From b3decffc39669769b80cb886912ce5626cb79c05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Sat, 10 Oct 2020 16:22:05 +0200 Subject: [PATCH] Add perfomrance check --- TODO.txt | 1 + dingux/My_settings.h | 6 + dingux/constants.h | 579 ++ dingux/game.h | 4819 +++++++++++ dingux/images.h | 1395 ++++ dingux/levels.h | 225 + dingux/mbed_config.h | 25 + .../mipsel-linux-uclibc/include/acl/libacl.h | 80 + .../include/attr/attributes.h | 200 + .../include/attr/error_context.h | 53 + .../include/attr/libattr.h | 46 + .../mipsel-linux-uclibc/include/blkid/blkid.h | 461 ++ .../opt/mipsel-linux-uclibc/include/com_err.h | 1 + .../opt/mipsel-linux-uclibc/include/e2p/e2p.h | 79 + .../mipsel-linux-uclibc/include/et/com_err.h | 68 + .../opt/mipsel-linux-uclibc/include/expat.h | 1085 +++ .../include/expat_config.h | 123 + .../include/expat_external.h | 162 + .../include/ext2fs/bitops.h | 703 ++ .../include/ext2fs/ext2_err.h | 196 + .../include/ext2fs/ext2_ext_attr.h | 73 + .../include/ext2fs/ext2_fs.h | 1104 +++ .../include/ext2fs/ext2_io.h | 163 + .../include/ext2fs/ext2_types.h | 205 + .../include/ext2fs/ext2fs.h | 1988 +++++ .../include/ext2fs/ext3_extents.h | 127 + .../include/ext2fs/qcow2.h | 113 + .../mipsel-linux-uclibc/include/ext2fs/tdb.h | 215 + .../include/gdb/jit-reader.h | 346 + .../mipsel-linux-uclibc/include/gettext-po.h | 357 + dingux/opt/mipsel-linux-uclibc/include/gmp.h | 2329 ++++++ .../include/libfdisk/libfdisk.h | 761 ++ .../include/libltdl/lt_dlloader.h | 91 + .../include/libltdl/lt_error.h | 86 + .../include/libltdl/lt_system.h | 166 + .../include/libmount/libmount.h | 956 +++ .../include/libsmartcols/libsmartcols.h | 309 + .../include/libxml2/libxml/DOCBparser.h | 96 + .../include/libxml2/libxml/HTMLparser.h | 306 + .../include/libxml2/libxml/HTMLtree.h | 147 + .../include/libxml2/libxml/SAX.h | 173 + .../include/libxml2/libxml/SAX2.h | 178 + .../include/libxml2/libxml/c14n.h | 126 + .../include/libxml2/libxml/catalog.h | 182 + .../include/libxml2/libxml/chvalid.h | 230 + .../include/libxml2/libxml/debugXML.h | 217 + .../include/libxml2/libxml/dict.h | 86 + .../include/libxml2/libxml/encoding.h | 245 + .../include/libxml2/libxml/entities.h | 151 + .../include/libxml2/libxml/globals.h | 508 ++ .../include/libxml2/libxml/hash.h | 236 + .../include/libxml2/libxml/list.h | 137 + .../include/libxml2/libxml/nanoftp.h | 163 + .../include/libxml2/libxml/nanohttp.h | 81 + .../include/libxml2/libxml/parser.h | 1241 +++ .../include/libxml2/libxml/parserInternals.h | 644 ++ .../include/libxml2/libxml/pattern.h | 100 + .../include/libxml2/libxml/relaxng.h | 217 + .../include/libxml2/libxml/schemasInternals.h | 958 +++ .../include/libxml2/libxml/schematron.h | 142 + .../include/libxml2/libxml/threads.h | 89 + .../include/libxml2/libxml/tree.h | 1311 +++ .../include/libxml2/libxml/uri.h | 94 + .../include/libxml2/libxml/valid.h | 458 ++ .../include/libxml2/libxml/xinclude.h | 129 + .../include/libxml2/libxml/xlink.h | 189 + .../include/libxml2/libxml/xmlIO.h | 366 + .../include/libxml2/libxml/xmlautomata.h | 146 + .../include/libxml2/libxml/xmlerror.h | 945 +++ .../include/libxml2/libxml/xmlexports.h | 162 + .../include/libxml2/libxml/xmlmemory.h | 224 + .../include/libxml2/libxml/xmlmodule.h | 57 + .../include/libxml2/libxml/xmlreader.h | 428 + .../include/libxml2/libxml/xmlregexp.h | 222 + .../include/libxml2/libxml/xmlsave.h | 88 + .../include/libxml2/libxml/xmlschemas.h | 246 + .../include/libxml2/libxml/xmlschemastypes.h | 151 + .../include/libxml2/libxml/xmlstring.h | 140 + .../include/libxml2/libxml/xmlunicode.h | 202 + .../include/libxml2/libxml/xmlversion.h | 486 ++ .../include/libxml2/libxml/xmlwriter.h | 488 ++ .../include/libxml2/libxml/xpath.h | 557 ++ .../include/libxml2/libxml/xpathInternals.h | 632 ++ .../include/libxml2/libxml/xpointer.h | 114 + dingux/opt/mipsel-linux-uclibc/include/ltdl.h | 163 + dingux/opt/mipsel-linux-uclibc/include/mpc.h | 269 + .../mipsel-linux-uclibc/include/mpf2mpfr.h | 175 + dingux/opt/mipsel-linux-uclibc/include/mpfr.h | 1059 +++ .../include/ncurses/curses.h | 1712 ++++ .../mipsel-linux-uclibc/include/ncurses/eti.h | 54 + .../include/ncurses/form.h | 428 + .../include/ncurses/menu.h | 260 + .../include/ncurses/nc_tparm.h | 77 + .../include/ncurses/ncurses.h | 1 + .../include/ncurses/ncurses_dll.h | 102 + .../include/ncurses/panel.h | 85 + .../include/ncurses/term.h | 806 ++ .../include/ncurses/term_entry.h | 192 + .../include/ncurses/termcap.h | 75 + .../mipsel-linux-uclibc/include/ncurses/tic.h | 341 + .../include/ncurses/unctrl.h | 67 + .../include/python2.7/Python-ast.h | 535 ++ .../include/python2.7/Python.h | 181 + .../include/python2.7/abstract.h | 1396 ++++ .../include/python2.7/asdl.h | 45 + .../include/python2.7/ast.h | 13 + .../include/python2.7/bitset.h | 32 + .../include/python2.7/boolobject.h | 36 + .../include/python2.7/bufferobject.h | 33 + .../include/python2.7/bytearrayobject.h | 57 + .../include/python2.7/bytes_methods.h | 75 + .../include/python2.7/bytesobject.h | 27 + .../include/python2.7/cStringIO.h | 73 + .../include/python2.7/cellobject.h | 28 + .../include/python2.7/ceval.h | 154 + .../include/python2.7/classobject.h | 83 + .../include/python2.7/cobject.h | 89 + .../include/python2.7/code.h | 116 + .../include/python2.7/codecs.h | 212 + .../include/python2.7/compile.h | 40 + .../include/python2.7/complexobject.h | 66 + .../include/python2.7/datetime.h | 239 + .../include/python2.7/descrobject.h | 94 + .../include/python2.7/dictobject.h | 160 + .../include/python2.7/dtoa.h | 15 + .../include/python2.7/enumobject.h | 17 + .../include/python2.7/errcode.h | 36 + .../include/python2.7/eval.h | 25 + .../include/python2.7/fileobject.h | 97 + .../include/python2.7/floatobject.h | 140 + .../include/python2.7/frameobject.h | 89 + .../include/python2.7/funcobject.h | 76 + .../include/python2.7/genobject.h | 40 + .../include/python2.7/graminit.h | 87 + .../include/python2.7/grammar.h | 93 + .../include/python2.7/import.h | 71 + .../include/python2.7/intobject.h | 81 + .../include/python2.7/intrcheck.h | 15 + .../include/python2.7/iterobject.h | 23 + .../include/python2.7/listobject.h | 68 + .../include/python2.7/longintrepr.h | 103 + .../include/python2.7/longobject.h | 135 + .../include/python2.7/marshal.h | 25 + .../include/python2.7/memoryobject.h | 74 + .../include/python2.7/metagrammar.h | 18 + .../include/python2.7/methodobject.h | 93 + .../include/python2.7/modsupport.h | 134 + .../include/python2.7/moduleobject.h | 24 + .../include/python2.7/node.h | 41 + .../include/python2.7/object.h | 1046 +++ .../include/python2.7/objimpl.h | 369 + .../include/python2.7/opcode.h | 171 + .../include/python2.7/osdefs.h | 63 + .../include/python2.7/parsetok.h | 64 + .../include/python2.7/patchlevel.h | 43 + .../include/python2.7/pgen.h | 18 + .../include/python2.7/pgenheaders.h | 42 + .../include/python2.7/py_curses.h | 177 + .../include/python2.7/pyarena.h | 62 + .../include/python2.7/pycapsule.h | 56 + .../include/python2.7/pyconfig.h | 1317 +++ .../include/python2.7/pyctype.h | 31 + .../include/python2.7/pydebug.h | 41 + .../include/python2.7/pyerrors.h | 329 + .../include/python2.7/pyexpat.h | 48 + .../include/python2.7/pyfpe.h | 176 + .../include/python2.7/pygetopt.h | 18 + .../include/python2.7/pymacconfig.h | 102 + .../include/python2.7/pymactoolbox.h | 232 + .../include/python2.7/pymath.h | 214 + .../include/python2.7/pymem.h | 122 + .../include/python2.7/pyport.h | 950 +++ .../include/python2.7/pystate.h | 200 + .../include/python2.7/pystrcmp.h | 23 + .../include/python2.7/pystrtod.h | 45 + .../include/python2.7/pythonrun.h | 181 + .../include/python2.7/pythread.h | 41 + .../include/python2.7/rangeobject.h | 28 + .../include/python2.7/setobject.h | 99 + .../include/python2.7/sliceobject.h | 50 + .../include/python2.7/stringobject.h | 210 + .../include/python2.7/structmember.h | 99 + .../include/python2.7/structseq.h | 41 + .../include/python2.7/symtable.h | 98 + .../include/python2.7/sysmodule.h | 31 + .../include/python2.7/timefuncs.h | 26 + .../include/python2.7/token.h | 85 + .../include/python2.7/traceback.h | 31 + .../include/python2.7/tupleobject.h | 61 + .../include/python2.7/ucnhash.h | 33 + .../include/python2.7/unicodeobject.h | 1413 ++++ .../include/python2.7/warnings.h | 23 + .../include/python2.7/weakrefobject.h | 82 + .../opt/mipsel-linux-uclibc/include/ss/ss.h | 96 + .../mipsel-linux-uclibc/include/ss/ss_err.h | 30 + .../opt/mipsel-linux-uclibc/include/sys/acl.h | 128 + .../include/unicode/alphaindex.h | 755 ++ .../include/unicode/appendable.h | 234 + .../include/unicode/basictz.h | 216 + .../include/unicode/brkiter.h | 661 ++ .../include/unicode/bytestream.h | 272 + .../include/unicode/bytestrie.h | 520 ++ .../include/unicode/bytestriebuilder.h | 183 + .../include/unicode/calendar.h | 2551 ++++++ .../include/unicode/caniter.h | 210 + .../include/unicode/casemap.h | 496 ++ .../include/unicode/char16ptr.h | 306 + .../include/unicode/chariter.h | 728 ++ .../include/unicode/choicfmt.h | 596 ++ .../include/unicode/coleitr.h | 407 + .../include/unicode/coll.h | 1274 +++ .../include/unicode/compactdecimalformat.h | 415 + .../include/unicode/curramt.h | 132 + .../include/unicode/currpinf.h | 261 + .../include/unicode/currunit.h | 130 + .../include/unicode/datefmt.h | 952 +++ .../include/unicode/dbbi.h | 42 + .../include/unicode/dcfmtsym.h | 530 ++ .../include/unicode/decimfmt.h | 2280 ++++++ .../include/unicode/docmain.h | 222 + .../include/unicode/dtfmtsym.h | 1015 +++ .../include/unicode/dtintrv.h | 160 + .../include/unicode/dtitvfmt.h | 1046 +++ .../include/unicode/dtitvinf.h | 520 ++ .../include/unicode/dtptngen.h | 569 ++ .../include/unicode/dtrule.h | 252 + .../include/unicode/edits.h | 422 + .../include/unicode/enumset.h | 66 + .../include/unicode/errorcode.h | 139 + .../include/unicode/fieldpos.h | 294 + .../include/unicode/filteredbrk.h | 153 + .../include/unicode/fmtable.h | 762 ++ .../include/unicode/format.h | 307 + .../include/unicode/fpositer.h | 127 + .../include/unicode/gender.h | 113 + .../include/unicode/gregocal.h | 779 ++ .../include/unicode/icudataver.h | 43 + .../include/unicode/icuplug.h | 388 + .../include/unicode/idna.h | 325 + .../include/unicode/listformatter.h | 171 + .../include/unicode/localpointer.h | 524 ++ .../include/unicode/locdspnm.h | 207 + .../include/unicode/locid.h | 815 ++ .../include/unicode/measfmt.h | 399 + .../include/unicode/measunit.h | 1343 ++++ .../include/unicode/measure.h | 161 + .../include/unicode/messagepattern.h | 945 +++ .../include/unicode/msgfmt.h | 1095 +++ .../include/unicode/normalizer2.h | 774 ++ .../include/unicode/normlzr.h | 809 ++ .../include/unicode/nounit.h | 111 + .../include/unicode/numberformatter.h | 1998 +++++ .../include/unicode/numfmt.h | 1227 +++ .../include/unicode/numsys.h | 210 + .../include/unicode/parseerr.h | 94 + .../include/unicode/parsepos.h | 232 + .../include/unicode/platform.h | 863 ++ .../include/unicode/plurfmt.h | 617 ++ .../include/unicode/plurrule.h | 531 ++ .../include/unicode/ptypes.h | 128 + .../include/unicode/putil.h | 183 + .../include/unicode/rbbi.h | 717 ++ .../include/unicode/rbnf.h | 1140 +++ .../include/unicode/rbtz.h | 364 + .../include/unicode/regex.h | 1885 +++++ .../include/unicode/region.h | 224 + .../include/unicode/reldatefmt.h | 522 ++ .../mipsel-linux-uclibc/include/unicode/rep.h | 263 + .../include/unicode/resbund.h | 492 ++ .../include/unicode/schriter.h | 189 + .../unicode/scientificnumberformatter.h | 222 + .../include/unicode/search.h | 577 ++ .../include/unicode/selfmt.h | 369 + .../include/unicode/simpleformatter.h | 303 + .../include/unicode/simpletz.h | 930 +++ .../include/unicode/smpdtfmt.h | 1630 ++++ .../include/unicode/sortkey.h | 340 + .../include/unicode/std_string.h | 37 + .../include/unicode/strenum.h | 278 + .../include/unicode/stringoptions.h | 198 + .../include/unicode/stringpiece.h | 224 + .../include/unicode/stringtriebuilder.h | 414 + .../include/unicode/stsearch.h | 506 ++ .../include/unicode/symtable.h | 114 + .../include/unicode/tblcoll.h | 877 ++ .../include/unicode/timezone.h | 965 +++ .../include/unicode/tmunit.h | 137 + .../include/unicode/tmutamt.h | 170 + .../include/unicode/tmutfmt.h | 248 + .../include/unicode/translit.h | 1344 ++++ .../include/unicode/tzfmt.h | 1097 +++ .../include/unicode/tznames.h | 414 + .../include/unicode/tzrule.h | 830 ++ .../include/unicode/tztrans.h | 197 + .../include/unicode/ubidi.h | 2201 +++++ .../include/unicode/ubiditransform.h | 318 + .../include/unicode/ubrk.h | 634 ++ .../include/unicode/ucal.h | 1564 ++++ .../include/unicode/ucasemap.h | 385 + .../include/unicode/ucat.h | 160 + .../include/unicode/uchar.h | 3732 +++++++++ .../include/unicode/ucharstrie.h | 578 ++ .../include/unicode/ucharstriebuilder.h | 187 + .../include/unicode/uchriter.h | 387 + .../include/unicode/uclean.h | 262 + .../include/unicode/ucnv.h | 2043 +++++ .../include/unicode/ucnv_cb.h | 164 + .../include/unicode/ucnv_err.h | 465 ++ .../include/unicode/ucnvsel.h | 189 + .../include/unicode/ucol.h | 1497 ++++ .../include/unicode/ucoleitr.h | 268 + .../include/unicode/uconfig.h | 455 ++ .../include/unicode/ucsdet.h | 419 + .../include/unicode/ucurr.h | 420 + .../include/unicode/udat.h | 1660 ++++ .../include/unicode/udata.h | 437 + .../include/unicode/udateintervalformat.h | 186 + .../include/unicode/udatpg.h | 605 ++ .../include/unicode/udisplaycontext.h | 172 + .../include/unicode/uenum.h | 210 + .../include/unicode/ufieldpositer.h | 121 + .../include/unicode/uformattable.h | 288 + .../include/unicode/ugender.h | 84 + .../include/unicode/uidna.h | 772 ++ .../include/unicode/uiter.h | 709 ++ .../include/unicode/uldnames.h | 304 + .../include/unicode/ulistformatter.h | 130 + .../include/unicode/uloc.h | 1272 +++ .../include/unicode/ulocdata.h | 296 + .../include/unicode/umachine.h | 420 + .../include/unicode/umisc.h | 62 + .../include/unicode/umsg.h | 625 ++ .../include/unicode/unifilt.h | 122 + .../include/unicode/unifunct.h | 127 + .../include/unicode/unimatch.h | 165 + .../include/unicode/unirepl.h | 99 + .../include/unicode/uniset.h | 1715 ++++ .../include/unicode/unistr.h | 4807 +++++++++++ .../include/unicode/unorm.h | 472 ++ .../include/unicode/unorm2.h | 603 ++ .../include/unicode/unum.h | 1439 ++++ .../include/unicode/unumsys.h | 172 + .../include/unicode/uobject.h | 322 + .../include/unicode/upluralrules.h | 196 + .../include/unicode/uregex.h | 1614 ++++ .../include/unicode/uregion.h | 252 + .../include/unicode/ureldatefmt.h | 365 + .../include/unicode/urename.h | 1820 +++++ .../include/unicode/urep.h | 157 + .../include/unicode/ures.h | 908 +++ .../include/unicode/uscript.h | 675 ++ .../include/unicode/usearch.h | 891 ++ .../include/unicode/uset.h | 1130 +++ .../include/unicode/usetiter.h | 320 + .../include/unicode/ushape.h | 476 ++ .../include/unicode/uspoof.h | 1576 ++++ .../include/unicode/usprep.h | 271 + .../include/unicode/ustring.h | 1692 ++++ .../include/unicode/ustringtrie.h | 97 + .../include/unicode/utext.h | 1602 ++++ .../mipsel-linux-uclibc/include/unicode/utf.h | 225 + .../include/unicode/utf16.h | 745 ++ .../include/unicode/utf32.h | 25 + .../include/unicode/utf8.h | 836 ++ .../include/unicode/utf_old.h | 1204 +++ .../include/unicode/utmscale.h | 490 ++ .../include/unicode/utrace.h | 379 + .../include/unicode/utrans.h | 658 ++ .../include/unicode/utypes.h | 701 ++ .../include/unicode/uvernum.h | 171 + .../include/unicode/uversion.h | 195 + .../include/unicode/vtzone.h | 457 ++ .../mipsel-linux-uclibc/include/uuid/uuid.h | 121 + .../opt/mipsel-linux-uclibc/include/zconf.h | 534 ++ dingux/opt/mipsel-linux-uclibc/include/zlib.h | 1912 +++++ .../7.3.0/include-fixed/limits.h | 197 + .../7.3.0/include-fixed/syslimits.h | 8 + .../7.3.0/include/float.h | 506 ++ .../7.3.0/include/gcov.h | 41 + .../7.3.0/include/iso646.h | 45 + .../7.3.0/include/loongson.h | 690 ++ .../7.3.0/include/msa.h | 582 ++ .../7.3.0/include/stdalign.h | 39 + .../7.3.0/include/stdarg.h | 127 + .../7.3.0/include/stdatomic.h | 243 + .../7.3.0/include/stdbool.h | 54 + .../7.3.0/include/stddef.h | 451 ++ .../7.3.0/include/stdfix.h | 204 + .../7.3.0/include/stdint-gcc.h | 364 + .../7.3.0/include/stdint.h | 14 + .../7.3.0/include/stdnoreturn.h | 35 + .../7.3.0/include/unwind.h | 291 + .../7.3.0/include/varargs.h | 7 + .../7.3.0/install-tools/gsyslimits.h | 8 + .../7.3.0/install-tools/include/limits.h | 197 + .../7.3.0/plugin/include/addresses.h | 89 + .../7.3.0/plugin/include/alias.h | 47 + .../7.3.0/plugin/include/alloc-pool.h | 566 ++ .../7.3.0/plugin/include/ansidecl.h | 355 + .../7.3.0/plugin/include/asan.h | 164 + .../7.3.0/plugin/include/attribs.h | 44 + .../7.3.0/plugin/include/auto-host.h | 2419 ++++++ .../7.3.0/plugin/include/auto-profile.h | 31 + .../7.3.0/plugin/include/backend.h | 35 + .../7.3.0/plugin/include/basic-block.h | 652 ++ .../7.3.0/plugin/include/bb-reorder.h | 40 + .../7.3.0/plugin/include/bitmap.h | 826 ++ .../7.3.0/plugin/include/builtins.h | 105 + .../7.3.0/plugin/include/bversion.h | 4 + .../7.3.0/plugin/include/c-family/c-common.h | 1566 ++++ .../7.3.0/plugin/include/c-family/c-objc.h | 114 + .../7.3.0/plugin/include/c-family/c-pragma.h | 259 + .../plugin/include/c-family/c-pretty-print.h | 139 + .../7.3.0/plugin/include/c-tree.h | 761 ++ .../7.3.0/plugin/include/calls.h | 43 + .../7.3.0/plugin/include/ccmp.h | 25 + .../7.3.0/plugin/include/cfg.h | 121 + .../7.3.0/plugin/include/cfganal.h | 81 + .../7.3.0/plugin/include/cfgbuild.h | 28 + .../7.3.0/plugin/include/cfgcleanup.h | 34 + .../7.3.0/plugin/include/cfgexpand.h | 28 + .../7.3.0/plugin/include/cfghooks.h | 272 + .../7.3.0/plugin/include/cfgloop.h | 854 ++ .../7.3.0/plugin/include/cfgloopmanip.h | 64 + .../7.3.0/plugin/include/cfgrtl.h | 58 + .../7.3.0/plugin/include/cgraph.h | 3294 ++++++++ .../7.3.0/plugin/include/cilk.h | 109 + .../7.3.0/plugin/include/collect-utils.h | 49 + .../7.3.0/plugin/include/collect2-aix.h | 306 + .../7.3.0/plugin/include/collect2.h | 45 + .../7.3.0/plugin/include/conditions.h | 118 + .../7.3.0/plugin/include/config.h | 10 + .../7.3.0/plugin/include/config/dbxelf.h | 68 + .../7.3.0/plugin/include/config/elfos.h | 465 ++ .../plugin/include/config/glibc-stdint.h | 61 + .../7.3.0/plugin/include/config/gnu-user.h | 171 + .../plugin/include/config/initfini-array.h | 45 + .../plugin/include/config/linux-android.h | 59 + .../plugin/include/config/linux-protos.h | 22 + .../7.3.0/plugin/include/config/linux.h | 210 + .../plugin/include/config/mips/gnu-user.h | 149 + .../plugin/include/config/mips/linux-common.h | 64 + .../7.3.0/plugin/include/config/mips/linux.h | 52 + .../plugin/include/config/mips/mips-opts.h | 56 + .../plugin/include/config/mips/mips-protos.h | 396 + .../7.3.0/plugin/include/config/mips/mips.h | 3469 ++++++++ .../plugin/include/config/vxworks-dummy.h | 40 + .../7.3.0/plugin/include/configargs.h | 7 + .../7.3.0/plugin/include/context.h | 63 + .../7.3.0/plugin/include/convert.h | 43 + .../7.3.0/plugin/include/coretypes.h | 376 + .../7.3.0/plugin/include/coverage.h | 62 + .../7.3.0/plugin/include/cp/cp-tree.h | 7101 ++++++++++++++++ .../plugin/include/cp/cxx-pretty-print.h | 113 + .../7.3.0/plugin/include/cp/name-lookup.h | 379 + .../7.3.0/plugin/include/cp/type-utils.h | 55 + .../7.3.0/plugin/include/cppbuiltin.h | 33 + .../7.3.0/plugin/include/cppdefault.h | 71 + .../7.3.0/plugin/include/cpplib.h | 1199 +++ .../7.3.0/plugin/include/cselib.h | 140 + .../7.3.0/plugin/include/data-streamer.h | 323 + .../7.3.0/plugin/include/dbgcnt.h | 39 + .../7.3.0/plugin/include/dbxout.h | 61 + .../7.3.0/plugin/include/dce.h | 27 + .../7.3.0/plugin/include/ddg.h | 185 + .../7.3.0/plugin/include/debug.h | 245 + .../7.3.0/plugin/include/defaults.h | 1478 ++++ .../7.3.0/plugin/include/df.h | 1246 +++ .../7.3.0/plugin/include/dfp.h | 50 + .../7.3.0/plugin/include/diagnostic-color.h | 65 + .../7.3.0/plugin/include/diagnostic-core.h | 105 + .../7.3.0/plugin/include/diagnostic.h | 381 + .../7.3.0/plugin/include/dojump.h | 81 + .../7.3.0/plugin/include/dominance.h | 94 + .../7.3.0/plugin/include/domwalk.h | 77 + .../7.3.0/plugin/include/double-int.h | 470 ++ .../7.3.0/plugin/include/dumpfile.h | 262 + .../7.3.0/plugin/include/dwarf2asm.h | 96 + .../7.3.0/plugin/include/dwarf2out.h | 380 + .../7.3.0/plugin/include/edit-context.h | 68 + .../7.3.0/plugin/include/emit-rtl.h | 515 ++ .../7.3.0/plugin/include/errors.h | 40 + .../7.3.0/plugin/include/et-forest.h | 85 + .../7.3.0/plugin/include/except.h | 335 + .../7.3.0/plugin/include/explow.h | 127 + .../7.3.0/plugin/include/expmed.h | 733 ++ .../7.3.0/plugin/include/expr.h | 316 + .../7.3.0/plugin/include/fibonacci_heap.h | 651 ++ .../7.3.0/plugin/include/file-find.h | 47 + .../7.3.0/plugin/include/filenames.h | 99 + .../7.3.0/plugin/include/fixed-value.h | 112 + .../7.3.0/plugin/include/flag-types.h | 311 + .../7.3.0/plugin/include/flags.h | 98 + .../7.3.0/plugin/include/fold-const-call.h | 29 + .../7.3.0/plugin/include/fold-const.h | 207 + .../7.3.0/plugin/include/function.h | 659 ++ .../7.3.0/plugin/include/gcc-plugin.h | 47 + .../7.3.0/plugin/include/gcc-rich-location.h | 45 + .../7.3.0/plugin/include/gcc-symtab.h | 28 + .../7.3.0/plugin/include/gcc.h | 102 + .../7.3.0/plugin/include/gcov-io.h | 424 + .../7.3.0/plugin/include/gcse-common.h | 47 + .../7.3.0/plugin/include/gcse.h | 45 + .../7.3.0/plugin/include/generic-match.h | 33 + .../7.3.0/plugin/include/gengtype.h | 510 ++ .../7.3.0/plugin/include/genrtl.h | 1212 +++ .../7.3.0/plugin/include/gensupport.h | 227 + .../7.3.0/plugin/include/ggc-internal.h | 118 + .../7.3.0/plugin/include/ggc.h | 327 + .../7.3.0/plugin/include/gimple-builder.h | 34 + .../7.3.0/plugin/include/gimple-expr.h | 176 + .../7.3.0/plugin/include/gimple-fold.h | 143 + .../7.3.0/plugin/include/gimple-iterator.h | 391 + .../7.3.0/plugin/include/gimple-low.h | 28 + .../7.3.0/plugin/include/gimple-match.h | 70 + .../7.3.0/plugin/include/gimple-predict.h | 83 + .../plugin/include/gimple-pretty-print.h | 39 + .../7.3.0/plugin/include/gimple-ssa.h | 201 + .../7.3.0/plugin/include/gimple-streamer.h | 34 + .../7.3.0/plugin/include/gimple-walk.h | 101 + .../7.3.0/plugin/include/gimple.h | 6363 +++++++++++++++ .../7.3.0/plugin/include/gimplify-me.h | 37 + .../7.3.0/plugin/include/gimplify.h | 107 + .../7.3.0/plugin/include/glimits.h | 152 + .../7.3.0/plugin/include/graph.h | 27 + .../7.3.0/plugin/include/graphds.h | 66 + .../7.3.0/plugin/include/graphite.h | 462 ++ .../7.3.0/plugin/include/gstab.h | 35 + .../7.3.0/plugin/include/gsyms.h | 97 + .../7.3.0/plugin/include/gsyslimits.h | 8 + .../7.3.0/plugin/include/gtype-desc.h | 3249 ++++++++ .../7.3.0/plugin/include/hard-reg-set.h | 773 ++ .../7.3.0/plugin/include/hash-map-traits.h | 181 + .../7.3.0/plugin/include/hash-map.h | 268 + .../7.3.0/plugin/include/hash-set.h | 149 + .../7.3.0/plugin/include/hash-table.h | 1110 +++ .../7.3.0/plugin/include/hash-traits.h | 309 + .../7.3.0/plugin/include/hashtab.h | 204 + .../plugin/include/highlev-plugin-common.h | 33 + .../7.3.0/plugin/include/hooks.h | 116 + .../7.3.0/plugin/include/hosthooks-def.h | 51 + .../7.3.0/plugin/include/hosthooks.h | 48 + .../7.3.0/plugin/include/hsa-brig-format.h | 1234 +++ .../7.3.0/plugin/include/hsa-common.h | 1412 ++++ .../7.3.0/plugin/include/hw-doloop.h | 160 + .../7.3.0/plugin/include/hwint.h | 336 + .../7.3.0/plugin/include/ifcvt.h | 113 + .../7.3.0/plugin/include/inchash.h | 186 + .../7.3.0/plugin/include/incpath.h | 39 + .../7.3.0/plugin/include/input.h | 156 + .../7.3.0/plugin/include/insn-addr.h | 63 + .../7.3.0/plugin/include/insn-codes.h | 1664 ++++ .../7.3.0/plugin/include/insn-constants.h | 373 + .../7.3.0/plugin/include/insn-flags.h | 3440 ++++++++ .../7.3.0/plugin/include/insn-modes.h | 645 ++ .../7.3.0/plugin/include/internal-fn.h | 183 + .../7.3.0/plugin/include/intl.h | 69 + .../7.3.0/plugin/include/ipa-chkp.h | 29 + .../7.3.0/plugin/include/ipa-icf-gimple.h | 278 + .../7.3.0/plugin/include/ipa-icf.h | 637 ++ .../7.3.0/plugin/include/ipa-inline.h | 351 + .../7.3.0/plugin/include/ipa-prop.h | 857 ++ .../7.3.0/plugin/include/ipa-ref.h | 138 + .../7.3.0/plugin/include/ipa-reference.h | 36 + .../7.3.0/plugin/include/ipa-utils.h | 266 + .../7.3.0/plugin/include/ira-int.h | 1511 ++++ .../7.3.0/plugin/include/ira.h | 224 + .../7.3.0/plugin/include/is-a.h | 239 + .../7.3.0/plugin/include/langhooks-def.h | 347 + .../7.3.0/plugin/include/langhooks.h | 564 ++ .../7.3.0/plugin/include/lcm.h | 34 + .../7.3.0/plugin/include/libfuncs.h | 84 + .../7.3.0/plugin/include/libiberty.h | 750 ++ .../7.3.0/plugin/include/limitx.h | 35 + .../7.3.0/plugin/include/limity.h | 10 + .../7.3.0/plugin/include/line-map.h | 1915 +++++ .../7.3.0/plugin/include/loop-unroll.h | 27 + .../7.3.0/plugin/include/lower-subreg.h | 60 + .../7.3.0/plugin/include/lra-int.h | 526 ++ .../7.3.0/plugin/include/lra.h | 44 + .../7.3.0/plugin/include/lto-compress.h | 42 + .../7.3.0/plugin/include/lto-section-names.h | 41 + .../7.3.0/plugin/include/lto-streamer.h | 1228 +++ .../7.3.0/plugin/include/machmode.h | 375 + .../7.3.0/plugin/include/md5.h | 154 + .../7.3.0/plugin/include/mem-stats-traits.h | 41 + .../7.3.0/plugin/include/mem-stats.h | 636 ++ .../7.3.0/plugin/include/memmodel.h | 114 + .../7.3.0/plugin/include/memory-block.h | 76 + .../7.3.0/plugin/include/obstack.h | 535 ++ .../7.3.0/plugin/include/omp-expand.h | 32 + .../7.3.0/plugin/include/omp-general.h | 93 + .../7.3.0/plugin/include/omp-grid.h | 27 + .../7.3.0/plugin/include/omp-low.h | 31 + .../7.3.0/plugin/include/omp-offload.h | 30 + .../7.3.0/plugin/include/optabs-libfuncs.h | 77 + .../7.3.0/plugin/include/optabs-query.h | 182 + .../7.3.0/plugin/include/optabs-tree.h | 45 + .../7.3.0/plugin/include/optabs.h | 351 + .../7.3.0/plugin/include/options.h | 7078 ++++++++++++++++ .../7.3.0/plugin/include/opts-diagnostic.h | 25 + .../7.3.0/plugin/include/opts.h | 435 + .../7.3.0/plugin/include/output.h | 618 ++ .../7.3.0/plugin/include/params-enum.h | 39 + .../7.3.0/plugin/include/params-list.h | 26 + .../7.3.0/plugin/include/params-options.h | 27 + .../7.3.0/plugin/include/params.h | 250 + .../7.3.0/plugin/include/pass_manager.h | 152 + .../7.3.0/plugin/include/plugin-api.h | 457 ++ .../7.3.0/plugin/include/plugin-version.h | 18 + .../7.3.0/plugin/include/plugin.h | 205 + .../7.3.0/plugin/include/predict.h | 96 + .../7.3.0/plugin/include/prefix.h | 40 + .../7.3.0/plugin/include/pretty-print.h | 389 + .../7.3.0/plugin/include/print-rtl.h | 162 + .../7.3.0/plugin/include/print-tree.h | 47 + .../7.3.0/plugin/include/profile.h | 59 + .../7.3.0/plugin/include/read-md.h | 343 + .../7.3.0/plugin/include/read-rtl-function.h | 28 + .../7.3.0/plugin/include/real.h | 521 ++ .../7.3.0/plugin/include/realmpfr.h | 41 + .../7.3.0/plugin/include/recog.h | 415 + .../7.3.0/plugin/include/regcprop.h | 25 + .../7.3.0/plugin/include/regrename.h | 107 + .../7.3.0/plugin/include/regs.h | 389 + .../7.3.0/plugin/include/regset.h | 124 + .../7.3.0/plugin/include/reload.h | 465 ++ .../7.3.0/plugin/include/resource.h | 54 + .../7.3.0/plugin/include/rtl-chkp.h | 38 + .../7.3.0/plugin/include/rtl-error.h | 31 + .../7.3.0/plugin/include/rtl-iter.h | 291 + .../7.3.0/plugin/include/rtl.h | 3840 +++++++++ .../7.3.0/plugin/include/rtlhash.h | 31 + .../7.3.0/plugin/include/rtlhooks-def.h | 50 + .../7.3.0/plugin/include/run-rtl-passes.h | 25 + .../7.3.0/plugin/include/safe-ctype.h | 150 + .../7.3.0/plugin/include/sbitmap.h | 287 + .../7.3.0/plugin/include/sched-int.h | 1691 ++++ .../7.3.0/plugin/include/sdbout.h | 26 + .../7.3.0/plugin/include/sel-sched-dump.h | 233 + .../7.3.0/plugin/include/sel-sched-ir.h | 1671 ++++ .../7.3.0/plugin/include/sel-sched.h | 27 + .../7.3.0/plugin/include/selftest-rtl.h | 91 + .../7.3.0/plugin/include/selftest.h | 326 + .../7.3.0/plugin/include/sese.h | 350 + .../7.3.0/plugin/include/shrink-wrap.h | 34 + .../7.3.0/plugin/include/signop.h | 33 + .../7.3.0/plugin/include/sparseset.h | 219 + .../7.3.0/plugin/include/spellcheck-tree.h | 77 + .../7.3.0/plugin/include/spellcheck.h | 192 + .../7.3.0/plugin/include/splay-tree.h | 156 + .../7.3.0/plugin/include/sreal.h | 271 + .../7.3.0/plugin/include/ssa-iterators.h | 1004 +++ .../7.3.0/plugin/include/ssa.h | 33 + .../7.3.0/plugin/include/statistics.h | 71 + .../7.3.0/plugin/include/stmt.h | 53 + .../7.3.0/plugin/include/stor-layout.h | 120 + .../7.3.0/plugin/include/streamer-hooks.h | 82 + .../7.3.0/plugin/include/stringpool.h | 43 + .../plugin/include/substring-locations.h | 102 + .../7.3.0/plugin/include/symbol-summary.h | 254 + .../7.3.0/plugin/include/symtab.h | 103 + .../7.3.0/plugin/include/system.h | 1172 +++ .../7.3.0/plugin/include/target-def.h | 110 + .../7.3.0/plugin/include/target-globals.h | 91 + .../plugin/include/target-hooks-macros.h | 80 + .../7.3.0/plugin/include/target.h | 232 + .../7.3.0/plugin/include/targhooks.h | 267 + .../7.3.0/plugin/include/timevar.h | 261 + .../7.3.0/plugin/include/tm-preds.h | 354 + .../7.3.0/plugin/include/tm.h | 57 + .../7.3.0/plugin/include/tm_p.h | 8 + .../7.3.0/plugin/include/toplev.h | 98 + .../7.3.0/plugin/include/tracer.h | 26 + .../7.3.0/plugin/include/trans-mem.h | 52 + .../7.3.0/plugin/include/tree-affine.h | 104 + .../7.3.0/plugin/include/tree-cfg.h | 121 + .../7.3.0/plugin/include/tree-cfgcleanup.h | 28 + .../7.3.0/plugin/include/tree-check.h | 356 + .../7.3.0/plugin/include/tree-chkp.h | 64 + .../7.3.0/plugin/include/tree-chrec.h | 257 + .../7.3.0/plugin/include/tree-core.h | 2100 +++++ .../7.3.0/plugin/include/tree-data-ref.h | 561 ++ .../7.3.0/plugin/include/tree-dfa.h | 42 + .../7.3.0/plugin/include/tree-diagnostic.h | 60 + .../7.3.0/plugin/include/tree-dump.h | 93 + .../7.3.0/plugin/include/tree-eh.h | 55 + .../7.3.0/plugin/include/tree-hash-traits.h | 84 + .../7.3.0/plugin/include/tree-hasher.h | 65 + .../7.3.0/plugin/include/tree-if-conv.h | 24 + .../7.3.0/plugin/include/tree-inline.h | 231 + .../7.3.0/plugin/include/tree-into-ssa.h | 53 + .../7.3.0/plugin/include/tree-iterator.h | 123 + .../7.3.0/plugin/include/tree-nested.h | 27 + .../7.3.0/plugin/include/tree-object-size.h | 27 + .../7.3.0/plugin/include/tree-outof-ssa.h | 78 + .../7.3.0/plugin/include/tree-parloops.h | 25 + .../7.3.0/plugin/include/tree-pass.h | 654 ++ .../7.3.0/plugin/include/tree-phinodes.h | 68 + .../7.3.0/plugin/include/tree-pretty-print.h | 54 + .../plugin/include/tree-scalar-evolution.h | 74 + .../7.3.0/plugin/include/tree-ssa-address.h | 32 + .../7.3.0/plugin/include/tree-ssa-alias.h | 188 + .../7.3.0/plugin/include/tree-ssa-ccp.h | 29 + .../7.3.0/plugin/include/tree-ssa-coalesce.h | 27 + .../7.3.0/plugin/include/tree-ssa-dom.h | 28 + .../7.3.0/plugin/include/tree-ssa-live.h | 313 + .../plugin/include/tree-ssa-loop-ivopts.h | 36 + .../plugin/include/tree-ssa-loop-manip.h | 61 + .../plugin/include/tree-ssa-loop-niter.h | 58 + .../7.3.0/plugin/include/tree-ssa-loop.h | 82 + .../7.3.0/plugin/include/tree-ssa-operands.h | 122 + .../7.3.0/plugin/include/tree-ssa-propagate.h | 88 + .../7.3.0/plugin/include/tree-ssa-sccvn.h | 300 + .../plugin/include/tree-ssa-scopedtables.h | 207 + .../7.3.0/plugin/include/tree-ssa-ter.h | 26 + .../plugin/include/tree-ssa-threadbackward.h | 25 + .../plugin/include/tree-ssa-threadedge.h | 39 + .../plugin/include/tree-ssa-threadupdate.h | 63 + .../7.3.0/plugin/include/tree-ssa.h | 92 + .../7.3.0/plugin/include/tree-ssanames.h | 156 + .../7.3.0/plugin/include/tree-stdarg.h | 36 + .../7.3.0/plugin/include/tree-streamer.h | 124 + .../7.3.0/plugin/include/tree-vectorizer.h | 1219 +++ .../7.3.0/plugin/include/tree-vrp.h | 59 + .../7.3.0/plugin/include/tree.h | 5503 +++++++++++++ .../7.3.0/plugin/include/tsan.h | 26 + .../7.3.0/plugin/include/tsystem.h | 137 + .../7.3.0/plugin/include/typeclass.h | 43 + .../7.3.0/plugin/include/typed-splay-tree.h | 197 + .../7.3.0/plugin/include/ubsan.h | 69 + .../7.3.0/plugin/include/valtrack.h | 139 + .../7.3.0/plugin/include/value-prof.h | 120 + .../7.3.0/plugin/include/varasm.h | 82 + .../7.3.0/plugin/include/vec.h | 1772 ++++ .../7.3.0/plugin/include/version.h | 6 + .../7.3.0/plugin/include/vmsdbg.h | 249 + .../7.3.0/plugin/include/vtable-verify.h | 143 + .../7.3.0/plugin/include/wide-int-print.h | 38 + .../7.3.0/plugin/include/wide-int.h | 3277 ++++++++ .../7.3.0/plugin/include/xcoff.h | 40 + .../7.3.0/plugin/include/xcoffout.h | 194 + .../include/c++/7.3.0/backward/auto_ptr.h | 333 + .../c++/7.3.0/backward/backward_warning.h | 60 + .../include/c++/7.3.0/backward/binders.h | 182 + .../include/c++/7.3.0/backward/hash_fun.h | 170 + .../include/c++/7.3.0/backward/hashtable.h | 1167 +++ .../include/c++/7.3.0/bits/algorithmfwd.h | 855 ++ .../include/c++/7.3.0/bits/alloc_traits.h | 605 ++ .../include/c++/7.3.0/bits/allocated_ptr.h | 111 + .../include/c++/7.3.0/bits/allocator.h | 247 + .../include/c++/7.3.0/bits/atomic_base.h | 796 ++ .../include/c++/7.3.0/bits/atomic_futex.h | 290 + .../c++/7.3.0/bits/atomic_lockfree_defines.h | 63 + .../include/c++/7.3.0/bits/basic_ios.h | 518 ++ .../include/c++/7.3.0/bits/basic_string.h | 6694 +++++++++++++++ .../c++/7.3.0/bits/boost_concept_check.h | 790 ++ .../include/c++/7.3.0/bits/c++0x_warning.h | 37 + .../include/c++/7.3.0/bits/c++14_warning.h | 37 + .../include/c++/7.3.0/bits/char_traits.h | 706 ++ .../include/c++/7.3.0/bits/codecvt.h | 681 ++ .../include/c++/7.3.0/bits/concept_check.h | 81 + .../include/c++/7.3.0/bits/cpp_type_traits.h | 415 + .../include/c++/7.3.0/bits/cxxabi_forced.h | 60 + .../c++/7.3.0/bits/cxxabi_init_exception.h | 77 + .../c++/7.3.0/bits/enable_special_members.h | 312 + .../include/c++/7.3.0/bits/exception.h | 78 + .../c++/7.3.0/bits/exception_defines.h | 45 + .../include/c++/7.3.0/bits/exception_ptr.h | 224 + .../include/c++/7.3.0/bits/forward_list.h | 1435 ++++ .../include/c++/7.3.0/bits/functexcept.h | 110 + .../include/c++/7.3.0/bits/functional_hash.h | 274 + .../include/c++/7.3.0/bits/gslice.h | 185 + .../include/c++/7.3.0/bits/gslice_array.h | 218 + .../include/c++/7.3.0/bits/hash_bytes.h | 59 + .../include/c++/7.3.0/bits/hashtable.h | 2216 +++++ .../include/c++/7.3.0/bits/hashtable_policy.h | 2129 +++++ .../include/c++/7.3.0/bits/indirect_array.h | 212 + .../include/c++/7.3.0/bits/invoke.h | 104 + .../include/c++/7.3.0/bits/ios_base.h | 1079 +++ .../include/c++/7.3.0/bits/locale_classes.h | 853 ++ .../include/c++/7.3.0/bits/locale_conv.h | 549 ++ .../include/c++/7.3.0/bits/locale_facets.h | 2653 ++++++ .../c++/7.3.0/bits/locale_facets_nonio.h | 2015 +++++ .../include/c++/7.3.0/bits/localefwd.h | 206 + .../include/c++/7.3.0/bits/mask_array.h | 208 + .../include/c++/7.3.0/bits/memoryfwd.h | 78 + .../include/c++/7.3.0/bits/move.h | 225 + .../include/c++/7.3.0/bits/nested_exception.h | 161 + .../include/c++/7.3.0/bits/node_handle.h | 293 + .../include/c++/7.3.0/bits/ostream_insert.h | 129 + .../include/c++/7.3.0/bits/parse_numbers.h | 288 + .../include/c++/7.3.0/bits/postypes.h | 242 + .../include/c++/7.3.0/bits/predefined_ops.h | 362 + .../include/c++/7.3.0/bits/ptr_traits.h | 154 + .../include/c++/7.3.0/bits/quoted_string.h | 164 + .../include/c++/7.3.0/bits/random.h | 6000 ++++++++++++++ .../include/c++/7.3.0/bits/range_access.h | 328 + .../include/c++/7.3.0/bits/refwrap.h | 398 + .../include/c++/7.3.0/bits/regex.h | 2802 +++++++ .../include/c++/7.3.0/bits/regex_automaton.h | 400 + .../include/c++/7.3.0/bits/regex_compiler.h | 583 ++ .../include/c++/7.3.0/bits/regex_constants.h | 417 + .../include/c++/7.3.0/bits/regex_error.h | 177 + .../include/c++/7.3.0/bits/regex_executor.h | 258 + .../include/c++/7.3.0/bits/regex_scanner.h | 272 + .../include/c++/7.3.0/bits/shared_ptr.h | 727 ++ .../c++/7.3.0/bits/shared_ptr_atomic.h | 330 + .../include/c++/7.3.0/bits/shared_ptr_base.h | 1866 +++++ .../include/c++/7.3.0/bits/slice_array.h | 274 + .../include/c++/7.3.0/bits/specfun.h | 1309 +++ .../include/c++/7.3.0/bits/std_abs.h | 110 + .../include/c++/7.3.0/bits/std_function.h | 811 ++ .../include/c++/7.3.0/bits/std_mutex.h | 373 + .../include/c++/7.3.0/bits/stl_algo.h | 5836 ++++++++++++++ .../include/c++/7.3.0/bits/stl_algobase.h | 1423 ++++ .../include/c++/7.3.0/bits/stl_bvector.h | 1294 +++ .../include/c++/7.3.0/bits/stl_construct.h | 236 + .../include/c++/7.3.0/bits/stl_deque.h | 2321 ++++++ .../include/c++/7.3.0/bits/stl_function.h | 1130 +++ .../include/c++/7.3.0/bits/stl_heap.h | 561 ++ .../include/c++/7.3.0/bits/stl_iterator.h | 1260 +++ .../c++/7.3.0/bits/stl_iterator_base_funcs.h | 235 + .../c++/7.3.0/bits/stl_iterator_base_types.h | 242 + .../include/c++/7.3.0/bits/stl_list.h | 1995 +++++ .../include/c++/7.3.0/bits/stl_map.h | 1479 ++++ .../include/c++/7.3.0/bits/stl_multimap.h | 1145 +++ .../include/c++/7.3.0/bits/stl_multiset.h | 979 +++ .../include/c++/7.3.0/bits/stl_numeric.h | 387 + .../include/c++/7.3.0/bits/stl_pair.h | 538 ++ .../include/c++/7.3.0/bits/stl_queue.h | 682 ++ .../c++/7.3.0/bits/stl_raw_storage_iter.h | 123 + .../include/c++/7.3.0/bits/stl_relops.h | 134 + .../include/c++/7.3.0/bits/stl_set.h | 993 +++ .../include/c++/7.3.0/bits/stl_stack.h | 359 + .../include/c++/7.3.0/bits/stl_tempbuf.h | 271 + .../include/c++/7.3.0/bits/stl_tree.h | 2614 ++++++ .../c++/7.3.0/bits/stl_uninitialized.h | 885 ++ .../include/c++/7.3.0/bits/stl_vector.h | 1651 ++++ .../include/c++/7.3.0/bits/stream_iterator.h | 222 + .../c++/7.3.0/bits/streambuf_iterator.h | 412 + .../include/c++/7.3.0/bits/stringfwd.h | 97 + .../include/c++/7.3.0/bits/uniform_int_dist.h | 375 + .../include/c++/7.3.0/bits/unique_ptr.h | 844 ++ .../include/c++/7.3.0/bits/unordered_map.h | 1989 +++++ .../include/c++/7.3.0/bits/unordered_set.h | 1612 ++++ .../include/c++/7.3.0/bits/uses_allocator.h | 186 + .../include/c++/7.3.0/bits/valarray_after.h | 551 ++ .../include/c++/7.3.0/bits/valarray_array.h | 693 ++ .../include/c++/7.3.0/bits/valarray_before.h | 743 ++ .../include/c++/7.3.0/complex.h | 46 + .../include/c++/7.3.0/cxxabi.h | 705 ++ .../include/c++/7.3.0/debug/assertions.h | 68 + .../include/c++/7.3.0/debug/debug.h | 125 + .../include/c++/7.3.0/debug/formatter.h | 493 ++ .../include/c++/7.3.0/debug/functions.h | 492 ++ .../c++/7.3.0/debug/helper_functions.h | 211 + .../include/c++/7.3.0/debug/macros.h | 398 + .../include/c++/7.3.0/debug/map.h | 741 ++ .../include/c++/7.3.0/debug/multimap.h | 626 ++ .../include/c++/7.3.0/debug/multiset.h | 591 ++ .../include/c++/7.3.0/debug/safe_base.h | 278 + .../include/c++/7.3.0/debug/safe_container.h | 122 + .../include/c++/7.3.0/debug/safe_iterator.h | 906 +++ .../c++/7.3.0/debug/safe_local_iterator.h | 508 ++ .../include/c++/7.3.0/debug/safe_sequence.h | 150 + .../c++/7.3.0/debug/safe_unordered_base.h | 185 + .../7.3.0/debug/safe_unordered_container.h | 105 + .../include/c++/7.3.0/debug/set.h | 609 ++ .../include/c++/7.3.0/debug/stl_iterator.h | 113 + .../include/c++/7.3.0/decimal/decimal.h | 468 ++ .../c++/7.3.0/experimental/bits/erase_if.h | 70 + .../c++/7.3.0/experimental/bits/fs_dir.h | 363 + .../c++/7.3.0/experimental/bits/fs_fwd.h | 293 + .../c++/7.3.0/experimental/bits/fs_ops.h | 300 + .../c++/7.3.0/experimental/bits/fs_path.h | 1091 +++ .../c++/7.3.0/experimental/bits/lfts_config.h | 64 + .../c++/7.3.0/experimental/bits/shared_ptr.h | 684 ++ .../include/c++/7.3.0/ext/aligned_buffer.h | 119 + .../include/c++/7.3.0/ext/alloc_traits.h | 163 + .../include/c++/7.3.0/ext/array_allocator.h | 182 + .../include/c++/7.3.0/ext/atomicity.h | 117 + .../include/c++/7.3.0/ext/bitmap_allocator.h | 1137 +++ .../include/c++/7.3.0/ext/cast.h | 121 + .../c++/7.3.0/ext/codecvt_specializations.h | 515 ++ .../include/c++/7.3.0/ext/concurrence.h | 318 + .../include/c++/7.3.0/ext/debug_allocator.h | 191 + .../include/c++/7.3.0/ext/enc_filebuf.h | 65 + .../include/c++/7.3.0/ext/extptr_allocator.h | 197 + .../include/c++/7.3.0/ext/malloc_allocator.h | 175 + .../include/c++/7.3.0/ext/mt_allocator.h | 784 ++ .../include/c++/7.3.0/ext/new_allocator.h | 166 + .../include/c++/7.3.0/ext/numeric_traits.h | 138 + .../include/c++/7.3.0/ext/pod_char_traits.h | 198 + .../include/c++/7.3.0/ext/pointer.h | 593 ++ .../include/c++/7.3.0/ext/pool_allocator.h | 296 + .../include/c++/7.3.0/ext/rc_string_base.h | 735 ++ .../include/c++/7.3.0/ext/ropeimpl.h | 1703 ++++ .../include/c++/7.3.0/ext/sso_string_base.h | 576 ++ .../include/c++/7.3.0/ext/stdio_filebuf.h | 171 + .../c++/7.3.0/ext/stdio_sync_filebuf.h | 319 + .../c++/7.3.0/ext/string_conversions.h | 123 + .../include/c++/7.3.0/ext/throw_allocator.h | 980 +++ .../include/c++/7.3.0/ext/type_traits.h | 221 + .../include/c++/7.3.0/ext/typelist.h | 559 ++ .../include/c++/7.3.0/ext/vstring.h | 2967 +++++++ .../include/c++/7.3.0/ext/vstring_fwd.h | 89 + .../include/c++/7.3.0/ext/vstring_util.h | 183 + .../include/c++/7.3.0/fenv.h | 81 + .../include/c++/7.3.0/math.h | 181 + .../bits/atomic_word.h | 40 + .../bits/basic_file.h | 130 + .../bits/c++allocator.h | 55 + .../bits/c++config.h | 1956 +++++ .../bits/c++io.h | 50 + .../bits/c++locale.h | 92 + .../bits/cpu_defines.h | 33 + .../bits/ctype_base.h | 68 + .../bits/ctype_inline.h | 76 + .../bits/cxxabi_tweaks.h | 59 + .../bits/error_constants.h | 178 + .../bits/extc++.h | 84 + .../bits/gthr-default.h | 889 ++ .../bits/gthr-posix.h | 889 ++ .../bits/gthr-single.h | 298 + .../mipsel-buildroot-linux-uclibc/bits/gthr.h | 154 + .../bits/messages_members.h | 92 + .../bits/opt_random.h | 38 + .../bits/os_defines.h | 44 + .../bits/stdc++.h | 123 + .../bits/stdtr1c++.h | 53 + .../bits/time_members.h | 92 + .../ext/opt_random.h | 38 + .../include/c++/7.3.0/parallel/algo.h | 2195 +++++ .../include/c++/7.3.0/parallel/algobase.h | 432 + .../include/c++/7.3.0/parallel/algorithmfwd.h | 908 +++ .../c++/7.3.0/parallel/balanced_quicksort.h | 495 ++ .../include/c++/7.3.0/parallel/base.h | 430 + .../c++/7.3.0/parallel/basic_iterator.h | 41 + .../include/c++/7.3.0/parallel/checkers.h | 73 + .../c++/7.3.0/parallel/compatibility.h | 131 + .../c++/7.3.0/parallel/compiletime_settings.h | 75 + .../c++/7.3.0/parallel/equally_split.h | 89 + .../include/c++/7.3.0/parallel/features.h | 104 + .../include/c++/7.3.0/parallel/find.h | 405 + .../c++/7.3.0/parallel/find_selectors.h | 197 + .../include/c++/7.3.0/parallel/for_each.h | 90 + .../c++/7.3.0/parallel/for_each_selectors.h | 349 + .../include/c++/7.3.0/parallel/iterator.h | 198 + .../c++/7.3.0/parallel/list_partition.h | 179 + .../include/c++/7.3.0/parallel/losertree.h | 1063 +++ .../include/c++/7.3.0/parallel/merge.h | 251 + .../c++/7.3.0/parallel/multiseq_selection.h | 644 ++ .../c++/7.3.0/parallel/multiway_merge.h | 2072 +++++ .../c++/7.3.0/parallel/multiway_mergesort.h | 480 ++ .../include/c++/7.3.0/parallel/numericfwd.h | 203 + .../include/c++/7.3.0/parallel/omp_loop.h | 115 + .../c++/7.3.0/parallel/omp_loop_static.h | 115 + .../include/c++/7.3.0/parallel/par_loop.h | 139 + .../include/c++/7.3.0/parallel/parallel.h | 42 + .../include/c++/7.3.0/parallel/partial_sum.h | 230 + .../include/c++/7.3.0/parallel/partition.h | 434 + .../include/c++/7.3.0/parallel/queue.h | 155 + .../include/c++/7.3.0/parallel/quicksort.h | 176 + .../c++/7.3.0/parallel/random_number.h | 125 + .../c++/7.3.0/parallel/random_shuffle.h | 533 ++ .../include/c++/7.3.0/parallel/search.h | 172 + .../c++/7.3.0/parallel/set_operations.h | 529 ++ .../include/c++/7.3.0/parallel/settings.h | 343 + .../include/c++/7.3.0/parallel/sort.h | 238 + .../include/c++/7.3.0/parallel/tags.h | 185 + .../include/c++/7.3.0/parallel/types.h | 137 + .../include/c++/7.3.0/parallel/unique_copy.h | 197 + .../include/c++/7.3.0/parallel/workstealing.h | 312 + .../include/c++/7.3.0/profile/base.h | 58 + .../include/c++/7.3.0/profile/impl/profiler.h | 370 + .../c++/7.3.0/profile/impl/profiler_algos.h | 111 + .../profile/impl/profiler_container_size.h | 186 + .../7.3.0/profile/impl/profiler_hash_func.h | 153 + .../profile/impl/profiler_hashtable_size.h | 100 + .../profile/impl/profiler_list_to_slist.h | 168 + .../profile/impl/profiler_list_to_vector.h | 261 + .../impl/profiler_map_to_unordered_map.h | 275 + .../c++/7.3.0/profile/impl/profiler_node.h | 155 + .../c++/7.3.0/profile/impl/profiler_state.h | 69 + .../c++/7.3.0/profile/impl/profiler_trace.h | 663 ++ .../7.3.0/profile/impl/profiler_vector_size.h | 100 + .../profile/impl/profiler_vector_to_list.h | 261 + .../c++/7.3.0/profile/iterator_tracker.h | 286 + .../include/c++/7.3.0/profile/map.h | 705 ++ .../include/c++/7.3.0/profile/multimap.h | 663 ++ .../include/c++/7.3.0/profile/multiset.h | 647 ++ .../include/c++/7.3.0/profile/ordered_base.h | 100 + .../include/c++/7.3.0/profile/set.h | 628 ++ .../c++/7.3.0/profile/unordered_base.h | 308 + .../include/c++/7.3.0/stdlib.h | 86 + .../include/c++/7.3.0/tgmath.h | 42 + .../include/c++/7.3.0/tr1/complex.h | 34 + .../include/c++/7.3.0/tr1/ctype.h | 34 + .../include/c++/7.3.0/tr1/fenv.h | 34 + .../include/c++/7.3.0/tr1/float.h | 34 + .../include/c++/7.3.0/tr1/functional_hash.h | 200 + .../include/c++/7.3.0/tr1/hashtable.h | 1181 +++ .../include/c++/7.3.0/tr1/hashtable_policy.h | 778 ++ .../include/c++/7.3.0/tr1/inttypes.h | 34 + .../include/c++/7.3.0/tr1/limits.h | 34 + .../include/c++/7.3.0/tr1/math.h | 186 + .../include/c++/7.3.0/tr1/random.h | 2417 ++++++ .../include/c++/7.3.0/tr1/shared_ptr.h | 1170 +++ .../c++/7.3.0/tr1/special_function_util.h | 142 + .../include/c++/7.3.0/tr1/stdarg.h | 34 + .../include/c++/7.3.0/tr1/stdbool.h | 34 + .../include/c++/7.3.0/tr1/stdint.h | 34 + .../include/c++/7.3.0/tr1/stdio.h | 34 + .../include/c++/7.3.0/tr1/stdlib.h | 52 + .../include/c++/7.3.0/tr1/tgmath.h | 34 + .../include/c++/7.3.0/tr1/unordered_map.h | 278 + .../include/c++/7.3.0/tr1/unordered_set.h | 267 + .../include/c++/7.3.0/tr1/wchar.h | 34 + .../include/c++/7.3.0/tr1/wctype.h | 34 + .../sysroot/usr/include/SDL/SDL.h | 101 + .../sysroot/usr/include/SDL/SDL_active.h | 63 + .../sysroot/usr/include/SDL/SDL_audio.h | 284 + .../sysroot/usr/include/SDL/SDL_byteorder.h | 29 + .../sysroot/usr/include/SDL/SDL_cdrom.h | 202 + .../sysroot/usr/include/SDL/SDL_config.h | 314 + .../sysroot/usr/include/SDL/SDL_cpuinfo.h | 69 + .../sysroot/usr/include/SDL/SDL_endian.h | 214 + .../sysroot/usr/include/SDL/SDL_error.h | 72 + .../sysroot/usr/include/SDL/SDL_events.h | 356 + .../sysroot/usr/include/SDL/SDL_framerate.h | 99 + .../sysroot/usr/include/SDL/SDL_getenv.h | 28 + .../sysroot/usr/include/SDL/SDL_gfxBlitFunc.h | 165 + .../usr/include/SDL/SDL_gfxPrimitives.h | 246 + .../usr/include/SDL/SDL_gfxPrimitives_font.h | 3082 +++++++ .../sysroot/usr/include/SDL/SDL_image.h | 138 + .../sysroot/usr/include/SDL/SDL_imageFilter.h | 215 + .../sysroot/usr/include/SDL/SDL_joystick.h | 187 + .../sysroot/usr/include/SDL/SDL_keyboard.h | 135 + .../sysroot/usr/include/SDL/SDL_keysym.h | 326 + .../sysroot/usr/include/SDL/SDL_loadso.h | 78 + .../sysroot/usr/include/SDL/SDL_main.h | 106 + .../sysroot/usr/include/SDL/SDL_mixer.h | 634 ++ .../sysroot/usr/include/SDL/SDL_mouse.h | 143 + .../sysroot/usr/include/SDL/SDL_mutex.h | 177 + .../sysroot/usr/include/SDL/SDL_name.h | 11 + .../sysroot/usr/include/SDL/SDL_net.h | 452 ++ .../sysroot/usr/include/SDL/SDL_opengl.h | 6570 +++++++++++++++ .../sysroot/usr/include/SDL/SDL_platform.h | 110 + .../sysroot/usr/include/SDL/SDL_quit.h | 55 + .../sysroot/usr/include/SDL/SDL_rotozoom.h | 123 + .../sysroot/usr/include/SDL/SDL_rwops.h | 155 + .../sysroot/usr/include/SDL/SDL_sound.h | 674 ++ .../sysroot/usr/include/SDL/SDL_stdinc.h | 620 ++ .../sysroot/usr/include/SDL/SDL_syswm.h | 226 + .../sysroot/usr/include/SDL/SDL_thread.h | 115 + .../sysroot/usr/include/SDL/SDL_timer.h | 125 + .../sysroot/usr/include/SDL/SDL_ttf.h | 249 + .../sysroot/usr/include/SDL/SDL_types.h | 28 + .../sysroot/usr/include/SDL/SDL_version.h | 91 + .../sysroot/usr/include/SDL/SDL_video.h | 952 +++ .../sysroot/usr/include/SDL/begin_code.h | 196 + .../sysroot/usr/include/SDL/close_code.h | 46 + .../sysroot/usr/include/a.out.h | 1 + .../sysroot/usr/include/alloca.h | 40 + .../sysroot/usr/include/ao/ao.h | 139 + .../sysroot/usr/include/ao/os_types.h | 39 + .../sysroot/usr/include/ao/plugin.h | 51 + .../sysroot/usr/include/ar.h | 47 + .../sysroot/usr/include/archive.h | 1191 +++ .../sysroot/usr/include/archive_entry.h | 703 ++ .../sysroot/usr/include/argp.h | 603 ++ .../sysroot/usr/include/arpa/ftp.h | 105 + .../sysroot/usr/include/arpa/inet.h | 111 + .../sysroot/usr/include/arpa/nameser.h | 550 ++ .../sysroot/usr/include/arpa/nameser_compat.h | 183 + .../sysroot/usr/include/arpa/telnet.h | 316 + .../sysroot/usr/include/arpa/tftp.h | 76 + .../sysroot/usr/include/asm-generic/auxvec.h | 8 + .../usr/include/asm-generic/bitsperlong.h | 15 + .../usr/include/asm-generic/errno-base.h | 39 + .../sysroot/usr/include/asm-generic/errno.h | 113 + .../sysroot/usr/include/asm-generic/fcntl.h | 195 + .../sysroot/usr/include/asm-generic/int-l64.h | 34 + .../usr/include/asm-generic/int-ll64.h | 39 + .../sysroot/usr/include/asm-generic/ioctl.h | 96 + .../sysroot/usr/include/asm-generic/ioctls.h | 114 + .../sysroot/usr/include/asm-generic/ipcbuf.h | 34 + .../usr/include/asm-generic/mman-common.h | 54 + .../sysroot/usr/include/asm-generic/mman.h | 19 + .../sysroot/usr/include/asm-generic/msgbuf.h | 47 + .../sysroot/usr/include/asm-generic/param.h | 19 + .../sysroot/usr/include/asm-generic/poll.h | 39 + .../usr/include/asm-generic/posix_types.h | 94 + .../usr/include/asm-generic/resource.h | 68 + .../sysroot/usr/include/asm-generic/sembuf.h | 38 + .../sysroot/usr/include/asm-generic/setup.h | 6 + .../sysroot/usr/include/asm-generic/shmbuf.h | 59 + .../usr/include/asm-generic/shmparam.h | 6 + .../sysroot/usr/include/asm-generic/siginfo.h | 267 + .../usr/include/asm-generic/signal-defs.h | 28 + .../sysroot/usr/include/asm-generic/signal.h | 127 + .../sysroot/usr/include/asm-generic/socket.h | 67 + .../sysroot/usr/include/asm-generic/sockios.h | 13 + .../sysroot/usr/include/asm-generic/stat.h | 72 + .../sysroot/usr/include/asm-generic/statfs.h | 83 + .../sysroot/usr/include/asm-generic/swab.h | 18 + .../usr/include/asm-generic/termbits.h | 199 + .../sysroot/usr/include/asm-generic/termios.h | 50 + .../sysroot/usr/include/asm-generic/types.h | 15 + .../usr/include/asm-generic/ucontext.h | 12 + .../sysroot/usr/include/asm-generic/unistd.h | 905 +++ .../sysroot/usr/include/asm/auxvec.h | 4 + .../sysroot/usr/include/asm/bitsperlong.h | 8 + .../sysroot/usr/include/asm/byteorder.h | 19 + .../sysroot/usr/include/asm/cachectl.h | 26 + .../sysroot/usr/include/asm/errno.h | 129 + .../sysroot/usr/include/asm/fcntl.h | 77 + .../sysroot/usr/include/asm/ioctl.h | 27 + .../sysroot/usr/include/asm/ioctls.h | 110 + .../sysroot/usr/include/asm/ipcbuf.h | 28 + .../sysroot/usr/include/asm/mman.h | 86 + .../sysroot/usr/include/asm/msgbuf.h | 47 + .../sysroot/usr/include/asm/param.h | 16 + .../sysroot/usr/include/asm/poll.h | 9 + .../sysroot/usr/include/asm/posix_types.h | 73 + .../sysroot/usr/include/asm/ptrace.h | 116 + .../sysroot/usr/include/asm/resource.h | 35 + .../sysroot/usr/include/asm/sembuf.h | 22 + .../sysroot/usr/include/asm/setup.h | 7 + .../sysroot/usr/include/asm/sgidefs.h | 44 + .../sysroot/usr/include/asm/shmbuf.h | 38 + .../sysroot/usr/include/asm/sigcontext.h | 78 + .../sysroot/usr/include/asm/siginfo.h | 114 + .../sysroot/usr/include/asm/signal.h | 123 + .../sysroot/usr/include/asm/socket.h | 86 + .../sysroot/usr/include/asm/sockios.h | 26 + .../sysroot/usr/include/asm/stat.h | 132 + .../sysroot/usr/include/asm/statfs.h | 100 + .../sysroot/usr/include/asm/swab.h | 59 + .../sysroot/usr/include/asm/sysmips.h | 25 + .../sysroot/usr/include/asm/termbits.h | 227 + .../sysroot/usr/include/asm/termios.h | 80 + .../sysroot/usr/include/asm/types.h | 34 + .../sysroot/usr/include/asm/unistd.h | 1032 +++ .../Biquad_Native/asplib_BiquadNative.h | 57 + .../asplib/Biquad/Interfaces/asplib_IBiquad.h | 97 + .../asplib/Biquad/apslib_BiquadFactory.h | 57 + .../asplib/Core/Buffers/asplib_IBufferBase.h | 87 + .../asplib/Core/Buffers/asplib_ITBuffer.h | 47 + .../asplib/Core/Buffers/asplib_TBaseBuffer.h | 148 + .../Core/Buffers/asplib_TBaseFrameBuffer.h | 48 + .../asplib/Core/Buffers/asplib_TFrameBuffer.h | 73 + .../Core/Buffers/asplib_TFrameRingBuffer.h | 81 + .../asplib/Core/Buffers/asplib_TRingBuffer.h | 237 + .../Constants_Typedefs/asplib_Constants.h | 39 + .../Core/Constants_Typedefs/asplib_Typedefs.h | 96 + .../Core/Exceptions/asplib_IException.h | 61 + .../Core/Exceptions/asplib_StringException.h | 72 + .../Core/Strings/asplib_stdStringUtils.h | 63 + .../Core/os/android/android_definitions.h | 57 + .../usr/include/asplib/Core/os/asplib_os.h | 71 + .../os/darwin_ios/darwin_ios_definitions.h | 57 + .../os/darwin_osx/darwin_osx_definitions.h | 57 + .../Core/os/freebsd/freebsd_definitions.h | 57 + .../asplib/Core/os/linux/linux_definitions.h | 57 + .../raspberry_pi/raspberry_pi_definitions.h | 57 + .../Core/os/windows/windows_definitions.h | 56 + .../usr/include/asplib/Logger/ILogger.h | 54 + .../usr/include/asplib/Logger/LoggerFactory.h | 44 + .../usr/include/asplib/Logger/LoggerFile.h | 54 + .../usr/include/asplib/Logger/LoggerStdout.h | 48 + .../usr/include/asplib/Logger/Logger_types.h | 54 + .../asplib/Logger/asplib_DefaultLogger.h | 34 + .../asplib/Signals/asplib_Interleaver.h | 65 + .../asplib/Signals/asplib_SamplesConverter.h | 29 + .../include/asplib/Timer/asplib_CPUTimer.h | 65 + .../sysroot/usr/include/assert.h | 77 + .../sysroot/usr/include/bits/byteswap-16.h | 34 + .../usr/include/bits/byteswap-common.h | 112 + .../sysroot/usr/include/bits/byteswap.h | 1 + .../sysroot/usr/include/bits/cmathcalls.h | 157 + .../sysroot/usr/include/bits/confname.h | 680 ++ .../sysroot/usr/include/bits/dirent.h | 52 + .../sysroot/usr/include/bits/dlfcn.h | 44 + .../sysroot/usr/include/bits/elfclass.h | 14 + .../sysroot/usr/include/bits/endian.h | 16 + .../sysroot/usr/include/bits/environments.h | 87 + .../sysroot/usr/include/bits/epoll.h | 29 + .../sysroot/usr/include/bits/errno.h | 58 + .../sysroot/usr/include/bits/eventfd.h | 31 + .../sysroot/usr/include/bits/fcntl.h | 267 + .../sysroot/usr/include/bits/getopt.h | 145 + .../sysroot/usr/include/bits/getopt_int.h | 129 + .../sysroot/usr/include/bits/huge_val.h | 54 + .../sysroot/usr/include/bits/huge_valf.h | 52 + .../sysroot/usr/include/bits/huge_vall.h | 28 + .../sysroot/usr/include/bits/in.h | 190 + .../sysroot/usr/include/bits/inf.h | 29 + .../sysroot/usr/include/bits/initspin.h | 27 + .../sysroot/usr/include/bits/inotify.h | 29 + .../sysroot/usr/include/bits/ioctl-types.h | 75 + .../sysroot/usr/include/bits/ioctls.h | 108 + .../sysroot/usr/include/bits/ipc.h | 54 + .../usr/include/bits/kernel-features.h | 495 ++ .../sysroot/usr/include/bits/local_lim.h | 99 + .../sysroot/usr/include/bits/locale.h | 43 + .../sysroot/usr/include/bits/mathcalls.h | 383 + .../sysroot/usr/include/bits/mathdef.h | 39 + .../sysroot/usr/include/bits/mathinline.h | 12 + .../sysroot/usr/include/bits/mman-common.h | 109 + .../sysroot/usr/include/bits/mman.h | 107 + .../sysroot/usr/include/bits/mqueue.h | 31 + .../sysroot/usr/include/bits/msq.h | 92 + .../sysroot/usr/include/bits/nan.h | 52 + .../sysroot/usr/include/bits/netdb.h | 32 + .../sysroot/usr/include/bits/poll.h | 49 + .../sysroot/usr/include/bits/posix1_lim.h | 168 + .../sysroot/usr/include/bits/posix2_lim.h | 90 + .../sysroot/usr/include/bits/posix_opt.h | 191 + .../sysroot/usr/include/bits/pthreadtypes.h | 229 + .../sysroot/usr/include/bits/resource.h | 232 + .../sysroot/usr/include/bits/sched.h | 215 + .../sysroot/usr/include/bits/select.h | 34 + .../sysroot/usr/include/bits/sem.h | 84 + .../sysroot/usr/include/bits/semaphore.h | 36 + .../sysroot/usr/include/bits/setjmp.h | 66 + .../sysroot/usr/include/bits/shm.h | 93 + .../sysroot/usr/include/bits/sigaction.h | 73 + .../sysroot/usr/include/bits/sigcontext.h | 83 + .../sysroot/usr/include/bits/siginfo.h | 343 + .../sysroot/usr/include/bits/signalfd.h | 29 + .../sysroot/usr/include/bits/signum.h | 72 + .../sysroot/usr/include/bits/sigset.h | 180 + .../sysroot/usr/include/bits/sigstack.h | 54 + .../sysroot/usr/include/bits/sigthread.h | 43 + .../sysroot/usr/include/bits/sockaddr.h | 39 + .../sysroot/usr/include/bits/socket.h | 344 + .../sysroot/usr/include/bits/socket_type.h | 55 + .../sysroot/usr/include/bits/stat.h | 253 + .../sysroot/usr/include/bits/statfs.h | 74 + .../sysroot/usr/include/bits/statvfs.h | 108 + .../sysroot/usr/include/bits/stdio.h | 22 + .../sysroot/usr/include/bits/stdio_lim.h | 40 + .../sysroot/usr/include/bits/sysnum.h | 1074 +++ .../sysroot/usr/include/bits/termios.h | 217 + .../sysroot/usr/include/bits/time.h | 90 + .../sysroot/usr/include/bits/timerfd.h | 29 + .../sysroot/usr/include/bits/types.h | 200 + .../sysroot/usr/include/bits/typesizes.h | 65 + .../sysroot/usr/include/bits/uClibc_alloc.h | 21 + .../usr/include/bits/uClibc_charclass.h | 40 + .../sysroot/usr/include/bits/uClibc_clk_tck.h | 8 + .../sysroot/usr/include/bits/uClibc_config.h | 233 + .../usr/include/bits/uClibc_local_lim.h | 20 + .../sysroot/usr/include/bits/uClibc_locale.h | 80 + .../sysroot/usr/include/bits/uClibc_page.h | 35 + .../usr/include/bits/uClibc_posix_opt.h | 58 + .../sysroot/usr/include/bits/uClibc_stdio.h | 342 + .../sysroot/usr/include/bits/uClibc_touplow.h | 44 + .../sysroot/usr/include/bits/uio.h | 50 + .../sysroot/usr/include/bits/utmp.h | 124 + .../sysroot/usr/include/bits/utmpx.h | 102 + .../sysroot/usr/include/bits/utsname.h | 28 + .../sysroot/usr/include/bits/waitflags.h | 37 + .../sysroot/usr/include/bits/waitstatus.h | 113 + .../sysroot/usr/include/bits/wchar.h | 25 + .../sysroot/usr/include/bits/wordsize.h | 21 + .../sysroot/usr/include/bits/xopen_lim.h | 143 + .../sysroot/usr/include/blkid/blkid.h | 461 ++ .../sysroot/usr/include/byteswap.h | 39 + .../sysroot/usr/include/bzlib.h | 282 + .../sysroot/usr/include/com_err.h | 1 + .../sysroot/usr/include/complex.h | 109 + .../sysroot/usr/include/cpio.h | 73 + .../sysroot/usr/include/crypt.h | 40 + .../sysroot/usr/include/ctype.h | 342 + .../sysroot/usr/include/curses.h | 2024 +++++ .../sysroot/usr/include/dirent.h | 363 + .../sysroot/usr/include/dlfcn.h | 197 + .../sysroot/usr/include/drm/drm.h | 804 ++ .../sysroot/usr/include/drm/drm_mode.h | 383 + .../sysroot/usr/include/drm/drm_sarea.h | 82 + .../sysroot/usr/include/drm/i810_drm.h | 281 + .../sysroot/usr/include/drm/i915_drm.h | 839 ++ .../sysroot/usr/include/drm/mga_drm.h | 419 + .../sysroot/usr/include/drm/nouveau_drm.h | 218 + .../sysroot/usr/include/drm/r128_drm.h | 326 + .../sysroot/usr/include/drm/radeon_drm.h | 926 +++ .../sysroot/usr/include/drm/savage_drm.h | 210 + .../sysroot/usr/include/drm/sis_drm.h | 67 + .../sysroot/usr/include/drm/via_drm.h | 275 + .../sysroot/usr/include/drm/vmwgfx_drm.h | 790 ++ .../sysroot/usr/include/e2p/e2p.h | 79 + .../sysroot/usr/include/elf.h | 3720 +++++++++ .../sysroot/usr/include/endian.h | 94 + .../sysroot/usr/include/err.h | 57 + .../sysroot/usr/include/errno.h | 72 + .../sysroot/usr/include/error.h | 51 + .../sysroot/usr/include/et/com_err.h | 68 + .../sysroot/usr/include/eti.h | 54 + .../sysroot/usr/include/ext2fs/bitops.h | 703 ++ .../sysroot/usr/include/ext2fs/ext2_err.h | 196 + .../usr/include/ext2fs/ext2_ext_attr.h | 73 + .../sysroot/usr/include/ext2fs/ext2_fs.h | 1104 +++ .../sysroot/usr/include/ext2fs/ext2_io.h | 163 + .../sysroot/usr/include/ext2fs/ext2_types.h | 205 + .../sysroot/usr/include/ext2fs/ext2fs.h | 1988 +++++ .../sysroot/usr/include/ext2fs/ext3_extents.h | 127 + .../sysroot/usr/include/ext2fs/qcow2.h | 113 + .../sysroot/usr/include/ext2fs/tdb.h | 215 + .../sysroot/usr/include/fcntl.h | 262 + .../sysroot/usr/include/features.h | 417 + .../sysroot/usr/include/ffi.h | 487 ++ .../sysroot/usr/include/ffitarget.h | 247 + .../sysroot/usr/include/fnmatch.h | 63 + .../sysroot/usr/include/form.h | 428 + .../sysroot/usr/include/fpu_control.h | 99 + .../freetype2/freetype/config/ftconfig.h | 603 ++ .../freetype2/freetype/config/ftheader.h | 804 ++ .../freetype2/freetype/config/ftmodule.h | 20 + .../freetype2/freetype/config/ftoption.h | 977 +++ .../freetype2/freetype/config/ftstdlib.h | 175 + .../usr/include/freetype2/freetype/freetype.h | 4657 +++++++++++ .../usr/include/freetype2/freetype/ftadvanc.h | 187 + .../usr/include/freetype2/freetype/ftbbox.h | 101 + .../usr/include/freetype2/freetype/ftbdf.h | 210 + .../usr/include/freetype2/freetype/ftbitmap.h | 240 + .../usr/include/freetype2/freetype/ftbzip2.h | 102 + .../usr/include/freetype2/freetype/ftcache.h | 1042 +++ .../include/freetype2/freetype/ftchapters.h | 139 + .../usr/include/freetype2/freetype/ftcid.h | 168 + .../usr/include/freetype2/freetype/ftdriver.h | 1225 +++ .../usr/include/freetype2/freetype/fterrdef.h | 280 + .../usr/include/freetype2/freetype/fterrors.h | 226 + .../usr/include/freetype2/freetype/ftfntfmt.h | 95 + .../usr/include/freetype2/freetype/ftgasp.h | 142 + .../usr/include/freetype2/freetype/ftglyph.h | 614 ++ .../usr/include/freetype2/freetype/ftgxval.h | 357 + .../usr/include/freetype2/freetype/ftgzip.h | 151 + .../usr/include/freetype2/freetype/ftimage.h | 1205 +++ .../usr/include/freetype2/freetype/ftincrem.h | 343 + .../usr/include/freetype2/freetype/ftlcdfil.h | 309 + .../usr/include/freetype2/freetype/ftlist.h | 276 + .../usr/include/freetype2/freetype/ftlzw.h | 99 + .../usr/include/freetype2/freetype/ftmac.h | 275 + .../usr/include/freetype2/freetype/ftmm.h | 638 ++ .../usr/include/freetype2/freetype/ftmodapi.h | 711 ++ .../usr/include/freetype2/freetype/ftmoderr.h | 194 + .../usr/include/freetype2/freetype/ftotval.h | 204 + .../usr/include/freetype2/freetype/ftoutln.h | 582 ++ .../usr/include/freetype2/freetype/ftparams.h | 205 + .../usr/include/freetype2/freetype/ftpfr.h | 172 + .../usr/include/freetype2/freetype/ftrender.h | 233 + .../usr/include/freetype2/freetype/ftsizes.h | 159 + .../usr/include/freetype2/freetype/ftsnames.h | 253 + .../usr/include/freetype2/freetype/ftstroke.h | 785 ++ .../usr/include/freetype2/freetype/ftsynth.h | 84 + .../usr/include/freetype2/freetype/ftsystem.h | 355 + .../usr/include/freetype2/freetype/fttrigon.h | 350 + .../usr/include/freetype2/freetype/fttypes.h | 602 ++ .../usr/include/freetype2/freetype/ftwinfnt.h | 275 + .../usr/include/freetype2/freetype/t1tables.h | 770 ++ .../usr/include/freetype2/freetype/ttnameid.h | 1236 +++ .../usr/include/freetype2/freetype/tttables.h | 846 ++ .../usr/include/freetype2/freetype/tttags.h | 121 + .../sysroot/usr/include/freetype2/ft2build.h | 42 + .../sysroot/usr/include/ftw.h | 177 + .../sysroot/usr/include/fuse.h | 9 + .../sysroot/usr/include/fuse/cuse_lowlevel.h | 87 + .../sysroot/usr/include/fuse/fuse.h | 1061 +++ .../sysroot/usr/include/fuse/fuse_common.h | 505 ++ .../usr/include/fuse/fuse_common_compat.h | 26 + .../sysroot/usr/include/fuse/fuse_compat.h | 201 + .../sysroot/usr/include/fuse/fuse_lowlevel.h | 1857 +++++ .../usr/include/fuse/fuse_lowlevel_compat.h | 155 + .../sysroot/usr/include/fuse/fuse_opt.h | 270 + .../sysroot/usr/include/getopt.h | 4 + .../sysroot/usr/include/gif_lib.h | 312 + .../sysroot/usr/include/glob.h | 203 + .../sysroot/usr/include/gnu-versions.h | 51 + .../sysroot/usr/include/grp.h | 209 + .../sysroot/usr/include/iconv.h | 241 + .../sysroot/usr/include/id3tag.h | 364 + .../sysroot/usr/include/ieee754.h | 198 + .../sysroot/usr/include/ifaddrs.h | 73 + .../sysroot/usr/include/inttypes.h | 436 + .../sysroot/usr/include/jconfig.h | 73 + .../sysroot/usr/include/jerror.h | 316 + .../sysroot/usr/include/jmorecfg.h | 421 + .../sysroot/usr/include/jpeglib.h | 1132 +++ .../sysroot/usr/include/langinfo.h | 635 ++ .../sysroot/usr/include/lastlog.h | 4 + .../sysroot/usr/include/libcharset.h | 45 + .../sysroot/usr/include/libconfig.h | 328 + .../sysroot/usr/include/libfdisk/libfdisk.h | 761 ++ .../sysroot/usr/include/libgen.h | 39 + .../sysroot/usr/include/libintl.h | 464 ++ .../sysroot/usr/include/libltdl/lt_dlloader.h | 91 + .../sysroot/usr/include/libltdl/lt_error.h | 86 + .../sysroot/usr/include/libltdl/lt_system.h | 166 + .../sysroot/usr/include/libmodplug/it_defs.h | 134 + .../sysroot/usr/include/libmodplug/modplug.h | 186 + .../sysroot/usr/include/libmodplug/sndfile.h | 1017 +++ .../sysroot/usr/include/libmodplug/stdafx.h | 146 + .../sysroot/usr/include/libmount/libmount.h | 956 +++ .../sysroot/usr/include/libpng16/png.h | 3278 ++++++++ .../sysroot/usr/include/libpng16/pngconf.h | 622 ++ .../sysroot/usr/include/libpng16/pnglibconf.h | 219 + .../sysroot/usr/include/libsha1.h | 67 + .../usr/include/libsmartcols/libsmartcols.h | 309 + .../sysroot/usr/include/limits.h | 153 + .../sysroot/usr/include/link.h | 221 + .../sysroot/usr/include/linux/acct.h | 114 + .../sysroot/usr/include/linux/adb.h | 44 + .../sysroot/usr/include/linux/adfs_fs.h | 44 + .../usr/include/linux/affs_hardblocks.h | 68 + .../sysroot/usr/include/linux/agpgart.h | 111 + .../sysroot/usr/include/linux/aio_abi.h | 111 + .../sysroot/usr/include/linux/apm_bios.h | 135 + .../sysroot/usr/include/linux/arcfb.h | 8 + .../sysroot/usr/include/linux/atalk.h | 44 + .../sysroot/usr/include/linux/atm.h | 241 + .../sysroot/usr/include/linux/atm_eni.h | 23 + .../sysroot/usr/include/linux/atm_he.h | 20 + .../sysroot/usr/include/linux/atm_idt77105.h | 28 + .../sysroot/usr/include/linux/atm_nicstar.h | 53 + .../sysroot/usr/include/linux/atm_tcp.h | 61 + .../sysroot/usr/include/linux/atm_zatm.h | 52 + .../sysroot/usr/include/linux/atmapi.h | 29 + .../sysroot/usr/include/linux/atmarp.h | 41 + .../sysroot/usr/include/linux/atmbr2684.h | 117 + .../sysroot/usr/include/linux/atmclip.h | 21 + .../sysroot/usr/include/linux/atmdev.h | 215 + .../sysroot/usr/include/linux/atmioc.h | 41 + .../sysroot/usr/include/linux/atmlec.h | 98 + .../sysroot/usr/include/linux/atmmpc.h | 126 + .../sysroot/usr/include/linux/atmppp.h | 24 + .../sysroot/usr/include/linux/atmsap.h | 162 + .../sysroot/usr/include/linux/atmsvc.h | 55 + .../sysroot/usr/include/linux/audit.h | 364 + .../sysroot/usr/include/linux/auto_fs.h | 71 + .../sysroot/usr/include/linux/auto_fs4.h | 164 + .../sysroot/usr/include/linux/auxvec.h | 35 + .../sysroot/usr/include/linux/ax25.h | 116 + .../sysroot/usr/include/linux/b1lli.h | 73 + .../sysroot/usr/include/linux/baycom.h | 39 + .../sysroot/usr/include/linux/bfs_fs.h | 81 + .../sysroot/usr/include/linux/binfmts.h | 20 + .../sysroot/usr/include/linux/blk_types.h | 197 + .../sysroot/usr/include/linux/blkpg.h | 58 + .../sysroot/usr/include/linux/blktrace_api.h | 142 + .../sysroot/usr/include/linux/bpqether.h | 41 + .../sysroot/usr/include/linux/bsg.h | 65 + .../usr/include/linux/byteorder/big_endian.h | 105 + .../include/linux/byteorder/little_endian.h | 105 + .../usr/include/linux/caif/caif_socket.h | 194 + .../sysroot/usr/include/linux/caif/if_caif.h | 34 + .../sysroot/usr/include/linux/can.h | 110 + .../sysroot/usr/include/linux/can/bcm.h | 66 + .../sysroot/usr/include/linux/can/error.h | 91 + .../sysroot/usr/include/linux/can/gw.h | 162 + .../sysroot/usr/include/linux/can/netlink.h | 122 + .../sysroot/usr/include/linux/can/raw.h | 29 + .../sysroot/usr/include/linux/capability.h | 353 + .../sysroot/usr/include/linux/capi.h | 131 + .../sysroot/usr/include/linux/cciss_defs.h | 130 + .../sysroot/usr/include/linux/cciss_ioctl.h | 88 + .../sysroot/usr/include/linux/cdk.h | 486 ++ .../sysroot/usr/include/linux/cdrom.h | 912 +++ .../sysroot/usr/include/linux/cgroupstats.h | 71 + .../sysroot/usr/include/linux/chio.h | 168 + .../sysroot/usr/include/linux/cm4000_cs.h | 62 + .../sysroot/usr/include/linux/cn_proc.h | 121 + .../sysroot/usr/include/linux/coda.h | 737 ++ .../sysroot/usr/include/linux/coda_psdev.h | 27 + .../sysroot/usr/include/linux/coff.h | 351 + .../sysroot/usr/include/linux/comstats.h | 119 + .../sysroot/usr/include/linux/connector.h | 76 + .../sysroot/usr/include/linux/const.h | 24 + .../sysroot/usr/include/linux/cramfs_fs.h | 88 + .../sysroot/usr/include/linux/cuda.h | 28 + .../sysroot/usr/include/linux/cyclades.h | 493 ++ .../sysroot/usr/include/linux/cycx_cfm.h | 101 + .../sysroot/usr/include/linux/dcbnl.h | 672 ++ .../sysroot/usr/include/linux/dccp.h | 237 + .../sysroot/usr/include/linux/dlm.h | 77 + .../sysroot/usr/include/linux/dlm_device.h | 108 + .../sysroot/usr/include/linux/dlm_netlink.h | 58 + .../sysroot/usr/include/linux/dlm_plock.h | 46 + .../sysroot/usr/include/linux/dlmconstants.h | 163 + .../sysroot/usr/include/linux/dm-ioctl.h | 337 + .../usr/include/linux/dm-log-userspace.h | 416 + .../sysroot/usr/include/linux/dn.h | 146 + .../sysroot/usr/include/linux/dqblk_xfs.h | 166 + .../sysroot/usr/include/linux/dvb/audio.h | 135 + .../sysroot/usr/include/linux/dvb/ca.h | 90 + .../sysroot/usr/include/linux/dvb/dmx.h | 153 + .../sysroot/usr/include/linux/dvb/frontend.h | 427 + .../sysroot/usr/include/linux/dvb/net.h | 52 + .../sysroot/usr/include/linux/dvb/osd.h | 144 + .../sysroot/usr/include/linux/dvb/version.h | 29 + .../sysroot/usr/include/linux/dvb/video.h | 272 + .../sysroot/usr/include/linux/edd.h | 191 + .../sysroot/usr/include/linux/efs_fs_sb.h | 62 + .../sysroot/usr/include/linux/elf-em.h | 55 + .../sysroot/usr/include/linux/elf-fdpic.h | 62 + .../sysroot/usr/include/linux/elf.h | 413 + .../sysroot/usr/include/linux/elfcore.h | 96 + .../sysroot/usr/include/linux/errno.h | 7 + .../sysroot/usr/include/linux/errqueue.h | 25 + .../sysroot/usr/include/linux/ethtool.h | 940 +++ .../sysroot/usr/include/linux/eventpoll.h | 54 + .../sysroot/usr/include/linux/ext2_fs.h | 557 ++ .../sysroot/usr/include/linux/fadvise.h | 21 + .../sysroot/usr/include/linux/falloc.h | 8 + .../sysroot/usr/include/linux/fanotify.h | 116 + .../sysroot/usr/include/linux/fb.h | 394 + .../sysroot/usr/include/linux/fcntl.h | 52 + .../sysroot/usr/include/linux/fd.h | 382 + .../sysroot/usr/include/linux/fdreg.h | 137 + .../sysroot/usr/include/linux/fib_rules.h | 72 + .../sysroot/usr/include/linux/fiemap.h | 68 + .../sysroot/usr/include/linux/filter.h | 131 + .../sysroot/usr/include/linux/firewire-cdev.h | 1010 +++ .../usr/include/linux/firewire-constants.h | 92 + .../sysroot/usr/include/linux/flat.h | 58 + .../sysroot/usr/include/linux/fs.h | 381 + .../usr/include/linux/fsl_hypervisor.h | 220 + .../sysroot/usr/include/linux/fuse.h | 634 ++ .../sysroot/usr/include/linux/futex.h | 152 + .../sysroot/usr/include/linux/gameport.h | 28 + .../sysroot/usr/include/linux/gen_stats.h | 67 + .../usr/include/linux/generic_serial.h | 36 + .../sysroot/usr/include/linux/genetlink.h | 84 + .../sysroot/usr/include/linux/gfs2_ondisk.h | 449 ++ .../sysroot/usr/include/linux/gigaset_dev.h | 38 + .../sysroot/usr/include/linux/hdlc.h | 23 + .../sysroot/usr/include/linux/hdlc/ioctl.h | 81 + .../sysroot/usr/include/linux/hdlcdrv.h | 110 + .../sysroot/usr/include/linux/hdreg.h | 642 ++ .../sysroot/usr/include/linux/hid.h | 67 + .../sysroot/usr/include/linux/hiddev.h | 212 + .../sysroot/usr/include/linux/hidraw.h | 50 + .../sysroot/usr/include/linux/hpet.h | 25 + .../sysroot/usr/include/linux/hysdn_if.h | 33 + .../sysroot/usr/include/linux/i2c-dev.h | 71 + .../sysroot/usr/include/linux/i2c.h | 148 + .../sysroot/usr/include/linux/i2o-dev.h | 421 + .../sysroot/usr/include/linux/i8k.h | 46 + .../sysroot/usr/include/linux/icmp.h | 97 + .../sysroot/usr/include/linux/icmpv6.h | 166 + .../sysroot/usr/include/linux/if.h | 230 + .../sysroot/usr/include/linux/if_addr.h | 59 + .../sysroot/usr/include/linux/if_addrlabel.h | 32 + .../sysroot/usr/include/linux/if_alg.h | 40 + .../sysroot/usr/include/linux/if_arcnet.h | 132 + .../sysroot/usr/include/linux/if_arp.h | 157 + .../sysroot/usr/include/linux/if_bonding.h | 128 + .../sysroot/usr/include/linux/if_bridge.h | 101 + .../sysroot/usr/include/linux/if_cablemodem.h | 22 + .../sysroot/usr/include/linux/if_ec.h | 34 + .../sysroot/usr/include/linux/if_eql.h | 54 + .../sysroot/usr/include/linux/if_ether.h | 133 + .../sysroot/usr/include/linux/if_fc.h | 51 + .../sysroot/usr/include/linux/if_fddi.h | 104 + .../sysroot/usr/include/linux/if_frad.h | 122 + .../sysroot/usr/include/linux/if_hippi.h | 153 + .../sysroot/usr/include/linux/if_infiniband.h | 29 + .../sysroot/usr/include/linux/if_link.h | 380 + .../sysroot/usr/include/linux/if_ltalk.h | 9 + .../sysroot/usr/include/linux/if_packet.h | 272 + .../sysroot/usr/include/linux/if_phonet.h | 16 + .../sysroot/usr/include/linux/if_plip.h | 27 + .../sysroot/usr/include/linux/if_ppp.h | 173 + .../sysroot/usr/include/linux/if_pppol2tp.h | 79 + .../sysroot/usr/include/linux/if_pppox.h | 144 + .../sysroot/usr/include/linux/if_slip.h | 30 + .../sysroot/usr/include/linux/if_strip.h | 27 + .../sysroot/usr/include/linux/if_tr.h | 95 + .../sysroot/usr/include/linux/if_tun.h | 94 + .../sysroot/usr/include/linux/if_tunnel.h | 79 + .../sysroot/usr/include/linux/if_vlan.h | 63 + .../sysroot/usr/include/linux/if_x25.h | 26 + .../sysroot/usr/include/linux/igmp.h | 128 + .../sysroot/usr/include/linux/in.h | 252 + .../sysroot/usr/include/linux/in6.h | 278 + .../sysroot/usr/include/linux/in_route.h | 32 + .../sysroot/usr/include/linux/inet_diag.h | 126 + .../sysroot/usr/include/linux/inotify.h | 74 + .../sysroot/usr/include/linux/input.h | 1120 +++ .../sysroot/usr/include/linux/ioctl.h | 7 + .../sysroot/usr/include/linux/ip.h | 136 + .../sysroot/usr/include/linux/ip6_tunnel.h | 34 + .../sysroot/usr/include/linux/ip_vs.h | 429 + .../sysroot/usr/include/linux/ipc.h | 81 + .../sysroot/usr/include/linux/ipmi.h | 456 ++ .../sysroot/usr/include/linux/ipmi_msgdefs.h | 121 + .../sysroot/usr/include/linux/ipsec.h | 47 + .../sysroot/usr/include/linux/ipv6.h | 166 + .../sysroot/usr/include/linux/ipv6_route.h | 58 + .../sysroot/usr/include/linux/ipx.h | 75 + .../sysroot/usr/include/linux/irda.h | 251 + .../sysroot/usr/include/linux/irqnr.h | 8 + .../sysroot/usr/include/linux/isdn.h | 142 + .../sysroot/usr/include/linux/isdn/capicmd.h | 115 + .../sysroot/usr/include/linux/isdn_divertif.h | 26 + .../sysroot/usr/include/linux/isdn_ppp.h | 67 + .../sysroot/usr/include/linux/isdnif.h | 56 + .../sysroot/usr/include/linux/iso_fs.h | 165 + .../sysroot/usr/include/linux/ivtv.h | 69 + .../sysroot/usr/include/linux/ivtvfb.h | 37 + .../sysroot/usr/include/linux/ixjuser.h | 720 ++ .../sysroot/usr/include/linux/jffs2.h | 223 + .../sysroot/usr/include/linux/joystick.h | 136 + .../sysroot/usr/include/linux/kd.h | 183 + .../sysroot/usr/include/linux/kdev_t.h | 11 + .../usr/include/linux/kernel-page-flags.h | 35 + .../sysroot/usr/include/linux/kernel.h | 29 + .../sysroot/usr/include/linux/kernelcapi.h | 47 + .../sysroot/usr/include/linux/keyboard.h | 443 + .../sysroot/usr/include/linux/keyctl.h | 59 + .../sysroot/usr/include/linux/l2tp.h | 160 + .../sysroot/usr/include/linux/limits.h | 20 + .../sysroot/usr/include/linux/llc.h | 84 + .../sysroot/usr/include/linux/loop.h | 94 + .../sysroot/usr/include/linux/lp.h | 100 + .../sysroot/usr/include/linux/magic.h | 65 + .../sysroot/usr/include/linux/major.h | 177 + .../usr/include/linux/map_to_7segment.h | 187 + .../sysroot/usr/include/linux/matroxfb.h | 42 + .../sysroot/usr/include/linux/media.h | 132 + .../sysroot/usr/include/linux/mempolicy.h | 64 + .../sysroot/usr/include/linux/meye.h | 66 + .../sysroot/usr/include/linux/mii.h | 151 + .../sysroot/usr/include/linux/minix_fs.h | 106 + .../sysroot/usr/include/linux/mman.h | 13 + .../sysroot/usr/include/linux/mmc/ioctl.h | 54 + .../sysroot/usr/include/linux/mmtimer.h | 56 + .../sysroot/usr/include/linux/mqueue.h | 53 + .../sysroot/usr/include/linux/mroute.h | 143 + .../sysroot/usr/include/linux/mroute6.h | 135 + .../sysroot/usr/include/linux/msdos_fs.h | 166 + .../sysroot/usr/include/linux/msg.h | 75 + .../sysroot/usr/include/linux/mtio.h | 207 + .../sysroot/usr/include/linux/n_r3964.h | 98 + .../sysroot/usr/include/linux/nbd.h | 68 + .../sysroot/usr/include/linux/ncp.h | 198 + .../sysroot/usr/include/linux/ncp_fs.h | 146 + .../sysroot/usr/include/linux/ncp_mount.h | 71 + .../sysroot/usr/include/linux/ncp_no.h | 19 + .../sysroot/usr/include/linux/neighbour.h | 155 + .../sysroot/usr/include/linux/net.h | 57 + .../sysroot/usr/include/linux/net_dropmon.h | 64 + .../sysroot/usr/include/linux/net_tstamp.h | 113 + .../sysroot/usr/include/linux/netdevice.h | 53 + .../sysroot/usr/include/linux/netfilter.h | 69 + .../include/linux/netfilter/ipset/ip_set.h | 172 + .../linux/netfilter/ipset/ip_set_bitmap.h | 13 + .../linux/netfilter/ipset/ip_set_hash.h | 21 + .../linux/netfilter/ipset/ip_set_list.h | 21 + .../linux/netfilter/nf_conntrack_common.h | 122 + .../linux/netfilter/nf_conntrack_ftp.h | 18 + .../linux/netfilter/nf_conntrack_sctp.h | 25 + .../linux/netfilter/nf_conntrack_tcp.h | 48 + .../netfilter/nf_conntrack_tuple_common.h | 12 + .../usr/include/linux/netfilter/nfnetlink.h | 53 + .../linux/netfilter/nfnetlink_compat.h | 61 + .../linux/netfilter/nfnetlink_conntrack.h | 193 + .../include/linux/netfilter/nfnetlink_log.h | 97 + .../include/linux/netfilter/nfnetlink_queue.h | 91 + .../usr/include/linux/netfilter/x_tables.h | 185 + .../usr/include/linux/netfilter/xt_AUDIT.h | 30 + .../usr/include/linux/netfilter/xt_CHECKSUM.h | 20 + .../usr/include/linux/netfilter/xt_CLASSIFY.h | 10 + .../usr/include/linux/netfilter/xt_CONNMARK.h | 6 + .../include/linux/netfilter/xt_CONNSECMARK.h | 15 + .../usr/include/linux/netfilter/xt_CT.h | 19 + .../usr/include/linux/netfilter/xt_DSCP.h | 26 + .../include/linux/netfilter/xt_IDLETIMER.h | 45 + .../usr/include/linux/netfilter/xt_LED.h | 15 + .../usr/include/linux/netfilter/xt_MARK.h | 6 + .../usr/include/linux/netfilter/xt_NFLOG.h | 20 + .../usr/include/linux/netfilter/xt_NFQUEUE.h | 29 + .../usr/include/linux/netfilter/xt_RATEEST.h | 15 + .../usr/include/linux/netfilter/xt_SECMARK.h | 22 + .../usr/include/linux/netfilter/xt_TCPMSS.h | 12 + .../include/linux/netfilter/xt_TCPOPTSTRIP.h | 15 + .../usr/include/linux/netfilter/xt_TEE.h | 12 + .../usr/include/linux/netfilter/xt_TPROXY.h | 23 + .../usr/include/linux/netfilter/xt_addrtype.h | 44 + .../usr/include/linux/netfilter/xt_cluster.h | 19 + .../usr/include/linux/netfilter/xt_comment.h | 10 + .../include/linux/netfilter/xt_connbytes.h | 26 + .../include/linux/netfilter/xt_connlimit.h | 35 + .../usr/include/linux/netfilter/xt_connmark.h | 31 + .../include/linux/netfilter/xt_conntrack.h | 77 + .../usr/include/linux/netfilter/xt_cpu.h | 11 + .../usr/include/linux/netfilter/xt_dccp.h | 25 + .../usr/include/linux/netfilter/xt_devgroup.h | 21 + .../usr/include/linux/netfilter/xt_dscp.h | 31 + .../usr/include/linux/netfilter/xt_esp.h | 15 + .../include/linux/netfilter/xt_hashlimit.h | 68 + .../usr/include/linux/netfilter/xt_helper.h | 8 + .../usr/include/linux/netfilter/xt_iprange.h | 20 + .../usr/include/linux/netfilter/xt_ipvs.h | 29 + .../usr/include/linux/netfilter/xt_length.h | 11 + .../usr/include/linux/netfilter/xt_limit.h | 24 + .../usr/include/linux/netfilter/xt_mac.h | 8 + .../usr/include/linux/netfilter/xt_mark.h | 15 + .../include/linux/netfilter/xt_multiport.h | 29 + .../usr/include/linux/netfilter/xt_osf.h | 135 + .../usr/include/linux/netfilter/xt_owner.h | 18 + .../usr/include/linux/netfilter/xt_physdev.h | 23 + .../usr/include/linux/netfilter/xt_pkttype.h | 8 + .../usr/include/linux/netfilter/xt_policy.h | 58 + .../usr/include/linux/netfilter/xt_quota.h | 22 + .../usr/include/linux/netfilter/xt_rateest.h | 37 + .../usr/include/linux/netfilter/xt_realm.h | 12 + .../usr/include/linux/netfilter/xt_recent.h | 35 + .../usr/include/linux/netfilter/xt_sctp.h | 92 + .../usr/include/linux/netfilter/xt_set.h | 65 + .../usr/include/linux/netfilter/xt_socket.h | 14 + .../usr/include/linux/netfilter/xt_state.h | 12 + .../include/linux/netfilter/xt_statistic.h | 36 + .../usr/include/linux/netfilter/xt_string.h | 34 + .../usr/include/linux/netfilter/xt_tcpmss.h | 11 + .../usr/include/linux/netfilter/xt_tcpudp.h | 36 + .../usr/include/linux/netfilter/xt_time.h | 27 + .../usr/include/linux/netfilter/xt_u32.h | 42 + .../sysroot/usr/include/linux/netfilter_arp.h | 19 + .../include/linux/netfilter_arp/arp_tables.h | 204 + .../include/linux/netfilter_arp/arpt_mangle.h | 26 + .../usr/include/linux/netfilter_bridge.h | 27 + .../linux/netfilter_bridge/ebt_802_3.h | 62 + .../linux/netfilter_bridge/ebt_among.h | 64 + .../include/linux/netfilter_bridge/ebt_arp.h | 36 + .../linux/netfilter_bridge/ebt_arpreply.h | 10 + .../include/linux/netfilter_bridge/ebt_ip.h | 44 + .../include/linux/netfilter_bridge/ebt_ip6.h | 50 + .../linux/netfilter_bridge/ebt_limit.h | 24 + .../include/linux/netfilter_bridge/ebt_log.h | 20 + .../linux/netfilter_bridge/ebt_mark_m.h | 16 + .../linux/netfilter_bridge/ebt_mark_t.h | 23 + .../include/linux/netfilter_bridge/ebt_nat.h | 13 + .../linux/netfilter_bridge/ebt_nflog.h | 23 + .../linux/netfilter_bridge/ebt_pkttype.h | 12 + .../linux/netfilter_bridge/ebt_redirect.h | 10 + .../include/linux/netfilter_bridge/ebt_stp.h | 46 + .../include/linux/netfilter_bridge/ebt_ulog.h | 38 + .../include/linux/netfilter_bridge/ebt_vlan.h | 22 + .../include/linux/netfilter_bridge/ebtables.h | 268 + .../usr/include/linux/netfilter_decnet.h | 75 + .../usr/include/linux/netfilter_ipv4.h | 78 + .../include/linux/netfilter_ipv4/ip_queue.h | 64 + .../include/linux/netfilter_ipv4/ip_tables.h | 227 + .../linux/netfilter_ipv4/ipt_CLUSTERIP.h | 36 + .../include/linux/netfilter_ipv4/ipt_ECN.h | 33 + .../include/linux/netfilter_ipv4/ipt_LOG.h | 19 + .../include/linux/netfilter_ipv4/ipt_REJECT.h | 20 + .../include/linux/netfilter_ipv4/ipt_SAME.h | 20 + .../include/linux/netfilter_ipv4/ipt_TTL.h | 23 + .../include/linux/netfilter_ipv4/ipt_ULOG.h | 49 + .../linux/netfilter_ipv4/ipt_addrtype.h | 27 + .../usr/include/linux/netfilter_ipv4/ipt_ah.h | 17 + .../include/linux/netfilter_ipv4/ipt_ecn.h | 35 + .../include/linux/netfilter_ipv4/ipt_realm.h | 7 + .../include/linux/netfilter_ipv4/ipt_ttl.h | 23 + .../usr/include/linux/netfilter_ipv4/nf_nat.h | 58 + .../usr/include/linux/netfilter_ipv6.h | 76 + .../include/linux/netfilter_ipv6/ip6_tables.h | 265 + .../include/linux/netfilter_ipv6/ip6t_HL.h | 24 + .../include/linux/netfilter_ipv6/ip6t_LOG.h | 19 + .../linux/netfilter_ipv6/ip6t_REJECT.h | 20 + .../include/linux/netfilter_ipv6/ip6t_ah.h | 22 + .../include/linux/netfilter_ipv6/ip6t_frag.h | 25 + .../include/linux/netfilter_ipv6/ip6t_hl.h | 24 + .../linux/netfilter_ipv6/ip6t_ipv6header.h | 28 + .../include/linux/netfilter_ipv6/ip6t_mh.h | 16 + .../include/linux/netfilter_ipv6/ip6t_opts.h | 24 + .../include/linux/netfilter_ipv6/ip6t_rt.h | 33 + .../sysroot/usr/include/linux/netlink.h | 151 + .../sysroot/usr/include/linux/netrom.h | 36 + .../sysroot/usr/include/linux/nfc.h | 134 + .../sysroot/usr/include/linux/nfs.h | 131 + .../sysroot/usr/include/linux/nfs2.h | 67 + .../sysroot/usr/include/linux/nfs3.h | 97 + .../sysroot/usr/include/linux/nfs4.h | 174 + .../sysroot/usr/include/linux/nfs4_mount.h | 71 + .../sysroot/usr/include/linux/nfs_fs.h | 60 + .../sysroot/usr/include/linux/nfs_idmap.h | 65 + .../sysroot/usr/include/linux/nfs_mount.h | 77 + .../sysroot/usr/include/linux/nfsacl.h | 29 + .../sysroot/usr/include/linux/nfsd/debug.h | 40 + .../sysroot/usr/include/linux/nfsd/export.h | 59 + .../sysroot/usr/include/linux/nfsd/nfsfh.h | 122 + .../sysroot/usr/include/linux/nfsd/stats.h | 17 + .../sysroot/usr/include/linux/nl80211.h | 2653 ++++++ .../sysroot/usr/include/linux/nubus.h | 244 + .../sysroot/usr/include/linux/nvram.h | 16 + .../sysroot/usr/include/linux/omap3isp.h | 644 ++ .../sysroot/usr/include/linux/omapfb.h | 222 + .../sysroot/usr/include/linux/oom.h | 22 + .../sysroot/usr/include/linux/param.h | 6 + .../sysroot/usr/include/linux/parport.h | 95 + .../sysroot/usr/include/linux/patchkey.h | 33 + .../sysroot/usr/include/linux/pci.h | 41 + .../sysroot/usr/include/linux/pci_regs.h | 735 ++ .../sysroot/usr/include/linux/perf_event.h | 483 ++ .../sysroot/usr/include/linux/personality.h | 69 + .../sysroot/usr/include/linux/pfkeyv2.h | 370 + .../sysroot/usr/include/linux/pg.h | 63 + .../sysroot/usr/include/linux/phantom.h | 49 + .../sysroot/usr/include/linux/phonet.h | 183 + .../sysroot/usr/include/linux/pkt_cls.h | 467 ++ .../sysroot/usr/include/linux/pkt_sched.h | 606 ++ .../sysroot/usr/include/linux/pktcdvd.h | 111 + .../sysroot/usr/include/linux/pmu.h | 135 + .../sysroot/usr/include/linux/poll.h | 7 + .../sysroot/usr/include/linux/posix_types.h | 49 + .../sysroot/usr/include/linux/ppdev.h | 99 + .../sysroot/usr/include/linux/ppp-comp.h | 210 + .../sysroot/usr/include/linux/ppp_defs.h | 180 + .../sysroot/usr/include/linux/pps.h | 131 + .../sysroot/usr/include/linux/prctl.h | 105 + .../sysroot/usr/include/linux/ptp_clock.h | 84 + .../sysroot/usr/include/linux/ptrace.h | 80 + .../sysroot/usr/include/linux/qnx4_fs.h | 88 + .../sysroot/usr/include/linux/qnxtypes.h | 28 + .../sysroot/usr/include/linux/quota.h | 171 + .../sysroot/usr/include/linux/radeonfb.h | 15 + .../sysroot/usr/include/linux/raid/md_p.h | 283 + .../sysroot/usr/include/linux/raid/md_u.h | 156 + .../sysroot/usr/include/linux/random.h | 50 + .../sysroot/usr/include/linux/raw.h | 18 + .../sysroot/usr/include/linux/rds.h | 285 + .../sysroot/usr/include/linux/reboot.h | 39 + .../sysroot/usr/include/linux/reiserfs_fs.h | 35 + .../usr/include/linux/reiserfs_xattr.h | 25 + .../sysroot/usr/include/linux/resource.h | 80 + .../sysroot/usr/include/linux/rfkill.h | 107 + .../sysroot/usr/include/linux/romfs_fs.h | 59 + .../sysroot/usr/include/linux/rose.h | 90 + .../sysroot/usr/include/linux/route.h | 67 + .../sysroot/usr/include/linux/rtc.h | 104 + .../sysroot/usr/include/linux/rtnetlink.h | 610 ++ .../sysroot/usr/include/linux/scc.h | 172 + .../sysroot/usr/include/linux/sched.h | 46 + .../sysroot/usr/include/linux/screen_info.h | 72 + .../sysroot/usr/include/linux/sdla.h | 116 + .../sysroot/usr/include/linux/securebits.h | 51 + .../usr/include/linux/selinux_netlink.h | 48 + .../sysroot/usr/include/linux/sem.h | 80 + .../sysroot/usr/include/linux/serial.h | 204 + .../sysroot/usr/include/linux/serial_core.h | 215 + .../sysroot/usr/include/linux/serial_reg.h | 367 + .../sysroot/usr/include/linux/serio.h | 80 + .../sysroot/usr/include/linux/shm.h | 75 + .../sysroot/usr/include/linux/signal.h | 8 + .../sysroot/usr/include/linux/signalfd.h | 52 + .../sysroot/usr/include/linux/snmp.h | 273 + .../sysroot/usr/include/linux/socket.h | 21 + .../sysroot/usr/include/linux/sockios.h | 148 + .../sysroot/usr/include/linux/som.h | 154 + .../sysroot/usr/include/linux/sonet.h | 60 + .../sysroot/usr/include/linux/sonypi.h | 146 + .../sysroot/usr/include/linux/sound.h | 27 + .../sysroot/usr/include/linux/soundcard.h | 1276 +++ .../sysroot/usr/include/linux/spi/spidev.h | 132 + .../sysroot/usr/include/linux/stat.h | 45 + .../sysroot/usr/include/linux/stddef.h | 14 + .../sysroot/usr/include/linux/string.h | 7 + .../sysroot/usr/include/linux/sunrpc/debug.h | 48 + .../usr/include/linux/suspend_ioctls.h | 33 + .../sysroot/usr/include/linux/swab.h | 282 + .../sysroot/usr/include/linux/synclink.h | 300 + .../sysroot/usr/include/linux/sysctl.h | 932 +++ .../sysroot/usr/include/linux/taskstats.h | 213 + .../usr/include/linux/tc_act/tc_csum.h | 32 + .../usr/include/linux/tc_act/tc_gact.h | 32 + .../sysroot/usr/include/linux/tc_act/tc_ipt.h | 20 + .../usr/include/linux/tc_act/tc_mirred.h | 27 + .../sysroot/usr/include/linux/tc_act/tc_nat.h | 27 + .../usr/include/linux/tc_act/tc_pedit.h | 34 + .../usr/include/linux/tc_act/tc_skbedit.h | 46 + .../usr/include/linux/tc_ematch/tc_em_cmp.h | 25 + .../usr/include/linux/tc_ematch/tc_em_meta.h | 92 + .../usr/include/linux/tc_ematch/tc_em_nbyte.h | 13 + .../usr/include/linux/tc_ematch/tc_em_text.h | 19 + .../sysroot/usr/include/linux/tcp.h | 208 + .../sysroot/usr/include/linux/telephony.h | 262 + .../sysroot/usr/include/linux/termios.h | 22 + .../sysroot/usr/include/linux/time.h | 79 + .../sysroot/usr/include/linux/times.h | 13 + .../sysroot/usr/include/linux/timex.h | 164 + .../sysroot/usr/include/linux/tiocl.h | 39 + .../sysroot/usr/include/linux/tipc.h | 209 + .../sysroot/usr/include/linux/tipc_config.h | 393 + .../sysroot/usr/include/linux/toshiba.h | 37 + .../sysroot/usr/include/linux/tty.h | 38 + .../sysroot/usr/include/linux/types.h | 51 + .../sysroot/usr/include/linux/udf_fs_i.h | 21 + .../sysroot/usr/include/linux/udp.h | 39 + .../sysroot/usr/include/linux/uinput.h | 137 + .../sysroot/usr/include/linux/uio.h | 30 + .../sysroot/usr/include/linux/ultrasound.h | 103 + .../sysroot/usr/include/linux/un.h | 13 + .../sysroot/usr/include/linux/unistd.h | 9 + .../sysroot/usr/include/linux/usb/audio.h | 547 ++ .../sysroot/usr/include/linux/usb/cdc.h | 412 + .../sysroot/usr/include/linux/usb/ch11.h | 243 + .../sysroot/usr/include/linux/usb/ch9.h | 952 +++ .../usr/include/linux/usb/functionfs.h | 167 + .../sysroot/usr/include/linux/usb/g_printer.h | 35 + .../sysroot/usr/include/linux/usb/gadgetfs.h | 88 + .../sysroot/usr/include/linux/usb/midi.h | 112 + .../sysroot/usr/include/linux/usb/tmc.h | 43 + .../sysroot/usr/include/linux/usb/video.h | 568 ++ .../sysroot/usr/include/linux/usbdevice_fs.h | 158 + .../sysroot/usr/include/linux/utime.h | 11 + .../sysroot/usr/include/linux/utsname.h | 34 + .../sysroot/usr/include/linux/uvcvideo.h | 69 + .../sysroot/usr/include/linux/v4l2-mediabus.h | 114 + .../sysroot/usr/include/linux/v4l2-subdev.h | 141 + .../sysroot/usr/include/linux/version.h | 2 + .../sysroot/usr/include/linux/veth.h | 12 + .../sysroot/usr/include/linux/vhost.h | 130 + .../sysroot/usr/include/linux/videodev2.h | 2258 ++++++ .../sysroot/usr/include/linux/virtio_9p.h | 44 + .../usr/include/linux/virtio_balloon.h | 59 + .../sysroot/usr/include/linux/virtio_blk.h | 122 + .../sysroot/usr/include/linux/virtio_config.h | 54 + .../usr/include/linux/virtio_console.h | 74 + .../sysroot/usr/include/linux/virtio_ids.h | 39 + .../sysroot/usr/include/linux/virtio_net.h | 155 + .../sysroot/usr/include/linux/virtio_pci.h | 95 + .../sysroot/usr/include/linux/virtio_ring.h | 163 + .../sysroot/usr/include/linux/virtio_rng.h | 8 + .../sysroot/usr/include/linux/vt.h | 90 + .../sysroot/usr/include/linux/wait.h | 21 + .../sysroot/usr/include/linux/wanrouter.h | 452 ++ .../sysroot/usr/include/linux/watchdog.h | 55 + .../sysroot/usr/include/linux/wimax.h | 239 + .../sysroot/usr/include/linux/wimax/i2400m.h | 572 ++ .../sysroot/usr/include/linux/wireless.h | 1128 +++ .../sysroot/usr/include/linux/x25.h | 152 + .../sysroot/usr/include/linux/xattr.h | 61 + .../sysroot/usr/include/linux/xfrm.h | 504 ++ .../sysroot/usr/include/localcharset.h | 40 + .../sysroot/usr/include/locale.h | 219 + .../sysroot/usr/include/ltdl.h | 163 + .../sysroot/usr/include/lz4.h | 463 ++ .../sysroot/usr/include/lz4frame.h | 340 + .../sysroot/usr/include/lz4hc.h | 228 + .../sysroot/usr/include/mad.h | 996 +++ .../sysroot/usr/include/malloc.h | 192 + .../sysroot/usr/include/math.h | 524 ++ .../sysroot/usr/include/memory.h | 33 + .../sysroot/usr/include/menu.h | 260 + .../sysroot/usr/include/mntent.h | 97 + .../sysroot/usr/include/mqueue.h | 91 + .../sysroot/usr/include/mtd/inftl-user.h | 91 + .../sysroot/usr/include/mtd/mtd-abi.h | 277 + .../sysroot/usr/include/mtd/mtd-user.h | 34 + .../sysroot/usr/include/mtd/nftl-user.h | 90 + .../sysroot/usr/include/mtd/ubi-user.h | 414 + .../sysroot/usr/include/ncurses.h | 1 + .../sysroot/usr/include/ncurses_dll.h | 102 + .../sysroot/usr/include/net/ethernet.h | 83 + .../sysroot/usr/include/net/if.h | 204 + .../sysroot/usr/include/net/if_arp.h | 183 + .../sysroot/usr/include/net/if_packet.h | 36 + .../sysroot/usr/include/net/if_ppp.h | 169 + .../sysroot/usr/include/net/if_shaper.h | 58 + .../sysroot/usr/include/net/if_slip.h | 24 + .../sysroot/usr/include/net/ppp-comp.h | 1 + .../sysroot/usr/include/net/ppp_defs.h | 10 + .../sysroot/usr/include/net/route.h | 144 + .../sysroot/usr/include/netax25/ax25.h | 170 + .../sysroot/usr/include/netdb.h | 644 ++ .../sysroot/usr/include/neteconet/ec.h | 51 + .../sysroot/usr/include/netinet/ether.h | 56 + .../sysroot/usr/include/netinet/icmp6.h | 345 + .../sysroot/usr/include/netinet/if_ether.h | 104 + .../sysroot/usr/include/netinet/if_fddi.h | 36 + .../sysroot/usr/include/netinet/if_tr.h | 110 + .../sysroot/usr/include/netinet/igmp.h | 125 + .../sysroot/usr/include/netinet/in.h | 578 ++ .../sysroot/usr/include/netinet/in_systm.h | 40 + .../sysroot/usr/include/netinet/ip.h | 302 + .../sysroot/usr/include/netinet/ip6.h | 188 + .../sysroot/usr/include/netinet/ip_icmp.h | 282 + .../sysroot/usr/include/netinet/tcp.h | 259 + .../sysroot/usr/include/netinet/udp.h | 94 + .../sysroot/usr/include/netipx/ipx.h | 112 + .../sysroot/usr/include/netpacket/packet.h | 63 + .../sysroot/usr/include/nl_types.h | 56 + .../sysroot/usr/include/ntfs-3g/acls.h | 184 + .../sysroot/usr/include/ntfs-3g/attrib.h | 403 + .../sysroot/usr/include/ntfs-3g/attrlist.h | 51 + .../sysroot/usr/include/ntfs-3g/bitmap.h | 96 + .../sysroot/usr/include/ntfs-3g/bootsect.h | 42 + .../sysroot/usr/include/ntfs-3g/cache.h | 118 + .../sysroot/usr/include/ntfs-3g/collate.h | 34 + .../sysroot/usr/include/ntfs-3g/compat.h | 79 + .../sysroot/usr/include/ntfs-3g/compress.h | 41 + .../sysroot/usr/include/ntfs-3g/debug.h | 47 + .../sysroot/usr/include/ntfs-3g/device.h | 144 + .../sysroot/usr/include/ntfs-3g/device_io.h | 88 + .../sysroot/usr/include/ntfs-3g/dir.h | 130 + .../sysroot/usr/include/ntfs-3g/ea.h | 33 + .../sysroot/usr/include/ntfs-3g/efs.h | 30 + .../sysroot/usr/include/ntfs-3g/endians.h | 305 + .../sysroot/usr/include/ntfs-3g/index.h | 168 + .../sysroot/usr/include/ntfs-3g/inode.h | 225 + .../sysroot/usr/include/ntfs-3g/ioctl.h | 30 + .../sysroot/usr/include/ntfs-3g/layout.h | 2668 ++++++ .../sysroot/usr/include/ntfs-3g/lcnalloc.h | 51 + .../sysroot/usr/include/ntfs-3g/logfile.h | 470 ++ .../sysroot/usr/include/ntfs-3g/logging.h | 121 + .../sysroot/usr/include/ntfs-3g/mft.h | 134 + .../sysroot/usr/include/ntfs-3g/misc.h | 30 + .../sysroot/usr/include/ntfs-3g/mst.h | 37 + .../sysroot/usr/include/ntfs-3g/ntfstime.h | 131 + .../sysroot/usr/include/ntfs-3g/object_id.h | 35 + .../sysroot/usr/include/ntfs-3g/param.h | 151 + .../sysroot/usr/include/ntfs-3g/plugin.h | 141 + .../sysroot/usr/include/ntfs-3g/realpath.h | 24 + .../sysroot/usr/include/ntfs-3g/reparse.h | 41 + .../sysroot/usr/include/ntfs-3g/runlist.h | 90 + .../sysroot/usr/include/ntfs-3g/security.h | 338 + .../sysroot/usr/include/ntfs-3g/support.h | 85 + .../sysroot/usr/include/ntfs-3g/types.h | 140 + .../sysroot/usr/include/ntfs-3g/unistr.h | 121 + .../sysroot/usr/include/ntfs-3g/volume.h | 312 + .../sysroot/usr/include/ntfs-3g/xattrs.h | 97 + .../sysroot/usr/include/ogg/config_types.h | 25 + .../sysroot/usr/include/ogg/ogg.h | 210 + .../sysroot/usr/include/ogg/os_types.h | 148 + .../sysroot/usr/include/panel.h | 85 + .../sysroot/usr/include/paths.h | 75 + .../sysroot/usr/include/png.h | 1 + .../sysroot/usr/include/pngconf.h | 1 + .../sysroot/usr/include/pnglibconf.h | 1 + .../sysroot/usr/include/poll.h | 1 + .../sysroot/usr/include/popt.h | 744 ++ .../sysroot/usr/include/printf.h | 196 + .../sysroot/usr/include/protocols/routed.h | 101 + .../sysroot/usr/include/protocols/rwhod.h | 67 + .../sysroot/usr/include/protocols/talkd.h | 113 + .../sysroot/usr/include/protocols/timed.h | 97 + .../sysroot/usr/include/pthread.h | 1145 +++ .../sysroot/usr/include/pty.h | 43 + .../sysroot/usr/include/pwd.h | 185 + .../usr/include/python2.7/Python-ast.h | 535 ++ .../sysroot/usr/include/python2.7/Python.h | 181 + .../sysroot/usr/include/python2.7/abstract.h | 1396 ++++ .../sysroot/usr/include/python2.7/asdl.h | 45 + .../sysroot/usr/include/python2.7/ast.h | 13 + .../sysroot/usr/include/python2.7/bitset.h | 32 + .../usr/include/python2.7/boolobject.h | 36 + .../usr/include/python2.7/bufferobject.h | 33 + .../usr/include/python2.7/bytearrayobject.h | 57 + .../usr/include/python2.7/bytes_methods.h | 75 + .../usr/include/python2.7/bytesobject.h | 27 + .../sysroot/usr/include/python2.7/cStringIO.h | 73 + .../usr/include/python2.7/cellobject.h | 28 + .../sysroot/usr/include/python2.7/ceval.h | 154 + .../usr/include/python2.7/classobject.h | 83 + .../sysroot/usr/include/python2.7/cobject.h | 89 + .../sysroot/usr/include/python2.7/code.h | 116 + .../sysroot/usr/include/python2.7/codecs.h | 212 + .../sysroot/usr/include/python2.7/compile.h | 40 + .../usr/include/python2.7/complexobject.h | 66 + .../sysroot/usr/include/python2.7/datetime.h | 239 + .../usr/include/python2.7/descrobject.h | 94 + .../usr/include/python2.7/dictobject.h | 160 + .../sysroot/usr/include/python2.7/dtoa.h | 15 + .../usr/include/python2.7/enumobject.h | 17 + .../sysroot/usr/include/python2.7/errcode.h | 36 + .../sysroot/usr/include/python2.7/eval.h | 25 + .../usr/include/python2.7/fileobject.h | 97 + .../usr/include/python2.7/floatobject.h | 140 + .../usr/include/python2.7/frameobject.h | 89 + .../usr/include/python2.7/funcobject.h | 76 + .../sysroot/usr/include/python2.7/genobject.h | 40 + .../sysroot/usr/include/python2.7/graminit.h | 87 + .../sysroot/usr/include/python2.7/grammar.h | 93 + .../sysroot/usr/include/python2.7/import.h | 71 + .../sysroot/usr/include/python2.7/intobject.h | 81 + .../sysroot/usr/include/python2.7/intrcheck.h | 15 + .../usr/include/python2.7/iterobject.h | 23 + .../usr/include/python2.7/listobject.h | 68 + .../usr/include/python2.7/longintrepr.h | 103 + .../usr/include/python2.7/longobject.h | 135 + .../sysroot/usr/include/python2.7/marshal.h | 25 + .../usr/include/python2.7/memoryobject.h | 74 + .../usr/include/python2.7/metagrammar.h | 18 + .../usr/include/python2.7/methodobject.h | 93 + .../usr/include/python2.7/modsupport.h | 134 + .../usr/include/python2.7/moduleobject.h | 24 + .../sysroot/usr/include/python2.7/node.h | 41 + .../sysroot/usr/include/python2.7/object.h | 1046 +++ .../sysroot/usr/include/python2.7/objimpl.h | 369 + .../sysroot/usr/include/python2.7/opcode.h | 171 + .../sysroot/usr/include/python2.7/osdefs.h | 63 + .../sysroot/usr/include/python2.7/parsetok.h | 64 + .../usr/include/python2.7/patchlevel.h | 43 + .../sysroot/usr/include/python2.7/pgen.h | 18 + .../usr/include/python2.7/pgenheaders.h | 42 + .../sysroot/usr/include/python2.7/py_curses.h | 177 + .../sysroot/usr/include/python2.7/pyarena.h | 62 + .../sysroot/usr/include/python2.7/pycapsule.h | 56 + .../sysroot/usr/include/python2.7/pyconfig.h | 1317 +++ .../sysroot/usr/include/python2.7/pyctype.h | 31 + .../sysroot/usr/include/python2.7/pydebug.h | 41 + .../sysroot/usr/include/python2.7/pyerrors.h | 329 + .../sysroot/usr/include/python2.7/pyexpat.h | 48 + .../sysroot/usr/include/python2.7/pyfpe.h | 176 + .../sysroot/usr/include/python2.7/pygetopt.h | 18 + .../usr/include/python2.7/pymacconfig.h | 102 + .../usr/include/python2.7/pymactoolbox.h | 232 + .../sysroot/usr/include/python2.7/pymath.h | 214 + .../sysroot/usr/include/python2.7/pymem.h | 122 + .../sysroot/usr/include/python2.7/pyport.h | 950 +++ .../sysroot/usr/include/python2.7/pystate.h | 200 + .../sysroot/usr/include/python2.7/pystrcmp.h | 23 + .../sysroot/usr/include/python2.7/pystrtod.h | 45 + .../sysroot/usr/include/python2.7/pythonrun.h | 181 + .../sysroot/usr/include/python2.7/pythread.h | 41 + .../usr/include/python2.7/rangeobject.h | 28 + .../sysroot/usr/include/python2.7/setobject.h | 99 + .../usr/include/python2.7/sliceobject.h | 50 + .../usr/include/python2.7/stringobject.h | 210 + .../usr/include/python2.7/structmember.h | 99 + .../sysroot/usr/include/python2.7/structseq.h | 41 + .../sysroot/usr/include/python2.7/symtable.h | 98 + .../sysroot/usr/include/python2.7/sysmodule.h | 31 + .../sysroot/usr/include/python2.7/timefuncs.h | 26 + .../sysroot/usr/include/python2.7/token.h | 85 + .../sysroot/usr/include/python2.7/traceback.h | 31 + .../usr/include/python2.7/tupleobject.h | 61 + .../sysroot/usr/include/python2.7/ucnhash.h | 33 + .../usr/include/python2.7/unicodeobject.h | 1413 ++++ .../sysroot/usr/include/python2.7/warnings.h | 23 + .../usr/include/python2.7/weakrefobject.h | 82 + .../sysroot/usr/include/rdma/ib_user_cm.h | 325 + .../sysroot/usr/include/rdma/ib_user_mad.h | 203 + .../sysroot/usr/include/rdma/ib_user_sa.h | 76 + .../sysroot/usr/include/rdma/ib_user_verbs.h | 734 ++ .../sysroot/usr/include/rdma/rdma_netlink.h | 37 + .../sysroot/usr/include/rdma/rdma_user_cm.h | 248 + .../sysroot/usr/include/regdef.h | 25 + .../sysroot/usr/include/regex.h | 569 ++ .../sysroot/usr/include/regexp.h | 231 + .../sysroot/usr/include/resolv.h | 424 + .../sysroot/usr/include/sched.h | 120 + .../sysroot/usr/include/scsi/fc/fc_els.h | 831 ++ .../sysroot/usr/include/scsi/fc/fc_fs.h | 348 + .../sysroot/usr/include/scsi/fc/fc_gs.h | 96 + .../sysroot/usr/include/scsi/fc/fc_ns.h | 208 + .../sysroot/usr/include/scsi/scsi.h | 225 + .../sysroot/usr/include/scsi/scsi_bsg_fc.h | 322 + .../sysroot/usr/include/scsi/scsi_ioctl.h | 33 + .../sysroot/usr/include/scsi/scsi_netlink.h | 125 + .../usr/include/scsi/scsi_netlink_fc.h | 71 + .../sysroot/usr/include/scsi/sg.h | 274 + .../sysroot/usr/include/search.h | 174 + .../sysroot/usr/include/semaphore.h | 78 + .../sysroot/usr/include/setjmp.h | 108 + .../sysroot/usr/include/sgidefs.h | 72 + .../sysroot/usr/include/sgtty.h | 44 + .../sysroot/usr/include/shadow.h | 148 + .../sigc++/adaptors/adaptor_trait.h | 403 + .../sigc++-2.0/sigc++/adaptors/adaptors.h | 32 + .../include/sigc++-2.0/sigc++/adaptors/bind.h | 2316 ++++++ .../sigc++-2.0/sigc++/adaptors/bind_return.h | 233 + .../sigc++/adaptors/bound_argument.h | 209 + .../sigc++-2.0/sigc++/adaptors/compose.h | 306 + .../sigc++/adaptors/deduce_result_type.h | 71 + .../sigc++/adaptors/exception_catch.h | 330 + .../include/sigc++-2.0/sigc++/adaptors/hide.h | 1078 +++ .../sigc++-2.0/sigc++/adaptors/lambda/base.h | 272 + .../sigc++/adaptors/lambda/select.h | 342 + .../sigc++-2.0/sigc++/adaptors/retype.h | 1266 +++ .../sigc++/adaptors/retype_return.h | 317 + .../sigc++-2.0/sigc++/adaptors/track_obj.h | 874 ++ .../usr/include/sigc++-2.0/sigc++/bind.h | 24 + .../include/sigc++-2.0/sigc++/bind_return.h | 25 + .../include/sigc++-2.0/sigc++/connection.h | 130 + .../sigc++/functors/functor_trait.h | 417 + .../sigc++-2.0/sigc++/functors/functors.h | 27 + .../sigc++-2.0/sigc++/functors/mem_fun.h | 7071 ++++++++++++++++ .../sigc++-2.0/sigc++/functors/ptr_fun.h | 542 ++ .../include/sigc++-2.0/sigc++/functors/slot.h | 2320 ++++++ .../sigc++-2.0/sigc++/functors/slot_base.h | 387 + .../sigc++-2.0/sigc++/limit_reference.h | 471 ++ .../sigc++-2.0/sigc++/reference_wrapper.h | 144 + .../include/sigc++-2.0/sigc++/retype_return.h | 25 + .../usr/include/sigc++-2.0/sigc++/sigc++.h | 110 + .../usr/include/sigc++-2.0/sigc++/signal.h | 4871 +++++++++++ .../include/sigc++-2.0/sigc++/signal_base.h | 415 + .../usr/include/sigc++-2.0/sigc++/slot.h | 20 + .../usr/include/sigc++-2.0/sigc++/trackable.h | 161 + .../include/sigc++-2.0/sigc++/type_traits.h | 70 + .../include/sigc++-2.0/sigc++/visit_each.h | 206 + .../sysroot/usr/include/signal.h | 382 + .../sysroot/usr/include/sndfile.h | 857 ++ .../sysroot/usr/include/sound/asequencer.h | 614 ++ .../sysroot/usr/include/sound/asound.h | 904 +++ .../sysroot/usr/include/sound/asound_fm.h | 134 + .../sysroot/usr/include/sound/emu10k1.h | 371 + .../sysroot/usr/include/sound/hdsp.h | 110 + .../sysroot/usr/include/sound/hdspm.h | 229 + .../sysroot/usr/include/sound/sb16_csp.h | 122 + .../sysroot/usr/include/sound/sfnt_info.h | 212 + .../sysroot/usr/include/spawn.h | 295 + .../sysroot/usr/include/ss/ss.h | 96 + .../sysroot/usr/include/ss/ss_err.h | 30 + .../sysroot/usr/include/stdint.h | 306 + .../sysroot/usr/include/stdio.h | 870 ++ .../sysroot/usr/include/stdio_ext.h | 86 + .../sysroot/usr/include/stdlib.h | 929 +++ .../sysroot/usr/include/string.h | 431 + .../sysroot/usr/include/strings.h | 97 + .../sysroot/usr/include/sys/acct.h | 109 + .../sysroot/usr/include/sys/asm.h | 497 ++ .../sysroot/usr/include/sys/bitypes.h | 3 + .../sysroot/usr/include/sys/cachectl.h | 43 + .../sysroot/usr/include/sys/cdefs.h | 371 + .../sysroot/usr/include/sys/dir.h | 27 + .../sysroot/usr/include/sys/epoll.h | 139 + .../sysroot/usr/include/sys/errno.h | 1 + .../sysroot/usr/include/sys/eventfd.h | 44 + .../sysroot/usr/include/sys/fanotify.h | 96 + .../sysroot/usr/include/sys/fcntl.h | 1 + .../sysroot/usr/include/sys/file.h | 55 + .../sysroot/usr/include/sys/fpregdef.h | 116 + .../sysroot/usr/include/sys/fsuid.h | 35 + .../sysroot/usr/include/sys/inotify.h | 99 + .../sysroot/usr/include/sys/ioctl.h | 45 + .../sysroot/usr/include/sys/ipc.h | 57 + .../sysroot/usr/include/sys/kd.h | 34 + .../sysroot/usr/include/sys/kdaemon.h | 32 + .../sysroot/usr/include/sys/klog.h | 33 + .../sysroot/usr/include/sys/mman.h | 152 + .../sysroot/usr/include/sys/mount.h | 147 + .../sysroot/usr/include/sys/msg.h | 84 + .../sysroot/usr/include/sys/mtio.h | 276 + .../sysroot/usr/include/sys/param.h | 81 + .../sysroot/usr/include/sys/personality.h | 72 + .../sysroot/usr/include/sys/poll.h | 73 + .../sysroot/usr/include/sys/prctl.h | 31 + .../sysroot/usr/include/sys/procfs.h | 111 + .../sysroot/usr/include/sys/ptrace.h | 190 + .../sysroot/usr/include/sys/queue.h | 574 ++ .../sysroot/usr/include/sys/quota.h | 226 + .../sysroot/usr/include/sys/random.h | 33 + .../sysroot/usr/include/sys/reboot.h | 54 + .../sysroot/usr/include/sys/regdef.h | 81 + .../sysroot/usr/include/sys/resource.h | 102 + .../sysroot/usr/include/sys/select.h | 129 + .../sysroot/usr/include/sys/sem.h | 68 + .../sysroot/usr/include/sys/sendfile.h | 51 + .../sysroot/usr/include/sys/shm.h | 64 + .../sysroot/usr/include/sys/signal.h | 1 + .../sysroot/usr/include/sys/signalfd.h | 58 + .../sysroot/usr/include/sys/socket.h | 277 + .../sysroot/usr/include/sys/socketvar.h | 3 + .../sysroot/usr/include/sys/soundcard.h | 1 + .../sysroot/usr/include/sys/stat.h | 384 + .../sysroot/usr/include/sys/statfs.h | 67 + .../sysroot/usr/include/sys/statvfs.h | 90 + .../sysroot/usr/include/sys/swap.h | 42 + .../sysroot/usr/include/sys/syscall.h | 26 + .../sysroot/usr/include/sys/sysctl.h | 71 + .../sysroot/usr/include/sys/sysinfo.h | 67 + .../sysroot/usr/include/sys/syslog.h | 212 + .../sysroot/usr/include/sys/sysmacros.h | 69 + .../sysroot/usr/include/sys/sysmips.h | 43 + .../sysroot/usr/include/sys/tas.h | 66 + .../sysroot/usr/include/sys/termios.h | 4 + .../sysroot/usr/include/sys/time.h | 194 + .../sysroot/usr/include/sys/timeb.h | 45 + .../sysroot/usr/include/sys/timerfd.h | 52 + .../sysroot/usr/include/sys/times.h | 52 + .../sysroot/usr/include/sys/timex.h | 136 + .../sysroot/usr/include/sys/ttydefaults.h | 100 + .../sysroot/usr/include/sys/types.h | 275 + .../sysroot/usr/include/sys/ucontext.h | 116 + .../sysroot/usr/include/sys/uio.h | 79 + .../sysroot/usr/include/sys/un.h | 46 + .../sysroot/usr/include/sys/unistd.h | 1 + .../sysroot/usr/include/sys/user.h | 216 + .../sysroot/usr/include/sys/utsname.h | 86 + .../sysroot/usr/include/sys/vfs.h | 4 + .../sysroot/usr/include/sys/vt.h | 1 + .../sysroot/usr/include/sys/wait.h | 183 + .../sysroot/usr/include/sys/xattr.h | 103 + .../sysroot/usr/include/syscall.h | 1 + .../sysroot/usr/include/sysexits.h | 114 + .../sysroot/usr/include/syslog.h | 1 + .../sysroot/usr/include/tar.h | 107 + .../sysroot/usr/include/term.h | 806 ++ .../sysroot/usr/include/termcap.h | 75 + .../sysroot/usr/include/termio.h | 6 + .../sysroot/usr/include/termios.h | 109 + .../sysroot/usr/include/tgmath.h | 455 ++ .../sysroot/usr/include/thread_db.h | 463 ++ .../sysroot/usr/include/tiff.h | 681 ++ .../sysroot/usr/include/tiffconf.h | 128 + .../sysroot/usr/include/tiffio.h | 560 ++ .../sysroot/usr/include/tiffvers.h | 9 + .../sysroot/usr/include/time.h | 374 + .../sysroot/usr/include/tremor/config_types.h | 25 + .../sysroot/usr/include/tremor/ivorbiscodec.h | 204 + .../sysroot/usr/include/tremor/ivorbisfile.h | 131 + .../sysroot/usr/include/ttyent.h | 65 + .../sysroot/usr/include/turbojpeg.h | 1744 ++++ .../sysroot/usr/include/uchar.h | 56 + .../sysroot/usr/include/ucontext.h | 53 + .../sysroot/usr/include/ulimit.h | 47 + .../sysroot/usr/include/ulockmgr.h | 24 + .../sysroot/usr/include/unctrl.h | 67 + .../sysroot/usr/include/unicode/alphaindex.h | 755 ++ .../sysroot/usr/include/unicode/appendable.h | 234 + .../sysroot/usr/include/unicode/basictz.h | 216 + .../sysroot/usr/include/unicode/brkiter.h | 661 ++ .../sysroot/usr/include/unicode/bytestream.h | 272 + .../sysroot/usr/include/unicode/bytestrie.h | 520 ++ .../usr/include/unicode/bytestriebuilder.h | 183 + .../sysroot/usr/include/unicode/calendar.h | 2551 ++++++ .../sysroot/usr/include/unicode/caniter.h | 210 + .../sysroot/usr/include/unicode/casemap.h | 496 ++ .../sysroot/usr/include/unicode/char16ptr.h | 306 + .../sysroot/usr/include/unicode/chariter.h | 728 ++ .../sysroot/usr/include/unicode/choicfmt.h | 596 ++ .../sysroot/usr/include/unicode/coleitr.h | 407 + .../sysroot/usr/include/unicode/coll.h | 1274 +++ .../include/unicode/compactdecimalformat.h | 415 + .../sysroot/usr/include/unicode/curramt.h | 132 + .../sysroot/usr/include/unicode/currpinf.h | 261 + .../sysroot/usr/include/unicode/currunit.h | 130 + .../sysroot/usr/include/unicode/datefmt.h | 952 +++ .../sysroot/usr/include/unicode/dbbi.h | 42 + .../sysroot/usr/include/unicode/dcfmtsym.h | 530 ++ .../sysroot/usr/include/unicode/decimfmt.h | 2280 ++++++ .../sysroot/usr/include/unicode/docmain.h | 222 + .../sysroot/usr/include/unicode/dtfmtsym.h | 1015 +++ .../sysroot/usr/include/unicode/dtintrv.h | 160 + .../sysroot/usr/include/unicode/dtitvfmt.h | 1046 +++ .../sysroot/usr/include/unicode/dtitvinf.h | 520 ++ .../sysroot/usr/include/unicode/dtptngen.h | 569 ++ .../sysroot/usr/include/unicode/dtrule.h | 252 + .../sysroot/usr/include/unicode/edits.h | 422 + .../sysroot/usr/include/unicode/enumset.h | 66 + .../sysroot/usr/include/unicode/errorcode.h | 139 + .../sysroot/usr/include/unicode/fieldpos.h | 294 + .../sysroot/usr/include/unicode/filteredbrk.h | 153 + .../sysroot/usr/include/unicode/fmtable.h | 762 ++ .../sysroot/usr/include/unicode/format.h | 307 + .../sysroot/usr/include/unicode/fpositer.h | 127 + .../sysroot/usr/include/unicode/gender.h | 113 + .../sysroot/usr/include/unicode/gregocal.h | 779 ++ .../sysroot/usr/include/unicode/icudataver.h | 43 + .../sysroot/usr/include/unicode/icuplug.h | 388 + .../sysroot/usr/include/unicode/idna.h | 325 + .../usr/include/unicode/listformatter.h | 171 + .../usr/include/unicode/localpointer.h | 524 ++ .../sysroot/usr/include/unicode/locdspnm.h | 207 + .../sysroot/usr/include/unicode/locid.h | 815 ++ .../sysroot/usr/include/unicode/measfmt.h | 399 + .../sysroot/usr/include/unicode/measunit.h | 1343 ++++ .../sysroot/usr/include/unicode/measure.h | 161 + .../usr/include/unicode/messagepattern.h | 945 +++ .../sysroot/usr/include/unicode/msgfmt.h | 1095 +++ .../sysroot/usr/include/unicode/normalizer2.h | 774 ++ .../sysroot/usr/include/unicode/normlzr.h | 809 ++ .../sysroot/usr/include/unicode/nounit.h | 111 + .../usr/include/unicode/numberformatter.h | 1998 +++++ .../sysroot/usr/include/unicode/numfmt.h | 1227 +++ .../sysroot/usr/include/unicode/numsys.h | 210 + .../sysroot/usr/include/unicode/parseerr.h | 94 + .../sysroot/usr/include/unicode/parsepos.h | 232 + .../sysroot/usr/include/unicode/platform.h | 863 ++ .../sysroot/usr/include/unicode/plurfmt.h | 617 ++ .../sysroot/usr/include/unicode/plurrule.h | 531 ++ .../sysroot/usr/include/unicode/ptypes.h | 128 + .../sysroot/usr/include/unicode/putil.h | 183 + .../sysroot/usr/include/unicode/rbbi.h | 717 ++ .../sysroot/usr/include/unicode/rbnf.h | 1140 +++ .../sysroot/usr/include/unicode/rbtz.h | 364 + .../sysroot/usr/include/unicode/regex.h | 1885 +++++ .../sysroot/usr/include/unicode/region.h | 224 + .../sysroot/usr/include/unicode/reldatefmt.h | 522 ++ .../sysroot/usr/include/unicode/rep.h | 263 + .../sysroot/usr/include/unicode/resbund.h | 492 ++ .../sysroot/usr/include/unicode/schriter.h | 189 + .../unicode/scientificnumberformatter.h | 222 + .../sysroot/usr/include/unicode/search.h | 577 ++ .../sysroot/usr/include/unicode/selfmt.h | 369 + .../usr/include/unicode/simpleformatter.h | 303 + .../sysroot/usr/include/unicode/simpletz.h | 930 +++ .../sysroot/usr/include/unicode/smpdtfmt.h | 1630 ++++ .../sysroot/usr/include/unicode/sortkey.h | 340 + .../sysroot/usr/include/unicode/std_string.h | 37 + .../sysroot/usr/include/unicode/strenum.h | 278 + .../usr/include/unicode/stringoptions.h | 198 + .../sysroot/usr/include/unicode/stringpiece.h | 224 + .../usr/include/unicode/stringtriebuilder.h | 414 + .../sysroot/usr/include/unicode/stsearch.h | 506 ++ .../sysroot/usr/include/unicode/symtable.h | 114 + .../sysroot/usr/include/unicode/tblcoll.h | 877 ++ .../sysroot/usr/include/unicode/timezone.h | 965 +++ .../sysroot/usr/include/unicode/tmunit.h | 137 + .../sysroot/usr/include/unicode/tmutamt.h | 170 + .../sysroot/usr/include/unicode/tmutfmt.h | 248 + .../sysroot/usr/include/unicode/translit.h | 1344 ++++ .../sysroot/usr/include/unicode/tzfmt.h | 1097 +++ .../sysroot/usr/include/unicode/tznames.h | 414 + .../sysroot/usr/include/unicode/tzrule.h | 830 ++ .../sysroot/usr/include/unicode/tztrans.h | 197 + .../sysroot/usr/include/unicode/ubidi.h | 2201 +++++ .../usr/include/unicode/ubiditransform.h | 318 + .../sysroot/usr/include/unicode/ubrk.h | 634 ++ .../sysroot/usr/include/unicode/ucal.h | 1564 ++++ .../sysroot/usr/include/unicode/ucasemap.h | 385 + .../sysroot/usr/include/unicode/ucat.h | 160 + .../sysroot/usr/include/unicode/uchar.h | 3732 +++++++++ .../sysroot/usr/include/unicode/ucharstrie.h | 578 ++ .../usr/include/unicode/ucharstriebuilder.h | 187 + .../sysroot/usr/include/unicode/uchriter.h | 387 + .../sysroot/usr/include/unicode/uclean.h | 262 + .../sysroot/usr/include/unicode/ucnv.h | 2043 +++++ .../sysroot/usr/include/unicode/ucnv_cb.h | 164 + .../sysroot/usr/include/unicode/ucnv_err.h | 465 ++ .../sysroot/usr/include/unicode/ucnvsel.h | 189 + .../sysroot/usr/include/unicode/ucol.h | 1497 ++++ .../sysroot/usr/include/unicode/ucoleitr.h | 268 + .../sysroot/usr/include/unicode/uconfig.h | 455 ++ .../sysroot/usr/include/unicode/ucsdet.h | 419 + .../sysroot/usr/include/unicode/ucurr.h | 420 + .../sysroot/usr/include/unicode/udat.h | 1660 ++++ .../sysroot/usr/include/unicode/udata.h | 437 + .../usr/include/unicode/udateintervalformat.h | 186 + .../sysroot/usr/include/unicode/udatpg.h | 605 ++ .../usr/include/unicode/udisplaycontext.h | 172 + .../sysroot/usr/include/unicode/uenum.h | 210 + .../usr/include/unicode/ufieldpositer.h | 121 + .../usr/include/unicode/uformattable.h | 288 + .../sysroot/usr/include/unicode/ugender.h | 84 + .../sysroot/usr/include/unicode/uidna.h | 772 ++ .../sysroot/usr/include/unicode/uiter.h | 709 ++ .../sysroot/usr/include/unicode/uldnames.h | 304 + .../usr/include/unicode/ulistformatter.h | 130 + .../sysroot/usr/include/unicode/uloc.h | 1272 +++ .../sysroot/usr/include/unicode/ulocdata.h | 296 + .../sysroot/usr/include/unicode/umachine.h | 420 + .../sysroot/usr/include/unicode/umisc.h | 62 + .../sysroot/usr/include/unicode/umsg.h | 625 ++ .../sysroot/usr/include/unicode/unifilt.h | 122 + .../sysroot/usr/include/unicode/unifunct.h | 127 + .../sysroot/usr/include/unicode/unimatch.h | 165 + .../sysroot/usr/include/unicode/unirepl.h | 99 + .../sysroot/usr/include/unicode/uniset.h | 1715 ++++ .../sysroot/usr/include/unicode/unistr.h | 4807 +++++++++++ .../sysroot/usr/include/unicode/unorm.h | 472 ++ .../sysroot/usr/include/unicode/unorm2.h | 603 ++ .../sysroot/usr/include/unicode/unum.h | 1439 ++++ .../sysroot/usr/include/unicode/unumsys.h | 172 + .../sysroot/usr/include/unicode/uobject.h | 322 + .../usr/include/unicode/upluralrules.h | 196 + .../sysroot/usr/include/unicode/uregex.h | 1614 ++++ .../sysroot/usr/include/unicode/uregion.h | 252 + .../sysroot/usr/include/unicode/ureldatefmt.h | 365 + .../sysroot/usr/include/unicode/urename.h | 1820 +++++ .../sysroot/usr/include/unicode/urep.h | 157 + .../sysroot/usr/include/unicode/ures.h | 908 +++ .../sysroot/usr/include/unicode/uscript.h | 675 ++ .../sysroot/usr/include/unicode/usearch.h | 891 ++ .../sysroot/usr/include/unicode/uset.h | 1130 +++ .../sysroot/usr/include/unicode/usetiter.h | 320 + .../sysroot/usr/include/unicode/ushape.h | 476 ++ .../sysroot/usr/include/unicode/uspoof.h | 1576 ++++ .../sysroot/usr/include/unicode/usprep.h | 271 + .../sysroot/usr/include/unicode/ustdio.h | 1018 +++ .../sysroot/usr/include/unicode/ustream.h | 63 + .../sysroot/usr/include/unicode/ustring.h | 1692 ++++ .../sysroot/usr/include/unicode/ustringtrie.h | 97 + .../sysroot/usr/include/unicode/utext.h | 1602 ++++ .../sysroot/usr/include/unicode/utf.h | 225 + .../sysroot/usr/include/unicode/utf16.h | 745 ++ .../sysroot/usr/include/unicode/utf32.h | 25 + .../sysroot/usr/include/unicode/utf8.h | 836 ++ .../sysroot/usr/include/unicode/utf_old.h | 1204 +++ .../sysroot/usr/include/unicode/utmscale.h | 490 ++ .../sysroot/usr/include/unicode/utrace.h | 379 + .../sysroot/usr/include/unicode/utrans.h | 658 ++ .../sysroot/usr/include/unicode/utypes.h | 701 ++ .../sysroot/usr/include/unicode/uvernum.h | 171 + .../sysroot/usr/include/unicode/uversion.h | 195 + .../sysroot/usr/include/unicode/vtzone.h | 457 ++ .../sysroot/usr/include/unistd.h | 1154 +++ .../sysroot/usr/include/utime.h | 51 + .../sysroot/usr/include/utmp.h | 95 + .../sysroot/usr/include/utmpx.h | 126 + .../sysroot/usr/include/uuid/uuid.h | 121 + .../sysroot/usr/include/valgrind/callgrind.h | 129 + .../sysroot/usr/include/valgrind/config.h | 468 ++ .../sysroot/usr/include/valgrind/drd.h | 571 ++ .../sysroot/usr/include/valgrind/helgrind.h | 798 ++ .../sysroot/usr/include/valgrind/libvex.h | 973 +++ .../usr/include/valgrind/libvex_basictypes.h | 200 + .../usr/include/valgrind/libvex_emnote.h | 136 + .../usr/include/valgrind/libvex_guest_amd64.h | 225 + .../usr/include/valgrind/libvex_guest_arm.h | 224 + .../usr/include/valgrind/libvex_guest_arm64.h | 203 + .../include/valgrind/libvex_guest_mips32.h | 173 + .../include/valgrind/libvex_guest_mips64.h | 172 + .../include/valgrind/libvex_guest_offsets.h | 224 + .../usr/include/valgrind/libvex_guest_ppc32.h | 298 + .../usr/include/valgrind/libvex_guest_ppc64.h | 343 + .../usr/include/valgrind/libvex_guest_s390x.h | 177 + .../include/valgrind/libvex_guest_tilegx.h | 149 + .../usr/include/valgrind/libvex_guest_x86.h | 322 + .../sysroot/usr/include/valgrind/libvex_ir.h | 3092 +++++++ .../include/valgrind/libvex_s390x_common.h | 120 + .../usr/include/valgrind/libvex_trc_values.h | 98 + .../sysroot/usr/include/valgrind/memcheck.h | 302 + .../usr/include/valgrind/pub_tool_addrinfo.h | 226 + .../usr/include/valgrind/pub_tool_aspacehl.h | 48 + .../usr/include/valgrind/pub_tool_aspacemgr.h | 165 + .../usr/include/valgrind/pub_tool_basics.h | 471 ++ .../include/valgrind/pub_tool_basics_asm.h | 79 + .../include/valgrind/pub_tool_clientstate.h | 73 + .../usr/include/valgrind/pub_tool_clreq.h | 40 + .../usr/include/valgrind/pub_tool_debuginfo.h | 274 + .../valgrind/pub_tool_deduppoolalloc.h | 139 + .../usr/include/valgrind/pub_tool_errormgr.h | 145 + .../include/valgrind/pub_tool_execontext.h | 125 + .../usr/include/valgrind/pub_tool_gdbserver.h | 199 + .../usr/include/valgrind/pub_tool_guest.h | 78 + .../usr/include/valgrind/pub_tool_hashtable.h | 141 + .../include/valgrind/pub_tool_libcassert.h | 68 + .../usr/include/valgrind/pub_tool_libcbase.h | 235 + .../usr/include/valgrind/pub_tool_libcfile.h | 115 + .../usr/include/valgrind/pub_tool_libcprint.h | 166 + .../usr/include/valgrind/pub_tool_libcproc.h | 119 + .../include/valgrind/pub_tool_libcsetjmp.h | 136 + .../include/valgrind/pub_tool_libcsignal.h | 55 + .../usr/include/valgrind/pub_tool_machine.h | 193 + .../include/valgrind/pub_tool_mallocfree.h | 72 + .../usr/include/valgrind/pub_tool_options.h | 258 + .../usr/include/valgrind/pub_tool_oset.h | 317 + .../usr/include/valgrind/pub_tool_poolalloc.h | 101 + .../usr/include/valgrind/pub_tool_rangemap.h | 84 + .../usr/include/valgrind/pub_tool_redir.h | 368 + .../include/valgrind/pub_tool_replacemalloc.h | 86 + .../usr/include/valgrind/pub_tool_seqmatch.h | 107 + .../usr/include/valgrind/pub_tool_signals.h | 52 + .../usr/include/valgrind/pub_tool_sparsewa.h | 98 + .../include/valgrind/pub_tool_stacktrace.h | 89 + .../include/valgrind/pub_tool_threadstate.h | 51 + .../usr/include/valgrind/pub_tool_tooliface.h | 725 ++ .../usr/include/valgrind/pub_tool_transtab.h | 43 + .../usr/include/valgrind/pub_tool_vki.h | 68 + .../usr/include/valgrind/pub_tool_vkiscnums.h | 54 + .../include/valgrind/pub_tool_vkiscnums_asm.h | 80 + .../usr/include/valgrind/pub_tool_wordfm.h | 215 + .../usr/include/valgrind/pub_tool_xarray.h | 173 + .../sysroot/usr/include/valgrind/valgrind.h | 7160 +++++++++++++++++ .../include/valgrind/vki/vki-amd64-linux.h | 708 ++ .../usr/include/valgrind/vki/vki-arm-linux.h | 918 +++ .../include/valgrind/vki/vki-arm64-linux.h | 701 ++ .../usr/include/valgrind/vki/vki-darwin.h | 1114 +++ .../usr/include/valgrind/vki/vki-linux-drm.h | 810 ++ .../usr/include/valgrind/vki/vki-linux.h | 4735 +++++++++++ .../include/valgrind/vki/vki-mips32-linux.h | 1066 +++ .../include/valgrind/vki/vki-mips64-linux.h | 1030 +++ .../valgrind/vki/vki-posixtypes-amd64-linux.h | 68 + .../valgrind/vki/vki-posixtypes-arm-linux.h | 68 + .../valgrind/vki/vki-posixtypes-arm64-linux.h | 68 + .../vki/vki-posixtypes-mips32-linux.h | 68 + .../vki/vki-posixtypes-mips64-linux.h | 87 + .../valgrind/vki/vki-posixtypes-ppc32-linux.h | 68 + .../valgrind/vki/vki-posixtypes-ppc64-linux.h | 75 + .../valgrind/vki/vki-posixtypes-s390x-linux.h | 77 + .../valgrind/vki/vki-posixtypes-x86-linux.h | 68 + .../include/valgrind/vki/vki-ppc32-linux.h | 966 +++ .../include/valgrind/vki/vki-ppc64-linux.h | 812 ++ .../include/valgrind/vki/vki-s390x-linux.h | 993 +++ .../valgrind/vki/vki-scnums-amd64-linux.h | 411 + .../valgrind/vki/vki-scnums-arm-linux.h | 440 + .../valgrind/vki/vki-scnums-arm64-linux.h | 517 ++ .../include/valgrind/vki/vki-scnums-darwin.h | 806 ++ .../valgrind/vki/vki-scnums-mips32-linux.h | 408 + .../valgrind/vki/vki-scnums-mips64-linux.h | 359 + .../valgrind/vki/vki-scnums-ppc32-linux.h | 411 + .../valgrind/vki/vki-scnums-ppc64-linux.h | 403 + .../valgrind/vki/vki-scnums-s390x-linux.h | 376 + .../include/valgrind/vki/vki-scnums-solaris.h | 374 + .../valgrind/vki/vki-scnums-x86-linux.h | 419 + .../valgrind/vki/vki-solaris-repcache.h | 450 ++ .../usr/include/valgrind/vki/vki-solaris.h | 1701 ++++ .../usr/include/valgrind/vki/vki-x86-linux.h | 924 +++ .../usr/include/valgrind/vki/vki-xen-domctl.h | 543 ++ .../usr/include/valgrind/vki/vki-xen-evtchn.h | 73 + .../usr/include/valgrind/vki/vki-xen-gnttab.h | 59 + .../usr/include/valgrind/vki/vki-xen-hvm.h | 115 + .../usr/include/valgrind/vki/vki-xen-memory.h | 109 + .../usr/include/valgrind/vki/vki-xen-mmuext.h | 75 + .../include/valgrind/vki/vki-xen-physdev.h | 67 + .../include/valgrind/vki/vki-xen-schedop.h | 50 + .../usr/include/valgrind/vki/vki-xen-sysctl.h | 204 + .../usr/include/valgrind/vki/vki-xen-tmem.h | 102 + .../include/valgrind/vki/vki-xen-version.h | 70 + .../usr/include/valgrind/vki/vki-xen-x86.h | 277 + .../usr/include/valgrind/vki/vki-xen-xsm.h | 95 + .../usr/include/valgrind/vki/vki-xen.h | 124 + .../sysroot/usr/include/values.h | 68 + .../sysroot/usr/include/video/edid.h | 11 + .../sysroot/usr/include/video/sisfb.h | 209 + .../sysroot/usr/include/video/uvesafb.h | 60 + .../sysroot/usr/include/wait.h | 1 + .../sysroot/usr/include/wchar.h | 737 ++ .../sysroot/usr/include/wctype.h | 320 + .../sysroot/usr/include/webp/decode.h | 494 ++ .../sysroot/usr/include/webp/encode.h | 545 ++ .../sysroot/usr/include/webp/types.h | 52 + .../sysroot/usr/include/wordexp.h | 70 + .../sysroot/usr/include/xen/evtchn.h | 88 + .../sysroot/usr/include/xen/gntalloc.h | 82 + .../sysroot/usr/include/xen/gntdev.h | 150 + .../sysroot/usr/include/xen/privcmd.h | 77 + .../sysroot/usr/include/zconf.h | 534 ++ .../sysroot/usr/include/zip.h | 446 + .../sysroot/usr/include/zipconf.h | 128 + .../sysroot/usr/include/zlib.h | 1912 +++++ .../usr/lib/sigc++-2.0/include/sigc++config.h | 85 + .../usr/share/libtool/libltdl/lt__alloc.h | 58 + .../usr/share/libtool/libltdl/lt__argz_.h | 69 + .../usr/share/libtool/libltdl/lt__dirent.h | 88 + .../usr/share/libtool/libltdl/lt__glibc.h | 89 + .../usr/share/libtool/libltdl/lt__private.h | 149 + .../usr/share/libtool/libltdl/lt__strl.h | 53 + .../usr/share/libtool/libltdl/lt_dlloader.h | 91 + .../usr/share/libtool/libltdl/lt_error.h | 86 + .../usr/share/libtool/libltdl/lt_system.h | 166 + .../sysroot/usr/share/libtool/libltdl/slist.h | 97 + .../sysroot/usr/share/libtool/ltdl.h | 163 + .../examples/hello-c++-kde/hellowindow.h | 20 + .../hello-objc-gnustep/AppController.h | 35 + .../examples/hello-objc-gnustep/Hello.h | 31 + .../share/gettext/gettext.h | 292 + .../share/gettext/intl/eval-plural.h | 106 + .../share/gettext/intl/export.h | 6 + .../share/gettext/intl/gettextP.h | 313 + .../share/gettext/intl/gmo.h | 150 + .../share/gettext/intl/hash-string.h | 34 + .../share/gettext/intl/libgnuintl.in.h | 466 ++ .../share/gettext/intl/loadinfo.h | 130 + .../share/gettext/intl/localcharset.h | 40 + .../share/gettext/intl/lock.h | 927 +++ .../share/gettext/intl/os2compat.h | 44 + .../share/gettext/intl/plural-exp.h | 141 + .../share/gettext/intl/printf-args.h | 158 + .../share/gettext/intl/printf-parse.h | 85 + .../share/gettext/intl/relocatable.h | 81 + .../share/gettext/intl/tsearch.h | 81 + .../share/gettext/intl/vasnprintf.h | 76 + .../share/gettext/intl/vasnwprintf.h | 44 + .../share/gettext/intl/verify.h | 279 + .../share/gettext/intl/wprintf-parse.h | 85 + .../share/gettext/intl/xsize.h | 117 + .../share/libtool/libltdl/lt__alloc.h | 58 + .../share/libtool/libltdl/lt__argz_.h | 69 + .../share/libtool/libltdl/lt__dirent.h | 88 + .../share/libtool/libltdl/lt__glibc.h | 89 + .../share/libtool/libltdl/lt__private.h | 149 + .../share/libtool/libltdl/lt__strl.h | 53 + .../share/libtool/libltdl/lt_dlloader.h | 91 + .../share/libtool/libltdl/lt_error.h | 86 + .../share/libtool/libltdl/lt_system.h | 166 + .../share/libtool/libltdl/slist.h | 97 + .../mipsel-linux-uclibc/share/libtool/ltdl.h | 163 + dingux/palette.h | 98 + dingux/raycastlib.h | 2019 +++++ dingux/settings.h | 417 + dingux/sounds.h | 478 ++ dingux/texts.h | 60 + game.h | 7 + main_gbmeta/My_settings.h | 6 + main_gbmeta/constants.h | 579 ++ main_gbmeta/game.h | 4805 +++++++++++ main_gbmeta/images.h | 1395 ++++ main_gbmeta/levels.h | 225 + main_gbmeta/mbed_config.h | 25 + main_gbmeta/palette.h | 98 + main_gbmeta/raycastlib.h | 2019 +++++ main_gbmeta/settings.h | 409 + main_gbmeta/sounds.h | 470 ++ main_gbmeta/texts.h | 60 + main_sdl.c | 3 + 2703 files changed, 887878 insertions(+) create mode 100644 dingux/My_settings.h create mode 100644 dingux/constants.h create mode 100755 dingux/game.h create mode 100644 dingux/images.h create mode 100644 dingux/levels.h create mode 100644 dingux/mbed_config.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/acl/libacl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/attr/attributes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/attr/error_context.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/attr/libattr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/blkid/blkid.h create mode 120000 dingux/opt/mipsel-linux-uclibc/include/com_err.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/e2p/e2p.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/et/com_err.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/expat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/expat_config.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/expat_external.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ext2fs/bitops.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2_err.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2_ext_attr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2_fs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2_io.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2_types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2fs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext3_extents.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ext2fs/qcow2.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ext2fs/tdb.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/gdb/jit-reader.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/gettext-po.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/gmp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libfdisk/libfdisk.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libltdl/lt_dlloader.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libltdl/lt_error.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libltdl/lt_system.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libmount/libmount.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libsmartcols/libsmartcols.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/DOCBparser.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/HTMLparser.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/HTMLtree.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/SAX.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/SAX2.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/c14n.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/catalog.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/chvalid.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/debugXML.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/dict.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/encoding.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/entities.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/globals.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/hash.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/list.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/nanoftp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/nanohttp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/parser.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/parserInternals.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/pattern.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/relaxng.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/schemasInternals.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/schematron.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/threads.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/tree.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/uri.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/valid.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xinclude.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xlink.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlIO.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlautomata.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlerror.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlexports.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlmemory.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlmodule.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlreader.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlregexp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlsave.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlschemas.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlschemastypes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlstring.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlunicode.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlversion.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlwriter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xpath.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xpathInternals.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xpointer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ltdl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/mpc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/mpf2mpfr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/mpfr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ncurses/curses.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ncurses/eti.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ncurses/form.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ncurses/menu.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ncurses/nc_tparm.h create mode 120000 dingux/opt/mipsel-linux-uclibc/include/ncurses/ncurses.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ncurses/ncurses_dll.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ncurses/panel.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ncurses/term.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ncurses/term_entry.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ncurses/termcap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ncurses/tic.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ncurses/unctrl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/Python-ast.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/Python.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/abstract.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/asdl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/ast.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/bitset.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/boolobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/bufferobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/bytearrayobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/bytes_methods.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/bytesobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/cStringIO.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/cellobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/ceval.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/classobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/cobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/code.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/codecs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/compile.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/complexobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/datetime.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/descrobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/dictobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/dtoa.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/enumobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/errcode.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/eval.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/fileobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/floatobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/frameobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/funcobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/genobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/graminit.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/grammar.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/import.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/intobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/intrcheck.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/iterobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/listobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/longintrepr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/longobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/marshal.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/memoryobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/metagrammar.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/methodobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/modsupport.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/moduleobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/node.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/object.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/objimpl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/opcode.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/osdefs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/parsetok.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/patchlevel.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/pgen.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/pgenheaders.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/py_curses.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/pyarena.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/pycapsule.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/pyconfig.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/pyctype.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/pydebug.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/pyerrors.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/pyexpat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/pyfpe.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/pygetopt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/pymacconfig.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/pymactoolbox.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/pymath.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/pymem.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/pyport.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/pystate.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/pystrcmp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/pystrtod.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/pythonrun.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/pythread.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/rangeobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/setobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/sliceobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/stringobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/structmember.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/structseq.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/symtable.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/sysmodule.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/timefuncs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/token.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/traceback.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/tupleobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/ucnhash.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/unicodeobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/warnings.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/python2.7/weakrefobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ss/ss.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/ss/ss_err.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/sys/acl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/alphaindex.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/appendable.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/basictz.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/brkiter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/bytestream.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/bytestrie.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/bytestriebuilder.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/calendar.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/caniter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/casemap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/char16ptr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/chariter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/choicfmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/coleitr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/coll.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/compactdecimalformat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/curramt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/currpinf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/currunit.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/datefmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/dbbi.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/dcfmtsym.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/decimfmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/docmain.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/dtfmtsym.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/dtintrv.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/dtitvfmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/dtitvinf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/dtptngen.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/dtrule.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/edits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/enumset.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/errorcode.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/fieldpos.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/filteredbrk.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/fmtable.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/format.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/fpositer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/gender.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/gregocal.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/icudataver.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/icuplug.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/idna.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/listformatter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/localpointer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/locdspnm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/locid.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/measfmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/measunit.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/measure.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/messagepattern.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/msgfmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/normalizer2.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/normlzr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/nounit.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/numberformatter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/numfmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/numsys.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/parseerr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/parsepos.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/platform.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/plurfmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/plurrule.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ptypes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/putil.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/rbbi.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/rbnf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/rbtz.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/regex.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/region.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/reldatefmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/rep.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/resbund.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/schriter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/scientificnumberformatter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/search.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/selfmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/simpleformatter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/simpletz.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/smpdtfmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/sortkey.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/std_string.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/strenum.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/stringoptions.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/stringpiece.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/stringtriebuilder.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/stsearch.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/symtable.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/tblcoll.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/timezone.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/tmunit.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/tmutamt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/tmutfmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/translit.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/tzfmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/tznames.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/tzrule.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/tztrans.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ubidi.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ubiditransform.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ubrk.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ucal.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ucasemap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ucat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/uchar.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ucharstrie.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ucharstriebuilder.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/uchriter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/uclean.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ucnv.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ucnv_cb.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ucnv_err.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ucnvsel.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ucol.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ucoleitr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/uconfig.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ucsdet.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ucurr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/udat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/udata.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/udateintervalformat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/udatpg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/udisplaycontext.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/uenum.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ufieldpositer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/uformattable.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ugender.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/uidna.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/uiter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/uldnames.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ulistformatter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/uloc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ulocdata.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/umachine.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/umisc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/umsg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/unifilt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/unifunct.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/unimatch.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/unirepl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/uniset.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/unistr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/unorm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/unorm2.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/unum.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/unumsys.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/uobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/upluralrules.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/uregex.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/uregion.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ureldatefmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/urename.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/urep.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ures.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/uscript.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/usearch.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/uset.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/usetiter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ushape.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/uspoof.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/usprep.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ustring.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/ustringtrie.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/utext.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/utf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/utf16.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/utf32.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/utf8.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/utf_old.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/utmscale.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/utrace.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/utrans.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/utypes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/uvernum.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/uversion.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/unicode/vtzone.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/uuid/uuid.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/zconf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/include/zlib.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include-fixed/limits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include-fixed/syslimits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/float.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/gcov.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/iso646.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/loongson.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/msa.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdalign.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdarg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdatomic.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdbool.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stddef.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdfix.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdint-gcc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdint.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdnoreturn.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/unwind.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/varargs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/install-tools/gsyslimits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/install-tools/include/limits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/addresses.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/alias.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/alloc-pool.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ansidecl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/asan.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/attribs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/auto-host.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/auto-profile.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/backend.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/basic-block.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/bb-reorder.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/bitmap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/builtins.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/bversion.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/c-family/c-common.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/c-family/c-objc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/c-family/c-pragma.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/c-family/c-pretty-print.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/c-tree.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/calls.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ccmp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfganal.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgbuild.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgcleanup.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgexpand.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfghooks.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgloop.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgloopmanip.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgrtl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cgraph.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cilk.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/collect-utils.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/collect2-aix.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/collect2.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/conditions.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/dbxelf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/elfos.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/glibc-stdint.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/gnu-user.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/initfini-array.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/linux-android.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/linux-protos.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/mips/gnu-user.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/mips/linux-common.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/mips/linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/mips/mips-opts.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/mips/mips-protos.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/mips/mips.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/vxworks-dummy.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/configargs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/context.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/convert.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/coretypes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/coverage.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cp/cp-tree.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cp/cxx-pretty-print.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cp/name-lookup.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cp/type-utils.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cppbuiltin.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cppdefault.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cpplib.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cselib.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/data-streamer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dbgcnt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dbxout.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dce.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ddg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/debug.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/defaults.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/df.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dfp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/diagnostic-color.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/diagnostic-core.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/diagnostic.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dojump.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dominance.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/domwalk.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/double-int.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dumpfile.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dwarf2asm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dwarf2out.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/edit-context.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/emit-rtl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/errors.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/et-forest.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/except.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/explow.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/expmed.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/expr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/fibonacci_heap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/file-find.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/filenames.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/fixed-value.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/flag-types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/flags.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/fold-const-call.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/fold-const.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/function.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcc-plugin.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcc-rich-location.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcc-symtab.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcov-io.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcse-common.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcse.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/generic-match.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gengtype.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/genrtl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gensupport.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ggc-internal.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ggc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-builder.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-expr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-fold.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-iterator.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-low.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-match.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-predict.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-pretty-print.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-ssa.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-streamer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-walk.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimplify-me.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimplify.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/glimits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/graph.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/graphds.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/graphite.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gstab.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gsyms.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gsyslimits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gtype-desc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hard-reg-set.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hash-map-traits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hash-map.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hash-set.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hash-table.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hash-traits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hashtab.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/highlev-plugin-common.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hooks.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hosthooks-def.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hosthooks.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hsa-brig-format.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hsa-common.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hw-doloop.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hwint.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ifcvt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/inchash.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/incpath.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/input.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/insn-addr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/insn-codes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/insn-constants.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/insn-flags.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/insn-modes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/internal-fn.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/intl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-chkp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-icf-gimple.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-icf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-inline.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-prop.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-ref.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-reference.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-utils.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ira-int.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ira.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/is-a.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/langhooks-def.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/langhooks.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lcm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/libfuncs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/libiberty.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/limitx.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/limity.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/line-map.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/loop-unroll.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lower-subreg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lra-int.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lra.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lto-compress.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lto-section-names.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lto-streamer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/machmode.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/md5.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/mem-stats-traits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/mem-stats.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/memmodel.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/memory-block.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/obstack.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/omp-expand.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/omp-general.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/omp-grid.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/omp-low.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/omp-offload.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/optabs-libfuncs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/optabs-query.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/optabs-tree.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/optabs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/options.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/opts-diagnostic.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/opts.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/output.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/params-enum.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/params-list.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/params-options.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/params.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/pass_manager.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/plugin-api.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/plugin-version.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/plugin.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/predict.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/prefix.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/pretty-print.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/print-rtl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/print-tree.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/profile.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/read-md.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/read-rtl-function.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/real.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/realmpfr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/recog.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/regcprop.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/regrename.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/regs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/regset.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/reload.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/resource.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtl-chkp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtl-error.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtl-iter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtlhash.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtlhooks-def.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/run-rtl-passes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/safe-ctype.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sbitmap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sched-int.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sdbout.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sel-sched-dump.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sel-sched-ir.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sel-sched.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/selftest-rtl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/selftest.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sese.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/shrink-wrap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/signop.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sparseset.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/spellcheck-tree.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/spellcheck.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/splay-tree.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sreal.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ssa-iterators.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ssa.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/statistics.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/stmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/stor-layout.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/streamer-hooks.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/stringpool.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/substring-locations.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/symbol-summary.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/symtab.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/system.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/target-def.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/target-globals.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/target-hooks-macros.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/target.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/targhooks.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/timevar.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tm-preds.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tm_p.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/toplev.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tracer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/trans-mem.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-affine.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-cfg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-cfgcleanup.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-check.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-chkp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-chrec.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-core.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-data-ref.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-dfa.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-diagnostic.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-dump.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-eh.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-hash-traits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-hasher.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-if-conv.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-inline.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-into-ssa.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-iterator.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-nested.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-object-size.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-outof-ssa.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-parloops.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-pass.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-phinodes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-pretty-print.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-scalar-evolution.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-address.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-alias.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-ccp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-coalesce.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-dom.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-live.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-loop-ivopts.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-loop-manip.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-loop-niter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-loop.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-operands.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-propagate.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-sccvn.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-scopedtables.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-ter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-threadbackward.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-threadedge.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-threadupdate.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssanames.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-stdarg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-streamer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-vectorizer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-vrp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tsan.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tsystem.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/typeclass.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/typed-splay-tree.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ubsan.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/valtrack.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/value-prof.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/varasm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/vec.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/version.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/vmsdbg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/vtable-verify.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/wide-int-print.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/wide-int.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/xcoff.h create mode 100644 dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/xcoffout.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/backward/auto_ptr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/backward/backward_warning.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/backward/binders.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/backward/hash_fun.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/backward/hashtable.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/algorithmfwd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/alloc_traits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/allocated_ptr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/allocator.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/atomic_base.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/atomic_futex.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/atomic_lockfree_defines.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/basic_ios.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/basic_string.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/boost_concept_check.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/c++0x_warning.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/c++14_warning.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/char_traits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/codecvt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/concept_check.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/cpp_type_traits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/cxxabi_forced.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/cxxabi_init_exception.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/enable_special_members.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/exception.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/exception_defines.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/exception_ptr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/forward_list.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/functexcept.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/functional_hash.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/gslice.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/gslice_array.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/hash_bytes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/hashtable.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/hashtable_policy.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/indirect_array.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/invoke.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/ios_base.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/locale_classes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/locale_conv.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/locale_facets.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/locale_facets_nonio.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/localefwd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/mask_array.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/memoryfwd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/move.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/nested_exception.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/node_handle.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/ostream_insert.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/parse_numbers.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/postypes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/predefined_ops.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/ptr_traits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/quoted_string.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/random.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/range_access.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/refwrap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_automaton.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_compiler.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_constants.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_error.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_executor.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_scanner.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/shared_ptr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/shared_ptr_atomic.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/shared_ptr_base.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/slice_array.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/specfun.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/std_abs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/std_function.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/std_mutex.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_algo.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_algobase.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_bvector.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_construct.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_deque.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_function.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_heap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_iterator.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_iterator_base_funcs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_iterator_base_types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_list.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_map.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_multimap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_multiset.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_numeric.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_pair.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_queue.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_raw_storage_iter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_relops.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_set.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_stack.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_tempbuf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_tree.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_uninitialized.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_vector.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stream_iterator.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/streambuf_iterator.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stringfwd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/uniform_int_dist.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/unique_ptr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/unordered_map.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/unordered_set.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/uses_allocator.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/valarray_after.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/valarray_array.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/valarray_before.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/complex.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/cxxabi.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/assertions.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/debug.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/formatter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/functions.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/helper_functions.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/macros.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/map.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/multimap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/multiset.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_base.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_container.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_iterator.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_local_iterator.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_sequence.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_unordered_base.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_unordered_container.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/set.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/stl_iterator.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/decimal/decimal.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/erase_if.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/fs_dir.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/fs_fwd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/fs_ops.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/fs_path.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/lfts_config.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/shared_ptr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/aligned_buffer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/alloc_traits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/array_allocator.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/atomicity.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/bitmap_allocator.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/cast.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/codecvt_specializations.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/concurrence.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/debug_allocator.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/enc_filebuf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/extptr_allocator.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/malloc_allocator.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/mt_allocator.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/new_allocator.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/numeric_traits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/pod_char_traits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/pointer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/pool_allocator.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/rc_string_base.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/ropeimpl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/sso_string_base.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/stdio_filebuf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/stdio_sync_filebuf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/string_conversions.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/throw_allocator.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/type_traits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/typelist.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/vstring.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/vstring_fwd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/vstring_util.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/fenv.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/math.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/mipsel-buildroot-linux-uclibc/bits/atomic_word.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/mipsel-buildroot-linux-uclibc/bits/basic_file.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/mipsel-buildroot-linux-uclibc/bits/c++allocator.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/mipsel-buildroot-linux-uclibc/bits/c++config.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/mipsel-buildroot-linux-uclibc/bits/c++io.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/mipsel-buildroot-linux-uclibc/bits/c++locale.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/mipsel-buildroot-linux-uclibc/bits/cpu_defines.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/mipsel-buildroot-linux-uclibc/bits/ctype_base.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/mipsel-buildroot-linux-uclibc/bits/ctype_inline.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/mipsel-buildroot-linux-uclibc/bits/cxxabi_tweaks.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/mipsel-buildroot-linux-uclibc/bits/error_constants.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/mipsel-buildroot-linux-uclibc/bits/extc++.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/mipsel-buildroot-linux-uclibc/bits/gthr-default.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/mipsel-buildroot-linux-uclibc/bits/gthr-posix.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/mipsel-buildroot-linux-uclibc/bits/gthr-single.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/mipsel-buildroot-linux-uclibc/bits/gthr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/mipsel-buildroot-linux-uclibc/bits/messages_members.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/mipsel-buildroot-linux-uclibc/bits/opt_random.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/mipsel-buildroot-linux-uclibc/bits/os_defines.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/mipsel-buildroot-linux-uclibc/bits/stdc++.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/mipsel-buildroot-linux-uclibc/bits/stdtr1c++.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/mipsel-buildroot-linux-uclibc/bits/time_members.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/mipsel-buildroot-linux-uclibc/ext/opt_random.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/algo.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/algobase.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/algorithmfwd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/balanced_quicksort.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/base.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/basic_iterator.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/checkers.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/compatibility.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/compiletime_settings.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/equally_split.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/features.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/find.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/find_selectors.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/for_each.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/for_each_selectors.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/iterator.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/list_partition.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/losertree.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/merge.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/multiseq_selection.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/multiway_merge.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/multiway_mergesort.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/numericfwd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/omp_loop.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/omp_loop_static.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/par_loop.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/parallel.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/partial_sum.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/partition.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/queue.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/quicksort.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/random_number.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/random_shuffle.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/search.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/set_operations.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/settings.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/sort.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/tags.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/unique_copy.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/parallel/workstealing.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/profile/base.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/profile/impl/profiler.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/profile/impl/profiler_algos.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/profile/impl/profiler_container_size.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/profile/impl/profiler_hash_func.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/profile/impl/profiler_hashtable_size.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/profile/impl/profiler_list_to_slist.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/profile/impl/profiler_list_to_vector.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/profile/impl/profiler_map_to_unordered_map.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/profile/impl/profiler_node.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/profile/impl/profiler_state.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/profile/impl/profiler_trace.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/profile/impl/profiler_vector_size.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/profile/impl/profiler_vector_to_list.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/profile/iterator_tracker.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/profile/map.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/profile/multimap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/profile/multiset.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/profile/ordered_base.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/profile/set.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/profile/unordered_base.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/stdlib.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tgmath.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tr1/complex.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tr1/ctype.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tr1/fenv.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tr1/float.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tr1/functional_hash.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tr1/hashtable.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tr1/hashtable_policy.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tr1/inttypes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tr1/limits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tr1/math.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tr1/random.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tr1/shared_ptr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tr1/special_function_util.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tr1/stdarg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tr1/stdbool.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tr1/stdint.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tr1/stdio.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tr1/stdlib.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tr1/tgmath.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tr1/unordered_map.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tr1/unordered_set.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tr1/wchar.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/tr1/wctype.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_active.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_audio.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_byteorder.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_cdrom.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_config.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_cpuinfo.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_endian.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_error.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_events.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_framerate.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_getenv.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_gfxBlitFunc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_gfxPrimitives.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_gfxPrimitives_font.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_image.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_imageFilter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_joystick.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_keyboard.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_keysym.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_loadso.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_main.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_mixer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_mouse.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_mutex.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_name.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_net.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_opengl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_platform.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_quit.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_rotozoom.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_rwops.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_sound.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_stdinc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_syswm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_thread.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_timer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_ttf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_version.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/SDL_video.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/begin_code.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/SDL/close_code.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/a.out.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/alloca.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ao/ao.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ao/os_types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ao/plugin.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ar.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/archive.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/archive_entry.h create mode 100755 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/argp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/arpa/ftp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/arpa/inet.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/arpa/nameser.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/arpa/nameser_compat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/arpa/telnet.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/arpa/tftp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/auxvec.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/bitsperlong.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/errno-base.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/errno.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/fcntl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/int-l64.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/int-ll64.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/ioctl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/ioctls.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/ipcbuf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/mman-common.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/mman.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/msgbuf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/param.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/poll.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/posix_types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/resource.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/sembuf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/setup.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/shmbuf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/shmparam.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/siginfo.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/signal-defs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/signal.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/socket.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/sockios.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/stat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/statfs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/swab.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/termbits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/termios.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/ucontext.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm-generic/unistd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/auxvec.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/bitsperlong.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/byteorder.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/cachectl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/errno.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/fcntl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/ioctl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/ioctls.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/ipcbuf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/mman.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/msgbuf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/param.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/poll.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/posix_types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/ptrace.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/resource.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/sembuf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/setup.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/sgidefs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/shmbuf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/sigcontext.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/siginfo.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/signal.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/socket.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/sockios.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/stat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/statfs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/swab.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/sysmips.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/termbits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/termios.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asm/unistd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Biquad/Biquad_Native/asplib_BiquadNative.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Biquad/Interfaces/asplib_IBiquad.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Biquad/apslib_BiquadFactory.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Core/Buffers/asplib_IBufferBase.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Core/Buffers/asplib_ITBuffer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Core/Buffers/asplib_TBaseBuffer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Core/Buffers/asplib_TBaseFrameBuffer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Core/Buffers/asplib_TFrameBuffer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Core/Buffers/asplib_TFrameRingBuffer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Core/Buffers/asplib_TRingBuffer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Core/Constants_Typedefs/asplib_Constants.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Core/Constants_Typedefs/asplib_Typedefs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Core/Exceptions/asplib_IException.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Core/Exceptions/asplib_StringException.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Core/Strings/asplib_stdStringUtils.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Core/os/android/android_definitions.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Core/os/asplib_os.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Core/os/darwin_ios/darwin_ios_definitions.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Core/os/darwin_osx/darwin_osx_definitions.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Core/os/freebsd/freebsd_definitions.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Core/os/linux/linux_definitions.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Core/os/raspberry_pi/raspberry_pi_definitions.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Core/os/windows/windows_definitions.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Logger/ILogger.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Logger/LoggerFactory.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Logger/LoggerFile.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Logger/LoggerStdout.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Logger/Logger_types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Logger/asplib_DefaultLogger.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Signals/asplib_Interleaver.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Signals/asplib_SamplesConverter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/asplib/Timer/asplib_CPUTimer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/assert.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/byteswap-16.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/byteswap-common.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/byteswap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/cmathcalls.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/confname.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/dirent.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/dlfcn.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/elfclass.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/endian.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/environments.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/epoll.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/errno.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/eventfd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/fcntl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/getopt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/getopt_int.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/huge_val.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/huge_valf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/huge_vall.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/in.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/inf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/initspin.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/inotify.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/ioctl-types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/ioctls.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/ipc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/kernel-features.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/local_lim.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/locale.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/mathcalls.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/mathdef.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/mathinline.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/mman-common.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/mman.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/mqueue.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/msq.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/nan.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/netdb.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/poll.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/posix1_lim.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/posix2_lim.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/posix_opt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/pthreadtypes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/resource.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/sched.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/select.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/sem.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/semaphore.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/setjmp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/shm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/sigaction.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/sigcontext.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/siginfo.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/signalfd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/signum.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/sigset.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/sigstack.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/sigthread.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/sockaddr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/socket.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/socket_type.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/stat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/statfs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/statvfs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/stdio.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/stdio_lim.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/sysnum.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/termios.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/time.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/timerfd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/typesizes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/uClibc_alloc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/uClibc_charclass.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/uClibc_clk_tck.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/uClibc_config.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/uClibc_local_lim.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/uClibc_locale.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/uClibc_page.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/uClibc_posix_opt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/uClibc_stdio.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/uClibc_touplow.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/uio.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/utmp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/utmpx.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/utsname.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/waitflags.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/waitstatus.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/wchar.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/wordsize.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/xopen_lim.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/blkid/blkid.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/byteswap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/bzlib.h create mode 120000 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/com_err.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/complex.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/cpio.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/crypt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ctype.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/curses.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/dirent.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/dlfcn.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/drm/drm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/drm/drm_mode.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/drm/drm_sarea.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/drm/i810_drm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/drm/i915_drm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/drm/mga_drm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/drm/nouveau_drm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/drm/r128_drm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/drm/radeon_drm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/drm/savage_drm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/drm/sis_drm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/drm/via_drm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/drm/vmwgfx_drm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/e2p/e2p.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/elf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/endian.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/err.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/errno.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/error.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/et/com_err.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/eti.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ext2fs/bitops.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ext2fs/ext2_err.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ext2fs/ext2_ext_attr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ext2fs/ext2_fs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ext2fs/ext2_io.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ext2fs/ext2_types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ext2fs/ext2fs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ext2fs/ext3_extents.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ext2fs/qcow2.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ext2fs/tdb.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/fcntl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/features.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ffi.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ffitarget.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/fnmatch.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/form.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/fpu_control.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/config/ftconfig.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/config/ftheader.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/config/ftmodule.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/config/ftoption.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/config/ftstdlib.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/freetype.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftadvanc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftbbox.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftbdf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftbitmap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftbzip2.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftcache.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftchapters.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftcid.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftdriver.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/fterrdef.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/fterrors.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftfntfmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftgasp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftglyph.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftgxval.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftgzip.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftimage.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftincrem.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftlcdfil.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftlist.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftlzw.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftmac.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftmm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftmodapi.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftmoderr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftotval.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftoutln.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftparams.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftpfr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftrender.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftsizes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftsnames.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftstroke.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftsynth.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftsystem.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/fttrigon.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/fttypes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ftwinfnt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/t1tables.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/ttnameid.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/tttables.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/freetype/tttags.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/freetype2/ft2build.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ftw.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/fuse.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/fuse/cuse_lowlevel.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/fuse/fuse.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/fuse/fuse_common.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/fuse/fuse_common_compat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/fuse/fuse_compat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/fuse/fuse_lowlevel.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/fuse/fuse_lowlevel_compat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/fuse/fuse_opt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/getopt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/gif_lib.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/glob.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/gnu-versions.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/grp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/iconv.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/id3tag.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ieee754.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ifaddrs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/inttypes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/jconfig.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/jerror.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/jmorecfg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/jpeglib.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/langinfo.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/lastlog.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/libcharset.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/libconfig.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/libfdisk/libfdisk.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/libgen.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/libintl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/libltdl/lt_dlloader.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/libltdl/lt_error.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/libltdl/lt_system.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/libmodplug/it_defs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/libmodplug/modplug.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/libmodplug/sndfile.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/libmodplug/stdafx.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/libmount/libmount.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/libpng16/png.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/libpng16/pngconf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/libpng16/pnglibconf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/libsha1.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/libsmartcols/libsmartcols.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/limits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/link.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/acct.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/adb.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/adfs_fs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/affs_hardblocks.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/agpgart.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/aio_abi.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/apm_bios.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/arcfb.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/atalk.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/atm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/atm_eni.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/atm_he.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/atm_idt77105.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/atm_nicstar.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/atm_tcp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/atm_zatm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/atmapi.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/atmarp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/atmbr2684.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/atmclip.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/atmdev.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/atmioc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/atmlec.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/atmmpc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/atmppp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/atmsap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/atmsvc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/audit.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/auto_fs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/auto_fs4.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/auxvec.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ax25.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/b1lli.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/baycom.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/bfs_fs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/binfmts.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/blk_types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/blkpg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/blktrace_api.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/bpqether.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/bsg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/byteorder/big_endian.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/byteorder/little_endian.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/caif/caif_socket.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/caif/if_caif.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/can.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/can/bcm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/can/error.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/can/gw.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/can/netlink.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/can/raw.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/capability.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/capi.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/cciss_defs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/cciss_ioctl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/cdk.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/cdrom.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/cgroupstats.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/chio.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/cm4000_cs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/cn_proc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/coda.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/coda_psdev.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/coff.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/comstats.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/connector.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/const.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/cramfs_fs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/cuda.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/cyclades.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/cycx_cfm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/dcbnl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/dccp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/dlm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/dlm_device.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/dlm_netlink.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/dlm_plock.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/dlmconstants.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/dm-ioctl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/dm-log-userspace.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/dn.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/dqblk_xfs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/dvb/audio.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/dvb/ca.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/dvb/dmx.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/dvb/frontend.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/dvb/net.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/dvb/osd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/dvb/version.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/dvb/video.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/edd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/efs_fs_sb.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/elf-em.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/elf-fdpic.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/elf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/elfcore.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/errno.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/errqueue.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ethtool.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/eventpoll.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ext2_fs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/fadvise.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/falloc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/fanotify.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/fb.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/fcntl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/fd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/fdreg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/fib_rules.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/fiemap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/filter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/firewire-cdev.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/firewire-constants.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/flat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/fs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/fsl_hypervisor.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/fuse.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/futex.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/gameport.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/gen_stats.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/generic_serial.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/genetlink.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/gfs2_ondisk.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/gigaset_dev.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/hdlc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/hdlc/ioctl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/hdlcdrv.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/hdreg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/hid.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/hiddev.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/hidraw.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/hpet.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/hysdn_if.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/i2c-dev.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/i2c.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/i2o-dev.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/i8k.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/icmp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/icmpv6.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_addr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_addrlabel.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_alg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_arcnet.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_arp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_bonding.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_bridge.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_cablemodem.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_ec.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_eql.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_ether.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_fc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_fddi.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_frad.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_hippi.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_infiniband.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_link.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_ltalk.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_packet.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_phonet.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_plip.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_ppp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_pppol2tp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_pppox.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_slip.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_strip.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_tr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_tun.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_tunnel.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_vlan.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/if_x25.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/igmp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/in.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/in6.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/in_route.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/inet_diag.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/inotify.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/input.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ioctl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ip.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ip6_tunnel.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ip_vs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ipc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ipmi.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ipmi_msgdefs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ipsec.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ipv6.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ipv6_route.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ipx.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/irda.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/irqnr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/isdn.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/isdn/capicmd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/isdn_divertif.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/isdn_ppp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/isdnif.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/iso_fs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ivtv.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ivtvfb.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ixjuser.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/jffs2.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/joystick.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/kd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/kdev_t.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/kernel-page-flags.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/kernel.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/kernelcapi.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/keyboard.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/keyctl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/l2tp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/limits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/llc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/loop.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/lp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/magic.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/major.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/map_to_7segment.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/matroxfb.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/media.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/mempolicy.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/meye.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/mii.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/minix_fs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/mman.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/mmc/ioctl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/mmtimer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/mqueue.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/mroute.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/mroute6.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/msdos_fs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/msg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/mtio.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/n_r3964.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/nbd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ncp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ncp_fs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ncp_mount.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ncp_no.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/neighbour.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/net.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/net_dropmon.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/net_tstamp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netdevice.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/ipset/ip_set.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/ipset/ip_set_bitmap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/ipset/ip_set_hash.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/ipset/ip_set_list.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_conntrack_common.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_conntrack_ftp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_conntrack_sctp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_conntrack_tcp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_conntrack_tuple_common.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink_compat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink_conntrack.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink_log.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink_queue.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/x_tables.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_AUDIT.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_CHECKSUM.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_CLASSIFY.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_CONNMARK.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_CONNSECMARK.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_CT.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_DSCP.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_IDLETIMER.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_LED.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_MARK.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_NFLOG.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_NFQUEUE.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_RATEEST.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_SECMARK.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_TCPMSS.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_TCPOPTSTRIP.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_TEE.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_TPROXY.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_addrtype.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_cluster.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_comment.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_connbytes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_connlimit.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_connmark.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_conntrack.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_cpu.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_dccp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_devgroup.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_dscp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_esp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_hashlimit.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_helper.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_iprange.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_ipvs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_length.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_limit.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_mac.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_mark.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_multiport.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_osf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_owner.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_physdev.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_pkttype.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_policy.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_quota.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_rateest.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_realm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_recent.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_sctp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_set.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_socket.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_state.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_statistic.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_string.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_tcpmss.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_tcpudp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_time.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_u32.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_arp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_arp/arp_tables.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_arp/arpt_mangle.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_802_3.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_among.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_arp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_arpreply.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_ip.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_ip6.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_limit.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_log.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_mark_m.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_mark_t.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_nat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_nflog.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_pkttype.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_redirect.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_stp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_ulog.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_vlan.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebtables.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_decnet.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ip_queue.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ip_tables.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_ECN.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_LOG.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_REJECT.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_SAME.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_TTL.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_ULOG.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_addrtype.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_ah.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_ecn.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_realm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_ttl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/nf_nat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6_tables.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_HL.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_LOG.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_REJECT.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_ah.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_frag.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_hl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_ipv6header.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_mh.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_opts.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_rt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netlink.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/netrom.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/nfc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/nfs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/nfs2.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/nfs3.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/nfs4.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/nfs4_mount.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/nfs_fs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/nfs_idmap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/nfs_mount.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/nfsacl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/nfsd/debug.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/nfsd/export.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/nfsd/nfsfh.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/nfsd/stats.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/nl80211.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/nubus.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/nvram.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/omap3isp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/omapfb.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/oom.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/param.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/parport.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/patchkey.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/pci.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/pci_regs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/perf_event.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/personality.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/pfkeyv2.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/pg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/phantom.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/phonet.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/pkt_cls.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/pkt_sched.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/pktcdvd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/pmu.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/poll.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/posix_types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ppdev.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ppp-comp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ppp_defs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/pps.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/prctl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ptp_clock.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ptrace.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/qnx4_fs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/qnxtypes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/quota.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/radeonfb.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/raid/md_p.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/raid/md_u.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/random.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/raw.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/rds.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/reboot.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/reiserfs_fs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/reiserfs_xattr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/resource.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/rfkill.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/romfs_fs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/rose.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/route.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/rtc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/rtnetlink.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/scc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/sched.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/screen_info.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/sdla.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/securebits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/selinux_netlink.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/sem.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/serial.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/serial_core.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/serial_reg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/serio.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/shm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/signal.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/signalfd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/snmp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/socket.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/sockios.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/som.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/sonet.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/sonypi.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/sound.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/soundcard.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/spi/spidev.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/stat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/stddef.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/string.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/sunrpc/debug.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/suspend_ioctls.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/swab.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/synclink.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/sysctl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/taskstats.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_csum.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_gact.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_ipt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_mirred.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_nat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_pedit.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_skbedit.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/tc_ematch/tc_em_cmp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/tc_ematch/tc_em_meta.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/tc_ematch/tc_em_nbyte.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/tc_ematch/tc_em_text.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/tcp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/telephony.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/termios.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/time.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/times.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/timex.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/tiocl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/tipc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/tipc_config.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/toshiba.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/tty.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/udf_fs_i.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/udp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/uinput.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/uio.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/ultrasound.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/un.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/unistd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/usb/audio.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/usb/cdc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/usb/ch11.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/usb/ch9.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/usb/functionfs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/usb/g_printer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/usb/gadgetfs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/usb/midi.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/usb/tmc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/usb/video.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/usbdevice_fs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/utime.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/utsname.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/uvcvideo.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/v4l2-mediabus.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/v4l2-subdev.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/version.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/veth.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/vhost.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/videodev2.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/virtio_9p.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/virtio_balloon.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/virtio_blk.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/virtio_config.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/virtio_console.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/virtio_ids.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/virtio_net.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/virtio_pci.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/virtio_ring.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/virtio_rng.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/vt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/wait.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/wanrouter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/watchdog.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/wimax.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/wimax/i2400m.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/wireless.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/x25.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/xattr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/linux/xfrm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/localcharset.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/locale.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ltdl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/lz4.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/lz4frame.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/lz4hc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/mad.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/malloc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/math.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/memory.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/menu.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/mntent.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/mqueue.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/mtd/inftl-user.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/mtd/mtd-abi.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/mtd/mtd-user.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/mtd/nftl-user.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/mtd/ubi-user.h create mode 120000 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ncurses.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ncurses_dll.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/net/ethernet.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/net/if.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/net/if_arp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/net/if_packet.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/net/if_ppp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/net/if_shaper.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/net/if_slip.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/net/ppp-comp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/net/ppp_defs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/net/route.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/netax25/ax25.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/netdb.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/neteconet/ec.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/netinet/ether.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/netinet/icmp6.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/netinet/if_ether.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/netinet/if_fddi.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/netinet/if_tr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/netinet/igmp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/netinet/in.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/netinet/in_systm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/netinet/ip.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/netinet/ip6.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/netinet/ip_icmp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/netinet/tcp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/netinet/udp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/netipx/ipx.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/netpacket/packet.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/nl_types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/acls.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/attrib.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/attrlist.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/bitmap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/bootsect.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/cache.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/collate.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/compat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/compress.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/debug.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/device.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/device_io.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/dir.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/ea.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/efs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/endians.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/index.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/inode.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/ioctl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/layout.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/lcnalloc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/logfile.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/logging.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/mft.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/misc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/mst.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/ntfstime.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/object_id.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/param.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/plugin.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/realpath.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/reparse.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/runlist.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/security.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/support.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/unistr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/volume.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ntfs-3g/xattrs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ogg/config_types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ogg/ogg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ogg/os_types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/panel.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/paths.h create mode 120000 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/png.h create mode 120000 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/pngconf.h create mode 120000 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/pnglibconf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/poll.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/popt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/printf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/protocols/routed.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/protocols/rwhod.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/protocols/talkd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/protocols/timed.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/pthread.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/pty.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/pwd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/Python-ast.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/Python.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/abstract.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/asdl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/ast.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/bitset.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/boolobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/bufferobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/bytearrayobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/bytes_methods.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/bytesobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/cStringIO.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/cellobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/ceval.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/classobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/cobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/code.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/codecs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/compile.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/complexobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/datetime.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/descrobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/dictobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/dtoa.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/enumobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/errcode.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/eval.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/fileobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/floatobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/frameobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/funcobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/genobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/graminit.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/grammar.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/import.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/intobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/intrcheck.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/iterobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/listobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/longintrepr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/longobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/marshal.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/memoryobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/metagrammar.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/methodobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/modsupport.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/moduleobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/node.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/object.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/objimpl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/opcode.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/osdefs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/parsetok.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/patchlevel.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/pgen.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/pgenheaders.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/py_curses.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/pyarena.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/pycapsule.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/pyconfig.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/pyctype.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/pydebug.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/pyerrors.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/pyexpat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/pyfpe.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/pygetopt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/pymacconfig.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/pymactoolbox.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/pymath.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/pymem.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/pyport.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/pystate.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/pystrcmp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/pystrtod.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/pythonrun.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/pythread.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/rangeobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/setobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/sliceobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/stringobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/structmember.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/structseq.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/symtable.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/sysmodule.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/timefuncs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/token.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/traceback.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/tupleobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/ucnhash.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/unicodeobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/warnings.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/python2.7/weakrefobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/rdma/ib_user_cm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/rdma/ib_user_mad.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/rdma/ib_user_sa.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/rdma/ib_user_verbs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/rdma/rdma_netlink.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/rdma/rdma_user_cm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/regdef.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/regex.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/regexp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/resolv.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sched.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/scsi/fc/fc_els.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/scsi/fc/fc_fs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/scsi/fc/fc_gs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/scsi/fc/fc_ns.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/scsi/scsi.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/scsi/scsi_bsg_fc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/scsi/scsi_ioctl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/scsi/scsi_netlink.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/scsi/scsi_netlink_fc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/scsi/sg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/search.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/semaphore.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/setjmp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sgidefs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sgtty.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/shadow.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/adaptors/adaptors.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/adaptors/bind.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/adaptors/bind_return.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/adaptors/bound_argument.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/adaptors/compose.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/adaptors/deduce_result_type.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/adaptors/exception_catch.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/adaptors/hide.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/adaptors/lambda/base.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/adaptors/lambda/select.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/adaptors/retype.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/adaptors/retype_return.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/adaptors/track_obj.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/bind.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/bind_return.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/connection.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/functors/functor_trait.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/functors/functors.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/functors/mem_fun.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/functors/ptr_fun.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/functors/slot.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/functors/slot_base.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/limit_reference.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/reference_wrapper.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/retype_return.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/sigc++.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/signal.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/signal_base.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/slot.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/trackable.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/type_traits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sigc++-2.0/sigc++/visit_each.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/signal.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sndfile.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sound/asequencer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sound/asound.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sound/asound_fm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sound/emu10k1.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sound/hdsp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sound/hdspm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sound/sb16_csp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sound/sfnt_info.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/spawn.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ss/ss.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ss/ss_err.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/stdint.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/stdio.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/stdio_ext.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/stdlib.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/string.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/strings.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/acct.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/asm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/bitypes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/cachectl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/cdefs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/dir.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/epoll.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/errno.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/eventfd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/fanotify.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/fcntl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/file.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/fpregdef.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/fsuid.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/inotify.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/ioctl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/ipc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/kd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/kdaemon.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/klog.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/mman.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/mount.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/msg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/mtio.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/param.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/personality.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/poll.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/prctl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/procfs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/ptrace.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/queue.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/quota.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/random.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/reboot.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/regdef.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/resource.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/select.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/sem.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/sendfile.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/shm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/signal.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/signalfd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/socket.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/socketvar.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/soundcard.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/stat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/statfs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/statvfs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/swap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/syscall.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/sysctl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/sysinfo.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/syslog.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/sysmacros.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/sysmips.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/tas.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/termios.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/time.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/timeb.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/timerfd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/times.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/timex.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/ttydefaults.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/ucontext.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/uio.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/un.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/unistd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/user.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/utsname.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/vfs.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/vt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/wait.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sys/xattr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/syscall.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/sysexits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/syslog.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/tar.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/term.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/termcap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/termio.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/termios.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/tgmath.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/thread_db.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/tiff.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/tiffconf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/tiffio.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/tiffvers.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/time.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/tremor/config_types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/tremor/ivorbiscodec.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/tremor/ivorbisfile.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ttyent.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/turbojpeg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/uchar.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ucontext.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ulimit.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/ulockmgr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unctrl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/alphaindex.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/appendable.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/basictz.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/brkiter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/bytestream.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/bytestrie.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/bytestriebuilder.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/calendar.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/caniter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/casemap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/char16ptr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/chariter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/choicfmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/coleitr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/coll.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/compactdecimalformat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/curramt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/currpinf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/currunit.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/datefmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/dbbi.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/dcfmtsym.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/decimfmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/docmain.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/dtfmtsym.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/dtintrv.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/dtitvfmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/dtitvinf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/dtptngen.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/dtrule.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/edits.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/enumset.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/errorcode.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/fieldpos.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/filteredbrk.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/fmtable.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/format.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/fpositer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/gender.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/gregocal.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/icudataver.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/icuplug.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/idna.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/listformatter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/localpointer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/locdspnm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/locid.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/measfmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/measunit.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/measure.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/messagepattern.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/msgfmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/normalizer2.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/normlzr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/nounit.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/numberformatter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/numfmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/numsys.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/parseerr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/parsepos.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/platform.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/plurfmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/plurrule.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ptypes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/putil.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/rbbi.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/rbnf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/rbtz.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/regex.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/region.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/reldatefmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/rep.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/resbund.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/schriter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/scientificnumberformatter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/search.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/selfmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/simpleformatter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/simpletz.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/smpdtfmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/sortkey.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/std_string.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/strenum.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/stringoptions.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/stringpiece.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/stringtriebuilder.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/stsearch.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/symtable.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/tblcoll.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/timezone.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/tmunit.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/tmutamt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/tmutfmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/translit.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/tzfmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/tznames.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/tzrule.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/tztrans.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ubidi.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ubiditransform.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ubrk.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ucal.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ucasemap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ucat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/uchar.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ucharstrie.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ucharstriebuilder.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/uchriter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/uclean.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ucnv.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ucnv_cb.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ucnv_err.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ucnvsel.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ucol.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ucoleitr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/uconfig.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ucsdet.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ucurr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/udat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/udata.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/udateintervalformat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/udatpg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/udisplaycontext.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/uenum.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ufieldpositer.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/uformattable.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ugender.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/uidna.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/uiter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/uldnames.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ulistformatter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/uloc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ulocdata.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/umachine.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/umisc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/umsg.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/unifilt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/unifunct.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/unimatch.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/unirepl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/uniset.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/unistr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/unorm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/unorm2.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/unum.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/unumsys.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/uobject.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/upluralrules.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/uregex.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/uregion.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ureldatefmt.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/urename.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/urep.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ures.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/uscript.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/usearch.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/uset.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/usetiter.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ushape.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/uspoof.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/usprep.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ustdio.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ustream.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ustring.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/ustringtrie.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/utext.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/utf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/utf16.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/utf32.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/utf8.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/utf_old.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/utmscale.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/utrace.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/utrans.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/utypes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/uvernum.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/uversion.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unicode/vtzone.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/unistd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/utime.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/utmp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/utmpx.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/uuid/uuid.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/callgrind.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/config.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/drd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/helgrind.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/libvex.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/libvex_basictypes.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/libvex_emnote.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/libvex_guest_amd64.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/libvex_guest_arm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/libvex_guest_arm64.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/libvex_guest_mips32.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/libvex_guest_mips64.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/libvex_guest_offsets.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/libvex_guest_ppc32.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/libvex_guest_ppc64.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/libvex_guest_s390x.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/libvex_guest_tilegx.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/libvex_guest_x86.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/libvex_ir.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/libvex_s390x_common.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/libvex_trc_values.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/memcheck.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_addrinfo.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_aspacehl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_aspacemgr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_basics.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_basics_asm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_clientstate.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_clreq.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_debuginfo.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_deduppoolalloc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_errormgr.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_execontext.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_gdbserver.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_guest.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_hashtable.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_libcassert.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_libcbase.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_libcfile.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_libcprint.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_libcproc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_libcsetjmp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_libcsignal.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_machine.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_mallocfree.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_options.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_oset.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_poolalloc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_rangemap.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_redir.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_replacemalloc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_seqmatch.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_signals.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_sparsewa.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_stacktrace.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_threadstate.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_tooliface.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_transtab.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_vki.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_vkiscnums.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_vkiscnums_asm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_wordfm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/pub_tool_xarray.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/valgrind.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-amd64-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-arm-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-arm64-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-darwin.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-linux-drm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-mips32-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-mips64-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-posixtypes-amd64-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-posixtypes-arm-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-posixtypes-arm64-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-posixtypes-mips32-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-posixtypes-mips64-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-posixtypes-ppc32-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-posixtypes-ppc64-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-posixtypes-s390x-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-posixtypes-x86-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-ppc32-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-ppc64-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-s390x-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-scnums-amd64-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-scnums-arm-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-scnums-arm64-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-scnums-darwin.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-scnums-mips32-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-scnums-mips64-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-scnums-ppc32-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-scnums-ppc64-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-scnums-s390x-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-scnums-solaris.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-scnums-x86-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-solaris-repcache.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-solaris.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-x86-linux.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-xen-domctl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-xen-evtchn.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-xen-gnttab.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-xen-hvm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-xen-memory.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-xen-mmuext.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-xen-physdev.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-xen-schedop.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-xen-sysctl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-xen-tmem.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-xen-version.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-xen-x86.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-xen-xsm.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/valgrind/vki/vki-xen.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/values.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/video/edid.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/video/sisfb.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/video/uvesafb.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/wait.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/wchar.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/wctype.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/webp/decode.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/webp/encode.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/webp/types.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/wordexp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/xen/evtchn.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/xen/gntalloc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/xen/gntdev.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/xen/privcmd.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/zconf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/zip.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/zipconf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/include/zlib.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/lib/sigc++-2.0/include/sigc++config.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/share/libtool/libltdl/lt__alloc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/share/libtool/libltdl/lt__argz_.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/share/libtool/libltdl/lt__dirent.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/share/libtool/libltdl/lt__glibc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/share/libtool/libltdl/lt__private.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/share/libtool/libltdl/lt__strl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/share/libtool/libltdl/lt_dlloader.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/share/libtool/libltdl/lt_error.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/share/libtool/libltdl/lt_system.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/share/libtool/libltdl/slist.h create mode 100644 dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot/usr/share/libtool/ltdl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/doc/gettext/examples/hello-c++-kde/hellowindow.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/doc/gettext/examples/hello-objc-gnustep/AppController.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/doc/gettext/examples/hello-objc-gnustep/Hello.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/gettext/gettext.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/gettext/intl/eval-plural.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/gettext/intl/export.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/gettext/intl/gettextP.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/gettext/intl/gmo.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/gettext/intl/hash-string.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/gettext/intl/libgnuintl.in.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/gettext/intl/loadinfo.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/gettext/intl/localcharset.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/gettext/intl/lock.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/gettext/intl/os2compat.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/gettext/intl/plural-exp.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/gettext/intl/printf-args.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/gettext/intl/printf-parse.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/gettext/intl/relocatable.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/gettext/intl/tsearch.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/gettext/intl/vasnprintf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/gettext/intl/vasnwprintf.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/gettext/intl/verify.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/gettext/intl/wprintf-parse.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/gettext/intl/xsize.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/libtool/libltdl/lt__alloc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/libtool/libltdl/lt__argz_.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/libtool/libltdl/lt__dirent.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/libtool/libltdl/lt__glibc.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/libtool/libltdl/lt__private.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/libtool/libltdl/lt__strl.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/libtool/libltdl/lt_dlloader.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/libtool/libltdl/lt_error.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/libtool/libltdl/lt_system.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/libtool/libltdl/slist.h create mode 100644 dingux/opt/mipsel-linux-uclibc/share/libtool/ltdl.h create mode 100644 dingux/palette.h create mode 100644 dingux/raycastlib.h create mode 100644 dingux/settings.h create mode 100644 dingux/sounds.h create mode 100644 dingux/texts.h create mode 100644 main_gbmeta/My_settings.h create mode 100644 main_gbmeta/constants.h create mode 100755 main_gbmeta/game.h create mode 100644 main_gbmeta/images.h create mode 100644 main_gbmeta/levels.h create mode 100644 main_gbmeta/mbed_config.h create mode 100644 main_gbmeta/palette.h create mode 100644 main_gbmeta/raycastlib.h create mode 100644 main_gbmeta/settings.h create mode 100644 main_gbmeta/sounds.h create mode 100644 main_gbmeta/texts.h diff --git a/TODO.txt b/TODO.txt index 4721fc0..a467f0e 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,5 +1,6 @@ general: +- High pitch noise in SDL music AGAIN! - Refactor. - Port to OpenDingux. - Port to some fantasy console? diff --git a/dingux/My_settings.h b/dingux/My_settings.h new file mode 100644 index 0000000..cf7eba5 --- /dev/null +++ b/dingux/My_settings.h @@ -0,0 +1,6 @@ +// Pokitto config required by PokittoLib + +//#define PROJ_SHOW_FPS_COUNTER +#define PROJ_SCREENMODE 13 +#define PROJ_MODE13 1 +#define PROJ_ENABLE_SOUND 1 diff --git a/dingux/constants.h b/dingux/constants.h new file mode 100644 index 0000000..8b0a864 --- /dev/null +++ b/dingux/constants.h @@ -0,0 +1,579 @@ +/** + @file constants.h + + This file contains definitions of game constants that are not considered + part of game settings and whose change can ffect the game balance and + playability, e.g. physics constants. + + by Miloslav Ciz (drummyfish), 2019 + + Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/) + plus a waiver of all other intellectual property. The goal of this work is + be and remain completely in the public domain forever, available for any use + whatsoever. +*/ + +#ifndef _SFG_CONSTANTS_H +#define _SFG_CONSTANTS_H + +/** + How quickly player moves, in squares per second. +*/ +#define SFG_PLAYER_MOVE_SPEED 7 + +/** + Gravity acceleration in squares / (second^2). +*/ +#define SFG_GRAVITY_ACCELERATION 30 + +/** + Initial upwards speed of player's jump, in squares per second. +*/ +#define SFG_PLAYER_JUMP_SPEED 5 + +/** + Melee and close-up attack range, in RCL_Units. +*/ +#define SFG_MELEE_RANGE 1600 + +/** + When a projectile is shot, it'll be offset by this distance (in RCL_Units) + from the shooter. +*/ + +#define SFG_PROJECTILE_SPAWN_OFFSET 256 + +/** + Player's melee hit range, in RCL_Units (RCL_UNITS_PER_SQUARE means full angle, + 180 degrees to both sides). +*/ +#define SFG_PLAYER_MELEE_ANGLE 512 + +/** + How quickly elevators and squeezers move, in RCL_Unit per second. +*/ +#define SFG_MOVING_WALL_SPEED 1024 + +/** + How quickly doors open and close, in RCL_Unit per second. +*/ +#define SFG_DOOR_OPEN_SPEED 2048 + +/** + Helper special state value. +*/ +#define SFG_CANT_SAVE 255 + +/** + Says the distance in RCL_Units at which level elements (items, monsters etc.) + are active. +*/ +#define SFG_LEVEL_ELEMENT_ACTIVE_DISTANCE (12 * 1024) + +/** + Rate at which AI will be updated, which also affects how fast enemies will + appear. +*/ +#define SFG_AI_FPS 4 + +/** + Says a probability (0 - 255) of the AI changing its state during one update + step. +*/ +#define SFG_AI_RANDOM_CHANGE_PROBABILITY 40 + +/** + Distance at which level elements (sprites) collide, in RCL_Unit (1024 per + square). +*/ +#define SFG_ELEMENT_COLLISION_RADIUS 1900 + +/** + Height, in RCL_Units, at which collisions happen with level elements + (sprites). +*/ +#define SFG_ELEMENT_COLLISION_HEIGHT 1024 + +/** + Distance at which explosion does damage and throws away the player and + monsters, in RCL_Units. +*/ +#define SFG_EXPLOSION_RADIUS 2048 + +/** + Distance in RCL_Units which the player is pushed away by an explosion. +*/ +#define SFG_EXPLOSION_PUSH_AWAY_DISTANCE 1200 + +/** + How much damage triggers a barrel explosion. +*/ + +#define SFG_BARREL_EXPLOSION_DAMAGE_THRESHOLD 3 + +/** + Maximum player health. +*/ +#define SFG_PLAYER_MAX_HEALTH 125 + +/** + Start health of player. +*/ +#define SFG_PLAYER_START_HEALTH 100 + +/** + At which value health indicator shows a warning (red color). +*/ +#define SFG_PLAYER_HEALTH_WARNING_LEVEL 20 + +/** + Amount of health that is increased by taking a health kit. +*/ +#define SFG_HEALTH_KIT_VALUE 20 + +/** + How much randomness (positive and negative) will be added to damage + (e.g. by weapons, explosions, ...). This constant is is 0 to 255, 255 meaning + 100% of the base value. +*/ +#define SFG_DAMAGE_RANDOMNESS 64 + +/** + Height of monster collision BBox in RCL_Units. +*/ +#define SFG_MONSTER_COLLISION_HEIGHT 1024 + +/** + Specifies key repeat delay, in ms. +*/ +#define SFG_KEY_REPEAT_DELAY 500 + +/** + Specifies key repeat period, in ms. +*/ +#define SFG_KEY_REPEAT_PERIOD 150 + +/** + Angle in which multiple projectiles are spread, RCL_Units. +*/ +#define SFG_PROJECTILE_SPREAD_ANGLE 100 + +#define SFG_MAX_MONSTERS 64 + +#define SFG_MAX_PROJECTILES 12 + +#define SFG_MAX_DOORS 32 + +#define SFG_AMMO_BULLETS 0 +#define SFG_AMMO_ROCKETS 1 +#define SFG_AMMO_PLASMA 2 + +#define SFG_AMMO_TOTAL 3 + +#define SFG_AMMO_NONE SFG_AMMO_TOTAL + +#define SFG_AMMO_INCREASE_BULLETS 10 +#define SFG_AMMO_INCREASE_ROCKETS 5 +#define SFG_AMMO_INCREASE_PLASMA 8 + +#define SFG_AMMO_MAX_BULLETS 200 +#define SFG_AMMO_MAX_ROCKETS 100 +#define SFG_AMMO_MAX_PLASMA 150 + +/** + Duration of story text (intro/outro) in ms. +*/ +#define SFG_STORYTEXT_DURATION 15000 + +/** + Time in ms of the player death animation. +*/ +#define SFG_LOSE_ANIMATION_DURATION 2000 + +/** + Time in ms of the level win animation. +*/ +#define SFG_WIN_ANIMATION_DURATION 2500 + +/** + Time in ms of the level start stage. +*/ +#define SFG_LEVEL_START_DURATION 1500 + +/** + Vertical sprite size, in RCL_Units. +*/ +#define SFG_BASE_SPRITE_SIZE RCL_UNITS_PER_SQUARE + +// ---------------------------- +// derived constants + +#define SFG_GAME_RESOLUTION_X \ + (SFG_SCREEN_RESOLUTION_X / SFG_RESOLUTION_SCALEDOWN) + +#define SFG_GAME_RESOLUTION_Y \ + (SFG_SCREEN_RESOLUTION_Y / SFG_RESOLUTION_SCALEDOWN) + +#define SFG_MS_PER_FRAME (1000 / SFG_FPS) // ms per frame with target FPS + +#if SFG_MS_PER_FRAME == 0 + #undef SFG_MS_PER_FRAME + #define SFG_MS_PER_FRAME 1 +#endif + +#define SFG_KEY_REPEAT_DELAY_FRAMES \ + (SFG_KEY_REPEAT_DELAY / SFG_MS_PER_FRAME) + +#if SFG_KEY_REPEAT_DELAY_FRAMES == 0 + #undef SFG_KEY_REPEAT_DELAY_FRAMES + #define SFG_KEY_REPEAT_DELAY_FRAMES 1 +#endif + +#define SFG_KEY_REPEAT_PERIOD_FRAMES \ + (SFG_KEY_REPEAT_PERIOD / SFG_MS_PER_FRAME) + +#if SFG_KEY_REPEAT_PERIOD_FRAMES == 0 + #undef SFG_KEY_REPEAT_PERIOD_FRAMES + #define SFG_KEY_REPEAT_PERIOD_FRAMES 1 +#endif + +#define SFG_WEAPON_IMAGE_SCALE \ + (SFG_GAME_RESOLUTION_X / (SFG_TEXTURE_SIZE * 5)) + +#if SFG_WEAPON_IMAGE_SCALE == 0 + #undef SFG_WEAPON_IMAGE_SCALE + #define SFG_WEAPON_IMAGE_SCALE 1 +#endif + +#define SFG_WEAPONBOB_OFFSET_PIXELS \ + (SFG_WEAPONBOB_OFFSET * SFG_WEAPON_IMAGE_SCALE) + +#define SFG_WEAPON_IMAGE_POSITION_X \ + (SFG_GAME_RESOLUTION_X / 2 - (SFG_WEAPON_IMAGE_SCALE * SFG_TEXTURE_SIZE) / 2) + +#if SFG_GAME_RESOLUTION_Y > 70 + #define SFG_WEAPON_IMAGE_POSITION_Y \ + (SFG_GAME_RESOLUTION_Y - (SFG_WEAPON_IMAGE_SCALE * SFG_TEXTURE_SIZE)) +#elif SFG_GAME_RESOLUTION_Y > 50 + #define SFG_WEAPON_IMAGE_POSITION_Y (SFG_GAME_RESOLUTION_Y \ + - ((SFG_WEAPON_IMAGE_SCALE * 3 * SFG_TEXTURE_SIZE) / 4)) +#else + #define SFG_WEAPON_IMAGE_POSITION_Y \ + (SFG_GAME_RESOLUTION_Y - SFG_TEXTURE_SIZE / 2) +#endif + +#define SFG_PLAYER_TURN_UNITS_PER_FRAME \ + ((SFG_PLAYER_TURN_SPEED * RCL_UNITS_PER_SQUARE) / (360 * SFG_FPS)) + +#if SFG_PLAYER_TURN_UNITS_PER_FRAME == 0 + #undef SFG_PLAYER_TURN_UNITS_PER_FRAME + #define SFG_PLAYER_TURN_UNITS_PER_FRAME 1 +#endif + +#define SFG_PLAYER_MOVE_UNITS_PER_FRAME \ + ((SFG_PLAYER_MOVE_SPEED * RCL_UNITS_PER_SQUARE) / SFG_FPS) + +#if SFG_PLAYER_MOVE_UNITS_PER_FRAME == 0 + #undef SFG_PLAYER_MOVE_UNITS_PER_FRAME + #define SFG_PLAYER_MOVE_UNITS_PER_FRAME 1 +#endif + +#define SFG_GRAVITY_SPEED_INCREASE_PER_FRAME \ + ((SFG_GRAVITY_ACCELERATION * RCL_UNITS_PER_SQUARE) / (SFG_FPS * SFG_FPS)) + +#if SFG_GRAVITY_SPEED_INCREASE_PER_FRAME == 0 + #undef SFG_GRAVITY_SPEED_INCREASE_PER_FRAME + #define SFG_GRAVITY_SPEED_INCREASE_PER_FRAME 1 +#endif + +#define SFG_PLAYER_JUMP_OFFSET_PER_FRAME \ + (((SFG_PLAYER_JUMP_SPEED * RCL_UNITS_PER_SQUARE) / SFG_FPS) \ + - SFG_GRAVITY_SPEED_INCREASE_PER_FRAME / 2) + /* ^ This substraction corrects the initial veloc. so that the numeric curve + copies the analytical (smooth) curve. Without it the numeric curve goes + ABOVE and makes player jump higher with lower FPS. To make sense of this + try to solve the differential equation and plot it. */ + +#if SFG_PLAYER_JUMP_OFFSET_PER_FRAME == 0 + #undef SFG_PLAYER_JUMP_OFFSET_PER_FRAME + #define SFG_PLAYER_JUMP_OFFSET_PER_FRAME 1 +#endif + +#define SFG_HEADBOB_FRAME_INCREASE_PER_FRAME \ + (SFG_HEADBOB_SPEED / SFG_FPS) + +#if SFG_HEADBOB_FRAME_INCREASE_PER_FRAME == 0 + #undef SFG_HEADBOB_FRAME_INCREASE_PER_FRAME + #define SFG_HEADBOB_FRAME_INCREASE_PER_FRAME 1 +#endif + +#define SFG_HEADBOB_ENABLED (SFG_HEADBOB_SPEED > 0 && SFG_HEADBOB_OFFSET > 0) + +#define SFG_CAMERA_SHEAR_STEP_PER_FRAME \ + ((SFG_GAME_RESOLUTION_Y * SFG_CAMERA_SHEAR_SPEED) / SFG_FPS) + +#if SFG_CAMERA_SHEAR_STEP_PER_FRAME == 0 + #undef SFG_CAMERA_SHEAR_STEP_PER_FRAME + #define SFG_CAMERA_SHEAR_STEP_PER_FRAME 1 +#endif + +#define SFG_CAMERA_MAX_SHEAR_PIXELS \ + ((SFG_CAMERA_MAX_SHEAR * SFG_GAME_RESOLUTION_Y) / 1024) + +#define SFG_FONT_SIZE_SMALL \ + (SFG_GAME_RESOLUTION_X / (SFG_FONT_CHARACTER_SIZE * 50)) + +#if SFG_FONT_SIZE_SMALL == 0 + #undef SFG_FONT_SIZE_SMALL + #define SFG_FONT_SIZE_SMALL 1 +#endif + +#define SFG_FONT_SIZE_MEDIUM \ + (SFG_GAME_RESOLUTION_X / (SFG_FONT_CHARACTER_SIZE * 30)) + +#if SFG_FONT_SIZE_MEDIUM == 0 + #undef SFG_FONT_SIZE_MEDIUM + #define SFG_FONT_SIZE_MEDIUM 1 +#endif + +#define SFG_FONT_SIZE_BIG \ + (SFG_GAME_RESOLUTION_X / (SFG_FONT_CHARACTER_SIZE * 18)) + +#if SFG_FONT_SIZE_BIG == 0 + #undef SFG_FONT_SIZE_BIG + #define SFG_FONT_SIZE_BIG 1 +#endif + +#define SFG_Z_BUFFER_SIZE SFG_GAME_RESOLUTION_X + +/** + Step in which walls get higher, in raycastlib units. +*/ +#define SFG_WALL_HEIGHT_STEP (RCL_UNITS_PER_SQUARE / 4) + +#define SFG_CEILING_MAX_HEIGHT\ + (16 * RCL_UNITS_PER_SQUARE - RCL_UNITS_PER_SQUARE / 2 ) + +#define SFG_DOOR_UP_DOWN_MASK 0x20 +#define SFG_DOOR_LOCK(doorRecord) ((doorRecord) >> 6) +#define SFG_DOOR_VERTICAL_POSITION_MASK 0x1f +#define SFG_DOOR_HEIGHT_STEP (RCL_UNITS_PER_SQUARE / 0x1f) + +#define SFG_DOOR_INCREMENT_PER_FRAME \ + (SFG_DOOR_OPEN_SPEED / (SFG_DOOR_HEIGHT_STEP * SFG_FPS)) + +#if SFG_DOOR_INCREMENT_PER_FRAME == 0 + #undef SFG_DOOR_INCREMENT_PER_FRAME + #define SFG_DOOR_INCREMENT_PER_FRAME 1 +#endif + +#define SFG_MAX_ITEMS SFG_MAX_LEVEL_ELEMENTS + +#define SFG_MAX_SPRITE_SIZE SFG_GAME_RESOLUTION_X + +#define SFG_MAP_PIXEL_SIZE (SFG_GAME_RESOLUTION_Y / SFG_MAP_SIZE) + +#if SFG_MAP_PIXEL_SIZE == 0 + #undef SFG_MAP_PIXEL_SIZE + #define SFG_MAP_PIXEL_SIZE 1 +#endif + +#define SFG_AI_UPDATE_FRAME_INTERVAL \ + (SFG_FPS / SFG_AI_FPS) + +#if SFG_AI_UPDATE_FRAME_INTERVAL == 0 + #undef SFG_AI_UPDATE_FRAME_INTERVAL + #define SFG_AI_UPDATE_FRAME_INTERVAL 1 +#endif + +#define SFG_SPRITE_ANIMATION_FRAME_DURATION \ + (SFG_FPS / SFG_SPRITE_ANIMATION_SPEED) + +#if SFG_SPRITE_ANIMATION_FRAME_DURATION == 0 + #undef SFG_SPRITE_ANIMATION_FRAME_DURATION + #define SFG_SPRITE_ANIMATION_FRAME_DURATION 1 +#endif + +#define SFG_HUD_MARGIN (SFG_GAME_RESOLUTION_X / 40) + +#define SFG_HUD_BORDER_INDICATOR_WIDTH_PIXELS \ + (SFG_GAME_RESOLUTION_Y / SFG_HUD_BORDER_INDICATOR_WIDTH) + +#define SFG_HUD_BORDER_INDICATOR_DURATION_FRAMES \ + (SFG_HUD_BORDER_INDICATOR_DURATION / SFG_MS_PER_FRAME) + +#if SFG_HUD_BORDER_INDICATOR_DURATION_FRAMES == 0 + #define SFG_HUD_BORDER_INDICATOR_DURATION_FRAMES 1 +#endif + +#define SFG_BLINK_PERIOD_FRAMES (SFG_BLINK_PERIOD / SFG_MS_PER_FRAME) + +#define SFG_HUD_BAR_HEIGHT \ + (SFG_FONT_CHARACTER_SIZE * SFG_FONT_SIZE_MEDIUM + SFG_HUD_MARGIN * 2 + 1) + +// ---------------------------- +// monsters + +#define SFG_MONSTER_ATTACK_MELEE 0 +#define SFG_MONSTER_ATTACK_FIREBALL 1 +#define SFG_MONSTER_ATTACK_BULLET 2 +#define SFG_MONSTER_ATTACK_FIREBALL_BULLET 3 +#define SFG_MONSTER_ATTACK_PLASMA 4 +#define SFG_MONSTER_ATTACK_EXPLODE 5 +#define SFG_MONSTER_ATTACK_FIREBALL_PLASMA 6 + +#define SFG_MONSTER_ATTRIBUTE(attackType,aggressivity0to255,health0to255,spriteSize0to3) \ + ((uint16_t) ( \ + attackType | \ + ((aggressivity0to255 / 8) << 3) | \ + (spriteSize0to3 << 8) | \ + ((health0to255 / 4) << 10))) + +#define SFG_GET_MONSTER_ATTACK_TYPE(monsterNumber) \ + (SFG_monsterAttributeTable[monsterNumber] & 0x0007) + +#define SFG_GET_MONSTER_AGGRESSIVITY(monsterNumber) \ + (((SFG_monsterAttributeTable[monsterNumber] >> 3) & 0x1F) * 8) + +#define SFG_GET_MONSTER_SPRITE_SIZE(monsterNumber) \ + ((SFG_monsterAttributeTable[monsterNumber] >> 8) & 0x03) + +#define SFG_GET_MONSTER_MAX_HEALTH(monsterNumber) \ + (((SFG_monsterAttributeTable[monsterNumber] >> 10) & 0x3F) * 4) + +/** + Table of monster attributes, each as a 16bit word in format: + + MSB hhhhhhssaaaattt LSB + + ttt: attack type + aaaaa: aggressivity (frequence of attacks), 0 to 31 + ss: sprite size + hhhhhh: health, 0 to 63 +*/ +uint16_t SFG_monsterAttributeTable[SFG_MONSTERS_TOTAL] = +{ + /* spider */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_FIREBALL,40,61,2), + /* destr. */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_FIREBALL_BULLET,90,170,3), + /* warrior */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_MELEE,255,40,1), + /* plasma */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_PLASMA,56,92,1), + /* ender */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_FIREBALL_PLASMA,128,255,3), + /* turret */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_BULLET,32,23,0), + /* explod. */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_EXPLODE,255,36,1) +}; + +// ---------------------------- +// weapons and projectiles + +#define SFG_WEAPON_KNIFE 0 +#define SFG_WEAPON_SHOTGUN 1 +#define SFG_WEAPON_MACHINE_GUN 2 +#define SFG_WEAPON_ROCKET_LAUNCHER 3 +#define SFG_WEAPON_PLASMAGUN 4 +#define SFG_WEAPON_SOLUTION 5 + +#define SFG_WEAPONS_TOTAL 6 + +#define SFG_WEAPON_ATTRIBUTE(fireType,projectileCount,fireCooldownMs) \ + ((uint8_t) (fireType | ((projectileCount - 1) << 2) | ((fireCooldownMs / (SFG_MS_PER_FRAME * 16)) << 4))) + +#define SFG_GET_WEAPON_FIRE_TYPE(weaponNumber) \ + (SFG_weaponAttributeTable[weaponNumber] & 0x03) + +#define SFG_GET_WEAPON_FIRE_COOLDOWN_FRAMES(weaponNumber) \ + ((SFG_weaponAttributeTable[weaponNumber] >> 4) * 16) + +#define SFG_GET_WEAPON_PROJECTILE_COUNT(weaponNumber) \ + (((SFG_weaponAttributeTable[weaponNumber] >> 2) & 0x03) + 1) + +#define SFG_MIN_WEAPON_COOLDOWN_FRAMES 8 + +#define SFG_WEAPON_FIRE_TYPE_MELEE 0 +#define SFG_WEAPON_FIRE_TYPE_BULLET 1 +#define SFG_WEAPON_FIRE_TYPE_FIREBALL 2 +#define SFG_WEAPON_FIRE_TYPE_PLASMA 3 + +#define SFG_WEAPON_FIRE_TYPES_TOTAL 4 + +/** + Table of weapon attributes, each as a byte in format: + + MSB ccccnnff LSB + + ff: fire type + nn: number of projectiles - 1 + cccc: fire cooldown in frames, i.e. time after which the next shot can be + shot again, ccccc has to be multiplied by 16 to get the real value +*/ +SFG_PROGRAM_MEMORY uint8_t SFG_weaponAttributeTable[SFG_WEAPONS_TOTAL] = +{ + /* knife */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_MELEE,1,650), // DPS: 6.2 + /* shotgun */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_BULLET,2,1250), // DPS: 12.8 + /* m. gun */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_BULLET,1,700), // DPS: 11.4 + /* r. laun. */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_FIREBALL,1,850), // DPS: 28.2 + /* plasma */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_PLASMA,1,550), // DPS: 32.7 + /* solution */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_PLASMA,4,1050) // DPS: 85.7 +}; + +SFG_PROGRAM_MEMORY uint8_t SFG_attackDamageTable[SFG_WEAPON_FIRE_TYPES_TOTAL] = +{ + /* melee */ 4, + /* bullet */ 8, + /* explostion (fireball) */ 24, + /* plasma */ 18 +}; + +#define SFG_PROJECTILE_EXPLOSION 0 +#define SFG_PROJECTILE_FIREBALL 1 +#define SFG_PROJECTILE_PLASMA 2 +#define SFG_PROJECTILE_DUST 3 +#define SFG_PROJECTILE_BULLET 4 +#define SFG_PROJECTILE_NONE 255 + +#define SFG_PROJECTILES_TOTAL 5 + +#define SFG_PROJECTILE_ATTRIBUTE(speedSquaresPerSec,timeToLiveMs) \ + ((uint8_t) \ + ((((speedSquaresPerSec / 4 == 0) && (speedSquaresPerSec != 0)) ? 1 : speedSquaresPerSec / 4) | \ + ((timeToLiveMs / (8 * SFG_MS_PER_FRAME)) << 3))) + +#define SFG_GET_PROJECTILE_SPEED_UPS(projectileNumber) \ + (((SFG_projectileAttributeTable[projectileNumber] & 0x07) * 4 * RCL_UNITS_PER_SQUARE) / SFG_FPS) + +#define SFG_GET_PROJECTILE_FRAMES_TO_LIVE(projectileNumber) \ + ((SFG_projectileAttributeTable[projectileNumber] >> 3) * 8) + +/** + Table of projectile attributes, each as a byte in format: + + MSB lllllsss LSB + + fff: half speed in game squares per second + lllll: eigth of frames to live +*/ + +#define LOW_FPS (SFG_FPS < 20) ///< low FPS needs low speeds, because collisions + +SFG_PROGRAM_MEMORY uint8_t SFG_projectileAttributeTable[SFG_PROJECTILES_TOTAL] = +{ + /* explosion */ SFG_PROJECTILE_ATTRIBUTE(0,400), + /* fireball */ SFG_PROJECTILE_ATTRIBUTE(10,1000), + +#if LOW_FPS + /* plasma */ SFG_PROJECTILE_ATTRIBUTE(17,500), +#else + /* plasma */ SFG_PROJECTILE_ATTRIBUTE(18,500), +#endif + + /* dust */ SFG_PROJECTILE_ATTRIBUTE(0,450), + +#if LOW_FPS + /* bullet */ SFG_PROJECTILE_ATTRIBUTE(17,1000) +#else + /* bullet */ SFG_PROJECTILE_ATTRIBUTE(28,1000) +#endif +}; + +#undef LOW_FPS + +#endif // guard diff --git a/dingux/game.h b/dingux/game.h new file mode 100755 index 0000000..d894d44 --- /dev/null +++ b/dingux/game.h @@ -0,0 +1,4819 @@ +/** + @file game.h + + Main source file of the game that puts together all the pieces. main game + logic is implemented here. + + Physics notes (you can break this when messing with constants): + + - Lowest ceiling under which player can fit is 4 height steps. + - Widest hole over which player can run without jumping is 1 square. + - Widest hole over which the player can jump is 3 squares. + - Highest step a player can walk onto without jumping is 2 height steps. + - Highest step a player can jump onto is 3 height steps. + + by Miloslav Ciz (drummyfish), 2019 + + Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/) + plus a waiver of all other intellectual property. The goal of this work is + be and remain completely in the public domain forever, available for any use + whatsoever. +*/ + +#ifndef _SFG_GAME_H +#define _SFG_GAME_H + +#include + +/* + The following keys are mandatory to be implemented on any platform in order + for the game to be playable. +*/ +#define SFG_KEY_UP 0 +#define SFG_KEY_RIGHT 1 +#define SFG_KEY_DOWN 2 +#define SFG_KEY_LEFT 3 +#define SFG_KEY_A 4 +#define SFG_KEY_B 5 +#define SFG_KEY_C 6 + +/* + The following keys are optional for a platform to implement. They just make + the controls more comfortable. +*/ +#define SFG_KEY_JUMP 7 +#define SFG_KEY_STRAFE_LEFT 8 +#define SFG_KEY_STRAFE_RIGHT 9 +#define SFG_KEY_MAP 10 +#define SFG_KEY_TOGGLE_FREELOOK 11 +#define SFG_KEY_NEXT_WEAPON 12 +#define SFG_KEY_PREVIOUS_WEAPON 13 +#define SFG_KEY_MENU 14 + +#define SFG_KEY_COUNT 15 ///< Number of keys. + +/* ============================= PORTING =================================== */ + +/* When porting, do the following: + - Include this file (and possibly other optionaly files) in your main_* + frontend source. + - Implement the following functions in your frontend source. + - Call SFG_init() from your frontend initialization code. + - Call SFG_mainLoopBody() from within your frontend main loop. +*/ + +#ifndef SFG_LOG + #define SFG_LOG(str) ; ///< Can be redefined to log messages for better debug. +#endif + +/** + Returns 1 (0) if given key is pressed (not pressed). At least the mandatory + keys have to be implemented, the optional keys don't have to ever return 1. + See the key contant definitions to see which ones are mandatory. +*/ +int8_t SFG_keyPressed(uint8_t key); + +/** + Optinal function for mouse/analog controls, gets mouse x and y offset in + pixels from the game screen center (to achieve classic FPS mouse controls the + platform should center the mouse at the end). If the platform isn't using a + mouse, this function can simply return [0,0] offets at each call, or even + do nothing (leave the variables as are). +*/ +void SFG_getMouseOffset(int16_t *x, int16_t *y); + +/** + Returns time in ms sice program start. +*/ +uint32_t SFG_getTimeMs(); + +/** + Sleep (yield CPU) for specified amount of ms. This is used to relieve CPU + usage. If your platform doesn't need this or handles it in other way, this + function can do nothing. +*/ +void SFG_sleepMs(uint16_t timeMs); + +/** + Set specified screen pixel. The function doesn't have to check whether + the coordinates are within screen. +*/ +static inline void SFG_setPixel(uint16_t x, uint16_t y, uint8_t colorIndex); + +/** + Play given sound effect (SFX). This function may or may not use the sound + samples provided in sounds.h, and it may or may not ignore the (logarithmic) + volume parameter (0 to 255). Depending on the platform the function can play + completely different samples or even e.g. just beeps. If the platform can't + play sounds, this function implementation can simply be left empty. This + function doesn't have to implement safety measures, the back end takes cares + of them. +*/ +void SFG_playSound(uint8_t soundIndex, uint8_t volume); + +/** + Informs the frontend whether music should get enabled/disabled. Playing music + is optional and the frontend can ignore it. If a frontend wants to implement + music, it can use the one provided in sounds.h or use its own. +*/ +void SFG_enableMusic(uint8_t enable); + +#define SFG_EVENT_VIBRATE 0 ///< the controller should vibrate (or blink etc.) +#define SFG_EVENT_PLAYER_HURT 1 +#define SFG_EVENT_PLAYER_DIES 2 +#define SFG_EVENT_LEVEL_STARTS 3 +#define SFG_EVENT_LEVEL_WON 4 +#define SFG_EVENT_MONSTER_DIES 5 +#define SFG_EVENT_PLAYER_TAKES_ITEM 6 +#define SFG_EVENT_EXPLOSION 7 +#define SFG_EVENT_PLAYER_TELEPORTS 8 +#define SFG_EVENT_PLAYER_CHANGES_WEAPON 9 + +/** + This is an optional function that informs the frontend about special events + which may trigger something special, such as a controller vibration, logging + something etc. This function can do nothing. +*/ +void SFG_processEvent(uint8_t event, uint8_t data); + +#define SFG_SAVE_SIZE 12 + +/** + Optional function for permanently saving game state. Platform that don't have + permanent storage may let this function do nothing. If implemented, the + function should save the passed data into its permanent storage, e.g. a file, + a cookie etc. +*/ +void SFG_save(uint8_t data[SFG_SAVE_SIZE]); + +/** + Optional function for retrieving game data that were saved to permanent + storage. Platforms without permanent storage may let this function do nothing. + If implemented, the function should fill the passed array with data from + permanent storage, e.g. a file, a cookie etc. + + If this function is called before SFG_save was ever called and no data is + present in permanent memory, this function should do nothing (leave the data + array as is). + + This function should return 1 if saving/loading is possible and 0 if not (this + will be used by the game to detect this capability). +*/ +uint8_t SFG_load(uint8_t data[SFG_SAVE_SIZE]); + +/* ========================================================================= */ + +/** + Game main loop body, call this inside the platform's specific main loop. + Returns 1 if the game continues, 0 if the game was exited. +*/ +uint8_t SFG_mainLoopBody(); + +/** + Initializes the whole program, call this in the platform initialization. +*/ +void SFG_init(); + +#include "settings.h" + +#if SFG_ARDUINO + #include + + #define SFG_PROGRAM_MEMORY const PROGMEM + #define SFG_PROGRAM_MEMORY_U8(addr) pgm_read_byte(addr) + // TODO +#else + #define SFG_PROGRAM_MEMORY static const + #define SFG_PROGRAM_MEMORY_U8(addr) ((uint8_t) (*(addr))) +#endif + +#include "images.h" +#include "levels.h" +#include "texts.h" +#include "palette.h" + +#if SFG_TEXTURE_DISTANCE == 0 + #define RCL_COMPUTE_WALL_TEXCOORDS 0 +#endif + +#define RCL_PIXEL_FUNCTION SFG_pixelFunc +#define RCL_TEXTURE_VERTICAL_STRETCH 0 + +#define RCL_CAMERA_COLL_HEIGHT_BELOW 800 +#define RCL_CAMERA_COLL_HEIGHT_ABOVE 200 + +#include "raycastlib.h" + +#include "constants.h" + +typedef struct +{ + uint8_t coords[2]; + uint8_t state; /**< door state in format: + + MSB ccbaaaaa LSB + + aaaaa: current door height (how much they're open) + b: whether currently going up (0) or down (1) + cc: by which card (key) the door is unlocked, 00 + means no card (unlocked), 1 means card 0 etc. + */ +} SFG_DoorRecord; + +#define SFG_SPRITE_SIZE(size0to3) \ + (((size0to3 + 3) * SFG_BASE_SPRITE_SIZE) / 4) + +#define SFG_SPRITE_SIZE_PIXELS(size0to3) \ + ((SFG_SPRITE_SIZE(size0to3) * SFG_GAME_RESOLUTION_Y) / RCL_UNITS_PER_SQUARE) + +#define SFG_SPRITE_SIZE_TO_HEIGHT_ABOVE_GROUND(size0to3) \ + (SFG_SPRITE_SIZE(size0to3) / 2) + +/** + Holds information about one instance of a level item (a type of level element, + e.g. pickable items, decorations etc.). The format is following: + + MSB abbbbbbb LSB + + a: active flag, 1 means the item is nearby to player and is active + bbbbbbb: index to elements array of the current level, pointing to element + representing this item +*/ +typedef uint8_t SFG_ItemRecord; + +#define SFG_ITEM_RECORD_ACTIVE_MASK 0x80 + +#define SFG_ITEM_RECORD_LEVEL_ELEMENT(itemRecord) \ + (SFG_currentLevel.levelPointer->elements[itemRecord & \ + ~SFG_ITEM_RECORD_ACTIVE_MASK]) + +typedef struct +{ + uint8_t stateType; /**< Holds state (lower 4 bits) and type of monster + (upper 4 bits). */ + uint8_t coords[2]; /**< monster position, in 1/4s of a square */ + uint8_t health; +} SFG_MonsterRecord; + +#define SFG_MR_STATE(mr) ((mr).stateType & SFG_MONSTER_MASK_STATE) +#define SFG_MR_TYPE(mr) \ + (SFG_MONSTER_INDEX_TO_TYPE(((mr).stateType & SFG_MONSTER_MASK_TYPE) >> 4)) + +#define SFG_MONSTER_COORD_TO_RCL_UNITS(c) ((RCL_UNITS_PER_SQUARE / 8) + c * 256) +#define SFG_MONSTER_COORD_TO_SQUARES(c) (c / 4) + +#define SFG_ELEMENT_COORD_TO_RCL_UNITS(c) \ + (c * RCL_UNITS_PER_SQUARE + RCL_UNITS_PER_SQUARE / 2) + +#define SFG_MONSTER_MASK_STATE 0x0f +#define SFG_MONSTER_MASK_TYPE 0xf0 + +#define SFG_MONSTER_STATE_INACTIVE 0 ///< Not nearby, not actively updated. +#define SFG_MONSTER_STATE_IDLE 1 +#define SFG_MONSTER_STATE_ATTACKING 2 +#define SFG_MONSTER_STATE_HURTING 3 +#define SFG_MONSTER_STATE_DYING 4 +#define SFG_MONSTER_STATE_GOING_N 5 +#define SFG_MONSTER_STATE_GOING_NE 6 +#define SFG_MONSTER_STATE_GOING_E 7 +#define SFG_MONSTER_STATE_GOING_SE 8 +#define SFG_MONSTER_STATE_GOING_S 9 +#define SFG_MONSTER_STATE_GOING_SW 10 +#define SFG_MONSTER_STATE_GOING_W 11 +#define SFG_MONSTER_STATE_GOING_NW 12 +#define SFG_MONSTER_STATE_DEAD 13 + +typedef struct +{ + uint8_t type; + uint8_t doubleFramesToLive; /**< This number times two (because 256 could be + too little at high FPS) says after how many + frames the projectile is destroyed. */ + uint16_t position[3]; /**< Current position, stored as u16 to save space, as + that is exactly enough to store position on 64x64 + map. */ + int16_t direction[3]; /**< Added to position each game step. */ +} SFG_ProjectileRecord; + +#define SFG_GAME_STATE_MENU 0 +#define SFG_GAME_STATE_PLAYING 1 +#define SFG_GAME_STATE_WIN 2 +#define SFG_GAME_STATE_LOSE 3 +#define SFG_GAME_STATE_INTRO 4 +#define SFG_GAME_STATE_OUTRO 5 +#define SFG_GAME_STATE_MAP 6 +#define SFG_GAME_STATE_LEVEL_START 7 + +#define SFG_MENU_ITEM_CONTINUE 0 +#define SFG_MENU_ITEM_MAP 1 +#define SFG_MENU_ITEM_PLAY 2 +#define SFG_MENU_ITEM_LOAD 3 +#define SFG_MENU_ITEM_SOUND 4 +#define SFG_MENU_ITEM_SHEAR 5 +#define SFG_MENU_ITEM_EXIT 6 + +#define SFG_MENU_ITEM_NONE 255 + +/* + GLOBAL VARIABLES +=============================================================================== +*/ + +/** + Groups global variables related to the game as such in a single struct. There + are still other global structs for player, level etc. +*/ +struct +{ + uint8_t state; + uint32_t stateChangeTime; ///< Time in ms at which the state was changed. + + uint8_t currentRandom; ///< for RNG + uint8_t spriteAnimationFrame; + + uint8_t soundsPlayedThisFrame; /**< Each bit says whether given sound was + played this frame, prevents playing too many + sounds at once. */ + + RCL_RayConstraints rayConstraints; + uint8_t keyStates[SFG_KEY_COUNT]; /**< Pressed states of keys, each value + stores the number of frames for which the + key has been held. */ + uint8_t zBuffer[SFG_Z_BUFFER_SIZE]; + + uint8_t textureAverageColors[SFG_WALL_TEXTURE_COUNT]; /**< Contains average + color for each wall texture. */ + + int8_t backgroundScaleMap[SFG_GAME_RESOLUTION_Y]; + uint16_t backgroundScroll; + uint8_t spriteSamplingPoints[SFG_MAX_SPRITE_SIZE]; /**< Helper for + precomputing sprite + sampling positions for + drawing. */ + uint32_t frameTime; ///< Keeps a constant time (in ms) during a frame + uint32_t frame; + uint32_t lastFrameTimeMs; + uint8_t selectedMenuItem; + uint8_t selectedLevel; ///< Level to play selected in the main menu. + uint8_t antiSpam; ///< Prevents log message spamming. + uint8_t settings; /**< Dynamic game settings (can be changed at runtime), + bit meaning: + + MSB -------- LSB + |||| + |||\_ sound (SFX) + ||\__ music + |\___ shearing + \____ freelook (shearing not sliding back) */ + + uint8_t blink; ///< Says whether blinkg is currently on or off. + uint8_t saved; /**< Helper variable to know if game was saved. Can be + 0 (not saved), 1 (just saved) or 255 (can't save).*/ + uint8_t save[SFG_SAVE_SIZE]; /**< Stores the game save state that's kept in + the persistent memory. + + The save format is binary and platform independent. + The save contains game settings, game progress and a + saved position. The format is as follows: + + 0 4b highest level that has been reached + 0 4b level number of the saved position (15: no save) + 1 8b game settings (SFG_game.settings) + 2 8b health at saved position + 3 8b bullet ammo at saved position + 4 8b rocket ammo at saved position + 5 8b plasma ammo at saved position + 6 32b little endian total play time, in 10ths of sec + 10 16b little endian total enemies killed from start */ + uint8_t continues; ///< Whether the game continues or was exited. +} SFG_game; + +#define SFG_SAVE_TOTAL_TIME (SFG_game.save[6] + SFG_game.save[7] * 256 + \ + SFG_game.save[8] * 65536 + SFG_game.save[9] * 4294967296) + +/** + Stores player state. +*/ +struct +{ + RCL_Camera camera; + int8_t squarePosition[2]; + RCL_Vector2D direction; + RCL_Unit verticalSpeed; + RCL_Unit previousVerticalSpeed; /**< Vertical speed in previous frame, needed + for determining whether player is in the + air. */ + uint16_t headBobFrame; + uint8_t weapon; ///< currently selected weapon + + uint8_t health; + + uint32_t weaponCooldownFrames; ///< frames left for weapon cooldow + uint32_t lastHurtFrame; + uint32_t lastItemTakenFrame; + + uint8_t ammo[SFG_AMMO_TOTAL]; + + uint8_t cards; /**< Lowest 3 bits say which access cards have + been taken., the next 3 bits say which cards + should be blinking in the HUD, the last + 2 bits are a blink reset counter. */ + uint8_t justTeleported; +} SFG_player; + +/** + Stores the current level and helper precomputed vaues for better performance. +*/ +struct +{ + const SFG_Level *levelPointer; + uint8_t levelNumber; + const uint8_t* textures[7]; + + uint32_t timeStart; + uint32_t frameStart; + uint32_t completionTime10sOfS; ///< Completion time in 10th of second. + + uint8_t floorColor; + uint8_t ceilingColor; + + SFG_DoorRecord doorRecords[SFG_MAX_DOORS]; + uint8_t doorRecordCount; + uint8_t checkedDoorIndex; ///< Says which door are currently being checked. + + SFG_ItemRecord itemRecords[SFG_MAX_ITEMS]; ///< Holds level items. + uint8_t itemRecordCount; + uint8_t checkedItemIndex; ///< Same as checkedDoorIndex, but for items. + + SFG_MonsterRecord monsterRecords[SFG_MAX_MONSTERS]; + uint8_t monsterRecordCount; + uint8_t checkedMonsterIndex; + + SFG_ProjectileRecord projectileRecords[SFG_MAX_PROJECTILES]; + uint8_t projectileRecordCount; + uint8_t bossCount; + uint8_t monstersDead; + uint8_t backgroundImage; + uint8_t teleportCount; + uint16_t mapRevealMask; /**< Bits say which parts of the map have been + revealed. */ + + uint8_t itemCollisionMap[(SFG_MAP_SIZE * SFG_MAP_SIZE) / 8]; + /**< Bit array, for each map square says whether there + is a colliding item or not. */ +} SFG_currentLevel; + +#if SFG_ARDUINO +/** + Copy of the current level that is stored in RAM. This is only done on Arduino + because accessing it in program memory directly would be difficult. +*/ +SFG_Level SFG_ramLevel; +#endif + +/** + Helper function for accessing the itemCollisionMap bits. +*/ +void SFG_getItemCollisionMapIndex( + uint8_t x, uint8_t y, uint16_t *byte, uint8_t *bit) +{ + uint16_t index = y * SFG_MAP_SIZE + x; + + *byte = index / 8; + *bit = index % 8; +} + +void SFG_setItemCollisionMapBit(uint8_t x, uint8_t y, uint8_t value) +{ + uint16_t byte; + uint8_t bit; + + SFG_getItemCollisionMapIndex(x,y,&byte,&bit); + + SFG_currentLevel.itemCollisionMap[byte] &= ~(0x01 << bit); + SFG_currentLevel.itemCollisionMap[byte] |= (value & 0x01) << bit; +} + +uint8_t SFG_getItemCollisionMapBit(uint8_t x, uint8_t y) +{ + uint16_t byte; + uint8_t bit; + + SFG_getItemCollisionMapIndex(x,y,&byte,&bit); + return (SFG_currentLevel.itemCollisionMap[byte] >> bit) & 0x01; +} + +#if SFG_DITHERED_SHADOW +SFG_PROGRAM_MEMORY uint8_t SFG_ditheringPatterns[] = +{ + 0,0,0,0, + 0,0,0,0, + + 0,0,0,0, + 0,1,0,0, + + 0,0,0,0, + 0,1,0,1, + + 1,0,1,0, + 0,1,0,0, + + 1,0,1,0, + 0,1,0,1, + + 1,0,1,0, + 0,1,1,1, + + 1,1,1,1, + 0,1,0,1, + + 1,1,1,1, + 0,1,1,1, + + 1,1,1,1, + 1,1,1,1 +}; +#endif + +/* + FUNCTIONS +=============================================================================== +*/ + +/** + Returns a pseudorandom byte. This is a very simple congrent generator, its + parameters have been chosen so that each number (0-255) is included in the + output exactly once! +*/ +uint8_t SFG_random() +{ + SFG_game.currentRandom *= 13; + SFG_game.currentRandom += 7; + + return SFG_game.currentRandom; +} + +void SFG_playGameSound(uint8_t soundIndex, uint8_t volume) +{ + if (!(SFG_game.settings & 0x01)) + return; + + uint8_t mask = 0x01 << soundIndex; + + if (!(SFG_game.soundsPlayedThisFrame & mask)) + { + SFG_playSound(soundIndex,volume); + SFG_game.soundsPlayedThisFrame |= mask; + } +} + +/** + Returns a damage value for specific attack type (SFG_WEAPON_FIRE_TYPE_...), + with added randomness (so the values will differ). For explosion pass + SFG_WEAPON_FIRE_TYPE_FIREBALL. +*/ +uint8_t SFG_getDamageValue(uint8_t attackType) +{ + if (attackType >= SFG_WEAPON_FIRE_TYPES_TOTAL) + return 0; + + int32_t value = SFG_attackDamageTable[attackType]; // has to be signed + int32_t maxAdd = (value * SFG_DAMAGE_RANDOMNESS) / 256; + + value = value + (maxAdd / 2) - (SFG_random() * maxAdd / 256); + + if (value < 0) + value = 0; + + return value; +} + +/** + Saves game data to persistent storage. +*/ +void SFG_gameSave() +{ + if (SFG_game.saved == SFG_CANT_SAVE) + return; + + SFG_LOG("saving game data"); + + SFG_save(SFG_game.save); +} + +/** + Loads game data from persistent storage. +*/ +void SFG_gameLoad() +{ + if (SFG_game.saved == SFG_CANT_SAVE) + return; + + SFG_LOG("loading game data"); + + uint8_t result = SFG_load(SFG_game.save); + + if (result == 0) + SFG_game.saved = SFG_CANT_SAVE; +} + +/** + Returns ammo type for given weapon. +*/ +uint8_t SFG_weaponAmmo(uint8_t weapon) +{ + if (weapon == SFG_WEAPON_KNIFE) + return SFG_AMMO_NONE; + if (weapon == SFG_WEAPON_MACHINE_GUN || + weapon == SFG_WEAPON_SHOTGUN) + return SFG_AMMO_BULLETS; + else if (weapon == SFG_WEAPON_ROCKET_LAUNCHER) + return SFG_AMMO_ROCKETS; + else + return SFG_AMMO_PLASMA; +} + +RCL_Unit SFG_taxicabDistance( + RCL_Unit x0, RCL_Unit y0, RCL_Unit z0, RCL_Unit x1, RCL_Unit y1, RCL_Unit z1) +{ + return (RCL_abs(x0 - x1) + RCL_abs(y0 - y1) + RCL_abs(z0 - z1)); +} + +uint8_t SFG_isInActiveDistanceFromPlayer(RCL_Unit x, RCL_Unit y, RCL_Unit z) +{ + return SFG_taxicabDistance( + x,y,z,SFG_player.camera.position.x,SFG_player.camera.position.y, + SFG_player.camera.height) <= SFG_LEVEL_ELEMENT_ACTIVE_DISTANCE; +} + +/** + Function called when a level end to compute the stats etc. +*/ +void SFG_levelEnds() +{ + SFG_currentLevel.completionTime10sOfS = (SFG_MS_PER_FRAME * + (SFG_game.frame - SFG_currentLevel.frameStart)) / 100; + + SFG_currentLevel.monstersDead = 0; + + for (uint16_t i = 0; i < SFG_currentLevel.monsterRecordCount; ++i) + if (SFG_currentLevel.monsterRecords[i].health == 0) + SFG_currentLevel.monstersDead++; + + uint32_t totalTime = SFG_SAVE_TOTAL_TIME; + + if ((SFG_currentLevel.levelNumber == 0) || (totalTime != 0)) + { + SFG_LOG("Updating save totals."); + + totalTime += SFG_currentLevel.completionTime10sOfS; + + for (uint8_t i = 0; i < 4; ++i) + { + SFG_game.save[6 + i] = totalTime % 256; + totalTime /= 256; + } + + SFG_game.save[10] += SFG_currentLevel.monstersDead % 256; + SFG_game.save[11] += SFG_currentLevel.monstersDead / 256; + } + + SFG_game.save[0] = + (SFG_game.save[0] & 0x0f) | ((SFG_currentLevel.levelNumber + 1) << 4); + + SFG_game.save[2] = SFG_player.health; + SFG_game.save[3] = SFG_player.ammo[0]; + SFG_game.save[4] = SFG_player.ammo[1]; + SFG_game.save[5] = SFG_player.ammo[2]; +} + +static inline uint8_t SFG_RCLUnitToZBuffer(RCL_Unit x) +{ + x /= (RCL_UNITS_PER_SQUARE / 8); + + uint8_t okay = x < 256; + + return okay * (x + 1) - 1; +} + +const uint8_t *SFG_getMonsterSprite( + uint8_t monsterType, uint8_t state, uint8_t frame) +{ + uint8_t index = + state == SFG_MONSTER_STATE_DEAD ? 18 : 17; + // ^ makes the code smaller compared to returning pointers + + if ((state != SFG_MONSTER_STATE_DYING) && (state != SFG_MONSTER_STATE_DEAD)) + switch (monsterType) + { + case SFG_LEVEL_ELEMENT_MONSTER_SPIDER: + switch (state) + { + case SFG_MONSTER_STATE_ATTACKING: index = 1; break; + case SFG_MONSTER_STATE_IDLE: index = 0; break; + default: index = frame ? 0 : 2; break; + } + break; + + case SFG_LEVEL_ELEMENT_MONSTER_WARRIOR: + index = state != SFG_MONSTER_STATE_ATTACKING ? 6 : 7; + break; + + case SFG_LEVEL_ELEMENT_MONSTER_DESTROYER: + switch (state) + { + case SFG_MONSTER_STATE_ATTACKING: index = 4; break; + case SFG_MONSTER_STATE_IDLE: index = 3; break; + default: index = frame ? 3 : 5; break; + } + break; + + case SFG_LEVEL_ELEMENT_MONSTER_PLASMABOT: + index = state != SFG_MONSTER_STATE_ATTACKING ? 8 : 9; + break; + + case SFG_LEVEL_ELEMENT_MONSTER_ENDER: + switch (state) + { + case SFG_MONSTER_STATE_ATTACKING: index = 12; break; + case SFG_MONSTER_STATE_IDLE: index = 10; break; + default: index = frame ? 10 : 11; break; + } + break; + + case SFG_LEVEL_ELEMENT_MONSTER_TURRET: + switch (state) + { + case SFG_MONSTER_STATE_ATTACKING: index = 15; break; + case SFG_MONSTER_STATE_IDLE: index = 13; break; + default: index = frame ? 13 : 14; break; + } + break; + + case SFG_LEVEL_ELEMENT_MONSTER_EXPLODER: + default: + index = 16; + break; + } + + return SFG_monsterSprites + index * SFG_TEXTURE_STORE_SIZE; +} + +/** + Says whether given key is currently pressed (down). This should be preferred + to SFG_keyPressed(). +*/ +uint8_t SFG_keyIsDown(uint8_t key) +{ + return SFG_game.keyStates[key] != 0; +} + +/** + Says whether given key has been pressed in the current frame. +*/ +uint8_t SFG_keyJustPressed(uint8_t key) +{ + return (SFG_game.keyStates[key]) == 1; +} + +/** + Says whether a key is being repeated after being held for certain time. +*/ +uint8_t SFG_keyRepeated(uint8_t key) +{ + return + ((SFG_game.keyStates[key] >= SFG_KEY_REPEAT_DELAY_FRAMES) || + (SFG_game.keyStates[key] == 255)) && + (SFG_game.frame % SFG_KEY_REPEAT_PERIOD_FRAMES == 0); +} + +uint16_t SFG_keyRegisters(uint8_t key) +{ + return SFG_keyJustPressed(key) || SFG_keyRepeated(key); +} + +#if SFG_RESOLUTION_SCALEDOWN == 1 + #define SFG_setGamePixel SFG_setPixel +#else + +/** + Sets the game pixel (a pixel that can potentially be bigger than the screen + pixel). +*/ +static inline void SFG_setGamePixel(uint16_t x, uint16_t y, uint8_t colorIndex) +{ + uint16_t screenY = y * SFG_RESOLUTION_SCALEDOWN; + uint16_t screenX = x * SFG_RESOLUTION_SCALEDOWN; + + for (uint16_t j = screenY; j < screenY + SFG_RESOLUTION_SCALEDOWN; ++j) + for (uint16_t i = screenX; i < screenX + SFG_RESOLUTION_SCALEDOWN; ++i) + SFG_setPixel(i,j,colorIndex); +} +#endif + +void SFG_recomputePLayerDirection() +{ + SFG_player.camera.direction = + RCL_wrap(SFG_player.camera.direction,RCL_UNITS_PER_SQUARE); + + SFG_player.direction = RCL_angleToDirection(SFG_player.camera.direction); + + SFG_player.direction.x = + (SFG_player.direction.x * SFG_PLAYER_MOVE_UNITS_PER_FRAME) + / RCL_UNITS_PER_SQUARE; + + SFG_player.direction.y = + (SFG_player.direction.y * SFG_PLAYER_MOVE_UNITS_PER_FRAME) + / RCL_UNITS_PER_SQUARE; + + SFG_game.backgroundScroll = + ((SFG_player.camera.direction * 8) * SFG_GAME_RESOLUTION_Y) + / RCL_UNITS_PER_SQUARE; +} + +#if SFG_BACKGROUND_BLUR != 0 +uint8_t SFG_backgroundBlurIndex = 0; + +SFG_PROGRAM_MEMORY int8_t SFG_backgroundBlurOffsets[9] = + { + 0 * SFG_BACKGROUND_BLUR, + 16 * SFG_BACKGROUND_BLUR, + 7 * SFG_BACKGROUND_BLUR, + 17 * SFG_BACKGROUND_BLUR, + 1 * SFG_BACKGROUND_BLUR, + 4 * SFG_BACKGROUND_BLUR, + 15 * SFG_BACKGROUND_BLUR, + 9 * SFG_BACKGROUND_BLUR, + 7 * SFG_BACKGROUND_BLUR + }; +#endif + +static inline uint8_t SFG_fogValueDiminish(RCL_Unit depth) +{ + return depth / SFG_FOG_DIMINISH_STEP; +} + +static inline uint8_t + SFG_getTexelFull(uint8_t textureIndex,RCL_Unit u, RCL_Unit v) +{ + return + SFG_getTexel( + textureIndex != 255 ? + SFG_currentLevel.textures[textureIndex] : + (SFG_wallTextures + SFG_currentLevel.levelPointer->doorTextureIndex + * SFG_TEXTURE_STORE_SIZE), + u / 32, + v / 32); +} + +static inline uint8_t SFG_getTexelAverage(uint8_t textureIndex) +{ + return + textureIndex != 255 ? + SFG_game.textureAverageColors[ + SFG_currentLevel.levelPointer->textureIndices[textureIndex]] + : + ( + SFG_game.textureAverageColors[ + SFG_currentLevel.levelPointer->doorTextureIndex] + + 1 // to distinguish from normal walls + ); +} + +void SFG_pixelFunc(RCL_PixelInfo *pixel) +{ + uint8_t color; + uint8_t shadow = 0; + + if (pixel->isHorizon && pixel->depth > RCL_UNITS_PER_SQUARE * 16) + { + color = SFG_TRANSPARENT_COLOR; + } + else if (pixel->isWall) + { + uint8_t textureIndex = + pixel->isFloor ? + ( + ((pixel->hit.type & SFG_TILE_PROPERTY_MASK) != SFG_TILE_PROPERTY_DOOR) ? + (pixel->hit.type & 0x7) + : + ( + (pixel->texCoords.y > RCL_UNITS_PER_SQUARE) ? + (pixel->hit.type & 0x7) : 255 + ) + ): + ((pixel->hit.type & 0x38) >> 3); + +#if SFG_TEXTURE_DISTANCE != 0 + RCL_Unit textureV = pixel->texCoords.y; + + if ((pixel->hit.type & SFG_TILE_PROPERTY_MASK) == + SFG_TILE_PROPERTY_SQUEEZER) + textureV += pixel->wallHeight; +#endif + + color = + textureIndex != SFG_TILE_TEXTURE_TRANSPARENT ? + ( +#if SFG_TEXTURE_DISTANCE >= 65535 + SFG_getTexelFull(textureIndex,pixel->texCoords.x,textureV) +#elif SFG_TEXTURE_DISTANCE == 0 + SFG_getTexelAverage(textureIndex) +#else + pixel->depth <= SFG_TEXTURE_DISTANCE ? + SFG_getTexelFull(textureIndex,pixel->texCoords.x,textureV) : + SFG_getTexelAverage(textureIndex) +#endif + ) + : + SFG_TRANSPARENT_COLOR; + + shadow = pixel->hit.direction >> 1; + } + else + { + color = pixel->isFloor ? + (SFG_currentLevel.floorColor) : + (pixel->height < SFG_CEILING_MAX_HEIGHT ? + SFG_currentLevel.ceilingColor : SFG_TRANSPARENT_COLOR); + } + + if (color != SFG_TRANSPARENT_COLOR) + { +#if SFG_DITHERED_SHADOW + uint8_t fogShadow = (pixel->depth * 8) / SFG_FOG_DIMINISH_STEP; + + uint8_t fogShadowPart = fogShadow & 0x07; + + fogShadow /= 8; + + uint8_t xMod4 = pixel->position.x & 0x03; + uint8_t yMod2 = pixel->position.y & 0x01; + + shadow += + fogShadow + SFG_ditheringPatterns[fogShadowPart * 8 + yMod2 * 4 + xMod4]; +#else + shadow += SFG_fogValueDiminish(pixel->depth); +#endif + +#if SFG_ENABLE_FOG + color = palette_minusValue(color,shadow); +#endif + } + else + { +#if SFG_DRAW_LEVEL_BACKGROUND + color = SFG_getTexel(SFG_backgroundImages + + SFG_currentLevel.backgroundImage * SFG_TEXTURE_STORE_SIZE, + SFG_game.backgroundScaleMap[((pixel->position.x + #if SFG_BACKGROUND_BLUR != 0 + + SFG_backgroundBlurOffsets[SFG_backgroundBlurIndex] + #endif + ) * SFG_RAYCASTING_SUBSAMPLE + SFG_game.backgroundScroll) % SFG_GAME_RESOLUTION_Y], + (SFG_game.backgroundScaleMap[(pixel->position.y // ^ TODO: get rid of mod? + #if SFG_BACKGROUND_BLUR != 0 + + SFG_backgroundBlurOffsets[SFG_backgroundBlurIndex + 1] + #endif + ) % SFG_GAME_RESOLUTION_Y ]) + ); + + #if SFG_BACKGROUND_BLUR != 0 + SFG_backgroundBlurIndex = (SFG_backgroundBlurIndex + 1) % 0x07; + #endif +#else + color = 1; +#endif + } + + RCL_Unit screenX = pixel->position.x * SFG_RAYCASTING_SUBSAMPLE; + + for (int_fast8_t i = 0; i < SFG_RAYCASTING_SUBSAMPLE; ++i) + { + SFG_setGamePixel(screenX,pixel->position.y,color); + screenX++; + } +} + +/** + Draws image on screen, with transparency. This is faster than sprite drawing. + For performance sake drawing near screen edges is not pixel perfect. +*/ +void SFG_blitImage( + const uint8_t *image, + int16_t posX, + int16_t posY, + uint8_t scale) +{ + if (scale == 0) + return; + + uint16_t x0 = posX, + x1, + y0 = posY, + y1; + + uint8_t u0 = 0, v0 = 0; + + if (posX < 0) + { + x0 = 0; + u0 = (-1 * posX) / scale; + } + + posX += scale * SFG_TEXTURE_SIZE; + + uint16_t limitX = SFG_GAME_RESOLUTION_X - scale; + uint16_t limitY = SFG_GAME_RESOLUTION_Y - scale; + + x1 = posX >= 0 ? + (posX <= limitX ? posX : limitX) + : 0; + + if (x1 >= SFG_GAME_RESOLUTION_X) + x1 = SFG_GAME_RESOLUTION_X - 1; + + if (posY < 0) + { + y0 = 0; + v0 = (-1 * posY) / scale; + } + + posY += scale * SFG_TEXTURE_SIZE; + + y1 = posY >= 0 ? + (posY <= limitY ? posY : limitY) + : 0; + + if (y1 >= SFG_GAME_RESOLUTION_Y) + y1 = SFG_GAME_RESOLUTION_Y - 1; + + uint8_t u,v; + + v = v0; + + for (uint16_t y = y0; y < y1; y += scale) + { + u = u0; + + for (uint16_t x = x0; x < x1; x += scale) + { + uint8_t color = SFG_getTexel(image,u,v); + + if (color != SFG_TRANSPARENT_COLOR) + { + uint16_t sY = y; + + for (uint8_t j = 0; j < scale; ++j) + { + uint16_t sX = x; + + for (uint8_t i = 0; i < scale; ++i) + { + SFG_setGamePixel(sX,sY,color); + sX++; + } + + sY++; + } + } + u++; + } + v++; + } +} + +void SFG_drawScaledSprite( + const uint8_t *image, + int16_t centerX, + int16_t centerY, + int16_t size, + uint8_t minusValue, + RCL_Unit distance) +{ + if ((size > SFG_MAX_SPRITE_SIZE) || (size == 0)) + return; + + uint16_t halfSize = size / 2; + + int16_t topLeftX = centerX - halfSize; + int16_t topLeftY = centerY - halfSize; + + int16_t x0, u0; + + if (topLeftX < 0) + { + u0 = -1 * topLeftX; + x0 = 0; + } + else + { + u0 = 0; + x0 = topLeftX; + } + + int16_t x1 = topLeftX + size - 1; + + if (x1 >= SFG_GAME_RESOLUTION_X) + x1 = SFG_GAME_RESOLUTION_X - 1; + + int16_t y0, v0; + + if (topLeftY < 0) + { + v0 = -1 * topLeftY; + y0 = 0; + } + else + { + v0 = 0; + y0 = topLeftY; + } + + int16_t y1 = topLeftY + size - 1; + + if (y1 >= SFG_GAME_RESOLUTION_Y) + y1 = SFG_GAME_RESOLUTION_Y - 1; + + if ((x0 > x1) || (y0 > y1) || (u0 >= size) || (v0 >= size)) // outside screen? + return; + + int16_t u1 = u0 + (x1 - x0); + int16_t v1 = v0 + (y1 - y0); + + // precompute sampling positions: + + int16_t uMin = RCL_min(u0,u1); + int16_t vMin = RCL_min(v0,v1); + int16_t uMax = RCL_max(u0,u1); + int16_t vMax = RCL_max(v0,v1); + + int16_t precompFrom = RCL_min(uMin,vMin); + int16_t precompTo = RCL_max(uMax,vMax); + + precompFrom = RCL_max(0,precompFrom); + precompTo = RCL_min(SFG_MAX_SPRITE_SIZE - 1,precompTo); + + #define PRECOMP_SCALE 512 + + int16_t precompStepScaled = ((SFG_TEXTURE_SIZE) * PRECOMP_SCALE) / size; + int16_t precompPosScaled = precompFrom * precompStepScaled; + + for (int16_t i = precompFrom; i <= precompTo; ++i) + { + SFG_game.spriteSamplingPoints[i] = precompPosScaled / PRECOMP_SCALE; + precompPosScaled += precompStepScaled; + } + + #undef PRECOMP_SCALE + + uint8_t zDistance = SFG_RCLUnitToZBuffer(distance); + + for (int16_t x = x0, u = u0; x <= x1; ++x, ++u) + { + if (SFG_game.zBuffer[x] >= zDistance) + { + int8_t columnTransparent = 1; + + for (int16_t y = y0, v = v0; y <= y1; ++y, ++v) + { + uint8_t color = + SFG_getTexel(image,SFG_game.spriteSamplingPoints[u], + SFG_game.spriteSamplingPoints[v]); + + if (color != SFG_TRANSPARENT_COLOR) + { +#if SFG_DIMINISH_SPRITES + color = palette_minusValue(color,minusValue); +#endif + columnTransparent = 0; + + SFG_setGamePixel(x,y,color); + } + } + + if (!columnTransparent) + SFG_game.zBuffer[x] = zDistance; + } + } +} + +RCL_Unit SFG_texturesAt(int16_t x, int16_t y) +{ + uint8_t p; + + SFG_TileDefinition tile = + SFG_getMapTile(SFG_currentLevel.levelPointer,x,y,&p); + + return + SFG_TILE_FLOOR_TEXTURE(tile) | (SFG_TILE_CEILING_TEXTURE(tile) << 3) | p; + // ^ store both textures (floor and ceiling) and properties in one number +} + +RCL_Unit SFG_movingWallHeight +( + RCL_Unit low, + RCL_Unit high, + uint32_t time +) +{ + RCL_Unit height = high - low; + RCL_Unit halfHeight = height / 2; + + RCL_Unit sinArg = + (time * ((SFG_MOVING_WALL_SPEED * RCL_UNITS_PER_SQUARE) / 1000)) / height; + + return + low + halfHeight + (RCL_sin(sinArg) * halfHeight) / RCL_UNITS_PER_SQUARE; +} + +RCL_Unit SFG_floorHeightAt(int16_t x, int16_t y) +{ + uint8_t properties; + + SFG_TileDefinition tile = + SFG_getMapTile(SFG_currentLevel.levelPointer,x,y,&properties); + + RCL_Unit doorHeight = 0; + + if (properties == SFG_TILE_PROPERTY_DOOR) + { + for (uint8_t i = 0; i < SFG_currentLevel.doorRecordCount; ++i) + { + SFG_DoorRecord *door = &(SFG_currentLevel.doorRecords[i]); + + if ((door->coords[0] == x) && (door->coords[1] == y)) + { + doorHeight = door->state & SFG_DOOR_VERTICAL_POSITION_MASK; + + doorHeight = doorHeight != (0xff & SFG_DOOR_VERTICAL_POSITION_MASK) ? + doorHeight * SFG_DOOR_HEIGHT_STEP : RCL_UNITS_PER_SQUARE; + + + break; + } + } + } + else if (properties == SFG_TILE_PROPERTY_ELEVATOR) + { + RCL_Unit height = + SFG_TILE_FLOOR_HEIGHT(tile) * SFG_WALL_HEIGHT_STEP; + + return SFG_movingWallHeight( + height, + height + SFG_TILE_CEILING_HEIGHT(tile) * SFG_WALL_HEIGHT_STEP, + SFG_game.frameTime - SFG_currentLevel.timeStart); + } + + return SFG_TILE_FLOOR_HEIGHT(tile) * SFG_WALL_HEIGHT_STEP - doorHeight; +} + +/** + Like SFG_floorCollisionHeightAt, but takes into account colliding items on + the map, so the squares that have these items are higher. The former function + is for rendering, this one is for collision checking. +*/ +RCL_Unit SFG_floorCollisionHeightAt(int16_t x, int16_t y) +{ + return SFG_floorHeightAt(x,y) + + SFG_getItemCollisionMapBit(x,y) * RCL_UNITS_PER_SQUARE; +} + +void SFG_getPlayerWeaponInfo( + uint8_t *ammoType, uint8_t *projectileCount, uint8_t *canShoot) +{ + *ammoType = SFG_weaponAmmo(SFG_player.weapon); + + *projectileCount = SFG_GET_WEAPON_PROJECTILE_COUNT(SFG_player.weapon); + +#if SFG_INFINITE_AMMO + *canShoot = 1; +#else + *canShoot = + (*ammoType == SFG_AMMO_NONE || + SFG_player.ammo[*ammoType] >= *projectileCount); +#endif +} + +void SFG_playerRotateWeapon(uint8_t next) +{ + uint8_t initialWeapon = SFG_player.weapon; + int8_t increment = next ? 1 : -1; + + while (1) + { + SFG_player.weapon = + (SFG_WEAPONS_TOTAL + SFG_player.weapon + increment) % SFG_WEAPONS_TOTAL; + + if (SFG_player.weapon == initialWeapon) + break; + + uint8_t ammo, projectileCount, canShoot; + + SFG_getPlayerWeaponInfo(&ammo,&projectileCount,&canShoot); + + if (canShoot) + break; + } +} + +void SFG_initPlayer() +{ + RCL_initCamera(&SFG_player.camera); + + SFG_player.camera.resolution.x = + SFG_GAME_RESOLUTION_X / SFG_RAYCASTING_SUBSAMPLE; + + SFG_player.camera.resolution.y = SFG_GAME_RESOLUTION_Y - SFG_HUD_BAR_HEIGHT; + + SFG_player.camera.position.x = RCL_UNITS_PER_SQUARE / 2 + + SFG_currentLevel.levelPointer->playerStart[0] * RCL_UNITS_PER_SQUARE; + + SFG_player.camera.position.y = RCL_UNITS_PER_SQUARE / 2 + + SFG_currentLevel.levelPointer->playerStart[1] * RCL_UNITS_PER_SQUARE; + + SFG_player.squarePosition[0] = + SFG_player.camera.position.x / RCL_UNITS_PER_SQUARE; + + SFG_player.squarePosition[1] = + SFG_player.camera.position.y / RCL_UNITS_PER_SQUARE; + + SFG_player.camera.height = + SFG_floorHeightAt( + SFG_currentLevel.levelPointer->playerStart[0], + SFG_currentLevel.levelPointer->playerStart[1]) + + RCL_CAMERA_COLL_HEIGHT_BELOW; + + SFG_player.camera.direction = + SFG_currentLevel.levelPointer->playerStart[2] * + (RCL_UNITS_PER_SQUARE / 256); + + SFG_recomputePLayerDirection(); + + SFG_player.previousVerticalSpeed = 0; + + SFG_player.headBobFrame = 0; + + SFG_player.weapon = SFG_WEAPON_KNIFE; + + SFG_player.weaponCooldownFrames = 0; + SFG_player.lastHurtFrame = SFG_game.frame; + SFG_player.lastItemTakenFrame = SFG_game.frame; + + SFG_player.health = SFG_PLAYER_START_HEALTH; + + SFG_player.cards = +#if SFG_UNLOCK_DOOR + 0x07; +#else + 0; +#endif + + SFG_player.justTeleported = 0; + + for (uint8_t i = 0; i < SFG_AMMO_TOTAL; ++i) + SFG_player.ammo[i] = 0; +} + +RCL_Unit SFG_ceilingHeightAt(int16_t x, int16_t y) +{ + uint8_t properties; + SFG_TileDefinition tile = + SFG_getMapTile(SFG_currentLevel.levelPointer,x,y,&properties); + + if (properties == SFG_TILE_PROPERTY_ELEVATOR) + return SFG_CEILING_MAX_HEIGHT; + + uint8_t height = SFG_TILE_CEILING_HEIGHT(tile); + + return properties != SFG_TILE_PROPERTY_SQUEEZER ? + ( + height != SFG_TILE_CEILING_MAX_HEIGHT ? + ((SFG_TILE_FLOOR_HEIGHT(tile) + height) * SFG_WALL_HEIGHT_STEP) : + SFG_CEILING_MAX_HEIGHT + ) : + SFG_movingWallHeight( + SFG_TILE_FLOOR_HEIGHT(tile) * SFG_WALL_HEIGHT_STEP, + (SFG_TILE_CEILING_HEIGHT(tile) + SFG_TILE_FLOOR_HEIGHT(tile)) + * SFG_WALL_HEIGHT_STEP, + SFG_game.frameTime - SFG_currentLevel.timeStart); +} + +/** + Gets sprite (image and sprite size) for given item. +*/ +void SFG_getItemSprite( + uint8_t elementType, const uint8_t **sprite, uint8_t *spriteSize) +{ + *spriteSize = 0; + *sprite = SFG_itemSprites + (elementType - 1) * SFG_TEXTURE_STORE_SIZE; + + switch (elementType) + { + case SFG_LEVEL_ELEMENT_TREE: + case SFG_LEVEL_ELEMENT_RUIN: + case SFG_LEVEL_ELEMENT_LAMP: + case SFG_LEVEL_ELEMENT_TELEPORT: + *spriteSize = 2; + break; + + case SFG_LEVEL_ELEMENT_TERMINAL: + *spriteSize = 1; + break; + + case SFG_LEVEL_ELEMENT_FINISH: + case SFG_LEVEL_ELEMENT_COLUMN: + *spriteSize = 3; + break; + + case SFG_LEVEL_ELEMENT_CARD0: + case SFG_LEVEL_ELEMENT_CARD1: + case SFG_LEVEL_ELEMENT_CARD2: + *sprite = SFG_itemSprites + + (SFG_LEVEL_ELEMENT_CARD0 - 1) * SFG_TEXTURE_STORE_SIZE; + break; + + case SFG_LEVEL_ELEMENT_BLOCKER: + *sprite = 0; + break; + + default: + break; + } +} + +/** + Says whether given item type collides, i.e. stops player from moving. +*/ +uint8_t SFG_itemCollides(uint8_t elementType) +{ + return + elementType == SFG_LEVEL_ELEMENT_BARREL || + elementType == SFG_LEVEL_ELEMENT_TREE || + elementType == SFG_LEVEL_ELEMENT_TERMINAL || + elementType == SFG_LEVEL_ELEMENT_COLUMN || + elementType == SFG_LEVEL_ELEMENT_RUIN || + elementType == SFG_LEVEL_ELEMENT_BLOCKER || + elementType == SFG_LEVEL_ELEMENT_LAMP; +} + +void SFG_setGameState(uint8_t state) +{ + SFG_game.state = state; + SFG_game.stateChangeTime = SFG_game.frameTime; +} + +void SFG_setAndInitLevel(uint8_t levelNumber) +{ + SFG_LOG("setting and initializing level"); + + const SFG_Level *level; + +#if SFG_ARDUINO + memcpy_P(&SFG_ramLevel,SFG_levels[levelNumber],sizeof(SFG_Level)); + level = &SFG_ramLevel; +#else + level = SFG_levels[levelNumber]; +#endif + + SFG_game.currentRandom = 0; + + if (SFG_game.saved != SFG_CANT_SAVE) + SFG_game.saved = 0; + + SFG_currentLevel.levelNumber = levelNumber; + SFG_currentLevel.monstersDead = 0; + SFG_currentLevel.backgroundImage = level->backgroundImage; + SFG_currentLevel.levelPointer = level; + SFG_currentLevel.bossCount = 0; + SFG_currentLevel.floorColor = level->floorColor; + SFG_currentLevel.ceilingColor = level->ceilingColor; + SFG_currentLevel.completionTime10sOfS = 0; + + for (uint8_t i = 0; i < 7; ++i) + SFG_currentLevel.textures[i] = + SFG_wallTextures + level->textureIndices[i] * SFG_TEXTURE_STORE_SIZE; + + SFG_LOG("initializing doors"); + + SFG_currentLevel.checkedDoorIndex = 0; + SFG_currentLevel.doorRecordCount = 0; + SFG_currentLevel.projectileRecordCount = 0; + SFG_currentLevel.teleportCount = 0; + SFG_currentLevel.mapRevealMask = +#if SFG_REVEAL_MAP + 0xffff; +#else + 0; +#endif + + for (uint8_t j = 0; j < SFG_MAP_SIZE; ++j) + { + for (uint8_t i = 0; i < SFG_MAP_SIZE; ++i) + { + uint8_t properties; + + SFG_getMapTile(level,i,j,&properties); + + if ((properties & SFG_TILE_PROPERTY_MASK) == SFG_TILE_PROPERTY_DOOR) + { + SFG_DoorRecord *d = + &(SFG_currentLevel.doorRecords[SFG_currentLevel.doorRecordCount]); + + d->coords[0] = i; + d->coords[1] = j; + d->state = 0x00; + + SFG_currentLevel.doorRecordCount++; + } + + if (SFG_currentLevel.doorRecordCount >= SFG_MAX_DOORS) + { + SFG_LOG("warning: too many doors!"); + break; + } + } + + if (SFG_currentLevel.doorRecordCount >= SFG_MAX_DOORS) + break; + } + + SFG_LOG("initializing level elements"); + + SFG_currentLevel.itemRecordCount = 0; + SFG_currentLevel.checkedItemIndex = 0; + + SFG_currentLevel.monsterRecordCount = 0; + SFG_currentLevel.checkedMonsterIndex = 0; + + SFG_MonsterRecord *monster; + + for (uint16_t i = 0; i < ((SFG_MAP_SIZE * SFG_MAP_SIZE) / 8); ++i) + SFG_currentLevel.itemCollisionMap[i] = 0; + + for (uint8_t i = 0; i < SFG_MAX_LEVEL_ELEMENTS; ++i) + { + const SFG_LevelElement *e = &(SFG_currentLevel.levelPointer->elements[i]); + + if (e->type != SFG_LEVEL_ELEMENT_NONE) + { + if (SFG_LEVEL_ELEMENT_TYPE_IS_MOSTER(e->type)) + { + SFG_LOG("adding monster"); + + monster = + &(SFG_currentLevel.monsterRecords[SFG_currentLevel.monsterRecordCount]); + + monster->stateType = (SFG_MONSTER_TYPE_TO_INDEX(e->type) << 4) + | SFG_MONSTER_STATE_INACTIVE; + + monster->health = + SFG_GET_MONSTER_MAX_HEALTH(SFG_MONSTER_TYPE_TO_INDEX(e->type)); + + monster->coords[0] = e->coords[0] * 4 + 2; + monster->coords[1] = e->coords[1] * 4 + 2; + + SFG_currentLevel.monsterRecordCount++; + + if (e->type == SFG_LEVEL_ELEMENT_MONSTER_ENDER) + SFG_currentLevel.bossCount++; + } + else if ((e->type < SFG_LEVEL_ELEMENT_LOCK0) || + (e->type > SFG_LEVEL_ELEMENT_LOCK2)) + { + SFG_LOG("adding item"); + SFG_currentLevel.itemRecords[SFG_currentLevel.itemRecordCount] = i; + SFG_currentLevel.itemRecordCount++; + + if (e->type == SFG_LEVEL_ELEMENT_TELEPORT) + SFG_currentLevel.teleportCount++; + + if (SFG_itemCollides(e->type)) + SFG_setItemCollisionMapBit(e->coords[0],e->coords[1],1); + } + else + { + SFG_LOG("adding door lock"); + + uint8_t properties; + + SFG_getMapTile(level,e->coords[0],e->coords[1],&properties); + + if ((properties & SFG_TILE_PROPERTY_MASK) == SFG_TILE_PROPERTY_DOOR) + { + // find the door record and lock the door: + for (uint16_t j = 0; j < SFG_currentLevel.doorRecordCount; ++j) + { + SFG_DoorRecord *d = &(SFG_currentLevel.doorRecords[j]); + + if (d->coords[0] == e->coords[0] && d->coords[1] == e->coords[1]) + { + d->state |= (e->type - SFG_LEVEL_ELEMENT_LOCK0 + 1) << 6; + break; + } + } + } + else + { + SFG_LOG("warning: lock not put on door tile!"); + } + } + } + } + + SFG_currentLevel.timeStart = SFG_getTimeMs(); + SFG_currentLevel.frameStart = SFG_game.frame; + + SFG_game.spriteAnimationFrame = 0; + + SFG_initPlayer(); + SFG_setGameState(SFG_GAME_STATE_LEVEL_START); + SFG_processEvent(SFG_EVENT_LEVEL_STARTS,levelNumber); +} + +void SFG_init() +{ + SFG_LOG("initializing game") + + SFG_game.frame = 0; + SFG_game.currentRandom = 0; + SFG_game.continues = 1; + + RCL_initRayConstraints(&SFG_game.rayConstraints); + SFG_game.rayConstraints.maxHits = SFG_RAYCASTING_MAX_HITS; + SFG_game.rayConstraints.maxSteps = SFG_RAYCASTING_MAX_STEPS; + + SFG_game.antiSpam = 0; + + SFG_LOG("computing average texture colors") + + for (uint8_t i = 0; i < SFG_WALL_TEXTURE_COUNT; ++i) + { + /** For simplicity, we round colors so that there is only 64 of them, and + we count them up to 256. */ + + uint8_t colorHistogram[64]; + + for (uint8_t j = 0; j < 64; ++j) + colorHistogram[j] = 0; + + for (uint8_t y = 0; y < SFG_TEXTURE_SIZE; ++y) + for (uint8_t x = 0; x < SFG_TEXTURE_SIZE; ++x) + { + uint8_t color = + SFG_getTexel(SFG_wallTextures + i * SFG_TEXTURE_STORE_SIZE,x,y) / 4; + + colorHistogram[color] += 1; + + if (colorHistogram[color] == 255) + break; + } + + uint8_t maxIndex = 0; + + for (uint8_t j = 0; j < 64; ++j) + { + if (colorHistogram[j] == 255) + { + maxIndex = j; + break; + } + + if (colorHistogram[j] > colorHistogram[maxIndex]) + maxIndex = j; + } + + SFG_game.textureAverageColors[i] = maxIndex * 4; + } + + for (uint16_t i = 0; i < SFG_GAME_RESOLUTION_Y; ++i) + SFG_game.backgroundScaleMap[i] = + (i * SFG_TEXTURE_SIZE) / SFG_GAME_RESOLUTION_Y; + + for (uint8_t i = 0; i < SFG_KEY_COUNT; ++i) + SFG_game.keyStates[i] = 0; + + SFG_game.backgroundScroll = 0; + SFG_currentLevel.levelPointer = 0; + SFG_game.lastFrameTimeMs = SFG_getTimeMs(); + SFG_game.selectedMenuItem = 0; + SFG_game.selectedLevel = 0; + SFG_game.settings = 0x03; + SFG_game.saved = 0; + + // create a default save data: + + for (uint16_t i = 0; i < SFG_SAVE_SIZE; ++i) + SFG_game.save[i] = 0; + + SFG_game.save[0] = 0; + SFG_game.save[1] = SFG_game.settings; + + SFG_gameLoad(); // attempt to load settings + + if (SFG_game.saved != SFG_CANT_SAVE) + { + SFG_LOG("settings loaded"); + SFG_game.settings = SFG_game.save[1]; + } + else + { + SFG_LOG("saving/loading not possible"); + SFG_game.save[0] = SFG_NUMBER_OF_LEVELS | 0xf0; // revealed all levels + } + + SFG_enableMusic(SFG_game.settings & 0x02); + +#if SFG_START_LEVEL == 0 + SFG_setGameState(SFG_GAME_STATE_MENU); +#else + SFG_setAndInitLevel(SFG_START_LEVEL - 1); +#endif +} + +/** + Adds new projectile to the current level, return 1 if added, 0 if not (max + count reached). +*/ +uint8_t SFG_createProjectile(SFG_ProjectileRecord projectile) +{ + if (SFG_currentLevel.projectileRecordCount >= SFG_MAX_PROJECTILES) + return 0; + + SFG_currentLevel.projectileRecords[SFG_currentLevel.projectileRecordCount] = + projectile; + + SFG_currentLevel.projectileRecordCount++; + + return 1; +} + +/** + Launches projectile of given type from given position in given direction + (has to be normalized), with given offset (so as to not collide with the + shooting entity). Returns the same value as SFG_createProjectile. +*/ +uint8_t SFG_launchProjectile( + uint8_t type, + RCL_Vector2D shootFrom, + RCL_Unit shootFromHeight, + RCL_Vector2D direction, + RCL_Unit verticalSpeed, + RCL_Unit offsetDistance + ) +{ + if (type == SFG_PROJECTILE_NONE) + return 0; + + SFG_ProjectileRecord p; + + p.type = type; + p.doubleFramesToLive = + RCL_nonZero(SFG_GET_PROJECTILE_FRAMES_TO_LIVE(type) / 2); + + p.position[0] = + shootFrom.x + (direction.x * offsetDistance) / RCL_UNITS_PER_SQUARE; + + p.position[1] = + shootFrom.y + (direction.y * offsetDistance) / RCL_UNITS_PER_SQUARE; + + p.position[2] = shootFromHeight; + + p.direction[0] = + (direction.x * SFG_GET_PROJECTILE_SPEED_UPS(type)) / RCL_UNITS_PER_SQUARE; + + p.direction[1] = + (direction.y * SFG_GET_PROJECTILE_SPEED_UPS(type)) / RCL_UNITS_PER_SQUARE; + + p.direction[2] = verticalSpeed; + + return SFG_createProjectile(p); +} + +/** + Pushes a given position away from a center by given distance, with collisions. + Returns 1 if push away happened, otherwise 0. +*/ +uint8_t SFG_pushAway( + RCL_Unit pos[3], + RCL_Unit centerX, + RCL_Unit centerY, + RCL_Unit preferredDirection, + RCL_Unit distance) +{ + RCL_Vector2D fromCenter; + + fromCenter.x = pos[0] - centerX; + fromCenter.y = pos[1] - centerY; + + RCL_Unit l = RCL_len(fromCenter); + + if (l < 128) + { + fromCenter = RCL_angleToDirection(preferredDirection); + l = RCL_UNITS_PER_SQUARE; + } + else if (l >= distance) + { + return 0; + } + + RCL_Vector2D offset; + + offset.x = (fromCenter.x * distance) / l; + offset.y = (fromCenter.y * distance) / l; + + RCL_Camera c; + + RCL_initCamera(&c); + + c.position.x = pos[0]; + c.position.y = pos[1]; + c.height = pos[2]; + + RCL_moveCameraWithCollision(&c,offset,0,SFG_floorCollisionHeightAt, + SFG_ceilingHeightAt,1,1); + + pos[0] = c.position.x; + pos[1] = c.position.y; + pos[2] = c.height; + + return 1; +} + +uint8_t SFG_pushPlayerAway( + RCL_Unit centerX, RCL_Unit centerY, RCL_Unit distance) +{ + RCL_Unit p[3]; + + p[0] = SFG_player.camera.position.x; + p[1] = SFG_player.camera.position.y; + p[2] = SFG_player.camera.height; + + uint8_t result = SFG_pushAway(p,centerX,centerY, + SFG_player.camera.direction - RCL_UNITS_PER_SQUARE / 2, + distance); + + SFG_player.camera.position.x = p[0]; + SFG_player.camera.position.y = p[1]; + SFG_player.camera.height = p[2]; + + return result; +} + +/** + Helper function to resolve collision with level element. The function supposes + the collision already does happen and only resolves it. Returns adjusted move + offset. +*/ +RCL_Vector2D SFG_resolveCollisionWithElement( + RCL_Vector2D position, RCL_Vector2D moveOffset, RCL_Vector2D elementPos) +{ + RCL_Unit dx = RCL_abs(elementPos.x - position.x); + RCL_Unit dy = RCL_abs(elementPos.y - position.y); + + if (dx > dy) + { + // colliding from left/right + + if ((moveOffset.x > 0) == (position.x < elementPos.x)) + moveOffset.x = 0; + // ^ only stop if heading towards element, to avoid getting stuck + } + else + { + // colliding from up/down + + if ((moveOffset.y > 0) == (position.y < elementPos.y)) + moveOffset.y = 0; + } + + return moveOffset; +} + +/** + Adds or substracts player's health, which either hurts him (negative value) + or heals him (positive value). +*/ +void SFG_playerChangeHealth(int8_t healthAdd) +{ + int16_t health = SFG_player.health; + health += healthAdd; + health = RCL_clamp(health,0,SFG_PLAYER_MAX_HEALTH); + + SFG_player.health = health; + + if (healthAdd < 0) + { + SFG_player.lastHurtFrame = SFG_game.frame; + SFG_processEvent(SFG_EVENT_VIBRATE,0); + SFG_processEvent(SFG_EVENT_PLAYER_HURT,-1 * healthAdd); + } +} + +void SFG_playerChangeHealthWithMiltiplier(int8_t healthAdd) +{ + if (healthAdd < 0) + healthAdd = + RCL_min(-1, + (((RCL_Unit) healthAdd) * SFG_PLAYER_DAMAGE_MULTIPLIER) / + RCL_UNITS_PER_SQUARE); + + SFG_playerChangeHealth(healthAdd); +} + +uint8_t SFG_distantSoundVolume(RCL_Unit x, RCL_Unit y, RCL_Unit z) +{ + RCL_Unit distance = SFG_taxicabDistance(x,y,z, + SFG_player.camera.position.x, + SFG_player.camera.position.y, + SFG_player.camera.height); + + if (distance >= SFG_SFX_MAX_DISTANCE) + return 0; + + uint32_t result = 255 - (distance * 255) / SFG_SFX_MAX_DISTANCE; + + return (result * result) / 256; +} + +/** + Same as SFG_playerChangeHealth but for monsters. +*/ +void SFG_monsterChangeHealth(SFG_MonsterRecord *monster, int8_t healthAdd) +{ + int16_t health = monster->health; + + health += healthAdd; + health = RCL_clamp(health,0,255); + monster->health = health; + + if (healthAdd < 0) + { + // play hurt sound + + uint8_t volume = SFG_distantSoundVolume( + SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[0]), + SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[1]), + SFG_floorHeightAt( + SFG_MONSTER_COORD_TO_SQUARES(monster->coords[0]), + SFG_MONSTER_COORD_TO_SQUARES(monster->coords[1]))); + + SFG_playGameSound(5,volume); + + if (monster->health == 0) + SFG_playGameSound(2,volume); + } +} + +void SFG_removeItem(uint8_t index) +{ + SFG_LOG("removing item"); + + for (uint16_t j = index; j < SFG_currentLevel.itemRecordCount - 1; ++j) + SFG_currentLevel.itemRecords[j] = + SFG_currentLevel.itemRecords[j + 1]; + + SFG_currentLevel.itemRecordCount--; +} + +/** + Helper function, returns a pointer to level element representing item with + given index, but only if the item is active (otherwise 0 is returned). +*/ +static inline const SFG_LevelElement *SFG_getActiveItemElement(uint8_t index) +{ + SFG_ItemRecord item = SFG_currentLevel.itemRecords[index]; + + if ((item & SFG_ITEM_RECORD_ACTIVE_MASK) == 0) + return 0; + + return &(SFG_currentLevel.levelPointer->elements[item & + ~SFG_ITEM_RECORD_ACTIVE_MASK]); +} + +static inline const SFG_LevelElement *SFG_getLevelElement(uint8_t index) +{ + SFG_ItemRecord item = SFG_currentLevel.itemRecords[index]; + + return &(SFG_currentLevel.levelPointer->elements[item & + ~SFG_ITEM_RECORD_ACTIVE_MASK]); +} + +void SFG_createExplosion(RCL_Unit, RCL_Unit, RCL_Unit); // forward decl + +void SFG_explodeBarrel(uint8_t itemIndex, RCL_Unit x, RCL_Unit y, RCL_Unit z) +{ + const SFG_LevelElement *e = SFG_getLevelElement(itemIndex); + SFG_setItemCollisionMapBit(e->coords[0],e->coords[1],0); + SFG_removeItem(itemIndex); + SFG_createExplosion(x,y,z); +} + +void SFG_createExplosion(RCL_Unit x, RCL_Unit y, RCL_Unit z) +{ + SFG_ProjectileRecord explosion; + + SFG_playGameSound(2,SFG_distantSoundVolume(x,y,z)); + SFG_processEvent(SFG_EVENT_EXPLOSION,0); + + explosion.type = SFG_PROJECTILE_EXPLOSION; + + explosion.position[0] = x; + explosion.position[1] = y; + explosion.position[2] = z; + + explosion.direction[0] = 0; + explosion.direction[1] = 0; + explosion.direction[2] = 0; + + explosion.doubleFramesToLive = RCL_nonZero( + SFG_GET_PROJECTILE_FRAMES_TO_LIVE(SFG_PROJECTILE_EXPLOSION) / 2); + + SFG_createProjectile(explosion); + + uint8_t damage = SFG_getDamageValue(SFG_WEAPON_FIRE_TYPE_FIREBALL); + + if (SFG_pushPlayerAway(x,y,SFG_EXPLOSION_PUSH_AWAY_DISTANCE)) + SFG_playerChangeHealthWithMiltiplier(-1 * damage); + + for (uint16_t i = 0; i < SFG_currentLevel.monsterRecordCount; ++i) + { + SFG_MonsterRecord *monster = &(SFG_currentLevel.monsterRecords[i]); + + uint16_t state = SFG_MR_STATE(*monster); + + if ((state == SFG_MONSTER_STATE_INACTIVE) || + (state == SFG_MONSTER_STATE_DEAD)) + continue; + + RCL_Unit monsterHeight = + SFG_floorHeightAt( + SFG_MONSTER_COORD_TO_SQUARES(monster->coords[0]), + SFG_MONSTER_COORD_TO_SQUARES(monster->coords[1])) + + RCL_UNITS_PER_SQUARE / 2; + + if (SFG_taxicabDistance( + SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[0]), + SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[1]),monsterHeight, + x,y,z) <= SFG_EXPLOSION_RADIUS) + { + SFG_monsterChangeHealth(monster, + -1 * SFG_getDamageValue(SFG_WEAPON_FIRE_TYPE_FIREBALL)); + } + } + + // explode nearby barrels + + if (damage >= SFG_BARREL_EXPLOSION_DAMAGE_THRESHOLD) + for (uint16_t i = 0; i < SFG_currentLevel.itemRecordCount; ++i) + { + SFG_ItemRecord item = SFG_currentLevel.itemRecords[i]; + + /* We DON'T check just active barrels but all, otherwise it looks weird + that out of sight barrels in a line didn't explode.*/ + + SFG_LevelElement element = SFG_ITEM_RECORD_LEVEL_ELEMENT(item); + + if (element.type != SFG_LEVEL_ELEMENT_BARREL) + continue; + + RCL_Unit elementX = + element.coords[0] * RCL_UNITS_PER_SQUARE + RCL_UNITS_PER_SQUARE / 2; + + RCL_Unit elementY = + element.coords[1] * RCL_UNITS_PER_SQUARE + RCL_UNITS_PER_SQUARE / 2; + + RCL_Unit elementHeight = + SFG_floorHeightAt(element.coords[0],element.coords[1]); + + if (SFG_taxicabDistance( + x,y,z,elementX,elementY,elementHeight) <= SFG_EXPLOSION_RADIUS) + { + SFG_explodeBarrel(i,elementX,elementY,elementHeight); + i--; + } + } +} + +void SFG_createDust(RCL_Unit x, RCL_Unit y, RCL_Unit z) +{ + SFG_ProjectileRecord dust; + + dust.type = SFG_PROJECTILE_DUST; + + dust.position[0] = x; + dust.position[1] = y; + dust.position[2] = z; + + dust.direction[0] = 0; + dust.direction[1] = 0; + dust.direction[2] = 0; + + dust.doubleFramesToLive = + RCL_nonZero(SFG_GET_PROJECTILE_FRAMES_TO_LIVE(SFG_PROJECTILE_DUST) / 2); + + SFG_createProjectile(dust); +} + +void SFG_getMonsterWorldPosition(SFG_MonsterRecord *monster, RCL_Unit *x, + RCL_Unit *y, RCL_Unit *z) +{ + *x = SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[0]); + *y = SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[1]); + *z = SFG_floorHeightAt( + SFG_MONSTER_COORD_TO_SQUARES(monster->coords[0]), + SFG_MONSTER_COORD_TO_SQUARES(monster->coords[1])) + + RCL_UNITS_PER_SQUARE / 2; +} + +void SFG_monsterPerformAI(SFG_MonsterRecord *monster) +{ + uint8_t state = SFG_MR_STATE(*monster); + uint8_t type = SFG_MR_TYPE(*monster); + uint8_t monsterNumber = SFG_MONSTER_TYPE_TO_INDEX(type); + uint8_t attackType = SFG_GET_MONSTER_ATTACK_TYPE(monsterNumber); + + int8_t coordAdd[2]; + + coordAdd[0] = 0; + coordAdd[1] = 0; + + uint8_t notRanged = + (attackType == SFG_MONSTER_ATTACK_MELEE) || + (attackType == SFG_MONSTER_ATTACK_EXPLODE); + + uint8_t monsterSquare[2] = + { + SFG_MONSTER_COORD_TO_SQUARES(monster->coords[0]), + SFG_MONSTER_COORD_TO_SQUARES(monster->coords[1]) + }; + + RCL_Unit currentHeight = + SFG_floorCollisionHeightAt(monsterSquare[0],monsterSquare[1]); + + if ( // sometimes randomly attack + !notRanged && + (SFG_random() < + SFG_GET_MONSTER_AGGRESSIVITY(SFG_MONSTER_TYPE_TO_INDEX(type))) + ) + { + if (!notRanged && (SFG_random() % 4 != 0)) + { + // attack + + state = SFG_MONSTER_STATE_ATTACKING; + + if (type != SFG_LEVEL_ELEMENT_MONSTER_WARRIOR) + { + RCL_Vector2D pos; + RCL_Vector2D dir; + + pos.x = SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[0]); + pos.y = SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[1]); + + dir.x = SFG_player.camera.position.x - pos.x + - 128 * SFG_MONSTER_AIM_RANDOMNESS + + SFG_random() * SFG_MONSTER_AIM_RANDOMNESS; + + dir.y = SFG_player.camera.position.y - pos.y + - 128 * SFG_MONSTER_AIM_RANDOMNESS + + SFG_random() * SFG_MONSTER_AIM_RANDOMNESS; + + dir = RCL_normalize(dir); + + uint8_t projectile; + + switch (SFG_GET_MONSTER_ATTACK_TYPE(monsterNumber)) + { + case SFG_MONSTER_ATTACK_FIREBALL: + projectile = SFG_PROJECTILE_FIREBALL; + break; + + case SFG_MONSTER_ATTACK_BULLET: + projectile = SFG_PROJECTILE_BULLET; + break; + + case SFG_MONSTER_ATTACK_PLASMA: + projectile = SFG_PROJECTILE_PLASMA; + break; + + case SFG_MONSTER_ATTACK_FIREBALL_BULLET: + projectile = (SFG_random() < 128) ? + SFG_PROJECTILE_FIREBALL : + SFG_PROJECTILE_BULLET; + break; + + case SFG_MONSTER_ATTACK_FIREBALL_PLASMA: + projectile = (SFG_random() < 128) ? + SFG_PROJECTILE_FIREBALL : + SFG_PROJECTILE_PLASMA; + break; + + default: + projectile = SFG_PROJECTILE_NONE; + break; + } + + if (projectile == SFG_PROJECTILE_BULLET) + SFG_playGameSound(0, + SFG_distantSoundVolume( + SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[0]), + SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[1]), + currentHeight) + ); + + SFG_launchProjectile( + projectile, + pos, + currentHeight + RCL_UNITS_PER_SQUARE / 2, + dir, + 0, + SFG_PROJECTILE_SPAWN_OFFSET + ); + } + } + else + state = SFG_MONSTER_STATE_IDLE; + } + else if (state == SFG_MONSTER_STATE_IDLE) + { + if (notRanged) + { + // non-ranged monsters walk towards player + + RCL_Unit pX, pY, pZ; + SFG_getMonsterWorldPosition(monster,&pX,&pY,&pZ); + + uint8_t isClose = // close to player? + SFG_taxicabDistance(pX,pY,pZ, + SFG_player.camera.position.x, + SFG_player.camera.position.y, + SFG_player.camera.height) <= SFG_MELEE_RANGE; + + if (!isClose) + { + // walk towards player + + if (monsterSquare[0] > SFG_player.squarePosition[0]) + { + if (monsterSquare[1] > SFG_player.squarePosition[1]) + state = SFG_MONSTER_STATE_GOING_NW; + else if (monsterSquare[1] < SFG_player.squarePosition[1]) + state = SFG_MONSTER_STATE_GOING_SW; + else + state = SFG_MONSTER_STATE_GOING_W; + } + else if (monsterSquare[0] < SFG_player.squarePosition[0]) + { + if (monsterSquare[1] > SFG_player.squarePosition[1]) + state = SFG_MONSTER_STATE_GOING_NE; + else if (monsterSquare[1] < SFG_player.squarePosition[1]) + state = SFG_MONSTER_STATE_GOING_SE; + else + state = SFG_MONSTER_STATE_GOING_E; + } + else + { + if (monsterSquare[1] > SFG_player.squarePosition[1]) + state = SFG_MONSTER_STATE_GOING_N; + else if (monsterSquare[1] < SFG_player.squarePosition[1]) + state = SFG_MONSTER_STATE_GOING_S; + } + } + else // is close + { + // melee, close-up attack + + if (attackType == SFG_MONSTER_ATTACK_MELEE) + { + // melee attack + + state = SFG_MONSTER_STATE_ATTACKING; + + SFG_playerChangeHealthWithMiltiplier( + -1 * SFG_getDamageValue(SFG_WEAPON_FIRE_TYPE_MELEE)); + + SFG_playGameSound(3,255); + } + else // SFG_MONSTER_ATTACK_EXPLODE + { + // explode + + SFG_createExplosion(pX,pY,pZ); + monster->health = 0; + } + } + } + else // ranged monsters + { + // choose walk direction randomly + + switch (SFG_random() % 8) + { + case 0: state = SFG_MONSTER_STATE_GOING_E; break; + case 1: state = SFG_MONSTER_STATE_GOING_W; break; + case 2: state = SFG_MONSTER_STATE_GOING_N; break; + case 3: state = SFG_MONSTER_STATE_GOING_S; break; + case 4: state = SFG_MONSTER_STATE_GOING_NE; break; + case 5: state = SFG_MONSTER_STATE_GOING_NW; break; + case 6: state = SFG_MONSTER_STATE_GOING_SE; break; + case 7: state = SFG_MONSTER_STATE_GOING_SW; break; + default: break; + } + } + } + else if (state == SFG_MONSTER_STATE_ATTACKING) + { + state = SFG_MONSTER_STATE_IDLE; + } + else + { + int8_t add = 1; + + if (attackType == SFG_MONSTER_ATTACK_MELEE) + add = 2; + else if (attackType == SFG_MONSTER_ATTACK_EXPLODE) + add = 3; + + if (state == SFG_MONSTER_STATE_GOING_E || + state == SFG_MONSTER_STATE_GOING_NE || + state == SFG_MONSTER_STATE_GOING_SE) + coordAdd[0] = add; + else if (state == SFG_MONSTER_STATE_GOING_W || + state == SFG_MONSTER_STATE_GOING_SW || + state == SFG_MONSTER_STATE_GOING_NW) + coordAdd[0] = -1 * add; + + if (state == SFG_MONSTER_STATE_GOING_N || + state == SFG_MONSTER_STATE_GOING_NE || + state == SFG_MONSTER_STATE_GOING_NW) + coordAdd[1] = -1 * add; + else if (state == SFG_MONSTER_STATE_GOING_S || + state == SFG_MONSTER_STATE_GOING_SE || + state == SFG_MONSTER_STATE_GOING_SW) + coordAdd[1] = add; + + if ((coordAdd[0] != 0 || coordAdd[1] != 0) && SFG_random() < + SFG_MONSTER_SOUND_PROBABILITY) + SFG_playGameSound(5, + SFG_distantSoundVolume( + SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[0]), + SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[1]), + currentHeight) / 2); + + state = SFG_MONSTER_STATE_IDLE; + } + + int16_t newPos[2]; + + newPos[0] = monster->coords[0] + coordAdd[0]; + newPos[1] = monster->coords[1] + coordAdd[1]; + + int8_t collision = 0; + + if (newPos[0] < 0 || newPos[0] >= 256 || newPos[1] < 0 || newPos[1] >= 256) + { + collision = 1; + } + else + { + uint8_t movingDiagonally = (coordAdd[0] != 0) && (coordAdd[1] != 0); + + // when moving diagonally, we need to check extra tiles + + for (uint8_t i = 0; i < (1 + movingDiagonally); ++i) + { + newPos[0] = monster->coords[0] + (i != 1) * coordAdd[0]; + + RCL_Unit newHeight = + SFG_floorCollisionHeightAt( + SFG_MONSTER_COORD_TO_SQUARES(newPos[0]), + SFG_MONSTER_COORD_TO_SQUARES(newPos[1])); + + collision = + RCL_abs(currentHeight - newHeight) > RCL_CAMERA_COLL_STEP_HEIGHT; + + if (!collision) + collision = (SFG_ceilingHeightAt( + SFG_MONSTER_COORD_TO_SQUARES(newPos[0]), + SFG_MONSTER_COORD_TO_SQUARES(newPos[1])) - newHeight) < + SFG_MONSTER_COLLISION_HEIGHT; + + if (collision) + break; + } + + newPos[0] = monster->coords[0] + coordAdd[0]; + } + + if (collision) + { + state = SFG_MONSTER_STATE_IDLE; + // ^ will force the monster to choose random direction in the next update + + newPos[0] = monster->coords[0]; + newPos[1] = monster->coords[1]; + } + + monster->stateType = state | (monsterNumber << 4); + monster->coords[0] = newPos[0]; + monster->coords[1] = newPos[1];; +} + +static inline uint8_t SFG_elementCollides( + RCL_Unit pointX, + RCL_Unit pointY, + RCL_Unit pointZ, + RCL_Unit elementX, + RCL_Unit elementY, + RCL_Unit elementHeight +) +{ + return + SFG_taxicabDistance(pointX,pointY,pointZ,elementX,elementY,elementHeight) + <= SFG_ELEMENT_COLLISION_RADIUS; +} + +/** + Checks collision of a projectile with level element at given position. +*/ +uint8_t SFG_projectileCollides(SFG_ProjectileRecord *projectile, + RCL_Unit x, RCL_Unit y, RCL_Unit z) +{ + if (!SFG_elementCollides(x,y,z, + projectile->position[0],projectile->position[1],projectile->position[2])) + return 0; + + if ((projectile->type == SFG_PROJECTILE_EXPLOSION) || + (projectile->type == SFG_PROJECTILE_DUST)) + return 0; + + /* For directional projectiles we only register a collision if its direction + is "towards" the element so that the shooter doesn't get shot by his own + projectile. */ + + RCL_Vector2D projDir, toElement; + + projDir.x = projectile->direction[0]; + projDir.y = projectile->direction[1]; + + toElement.x = x - projectile->position[0]; + toElement.y = y - projectile->position[1]; + + return RCL_vectorsAngleCos(projDir,toElement) >= 0; +} + +/** + Updates a frame of the currently loaded level, i.e. enemies, projectiles, + aimations etc., with the exception of player. +*/ +void SFG_updateLevel() +{ + // update projectiles: + + uint8_t substractFrames = + (SFG_game.frame - SFG_currentLevel.frameStart) & 0x01 ? 1 : 0; + /* ^ only substract frames to live every other frame because a maximum of + 256 frames would be too few */ + + for (int8_t i = 0; i < SFG_currentLevel.projectileRecordCount; ++i) + { // ^ has to be signed + SFG_ProjectileRecord *p = &(SFG_currentLevel.projectileRecords[i]); + + uint8_t attackType = 255; + + if (p->type == SFG_PROJECTILE_BULLET) + attackType = SFG_WEAPON_FIRE_TYPE_BULLET; + else if (p->type == SFG_PROJECTILE_PLASMA) + attackType = SFG_WEAPON_FIRE_TYPE_PLASMA; + + RCL_Unit pos[3] = {0,0,0}; /* we have to convert from uint16_t because of + under/overflows */ + uint8_t eliminate = 0; + + for (uint8_t j = 0; j < 3; ++j) + { + pos[j] = p->position[j]; + pos[j] += p->direction[j]; + + if ( // projectile outside map? + (pos[j] < 0) || + (pos[j] >= (SFG_MAP_SIZE * RCL_UNITS_PER_SQUARE))) + { + eliminate = 1; + break; + } + } + + if (p->doubleFramesToLive == 0) // no more time to live? + { + eliminate = 1; + } + else if ( + (p->type != SFG_PROJECTILE_EXPLOSION) && + (p->type != SFG_PROJECTILE_DUST)) + { + if (SFG_projectileCollides( // collides with player? + p, + SFG_player.camera.position.x, + SFG_player.camera.position.y, + SFG_player.camera.height)) + { + eliminate = 1; + SFG_playerChangeHealthWithMiltiplier(-1 * SFG_getDamageValue(attackType)); + } + + /* Check collision with the map (we don't use SFG_floorCollisionHeightAt + because collisions with items have to be done differently for + projectiles). */ + + if (!eliminate && + ((SFG_floorHeightAt(pos[0] / RCL_UNITS_PER_SQUARE,pos[1] / + RCL_UNITS_PER_SQUARE) >= pos[2]) + || + (SFG_ceilingHeightAt(pos[0] / RCL_UNITS_PER_SQUARE,pos[1] / + RCL_UNITS_PER_SQUARE) <= pos[2])) + ) + eliminate = 1; + + // check collision with active level elements + + if (!eliminate) // monsters + for (uint16_t j = 0; j < SFG_currentLevel.monsterRecordCount; ++j) + { + SFG_MonsterRecord *m = &(SFG_currentLevel.monsterRecords[j]); + + uint8_t state = SFG_MR_STATE(*m); + + if ((state != SFG_MONSTER_STATE_INACTIVE) && + (state != SFG_MONSTER_STATE_DEAD)) + { + if (SFG_projectileCollides(p, + SFG_MONSTER_COORD_TO_RCL_UNITS(m->coords[0]), + SFG_MONSTER_COORD_TO_RCL_UNITS(m->coords[1]), + SFG_floorHeightAt( + SFG_MONSTER_COORD_TO_SQUARES(m->coords[0]), + SFG_MONSTER_COORD_TO_SQUARES(m->coords[1])) + )) + { + eliminate = 1; + SFG_monsterChangeHealth(m,-1 * SFG_getDamageValue(attackType)); + break; + } + } + } + + if (!eliminate) // items (can't check itemCollisionMap because of barrels) + for (uint16_t j = 0; j < SFG_currentLevel.itemRecordCount; ++j) + { + const SFG_LevelElement *e = SFG_getActiveItemElement(j); + + if (e != 0 && SFG_itemCollides(e->type)) + { + RCL_Unit x = SFG_ELEMENT_COORD_TO_RCL_UNITS(e->coords[0]); + RCL_Unit y = SFG_ELEMENT_COORD_TO_RCL_UNITS(e->coords[1]); + RCL_Unit z = SFG_floorHeightAt(e->coords[0],e->coords[1]); + + if (SFG_projectileCollides(p,x,y,z)) + { + if ( + (e->type == SFG_LEVEL_ELEMENT_BARREL) && + (SFG_getDamageValue(attackType) >= + SFG_BARREL_EXPLOSION_DAMAGE_THRESHOLD) + ) + { + SFG_explodeBarrel(j,x,y,z); + } + + eliminate = 1; + break; + } + } + } + } + + if (eliminate) + { + if (p->type == SFG_PROJECTILE_FIREBALL) + SFG_createExplosion(p->position[0],p->position[1],p->position[2]); + else if (p->type == SFG_PROJECTILE_BULLET) + SFG_createDust(p->position[0],p->position[1],p->position[2]); + else if (p->type == SFG_PROJECTILE_PLASMA) + SFG_playGameSound(4,SFG_distantSoundVolume(pos[0],pos[1],pos[2])); + + // remove the projectile + + for (uint8_t j = i; j < SFG_currentLevel.projectileRecordCount - 1; ++j) + SFG_currentLevel.projectileRecords[j] = + SFG_currentLevel.projectileRecords[j + 1]; + + SFG_currentLevel.projectileRecordCount--; + + i--; + } + else + { + p->position[0] = pos[0]; + p->position[1] = pos[1]; + p->position[2] = pos[2]; + } + + p->doubleFramesToLive -= substractFrames; + } + + // handle door: + if (SFG_currentLevel.doorRecordCount > 0) // has to be here + { + /* Check door on whether a player is standing nearby. For performance + reasons we only check a few doors and move to others in the next + frame. */ + + if (SFG_currentLevel.checkedDoorIndex == 0) + { + uint8_t count = SFG_player.cards >> 6; + + SFG_player.cards = (count <= 1) ? + (SFG_player.cards & 0x07) : + ((SFG_player.cards & 0x7f) | ((count - 1) << 6)); + } + + for (uint16_t i = 0; + i < RCL_min(SFG_ELEMENT_DISTANCES_CHECKED_PER_FRAME, + SFG_currentLevel.doorRecordCount); + ++i) + { + SFG_DoorRecord *door = + &(SFG_currentLevel.doorRecords[SFG_currentLevel.checkedDoorIndex]); + + uint8_t upDownState = door->state & SFG_DOOR_UP_DOWN_MASK; + + uint8_t newUpDownState = 0; + + uint8_t lock = SFG_DOOR_LOCK(door->state); + + if ( // player near door? + (door->coords[0] >= (SFG_player.squarePosition[0] - 1)) && + (door->coords[0] <= (SFG_player.squarePosition[0] + 1)) && + (door->coords[1] >= (SFG_player.squarePosition[1] - 1)) && + (door->coords[1] <= (SFG_player.squarePosition[1] + 1))) + { + if (lock == 0) + { + newUpDownState = SFG_DOOR_UP_DOWN_MASK; + } + else + { + lock = 1 << (lock - 1); + + if (SFG_player.cards & lock) // player has the card? + newUpDownState = SFG_DOOR_UP_DOWN_MASK; + else + SFG_player.cards = + (SFG_player.cards & 0x07) | (lock << 3) | (2 << 6); + } + } + + if (upDownState != newUpDownState) + SFG_playGameSound(1,255); + + door->state = (door->state & ~SFG_DOOR_UP_DOWN_MASK) | newUpDownState; + + SFG_currentLevel.checkedDoorIndex++; + + if (SFG_currentLevel.checkedDoorIndex >= SFG_currentLevel.doorRecordCount) + SFG_currentLevel.checkedDoorIndex = 0; + } + + // move door up/down: + for (uint32_t i = 0; i < SFG_currentLevel.doorRecordCount; ++i) + { + SFG_DoorRecord *door = &(SFG_currentLevel.doorRecords[i]); + + int8_t height = door->state & SFG_DOOR_VERTICAL_POSITION_MASK; + + height = (door->state & SFG_DOOR_UP_DOWN_MASK) ? + RCL_min(0x1f,height + SFG_DOOR_INCREMENT_PER_FRAME) : + RCL_max(0x00,height - SFG_DOOR_INCREMENT_PER_FRAME); + + door->state = (door->state & ~SFG_DOOR_VERTICAL_POSITION_MASK) | height; + } + } + + // handle items, in a similar manner to door: + if (SFG_currentLevel.itemRecordCount > 0) // has to be here + { + // check item distances: + + for (uint16_t i = 0; + i < RCL_min(SFG_ELEMENT_DISTANCES_CHECKED_PER_FRAME, + SFG_currentLevel.itemRecordCount); + ++i) + { + SFG_ItemRecord item = + SFG_currentLevel.itemRecords[SFG_currentLevel.checkedItemIndex]; + + item &= ~SFG_ITEM_RECORD_ACTIVE_MASK; + + SFG_LevelElement e = + SFG_currentLevel.levelPointer->elements[item]; + + if ( + SFG_isInActiveDistanceFromPlayer( + e.coords[0] * RCL_UNITS_PER_SQUARE + RCL_UNITS_PER_SQUARE / 2, + e.coords[1] * RCL_UNITS_PER_SQUARE + RCL_UNITS_PER_SQUARE / 2, + SFG_floorHeightAt(e.coords[0],e.coords[1]) + RCL_UNITS_PER_SQUARE / 2) + ) + item |= SFG_ITEM_RECORD_ACTIVE_MASK; + + SFG_currentLevel.itemRecords[SFG_currentLevel.checkedItemIndex] = item; + + SFG_currentLevel.checkedItemIndex++; + + if (SFG_currentLevel.checkedItemIndex >= SFG_currentLevel.itemRecordCount) + SFG_currentLevel.checkedItemIndex = 0; + } + } + + // similarly handle monsters: + if (SFG_currentLevel.monsterRecordCount > 0) // has to be here + { + // check monster distances: + + for (uint16_t i = 0; + i < RCL_min(SFG_ELEMENT_DISTANCES_CHECKED_PER_FRAME, + SFG_currentLevel.monsterRecordCount); + ++i) + { + SFG_MonsterRecord *monster = + &(SFG_currentLevel.monsterRecords[SFG_currentLevel.checkedMonsterIndex]); + + if ( // far away from the player? + !SFG_isInActiveDistanceFromPlayer( + SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[0]), + SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[1]), + SFG_floorHeightAt( + SFG_MONSTER_COORD_TO_SQUARES(monster->coords[0]), + SFG_MONSTER_COORD_TO_SQUARES(monster->coords[1])) + + RCL_UNITS_PER_SQUARE / 2 + ) + ) + { + monster->stateType = + (monster->stateType & SFG_MONSTER_MASK_TYPE) | + SFG_MONSTER_STATE_INACTIVE; + } + else if (SFG_MR_STATE(*monster) == SFG_MONSTER_STATE_INACTIVE) + { + monster->stateType = + (monster->stateType & SFG_MONSTER_MASK_TYPE) | + (monster->health != 0 ? + SFG_MONSTER_STATE_IDLE : SFG_MONSTER_STATE_DEAD); + } + + SFG_currentLevel.checkedMonsterIndex++; + + if (SFG_currentLevel.checkedMonsterIndex >= + SFG_currentLevel.monsterRecordCount) + SFG_currentLevel.checkedMonsterIndex = 0; + } + } + + // update AI and handle dead monsters: + if ((SFG_game.frame - SFG_currentLevel.frameStart) % + SFG_AI_UPDATE_FRAME_INTERVAL == 0) + { + for (uint16_t i = 0; i < SFG_currentLevel.monsterRecordCount; ++i) + { + SFG_MonsterRecord *monster = &(SFG_currentLevel.monsterRecords[i]); + uint8_t state = SFG_MR_STATE(*monster); + + if ((state == SFG_MONSTER_STATE_INACTIVE) || + (state == SFG_MONSTER_STATE_DEAD)) + continue; + + if (state == SFG_MONSTER_STATE_DYING) + { + if (SFG_MR_TYPE(*monster) == SFG_LEVEL_ELEMENT_MONSTER_ENDER) + { + SFG_currentLevel.bossCount--; + + // last boss killed gives player a key card + + if (SFG_currentLevel.bossCount == 0) + { + SFG_LOG("boss killed, giving player a card"); + SFG_player.cards |= 0x04; + } + } + + monster->stateType = + (monster->stateType & 0xf0) | SFG_MONSTER_STATE_DEAD; + } + else if (monster->health == 0) + { + monster->stateType = (monster->stateType & SFG_MONSTER_MASK_TYPE) | + SFG_MONSTER_STATE_DYING; + + SFG_processEvent(SFG_EVENT_MONSTER_DIES,SFG_MR_TYPE(*monster)); + + if (SFG_MR_TYPE(*monster) == SFG_LEVEL_ELEMENT_MONSTER_EXPLODER) + SFG_createExplosion( + SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[0]), + SFG_MONSTER_COORD_TO_RCL_UNITS(monster->coords[1]), + SFG_floorCollisionHeightAt( + SFG_MONSTER_COORD_TO_SQUARES(monster->coords[0]), + SFG_MONSTER_COORD_TO_SQUARES(monster->coords[0])) + + RCL_UNITS_PER_SQUARE / 2); + } + else + { +#if SFG_PREVIEW_MODE == 0 + SFG_monsterPerformAI(monster); +#endif + } + } + } +} + +/** + Maps square position on the map to a bit in map reveal mask. +*/ +static inline uint16_t SFG_getMapRevealBit(uint8_t squareX, uint8_t squareY) +{ + return 1 << ((squareY / 16) * 4 + squareX / 16); +} + +/** + Checks a 3D point visibility from player's position (WITHOUT considering + facing direction). +*/ +static inline uint8_t SFG_spriteIsVisible(RCL_Vector2D pos, RCL_Unit height, + uint8_t spriteSize) +{ + return + RCL_castRay3D( + SFG_player.camera.position, + SFG_player.camera.height, + pos, + height, + SFG_floorHeightAt, + SFG_ceilingHeightAt, + SFG_game.rayConstraints + ) == RCL_UNITS_PER_SQUARE; +} + +/** + Returns a tangent in RCL_Unit of vertical autoaim, given current game state. +*/ +RCL_Unit SFG_autoaimVertically() +{ + for (uint16_t i = 0; i < SFG_currentLevel.monsterRecordCount; ++i) + { + SFG_MonsterRecord m = SFG_currentLevel.monsterRecords[i]; + + if (SFG_MR_STATE(m) == SFG_MONSTER_STATE_INACTIVE) + continue; + + RCL_Vector2D worldPosition, toMonster; + + worldPosition.x = SFG_MONSTER_COORD_TO_RCL_UNITS(m.coords[0]); + worldPosition.y = SFG_MONSTER_COORD_TO_RCL_UNITS(m.coords[1]); + + toMonster.x = worldPosition.x - SFG_player.camera.position.x; + toMonster.y = worldPosition.y - SFG_player.camera.position.y; + + if (RCL_abs( + RCL_vectorsAngleCos(SFG_player.direction,toMonster) + - RCL_UNITS_PER_SQUARE) < SFG_VERTICAL_AUTOAIM_ANGLE_THRESHOLD) + { + uint8_t spriteSize = SFG_GET_MONSTER_SPRITE_SIZE( + SFG_MONSTER_TYPE_TO_INDEX(SFG_MR_TYPE(m))); + + RCL_Unit worldHeight = + SFG_floorHeightAt( + SFG_MONSTER_COORD_TO_SQUARES(m.coords[0]), + SFG_MONSTER_COORD_TO_SQUARES(m.coords[1])) + + + SFG_SPRITE_SIZE_TO_HEIGHT_ABOVE_GROUND(spriteSize); + + if (SFG_spriteIsVisible(worldPosition,worldHeight,spriteSize)) + { + RCL_Unit distance = RCL_len(toMonster); + + return ((worldHeight - SFG_player.camera.height) * RCL_UNITS_PER_SQUARE) + / distance; + } + } + } + + return 0; +} + +/** + Draws text on screen using the bitmap font stored in assets. +*/ +void SFG_drawText( + const char *text, + uint16_t x, + uint16_t y, + uint8_t size, + uint8_t color, + uint16_t maxLength, + uint16_t limitX) +{ + if (size == 0) + size = 1; + + if (limitX == 0) + limitX = 65535; + + if (maxLength == 0) + maxLength = 65535; + + uint16_t pos = 0; + + uint16_t currentX = x; + uint16_t currentY = y; + + while (text[pos] != 0 && pos < maxLength) // for each character + { + uint16_t character = SFG_font[SFG_charToFontIndex(text[pos])]; + + for (uint8_t i = 0; i < SFG_FONT_CHARACTER_SIZE; ++i) // for each line + { + currentY = y; + + for (uint8_t j = 0; j < SFG_FONT_CHARACTER_SIZE; ++j) // for each row + { + if (character & 0x8000) + for (uint8_t k = 0; k < size; ++k) + for (uint8_t l = 0; l < size; ++l) + { + uint16_t drawX = currentX + k; + uint16_t drawY = currentY + l; + + if (drawX < SFG_GAME_RESOLUTION_X && + drawY < SFG_GAME_RESOLUTION_Y) + SFG_setGamePixel(drawX,drawY,color); + } + + currentY += size; + character = character << 1; + } + + currentX += size; + } + + currentX += size; // space + + if (currentX > limitX) + { + currentX = x; + y += (SFG_FONT_CHARACTER_SIZE + 1) * size; + } + + pos++; + } +} + +void SFG_drawLevelStartOverlay() +{ + uint8_t stage = ((SFG_game.frameTime - SFG_game.stateChangeTime) * 4) / + SFG_LEVEL_START_DURATION; + + // fade in: + + for (uint16_t y = 0; y < SFG_GAME_RESOLUTION_Y; ++y) + for (uint16_t x = 0; x < SFG_GAME_RESOLUTION_X; ++x) + { + uint8_t draw = 0; + + switch (stage) + { + case 0: draw = 1; break; + case 1: draw = (x % 2) || (y % 2); break; + case 2: draw = (x % 2) == (y % 2); break; + case 3: draw = (x % 2) && (y % 2); break; + default: break; + } + + if (draw) + SFG_setGamePixel(x,y,0); + } + + if (SFG_game.saved == 1) + SFG_drawText(SFG_TEXT_SAVED,SFG_HUD_MARGIN,SFG_HUD_MARGIN, + SFG_FONT_SIZE_MEDIUM,7,255,0); +} + +/** + Sets player's height to match the floor height below him. +*/ +void SFG_updatePlayerHeight() +{ + SFG_player.camera.height = + SFG_floorCollisionHeightAt( + SFG_player.squarePosition[0],SFG_player.squarePosition[1]) + + RCL_CAMERA_COLL_HEIGHT_BELOW; +} + +/** + Part of SFG_gameStep() for SFG_GAME_STATE_PLAYING. +*/ +void SFG_gameStepPlaying() +{ + if ( + (SFG_keyIsDown(SFG_KEY_C) && SFG_keyIsDown(SFG_KEY_DOWN)) || + SFG_keyIsDown(SFG_KEY_MENU)) + { + SFG_setGameState(SFG_GAME_STATE_MENU); + SFG_playGameSound(3,SFG_MENU_CLICK_VOLUME); + return; + } + + SFG_updateLevel(); + + int8_t recomputeDirection = SFG_currentLevel.frameStart == SFG_game.frame; + + RCL_Vector2D moveOffset; + + moveOffset.x = 0; + moveOffset.y = 0; + + int8_t strafe = 0; + + uint8_t currentWeapon = SFG_player.weapon; + +#if SFG_HEADBOB_ENABLED + int8_t bobbing = 0; +#endif + + int8_t shearing = 0; + + if (SFG_player.weaponCooldownFrames > 0) + SFG_player.weaponCooldownFrames--; + + if (SFG_keyJustPressed(SFG_KEY_TOGGLE_FREELOOK)) + SFG_game.settings = (SFG_game.settings & 0x04) ? + (SFG_game.settings & ~0x0c) : (SFG_game.settings | 0x0c ); + + int8_t canSwitchWeapon = SFG_player.weaponCooldownFrames == 0; + + if (SFG_keyJustPressed(SFG_KEY_NEXT_WEAPON) && canSwitchWeapon) + SFG_playerRotateWeapon(1); + else if (SFG_keyJustPressed(SFG_KEY_PREVIOUS_WEAPON) && canSwitchWeapon) + SFG_playerRotateWeapon(0); + + uint8_t shearingOn = SFG_game.settings & 0x04; + + if (SFG_keyIsDown(SFG_KEY_A)) + { + if (shearingOn) // A + U/D: shearing (if on) + { + if (SFG_keyIsDown(SFG_KEY_UP)) + { + SFG_player.camera.shear = + RCL_min(SFG_CAMERA_MAX_SHEAR_PIXELS, + SFG_player.camera.shear + SFG_CAMERA_SHEAR_STEP_PER_FRAME); + + shearing = 1; + } + else if (SFG_keyIsDown(SFG_KEY_DOWN)) + { + SFG_player.camera.shear = + RCL_max(-1 * SFG_CAMERA_MAX_SHEAR_PIXELS, + SFG_player.camera.shear - SFG_CAMERA_SHEAR_STEP_PER_FRAME); + + shearing = 1; + } + } + + if (!SFG_keyIsDown(SFG_KEY_C)) + { // A + L/R: strafing + if (SFG_keyIsDown(SFG_KEY_LEFT)) + strafe = -1; + else if (SFG_keyIsDown(SFG_KEY_RIGHT)) + strafe = 1; + } + } + + if (SFG_keyIsDown(SFG_KEY_C)) // C + AL/BR: weapon switching + { + if ((SFG_keyJustPressed(SFG_KEY_LEFT) || SFG_keyJustPressed(SFG_KEY_A)) && + canSwitchWeapon) + SFG_playerRotateWeapon(0); + else if ( + (SFG_keyJustPressed(SFG_KEY_RIGHT) || SFG_keyJustPressed(SFG_KEY_B)) && + canSwitchWeapon) + SFG_playerRotateWeapon(1); + } + else if (!SFG_keyIsDown(SFG_KEY_A)) // L/R: turning + { + if (SFG_keyIsDown(SFG_KEY_LEFT)) + { + SFG_player.camera.direction -= SFG_PLAYER_TURN_UNITS_PER_FRAME; + recomputeDirection = 1; + } + else if (SFG_keyIsDown(SFG_KEY_RIGHT)) + { + SFG_player.camera.direction += SFG_PLAYER_TURN_UNITS_PER_FRAME; + recomputeDirection = 1; + } + } + + if (!SFG_keyIsDown(SFG_KEY_A) || !shearingOn) // U/D: movement + { + if (SFG_keyIsDown(SFG_KEY_UP)) + { + moveOffset.x += SFG_player.direction.x; + moveOffset.y += SFG_player.direction.y; +#if SFG_HEADBOB_ENABLED + bobbing = 1; +#endif + } + else if (SFG_keyIsDown(SFG_KEY_DOWN)) + { + moveOffset.x -= SFG_player.direction.x; + moveOffset.y -= SFG_player.direction.y; +#if SFG_HEADBOB_ENABLED + bobbing = 1; +#endif + } + } + + int16_t mouseX = 0, mouseY = 0; + + SFG_getMouseOffset(&mouseX,&mouseY); + + if (mouseX != 0) // mouse turning + { + SFG_player.camera.direction += + (mouseX * SFG_MOUSE_SENSITIVITY_HORIZONTAL) / 128; + + recomputeDirection = 1; + } + + if ((mouseY != 0) && shearingOn) // mouse shearing + SFG_player.camera.shear = + RCL_max(RCL_min( + SFG_player.camera.shear - + (mouseY * SFG_MOUSE_SENSITIVITY_VERTICAL) / 128, + SFG_CAMERA_MAX_SHEAR_PIXELS), + -1 * SFG_CAMERA_MAX_SHEAR_PIXELS); + + if (recomputeDirection) + SFG_recomputePLayerDirection(); + + if (SFG_keyIsDown(SFG_KEY_STRAFE_LEFT)) + strafe = -1; + else if (SFG_keyIsDown(SFG_KEY_STRAFE_RIGHT)) + strafe = 1; + + if (strafe != 0) + { + moveOffset.x += strafe * SFG_player.direction.y; + moveOffset.y -= strafe * SFG_player.direction.x; + } + +#if SFG_PREVIEW_MODE + if (SFG_keyIsDown(SFG_KEY_B)) + SFG_player.verticalSpeed = SFG_PLAYER_MOVE_UNITS_PER_FRAME; + else if (SFG_keyIsDown(SFG_KEY_C)) + SFG_player.verticalSpeed = -1 * SFG_PLAYER_MOVE_UNITS_PER_FRAME; + else + SFG_player.verticalSpeed = 0; +#else + RCL_Unit verticalOffset = + ( + ( + SFG_keyIsDown(SFG_KEY_JUMP) || + (SFG_keyIsDown(SFG_KEY_UP) && SFG_keyIsDown(SFG_KEY_C)) + ) && + (SFG_player.verticalSpeed == 0) && + (SFG_player.previousVerticalSpeed == 0)) ? + SFG_PLAYER_JUMP_OFFSET_PER_FRAME : // jump + (SFG_player.verticalSpeed - SFG_GRAVITY_SPEED_INCREASE_PER_FRAME); +#endif + + if (!shearing && SFG_player.camera.shear != 0 && !(SFG_game.settings & 0x08)) + { + // gradually shear back to zero + + SFG_player.camera.shear = + (SFG_player.camera.shear > 0) ? + RCL_max(0,SFG_player.camera.shear - SFG_CAMERA_SHEAR_STEP_PER_FRAME) : + RCL_min(0,SFG_player.camera.shear + SFG_CAMERA_SHEAR_STEP_PER_FRAME); + } + +#if SFG_HEADBOB_ENABLED && !SFG_PREVIEW_MODE + if (bobbing) + { + SFG_player.headBobFrame += SFG_HEADBOB_FRAME_INCREASE_PER_FRAME; + } + else if (SFG_player.headBobFrame != 0) + { + // smoothly stop bobbing + + uint8_t quadrant = (SFG_player.headBobFrame % RCL_UNITS_PER_SQUARE) / + (RCL_UNITS_PER_SQUARE / 4); + + /* When in quadrant in which sin is going away from zero, switch to the + same value of the next quadrant, so that bobbing starts to go towards + zero immediately. */ + + if (quadrant % 2 == 0) + SFG_player.headBobFrame = + ((quadrant + 1) * RCL_UNITS_PER_SQUARE / 4) + + (RCL_UNITS_PER_SQUARE / 4 - SFG_player.headBobFrame % + (RCL_UNITS_PER_SQUARE / 4)); + + RCL_Unit currentFrame = SFG_player.headBobFrame; + RCL_Unit nextFrame = SFG_player.headBobFrame + 16; + + // only stop bobbing when we pass a frame at which sin crosses zero + SFG_player.headBobFrame = + (currentFrame / (RCL_UNITS_PER_SQUARE / 2) == + nextFrame / (RCL_UNITS_PER_SQUARE / 2)) ? + nextFrame : 0; + } +#endif + + RCL_Unit previousHeight = SFG_player.camera.height; + + // handle player collision with level elements: + + // monsters: + for (uint16_t i = 0; i < SFG_currentLevel.monsterRecordCount; ++i) + { + SFG_MonsterRecord *m = &(SFG_currentLevel.monsterRecords[i]); + + uint8_t state = SFG_MR_STATE(*m); + + if (state == SFG_MONSTER_STATE_INACTIVE || state == SFG_MONSTER_STATE_DEAD) + continue; + + RCL_Vector2D mPos; + + mPos.x = SFG_MONSTER_COORD_TO_RCL_UNITS(m->coords[0]); + mPos.y = SFG_MONSTER_COORD_TO_RCL_UNITS(m->coords[1]); + + if ( + SFG_elementCollides( + SFG_player.camera.position.x, + SFG_player.camera.position.y, + SFG_player.camera.height, + mPos.x, + mPos.y, + SFG_floorHeightAt( + SFG_MONSTER_COORD_TO_SQUARES(m->coords[0]), + SFG_MONSTER_COORD_TO_SQUARES(m->coords[1])) + ) + ) + { + moveOffset = SFG_resolveCollisionWithElement( + SFG_player.camera.position,moveOffset,mPos); + } + } + + uint8_t collidesWithTeleport = 0; + + /* item collisions with player (only those that don't stop player's movement, + as those are handled differently, via itemCollisionMap): */ + for (int16_t i = 0; i < SFG_currentLevel.itemRecordCount; ++i) + // ^ has to be int16_t (signed) + { + if (!(SFG_currentLevel.itemRecords[i] & SFG_ITEM_RECORD_ACTIVE_MASK)) + continue; + + const SFG_LevelElement *e = SFG_getActiveItemElement(i); + + if (e != 0) + { + RCL_Vector2D ePos; + + ePos.x = SFG_ELEMENT_COORD_TO_RCL_UNITS(e->coords[0]); + ePos.y = SFG_ELEMENT_COORD_TO_RCL_UNITS(e->coords[1]); + + if (!SFG_itemCollides(e->type) && + SFG_elementCollides( + SFG_player.camera.position.x, + SFG_player.camera.position.y, + SFG_player.camera.height, + ePos.x, + ePos.y, + SFG_floorHeightAt(e->coords[0],e->coords[1])) + ) + { + uint8_t eliminate = 1; + + uint8_t onlyKnife = 1; + + for (uint8_t i = 0; i < SFG_AMMO_TOTAL; ++i) + if (SFG_player.ammo[i] != 0) + { + onlyKnife = 0; + break; + } + + switch (e->type) + { + case SFG_LEVEL_ELEMENT_HEALTH: + if (SFG_player.health < SFG_PLAYER_MAX_HEALTH) + SFG_playerChangeHealth(SFG_HEALTH_KIT_VALUE); + else + eliminate = 0; + break; + +#define addAmmo(type) \ + if (SFG_player.ammo[SFG_AMMO_##type] < SFG_AMMO_MAX_##type) \ + {\ + SFG_player.ammo[SFG_AMMO_##type] = RCL_min(SFG_AMMO_MAX_##type,\ + SFG_player.ammo[SFG_AMMO_##type] + SFG_AMMO_INCREASE_##type);\ + if (onlyKnife) SFG_playerRotateWeapon(1); \ + }\ + else\ + eliminate = 0; + + case SFG_LEVEL_ELEMENT_BULLETS: + addAmmo(BULLETS) + break; + + case SFG_LEVEL_ELEMENT_ROCKETS: + addAmmo(ROCKETS) + break; + + case SFG_LEVEL_ELEMENT_PLASMA: + addAmmo(PLASMA) + break; + +#undef addAmmo + + case SFG_LEVEL_ELEMENT_CARD0: + case SFG_LEVEL_ELEMENT_CARD1: + case SFG_LEVEL_ELEMENT_CARD2: + SFG_player.cards |= 1 << (e->type - SFG_LEVEL_ELEMENT_CARD0); + break; + + case SFG_LEVEL_ELEMENT_TELEPORT: + collidesWithTeleport = 1; + eliminate = 0; + break; + + case SFG_LEVEL_ELEMENT_FINISH: + SFG_levelEnds(); + SFG_setGameState(SFG_GAME_STATE_WIN); + SFG_playGameSound(2,255); + SFG_processEvent(SFG_EVENT_VIBRATE,0); + SFG_processEvent( + SFG_EVENT_LEVEL_WON,SFG_currentLevel.levelNumber + 1); + eliminate = 0; + break; + + default: + eliminate = 0; + break; + } + + if (eliminate) // take the item + { +#if !SFG_PREVIEW_MODE + SFG_removeItem(i); + SFG_player.lastItemTakenFrame = SFG_game.frame; + i--; + SFG_playGameSound(3,255); + SFG_processEvent(SFG_EVENT_PLAYER_TAKES_ITEM,e->type); +#endif + } + else if ( + e->type == SFG_LEVEL_ELEMENT_TELEPORT && + SFG_currentLevel.teleportCount > 1 && + !SFG_player.justTeleported) + { + // teleport to random destination teleport + + uint8_t teleportNumber = + SFG_random() % (SFG_currentLevel.teleportCount - 1) + 1; + + for (uint16_t j = 0; j < SFG_currentLevel.itemRecordCount; ++j) + { + SFG_LevelElement e2 = + SFG_currentLevel.levelPointer->elements + [SFG_currentLevel.itemRecords[j] & + ~SFG_ITEM_RECORD_ACTIVE_MASK]; + + if ((e2.type == SFG_LEVEL_ELEMENT_TELEPORT) && (j != i)) + teleportNumber--; + + if (teleportNumber == 0) + { + SFG_player.camera.position.x = + SFG_ELEMENT_COORD_TO_RCL_UNITS(e2.coords[0]); + + SFG_player.camera.position.y = + SFG_ELEMENT_COORD_TO_RCL_UNITS(e2.coords[1]); + + SFG_player.camera.height = + SFG_floorHeightAt(e2.coords[0],e2.coords[1]) + + RCL_CAMERA_COLL_HEIGHT_BELOW; + + SFG_currentLevel.itemRecords[j] |= SFG_ITEM_RECORD_ACTIVE_MASK; + /* ^ we have to make the new teleport immediately active so + that it will immediately collide */ + + SFG_player.justTeleported = 1; + + SFG_playGameSound(4,255); + SFG_processEvent(SFG_EVENT_PLAYER_TELEPORTS,0); + + break; + } + } + } + } + } + } // item collision check + + if (!collidesWithTeleport) + SFG_player.justTeleported = 0; + +#if SFG_PREVIEW_MODE + SFG_player.camera.position.x += + SFG_PREVIEW_MODE_SPEED_MULTIPLIER * moveOffset.x; + + SFG_player.camera.position.y += + SFG_PREVIEW_MODE_SPEED_MULTIPLIER * moveOffset.y; + + SFG_player.camera.height += + SFG_PREVIEW_MODE_SPEED_MULTIPLIER * SFG_player.verticalSpeed; +#else + RCL_moveCameraWithCollision(&(SFG_player.camera),moveOffset, + verticalOffset,SFG_floorCollisionHeightAt,SFG_ceilingHeightAt,1,1); + + SFG_player.previousVerticalSpeed = SFG_player.verticalSpeed; + + RCL_Unit limit = RCL_max(RCL_max(0,verticalOffset),SFG_player.verticalSpeed); + + SFG_player.verticalSpeed = + RCL_min(limit,SFG_player.camera.height - previousHeight); + /* ^ By "limit" we assure height increase caused by climbing a step doesn't + add vertical velocity. */ +#endif + +#if SFG_PREVIEW_MODE == 0 + if ( + SFG_keyIsDown(SFG_KEY_B) && + !SFG_keyIsDown(SFG_KEY_C) && + (SFG_player.weaponCooldownFrames == 0)) + { + /* Player attack/shoot/fire, this has to be done AFTER the player is moved, + otherwise he could shoot himself while running forward. */ + + uint8_t ammo, projectileCount, canShoot; + + SFG_getPlayerWeaponInfo(&ammo,&projectileCount,&canShoot); + + if (canShoot) + { + uint8_t sound; + + switch (SFG_player.weapon) + { + case SFG_WEAPON_KNIFE: sound = 255; break; + case SFG_WEAPON_ROCKET_LAUNCHER: + case SFG_WEAPON_SHOTGUN: sound = 2; break; + case SFG_WEAPON_PLASMAGUN: + case SFG_WEAPON_SOLUTION: sound = 4; break; + default: sound = 0; break; + } + + if (sound != 255) + SFG_playGameSound(sound,255); + + if (ammo != SFG_AMMO_NONE) + SFG_player.ammo[ammo] -= projectileCount; + + uint8_t projectile; + + switch (SFG_GET_WEAPON_FIRE_TYPE(SFG_player.weapon)) + { + case SFG_WEAPON_FIRE_TYPE_PLASMA: + projectile = SFG_PROJECTILE_PLASMA; + break; + + case SFG_WEAPON_FIRE_TYPE_FIREBALL: + projectile = SFG_PROJECTILE_FIREBALL; + break; + + case SFG_WEAPON_FIRE_TYPE_BULLET: + projectile = SFG_PROJECTILE_BULLET; + break; + + case SFG_WEAPON_FIRE_TYPE_MELEE: + projectile = SFG_PROJECTILE_NONE; + break; + + default: + projectile = 255; + break; + } + + if (projectile != SFG_PROJECTILE_NONE) + { + uint16_t angleAdd = SFG_PROJECTILE_SPREAD_ANGLE / (projectileCount + 1); + + RCL_Unit direction = + (SFG_player.camera.direction - SFG_PROJECTILE_SPREAD_ANGLE / 2) + + angleAdd; + + RCL_Unit projectileSpeed = SFG_GET_PROJECTILE_SPEED_UPS(projectile); + + /* Vertical speed will be either determined by autoaim (if shearing is + off) or the camera shear value. */ + RCL_Unit verticalSpeed = (SFG_game.settings & 0x04) ? + (SFG_player.camera.shear * projectileSpeed * 2) / // only approximate + SFG_CAMERA_MAX_SHEAR_PIXELS + : + (projectileSpeed * SFG_autoaimVertically()) / RCL_UNITS_PER_SQUARE; + + for (uint8_t i = 0; i < projectileCount; ++i) + { + SFG_launchProjectile( + projectile, + SFG_player.camera.position, + SFG_player.camera.height, + RCL_angleToDirection(direction), + verticalSpeed, + SFG_PROJECTILE_SPAWN_OFFSET + ); + + direction += angleAdd; + } + } + else + { + // player's melee attack + + for (uint16_t i = 0; i < SFG_currentLevel.monsterRecordCount; ++i) + { + SFG_MonsterRecord *m = &(SFG_currentLevel.monsterRecords[i]); + + uint8_t state = SFG_MR_STATE(*m); + + if ((state == SFG_MONSTER_STATE_INACTIVE) || + (state == SFG_MONSTER_STATE_DEAD)) + continue; + + RCL_Unit pX, pY, pZ; + SFG_getMonsterWorldPosition(m,&pX,&pY,&pZ); + + if (SFG_taxicabDistance(pX,pY,pZ, + SFG_player.camera.position.x, + SFG_player.camera.position.y, + SFG_player.camera.height) > SFG_MELEE_RANGE) + continue; + + RCL_Vector2D toMonster; + + toMonster.x = pX - SFG_player.camera.position.x; + toMonster.y = pY - SFG_player.camera.position.y; + + if (RCL_vectorsAngleCos(SFG_player.direction,toMonster) >= + (RCL_UNITS_PER_SQUARE - SFG_PLAYER_MELEE_ANGLE)) + { + SFG_monsterChangeHealth(m, + -1 * SFG_getDamageValue(SFG_WEAPON_FIRE_TYPE_MELEE)); + + SFG_createDust(pX,pY,pZ); + + break; + } + } + } + + SFG_player.weaponCooldownFrames = + RCL_max( + SFG_GET_WEAPON_FIRE_COOLDOWN_FRAMES(SFG_player.weapon), + SFG_MIN_WEAPON_COOLDOWN_FRAMES); + + SFG_getPlayerWeaponInfo(&ammo,&projectileCount,&canShoot); + + if (!canShoot) + { + // No more ammo, switch to the second strongest weapon. + + SFG_playerRotateWeapon(1); + + uint8_t previousWeapon = SFG_player.weapon; + + SFG_playerRotateWeapon(0); + + if (previousWeapon > SFG_player.weapon) + SFG_playerRotateWeapon(1); + } + } // endif: has enough ammo? + } // attack +#endif // SFG_PREVIEW_MODE == 0 + + SFG_player.squarePosition[0] = + SFG_player.camera.position.x / RCL_UNITS_PER_SQUARE; + + SFG_player.squarePosition[1] = + SFG_player.camera.position.y / RCL_UNITS_PER_SQUARE; + + SFG_currentLevel.mapRevealMask |= + SFG_getMapRevealBit( + SFG_player.squarePosition[0], + SFG_player.squarePosition[1]); + + if ( // squeezer check + (SFG_ceilingHeightAt( + SFG_player.squarePosition[0],SFG_player.squarePosition[1]) - + SFG_floorHeightAt( + SFG_player.squarePosition[0],SFG_player.squarePosition[1])) + < + (RCL_CAMERA_COLL_HEIGHT_ABOVE + RCL_CAMERA_COLL_HEIGHT_BELOW)) + { + SFG_LOG("player is squeezed"); + SFG_player.health = 0; + } + + if (SFG_player.weapon != currentWeapon) // if weapon switched, start cooldown + SFG_player.weaponCooldownFrames = + SFG_GET_WEAPON_FIRE_COOLDOWN_FRAMES(SFG_player.weapon) / 2; + +#if SFG_IMMORTAL == 0 + if (SFG_player.health == 0) + { + SFG_LOG("player dies"); + SFG_levelEnds(); + SFG_processEvent(SFG_EVENT_VIBRATE,0); + SFG_processEvent(SFG_EVENT_PLAYER_DIES,0); + SFG_setGameState(SFG_GAME_STATE_LOSE); + } +#endif +} + +/** + This function defines which items are displayed in the menu. +*/ +uint8_t SFG_getMenuItem(uint8_t index) +{ + uint8_t current = 0; + + while (1) // find first legitimate item + { + if ( // skip non-legitimate items + ((current <= SFG_MENU_ITEM_MAP) && (SFG_currentLevel.levelPointer == 0)) + || ((current == SFG_MENU_ITEM_LOAD) && ((SFG_game.save[0] >> 4) == 0x0f))) + { + current++; + continue; + } + + if (index == 0) + return (current <= (SFG_MENU_ITEM_EXIT - (SFG_CAN_EXIT ? 0 : 1)) + ) ? current : SFG_MENU_ITEM_NONE; + + current++; + index--; + } + + return SFG_MENU_ITEM_NONE; +} + +void SFG_gameStepMenu() +{ + uint8_t menuItems = 0; + + while (SFG_getMenuItem(menuItems) != SFG_MENU_ITEM_NONE) + menuItems++; + + uint8_t item = SFG_getMenuItem(SFG_game.selectedMenuItem); + + if (SFG_keyRegisters(SFG_KEY_DOWN) && + (SFG_game.selectedMenuItem < menuItems - 1)) + { + SFG_game.selectedMenuItem++; + SFG_playGameSound(3,SFG_MENU_CLICK_VOLUME); + } + else if (SFG_keyRegisters(SFG_KEY_UP) && (SFG_game.selectedMenuItem > 0)) + { + SFG_game.selectedMenuItem--; + SFG_playGameSound(3,SFG_MENU_CLICK_VOLUME); + } + else if (SFG_keyJustPressed(SFG_KEY_A)) + { + switch (item) + { + case SFG_MENU_ITEM_PLAY: + for (uint8_t i = 6; i < SFG_SAVE_SIZE; ++i) // reset totals in save + SFG_game.save[i] = 0; + + if (SFG_game.selectedLevel == 0) + SFG_setGameState(SFG_GAME_STATE_INTRO); + else + SFG_setAndInitLevel(SFG_game.selectedLevel); + + break; + + case SFG_MENU_ITEM_LOAD: + { + SFG_gameLoad(); + + uint8_t saveBackup[SFG_SAVE_SIZE]; + + for (uint8_t i = 0; i < SFG_SAVE_SIZE; ++i) + saveBackup[i] = SFG_game.save[i]; + + SFG_setAndInitLevel(SFG_game.save[0] >> 4); + + for (uint8_t i = 0; i < SFG_SAVE_SIZE; ++i) + SFG_game.save[i] = saveBackup[i]; + + SFG_player.health = SFG_game.save[2]; + SFG_player.ammo[0] = SFG_game.save[3]; + SFG_player.ammo[1] = SFG_game.save[4]; + SFG_player.ammo[2] = SFG_game.save[5]; + + SFG_playerRotateWeapon(0); // this chooses weapon with ammo available + break; + } + + case SFG_MENU_ITEM_CONTINUE: + SFG_setGameState(SFG_GAME_STATE_PLAYING); + break; + + case SFG_MENU_ITEM_MAP: + SFG_setGameState(SFG_GAME_STATE_MAP); + break; + + case SFG_MENU_ITEM_SOUND: + SFG_LOG("sound changed"); + + SFG_game.settings = + (SFG_game.settings & ~0x03) | ((SFG_game.settings + 1) & 0x03); + + SFG_playGameSound(3,SFG_MENU_CLICK_VOLUME); + + if ((SFG_game.settings & 0x02) != + ((SFG_game.settings - 1) & 0x02)) + SFG_enableMusic(SFG_game.settings & 0x02); + + SFG_game.save[1] = SFG_game.settings; + SFG_gameSave(); + + break; + + case SFG_MENU_ITEM_SHEAR: + { + uint8_t current = (SFG_game.settings >> 2) & 0x03; + + current++; + + if (current == 2) // option that doesn't make sense, skip + current++; + + SFG_game.settings = + (SFG_game.settings & ~0x0c) | ((current & 0x03) << 2); + + SFG_game.save[1] = SFG_game.settings; + SFG_gameSave(); + + break; + } + + case SFG_MENU_ITEM_EXIT: + SFG_game.continues = 0; + break; + + default: + break; + } + } + else if (item == SFG_MENU_ITEM_PLAY) + { + if (SFG_keyRegisters(SFG_KEY_RIGHT) && + (SFG_game.selectedLevel < (SFG_game.save[0] & 0x0f))) + { + SFG_game.selectedLevel++; + SFG_playGameSound(3,SFG_MENU_CLICK_VOLUME); + } + else if (SFG_keyRegisters(SFG_KEY_LEFT) && SFG_game.selectedLevel > 0) + { + SFG_game.selectedLevel--; + SFG_playGameSound(3,SFG_MENU_CLICK_VOLUME); + } + } +} + +/** + Performs one game step (logic, physics, menu, ...), happening SFG_MS_PER_FRAME + after the previous step. +*/ +void SFG_gameStep() +{ + SFG_game.soundsPlayedThisFrame = 0; + + SFG_game.blink = (SFG_game.frame / SFG_BLINK_PERIOD_FRAMES) % 2; + + for (uint8_t i = 0; i < SFG_KEY_COUNT; ++i) + if (!SFG_keyPressed(i)) + SFG_game.keyStates[i] = 0; + else if (SFG_game.keyStates[i] < 255) + SFG_game.keyStates[i]++; + + if ((SFG_currentLevel.frameStart - SFG_game.frame) % + SFG_SPRITE_ANIMATION_FRAME_DURATION == 0) + SFG_game.spriteAnimationFrame++; + + switch (SFG_game.state) + { + case SFG_GAME_STATE_PLAYING: + SFG_gameStepPlaying(); + break; + + case SFG_GAME_STATE_MENU: + SFG_gameStepMenu(); + break; + + case SFG_GAME_STATE_LOSE: + { + // player die animation (lose) + + SFG_updateLevel(); // let monsters and other things continue moving + SFG_updatePlayerHeight(); // in case player is on elevator + + int32_t t = SFG_game.frameTime - SFG_game.stateChangeTime; + + RCL_Unit h = SFG_floorHeightAt(SFG_player.squarePosition[0], + SFG_player.squarePosition[1]); + + SFG_player.camera.height = + RCL_max(h,h + ((SFG_LOSE_ANIMATION_DURATION - t) * + RCL_CAMERA_COLL_HEIGHT_BELOW) / SFG_LOSE_ANIMATION_DURATION); + + SFG_player.camera.shear = + RCL_min(SFG_CAMERA_MAX_SHEAR_PIXELS / 4, + (t * (SFG_CAMERA_MAX_SHEAR_PIXELS / 4)) / SFG_LOSE_ANIMATION_DURATION); + + if (t > SFG_LOSE_ANIMATION_DURATION && + (SFG_keyIsDown(SFG_KEY_A) || SFG_keyIsDown(SFG_KEY_B))) + { + for (uint8_t i = 6; i < SFG_SAVE_SIZE; ++i) + SFG_game.save[i] = 0; + + SFG_setAndInitLevel(SFG_currentLevel.levelNumber); + } + + break; + } + + case SFG_GAME_STATE_WIN: + { + // win animation + + SFG_updateLevel(); + + int32_t t = SFG_game.frameTime - SFG_game.stateChangeTime; + + if (t > SFG_WIN_ANIMATION_DURATION) + { + if (SFG_currentLevel.levelNumber == (SFG_NUMBER_OF_LEVELS - 1)) + { + if (SFG_keyIsDown(SFG_KEY_A)) + SFG_setGameState(SFG_GAME_STATE_OUTRO); + } + else if (SFG_keyIsDown(SFG_KEY_RIGHT) || + SFG_keyIsDown(SFG_KEY_LEFT)) + { + SFG_setAndInitLevel(SFG_currentLevel.levelNumber + 1); + + SFG_player.health = SFG_game.save[2]; + SFG_player.ammo[0] = SFG_game.save[3]; + SFG_player.ammo[1] = SFG_game.save[4]; + SFG_player.ammo[2] = SFG_game.save[5]; + + if (SFG_keyIsDown(SFG_KEY_RIGHT) && SFG_game.saved != SFG_CANT_SAVE) + { + // save the current position + SFG_gameSave(); + SFG_game.saved = 1; + } + } + } + + break; + } + + case SFG_GAME_STATE_MAP: + if (SFG_keyIsDown(SFG_KEY_B)) + SFG_setGameState(SFG_GAME_STATE_MENU); + + break; + + case SFG_GAME_STATE_INTRO: + if (SFG_keyJustPressed(SFG_KEY_A) || SFG_keyJustPressed(SFG_KEY_B)) + SFG_setAndInitLevel(0); + + break; + + case SFG_GAME_STATE_OUTRO: + if (((SFG_game.frameTime - SFG_game.stateChangeTime) > + SFG_STORYTEXT_DURATION) && (SFG_keyIsDown(SFG_KEY_A) || + SFG_keyIsDown(SFG_KEY_B))) + { + SFG_setGameState(SFG_GAME_STATE_MENU); + SFG_playGameSound(3,SFG_MENU_CLICK_VOLUME); + } + + break; + + case SFG_GAME_STATE_LEVEL_START: + { + SFG_updateLevel(); + SFG_updatePlayerHeight(); // in case player is on elevator + + if (SFG_currentLevel.levelNumber > (SFG_game.save[0] & 0x0f)) + { + SFG_game.save[0] = // save progress + (SFG_game.save[0] & 0xf0) | SFG_currentLevel.levelNumber; + SFG_gameSave(); + } + + int16_t x = 0, y = 0; + + SFG_getMouseOffset(&x,&y); // this keeps centering the mouse + + if ((SFG_game.frameTime - SFG_game.stateChangeTime) >= + SFG_LEVEL_START_DURATION) + SFG_setGameState(SFG_GAME_STATE_PLAYING); + + break; + } + + default: + break; + } +} + +void SFG_fillRectangle( + uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t color) +{ + if ((x + width > SFG_GAME_RESOLUTION_X) || + (y + height > SFG_GAME_RESOLUTION_Y)) + return; + + for (uint16_t j = y; j < y + height; ++j) + for (uint16_t i = x; i < x + width; ++i) + SFG_setGamePixel(i,j,color); +} + +static inline void SFG_clearScreen(uint8_t color) +{ + SFG_fillRectangle(0,0,SFG_GAME_RESOLUTION_X, + SFG_GAME_RESOLUTION_Y,color); +} + +/** + Draws fullscreen map of the current level. +*/ +void SFG_drawMap() +{ + SFG_clearScreen(0); + + uint16_t maxJ = + (SFG_MAP_PIXEL_SIZE * SFG_MAP_SIZE) < SFG_GAME_RESOLUTION_Y ? + (SFG_MAP_SIZE) : (SFG_GAME_RESOLUTION_Y / SFG_MAP_PIXEL_SIZE); + + uint16_t maxI = + (SFG_MAP_PIXEL_SIZE * SFG_MAP_SIZE) < SFG_GAME_RESOLUTION_X ? + (SFG_MAP_SIZE) : (SFG_GAME_RESOLUTION_X / SFG_MAP_PIXEL_SIZE); + + uint16_t topLeftX = + (SFG_GAME_RESOLUTION_X - (maxI * SFG_MAP_PIXEL_SIZE)) / 2; + + uint16_t topLeftY = + (SFG_GAME_RESOLUTION_Y - (maxJ * SFG_MAP_PIXEL_SIZE)) / 2; + + uint16_t x; + uint16_t y = topLeftY; + + uint8_t playerColor = + SFG_game.blink ? SFG_MAP_PLAYER_COLOR1 : SFG_MAP_PLAYER_COLOR2; + + for (int16_t j = 0; j < maxJ; ++j) + { + x = topLeftX; + + for (int16_t i = maxI - 1; i >= 0; --i) + { + uint8_t color = 0; // init with non-revealed color + + if (SFG_currentLevel.mapRevealMask & SFG_getMapRevealBit(i,j)) + { + uint8_t properties; + + SFG_TileDefinition tile = + SFG_getMapTile(SFG_currentLevel.levelPointer,i,j,&properties); + + color = playerColor; // start with player color + + if (i != SFG_player.squarePosition[0] || + j != SFG_player.squarePosition[1]) + { + if (properties == SFG_TILE_PROPERTY_ELEVATOR) + color = SFG_MAP_ELEVATOR_COLOR; + else if (properties == SFG_TILE_PROPERTY_SQUEEZER) + color = SFG_MAP_SQUEEZER_COLOR; + else if (properties == SFG_TILE_PROPERTY_DOOR) + color = SFG_MAP_DOOR_COLOR; + else + { + color = 0; + + uint8_t c = SFG_TILE_CEILING_HEIGHT(tile) / 4; + + if (c != 0) + color = (SFG_TILE_FLOOR_HEIGHT(tile) % 8 + 3) * 8 + c - 1; + } + } + } + + for (int_fast16_t k = 0; k < SFG_MAP_PIXEL_SIZE; ++k) + for (int_fast16_t l = 0; l < SFG_MAP_PIXEL_SIZE; ++l) + SFG_setGamePixel(x + l, y + k,color); + + x += SFG_MAP_PIXEL_SIZE; + } + + y += SFG_MAP_PIXEL_SIZE; + } +} + +/** + Draws fullscreen story text (intro/outro). +*/ +void SFG_drawStoryText() +{ + const char *text = SFG_outroText; + uint16_t textColor = 23; + uint8_t clearColor = 9; + uint8_t sprite = 18; + + if (SFG_currentLevel.levelNumber != (SFG_NUMBER_OF_LEVELS - 1)) // intro? + { + text = SFG_introText; + textColor = 7; + clearColor = 0; + sprite = SFG_game.blink * 2; + } + + SFG_clearScreen(clearColor); + + SFG_blitImage(SFG_monsterSprites + sprite * SFG_TEXTURE_STORE_SIZE, + (SFG_GAME_RESOLUTION_X - SFG_TEXTURE_SIZE * SFG_FONT_SIZE_SMALL) / 2, + SFG_GAME_RESOLUTION_Y - (SFG_TEXTURE_SIZE + 3) * SFG_FONT_SIZE_SMALL, + SFG_FONT_SIZE_SMALL); + + uint16_t textLen = 0; + + while (text[textLen] != 0) + textLen++; + + uint16_t drawLen = + RCL_min(textLen, + ((SFG_game.frameTime - SFG_game.stateChangeTime) * textLen) / + SFG_STORYTEXT_DURATION + 1); + +#define CHAR_SIZE (SFG_FONT_SIZE_SMALL * (SFG_FONT_CHARACTER_SIZE + 1)) +#define LINE_LENGTH (SFG_GAME_RESOLUTION_X / CHAR_SIZE) +#define MAX_LENGTH (((SFG_GAME_RESOLUTION_Y / CHAR_SIZE) / 2) * LINE_LENGTH ) + + uint16_t drawShift = (drawLen < MAX_LENGTH) ? 0 : + (((drawLen - MAX_LENGTH) / LINE_LENGTH) * LINE_LENGTH); + +#undef CHAR_SIZE +#undef LINE_LENGTH +#undef MAX_LENGTH + + text += drawShift; + drawLen -= drawShift; + + SFG_drawText(text,SFG_HUD_MARGIN,SFG_HUD_MARGIN,SFG_FONT_SIZE_SMALL,textColor, + drawLen,SFG_GAME_RESOLUTION_X - SFG_HUD_MARGIN); +} + +/** + Draws a number as text on screen, returns the number of characters drawn. +*/ +uint8_t SFG_drawNumber( + int16_t number, + uint16_t x, + uint16_t y, + uint8_t size, + uint8_t color) +{ + char text[7]; + + text[6] = 0; // terminate the string + + int8_t positive = 1; + + if (number < 0) + { + positive = 0; + number *= -1; + } + + int8_t position = 5; + + while (1) + { + text[position] = '0' + number % 10; + number /= 10; + + position--; + + if (number == 0 || position == 0) + break; + } + + if (!positive) + { + text[position] = '-'; + position--; + } + + SFG_drawText(text + position + 1,x,y,size,color,0,0); + + return 5 - position; +} + +/** + Draws a screen border that indicates something is happening, e.g. being hurt + or taking an item. +*/ +void SFG_drawIndicationBorder(uint16_t width, uint8_t color) +{ + for (int_fast16_t j = 0; j < width; ++j) + { + uint16_t j2 = SFG_GAME_RESOLUTION_Y - 1 - j; + + for (int_fast16_t i = 0; i < SFG_GAME_RESOLUTION_X; ++i) + { + if ((i & 0x01) == (j & 0x01)) + { + SFG_setGamePixel(i,j,color); + SFG_setGamePixel(i,j2,color); + } + } + } + + for (int_fast16_t i = 0; i < width; ++i) + { + uint16_t i2 = SFG_GAME_RESOLUTION_X - 1 - i; + + for (int_fast16_t j = width; j < SFG_GAME_RESOLUTION_Y - width; ++j) + { + if ((i & 0x01) == (j & 0x01)) + { + SFG_setGamePixel(i,j,color); + SFG_setGamePixel(i2,j,color); + } + } + } +} + +/** + Draws the player weapon, includes handling the shoot animation. +*/ +void SFG_drawWeapon(int16_t bobOffset) +{ + uint32_t animationLength = + RCL_max(SFG_MIN_WEAPON_COOLDOWN_FRAMES, + SFG_GET_WEAPON_FIRE_COOLDOWN_FRAMES(SFG_player.weapon)); + + uint32_t shotAnimationFrame = + animationLength - SFG_player.weaponCooldownFrames; + + bobOffset -= SFG_HUD_BAR_HEIGHT; + + uint8_t fireType = SFG_GET_WEAPON_FIRE_TYPE(SFG_player.weapon); + + if (shotAnimationFrame < animationLength) + { + if (fireType == SFG_WEAPON_FIRE_TYPE_MELEE) + { + bobOffset = shotAnimationFrame < animationLength / 2 ? 0 : + 2 * SFG_WEAPONBOB_OFFSET_PIXELS ; + } + else + { + bobOffset += + ((animationLength - shotAnimationFrame) * SFG_WEAPON_IMAGE_SCALE * 20) + / animationLength; + + if ( + ((fireType == SFG_WEAPON_FIRE_TYPE_FIREBALL) || + (fireType == SFG_WEAPON_FIRE_TYPE_BULLET)) && + shotAnimationFrame < animationLength / 2) + SFG_blitImage(SFG_effectSprites, + SFG_WEAPON_IMAGE_POSITION_X, + SFG_WEAPON_IMAGE_POSITION_Y - + (SFG_TEXTURE_SIZE / 3) * SFG_WEAPON_IMAGE_SCALE + bobOffset, + SFG_WEAPON_IMAGE_SCALE); + } + } + + SFG_blitImage(SFG_weaponImages + SFG_player.weapon * SFG_TEXTURE_STORE_SIZE, + SFG_WEAPON_IMAGE_POSITION_X, + SFG_WEAPON_IMAGE_POSITION_Y + bobOffset - 1, + SFG_WEAPON_IMAGE_SCALE); +} + +uint16_t SFG_textLen(const char *text) +{ + uint16_t result = 0; + + while (text[result] != 0) + result++; + + return result; +} + +static inline uint16_t SFG_characterSize(uint8_t textSize) +{ + return (SFG_FONT_CHARACTER_SIZE + 1) * textSize; +} + +static inline uint16_t + SFG_textHorizontalSize(const char *text, uint8_t textSize) +{ + return (SFG_textLen(text) * SFG_characterSize(textSize)); +} + +void SFG_drawMenu() +{ + #define BACKGROUND_SCALE (SFG_GAME_RESOLUTION_X / (4 * SFG_TEXTURE_SIZE ) ) + + #if BACKGROUND_SCALE == 0 + #undef BACKGROUND_SCALE + #define BACKGROUND_SCALE 1 + #endif + + #define SCROLL_PIXELS_PER_FRAME ((64 * SFG_GAME_RESOLUTION_X) / (8 * SFG_FPS)) + + #if SCROLL_PIXELS_PER_FRAME == 0 + #undef SCROLL_PIXELS_PER_FRAME + #define SCROLL_PIXELS_PER_FRAME 1 + #endif + + #define SELECTION_START_X ((SFG_GAME_RESOLUTION_X - 12 * SFG_FONT_SIZE_MEDIUM\ + * (SFG_FONT_CHARACTER_SIZE + 1)) / 2) + + uint16_t scroll = (SFG_game.frame * SCROLL_PIXELS_PER_FRAME) / 64; + + for (uint16_t y = 0; y < SFG_GAME_RESOLUTION_Y; ++y) + for (uint16_t x = 0; x < SFG_GAME_RESOLUTION_X; ++x) + SFG_setGamePixel(x,y, + (y >= (SFG_TEXTURE_SIZE * BACKGROUND_SCALE)) ? 0 : + SFG_getTexel(SFG_backgroundImages,((x + scroll) / BACKGROUND_SCALE) + % SFG_TEXTURE_SIZE,y / BACKGROUND_SCALE)); + + uint16_t y = SFG_characterSize(SFG_FONT_SIZE_MEDIUM); + + SFG_blitImage(SFG_logoImage, + SFG_GAME_RESOLUTION_X / 2 - 16 * SFG_FONT_SIZE_MEDIUM,y, + SFG_FONT_SIZE_MEDIUM); + +#if SFG_GAME_RESOLUTION_Y > 50 + y += 32 * SFG_FONT_SIZE_MEDIUM + SFG_characterSize(SFG_FONT_SIZE_MEDIUM); +#else + y = 2; +#endif + + uint8_t i = 0; + + while (1) // draw menu items + { + uint8_t item = SFG_getMenuItem(i); + + if (item == SFG_MENU_ITEM_NONE) + break; + +#if SFG_GAME_RESOLUTION_Y < 70 + // with low resolution only display the selected item + + if (i != SFG_game.selectedMenuItem) + { + i++; + continue; + } +#endif + + const char *text = SFG_menuItemTexts[item]; + uint8_t textLen = SFG_textLen(text); + + uint16_t drawX = (SFG_GAME_RESOLUTION_X - + SFG_textHorizontalSize(text,SFG_FONT_SIZE_MEDIUM)) / 2; + + uint8_t textColor = 7; + + if (i != SFG_game.selectedMenuItem) + textColor = 23; + else + SFG_fillRectangle( // menu item highlight + SELECTION_START_X, + y - SFG_FONT_SIZE_MEDIUM, + SFG_GAME_RESOLUTION_X - SELECTION_START_X * 2, + SFG_characterSize(SFG_FONT_SIZE_MEDIUM),2); + + SFG_drawText(text,drawX,y,SFG_FONT_SIZE_MEDIUM,textColor,0,0); + + if ((item == SFG_MENU_ITEM_PLAY || item == SFG_MENU_ITEM_SOUND + || item == SFG_MENU_ITEM_SHEAR) && + ((i != SFG_game.selectedMenuItem) || SFG_game.blink)) + { + uint32_t x = + drawX + SFG_characterSize(SFG_FONT_SIZE_MEDIUM) * (textLen + 1); + + uint8_t c = 93; + + if (item == SFG_MENU_ITEM_PLAY) + SFG_drawNumber(SFG_game.selectedLevel + 1,x,y,SFG_FONT_SIZE_MEDIUM,c); + else if (item == SFG_MENU_ITEM_SHEAR) + { + uint8_t n = (SFG_game.settings >> 2) & 0x03; + + SFG_drawNumber(n == 3 ? 2 : n,x,y,SFG_FONT_SIZE_MEDIUM,c); + } + else + { + char settingText[3] = " "; + + settingText[0] = (SFG_game.settings & 0x01) ? 'S' : ' '; + settingText[1] = (SFG_game.settings & 0x02) ? 'M' : ' '; + + SFG_drawText(settingText,x,y,SFG_FONT_SIZE_MEDIUM,c,0,0); + } + } + + y += SFG_characterSize(SFG_FONT_SIZE_MEDIUM) + SFG_FONT_SIZE_MEDIUM; + i++; + } + + SFG_drawText(SFG_VERSION_STRING " CC0",SFG_HUD_MARGIN,SFG_GAME_RESOLUTION_Y - + SFG_HUD_MARGIN - SFG_FONT_SIZE_SMALL * SFG_FONT_CHARACTER_SIZE, + SFG_FONT_SIZE_SMALL,4,0,0); + + #if SFG_OS_IS_MALWARE + if (SFG_game.blink) + SFG_drawText(SFG_MALWARE_WARNING,SFG_HUD_MARGIN,SFG_HUD_MARGIN, + SFG_FONT_SIZE_MEDIUM,95,0,0); + #endif + + #undef MAX_ITEMS + #undef BACKGROUND_SCALE + #undef SCROLL_PIXELS_PER_FRAME +} + +void SFG_drawWinOverlay() +{ + uint32_t t = RCL_min(SFG_WIN_ANIMATION_DURATION, + SFG_game.frameTime - SFG_game.stateChangeTime); + + uint32_t t2 = RCL_min(t,SFG_WIN_ANIMATION_DURATION / 4); + + #define STRIP_HEIGHT (SFG_GAME_RESOLUTION_Y / 2) + #define INNER_STRIP_HEIGHT ((STRIP_HEIGHT * 3) / 4) + #define STRIP_START ((SFG_GAME_RESOLUTION_Y - STRIP_HEIGHT) / 2) + + RCL_Unit l = (t2 * STRIP_HEIGHT * 4) / SFG_WIN_ANIMATION_DURATION; + + for (uint16_t y = STRIP_START; y < STRIP_START + l; ++y) + for (uint16_t x = 0; x < SFG_GAME_RESOLUTION_X; ++x) + SFG_setGamePixel(x,y, + RCL_abs(y - (SFG_GAME_RESOLUTION_Y / 2)) <= (INNER_STRIP_HEIGHT / 2) ? + 0 : 172); + + char textLine[] = "level done"; + + uint16_t y = SFG_GAME_RESOLUTION_Y / 2 - + ((STRIP_HEIGHT + INNER_STRIP_HEIGHT) / 2) / 2; + + uint16_t x = (SFG_GAME_RESOLUTION_X - + SFG_textHorizontalSize(textLine,SFG_FONT_SIZE_BIG)) / 2; + + SFG_drawText(textLine,x,y,SFG_FONT_SIZE_BIG,7 + SFG_game.blink * 95,255,0); + + uint32_t timeTotal = SFG_SAVE_TOTAL_TIME; + + // don't show totals in level 1: + uint8_t blink = (SFG_game.blink) && (SFG_currentLevel.levelNumber != 0) + && (timeTotal != 0); + + if (t >= (SFG_WIN_ANIMATION_DURATION / 2)) + { + y += (SFG_FONT_SIZE_BIG + SFG_FONT_SIZE_MEDIUM) * SFG_FONT_CHARACTER_SIZE; + x = SFG_HUD_MARGIN; + + #define CHAR_SIZE (SFG_FONT_SIZE_SMALL * SFG_FONT_CHARACTER_SIZE) + + uint32_t time = blink ? timeTotal : SFG_currentLevel.completionTime10sOfS; + + x += SFG_drawNumber(time / 10,x,y,SFG_FONT_SIZE_SMALL,7) * + CHAR_SIZE + SFG_FONT_SIZE_SMALL; + + char timeRest[5] = ".X s"; + + timeRest[1] = '0' + (time % 10); + + SFG_drawText(timeRest,x,y,SFG_FONT_SIZE_SMALL,7,4,0); + + x = SFG_HUD_MARGIN; + y += (SFG_FONT_SIZE_BIG + SFG_FONT_SIZE_MEDIUM) * SFG_FONT_CHARACTER_SIZE; + + if (blink) + { + x += (SFG_drawNumber(SFG_game.save[10] + SFG_game.save[11] * 256,x,y, + SFG_FONT_SIZE_SMALL,7) + 1) * CHAR_SIZE; + } + else + { + x += SFG_drawNumber(SFG_currentLevel.monstersDead,x,y, + SFG_FONT_SIZE_SMALL,7) * CHAR_SIZE; + + SFG_drawText("/",x,y,SFG_FONT_SIZE_SMALL,7,1,0); + + x += CHAR_SIZE; + + x += (SFG_drawNumber(SFG_currentLevel.monsterRecordCount,x,y, + SFG_FONT_SIZE_SMALL,7) + 1) * CHAR_SIZE; + } + + SFG_drawText(SFG_TEXT_KILLS,x,y,SFG_FONT_SIZE_SMALL,7,255,0); + + if ((t >= (SFG_WIN_ANIMATION_DURATION - 1)) && + (SFG_currentLevel.levelNumber != (SFG_NUMBER_OF_LEVELS - 1))) + { + y += (SFG_FONT_SIZE_BIG + SFG_FONT_SIZE_MEDIUM) * SFG_FONT_CHARACTER_SIZE; + + SFG_drawText(SFG_TEXT_SAVE_PROMPT, + (SFG_GAME_RESOLUTION_X - SFG_textHorizontalSize(SFG_TEXT_SAVE_PROMPT, + SFG_FONT_SIZE_MEDIUM)) / 2,y,SFG_FONT_SIZE_MEDIUM,7,255,0); + } + + #undef CHAR_SIZE + } + + #undef STRIP_HEIGHT + #undef STRIP_START + #undef INNER_STRIP_HEIGHT +} + +void SFG_draw() +{ +#if SFG_BACKGROUND_BLUR != 0 + SFG_backgroundBlurIndex = 0; +#endif + + if (SFG_game.state == SFG_GAME_STATE_MENU) + { + SFG_drawMenu(); + return; + } + + if (SFG_game.state == SFG_GAME_STATE_INTRO || + SFG_game.state == SFG_GAME_STATE_OUTRO) + { + SFG_drawStoryText(); + return; + } + + if (SFG_keyPressed(SFG_KEY_MAP) || (SFG_game.state == SFG_GAME_STATE_MAP)) + { + SFG_drawMap(); + } + else + { + for (int_fast16_t i = 0; i < SFG_Z_BUFFER_SIZE; ++i) + SFG_game.zBuffer[i] = 255; + + int16_t weaponBobOffset = 0; + +#if SFG_HEADBOB_ENABLED + RCL_Unit headBobOffset = 0; + +#if SFG_HEADBOB_SHEAR != 0 + int16_t headBobShearOffset; +#endif + + if (SFG_game.state != SFG_GAME_STATE_LOSE) + { + RCL_Unit bobSin = RCL_sin(SFG_player.headBobFrame); + + headBobOffset = (bobSin * SFG_HEADBOB_OFFSET) / RCL_UNITS_PER_SQUARE; + +#if SFG_HEADBOB_SHEAR != 0 + headBobShearOffset = (bobSin * SFG_HEADBOB_SHEAR) / RCL_UNITS_PER_SQUARE; + SFG_player.camera.shear += headBobShearOffset; +#endif + + weaponBobOffset = + (bobSin * SFG_WEAPONBOB_OFFSET_PIXELS) / (RCL_UNITS_PER_SQUARE) + + SFG_WEAPONBOB_OFFSET_PIXELS; + } + else + { + // player die animation + + int32_t t = SFG_game.frameTime - SFG_game.stateChangeTime; + + weaponBobOffset = (SFG_WEAPON_IMAGE_SCALE * SFG_TEXTURE_SIZE * t) / + SFG_LOSE_ANIMATION_DURATION; + } + + // add head bob just for the rendering (we'll will substract it back later) + + SFG_player.camera.height += headBobOffset; +#endif // headbob enabled? + + RCL_renderComplex( + SFG_player.camera, + SFG_floorHeightAt, + SFG_ceilingHeightAt, + SFG_texturesAt, + SFG_game.rayConstraints); + + // draw sprites: + + // monster sprites: + for (int_fast16_t i = 0; i < SFG_currentLevel.monsterRecordCount; ++i) + { + SFG_MonsterRecord m = SFG_currentLevel.monsterRecords[i]; + + uint8_t state = SFG_MR_STATE(m); + + if (state != SFG_MONSTER_STATE_INACTIVE) + { + RCL_Vector2D worldPosition; + + worldPosition.x = SFG_MONSTER_COORD_TO_RCL_UNITS(m.coords[0]); + worldPosition.y = SFG_MONSTER_COORD_TO_RCL_UNITS(m.coords[1]); + + uint8_t spriteSize = SFG_GET_MONSTER_SPRITE_SIZE( + SFG_MONSTER_TYPE_TO_INDEX(SFG_MR_TYPE(m))); + + RCL_Unit worldHeight = + SFG_floorHeightAt( + SFG_MONSTER_COORD_TO_SQUARES(m.coords[0]), + SFG_MONSTER_COORD_TO_SQUARES(m.coords[1])) + + + SFG_SPRITE_SIZE_TO_HEIGHT_ABOVE_GROUND(spriteSize); + + RCL_PixelInfo p = + RCL_mapToScreen(worldPosition,worldHeight,SFG_player.camera); + + if (p.depth > 0 && + SFG_spriteIsVisible(worldPosition,worldHeight,spriteSize)) + { + const uint8_t *s = + SFG_getMonsterSprite( + SFG_MR_TYPE(m), + state, + SFG_game.spriteAnimationFrame & 0x01); + + SFG_drawScaledSprite(s, + p.position.x * SFG_RAYCASTING_SUBSAMPLE,p.position.y, + RCL_perspectiveScaleVertical( + SFG_SPRITE_SIZE_PIXELS(spriteSize), + p.depth), + p.depth / (RCL_UNITS_PER_SQUARE * 2),p.depth); + } + } + } + + // item sprites: + for (int_fast16_t i = 0; i < SFG_currentLevel.itemRecordCount; ++i) + if (SFG_currentLevel.itemRecords[i] & SFG_ITEM_RECORD_ACTIVE_MASK) + { + RCL_Vector2D worldPosition; + + SFG_LevelElement e = + SFG_currentLevel.levelPointer->elements[ + SFG_currentLevel.itemRecords[i] & ~SFG_ITEM_RECORD_ACTIVE_MASK]; + + worldPosition.x = + SFG_ELEMENT_COORD_TO_RCL_UNITS(e.coords[0]); + + worldPosition.y = + SFG_ELEMENT_COORD_TO_RCL_UNITS(e.coords[1]); + + const uint8_t *sprite; + uint8_t spriteSize; + + SFG_getItemSprite(e.type,&sprite,&spriteSize); + + if (sprite != 0) + { + RCL_Unit worldHeight = SFG_floorHeightAt(e.coords[0],e.coords[1]) + + SFG_SPRITE_SIZE_TO_HEIGHT_ABOVE_GROUND(spriteSize); + + RCL_PixelInfo p = + RCL_mapToScreen(worldPosition,worldHeight,SFG_player.camera); + + if (p.depth > 0 && + SFG_spriteIsVisible(worldPosition,worldHeight,spriteSize)) + SFG_drawScaledSprite( + sprite, + p.position.x * SFG_RAYCASTING_SUBSAMPLE,p.position.y, + RCL_perspectiveScaleVertical(SFG_SPRITE_SIZE_PIXELS(spriteSize),p.depth), + p.depth / (RCL_UNITS_PER_SQUARE * 2),p.depth); + } + } + + // projectile sprites: + for (uint8_t i = 0; i < SFG_currentLevel.projectileRecordCount; ++i) + { + SFG_ProjectileRecord *proj = &(SFG_currentLevel.projectileRecords[i]); + + if (proj->type == SFG_PROJECTILE_BULLET) + continue; // bullets aren't drawn + + RCL_Vector2D worldPosition; + + worldPosition.x = proj->position[0]; + worldPosition.y = proj->position[1]; + + RCL_PixelInfo p = + RCL_mapToScreen(worldPosition,proj->position[2],SFG_player.camera); + + const uint8_t *s = + SFG_effectSprites + proj->type * SFG_TEXTURE_STORE_SIZE; + + int16_t spriteSize = SFG_SPRITE_SIZE_PIXELS(0); + + if (proj->type == SFG_PROJECTILE_EXPLOSION || + proj->type == SFG_PROJECTILE_DUST) + { + int16_t doubleFramesToLive = + RCL_nonZero(SFG_GET_PROJECTILE_FRAMES_TO_LIVE(proj->type) / 2); + + // grow the explosion/dust sprite as an animation + spriteSize = + ( + SFG_SPRITE_SIZE_PIXELS(2) * + RCL_sin( + ((doubleFramesToLive - + proj->doubleFramesToLive) * RCL_UNITS_PER_SQUARE / 4) + / doubleFramesToLive) + ) / RCL_UNITS_PER_SQUARE; + } + + if (p.depth > 0 && + SFG_spriteIsVisible(worldPosition,proj->position[2],spriteSize)) + SFG_drawScaledSprite(s, + p.position.x * SFG_RAYCASTING_SUBSAMPLE,p.position.y, + RCL_perspectiveScaleVertical(spriteSize,p.depth), + SFG_fogValueDiminish(p.depth), + p.depth); + } + +#if SFG_HEADBOB_ENABLED + // after rendering sprites substract back the head bob offset + SFG_player.camera.height -= headBobOffset; + +#if SFG_HEADBOB_SHEAR != 0 + SFG_player.camera.shear -= headBobShearOffset; +#endif + +#endif // head bob enabled? + +#if SFG_PREVIEW_MODE == 0 + SFG_drawWeapon(weaponBobOffset); +#endif + + // draw HUD: + + // bar + + uint8_t color = 5; + + for (uint16_t j = SFG_GAME_RESOLUTION_Y - SFG_HUD_BAR_HEIGHT; + j < SFG_GAME_RESOLUTION_Y; ++j) + { + for (uint16_t i = 0; i < SFG_GAME_RESOLUTION_X; ++i) + SFG_setGamePixel(i,j,color); + + color = 2; + } + + #define TEXT_Y (SFG_GAME_RESOLUTION_Y - SFG_HUD_MARGIN - \ + SFG_FONT_CHARACTER_SIZE * SFG_FONT_SIZE_MEDIUM) + + SFG_drawNumber( // health + SFG_player.health, + SFG_HUD_MARGIN, + TEXT_Y, + SFG_FONT_SIZE_MEDIUM, + SFG_player.health > SFG_PLAYER_HEALTH_WARNING_LEVEL ? 4 : 175); + + SFG_drawNumber( // ammo + SFG_player.weapon != SFG_WEAPON_KNIFE ? + SFG_player.ammo[SFG_weaponAmmo(SFG_player.weapon)] : 0, + SFG_GAME_RESOLUTION_X - SFG_HUD_MARGIN - + (SFG_FONT_CHARACTER_SIZE + 1) * SFG_FONT_SIZE_MEDIUM * 3, + TEXT_Y, + SFG_FONT_SIZE_MEDIUM, + 4); + + for (uint8_t i = 0; i < 3; ++i) // access cards + if ( + ((SFG_player.cards >> i) | ((SFG_player.cards >> (i + 3)) + & SFG_game.blink)) & 0x01) + SFG_fillRectangle( + SFG_HUD_MARGIN + (SFG_FONT_CHARACTER_SIZE + 1) * + SFG_FONT_SIZE_MEDIUM * (5 + i), + TEXT_Y, + SFG_FONT_SIZE_MEDIUM * SFG_FONT_CHARACTER_SIZE, + SFG_FONT_SIZE_MEDIUM * SFG_FONT_CHARACTER_SIZE, + i == 0 ? 93 : (i == 1 ? 124 : 60)); + + #undef TEXT_Y + + // border indicator + + if ((SFG_game.frame - SFG_player.lastHurtFrame + <= SFG_HUD_BORDER_INDICATOR_DURATION_FRAMES) || + (SFG_game.state == SFG_GAME_STATE_LOSE)) + SFG_drawIndicationBorder(SFG_HUD_BORDER_INDICATOR_WIDTH_PIXELS, + SFG_HUD_HURT_INDICATION_COLOR); + else if (SFG_game.frame - SFG_player.lastItemTakenFrame + <= SFG_HUD_BORDER_INDICATOR_DURATION_FRAMES) + SFG_drawIndicationBorder(SFG_HUD_BORDER_INDICATOR_WIDTH_PIXELS, + SFG_HUD_ITEM_TAKEN_INDICATION_COLOR); + + if (SFG_game.state == SFG_GAME_STATE_WIN) + SFG_drawWinOverlay(); + else if (SFG_game.state == SFG_GAME_STATE_LEVEL_START) + SFG_drawLevelStartOverlay(); + } +} + +uint8_t SFG_mainLoopBody() +{ + /* Standard deterministic game loop, independed of actual achieved FPS. + Each game logic (physics) frame is performed with the SFG_MS_PER_FRAME + delta time. */ + uint32_t timeNow = SFG_getTimeMs(); + uint32_t timeNextFrame = SFG_game.lastFrameTimeMs + SFG_MS_PER_FRAME; + + SFG_game.frameTime = timeNow; + + if (timeNow >= timeNextFrame) + { + uint32_t timeSinceLastFrame = timeNow - SFG_game.lastFrameTimeMs; + + uint8_t steps = 0; + + uint8_t previousWeapon = SFG_player.weapon; + + // perform game logic (physics etc.), for each frame + while (timeSinceLastFrame >= SFG_MS_PER_FRAME) + { + SFG_gameStep(); + + timeSinceLastFrame -= SFG_MS_PER_FRAME; + + SFG_game.frame++; + steps++; + } + + if (SFG_player.weapon != previousWeapon) + SFG_processEvent(SFG_EVENT_PLAYER_CHANGES_WEAPON,SFG_player.weapon); + + if ((steps > 1) && (SFG_game.antiSpam == 0)) + { + SFG_LOG("failed to reach target FPS! consider setting a lower value") + SFG_game.antiSpam = 30; + } + + if (SFG_game.antiSpam > 0) + SFG_game.antiSpam--; + + // render noly once + SFG_draw(); + + SFG_game.lastFrameTimeMs = timeNow; + } + else + { + SFG_sleepMs((timeNextFrame - timeNow) / 2); // wait, relieve CPU + } + + return SFG_game.continues; +} + +#undef SFG_SAVE_TOTAL_TIME + +#endif // guard diff --git a/dingux/images.h b/dingux/images.h new file mode 100644 index 0000000..4f7934b --- /dev/null +++ b/dingux/images.h @@ -0,0 +1,1395 @@ +/** + @file assets.h + + This file containts assets to be used in the game. Textures are stored by + columns for cache friendliness (as rendering also happens by columns), + 4 bits per pixel, which means an index to 16 color subpalette stored at the + beginning of the image. Images can be converted to this format with the + provided pything script: + + python img2array.py -t -c -x32 -y32 -ppalette565.png image.png + + by Miloslav Ciz (drummyfish), 2019 + + Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/) + plus a waiver of all other intellectual property. The goal of this work is + be and remain completely in the public domain forever, available for any use + whatsoever. +*/ + +#ifndef _SFG_IMAGES_H +#define _SFG_IMAGES_H + +#define SFG_TEXTURE_SIZE 32 + +#define SFG_TEXTURE_STORE_SIZE (16 + (SFG_TEXTURE_SIZE * SFG_TEXTURE_SIZE) / 2) + +/** + Color index which will in textures and sprites be considered transparent. +*/ +#define SFG_TRANSPARENT_COLOR 175 + +/** + Special index of an implicit texture that consists of only transparent pixels. +*/ +#define SFG_TRANSPARENT_TEXTURE 255 + +static inline uint8_t SFG_getTexel(const uint8_t *texture, uint8_t x, uint8_t y) +{ + x &= 0x1f; + y &= 0x1f; + + return SFG_PROGRAM_MEMORY_U8 (texture + + ((SFG_PROGRAM_MEMORY_U8(texture + 16 + (x * SFG_TEXTURE_SIZE + y) / 2) >> + (4 * (y % 2 == 0))) & 0x0f)); +} + +#define SFG_WALL_TEXTURE_COUNT 16 + +SFG_PROGRAM_MEMORY uint8_t + SFG_wallTextures[SFG_WALL_TEXTURE_COUNT * SFG_TEXTURE_STORE_SIZE] = +{ +// 0, white wooden planks +4,21,5,3,20,0,2,26,6,18,57,65,1,16,17,49,0,1,0,3,32,1,33,0,161,64,1,16,64,3,3, +32,0,17,16,9,32,1,17,1,161,65,1,16,78,132,35,32,0,17,16,7,32,1,32,17,240,49,0, +16,57,99,87,206,0,18,16,6,33,0,16,1,177,48,0,0,97,0,2,0,0,17,32,6,32,1,0,1,178, +48,0,0,48,0,2,0,0,17,32,7,32,17,1,0,178,48,1,0,49,0,1,0,0,1,16,3,32,18,0,0,194, +48,0,0,48,0,18,4,64,17,32,4,35,0,3,0,194,48,0,0,49,0,34,4,0,17,32,6,130,50,32, +40,242,48,1,0,49,0,18,0,0,2,32,12,85,85,85,85,81,48,2,0,49,0,33,3,0,2,16,3,32,0, +32,2,98,48,1,0,49,0,34,19,0,18,17,3,32,0,32,0,194,48,2,0,0,0,34,3,4,2,16,3,16,0, +32,32,226,48,2,0,48,0,33,19,0,18,33,3,0,16,32,32,178,48,1,1,50,1,34,3,4,17,16,3, +0,16,32,16,162,48,1,64,50,1,34,7,3,1,17,3,0,16,32,16,184,2,2,2,2,48,18,3,0,0,17, +3,0,17,32,16,94,93,93,89,112,0,18,3,0,0,16,3,0,2,32,16,48,48,48,3,0,0,17,4,0,0, +17,3,0,1,32,16,48,48,0,3,1,1,18,3,0,0,32,7,16,1,32,16,48,0,1,0,1,50,34,3,0,1,33, +3,16,1,20,32,112,48,0,16,1,49,34,3,64,16,33,3,4,2,4,16,48,49,0,16,0,49,34,3,64, +0,32,3,16,1,0,0,48,49,0,16,65,48,34,3,49,0,17,3,16,2,0,0,48,49,1,32,0,49,34,3, +64,0,16,19,16,2,1,0,113,49,17,16,0,48,32,3,0,0,16,19,16,1,2,0,97,66,17,32,64,48, +33,19,34,2,0,137,16,1,18,0,97,49,17,16,66,64,32,3,84,212,105,69,16,1,17,0,97,49, +18,16,50,48,16,19,51,48,51,51,16,1,16,0,98,50,1,19,66,48,32,3,0,1,0,3,32,1,33,0, +177,49,2,16,66,64,16,3,0,1,0,7,32,1,16,1,82,64,1,16,50,0,16,35,0,1,0,9,33,2,32, +0,161,64,1,20,48,0,0,32 +, // 1, skyscraper window +4,5,3,6,2,81,0,59,48,128,138,131,66,44,137,129,16,176,208,176,44,33,0,0,1,43,1, +13,0,32,29,0,0,176,0,0,12,64,0,17,0,32,0,17,1,32,13,11,0,176,0,208,4,65,0,0,0, +34,1,16,1,32,16,0,23,32,0,2,40,66,2,194,230,140,34,208,2,176,17,0,119,76,66,34, +34,34,34,34,34,34,34,34,34,116,64,0,72,194,51,51,51,51,17,49,51,19,19,49,51,12, +34,36,17,210,49,17,16,17,1,17,17,16,17,1,17,42,1,17,17,2,49,154,116,244,229,164, +233,85,49,16,17,14,1,16,2,69,17,104,79,117,149,88,94,137,49,17,17,36,0,0,196,69, +48,137,119,69,84,79,88,85,49,17,1,4,92,244,0,34,0,69,85,95,127,116,86,89,49,17, +17,36,0,0,17,32,1,169,88,229,228,74,85,85,49,19,1,4,0,0,0,2,49,90,153,85,85,169, +95,85,49,16,17,4,2,0,0,39,48,68,85,233,138,37,133,136,49,17,17,36,0,32,0,4,17, +122,150,84,133,230,136,136,49,1,17,10,0,0,0,44,48,35,51,51,51,51,51,35,49,17,1, +66,0,13,0,4,17,51,3,211,3,3,35,2,49,17,17,34,0,0,0,37,49,167,42,70,106,69,102, +102,49,0,17,36,2,34,68,244,48,39,119,79,69,150,102,102,49,17,17,68,64,34,16,76, +49,119,2,127,120,102,102,102,49,17,19,5,0,1,1,74,49,114,119,4,152,102,104,102, +49,17,17,75,0,0,208,28,49,119,39,116,248,104,134,102,49,16,17,34,0,0,0,10,17,39, +114,37,169,104,136,86,49,16,17,4,0,0,1,43,49,114,126,232,74,102,104,134,49,1,0, +34,0,32,0,116,17,119,122,102,88,102,102,102,49,16,17,66,0,0,1,36,49,17,17,17,17, +17,17,17,1,1,1,64,0,0,32,184,49,17,49,17,17,19,51,17,17,17,19,178,0,34,44,66,34, +71,39,34,180,36,66,34,2,32,32,192,17,19,66,192,0,16,176,66,34,34,34,200,36,34, +34,36,68,44,221,192,0,0,10,32,0,16,1,34,16,16,0,11,0,16,13,64,0,0,10,0,0,0,1,34, +0,1,1,2,16,0,1,176,27,0,11,33,0,17,0,112,0,1,17,113,16,0 +, // 2, pink high-tech wall +83,4,12,5,84,20,61,85,13,6,11,3,7,14,15,0,34,32,34,0,32,2,170,34,170,160,170, +160,17,17,17,17,34,34,32,34,42,34,170,2,42,42,170,170,17,17,17,17,34,34,34,36, +34,160,36,32,160,160,42,10,49,17,17,17,34,34,34,42,34,0,0,0,0,0,0,4,49,49,17,17, +34,34,2,10,36,32,17,17,81,17,81,23,59,59,59,17,0,0,0,0,2,0,84,84,96,0,0,0,59,59, +49,19,102,102,102,102,96,32,20,86,0,102,102,102,145,59,59,19,34,34,34,36,96,32, +21,86,5,85,85,23,59,59,49,19,34,34,34,42,96,64,21,86,5,85,69,71,145,155,49,49, +34,34,66,37,96,128,84,86,5,85,91,23,49,49,49,19,34,34,0,0,0,0,0,0,4,84,69,87, +145,155,49,49,34,38,6,102,102,102,102,96,68,84,84,23,145,145,145,51,34,38,2,37, +88,32,68,69,69,85,85,71,49,145,49,51,40,134,2,34,130,64,21,69,85,84,21,23,145, +145,147,51,36,38,4,68,68,64,84,85,85,84,20,71,145,145,49,51,37,38,2,66,68,32,69, +85,85,85,69,87,145,145,147,51,40,134,5,84,72,64,20,65,69,68,20,71,145,193,147, +51,36,70,2,72,136,112,68,65,20,84,20,87,145,145,51,57,40,134,8,133,132,32,84,84, +17,84,68,87,195,147,147,51,40,134,8,88,136,112,21,17,17,68,17,23,147,51,51,51, +36,134,4,133,136,112,81,17,17,68,65,87,147,147,51,57,40,134,0,0,0,0,0,0,65,20, +68,71,147,57,147,57,39,120,102,102,102,102,102,102,1,17,84,71,153,51,57,57,40, +119,135,119,96,112,17,22,1,17,68,183,147,57,51,51,37,120,135,120,96,112,177,22, +1,17,17,87,153,147,57,57,37,136,136,135,96,32,65,22,1,20,91,71,60,57,57,57,0,0, +0,0,96,112,84,22,96,0,0,0,57,57,60,57,102,102,102,102,104,128,75,181,102,102, +102,102,60,57,51,60,39,119,135,119,120,112,180,84,180,181,75,183,57,60,57,57,34, +136,135,215,231,116,119,119,119,119,119,119,60,51,60,60,37,120,135,114,119,135, +125,120,116,212,68,114,60,60,57,57,34,117,136,135,135,120,132,136,136,136,136, +71,57,57,57,153 +, // 3, partly mossy concrete wall +4,3,5,36,20,37,76,12,11,19,77,130,13,35,2,0,2,0,0,80,32,0,0,1,5,37,1,64,4,25,19, +145,0,32,96,32,0,16,48,24,115,48,65,53,48,16,113,11,2,0,0,0,0,0,0,152,3,48,49, +48,51,19,1,17,0,32,16,48,0,16,0,8,0,0,1,67,0,23,19,17,2,0,5,48,0,16,0,24,115,65, +113,85,67,16,0,17,2,0,18,0,0,0,0,6,4,0,0,67,48,19,145,17,0,0,3,80,80,0,0,1,3,80, +19,3,83,16,9,1,2,0,210,0,0,16,0,1,148,3,1,48,51,16,17,17,19,0,16,48,0,16,0,24,5, +64,113,51,3,49,1,11,2,0,0,34,0,0,0,8,85,3,1,67,84,3,112,17,0,36,5,4,32,96,0,8,4, +4,3,52,83,16,17,1,34,0,2,32,0,0,7,1,3,32,49,3,51,119,49,113,4,32,96,66,0,0,0,7, +5,84,1,51,67,112,0,30,2,32,98,32,10,0,0,8,68,32,64,5,3,49,0,14,2,2,96,0,0,96,0, +6,5,80,49,48,51,112,1,27,0,32,2,0,1,96,0,1,51,0,1,3,51,27,0,27,2,0,96,32,0,0,6, +8,0,48,3,3,48,208,24,1,2,32,98,4,32,0,0,6,4,36,3,0,51,0,16,17,34,194,96,34,0,96, +0,6,50,48,1,83,67,144,0,8,0,42,2,36,0,0,162,8,5,32,65,64,48,23,1,1,2,32,100,34, +6,0,12,8,68,50,1,0,3,16,112,1,36,34,2,0,0,0,0,8,0,0,0,48,0,23,7,17,2,42,4,32,42, +0,0,8,5,64,64,35,0,135,0,1,2,64,98,44,6,0,32,8,48,48,1,85,0,17,0,49,2,32,3,2,0, +4,0,8,5,64,0,0,4,0,112,1,4,34,98,2,6,98,32,8,85,36,48,67,5,1,0,11,2,32,98,192, +160,4,52,8,4,0,1,4,0,0,112,113,2,194,2,0,0,0,2,1,5,85,64,211,4,48,0,1,2,32,0,42, +0,21,4,8,64,68,45,4,48,0,23,27,2,32,96,0,0,16,0,1,5,80,0,85,3,16,0,1,2,194,0,0, +0,16,48,17,84,85,0,48,64,144,25,17,0,32,96,0,0,0,64,13,3,68,0,5,48,16,0,17 +, // 4, wooden chess pattern +20,12,11,21,2,43,19,73,1,83,81,10,9,34,42,65,86,82,91,85,89,249,149,153,66,34, +40,34,34,114,34,36,0,0,0,48,48,35,0,2,33,18,39,17,17,66,17,18,0,0,5,48,3,96,3, +50,33,34,40,33,33,113,17,18,96,0,6,48,3,99,3,50,33,34,23,33,18,129,17,18,80,3,5, +48,3,99,3,54,33,33,23,18,17,114,17,18,80,0,5,48,3,99,0,54,33,34,20,34,33,114,33, +18,80,0,2,48,51,163,3,54,65,34,20,34,33,65,33,18,80,3,2,48,0,163,0,54,33,34,20, +34,17,66,33,18,0,0,2,3,0,67,0,53,177,34,20,34,17,130,33,18,0,0,2,51,0,211,0,5, +33,34,36,34,17,114,18,18,80,0,6,3,0,99,0,53,33,34,20,18,33,113,17,18,0,3,2,48,3, +99,0,6,65,33,20,18,33,65,17,18,0,0,2,0,0,96,0,6,34,34,20,17,33,129,17,18,0,0,5, +0,0,99,0,1,33,34,36,17,33,130,17,18,3,3,53,48,0,35,0,6,65,17,20,17,17,66,17,18, +80,85,86,5,85,224,85,85,68,68,72,66,68,132,68,36,66,34,20,34,34,66,34,36,96,0,5, +5,80,80,85,82,65,34,20,33,34,65,18,18,3,3,53,48,3,83,0,5,65,34,20,18,34,65,18, +34,51,51,54,51,3,80,5,5,66,34,20,18,34,65,18,18,51,51,53,51,3,80,5,5,66,34,20, +17,33,65,17,18,0,51,54,51,3,80,5,5,65,34,20,17,17,65,17,34,51,51,53,51,3,80,0,0, +65,34,20,17,17,65,17,18,0,51,54,48,51,80,0,0,66,34,20,17,18,65,17,18,3,51,54,48, +51,80,5,5,65,34,20,17,33,65,17,18,3,51,54,51,51,32,0,5,65,34,20,17,33,65,17,18, +3,51,54,51,51,80,1,5,65,34,20,17,33,65,34,34,3,51,59,48,51,80,5,85,65,34,20,17, +17,66,34,36,3,51,52,48,3,83,1,5,65,34,20,17,17,68,17,20,3,51,54,48,48,35,48,5, +65,33,20,34,17,66,17,18,3,0,52,51,51,35,48,5,65,33,20,17,17,65,18,18,3,51,54,51, +0,35,48,5,32,80,106,0,80,101,6,2,85,85,92,86,86,160,5,82 +, // 5, red brick wall +13,5,6,21,93,101,4,100,11,7,19,3,106,178,0,0,33,17,22,37,48,8,33,3,54,33,64,0,1, +20,5,70,37,0,88,37,85,88,32,64,4,17,64,0,65,20,0,70,32,51,56,37,85,8,33,0,4,17, +83,51,81,20,96,70,32,3,52,38,51,8,33,3,4,18,83,51,81,20,85,70,38,6,4,32,51,8,33, +3,4,18,64,51,81,20,85,69,38,0,4,38,3,52,33,83,5,17,67,51,81,20,101,70,38,0,4,38, +83,4,17,83,0,17,67,51,81,20,101,68,38,0,4,38,69,68,17,86,80,18,69,85,65,36,101, +68,32,85,4,34,17,17,33,86,83,18,18,34,34,36,0,88,33,0,4,34,34,18,33,83,0,18,17, +17,17,36,0,84,35,3,56,34,64,76,17,83,48,98,112,0,119,36,0,68,35,0,4,34,133,4,18, +3,48,98,113,0,17,36,0,85,33,0,4,34,133,100,17,81,48,98,112,0,1,36,0,86,35,0,8, +33,165,68,17,67,53,98,113,0,1,36,85,86,35,0,4,33,69,106,17,64,53,98,112,0,1,20, +85,86,35,0,4,33,133,68,17,64,53,18,112,0,1,20,5,86,35,0,4,33,166,84,17,64,53,18, +112,0,1,20,5,86,35,3,4,33,69,10,17,80,53,18,112,0,1,36,85,86,35,0,52,34,69,100, +33,83,5,18,112,0,113,40,5,84,33,64,8,33,69,4,33,69,68,18,112,0,1,36,0,22,33,0,4, +33,0,52,17,34,34,18,112,0,1,34,34,145,34,41,146,33,0,4,17,17,17,18,113,17,1,36, +99,22,38,80,49,33,69,4,32,0,4,98,112,17,17,36,51,6,32,80,4,33,69,106,35,3,53,98, +112,0,17,36,51,6,33,3,52,33,69,72,35,51,53,18,16,0,17,37,51,6,33,3,52,17,69,84, +35,51,53,98,112,0,17,37,51,6,33,1,52,17,69,100,35,51,48,98,113,17,17,21,3,6,35, +3,52,17,67,4,35,51,48,98,112,0,17,16,51,6,35,3,53,17,69,100,33,49,19,97,112,0, +17,37,51,6,35,3,4,17,212,4,33,3,51,98,1,0,1,36,3,6,35,3,52,18,34,34,33,3,48,177, +34,153,146,36,51,54,33,3,52,34,49,17,33,3,48,98,70,102,17,36,0,6 +, // 6, grass-covered concrete wall, tiles with skyscraper window +36,37,43,35,4,3,107,34,131,50,42,5,106,110,114,26,3,131,51,128,58,52,0,5,84,56, +84,2,0,48,66,0,48,128,5,5,10,112,0,68,0,48,85,68,4,144,32,1,6,32,17,0,7,116,80, +0,85,153,36,13,0,1,0,0,16,1,1,0,54,115,3,160,110,234,55,1,208,40,1,0,170,96,0, +39,115,51,51,144,0,51,144,0,0,16,0,2,17,16,17,208,11,187,20,0,2,43,64,32,17,16, +0,44,17,1,0,16,3,1,0,2,0,3,64,0,0,32,32,0,1,16,17,0,1,3,2,96,32,37,64,0,2,0,2, +32,17,16,1,1,0,0,34,128,32,0,1,16,16,32,0,32,1,0,0,0,16,8,0,2,2,2,2,0,32,2,32,0, +34,1,19,48,5,96,0,2,0,32,0,17,1,2,0,16,1,18,16,65,16,0,32,0,1,2,2,4,0,8,32,2,1, +39,18,4,1,32,0,208,0,0,0,1,16,0,2,0,0,18,19,48,0,16,13,0,1,0,32,18,16,0,0,0,16, +1,0,0,16,65,16,0,0,33,1,16,0,54,0,38,0,6,64,0,129,0,0,0,0,1,0,0,0,9,63,50,2,2,8, +2,32,0,18,0,17,0,1,17,96,0,5,80,32,0,0,0,0,18,69,80,0,1,16,48,1,0,32,153,206,32, +2,2,32,17,4,64,96,32,0,17,0,224,0,131,64,0,0,0,1,0,4,8,0,0,16,16,1,18,96,0,2,2, +0,34,32,2,0,0,5,0,0,96,2,0,32,0,2,0,2,0,17,0,0,0,85,34,32,0,0,0,0,0,2,0,1,16,48, +0,33,2,68,0,2,2,0,16,0,32,32,32,38,1,32,0,0,34,6,0,0,48,3,0,8,0,0,0,18,16,0,0, +98,0,32,0,0,0,33,32,0,32,0,17,17,0,0,0,33,32,0,0,4,49,18,0,2,16,2,1,66,0,98,2,0, +0,0,34,0,17,1,0,0,0,17,0,17,33,2,0,12,126,199,112,39,0,16,6,21,0,16,16,0,16,32, +32,167,51,63,62,172,151,113,0,0,2,0,1,17,48,16,16,48,69,4,51,64,64,0,16,8,96,27, +16,16,16,62,57,149,0,4,51,0,1,4,7,80,2,0,17,1,51,8,52,0,68,0,32,0,4,68,36,16,32 +, // 7, steel door +4,80,3,17,5,59,6,69,58,50,60,2,68,74,70,67,1,17,17,17,17,17,17,17,17,17,17,17, +17,17,17,17,22,102,70,102,70,102,70,102,70,100,102,100,102,100,102,97,16,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,1,16,0,32,0,32,0,32,0,32,2,0,2,0,2,0,1,19,189,187,221,189, +219,219,219,187,187,187,219,189,189,189,177,17,51,51,51,51,51,51,51,51,51,51,51, +51,51,51,49,19,136,136,136,133,133,85,95,34,34,44,47,34,194,34,40,19,136,34,34, +34,2,34,34,34,32,34,32,2,2,2,34,19,130,40,140,136,192,197,192,112,112,64,0,0,7, +4,7,19,146,136,200,92,80,122,90,160,0,64,0,7,0,4,0,19,146,149,136,200,84,122, +202,0,0,64,0,0,7,14,0,19,146,153,153,197,94,170,80,112,0,64,0,112,0,4,0,19,146, +37,156,133,112,5,0,0,224,224,0,112,112,4,0,19,146,153,153,87,160,0,7,160,0,64,0, +0,0,4,4,19,146,149,41,149,4,7,80,160,10,71,0,0,7,4,0,19,146,153,146,87,0,170,87, +0,7,64,0,7,0,4,4,19,146,89,204,87,4,167,80,7,0,224,0,0,0,4,0,19,146,153,156,90, +160,122,80,0,14,64,0,0,112,116,4,19,146,149,153,85,116,170,192,0,112,64,112,0,0, +4,0,19,146,41,92,138,84,122,90,0,0,71,0,7,0,4,4,19,146,153,204,80,126,90,202, +224,0,64,0,0,0,4,0,19,146,143,85,32,4,170,90,160,0,71,0,7,7,14,0,19,130,136,140, +128,116,122,202,112,10,64,0,112,0,4,0,19,130,40,200,92,14,170,80,0,170,74,112,0, +112,116,0,19,136,34,34,34,2,2,0,0,32,34,34,34,34,2,34,19,136,136,136,133,34,85, +85,85,37,194,47,34,242,34,34,17,51,51,51,51,51,51,51,51,51,51,51,51,51,51,49,27, +189,221,187,219,219,219,187,221,187,187,221,189,189,189,177,22,102,70,102,70, +102,70,102,70,102,70,100,102,100,102,97,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,16,0, +32,0,32,0,32,0,32,0,32,2,0,2,0,1,1,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17 +, // 8, white skull on blue +6,5,4,59,60,62,218,14,3,13,85,139,74,63,12,15,17,17,17,17,17,18,147,69,72,17,17, +17,17,17,17,17,16,16,1,1,16,18,35,51,50,17,1,1,16,16,1,17,16,0,0,0,0,18,36,99, +82,16,16,0,0,0,0,17,0,0,0,0,0,18,37,51,82,17,0,0,0,0,0,1,16,0,0,0,0,18,35,179, +50,17,16,0,0,0,0,1,0,0,0,0,0,18,35,51,66,17,16,0,0,0,0,17,16,0,0,0,1,226,37,67, +84,40,17,0,0,0,0,1,0,0,0,17,42,34,85,83,85,67,33,16,0,0,0,17,0,0,1,18,34,51,34, +34,68,75,98,129,16,0,0,17,16,0,17,162,51,130,34,34,38,198,52,66,129,0,1,17,17, +17,42,36,98,33,17,17,34,51,51,68,98,33,17,17,130,34,36,68,33,17,17,23,121,34,52, +68,51,66,34,34,68,84,53,85,33,0,0,121,151,34,37,85,67,69,221,51,51,68,52,82,16, +0,0,126,151,18,34,133,91,69,84,99,51,107,52,66,0,16,16,247,119,17,34,40,60,67, +51,68,83,99,51,50,1,1,17,0,1,33,18,40,51,51,52,85,75,52,52,66,0,17,17,0,1,33,18, +40,51,68,51,69,51,84,53,82,1,0,16,247,119,17,34,40,70,69,51,51,85,84,52,82,16,0, +0,126,151,18,34,132,70,69,84,99,85,68,52,52,33,0,0,121,151,34,36,52,60,52,85,51, +130,34,35,107,33,17,17,23,121,34,99,107,195,66,34,34,17,17,42,102,98,33,17,17, +34,54,102,102,98,33,17,17,16,0,17,162,68,130,34,34,36,76,102,98,33,0,1,17,0,0,1, +18,35,69,34,34,85,67,194,161,16,0,0,17,16,0,0,17,42,35,69,67,68,75,33,16,0,0,0, +17,0,0,0,0,1,226,35,99,54,42,17,0,0,0,0,1,0,0,0,0,0,18,35,51,66,17,16,0,0,0,0, +17,16,0,0,0,0,18,37,51,82,17,16,0,0,0,0,1,0,0,0,0,0,18,45,51,66,17,0,0,0,0,0,1, +16,0,0,0,0,18,36,99,50,16,16,0,0,0,0,17,16,16,1,1,16,18,35,68,50,17,16,16,16,16, +1,17,17,17,17,17,17,18,148,85,88,17,17,17,17,17,17,17 +, // 9, red lava with stones +3,4,12,11,83,94,102,92,91,14,93,15,19,20,100,0,3,82,2,83,32,67,84,1,17,17,16,5, +32,17,20,0,2,48,0,67,117,118,36,0,33,33,0,5,33,17,17,19,69,64,17,20,67,86,82,36, +17,1,0,53,1,17,17,64,56,1,17,17,0,130,50,117,131,64,4,39,0,17,17,0,32,1,17,17,3, +82,4,68,39,85,34,98,36,16,0,3,0,0,1,16,3,82,1,16,0,35,53,106,83,51,51,54,85,68, +36,3,53,32,49,17,16,0,54,34,66,35,37,86,67,85,85,34,38,66,1,17,17,0,82,64,64,0, +3,101,0,32,3,34,102,103,65,1,17,3,84,1,17,0,3,83,18,17,0,67,34,68,85,52,0,69,48, +17,17,19,69,0,17,17,20,3,112,0,2,53,51,114,1,17,17,16,69,65,17,17,16,3,80,3,0,4, +46,98,64,17,17,32,115,1,17,18,0,53,64,17,17,16,50,86,34,0,0,0,35,1,0,0,0,37,65, +17,17,17,2,34,119,85,67,66,34,0,51,130,50,98,64,17,17,17,2,35,68,51,85,102,98, +35,51,50,86,102,35,34,2,16,3,132,0,0,4,34,82,35,20,0,66,85,39,120,34,4,2,80,1, +17,4,53,52,0,17,4,3,83,64,2,37,81,69,16,77,17,16,69,16,0,18,16,0,84,16,0,67,66, +38,49,17,17,32,53,32,17,17,17,0,82,0,33,16,3,102,32,0,0,4,84,0,18,17,17,0,84,1, +17,17,4,182,98,64,0,3,84,1,17,17,17,0,83,1,17,17,4,99,37,83,50,50,32,0,33,17,16, +0,83,1,17,33,2,36,0,34,114,118,84,16,17,0,0,3,83,1,17,16,67,49,1,16,4,38,103,51, +64,84,68,53,32,0,17,0,55,32,17,17,0,39,50,39,85,37,82,166,98,36,16,64,34,1,17, +17,16,55,32,0,36,0,4,54,34,117,66,51,84,1,17,17,16,82,0,0,2,17,4,39,64,18,82, +118,98,64,1,17,4,84,16,17,17,18,4,84,4,0,20,53,102,82,32,0,4,84,0,33,17,16,2,32, +1,17,64,39,51,69,85,117,53,156,65,1,18,50,38,36,17,17,16,34,0,0,20,67,102,101, +115,51,51,130,101,101,32,17,4,84,1,17,33,16,38,148,19,56,56 +, // 10, transparent window +175,4,5,3,59,13,49,60,74,62,61,50,83,2,69,12,17,17,33,17,81,17,17,33,17,17,17, +17,18,34,34,17,59,17,17,17,17,17,17,17,17,17,177,17,18,34,82,33,51,51,51,51,51, +51,51,51,51,51,59,81,18,34,33,17,49,182,102,102,102,102,102,102,102,107,18,33, +18,34,34,33,51,0,0,0,0,116,16,0,0,10,50,37,18,34,34,33,51,0,0,0,0,116,16,0,0,10, +50,17,18,34,21,33,51,0,0,0,0,84,16,0,0,10,50,33,17,243,51,52,51,0,0,0,0,20,16,0, +0,10,50,145,18,17,17,21,51,0,0,0,0,20,32,0,0,10,50,149,18,49,81,17,51,0,0,0,0, +116,112,0,0,1,50,37,82,17,113,17,51,18,51,140,140,71,72,140,136,200,50,37,82,49, +17,225,51,18,68,68,68,121,116,68,68,71,50,33,82,18,18,17,51,0,0,0,0,212,208,0,0, +12,50,17,18,37,34,17,51,0,0,0,0,20,16,0,0,9,50,17,18,18,37,30,51,0,0,0,0,116,32, +0,0,2,50,145,18,34,34,33,51,0,0,0,0,116,16,0,0,2,50,37,18,34,18,17,51,0,0,0,0, +116,16,0,0,10,50,145,18,37,33,18,51,0,0,0,0,116,16,0,0,10,57,145,82,33,18,225, +51,0,0,0,0,20,16,0,0,10,57,145,18,18,17,21,51,0,0,0,0,212,208,0,0,13,50,149,18, +37,18,17,51,18,68,68,68,121,116,68,68,71,50,37,18,34,33,17,51,18,60,200,140,71, +76,136,136,200,50,37,18,34,81,30,51,0,0,0,0,244,16,0,0,1,50,149,18,34,33,17,51, +0,0,0,0,20,32,0,0,10,50,33,18,18,17,17,51,0,0,0,0,116,32,0,0,2,50,33,17,243,51, +52,51,0,0,0,0,20,16,0,0,10,50,17,18,17,17,17,51,0,0,0,0,84,16,0,0,10,50,33,82, +17,33,31,51,0,0,0,0,116,16,0,0,2,50,33,18,17,17,17,49,182,102,102,102,102,102, +102,102,107,34,81,18,37,17,17,19,50,34,34,34,34,34,34,34,34,35,81,18,34,17,17, +59,34,34,34,34,34,34,34,34,34,181,17,18,18,81,21,17,17,17,17,33,17,17,17,21,17, +17,17,18,34,34,18 +, // 11, white steel blocks +6,5,7,4,3,85,71,78,0,0,0,0,0,0,0,0,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68, +68,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,52,34,0,34,34,2,34,34,34,34,34, +0,34,34,34,0,17,0,17,0,0,0,1,16,0,0,0,0,0,1,16,17,17,0,20,0,0,0,0,0,0,0,0,0,0,1, +64,0,17,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,17,17,17,17,17,17,17,17,81,17,17,17,17,17, +17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,17,1,17,16,0,0,0,0,0,0,0,0,0,0,0,0,17,0, +0,1,1,0,0,6,0,0,0,0,0,0,0,0,17,34,0,34,0,34,34,34,34,34,34,34,34,32,2,34,17,0, +17,0,1,16,0,0,0,0,0,17,0,0,0,0,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,17,0,0,0,0,1,0, +0,0,0,0,0,0,16,0,17,17,17,17,17,81,17,22,0,0,0,1,17,1,17,17,17,19,0,0,0,0,0,2,0, +0,0,1,0,0,0,0,113,21,16,0,0,0,0,2,0,0,0,1,0,0,0,0,0,19,0,0,0,0,0,2,0,0,0,1,0,0, +0,0,1,17,34,34,32,2,34,34,0,0,0,2,34,34,0,34,0,17,0,0,0,0,0,17,0,0,0,0,0,1,16, +16,17,17,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0,17,0,1,0,0,0,0,0,0,0,0,0,0,0,17,17, +17,17,17,17,17,17,81,17,17,17,17,17,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,1, +17,16,0,0,0,0,0,0,0,0,1,0,1,16,17,0,0,1,1,0,0,6,0,0,0,16,0,0,0,0,17,34,0,34,0, +34,0,34,34,34,34,34,34,32,2,34,17,0,17,1,1,16,0,0,0,0,0,17,0,1,16,0,17,0,20,0,0, +0,0,0,0,0,0,0,0,1,64,1,17,0,0,0,0,0,0,0,1,0,0,0,0,16,0,17,17,17,17,17,17,17,17, +17,17,21,17,17,17,17,17,17,19,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51 +, // 12, gray square-tiled wall +4,5,3,13,50,6,12,21,85,20,14,11,19,22,84,0,17,17,17,17,17,17,17,18,17,17,17,17, +17,17,17,20,17,3,16,8,17,16,0,18,17,16,1,1,0,3,16,18,16,1,16,1,0,49,17,48,17,1, +3,6,0,17,3,2,16,16,0,16,16,24,16,16,17,0,0,23,16,0,0,2,16,1,3,17,1,16,16,18,19, +0,0,0,49,1,1,2,16,48,17,6,17,17,0,0,16,16,16,119,16,19,0,2,17,16,17,17,17,26,16, +50,17,49,0,19,0,0,0,2,16,17,49,17,129,17,16,2,16,3,16,0,0,1,6,2,16,17,16,1,17, +17,16,2,17,0,17,1,0,0,0,18,17,49,24,17,17,129,16,6,16,113,49,3,16,0,0,98,17,17, +17,16,49,0,96,9,16,16,0,0,1,49,0,18,17,17,17,17,17,16,1,2,81,1,0,32,0,16,16,2, +17,161,129,1,0,48,0,4,16,0,48,16,0,49,1,2,17,17,17,49,17,0,0,16,16,0,16,16,0,0, +48,2,80,17,17,17,19,17,48,0,16,16,0,0,0,17,6,2,32,48,32,6,0,34,32,98,2,34,34,38, +2,34,34,34,21,81,21,85,81,21,81,86,85,21,17,17,21,81,17,27,17,17,16,19,0,48,1,0, +16,0,0,0,48,0,0,2,19,17,49,0,17,1,17,2,22,1,0,1,1,48,0,2,16,17,0,0,48,0,49,2,80, +6,0,0,16,1,48,2,16,48,0,0,16,16,112,50,16,0,0,1,0,16,16,148,17,1,49,0,0,49,0,28, +16,0,0,48,3,0,0,2,16,0,3,1,0,0,17,18,16,3,0,0,0,0,0,50,17,113,1,3,0,0,48,2,16,0, +0,0,0,6,0,2,16,0,0,0,0,48,0,18,16,0,0,0,0,0,0,2,17,0,0,0,0,0,3,2,208,0,3,0,48,0, +0,4,17,112,48,19,16,0,0,18,17,0,0,0,0,0,16,100,16,17,9,1,1,16,1,2,22,0,0,0,0,0, +0,2,16,1,0,16,3,0,48,0,16,0,0,0,0,224,0,4,16,48,3,1,0,0,16,50,16,3,0,48,0,3,0, +52,16,16,1,16,0,0,0,2,16,16,0,0,2,2,1,4,68,66,32,34,36,34,34,36,34,36,34,34,68, +68,68,68 +, // 13, scifi door +3,2,4,9,0,74,200,10,75,41,160,48,120,17,34,50,68,68,68,68,68,68,68,68,70,102, +102,102,102,102,102,102,85,85,153,85,85,153,85,85,85,136,136,136,136,136,136, +136,149,153,153,147,147,57,55,57,125,238,88,135,127,85,119,119,51,147,51,51,51, +55,147,55,215,125,215,119,119,119,119,119,68,68,68,68,68,68,68,70,102,102,102, +102,102,102,102,102,0,0,0,0,0,0,0,5,2,34,34,34,34,34,34,34,53,92,65,85,19,48,0, +81,32,11,160,0,1,18,34,1,48,83,64,0,83,16,0,1,34,1,178,34,1,2,34,33,53,84,65,0, +4,49,80,1,0,11,160,34,43,16,2,1,52,196,49,85,28,51,51,161,26,186,16,0,11,17,17, +161,51,51,51,51,51,51,49,16,1,17,17,17,17,17,17,16,53,85,49,85,19,21,0,34,32,0, +16,0,1,2,34,1,53,5,48,0,83,16,34,34,34,32,18,34,1,2,34,17,49,85,49,0,4,16,34,34, +34,32,16,34,43,2,32,161,51,68,49,85,28,16,34,34,34,32,16,0,11,0,17,0,51,67,51, +51,51,16,34,34,34,32,17,17,17,1,16,34,52,49,49,17,19,16,34,34,34,32,16,0,1,0,17, +2,51,5,48,0,84,16,34,34,34,32,18,34,10,2,1,17,48,5,49,5,84,16,34,34,34,32,16,32, +10,2,32,161,48,85,49,21,28,53,2,34,34,0,16,0,11,16,34,17,49,19,67,68,195,17,80, +177,16,1,161,171,177,0,0,177,51,52,17,51,67,51,17,16,1,26,0,17,161,17,17,16,53, +92,48,85,196,48,0,1,32,11,18,0,186,18,34,1,48,83,48,5,52,48,0,33,34,1,18,32,27, +18,34,33,53,84,49,85,68,17,80,1,0,11,16,0,186,0,2,1,52,196,51,76,67,19,51,161, +26,186,17,171,161,1,17,161,0,0,0,0,0,0,0,0,2,34,34,34,34,34,34,34,68,68,68,68, +68,68,68,102,102,102,102,102,102,102,102,102,51,147,51,51,51,55,147,125,125,119, +119,119,119,119,119,119,149,153,153,147,147,121,55,62,119,238,88,135,127,85,119, +119,85,85,153,85,85,153,85,85,152,136,136,136,136,136,136,136,68,68,68,68,68,68, +68,68,102,102,102,102,102,102,102,102 +, // 14, concrete wall, tiles with skyscraper window +5,4,3,2,6,44,131,66,50,51,45,81,132,28,138,1,1,97,81,193,39,32,17,17,16,44,16, +21,17,33,5,17,17,97,17,17,23,49,17,0,17,33,17,0,16,33,21,28,17,97,17,81,19,48, +17,17,17,34,16,1,16,33,1,17,9,33,17,18,47,50,18,130,255,248,34,81,18,97,0,17, +153,55,50,34,34,34,34,34,34,34,34,34,34,147,49,17,63,114,68,68,68,68,0,64,68,4, +4,64,68,24,34,35,0,82,64,0,1,0,16,0,0,1,0,16,0,46,16,0,0,18,64,16,1,17,0,0,13,0, +0,1,0,31,16,1,18,59,0,16,0,0,0,0,0,0,0,0,0,35,17,17,115,59,65,17,0,0,0,0,0,0,0, +0,16,19,183,51,161,34,17,16,0,0,0,0,0,0,0,0,0,35,17,17,0,33,16,0,0,0,0,0,0,0,0, +4,208,19,17,17,17,18,64,0,0,0,0,0,0,0,0,1,0,19,18,17,17,41,65,16,0,0,0,0,0,0,0, +0,0,35,17,33,17,19,0,16,0,0,0,0,0,0,0,16,0,30,17,17,17,39,65,0,0,0,0,0,0,0,0,0, +16,50,17,21,17,19,0,21,17,0,0,0,0,0,0,0,0,34,17,17,17,43,64,0,0,0,0,0,0,0,0,29, +0,35,18,34,51,51,65,21,1,0,0,0,0,0,0,0,0,51,49,34,1,55,64,0,0,0,0,0,0,0,0,0,4, +27,17,16,16,62,64,16,1,0,0,0,0,0,0,0,0,54,17,17,81,7,64,0,160,0,1,0,0,0,0,1,0, +34,17,17,17,30,0,16,16,16,0,0,0,0,0,1,0,19,17,17,16,38,64,0,0,160,16,0,0,0,208, +16,209,34,17,33,17,147,0,16,17,0,0,16,0,16,0,1,0,50,17,17,16,35,64,0,0,0,0,0,0, +0,16,16,16,49,17,17,33,111,64,0,64,0,0,4,68,0,0,0,4,98,17,34,40,50,34,57,41,34, +99,35,50,34,18,33,33,129,0,4,50,129,17,1,193,50,34,34,34,143,35,34,34,35,51,39, +85,113,17,17,22,33,17,1,16,34,1,1,161,22,17,1,21,49,17,17,30,17,17,17,16,34,17, +16,16,18,10,17,16,97,12,17,22,32,17,0,17,145,17,16,0,144,1,17 +, // 15, computer tech wall +52,59,53,220,38,141,54,143,75,76,77,61,74,5,66,95,48,0,0,0,10,17,0,0,0,0,38,0,0, +0,0,51,16,0,2,1,17,17,0,0,16,0,38,0,0,0,0,3,10,0,0,0,17,1,17,17,17,16,34,0,1,0, +0,0,7,0,0,0,17,49,81,33,33,32,34,48,1,48,0,0,2,0,0,0,17,1,1,17,17,16,38,0,0,0,0, +0,0,0,0,83,0,17,1,33,33,35,18,0,0,80,0,0,0,0,3,0,0,17,17,17,17,16,2,83,2,0,7,0, +0,85,19,19,3,17,17,33,33,32,2,17,0,32,0,0,0,0,48,0,1,16,1,0,16,0,34,17,17,0,0,0, +0,1,2,16,0,24,0,80,1,0,82,1,12,2,0,0,16,16,5,16,0,1,1,0,9,17,34,17,30,18,32,8, +16,0,96,0,0,17,17,17,17,17,34,80,85,16,32,1,0,2,2,0,0,17,68,68,68,68,34,5,85,1, +39,0,0,6,0,176,0,17,68,68,68,68,34,85,5,1,114,3,0,6,0,0,10,25,68,68,68,68,38,11, +85,1,114,3,0,6,0,0,0,17,68,68,68,68,34,0,48,1,2,3,2,6,0,0,0,17,68,68,68,68,34,0, +0,1,2,0,0,2,112,0,0,17,68,68,68,68,38,0,0,1,2,112,0,0,7,112,80,17,68,68,68,68, +38,0,0,21,34,0,0,16,32,0,0,19,34,34,34,34,34,5,0,80,34,177,17,227,0,53,1,17,16, +3,1,1,50,19,51,224,32,24,128,17,32,16,1,16,1,0,16,16,2,51,28,50,32,8,16,1,0,80, +0,21,0,0,16,1,146,51,137,6,0,1,0,1,16,0,17,17,0,0,17,16,34,17,144,32,0,3,0,0,17, +0,1,1,13,240,3,17,35,24,0,0,3,3,0,0,81,16,0,1,15,240,51,0,35,0,3,0,0,1,48,0,0, +195,0,17,0,0,5,49,34,0,3,0,160,3,0,0,5,48,206,17,4,208,109,0,2,48,0,112,2,3,57, +0,0,0,1,17,13,208,221,51,18,17,0,176,3,3,19,0,5,16,0,1,3,0,49,19,50,17,1,0,51,1, +144,0,48,0,0,17,0,0,0,48,34,49,48,0,0,3,48,0,0,0,10,17,0,0,0,0,38,0,0,0,0,51 +}; + +SFG_PROGRAM_MEMORY uint8_t SFG_itemSprites[13 * SFG_TEXTURE_STORE_SIZE] = +{ +// 0, barrel +175,6,106,29,100,84,7,92,2,43,10,11,46,4,28,200,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0, +15,240,0,0,0,0,0,0,255,248,255,255,255,255,255,255,248,143,255,255,255,255,255, +255,143,248,248,255,255,143,136,136,130,136,136,136,136,136,136,136,143,168,66, +136,136,137,136,146,146,130,153,153,146,146,143,66,168,170,226,34,130,41,73,41, +66,137,34,34,153,41,146,226,168,186,34,34,155,149,187,186,162,170,84,153,34,146, +36,158,170,234,34,233,229,93,170,171,85,91,43,78,68,66,146,36,187,121,228,237, +69,90,181,85,85,93,91,132,77,66,36,73,158,89,18,68,69,187,85,183,119,122,181, +187,68,66,68,18,222,93,18,68,77,161,197,28,119,119,170,26,94,34,36,18,213,93, +193,20,21,177,17,81,87,119,123,183,84,52,44,20,222,93,17,17,23,17,17,21,119,117, +17,81,65,35,65,28,213,93,49,17,26,21,186,167,119,225,17,17,113,34,49,49,222,93, +60,19,106,97,106,119,115,49,97,193,118,35,67,19,222,93,18,102,101,102,102,103, +117,86,22,54,113,50,35,18,213,93,18,198,99,118,102,119,119,119,119,183,54,99,38, +25,190,93,102,102,195,166,203,119,119,123,190,101,108,50,51,99,181,93,54,54,51, +117,22,19,87,187,229,53,51,34,33,28,222,125,51,51,51,58,49,28,17,49,21,227,19, +19,51,17,158,185,195,51,51,49,174,81,17,85,117,17,17,193,28,76,155,186,51,195, +51,17,61,91,187,181,49,52,49,28,20,28,154,170,25,236,30,49,49,17,49,193,17,17, +28,20,19,28,184,170,25,225,193,17,17,17,17,193,17,17,17,20,19,30,184,138,60,238, +236,193,193,193,17,195,65,17,17,225,68,62,175,250,34,34,34,34,34,36,225,228,34, +34,34,34,34,36,175,251,0,0,0,0,0,0,4,64,0,0,0,0,0,0,191,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +, // 1, health +175,7,73,6,174,5,69,4,71,53,3,93,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,34,34,32,0,2,34,34,32,0,0,0,0,0,0,0,2,17,17,18,34,33,17,17, +18,0,0,0,0,0,0,0,33,19,51,49,17,19,51,51,53,32,0,0,0,0,0,2,17,54,102,102,102, +102,102,102,51,162,0,0,0,0,0,2,85,102,89,89,89,89,89,86,101,162,0,0,0,0,0,2,85, +101,149,149,149,149,149,148,101,162,0,0,0,0,0,34,19,129,17,17,17,17,17,52,131, +114,0,0,0,0,2,90,19,131,17,17,17,17,17,20,131,114,0,0,0,0,2,42,19,129,20,68,68, +68,177,52,131,114,0,0,0,0,2,2,19,131,20,68,68,68,177,20,133,114,0,0,0,0,2,2,161, +129,49,49,75,17,49,52,135,32,0,0,0,0,2,0,33,131,19,17,75,19,19,20,135,32,0,0,0, +0,2,0,33,129,49,49,75,17,49,52,135,32,0,0,0,0,2,2,161,131,19,17,75,19,19,20,135, +32,0,0,0,0,2,2,19,129,20,68,68,68,177,52,133,114,0,0,0,0,2,42,19,131,20,68,68, +68,177,20,131,114,0,0,0,0,2,90,19,129,17,17,17,17,17,52,131,114,0,0,0,0,0,34,19, +131,17,17,17,17,17,20,131,114,0,0,0,0,0,2,85,105,89,89,89,89,89,84,101,162,0,0, +0,0,0,2,85,102,149,149,149,149,149,150,101,162,0,0,0,0,0,2,19,54,102,102,102, +102,102,102,53,114,0,0,0,0,0,0,37,51,51,87,119,117,51,51,87,32,0,0,0,0,0,0,2, +119,119,114,34,39,119,119,114,0,0,0,0,0,0,0,0,34,34,32,0,2,34,34,32,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +, // 2, ammo: bullets +175,124,168,112,125,5,194,21,19,17,113,190,2,3,4,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,51,51,51,0,0,0,0,0,0,0,0,0,0,0,0,51,136,200,211,0,0, +0,0,0,0,0,0,0,0,0,3,120,119,215,195,32,0,0,0,0,2,34,34,34,34,34,35,51,51,51,54, +32,0,0,0,0,33,102,102,102,106,102,102,238,230,102,22,32,0,0,0,0,36,17,17,51,58, +102,102,238,230,102,22,32,0,0,0,0,36,17,51,136,202,102,102,238,230,102,22,32,0, +0,0,0,36,19,120,119,218,68,68,255,244,68,70,32,0,0,0,0,36,17,34,51,58,65,17,85, +81,17,65,32,0,0,0,0,36,17,51,136,202,65,17,85,81,17,65,32,0,0,0,0,36,19,120,119, +218,65,17,91,177,17,65,32,0,0,0,0,36,17,57,127,90,65,17,187,81,17,65,32,0,0,0,0, +36,17,56,153,154,65,17,181,81,17,65,32,0,0,0,0,36,19,120,119,218,65,17,91,81,22, +22,32,0,0,0,0,36,17,56,153,154,65,17,187,182,51,51,50,0,0,0,0,36,17,57,136,202, +65,17,85,51,136,200,194,0,0,0,0,36,19,120,119,218,65,17,83,120,119,215,210,0,0, +0,0,36,17,57,127,90,65,17,187,57,255,95,82,0,0,0,0,36,17,57,136,202,65,17,85, +177,153,147,50,0,0,0,0,36,19,120,119,218,65,17,91,177,19,204,210,0,0,0,0,36,17, +57,127,90,65,17,181,177,19,247,130,0,0,0,0,36,19,136,153,154,65,17,181,81,25,93, +194,0,0,0,0,36,17,57,136,202,65,17,91,177,25,247,130,0,0,0,0,36,19,120,119,218, +65,17,91,81,17,151,130,0,0,0,0,2,34,51,127,90,65,17,187,177,17,152,32,0,0,0,0,0, +0,0,34,42,65,17,85,81,17,67,32,0,0,0,0,0,0,0,0,2,65,17,85,81,17,65,32,0,0,0,0,0, +0,0,0,2,34,34,34,34,34,65,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,32,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +, // 3, ammo: rockets +175,1,117,120,30,3,33,82,5,98,101,102,2,178,174,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,204,16,0,0,0,0,0,0,0,0,0, +0,0,0,17,26,197,81,17,17,17,16,0,0,0,0,0,0,0,17,204,202,85,92,113,119,23,16,0,0, +0,0,0,0,1,85,197,90,85,204,119,17,119,16,0,0,3,51,0,0,1,170,85,90,85,92,119,119, +119,16,0,3,59,47,51,0,1,85,197,90,85,204,124,119,199,193,0,59,187,42,169,51,53, +170,92,90,85,87,246,31,31,193,3,187,238,218,153,157,149,68,37,36,42,39,135,17, +17,17,0,62,238,217,153,51,53,85,82,36,34,167,136,97,17,16,0,3,222,217,211,0,6, +68,34,36,42,247,136,246,17,96,0,3,221,221,211,0,6,68,85,36,34,247,136,246,225, +96,0,59,187,42,169,51,53,68,133,36,42,39,136,246,209,96,3,187,238,218,153,157, +149,68,40,36,34,167,136,246,145,96,0,62,238,217,153,51,53,68,85,36,42,39,136, +246,225,96,0,3,222,217,211,0,6,68,130,36,34,167,136,246,209,96,0,3,221,221,211, +51,54,68,85,36,42,247,136,246,145,96,0,59,187,42,169,51,53,68,85,36,34,247,136, +246,225,96,3,187,238,218,153,157,149,68,34,36,42,39,136,246,209,96,0,62,238,217, +153,51,53,68,85,36,34,167,136,118,145,96,0,3,62,217,51,59,230,68,34,36,42,39, +136,201,153,16,0,0,3,51,0,50,182,68,34,36,34,167,135,106,153,16,0,0,0,0,0,3,54, +85,82,36,42,247,140,250,169,145,0,0,0,0,0,0,6,136,37,36,34,247,134,34,221,209,0, +0,0,0,0,0,0,102,72,68,42,39,134,187,238,236,0,0,0,0,0,0,0,0,102,104,34,166,102, +203,238,192,0,0,0,0,0,0,0,0,0,6,68,105,209,203,190,192,0,0,0,0,0,0,0,0,0,0,102, +1,145,28,188,0,0,0,0,0,0,0,0,0,0,0,0,0,17,16,192,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +, // 4, ammo: plasma +175,0,6,2,4,5,206,7,205,142,207,116,62,1,115,201,0,0,0,0,17,17,17,17,17,17,0,1, +16,0,0,0,0,0,0,1,52,66,66,66,68,67,16,22,97,0,0,0,0,0,0,19,67,17,17,17,17,52,17, +24,129,17,17,16,0,0,1,52,49,15,255,17,243,17,221,21,65,221,61,16,0,0,1,67,16, +250,104,143,52,51,51,53,67,61,67,16,0,0,1,65,1,166,136,190,53,68,68,67,52,67,84, +16,0,0,1,65,1,166,136,187,53,68,68,68,68,67,84,16,0,0,1,65,1,166,104,190,50,85, +85,85,85,84,37,16,0,0,1,65,0,54,102,104,50,85,85,85,85,84,37,16,0,0,1,65,0,243, +51,51,247,34,34,34,34,37,114,16,0,0,0,17,1,104,187,190,55,34,194,44,46,230,114, +16,0,0,1,17,1,166,136,139,55,34,146,41,46,138,114,16,0,0,0,17,1,166,104,142,55, +34,146,156,46,138,114,16,0,0,1,17,0,54,102,104,55,204,153,194,40,170,114,16,0,0, +0,17,0,243,51,51,247,201,34,34,34,37,114,16,0,0,1,17,1,104,187,190,55,34,44,44, +34,37,114,16,0,0,0,17,1,166,136,187,55,41,41,41,34,37,114,16,0,0,1,17,1,166,104, +190,55,41,41,41,34,37,114,16,0,0,0,17,0,54,102,104,55,44,41,146,34,37,114,16,0, +0,1,17,0,243,51,51,247,34,34,44,34,37,114,16,0,0,0,17,1,104,187,190,55,34,146, +41,34,37,114,16,0,0,1,17,1,166,136,187,55,34,146,146,34,37,114,16,0,0,1,65,1, +166,104,190,55,34,153,41,34,37,114,16,0,0,1,65,0,54,102,104,55,201,34,34,34,37, +114,16,0,0,1,65,0,243,51,51,247,146,194,34,36,37,114,16,0,0,1,65,1,104,187,190, +55,34,146,146,37,37,114,16,0,0,1,65,1,166,136,187,55,34,146,201,36,37,114,16,0, +0,1,67,17,166,104,136,55,34,153,34,34,37,114,16,0,0,1,52,61,54,102,104,55,34,34, +34,34,37,114,16,0,0,0,19,67,29,221,221,245,85,85,85,85,84,84,16,0,0,0,1,52,66, +66,66,67,51,17,19,49,17,17,16,0,0,0,0,17,17,17,17,17,17,0,1,16,0,0,0 +, // 5, tree +175,0,5,3,4,196,20,114,2,38,115,17,22,192,37,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,17,0,0,0,1,17,16,0,0,0,0,0,0,0,17,22,36,0,0,0,25, +153,145,0,0,0,0,0,0,1,36,130,36,0,0,1,153,238,81,0,0,0,0,17,17,1,34,130,36,0,0, +1,158,229,167,16,0,0,17,153,238,17,34,130,36,0,0,17,158,85,167,16,0,0,25,85,85, +81,34,131,36,0,1,193,229,90,125,16,1,0,1,21,85,81,34,40,68,1,17,193,229,167,113, +0,28,16,0,1,218,81,34,72,51,1,204,204,122,119,17,1,193,0,0,25,170,161,36,130,36, +0,17,204,103,209,241,22,16,0,1,154,173,17,40,34,36,0,0,17,204,59,179,111,16,0,0, +29,216,129,56,98,36,0,0,0,17,22,51,177,0,0,1,102,51,49,36,134,36,0,0,0,0,1,54, +61,17,17,28,99,51,177,34,72,52,0,17,17,0,29,214,104,255,182,198,51,187,177,34, +36,131,1,153,145,17,204,204,198,59,204,51,59,191,241,34,40,36,1,158,87,204,195, +60,204,204,99,51,191,17,17,34,40,36,25,149,90,115,63,220,204,99,51,191,209,85, +81,34,36,131,25,229,90,125,241,99,220,63,17,31,182,221,81,34,72,52,30,85,167, +113,22,61,204,241,209,1,31,99,209,36,134,36,30,90,167,209,102,251,198,29,113,0, +1,179,49,56,98,36,1,170,125,19,63,28,49,119,16,0,1,251,49,40,34,36,0,23,209,87, +17,28,177,17,0,0,0,31,177,36,130,36,0,1,21,167,16,22,177,0,0,0,1,145,177,34,72, +51,0,1,90,125,16,19,16,0,0,1,25,27,49,34,40,68,0,0,17,17,0,23,16,0,0,25,229,211, +49,34,131,36,0,0,0,0,1,153,17,0,0,1,26,173,49,34,130,36,0,0,0,0,25,238,87,16,0, +0,1,17,17,34,130,36,0,0,0,0,30,229,167,16,0,0,0,0,1,36,130,36,0,0,0,0,30,90,125, +16,0,0,0,0,0,17,22,36,0,0,0,0,1,167,209,0,0,0,0,0,0,0,1,17,0,0,0,0,0,17,16,0,0, +0,0,0,0,0,0,0 +, // 6, finish +175,3,4,0,5,1,2,6,50,7,198,209,48,42,44,49,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,51,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,147,3,51,51,51,51,51, +51,51,51,51,51,51,51,51,54,115,3,153,153,153,34,153,153,146,41,153,153,34,153, +153,153,115,3,119,119,119,34,119,119,114,39,119,119,34,119,119,119,67,3,68,68, +71,119,119,119,119,119,119,119,119,119,119,119,67,3,68,68,71,34,34,34,34,34,34, +34,34,34,34,34,67,53,85,85,71,40,136,136,136,136,136,136,136,136,129,68,115,49, +170,165,36,43,204,204,95,102,102,102,102,102,97,71,115,49,170,165,36,43,204,197, +246,102,102,102,102,102,97,65,67,49,161,165,36,43,187,255,216,136,136,136,136, +136,129,65,67,49,17,21,36,43,187,253,136,136,136,136,136,136,129,65,67,49,161, +165,36,43,187,253,136,136,136,136,136,136,129,65,67,49,26,21,36,43,102,129,17, +17,17,17,17,17,17,65,67,49,161,165,18,43,102,129,17,17,17,17,17,17,17,65,67,49, +17,21,18,43,102,129,17,17,17,17,17,17,17,65,67,49,170,165,18,43,17,34,34,34,34, +34,34,34,33,65,67,49,17,21,18,43,17,34,34,34,34,34,34,34,33,65,67,49,161,21,18, +43,18,68,68,68,68,68,68,68,65,65,67,49,170,165,142,43,18,68,68,68,68,68,68,68, +65,65,67,49,161,21,142,43,18,119,119,119,119,119,119,119,113,85,83,53,85,85,142, +38,18,68,68,68,68,68,68,68,65,245,83,3,102,102,97,34,34,34,34,34,34,34,34,34,33, +255,99,3,102,102,97,85,85,85,85,85,85,85,85,85,85,85,99,3,102,102,102,17,102, +102,97,22,102,102,17,102,102,102,99,3,85,85,85,17,85,85,81,21,85,85,17,85,85,86, +99,3,51,51,51,51,51,51,51,51,51,51,51,51,51,53,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3, +83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,51,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0 +, // 7, teleport +175,0,151,6,3,143,5,134,4,53,55,63,127,45,71,2,0,0,0,0,17,16,0,0,1,17,0,0,0,0,0, +0,0,0,0,1,56,17,0,0,19,129,16,0,1,17,17,16,0,0,0,1,102,129,0,0,22,104,16,0,31, +241,17,17,0,0,0,1,102,129,0,0,22,104,16,0,24,143,31,241,0,1,17,17,68,68,17,17, +20,68,65,17,19,56,248,129,0,20,51,51,51,51,51,51,51,51,51,51,143,51,246,97,0,19, +68,68,34,34,34,37,85,34,34,37,17,99,134,97,0,19,68,187,178,238,165,87,82,34,137, +204,145,68,72,129,0,19,190,37,82,39,82,34,114,85,124,119,159,68,68,65,0,19,68, +39,114,85,85,87,199,204,205,215,223,152,132,65,0,19,190,39,114,85,34,89,121,220, +205,217,223,116,79,241,0,19,69,172,206,165,34,34,85,119,204,119,212,125,70,132, +0,19,68,172,202,170,190,34,85,34,217,153,148,121,70,132,0,19,74,172,203,170,226, +34,85,34,221,153,152,121,70,132,0,19,74,170,187,170,226,34,85,37,124,119,152, +121,134,132,0,19,171,235,226,85,34,37,87,119,199,217,152,121,214,132,0,19,75, +187,178,87,34,85,119,119,199,153,157,121,214,132,0,19,68,187,187,186,34,34,85, +37,119,119,157,121,214,132,0,19,69,187,187,234,178,34,114,34,156,201,152,121, +134,132,0,19,68,90,170,170,174,34,114,34,156,201,152,121,134,132,0,19,170,74, +190,229,114,37,85,119,124,204,152,121,70,132,0,19,90,87,34,37,82,89,121,156,204, +221,157,116,68,241,0,19,68,71,34,37,85,85,119,204,205,215,159,118,51,49,0,19, +165,39,34,34,114,37,114,85,87,85,159,147,54,49,0,19,170,187,178,235,162,34,85, +34,204,153,159,99,134,97,0,19,68,68,34,34,34,34,34,34,37,85,129,131,134,97,0,20, +51,51,51,51,51,51,51,51,51,51,212,99,246,97,0,1,17,17,68,68,17,17,20,68,65,17, +24,54,246,129,0,0,0,1,102,129,0,0,22,104,16,0,19,111,24,129,0,0,0,1,102,129,0,0, +22,104,16,0,22,129,20,65,0,0,0,1,56,17,0,0,19,129,16,0,1,17,17,16,0,0,0,0,17,16, +0,0,1,17,0,0,0,0,0,0 +, // 8, computer terminal +175,0,1,85,5,4,23,6,9,26,80,65,2,84,161,194,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,17,0,1,17,17,17,17,17,17,0,1,16,0,0,0,1,116,0,22,101,101,102,102,102, +101,16,1,65,0,0,238,225,117,1,99,53,53,51,51,51,53,187,27,75,17,17,238,17,69,22, +60,129,17,17,17,17,139,83,102,74,140,158,233,154,69,22,56,148,68,68,68,73,21,51, +54,74,142,238,51,25,69,22,49,66,34,34,34,36,19,68,54,90,238,141,61,169,69,21, +177,66,242,242,34,36,19,119,54,202,131,51,218,121,69,22,49,66,242,34,34,36,31, +119,54,90,141,216,167,121,69,22,49,66,242,242,34,36,131,119,54,202,17,138,119, +73,69,22,49,66,242,34,34,36,207,119,54,90,87,119,68,89,69,22,49,66,242,34,34,36, +195,119,54,90,148,68,85,89,69,22,49,66,34,34,34,36,195,119,54,90,181,85,85,89, +69,22,49,79,255,255,255,244,195,119,54,202,185,153,149,89,69,22,49,66,34,34,34, +36,195,119,54,90,185,153,153,153,69,22,49,66,34,34,34,36,140,119,54,90,17,138, +187,153,85,22,49,66,34,34,34,36,19,119,54,202,141,216,171,187,69,21,177,66,34, +34,34,36,28,119,54,90,131,51,218,187,85,22,49,66,34,34,34,36,19,68,54,90,133,85, +93,171,149,22,56,148,68,68,68,73,21,51,54,74,141,221,93,27,89,22,60,129,17,17, +17,17,139,83,54,74,136,136,136,138,149,1,51,60,60,51,51,51,53,187,27,75,17,17, +17,17,153,0,24,140,140,136,136,136,136,16,1,65,0,0,0,1,153,0,1,17,17,17,17,17, +17,0,1,16,0,0,0,1,187,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0 +, // 9, column +175,2,4,3,5,48,6,63,51,7,81,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,65,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,20,65,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,73,16,0,0,0,0,0,0,0, +0,0,0,0,0,1,148,38,145,16,0,0,16,0,0,0,1,0,0,0,1,22,146,36,105,145,17,17,33,17, +17,17,23,17,17,17,25,150,98,36,102,67,119,119,41,121,150,102,103,119,118,121,54, +150,98,36,70,67,68,71,36,68,68,68,71,66,119,119,57,70,66,50,68,67,36,68,40,68, +68,67,34,66,36,68,52,36,66,34,34,35,51,51,40,34,50,40,34,35,50,34,52,36,66,50, +34,33,49,129,40,35,131,49,50,35,50,50,20,36,66,35,34,33,17,17,40,129,51,49,18, +51,50,131,18,36,34,51,51,49,17,24,33,19,51,17,50,56,51,131,18,34,66,50,51,49,26, +161,33,51,17,19,50,17,51,19,19,50,51,51,19,49,170,161,35,17,17,17,18,51,19,19, +19,50,35,49,19,17,161,168,34,130,35,56,34,34,33,131,17,34,33,49,50,53,85,85,37, +85,85,85,82,85,85,85,82,67,49,17,42,160,0,0,16,0,0,0,1,0,0,0,10,162,33,19,160,0, +0,0,0,0,0,0,0,0,0,0,0,10,33,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,17,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,17,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +, // 10, ruin +175,5,4,3,50,153,2,75,12,6,13,21,240,17,74,83,0,0,0,0,0,0,0,5,0,0,0,9,25,56,18, +19,0,0,0,0,0,0,0,5,0,0,0,145,34,162,56,35,0,0,0,0,0,0,0,117,0,0,0,18,19,49,35, +50,0,0,0,0,119,87,116,69,119,87,82,25,34,51,50,162,0,0,0,5,84,84,84,84,84,85,69, +154,34,34,51,34,0,0,0,0,0,0,0,117,0,0,2,145,33,177,19,50,0,0,0,0,0,0,0,236,0,0, +153,17,17,18,34,51,0,0,0,0,0,0,0,204,0,9,155,17,177,17,17,19,0,0,0,0,0,0,0,236, +0,9,17,17,34,17,17,131,0,0,0,0,0,0,17,17,17,17,17,17,161,17,17,38,0,0,0,0,0,1, +17,35,51,17,177,17,17,17,19,99,0,0,0,0,0,1,19,35,57,33,17,17,18,177,35,102,0,0, +0,0,0,2,24,51,17,17,17,18,17,17,54,102,0,0,0,7,119,124,34,56,33,177,17,27,18,18, +102,214,0,0,0,119,84,92,19,50,33,18,33,17,17,40,99,51,0,0,119,117,0,4,19,51,161, +17,17,17,27,54,70,111,0,0,0,0,0,3,35,67,49,177,33,17,18,99,18,34,0,0,0,0,0,0,34, +51,52,50,34,162,38,49,161,130,0,0,0,0,0,0,65,34,130,68,50,18,131,34,17,33,0,0,0, +0,0,0,49,35,34,52,72,34,99,18,18,42,0,0,0,0,0,0,66,35,35,56,68,214,49,34,33,34, +0,0,7,119,71,71,193,51,50,51,34,70,50,18,162,33,0,0,0,85,84,84,65,35,131,50,132, +70,33,18,34,34,0,0,0,0,0,0,49,35,51,51,52,70,34,35,51,50,0,0,0,0,0,0,51,52,68, +67,68,46,131,51,51,51,0,0,0,0,0,0,244,68,221,77,221,34,102,102,54,109,0,0,0,0,0, +0,0,7,80,0,6,18,35,238,102,102,0,0,0,0,0,0,0,7,80,0,3,18,34,243,51,230,0,0,0,0, +0,84,68,71,84,119,117,146,34,40,51,246,0,0,0,0,0,0,68,85,85,85,67,18,35,35,34, +52,0,0,0,0,0,0,0,5,80,0,0,51,51,51,51,51,0,0,0,0,0,0,0,5,0,0,0,0,51,50,51,35 +, // 11, lamp +175,0,49,31,7,106,27,28,107,3,4,105,1,2,26,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,220,16,0,0,0,0,0,0,0,0,0,0,0,0,0,1,220, +16,0,0,0,0,0,0,0,0,0,0,0,0,0,29,220,193,0,0,0,0,0,0,0,0,0,0,0,0,0,22,220,91,0,0, +0,0,0,0,0,0,17,0,1,16,85,103,146,88,85,0,0,0,0,0,0,1,33,0,22,133,51,103,146,232, +51,80,0,0,0,0,0,1,33,17,215,131,51,103,146,248,67,80,0,0,1,16,0,25,33,28,103, +132,68,103,146,248,68,59,187,177,26,33,17,153,33,28,119,132,68,231,98,232,68,55, +119,226,42,34,34,153,33,28,167,132,68,103,111,104,68,59,187,177,26,33,17,169,33, +17,167,131,51,119,98,136,67,80,0,0,1,16,0,26,33,0,23,85,51,119,111,230,51,80,0, +0,0,0,0,1,33,0,1,16,85,119,146,230,85,0,0,0,0,0,0,1,33,0,0,0,0,26,146,97,0,0,0, +0,0,0,0,0,17,0,0,0,0,26,162,241,0,0,0,0,0,0,0,0,0,0,0,0,0,1,175,16,0,0,0,0,0,0, +0,0,0,0,0,0,0,1,162,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +, // 12, access card +175,0,21,45,44,23,46,2,19,34,69,22,68,60,131,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,17,17,17,17,17,17,0,0,0,0,0,0,0,0,1, +68,17,24,102,101,86,97,0,0,0,0,0,0,0,0,1,68,17,24,102,85,86,101,16,0,0,0,0,0,0, +0,1,67,17,24,101,85,86,101,183,16,0,0,0,0,0,0,1,51,17,24,85,85,102,59,178,16,0, +0,0,0,0,0,1,51,17,24,85,86,232,219,34,240,0,0,0,0,0,0,1,51,17,24,85,86,131,130, +34,240,0,0,0,0,0,0,1,51,17,24,85,102,52,114,34,16,0,0,0,0,0,0,1,54,17,24,86,99, +56,66,34,16,0,0,0,0,0,0,1,102,17,24,86,51,141,114,34,16,0,0,0,0,0,0,1,101,17,24, +102,51,211,114,34,16,0,0,0,0,0,0,1,101,17,24,99,51,55,114,34,16,0,0,0,0,0,0,1, +85,17,24,51,51,119,226,34,16,0,0,0,0,0,0,1,85,17,24,51,52,71,34,34,16,0,0,0,0,0, +0,1,85,17,24,51,52,119,130,34,16,0,0,0,0,0,0,1,85,17,24,51,68,228,114,34,16,0,0, +0,0,0,0,1,85,17,24,52,68,66,34,34,16,0,0,0,0,0,0,1,86,17,25,52,68,66,34,34,16,0, +0,0,0,0,0,1,86,17,23,68,68,34,34,34,16,0,0,0,0,0,0,1,102,17,23,68,68,34,34,34, +16,0,0,0,0,0,0,1,99,17,23,68,153,153,114,34,16,0,0,0,0,0,0,1,99,17,23,68,154, +170,114,34,16,0,0,0,0,0,0,1,51,17,23,68,154,204,114,34,16,0,0,0,0,0,0,1,51,17, +23,68,154,204,114,34,16,0,0,0,0,0,0,1,51,17,23,68,151,119,114,34,16,0,0,0,0,0,0, +1,51,17,23,66,130,34,130,34,16,0,0,0,0,0,0,1,51,17,23,66,130,34,130,34,16,0,0,0, +0,0,0,0,17,17,17,17,17,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0 +}; + +SFG_PROGRAM_MEMORY uint8_t SFG_backgroundImages[3 * SFG_TEXTURE_STORE_SIZE] = +{ +// 0, city +64,10,73,168,19,12,14,13,80,1,72,101,0,100,136,57,17,17,17,68,87,119,119,119, +118,8,0,32,0,46,34,154,17,17,20,85,84,85,119,118,102,96,0,130,130,2,34,154,17, +17,20,65,68,69,119,102,99,48,48,0,2,32,34,154,17,17,17,17,68,68,87,118,102,102, +104,0,2,14,34,154,17,17,17,20,69,69,51,51,0,8,0,224,2,32,34,154,17,17,17,20,85, +87,60,204,195,51,0,0,0,2,34,154,17,17,17,68,85,119,252,204,51,224,48,0,0,32,34, +154,17,17,17,68,85,119,51,51,48,3,0,0,130,34,34,154,17,17,68,68,85,119,119,102, +102,104,48,40,32,32,34,154,17,17,20,69,87,119,119,102,102,102,128,128,0,2,34, +154,17,17,17,69,87,51,51,51,0,8,48,40,32,32,34,154,17,17,17,20,87,60,252,252, +243,51,0,0,128,2,34,154,65,17,17,20,85,60,204,204,51,48,48,0,32,32,34,154,17,17, +17,68,85,51,63,51,48,51,8,130,130,2,34,154,17,17,20,69,103,181,85,86,102,0,56,0, +0,46,34,154,17,17,17,69,85,187,85,91,102,3,15,0,0,2,34,154,17,17,17,68,85,187, +51,51,0,8,8,0,0,32,34,154,17,17,17,68,77,187,51,51,48,0,142,0,0,2,34,154,17,17, +17,68,77,219,51,51,0,8,48,0,0,32,34,154,17,17,65,69,51,51,60,204,195,51,224,0,0, +2,34,154,17,17,68,69,63,239,204,204,51,48,224,0,0,32,34,154,17,17,71,69,51,51, +51,51,48,240,136,128,14,2,34,154,68,17,71,68,85,221,187,219,176,8,48,40,32,46, +34,154,17,17,20,68,69,93,219,211,48,0,0,0,0,2,34,154,17,17,68,68,77,219,221,211, +0,8,48,0,224,32,34,154,65,20,69,85,84,219,221,179,48,0,136,128,0,2,34,154,17,68, +69,85,119,123,221,219,182,104,8,32,0,32,34,154,17,17,68,69,87,107,221,187,102, +102,102,128,0,2,34,154,17,17,20,85,87,107,219,190,0,8,8,0,0,32,34,154,17,17,20, +84,86,107,182,102,102,3,224,0,2,2,34,154,17,17,20,68,71,103,118,110,0,8,0,40,34, +32,34,154,17,17,17,68,71,102,103,102,102,102,104,128,0,2,34,154 +, // 1, reddish scifi interior +168,18,17,19,65,153,1,9,152,232,0,45,61,80,96,160,18,114,34,34,34,34,34,80,0,0, +0,0,0,0,0,0,18,114,34,34,34,34,34,80,0,0,0,0,0,0,0,0,0,215,34,34,34,34,34,80,0, +0,0,0,0,0,0,0,0,119,34,34,34,34,34,80,0,0,0,0,0,0,0,0,0,214,34,34,34,34,34,34, +32,0,0,0,0,0,0,0,0,118,34,34,34,34,34,34,36,69,0,0,0,0,0,0,18,118,17,17,17,17, +17,17,20,69,0,0,0,0,0,0,18,118,17,17,17,17,17,17,20,69,0,0,0,0,0,0,18,118,114, +34,34,34,34,34,116,69,0,0,0,0,0,0,18,118,130,34,34,38,0,0,0,0,0,0,0,0,0,0,18, +118,135,34,34,34,0,0,0,0,0,0,0,0,0,0,85,86,138,34,34,34,34,41,133,0,0,0,0,0,0,0, +0,86,138,17,17,17,17,25,133,85,0,0,0,0,0,0,0,86,138,17,17,17,27,25,132,70,0,0,0, +0,0,0,0,85,85,85,17,17,17,25,132,70,0,0,0,0,0,0,0,0,0,5,17,17,17,25,132,70,0,0, +0,0,0,0,0,0,0,5,17,27,17,25,132,70,0,0,0,0,0,0,0,6,128,17,17,17,17,25,132,70,0, +0,0,0,0,0,16,118,128,17,17,27,17,25,246,0,0,0,0,0,0,0,16,118,128,17,17,17,17,25, +132,0,0,0,0,0,0,0,16,118,128,51,51,51,51,57,246,0,0,0,0,0,0,0,16,118,130,51,51, +51,51,50,132,0,0,0,0,0,0,0,16,118,130,51,51,51,51,50,132,0,0,0,0,0,0,0,16,118, +131,51,51,51,51,51,132,70,0,0,0,0,0,0,0,0,5,60,51,51,51,51,36,70,0,0,0,0,0,0,0, +0,5,51,51,51,51,51,36,70,0,0,0,0,0,0,0,14,229,51,51,51,51,51,52,70,0,0,0,0,0,0, +85,85,51,195,51,51,51,51,52,64,0,0,0,0,0,0,18,114,17,17,17,17,17,17,18,64,0,0,0, +0,0,0,18,113,17,17,17,17,17,17,17,64,0,0,0,0,0,0,18,115,51,51,51,51,51,80,0,0,0, +0,0,0,0,0,18,115,51,51,51,51,51,80,0,0,0,0,0,0,0,0 +, // 2, red city at night +171,1,175,90,172,174,173,25,27,30,91,103,0,0,0,0,113,23,113,17,51,68,68,102,102, +85,82,34,34,34,38,49,113,23,113,17,51,68,68,102,102,85,82,34,34,34,35,51,113,0, +0,0,0,0,0,0,68,69,85,19,4,101,166,17,113,0,0,4,68,102,102,85,85,81,17,19,4,101, +38,54,113,0,0,4,68,102,102,85,85,81,17,19,4,101,38,51,113,0,0,4,68,102,102,85, +85,82,33,19,4,101,34,49,113,0,0,0,0,0,0,0,4,69,81,19,4,101,42,17,119,17,17,17, +17,0,4,68,102,85,85,35,4,101,42,51,135,17,17,51,51,51,0,0,0,0,68,83,4,101,34,17, +152,113,17,59,51,48,0,4,68,102,85,19,4,101,34,83,152,113,17,51,51,48,0,4,68,17, +17,19,4,101,42,51,135,113,17,51,51,48,0,4,68,17,17,19,4,101,164,17,119,17,17,59, +51,48,0,4,68,102,82,19,4,101,165,17,119,17,17,51,51,51,0,0,0,0,69,85,85,34,37, +51,119,113,17,17,17,16,4,68,102,101,82,37,85,34,34,102,119,119,17,19,51,0,4,70, +102,85,34,37,85,34,34,34,119,119,17,17,17,0,4,70,101,85,34,37,85,34,34,34,119, +17,17,17,17,16,4,70,101,82,38,17,48,70,51,34,113,16,0,0,0,0,0,0,102,102,33,17, +48,67,50,38,17,16,176,176,0,4,68,102,101,82,33,17,48,17,51,51,113,16,0,0,0,4,68, +102,101,82,33,17,48,17,51,50,113,16,0,0,0,4,68,102,101,82,38,17,48,17,51,51,135, +17,17,17,17,16,0,0,0,82,34,34,34,35,50,34,136,113,17,17,17,19,0,0,70,85,85,34, +34,36,51,36,136,113,17,16,0,3,48,0,0,0,68,102,82,36,17,17,152,135,17,16,0,0,51, +0,4,68,85,85,34,33,17,22,153,135,17,16,0,0,0,0,0,0,68,102,82,37,17,17,153,135, +17,17,17,16,0,68,70,101,1,19,4,101,81,34,152,119,16,0,0,0,4,68,64,17,17,19,4, +101,34,36,152,119,16,0,0,0,0,68,70,101,1,19,4,101,35,51,135,119,16,0,0,0,0,4,70, +101,85,34,34,34,35,54,119,23,16,0,0,0,0,0,0,4,69,82,34,34,35,51 +}; + +SFG_PROGRAM_MEMORY uint8_t SFG_weaponImages[6 * SFG_TEXTURE_STORE_SIZE] = +{ +// 0, knife +175,0,5,2,6,4,3,83,1,77,85,61,60,62,63,75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,1,153,163,16,0,0,0,0,0,0,0,0,0,0,0,0,1,170, +167,16,0,0,0,0,0,0,0,0,0,0,0,0,1,154,151,16,0,0,0,0,0,0,0,0,0,0,0,0,0,26,119,16, +0,0,0,0,0,0,0,0,0,0,1,17,17,58,119,16,0,0,0,0,0,0,0,0,1,17,20,78,219,57,115,16, +0,0,0,0,0,0,0,17,29,68,68,68,219,57,49,17,17,0,0,0,0,0,17,34,68,238,68,68,219, +57,131,102,102,0,0,0,0,17,85,34,68,68,68,68,43,63,134,102,102,0,0,0,17,34,85,36, +68,78,66,34,37,63,54,102,102,0,0,17,34,36,34,34,36,68,213,188,86,63,54,51,51,0, +1,34,36,43,181,82,34,34,43,44,86,63,51,51,51,0,18,36,69,204,205,34,68,66,34,85, +86,63,51,51,51,1,34,75,204,85,180,68,68,68,37,82,86,63,51,51,51,1,36,188,181,91, +45,222,238,210,85,34,86,63,131,51,136,22,102,102,101,101,82,46,66,34,85,85,86, +57,136,136,136,17,17,17,129,17,17,18,82,38,85,101,86,57,56,136,136,0,0,0,0,0,0, +1,18,83,92,133,83,57,120,17,17,0,0,0,0,0,0,0,8,136,83,22,83,58,119,128,0,0,0,0, +0,0,0,0,0,0,17,1,104,57,119,128,0,0,0,0,0,0,0,0,0,0,0,0,17,58,119,128,0,0,0,0,0, +0,0,0,0,0,0,0,0,26,119,16,0,0,0,0,0,0,0,0,0,0,0,0,1,154,151,16,0,0,0,0,0,0,0,0, +0,0,0,0,1,170,167,16,0,0,0,0,0,0,0,0,0,0,0,0,1,153,163,16,0,0,0,0,0,0,0,0,0,0,0, +0,0,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +, // 1, shotgun +175,1,3,4,6,101,5,17,7,100,2,99,19,21,25,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,17,0, +0,0,0,0,0,0,0,0,0,0,0,17,17,121,153,0,0,0,0,0,0,0,0,0,0,1,17,100,55,149,85,0,0, +0,0,0,0,0,0,1,17,22,67,70,121,85,221,0,0,0,0,0,0,0,17,19,52,136,65,38,123,85, +221,0,0,0,0,0,17,17,102,104,132,68,97,38,123,149,93,0,0,0,0,17,70,68,136,68,52, +136,52,70,123,149,93,0,0,0,1,68,36,132,72,131,100,67,54,99,123,185,93,0,0,0,20, +68,36,136,136,67,54,34,97,35,126,185,85,0,0,0,24,138,72,132,102,102,34,163,49, +35,126,235,85,0,0,1,68,74,68,70,102,102,51,51,51,51,39,170,85,0,0,1,68,67,67,51, +51,51,50,34,34,33,42,126,149,0,0,113,19,51,163,34,34,34,34,34,34,33,42,119,149, +0,5,190,225,47,162,242,255,255,255,250,250,175,167,113,233,0,7,119,238,238,119, +119,119,23,23,17,17,17,113,17,238,0,0,1,238,239,255,204,204,204,204,204,204,255, +167,113,233,0,7,119,238,236,153,149,85,85,85,85,85,153,204,113,149,0,5,190,225, +51,242,34,34,34,34,34,34,33,34,119,149,0,0,113,20,67,52,68,136,68,70,102,51,49, +34,123,85,0,0,1,136,138,72,136,136,136,132,68,136,136,98,121,85,0,0,1,68,74,100, +68,68,132,72,136,65,40,103,185,93,0,0,0,19,58,52,102,102,68,51,52,65,38,55,149, +93,0,0,0,22,102,166,51,51,58,35,34,100,70,123,85,221,0,0,0,1,102,51,51,35,58, +162,42,163,51,123,85,221,0,0,0,0,17,34,102,50,34,175,34,161,34,123,149,93,0,0,0, +0,0,17,17,38,102,99,50,161,42,123,149,93,0,0,0,0,0,0,0,17,19,50,102,106,42,123, +185,85,0,0,0,0,0,0,0,0,1,17,18,58,58,126,185,85,0,0,0,0,0,0,0,0,0,0,1,17,51,167, +235,85,0,0,0,0,0,0,0,0,0,0,0,0,17,17,122,153,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,17, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +, // 2, machine gun +175,4,2,3,0,1,5,6,60,59,50,53,61,62,73,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,68,68,68,64,0,0,0,0, +0,0,0,0,0,0,0,68,18,34,85,84,68,68,64,0,0,0,0,0,0,0,4,113,34,37,85,87,119,19, +164,0,0,0,0,0,0,0,71,18,37,85,114,39,113,49,245,0,0,0,0,0,0,0,65,85,87,34,119, +119,17,17,37,0,0,0,0,0,0,4,85,114,39,119,119,118,22,19,37,0,0,0,0,0,0,71,119, +119,17,97,140,177,17,50,37,0,0,0,0,0,4,97,17,51,49,17,27,177,51,162,85,0,0,0,0, +68,66,17,19,51,152,50,35,51,162,85,85,0,0,4,68,104,99,17,58,35,136,22,22,49,51, +134,102,0,4,71,151,135,115,19,147,49,17,102,102,17,51,17,22,0,4,233,40,56,210, +19,51,49,17,102,97,17,51,17,17,0,4,66,35,33,18,19,51,17,22,102,17,22,51,17,17,0, +0,4,68,50,53,147,23,118,102,102,17,102,51,129,17,0,0,0,0,68,69,147,49,17,103, +119,103,113,162,85,85,0,0,0,0,0,4,41,17,22,102,17,22,195,51,162,85,0,0,0,0,0,0, +66,34,34,51,54,108,131,51,50,37,0,0,0,0,0,0,4,69,37,82,34,34,35,49,51,37,0,0,0, +0,0,0,0,65,85,82,85,34,34,49,19,37,0,0,0,0,0,0,0,65,34,85,85,37,82,35,51,37,0,0, +0,0,0,0,0,4,18,34,85,85,82,34,51,36,0,0,0,0,0,0,0,0,68,18,37,85,84,68,68,64,0,0, +0,0,0,0,0,0,0,68,68,68,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +, // 3, rocket launcher +175,0,115,2,37,7,25,117,6,116,114,21,5,38,39,1,0,0,0,0,0,0,0,0,0,0,0,0,0,17,17, +0,0,0,0,0,0,0,0,0,0,0,0,17,17,196,51,16,0,0,0,0,0,0,0,0,0,0,1,136,140,67,195,16, +0,0,0,0,0,0,0,0,0,0,1,68,68,67,195,16,0,0,0,0,0,0,0,0,0,0,1,51,51,51,63,17,0,0, +0,0,1,17,16,0,0,0,17,255,255,255,255,250,0,0,0,17,19,51,49,16,17,17,119,121,255, +170,175,164,0,0,17,204,51,51,51,49,119,119,121,146,175,74,148,68,0,1,204,51,102, +98,146,151,146,146,34,41,40,153,119,119,0,27,195,54,98,34,34,34,41,153,153,121, +135,119,119,119,1,184,51,102,41,151,41,153,41,119,116,68,132,77,221,221,1,136, +54,103,119,114,119,114,116,77,220,72,222,221,237,221,1,86,102,39,68,66,34,34,72, +136,136,69,136,136,136,142,24,86,102,125,68,204,200,136,136,136,142,69,142,238, +238,102,21,86,99,126,238,229,85,85,85,85,85,197,85,85,102,221,21,83,51,126,229, +85,85,85,85,85,85,197,85,86,221,187,24,83,51,116,68,68,221,221,221,221,238,69, +238,103,219,68,28,83,51,34,68,68,68,71,119,119,68,72,221,109,180,68,28,131,54, +34,34,34,41,153,153,151,116,152,68,103,116,68,1,131,102,98,34,34,34,34,34,34, +153,40,153,103,180,68,1,203,102,54,170,162,34,34,34,34,34,40,34,103,180,68,1, +204,51,51,102,170,170,170,170,34,34,34,130,103,180,68,0,28,195,51,54,255,102, +102,106,170,170,162,130,109,180,68,0,1,204,51,51,54,255,99,54,102,102,170,40, +109,187,68,0,0,17,204,51,51,51,49,246,54,102,102,40,103,187,68,0,0,0,17,19,51, +49,16,17,17,102,102,54,109,187,187,0,0,0,0,1,17,16,0,0,0,17,17,243,103,187,187, +0,0,0,0,0,0,0,0,0,0,0,0,17,107,180,75,0,0,0,0,0,0,0,0,0,0,0,0,0,18,180,68,0,0,0, +0,0,0,0,0,0,0,0,0,0,22,43,119,0,0,0,0,0,0,0,0,0,0,0,0,0,1,18,34,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,1,17 +, // 4, plasma gun +175,4,6,3,0,5,50,17,49,187,7,190,37,42,209,100,0,0,0,0,0,0,0,0,0,0,0,0,4,64,0, +68,0,0,0,0,0,0,0,0,0,0,68,0,76,148,68,170,0,0,0,0,0,0,0,4,64,4,198,64,70,106, +162,34,0,0,0,0,0,0,0,76,100,4,195,52,170,170,34,34,0,0,0,0,0,0,4,201,103,68,58, +170,162,34,34,102,0,0,0,0,68,0,4,195,55,170,90,34,34,51,102,17,0,0,0,68,85,64, +68,58,170,162,82,34,38,49,17,17,0,0,68,37,85,68,90,165,34,37,34,34,97,17,19,119, +0,4,34,85,68,170,82,34,85,82,34,37,113,17,55,34,0,74,37,136,170,85,34,34,34,34, +34,83,17,19,85,85,4,162,40,170,162,34,37,85,51,118,115,49,17,85,17,153,4,136, +136,134,102,102,99,49,17,19,17,19,21,89,187,187,74,37,17,17,17,17,17,17,17,17, +49,17,53,155,151,119,69,19,136,135,118,97,21,85,85,85,53,85,49,185,114,82,66,85, +81,56,150,150,22,22,145,105,22,145,27,183,34,21,66,85,17,56,185,185,185,185,187, +155,185,187,187,183,37,21,66,81,19,56,150,150,22,22,145,105,22,145,27,183,85,21, +65,51,136,135,118,97,21,85,85,85,53,85,49,185,113,49,69,17,18,34,34,34,34,34,34, +34,50,34,53,155,151,119,4,136,134,102,102,102,51,85,85,35,34,35,37,89,187,187,4, +17,56,17,17,17,17,19,103,103,119,114,34,85,17,153,0,67,51,136,51,136,17,17,17, +17,17,23,34,35,85,85,0,4,51,51,68,136,131,17,136,209,17,17,114,34,55,34,0,0,68, +56,136,68,232,62,51,61,17,17,111,34,35,119,0,0,0,119,136,64,68,119,136,51,131, +49,22,245,34,34,0,0,0,0,68,0,4,198,120,135,227,51,49,102,102,82,0,0,0,0,0,0,4, +201,103,68,119,115,51,51,51,214,0,0,0,0,0,0,0,76,148,4,201,68,115,51,51,51,0,0, +0,0,0,0,0,4,64,4,198,64,70,103,51,51,0,0,0,0,0,0,0,0,0,0,68,0,76,148,68,115,0,0, +0,0,0,0,0,0,0,0,0,0,4,64,0,68,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +, // 5, solution +6,76,175,26,48,5,4,7,57,77,75,27,58,68,2,28,34,34,34,34,34,34,34,34,40,235,180, +34,36,68,66,68,34,34,34,68,68,34,34,34,71,119,119,66,67,51,52,17,34,34,68,53,86, +68,68,46,112,87,119,4,56,136,51,170,34,34,69,102,54,102,102,135,0,87,7,99,132, +174,131,170,34,34,64,182,51,54,103,112,0,87,0,99,134,108,234,170,34,34,64,96, +181,51,112,0,0,87,0,83,134,119,58,170,34,34,69,176,96,183,0,0,5,21,80,3,62,7, +124,170,34,68,69,54,102,112,0,5,105,145,21,0,54,0,7,202,68,85,104,136,55,0,0,97, +17,153,17,85,0,0,0,124,64,54,102,104,135,0,6,17,29,25,17,17,85,0,0,7,64,179,51, +54,103,0,81,17,17,17,153,17,25,80,0,0,64,101,182,51,55,0,81,17,26,17,217,145,17, +23,0,5,64,240,96,246,55,0,101,17,17,17,25,145,17,23,0,92,69,176,240,96,55,0,105, +81,218,209,209,153,17,23,0,202,68,70,54,181,48,0,97,150,144,154,13,153,17,23,0, +198,34,36,136,56,48,85,97,29,125,122,122,25,145,16,85,134,34,36,72,131,128,0,97, +29,1,13,10,17,145,23,0,134,68,70,51,51,48,80,97,26,145,144,157,17,25,23,0,138, +69,102,54,53,176,80,97,17,169,170,209,17,25,151,0,138,69,176,176,240,183,85,97, +17,25,145,17,17,17,151,0,88,64,240,96,101,183,5,81,17,26,153,209,17,17,112,0,5, +69,101,245,179,135,0,85,17,17,25,145,17,80,0,0,0,69,51,238,136,135,0,5,81,26,25, +97,7,5,0,0,6,68,136,136,131,55,0,0,85,81,17,151,0,0,80,0,60,34,68,133,54,54,112, +0,85,5,16,112,0,102,5,99,204,34,34,69,176,245,55,0,5,80,87,0,5,51,102,60,204,34, +34,64,240,182,51,112,0,85,87,0,6,56,51,204,202,34,34,64,182,51,56,135,112,5,87, +0,99,56,142,236,170,34,34,69,51,136,136,136,71,5,96,5,99,52,174,131,170,34,34, +68,136,136,68,68,36,112,102,99,136,51,56,131,170,34,34,34,68,68,34,34,34,70,102, +51,66,72,51,52,17,34,34,34,34,34,34,34,34,36,68,68,34,36,68,66,68 +}; + +SFG_PROGRAM_MEMORY uint8_t SFG_effectSprites[4 * SFG_TEXTURE_STORE_SIZE] = +{ +// 0, explostion +175,183,174,15,103,111,191,7,31,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,48,0,0,0, +0,0,0,0,0,0,0,0,3,3,3,3,19,3,0,0,0,0,0,0,0,0,0,48,48,16,51,49,19,48,48,0,0,0,0, +0,0,0,3,3,1,1,19,17,131,51,49,0,0,0,0,1,16,0,0,48,50,34,20,85,120,49,17,64,0,0, +0,0,65,1,0,0,34,17,69,87,117,17,33,16,0,0,0,0,4,16,16,4,18,17,21,87,85,18,33,16, +0,0,0,1,9,34,34,17,34,17,21,85,85,66,17,48,0,0,0,65,18,34,34,17,65,22,85,86,68, +65,19,51,0,0,48,17,34,34,33,18,65,68,70,68,68,102,67,51,0,1,19,49,34,34,33,18, +36,132,100,70,97,20,81,17,51,48,17,18,34,18,18,34,33,119,85,86,97,33,81,51,48,3, +51,18,33,17,34,33,37,119,85,100,97,18,35,51,0,48,49,34,18,34,33,102,87,119,117, +97,17,34,34,16,48,1,17,18,33,17,22,104,119,119,117,81,18,18,33,67,0,1,65,18,33, +20,71,119,119,119,119,132,65,18,34,64,48,0,69,81,17,86,69,88,119,119,133,81,17, +18,34,147,0,0,56,21,69,86,70,103,119,119,116,17,18,34,34,144,0,3,51,56,86,102, +102,120,118,101,120,81,34,34,35,0,0,48,51,17,85,102,102,103,70,102,136,85,34,34, +17,0,0,3,49,19,53,84,102,100,70,102,88,133,84,66,17,19,0,48,51,51,85,68,102,68, +102,102,101,97,33,68,19,17,48,3,3,49,81,36,84,17,70,101,82,33,18,33,67,51,0,0, +51,49,17,33,33,33,70,102,66,34,34,34,17,51,48,0,3,17,18,34,33,34,20,129,18,34, +34,34,34,51,0,0,49,17,34,33,17,17,33,65,34,34,17,18,34,19,48,0,1,18,33,17,17,17, +34,34,33,145,17,18,34,19,48,0,1,17,17,19,49,49,18,17,49,19,49,18,34,35,51,0,0, +17,51,51,17,49,18,19,3,19,51,17,17,36,3,0,3,51,51,48,48,3,17,16,48,17,3,51,17, +16,0,0,3,48,3,3,0,0,16,19,0,0,0,51,51,0,0,0,51,0,0,0,0,0,1,3,48,0,51,51,48,0,0 +, // 1, fireball +175,103,183,7,191,111,254,31,95,180,173,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,17,0,16,0,0,0,0, +0,0,0,0,0,0,1,1,23,17,17,24,1,0,0,0,0,0,0,0,0,0,16,16,23,85,87,81,24,16,0,0,0,0, +0,0,0,1,8,17,119,115,55,119,17,129,16,0,0,0,0,0,0,0,129,23,119,51,51,55,113,24, +23,0,0,0,0,0,0,8,17,17,113,83,51,85,119,23,113,0,0,0,0,0,0,1,21,113,81,19,53,81, +17,119,129,0,0,0,0,0,0,17,19,53,17,19,50,17,17,113,16,16,0,0,0,0,1,33,83,49,17, +19,66,34,17,17,18,0,0,0,0,0,0,33,85,53,21,19,18,34,34,24,18,16,0,0,0,0,1,33,85, +85,84,68,20,34,35,66,98,0,0,0,0,0,0,33,83,53,20,68,51,51,51,70,34,16,0,0,0,0,1, +33,19,49,66,36,67,52,41,40,98,0,0,0,0,0,0,33,19,84,34,36,36,70,38,134,34,0,0,0, +0,0,0,8,21,81,18,36,66,98,102,166,32,0,0,0,0,0,0,2,21,81,18,68,68,38,134,105,33, +0,0,0,0,0,0,0,18,33,18,68,51,73,102,98,16,0,0,0,0,0,0,0,18,18,34,68,51,74,102, +102,16,0,0,0,0,0,0,0,1,17,18,34,36,38,38,129,0,0,0,0,0,0,0,0,0,8,134,38,34,34, +104,0,0,0,0,0,0,0,0,0,0,0,2,34,102,96,16,0,0,0,0,0,0,0,0,0,0,0,0,1,16,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0 +, // 2, plasma +175,199,126,213,198,215,118,46,125,204,124,134,45,117,135,116,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,1,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,68,16,0,0,0,0,0,0,0,0,0,0,16, +1,17,20,17,16,16,16,0,0,0,0,0,0,0,17,18,7,113,20,17,119,1,1,0,0,0,0,0,0,1,17,65, +16,34,67,50,33,17,16,0,0,0,0,0,0,1,36,34,1,19,153,51,33,65,0,0,0,0,0,0,0,14,37, +34,32,51,57,163,35,50,16,0,0,0,0,0,0,114,37,82,2,17,51,170,51,34,17,0,0,0,0,0,0, +18,51,83,34,17,3,152,138,43,178,16,0,0,0,0,1,20,34,52,83,163,32,123,136,199,34, +17,0,0,0,0,1,17,18,35,51,51,34,18,34,194,36,68,0,0,0,0,0,17,17,104,109,250,51, +18,34,34,51,17,0,0,0,0,1,7,113,34,134,136,34,211,70,34,131,17,0,0,0,0,0,16,34, +34,134,34,34,97,17,102,98,16,0,0,0,0,0,1,18,85,84,17,98,97,33,22,98,1,0,0,0,0,1, +17,37,83,242,68,70,18,146,33,23,16,0,0,0,0,1,50,53,35,134,133,65,39,185,37,17,1, +0,0,0,0,0,19,147,34,136,51,81,39,190,36,65,32,0,0,0,0,0,17,18,34,131,34,83,39,0, +35,34,32,0,0,0,0,1,1,17,34,34,34,57,50,114,49,34,0,0,0,0,0,0,16,17,34,34,83,147, +67,33,64,0,0,0,0,0,0,0,1,2,33,35,81,17,68,68,65,0,0,0,0,0,0,0,0,2,33,21,17,17, +17,17,16,0,0,0,0,0,0,0,0,0,0,20,65,0,1,17,0,0,0,0,0,0,0,0,0,0,0,1,65,16,0,16,0, +0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +, // 3, dust +175,5,3,4,53,2,6,52,50,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,2,34,0,0,16, +1,0,0,0,0,0,0,0,0,0,0,34,50,32,3,48,0,0,0,0,0,0,0,0,0,0,2,35,50,16,66,18,0,0,0, +0,0,0,0,1,16,0,2,49,51,4,4,2,82,34,0,0,0,0,0,0,1,16,0,49,49,32,64,18,81,51,32,0, +0,0,0,0,0,0,0,3,22,55,97,18,33,19,48,0,0,0,0,0,0,0,0,0,6,19,50,34,19,17,48,0,0, +0,0,0,0,1,51,17,17,99,35,129,51,50,0,0,0,0,0,0,0,0,1,55,0,7,50,4,34,32,1,0,0,0, +0,0,0,0,3,112,64,2,64,32,98,0,0,0,0,0,0,0,0,0,9,52,4,3,4,4,5,0,0,0,0,0,0,0,0,0, +18,64,34,49,0,32,18,1,16,0,0,0,0,0,0,0,18,34,35,19,32,18,50,0,1,16,0,0,0,0,0,0, +0,37,19,34,136,18,51,16,0,0,0,0,0,0,0,0,0,5,35,49,51,1,0,16,0,0,0,0,0,0,0,0,0,1, +17,19,34,0,0,0,0,0,0,0,0,0,0,0,0,0,34,18,32,0,0,0,0,0,0,0,0,0,0,0,1,0,0,34,0,1, +0,0,0,0,0,0,0,0,0,0,16,0,16,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,16,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +}; + +SFG_PROGRAM_MEMORY uint8_t SFG_monsterSprites[19 * SFG_TEXTURE_STORE_SIZE] = +{ +// 0, spider idle +175,0,4,3,5,6,223,1,7,10,2,20,62,95,120,18,0,1,17,16,0,0,0,0,0,0,0,0,1,17,16,0, +0,20,45,65,0,0,0,0,0,0,0,0,21,52,33,0,1,65,170,20,16,0,0,0,0,0,0,17,133,50,51, +16,1,218,211,162,16,0,0,0,0,0,17,133,84,17,17,17,1,42,61,173,16,1,0,0,0,1,133, +84,33,0,0,0,1,65,170,20,17,1,16,0,1,24,85,73,16,0,0,0,0,20,210,71,119,19,81,0,0, +1,19,146,16,0,0,0,1,115,17,115,115,68,65,0,0,0,1,66,49,0,0,0,20,36,119,41,37,69, +85,16,0,0,1,66,49,17,17,0,18,50,115,21,85,68,68,33,0,1,17,51,133,52,66,16,20,45, +113,28,197,66,66,65,1,24,136,85,85,50,35,49,1,17,37,86,198,196,34,33,0,1,85,85, +68,153,153,145,0,21,85,70,140,102,34,34,16,0,147,57,147,51,35,16,0,17,119,60, +104,102,98,34,46,238,191,66,243,17,17,17,1,57,115,115,38,108,198,34,231,243,187, +116,33,0,0,0,18,49,153,151,34,104,198,62,255,59,180,51,112,0,0,0,18,49,51,55,34, +104,198,62,255,59,180,51,112,0,0,0,1,57,121,115,38,108,198,34,231,243,187,116, +33,0,0,0,0,17,119,60,104,102,98,34,46,238,191,66,147,17,17,17,0,21,85,70,140, +102,34,34,16,0,148,41,147,51,35,16,1,17,37,86,198,196,34,33,0,1,136,136,133,153, +153,145,20,45,113,28,197,66,66,65,1,21,85,85,85,52,66,49,18,50,115,21,85,84,68, +33,0,1,17,51,133,50,35,16,20,36,119,41,37,85,85,16,0,0,1,66,55,17,17,0,1,115,17, +115,115,68,65,0,0,0,1,66,49,0,0,0,0,20,45,71,119,19,81,0,0,1,19,50,16,0,0,0,1, +65,170,20,17,1,16,0,1,24,136,137,16,0,0,0,1,218,61,162,16,1,0,0,0,1,133,85,129, +0,0,0,1,42,211,173,16,0,0,0,0,0,17,69,85,17,17,17,1,65,170,20,16,0,0,0,0,0,0,17, +69,50,35,16,0,20,210,65,0,0,0,0,0,0,0,0,20,50,49,0,0,1,17,16,0,0,0,0,0,0,0,0,1, +17,16,0 +, // 1, spider attacking +175,0,183,3,4,1,191,5,31,6,7,22,10,223,20,18,0,34,37,85,43,176,0,0,0,0,0,0,17, +17,16,0,0,34,98,34,38,102,0,0,0,0,0,1,148,71,65,16,0,2,98,34,102,98,0,0,0,0,0, +89,169,52,51,49,0,2,104,40,102,32,0,0,0,0,5,170,145,17,17,16,2,38,104,136,98,32, +80,0,0,0,90,167,65,0,0,0,2,102,102,102,102,34,85,0,0,5,184,124,16,0,0,0,2,102, +34,34,102,102,232,80,0,91,139,76,16,0,0,0,2,34,46,34,38,102,187,113,0,85,84,196, +49,17,17,0,0,91,235,85,34,107,136,145,0,0,5,115,19,71,116,16,0,94,238,94,88,139, +139,116,80,0,85,58,169,52,67,49,0,23,75,85,91,184,231,71,80,5,170,153,119,60, +204,17,0,1,21,232,141,141,116,68,16,88,137,119,204,195,49,0,0,1,153,136,189,169, +212,68,65,1,195,60,51,51,67,16,0,1,17,85,55,218,221,212,68,85,95,116,243,49,17, +17,0,19,197,51,83,77,217,125,69,95,62,87,65,16,0,0,1,67,49,204,197,68,218,157, +95,243,235,51,80,0,0,0,1,67,193,51,53,68,218,157,95,243,235,51,80,0,0,0,0,19, +197,204,83,77,217,125,69,95,62,87,65,16,0,0,0,1,17,85,55,218,221,212,68,85,95, +116,243,49,17,17,0,1,153,153,125,168,221,68,65,5,51,60,51,51,67,16,0,1,17,232, +141,141,190,68,16,90,170,170,204,195,49,0,0,23,75,85,91,184,235,71,85,5,183,153, +170,60,204,17,0,94,238,94,88,184,187,116,80,0,85,55,153,52,67,49,2,43,235,82,34, +136,136,145,0,0,1,115,19,71,116,16,2,34,82,34,98,46,187,113,0,85,83,196,49,17, +17,0,2,98,34,38,102,44,232,16,0,91,170,124,16,0,0,0,2,102,102,102,98,37,85,0,0, +5,185,172,16,0,0,0,2,38,136,134,34,80,80,0,0,0,88,167,65,0,0,0,0,182,136,134,98, +80,0,0,0,0,5,185,145,17,17,16,0,34,102,102,102,32,0,0,0,0,0,87,153,52,51,49,0,2, +98,34,102,107,0,0,0,0,0,1,116,71,65,16,0,2,37,82,43,32,0,0,0,0,0,0,17,17,16,0 +, // 2, spider walking +175,0,4,5,6,3,223,1,10,7,2,18,62,95,120,63,0,0,17,17,0,0,0,0,0,0,0,1,17,17,0,0, +0,1,50,211,16,0,0,0,0,0,0,21,51,50,16,0,0,19,26,161,49,0,0,0,0,0,17,146,35,33,0, +0,0,29,173,90,33,0,0,0,0,1,148,68,81,16,0,0,0,18,165,218,209,0,16,0,0,25,67,49, +16,0,0,0,0,19,26,161,49,16,17,0,1,148,51,16,0,0,0,0,0,1,61,35,119,113,84,16,25, +68,56,0,0,0,0,0,0,23,81,23,87,83,51,16,17,21,129,0,0,0,0,0,1,50,55,114,130,67, +68,65,0,1,50,16,0,0,0,0,1,37,39,81,68,67,51,50,0,1,85,81,17,17,17,0,1,50,215,17, +204,67,35,35,16,25,153,148,68,83,50,16,0,17,18,68,111,108,50,34,16,1,68,68,68, +82,37,81,0,1,68,67,105,246,98,34,33,0,133,88,136,136,136,129,0,1,23,117,198,150, +102,34,34,238,227,37,181,17,0,0,0,21,135,87,82,102,252,98,46,123,91,50,81,0,0,0, +1,37,24,136,114,38,159,101,235,181,35,181,112,0,0,0,1,37,24,136,114,38,159,101, +235,181,35,181,112,0,0,0,0,21,135,87,82,102,252,98,46,123,83,123,33,0,0,0,0,1, +23,117,198,150,102,34,34,238,235,50,133,17,17,0,0,1,68,67,105,246,98,34,33,0, +131,40,85,85,34,16,0,17,18,68,111,108,50,34,16,1,148,33,17,17,17,0,1,50,215,17, +204,67,35,35,16,25,50,16,0,0,0,0,1,37,39,81,68,67,51,50,17,148,72,136,128,0,0,0, +1,50,55,114,130,67,68,65,20,68,73,148,136,128,0,0,0,23,81,23,87,83,51,16,1,17, +84,68,83,56,129,0,0,1,61,35,119,113,84,16,0,5,21,68,82,34,81,0,0,19,26,161,49, +16,17,0,0,20,66,87,18,37,16,0,0,18,165,218,209,0,16,0,0,1,84,52,65,17,81,17,0, +29,173,90,33,0,0,0,0,0,17,19,52,82,37,16,0,19,26,161,49,0,0,0,0,0,0,1,19,82,81, +0,0,1,50,211,16,0,0,0,0,0,0,0,1,17,16,0,0,0,17,17,0,0,0,0,0,0,0,0,0,0,0,0 +, // 3, destroyer idle +0,175,3,4,5,73,1,6,2,77,157,79,7,78,76,75,17,0,0,0,17,17,17,17,17,17,17,17,17, +17,17,17,17,11,221,219,0,17,17,17,16,0,0,0,0,0,1,17,17,11,217,153,219,1,17,16,2, +119,114,39,116,119,1,17,17,11,189,154,155,1,16,12,194,124,204,204,199,204,1,17, +17,16,189,154,169,176,12,199,116,35,51,51,50,51,1,17,17,17,11,217,170,213,196, +68,67,34,34,34,40,34,0,0,17,16,11,217,154,149,52,50,50,0,0,0,0,0,4,64,17,7,118, +102,138,173,83,68,128,17,17,17,17,7,114,32,16,116,12,66,106,169,181,51,71,0,1, +17,0,115,56,128,16,67,0,102,102,42,213,35,52,71,112,0,119,51,40,128,7,48,194,0, +7,114,171,82,51,68,71,114,83,34,40,128,4,12,204,64,0,71,106,181,131,52,68,71,82, +34,40,80,4,12,199,114,192,36,70,157,184,52,119,116,37,40,133,80,0,204,119,119, +96,4,70,169,213,55,51,55,69,80,102,96,0,102,103,116,44,4,50,106,155,83,157,147, +117,34,0,0,2,9,230,68,32,3,50,106,173,83,57,211,53,34,1,17,2,11,150,68,48,3,50, +106,233,83,57,211,53,34,1,17,0,34,36,67,44,3,50,106,238,83,157,147,37,34,128,0, +0,119,68,67,128,3,54,254,229,34,51,50,53,88,50,32,6,7,68,50,192,131,38,174,245, +35,34,35,37,34,40,128,2,4,68,48,0,50,111,229,82,51,51,50,82,34,40,128,3,32,66,0, +3,38,254,86,130,34,34,34,88,34,40,128,16,50,0,0,0,111,229,104,34,40,133,85,104, +136,40,80,16,51,99,38,105,154,245,130,40,96,82,67,6,102,133,80,17,3,54,102,137, +238,88,134,96,17,7,66,6,0,101,80,17,16,13,187,154,229,102,104,36,0,116,72,128, +17,6,96,17,17,11,186,170,245,96,130,51,71,67,34,32,17,16,0,17,16,187,218,174, +240,5,130,51,51,51,50,80,17,17,17,17,11,189,170,175,1,16,5,34,34,34,80,1,17,17, +17,17,11,221,170,255,1,17,16,85,85,0,1,17,17,17,17,17,11,218,255,0,17,17,17,0,0, +17,17,17,17,17,17,17,0,0,0,17,17,17,17,17,17,17,17,17,17,17,17 +, // 4, destroyer attacking +175,0,3,4,73,1,5,2,183,6,77,157,79,78,7,31,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0, +17,17,17,0,0,0,0,0,136,136,128,0,0,0,0,0,28,221,220,17,0,0,0,8,136,136,128,0,0, +0,0,0,28,218,170,220,16,1,88,136,136,255,136,128,0,0,0,0,28,218,187,172,85,94, +238,136,136,255,136,128,0,0,0,0,28,218,187,187,215,105,255,248,136,136,136,0,0, +0,0,0,1,221,171,187,163,102,255,255,136,136,136,0,0,1,17,0,25,17,85,87,189,38, +99,99,56,136,0,0,17,86,97,1,150,37,230,37,186,195,51,35,56,0,0,17,255,146,33,1, +99,37,85,85,82,211,35,54,98,17,17,249,99,55,113,25,51,94,33,17,153,44,50,51,111, +255,243,70,50,39,113,22,53,238,230,17,22,148,195,115,54,153,159,114,34,39,113, +19,49,238,153,46,18,102,125,151,57,51,57,100,34,39,65,19,94,233,153,149,17,102, +90,215,51,173,163,148,68,116,65,18,21,85,153,98,225,99,37,172,67,58,211,52,39, +69,81,19,33,163,86,98,17,51,37,189,67,58,211,52,34,17,17,18,33,202,86,99,17,51, +37,58,67,173,163,36,34,16,0,19,18,34,102,50,225,51,37,58,66,51,50,52,34,113,17, +18,89,150,102,55,17,51,82,52,35,34,35,36,71,50,33,19,33,150,99,46,23,50,82,36, +35,51,50,116,34,39,113,19,37,102,99,17,19,37,36,66,51,50,39,66,34,39,113,19,34, +22,33,17,50,82,69,114,34,36,68,71,34,39,113,1,50,81,17,85,85,36,87,34,39,66,99, +23,119,39,65,1,51,37,50,87,171,68,21,81,119,25,98,21,85,116,65,0,19,51,85,123, +50,65,87,38,17,150,103,113,17,84,65,0,1,92,202,171,52,81,35,51,105,99,34,33,0, +21,81,0,1,204,219,187,36,20,114,51,51,51,50,65,0,1,17,0,28,205,219,178,65,20, +119,34,34,34,65,16,0,0,0,0,28,205,187,36,16,1,20,68,68,65,16,0,0,0,0,0,28,219, +187,33,0,0,1,17,17,16,0,0,0,0,0,0,28,219,177,16,0,0,0,0,0,0,0,0,0,0,0,0,17,17, +16,0,0,0,0,0,0,0,0,0,0,0,0 +, // 5, destroyer walking +175,0,3,4,1,5,2,73,6,77,79,7,78,157,75,76,0,17,17,17,0,0,0,0,0,0,0,0,0,0,0,0,0, +26,204,202,17,0,0,1,17,17,17,0,0,0,0,0,0,26,201,153,202,16,1,19,136,130,33,17, +17,0,0,0,0,26,172,157,154,16,27,179,40,187,184,133,129,16,0,0,0,1,172,157,217, +161,184,136,50,51,59,184,102,16,0,0,0,0,26,201,221,199,85,85,50,34,35,50,102,16, +0,0,0,1,26,201,157,151,53,35,97,17,18,38,102,16,17,16,0,24,17,68,70,220,115,54, +16,0,1,17,97,17,85,16,1,133,36,181,36,217,167,51,81,17,16,0,17,56,34,16,1,83,36, +68,68,119,199,35,53,88,129,17,136,51,102,16,24,51,75,33,17,136,122,114,51,85,88, +130,115,34,102,16,21,52,187,181,17,21,135,167,99,53,85,88,114,34,102,16,19,49, +187,136,43,18,85,76,214,53,136,133,39,34,103,16,19,75,184,136,132,17,85,73,199, +56,51,56,87,118,119,16,18,20,68,136,82,177,83,36,154,115,156,147,135,33,68,16, +19,33,159,69,82,17,51,36,220,115,57,195,55,34,17,16,18,33,169,69,83,17,51,36, +249,115,57,195,55,34,97,17,19,18,34,85,50,177,51,36,255,115,156,147,39,38,50,33, +18,72,133,85,54,17,51,78,247,34,51,50,55,114,38,97,19,33,133,83,43,22,50,78,231, +35,34,35,39,34,38,97,19,36,85,83,17,19,36,231,114,51,51,50,114,34,38,97,19,34, +21,33,17,50,78,116,98,34,34,38,118,34,38,113,1,50,65,17,68,68,231,70,34,38,97, +17,22,102,103,113,1,51,36,50,70,157,119,20,38,65,16,0,1,20,71,113,0,19,51,68, +109,254,113,70,65,23,97,16,0,1,20,65,0,1,74,169,157,247,65,35,37,136,133,33,0,0, +1,17,0,0,26,173,221,231,65,98,51,85,134,97,0,0,0,0,0,1,170,205,223,225,23,98,34, +51,51,33,0,0,0,0,0,26,172,221,222,16,1,17,118,34,38,97,0,0,0,0,0,26,204,221,238, +16,0,0,17,17,17,16,0,0,0,0,0,26,205,238,17,0,0,0,0,0,0,0,0,0,0,0,0,17,17,17,0,0, +0,0,0,0,0,0,0,0,0,0 +, // 6, warrior idle +175,0,3,5,1,4,6,7,2,62,170,63,92,93,95,151,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,17,17,17,17,17, +17,17,16,0,0,0,0,0,0,0,23,119,119,119,119,119,119,119,113,0,0,0,0,0,0,1,136,255, +153,187,187,187,185,153,241,0,0,0,0,0,0,1,17,17,17,17,17,17,17,31,133,16,0,0,0, +0,0,0,0,0,0,0,0,0,0,1,85,16,0,0,1,17,16,0,0,0,0,0,0,0,0,0,21,81,0,1,19,53,82,0, +0,0,0,0,0,0,0,0,1,33,1,22,99,51,82,0,0,17,0,0,0,0,0,0,1,40,22,102,51,51,36,0,0, +23,16,0,17,16,0,0,18,40,119,102,99,50,68,0,0,22,113,17,234,113,0,1,85,85,85,54, +51,50,68,0,0,19,103,122,234,102,16,24,60,205,51,38,99,50,68,0,0,1,51,54,162,54, +65,130,57,220,211,38,51,50,68,0,0,0,21,51,102,99,72,34,57,156,211,38,99,51,36,0, +1,17,34,85,51,102,52,34,57,220,211,38,51,51,82,0,19,51,51,51,51,51,84,34,60,205, +50,86,99,53,82,0,1,17,34,37,51,53,84,34,51,51,35,102,50,34,36,0,0,0,18,85,85,85, +72,40,51,50,55,98,34,34,36,0,0,1,37,85,162,82,72,136,34,36,117,34,36,68,68,0,0, +21,85,42,234,34,65,132,34,36,82,36,68,34,36,0,0,21,33,17,234,33,0,20,34,36,36, +68,66,83,82,0,0,18,16,0,17,16,0,1,17,17,36,68,68,68,68,0,0,17,0,0,0,0,0,0,0,1, +36,68,68,34,36,0,0,0,0,0,0,0,0,0,0,0,18,36,66,83,82,0,0,0,0,0,0,0,0,0,0,0,1,18, +36,68,68,0,0,0,0,0,0,0,0,0,0,0,0,1,18,34,36,0,0,0,0,0,0,0,0,0,0,0,0,0,1,17,16,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0 +, // 7, warrior attacking +175,0,5,1,3,4,2,7,6,63,170,92,93,62,95,148,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +17,0,0,1,17,16,0,0,0,0,0,0,0,0,0,1,71,16,1,18,37,84,0,0,1,16,0,0,0,0,0,18,73,17, +24,130,34,84,0,0,1,113,16,1,17,0,1,36,63,115,72,34,34,67,0,0,1,135,113,30,167, +16,1,102,99,150,68,130,36,51,0,0,0,24,119,174,168,33,22,82,35,247,52,34,36,51,0, +0,0,18,34,138,162,131,102,43,188,57,100,66,36,51,0,0,0,1,82,40,136,35,68,45,203, +61,115,66,36,51,0,0,1,17,20,85,40,130,52,45,219,195,150,68,34,67,0,0,18,34,34, +34,34,37,52,45,203,195,151,52,34,84,0,0,1,17,68,82,34,85,52,43,188,34,57,100,66, +84,0,0,0,1,69,85,85,83,68,34,34,36,57,115,69,84,0,0,0,20,85,90,165,67,102,34,34, +66,99,148,100,67,0,0,0,21,84,174,164,67,54,68,67,84,67,215,51,51,0,0,1,84,17,30, +164,16,3,102,99,70,51,57,52,84,0,0,1,65,0,1,17,0,0,51,51,70,51,51,115,51,0,0,1, +16,0,0,0,0,0,0,1,100,51,51,147,68,0,0,0,0,0,0,0,0,0,0,0,17,68,102,55,19,0,0,0,0, +0,0,0,0,0,0,0,0,17,20,57,17,0,0,0,0,0,0,0,0,0,0,0,0,0,1,17,16,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +, // 8, plasmabot idle +175,0,72,65,2,3,4,5,61,60,54,62,6,59,49,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +2,34,34,0,0,0,0,0,0,0,0,0,0,0,0,0,42,170,170,34,0,0,0,0,0,0,1,17,0,0,0,0,42,147, +56,171,32,0,0,0,0,0,1,193,0,0,0,0,42,50,35,153,32,0,0,0,1,17,20,68,17,17,0,2, +171,50,34,57,32,0,0,0,1,119,118,102,85,65,0,2,163,34,34,57,33,0,0,0,1,101,85,68, +68,65,0,2,163,34,35,137,35,16,0,0,1,17,17,17,17,17,0,42,185,50,35,141,50,49,0,0, +0,0,1,65,0,0,0,42,187,131,57,211,66,52,16,0,0,0,21,81,0,0,0,43,51,136,179,68, +136,34,17,17,17,17,68,65,0,0,0,36,101,51,52,216,136,146,86,124,197,204,204,113, +0,0,0,3,122,229,61,136,137,242,17,17,17,17,28,17,0,0,0,2,122,174,83,153,211,35, +65,0,0,0,28,16,0,0,0,2,118,174,101,51,50,51,65,0,17,17,68,65,17,16,0,2,118,102, +238,85,82,52,65,1,119,119,102,102,85,65,0,2,118,102,238,102,98,52,81,1,102,85, +85,68,68,65,0,2,118,174,102,83,50,53,81,0,17,17,17,17,17,16,0,2,122,174,101,171, +179,37,81,0,0,0,20,16,0,0,0,3,122,230,93,184,136,210,17,17,17,17,21,17,0,0,0,35, +118,85,52,216,137,243,86,124,197,204,199,81,0,0,0,43,85,170,179,68,159,34,17,17, +17,17,68,65,0,0,0,42,171,147,57,211,66,52,16,0,0,0,23,113,0,0,0,42,185,50,35, +136,50,65,0,0,0,0,1,193,0,0,0,2,179,34,35,137,36,16,0,0,1,17,20,68,17,17,0,2, +179,34,34,57,33,0,0,0,1,119,118,102,85,65,0,2,152,50,34,61,32,0,0,0,1,101,85,68, +68,65,0,0,40,50,35,223,32,0,0,0,1,17,17,17,17,17,0,0,41,147,61,255,32,0,0,0,0,0, +1,81,0,0,0,0,47,255,223,34,0,0,0,0,0,0,1,17,0,0,0,0,2,34,34,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +, // 9, plasmabot attacking +175,198,0,2,4,3,72,39,193,5,194,6,49,192,65,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,111,193,1,0,0,0,0,0,0,0,0,0,0,0,0,6,177,17,17,0,0,0,0,0,0,2,34,0,0,0,0,15, +113,17,17,240,0,0,0,0,0,2,178,0,0,0,0,107,17,23,17,31,0,0,0,8,136,131,51,34,34, +0,0,97,23,119,113,17,17,0,0,10,153,153,68,85,50,0,0,103,17,119,119,17,16,0,0,10, +68,85,83,51,50,0,6,145,17,119,17,19,61,0,0,10,168,141,34,34,34,0,1,17,17,23,17, +85,172,128,0,0,0,2,50,0,0,0,6,17,113,17,17,85,172,128,0,0,0,2,82,0,0,0,6,156,55, +113,85,84,76,200,170,168,136,211,50,0,0,0,6,52,85,81,84,180,68,245,73,187,91, +187,146,0,0,0,0,233,151,85,91,180,67,98,34,34,34,43,34,0,0,0,0,105,71,115,52,69, +230,227,32,0,0,43,32,0,0,0,0,105,68,124,83,206,110,227,32,168,141,51,50,34,32,0, +0,105,68,68,204,85,110,51,218,153,153,68,68,85,50,0,0,105,68,68,204,68,110,51, +218,68,85,85,51,51,50,0,0,105,68,124,69,238,254,53,208,136,136,221,210,34,32,0, +0,105,71,124,91,153,207,85,32,0,0,35,32,0,0,0,0,233,71,197,25,68,69,253,136,221, +221,37,34,0,0,0,6,233,149,81,20,148,67,197,73,187,91,185,82,0,0,0,6,149,87,17, +17,84,60,200,136,136,136,211,50,0,0,0,6,187,113,17,17,21,172,208,0,0,0,13,146,0, +0,0,6,177,17,119,17,17,163,32,0,0,0,13,178,0,0,0,6,73,145,23,119,19,50,0,0,10, +136,131,51,34,34,0,0,105,17,119,113,28,32,0,0,10,153,68,68,85,50,0,0,105,17,119, +17,17,0,0,0,10,69,85,51,51,50,0,0,97,17,23,17,22,0,0,0,10,168,210,34,34,34,0,0, +1,65,17,21,17,0,0,0,0,0,2,82,0,0,0,0,6,52,69,31,0,0,0,0,0,0,2,34,0,0,0,0,0,102, +102,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +, // 10, ender idle +0,3,4,5,2,175,1,6,52,7,93,92,50,74,73,0,85,85,85,85,0,0,0,80,5,0,5,85,85,80,0,0, +85,85,80,0,153,153,52,1,134,17,16,80,0,9,114,32,85,80,3,151,119,119,119,104,97, +135,129,9,119,115,36,16,85,9,114,115,51,51,51,54,97,114,113,99,50,17,22,16,80, +151,113,18,4,18,34,51,97,135,129,102,33,20,70,16,9,119,20,55,114,0,65,34,16,17, +22,24,4,68,70,16,2,20,67,51,51,51,48,34,33,6,96,129,4,65,0,0,9,113,51,58,58,51, +115,3,49,65,51,0,65,96,85,85,9,49,33,34,35,34,35,49,51,18,34,38,102,102,0,0,7, +49,36,34,33,35,18,113,115,43,50,22,23,119,114,32,7,49,33,1,34,51,49,39,23,114, +51,22,18,34,36,16,7,19,34,64,66,34,51,19,35,51,50,6,102,17,22,96,80,115,35,11, +176,34,49,19,45,194,35,51,116,100,70,16,85,3,55,10,164,18,18,61,17,18,18,50,55, +97,22,16,80,1,121,10,170,65,35,18,34,34,33,34,35,96,0,0,3,68,121,64,0,1,18,34, +32,68,18,34,34,6,5,85,1,68,119,64,0,1,17,18,32,68,18,34,34,6,5,85,80,1,55,10, +170,65,34,65,34,34,33,34,33,96,0,0,85,3,51,10,164,35,34,52,17,18,17,34,36,103, +114,32,80,115,35,11,176,51,49,19,20,65,18,34,68,98,36,16,9,19,34,64,67,51,119, +19,35,50,33,70,6,17,22,96,7,49,33,1,51,51,113,35,19,52,34,16,100,68,70,16,3,49, +36,34,50,39,18,49,35,65,17,70,65,17,22,16,3,49,33,51,51,35,35,16,18,75,68,102, +102,102,0,0,3,33,35,51,51,51,49,1,17,68,70,0,98,96,85,85,1,68,18,58,58,49,208, +17,68,6,96,129,2,34,0,0,3,34,65,35,50,0,65,20,96,17,22,24,1,18,36,32,80,50,36, +29,4,18,17,70,97,135,129,0,17,17,20,16,85,2,36,34,34,33,20,230,97,114,113,100, +68,17,22,16,85,80,4,193,17,204,68,104,1,135,129,4,68,68,70,16,85,85,80,0,68,68, +70,1,128,17,16,80,0,4,70,16,85,85,85,85,0,0,0,80,5,0,5,85,85,80,0,0 +, // 11, ender walking +0,3,4,5,175,2,1,6,52,93,7,92,50,74,73,0,68,68,68,68,64,0,0,4,0,64,0,68,68,0,0,4, +68,68,68,0,10,170,114,80,136,97,17,4,0,167,34,4,68,68,0,39,119,119,119,21,86,24, +120,16,119,50,81,4,68,0,167,35,51,51,51,49,102,23,39,22,33,17,97,4,64,42,114,18, +85,1,34,51,22,24,120,22,1,85,97,4,64,167,37,87,114,32,81,34,49,1,17,97,128,85, +97,4,2,21,85,51,51,51,53,18,34,16,102,8,16,81,0,4,10,119,19,51,147,147,115,1,49, +85,18,0,1,96,68,68,10,115,18,34,34,50,35,50,35,33,34,22,102,96,68,68,7,115,18, +81,34,18,49,55,19,50,178,22,23,114,0,0,7,115,18,16,18,35,50,23,23,115,35,22,18, +39,114,32,3,17,50,53,5,34,51,35,35,51,50,6,102,18,37,16,64,115,34,48,187,2,49, +19,45,194,35,51,117,101,22,96,64,50,39,112,153,177,18,49,209,17,33,35,55,97,86, +16,68,0,39,160,153,149,35,17,34,34,34,18,51,96,22,16,64,53,87,165,0,0,17,34,33, +5,82,34,35,6,0,0,64,21,87,165,0,0,17,18,33,5,82,34,34,6,4,68,68,0,39,112,153, +149,34,81,34,34,34,18,33,96,0,4,68,7,51,48,153,178,34,53,17,17,33,18,21,103,34, +4,64,115,35,48,187,3,49,19,21,81,18,17,85,98,81,4,10,17,34,37,5,51,55,19,34,51, +33,86,6,17,102,4,7,50,18,16,19,51,113,35,19,50,81,80,101,85,97,4,7,50,18,82,35, +39,18,49,83,37,21,86,81,17,97,4,3,50,18,35,51,50,35,16,18,37,181,102,102,96,0,4, +2,34,19,51,51,51,49,101,17,85,86,0,2,34,102,96,1,21,81,51,147,145,214,81,85,80, +102,1,128,18,37,32,64,50,37,19,50,37,1,21,86,1,17,104,16,17,21,16,64,51,33,93, +80,82,17,86,96,24,120,22,1,17,22,16,68,0,33,82,34,33,21,230,96,23,39,22,85,85, +86,16,68,68,0,92,17,204,85,96,16,24,120,16,85,85,86,16,68,68,68,0,5,85,86,0,136, +1,17,4,0,0,0,0,68,68,68,68,64,0,0,68,0,64,0,68,68,68,68,68 +, // 12, ender attacking +0,4,5,175,3,26,28,191,6,29,2,1,30,7,105,27,51,51,51,51,48,0,0,3,0,48,112,51,51, +48,0,0,51,51,51,0,13,221,137,80,153,231,119,115,0,13,129,16,51,51,0,24,136,136, +136,101,94,119,221,119,136,130,26,64,51,0,216,18,204,204,204,198,119,125,221, +119,118,244,75,64,48,29,129,73,85,6,153,204,103,119,215,126,6,250,171,64,48,216, +26,168,137,144,86,153,198,7,119,118,144,90,171,64,1,74,170,34,34,34,37,105,153, +96,119,9,96,84,0,0,13,136,66,34,82,82,130,6,198,85,121,0,6,176,51,51,13,130,65, +17,17,33,18,41,156,150,153,110,187,187,0,0,8,130,65,164,17,65,36,40,108,201,89, +110,104,136,129,16,8,130,65,64,65,18,33,72,248,140,156,110,105,145,26,64,2,68, +33,42,170,17,34,18,18,34,41,14,235,255,75,176,48,130,17,42,85,1,36,66,26,81,18, +34,133,181,171,64,48,33,17,40,5,84,65,36,164,68,20,18,40,180,75,64,51,0,17,141, +5,90,18,68,17,17,17,65,34,176,0,0,48,42,161,141,0,0,68,17,20,10,161,17,18,11,3, +51,48,74,161,136,0,0,68,65,20,10,161,17,17,11,3,51,51,0,18,40,5,90,17,95,145,17, +17,65,20,176,0,0,51,8,34,33,5,81,17,37,255,255,31,65,74,184,129,16,48,130,18,42, +85,2,47,242,101,95,249,255,85,177,26,64,13,68,17,26,10,34,40,108,153,34,150,91, +11,244,75,176,8,33,65,64,66,34,134,156,108,201,86,80,181,170,171,64,8,33,65,161, +18,152,105,198,92,149,101,94,95,68,75,64,2,33,65,18,34,41,156,96,105,149,85,238, +235,187,0,0,1,17,66,34,34,44,198,229,102,85,126,0,9,176,51,51,4,74,164,34,82, +166,254,86,85,80,119,6,144,145,0,0,48,33,26,66,41,149,6,101,94,119,119,121,96, +97,26,16,48,34,20,95,80,89,102,94,224,119,215,126,6,111,74,64,51,0,20,89,153, +150,101,238,231,125,221,119,117,111,75,64,51,51,0,95,102,255,85,224,96,119,215, +112,85,90,171,64,51,51,51,0,5,85,94,0,153,7,119,3,0,10,171,64,51,51,51,51,48,0, +0,51,0,48,112,51,51,48,0,0 +, // 13, turret idle +175,0,131,26,41,168,37,6,91,7,48,93,90,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,16,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,25,145,0,0,0,0,0,0,0,0,17,0,0,0,0,17,151,98,16,0,0,0,0,0,0,1,130,16,0,0, +1,35,184,130,81,16,0,0,0,0,0,1,40,16,0,0,1,34,123,178,85,65,0,0,0,0,0,23,49,0,0, +0,25,98,187,98,81,16,0,0,0,0,0,23,65,0,0,0,25,98,118,98,16,0,0,0,0,0,1,115,16,0, +17,17,71,98,118,98,81,16,0,0,0,1,20,116,16,0,0,0,22,35,114,36,85,65,0,0,1,25, +103,53,16,0,0,1,50,52,98,36,81,16,0,0,25,151,39,69,161,0,0,25,51,68,98,36,16,0, +0,0,25,118,100,84,161,0,1,151,54,35,184,36,16,0,0,1,151,98,35,52,85,17,23,102, +70,35,104,132,81,16,0,1,151,98,35,52,85,162,50,34,70,35,104,132,85,65,0,1,118, +34,51,68,85,17,19,51,70,35,104,132,81,16,0,1,118,35,51,68,81,0,1,67,70,35,184, +36,16,0,0,1,102,35,52,69,81,0,0,20,66,53,98,36,16,0,0,1,115,51,68,81,16,0,0,1, +67,165,98,36,81,16,0,1,114,51,69,16,0,0,0,0,20,85,98,36,85,65,0,27,98,35,65,0,0, +1,17,17,18,58,35,58,81,16,0,27,34,35,16,0,0,23,98,51,18,58,35,58,16,0,1,123,130, +52,16,0,0,22,34,68,18,58,140,58,81,16,23,98,184,129,0,0,0,1,35,65,1,90,44,202, +85,65,25,34,35,193,0,0,0,1,20,81,1,85,140,202,81,16,22,34,52,65,0,0,0,17,1,16,0, +17,35,58,16,0,1,35,68,16,0,0,0,16,0,0,0,0,19,49,0,0,0,17,17,0,0,0,0,0,0,0,0,0,1, +16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0 +, // 14 turret walk +175,0,131,26,41,37,168,6,91,7,48,93,90,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,1,153,16,0,0,0,0,0,0,0,0,0,0,0,0,1,25,117,33,0,0,0,0,0,0,0,0,1,16,0,0, +18,59,136,33,0,0,0,0,0,0,0,0,24,33,0,0,18,39,187,38,16,0,0,0,0,0,0,0,18,129,0,1, +149,43,181,38,65,0,0,0,0,0,0,1,115,16,0,1,149,39,85,38,16,0,0,0,0,0,0,25,33,0,1, +20,117,39,85,33,0,0,0,0,0,1,17,114,49,0,16,1,82,55,34,70,16,0,0,0,1,25,87,51,16, +0,0,19,35,69,34,65,0,0,0,0,25,151,39,70,16,0,1,147,52,69,34,65,0,0,0,0,25,117, +84,100,161,0,25,115,82,59,130,70,16,0,0,1,151,82,35,52,161,17,117,83,82,53,136, +70,65,0,0,1,151,82,35,52,102,35,34,35,82,53,136,70,16,0,0,1,117,34,51,68,102,17, +51,52,82,53,136,65,0,0,0,1,117,34,51,68,102,0,20,52,82,59,130,65,0,0,0,23,85,35, +52,70,97,0,1,68,35,101,34,65,0,0,0,23,82,51,68,102,96,0,0,20,58,101,34,70,16,0, +1,181,34,52,65,16,0,17,16,1,70,101,34,65,0,0,23,178,34,52,16,0,1,119,81,17,35, +162,51,161,0,1,117,40,35,65,0,0,1,82,35,49,35,162,51,166,16,1,146,43,136,65,0,0, +17,34,52,17,35,168,195,166,65,1,82,34,60,16,0,0,1,51,65,0,22,162,204,166,16,1, +34,51,68,16,0,0,0,17,16,0,22,104,204,161,0,0,17,52,65,0,0,0,0,0,0,0,1,18,51,161, +0,0,0,17,16,0,0,0,0,0,0,0,0,1,51,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0 +, // 15 turret attack +175,0,131,41,26,1,168,191,7,48,81,6,37,21,35,44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,1,136,16,0,0,0,0,0,0,0,0,0,0,0,0,1,24,188,33,0,0,0,0,0,0,0,0,0,0,0,0, +18,77,170,38,16,0,0,0,0,0,0,0,0,0,0,0,18,43,212,38,49,0,0,0,0,0,0,0,0,0,0,1,140, +45,220,38,16,0,0,0,0,0,0,0,0,0,0,1,140,43,220,33,0,0,0,0,0,0,0,0,0,1,17,19,188, +43,220,38,16,0,0,0,0,80,85,0,0,0,0,1,194,75,226,54,49,0,0,0,85,135,188,165,0,0, +0,148,36,61,226,54,16,0,0,90,136,183,15,254,80,0,9,132,67,61,226,49,0,0,0,168, +139,119,112,238,80,0,24,180,194,77,162,49,0,0,1,187,183,120,135,116,161,21,189, +211,194,77,170,54,16,0,1,192,119,120,135,119,9,173,204,195,194,77,170,54,49,0,1, +204,192,119,119,106,169,21,221,211,194,77,170,54,16,0,0,175,255,247,122,170,80, +0,94,211,194,77,162,49,0,0,0,90,255,231,68,170,80,0,5,227,36,109,226,49,0,0,0,0, +85,224,74,85,0,0,0,83,73,109,226,54,16,0,0,0,0,85,85,0,0,0,0,1,54,109,226,54,49, +0,0,0,0,0,0,0,0,68,68,65,36,158,68,150,16,0,0,0,0,0,0,0,4,141,221,225,36,158,68, +145,0,0,0,0,0,0,0,0,4,221,35,49,36,154,164,150,16,0,0,0,0,0,0,0,0,18,67,16,22, +158,170,150,49,0,0,0,0,0,0,0,0,17,54,16,22,106,170,150,16,0,0,0,0,0,0,0,1,16,17, +0,1,30,68,145,0,0,0,0,0,0,0,0,1,0,0,0,0,1,68,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0 +, // 16 exploder walk +175,168,1,2,3,102,4,5,23,174,99,191,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,16,0,0, +0,0,89,0,0,0,0,0,0,0,0,68,65,177,0,0,5,85,89,0,0,0,0,0,0,0,4,34,33,177,0,0,19, +187,144,0,0,0,0,0,0,0,1,32,1,131,16,1,198,57,0,0,0,0,0,0,0,0,23,97,1,138,16,28, +116,16,0,0,0,0,0,0,17,17,34,34,17,138,17,17,65,0,0,0,0,0,0,0,22,50,51,51,50,134, +19,49,16,1,17,0,0,0,0,0,23,66,51,34,184,134,33,49,1,23,199,21,153,0,0,0,23,66, +34,184,133,85,50,17,28,199,103,99,85,80,0,0,23,66,136,138,18,85,106,50,199,119, +100,99,85,153,0,0,23,66,136,85,171,166,102,34,39,102,51,36,181,89,144,0,23,34, +34,165,90,21,130,33,36,35,55,103,75,89,0,1,18,187,136,136,81,168,36,116,18,119, +118,70,59,185,144,24,139,85,85,102,98,88,39,71,18,102,102,68,59,187,153,1,18,51, +170,170,97,168,36,116,18,68,68,68,59,185,144,0,19,34,34,58,106,21,130,33,39,34, +51,68,75,89,0,0,23,50,35,35,171,166,163,34,54,103,51,36,85,153,0,0,23,66,42,51, +18,102,163,34,52,70,102,115,89,144,0,0,23,66,34,163,51,86,50,17,19,52,68,97,89, +0,0,0,23,66,50,34,58,90,33,49,1,19,51,16,0,0,0,0,22,50,51,51,34,90,19,49,16,1, +17,0,0,0,0,0,17,17,34,34,17,138,17,17,193,0,0,0,0,0,0,0,0,0,20,65,1,131,16,20, +124,16,0,0,0,0,0,0,0,0,1,32,1,131,16,1,70,57,0,0,0,0,0,0,0,0,1,18,33,129,0,0,19, +187,144,0,0,0,0,0,0,0,0,17,17,129,0,0,5,155,153,0,0,0,0,0,0,0,0,0,1,16,0,0,0,5, +80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +, // 17 universal dying sprite +175,0,223,1,3,4,5,2,6,73,135,79,26,159,131,37,0,0,0,0,0,0,0,0,0,0,0,51,0,0,0,0, +0,0,0,0,0,2,0,0,0,34,32,51,0,0,0,0,0,0,0,0,0,2,32,0,2,163,34,0,0,0,0,0,0,0,0,0, +0,0,0,0,42,3,50,33,16,0,0,0,0,0,0,0,0,0,1,16,32,0,2,22,97,16,0,0,0,0,0,0,0,1,24, +129,16,0,1,119,85,81,0,0,0,0,0,0,0,24,134,134,1,16,1,68,119,84,16,0,0,0,0,0,0, +24,102,136,102,81,0,20,68,116,16,0,0,0,0,0,1,102,102,104,134,65,2,20,68,151,113, +0,0,0,0,0,1,101,86,102,101,48,2,1,68,73,113,0,0,0,0,0,1,101,85,102,100,48,35,52, +17,73,16,0,0,0,0,0,1,85,85,85,71,51,37,84,48,17,0,0,0,0,0,0,1,84,80,80,71,50,34, +36,48,0,0,0,0,0,0,0,0,20,68,68,115,34,85,34,35,0,51,0,0,0,0,0,0,1,68,19,50,42, +51,85,34,3,48,0,0,0,0,0,0,0,17,34,34,163,101,51,67,32,0,0,0,0,0,0,0,0,2,42,68, +83,67,85,49,0,0,0,0,0,0,0,0,2,34,0,53,51,53,51,84,16,0,0,0,0,0,0,0,0,32,0,1,187, +211,115,21,16,0,0,0,0,0,0,0,2,32,0,27,189,211,48,23,16,0,0,0,0,0,0,0,2,0,0,27, +221,209,1,97,0,0,0,0,0,0,0,0,0,0,1,155,221,65,1,112,1,17,16,0,0,0,0,0,0,0,22, +153,145,17,22,49,22,117,16,0,0,0,0,0,0,1,101,84,113,0,23,54,102,53,16,0,0,0,0,0, +0,33,85,84,121,16,1,85,68,55,81,0,0,0,0,0,2,33,68,73,17,193,1,68,71,115,65,0,0, +0,0,0,34,42,153,145,1,195,16,23,119,115,65,0,0,0,0,0,32,2,170,34,31,236,49,23, +116,17,17,0,0,0,0,0,0,0,34,2,24,238,193,1,17,0,0,0,0,0,0,0,0,0,32,0,24,254,193, +0,35,48,0,0,0,0,0,0,0,0,0,0,1,17,16,2,32,48,0,0,0,0,0,0,0,0,0,0,0,1,0,2,0,0,0 +, // 18 universal dead/corpse sprite +175,0,3,4,1,5,6,2,157,18,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0,0,0,4,68,0,0,0,0,0,0,0,0,0,0,0,0,0,0,66,34,0,0,0,0,0,0,0,0,0,0,0, +0,0,4,50,34,0,0,0,0,0,0,0,0,0,0,0,0,0,4,36,17,0,0,0,0,0,0,0,0,0,0,0,0,1,18,65, +49,0,0,0,0,0,0,0,0,0,0,1,17,34,34,19,51,0,0,0,0,0,0,0,0,0,1,22,98,34,34,33,20,0, +0,0,0,0,0,0,0,0,22,101,101,40,130,36,68,0,0,0,0,0,0,0,0,0,22,85,102,85,136,129, +17,0,0,0,0,0,0,0,0,1,85,85,82,37,136,22,68,0,0,0,0,0,0,0,0,1,18,53,85,34,132,19, +36,0,0,0,0,0,0,0,0,0,2,34,85,84,33,100,66,0,0,0,0,0,0,0,0,1,35,51,51,39,22,102, +49,0,0,0,0,0,0,0,0,1,50,58,58,39,65,101,33,0,0,0,0,0,0,0,0,0,18,34,34,116,22,83, +17,0,0,0,0,0,0,0,0,0,1,34,20,68,17,50,20,0,0,0,0,0,0,0,0,0,0,17,4,68,34,20,52,0, +0,0,0,0,0,0,0,0,0,0,0,34,39,83,49,0,0,0,0,0,0,0,0,0,0,0,34,35,117,51,65,0,0,0,0, +0,0,0,0,0,0,0,0,19,115,51,52,0,0,0,0,0,0,0,0,0,0,0,0,19,55,163,153,0,0,0,0,0,0, +0,0,0,0,0,0,1,55,51,153,0,0,0,0,0,0,0,0,0,0,0,0,0,17,115,41,0,0,0,0,0,0,0,0,0,0, +0,0,17,53,36,65,0,0,0,0,0,0,0,0,0,0,0,0,21,33,17,18,0,0,0,0,0,0,0,0,0,0,0,0,1, +16,1,35,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,50,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,34,0,0, +0,0,0,0,0,0,0,0,0,0,0,0,2,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,0,0,0,0,0,0,0,0,0, +0,0,0,0,0,0,0 +}; + +SFG_PROGRAM_MEMORY uint8_t SFG_logoImage[SFG_TEXTURE_STORE_SIZE] = +{ +175,224,0,7,4,5,162,77,2,74,70,69,6,11,68,75,0,0,0,0,0,0,17,17,17,17,17,0,0,0,0, +0,0,0,0,0,0,1,132,69,51,84,65,0,0,0,0,0,0,0,0,0,0,24,65,17,19,17,17,0,0,0,0,0,0, +0,0,0,0,24,65,0,19,16,0,0,0,0,0,0,0,0,0,0,0,24,65,17,19,17,17,0,0,0,0,0,0,0,0,0, +0,1,132,69,51,84,65,32,0,0,0,0,0,0,0,0,0,1,17,17,17,17,17,242,0,0,0,0,0,0,0,6, +97,243,94,40,51,84,66,159,32,0,0,0,0,0,17,17,24,60,190,40,50,34,34,155,146,0,0, +0,0,0,33,17,20,203,238,109,51,84,66,251,178,0,0,0,0,0,17,17,131,171,123,145,18, +34,38,122,187,32,0,0,0,0,6,97,92,170,167,113,115,35,81,122,171,32,0,0,0,0,2,22, +202,170,170,212,51,37,210,26,121,130,0,0,0,0,34,17,22,234,164,28,60,34,92,23, +218,56,32,0,0,2,33,17,102,110,113,69,210,35,51,93,51,66,50,0,0,34,34,40,126,246, +210,34,195,35,51,49,210,34,34,0,0,0,2,40,119,238,105,197,210,35,51,93,51,65,50, +0,0,0,2,38,87,119,166,156,60,34,92,223,218,161,32,0,0,2,34,38,87,119,170,20,51, +37,223,23,114,18,0,0,0,2,34,34,69,122,119,241,211,35,86,102,187,32,0,0,0,0,0,97, +213,119,187,97,134,45,17,246,105,32,0,0,0,0,34,33,22,247,238,29,51,53,65,155,98, +0,0,0,0,0,2,34,33,110,233,29,54,17,17,155,146,0,0,0,0,0,0,0,97,111,153,34,34,34, +29,159,32,0,0,0,0,0,0,0,0,41,150,40,51,84,65,146,0,0,0,0,0,0,0,0,0,2,38,40,56, +24,65,32,0,0,0,0,0,0,0,0,0,0,2,40,49,145,65,0,0,0,0,0,0,0,0,0,0,1,17,34,17,17, +17,0,0,0,0,0,0,0,0,0,0,1,132,69,51,84,65,0,0,0,0,0,0,0,0,0,0,1,17,24,56,17,17,0, +0,0,0,0,0,0,0,0,0,0,0,24,51,84,65,0,0,0,0,0,0,0,0,0,0,0,0,1,17,17,17,0,0,0,0,0 +}; + +uint8_t SFG_charToFontIndex(char c) +{ + if (c >= 'a' && c <= 'z') + return c - 'a'; + + if (c >= 'A' && c <= 'Z') + return c - 'A'; + + if (c >= '0' && c <= '9') + return c - '0' + 31; + + switch (c) + { + case ' ': return 26; break; + case '.': return 27; break; + case ',': return 28; break; + case '!': return 29; break; + case '/': return 41; break; + case '-': return 42; break; + case '+': return 43; break; + case '(': return 44; break; + case ')': return 45; break; + case '%': return 46; break; + default: return 30; break; // "?" + } +} + +#define SFG_FONT_CHARACTER_SIZE 4 + +/** + 4x4 font, each character stored as 16 bits. +*/ +SFG_PROGRAM_MEMORY uint16_t SFG_font[47] = +{ + 0xfaf0, // 0 "A" + 0xfd70, // 1 "B" + 0x6990, // 2 "C" + 0xf960, // 3 "D" + 0xfd90, // 4 "E" + 0xfa80, // 5 "F" + 0x69b0, // 6 "G" + 0xf4f0, // 7 "H" + 0x9f90, // 8 "I" + 0x31f0, // 9 "J" + 0xf4b0, // 10 "K" + 0xf110, // 11 "L" + 0xfc4f, // 12 "M" + 0xf42f, // 13 "N" + 0x6996, // 14 "O" + 0xfae0, // 15 "P" + 0x69b7, // 16 "Q" + 0xfad0, // 17 "R" + 0x5da0, // 18 "S" + 0x8f80, // 19 "T" + 0xf1f0, // 20 "U" + 0xe1e0, // 21 "V" + 0xf32f, // 22 "W" + 0x9690, // 23 "X" + 0xc7c0, // 24 "Y" + 0xbd90, // 25 "Z" + 0x0000, // 26 " " + 0x0100, // 27 "." + 0x0300, // 28 "," + 0x0d00, // 29 "!" + 0x48b4, // 30 "?" + 0xf9f0, // 31 "0" + 0x9f10, // 32 "1" + 0xbdd0, // 33 "2" + 0x9da0, // 34 "3" + 0xe2f0, // 35 "4" + 0xdbb0, // 36 "5" + 0xfbb0, // 37 "6" + 0x8bc0, // 38 "7" + 0xfdf0, // 39 "8" + 0xddf0, // 40 "9" + 0x1680, // 41 "/" + 0x2220, // 42 "-" + 0x2720, // 43 "+" + 0x0690, // 44 "(" + 0x0960, // 45 ")" + 0x9249 // 46 "%" +}; + +#endif // guard diff --git a/dingux/levels.h b/dingux/levels.h new file mode 100644 index 0000000..d448707 --- /dev/null +++ b/dingux/levels.h @@ -0,0 +1,225 @@ +/** + @file levels.h + + This file contains game levels and related code. + + by Miloslav Ciz (drummyfish), 2019 + + Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/) + plus a waiver of all other intellectual property. The goal of this work is + be and remain completely in the public domain forever, available for any use + whatsoever. +*/ + +#ifndef _SFG_LEVELS_H +#define _SFG_LEVELS_H + +#define SFG_MAP_SIZE 64 +#define SFG_TILE_DICTIONARY_SIZE 64 + +typedef uint16_t SFG_TileDefinition; +/**< + Defines a single game map tile. The format is following: + + MSB aaabbbbb cccddddd LSB + + aaa: ceiling texture index (from texture available on the map), 111 + means completely transparent texture + bbbbb: ceiling height (1111 meaning no ceiling) ABOVE the floor + ccc: floor texture index, 111 means completely transparent texture + ddddd: floor height +*/ + +#define SFG_TILE_CEILING_MAX_HEIGHT 31 +#define SFG_TILE_TEXTURE_TRANSPARENT 7 + +typedef SFG_TileDefinition SFG_TileDictionary[SFG_TILE_DICTIONARY_SIZE]; + +/// helper macros for SFG_TileDefinition +#define SFG_TD(floorH, ceilH, floorT, ceilT)\ + ((floorH & 0x001f) |\ + ((floorT & 0x0007) << 5) |\ + ((ceilH & 0x001f) << 8) |\ + ((ceilT & 0x0007) << 13)) + +#define SFG_TILE_FLOOR_HEIGHT(tile) (tile & 0x1f) +#define SFG_TILE_FLOOR_TEXTURE(tile) ((tile & 0xe0) >> 5) +#define SFG_TILE_CEILING_HEIGHT(tile) ((tile & 0x1f00) >> 8) +#define SFG_TILE_CEILING_TEXTURE(tile) ((tile & 0xe000) >> 13) + +#define SFG_OUTSIDE_TILE SFG_TD(63,0,7,7) + +/** + Game map represented as a 2D array. Array item has this format: + + MSB aabbbbbb LSB + + aa: type of square, possible values: + 00: normal + 01: moving floor (elevator), moves from floor height to ceililing height + (there is no ceiling above) + 10: moving ceiling, moves from ceiling height to floor height + 11: door + bbbbbb: index into tile dictionary +*/ +typedef uint8_t SFG_MapArray[SFG_MAP_SIZE * SFG_MAP_SIZE]; + +#define SFG_TILE_PROPERTY_MASK 0xc0 +#define SFG_TILE_PROPERTY_NORMAL 0x00 +#define SFG_TILE_PROPERTY_ELEVATOR 0x40 +#define SFG_TILE_PROPERTY_SQUEEZER 0x80 +#define SFG_TILE_PROPERTY_DOOR 0xc0 + +/** + Serves to place elements (items, enemies etc.) into the game level. +*/ +typedef struct +{ + uint8_t type; + uint8_t coords[2]; +} SFG_LevelElement; + +#define SFG_MAX_LEVEL_ELEMENTS 128 + +/* + Definitions of level element type. These values must leave the highest bit + unused because that will be used by the game engine, so the values must be + lower than 128. +*/ +#define SFG_LEVEL_ELEMENT_NONE 0 +#define SFG_LEVEL_ELEMENT_BARREL 0x01 +#define SFG_LEVEL_ELEMENT_HEALTH 0x02 +#define SFG_LEVEL_ELEMENT_BULLETS 0x03 +#define SFG_LEVEL_ELEMENT_ROCKETS 0x04 +#define SFG_LEVEL_ELEMENT_PLASMA 0x05 +#define SFG_LEVEL_ELEMENT_TREE 0x06 +#define SFG_LEVEL_ELEMENT_FINISH 0x07 +#define SFG_LEVEL_ELEMENT_TELEPORT 0x08 +#define SFG_LEVEL_ELEMENT_TERMINAL 0x09 +#define SFG_LEVEL_ELEMENT_COLUMN 0x0a +#define SFG_LEVEL_ELEMENT_RUIN 0x0b +#define SFG_LEVEL_ELEMENT_LAMP 0x0c +#define SFG_LEVEL_ELEMENT_CARD0 0x0d ///< Access card, unlocks doors with lock. +#define SFG_LEVEL_ELEMENT_CARD1 0x0e +#define SFG_LEVEL_ELEMENT_CARD2 0x0f +#define SFG_LEVEL_ELEMENT_LOCK0 0x10 /**< Special level element that must be + placed on a tile with door. This door is + then unlocked by taking the corresponding + access card. */ +#define SFG_LEVEL_ELEMENT_LOCK1 0x11 +#define SFG_LEVEL_ELEMENT_LOCK2 0x12 +#define SFG_LEVEL_ELEMENT_BLOCKER 0x13 ///< Invisible wall. + +#define SFG_LEVEL_ELEMENT_MONSTER_SPIDER 0x20 +#define SFG_LEVEL_ELEMENT_MONSTER_DESTROYER 0x21 +#define SFG_LEVEL_ELEMENT_MONSTER_WARRIOR 0x22 +#define SFG_LEVEL_ELEMENT_MONSTER_PLASMABOT 0x23 +#define SFG_LEVEL_ELEMENT_MONSTER_ENDER 0x24 +#define SFG_LEVEL_ELEMENT_MONSTER_TURRET 0x25 +#define SFG_LEVEL_ELEMENT_MONSTER_EXPLODER 0x26 + +#define SFG_MONSTERS_TOTAL 7 + +#define SFG_MONSTER_TYPE_TO_INDEX(monsterType) \ + ((monsterType) - SFG_LEVEL_ELEMENT_MONSTER_SPIDER) + +#define SFG_MONSTER_INDEX_TO_TYPE(monsterIndex) \ + ((monsterIndex) + SFG_LEVEL_ELEMENT_MONSTER_SPIDER) + +#define SFG_LEVEL_ELEMENT_TYPE_IS_MOSTER(t) \ + ((t) >= SFG_LEVEL_ELEMENT_MONSTER_SPIDER) + +typedef struct +{ + SFG_MapArray mapArray; + SFG_TileDictionary tileDictionary; + uint8_t textureIndices[7]; /**< Says which textures are used on the map. There + can be at most 7 because of 3bit indexing (one + value is reserved for special transparent + texture). */ + uint8_t doorTextureIndex; /**< Index (global, NOT from textureIndices) of a + texture used for door. */ + uint8_t floorColor; + uint8_t ceilingColor; + uint8_t playerStart[3]; /**< Player starting location: square X, square Y, + direction (fourths of RCL_Unit). */ + uint8_t backgroundImage; /** Index of level background image. */ + SFG_LevelElement elements[SFG_MAX_LEVEL_ELEMENTS]; +} SFG_Level; + +static inline SFG_TileDefinition SFG_getMapTile +( + const SFG_Level *level, + int16_t x, + int16_t y, + uint8_t *properties +) +{ + if (x < 0 || x >= SFG_MAP_SIZE || y < 0 || y >= SFG_MAP_SIZE) + { + *properties = SFG_TILE_PROPERTY_NORMAL; + return SFG_OUTSIDE_TILE; + } + + uint8_t tile = level->mapArray[y * SFG_MAP_SIZE + x]; + + *properties = tile & 0xc0; + return level->tileDictionary[tile & 0x3f]; +} + +#define SFG_NUMBER_OF_LEVELS 10 + +/* + NOTE: Initially the levels were stored sequentially in one big array, but that + caused some issues with Arduino's PROGMEM, so now we store each level in a + separate variable and eventually create an array of pointers to these. +*/ + +SFG_PROGRAM_MEMORY SFG_Level SFG_level0 = + #include "/home/tastyfish/git/anarch/assets/tmp.txt" + ; + +SFG_PROGRAM_MEMORY SFG_Level SFG_level1 = + #include "/home/tastyfish/git/anarch/assets/tmp.txt" + ; + +SFG_PROGRAM_MEMORY SFG_Level SFG_level2 = + #include "/home/tastyfish/git/anarch/assets/tmp.txt" + ; + +SFG_PROGRAM_MEMORY SFG_Level SFG_level3 = + #include "/home/tastyfish/git/anarch/assets/tmp.txt" + ; + +SFG_PROGRAM_MEMORY SFG_Level SFG_level4 = + #include "/home/tastyfish/git/anarch/assets/tmp.txt" + ; + +SFG_PROGRAM_MEMORY SFG_Level SFG_level5 = + #include "/home/tastyfish/git/anarch/assets/tmp.txt" + ; + +SFG_PROGRAM_MEMORY SFG_Level SFG_level6 = + #include "/home/tastyfish/git/anarch/assets/tmp.txt" + ; + +SFG_PROGRAM_MEMORY SFG_Level SFG_level7 = + #include "/home/tastyfish/git/anarch/assets/tmp.txt" + ; + +SFG_PROGRAM_MEMORY SFG_Level SFG_level8 = + #include "/home/tastyfish/git/anarch/assets/tmp.txt" + ; + +SFG_PROGRAM_MEMORY SFG_Level SFG_level9 = + #include "/home/tastyfish/git/anarch/assets/tmp.txt" + ; + +static const SFG_Level * SFG_levels[SFG_NUMBER_OF_LEVELS] = +{ + &SFG_level0, &SFG_level1, &SFG_level2, &SFG_level3, &SFG_level4, &SFG_level5, + &SFG_level6, &SFG_level7, &SFG_level8, &SFG_level9 +}; + +#endif // guard + diff --git a/dingux/mbed_config.h b/dingux/mbed_config.h new file mode 100644 index 0000000..34e7f96 --- /dev/null +++ b/dingux/mbed_config.h @@ -0,0 +1,25 @@ +/* + * mbed SDK + * Copyright (c) 2017 ARM Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Automatically generated configuration file. +// DO NOT EDIT, content will be overwritten. + +#ifndef __MBED_CONFIG_DATA__ +#define __MBED_CONFIG_DATA__ + + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/acl/libacl.h b/dingux/opt/mipsel-linux-uclibc/include/acl/libacl.h new file mode 100644 index 0000000..46ae8e9 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/acl/libacl.h @@ -0,0 +1,80 @@ +/* + File: libacl.h + + (C) 1999, 2000 Andreas Gruenbacher, + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 2.1 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef __ACL_LIBACL_H +#define __ACL_LIBACL_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Flags for acl_to_any_text() */ + +/* Print NO, SOME or ALL effective permissions comments. SOME prints + effective rights comments for entries which have different permissions + than effective permissions. */ +#define TEXT_SOME_EFFECTIVE 0x01 +#define TEXT_ALL_EFFECTIVE 0x02 + +/* Align effective permission comments to column 32 using tabs or + use a single tab. */ +#define TEXT_SMART_INDENT 0x04 + +/* User and group IDs instead of names. */ +#define TEXT_NUMERIC_IDS 0x08 + +/* Only output the first letter of entry types + ("u::rwx" instead of "user::rwx"). */ +#define TEXT_ABBREVIATE 0x10 + +/* acl_check error codes */ + +#define ACL_MULTI_ERROR (0x1000) /* multiple unique objects */ +#define ACL_DUPLICATE_ERROR (0x2000) /* duplicate Id's in entries */ +#define ACL_MISS_ERROR (0x3000) /* missing required entry */ +#define ACL_ENTRY_ERROR (0x4000) /* wrong entry type */ + +extern char *acl_to_any_text(acl_t acl, const char *prefix, + char separator, int options); +extern int acl_cmp(acl_t acl1, acl_t acl2); +extern int acl_check(acl_t acl, int *last); +extern acl_t acl_from_mode(mode_t mode); +extern int acl_equiv_mode(acl_t acl, mode_t *mode_p); +extern int acl_extended_file(const char *path_p); +extern int acl_extended_file_nofollow(const char *path_p); +extern int acl_extended_fd(int fd); +extern int acl_entries(acl_t acl); +extern const char *acl_error(int code); +extern int acl_get_perm(acl_permset_t permset_d, acl_perm_t perm); + +/* Copying permissions between files */ +struct error_context; +extern int perm_copy_file (const char *, const char *, + struct error_context *); +extern int perm_copy_fd (const char *, int, const char *, int, + struct error_context *); + +#ifdef __cplusplus +} +#endif + +#endif /* __ACL_LIBACL_H */ + diff --git a/dingux/opt/mipsel-linux-uclibc/include/attr/attributes.h b/dingux/opt/mipsel-linux-uclibc/include/attr/attributes.h new file mode 100644 index 0000000..0126927 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/attr/attributes.h @@ -0,0 +1,200 @@ +/* + * Copyright (c) 2001-2002,2004 Silicon Graphics, Inc. + * All Rights Reserved. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ +#ifndef __ATTRIBUTES_H__ +#define __ATTRIBUTES_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifndef ENOATTR +# define ENOATTR ENODATA +#endif + +/* + * An almost-IRIX-compatible extended attributes API + * (the IRIX attribute "list" operation is missing, added ATTR_SECURE). + */ + +/* + * The maximum size (into the kernel or returned from the kernel) of an + * attribute value or the buffer used for an attr_list() call. Larger + * sizes will result in an E2BIG return code. + */ +#define ATTR_MAX_VALUELEN (64*1024) /* max length of a value */ + + +/* + * Flags that can be used with any of the simple attribute calls. + * All desired flags should be bit-wise OR'ed together. + */ +#define ATTR_DONTFOLLOW 0x0001 /* do not follow symlinks for a pathname */ +#define ATTR_ROOT 0x0002 /* use root namespace attributes in op */ +#define ATTR_TRUST 0x0004 /* tell server we can be trusted to properly + handle extended attributes */ +#define ATTR_SECURE 0x0008 /* use security namespace attributes in op */ + +/* + * Additional flags that can be used with the set() attribute call. + * All desired flags (from both lists) should be bit-wise OR'ed together. + */ +#define ATTR_CREATE 0x0010 /* pure create: fail if attr already exists */ +#define ATTR_REPLACE 0x0020 /* pure set: fail if attr does not exist */ + +/* + * Define how lists of attribute names are returned to the user from + * the attr_list() call. A large, 32bit aligned, buffer is passed in + * along with its size. We put an array of offsets at the top that each + * reference an attrlist_ent_t and pack the attrlist_ent_t's at the bottom. + */ +typedef struct attrlist { + int32_t al_count; /* number of entries in attrlist */ + int32_t al_more; /* T/F: more attrs (do call again) */ + int32_t al_offset[1]; /* byte offsets of attrs [var-sized] */ +} attrlist_t; + +/* + * Show the interesting info about one attribute. This is what the + * al_offset[i] entry points to. + */ +typedef struct attrlist_ent { /* data from attr_list() */ + uint32_t a_valuelen; /* number bytes in value of attr */ + char a_name[1]; /* attr name (NULL terminated) */ +} attrlist_ent_t; + +/* + * Given a pointer to the (char*) buffer containing the attr_list() result, + * and an index, return a pointer to the indicated attribute in the buffer. + */ +#define ATTR_ENTRY(buffer, index) \ + ((attrlist_ent_t *) \ + &((char *)buffer)[ ((attrlist_t *)(buffer))->al_offset[index] ]) + +/* + * Implement a "cursor" for use in successive attr_list() calls. + * It provides a way to find the last attribute that was returned in the + * last attr_list() call so that we can get the next one without missing + * any. This should be bzero()ed before use and whenever it is desired to + * start over from the beginning of the attribute list. The only valid + * operation on a cursor is to bzero() it. + */ +typedef struct attrlist_cursor { + uint32_t opaque[4]; /* an opaque cookie */ +} attrlist_cursor_t; + +/* + * Multi-attribute operation vector. + */ +typedef struct attr_multiop { + int32_t am_opcode; /* operation to perform (ATTR_OP_GET, etc.) */ + int32_t am_error; /* [out arg] result of this sub-op (an errno) */ + char *am_attrname; /* attribute name to work with */ + char *am_attrvalue; /* [in/out arg] attribute value (raw bytes) */ + int32_t am_length; /* [in/out arg] length of value */ + int32_t am_flags; /* flags (bit-wise OR of #defines above) */ +} attr_multiop_t; +#define ATTR_MAX_MULTIOPS 128 /* max number ops in an oplist array */ + +/* + * Valid values of am_opcode. + */ +#define ATTR_OP_GET 1 /* return the indicated attr's value */ +#define ATTR_OP_SET 2 /* set/create the indicated attr/value pair */ +#define ATTR_OP_REMOVE 3 /* remove the indicated attr */ + +/* + * Get the value of an attribute. + * Valuelength must be set to the maximum size of the value buffer, it will + * be set to the actual number of bytes used in the value buffer upon return. + * The return value is -1 on error (w/errno set appropriately), 0 on success. + */ +extern int attr_get (const char *__path, const char *__attrname, + char *__attrvalue, int *__valuelength, int __flags) + __attribute__ ((deprecated)); +extern int attr_getf (int __fd, const char *__attrname, char *__attrvalue, + int *__valuelength, int __flags) + __attribute__ ((deprecated)); + +/* + * Set the value of an attribute, creating the attribute if necessary. + * The return value is -1 on error (w/errno set appropriately), 0 on success. + */ +extern int attr_set (const char *__path, const char *__attrname, + const char *__attrvalue, const int __valuelength, + int __flags) + __attribute__ ((deprecated)); +extern int attr_setf (int __fd, const char *__attrname, + const char *__attrvalue, const int __valuelength, + int __flags) + __attribute__ ((deprecated)); + +/* + * Remove an attribute. + * The return value is -1 on error (w/errno set appropriately), 0 on success. + */ +extern int attr_remove (const char *__path, const char *__attrname, + int __flags) + __attribute__ ((deprecated)); +extern int attr_removef (int __fd, const char *__attrname, int __flags) + __attribute__ ((deprecated)); + +/* + * List the names and sizes of the values of all the attributes of an object. + * "Cursor" must be allocated and zeroed before the first call, it is used + * to maintain context between system calls if all the attribute names won't + * fit into the buffer on the first system call. + * The return value is -1 on error (w/errno set appropriately), 0 on success. + */ +extern int attr_list(const char *__path, char *__buffer, const int __buffersize, + int __flags, attrlist_cursor_t *__cursor) + __attribute__ ((deprecated)); +extern int attr_listf(int __fd, char *__buffer, const int __buffersize, + int __flags, attrlist_cursor_t *__cursor) + __attribute__ ((deprecated)); + +/* + * Operate on multiple attributes of the same object simultaneously. + * + * This call will save on system call overhead when many attributes are + * going to be operated on. + * + * The return value is -1 on error (w/errno set appropriately), 0 on success. + * Note that this call will not return -1 as a result of failure of any + * of the sub-operations, their return value is stored in each element + * of the operation array. This call will return -1 for a failure of the + * call as a whole, eg: if the pathname doesn't exist, or the fd is bad. + * + * The semantics and allowable values for the fields in a attr_multiop_t + * are the same as the semantics and allowable values for the arguments to + * the corresponding "simple" attribute interface. For example: the args + * to a ATTR_OP_GET are the same as the args to an attr_get() call. + */ +extern int attr_multi (const char *__path, attr_multiop_t *__oplist, + int __count, int __flags) + __attribute__ ((deprecated)); +extern int attr_multif (int __fd, attr_multiop_t *__oplist, + int __count, int __flags) + __attribute__ ((deprecated)); + +#ifdef __cplusplus +} +#endif + +#endif /* __ATTRIBUTES_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/attr/error_context.h b/dingux/opt/mipsel-linux-uclibc/include/attr/error_context.h new file mode 100644 index 0000000..9b56944 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/attr/error_context.h @@ -0,0 +1,53 @@ +/* + Copyright (C) 2009 Andreas Gruenbacher + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 2.1 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . + */ + +#ifndef __ERROR_CONTEXT_T +#define __ERROR_CONTEXT_T + +#ifdef __cplusplus +extern "C" { +#endif + +struct error_context { + /* Process an error message */ + void (*error) (struct error_context *, const char *, ...); + + /* Quote a file name for including in an error message */ + const char *(*quote) (struct error_context *, const char *); + + /* Free a quoted name */ + void (*quote_free) (struct error_context *, const char *); +}; + +#ifdef ERROR_CONTEXT_MACROS +# define error(ctx, args...) do { \ + if ((ctx) && (ctx)->error) \ + (ctx)->error((ctx), args); \ + } while(0) +# define quote(ctx, name) \ + ( ((ctx) && (ctx)->quote) ? (ctx)->quote((ctx), (name)) : (name) ) +# define quote_free(ctx, name) do { \ + if ((ctx) && (ctx)->quote_free) \ + (ctx)->quote_free((ctx), (name)); \ + } while(0) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __ERROR_CONTEXT_T */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/attr/libattr.h b/dingux/opt/mipsel-linux-uclibc/include/attr/libattr.h new file mode 100644 index 0000000..81ebc1b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/attr/libattr.h @@ -0,0 +1,46 @@ +/* + Copyright (C) 2009 Andreas Gruenbacher + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 2.1 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . + */ + +#ifndef __LIBATTR_H +#define __LIBATTR_H + +#ifdef __cplusplus +extern "C" { +#endif + +struct error_context; + +extern int attr_copy_file (const char *, const char *, + int (*) (const char *, struct error_context *), + struct error_context *); +extern int attr_copy_fd (const char *, int, const char *, int, + int (*) (const char *, struct error_context *), + struct error_context *); + +/* Keep this function for backwards compatibility. */ +extern int attr_copy_check_permissions(const char *, struct error_context *); + +#define ATTR_ACTION_SKIP 1 +#define ATTR_ACTION_PERMISSIONS 2 + +extern int attr_copy_action(const char *, struct error_context *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/blkid/blkid.h b/dingux/opt/mipsel-linux-uclibc/include/blkid/blkid.h new file mode 100644 index 0000000..6ef836d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/blkid/blkid.h @@ -0,0 +1,461 @@ +/* + * blkid.h - Interface for libblkid, a library to identify block devices + * + * Copyright (C) 2001 Andreas Dilger + * Copyright (C) 2003 Theodore Ts'o + * Copyright (C) 2008 Karel Zak + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef _BLKID_BLKID_H +#define _BLKID_BLKID_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define BLKID_VERSION "2.31.1" +#define BLKID_DATE "19-Dec-2017" + +/** + * blkid_dev: + * + * The device object keeps information about one device + */ +typedef struct blkid_struct_dev *blkid_dev; + +/** + * blkid_cache: + * + * information about all system devices + */ +typedef struct blkid_struct_cache *blkid_cache; + +/** + * blkid_probe: + * + * low-level probing setting + */ +typedef struct blkid_struct_probe *blkid_probe; + +/** + * blkid_topology: + * + * device topology information + */ +typedef struct blkid_struct_topology *blkid_topology; + +/** + * blkid_partlist + * + * list of all detected partitions and partitions tables + */ +typedef struct blkid_struct_partlist *blkid_partlist; + +/** + * blkid_partition: + * + * information about a partition + */ +typedef struct blkid_struct_partition *blkid_partition; + +/** + * blkid_parttable: + * + * information about a partition table + */ +typedef struct blkid_struct_parttable *blkid_parttable; + +/** + * blkid_loff_t: + * + * 64-bit signed number for offsets and sizes + */ +typedef int64_t blkid_loff_t; + +/** + * blkid_tag_iterate: + * + * tags iterator for high-level (blkid_cache) API + */ +typedef struct blkid_struct_tag_iterate *blkid_tag_iterate; + +/** + * blkid_dev_iterate: + * + * devices iterator for high-level (blkid_cache) API + */ +typedef struct blkid_struct_dev_iterate *blkid_dev_iterate; + +/* + * Flags for blkid_get_dev + * + * BLKID_DEV_CREATE Create an empty device structure if not found + * in the cache. + * BLKID_DEV_VERIFY Make sure the device structure corresponds + * with reality. + * BLKID_DEV_FIND Just look up a device entry, and return NULL + * if it is not found. + * BLKID_DEV_NORMAL Get a valid device structure, either from the + * cache or by probing the device. + */ +#define BLKID_DEV_FIND 0x0000 +#define BLKID_DEV_CREATE 0x0001 +#define BLKID_DEV_VERIFY 0x0002 +#define BLKID_DEV_NORMAL (BLKID_DEV_CREATE | BLKID_DEV_VERIFY) + + +#ifndef __GNUC_PREREQ +# if defined __GNUC__ && defined __GNUC_MINOR__ +# define __GNUC_PREREQ(maj, min) ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) +# else +# define __GNUC_PREREQ(maj, min) 0 +# endif +#endif + +#ifndef __ul_attribute__ +# if __GNUC_PREREQ (3, 4) +# define __ul_attribute__(_a_) __attribute__(_a_) +# else +# define __ul_attribute__(_a_) +# endif +#endif + +/* cache.c */ +extern void blkid_init_debug(int mask); +extern void blkid_put_cache(blkid_cache cache); +extern int blkid_get_cache(blkid_cache *cache, const char *filename); +extern void blkid_gc_cache(blkid_cache cache); + +/* dev.c */ +extern const char *blkid_dev_devname(blkid_dev dev) + __ul_attribute__((warn_unused_result)); + +extern blkid_dev_iterate blkid_dev_iterate_begin(blkid_cache cache); +extern int blkid_dev_set_search(blkid_dev_iterate iter, + char *search_type, char *search_value); +extern int blkid_dev_next(blkid_dev_iterate iterate, blkid_dev *dev); +extern void blkid_dev_iterate_end(blkid_dev_iterate iterate); + +/* devno.c */ +extern char *blkid_devno_to_devname(dev_t devno) + __ul_attribute__((warn_unused_result)); +extern int blkid_devno_to_wholedisk(dev_t dev, char *diskname, + size_t len, dev_t *diskdevno) + __ul_attribute__((warn_unused_result)); + +/* devname.c */ +extern int blkid_probe_all(blkid_cache cache); +extern int blkid_probe_all_new(blkid_cache cache); +extern int blkid_probe_all_removable(blkid_cache cache); + +extern blkid_dev blkid_get_dev(blkid_cache cache, const char *devname, int flags); + +/* getsize.c */ +extern blkid_loff_t blkid_get_dev_size(int fd); + +/* verify.c */ +extern blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev); + +/* read.c */ + +/* resolve.c */ +extern char *blkid_get_tag_value(blkid_cache cache, const char *tagname, + const char *devname) + __ul_attribute__((warn_unused_result)); +extern char *blkid_get_devname(blkid_cache cache, const char *token, + const char *value) + __ul_attribute__((warn_unused_result)); + +/* tag.c */ +extern blkid_tag_iterate blkid_tag_iterate_begin(blkid_dev dev); +extern int blkid_tag_next(blkid_tag_iterate iterate, + const char **type, const char **value); +extern void blkid_tag_iterate_end(blkid_tag_iterate iterate); +extern int blkid_dev_has_tag(blkid_dev dev, const char *type, const char *value); + +extern blkid_dev blkid_find_dev_with_tag(blkid_cache cache, + const char *type, + const char *value); + +extern int blkid_parse_tag_string(const char *token, char **ret_type, char **ret_val); + +/* version.c */ +extern int blkid_parse_version_string(const char *ver_string) + __ul_attribute__((nonnull)); +extern int blkid_get_library_version(const char **ver_string, + const char **date_string); + +/* encode.c */ +extern int blkid_encode_string(const char *str, char *str_enc, size_t len); +extern int blkid_safe_string(const char *str, char *str_safe, size_t len); + +/* evaluate.c */ +extern int blkid_send_uevent(const char *devname, const char *action); +extern char *blkid_evaluate_tag(const char *token, const char *value, + blkid_cache *cache) + __ul_attribute__((warn_unused_result)); +extern char *blkid_evaluate_spec(const char *spec, blkid_cache *cache) + __ul_attribute__((warn_unused_result)); + +/* probe.c */ +extern blkid_probe blkid_new_probe(void) + __ul_attribute__((warn_unused_result)); +extern blkid_probe blkid_new_probe_from_filename(const char *filename) + __ul_attribute__((warn_unused_result)) + __ul_attribute__((nonnull)); +extern void blkid_free_probe(blkid_probe pr); + +extern void blkid_reset_probe(blkid_probe pr); +extern int blkid_probe_reset_buffers(blkid_probe pr); +extern int blkid_probe_hide_range(blkid_probe pr, uint64_t off, uint64_t len); + +extern int blkid_probe_set_device(blkid_probe pr, int fd, + blkid_loff_t off, blkid_loff_t size) + __ul_attribute__((nonnull)); + +extern dev_t blkid_probe_get_devno(blkid_probe pr) + __ul_attribute__((nonnull)); + +extern dev_t blkid_probe_get_wholedisk_devno(blkid_probe pr) + __ul_attribute__((nonnull)); + +extern int blkid_probe_is_wholedisk(blkid_probe pr) + __ul_attribute__((nonnull)); + +extern blkid_loff_t blkid_probe_get_size(blkid_probe pr) + __ul_attribute__((nonnull)); +extern blkid_loff_t blkid_probe_get_offset(blkid_probe pr) + __ul_attribute__((nonnull)); +extern unsigned int blkid_probe_get_sectorsize(blkid_probe pr) + __ul_attribute__((nonnull)); +extern int blkid_probe_set_sectorsize(blkid_probe pr, unsigned int sz) + __ul_attribute__((nonnull)); +extern blkid_loff_t blkid_probe_get_sectors(blkid_probe pr) + __ul_attribute__((nonnull)); + +extern int blkid_probe_get_fd(blkid_probe pr) + __ul_attribute__((nonnull)); + +/* + * superblocks probing + */ +extern int blkid_known_fstype(const char *fstype) + __ul_attribute__((nonnull)); + +extern int blkid_superblocks_get_name(size_t idx, const char **name, int *usage); + +extern int blkid_probe_enable_superblocks(blkid_probe pr, int enable) + __ul_attribute__((nonnull)); + +#define BLKID_SUBLKS_LABEL (1 << 1) /* read LABEL from superblock */ +#define BLKID_SUBLKS_LABELRAW (1 << 2) /* read and define LABEL_RAW result value*/ +#define BLKID_SUBLKS_UUID (1 << 3) /* read UUID from superblock */ +#define BLKID_SUBLKS_UUIDRAW (1 << 4) /* read and define UUID_RAW result value */ +#define BLKID_SUBLKS_TYPE (1 << 5) /* define TYPE result value */ +#define BLKID_SUBLKS_SECTYPE (1 << 6) /* define compatible fs type (second type) */ +#define BLKID_SUBLKS_USAGE (1 << 7) /* define USAGE result value */ +#define BLKID_SUBLKS_VERSION (1 << 8) /* read FS type from superblock */ +#define BLKID_SUBLKS_MAGIC (1 << 9) /* define SBMAGIC and SBMAGIC_OFFSET */ +#define BLKID_SUBLKS_BADCSUM (1 << 10) /* allow a bad checksum */ + +#define BLKID_SUBLKS_DEFAULT (BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID | \ + BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE) + +extern int blkid_probe_set_superblocks_flags(blkid_probe pr, int flags) + __ul_attribute__((nonnull)); +extern int blkid_probe_reset_superblocks_filter(blkid_probe pr) + __ul_attribute__((nonnull)); +extern int blkid_probe_invert_superblocks_filter(blkid_probe pr) + __ul_attribute__((nonnull)); + +/** + * BLKID_FLTR_NOTIN + */ +#define BLKID_FLTR_NOTIN 1 +/** + * BLKID_FLTR_ONLYIN + */ +#define BLKID_FLTR_ONLYIN 2 +extern int blkid_probe_filter_superblocks_type(blkid_probe pr, int flag, char *names[]) + __ul_attribute__((nonnull)); + +#define BLKID_USAGE_FILESYSTEM (1 << 1) +#define BLKID_USAGE_RAID (1 << 2) +#define BLKID_USAGE_CRYPTO (1 << 3) +#define BLKID_USAGE_OTHER (1 << 4) +extern int blkid_probe_filter_superblocks_usage(blkid_probe pr, int flag, int usage) + __ul_attribute__((nonnull)); + +/* + * topology probing + */ +extern int blkid_probe_enable_topology(blkid_probe pr, int enable) + __ul_attribute__((nonnull)); + +/* binary interface */ +extern blkid_topology blkid_probe_get_topology(blkid_probe pr) + __ul_attribute__((nonnull)); + +extern unsigned long blkid_topology_get_alignment_offset(blkid_topology tp) + __ul_attribute__((nonnull)); +extern unsigned long blkid_topology_get_minimum_io_size(blkid_topology tp) + __ul_attribute__((nonnull)); +extern unsigned long blkid_topology_get_optimal_io_size(blkid_topology tp) + __ul_attribute__((nonnull)); +extern unsigned long blkid_topology_get_logical_sector_size(blkid_topology tp) + __ul_attribute__((nonnull)); +extern unsigned long blkid_topology_get_physical_sector_size(blkid_topology tp) + __ul_attribute__((nonnull)); + +/* + * partitions probing + */ +extern int blkid_known_pttype(const char *pttype); +extern int blkid_partitions_get_name(const size_t idx, const char **name); + +extern int blkid_probe_enable_partitions(blkid_probe pr, int enable) + __ul_attribute__((nonnull)); + +extern int blkid_probe_reset_partitions_filter(blkid_probe pr) + __ul_attribute__((nonnull)); +extern int blkid_probe_invert_partitions_filter(blkid_probe pr) + __ul_attribute__((nonnull)); +extern int blkid_probe_filter_partitions_type(blkid_probe pr, int flag, char *names[]) + __ul_attribute__((nonnull)); + +/* partitions probing flags */ +#define BLKID_PARTS_FORCE_GPT (1 << 1) +#define BLKID_PARTS_ENTRY_DETAILS (1 << 2) +#define BLKID_PARTS_MAGIC (1 << 3) +extern int blkid_probe_set_partitions_flags(blkid_probe pr, int flags) + __ul_attribute__((nonnull)); + +/* binary interface */ +extern blkid_partlist blkid_probe_get_partitions(blkid_probe pr) + __ul_attribute__((nonnull)); + +extern int blkid_partlist_numof_partitions(blkid_partlist ls) + __ul_attribute__((nonnull)); +extern blkid_parttable blkid_partlist_get_table(blkid_partlist ls) + __ul_attribute__((nonnull)); +extern blkid_partition blkid_partlist_get_partition(blkid_partlist ls, int n) + __ul_attribute__((nonnull)); +extern blkid_partition blkid_partlist_get_partition_by_partno(blkid_partlist ls, int n) + __ul_attribute__((nonnull)); +extern blkid_partition blkid_partlist_devno_to_partition(blkid_partlist ls, dev_t devno) + __ul_attribute__((nonnull)); +extern blkid_parttable blkid_partition_get_table(blkid_partition par) + __ul_attribute__((nonnull)); + +extern const char *blkid_partition_get_name(blkid_partition par) + __ul_attribute__((nonnull)); +extern const char *blkid_partition_get_uuid(blkid_partition par) + __ul_attribute__((nonnull)); +extern int blkid_partition_get_partno(blkid_partition par) + __ul_attribute__((nonnull)); +extern blkid_loff_t blkid_partition_get_start(blkid_partition par) + __ul_attribute__((nonnull)); +extern blkid_loff_t blkid_partition_get_size(blkid_partition par) + __ul_attribute__((nonnull)); + +extern int blkid_partition_get_type(blkid_partition par) + __ul_attribute__((nonnull)); +extern const char *blkid_partition_get_type_string(blkid_partition par) + __ul_attribute__((nonnull)); +extern unsigned long long blkid_partition_get_flags(blkid_partition par) + __ul_attribute__((nonnull)); + +extern int blkid_partition_is_logical(blkid_partition par) + __ul_attribute__((nonnull)); +extern int blkid_partition_is_extended(blkid_partition par) + __ul_attribute__((nonnull)); +extern int blkid_partition_is_primary(blkid_partition par) + __ul_attribute__((nonnull)); + +extern const char *blkid_parttable_get_type(blkid_parttable tab) + __ul_attribute__((nonnull)); +extern const char *blkid_parttable_get_id(blkid_parttable tab) + __ul_attribute__((nonnull)); +extern blkid_loff_t blkid_parttable_get_offset(blkid_parttable tab) + __ul_attribute__((nonnull)); +extern blkid_partition blkid_parttable_get_parent(blkid_parttable tab) + __ul_attribute__((nonnull)); + +/* + * NAME=value low-level interface + */ +extern int blkid_do_probe(blkid_probe pr) + __ul_attribute__((nonnull)); +extern int blkid_do_safeprobe(blkid_probe pr) + __ul_attribute__((nonnull)); +extern int blkid_do_fullprobe(blkid_probe pr) + __ul_attribute__((nonnull)); + +extern int blkid_probe_numof_values(blkid_probe pr) + __ul_attribute__((nonnull)); +extern int blkid_probe_get_value(blkid_probe pr, int num, const char **name, + const char **data, size_t *len) + __ul_attribute__((nonnull(1))); +extern int blkid_probe_lookup_value(blkid_probe pr, const char *name, + const char **data, size_t *len) + __ul_attribute__((nonnull(1, 2))); +extern int blkid_probe_has_value(blkid_probe pr, const char *name) + __ul_attribute__((nonnull)); +extern int blkid_do_wipe(blkid_probe pr, int dryrun) + __ul_attribute__((nonnull)); +extern int blkid_probe_step_back(blkid_probe pr) + __ul_attribute__((nonnull)); + +/* + * Deprecated functions/macros + */ +#ifndef BLKID_DISABLE_DEPRECATED + +#define BLKID_PROBREQ_LABEL BLKID_SUBLKS_LABEL +#define BLKID_PROBREQ_LABELRAW BLKID_SUBLKS_LABELRAW +#define BLKID_PROBREQ_UUID BLKID_SUBLKS_UUID +#define BLKID_PROBREQ_UUIDRAW BLKID_SUBLKS_UUIDRAW +#define BLKID_PROBREQ_TYPE BLKID_SUBLKS_TYPE +#define BLKID_PROBREQ_SECTYPE BLKID_SUBLKS_SECTYPE +#define BLKID_PROBREQ_USAGE BLKID_SUBLKS_USAGE +#define BLKID_PROBREQ_VERSION BLKID_SUBLKS_VERSION + +extern int blkid_probe_set_request(blkid_probe pr, int flags) + __ul_attribute__((deprecated)); + +extern int blkid_probe_filter_usage(blkid_probe pr, int flag, int usage) + __ul_attribute__((deprecated)); + +extern int blkid_probe_filter_types(blkid_probe pr, int flag, char *names[]) + __ul_attribute__((deprecated)); + +extern int blkid_probe_invert_filter(blkid_probe pr) + __ul_attribute__((deprecated)); + +extern int blkid_probe_reset_filter(blkid_probe pr) + __ul_attribute__((deprecated)); + +#endif /* BLKID_DISABLE_DEPRECATED */ + +#ifdef __cplusplus +} +#endif + +#endif /* _BLKID_BLKID_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/com_err.h b/dingux/opt/mipsel-linux-uclibc/include/com_err.h new file mode 120000 index 0000000..b52fc72 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/com_err.h @@ -0,0 +1 @@ +et/com_err.h \ No newline at end of file diff --git a/dingux/opt/mipsel-linux-uclibc/include/e2p/e2p.h b/dingux/opt/mipsel-linux-uclibc/include/e2p/e2p.h new file mode 100644 index 0000000..e96cdec --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/e2p/e2p.h @@ -0,0 +1,79 @@ +/* + * e2p.h --- header file for the e2p library + * + * %Begin-Header% + * This file may be redistributed under the terms of the GNU Library + * General Public License, version 2. + * %End-Header% + */ + +#include /* Needed by dirent.h on netbsd */ +#include +#include + +#include + +#define E2P_FEATURE_COMPAT 0 +#define E2P_FEATURE_INCOMPAT 1 +#define E2P_FEATURE_RO_INCOMPAT 2 +#define E2P_FEATURE_TYPE_MASK 0x03 + +#define E2P_FEATURE_NEGATE_FLAG 0x80 + +#define E2P_FS_FEATURE 0 +#define E2P_JOURNAL_FEATURE 1 + +/* `options' for print_flags() */ + +#define PFOPT_LONG 1 /* Must be 1 for compatibility with `int long_format'. */ + + +int fgetflags (const char * name, unsigned long * flags); +int fgetversion (const char * name, unsigned long * version); +int fsetflags (const char * name, unsigned long flags); +int fsetversion (const char * name, unsigned long version); +int fgetproject(const char *name, unsigned long *project); +int fsetproject(const char *name, unsigned long project); +int getflags (int fd, unsigned long * flags); +int getversion (int fd, unsigned long * version); +int iterate_on_dir (const char * dir_name, + int (*func) (const char *, struct dirent *, void *), + void * private_arg); +void list_super(struct ext2_super_block * s); +void list_super2(struct ext2_super_block * s, FILE *f); +void print_fs_errors (FILE * f, unsigned short errors); +void print_flags (FILE * f, unsigned long flags, unsigned options); +void print_fs_state (FILE * f, unsigned short state); +int setflags (int fd, unsigned long flags); +int setversion (int fd, unsigned long version); + +void e2p_list_journal_super(FILE *f, char *journal_sb_buf, + int exp_block_size, int flags); + +const char *e2p_feature2string(int compat, unsigned int mask); +const char *e2p_jrnl_feature2string(int compat, unsigned int mask); +int e2p_string2feature(char *string, int *compat, unsigned int *mask); +int e2p_jrnl_string2feature(char *string, int *compat_type, unsigned int *mask); +int e2p_edit_feature(const char *str, __u32 *compat_array, __u32 *ok_array); +int e2p_edit_feature2(const char *str, __u32 *compat_array, __u32 *ok_array, + __u32 *clear_ok_array, int *type_err, + unsigned int *mask_err); + +int e2p_is_null_uuid(void *uu); +void e2p_uuid_to_str(void *uu, char *out); +const char *e2p_uuid2str(void *uu); + +const char *e2p_hash2string(int num); +int e2p_string2hash(char *string); + +const char *e2p_mntopt2string(unsigned int mask); +int e2p_string2mntopt(char *string, unsigned int *mask); +int e2p_edit_mntopts(const char *str, __u32 *mntopts, __u32 ok); + +unsigned long parse_num_blocks(const char *arg, int log_block_size); +unsigned long long parse_num_blocks2(const char *arg, int log_block_size); + +char *e2p_os2string(int os_type); +int e2p_string2os(char *str); + +unsigned int e2p_percent(int percent, unsigned int base); diff --git a/dingux/opt/mipsel-linux-uclibc/include/et/com_err.h b/dingux/opt/mipsel-linux-uclibc/include/et/com_err.h new file mode 100644 index 0000000..27a36ea --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/et/com_err.h @@ -0,0 +1,68 @@ +/* + * Header file for common error description library. + * + * Copyright 1988, Student Information Processing Board of the + * Massachusetts Institute of Technology. + * + * For copyright and distribution info, see the documentation supplied + * with this package. + */ + +#if !defined(__COM_ERR_H) && !defined(__COM_ERR_H__) + +#ifdef __GNUC__ +#define COM_ERR_ATTR(x) __attribute__(x) +#else +#define COM_ERR_ATTR(x) +#endif + +#include +#include + +typedef long errcode_t; + +struct error_table { + char const * const * msgs; + long base; + int n_msgs; +}; +struct et_list; + +extern void com_err (const char *, long, const char *, ...) + COM_ERR_ATTR((format(printf, 3, 4))); + +extern void com_err_va (const char *whoami, errcode_t code, const char *fmt, + va_list args) + COM_ERR_ATTR((format(printf, 3, 0))); + +extern char const *error_message (long); +extern void (*com_err_hook) (const char *, long, const char *, va_list); +extern void (*set_com_err_hook (void (*) (const char *, long, + const char *, va_list))) + (const char *, long, const char *, va_list); +extern void (*reset_com_err_hook (void)) (const char *, long, + const char *, va_list); +extern int init_error_table(const char * const *msgs, long base, int count); +extern char *(*set_com_err_gettext (char *(*) (const char *))) + (const char *); + +extern errcode_t add_error_table(const struct error_table * et); +extern errcode_t remove_error_table(const struct error_table * et); +extern void add_to_error_table(struct et_list *new_table); + +/* Provided for Heimdall compatibility */ +extern const char *com_right(struct et_list *list, long code); +extern const char *com_right_r(struct et_list *list, long code, char *str, size_t len); +extern void initialize_error_table_r(struct et_list **list, + const char **messages, + int num_errors, + long base); +extern void free_error_table(struct et_list *et); + +/* Provided for compatibility with other com_err libraries */ +extern int et_list_lock(void); +extern int et_list_unlock(void); + +#define __COM_ERR_H +#define __COM_ERR_H__ +#endif /* !defined(__COM_ERR_H) && !defined(__COM_ERR_H__)*/ diff --git a/dingux/opt/mipsel-linux-uclibc/include/expat.h b/dingux/opt/mipsel-linux-uclibc/include/expat.h new file mode 100644 index 0000000..1f608c0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/expat.h @@ -0,0 +1,1085 @@ +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef Expat_INCLUDED +#define Expat_INCLUDED 1 + +#ifdef __VMS +/* 0 1 2 3 0 1 2 3 + 1234567890123456789012345678901 1234567890123456789012345678901 */ +#define XML_SetProcessingInstructionHandler XML_SetProcessingInstrHandler +#define XML_SetUnparsedEntityDeclHandler XML_SetUnparsedEntDeclHandler +#define XML_SetStartNamespaceDeclHandler XML_SetStartNamespcDeclHandler +#define XML_SetExternalEntityRefHandlerArg XML_SetExternalEntRefHandlerArg +#endif + +#include +#include "expat_external.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct XML_ParserStruct; +typedef struct XML_ParserStruct *XML_Parser; + +typedef unsigned char XML_Bool; +#define XML_TRUE ((XML_Bool) 1) +#define XML_FALSE ((XML_Bool) 0) + +/* The XML_Status enum gives the possible return values for several + API functions. The preprocessor #defines are included so this + stanza can be added to code that still needs to support older + versions of Expat 1.95.x: + + #ifndef XML_STATUS_OK + #define XML_STATUS_OK 1 + #define XML_STATUS_ERROR 0 + #endif + + Otherwise, the #define hackery is quite ugly and would have been + dropped. +*/ +enum XML_Status { + XML_STATUS_ERROR = 0, +#define XML_STATUS_ERROR XML_STATUS_ERROR + XML_STATUS_OK = 1, +#define XML_STATUS_OK XML_STATUS_OK + XML_STATUS_SUSPENDED = 2 +#define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED +}; + +enum XML_Error { + XML_ERROR_NONE, + XML_ERROR_NO_MEMORY, + XML_ERROR_SYNTAX, + XML_ERROR_NO_ELEMENTS, + XML_ERROR_INVALID_TOKEN, + XML_ERROR_UNCLOSED_TOKEN, + XML_ERROR_PARTIAL_CHAR, + XML_ERROR_TAG_MISMATCH, + XML_ERROR_DUPLICATE_ATTRIBUTE, + XML_ERROR_JUNK_AFTER_DOC_ELEMENT, + XML_ERROR_PARAM_ENTITY_REF, + XML_ERROR_UNDEFINED_ENTITY, + XML_ERROR_RECURSIVE_ENTITY_REF, + XML_ERROR_ASYNC_ENTITY, + XML_ERROR_BAD_CHAR_REF, + XML_ERROR_BINARY_ENTITY_REF, + XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, + XML_ERROR_MISPLACED_XML_PI, + XML_ERROR_UNKNOWN_ENCODING, + XML_ERROR_INCORRECT_ENCODING, + XML_ERROR_UNCLOSED_CDATA_SECTION, + XML_ERROR_EXTERNAL_ENTITY_HANDLING, + XML_ERROR_NOT_STANDALONE, + XML_ERROR_UNEXPECTED_STATE, + XML_ERROR_ENTITY_DECLARED_IN_PE, + XML_ERROR_FEATURE_REQUIRES_XML_DTD, + XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING, + /* Added in 1.95.7. */ + XML_ERROR_UNBOUND_PREFIX, + /* Added in 1.95.8. */ + XML_ERROR_UNDECLARING_PREFIX, + XML_ERROR_INCOMPLETE_PE, + XML_ERROR_XML_DECL, + XML_ERROR_TEXT_DECL, + XML_ERROR_PUBLICID, + XML_ERROR_SUSPENDED, + XML_ERROR_NOT_SUSPENDED, + XML_ERROR_ABORTED, + XML_ERROR_FINISHED, + XML_ERROR_SUSPEND_PE, + /* Added in 2.0. */ + XML_ERROR_RESERVED_PREFIX_XML, + XML_ERROR_RESERVED_PREFIX_XMLNS, + XML_ERROR_RESERVED_NAMESPACE_URI, + /* Added in 2.2.1. */ + XML_ERROR_INVALID_ARGUMENT +}; + +enum XML_Content_Type { + XML_CTYPE_EMPTY = 1, + XML_CTYPE_ANY, + XML_CTYPE_MIXED, + XML_CTYPE_NAME, + XML_CTYPE_CHOICE, + XML_CTYPE_SEQ +}; + +enum XML_Content_Quant { + XML_CQUANT_NONE, + XML_CQUANT_OPT, + XML_CQUANT_REP, + XML_CQUANT_PLUS +}; + +/* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be + XML_CQUANT_NONE, and the other fields will be zero or NULL. + If type == XML_CTYPE_MIXED, then quant will be NONE or REP and + numchildren will contain number of elements that may be mixed in + and children point to an array of XML_Content cells that will be + all of XML_CTYPE_NAME type with no quantification. + + If type == XML_CTYPE_NAME, then the name points to the name, and + the numchildren field will be zero and children will be NULL. The + quant fields indicates any quantifiers placed on the name. + + CHOICE and SEQ will have name NULL, the number of children in + numchildren and children will point, recursively, to an array + of XML_Content cells. + + The EMPTY, ANY, and MIXED types will only occur at top level. +*/ + +typedef struct XML_cp XML_Content; + +struct XML_cp { + enum XML_Content_Type type; + enum XML_Content_Quant quant; + XML_Char * name; + unsigned int numchildren; + XML_Content * children; +}; + + +/* This is called for an element declaration. See above for + description of the model argument. It's the caller's responsibility + to free model when finished with it. +*/ +typedef void (XMLCALL *XML_ElementDeclHandler) (void *userData, + const XML_Char *name, + XML_Content *model); + +XMLPARSEAPI(void) +XML_SetElementDeclHandler(XML_Parser parser, + XML_ElementDeclHandler eldecl); + +/* The Attlist declaration handler is called for *each* attribute. So + a single Attlist declaration with multiple attributes declared will + generate multiple calls to this handler. The "default" parameter + may be NULL in the case of the "#IMPLIED" or "#REQUIRED" + keyword. The "isrequired" parameter will be true and the default + value will be NULL in the case of "#REQUIRED". If "isrequired" is + true and default is non-NULL, then this is a "#FIXED" default. +*/ +typedef void (XMLCALL *XML_AttlistDeclHandler) ( + void *userData, + const XML_Char *elname, + const XML_Char *attname, + const XML_Char *att_type, + const XML_Char *dflt, + int isrequired); + +XMLPARSEAPI(void) +XML_SetAttlistDeclHandler(XML_Parser parser, + XML_AttlistDeclHandler attdecl); + +/* The XML declaration handler is called for *both* XML declarations + and text declarations. The way to distinguish is that the version + parameter will be NULL for text declarations. The encoding + parameter may be NULL for XML declarations. The standalone + parameter will be -1, 0, or 1 indicating respectively that there + was no standalone parameter in the declaration, that it was given + as no, or that it was given as yes. +*/ +typedef void (XMLCALL *XML_XmlDeclHandler) (void *userData, + const XML_Char *version, + const XML_Char *encoding, + int standalone); + +XMLPARSEAPI(void) +XML_SetXmlDeclHandler(XML_Parser parser, + XML_XmlDeclHandler xmldecl); + + +typedef struct { + void *(*malloc_fcn)(size_t size); + void *(*realloc_fcn)(void *ptr, size_t size); + void (*free_fcn)(void *ptr); +} XML_Memory_Handling_Suite; + +/* Constructs a new parser; encoding is the encoding specified by the + external protocol or NULL if there is none specified. +*/ +XMLPARSEAPI(XML_Parser) +XML_ParserCreate(const XML_Char *encoding); + +/* Constructs a new parser and namespace processor. Element type + names and attribute names that belong to a namespace will be + expanded; unprefixed attribute names are never expanded; unprefixed + element type names are expanded only if there is a default + namespace. The expanded name is the concatenation of the namespace + URI, the namespace separator character, and the local part of the + name. If the namespace separator is '\0' then the namespace URI + and the local part will be concatenated without any separator. + It is a programming error to use the separator '\0' with namespace + triplets (see XML_SetReturnNSTriplet). +*/ +XMLPARSEAPI(XML_Parser) +XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator); + + +/* Constructs a new parser using the memory management suite referred to + by memsuite. If memsuite is NULL, then use the standard library memory + suite. If namespaceSeparator is non-NULL it creates a parser with + namespace processing as described above. The character pointed at + will serve as the namespace separator. + + All further memory operations used for the created parser will come from + the given suite. +*/ +XMLPARSEAPI(XML_Parser) +XML_ParserCreate_MM(const XML_Char *encoding, + const XML_Memory_Handling_Suite *memsuite, + const XML_Char *namespaceSeparator); + +/* Prepare a parser object to be re-used. This is particularly + valuable when memory allocation overhead is disproportionatly high, + such as when a large number of small documnents need to be parsed. + All handlers are cleared from the parser, except for the + unknownEncodingHandler. The parser's external state is re-initialized + except for the values of ns and ns_triplets. + + Added in Expat 1.95.3. +*/ +XMLPARSEAPI(XML_Bool) +XML_ParserReset(XML_Parser parser, const XML_Char *encoding); + +/* atts is array of name/value pairs, terminated by 0; + names and values are 0 terminated. +*/ +typedef void (XMLCALL *XML_StartElementHandler) (void *userData, + const XML_Char *name, + const XML_Char **atts); + +typedef void (XMLCALL *XML_EndElementHandler) (void *userData, + const XML_Char *name); + + +/* s is not 0 terminated. */ +typedef void (XMLCALL *XML_CharacterDataHandler) (void *userData, + const XML_Char *s, + int len); + +/* target and data are 0 terminated */ +typedef void (XMLCALL *XML_ProcessingInstructionHandler) ( + void *userData, + const XML_Char *target, + const XML_Char *data); + +/* data is 0 terminated */ +typedef void (XMLCALL *XML_CommentHandler) (void *userData, + const XML_Char *data); + +typedef void (XMLCALL *XML_StartCdataSectionHandler) (void *userData); +typedef void (XMLCALL *XML_EndCdataSectionHandler) (void *userData); + +/* This is called for any characters in the XML document for which + there is no applicable handler. This includes both characters that + are part of markup which is of a kind that is not reported + (comments, markup declarations), or characters that are part of a + construct which could be reported but for which no handler has been + supplied. The characters are passed exactly as they were in the XML + document except that they will be encoded in UTF-8 or UTF-16. + Line boundaries are not normalized. Note that a byte order mark + character is not passed to the default handler. There are no + guarantees about how characters are divided between calls to the + default handler: for example, a comment might be split between + multiple calls. +*/ +typedef void (XMLCALL *XML_DefaultHandler) (void *userData, + const XML_Char *s, + int len); + +/* This is called for the start of the DOCTYPE declaration, before + any DTD or internal subset is parsed. +*/ +typedef void (XMLCALL *XML_StartDoctypeDeclHandler) ( + void *userData, + const XML_Char *doctypeName, + const XML_Char *sysid, + const XML_Char *pubid, + int has_internal_subset); + +/* This is called for the start of the DOCTYPE declaration when the + closing > is encountered, but after processing any external + subset. +*/ +typedef void (XMLCALL *XML_EndDoctypeDeclHandler)(void *userData); + +/* This is called for entity declarations. The is_parameter_entity + argument will be non-zero if the entity is a parameter entity, zero + otherwise. + + For internal entities (), value will + be non-NULL and systemId, publicID, and notationName will be NULL. + The value string is NOT nul-terminated; the length is provided in + the value_length argument. Since it is legal to have zero-length + values, do not use this argument to test for internal entities. + + For external entities, value will be NULL and systemId will be + non-NULL. The publicId argument will be NULL unless a public + identifier was provided. The notationName argument will have a + non-NULL value only for unparsed entity declarations. + + Note that is_parameter_entity can't be changed to XML_Bool, since + that would break binary compatibility. +*/ +typedef void (XMLCALL *XML_EntityDeclHandler) ( + void *userData, + const XML_Char *entityName, + int is_parameter_entity, + const XML_Char *value, + int value_length, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId, + const XML_Char *notationName); + +XMLPARSEAPI(void) +XML_SetEntityDeclHandler(XML_Parser parser, + XML_EntityDeclHandler handler); + +/* OBSOLETE -- OBSOLETE -- OBSOLETE + This handler has been superseded by the EntityDeclHandler above. + It is provided here for backward compatibility. + + This is called for a declaration of an unparsed (NDATA) entity. + The base argument is whatever was set by XML_SetBase. The + entityName, systemId and notationName arguments will never be + NULL. The other arguments may be. +*/ +typedef void (XMLCALL *XML_UnparsedEntityDeclHandler) ( + void *userData, + const XML_Char *entityName, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId, + const XML_Char *notationName); + +/* This is called for a declaration of notation. The base argument is + whatever was set by XML_SetBase. The notationName will never be + NULL. The other arguments can be. +*/ +typedef void (XMLCALL *XML_NotationDeclHandler) ( + void *userData, + const XML_Char *notationName, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId); + +/* When namespace processing is enabled, these are called once for + each namespace declaration. The call to the start and end element + handlers occur between the calls to the start and end namespace + declaration handlers. For an xmlns attribute, prefix will be + NULL. For an xmlns="" attribute, uri will be NULL. +*/ +typedef void (XMLCALL *XML_StartNamespaceDeclHandler) ( + void *userData, + const XML_Char *prefix, + const XML_Char *uri); + +typedef void (XMLCALL *XML_EndNamespaceDeclHandler) ( + void *userData, + const XML_Char *prefix); + +/* This is called if the document is not standalone, that is, it has an + external subset or a reference to a parameter entity, but does not + have standalone="yes". If this handler returns XML_STATUS_ERROR, + then processing will not continue, and the parser will return a + XML_ERROR_NOT_STANDALONE error. + If parameter entity parsing is enabled, then in addition to the + conditions above this handler will only be called if the referenced + entity was actually read. +*/ +typedef int (XMLCALL *XML_NotStandaloneHandler) (void *userData); + +/* This is called for a reference to an external parsed general + entity. The referenced entity is not automatically parsed. The + application can parse it immediately or later using + XML_ExternalEntityParserCreate. + + The parser argument is the parser parsing the entity containing the + reference; it can be passed as the parser argument to + XML_ExternalEntityParserCreate. The systemId argument is the + system identifier as specified in the entity declaration; it will + not be NULL. + + The base argument is the system identifier that should be used as + the base for resolving systemId if systemId was relative; this is + set by XML_SetBase; it may be NULL. + + The publicId argument is the public identifier as specified in the + entity declaration, or NULL if none was specified; the whitespace + in the public identifier will have been normalized as required by + the XML spec. + + The context argument specifies the parsing context in the format + expected by the context argument to XML_ExternalEntityParserCreate; + context is valid only until the handler returns, so if the + referenced entity is to be parsed later, it must be copied. + context is NULL only when the entity is a parameter entity. + + The handler should return XML_STATUS_ERROR if processing should not + continue because of a fatal error in the handling of the external + entity. In this case the calling parser will return an + XML_ERROR_EXTERNAL_ENTITY_HANDLING error. + + Note that unlike other handlers the first argument is the parser, + not userData. +*/ +typedef int (XMLCALL *XML_ExternalEntityRefHandler) ( + XML_Parser parser, + const XML_Char *context, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId); + +/* This is called in two situations: + 1) An entity reference is encountered for which no declaration + has been read *and* this is not an error. + 2) An internal entity reference is read, but not expanded, because + XML_SetDefaultHandler has been called. + Note: skipped parameter entities in declarations and skipped general + entities in attribute values cannot be reported, because + the event would be out of sync with the reporting of the + declarations or attribute values +*/ +typedef void (XMLCALL *XML_SkippedEntityHandler) ( + void *userData, + const XML_Char *entityName, + int is_parameter_entity); + +/* This structure is filled in by the XML_UnknownEncodingHandler to + provide information to the parser about encodings that are unknown + to the parser. + + The map[b] member gives information about byte sequences whose + first byte is b. + + If map[b] is c where c is >= 0, then b by itself encodes the + Unicode scalar value c. + + If map[b] is -1, then the byte sequence is malformed. + + If map[b] is -n, where n >= 2, then b is the first byte of an + n-byte sequence that encodes a single Unicode scalar value. + + The data member will be passed as the first argument to the convert + function. + + The convert function is used to convert multibyte sequences; s will + point to a n-byte sequence where map[(unsigned char)*s] == -n. The + convert function must return the Unicode scalar value represented + by this byte sequence or -1 if the byte sequence is malformed. + + The convert function may be NULL if the encoding is a single-byte + encoding, that is if map[b] >= -1 for all bytes b. + + When the parser is finished with the encoding, then if release is + not NULL, it will call release passing it the data member; once + release has been called, the convert function will not be called + again. + + Expat places certain restrictions on the encodings that are supported + using this mechanism. + + 1. Every ASCII character that can appear in a well-formed XML document, + other than the characters + + $@\^`{}~ + + must be represented by a single byte, and that byte must be the + same byte that represents that character in ASCII. + + 2. No character may require more than 4 bytes to encode. + + 3. All characters encoded must have Unicode scalar values <= + 0xFFFF, (i.e., characters that would be encoded by surrogates in + UTF-16 are not allowed). Note that this restriction doesn't + apply to the built-in support for UTF-8 and UTF-16. + + 4. No Unicode character may be encoded by more than one distinct + sequence of bytes. +*/ +typedef struct { + int map[256]; + void *data; + int (XMLCALL *convert)(void *data, const char *s); + void (XMLCALL *release)(void *data); +} XML_Encoding; + +/* This is called for an encoding that is unknown to the parser. + + The encodingHandlerData argument is that which was passed as the + second argument to XML_SetUnknownEncodingHandler. + + The name argument gives the name of the encoding as specified in + the encoding declaration. + + If the callback can provide information about the encoding, it must + fill in the XML_Encoding structure, and return XML_STATUS_OK. + Otherwise it must return XML_STATUS_ERROR. + + If info does not describe a suitable encoding, then the parser will + return an XML_UNKNOWN_ENCODING error. +*/ +typedef int (XMLCALL *XML_UnknownEncodingHandler) ( + void *encodingHandlerData, + const XML_Char *name, + XML_Encoding *info); + +XMLPARSEAPI(void) +XML_SetElementHandler(XML_Parser parser, + XML_StartElementHandler start, + XML_EndElementHandler end); + +XMLPARSEAPI(void) +XML_SetStartElementHandler(XML_Parser parser, + XML_StartElementHandler handler); + +XMLPARSEAPI(void) +XML_SetEndElementHandler(XML_Parser parser, + XML_EndElementHandler handler); + +XMLPARSEAPI(void) +XML_SetCharacterDataHandler(XML_Parser parser, + XML_CharacterDataHandler handler); + +XMLPARSEAPI(void) +XML_SetProcessingInstructionHandler(XML_Parser parser, + XML_ProcessingInstructionHandler handler); +XMLPARSEAPI(void) +XML_SetCommentHandler(XML_Parser parser, + XML_CommentHandler handler); + +XMLPARSEAPI(void) +XML_SetCdataSectionHandler(XML_Parser parser, + XML_StartCdataSectionHandler start, + XML_EndCdataSectionHandler end); + +XMLPARSEAPI(void) +XML_SetStartCdataSectionHandler(XML_Parser parser, + XML_StartCdataSectionHandler start); + +XMLPARSEAPI(void) +XML_SetEndCdataSectionHandler(XML_Parser parser, + XML_EndCdataSectionHandler end); + +/* This sets the default handler and also inhibits expansion of + internal entities. These entity references will be passed to the + default handler, or to the skipped entity handler, if one is set. +*/ +XMLPARSEAPI(void) +XML_SetDefaultHandler(XML_Parser parser, + XML_DefaultHandler handler); + +/* This sets the default handler but does not inhibit expansion of + internal entities. The entity reference will not be passed to the + default handler. +*/ +XMLPARSEAPI(void) +XML_SetDefaultHandlerExpand(XML_Parser parser, + XML_DefaultHandler handler); + +XMLPARSEAPI(void) +XML_SetDoctypeDeclHandler(XML_Parser parser, + XML_StartDoctypeDeclHandler start, + XML_EndDoctypeDeclHandler end); + +XMLPARSEAPI(void) +XML_SetStartDoctypeDeclHandler(XML_Parser parser, + XML_StartDoctypeDeclHandler start); + +XMLPARSEAPI(void) +XML_SetEndDoctypeDeclHandler(XML_Parser parser, + XML_EndDoctypeDeclHandler end); + +XMLPARSEAPI(void) +XML_SetUnparsedEntityDeclHandler(XML_Parser parser, + XML_UnparsedEntityDeclHandler handler); + +XMLPARSEAPI(void) +XML_SetNotationDeclHandler(XML_Parser parser, + XML_NotationDeclHandler handler); + +XMLPARSEAPI(void) +XML_SetNamespaceDeclHandler(XML_Parser parser, + XML_StartNamespaceDeclHandler start, + XML_EndNamespaceDeclHandler end); + +XMLPARSEAPI(void) +XML_SetStartNamespaceDeclHandler(XML_Parser parser, + XML_StartNamespaceDeclHandler start); + +XMLPARSEAPI(void) +XML_SetEndNamespaceDeclHandler(XML_Parser parser, + XML_EndNamespaceDeclHandler end); + +XMLPARSEAPI(void) +XML_SetNotStandaloneHandler(XML_Parser parser, + XML_NotStandaloneHandler handler); + +XMLPARSEAPI(void) +XML_SetExternalEntityRefHandler(XML_Parser parser, + XML_ExternalEntityRefHandler handler); + +/* If a non-NULL value for arg is specified here, then it will be + passed as the first argument to the external entity ref handler + instead of the parser object. +*/ +XMLPARSEAPI(void) +XML_SetExternalEntityRefHandlerArg(XML_Parser parser, + void *arg); + +XMLPARSEAPI(void) +XML_SetSkippedEntityHandler(XML_Parser parser, + XML_SkippedEntityHandler handler); + +XMLPARSEAPI(void) +XML_SetUnknownEncodingHandler(XML_Parser parser, + XML_UnknownEncodingHandler handler, + void *encodingHandlerData); + +/* This can be called within a handler for a start element, end + element, processing instruction or character data. It causes the + corresponding markup to be passed to the default handler. +*/ +XMLPARSEAPI(void) +XML_DefaultCurrent(XML_Parser parser); + +/* If do_nst is non-zero, and namespace processing is in effect, and + a name has a prefix (i.e. an explicit namespace qualifier) then + that name is returned as a triplet in a single string separated by + the separator character specified when the parser was created: URI + + sep + local_name + sep + prefix. + + If do_nst is zero, then namespace information is returned in the + default manner (URI + sep + local_name) whether or not the name + has a prefix. + + Note: Calling XML_SetReturnNSTriplet after XML_Parse or + XML_ParseBuffer has no effect. +*/ + +XMLPARSEAPI(void) +XML_SetReturnNSTriplet(XML_Parser parser, int do_nst); + +/* This value is passed as the userData argument to callbacks. */ +XMLPARSEAPI(void) +XML_SetUserData(XML_Parser parser, void *userData); + +/* Returns the last value set by XML_SetUserData or NULL. */ +#define XML_GetUserData(parser) (*(void **)(parser)) + +/* This is equivalent to supplying an encoding argument to + XML_ParserCreate. On success XML_SetEncoding returns non-zero, + zero otherwise. + Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer + has no effect and returns XML_STATUS_ERROR. +*/ +XMLPARSEAPI(enum XML_Status) +XML_SetEncoding(XML_Parser parser, const XML_Char *encoding); + +/* If this function is called, then the parser will be passed as the + first argument to callbacks instead of userData. The userData will + still be accessible using XML_GetUserData. +*/ +XMLPARSEAPI(void) +XML_UseParserAsHandlerArg(XML_Parser parser); + +/* If useDTD == XML_TRUE is passed to this function, then the parser + will assume that there is an external subset, even if none is + specified in the document. In such a case the parser will call the + externalEntityRefHandler with a value of NULL for the systemId + argument (the publicId and context arguments will be NULL as well). + Note: For the purpose of checking WFC: Entity Declared, passing + useDTD == XML_TRUE will make the parser behave as if the document + had a DTD with an external subset. + Note: If this function is called, then this must be done before + the first call to XML_Parse or XML_ParseBuffer, since it will + have no effect after that. Returns + XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING. + Note: If the document does not have a DOCTYPE declaration at all, + then startDoctypeDeclHandler and endDoctypeDeclHandler will not + be called, despite an external subset being parsed. + Note: If XML_DTD is not defined when Expat is compiled, returns + XML_ERROR_FEATURE_REQUIRES_XML_DTD. + Note: If parser == NULL, returns XML_ERROR_INVALID_ARGUMENT. +*/ +XMLPARSEAPI(enum XML_Error) +XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD); + + +/* Sets the base to be used for resolving relative URIs in system + identifiers in declarations. Resolving relative identifiers is + left to the application: this value will be passed through as the + base argument to the XML_ExternalEntityRefHandler, + XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base + argument will be copied. Returns XML_STATUS_ERROR if out of memory, + XML_STATUS_OK otherwise. +*/ +XMLPARSEAPI(enum XML_Status) +XML_SetBase(XML_Parser parser, const XML_Char *base); + +XMLPARSEAPI(const XML_Char *) +XML_GetBase(XML_Parser parser); + +/* Returns the number of the attribute/value pairs passed in last call + to the XML_StartElementHandler that were specified in the start-tag + rather than defaulted. Each attribute/value pair counts as 2; thus + this correspondds to an index into the atts array passed to the + XML_StartElementHandler. Returns -1 if parser == NULL. +*/ +XMLPARSEAPI(int) +XML_GetSpecifiedAttributeCount(XML_Parser parser); + +/* Returns the index of the ID attribute passed in the last call to + XML_StartElementHandler, or -1 if there is no ID attribute or + parser == NULL. Each attribute/value pair counts as 2; thus this + correspondds to an index into the atts array passed to the + XML_StartElementHandler. +*/ +XMLPARSEAPI(int) +XML_GetIdAttributeIndex(XML_Parser parser); + +#ifdef XML_ATTR_INFO +/* Source file byte offsets for the start and end of attribute names and values. + The value indices are exclusive of surrounding quotes; thus in a UTF-8 source + file an attribute value of "blah" will yield: + info->valueEnd - info->valueStart = 4 bytes. +*/ +typedef struct { + XML_Index nameStart; /* Offset to beginning of the attribute name. */ + XML_Index nameEnd; /* Offset after the attribute name's last byte. */ + XML_Index valueStart; /* Offset to beginning of the attribute value. */ + XML_Index valueEnd; /* Offset after the attribute value's last byte. */ +} XML_AttrInfo; + +/* Returns an array of XML_AttrInfo structures for the attribute/value pairs + passed in last call to the XML_StartElementHandler that were specified + in the start-tag rather than defaulted. Each attribute/value pair counts + as 1; thus the number of entries in the array is + XML_GetSpecifiedAttributeCount(parser) / 2. +*/ +XMLPARSEAPI(const XML_AttrInfo *) +XML_GetAttributeInfo(XML_Parser parser); +#endif + +/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is + detected. The last call to XML_Parse must have isFinal true; len + may be zero for this call (or any other). + + Though the return values for these functions has always been + described as a Boolean value, the implementation, at least for the + 1.95.x series, has always returned exactly one of the XML_Status + values. +*/ +XMLPARSEAPI(enum XML_Status) +XML_Parse(XML_Parser parser, const char *s, int len, int isFinal); + +XMLPARSEAPI(void *) +XML_GetBuffer(XML_Parser parser, int len); + +XMLPARSEAPI(enum XML_Status) +XML_ParseBuffer(XML_Parser parser, int len, int isFinal); + +/* Stops parsing, causing XML_Parse() or XML_ParseBuffer() to return. + Must be called from within a call-back handler, except when aborting + (resumable = 0) an already suspended parser. Some call-backs may + still follow because they would otherwise get lost. Examples: + - endElementHandler() for empty elements when stopped in + startElementHandler(), + - endNameSpaceDeclHandler() when stopped in endElementHandler(), + and possibly others. + + Can be called from most handlers, including DTD related call-backs, + except when parsing an external parameter entity and resumable != 0. + Returns XML_STATUS_OK when successful, XML_STATUS_ERROR otherwise. + Possible error codes: + - XML_ERROR_SUSPENDED: when suspending an already suspended parser. + - XML_ERROR_FINISHED: when the parser has already finished. + - XML_ERROR_SUSPEND_PE: when suspending while parsing an external PE. + + When resumable != 0 (true) then parsing is suspended, that is, + XML_Parse() and XML_ParseBuffer() return XML_STATUS_SUSPENDED. + Otherwise, parsing is aborted, that is, XML_Parse() and XML_ParseBuffer() + return XML_STATUS_ERROR with error code XML_ERROR_ABORTED. + + *Note*: + This will be applied to the current parser instance only, that is, if + there is a parent parser then it will continue parsing when the + externalEntityRefHandler() returns. It is up to the implementation of + the externalEntityRefHandler() to call XML_StopParser() on the parent + parser (recursively), if one wants to stop parsing altogether. + + When suspended, parsing can be resumed by calling XML_ResumeParser(). +*/ +XMLPARSEAPI(enum XML_Status) +XML_StopParser(XML_Parser parser, XML_Bool resumable); + +/* Resumes parsing after it has been suspended with XML_StopParser(). + Must not be called from within a handler call-back. Returns same + status codes as XML_Parse() or XML_ParseBuffer(). + Additional error code XML_ERROR_NOT_SUSPENDED possible. + + *Note*: + This must be called on the most deeply nested child parser instance + first, and on its parent parser only after the child parser has finished, + to be applied recursively until the document entity's parser is restarted. + That is, the parent parser will not resume by itself and it is up to the + application to call XML_ResumeParser() on it at the appropriate moment. +*/ +XMLPARSEAPI(enum XML_Status) +XML_ResumeParser(XML_Parser parser); + +enum XML_Parsing { + XML_INITIALIZED, + XML_PARSING, + XML_FINISHED, + XML_SUSPENDED +}; + +typedef struct { + enum XML_Parsing parsing; + XML_Bool finalBuffer; +} XML_ParsingStatus; + +/* Returns status of parser with respect to being initialized, parsing, + finished, or suspended and processing the final buffer. + XXX XML_Parse() and XML_ParseBuffer() should return XML_ParsingStatus, + XXX with XML_FINISHED_OK or XML_FINISHED_ERROR replacing XML_FINISHED +*/ +XMLPARSEAPI(void) +XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status); + +/* Creates an XML_Parser object that can parse an external general + entity; context is a '\0'-terminated string specifying the parse + context; encoding is a '\0'-terminated string giving the name of + the externally specified encoding, or NULL if there is no + externally specified encoding. The context string consists of a + sequence of tokens separated by formfeeds (\f); a token consisting + of a name specifies that the general entity of the name is open; a + token of the form prefix=uri specifies the namespace for a + particular prefix; a token of the form =uri specifies the default + namespace. This can be called at any point after the first call to + an ExternalEntityRefHandler so longer as the parser has not yet + been freed. The new parser is completely independent and may + safely be used in a separate thread. The handlers and userData are + initialized from the parser argument. Returns NULL if out of memory. + Otherwise returns a new XML_Parser object. +*/ +XMLPARSEAPI(XML_Parser) +XML_ExternalEntityParserCreate(XML_Parser parser, + const XML_Char *context, + const XML_Char *encoding); + +enum XML_ParamEntityParsing { + XML_PARAM_ENTITY_PARSING_NEVER, + XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE, + XML_PARAM_ENTITY_PARSING_ALWAYS +}; + +/* Controls parsing of parameter entities (including the external DTD + subset). If parsing of parameter entities is enabled, then + references to external parameter entities (including the external + DTD subset) will be passed to the handler set with + XML_SetExternalEntityRefHandler. The context passed will be 0. + + Unlike external general entities, external parameter entities can + only be parsed synchronously. If the external parameter entity is + to be parsed, it must be parsed during the call to the external + entity ref handler: the complete sequence of + XML_ExternalEntityParserCreate, XML_Parse/XML_ParseBuffer and + XML_ParserFree calls must be made during this call. After + XML_ExternalEntityParserCreate has been called to create the parser + for the external parameter entity (context must be 0 for this + call), it is illegal to make any calls on the old parser until + XML_ParserFree has been called on the newly created parser. + If the library has been compiled without support for parameter + entity parsing (ie without XML_DTD being defined), then + XML_SetParamEntityParsing will return 0 if parsing of parameter + entities is requested; otherwise it will return non-zero. + Note: If XML_SetParamEntityParsing is called after XML_Parse or + XML_ParseBuffer, then it has no effect and will always return 0. + Note: If parser == NULL, the function will do nothing and return 0. +*/ +XMLPARSEAPI(int) +XML_SetParamEntityParsing(XML_Parser parser, + enum XML_ParamEntityParsing parsing); + +/* Sets the hash salt to use for internal hash calculations. + Helps in preventing DoS attacks based on predicting hash + function behavior. This must be called before parsing is started. + Returns 1 if successful, 0 when called after parsing has started. + Note: If parser == NULL, the function will do nothing and return 0. +*/ +XMLPARSEAPI(int) +XML_SetHashSalt(XML_Parser parser, + unsigned long hash_salt); + +/* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then + XML_GetErrorCode returns information about the error. +*/ +XMLPARSEAPI(enum XML_Error) +XML_GetErrorCode(XML_Parser parser); + +/* These functions return information about the current parse + location. They may be called from any callback called to report + some parse event; in this case the location is the location of the + first of the sequence of characters that generated the event. When + called from callbacks generated by declarations in the document + prologue, the location identified isn't as neatly defined, but will + be within the relevant markup. When called outside of the callback + functions, the position indicated will be just past the last parse + event (regardless of whether there was an associated callback). + + They may also be called after returning from a call to XML_Parse + or XML_ParseBuffer. If the return value is XML_STATUS_ERROR then + the location is the location of the character at which the error + was detected; otherwise the location is the location of the last + parse event, as described above. + + Note: XML_GetCurrentLineNumber and XML_GetCurrentColumnNumber + return 0 to indicate an error. + Note: XML_GetCurrentByteIndex returns -1 to indicate an error. +*/ +XMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser); +XMLPARSEAPI(XML_Size) XML_GetCurrentColumnNumber(XML_Parser parser); +XMLPARSEAPI(XML_Index) XML_GetCurrentByteIndex(XML_Parser parser); + +/* Return the number of bytes in the current event. + Returns 0 if the event is in an internal entity. +*/ +XMLPARSEAPI(int) +XML_GetCurrentByteCount(XML_Parser parser); + +/* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets + the integer pointed to by offset to the offset within this buffer + of the current parse position, and sets the integer pointed to by size + to the size of this buffer (the number of input bytes). Otherwise + returns a NULL pointer. Also returns a NULL pointer if a parse isn't + active. + + NOTE: The character pointer returned should not be used outside + the handler that makes the call. +*/ +XMLPARSEAPI(const char *) +XML_GetInputContext(XML_Parser parser, + int *offset, + int *size); + +/* For backwards compatibility with previous versions. */ +#define XML_GetErrorLineNumber XML_GetCurrentLineNumber +#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber +#define XML_GetErrorByteIndex XML_GetCurrentByteIndex + +/* Frees the content model passed to the element declaration handler */ +XMLPARSEAPI(void) +XML_FreeContentModel(XML_Parser parser, XML_Content *model); + +/* Exposing the memory handling functions used in Expat */ +XMLPARSEAPI(void *) +XML_ATTR_MALLOC +XML_ATTR_ALLOC_SIZE(2) +XML_MemMalloc(XML_Parser parser, size_t size); + +XMLPARSEAPI(void *) +XML_ATTR_ALLOC_SIZE(3) +XML_MemRealloc(XML_Parser parser, void *ptr, size_t size); + +XMLPARSEAPI(void) +XML_MemFree(XML_Parser parser, void *ptr); + +/* Frees memory used by the parser. */ +XMLPARSEAPI(void) +XML_ParserFree(XML_Parser parser); + +/* Returns a string describing the error. */ +XMLPARSEAPI(const XML_LChar *) +XML_ErrorString(enum XML_Error code); + +/* Return a string containing the version number of this expat */ +XMLPARSEAPI(const XML_LChar *) +XML_ExpatVersion(void); + +typedef struct { + int major; + int minor; + int micro; +} XML_Expat_Version; + +/* Return an XML_Expat_Version structure containing numeric version + number information for this version of expat. +*/ +XMLPARSEAPI(XML_Expat_Version) +XML_ExpatVersionInfo(void); + +/* Added in Expat 1.95.5. */ +enum XML_FeatureEnum { + XML_FEATURE_END = 0, + XML_FEATURE_UNICODE, + XML_FEATURE_UNICODE_WCHAR_T, + XML_FEATURE_DTD, + XML_FEATURE_CONTEXT_BYTES, + XML_FEATURE_MIN_SIZE, + XML_FEATURE_SIZEOF_XML_CHAR, + XML_FEATURE_SIZEOF_XML_LCHAR, + XML_FEATURE_NS, + XML_FEATURE_LARGE_SIZE, + XML_FEATURE_ATTR_INFO + /* Additional features must be added to the end of this enum. */ +}; + +typedef struct { + enum XML_FeatureEnum feature; + const XML_LChar *name; + long int value; +} XML_Feature; + +XMLPARSEAPI(const XML_Feature *) +XML_GetFeatureList(void); + + +/* Expat follows the semantic versioning convention. + See http://semver.org. +*/ +#define XML_MAJOR_VERSION 2 +#define XML_MINOR_VERSION 2 +#define XML_MICRO_VERSION 5 + +#ifdef __cplusplus +} +#endif + +#endif /* not Expat_INCLUDED */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/expat_config.h b/dingux/opt/mipsel-linux-uclibc/include/expat_config.h new file mode 100644 index 0000000..3305431 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/expat_config.h @@ -0,0 +1,123 @@ +/* expat_config.h. Generated from expat_config.h.in by configure. */ +/* expat_config.h.in. Generated from configure.ac by autoheader. */ + +/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ +#define BYTEORDER 1234 + +/* Define to 1 if you have the `arc4random' function. */ +/* #undef HAVE_ARC4RANDOM */ + +/* Define to 1 if you have the `arc4random_buf' function. */ +/* #undef HAVE_ARC4RANDOM_BUF */ + +/* Define to 1 if you have the `bcopy' function. */ +#define HAVE_BCOPY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `getpagesize' function. */ +#define HAVE_GETPAGESIZE 1 + +/* Define to 1 if you have the `getrandom' function. */ +#define HAVE_GETRANDOM 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `bsd' library (-lbsd). */ +/* #undef HAVE_LIBBSD */ + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have a working `mmap' system call. */ +#define HAVE_MMAP 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have `syscall' and `SYS_getrandom'. */ +/* #undef HAVE_SYSCALL_GETRANDOM */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* Name of package */ +#define PACKAGE "expat" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "expat-bugs@libexpat.org" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "expat" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "expat 2.2.5" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "expat" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "2.2.5" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "2.2.5" + +/* whether byteorder is bigendian */ +/* #undef WORDS_BIGENDIAN */ + +/* Define to specify how much context to retain around the current parse + point. */ +#define XML_CONTEXT_BYTES 1024 + +/* Define to include code reading entropy from `/dev/urandom'. */ +#define XML_DEV_URANDOM 1 + +/* Define to make parameter entity parsing functionality available. */ +#define XML_DTD 1 + +/* Define to make XML Namespaces functionality available. */ +#define XML_NS 1 + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `long int' if does not define. */ +/* #undef off_t */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/expat_external.h b/dingux/opt/mipsel-linux-uclibc/include/expat_external.h new file mode 100644 index 0000000..629483a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/expat_external.h @@ -0,0 +1,162 @@ +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000-2017 Expat development team + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef Expat_External_INCLUDED +#define Expat_External_INCLUDED 1 + +/* External API definitions */ + +#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) +# define XML_USE_MSC_EXTENSIONS 1 +#endif + +/* Expat tries very hard to make the API boundary very specifically + defined. There are two macros defined to control this boundary; + each of these can be defined before including this header to + achieve some different behavior, but doing so it not recommended or + tested frequently. + + XMLCALL - The calling convention to use for all calls across the + "library boundary." This will default to cdecl, and + try really hard to tell the compiler that's what we + want. + + XMLIMPORT - Whatever magic is needed to note that a function is + to be imported from a dynamically loaded library + (.dll, .so, or .sl, depending on your platform). + + The XMLCALL macro was added in Expat 1.95.7. The only one which is + expected to be directly useful in client code is XMLCALL. + + Note that on at least some Unix versions, the Expat library must be + compiled with the cdecl calling convention as the default since + system headers may assume the cdecl convention. +*/ +#ifndef XMLCALL +# if defined(_MSC_VER) +# define XMLCALL __cdecl +# elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER) +# define XMLCALL __attribute__((cdecl)) +# else +/* For any platform which uses this definition and supports more than + one calling convention, we need to extend this definition to + declare the convention used on that platform, if it's possible to + do so. + + If this is the case for your platform, please file a bug report + with information on how to identify your platform via the C + pre-processor and how to specify the same calling convention as the + platform's malloc() implementation. +*/ +# define XMLCALL +# endif +#endif /* not defined XMLCALL */ + + +#if !defined(XML_STATIC) && !defined(XMLIMPORT) +# ifndef XML_BUILDING_EXPAT +/* using Expat from an application */ + +# ifdef XML_USE_MSC_EXTENSIONS +# define XMLIMPORT __declspec(dllimport) +# endif + +# endif +#endif /* not defined XML_STATIC */ + +#if !defined(XMLIMPORT) && defined(__GNUC__) && (__GNUC__ >= 4) +# define XMLIMPORT __attribute__ ((visibility ("default"))) +#endif + +/* If we didn't define it above, define it away: */ +#ifndef XMLIMPORT +# define XMLIMPORT +#endif + +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)) +# define XML_ATTR_MALLOC __attribute__((__malloc__)) +#else +# define XML_ATTR_MALLOC +#endif + +#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) +# define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x))) +#else +# define XML_ATTR_ALLOC_SIZE(x) +#endif + +#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef XML_UNICODE_WCHAR_T +# ifndef XML_UNICODE +# define XML_UNICODE +# endif +# if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2) +# error "sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc" +# endif +#endif + +#ifdef XML_UNICODE /* Information is UTF-16 encoded. */ +# ifdef XML_UNICODE_WCHAR_T +typedef wchar_t XML_Char; +typedef wchar_t XML_LChar; +# else +typedef unsigned short XML_Char; +typedef char XML_LChar; +# endif /* XML_UNICODE_WCHAR_T */ +#else /* Information is UTF-8 encoded. */ +typedef char XML_Char; +typedef char XML_LChar; +#endif /* XML_UNICODE */ + +#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */ +# if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 +typedef __int64 XML_Index; +typedef unsigned __int64 XML_Size; +# else +typedef long long XML_Index; +typedef unsigned long long XML_Size; +# endif +#else +typedef long XML_Index; +typedef unsigned long XML_Size; +#endif /* XML_LARGE_SIZE */ + +#ifdef __cplusplus +} +#endif + +#endif /* not Expat_External_INCLUDED */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/ext2fs/bitops.h b/dingux/opt/mipsel-linux-uclibc/include/ext2fs/bitops.h new file mode 100644 index 0000000..bc59608 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ext2fs/bitops.h @@ -0,0 +1,703 @@ +/* + * bitops.h --- Bitmap frobbing code. The byte swapping routines are + * also included here. + * + * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. + * + * %Begin-Header% + * This file may be redistributed under the terms of the GNU Library + * General Public License, version 2. + * %End-Header% + */ + +#ifdef WORDS_BIGENDIAN +#define ext2fs_cpu_to_le64(x) ((__force __le64)ext2fs_swab64((__u64)(x))) +#define ext2fs_le64_to_cpu(x) ext2fs_swab64((__force __u64)(__le64)(x)) +#define ext2fs_cpu_to_le32(x) ((__force __le32)ext2fs_swab32((__u32)(x))) +#define ext2fs_le32_to_cpu(x) ext2fs_swab32((__force __u32)(__le32)(x)) +#define ext2fs_cpu_to_le16(x) ((__force __le16)ext2fs_swab16((__u16)(x))) +#define ext2fs_le16_to_cpu(x) ext2fs_swab16((__force __u16)(__le16)(x)) + +#define ext2fs_cpu_to_be64(x) ((__force __be64)(__u64)(x)) +#define ext2fs_be64_to_cpu(x) ((__force __u64)(__be64)(x)) +#define ext2fs_cpu_to_be32(x) ((__force __be32)(__u32)(x)) +#define ext2fs_be32_to_cpu(x) ((__force __u32)(__be32)(x)) +#define ext2fs_cpu_to_be16(x) ((__force __be16)(__u16)(x)) +#define ext2fs_be16_to_cpu(x) ((__force __u16)(__be16)(x)) +#else +#define ext2fs_cpu_to_le64(x) ((__force __le64)(__u64)(x)) +#define ext2fs_le64_to_cpu(x) ((__force __u64)(__le64)(x)) +#define ext2fs_cpu_to_le32(x) ((__force __le32)(__u32)(x)) +#define ext2fs_le32_to_cpu(x) ((__force __u32)(__le32)(x)) +#define ext2fs_cpu_to_le16(x) ((__force __le16)(__u16)(x)) +#define ext2fs_le16_to_cpu(x) ((__force __u16)(__le16)(x)) + +#define ext2fs_cpu_to_be64(x) ((__force __be64)ext2fs_swab64((__u64)(x))) +#define ext2fs_be64_to_cpu(x) ext2fs_swab64((__force __u64)(__be64)(x)) +#define ext2fs_cpu_to_be32(x) ((__force __be32)ext2fs_swab32((__u32)(x))) +#define ext2fs_be32_to_cpu(x) ext2fs_swab32((__force __u32)(__be32)(x)) +#define ext2fs_cpu_to_be16(x) ((__force __be16)ext2fs_swab16((__u16)(x))) +#define ext2fs_be16_to_cpu(x) ext2fs_swab16((__force __u16)(__be16)(x)) +#endif + +/* + * EXT2FS bitmap manipulation routines. + */ + +/* Support for sending warning messages from the inline subroutines */ +extern const char *ext2fs_block_string; +extern const char *ext2fs_inode_string; +extern const char *ext2fs_mark_string; +extern const char *ext2fs_unmark_string; +extern const char *ext2fs_test_string; +extern void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg, + const char *description); +extern void ext2fs_warn_bitmap2(ext2fs_generic_bitmap bitmap, + int code, unsigned long arg); + +#ifdef NO_INLINE_FUNCS +extern void ext2fs_fast_set_bit(unsigned int nr,void * addr); +extern void ext2fs_fast_clear_bit(unsigned int nr, void * addr); +extern void ext2fs_fast_set_bit64(__u64 nr,void * addr); +extern void ext2fs_fast_clear_bit64(__u64 nr, void * addr); +extern __u16 ext2fs_swab16(__u16 val); +extern __u32 ext2fs_swab32(__u32 val); +extern __u64 ext2fs_swab64(__u64 val); + +extern int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); +extern int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap, + blk_t block); +extern int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); + +extern int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); +extern int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, + ext2_ino_t inode); +extern int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); + +extern void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap, + blk_t block); +extern void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap, + blk_t block); +extern int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap, + blk_t block); + +extern void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, + ext2_ino_t inode); +extern void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, + ext2_ino_t inode); +extern int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap, + ext2_ino_t inode); +extern blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap); +extern ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap); +extern blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap); +extern ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap); + +extern void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, + blk_t block, int num); +extern void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, + blk_t block, int num); +extern int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap, + blk_t block, int num); +#endif + +/* These functions routines moved to gen_bitmap.c */ +extern void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, + blk_t block, int num); +extern void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, + blk_t block, int num); +extern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap, + blk_t block, int num); +extern int ext2fs_test_inode_bitmap_range(ext2fs_inode_bitmap bitmap, + ino_t inode, int num); +extern int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap, + __u32 bitno); +extern int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap, + blk_t bitno); +extern int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap, + blk_t bitno); +extern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap, + blk_t block, int num); +extern void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map); +extern __u32 ext2fs_get_generic_bitmap_start(ext2fs_generic_bitmap bitmap); +extern __u32 ext2fs_get_generic_bitmap_end(ext2fs_generic_bitmap bitmap); + +/* 64-bit versions */ + +#ifdef NO_INLINE_FUNCS +extern int ext2fs_mark_block_bitmap2(ext2fs_block_bitmap bitmap, + blk64_t block); +extern int ext2fs_unmark_block_bitmap2(ext2fs_block_bitmap bitmap, + blk64_t block); +extern int ext2fs_test_block_bitmap2(ext2fs_block_bitmap bitmap, + blk64_t block); + +extern int ext2fs_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap, + ext2_ino_t inode); +extern int ext2fs_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap, + ext2_ino_t inode); +extern int ext2fs_test_inode_bitmap2(ext2fs_inode_bitmap bitmap, + ext2_ino_t inode); + +extern void ext2fs_fast_mark_block_bitmap2(ext2fs_block_bitmap bitmap, + blk64_t block); +extern void ext2fs_fast_unmark_block_bitmap2(ext2fs_block_bitmap bitmap, + blk64_t block); +extern int ext2fs_fast_test_block_bitmap2(ext2fs_block_bitmap bitmap, + blk64_t block); + +extern void ext2fs_fast_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap, + ext2_ino_t inode); +extern void ext2fs_fast_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap, + ext2_ino_t inode); +extern int ext2fs_fast_test_inode_bitmap2(ext2fs_inode_bitmap bitmap, + ext2_ino_t inode); +extern errcode_t ext2fs_find_first_zero_block_bitmap2(ext2fs_block_bitmap bitmap, + blk64_t start, + blk64_t end, + blk64_t *out); +extern errcode_t ext2fs_find_first_zero_inode_bitmap2(ext2fs_inode_bitmap bitmap, + ext2_ino_t start, + ext2_ino_t end, + ext2_ino_t *out); +extern errcode_t ext2fs_find_first_set_block_bitmap2(ext2fs_block_bitmap bitmap, + blk64_t start, + blk64_t end, + blk64_t *out); +extern errcode_t ext2fs_find_first_set_inode_bitmap2(ext2fs_inode_bitmap bitmap, + ext2_ino_t start, + ext2_ino_t end, + ext2_ino_t *out); +extern blk64_t ext2fs_get_block_bitmap_start2(ext2fs_block_bitmap bitmap); +extern ext2_ino_t ext2fs_get_inode_bitmap_start2(ext2fs_inode_bitmap bitmap); +extern blk64_t ext2fs_get_block_bitmap_end2(ext2fs_block_bitmap bitmap); +extern ext2_ino_t ext2fs_get_inode_bitmap_end2(ext2fs_inode_bitmap bitmap); + +extern int ext2fs_fast_test_block_bitmap_range2(ext2fs_block_bitmap bitmap, + blk64_t block, + unsigned int num); +extern void ext2fs_fast_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap, + blk64_t block, + unsigned int num); +extern void ext2fs_fast_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap, + blk64_t block, + unsigned int num); +#endif + +/* These routines moved to gen_bitmap64.c */ +extern void ext2fs_clear_generic_bmap(ext2fs_generic_bitmap bitmap); +extern errcode_t ext2fs_compare_generic_bmap(errcode_t neq, + ext2fs_generic_bitmap bm1, + ext2fs_generic_bitmap bm2); +extern void ext2fs_set_generic_bmap_padding(ext2fs_generic_bitmap bmap); +extern int ext2fs_mark_generic_bmap(ext2fs_generic_bitmap bitmap, + blk64_t bitno); +extern int ext2fs_unmark_generic_bmap(ext2fs_generic_bitmap bitmap, + blk64_t bitno); +extern int ext2fs_test_generic_bmap(ext2fs_generic_bitmap bitmap, + blk64_t bitno); +extern int ext2fs_test_block_bitmap_range2(ext2fs_block_bitmap bitmap, + blk64_t block, unsigned int num); +extern __u64 ext2fs_get_generic_bmap_start(ext2fs_generic_bitmap bitmap); +extern __u64 ext2fs_get_generic_bmap_end(ext2fs_generic_bitmap bitmap); +extern int ext2fs_test_block_bitmap_range2(ext2fs_block_bitmap bitmap, + blk64_t block, unsigned int num); +extern void ext2fs_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap, + blk64_t block, unsigned int num); +extern void ext2fs_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap, + blk64_t block, unsigned int num); +extern errcode_t ext2fs_find_first_zero_generic_bmap(ext2fs_generic_bitmap bitmap, + __u64 start, __u64 end, + __u64 *out); +extern errcode_t ext2fs_find_first_set_generic_bmap(ext2fs_generic_bitmap bitmap, + __u64 start, __u64 end, + __u64 *out); + +/* + * The inline routines themselves... + * + * If NO_INLINE_FUNCS is defined, then we won't try to do inline + * functions at all; they will be included as normal functions in + * inline.c + */ +#ifdef NO_INLINE_FUNCS +#if (defined(__GNUC__) && (defined(__i386__) || defined(__i486__) || \ + defined(__i586__))) + /* This prevents bitops.c from trying to include the C */ + /* function version of these functions */ +#define _EXT2_HAVE_ASM_BITOPS_ +#endif +#endif /* NO_INLINE_FUNCS */ + +#if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS)) +#ifdef INCLUDE_INLINE_FUNCS +#if (__STDC_VERSION__ >= 199901L) +#define _INLINE_ extern inline +#else +#define _INLINE_ inline +#endif +#else /* !INCLUDE_INLINE FUNCS */ +#if (__STDC_VERSION__ >= 199901L) +#define _INLINE_ inline +#else /* not C99 */ +#ifdef __GNUC__ +#define _INLINE_ extern __inline__ +#else /* For Watcom C */ +#define _INLINE_ extern inline +#endif /* __GNUC__ */ +#endif /* __STDC_VERSION__ >= 199901L */ +#endif /* INCLUDE_INLINE_FUNCS */ + +/* + * Fast bit set/clear functions that doesn't need to return the + * previous bit value. + */ + +_INLINE_ void ext2fs_fast_set_bit(unsigned int nr,void * addr) +{ + unsigned char *ADDR = (unsigned char *) addr; + + ADDR += nr >> 3; + *ADDR |= (unsigned char) (1 << (nr & 0x07)); +} + +_INLINE_ void ext2fs_fast_clear_bit(unsigned int nr, void * addr) +{ + unsigned char *ADDR = (unsigned char *) addr; + + ADDR += nr >> 3; + *ADDR &= (unsigned char) ~(1 << (nr & 0x07)); +} + + +_INLINE_ void ext2fs_fast_set_bit64(__u64 nr, void * addr) +{ + unsigned char *ADDR = (unsigned char *) addr; + + ADDR += nr >> 3; + *ADDR |= (unsigned char) (1 << (nr & 0x07)); +} + +_INLINE_ void ext2fs_fast_clear_bit64(__u64 nr, void * addr) +{ + unsigned char *ADDR = (unsigned char *) addr; + + ADDR += nr >> 3; + *ADDR &= (unsigned char) ~(1 << (nr & 0x07)); +} + + +#if ((defined __GNUC__) && !defined(_EXT2_USE_C_VERSIONS_) && \ + (defined(__i386__) || defined(__i486__) || defined(__i586__))) + +#define _EXT2_HAVE_ASM_BITOPS_ +#define _EXT2_HAVE_ASM_SWAB_ + +/* + * These are done by inline assembly for speed reasons..... + * + * All bitoperations return 0 if the bit was cleared before the + * operation and != 0 if it was not. Bit 0 is the LSB of addr; bit 32 + * is the LSB of (addr+1). + */ + +/* + * Some hacks to defeat gcc over-optimizations.. + */ +struct __dummy_h { unsigned long a[100]; }; +#define EXT2FS_ADDR (*(struct __dummy_h *) addr) +#define EXT2FS_CONST_ADDR (*(const struct __dummy_h *) addr) + +_INLINE_ int ext2fs_set_bit(unsigned int nr, void * addr) +{ + int oldbit; + + addr = (void *) (((unsigned char *) addr) + (nr >> 3)); + __asm__ __volatile__("btsl %2,%1\n\tsbbl %0,%0" + :"=r" (oldbit),"+m" (EXT2FS_ADDR) + :"r" (nr & 7)); + return oldbit; +} + +_INLINE_ int ext2fs_clear_bit(unsigned int nr, void * addr) +{ + int oldbit; + + addr = (void *) (((unsigned char *) addr) + (nr >> 3)); + __asm__ __volatile__("btrl %2,%1\n\tsbbl %0,%0" + :"=r" (oldbit),"+m" (EXT2FS_ADDR) + :"r" (nr & 7)); + return oldbit; +} + +_INLINE_ int ext2fs_test_bit(unsigned int nr, const void * addr) +{ + int oldbit; + + addr = (const void *) (((const unsigned char *) addr) + (nr >> 3)); + __asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0" + :"=r" (oldbit) + :"m" (EXT2FS_CONST_ADDR),"r" (nr & 7)); + return oldbit; +} + +_INLINE_ __u32 ext2fs_swab32(__u32 val) +{ +#ifdef EXT2FS_REQUIRE_486 + __asm__("bswap %0" : "=r" (val) : "0" (val)); +#else + __asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */ + "rorl $16,%0\n\t" /* swap words */ + "xchgb %b0,%h0" /* swap higher bytes */ + :"=q" (val) + : "0" (val)); +#endif + return val; +} + +_INLINE_ __u16 ext2fs_swab16(__u16 val) +{ + __asm__("xchgb %b0,%h0" /* swap bytes */ \ + : "=q" (val) \ + : "0" (val)); \ + return val; +} + +#undef EXT2FS_ADDR + +#endif /* i386 */ + + +#if !defined(_EXT2_HAVE_ASM_SWAB_) + +_INLINE_ __u16 ext2fs_swab16(__u16 val) +{ + return (val >> 8) | (__u16) (val << 8); +} + +_INLINE_ __u32 ext2fs_swab32(__u32 val) +{ + return ((val>>24) | ((val>>8)&0xFF00) | + ((val<<8)&0xFF0000) | (val<<24)); +} + +#endif /* !_EXT2_HAVE_ASM_SWAB */ + +_INLINE_ __u64 ext2fs_swab64(__u64 val) +{ + return (ext2fs_swab32((__u32) (val >> 32)) | + (((__u64)ext2fs_swab32(val & 0xFFFFFFFFUL)) << 32)); +} + +_INLINE_ int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, + blk_t block) +{ + return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, + block); +} + +_INLINE_ int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap, + blk_t block) +{ + return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, + block); +} + +_INLINE_ int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, + blk_t block) +{ + return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, + block); +} + +_INLINE_ int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, + ext2_ino_t inode) +{ + return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, + inode); +} + +_INLINE_ int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, + ext2_ino_t inode) +{ + return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, + inode); +} + +_INLINE_ int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, + ext2_ino_t inode) +{ + return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, + inode); +} + +_INLINE_ void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap, + blk_t block) +{ + ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block); +} + +_INLINE_ void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap, + blk_t block) +{ + ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block); +} + +_INLINE_ int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap, + blk_t block) +{ + return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, + block); +} + +_INLINE_ void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, + ext2_ino_t inode) +{ + ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode); +} + +_INLINE_ void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, + ext2_ino_t inode) +{ + ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode); +} + +_INLINE_ int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap, + ext2_ino_t inode) +{ + return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, + inode); +} + +_INLINE_ blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap) +{ + return ext2fs_get_generic_bitmap_start((ext2fs_generic_bitmap) bitmap); +} + +_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap) +{ + return ext2fs_get_generic_bitmap_start((ext2fs_generic_bitmap) bitmap); +} + +_INLINE_ blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap) +{ + return ext2fs_get_generic_bitmap_end((ext2fs_generic_bitmap) bitmap); +} + +_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap) +{ + return ext2fs_get_generic_bitmap_end((ext2fs_generic_bitmap) bitmap); +} + +_INLINE_ int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap, + blk_t block, int num) +{ + return ext2fs_test_block_bitmap_range(bitmap, block, num); +} + +_INLINE_ void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, + blk_t block, int num) +{ + ext2fs_mark_block_bitmap_range(bitmap, block, num); +} + +_INLINE_ void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, + blk_t block, int num) +{ + ext2fs_unmark_block_bitmap_range(bitmap, block, num); +} + +/* 64-bit versions */ + +_INLINE_ int ext2fs_mark_block_bitmap2(ext2fs_block_bitmap bitmap, + blk64_t block) +{ + return ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap, + block); +} + +_INLINE_ int ext2fs_unmark_block_bitmap2(ext2fs_block_bitmap bitmap, + blk64_t block) +{ + return ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, block); +} + +_INLINE_ int ext2fs_test_block_bitmap2(ext2fs_block_bitmap bitmap, + blk64_t block) +{ + return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap, + block); +} + +_INLINE_ int ext2fs_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap, + ext2_ino_t inode) +{ + return ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap, + inode); +} + +_INLINE_ int ext2fs_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap, + ext2_ino_t inode) +{ + return ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, + inode); +} + +_INLINE_ int ext2fs_test_inode_bitmap2(ext2fs_inode_bitmap bitmap, + ext2_ino_t inode) +{ + return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap, + inode); +} + +_INLINE_ void ext2fs_fast_mark_block_bitmap2(ext2fs_block_bitmap bitmap, + blk64_t block) +{ + ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap, block); +} + +_INLINE_ void ext2fs_fast_unmark_block_bitmap2(ext2fs_block_bitmap bitmap, + blk64_t block) +{ + ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, block); +} + +_INLINE_ int ext2fs_fast_test_block_bitmap2(ext2fs_block_bitmap bitmap, + blk64_t block) +{ + return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap, + block); +} + +_INLINE_ void ext2fs_fast_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap, + ext2_ino_t inode) +{ + ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap, inode); +} + +_INLINE_ void ext2fs_fast_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap, + ext2_ino_t inode) +{ + ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, inode); +} + +_INLINE_ int ext2fs_fast_test_inode_bitmap2(ext2fs_inode_bitmap bitmap, + ext2_ino_t inode) +{ + return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap, + inode); +} + +_INLINE_ errcode_t ext2fs_find_first_zero_block_bitmap2(ext2fs_block_bitmap bitmap, + blk64_t start, + blk64_t end, + blk64_t *out) +{ + __u64 o; + errcode_t rv; + + rv = ext2fs_find_first_zero_generic_bmap((ext2fs_generic_bitmap) bitmap, + start, end, &o); + if (!rv) + *out = o; + return rv; +} + +_INLINE_ errcode_t ext2fs_find_first_zero_inode_bitmap2(ext2fs_inode_bitmap bitmap, + ext2_ino_t start, + ext2_ino_t end, + ext2_ino_t *out) +{ + __u64 o; + errcode_t rv; + + rv = ext2fs_find_first_zero_generic_bmap((ext2fs_generic_bitmap) bitmap, + start, end, &o); + if (!rv) + *out = (ext2_ino_t) o; + return rv; +} + +_INLINE_ errcode_t ext2fs_find_first_set_block_bitmap2(ext2fs_block_bitmap bitmap, + blk64_t start, + blk64_t end, + blk64_t *out) +{ + __u64 o; + errcode_t rv; + + rv = ext2fs_find_first_set_generic_bmap((ext2fs_generic_bitmap) bitmap, + start, end, &o); + if (!rv) + *out = o; + return rv; +} + +_INLINE_ errcode_t ext2fs_find_first_set_inode_bitmap2(ext2fs_inode_bitmap bitmap, + ext2_ino_t start, + ext2_ino_t end, + ext2_ino_t *out) +{ + __u64 o; + errcode_t rv; + + rv = ext2fs_find_first_set_generic_bmap((ext2fs_generic_bitmap) bitmap, + start, end, &o); + if (!rv) + *out = (ext2_ino_t) o; + return rv; +} + +_INLINE_ blk64_t ext2fs_get_block_bitmap_start2(ext2fs_block_bitmap bitmap) +{ + return ext2fs_get_generic_bmap_start((ext2fs_generic_bitmap) bitmap); +} + +_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_start2(ext2fs_inode_bitmap bitmap) +{ + return (ext2_ino_t) ext2fs_get_generic_bmap_start((ext2fs_generic_bitmap) bitmap); +} + +_INLINE_ blk64_t ext2fs_get_block_bitmap_end2(ext2fs_block_bitmap bitmap) +{ + return ext2fs_get_generic_bmap_end((ext2fs_generic_bitmap) bitmap); +} + +_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_end2(ext2fs_inode_bitmap bitmap) +{ + return (ext2_ino_t) ext2fs_get_generic_bmap_end((ext2fs_generic_bitmap) bitmap); +} + +_INLINE_ int ext2fs_fast_test_block_bitmap_range2(ext2fs_block_bitmap bitmap, + blk64_t block, + unsigned int num) +{ + return ext2fs_test_block_bitmap_range2(bitmap, block, num); +} + +_INLINE_ void ext2fs_fast_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap, + blk64_t block, + unsigned int num) +{ + ext2fs_mark_block_bitmap_range2(bitmap, block, num); +} + +_INLINE_ void ext2fs_fast_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap, + blk64_t block, + unsigned int num) +{ + ext2fs_unmark_block_bitmap_range2(bitmap, block, num); +} + +#undef _INLINE_ +#endif + +#ifndef _EXT2_HAVE_ASM_BITOPS_ +extern int ext2fs_set_bit(unsigned int nr,void * addr); +extern int ext2fs_clear_bit(unsigned int nr, void * addr); +extern int ext2fs_test_bit(unsigned int nr, const void * addr); +#endif + +extern int ext2fs_set_bit64(__u64 nr,void * addr); +extern int ext2fs_clear_bit64(__u64 nr, void * addr); +extern int ext2fs_test_bit64(__u64 nr, const void * addr); +extern unsigned int ext2fs_bitcount(const void *addr, unsigned int nbytes); diff --git a/dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2_err.h b/dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2_err.h new file mode 100644 index 0000000..0c79e4e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2_err.h @@ -0,0 +1,196 @@ +/* + * ext2_err.h: + * This file is automatically generated; please do not edit it. + */ + +#include + +#define EXT2_ET_BASE (2133571328L) +#define EXT2_ET_MAGIC_EXT2FS_FILSYS (2133571329L) +#define EXT2_ET_MAGIC_BADBLOCKS_LIST (2133571330L) +#define EXT2_ET_MAGIC_BADBLOCKS_ITERATE (2133571331L) +#define EXT2_ET_MAGIC_INODE_SCAN (2133571332L) +#define EXT2_ET_MAGIC_IO_CHANNEL (2133571333L) +#define EXT2_ET_MAGIC_UNIX_IO_CHANNEL (2133571334L) +#define EXT2_ET_MAGIC_IO_MANAGER (2133571335L) +#define EXT2_ET_MAGIC_BLOCK_BITMAP (2133571336L) +#define EXT2_ET_MAGIC_INODE_BITMAP (2133571337L) +#define EXT2_ET_MAGIC_GENERIC_BITMAP (2133571338L) +#define EXT2_ET_MAGIC_TEST_IO_CHANNEL (2133571339L) +#define EXT2_ET_MAGIC_DBLIST (2133571340L) +#define EXT2_ET_MAGIC_ICOUNT (2133571341L) +#define EXT2_ET_MAGIC_PQ_IO_CHANNEL (2133571342L) +#define EXT2_ET_MAGIC_EXT2_FILE (2133571343L) +#define EXT2_ET_MAGIC_E2IMAGE (2133571344L) +#define EXT2_ET_MAGIC_INODE_IO_CHANNEL (2133571345L) +#define EXT2_ET_MAGIC_EXTENT_HANDLE (2133571346L) +#define EXT2_ET_BAD_MAGIC (2133571347L) +#define EXT2_ET_REV_TOO_HIGH (2133571348L) +#define EXT2_ET_RO_FILSYS (2133571349L) +#define EXT2_ET_GDESC_READ (2133571350L) +#define EXT2_ET_GDESC_WRITE (2133571351L) +#define EXT2_ET_GDESC_BAD_BLOCK_MAP (2133571352L) +#define EXT2_ET_GDESC_BAD_INODE_MAP (2133571353L) +#define EXT2_ET_GDESC_BAD_INODE_TABLE (2133571354L) +#define EXT2_ET_INODE_BITMAP_WRITE (2133571355L) +#define EXT2_ET_INODE_BITMAP_READ (2133571356L) +#define EXT2_ET_BLOCK_BITMAP_WRITE (2133571357L) +#define EXT2_ET_BLOCK_BITMAP_READ (2133571358L) +#define EXT2_ET_INODE_TABLE_WRITE (2133571359L) +#define EXT2_ET_INODE_TABLE_READ (2133571360L) +#define EXT2_ET_NEXT_INODE_READ (2133571361L) +#define EXT2_ET_UNEXPECTED_BLOCK_SIZE (2133571362L) +#define EXT2_ET_DIR_CORRUPTED (2133571363L) +#define EXT2_ET_SHORT_READ (2133571364L) +#define EXT2_ET_SHORT_WRITE (2133571365L) +#define EXT2_ET_DIR_NO_SPACE (2133571366L) +#define EXT2_ET_NO_INODE_BITMAP (2133571367L) +#define EXT2_ET_NO_BLOCK_BITMAP (2133571368L) +#define EXT2_ET_BAD_INODE_NUM (2133571369L) +#define EXT2_ET_BAD_BLOCK_NUM (2133571370L) +#define EXT2_ET_EXPAND_DIR_ERR (2133571371L) +#define EXT2_ET_TOOSMALL (2133571372L) +#define EXT2_ET_BAD_BLOCK_MARK (2133571373L) +#define EXT2_ET_BAD_BLOCK_UNMARK (2133571374L) +#define EXT2_ET_BAD_BLOCK_TEST (2133571375L) +#define EXT2_ET_BAD_INODE_MARK (2133571376L) +#define EXT2_ET_BAD_INODE_UNMARK (2133571377L) +#define EXT2_ET_BAD_INODE_TEST (2133571378L) +#define EXT2_ET_FUDGE_BLOCK_BITMAP_END (2133571379L) +#define EXT2_ET_FUDGE_INODE_BITMAP_END (2133571380L) +#define EXT2_ET_BAD_IND_BLOCK (2133571381L) +#define EXT2_ET_BAD_DIND_BLOCK (2133571382L) +#define EXT2_ET_BAD_TIND_BLOCK (2133571383L) +#define EXT2_ET_NEQ_BLOCK_BITMAP (2133571384L) +#define EXT2_ET_NEQ_INODE_BITMAP (2133571385L) +#define EXT2_ET_BAD_DEVICE_NAME (2133571386L) +#define EXT2_ET_MISSING_INODE_TABLE (2133571387L) +#define EXT2_ET_CORRUPT_SUPERBLOCK (2133571388L) +#define EXT2_ET_BAD_GENERIC_MARK (2133571389L) +#define EXT2_ET_BAD_GENERIC_UNMARK (2133571390L) +#define EXT2_ET_BAD_GENERIC_TEST (2133571391L) +#define EXT2_ET_SYMLINK_LOOP (2133571392L) +#define EXT2_ET_CALLBACK_NOTHANDLED (2133571393L) +#define EXT2_ET_BAD_BLOCK_IN_INODE_TABLE (2133571394L) +#define EXT2_ET_UNSUPP_FEATURE (2133571395L) +#define EXT2_ET_RO_UNSUPP_FEATURE (2133571396L) +#define EXT2_ET_LLSEEK_FAILED (2133571397L) +#define EXT2_ET_NO_MEMORY (2133571398L) +#define EXT2_ET_INVALID_ARGUMENT (2133571399L) +#define EXT2_ET_BLOCK_ALLOC_FAIL (2133571400L) +#define EXT2_ET_INODE_ALLOC_FAIL (2133571401L) +#define EXT2_ET_NO_DIRECTORY (2133571402L) +#define EXT2_ET_TOO_MANY_REFS (2133571403L) +#define EXT2_ET_FILE_NOT_FOUND (2133571404L) +#define EXT2_ET_FILE_RO (2133571405L) +#define EXT2_ET_DB_NOT_FOUND (2133571406L) +#define EXT2_ET_DIR_EXISTS (2133571407L) +#define EXT2_ET_UNIMPLEMENTED (2133571408L) +#define EXT2_ET_CANCEL_REQUESTED (2133571409L) +#define EXT2_ET_FILE_TOO_BIG (2133571410L) +#define EXT2_ET_JOURNAL_NOT_BLOCK (2133571411L) +#define EXT2_ET_NO_JOURNAL_SB (2133571412L) +#define EXT2_ET_JOURNAL_TOO_SMALL (2133571413L) +#define EXT2_ET_JOURNAL_UNSUPP_VERSION (2133571414L) +#define EXT2_ET_LOAD_EXT_JOURNAL (2133571415L) +#define EXT2_ET_NO_JOURNAL (2133571416L) +#define EXT2_ET_DIRHASH_UNSUPP (2133571417L) +#define EXT2_ET_BAD_EA_BLOCK_NUM (2133571418L) +#define EXT2_ET_TOO_MANY_INODES (2133571419L) +#define EXT2_ET_NOT_IMAGE_FILE (2133571420L) +#define EXT2_ET_RES_GDT_BLOCKS (2133571421L) +#define EXT2_ET_RESIZE_INODE_CORRUPT (2133571422L) +#define EXT2_ET_SET_BMAP_NO_IND (2133571423L) +#define EXT2_ET_TDB_SUCCESS (2133571424L) +#define EXT2_ET_TDB_ERR_CORRUPT (2133571425L) +#define EXT2_ET_TDB_ERR_IO (2133571426L) +#define EXT2_ET_TDB_ERR_LOCK (2133571427L) +#define EXT2_ET_TDB_ERR_OOM (2133571428L) +#define EXT2_ET_TDB_ERR_EXISTS (2133571429L) +#define EXT2_ET_TDB_ERR_NOLOCK (2133571430L) +#define EXT2_ET_TDB_ERR_EINVAL (2133571431L) +#define EXT2_ET_TDB_ERR_NOEXIST (2133571432L) +#define EXT2_ET_TDB_ERR_RDONLY (2133571433L) +#define EXT2_ET_DBLIST_EMPTY (2133571434L) +#define EXT2_ET_RO_BLOCK_ITERATE (2133571435L) +#define EXT2_ET_MAGIC_EXTENT_PATH (2133571436L) +#define EXT2_ET_MAGIC_GENERIC_BITMAP64 (2133571437L) +#define EXT2_ET_MAGIC_BLOCK_BITMAP64 (2133571438L) +#define EXT2_ET_MAGIC_INODE_BITMAP64 (2133571439L) +#define EXT2_ET_MAGIC_RESERVED_13 (2133571440L) +#define EXT2_ET_MAGIC_RESERVED_14 (2133571441L) +#define EXT2_ET_MAGIC_RESERVED_15 (2133571442L) +#define EXT2_ET_MAGIC_RESERVED_16 (2133571443L) +#define EXT2_ET_MAGIC_RESERVED_17 (2133571444L) +#define EXT2_ET_MAGIC_RESERVED_18 (2133571445L) +#define EXT2_ET_MAGIC_RESERVED_19 (2133571446L) +#define EXT2_ET_EXTENT_HEADER_BAD (2133571447L) +#define EXT2_ET_EXTENT_INDEX_BAD (2133571448L) +#define EXT2_ET_EXTENT_LEAF_BAD (2133571449L) +#define EXT2_ET_EXTENT_NO_SPACE (2133571450L) +#define EXT2_ET_INODE_NOT_EXTENT (2133571451L) +#define EXT2_ET_EXTENT_NO_NEXT (2133571452L) +#define EXT2_ET_EXTENT_NO_PREV (2133571453L) +#define EXT2_ET_EXTENT_NO_UP (2133571454L) +#define EXT2_ET_EXTENT_NO_DOWN (2133571455L) +#define EXT2_ET_NO_CURRENT_NODE (2133571456L) +#define EXT2_ET_OP_NOT_SUPPORTED (2133571457L) +#define EXT2_ET_CANT_INSERT_EXTENT (2133571458L) +#define EXT2_ET_CANT_SPLIT_EXTENT (2133571459L) +#define EXT2_ET_EXTENT_NOT_FOUND (2133571460L) +#define EXT2_ET_EXTENT_NOT_SUPPORTED (2133571461L) +#define EXT2_ET_EXTENT_INVALID_LENGTH (2133571462L) +#define EXT2_ET_IO_CHANNEL_NO_SUPPORT_64 (2133571463L) +#define EXT2_ET_NO_MTAB_FILE (2133571464L) +#define EXT2_ET_CANT_USE_LEGACY_BITMAPS (2133571465L) +#define EXT2_ET_MMP_MAGIC_INVALID (2133571466L) +#define EXT2_ET_MMP_FAILED (2133571467L) +#define EXT2_ET_MMP_FSCK_ON (2133571468L) +#define EXT2_ET_MMP_BAD_BLOCK (2133571469L) +#define EXT2_ET_MMP_UNKNOWN_SEQ (2133571470L) +#define EXT2_ET_MMP_CHANGE_ABORT (2133571471L) +#define EXT2_ET_MMP_OPEN_DIRECT (2133571472L) +#define EXT2_ET_BAD_DESC_SIZE (2133571473L) +#define EXT2_ET_INODE_CSUM_INVALID (2133571474L) +#define EXT2_ET_INODE_BITMAP_CSUM_INVALID (2133571475L) +#define EXT2_ET_EXTENT_CSUM_INVALID (2133571476L) +#define EXT2_ET_DIR_NO_SPACE_FOR_CSUM (2133571477L) +#define EXT2_ET_DIR_CSUM_INVALID (2133571478L) +#define EXT2_ET_EXT_ATTR_CSUM_INVALID (2133571479L) +#define EXT2_ET_SB_CSUM_INVALID (2133571480L) +#define EXT2_ET_UNKNOWN_CSUM (2133571481L) +#define EXT2_ET_MMP_CSUM_INVALID (2133571482L) +#define EXT2_ET_FILE_EXISTS (2133571483L) +#define EXT2_ET_BLOCK_BITMAP_CSUM_INVALID (2133571484L) +#define EXT2_ET_INLINE_DATA_CANT_ITERATE (2133571485L) +#define EXT2_ET_EA_BAD_NAME_LEN (2133571486L) +#define EXT2_ET_EA_BAD_VALUE_SIZE (2133571487L) +#define EXT2_ET_BAD_EA_HASH (2133571488L) +#define EXT2_ET_BAD_EA_HEADER (2133571489L) +#define EXT2_ET_EA_KEY_NOT_FOUND (2133571490L) +#define EXT2_ET_EA_NO_SPACE (2133571491L) +#define EXT2_ET_MISSING_EA_FEATURE (2133571492L) +#define EXT2_ET_NO_INLINE_DATA (2133571493L) +#define EXT2_ET_INLINE_DATA_NO_BLOCK (2133571494L) +#define EXT2_ET_INLINE_DATA_NO_SPACE (2133571495L) +#define EXT2_ET_MAGIC_EA_HANDLE (2133571496L) +#define EXT2_ET_INODE_IS_GARBAGE (2133571497L) +#define EXT2_ET_EA_BAD_VALUE_OFFSET (2133571498L) +#define EXT2_ET_JOURNAL_FLAGS_WRONG (2133571499L) +#define EXT2_ET_UNDO_FILE_CORRUPT (2133571500L) +#define EXT2_ET_UNDO_FILE_WRONG (2133571501L) +#define EXT2_ET_FILESYSTEM_CORRUPTED (2133571502L) +#define EXT2_ET_BAD_CRC (2133571503L) +#define EXT2_ET_CORRUPT_JOURNAL_SB (2133571504L) +#define EXT2_ET_INODE_CORRUPTED (2133571505L) +extern const struct error_table et_ext2_error_table; +extern void initialize_ext2_error_table(void); + +/* For compatibility with Heimdal */ +extern void initialize_ext2_error_table_r(struct et_list **list); + +#define ERROR_TABLE_BASE_ext2 (2133571328L) + +/* for compatibility with older versions... */ +#define init_ext2_err_tbl initialize_ext2_error_table +#define ext2_err_base ERROR_TABLE_BASE_ext2 diff --git a/dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2_ext_attr.h b/dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2_ext_attr.h new file mode 100644 index 0000000..bbb0aaa --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2_ext_attr.h @@ -0,0 +1,73 @@ +/* + File: linux/ext2_ext_attr.h + + On-disk format of extended attributes for the ext2 filesystem. + + (C) 2000 Andreas Gruenbacher, +*/ + +#ifndef _EXT2_EXT_ATTR_H +#define _EXT2_EXT_ATTR_H +/* Magic value in attribute blocks */ +#define EXT2_EXT_ATTR_MAGIC_v1 0xEA010000 +#define EXT2_EXT_ATTR_MAGIC 0xEA020000 + +/* Maximum number of references to one attribute block */ +#define EXT2_EXT_ATTR_REFCOUNT_MAX 1024 + +struct ext2_ext_attr_header { + __u32 h_magic; /* magic number for identification */ + __u32 h_refcount; /* reference count */ + __u32 h_blocks; /* number of disk blocks used */ + __u32 h_hash; /* hash value of all attributes */ + __u32 h_checksum; /* crc32c(uuid+id+xattrs) */ + /* id = inum if refcount = 1, else blknum */ + __u32 h_reserved[3]; /* zero right now */ +}; + +struct ext2_ext_attr_entry { + __u8 e_name_len; /* length of name */ + __u8 e_name_index; /* attribute name index */ + __u16 e_value_offs; /* offset in disk block of value */ + __u32 e_value_block; /* disk block attribute is stored on (n/i) */ + __u32 e_value_size; /* size of attribute value */ + __u32 e_hash; /* hash value of name and value */ +#if 0 + char e_name[0]; /* attribute name */ +#endif +}; + +#define EXT2_EXT_ATTR_PAD_BITS 2 +#define EXT2_EXT_ATTR_PAD ((unsigned) 1<e_name_len)) ) +#define EXT2_EXT_ATTR_SIZE(size) \ + (((size) + EXT2_EXT_ATTR_ROUND) & ~EXT2_EXT_ATTR_ROUND) +#define EXT2_EXT_IS_LAST_ENTRY(entry) (*((__u32 *)(entry)) == 0UL) +#define EXT2_EXT_ATTR_NAME(entry) \ + (((char *) (entry)) + sizeof(struct ext2_ext_attr_entry)) +#define EXT2_XATTR_LEN(name_len) \ + (((name_len) + EXT2_EXT_ATTR_ROUND + \ + sizeof(struct ext2_xattr_entry)) & ~EXT2_EXT_ATTR_ROUND) +#define EXT2_XATTR_SIZE(size) \ + (((size) + EXT2_EXT_ATTR_ROUND) & ~EXT2_EXT_ATTR_ROUND) + +#ifdef __KERNEL__ +# ifdef CONFIG_EXT2_FS_EXT_ATTR +extern int ext2_get_ext_attr(struct inode *, const char *, char *, size_t, int); +extern int ext2_set_ext_attr(struct inode *, const char *, char *, size_t, int); +extern void ext2_ext_attr_free_inode(struct inode *inode); +extern void ext2_ext_attr_put_super(struct super_block *sb); +extern int ext2_ext_attr_init(void); +extern void ext2_ext_attr_done(void); +# else +# define ext2_get_ext_attr NULL +# define ext2_set_ext_attr NULL +# endif +#endif /* __KERNEL__ */ +#endif /* _EXT2_EXT_ATTR_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2_fs.h b/dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2_fs.h new file mode 100644 index 0000000..637fab2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2_fs.h @@ -0,0 +1,1104 @@ +/* + * linux/include/linux/ext2_fs.h + * + * Copyright (C) 1992, 1993, 1994, 1995 + * Remy Card (card@masi.ibp.fr) + * Laboratoire MASI - Institut Blaise Pascal + * Universite Pierre et Marie Curie (Paris VI) + * + * from + * + * linux/include/linux/minix_fs.h + * + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#ifndef _LINUX_EXT2_FS_H +#define _LINUX_EXT2_FS_H + +#include /* Changed from linux/types.h */ + +/* + * The second extended filesystem constants/structures + */ + +/* + * Define EXT2FS_DEBUG to produce debug messages + */ +#undef EXT2FS_DEBUG + +/* + * Define EXT2_PREALLOCATE to preallocate data blocks for expanding files + */ +#define EXT2_PREALLOCATE +#define EXT2_DEFAULT_PREALLOC_BLOCKS 8 + +/* + * The second extended file system version + */ +#define EXT2FS_DATE "95/08/09" +#define EXT2FS_VERSION "0.5b" + +/* + * Special inode numbers + */ +#define EXT2_BAD_INO 1 /* Bad blocks inode */ +#define EXT2_ROOT_INO 2 /* Root inode */ +#define EXT4_USR_QUOTA_INO 3 /* User quota inode */ +#define EXT4_GRP_QUOTA_INO 4 /* Group quota inode */ +#define EXT2_BOOT_LOADER_INO 5 /* Boot loader inode */ +#define EXT2_UNDEL_DIR_INO 6 /* Undelete directory inode */ +#define EXT2_RESIZE_INO 7 /* Reserved group descriptors inode */ +#define EXT2_JOURNAL_INO 8 /* Journal inode */ +#define EXT2_EXCLUDE_INO 9 /* The "exclude" inode, for snapshots */ +#define EXT4_REPLICA_INO 10 /* Used by non-upstream feature */ + +/* First non-reserved inode for old ext2 filesystems */ +#define EXT2_GOOD_OLD_FIRST_INO 11 + +/* + * The second extended file system magic number + */ +#define EXT2_SUPER_MAGIC 0xEF53 + +#ifdef __KERNEL__ +#define EXT2_SB(sb) (&((sb)->u.ext2_sb)) +#else +/* Assume that user mode programs are passing in an ext2fs superblock, not + * a kernel struct super_block. This will allow us to call the feature-test + * macros from user land. */ +#define EXT2_SB(sb) (sb) +#endif + +/* + * Maximal count of links to a file + */ +#define EXT2_LINK_MAX 65000 + +/* + * Macro-instructions used to manage several block sizes + */ +#define EXT2_MIN_BLOCK_LOG_SIZE 10 /* 1024 */ +#define EXT2_MAX_BLOCK_LOG_SIZE 16 /* 65536 */ +#define EXT2_MIN_BLOCK_SIZE (1 << EXT2_MIN_BLOCK_LOG_SIZE) +#define EXT2_MAX_BLOCK_SIZE (1 << EXT2_MAX_BLOCK_LOG_SIZE) +#ifdef __KERNEL__ +#define EXT2_BLOCK_SIZE(s) ((s)->s_blocksize) +#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits) +#define EXT2_ADDR_PER_BLOCK_BITS(s) (EXT2_SB(s)->addr_per_block_bits) +#define EXT2_INODE_SIZE(s) (EXT2_SB(s)->s_inode_size) +#define EXT2_FIRST_INO(s) (EXT2_SB(s)->s_first_ino) +#else +#define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size) +#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) +#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ + EXT2_GOOD_OLD_INODE_SIZE : (s)->s_inode_size) +#define EXT2_FIRST_INO(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ + EXT2_GOOD_OLD_FIRST_INO : (s)->s_first_ino) +#endif +#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof(__u32)) + +/* + * Macro-instructions used to manage allocation clusters + */ +#define EXT2_MIN_CLUSTER_LOG_SIZE EXT2_MIN_BLOCK_LOG_SIZE +#define EXT2_MAX_CLUSTER_LOG_SIZE 29 /* 512MB */ +#define EXT2_MIN_CLUSTER_SIZE EXT2_MIN_BLOCK_SIZE +#define EXT2_MAX_CLUSTER_SIZE (1 << EXT2_MAX_CLUSTER_LOG_SIZE) +#define EXT2_CLUSTER_SIZE(s) (EXT2_MIN_BLOCK_SIZE << \ + (s)->s_log_cluster_size) +#define EXT2_CLUSTER_SIZE_BITS(s) ((s)->s_log_cluster_size + 10) + +/* + * Macro-instructions used to manage fragments + * + * Note: for backwards compatibility only, for the dump program. + * Ext2/3/4 will never support fragments.... + */ +#define EXT2_MIN_FRAG_SIZE EXT2_MIN_BLOCK_SIZE +#define EXT2_MAX_FRAG_SIZE EXT2_MAX_BLOCK_SIZE +#define EXT2_MIN_FRAG_LOG_SIZE EXT2_MIN_BLOCK_LOG_SIZE +#define EXT2_FRAG_SIZE(s) EXT2_BLOCK_SIZE(s) +#define EXT2_FRAGS_PER_BLOCK(s) 1 + +/* + * ACL structures + */ +struct ext2_acl_header /* Header of Access Control Lists */ +{ + __u32 aclh_size; + __u32 aclh_file_count; + __u32 aclh_acle_count; + __u32 aclh_first_acle; +}; + +struct ext2_acl_entry /* Access Control List Entry */ +{ + __u32 acle_size; + __u16 acle_perms; /* Access permissions */ + __u16 acle_type; /* Type of entry */ + __u16 acle_tag; /* User or group identity */ + __u16 acle_pad1; + __u32 acle_next; /* Pointer on next entry for the */ + /* same inode or on next free entry */ +}; + +/* + * Structure of a blocks group descriptor + */ +struct ext2_group_desc +{ + __u32 bg_block_bitmap; /* Blocks bitmap block */ + __u32 bg_inode_bitmap; /* Inodes bitmap block */ + __u32 bg_inode_table; /* Inodes table block */ + __u16 bg_free_blocks_count; /* Free blocks count */ + __u16 bg_free_inodes_count; /* Free inodes count */ + __u16 bg_used_dirs_count; /* Directories count */ + __u16 bg_flags; + __u32 bg_exclude_bitmap_lo; /* Exclude bitmap for snapshots */ + __u16 bg_block_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */ + __u16 bg_inode_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */ + __u16 bg_itable_unused; /* Unused inodes count */ + __u16 bg_checksum; /* crc16(s_uuid+group_num+group_desc)*/ +}; + +/* + * Structure of a blocks group descriptor + */ +struct ext4_group_desc +{ + __u32 bg_block_bitmap; /* Blocks bitmap block */ + __u32 bg_inode_bitmap; /* Inodes bitmap block */ + __u32 bg_inode_table; /* Inodes table block */ + __u16 bg_free_blocks_count; /* Free blocks count */ + __u16 bg_free_inodes_count; /* Free inodes count */ + __u16 bg_used_dirs_count; /* Directories count */ + __u16 bg_flags; /* EXT4_BG_flags (INODE_UNINIT, etc) */ + __u32 bg_exclude_bitmap_lo; /* Exclude bitmap for snapshots */ + __u16 bg_block_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */ + __u16 bg_inode_bitmap_csum_lo;/* crc32c(s_uuid+grp_num+bitmap) LSB */ + __u16 bg_itable_unused; /* Unused inodes count */ + __u16 bg_checksum; /* crc16(sb_uuid+group+desc) */ + __u32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */ + __u32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */ + __u32 bg_inode_table_hi; /* Inodes table block MSB */ + __u16 bg_free_blocks_count_hi;/* Free blocks count MSB */ + __u16 bg_free_inodes_count_hi;/* Free inodes count MSB */ + __u16 bg_used_dirs_count_hi; /* Directories count MSB */ + __u16 bg_itable_unused_hi; /* Unused inodes count MSB */ + __u32 bg_exclude_bitmap_hi; /* Exclude bitmap block MSB */ + __u16 bg_block_bitmap_csum_hi;/* crc32c(s_uuid+grp_num+bitmap) MSB */ + __u16 bg_inode_bitmap_csum_hi;/* crc32c(s_uuid+grp_num+bitmap) MSB */ + __u32 bg_reserved; +}; + +#define EXT4_BG_INODE_BITMAP_CSUM_HI_END \ + (offsetof(struct ext4_group_desc, bg_inode_bitmap_csum_hi) + \ + sizeof(__u16)) +#define EXT4_BG_BLOCK_BITMAP_CSUM_HI_LOCATION \ + (offsetof(struct ext4_group_desc, bg_block_bitmap_csum_hi) + \ + sizeof(__u16)) + +#define EXT2_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not initialized */ +#define EXT2_BG_BLOCK_UNINIT 0x0002 /* Block bitmap not initialized */ +#define EXT2_BG_INODE_ZEROED 0x0004 /* On-disk itable initialized to zero */ + +/* + * Data structures used by the directory indexing feature + * + * Note: all of the multibyte integer fields are little endian. + */ + +/* + * Note: dx_root_info is laid out so that if it should somehow get + * overlaid by a dirent the two low bits of the hash version will be + * zero. Therefore, the hash version mod 4 should never be 0. + * Sincerely, the paranoia department. + */ +struct ext2_dx_root_info { + __u32 reserved_zero; + __u8 hash_version; /* 0 now, 1 at release */ + __u8 info_length; /* 8 */ + __u8 indirect_levels; + __u8 unused_flags; +}; + +#define EXT2_HASH_LEGACY 0 +#define EXT2_HASH_HALF_MD4 1 +#define EXT2_HASH_TEA 2 +#define EXT2_HASH_LEGACY_UNSIGNED 3 /* reserved for userspace lib */ +#define EXT2_HASH_HALF_MD4_UNSIGNED 4 /* reserved for userspace lib */ +#define EXT2_HASH_TEA_UNSIGNED 5 /* reserved for userspace lib */ + +#define EXT2_HASH_FLAG_INCOMPAT 0x1 + +struct ext2_dx_entry { + __le32 hash; + __le32 block; +}; + +struct ext2_dx_countlimit { + __le16 limit; + __le16 count; +}; + +/* + * This goes at the end of each htree block. + */ +struct ext2_dx_tail { + __le32 dt_reserved; + __le32 dt_checksum; /* crc32c(uuid+inum+dxblock) */ +}; + +/* + * Macro-instructions used to manage group descriptors + */ +#define EXT2_MIN_DESC_SIZE 32 +#define EXT2_MIN_DESC_SIZE_64BIT 64 +#define EXT2_MAX_DESC_SIZE EXT2_MIN_BLOCK_SIZE +#define EXT2_DESC_SIZE(s) \ + ((EXT2_SB(s)->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) ? \ + (s)->s_desc_size : EXT2_MIN_DESC_SIZE) + +#define EXT2_BLOCKS_PER_GROUP(s) (EXT2_SB(s)->s_blocks_per_group) +#define EXT2_INODES_PER_GROUP(s) (EXT2_SB(s)->s_inodes_per_group) +#define EXT2_CLUSTERS_PER_GROUP(s) (EXT2_SB(s)->s_clusters_per_group) +#define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s)) +/* limits imposed by 16-bit value gd_free_{blocks,inode}_count */ +#define EXT2_MAX_BLOCKS_PER_GROUP(s) ((((unsigned) 1 << 16) - 8) * \ + (EXT2_CLUSTER_SIZE(s) / \ + EXT2_BLOCK_SIZE(s))) +#define EXT2_MAX_CLUSTERS_PER_GROUP(s) (((unsigned) 1 << 16) - 8) +#define EXT2_MAX_INODES_PER_GROUP(s) (((unsigned) 1 << 16) - \ + EXT2_INODES_PER_BLOCK(s)) +#ifdef __KERNEL__ +#define EXT2_DESC_PER_BLOCK(s) (EXT2_SB(s)->s_desc_per_block) +#define EXT2_DESC_PER_BLOCK_BITS(s) (EXT2_SB(s)->s_desc_per_block_bits) +#else +#define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_DESC_SIZE(s)) +#endif + +#define EXT2_GROUPS_TO_BLOCKS(s, g) ((blk64_t) EXT2_BLOCKS_PER_GROUP(s) * \ + (g)) +#define EXT2_GROUPS_TO_CLUSTERS(s, g) ((blk64_t) EXT2_CLUSTERS_PER_GROUP(s) * \ + (g)) + +/* + * Constants relative to the data blocks + */ +#define EXT2_NDIR_BLOCKS 12 +#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS +#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1) +#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1) +#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1) + +/* + * Inode flags + */ +#define EXT2_SECRM_FL 0x00000001 /* Secure deletion */ +#define EXT2_UNRM_FL 0x00000002 /* Undelete */ +#define EXT2_COMPR_FL 0x00000004 /* Compress file */ +#define EXT2_SYNC_FL 0x00000008 /* Synchronous updates */ +#define EXT2_IMMUTABLE_FL 0x00000010 /* Immutable file */ +#define EXT2_APPEND_FL 0x00000020 /* writes to file may only append */ +#define EXT2_NODUMP_FL 0x00000040 /* do not dump file */ +#define EXT2_NOATIME_FL 0x00000080 /* do not update atime */ +/* Reserved for compression usage... */ +#define EXT2_DIRTY_FL 0x00000100 +#define EXT2_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */ +#define EXT2_NOCOMPR_FL 0x00000400 /* Access raw compressed data */ + /* nb: was previously EXT2_ECOMPR_FL */ +#define EXT4_ENCRYPT_FL 0x00000800 /* encrypted inode */ +/* End compression flags --- maybe not all used */ +#define EXT2_BTREE_FL 0x00001000 /* btree format dir */ +#define EXT2_INDEX_FL 0x00001000 /* hash-indexed directory */ +#define EXT2_IMAGIC_FL 0x00002000 +#define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */ +#define EXT2_NOTAIL_FL 0x00008000 /* file tail should not be merged */ +#define EXT2_DIRSYNC_FL 0x00010000 /* Synchronous directory modifications */ +#define EXT2_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ +#define EXT4_HUGE_FILE_FL 0x00040000 /* Set to each huge file */ +#define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */ +#define EXT4_EA_INODE_FL 0x00200000 /* Inode used for large EA */ +/* EXT4_EOFBLOCKS_FL 0x00400000 was here */ +#define FS_NOCOW_FL 0x00800000 /* Do not cow file */ +#define EXT4_SNAPFILE_FL 0x01000000 /* Inode is a snapshot */ +#define EXT4_SNAPFILE_DELETED_FL 0x04000000 /* Snapshot is being deleted */ +#define EXT4_SNAPFILE_SHRUNK_FL 0x08000000 /* Snapshot shrink has completed */ +#define EXT4_INLINE_DATA_FL 0x10000000 /* Inode has inline data */ +#define EXT4_PROJINHERIT_FL 0x20000000 /* Create with parents projid */ +#define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ + +#define EXT2_FL_USER_VISIBLE 0x204BDFFF /* User visible flags */ +#define EXT2_FL_USER_MODIFIABLE 0x204B80FF /* User modifiable flags */ + +/* + * ioctl commands + */ + +/* Used for online resize */ +struct ext2_new_group_input { + __u32 group; /* Group number for this data */ + __u32 block_bitmap; /* Absolute block number of block bitmap */ + __u32 inode_bitmap; /* Absolute block number of inode bitmap */ + __u32 inode_table; /* Absolute block number of inode table start */ + __u32 blocks_count; /* Total number of blocks in this group */ + __u16 reserved_blocks; /* Number of reserved blocks in this group */ + __u16 unused; /* Number of reserved GDT blocks in group */ +}; + +struct ext4_new_group_input { + __u32 group; /* Group number for this data */ + __u64 block_bitmap; /* Absolute block number of block bitmap */ + __u64 inode_bitmap; /* Absolute block number of inode bitmap */ + __u64 inode_table; /* Absolute block number of inode table start */ + __u32 blocks_count; /* Total number of blocks in this group */ + __u16 reserved_blocks; /* Number of reserved blocks in this group */ + __u16 unused; +}; + +#ifdef __GNU__ /* Needed for the Hurd */ +#define _IOT_ext2_new_group_input _IOT (_IOTS(__u32), 5, _IOTS(__u16), 2, 0, 0) +#endif + +#define EXT2_IOC_GETFLAGS _IOR('f', 1, long) +#define EXT2_IOC_SETFLAGS _IOW('f', 2, long) +#define EXT2_IOC_GETVERSION _IOR('v', 1, long) +#define EXT2_IOC_SETVERSION _IOW('v', 2, long) +#define EXT2_IOC_GETVERSION_NEW _IOR('f', 3, long) +#define EXT2_IOC_SETVERSION_NEW _IOW('f', 4, long) +#define EXT2_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long) +#define EXT2_IOC_GROUP_ADD _IOW('f', 8,struct ext2_new_group_input) +#define EXT4_IOC_GROUP_ADD _IOW('f', 8,struct ext4_new_group_input) +#define EXT4_IOC_RESIZE_FS _IOW('f', 16, __u64) + +/* + * Structure of an inode on the disk + */ +struct ext2_inode { + __u16 i_mode; /* File mode */ + __u16 i_uid; /* Low 16 bits of Owner Uid */ + __u32 i_size; /* Size in bytes */ + __u32 i_atime; /* Access time */ + __u32 i_ctime; /* Inode change time */ + __u32 i_mtime; /* Modification time */ + __u32 i_dtime; /* Deletion Time */ + __u16 i_gid; /* Low 16 bits of Group Id */ + __u16 i_links_count; /* Links count */ + __u32 i_blocks; /* Blocks count */ + __u32 i_flags; /* File flags */ + union { + struct { + __u32 l_i_version; /* was l_i_reserved1 */ + } linux1; + struct { + __u32 h_i_translator; + } hurd1; + } osd1; /* OS dependent 1 */ + __u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */ + __u32 i_generation; /* File version (for NFS) */ + __u32 i_file_acl; /* File ACL */ + __u32 i_size_high; /* Formerly i_dir_acl, directory ACL */ + __u32 i_faddr; /* Fragment address */ + union { + struct { + __u16 l_i_blocks_hi; + __u16 l_i_file_acl_high; + __u16 l_i_uid_high; /* these 2 fields */ + __u16 l_i_gid_high; /* were reserved2[0] */ + __u16 l_i_checksum_lo; /* crc32c(uuid+inum+inode) */ + __u16 l_i_reserved; + } linux2; + struct { + __u8 h_i_frag; /* Fragment number */ + __u8 h_i_fsize; /* Fragment size */ + __u16 h_i_mode_high; + __u16 h_i_uid_high; + __u16 h_i_gid_high; + __u32 h_i_author; + } hurd2; + } osd2; /* OS dependent 2 */ +}; + +/* + * Permanent part of an large inode on the disk + */ +struct ext2_inode_large { + __u16 i_mode; /* File mode */ + __u16 i_uid; /* Low 16 bits of Owner Uid */ + __u32 i_size; /* Size in bytes */ + __u32 i_atime; /* Access time */ + __u32 i_ctime; /* Inode Change time */ + __u32 i_mtime; /* Modification time */ + __u32 i_dtime; /* Deletion Time */ + __u16 i_gid; /* Low 16 bits of Group Id */ + __u16 i_links_count; /* Links count */ + __u32 i_blocks; /* Blocks count */ + __u32 i_flags; /* File flags */ + union { + struct { + __u32 l_i_version; /* was l_i_reserved1 */ + } linux1; + struct { + __u32 h_i_translator; + } hurd1; + } osd1; /* OS dependent 1 */ + __u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */ + __u32 i_generation; /* File version (for NFS) */ + __u32 i_file_acl; /* File ACL */ + __u32 i_size_high; /* Formerly i_dir_acl, directory ACL */ + __u32 i_faddr; /* Fragment address */ + union { + struct { + __u16 l_i_blocks_hi; + __u16 l_i_file_acl_high; + __u16 l_i_uid_high; /* these 2 fields */ + __u16 l_i_gid_high; /* were reserved2[0] */ + __u16 l_i_checksum_lo; /* crc32c(uuid+inum+inode) */ + __u16 l_i_reserved; + } linux2; + struct { + __u8 h_i_frag; /* Fragment number */ + __u8 h_i_fsize; /* Fragment size */ + __u16 h_i_mode_high; + __u16 h_i_uid_high; + __u16 h_i_gid_high; + __u32 h_i_author; + } hurd2; + } osd2; /* OS dependent 2 */ + __u16 i_extra_isize; + __u16 i_checksum_hi; /* crc32c(uuid+inum+inode) */ + __u32 i_ctime_extra; /* extra Change time (nsec << 2 | epoch) */ + __u32 i_mtime_extra; /* extra Modification time (nsec << 2 | epoch) */ + __u32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */ + __u32 i_crtime; /* File creation time */ + __u32 i_crtime_extra; /* extra File creation time (nsec << 2 | epoch)*/ + __u32 i_version_hi; /* high 32 bits for 64-bit version */ + __u32 i_projid; /* Project ID */ +}; + +#define EXT4_INODE_CSUM_HI_EXTRA_END \ + (offsetof(struct ext2_inode_large, i_checksum_hi) + sizeof(__u16) - \ + EXT2_GOOD_OLD_INODE_SIZE) + +#define EXT4_EPOCH_BITS 2 +#define EXT4_EPOCH_MASK ((1 << EXT4_EPOCH_BITS) - 1) + +#define i_dir_acl i_size_high + +#define i_checksum_lo osd2.linux2.l_i_checksum_lo + +#define inode_includes(size, field) \ + (size >= (sizeof(((struct ext2_inode_large *)0)->field) + \ + offsetof(struct ext2_inode_large, field))) + +#if defined(__KERNEL__) || defined(__linux__) +#define i_reserved1 osd1.linux1.l_i_reserved1 +#define i_frag osd2.linux2.l_i_frag +#define i_fsize osd2.linux2.l_i_fsize +#define i_uid_low i_uid +#define i_gid_low i_gid +#define i_uid_high osd2.linux2.l_i_uid_high +#define i_gid_high osd2.linux2.l_i_gid_high +#else +#if defined(__GNU__) + +#define i_translator osd1.hurd1.h_i_translator +#define i_frag osd2.hurd2.h_i_frag; +#define i_fsize osd2.hurd2.h_i_fsize; +#define i_uid_high osd2.hurd2.h_i_uid_high +#define i_gid_high osd2.hurd2.h_i_gid_high +#define i_author osd2.hurd2.h_i_author + +#endif /* __GNU__ */ +#endif /* defined(__KERNEL__) || defined(__linux__) */ + +#define inode_uid(inode) ((inode).i_uid | (inode).osd2.linux2.l_i_uid_high << 16) +#define inode_gid(inode) ((inode).i_gid | (inode).osd2.linux2.l_i_gid_high << 16) +#define inode_projid(inode) ((inode).i_projid) +#define ext2fs_set_i_uid_high(inode,x) ((inode).osd2.linux2.l_i_uid_high = (x)) +#define ext2fs_set_i_gid_high(inode,x) ((inode).osd2.linux2.l_i_gid_high = (x)) + +static inline +struct ext2_inode *EXT2_INODE(struct ext2_inode_large *large_inode) +{ + return (struct ext2_inode *) large_inode; +} + +/* + * File system states + */ +#define EXT2_VALID_FS 0x0001 /* Unmounted cleanly */ +#define EXT2_ERROR_FS 0x0002 /* Errors detected */ +#define EXT3_ORPHAN_FS 0x0004 /* Orphans being recovered */ + +/* + * Misc. filesystem flags + */ +#define EXT2_FLAGS_SIGNED_HASH 0x0001 /* Signed dirhash in use */ +#define EXT2_FLAGS_UNSIGNED_HASH 0x0002 /* Unsigned dirhash in use */ +#define EXT2_FLAGS_TEST_FILESYS 0x0004 /* OK for use on development code */ +#define EXT2_FLAGS_IS_SNAPSHOT 0x0010 /* This is a snapshot image */ +#define EXT2_FLAGS_FIX_SNAPSHOT 0x0020 /* Snapshot inodes corrupted */ +#define EXT2_FLAGS_FIX_EXCLUDE 0x0040 /* Exclude bitmaps corrupted */ + +/* + * Mount flags + */ +#define EXT2_MOUNT_CHECK 0x0001 /* Do mount-time checks */ +#define EXT2_MOUNT_GRPID 0x0004 /* Create files with directory's group */ +#define EXT2_MOUNT_DEBUG 0x0008 /* Some debugging messages */ +#define EXT2_MOUNT_ERRORS_CONT 0x0010 /* Continue on errors */ +#define EXT2_MOUNT_ERRORS_RO 0x0020 /* Remount fs ro on errors */ +#define EXT2_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */ +#define EXT2_MOUNT_MINIX_DF 0x0080 /* Mimics the Minix statfs */ +#define EXT2_MOUNT_NO_UID32 0x0200 /* Disable 32-bit UIDs */ + +#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt +#define set_opt(o, opt) o |= EXT2_MOUNT_##opt +#define test_opt(sb, opt) (EXT2_SB(sb)->s_mount_opt & \ + EXT2_MOUNT_##opt) +/* + * Maximal mount counts between two filesystem checks + */ +#define EXT2_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */ +#define EXT2_DFL_CHECKINTERVAL 0 /* Don't use interval check */ + +/* + * Behaviour when detecting errors + */ +#define EXT2_ERRORS_CONTINUE 1 /* Continue execution */ +#define EXT2_ERRORS_RO 2 /* Remount fs read-only */ +#define EXT2_ERRORS_PANIC 3 /* Panic */ +#define EXT2_ERRORS_DEFAULT EXT2_ERRORS_CONTINUE + +#if (__GNUC__ >= 4) +#define ext4_offsetof(TYPE,MEMBER) __builtin_offsetof(TYPE,MEMBER) +#else +#define ext4_offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) +#endif + +/* Metadata checksum algorithms */ +#define EXT2_CRC32C_CHKSUM 1 + +/* Encryption algorithms, key size and key reference len */ +#define EXT4_ENCRYPTION_MODE_INVALID 0 +#define EXT4_ENCRYPTION_MODE_AES_256_XTS 1 +#define EXT4_ENCRYPTION_MODE_AES_256_GCM 2 +#define EXT4_ENCRYPTION_MODE_AES_256_CBC 3 +#define EXT4_ENCRYPTION_MODE_AES_256_CTS 4 + +#define EXT4_AES_256_XTS_KEY_SIZE 64 +#define EXT4_AES_256_GCM_KEY_SIZE 32 +#define EXT4_AES_256_CBC_KEY_SIZE 32 +#define EXT4_AES_256_CTS_KEY_SIZE 32 +#define EXT4_MAX_KEY_SIZE 64 + +#define EXT4_KEY_DESCRIPTOR_SIZE 8 +#define EXT4_CRYPTO_BLOCK_SIZE 16 + +/* Password derivation constants */ +#define EXT4_MAX_PASSPHRASE_SIZE 1024 +#define EXT4_MAX_SALT_SIZE 256 +#define EXT4_PBKDF2_ITERATIONS 0xFFFF + +#define EXT2_LABEL_LEN 16 + +/* + * Policy provided via an ioctl on the topmost directory. This + * structure is also in the kernel. + */ +struct ext4_encryption_policy { + char version; + char contents_encryption_mode; + char filenames_encryption_mode; + char flags; + char master_key_descriptor[EXT4_KEY_DESCRIPTOR_SIZE]; +} __attribute__((__packed__)); + +struct ext4_encryption_key { + __u32 mode; + char raw[EXT4_MAX_KEY_SIZE]; + __u32 size; +} __attribute__((__packed__)); + +/* + * Structure of the super block + */ +struct ext2_super_block { + __u32 s_inodes_count; /* Inodes count */ + __u32 s_blocks_count; /* Blocks count */ + __u32 s_r_blocks_count; /* Reserved blocks count */ + __u32 s_free_blocks_count; /* Free blocks count */ + __u32 s_free_inodes_count; /* Free inodes count */ + __u32 s_first_data_block; /* First Data Block */ + __u32 s_log_block_size; /* Block size */ + __u32 s_log_cluster_size; /* Allocation cluster size */ + __u32 s_blocks_per_group; /* # Blocks per group */ + __u32 s_clusters_per_group; /* # Fragments per group */ + __u32 s_inodes_per_group; /* # Inodes per group */ + __u32 s_mtime; /* Mount time */ + __u32 s_wtime; /* Write time */ + __u16 s_mnt_count; /* Mount count */ + __s16 s_max_mnt_count; /* Maximal mount count */ + __u16 s_magic; /* Magic signature */ + __u16 s_state; /* File system state */ + __u16 s_errors; /* Behaviour when detecting errors */ + __u16 s_minor_rev_level; /* minor revision level */ + __u32 s_lastcheck; /* time of last check */ + __u32 s_checkinterval; /* max. time between checks */ + __u32 s_creator_os; /* OS */ + __u32 s_rev_level; /* Revision level */ + __u16 s_def_resuid; /* Default uid for reserved blocks */ + __u16 s_def_resgid; /* Default gid for reserved blocks */ + /* + * These fields are for EXT2_DYNAMIC_REV superblocks only. + * + * Note: the difference between the compatible feature set and + * the incompatible feature set is that if there is a bit set + * in the incompatible feature set that the kernel doesn't + * know about, it should refuse to mount the filesystem. + * + * e2fsck's requirements are more strict; if it doesn't know + * about a feature in either the compatible or incompatible + * feature set, it must abort and not try to meddle with + * things it doesn't understand... + */ + __u32 s_first_ino; /* First non-reserved inode */ + __u16 s_inode_size; /* size of inode structure */ + __u16 s_block_group_nr; /* block group # of this superblock */ + __u32 s_feature_compat; /* compatible feature set */ + __u32 s_feature_incompat; /* incompatible feature set */ + __u32 s_feature_ro_compat; /* readonly-compatible feature set */ + __u8 s_uuid[16]; /* 128-bit uuid for volume */ + char s_volume_name[EXT2_LABEL_LEN]; /* volume name */ + char s_last_mounted[64]; /* directory where last mounted */ + __u32 s_algorithm_usage_bitmap; /* For compression */ + /* + * Performance hints. Directory preallocation should only + * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on. + */ + __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ + __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ + __u16 s_reserved_gdt_blocks; /* Per group table for online growth */ + /* + * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set. + */ + __u8 s_journal_uuid[16]; /* uuid of journal superblock */ + __u32 s_journal_inum; /* inode number of journal file */ + __u32 s_journal_dev; /* device number of journal file */ + __u32 s_last_orphan; /* start of list of inodes to delete */ + __u32 s_hash_seed[4]; /* HTREE hash seed */ + __u8 s_def_hash_version; /* Default hash version to use */ + __u8 s_jnl_backup_type; /* Default type of journal backup */ + __u16 s_desc_size; /* Group desc. size: INCOMPAT_64BIT */ + __u32 s_default_mount_opts; + __u32 s_first_meta_bg; /* First metablock group */ + __u32 s_mkfs_time; /* When the filesystem was created */ + __u32 s_jnl_blocks[17]; /* Backup of the journal inode */ + __u32 s_blocks_count_hi; /* Blocks count high 32bits */ + __u32 s_r_blocks_count_hi; /* Reserved blocks count high 32 bits*/ + __u32 s_free_blocks_hi; /* Free blocks count */ + __u16 s_min_extra_isize; /* All inodes have at least # bytes */ + __u16 s_want_extra_isize; /* New inodes should reserve # bytes */ + __u32 s_flags; /* Miscellaneous flags */ + __u16 s_raid_stride; /* RAID stride */ + __u16 s_mmp_update_interval; /* # seconds to wait in MMP checking */ + __u64 s_mmp_block; /* Block for multi-mount protection */ + __u32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/ + __u8 s_log_groups_per_flex; /* FLEX_BG group size */ + __u8 s_checksum_type; /* metadata checksum algorithm */ + __u8 s_encryption_level; /* versioning level for encryption */ + __u8 s_reserved_pad; /* Padding to next 32bits */ + __u64 s_kbytes_written; /* nr of lifetime kilobytes written */ + __u32 s_snapshot_inum; /* Inode number of active snapshot */ + __u32 s_snapshot_id; /* sequential ID of active snapshot */ + __u64 s_snapshot_r_blocks_count; /* reserved blocks for active + snapshot's future use */ + __u32 s_snapshot_list; /* inode number of the head of the on-disk snapshot list */ +#define EXT4_S_ERR_START ext4_offsetof(struct ext2_super_block, s_error_count) + __u32 s_error_count; /* number of fs errors */ + __u32 s_first_error_time; /* first time an error happened */ + __u32 s_first_error_ino; /* inode involved in first error */ + __u64 s_first_error_block; /* block involved of first error */ + __u8 s_first_error_func[32]; /* function where the error happened */ + __u32 s_first_error_line; /* line number where error happened */ + __u32 s_last_error_time; /* most recent time of an error */ + __u32 s_last_error_ino; /* inode involved in last error */ + __u32 s_last_error_line; /* line number where error happened */ + __u64 s_last_error_block; /* block involved of last error */ + __u8 s_last_error_func[32]; /* function where the error happened */ +#define EXT4_S_ERR_END ext4_offsetof(struct ext2_super_block, s_mount_opts) + __u8 s_mount_opts[64]; + __u32 s_usr_quota_inum; /* inode number of user quota file */ + __u32 s_grp_quota_inum; /* inode number of group quota file */ + __u32 s_overhead_blocks; /* overhead blocks/clusters in fs */ + __u32 s_backup_bgs[2]; /* If sparse_super2 enabled */ + __u8 s_encrypt_algos[4]; /* Encryption algorithms in use */ + __u8 s_encrypt_pw_salt[16]; /* Salt used for string2key algorithm */ + __le32 s_lpf_ino; /* Location of the lost+found inode */ + __le32 s_prj_quota_inum; /* inode for tracking project quota */ + __le32 s_checksum_seed; /* crc32c(orig_uuid) if csum_seed set */ + __le32 s_reserved[98]; /* Padding to the end of the block */ + __u32 s_checksum; /* crc32c(superblock) */ +}; + +#define EXT4_S_ERR_LEN (EXT4_S_ERR_END - EXT4_S_ERR_START) + +/* + * Codes for operating systems + */ +#define EXT2_OS_LINUX 0 +#define EXT2_OS_HURD 1 +#define EXT2_OBSO_OS_MASIX 2 +#define EXT2_OS_FREEBSD 3 +#define EXT2_OS_LITES 4 + +/* + * Revision levels + */ +#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */ +#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */ + +#define EXT2_CURRENT_REV EXT2_GOOD_OLD_REV +#define EXT2_MAX_SUPP_REV EXT2_DYNAMIC_REV + +#define EXT2_GOOD_OLD_INODE_SIZE 128 + +/* + * Journal inode backup types + */ +#define EXT3_JNL_BACKUP_BLOCKS 1 + +/* + * Feature set definitions + */ + +#define EXT2_HAS_COMPAT_FEATURE(sb,mask) \ + ( EXT2_SB(sb)->s_feature_compat & (mask) ) +#define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) \ + ( EXT2_SB(sb)->s_feature_ro_compat & (mask) ) +#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \ + ( EXT2_SB(sb)->s_feature_incompat & (mask) ) + +#define EXT2_FEATURE_COMPAT_DIR_PREALLOC 0x0001 +#define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002 +#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 +#define EXT2_FEATURE_COMPAT_EXT_ATTR 0x0008 +#define EXT2_FEATURE_COMPAT_RESIZE_INODE 0x0010 +#define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020 +#define EXT2_FEATURE_COMPAT_LAZY_BG 0x0040 +/* #define EXT2_FEATURE_COMPAT_EXCLUDE_INODE 0x0080 not used, legacy */ +#define EXT2_FEATURE_COMPAT_EXCLUDE_BITMAP 0x0100 +#define EXT4_FEATURE_COMPAT_SPARSE_SUPER2 0x0200 + + +#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 +#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 +/* #define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 not used */ +#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008 +#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010 +#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020 +#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040 +#define EXT4_FEATURE_RO_COMPAT_HAS_SNAPSHOT 0x0080 +#define EXT4_FEATURE_RO_COMPAT_QUOTA 0x0100 +#define EXT4_FEATURE_RO_COMPAT_BIGALLOC 0x0200 +/* + * METADATA_CSUM implies GDT_CSUM. When METADATA_CSUM is set, group + * descriptor checksums use the same algorithm as all other data + * structures' checksums. + */ +#define EXT4_FEATURE_RO_COMPAT_METADATA_CSUM 0x0400 +#define EXT4_FEATURE_RO_COMPAT_REPLICA 0x0800 +#define EXT4_FEATURE_RO_COMPAT_READONLY 0x1000 +#define EXT4_FEATURE_RO_COMPAT_PROJECT 0x2000 /* Project quota */ + + +#define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001 +#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002 +#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */ +#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */ +#define EXT2_FEATURE_INCOMPAT_META_BG 0x0010 +#define EXT3_FEATURE_INCOMPAT_EXTENTS 0x0040 +#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 +#define EXT4_FEATURE_INCOMPAT_MMP 0x0100 +#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 +#define EXT4_FEATURE_INCOMPAT_EA_INODE 0x0400 +#define EXT4_FEATURE_INCOMPAT_DIRDATA 0x1000 +#define EXT4_FEATURE_INCOMPAT_CSUM_SEED 0x2000 +#define EXT4_FEATURE_INCOMPAT_LARGEDIR 0x4000 /* >2GB or 3-lvl htree */ +#define EXT4_FEATURE_INCOMPAT_INLINE_DATA 0x8000 /* data in inode */ +#define EXT4_FEATURE_INCOMPAT_ENCRYPT 0x10000 + +#define EXT4_FEATURE_COMPAT_FUNCS(name, ver, flagname) \ +static inline int ext2fs_has_feature_##name(struct ext2_super_block *sb) \ +{ \ + return ((EXT2_SB(sb)->s_feature_compat & \ + EXT##ver##_FEATURE_COMPAT_##flagname) != 0); \ +} \ +static inline void ext2fs_set_feature_##name(struct ext2_super_block *sb) \ +{ \ + EXT2_SB(sb)->s_feature_compat |= \ + EXT##ver##_FEATURE_COMPAT_##flagname; \ +} \ +static inline void ext2fs_clear_feature_##name(struct ext2_super_block *sb) \ +{ \ + EXT2_SB(sb)->s_feature_compat &= \ + ~EXT##ver##_FEATURE_COMPAT_##flagname; \ +} + +#define EXT4_FEATURE_RO_COMPAT_FUNCS(name, ver, flagname) \ +static inline int ext2fs_has_feature_##name(struct ext2_super_block *sb) \ +{ \ + return ((EXT2_SB(sb)->s_feature_ro_compat & \ + EXT##ver##_FEATURE_RO_COMPAT_##flagname) != 0); \ +} \ +static inline void ext2fs_set_feature_##name(struct ext2_super_block *sb) \ +{ \ + EXT2_SB(sb)->s_feature_ro_compat |= \ + EXT##ver##_FEATURE_RO_COMPAT_##flagname; \ +} \ +static inline void ext2fs_clear_feature_##name(struct ext2_super_block *sb) \ +{ \ + EXT2_SB(sb)->s_feature_ro_compat &= \ + ~EXT##ver##_FEATURE_RO_COMPAT_##flagname; \ +} + +#define EXT4_FEATURE_INCOMPAT_FUNCS(name, ver, flagname) \ +static inline int ext2fs_has_feature_##name(struct ext2_super_block *sb) \ +{ \ + return ((EXT2_SB(sb)->s_feature_incompat & \ + EXT##ver##_FEATURE_INCOMPAT_##flagname) != 0); \ +} \ +static inline void ext2fs_set_feature_##name(struct ext2_super_block *sb) \ +{ \ + EXT2_SB(sb)->s_feature_incompat |= \ + EXT##ver##_FEATURE_INCOMPAT_##flagname; \ +} \ +static inline void ext2fs_clear_feature_##name(struct ext2_super_block *sb) \ +{ \ + EXT2_SB(sb)->s_feature_incompat &= \ + ~EXT##ver##_FEATURE_INCOMPAT_##flagname; \ +} + +EXT4_FEATURE_COMPAT_FUNCS(dir_prealloc, 2, DIR_PREALLOC) +EXT4_FEATURE_COMPAT_FUNCS(imagic_inodes, 2, IMAGIC_INODES) +EXT4_FEATURE_COMPAT_FUNCS(journal, 3, HAS_JOURNAL) +EXT4_FEATURE_COMPAT_FUNCS(xattr, 2, EXT_ATTR) +EXT4_FEATURE_COMPAT_FUNCS(resize_inode, 2, RESIZE_INODE) +EXT4_FEATURE_COMPAT_FUNCS(dir_index, 2, DIR_INDEX) +EXT4_FEATURE_COMPAT_FUNCS(lazy_bg, 2, LAZY_BG) +EXT4_FEATURE_COMPAT_FUNCS(exclude_bitmap, 2, EXCLUDE_BITMAP) +EXT4_FEATURE_COMPAT_FUNCS(sparse_super2, 4, SPARSE_SUPER2) + +EXT4_FEATURE_RO_COMPAT_FUNCS(sparse_super, 2, SPARSE_SUPER) +EXT4_FEATURE_RO_COMPAT_FUNCS(large_file, 2, LARGE_FILE) +EXT4_FEATURE_RO_COMPAT_FUNCS(huge_file, 4, HUGE_FILE) +EXT4_FEATURE_RO_COMPAT_FUNCS(gdt_csum, 4, GDT_CSUM) +EXT4_FEATURE_RO_COMPAT_FUNCS(dir_nlink, 4, DIR_NLINK) +EXT4_FEATURE_RO_COMPAT_FUNCS(extra_isize, 4, EXTRA_ISIZE) +EXT4_FEATURE_RO_COMPAT_FUNCS(has_snapshot, 4, HAS_SNAPSHOT) +EXT4_FEATURE_RO_COMPAT_FUNCS(quota, 4, QUOTA) +EXT4_FEATURE_RO_COMPAT_FUNCS(bigalloc, 4, BIGALLOC) +EXT4_FEATURE_RO_COMPAT_FUNCS(metadata_csum, 4, METADATA_CSUM) +EXT4_FEATURE_RO_COMPAT_FUNCS(replica, 4, REPLICA) +EXT4_FEATURE_RO_COMPAT_FUNCS(readonly, 4, READONLY) +EXT4_FEATURE_RO_COMPAT_FUNCS(project, 4, PROJECT) + +EXT4_FEATURE_INCOMPAT_FUNCS(compression, 2, COMPRESSION) +EXT4_FEATURE_INCOMPAT_FUNCS(filetype, 2, FILETYPE) +EXT4_FEATURE_INCOMPAT_FUNCS(journal_needs_recovery, 3, RECOVER) +EXT4_FEATURE_INCOMPAT_FUNCS(journal_dev, 3, JOURNAL_DEV) +EXT4_FEATURE_INCOMPAT_FUNCS(meta_bg, 2, META_BG) +EXT4_FEATURE_INCOMPAT_FUNCS(extents, 3, EXTENTS) +EXT4_FEATURE_INCOMPAT_FUNCS(64bit, 4, 64BIT) +EXT4_FEATURE_INCOMPAT_FUNCS(mmp, 4, MMP) +EXT4_FEATURE_INCOMPAT_FUNCS(flex_bg, 4, FLEX_BG) +EXT4_FEATURE_INCOMPAT_FUNCS(ea_inode, 4, EA_INODE) +EXT4_FEATURE_INCOMPAT_FUNCS(dirdata, 4, DIRDATA) +EXT4_FEATURE_INCOMPAT_FUNCS(csum_seed, 4, CSUM_SEED) +EXT4_FEATURE_INCOMPAT_FUNCS(largedir, 4, LARGEDIR) +EXT4_FEATURE_INCOMPAT_FUNCS(inline_data, 4, INLINE_DATA) +EXT4_FEATURE_INCOMPAT_FUNCS(encrypt, 4, ENCRYPT) + +#define EXT2_FEATURE_COMPAT_SUPP 0 +#define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \ + EXT4_FEATURE_INCOMPAT_MMP) +#define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \ + EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \ + EXT4_FEATURE_RO_COMPAT_DIR_NLINK| \ + EXT2_FEATURE_RO_COMPAT_BTREE_DIR) + +/* + * Default values for user and/or group using reserved blocks + */ +#define EXT2_DEF_RESUID 0 +#define EXT2_DEF_RESGID 0 + +/* + * Default mount options + */ +#define EXT2_DEFM_DEBUG 0x0001 +#define EXT2_DEFM_BSDGROUPS 0x0002 +#define EXT2_DEFM_XATTR_USER 0x0004 +#define EXT2_DEFM_ACL 0x0008 +#define EXT2_DEFM_UID16 0x0010 +#define EXT3_DEFM_JMODE 0x0060 +#define EXT3_DEFM_JMODE_DATA 0x0020 +#define EXT3_DEFM_JMODE_ORDERED 0x0040 +#define EXT3_DEFM_JMODE_WBACK 0x0060 +#define EXT4_DEFM_NOBARRIER 0x0100 +#define EXT4_DEFM_BLOCK_VALIDITY 0x0200 +#define EXT4_DEFM_DISCARD 0x0400 +#define EXT4_DEFM_NODELALLOC 0x0800 + +/* + * Structure of a directory entry + */ +#define EXT2_NAME_LEN 255 + +struct ext2_dir_entry { + __u32 inode; /* Inode number */ + __u16 rec_len; /* Directory entry length */ + __u16 name_len; /* Name length */ + char name[EXT2_NAME_LEN]; /* File name */ +}; + +/* + * The new version of the directory entry. Since EXT2 structures are + * stored in intel byte order, and the name_len field could never be + * bigger than 255 chars, it's safe to reclaim the extra byte for the + * file_type field. + * + * This structure is deprecated due to endian issues. Please use struct + * ext2_dir_entry and accessor functions + * ext2fs_dirent_name_len + * ext2fs_dirent_set_name_len + * ext2fs_dirent_file_type + * ext2fs_dirent_set_file_type + * to get and set name_len and file_type fields. + */ +struct ext2_dir_entry_2 { + __u32 inode; /* Inode number */ + __u16 rec_len; /* Directory entry length */ + __u8 name_len; /* Name length */ + __u8 file_type; + char name[EXT2_NAME_LEN]; /* File name */ +}; + +/* + * This is a bogus directory entry at the end of each leaf block that + * records checksums. + */ +struct ext2_dir_entry_tail { + __u32 det_reserved_zero1; /* Pretend to be unused */ + __u16 det_rec_len; /* 12 */ + __u16 det_reserved_name_len; /* 0xDE00, fake namelen/filetype */ + __u32 det_checksum; /* crc32c(uuid+inode+dirent) */ +}; + +/* + * Ext2 directory file types. Only the low 3 bits are used. The + * other bits are reserved for now. + */ +#define EXT2_FT_UNKNOWN 0 +#define EXT2_FT_REG_FILE 1 +#define EXT2_FT_DIR 2 +#define EXT2_FT_CHRDEV 3 +#define EXT2_FT_BLKDEV 4 +#define EXT2_FT_FIFO 5 +#define EXT2_FT_SOCK 6 +#define EXT2_FT_SYMLINK 7 + +#define EXT2_FT_MAX 8 + +/* + * Annoyingly, e2fsprogs always swab16s ext2_dir_entry.name_len, so we + * have to build ext2_dir_entry_tail with that assumption too. This + * constant helps to build the dir_entry_tail to look like it has an + * "invalid" file type. + */ +#define EXT2_DIR_NAME_LEN_CSUM 0xDE00 + +/* + * EXT2_DIR_PAD defines the directory entries boundaries + * + * NOTE: It must be a multiple of 4 + */ +#define EXT2_DIR_ENTRY_HEADER_LEN 8 +#define EXT2_DIR_PAD 4 +#define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1) +#define EXT2_DIR_REC_LEN(name_len) (((name_len) + \ + EXT2_DIR_ENTRY_HEADER_LEN + \ + EXT2_DIR_ROUND) & \ + ~EXT2_DIR_ROUND) + +/* + * Constants for ext4's extended time encoding + */ +#define EXT4_EPOCH_BITS 2 +#define EXT4_EPOCH_MASK ((1 << EXT4_EPOCH_BITS) - 1) +#define EXT4_NSEC_MASK (~0UL << EXT4_EPOCH_BITS) + +/* + * This structure is used for multiple mount protection. It is written + * into the block number saved in the s_mmp_block field in the superblock. + * Programs that check MMP should assume that if SEQ_FSCK (or any unknown + * code above SEQ_MAX) is present then it is NOT safe to use the filesystem, + * regardless of how old the timestamp is. + * + * The timestamp in the MMP structure will be updated by e2fsck at some + * arbitrary intervals (start of passes, after every few groups of inodes + * in pass1 and pass1b). There is no guarantee that e2fsck is updating + * the MMP block in a timely manner, and the updates it does are purely + * for the convenience of the sysadmin and not for automatic validation. + * + * Note: Only the mmp_seq value is used to determine whether the MMP block + * is being updated. The mmp_time, mmp_nodename, and mmp_bdevname + * fields are only for informational purposes for the administrator, + * due to clock skew between nodes and hostname HA service takeover. + */ +#define EXT4_MMP_MAGIC 0x004D4D50U /* ASCII for MMP */ +#define EXT4_MMP_SEQ_CLEAN 0xFF4D4D50U /* mmp_seq value for clean unmount */ +#define EXT4_MMP_SEQ_FSCK 0xE24D4D50U /* mmp_seq value when being fscked */ +#define EXT4_MMP_SEQ_MAX 0xE24D4D4FU /* maximum valid mmp_seq value */ + +/* Not endian-annotated; it's swapped at read/write time */ +struct mmp_struct { + __u32 mmp_magic; /* Magic number for MMP */ + __u32 mmp_seq; /* Sequence no. updated periodically */ + __u64 mmp_time; /* Time last updated */ + char mmp_nodename[64]; /* Node which last updated MMP block */ + char mmp_bdevname[32]; /* Bdev which last updated MMP block */ + __u16 mmp_check_interval; /* Changed mmp_check_interval */ + __u16 mmp_pad1; + __u32 mmp_pad2[226]; + __u32 mmp_checksum; /* crc32c(uuid+mmp_block) */ +}; + +/* + * Default interval for MMP update in seconds. + */ +#define EXT4_MMP_UPDATE_INTERVAL 5 + +/* + * Maximum interval for MMP update in seconds. + */ +#define EXT4_MMP_MAX_UPDATE_INTERVAL 300 + +/* + * Minimum interval for MMP checking in seconds. + */ +#define EXT4_MMP_MIN_CHECK_INTERVAL 5 + +/* + * Minimum size of inline data. + */ +#define EXT4_MIN_INLINE_DATA_SIZE ((sizeof(__u32) * EXT2_N_BLOCKS)) + +/* + * Size of a parent inode in inline data directory. + */ +#define EXT4_INLINE_DATA_DOTDOT_SIZE (4) + +#endif /* _LINUX_EXT2_FS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2_io.h b/dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2_io.h new file mode 100644 index 0000000..6b7e977 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2_io.h @@ -0,0 +1,163 @@ +/* + * io.h --- the I/O manager abstraction + * + * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. + * + * %Begin-Header% + * This file may be redistributed under the terms of the GNU Library + * General Public License, version 2. + * %End-Header% + */ + +#ifndef _EXT2FS_EXT2_IO_H +#define _EXT2FS_EXT2_IO_H + +/* + * ext2_loff_t is defined here since unix_io.c needs it. + */ +#if defined(__GNUC__) || defined(HAS_LONG_LONG) +typedef long long ext2_loff_t; +#else +typedef long ext2_loff_t; +#endif + +/* llseek.c */ +ext2_loff_t ext2fs_llseek (int, ext2_loff_t, int); + +typedef struct struct_io_manager *io_manager; +typedef struct struct_io_channel *io_channel; +typedef struct struct_io_stats *io_stats; + +#define CHANNEL_FLAGS_WRITETHROUGH 0x01 +#define CHANNEL_FLAGS_DISCARD_ZEROES 0x02 +#define CHANNEL_FLAGS_BLOCK_DEVICE 0x04 + +#define io_channel_discard_zeroes_data(i) (i->flags & CHANNEL_FLAGS_DISCARD_ZEROES) + +struct struct_io_channel { + errcode_t magic; + io_manager manager; + char *name; + int block_size; + errcode_t (*read_error)(io_channel channel, + unsigned long block, + int count, + void *data, + size_t size, + int actual_bytes_read, + errcode_t error); + errcode_t (*write_error)(io_channel channel, + unsigned long block, + int count, + const void *data, + size_t size, + int actual_bytes_written, + errcode_t error); + int refcount; + int flags; + long reserved[14]; + void *private_data; + void *app_data; + int align; +}; + +struct struct_io_stats { + int num_fields; + int reserved; + unsigned long long bytes_read; + unsigned long long bytes_written; +}; + +struct struct_io_manager { + errcode_t magic; + const char *name; + errcode_t (*open)(const char *name, int flags, io_channel *channel); + errcode_t (*close)(io_channel channel); + errcode_t (*set_blksize)(io_channel channel, int blksize); + errcode_t (*read_blk)(io_channel channel, unsigned long block, + int count, void *data); + errcode_t (*write_blk)(io_channel channel, unsigned long block, + int count, const void *data); + errcode_t (*flush)(io_channel channel); + errcode_t (*write_byte)(io_channel channel, unsigned long offset, + int count, const void *data); + errcode_t (*set_option)(io_channel channel, const char *option, + const char *arg); + errcode_t (*get_stats)(io_channel channel, io_stats *io_stats); + errcode_t (*read_blk64)(io_channel channel, unsigned long long block, + int count, void *data); + errcode_t (*write_blk64)(io_channel channel, unsigned long long block, + int count, const void *data); + errcode_t (*discard)(io_channel channel, unsigned long long block, + unsigned long long count); + errcode_t (*cache_readahead)(io_channel channel, + unsigned long long block, + unsigned long long count); + errcode_t (*zeroout)(io_channel channel, unsigned long long block, + unsigned long long count); + long reserved[14]; +}; + +#define IO_FLAG_RW 0x0001 +#define IO_FLAG_EXCLUSIVE 0x0002 +#define IO_FLAG_DIRECT_IO 0x0004 +#define IO_FLAG_FORCE_BOUNCE 0x0008 + +/* + * Convenience functions.... + */ +#define io_channel_close(c) ((c)->manager->close((c))) +#define io_channel_set_blksize(c,s) ((c)->manager->set_blksize((c),s)) +#define io_channel_read_blk(c,b,n,d) ((c)->manager->read_blk((c),b,n,d)) +#define io_channel_write_blk(c,b,n,d) ((c)->manager->write_blk((c),b,n,d)) +#define io_channel_flush(c) ((c)->manager->flush((c))) +#define io_channel_bumpcount(c) ((c)->refcount++) + +/* io_manager.c */ +extern errcode_t io_channel_set_options(io_channel channel, + const char *options); +extern errcode_t io_channel_write_byte(io_channel channel, + unsigned long offset, + int count, const void *data); +extern errcode_t io_channel_read_blk64(io_channel channel, + unsigned long long block, + int count, void *data); +extern errcode_t io_channel_write_blk64(io_channel channel, + unsigned long long block, + int count, const void *data); +extern errcode_t io_channel_discard(io_channel channel, + unsigned long long block, + unsigned long long count); +extern errcode_t io_channel_zeroout(io_channel channel, + unsigned long long block, + unsigned long long count); +extern errcode_t io_channel_alloc_buf(io_channel channel, + int count, void *ptr); +extern errcode_t io_channel_cache_readahead(io_channel io, + unsigned long long block, + unsigned long long count); + +/* unix_io.c */ +extern io_manager unix_io_manager; +extern io_manager unixfd_io_manager; + +/* undo_io.c */ +extern io_manager undo_io_manager; +extern errcode_t set_undo_io_backing_manager(io_manager manager); +extern errcode_t set_undo_io_backup_file(char *file_name); + +/* test_io.c */ +extern io_manager test_io_manager, test_io_backing_manager; +extern void (*test_io_cb_read_blk) + (unsigned long block, int count, errcode_t err); +extern void (*test_io_cb_write_blk) + (unsigned long block, int count, errcode_t err); +extern void (*test_io_cb_read_blk64) + (unsigned long long block, int count, errcode_t err); +extern void (*test_io_cb_write_blk64) + (unsigned long long block, int count, errcode_t err); +extern void (*test_io_cb_set_blksize) + (int blksize, errcode_t err); + +#endif /* _EXT2FS_EXT2_IO_H */ + diff --git a/dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2_types.h b/dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2_types.h new file mode 100644 index 0000000..0638256 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2_types.h @@ -0,0 +1,205 @@ +/* + * If linux/types.h is already been included, assume it has defined + * everything we need. (cross fingers) Other header files may have + * also defined the types that we need. + */ +#if (!defined(_LINUX_TYPES_H) && !defined(_BLKID_TYPES_H) && \ + !defined(_EXT2_TYPES_H)) +#define _EXT2_TYPES_H + +#define __S8_TYPEDEF __signed__ char +#define __U8_TYPEDEF unsigned char +#define __S16_TYPEDEF __signed__ short +#define __U16_TYPEDEF unsigned short +#define __S32_TYPEDEF __signed__ int +#define __U32_TYPEDEF unsigned int +#define __S64_TYPEDEF __signed__ long long +#define __U64_TYPEDEF unsigned long long + +#ifndef HAVE___U8 +#define HAVE___U8 +#ifdef __U8_TYPEDEF +typedef __U8_TYPEDEF __u8; +#else +typedef unsigned char __u8; +#endif +#endif /* HAVE___U8 */ + +#ifndef HAVE___S8 +#define HAVE___S8 +#ifdef __S8_TYPEDEF +typedef __S8_TYPEDEF __s8; +#else +typedef signed char __s8; +#endif +#endif /* HAVE___S8 */ + +#ifndef HAVE___U16 +#define HAVE___U16 +#ifdef __U16_TYPEDEF +typedef __U16_TYPEDEF __u16; +#else +#if (4 == 2) +typedef unsigned int __u16; +#else +#if (2 == 2) +typedef unsigned short __u16; +#else +#undef HAVE___U16 + ?==error: undefined 16 bit type +#endif /* SIZEOF_SHORT == 2 */ +#endif /* SIZEOF_INT == 2 */ +#endif /* __U16_TYPEDEF */ +#endif /* HAVE___U16 */ + +#ifndef HAVE___S16 +#define HAVE___S16 +#ifdef __S16_TYPEDEF +typedef __S16_TYPEDEF __s16; +#else +#if (4 == 2) +typedef int __s16; +#else +#if (2 == 2) +typedef short __s16; +#else +#undef HAVE___S16 + ?==error: undefined 16 bit type +#endif /* SIZEOF_SHORT == 2 */ +#endif /* SIZEOF_INT == 2 */ +#endif /* __S16_TYPEDEF */ +#endif /* HAVE___S16 */ + +#ifndef HAVE___U32 +#define HAVE___U32 +#ifdef __U32_TYPEDEF +typedef __U32_TYPEDEF __u32; +#else +#if (4 == 4) +typedef unsigned int __u32; +#else +#if (8 == 4) +typedef unsigned long __u32; +#else +#if (2 == 4) +typedef unsigned short __u32; +#else +#undef HAVE___U32 + ?== error: undefined 32 bit type +#endif /* SIZEOF_SHORT == 4 */ +#endif /* SIZEOF_LONG == 4 */ +#endif /* SIZEOF_INT == 4 */ +#endif /* __U32_TYPEDEF */ +#endif /* HAVE___U32 */ + +#ifndef HAVE___S32 +#define HAVE___S32 +#ifdef __S32_TYPEDEF +typedef __S32_TYPEDEF __s32; +#else +#if (4 == 4) +typedef int __s32; +#else +#if (8 == 4) +typedef long __s32; +#else +#if (2 == 4) +typedef short __s32; +#else +#undef HAVE___S32 + ?== error: undefined 32 bit type +#endif /* SIZEOF_SHORT == 4 */ +#endif /* SIZEOF_LONG == 4 */ +#endif /* SIZEOF_INT == 4 */ +#endif /* __S32_TYPEDEF */ +#endif /* HAVE___S32 */ + +#ifndef HAVE___U64 +#define HAVE___U64 +#ifdef __U64_TYPEDEF +typedef __U64_TYPEDEF __u64; +#else +#if (4 == 8) +typedef unsigned int __u64; +#else +#if (8 == 8) +typedef unsigned long long __u64; +#else +#if (8 == 8) +typedef unsigned long __u64; +#else +#undef HAVE___U64 + ?== error: undefined 64 bit type +#endif /* SIZEOF_LONG_LONG == 8 */ +#endif /* SIZEOF_LONG == 8 */ +#endif /* SIZEOF_INT == 8 */ +#endif /* __U64_TYPEDEF */ +#endif /* HAVE___U64 */ + +#ifndef HAVE___S64 +#define HAVE___S64 +#ifdef __S64_TYPEDEF +typedef __S64_TYPEDEF __s64; +#else +#if (4 == 8) +typedef int __s64; +#else +#if (8 == 8) +#if defined(__GNUC__) +typedef __signed__ long long __s64; +#else +typedef signed long long __s64; +#endif /* __GNUC__ */ +#else +#if (8 == 8) +typedef long __s64; +#else +#undef HAVE___S64 + ?== error: undefined 64 bit type +#endif /* SIZEOF_LONG_LONG == 8 */ +#endif /* SIZEOF_LONG == 8 */ +#endif /* SIZEOF_INT == 8 */ +#endif /* __S64_TYPEDEF */ +#endif /* HAVE___S64 */ + +#undef __S8_TYPEDEF +#undef __U8_TYPEDEF +#undef __S16_TYPEDEF +#undef __U16_TYPEDEF +#undef __S32_TYPEDEF +#undef __U32_TYPEDEF +#undef __S64_TYPEDEF +#undef __U64_TYPEDEF + +#endif /* _*_TYPES_H */ + +#include + +/* endian checking stuff */ +#ifndef EXT2_ENDIAN_H_ +#define EXT2_ENDIAN_H_ + +#ifdef __CHECKER__ +# ifndef __bitwise +# define __bitwise __attribute__((bitwise)) +# endif +#define __force __attribute__((force)) +#else +# ifndef __bitwise +# define __bitwise +# endif +#define __force +#endif + +typedef __u16 __bitwise __le16; +typedef __u32 __bitwise __le32; +typedef __u64 __bitwise __le64; +typedef __u16 __bitwise __be16; +typedef __u32 __bitwise __be32; +typedef __u64 __bitwise __be64; + +#endif /* EXT2_ENDIAN_H_ */ + +/* These defines are needed for the public ext2fs.h header file */ +#define HAVE_SYS_TYPES_H 1 +#undef WORDS_BIGENDIAN diff --git a/dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2fs.h b/dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2fs.h new file mode 100644 index 0000000..6c6287b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext2fs.h @@ -0,0 +1,1988 @@ +/* + * ext2fs.h --- ext2fs + * + * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. + * + * %Begin-Header% + * This file may be redistributed under the terms of the GNU Library + * General Public License, version 2. + * %End-Header% + */ + +#ifndef _EXT2FS_EXT2FS_H +#define _EXT2FS_EXT2FS_H + +#ifdef __GNUC__ +#define EXT2FS_ATTR(x) __attribute__(x) +#else +#define EXT2FS_ATTR(x) +#endif + +#ifdef CONFIG_TDB +#define EXT2FS_NO_TDB_UNUSED +#else +#define EXT2FS_NO_TDB_UNUSED EXT2FS_ATTR((unused)) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Non-GNU C compilers won't necessarily understand inline + */ +#if (!defined(__GNUC__) && !defined(__WATCOMC__)) +#define NO_INLINE_FUNCS +#endif + +/* + * Where the master copy of the superblock is located, and how big + * superblocks are supposed to be. We define SUPERBLOCK_SIZE because + * the size of the superblock structure is not necessarily trustworthy + * (some versions have the padding set up so that the superblock is + * 1032 bytes long). + */ +#define SUPERBLOCK_OFFSET 1024 +#define SUPERBLOCK_SIZE 1024 + +#define UUID_STR_SIZE 37 + +/* + * The last ext2fs revision level that this version of the library is + * able to support. + */ +#define EXT2_LIB_CURRENT_REV EXT2_DYNAMIC_REV + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#include +#include +#include +#include +#include + +#if EXT2_FLAT_INCLUDES +#include "e2_types.h" +#include "ext2_fs.h" +#include "ext3_extents.h" +#else +#include +#include +#include +#endif /* EXT2_FLAT_INCLUDES */ + +typedef __u32 __bitwise ext2_ino_t; +typedef __u32 __bitwise blk_t; +typedef __u64 __bitwise blk64_t; +typedef __u32 __bitwise dgrp_t; +typedef __u32 __bitwise ext2_off_t; +typedef __u64 __bitwise ext2_off64_t; +typedef __s64 __bitwise e2_blkcnt_t; +typedef __u32 __bitwise ext2_dirhash_t; + +#if EXT2_FLAT_INCLUDES +#include "com_err.h" +#include "ext2_io.h" +#include "ext2_err.h" +#include "ext2_ext_attr.h" +#else +#include +#include +#include +#include +#endif + +/* + * Portability help for Microsoft Visual C++ + */ +#ifdef _MSC_VER +#define EXT2_QSORT_TYPE int __cdecl +#else +#define EXT2_QSORT_TYPE int +#endif + +typedef struct struct_ext2_filsys *ext2_filsys; + +#define EXT2FS_MARK_ERROR 0 +#define EXT2FS_UNMARK_ERROR 1 +#define EXT2FS_TEST_ERROR 2 + +typedef struct ext2fs_struct_generic_bitmap *ext2fs_generic_bitmap; +typedef struct ext2fs_struct_generic_bitmap *ext2fs_inode_bitmap; +typedef struct ext2fs_struct_generic_bitmap *ext2fs_block_bitmap; + +#define EXT2_FIRST_INODE(s) EXT2_FIRST_INO(s) + + +/* + * Badblocks list definitions + */ + +typedef struct ext2_struct_u32_list *ext2_badblocks_list; +typedef struct ext2_struct_u32_iterate *ext2_badblocks_iterate; + +typedef struct ext2_struct_u32_list *ext2_u32_list; +typedef struct ext2_struct_u32_iterate *ext2_u32_iterate; + +/* old */ +typedef struct ext2_struct_u32_list *badblocks_list; +typedef struct ext2_struct_u32_iterate *badblocks_iterate; + +#define BADBLOCKS_FLAG_DIRTY 1 + +/* + * ext2_dblist structure and abstractions (see dblist.c) + */ +struct ext2_db_entry2 { + ext2_ino_t ino; + blk64_t blk; + e2_blkcnt_t blockcnt; +}; + +/* Ye Olde 32-bit version */ +struct ext2_db_entry { + ext2_ino_t ino; + blk_t blk; + int blockcnt; +}; + +typedef struct ext2_struct_dblist *ext2_dblist; + +#define DBLIST_ABORT 1 + +/* + * ext2_fileio definitions + */ + +#define EXT2_FILE_WRITE 0x0001 +#define EXT2_FILE_CREATE 0x0002 + +#define EXT2_FILE_MASK 0x00FF + +#define EXT2_FILE_BUF_DIRTY 0x4000 +#define EXT2_FILE_BUF_VALID 0x2000 + +typedef struct ext2_file *ext2_file_t; + +#define EXT2_SEEK_SET 0 +#define EXT2_SEEK_CUR 1 +#define EXT2_SEEK_END 2 + +/* + * Flags for the ext2_filsys structure and for ext2fs_open() + */ +#define EXT2_FLAG_RW 0x01 +#define EXT2_FLAG_CHANGED 0x02 +#define EXT2_FLAG_DIRTY 0x04 +#define EXT2_FLAG_VALID 0x08 +#define EXT2_FLAG_IB_DIRTY 0x10 +#define EXT2_FLAG_BB_DIRTY 0x20 +#define EXT2_FLAG_SWAP_BYTES 0x40 +#define EXT2_FLAG_SWAP_BYTES_READ 0x80 +#define EXT2_FLAG_SWAP_BYTES_WRITE 0x100 +#define EXT2_FLAG_MASTER_SB_ONLY 0x200 +#define EXT2_FLAG_FORCE 0x400 +#define EXT2_FLAG_SUPER_ONLY 0x800 +#define EXT2_FLAG_JOURNAL_DEV_OK 0x1000 +#define EXT2_FLAG_IMAGE_FILE 0x2000 +#define EXT2_FLAG_EXCLUSIVE 0x4000 +#define EXT2_FLAG_SOFTSUPP_FEATURES 0x8000 +#define EXT2_FLAG_NOFREE_ON_ERROR 0x10000 +#define EXT2_FLAG_64BITS 0x20000 +#define EXT2_FLAG_PRINT_PROGRESS 0x40000 +#define EXT2_FLAG_DIRECT_IO 0x80000 +#define EXT2_FLAG_SKIP_MMP 0x100000 +#define EXT2_FLAG_IGNORE_CSUM_ERRORS 0x200000 + +/* + * Special flag in the ext2 inode i_flag field that means that this is + * a new inode. (So that ext2_write_inode() can clear extra fields.) + */ +#define EXT2_NEW_INODE_FL 0x80000000 + +/* + * Flags for mkjournal + */ +#define EXT2_MKJOURNAL_V1_SUPER 0x0000001 /* create V1 superblock (deprecated) */ +#define EXT2_MKJOURNAL_LAZYINIT 0x0000002 /* don't zero journal inode before use*/ +#define EXT2_MKJOURNAL_NO_MNT_CHECK 0x0000004 /* don't check mount status */ + +struct opaque_ext2_group_desc; + +struct struct_ext2_filsys { + errcode_t magic; + io_channel io; + int flags; + char * device_name; + struct ext2_super_block * super; + unsigned int blocksize; + int fragsize; + dgrp_t group_desc_count; + unsigned long desc_blocks; + struct opaque_ext2_group_desc * group_desc; + unsigned int inode_blocks_per_group; + ext2fs_inode_bitmap inode_map; + ext2fs_block_bitmap block_map; + /* XXX FIXME-64: not 64-bit safe, but not used? */ + errcode_t (*get_blocks)(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks); + errcode_t (*check_directory)(ext2_filsys fs, ext2_ino_t ino); + errcode_t (*write_bitmaps)(ext2_filsys fs); + errcode_t (*read_inode)(ext2_filsys fs, ext2_ino_t ino, + struct ext2_inode *inode); + errcode_t (*write_inode)(ext2_filsys fs, ext2_ino_t ino, + struct ext2_inode *inode); + ext2_badblocks_list badblocks; + ext2_dblist dblist; + __u32 stride; /* for mke2fs */ + struct ext2_super_block * orig_super; + struct ext2_image_hdr * image_header; + __u32 umask; + time_t now; + int cluster_ratio_bits; + __u16 default_bitmap_type; + __u16 pad; + /* + * Reserved for future expansion + */ + __u32 reserved[5]; + + /* + * Reserved for the use of the calling application. + */ + void * priv_data; + + /* + * Inode cache + */ + struct ext2_inode_cache *icache; + io_channel image_io; + + /* + * More callback functions + */ + errcode_t (*get_alloc_block)(ext2_filsys fs, blk64_t goal, + blk64_t *ret); + void (*block_alloc_stats)(ext2_filsys fs, blk64_t blk, int inuse); + + /* + * Buffers for Multiple mount protection(MMP) block. + */ + void *mmp_buf; + void *mmp_cmp; + int mmp_fd; + + /* + * Time at which e2fsck last updated the MMP block. + */ + long mmp_last_written; + + /* progress operation functions */ + struct ext2fs_progress_ops *progress_ops; + + /* Precomputed FS UUID checksum for seeding other checksums */ + __u32 csum_seed; + + io_channel journal_io; + char *journal_name; + + /* New block range allocation hooks */ + errcode_t (*new_range)(ext2_filsys fs, int flags, blk64_t goal, + blk64_t len, blk64_t *pblk, blk64_t *plen); + void (*block_alloc_stats_range)(ext2_filsys fs, blk64_t blk, blk_t num, + int inuse); +}; + +#if EXT2_FLAT_INCLUDES +#include "e2_bitops.h" +#else +#include +#endif + +/* + * 64-bit bitmap backend types + */ +#define EXT2FS_BMAP64_BITARRAY 1 +#define EXT2FS_BMAP64_RBTREE 2 +#define EXT2FS_BMAP64_AUTODIR 3 + +/* + * Return flags for the block iterator functions + */ +#define BLOCK_CHANGED 1 +#define BLOCK_ABORT 2 +#define BLOCK_ERROR 4 +#define BLOCK_INLINE_DATA_CHANGED 8 + +/* + * Block interate flags + * + * BLOCK_FLAG_APPEND, or BLOCK_FLAG_HOLE, indicates that the interator + * function should be called on blocks where the block number is zero. + * This is used by ext2fs_expand_dir() to be able to add a new block + * to an inode. It can also be used for programs that want to be able + * to deal with files that contain "holes". + * + * BLOCK_FLAG_DEPTH_TRAVERSE indicates that the iterator function for + * the indirect, doubly indirect, etc. blocks should be called after + * all of the blocks contained in the indirect blocks are processed. + * This is useful if you are going to be deallocating blocks from an + * inode. + * + * BLOCK_FLAG_DATA_ONLY indicates that the iterator function should be + * called for data blocks only. + * + * BLOCK_FLAG_READ_ONLY is a promise by the caller that it will not + * modify returned block number. + * + * BLOCK_FLAG_NO_LARGE is for internal use only. It informs + * ext2fs_block_iterate2 that large files won't be accepted. + */ +#define BLOCK_FLAG_APPEND 1 +#define BLOCK_FLAG_HOLE 1 +#define BLOCK_FLAG_DEPTH_TRAVERSE 2 +#define BLOCK_FLAG_DATA_ONLY 4 +#define BLOCK_FLAG_READ_ONLY 8 + +#define BLOCK_FLAG_NO_LARGE 0x1000 + +/* + * Magic "block count" return values for the block iterator function. + */ +#define BLOCK_COUNT_IND (-1) +#define BLOCK_COUNT_DIND (-2) +#define BLOCK_COUNT_TIND (-3) +#define BLOCK_COUNT_TRANSLATOR (-4) + +#if 0 +/* + * Flags for ext2fs_move_blocks + */ +#define EXT2_BMOVE_GET_DBLIST 0x0001 +#define EXT2_BMOVE_DEBUG 0x0002 +#endif + +/* + * Generic (non-filesystem layout specific) extents structure + */ + +#define EXT2_EXTENT_FLAGS_LEAF 0x0001 +#define EXT2_EXTENT_FLAGS_UNINIT 0x0002 +#define EXT2_EXTENT_FLAGS_SECOND_VISIT 0x0004 + +struct ext2fs_extent { + blk64_t e_pblk; /* first physical block */ + blk64_t e_lblk; /* first logical block extent covers */ + __u32 e_len; /* number of blocks covered by extent */ + __u32 e_flags; /* extent flags */ +}; + +typedef struct ext2_extent_handle *ext2_extent_handle_t; +typedef struct ext2_extent_path *ext2_extent_path_t; + +/* + * Flags used by ext2fs_extent_get() + */ +#define EXT2_EXTENT_CURRENT 0x0000 +#define EXT2_EXTENT_MOVE_MASK 0x000F +#define EXT2_EXTENT_ROOT 0x0001 +#define EXT2_EXTENT_LAST_LEAF 0x0002 +#define EXT2_EXTENT_FIRST_SIB 0x0003 +#define EXT2_EXTENT_LAST_SIB 0x0004 +#define EXT2_EXTENT_NEXT_SIB 0x0005 +#define EXT2_EXTENT_PREV_SIB 0x0006 +#define EXT2_EXTENT_NEXT_LEAF 0x0007 +#define EXT2_EXTENT_PREV_LEAF 0x0008 +#define EXT2_EXTENT_NEXT 0x0009 +#define EXT2_EXTENT_PREV 0x000A +#define EXT2_EXTENT_UP 0x000B +#define EXT2_EXTENT_DOWN 0x000C +#define EXT2_EXTENT_DOWN_AND_LAST 0x000D + +/* + * Flags used by ext2fs_extent_insert() + */ +#define EXT2_EXTENT_INSERT_AFTER 0x0001 /* insert after handle loc'n */ +#define EXT2_EXTENT_INSERT_NOSPLIT 0x0002 /* insert may not cause split */ + +/* + * Flags used by ext2fs_extent_delete() + */ +#define EXT2_EXTENT_DELETE_KEEP_EMPTY 0x001 /* keep node if last extent gone */ + +/* + * Flags used by ext2fs_extent_set_bmap() + */ +#define EXT2_EXTENT_SET_BMAP_UNINIT 0x0001 + +/* + * Data structure returned by ext2fs_extent_get_info() + */ +struct ext2_extent_info { + int curr_entry; + int curr_level; + int num_entries; + int max_entries; + int max_depth; + int bytes_avail; + blk64_t max_lblk; + blk64_t max_pblk; + __u32 max_len; + __u32 max_uninit_len; +}; + +/* + * Flags for directory block reading and writing functions + */ +#define EXT2_DIRBLOCK_V2_STRUCT 0x0001 + +/* + * Return flags for the directory iterator functions + */ +#define DIRENT_CHANGED 1 +#define DIRENT_ABORT 2 +#define DIRENT_ERROR 3 + +/* + * Directory iterator flags + */ + +#define DIRENT_FLAG_INCLUDE_EMPTY 1 +#define DIRENT_FLAG_INCLUDE_REMOVED 2 +#define DIRENT_FLAG_INCLUDE_CSUM 4 +#define DIRENT_FLAG_INCLUDE_INLINE_DATA 8 + +#define DIRENT_DOT_FILE 1 +#define DIRENT_DOT_DOT_FILE 2 +#define DIRENT_OTHER_FILE 3 +#define DIRENT_DELETED_FILE 4 +#define DIRENT_CHECKSUM 5 + +/* + * Inode scan definitions + */ +typedef struct ext2_struct_inode_scan *ext2_inode_scan; + +/* + * ext2fs_scan flags + */ +#define EXT2_SF_CHK_BADBLOCKS 0x0001 +#define EXT2_SF_BAD_INODE_BLK 0x0002 +#define EXT2_SF_BAD_EXTRA_BYTES 0x0004 +#define EXT2_SF_SKIP_MISSING_ITABLE 0x0008 +#define EXT2_SF_DO_LAZY 0x0010 +#define EXT2_SF_WARN_GARBAGE_INODES 0x0020 + +/* + * ext2fs_check_if_mounted flags + */ +#define EXT2_MF_MOUNTED 1 +#define EXT2_MF_ISROOT 2 +#define EXT2_MF_READONLY 4 +#define EXT2_MF_SWAP 8 +#define EXT2_MF_BUSY 16 + +/* + * Ext2/linux mode flags. We define them here so that we don't need + * to depend on the OS's sys/stat.h, since we may be compiling on a + * non-Linux system. + */ +#define LINUX_S_IFMT 00170000 +#define LINUX_S_IFSOCK 0140000 +#define LINUX_S_IFLNK 0120000 +#define LINUX_S_IFREG 0100000 +#define LINUX_S_IFBLK 0060000 +#define LINUX_S_IFDIR 0040000 +#define LINUX_S_IFCHR 0020000 +#define LINUX_S_IFIFO 0010000 +#define LINUX_S_ISUID 0004000 +#define LINUX_S_ISGID 0002000 +#define LINUX_S_ISVTX 0001000 + +#define LINUX_S_IRWXU 00700 +#define LINUX_S_IRUSR 00400 +#define LINUX_S_IWUSR 00200 +#define LINUX_S_IXUSR 00100 + +#define LINUX_S_IRWXG 00070 +#define LINUX_S_IRGRP 00040 +#define LINUX_S_IWGRP 00020 +#define LINUX_S_IXGRP 00010 + +#define LINUX_S_IRWXO 00007 +#define LINUX_S_IROTH 00004 +#define LINUX_S_IWOTH 00002 +#define LINUX_S_IXOTH 00001 + +#define LINUX_S_ISLNK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFLNK) +#define LINUX_S_ISREG(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFREG) +#define LINUX_S_ISDIR(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFDIR) +#define LINUX_S_ISCHR(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFCHR) +#define LINUX_S_ISBLK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFBLK) +#define LINUX_S_ISFIFO(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFIFO) +#define LINUX_S_ISSOCK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFSOCK) + +/* + * ext2 size of an inode + */ +#define EXT2_I_SIZE(i) ((i)->i_size | ((__u64) (i)->i_size_high << 32)) + +/* + * ext2_icount_t abstraction + */ +#define EXT2_ICOUNT_OPT_INCREMENT 0x01 +#define EXT2_ICOUNT_OPT_FULLMAP 0x02 + +typedef struct ext2_icount *ext2_icount_t; + +/* + * Flags for ext2fs_bmap + */ +#define BMAP_ALLOC 0x0001 +#define BMAP_SET 0x0002 +#define BMAP_UNINIT 0x0004 +#define BMAP_ZERO 0x0008 + +/* + * Returned flags from ext2fs_bmap + */ +#define BMAP_RET_UNINIT 0x0001 + +/* + * Flags for imager.c functions + */ +#define IMAGER_FLAG_INODEMAP 1 +#define IMAGER_FLAG_SPARSEWRITE 2 + +/* + * For checking structure magic numbers... + */ + +#define EXT2_CHECK_MAGIC(struct, code) \ + if ((struct)->magic != (code)) return (code) + +/* + * Features supported by this version of the library + */ +#define EXT2_LIB_FEATURE_COMPAT_SUPP (EXT2_FEATURE_COMPAT_DIR_PREALLOC|\ + EXT2_FEATURE_COMPAT_IMAGIC_INODES|\ + EXT3_FEATURE_COMPAT_HAS_JOURNAL|\ + EXT2_FEATURE_COMPAT_RESIZE_INODE|\ + EXT2_FEATURE_COMPAT_DIR_INDEX|\ + EXT2_FEATURE_COMPAT_EXT_ATTR|\ + EXT4_FEATURE_COMPAT_SPARSE_SUPER2) + +#ifdef CONFIG_MMP +#define EXT4_LIB_INCOMPAT_MMP EXT4_FEATURE_INCOMPAT_MMP +#else +#define EXT4_LIB_INCOMPAT_MMP (0) +#endif + +#define EXT2_LIB_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE|\ + EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\ + EXT2_FEATURE_INCOMPAT_META_BG|\ + EXT3_FEATURE_INCOMPAT_RECOVER|\ + EXT3_FEATURE_INCOMPAT_EXTENTS|\ + EXT4_FEATURE_INCOMPAT_FLEX_BG|\ + EXT4_LIB_INCOMPAT_MMP|\ + EXT4_FEATURE_INCOMPAT_64BIT|\ + EXT4_FEATURE_INCOMPAT_INLINE_DATA|\ + EXT4_FEATURE_INCOMPAT_ENCRYPT|\ + EXT4_FEATURE_INCOMPAT_CSUM_SEED) + +#define EXT2_LIB_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER|\ + EXT4_FEATURE_RO_COMPAT_HUGE_FILE|\ + EXT2_FEATURE_RO_COMPAT_LARGE_FILE|\ + EXT4_FEATURE_RO_COMPAT_DIR_NLINK|\ + EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE|\ + EXT4_FEATURE_RO_COMPAT_GDT_CSUM|\ + EXT4_FEATURE_RO_COMPAT_BIGALLOC|\ + EXT4_FEATURE_RO_COMPAT_QUOTA|\ + EXT4_FEATURE_RO_COMPAT_METADATA_CSUM|\ + EXT4_FEATURE_RO_COMPAT_READONLY |\ + EXT4_FEATURE_RO_COMPAT_PROJECT) + +/* + * These features are only allowed if EXT2_FLAG_SOFTSUPP_FEATURES is passed + * to ext2fs_openfs() + */ +#define EXT2_LIB_SOFTSUPP_INCOMPAT (0) +#define EXT2_LIB_SOFTSUPP_RO_COMPAT (EXT4_FEATURE_RO_COMPAT_REPLICA) + + +/* Translate a block number to a cluster number */ +#define EXT2FS_CLUSTER_RATIO(fs) (1 << (fs)->cluster_ratio_bits) +#define EXT2FS_CLUSTER_MASK(fs) (EXT2FS_CLUSTER_RATIO(fs) - 1) +#define EXT2FS_B2C(fs, blk) ((blk) >> (fs)->cluster_ratio_bits) +/* Translate a cluster number to a block number */ +#define EXT2FS_C2B(fs, cluster) ((cluster) << (fs)->cluster_ratio_bits) +/* Translate # of blks to # of clusters */ +#define EXT2FS_NUM_B2C(fs, blks) (((blks) + EXT2FS_CLUSTER_MASK(fs)) >> \ + (fs)->cluster_ratio_bits) + +#if defined(HAVE_FSTAT64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED) +typedef struct stat64 ext2fs_struct_stat; +#else +typedef struct stat ext2fs_struct_stat; +#endif + +/* + * For ext2fs_close2() and ext2fs_flush2(), this flag allows you to + * avoid the fsync call. + */ +#define EXT2_FLAG_FLUSH_NO_SYNC 1 + +/* + * Modify and iterate extended attributes + */ +struct ext2_xattr_handle; +#define XATTR_ABORT 1 +#define XATTR_CHANGED 2 + +/* + * function prototypes + */ +static inline int ext2fs_has_group_desc_csum(ext2_filsys fs) +{ + return ext2fs_has_feature_metadata_csum(fs->super) || + ext2fs_has_feature_gdt_csum(fs->super); +} + +/* The LARGE_FILE feature should be set if we have stored files 2GB+ in size */ +static inline int ext2fs_needs_large_file_feature(unsigned long long file_size) +{ + return file_size >= 0x80000000ULL; +} + +/* alloc.c */ +extern void ext2fs_clear_block_uninit(ext2_filsys fs, dgrp_t group); +extern errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, int mode, + ext2fs_inode_bitmap map, ext2_ino_t *ret); +extern errcode_t ext2fs_new_block(ext2_filsys fs, blk_t goal, + ext2fs_block_bitmap map, blk_t *ret); +extern errcode_t ext2fs_new_block2(ext2_filsys fs, blk64_t goal, + ext2fs_block_bitmap map, blk64_t *ret); +extern errcode_t ext2fs_get_free_blocks(ext2_filsys fs, blk_t start, + blk_t finish, int num, + ext2fs_block_bitmap map, + blk_t *ret); +extern errcode_t ext2fs_get_free_blocks2(ext2_filsys fs, blk64_t start, + blk64_t finish, int num, + ext2fs_block_bitmap map, + blk64_t *ret); +extern errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal, + char *block_buf, blk_t *ret); +extern errcode_t ext2fs_alloc_block2(ext2_filsys fs, blk64_t goal, + char *block_buf, blk64_t *ret); +extern void ext2fs_set_alloc_block_callback(ext2_filsys fs, + errcode_t (*func)(ext2_filsys fs, + blk64_t goal, + blk64_t *ret), + errcode_t (**old)(ext2_filsys fs, + blk64_t goal, + blk64_t *ret)); +blk64_t ext2fs_find_inode_goal(ext2_filsys fs, ext2_ino_t ino, + struct ext2_inode *inode, blk64_t lblk); +extern void ext2fs_set_new_range_callback(ext2_filsys fs, + errcode_t (*func)(ext2_filsys fs, int flags, blk64_t goal, + blk64_t len, blk64_t *pblk, blk64_t *plen), + errcode_t (**old)(ext2_filsys fs, int flags, blk64_t goal, + blk64_t len, blk64_t *pblk, blk64_t *plen)); +extern void ext2fs_set_block_alloc_stats_range_callback(ext2_filsys fs, + void (*func)(ext2_filsys fs, blk64_t blk, + blk_t num, int inuse), + void (**old)(ext2_filsys fs, blk64_t blk, + blk_t num, int inuse)); +#define EXT2_NEWRANGE_FIXED_GOAL (0x1) +#define EXT2_NEWRANGE_MIN_LENGTH (0x2) +#define EXT2_NEWRANGE_ALL_FLAGS (0x3) +errcode_t ext2fs_new_range(ext2_filsys fs, int flags, blk64_t goal, + blk64_t len, ext2fs_block_bitmap map, blk64_t *pblk, + blk64_t *plen); +#define EXT2_ALLOCRANGE_FIXED_GOAL (0x1) +#define EXT2_ALLOCRANGE_ZERO_BLOCKS (0x2) +#define EXT2_ALLOCRANGE_ALL_FLAGS (0x3) +errcode_t ext2fs_alloc_range(ext2_filsys fs, int flags, blk64_t goal, + blk_t len, blk64_t *ret); + +/* alloc_sb.c */ +extern int ext2fs_reserve_super_and_bgd(ext2_filsys fs, + dgrp_t group, + ext2fs_block_bitmap bmap); +extern void ext2fs_set_block_alloc_stats_callback(ext2_filsys fs, + void (*func)(ext2_filsys fs, + blk64_t blk, + int inuse), + void (**old)(ext2_filsys fs, + blk64_t blk, + int inuse)); + +/* alloc_stats.c */ +void ext2fs_inode_alloc_stats(ext2_filsys fs, ext2_ino_t ino, int inuse); +void ext2fs_inode_alloc_stats2(ext2_filsys fs, ext2_ino_t ino, + int inuse, int isdir); +void ext2fs_block_alloc_stats(ext2_filsys fs, blk_t blk, int inuse); +void ext2fs_block_alloc_stats2(ext2_filsys fs, blk64_t blk, int inuse); +void ext2fs_block_alloc_stats_range(ext2_filsys fs, blk64_t blk, + blk_t num, int inuse); + +/* alloc_tables.c */ +extern errcode_t ext2fs_allocate_tables(ext2_filsys fs); +extern errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group, + ext2fs_block_bitmap bmap); + +/* badblocks.c */ +extern errcode_t ext2fs_u32_list_create(ext2_u32_list *ret, int size); +extern errcode_t ext2fs_u32_list_add(ext2_u32_list bb, __u32 blk); +extern int ext2fs_u32_list_find(ext2_u32_list bb, __u32 blk); +extern int ext2fs_u32_list_test(ext2_u32_list bb, blk_t blk); +extern errcode_t ext2fs_u32_list_iterate_begin(ext2_u32_list bb, + ext2_u32_iterate *ret); +extern int ext2fs_u32_list_iterate(ext2_u32_iterate iter, blk_t *blk); +extern void ext2fs_u32_list_iterate_end(ext2_u32_iterate iter); +extern errcode_t ext2fs_u32_copy(ext2_u32_list src, ext2_u32_list *dest); +extern int ext2fs_u32_list_equal(ext2_u32_list bb1, ext2_u32_list bb2); + +extern errcode_t ext2fs_badblocks_list_create(ext2_badblocks_list *ret, + int size); +extern errcode_t ext2fs_badblocks_list_add(ext2_badblocks_list bb, + blk_t blk); +extern int ext2fs_badblocks_list_test(ext2_badblocks_list bb, + blk_t blk); +extern int ext2fs_u32_list_del(ext2_u32_list bb, __u32 blk); +extern void ext2fs_badblocks_list_del(ext2_u32_list bb, __u32 blk); +extern errcode_t + ext2fs_badblocks_list_iterate_begin(ext2_badblocks_list bb, + ext2_badblocks_iterate *ret); +extern int ext2fs_badblocks_list_iterate(ext2_badblocks_iterate iter, + blk_t *blk); +extern void ext2fs_badblocks_list_iterate_end(ext2_badblocks_iterate iter); +extern errcode_t ext2fs_badblocks_copy(ext2_badblocks_list src, + ext2_badblocks_list *dest); +extern int ext2fs_badblocks_equal(ext2_badblocks_list bb1, + ext2_badblocks_list bb2); +extern int ext2fs_u32_list_count(ext2_u32_list bb); + +/* bb_compat */ +extern errcode_t badblocks_list_create(badblocks_list *ret, int size); +extern errcode_t badblocks_list_add(badblocks_list bb, blk_t blk); +extern int badblocks_list_test(badblocks_list bb, blk_t blk); +extern errcode_t badblocks_list_iterate_begin(badblocks_list bb, + badblocks_iterate *ret); +extern int badblocks_list_iterate(badblocks_iterate iter, blk_t *blk); +extern void badblocks_list_iterate_end(badblocks_iterate iter); +extern void badblocks_list_free(badblocks_list bb); + +/* bb_inode.c */ +extern errcode_t ext2fs_update_bb_inode(ext2_filsys fs, + ext2_badblocks_list bb_list); + +/* bitmaps.c */ +extern void ext2fs_free_block_bitmap(ext2fs_block_bitmap bitmap); +extern void ext2fs_free_inode_bitmap(ext2fs_inode_bitmap bitmap); +extern errcode_t ext2fs_copy_bitmap(ext2fs_generic_bitmap src, + ext2fs_generic_bitmap *dest); +extern errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs); +extern errcode_t ext2fs_write_block_bitmap (ext2_filsys fs); +extern errcode_t ext2fs_read_inode_bitmap (ext2_filsys fs); +extern errcode_t ext2fs_read_block_bitmap(ext2_filsys fs); +extern errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs, + const char *descr, + ext2fs_block_bitmap *ret); +extern errcode_t ext2fs_allocate_subcluster_bitmap(ext2_filsys fs, + const char *descr, + ext2fs_block_bitmap *ret); +extern int ext2fs_get_bitmap_granularity(ext2fs_block_bitmap bitmap); +extern errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs, + const char *descr, + ext2fs_inode_bitmap *ret); +extern errcode_t ext2fs_fudge_inode_bitmap_end(ext2fs_inode_bitmap bitmap, + ext2_ino_t end, ext2_ino_t *oend); +extern errcode_t ext2fs_fudge_block_bitmap_end(ext2fs_block_bitmap bitmap, + blk_t end, blk_t *oend); +extern errcode_t ext2fs_fudge_block_bitmap_end2(ext2fs_block_bitmap bitmap, + blk64_t end, blk64_t *oend); +extern void ext2fs_clear_inode_bitmap(ext2fs_inode_bitmap bitmap); +extern void ext2fs_clear_block_bitmap(ext2fs_block_bitmap bitmap); +extern errcode_t ext2fs_read_bitmaps(ext2_filsys fs); +extern errcode_t ext2fs_write_bitmaps(ext2_filsys fs); +extern errcode_t ext2fs_resize_inode_bitmap(__u32 new_end, __u32 new_real_end, + ext2fs_inode_bitmap bmap); +extern errcode_t ext2fs_resize_inode_bitmap2(__u64 new_end, + __u64 new_real_end, + ext2fs_inode_bitmap bmap); +extern errcode_t ext2fs_resize_block_bitmap(__u32 new_end, __u32 new_real_end, + ext2fs_block_bitmap bmap); +extern errcode_t ext2fs_resize_block_bitmap2(__u64 new_end, + __u64 new_real_end, + ext2fs_block_bitmap bmap); +extern errcode_t ext2fs_compare_block_bitmap(ext2fs_block_bitmap bm1, + ext2fs_block_bitmap bm2); +extern errcode_t ext2fs_compare_inode_bitmap(ext2fs_inode_bitmap bm1, + ext2fs_inode_bitmap bm2); +extern errcode_t ext2fs_set_inode_bitmap_range(ext2fs_inode_bitmap bmap, + ext2_ino_t start, unsigned int num, + void *in); +extern errcode_t ext2fs_set_inode_bitmap_range2(ext2fs_inode_bitmap bmap, + __u64 start, size_t num, + void *in); +extern errcode_t ext2fs_get_inode_bitmap_range(ext2fs_inode_bitmap bmap, + ext2_ino_t start, unsigned int num, + void *out); +extern errcode_t ext2fs_get_inode_bitmap_range2(ext2fs_inode_bitmap bmap, + __u64 start, size_t num, + void *out); +extern errcode_t ext2fs_set_block_bitmap_range(ext2fs_block_bitmap bmap, + blk_t start, unsigned int num, + void *in); +extern errcode_t ext2fs_set_block_bitmap_range2(ext2fs_block_bitmap bmap, + blk64_t start, size_t num, + void *in); +extern errcode_t ext2fs_get_block_bitmap_range(ext2fs_block_bitmap bmap, + blk_t start, unsigned int num, + void *out); +extern errcode_t ext2fs_get_block_bitmap_range2(ext2fs_block_bitmap bmap, + blk64_t start, size_t num, + void *out); + +/* blknum.c */ +extern __u32 ext2fs_inode_bitmap_checksum(ext2_filsys fs, dgrp_t group); +extern __u32 ext2fs_block_bitmap_checksum(ext2_filsys fs, dgrp_t group); +extern dgrp_t ext2fs_group_of_blk2(ext2_filsys fs, blk64_t); +extern blk64_t ext2fs_group_first_block2(ext2_filsys fs, dgrp_t group); +extern blk64_t ext2fs_group_last_block2(ext2_filsys fs, dgrp_t group); +extern int ext2fs_group_blocks_count(ext2_filsys fs, dgrp_t group); +extern blk64_t ext2fs_inode_data_blocks2(ext2_filsys fs, + struct ext2_inode *inode); +extern blk64_t ext2fs_inode_i_blocks(ext2_filsys fs, + struct ext2_inode *inode); +extern blk64_t ext2fs_blocks_count(struct ext2_super_block *super); +extern void ext2fs_blocks_count_set(struct ext2_super_block *super, + blk64_t blk); +extern void ext2fs_blocks_count_add(struct ext2_super_block *super, + blk64_t blk); +extern blk64_t ext2fs_r_blocks_count(struct ext2_super_block *super); +extern void ext2fs_r_blocks_count_set(struct ext2_super_block *super, + blk64_t blk); +extern void ext2fs_r_blocks_count_add(struct ext2_super_block *super, + blk64_t blk); +extern blk64_t ext2fs_free_blocks_count(struct ext2_super_block *super); +extern void ext2fs_free_blocks_count_set(struct ext2_super_block *super, + blk64_t blk); +extern void ext2fs_free_blocks_count_add(struct ext2_super_block *super, + blk64_t blk); +/* Block group descriptor accessor functions */ +extern struct ext2_group_desc *ext2fs_group_desc(ext2_filsys fs, + struct opaque_ext2_group_desc *gdp, + dgrp_t group); +extern blk64_t ext2fs_block_bitmap_csum(ext2_filsys fs, dgrp_t group); +extern blk64_t ext2fs_block_bitmap_loc(ext2_filsys fs, dgrp_t group); +extern void ext2fs_block_bitmap_loc_set(ext2_filsys fs, dgrp_t group, + blk64_t blk); +extern __u32 ext2fs_inode_bitmap_csum(ext2_filsys fs, dgrp_t group); +extern blk64_t ext2fs_inode_bitmap_loc(ext2_filsys fs, dgrp_t group); +extern void ext2fs_inode_bitmap_loc_set(ext2_filsys fs, dgrp_t group, + blk64_t blk); +extern blk64_t ext2fs_inode_table_loc(ext2_filsys fs, dgrp_t group); +extern void ext2fs_inode_table_loc_set(ext2_filsys fs, dgrp_t group, + blk64_t blk); +extern __u32 ext2fs_bg_free_blocks_count(ext2_filsys fs, dgrp_t group); +extern void ext2fs_bg_free_blocks_count_set(ext2_filsys fs, dgrp_t group, + __u32 n); +extern __u32 ext2fs_bg_free_inodes_count(ext2_filsys fs, dgrp_t group); +extern void ext2fs_bg_free_inodes_count_set(ext2_filsys fs, dgrp_t group, + __u32 n); +extern __u32 ext2fs_bg_used_dirs_count(ext2_filsys fs, dgrp_t group); +extern void ext2fs_bg_used_dirs_count_set(ext2_filsys fs, dgrp_t group, + __u32 n); +extern __u32 ext2fs_bg_itable_unused(ext2_filsys fs, dgrp_t group); +extern void ext2fs_bg_itable_unused_set(ext2_filsys fs, dgrp_t group, + __u32 n); +extern __u16 ext2fs_bg_flags(ext2_filsys fs, dgrp_t group); +extern void ext2fs_bg_flags_zap(ext2_filsys fs, dgrp_t group); +extern int ext2fs_bg_flags_test(ext2_filsys fs, dgrp_t group, __u16 bg_flag); +extern void ext2fs_bg_flags_set(ext2_filsys fs, dgrp_t group, __u16 bg_flags); +extern void ext2fs_bg_flags_clear(ext2_filsys fs, dgrp_t group, __u16 bg_flags); +extern __u16 ext2fs_bg_checksum(ext2_filsys fs, dgrp_t group); +extern void ext2fs_bg_checksum_set(ext2_filsys fs, dgrp_t group, __u16 checksum); +extern blk64_t ext2fs_file_acl_block(ext2_filsys fs, + const struct ext2_inode *inode); +extern void ext2fs_file_acl_block_set(ext2_filsys fs, + struct ext2_inode *inode, blk64_t blk); +extern errcode_t ext2fs_inode_size_set(ext2_filsys fs, struct ext2_inode *inode, + ext2_off64_t size); + +/* block.c */ +extern errcode_t ext2fs_block_iterate(ext2_filsys fs, + ext2_ino_t ino, + int flags, + char *block_buf, + int (*func)(ext2_filsys fs, + blk_t *blocknr, + int blockcnt, + void *priv_data), + void *priv_data); +errcode_t ext2fs_block_iterate2(ext2_filsys fs, + ext2_ino_t ino, + int flags, + char *block_buf, + int (*func)(ext2_filsys fs, + blk_t *blocknr, + e2_blkcnt_t blockcnt, + blk_t ref_blk, + int ref_offset, + void *priv_data), + void *priv_data); +errcode_t ext2fs_block_iterate3(ext2_filsys fs, + ext2_ino_t ino, + int flags, + char *block_buf, + int (*func)(ext2_filsys fs, + blk64_t *blocknr, + e2_blkcnt_t blockcnt, + blk64_t ref_blk, + int ref_offset, + void *priv_data), + void *priv_data); + +/* bmap.c */ +extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, + struct ext2_inode *inode, + char *block_buf, int bmap_flags, + blk_t block, blk_t *phys_blk); +extern errcode_t ext2fs_bmap2(ext2_filsys fs, ext2_ino_t ino, + struct ext2_inode *inode, + char *block_buf, int bmap_flags, blk64_t block, + int *ret_flags, blk64_t *phys_blk); +errcode_t ext2fs_map_cluster_block(ext2_filsys fs, ext2_ino_t ino, + struct ext2_inode *inode, blk64_t lblk, + blk64_t *pblk); + +#if 0 +/* bmove.c */ +extern errcode_t ext2fs_move_blocks(ext2_filsys fs, + ext2fs_block_bitmap reserve, + ext2fs_block_bitmap alloc_map, + int flags); +#endif + +/* check_desc.c */ +extern errcode_t ext2fs_check_desc(ext2_filsys fs); + +/* closefs.c */ +extern errcode_t ext2fs_close(ext2_filsys fs); +extern errcode_t ext2fs_close2(ext2_filsys fs, int flags); +extern errcode_t ext2fs_close_free(ext2_filsys *fs); +extern errcode_t ext2fs_flush(ext2_filsys fs); +extern errcode_t ext2fs_flush2(ext2_filsys fs, int flags); +extern int ext2fs_bg_has_super(ext2_filsys fs, dgrp_t group_block); +extern errcode_t ext2fs_super_and_bgd_loc2(ext2_filsys fs, + dgrp_t group, + blk64_t *ret_super_blk, + blk64_t *ret_old_desc_blk, + blk64_t *ret_new_desc_blk, + blk_t *ret_used_blks); +extern int ext2fs_super_and_bgd_loc(ext2_filsys fs, + dgrp_t group, + blk_t *ret_super_blk, + blk_t *ret_old_desc_blk, + blk_t *ret_new_desc_blk, + int *ret_meta_bg); +extern void ext2fs_update_dynamic_rev(ext2_filsys fs); + +/* crc32c.c */ +extern __u32 ext2fs_crc32_be(__u32 crc, unsigned char const *p, size_t len); +extern __u32 ext2fs_crc32c_le(__u32 crc, unsigned char const *p, size_t len); + +/* csum.c */ +extern void ext2fs_init_csum_seed(ext2_filsys fs); +extern errcode_t ext2fs_mmp_csum_set(ext2_filsys fs, struct mmp_struct *mmp); +extern int ext2fs_mmp_csum_verify(ext2_filsys, struct mmp_struct *mmp); +extern int ext2fs_verify_csum_type(ext2_filsys fs, struct ext2_super_block *sb); +extern errcode_t ext2fs_superblock_csum_set(ext2_filsys fs, + struct ext2_super_block *sb); +extern int ext2fs_superblock_csum_verify(ext2_filsys fs, + struct ext2_super_block *sb); +extern errcode_t ext2fs_ext_attr_block_csum_set(ext2_filsys fs, + ext2_ino_t inum, blk64_t block, + struct ext2_ext_attr_header *hdr); +extern int ext2fs_ext_attr_block_csum_verify(ext2_filsys fs, ext2_ino_t inum, + blk64_t block, + struct ext2_ext_attr_header *hdr); +#define EXT2_DIRENT_TAIL(block, blocksize) \ + ((struct ext2_dir_entry_tail *)(((char *)(block)) + \ + (blocksize) - sizeof(struct ext2_dir_entry_tail))) + +extern void ext2fs_initialize_dirent_tail(ext2_filsys fs, + struct ext2_dir_entry_tail *t); +extern int ext2fs_dirent_has_tail(ext2_filsys fs, + struct ext2_dir_entry *dirent); +extern int ext2fs_dirent_csum_verify(ext2_filsys fs, ext2_ino_t inum, + struct ext2_dir_entry *dirent); +extern int ext2fs_dir_block_csum_verify(ext2_filsys fs, ext2_ino_t inum, + struct ext2_dir_entry *dirent); +extern errcode_t ext2fs_dir_block_csum_set(ext2_filsys fs, ext2_ino_t inum, + struct ext2_dir_entry *dirent); +extern errcode_t ext2fs_get_dx_countlimit(ext2_filsys fs, + struct ext2_dir_entry *dirent, + struct ext2_dx_countlimit **cc, + int *offset); +extern errcode_t ext2fs_extent_block_csum_set(ext2_filsys fs, + ext2_ino_t inum, + struct ext3_extent_header *eh); +extern int ext2fs_extent_block_csum_verify(ext2_filsys fs, + ext2_ino_t inum, + struct ext3_extent_header *eh); +extern errcode_t ext2fs_block_bitmap_csum_set(ext2_filsys fs, dgrp_t group, + char *bitmap, int size); +extern int ext2fs_block_bitmap_csum_verify(ext2_filsys fs, dgrp_t group, + char *bitmap, int size); +extern errcode_t ext2fs_inode_bitmap_csum_set(ext2_filsys fs, dgrp_t group, + char *bitmap, int size); +extern int ext2fs_inode_bitmap_csum_verify(ext2_filsys fs, dgrp_t group, + char *bitmap, int size); +extern errcode_t ext2fs_inode_csum_set(ext2_filsys fs, ext2_ino_t inum, + struct ext2_inode_large *inode); +extern int ext2fs_inode_csum_verify(ext2_filsys fs, ext2_ino_t inum, + struct ext2_inode_large *inode); +extern void ext2fs_group_desc_csum_set(ext2_filsys fs, dgrp_t group); +extern int ext2fs_group_desc_csum_verify(ext2_filsys fs, dgrp_t group); +extern errcode_t ext2fs_set_gdt_csum(ext2_filsys fs); +extern __u16 ext2fs_group_desc_csum(ext2_filsys fs, dgrp_t group); + +/* dblist.c */ +extern errcode_t ext2fs_init_dblist(ext2_filsys fs, ext2_dblist *ret_dblist); +extern errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ext2_ino_t ino, + blk_t blk, int blockcnt); +extern errcode_t ext2fs_add_dir_block2(ext2_dblist dblist, ext2_ino_t ino, + blk64_t blk, e2_blkcnt_t blockcnt); +extern void ext2fs_dblist_sort(ext2_dblist dblist, + EXT2_QSORT_TYPE (*sortfunc)(const void *, + const void *)); +extern void ext2fs_dblist_sort2(ext2_dblist dblist, + EXT2_QSORT_TYPE (*sortfunc)(const void *, + const void *)); +extern errcode_t ext2fs_dblist_iterate(ext2_dblist dblist, + int (*func)(ext2_filsys fs, struct ext2_db_entry *db_info, + void *priv_data), + void *priv_data); +extern errcode_t ext2fs_dblist_iterate2(ext2_dblist dblist, + int (*func)(ext2_filsys fs, struct ext2_db_entry2 *db_info, + void *priv_data), + void *priv_data); +extern errcode_t ext2fs_dblist_iterate3(ext2_dblist dblist, + int (*func)(ext2_filsys fs, struct ext2_db_entry2 *db_info, + void *priv_data), + unsigned long long start, + unsigned long long count, + void *priv_data); +extern errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ext2_ino_t ino, + blk_t blk, int blockcnt); +extern errcode_t ext2fs_set_dir_block2(ext2_dblist dblist, ext2_ino_t ino, + blk64_t blk, e2_blkcnt_t blockcnt); +extern errcode_t ext2fs_copy_dblist(ext2_dblist src, + ext2_dblist *dest); +extern int ext2fs_dblist_count(ext2_dblist dblist); +extern blk64_t ext2fs_dblist_count2(ext2_dblist dblist); +extern errcode_t ext2fs_dblist_get_last(ext2_dblist dblist, + struct ext2_db_entry **entry); +extern errcode_t ext2fs_dblist_get_last2(ext2_dblist dblist, + struct ext2_db_entry2 **entry); +extern errcode_t ext2fs_dblist_drop_last(ext2_dblist dblist); + +/* dblist_dir.c */ +extern errcode_t + ext2fs_dblist_dir_iterate(ext2_dblist dblist, + int flags, + char *block_buf, + int (*func)(ext2_ino_t dir, + int entry, + struct ext2_dir_entry *dirent, + int offset, + int blocksize, + char *buf, + void *priv_data), + void *priv_data); + +#if 0 +/* digest_encode.c */ +#define EXT2FS_DIGEST_SIZE EXT2FS_SHA256_LENGTH +extern int ext2fs_digest_encode(const char *src, int len, char *dst); +extern int ext2fs_digest_decode(const char *src, int len, char *dst); +#endif + +/* dirblock.c */ +extern errcode_t ext2fs_read_dir_block(ext2_filsys fs, blk_t block, + void *buf); +extern errcode_t ext2fs_read_dir_block2(ext2_filsys fs, blk_t block, + void *buf, int flags); +extern errcode_t ext2fs_read_dir_block3(ext2_filsys fs, blk64_t block, + void *buf, int flags); +extern errcode_t ext2fs_read_dir_block4(ext2_filsys fs, blk64_t block, + void *buf, int flags, ext2_ino_t ino); +extern errcode_t ext2fs_write_dir_block(ext2_filsys fs, blk_t block, + void *buf); +extern errcode_t ext2fs_write_dir_block2(ext2_filsys fs, blk_t block, + void *buf, int flags); +extern errcode_t ext2fs_write_dir_block3(ext2_filsys fs, blk64_t block, + void *buf, int flags); +extern errcode_t ext2fs_write_dir_block4(ext2_filsys fs, blk64_t block, + void *buf, int flags, ext2_ino_t ino); + +/* dirhash.c */ +extern errcode_t ext2fs_dirhash(int version, const char *name, int len, + const __u32 *seed, + ext2_dirhash_t *ret_hash, + ext2_dirhash_t *ret_minor_hash); + + +/* dir_iterate.c */ +extern errcode_t ext2fs_get_rec_len(ext2_filsys fs, + struct ext2_dir_entry *dirent, + unsigned int *rec_len); +extern errcode_t ext2fs_set_rec_len(ext2_filsys fs, + unsigned int len, + struct ext2_dir_entry *dirent); +extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, + ext2_ino_t dir, + int flags, + char *block_buf, + int (*func)(struct ext2_dir_entry *dirent, + int offset, + int blocksize, + char *buf, + void *priv_data), + void *priv_data); +extern errcode_t ext2fs_dir_iterate2(ext2_filsys fs, + ext2_ino_t dir, + int flags, + char *block_buf, + int (*func)(ext2_ino_t dir, + int entry, + struct ext2_dir_entry *dirent, + int offset, + int blocksize, + char *buf, + void *priv_data), + void *priv_data); + +/* dupfs.c */ +extern errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest); + +/* expanddir.c */ +extern errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir); + +/* ext_attr.c */ +extern __u32 ext2fs_ext_attr_hash_entry(struct ext2_ext_attr_entry *entry, + void *data); +extern errcode_t ext2fs_read_ext_attr(ext2_filsys fs, blk_t block, void *buf); +extern errcode_t ext2fs_read_ext_attr2(ext2_filsys fs, blk64_t block, + void *buf); +extern errcode_t ext2fs_read_ext_attr3(ext2_filsys fs, blk64_t block, + void *buf, ext2_ino_t inum); +extern errcode_t ext2fs_write_ext_attr(ext2_filsys fs, blk_t block, + void *buf); +extern errcode_t ext2fs_write_ext_attr2(ext2_filsys fs, blk64_t block, + void *buf); +extern errcode_t ext2fs_write_ext_attr3(ext2_filsys fs, blk64_t block, + void *buf, ext2_ino_t inum); +extern errcode_t ext2fs_adjust_ea_refcount(ext2_filsys fs, blk_t blk, + char *block_buf, + int adjust, __u32 *newcount); +extern errcode_t ext2fs_adjust_ea_refcount2(ext2_filsys fs, blk64_t blk, + char *block_buf, + int adjust, __u32 *newcount); +extern errcode_t ext2fs_adjust_ea_refcount3(ext2_filsys fs, blk64_t blk, + char *block_buf, + int adjust, __u32 *newcount, + ext2_ino_t inum); +errcode_t ext2fs_xattrs_write(struct ext2_xattr_handle *handle); +errcode_t ext2fs_xattrs_read(struct ext2_xattr_handle *handle); +errcode_t ext2fs_xattrs_iterate(struct ext2_xattr_handle *h, + int (*func)(char *name, char *value, + size_t value_len, void *data), + void *data); +errcode_t ext2fs_xattr_get(struct ext2_xattr_handle *h, const char *key, + void **value, size_t *value_len); +errcode_t ext2fs_xattr_set(struct ext2_xattr_handle *handle, + const char *key, + const void *value, + size_t value_len); +errcode_t ext2fs_xattr_remove(struct ext2_xattr_handle *handle, + const char *key); +errcode_t ext2fs_xattrs_open(ext2_filsys fs, ext2_ino_t ino, + struct ext2_xattr_handle **handle); +errcode_t ext2fs_xattrs_close(struct ext2_xattr_handle **handle); +errcode_t ext2fs_free_ext_attr(ext2_filsys fs, ext2_ino_t ino, + struct ext2_inode_large *inode); +errcode_t ext2fs_xattrs_count(struct ext2_xattr_handle *handle, size_t *count); +errcode_t ext2fs_xattr_inode_max_size(ext2_filsys fs, ext2_ino_t ino, + size_t *size); +#define XATTR_HANDLE_FLAG_RAW 0x0001 +errcode_t ext2fs_xattrs_flags(struct ext2_xattr_handle *handle, + unsigned int *new_flags, unsigned int *old_flags); + +/* extent.c */ +extern errcode_t ext2fs_extent_header_verify(void *ptr, int size); +extern errcode_t ext2fs_extent_open(ext2_filsys fs, ext2_ino_t ino, + ext2_extent_handle_t *handle); +extern errcode_t ext2fs_extent_open2(ext2_filsys fs, ext2_ino_t ino, + struct ext2_inode *inode, + ext2_extent_handle_t *ret_handle); +extern void ext2fs_extent_free(ext2_extent_handle_t handle); +extern errcode_t ext2fs_extent_get(ext2_extent_handle_t handle, + int flags, struct ext2fs_extent *extent); +extern errcode_t ext2fs_extent_node_split(ext2_extent_handle_t handle); +extern errcode_t ext2fs_extent_replace(ext2_extent_handle_t handle, int flags, + struct ext2fs_extent *extent); +extern errcode_t ext2fs_extent_insert(ext2_extent_handle_t handle, int flags, + struct ext2fs_extent *extent); +extern errcode_t ext2fs_extent_set_bmap(ext2_extent_handle_t handle, + blk64_t logical, blk64_t physical, + int flags); +extern errcode_t ext2fs_extent_delete(ext2_extent_handle_t handle, int flags); +extern errcode_t ext2fs_extent_get_info(ext2_extent_handle_t handle, + struct ext2_extent_info *info); +extern errcode_t ext2fs_extent_goto(ext2_extent_handle_t handle, + blk64_t blk); +extern errcode_t ext2fs_extent_goto2(ext2_extent_handle_t handle, + int leaf_level, blk64_t blk); +extern errcode_t ext2fs_extent_fix_parents(ext2_extent_handle_t handle); +size_t ext2fs_max_extent_depth(ext2_extent_handle_t handle); + +/* fallocate.c */ +#define EXT2_FALLOCATE_ZERO_BLOCKS (0x1) +#define EXT2_FALLOCATE_FORCE_INIT (0x2) +#define EXT2_FALLOCATE_FORCE_UNINIT (0x4) +#define EXT2_FALLOCATE_INIT_BEYOND_EOF (0x8) +#define EXT2_FALLOCATE_ALL_FLAGS (0xF) +errcode_t ext2fs_fallocate(ext2_filsys fs, int flags, ext2_ino_t ino, + struct ext2_inode *inode, blk64_t goal, + blk64_t start, blk64_t len); + +/* fileio.c */ +extern errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino, + struct ext2_inode *inode, + int flags, ext2_file_t *ret); +extern errcode_t ext2fs_file_open(ext2_filsys fs, ext2_ino_t ino, + int flags, ext2_file_t *ret); +extern ext2_filsys ext2fs_file_get_fs(ext2_file_t file); +struct ext2_inode *ext2fs_file_get_inode(ext2_file_t file); +extern ext2_ino_t ext2fs_file_get_inode_num(ext2_file_t file); +extern errcode_t ext2fs_file_close(ext2_file_t file); +extern errcode_t ext2fs_file_flush(ext2_file_t file); +extern errcode_t ext2fs_file_read(ext2_file_t file, void *buf, + unsigned int wanted, unsigned int *got); +extern errcode_t ext2fs_file_write(ext2_file_t file, const void *buf, + unsigned int nbytes, unsigned int *written); +extern errcode_t ext2fs_file_llseek(ext2_file_t file, __u64 offset, + int whence, __u64 *ret_pos); +extern errcode_t ext2fs_file_lseek(ext2_file_t file, ext2_off_t offset, + int whence, ext2_off_t *ret_pos); +errcode_t ext2fs_file_get_lsize(ext2_file_t file, __u64 *ret_size); +extern ext2_off_t ext2fs_file_get_size(ext2_file_t file); +extern errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size); +extern errcode_t ext2fs_file_set_size2(ext2_file_t file, ext2_off64_t size); + +/* finddev.c */ +extern char *ext2fs_find_block_device(dev_t device); + +/* flushb.c */ +extern errcode_t ext2fs_sync_device(int fd, int flushb); + +/* freefs.c */ +extern void ext2fs_free(ext2_filsys fs); +extern void ext2fs_free_dblist(ext2_dblist dblist); +extern void ext2fs_badblocks_list_free(ext2_badblocks_list bb); +extern void ext2fs_u32_list_free(ext2_u32_list bb); + +/* gen_bitmap.c */ +extern void ext2fs_free_generic_bitmap(ext2fs_inode_bitmap bitmap); +extern errcode_t ext2fs_make_generic_bitmap(errcode_t magic, ext2_filsys fs, + __u32 start, __u32 end, + __u32 real_end, + const char *descr, char *init_map, + ext2fs_generic_bitmap *ret); +extern errcode_t ext2fs_allocate_generic_bitmap(__u32 start, + __u32 end, + __u32 real_end, + const char *descr, + ext2fs_generic_bitmap *ret); +extern errcode_t ext2fs_copy_generic_bitmap(ext2fs_generic_bitmap src, + ext2fs_generic_bitmap *dest); +extern void ext2fs_clear_generic_bitmap(ext2fs_generic_bitmap bitmap); +extern errcode_t ext2fs_fudge_generic_bitmap_end(ext2fs_inode_bitmap bitmap, + errcode_t magic, + errcode_t neq, + ext2_ino_t end, + ext2_ino_t *oend); +extern void ext2fs_set_generic_bitmap_padding(ext2fs_generic_bitmap map); +extern errcode_t ext2fs_resize_generic_bitmap(errcode_t magic, + __u32 new_end, + __u32 new_real_end, + ext2fs_generic_bitmap bmap); +extern errcode_t ext2fs_compare_generic_bitmap(errcode_t magic, errcode_t neq, + ext2fs_generic_bitmap bm1, + ext2fs_generic_bitmap bm2); +extern errcode_t ext2fs_get_generic_bitmap_range(ext2fs_generic_bitmap bmap, + errcode_t magic, + __u32 start, __u32 num, + void *out); +extern errcode_t ext2fs_set_generic_bitmap_range(ext2fs_generic_bitmap bmap, + errcode_t magic, + __u32 start, __u32 num, + void *in); +extern errcode_t ext2fs_find_first_zero_generic_bitmap(ext2fs_generic_bitmap bitmap, + __u32 start, __u32 end, + __u32 *out); +extern errcode_t ext2fs_find_first_set_generic_bitmap(ext2fs_generic_bitmap bitmap, + __u32 start, __u32 end, + __u32 *out); + +/* gen_bitmap64.c */ +void ext2fs_free_generic_bmap(ext2fs_generic_bitmap bmap); +errcode_t ext2fs_alloc_generic_bmap(ext2_filsys fs, errcode_t magic, + int type, __u64 start, __u64 end, + __u64 real_end, + const char *descr, + ext2fs_generic_bitmap *ret); +errcode_t ext2fs_copy_generic_bmap(ext2fs_generic_bitmap src, + ext2fs_generic_bitmap *dest); +void ext2fs_clear_generic_bmap(ext2fs_generic_bitmap bitmap); +errcode_t ext2fs_fudge_generic_bmap_end(ext2fs_generic_bitmap bitmap, + errcode_t neq, + __u64 end, __u64 *oend); +void ext2fs_set_generic_bmap_padding(ext2fs_generic_bitmap bmap); +errcode_t ext2fs_resize_generic_bmap(ext2fs_generic_bitmap bmap, + __u64 new_end, + __u64 new_real_end); +errcode_t ext2fs_compare_generic_bmap(errcode_t neq, + ext2fs_generic_bitmap bm1, + ext2fs_generic_bitmap bm2); +errcode_t ext2fs_get_generic_bmap_range(ext2fs_generic_bitmap bmap, + __u64 start, unsigned int num, + void *out); +errcode_t ext2fs_set_generic_bmap_range(ext2fs_generic_bitmap bmap, + __u64 start, unsigned int num, + void *in); +errcode_t ext2fs_convert_subcluster_bitmap(ext2_filsys fs, + ext2fs_block_bitmap *bitmap); + +/* get_num_dirs.c */ +extern errcode_t ext2fs_get_num_dirs(ext2_filsys fs, ext2_ino_t *ret_num_dirs); + +/* getsize.c */ +extern errcode_t ext2fs_get_device_size(const char *file, int blocksize, + blk_t *retblocks); +extern errcode_t ext2fs_get_device_size2(const char *file, int blocksize, + blk64_t *retblocks); + +/* getsectsize.c */ +extern int ext2fs_get_dio_alignment(int fd); +errcode_t ext2fs_get_device_sectsize(const char *file, int *sectsize); +errcode_t ext2fs_get_device_phys_sectsize(const char *file, int *sectsize); + +/* i_block.c */ +errcode_t ext2fs_iblk_add_blocks(ext2_filsys fs, struct ext2_inode *inode, + blk64_t num_blocks); +errcode_t ext2fs_iblk_sub_blocks(ext2_filsys fs, struct ext2_inode *inode, + blk64_t num_blocks); +errcode_t ext2fs_iblk_set(ext2_filsys fs, struct ext2_inode *inode, blk64_t b); + +/* imager.c */ +extern errcode_t ext2fs_image_inode_write(ext2_filsys fs, int fd, int flags); +extern errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, int flags); +extern errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, int flags); +extern errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd, int flags); +extern errcode_t ext2fs_image_bitmap_write(ext2_filsys fs, int fd, int flags); +extern errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags); + +/* ind_block.c */ +errcode_t ext2fs_read_ind_block(ext2_filsys fs, blk_t blk, void *buf); +errcode_t ext2fs_write_ind_block(ext2_filsys fs, blk_t blk, void *buf); + +/* initialize.c */ +extern errcode_t ext2fs_initialize(const char *name, int flags, + struct ext2_super_block *param, + io_manager manager, ext2_filsys *ret_fs); + +/* icount.c */ +extern void ext2fs_free_icount(ext2_icount_t icount); +extern errcode_t ext2fs_create_icount_tdb(ext2_filsys fs, char *tdb_dir, + int flags, ext2_icount_t *ret); +extern errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, + unsigned int size, + ext2_icount_t hint, ext2_icount_t *ret); +extern errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, + unsigned int size, + ext2_icount_t *ret); +extern errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino, + __u16 *ret); +extern errcode_t ext2fs_icount_increment(ext2_icount_t icount, ext2_ino_t ino, + __u16 *ret); +extern errcode_t ext2fs_icount_decrement(ext2_icount_t icount, ext2_ino_t ino, + __u16 *ret); +extern errcode_t ext2fs_icount_store(ext2_icount_t icount, ext2_ino_t ino, + __u16 count); +extern ext2_ino_t ext2fs_get_icount_size(ext2_icount_t icount); +errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *); + +/* inline.c */ + +extern errcode_t ext2fs_get_memalign(unsigned long size, + unsigned long align, void *ptr); + +/* inline_data.c */ +extern errcode_t ext2fs_inline_data_init(ext2_filsys fs, ext2_ino_t ino); +extern errcode_t ext2fs_inline_data_size(ext2_filsys fs, ext2_ino_t ino, + size_t *size); +extern errcode_t ext2fs_inline_data_get(ext2_filsys fs, ext2_ino_t ino, + struct ext2_inode *inode, + void *buf, size_t *size); +extern errcode_t ext2fs_inline_data_set(ext2_filsys fs, ext2_ino_t ino, + struct ext2_inode *inode, + void *buf, size_t size); + +/* inode.c */ +extern errcode_t ext2fs_create_inode_cache(ext2_filsys fs, + unsigned int cache_size); +extern void ext2fs_free_inode_cache(struct ext2_inode_cache *icache); +extern errcode_t ext2fs_flush_icache(ext2_filsys fs); +extern errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, + ext2_ino_t *ino, + struct ext2_inode *inode, + int bufsize); +#define EXT2_INODE_SCAN_DEFAULT_BUFFER_BLOCKS 8 +extern errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks, + ext2_inode_scan *ret_scan); +extern void ext2fs_close_inode_scan(ext2_inode_scan scan); +extern errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ext2_ino_t *ino, + struct ext2_inode *inode); +extern errcode_t ext2fs_inode_scan_goto_blockgroup(ext2_inode_scan scan, + int group); +extern void ext2fs_set_inode_callback + (ext2_inode_scan scan, + errcode_t (*done_group)(ext2_filsys fs, + ext2_inode_scan scan, + dgrp_t group, + void * priv_data), + void *done_group_data); +extern int ext2fs_inode_scan_flags(ext2_inode_scan scan, int set_flags, + int clear_flags); +extern errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, + struct ext2_inode * inode, + int bufsize); +extern errcode_t ext2fs_read_inode (ext2_filsys fs, ext2_ino_t ino, + struct ext2_inode * inode); +extern errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, + struct ext2_inode * inode, + int bufsize); +extern errcode_t ext2fs_write_inode(ext2_filsys fs, ext2_ino_t ino, + struct ext2_inode * inode); +extern errcode_t ext2fs_write_new_inode(ext2_filsys fs, ext2_ino_t ino, + struct ext2_inode * inode); +extern errcode_t ext2fs_get_blocks(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks); +extern errcode_t ext2fs_check_directory(ext2_filsys fs, ext2_ino_t ino); + +/* inode_io.c */ +extern io_manager inode_io_manager; +extern errcode_t ext2fs_inode_io_intern(ext2_filsys fs, ext2_ino_t ino, + char **name); +extern errcode_t ext2fs_inode_io_intern2(ext2_filsys fs, ext2_ino_t ino, + struct ext2_inode *inode, + char **name); + +/* ismounted.c */ +extern errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags); +extern errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags, + char *mtpt, int mtlen); + +/* punch.c */ +/* + * NOTE: This function removes from an inode the blocks "start", "end", and + * every block in between. + */ +extern errcode_t ext2fs_punch(ext2_filsys fs, ext2_ino_t ino, + struct ext2_inode *inode, + char *block_buf, blk64_t start, + blk64_t end); + +/* namei.c */ +extern errcode_t ext2fs_lookup(ext2_filsys fs, ext2_ino_t dir, const char *name, + int namelen, char *buf, ext2_ino_t *inode); +extern errcode_t ext2fs_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd, + const char *name, ext2_ino_t *inode); +errcode_t ext2fs_namei_follow(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd, + const char *name, ext2_ino_t *inode); +extern errcode_t ext2fs_follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd, + ext2_ino_t inode, ext2_ino_t *res_inode); + +/* native.c */ +int ext2fs_native_flag(void); + +/* newdir.c */ +extern errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino, + ext2_ino_t parent_ino, char **block); +extern errcode_t ext2fs_new_dir_inline_data(ext2_filsys fs, ext2_ino_t dir_ino, + ext2_ino_t parent_ino, __u32 *iblock); + +/* mkdir.c */ +extern errcode_t ext2fs_mkdir(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t inum, + const char *name); + +/* mkjournal.c */ +extern errcode_t ext2fs_zero_blocks(ext2_filsys fs, blk_t blk, int num, + blk_t *ret_blk, int *ret_count); +extern errcode_t ext2fs_zero_blocks2(ext2_filsys fs, blk64_t blk, int num, + blk64_t *ret_blk, int *ret_count); +extern errcode_t ext2fs_create_journal_superblock(ext2_filsys fs, + __u32 num_blocks, int flags, + char **ret_jsb); +extern errcode_t ext2fs_add_journal_device(ext2_filsys fs, + ext2_filsys journal_dev); +extern errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t num_blocks, + int flags); +extern errcode_t ext2fs_add_journal_inode2(ext2_filsys fs, blk_t num_blocks, + blk64_t goal, int flags); +extern int ext2fs_default_journal_size(__u64 num_blocks); +extern int ext2fs_journal_sb_start(int blocksize); + +/* openfs.c */ +extern errcode_t ext2fs_open(const char *name, int flags, int superblock, + unsigned int block_size, io_manager manager, + ext2_filsys *ret_fs); +extern errcode_t ext2fs_open2(const char *name, const char *io_options, + int flags, int superblock, + unsigned int block_size, io_manager manager, + ext2_filsys *ret_fs); +/* + * The dgrp_t argument to these two functions is not actually a group number + * but a block number offset within a group table! Convert with the formula + * (group_number / groups_per_block). + */ +extern blk64_t ext2fs_descriptor_block_loc2(ext2_filsys fs, + blk64_t group_block, dgrp_t i); +extern blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, + dgrp_t i); +errcode_t ext2fs_get_data_io(ext2_filsys fs, io_channel *old_io); +errcode_t ext2fs_set_data_io(ext2_filsys fs, io_channel new_io); +errcode_t ext2fs_rewrite_to_io(ext2_filsys fs, io_channel new_io); + +/* get_pathname.c */ +extern errcode_t ext2fs_get_pathname(ext2_filsys fs, ext2_ino_t dir, ext2_ino_t ino, + char **name); + +/* link.c */ +errcode_t ext2fs_link(ext2_filsys fs, ext2_ino_t dir, const char *name, + ext2_ino_t ino, int flags); +errcode_t ext2fs_unlink(ext2_filsys fs, ext2_ino_t dir, const char *name, + ext2_ino_t ino, int flags); + +/* symlink.c */ +errcode_t ext2fs_symlink(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t ino, + const char *name, const char *target); + +/* mmp.c */ +errcode_t ext2fs_mmp_read(ext2_filsys fs, blk64_t mmp_blk, void *buf); +errcode_t ext2fs_mmp_write(ext2_filsys fs, blk64_t mmp_blk, void *buf); +errcode_t ext2fs_mmp_clear(ext2_filsys fs); +errcode_t ext2fs_mmp_init(ext2_filsys fs); +errcode_t ext2fs_mmp_start(ext2_filsys fs); +errcode_t ext2fs_mmp_update(ext2_filsys fs); +errcode_t ext2fs_mmp_update2(ext2_filsys fs, int immediately); +errcode_t ext2fs_mmp_stop(ext2_filsys fs); +unsigned ext2fs_mmp_new_seq(void); + +/* read_bb.c */ +extern errcode_t ext2fs_read_bb_inode(ext2_filsys fs, + ext2_badblocks_list *bb_list); + +/* read_bb_file.c */ +extern errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, + ext2_badblocks_list *bb_list, + void *priv_data, + void (*invalid)(ext2_filsys fs, + blk_t blk, + char *badstr, + void *priv_data)); +extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, + ext2_badblocks_list *bb_list, + void (*invalid)(ext2_filsys fs, + blk_t blk)); + +/* res_gdt.c */ +extern errcode_t ext2fs_create_resize_inode(ext2_filsys fs); + +/*sha256.c */ +#define EXT2FS_SHA256_LENGTH 32 +#if 0 +extern void ext2fs_sha256(const unsigned char *in, unsigned long in_size, + unsigned char out[EXT2FS_SHA256_LENGTH]); +#endif + +/* sha512.c */ +#define EXT2FS_SHA512_LENGTH 64 +extern void ext2fs_sha512(const unsigned char *in, unsigned long in_size, + unsigned char out[EXT2FS_SHA512_LENGTH]); + +/* swapfs.c */ +extern errcode_t ext2fs_dirent_swab_in2(ext2_filsys fs, char *buf, size_t size, + int flags); +extern errcode_t ext2fs_dirent_swab_in(ext2_filsys fs, char *buf, int flags); +extern errcode_t ext2fs_dirent_swab_out2(ext2_filsys fs, char *buf, size_t size, + int flags); +extern errcode_t ext2fs_dirent_swab_out(ext2_filsys fs, char *buf, int flags); +extern void ext2fs_swap_ext_attr(char *to, char *from, int bufsize, + int has_header); +extern void ext2fs_swap_ext_attr_header(struct ext2_ext_attr_header *to_header, + struct ext2_ext_attr_header *from_hdr); +extern void ext2fs_swap_ext_attr_entry(struct ext2_ext_attr_entry *to_entry, + struct ext2_ext_attr_entry *from_entry); +extern void ext2fs_swap_super(struct ext2_super_block * super); +extern void ext2fs_swap_group_desc(struct ext2_group_desc *gdp); +extern void ext2fs_swap_group_desc2(ext2_filsys, struct ext2_group_desc *gdp); +extern void ext2fs_swap_inode_full(ext2_filsys fs, struct ext2_inode_large *t, + struct ext2_inode_large *f, int hostorder, + int bufsize); +extern void ext2fs_swap_inode(ext2_filsys fs,struct ext2_inode *t, + struct ext2_inode *f, int hostorder); +extern void ext2fs_swap_mmp(struct mmp_struct *mmp); + +/* unix_io.c */ +extern int ext2fs_open_file(const char *pathname, int flags, mode_t mode); +extern int ext2fs_stat(const char *path, ext2fs_struct_stat *buf); +extern int ext2fs_fstat(int fd, ext2fs_struct_stat *buf); + +/* valid_blk.c */ +extern int ext2fs_inode_has_valid_blocks(struct ext2_inode *inode); +extern int ext2fs_inode_has_valid_blocks2(ext2_filsys fs, + struct ext2_inode *inode); + +/* version.c */ +extern int ext2fs_parse_version_string(const char *ver_string); +extern int ext2fs_get_library_version(const char **ver_string, + const char **date_string); + +/* write_bb_file.c */ +extern errcode_t ext2fs_write_bb_FILE(ext2_badblocks_list bb_list, + unsigned int flags, + FILE *f); + + +/* inline functions */ +#ifdef NO_INLINE_FUNCS +extern errcode_t ext2fs_get_mem(unsigned long size, void *ptr); +extern errcode_t ext2fs_get_memzero(unsigned long size, void *ptr); +extern errcode_t ext2fs_get_array(unsigned long count, + unsigned long size, void *ptr); +extern errcode_t ext2fs_get_arrayzero(unsigned long count, + unsigned long size, void *ptr); +extern errcode_t ext2fs_free_mem(void *ptr); +extern errcode_t ext2fs_resize_mem(unsigned long old_size, + unsigned long size, void *ptr); +extern void ext2fs_mark_super_dirty(ext2_filsys fs); +extern void ext2fs_mark_changed(ext2_filsys fs); +extern int ext2fs_test_changed(ext2_filsys fs); +extern void ext2fs_mark_valid(ext2_filsys fs); +extern void ext2fs_unmark_valid(ext2_filsys fs); +extern int ext2fs_test_valid(ext2_filsys fs); +extern void ext2fs_mark_ib_dirty(ext2_filsys fs); +extern void ext2fs_mark_bb_dirty(ext2_filsys fs); +extern int ext2fs_test_ib_dirty(ext2_filsys fs); +extern int ext2fs_test_bb_dirty(ext2_filsys fs); +extern dgrp_t ext2fs_group_of_blk(ext2_filsys fs, blk_t blk); +extern dgrp_t ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino); +extern blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group); +extern blk_t ext2fs_group_last_block(ext2_filsys fs, dgrp_t group); +extern blk_t ext2fs_inode_data_blocks(ext2_filsys fs, + struct ext2_inode *inode); +extern unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b); +extern __u64 ext2fs_div64_ceil(__u64 a, __u64 b); +extern int ext2fs_dirent_name_len(const struct ext2_dir_entry *entry); +extern void ext2fs_dirent_set_name_len(struct ext2_dir_entry *entry, int len); +extern int ext2fs_dirent_file_type(const struct ext2_dir_entry *entry); +extern void ext2fs_dirent_set_file_type(struct ext2_dir_entry *entry, int type); +extern struct ext2_inode *ext2fs_inode(struct ext2_inode_large * large_inode); +extern const struct ext2_inode *ext2fs_const_inode(const struct ext2_inode_large * large_inode); + +#endif + +/* + * The actual inlined functions definitions themselves... + * + * If NO_INLINE_FUNCS is defined, then we won't try to do inline + * functions at all! + */ +#if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS)) +#ifdef INCLUDE_INLINE_FUNCS +#define _INLINE_ extern +#else +#if (__STDC_VERSION__ >= 199901L) +#define _INLINE_ inline +#else +#ifdef __GNUC__ +#define _INLINE_ extern __inline__ +#else /* For Watcom C */ +#define _INLINE_ extern inline +#endif /* __GNUC__ */ +#endif /* __STDC_VERSION__ >= 199901L */ +#endif + +#ifndef EXT2_CUSTOM_MEMORY_ROUTINES +#include +/* + * Allocate memory. The 'ptr' arg must point to a pointer. + */ +_INLINE_ errcode_t ext2fs_get_mem(unsigned long size, void *ptr) +{ + void *pp; + + pp = malloc(size); + if (!pp) + return EXT2_ET_NO_MEMORY; + memcpy(ptr, &pp, sizeof (pp)); + return 0; +} + +_INLINE_ errcode_t ext2fs_get_memzero(unsigned long size, void *ptr) +{ + void *pp; + + pp = malloc(size); + if (!pp) + return EXT2_ET_NO_MEMORY; + memset(pp, 0, size); + memcpy(ptr, &pp, sizeof(pp)); + return 0; +} + +_INLINE_ errcode_t ext2fs_get_array(unsigned long count, unsigned long size, void *ptr) +{ + if (count && (~0UL)/count < size) + return EXT2_ET_NO_MEMORY; + return ext2fs_get_mem(count*size, ptr); +} + +_INLINE_ errcode_t ext2fs_get_arrayzero(unsigned long count, + unsigned long size, void *ptr) +{ + void *pp; + + if (count && (~0UL)/count < size) + return EXT2_ET_NO_MEMORY; + pp = calloc(count, size); + if (!pp) + return EXT2_ET_NO_MEMORY; + memcpy(ptr, &pp, sizeof(pp)); + return 0; +} + +/* + * Free memory. The 'ptr' arg must point to a pointer. + */ +_INLINE_ errcode_t ext2fs_free_mem(void *ptr) +{ + void *p; + + memcpy(&p, ptr, sizeof(p)); + free(p); + p = 0; + memcpy(ptr, &p, sizeof(p)); + return 0; +} + +/* + * Resize memory. The 'ptr' arg must point to a pointer. + */ +_INLINE_ errcode_t ext2fs_resize_mem(unsigned long EXT2FS_ATTR((unused)) old_size, + unsigned long size, void *ptr) +{ + void *p; + + /* Use "memcpy" for pointer assignments here to avoid problems + * with C99 strict type aliasing rules. */ + memcpy(&p, ptr, sizeof(p)); + p = realloc(p, size); + if (!p) + return EXT2_ET_NO_MEMORY; + memcpy(ptr, &p, sizeof(p)); + return 0; +} +#endif /* Custom memory routines */ + +/* + * Mark a filesystem superblock as dirty + */ +_INLINE_ void ext2fs_mark_super_dirty(ext2_filsys fs) +{ + fs->flags |= EXT2_FLAG_DIRTY | EXT2_FLAG_CHANGED; +} + +/* + * Mark a filesystem as changed + */ +_INLINE_ void ext2fs_mark_changed(ext2_filsys fs) +{ + fs->flags |= EXT2_FLAG_CHANGED; +} + +/* + * Check to see if a filesystem has changed + */ +_INLINE_ int ext2fs_test_changed(ext2_filsys fs) +{ + return (fs->flags & EXT2_FLAG_CHANGED); +} + +/* + * Mark a filesystem as valid + */ +_INLINE_ void ext2fs_mark_valid(ext2_filsys fs) +{ + fs->flags |= EXT2_FLAG_VALID; +} + +/* + * Mark a filesystem as NOT valid + */ +_INLINE_ void ext2fs_unmark_valid(ext2_filsys fs) +{ + fs->flags &= ~EXT2_FLAG_VALID; +} + +/* + * Check to see if a filesystem is valid + */ +_INLINE_ int ext2fs_test_valid(ext2_filsys fs) +{ + return (fs->flags & EXT2_FLAG_VALID); +} + +/* + * Mark the inode bitmap as dirty + */ +_INLINE_ void ext2fs_mark_ib_dirty(ext2_filsys fs) +{ + fs->flags |= EXT2_FLAG_IB_DIRTY | EXT2_FLAG_CHANGED; +} + +/* + * Mark the block bitmap as dirty + */ +_INLINE_ void ext2fs_mark_bb_dirty(ext2_filsys fs) +{ + fs->flags |= EXT2_FLAG_BB_DIRTY | EXT2_FLAG_CHANGED; +} + +/* + * Check to see if a filesystem's inode bitmap is dirty + */ +_INLINE_ int ext2fs_test_ib_dirty(ext2_filsys fs) +{ + return (fs->flags & EXT2_FLAG_IB_DIRTY); +} + +/* + * Check to see if a filesystem's block bitmap is dirty + */ +_INLINE_ int ext2fs_test_bb_dirty(ext2_filsys fs) +{ + return (fs->flags & EXT2_FLAG_BB_DIRTY); +} + +/* + * Return the group # of a block + */ +_INLINE_ dgrp_t ext2fs_group_of_blk(ext2_filsys fs, blk_t blk) +{ + return ext2fs_group_of_blk2(fs, blk); +} +/* + * Return the group # of an inode number + */ +_INLINE_ dgrp_t ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino) +{ + return (ino - 1) / fs->super->s_inodes_per_group; +} + +/* + * Return the first block (inclusive) in a group + */ +_INLINE_ blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group) +{ + return (blk_t) ext2fs_group_first_block2(fs, group); +} + +/* + * Return the last block (inclusive) in a group + */ +_INLINE_ blk_t ext2fs_group_last_block(ext2_filsys fs, dgrp_t group) +{ + return (blk_t) ext2fs_group_last_block2(fs, group); +} + +_INLINE_ blk_t ext2fs_inode_data_blocks(ext2_filsys fs, + struct ext2_inode *inode) +{ + return (blk_t) ext2fs_inode_data_blocks2(fs, inode); +} + +/* + * This is an efficient, overflow safe way of calculating ceil((1.0 * a) / b) + */ +_INLINE_ unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b) +{ + if (!a) + return 0; + return ((a - 1) / b) + 1; +} + +_INLINE_ __u64 ext2fs_div64_ceil(__u64 a, __u64 b) +{ + if (!a) + return 0; + return ((a - 1) / b) + 1; +} + +_INLINE_ int ext2fs_dirent_name_len(const struct ext2_dir_entry *entry) +{ + return entry->name_len & 0xff; +} + +_INLINE_ void ext2fs_dirent_set_name_len(struct ext2_dir_entry *entry, int len) +{ + entry->name_len = (entry->name_len & 0xff00) | (len & 0xff); +} + +_INLINE_ int ext2fs_dirent_file_type(const struct ext2_dir_entry *entry) +{ + return entry->name_len >> 8; +} + +_INLINE_ void ext2fs_dirent_set_file_type(struct ext2_dir_entry *entry, int type) +{ + entry->name_len = (entry->name_len & 0xff) | (type << 8); +} + +_INLINE_ struct ext2_inode *ext2fs_inode(struct ext2_inode_large * large_inode) +{ + /* It is always safe to convert large inode to a small inode */ + return (struct ext2_inode *) large_inode; +} + +_INLINE_ const struct ext2_inode * +ext2fs_const_inode(const struct ext2_inode_large * large_inode) +{ + /* It is always safe to convert large inode to a small inode */ + return (const struct ext2_inode *) large_inode; +} + +#undef _INLINE_ +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _EXT2FS_EXT2FS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext3_extents.h b/dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext3_extents.h new file mode 100644 index 0000000..309fbc8 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ext2fs/ext3_extents.h @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2003,2004 Cluster File Systems, Inc, info@clusterfs.com + * Written by Alex Tomas + * + * %Begin-Header% + * This file may be redistributed under the terms of the GNU Library + * General Public License, version 2. + * %End-Header% + */ + +#ifndef _LINUX_EXT3_EXTENTS +#define _LINUX_EXT3_EXTENTS + +/* + * ext3_inode has i_block array (total 60 bytes) + * first 4 bytes are used to store: + * - tree depth (0 mean there is no tree yet. all extents in the inode) + * - number of alive extents in the inode + */ + +/* + * This is extent tail on-disk structure. + * All other extent structures are 12 bytes long. It turns out that + * block_size % 12 >= 4 for at least all powers of 2 greater than 512, which + * covers all valid ext4 block sizes. Therefore, this tail structure can be + * crammed into the end of the block without having to rebalance the tree. + */ +struct ext3_extent_tail { + __le32 et_checksum; /* crc32c(uuid+inum+extent_block) */ +}; + +/* + * this is extent on-disk structure + * it's used at the bottom of the tree + */ +struct ext3_extent { + __le32 ee_block; /* first logical block extent covers */ + __le16 ee_len; /* number of blocks covered by extent */ + __le16 ee_start_hi; /* high 16 bits of physical block */ + __le32 ee_start; /* low 32 bigs of physical block */ +}; + +/* + * this is index on-disk structure + * it's used at all the levels, but the bottom + */ +struct ext3_extent_idx { + __le32 ei_block; /* index covers logical blocks from 'block' */ + __le32 ei_leaf; /* pointer to the physical block of the next * + * level. leaf or next index could bet here */ + __le16 ei_leaf_hi; /* high 16 bits of physical block */ + __le16 ei_unused; +}; + +/* + * each block (leaves and indexes), even inode-stored has header + */ +struct ext3_extent_header { + __le16 eh_magic; /* probably will support different formats */ + __le16 eh_entries; /* number of valid entries */ + __le16 eh_max; /* capacity of store in entries */ + __le16 eh_depth; /* has tree real underlying blocks? */ + __le32 eh_generation; /* generation of the tree */ +}; + +#define EXT3_EXT_MAGIC 0xf30a + +/* + * array of ext3_ext_path contains path to some extent + * creation/lookup routines use it for traversal/splitting/etc + * truncate uses it to simulate recursive walking + */ +struct ext3_ext_path { + __u32 p_block; + __u16 p_depth; + struct ext3_extent *p_ext; + struct ext3_extent_idx *p_idx; + struct ext3_extent_header *p_hdr; + struct buffer_head *p_bh; +}; + +/* + * EXT_INIT_MAX_LEN is the maximum number of blocks we can have in an + * initialized extent. This is 2^15 and not (2^16 - 1), since we use the + * MSB of ee_len field in the extent datastructure to signify if this + * particular extent is an initialized extent or an uninitialized (i.e. + * preallocated). + * EXT_UNINIT_MAX_LEN is the maximum number of blocks we can have in an + * uninitialized extent. + * If ee_len is <= 0x8000, it is an initialized extent. Otherwise, it is an + * uninitialized one. In other words, if MSB of ee_len is set, it is an + * uninitialized extent with only one special scenario when ee_len = 0x8000. + * In this case we can not have an uninitialized extent of zero length and + * thus we make it as a special case of initialized extent with 0x8000 length. + * This way we get better extent-to-group alignment for initialized extents. + * Hence, the maximum number of blocks we can have in an *initialized* + * extent is 2^15 (32768) and in an *uninitialized* extent is 2^15-1 (32767). + */ +#define EXT_INIT_MAX_LEN (1UL << 15) +#define EXT_UNINIT_MAX_LEN (EXT_INIT_MAX_LEN - 1) +#define EXT_MAX_EXTENT_LBLK (((__u64) 1 << 32) - 1) +#define EXT_MAX_EXTENT_PBLK (((__u64) 1 << 48) - 1) + +#define EXT_FIRST_EXTENT(__hdr__) \ + ((struct ext3_extent *) (((char *) (__hdr__)) + \ + sizeof(struct ext3_extent_header))) +#define EXT_FIRST_INDEX(__hdr__) \ + ((struct ext3_extent_idx *) (((char *) (__hdr__)) + \ + sizeof(struct ext3_extent_header))) +#define EXT_HAS_FREE_INDEX(__path__) \ + (ext2fs_le16_to_cpu((__path__)->p_hdr->eh_entries) < \ + ext2fs_le16_to_cpu((__path__)->p_hdr->eh_max)) +#define EXT_LAST_EXTENT(__hdr__) \ + (EXT_FIRST_EXTENT((__hdr__)) + \ + ext2fs_le16_to_cpu((__hdr__)->eh_entries) - 1) +#define EXT_LAST_INDEX(__hdr__) \ + (EXT_FIRST_INDEX((__hdr__)) + \ + ext2fs_le16_to_cpu((__hdr__)->eh_entries) - 1) +#define EXT_MAX_EXTENT(__hdr__) \ + (EXT_FIRST_EXTENT((__hdr__)) + \ + ext2fs_le16_to_cpu((__hdr__)->eh_max) - 1) +#define EXT_MAX_INDEX(__hdr__) \ + (EXT_FIRST_INDEX((__hdr__)) + \ + ext2fs_le16_to_cpu((__hdr__)->eh_max) - 1) + +#endif /* _LINUX_EXT3_EXTENTS */ + diff --git a/dingux/opt/mipsel-linux-uclibc/include/ext2fs/qcow2.h b/dingux/opt/mipsel-linux-uclibc/include/ext2fs/qcow2.h new file mode 100644 index 0000000..81e0ec9 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ext2fs/qcow2.h @@ -0,0 +1,113 @@ +/* + * qcow2.h --- structures and function prototypes for qcow2.c to generate + * qcow2 formatted disk images. This format is used originally by QEMU + * for virtual machines, and stores the filesystem data on disk in a + * packed format to avoid creating sparse image files that need lots of + * seeking to read and write. + * + * The qcow2 format supports zlib compression, but that is not yet + * implemented. + * + * It is possible to directly mount a qcow2 image using qemu-nbd: + * + * [root]# modprobe nbd max_part=63 + * [root]# qemu-nbd -c /dev/nbd0 image.img + * [root]# mount /dev/nbd0p1 /mnt/qemu + * + * Format details at http://people.gnome.org/~markmc/qcow-image-format.html + * + * Copyright (C) 2010 Red Hat, Inc., Lukas Czerner + * + * %Begin-Header% + * This file may be redistributed under the terms of the GNU Public + * License. + * %End-Header% + */ + +/* Number of l2 tables in memory before writeback */ +#define L2_CACHE_PREALLOC 512 + + +#define QCOW_MAGIC (('Q' << 24) | ('F' << 16) | ('I' << 8) | 0xfb) +#define QCOW_VERSION 2 +#define QCOW_OFLAG_COPIED (1LL << 63) +#define QCOW_OFLAG_COMPRESSED (1LL << 62) + +#define QCOW_COMPRESSED 1 +#define QCOW_ENCRYPTED 2 + +struct ext2_qcow2_hdr { + __u32 magic; + __u32 version; + + __u64 backing_file_offset; + __u32 backing_file_size; + + __u32 cluster_bits; + __u64 size; + __u32 crypt_method; + + __u32 l1_size; + __u64 l1_table_offset; + + __u64 refcount_table_offset; + __u32 refcount_table_clusters; + + __u32 nb_snapshots; + __u64 snapshots_offset; +}; + +typedef struct ext2_qcow2_l2_table L2_CACHE_HEAD; + +struct ext2_qcow2_l2_table { + __u32 l1_index; + __u64 offset; + __u64 *data; + L2_CACHE_HEAD *next; +}; + +struct ext2_qcow2_l2_cache { + L2_CACHE_HEAD *used_head; + L2_CACHE_HEAD *used_tail; + L2_CACHE_HEAD *free_head; + __u32 free; + __u32 count; + __u64 next_offset; +}; + +struct ext2_qcow2_refcount { + __u64 *refcount_table; + __u64 refcount_table_offset; + __u64 refcount_block_offset; + + __u32 refcount_table_clusters; + __u32 refcount_table_index; + __u32 refcount_block_index; + + __u16 *refcount_block; +}; + +struct ext2_qcow2_image { + int fd; + struct ext2_qcow2_hdr *hdr; + struct ext2_qcow2_l2_cache *l2_cache; + struct ext2_qcow2_refcount refcount; + __u32 cluster_size; + __u32 cluster_bits; + __u32 l1_size; + __u32 l2_size; + + __u64 *l1_table; + __u64 l2_offset; + __u64 l1_offset; + __u64 image_size; +}; + +/* Function prototypes */ + +/* qcow2.c */ + +/* Functions for converting qcow2 image into raw image */ +struct ext2_qcow2_hdr *qcow2_read_header(int); +int qcow2_write_raw_image(int, int, struct ext2_qcow2_hdr *); + diff --git a/dingux/opt/mipsel-linux-uclibc/include/ext2fs/tdb.h b/dingux/opt/mipsel-linux-uclibc/include/ext2fs/tdb.h new file mode 100644 index 0000000..6a4086c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ext2fs/tdb.h @@ -0,0 +1,215 @@ +#ifndef __TDB_H__ +#define __TDB_H__ + +/* + Unix SMB/CIFS implementation. + + trivial database library + + Copyright (C) Andrew Tridgell 1999-2004 + + ** NOTE! The following LGPL license applies to the tdb + ** library. This does NOT imply that all of Samba is released + ** under the LGPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifdef __cplusplus +extern "C" { +#endif + + +/* flags to tdb_store() */ +#define TDB_REPLACE 1 +#define TDB_INSERT 2 +#define TDB_MODIFY 3 + +/* flags for tdb_open() */ +#define TDB_DEFAULT 0 /* just a readability place holder */ +#define TDB_CLEAR_IF_FIRST 1 +#define TDB_INTERNAL 2 /* don't store on disk */ +#define TDB_NOLOCK 4 /* don't do any locking */ +#define TDB_NOMMAP 8 /* don't use mmap */ +#define TDB_CONVERT 16 /* convert endian (internal use) */ +#define TDB_BIGENDIAN 32 /* header is big-endian (internal use) */ +#define TDB_NOSYNC 64 /* don't use synchronous transactions */ +#define TDB_SEQNUM 128 /* maintain a sequence number */ + +#define TDB_ERRCODE(code, ret) ((tdb->ecode = (code)), ret) + +/* error codes */ +enum TDB_ERROR {TDB_SUCCESS=0, TDB_ERR_CORRUPT, TDB_ERR_IO, TDB_ERR_LOCK, + TDB_ERR_OOM, TDB_ERR_EXISTS, TDB_ERR_NOLOCK, TDB_ERR_LOCK_TIMEOUT, + TDB_ERR_NOEXIST, TDB_ERR_EINVAL, TDB_ERR_RDONLY}; + +/* debugging uses one of the following levels */ +enum tdb_debug_level {TDB_DEBUG_FATAL = 0, TDB_DEBUG_ERROR, + TDB_DEBUG_WARNING, TDB_DEBUG_TRACE}; + +typedef struct TDB_DATA { + unsigned char *dptr; + size_t dsize; +} TDB_DATA; + +#ifndef PRINTF_ATTRIBUTE +#if (__GNUC__ >= 3) +/** Use gcc attribute to check printf fns. a1 is the 1-based index of + * the parameter containing the format, and a2 the index of the first + * argument. Note that some gcc 2.x versions don't handle this + * properly **/ +#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2))) +#else +#define PRINTF_ATTRIBUTE(a1, a2) +#endif +#endif + +/* ext2fs tdb renames */ +#define tdb_open ext2fs_tdb_open +#define tdb_open_ex ext2fs_tdb_open_ex +#define tdb_set_max_dead ext2fs_tdb_set_max_dead +#define tdb_reopen ext2fs_tdb_reopen +#define tdb_reopen_all ext2fs_tdb_reopen_all +#define tdb_set_logging_function ext2fs_tdb_set_logging_function +#define tdb_error ext2fs_tdb_error +#define tdb_errorstr ext2fs_tdb_errorstr +#define tdb_fetch ext2fs_tdb_fetch +#define tdb_parse_record ext2fs_tdb_parse_record +#define tdb_delete ext2fs_tdb_delete +#define tdb_store ext2fs_tdb_store +#define tdb_append ext2fs_tdb_append +#define tdb_close ext2fs_tdb_close +#define tdb_firstkey ext2fs_tdb_firstkey +#define tdb_nextkey ext2fs_tdb_nextkey +#define tdb_traverse ext2fs_tdb_traverse +#define tdb_traverse_read ext2fs_tdb_traverse_read +#define tdb_exists ext2fs_tdb_exists +#define tdb_lockall ext2fs_tdb_lockall +#define tdb_unlockall ext2fs_tdb_unlockall +#define tdb_lockall_read ext2fs_tdb_lockall_read +#define tdb_unlockall_read ext2fs_tdb_unlockall_read +#define tdb_name ext2fs_tdb_name +#define tdb_fd ext2fs_tdb_fd +#define tdb_log_fn ext2fs_tdb_log_fn +#define tdb_get_logging_private ext2fs_tdb_get_logging_private +#define tdb_transaction_start ext2fs_tdb_transaction_start +#define tdb_transaction_commit ext2fs_tdb_transaction_commit +#define tdb_transaction_cancel ext2fs_tdb_transaction_cancel +#define tdb_transaction_recover ext2fs_tdb_transaction_recover +#define tdb_get_seqnum ext2fs_tdb_get_seqnum +#define tdb_hash_size ext2fs_tdb_hash_size +#define tdb_map_size ext2fs_tdb_map_size +#define tdb_get_flags ext2fs_tdb_get_flags +#define tdb_chainlock ext2fs_tdb_chainlock +#define tdb_chainunlock ext2fs_tdb_chainunlock +#define tdb_chainlock_read ext2fs_tdb_chainlock_read +#define tdb_chainunlock_read ext2fs_tdb_chainunlock_read +#define tdb_dump_all ext2fs_tdb_dump_all +#define tdb_printfreelist ext2fs_tdb_printfreelist +#define tdb_validate_freelist ext2fs_tdb_validate_freelist +#define tdb_chainlock_mark ext2fs_tdb_chainlock_mark +#define tdb_chainlock_nonblock ext2fs_tdb_chainlock_nonblock +#define tdb_chainlock_unmark ext2fs_tdb_chainlock_unmark +#define tdb_enable_seqnum ext2fs_tdb_enable_seqnum +#define tdb_increment_seqnum_nonblock ext2fs_tdb_increment_seqnum_nonblock +#define tdb_lock_nonblock ext2fs_tdb_lock_nonblock +#define tdb_lockall_mark ext2fs_tdb_lockall_mark +#define tdb_lockall_nonblock ext2fs_tdb_lockall_nonblock +#define tdb_lockall_read_nonblock ext2fs_tdb_lockall_read_nonblock +#define tdb_lockall_unmark ext2fs_tdb_lockall_unmark +#define tdb_flush ext2fs_tdb_flush + +/* this is the context structure that is returned from a db open */ +typedef struct tdb_context TDB_CONTEXT; + +typedef int (*tdb_traverse_func)(struct tdb_context *, TDB_DATA, TDB_DATA, void *); +typedef void (*tdb_log_func)(struct tdb_context *, enum tdb_debug_level, const char *, ...) PRINTF_ATTRIBUTE(3, 4); +typedef unsigned int (*tdb_hash_func)(TDB_DATA *key); + +struct tdb_logging_context { + tdb_log_func log_fn; + void *log_private; +}; + +struct tdb_context *tdb_open(const char *name, int hash_size, int tdb_flags, + int open_flags, mode_t mode); +struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, + int open_flags, mode_t mode, + const struct tdb_logging_context *log_ctx, + tdb_hash_func hash_fn); +void tdb_set_max_dead(struct tdb_context *tdb, int max_dead); + +int tdb_reopen(struct tdb_context *tdb); +int tdb_reopen_all(int parent_longlived); +void tdb_set_logging_function(struct tdb_context *tdb, const struct tdb_logging_context *log_ctx); +enum TDB_ERROR tdb_error(struct tdb_context *tdb); +const char *tdb_errorstr(struct tdb_context *tdb); +TDB_DATA tdb_fetch(struct tdb_context *tdb, TDB_DATA key); +int tdb_parse_record(struct tdb_context *tdb, TDB_DATA key, + int (*parser)(TDB_DATA key, TDB_DATA data, + void *private_data), + void *private_data); +int tdb_delete(struct tdb_context *tdb, TDB_DATA key); +int tdb_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, int flag); +int tdb_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf); +int tdb_close(struct tdb_context *tdb); +TDB_DATA tdb_firstkey(struct tdb_context *tdb); +TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA key); +int tdb_traverse(struct tdb_context *tdb, tdb_traverse_func fn, void *); +int tdb_traverse_read(struct tdb_context *tdb, tdb_traverse_func fn, void *); +int tdb_exists(struct tdb_context *tdb, TDB_DATA key); +int tdb_lockall(struct tdb_context *tdb); +int tdb_lockall_nonblock(struct tdb_context *tdb); +int tdb_unlockall(struct tdb_context *tdb); +int tdb_lockall_read(struct tdb_context *tdb); +int tdb_lockall_read_nonblock(struct tdb_context *tdb); +int tdb_unlockall_read(struct tdb_context *tdb); +int tdb_lockall_mark(struct tdb_context *tdb); +int tdb_lockall_unmark(struct tdb_context *tdb); +const char *tdb_name(struct tdb_context *tdb); +int tdb_fd(struct tdb_context *tdb); +tdb_log_func tdb_log_fn(struct tdb_context *tdb); +void *tdb_get_logging_private(struct tdb_context *tdb); +int tdb_transaction_start(struct tdb_context *tdb); +int tdb_transaction_commit(struct tdb_context *tdb); +int tdb_transaction_cancel(struct tdb_context *tdb); +int tdb_transaction_recover(struct tdb_context *tdb); +int tdb_get_seqnum(struct tdb_context *tdb); +int tdb_hash_size(struct tdb_context *tdb); +size_t tdb_map_size(struct tdb_context *tdb); +int tdb_get_flags(struct tdb_context *tdb); +void tdb_enable_seqnum(struct tdb_context *tdb); +void tdb_increment_seqnum_nonblock(struct tdb_context *tdb); +int tdb_flush(struct tdb_context *tdb); + +/* Low level locking functions: use with care */ +int tdb_chainlock(struct tdb_context *tdb, TDB_DATA key); +int tdb_chainlock_nonblock(struct tdb_context *tdb, TDB_DATA key); +int tdb_chainunlock(struct tdb_context *tdb, TDB_DATA key); +int tdb_chainlock_read(struct tdb_context *tdb, TDB_DATA key); +int tdb_chainunlock_read(struct tdb_context *tdb, TDB_DATA key); +int tdb_chainlock_mark(struct tdb_context *tdb, TDB_DATA key); +int tdb_chainlock_unmark(struct tdb_context *tdb, TDB_DATA key); + +/* Debug functions. Not used in production. */ +void tdb_dump_all(struct tdb_context *tdb); +int tdb_printfreelist(struct tdb_context *tdb); +int tdb_validate_freelist(struct tdb_context *tdb, int *pnum_entries); + +#ifdef __cplusplus +} +#endif + +#endif /* tdb.h */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/gdb/jit-reader.h b/dingux/opt/mipsel-linux-uclibc/include/gdb/jit-reader.h new file mode 100644 index 0000000..777d0d7 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/gdb/jit-reader.h @@ -0,0 +1,346 @@ +/* JIT declarations for GDB, the GNU Debugger. + + Copyright (C) 2011-2016 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef GDB_JIT_READER_H +#define GDB_JIT_READER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Versioning information. See gdb_reader_funcs. */ + +#define GDB_READER_INTERFACE_VERSION 1 + +/* Readers must be released under a GPL compatible license. To + declare that the reader is indeed released under a GPL compatible + license, invoke the macro GDB_DECLARE_GPL_COMPATIBLE in a source + file. */ + +#ifdef __cplusplus +#define GDB_DECLARE_GPL_COMPATIBLE_READER \ + extern "C" { \ + extern int plugin_is_GPL_compatible (void); \ + extern int plugin_is_GPL_compatible (void) \ + { \ + return 0; \ + } \ + } + +#else + +#define GDB_DECLARE_GPL_COMPATIBLE_READER \ + extern int plugin_is_GPL_compatible (void); \ + extern int plugin_is_GPL_compatible (void) \ + { \ + return 0; \ + } + +#endif + +/* Represents an address on the target system. */ + +typedef unsigned long GDB_CORE_ADDR; + +/* Return status codes. */ + +enum gdb_status { + GDB_FAIL = 0, + GDB_SUCCESS = 1 +}; + +struct gdb_object; +struct gdb_symtab; +struct gdb_block; +struct gdb_symbol_callbacks; + +/* An array of these are used to represent a map from code addresses to line + numbers in the source file. */ + +struct gdb_line_mapping +{ + int line; + GDB_CORE_ADDR pc; +}; + +/* Create a new GDB code object. Each code object can have one or + more symbol tables, each representing a compiled source file. */ + +typedef struct gdb_object *(gdb_object_open) (struct gdb_symbol_callbacks *cb); + +/* The callback used to create new symbol table. CB is the + gdb_symbol_callbacks which the structure is part of. FILE_NAME is + an (optionally NULL) file name to associate with this new symbol + table. + + Returns a new instance to gdb_symtab that can later be passed to + gdb_block_new, gdb_symtab_add_line_mapping and gdb_symtab_close. */ + +typedef struct gdb_symtab *(gdb_symtab_open) (struct gdb_symbol_callbacks *cb, + struct gdb_object *obj, + const char *file_name); + +/* Creates a new block in a given symbol table. A symbol table is a + forest of blocks, each block representing an code address range and + a corresponding (optionally NULL) NAME. In case the block + corresponds to a function, the NAME passed should be the name of + the function. + + If the new block to be created is a child of (i.e. is nested in) + another block, the parent block can be passed in PARENT. SYMTAB is + the symbol table the new block is to belong in. BEGIN, END is the + code address range the block corresponds to. + + Returns a new instance of gdb_block, which, as of now, has no use. + Note that the gdb_block returned must not be freed by the + caller. */ + +typedef struct gdb_block *(gdb_block_open) (struct gdb_symbol_callbacks *cb, + struct gdb_symtab *symtab, + struct gdb_block *parent, + GDB_CORE_ADDR begin, + GDB_CORE_ADDR end, + const char *name); + +/* Adds a PC to line number mapping for the symbol table SYMTAB. + NLINES is the number of elements in LINES, each element + corresponding to one (PC, line) pair. */ + +typedef void (gdb_symtab_add_line_mapping) (struct gdb_symbol_callbacks *cb, + struct gdb_symtab *symtab, + int nlines, + struct gdb_line_mapping *lines); + +/* Close the symtab SYMTAB. This signals to GDB that no more blocks + will be opened on this symtab. */ + +typedef void (gdb_symtab_close) (struct gdb_symbol_callbacks *cb, + struct gdb_symtab *symtab); + + +/* Closes the gdb_object OBJ and adds the emitted information into + GDB's internal structures. Once this is done, the debug + information will be picked up and used; this will usually be the + last operation in gdb_read_debug_info. */ + +typedef void (gdb_object_close) (struct gdb_symbol_callbacks *cb, + struct gdb_object *obj); + +/* Reads LEN bytes from TARGET_MEM in the target's virtual address + space into GDB_BUF. + + Returns GDB_FAIL on failure, and GDB_SUCCESS on success. */ + +typedef enum gdb_status (gdb_target_read) (GDB_CORE_ADDR target_mem, + void *gdb_buf, int len); + +/* The list of callbacks that are passed to read. These callbacks are + to be used to construct the symbol table. The functions have been + described above. */ + +struct gdb_symbol_callbacks +{ + gdb_object_open *object_open; + gdb_symtab_open *symtab_open; + gdb_block_open *block_open; + gdb_symtab_close *symtab_close; + gdb_object_close *object_close; + + gdb_symtab_add_line_mapping *line_mapping_add; + gdb_target_read *target_read; + + /* For internal use by GDB. */ + void *priv_data; +}; + +/* Forward declaration. */ + +struct gdb_reg_value; + +/* A function of this type is used to free a gdb_reg_value. See the + comment on `free' in struct gdb_reg_value. */ + +typedef void (gdb_reg_value_free) (struct gdb_reg_value *); + +/* Denotes the value of a register. */ + +struct gdb_reg_value +{ + /* The size of the register in bytes. The reader need not set this + field. This will be set for (defined) register values being read + from GDB using reg_get. */ + int size; + + /* Set to non-zero if the value for the register is known. The + registers for which the reader does not call reg_set are also + assumed to be undefined */ + int defined; + + /* Since gdb_reg_value is a variable sized structure, it will + usually be allocated on the heap. This function is expected to + contain the corresponding "free" function. + + When a pointer to gdb_reg_value is being sent from GDB to the + reader (via gdb_unwind_reg_get), the reader is expected to call + this function (with the same gdb_reg_value as argument) once it + is done with the value. + + When the function sends the a gdb_reg_value to GDB (via + gdb_unwind_reg_set), it is expected to set this field to point to + an appropriate cleanup routine (or to NULL if no cleanup is + required). */ + gdb_reg_value_free *free; + + /* The value of the register. */ + unsigned char value[1]; +}; + +/* get_frame_id in gdb_reader_funcs is to return a gdb_frame_id + corresponding to the current frame. The registers corresponding to + the current frame can be read using reg_get. Calling get_frame_id + on a particular frame should return the same gdb_frame_id + throughout its lifetime (i.e. till before it gets unwound). One + way to do this is by having the CODE_ADDRESS point to the + function's first instruction and STACK_ADDRESS point to the value + of the stack pointer when entering the function. */ + +struct gdb_frame_id +{ + GDB_CORE_ADDR code_address; + GDB_CORE_ADDR stack_address; +}; + +/* Forward declaration. */ + +struct gdb_unwind_callbacks; + +/* Returns the value of a particular register in the current frame. + The current frame is the frame that needs to be unwound into the + outer (earlier) frame. + + CB is the struct gdb_unwind_callbacks * the callback belongs to. + REGNUM is the DWARF register number of the register that needs to + be unwound. + + Returns the gdb_reg_value corresponding to the register requested. + In case the value of the register has been optimized away or + otherwise unavailable, the defined flag in the returned + gdb_reg_value will be zero. */ + +typedef struct gdb_reg_value *(gdb_unwind_reg_get) + (struct gdb_unwind_callbacks *cb, int regnum); + +/* Sets the previous value of a particular register. REGNUM is the + (DWARF) register number whose value is to be set. VAL is the value + the register is to be set to. + + VAL is *not* copied, so the memory allocated to it cannot be + reused. Once GDB no longer needs the value, it is deallocated + using the FREE function (see gdb_reg_value). + + A register can also be "set" to an undefined value by setting the + defined in VAL to zero. */ + +typedef void (gdb_unwind_reg_set) (struct gdb_unwind_callbacks *cb, int regnum, + struct gdb_reg_value *val); + +/* This struct is passed to unwind in gdb_reader_funcs, and is to be + used to unwind the current frame (current being the frame whose + registers can be read using reg_get) into the earlier frame. The + functions have been described above. */ + +struct gdb_unwind_callbacks +{ + gdb_unwind_reg_get *reg_get; + gdb_unwind_reg_set *reg_set; + gdb_target_read *target_read; + + /* For internal use by GDB. */ + void *priv_data; +}; + +/* Forward declaration. */ + +struct gdb_reader_funcs; + +/* Parse the debug info off a block of memory, pointed to by MEMORY + (already copied to GDB's address space) and MEMORY_SZ bytes long. + The implementation has to use the functions in CB to actually emit + the parsed data into GDB. SELF is the same structure returned by + gdb_init_reader. + + Return GDB_FAIL on failure and GDB_SUCCESS on success. */ + +typedef enum gdb_status (gdb_read_debug_info) (struct gdb_reader_funcs *self, + struct gdb_symbol_callbacks *cb, + void *memory, long memory_sz); + +/* Unwind the current frame, CB is the set of unwind callbacks that + are to be used to do this. + + Return GDB_FAIL on failure and GDB_SUCCESS on success. */ + +typedef enum gdb_status (gdb_unwind_frame) (struct gdb_reader_funcs *self, + struct gdb_unwind_callbacks *cb); + +/* Return the frame ID corresponding to the current frame, using C to + read the current register values. See the comment on struct + gdb_frame_id. */ + +typedef struct gdb_frame_id (gdb_get_frame_id) (struct gdb_reader_funcs *self, + struct gdb_unwind_callbacks *c); + +/* Called when a reader is being unloaded. This function should also + free SELF, if required. */ + +typedef void (gdb_destroy_reader) (struct gdb_reader_funcs *self); + +/* Called when the reader is loaded. Must either return a properly + populated gdb_reader_funcs or NULL. The memory allocated for the + gdb_reader_funcs is to be managed by the reader itself (i.e. if it + is allocated from the heap, it must also be freed in + gdb_destroy_reader). */ + +extern struct gdb_reader_funcs *gdb_init_reader (void); + +/* Pointer to the functions which implement the reader's + functionality. The individual functions have been documented + above. + + None of the fields are optional. */ + +struct gdb_reader_funcs +{ + /* Must be set to GDB_READER_INTERFACE_VERSION. */ + int reader_version; + + /* For use by the reader. */ + void *priv_data; + + gdb_read_debug_info *read; + gdb_unwind_frame *unwind; + gdb_get_frame_id *get_frame_id; + gdb_destroy_reader *destroy; +}; + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/gettext-po.h b/dingux/opt/mipsel-linux-uclibc/include/gettext-po.h new file mode 100644 index 0000000..a42ae22 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/gettext-po.h @@ -0,0 +1,357 @@ +/* Public API for GNU gettext PO files - contained in libgettextpo. + Copyright (C) 2003-2008, 2010, 2015-2016 Free Software Foundation, Inc. + Written by Bruno Haible , 2003. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef _GETTEXT_PO_H +#define _GETTEXT_PO_H 1 + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* =========================== Meta Information ============================ */ + +/* Version number: (major<<16) + (minor<<8) + subminor */ +#define LIBGETTEXTPO_VERSION 0x001308 +extern int libgettextpo_version; + +/* ================================= Types ================================= */ + +/* A po_file_t represents the contents of a PO file. */ +typedef struct po_file *po_file_t; + +/* A po_message_iterator_t represents an iterator through a domain of a + PO file. */ +typedef struct po_message_iterator *po_message_iterator_t; + +/* A po_message_t represents a message in a PO file. */ +typedef struct po_message *po_message_t; + +/* A po_filepos_t represents a string's position within a source file. */ +typedef struct po_filepos *po_filepos_t; + +/* A po_error_handler handles error situations. */ +struct po_error_handler +{ + /* Signal an error. The error message is built from FORMAT and the following + arguments. ERRNUM, if nonzero, is an errno value. + Must increment the error_message_count variable declared in error.h. + Must not return if STATUS is nonzero. */ + void (*error) (int status, int errnum, + const char *format, ...) +#if ((__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || __GNUC__ > 3) && !__STRICT_ANSI__ + __attribute__ ((__format__ (__printf__, 3, 4))) +#endif + ; + + /* Signal an error. The error message is built from FORMAT and the following + arguments. The error location is at FILENAME line LINENO. ERRNUM, if + nonzero, is an errno value. + Must increment the error_message_count variable declared in error.h. + Must not return if STATUS is nonzero. */ + void (*error_at_line) (int status, int errnum, + const char *filename, unsigned int lineno, + const char *format, ...) +#if ((__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || __GNUC__ > 3) && !__STRICT_ANSI__ + __attribute__ ((__format__ (__printf__, 5, 6))) +#endif + ; + + /* Signal a multiline warning. The PREFIX applies to all lines of the + MESSAGE. Free the PREFIX and MESSAGE when done. */ + void (*multiline_warning) (char *prefix, char *message); + + /* Signal a multiline error. The PREFIX applies to all lines of the + MESSAGE. Free the PREFIX and MESSAGE when done. + Must increment the error_message_count variable declared in error.h if + PREFIX is non-NULL. */ + void (*multiline_error) (char *prefix, char *message); +}; +typedef const struct po_error_handler *po_error_handler_t; + +/* A po_xerror_handler handles warnings, error and fatal error situations. */ +#define PO_SEVERITY_WARNING 0 /* just a warning, tell the user */ +#define PO_SEVERITY_ERROR 1 /* an error, the operation cannot complete */ +#define PO_SEVERITY_FATAL_ERROR 2 /* an error, the operation must be aborted */ +struct po_xerror_handler +{ + /* Signal a problem of the given severity. + MESSAGE and/or FILENAME + LINENO indicate where the problem occurred. + If FILENAME is NULL, FILENAME and LINENO and COLUMN should be ignored. + If LINENO is (size_t)(-1), LINENO and COLUMN should be ignored. + If COLUMN is (size_t)(-1), it should be ignored. + MESSAGE_TEXT is the problem description (if MULTILINE_P is true, + multiple lines of text, each terminated with a newline, otherwise + usually a single line). + Must not return if SEVERITY is PO_SEVERITY_FATAL_ERROR. */ + void (*xerror) (int severity, + po_message_t message, + const char *filename, size_t lineno, size_t column, + int multiline_p, const char *message_text); + /* Signal a problem that refers to two messages. + Similar to two calls to xerror. + If possible, a "..." can be appended to MESSAGE_TEXT1 and prepended to + MESSAGE_TEXT2. */ + void (*xerror2) (int severity, + po_message_t message1, + const char *filename1, size_t lineno1, size_t column1, + int multiline_p1, const char *message_text1, + po_message_t message2, + const char *filename2, size_t lineno2, size_t column2, + int multiline_p2, const char *message_text2); +}; +typedef const struct po_xerror_handler *po_xerror_handler_t; + +/* Memory allocation: + The memory allocations performed by these functions use xmalloc(), + therefore will cause a program exit if memory is exhausted. + The memory allocated by po_file_read, and implicitly returned through + the po_message_* functions, lasts until freed with po_file_free. */ + + +/* ============================= po_file_t API ============================= */ + +/* Create an empty PO file representation in memory. */ +extern po_file_t po_file_create (void); + +/* Read a PO file into memory. + Return its contents. Upon failure, return NULL and set errno. */ +#define po_file_read po_file_read_v3 +extern po_file_t po_file_read (const char *filename, + po_xerror_handler_t handler); + +/* Write an in-memory PO file to a file. + Upon failure, return NULL and set errno. */ +#define po_file_write po_file_write_v2 +extern po_file_t po_file_write (po_file_t file, const char *filename, + po_xerror_handler_t handler); + +/* Free a PO file from memory. */ +extern void po_file_free (po_file_t file); + +/* Return the names of the domains covered by a PO file in memory. */ +extern const char * const * po_file_domains (po_file_t file); + + +/* =========================== Header entry API ============================ */ + +/* Return the header entry of a domain of a PO file in memory. + The domain NULL denotes the default domain. + Return NULL if there is no header entry. */ +extern const char * po_file_domain_header (po_file_t file, const char *domain); + +/* Return the value of a field in a header entry. + The return value is either a freshly allocated string, to be freed by the + caller, or NULL. */ +extern char * po_header_field (const char *header, const char *field); + +/* Return the header entry with a given field set to a given value. The field + is added if necessary. + The return value is a freshly allocated string. */ +extern char * po_header_set_field (const char *header, const char *field, const char *value); + + +/* ======================= po_message_iterator_t API ======================= */ + +/* Create an iterator for traversing a domain of a PO file in memory. + The domain NULL denotes the default domain. */ +extern po_message_iterator_t po_message_iterator (po_file_t file, const char *domain); + +/* Free an iterator. */ +extern void po_message_iterator_free (po_message_iterator_t iterator); + +/* Return the next message, and advance the iterator. + Return NULL at the end of the message list. */ +extern po_message_t po_next_message (po_message_iterator_t iterator); + +/* Insert a message in a PO file in memory, in the domain and at the position + indicated by the iterator. The iterator thereby advances past the freshly + inserted message. */ +extern void po_message_insert (po_message_iterator_t iterator, po_message_t message); + + +/* =========================== po_message_t API ============================ */ + +/* Return a freshly constructed message. + To finish initializing the message, you must set the msgid and msgstr. */ +extern po_message_t po_message_create (void); + +/* Return the context of a message, or NULL for a message not restricted to a + context. */ +extern const char * po_message_msgctxt (po_message_t message); + +/* Change the context of a message. NULL means a message not restricted to a + context. */ +extern void po_message_set_msgctxt (po_message_t message, const char *msgctxt); + +/* Return the msgid (untranslated English string) of a message. */ +extern const char * po_message_msgid (po_message_t message); + +/* Change the msgid (untranslated English string) of a message. */ +extern void po_message_set_msgid (po_message_t message, const char *msgid); + +/* Return the msgid_plural (untranslated English plural string) of a message, + or NULL for a message without plural. */ +extern const char * po_message_msgid_plural (po_message_t message); + +/* Change the msgid_plural (untranslated English plural string) of a message. + NULL means a message without plural. */ +extern void po_message_set_msgid_plural (po_message_t message, const char *msgid_plural); + +/* Return the msgstr (translation) of a message. + Return the empty string for an untranslated message. */ +extern const char * po_message_msgstr (po_message_t message); + +/* Change the msgstr (translation) of a message. + Use an empty string to denote an untranslated message. */ +extern void po_message_set_msgstr (po_message_t message, const char *msgstr); + +/* Return the msgstr[index] for a message with plural handling, or + NULL when the index is out of range or for a message without plural. */ +extern const char * po_message_msgstr_plural (po_message_t message, int index); + +/* Change the msgstr[index] for a message with plural handling. + Use a NULL value at the end to reduce the number of plural forms. */ +extern void po_message_set_msgstr_plural (po_message_t message, int index, const char *msgstr); + +/* Return the comments for a message. */ +extern const char * po_message_comments (po_message_t message); + +/* Change the comments for a message. + comments should be a multiline string, ending in a newline, or empty. */ +extern void po_message_set_comments (po_message_t message, const char *comments); + +/* Return the extracted comments for a message. */ +extern const char * po_message_extracted_comments (po_message_t message); + +/* Change the extracted comments for a message. + comments should be a multiline string, ending in a newline, or empty. */ +extern void po_message_set_extracted_comments (po_message_t message, const char *comments); + +/* Return the i-th file position for a message, or NULL if i is out of + range. */ +extern po_filepos_t po_message_filepos (po_message_t message, int i); + +/* Remove the i-th file position from a message. + The indices of all following file positions for the message are decremented + by one. */ +extern void po_message_remove_filepos (po_message_t message, int i); + +/* Add a file position to a message, if it is not already present for the + message. + file is the file name. + start_line is the line number where the string starts, or (size_t)(-1) if no + line number is available. */ +extern void po_message_add_filepos (po_message_t message, const char *file, size_t start_line); + +/* Return the previous context of a message, or NULL for none. */ +extern const char * po_message_prev_msgctxt (po_message_t message); + +/* Change the previous context of a message. NULL is allowed. */ +extern void po_message_set_prev_msgctxt (po_message_t message, const char *prev_msgctxt); + +/* Return the previous msgid (untranslated English string) of a message, or + NULL for none. */ +extern const char * po_message_prev_msgid (po_message_t message); + +/* Change the previous msgid (untranslated English string) of a message. + NULL is allowed. */ +extern void po_message_set_prev_msgid (po_message_t message, const char *prev_msgid); + +/* Return the previous msgid_plural (untranslated English plural string) of a + message, or NULL for none. */ +extern const char * po_message_prev_msgid_plural (po_message_t message); + +/* Change the previous msgid_plural (untranslated English plural string) of a + message. NULL is allowed. */ +extern void po_message_set_prev_msgid_plural (po_message_t message, const char *prev_msgid_plural); + +/* Return true if the message is marked obsolete. */ +extern int po_message_is_obsolete (po_message_t message); + +/* Change the obsolete mark of a message. */ +extern void po_message_set_obsolete (po_message_t message, int obsolete); + +/* Return true if the message is marked fuzzy. */ +extern int po_message_is_fuzzy (po_message_t message); + +/* Change the fuzzy mark of a message. */ +extern void po_message_set_fuzzy (po_message_t message, int fuzzy); + +/* Return true if the message is marked as being a format string of the given + type (e.g. "c-format"). */ +extern int po_message_is_format (po_message_t message, const char *format_type); + +/* Change the format string mark for a given type of a message. */ +extern void po_message_set_format (po_message_t message, const char *format_type, /*bool*/int value); + +/* If a numeric range of a message is set, return true and store the minimum + and maximum value in *MINP and *MAXP. */ +extern int po_message_is_range (po_message_t message, int *minp, int *maxp); + +/* Change the numeric range of a message. MIN and MAX must be non-negative, + with MIN < MAX. Use MIN = MAX = -1 to remove the numeric range of a + message. */ +extern void po_message_set_range (po_message_t message, int min, int max); + + +/* =========================== po_filepos_t API ============================ */ + +/* Return the file name. */ +extern const char * po_filepos_file (po_filepos_t filepos); + +/* Return the line number where the string starts, or (size_t)(-1) if no line + number is available. */ +extern size_t po_filepos_start_line (po_filepos_t filepos); + + +/* ============================ Format type API ============================= */ + +/* Return a NULL terminated array of the supported format types. */ +extern const char * const * po_format_list (void); + +/* Return the pretty name associated with a format type. + For example, for "csharp-format", return "C#". + Return NULL if the argument is not a supported format type. */ +extern const char * po_format_pretty_name (const char *format_type); + + +/* ============================= Checking API ============================== */ + +/* Test whether an entire file PO file is valid, like msgfmt does it. + If it is invalid, pass the reasons to the handler. */ +extern void po_file_check_all (po_file_t file, po_xerror_handler_t handler); + +/* Test a single message, to be inserted in a PO file in memory, like msgfmt + does it. If it is invalid, pass the reasons to the handler. The iterator + is not modified by this call; it only specifies the file and the domain. */ +extern void po_message_check_all (po_message_t message, po_message_iterator_t iterator, po_xerror_handler_t handler); + +/* Test whether the message translation is a valid format string if the message + is marked as being a format string. If it is invalid, pass the reasons to + the handler. */ +#define po_message_check_format po_message_check_format_v2 +extern void po_message_check_format (po_message_t message, po_xerror_handler_t handler); + + +#ifdef __cplusplus +} +#endif + +#endif /* _GETTEXT_PO_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/gmp.h b/dingux/opt/mipsel-linux-uclibc/include/gmp.h new file mode 100644 index 0000000..02e95aa --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/gmp.h @@ -0,0 +1,2329 @@ +/* Definitions for GNU multiple precision functions. -*- mode: c -*- + +Copyright 1991, 1993-1997, 1999-2016 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of either: + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at your + option) any later version. + +or + + * the GNU General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any + later version. + +or both in parallel, as here. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received copies of the GNU General Public License and the +GNU Lesser General Public License along with the GNU MP Library. If not, +see https://www.gnu.org/licenses/. */ + +#ifndef __GMP_H__ + +#if defined (__cplusplus) +#include /* for std::istream, std::ostream, std::string */ +#include +#endif + + +/* Instantiated by configure. */ +#if ! defined (__GMP_WITHIN_CONFIGURE) +#define __GMP_HAVE_HOST_CPU_FAMILY_power 0 +#define __GMP_HAVE_HOST_CPU_FAMILY_powerpc 0 +#define GMP_LIMB_BITS 64 +#define GMP_NAIL_BITS 0 +#endif +#define GMP_NUMB_BITS (GMP_LIMB_BITS - GMP_NAIL_BITS) +#define GMP_NUMB_MASK ((~ __GMP_CAST (mp_limb_t, 0)) >> GMP_NAIL_BITS) +#define GMP_NUMB_MAX GMP_NUMB_MASK +#define GMP_NAIL_MASK (~ GMP_NUMB_MASK) + + +#ifndef __GNU_MP__ +#define __GNU_MP__ 6 + +#include /* for size_t */ +#include + +/* Instantiated by configure. */ +#if ! defined (__GMP_WITHIN_CONFIGURE) +/* #undef _LONG_LONG_LIMB */ +#define __GMP_LIBGMP_DLL 0 +#endif + + +/* __GMP_DECLSPEC supports Windows DLL versions of libgmp, and is empty in + all other circumstances. + + When compiling objects for libgmp, __GMP_DECLSPEC is an export directive, + or when compiling for an application it's an import directive. The two + cases are differentiated by __GMP_WITHIN_GMP defined by the GMP Makefiles + (and not defined from an application). + + __GMP_DECLSPEC_XX is similarly used for libgmpxx. __GMP_WITHIN_GMPXX + indicates when building libgmpxx, and in that case libgmpxx functions are + exports, but libgmp functions which might get called are imports. + + Libtool DLL_EXPORT define is not used. + + There's no attempt to support GMP built both static and DLL. Doing so + would mean applications would have to tell us which of the two is going + to be used when linking, and that seems very tedious and error prone if + using GMP by hand, and equally tedious from a package since autoconf and + automake don't give much help. + + __GMP_DECLSPEC is required on all documented global functions and + variables, the various internals in gmp-impl.h etc can be left unadorned. + But internals used by the test programs or speed measuring programs + should have __GMP_DECLSPEC, and certainly constants or variables must + have it or the wrong address will be resolved. + + In gcc __declspec can go at either the start or end of a prototype. + + In Microsoft C __declspec must go at the start, or after the type like + void __declspec(...) *foo()". There's no __dllexport or anything to + guard against someone foolish #defining dllexport. _export used to be + available, but no longer. + + In Borland C _export still exists, but needs to go after the type, like + "void _export foo();". Would have to change the __GMP_DECLSPEC syntax to + make use of that. Probably more trouble than it's worth. */ + +#if defined (__GNUC__) +#define __GMP_DECLSPEC_EXPORT __declspec(__dllexport__) +#define __GMP_DECLSPEC_IMPORT __declspec(__dllimport__) +#endif +#if defined (_MSC_VER) || defined (__BORLANDC__) +#define __GMP_DECLSPEC_EXPORT __declspec(dllexport) +#define __GMP_DECLSPEC_IMPORT __declspec(dllimport) +#endif +#ifdef __WATCOMC__ +#define __GMP_DECLSPEC_EXPORT __export +#define __GMP_DECLSPEC_IMPORT __import +#endif +#ifdef __IBMC__ +#define __GMP_DECLSPEC_EXPORT _Export +#define __GMP_DECLSPEC_IMPORT _Import +#endif + +#if __GMP_LIBGMP_DLL +#ifdef __GMP_WITHIN_GMP +/* compiling to go into a DLL libgmp */ +#define __GMP_DECLSPEC __GMP_DECLSPEC_EXPORT +#else +/* compiling to go into an application which will link to a DLL libgmp */ +#define __GMP_DECLSPEC __GMP_DECLSPEC_IMPORT +#endif +#else +/* all other cases */ +#define __GMP_DECLSPEC +#endif + + +#ifdef __GMP_SHORT_LIMB +typedef unsigned int mp_limb_t; +typedef int mp_limb_signed_t; +#else +#ifdef _LONG_LONG_LIMB +typedef unsigned long long int mp_limb_t; +typedef long long int mp_limb_signed_t; +#else +typedef unsigned long int mp_limb_t; +typedef long int mp_limb_signed_t; +#endif +#endif +typedef unsigned long int mp_bitcnt_t; + +/* For reference, note that the name __mpz_struct gets into C++ mangled + function names, which means although the "__" suggests an internal, we + must leave this name for binary compatibility. */ +typedef struct +{ + int _mp_alloc; /* Number of *limbs* allocated and pointed + to by the _mp_d field. */ + int _mp_size; /* abs(_mp_size) is the number of limbs the + last field points to. If _mp_size is + negative this is a negative number. */ + mp_limb_t *_mp_d; /* Pointer to the limbs. */ +} __mpz_struct; + +#endif /* __GNU_MP__ */ + + +typedef __mpz_struct MP_INT; /* gmp 1 source compatibility */ +typedef __mpz_struct mpz_t[1]; + +typedef mp_limb_t * mp_ptr; +typedef const mp_limb_t * mp_srcptr; +#if defined (_CRAY) && ! defined (_CRAYMPP) +/* plain `int' is much faster (48 bits) */ +#define __GMP_MP_SIZE_T_INT 1 +typedef int mp_size_t; +typedef int mp_exp_t; +#else +#define __GMP_MP_SIZE_T_INT 0 +typedef long int mp_size_t; +typedef long int mp_exp_t; +#endif + +typedef struct +{ + __mpz_struct _mp_num; + __mpz_struct _mp_den; +} __mpq_struct; + +typedef __mpq_struct MP_RAT; /* gmp 1 source compatibility */ +typedef __mpq_struct mpq_t[1]; + +typedef struct +{ + int _mp_prec; /* Max precision, in number of `mp_limb_t's. + Set by mpf_init and modified by + mpf_set_prec. The area pointed to by the + _mp_d field contains `prec' + 1 limbs. */ + int _mp_size; /* abs(_mp_size) is the number of limbs the + last field points to. If _mp_size is + negative this is a negative number. */ + mp_exp_t _mp_exp; /* Exponent, in the base of `mp_limb_t'. */ + mp_limb_t *_mp_d; /* Pointer to the limbs. */ +} __mpf_struct; + +/* typedef __mpf_struct MP_FLOAT; */ +typedef __mpf_struct mpf_t[1]; + +/* Available random number generation algorithms. */ +typedef enum +{ + GMP_RAND_ALG_DEFAULT = 0, + GMP_RAND_ALG_LC = GMP_RAND_ALG_DEFAULT /* Linear congruential. */ +} gmp_randalg_t; + +/* Random state struct. */ +typedef struct +{ + mpz_t _mp_seed; /* _mp_d member points to state of the generator. */ + gmp_randalg_t _mp_alg; /* Currently unused. */ + union { + void *_mp_lc; /* Pointer to function pointers structure. */ + } _mp_algdata; +} __gmp_randstate_struct; +typedef __gmp_randstate_struct gmp_randstate_t[1]; + +/* Types for function declarations in gmp files. */ +/* ??? Should not pollute user name space with these ??? */ +typedef const __mpz_struct *mpz_srcptr; +typedef __mpz_struct *mpz_ptr; +typedef const __mpf_struct *mpf_srcptr; +typedef __mpf_struct *mpf_ptr; +typedef const __mpq_struct *mpq_srcptr; +typedef __mpq_struct *mpq_ptr; + + +#if __GMP_LIBGMP_DLL +#ifdef __GMP_WITHIN_GMPXX +/* compiling to go into a DLL libgmpxx */ +#define __GMP_DECLSPEC_XX __GMP_DECLSPEC_EXPORT +#else +/* compiling to go into a application which will link to a DLL libgmpxx */ +#define __GMP_DECLSPEC_XX __GMP_DECLSPEC_IMPORT +#endif +#else +/* all other cases */ +#define __GMP_DECLSPEC_XX +#endif + + +#ifndef __MPN +#define __MPN(x) __gmpn_##x +#endif + +/* For reference, "defined(EOF)" cannot be used here. In g++ 2.95.4, + defines EOF but not FILE. */ +#if defined (FILE) \ + || defined (H_STDIO) \ + || defined (_H_STDIO) /* AIX */ \ + || defined (_STDIO_H) /* glibc, Sun, SCO */ \ + || defined (_STDIO_H_) /* BSD, OSF */ \ + || defined (__STDIO_H) /* Borland */ \ + || defined (__STDIO_H__) /* IRIX */ \ + || defined (_STDIO_INCLUDED) /* HPUX */ \ + || defined (__dj_include_stdio_h_) /* DJGPP */ \ + || defined (_FILE_DEFINED) /* Microsoft */ \ + || defined (__STDIO__) /* Apple MPW MrC */ \ + || defined (_MSL_STDIO_H) /* Metrowerks */ \ + || defined (_STDIO_H_INCLUDED) /* QNX4 */ \ + || defined (_ISO_STDIO_ISO_H) /* Sun C++ */ \ + || defined (__STDIO_LOADED) /* VMS */ \ + || defined (__DEFINED_FILE) /* musl */ +#define _GMP_H_HAVE_FILE 1 +#endif + +/* In ISO C, if a prototype involving "struct obstack *" is given without + that structure defined, then the struct is scoped down to just the + prototype, causing a conflict if it's subsequently defined for real. So + only give prototypes if we've got obstack.h. */ +#if defined (_OBSTACK_H) /* glibc */ +#define _GMP_H_HAVE_OBSTACK 1 +#endif + +/* The prototypes for gmp_vprintf etc are provided only if va_list is defined, + via an application having included . Usually va_list is a typedef + so can't be tested directly, but C99 specifies that va_start is a macro. + + will define some sort of va_list for vprintf and vfprintf, but + let's not bother trying to use that since it's not standard and since + application uses for gmp_vprintf etc will almost certainly require the + whole anyway. */ + +#ifdef va_start +#define _GMP_H_HAVE_VA_LIST 1 +#endif + +/* Test for gcc >= maj.min, as per __GNUC_PREREQ in glibc */ +#if defined (__GNUC__) && defined (__GNUC_MINOR__) +#define __GMP_GNUC_PREREQ(maj, min) \ + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) +#else +#define __GMP_GNUC_PREREQ(maj, min) 0 +#endif + +/* "pure" is in gcc 2.96 and up, see "(gcc)Function Attributes". Basically + it means a function does nothing but examine its arguments and memory + (global or via arguments) to generate a return value, but changes nothing + and has no side-effects. __GMP_NO_ATTRIBUTE_CONST_PURE lets + tune/common.c etc turn this off when trying to write timing loops. */ +#if __GMP_GNUC_PREREQ (2,96) && ! defined (__GMP_NO_ATTRIBUTE_CONST_PURE) +#define __GMP_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +#define __GMP_ATTRIBUTE_PURE +#endif + + +/* __GMP_CAST allows us to use static_cast in C++, so our macros are clean + to "g++ -Wold-style-cast". + + Casts in "extern inline" code within an extern "C" block don't induce + these warnings, so __GMP_CAST only needs to be used on documented + macros. */ + +#ifdef __cplusplus +#define __GMP_CAST(type, expr) (static_cast (expr)) +#else +#define __GMP_CAST(type, expr) ((type) (expr)) +#endif + + +/* An empty "throw ()" means the function doesn't throw any C++ exceptions, + this can save some stack frame info in applications. + + Currently it's given only on functions which never divide-by-zero etc, + don't allocate memory, and are expected to never need to allocate memory. + This leaves open the possibility of a C++ throw from a future GMP + exceptions scheme. + + mpz_set_ui etc are omitted to leave open the lazy allocation scheme + described in doc/tasks.html. mpz_get_d etc are omitted to leave open + exceptions for float overflows. + + Note that __GMP_NOTHROW must be given on any inlines the same as on their + prototypes (for g++ at least, where they're used together). Note also + that g++ 3.0 demands that __GMP_NOTHROW is before other attributes like + __GMP_ATTRIBUTE_PURE. */ + +#if defined (__cplusplus) +#define __GMP_NOTHROW throw () +#else +#define __GMP_NOTHROW +#endif + + +/* PORTME: What other compilers have a useful "extern inline"? "static + inline" would be an acceptable substitute if the compiler (or linker) + discards unused statics. */ + + /* gcc has __inline__ in all modes, including strict ansi. Give a prototype + for an inline too, so as to correctly specify "dllimport" on windows, in + case the function is called rather than inlined. + GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 + inline semantics, unless -fgnu89-inline is used. */ +#ifdef __GNUC__ +#if (defined __GNUC_STDC_INLINE__) || (__GNUC__ == 4 && __GNUC_MINOR__ == 2) \ + || (defined __GNUC_GNU_INLINE__ && defined __cplusplus) +#define __GMP_EXTERN_INLINE extern __inline__ __attribute__ ((__gnu_inline__)) +#else +#define __GMP_EXTERN_INLINE extern __inline__ +#endif +#define __GMP_INLINE_PROTOTYPES 1 +#endif + +/* DEC C (eg. version 5.9) supports "static __inline foo()", even in -std1 + strict ANSI mode. Inlining is done even when not optimizing (ie. -O0 + mode, which is the default), but an unnecessary local copy of foo is + emitted unless -O is used. "extern __inline" is accepted, but the + "extern" appears to be ignored, ie. it becomes a plain global function + but which is inlined within its file. Don't know if all old versions of + DEC C supported __inline, but as a start let's do the right thing for + current versions. */ +#ifdef __DECC +#define __GMP_EXTERN_INLINE static __inline +#endif + +/* SCO OpenUNIX 8 cc supports "static inline foo()" but not in -Xc strict + ANSI mode (__STDC__ is 1 in that mode). Inlining only actually takes + place under -O. Without -O "foo" seems to be emitted whether it's used + or not, which is wasteful. "extern inline foo()" isn't useful, the + "extern" is apparently ignored, so foo is inlined if possible but also + emitted as a global, which causes multiple definition errors when + building a shared libgmp. */ +#ifdef __SCO_VERSION__ +#if __SCO_VERSION__ > 400000000 && __STDC__ != 1 \ + && ! defined (__GMP_EXTERN_INLINE) +#define __GMP_EXTERN_INLINE static inline +#endif +#endif + +/* Microsoft's C compiler accepts __inline */ +#ifdef _MSC_VER +#define __GMP_EXTERN_INLINE __inline +#endif + +/* Recent enough Sun C compilers want "inline" */ +#if defined (__SUNPRO_C) && __SUNPRO_C >= 0x560 \ + && ! defined (__GMP_EXTERN_INLINE) +#define __GMP_EXTERN_INLINE inline +#endif + +/* Somewhat older Sun C compilers want "static inline" */ +#if defined (__SUNPRO_C) && __SUNPRO_C >= 0x540 \ + && ! defined (__GMP_EXTERN_INLINE) +#define __GMP_EXTERN_INLINE static inline +#endif + + +/* C++ always has "inline" and since it's a normal feature the linker should + discard duplicate non-inlined copies, or if it doesn't then that's a + problem for everyone, not just GMP. */ +#if defined (__cplusplus) && ! defined (__GMP_EXTERN_INLINE) +#define __GMP_EXTERN_INLINE inline +#endif + +/* Don't do any inlining within a configure run, since if the compiler ends + up emitting copies of the code into the object file it can end up + demanding the various support routines (like mpn_popcount) for linking, + making the "alloca" test and perhaps others fail. And on hppa ia64 a + pre-release gcc 3.2 was seen not respecting the "extern" in "extern + __inline__", triggering this problem too. */ +#if defined (__GMP_WITHIN_CONFIGURE) && ! __GMP_WITHIN_CONFIGURE_INLINE +#undef __GMP_EXTERN_INLINE +#endif + +/* By default, don't give a prototype when there's going to be an inline + version. Note in particular that Cray C++ objects to the combination of + prototype and inline. */ +#ifdef __GMP_EXTERN_INLINE +#ifndef __GMP_INLINE_PROTOTYPES +#define __GMP_INLINE_PROTOTYPES 0 +#endif +#else +#define __GMP_INLINE_PROTOTYPES 1 +#endif + + +#define __GMP_ABS(x) ((x) >= 0 ? (x) : -(x)) +#define __GMP_MAX(h,i) ((h) > (i) ? (h) : (i)) + + +/* __builtin_expect is in gcc 3.0, and not in 2.95. */ +#if __GMP_GNUC_PREREQ (3,0) +#define __GMP_LIKELY(cond) __builtin_expect ((cond) != 0, 1) +#define __GMP_UNLIKELY(cond) __builtin_expect ((cond) != 0, 0) +#else +#define __GMP_LIKELY(cond) (cond) +#define __GMP_UNLIKELY(cond) (cond) +#endif + +#ifdef _CRAY +#define __GMP_CRAY_Pragma(str) _Pragma (str) +#else +#define __GMP_CRAY_Pragma(str) +#endif + + +/* Allow direct user access to numerator and denominator of an mpq_t object. */ +#define mpq_numref(Q) (&((Q)->_mp_num)) +#define mpq_denref(Q) (&((Q)->_mp_den)) + + +#if defined (__cplusplus) +extern "C" { +using std::FILE; +#endif + +#define mp_set_memory_functions __gmp_set_memory_functions +__GMP_DECLSPEC void mp_set_memory_functions (void *(*) (size_t), + void *(*) (void *, size_t, size_t), + void (*) (void *, size_t)) __GMP_NOTHROW; + +#define mp_get_memory_functions __gmp_get_memory_functions +__GMP_DECLSPEC void mp_get_memory_functions (void *(**) (size_t), + void *(**) (void *, size_t, size_t), + void (**) (void *, size_t)) __GMP_NOTHROW; + +#define mp_bits_per_limb __gmp_bits_per_limb +__GMP_DECLSPEC extern const int mp_bits_per_limb; + +#define gmp_errno __gmp_errno +__GMP_DECLSPEC extern int gmp_errno; + +#define gmp_version __gmp_version +__GMP_DECLSPEC extern const char * const gmp_version; + + +/**************** Random number routines. ****************/ + +/* obsolete */ +#define gmp_randinit __gmp_randinit +__GMP_DECLSPEC void gmp_randinit (gmp_randstate_t, gmp_randalg_t, ...); + +#define gmp_randinit_default __gmp_randinit_default +__GMP_DECLSPEC void gmp_randinit_default (gmp_randstate_t); + +#define gmp_randinit_lc_2exp __gmp_randinit_lc_2exp +__GMP_DECLSPEC void gmp_randinit_lc_2exp (gmp_randstate_t, mpz_srcptr, unsigned long int, mp_bitcnt_t); + +#define gmp_randinit_lc_2exp_size __gmp_randinit_lc_2exp_size +__GMP_DECLSPEC int gmp_randinit_lc_2exp_size (gmp_randstate_t, mp_bitcnt_t); + +#define gmp_randinit_mt __gmp_randinit_mt +__GMP_DECLSPEC void gmp_randinit_mt (gmp_randstate_t); + +#define gmp_randinit_set __gmp_randinit_set +__GMP_DECLSPEC void gmp_randinit_set (gmp_randstate_t, const __gmp_randstate_struct *); + +#define gmp_randseed __gmp_randseed +__GMP_DECLSPEC void gmp_randseed (gmp_randstate_t, mpz_srcptr); + +#define gmp_randseed_ui __gmp_randseed_ui +__GMP_DECLSPEC void gmp_randseed_ui (gmp_randstate_t, unsigned long int); + +#define gmp_randclear __gmp_randclear +__GMP_DECLSPEC void gmp_randclear (gmp_randstate_t); + +#define gmp_urandomb_ui __gmp_urandomb_ui +__GMP_DECLSPEC unsigned long gmp_urandomb_ui (gmp_randstate_t, unsigned long); + +#define gmp_urandomm_ui __gmp_urandomm_ui +__GMP_DECLSPEC unsigned long gmp_urandomm_ui (gmp_randstate_t, unsigned long); + + +/**************** Formatted output routines. ****************/ + +#define gmp_asprintf __gmp_asprintf +__GMP_DECLSPEC int gmp_asprintf (char **, const char *, ...); + +#define gmp_fprintf __gmp_fprintf +#ifdef _GMP_H_HAVE_FILE +__GMP_DECLSPEC int gmp_fprintf (FILE *, const char *, ...); +#endif + +#define gmp_obstack_printf __gmp_obstack_printf +#if defined (_GMP_H_HAVE_OBSTACK) +__GMP_DECLSPEC int gmp_obstack_printf (struct obstack *, const char *, ...); +#endif + +#define gmp_obstack_vprintf __gmp_obstack_vprintf +#if defined (_GMP_H_HAVE_OBSTACK) && defined (_GMP_H_HAVE_VA_LIST) +__GMP_DECLSPEC int gmp_obstack_vprintf (struct obstack *, const char *, va_list); +#endif + +#define gmp_printf __gmp_printf +__GMP_DECLSPEC int gmp_printf (const char *, ...); + +#define gmp_snprintf __gmp_snprintf +__GMP_DECLSPEC int gmp_snprintf (char *, size_t, const char *, ...); + +#define gmp_sprintf __gmp_sprintf +__GMP_DECLSPEC int gmp_sprintf (char *, const char *, ...); + +#define gmp_vasprintf __gmp_vasprintf +#if defined (_GMP_H_HAVE_VA_LIST) +__GMP_DECLSPEC int gmp_vasprintf (char **, const char *, va_list); +#endif + +#define gmp_vfprintf __gmp_vfprintf +#if defined (_GMP_H_HAVE_FILE) && defined (_GMP_H_HAVE_VA_LIST) +__GMP_DECLSPEC int gmp_vfprintf (FILE *, const char *, va_list); +#endif + +#define gmp_vprintf __gmp_vprintf +#if defined (_GMP_H_HAVE_VA_LIST) +__GMP_DECLSPEC int gmp_vprintf (const char *, va_list); +#endif + +#define gmp_vsnprintf __gmp_vsnprintf +#if defined (_GMP_H_HAVE_VA_LIST) +__GMP_DECLSPEC int gmp_vsnprintf (char *, size_t, const char *, va_list); +#endif + +#define gmp_vsprintf __gmp_vsprintf +#if defined (_GMP_H_HAVE_VA_LIST) +__GMP_DECLSPEC int gmp_vsprintf (char *, const char *, va_list); +#endif + + +/**************** Formatted input routines. ****************/ + +#define gmp_fscanf __gmp_fscanf +#ifdef _GMP_H_HAVE_FILE +__GMP_DECLSPEC int gmp_fscanf (FILE *, const char *, ...); +#endif + +#define gmp_scanf __gmp_scanf +__GMP_DECLSPEC int gmp_scanf (const char *, ...); + +#define gmp_sscanf __gmp_sscanf +__GMP_DECLSPEC int gmp_sscanf (const char *, const char *, ...); + +#define gmp_vfscanf __gmp_vfscanf +#if defined (_GMP_H_HAVE_FILE) && defined (_GMP_H_HAVE_VA_LIST) +__GMP_DECLSPEC int gmp_vfscanf (FILE *, const char *, va_list); +#endif + +#define gmp_vscanf __gmp_vscanf +#if defined (_GMP_H_HAVE_VA_LIST) +__GMP_DECLSPEC int gmp_vscanf (const char *, va_list); +#endif + +#define gmp_vsscanf __gmp_vsscanf +#if defined (_GMP_H_HAVE_VA_LIST) +__GMP_DECLSPEC int gmp_vsscanf (const char *, const char *, va_list); +#endif + + +/**************** Integer (i.e. Z) routines. ****************/ + +#define _mpz_realloc __gmpz_realloc +#define mpz_realloc __gmpz_realloc +__GMP_DECLSPEC void *_mpz_realloc (mpz_ptr, mp_size_t); + +#define mpz_abs __gmpz_abs +#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_abs) +__GMP_DECLSPEC void mpz_abs (mpz_ptr, mpz_srcptr); +#endif + +#define mpz_add __gmpz_add +__GMP_DECLSPEC void mpz_add (mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_add_ui __gmpz_add_ui +__GMP_DECLSPEC void mpz_add_ui (mpz_ptr, mpz_srcptr, unsigned long int); + +#define mpz_addmul __gmpz_addmul +__GMP_DECLSPEC void mpz_addmul (mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_addmul_ui __gmpz_addmul_ui +__GMP_DECLSPEC void mpz_addmul_ui (mpz_ptr, mpz_srcptr, unsigned long int); + +#define mpz_and __gmpz_and +__GMP_DECLSPEC void mpz_and (mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_array_init __gmpz_array_init +__GMP_DECLSPEC void mpz_array_init (mpz_ptr, mp_size_t, mp_size_t); + +#define mpz_bin_ui __gmpz_bin_ui +__GMP_DECLSPEC void mpz_bin_ui (mpz_ptr, mpz_srcptr, unsigned long int); + +#define mpz_bin_uiui __gmpz_bin_uiui +__GMP_DECLSPEC void mpz_bin_uiui (mpz_ptr, unsigned long int, unsigned long int); + +#define mpz_cdiv_q __gmpz_cdiv_q +__GMP_DECLSPEC void mpz_cdiv_q (mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_cdiv_q_2exp __gmpz_cdiv_q_2exp +__GMP_DECLSPEC void mpz_cdiv_q_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t); + +#define mpz_cdiv_q_ui __gmpz_cdiv_q_ui +__GMP_DECLSPEC unsigned long int mpz_cdiv_q_ui (mpz_ptr, mpz_srcptr, unsigned long int); + +#define mpz_cdiv_qr __gmpz_cdiv_qr +__GMP_DECLSPEC void mpz_cdiv_qr (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_cdiv_qr_ui __gmpz_cdiv_qr_ui +__GMP_DECLSPEC unsigned long int mpz_cdiv_qr_ui (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int); + +#define mpz_cdiv_r __gmpz_cdiv_r +__GMP_DECLSPEC void mpz_cdiv_r (mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_cdiv_r_2exp __gmpz_cdiv_r_2exp +__GMP_DECLSPEC void mpz_cdiv_r_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t); + +#define mpz_cdiv_r_ui __gmpz_cdiv_r_ui +__GMP_DECLSPEC unsigned long int mpz_cdiv_r_ui (mpz_ptr, mpz_srcptr, unsigned long int); + +#define mpz_cdiv_ui __gmpz_cdiv_ui +__GMP_DECLSPEC unsigned long int mpz_cdiv_ui (mpz_srcptr, unsigned long int) __GMP_ATTRIBUTE_PURE; + +#define mpz_clear __gmpz_clear +__GMP_DECLSPEC void mpz_clear (mpz_ptr); + +#define mpz_clears __gmpz_clears +__GMP_DECLSPEC void mpz_clears (mpz_ptr, ...); + +#define mpz_clrbit __gmpz_clrbit +__GMP_DECLSPEC void mpz_clrbit (mpz_ptr, mp_bitcnt_t); + +#define mpz_cmp __gmpz_cmp +__GMP_DECLSPEC int mpz_cmp (mpz_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpz_cmp_d __gmpz_cmp_d +__GMP_DECLSPEC int mpz_cmp_d (mpz_srcptr, double) __GMP_ATTRIBUTE_PURE; + +#define _mpz_cmp_si __gmpz_cmp_si +__GMP_DECLSPEC int _mpz_cmp_si (mpz_srcptr, signed long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define _mpz_cmp_ui __gmpz_cmp_ui +__GMP_DECLSPEC int _mpz_cmp_ui (mpz_srcptr, unsigned long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpz_cmpabs __gmpz_cmpabs +__GMP_DECLSPEC int mpz_cmpabs (mpz_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpz_cmpabs_d __gmpz_cmpabs_d +__GMP_DECLSPEC int mpz_cmpabs_d (mpz_srcptr, double) __GMP_ATTRIBUTE_PURE; + +#define mpz_cmpabs_ui __gmpz_cmpabs_ui +__GMP_DECLSPEC int mpz_cmpabs_ui (mpz_srcptr, unsigned long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpz_com __gmpz_com +__GMP_DECLSPEC void mpz_com (mpz_ptr, mpz_srcptr); + +#define mpz_combit __gmpz_combit +__GMP_DECLSPEC void mpz_combit (mpz_ptr, mp_bitcnt_t); + +#define mpz_congruent_p __gmpz_congruent_p +__GMP_DECLSPEC int mpz_congruent_p (mpz_srcptr, mpz_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE; + +#define mpz_congruent_2exp_p __gmpz_congruent_2exp_p +__GMP_DECLSPEC int mpz_congruent_2exp_p (mpz_srcptr, mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpz_congruent_ui_p __gmpz_congruent_ui_p +__GMP_DECLSPEC int mpz_congruent_ui_p (mpz_srcptr, unsigned long, unsigned long) __GMP_ATTRIBUTE_PURE; + +#define mpz_divexact __gmpz_divexact +__GMP_DECLSPEC void mpz_divexact (mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_divexact_ui __gmpz_divexact_ui +__GMP_DECLSPEC void mpz_divexact_ui (mpz_ptr, mpz_srcptr, unsigned long); + +#define mpz_divisible_p __gmpz_divisible_p +__GMP_DECLSPEC int mpz_divisible_p (mpz_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE; + +#define mpz_divisible_ui_p __gmpz_divisible_ui_p +__GMP_DECLSPEC int mpz_divisible_ui_p (mpz_srcptr, unsigned long) __GMP_ATTRIBUTE_PURE; + +#define mpz_divisible_2exp_p __gmpz_divisible_2exp_p +__GMP_DECLSPEC int mpz_divisible_2exp_p (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpz_dump __gmpz_dump +__GMP_DECLSPEC void mpz_dump (mpz_srcptr); + +#define mpz_export __gmpz_export +__GMP_DECLSPEC void *mpz_export (void *, size_t *, int, size_t, int, size_t, mpz_srcptr); + +#define mpz_fac_ui __gmpz_fac_ui +__GMP_DECLSPEC void mpz_fac_ui (mpz_ptr, unsigned long int); + +#define mpz_2fac_ui __gmpz_2fac_ui +__GMP_DECLSPEC void mpz_2fac_ui (mpz_ptr, unsigned long int); + +#define mpz_mfac_uiui __gmpz_mfac_uiui +__GMP_DECLSPEC void mpz_mfac_uiui (mpz_ptr, unsigned long int, unsigned long int); + +#define mpz_primorial_ui __gmpz_primorial_ui +__GMP_DECLSPEC void mpz_primorial_ui (mpz_ptr, unsigned long int); + +#define mpz_fdiv_q __gmpz_fdiv_q +__GMP_DECLSPEC void mpz_fdiv_q (mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_fdiv_q_2exp __gmpz_fdiv_q_2exp +__GMP_DECLSPEC void mpz_fdiv_q_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t); + +#define mpz_fdiv_q_ui __gmpz_fdiv_q_ui +__GMP_DECLSPEC unsigned long int mpz_fdiv_q_ui (mpz_ptr, mpz_srcptr, unsigned long int); + +#define mpz_fdiv_qr __gmpz_fdiv_qr +__GMP_DECLSPEC void mpz_fdiv_qr (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_fdiv_qr_ui __gmpz_fdiv_qr_ui +__GMP_DECLSPEC unsigned long int mpz_fdiv_qr_ui (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int); + +#define mpz_fdiv_r __gmpz_fdiv_r +__GMP_DECLSPEC void mpz_fdiv_r (mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_fdiv_r_2exp __gmpz_fdiv_r_2exp +__GMP_DECLSPEC void mpz_fdiv_r_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t); + +#define mpz_fdiv_r_ui __gmpz_fdiv_r_ui +__GMP_DECLSPEC unsigned long int mpz_fdiv_r_ui (mpz_ptr, mpz_srcptr, unsigned long int); + +#define mpz_fdiv_ui __gmpz_fdiv_ui +__GMP_DECLSPEC unsigned long int mpz_fdiv_ui (mpz_srcptr, unsigned long int) __GMP_ATTRIBUTE_PURE; + +#define mpz_fib_ui __gmpz_fib_ui +__GMP_DECLSPEC void mpz_fib_ui (mpz_ptr, unsigned long int); + +#define mpz_fib2_ui __gmpz_fib2_ui +__GMP_DECLSPEC void mpz_fib2_ui (mpz_ptr, mpz_ptr, unsigned long int); + +#define mpz_fits_sint_p __gmpz_fits_sint_p +__GMP_DECLSPEC int mpz_fits_sint_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpz_fits_slong_p __gmpz_fits_slong_p +__GMP_DECLSPEC int mpz_fits_slong_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpz_fits_sshort_p __gmpz_fits_sshort_p +__GMP_DECLSPEC int mpz_fits_sshort_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpz_fits_uint_p __gmpz_fits_uint_p +#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_uint_p) +__GMP_DECLSPEC int mpz_fits_uint_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; +#endif + +#define mpz_fits_ulong_p __gmpz_fits_ulong_p +#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_ulong_p) +__GMP_DECLSPEC int mpz_fits_ulong_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; +#endif + +#define mpz_fits_ushort_p __gmpz_fits_ushort_p +#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_ushort_p) +__GMP_DECLSPEC int mpz_fits_ushort_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; +#endif + +#define mpz_gcd __gmpz_gcd +__GMP_DECLSPEC void mpz_gcd (mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_gcd_ui __gmpz_gcd_ui +__GMP_DECLSPEC unsigned long int mpz_gcd_ui (mpz_ptr, mpz_srcptr, unsigned long int); + +#define mpz_gcdext __gmpz_gcdext +__GMP_DECLSPEC void mpz_gcdext (mpz_ptr, mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_get_d __gmpz_get_d +__GMP_DECLSPEC double mpz_get_d (mpz_srcptr) __GMP_ATTRIBUTE_PURE; + +#define mpz_get_d_2exp __gmpz_get_d_2exp +__GMP_DECLSPEC double mpz_get_d_2exp (signed long int *, mpz_srcptr); + +#define mpz_get_si __gmpz_get_si +__GMP_DECLSPEC /* signed */ long int mpz_get_si (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpz_get_str __gmpz_get_str +__GMP_DECLSPEC char *mpz_get_str (char *, int, mpz_srcptr); + +#define mpz_get_ui __gmpz_get_ui +#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_get_ui) +__GMP_DECLSPEC unsigned long int mpz_get_ui (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; +#endif + +#define mpz_getlimbn __gmpz_getlimbn +#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_getlimbn) +__GMP_DECLSPEC mp_limb_t mpz_getlimbn (mpz_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; +#endif + +#define mpz_hamdist __gmpz_hamdist +__GMP_DECLSPEC mp_bitcnt_t mpz_hamdist (mpz_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpz_import __gmpz_import +__GMP_DECLSPEC void mpz_import (mpz_ptr, size_t, int, size_t, int, size_t, const void *); + +#define mpz_init __gmpz_init +__GMP_DECLSPEC void mpz_init (mpz_ptr); + +#define mpz_init2 __gmpz_init2 +__GMP_DECLSPEC void mpz_init2 (mpz_ptr, mp_bitcnt_t); + +#define mpz_inits __gmpz_inits +__GMP_DECLSPEC void mpz_inits (mpz_ptr, ...); + +#define mpz_init_set __gmpz_init_set +__GMP_DECLSPEC void mpz_init_set (mpz_ptr, mpz_srcptr); + +#define mpz_init_set_d __gmpz_init_set_d +__GMP_DECLSPEC void mpz_init_set_d (mpz_ptr, double); + +#define mpz_init_set_si __gmpz_init_set_si +__GMP_DECLSPEC void mpz_init_set_si (mpz_ptr, signed long int); + +#define mpz_init_set_str __gmpz_init_set_str +__GMP_DECLSPEC int mpz_init_set_str (mpz_ptr, const char *, int); + +#define mpz_init_set_ui __gmpz_init_set_ui +__GMP_DECLSPEC void mpz_init_set_ui (mpz_ptr, unsigned long int); + +#define mpz_inp_raw __gmpz_inp_raw +#ifdef _GMP_H_HAVE_FILE +__GMP_DECLSPEC size_t mpz_inp_raw (mpz_ptr, FILE *); +#endif + +#define mpz_inp_str __gmpz_inp_str +#ifdef _GMP_H_HAVE_FILE +__GMP_DECLSPEC size_t mpz_inp_str (mpz_ptr, FILE *, int); +#endif + +#define mpz_invert __gmpz_invert +__GMP_DECLSPEC int mpz_invert (mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_ior __gmpz_ior +__GMP_DECLSPEC void mpz_ior (mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_jacobi __gmpz_jacobi +__GMP_DECLSPEC int mpz_jacobi (mpz_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE; + +#define mpz_kronecker mpz_jacobi /* alias */ + +#define mpz_kronecker_si __gmpz_kronecker_si +__GMP_DECLSPEC int mpz_kronecker_si (mpz_srcptr, long) __GMP_ATTRIBUTE_PURE; + +#define mpz_kronecker_ui __gmpz_kronecker_ui +__GMP_DECLSPEC int mpz_kronecker_ui (mpz_srcptr, unsigned long) __GMP_ATTRIBUTE_PURE; + +#define mpz_si_kronecker __gmpz_si_kronecker +__GMP_DECLSPEC int mpz_si_kronecker (long, mpz_srcptr) __GMP_ATTRIBUTE_PURE; + +#define mpz_ui_kronecker __gmpz_ui_kronecker +__GMP_DECLSPEC int mpz_ui_kronecker (unsigned long, mpz_srcptr) __GMP_ATTRIBUTE_PURE; + +#define mpz_lcm __gmpz_lcm +__GMP_DECLSPEC void mpz_lcm (mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_lcm_ui __gmpz_lcm_ui +__GMP_DECLSPEC void mpz_lcm_ui (mpz_ptr, mpz_srcptr, unsigned long); + +#define mpz_legendre mpz_jacobi /* alias */ + +#define mpz_lucnum_ui __gmpz_lucnum_ui +__GMP_DECLSPEC void mpz_lucnum_ui (mpz_ptr, unsigned long int); + +#define mpz_lucnum2_ui __gmpz_lucnum2_ui +__GMP_DECLSPEC void mpz_lucnum2_ui (mpz_ptr, mpz_ptr, unsigned long int); + +#define mpz_millerrabin __gmpz_millerrabin +__GMP_DECLSPEC int mpz_millerrabin (mpz_srcptr, int) __GMP_ATTRIBUTE_PURE; + +#define mpz_mod __gmpz_mod +__GMP_DECLSPEC void mpz_mod (mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_mod_ui mpz_fdiv_r_ui /* same as fdiv_r because divisor unsigned */ + +#define mpz_mul __gmpz_mul +__GMP_DECLSPEC void mpz_mul (mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_mul_2exp __gmpz_mul_2exp +__GMP_DECLSPEC void mpz_mul_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t); + +#define mpz_mul_si __gmpz_mul_si +__GMP_DECLSPEC void mpz_mul_si (mpz_ptr, mpz_srcptr, long int); + +#define mpz_mul_ui __gmpz_mul_ui +__GMP_DECLSPEC void mpz_mul_ui (mpz_ptr, mpz_srcptr, unsigned long int); + +#define mpz_neg __gmpz_neg +#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_neg) +__GMP_DECLSPEC void mpz_neg (mpz_ptr, mpz_srcptr); +#endif + +#define mpz_nextprime __gmpz_nextprime +__GMP_DECLSPEC void mpz_nextprime (mpz_ptr, mpz_srcptr); + +#define mpz_out_raw __gmpz_out_raw +#ifdef _GMP_H_HAVE_FILE +__GMP_DECLSPEC size_t mpz_out_raw (FILE *, mpz_srcptr); +#endif + +#define mpz_out_str __gmpz_out_str +#ifdef _GMP_H_HAVE_FILE +__GMP_DECLSPEC size_t mpz_out_str (FILE *, int, mpz_srcptr); +#endif + +#define mpz_perfect_power_p __gmpz_perfect_power_p +__GMP_DECLSPEC int mpz_perfect_power_p (mpz_srcptr) __GMP_ATTRIBUTE_PURE; + +#define mpz_perfect_square_p __gmpz_perfect_square_p +#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_perfect_square_p) +__GMP_DECLSPEC int mpz_perfect_square_p (mpz_srcptr) __GMP_ATTRIBUTE_PURE; +#endif + +#define mpz_popcount __gmpz_popcount +#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_popcount) +__GMP_DECLSPEC mp_bitcnt_t mpz_popcount (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; +#endif + +#define mpz_pow_ui __gmpz_pow_ui +__GMP_DECLSPEC void mpz_pow_ui (mpz_ptr, mpz_srcptr, unsigned long int); + +#define mpz_powm __gmpz_powm +__GMP_DECLSPEC void mpz_powm (mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr); + +#define mpz_powm_sec __gmpz_powm_sec +__GMP_DECLSPEC void mpz_powm_sec (mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr); + +#define mpz_powm_ui __gmpz_powm_ui +__GMP_DECLSPEC void mpz_powm_ui (mpz_ptr, mpz_srcptr, unsigned long int, mpz_srcptr); + +#define mpz_probab_prime_p __gmpz_probab_prime_p +__GMP_DECLSPEC int mpz_probab_prime_p (mpz_srcptr, int) __GMP_ATTRIBUTE_PURE; + +#define mpz_random __gmpz_random +__GMP_DECLSPEC void mpz_random (mpz_ptr, mp_size_t); + +#define mpz_random2 __gmpz_random2 +__GMP_DECLSPEC void mpz_random2 (mpz_ptr, mp_size_t); + +#define mpz_realloc2 __gmpz_realloc2 +__GMP_DECLSPEC void mpz_realloc2 (mpz_ptr, mp_bitcnt_t); + +#define mpz_remove __gmpz_remove +__GMP_DECLSPEC mp_bitcnt_t mpz_remove (mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_root __gmpz_root +__GMP_DECLSPEC int mpz_root (mpz_ptr, mpz_srcptr, unsigned long int); + +#define mpz_rootrem __gmpz_rootrem +__GMP_DECLSPEC void mpz_rootrem (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int); + +#define mpz_rrandomb __gmpz_rrandomb +__GMP_DECLSPEC void mpz_rrandomb (mpz_ptr, gmp_randstate_t, mp_bitcnt_t); + +#define mpz_scan0 __gmpz_scan0 +__GMP_DECLSPEC mp_bitcnt_t mpz_scan0 (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpz_scan1 __gmpz_scan1 +__GMP_DECLSPEC mp_bitcnt_t mpz_scan1 (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpz_set __gmpz_set +__GMP_DECLSPEC void mpz_set (mpz_ptr, mpz_srcptr); + +#define mpz_set_d __gmpz_set_d +__GMP_DECLSPEC void mpz_set_d (mpz_ptr, double); + +#define mpz_set_f __gmpz_set_f +__GMP_DECLSPEC void mpz_set_f (mpz_ptr, mpf_srcptr); + +#define mpz_set_q __gmpz_set_q +#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_set_q) +__GMP_DECLSPEC void mpz_set_q (mpz_ptr, mpq_srcptr); +#endif + +#define mpz_set_si __gmpz_set_si +__GMP_DECLSPEC void mpz_set_si (mpz_ptr, signed long int); + +#define mpz_set_str __gmpz_set_str +__GMP_DECLSPEC int mpz_set_str (mpz_ptr, const char *, int); + +#define mpz_set_ui __gmpz_set_ui +__GMP_DECLSPEC void mpz_set_ui (mpz_ptr, unsigned long int); + +#define mpz_setbit __gmpz_setbit +__GMP_DECLSPEC void mpz_setbit (mpz_ptr, mp_bitcnt_t); + +#define mpz_size __gmpz_size +#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_size) +__GMP_DECLSPEC size_t mpz_size (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; +#endif + +#define mpz_sizeinbase __gmpz_sizeinbase +__GMP_DECLSPEC size_t mpz_sizeinbase (mpz_srcptr, int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpz_sqrt __gmpz_sqrt +__GMP_DECLSPEC void mpz_sqrt (mpz_ptr, mpz_srcptr); + +#define mpz_sqrtrem __gmpz_sqrtrem +__GMP_DECLSPEC void mpz_sqrtrem (mpz_ptr, mpz_ptr, mpz_srcptr); + +#define mpz_sub __gmpz_sub +__GMP_DECLSPEC void mpz_sub (mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_sub_ui __gmpz_sub_ui +__GMP_DECLSPEC void mpz_sub_ui (mpz_ptr, mpz_srcptr, unsigned long int); + +#define mpz_ui_sub __gmpz_ui_sub +__GMP_DECLSPEC void mpz_ui_sub (mpz_ptr, unsigned long int, mpz_srcptr); + +#define mpz_submul __gmpz_submul +__GMP_DECLSPEC void mpz_submul (mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_submul_ui __gmpz_submul_ui +__GMP_DECLSPEC void mpz_submul_ui (mpz_ptr, mpz_srcptr, unsigned long int); + +#define mpz_swap __gmpz_swap +__GMP_DECLSPEC void mpz_swap (mpz_ptr, mpz_ptr) __GMP_NOTHROW; + +#define mpz_tdiv_ui __gmpz_tdiv_ui +__GMP_DECLSPEC unsigned long int mpz_tdiv_ui (mpz_srcptr, unsigned long int) __GMP_ATTRIBUTE_PURE; + +#define mpz_tdiv_q __gmpz_tdiv_q +__GMP_DECLSPEC void mpz_tdiv_q (mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_tdiv_q_2exp __gmpz_tdiv_q_2exp +__GMP_DECLSPEC void mpz_tdiv_q_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t); + +#define mpz_tdiv_q_ui __gmpz_tdiv_q_ui +__GMP_DECLSPEC unsigned long int mpz_tdiv_q_ui (mpz_ptr, mpz_srcptr, unsigned long int); + +#define mpz_tdiv_qr __gmpz_tdiv_qr +__GMP_DECLSPEC void mpz_tdiv_qr (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_tdiv_qr_ui __gmpz_tdiv_qr_ui +__GMP_DECLSPEC unsigned long int mpz_tdiv_qr_ui (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int); + +#define mpz_tdiv_r __gmpz_tdiv_r +__GMP_DECLSPEC void mpz_tdiv_r (mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_tdiv_r_2exp __gmpz_tdiv_r_2exp +__GMP_DECLSPEC void mpz_tdiv_r_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t); + +#define mpz_tdiv_r_ui __gmpz_tdiv_r_ui +__GMP_DECLSPEC unsigned long int mpz_tdiv_r_ui (mpz_ptr, mpz_srcptr, unsigned long int); + +#define mpz_tstbit __gmpz_tstbit +__GMP_DECLSPEC int mpz_tstbit (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpz_ui_pow_ui __gmpz_ui_pow_ui +__GMP_DECLSPEC void mpz_ui_pow_ui (mpz_ptr, unsigned long int, unsigned long int); + +#define mpz_urandomb __gmpz_urandomb +__GMP_DECLSPEC void mpz_urandomb (mpz_ptr, gmp_randstate_t, mp_bitcnt_t); + +#define mpz_urandomm __gmpz_urandomm +__GMP_DECLSPEC void mpz_urandomm (mpz_ptr, gmp_randstate_t, mpz_srcptr); + +#define mpz_xor __gmpz_xor +#define mpz_eor __gmpz_xor +__GMP_DECLSPEC void mpz_xor (mpz_ptr, mpz_srcptr, mpz_srcptr); + +#define mpz_limbs_read __gmpz_limbs_read +__GMP_DECLSPEC mp_srcptr mpz_limbs_read (mpz_srcptr); + +#define mpz_limbs_write __gmpz_limbs_write +__GMP_DECLSPEC mp_ptr mpz_limbs_write (mpz_ptr, mp_size_t); + +#define mpz_limbs_modify __gmpz_limbs_modify +__GMP_DECLSPEC mp_ptr mpz_limbs_modify (mpz_ptr, mp_size_t); + +#define mpz_limbs_finish __gmpz_limbs_finish +__GMP_DECLSPEC void mpz_limbs_finish (mpz_ptr, mp_size_t); + +#define mpz_roinit_n __gmpz_roinit_n +__GMP_DECLSPEC mpz_srcptr mpz_roinit_n (mpz_ptr, mp_srcptr, mp_size_t); + +#define MPZ_ROINIT_N(xp, xs) {{0, (xs),(xp) }} + +/**************** Rational (i.e. Q) routines. ****************/ + +#define mpq_abs __gmpq_abs +#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpq_abs) +__GMP_DECLSPEC void mpq_abs (mpq_ptr, mpq_srcptr); +#endif + +#define mpq_add __gmpq_add +__GMP_DECLSPEC void mpq_add (mpq_ptr, mpq_srcptr, mpq_srcptr); + +#define mpq_canonicalize __gmpq_canonicalize +__GMP_DECLSPEC void mpq_canonicalize (mpq_ptr); + +#define mpq_clear __gmpq_clear +__GMP_DECLSPEC void mpq_clear (mpq_ptr); + +#define mpq_clears __gmpq_clears +__GMP_DECLSPEC void mpq_clears (mpq_ptr, ...); + +#define mpq_cmp __gmpq_cmp +__GMP_DECLSPEC int mpq_cmp (mpq_srcptr, mpq_srcptr) __GMP_ATTRIBUTE_PURE; + +#define _mpq_cmp_si __gmpq_cmp_si +__GMP_DECLSPEC int _mpq_cmp_si (mpq_srcptr, long, unsigned long) __GMP_ATTRIBUTE_PURE; + +#define _mpq_cmp_ui __gmpq_cmp_ui +__GMP_DECLSPEC int _mpq_cmp_ui (mpq_srcptr, unsigned long int, unsigned long int) __GMP_ATTRIBUTE_PURE; + +#define mpq_cmp_z __gmpq_cmp_z +__GMP_DECLSPEC int mpq_cmp_z (mpq_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE; + +#define mpq_div __gmpq_div +__GMP_DECLSPEC void mpq_div (mpq_ptr, mpq_srcptr, mpq_srcptr); + +#define mpq_div_2exp __gmpq_div_2exp +__GMP_DECLSPEC void mpq_div_2exp (mpq_ptr, mpq_srcptr, mp_bitcnt_t); + +#define mpq_equal __gmpq_equal +__GMP_DECLSPEC int mpq_equal (mpq_srcptr, mpq_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpq_get_num __gmpq_get_num +__GMP_DECLSPEC void mpq_get_num (mpz_ptr, mpq_srcptr); + +#define mpq_get_den __gmpq_get_den +__GMP_DECLSPEC void mpq_get_den (mpz_ptr, mpq_srcptr); + +#define mpq_get_d __gmpq_get_d +__GMP_DECLSPEC double mpq_get_d (mpq_srcptr) __GMP_ATTRIBUTE_PURE; + +#define mpq_get_str __gmpq_get_str +__GMP_DECLSPEC char *mpq_get_str (char *, int, mpq_srcptr); + +#define mpq_init __gmpq_init +__GMP_DECLSPEC void mpq_init (mpq_ptr); + +#define mpq_inits __gmpq_inits +__GMP_DECLSPEC void mpq_inits (mpq_ptr, ...); + +#define mpq_inp_str __gmpq_inp_str +#ifdef _GMP_H_HAVE_FILE +__GMP_DECLSPEC size_t mpq_inp_str (mpq_ptr, FILE *, int); +#endif + +#define mpq_inv __gmpq_inv +__GMP_DECLSPEC void mpq_inv (mpq_ptr, mpq_srcptr); + +#define mpq_mul __gmpq_mul +__GMP_DECLSPEC void mpq_mul (mpq_ptr, mpq_srcptr, mpq_srcptr); + +#define mpq_mul_2exp __gmpq_mul_2exp +__GMP_DECLSPEC void mpq_mul_2exp (mpq_ptr, mpq_srcptr, mp_bitcnt_t); + +#define mpq_neg __gmpq_neg +#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpq_neg) +__GMP_DECLSPEC void mpq_neg (mpq_ptr, mpq_srcptr); +#endif + +#define mpq_out_str __gmpq_out_str +#ifdef _GMP_H_HAVE_FILE +__GMP_DECLSPEC size_t mpq_out_str (FILE *, int, mpq_srcptr); +#endif + +#define mpq_set __gmpq_set +__GMP_DECLSPEC void mpq_set (mpq_ptr, mpq_srcptr); + +#define mpq_set_d __gmpq_set_d +__GMP_DECLSPEC void mpq_set_d (mpq_ptr, double); + +#define mpq_set_den __gmpq_set_den +__GMP_DECLSPEC void mpq_set_den (mpq_ptr, mpz_srcptr); + +#define mpq_set_f __gmpq_set_f +__GMP_DECLSPEC void mpq_set_f (mpq_ptr, mpf_srcptr); + +#define mpq_set_num __gmpq_set_num +__GMP_DECLSPEC void mpq_set_num (mpq_ptr, mpz_srcptr); + +#define mpq_set_si __gmpq_set_si +__GMP_DECLSPEC void mpq_set_si (mpq_ptr, signed long int, unsigned long int); + +#define mpq_set_str __gmpq_set_str +__GMP_DECLSPEC int mpq_set_str (mpq_ptr, const char *, int); + +#define mpq_set_ui __gmpq_set_ui +__GMP_DECLSPEC void mpq_set_ui (mpq_ptr, unsigned long int, unsigned long int); + +#define mpq_set_z __gmpq_set_z +__GMP_DECLSPEC void mpq_set_z (mpq_ptr, mpz_srcptr); + +#define mpq_sub __gmpq_sub +__GMP_DECLSPEC void mpq_sub (mpq_ptr, mpq_srcptr, mpq_srcptr); + +#define mpq_swap __gmpq_swap +__GMP_DECLSPEC void mpq_swap (mpq_ptr, mpq_ptr) __GMP_NOTHROW; + + +/**************** Float (i.e. F) routines. ****************/ + +#define mpf_abs __gmpf_abs +__GMP_DECLSPEC void mpf_abs (mpf_ptr, mpf_srcptr); + +#define mpf_add __gmpf_add +__GMP_DECLSPEC void mpf_add (mpf_ptr, mpf_srcptr, mpf_srcptr); + +#define mpf_add_ui __gmpf_add_ui +__GMP_DECLSPEC void mpf_add_ui (mpf_ptr, mpf_srcptr, unsigned long int); +#define mpf_ceil __gmpf_ceil +__GMP_DECLSPEC void mpf_ceil (mpf_ptr, mpf_srcptr); + +#define mpf_clear __gmpf_clear +__GMP_DECLSPEC void mpf_clear (mpf_ptr); + +#define mpf_clears __gmpf_clears +__GMP_DECLSPEC void mpf_clears (mpf_ptr, ...); + +#define mpf_cmp __gmpf_cmp +__GMP_DECLSPEC int mpf_cmp (mpf_srcptr, mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpf_cmp_z __gmpf_cmp_z +__GMP_DECLSPEC int mpf_cmp_z (mpf_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpf_cmp_d __gmpf_cmp_d +__GMP_DECLSPEC int mpf_cmp_d (mpf_srcptr, double) __GMP_ATTRIBUTE_PURE; + +#define mpf_cmp_si __gmpf_cmp_si +__GMP_DECLSPEC int mpf_cmp_si (mpf_srcptr, signed long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpf_cmp_ui __gmpf_cmp_ui +__GMP_DECLSPEC int mpf_cmp_ui (mpf_srcptr, unsigned long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpf_div __gmpf_div +__GMP_DECLSPEC void mpf_div (mpf_ptr, mpf_srcptr, mpf_srcptr); + +#define mpf_div_2exp __gmpf_div_2exp +__GMP_DECLSPEC void mpf_div_2exp (mpf_ptr, mpf_srcptr, mp_bitcnt_t); + +#define mpf_div_ui __gmpf_div_ui +__GMP_DECLSPEC void mpf_div_ui (mpf_ptr, mpf_srcptr, unsigned long int); + +#define mpf_dump __gmpf_dump +__GMP_DECLSPEC void mpf_dump (mpf_srcptr); + +#define mpf_eq __gmpf_eq +__GMP_DECLSPEC int mpf_eq (mpf_srcptr, mpf_srcptr, mp_bitcnt_t) __GMP_ATTRIBUTE_PURE; + +#define mpf_fits_sint_p __gmpf_fits_sint_p +__GMP_DECLSPEC int mpf_fits_sint_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpf_fits_slong_p __gmpf_fits_slong_p +__GMP_DECLSPEC int mpf_fits_slong_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpf_fits_sshort_p __gmpf_fits_sshort_p +__GMP_DECLSPEC int mpf_fits_sshort_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpf_fits_uint_p __gmpf_fits_uint_p +__GMP_DECLSPEC int mpf_fits_uint_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpf_fits_ulong_p __gmpf_fits_ulong_p +__GMP_DECLSPEC int mpf_fits_ulong_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpf_fits_ushort_p __gmpf_fits_ushort_p +__GMP_DECLSPEC int mpf_fits_ushort_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpf_floor __gmpf_floor +__GMP_DECLSPEC void mpf_floor (mpf_ptr, mpf_srcptr); + +#define mpf_get_d __gmpf_get_d +__GMP_DECLSPEC double mpf_get_d (mpf_srcptr) __GMP_ATTRIBUTE_PURE; + +#define mpf_get_d_2exp __gmpf_get_d_2exp +__GMP_DECLSPEC double mpf_get_d_2exp (signed long int *, mpf_srcptr); + +#define mpf_get_default_prec __gmpf_get_default_prec +__GMP_DECLSPEC mp_bitcnt_t mpf_get_default_prec (void) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpf_get_prec __gmpf_get_prec +__GMP_DECLSPEC mp_bitcnt_t mpf_get_prec (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpf_get_si __gmpf_get_si +__GMP_DECLSPEC long mpf_get_si (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpf_get_str __gmpf_get_str +__GMP_DECLSPEC char *mpf_get_str (char *, mp_exp_t *, int, size_t, mpf_srcptr); + +#define mpf_get_ui __gmpf_get_ui +__GMP_DECLSPEC unsigned long mpf_get_ui (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpf_init __gmpf_init +__GMP_DECLSPEC void mpf_init (mpf_ptr); + +#define mpf_init2 __gmpf_init2 +__GMP_DECLSPEC void mpf_init2 (mpf_ptr, mp_bitcnt_t); + +#define mpf_inits __gmpf_inits +__GMP_DECLSPEC void mpf_inits (mpf_ptr, ...); + +#define mpf_init_set __gmpf_init_set +__GMP_DECLSPEC void mpf_init_set (mpf_ptr, mpf_srcptr); + +#define mpf_init_set_d __gmpf_init_set_d +__GMP_DECLSPEC void mpf_init_set_d (mpf_ptr, double); + +#define mpf_init_set_si __gmpf_init_set_si +__GMP_DECLSPEC void mpf_init_set_si (mpf_ptr, signed long int); + +#define mpf_init_set_str __gmpf_init_set_str +__GMP_DECLSPEC int mpf_init_set_str (mpf_ptr, const char *, int); + +#define mpf_init_set_ui __gmpf_init_set_ui +__GMP_DECLSPEC void mpf_init_set_ui (mpf_ptr, unsigned long int); + +#define mpf_inp_str __gmpf_inp_str +#ifdef _GMP_H_HAVE_FILE +__GMP_DECLSPEC size_t mpf_inp_str (mpf_ptr, FILE *, int); +#endif + +#define mpf_integer_p __gmpf_integer_p +__GMP_DECLSPEC int mpf_integer_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpf_mul __gmpf_mul +__GMP_DECLSPEC void mpf_mul (mpf_ptr, mpf_srcptr, mpf_srcptr); + +#define mpf_mul_2exp __gmpf_mul_2exp +__GMP_DECLSPEC void mpf_mul_2exp (mpf_ptr, mpf_srcptr, mp_bitcnt_t); + +#define mpf_mul_ui __gmpf_mul_ui +__GMP_DECLSPEC void mpf_mul_ui (mpf_ptr, mpf_srcptr, unsigned long int); + +#define mpf_neg __gmpf_neg +__GMP_DECLSPEC void mpf_neg (mpf_ptr, mpf_srcptr); + +#define mpf_out_str __gmpf_out_str +#ifdef _GMP_H_HAVE_FILE +__GMP_DECLSPEC size_t mpf_out_str (FILE *, int, size_t, mpf_srcptr); +#endif + +#define mpf_pow_ui __gmpf_pow_ui +__GMP_DECLSPEC void mpf_pow_ui (mpf_ptr, mpf_srcptr, unsigned long int); + +#define mpf_random2 __gmpf_random2 +__GMP_DECLSPEC void mpf_random2 (mpf_ptr, mp_size_t, mp_exp_t); + +#define mpf_reldiff __gmpf_reldiff +__GMP_DECLSPEC void mpf_reldiff (mpf_ptr, mpf_srcptr, mpf_srcptr); + +#define mpf_set __gmpf_set +__GMP_DECLSPEC void mpf_set (mpf_ptr, mpf_srcptr); + +#define mpf_set_d __gmpf_set_d +__GMP_DECLSPEC void mpf_set_d (mpf_ptr, double); + +#define mpf_set_default_prec __gmpf_set_default_prec +__GMP_DECLSPEC void mpf_set_default_prec (mp_bitcnt_t) __GMP_NOTHROW; + +#define mpf_set_prec __gmpf_set_prec +__GMP_DECLSPEC void mpf_set_prec (mpf_ptr, mp_bitcnt_t); + +#define mpf_set_prec_raw __gmpf_set_prec_raw +__GMP_DECLSPEC void mpf_set_prec_raw (mpf_ptr, mp_bitcnt_t) __GMP_NOTHROW; + +#define mpf_set_q __gmpf_set_q +__GMP_DECLSPEC void mpf_set_q (mpf_ptr, mpq_srcptr); + +#define mpf_set_si __gmpf_set_si +__GMP_DECLSPEC void mpf_set_si (mpf_ptr, signed long int); + +#define mpf_set_str __gmpf_set_str +__GMP_DECLSPEC int mpf_set_str (mpf_ptr, const char *, int); + +#define mpf_set_ui __gmpf_set_ui +__GMP_DECLSPEC void mpf_set_ui (mpf_ptr, unsigned long int); + +#define mpf_set_z __gmpf_set_z +__GMP_DECLSPEC void mpf_set_z (mpf_ptr, mpz_srcptr); + +#define mpf_size __gmpf_size +__GMP_DECLSPEC size_t mpf_size (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpf_sqrt __gmpf_sqrt +__GMP_DECLSPEC void mpf_sqrt (mpf_ptr, mpf_srcptr); + +#define mpf_sqrt_ui __gmpf_sqrt_ui +__GMP_DECLSPEC void mpf_sqrt_ui (mpf_ptr, unsigned long int); + +#define mpf_sub __gmpf_sub +__GMP_DECLSPEC void mpf_sub (mpf_ptr, mpf_srcptr, mpf_srcptr); + +#define mpf_sub_ui __gmpf_sub_ui +__GMP_DECLSPEC void mpf_sub_ui (mpf_ptr, mpf_srcptr, unsigned long int); + +#define mpf_swap __gmpf_swap +__GMP_DECLSPEC void mpf_swap (mpf_ptr, mpf_ptr) __GMP_NOTHROW; + +#define mpf_trunc __gmpf_trunc +__GMP_DECLSPEC void mpf_trunc (mpf_ptr, mpf_srcptr); + +#define mpf_ui_div __gmpf_ui_div +__GMP_DECLSPEC void mpf_ui_div (mpf_ptr, unsigned long int, mpf_srcptr); + +#define mpf_ui_sub __gmpf_ui_sub +__GMP_DECLSPEC void mpf_ui_sub (mpf_ptr, unsigned long int, mpf_srcptr); + +#define mpf_urandomb __gmpf_urandomb +__GMP_DECLSPEC void mpf_urandomb (mpf_t, gmp_randstate_t, mp_bitcnt_t); + + +/************ Low level positive-integer (i.e. N) routines. ************/ + +/* This is ugly, but we need to make user calls reach the prefixed function. */ + +#define mpn_add __MPN(add) +#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_add) +__GMP_DECLSPEC mp_limb_t mpn_add (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t); +#endif + +#define mpn_add_1 __MPN(add_1) +#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_add_1) +__GMP_DECLSPEC mp_limb_t mpn_add_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t) __GMP_NOTHROW; +#endif + +#define mpn_add_n __MPN(add_n) +__GMP_DECLSPEC mp_limb_t mpn_add_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t); + +#define mpn_addmul_1 __MPN(addmul_1) +__GMP_DECLSPEC mp_limb_t mpn_addmul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t); + +#define mpn_cmp __MPN(cmp) +#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_cmp) +__GMP_DECLSPEC int mpn_cmp (mp_srcptr, mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; +#endif + +#define mpn_zero_p __MPN(zero_p) +#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_zero_p) +__GMP_DECLSPEC int mpn_zero_p (mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; +#endif + +#define mpn_divexact_1 __MPN(divexact_1) +__GMP_DECLSPEC void mpn_divexact_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t); + +#define mpn_divexact_by3(dst,src,size) \ + mpn_divexact_by3c (dst, src, size, __GMP_CAST (mp_limb_t, 0)) + +#define mpn_divexact_by3c __MPN(divexact_by3c) +__GMP_DECLSPEC mp_limb_t mpn_divexact_by3c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t); + +#define mpn_divmod_1(qp,np,nsize,dlimb) \ + mpn_divrem_1 (qp, __GMP_CAST (mp_size_t, 0), np, nsize, dlimb) + +#define mpn_divrem __MPN(divrem) +__GMP_DECLSPEC mp_limb_t mpn_divrem (mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr, mp_size_t); + +#define mpn_divrem_1 __MPN(divrem_1) +__GMP_DECLSPEC mp_limb_t mpn_divrem_1 (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t); + +#define mpn_divrem_2 __MPN(divrem_2) +__GMP_DECLSPEC mp_limb_t mpn_divrem_2 (mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr); + +#define mpn_div_qr_1 __MPN(div_qr_1) +__GMP_DECLSPEC mp_limb_t mpn_div_qr_1 (mp_ptr, mp_limb_t *, mp_srcptr, mp_size_t, mp_limb_t); + +#define mpn_div_qr_2 __MPN(div_qr_2) +__GMP_DECLSPEC mp_limb_t mpn_div_qr_2 (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr); + +#define mpn_gcd __MPN(gcd) +__GMP_DECLSPEC mp_size_t mpn_gcd (mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t); + +#define mpn_gcd_1 __MPN(gcd_1) +__GMP_DECLSPEC mp_limb_t mpn_gcd_1 (mp_srcptr, mp_size_t, mp_limb_t) __GMP_ATTRIBUTE_PURE; + +#define mpn_gcdext_1 __MPN(gcdext_1) +__GMP_DECLSPEC mp_limb_t mpn_gcdext_1 (mp_limb_signed_t *, mp_limb_signed_t *, mp_limb_t, mp_limb_t); + +#define mpn_gcdext __MPN(gcdext) +__GMP_DECLSPEC mp_size_t mpn_gcdext (mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t); + +#define mpn_get_str __MPN(get_str) +__GMP_DECLSPEC size_t mpn_get_str (unsigned char *, int, mp_ptr, mp_size_t); + +#define mpn_hamdist __MPN(hamdist) +__GMP_DECLSPEC mp_bitcnt_t mpn_hamdist (mp_srcptr, mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpn_lshift __MPN(lshift) +__GMP_DECLSPEC mp_limb_t mpn_lshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int); + +#define mpn_mod_1 __MPN(mod_1) +__GMP_DECLSPEC mp_limb_t mpn_mod_1 (mp_srcptr, mp_size_t, mp_limb_t) __GMP_ATTRIBUTE_PURE; + +#define mpn_mul __MPN(mul) +__GMP_DECLSPEC mp_limb_t mpn_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t); + +#define mpn_mul_1 __MPN(mul_1) +__GMP_DECLSPEC mp_limb_t mpn_mul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t); + +#define mpn_mul_n __MPN(mul_n) +__GMP_DECLSPEC void mpn_mul_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t); + +#define mpn_sqr __MPN(sqr) +__GMP_DECLSPEC void mpn_sqr (mp_ptr, mp_srcptr, mp_size_t); + +#define mpn_neg __MPN(neg) +#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_neg) +__GMP_DECLSPEC mp_limb_t mpn_neg (mp_ptr, mp_srcptr, mp_size_t); +#endif + +#define mpn_com __MPN(com) +__GMP_DECLSPEC void mpn_com (mp_ptr, mp_srcptr, mp_size_t); + +#define mpn_perfect_square_p __MPN(perfect_square_p) +__GMP_DECLSPEC int mpn_perfect_square_p (mp_srcptr, mp_size_t) __GMP_ATTRIBUTE_PURE; + +#define mpn_perfect_power_p __MPN(perfect_power_p) +__GMP_DECLSPEC int mpn_perfect_power_p (mp_srcptr, mp_size_t) __GMP_ATTRIBUTE_PURE; + +#define mpn_popcount __MPN(popcount) +__GMP_DECLSPEC mp_bitcnt_t mpn_popcount (mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE; + +#define mpn_pow_1 __MPN(pow_1) +__GMP_DECLSPEC mp_size_t mpn_pow_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr); + +/* undocumented now, but retained here for upward compatibility */ +#define mpn_preinv_mod_1 __MPN(preinv_mod_1) +__GMP_DECLSPEC mp_limb_t mpn_preinv_mod_1 (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t) __GMP_ATTRIBUTE_PURE; + +#define mpn_random __MPN(random) +__GMP_DECLSPEC void mpn_random (mp_ptr, mp_size_t); + +#define mpn_random2 __MPN(random2) +__GMP_DECLSPEC void mpn_random2 (mp_ptr, mp_size_t); + +#define mpn_rshift __MPN(rshift) +__GMP_DECLSPEC mp_limb_t mpn_rshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int); + +#define mpn_scan0 __MPN(scan0) +__GMP_DECLSPEC mp_bitcnt_t mpn_scan0 (mp_srcptr, mp_bitcnt_t) __GMP_ATTRIBUTE_PURE; + +#define mpn_scan1 __MPN(scan1) +__GMP_DECLSPEC mp_bitcnt_t mpn_scan1 (mp_srcptr, mp_bitcnt_t) __GMP_ATTRIBUTE_PURE; + +#define mpn_set_str __MPN(set_str) +__GMP_DECLSPEC mp_size_t mpn_set_str (mp_ptr, const unsigned char *, size_t, int); + +#define mpn_sizeinbase __MPN(sizeinbase) +__GMP_DECLSPEC size_t mpn_sizeinbase (mp_srcptr, mp_size_t, int); + +#define mpn_sqrtrem __MPN(sqrtrem) +__GMP_DECLSPEC mp_size_t mpn_sqrtrem (mp_ptr, mp_ptr, mp_srcptr, mp_size_t); + +#define mpn_sub __MPN(sub) +#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_sub) +__GMP_DECLSPEC mp_limb_t mpn_sub (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t); +#endif + +#define mpn_sub_1 __MPN(sub_1) +#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_sub_1) +__GMP_DECLSPEC mp_limb_t mpn_sub_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t) __GMP_NOTHROW; +#endif + +#define mpn_sub_n __MPN(sub_n) +__GMP_DECLSPEC mp_limb_t mpn_sub_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t); + +#define mpn_submul_1 __MPN(submul_1) +__GMP_DECLSPEC mp_limb_t mpn_submul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t); + +#define mpn_tdiv_qr __MPN(tdiv_qr) +__GMP_DECLSPEC void mpn_tdiv_qr (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t); + +#define mpn_and_n __MPN(and_n) +__GMP_DECLSPEC void mpn_and_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t); +#define mpn_andn_n __MPN(andn_n) +__GMP_DECLSPEC void mpn_andn_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t); +#define mpn_nand_n __MPN(nand_n) +__GMP_DECLSPEC void mpn_nand_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t); +#define mpn_ior_n __MPN(ior_n) +__GMP_DECLSPEC void mpn_ior_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t); +#define mpn_iorn_n __MPN(iorn_n) +__GMP_DECLSPEC void mpn_iorn_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t); +#define mpn_nior_n __MPN(nior_n) +__GMP_DECLSPEC void mpn_nior_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t); +#define mpn_xor_n __MPN(xor_n) +__GMP_DECLSPEC void mpn_xor_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t); +#define mpn_xnor_n __MPN(xnor_n) +__GMP_DECLSPEC void mpn_xnor_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t); + +#define mpn_copyi __MPN(copyi) +__GMP_DECLSPEC void mpn_copyi (mp_ptr, mp_srcptr, mp_size_t); +#define mpn_copyd __MPN(copyd) +__GMP_DECLSPEC void mpn_copyd (mp_ptr, mp_srcptr, mp_size_t); +#define mpn_zero __MPN(zero) +__GMP_DECLSPEC void mpn_zero (mp_ptr, mp_size_t); + +#define mpn_cnd_add_n __MPN(cnd_add_n) +__GMP_DECLSPEC mp_limb_t mpn_cnd_add_n (mp_limb_t, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t); +#define mpn_cnd_sub_n __MPN(cnd_sub_n) +__GMP_DECLSPEC mp_limb_t mpn_cnd_sub_n (mp_limb_t, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t); + +#define mpn_sec_add_1 __MPN(sec_add_1) +__GMP_DECLSPEC mp_limb_t mpn_sec_add_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr); +#define mpn_sec_add_1_itch __MPN(sec_add_1_itch) +__GMP_DECLSPEC mp_size_t mpn_sec_add_1_itch (mp_size_t) __GMP_ATTRIBUTE_PURE; + +#define mpn_sec_sub_1 __MPN(sec_sub_1) +__GMP_DECLSPEC mp_limb_t mpn_sec_sub_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr); +#define mpn_sec_sub_1_itch __MPN(sec_sub_1_itch) +__GMP_DECLSPEC mp_size_t mpn_sec_sub_1_itch (mp_size_t) __GMP_ATTRIBUTE_PURE; + +#define mpn_cnd_swap __MPN(cnd_swap) +__GMP_DECLSPEC void mpn_cnd_swap (mp_limb_t, volatile mp_limb_t *, volatile mp_limb_t *, mp_size_t); + +#define mpn_sec_mul __MPN(sec_mul) +__GMP_DECLSPEC void mpn_sec_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr); +#define mpn_sec_mul_itch __MPN(sec_mul_itch) +__GMP_DECLSPEC mp_size_t mpn_sec_mul_itch (mp_size_t, mp_size_t) __GMP_ATTRIBUTE_PURE; + +#define mpn_sec_sqr __MPN(sec_sqr) +__GMP_DECLSPEC void mpn_sec_sqr (mp_ptr, mp_srcptr, mp_size_t, mp_ptr); +#define mpn_sec_sqr_itch __MPN(sec_sqr_itch) +__GMP_DECLSPEC mp_size_t mpn_sec_sqr_itch (mp_size_t) __GMP_ATTRIBUTE_PURE; + +#define mpn_sec_powm __MPN(sec_powm) +__GMP_DECLSPEC void mpn_sec_powm (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_bitcnt_t, mp_srcptr, mp_size_t, mp_ptr); +#define mpn_sec_powm_itch __MPN(sec_powm_itch) +__GMP_DECLSPEC mp_size_t mpn_sec_powm_itch (mp_size_t, mp_bitcnt_t, mp_size_t) __GMP_ATTRIBUTE_PURE; + +#define mpn_sec_tabselect __MPN(sec_tabselect) +__GMP_DECLSPEC void mpn_sec_tabselect (volatile mp_limb_t *, volatile const mp_limb_t *, mp_size_t, mp_size_t, mp_size_t); + +#define mpn_sec_div_qr __MPN(sec_div_qr) +__GMP_DECLSPEC mp_limb_t mpn_sec_div_qr (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr); +#define mpn_sec_div_qr_itch __MPN(sec_div_qr_itch) +__GMP_DECLSPEC mp_size_t mpn_sec_div_qr_itch (mp_size_t, mp_size_t) __GMP_ATTRIBUTE_PURE; +#define mpn_sec_div_r __MPN(sec_div_r) +__GMP_DECLSPEC void mpn_sec_div_r (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr); +#define mpn_sec_div_r_itch __MPN(sec_div_r_itch) +__GMP_DECLSPEC mp_size_t mpn_sec_div_r_itch (mp_size_t, mp_size_t) __GMP_ATTRIBUTE_PURE; + +#define mpn_sec_invert __MPN(sec_invert) +__GMP_DECLSPEC int mpn_sec_invert (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_bitcnt_t, mp_ptr); +#define mpn_sec_invert_itch __MPN(sec_invert_itch) +__GMP_DECLSPEC mp_size_t mpn_sec_invert_itch (mp_size_t) __GMP_ATTRIBUTE_PURE; + + +/**************** mpz inlines ****************/ + +/* The following are provided as inlines where possible, but always exist as + library functions too, for binary compatibility. + + Within gmp itself this inlining generally isn't relied on, since it + doesn't get done for all compilers, whereas if something is worth + inlining then it's worth arranging always. + + There are two styles of inlining here. When the same bit of code is + wanted for the inline as for the library version, then __GMP_FORCE_foo + arranges for that code to be emitted and the __GMP_EXTERN_INLINE + directive suppressed, eg. mpz_fits_uint_p. When a different bit of code + is wanted for the inline than for the library version, then + __GMP_FORCE_foo arranges the inline to be suppressed, eg. mpz_abs. */ + +#if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpz_abs) +__GMP_EXTERN_INLINE void +mpz_abs (mpz_ptr __gmp_w, mpz_srcptr __gmp_u) +{ + if (__gmp_w != __gmp_u) + mpz_set (__gmp_w, __gmp_u); + __gmp_w->_mp_size = __GMP_ABS (__gmp_w->_mp_size); +} +#endif + +#if GMP_NAIL_BITS == 0 +#define __GMPZ_FITS_UTYPE_P(z,maxval) \ + mp_size_t __gmp_n = z->_mp_size; \ + mp_ptr __gmp_p = z->_mp_d; \ + return (__gmp_n == 0 || (__gmp_n == 1 && __gmp_p[0] <= maxval)); +#else +#define __GMPZ_FITS_UTYPE_P(z,maxval) \ + mp_size_t __gmp_n = z->_mp_size; \ + mp_ptr __gmp_p = z->_mp_d; \ + return (__gmp_n == 0 || (__gmp_n == 1 && __gmp_p[0] <= maxval) \ + || (__gmp_n == 2 && __gmp_p[1] <= ((mp_limb_t) maxval >> GMP_NUMB_BITS))); +#endif + +#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_uint_p) +#if ! defined (__GMP_FORCE_mpz_fits_uint_p) +__GMP_EXTERN_INLINE +#endif +int +mpz_fits_uint_p (mpz_srcptr __gmp_z) __GMP_NOTHROW +{ + __GMPZ_FITS_UTYPE_P (__gmp_z, UINT_MAX); +} +#endif + +#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_ulong_p) +#if ! defined (__GMP_FORCE_mpz_fits_ulong_p) +__GMP_EXTERN_INLINE +#endif +int +mpz_fits_ulong_p (mpz_srcptr __gmp_z) __GMP_NOTHROW +{ + __GMPZ_FITS_UTYPE_P (__gmp_z, ULONG_MAX); +} +#endif + +#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_ushort_p) +#if ! defined (__GMP_FORCE_mpz_fits_ushort_p) +__GMP_EXTERN_INLINE +#endif +int +mpz_fits_ushort_p (mpz_srcptr __gmp_z) __GMP_NOTHROW +{ + __GMPZ_FITS_UTYPE_P (__gmp_z, USHRT_MAX); +} +#endif + +#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_get_ui) +#if ! defined (__GMP_FORCE_mpz_get_ui) +__GMP_EXTERN_INLINE +#endif +unsigned long +mpz_get_ui (mpz_srcptr __gmp_z) __GMP_NOTHROW +{ + mp_ptr __gmp_p = __gmp_z->_mp_d; + mp_size_t __gmp_n = __gmp_z->_mp_size; + mp_limb_t __gmp_l = __gmp_p[0]; + /* This is a "#if" rather than a plain "if" so as to avoid gcc warnings + about "<< GMP_NUMB_BITS" exceeding the type size, and to avoid Borland + C++ 6.0 warnings about condition always true for something like + "ULONG_MAX < GMP_NUMB_MASK". */ +#if GMP_NAIL_BITS == 0 || defined (_LONG_LONG_LIMB) + /* limb==long and no nails, or limb==longlong, one limb is enough */ + return (__gmp_n != 0 ? __gmp_l : 0); +#else + /* limb==long and nails, need two limbs when available */ + __gmp_n = __GMP_ABS (__gmp_n); + if (__gmp_n <= 1) + return (__gmp_n != 0 ? __gmp_l : 0); + else + return __gmp_l + (__gmp_p[1] << GMP_NUMB_BITS); +#endif +} +#endif + +#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_getlimbn) +#if ! defined (__GMP_FORCE_mpz_getlimbn) +__GMP_EXTERN_INLINE +#endif +mp_limb_t +mpz_getlimbn (mpz_srcptr __gmp_z, mp_size_t __gmp_n) __GMP_NOTHROW +{ + mp_limb_t __gmp_result = 0; + if (__GMP_LIKELY (__gmp_n >= 0 && __gmp_n < __GMP_ABS (__gmp_z->_mp_size))) + __gmp_result = __gmp_z->_mp_d[__gmp_n]; + return __gmp_result; +} +#endif + +#if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpz_neg) +__GMP_EXTERN_INLINE void +mpz_neg (mpz_ptr __gmp_w, mpz_srcptr __gmp_u) +{ + if (__gmp_w != __gmp_u) + mpz_set (__gmp_w, __gmp_u); + __gmp_w->_mp_size = - __gmp_w->_mp_size; +} +#endif + +#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_perfect_square_p) +#if ! defined (__GMP_FORCE_mpz_perfect_square_p) +__GMP_EXTERN_INLINE +#endif +int +mpz_perfect_square_p (mpz_srcptr __gmp_a) +{ + mp_size_t __gmp_asize; + int __gmp_result; + + __gmp_asize = __gmp_a->_mp_size; + __gmp_result = (__gmp_asize >= 0); /* zero is a square, negatives are not */ + if (__GMP_LIKELY (__gmp_asize > 0)) + __gmp_result = mpn_perfect_square_p (__gmp_a->_mp_d, __gmp_asize); + return __gmp_result; +} +#endif + +#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_popcount) +#if ! defined (__GMP_FORCE_mpz_popcount) +__GMP_EXTERN_INLINE +#endif +mp_bitcnt_t +mpz_popcount (mpz_srcptr __gmp_u) __GMP_NOTHROW +{ + mp_size_t __gmp_usize; + mp_bitcnt_t __gmp_result; + + __gmp_usize = __gmp_u->_mp_size; + __gmp_result = (__gmp_usize < 0 ? ULONG_MAX : 0); + if (__GMP_LIKELY (__gmp_usize > 0)) + __gmp_result = mpn_popcount (__gmp_u->_mp_d, __gmp_usize); + return __gmp_result; +} +#endif + +#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_set_q) +#if ! defined (__GMP_FORCE_mpz_set_q) +__GMP_EXTERN_INLINE +#endif +void +mpz_set_q (mpz_ptr __gmp_w, mpq_srcptr __gmp_u) +{ + mpz_tdiv_q (__gmp_w, mpq_numref (__gmp_u), mpq_denref (__gmp_u)); +} +#endif + +#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_size) +#if ! defined (__GMP_FORCE_mpz_size) +__GMP_EXTERN_INLINE +#endif +size_t +mpz_size (mpz_srcptr __gmp_z) __GMP_NOTHROW +{ + return __GMP_ABS (__gmp_z->_mp_size); +} +#endif + + +/**************** mpq inlines ****************/ + +#if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpq_abs) +__GMP_EXTERN_INLINE void +mpq_abs (mpq_ptr __gmp_w, mpq_srcptr __gmp_u) +{ + if (__gmp_w != __gmp_u) + mpq_set (__gmp_w, __gmp_u); + __gmp_w->_mp_num._mp_size = __GMP_ABS (__gmp_w->_mp_num._mp_size); +} +#endif + +#if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpq_neg) +__GMP_EXTERN_INLINE void +mpq_neg (mpq_ptr __gmp_w, mpq_srcptr __gmp_u) +{ + if (__gmp_w != __gmp_u) + mpq_set (__gmp_w, __gmp_u); + __gmp_w->_mp_num._mp_size = - __gmp_w->_mp_num._mp_size; +} +#endif + + +/**************** mpn inlines ****************/ + +/* The comments with __GMPN_ADD_1 below apply here too. + + The test for FUNCTION returning 0 should predict well. If it's assumed + {yp,ysize} will usually have a random number of bits then the high limb + won't be full and a carry out will occur a good deal less than 50% of the + time. + + ysize==0 isn't a documented feature, but is used internally in a few + places. + + Producing cout last stops it using up a register during the main part of + the calculation, though gcc (as of 3.0) on an "if (mpn_add (...))" + doesn't seem able to move the true and false legs of the conditional up + to the two places cout is generated. */ + +#define __GMPN_AORS(cout, wp, xp, xsize, yp, ysize, FUNCTION, TEST) \ + do { \ + mp_size_t __gmp_i; \ + mp_limb_t __gmp_x; \ + \ + /* ASSERT ((ysize) >= 0); */ \ + /* ASSERT ((xsize) >= (ysize)); */ \ + /* ASSERT (MPN_SAME_OR_SEPARATE2_P (wp, xsize, xp, xsize)); */ \ + /* ASSERT (MPN_SAME_OR_SEPARATE2_P (wp, xsize, yp, ysize)); */ \ + \ + __gmp_i = (ysize); \ + if (__gmp_i != 0) \ + { \ + if (FUNCTION (wp, xp, yp, __gmp_i)) \ + { \ + do \ + { \ + if (__gmp_i >= (xsize)) \ + { \ + (cout) = 1; \ + goto __gmp_done; \ + } \ + __gmp_x = (xp)[__gmp_i]; \ + } \ + while (TEST); \ + } \ + } \ + if ((wp) != (xp)) \ + __GMPN_COPY_REST (wp, xp, xsize, __gmp_i); \ + (cout) = 0; \ + __gmp_done: \ + ; \ + } while (0) + +#define __GMPN_ADD(cout, wp, xp, xsize, yp, ysize) \ + __GMPN_AORS (cout, wp, xp, xsize, yp, ysize, mpn_add_n, \ + (((wp)[__gmp_i++] = (__gmp_x + 1) & GMP_NUMB_MASK) == 0)) +#define __GMPN_SUB(cout, wp, xp, xsize, yp, ysize) \ + __GMPN_AORS (cout, wp, xp, xsize, yp, ysize, mpn_sub_n, \ + (((wp)[__gmp_i++] = (__gmp_x - 1) & GMP_NUMB_MASK), __gmp_x == 0)) + + +/* The use of __gmp_i indexing is designed to ensure a compile time src==dst + remains nice and clear to the compiler, so that __GMPN_COPY_REST can + disappear, and the load/add/store gets a chance to become a + read-modify-write on CISC CPUs. + + Alternatives: + + Using a pair of pointers instead of indexing would be possible, but gcc + isn't able to recognise compile-time src==dst in that case, even when the + pointers are incremented more or less together. Other compilers would + very likely have similar difficulty. + + gcc could use "if (__builtin_constant_p(src==dst) && src==dst)" or + similar to detect a compile-time src==dst. This works nicely on gcc + 2.95.x, it's not good on gcc 3.0 where __builtin_constant_p(p==p) seems + to be always false, for a pointer p. But the current code form seems + good enough for src==dst anyway. + + gcc on x86 as usual doesn't give particularly good flags handling for the + carry/borrow detection. It's tempting to want some multi instruction asm + blocks to help it, and this was tried, but in truth there's only a few + instructions to save and any gain is all too easily lost by register + juggling setting up for the asm. */ + +#if GMP_NAIL_BITS == 0 +#define __GMPN_AORS_1(cout, dst, src, n, v, OP, CB) \ + do { \ + mp_size_t __gmp_i; \ + mp_limb_t __gmp_x, __gmp_r; \ + \ + /* ASSERT ((n) >= 1); */ \ + /* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, n)); */ \ + \ + __gmp_x = (src)[0]; \ + __gmp_r = __gmp_x OP (v); \ + (dst)[0] = __gmp_r; \ + if (CB (__gmp_r, __gmp_x, (v))) \ + { \ + (cout) = 1; \ + for (__gmp_i = 1; __gmp_i < (n);) \ + { \ + __gmp_x = (src)[__gmp_i]; \ + __gmp_r = __gmp_x OP 1; \ + (dst)[__gmp_i] = __gmp_r; \ + ++__gmp_i; \ + if (!CB (__gmp_r, __gmp_x, 1)) \ + { \ + if ((src) != (dst)) \ + __GMPN_COPY_REST (dst, src, n, __gmp_i); \ + (cout) = 0; \ + break; \ + } \ + } \ + } \ + else \ + { \ + if ((src) != (dst)) \ + __GMPN_COPY_REST (dst, src, n, 1); \ + (cout) = 0; \ + } \ + } while (0) +#endif + +#if GMP_NAIL_BITS >= 1 +#define __GMPN_AORS_1(cout, dst, src, n, v, OP, CB) \ + do { \ + mp_size_t __gmp_i; \ + mp_limb_t __gmp_x, __gmp_r; \ + \ + /* ASSERT ((n) >= 1); */ \ + /* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, n)); */ \ + \ + __gmp_x = (src)[0]; \ + __gmp_r = __gmp_x OP (v); \ + (dst)[0] = __gmp_r & GMP_NUMB_MASK; \ + if (__gmp_r >> GMP_NUMB_BITS != 0) \ + { \ + (cout) = 1; \ + for (__gmp_i = 1; __gmp_i < (n);) \ + { \ + __gmp_x = (src)[__gmp_i]; \ + __gmp_r = __gmp_x OP 1; \ + (dst)[__gmp_i] = __gmp_r & GMP_NUMB_MASK; \ + ++__gmp_i; \ + if (__gmp_r >> GMP_NUMB_BITS == 0) \ + { \ + if ((src) != (dst)) \ + __GMPN_COPY_REST (dst, src, n, __gmp_i); \ + (cout) = 0; \ + break; \ + } \ + } \ + } \ + else \ + { \ + if ((src) != (dst)) \ + __GMPN_COPY_REST (dst, src, n, 1); \ + (cout) = 0; \ + } \ + } while (0) +#endif + +#define __GMPN_ADDCB(r,x,y) ((r) < (y)) +#define __GMPN_SUBCB(r,x,y) ((x) < (y)) + +#define __GMPN_ADD_1(cout, dst, src, n, v) \ + __GMPN_AORS_1(cout, dst, src, n, v, +, __GMPN_ADDCB) +#define __GMPN_SUB_1(cout, dst, src, n, v) \ + __GMPN_AORS_1(cout, dst, src, n, v, -, __GMPN_SUBCB) + + +/* Compare {xp,size} and {yp,size}, setting "result" to positive, zero or + negative. size==0 is allowed. On random data usually only one limb will + need to be examined to get a result, so it's worth having it inline. */ +#define __GMPN_CMP(result, xp, yp, size) \ + do { \ + mp_size_t __gmp_i; \ + mp_limb_t __gmp_x, __gmp_y; \ + \ + /* ASSERT ((size) >= 0); */ \ + \ + (result) = 0; \ + __gmp_i = (size); \ + while (--__gmp_i >= 0) \ + { \ + __gmp_x = (xp)[__gmp_i]; \ + __gmp_y = (yp)[__gmp_i]; \ + if (__gmp_x != __gmp_y) \ + { \ + /* Cannot use __gmp_x - __gmp_y, may overflow an "int" */ \ + (result) = (__gmp_x > __gmp_y ? 1 : -1); \ + break; \ + } \ + } \ + } while (0) + + +#if defined (__GMPN_COPY) && ! defined (__GMPN_COPY_REST) +#define __GMPN_COPY_REST(dst, src, size, start) \ + do { \ + /* ASSERT ((start) >= 0); */ \ + /* ASSERT ((start) <= (size)); */ \ + __GMPN_COPY ((dst)+(start), (src)+(start), (size)-(start)); \ + } while (0) +#endif + +/* Copy {src,size} to {dst,size}, starting at "start". This is designed to + keep the indexing dst[j] and src[j] nice and simple for __GMPN_ADD_1, + __GMPN_ADD, etc. */ +#if ! defined (__GMPN_COPY_REST) +#define __GMPN_COPY_REST(dst, src, size, start) \ + do { \ + mp_size_t __gmp_j; \ + /* ASSERT ((size) >= 0); */ \ + /* ASSERT ((start) >= 0); */ \ + /* ASSERT ((start) <= (size)); */ \ + /* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, size)); */ \ + __GMP_CRAY_Pragma ("_CRI ivdep"); \ + for (__gmp_j = (start); __gmp_j < (size); __gmp_j++) \ + (dst)[__gmp_j] = (src)[__gmp_j]; \ + } while (0) +#endif + +/* Enhancement: Use some of the smarter code from gmp-impl.h. Maybe use + mpn_copyi if there's a native version, and if we don't mind demanding + binary compatibility for it (on targets which use it). */ + +#if ! defined (__GMPN_COPY) +#define __GMPN_COPY(dst, src, size) __GMPN_COPY_REST (dst, src, size, 0) +#endif + + +#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_add) +#if ! defined (__GMP_FORCE_mpn_add) +__GMP_EXTERN_INLINE +#endif +mp_limb_t +mpn_add (mp_ptr __gmp_wp, mp_srcptr __gmp_xp, mp_size_t __gmp_xsize, mp_srcptr __gmp_yp, mp_size_t __gmp_ysize) +{ + mp_limb_t __gmp_c; + __GMPN_ADD (__gmp_c, __gmp_wp, __gmp_xp, __gmp_xsize, __gmp_yp, __gmp_ysize); + return __gmp_c; +} +#endif + +#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_add_1) +#if ! defined (__GMP_FORCE_mpn_add_1) +__GMP_EXTERN_INLINE +#endif +mp_limb_t +mpn_add_1 (mp_ptr __gmp_dst, mp_srcptr __gmp_src, mp_size_t __gmp_size, mp_limb_t __gmp_n) __GMP_NOTHROW +{ + mp_limb_t __gmp_c; + __GMPN_ADD_1 (__gmp_c, __gmp_dst, __gmp_src, __gmp_size, __gmp_n); + return __gmp_c; +} +#endif + +#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_cmp) +#if ! defined (__GMP_FORCE_mpn_cmp) +__GMP_EXTERN_INLINE +#endif +int +mpn_cmp (mp_srcptr __gmp_xp, mp_srcptr __gmp_yp, mp_size_t __gmp_size) __GMP_NOTHROW +{ + int __gmp_result; + __GMPN_CMP (__gmp_result, __gmp_xp, __gmp_yp, __gmp_size); + return __gmp_result; +} +#endif + +#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_zero_p) +#if ! defined (__GMP_FORCE_mpn_zero_p) +__GMP_EXTERN_INLINE +#endif +int +mpn_zero_p (mp_srcptr __gmp_p, mp_size_t __gmp_n) __GMP_NOTHROW +{ + /* if (__GMP_LIKELY (__gmp_n > 0)) */ + do { + if (__gmp_p[--__gmp_n] != 0) + return 0; + } while (__gmp_n != 0); + return 1; +} +#endif + +#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_sub) +#if ! defined (__GMP_FORCE_mpn_sub) +__GMP_EXTERN_INLINE +#endif +mp_limb_t +mpn_sub (mp_ptr __gmp_wp, mp_srcptr __gmp_xp, mp_size_t __gmp_xsize, mp_srcptr __gmp_yp, mp_size_t __gmp_ysize) +{ + mp_limb_t __gmp_c; + __GMPN_SUB (__gmp_c, __gmp_wp, __gmp_xp, __gmp_xsize, __gmp_yp, __gmp_ysize); + return __gmp_c; +} +#endif + +#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_sub_1) +#if ! defined (__GMP_FORCE_mpn_sub_1) +__GMP_EXTERN_INLINE +#endif +mp_limb_t +mpn_sub_1 (mp_ptr __gmp_dst, mp_srcptr __gmp_src, mp_size_t __gmp_size, mp_limb_t __gmp_n) __GMP_NOTHROW +{ + mp_limb_t __gmp_c; + __GMPN_SUB_1 (__gmp_c, __gmp_dst, __gmp_src, __gmp_size, __gmp_n); + return __gmp_c; +} +#endif + +#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_neg) +#if ! defined (__GMP_FORCE_mpn_neg) +__GMP_EXTERN_INLINE +#endif +mp_limb_t +mpn_neg (mp_ptr __gmp_rp, mp_srcptr __gmp_up, mp_size_t __gmp_n) +{ + while (*__gmp_up == 0) /* Low zero limbs are unchanged by negation. */ + { + *__gmp_rp = 0; + if (!--__gmp_n) /* All zero */ + return 0; + ++__gmp_up; ++__gmp_rp; + } + + *__gmp_rp = (- *__gmp_up) & GMP_NUMB_MASK; + + if (--__gmp_n) /* Higher limbs get complemented. */ + mpn_com (++__gmp_rp, ++__gmp_up, __gmp_n); + + return 1; +} +#endif + +#if defined (__cplusplus) +} +#endif + + +/* Allow faster testing for negative, zero, and positive. */ +#define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0) +#define mpf_sgn(F) ((F)->_mp_size < 0 ? -1 : (F)->_mp_size > 0) +#define mpq_sgn(Q) ((Q)->_mp_num._mp_size < 0 ? -1 : (Q)->_mp_num._mp_size > 0) + +/* When using GCC, optimize certain common comparisons. */ +#if defined (__GNUC__) && __GNUC__ >= 2 +#define mpz_cmp_ui(Z,UI) \ + (__builtin_constant_p (UI) && (UI) == 0 \ + ? mpz_sgn (Z) : _mpz_cmp_ui (Z,UI)) +#define mpz_cmp_si(Z,SI) \ + (__builtin_constant_p ((SI) >= 0) && (SI) >= 0 \ + ? mpz_cmp_ui (Z, __GMP_CAST (unsigned long, SI)) \ + : _mpz_cmp_si (Z,SI)) +#define mpq_cmp_ui(Q,NUI,DUI) \ + (__builtin_constant_p (NUI) && (NUI) == 0 ? mpq_sgn (Q) \ + : __builtin_constant_p ((NUI) == (DUI)) && (NUI) == (DUI) \ + ? mpz_cmp (mpq_numref (Q), mpq_denref (Q)) \ + : _mpq_cmp_ui (Q,NUI,DUI)) +#define mpq_cmp_si(q,n,d) \ + (__builtin_constant_p ((n) >= 0) && (n) >= 0 \ + ? mpq_cmp_ui (q, __GMP_CAST (unsigned long, n), d) \ + : _mpq_cmp_si (q, n, d)) +#else +#define mpz_cmp_ui(Z,UI) _mpz_cmp_ui (Z,UI) +#define mpz_cmp_si(Z,UI) _mpz_cmp_si (Z,UI) +#define mpq_cmp_ui(Q,NUI,DUI) _mpq_cmp_ui (Q,NUI,DUI) +#define mpq_cmp_si(q,n,d) _mpq_cmp_si(q,n,d) +#endif + + +/* Using "&" rather than "&&" means these can come out branch-free. Every + mpz_t has at least one limb allocated, so fetching the low limb is always + allowed. */ +#define mpz_odd_p(z) (((z)->_mp_size != 0) & __GMP_CAST (int, (z)->_mp_d[0])) +#define mpz_even_p(z) (! mpz_odd_p (z)) + + +/**************** C++ routines ****************/ + +#ifdef __cplusplus +__GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpz_srcptr); +__GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpq_srcptr); +__GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpf_srcptr); +__GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpz_ptr); +__GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpq_ptr); +__GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpf_ptr); +#endif + + +/* Source-level compatibility with GMP 2 and earlier. */ +#define mpn_divmod(qp,np,nsize,dp,dsize) \ + mpn_divrem (qp, __GMP_CAST (mp_size_t, 0), np, nsize, dp, dsize) + +/* Source-level compatibility with GMP 1. */ +#define mpz_mdiv mpz_fdiv_q +#define mpz_mdivmod mpz_fdiv_qr +#define mpz_mmod mpz_fdiv_r +#define mpz_mdiv_ui mpz_fdiv_q_ui +#define mpz_mdivmod_ui(q,r,n,d) \ + (((r) == 0) ? mpz_fdiv_q_ui (q,n,d) : mpz_fdiv_qr_ui (q,r,n,d)) +#define mpz_mmod_ui(r,n,d) \ + (((r) == 0) ? mpz_fdiv_ui (n,d) : mpz_fdiv_r_ui (r,n,d)) + +/* Useful synonyms, but not quite compatible with GMP 1. */ +#define mpz_div mpz_fdiv_q +#define mpz_divmod mpz_fdiv_qr +#define mpz_div_ui mpz_fdiv_q_ui +#define mpz_divmod_ui mpz_fdiv_qr_ui +#define mpz_div_2exp mpz_fdiv_q_2exp +#define mpz_mod_2exp mpz_fdiv_r_2exp + +enum +{ + GMP_ERROR_NONE = 0, + GMP_ERROR_UNSUPPORTED_ARGUMENT = 1, + GMP_ERROR_DIVISION_BY_ZERO = 2, + GMP_ERROR_SQRT_OF_NEGATIVE = 4, + GMP_ERROR_INVALID_ARGUMENT = 8 +}; + +/* Define CC and CFLAGS which were used to build this version of GMP */ +#define __GMP_CC "/usr/bin/gcc" +#define __GMP_CFLAGS "-O2 -I/opt/mipsel-linux-uclibc/include" + +/* Major version number is the value of __GNU_MP__ too, above. */ +#define __GNU_MP_VERSION 6 +#define __GNU_MP_VERSION_MINOR 1 +#define __GNU_MP_VERSION_PATCHLEVEL 2 +#define __GNU_MP_RELEASE (__GNU_MP_VERSION * 10000 + __GNU_MP_VERSION_MINOR * 100 + __GNU_MP_VERSION_PATCHLEVEL) + +#define __GMP_H__ +#endif /* __GMP_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libfdisk/libfdisk.h b/dingux/opt/mipsel-linux-uclibc/include/libfdisk/libfdisk.h new file mode 100644 index 0000000..80fb22a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libfdisk/libfdisk.h @@ -0,0 +1,761 @@ +/* + * libfdisk.h - libfdisk API + * + * Copyright (C) 2012-2014 Karel Zak + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef _LIBFDISK_H +#define _LIBFDISK_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +/** + * LIBFDISK_VERSION: + * + * Library version string + */ +#define LIBFDISK_VERSION "2.31.1" + +#define LIBFDISK_MAJOR_VERSION 2 +#define LIBFDISK_MINOR_VERSION 31 +#define LIBFDISK_PATCH_VERSION 1 + +/** + * fdisk_context: + * + * Basic library handler. + */ +struct fdisk_context; + +/** + * fdisk_label: + * + * Disk label specific driver and setting. + */ +struct fdisk_label; + +/** + * fdisk_parttype: + * + * Partition type. + */ +struct fdisk_parttype; + +/** + * fdisk_partition: + * + * Partition abstraction (and template). + */ +struct fdisk_partition; + +/** + * fdisk_ask: + * + * Ask API handler for dialogs with users. + */ +struct fdisk_ask; + +/** + * fdisk_iter: + * + * Unified iterator. + */ +struct fdisk_iter; + +/** + * fdisk_table: + * + * Container for fdisk_partition objects + */ +struct fdisk_table; + +/** + * fdisk_field + * + * Output field description. + */ +struct fdisk_field; + +/** + * fdisk_script + * + * library handler for sfdisk compatible scripts and dumps + */ +struct fdisk_script; + +/** + * fdisk_sector_t + * + * LBA adresses type + */ +typedef uint64_t fdisk_sector_t; + +/** + * fdisk_labeltype: + * + * Supported partition table types (labels) + */ +enum fdisk_labeltype { + FDISK_DISKLABEL_DOS = (1 << 1), /* MBR label type */ + FDISK_DISKLABEL_SUN = (1 << 2), /* SUN label type */ + FDISK_DISKLABEL_SGI = (1 << 3), /* SGI label type */ + FDISK_DISKLABEL_BSD = (1 << 4), /* BSD label t ype */ + FDISK_DISKLABEL_GPT = (1 << 5) /* UEFI GPT type */ +}; + +/** + * fdisk_labelitem + * + * library handler for label specific information. See + * generic FDISK_LABELITEM_* and label specific {GPT,MBR,..}_LABELITEM_*. + */ +struct fdisk_labelitem; + +/** + * fdisk_asktype: + * + * Ask API dialog types + */ +enum fdisk_asktype { + FDISK_ASKTYPE_NONE = 0, /* undefined type */ + FDISK_ASKTYPE_NUMBER, /* ask for number */ + FDISK_ASKTYPE_OFFSET, /* ask for offset */ + FDISK_ASKTYPE_WARN, /* print warning message and errno */ + FDISK_ASKTYPE_WARNX, /* print warning message */ + FDISK_ASKTYPE_INFO, /* print infor message */ + FDISK_ASKTYPE_YESNO, /* ask Yes/No question */ + FDISK_ASKTYPE_STRING, /* ask for string */ + FDISK_ASKTYPE_MENU /* ask for menu item */ +}; + +/* init.c */ +extern void fdisk_init_debug(int mask); + +/* version.c */ +extern int fdisk_parse_version_string(const char *ver_string); +extern int fdisk_get_library_version(const char **ver_string); +extern int fdisk_get_library_features(const char ***features); + +/* context.h */ + +#define FDISK_PLURAL 0 +#define FDISK_SINGULAR 1 + +struct fdisk_context *fdisk_new_context(void); +struct fdisk_context *fdisk_new_nested_context(struct fdisk_context *parent, const char *name); +void fdisk_unref_context(struct fdisk_context *cxt); +void fdisk_ref_context(struct fdisk_context *cxt); + +struct fdisk_context *fdisk_get_parent(struct fdisk_context *cxt); +size_t fdisk_get_npartitions(struct fdisk_context *cxt); + +struct fdisk_label *fdisk_get_label(struct fdisk_context *cxt, const char *name); +int fdisk_next_label(struct fdisk_context *cxt, struct fdisk_label **lb); +size_t fdisk_get_nlabels(struct fdisk_context *cxt); + +int fdisk_has_label(struct fdisk_context *cxt); +int fdisk_is_labeltype(struct fdisk_context *cxt, enum fdisk_labeltype id); +#define fdisk_is_label(c, x) fdisk_is_labeltype(c, FDISK_DISKLABEL_ ## x) + + +int fdisk_assign_device(struct fdisk_context *cxt, + const char *fname, int readonly); +int fdisk_deassign_device(struct fdisk_context *cxt, int nosync); +int fdisk_reassign_device(struct fdisk_context *cxt); + +int fdisk_is_readonly(struct fdisk_context *cxt); +int fdisk_is_regfile(struct fdisk_context *cxt); +int fdisk_device_is_used(struct fdisk_context *cxt); + +int fdisk_disable_dialogs(struct fdisk_context *cxt, int disable); +int fdisk_has_dialogs(struct fdisk_context *cxt); + +int fdisk_enable_details(struct fdisk_context *cxt, int enable); +int fdisk_is_details(struct fdisk_context *cxt); + +int fdisk_enable_listonly(struct fdisk_context *cxt, int enable); +int fdisk_is_listonly(struct fdisk_context *cxt); + +int fdisk_enable_wipe(struct fdisk_context *cxt, int enable); +int fdisk_has_wipe(struct fdisk_context *cxt); +const char *fdisk_get_collision(struct fdisk_context *cxt); +int fdisk_is_ptcollision(struct fdisk_context *cxt); + +int fdisk_set_unit(struct fdisk_context *cxt, const char *str); +const char *fdisk_get_unit(struct fdisk_context *cxt, int n); +int fdisk_use_cylinders(struct fdisk_context *cxt); +unsigned int fdisk_get_units_per_sector(struct fdisk_context *cxt); + +unsigned long fdisk_get_optimal_iosize(struct fdisk_context *cxt); +unsigned long fdisk_get_minimal_iosize(struct fdisk_context *cxt); +unsigned long fdisk_get_physector_size(struct fdisk_context *cxt); +unsigned long fdisk_get_sector_size(struct fdisk_context *cxt); +unsigned long fdisk_get_alignment_offset(struct fdisk_context *cxt); +unsigned long fdisk_get_grain_size(struct fdisk_context *cxt); +fdisk_sector_t fdisk_get_first_lba(struct fdisk_context *cxt); +fdisk_sector_t fdisk_set_first_lba(struct fdisk_context *cxt, fdisk_sector_t lba); +fdisk_sector_t fdisk_get_last_lba(struct fdisk_context *cxt); +fdisk_sector_t fdisk_set_last_lba(struct fdisk_context *cxt, fdisk_sector_t lba); +fdisk_sector_t fdisk_get_nsectors(struct fdisk_context *cxt); +const char *fdisk_get_devname(struct fdisk_context *cxt); +int fdisk_get_devfd(struct fdisk_context *cxt); + +unsigned int fdisk_get_geom_heads(struct fdisk_context *cxt); +fdisk_sector_t fdisk_get_geom_sectors(struct fdisk_context *cxt); +fdisk_sector_t fdisk_get_geom_cylinders(struct fdisk_context *cxt); + +enum { + FDISK_SIZEUNIT_HUMAN = 0, /* default, human readable {M,G,P,...} */ + FDISK_SIZEUNIT_BYTES /* bytes */ +}; +int fdisk_set_size_unit(struct fdisk_context *cxt, int unit); +int fdisk_get_size_unit(struct fdisk_context *cxt); + +int fdisk_has_protected_bootbits(struct fdisk_context *cxt); +int fdisk_enable_bootbits_protection(struct fdisk_context *cxt, int enable); + +/* parttype.c */ +struct fdisk_parttype *fdisk_new_parttype(void); +void fdisk_ref_parttype(struct fdisk_parttype *t); +void fdisk_unref_parttype(struct fdisk_parttype *t); +int fdisk_parttype_set_name(struct fdisk_parttype *t, const char *str); +int fdisk_parttype_set_typestr(struct fdisk_parttype *t, const char *str); +int fdisk_parttype_set_code(struct fdisk_parttype *t, int code); +size_t fdisk_label_get_nparttypes(const struct fdisk_label *lb); +struct fdisk_parttype *fdisk_label_get_parttype(const struct fdisk_label *lb, size_t n); +int fdisk_label_has_code_parttypes(const struct fdisk_label *lb); +struct fdisk_parttype *fdisk_label_get_parttype_from_code( + const struct fdisk_label *lb, + unsigned int code); +struct fdisk_parttype *fdisk_label_get_parttype_from_string( + const struct fdisk_label *lb, + const char *str); +struct fdisk_parttype *fdisk_new_unknown_parttype(unsigned int code, + const char *typestr); +struct fdisk_parttype *fdisk_copy_parttype(const struct fdisk_parttype *type); +struct fdisk_parttype *fdisk_label_parse_parttype( + const struct fdisk_label *lb, + const char *str); +const char *fdisk_parttype_get_string(const struct fdisk_parttype *t); +unsigned int fdisk_parttype_get_code(const struct fdisk_parttype *t); +const char *fdisk_parttype_get_name(const struct fdisk_parttype *t); +int fdisk_parttype_is_unknown(const struct fdisk_parttype *t); + + +/* field.c */ +extern int fdisk_field_get_id(const struct fdisk_field *field); +extern const char *fdisk_field_get_name(const struct fdisk_field *field); +extern double fdisk_field_get_width(const struct fdisk_field *field); +extern int fdisk_field_is_number(const struct fdisk_field *field); + + +/* label.c */ + +/** + * fdisk_fieldtype: + * + * Types of fdisk_field. The fields describe a partition. + */ +enum fdisk_fieldtype { + FDISK_FIELD_NONE = 0, + + /* generic */ + FDISK_FIELD_DEVICE, /* partition device name */ + FDISK_FIELD_START, /* start offset of the partition */ + FDISK_FIELD_END, /* end offset of the partition */ + FDISK_FIELD_SECTORS, /* number of sectors */ + FDISK_FIELD_CYLINDERS, /* number of cylinders (deprecated) */ + FDISK_FIELD_SIZE, /* partition size */ + FDISK_FIELD_TYPE, /* partition type */ + FDISK_FIELD_TYPEID, /* partition type ID */ + + /* label specific */ + FDISK_FIELD_ATTR, /* partition attribute (GPT) */ + FDISK_FIELD_BOOT, /* partition boot flag */ + FDISK_FIELD_BSIZE, /* size of the boot area (BSD) */ + FDISK_FIELD_CPG, /* BSD */ + FDISK_FIELD_EADDR, /* End-C/H/S (MBR) */ + FDISK_FIELD_FSIZE, /* BSD */ + FDISK_FIELD_NAME, /* partition label/name (GPT) */ + FDISK_FIELD_SADDR, /* Start-C/H/S (MBR) */ + FDISK_FIELD_UUID, /* partition UUID (GPT) */ + + FDISK_FIELD_FSUUID, + FDISK_FIELD_FSLABEL, + FDISK_FIELD_FSTYPE, + + FDISK_NFIELDS /* must be last */ +}; + +int fdisk_label_get_type(const struct fdisk_label *lb); +const char *fdisk_label_get_name(const struct fdisk_label *lb); +int fdisk_label_require_geometry(const struct fdisk_label *lb); + + +extern int fdisk_write_disklabel(struct fdisk_context *cxt); +extern int fdisk_verify_disklabel(struct fdisk_context *cxt); +extern int fdisk_create_disklabel(struct fdisk_context *cxt, const char *name); +extern int fdisk_list_disklabel(struct fdisk_context *cxt); +extern int fdisk_locate_disklabel(struct fdisk_context *cxt, int n, + const char **name, + uint64_t *offset, + size_t *size); + +/** + * fdisk_labelitem_gen: + * + * Generic disklabel items + */ +enum fdisk_labelitem_gen { + FDISK_LABELITEM_ID = 0, /* Unique disk identifier */ + + __FDISK_NLABELITEMS = 8 /* Specifies reserved range for generic items (0..7) */ +}; + +/* item.c */ +extern struct fdisk_labelitem *fdisk_new_labelitem(void); +extern void fdisk_ref_labelitem(struct fdisk_labelitem *li); +extern int fdisk_reset_labelitem(struct fdisk_labelitem *li); +extern void fdisk_unref_labelitem(struct fdisk_labelitem *li); +extern const char *fdisk_labelitem_get_name(struct fdisk_labelitem *li); +extern int fdisk_labelitem_get_id(struct fdisk_labelitem *li); +extern int fdisk_labelitem_get_data_u64(struct fdisk_labelitem *li, uint64_t *data); +extern int fdisk_labelitem_get_data_string(struct fdisk_labelitem *li, const char **data); +extern int fdisk_labelitem_is_string(struct fdisk_labelitem *li); +extern int fdisk_labelitem_is_number(struct fdisk_labelitem *li); + +extern int fdisk_get_disklabel_item(struct fdisk_context *cxt, int id, struct fdisk_labelitem *item); + +extern int fdisk_get_disklabel_id(struct fdisk_context *cxt, char **id); +extern int fdisk_set_disklabel_id(struct fdisk_context *cxt); + +extern int fdisk_get_partition(struct fdisk_context *cxt, size_t partno, struct fdisk_partition **pa); +extern int fdisk_set_partition(struct fdisk_context *cxt, size_t partno, struct fdisk_partition *pa); +extern int fdisk_add_partition(struct fdisk_context *cxt, struct fdisk_partition *pa, size_t *partno); +extern int fdisk_delete_partition(struct fdisk_context *cxt, size_t partno); +extern int fdisk_delete_all_partitions(struct fdisk_context *cxt); + +extern int fdisk_wipe_partition(struct fdisk_context *cxt, size_t partno, int enable); + +extern int fdisk_set_partition_type(struct fdisk_context *cxt, size_t partnum, + struct fdisk_parttype *t); + + +extern int fdisk_label_get_fields_ids( + const struct fdisk_label *lb, + struct fdisk_context *cxt, + int **ids, size_t *nids); + +extern int fdisk_label_get_fields_ids_all( + const struct fdisk_label *lb, + struct fdisk_context *cxt, + int **ids, size_t *nids); + +extern const struct fdisk_field *fdisk_label_get_field(const struct fdisk_label *lb, int id); +extern const struct fdisk_field *fdisk_label_get_field_by_name( + const struct fdisk_label *lb, + const char *name); + +extern void fdisk_label_set_changed(struct fdisk_label *lb, int changed); +extern int fdisk_label_is_changed(const struct fdisk_label *lb); + +extern void fdisk_label_set_disabled(struct fdisk_label *lb, int disabled); +extern int fdisk_label_is_disabled(const struct fdisk_label *lb); + +extern int fdisk_is_partition_used(struct fdisk_context *cxt, size_t n); + +extern int fdisk_toggle_partition_flag(struct fdisk_context *cxt, size_t partnum, unsigned long flag); + +extern struct fdisk_partition *fdisk_new_partition(void); +extern void fdisk_reset_partition(struct fdisk_partition *pa); +extern void fdisk_ref_partition(struct fdisk_partition *pa); +extern void fdisk_unref_partition(struct fdisk_partition *pa); +extern int fdisk_partition_is_freespace(struct fdisk_partition *pa); + +int fdisk_partition_set_start(struct fdisk_partition *pa, uint64_t off); +int fdisk_partition_unset_start(struct fdisk_partition *pa); +fdisk_sector_t fdisk_partition_get_start(struct fdisk_partition *pa); +int fdisk_partition_has_start(struct fdisk_partition *pa); +int fdisk_partition_cmp_start(struct fdisk_partition *a, + struct fdisk_partition *b); +int fdisk_partition_start_follow_default(struct fdisk_partition *pa, int enable); +int fdisk_partition_start_is_default(struct fdisk_partition *pa); + +int fdisk_partition_set_size(struct fdisk_partition *pa, uint64_t sz); +int fdisk_partition_unset_size(struct fdisk_partition *pa); +fdisk_sector_t fdisk_partition_get_size(struct fdisk_partition *pa); +int fdisk_partition_has_size(struct fdisk_partition *pa); +int fdisk_partition_size_explicit(struct fdisk_partition *pa, int enable); + +int fdisk_partition_has_end(struct fdisk_partition *pa); +fdisk_sector_t fdisk_partition_get_end(struct fdisk_partition *pa); + +int fdisk_partition_set_partno(struct fdisk_partition *pa, size_t num); +int fdisk_partition_unset_partno(struct fdisk_partition *pa); +size_t fdisk_partition_get_partno(struct fdisk_partition *pa); +int fdisk_partition_has_partno(struct fdisk_partition *pa); +int fdisk_partition_cmp_partno(struct fdisk_partition *a, + struct fdisk_partition *b); + +int fdisk_partition_partno_follow_default(struct fdisk_partition *pa, int enable); + +extern int fdisk_partition_set_type(struct fdisk_partition *pa, struct fdisk_parttype *type); +extern struct fdisk_parttype *fdisk_partition_get_type(struct fdisk_partition *pa); +extern int fdisk_partition_set_name(struct fdisk_partition *pa, const char *name); +extern const char *fdisk_partition_get_name(struct fdisk_partition *pa); +extern int fdisk_partition_set_uuid(struct fdisk_partition *pa, const char *uuid); +extern int fdisk_partition_set_attrs(struct fdisk_partition *pa, const char *attrs); +extern const char *fdisk_partition_get_uuid(struct fdisk_partition *pa); +extern const char *fdisk_partition_get_attrs(struct fdisk_partition *pa); +extern int fdisk_partition_is_nested(struct fdisk_partition *pa); +extern int fdisk_partition_is_container(struct fdisk_partition *pa); +extern int fdisk_partition_get_parent(struct fdisk_partition *pa, size_t *parent); +extern int fdisk_partition_is_used(struct fdisk_partition *pa); +extern int fdisk_partition_is_bootable(struct fdisk_partition *pa); +extern int fdisk_partition_is_wholedisk(struct fdisk_partition *pa); +extern int fdisk_partition_to_string(struct fdisk_partition *pa, + struct fdisk_context *cxt, + int id, char **data); + +int fdisk_partition_next_partno(struct fdisk_partition *pa, + struct fdisk_context *cxt, + size_t *n); + +extern int fdisk_partition_end_follow_default(struct fdisk_partition *pa, int enable); +extern int fdisk_partition_end_is_default(struct fdisk_partition *pa); + +extern int fdisk_reorder_partitions(struct fdisk_context *cxt); + +extern int fdisk_partition_has_wipe(struct fdisk_context *cxt, struct fdisk_partition *pa); + + +/* table.c */ +extern struct fdisk_table *fdisk_new_table(void); +extern int fdisk_reset_table(struct fdisk_table *tb); +extern void fdisk_ref_table(struct fdisk_table *tb); +extern void fdisk_unref_table(struct fdisk_table *tb); +extern size_t fdisk_table_get_nents(struct fdisk_table *tb); +extern int fdisk_table_is_empty(struct fdisk_table *tb); +extern int fdisk_table_add_partition(struct fdisk_table *tb, struct fdisk_partition *pa); +extern int fdisk_table_remove_partition(struct fdisk_table *tb, struct fdisk_partition *pa); + +extern int fdisk_get_partitions(struct fdisk_context *cxt, struct fdisk_table **tb); +extern int fdisk_get_freespaces(struct fdisk_context *cxt, struct fdisk_table **tb); + + +extern int fdisk_table_wrong_order(struct fdisk_table *tb); +extern int fdisk_table_sort_partitions(struct fdisk_table *tb, + int (*cmp)(struct fdisk_partition *, + struct fdisk_partition *)); + +extern int fdisk_table_next_partition( + struct fdisk_table *tb, + struct fdisk_iter *itr, + struct fdisk_partition **pa); + +extern struct fdisk_partition *fdisk_table_get_partition( + struct fdisk_table *tb, + size_t n); +extern struct fdisk_partition *fdisk_table_get_partition_by_partno( + struct fdisk_table *tb, + size_t partno); + +extern int fdisk_apply_table(struct fdisk_context *cxt, struct fdisk_table *tb); + +/* alignment.c */ +#define FDISK_ALIGN_UP 1 +#define FDISK_ALIGN_DOWN 2 +#define FDISK_ALIGN_NEAREST 3 + +fdisk_sector_t fdisk_align_lba(struct fdisk_context *cxt, fdisk_sector_t lba, int direction); +fdisk_sector_t fdisk_align_lba_in_range(struct fdisk_context *cxt, + fdisk_sector_t lba, fdisk_sector_t start, fdisk_sector_t stop); +int fdisk_lba_is_phy_aligned(struct fdisk_context *cxt, fdisk_sector_t lba); + +int fdisk_override_geometry(struct fdisk_context *cxt, + unsigned int cylinders, + unsigned int heads, + unsigned int sectors); +int fdisk_save_user_geometry(struct fdisk_context *cxt, + unsigned int cylinders, + unsigned int heads, + unsigned int sectors); +int fdisk_save_user_sector_size(struct fdisk_context *cxt, + unsigned int phy, + unsigned int log); + +int fdisk_save_user_grain(struct fdisk_context *cxt, unsigned long grain); + +int fdisk_has_user_device_properties(struct fdisk_context *cxt); +int fdisk_reset_alignment(struct fdisk_context *cxt); +int fdisk_reset_device_properties(struct fdisk_context *cxt); +int fdisk_reread_partition_table(struct fdisk_context *cxt); +int fdisk_reread_changes(struct fdisk_context *cxt, struct fdisk_table *org); + +/* iter.c */ +enum { + + FDISK_ITER_FORWARD = 0, + FDISK_ITER_BACKWARD +}; +extern struct fdisk_iter *fdisk_new_iter(int direction); +extern void fdisk_free_iter(struct fdisk_iter *itr); +extern void fdisk_reset_iter(struct fdisk_iter *itr, int direction); +extern int fdisk_iter_get_direction(struct fdisk_iter *itr); + + +/* dos.c */ +#define DOS_FLAG_ACTIVE 1 + +extern int fdisk_dos_move_begin(struct fdisk_context *cxt, size_t i); +extern int fdisk_dos_enable_compatible(struct fdisk_label *lb, int enable); +extern int fdisk_dos_is_compatible(struct fdisk_label *lb); + +/* sun.h */ +extern int fdisk_sun_set_alt_cyl(struct fdisk_context *cxt); +extern int fdisk_sun_set_xcyl(struct fdisk_context *cxt); +extern int fdisk_sun_set_ilfact(struct fdisk_context *cxt); +extern int fdisk_sun_set_rspeed(struct fdisk_context *cxt); +extern int fdisk_sun_set_pcylcount(struct fdisk_context *cxt); + +/** + * fdisk_labelitem_sun: + * + * SUN specific label items. + */ +enum fdisk_labelitem_sun { + SUN_LABELITEM_LABELID = __FDISK_NLABELITEMS, + SUN_LABELITEM_VTOCID, + SUN_LABELITEM_RPM, + SUN_LABELITEM_ACYL, + SUN_LABELITEM_PCYL, + SUN_LABELITEM_APC, + SUN_LABELITEM_INTRLV +}; + +/* bsd.c */ +extern int fdisk_bsd_edit_disklabel(struct fdisk_context *cxt); +extern int fdisk_bsd_write_bootstrap(struct fdisk_context *cxt); +extern int fdisk_bsd_link_partition(struct fdisk_context *cxt); + +/** + * fdisk_labelitem_bsd: + * + * BSD specific label items. + */ +enum fdisk_labelitem_bsd { + /* specific */ + BSD_LABELITEM_TYPE = __FDISK_NLABELITEMS, + BSD_LABELITEM_DISK, + BSD_LABELITEM_PACKNAME, + BSD_LABELITEM_FLAGS, + BSD_LABELITEM_SECSIZE, + BSD_LABELITEM_NTRACKS, + BSD_LABELITEM_SECPERCYL, + BSD_LABELITEM_CYLINDERS, + BSD_LABELITEM_RPM, + BSD_LABELITEM_INTERLEAVE, + BSD_LABELITEM_TRACKSKEW, + BSD_LABELITEM_CYLINDERSKEW, + BSD_LABELITEM_HEADSWITCH, + BSD_LABELITEM_TRKSEEK +}; + +/* sgi.h */ +#define SGI_FLAG_BOOT 1 +#define SGI_FLAG_SWAP 2 +extern int fdisk_sgi_set_bootfile(struct fdisk_context *cxt); +extern int fdisk_sgi_create_info(struct fdisk_context *cxt); + +/** + * fdisk_labelitem_sgi: + * + * SGI specific label items. + */ +enum fdisk_labelitem_sgi { + SGI_LABELITEM_PCYLCOUNT = __FDISK_NLABELITEMS, + SGI_LABELITEM_SPARECYL, + SGI_LABELITEM_ILFACT, + SGI_LABELITEM_BOOTFILE +}; + +/* gpt */ + +/* + * GPT partition attributes + */ + +/** + * GPT_FLAG_REQUIRED: + * + * GPT attribute; marks a partition as system partition (disk + * partitioning utilities must preserve the partition as is) + */ +#define GPT_FLAG_REQUIRED 1 + +/** + * GPT_FLAG_NOBLOCK: + * + * GPT attribute; EFI firmware should ignore the content of the + * partition and not try to read from it + */ +#define GPT_FLAG_NOBLOCK 2 + +/** + * GPT_FLAG_LEGACYBOOT: + * + * GPT attribute; use the partition for legacy boot method + */ +#define GPT_FLAG_LEGACYBOOT 3 + +/** + * GPT_FLAG_GUIDSPECIFIC: + * + * GPT attribute; for bites 48-63, defined and used by the individual partition + * type. + * + * The flag GPT_FLAG_GUIDSPECIFIC forces libfdisk to ask (by ask API) + * for a bit number. If you want to toggle specific bit and avoid any + * dialog, then use the bit number (in range 48..63). For example: + * + * // start dialog to ask for bit number + * fdisk_toggle_partition_flag(cxt, n, GPT_FLAG_GUIDSPECIFIC); + * + * // toggle bit 60 + * fdisk_toggle_partition_flag(cxt, n, 60); + */ +#define GPT_FLAG_GUIDSPECIFIC 4 + +extern int fdisk_gpt_is_hybrid(struct fdisk_context *cxt); +extern int fdisk_gpt_set_npartitions(struct fdisk_context *cxt, uint32_t entries); +extern int fdisk_gpt_get_partition_attrs(struct fdisk_context *cxt, size_t partnum, uint64_t *attrs); +extern int fdisk_gpt_set_partition_attrs(struct fdisk_context *cxt, size_t partnum, uint64_t attrs); + +/** + * fdisk_labelitem_gpt: + * + * GPT specific label items. + */ +enum fdisk_labelitem_gpt { + /* generic */ + GPT_LABELITEM_ID = FDISK_LABELITEM_ID, /* GPT disklabel UUID (!= partition UUID) */ + /* specific */ + GPT_LABELITEM_FIRSTLBA = __FDISK_NLABELITEMS, /* First Usable LBA */ + GPT_LABELITEM_LASTLBA, /* Last Usable LBA */ + GPT_LABELITEM_ALTLBA, /* Alternative LBA (backup header LBA) */ + GPT_LABELITEM_ENTRIESLBA, /* Partitions entires array LBA */ + GPT_LABELITEM_ENTRIESALLOC /* Number of allocated entries in entries array */ +}; + +/* script.c */ +struct fdisk_script *fdisk_new_script(struct fdisk_context *cxt); +struct fdisk_script *fdisk_new_script_from_file(struct fdisk_context *cxt, + const char *filename); +void fdisk_ref_script(struct fdisk_script *dp); +void fdisk_unref_script(struct fdisk_script *dp); + +const char *fdisk_script_get_header(struct fdisk_script *dp, const char *name); +int fdisk_script_set_header(struct fdisk_script *dp, const char *name, const char *data); +struct fdisk_table *fdisk_script_get_table(struct fdisk_script *dp); +int fdisk_script_get_nlines(struct fdisk_script *dp); +int fdisk_script_has_force_label(struct fdisk_script *dp); + +int fdisk_script_set_userdata(struct fdisk_script *dp, void *data); +void *fdisk_script_get_userdata(struct fdisk_script *dp); + +int fdisk_script_set_fgets(struct fdisk_script *dp, + char *(*fn_fgets)(struct fdisk_script *, char *, size_t, FILE *)); +int fdisk_script_read_context(struct fdisk_script *dp, struct fdisk_context *cxt); +int fdisk_script_enable_json(struct fdisk_script *dp, int json); +int fdisk_script_write_file(struct fdisk_script *dp, FILE *f); +int fdisk_script_read_file(struct fdisk_script *dp, FILE *f); +int fdisk_script_read_line(struct fdisk_script *dp, FILE *f, char *buf, size_t bufsz); + +int fdisk_set_script(struct fdisk_context *cxt, struct fdisk_script *dp); +struct fdisk_script *fdisk_get_script(struct fdisk_context *cxt); + +int fdisk_apply_script_headers(struct fdisk_context *cxt, struct fdisk_script *dp); +int fdisk_apply_script(struct fdisk_context *cxt, struct fdisk_script *dp); + + +/* ask.c */ +#define fdisk_is_ask(a, x) (fdisk_ask_get_type(a) == FDISK_ASKTYPE_ ## x) + +int fdisk_set_ask(struct fdisk_context *cxt, + int (*ask_cb)(struct fdisk_context *, struct fdisk_ask *, void *), + void *data); + + +void fdisk_ref_ask(struct fdisk_ask *ask); +void fdisk_unref_ask(struct fdisk_ask *ask); +const char *fdisk_ask_get_query(struct fdisk_ask *ask); +int fdisk_ask_get_type(struct fdisk_ask *ask); +const char *fdisk_ask_number_get_range(struct fdisk_ask *ask); +uint64_t fdisk_ask_number_get_default(struct fdisk_ask *ask); +uint64_t fdisk_ask_number_get_low(struct fdisk_ask *ask); +uint64_t fdisk_ask_number_get_high(struct fdisk_ask *ask); +uint64_t fdisk_ask_number_get_result(struct fdisk_ask *ask); +int fdisk_ask_number_set_result(struct fdisk_ask *ask, uint64_t result); +uint64_t fdisk_ask_number_get_base(struct fdisk_ask *ask); +uint64_t fdisk_ask_number_get_unit(struct fdisk_ask *ask); +int fdisk_ask_number_set_relative(struct fdisk_ask *ask, int relative); +int fdisk_ask_number_inchars(struct fdisk_ask *ask); +int fdisk_ask_partnum(struct fdisk_context *cxt, size_t *partnum, int wantnew); + +int fdisk_ask_number(struct fdisk_context *cxt, + uintmax_t low, + uintmax_t dflt, + uintmax_t high, + const char *query, + uintmax_t *result); +char *fdisk_ask_string_get_result(struct fdisk_ask *ask); +int fdisk_ask_string_set_result(struct fdisk_ask *ask, char *result); +int fdisk_ask_string(struct fdisk_context *cxt, + const char *query, + char **result); +int fdisk_ask_yesno(struct fdisk_context *cxt, + const char *query, + int *result); +int fdisk_ask_yesno_get_result(struct fdisk_ask *ask); +int fdisk_ask_yesno_set_result(struct fdisk_ask *ask, int result); +int fdisk_ask_menu_get_default(struct fdisk_ask *ask); +int fdisk_ask_menu_set_result(struct fdisk_ask *ask, int key); +int fdisk_ask_menu_get_result(struct fdisk_ask *ask, int *key); +int fdisk_ask_menu_get_item(struct fdisk_ask *ask, size_t idx, int *key, + const char **name, const char **desc); +size_t fdisk_ask_menu_get_nitems(struct fdisk_ask *ask); +int fdisk_ask_print_get_errno(struct fdisk_ask *ask); +const char *fdisk_ask_print_get_mesg(struct fdisk_ask *ask); + +int fdisk_info(struct fdisk_context *cxt, const char *fmt, ...); +int fdisk_warn(struct fdisk_context *cxt, const char *fmt, ...); +int fdisk_warnx(struct fdisk_context *cxt, const char *fmt, ...); + +/* utils.h */ +extern char *fdisk_partname(const char *dev, size_t partno); + +#ifdef __cplusplus +} +#endif + +#endif /* _LIBFDISK_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libltdl/lt_dlloader.h b/dingux/opt/mipsel-linux-uclibc/include/libltdl/lt_dlloader.h new file mode 100644 index 0000000..66cf047 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libltdl/lt_dlloader.h @@ -0,0 +1,91 @@ +/* lt_dlloader.h -- dynamic library loader interface + + Copyright (C) 2004, 2007-2008, 2011-2015 Free Software Foundation, + Inc. + Written by Gary V. Vaughan, 2004 + + NOTE: The canonical source of this file is maintained with the + GNU Libtool package. Report bugs to bug-libtool@gnu.org. + +GNU Libltdl is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +As a special exception to the GNU Lesser General Public License, +if you distribute this file as part of a program or library that +is built using GNU Libtool, you may include this file under the +same distribution terms that you use for the rest of that program. + +GNU Libltdl is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with GNU Libltdl; see the file COPYING.LIB. If not, a +copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, +or obtained by writing to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#if !defined LT_DLLOADER_H +#define LT_DLLOADER_H 1 + +#include + +LT_BEGIN_C_DECLS + +typedef void * lt_dlloader; +typedef void * lt_module; +typedef void * lt_user_data; +typedef struct lt__advise * lt_dladvise; + +/* Function pointer types for module loader vtable entries: */ +typedef lt_module lt_module_open (lt_user_data data, + const char *filename, + lt_dladvise advise); +typedef int lt_module_close (lt_user_data data, + lt_module module); +typedef void * lt_find_sym (lt_user_data data, lt_module module, + const char *symbolname); +typedef int lt_dlloader_init (lt_user_data data); +typedef int lt_dlloader_exit (lt_user_data data); + +/* Default priority is LT_DLLOADER_PREPEND if none is explicitly given. */ +typedef enum { + LT_DLLOADER_PREPEND = 0, LT_DLLOADER_APPEND +} lt_dlloader_priority; + +/* This structure defines a module loader, as populated by the get_vtable + entry point of each loader. */ +typedef struct { + const char * name; + const char * sym_prefix; + lt_module_open * module_open; + lt_module_close * module_close; + lt_find_sym * find_sym; + lt_dlloader_init * dlloader_init; + lt_dlloader_exit * dlloader_exit; + lt_user_data dlloader_data; + lt_dlloader_priority priority; +} lt_dlvtable; + +LT_SCOPE int lt_dlloader_add (const lt_dlvtable *vtable); +LT_SCOPE lt_dlloader lt_dlloader_next (const lt_dlloader loader); + +LT_SCOPE lt_dlvtable * lt_dlloader_remove (const char *name); +LT_SCOPE const lt_dlvtable *lt_dlloader_find (const char *name); +LT_SCOPE const lt_dlvtable *lt_dlloader_get (lt_dlloader loader); + + +/* Type of a function to get a loader's vtable: */ +typedef const lt_dlvtable *lt_get_vtable (lt_user_data data); + +#ifdef LT_DEBUG_LOADERS +LT_SCOPE void lt_dlloader_dump (void); +#endif + +LT_END_C_DECLS + +#endif /*!defined LT_DLLOADER_H*/ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libltdl/lt_error.h b/dingux/opt/mipsel-linux-uclibc/include/libltdl/lt_error.h new file mode 100644 index 0000000..367c36b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libltdl/lt_error.h @@ -0,0 +1,86 @@ +/* lt_error.h -- error propagation interface + + Copyright (C) 1999-2001, 2004, 2007, 2011-2015 Free Software + Foundation, Inc. + Written by Thomas Tanner, 1999 + + NOTE: The canonical source of this file is maintained with the + GNU Libtool package. Report bugs to bug-libtool@gnu.org. + +GNU Libltdl is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +As a special exception to the GNU Lesser General Public License, +if you distribute this file as part of a program or library that +is built using GNU Libtool, you may include this file under the +same distribution terms that you use for the rest of that program. + +GNU Libltdl is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with GNU Libltdl; see the file COPYING.LIB. If not, a +copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, +or obtained by writing to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +/* Only include this header file once. */ +#if !defined LT_ERROR_H +#define LT_ERROR_H 1 + +#include + +LT_BEGIN_C_DECLS + +/* Defining error strings alongside their symbolic names in a macro in + this way allows us to expand the macro in different contexts with + confidence that the enumeration of symbolic names will map correctly + onto the table of error strings. \0 is appended to the strings to + expilicitely initialize the string terminator. */ +#define lt_dlerror_table \ + LT_ERROR(UNKNOWN, "unknown error\0") \ + LT_ERROR(DLOPEN_NOT_SUPPORTED, "dlopen support not available\0") \ + LT_ERROR(INVALID_LOADER, "invalid loader\0") \ + LT_ERROR(INIT_LOADER, "loader initialization failed\0") \ + LT_ERROR(REMOVE_LOADER, "loader removal failed\0") \ + LT_ERROR(FILE_NOT_FOUND, "file not found\0") \ + LT_ERROR(DEPLIB_NOT_FOUND, "dependency library not found\0") \ + LT_ERROR(NO_SYMBOLS, "no symbols defined\0") \ + LT_ERROR(CANNOT_OPEN, "can't open the module\0") \ + LT_ERROR(CANNOT_CLOSE, "can't close the module\0") \ + LT_ERROR(SYMBOL_NOT_FOUND, "symbol not found\0") \ + LT_ERROR(NO_MEMORY, "not enough memory\0") \ + LT_ERROR(INVALID_HANDLE, "invalid module handle\0") \ + LT_ERROR(BUFFER_OVERFLOW, "internal buffer overflow\0") \ + LT_ERROR(INVALID_ERRORCODE, "invalid errorcode\0") \ + LT_ERROR(SHUTDOWN, "library already shutdown\0") \ + LT_ERROR(CLOSE_RESIDENT_MODULE, "can't close resident module\0") \ + LT_ERROR(INVALID_MUTEX_ARGS, "internal error (code withdrawn)\0")\ + LT_ERROR(INVALID_POSITION, "invalid search path insert position\0")\ + LT_ERROR(CONFLICTING_FLAGS, "symbol visibility can be global or local\0") + +/* Enumerate the symbolic error names. */ +enum { +#define LT_ERROR(name, diagnostic) LT_CONC(LT_ERROR_, name), + lt_dlerror_table +#undef LT_ERROR + + LT_ERROR_MAX +}; + +/* Should be max of the error string lengths above (plus one for C++) */ +#define LT_ERROR_LEN_MAX (41) + +/* These functions are only useful from inside custom module loaders. */ +LT_SCOPE int lt_dladderror (const char *diagnostic); +LT_SCOPE int lt_dlseterror (int errorcode); + + +LT_END_C_DECLS + +#endif /*!defined LT_ERROR_H*/ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libltdl/lt_system.h b/dingux/opt/mipsel-linux-uclibc/include/libltdl/lt_system.h new file mode 100644 index 0000000..a9bc7ec --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libltdl/lt_system.h @@ -0,0 +1,166 @@ +/* lt_system.h -- system portability abstraction layer + + Copyright (C) 2004, 2007, 2010-2015 Free Software Foundation, Inc. + Written by Gary V. Vaughan, 2004 + + NOTE: The canonical source of this file is maintained with the + GNU Libtool package. Report bugs to bug-libtool@gnu.org. + +GNU Libltdl is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +As a special exception to the GNU Lesser General Public License, +if you distribute this file as part of a program or library that +is built using GNU Libtool, you may include this file under the +same distribution terms that you use for the rest of that program. + +GNU Libltdl is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with GNU Libltdl; see the file COPYING.LIB. If not, a +copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, +or obtained by writing to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#if !defined LT_SYSTEM_H +#define LT_SYSTEM_H 1 + +#include +#include +#include + +/* Some systems do not define EXIT_*, even with STDC_HEADERS. */ +#if !defined EXIT_SUCCESS +# define EXIT_SUCCESS 0 +#endif +#if !defined EXIT_FAILURE +# define EXIT_FAILURE 1 +#endif + +/* Just pick a big number... */ +#define LT_FILENAME_MAX 2048 + + +/* Saves on those hard to debug '\0' typos.... */ +#define LT_EOS_CHAR '\0' + +/* LTDL_BEGIN_C_DECLS should be used at the beginning of your declarations, + so that C++ compilers don't mangle their names. Use LTDL_END_C_DECLS at + the end of C declarations. */ +#if defined __cplusplus +# define LT_BEGIN_C_DECLS extern "C" { +# define LT_END_C_DECLS } +#else +# define LT_BEGIN_C_DECLS /* empty */ +# define LT_END_C_DECLS /* empty */ +#endif + +/* LT_STMT_START/END are used to create macros that expand to a + a single compound statement in a portable way. */ +#if defined __GNUC__ && !defined __STRICT_ANSI__ && !defined __cplusplus +# define LT_STMT_START (void)( +# define LT_STMT_END ) +#else +# if (defined sun || defined __sun__) +# define LT_STMT_START if (1) +# define LT_STMT_END else (void)0 +# else +# define LT_STMT_START do +# define LT_STMT_END while (0) +# endif +#endif + +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined __osf__ +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +/* Canonicalise Windows and Cygwin recognition macros. + To match the values set by recent Cygwin compilers, make sure that if + __CYGWIN__ is defined (after canonicalisation), __WINDOWS__ is NOT! */ +#if defined __CYGWIN32__ && !defined __CYGWIN__ +# define __CYGWIN__ __CYGWIN32__ +#endif +#if defined __CYGWIN__ +# if defined __WINDOWS__ +# undef __WINDOWS__ +# endif +#elif defined _WIN32 +# define __WINDOWS__ _WIN32 +#elif defined WIN32 +# define __WINDOWS__ WIN32 +#endif +#if defined __CYGWIN__ && defined __WINDOWS__ +# undef __WINDOWS__ +#endif + + +/* DLL building support on win32 hosts; mostly to workaround their + ridiculous implementation of data symbol exporting. */ +#if !defined LT_SCOPE +# if defined __WINDOWS__ || defined __CYGWIN__ +# if defined DLL_EXPORT /* defined by libtool (if required) */ +# define LT_SCOPE extern __declspec(dllexport) +# endif +# if defined LIBLTDL_DLL_IMPORT /* define if linking with this dll */ + /* note: cygwin/mingw compilers can rely instead on auto-import */ +# define LT_SCOPE extern __declspec(dllimport) +# endif +# endif +# if !defined LT_SCOPE /* static linking or !__WINDOWS__ */ +# define LT_SCOPE extern +# endif +#endif + +#if defined __WINDOWS__ +/* LT_DIRSEP_CHAR is accepted *in addition* to '/' as a directory + separator when it is set. */ +# define LT_DIRSEP_CHAR '\\' +# define LT_PATHSEP_CHAR ';' +#else +# define LT_PATHSEP_CHAR ':' +#endif + +#if defined _MSC_VER /* Visual Studio */ +# define R_OK 4 +#endif + +/* fopen() mode flags for reading a text file */ +#undef LT_READTEXT_MODE +#if defined __WINDOWS__ || defined __CYGWIN__ +# define LT_READTEXT_MODE "rt" +#else +# define LT_READTEXT_MODE "r" +#endif + +/* The extra indirection to the LT__STR and LT__CONC macros is required so + that if the arguments to LT_STR() (or LT_CONC()) are themselves macros, + they will be expanded before being quoted. */ +#ifndef LT_STR +# define LT__STR(arg) #arg +# define LT_STR(arg) LT__STR(arg) +#endif + +#ifndef LT_CONC +# define LT__CONC(a, b) a##b +# define LT_CONC(a, b) LT__CONC(a, b) +#endif +#ifndef LT_CONC3 +# define LT__CONC3(a, b, c) a##b##c +# define LT_CONC3(a, b, c) LT__CONC3(a, b, c) +#endif + +#endif /*!defined LT_SYSTEM_H*/ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libmount/libmount.h b/dingux/opt/mipsel-linux-uclibc/include/libmount/libmount.h new file mode 100644 index 0000000..8bb93a0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libmount/libmount.h @@ -0,0 +1,956 @@ +/* + * mount.h - libmount API + * + * Copyright (C) 2008-2009 Karel Zak + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef _LIBMOUNT_MOUNT_H +#define _LIBMOUNT_MOUNT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#define LIBMOUNT_VERSION "2.31.1" +#define LIBMOUNT_MAJOR_VERSION 2 +#define LIBMOUNT_MINOR_VERSION 31 +#define LIBMOUNT_PATCH_VERSION 1 + +/** + * libmnt_cache: + * + * Stores canonicalized paths and evaluated tags + */ +struct libmnt_cache; + +/** + * libmnt_lock: + * + * Stores information about the locked file (e.g. /etc/mtab) + */ +struct libmnt_lock; + +/** + * libmnt_iter: + * + * Generic iterator (stores state about lists) + */ +struct libmnt_iter; + +/** + * libmnt_optmap: + * @name: option name[=type] where type is printf-like type specifier") + * @id: option ID or MS_* flags (e.g MS_RDONLY) + * @mask: MNT_{NOMTAB,INVERT,...} mask + * + * Mount options description (map) + */ +struct libmnt_optmap +{ + const char *name; + int id; + int mask; +}; + +/* + * mount options map masks + */ +#define MNT_INVERT (1 << 1) /* invert the mountflag */ +#define MNT_NOMTAB (1 << 2) /* skip in the mtab option string */ +#define MNT_PREFIX (1 << 3) /* prefix used for some options (e.g. "x-foo") */ +#define MNT_NOHLPS (1 << 4) /* don't add the option to mount. helpers command line */ + +/** + * libmnt_fs: + * + * Parsed fstab/mtab/mountinfo entry + */ +struct libmnt_fs; + +/** + * libmnt_table: + * + * List of struct libmnt_fs entries (parsed fstab/mtab/mountinfo) + */ +struct libmnt_table; + +/** + * libmnt_update + * + * /etc/mtab or utab update description + */ +struct libmnt_update; + +/** + * libmnt_context + * + * Mount/umount status + */ +struct libmnt_context; + +/** + * libmnt_monitor + * + * Mount tables monitor + */ +struct libmnt_monitor; + +/** + * libmnt_tabdiff: + * + * Stores mountinfo state + */ +struct libmnt_tabdiff; + +/* + * Actions + */ +enum { + MNT_ACT_MOUNT = 1, + MNT_ACT_UMOUNT +}; + +/* + * Errors -- by default libmount returns -errno for generic errors (ENOMEM, + * EINVAL, ...) and for mount(2) errors, but for some specific operations it + * returns private error codes. Note that maximum system errno value should be + * 4095 on UNIXes. + * + * See also mnt_context_get_syscall_errno() and mnt_context_get_helper_status(). + */ +/** + * MNT_ERR_NOFSTAB: + * + * not found required entry in fstab + */ +#define MNT_ERR_NOFSTAB 5000 +/** + * MNT_ERR_NOFSTYPE: + * + * failed to detect filesystem type + */ +#define MNT_ERR_NOFSTYPE 5001 +/** + * MNT_ERR_NOSOURCE: + * + * required mount source undefined + */ +#define MNT_ERR_NOSOURCE 5002 +/** + * MNT_ERR_LOOPDEV: + * + * loopdev setup failed, errno set by libc + */ +#define MNT_ERR_LOOPDEV 5003 +/** + * MNT_ERR_MOUNTOPT: + * + * failed to parse/use userspace mount options + */ +#define MNT_ERR_MOUNTOPT 5004 +/** + * MNT_ERR_APPLYFLAGS: + * + * failed to apply MS_PROPAGATION flags + */ +#define MNT_ERR_APPLYFLAGS 5005 +/** + * MNT_ERR_AMBIFS: + * + * libblkid detected more filesystems on the device + */ +#define MNT_ERR_AMBIFS 5006 +/** + * MNT_ERR_LOOPOVERLAP: + * + * detected overlapping loop device that cannot be re-used + */ +#define MNT_ERR_LOOPOVERLAP 5007 +/** + * MNT_ERR_LOCK: + * + * failed to lock mtab/utab or so. + */ +#define MNT_ERR_LOCK 5008 + + +/* + * Overall return codes -- based on mount(8) and umount(8) return codes. + * See mnt_context_get_excode() for more details. + */ + +/** + * MNT_EX_SUCCESS: + * + * [u]mount(8) exit code: no errors + */ +#define MNT_EX_SUCCESS 0 + +/** + * MNT_EX_USAGE: + * + * [u]mount(8) exit code: incorrect invocation or permission + */ +#define MNT_EX_USAGE 1 + +/** + * MNT_EX_SYSERR: + * + * [u]mount(8) exit code: out of memory, cannot fork, ... + */ + +#define MNT_EX_SYSERR 2 + +/** + * MNT_EX_SOFTWARE: + * + * [u]mount(8) exit code: internal mount bug or wrong version + */ +#define MNT_EX_SOFTWARE 4 + +/** + * MNT_EX_USER: + * + * [u]mount(8) exit code: user interrupt + */ +#define MNT_EX_USER 8 + +/** + * MNT_EX_FILEIO: + * + * [u]mount(8) exit code: problems writing, locking, ... mtab/utab + */ +#define MNT_EX_FILEIO 16 + +/** + * MNT_EX_FAIL: + * + * [u]mount(8) exit code: mount failure + */ +#define MNT_EX_FAIL 32 + +/** + * MNT_EX_SOMEOK: + * + * [u]mount(8) exit code: some mount succeeded; usually when executed with + * --all options. Never returned by libmount. + */ +#define MNT_EX_SOMEOK 64 + + + +#ifndef __GNUC_PREREQ +# if defined __GNUC__ && defined __GNUC_MINOR__ +# define __GNUC_PREREQ(maj, min) ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) +# else +# define __GNUC_PREREQ(maj, min) 0 +# endif +#endif + +#ifndef __ul_attribute__ +# if __GNUC_PREREQ (3, 4) +# define __ul_attribute__(_a_) __attribute__(_a_) +# else +# define __ul_attribute__(_a_) +# endif +#endif + + +/* init.c */ +extern void mnt_init_debug(int mask); + +/* version.c */ +extern int mnt_parse_version_string(const char *ver_string); +extern int mnt_get_library_version(const char **ver_string); +extern int mnt_get_library_features(const char ***features); + +/* utils.c */ +extern char *mnt_mangle(const char *str) + __ul_attribute__((warn_unused_result)); +extern char *mnt_unmangle(const char *str) + __ul_attribute__((warn_unused_result)); + +extern int mnt_tag_is_valid(const char *tag); +extern int mnt_fstype_is_netfs(const char *type); +extern int mnt_fstype_is_pseudofs(const char *type); + +extern int mnt_match_fstype(const char *type, const char *pattern) + __ul_attribute__((warn_unused_result)); +extern int mnt_match_options(const char *optstr, const char *pattern) + __ul_attribute__((warn_unused_result)); +extern const char *mnt_get_fstab_path(void); +extern const char *mnt_get_swaps_path(void); +extern const char *mnt_get_mtab_path(void); +extern int mnt_has_regular_mtab(const char **mtab, int *writable); +extern char *mnt_get_mountpoint(const char *path) + __ul_attribute__((warn_unused_result)); + +/* cache.c */ +extern struct libmnt_cache *mnt_new_cache(void) + __ul_attribute__((warn_unused_result)); +extern void mnt_free_cache(struct libmnt_cache *cache); + +extern void mnt_ref_cache(struct libmnt_cache *cache); +extern void mnt_unref_cache(struct libmnt_cache *cache); + +extern int mnt_cache_set_targets(struct libmnt_cache *cache, + struct libmnt_table *mtab); +extern int mnt_cache_read_tags(struct libmnt_cache *cache, const char *devname); + +extern int mnt_cache_device_has_tag(struct libmnt_cache *cache, + const char *devname, + const char *token, + const char *value); + +extern char *mnt_cache_find_tag_value(struct libmnt_cache *cache, + const char *devname, const char *token); + +extern char *mnt_get_fstype(const char *devname, int *ambi, + struct libmnt_cache *cache) + __ul_attribute__((warn_unused_result)); +extern char *mnt_resolve_path(const char *path, struct libmnt_cache *cache) + __ul_attribute__((warn_unused_result)); +extern char *mnt_resolve_target(const char *path, struct libmnt_cache *cache) + __ul_attribute__((warn_unused_result)); +extern char *mnt_resolve_tag(const char *token, const char *value, + struct libmnt_cache *cache) + __ul_attribute__((warn_unused_result)); +extern char *mnt_resolve_spec(const char *spec, struct libmnt_cache *cache) + __ul_attribute__((warn_unused_result)); +extern char *mnt_pretty_path(const char *path, struct libmnt_cache *cache) + __ul_attribute__((warn_unused_result)); + +/* optstr.c */ +extern int mnt_optstr_next_option(char **optstr, char **name, size_t *namesz, + char **value, size_t *valuesz); +extern int mnt_optstr_append_option(char **optstr, const char *name, + const char *value); +extern int mnt_optstr_prepend_option(char **optstr, const char *name, + const char *value); + +extern int mnt_optstr_get_option(const char *optstr, const char *name, + char **value, size_t *valsz); +extern int mnt_optstr_set_option(char **optstr, const char *name, + const char *value); +extern int mnt_optstr_remove_option(char **optstr, const char *name); +extern int mnt_optstr_deduplicate_option(char **optstr, const char *name); + +extern int mnt_split_optstr(const char *optstr, + char **user, char **vfs, char **fs, + int ignore_user, int ignore_vfs); + +extern int mnt_optstr_get_options(const char *optstr, char **subset, + const struct libmnt_optmap *map, int ignore); + +extern int mnt_optstr_get_flags(const char *optstr, unsigned long *flags, + const struct libmnt_optmap *map); + +extern int mnt_optstr_apply_flags(char **optstr, unsigned long flags, + const struct libmnt_optmap *map); + +/* iter.c */ +enum { + + MNT_ITER_FORWARD = 0, + MNT_ITER_BACKWARD +}; +extern struct libmnt_iter *mnt_new_iter(int direction) + __ul_attribute__((warn_unused_result)); +extern void mnt_free_iter(struct libmnt_iter *itr); + +extern void mnt_reset_iter(struct libmnt_iter *itr, int direction) + __ul_attribute__((nonnull)); +extern int mnt_iter_get_direction(struct libmnt_iter *itr) + __ul_attribute__((nonnull)); + +/* optmap.c */ +enum { + MNT_LINUX_MAP = 1, + MNT_USERSPACE_MAP +}; +extern const struct libmnt_optmap *mnt_get_builtin_optmap(int id); + +/* lock.c */ +extern struct libmnt_lock *mnt_new_lock(const char *datafile, pid_t id) + __ul_attribute__((warn_unused_result)); +extern void mnt_free_lock(struct libmnt_lock *ml); + +extern void mnt_unlock_file(struct libmnt_lock *ml); +extern int mnt_lock_file(struct libmnt_lock *ml); +extern int mnt_lock_block_signals(struct libmnt_lock *ml, int enable); + +/* fs.c */ +extern struct libmnt_fs *mnt_new_fs(void) + __ul_attribute__((warn_unused_result)); +extern void mnt_free_fs(struct libmnt_fs *fs); +extern void mnt_ref_fs(struct libmnt_fs *fs); +extern void mnt_unref_fs(struct libmnt_fs *fs); + +extern void mnt_reset_fs(struct libmnt_fs *fs); +extern struct libmnt_fs *mnt_copy_fs(struct libmnt_fs *dest, + const struct libmnt_fs *src) + __ul_attribute__((warn_unused_result)); +extern void *mnt_fs_get_userdata(struct libmnt_fs *fs); +extern int mnt_fs_set_userdata(struct libmnt_fs *fs, void *data); +extern const char *mnt_fs_get_source(struct libmnt_fs *fs); +extern int mnt_fs_set_source(struct libmnt_fs *fs, const char *source); +extern const char *mnt_fs_get_srcpath(struct libmnt_fs *fs); + +extern int mnt_fs_get_tag(struct libmnt_fs *fs, const char **name, + const char **value); +extern const char *mnt_fs_get_target(struct libmnt_fs *fs); +extern int mnt_fs_set_target(struct libmnt_fs *fs, const char *tgt); +extern const char *mnt_fs_get_fstype(struct libmnt_fs *fs); +extern int mnt_fs_set_fstype(struct libmnt_fs *fs, const char *fstype); + +extern int mnt_fs_streq_srcpath(struct libmnt_fs *fs, const char *path) + __ul_attribute__((warn_unused_result)); +extern int mnt_fs_streq_target(struct libmnt_fs *fs, const char *path) + __ul_attribute__((warn_unused_result)); + +extern char *mnt_fs_strdup_options(struct libmnt_fs *fs) + __ul_attribute__((warn_unused_result)); +extern const char *mnt_fs_get_options(struct libmnt_fs *fs) + __ul_attribute__((warn_unused_result)); +extern const char *mnt_fs_get_optional_fields(struct libmnt_fs *fs) + __ul_attribute__((warn_unused_result)); +extern int mnt_fs_get_propagation(struct libmnt_fs *fs, unsigned long *flags); + +extern int mnt_fs_set_options(struct libmnt_fs *fs, const char *optstr); +extern int mnt_fs_append_options(struct libmnt_fs *fs, const char *optstr); +extern int mnt_fs_prepend_options(struct libmnt_fs *fs, const char *optstr); + +extern int mnt_fs_get_option(struct libmnt_fs *fs, const char *name, + char **value, size_t *valsz); + +extern const char *mnt_fs_get_fs_options(struct libmnt_fs *fs); +extern const char *mnt_fs_get_vfs_options(struct libmnt_fs *fs); +extern const char *mnt_fs_get_user_options(struct libmnt_fs *fs); + +extern const char *mnt_fs_get_attributes(struct libmnt_fs *fs); +extern int mnt_fs_set_attributes(struct libmnt_fs *fs, const char *optstr); +extern int mnt_fs_get_attribute(struct libmnt_fs *fs, const char *name, + char **value, size_t *valsz); +extern int mnt_fs_append_attributes(struct libmnt_fs *fs, const char *optstr); +extern int mnt_fs_prepend_attributes(struct libmnt_fs *fs, const char *optstr); + +extern int mnt_fs_get_freq(struct libmnt_fs *fs); +extern int mnt_fs_set_freq(struct libmnt_fs *fs, int freq); +extern int mnt_fs_get_passno(struct libmnt_fs *fs); +extern int mnt_fs_set_passno(struct libmnt_fs *fs, int passno); +extern const char *mnt_fs_get_root(struct libmnt_fs *fs); +extern int mnt_fs_set_root(struct libmnt_fs *fs, const char *path); +extern const char *mnt_fs_get_bindsrc(struct libmnt_fs *fs); +extern int mnt_fs_set_bindsrc(struct libmnt_fs *fs, const char *src); +extern int mnt_fs_get_id(struct libmnt_fs *fs); +extern int mnt_fs_get_parent_id(struct libmnt_fs *fs); +extern dev_t mnt_fs_get_devno(struct libmnt_fs *fs); +extern pid_t mnt_fs_get_tid(struct libmnt_fs *fs); + +extern const char *mnt_fs_get_swaptype(struct libmnt_fs *fs); +extern off_t mnt_fs_get_size(struct libmnt_fs *fs); +extern off_t mnt_fs_get_usedsize(struct libmnt_fs *fs); +extern int mnt_fs_get_priority(struct libmnt_fs *fs); +extern int mnt_fs_set_priority(struct libmnt_fs *fs, int prio); + +extern const char *mnt_fs_get_comment(struct libmnt_fs *fs); +extern int mnt_fs_set_comment(struct libmnt_fs *fs, const char *comm); +extern int mnt_fs_append_comment(struct libmnt_fs *fs, const char *comm); + +extern int mnt_fs_match_target(struct libmnt_fs *fs, const char *target, + struct libmnt_cache *cache); +extern int mnt_fs_match_source(struct libmnt_fs *fs, const char *source, + struct libmnt_cache *cache); +extern int mnt_fs_match_fstype(struct libmnt_fs *fs, const char *types); +extern int mnt_fs_match_options(struct libmnt_fs *fs, const char *options); +extern int mnt_fs_print_debug(struct libmnt_fs *fs, FILE *file); + +extern int mnt_fs_is_kernel(struct libmnt_fs *fs); +extern int mnt_fs_is_swaparea(struct libmnt_fs *fs); +extern int mnt_fs_is_netfs(struct libmnt_fs *fs); +extern int mnt_fs_is_pseudofs(struct libmnt_fs *fs); + +extern void mnt_free_mntent(struct mntent *mnt); +extern int mnt_fs_to_mntent(struct libmnt_fs *fs, struct mntent **mnt); + +/* tab-parse.c */ +extern struct libmnt_table *mnt_new_table_from_file(const char *filename) + __ul_attribute__((warn_unused_result)); +extern struct libmnt_table *mnt_new_table_from_dir(const char *dirname) + __ul_attribute__((warn_unused_result)); +extern int mnt_table_parse_stream(struct libmnt_table *tb, FILE *f, + const char *filename); +extern int mnt_table_parse_file(struct libmnt_table *tb, const char *filename); +extern int mnt_table_parse_dir(struct libmnt_table *tb, const char *dirname); + +extern int mnt_table_parse_fstab(struct libmnt_table *tb, const char *filename); +extern int mnt_table_parse_swaps(struct libmnt_table *tb, const char *filename); +extern int mnt_table_parse_mtab(struct libmnt_table *tb, const char *filename); +extern int mnt_table_set_parser_errcb(struct libmnt_table *tb, + int (*cb)(struct libmnt_table *tb, const char *filename, int line)); + +/* tab.c */ +extern struct libmnt_table *mnt_new_table(void) + __ul_attribute__((warn_unused_result)); +extern void mnt_free_table(struct libmnt_table *tb); + +extern void mnt_ref_table(struct libmnt_table *tb); +extern void mnt_unref_table(struct libmnt_table *tb); + +extern int mnt_reset_table(struct libmnt_table *tb); +extern int mnt_table_get_nents(struct libmnt_table *tb); +extern int mnt_table_is_empty(struct libmnt_table *tb); + +extern int mnt_table_set_userdata(struct libmnt_table *tb, void *data); +extern void *mnt_table_get_userdata(struct libmnt_table *tb); + +extern void mnt_table_enable_comments(struct libmnt_table *tb, int enable); +extern int mnt_table_with_comments(struct libmnt_table *tb); +extern const char *mnt_table_get_intro_comment(struct libmnt_table *tb); +extern int mnt_table_set_intro_comment(struct libmnt_table *tb, const char *comm); +extern int mnt_table_append_intro_comment(struct libmnt_table *tb, const char *comm); +extern int mnt_table_set_trailing_comment(struct libmnt_table *tb, const char *comm); +extern const char *mnt_table_get_trailing_comment(struct libmnt_table *tb); +extern int mnt_table_append_trailing_comment(struct libmnt_table *tb, const char *comm); + +extern int mnt_table_set_cache(struct libmnt_table *tb, struct libmnt_cache *mpc); +extern struct libmnt_cache *mnt_table_get_cache(struct libmnt_table *tb); +extern int mnt_table_add_fs(struct libmnt_table *tb, struct libmnt_fs *fs); +extern int mnt_table_remove_fs(struct libmnt_table *tb, struct libmnt_fs *fs); +extern int mnt_table_first_fs(struct libmnt_table *tb, struct libmnt_fs **fs); +extern int mnt_table_last_fs(struct libmnt_table *tb, struct libmnt_fs **fs); +extern int mnt_table_next_fs(struct libmnt_table *tb, struct libmnt_iter *itr, + struct libmnt_fs **fs); +extern int mnt_table_next_child_fs(struct libmnt_table *tb, struct libmnt_iter *itr, + struct libmnt_fs *parent, struct libmnt_fs **chld); +extern int mnt_table_get_root_fs(struct libmnt_table *tb, struct libmnt_fs **root); +extern int mnt_table_set_iter(struct libmnt_table *tb, struct libmnt_iter *itr, + struct libmnt_fs *fs); + +enum { + MNT_UNIQ_FORWARD = (1 << 1), /* default is backward */ + MNT_UNIQ_KEEPTREE = (1 << 2) +}; +extern int mnt_table_uniq_fs(struct libmnt_table *tb, int flags, + int (*cmp)(struct libmnt_table *, + struct libmnt_fs *, + struct libmnt_fs *)); + +extern struct libmnt_fs *mnt_table_find_mountpoint(struct libmnt_table *tb, + const char *path, int direction); +extern struct libmnt_fs *mnt_table_find_target(struct libmnt_table *tb, + const char *path, int direction); +extern struct libmnt_fs *mnt_table_find_srcpath(struct libmnt_table *tb, + const char *path, int direction); +extern struct libmnt_fs *mnt_table_find_tag(struct libmnt_table *tb, const char *tag, + const char *val, int direction); +extern struct libmnt_fs *mnt_table_find_target_with_option(struct libmnt_table *tb, const char *path, + const char *option, const char *val, int direction); +extern struct libmnt_fs *mnt_table_find_source(struct libmnt_table *tb, + const char *source, int direction); +extern struct libmnt_fs *mnt_table_find_pair(struct libmnt_table *tb, + const char *source, + const char *target, int direction); +extern struct libmnt_fs *mnt_table_find_devno(struct libmnt_table *tb, + dev_t devno, int direction); + +extern int mnt_table_find_next_fs(struct libmnt_table *tb, + struct libmnt_iter *itr, + int (*match_func)(struct libmnt_fs *, void *), + void *userdata, + struct libmnt_fs **fs); + +extern int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs); + +/* tab_update.c */ +extern struct libmnt_update *mnt_new_update(void) + __ul_attribute__((warn_unused_result)); +extern void mnt_free_update(struct libmnt_update *upd); + +extern int mnt_table_replace_file(struct libmnt_table *tb, const char *filename); +extern int mnt_table_write_file(struct libmnt_table *tb, FILE *file); + +extern int mnt_update_is_ready(struct libmnt_update *upd); +extern int mnt_update_set_fs(struct libmnt_update *upd, unsigned long mountflags, + const char *target, struct libmnt_fs *fs); +extern int mnt_update_table(struct libmnt_update *upd, struct libmnt_lock *lc); +extern unsigned long mnt_update_get_mflags(struct libmnt_update *upd); +extern int mnt_update_force_rdonly(struct libmnt_update *upd, int rdonly); +extern const char *mnt_update_get_filename(struct libmnt_update *upd); +extern struct libmnt_fs *mnt_update_get_fs(struct libmnt_update *upd); + +/* tab_diff.c */ +enum { + MNT_TABDIFF_MOUNT = 1, + MNT_TABDIFF_UMOUNT, + MNT_TABDIFF_MOVE, + MNT_TABDIFF_REMOUNT, + MNT_TABDIFF_PROPAGATION, /* not implemented yet (TODO) */ +}; + +extern struct libmnt_tabdiff *mnt_new_tabdiff(void) + __ul_attribute__((warn_unused_result)); +extern void mnt_free_tabdiff(struct libmnt_tabdiff *df); + +extern int mnt_diff_tables(struct libmnt_tabdiff *df, + struct libmnt_table *old_tab, + struct libmnt_table *new_tab); + +extern int mnt_tabdiff_next_change(struct libmnt_tabdiff *df, + struct libmnt_iter *itr, + struct libmnt_fs **old_fs, + struct libmnt_fs **new_fs, + int *oper); + +/* monitor.c */ +enum { + MNT_MONITOR_TYPE_USERSPACE = 1, /* userspace mount options */ + MNT_MONITOR_TYPE_KERNEL /* kernel mount table */ +}; + +extern struct libmnt_monitor *mnt_new_monitor(void); +extern void mnt_ref_monitor(struct libmnt_monitor *mn); +extern void mnt_unref_monitor(struct libmnt_monitor *mn); + +extern int mnt_monitor_enable_kernel(struct libmnt_monitor *mn, int enable); +extern int mnt_monitor_enable_userspace(struct libmnt_monitor *mn, + int enable, const char *filename); + +extern int mnt_monitor_get_fd(struct libmnt_monitor *mn); +extern int mnt_monitor_close_fd(struct libmnt_monitor *mn); +extern int mnt_monitor_wait(struct libmnt_monitor *mn, int timeout); + +extern int mnt_monitor_next_change(struct libmnt_monitor *mn, + const char **filename, int *type); +extern int mnt_monitor_event_cleanup(struct libmnt_monitor *mn); + + +/* context.c */ + +/* + * Mode for mount options from fstab (or mtab), see mnt_context_set_optsmode(). + */ +enum { + MNT_OMODE_IGNORE = (1 << 1), /* ignore mtab/fstab options */ + MNT_OMODE_APPEND = (1 << 2), /* append mtab/fstab options to existing options */ + MNT_OMODE_PREPEND = (1 << 3), /* prepend mtab/fstab options to existing options */ + MNT_OMODE_REPLACE = (1 << 4), /* replace existing options with options from mtab/fstab */ + + MNT_OMODE_FORCE = (1 << 5), /* always read mtab/fstab options */ + + MNT_OMODE_FSTAB = (1 << 10), /* read from fstab */ + MNT_OMODE_MTAB = (1 << 11), /* read from mtab if fstab not enabled or failed */ + MNT_OMODE_NOTAB = (1 << 12), /* do not read fstab/mtab at all */ + + /* default */ + MNT_OMODE_AUTO = (MNT_OMODE_PREPEND | MNT_OMODE_FSTAB | MNT_OMODE_MTAB), + /* non-root users */ + MNT_OMODE_USER = (MNT_OMODE_REPLACE | MNT_OMODE_FORCE | MNT_OMODE_FSTAB) +}; + +extern struct libmnt_context *mnt_new_context(void) + __ul_attribute__((warn_unused_result)); +extern void mnt_free_context(struct libmnt_context *cxt); + +extern int mnt_reset_context(struct libmnt_context *cxt); +extern int mnt_context_is_restricted(struct libmnt_context *cxt) + __ul_attribute__((nonnull)); + +extern int mnt_context_init_helper(struct libmnt_context *cxt, + int action, int flags); +extern int mnt_context_helper_setopt(struct libmnt_context *cxt, int c, char *arg); + +extern int mnt_context_set_optsmode(struct libmnt_context *cxt, int mode); +extern int mnt_context_disable_canonicalize(struct libmnt_context *cxt, int disable); +extern int mnt_context_enable_lazy(struct libmnt_context *cxt, int enable); +extern int mnt_context_enable_rdonly_umount(struct libmnt_context *cxt, int enable); +extern int mnt_context_enable_rwonly_mount(struct libmnt_context *cxt, int enable); +extern int mnt_context_disable_helpers(struct libmnt_context *cxt, int disable); +extern int mnt_context_enable_sloppy(struct libmnt_context *cxt, int enable); +extern int mnt_context_enable_fake(struct libmnt_context *cxt, int enable); +extern int mnt_context_disable_mtab(struct libmnt_context *cxt, int disable); +extern int mnt_context_enable_force(struct libmnt_context *cxt, int enable); +extern int mnt_context_enable_verbose(struct libmnt_context *cxt, int enable); +extern int mnt_context_enable_loopdel(struct libmnt_context *cxt, int enable); +extern int mnt_context_enable_fork(struct libmnt_context *cxt, int enable); +extern int mnt_context_disable_swapmatch(struct libmnt_context *cxt, int disable); + +extern int mnt_context_get_optsmode(struct libmnt_context *cxt); + +extern int mnt_context_is_lazy(struct libmnt_context *cxt) + __ul_attribute__((nonnull)); +extern int mnt_context_is_rdonly_umount(struct libmnt_context *cxt) + __ul_attribute__((nonnull)); +extern int mnt_context_is_rwonly_mount(struct libmnt_context *cxt) + __ul_attribute__((nonnull)); +extern int mnt_context_is_sloppy(struct libmnt_context *cxt) + __ul_attribute__((nonnull)); +extern int mnt_context_is_fake(struct libmnt_context *cxt) + __ul_attribute__((nonnull)); +extern int mnt_context_is_nomtab(struct libmnt_context *cxt) + __ul_attribute__((nonnull)); +extern int mnt_context_is_force(struct libmnt_context *cxt) + __ul_attribute__((nonnull)); +extern int mnt_context_is_verbose(struct libmnt_context *cxt) + __ul_attribute__((nonnull)); +extern int mnt_context_is_loopdel(struct libmnt_context *cxt) + __ul_attribute__((nonnull)); +extern int mnt_context_is_nohelpers(struct libmnt_context *cxt) + __ul_attribute__((nonnull)); +extern int mnt_context_is_nocanonicalize(struct libmnt_context *cxt) + __ul_attribute__((nonnull)); +extern int mnt_context_is_swapmatch(struct libmnt_context *cxt) + __ul_attribute__((nonnull)); +extern int mnt_context_forced_rdonly(struct libmnt_context *cxt) + __ul_attribute__((nonnull)); + +extern int mnt_context_is_fork(struct libmnt_context *cxt) + __ul_attribute__((nonnull)); +extern int mnt_context_is_parent(struct libmnt_context *cxt) + __ul_attribute__((nonnull)); +extern int mnt_context_is_child(struct libmnt_context *cxt) + __ul_attribute__((nonnull)); + +extern int mnt_context_wait_for_children(struct libmnt_context *cxt, + int *nchildren, int *nerrs); + +extern int mnt_context_is_fs_mounted(struct libmnt_context *cxt, + struct libmnt_fs *fs, int *mounted); +extern int mnt_context_set_fs(struct libmnt_context *cxt, struct libmnt_fs *fs); +extern struct libmnt_fs *mnt_context_get_fs(struct libmnt_context *cxt); + +extern int mnt_context_set_source(struct libmnt_context *cxt, const char *source); +extern int mnt_context_set_target(struct libmnt_context *cxt, const char *target); +extern int mnt_context_set_fstype(struct libmnt_context *cxt, const char *fstype); + +extern const char *mnt_context_get_source(struct libmnt_context *cxt); +extern const char *mnt_context_get_target(struct libmnt_context *cxt); +extern const char *mnt_context_get_fstype(struct libmnt_context *cxt); + +extern void *mnt_context_get_mtab_userdata(struct libmnt_context *cxt); +extern void *mnt_context_get_fstab_userdata(struct libmnt_context *cxt); +extern void *mnt_context_get_fs_userdata(struct libmnt_context *cxt); + +extern int mnt_context_set_options(struct libmnt_context *cxt, const char *optstr); +extern int mnt_context_append_options(struct libmnt_context *cxt, const char *optstr); + +extern const char *mnt_context_get_options(struct libmnt_context *cxt); + +extern int mnt_context_set_fstype_pattern(struct libmnt_context *cxt, const char *pattern); +extern int mnt_context_set_options_pattern(struct libmnt_context *cxt, const char *pattern); + +extern int mnt_context_set_passwd_cb(struct libmnt_context *cxt, + char *(*get)(struct libmnt_context *), + void (*release)(struct libmnt_context *, char *)) + __ul_attribute__((deprecated)); + +extern int mnt_context_set_tables_errcb(struct libmnt_context *cxt, + int (*cb)(struct libmnt_table *tb, const char *filename, int line)); +extern int mnt_context_set_fstab(struct libmnt_context *cxt, + struct libmnt_table *tb); +extern int mnt_context_get_fstab(struct libmnt_context *cxt, + struct libmnt_table **tb); + +extern int mnt_context_get_mtab(struct libmnt_context *cxt, + struct libmnt_table **tb); +extern int mnt_context_get_table(struct libmnt_context *cxt, + const char *filename, + struct libmnt_table **tb); +extern int mnt_context_set_cache(struct libmnt_context *cxt, + struct libmnt_cache *cache); +extern struct libmnt_cache *mnt_context_get_cache(struct libmnt_context *cxt); +extern struct libmnt_lock *mnt_context_get_lock(struct libmnt_context *cxt); +extern int mnt_context_set_mflags(struct libmnt_context *cxt, + unsigned long flags); +extern int mnt_context_get_mflags(struct libmnt_context *cxt, + unsigned long *flags); +extern int mnt_context_set_user_mflags(struct libmnt_context *cxt, + unsigned long flags); +extern int mnt_context_get_user_mflags(struct libmnt_context *cxt, + unsigned long *flags); + +extern int mnt_context_set_mountdata(struct libmnt_context *cxt, void *data); +extern int mnt_context_apply_fstab(struct libmnt_context *cxt); + +extern int mnt_context_reset_status(struct libmnt_context *cxt); +extern int mnt_context_get_status(struct libmnt_context *cxt); + +extern int mnt_context_helper_executed(struct libmnt_context *cxt); +extern int mnt_context_get_helper_status(struct libmnt_context *cxt); + +extern int mnt_context_syscall_called(struct libmnt_context *cxt); + +extern int mnt_context_get_syscall_errno(struct libmnt_context *cxt); + +extern int mnt_context_strerror(struct libmnt_context *cxt, char *buf, + size_t bufsiz) + __ul_attribute__((deprecated)); + +extern int mnt_context_get_excode(struct libmnt_context *cxt, + int rc, char *buf, size_t bufsz); + + +/* context_mount.c */ +extern int mnt_context_mount(struct libmnt_context *cxt); +extern int mnt_context_umount(struct libmnt_context *cxt); +extern int mnt_context_next_mount(struct libmnt_context *cxt, + struct libmnt_iter *itr, + struct libmnt_fs **fs, + int *mntrc, int *ignored); + +extern int mnt_context_prepare_mount(struct libmnt_context *cxt) + __ul_attribute__((warn_unused_result)); +extern int mnt_context_do_mount(struct libmnt_context *cxt); +extern int mnt_context_finalize_mount(struct libmnt_context *cxt); + +/* context_umount.c */ +extern int mnt_context_find_umount_fs(struct libmnt_context *cxt, + const char *tgt, + struct libmnt_fs **pfs); +extern int mnt_context_next_umount(struct libmnt_context *cxt, + struct libmnt_iter *itr, + struct libmnt_fs **fs, + int *mntrc, int *ignored); + +extern int mnt_context_prepare_umount(struct libmnt_context *cxt) + __ul_attribute__((warn_unused_result)); +extern int mnt_context_do_umount(struct libmnt_context *cxt); +extern int mnt_context_finalize_umount(struct libmnt_context *cxt); + +extern int mnt_context_tab_applied(struct libmnt_context *cxt); +extern int mnt_context_set_syscall_status(struct libmnt_context *cxt, int status); + +/* + * mount(8) userspace options masks (MNT_MAP_USERSPACE map) + */ +#define MNT_MS_NOAUTO (1 << 2) +#define MNT_MS_USER (1 << 3) +#define MNT_MS_USERS (1 << 4) +#define MNT_MS_OWNER (1 << 5) +#define MNT_MS_GROUP (1 << 6) +#define MNT_MS_NETDEV (1 << 7) +#define MNT_MS_COMMENT (1 << 8) +#define MNT_MS_LOOP (1 << 9) +#define MNT_MS_NOFAIL (1 << 10) +#define MNT_MS_UHELPER (1 << 11) +#define MNT_MS_HELPER (1 << 12) +#define MNT_MS_XCOMMENT (1 << 13) +#define MNT_MS_OFFSET (1 << 14) +#define MNT_MS_SIZELIMIT (1 << 15) +#define MNT_MS_ENCRYPTION (1 << 16) +#define MNT_MS_XFSTABCOMM (1 << 17) + +/* + * mount(2) MS_* masks (MNT_MAP_LINUX map) + */ +#ifndef MS_RDONLY +#define MS_RDONLY 1 /* Mount read-only */ +#endif +#ifndef MS_NOSUID +#define MS_NOSUID 2 /* Ignore suid and sgid bits */ +#endif +#ifndef MS_NODEV +#define MS_NODEV 4 /* Disallow access to device special files */ +#endif +#ifndef MS_NOEXEC +#define MS_NOEXEC 8 /* Disallow program execution */ +#endif +#ifndef MS_SYNCHRONOUS +#define MS_SYNCHRONOUS 16 /* Writes are synced at once */ +#endif +#ifndef MS_REMOUNT +#define MS_REMOUNT 32 /* Alter flags of a mounted FS */ +#endif +#ifndef MS_MANDLOCK +#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ +#endif +#ifndef MS_DIRSYNC +#define MS_DIRSYNC 128 /* Directory modifications are synchronous */ +#endif +#ifndef MS_NOATIME +#define MS_NOATIME 0x400 /* 1024: Do not update access times. */ +#endif +#ifndef MS_NODIRATIME +#define MS_NODIRATIME 0x800 /* 2048: Don't update directory access times */ +#endif +#ifndef MS_BIND +#define MS_BIND 0x1000 /* 4096: Mount existing tree elsewhere as well */ +#endif +#ifndef MS_MOVE +#define MS_MOVE 0x2000 /* 8192: Atomically move the tree */ +#endif +#ifndef MS_REC +#define MS_REC 0x4000 /* 16384: Recursive loopback */ +#endif +#ifndef MS_SILENT +#define MS_SILENT 0x8000 /* 32768: Don't emit certain kernel messages */ +#endif +#ifndef MS_UNBINDABLE +#define MS_UNBINDABLE (1<<17) /* 131072: Make unbindable */ +#endif +#ifndef MS_PRIVATE +#define MS_PRIVATE (1<<18) /* 262144: Make private */ +#endif +#ifndef MS_SLAVE +#define MS_SLAVE (1<<19) /* 524288: Make slave */ +#endif +#ifndef MS_SHARED +#define MS_SHARED (1<<20) /* 1048576: Make shared */ +#endif +#ifndef MS_RELATIME +#define MS_RELATIME (1<<21) /* 2097152: Update atime relative to mtime/ctime */ +#endif +#ifndef MS_I_VERSION +#define MS_I_VERSION (1<<23) /* Update the inode I_version field */ +#endif +#ifndef MS_STRICTATIME +#define MS_STRICTATIME (1<<24) /* Always perform atime updates */ +#endif +#ifndef MS_LAZYTIME +#define MS_LAZYTIME (1<<25) /* Update the on-disk [acm]times lazily */ +#endif + + +/* + * Magic mount flag number. Had to be or-ed to the flag values. + */ +#ifndef MS_MGC_VAL +#define MS_MGC_VAL 0xC0ED0000 /* magic flag number to indicate "new" flags */ +#endif +#ifndef MS_MGC_MSK +#define MS_MGC_MSK 0xffff0000 /* magic flag number mask */ +#endif + + +/* Shared-subtree options */ +#define MS_PROPAGATION (MS_SHARED|MS_SLAVE|MS_UNBINDABLE|MS_PRIVATE) + +/* Options that we make ordinary users have by default. */ +#define MS_SECURE (MS_NOEXEC|MS_NOSUID|MS_NODEV) + +/* Options that we make owner-mounted devices have by default */ +#define MS_OWNERSECURE (MS_NOSUID|MS_NODEV) + +#ifdef __cplusplus +} +#endif + +#endif /* _LIBMOUNT_MOUNT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libsmartcols/libsmartcols.h b/dingux/opt/mipsel-linux-uclibc/include/libsmartcols/libsmartcols.h new file mode 100644 index 0000000..b08b544 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libsmartcols/libsmartcols.h @@ -0,0 +1,309 @@ +/* + * Prints table or tree. + * + * Copyright (C) 2014 Ondrej Oprala + * Copyright (C) 2014 Karel Zak + * + * This file may be redistributed under the terms of the + * GNU Lesser General Public License. + */ +#ifndef _LIBSMARTCOLS_H +#define _LIBSMARTCOLS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +/** + * LIBSMARTCOLS_VERSION: + * + * Library version string + */ +#define LIBSMARTCOLS_VERSION "2.31.1" + +/** + * libscols_iter: + * + * Generic iterator + */ +struct libscols_iter; + +/** + * libscols_symbols: + * + * Symbol groups for printing tree hierarchies + */ +struct libscols_symbols; + +/** + * libscols_cell: + * + * A cell - the smallest library object + */ +struct libscols_cell; + +/** + * libscols_line: + * + * A line - an array of cells + */ +struct libscols_line; + +/** + * libscols_table: + * + * A table - The most abstract object, encapsulating lines, columns, symbols and cells + */ +struct libscols_table; + +/** + * libscols_column: + * + * A column - defines the number of columns and column names + */ +struct libscols_column; + +/* iter.c */ +enum { + + SCOLS_ITER_FORWARD = 0, + SCOLS_ITER_BACKWARD +}; + +/* + * Column flags + */ +enum { + SCOLS_FL_TRUNC = (1 << 0), /* truncate fields data if necessary */ + SCOLS_FL_TREE = (1 << 1), /* use tree "ascii art" */ + SCOLS_FL_RIGHT = (1 << 2), /* align to the right */ + SCOLS_FL_STRICTWIDTH = (1 << 3), /* don't reduce width if column is empty */ + SCOLS_FL_NOEXTREMES = (1 << 4), /* ignore extreme fields when count column width*/ + SCOLS_FL_HIDDEN = (1 << 5), /* maintain data, but don't print */ + SCOLS_FL_WRAP = (1 << 6) /* wrap long lines to multi-line cells */ +}; + +/* + * Cell flags, see scols_cell_set_flags() before use + */ +enum { + /* alignment evaluated in order: right,center,left */ + SCOLS_CELL_FL_LEFT = 0, + SCOLS_CELL_FL_CENTER = (1 << 0), + SCOLS_CELL_FL_RIGHT = (1 << 1) +}; + +extern struct libscols_iter *scols_new_iter(int direction); +extern void scols_free_iter(struct libscols_iter *itr); +extern void scols_reset_iter(struct libscols_iter *itr, int direction); +extern int scols_iter_get_direction(const struct libscols_iter *itr); + +/* init.c */ +extern void scols_init_debug(int mask); + +/* version.c */ +extern int scols_parse_version_string(const char *ver_string); +extern int scols_get_library_version(const char **ver_string); + +/* symbols.c */ +extern struct libscols_symbols *scols_new_symbols(void); +extern void scols_ref_symbols(struct libscols_symbols *sy); +extern void scols_unref_symbols(struct libscols_symbols *sy); +extern struct libscols_symbols *scols_copy_symbols(const struct libscols_symbols *sy); +extern int scols_symbols_set_branch(struct libscols_symbols *sy, const char *str); +extern int scols_symbols_set_vertical(struct libscols_symbols *sy, const char *str); +extern int scols_symbols_set_right(struct libscols_symbols *sy, const char *str); +extern int scols_symbols_set_title_padding(struct libscols_symbols *sy, const char *str); +extern int scols_symbols_set_cell_padding(struct libscols_symbols *sy, const char *str); + +/* cell.c */ +extern int scols_reset_cell(struct libscols_cell *ce); +extern int scols_cell_copy_content(struct libscols_cell *dest, + const struct libscols_cell *src); +extern int scols_cell_set_data(struct libscols_cell *ce, const char *data); +extern int scols_cell_refer_data(struct libscols_cell *ce, char *data); +extern const char *scols_cell_get_data(const struct libscols_cell *ce); +extern int scols_cell_set_color(struct libscols_cell *ce, const char *color); +extern const char *scols_cell_get_color(const struct libscols_cell *ce); + +extern int scols_cell_set_flags(struct libscols_cell *ce, int flags); +extern int scols_cell_get_flags(const struct libscols_cell *ce); +extern int scols_cell_get_alignment(const struct libscols_cell *ce); + +extern void *scols_cell_get_userdata(struct libscols_cell *ce); +extern int scols_cell_set_userdata(struct libscols_cell *ce, void *data); + +extern int scols_cmpstr_cells(struct libscols_cell *a, + struct libscols_cell *b, void *data); +/* column.c */ +extern int scols_column_is_tree(const struct libscols_column *cl); +extern int scols_column_is_trunc(const struct libscols_column *cl); +extern int scols_column_is_right(const struct libscols_column *cl); +extern int scols_column_is_strict_width(const struct libscols_column *cl); +extern int scols_column_is_hidden(const struct libscols_column *cl); +extern int scols_column_is_noextremes(const struct libscols_column *cl); +extern int scols_column_is_wrap(const struct libscols_column *cl); +extern int scols_column_is_customwrap(const struct libscols_column *cl); + +extern size_t scols_column_get_width(const struct libscols_column *cl); + +extern int scols_column_set_safechars(struct libscols_column *cl, const char *safe); +extern const char *scols_column_get_safechars(const struct libscols_column *cl); + +extern int scols_column_set_flags(struct libscols_column *cl, int flags); +extern int scols_column_get_flags(const struct libscols_column *cl); +extern struct libscols_column *scols_new_column(void); +extern void scols_ref_column(struct libscols_column *cl); +extern void scols_unref_column(struct libscols_column *cl); +extern struct libscols_column *scols_copy_column(const struct libscols_column *cl); +extern int scols_column_set_whint(struct libscols_column *cl, double whint); +extern double scols_column_get_whint(const struct libscols_column *cl); +extern struct libscols_cell *scols_column_get_header(struct libscols_column *cl); +extern int scols_column_set_color(struct libscols_column *cl, const char *color); +extern const char *scols_column_get_color(const struct libscols_column *cl); +extern struct libscols_table *scols_column_get_table(const struct libscols_column *cl); + +extern int scols_column_set_cmpfunc(struct libscols_column *cl, + int (*cmp)(struct libscols_cell *a, + struct libscols_cell *b, void *), + void *data); + +extern int scols_column_set_wrapfunc(struct libscols_column *cl, + size_t (*wrap_chunksize)(const struct libscols_column *, + const char *, void *), + char * (*wrap_nextchunk)(const struct libscols_column *, + char *, void *), + void *userdata); + +extern char *scols_wrapnl_nextchunk(const struct libscols_column *cl, char *data, void *userdata); +extern size_t scols_wrapnl_chunksize(const struct libscols_column *cl, const char *data, void *userdata); + +/* line.c */ +extern struct libscols_line *scols_new_line(void); +extern void scols_ref_line(struct libscols_line *ln); +extern void scols_unref_line(struct libscols_line *ln); +extern int scols_line_alloc_cells(struct libscols_line *ln, size_t n); +extern void scols_line_free_cells(struct libscols_line *ln); +extern int scols_line_set_userdata(struct libscols_line *ln, void *data); +extern void *scols_line_get_userdata(struct libscols_line *ln); +extern int scols_line_remove_child(struct libscols_line *ln, struct libscols_line *child); +extern int scols_line_add_child(struct libscols_line *ln, struct libscols_line *child); +extern int scols_line_has_children(struct libscols_line *ln); +extern int scols_line_is_ancestor(struct libscols_line *ln, struct libscols_line *parent); +extern int scols_line_next_child(struct libscols_line *ln, + struct libscols_iter *itr, struct libscols_line **chld); +extern struct libscols_line *scols_line_get_parent(const struct libscols_line *ln); +extern int scols_line_set_color(struct libscols_line *ln, const char *color); +extern const char *scols_line_get_color(const struct libscols_line *ln); +extern size_t scols_line_get_ncells(const struct libscols_line *ln); +extern struct libscols_cell *scols_line_get_cell(struct libscols_line *ln, size_t n); +extern struct libscols_cell *scols_line_get_column_cell( + struct libscols_line *ln, + struct libscols_column *cl); +extern int scols_line_set_data(struct libscols_line *ln, size_t n, const char *data); +extern int scols_line_refer_data(struct libscols_line *ln, size_t n, char *data); +extern int scols_line_set_column_data(struct libscols_line *ln, struct libscols_column *cl, const char *data); +extern int scols_line_refer_column_data(struct libscols_line *ln, struct libscols_column *cl, char *data); +extern struct libscols_line *scols_copy_line(const struct libscols_line *ln); + +/* table */ +extern int scols_table_colors_wanted(const struct libscols_table *tb); +extern int scols_table_set_name(struct libscols_table *tb, const char *name); +extern const char *scols_table_get_name(const struct libscols_table *tb); +extern struct libscols_cell *scols_table_get_title(struct libscols_table *tb); +extern int scols_table_is_raw(const struct libscols_table *tb); +extern int scols_table_is_ascii(const struct libscols_table *tb); +extern int scols_table_is_json(const struct libscols_table *tb); +extern int scols_table_is_noheadings(const struct libscols_table *tb); +extern int scols_table_is_header_repeat(const struct libscols_table *tb); +extern int scols_table_is_empty(const struct libscols_table *tb); +extern int scols_table_is_export(const struct libscols_table *tb); +extern int scols_table_is_maxout(const struct libscols_table *tb); +extern int scols_table_is_nowrap(const struct libscols_table *tb); +extern int scols_table_is_nolinesep(const struct libscols_table *tb); +extern int scols_table_is_tree(const struct libscols_table *tb); +extern int scols_table_is_noencoding(const struct libscols_table *tb); + +extern int scols_table_enable_colors(struct libscols_table *tb, int enable); +extern int scols_table_enable_raw(struct libscols_table *tb, int enable); +extern int scols_table_enable_ascii(struct libscols_table *tb, int enable); +extern int scols_table_enable_json(struct libscols_table *tb, int enable); +extern int scols_table_enable_noheadings(struct libscols_table *tb, int enable); +extern int scols_table_enable_header_repeat(struct libscols_table *tb, int enable); +extern int scols_table_enable_export(struct libscols_table *tb, int enable); +extern int scols_table_enable_maxout(struct libscols_table *tb, int enable); +extern int scols_table_enable_nowrap(struct libscols_table *tb, int enable); +extern int scols_table_enable_nolinesep(struct libscols_table *tb, int enable); +extern int scols_table_enable_noencoding(struct libscols_table *tb, int enable); + +extern int scols_table_set_column_separator(struct libscols_table *tb, const char *sep); +extern int scols_table_set_line_separator(struct libscols_table *tb, const char *sep); + +extern struct libscols_table *scols_new_table(void); +extern void scols_ref_table(struct libscols_table *tb); +extern void scols_unref_table(struct libscols_table *tb); +extern int scols_table_add_column(struct libscols_table *tb, struct libscols_column *cl); +extern int scols_table_remove_column(struct libscols_table *tb, struct libscols_column *cl); +extern int scols_table_remove_columns(struct libscols_table *tb); +extern int scols_table_move_column(struct libscols_table *tb, struct libscols_column *pre, struct libscols_column *cl); +extern struct libscols_column *scols_table_new_column(struct libscols_table *tb, const char *name, double whint, int flags); +extern int scols_table_next_column(struct libscols_table *tb, struct libscols_iter *itr, struct libscols_column **cl); +extern const char *scols_table_get_column_separator(const struct libscols_table *tb); +extern const char *scols_table_get_line_separator(const struct libscols_table *tb); +extern size_t scols_table_get_ncols(const struct libscols_table *tb); +extern size_t scols_table_get_nlines(const struct libscols_table *tb); +extern struct libscols_column *scols_table_get_column(struct libscols_table *tb, size_t n); +extern int scols_table_add_line(struct libscols_table *tb, struct libscols_line *ln); +extern int scols_table_remove_line(struct libscols_table *tb, struct libscols_line *ln); +extern void scols_table_remove_lines(struct libscols_table *tb); +extern int scols_table_next_line(struct libscols_table *tb, struct libscols_iter *itr, struct libscols_line **ln); +extern struct libscols_line *scols_table_new_line(struct libscols_table *tb, struct libscols_line *parent); +extern struct libscols_line *scols_table_get_line(struct libscols_table *tb, size_t n); +extern struct libscols_table *scols_copy_table(struct libscols_table *tb); +extern int scols_table_set_symbols(struct libscols_table *tb, struct libscols_symbols *sy); +extern int scols_table_set_default_symbols(struct libscols_table *tb); +extern struct libscols_symbols *scols_table_get_symbols(const struct libscols_table *tb); + +extern int scols_table_set_stream(struct libscols_table *tb, FILE *stream); +extern FILE *scols_table_get_stream(const struct libscols_table *tb); +extern int scols_table_reduce_termwidth(struct libscols_table *tb, size_t reduce); + +extern int scols_sort_table(struct libscols_table *tb, struct libscols_column *cl); +extern int scols_sort_table_by_tree(struct libscols_table *tb); +/* + * + */ +enum { + SCOLS_TERMFORCE_AUTO = 0, + SCOLS_TERMFORCE_NEVER, + SCOLS_TERMFORCE_ALWAYS +}; +extern int scols_table_set_termforce(struct libscols_table *tb, int force); +extern int scols_table_get_termforce(const struct libscols_table *tb); +extern int scols_table_set_termwidth(struct libscols_table *tb, size_t width); +extern size_t scols_table_get_termwidth(const struct libscols_table *tb); +extern int scols_table_set_termheight(struct libscols_table *tb, size_t height); +extern size_t scols_table_get_termheight(const struct libscols_table *tb); + + +/* table_print.c */ +extern int scols_print_table(struct libscols_table *tb); +extern int scols_print_table_to_string(struct libscols_table *tb, char **data); + +extern int scols_table_print_range( struct libscols_table *tb, + struct libscols_line *start, + struct libscols_line *end); +extern int scols_table_print_range_to_string( struct libscols_table *tb, + struct libscols_line *start, + struct libscols_line *end, + char **data); + +#ifdef __cplusplus +} +#endif + +#endif /* _LIBSMARTCOLS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/DOCBparser.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/DOCBparser.h new file mode 100644 index 0000000..9394fa7 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/DOCBparser.h @@ -0,0 +1,96 @@ +/* + * Summary: old DocBook SGML parser + * Description: interface for a DocBook SGML non-verifying parser + * This code is DEPRECATED, and should not be used anymore. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __DOCB_PARSER_H__ +#define __DOCB_PARSER_H__ +#include + +#ifdef LIBXML_DOCB_ENABLED + +#include +#include + +#ifndef IN_LIBXML +#ifdef __GNUC__ +#warning "The DOCBparser module has been deprecated in libxml2-2.6.0" +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Most of the back-end structures from XML and SGML are shared. + */ +typedef xmlParserCtxt docbParserCtxt; +typedef xmlParserCtxtPtr docbParserCtxtPtr; +typedef xmlSAXHandler docbSAXHandler; +typedef xmlSAXHandlerPtr docbSAXHandlerPtr; +typedef xmlParserInput docbParserInput; +typedef xmlParserInputPtr docbParserInputPtr; +typedef xmlDocPtr docbDocPtr; + +/* + * There is only few public functions. + */ +XMLPUBFUN int XMLCALL + docbEncodeEntities(unsigned char *out, + int *outlen, + const unsigned char *in, + int *inlen, int quoteChar); + +XMLPUBFUN docbDocPtr XMLCALL + docbSAXParseDoc (xmlChar *cur, + const char *encoding, + docbSAXHandlerPtr sax, + void *userData); +XMLPUBFUN docbDocPtr XMLCALL + docbParseDoc (xmlChar *cur, + const char *encoding); +XMLPUBFUN docbDocPtr XMLCALL + docbSAXParseFile (const char *filename, + const char *encoding, + docbSAXHandlerPtr sax, + void *userData); +XMLPUBFUN docbDocPtr XMLCALL + docbParseFile (const char *filename, + const char *encoding); + +/** + * Interfaces for the Push mode. + */ +XMLPUBFUN void XMLCALL + docbFreeParserCtxt (docbParserCtxtPtr ctxt); +XMLPUBFUN docbParserCtxtPtr XMLCALL + docbCreatePushParserCtxt(docbSAXHandlerPtr sax, + void *user_data, + const char *chunk, + int size, + const char *filename, + xmlCharEncoding enc); +XMLPUBFUN int XMLCALL + docbParseChunk (docbParserCtxtPtr ctxt, + const char *chunk, + int size, + int terminate); +XMLPUBFUN docbParserCtxtPtr XMLCALL + docbCreateFileParserCtxt(const char *filename, + const char *encoding); +XMLPUBFUN int XMLCALL + docbParseDocument (docbParserCtxtPtr ctxt); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_DOCB_ENABLED */ + +#endif /* __DOCB_PARSER_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/HTMLparser.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/HTMLparser.h new file mode 100644 index 0000000..1d4fec2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/HTMLparser.h @@ -0,0 +1,306 @@ +/* + * Summary: interface for an HTML 4.0 non-verifying parser + * Description: this module implements an HTML 4.0 non-verifying parser + * with API compatible with the XML parser ones. It should + * be able to parse "real world" HTML, even if severely + * broken from a specification point of view. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __HTML_PARSER_H__ +#define __HTML_PARSER_H__ +#include +#include + +#ifdef LIBXML_HTML_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Most of the back-end structures from XML and HTML are shared. + */ +typedef xmlParserCtxt htmlParserCtxt; +typedef xmlParserCtxtPtr htmlParserCtxtPtr; +typedef xmlParserNodeInfo htmlParserNodeInfo; +typedef xmlSAXHandler htmlSAXHandler; +typedef xmlSAXHandlerPtr htmlSAXHandlerPtr; +typedef xmlParserInput htmlParserInput; +typedef xmlParserInputPtr htmlParserInputPtr; +typedef xmlDocPtr htmlDocPtr; +typedef xmlNodePtr htmlNodePtr; + +/* + * Internal description of an HTML element, representing HTML 4.01 + * and XHTML 1.0 (which share the same structure). + */ +typedef struct _htmlElemDesc htmlElemDesc; +typedef htmlElemDesc *htmlElemDescPtr; +struct _htmlElemDesc { + const char *name; /* The tag name */ + char startTag; /* Whether the start tag can be implied */ + char endTag; /* Whether the end tag can be implied */ + char saveEndTag; /* Whether the end tag should be saved */ + char empty; /* Is this an empty element ? */ + char depr; /* Is this a deprecated element ? */ + char dtd; /* 1: only in Loose DTD, 2: only Frameset one */ + char isinline; /* is this a block 0 or inline 1 element */ + const char *desc; /* the description */ + +/* NRK Jan.2003 + * New fields encapsulating HTML structure + * + * Bugs: + * This is a very limited representation. It fails to tell us when + * an element *requires* subelements (we only have whether they're + * allowed or not), and it doesn't tell us where CDATA and PCDATA + * are allowed. Some element relationships are not fully represented: + * these are flagged with the word MODIFIER + */ + const char** subelts; /* allowed sub-elements of this element */ + const char* defaultsubelt; /* subelement for suggested auto-repair + if necessary or NULL */ + const char** attrs_opt; /* Optional Attributes */ + const char** attrs_depr; /* Additional deprecated attributes */ + const char** attrs_req; /* Required attributes */ +}; + +/* + * Internal description of an HTML entity. + */ +typedef struct _htmlEntityDesc htmlEntityDesc; +typedef htmlEntityDesc *htmlEntityDescPtr; +struct _htmlEntityDesc { + unsigned int value; /* the UNICODE value for the character */ + const char *name; /* The entity name */ + const char *desc; /* the description */ +}; + +/* + * There is only few public functions. + */ +XMLPUBFUN const htmlElemDesc * XMLCALL + htmlTagLookup (const xmlChar *tag); +XMLPUBFUN const htmlEntityDesc * XMLCALL + htmlEntityLookup(const xmlChar *name); +XMLPUBFUN const htmlEntityDesc * XMLCALL + htmlEntityValueLookup(unsigned int value); + +XMLPUBFUN int XMLCALL + htmlIsAutoClosed(htmlDocPtr doc, + htmlNodePtr elem); +XMLPUBFUN int XMLCALL + htmlAutoCloseTag(htmlDocPtr doc, + const xmlChar *name, + htmlNodePtr elem); +XMLPUBFUN const htmlEntityDesc * XMLCALL + htmlParseEntityRef(htmlParserCtxtPtr ctxt, + const xmlChar **str); +XMLPUBFUN int XMLCALL + htmlParseCharRef(htmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + htmlParseElement(htmlParserCtxtPtr ctxt); + +XMLPUBFUN htmlParserCtxtPtr XMLCALL + htmlNewParserCtxt(void); + +XMLPUBFUN htmlParserCtxtPtr XMLCALL + htmlCreateMemoryParserCtxt(const char *buffer, + int size); + +XMLPUBFUN int XMLCALL + htmlParseDocument(htmlParserCtxtPtr ctxt); +XMLPUBFUN htmlDocPtr XMLCALL + htmlSAXParseDoc (const xmlChar *cur, + const char *encoding, + htmlSAXHandlerPtr sax, + void *userData); +XMLPUBFUN htmlDocPtr XMLCALL + htmlParseDoc (const xmlChar *cur, + const char *encoding); +XMLPUBFUN htmlDocPtr XMLCALL + htmlSAXParseFile(const char *filename, + const char *encoding, + htmlSAXHandlerPtr sax, + void *userData); +XMLPUBFUN htmlDocPtr XMLCALL + htmlParseFile (const char *filename, + const char *encoding); +XMLPUBFUN int XMLCALL + UTF8ToHtml (unsigned char *out, + int *outlen, + const unsigned char *in, + int *inlen); +XMLPUBFUN int XMLCALL + htmlEncodeEntities(unsigned char *out, + int *outlen, + const unsigned char *in, + int *inlen, int quoteChar); +XMLPUBFUN int XMLCALL + htmlIsScriptAttribute(const xmlChar *name); +XMLPUBFUN int XMLCALL + htmlHandleOmittedElem(int val); + +#ifdef LIBXML_PUSH_ENABLED +/** + * Interfaces for the Push mode. + */ +XMLPUBFUN htmlParserCtxtPtr XMLCALL + htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, + void *user_data, + const char *chunk, + int size, + const char *filename, + xmlCharEncoding enc); +XMLPUBFUN int XMLCALL + htmlParseChunk (htmlParserCtxtPtr ctxt, + const char *chunk, + int size, + int terminate); +#endif /* LIBXML_PUSH_ENABLED */ + +XMLPUBFUN void XMLCALL + htmlFreeParserCtxt (htmlParserCtxtPtr ctxt); + +/* + * New set of simpler/more flexible APIs + */ +/** + * xmlParserOption: + * + * This is the set of XML parser options that can be passed down + * to the xmlReadDoc() and similar calls. + */ +typedef enum { + HTML_PARSE_RECOVER = 1<<0, /* Relaxed parsing */ + HTML_PARSE_NODEFDTD = 1<<2, /* do not default a doctype if not found */ + HTML_PARSE_NOERROR = 1<<5, /* suppress error reports */ + HTML_PARSE_NOWARNING= 1<<6, /* suppress warning reports */ + HTML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ + HTML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ + HTML_PARSE_NONET = 1<<11,/* Forbid network access */ + HTML_PARSE_NOIMPLIED= 1<<13,/* Do not add implied html/body... elements */ + HTML_PARSE_COMPACT = 1<<16,/* compact small text nodes */ + HTML_PARSE_IGNORE_ENC=1<<21 /* ignore internal document encoding hint */ +} htmlParserOption; + +XMLPUBFUN void XMLCALL + htmlCtxtReset (htmlParserCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + htmlCtxtUseOptions (htmlParserCtxtPtr ctxt, + int options); +XMLPUBFUN htmlDocPtr XMLCALL + htmlReadDoc (const xmlChar *cur, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr XMLCALL + htmlReadFile (const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr XMLCALL + htmlReadMemory (const char *buffer, + int size, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr XMLCALL + htmlReadFd (int fd, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr XMLCALL + htmlReadIO (xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr XMLCALL + htmlCtxtReadDoc (xmlParserCtxtPtr ctxt, + const xmlChar *cur, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr XMLCALL + htmlCtxtReadFile (xmlParserCtxtPtr ctxt, + const char *filename, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr XMLCALL + htmlCtxtReadMemory (xmlParserCtxtPtr ctxt, + const char *buffer, + int size, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr XMLCALL + htmlCtxtReadFd (xmlParserCtxtPtr ctxt, + int fd, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN htmlDocPtr XMLCALL + htmlCtxtReadIO (xmlParserCtxtPtr ctxt, + xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + const char *URL, + const char *encoding, + int options); + +/* NRK/Jan2003: further knowledge of HTML structure + */ +typedef enum { + HTML_NA = 0 , /* something we don't check at all */ + HTML_INVALID = 0x1 , + HTML_DEPRECATED = 0x2 , + HTML_VALID = 0x4 , + HTML_REQUIRED = 0xc /* VALID bit set so ( & HTML_VALID ) is TRUE */ +} htmlStatus ; + +/* Using htmlElemDesc rather than name here, to emphasise the fact + that otherwise there's a lookup overhead +*/ +XMLPUBFUN htmlStatus XMLCALL htmlAttrAllowed(const htmlElemDesc*, const xmlChar*, int) ; +XMLPUBFUN int XMLCALL htmlElementAllowedHere(const htmlElemDesc*, const xmlChar*) ; +XMLPUBFUN htmlStatus XMLCALL htmlElementStatusHere(const htmlElemDesc*, const htmlElemDesc*) ; +XMLPUBFUN htmlStatus XMLCALL htmlNodeStatus(const htmlNodePtr, int) ; +/** + * htmlDefaultSubelement: + * @elt: HTML element + * + * Returns the default subelement for this element + */ +#define htmlDefaultSubelement(elt) elt->defaultsubelt +/** + * htmlElementAllowedHereDesc: + * @parent: HTML parent element + * @elt: HTML element + * + * Checks whether an HTML element description may be a + * direct child of the specified element. + * + * Returns 1 if allowed; 0 otherwise. + */ +#define htmlElementAllowedHereDesc(parent,elt) \ + htmlElementAllowedHere((parent), (elt)->name) +/** + * htmlRequiredAttrs: + * @elt: HTML element + * + * Returns the attributes required for the specified element. + */ +#define htmlRequiredAttrs(elt) (elt)->attrs_req + + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_HTML_ENABLED */ +#endif /* __HTML_PARSER_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/HTMLtree.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/HTMLtree.h new file mode 100644 index 0000000..c0e1103 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/HTMLtree.h @@ -0,0 +1,147 @@ +/* + * Summary: specific APIs to process HTML tree, especially serialization + * Description: this module implements a few function needed to process + * tree in an HTML specific way. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __HTML_TREE_H__ +#define __HTML_TREE_H__ + +#include +#include +#include +#include + +#ifdef LIBXML_HTML_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * HTML_TEXT_NODE: + * + * Macro. A text node in a HTML document is really implemented + * the same way as a text node in an XML document. + */ +#define HTML_TEXT_NODE XML_TEXT_NODE +/** + * HTML_ENTITY_REF_NODE: + * + * Macro. An entity reference in a HTML document is really implemented + * the same way as an entity reference in an XML document. + */ +#define HTML_ENTITY_REF_NODE XML_ENTITY_REF_NODE +/** + * HTML_COMMENT_NODE: + * + * Macro. A comment in a HTML document is really implemented + * the same way as a comment in an XML document. + */ +#define HTML_COMMENT_NODE XML_COMMENT_NODE +/** + * HTML_PRESERVE_NODE: + * + * Macro. A preserved node in a HTML document is really implemented + * the same way as a CDATA section in an XML document. + */ +#define HTML_PRESERVE_NODE XML_CDATA_SECTION_NODE +/** + * HTML_PI_NODE: + * + * Macro. A processing instruction in a HTML document is really implemented + * the same way as a processing instruction in an XML document. + */ +#define HTML_PI_NODE XML_PI_NODE + +XMLPUBFUN htmlDocPtr XMLCALL + htmlNewDoc (const xmlChar *URI, + const xmlChar *ExternalID); +XMLPUBFUN htmlDocPtr XMLCALL + htmlNewDocNoDtD (const xmlChar *URI, + const xmlChar *ExternalID); +XMLPUBFUN const xmlChar * XMLCALL + htmlGetMetaEncoding (htmlDocPtr doc); +XMLPUBFUN int XMLCALL + htmlSetMetaEncoding (htmlDocPtr doc, + const xmlChar *encoding); +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void XMLCALL + htmlDocDumpMemory (xmlDocPtr cur, + xmlChar **mem, + int *size); +XMLPUBFUN void XMLCALL + htmlDocDumpMemoryFormat (xmlDocPtr cur, + xmlChar **mem, + int *size, + int format); +XMLPUBFUN int XMLCALL + htmlDocDump (FILE *f, + xmlDocPtr cur); +XMLPUBFUN int XMLCALL + htmlSaveFile (const char *filename, + xmlDocPtr cur); +XMLPUBFUN int XMLCALL + htmlNodeDump (xmlBufferPtr buf, + xmlDocPtr doc, + xmlNodePtr cur); +XMLPUBFUN void XMLCALL + htmlNodeDumpFile (FILE *out, + xmlDocPtr doc, + xmlNodePtr cur); +XMLPUBFUN int XMLCALL + htmlNodeDumpFileFormat (FILE *out, + xmlDocPtr doc, + xmlNodePtr cur, + const char *encoding, + int format); +XMLPUBFUN int XMLCALL + htmlSaveFileEnc (const char *filename, + xmlDocPtr cur, + const char *encoding); +XMLPUBFUN int XMLCALL + htmlSaveFileFormat (const char *filename, + xmlDocPtr cur, + const char *encoding, + int format); + +XMLPUBFUN void XMLCALL + htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, + xmlDocPtr doc, + xmlNodePtr cur, + const char *encoding, + int format); +XMLPUBFUN void XMLCALL + htmlDocContentDumpOutput(xmlOutputBufferPtr buf, + xmlDocPtr cur, + const char *encoding); +XMLPUBFUN void XMLCALL + htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf, + xmlDocPtr cur, + const char *encoding, + int format); +XMLPUBFUN void XMLCALL + htmlNodeDumpOutput (xmlOutputBufferPtr buf, + xmlDocPtr doc, + xmlNodePtr cur, + const char *encoding); + +#endif /* LIBXML_OUTPUT_ENABLED */ + +XMLPUBFUN int XMLCALL + htmlIsBooleanAttr (const xmlChar *name); + + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_HTML_ENABLED */ + +#endif /* __HTML_TREE_H__ */ + diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/SAX.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/SAX.h new file mode 100644 index 0000000..20093ce --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/SAX.h @@ -0,0 +1,173 @@ +/* + * Summary: Old SAX version 1 handler, deprecated + * Description: DEPRECATED set of SAX version 1 interfaces used to + * build the DOM tree. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + + +#ifndef __XML_SAX_H__ +#define __XML_SAX_H__ + +#include +#include +#include +#include +#include + +#ifdef LIBXML_LEGACY_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif +XMLPUBFUN const xmlChar * XMLCALL + getPublicId (void *ctx); +XMLPUBFUN const xmlChar * XMLCALL + getSystemId (void *ctx); +XMLPUBFUN void XMLCALL + setDocumentLocator (void *ctx, + xmlSAXLocatorPtr loc); + +XMLPUBFUN int XMLCALL + getLineNumber (void *ctx); +XMLPUBFUN int XMLCALL + getColumnNumber (void *ctx); + +XMLPUBFUN int XMLCALL + isStandalone (void *ctx); +XMLPUBFUN int XMLCALL + hasInternalSubset (void *ctx); +XMLPUBFUN int XMLCALL + hasExternalSubset (void *ctx); + +XMLPUBFUN void XMLCALL + internalSubset (void *ctx, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +XMLPUBFUN void XMLCALL + externalSubset (void *ctx, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +XMLPUBFUN xmlEntityPtr XMLCALL + getEntity (void *ctx, + const xmlChar *name); +XMLPUBFUN xmlEntityPtr XMLCALL + getParameterEntity (void *ctx, + const xmlChar *name); +XMLPUBFUN xmlParserInputPtr XMLCALL + resolveEntity (void *ctx, + const xmlChar *publicId, + const xmlChar *systemId); + +XMLPUBFUN void XMLCALL + entityDecl (void *ctx, + const xmlChar *name, + int type, + const xmlChar *publicId, + const xmlChar *systemId, + xmlChar *content); +XMLPUBFUN void XMLCALL + attributeDecl (void *ctx, + const xmlChar *elem, + const xmlChar *fullname, + int type, + int def, + const xmlChar *defaultValue, + xmlEnumerationPtr tree); +XMLPUBFUN void XMLCALL + elementDecl (void *ctx, + const xmlChar *name, + int type, + xmlElementContentPtr content); +XMLPUBFUN void XMLCALL + notationDecl (void *ctx, + const xmlChar *name, + const xmlChar *publicId, + const xmlChar *systemId); +XMLPUBFUN void XMLCALL + unparsedEntityDecl (void *ctx, + const xmlChar *name, + const xmlChar *publicId, + const xmlChar *systemId, + const xmlChar *notationName); + +XMLPUBFUN void XMLCALL + startDocument (void *ctx); +XMLPUBFUN void XMLCALL + endDocument (void *ctx); +XMLPUBFUN void XMLCALL + attribute (void *ctx, + const xmlChar *fullname, + const xmlChar *value); +XMLPUBFUN void XMLCALL + startElement (void *ctx, + const xmlChar *fullname, + const xmlChar **atts); +XMLPUBFUN void XMLCALL + endElement (void *ctx, + const xmlChar *name); +XMLPUBFUN void XMLCALL + reference (void *ctx, + const xmlChar *name); +XMLPUBFUN void XMLCALL + characters (void *ctx, + const xmlChar *ch, + int len); +XMLPUBFUN void XMLCALL + ignorableWhitespace (void *ctx, + const xmlChar *ch, + int len); +XMLPUBFUN void XMLCALL + processingInstruction (void *ctx, + const xmlChar *target, + const xmlChar *data); +XMLPUBFUN void XMLCALL + globalNamespace (void *ctx, + const xmlChar *href, + const xmlChar *prefix); +XMLPUBFUN void XMLCALL + setNamespace (void *ctx, + const xmlChar *name); +XMLPUBFUN xmlNsPtr XMLCALL + getNamespace (void *ctx); +XMLPUBFUN int XMLCALL + checkNamespace (void *ctx, + xmlChar *nameSpace); +XMLPUBFUN void XMLCALL + namespaceDecl (void *ctx, + const xmlChar *href, + const xmlChar *prefix); +XMLPUBFUN void XMLCALL + comment (void *ctx, + const xmlChar *value); +XMLPUBFUN void XMLCALL + cdataBlock (void *ctx, + const xmlChar *value, + int len); + +#ifdef LIBXML_SAX1_ENABLED +XMLPUBFUN void XMLCALL + initxmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr, + int warning); +#ifdef LIBXML_HTML_ENABLED +XMLPUBFUN void XMLCALL + inithtmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr); +#endif +#ifdef LIBXML_DOCB_ENABLED +XMLPUBFUN void XMLCALL + initdocbDefaultSAXHandler (xmlSAXHandlerV1 *hdlr); +#endif +#endif /* LIBXML_SAX1_ENABLED */ + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_LEGACY_ENABLED */ + +#endif /* __XML_SAX_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/SAX2.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/SAX2.h new file mode 100644 index 0000000..a55212e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/SAX2.h @@ -0,0 +1,178 @@ +/* + * Summary: SAX2 parser interface used to build the DOM tree + * Description: those are the default SAX2 interfaces used by + * the library when building DOM tree. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + + +#ifndef __XML_SAX2_H__ +#define __XML_SAX2_H__ + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif +XMLPUBFUN const xmlChar * XMLCALL + xmlSAX2GetPublicId (void *ctx); +XMLPUBFUN const xmlChar * XMLCALL + xmlSAX2GetSystemId (void *ctx); +XMLPUBFUN void XMLCALL + xmlSAX2SetDocumentLocator (void *ctx, + xmlSAXLocatorPtr loc); + +XMLPUBFUN int XMLCALL + xmlSAX2GetLineNumber (void *ctx); +XMLPUBFUN int XMLCALL + xmlSAX2GetColumnNumber (void *ctx); + +XMLPUBFUN int XMLCALL + xmlSAX2IsStandalone (void *ctx); +XMLPUBFUN int XMLCALL + xmlSAX2HasInternalSubset (void *ctx); +XMLPUBFUN int XMLCALL + xmlSAX2HasExternalSubset (void *ctx); + +XMLPUBFUN void XMLCALL + xmlSAX2InternalSubset (void *ctx, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +XMLPUBFUN void XMLCALL + xmlSAX2ExternalSubset (void *ctx, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +XMLPUBFUN xmlEntityPtr XMLCALL + xmlSAX2GetEntity (void *ctx, + const xmlChar *name); +XMLPUBFUN xmlEntityPtr XMLCALL + xmlSAX2GetParameterEntity (void *ctx, + const xmlChar *name); +XMLPUBFUN xmlParserInputPtr XMLCALL + xmlSAX2ResolveEntity (void *ctx, + const xmlChar *publicId, + const xmlChar *systemId); + +XMLPUBFUN void XMLCALL + xmlSAX2EntityDecl (void *ctx, + const xmlChar *name, + int type, + const xmlChar *publicId, + const xmlChar *systemId, + xmlChar *content); +XMLPUBFUN void XMLCALL + xmlSAX2AttributeDecl (void *ctx, + const xmlChar *elem, + const xmlChar *fullname, + int type, + int def, + const xmlChar *defaultValue, + xmlEnumerationPtr tree); +XMLPUBFUN void XMLCALL + xmlSAX2ElementDecl (void *ctx, + const xmlChar *name, + int type, + xmlElementContentPtr content); +XMLPUBFUN void XMLCALL + xmlSAX2NotationDecl (void *ctx, + const xmlChar *name, + const xmlChar *publicId, + const xmlChar *systemId); +XMLPUBFUN void XMLCALL + xmlSAX2UnparsedEntityDecl (void *ctx, + const xmlChar *name, + const xmlChar *publicId, + const xmlChar *systemId, + const xmlChar *notationName); + +XMLPUBFUN void XMLCALL + xmlSAX2StartDocument (void *ctx); +XMLPUBFUN void XMLCALL + xmlSAX2EndDocument (void *ctx); +#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ + defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || \ + defined(LIBXML_LEGACY_ENABLED) +XMLPUBFUN void XMLCALL + xmlSAX2StartElement (void *ctx, + const xmlChar *fullname, + const xmlChar **atts); +XMLPUBFUN void XMLCALL + xmlSAX2EndElement (void *ctx, + const xmlChar *name); +#endif /* LIBXML_SAX1_ENABLED or LIBXML_HTML_ENABLED or LIBXML_LEGACY_ENABLED */ +XMLPUBFUN void XMLCALL + xmlSAX2StartElementNs (void *ctx, + const xmlChar *localname, + const xmlChar *prefix, + const xmlChar *URI, + int nb_namespaces, + const xmlChar **namespaces, + int nb_attributes, + int nb_defaulted, + const xmlChar **attributes); +XMLPUBFUN void XMLCALL + xmlSAX2EndElementNs (void *ctx, + const xmlChar *localname, + const xmlChar *prefix, + const xmlChar *URI); +XMLPUBFUN void XMLCALL + xmlSAX2Reference (void *ctx, + const xmlChar *name); +XMLPUBFUN void XMLCALL + xmlSAX2Characters (void *ctx, + const xmlChar *ch, + int len); +XMLPUBFUN void XMLCALL + xmlSAX2IgnorableWhitespace (void *ctx, + const xmlChar *ch, + int len); +XMLPUBFUN void XMLCALL + xmlSAX2ProcessingInstruction (void *ctx, + const xmlChar *target, + const xmlChar *data); +XMLPUBFUN void XMLCALL + xmlSAX2Comment (void *ctx, + const xmlChar *value); +XMLPUBFUN void XMLCALL + xmlSAX2CDataBlock (void *ctx, + const xmlChar *value, + int len); + +#ifdef LIBXML_SAX1_ENABLED +XMLPUBFUN int XMLCALL + xmlSAXDefaultVersion (int version); +#endif /* LIBXML_SAX1_ENABLED */ + +XMLPUBFUN int XMLCALL + xmlSAXVersion (xmlSAXHandler *hdlr, + int version); +XMLPUBFUN void XMLCALL + xmlSAX2InitDefaultSAXHandler (xmlSAXHandler *hdlr, + int warning); +#ifdef LIBXML_HTML_ENABLED +XMLPUBFUN void XMLCALL + xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr); +XMLPUBFUN void XMLCALL + htmlDefaultSAXHandlerInit (void); +#endif +#ifdef LIBXML_DOCB_ENABLED +XMLPUBFUN void XMLCALL + xmlSAX2InitDocbDefaultSAXHandler(xmlSAXHandler *hdlr); +XMLPUBFUN void XMLCALL + docbDefaultSAXHandlerInit (void); +#endif +XMLPUBFUN void XMLCALL + xmlDefaultSAXHandlerInit (void); +#ifdef __cplusplus +} +#endif +#endif /* __XML_SAX2_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/c14n.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/c14n.h new file mode 100644 index 0000000..b8971d9 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/c14n.h @@ -0,0 +1,126 @@ +/* + * Summary: Provide Canonical XML and Exclusive XML Canonicalization + * Description: the c14n modules provides a + * + * "Canonical XML" implementation + * http://www.w3.org/TR/xml-c14n + * + * and an + * + * "Exclusive XML Canonicalization" implementation + * http://www.w3.org/TR/xml-exc-c14n + + * Copy: See Copyright for the status of this software. + * + * Author: Aleksey Sanin + */ +#ifndef __XML_C14N_H__ +#define __XML_C14N_H__ +#ifdef LIBXML_C14N_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include +#include + +/* + * XML Canonicazation + * http://www.w3.org/TR/xml-c14n + * + * Exclusive XML Canonicazation + * http://www.w3.org/TR/xml-exc-c14n + * + * Canonical form of an XML document could be created if and only if + * a) default attributes (if any) are added to all nodes + * b) all character and parsed entity references are resolved + * In order to achive this in libxml2 the document MUST be loaded with + * following global setings: + * + * xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; + * xmlSubstituteEntitiesDefault(1); + * + * or corresponding parser context setting: + * xmlParserCtxtPtr ctxt; + * + * ... + * ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; + * ctxt->replaceEntities = 1; + * ... + */ + +/* + * xmlC14NMode: + * + * Predefined values for C14N modes + * + */ +typedef enum { + XML_C14N_1_0 = 0, /* Origianal C14N 1.0 spec */ + XML_C14N_EXCLUSIVE_1_0 = 1, /* Exclusive C14N 1.0 spec */ + XML_C14N_1_1 = 2 /* C14N 1.1 spec */ +} xmlC14NMode; + +XMLPUBFUN int XMLCALL + xmlC14NDocSaveTo (xmlDocPtr doc, + xmlNodeSetPtr nodes, + int mode, /* a xmlC14NMode */ + xmlChar **inclusive_ns_prefixes, + int with_comments, + xmlOutputBufferPtr buf); + +XMLPUBFUN int XMLCALL + xmlC14NDocDumpMemory (xmlDocPtr doc, + xmlNodeSetPtr nodes, + int mode, /* a xmlC14NMode */ + xmlChar **inclusive_ns_prefixes, + int with_comments, + xmlChar **doc_txt_ptr); + +XMLPUBFUN int XMLCALL + xmlC14NDocSave (xmlDocPtr doc, + xmlNodeSetPtr nodes, + int mode, /* a xmlC14NMode */ + xmlChar **inclusive_ns_prefixes, + int with_comments, + const char* filename, + int compression); + + +/** + * This is the core C14N function + */ +/** + * xmlC14NIsVisibleCallback: + * @user_data: user data + * @node: the curent node + * @parent: the parent node + * + * Signature for a C14N callback on visible nodes + * + * Returns 1 if the node should be included + */ +typedef int (*xmlC14NIsVisibleCallback) (void* user_data, + xmlNodePtr node, + xmlNodePtr parent); + +XMLPUBFUN int XMLCALL + xmlC14NExecute (xmlDocPtr doc, + xmlC14NIsVisibleCallback is_visible_callback, + void* user_data, + int mode, /* a xmlC14NMode */ + xmlChar **inclusive_ns_prefixes, + int with_comments, + xmlOutputBufferPtr buf); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* LIBXML_OUTPUT_ENABLED */ +#endif /* LIBXML_C14N_ENABLED */ +#endif /* __XML_C14N_H__ */ + diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/catalog.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/catalog.h new file mode 100644 index 0000000..5a13f51 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/catalog.h @@ -0,0 +1,182 @@ +/** + * Summary: interfaces to the Catalog handling system + * Description: the catalog module implements the support for + * XML Catalogs and SGML catalogs + * + * SGML Open Technical Resolution TR9401:1997. + * http://www.jclark.com/sp/catalog.htm + * + * XML Catalogs Working Draft 06 August 2001 + * http://www.oasis-open.org/committees/entity/spec-2001-08-06.html + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_CATALOG_H__ +#define __XML_CATALOG_H__ + +#include + +#include +#include +#include + +#ifdef LIBXML_CATALOG_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * XML_CATALOGS_NAMESPACE: + * + * The namespace for the XML Catalogs elements. + */ +#define XML_CATALOGS_NAMESPACE \ + (const xmlChar *) "urn:oasis:names:tc:entity:xmlns:xml:catalog" +/** + * XML_CATALOG_PI: + * + * The specific XML Catalog Processing Instuction name. + */ +#define XML_CATALOG_PI \ + (const xmlChar *) "oasis-xml-catalog" + +/* + * The API is voluntarily limited to general cataloging. + */ +typedef enum { + XML_CATA_PREFER_NONE = 0, + XML_CATA_PREFER_PUBLIC = 1, + XML_CATA_PREFER_SYSTEM +} xmlCatalogPrefer; + +typedef enum { + XML_CATA_ALLOW_NONE = 0, + XML_CATA_ALLOW_GLOBAL = 1, + XML_CATA_ALLOW_DOCUMENT = 2, + XML_CATA_ALLOW_ALL = 3 +} xmlCatalogAllow; + +typedef struct _xmlCatalog xmlCatalog; +typedef xmlCatalog *xmlCatalogPtr; + +/* + * Operations on a given catalog. + */ +XMLPUBFUN xmlCatalogPtr XMLCALL + xmlNewCatalog (int sgml); +XMLPUBFUN xmlCatalogPtr XMLCALL + xmlLoadACatalog (const char *filename); +XMLPUBFUN xmlCatalogPtr XMLCALL + xmlLoadSGMLSuperCatalog (const char *filename); +XMLPUBFUN int XMLCALL + xmlConvertSGMLCatalog (xmlCatalogPtr catal); +XMLPUBFUN int XMLCALL + xmlACatalogAdd (xmlCatalogPtr catal, + const xmlChar *type, + const xmlChar *orig, + const xmlChar *replace); +XMLPUBFUN int XMLCALL + xmlACatalogRemove (xmlCatalogPtr catal, + const xmlChar *value); +XMLPUBFUN xmlChar * XMLCALL + xmlACatalogResolve (xmlCatalogPtr catal, + const xmlChar *pubID, + const xmlChar *sysID); +XMLPUBFUN xmlChar * XMLCALL + xmlACatalogResolveSystem(xmlCatalogPtr catal, + const xmlChar *sysID); +XMLPUBFUN xmlChar * XMLCALL + xmlACatalogResolvePublic(xmlCatalogPtr catal, + const xmlChar *pubID); +XMLPUBFUN xmlChar * XMLCALL + xmlACatalogResolveURI (xmlCatalogPtr catal, + const xmlChar *URI); +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void XMLCALL + xmlACatalogDump (xmlCatalogPtr catal, + FILE *out); +#endif /* LIBXML_OUTPUT_ENABLED */ +XMLPUBFUN void XMLCALL + xmlFreeCatalog (xmlCatalogPtr catal); +XMLPUBFUN int XMLCALL + xmlCatalogIsEmpty (xmlCatalogPtr catal); + +/* + * Global operations. + */ +XMLPUBFUN void XMLCALL + xmlInitializeCatalog (void); +XMLPUBFUN int XMLCALL + xmlLoadCatalog (const char *filename); +XMLPUBFUN void XMLCALL + xmlLoadCatalogs (const char *paths); +XMLPUBFUN void XMLCALL + xmlCatalogCleanup (void); +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void XMLCALL + xmlCatalogDump (FILE *out); +#endif /* LIBXML_OUTPUT_ENABLED */ +XMLPUBFUN xmlChar * XMLCALL + xmlCatalogResolve (const xmlChar *pubID, + const xmlChar *sysID); +XMLPUBFUN xmlChar * XMLCALL + xmlCatalogResolveSystem (const xmlChar *sysID); +XMLPUBFUN xmlChar * XMLCALL + xmlCatalogResolvePublic (const xmlChar *pubID); +XMLPUBFUN xmlChar * XMLCALL + xmlCatalogResolveURI (const xmlChar *URI); +XMLPUBFUN int XMLCALL + xmlCatalogAdd (const xmlChar *type, + const xmlChar *orig, + const xmlChar *replace); +XMLPUBFUN int XMLCALL + xmlCatalogRemove (const xmlChar *value); +XMLPUBFUN xmlDocPtr XMLCALL + xmlParseCatalogFile (const char *filename); +XMLPUBFUN int XMLCALL + xmlCatalogConvert (void); + +/* + * Strictly minimal interfaces for per-document catalogs used + * by the parser. + */ +XMLPUBFUN void XMLCALL + xmlCatalogFreeLocal (void *catalogs); +XMLPUBFUN void * XMLCALL + xmlCatalogAddLocal (void *catalogs, + const xmlChar *URL); +XMLPUBFUN xmlChar * XMLCALL + xmlCatalogLocalResolve (void *catalogs, + const xmlChar *pubID, + const xmlChar *sysID); +XMLPUBFUN xmlChar * XMLCALL + xmlCatalogLocalResolveURI(void *catalogs, + const xmlChar *URI); +/* + * Preference settings. + */ +XMLPUBFUN int XMLCALL + xmlCatalogSetDebug (int level); +XMLPUBFUN xmlCatalogPrefer XMLCALL + xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer); +XMLPUBFUN void XMLCALL + xmlCatalogSetDefaults (xmlCatalogAllow allow); +XMLPUBFUN xmlCatalogAllow XMLCALL + xmlCatalogGetDefaults (void); + + +/* DEPRECATED interfaces */ +XMLPUBFUN const xmlChar * XMLCALL + xmlCatalogGetSystem (const xmlChar *sysID); +XMLPUBFUN const xmlChar * XMLCALL + xmlCatalogGetPublic (const xmlChar *pubID); + +#ifdef __cplusplus +} +#endif +#endif /* LIBXML_CATALOG_ENABLED */ +#endif /* __XML_CATALOG_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/chvalid.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/chvalid.h new file mode 100644 index 0000000..fb43016 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/chvalid.h @@ -0,0 +1,230 @@ +/* + * Summary: Unicode character range checking + * Description: this module exports interfaces for the character + * range validation APIs + * + * This file is automatically generated from the cvs source + * definition files using the genChRanges.py Python script + * + * Generation date: Mon Mar 27 11:09:48 2006 + * Sources: chvalid.def + * Author: William Brack + */ + +#ifndef __XML_CHVALID_H__ +#define __XML_CHVALID_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Define our typedefs and structures + * + */ +typedef struct _xmlChSRange xmlChSRange; +typedef xmlChSRange *xmlChSRangePtr; +struct _xmlChSRange { + unsigned short low; + unsigned short high; +}; + +typedef struct _xmlChLRange xmlChLRange; +typedef xmlChLRange *xmlChLRangePtr; +struct _xmlChLRange { + unsigned int low; + unsigned int high; +}; + +typedef struct _xmlChRangeGroup xmlChRangeGroup; +typedef xmlChRangeGroup *xmlChRangeGroupPtr; +struct _xmlChRangeGroup { + int nbShortRange; + int nbLongRange; + const xmlChSRange *shortRange; /* points to an array of ranges */ + const xmlChLRange *longRange; +}; + +/** + * Range checking routine + */ +XMLPUBFUN int XMLCALL + xmlCharInRange(unsigned int val, const xmlChRangeGroup *group); + + +/** + * xmlIsBaseChar_ch: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsBaseChar_ch(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \ + ((0x61 <= (c)) && ((c) <= 0x7a)) || \ + ((0xc0 <= (c)) && ((c) <= 0xd6)) || \ + ((0xd8 <= (c)) && ((c) <= 0xf6)) || \ + (0xf8 <= (c))) + +/** + * xmlIsBaseCharQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsBaseCharQ(c) (((c) < 0x100) ? \ + xmlIsBaseChar_ch((c)) : \ + xmlCharInRange((c), &xmlIsBaseCharGroup)) + +XMLPUBVAR const xmlChRangeGroup xmlIsBaseCharGroup; + +/** + * xmlIsBlank_ch: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsBlank_ch(c) (((c) == 0x20) || \ + ((0x9 <= (c)) && ((c) <= 0xa)) || \ + ((c) == 0xd)) + +/** + * xmlIsBlankQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsBlankQ(c) (((c) < 0x100) ? \ + xmlIsBlank_ch((c)) : 0) + + +/** + * xmlIsChar_ch: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsChar_ch(c) (((0x9 <= (c)) && ((c) <= 0xa)) || \ + ((c) == 0xd) || \ + (0x20 <= (c))) + +/** + * xmlIsCharQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsCharQ(c) (((c) < 0x100) ? \ + xmlIsChar_ch((c)) :\ + (((0x100 <= (c)) && ((c) <= 0xd7ff)) || \ + ((0xe000 <= (c)) && ((c) <= 0xfffd)) || \ + ((0x10000 <= (c)) && ((c) <= 0x10ffff)))) + +XMLPUBVAR const xmlChRangeGroup xmlIsCharGroup; + +/** + * xmlIsCombiningQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsCombiningQ(c) (((c) < 0x100) ? \ + 0 : \ + xmlCharInRange((c), &xmlIsCombiningGroup)) + +XMLPUBVAR const xmlChRangeGroup xmlIsCombiningGroup; + +/** + * xmlIsDigit_ch: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsDigit_ch(c) (((0x30 <= (c)) && ((c) <= 0x39))) + +/** + * xmlIsDigitQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsDigitQ(c) (((c) < 0x100) ? \ + xmlIsDigit_ch((c)) : \ + xmlCharInRange((c), &xmlIsDigitGroup)) + +XMLPUBVAR const xmlChRangeGroup xmlIsDigitGroup; + +/** + * xmlIsExtender_ch: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsExtender_ch(c) (((c) == 0xb7)) + +/** + * xmlIsExtenderQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsExtenderQ(c) (((c) < 0x100) ? \ + xmlIsExtender_ch((c)) : \ + xmlCharInRange((c), &xmlIsExtenderGroup)) + +XMLPUBVAR const xmlChRangeGroup xmlIsExtenderGroup; + +/** + * xmlIsIdeographicQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsIdeographicQ(c) (((c) < 0x100) ? \ + 0 :\ + (((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \ + ((c) == 0x3007) || \ + ((0x3021 <= (c)) && ((c) <= 0x3029)))) + +XMLPUBVAR const xmlChRangeGroup xmlIsIdeographicGroup; +XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256]; + +/** + * xmlIsPubidChar_ch: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsPubidChar_ch(c) (xmlIsPubidChar_tab[(c)]) + +/** + * xmlIsPubidCharQ: + * @c: char to validate + * + * Automatically generated by genChRanges.py + */ +#define xmlIsPubidCharQ(c) (((c) < 0x100) ? \ + xmlIsPubidChar_ch((c)) : 0) + +XMLPUBFUN int XMLCALL + xmlIsBaseChar(unsigned int ch); +XMLPUBFUN int XMLCALL + xmlIsBlank(unsigned int ch); +XMLPUBFUN int XMLCALL + xmlIsChar(unsigned int ch); +XMLPUBFUN int XMLCALL + xmlIsCombining(unsigned int ch); +XMLPUBFUN int XMLCALL + xmlIsDigit(unsigned int ch); +XMLPUBFUN int XMLCALL + xmlIsExtender(unsigned int ch); +XMLPUBFUN int XMLCALL + xmlIsIdeographic(unsigned int ch); +XMLPUBFUN int XMLCALL + xmlIsPubidChar(unsigned int ch); + +#ifdef __cplusplus +} +#endif +#endif /* __XML_CHVALID_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/debugXML.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/debugXML.h new file mode 100644 index 0000000..5b3be13 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/debugXML.h @@ -0,0 +1,217 @@ +/* + * Summary: Tree debugging APIs + * Description: Interfaces to a set of routines used for debugging the tree + * produced by the XML parser. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __DEBUG_XML__ +#define __DEBUG_XML__ +#include +#include +#include + +#ifdef LIBXML_DEBUG_ENABLED + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The standard Dump routines. + */ +XMLPUBFUN void XMLCALL + xmlDebugDumpString (FILE *output, + const xmlChar *str); +XMLPUBFUN void XMLCALL + xmlDebugDumpAttr (FILE *output, + xmlAttrPtr attr, + int depth); +XMLPUBFUN void XMLCALL + xmlDebugDumpAttrList (FILE *output, + xmlAttrPtr attr, + int depth); +XMLPUBFUN void XMLCALL + xmlDebugDumpOneNode (FILE *output, + xmlNodePtr node, + int depth); +XMLPUBFUN void XMLCALL + xmlDebugDumpNode (FILE *output, + xmlNodePtr node, + int depth); +XMLPUBFUN void XMLCALL + xmlDebugDumpNodeList (FILE *output, + xmlNodePtr node, + int depth); +XMLPUBFUN void XMLCALL + xmlDebugDumpDocumentHead(FILE *output, + xmlDocPtr doc); +XMLPUBFUN void XMLCALL + xmlDebugDumpDocument (FILE *output, + xmlDocPtr doc); +XMLPUBFUN void XMLCALL + xmlDebugDumpDTD (FILE *output, + xmlDtdPtr dtd); +XMLPUBFUN void XMLCALL + xmlDebugDumpEntities (FILE *output, + xmlDocPtr doc); + +/**************************************************************** + * * + * Checking routines * + * * + ****************************************************************/ + +XMLPUBFUN int XMLCALL + xmlDebugCheckDocument (FILE * output, + xmlDocPtr doc); + +/**************************************************************** + * * + * XML shell helpers * + * * + ****************************************************************/ + +XMLPUBFUN void XMLCALL + xmlLsOneNode (FILE *output, xmlNodePtr node); +XMLPUBFUN int XMLCALL + xmlLsCountNode (xmlNodePtr node); + +XMLPUBFUN const char * XMLCALL + xmlBoolToText (int boolval); + +/**************************************************************** + * * + * The XML shell related structures and functions * + * * + ****************************************************************/ + +#ifdef LIBXML_XPATH_ENABLED +/** + * xmlShellReadlineFunc: + * @prompt: a string prompt + * + * This is a generic signature for the XML shell input function. + * + * Returns a string which will be freed by the Shell. + */ +typedef char * (* xmlShellReadlineFunc)(char *prompt); + +/** + * xmlShellCtxt: + * + * A debugging shell context. + * TODO: add the defined function tables. + */ +typedef struct _xmlShellCtxt xmlShellCtxt; +typedef xmlShellCtxt *xmlShellCtxtPtr; +struct _xmlShellCtxt { + char *filename; + xmlDocPtr doc; + xmlNodePtr node; + xmlXPathContextPtr pctxt; + int loaded; + FILE *output; + xmlShellReadlineFunc input; +}; + +/** + * xmlShellCmd: + * @ctxt: a shell context + * @arg: a string argument + * @node: a first node + * @node2: a second node + * + * This is a generic signature for the XML shell functions. + * + * Returns an int, negative returns indicating errors. + */ +typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt, + char *arg, + xmlNodePtr node, + xmlNodePtr node2); + +XMLPUBFUN void XMLCALL + xmlShellPrintXPathError (int errorType, + const char *arg); +XMLPUBFUN void XMLCALL + xmlShellPrintXPathResult(xmlXPathObjectPtr list); +XMLPUBFUN int XMLCALL + xmlShellList (xmlShellCtxtPtr ctxt, + char *arg, + xmlNodePtr node, + xmlNodePtr node2); +XMLPUBFUN int XMLCALL + xmlShellBase (xmlShellCtxtPtr ctxt, + char *arg, + xmlNodePtr node, + xmlNodePtr node2); +XMLPUBFUN int XMLCALL + xmlShellDir (xmlShellCtxtPtr ctxt, + char *arg, + xmlNodePtr node, + xmlNodePtr node2); +XMLPUBFUN int XMLCALL + xmlShellLoad (xmlShellCtxtPtr ctxt, + char *filename, + xmlNodePtr node, + xmlNodePtr node2); +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void XMLCALL + xmlShellPrintNode (xmlNodePtr node); +XMLPUBFUN int XMLCALL + xmlShellCat (xmlShellCtxtPtr ctxt, + char *arg, + xmlNodePtr node, + xmlNodePtr node2); +XMLPUBFUN int XMLCALL + xmlShellWrite (xmlShellCtxtPtr ctxt, + char *filename, + xmlNodePtr node, + xmlNodePtr node2); +XMLPUBFUN int XMLCALL + xmlShellSave (xmlShellCtxtPtr ctxt, + char *filename, + xmlNodePtr node, + xmlNodePtr node2); +#endif /* LIBXML_OUTPUT_ENABLED */ +#ifdef LIBXML_VALID_ENABLED +XMLPUBFUN int XMLCALL + xmlShellValidate (xmlShellCtxtPtr ctxt, + char *dtd, + xmlNodePtr node, + xmlNodePtr node2); +#endif /* LIBXML_VALID_ENABLED */ +XMLPUBFUN int XMLCALL + xmlShellDu (xmlShellCtxtPtr ctxt, + char *arg, + xmlNodePtr tree, + xmlNodePtr node2); +XMLPUBFUN int XMLCALL + xmlShellPwd (xmlShellCtxtPtr ctxt, + char *buffer, + xmlNodePtr node, + xmlNodePtr node2); + +/* + * The Shell interface. + */ +XMLPUBFUN void XMLCALL + xmlShell (xmlDocPtr doc, + char *filename, + xmlShellReadlineFunc input, + FILE *output); + +#endif /* LIBXML_XPATH_ENABLED */ + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_DEBUG_ENABLED */ +#endif /* __DEBUG_XML__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/dict.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/dict.h new file mode 100644 index 0000000..b83db59 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/dict.h @@ -0,0 +1,86 @@ +/* + * Summary: string dictionary + * Description: dictionary of reusable strings, just used to avoid allocation + * and freeing operations. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_DICT_H__ +#define __XML_DICT_H__ + +#ifdef __cplusplus +#define __XML_EXTERNC extern "C" +#else +#define __XML_EXTERNC +#endif + +/* + * The dictionary. + */ +__XML_EXTERNC typedef struct _xmlDict xmlDict; +__XML_EXTERNC typedef xmlDict *xmlDictPtr; + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Initializer + */ +XMLPUBFUN int XMLCALL xmlInitializeDict(void); + +/* + * Constructor and destructor. + */ +XMLPUBFUN xmlDictPtr XMLCALL + xmlDictCreate (void); +XMLPUBFUN size_t XMLCALL + xmlDictSetLimit (xmlDictPtr dict, + size_t limit); +XMLPUBFUN size_t XMLCALL + xmlDictGetUsage (xmlDictPtr dict); +XMLPUBFUN xmlDictPtr XMLCALL + xmlDictCreateSub(xmlDictPtr sub); +XMLPUBFUN int XMLCALL + xmlDictReference(xmlDictPtr dict); +XMLPUBFUN void XMLCALL + xmlDictFree (xmlDictPtr dict); + +/* + * Lookup of entry in the dictionary. + */ +XMLPUBFUN const xmlChar * XMLCALL + xmlDictLookup (xmlDictPtr dict, + const xmlChar *name, + int len); +XMLPUBFUN const xmlChar * XMLCALL + xmlDictExists (xmlDictPtr dict, + const xmlChar *name, + int len); +XMLPUBFUN const xmlChar * XMLCALL + xmlDictQLookup (xmlDictPtr dict, + const xmlChar *prefix, + const xmlChar *name); +XMLPUBFUN int XMLCALL + xmlDictOwns (xmlDictPtr dict, + const xmlChar *str); +XMLPUBFUN int XMLCALL + xmlDictSize (xmlDictPtr dict); + +/* + * Cleanup function + */ +XMLPUBFUN void XMLCALL + xmlDictCleanup (void); + +#ifdef __cplusplus +} +#endif +#endif /* ! __XML_DICT_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/encoding.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/encoding.h new file mode 100644 index 0000000..c875af6 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/encoding.h @@ -0,0 +1,245 @@ +/* + * Summary: interface for the encoding conversion functions + * Description: interface for the encoding conversion functions needed for + * XML basic encoding and iconv() support. + * + * Related specs are + * rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies + * [ISO-10646] UTF-8 and UTF-16 in Annexes + * [ISO-8859-1] ISO Latin-1 characters codes. + * [UNICODE] The Unicode Consortium, "The Unicode Standard -- + * Worldwide Character Encoding -- Version 1.0", Addison- + * Wesley, Volume 1, 1991, Volume 2, 1992. UTF-8 is + * described in Unicode Technical Report #4. + * [US-ASCII] Coded Character Set--7-bit American Standard Code for + * Information Interchange, ANSI X3.4-1986. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_CHAR_ENCODING_H__ +#define __XML_CHAR_ENCODING_H__ + +#include + +#ifdef LIBXML_ICONV_ENABLED +#include +#endif +#ifdef LIBXML_ICU_ENABLED +#include +#endif +#ifdef __cplusplus +extern "C" { +#endif + +/* + * xmlCharEncoding: + * + * Predefined values for some standard encodings. + * Libxml does not do beforehand translation on UTF8 and ISOLatinX. + * It also supports ASCII, ISO-8859-1, and UTF16 (LE and BE) by default. + * + * Anything else would have to be translated to UTF8 before being + * given to the parser itself. The BOM for UTF16 and the encoding + * declaration are looked at and a converter is looked for at that + * point. If not found the parser stops here as asked by the XML REC. A + * converter can be registered by the user using xmlRegisterCharEncodingHandler + * but the current form doesn't allow stateful transcoding (a serious + * problem agreed !). If iconv has been found it will be used + * automatically and allow stateful transcoding, the simplest is then + * to be sure to enable iconv and to provide iconv libs for the encoding + * support needed. + * + * Note that the generic "UTF-16" is not a predefined value. Instead, only + * the specific UTF-16LE and UTF-16BE are present. + */ +typedef enum { + XML_CHAR_ENCODING_ERROR= -1, /* No char encoding detected */ + XML_CHAR_ENCODING_NONE= 0, /* No char encoding detected */ + XML_CHAR_ENCODING_UTF8= 1, /* UTF-8 */ + XML_CHAR_ENCODING_UTF16LE= 2, /* UTF-16 little endian */ + XML_CHAR_ENCODING_UTF16BE= 3, /* UTF-16 big endian */ + XML_CHAR_ENCODING_UCS4LE= 4, /* UCS-4 little endian */ + XML_CHAR_ENCODING_UCS4BE= 5, /* UCS-4 big endian */ + XML_CHAR_ENCODING_EBCDIC= 6, /* EBCDIC uh! */ + XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */ + XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */ + XML_CHAR_ENCODING_UCS2= 9, /* UCS-2 */ + XML_CHAR_ENCODING_8859_1= 10,/* ISO-8859-1 ISO Latin 1 */ + XML_CHAR_ENCODING_8859_2= 11,/* ISO-8859-2 ISO Latin 2 */ + XML_CHAR_ENCODING_8859_3= 12,/* ISO-8859-3 */ + XML_CHAR_ENCODING_8859_4= 13,/* ISO-8859-4 */ + XML_CHAR_ENCODING_8859_5= 14,/* ISO-8859-5 */ + XML_CHAR_ENCODING_8859_6= 15,/* ISO-8859-6 */ + XML_CHAR_ENCODING_8859_7= 16,/* ISO-8859-7 */ + XML_CHAR_ENCODING_8859_8= 17,/* ISO-8859-8 */ + XML_CHAR_ENCODING_8859_9= 18,/* ISO-8859-9 */ + XML_CHAR_ENCODING_2022_JP= 19,/* ISO-2022-JP */ + XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */ + XML_CHAR_ENCODING_EUC_JP= 21,/* EUC-JP */ + XML_CHAR_ENCODING_ASCII= 22 /* pure ASCII */ +} xmlCharEncoding; + +/** + * xmlCharEncodingInputFunc: + * @out: a pointer to an array of bytes to store the UTF-8 result + * @outlen: the length of @out + * @in: a pointer to an array of chars in the original encoding + * @inlen: the length of @in + * + * Take a block of chars in the original encoding and try to convert + * it to an UTF-8 block of chars out. + * + * Returns the number of bytes written, -1 if lack of space, or -2 + * if the transcoding failed. + * The value of @inlen after return is the number of octets consumed + * if the return value is positive, else unpredictiable. + * The value of @outlen after return is the number of octets consumed. + */ +typedef int (* xmlCharEncodingInputFunc)(unsigned char *out, int *outlen, + const unsigned char *in, int *inlen); + + +/** + * xmlCharEncodingOutputFunc: + * @out: a pointer to an array of bytes to store the result + * @outlen: the length of @out + * @in: a pointer to an array of UTF-8 chars + * @inlen: the length of @in + * + * Take a block of UTF-8 chars in and try to convert it to another + * encoding. + * Note: a first call designed to produce heading info is called with + * in = NULL. If stateful this should also initialize the encoder state. + * + * Returns the number of bytes written, -1 if lack of space, or -2 + * if the transcoding failed. + * The value of @inlen after return is the number of octets consumed + * if the return value is positive, else unpredictiable. + * The value of @outlen after return is the number of octets produced. + */ +typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen, + const unsigned char *in, int *inlen); + + +/* + * Block defining the handlers for non UTF-8 encodings. + * If iconv is supported, there are two extra fields. + */ +#ifdef LIBXML_ICU_ENABLED +/* Size of pivot buffer, same as icu/source/common/ucnv.cpp CHUNK_SIZE */ +#define ICU_PIVOT_BUF_SIZE 1024 +struct _uconv_t { + UConverter *uconv; /* for conversion between an encoding and UTF-16 */ + UConverter *utf8; /* for conversion between UTF-8 and UTF-16 */ + UChar pivot_buf[ICU_PIVOT_BUF_SIZE]; + UChar *pivot_source; + UChar *pivot_target; +}; +typedef struct _uconv_t uconv_t; +#endif + +typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler; +typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr; +struct _xmlCharEncodingHandler { + char *name; + xmlCharEncodingInputFunc input; + xmlCharEncodingOutputFunc output; +#ifdef LIBXML_ICONV_ENABLED + iconv_t iconv_in; + iconv_t iconv_out; +#endif /* LIBXML_ICONV_ENABLED */ +#ifdef LIBXML_ICU_ENABLED + uconv_t *uconv_in; + uconv_t *uconv_out; +#endif /* LIBXML_ICU_ENABLED */ +}; + +#ifdef __cplusplus +} +#endif +#include +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Interfaces for encoding handlers. + */ +XMLPUBFUN void XMLCALL + xmlInitCharEncodingHandlers (void); +XMLPUBFUN void XMLCALL + xmlCleanupCharEncodingHandlers (void); +XMLPUBFUN void XMLCALL + xmlRegisterCharEncodingHandler (xmlCharEncodingHandlerPtr handler); +XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL + xmlGetCharEncodingHandler (xmlCharEncoding enc); +XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL + xmlFindCharEncodingHandler (const char *name); +XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL + xmlNewCharEncodingHandler (const char *name, + xmlCharEncodingInputFunc input, + xmlCharEncodingOutputFunc output); + +/* + * Interfaces for encoding names and aliases. + */ +XMLPUBFUN int XMLCALL + xmlAddEncodingAlias (const char *name, + const char *alias); +XMLPUBFUN int XMLCALL + xmlDelEncodingAlias (const char *alias); +XMLPUBFUN const char * XMLCALL + xmlGetEncodingAlias (const char *alias); +XMLPUBFUN void XMLCALL + xmlCleanupEncodingAliases (void); +XMLPUBFUN xmlCharEncoding XMLCALL + xmlParseCharEncoding (const char *name); +XMLPUBFUN const char * XMLCALL + xmlGetCharEncodingName (xmlCharEncoding enc); + +/* + * Interfaces directly used by the parsers. + */ +XMLPUBFUN xmlCharEncoding XMLCALL + xmlDetectCharEncoding (const unsigned char *in, + int len); + +XMLPUBFUN int XMLCALL + xmlCharEncOutFunc (xmlCharEncodingHandler *handler, + xmlBufferPtr out, + xmlBufferPtr in); + +XMLPUBFUN int XMLCALL + xmlCharEncInFunc (xmlCharEncodingHandler *handler, + xmlBufferPtr out, + xmlBufferPtr in); +XMLPUBFUN int XMLCALL + xmlCharEncFirstLine (xmlCharEncodingHandler *handler, + xmlBufferPtr out, + xmlBufferPtr in); +XMLPUBFUN int XMLCALL + xmlCharEncCloseFunc (xmlCharEncodingHandler *handler); + +/* + * Export a few useful functions + */ +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN int XMLCALL + UTF8Toisolat1 (unsigned char *out, + int *outlen, + const unsigned char *in, + int *inlen); +#endif /* LIBXML_OUTPUT_ENABLED */ +XMLPUBFUN int XMLCALL + isolat1ToUTF8 (unsigned char *out, + int *outlen, + const unsigned char *in, + int *inlen); +#ifdef __cplusplus +} +#endif + +#endif /* __XML_CHAR_ENCODING_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/entities.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/entities.h new file mode 100644 index 0000000..47b4573 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/entities.h @@ -0,0 +1,151 @@ +/* + * Summary: interface for the XML entities handling + * Description: this module provides some of the entity API needed + * for the parser and applications. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_ENTITIES_H__ +#define __XML_ENTITIES_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The different valid entity types. + */ +typedef enum { + XML_INTERNAL_GENERAL_ENTITY = 1, + XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2, + XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3, + XML_INTERNAL_PARAMETER_ENTITY = 4, + XML_EXTERNAL_PARAMETER_ENTITY = 5, + XML_INTERNAL_PREDEFINED_ENTITY = 6 +} xmlEntityType; + +/* + * An unit of storage for an entity, contains the string, the value + * and the linkind data needed for the linking in the hash table. + */ + +struct _xmlEntity { + void *_private; /* application data */ + xmlElementType type; /* XML_ENTITY_DECL, must be second ! */ + const xmlChar *name; /* Entity name */ + struct _xmlNode *children; /* First child link */ + struct _xmlNode *last; /* Last child link */ + struct _xmlDtd *parent; /* -> DTD */ + struct _xmlNode *next; /* next sibling link */ + struct _xmlNode *prev; /* previous sibling link */ + struct _xmlDoc *doc; /* the containing document */ + + xmlChar *orig; /* content without ref substitution */ + xmlChar *content; /* content or ndata if unparsed */ + int length; /* the content length */ + xmlEntityType etype; /* The entity type */ + const xmlChar *ExternalID; /* External identifier for PUBLIC */ + const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */ + + struct _xmlEntity *nexte; /* unused */ + const xmlChar *URI; /* the full URI as computed */ + int owner; /* does the entity own the childrens */ + int checked; /* was the entity content checked */ + /* this is also used to count entities + * references done from that entity + * and if it contains '<' */ +}; + +/* + * All entities are stored in an hash table. + * There is 2 separate hash tables for global and parameter entities. + */ + +typedef struct _xmlHashTable xmlEntitiesTable; +typedef xmlEntitiesTable *xmlEntitiesTablePtr; + +/* + * External functions: + */ + +#ifdef LIBXML_LEGACY_ENABLED +XMLPUBFUN void XMLCALL + xmlInitializePredefinedEntities (void); +#endif /* LIBXML_LEGACY_ENABLED */ + +XMLPUBFUN xmlEntityPtr XMLCALL + xmlNewEntity (xmlDocPtr doc, + const xmlChar *name, + int type, + const xmlChar *ExternalID, + const xmlChar *SystemID, + const xmlChar *content); +XMLPUBFUN xmlEntityPtr XMLCALL + xmlAddDocEntity (xmlDocPtr doc, + const xmlChar *name, + int type, + const xmlChar *ExternalID, + const xmlChar *SystemID, + const xmlChar *content); +XMLPUBFUN xmlEntityPtr XMLCALL + xmlAddDtdEntity (xmlDocPtr doc, + const xmlChar *name, + int type, + const xmlChar *ExternalID, + const xmlChar *SystemID, + const xmlChar *content); +XMLPUBFUN xmlEntityPtr XMLCALL + xmlGetPredefinedEntity (const xmlChar *name); +XMLPUBFUN xmlEntityPtr XMLCALL + xmlGetDocEntity (const xmlDoc *doc, + const xmlChar *name); +XMLPUBFUN xmlEntityPtr XMLCALL + xmlGetDtdEntity (xmlDocPtr doc, + const xmlChar *name); +XMLPUBFUN xmlEntityPtr XMLCALL + xmlGetParameterEntity (xmlDocPtr doc, + const xmlChar *name); +#ifdef LIBXML_LEGACY_ENABLED +XMLPUBFUN const xmlChar * XMLCALL + xmlEncodeEntities (xmlDocPtr doc, + const xmlChar *input); +#endif /* LIBXML_LEGACY_ENABLED */ +XMLPUBFUN xmlChar * XMLCALL + xmlEncodeEntitiesReentrant(xmlDocPtr doc, + const xmlChar *input); +XMLPUBFUN xmlChar * XMLCALL + xmlEncodeSpecialChars (const xmlDoc *doc, + const xmlChar *input); +XMLPUBFUN xmlEntitiesTablePtr XMLCALL + xmlCreateEntitiesTable (void); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN xmlEntitiesTablePtr XMLCALL + xmlCopyEntitiesTable (xmlEntitiesTablePtr table); +#endif /* LIBXML_TREE_ENABLED */ +XMLPUBFUN void XMLCALL + xmlFreeEntitiesTable (xmlEntitiesTablePtr table); +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void XMLCALL + xmlDumpEntitiesTable (xmlBufferPtr buf, + xmlEntitiesTablePtr table); +XMLPUBFUN void XMLCALL + xmlDumpEntityDecl (xmlBufferPtr buf, + xmlEntityPtr ent); +#endif /* LIBXML_OUTPUT_ENABLED */ +#ifdef LIBXML_LEGACY_ENABLED +XMLPUBFUN void XMLCALL + xmlCleanupPredefinedEntities(void); +#endif /* LIBXML_LEGACY_ENABLED */ + + +#ifdef __cplusplus +} +#endif + +# endif /* __XML_ENTITIES_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/globals.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/globals.h new file mode 100644 index 0000000..5e41b7b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/globals.h @@ -0,0 +1,508 @@ +/* + * Summary: interface for all global variables of the library + * Description: all the global variables and thread handling for + * those variables is handled by this module. + * + * The bottom of this file is automatically generated by build_glob.py + * based on the description file global.data + * + * Copy: See Copyright for the status of this software. + * + * Author: Gary Pennington , Daniel Veillard + */ + +#ifndef __XML_GLOBALS_H +#define __XML_GLOBALS_H + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +XMLPUBFUN void XMLCALL xmlInitGlobals(void); +XMLPUBFUN void XMLCALL xmlCleanupGlobals(void); + +/** + * xmlParserInputBufferCreateFilenameFunc: + * @URI: the URI to read from + * @enc: the requested source encoding + * + * Signature for the function doing the lookup for a suitable input method + * corresponding to an URI. + * + * Returns the new xmlParserInputBufferPtr in case of success or NULL if no + * method was found. + */ +typedef xmlParserInputBufferPtr (*xmlParserInputBufferCreateFilenameFunc) (const char *URI, + xmlCharEncoding enc); + + +/** + * xmlOutputBufferCreateFilenameFunc: + * @URI: the URI to write to + * @enc: the requested target encoding + * + * Signature for the function doing the lookup for a suitable output method + * corresponding to an URI. + * + * Returns the new xmlOutputBufferPtr in case of success or NULL if no + * method was found. + */ +typedef xmlOutputBufferPtr (*xmlOutputBufferCreateFilenameFunc) (const char *URI, + xmlCharEncodingHandlerPtr encoder, + int compression); + +XMLPUBFUN xmlParserInputBufferCreateFilenameFunc +XMLCALL xmlParserInputBufferCreateFilenameDefault (xmlParserInputBufferCreateFilenameFunc func); +XMLPUBFUN xmlOutputBufferCreateFilenameFunc +XMLCALL xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc func); + +/* + * Externally global symbols which need to be protected for backwards + * compatibility support. + */ + +#undef docbDefaultSAXHandler +#undef htmlDefaultSAXHandler +#undef oldXMLWDcompatibility +#undef xmlBufferAllocScheme +#undef xmlDefaultBufferSize +#undef xmlDefaultSAXHandler +#undef xmlDefaultSAXLocator +#undef xmlDoValidityCheckingDefaultValue +#undef xmlFree +#undef xmlGenericError +#undef xmlStructuredError +#undef xmlGenericErrorContext +#undef xmlStructuredErrorContext +#undef xmlGetWarningsDefaultValue +#undef xmlIndentTreeOutput +#undef xmlTreeIndentString +#undef xmlKeepBlanksDefaultValue +#undef xmlLineNumbersDefaultValue +#undef xmlLoadExtDtdDefaultValue +#undef xmlMalloc +#undef xmlMallocAtomic +#undef xmlMemStrdup +#undef xmlParserDebugEntities +#undef xmlParserVersion +#undef xmlPedanticParserDefaultValue +#undef xmlRealloc +#undef xmlSaveNoEmptyTags +#undef xmlSubstituteEntitiesDefaultValue +#undef xmlRegisterNodeDefaultValue +#undef xmlDeregisterNodeDefaultValue +#undef xmlLastError +#undef xmlParserInputBufferCreateFilenameValue +#undef xmlOutputBufferCreateFilenameValue + +/** + * xmlRegisterNodeFunc: + * @node: the current node + * + * Signature for the registration callback of a created node + */ +typedef void (*xmlRegisterNodeFunc) (xmlNodePtr node); +/** + * xmlDeregisterNodeFunc: + * @node: the current node + * + * Signature for the deregistration callback of a discarded node + */ +typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node); + +typedef struct _xmlGlobalState xmlGlobalState; +typedef xmlGlobalState *xmlGlobalStatePtr; +struct _xmlGlobalState +{ + const char *xmlParserVersion; + + xmlSAXLocator xmlDefaultSAXLocator; + xmlSAXHandlerV1 xmlDefaultSAXHandler; + xmlSAXHandlerV1 docbDefaultSAXHandler; + xmlSAXHandlerV1 htmlDefaultSAXHandler; + + xmlFreeFunc xmlFree; + xmlMallocFunc xmlMalloc; + xmlStrdupFunc xmlMemStrdup; + xmlReallocFunc xmlRealloc; + + xmlGenericErrorFunc xmlGenericError; + xmlStructuredErrorFunc xmlStructuredError; + void *xmlGenericErrorContext; + + int oldXMLWDcompatibility; + + xmlBufferAllocationScheme xmlBufferAllocScheme; + int xmlDefaultBufferSize; + + int xmlSubstituteEntitiesDefaultValue; + int xmlDoValidityCheckingDefaultValue; + int xmlGetWarningsDefaultValue; + int xmlKeepBlanksDefaultValue; + int xmlLineNumbersDefaultValue; + int xmlLoadExtDtdDefaultValue; + int xmlParserDebugEntities; + int xmlPedanticParserDefaultValue; + + int xmlSaveNoEmptyTags; + int xmlIndentTreeOutput; + const char *xmlTreeIndentString; + + xmlRegisterNodeFunc xmlRegisterNodeDefaultValue; + xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue; + + xmlMallocFunc xmlMallocAtomic; + xmlError xmlLastError; + + xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue; + xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue; + + void *xmlStructuredErrorContext; +}; + +#ifdef __cplusplus +} +#endif +#include +#ifdef __cplusplus +extern "C" { +#endif + +XMLPUBFUN void XMLCALL xmlInitializeGlobalState(xmlGlobalStatePtr gs); + +XMLPUBFUN void XMLCALL xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler); + +XMLPUBFUN void XMLCALL xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler); + +XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlRegisterNodeDefault(xmlRegisterNodeFunc func); +XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func); +XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func); +XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func); + +XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL + xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func); +XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL + xmlThrDefParserInputBufferCreateFilenameDefault( + xmlParserInputBufferCreateFilenameFunc func); + +/** DOC_DISABLE */ +/* + * In general the memory allocation entry points are not kept + * thread specific but this can be overridden by LIBXML_THREAD_ALLOC_ENABLED + * - xmlMalloc + * - xmlMallocAtomic + * - xmlRealloc + * - xmlMemStrdup + * - xmlFree + */ + +#ifdef LIBXML_THREAD_ALLOC_ENABLED +#ifdef LIBXML_THREAD_ENABLED +XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMalloc(void); +#define xmlMalloc \ +(*(__xmlMalloc())) +#else +XMLPUBVAR xmlMallocFunc xmlMalloc; +#endif + +#ifdef LIBXML_THREAD_ENABLED +XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMallocAtomic(void); +#define xmlMallocAtomic \ +(*(__xmlMallocAtomic())) +#else +XMLPUBVAR xmlMallocFunc xmlMallocAtomic; +#endif + +#ifdef LIBXML_THREAD_ENABLED +XMLPUBFUN xmlReallocFunc * XMLCALL __xmlRealloc(void); +#define xmlRealloc \ +(*(__xmlRealloc())) +#else +XMLPUBVAR xmlReallocFunc xmlRealloc; +#endif + +#ifdef LIBXML_THREAD_ENABLED +XMLPUBFUN xmlFreeFunc * XMLCALL __xmlFree(void); +#define xmlFree \ +(*(__xmlFree())) +#else +XMLPUBVAR xmlFreeFunc xmlFree; +#endif + +#ifdef LIBXML_THREAD_ENABLED +XMLPUBFUN xmlStrdupFunc * XMLCALL __xmlMemStrdup(void); +#define xmlMemStrdup \ +(*(__xmlMemStrdup())) +#else +XMLPUBVAR xmlStrdupFunc xmlMemStrdup; +#endif + +#else /* !LIBXML_THREAD_ALLOC_ENABLED */ +XMLPUBVAR xmlMallocFunc xmlMalloc; +XMLPUBVAR xmlMallocFunc xmlMallocAtomic; +XMLPUBVAR xmlReallocFunc xmlRealloc; +XMLPUBVAR xmlFreeFunc xmlFree; +XMLPUBVAR xmlStrdupFunc xmlMemStrdup; +#endif /* LIBXML_THREAD_ALLOC_ENABLED */ + +#ifdef LIBXML_DOCB_ENABLED +XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __docbDefaultSAXHandler(void); +#ifdef LIBXML_THREAD_ENABLED +#define docbDefaultSAXHandler \ +(*(__docbDefaultSAXHandler())) +#else +XMLPUBVAR xmlSAXHandlerV1 docbDefaultSAXHandler; +#endif +#endif + +#ifdef LIBXML_HTML_ENABLED +XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __htmlDefaultSAXHandler(void); +#ifdef LIBXML_THREAD_ENABLED +#define htmlDefaultSAXHandler \ +(*(__htmlDefaultSAXHandler())) +#else +XMLPUBVAR xmlSAXHandlerV1 htmlDefaultSAXHandler; +#endif +#endif + +XMLPUBFUN xmlError * XMLCALL __xmlLastError(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlLastError \ +(*(__xmlLastError())) +#else +XMLPUBVAR xmlError xmlLastError; +#endif + +/* + * Everything starting from the line below is + * Automatically generated by build_glob.py. + * Do not modify the previous line. + */ + + +XMLPUBFUN int * XMLCALL __oldXMLWDcompatibility(void); +#ifdef LIBXML_THREAD_ENABLED +#define oldXMLWDcompatibility \ +(*(__oldXMLWDcompatibility())) +#else +XMLPUBVAR int oldXMLWDcompatibility; +#endif + +XMLPUBFUN xmlBufferAllocationScheme * XMLCALL __xmlBufferAllocScheme(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlBufferAllocScheme \ +(*(__xmlBufferAllocScheme())) +#else +XMLPUBVAR xmlBufferAllocationScheme xmlBufferAllocScheme; +#endif +XMLPUBFUN xmlBufferAllocationScheme XMLCALL + xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v); + +XMLPUBFUN int * XMLCALL __xmlDefaultBufferSize(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlDefaultBufferSize \ +(*(__xmlDefaultBufferSize())) +#else +XMLPUBVAR int xmlDefaultBufferSize; +#endif +XMLPUBFUN int XMLCALL xmlThrDefDefaultBufferSize(int v); + +XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __xmlDefaultSAXHandler(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlDefaultSAXHandler \ +(*(__xmlDefaultSAXHandler())) +#else +XMLPUBVAR xmlSAXHandlerV1 xmlDefaultSAXHandler; +#endif + +XMLPUBFUN xmlSAXLocator * XMLCALL __xmlDefaultSAXLocator(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlDefaultSAXLocator \ +(*(__xmlDefaultSAXLocator())) +#else +XMLPUBVAR xmlSAXLocator xmlDefaultSAXLocator; +#endif + +XMLPUBFUN int * XMLCALL __xmlDoValidityCheckingDefaultValue(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlDoValidityCheckingDefaultValue \ +(*(__xmlDoValidityCheckingDefaultValue())) +#else +XMLPUBVAR int xmlDoValidityCheckingDefaultValue; +#endif +XMLPUBFUN int XMLCALL xmlThrDefDoValidityCheckingDefaultValue(int v); + +XMLPUBFUN xmlGenericErrorFunc * XMLCALL __xmlGenericError(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlGenericError \ +(*(__xmlGenericError())) +#else +XMLPUBVAR xmlGenericErrorFunc xmlGenericError; +#endif + +XMLPUBFUN xmlStructuredErrorFunc * XMLCALL __xmlStructuredError(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlStructuredError \ +(*(__xmlStructuredError())) +#else +XMLPUBVAR xmlStructuredErrorFunc xmlStructuredError; +#endif + +XMLPUBFUN void * * XMLCALL __xmlGenericErrorContext(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlGenericErrorContext \ +(*(__xmlGenericErrorContext())) +#else +XMLPUBVAR void * xmlGenericErrorContext; +#endif + +XMLPUBFUN void * * XMLCALL __xmlStructuredErrorContext(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlStructuredErrorContext \ +(*(__xmlStructuredErrorContext())) +#else +XMLPUBVAR void * xmlStructuredErrorContext; +#endif + +XMLPUBFUN int * XMLCALL __xmlGetWarningsDefaultValue(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlGetWarningsDefaultValue \ +(*(__xmlGetWarningsDefaultValue())) +#else +XMLPUBVAR int xmlGetWarningsDefaultValue; +#endif +XMLPUBFUN int XMLCALL xmlThrDefGetWarningsDefaultValue(int v); + +XMLPUBFUN int * XMLCALL __xmlIndentTreeOutput(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlIndentTreeOutput \ +(*(__xmlIndentTreeOutput())) +#else +XMLPUBVAR int xmlIndentTreeOutput; +#endif +XMLPUBFUN int XMLCALL xmlThrDefIndentTreeOutput(int v); + +XMLPUBFUN const char * * XMLCALL __xmlTreeIndentString(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlTreeIndentString \ +(*(__xmlTreeIndentString())) +#else +XMLPUBVAR const char * xmlTreeIndentString; +#endif +XMLPUBFUN const char * XMLCALL xmlThrDefTreeIndentString(const char * v); + +XMLPUBFUN int * XMLCALL __xmlKeepBlanksDefaultValue(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlKeepBlanksDefaultValue \ +(*(__xmlKeepBlanksDefaultValue())) +#else +XMLPUBVAR int xmlKeepBlanksDefaultValue; +#endif +XMLPUBFUN int XMLCALL xmlThrDefKeepBlanksDefaultValue(int v); + +XMLPUBFUN int * XMLCALL __xmlLineNumbersDefaultValue(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlLineNumbersDefaultValue \ +(*(__xmlLineNumbersDefaultValue())) +#else +XMLPUBVAR int xmlLineNumbersDefaultValue; +#endif +XMLPUBFUN int XMLCALL xmlThrDefLineNumbersDefaultValue(int v); + +XMLPUBFUN int * XMLCALL __xmlLoadExtDtdDefaultValue(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlLoadExtDtdDefaultValue \ +(*(__xmlLoadExtDtdDefaultValue())) +#else +XMLPUBVAR int xmlLoadExtDtdDefaultValue; +#endif +XMLPUBFUN int XMLCALL xmlThrDefLoadExtDtdDefaultValue(int v); + +XMLPUBFUN int * XMLCALL __xmlParserDebugEntities(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlParserDebugEntities \ +(*(__xmlParserDebugEntities())) +#else +XMLPUBVAR int xmlParserDebugEntities; +#endif +XMLPUBFUN int XMLCALL xmlThrDefParserDebugEntities(int v); + +XMLPUBFUN const char * * XMLCALL __xmlParserVersion(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlParserVersion \ +(*(__xmlParserVersion())) +#else +XMLPUBVAR const char * xmlParserVersion; +#endif + +XMLPUBFUN int * XMLCALL __xmlPedanticParserDefaultValue(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlPedanticParserDefaultValue \ +(*(__xmlPedanticParserDefaultValue())) +#else +XMLPUBVAR int xmlPedanticParserDefaultValue; +#endif +XMLPUBFUN int XMLCALL xmlThrDefPedanticParserDefaultValue(int v); + +XMLPUBFUN int * XMLCALL __xmlSaveNoEmptyTags(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlSaveNoEmptyTags \ +(*(__xmlSaveNoEmptyTags())) +#else +XMLPUBVAR int xmlSaveNoEmptyTags; +#endif +XMLPUBFUN int XMLCALL xmlThrDefSaveNoEmptyTags(int v); + +XMLPUBFUN int * XMLCALL __xmlSubstituteEntitiesDefaultValue(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlSubstituteEntitiesDefaultValue \ +(*(__xmlSubstituteEntitiesDefaultValue())) +#else +XMLPUBVAR int xmlSubstituteEntitiesDefaultValue; +#endif +XMLPUBFUN int XMLCALL xmlThrDefSubstituteEntitiesDefaultValue(int v); + +XMLPUBFUN xmlRegisterNodeFunc * XMLCALL __xmlRegisterNodeDefaultValue(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlRegisterNodeDefaultValue \ +(*(__xmlRegisterNodeDefaultValue())) +#else +XMLPUBVAR xmlRegisterNodeFunc xmlRegisterNodeDefaultValue; +#endif + +XMLPUBFUN xmlDeregisterNodeFunc * XMLCALL __xmlDeregisterNodeDefaultValue(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlDeregisterNodeDefaultValue \ +(*(__xmlDeregisterNodeDefaultValue())) +#else +XMLPUBVAR xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue; +#endif + +XMLPUBFUN xmlParserInputBufferCreateFilenameFunc * XMLCALL \ + __xmlParserInputBufferCreateFilenameValue(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlParserInputBufferCreateFilenameValue \ +(*(__xmlParserInputBufferCreateFilenameValue())) +#else +XMLPUBVAR xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue; +#endif + +XMLPUBFUN xmlOutputBufferCreateFilenameFunc * XMLCALL __xmlOutputBufferCreateFilenameValue(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlOutputBufferCreateFilenameValue \ +(*(__xmlOutputBufferCreateFilenameValue())) +#else +XMLPUBVAR xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue; +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_GLOBALS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/hash.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/hash.h new file mode 100644 index 0000000..6352874 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/hash.h @@ -0,0 +1,236 @@ +/* + * Summary: Chained hash tables + * Description: This module implements the hash table support used in + * various places in the library. + * + * Copy: See Copyright for the status of this software. + * + * Author: Bjorn Reese + */ + +#ifndef __XML_HASH_H__ +#define __XML_HASH_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The hash table. + */ +typedef struct _xmlHashTable xmlHashTable; +typedef xmlHashTable *xmlHashTablePtr; + +#ifdef __cplusplus +} +#endif + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Recent version of gcc produce a warning when a function pointer is assigned + * to an object pointer, or vice versa. The following macro is a dirty hack + * to allow suppression of the warning. If your architecture has function + * pointers which are a different size than a void pointer, there may be some + * serious trouble within the library. + */ +/** + * XML_CAST_FPTR: + * @fptr: pointer to a function + * + * Macro to do a casting from an object pointer to a + * function pointer without encountering a warning from + * gcc + * + * #define XML_CAST_FPTR(fptr) (*(void **)(&fptr)) + * This macro violated ISO C aliasing rules (gcc4 on s390 broke) + * so it is disabled now + */ + +#define XML_CAST_FPTR(fptr) fptr + + +/* + * function types: + */ +/** + * xmlHashDeallocator: + * @payload: the data in the hash + * @name: the name associated + * + * Callback to free data from a hash. + */ +typedef void (*xmlHashDeallocator)(void *payload, const xmlChar *name); +/** + * xmlHashCopier: + * @payload: the data in the hash + * @name: the name associated + * + * Callback to copy data from a hash. + * + * Returns a copy of the data or NULL in case of error. + */ +typedef void *(*xmlHashCopier)(void *payload, const xmlChar *name); +/** + * xmlHashScanner: + * @payload: the data in the hash + * @data: extra scannner data + * @name: the name associated + * + * Callback when scanning data in a hash with the simple scanner. + */ +typedef void (*xmlHashScanner)(void *payload, void *data, const xmlChar *name); +/** + * xmlHashScannerFull: + * @payload: the data in the hash + * @data: extra scannner data + * @name: the name associated + * @name2: the second name associated + * @name3: the third name associated + * + * Callback when scanning data in a hash with the full scanner. + */ +typedef void (*xmlHashScannerFull)(void *payload, void *data, + const xmlChar *name, const xmlChar *name2, + const xmlChar *name3); + +/* + * Constructor and destructor. + */ +XMLPUBFUN xmlHashTablePtr XMLCALL + xmlHashCreate (int size); +XMLPUBFUN xmlHashTablePtr XMLCALL + xmlHashCreateDict(int size, + xmlDictPtr dict); +XMLPUBFUN void XMLCALL + xmlHashFree (xmlHashTablePtr table, + xmlHashDeallocator f); +XMLPUBFUN void XMLCALL + xmlHashDefaultDeallocator(void *entry, + const xmlChar *name); + +/* + * Add a new entry to the hash table. + */ +XMLPUBFUN int XMLCALL + xmlHashAddEntry (xmlHashTablePtr table, + const xmlChar *name, + void *userdata); +XMLPUBFUN int XMLCALL + xmlHashUpdateEntry(xmlHashTablePtr table, + const xmlChar *name, + void *userdata, + xmlHashDeallocator f); +XMLPUBFUN int XMLCALL + xmlHashAddEntry2(xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *name2, + void *userdata); +XMLPUBFUN int XMLCALL + xmlHashUpdateEntry2(xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *name2, + void *userdata, + xmlHashDeallocator f); +XMLPUBFUN int XMLCALL + xmlHashAddEntry3(xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *name2, + const xmlChar *name3, + void *userdata); +XMLPUBFUN int XMLCALL + xmlHashUpdateEntry3(xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *name2, + const xmlChar *name3, + void *userdata, + xmlHashDeallocator f); + +/* + * Remove an entry from the hash table. + */ +XMLPUBFUN int XMLCALL + xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, + xmlHashDeallocator f); +XMLPUBFUN int XMLCALL + xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, + const xmlChar *name2, xmlHashDeallocator f); +XMLPUBFUN int XMLCALL + xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name, + const xmlChar *name2, const xmlChar *name3, + xmlHashDeallocator f); + +/* + * Retrieve the userdata. + */ +XMLPUBFUN void * XMLCALL + xmlHashLookup (xmlHashTablePtr table, + const xmlChar *name); +XMLPUBFUN void * XMLCALL + xmlHashLookup2 (xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *name2); +XMLPUBFUN void * XMLCALL + xmlHashLookup3 (xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *name2, + const xmlChar *name3); +XMLPUBFUN void * XMLCALL + xmlHashQLookup (xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *prefix); +XMLPUBFUN void * XMLCALL + xmlHashQLookup2 (xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *prefix, + const xmlChar *name2, + const xmlChar *prefix2); +XMLPUBFUN void * XMLCALL + xmlHashQLookup3 (xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *prefix, + const xmlChar *name2, + const xmlChar *prefix2, + const xmlChar *name3, + const xmlChar *prefix3); + +/* + * Helpers. + */ +XMLPUBFUN xmlHashTablePtr XMLCALL + xmlHashCopy (xmlHashTablePtr table, + xmlHashCopier f); +XMLPUBFUN int XMLCALL + xmlHashSize (xmlHashTablePtr table); +XMLPUBFUN void XMLCALL + xmlHashScan (xmlHashTablePtr table, + xmlHashScanner f, + void *data); +XMLPUBFUN void XMLCALL + xmlHashScan3 (xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *name2, + const xmlChar *name3, + xmlHashScanner f, + void *data); +XMLPUBFUN void XMLCALL + xmlHashScanFull (xmlHashTablePtr table, + xmlHashScannerFull f, + void *data); +XMLPUBFUN void XMLCALL + xmlHashScanFull3(xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *name2, + const xmlChar *name3, + xmlHashScannerFull f, + void *data); +#ifdef __cplusplus +} +#endif +#endif /* ! __XML_HASH_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/list.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/list.h new file mode 100644 index 0000000..3211c75 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/list.h @@ -0,0 +1,137 @@ +/* + * Summary: lists interfaces + * Description: this module implement the list support used in + * various place in the library. + * + * Copy: See Copyright for the status of this software. + * + * Author: Gary Pennington + */ + +#ifndef __XML_LINK_INCLUDE__ +#define __XML_LINK_INCLUDE__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _xmlLink xmlLink; +typedef xmlLink *xmlLinkPtr; + +typedef struct _xmlList xmlList; +typedef xmlList *xmlListPtr; + +/** + * xmlListDeallocator: + * @lk: the data to deallocate + * + * Callback function used to free data from a list. + */ +typedef void (*xmlListDeallocator) (xmlLinkPtr lk); +/** + * xmlListDataCompare: + * @data0: the first data + * @data1: the second data + * + * Callback function used to compare 2 data. + * + * Returns 0 is equality, -1 or 1 otherwise depending on the ordering. + */ +typedef int (*xmlListDataCompare) (const void *data0, const void *data1); +/** + * xmlListWalker: + * @data: the data found in the list + * @user: extra user provided data to the walker + * + * Callback function used when walking a list with xmlListWalk(). + * + * Returns 0 to stop walking the list, 1 otherwise. + */ +typedef int (*xmlListWalker) (const void *data, void *user); + +/* Creation/Deletion */ +XMLPUBFUN xmlListPtr XMLCALL + xmlListCreate (xmlListDeallocator deallocator, + xmlListDataCompare compare); +XMLPUBFUN void XMLCALL + xmlListDelete (xmlListPtr l); + +/* Basic Operators */ +XMLPUBFUN void * XMLCALL + xmlListSearch (xmlListPtr l, + void *data); +XMLPUBFUN void * XMLCALL + xmlListReverseSearch (xmlListPtr l, + void *data); +XMLPUBFUN int XMLCALL + xmlListInsert (xmlListPtr l, + void *data) ; +XMLPUBFUN int XMLCALL + xmlListAppend (xmlListPtr l, + void *data) ; +XMLPUBFUN int XMLCALL + xmlListRemoveFirst (xmlListPtr l, + void *data); +XMLPUBFUN int XMLCALL + xmlListRemoveLast (xmlListPtr l, + void *data); +XMLPUBFUN int XMLCALL + xmlListRemoveAll (xmlListPtr l, + void *data); +XMLPUBFUN void XMLCALL + xmlListClear (xmlListPtr l); +XMLPUBFUN int XMLCALL + xmlListEmpty (xmlListPtr l); +XMLPUBFUN xmlLinkPtr XMLCALL + xmlListFront (xmlListPtr l); +XMLPUBFUN xmlLinkPtr XMLCALL + xmlListEnd (xmlListPtr l); +XMLPUBFUN int XMLCALL + xmlListSize (xmlListPtr l); + +XMLPUBFUN void XMLCALL + xmlListPopFront (xmlListPtr l); +XMLPUBFUN void XMLCALL + xmlListPopBack (xmlListPtr l); +XMLPUBFUN int XMLCALL + xmlListPushFront (xmlListPtr l, + void *data); +XMLPUBFUN int XMLCALL + xmlListPushBack (xmlListPtr l, + void *data); + +/* Advanced Operators */ +XMLPUBFUN void XMLCALL + xmlListReverse (xmlListPtr l); +XMLPUBFUN void XMLCALL + xmlListSort (xmlListPtr l); +XMLPUBFUN void XMLCALL + xmlListWalk (xmlListPtr l, + xmlListWalker walker, + void *user); +XMLPUBFUN void XMLCALL + xmlListReverseWalk (xmlListPtr l, + xmlListWalker walker, + void *user); +XMLPUBFUN void XMLCALL + xmlListMerge (xmlListPtr l1, + xmlListPtr l2); +XMLPUBFUN xmlListPtr XMLCALL + xmlListDup (const xmlListPtr old); +XMLPUBFUN int XMLCALL + xmlListCopy (xmlListPtr cur, + const xmlListPtr old); +/* Link operators */ +XMLPUBFUN void * XMLCALL + xmlLinkGetData (xmlLinkPtr lk); + +/* xmlListUnique() */ +/* xmlListSwap */ + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_LINK_INCLUDE__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/nanoftp.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/nanoftp.h new file mode 100644 index 0000000..7335faf --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/nanoftp.h @@ -0,0 +1,163 @@ +/* + * Summary: minimal FTP implementation + * Description: minimal FTP implementation allowing to fetch resources + * like external subset. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __NANO_FTP_H__ +#define __NANO_FTP_H__ + +#include + +#ifdef LIBXML_FTP_ENABLED + +/* Needed for portability to Windows 64 bits */ +#if defined(_WIN32) && !defined(__CYGWIN__) +#include +#else +/** + * SOCKET: + * + * macro used to provide portability of code to windows sockets + */ +#define SOCKET int +/** + * INVALID_SOCKET: + * + * macro used to provide portability of code to windows sockets + * the value to be used when the socket is not valid + */ +#undef INVALID_SOCKET +#define INVALID_SOCKET (-1) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * ftpListCallback: + * @userData: user provided data for the callback + * @filename: the file name (including "->" when links are shown) + * @attrib: the attribute string + * @owner: the owner string + * @group: the group string + * @size: the file size + * @links: the link count + * @year: the year + * @month: the month + * @day: the day + * @hour: the hour + * @minute: the minute + * + * A callback for the xmlNanoFTPList command. + * Note that only one of year and day:minute are specified. + */ +typedef void (*ftpListCallback) (void *userData, + const char *filename, const char *attrib, + const char *owner, const char *group, + unsigned long size, int links, int year, + const char *month, int day, int hour, + int minute); +/** + * ftpDataCallback: + * @userData: the user provided context + * @data: the data received + * @len: its size in bytes + * + * A callback for the xmlNanoFTPGet command. + */ +typedef void (*ftpDataCallback) (void *userData, + const char *data, + int len); + +/* + * Init + */ +XMLPUBFUN void XMLCALL + xmlNanoFTPInit (void); +XMLPUBFUN void XMLCALL + xmlNanoFTPCleanup (void); + +/* + * Creating/freeing contexts. + */ +XMLPUBFUN void * XMLCALL + xmlNanoFTPNewCtxt (const char *URL); +XMLPUBFUN void XMLCALL + xmlNanoFTPFreeCtxt (void * ctx); +XMLPUBFUN void * XMLCALL + xmlNanoFTPConnectTo (const char *server, + int port); +/* + * Opening/closing session connections. + */ +XMLPUBFUN void * XMLCALL + xmlNanoFTPOpen (const char *URL); +XMLPUBFUN int XMLCALL + xmlNanoFTPConnect (void *ctx); +XMLPUBFUN int XMLCALL + xmlNanoFTPClose (void *ctx); +XMLPUBFUN int XMLCALL + xmlNanoFTPQuit (void *ctx); +XMLPUBFUN void XMLCALL + xmlNanoFTPScanProxy (const char *URL); +XMLPUBFUN void XMLCALL + xmlNanoFTPProxy (const char *host, + int port, + const char *user, + const char *passwd, + int type); +XMLPUBFUN int XMLCALL + xmlNanoFTPUpdateURL (void *ctx, + const char *URL); + +/* + * Rather internal commands. + */ +XMLPUBFUN int XMLCALL + xmlNanoFTPGetResponse (void *ctx); +XMLPUBFUN int XMLCALL + xmlNanoFTPCheckResponse (void *ctx); + +/* + * CD/DIR/GET handlers. + */ +XMLPUBFUN int XMLCALL + xmlNanoFTPCwd (void *ctx, + const char *directory); +XMLPUBFUN int XMLCALL + xmlNanoFTPDele (void *ctx, + const char *file); + +XMLPUBFUN SOCKET XMLCALL + xmlNanoFTPGetConnection (void *ctx); +XMLPUBFUN int XMLCALL + xmlNanoFTPCloseConnection(void *ctx); +XMLPUBFUN int XMLCALL + xmlNanoFTPList (void *ctx, + ftpListCallback callback, + void *userData, + const char *filename); +XMLPUBFUN SOCKET XMLCALL + xmlNanoFTPGetSocket (void *ctx, + const char *filename); +XMLPUBFUN int XMLCALL + xmlNanoFTPGet (void *ctx, + ftpDataCallback callback, + void *userData, + const char *filename); +XMLPUBFUN int XMLCALL + xmlNanoFTPRead (void *ctx, + void *dest, + int len); + +#ifdef __cplusplus +} +#endif +#endif /* LIBXML_FTP_ENABLED */ +#endif /* __NANO_FTP_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/nanohttp.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/nanohttp.h new file mode 100644 index 0000000..22b8fb4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/nanohttp.h @@ -0,0 +1,81 @@ +/* + * Summary: minimal HTTP implementation + * Description: minimal HTTP implementation allowing to fetch resources + * like external subset. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __NANO_HTTP_H__ +#define __NANO_HTTP_H__ + +#include + +#ifdef LIBXML_HTTP_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif +XMLPUBFUN void XMLCALL + xmlNanoHTTPInit (void); +XMLPUBFUN void XMLCALL + xmlNanoHTTPCleanup (void); +XMLPUBFUN void XMLCALL + xmlNanoHTTPScanProxy (const char *URL); +XMLPUBFUN int XMLCALL + xmlNanoHTTPFetch (const char *URL, + const char *filename, + char **contentType); +XMLPUBFUN void * XMLCALL + xmlNanoHTTPMethod (const char *URL, + const char *method, + const char *input, + char **contentType, + const char *headers, + int ilen); +XMLPUBFUN void * XMLCALL + xmlNanoHTTPMethodRedir (const char *URL, + const char *method, + const char *input, + char **contentType, + char **redir, + const char *headers, + int ilen); +XMLPUBFUN void * XMLCALL + xmlNanoHTTPOpen (const char *URL, + char **contentType); +XMLPUBFUN void * XMLCALL + xmlNanoHTTPOpenRedir (const char *URL, + char **contentType, + char **redir); +XMLPUBFUN int XMLCALL + xmlNanoHTTPReturnCode (void *ctx); +XMLPUBFUN const char * XMLCALL + xmlNanoHTTPAuthHeader (void *ctx); +XMLPUBFUN const char * XMLCALL + xmlNanoHTTPRedir (void *ctx); +XMLPUBFUN int XMLCALL + xmlNanoHTTPContentLength( void * ctx ); +XMLPUBFUN const char * XMLCALL + xmlNanoHTTPEncoding (void *ctx); +XMLPUBFUN const char * XMLCALL + xmlNanoHTTPMimeType (void *ctx); +XMLPUBFUN int XMLCALL + xmlNanoHTTPRead (void *ctx, + void *dest, + int len); +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN int XMLCALL + xmlNanoHTTPSave (void *ctxt, + const char *filename); +#endif /* LIBXML_OUTPUT_ENABLED */ +XMLPUBFUN void XMLCALL + xmlNanoHTTPClose (void *ctx); +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_HTTP_ENABLED */ +#endif /* __NANO_HTTP_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/parser.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/parser.h new file mode 100644 index 0000000..47fbec0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/parser.h @@ -0,0 +1,1241 @@ +/* + * Summary: the core parser module + * Description: Interfaces, constants and types related to the XML parser + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_PARSER_H__ +#define __XML_PARSER_H__ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * XML_DEFAULT_VERSION: + * + * The default version of XML used: 1.0 + */ +#define XML_DEFAULT_VERSION "1.0" + +/** + * xmlParserInput: + * + * An xmlParserInput is an input flow for the XML processor. + * Each entity parsed is associated an xmlParserInput (except the + * few predefined ones). This is the case both for internal entities + * - in which case the flow is already completely in memory - or + * external entities - in which case we use the buf structure for + * progressive reading and I18N conversions to the internal UTF-8 format. + */ + +/** + * xmlParserInputDeallocate: + * @str: the string to deallocate + * + * Callback for freeing some parser input allocations. + */ +typedef void (* xmlParserInputDeallocate)(xmlChar *str); + +struct _xmlParserInput { + /* Input buffer */ + xmlParserInputBufferPtr buf; /* UTF-8 encoded buffer */ + + const char *filename; /* The file analyzed, if any */ + const char *directory; /* the directory/base of the file */ + const xmlChar *base; /* Base of the array to parse */ + const xmlChar *cur; /* Current char being parsed */ + const xmlChar *end; /* end of the array to parse */ + int length; /* length if known */ + int line; /* Current line */ + int col; /* Current column */ + /* + * NOTE: consumed is only tested for equality in the parser code, + * so even if there is an overflow this should not give troubles + * for parsing very large instances. + */ + unsigned long consumed; /* How many xmlChars already consumed */ + xmlParserInputDeallocate free; /* function to deallocate the base */ + const xmlChar *encoding; /* the encoding string for entity */ + const xmlChar *version; /* the version string for entity */ + int standalone; /* Was that entity marked standalone */ + int id; /* an unique identifier for the entity */ +}; + +/** + * xmlParserNodeInfo: + * + * The parser can be asked to collect Node informations, i.e. at what + * place in the file they were detected. + * NOTE: This is off by default and not very well tested. + */ +typedef struct _xmlParserNodeInfo xmlParserNodeInfo; +typedef xmlParserNodeInfo *xmlParserNodeInfoPtr; + +struct _xmlParserNodeInfo { + const struct _xmlNode* node; + /* Position & line # that text that created the node begins & ends on */ + unsigned long begin_pos; + unsigned long begin_line; + unsigned long end_pos; + unsigned long end_line; +}; + +typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq; +typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr; +struct _xmlParserNodeInfoSeq { + unsigned long maximum; + unsigned long length; + xmlParserNodeInfo* buffer; +}; + +/** + * xmlParserInputState: + * + * The parser is now working also as a state based parser. + * The recursive one use the state info for entities processing. + */ +typedef enum { + XML_PARSER_EOF = -1, /* nothing is to be parsed */ + XML_PARSER_START = 0, /* nothing has been parsed */ + XML_PARSER_MISC, /* Misc* before int subset */ + XML_PARSER_PI, /* Within a processing instruction */ + XML_PARSER_DTD, /* within some DTD content */ + XML_PARSER_PROLOG, /* Misc* after internal subset */ + XML_PARSER_COMMENT, /* within a comment */ + XML_PARSER_START_TAG, /* within a start tag */ + XML_PARSER_CONTENT, /* within the content */ + XML_PARSER_CDATA_SECTION, /* within a CDATA section */ + XML_PARSER_END_TAG, /* within a closing tag */ + XML_PARSER_ENTITY_DECL, /* within an entity declaration */ + XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */ + XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */ + XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */ + XML_PARSER_EPILOG, /* the Misc* after the last end tag */ + XML_PARSER_IGNORE, /* within an IGNORED section */ + XML_PARSER_PUBLIC_LITERAL /* within a PUBLIC value */ +} xmlParserInputState; + +/** + * XML_DETECT_IDS: + * + * Bit in the loadsubset context field to tell to do ID/REFs lookups. + * Use it to initialize xmlLoadExtDtdDefaultValue. + */ +#define XML_DETECT_IDS 2 + +/** + * XML_COMPLETE_ATTRS: + * + * Bit in the loadsubset context field to tell to do complete the + * elements attributes lists with the ones defaulted from the DTDs. + * Use it to initialize xmlLoadExtDtdDefaultValue. + */ +#define XML_COMPLETE_ATTRS 4 + +/** + * XML_SKIP_IDS: + * + * Bit in the loadsubset context field to tell to not do ID/REFs registration. + * Used to initialize xmlLoadExtDtdDefaultValue in some special cases. + */ +#define XML_SKIP_IDS 8 + +/** + * xmlParserMode: + * + * A parser can operate in various modes + */ +typedef enum { + XML_PARSE_UNKNOWN = 0, + XML_PARSE_DOM = 1, + XML_PARSE_SAX = 2, + XML_PARSE_PUSH_DOM = 3, + XML_PARSE_PUSH_SAX = 4, + XML_PARSE_READER = 5 +} xmlParserMode; + +/** + * xmlParserCtxt: + * + * The parser context. + * NOTE This doesn't completely define the parser state, the (current ?) + * design of the parser uses recursive function calls since this allow + * and easy mapping from the production rules of the specification + * to the actual code. The drawback is that the actual function call + * also reflect the parser state. However most of the parsing routines + * takes as the only argument the parser context pointer, so migrating + * to a state based parser for progressive parsing shouldn't be too hard. + */ +struct _xmlParserCtxt { + struct _xmlSAXHandler *sax; /* The SAX handler */ + void *userData; /* For SAX interface only, used by DOM build */ + xmlDocPtr myDoc; /* the document being built */ + int wellFormed; /* is the document well formed */ + int replaceEntities; /* shall we replace entities ? */ + const xmlChar *version; /* the XML version string */ + const xmlChar *encoding; /* the declared encoding, if any */ + int standalone; /* standalone document */ + int html; /* an HTML(1)/Docbook(2) document + * 3 is HTML after + * 10 is HTML after + */ + + /* Input stream stack */ + xmlParserInputPtr input; /* Current input stream */ + int inputNr; /* Number of current input streams */ + int inputMax; /* Max number of input streams */ + xmlParserInputPtr *inputTab; /* stack of inputs */ + + /* Node analysis stack only used for DOM building */ + xmlNodePtr node; /* Current parsed Node */ + int nodeNr; /* Depth of the parsing stack */ + int nodeMax; /* Max depth of the parsing stack */ + xmlNodePtr *nodeTab; /* array of nodes */ + + int record_info; /* Whether node info should be kept */ + xmlParserNodeInfoSeq node_seq; /* info about each node parsed */ + + int errNo; /* error code */ + + int hasExternalSubset; /* reference and external subset */ + int hasPErefs; /* the internal subset has PE refs */ + int external; /* are we parsing an external entity */ + + int valid; /* is the document valid */ + int validate; /* shall we try to validate ? */ + xmlValidCtxt vctxt; /* The validity context */ + + xmlParserInputState instate; /* current type of input */ + int token; /* next char look-ahead */ + + char *directory; /* the data directory */ + + /* Node name stack */ + const xmlChar *name; /* Current parsed Node */ + int nameNr; /* Depth of the parsing stack */ + int nameMax; /* Max depth of the parsing stack */ + const xmlChar * *nameTab; /* array of nodes */ + + long nbChars; /* number of xmlChar processed */ + long checkIndex; /* used by progressive parsing lookup */ + int keepBlanks; /* ugly but ... */ + int disableSAX; /* SAX callbacks are disabled */ + int inSubset; /* Parsing is in int 1/ext 2 subset */ + const xmlChar * intSubName; /* name of subset */ + xmlChar * extSubURI; /* URI of external subset */ + xmlChar * extSubSystem; /* SYSTEM ID of external subset */ + + /* xml:space values */ + int * space; /* Should the parser preserve spaces */ + int spaceNr; /* Depth of the parsing stack */ + int spaceMax; /* Max depth of the parsing stack */ + int * spaceTab; /* array of space infos */ + + int depth; /* to prevent entity substitution loops */ + xmlParserInputPtr entity; /* used to check entities boundaries */ + int charset; /* encoding of the in-memory content + actually an xmlCharEncoding */ + int nodelen; /* Those two fields are there to */ + int nodemem; /* Speed up large node parsing */ + int pedantic; /* signal pedantic warnings */ + void *_private; /* For user data, libxml won't touch it */ + + int loadsubset; /* should the external subset be loaded */ + int linenumbers; /* set line number in element content */ + void *catalogs; /* document's own catalog */ + int recovery; /* run in recovery mode */ + int progressive; /* is this a progressive parsing */ + xmlDictPtr dict; /* dictionary for the parser */ + const xmlChar * *atts; /* array for the attributes callbacks */ + int maxatts; /* the size of the array */ + int docdict; /* use strings from dict to build tree */ + + /* + * pre-interned strings + */ + const xmlChar *str_xml; + const xmlChar *str_xmlns; + const xmlChar *str_xml_ns; + + /* + * Everything below is used only by the new SAX mode + */ + int sax2; /* operating in the new SAX mode */ + int nsNr; /* the number of inherited namespaces */ + int nsMax; /* the size of the arrays */ + const xmlChar * *nsTab; /* the array of prefix/namespace name */ + int *attallocs; /* which attribute were allocated */ + void * *pushTab; /* array of data for push */ + xmlHashTablePtr attsDefault; /* defaulted attributes if any */ + xmlHashTablePtr attsSpecial; /* non-CDATA attributes if any */ + int nsWellFormed; /* is the document XML Nanespace okay */ + int options; /* Extra options */ + + /* + * Those fields are needed only for treaming parsing so far + */ + int dictNames; /* Use dictionary names for the tree */ + int freeElemsNr; /* number of freed element nodes */ + xmlNodePtr freeElems; /* List of freed element nodes */ + int freeAttrsNr; /* number of freed attributes nodes */ + xmlAttrPtr freeAttrs; /* List of freed attributes nodes */ + + /* + * the complete error informations for the last error. + */ + xmlError lastError; + xmlParserMode parseMode; /* the parser mode */ + unsigned long nbentities; /* number of entities references */ + unsigned long sizeentities; /* size of parsed entities */ + + /* for use by HTML non-recursive parser */ + xmlParserNodeInfo *nodeInfo; /* Current NodeInfo */ + int nodeInfoNr; /* Depth of the parsing stack */ + int nodeInfoMax; /* Max depth of the parsing stack */ + xmlParserNodeInfo *nodeInfoTab; /* array of nodeInfos */ + + int input_id; /* we need to label inputs */ + unsigned long sizeentcopy; /* volume of entity copy */ +}; + +/** + * xmlSAXLocator: + * + * A SAX Locator. + */ +struct _xmlSAXLocator { + const xmlChar *(*getPublicId)(void *ctx); + const xmlChar *(*getSystemId)(void *ctx); + int (*getLineNumber)(void *ctx); + int (*getColumnNumber)(void *ctx); +}; + +/** + * xmlSAXHandler: + * + * A SAX handler is bunch of callbacks called by the parser when processing + * of the input generate data or structure informations. + */ + +/** + * resolveEntitySAXFunc: + * @ctx: the user data (XML parser context) + * @publicId: The public ID of the entity + * @systemId: The system ID of the entity + * + * Callback: + * The entity loader, to control the loading of external entities, + * the application can either: + * - override this resolveEntity() callback in the SAX block + * - or better use the xmlSetExternalEntityLoader() function to + * set up it's own entity resolution routine + * + * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour. + */ +typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx, + const xmlChar *publicId, + const xmlChar *systemId); +/** + * internalSubsetSAXFunc: + * @ctx: the user data (XML parser context) + * @name: the root element name + * @ExternalID: the external ID + * @SystemID: the SYSTEM ID (e.g. filename or URL) + * + * Callback on internal subset declaration. + */ +typedef void (*internalSubsetSAXFunc) (void *ctx, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +/** + * externalSubsetSAXFunc: + * @ctx: the user data (XML parser context) + * @name: the root element name + * @ExternalID: the external ID + * @SystemID: the SYSTEM ID (e.g. filename or URL) + * + * Callback on external subset declaration. + */ +typedef void (*externalSubsetSAXFunc) (void *ctx, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +/** + * getEntitySAXFunc: + * @ctx: the user data (XML parser context) + * @name: The entity name + * + * Get an entity by name. + * + * Returns the xmlEntityPtr if found. + */ +typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx, + const xmlChar *name); +/** + * getParameterEntitySAXFunc: + * @ctx: the user data (XML parser context) + * @name: The entity name + * + * Get a parameter entity by name. + * + * Returns the xmlEntityPtr if found. + */ +typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx, + const xmlChar *name); +/** + * entityDeclSAXFunc: + * @ctx: the user data (XML parser context) + * @name: the entity name + * @type: the entity type + * @publicId: The public ID of the entity + * @systemId: The system ID of the entity + * @content: the entity value (without processing). + * + * An entity definition has been parsed. + */ +typedef void (*entityDeclSAXFunc) (void *ctx, + const xmlChar *name, + int type, + const xmlChar *publicId, + const xmlChar *systemId, + xmlChar *content); +/** + * notationDeclSAXFunc: + * @ctx: the user data (XML parser context) + * @name: The name of the notation + * @publicId: The public ID of the entity + * @systemId: The system ID of the entity + * + * What to do when a notation declaration has been parsed. + */ +typedef void (*notationDeclSAXFunc)(void *ctx, + const xmlChar *name, + const xmlChar *publicId, + const xmlChar *systemId); +/** + * attributeDeclSAXFunc: + * @ctx: the user data (XML parser context) + * @elem: the name of the element + * @fullname: the attribute name + * @type: the attribute type + * @def: the type of default value + * @defaultValue: the attribute default value + * @tree: the tree of enumerated value set + * + * An attribute definition has been parsed. + */ +typedef void (*attributeDeclSAXFunc)(void *ctx, + const xmlChar *elem, + const xmlChar *fullname, + int type, + int def, + const xmlChar *defaultValue, + xmlEnumerationPtr tree); +/** + * elementDeclSAXFunc: + * @ctx: the user data (XML parser context) + * @name: the element name + * @type: the element type + * @content: the element value tree + * + * An element definition has been parsed. + */ +typedef void (*elementDeclSAXFunc)(void *ctx, + const xmlChar *name, + int type, + xmlElementContentPtr content); +/** + * unparsedEntityDeclSAXFunc: + * @ctx: the user data (XML parser context) + * @name: The name of the entity + * @publicId: The public ID of the entity + * @systemId: The system ID of the entity + * @notationName: the name of the notation + * + * What to do when an unparsed entity declaration is parsed. + */ +typedef void (*unparsedEntityDeclSAXFunc)(void *ctx, + const xmlChar *name, + const xmlChar *publicId, + const xmlChar *systemId, + const xmlChar *notationName); +/** + * setDocumentLocatorSAXFunc: + * @ctx: the user data (XML parser context) + * @loc: A SAX Locator + * + * Receive the document locator at startup, actually xmlDefaultSAXLocator. + * Everything is available on the context, so this is useless in our case. + */ +typedef void (*setDocumentLocatorSAXFunc) (void *ctx, + xmlSAXLocatorPtr loc); +/** + * startDocumentSAXFunc: + * @ctx: the user data (XML parser context) + * + * Called when the document start being processed. + */ +typedef void (*startDocumentSAXFunc) (void *ctx); +/** + * endDocumentSAXFunc: + * @ctx: the user data (XML parser context) + * + * Called when the document end has been detected. + */ +typedef void (*endDocumentSAXFunc) (void *ctx); +/** + * startElementSAXFunc: + * @ctx: the user data (XML parser context) + * @name: The element name, including namespace prefix + * @atts: An array of name/value attributes pairs, NULL terminated + * + * Called when an opening tag has been processed. + */ +typedef void (*startElementSAXFunc) (void *ctx, + const xmlChar *name, + const xmlChar **atts); +/** + * endElementSAXFunc: + * @ctx: the user data (XML parser context) + * @name: The element name + * + * Called when the end of an element has been detected. + */ +typedef void (*endElementSAXFunc) (void *ctx, + const xmlChar *name); +/** + * attributeSAXFunc: + * @ctx: the user data (XML parser context) + * @name: The attribute name, including namespace prefix + * @value: The attribute value + * + * Handle an attribute that has been read by the parser. + * The default handling is to convert the attribute into an + * DOM subtree and past it in a new xmlAttr element added to + * the element. + */ +typedef void (*attributeSAXFunc) (void *ctx, + const xmlChar *name, + const xmlChar *value); +/** + * referenceSAXFunc: + * @ctx: the user data (XML parser context) + * @name: The entity name + * + * Called when an entity reference is detected. + */ +typedef void (*referenceSAXFunc) (void *ctx, + const xmlChar *name); +/** + * charactersSAXFunc: + * @ctx: the user data (XML parser context) + * @ch: a xmlChar string + * @len: the number of xmlChar + * + * Receiving some chars from the parser. + */ +typedef void (*charactersSAXFunc) (void *ctx, + const xmlChar *ch, + int len); +/** + * ignorableWhitespaceSAXFunc: + * @ctx: the user data (XML parser context) + * @ch: a xmlChar string + * @len: the number of xmlChar + * + * Receiving some ignorable whitespaces from the parser. + * UNUSED: by default the DOM building will use characters. + */ +typedef void (*ignorableWhitespaceSAXFunc) (void *ctx, + const xmlChar *ch, + int len); +/** + * processingInstructionSAXFunc: + * @ctx: the user data (XML parser context) + * @target: the target name + * @data: the PI data's + * + * A processing instruction has been parsed. + */ +typedef void (*processingInstructionSAXFunc) (void *ctx, + const xmlChar *target, + const xmlChar *data); +/** + * commentSAXFunc: + * @ctx: the user data (XML parser context) + * @value: the comment content + * + * A comment has been parsed. + */ +typedef void (*commentSAXFunc) (void *ctx, + const xmlChar *value); +/** + * cdataBlockSAXFunc: + * @ctx: the user data (XML parser context) + * @value: The pcdata content + * @len: the block length + * + * Called when a pcdata block has been parsed. + */ +typedef void (*cdataBlockSAXFunc) ( + void *ctx, + const xmlChar *value, + int len); +/** + * warningSAXFunc: + * @ctx: an XML parser context + * @msg: the message to display/transmit + * @...: extra parameters for the message display + * + * Display and format a warning messages, callback. + */ +typedef void (XMLCDECL *warningSAXFunc) (void *ctx, + const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); +/** + * errorSAXFunc: + * @ctx: an XML parser context + * @msg: the message to display/transmit + * @...: extra parameters for the message display + * + * Display and format an error messages, callback. + */ +typedef void (XMLCDECL *errorSAXFunc) (void *ctx, + const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); +/** + * fatalErrorSAXFunc: + * @ctx: an XML parser context + * @msg: the message to display/transmit + * @...: extra parameters for the message display + * + * Display and format fatal error messages, callback. + * Note: so far fatalError() SAX callbacks are not used, error() + * get all the callbacks for errors. + */ +typedef void (XMLCDECL *fatalErrorSAXFunc) (void *ctx, + const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); +/** + * isStandaloneSAXFunc: + * @ctx: the user data (XML parser context) + * + * Is this document tagged standalone? + * + * Returns 1 if true + */ +typedef int (*isStandaloneSAXFunc) (void *ctx); +/** + * hasInternalSubsetSAXFunc: + * @ctx: the user data (XML parser context) + * + * Does this document has an internal subset. + * + * Returns 1 if true + */ +typedef int (*hasInternalSubsetSAXFunc) (void *ctx); + +/** + * hasExternalSubsetSAXFunc: + * @ctx: the user data (XML parser context) + * + * Does this document has an external subset? + * + * Returns 1 if true + */ +typedef int (*hasExternalSubsetSAXFunc) (void *ctx); + +/************************************************************************ + * * + * The SAX version 2 API extensions * + * * + ************************************************************************/ +/** + * XML_SAX2_MAGIC: + * + * Special constant found in SAX2 blocks initialized fields + */ +#define XML_SAX2_MAGIC 0xDEEDBEAF + +/** + * startElementNsSAX2Func: + * @ctx: the user data (XML parser context) + * @localname: the local name of the element + * @prefix: the element namespace prefix if available + * @URI: the element namespace name if available + * @nb_namespaces: number of namespace definitions on that node + * @namespaces: pointer to the array of prefix/URI pairs namespace definitions + * @nb_attributes: the number of attributes on that node + * @nb_defaulted: the number of defaulted attributes. The defaulted + * ones are at the end of the array + * @attributes: pointer to the array of (localname/prefix/URI/value/end) + * attribute values. + * + * SAX2 callback when an element start has been detected by the parser. + * It provides the namespace informations for the element, as well as + * the new namespace declarations on the element. + */ + +typedef void (*startElementNsSAX2Func) (void *ctx, + const xmlChar *localname, + const xmlChar *prefix, + const xmlChar *URI, + int nb_namespaces, + const xmlChar **namespaces, + int nb_attributes, + int nb_defaulted, + const xmlChar **attributes); + +/** + * endElementNsSAX2Func: + * @ctx: the user data (XML parser context) + * @localname: the local name of the element + * @prefix: the element namespace prefix if available + * @URI: the element namespace name if available + * + * SAX2 callback when an element end has been detected by the parser. + * It provides the namespace informations for the element. + */ + +typedef void (*endElementNsSAX2Func) (void *ctx, + const xmlChar *localname, + const xmlChar *prefix, + const xmlChar *URI); + + +struct _xmlSAXHandler { + internalSubsetSAXFunc internalSubset; + isStandaloneSAXFunc isStandalone; + hasInternalSubsetSAXFunc hasInternalSubset; + hasExternalSubsetSAXFunc hasExternalSubset; + resolveEntitySAXFunc resolveEntity; + getEntitySAXFunc getEntity; + entityDeclSAXFunc entityDecl; + notationDeclSAXFunc notationDecl; + attributeDeclSAXFunc attributeDecl; + elementDeclSAXFunc elementDecl; + unparsedEntityDeclSAXFunc unparsedEntityDecl; + setDocumentLocatorSAXFunc setDocumentLocator; + startDocumentSAXFunc startDocument; + endDocumentSAXFunc endDocument; + startElementSAXFunc startElement; + endElementSAXFunc endElement; + referenceSAXFunc reference; + charactersSAXFunc characters; + ignorableWhitespaceSAXFunc ignorableWhitespace; + processingInstructionSAXFunc processingInstruction; + commentSAXFunc comment; + warningSAXFunc warning; + errorSAXFunc error; + fatalErrorSAXFunc fatalError; /* unused error() get all the errors */ + getParameterEntitySAXFunc getParameterEntity; + cdataBlockSAXFunc cdataBlock; + externalSubsetSAXFunc externalSubset; + unsigned int initialized; + /* The following fields are extensions available only on version 2 */ + void *_private; + startElementNsSAX2Func startElementNs; + endElementNsSAX2Func endElementNs; + xmlStructuredErrorFunc serror; +}; + +/* + * SAX Version 1 + */ +typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1; +typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr; +struct _xmlSAXHandlerV1 { + internalSubsetSAXFunc internalSubset; + isStandaloneSAXFunc isStandalone; + hasInternalSubsetSAXFunc hasInternalSubset; + hasExternalSubsetSAXFunc hasExternalSubset; + resolveEntitySAXFunc resolveEntity; + getEntitySAXFunc getEntity; + entityDeclSAXFunc entityDecl; + notationDeclSAXFunc notationDecl; + attributeDeclSAXFunc attributeDecl; + elementDeclSAXFunc elementDecl; + unparsedEntityDeclSAXFunc unparsedEntityDecl; + setDocumentLocatorSAXFunc setDocumentLocator; + startDocumentSAXFunc startDocument; + endDocumentSAXFunc endDocument; + startElementSAXFunc startElement; + endElementSAXFunc endElement; + referenceSAXFunc reference; + charactersSAXFunc characters; + ignorableWhitespaceSAXFunc ignorableWhitespace; + processingInstructionSAXFunc processingInstruction; + commentSAXFunc comment; + warningSAXFunc warning; + errorSAXFunc error; + fatalErrorSAXFunc fatalError; /* unused error() get all the errors */ + getParameterEntitySAXFunc getParameterEntity; + cdataBlockSAXFunc cdataBlock; + externalSubsetSAXFunc externalSubset; + unsigned int initialized; +}; + + +/** + * xmlExternalEntityLoader: + * @URL: The System ID of the resource requested + * @ID: The Public ID of the resource requested + * @context: the XML parser context + * + * External entity loaders types. + * + * Returns the entity input parser. + */ +typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL, + const char *ID, + xmlParserCtxtPtr context); + +#ifdef __cplusplus +} +#endif + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* + * Init/Cleanup + */ +XMLPUBFUN void XMLCALL + xmlInitParser (void); +XMLPUBFUN void XMLCALL + xmlCleanupParser (void); + +/* + * Input functions + */ +XMLPUBFUN int XMLCALL + xmlParserInputRead (xmlParserInputPtr in, + int len); +XMLPUBFUN int XMLCALL + xmlParserInputGrow (xmlParserInputPtr in, + int len); + +/* + * Basic parsing Interfaces + */ +#ifdef LIBXML_SAX1_ENABLED +XMLPUBFUN xmlDocPtr XMLCALL + xmlParseDoc (const xmlChar *cur); +XMLPUBFUN xmlDocPtr XMLCALL + xmlParseFile (const char *filename); +XMLPUBFUN xmlDocPtr XMLCALL + xmlParseMemory (const char *buffer, + int size); +#endif /* LIBXML_SAX1_ENABLED */ +XMLPUBFUN int XMLCALL + xmlSubstituteEntitiesDefault(int val); +XMLPUBFUN int XMLCALL + xmlKeepBlanksDefault (int val); +XMLPUBFUN void XMLCALL + xmlStopParser (xmlParserCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlPedanticParserDefault(int val); +XMLPUBFUN int XMLCALL + xmlLineNumbersDefault (int val); + +#ifdef LIBXML_SAX1_ENABLED +/* + * Recovery mode + */ +XMLPUBFUN xmlDocPtr XMLCALL + xmlRecoverDoc (const xmlChar *cur); +XMLPUBFUN xmlDocPtr XMLCALL + xmlRecoverMemory (const char *buffer, + int size); +XMLPUBFUN xmlDocPtr XMLCALL + xmlRecoverFile (const char *filename); +#endif /* LIBXML_SAX1_ENABLED */ + +/* + * Less common routines and SAX interfaces + */ +XMLPUBFUN int XMLCALL + xmlParseDocument (xmlParserCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt); +#ifdef LIBXML_SAX1_ENABLED +XMLPUBFUN int XMLCALL + xmlSAXUserParseFile (xmlSAXHandlerPtr sax, + void *user_data, + const char *filename); +XMLPUBFUN int XMLCALL + xmlSAXUserParseMemory (xmlSAXHandlerPtr sax, + void *user_data, + const char *buffer, + int size); +XMLPUBFUN xmlDocPtr XMLCALL + xmlSAXParseDoc (xmlSAXHandlerPtr sax, + const xmlChar *cur, + int recovery); +XMLPUBFUN xmlDocPtr XMLCALL + xmlSAXParseMemory (xmlSAXHandlerPtr sax, + const char *buffer, + int size, + int recovery); +XMLPUBFUN xmlDocPtr XMLCALL + xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax, + const char *buffer, + int size, + int recovery, + void *data); +XMLPUBFUN xmlDocPtr XMLCALL + xmlSAXParseFile (xmlSAXHandlerPtr sax, + const char *filename, + int recovery); +XMLPUBFUN xmlDocPtr XMLCALL + xmlSAXParseFileWithData (xmlSAXHandlerPtr sax, + const char *filename, + int recovery, + void *data); +XMLPUBFUN xmlDocPtr XMLCALL + xmlSAXParseEntity (xmlSAXHandlerPtr sax, + const char *filename); +XMLPUBFUN xmlDocPtr XMLCALL + xmlParseEntity (const char *filename); +#endif /* LIBXML_SAX1_ENABLED */ + +#ifdef LIBXML_VALID_ENABLED +XMLPUBFUN xmlDtdPtr XMLCALL + xmlSAXParseDTD (xmlSAXHandlerPtr sax, + const xmlChar *ExternalID, + const xmlChar *SystemID); +XMLPUBFUN xmlDtdPtr XMLCALL + xmlParseDTD (const xmlChar *ExternalID, + const xmlChar *SystemID); +XMLPUBFUN xmlDtdPtr XMLCALL + xmlIOParseDTD (xmlSAXHandlerPtr sax, + xmlParserInputBufferPtr input, + xmlCharEncoding enc); +#endif /* LIBXML_VALID_ENABLE */ +#ifdef LIBXML_SAX1_ENABLED +XMLPUBFUN int XMLCALL + xmlParseBalancedChunkMemory(xmlDocPtr doc, + xmlSAXHandlerPtr sax, + void *user_data, + int depth, + const xmlChar *string, + xmlNodePtr *lst); +#endif /* LIBXML_SAX1_ENABLED */ +XMLPUBFUN xmlParserErrors XMLCALL + xmlParseInNodeContext (xmlNodePtr node, + const char *data, + int datalen, + int options, + xmlNodePtr *lst); +#ifdef LIBXML_SAX1_ENABLED +XMLPUBFUN int XMLCALL + xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, + xmlSAXHandlerPtr sax, + void *user_data, + int depth, + const xmlChar *string, + xmlNodePtr *lst, + int recover); +XMLPUBFUN int XMLCALL + xmlParseExternalEntity (xmlDocPtr doc, + xmlSAXHandlerPtr sax, + void *user_data, + int depth, + const xmlChar *URL, + const xmlChar *ID, + xmlNodePtr *lst); +#endif /* LIBXML_SAX1_ENABLED */ +XMLPUBFUN int XMLCALL + xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, + const xmlChar *URL, + const xmlChar *ID, + xmlNodePtr *lst); + +/* + * Parser contexts handling. + */ +XMLPUBFUN xmlParserCtxtPtr XMLCALL + xmlNewParserCtxt (void); +XMLPUBFUN int XMLCALL + xmlInitParserCtxt (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlClearParserCtxt (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlFreeParserCtxt (xmlParserCtxtPtr ctxt); +#ifdef LIBXML_SAX1_ENABLED +XMLPUBFUN void XMLCALL + xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt, + const xmlChar* buffer, + const char *filename); +#endif /* LIBXML_SAX1_ENABLED */ +XMLPUBFUN xmlParserCtxtPtr XMLCALL + xmlCreateDocParserCtxt (const xmlChar *cur); + +#ifdef LIBXML_LEGACY_ENABLED +/* + * Reading/setting optional parsing features. + */ +XMLPUBFUN int XMLCALL + xmlGetFeaturesList (int *len, + const char **result); +XMLPUBFUN int XMLCALL + xmlGetFeature (xmlParserCtxtPtr ctxt, + const char *name, + void *result); +XMLPUBFUN int XMLCALL + xmlSetFeature (xmlParserCtxtPtr ctxt, + const char *name, + void *value); +#endif /* LIBXML_LEGACY_ENABLED */ + +#ifdef LIBXML_PUSH_ENABLED +/* + * Interfaces for the Push mode. + */ +XMLPUBFUN xmlParserCtxtPtr XMLCALL + xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, + void *user_data, + const char *chunk, + int size, + const char *filename); +XMLPUBFUN int XMLCALL + xmlParseChunk (xmlParserCtxtPtr ctxt, + const char *chunk, + int size, + int terminate); +#endif /* LIBXML_PUSH_ENABLED */ + +/* + * Special I/O mode. + */ + +XMLPUBFUN xmlParserCtxtPtr XMLCALL + xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax, + void *user_data, + xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + xmlCharEncoding enc); + +XMLPUBFUN xmlParserInputPtr XMLCALL + xmlNewIOInputStream (xmlParserCtxtPtr ctxt, + xmlParserInputBufferPtr input, + xmlCharEncoding enc); + +/* + * Node infos. + */ +XMLPUBFUN const xmlParserNodeInfo* XMLCALL + xmlParserFindNodeInfo (const xmlParserCtxtPtr ctxt, + const xmlNodePtr node); +XMLPUBFUN void XMLCALL + xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); +XMLPUBFUN void XMLCALL + xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); +XMLPUBFUN unsigned long XMLCALL + xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq, + const xmlNodePtr node); +XMLPUBFUN void XMLCALL + xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt, + const xmlParserNodeInfoPtr info); + +/* + * External entities handling actually implemented in xmlIO. + */ + +XMLPUBFUN void XMLCALL + xmlSetExternalEntityLoader(xmlExternalEntityLoader f); +XMLPUBFUN xmlExternalEntityLoader XMLCALL + xmlGetExternalEntityLoader(void); +XMLPUBFUN xmlParserInputPtr XMLCALL + xmlLoadExternalEntity (const char *URL, + const char *ID, + xmlParserCtxtPtr ctxt); + +/* + * Index lookup, actually implemented in the encoding module + */ +XMLPUBFUN long XMLCALL + xmlByteConsumed (xmlParserCtxtPtr ctxt); + +/* + * New set of simpler/more flexible APIs + */ +/** + * xmlParserOption: + * + * This is the set of XML parser options that can be passed down + * to the xmlReadDoc() and similar calls. + */ +typedef enum { + XML_PARSE_RECOVER = 1<<0, /* recover on errors */ + XML_PARSE_NOENT = 1<<1, /* substitute entities */ + XML_PARSE_DTDLOAD = 1<<2, /* load the external subset */ + XML_PARSE_DTDATTR = 1<<3, /* default DTD attributes */ + XML_PARSE_DTDVALID = 1<<4, /* validate with the DTD */ + XML_PARSE_NOERROR = 1<<5, /* suppress error reports */ + XML_PARSE_NOWARNING = 1<<6, /* suppress warning reports */ + XML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */ + XML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */ + XML_PARSE_SAX1 = 1<<9, /* use the SAX1 interface internally */ + XML_PARSE_XINCLUDE = 1<<10,/* Implement XInclude substitition */ + XML_PARSE_NONET = 1<<11,/* Forbid network access */ + XML_PARSE_NODICT = 1<<12,/* Do not reuse the context dictionary */ + XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */ + XML_PARSE_NOCDATA = 1<<14,/* merge CDATA as text nodes */ + XML_PARSE_NOXINCNODE= 1<<15,/* do not generate XINCLUDE START/END nodes */ + XML_PARSE_COMPACT = 1<<16,/* compact small text nodes; no modification of + the tree allowed afterwards (will possibly + crash if you try to modify the tree) */ + XML_PARSE_OLD10 = 1<<17,/* parse using XML-1.0 before update 5 */ + XML_PARSE_NOBASEFIX = 1<<18,/* do not fixup XINCLUDE xml:base uris */ + XML_PARSE_HUGE = 1<<19,/* relax any hardcoded limit from the parser */ + XML_PARSE_OLDSAX = 1<<20,/* parse using SAX2 interface before 2.7.0 */ + XML_PARSE_IGNORE_ENC= 1<<21,/* ignore internal document encoding hint */ + XML_PARSE_BIG_LINES = 1<<22 /* Store big lines numbers in text PSVI field */ +} xmlParserOption; + +XMLPUBFUN void XMLCALL + xmlCtxtReset (xmlParserCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlCtxtResetPush (xmlParserCtxtPtr ctxt, + const char *chunk, + int size, + const char *filename, + const char *encoding); +XMLPUBFUN int XMLCALL + xmlCtxtUseOptions (xmlParserCtxtPtr ctxt, + int options); +XMLPUBFUN xmlDocPtr XMLCALL + xmlReadDoc (const xmlChar *cur, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr XMLCALL + xmlReadFile (const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr XMLCALL + xmlReadMemory (const char *buffer, + int size, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr XMLCALL + xmlReadFd (int fd, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr XMLCALL + xmlReadIO (xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr XMLCALL + xmlCtxtReadDoc (xmlParserCtxtPtr ctxt, + const xmlChar *cur, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr XMLCALL + xmlCtxtReadFile (xmlParserCtxtPtr ctxt, + const char *filename, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr XMLCALL + xmlCtxtReadMemory (xmlParserCtxtPtr ctxt, + const char *buffer, + int size, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr XMLCALL + xmlCtxtReadFd (xmlParserCtxtPtr ctxt, + int fd, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlDocPtr XMLCALL + xmlCtxtReadIO (xmlParserCtxtPtr ctxt, + xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + const char *URL, + const char *encoding, + int options); + +/* + * Library wide options + */ +/** + * xmlFeature: + * + * Used to examine the existance of features that can be enabled + * or disabled at compile-time. + * They used to be called XML_FEATURE_xxx but this clashed with Expat + */ +typedef enum { + XML_WITH_THREAD = 1, + XML_WITH_TREE = 2, + XML_WITH_OUTPUT = 3, + XML_WITH_PUSH = 4, + XML_WITH_READER = 5, + XML_WITH_PATTERN = 6, + XML_WITH_WRITER = 7, + XML_WITH_SAX1 = 8, + XML_WITH_FTP = 9, + XML_WITH_HTTP = 10, + XML_WITH_VALID = 11, + XML_WITH_HTML = 12, + XML_WITH_LEGACY = 13, + XML_WITH_C14N = 14, + XML_WITH_CATALOG = 15, + XML_WITH_XPATH = 16, + XML_WITH_XPTR = 17, + XML_WITH_XINCLUDE = 18, + XML_WITH_ICONV = 19, + XML_WITH_ISO8859X = 20, + XML_WITH_UNICODE = 21, + XML_WITH_REGEXP = 22, + XML_WITH_AUTOMATA = 23, + XML_WITH_EXPR = 24, + XML_WITH_SCHEMAS = 25, + XML_WITH_SCHEMATRON = 26, + XML_WITH_MODULES = 27, + XML_WITH_DEBUG = 28, + XML_WITH_DEBUG_MEM = 29, + XML_WITH_DEBUG_RUN = 30, + XML_WITH_ZLIB = 31, + XML_WITH_ICU = 32, + XML_WITH_LZMA = 33, + XML_WITH_NONE = 99999 /* just to be sure of allocation size */ +} xmlFeature; + +XMLPUBFUN int XMLCALL + xmlHasFeature (xmlFeature feature); + +#ifdef __cplusplus +} +#endif +#endif /* __XML_PARSER_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/parserInternals.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/parserInternals.h new file mode 100644 index 0000000..f30fc68 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/parserInternals.h @@ -0,0 +1,644 @@ +/* + * Summary: internals routines and limits exported by the parser. + * Description: this module exports a number of internal parsing routines + * they are not really all intended for applications but + * can prove useful doing low level processing. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_PARSER_INTERNALS_H__ +#define __XML_PARSER_INTERNALS_H__ + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlParserMaxDepth: + * + * arbitrary depth limit for the XML documents that we allow to + * process. This is not a limitation of the parser but a safety + * boundary feature, use XML_PARSE_HUGE option to override it. + */ +XMLPUBVAR unsigned int xmlParserMaxDepth; + +/** + * XML_MAX_TEXT_LENGTH: + * + * Maximum size allowed for a single text node when building a tree. + * This is not a limitation of the parser but a safety boundary feature, + * use XML_PARSE_HUGE option to override it. + * Introduced in 2.9.0 + */ +#define XML_MAX_TEXT_LENGTH 10000000 + +/** + * XML_MAX_NAME_LENGTH: + * + * Maximum size allowed for a markup identitier + * This is not a limitation of the parser but a safety boundary feature, + * use XML_PARSE_HUGE option to override it. + * Note that with the use of parsing dictionaries overriding the limit + * may result in more runtime memory usage in face of "unfriendly' content + * Introduced in 2.9.0 + */ +#define XML_MAX_NAME_LENGTH 50000 + +/** + * XML_MAX_DICTIONARY_LIMIT: + * + * Maximum size allowed by the parser for a dictionary by default + * This is not a limitation of the parser but a safety boundary feature, + * use XML_PARSE_HUGE option to override it. + * Introduced in 2.9.0 + */ +#define XML_MAX_DICTIONARY_LIMIT 10000000 + +/** + * XML_MAX_LOOKUP_LIMIT: + * + * Maximum size allowed by the parser for ahead lookup + * This is an upper boundary enforced by the parser to avoid bad + * behaviour on "unfriendly' content + * Introduced in 2.9.0 + */ +#define XML_MAX_LOOKUP_LIMIT 10000000 + +/** + * XML_MAX_NAMELEN: + * + * Identifiers can be longer, but this will be more costly + * at runtime. + */ +#define XML_MAX_NAMELEN 100 + +/** + * INPUT_CHUNK: + * + * The parser tries to always have that amount of input ready. + * One of the point is providing context when reporting errors. + */ +#define INPUT_CHUNK 250 + +/************************************************************************ + * * + * UNICODE version of the macros. * + * * + ************************************************************************/ +/** + * IS_BYTE_CHAR: + * @c: an byte value (int) + * + * Macro to check the following production in the XML spec: + * + * [2] Char ::= #x9 | #xA | #xD | [#x20...] + * any byte character in the accepted range + */ +#define IS_BYTE_CHAR(c) xmlIsChar_ch(c) + +/** + * IS_CHAR: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] + * | [#x10000-#x10FFFF] + * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. + */ +#define IS_CHAR(c) xmlIsCharQ(c) + +/** + * IS_CHAR_CH: + * @c: an xmlChar (usually an unsigned char) + * + * Behaves like IS_CHAR on single-byte value + */ +#define IS_CHAR_CH(c) xmlIsChar_ch(c) + +/** + * IS_BLANK: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * [3] S ::= (#x20 | #x9 | #xD | #xA)+ + */ +#define IS_BLANK(c) xmlIsBlankQ(c) + +/** + * IS_BLANK_CH: + * @c: an xmlChar value (normally unsigned char) + * + * Behaviour same as IS_BLANK + */ +#define IS_BLANK_CH(c) xmlIsBlank_ch(c) + +/** + * IS_BASECHAR: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * [85] BaseChar ::= ... long list see REC ... + */ +#define IS_BASECHAR(c) xmlIsBaseCharQ(c) + +/** + * IS_DIGIT: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * [88] Digit ::= ... long list see REC ... + */ +#define IS_DIGIT(c) xmlIsDigitQ(c) + +/** + * IS_DIGIT_CH: + * @c: an xmlChar value (usually an unsigned char) + * + * Behaves like IS_DIGIT but with a single byte argument + */ +#define IS_DIGIT_CH(c) xmlIsDigit_ch(c) + +/** + * IS_COMBINING: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * [87] CombiningChar ::= ... long list see REC ... + */ +#define IS_COMBINING(c) xmlIsCombiningQ(c) + +/** + * IS_COMBINING_CH: + * @c: an xmlChar (usually an unsigned char) + * + * Always false (all combining chars > 0xff) + */ +#define IS_COMBINING_CH(c) 0 + +/** + * IS_EXTENDER: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * + * [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 | + * #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] | + * [#x309D-#x309E] | [#x30FC-#x30FE] + */ +#define IS_EXTENDER(c) xmlIsExtenderQ(c) + +/** + * IS_EXTENDER_CH: + * @c: an xmlChar value (usually an unsigned char) + * + * Behaves like IS_EXTENDER but with a single-byte argument + */ +#define IS_EXTENDER_CH(c) xmlIsExtender_ch(c) + +/** + * IS_IDEOGRAPHIC: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * + * [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029] + */ +#define IS_IDEOGRAPHIC(c) xmlIsIdeographicQ(c) + +/** + * IS_LETTER: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * + * [84] Letter ::= BaseChar | Ideographic + */ +#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c)) + +/** + * IS_LETTER_CH: + * @c: an xmlChar value (normally unsigned char) + * + * Macro behaves like IS_LETTER, but only check base chars + * + */ +#define IS_LETTER_CH(c) xmlIsBaseChar_ch(c) + +/** + * IS_ASCII_LETTER: + * @c: an xmlChar value + * + * Macro to check [a-zA-Z] + * + */ +#define IS_ASCII_LETTER(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \ + ((0x61 <= (c)) && ((c) <= 0x7a))) + +/** + * IS_ASCII_DIGIT: + * @c: an xmlChar value + * + * Macro to check [0-9] + * + */ +#define IS_ASCII_DIGIT(c) ((0x30 <= (c)) && ((c) <= 0x39)) + +/** + * IS_PUBIDCHAR: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * + * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] + */ +#define IS_PUBIDCHAR(c) xmlIsPubidCharQ(c) + +/** + * IS_PUBIDCHAR_CH: + * @c: an xmlChar value (normally unsigned char) + * + * Same as IS_PUBIDCHAR but for single-byte value + */ +#define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c) + +/** + * SKIP_EOL: + * @p: and UTF8 string pointer + * + * Skips the end of line chars. + */ +#define SKIP_EOL(p) \ + if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \ + if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; } + +/** + * MOVETO_ENDTAG: + * @p: and UTF8 string pointer + * + * Skips to the next '>' char. + */ +#define MOVETO_ENDTAG(p) \ + while ((*p) && (*(p) != '>')) (p)++ + +/** + * MOVETO_STARTTAG: + * @p: and UTF8 string pointer + * + * Skips to the next '<' char. + */ +#define MOVETO_STARTTAG(p) \ + while ((*p) && (*(p) != '<')) (p)++ + +/** + * Global variables used for predefined strings. + */ +XMLPUBVAR const xmlChar xmlStringText[]; +XMLPUBVAR const xmlChar xmlStringTextNoenc[]; +XMLPUBVAR const xmlChar xmlStringComment[]; + +/* + * Function to finish the work of the macros where needed. + */ +XMLPUBFUN int XMLCALL xmlIsLetter (int c); + +/** + * Parser context. + */ +XMLPUBFUN xmlParserCtxtPtr XMLCALL + xmlCreateFileParserCtxt (const char *filename); +XMLPUBFUN xmlParserCtxtPtr XMLCALL + xmlCreateURLParserCtxt (const char *filename, + int options); +XMLPUBFUN xmlParserCtxtPtr XMLCALL + xmlCreateMemoryParserCtxt(const char *buffer, + int size); +XMLPUBFUN xmlParserCtxtPtr XMLCALL + xmlCreateEntityParserCtxt(const xmlChar *URL, + const xmlChar *ID, + const xmlChar *base); +XMLPUBFUN int XMLCALL + xmlSwitchEncoding (xmlParserCtxtPtr ctxt, + xmlCharEncoding enc); +XMLPUBFUN int XMLCALL + xmlSwitchToEncoding (xmlParserCtxtPtr ctxt, + xmlCharEncodingHandlerPtr handler); +XMLPUBFUN int XMLCALL + xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt, + xmlParserInputPtr input, + xmlCharEncodingHandlerPtr handler); + +#ifdef IN_LIBXML +/* internal error reporting */ +XMLPUBFUN void XMLCALL + __xmlErrEncoding (xmlParserCtxtPtr ctxt, + xmlParserErrors xmlerr, + const char *msg, + const xmlChar * str1, + const xmlChar * str2) LIBXML_ATTR_FORMAT(3,0); +#endif + +/** + * Input Streams. + */ +XMLPUBFUN xmlParserInputPtr XMLCALL + xmlNewStringInputStream (xmlParserCtxtPtr ctxt, + const xmlChar *buffer); +XMLPUBFUN xmlParserInputPtr XMLCALL + xmlNewEntityInputStream (xmlParserCtxtPtr ctxt, + xmlEntityPtr entity); +XMLPUBFUN int XMLCALL + xmlPushInput (xmlParserCtxtPtr ctxt, + xmlParserInputPtr input); +XMLPUBFUN xmlChar XMLCALL + xmlPopInput (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlFreeInputStream (xmlParserInputPtr input); +XMLPUBFUN xmlParserInputPtr XMLCALL + xmlNewInputFromFile (xmlParserCtxtPtr ctxt, + const char *filename); +XMLPUBFUN xmlParserInputPtr XMLCALL + xmlNewInputStream (xmlParserCtxtPtr ctxt); + +/** + * Namespaces. + */ +XMLPUBFUN xmlChar * XMLCALL + xmlSplitQName (xmlParserCtxtPtr ctxt, + const xmlChar *name, + xmlChar **prefix); + +/** + * Generic production rules. + */ +XMLPUBFUN const xmlChar * XMLCALL + xmlParseName (xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlParseNmtoken (xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlParseEntityValue (xmlParserCtxtPtr ctxt, + xmlChar **orig); +XMLPUBFUN xmlChar * XMLCALL + xmlParseAttValue (xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlParseSystemLiteral (xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlParsePubidLiteral (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseCharData (xmlParserCtxtPtr ctxt, + int cdata); +XMLPUBFUN xmlChar * XMLCALL + xmlParseExternalID (xmlParserCtxtPtr ctxt, + xmlChar **publicID, + int strict); +XMLPUBFUN void XMLCALL + xmlParseComment (xmlParserCtxtPtr ctxt); +XMLPUBFUN const xmlChar * XMLCALL + xmlParsePITarget (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParsePI (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseNotationDecl (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseEntityDecl (xmlParserCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlParseDefaultDecl (xmlParserCtxtPtr ctxt, + xmlChar **value); +XMLPUBFUN xmlEnumerationPtr XMLCALL + xmlParseNotationType (xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlEnumerationPtr XMLCALL + xmlParseEnumerationType (xmlParserCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlParseEnumeratedType (xmlParserCtxtPtr ctxt, + xmlEnumerationPtr *tree); +XMLPUBFUN int XMLCALL + xmlParseAttributeType (xmlParserCtxtPtr ctxt, + xmlEnumerationPtr *tree); +XMLPUBFUN void XMLCALL + xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlElementContentPtr XMLCALL + xmlParseElementMixedContentDecl + (xmlParserCtxtPtr ctxt, + int inputchk); +XMLPUBFUN xmlElementContentPtr XMLCALL + xmlParseElementChildrenContentDecl + (xmlParserCtxtPtr ctxt, + int inputchk); +XMLPUBFUN int XMLCALL + xmlParseElementContentDecl(xmlParserCtxtPtr ctxt, + const xmlChar *name, + xmlElementContentPtr *result); +XMLPUBFUN int XMLCALL + xmlParseElementDecl (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseMarkupDecl (xmlParserCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlParseCharRef (xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlEntityPtr XMLCALL + xmlParseEntityRef (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseReference (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParsePEReference (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt); +#ifdef LIBXML_SAX1_ENABLED +XMLPUBFUN const xmlChar * XMLCALL + xmlParseAttribute (xmlParserCtxtPtr ctxt, + xmlChar **value); +XMLPUBFUN const xmlChar * XMLCALL + xmlParseStartTag (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseEndTag (xmlParserCtxtPtr ctxt); +#endif /* LIBXML_SAX1_ENABLED */ +XMLPUBFUN void XMLCALL + xmlParseCDSect (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseContent (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseElement (xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlParseVersionNum (xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlParseVersionInfo (xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlParseEncName (xmlParserCtxtPtr ctxt); +XMLPUBFUN const xmlChar * XMLCALL + xmlParseEncodingDecl (xmlParserCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlParseSDDecl (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseXMLDecl (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseTextDecl (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseMisc (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseExternalSubset (xmlParserCtxtPtr ctxt, + const xmlChar *ExternalID, + const xmlChar *SystemID); +/** + * XML_SUBSTITUTE_NONE: + * + * If no entities need to be substituted. + */ +#define XML_SUBSTITUTE_NONE 0 +/** + * XML_SUBSTITUTE_REF: + * + * Whether general entities need to be substituted. + */ +#define XML_SUBSTITUTE_REF 1 +/** + * XML_SUBSTITUTE_PEREF: + * + * Whether parameter entities need to be substituted. + */ +#define XML_SUBSTITUTE_PEREF 2 +/** + * XML_SUBSTITUTE_BOTH: + * + * Both general and parameter entities need to be substituted. + */ +#define XML_SUBSTITUTE_BOTH 3 + +XMLPUBFUN xmlChar * XMLCALL + xmlStringDecodeEntities (xmlParserCtxtPtr ctxt, + const xmlChar *str, + int what, + xmlChar end, + xmlChar end2, + xmlChar end3); +XMLPUBFUN xmlChar * XMLCALL + xmlStringLenDecodeEntities (xmlParserCtxtPtr ctxt, + const xmlChar *str, + int len, + int what, + xmlChar end, + xmlChar end2, + xmlChar end3); + +/* + * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP. + */ +XMLPUBFUN int XMLCALL nodePush (xmlParserCtxtPtr ctxt, + xmlNodePtr value); +XMLPUBFUN xmlNodePtr XMLCALL nodePop (xmlParserCtxtPtr ctxt); +XMLPUBFUN int XMLCALL inputPush (xmlParserCtxtPtr ctxt, + xmlParserInputPtr value); +XMLPUBFUN xmlParserInputPtr XMLCALL inputPop (xmlParserCtxtPtr ctxt); +XMLPUBFUN const xmlChar * XMLCALL namePop (xmlParserCtxtPtr ctxt); +XMLPUBFUN int XMLCALL namePush (xmlParserCtxtPtr ctxt, + const xmlChar *value); + +/* + * other commodities shared between parser.c and parserInternals. + */ +XMLPUBFUN int XMLCALL xmlSkipBlankChars (xmlParserCtxtPtr ctxt); +XMLPUBFUN int XMLCALL xmlStringCurrentChar (xmlParserCtxtPtr ctxt, + const xmlChar *cur, + int *len); +XMLPUBFUN void XMLCALL xmlParserHandlePEReference(xmlParserCtxtPtr ctxt); +XMLPUBFUN int XMLCALL xmlCheckLanguageID (const xmlChar *lang); + +/* + * Really core function shared with HTML parser. + */ +XMLPUBFUN int XMLCALL xmlCurrentChar (xmlParserCtxtPtr ctxt, + int *len); +XMLPUBFUN int XMLCALL xmlCopyCharMultiByte (xmlChar *out, + int val); +XMLPUBFUN int XMLCALL xmlCopyChar (int len, + xmlChar *out, + int val); +XMLPUBFUN void XMLCALL xmlNextChar (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL xmlParserInputShrink (xmlParserInputPtr in); + +#ifdef LIBXML_HTML_ENABLED +/* + * Actually comes from the HTML parser but launched from the init stuff. + */ +XMLPUBFUN void XMLCALL htmlInitAutoClose (void); +XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateFileParserCtxt(const char *filename, + const char *encoding); +#endif + +/* + * Specific function to keep track of entities references + * and used by the XSLT debugger. + */ +#ifdef LIBXML_LEGACY_ENABLED +/** + * xmlEntityReferenceFunc: + * @ent: the entity + * @firstNode: the fist node in the chunk + * @lastNode: the last nod in the chunk + * + * Callback function used when one needs to be able to track back the + * provenance of a chunk of nodes inherited from an entity replacement. + */ +typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent, + xmlNodePtr firstNode, + xmlNodePtr lastNode); + +XMLPUBFUN void XMLCALL xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func); + +XMLPUBFUN xmlChar * XMLCALL + xmlParseQuotedString (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlParseNamespace (xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlScanName (xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL xmlParserHandleReference(xmlParserCtxtPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlNamespaceParseQName (xmlParserCtxtPtr ctxt, + xmlChar **prefix); +/** + * Entities + */ +XMLPUBFUN xmlChar * XMLCALL + xmlDecodeEntities (xmlParserCtxtPtr ctxt, + int len, + int what, + xmlChar end, + xmlChar end2, + xmlChar end3); +XMLPUBFUN void XMLCALL + xmlHandleEntity (xmlParserCtxtPtr ctxt, + xmlEntityPtr entity); + +#endif /* LIBXML_LEGACY_ENABLED */ + +#ifdef IN_LIBXML +/* + * internal only + */ +XMLPUBFUN void XMLCALL + xmlErrMemory (xmlParserCtxtPtr ctxt, + const char *extra); +#endif + +#ifdef __cplusplus +} +#endif +#endif /* __XML_PARSER_INTERNALS_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/pattern.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/pattern.h new file mode 100644 index 0000000..97d2cd2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/pattern.h @@ -0,0 +1,100 @@ +/* + * Summary: pattern expression handling + * Description: allows to compile and test pattern expressions for nodes + * either in a tree or based on a parser state. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_PATTERN_H__ +#define __XML_PATTERN_H__ + +#include +#include +#include + +#ifdef LIBXML_PATTERN_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlPattern: + * + * A compiled (XPath based) pattern to select nodes + */ +typedef struct _xmlPattern xmlPattern; +typedef xmlPattern *xmlPatternPtr; + +/** + * xmlPatternFlags: + * + * This is the set of options affecting the behaviour of pattern + * matching with this module + * + */ +typedef enum { + XML_PATTERN_DEFAULT = 0, /* simple pattern match */ + XML_PATTERN_XPATH = 1<<0, /* standard XPath pattern */ + XML_PATTERN_XSSEL = 1<<1, /* XPath subset for schema selector */ + XML_PATTERN_XSFIELD = 1<<2 /* XPath subset for schema field */ +} xmlPatternFlags; + +XMLPUBFUN void XMLCALL + xmlFreePattern (xmlPatternPtr comp); + +XMLPUBFUN void XMLCALL + xmlFreePatternList (xmlPatternPtr comp); + +XMLPUBFUN xmlPatternPtr XMLCALL + xmlPatterncompile (const xmlChar *pattern, + xmlDict *dict, + int flags, + const xmlChar **namespaces); +XMLPUBFUN int XMLCALL + xmlPatternMatch (xmlPatternPtr comp, + xmlNodePtr node); + +/* streaming interfaces */ +typedef struct _xmlStreamCtxt xmlStreamCtxt; +typedef xmlStreamCtxt *xmlStreamCtxtPtr; + +XMLPUBFUN int XMLCALL + xmlPatternStreamable (xmlPatternPtr comp); +XMLPUBFUN int XMLCALL + xmlPatternMaxDepth (xmlPatternPtr comp); +XMLPUBFUN int XMLCALL + xmlPatternMinDepth (xmlPatternPtr comp); +XMLPUBFUN int XMLCALL + xmlPatternFromRoot (xmlPatternPtr comp); +XMLPUBFUN xmlStreamCtxtPtr XMLCALL + xmlPatternGetStreamCtxt (xmlPatternPtr comp); +XMLPUBFUN void XMLCALL + xmlFreeStreamCtxt (xmlStreamCtxtPtr stream); +XMLPUBFUN int XMLCALL + xmlStreamPushNode (xmlStreamCtxtPtr stream, + const xmlChar *name, + const xmlChar *ns, + int nodeType); +XMLPUBFUN int XMLCALL + xmlStreamPush (xmlStreamCtxtPtr stream, + const xmlChar *name, + const xmlChar *ns); +XMLPUBFUN int XMLCALL + xmlStreamPushAttr (xmlStreamCtxtPtr stream, + const xmlChar *name, + const xmlChar *ns); +XMLPUBFUN int XMLCALL + xmlStreamPop (xmlStreamCtxtPtr stream); +XMLPUBFUN int XMLCALL + xmlStreamWantsAnyNode (xmlStreamCtxtPtr stream); +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_PATTERN_ENABLED */ + +#endif /* __XML_PATTERN_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/relaxng.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/relaxng.h new file mode 100644 index 0000000..f269c9e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/relaxng.h @@ -0,0 +1,217 @@ +/* + * Summary: implementation of the Relax-NG validation + * Description: implementation of the Relax-NG validation + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_RELAX_NG__ +#define __XML_RELAX_NG__ + +#include +#include +#include + +#ifdef LIBXML_SCHEMAS_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _xmlRelaxNG xmlRelaxNG; +typedef xmlRelaxNG *xmlRelaxNGPtr; + + +/** + * xmlRelaxNGValidityErrorFunc: + * @ctx: the validation context + * @msg: the message + * @...: extra arguments + * + * Signature of an error callback from a Relax-NG validation + */ +typedef void (XMLCDECL *xmlRelaxNGValidityErrorFunc) (void *ctx, + const char *msg, + ...) LIBXML_ATTR_FORMAT(2,3); + +/** + * xmlRelaxNGValidityWarningFunc: + * @ctx: the validation context + * @msg: the message + * @...: extra arguments + * + * Signature of a warning callback from a Relax-NG validation + */ +typedef void (XMLCDECL *xmlRelaxNGValidityWarningFunc) (void *ctx, + const char *msg, + ...) LIBXML_ATTR_FORMAT(2,3); + +/** + * A schemas validation context + */ +typedef struct _xmlRelaxNGParserCtxt xmlRelaxNGParserCtxt; +typedef xmlRelaxNGParserCtxt *xmlRelaxNGParserCtxtPtr; + +typedef struct _xmlRelaxNGValidCtxt xmlRelaxNGValidCtxt; +typedef xmlRelaxNGValidCtxt *xmlRelaxNGValidCtxtPtr; + +/* + * xmlRelaxNGValidErr: + * + * List of possible Relax NG validation errors + */ +typedef enum { + XML_RELAXNG_OK = 0, + XML_RELAXNG_ERR_MEMORY, + XML_RELAXNG_ERR_TYPE, + XML_RELAXNG_ERR_TYPEVAL, + XML_RELAXNG_ERR_DUPID, + XML_RELAXNG_ERR_TYPECMP, + XML_RELAXNG_ERR_NOSTATE, + XML_RELAXNG_ERR_NODEFINE, + XML_RELAXNG_ERR_LISTEXTRA, + XML_RELAXNG_ERR_LISTEMPTY, + XML_RELAXNG_ERR_INTERNODATA, + XML_RELAXNG_ERR_INTERSEQ, + XML_RELAXNG_ERR_INTEREXTRA, + XML_RELAXNG_ERR_ELEMNAME, + XML_RELAXNG_ERR_ATTRNAME, + XML_RELAXNG_ERR_ELEMNONS, + XML_RELAXNG_ERR_ATTRNONS, + XML_RELAXNG_ERR_ELEMWRONGNS, + XML_RELAXNG_ERR_ATTRWRONGNS, + XML_RELAXNG_ERR_ELEMEXTRANS, + XML_RELAXNG_ERR_ATTREXTRANS, + XML_RELAXNG_ERR_ELEMNOTEMPTY, + XML_RELAXNG_ERR_NOELEM, + XML_RELAXNG_ERR_NOTELEM, + XML_RELAXNG_ERR_ATTRVALID, + XML_RELAXNG_ERR_CONTENTVALID, + XML_RELAXNG_ERR_EXTRACONTENT, + XML_RELAXNG_ERR_INVALIDATTR, + XML_RELAXNG_ERR_DATAELEM, + XML_RELAXNG_ERR_VALELEM, + XML_RELAXNG_ERR_LISTELEM, + XML_RELAXNG_ERR_DATATYPE, + XML_RELAXNG_ERR_VALUE, + XML_RELAXNG_ERR_LIST, + XML_RELAXNG_ERR_NOGRAMMAR, + XML_RELAXNG_ERR_EXTRADATA, + XML_RELAXNG_ERR_LACKDATA, + XML_RELAXNG_ERR_INTERNAL, + XML_RELAXNG_ERR_ELEMWRONG, + XML_RELAXNG_ERR_TEXTWRONG +} xmlRelaxNGValidErr; + +/* + * xmlRelaxNGParserFlags: + * + * List of possible Relax NG Parser flags + */ +typedef enum { + XML_RELAXNGP_NONE = 0, + XML_RELAXNGP_FREE_DOC = 1, + XML_RELAXNGP_CRNG = 2 +} xmlRelaxNGParserFlag; + +XMLPUBFUN int XMLCALL + xmlRelaxNGInitTypes (void); +XMLPUBFUN void XMLCALL + xmlRelaxNGCleanupTypes (void); + +/* + * Interfaces for parsing. + */ +XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL + xmlRelaxNGNewParserCtxt (const char *URL); +XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL + xmlRelaxNGNewMemParserCtxt (const char *buffer, + int size); +XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL + xmlRelaxNGNewDocParserCtxt (xmlDocPtr doc); + +XMLPUBFUN int XMLCALL + xmlRelaxParserSetFlag (xmlRelaxNGParserCtxtPtr ctxt, + int flag); + +XMLPUBFUN void XMLCALL + xmlRelaxNGFreeParserCtxt (xmlRelaxNGParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlRelaxNGSetParserErrors(xmlRelaxNGParserCtxtPtr ctxt, + xmlRelaxNGValidityErrorFunc err, + xmlRelaxNGValidityWarningFunc warn, + void *ctx); +XMLPUBFUN int XMLCALL + xmlRelaxNGGetParserErrors(xmlRelaxNGParserCtxtPtr ctxt, + xmlRelaxNGValidityErrorFunc *err, + xmlRelaxNGValidityWarningFunc *warn, + void **ctx); +XMLPUBFUN void XMLCALL + xmlRelaxNGSetParserStructuredErrors( + xmlRelaxNGParserCtxtPtr ctxt, + xmlStructuredErrorFunc serror, + void *ctx); +XMLPUBFUN xmlRelaxNGPtr XMLCALL + xmlRelaxNGParse (xmlRelaxNGParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlRelaxNGFree (xmlRelaxNGPtr schema); +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void XMLCALL + xmlRelaxNGDump (FILE *output, + xmlRelaxNGPtr schema); +XMLPUBFUN void XMLCALL + xmlRelaxNGDumpTree (FILE * output, + xmlRelaxNGPtr schema); +#endif /* LIBXML_OUTPUT_ENABLED */ +/* + * Interfaces for validating + */ +XMLPUBFUN void XMLCALL + xmlRelaxNGSetValidErrors(xmlRelaxNGValidCtxtPtr ctxt, + xmlRelaxNGValidityErrorFunc err, + xmlRelaxNGValidityWarningFunc warn, + void *ctx); +XMLPUBFUN int XMLCALL + xmlRelaxNGGetValidErrors(xmlRelaxNGValidCtxtPtr ctxt, + xmlRelaxNGValidityErrorFunc *err, + xmlRelaxNGValidityWarningFunc *warn, + void **ctx); +XMLPUBFUN void XMLCALL + xmlRelaxNGSetValidStructuredErrors(xmlRelaxNGValidCtxtPtr ctxt, + xmlStructuredErrorFunc serror, void *ctx); +XMLPUBFUN xmlRelaxNGValidCtxtPtr XMLCALL + xmlRelaxNGNewValidCtxt (xmlRelaxNGPtr schema); +XMLPUBFUN void XMLCALL + xmlRelaxNGFreeValidCtxt (xmlRelaxNGValidCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlRelaxNGValidateDoc (xmlRelaxNGValidCtxtPtr ctxt, + xmlDocPtr doc); +/* + * Interfaces for progressive validation when possible + */ +XMLPUBFUN int XMLCALL + xmlRelaxNGValidatePushElement (xmlRelaxNGValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem); +XMLPUBFUN int XMLCALL + xmlRelaxNGValidatePushCData (xmlRelaxNGValidCtxtPtr ctxt, + const xmlChar *data, + int len); +XMLPUBFUN int XMLCALL + xmlRelaxNGValidatePopElement (xmlRelaxNGValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem); +XMLPUBFUN int XMLCALL + xmlRelaxNGValidateFullElement (xmlRelaxNGValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_SCHEMAS_ENABLED */ + +#endif /* __XML_RELAX_NG__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/schemasInternals.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/schemasInternals.h new file mode 100644 index 0000000..6fb7113 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/schemasInternals.h @@ -0,0 +1,958 @@ +/* + * Summary: internal interfaces for XML Schemas + * Description: internal interfaces for the XML Schemas handling + * and schema validity checking + * The Schemas development is a Work In Progress. + * Some of those interfaces are not guaranteed to be API or ABI stable ! + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + + +#ifndef __XML_SCHEMA_INTERNALS_H__ +#define __XML_SCHEMA_INTERNALS_H__ + +#include + +#ifdef LIBXML_SCHEMAS_ENABLED + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + XML_SCHEMAS_UNKNOWN = 0, + XML_SCHEMAS_STRING = 1, + XML_SCHEMAS_NORMSTRING = 2, + XML_SCHEMAS_DECIMAL = 3, + XML_SCHEMAS_TIME = 4, + XML_SCHEMAS_GDAY = 5, + XML_SCHEMAS_GMONTH = 6, + XML_SCHEMAS_GMONTHDAY = 7, + XML_SCHEMAS_GYEAR = 8, + XML_SCHEMAS_GYEARMONTH = 9, + XML_SCHEMAS_DATE = 10, + XML_SCHEMAS_DATETIME = 11, + XML_SCHEMAS_DURATION = 12, + XML_SCHEMAS_FLOAT = 13, + XML_SCHEMAS_DOUBLE = 14, + XML_SCHEMAS_BOOLEAN = 15, + XML_SCHEMAS_TOKEN = 16, + XML_SCHEMAS_LANGUAGE = 17, + XML_SCHEMAS_NMTOKEN = 18, + XML_SCHEMAS_NMTOKENS = 19, + XML_SCHEMAS_NAME = 20, + XML_SCHEMAS_QNAME = 21, + XML_SCHEMAS_NCNAME = 22, + XML_SCHEMAS_ID = 23, + XML_SCHEMAS_IDREF = 24, + XML_SCHEMAS_IDREFS = 25, + XML_SCHEMAS_ENTITY = 26, + XML_SCHEMAS_ENTITIES = 27, + XML_SCHEMAS_NOTATION = 28, + XML_SCHEMAS_ANYURI = 29, + XML_SCHEMAS_INTEGER = 30, + XML_SCHEMAS_NPINTEGER = 31, + XML_SCHEMAS_NINTEGER = 32, + XML_SCHEMAS_NNINTEGER = 33, + XML_SCHEMAS_PINTEGER = 34, + XML_SCHEMAS_INT = 35, + XML_SCHEMAS_UINT = 36, + XML_SCHEMAS_LONG = 37, + XML_SCHEMAS_ULONG = 38, + XML_SCHEMAS_SHORT = 39, + XML_SCHEMAS_USHORT = 40, + XML_SCHEMAS_BYTE = 41, + XML_SCHEMAS_UBYTE = 42, + XML_SCHEMAS_HEXBINARY = 43, + XML_SCHEMAS_BASE64BINARY = 44, + XML_SCHEMAS_ANYTYPE = 45, + XML_SCHEMAS_ANYSIMPLETYPE = 46 +} xmlSchemaValType; + +/* + * XML Schemas defines multiple type of types. + */ +typedef enum { + XML_SCHEMA_TYPE_BASIC = 1, /* A built-in datatype */ + XML_SCHEMA_TYPE_ANY, + XML_SCHEMA_TYPE_FACET, + XML_SCHEMA_TYPE_SIMPLE, + XML_SCHEMA_TYPE_COMPLEX, + XML_SCHEMA_TYPE_SEQUENCE = 6, + XML_SCHEMA_TYPE_CHOICE, + XML_SCHEMA_TYPE_ALL, + XML_SCHEMA_TYPE_SIMPLE_CONTENT, + XML_SCHEMA_TYPE_COMPLEX_CONTENT, + XML_SCHEMA_TYPE_UR, + XML_SCHEMA_TYPE_RESTRICTION, + XML_SCHEMA_TYPE_EXTENSION, + XML_SCHEMA_TYPE_ELEMENT, + XML_SCHEMA_TYPE_ATTRIBUTE, + XML_SCHEMA_TYPE_ATTRIBUTEGROUP, + XML_SCHEMA_TYPE_GROUP, + XML_SCHEMA_TYPE_NOTATION, + XML_SCHEMA_TYPE_LIST, + XML_SCHEMA_TYPE_UNION, + XML_SCHEMA_TYPE_ANY_ATTRIBUTE, + XML_SCHEMA_TYPE_IDC_UNIQUE, + XML_SCHEMA_TYPE_IDC_KEY, + XML_SCHEMA_TYPE_IDC_KEYREF, + XML_SCHEMA_TYPE_PARTICLE = 25, + XML_SCHEMA_TYPE_ATTRIBUTE_USE, + XML_SCHEMA_FACET_MININCLUSIVE = 1000, + XML_SCHEMA_FACET_MINEXCLUSIVE, + XML_SCHEMA_FACET_MAXINCLUSIVE, + XML_SCHEMA_FACET_MAXEXCLUSIVE, + XML_SCHEMA_FACET_TOTALDIGITS, + XML_SCHEMA_FACET_FRACTIONDIGITS, + XML_SCHEMA_FACET_PATTERN, + XML_SCHEMA_FACET_ENUMERATION, + XML_SCHEMA_FACET_WHITESPACE, + XML_SCHEMA_FACET_LENGTH, + XML_SCHEMA_FACET_MAXLENGTH, + XML_SCHEMA_FACET_MINLENGTH, + XML_SCHEMA_EXTRA_QNAMEREF = 2000, + XML_SCHEMA_EXTRA_ATTR_USE_PROHIB +} xmlSchemaTypeType; + +typedef enum { + XML_SCHEMA_CONTENT_UNKNOWN = 0, + XML_SCHEMA_CONTENT_EMPTY = 1, + XML_SCHEMA_CONTENT_ELEMENTS, + XML_SCHEMA_CONTENT_MIXED, + XML_SCHEMA_CONTENT_SIMPLE, + XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS, /* Obsolete */ + XML_SCHEMA_CONTENT_BASIC, + XML_SCHEMA_CONTENT_ANY +} xmlSchemaContentType; + +typedef struct _xmlSchemaVal xmlSchemaVal; +typedef xmlSchemaVal *xmlSchemaValPtr; + +typedef struct _xmlSchemaType xmlSchemaType; +typedef xmlSchemaType *xmlSchemaTypePtr; + +typedef struct _xmlSchemaFacet xmlSchemaFacet; +typedef xmlSchemaFacet *xmlSchemaFacetPtr; + +/** + * Annotation + */ +typedef struct _xmlSchemaAnnot xmlSchemaAnnot; +typedef xmlSchemaAnnot *xmlSchemaAnnotPtr; +struct _xmlSchemaAnnot { + struct _xmlSchemaAnnot *next; + xmlNodePtr content; /* the annotation */ +}; + +/** + * XML_SCHEMAS_ANYATTR_SKIP: + * + * Skip unknown attribute from validation + * Obsolete, not used anymore. + */ +#define XML_SCHEMAS_ANYATTR_SKIP 1 +/** + * XML_SCHEMAS_ANYATTR_LAX: + * + * Ignore validation non definition on attributes + * Obsolete, not used anymore. + */ +#define XML_SCHEMAS_ANYATTR_LAX 2 +/** + * XML_SCHEMAS_ANYATTR_STRICT: + * + * Apply strict validation rules on attributes + * Obsolete, not used anymore. + */ +#define XML_SCHEMAS_ANYATTR_STRICT 3 +/** + * XML_SCHEMAS_ANY_SKIP: + * + * Skip unknown attribute from validation + */ +#define XML_SCHEMAS_ANY_SKIP 1 +/** + * XML_SCHEMAS_ANY_LAX: + * + * Used by wildcards. + * Validate if type found, don't worry if not found + */ +#define XML_SCHEMAS_ANY_LAX 2 +/** + * XML_SCHEMAS_ANY_STRICT: + * + * Used by wildcards. + * Apply strict validation rules + */ +#define XML_SCHEMAS_ANY_STRICT 3 +/** + * XML_SCHEMAS_ATTR_USE_PROHIBITED: + * + * Used by wildcards. + * The attribute is prohibited. + */ +#define XML_SCHEMAS_ATTR_USE_PROHIBITED 0 +/** + * XML_SCHEMAS_ATTR_USE_REQUIRED: + * + * The attribute is required. + */ +#define XML_SCHEMAS_ATTR_USE_REQUIRED 1 +/** + * XML_SCHEMAS_ATTR_USE_OPTIONAL: + * + * The attribute is optional. + */ +#define XML_SCHEMAS_ATTR_USE_OPTIONAL 2 +/** + * XML_SCHEMAS_ATTR_GLOBAL: + * + * allow elements in no namespace + */ +#define XML_SCHEMAS_ATTR_GLOBAL 1 << 0 +/** + * XML_SCHEMAS_ATTR_NSDEFAULT: + * + * allow elements in no namespace + */ +#define XML_SCHEMAS_ATTR_NSDEFAULT 1 << 7 +/** + * XML_SCHEMAS_ATTR_INTERNAL_RESOLVED: + * + * this is set when the "type" and "ref" references + * have been resolved. + */ +#define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED 1 << 8 +/** + * XML_SCHEMAS_ATTR_FIXED: + * + * the attribute has a fixed value + */ +#define XML_SCHEMAS_ATTR_FIXED 1 << 9 + +/** + * xmlSchemaAttribute: + * An attribute definition. + */ + +typedef struct _xmlSchemaAttribute xmlSchemaAttribute; +typedef xmlSchemaAttribute *xmlSchemaAttributePtr; +struct _xmlSchemaAttribute { + xmlSchemaTypeType type; + struct _xmlSchemaAttribute *next; /* the next attribute (not used?) */ + const xmlChar *name; /* the name of the declaration */ + const xmlChar *id; /* Deprecated; not used */ + const xmlChar *ref; /* Deprecated; not used */ + const xmlChar *refNs; /* Deprecated; not used */ + const xmlChar *typeName; /* the local name of the type definition */ + const xmlChar *typeNs; /* the ns URI of the type definition */ + xmlSchemaAnnotPtr annot; + + xmlSchemaTypePtr base; /* Deprecated; not used */ + int occurs; /* Deprecated; not used */ + const xmlChar *defValue; /* The initial value of the value constraint */ + xmlSchemaTypePtr subtypes; /* the type definition */ + xmlNodePtr node; + const xmlChar *targetNamespace; + int flags; + const xmlChar *refPrefix; /* Deprecated; not used */ + xmlSchemaValPtr defVal; /* The compiled value constraint */ + xmlSchemaAttributePtr refDecl; /* Deprecated; not used */ +}; + +/** + * xmlSchemaAttributeLink: + * Used to build a list of attribute uses on complexType definitions. + * WARNING: Deprecated; not used. + */ +typedef struct _xmlSchemaAttributeLink xmlSchemaAttributeLink; +typedef xmlSchemaAttributeLink *xmlSchemaAttributeLinkPtr; +struct _xmlSchemaAttributeLink { + struct _xmlSchemaAttributeLink *next;/* the next attribute link ... */ + struct _xmlSchemaAttribute *attr;/* the linked attribute */ +}; + +/** + * XML_SCHEMAS_WILDCARD_COMPLETE: + * + * If the wildcard is complete. + */ +#define XML_SCHEMAS_WILDCARD_COMPLETE 1 << 0 + +/** + * xmlSchemaCharValueLink: + * Used to build a list of namespaces on wildcards. + */ +typedef struct _xmlSchemaWildcardNs xmlSchemaWildcardNs; +typedef xmlSchemaWildcardNs *xmlSchemaWildcardNsPtr; +struct _xmlSchemaWildcardNs { + struct _xmlSchemaWildcardNs *next;/* the next constraint link ... */ + const xmlChar *value;/* the value */ +}; + +/** + * xmlSchemaWildcard. + * A wildcard. + */ +typedef struct _xmlSchemaWildcard xmlSchemaWildcard; +typedef xmlSchemaWildcard *xmlSchemaWildcardPtr; +struct _xmlSchemaWildcard { + xmlSchemaTypeType type; /* The kind of type */ + const xmlChar *id; /* Deprecated; not used */ + xmlSchemaAnnotPtr annot; + xmlNodePtr node; + int minOccurs; /* Deprecated; not used */ + int maxOccurs; /* Deprecated; not used */ + int processContents; + int any; /* Indicates if the ns constraint is of ##any */ + xmlSchemaWildcardNsPtr nsSet; /* The list of allowed namespaces */ + xmlSchemaWildcardNsPtr negNsSet; /* The negated namespace */ + int flags; +}; + +/** + * XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED: + * + * The attribute wildcard has been already builded. + */ +#define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED 1 << 0 +/** + * XML_SCHEMAS_ATTRGROUP_GLOBAL: + * + * The attribute wildcard has been already builded. + */ +#define XML_SCHEMAS_ATTRGROUP_GLOBAL 1 << 1 +/** + * XML_SCHEMAS_ATTRGROUP_MARKED: + * + * Marks the attr group as marked; used for circular checks. + */ +#define XML_SCHEMAS_ATTRGROUP_MARKED 1 << 2 + +/** + * XML_SCHEMAS_ATTRGROUP_REDEFINED: + * + * The attr group was redefined. + */ +#define XML_SCHEMAS_ATTRGROUP_REDEFINED 1 << 3 +/** + * XML_SCHEMAS_ATTRGROUP_HAS_REFS: + * + * Whether this attr. group contains attr. group references. + */ +#define XML_SCHEMAS_ATTRGROUP_HAS_REFS 1 << 4 + +/** + * An attribute group definition. + * + * xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures + * must be kept similar + */ +typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup; +typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr; +struct _xmlSchemaAttributeGroup { + xmlSchemaTypeType type; /* The kind of type */ + struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */ + const xmlChar *name; + const xmlChar *id; + const xmlChar *ref; /* Deprecated; not used */ + const xmlChar *refNs; /* Deprecated; not used */ + xmlSchemaAnnotPtr annot; + + xmlSchemaAttributePtr attributes; /* Deprecated; not used */ + xmlNodePtr node; + int flags; + xmlSchemaWildcardPtr attributeWildcard; + const xmlChar *refPrefix; /* Deprecated; not used */ + xmlSchemaAttributeGroupPtr refItem; /* Deprecated; not used */ + const xmlChar *targetNamespace; + void *attrUses; +}; + +/** + * xmlSchemaTypeLink: + * Used to build a list of types (e.g. member types of + * simpleType with variety "union"). + */ +typedef struct _xmlSchemaTypeLink xmlSchemaTypeLink; +typedef xmlSchemaTypeLink *xmlSchemaTypeLinkPtr; +struct _xmlSchemaTypeLink { + struct _xmlSchemaTypeLink *next;/* the next type link ... */ + xmlSchemaTypePtr type;/* the linked type */ +}; + +/** + * xmlSchemaFacetLink: + * Used to build a list of facets. + */ +typedef struct _xmlSchemaFacetLink xmlSchemaFacetLink; +typedef xmlSchemaFacetLink *xmlSchemaFacetLinkPtr; +struct _xmlSchemaFacetLink { + struct _xmlSchemaFacetLink *next;/* the next facet link ... */ + xmlSchemaFacetPtr facet;/* the linked facet */ +}; + +/** + * XML_SCHEMAS_TYPE_MIXED: + * + * the element content type is mixed + */ +#define XML_SCHEMAS_TYPE_MIXED 1 << 0 +/** + * XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION: + * + * the simple or complex type has a derivation method of "extension". + */ +#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION 1 << 1 +/** + * XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION: + * + * the simple or complex type has a derivation method of "restriction". + */ +#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION 1 << 2 +/** + * XML_SCHEMAS_TYPE_GLOBAL: + * + * the type is global + */ +#define XML_SCHEMAS_TYPE_GLOBAL 1 << 3 +/** + * XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD: + * + * the complexType owns an attribute wildcard, i.e. + * it can be freed by the complexType + */ +#define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD 1 << 4 /* Obsolete. */ +/** + * XML_SCHEMAS_TYPE_VARIETY_ABSENT: + * + * the simpleType has a variety of "absent". + * TODO: Actually not necessary :-/, since if + * none of the variety flags occur then it's + * automatically absent. + */ +#define XML_SCHEMAS_TYPE_VARIETY_ABSENT 1 << 5 +/** + * XML_SCHEMAS_TYPE_VARIETY_LIST: + * + * the simpleType has a variety of "list". + */ +#define XML_SCHEMAS_TYPE_VARIETY_LIST 1 << 6 +/** + * XML_SCHEMAS_TYPE_VARIETY_UNION: + * + * the simpleType has a variety of "union". + */ +#define XML_SCHEMAS_TYPE_VARIETY_UNION 1 << 7 +/** + * XML_SCHEMAS_TYPE_VARIETY_ATOMIC: + * + * the simpleType has a variety of "union". + */ +#define XML_SCHEMAS_TYPE_VARIETY_ATOMIC 1 << 8 +/** + * XML_SCHEMAS_TYPE_FINAL_EXTENSION: + * + * the complexType has a final of "extension". + */ +#define XML_SCHEMAS_TYPE_FINAL_EXTENSION 1 << 9 +/** + * XML_SCHEMAS_TYPE_FINAL_RESTRICTION: + * + * the simpleType/complexType has a final of "restriction". + */ +#define XML_SCHEMAS_TYPE_FINAL_RESTRICTION 1 << 10 +/** + * XML_SCHEMAS_TYPE_FINAL_LIST: + * + * the simpleType has a final of "list". + */ +#define XML_SCHEMAS_TYPE_FINAL_LIST 1 << 11 +/** + * XML_SCHEMAS_TYPE_FINAL_UNION: + * + * the simpleType has a final of "union". + */ +#define XML_SCHEMAS_TYPE_FINAL_UNION 1 << 12 +/** + * XML_SCHEMAS_TYPE_FINAL_DEFAULT: + * + * the simpleType has a final of "default". + */ +#define XML_SCHEMAS_TYPE_FINAL_DEFAULT 1 << 13 +/** + * XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE: + * + * Marks the item as a builtin primitive. + */ +#define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE 1 << 14 +/** + * XML_SCHEMAS_TYPE_MARKED: + * + * Marks the item as marked; used for circular checks. + */ +#define XML_SCHEMAS_TYPE_MARKED 1 << 16 +/** + * XML_SCHEMAS_TYPE_BLOCK_DEFAULT: + * + * the complexType did not specify 'block' so use the default of the + * item. + */ +#define XML_SCHEMAS_TYPE_BLOCK_DEFAULT 1 << 17 +/** + * XML_SCHEMAS_TYPE_BLOCK_EXTENSION: + * + * the complexType has a 'block' of "extension". + */ +#define XML_SCHEMAS_TYPE_BLOCK_EXTENSION 1 << 18 +/** + * XML_SCHEMAS_TYPE_BLOCK_RESTRICTION: + * + * the complexType has a 'block' of "restriction". + */ +#define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION 1 << 19 +/** + * XML_SCHEMAS_TYPE_ABSTRACT: + * + * the simple/complexType is abstract. + */ +#define XML_SCHEMAS_TYPE_ABSTRACT 1 << 20 +/** + * XML_SCHEMAS_TYPE_FACETSNEEDVALUE: + * + * indicates if the facets need a computed value + */ +#define XML_SCHEMAS_TYPE_FACETSNEEDVALUE 1 << 21 +/** + * XML_SCHEMAS_TYPE_INTERNAL_RESOLVED: + * + * indicates that the type was typefixed + */ +#define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED 1 << 22 +/** + * XML_SCHEMAS_TYPE_INTERNAL_INVALID: + * + * indicates that the type is invalid + */ +#define XML_SCHEMAS_TYPE_INTERNAL_INVALID 1 << 23 +/** + * XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE: + * + * a whitespace-facet value of "preserve" + */ +#define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE 1 << 24 +/** + * XML_SCHEMAS_TYPE_WHITESPACE_REPLACE: + * + * a whitespace-facet value of "replace" + */ +#define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE 1 << 25 +/** + * XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE: + * + * a whitespace-facet value of "collapse" + */ +#define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE 1 << 26 +/** + * XML_SCHEMAS_TYPE_HAS_FACETS: + * + * has facets + */ +#define XML_SCHEMAS_TYPE_HAS_FACETS 1 << 27 +/** + * XML_SCHEMAS_TYPE_NORMVALUENEEDED: + * + * indicates if the facets (pattern) need a normalized value + */ +#define XML_SCHEMAS_TYPE_NORMVALUENEEDED 1 << 28 + +/** + * XML_SCHEMAS_TYPE_FIXUP_1: + * + * First stage of fixup was done. + */ +#define XML_SCHEMAS_TYPE_FIXUP_1 1 << 29 + +/** + * XML_SCHEMAS_TYPE_REDEFINED: + * + * The type was redefined. + */ +#define XML_SCHEMAS_TYPE_REDEFINED 1 << 30 +/** + * XML_SCHEMAS_TYPE_REDEFINING: + * + * The type redefines an other type. + */ +/* #define XML_SCHEMAS_TYPE_REDEFINING 1 << 31 */ + +/** + * _xmlSchemaType: + * + * Schemas type definition. + */ +struct _xmlSchemaType { + xmlSchemaTypeType type; /* The kind of type */ + struct _xmlSchemaType *next; /* the next type if in a sequence ... */ + const xmlChar *name; + const xmlChar *id ; /* Deprecated; not used */ + const xmlChar *ref; /* Deprecated; not used */ + const xmlChar *refNs; /* Deprecated; not used */ + xmlSchemaAnnotPtr annot; + xmlSchemaTypePtr subtypes; + xmlSchemaAttributePtr attributes; /* Deprecated; not used */ + xmlNodePtr node; + int minOccurs; /* Deprecated; not used */ + int maxOccurs; /* Deprecated; not used */ + + int flags; + xmlSchemaContentType contentType; + const xmlChar *base; /* Base type's local name */ + const xmlChar *baseNs; /* Base type's target namespace */ + xmlSchemaTypePtr baseType; /* The base type component */ + xmlSchemaFacetPtr facets; /* Local facets */ + struct _xmlSchemaType *redef; /* Deprecated; not used */ + int recurse; /* Obsolete */ + xmlSchemaAttributeLinkPtr *attributeUses; /* Deprecated; not used */ + xmlSchemaWildcardPtr attributeWildcard; + int builtInType; /* Type of built-in types. */ + xmlSchemaTypeLinkPtr memberTypes; /* member-types if a union type. */ + xmlSchemaFacetLinkPtr facetSet; /* All facets (incl. inherited) */ + const xmlChar *refPrefix; /* Deprecated; not used */ + xmlSchemaTypePtr contentTypeDef; /* Used for the simple content of complex types. + Could we use @subtypes for this? */ + xmlRegexpPtr contModel; /* Holds the automaton of the content model */ + const xmlChar *targetNamespace; + void *attrUses; +}; + +/* + * xmlSchemaElement: + * An element definition. + * + * xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of + * structures must be kept similar + */ +/** + * XML_SCHEMAS_ELEM_NILLABLE: + * + * the element is nillable + */ +#define XML_SCHEMAS_ELEM_NILLABLE 1 << 0 +/** + * XML_SCHEMAS_ELEM_GLOBAL: + * + * the element is global + */ +#define XML_SCHEMAS_ELEM_GLOBAL 1 << 1 +/** + * XML_SCHEMAS_ELEM_DEFAULT: + * + * the element has a default value + */ +#define XML_SCHEMAS_ELEM_DEFAULT 1 << 2 +/** + * XML_SCHEMAS_ELEM_FIXED: + * + * the element has a fixed value + */ +#define XML_SCHEMAS_ELEM_FIXED 1 << 3 +/** + * XML_SCHEMAS_ELEM_ABSTRACT: + * + * the element is abstract + */ +#define XML_SCHEMAS_ELEM_ABSTRACT 1 << 4 +/** + * XML_SCHEMAS_ELEM_TOPLEVEL: + * + * the element is top level + * obsolete: use XML_SCHEMAS_ELEM_GLOBAL instead + */ +#define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5 +/** + * XML_SCHEMAS_ELEM_REF: + * + * the element is a reference to a type + */ +#define XML_SCHEMAS_ELEM_REF 1 << 6 +/** + * XML_SCHEMAS_ELEM_NSDEFAULT: + * + * allow elements in no namespace + * Obsolete, not used anymore. + */ +#define XML_SCHEMAS_ELEM_NSDEFAULT 1 << 7 +/** + * XML_SCHEMAS_ELEM_INTERNAL_RESOLVED: + * + * this is set when "type", "ref", "substitutionGroup" + * references have been resolved. + */ +#define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED 1 << 8 + /** + * XML_SCHEMAS_ELEM_CIRCULAR: + * + * a helper flag for the search of circular references. + */ +#define XML_SCHEMAS_ELEM_CIRCULAR 1 << 9 +/** + * XML_SCHEMAS_ELEM_BLOCK_ABSENT: + * + * the "block" attribute is absent + */ +#define XML_SCHEMAS_ELEM_BLOCK_ABSENT 1 << 10 +/** + * XML_SCHEMAS_ELEM_BLOCK_EXTENSION: + * + * disallowed substitutions are absent + */ +#define XML_SCHEMAS_ELEM_BLOCK_EXTENSION 1 << 11 +/** + * XML_SCHEMAS_ELEM_BLOCK_RESTRICTION: + * + * disallowed substitutions: "restriction" + */ +#define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION 1 << 12 +/** + * XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION: + * + * disallowed substitutions: "substituion" + */ +#define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION 1 << 13 +/** + * XML_SCHEMAS_ELEM_FINAL_ABSENT: + * + * substitution group exclusions are absent + */ +#define XML_SCHEMAS_ELEM_FINAL_ABSENT 1 << 14 +/** + * XML_SCHEMAS_ELEM_FINAL_EXTENSION: + * + * substitution group exclusions: "extension" + */ +#define XML_SCHEMAS_ELEM_FINAL_EXTENSION 1 << 15 +/** + * XML_SCHEMAS_ELEM_FINAL_RESTRICTION: + * + * substitution group exclusions: "restriction" + */ +#define XML_SCHEMAS_ELEM_FINAL_RESTRICTION 1 << 16 +/** + * XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD: + * + * the declaration is a substitution group head + */ +#define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD 1 << 17 +/** + * XML_SCHEMAS_ELEM_INTERNAL_CHECKED: + * + * this is set when the elem decl has been checked against + * all constraints + */ +#define XML_SCHEMAS_ELEM_INTERNAL_CHECKED 1 << 18 + +typedef struct _xmlSchemaElement xmlSchemaElement; +typedef xmlSchemaElement *xmlSchemaElementPtr; +struct _xmlSchemaElement { + xmlSchemaTypeType type; /* The kind of type */ + struct _xmlSchemaType *next; /* Not used? */ + const xmlChar *name; + const xmlChar *id; /* Deprecated; not used */ + const xmlChar *ref; /* Deprecated; not used */ + const xmlChar *refNs; /* Deprecated; not used */ + xmlSchemaAnnotPtr annot; + xmlSchemaTypePtr subtypes; /* the type definition */ + xmlSchemaAttributePtr attributes; + xmlNodePtr node; + int minOccurs; /* Deprecated; not used */ + int maxOccurs; /* Deprecated; not used */ + + int flags; + const xmlChar *targetNamespace; + const xmlChar *namedType; + const xmlChar *namedTypeNs; + const xmlChar *substGroup; + const xmlChar *substGroupNs; + const xmlChar *scope; + const xmlChar *value; /* The original value of the value constraint. */ + struct _xmlSchemaElement *refDecl; /* This will now be used for the + substitution group affiliation */ + xmlRegexpPtr contModel; /* Obsolete for WXS, maybe used for RelaxNG */ + xmlSchemaContentType contentType; + const xmlChar *refPrefix; /* Deprecated; not used */ + xmlSchemaValPtr defVal; /* The compiled value contraint. */ + void *idcs; /* The identity-constraint defs */ +}; + +/* + * XML_SCHEMAS_FACET_UNKNOWN: + * + * unknown facet handling + */ +#define XML_SCHEMAS_FACET_UNKNOWN 0 +/* + * XML_SCHEMAS_FACET_PRESERVE: + * + * preserve the type of the facet + */ +#define XML_SCHEMAS_FACET_PRESERVE 1 +/* + * XML_SCHEMAS_FACET_REPLACE: + * + * replace the type of the facet + */ +#define XML_SCHEMAS_FACET_REPLACE 2 +/* + * XML_SCHEMAS_FACET_COLLAPSE: + * + * collapse the types of the facet + */ +#define XML_SCHEMAS_FACET_COLLAPSE 3 +/** + * A facet definition. + */ +struct _xmlSchemaFacet { + xmlSchemaTypeType type; /* The kind of type */ + struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */ + const xmlChar *value; /* The original value */ + const xmlChar *id; /* Obsolete */ + xmlSchemaAnnotPtr annot; + xmlNodePtr node; + int fixed; /* XML_SCHEMAS_FACET_PRESERVE, etc. */ + int whitespace; + xmlSchemaValPtr val; /* The compiled value */ + xmlRegexpPtr regexp; /* The regex for patterns */ +}; + +/** + * A notation definition. + */ +typedef struct _xmlSchemaNotation xmlSchemaNotation; +typedef xmlSchemaNotation *xmlSchemaNotationPtr; +struct _xmlSchemaNotation { + xmlSchemaTypeType type; /* The kind of type */ + const xmlChar *name; + xmlSchemaAnnotPtr annot; + const xmlChar *identifier; + const xmlChar *targetNamespace; +}; + +/* +* TODO: Actually all those flags used for the schema should sit +* on the schema parser context, since they are used only +* during parsing an XML schema document, and not available +* on the component level as per spec. +*/ +/** + * XML_SCHEMAS_QUALIF_ELEM: + * + * Reflects elementFormDefault == qualified in + * an XML schema document. + */ +#define XML_SCHEMAS_QUALIF_ELEM 1 << 0 +/** + * XML_SCHEMAS_QUALIF_ATTR: + * + * Reflects attributeFormDefault == qualified in + * an XML schema document. + */ +#define XML_SCHEMAS_QUALIF_ATTR 1 << 1 +/** + * XML_SCHEMAS_FINAL_DEFAULT_EXTENSION: + * + * the schema has "extension" in the set of finalDefault. + */ +#define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION 1 << 2 +/** + * XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION: + * + * the schema has "restriction" in the set of finalDefault. + */ +#define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION 1 << 3 +/** + * XML_SCHEMAS_FINAL_DEFAULT_LIST: + * + * the cshema has "list" in the set of finalDefault. + */ +#define XML_SCHEMAS_FINAL_DEFAULT_LIST 1 << 4 +/** + * XML_SCHEMAS_FINAL_DEFAULT_UNION: + * + * the schema has "union" in the set of finalDefault. + */ +#define XML_SCHEMAS_FINAL_DEFAULT_UNION 1 << 5 +/** + * XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION: + * + * the schema has "extension" in the set of blockDefault. + */ +#define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION 1 << 6 +/** + * XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION: + * + * the schema has "restriction" in the set of blockDefault. + */ +#define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION 1 << 7 +/** + * XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION: + * + * the schema has "substitution" in the set of blockDefault. + */ +#define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION 1 << 8 +/** + * XML_SCHEMAS_INCLUDING_CONVERT_NS: + * + * the schema is currently including an other schema with + * no target namespace. + */ +#define XML_SCHEMAS_INCLUDING_CONVERT_NS 1 << 9 +/** + * _xmlSchema: + * + * A Schemas definition + */ +struct _xmlSchema { + const xmlChar *name; /* schema name */ + const xmlChar *targetNamespace; /* the target namespace */ + const xmlChar *version; + const xmlChar *id; /* Obsolete */ + xmlDocPtr doc; + xmlSchemaAnnotPtr annot; + int flags; + + xmlHashTablePtr typeDecl; + xmlHashTablePtr attrDecl; + xmlHashTablePtr attrgrpDecl; + xmlHashTablePtr elemDecl; + xmlHashTablePtr notaDecl; + + xmlHashTablePtr schemasImports; + + void *_private; /* unused by the library for users or bindings */ + xmlHashTablePtr groupDecl; + xmlDictPtr dict; + void *includes; /* the includes, this is opaque for now */ + int preserve; /* whether to free the document */ + int counter; /* used to give ononymous components unique names */ + xmlHashTablePtr idcDef; /* All identity-constraint defs. */ + void *volatiles; /* Obsolete */ +}; + +XMLPUBFUN void XMLCALL xmlSchemaFreeType (xmlSchemaTypePtr type); +XMLPUBFUN void XMLCALL xmlSchemaFreeWildcard(xmlSchemaWildcardPtr wildcard); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_SCHEMAS_ENABLED */ +#endif /* __XML_SCHEMA_INTERNALS_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/schematron.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/schematron.h new file mode 100644 index 0000000..364eaec --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/schematron.h @@ -0,0 +1,142 @@ +/* + * Summary: XML Schemastron implementation + * Description: interface to the XML Schematron validity checking. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + + +#ifndef __XML_SCHEMATRON_H__ +#define __XML_SCHEMATRON_H__ + +#include + +#ifdef LIBXML_SCHEMATRON_ENABLED + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + XML_SCHEMATRON_OUT_QUIET = 1 << 0, /* quiet no report */ + XML_SCHEMATRON_OUT_TEXT = 1 << 1, /* build a textual report */ + XML_SCHEMATRON_OUT_XML = 1 << 2, /* output SVRL */ + XML_SCHEMATRON_OUT_ERROR = 1 << 3, /* output via xmlStructuredErrorFunc */ + XML_SCHEMATRON_OUT_FILE = 1 << 8, /* output to a file descriptor */ + XML_SCHEMATRON_OUT_BUFFER = 1 << 9, /* output to a buffer */ + XML_SCHEMATRON_OUT_IO = 1 << 10 /* output to I/O mechanism */ +} xmlSchematronValidOptions; + +/** + * The schemas related types are kept internal + */ +typedef struct _xmlSchematron xmlSchematron; +typedef xmlSchematron *xmlSchematronPtr; + +/** + * xmlSchematronValidityErrorFunc: + * @ctx: the validation context + * @msg: the message + * @...: extra arguments + * + * Signature of an error callback from a Schematron validation + */ +typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...); + +/** + * xmlSchematronValidityWarningFunc: + * @ctx: the validation context + * @msg: the message + * @...: extra arguments + * + * Signature of a warning callback from a Schematron validation + */ +typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...); + +/** + * A schemas validation context + */ +typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt; +typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr; + +typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt; +typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr; + +/* + * Interfaces for parsing. + */ +XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL + xmlSchematronNewParserCtxt (const char *URL); +XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL + xmlSchematronNewMemParserCtxt(const char *buffer, + int size); +XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL + xmlSchematronNewDocParserCtxt(xmlDocPtr doc); +XMLPUBFUN void XMLCALL + xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt); +/***** +XMLPUBFUN void XMLCALL + xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt, + xmlSchematronValidityErrorFunc err, + xmlSchematronValidityWarningFunc warn, + void *ctx); +XMLPUBFUN int XMLCALL + xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt, + xmlSchematronValidityErrorFunc * err, + xmlSchematronValidityWarningFunc * warn, + void **ctx); +XMLPUBFUN int XMLCALL + xmlSchematronIsValid (xmlSchematronValidCtxtPtr ctxt); + *****/ +XMLPUBFUN xmlSchematronPtr XMLCALL + xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlSchematronFree (xmlSchematronPtr schema); +/* + * Interfaces for validating + */ +XMLPUBFUN void XMLCALL + xmlSchematronSetValidStructuredErrors( + xmlSchematronValidCtxtPtr ctxt, + xmlStructuredErrorFunc serror, + void *ctx); +/****** +XMLPUBFUN void XMLCALL + xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt, + xmlSchematronValidityErrorFunc err, + xmlSchematronValidityWarningFunc warn, + void *ctx); +XMLPUBFUN int XMLCALL + xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt, + xmlSchematronValidityErrorFunc *err, + xmlSchematronValidityWarningFunc *warn, + void **ctx); +XMLPUBFUN int XMLCALL + xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt, + int options); +XMLPUBFUN int XMLCALL + xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt, + xmlNodePtr elem); + *******/ + +XMLPUBFUN xmlSchematronValidCtxtPtr XMLCALL + xmlSchematronNewValidCtxt (xmlSchematronPtr schema, + int options); +XMLPUBFUN void XMLCALL + xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlSchematronValidateDoc (xmlSchematronValidCtxtPtr ctxt, + xmlDocPtr instance); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_SCHEMATRON_ENABLED */ +#endif /* __XML_SCHEMATRON_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/threads.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/threads.h new file mode 100644 index 0000000..9969ae7 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/threads.h @@ -0,0 +1,89 @@ +/** + * Summary: interfaces for thread handling + * Description: set of generic threading related routines + * should work with pthreads, Windows native or TLS threads + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_THREADS_H__ +#define __XML_THREADS_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * xmlMutex are a simple mutual exception locks. + */ +typedef struct _xmlMutex xmlMutex; +typedef xmlMutex *xmlMutexPtr; + +/* + * xmlRMutex are reentrant mutual exception locks. + */ +typedef struct _xmlRMutex xmlRMutex; +typedef xmlRMutex *xmlRMutexPtr; + +#ifdef __cplusplus +} +#endif +#include +#ifdef __cplusplus +extern "C" { +#endif +XMLPUBFUN xmlMutexPtr XMLCALL + xmlNewMutex (void); +XMLPUBFUN void XMLCALL + xmlMutexLock (xmlMutexPtr tok); +XMLPUBFUN void XMLCALL + xmlMutexUnlock (xmlMutexPtr tok); +XMLPUBFUN void XMLCALL + xmlFreeMutex (xmlMutexPtr tok); + +XMLPUBFUN xmlRMutexPtr XMLCALL + xmlNewRMutex (void); +XMLPUBFUN void XMLCALL + xmlRMutexLock (xmlRMutexPtr tok); +XMLPUBFUN void XMLCALL + xmlRMutexUnlock (xmlRMutexPtr tok); +XMLPUBFUN void XMLCALL + xmlFreeRMutex (xmlRMutexPtr tok); + +/* + * Library wide APIs. + */ +XMLPUBFUN void XMLCALL + xmlInitThreads (void); +XMLPUBFUN void XMLCALL + xmlLockLibrary (void); +XMLPUBFUN void XMLCALL + xmlUnlockLibrary(void); +XMLPUBFUN int XMLCALL + xmlGetThreadId (void); +XMLPUBFUN int XMLCALL + xmlIsMainThread (void); +XMLPUBFUN void XMLCALL + xmlCleanupThreads(void); +XMLPUBFUN xmlGlobalStatePtr XMLCALL + xmlGetGlobalState(void); + +#ifdef HAVE_PTHREAD_H +#elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)) +#if defined(LIBXML_STATIC_FOR_DLL) +int XMLCALL +xmlDllMain(void *hinstDLL, unsigned long fdwReason, + void *lpvReserved); +#endif +#endif + +#ifdef __cplusplus +} +#endif + + +#endif /* __XML_THREADS_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/tree.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/tree.h new file mode 100644 index 0000000..626ed6a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/tree.h @@ -0,0 +1,1311 @@ +/* + * Summary: interfaces for tree manipulation + * Description: this module describes the structures found in an tree resulting + * from an XML or HTML parsing, as well as the API provided for + * various processing on that tree + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_TREE_H__ +#define __XML_TREE_H__ + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Some of the basic types pointer to structures: + */ +/* xmlIO.h */ +typedef struct _xmlParserInputBuffer xmlParserInputBuffer; +typedef xmlParserInputBuffer *xmlParserInputBufferPtr; + +typedef struct _xmlOutputBuffer xmlOutputBuffer; +typedef xmlOutputBuffer *xmlOutputBufferPtr; + +/* parser.h */ +typedef struct _xmlParserInput xmlParserInput; +typedef xmlParserInput *xmlParserInputPtr; + +typedef struct _xmlParserCtxt xmlParserCtxt; +typedef xmlParserCtxt *xmlParserCtxtPtr; + +typedef struct _xmlSAXLocator xmlSAXLocator; +typedef xmlSAXLocator *xmlSAXLocatorPtr; + +typedef struct _xmlSAXHandler xmlSAXHandler; +typedef xmlSAXHandler *xmlSAXHandlerPtr; + +/* entities.h */ +typedef struct _xmlEntity xmlEntity; +typedef xmlEntity *xmlEntityPtr; + +/** + * BASE_BUFFER_SIZE: + * + * default buffer size 4000. + */ +#define BASE_BUFFER_SIZE 4096 + +/** + * LIBXML_NAMESPACE_DICT: + * + * Defines experimental behaviour: + * 1) xmlNs gets an additional field @context (a xmlDoc) + * 2) when creating a tree, xmlNs->href is stored in the dict of xmlDoc. + */ +/* #define LIBXML_NAMESPACE_DICT */ + +/** + * xmlBufferAllocationScheme: + * + * A buffer allocation scheme can be defined to either match exactly the + * need or double it's allocated size each time it is found too small. + */ + +typedef enum { + XML_BUFFER_ALLOC_DOUBLEIT, /* double each time one need to grow */ + XML_BUFFER_ALLOC_EXACT, /* grow only to the minimal size */ + XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer */ + XML_BUFFER_ALLOC_IO, /* special allocation scheme used for I/O */ + XML_BUFFER_ALLOC_HYBRID, /* exact up to a threshold, and doubleit thereafter */ + XML_BUFFER_ALLOC_BOUNDED /* limit the upper size of the buffer */ +} xmlBufferAllocationScheme; + +/** + * xmlBuffer: + * + * A buffer structure, this old construct is limited to 2GB and + * is being deprecated, use API with xmlBuf instead + */ +typedef struct _xmlBuffer xmlBuffer; +typedef xmlBuffer *xmlBufferPtr; +struct _xmlBuffer { + xmlChar *content; /* The buffer content UTF8 */ + unsigned int use; /* The buffer size used */ + unsigned int size; /* The buffer size */ + xmlBufferAllocationScheme alloc; /* The realloc method */ + xmlChar *contentIO; /* in IO mode we may have a different base */ +}; + +/** + * xmlBuf: + * + * A buffer structure, new one, the actual structure internals are not public + */ + +typedef struct _xmlBuf xmlBuf; + +/** + * xmlBufPtr: + * + * A pointer to a buffer structure, the actual structure internals are not + * public + */ + +typedef xmlBuf *xmlBufPtr; + +/* + * A few public routines for xmlBuf. As those are expected to be used + * mostly internally the bulk of the routines are internal in buf.h + */ +XMLPUBFUN xmlChar* XMLCALL xmlBufContent (const xmlBuf* buf); +XMLPUBFUN xmlChar* XMLCALL xmlBufEnd (xmlBufPtr buf); +XMLPUBFUN size_t XMLCALL xmlBufUse (const xmlBufPtr buf); +XMLPUBFUN size_t XMLCALL xmlBufShrink (xmlBufPtr buf, size_t len); + +/* + * LIBXML2_NEW_BUFFER: + * + * Macro used to express that the API use the new buffers for + * xmlParserInputBuffer and xmlOutputBuffer. The change was + * introduced in 2.9.0. + */ +#define LIBXML2_NEW_BUFFER + +/** + * XML_XML_NAMESPACE: + * + * This is the namespace for the special xml: prefix predefined in the + * XML Namespace specification. + */ +#define XML_XML_NAMESPACE \ + (const xmlChar *) "http://www.w3.org/XML/1998/namespace" + +/** + * XML_XML_ID: + * + * This is the name for the special xml:id attribute + */ +#define XML_XML_ID (const xmlChar *) "xml:id" + +/* + * The different element types carried by an XML tree. + * + * NOTE: This is synchronized with DOM Level1 values + * See http://www.w3.org/TR/REC-DOM-Level-1/ + * + * Actually this had diverged a bit, and now XML_DOCUMENT_TYPE_NODE should + * be deprecated to use an XML_DTD_NODE. + */ +typedef enum { + XML_ELEMENT_NODE= 1, + XML_ATTRIBUTE_NODE= 2, + XML_TEXT_NODE= 3, + XML_CDATA_SECTION_NODE= 4, + XML_ENTITY_REF_NODE= 5, + XML_ENTITY_NODE= 6, + XML_PI_NODE= 7, + XML_COMMENT_NODE= 8, + XML_DOCUMENT_NODE= 9, + XML_DOCUMENT_TYPE_NODE= 10, + XML_DOCUMENT_FRAG_NODE= 11, + XML_NOTATION_NODE= 12, + XML_HTML_DOCUMENT_NODE= 13, + XML_DTD_NODE= 14, + XML_ELEMENT_DECL= 15, + XML_ATTRIBUTE_DECL= 16, + XML_ENTITY_DECL= 17, + XML_NAMESPACE_DECL= 18, + XML_XINCLUDE_START= 19, + XML_XINCLUDE_END= 20 +#ifdef LIBXML_DOCB_ENABLED + ,XML_DOCB_DOCUMENT_NODE= 21 +#endif +} xmlElementType; + + +/** + * xmlNotation: + * + * A DTD Notation definition. + */ + +typedef struct _xmlNotation xmlNotation; +typedef xmlNotation *xmlNotationPtr; +struct _xmlNotation { + const xmlChar *name; /* Notation name */ + const xmlChar *PublicID; /* Public identifier, if any */ + const xmlChar *SystemID; /* System identifier, if any */ +}; + +/** + * xmlAttributeType: + * + * A DTD Attribute type definition. + */ + +typedef enum { + XML_ATTRIBUTE_CDATA = 1, + XML_ATTRIBUTE_ID, + XML_ATTRIBUTE_IDREF , + XML_ATTRIBUTE_IDREFS, + XML_ATTRIBUTE_ENTITY, + XML_ATTRIBUTE_ENTITIES, + XML_ATTRIBUTE_NMTOKEN, + XML_ATTRIBUTE_NMTOKENS, + XML_ATTRIBUTE_ENUMERATION, + XML_ATTRIBUTE_NOTATION +} xmlAttributeType; + +/** + * xmlAttributeDefault: + * + * A DTD Attribute default definition. + */ + +typedef enum { + XML_ATTRIBUTE_NONE = 1, + XML_ATTRIBUTE_REQUIRED, + XML_ATTRIBUTE_IMPLIED, + XML_ATTRIBUTE_FIXED +} xmlAttributeDefault; + +/** + * xmlEnumeration: + * + * List structure used when there is an enumeration in DTDs. + */ + +typedef struct _xmlEnumeration xmlEnumeration; +typedef xmlEnumeration *xmlEnumerationPtr; +struct _xmlEnumeration { + struct _xmlEnumeration *next; /* next one */ + const xmlChar *name; /* Enumeration name */ +}; + +/** + * xmlAttribute: + * + * An Attribute declaration in a DTD. + */ + +typedef struct _xmlAttribute xmlAttribute; +typedef xmlAttribute *xmlAttributePtr; +struct _xmlAttribute { + void *_private; /* application data */ + xmlElementType type; /* XML_ATTRIBUTE_DECL, must be second ! */ + const xmlChar *name; /* Attribute name */ + struct _xmlNode *children; /* NULL */ + struct _xmlNode *last; /* NULL */ + struct _xmlDtd *parent; /* -> DTD */ + struct _xmlNode *next; /* next sibling link */ + struct _xmlNode *prev; /* previous sibling link */ + struct _xmlDoc *doc; /* the containing document */ + + struct _xmlAttribute *nexth; /* next in hash table */ + xmlAttributeType atype; /* The attribute type */ + xmlAttributeDefault def; /* the default */ + const xmlChar *defaultValue; /* or the default value */ + xmlEnumerationPtr tree; /* or the enumeration tree if any */ + const xmlChar *prefix; /* the namespace prefix if any */ + const xmlChar *elem; /* Element holding the attribute */ +}; + +/** + * xmlElementContentType: + * + * Possible definitions of element content types. + */ +typedef enum { + XML_ELEMENT_CONTENT_PCDATA = 1, + XML_ELEMENT_CONTENT_ELEMENT, + XML_ELEMENT_CONTENT_SEQ, + XML_ELEMENT_CONTENT_OR +} xmlElementContentType; + +/** + * xmlElementContentOccur: + * + * Possible definitions of element content occurrences. + */ +typedef enum { + XML_ELEMENT_CONTENT_ONCE = 1, + XML_ELEMENT_CONTENT_OPT, + XML_ELEMENT_CONTENT_MULT, + XML_ELEMENT_CONTENT_PLUS +} xmlElementContentOccur; + +/** + * xmlElementContent: + * + * An XML Element content as stored after parsing an element definition + * in a DTD. + */ + +typedef struct _xmlElementContent xmlElementContent; +typedef xmlElementContent *xmlElementContentPtr; +struct _xmlElementContent { + xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */ + xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */ + const xmlChar *name; /* Element name */ + struct _xmlElementContent *c1; /* first child */ + struct _xmlElementContent *c2; /* second child */ + struct _xmlElementContent *parent; /* parent */ + const xmlChar *prefix; /* Namespace prefix */ +}; + +/** + * xmlElementTypeVal: + * + * The different possibilities for an element content type. + */ + +typedef enum { + XML_ELEMENT_TYPE_UNDEFINED = 0, + XML_ELEMENT_TYPE_EMPTY = 1, + XML_ELEMENT_TYPE_ANY, + XML_ELEMENT_TYPE_MIXED, + XML_ELEMENT_TYPE_ELEMENT +} xmlElementTypeVal; + +#ifdef __cplusplus +} +#endif +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlElement: + * + * An XML Element declaration from a DTD. + */ + +typedef struct _xmlElement xmlElement; +typedef xmlElement *xmlElementPtr; +struct _xmlElement { + void *_private; /* application data */ + xmlElementType type; /* XML_ELEMENT_DECL, must be second ! */ + const xmlChar *name; /* Element name */ + struct _xmlNode *children; /* NULL */ + struct _xmlNode *last; /* NULL */ + struct _xmlDtd *parent; /* -> DTD */ + struct _xmlNode *next; /* next sibling link */ + struct _xmlNode *prev; /* previous sibling link */ + struct _xmlDoc *doc; /* the containing document */ + + xmlElementTypeVal etype; /* The type */ + xmlElementContentPtr content; /* the allowed element content */ + xmlAttributePtr attributes; /* List of the declared attributes */ + const xmlChar *prefix; /* the namespace prefix if any */ +#ifdef LIBXML_REGEXP_ENABLED + xmlRegexpPtr contModel; /* the validating regexp */ +#else + void *contModel; +#endif +}; + + +/** + * XML_LOCAL_NAMESPACE: + * + * A namespace declaration node. + */ +#define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL +typedef xmlElementType xmlNsType; + +/** + * xmlNs: + * + * An XML namespace. + * Note that prefix == NULL is valid, it defines the default namespace + * within the subtree (until overridden). + * + * xmlNsType is unified with xmlElementType. + */ + +typedef struct _xmlNs xmlNs; +typedef xmlNs *xmlNsPtr; +struct _xmlNs { + struct _xmlNs *next; /* next Ns link for this node */ + xmlNsType type; /* global or local */ + const xmlChar *href; /* URL for the namespace */ + const xmlChar *prefix; /* prefix for the namespace */ + void *_private; /* application data */ + struct _xmlDoc *context; /* normally an xmlDoc */ +}; + +/** + * xmlDtd: + * + * An XML DTD, as defined by parent link */ + struct _xmlNode *next; /* next sibling link */ + struct _xmlNode *prev; /* previous sibling link */ + struct _xmlDoc *doc; /* the containing document */ + + /* End of common part */ + void *notations; /* Hash table for notations if any */ + void *elements; /* Hash table for elements if any */ + void *attributes; /* Hash table for attributes if any */ + void *entities; /* Hash table for entities if any */ + const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */ + const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */ + void *pentities; /* Hash table for param entities if any */ +}; + +/** + * xmlAttr: + * + * An attribute on an XML node. + */ +typedef struct _xmlAttr xmlAttr; +typedef xmlAttr *xmlAttrPtr; +struct _xmlAttr { + void *_private; /* application data */ + xmlElementType type; /* XML_ATTRIBUTE_NODE, must be second ! */ + const xmlChar *name; /* the name of the property */ + struct _xmlNode *children; /* the value of the property */ + struct _xmlNode *last; /* NULL */ + struct _xmlNode *parent; /* child->parent link */ + struct _xmlAttr *next; /* next sibling link */ + struct _xmlAttr *prev; /* previous sibling link */ + struct _xmlDoc *doc; /* the containing document */ + xmlNs *ns; /* pointer to the associated namespace */ + xmlAttributeType atype; /* the attribute type if validating */ + void *psvi; /* for type/PSVI informations */ +}; + +/** + * xmlID: + * + * An XML ID instance. + */ + +typedef struct _xmlID xmlID; +typedef xmlID *xmlIDPtr; +struct _xmlID { + struct _xmlID *next; /* next ID */ + const xmlChar *value; /* The ID name */ + xmlAttrPtr attr; /* The attribute holding it */ + const xmlChar *name; /* The attribute if attr is not available */ + int lineno; /* The line number if attr is not available */ + struct _xmlDoc *doc; /* The document holding the ID */ +}; + +/** + * xmlRef: + * + * An XML IDREF instance. + */ + +typedef struct _xmlRef xmlRef; +typedef xmlRef *xmlRefPtr; +struct _xmlRef { + struct _xmlRef *next; /* next Ref */ + const xmlChar *value; /* The Ref name */ + xmlAttrPtr attr; /* The attribute holding it */ + const xmlChar *name; /* The attribute if attr is not available */ + int lineno; /* The line number if attr is not available */ +}; + +/** + * xmlNode: + * + * A node in an XML tree. + */ +typedef struct _xmlNode xmlNode; +typedef xmlNode *xmlNodePtr; +struct _xmlNode { + void *_private; /* application data */ + xmlElementType type; /* type number, must be second ! */ + const xmlChar *name; /* the name of the node, or the entity */ + struct _xmlNode *children; /* parent->childs link */ + struct _xmlNode *last; /* last child link */ + struct _xmlNode *parent; /* child->parent link */ + struct _xmlNode *next; /* next sibling link */ + struct _xmlNode *prev; /* previous sibling link */ + struct _xmlDoc *doc; /* the containing document */ + + /* End of common part */ + xmlNs *ns; /* pointer to the associated namespace */ + xmlChar *content; /* the content */ + struct _xmlAttr *properties;/* properties list */ + xmlNs *nsDef; /* namespace definitions on this node */ + void *psvi; /* for type/PSVI informations */ + unsigned short line; /* line number */ + unsigned short extra; /* extra data for XPath/XSLT */ +}; + +/** + * XML_GET_CONTENT: + * + * Macro to extract the content pointer of a node. + */ +#define XML_GET_CONTENT(n) \ + ((n)->type == XML_ELEMENT_NODE ? NULL : (n)->content) + +/** + * XML_GET_LINE: + * + * Macro to extract the line number of an element node. + */ +#define XML_GET_LINE(n) \ + (xmlGetLineNo(n)) + +/** + * xmlDocProperty + * + * Set of properties of the document as found by the parser + * Some of them are linked to similary named xmlParserOption + */ +typedef enum { + XML_DOC_WELLFORMED = 1<<0, /* document is XML well formed */ + XML_DOC_NSVALID = 1<<1, /* document is Namespace valid */ + XML_DOC_OLD10 = 1<<2, /* parsed with old XML-1.0 parser */ + XML_DOC_DTDVALID = 1<<3, /* DTD validation was successful */ + XML_DOC_XINCLUDE = 1<<4, /* XInclude substitution was done */ + XML_DOC_USERBUILT = 1<<5, /* Document was built using the API + and not by parsing an instance */ + XML_DOC_INTERNAL = 1<<6, /* built for internal processing */ + XML_DOC_HTML = 1<<7 /* parsed or built HTML document */ +} xmlDocProperties; + +/** + * xmlDoc: + * + * An XML document. + */ +typedef struct _xmlDoc xmlDoc; +typedef xmlDoc *xmlDocPtr; +struct _xmlDoc { + void *_private; /* application data */ + xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */ + char *name; /* name/filename/URI of the document */ + struct _xmlNode *children; /* the document tree */ + struct _xmlNode *last; /* last child link */ + struct _xmlNode *parent; /* child->parent link */ + struct _xmlNode *next; /* next sibling link */ + struct _xmlNode *prev; /* previous sibling link */ + struct _xmlDoc *doc; /* autoreference to itself */ + + /* End of common part */ + int compression;/* level of zlib compression */ + int standalone; /* standalone document (no external refs) + 1 if standalone="yes" + 0 if standalone="no" + -1 if there is no XML declaration + -2 if there is an XML declaration, but no + standalone attribute was specified */ + struct _xmlDtd *intSubset; /* the document internal subset */ + struct _xmlDtd *extSubset; /* the document external subset */ + struct _xmlNs *oldNs; /* Global namespace, the old way */ + const xmlChar *version; /* the XML version string */ + const xmlChar *encoding; /* external initial encoding, if any */ + void *ids; /* Hash table for ID attributes if any */ + void *refs; /* Hash table for IDREFs attributes if any */ + const xmlChar *URL; /* The URI for that document */ + int charset; /* Internal flag for charset handling, + actually an xmlCharEncoding */ + struct _xmlDict *dict; /* dict used to allocate names or NULL */ + void *psvi; /* for type/PSVI informations */ + int parseFlags; /* set of xmlParserOption used to parse the + document */ + int properties; /* set of xmlDocProperties for this document + set at the end of parsing */ +}; + + +typedef struct _xmlDOMWrapCtxt xmlDOMWrapCtxt; +typedef xmlDOMWrapCtxt *xmlDOMWrapCtxtPtr; + +/** + * xmlDOMWrapAcquireNsFunction: + * @ctxt: a DOM wrapper context + * @node: the context node (element or attribute) + * @nsName: the requested namespace name + * @nsPrefix: the requested namespace prefix + * + * A function called to acquire namespaces (xmlNs) from the wrapper. + * + * Returns an xmlNsPtr or NULL in case of an error. + */ +typedef xmlNsPtr (*xmlDOMWrapAcquireNsFunction) (xmlDOMWrapCtxtPtr ctxt, + xmlNodePtr node, + const xmlChar *nsName, + const xmlChar *nsPrefix); + +/** + * xmlDOMWrapCtxt: + * + * Context for DOM wrapper-operations. + */ +struct _xmlDOMWrapCtxt { + void * _private; + /* + * The type of this context, just in case we need specialized + * contexts in the future. + */ + int type; + /* + * Internal namespace map used for various operations. + */ + void * namespaceMap; + /* + * Use this one to acquire an xmlNsPtr intended for node->ns. + * (Note that this is not intended for elem->nsDef). + */ + xmlDOMWrapAcquireNsFunction getNsForNodeFunc; +}; + +/** + * xmlChildrenNode: + * + * Macro for compatibility naming layer with libxml1. Maps + * to "children." + */ +#ifndef xmlChildrenNode +#define xmlChildrenNode children +#endif + +/** + * xmlRootNode: + * + * Macro for compatibility naming layer with libxml1. Maps + * to "children". + */ +#ifndef xmlRootNode +#define xmlRootNode children +#endif + +/* + * Variables. + */ + +/* + * Some helper functions + */ +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || \ + defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || \ + defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || \ + defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || \ + defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED) +XMLPUBFUN int XMLCALL + xmlValidateNCName (const xmlChar *value, + int space); +#endif + +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +XMLPUBFUN int XMLCALL + xmlValidateQName (const xmlChar *value, + int space); +XMLPUBFUN int XMLCALL + xmlValidateName (const xmlChar *value, + int space); +XMLPUBFUN int XMLCALL + xmlValidateNMToken (const xmlChar *value, + int space); +#endif + +XMLPUBFUN xmlChar * XMLCALL + xmlBuildQName (const xmlChar *ncname, + const xmlChar *prefix, + xmlChar *memory, + int len); +XMLPUBFUN xmlChar * XMLCALL + xmlSplitQName2 (const xmlChar *name, + xmlChar **prefix); +XMLPUBFUN const xmlChar * XMLCALL + xmlSplitQName3 (const xmlChar *name, + int *len); + +/* + * Handling Buffers, the old ones see @xmlBuf for the new ones. + */ + +XMLPUBFUN void XMLCALL + xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme); +XMLPUBFUN xmlBufferAllocationScheme XMLCALL + xmlGetBufferAllocationScheme(void); + +XMLPUBFUN xmlBufferPtr XMLCALL + xmlBufferCreate (void); +XMLPUBFUN xmlBufferPtr XMLCALL + xmlBufferCreateSize (size_t size); +XMLPUBFUN xmlBufferPtr XMLCALL + xmlBufferCreateStatic (void *mem, + size_t size); +XMLPUBFUN int XMLCALL + xmlBufferResize (xmlBufferPtr buf, + unsigned int size); +XMLPUBFUN void XMLCALL + xmlBufferFree (xmlBufferPtr buf); +XMLPUBFUN int XMLCALL + xmlBufferDump (FILE *file, + xmlBufferPtr buf); +XMLPUBFUN int XMLCALL + xmlBufferAdd (xmlBufferPtr buf, + const xmlChar *str, + int len); +XMLPUBFUN int XMLCALL + xmlBufferAddHead (xmlBufferPtr buf, + const xmlChar *str, + int len); +XMLPUBFUN int XMLCALL + xmlBufferCat (xmlBufferPtr buf, + const xmlChar *str); +XMLPUBFUN int XMLCALL + xmlBufferCCat (xmlBufferPtr buf, + const char *str); +XMLPUBFUN int XMLCALL + xmlBufferShrink (xmlBufferPtr buf, + unsigned int len); +XMLPUBFUN int XMLCALL + xmlBufferGrow (xmlBufferPtr buf, + unsigned int len); +XMLPUBFUN void XMLCALL + xmlBufferEmpty (xmlBufferPtr buf); +XMLPUBFUN const xmlChar* XMLCALL + xmlBufferContent (const xmlBuffer *buf); +XMLPUBFUN xmlChar* XMLCALL + xmlBufferDetach (xmlBufferPtr buf); +XMLPUBFUN void XMLCALL + xmlBufferSetAllocationScheme(xmlBufferPtr buf, + xmlBufferAllocationScheme scheme); +XMLPUBFUN int XMLCALL + xmlBufferLength (const xmlBuffer *buf); + +/* + * Creating/freeing new structures. + */ +XMLPUBFUN xmlDtdPtr XMLCALL + xmlCreateIntSubset (xmlDocPtr doc, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +XMLPUBFUN xmlDtdPtr XMLCALL + xmlNewDtd (xmlDocPtr doc, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +XMLPUBFUN xmlDtdPtr XMLCALL + xmlGetIntSubset (const xmlDoc *doc); +XMLPUBFUN void XMLCALL + xmlFreeDtd (xmlDtdPtr cur); +#ifdef LIBXML_LEGACY_ENABLED +XMLPUBFUN xmlNsPtr XMLCALL + xmlNewGlobalNs (xmlDocPtr doc, + const xmlChar *href, + const xmlChar *prefix); +#endif /* LIBXML_LEGACY_ENABLED */ +XMLPUBFUN xmlNsPtr XMLCALL + xmlNewNs (xmlNodePtr node, + const xmlChar *href, + const xmlChar *prefix); +XMLPUBFUN void XMLCALL + xmlFreeNs (xmlNsPtr cur); +XMLPUBFUN void XMLCALL + xmlFreeNsList (xmlNsPtr cur); +XMLPUBFUN xmlDocPtr XMLCALL + xmlNewDoc (const xmlChar *version); +XMLPUBFUN void XMLCALL + xmlFreeDoc (xmlDocPtr cur); +XMLPUBFUN xmlAttrPtr XMLCALL + xmlNewDocProp (xmlDocPtr doc, + const xmlChar *name, + const xmlChar *value); +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ + defined(LIBXML_SCHEMAS_ENABLED) +XMLPUBFUN xmlAttrPtr XMLCALL + xmlNewProp (xmlNodePtr node, + const xmlChar *name, + const xmlChar *value); +#endif +XMLPUBFUN xmlAttrPtr XMLCALL + xmlNewNsProp (xmlNodePtr node, + xmlNsPtr ns, + const xmlChar *name, + const xmlChar *value); +XMLPUBFUN xmlAttrPtr XMLCALL + xmlNewNsPropEatName (xmlNodePtr node, + xmlNsPtr ns, + xmlChar *name, + const xmlChar *value); +XMLPUBFUN void XMLCALL + xmlFreePropList (xmlAttrPtr cur); +XMLPUBFUN void XMLCALL + xmlFreeProp (xmlAttrPtr cur); +XMLPUBFUN xmlAttrPtr XMLCALL + xmlCopyProp (xmlNodePtr target, + xmlAttrPtr cur); +XMLPUBFUN xmlAttrPtr XMLCALL + xmlCopyPropList (xmlNodePtr target, + xmlAttrPtr cur); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN xmlDtdPtr XMLCALL + xmlCopyDtd (xmlDtdPtr dtd); +#endif /* LIBXML_TREE_ENABLED */ +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +XMLPUBFUN xmlDocPtr XMLCALL + xmlCopyDoc (xmlDocPtr doc, + int recursive); +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ +/* + * Creating new nodes. + */ +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewDocNode (xmlDocPtr doc, + xmlNsPtr ns, + const xmlChar *name, + const xmlChar *content); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewDocNodeEatName (xmlDocPtr doc, + xmlNsPtr ns, + xmlChar *name, + const xmlChar *content); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewNode (xmlNsPtr ns, + const xmlChar *name); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewNodeEatName (xmlNsPtr ns, + xmlChar *name); +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewChild (xmlNodePtr parent, + xmlNsPtr ns, + const xmlChar *name, + const xmlChar *content); +#endif +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewDocText (const xmlDoc *doc, + const xmlChar *content); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewText (const xmlChar *content); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewDocPI (xmlDocPtr doc, + const xmlChar *name, + const xmlChar *content); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewPI (const xmlChar *name, + const xmlChar *content); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewDocTextLen (xmlDocPtr doc, + const xmlChar *content, + int len); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewTextLen (const xmlChar *content, + int len); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewDocComment (xmlDocPtr doc, + const xmlChar *content); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewComment (const xmlChar *content); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewCDataBlock (xmlDocPtr doc, + const xmlChar *content, + int len); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewCharRef (xmlDocPtr doc, + const xmlChar *name); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewReference (const xmlDoc *doc, + const xmlChar *name); +XMLPUBFUN xmlNodePtr XMLCALL + xmlCopyNode (xmlNodePtr node, + int recursive); +XMLPUBFUN xmlNodePtr XMLCALL + xmlDocCopyNode (xmlNodePtr node, + xmlDocPtr doc, + int recursive); +XMLPUBFUN xmlNodePtr XMLCALL + xmlDocCopyNodeList (xmlDocPtr doc, + xmlNodePtr node); +XMLPUBFUN xmlNodePtr XMLCALL + xmlCopyNodeList (xmlNodePtr node); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewTextChild (xmlNodePtr parent, + xmlNsPtr ns, + const xmlChar *name, + const xmlChar *content); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewDocRawNode (xmlDocPtr doc, + xmlNsPtr ns, + const xmlChar *name, + const xmlChar *content); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNewDocFragment (xmlDocPtr doc); +#endif /* LIBXML_TREE_ENABLED */ + +/* + * Navigating. + */ +XMLPUBFUN long XMLCALL + xmlGetLineNo (const xmlNode *node); +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) +XMLPUBFUN xmlChar * XMLCALL + xmlGetNodePath (const xmlNode *node); +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */ +XMLPUBFUN xmlNodePtr XMLCALL + xmlDocGetRootElement (const xmlDoc *doc); +XMLPUBFUN xmlNodePtr XMLCALL + xmlGetLastChild (const xmlNode *parent); +XMLPUBFUN int XMLCALL + xmlNodeIsText (const xmlNode *node); +XMLPUBFUN int XMLCALL + xmlIsBlankNode (const xmlNode *node); + +/* + * Changing the structure. + */ +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) +XMLPUBFUN xmlNodePtr XMLCALL + xmlDocSetRootElement (xmlDocPtr doc, + xmlNodePtr root); +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN void XMLCALL + xmlNodeSetName (xmlNodePtr cur, + const xmlChar *name); +#endif /* LIBXML_TREE_ENABLED */ +XMLPUBFUN xmlNodePtr XMLCALL + xmlAddChild (xmlNodePtr parent, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL + xmlAddChildList (xmlNodePtr parent, + xmlNodePtr cur); +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) +XMLPUBFUN xmlNodePtr XMLCALL + xmlReplaceNode (xmlNodePtr old, + xmlNodePtr cur); +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ + defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) +XMLPUBFUN xmlNodePtr XMLCALL + xmlAddPrevSibling (xmlNodePtr cur, + xmlNodePtr elem); +#endif /* LIBXML_TREE_ENABLED || LIBXML_HTML_ENABLED || LIBXML_SCHEMAS_ENABLED */ +XMLPUBFUN xmlNodePtr XMLCALL + xmlAddSibling (xmlNodePtr cur, + xmlNodePtr elem); +XMLPUBFUN xmlNodePtr XMLCALL + xmlAddNextSibling (xmlNodePtr cur, + xmlNodePtr elem); +XMLPUBFUN void XMLCALL + xmlUnlinkNode (xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL + xmlTextMerge (xmlNodePtr first, + xmlNodePtr second); +XMLPUBFUN int XMLCALL + xmlTextConcat (xmlNodePtr node, + const xmlChar *content, + int len); +XMLPUBFUN void XMLCALL + xmlFreeNodeList (xmlNodePtr cur); +XMLPUBFUN void XMLCALL + xmlFreeNode (xmlNodePtr cur); +XMLPUBFUN void XMLCALL + xmlSetTreeDoc (xmlNodePtr tree, + xmlDocPtr doc); +XMLPUBFUN void XMLCALL + xmlSetListDoc (xmlNodePtr list, + xmlDocPtr doc); +/* + * Namespaces. + */ +XMLPUBFUN xmlNsPtr XMLCALL + xmlSearchNs (xmlDocPtr doc, + xmlNodePtr node, + const xmlChar *nameSpace); +XMLPUBFUN xmlNsPtr XMLCALL + xmlSearchNsByHref (xmlDocPtr doc, + xmlNodePtr node, + const xmlChar *href); +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || \ + defined(LIBXML_SCHEMAS_ENABLED) +XMLPUBFUN xmlNsPtr * XMLCALL + xmlGetNsList (const xmlDoc *doc, + const xmlNode *node); +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */ + +XMLPUBFUN void XMLCALL + xmlSetNs (xmlNodePtr node, + xmlNsPtr ns); +XMLPUBFUN xmlNsPtr XMLCALL + xmlCopyNamespace (xmlNsPtr cur); +XMLPUBFUN xmlNsPtr XMLCALL + xmlCopyNamespaceList (xmlNsPtr cur); + +/* + * Changing the content. + */ +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \ + defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) +XMLPUBFUN xmlAttrPtr XMLCALL + xmlSetProp (xmlNodePtr node, + const xmlChar *name, + const xmlChar *value); +XMLPUBFUN xmlAttrPtr XMLCALL + xmlSetNsProp (xmlNodePtr node, + xmlNsPtr ns, + const xmlChar *name, + const xmlChar *value); +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \ + defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */ +XMLPUBFUN xmlChar * XMLCALL + xmlGetNoNsProp (const xmlNode *node, + const xmlChar *name); +XMLPUBFUN xmlChar * XMLCALL + xmlGetProp (const xmlNode *node, + const xmlChar *name); +XMLPUBFUN xmlAttrPtr XMLCALL + xmlHasProp (const xmlNode *node, + const xmlChar *name); +XMLPUBFUN xmlAttrPtr XMLCALL + xmlHasNsProp (const xmlNode *node, + const xmlChar *name, + const xmlChar *nameSpace); +XMLPUBFUN xmlChar * XMLCALL + xmlGetNsProp (const xmlNode *node, + const xmlChar *name, + const xmlChar *nameSpace); +XMLPUBFUN xmlNodePtr XMLCALL + xmlStringGetNodeList (const xmlDoc *doc, + const xmlChar *value); +XMLPUBFUN xmlNodePtr XMLCALL + xmlStringLenGetNodeList (const xmlDoc *doc, + const xmlChar *value, + int len); +XMLPUBFUN xmlChar * XMLCALL + xmlNodeListGetString (xmlDocPtr doc, + const xmlNode *list, + int inLine); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN xmlChar * XMLCALL + xmlNodeListGetRawString (const xmlDoc *doc, + const xmlNode *list, + int inLine); +#endif /* LIBXML_TREE_ENABLED */ +XMLPUBFUN void XMLCALL + xmlNodeSetContent (xmlNodePtr cur, + const xmlChar *content); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN void XMLCALL + xmlNodeSetContentLen (xmlNodePtr cur, + const xmlChar *content, + int len); +#endif /* LIBXML_TREE_ENABLED */ +XMLPUBFUN void XMLCALL + xmlNodeAddContent (xmlNodePtr cur, + const xmlChar *content); +XMLPUBFUN void XMLCALL + xmlNodeAddContentLen (xmlNodePtr cur, + const xmlChar *content, + int len); +XMLPUBFUN xmlChar * XMLCALL + xmlNodeGetContent (const xmlNode *cur); + +XMLPUBFUN int XMLCALL + xmlNodeBufGetContent (xmlBufferPtr buffer, + const xmlNode *cur); +XMLPUBFUN int XMLCALL + xmlBufGetNodeContent (xmlBufPtr buf, + const xmlNode *cur); + +XMLPUBFUN xmlChar * XMLCALL + xmlNodeGetLang (const xmlNode *cur); +XMLPUBFUN int XMLCALL + xmlNodeGetSpacePreserve (const xmlNode *cur); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN void XMLCALL + xmlNodeSetLang (xmlNodePtr cur, + const xmlChar *lang); +XMLPUBFUN void XMLCALL + xmlNodeSetSpacePreserve (xmlNodePtr cur, + int val); +#endif /* LIBXML_TREE_ENABLED */ +XMLPUBFUN xmlChar * XMLCALL + xmlNodeGetBase (const xmlDoc *doc, + const xmlNode *cur); +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) +XMLPUBFUN void XMLCALL + xmlNodeSetBase (xmlNodePtr cur, + const xmlChar *uri); +#endif + +/* + * Removing content. + */ +XMLPUBFUN int XMLCALL + xmlRemoveProp (xmlAttrPtr cur); +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +XMLPUBFUN int XMLCALL + xmlUnsetNsProp (xmlNodePtr node, + xmlNsPtr ns, + const xmlChar *name); +XMLPUBFUN int XMLCALL + xmlUnsetProp (xmlNodePtr node, + const xmlChar *name); +#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ + +/* + * Internal, don't use. + */ +XMLPUBFUN void XMLCALL + xmlBufferWriteCHAR (xmlBufferPtr buf, + const xmlChar *string); +XMLPUBFUN void XMLCALL + xmlBufferWriteChar (xmlBufferPtr buf, + const char *string); +XMLPUBFUN void XMLCALL + xmlBufferWriteQuotedString(xmlBufferPtr buf, + const xmlChar *string); + +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void xmlAttrSerializeTxtContent(xmlBufferPtr buf, + xmlDocPtr doc, + xmlAttrPtr attr, + const xmlChar *string); +#endif /* LIBXML_OUTPUT_ENABLED */ + +#ifdef LIBXML_TREE_ENABLED +/* + * Namespace handling. + */ +XMLPUBFUN int XMLCALL + xmlReconciliateNs (xmlDocPtr doc, + xmlNodePtr tree); +#endif + +#ifdef LIBXML_OUTPUT_ENABLED +/* + * Saving. + */ +XMLPUBFUN void XMLCALL + xmlDocDumpFormatMemory (xmlDocPtr cur, + xmlChar **mem, + int *size, + int format); +XMLPUBFUN void XMLCALL + xmlDocDumpMemory (xmlDocPtr cur, + xmlChar **mem, + int *size); +XMLPUBFUN void XMLCALL + xmlDocDumpMemoryEnc (xmlDocPtr out_doc, + xmlChar **doc_txt_ptr, + int * doc_txt_len, + const char *txt_encoding); +XMLPUBFUN void XMLCALL + xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, + xmlChar **doc_txt_ptr, + int * doc_txt_len, + const char *txt_encoding, + int format); +XMLPUBFUN int XMLCALL + xmlDocFormatDump (FILE *f, + xmlDocPtr cur, + int format); +XMLPUBFUN int XMLCALL + xmlDocDump (FILE *f, + xmlDocPtr cur); +XMLPUBFUN void XMLCALL + xmlElemDump (FILE *f, + xmlDocPtr doc, + xmlNodePtr cur); +XMLPUBFUN int XMLCALL + xmlSaveFile (const char *filename, + xmlDocPtr cur); +XMLPUBFUN int XMLCALL + xmlSaveFormatFile (const char *filename, + xmlDocPtr cur, + int format); +XMLPUBFUN size_t XMLCALL + xmlBufNodeDump (xmlBufPtr buf, + xmlDocPtr doc, + xmlNodePtr cur, + int level, + int format); +XMLPUBFUN int XMLCALL + xmlNodeDump (xmlBufferPtr buf, + xmlDocPtr doc, + xmlNodePtr cur, + int level, + int format); + +XMLPUBFUN int XMLCALL + xmlSaveFileTo (xmlOutputBufferPtr buf, + xmlDocPtr cur, + const char *encoding); +XMLPUBFUN int XMLCALL + xmlSaveFormatFileTo (xmlOutputBufferPtr buf, + xmlDocPtr cur, + const char *encoding, + int format); +XMLPUBFUN void XMLCALL + xmlNodeDumpOutput (xmlOutputBufferPtr buf, + xmlDocPtr doc, + xmlNodePtr cur, + int level, + int format, + const char *encoding); + +XMLPUBFUN int XMLCALL + xmlSaveFormatFileEnc (const char *filename, + xmlDocPtr cur, + const char *encoding, + int format); + +XMLPUBFUN int XMLCALL + xmlSaveFileEnc (const char *filename, + xmlDocPtr cur, + const char *encoding); + +#endif /* LIBXML_OUTPUT_ENABLED */ +/* + * XHTML + */ +XMLPUBFUN int XMLCALL + xmlIsXHTML (const xmlChar *systemID, + const xmlChar *publicID); + +/* + * Compression. + */ +XMLPUBFUN int XMLCALL + xmlGetDocCompressMode (const xmlDoc *doc); +XMLPUBFUN void XMLCALL + xmlSetDocCompressMode (xmlDocPtr doc, + int mode); +XMLPUBFUN int XMLCALL + xmlGetCompressMode (void); +XMLPUBFUN void XMLCALL + xmlSetCompressMode (int mode); + +/* +* DOM-wrapper helper functions. +*/ +XMLPUBFUN xmlDOMWrapCtxtPtr XMLCALL + xmlDOMWrapNewCtxt (void); +XMLPUBFUN void XMLCALL + xmlDOMWrapFreeCtxt (xmlDOMWrapCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt, + xmlNodePtr elem, + int options); +XMLPUBFUN int XMLCALL + xmlDOMWrapAdoptNode (xmlDOMWrapCtxtPtr ctxt, + xmlDocPtr sourceDoc, + xmlNodePtr node, + xmlDocPtr destDoc, + xmlNodePtr destParent, + int options); +XMLPUBFUN int XMLCALL + xmlDOMWrapRemoveNode (xmlDOMWrapCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr node, + int options); +XMLPUBFUN int XMLCALL + xmlDOMWrapCloneNode (xmlDOMWrapCtxtPtr ctxt, + xmlDocPtr sourceDoc, + xmlNodePtr node, + xmlNodePtr *clonedNode, + xmlDocPtr destDoc, + xmlNodePtr destParent, + int deep, + int options); + +#ifdef LIBXML_TREE_ENABLED +/* + * 5 interfaces from DOM ElementTraversal, but different in entities + * traversal. + */ +XMLPUBFUN unsigned long XMLCALL + xmlChildElementCount (xmlNodePtr parent); +XMLPUBFUN xmlNodePtr XMLCALL + xmlNextElementSibling (xmlNodePtr node); +XMLPUBFUN xmlNodePtr XMLCALL + xmlFirstElementChild (xmlNodePtr parent); +XMLPUBFUN xmlNodePtr XMLCALL + xmlLastElementChild (xmlNodePtr parent); +XMLPUBFUN xmlNodePtr XMLCALL + xmlPreviousElementSibling (xmlNodePtr node); +#endif +#ifdef __cplusplus +} +#endif +#ifndef __XML_PARSER_H__ +#include +#endif + +#endif /* __XML_TREE_H__ */ + diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/uri.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/uri.h new file mode 100644 index 0000000..db48262 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/uri.h @@ -0,0 +1,94 @@ +/** + * Summary: library of generic URI related routines + * Description: library of generic URI related routines + * Implements RFC 2396 + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_URI_H__ +#define __XML_URI_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlURI: + * + * A parsed URI reference. This is a struct containing the various fields + * as described in RFC 2396 but separated for further processing. + * + * Note: query is a deprecated field which is incorrectly unescaped. + * query_raw takes precedence over query if the former is set. + * See: http://mail.gnome.org/archives/xml/2007-April/thread.html#00127 + */ +typedef struct _xmlURI xmlURI; +typedef xmlURI *xmlURIPtr; +struct _xmlURI { + char *scheme; /* the URI scheme */ + char *opaque; /* opaque part */ + char *authority; /* the authority part */ + char *server; /* the server part */ + char *user; /* the user part */ + int port; /* the port number */ + char *path; /* the path string */ + char *query; /* the query string (deprecated - use with caution) */ + char *fragment; /* the fragment identifier */ + int cleanup; /* parsing potentially unclean URI */ + char *query_raw; /* the query string (as it appears in the URI) */ +}; + +/* + * This function is in tree.h: + * xmlChar * xmlNodeGetBase (xmlDocPtr doc, + * xmlNodePtr cur); + */ +XMLPUBFUN xmlURIPtr XMLCALL + xmlCreateURI (void); +XMLPUBFUN xmlChar * XMLCALL + xmlBuildURI (const xmlChar *URI, + const xmlChar *base); +XMLPUBFUN xmlChar * XMLCALL + xmlBuildRelativeURI (const xmlChar *URI, + const xmlChar *base); +XMLPUBFUN xmlURIPtr XMLCALL + xmlParseURI (const char *str); +XMLPUBFUN xmlURIPtr XMLCALL + xmlParseURIRaw (const char *str, + int raw); +XMLPUBFUN int XMLCALL + xmlParseURIReference (xmlURIPtr uri, + const char *str); +XMLPUBFUN xmlChar * XMLCALL + xmlSaveUri (xmlURIPtr uri); +XMLPUBFUN void XMLCALL + xmlPrintURI (FILE *stream, + xmlURIPtr uri); +XMLPUBFUN xmlChar * XMLCALL + xmlURIEscapeStr (const xmlChar *str, + const xmlChar *list); +XMLPUBFUN char * XMLCALL + xmlURIUnescapeString (const char *str, + int len, + char *target); +XMLPUBFUN int XMLCALL + xmlNormalizeURIPath (char *path); +XMLPUBFUN xmlChar * XMLCALL + xmlURIEscape (const xmlChar *str); +XMLPUBFUN void XMLCALL + xmlFreeURI (xmlURIPtr uri); +XMLPUBFUN xmlChar* XMLCALL + xmlCanonicPath (const xmlChar *path); +XMLPUBFUN xmlChar* XMLCALL + xmlPathToURI (const xmlChar *path); + +#ifdef __cplusplus +} +#endif +#endif /* __XML_URI_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/valid.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/valid.h new file mode 100644 index 0000000..2bc7b38 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/valid.h @@ -0,0 +1,458 @@ +/* + * Summary: The DTD validation + * Description: API for the DTD handling and the validity checking + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + + +#ifndef __XML_VALID_H__ +#define __XML_VALID_H__ + +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Validation state added for non-determinist content model. + */ +typedef struct _xmlValidState xmlValidState; +typedef xmlValidState *xmlValidStatePtr; + +/** + * xmlValidityErrorFunc: + * @ctx: usually an xmlValidCtxtPtr to a validity error context, + * but comes from ctxt->userData (which normally contains such + * a pointer); ctxt->userData can be changed by the user. + * @msg: the string to format *printf like vararg + * @...: remaining arguments to the format + * + * Callback called when a validity error is found. This is a message + * oriented function similar to an *printf function. + */ +typedef void (XMLCDECL *xmlValidityErrorFunc) (void *ctx, + const char *msg, + ...) LIBXML_ATTR_FORMAT(2,3); + +/** + * xmlValidityWarningFunc: + * @ctx: usually an xmlValidCtxtPtr to a validity error context, + * but comes from ctxt->userData (which normally contains such + * a pointer); ctxt->userData can be changed by the user. + * @msg: the string to format *printf like vararg + * @...: remaining arguments to the format + * + * Callback called when a validity warning is found. This is a message + * oriented function similar to an *printf function. + */ +typedef void (XMLCDECL *xmlValidityWarningFunc) (void *ctx, + const char *msg, + ...) LIBXML_ATTR_FORMAT(2,3); + +#ifdef IN_LIBXML +/** + * XML_CTXT_FINISH_DTD_0: + * + * Special value for finishDtd field when embedded in an xmlParserCtxt + */ +#define XML_CTXT_FINISH_DTD_0 0xabcd1234 +/** + * XML_CTXT_FINISH_DTD_1: + * + * Special value for finishDtd field when embedded in an xmlParserCtxt + */ +#define XML_CTXT_FINISH_DTD_1 0xabcd1235 +#endif + +/* + * xmlValidCtxt: + * An xmlValidCtxt is used for error reporting when validating. + */ +typedef struct _xmlValidCtxt xmlValidCtxt; +typedef xmlValidCtxt *xmlValidCtxtPtr; +struct _xmlValidCtxt { + void *userData; /* user specific data block */ + xmlValidityErrorFunc error; /* the callback in case of errors */ + xmlValidityWarningFunc warning; /* the callback in case of warning */ + + /* Node analysis stack used when validating within entities */ + xmlNodePtr node; /* Current parsed Node */ + int nodeNr; /* Depth of the parsing stack */ + int nodeMax; /* Max depth of the parsing stack */ + xmlNodePtr *nodeTab; /* array of nodes */ + + unsigned int finishDtd; /* finished validating the Dtd ? */ + xmlDocPtr doc; /* the document */ + int valid; /* temporary validity check result */ + + /* state state used for non-determinist content validation */ + xmlValidState *vstate; /* current state */ + int vstateNr; /* Depth of the validation stack */ + int vstateMax; /* Max depth of the validation stack */ + xmlValidState *vstateTab; /* array of validation states */ + +#ifdef LIBXML_REGEXP_ENABLED + xmlAutomataPtr am; /* the automata */ + xmlAutomataStatePtr state; /* used to build the automata */ +#else + void *am; + void *state; +#endif +}; + +/* + * ALL notation declarations are stored in a table. + * There is one table per DTD. + */ + +typedef struct _xmlHashTable xmlNotationTable; +typedef xmlNotationTable *xmlNotationTablePtr; + +/* + * ALL element declarations are stored in a table. + * There is one table per DTD. + */ + +typedef struct _xmlHashTable xmlElementTable; +typedef xmlElementTable *xmlElementTablePtr; + +/* + * ALL attribute declarations are stored in a table. + * There is one table per DTD. + */ + +typedef struct _xmlHashTable xmlAttributeTable; +typedef xmlAttributeTable *xmlAttributeTablePtr; + +/* + * ALL IDs attributes are stored in a table. + * There is one table per document. + */ + +typedef struct _xmlHashTable xmlIDTable; +typedef xmlIDTable *xmlIDTablePtr; + +/* + * ALL Refs attributes are stored in a table. + * There is one table per document. + */ + +typedef struct _xmlHashTable xmlRefTable; +typedef xmlRefTable *xmlRefTablePtr; + +/* Notation */ +XMLPUBFUN xmlNotationPtr XMLCALL + xmlAddNotationDecl (xmlValidCtxtPtr ctxt, + xmlDtdPtr dtd, + const xmlChar *name, + const xmlChar *PublicID, + const xmlChar *SystemID); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN xmlNotationTablePtr XMLCALL + xmlCopyNotationTable (xmlNotationTablePtr table); +#endif /* LIBXML_TREE_ENABLED */ +XMLPUBFUN void XMLCALL + xmlFreeNotationTable (xmlNotationTablePtr table); +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void XMLCALL + xmlDumpNotationDecl (xmlBufferPtr buf, + xmlNotationPtr nota); +XMLPUBFUN void XMLCALL + xmlDumpNotationTable (xmlBufferPtr buf, + xmlNotationTablePtr table); +#endif /* LIBXML_OUTPUT_ENABLED */ + +/* Element Content */ +/* the non Doc version are being deprecated */ +XMLPUBFUN xmlElementContentPtr XMLCALL + xmlNewElementContent (const xmlChar *name, + xmlElementContentType type); +XMLPUBFUN xmlElementContentPtr XMLCALL + xmlCopyElementContent (xmlElementContentPtr content); +XMLPUBFUN void XMLCALL + xmlFreeElementContent (xmlElementContentPtr cur); +/* the new versions with doc argument */ +XMLPUBFUN xmlElementContentPtr XMLCALL + xmlNewDocElementContent (xmlDocPtr doc, + const xmlChar *name, + xmlElementContentType type); +XMLPUBFUN xmlElementContentPtr XMLCALL + xmlCopyDocElementContent(xmlDocPtr doc, + xmlElementContentPtr content); +XMLPUBFUN void XMLCALL + xmlFreeDocElementContent(xmlDocPtr doc, + xmlElementContentPtr cur); +XMLPUBFUN void XMLCALL + xmlSnprintfElementContent(char *buf, + int size, + xmlElementContentPtr content, + int englob); +#ifdef LIBXML_OUTPUT_ENABLED +/* DEPRECATED */ +XMLPUBFUN void XMLCALL + xmlSprintfElementContent(char *buf, + xmlElementContentPtr content, + int englob); +#endif /* LIBXML_OUTPUT_ENABLED */ +/* DEPRECATED */ + +/* Element */ +XMLPUBFUN xmlElementPtr XMLCALL + xmlAddElementDecl (xmlValidCtxtPtr ctxt, + xmlDtdPtr dtd, + const xmlChar *name, + xmlElementTypeVal type, + xmlElementContentPtr content); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN xmlElementTablePtr XMLCALL + xmlCopyElementTable (xmlElementTablePtr table); +#endif /* LIBXML_TREE_ENABLED */ +XMLPUBFUN void XMLCALL + xmlFreeElementTable (xmlElementTablePtr table); +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void XMLCALL + xmlDumpElementTable (xmlBufferPtr buf, + xmlElementTablePtr table); +XMLPUBFUN void XMLCALL + xmlDumpElementDecl (xmlBufferPtr buf, + xmlElementPtr elem); +#endif /* LIBXML_OUTPUT_ENABLED */ + +/* Enumeration */ +XMLPUBFUN xmlEnumerationPtr XMLCALL + xmlCreateEnumeration (const xmlChar *name); +XMLPUBFUN void XMLCALL + xmlFreeEnumeration (xmlEnumerationPtr cur); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN xmlEnumerationPtr XMLCALL + xmlCopyEnumeration (xmlEnumerationPtr cur); +#endif /* LIBXML_TREE_ENABLED */ + +/* Attribute */ +XMLPUBFUN xmlAttributePtr XMLCALL + xmlAddAttributeDecl (xmlValidCtxtPtr ctxt, + xmlDtdPtr dtd, + const xmlChar *elem, + const xmlChar *name, + const xmlChar *ns, + xmlAttributeType type, + xmlAttributeDefault def, + const xmlChar *defaultValue, + xmlEnumerationPtr tree); +#ifdef LIBXML_TREE_ENABLED +XMLPUBFUN xmlAttributeTablePtr XMLCALL + xmlCopyAttributeTable (xmlAttributeTablePtr table); +#endif /* LIBXML_TREE_ENABLED */ +XMLPUBFUN void XMLCALL + xmlFreeAttributeTable (xmlAttributeTablePtr table); +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void XMLCALL + xmlDumpAttributeTable (xmlBufferPtr buf, + xmlAttributeTablePtr table); +XMLPUBFUN void XMLCALL + xmlDumpAttributeDecl (xmlBufferPtr buf, + xmlAttributePtr attr); +#endif /* LIBXML_OUTPUT_ENABLED */ + +/* IDs */ +XMLPUBFUN xmlIDPtr XMLCALL + xmlAddID (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + const xmlChar *value, + xmlAttrPtr attr); +XMLPUBFUN void XMLCALL + xmlFreeIDTable (xmlIDTablePtr table); +XMLPUBFUN xmlAttrPtr XMLCALL + xmlGetID (xmlDocPtr doc, + const xmlChar *ID); +XMLPUBFUN int XMLCALL + xmlIsID (xmlDocPtr doc, + xmlNodePtr elem, + xmlAttrPtr attr); +XMLPUBFUN int XMLCALL + xmlRemoveID (xmlDocPtr doc, + xmlAttrPtr attr); + +/* IDREFs */ +XMLPUBFUN xmlRefPtr XMLCALL + xmlAddRef (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + const xmlChar *value, + xmlAttrPtr attr); +XMLPUBFUN void XMLCALL + xmlFreeRefTable (xmlRefTablePtr table); +XMLPUBFUN int XMLCALL + xmlIsRef (xmlDocPtr doc, + xmlNodePtr elem, + xmlAttrPtr attr); +XMLPUBFUN int XMLCALL + xmlRemoveRef (xmlDocPtr doc, + xmlAttrPtr attr); +XMLPUBFUN xmlListPtr XMLCALL + xmlGetRefs (xmlDocPtr doc, + const xmlChar *ID); + +/** + * The public function calls related to validity checking. + */ +#ifdef LIBXML_VALID_ENABLED +/* Allocate/Release Validation Contexts */ +XMLPUBFUN xmlValidCtxtPtr XMLCALL + xmlNewValidCtxt(void); +XMLPUBFUN void XMLCALL + xmlFreeValidCtxt(xmlValidCtxtPtr); + +XMLPUBFUN int XMLCALL + xmlValidateRoot (xmlValidCtxtPtr ctxt, + xmlDocPtr doc); +XMLPUBFUN int XMLCALL + xmlValidateElementDecl (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlElementPtr elem); +XMLPUBFUN xmlChar * XMLCALL + xmlValidNormalizeAttributeValue(xmlDocPtr doc, + xmlNodePtr elem, + const xmlChar *name, + const xmlChar *value); +XMLPUBFUN xmlChar * XMLCALL + xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem, + const xmlChar *name, + const xmlChar *value); +XMLPUBFUN int XMLCALL + xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlAttributePtr attr); +XMLPUBFUN int XMLCALL + xmlValidateAttributeValue(xmlAttributeType type, + const xmlChar *value); +XMLPUBFUN int XMLCALL + xmlValidateNotationDecl (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNotationPtr nota); +XMLPUBFUN int XMLCALL + xmlValidateDtd (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlDtdPtr dtd); +XMLPUBFUN int XMLCALL + xmlValidateDtdFinal (xmlValidCtxtPtr ctxt, + xmlDocPtr doc); +XMLPUBFUN int XMLCALL + xmlValidateDocument (xmlValidCtxtPtr ctxt, + xmlDocPtr doc); +XMLPUBFUN int XMLCALL + xmlValidateElement (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem); +XMLPUBFUN int XMLCALL + xmlValidateOneElement (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem); +XMLPUBFUN int XMLCALL + xmlValidateOneAttribute (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem, + xmlAttrPtr attr, + const xmlChar *value); +XMLPUBFUN int XMLCALL + xmlValidateOneNamespace (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem, + const xmlChar *prefix, + xmlNsPtr ns, + const xmlChar *value); +XMLPUBFUN int XMLCALL + xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, + xmlDocPtr doc); +#endif /* LIBXML_VALID_ENABLED */ + +#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +XMLPUBFUN int XMLCALL + xmlValidateNotationUse (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + const xmlChar *notationName); +#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */ + +XMLPUBFUN int XMLCALL + xmlIsMixedElement (xmlDocPtr doc, + const xmlChar *name); +XMLPUBFUN xmlAttributePtr XMLCALL + xmlGetDtdAttrDesc (xmlDtdPtr dtd, + const xmlChar *elem, + const xmlChar *name); +XMLPUBFUN xmlAttributePtr XMLCALL + xmlGetDtdQAttrDesc (xmlDtdPtr dtd, + const xmlChar *elem, + const xmlChar *name, + const xmlChar *prefix); +XMLPUBFUN xmlNotationPtr XMLCALL + xmlGetDtdNotationDesc (xmlDtdPtr dtd, + const xmlChar *name); +XMLPUBFUN xmlElementPtr XMLCALL + xmlGetDtdQElementDesc (xmlDtdPtr dtd, + const xmlChar *name, + const xmlChar *prefix); +XMLPUBFUN xmlElementPtr XMLCALL + xmlGetDtdElementDesc (xmlDtdPtr dtd, + const xmlChar *name); + +#ifdef LIBXML_VALID_ENABLED + +XMLPUBFUN int XMLCALL + xmlValidGetPotentialChildren(xmlElementContent *ctree, + const xmlChar **names, + int *len, + int max); + +XMLPUBFUN int XMLCALL + xmlValidGetValidElements(xmlNode *prev, + xmlNode *next, + const xmlChar **names, + int max); +XMLPUBFUN int XMLCALL + xmlValidateNameValue (const xmlChar *value); +XMLPUBFUN int XMLCALL + xmlValidateNamesValue (const xmlChar *value); +XMLPUBFUN int XMLCALL + xmlValidateNmtokenValue (const xmlChar *value); +XMLPUBFUN int XMLCALL + xmlValidateNmtokensValue(const xmlChar *value); + +#ifdef LIBXML_REGEXP_ENABLED +/* + * Validation based on the regexp support + */ +XMLPUBFUN int XMLCALL + xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, + xmlElementPtr elem); + +XMLPUBFUN int XMLCALL + xmlValidatePushElement (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem, + const xmlChar *qname); +XMLPUBFUN int XMLCALL + xmlValidatePushCData (xmlValidCtxtPtr ctxt, + const xmlChar *data, + int len); +XMLPUBFUN int XMLCALL + xmlValidatePopElement (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem, + const xmlChar *qname); +#endif /* LIBXML_REGEXP_ENABLED */ +#endif /* LIBXML_VALID_ENABLED */ +#ifdef __cplusplus +} +#endif +#endif /* __XML_VALID_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xinclude.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xinclude.h new file mode 100644 index 0000000..863ab25 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xinclude.h @@ -0,0 +1,129 @@ +/* + * Summary: implementation of XInclude + * Description: API to handle XInclude processing, + * implements the + * World Wide Web Consortium Last Call Working Draft 10 November 2003 + * http://www.w3.org/TR/2003/WD-xinclude-20031110 + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XINCLUDE_H__ +#define __XML_XINCLUDE_H__ + +#include +#include + +#ifdef LIBXML_XINCLUDE_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * XINCLUDE_NS: + * + * Macro defining the Xinclude namespace: http://www.w3.org/2003/XInclude + */ +#define XINCLUDE_NS (const xmlChar *) "http://www.w3.org/2003/XInclude" +/** + * XINCLUDE_OLD_NS: + * + * Macro defining the draft Xinclude namespace: http://www.w3.org/2001/XInclude + */ +#define XINCLUDE_OLD_NS (const xmlChar *) "http://www.w3.org/2001/XInclude" +/** + * XINCLUDE_NODE: + * + * Macro defining "include" + */ +#define XINCLUDE_NODE (const xmlChar *) "include" +/** + * XINCLUDE_FALLBACK: + * + * Macro defining "fallback" + */ +#define XINCLUDE_FALLBACK (const xmlChar *) "fallback" +/** + * XINCLUDE_HREF: + * + * Macro defining "href" + */ +#define XINCLUDE_HREF (const xmlChar *) "href" +/** + * XINCLUDE_PARSE: + * + * Macro defining "parse" + */ +#define XINCLUDE_PARSE (const xmlChar *) "parse" +/** + * XINCLUDE_PARSE_XML: + * + * Macro defining "xml" + */ +#define XINCLUDE_PARSE_XML (const xmlChar *) "xml" +/** + * XINCLUDE_PARSE_TEXT: + * + * Macro defining "text" + */ +#define XINCLUDE_PARSE_TEXT (const xmlChar *) "text" +/** + * XINCLUDE_PARSE_ENCODING: + * + * Macro defining "encoding" + */ +#define XINCLUDE_PARSE_ENCODING (const xmlChar *) "encoding" +/** + * XINCLUDE_PARSE_XPOINTER: + * + * Macro defining "xpointer" + */ +#define XINCLUDE_PARSE_XPOINTER (const xmlChar *) "xpointer" + +typedef struct _xmlXIncludeCtxt xmlXIncludeCtxt; +typedef xmlXIncludeCtxt *xmlXIncludeCtxtPtr; + +/* + * standalone processing + */ +XMLPUBFUN int XMLCALL + xmlXIncludeProcess (xmlDocPtr doc); +XMLPUBFUN int XMLCALL + xmlXIncludeProcessFlags (xmlDocPtr doc, + int flags); +XMLPUBFUN int XMLCALL + xmlXIncludeProcessFlagsData(xmlDocPtr doc, + int flags, + void *data); +XMLPUBFUN int XMLCALL + xmlXIncludeProcessTreeFlagsData(xmlNodePtr tree, + int flags, + void *data); +XMLPUBFUN int XMLCALL + xmlXIncludeProcessTree (xmlNodePtr tree); +XMLPUBFUN int XMLCALL + xmlXIncludeProcessTreeFlags(xmlNodePtr tree, + int flags); +/* + * contextual processing + */ +XMLPUBFUN xmlXIncludeCtxtPtr XMLCALL + xmlXIncludeNewContext (xmlDocPtr doc); +XMLPUBFUN int XMLCALL + xmlXIncludeSetFlags (xmlXIncludeCtxtPtr ctxt, + int flags); +XMLPUBFUN void XMLCALL + xmlXIncludeFreeContext (xmlXIncludeCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlXIncludeProcessNode (xmlXIncludeCtxtPtr ctxt, + xmlNodePtr tree); +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_XINCLUDE_ENABLED */ + +#endif /* __XML_XINCLUDE_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xlink.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xlink.h new file mode 100644 index 0000000..a209a99 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xlink.h @@ -0,0 +1,189 @@ +/* + * Summary: unfinished XLink detection module + * Description: unfinished XLink detection module + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XLINK_H__ +#define __XML_XLINK_H__ + +#include +#include + +#ifdef LIBXML_XPTR_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Various defines for the various Link properties. + * + * NOTE: the link detection layer will try to resolve QName expansion + * of namespaces. If "foo" is the prefix for "http://foo.com/" + * then the link detection layer will expand role="foo:myrole" + * to "http://foo.com/:myrole". + * NOTE: the link detection layer will expand URI-Refences found on + * href attributes by using the base mechanism if found. + */ +typedef xmlChar *xlinkHRef; +typedef xmlChar *xlinkRole; +typedef xmlChar *xlinkTitle; + +typedef enum { + XLINK_TYPE_NONE = 0, + XLINK_TYPE_SIMPLE, + XLINK_TYPE_EXTENDED, + XLINK_TYPE_EXTENDED_SET +} xlinkType; + +typedef enum { + XLINK_SHOW_NONE = 0, + XLINK_SHOW_NEW, + XLINK_SHOW_EMBED, + XLINK_SHOW_REPLACE +} xlinkShow; + +typedef enum { + XLINK_ACTUATE_NONE = 0, + XLINK_ACTUATE_AUTO, + XLINK_ACTUATE_ONREQUEST +} xlinkActuate; + +/** + * xlinkNodeDetectFunc: + * @ctx: user data pointer + * @node: the node to check + * + * This is the prototype for the link detection routine. + * It calls the default link detection callbacks upon link detection. + */ +typedef void (*xlinkNodeDetectFunc) (void *ctx, xmlNodePtr node); + +/* + * The link detection module interact with the upper layers using + * a set of callback registered at parsing time. + */ + +/** + * xlinkSimpleLinkFunk: + * @ctx: user data pointer + * @node: the node carrying the link + * @href: the target of the link + * @role: the role string + * @title: the link title + * + * This is the prototype for a simple link detection callback. + */ +typedef void +(*xlinkSimpleLinkFunk) (void *ctx, + xmlNodePtr node, + const xlinkHRef href, + const xlinkRole role, + const xlinkTitle title); + +/** + * xlinkExtendedLinkFunk: + * @ctx: user data pointer + * @node: the node carrying the link + * @nbLocators: the number of locators detected on the link + * @hrefs: pointer to the array of locator hrefs + * @roles: pointer to the array of locator roles + * @nbArcs: the number of arcs detected on the link + * @from: pointer to the array of source roles found on the arcs + * @to: pointer to the array of target roles found on the arcs + * @show: array of values for the show attributes found on the arcs + * @actuate: array of values for the actuate attributes found on the arcs + * @nbTitles: the number of titles detected on the link + * @title: array of titles detected on the link + * @langs: array of xml:lang values for the titles + * + * This is the prototype for a extended link detection callback. + */ +typedef void +(*xlinkExtendedLinkFunk)(void *ctx, + xmlNodePtr node, + int nbLocators, + const xlinkHRef *hrefs, + const xlinkRole *roles, + int nbArcs, + const xlinkRole *from, + const xlinkRole *to, + xlinkShow *show, + xlinkActuate *actuate, + int nbTitles, + const xlinkTitle *titles, + const xmlChar **langs); + +/** + * xlinkExtendedLinkSetFunk: + * @ctx: user data pointer + * @node: the node carrying the link + * @nbLocators: the number of locators detected on the link + * @hrefs: pointer to the array of locator hrefs + * @roles: pointer to the array of locator roles + * @nbTitles: the number of titles detected on the link + * @title: array of titles detected on the link + * @langs: array of xml:lang values for the titles + * + * This is the prototype for a extended link set detection callback. + */ +typedef void +(*xlinkExtendedLinkSetFunk) (void *ctx, + xmlNodePtr node, + int nbLocators, + const xlinkHRef *hrefs, + const xlinkRole *roles, + int nbTitles, + const xlinkTitle *titles, + const xmlChar **langs); + +/** + * This is the structure containing a set of Links detection callbacks. + * + * There is no default xlink callbacks, if one want to get link + * recognition activated, those call backs must be provided before parsing. + */ +typedef struct _xlinkHandler xlinkHandler; +typedef xlinkHandler *xlinkHandlerPtr; +struct _xlinkHandler { + xlinkSimpleLinkFunk simple; + xlinkExtendedLinkFunk extended; + xlinkExtendedLinkSetFunk set; +}; + +/* + * The default detection routine, can be overridden, they call the default + * detection callbacks. + */ + +XMLPUBFUN xlinkNodeDetectFunc XMLCALL + xlinkGetDefaultDetect (void); +XMLPUBFUN void XMLCALL + xlinkSetDefaultDetect (xlinkNodeDetectFunc func); + +/* + * Routines to set/get the default handlers. + */ +XMLPUBFUN xlinkHandlerPtr XMLCALL + xlinkGetDefaultHandler (void); +XMLPUBFUN void XMLCALL + xlinkSetDefaultHandler (xlinkHandlerPtr handler); + +/* + * Link detection module itself. + */ +XMLPUBFUN xlinkType XMLCALL + xlinkIsLink (xmlDocPtr doc, + xmlNodePtr node); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_XPTR_ENABLED */ + +#endif /* __XML_XLINK_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlIO.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlIO.h new file mode 100644 index 0000000..3e41744 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlIO.h @@ -0,0 +1,366 @@ +/* + * Summary: interface for the I/O interfaces used by the parser + * Description: interface for the I/O interfaces used by the parser + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_IO_H__ +#define __XML_IO_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Those are the functions and datatypes for the parser input + * I/O structures. + */ + +/** + * xmlInputMatchCallback: + * @filename: the filename or URI + * + * Callback used in the I/O Input API to detect if the current handler + * can provide input fonctionnalities for this resource. + * + * Returns 1 if yes and 0 if another Input module should be used + */ +typedef int (XMLCALL *xmlInputMatchCallback) (char const *filename); +/** + * xmlInputOpenCallback: + * @filename: the filename or URI + * + * Callback used in the I/O Input API to open the resource + * + * Returns an Input context or NULL in case or error + */ +typedef void * (XMLCALL *xmlInputOpenCallback) (char const *filename); +/** + * xmlInputReadCallback: + * @context: an Input context + * @buffer: the buffer to store data read + * @len: the length of the buffer in bytes + * + * Callback used in the I/O Input API to read the resource + * + * Returns the number of bytes read or -1 in case of error + */ +typedef int (XMLCALL *xmlInputReadCallback) (void * context, char * buffer, int len); +/** + * xmlInputCloseCallback: + * @context: an Input context + * + * Callback used in the I/O Input API to close the resource + * + * Returns 0 or -1 in case of error + */ +typedef int (XMLCALL *xmlInputCloseCallback) (void * context); + +#ifdef LIBXML_OUTPUT_ENABLED +/* + * Those are the functions and datatypes for the library output + * I/O structures. + */ + +/** + * xmlOutputMatchCallback: + * @filename: the filename or URI + * + * Callback used in the I/O Output API to detect if the current handler + * can provide output fonctionnalities for this resource. + * + * Returns 1 if yes and 0 if another Output module should be used + */ +typedef int (XMLCALL *xmlOutputMatchCallback) (char const *filename); +/** + * xmlOutputOpenCallback: + * @filename: the filename or URI + * + * Callback used in the I/O Output API to open the resource + * + * Returns an Output context or NULL in case or error + */ +typedef void * (XMLCALL *xmlOutputOpenCallback) (char const *filename); +/** + * xmlOutputWriteCallback: + * @context: an Output context + * @buffer: the buffer of data to write + * @len: the length of the buffer in bytes + * + * Callback used in the I/O Output API to write to the resource + * + * Returns the number of bytes written or -1 in case of error + */ +typedef int (XMLCALL *xmlOutputWriteCallback) (void * context, const char * buffer, + int len); +/** + * xmlOutputCloseCallback: + * @context: an Output context + * + * Callback used in the I/O Output API to close the resource + * + * Returns 0 or -1 in case of error + */ +typedef int (XMLCALL *xmlOutputCloseCallback) (void * context); +#endif /* LIBXML_OUTPUT_ENABLED */ + +#ifdef __cplusplus +} +#endif + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif +struct _xmlParserInputBuffer { + void* context; + xmlInputReadCallback readcallback; + xmlInputCloseCallback closecallback; + + xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */ + + xmlBufPtr buffer; /* Local buffer encoded in UTF-8 */ + xmlBufPtr raw; /* if encoder != NULL buffer for raw input */ + int compressed; /* -1=unknown, 0=not compressed, 1=compressed */ + int error; + unsigned long rawconsumed;/* amount consumed from raw */ +}; + + +#ifdef LIBXML_OUTPUT_ENABLED +struct _xmlOutputBuffer { + void* context; + xmlOutputWriteCallback writecallback; + xmlOutputCloseCallback closecallback; + + xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */ + + xmlBufPtr buffer; /* Local buffer encoded in UTF-8 or ISOLatin */ + xmlBufPtr conv; /* if encoder != NULL buffer for output */ + int written; /* total number of byte written */ + int error; +}; +#endif /* LIBXML_OUTPUT_ENABLED */ + +/* + * Interfaces for input + */ +XMLPUBFUN void XMLCALL + xmlCleanupInputCallbacks (void); + +XMLPUBFUN int XMLCALL + xmlPopInputCallbacks (void); + +XMLPUBFUN void XMLCALL + xmlRegisterDefaultInputCallbacks (void); +XMLPUBFUN xmlParserInputBufferPtr XMLCALL + xmlAllocParserInputBuffer (xmlCharEncoding enc); + +XMLPUBFUN xmlParserInputBufferPtr XMLCALL + xmlParserInputBufferCreateFilename (const char *URI, + xmlCharEncoding enc); +XMLPUBFUN xmlParserInputBufferPtr XMLCALL + xmlParserInputBufferCreateFile (FILE *file, + xmlCharEncoding enc); +XMLPUBFUN xmlParserInputBufferPtr XMLCALL + xmlParserInputBufferCreateFd (int fd, + xmlCharEncoding enc); +XMLPUBFUN xmlParserInputBufferPtr XMLCALL + xmlParserInputBufferCreateMem (const char *mem, int size, + xmlCharEncoding enc); +XMLPUBFUN xmlParserInputBufferPtr XMLCALL + xmlParserInputBufferCreateStatic (const char *mem, int size, + xmlCharEncoding enc); +XMLPUBFUN xmlParserInputBufferPtr XMLCALL + xmlParserInputBufferCreateIO (xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + xmlCharEncoding enc); +XMLPUBFUN int XMLCALL + xmlParserInputBufferRead (xmlParserInputBufferPtr in, + int len); +XMLPUBFUN int XMLCALL + xmlParserInputBufferGrow (xmlParserInputBufferPtr in, + int len); +XMLPUBFUN int XMLCALL + xmlParserInputBufferPush (xmlParserInputBufferPtr in, + int len, + const char *buf); +XMLPUBFUN void XMLCALL + xmlFreeParserInputBuffer (xmlParserInputBufferPtr in); +XMLPUBFUN char * XMLCALL + xmlParserGetDirectory (const char *filename); + +XMLPUBFUN int XMLCALL + xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc, + xmlInputOpenCallback openFunc, + xmlInputReadCallback readFunc, + xmlInputCloseCallback closeFunc); + +xmlParserInputBufferPtr + __xmlParserInputBufferCreateFilename(const char *URI, + xmlCharEncoding enc); + +#ifdef LIBXML_OUTPUT_ENABLED +/* + * Interfaces for output + */ +XMLPUBFUN void XMLCALL + xmlCleanupOutputCallbacks (void); +XMLPUBFUN void XMLCALL + xmlRegisterDefaultOutputCallbacks(void); +XMLPUBFUN xmlOutputBufferPtr XMLCALL + xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder); + +XMLPUBFUN xmlOutputBufferPtr XMLCALL + xmlOutputBufferCreateFilename (const char *URI, + xmlCharEncodingHandlerPtr encoder, + int compression); + +XMLPUBFUN xmlOutputBufferPtr XMLCALL + xmlOutputBufferCreateFile (FILE *file, + xmlCharEncodingHandlerPtr encoder); + +XMLPUBFUN xmlOutputBufferPtr XMLCALL + xmlOutputBufferCreateBuffer (xmlBufferPtr buffer, + xmlCharEncodingHandlerPtr encoder); + +XMLPUBFUN xmlOutputBufferPtr XMLCALL + xmlOutputBufferCreateFd (int fd, + xmlCharEncodingHandlerPtr encoder); + +XMLPUBFUN xmlOutputBufferPtr XMLCALL + xmlOutputBufferCreateIO (xmlOutputWriteCallback iowrite, + xmlOutputCloseCallback ioclose, + void *ioctx, + xmlCharEncodingHandlerPtr encoder); + +/* Couple of APIs to get the output without digging into the buffers */ +XMLPUBFUN const xmlChar * XMLCALL + xmlOutputBufferGetContent (xmlOutputBufferPtr out); +XMLPUBFUN size_t XMLCALL + xmlOutputBufferGetSize (xmlOutputBufferPtr out); + +XMLPUBFUN int XMLCALL + xmlOutputBufferWrite (xmlOutputBufferPtr out, + int len, + const char *buf); +XMLPUBFUN int XMLCALL + xmlOutputBufferWriteString (xmlOutputBufferPtr out, + const char *str); +XMLPUBFUN int XMLCALL + xmlOutputBufferWriteEscape (xmlOutputBufferPtr out, + const xmlChar *str, + xmlCharEncodingOutputFunc escaping); + +XMLPUBFUN int XMLCALL + xmlOutputBufferFlush (xmlOutputBufferPtr out); +XMLPUBFUN int XMLCALL + xmlOutputBufferClose (xmlOutputBufferPtr out); + +XMLPUBFUN int XMLCALL + xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc, + xmlOutputOpenCallback openFunc, + xmlOutputWriteCallback writeFunc, + xmlOutputCloseCallback closeFunc); + +xmlOutputBufferPtr + __xmlOutputBufferCreateFilename(const char *URI, + xmlCharEncodingHandlerPtr encoder, + int compression); + +#ifdef LIBXML_HTTP_ENABLED +/* This function only exists if HTTP support built into the library */ +XMLPUBFUN void XMLCALL + xmlRegisterHTTPPostCallbacks (void ); +#endif /* LIBXML_HTTP_ENABLED */ + +#endif /* LIBXML_OUTPUT_ENABLED */ + +XMLPUBFUN xmlParserInputPtr XMLCALL + xmlCheckHTTPInput (xmlParserCtxtPtr ctxt, + xmlParserInputPtr ret); + +/* + * A predefined entity loader disabling network accesses + */ +XMLPUBFUN xmlParserInputPtr XMLCALL + xmlNoNetExternalEntityLoader (const char *URL, + const char *ID, + xmlParserCtxtPtr ctxt); + +/* + * xmlNormalizeWindowsPath is obsolete, don't use it. + * Check xmlCanonicPath in uri.h for a better alternative. + */ +XMLPUBFUN xmlChar * XMLCALL + xmlNormalizeWindowsPath (const xmlChar *path); + +XMLPUBFUN int XMLCALL + xmlCheckFilename (const char *path); +/** + * Default 'file://' protocol callbacks + */ +XMLPUBFUN int XMLCALL + xmlFileMatch (const char *filename); +XMLPUBFUN void * XMLCALL + xmlFileOpen (const char *filename); +XMLPUBFUN int XMLCALL + xmlFileRead (void * context, + char * buffer, + int len); +XMLPUBFUN int XMLCALL + xmlFileClose (void * context); + +/** + * Default 'http://' protocol callbacks + */ +#ifdef LIBXML_HTTP_ENABLED +XMLPUBFUN int XMLCALL + xmlIOHTTPMatch (const char *filename); +XMLPUBFUN void * XMLCALL + xmlIOHTTPOpen (const char *filename); +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void * XMLCALL + xmlIOHTTPOpenW (const char * post_uri, + int compression ); +#endif /* LIBXML_OUTPUT_ENABLED */ +XMLPUBFUN int XMLCALL + xmlIOHTTPRead (void * context, + char * buffer, + int len); +XMLPUBFUN int XMLCALL + xmlIOHTTPClose (void * context); +#endif /* LIBXML_HTTP_ENABLED */ + +/** + * Default 'ftp://' protocol callbacks + */ +#ifdef LIBXML_FTP_ENABLED +XMLPUBFUN int XMLCALL + xmlIOFTPMatch (const char *filename); +XMLPUBFUN void * XMLCALL + xmlIOFTPOpen (const char *filename); +XMLPUBFUN int XMLCALL + xmlIOFTPRead (void * context, + char * buffer, + int len); +XMLPUBFUN int XMLCALL + xmlIOFTPClose (void * context); +#endif /* LIBXML_FTP_ENABLED */ + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_IO_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlautomata.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlautomata.h new file mode 100644 index 0000000..bf1b131 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlautomata.h @@ -0,0 +1,146 @@ +/* + * Summary: API to build regexp automata + * Description: the API to build regexp automata + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_AUTOMATA_H__ +#define __XML_AUTOMATA_H__ + +#include +#include + +#ifdef LIBXML_REGEXP_ENABLED +#ifdef LIBXML_AUTOMATA_ENABLED +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlAutomataPtr: + * + * A libxml automata description, It can be compiled into a regexp + */ +typedef struct _xmlAutomata xmlAutomata; +typedef xmlAutomata *xmlAutomataPtr; + +/** + * xmlAutomataStatePtr: + * + * A state int the automata description, + */ +typedef struct _xmlAutomataState xmlAutomataState; +typedef xmlAutomataState *xmlAutomataStatePtr; + +/* + * Building API + */ +XMLPUBFUN xmlAutomataPtr XMLCALL + xmlNewAutomata (void); +XMLPUBFUN void XMLCALL + xmlFreeAutomata (xmlAutomataPtr am); + +XMLPUBFUN xmlAutomataStatePtr XMLCALL + xmlAutomataGetInitState (xmlAutomataPtr am); +XMLPUBFUN int XMLCALL + xmlAutomataSetFinalState (xmlAutomataPtr am, + xmlAutomataStatePtr state); +XMLPUBFUN xmlAutomataStatePtr XMLCALL + xmlAutomataNewState (xmlAutomataPtr am); +XMLPUBFUN xmlAutomataStatePtr XMLCALL + xmlAutomataNewTransition (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + const xmlChar *token, + void *data); +XMLPUBFUN xmlAutomataStatePtr XMLCALL + xmlAutomataNewTransition2 (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + const xmlChar *token, + const xmlChar *token2, + void *data); +XMLPUBFUN xmlAutomataStatePtr XMLCALL + xmlAutomataNewNegTrans (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + const xmlChar *token, + const xmlChar *token2, + void *data); + +XMLPUBFUN xmlAutomataStatePtr XMLCALL + xmlAutomataNewCountTrans (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + const xmlChar *token, + int min, + int max, + void *data); +XMLPUBFUN xmlAutomataStatePtr XMLCALL + xmlAutomataNewCountTrans2 (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + const xmlChar *token, + const xmlChar *token2, + int min, + int max, + void *data); +XMLPUBFUN xmlAutomataStatePtr XMLCALL + xmlAutomataNewOnceTrans (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + const xmlChar *token, + int min, + int max, + void *data); +XMLPUBFUN xmlAutomataStatePtr XMLCALL + xmlAutomataNewOnceTrans2 (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + const xmlChar *token, + const xmlChar *token2, + int min, + int max, + void *data); +XMLPUBFUN xmlAutomataStatePtr XMLCALL + xmlAutomataNewAllTrans (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + int lax); +XMLPUBFUN xmlAutomataStatePtr XMLCALL + xmlAutomataNewEpsilon (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to); +XMLPUBFUN xmlAutomataStatePtr XMLCALL + xmlAutomataNewCountedTrans (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + int counter); +XMLPUBFUN xmlAutomataStatePtr XMLCALL + xmlAutomataNewCounterTrans (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + int counter); +XMLPUBFUN int XMLCALL + xmlAutomataNewCounter (xmlAutomataPtr am, + int min, + int max); + +XMLPUBFUN xmlRegexpPtr XMLCALL + xmlAutomataCompile (xmlAutomataPtr am); +XMLPUBFUN int XMLCALL + xmlAutomataIsDeterminist (xmlAutomataPtr am); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_AUTOMATA_ENABLED */ +#endif /* LIBXML_REGEXP_ENABLED */ + +#endif /* __XML_AUTOMATA_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlerror.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlerror.h new file mode 100644 index 0000000..037c16d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlerror.h @@ -0,0 +1,945 @@ +/* + * Summary: error handling + * Description: the API used to report errors + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#include + +#ifndef __XML_ERROR_H__ +#define __XML_ERROR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlErrorLevel: + * + * Indicates the level of an error + */ +typedef enum { + XML_ERR_NONE = 0, + XML_ERR_WARNING = 1, /* A simple warning */ + XML_ERR_ERROR = 2, /* A recoverable error */ + XML_ERR_FATAL = 3 /* A fatal error */ +} xmlErrorLevel; + +/** + * xmlErrorDomain: + * + * Indicates where an error may have come from + */ +typedef enum { + XML_FROM_NONE = 0, + XML_FROM_PARSER, /* The XML parser */ + XML_FROM_TREE, /* The tree module */ + XML_FROM_NAMESPACE, /* The XML Namespace module */ + XML_FROM_DTD, /* The XML DTD validation with parser context*/ + XML_FROM_HTML, /* The HTML parser */ + XML_FROM_MEMORY, /* The memory allocator */ + XML_FROM_OUTPUT, /* The serialization code */ + XML_FROM_IO, /* The Input/Output stack */ + XML_FROM_FTP, /* The FTP module */ + XML_FROM_HTTP, /* The HTTP module */ + XML_FROM_XINCLUDE, /* The XInclude processing */ + XML_FROM_XPATH, /* The XPath module */ + XML_FROM_XPOINTER, /* The XPointer module */ + XML_FROM_REGEXP, /* The regular expressions module */ + XML_FROM_DATATYPE, /* The W3C XML Schemas Datatype module */ + XML_FROM_SCHEMASP, /* The W3C XML Schemas parser module */ + XML_FROM_SCHEMASV, /* The W3C XML Schemas validation module */ + XML_FROM_RELAXNGP, /* The Relax-NG parser module */ + XML_FROM_RELAXNGV, /* The Relax-NG validator module */ + XML_FROM_CATALOG, /* The Catalog module */ + XML_FROM_C14N, /* The Canonicalization module */ + XML_FROM_XSLT, /* The XSLT engine from libxslt */ + XML_FROM_VALID, /* The XML DTD validation with valid context */ + XML_FROM_CHECK, /* The error checking module */ + XML_FROM_WRITER, /* The xmlwriter module */ + XML_FROM_MODULE, /* The dynamically loaded module module*/ + XML_FROM_I18N, /* The module handling character conversion */ + XML_FROM_SCHEMATRONV,/* The Schematron validator module */ + XML_FROM_BUFFER, /* The buffers module */ + XML_FROM_URI /* The URI module */ +} xmlErrorDomain; + +/** + * xmlError: + * + * An XML Error instance. + */ + +typedef struct _xmlError xmlError; +typedef xmlError *xmlErrorPtr; +struct _xmlError { + int domain; /* What part of the library raised this error */ + int code; /* The error code, e.g. an xmlParserError */ + char *message;/* human-readable informative error message */ + xmlErrorLevel level;/* how consequent is the error */ + char *file; /* the filename */ + int line; /* the line number if available */ + char *str1; /* extra string information */ + char *str2; /* extra string information */ + char *str3; /* extra string information */ + int int1; /* extra number information */ + int int2; /* error column # or 0 if N/A (todo: rename field when we would brk ABI) */ + void *ctxt; /* the parser context if available */ + void *node; /* the node in the tree */ +}; + +/** + * xmlParserError: + * + * This is an error that the XML (or HTML) parser can generate + */ +typedef enum { + XML_ERR_OK = 0, + XML_ERR_INTERNAL_ERROR, /* 1 */ + XML_ERR_NO_MEMORY, /* 2 */ + XML_ERR_DOCUMENT_START, /* 3 */ + XML_ERR_DOCUMENT_EMPTY, /* 4 */ + XML_ERR_DOCUMENT_END, /* 5 */ + XML_ERR_INVALID_HEX_CHARREF, /* 6 */ + XML_ERR_INVALID_DEC_CHARREF, /* 7 */ + XML_ERR_INVALID_CHARREF, /* 8 */ + XML_ERR_INVALID_CHAR, /* 9 */ + XML_ERR_CHARREF_AT_EOF, /* 10 */ + XML_ERR_CHARREF_IN_PROLOG, /* 11 */ + XML_ERR_CHARREF_IN_EPILOG, /* 12 */ + XML_ERR_CHARREF_IN_DTD, /* 13 */ + XML_ERR_ENTITYREF_AT_EOF, /* 14 */ + XML_ERR_ENTITYREF_IN_PROLOG, /* 15 */ + XML_ERR_ENTITYREF_IN_EPILOG, /* 16 */ + XML_ERR_ENTITYREF_IN_DTD, /* 17 */ + XML_ERR_PEREF_AT_EOF, /* 18 */ + XML_ERR_PEREF_IN_PROLOG, /* 19 */ + XML_ERR_PEREF_IN_EPILOG, /* 20 */ + XML_ERR_PEREF_IN_INT_SUBSET, /* 21 */ + XML_ERR_ENTITYREF_NO_NAME, /* 22 */ + XML_ERR_ENTITYREF_SEMICOL_MISSING, /* 23 */ + XML_ERR_PEREF_NO_NAME, /* 24 */ + XML_ERR_PEREF_SEMICOL_MISSING, /* 25 */ + XML_ERR_UNDECLARED_ENTITY, /* 26 */ + XML_WAR_UNDECLARED_ENTITY, /* 27 */ + XML_ERR_UNPARSED_ENTITY, /* 28 */ + XML_ERR_ENTITY_IS_EXTERNAL, /* 29 */ + XML_ERR_ENTITY_IS_PARAMETER, /* 30 */ + XML_ERR_UNKNOWN_ENCODING, /* 31 */ + XML_ERR_UNSUPPORTED_ENCODING, /* 32 */ + XML_ERR_STRING_NOT_STARTED, /* 33 */ + XML_ERR_STRING_NOT_CLOSED, /* 34 */ + XML_ERR_NS_DECL_ERROR, /* 35 */ + XML_ERR_ENTITY_NOT_STARTED, /* 36 */ + XML_ERR_ENTITY_NOT_FINISHED, /* 37 */ + XML_ERR_LT_IN_ATTRIBUTE, /* 38 */ + XML_ERR_ATTRIBUTE_NOT_STARTED, /* 39 */ + XML_ERR_ATTRIBUTE_NOT_FINISHED, /* 40 */ + XML_ERR_ATTRIBUTE_WITHOUT_VALUE, /* 41 */ + XML_ERR_ATTRIBUTE_REDEFINED, /* 42 */ + XML_ERR_LITERAL_NOT_STARTED, /* 43 */ + XML_ERR_LITERAL_NOT_FINISHED, /* 44 */ + XML_ERR_COMMENT_NOT_FINISHED, /* 45 */ + XML_ERR_PI_NOT_STARTED, /* 46 */ + XML_ERR_PI_NOT_FINISHED, /* 47 */ + XML_ERR_NOTATION_NOT_STARTED, /* 48 */ + XML_ERR_NOTATION_NOT_FINISHED, /* 49 */ + XML_ERR_ATTLIST_NOT_STARTED, /* 50 */ + XML_ERR_ATTLIST_NOT_FINISHED, /* 51 */ + XML_ERR_MIXED_NOT_STARTED, /* 52 */ + XML_ERR_MIXED_NOT_FINISHED, /* 53 */ + XML_ERR_ELEMCONTENT_NOT_STARTED, /* 54 */ + XML_ERR_ELEMCONTENT_NOT_FINISHED, /* 55 */ + XML_ERR_XMLDECL_NOT_STARTED, /* 56 */ + XML_ERR_XMLDECL_NOT_FINISHED, /* 57 */ + XML_ERR_CONDSEC_NOT_STARTED, /* 58 */ + XML_ERR_CONDSEC_NOT_FINISHED, /* 59 */ + XML_ERR_EXT_SUBSET_NOT_FINISHED, /* 60 */ + XML_ERR_DOCTYPE_NOT_FINISHED, /* 61 */ + XML_ERR_MISPLACED_CDATA_END, /* 62 */ + XML_ERR_CDATA_NOT_FINISHED, /* 63 */ + XML_ERR_RESERVED_XML_NAME, /* 64 */ + XML_ERR_SPACE_REQUIRED, /* 65 */ + XML_ERR_SEPARATOR_REQUIRED, /* 66 */ + XML_ERR_NMTOKEN_REQUIRED, /* 67 */ + XML_ERR_NAME_REQUIRED, /* 68 */ + XML_ERR_PCDATA_REQUIRED, /* 69 */ + XML_ERR_URI_REQUIRED, /* 70 */ + XML_ERR_PUBID_REQUIRED, /* 71 */ + XML_ERR_LT_REQUIRED, /* 72 */ + XML_ERR_GT_REQUIRED, /* 73 */ + XML_ERR_LTSLASH_REQUIRED, /* 74 */ + XML_ERR_EQUAL_REQUIRED, /* 75 */ + XML_ERR_TAG_NAME_MISMATCH, /* 76 */ + XML_ERR_TAG_NOT_FINISHED, /* 77 */ + XML_ERR_STANDALONE_VALUE, /* 78 */ + XML_ERR_ENCODING_NAME, /* 79 */ + XML_ERR_HYPHEN_IN_COMMENT, /* 80 */ + XML_ERR_INVALID_ENCODING, /* 81 */ + XML_ERR_EXT_ENTITY_STANDALONE, /* 82 */ + XML_ERR_CONDSEC_INVALID, /* 83 */ + XML_ERR_VALUE_REQUIRED, /* 84 */ + XML_ERR_NOT_WELL_BALANCED, /* 85 */ + XML_ERR_EXTRA_CONTENT, /* 86 */ + XML_ERR_ENTITY_CHAR_ERROR, /* 87 */ + XML_ERR_ENTITY_PE_INTERNAL, /* 88 */ + XML_ERR_ENTITY_LOOP, /* 89 */ + XML_ERR_ENTITY_BOUNDARY, /* 90 */ + XML_ERR_INVALID_URI, /* 91 */ + XML_ERR_URI_FRAGMENT, /* 92 */ + XML_WAR_CATALOG_PI, /* 93 */ + XML_ERR_NO_DTD, /* 94 */ + XML_ERR_CONDSEC_INVALID_KEYWORD, /* 95 */ + XML_ERR_VERSION_MISSING, /* 96 */ + XML_WAR_UNKNOWN_VERSION, /* 97 */ + XML_WAR_LANG_VALUE, /* 98 */ + XML_WAR_NS_URI, /* 99 */ + XML_WAR_NS_URI_RELATIVE, /* 100 */ + XML_ERR_MISSING_ENCODING, /* 101 */ + XML_WAR_SPACE_VALUE, /* 102 */ + XML_ERR_NOT_STANDALONE, /* 103 */ + XML_ERR_ENTITY_PROCESSING, /* 104 */ + XML_ERR_NOTATION_PROCESSING, /* 105 */ + XML_WAR_NS_COLUMN, /* 106 */ + XML_WAR_ENTITY_REDEFINED, /* 107 */ + XML_ERR_UNKNOWN_VERSION, /* 108 */ + XML_ERR_VERSION_MISMATCH, /* 109 */ + XML_ERR_NAME_TOO_LONG, /* 110 */ + XML_ERR_USER_STOP, /* 111 */ + XML_NS_ERR_XML_NAMESPACE = 200, + XML_NS_ERR_UNDEFINED_NAMESPACE, /* 201 */ + XML_NS_ERR_QNAME, /* 202 */ + XML_NS_ERR_ATTRIBUTE_REDEFINED, /* 203 */ + XML_NS_ERR_EMPTY, /* 204 */ + XML_NS_ERR_COLON, /* 205 */ + XML_DTD_ATTRIBUTE_DEFAULT = 500, + XML_DTD_ATTRIBUTE_REDEFINED, /* 501 */ + XML_DTD_ATTRIBUTE_VALUE, /* 502 */ + XML_DTD_CONTENT_ERROR, /* 503 */ + XML_DTD_CONTENT_MODEL, /* 504 */ + XML_DTD_CONTENT_NOT_DETERMINIST, /* 505 */ + XML_DTD_DIFFERENT_PREFIX, /* 506 */ + XML_DTD_ELEM_DEFAULT_NAMESPACE, /* 507 */ + XML_DTD_ELEM_NAMESPACE, /* 508 */ + XML_DTD_ELEM_REDEFINED, /* 509 */ + XML_DTD_EMPTY_NOTATION, /* 510 */ + XML_DTD_ENTITY_TYPE, /* 511 */ + XML_DTD_ID_FIXED, /* 512 */ + XML_DTD_ID_REDEFINED, /* 513 */ + XML_DTD_ID_SUBSET, /* 514 */ + XML_DTD_INVALID_CHILD, /* 515 */ + XML_DTD_INVALID_DEFAULT, /* 516 */ + XML_DTD_LOAD_ERROR, /* 517 */ + XML_DTD_MISSING_ATTRIBUTE, /* 518 */ + XML_DTD_MIXED_CORRUPT, /* 519 */ + XML_DTD_MULTIPLE_ID, /* 520 */ + XML_DTD_NO_DOC, /* 521 */ + XML_DTD_NO_DTD, /* 522 */ + XML_DTD_NO_ELEM_NAME, /* 523 */ + XML_DTD_NO_PREFIX, /* 524 */ + XML_DTD_NO_ROOT, /* 525 */ + XML_DTD_NOTATION_REDEFINED, /* 526 */ + XML_DTD_NOTATION_VALUE, /* 527 */ + XML_DTD_NOT_EMPTY, /* 528 */ + XML_DTD_NOT_PCDATA, /* 529 */ + XML_DTD_NOT_STANDALONE, /* 530 */ + XML_DTD_ROOT_NAME, /* 531 */ + XML_DTD_STANDALONE_WHITE_SPACE, /* 532 */ + XML_DTD_UNKNOWN_ATTRIBUTE, /* 533 */ + XML_DTD_UNKNOWN_ELEM, /* 534 */ + XML_DTD_UNKNOWN_ENTITY, /* 535 */ + XML_DTD_UNKNOWN_ID, /* 536 */ + XML_DTD_UNKNOWN_NOTATION, /* 537 */ + XML_DTD_STANDALONE_DEFAULTED, /* 538 */ + XML_DTD_XMLID_VALUE, /* 539 */ + XML_DTD_XMLID_TYPE, /* 540 */ + XML_DTD_DUP_TOKEN, /* 541 */ + XML_HTML_STRUCURE_ERROR = 800, + XML_HTML_UNKNOWN_TAG, /* 801 */ + XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000, + XML_RNGP_ATTR_CONFLICT, /* 1001 */ + XML_RNGP_ATTRIBUTE_CHILDREN, /* 1002 */ + XML_RNGP_ATTRIBUTE_CONTENT, /* 1003 */ + XML_RNGP_ATTRIBUTE_EMPTY, /* 1004 */ + XML_RNGP_ATTRIBUTE_NOOP, /* 1005 */ + XML_RNGP_CHOICE_CONTENT, /* 1006 */ + XML_RNGP_CHOICE_EMPTY, /* 1007 */ + XML_RNGP_CREATE_FAILURE, /* 1008 */ + XML_RNGP_DATA_CONTENT, /* 1009 */ + XML_RNGP_DEF_CHOICE_AND_INTERLEAVE, /* 1010 */ + XML_RNGP_DEFINE_CREATE_FAILED, /* 1011 */ + XML_RNGP_DEFINE_EMPTY, /* 1012 */ + XML_RNGP_DEFINE_MISSING, /* 1013 */ + XML_RNGP_DEFINE_NAME_MISSING, /* 1014 */ + XML_RNGP_ELEM_CONTENT_EMPTY, /* 1015 */ + XML_RNGP_ELEM_CONTENT_ERROR, /* 1016 */ + XML_RNGP_ELEMENT_EMPTY, /* 1017 */ + XML_RNGP_ELEMENT_CONTENT, /* 1018 */ + XML_RNGP_ELEMENT_NAME, /* 1019 */ + XML_RNGP_ELEMENT_NO_CONTENT, /* 1020 */ + XML_RNGP_ELEM_TEXT_CONFLICT, /* 1021 */ + XML_RNGP_EMPTY, /* 1022 */ + XML_RNGP_EMPTY_CONSTRUCT, /* 1023 */ + XML_RNGP_EMPTY_CONTENT, /* 1024 */ + XML_RNGP_EMPTY_NOT_EMPTY, /* 1025 */ + XML_RNGP_ERROR_TYPE_LIB, /* 1026 */ + XML_RNGP_EXCEPT_EMPTY, /* 1027 */ + XML_RNGP_EXCEPT_MISSING, /* 1028 */ + XML_RNGP_EXCEPT_MULTIPLE, /* 1029 */ + XML_RNGP_EXCEPT_NO_CONTENT, /* 1030 */ + XML_RNGP_EXTERNALREF_EMTPY, /* 1031 */ + XML_RNGP_EXTERNAL_REF_FAILURE, /* 1032 */ + XML_RNGP_EXTERNALREF_RECURSE, /* 1033 */ + XML_RNGP_FORBIDDEN_ATTRIBUTE, /* 1034 */ + XML_RNGP_FOREIGN_ELEMENT, /* 1035 */ + XML_RNGP_GRAMMAR_CONTENT, /* 1036 */ + XML_RNGP_GRAMMAR_EMPTY, /* 1037 */ + XML_RNGP_GRAMMAR_MISSING, /* 1038 */ + XML_RNGP_GRAMMAR_NO_START, /* 1039 */ + XML_RNGP_GROUP_ATTR_CONFLICT, /* 1040 */ + XML_RNGP_HREF_ERROR, /* 1041 */ + XML_RNGP_INCLUDE_EMPTY, /* 1042 */ + XML_RNGP_INCLUDE_FAILURE, /* 1043 */ + XML_RNGP_INCLUDE_RECURSE, /* 1044 */ + XML_RNGP_INTERLEAVE_ADD, /* 1045 */ + XML_RNGP_INTERLEAVE_CREATE_FAILED, /* 1046 */ + XML_RNGP_INTERLEAVE_EMPTY, /* 1047 */ + XML_RNGP_INTERLEAVE_NO_CONTENT, /* 1048 */ + XML_RNGP_INVALID_DEFINE_NAME, /* 1049 */ + XML_RNGP_INVALID_URI, /* 1050 */ + XML_RNGP_INVALID_VALUE, /* 1051 */ + XML_RNGP_MISSING_HREF, /* 1052 */ + XML_RNGP_NAME_MISSING, /* 1053 */ + XML_RNGP_NEED_COMBINE, /* 1054 */ + XML_RNGP_NOTALLOWED_NOT_EMPTY, /* 1055 */ + XML_RNGP_NSNAME_ATTR_ANCESTOR, /* 1056 */ + XML_RNGP_NSNAME_NO_NS, /* 1057 */ + XML_RNGP_PARAM_FORBIDDEN, /* 1058 */ + XML_RNGP_PARAM_NAME_MISSING, /* 1059 */ + XML_RNGP_PARENTREF_CREATE_FAILED, /* 1060 */ + XML_RNGP_PARENTREF_NAME_INVALID, /* 1061 */ + XML_RNGP_PARENTREF_NO_NAME, /* 1062 */ + XML_RNGP_PARENTREF_NO_PARENT, /* 1063 */ + XML_RNGP_PARENTREF_NOT_EMPTY, /* 1064 */ + XML_RNGP_PARSE_ERROR, /* 1065 */ + XML_RNGP_PAT_ANYNAME_EXCEPT_ANYNAME, /* 1066 */ + XML_RNGP_PAT_ATTR_ATTR, /* 1067 */ + XML_RNGP_PAT_ATTR_ELEM, /* 1068 */ + XML_RNGP_PAT_DATA_EXCEPT_ATTR, /* 1069 */ + XML_RNGP_PAT_DATA_EXCEPT_ELEM, /* 1070 */ + XML_RNGP_PAT_DATA_EXCEPT_EMPTY, /* 1071 */ + XML_RNGP_PAT_DATA_EXCEPT_GROUP, /* 1072 */ + XML_RNGP_PAT_DATA_EXCEPT_INTERLEAVE, /* 1073 */ + XML_RNGP_PAT_DATA_EXCEPT_LIST, /* 1074 */ + XML_RNGP_PAT_DATA_EXCEPT_ONEMORE, /* 1075 */ + XML_RNGP_PAT_DATA_EXCEPT_REF, /* 1076 */ + XML_RNGP_PAT_DATA_EXCEPT_TEXT, /* 1077 */ + XML_RNGP_PAT_LIST_ATTR, /* 1078 */ + XML_RNGP_PAT_LIST_ELEM, /* 1079 */ + XML_RNGP_PAT_LIST_INTERLEAVE, /* 1080 */ + XML_RNGP_PAT_LIST_LIST, /* 1081 */ + XML_RNGP_PAT_LIST_REF, /* 1082 */ + XML_RNGP_PAT_LIST_TEXT, /* 1083 */ + XML_RNGP_PAT_NSNAME_EXCEPT_ANYNAME, /* 1084 */ + XML_RNGP_PAT_NSNAME_EXCEPT_NSNAME, /* 1085 */ + XML_RNGP_PAT_ONEMORE_GROUP_ATTR, /* 1086 */ + XML_RNGP_PAT_ONEMORE_INTERLEAVE_ATTR, /* 1087 */ + XML_RNGP_PAT_START_ATTR, /* 1088 */ + XML_RNGP_PAT_START_DATA, /* 1089 */ + XML_RNGP_PAT_START_EMPTY, /* 1090 */ + XML_RNGP_PAT_START_GROUP, /* 1091 */ + XML_RNGP_PAT_START_INTERLEAVE, /* 1092 */ + XML_RNGP_PAT_START_LIST, /* 1093 */ + XML_RNGP_PAT_START_ONEMORE, /* 1094 */ + XML_RNGP_PAT_START_TEXT, /* 1095 */ + XML_RNGP_PAT_START_VALUE, /* 1096 */ + XML_RNGP_PREFIX_UNDEFINED, /* 1097 */ + XML_RNGP_REF_CREATE_FAILED, /* 1098 */ + XML_RNGP_REF_CYCLE, /* 1099 */ + XML_RNGP_REF_NAME_INVALID, /* 1100 */ + XML_RNGP_REF_NO_DEF, /* 1101 */ + XML_RNGP_REF_NO_NAME, /* 1102 */ + XML_RNGP_REF_NOT_EMPTY, /* 1103 */ + XML_RNGP_START_CHOICE_AND_INTERLEAVE, /* 1104 */ + XML_RNGP_START_CONTENT, /* 1105 */ + XML_RNGP_START_EMPTY, /* 1106 */ + XML_RNGP_START_MISSING, /* 1107 */ + XML_RNGP_TEXT_EXPECTED, /* 1108 */ + XML_RNGP_TEXT_HAS_CHILD, /* 1109 */ + XML_RNGP_TYPE_MISSING, /* 1110 */ + XML_RNGP_TYPE_NOT_FOUND, /* 1111 */ + XML_RNGP_TYPE_VALUE, /* 1112 */ + XML_RNGP_UNKNOWN_ATTRIBUTE, /* 1113 */ + XML_RNGP_UNKNOWN_COMBINE, /* 1114 */ + XML_RNGP_UNKNOWN_CONSTRUCT, /* 1115 */ + XML_RNGP_UNKNOWN_TYPE_LIB, /* 1116 */ + XML_RNGP_URI_FRAGMENT, /* 1117 */ + XML_RNGP_URI_NOT_ABSOLUTE, /* 1118 */ + XML_RNGP_VALUE_EMPTY, /* 1119 */ + XML_RNGP_VALUE_NO_CONTENT, /* 1120 */ + XML_RNGP_XMLNS_NAME, /* 1121 */ + XML_RNGP_XML_NS, /* 1122 */ + XML_XPATH_EXPRESSION_OK = 1200, + XML_XPATH_NUMBER_ERROR, /* 1201 */ + XML_XPATH_UNFINISHED_LITERAL_ERROR, /* 1202 */ + XML_XPATH_START_LITERAL_ERROR, /* 1203 */ + XML_XPATH_VARIABLE_REF_ERROR, /* 1204 */ + XML_XPATH_UNDEF_VARIABLE_ERROR, /* 1205 */ + XML_XPATH_INVALID_PREDICATE_ERROR, /* 1206 */ + XML_XPATH_EXPR_ERROR, /* 1207 */ + XML_XPATH_UNCLOSED_ERROR, /* 1208 */ + XML_XPATH_UNKNOWN_FUNC_ERROR, /* 1209 */ + XML_XPATH_INVALID_OPERAND, /* 1210 */ + XML_XPATH_INVALID_TYPE, /* 1211 */ + XML_XPATH_INVALID_ARITY, /* 1212 */ + XML_XPATH_INVALID_CTXT_SIZE, /* 1213 */ + XML_XPATH_INVALID_CTXT_POSITION, /* 1214 */ + XML_XPATH_MEMORY_ERROR, /* 1215 */ + XML_XPTR_SYNTAX_ERROR, /* 1216 */ + XML_XPTR_RESOURCE_ERROR, /* 1217 */ + XML_XPTR_SUB_RESOURCE_ERROR, /* 1218 */ + XML_XPATH_UNDEF_PREFIX_ERROR, /* 1219 */ + XML_XPATH_ENCODING_ERROR, /* 1220 */ + XML_XPATH_INVALID_CHAR_ERROR, /* 1221 */ + XML_TREE_INVALID_HEX = 1300, + XML_TREE_INVALID_DEC, /* 1301 */ + XML_TREE_UNTERMINATED_ENTITY, /* 1302 */ + XML_TREE_NOT_UTF8, /* 1303 */ + XML_SAVE_NOT_UTF8 = 1400, + XML_SAVE_CHAR_INVALID, /* 1401 */ + XML_SAVE_NO_DOCTYPE, /* 1402 */ + XML_SAVE_UNKNOWN_ENCODING, /* 1403 */ + XML_REGEXP_COMPILE_ERROR = 1450, + XML_IO_UNKNOWN = 1500, + XML_IO_EACCES, /* 1501 */ + XML_IO_EAGAIN, /* 1502 */ + XML_IO_EBADF, /* 1503 */ + XML_IO_EBADMSG, /* 1504 */ + XML_IO_EBUSY, /* 1505 */ + XML_IO_ECANCELED, /* 1506 */ + XML_IO_ECHILD, /* 1507 */ + XML_IO_EDEADLK, /* 1508 */ + XML_IO_EDOM, /* 1509 */ + XML_IO_EEXIST, /* 1510 */ + XML_IO_EFAULT, /* 1511 */ + XML_IO_EFBIG, /* 1512 */ + XML_IO_EINPROGRESS, /* 1513 */ + XML_IO_EINTR, /* 1514 */ + XML_IO_EINVAL, /* 1515 */ + XML_IO_EIO, /* 1516 */ + XML_IO_EISDIR, /* 1517 */ + XML_IO_EMFILE, /* 1518 */ + XML_IO_EMLINK, /* 1519 */ + XML_IO_EMSGSIZE, /* 1520 */ + XML_IO_ENAMETOOLONG, /* 1521 */ + XML_IO_ENFILE, /* 1522 */ + XML_IO_ENODEV, /* 1523 */ + XML_IO_ENOENT, /* 1524 */ + XML_IO_ENOEXEC, /* 1525 */ + XML_IO_ENOLCK, /* 1526 */ + XML_IO_ENOMEM, /* 1527 */ + XML_IO_ENOSPC, /* 1528 */ + XML_IO_ENOSYS, /* 1529 */ + XML_IO_ENOTDIR, /* 1530 */ + XML_IO_ENOTEMPTY, /* 1531 */ + XML_IO_ENOTSUP, /* 1532 */ + XML_IO_ENOTTY, /* 1533 */ + XML_IO_ENXIO, /* 1534 */ + XML_IO_EPERM, /* 1535 */ + XML_IO_EPIPE, /* 1536 */ + XML_IO_ERANGE, /* 1537 */ + XML_IO_EROFS, /* 1538 */ + XML_IO_ESPIPE, /* 1539 */ + XML_IO_ESRCH, /* 1540 */ + XML_IO_ETIMEDOUT, /* 1541 */ + XML_IO_EXDEV, /* 1542 */ + XML_IO_NETWORK_ATTEMPT, /* 1543 */ + XML_IO_ENCODER, /* 1544 */ + XML_IO_FLUSH, /* 1545 */ + XML_IO_WRITE, /* 1546 */ + XML_IO_NO_INPUT, /* 1547 */ + XML_IO_BUFFER_FULL, /* 1548 */ + XML_IO_LOAD_ERROR, /* 1549 */ + XML_IO_ENOTSOCK, /* 1550 */ + XML_IO_EISCONN, /* 1551 */ + XML_IO_ECONNREFUSED, /* 1552 */ + XML_IO_ENETUNREACH, /* 1553 */ + XML_IO_EADDRINUSE, /* 1554 */ + XML_IO_EALREADY, /* 1555 */ + XML_IO_EAFNOSUPPORT, /* 1556 */ + XML_XINCLUDE_RECURSION=1600, + XML_XINCLUDE_PARSE_VALUE, /* 1601 */ + XML_XINCLUDE_ENTITY_DEF_MISMATCH, /* 1602 */ + XML_XINCLUDE_NO_HREF, /* 1603 */ + XML_XINCLUDE_NO_FALLBACK, /* 1604 */ + XML_XINCLUDE_HREF_URI, /* 1605 */ + XML_XINCLUDE_TEXT_FRAGMENT, /* 1606 */ + XML_XINCLUDE_TEXT_DOCUMENT, /* 1607 */ + XML_XINCLUDE_INVALID_CHAR, /* 1608 */ + XML_XINCLUDE_BUILD_FAILED, /* 1609 */ + XML_XINCLUDE_UNKNOWN_ENCODING, /* 1610 */ + XML_XINCLUDE_MULTIPLE_ROOT, /* 1611 */ + XML_XINCLUDE_XPTR_FAILED, /* 1612 */ + XML_XINCLUDE_XPTR_RESULT, /* 1613 */ + XML_XINCLUDE_INCLUDE_IN_INCLUDE, /* 1614 */ + XML_XINCLUDE_FALLBACKS_IN_INCLUDE, /* 1615 */ + XML_XINCLUDE_FALLBACK_NOT_IN_INCLUDE, /* 1616 */ + XML_XINCLUDE_DEPRECATED_NS, /* 1617 */ + XML_XINCLUDE_FRAGMENT_ID, /* 1618 */ + XML_CATALOG_MISSING_ATTR = 1650, + XML_CATALOG_ENTRY_BROKEN, /* 1651 */ + XML_CATALOG_PREFER_VALUE, /* 1652 */ + XML_CATALOG_NOT_CATALOG, /* 1653 */ + XML_CATALOG_RECURSION, /* 1654 */ + XML_SCHEMAP_PREFIX_UNDEFINED = 1700, + XML_SCHEMAP_ATTRFORMDEFAULT_VALUE, /* 1701 */ + XML_SCHEMAP_ATTRGRP_NONAME_NOREF, /* 1702 */ + XML_SCHEMAP_ATTR_NONAME_NOREF, /* 1703 */ + XML_SCHEMAP_COMPLEXTYPE_NONAME_NOREF, /* 1704 */ + XML_SCHEMAP_ELEMFORMDEFAULT_VALUE, /* 1705 */ + XML_SCHEMAP_ELEM_NONAME_NOREF, /* 1706 */ + XML_SCHEMAP_EXTENSION_NO_BASE, /* 1707 */ + XML_SCHEMAP_FACET_NO_VALUE, /* 1708 */ + XML_SCHEMAP_FAILED_BUILD_IMPORT, /* 1709 */ + XML_SCHEMAP_GROUP_NONAME_NOREF, /* 1710 */ + XML_SCHEMAP_IMPORT_NAMESPACE_NOT_URI, /* 1711 */ + XML_SCHEMAP_IMPORT_REDEFINE_NSNAME, /* 1712 */ + XML_SCHEMAP_IMPORT_SCHEMA_NOT_URI, /* 1713 */ + XML_SCHEMAP_INVALID_BOOLEAN, /* 1714 */ + XML_SCHEMAP_INVALID_ENUM, /* 1715 */ + XML_SCHEMAP_INVALID_FACET, /* 1716 */ + XML_SCHEMAP_INVALID_FACET_VALUE, /* 1717 */ + XML_SCHEMAP_INVALID_MAXOCCURS, /* 1718 */ + XML_SCHEMAP_INVALID_MINOCCURS, /* 1719 */ + XML_SCHEMAP_INVALID_REF_AND_SUBTYPE, /* 1720 */ + XML_SCHEMAP_INVALID_WHITE_SPACE, /* 1721 */ + XML_SCHEMAP_NOATTR_NOREF, /* 1722 */ + XML_SCHEMAP_NOTATION_NO_NAME, /* 1723 */ + XML_SCHEMAP_NOTYPE_NOREF, /* 1724 */ + XML_SCHEMAP_REF_AND_SUBTYPE, /* 1725 */ + XML_SCHEMAP_RESTRICTION_NONAME_NOREF, /* 1726 */ + XML_SCHEMAP_SIMPLETYPE_NONAME, /* 1727 */ + XML_SCHEMAP_TYPE_AND_SUBTYPE, /* 1728 */ + XML_SCHEMAP_UNKNOWN_ALL_CHILD, /* 1729 */ + XML_SCHEMAP_UNKNOWN_ANYATTRIBUTE_CHILD, /* 1730 */ + XML_SCHEMAP_UNKNOWN_ATTR_CHILD, /* 1731 */ + XML_SCHEMAP_UNKNOWN_ATTRGRP_CHILD, /* 1732 */ + XML_SCHEMAP_UNKNOWN_ATTRIBUTE_GROUP, /* 1733 */ + XML_SCHEMAP_UNKNOWN_BASE_TYPE, /* 1734 */ + XML_SCHEMAP_UNKNOWN_CHOICE_CHILD, /* 1735 */ + XML_SCHEMAP_UNKNOWN_COMPLEXCONTENT_CHILD, /* 1736 */ + XML_SCHEMAP_UNKNOWN_COMPLEXTYPE_CHILD, /* 1737 */ + XML_SCHEMAP_UNKNOWN_ELEM_CHILD, /* 1738 */ + XML_SCHEMAP_UNKNOWN_EXTENSION_CHILD, /* 1739 */ + XML_SCHEMAP_UNKNOWN_FACET_CHILD, /* 1740 */ + XML_SCHEMAP_UNKNOWN_FACET_TYPE, /* 1741 */ + XML_SCHEMAP_UNKNOWN_GROUP_CHILD, /* 1742 */ + XML_SCHEMAP_UNKNOWN_IMPORT_CHILD, /* 1743 */ + XML_SCHEMAP_UNKNOWN_LIST_CHILD, /* 1744 */ + XML_SCHEMAP_UNKNOWN_NOTATION_CHILD, /* 1745 */ + XML_SCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD, /* 1746 */ + XML_SCHEMAP_UNKNOWN_REF, /* 1747 */ + XML_SCHEMAP_UNKNOWN_RESTRICTION_CHILD, /* 1748 */ + XML_SCHEMAP_UNKNOWN_SCHEMAS_CHILD, /* 1749 */ + XML_SCHEMAP_UNKNOWN_SEQUENCE_CHILD, /* 1750 */ + XML_SCHEMAP_UNKNOWN_SIMPLECONTENT_CHILD, /* 1751 */ + XML_SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD, /* 1752 */ + XML_SCHEMAP_UNKNOWN_TYPE, /* 1753 */ + XML_SCHEMAP_UNKNOWN_UNION_CHILD, /* 1754 */ + XML_SCHEMAP_ELEM_DEFAULT_FIXED, /* 1755 */ + XML_SCHEMAP_REGEXP_INVALID, /* 1756 */ + XML_SCHEMAP_FAILED_LOAD, /* 1757 */ + XML_SCHEMAP_NOTHING_TO_PARSE, /* 1758 */ + XML_SCHEMAP_NOROOT, /* 1759 */ + XML_SCHEMAP_REDEFINED_GROUP, /* 1760 */ + XML_SCHEMAP_REDEFINED_TYPE, /* 1761 */ + XML_SCHEMAP_REDEFINED_ELEMENT, /* 1762 */ + XML_SCHEMAP_REDEFINED_ATTRGROUP, /* 1763 */ + XML_SCHEMAP_REDEFINED_ATTR, /* 1764 */ + XML_SCHEMAP_REDEFINED_NOTATION, /* 1765 */ + XML_SCHEMAP_FAILED_PARSE, /* 1766 */ + XML_SCHEMAP_UNKNOWN_PREFIX, /* 1767 */ + XML_SCHEMAP_DEF_AND_PREFIX, /* 1768 */ + XML_SCHEMAP_UNKNOWN_INCLUDE_CHILD, /* 1769 */ + XML_SCHEMAP_INCLUDE_SCHEMA_NOT_URI, /* 1770 */ + XML_SCHEMAP_INCLUDE_SCHEMA_NO_URI, /* 1771 */ + XML_SCHEMAP_NOT_SCHEMA, /* 1772 */ + XML_SCHEMAP_UNKNOWN_MEMBER_TYPE, /* 1773 */ + XML_SCHEMAP_INVALID_ATTR_USE, /* 1774 */ + XML_SCHEMAP_RECURSIVE, /* 1775 */ + XML_SCHEMAP_SUPERNUMEROUS_LIST_ITEM_TYPE, /* 1776 */ + XML_SCHEMAP_INVALID_ATTR_COMBINATION, /* 1777 */ + XML_SCHEMAP_INVALID_ATTR_INLINE_COMBINATION, /* 1778 */ + XML_SCHEMAP_MISSING_SIMPLETYPE_CHILD, /* 1779 */ + XML_SCHEMAP_INVALID_ATTR_NAME, /* 1780 */ + XML_SCHEMAP_REF_AND_CONTENT, /* 1781 */ + XML_SCHEMAP_CT_PROPS_CORRECT_1, /* 1782 */ + XML_SCHEMAP_CT_PROPS_CORRECT_2, /* 1783 */ + XML_SCHEMAP_CT_PROPS_CORRECT_3, /* 1784 */ + XML_SCHEMAP_CT_PROPS_CORRECT_4, /* 1785 */ + XML_SCHEMAP_CT_PROPS_CORRECT_5, /* 1786 */ + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, /* 1787 */ + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1, /* 1788 */ + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2, /* 1789 */ + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_2, /* 1790 */ + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_3, /* 1791 */ + XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER, /* 1792 */ + XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE, /* 1793 */ + XML_SCHEMAP_UNION_NOT_EXPRESSIBLE, /* 1794 */ + XML_SCHEMAP_SRC_IMPORT_3_1, /* 1795 */ + XML_SCHEMAP_SRC_IMPORT_3_2, /* 1796 */ + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_1, /* 1797 */ + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_2, /* 1798 */ + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_3, /* 1799 */ + XML_SCHEMAP_COS_CT_EXTENDS_1_3, /* 1800 */ + XML_SCHEMAV_NOROOT = 1801, + XML_SCHEMAV_UNDECLAREDELEM, /* 1802 */ + XML_SCHEMAV_NOTTOPLEVEL, /* 1803 */ + XML_SCHEMAV_MISSING, /* 1804 */ + XML_SCHEMAV_WRONGELEM, /* 1805 */ + XML_SCHEMAV_NOTYPE, /* 1806 */ + XML_SCHEMAV_NOROLLBACK, /* 1807 */ + XML_SCHEMAV_ISABSTRACT, /* 1808 */ + XML_SCHEMAV_NOTEMPTY, /* 1809 */ + XML_SCHEMAV_ELEMCONT, /* 1810 */ + XML_SCHEMAV_HAVEDEFAULT, /* 1811 */ + XML_SCHEMAV_NOTNILLABLE, /* 1812 */ + XML_SCHEMAV_EXTRACONTENT, /* 1813 */ + XML_SCHEMAV_INVALIDATTR, /* 1814 */ + XML_SCHEMAV_INVALIDELEM, /* 1815 */ + XML_SCHEMAV_NOTDETERMINIST, /* 1816 */ + XML_SCHEMAV_CONSTRUCT, /* 1817 */ + XML_SCHEMAV_INTERNAL, /* 1818 */ + XML_SCHEMAV_NOTSIMPLE, /* 1819 */ + XML_SCHEMAV_ATTRUNKNOWN, /* 1820 */ + XML_SCHEMAV_ATTRINVALID, /* 1821 */ + XML_SCHEMAV_VALUE, /* 1822 */ + XML_SCHEMAV_FACET, /* 1823 */ + XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1, /* 1824 */ + XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2, /* 1825 */ + XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_3, /* 1826 */ + XML_SCHEMAV_CVC_TYPE_3_1_1, /* 1827 */ + XML_SCHEMAV_CVC_TYPE_3_1_2, /* 1828 */ + XML_SCHEMAV_CVC_FACET_VALID, /* 1829 */ + XML_SCHEMAV_CVC_LENGTH_VALID, /* 1830 */ + XML_SCHEMAV_CVC_MINLENGTH_VALID, /* 1831 */ + XML_SCHEMAV_CVC_MAXLENGTH_VALID, /* 1832 */ + XML_SCHEMAV_CVC_MININCLUSIVE_VALID, /* 1833 */ + XML_SCHEMAV_CVC_MAXINCLUSIVE_VALID, /* 1834 */ + XML_SCHEMAV_CVC_MINEXCLUSIVE_VALID, /* 1835 */ + XML_SCHEMAV_CVC_MAXEXCLUSIVE_VALID, /* 1836 */ + XML_SCHEMAV_CVC_TOTALDIGITS_VALID, /* 1837 */ + XML_SCHEMAV_CVC_FRACTIONDIGITS_VALID, /* 1838 */ + XML_SCHEMAV_CVC_PATTERN_VALID, /* 1839 */ + XML_SCHEMAV_CVC_ENUMERATION_VALID, /* 1840 */ + XML_SCHEMAV_CVC_COMPLEX_TYPE_2_1, /* 1841 */ + XML_SCHEMAV_CVC_COMPLEX_TYPE_2_2, /* 1842 */ + XML_SCHEMAV_CVC_COMPLEX_TYPE_2_3, /* 1843 */ + XML_SCHEMAV_CVC_COMPLEX_TYPE_2_4, /* 1844 */ + XML_SCHEMAV_CVC_ELT_1, /* 1845 */ + XML_SCHEMAV_CVC_ELT_2, /* 1846 */ + XML_SCHEMAV_CVC_ELT_3_1, /* 1847 */ + XML_SCHEMAV_CVC_ELT_3_2_1, /* 1848 */ + XML_SCHEMAV_CVC_ELT_3_2_2, /* 1849 */ + XML_SCHEMAV_CVC_ELT_4_1, /* 1850 */ + XML_SCHEMAV_CVC_ELT_4_2, /* 1851 */ + XML_SCHEMAV_CVC_ELT_4_3, /* 1852 */ + XML_SCHEMAV_CVC_ELT_5_1_1, /* 1853 */ + XML_SCHEMAV_CVC_ELT_5_1_2, /* 1854 */ + XML_SCHEMAV_CVC_ELT_5_2_1, /* 1855 */ + XML_SCHEMAV_CVC_ELT_5_2_2_1, /* 1856 */ + XML_SCHEMAV_CVC_ELT_5_2_2_2_1, /* 1857 */ + XML_SCHEMAV_CVC_ELT_5_2_2_2_2, /* 1858 */ + XML_SCHEMAV_CVC_ELT_6, /* 1859 */ + XML_SCHEMAV_CVC_ELT_7, /* 1860 */ + XML_SCHEMAV_CVC_ATTRIBUTE_1, /* 1861 */ + XML_SCHEMAV_CVC_ATTRIBUTE_2, /* 1862 */ + XML_SCHEMAV_CVC_ATTRIBUTE_3, /* 1863 */ + XML_SCHEMAV_CVC_ATTRIBUTE_4, /* 1864 */ + XML_SCHEMAV_CVC_COMPLEX_TYPE_3_1, /* 1865 */ + XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_1, /* 1866 */ + XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_2, /* 1867 */ + XML_SCHEMAV_CVC_COMPLEX_TYPE_4, /* 1868 */ + XML_SCHEMAV_CVC_COMPLEX_TYPE_5_1, /* 1869 */ + XML_SCHEMAV_CVC_COMPLEX_TYPE_5_2, /* 1870 */ + XML_SCHEMAV_ELEMENT_CONTENT, /* 1871 */ + XML_SCHEMAV_DOCUMENT_ELEMENT_MISSING, /* 1872 */ + XML_SCHEMAV_CVC_COMPLEX_TYPE_1, /* 1873 */ + XML_SCHEMAV_CVC_AU, /* 1874 */ + XML_SCHEMAV_CVC_TYPE_1, /* 1875 */ + XML_SCHEMAV_CVC_TYPE_2, /* 1876 */ + XML_SCHEMAV_CVC_IDC, /* 1877 */ + XML_SCHEMAV_CVC_WILDCARD, /* 1878 */ + XML_SCHEMAV_MISC, /* 1879 */ + XML_XPTR_UNKNOWN_SCHEME = 1900, + XML_XPTR_CHILDSEQ_START, /* 1901 */ + XML_XPTR_EVAL_FAILED, /* 1902 */ + XML_XPTR_EXTRA_OBJECTS, /* 1903 */ + XML_C14N_CREATE_CTXT = 1950, + XML_C14N_REQUIRES_UTF8, /* 1951 */ + XML_C14N_CREATE_STACK, /* 1952 */ + XML_C14N_INVALID_NODE, /* 1953 */ + XML_C14N_UNKNOW_NODE, /* 1954 */ + XML_C14N_RELATIVE_NAMESPACE, /* 1955 */ + XML_FTP_PASV_ANSWER = 2000, + XML_FTP_EPSV_ANSWER, /* 2001 */ + XML_FTP_ACCNT, /* 2002 */ + XML_FTP_URL_SYNTAX, /* 2003 */ + XML_HTTP_URL_SYNTAX = 2020, + XML_HTTP_USE_IP, /* 2021 */ + XML_HTTP_UNKNOWN_HOST, /* 2022 */ + XML_SCHEMAP_SRC_SIMPLE_TYPE_1 = 3000, + XML_SCHEMAP_SRC_SIMPLE_TYPE_2, /* 3001 */ + XML_SCHEMAP_SRC_SIMPLE_TYPE_3, /* 3002 */ + XML_SCHEMAP_SRC_SIMPLE_TYPE_4, /* 3003 */ + XML_SCHEMAP_SRC_RESOLVE, /* 3004 */ + XML_SCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE, /* 3005 */ + XML_SCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE, /* 3006 */ + XML_SCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES, /* 3007 */ + XML_SCHEMAP_ST_PROPS_CORRECT_1, /* 3008 */ + XML_SCHEMAP_ST_PROPS_CORRECT_2, /* 3009 */ + XML_SCHEMAP_ST_PROPS_CORRECT_3, /* 3010 */ + XML_SCHEMAP_COS_ST_RESTRICTS_1_1, /* 3011 */ + XML_SCHEMAP_COS_ST_RESTRICTS_1_2, /* 3012 */ + XML_SCHEMAP_COS_ST_RESTRICTS_1_3_1, /* 3013 */ + XML_SCHEMAP_COS_ST_RESTRICTS_1_3_2, /* 3014 */ + XML_SCHEMAP_COS_ST_RESTRICTS_2_1, /* 3015 */ + XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_1, /* 3016 */ + XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2, /* 3017 */ + XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_1, /* 3018 */ + XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_2, /* 3019 */ + XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_3, /* 3020 */ + XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_4, /* 3021 */ + XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_5, /* 3022 */ + XML_SCHEMAP_COS_ST_RESTRICTS_3_1, /* 3023 */ + XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1, /* 3024 */ + XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1_2, /* 3025 */ + XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_2, /* 3026 */ + XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_1, /* 3027 */ + XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_3, /* 3028 */ + XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_4, /* 3029 */ + XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_5, /* 3030 */ + XML_SCHEMAP_COS_ST_DERIVED_OK_2_1, /* 3031 */ + XML_SCHEMAP_COS_ST_DERIVED_OK_2_2, /* 3032 */ + XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, /* 3033 */ + XML_SCHEMAP_S4S_ELEM_MISSING, /* 3034 */ + XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, /* 3035 */ + XML_SCHEMAP_S4S_ATTR_MISSING, /* 3036 */ + XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, /* 3037 */ + XML_SCHEMAP_SRC_ELEMENT_1, /* 3038 */ + XML_SCHEMAP_SRC_ELEMENT_2_1, /* 3039 */ + XML_SCHEMAP_SRC_ELEMENT_2_2, /* 3040 */ + XML_SCHEMAP_SRC_ELEMENT_3, /* 3041 */ + XML_SCHEMAP_P_PROPS_CORRECT_1, /* 3042 */ + XML_SCHEMAP_P_PROPS_CORRECT_2_1, /* 3043 */ + XML_SCHEMAP_P_PROPS_CORRECT_2_2, /* 3044 */ + XML_SCHEMAP_E_PROPS_CORRECT_2, /* 3045 */ + XML_SCHEMAP_E_PROPS_CORRECT_3, /* 3046 */ + XML_SCHEMAP_E_PROPS_CORRECT_4, /* 3047 */ + XML_SCHEMAP_E_PROPS_CORRECT_5, /* 3048 */ + XML_SCHEMAP_E_PROPS_CORRECT_6, /* 3049 */ + XML_SCHEMAP_SRC_INCLUDE, /* 3050 */ + XML_SCHEMAP_SRC_ATTRIBUTE_1, /* 3051 */ + XML_SCHEMAP_SRC_ATTRIBUTE_2, /* 3052 */ + XML_SCHEMAP_SRC_ATTRIBUTE_3_1, /* 3053 */ + XML_SCHEMAP_SRC_ATTRIBUTE_3_2, /* 3054 */ + XML_SCHEMAP_SRC_ATTRIBUTE_4, /* 3055 */ + XML_SCHEMAP_NO_XMLNS, /* 3056 */ + XML_SCHEMAP_NO_XSI, /* 3057 */ + XML_SCHEMAP_COS_VALID_DEFAULT_1, /* 3058 */ + XML_SCHEMAP_COS_VALID_DEFAULT_2_1, /* 3059 */ + XML_SCHEMAP_COS_VALID_DEFAULT_2_2_1, /* 3060 */ + XML_SCHEMAP_COS_VALID_DEFAULT_2_2_2, /* 3061 */ + XML_SCHEMAP_CVC_SIMPLE_TYPE, /* 3062 */ + XML_SCHEMAP_COS_CT_EXTENDS_1_1, /* 3063 */ + XML_SCHEMAP_SRC_IMPORT_1_1, /* 3064 */ + XML_SCHEMAP_SRC_IMPORT_1_2, /* 3065 */ + XML_SCHEMAP_SRC_IMPORT_2, /* 3066 */ + XML_SCHEMAP_SRC_IMPORT_2_1, /* 3067 */ + XML_SCHEMAP_SRC_IMPORT_2_2, /* 3068 */ + XML_SCHEMAP_INTERNAL, /* 3069 non-W3C */ + XML_SCHEMAP_NOT_DETERMINISTIC, /* 3070 non-W3C */ + XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_1, /* 3071 */ + XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_2, /* 3072 */ + XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_3, /* 3073 */ + XML_SCHEMAP_MG_PROPS_CORRECT_1, /* 3074 */ + XML_SCHEMAP_MG_PROPS_CORRECT_2, /* 3075 */ + XML_SCHEMAP_SRC_CT_1, /* 3076 */ + XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3, /* 3077 */ + XML_SCHEMAP_AU_PROPS_CORRECT_2, /* 3078 */ + XML_SCHEMAP_A_PROPS_CORRECT_2, /* 3079 */ + XML_SCHEMAP_C_PROPS_CORRECT, /* 3080 */ + XML_SCHEMAP_SRC_REDEFINE, /* 3081 */ + XML_SCHEMAP_SRC_IMPORT, /* 3082 */ + XML_SCHEMAP_WARN_SKIP_SCHEMA, /* 3083 */ + XML_SCHEMAP_WARN_UNLOCATED_SCHEMA, /* 3084 */ + XML_SCHEMAP_WARN_ATTR_REDECL_PROH, /* 3085 */ + XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH, /* 3085 */ + XML_SCHEMAP_AG_PROPS_CORRECT, /* 3086 */ + XML_SCHEMAP_COS_CT_EXTENDS_1_2, /* 3087 */ + XML_SCHEMAP_AU_PROPS_CORRECT, /* 3088 */ + XML_SCHEMAP_A_PROPS_CORRECT_3, /* 3089 */ + XML_SCHEMAP_COS_ALL_LIMITED, /* 3090 */ + XML_SCHEMATRONV_ASSERT = 4000, /* 4000 */ + XML_SCHEMATRONV_REPORT, + XML_MODULE_OPEN = 4900, /* 4900 */ + XML_MODULE_CLOSE, /* 4901 */ + XML_CHECK_FOUND_ELEMENT = 5000, + XML_CHECK_FOUND_ATTRIBUTE, /* 5001 */ + XML_CHECK_FOUND_TEXT, /* 5002 */ + XML_CHECK_FOUND_CDATA, /* 5003 */ + XML_CHECK_FOUND_ENTITYREF, /* 5004 */ + XML_CHECK_FOUND_ENTITY, /* 5005 */ + XML_CHECK_FOUND_PI, /* 5006 */ + XML_CHECK_FOUND_COMMENT, /* 5007 */ + XML_CHECK_FOUND_DOCTYPE, /* 5008 */ + XML_CHECK_FOUND_FRAGMENT, /* 5009 */ + XML_CHECK_FOUND_NOTATION, /* 5010 */ + XML_CHECK_UNKNOWN_NODE, /* 5011 */ + XML_CHECK_ENTITY_TYPE, /* 5012 */ + XML_CHECK_NO_PARENT, /* 5013 */ + XML_CHECK_NO_DOC, /* 5014 */ + XML_CHECK_NO_NAME, /* 5015 */ + XML_CHECK_NO_ELEM, /* 5016 */ + XML_CHECK_WRONG_DOC, /* 5017 */ + XML_CHECK_NO_PREV, /* 5018 */ + XML_CHECK_WRONG_PREV, /* 5019 */ + XML_CHECK_NO_NEXT, /* 5020 */ + XML_CHECK_WRONG_NEXT, /* 5021 */ + XML_CHECK_NOT_DTD, /* 5022 */ + XML_CHECK_NOT_ATTR, /* 5023 */ + XML_CHECK_NOT_ATTR_DECL, /* 5024 */ + XML_CHECK_NOT_ELEM_DECL, /* 5025 */ + XML_CHECK_NOT_ENTITY_DECL, /* 5026 */ + XML_CHECK_NOT_NS_DECL, /* 5027 */ + XML_CHECK_NO_HREF, /* 5028 */ + XML_CHECK_WRONG_PARENT,/* 5029 */ + XML_CHECK_NS_SCOPE, /* 5030 */ + XML_CHECK_NS_ANCESTOR, /* 5031 */ + XML_CHECK_NOT_UTF8, /* 5032 */ + XML_CHECK_NO_DICT, /* 5033 */ + XML_CHECK_NOT_NCNAME, /* 5034 */ + XML_CHECK_OUTSIDE_DICT, /* 5035 */ + XML_CHECK_WRONG_NAME, /* 5036 */ + XML_CHECK_NAME_NOT_NULL, /* 5037 */ + XML_I18N_NO_NAME = 6000, + XML_I18N_NO_HANDLER, /* 6001 */ + XML_I18N_EXCESS_HANDLER, /* 6002 */ + XML_I18N_CONV_FAILED, /* 6003 */ + XML_I18N_NO_OUTPUT, /* 6004 */ + XML_BUF_OVERFLOW = 7000 +} xmlParserErrors; + +/** + * xmlGenericErrorFunc: + * @ctx: a parsing context + * @msg: the message + * @...: the extra arguments of the varags to format the message + * + * Signature of the function to use when there is an error and + * no parsing or validity context available . + */ +typedef void (XMLCDECL *xmlGenericErrorFunc) (void *ctx, + const char *msg, + ...) LIBXML_ATTR_FORMAT(2,3); +/** + * xmlStructuredErrorFunc: + * @userData: user provided data for the error callback + * @error: the error being raised. + * + * Signature of the function to use when there is an error and + * the module handles the new error reporting mechanism. + */ +typedef void (XMLCALL *xmlStructuredErrorFunc) (void *userData, xmlErrorPtr error); + +/* + * Use the following function to reset the two global variables + * xmlGenericError and xmlGenericErrorContext. + */ +XMLPUBFUN void XMLCALL + xmlSetGenericErrorFunc (void *ctx, + xmlGenericErrorFunc handler); +XMLPUBFUN void XMLCALL + initGenericErrorDefaultFunc (xmlGenericErrorFunc *handler); + +XMLPUBFUN void XMLCALL + xmlSetStructuredErrorFunc (void *ctx, + xmlStructuredErrorFunc handler); +/* + * Default message routines used by SAX and Valid context for error + * and warning reporting. + */ +XMLPUBFUN void XMLCDECL + xmlParserError (void *ctx, + const char *msg, + ...) LIBXML_ATTR_FORMAT(2,3); +XMLPUBFUN void XMLCDECL + xmlParserWarning (void *ctx, + const char *msg, + ...) LIBXML_ATTR_FORMAT(2,3); +XMLPUBFUN void XMLCDECL + xmlParserValidityError (void *ctx, + const char *msg, + ...) LIBXML_ATTR_FORMAT(2,3); +XMLPUBFUN void XMLCDECL + xmlParserValidityWarning (void *ctx, + const char *msg, + ...) LIBXML_ATTR_FORMAT(2,3); +XMLPUBFUN void XMLCALL + xmlParserPrintFileInfo (xmlParserInputPtr input); +XMLPUBFUN void XMLCALL + xmlParserPrintFileContext (xmlParserInputPtr input); + +/* + * Extended error information routines + */ +XMLPUBFUN xmlErrorPtr XMLCALL + xmlGetLastError (void); +XMLPUBFUN void XMLCALL + xmlResetLastError (void); +XMLPUBFUN xmlErrorPtr XMLCALL + xmlCtxtGetLastError (void *ctx); +XMLPUBFUN void XMLCALL + xmlCtxtResetLastError (void *ctx); +XMLPUBFUN void XMLCALL + xmlResetError (xmlErrorPtr err); +XMLPUBFUN int XMLCALL + xmlCopyError (xmlErrorPtr from, + xmlErrorPtr to); + +#ifdef IN_LIBXML +/* + * Internal callback reporting routine + */ +XMLPUBFUN void XMLCALL + __xmlRaiseError (xmlStructuredErrorFunc schannel, + xmlGenericErrorFunc channel, + void *data, + void *ctx, + void *node, + int domain, + int code, + xmlErrorLevel level, + const char *file, + int line, + const char *str1, + const char *str2, + const char *str3, + int int1, + int col, + const char *msg, + ...) LIBXML_ATTR_FORMAT(16,17); +XMLPUBFUN void XMLCALL + __xmlSimpleError (int domain, + int code, + xmlNodePtr node, + const char *msg, + const char *extra) LIBXML_ATTR_FORMAT(4,0); +#endif +#ifdef __cplusplus +} +#endif +#endif /* __XML_ERROR_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlexports.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlexports.h new file mode 100644 index 0000000..31ab8a1 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlexports.h @@ -0,0 +1,162 @@ +/* + * Summary: macros for marking symbols as exportable/importable. + * Description: macros for marking symbols as exportable/importable. + * + * Copy: See Copyright for the status of this software. + * + * Author: Igor Zlatovic + */ + +#ifndef __XML_EXPORTS_H__ +#define __XML_EXPORTS_H__ + +/** + * XMLPUBFUN, XMLPUBVAR, XMLCALL + * + * Macros which declare an exportable function, an exportable variable and + * the calling convention used for functions. + * + * Please use an extra block for every platform/compiler combination when + * modifying this, rather than overlong #ifdef lines. This helps + * readability as well as the fact that different compilers on the same + * platform might need different definitions. + */ + +/** + * XMLPUBFUN: + * + * Macros which declare an exportable function + */ +#define XMLPUBFUN +/** + * XMLPUBVAR: + * + * Macros which declare an exportable variable + */ +#define XMLPUBVAR extern +/** + * XMLCALL: + * + * Macros which declare the called convention for exported functions + */ +#define XMLCALL +/** + * XMLCDECL: + * + * Macro which declares the calling convention for exported functions that + * use '...'. + */ +#define XMLCDECL + +/** DOC_DISABLE */ + +/* Windows platform with MS compiler */ +#if defined(_WIN32) && defined(_MSC_VER) + #undef XMLPUBFUN + #undef XMLPUBVAR + #undef XMLCALL + #undef XMLCDECL + #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) + #define XMLPUBFUN __declspec(dllexport) + #define XMLPUBVAR __declspec(dllexport) + #else + #define XMLPUBFUN + #if !defined(LIBXML_STATIC) + #define XMLPUBVAR __declspec(dllimport) extern + #else + #define XMLPUBVAR extern + #endif + #endif + #if defined(LIBXML_FASTCALL) + #define XMLCALL __fastcall + #else + #define XMLCALL __cdecl + #endif + #define XMLCDECL __cdecl + #if !defined _REENTRANT + #define _REENTRANT + #endif +#endif + +/* Windows platform with Borland compiler */ +#if defined(_WIN32) && defined(__BORLANDC__) + #undef XMLPUBFUN + #undef XMLPUBVAR + #undef XMLCALL + #undef XMLCDECL + #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) + #define XMLPUBFUN __declspec(dllexport) + #define XMLPUBVAR __declspec(dllexport) extern + #else + #define XMLPUBFUN + #if !defined(LIBXML_STATIC) + #define XMLPUBVAR __declspec(dllimport) extern + #else + #define XMLPUBVAR extern + #endif + #endif + #define XMLCALL __cdecl + #define XMLCDECL __cdecl + #if !defined _REENTRANT + #define _REENTRANT + #endif +#endif + +/* Windows platform with GNU compiler (Mingw) */ +#if defined(_WIN32) && defined(__MINGW32__) + #undef XMLPUBFUN + #undef XMLPUBVAR + #undef XMLCALL + #undef XMLCDECL + /* + * if defined(IN_LIBXML) this raises problems on mingw with msys + * _imp__xmlFree listed as missing. Try to workaround the problem + * by also making that declaration when compiling client code. + */ + #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) + #define XMLPUBFUN __declspec(dllexport) + #define XMLPUBVAR __declspec(dllexport) extern + #else + #define XMLPUBFUN + #if !defined(LIBXML_STATIC) + #define XMLPUBVAR __declspec(dllimport) extern + #else + #define XMLPUBVAR extern + #endif + #endif + #define XMLCALL __cdecl + #define XMLCDECL __cdecl + #if !defined _REENTRANT + #define _REENTRANT + #endif +#endif + +/* Cygwin platform (does not define _WIN32), GNU compiler */ +#if defined(__CYGWIN__) + #undef XMLPUBFUN + #undef XMLPUBVAR + #undef XMLCALL + #undef XMLCDECL + #if defined(IN_LIBXML) && !defined(LIBXML_STATIC) + #define XMLPUBFUN __declspec(dllexport) + #define XMLPUBVAR __declspec(dllexport) + #else + #define XMLPUBFUN + #if !defined(LIBXML_STATIC) + #define XMLPUBVAR __declspec(dllimport) extern + #else + #define XMLPUBVAR extern + #endif + #endif + #define XMLCALL __cdecl + #define XMLCDECL __cdecl +#endif + +/* Compatibility */ +#if !defined(LIBXML_DLL_IMPORT) +#define LIBXML_DLL_IMPORT XMLPUBVAR +#endif + +#endif /* __XML_EXPORTS_H__ */ + + diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlmemory.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlmemory.h new file mode 100644 index 0000000..17e375a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlmemory.h @@ -0,0 +1,224 @@ +/* + * Summary: interface for the memory allocator + * Description: provides interfaces for the memory allocator, + * including debugging capabilities. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + + +#ifndef __DEBUG_MEMORY_ALLOC__ +#define __DEBUG_MEMORY_ALLOC__ + +#include +#include + +/** + * DEBUG_MEMORY: + * + * DEBUG_MEMORY replaces the allocator with a collect and debug + * shell to the libc allocator. + * DEBUG_MEMORY should only be activated when debugging + * libxml i.e. if libxml has been configured with --with-debug-mem too. + */ +/* #define DEBUG_MEMORY_FREED */ +/* #define DEBUG_MEMORY_LOCATION */ + +#ifdef DEBUG +#ifndef DEBUG_MEMORY +#define DEBUG_MEMORY +#endif +#endif + +/** + * DEBUG_MEMORY_LOCATION: + * + * DEBUG_MEMORY_LOCATION should be activated only when debugging + * libxml i.e. if libxml has been configured with --with-debug-mem too. + */ +#ifdef DEBUG_MEMORY_LOCATION +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The XML memory wrapper support 4 basic overloadable functions. + */ +/** + * xmlFreeFunc: + * @mem: an already allocated block of memory + * + * Signature for a free() implementation. + */ +typedef void (XMLCALL *xmlFreeFunc)(void *mem); +/** + * xmlMallocFunc: + * @size: the size requested in bytes + * + * Signature for a malloc() implementation. + * + * Returns a pointer to the newly allocated block or NULL in case of error. + */ +typedef void *(LIBXML_ATTR_ALLOC_SIZE(1) XMLCALL *xmlMallocFunc)(size_t size); + +/** + * xmlReallocFunc: + * @mem: an already allocated block of memory + * @size: the new size requested in bytes + * + * Signature for a realloc() implementation. + * + * Returns a pointer to the newly reallocated block or NULL in case of error. + */ +typedef void *(XMLCALL *xmlReallocFunc)(void *mem, size_t size); + +/** + * xmlStrdupFunc: + * @str: a zero terminated string + * + * Signature for an strdup() implementation. + * + * Returns the copy of the string or NULL in case of error. + */ +typedef char *(XMLCALL *xmlStrdupFunc)(const char *str); + +/* + * The 4 interfaces used for all memory handling within libxml. +LIBXML_DLL_IMPORT xmlFreeFunc xmlFree; +LIBXML_DLL_IMPORT xmlMallocFunc xmlMalloc; +LIBXML_DLL_IMPORT xmlMallocFunc xmlMallocAtomic; +LIBXML_DLL_IMPORT xmlReallocFunc xmlRealloc; +LIBXML_DLL_IMPORT xmlStrdupFunc xmlMemStrdup; + */ + +/* + * The way to overload the existing functions. + * The xmlGc function have an extra entry for atomic block + * allocations useful for garbage collected memory allocators + */ +XMLPUBFUN int XMLCALL + xmlMemSetup (xmlFreeFunc freeFunc, + xmlMallocFunc mallocFunc, + xmlReallocFunc reallocFunc, + xmlStrdupFunc strdupFunc); +XMLPUBFUN int XMLCALL + xmlMemGet (xmlFreeFunc *freeFunc, + xmlMallocFunc *mallocFunc, + xmlReallocFunc *reallocFunc, + xmlStrdupFunc *strdupFunc); +XMLPUBFUN int XMLCALL + xmlGcMemSetup (xmlFreeFunc freeFunc, + xmlMallocFunc mallocFunc, + xmlMallocFunc mallocAtomicFunc, + xmlReallocFunc reallocFunc, + xmlStrdupFunc strdupFunc); +XMLPUBFUN int XMLCALL + xmlGcMemGet (xmlFreeFunc *freeFunc, + xmlMallocFunc *mallocFunc, + xmlMallocFunc *mallocAtomicFunc, + xmlReallocFunc *reallocFunc, + xmlStrdupFunc *strdupFunc); + +/* + * Initialization of the memory layer. + */ +XMLPUBFUN int XMLCALL + xmlInitMemory (void); + +/* + * Cleanup of the memory layer. + */ +XMLPUBFUN void XMLCALL + xmlCleanupMemory (void); +/* + * These are specific to the XML debug memory wrapper. + */ +XMLPUBFUN int XMLCALL + xmlMemUsed (void); +XMLPUBFUN int XMLCALL + xmlMemBlocks (void); +XMLPUBFUN void XMLCALL + xmlMemDisplay (FILE *fp); +XMLPUBFUN void XMLCALL + xmlMemDisplayLast(FILE *fp, long nbBytes); +XMLPUBFUN void XMLCALL + xmlMemShow (FILE *fp, int nr); +XMLPUBFUN void XMLCALL + xmlMemoryDump (void); +XMLPUBFUN void * XMLCALL + xmlMemMalloc (size_t size) LIBXML_ATTR_ALLOC_SIZE(1); +XMLPUBFUN void * XMLCALL + xmlMemRealloc (void *ptr,size_t size); +XMLPUBFUN void XMLCALL + xmlMemFree (void *ptr); +XMLPUBFUN char * XMLCALL + xmlMemoryStrdup (const char *str); +XMLPUBFUN void * XMLCALL + xmlMallocLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1); +XMLPUBFUN void * XMLCALL + xmlReallocLoc (void *ptr, size_t size, const char *file, int line); +XMLPUBFUN void * XMLCALL + xmlMallocAtomicLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1); +XMLPUBFUN char * XMLCALL + xmlMemStrdupLoc (const char *str, const char *file, int line); + + +#ifdef DEBUG_MEMORY_LOCATION +/** + * xmlMalloc: + * @size: number of bytes to allocate + * + * Wrapper for the malloc() function used in the XML library. + * + * Returns the pointer to the allocated area or NULL in case of error. + */ +#define xmlMalloc(size) xmlMallocLoc((size), __FILE__, __LINE__) +/** + * xmlMallocAtomic: + * @size: number of bytes to allocate + * + * Wrapper for the malloc() function used in the XML library for allocation + * of block not containing pointers to other areas. + * + * Returns the pointer to the allocated area or NULL in case of error. + */ +#define xmlMallocAtomic(size) xmlMallocAtomicLoc((size), __FILE__, __LINE__) +/** + * xmlRealloc: + * @ptr: pointer to the existing allocated area + * @size: number of bytes to allocate + * + * Wrapper for the realloc() function used in the XML library. + * + * Returns the pointer to the allocated area or NULL in case of error. + */ +#define xmlRealloc(ptr, size) xmlReallocLoc((ptr), (size), __FILE__, __LINE__) +/** + * xmlMemStrdup: + * @str: pointer to the existing string + * + * Wrapper for the strdup() function, xmlStrdup() is usually preferred. + * + * Returns the pointer to the allocated area or NULL in case of error. + */ +#define xmlMemStrdup(str) xmlMemStrdupLoc((str), __FILE__, __LINE__) + +#endif /* DEBUG_MEMORY_LOCATION */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#ifndef __XML_GLOBALS_H +#ifndef __XML_THREADS_H__ +#include +#include +#endif +#endif + +#endif /* __DEBUG_MEMORY_ALLOC__ */ + diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlmodule.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlmodule.h new file mode 100644 index 0000000..9667820 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlmodule.h @@ -0,0 +1,57 @@ +/* + * Summary: dynamic module loading + * Description: basic API for dynamic module loading, used by + * libexslt added in 2.6.17 + * + * Copy: See Copyright for the status of this software. + * + * Author: Joel W. Reed + */ + +#ifndef __XML_MODULE_H__ +#define __XML_MODULE_H__ + +#include + +#ifdef LIBXML_MODULES_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlModulePtr: + * + * A handle to a dynamically loaded module + */ +typedef struct _xmlModule xmlModule; +typedef xmlModule *xmlModulePtr; + +/** + * xmlModuleOption: + * + * enumeration of options that can be passed down to xmlModuleOpen() + */ +typedef enum { + XML_MODULE_LAZY = 1, /* lazy binding */ + XML_MODULE_LOCAL= 2 /* local binding */ +} xmlModuleOption; + +XMLPUBFUN xmlModulePtr XMLCALL xmlModuleOpen (const char *filename, + int options); + +XMLPUBFUN int XMLCALL xmlModuleSymbol (xmlModulePtr module, + const char* name, + void **result); + +XMLPUBFUN int XMLCALL xmlModuleClose (xmlModulePtr module); + +XMLPUBFUN int XMLCALL xmlModuleFree (xmlModulePtr module); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_MODULES_ENABLED */ + +#endif /*__XML_MODULE_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlreader.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlreader.h new file mode 100644 index 0000000..e8a8bcc --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlreader.h @@ -0,0 +1,428 @@ +/* + * Summary: the XMLReader implementation + * Description: API of the XML streaming API based on C# interfaces. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XMLREADER_H__ +#define __XML_XMLREADER_H__ + +#include +#include +#include +#ifdef LIBXML_SCHEMAS_ENABLED +#include +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlParserSeverities: + * + * How severe an error callback is when the per-reader error callback API + * is used. + */ +typedef enum { + XML_PARSER_SEVERITY_VALIDITY_WARNING = 1, + XML_PARSER_SEVERITY_VALIDITY_ERROR = 2, + XML_PARSER_SEVERITY_WARNING = 3, + XML_PARSER_SEVERITY_ERROR = 4 +} xmlParserSeverities; + +#ifdef LIBXML_READER_ENABLED + +/** + * xmlTextReaderMode: + * + * Internal state values for the reader. + */ +typedef enum { + XML_TEXTREADER_MODE_INITIAL = 0, + XML_TEXTREADER_MODE_INTERACTIVE = 1, + XML_TEXTREADER_MODE_ERROR = 2, + XML_TEXTREADER_MODE_EOF =3, + XML_TEXTREADER_MODE_CLOSED = 4, + XML_TEXTREADER_MODE_READING = 5 +} xmlTextReaderMode; + +/** + * xmlParserProperties: + * + * Some common options to use with xmlTextReaderSetParserProp, but it + * is better to use xmlParserOption and the xmlReaderNewxxx and + * xmlReaderForxxx APIs now. + */ +typedef enum { + XML_PARSER_LOADDTD = 1, + XML_PARSER_DEFAULTATTRS = 2, + XML_PARSER_VALIDATE = 3, + XML_PARSER_SUBST_ENTITIES = 4 +} xmlParserProperties; + +/** + * xmlReaderTypes: + * + * Predefined constants for the different types of nodes. + */ +typedef enum { + XML_READER_TYPE_NONE = 0, + XML_READER_TYPE_ELEMENT = 1, + XML_READER_TYPE_ATTRIBUTE = 2, + XML_READER_TYPE_TEXT = 3, + XML_READER_TYPE_CDATA = 4, + XML_READER_TYPE_ENTITY_REFERENCE = 5, + XML_READER_TYPE_ENTITY = 6, + XML_READER_TYPE_PROCESSING_INSTRUCTION = 7, + XML_READER_TYPE_COMMENT = 8, + XML_READER_TYPE_DOCUMENT = 9, + XML_READER_TYPE_DOCUMENT_TYPE = 10, + XML_READER_TYPE_DOCUMENT_FRAGMENT = 11, + XML_READER_TYPE_NOTATION = 12, + XML_READER_TYPE_WHITESPACE = 13, + XML_READER_TYPE_SIGNIFICANT_WHITESPACE = 14, + XML_READER_TYPE_END_ELEMENT = 15, + XML_READER_TYPE_END_ENTITY = 16, + XML_READER_TYPE_XML_DECLARATION = 17 +} xmlReaderTypes; + +/** + * xmlTextReader: + * + * Structure for an xmlReader context. + */ +typedef struct _xmlTextReader xmlTextReader; + +/** + * xmlTextReaderPtr: + * + * Pointer to an xmlReader context. + */ +typedef xmlTextReader *xmlTextReaderPtr; + +/* + * Constructors & Destructor + */ +XMLPUBFUN xmlTextReaderPtr XMLCALL + xmlNewTextReader (xmlParserInputBufferPtr input, + const char *URI); +XMLPUBFUN xmlTextReaderPtr XMLCALL + xmlNewTextReaderFilename(const char *URI); + +XMLPUBFUN void XMLCALL + xmlFreeTextReader (xmlTextReaderPtr reader); + +XMLPUBFUN int XMLCALL + xmlTextReaderSetup(xmlTextReaderPtr reader, + xmlParserInputBufferPtr input, const char *URL, + const char *encoding, int options); + +/* + * Iterators + */ +XMLPUBFUN int XMLCALL + xmlTextReaderRead (xmlTextReaderPtr reader); + +#ifdef LIBXML_WRITER_ENABLED +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderReadInnerXml(xmlTextReaderPtr reader); + +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderReadOuterXml(xmlTextReaderPtr reader); +#endif + +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderReadString (xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderReadAttributeValue(xmlTextReaderPtr reader); + +/* + * Attributes of the node + */ +XMLPUBFUN int XMLCALL + xmlTextReaderAttributeCount(xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderDepth (xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderHasAttributes(xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderHasValue(xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderIsDefault (xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderNodeType (xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderQuoteChar (xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderReadState (xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader); + +XMLPUBFUN const xmlChar * XMLCALL + xmlTextReaderConstBaseUri (xmlTextReaderPtr reader); +XMLPUBFUN const xmlChar * XMLCALL + xmlTextReaderConstLocalName (xmlTextReaderPtr reader); +XMLPUBFUN const xmlChar * XMLCALL + xmlTextReaderConstName (xmlTextReaderPtr reader); +XMLPUBFUN const xmlChar * XMLCALL + xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader); +XMLPUBFUN const xmlChar * XMLCALL + xmlTextReaderConstPrefix (xmlTextReaderPtr reader); +XMLPUBFUN const xmlChar * XMLCALL + xmlTextReaderConstXmlLang (xmlTextReaderPtr reader); +XMLPUBFUN const xmlChar * XMLCALL + xmlTextReaderConstString (xmlTextReaderPtr reader, + const xmlChar *str); +XMLPUBFUN const xmlChar * XMLCALL + xmlTextReaderConstValue (xmlTextReaderPtr reader); + +/* + * use the Const version of the routine for + * better performance and simpler code + */ +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderBaseUri (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderLocalName (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderName (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderNamespaceUri(xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderPrefix (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderXmlLang (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderValue (xmlTextReaderPtr reader); + +/* + * Methods of the XmlTextReader + */ +XMLPUBFUN int XMLCALL + xmlTextReaderClose (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderGetAttributeNo (xmlTextReaderPtr reader, + int no); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderGetAttribute (xmlTextReaderPtr reader, + const xmlChar *name); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderGetAttributeNs (xmlTextReaderPtr reader, + const xmlChar *localName, + const xmlChar *namespaceURI); +XMLPUBFUN xmlParserInputBufferPtr XMLCALL + xmlTextReaderGetRemainder (xmlTextReaderPtr reader); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderLookupNamespace(xmlTextReaderPtr reader, + const xmlChar *prefix); +XMLPUBFUN int XMLCALL + xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr reader, + int no); +XMLPUBFUN int XMLCALL + xmlTextReaderMoveToAttribute(xmlTextReaderPtr reader, + const xmlChar *name); +XMLPUBFUN int XMLCALL + xmlTextReaderMoveToAttributeNs(xmlTextReaderPtr reader, + const xmlChar *localName, + const xmlChar *namespaceURI); +XMLPUBFUN int XMLCALL + xmlTextReaderMoveToFirstAttribute(xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderMoveToNextAttribute(xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderMoveToElement (xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderNormalization (xmlTextReaderPtr reader); +XMLPUBFUN const xmlChar * XMLCALL + xmlTextReaderConstEncoding (xmlTextReaderPtr reader); + +/* + * Extensions + */ +XMLPUBFUN int XMLCALL + xmlTextReaderSetParserProp (xmlTextReaderPtr reader, + int prop, + int value); +XMLPUBFUN int XMLCALL + xmlTextReaderGetParserProp (xmlTextReaderPtr reader, + int prop); +XMLPUBFUN xmlNodePtr XMLCALL + xmlTextReaderCurrentNode (xmlTextReaderPtr reader); + +XMLPUBFUN int XMLCALL + xmlTextReaderGetParserLineNumber(xmlTextReaderPtr reader); + +XMLPUBFUN int XMLCALL + xmlTextReaderGetParserColumnNumber(xmlTextReaderPtr reader); + +XMLPUBFUN xmlNodePtr XMLCALL + xmlTextReaderPreserve (xmlTextReaderPtr reader); +#ifdef LIBXML_PATTERN_ENABLED +XMLPUBFUN int XMLCALL + xmlTextReaderPreservePattern(xmlTextReaderPtr reader, + const xmlChar *pattern, + const xmlChar **namespaces); +#endif /* LIBXML_PATTERN_ENABLED */ +XMLPUBFUN xmlDocPtr XMLCALL + xmlTextReaderCurrentDoc (xmlTextReaderPtr reader); +XMLPUBFUN xmlNodePtr XMLCALL + xmlTextReaderExpand (xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderNext (xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderNextSibling (xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderIsValid (xmlTextReaderPtr reader); +#ifdef LIBXML_SCHEMAS_ENABLED +XMLPUBFUN int XMLCALL + xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader, + const char *rng); +XMLPUBFUN int XMLCALL + xmlTextReaderRelaxNGValidateCtxt(xmlTextReaderPtr reader, + xmlRelaxNGValidCtxtPtr ctxt, + int options); + +XMLPUBFUN int XMLCALL + xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader, + xmlRelaxNGPtr schema); +XMLPUBFUN int XMLCALL + xmlTextReaderSchemaValidate (xmlTextReaderPtr reader, + const char *xsd); +XMLPUBFUN int XMLCALL + xmlTextReaderSchemaValidateCtxt(xmlTextReaderPtr reader, + xmlSchemaValidCtxtPtr ctxt, + int options); +XMLPUBFUN int XMLCALL + xmlTextReaderSetSchema (xmlTextReaderPtr reader, + xmlSchemaPtr schema); +#endif +XMLPUBFUN const xmlChar * XMLCALL + xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader); +XMLPUBFUN int XMLCALL + xmlTextReaderStandalone (xmlTextReaderPtr reader); + + +/* + * Index lookup + */ +XMLPUBFUN long XMLCALL + xmlTextReaderByteConsumed (xmlTextReaderPtr reader); + +/* + * New more complete APIs for simpler creation and reuse of readers + */ +XMLPUBFUN xmlTextReaderPtr XMLCALL + xmlReaderWalker (xmlDocPtr doc); +XMLPUBFUN xmlTextReaderPtr XMLCALL + xmlReaderForDoc (const xmlChar * cur, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlTextReaderPtr XMLCALL + xmlReaderForFile (const char *filename, + const char *encoding, + int options); +XMLPUBFUN xmlTextReaderPtr XMLCALL + xmlReaderForMemory (const char *buffer, + int size, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlTextReaderPtr XMLCALL + xmlReaderForFd (int fd, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN xmlTextReaderPtr XMLCALL + xmlReaderForIO (xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + const char *URL, + const char *encoding, + int options); + +XMLPUBFUN int XMLCALL + xmlReaderNewWalker (xmlTextReaderPtr reader, + xmlDocPtr doc); +XMLPUBFUN int XMLCALL + xmlReaderNewDoc (xmlTextReaderPtr reader, + const xmlChar * cur, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN int XMLCALL + xmlReaderNewFile (xmlTextReaderPtr reader, + const char *filename, + const char *encoding, + int options); +XMLPUBFUN int XMLCALL + xmlReaderNewMemory (xmlTextReaderPtr reader, + const char *buffer, + int size, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN int XMLCALL + xmlReaderNewFd (xmlTextReaderPtr reader, + int fd, + const char *URL, + const char *encoding, + int options); +XMLPUBFUN int XMLCALL + xmlReaderNewIO (xmlTextReaderPtr reader, + xmlInputReadCallback ioread, + xmlInputCloseCallback ioclose, + void *ioctx, + const char *URL, + const char *encoding, + int options); +/* + * Error handling extensions + */ +typedef void * xmlTextReaderLocatorPtr; + +/** + * xmlTextReaderErrorFunc: + * @arg: the user argument + * @msg: the message + * @severity: the severity of the error + * @locator: a locator indicating where the error occurred + * + * Signature of an error callback from a reader parser + */ +typedef void (XMLCALL *xmlTextReaderErrorFunc)(void *arg, + const char *msg, + xmlParserSeverities severity, + xmlTextReaderLocatorPtr locator); +XMLPUBFUN int XMLCALL + xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator); +XMLPUBFUN xmlChar * XMLCALL + xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator); +XMLPUBFUN void XMLCALL + xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader, + xmlTextReaderErrorFunc f, + void *arg); +XMLPUBFUN void XMLCALL + xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader, + xmlStructuredErrorFunc f, + void *arg); +XMLPUBFUN void XMLCALL + xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader, + xmlTextReaderErrorFunc *f, + void **arg); + +#endif /* LIBXML_READER_ENABLED */ + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_XMLREADER_H__ */ + diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlregexp.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlregexp.h new file mode 100644 index 0000000..7009645 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlregexp.h @@ -0,0 +1,222 @@ +/* + * Summary: regular expressions handling + * Description: basic API for libxml regular expressions handling used + * for XML Schemas and validation. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_REGEXP_H__ +#define __XML_REGEXP_H__ + +#include + +#ifdef LIBXML_REGEXP_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlRegexpPtr: + * + * A libxml regular expression, they can actually be far more complex + * thank the POSIX regex expressions. + */ +typedef struct _xmlRegexp xmlRegexp; +typedef xmlRegexp *xmlRegexpPtr; + +/** + * xmlRegExecCtxtPtr: + * + * A libxml progressive regular expression evaluation context + */ +typedef struct _xmlRegExecCtxt xmlRegExecCtxt; +typedef xmlRegExecCtxt *xmlRegExecCtxtPtr; + +#ifdef __cplusplus +} +#endif +#include +#include +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The POSIX like API + */ +XMLPUBFUN xmlRegexpPtr XMLCALL + xmlRegexpCompile (const xmlChar *regexp); +XMLPUBFUN void XMLCALL xmlRegFreeRegexp(xmlRegexpPtr regexp); +XMLPUBFUN int XMLCALL + xmlRegexpExec (xmlRegexpPtr comp, + const xmlChar *value); +XMLPUBFUN void XMLCALL + xmlRegexpPrint (FILE *output, + xmlRegexpPtr regexp); +XMLPUBFUN int XMLCALL + xmlRegexpIsDeterminist(xmlRegexpPtr comp); + +/** + * xmlRegExecCallbacks: + * @exec: the regular expression context + * @token: the current token string + * @transdata: transition data + * @inputdata: input data + * + * Callback function when doing a transition in the automata + */ +typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec, + const xmlChar *token, + void *transdata, + void *inputdata); + +/* + * The progressive API + */ +XMLPUBFUN xmlRegExecCtxtPtr XMLCALL + xmlRegNewExecCtxt (xmlRegexpPtr comp, + xmlRegExecCallbacks callback, + void *data); +XMLPUBFUN void XMLCALL + xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec); +XMLPUBFUN int XMLCALL + xmlRegExecPushString(xmlRegExecCtxtPtr exec, + const xmlChar *value, + void *data); +XMLPUBFUN int XMLCALL + xmlRegExecPushString2(xmlRegExecCtxtPtr exec, + const xmlChar *value, + const xmlChar *value2, + void *data); + +XMLPUBFUN int XMLCALL + xmlRegExecNextValues(xmlRegExecCtxtPtr exec, + int *nbval, + int *nbneg, + xmlChar **values, + int *terminal); +XMLPUBFUN int XMLCALL + xmlRegExecErrInfo (xmlRegExecCtxtPtr exec, + const xmlChar **string, + int *nbval, + int *nbneg, + xmlChar **values, + int *terminal); +#ifdef LIBXML_EXPR_ENABLED +/* + * Formal regular expression handling + * Its goal is to do some formal work on content models + */ + +/* expressions are used within a context */ +typedef struct _xmlExpCtxt xmlExpCtxt; +typedef xmlExpCtxt *xmlExpCtxtPtr; + +XMLPUBFUN void XMLCALL + xmlExpFreeCtxt (xmlExpCtxtPtr ctxt); +XMLPUBFUN xmlExpCtxtPtr XMLCALL + xmlExpNewCtxt (int maxNodes, + xmlDictPtr dict); + +XMLPUBFUN int XMLCALL + xmlExpCtxtNbNodes(xmlExpCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlExpCtxtNbCons(xmlExpCtxtPtr ctxt); + +/* Expressions are trees but the tree is opaque */ +typedef struct _xmlExpNode xmlExpNode; +typedef xmlExpNode *xmlExpNodePtr; + +typedef enum { + XML_EXP_EMPTY = 0, + XML_EXP_FORBID = 1, + XML_EXP_ATOM = 2, + XML_EXP_SEQ = 3, + XML_EXP_OR = 4, + XML_EXP_COUNT = 5 +} xmlExpNodeType; + +/* + * 2 core expressions shared by all for the empty language set + * and for the set with just the empty token + */ +XMLPUBVAR xmlExpNodePtr forbiddenExp; +XMLPUBVAR xmlExpNodePtr emptyExp; + +/* + * Expressions are reference counted internally + */ +XMLPUBFUN void XMLCALL + xmlExpFree (xmlExpCtxtPtr ctxt, + xmlExpNodePtr expr); +XMLPUBFUN void XMLCALL + xmlExpRef (xmlExpNodePtr expr); + +/* + * constructors can be either manual or from a string + */ +XMLPUBFUN xmlExpNodePtr XMLCALL + xmlExpParse (xmlExpCtxtPtr ctxt, + const char *expr); +XMLPUBFUN xmlExpNodePtr XMLCALL + xmlExpNewAtom (xmlExpCtxtPtr ctxt, + const xmlChar *name, + int len); +XMLPUBFUN xmlExpNodePtr XMLCALL + xmlExpNewOr (xmlExpCtxtPtr ctxt, + xmlExpNodePtr left, + xmlExpNodePtr right); +XMLPUBFUN xmlExpNodePtr XMLCALL + xmlExpNewSeq (xmlExpCtxtPtr ctxt, + xmlExpNodePtr left, + xmlExpNodePtr right); +XMLPUBFUN xmlExpNodePtr XMLCALL + xmlExpNewRange (xmlExpCtxtPtr ctxt, + xmlExpNodePtr subset, + int min, + int max); +/* + * The really interesting APIs + */ +XMLPUBFUN int XMLCALL + xmlExpIsNillable(xmlExpNodePtr expr); +XMLPUBFUN int XMLCALL + xmlExpMaxToken (xmlExpNodePtr expr); +XMLPUBFUN int XMLCALL + xmlExpGetLanguage(xmlExpCtxtPtr ctxt, + xmlExpNodePtr expr, + const xmlChar**langList, + int len); +XMLPUBFUN int XMLCALL + xmlExpGetStart (xmlExpCtxtPtr ctxt, + xmlExpNodePtr expr, + const xmlChar**tokList, + int len); +XMLPUBFUN xmlExpNodePtr XMLCALL + xmlExpStringDerive(xmlExpCtxtPtr ctxt, + xmlExpNodePtr expr, + const xmlChar *str, + int len); +XMLPUBFUN xmlExpNodePtr XMLCALL + xmlExpExpDerive (xmlExpCtxtPtr ctxt, + xmlExpNodePtr expr, + xmlExpNodePtr sub); +XMLPUBFUN int XMLCALL + xmlExpSubsume (xmlExpCtxtPtr ctxt, + xmlExpNodePtr expr, + xmlExpNodePtr sub); +XMLPUBFUN void XMLCALL + xmlExpDump (xmlBufferPtr buf, + xmlExpNodePtr expr); +#endif /* LIBXML_EXPR_ENABLED */ +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_REGEXP_ENABLED */ + +#endif /*__XML_REGEXP_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlsave.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlsave.h new file mode 100644 index 0000000..fb329b2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlsave.h @@ -0,0 +1,88 @@ +/* + * Summary: the XML document serializer + * Description: API to save document or subtree of document + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XMLSAVE_H__ +#define __XML_XMLSAVE_H__ + +#include +#include +#include +#include + +#ifdef LIBXML_OUTPUT_ENABLED +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlSaveOption: + * + * This is the set of XML save options that can be passed down + * to the xmlSaveToFd() and similar calls. + */ +typedef enum { + XML_SAVE_FORMAT = 1<<0, /* format save output */ + XML_SAVE_NO_DECL = 1<<1, /* drop the xml declaration */ + XML_SAVE_NO_EMPTY = 1<<2, /* no empty tags */ + XML_SAVE_NO_XHTML = 1<<3, /* disable XHTML1 specific rules */ + XML_SAVE_XHTML = 1<<4, /* force XHTML1 specific rules */ + XML_SAVE_AS_XML = 1<<5, /* force XML serialization on HTML doc */ + XML_SAVE_AS_HTML = 1<<6, /* force HTML serialization on XML doc */ + XML_SAVE_WSNONSIG = 1<<7 /* format with non-significant whitespace */ +} xmlSaveOption; + + +typedef struct _xmlSaveCtxt xmlSaveCtxt; +typedef xmlSaveCtxt *xmlSaveCtxtPtr; + +XMLPUBFUN xmlSaveCtxtPtr XMLCALL + xmlSaveToFd (int fd, + const char *encoding, + int options); +XMLPUBFUN xmlSaveCtxtPtr XMLCALL + xmlSaveToFilename (const char *filename, + const char *encoding, + int options); + +XMLPUBFUN xmlSaveCtxtPtr XMLCALL + xmlSaveToBuffer (xmlBufferPtr buffer, + const char *encoding, + int options); + +XMLPUBFUN xmlSaveCtxtPtr XMLCALL + xmlSaveToIO (xmlOutputWriteCallback iowrite, + xmlOutputCloseCallback ioclose, + void *ioctx, + const char *encoding, + int options); + +XMLPUBFUN long XMLCALL + xmlSaveDoc (xmlSaveCtxtPtr ctxt, + xmlDocPtr doc); +XMLPUBFUN long XMLCALL + xmlSaveTree (xmlSaveCtxtPtr ctxt, + xmlNodePtr node); + +XMLPUBFUN int XMLCALL + xmlSaveFlush (xmlSaveCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlSaveClose (xmlSaveCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlSaveSetEscape (xmlSaveCtxtPtr ctxt, + xmlCharEncodingOutputFunc escape); +XMLPUBFUN int XMLCALL + xmlSaveSetAttrEscape (xmlSaveCtxtPtr ctxt, + xmlCharEncodingOutputFunc escape); +#ifdef __cplusplus +} +#endif +#endif /* LIBXML_OUTPUT_ENABLED */ +#endif /* __XML_XMLSAVE_H__ */ + + diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlschemas.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlschemas.h new file mode 100644 index 0000000..97930c7 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlschemas.h @@ -0,0 +1,246 @@ +/* + * Summary: incomplete XML Schemas structure implementation + * Description: interface to the XML Schemas handling and schema validity + * checking, it is incomplete right now. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + + +#ifndef __XML_SCHEMA_H__ +#define __XML_SCHEMA_H__ + +#include + +#ifdef LIBXML_SCHEMAS_ENABLED + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * This error codes are obsolete; not used any more. + */ +typedef enum { + XML_SCHEMAS_ERR_OK = 0, + XML_SCHEMAS_ERR_NOROOT = 1, + XML_SCHEMAS_ERR_UNDECLAREDELEM, + XML_SCHEMAS_ERR_NOTTOPLEVEL, + XML_SCHEMAS_ERR_MISSING, + XML_SCHEMAS_ERR_WRONGELEM, + XML_SCHEMAS_ERR_NOTYPE, + XML_SCHEMAS_ERR_NOROLLBACK, + XML_SCHEMAS_ERR_ISABSTRACT, + XML_SCHEMAS_ERR_NOTEMPTY, + XML_SCHEMAS_ERR_ELEMCONT, + XML_SCHEMAS_ERR_HAVEDEFAULT, + XML_SCHEMAS_ERR_NOTNILLABLE, + XML_SCHEMAS_ERR_EXTRACONTENT, + XML_SCHEMAS_ERR_INVALIDATTR, + XML_SCHEMAS_ERR_INVALIDELEM, + XML_SCHEMAS_ERR_NOTDETERMINIST, + XML_SCHEMAS_ERR_CONSTRUCT, + XML_SCHEMAS_ERR_INTERNAL, + XML_SCHEMAS_ERR_NOTSIMPLE, + XML_SCHEMAS_ERR_ATTRUNKNOWN, + XML_SCHEMAS_ERR_ATTRINVALID, + XML_SCHEMAS_ERR_VALUE, + XML_SCHEMAS_ERR_FACET, + XML_SCHEMAS_ERR_, + XML_SCHEMAS_ERR_XXX +} xmlSchemaValidError; + +/* +* ATTENTION: Change xmlSchemaSetValidOptions's check +* for invalid values, if adding to the validation +* options below. +*/ +/** + * xmlSchemaValidOption: + * + * This is the set of XML Schema validation options. + */ +typedef enum { + XML_SCHEMA_VAL_VC_I_CREATE = 1<<0 + /* Default/fixed: create an attribute node + * or an element's text node on the instance. + */ +} xmlSchemaValidOption; + +/* + XML_SCHEMA_VAL_XSI_ASSEMBLE = 1<<1, + * assemble schemata using + * xsi:schemaLocation and + * xsi:noNamespaceSchemaLocation +*/ + +/** + * The schemas related types are kept internal + */ +typedef struct _xmlSchema xmlSchema; +typedef xmlSchema *xmlSchemaPtr; + +/** + * xmlSchemaValidityErrorFunc: + * @ctx: the validation context + * @msg: the message + * @...: extra arguments + * + * Signature of an error callback from an XSD validation + */ +typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) + (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); + +/** + * xmlSchemaValidityWarningFunc: + * @ctx: the validation context + * @msg: the message + * @...: extra arguments + * + * Signature of a warning callback from an XSD validation + */ +typedef void (XMLCDECL *xmlSchemaValidityWarningFunc) + (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); + +/** + * A schemas validation context + */ +typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt; +typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr; + +typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt; +typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr; + +/** + * xmlSchemaValidityLocatorFunc: + * @ctx: user provided context + * @file: returned file information + * @line: returned line information + * + * A schemas validation locator, a callback called by the validator. + * This is used when file or node informations are not available + * to find out what file and line number are affected + * + * Returns: 0 in case of success and -1 in case of error + */ + +typedef int (XMLCDECL *xmlSchemaValidityLocatorFunc) (void *ctx, + const char **file, unsigned long *line); + +/* + * Interfaces for parsing. + */ +XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL + xmlSchemaNewParserCtxt (const char *URL); +XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL + xmlSchemaNewMemParserCtxt (const char *buffer, + int size); +XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL + xmlSchemaNewDocParserCtxt (xmlDocPtr doc); +XMLPUBFUN void XMLCALL + xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt, + xmlSchemaValidityErrorFunc err, + xmlSchemaValidityWarningFunc warn, + void *ctx); +XMLPUBFUN void XMLCALL + xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt, + xmlStructuredErrorFunc serror, + void *ctx); +XMLPUBFUN int XMLCALL + xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt, + xmlSchemaValidityErrorFunc * err, + xmlSchemaValidityWarningFunc * warn, + void **ctx); +XMLPUBFUN int XMLCALL + xmlSchemaIsValid (xmlSchemaValidCtxtPtr ctxt); + +XMLPUBFUN xmlSchemaPtr XMLCALL + xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt); +XMLPUBFUN void XMLCALL + xmlSchemaFree (xmlSchemaPtr schema); +#ifdef LIBXML_OUTPUT_ENABLED +XMLPUBFUN void XMLCALL + xmlSchemaDump (FILE *output, + xmlSchemaPtr schema); +#endif /* LIBXML_OUTPUT_ENABLED */ +/* + * Interfaces for validating + */ +XMLPUBFUN void XMLCALL + xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt, + xmlSchemaValidityErrorFunc err, + xmlSchemaValidityWarningFunc warn, + void *ctx); +XMLPUBFUN void XMLCALL + xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt, + xmlStructuredErrorFunc serror, + void *ctx); +XMLPUBFUN int XMLCALL + xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt, + xmlSchemaValidityErrorFunc *err, + xmlSchemaValidityWarningFunc *warn, + void **ctx); +XMLPUBFUN int XMLCALL + xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt, + int options); +XMLPUBFUN void XMLCALL + xmlSchemaValidateSetFilename(xmlSchemaValidCtxtPtr vctxt, + const char *filename); +XMLPUBFUN int XMLCALL + xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt); + +XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL + xmlSchemaNewValidCtxt (xmlSchemaPtr schema); +XMLPUBFUN void XMLCALL + xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt); +XMLPUBFUN int XMLCALL + xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt, + xmlDocPtr instance); +XMLPUBFUN int XMLCALL + xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt, + xmlNodePtr elem); +XMLPUBFUN int XMLCALL + xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt, + xmlParserInputBufferPtr input, + xmlCharEncoding enc, + xmlSAXHandlerPtr sax, + void *user_data); +XMLPUBFUN int XMLCALL + xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt, + const char * filename, + int options); + +XMLPUBFUN xmlParserCtxtPtr XMLCALL + xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt); + +/* + * Interface to insert Schemas SAX validation in a SAX stream + */ +typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct; +typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr; + +XMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL + xmlSchemaSAXPlug (xmlSchemaValidCtxtPtr ctxt, + xmlSAXHandlerPtr *sax, + void **user_data); +XMLPUBFUN int XMLCALL + xmlSchemaSAXUnplug (xmlSchemaSAXPlugPtr plug); + + +XMLPUBFUN void XMLCALL + xmlSchemaValidateSetLocator (xmlSchemaValidCtxtPtr vctxt, + xmlSchemaValidityLocatorFunc f, + void *ctxt); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_SCHEMAS_ENABLED */ +#endif /* __XML_SCHEMA_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlschemastypes.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlschemastypes.h new file mode 100644 index 0000000..35d48d4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlschemastypes.h @@ -0,0 +1,151 @@ +/* + * Summary: implementation of XML Schema Datatypes + * Description: module providing the XML Schema Datatypes implementation + * both definition and validity checking + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + + +#ifndef __XML_SCHEMA_TYPES_H__ +#define __XML_SCHEMA_TYPES_H__ + +#include + +#ifdef LIBXML_SCHEMAS_ENABLED + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + XML_SCHEMA_WHITESPACE_UNKNOWN = 0, + XML_SCHEMA_WHITESPACE_PRESERVE = 1, + XML_SCHEMA_WHITESPACE_REPLACE = 2, + XML_SCHEMA_WHITESPACE_COLLAPSE = 3 +} xmlSchemaWhitespaceValueType; + +XMLPUBFUN void XMLCALL + xmlSchemaInitTypes (void); +XMLPUBFUN void XMLCALL + xmlSchemaCleanupTypes (void); +XMLPUBFUN xmlSchemaTypePtr XMLCALL + xmlSchemaGetPredefinedType (const xmlChar *name, + const xmlChar *ns); +XMLPUBFUN int XMLCALL + xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type, + const xmlChar *value, + xmlSchemaValPtr *val); +XMLPUBFUN int XMLCALL + xmlSchemaValPredefTypeNode (xmlSchemaTypePtr type, + const xmlChar *value, + xmlSchemaValPtr *val, + xmlNodePtr node); +XMLPUBFUN int XMLCALL + xmlSchemaValidateFacet (xmlSchemaTypePtr base, + xmlSchemaFacetPtr facet, + const xmlChar *value, + xmlSchemaValPtr val); +XMLPUBFUN int XMLCALL + xmlSchemaValidateFacetWhtsp (xmlSchemaFacetPtr facet, + xmlSchemaWhitespaceValueType fws, + xmlSchemaValType valType, + const xmlChar *value, + xmlSchemaValPtr val, + xmlSchemaWhitespaceValueType ws); +XMLPUBFUN void XMLCALL + xmlSchemaFreeValue (xmlSchemaValPtr val); +XMLPUBFUN xmlSchemaFacetPtr XMLCALL + xmlSchemaNewFacet (void); +XMLPUBFUN int XMLCALL + xmlSchemaCheckFacet (xmlSchemaFacetPtr facet, + xmlSchemaTypePtr typeDecl, + xmlSchemaParserCtxtPtr ctxt, + const xmlChar *name); +XMLPUBFUN void XMLCALL + xmlSchemaFreeFacet (xmlSchemaFacetPtr facet); +XMLPUBFUN int XMLCALL + xmlSchemaCompareValues (xmlSchemaValPtr x, + xmlSchemaValPtr y); +XMLPUBFUN xmlSchemaTypePtr XMLCALL + xmlSchemaGetBuiltInListSimpleTypeItemType (xmlSchemaTypePtr type); +XMLPUBFUN int XMLCALL + xmlSchemaValidateListSimpleTypeFacet (xmlSchemaFacetPtr facet, + const xmlChar *value, + unsigned long actualLen, + unsigned long *expectedLen); +XMLPUBFUN xmlSchemaTypePtr XMLCALL + xmlSchemaGetBuiltInType (xmlSchemaValType type); +XMLPUBFUN int XMLCALL + xmlSchemaIsBuiltInTypeFacet (xmlSchemaTypePtr type, + int facetType); +XMLPUBFUN xmlChar * XMLCALL + xmlSchemaCollapseString (const xmlChar *value); +XMLPUBFUN xmlChar * XMLCALL + xmlSchemaWhiteSpaceReplace (const xmlChar *value); +XMLPUBFUN unsigned long XMLCALL + xmlSchemaGetFacetValueAsULong (xmlSchemaFacetPtr facet); +XMLPUBFUN int XMLCALL + xmlSchemaValidateLengthFacet (xmlSchemaTypePtr type, + xmlSchemaFacetPtr facet, + const xmlChar *value, + xmlSchemaValPtr val, + unsigned long *length); +XMLPUBFUN int XMLCALL + xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr facet, + xmlSchemaValType valType, + const xmlChar *value, + xmlSchemaValPtr val, + unsigned long *length, + xmlSchemaWhitespaceValueType ws); +XMLPUBFUN int XMLCALL + xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type, + const xmlChar *value, + xmlSchemaValPtr *val, + xmlNodePtr node); +XMLPUBFUN int XMLCALL + xmlSchemaGetCanonValue (xmlSchemaValPtr val, + const xmlChar **retValue); +XMLPUBFUN int XMLCALL + xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val, + const xmlChar **retValue, + xmlSchemaWhitespaceValueType ws); +XMLPUBFUN int XMLCALL + xmlSchemaValueAppend (xmlSchemaValPtr prev, + xmlSchemaValPtr cur); +XMLPUBFUN xmlSchemaValPtr XMLCALL + xmlSchemaValueGetNext (xmlSchemaValPtr cur); +XMLPUBFUN const xmlChar * XMLCALL + xmlSchemaValueGetAsString (xmlSchemaValPtr val); +XMLPUBFUN int XMLCALL + xmlSchemaValueGetAsBoolean (xmlSchemaValPtr val); +XMLPUBFUN xmlSchemaValPtr XMLCALL + xmlSchemaNewStringValue (xmlSchemaValType type, + const xmlChar *value); +XMLPUBFUN xmlSchemaValPtr XMLCALL + xmlSchemaNewNOTATIONValue (const xmlChar *name, + const xmlChar *ns); +XMLPUBFUN xmlSchemaValPtr XMLCALL + xmlSchemaNewQNameValue (const xmlChar *namespaceName, + const xmlChar *localName); +XMLPUBFUN int XMLCALL + xmlSchemaCompareValuesWhtsp (xmlSchemaValPtr x, + xmlSchemaWhitespaceValueType xws, + xmlSchemaValPtr y, + xmlSchemaWhitespaceValueType yws); +XMLPUBFUN xmlSchemaValPtr XMLCALL + xmlSchemaCopyValue (xmlSchemaValPtr val); +XMLPUBFUN xmlSchemaValType XMLCALL + xmlSchemaGetValType (xmlSchemaValPtr val); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_SCHEMAS_ENABLED */ +#endif /* __XML_SCHEMA_TYPES_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlstring.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlstring.h new file mode 100644 index 0000000..2d0b2d1 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlstring.h @@ -0,0 +1,140 @@ +/* + * Summary: set of routines to process strings + * Description: type and interfaces needed for the internal string handling + * of the library, especially UTF8 processing. + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_STRING_H__ +#define __XML_STRING_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlChar: + * + * This is a basic byte in an UTF-8 encoded string. + * It's unsigned allowing to pinpoint case where char * are assigned + * to xmlChar * (possibly making serialization back impossible). + */ +typedef unsigned char xmlChar; + +/** + * BAD_CAST: + * + * Macro to cast a string to an xmlChar * when one know its safe. + */ +#define BAD_CAST (xmlChar *) + +/* + * xmlChar handling + */ +XMLPUBFUN xmlChar * XMLCALL + xmlStrdup (const xmlChar *cur); +XMLPUBFUN xmlChar * XMLCALL + xmlStrndup (const xmlChar *cur, + int len); +XMLPUBFUN xmlChar * XMLCALL + xmlCharStrndup (const char *cur, + int len); +XMLPUBFUN xmlChar * XMLCALL + xmlCharStrdup (const char *cur); +XMLPUBFUN xmlChar * XMLCALL + xmlStrsub (const xmlChar *str, + int start, + int len); +XMLPUBFUN const xmlChar * XMLCALL + xmlStrchr (const xmlChar *str, + xmlChar val); +XMLPUBFUN const xmlChar * XMLCALL + xmlStrstr (const xmlChar *str, + const xmlChar *val); +XMLPUBFUN const xmlChar * XMLCALL + xmlStrcasestr (const xmlChar *str, + const xmlChar *val); +XMLPUBFUN int XMLCALL + xmlStrcmp (const xmlChar *str1, + const xmlChar *str2); +XMLPUBFUN int XMLCALL + xmlStrncmp (const xmlChar *str1, + const xmlChar *str2, + int len); +XMLPUBFUN int XMLCALL + xmlStrcasecmp (const xmlChar *str1, + const xmlChar *str2); +XMLPUBFUN int XMLCALL + xmlStrncasecmp (const xmlChar *str1, + const xmlChar *str2, + int len); +XMLPUBFUN int XMLCALL + xmlStrEqual (const xmlChar *str1, + const xmlChar *str2); +XMLPUBFUN int XMLCALL + xmlStrQEqual (const xmlChar *pref, + const xmlChar *name, + const xmlChar *str); +XMLPUBFUN int XMLCALL + xmlStrlen (const xmlChar *str); +XMLPUBFUN xmlChar * XMLCALL + xmlStrcat (xmlChar *cur, + const xmlChar *add); +XMLPUBFUN xmlChar * XMLCALL + xmlStrncat (xmlChar *cur, + const xmlChar *add, + int len); +XMLPUBFUN xmlChar * XMLCALL + xmlStrncatNew (const xmlChar *str1, + const xmlChar *str2, + int len); +XMLPUBFUN int XMLCALL + xmlStrPrintf (xmlChar *buf, + int len, + const char *msg, + ...) LIBXML_ATTR_FORMAT(3,4); +XMLPUBFUN int XMLCALL + xmlStrVPrintf (xmlChar *buf, + int len, + const char *msg, + va_list ap) LIBXML_ATTR_FORMAT(3,0); + +XMLPUBFUN int XMLCALL + xmlGetUTF8Char (const unsigned char *utf, + int *len); +XMLPUBFUN int XMLCALL + xmlCheckUTF8 (const unsigned char *utf); +XMLPUBFUN int XMLCALL + xmlUTF8Strsize (const xmlChar *utf, + int len); +XMLPUBFUN xmlChar * XMLCALL + xmlUTF8Strndup (const xmlChar *utf, + int len); +XMLPUBFUN const xmlChar * XMLCALL + xmlUTF8Strpos (const xmlChar *utf, + int pos); +XMLPUBFUN int XMLCALL + xmlUTF8Strloc (const xmlChar *utf, + const xmlChar *utfchar); +XMLPUBFUN xmlChar * XMLCALL + xmlUTF8Strsub (const xmlChar *utf, + int start, + int len); +XMLPUBFUN int XMLCALL + xmlUTF8Strlen (const xmlChar *utf); +XMLPUBFUN int XMLCALL + xmlUTF8Size (const xmlChar *utf); +XMLPUBFUN int XMLCALL + xmlUTF8Charcmp (const xmlChar *utf1, + const xmlChar *utf2); + +#ifdef __cplusplus +} +#endif +#endif /* __XML_STRING_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlunicode.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlunicode.h new file mode 100644 index 0000000..01ac8b6 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlunicode.h @@ -0,0 +1,202 @@ +/* + * Summary: Unicode character APIs + * Description: API for the Unicode character APIs + * + * This file is automatically generated from the + * UCS description files of the Unicode Character Database + * http://www.unicode.org/Public/4.0-Update1/UCD-4.0.1.html + * using the genUnicode.py Python script. + * + * Generation date: Mon Mar 27 11:09:52 2006 + * Sources: Blocks-4.0.1.txt UnicodeData-4.0.1.txt + * Author: Daniel Veillard + */ + +#ifndef __XML_UNICODE_H__ +#define __XML_UNICODE_H__ + +#include + +#ifdef LIBXML_UNICODE_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +XMLPUBFUN int XMLCALL xmlUCSIsAegeanNumbers (int code); +XMLPUBFUN int XMLCALL xmlUCSIsAlphabeticPresentationForms (int code); +XMLPUBFUN int XMLCALL xmlUCSIsArabic (int code); +XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsA (int code); +XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsB (int code); +XMLPUBFUN int XMLCALL xmlUCSIsArmenian (int code); +XMLPUBFUN int XMLCALL xmlUCSIsArrows (int code); +XMLPUBFUN int XMLCALL xmlUCSIsBasicLatin (int code); +XMLPUBFUN int XMLCALL xmlUCSIsBengali (int code); +XMLPUBFUN int XMLCALL xmlUCSIsBlockElements (int code); +XMLPUBFUN int XMLCALL xmlUCSIsBopomofo (int code); +XMLPUBFUN int XMLCALL xmlUCSIsBopomofoExtended (int code); +XMLPUBFUN int XMLCALL xmlUCSIsBoxDrawing (int code); +XMLPUBFUN int XMLCALL xmlUCSIsBraillePatterns (int code); +XMLPUBFUN int XMLCALL xmlUCSIsBuhid (int code); +XMLPUBFUN int XMLCALL xmlUCSIsByzantineMusicalSymbols (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibility (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityForms (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographs (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographsSupplement (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCJKRadicalsSupplement (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCJKSymbolsandPunctuation (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographs (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionA (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionB (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCherokee (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarks (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarksforSymbols (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCombiningHalfMarks (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCombiningMarksforSymbols (int code); +XMLPUBFUN int XMLCALL xmlUCSIsControlPictures (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCurrencySymbols (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCypriotSyllabary (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCyrillic (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCyrillicSupplement (int code); +XMLPUBFUN int XMLCALL xmlUCSIsDeseret (int code); +XMLPUBFUN int XMLCALL xmlUCSIsDevanagari (int code); +XMLPUBFUN int XMLCALL xmlUCSIsDingbats (int code); +XMLPUBFUN int XMLCALL xmlUCSIsEnclosedAlphanumerics (int code); +XMLPUBFUN int XMLCALL xmlUCSIsEnclosedCJKLettersandMonths (int code); +XMLPUBFUN int XMLCALL xmlUCSIsEthiopic (int code); +XMLPUBFUN int XMLCALL xmlUCSIsGeneralPunctuation (int code); +XMLPUBFUN int XMLCALL xmlUCSIsGeometricShapes (int code); +XMLPUBFUN int XMLCALL xmlUCSIsGeorgian (int code); +XMLPUBFUN int XMLCALL xmlUCSIsGothic (int code); +XMLPUBFUN int XMLCALL xmlUCSIsGreek (int code); +XMLPUBFUN int XMLCALL xmlUCSIsGreekExtended (int code); +XMLPUBFUN int XMLCALL xmlUCSIsGreekandCoptic (int code); +XMLPUBFUN int XMLCALL xmlUCSIsGujarati (int code); +XMLPUBFUN int XMLCALL xmlUCSIsGurmukhi (int code); +XMLPUBFUN int XMLCALL xmlUCSIsHalfwidthandFullwidthForms (int code); +XMLPUBFUN int XMLCALL xmlUCSIsHangulCompatibilityJamo (int code); +XMLPUBFUN int XMLCALL xmlUCSIsHangulJamo (int code); +XMLPUBFUN int XMLCALL xmlUCSIsHangulSyllables (int code); +XMLPUBFUN int XMLCALL xmlUCSIsHanunoo (int code); +XMLPUBFUN int XMLCALL xmlUCSIsHebrew (int code); +XMLPUBFUN int XMLCALL xmlUCSIsHighPrivateUseSurrogates (int code); +XMLPUBFUN int XMLCALL xmlUCSIsHighSurrogates (int code); +XMLPUBFUN int XMLCALL xmlUCSIsHiragana (int code); +XMLPUBFUN int XMLCALL xmlUCSIsIPAExtensions (int code); +XMLPUBFUN int XMLCALL xmlUCSIsIdeographicDescriptionCharacters (int code); +XMLPUBFUN int XMLCALL xmlUCSIsKanbun (int code); +XMLPUBFUN int XMLCALL xmlUCSIsKangxiRadicals (int code); +XMLPUBFUN int XMLCALL xmlUCSIsKannada (int code); +XMLPUBFUN int XMLCALL xmlUCSIsKatakana (int code); +XMLPUBFUN int XMLCALL xmlUCSIsKatakanaPhoneticExtensions (int code); +XMLPUBFUN int XMLCALL xmlUCSIsKhmer (int code); +XMLPUBFUN int XMLCALL xmlUCSIsKhmerSymbols (int code); +XMLPUBFUN int XMLCALL xmlUCSIsLao (int code); +XMLPUBFUN int XMLCALL xmlUCSIsLatin1Supplement (int code); +XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedA (int code); +XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedB (int code); +XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedAdditional (int code); +XMLPUBFUN int XMLCALL xmlUCSIsLetterlikeSymbols (int code); +XMLPUBFUN int XMLCALL xmlUCSIsLimbu (int code); +XMLPUBFUN int XMLCALL xmlUCSIsLinearBIdeograms (int code); +XMLPUBFUN int XMLCALL xmlUCSIsLinearBSyllabary (int code); +XMLPUBFUN int XMLCALL xmlUCSIsLowSurrogates (int code); +XMLPUBFUN int XMLCALL xmlUCSIsMalayalam (int code); +XMLPUBFUN int XMLCALL xmlUCSIsMathematicalAlphanumericSymbols (int code); +XMLPUBFUN int XMLCALL xmlUCSIsMathematicalOperators (int code); +XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsA (int code); +XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsB (int code); +XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbols (int code); +XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbolsandArrows (int code); +XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousTechnical (int code); +XMLPUBFUN int XMLCALL xmlUCSIsMongolian (int code); +XMLPUBFUN int XMLCALL xmlUCSIsMusicalSymbols (int code); +XMLPUBFUN int XMLCALL xmlUCSIsMyanmar (int code); +XMLPUBFUN int XMLCALL xmlUCSIsNumberForms (int code); +XMLPUBFUN int XMLCALL xmlUCSIsOgham (int code); +XMLPUBFUN int XMLCALL xmlUCSIsOldItalic (int code); +XMLPUBFUN int XMLCALL xmlUCSIsOpticalCharacterRecognition (int code); +XMLPUBFUN int XMLCALL xmlUCSIsOriya (int code); +XMLPUBFUN int XMLCALL xmlUCSIsOsmanya (int code); +XMLPUBFUN int XMLCALL xmlUCSIsPhoneticExtensions (int code); +XMLPUBFUN int XMLCALL xmlUCSIsPrivateUse (int code); +XMLPUBFUN int XMLCALL xmlUCSIsPrivateUseArea (int code); +XMLPUBFUN int XMLCALL xmlUCSIsRunic (int code); +XMLPUBFUN int XMLCALL xmlUCSIsShavian (int code); +XMLPUBFUN int XMLCALL xmlUCSIsSinhala (int code); +XMLPUBFUN int XMLCALL xmlUCSIsSmallFormVariants (int code); +XMLPUBFUN int XMLCALL xmlUCSIsSpacingModifierLetters (int code); +XMLPUBFUN int XMLCALL xmlUCSIsSpecials (int code); +XMLPUBFUN int XMLCALL xmlUCSIsSuperscriptsandSubscripts (int code); +XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsA (int code); +XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsB (int code); +XMLPUBFUN int XMLCALL xmlUCSIsSupplementalMathematicalOperators (int code); +XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaA (int code); +XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaB (int code); +XMLPUBFUN int XMLCALL xmlUCSIsSyriac (int code); +XMLPUBFUN int XMLCALL xmlUCSIsTagalog (int code); +XMLPUBFUN int XMLCALL xmlUCSIsTagbanwa (int code); +XMLPUBFUN int XMLCALL xmlUCSIsTags (int code); +XMLPUBFUN int XMLCALL xmlUCSIsTaiLe (int code); +XMLPUBFUN int XMLCALL xmlUCSIsTaiXuanJingSymbols (int code); +XMLPUBFUN int XMLCALL xmlUCSIsTamil (int code); +XMLPUBFUN int XMLCALL xmlUCSIsTelugu (int code); +XMLPUBFUN int XMLCALL xmlUCSIsThaana (int code); +XMLPUBFUN int XMLCALL xmlUCSIsThai (int code); +XMLPUBFUN int XMLCALL xmlUCSIsTibetan (int code); +XMLPUBFUN int XMLCALL xmlUCSIsUgaritic (int code); +XMLPUBFUN int XMLCALL xmlUCSIsUnifiedCanadianAboriginalSyllabics (int code); +XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectors (int code); +XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectorsSupplement (int code); +XMLPUBFUN int XMLCALL xmlUCSIsYiRadicals (int code); +XMLPUBFUN int XMLCALL xmlUCSIsYiSyllables (int code); +XMLPUBFUN int XMLCALL xmlUCSIsYijingHexagramSymbols (int code); + +XMLPUBFUN int XMLCALL xmlUCSIsBlock (int code, const char *block); + +XMLPUBFUN int XMLCALL xmlUCSIsCatC (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatCc (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatCf (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatCo (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatCs (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatL (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatLl (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatLm (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatLo (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatLt (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatLu (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatM (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatMc (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatMe (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatMn (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatN (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatNd (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatNl (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatNo (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatP (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatPc (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatPd (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatPe (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatPf (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatPi (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatPo (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatPs (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatS (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatSc (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatSk (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatSm (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatSo (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatZ (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatZl (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatZp (int code); +XMLPUBFUN int XMLCALL xmlUCSIsCatZs (int code); + +XMLPUBFUN int XMLCALL xmlUCSIsCat (int code, const char *cat); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_UNICODE_ENABLED */ + +#endif /* __XML_UNICODE_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlversion.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlversion.h new file mode 100644 index 0000000..31c5aa3 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlversion.h @@ -0,0 +1,486 @@ +/* + * Summary: compile-time version informations + * Description: compile-time version informations for the XML library + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_VERSION_H__ +#define __XML_VERSION_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * use those to be sure nothing nasty will happen if + * your library and includes mismatch + */ +#ifndef LIBXML2_COMPILING_MSCCDEF +XMLPUBFUN void XMLCALL xmlCheckVersion(int version); +#endif /* LIBXML2_COMPILING_MSCCDEF */ + +/** + * LIBXML_DOTTED_VERSION: + * + * the version string like "1.2.3" + */ +#define LIBXML_DOTTED_VERSION "2.9.9" + +/** + * LIBXML_VERSION: + * + * the version number: 1.2.3 value is 10203 + */ +#define LIBXML_VERSION 20909 + +/** + * LIBXML_VERSION_STRING: + * + * the version number string, 1.2.3 value is "10203" + */ +#define LIBXML_VERSION_STRING "20909" + +/** + * LIBXML_VERSION_EXTRA: + * + * extra version information, used to show a CVS compilation + */ +#define LIBXML_VERSION_EXTRA "" + +/** + * LIBXML_TEST_VERSION: + * + * Macro to check that the libxml version in use is compatible with + * the version the software has been compiled against + */ +#define LIBXML_TEST_VERSION xmlCheckVersion(20909); + +#ifndef VMS +#if 0 +/** + * WITH_TRIO: + * + * defined if the trio support need to be configured in + */ +#define WITH_TRIO +#else +/** + * WITHOUT_TRIO: + * + * defined if the trio support should not be configured in + */ +#define WITHOUT_TRIO +#endif +#else /* VMS */ +/** + * WITH_TRIO: + * + * defined if the trio support need to be configured in + */ +#define WITH_TRIO 1 +#endif /* VMS */ + +/** + * LIBXML_THREAD_ENABLED: + * + * Whether the thread support is configured in + */ +#if 1 +#if defined(_REENTRANT) || defined(__MT__) || \ + (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L)) +#define LIBXML_THREAD_ENABLED +#endif +#endif + +/** + * LIBXML_THREAD_ALLOC_ENABLED: + * + * Whether the allocation hooks are per-thread + */ +#if 0 +#define LIBXML_THREAD_ALLOC_ENABLED +#endif + +/** + * LIBXML_TREE_ENABLED: + * + * Whether the DOM like tree manipulation API support is configured in + */ +#if 1 +#define LIBXML_TREE_ENABLED +#endif + +/** + * LIBXML_OUTPUT_ENABLED: + * + * Whether the serialization/saving support is configured in + */ +#if 1 +#define LIBXML_OUTPUT_ENABLED +#endif + +/** + * LIBXML_PUSH_ENABLED: + * + * Whether the push parsing interfaces are configured in + */ +#if 1 +#define LIBXML_PUSH_ENABLED +#endif + +/** + * LIBXML_READER_ENABLED: + * + * Whether the xmlReader parsing interface is configured in + */ +#if 1 +#define LIBXML_READER_ENABLED +#endif + +/** + * LIBXML_PATTERN_ENABLED: + * + * Whether the xmlPattern node selection interface is configured in + */ +#if 1 +#define LIBXML_PATTERN_ENABLED +#endif + +/** + * LIBXML_WRITER_ENABLED: + * + * Whether the xmlWriter saving interface is configured in + */ +#if 1 +#define LIBXML_WRITER_ENABLED +#endif + +/** + * LIBXML_SAX1_ENABLED: + * + * Whether the older SAX1 interface is configured in + */ +#if 1 +#define LIBXML_SAX1_ENABLED +#endif + +/** + * LIBXML_FTP_ENABLED: + * + * Whether the FTP support is configured in + */ +#if 1 +#define LIBXML_FTP_ENABLED +#endif + +/** + * LIBXML_HTTP_ENABLED: + * + * Whether the HTTP support is configured in + */ +#if 1 +#define LIBXML_HTTP_ENABLED +#endif + +/** + * LIBXML_VALID_ENABLED: + * + * Whether the DTD validation support is configured in + */ +#if 1 +#define LIBXML_VALID_ENABLED +#endif + +/** + * LIBXML_HTML_ENABLED: + * + * Whether the HTML support is configured in + */ +#if 1 +#define LIBXML_HTML_ENABLED +#endif + +/** + * LIBXML_LEGACY_ENABLED: + * + * Whether the deprecated APIs are compiled in for compatibility + */ +#if 1 +#define LIBXML_LEGACY_ENABLED +#endif + +/** + * LIBXML_C14N_ENABLED: + * + * Whether the Canonicalization support is configured in + */ +#if 1 +#define LIBXML_C14N_ENABLED +#endif + +/** + * LIBXML_CATALOG_ENABLED: + * + * Whether the Catalog support is configured in + */ +#if 1 +#define LIBXML_CATALOG_ENABLED +#endif + +/** + * LIBXML_DOCB_ENABLED: + * + * Whether the SGML Docbook support is configured in + */ +#if 1 +#define LIBXML_DOCB_ENABLED +#endif + +/** + * LIBXML_XPATH_ENABLED: + * + * Whether XPath is configured in + */ +#if 1 +#define LIBXML_XPATH_ENABLED +#endif + +/** + * LIBXML_XPTR_ENABLED: + * + * Whether XPointer is configured in + */ +#if 1 +#define LIBXML_XPTR_ENABLED +#endif + +/** + * LIBXML_XINCLUDE_ENABLED: + * + * Whether XInclude is configured in + */ +#if 1 +#define LIBXML_XINCLUDE_ENABLED +#endif + +/** + * LIBXML_ICONV_ENABLED: + * + * Whether iconv support is available + */ +#if 1 +#define LIBXML_ICONV_ENABLED +#endif + +/** + * LIBXML_ICU_ENABLED: + * + * Whether icu support is available + */ +#if 0 +#define LIBXML_ICU_ENABLED +#endif + +/** + * LIBXML_ISO8859X_ENABLED: + * + * Whether ISO-8859-* support is made available in case iconv is not + */ +#if 1 +#define LIBXML_ISO8859X_ENABLED +#endif + +/** + * LIBXML_DEBUG_ENABLED: + * + * Whether Debugging module is configured in + */ +#if 1 +#define LIBXML_DEBUG_ENABLED +#endif + +/** + * DEBUG_MEMORY_LOCATION: + * + * Whether the memory debugging is configured in + */ +#if 0 +#define DEBUG_MEMORY_LOCATION +#endif + +/** + * LIBXML_DEBUG_RUNTIME: + * + * Whether the runtime debugging is configured in + */ +#if 0 +#define LIBXML_DEBUG_RUNTIME +#endif + +/** + * LIBXML_UNICODE_ENABLED: + * + * Whether the Unicode related interfaces are compiled in + */ +#if 1 +#define LIBXML_UNICODE_ENABLED +#endif + +/** + * LIBXML_REGEXP_ENABLED: + * + * Whether the regular expressions interfaces are compiled in + */ +#if 1 +#define LIBXML_REGEXP_ENABLED +#endif + +/** + * LIBXML_AUTOMATA_ENABLED: + * + * Whether the automata interfaces are compiled in + */ +#if 1 +#define LIBXML_AUTOMATA_ENABLED +#endif + +/** + * LIBXML_EXPR_ENABLED: + * + * Whether the formal expressions interfaces are compiled in + */ +#if 1 +#define LIBXML_EXPR_ENABLED +#endif + +/** + * LIBXML_SCHEMAS_ENABLED: + * + * Whether the Schemas validation interfaces are compiled in + */ +#if 1 +#define LIBXML_SCHEMAS_ENABLED +#endif + +/** + * LIBXML_SCHEMATRON_ENABLED: + * + * Whether the Schematron validation interfaces are compiled in + */ +#if 1 +#define LIBXML_SCHEMATRON_ENABLED +#endif + +/** + * LIBXML_MODULES_ENABLED: + * + * Whether the module interfaces are compiled in + */ +#if 1 +#define LIBXML_MODULES_ENABLED +/** + * LIBXML_MODULE_EXTENSION: + * + * the string suffix used by dynamic modules (usually shared libraries) + */ +#define LIBXML_MODULE_EXTENSION ".so" +#endif + +/** + * LIBXML_ZLIB_ENABLED: + * + * Whether the Zlib support is compiled in + */ +#if 0 +#define LIBXML_ZLIB_ENABLED +#endif + +/** + * LIBXML_LZMA_ENABLED: + * + * Whether the Lzma support is compiled in + */ +#if 0 +#define LIBXML_LZMA_ENABLED +#endif + +#ifdef __GNUC__ + +/** + * ATTRIBUTE_UNUSED: + * + * Macro used to signal to GCC unused function parameters + */ + +#ifndef ATTRIBUTE_UNUSED +# if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7))) +# define ATTRIBUTE_UNUSED __attribute__((unused)) +# else +# define ATTRIBUTE_UNUSED +# endif +#endif + +/** + * LIBXML_ATTR_ALLOC_SIZE: + * + * Macro used to indicate to GCC this is an allocator function + */ + +#ifndef LIBXML_ATTR_ALLOC_SIZE +# if (!defined(__clang__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))) +# define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x))) +# else +# define LIBXML_ATTR_ALLOC_SIZE(x) +# endif +#else +# define LIBXML_ATTR_ALLOC_SIZE(x) +#endif + +/** + * LIBXML_ATTR_FORMAT: + * + * Macro used to indicate to GCC the parameter are printf like + */ + +#ifndef LIBXML_ATTR_FORMAT +# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) +# define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args))) +# else +# define LIBXML_ATTR_FORMAT(fmt,args) +# endif +#else +# define LIBXML_ATTR_FORMAT(fmt,args) +#endif + +#else /* ! __GNUC__ */ +/** + * ATTRIBUTE_UNUSED: + * + * Macro used to signal to GCC unused function parameters + */ +#define ATTRIBUTE_UNUSED +/** + * LIBXML_ATTR_ALLOC_SIZE: + * + * Macro used to indicate to GCC this is an allocator function + */ +#define LIBXML_ATTR_ALLOC_SIZE(x) +/** + * LIBXML_ATTR_FORMAT: + * + * Macro used to indicate to GCC the parameter are printf like + */ +#define LIBXML_ATTR_FORMAT(fmt,args) +#endif /* __GNUC__ */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif + + diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlwriter.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlwriter.h new file mode 100644 index 0000000..dd5add3 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xmlwriter.h @@ -0,0 +1,488 @@ +/* + * Summary: text writing API for XML + * Description: text writing API for XML + * + * Copy: See Copyright for the status of this software. + * + * Author: Alfred Mickautsch + */ + +#ifndef __XML_XMLWRITER_H__ +#define __XML_XMLWRITER_H__ + +#include + +#ifdef LIBXML_WRITER_ENABLED + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + typedef struct _xmlTextWriter xmlTextWriter; + typedef xmlTextWriter *xmlTextWriterPtr; + +/* + * Constructors & Destructor + */ + XMLPUBFUN xmlTextWriterPtr XMLCALL + xmlNewTextWriter(xmlOutputBufferPtr out); + XMLPUBFUN xmlTextWriterPtr XMLCALL + xmlNewTextWriterFilename(const char *uri, int compression); + XMLPUBFUN xmlTextWriterPtr XMLCALL + xmlNewTextWriterMemory(xmlBufferPtr buf, int compression); + XMLPUBFUN xmlTextWriterPtr XMLCALL + xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt, int compression); + XMLPUBFUN xmlTextWriterPtr XMLCALL + xmlNewTextWriterDoc(xmlDocPtr * doc, int compression); + XMLPUBFUN xmlTextWriterPtr XMLCALL + xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node, + int compression); + XMLPUBFUN void XMLCALL xmlFreeTextWriter(xmlTextWriterPtr writer); + +/* + * Functions + */ + + +/* + * Document + */ + XMLPUBFUN int XMLCALL + xmlTextWriterStartDocument(xmlTextWriterPtr writer, + const char *version, + const char *encoding, + const char *standalone); + XMLPUBFUN int XMLCALL xmlTextWriterEndDocument(xmlTextWriterPtr + writer); + +/* + * Comments + */ + XMLPUBFUN int XMLCALL xmlTextWriterStartComment(xmlTextWriterPtr + writer); + XMLPUBFUN int XMLCALL xmlTextWriterEndComment(xmlTextWriterPtr writer); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer, + const char *format, ...) + LIBXML_ATTR_FORMAT(2,3); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer, + const char *format, + va_list argptr) + LIBXML_ATTR_FORMAT(2,0); + XMLPUBFUN int XMLCALL xmlTextWriterWriteComment(xmlTextWriterPtr + writer, + const xmlChar * + content); + +/* + * Elements + */ + XMLPUBFUN int XMLCALL + xmlTextWriterStartElement(xmlTextWriterPtr writer, + const xmlChar * name); + XMLPUBFUN int XMLCALL xmlTextWriterStartElementNS(xmlTextWriterPtr + writer, + const xmlChar * + prefix, + const xmlChar * name, + const xmlChar * + namespaceURI); + XMLPUBFUN int XMLCALL xmlTextWriterEndElement(xmlTextWriterPtr writer); + XMLPUBFUN int XMLCALL xmlTextWriterFullEndElement(xmlTextWriterPtr + writer); + +/* + * Elements conveniency functions + */ + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, ...) + LIBXML_ATTR_FORMAT(3,4); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, + va_list argptr) + LIBXML_ATTR_FORMAT(3,0); + XMLPUBFUN int XMLCALL xmlTextWriterWriteElement(xmlTextWriterPtr + writer, + const xmlChar * name, + const xmlChar * + content); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatElementNS(xmlTextWriterPtr writer, + const xmlChar * prefix, + const xmlChar * name, + const xmlChar * namespaceURI, + const char *format, ...) + LIBXML_ATTR_FORMAT(5,6); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer, + const xmlChar * prefix, + const xmlChar * name, + const xmlChar * namespaceURI, + const char *format, + va_list argptr) + LIBXML_ATTR_FORMAT(5,0); + XMLPUBFUN int XMLCALL xmlTextWriterWriteElementNS(xmlTextWriterPtr + writer, + const xmlChar * + prefix, + const xmlChar * name, + const xmlChar * + namespaceURI, + const xmlChar * + content); + +/* + * Text + */ + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer, + const char *format, ...) + LIBXML_ATTR_FORMAT(2,3); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer, + const char *format, va_list argptr) + LIBXML_ATTR_FORMAT(2,0); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteRawLen(xmlTextWriterPtr writer, + const xmlChar * content, int len); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteRaw(xmlTextWriterPtr writer, + const xmlChar * content); + XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatString(xmlTextWriterPtr + writer, + const char + *format, ...) + LIBXML_ATTR_FORMAT(2,3); + XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatString(xmlTextWriterPtr + writer, + const char + *format, + va_list argptr) + LIBXML_ATTR_FORMAT(2,0); + XMLPUBFUN int XMLCALL xmlTextWriterWriteString(xmlTextWriterPtr writer, + const xmlChar * + content); + XMLPUBFUN int XMLCALL xmlTextWriterWriteBase64(xmlTextWriterPtr writer, + const char *data, + int start, int len); + XMLPUBFUN int XMLCALL xmlTextWriterWriteBinHex(xmlTextWriterPtr writer, + const char *data, + int start, int len); + +/* + * Attributes + */ + XMLPUBFUN int XMLCALL + xmlTextWriterStartAttribute(xmlTextWriterPtr writer, + const xmlChar * name); + XMLPUBFUN int XMLCALL xmlTextWriterStartAttributeNS(xmlTextWriterPtr + writer, + const xmlChar * + prefix, + const xmlChar * + name, + const xmlChar * + namespaceURI); + XMLPUBFUN int XMLCALL xmlTextWriterEndAttribute(xmlTextWriterPtr + writer); + +/* + * Attributes conveniency functions + */ + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, ...) + LIBXML_ATTR_FORMAT(3,4); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, + va_list argptr) + LIBXML_ATTR_FORMAT(3,0); + XMLPUBFUN int XMLCALL xmlTextWriterWriteAttribute(xmlTextWriterPtr + writer, + const xmlChar * name, + const xmlChar * + content); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatAttributeNS(xmlTextWriterPtr writer, + const xmlChar * prefix, + const xmlChar * name, + const xmlChar * namespaceURI, + const char *format, ...) + LIBXML_ATTR_FORMAT(5,6); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer, + const xmlChar * prefix, + const xmlChar * name, + const xmlChar * namespaceURI, + const char *format, + va_list argptr) + LIBXML_ATTR_FORMAT(5,0); + XMLPUBFUN int XMLCALL xmlTextWriterWriteAttributeNS(xmlTextWriterPtr + writer, + const xmlChar * + prefix, + const xmlChar * + name, + const xmlChar * + namespaceURI, + const xmlChar * + content); + +/* + * PI's + */ + XMLPUBFUN int XMLCALL + xmlTextWriterStartPI(xmlTextWriterPtr writer, + const xmlChar * target); + XMLPUBFUN int XMLCALL xmlTextWriterEndPI(xmlTextWriterPtr writer); + +/* + * PI conveniency functions + */ + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer, + const xmlChar * target, + const char *format, ...) + LIBXML_ATTR_FORMAT(3,4); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer, + const xmlChar * target, + const char *format, va_list argptr) + LIBXML_ATTR_FORMAT(3,0); + XMLPUBFUN int XMLCALL + xmlTextWriterWritePI(xmlTextWriterPtr writer, + const xmlChar * target, + const xmlChar * content); + +/** + * xmlTextWriterWriteProcessingInstruction: + * + * This macro maps to xmlTextWriterWritePI + */ +#define xmlTextWriterWriteProcessingInstruction xmlTextWriterWritePI + +/* + * CDATA + */ + XMLPUBFUN int XMLCALL xmlTextWriterStartCDATA(xmlTextWriterPtr writer); + XMLPUBFUN int XMLCALL xmlTextWriterEndCDATA(xmlTextWriterPtr writer); + +/* + * CDATA conveniency functions + */ + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer, + const char *format, ...) + LIBXML_ATTR_FORMAT(2,3); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer, + const char *format, va_list argptr) + LIBXML_ATTR_FORMAT(2,0); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteCDATA(xmlTextWriterPtr writer, + const xmlChar * content); + +/* + * DTD + */ + XMLPUBFUN int XMLCALL + xmlTextWriterStartDTD(xmlTextWriterPtr writer, + const xmlChar * name, + const xmlChar * pubid, + const xmlChar * sysid); + XMLPUBFUN int XMLCALL xmlTextWriterEndDTD(xmlTextWriterPtr writer); + +/* + * DTD conveniency functions + */ + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatDTD(xmlTextWriterPtr writer, + const xmlChar * name, + const xmlChar * pubid, + const xmlChar * sysid, + const char *format, ...) + LIBXML_ATTR_FORMAT(5,6); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer, + const xmlChar * name, + const xmlChar * pubid, + const xmlChar * sysid, + const char *format, va_list argptr) + LIBXML_ATTR_FORMAT(5,0); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteDTD(xmlTextWriterPtr writer, + const xmlChar * name, + const xmlChar * pubid, + const xmlChar * sysid, + const xmlChar * subset); + +/** + * xmlTextWriterWriteDocType: + * + * this macro maps to xmlTextWriterWriteDTD + */ +#define xmlTextWriterWriteDocType xmlTextWriterWriteDTD + +/* + * DTD element definition + */ + XMLPUBFUN int XMLCALL + xmlTextWriterStartDTDElement(xmlTextWriterPtr writer, + const xmlChar * name); + XMLPUBFUN int XMLCALL xmlTextWriterEndDTDElement(xmlTextWriterPtr + writer); + +/* + * DTD element definition conveniency functions + */ + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, ...) + LIBXML_ATTR_FORMAT(3,4); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, + va_list argptr) + LIBXML_ATTR_FORMAT(3,0); + XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDElement(xmlTextWriterPtr + writer, + const xmlChar * + name, + const xmlChar * + content); + +/* + * DTD attribute list definition + */ + XMLPUBFUN int XMLCALL + xmlTextWriterStartDTDAttlist(xmlTextWriterPtr writer, + const xmlChar * name); + XMLPUBFUN int XMLCALL xmlTextWriterEndDTDAttlist(xmlTextWriterPtr + writer); + +/* + * DTD attribute list definition conveniency functions + */ + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, ...) + LIBXML_ATTR_FORMAT(3,4); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer, + const xmlChar * name, + const char *format, + va_list argptr) + LIBXML_ATTR_FORMAT(3,0); + XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr + writer, + const xmlChar * + name, + const xmlChar * + content); + +/* + * DTD entity definition + */ + XMLPUBFUN int XMLCALL + xmlTextWriterStartDTDEntity(xmlTextWriterPtr writer, + int pe, const xmlChar * name); + XMLPUBFUN int XMLCALL xmlTextWriterEndDTDEntity(xmlTextWriterPtr + writer); + +/* + * DTD entity definition conveniency functions + */ + XMLPUBFUN int XMLCALL + xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer, + int pe, + const xmlChar * name, + const char *format, ...) + LIBXML_ATTR_FORMAT(4,5); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer, + int pe, + const xmlChar * name, + const char *format, + va_list argptr) + LIBXML_ATTR_FORMAT(4,0); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer, + int pe, + const xmlChar * name, + const xmlChar * content); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteDTDExternalEntity(xmlTextWriterPtr writer, + int pe, + const xmlChar * name, + const xmlChar * pubid, + const xmlChar * sysid, + const xmlChar * ndataid); + XMLPUBFUN int XMLCALL + xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr + writer, + const xmlChar * pubid, + const xmlChar * sysid, + const xmlChar * + ndataid); + XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDEntity(xmlTextWriterPtr + writer, int pe, + const xmlChar * name, + const xmlChar * + pubid, + const xmlChar * + sysid, + const xmlChar * + ndataid, + const xmlChar * + content); + +/* + * DTD notation definition + */ + XMLPUBFUN int XMLCALL + xmlTextWriterWriteDTDNotation(xmlTextWriterPtr writer, + const xmlChar * name, + const xmlChar * pubid, + const xmlChar * sysid); + +/* + * Indentation + */ + XMLPUBFUN int XMLCALL + xmlTextWriterSetIndent(xmlTextWriterPtr writer, int indent); + XMLPUBFUN int XMLCALL + xmlTextWriterSetIndentString(xmlTextWriterPtr writer, + const xmlChar * str); + + XMLPUBFUN int XMLCALL + xmlTextWriterSetQuoteChar(xmlTextWriterPtr writer, xmlChar quotechar); + + +/* + * misc + */ + XMLPUBFUN int XMLCALL xmlTextWriterFlush(xmlTextWriterPtr writer); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_WRITER_ENABLED */ + +#endif /* __XML_XMLWRITER_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xpath.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xpath.h new file mode 100644 index 0000000..d96776c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xpath.h @@ -0,0 +1,557 @@ +/* + * Summary: XML Path Language implementation + * Description: API for the XML Path Language implementation + * + * XML Path Language implementation + * XPath is a language for addressing parts of an XML document, + * designed to be used by both XSLT and XPointer + * http://www.w3.org/TR/xpath + * + * Implements + * W3C Recommendation 16 November 1999 + * http://www.w3.org/TR/1999/REC-xpath-19991116 + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XPATH_H__ +#define __XML_XPATH_H__ + +#include + +#ifdef LIBXML_XPATH_ENABLED + +#include +#include +#include +#endif /* LIBXML_XPATH_ENABLED */ + +#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +#ifdef __cplusplus +extern "C" { +#endif +#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED */ + +#ifdef LIBXML_XPATH_ENABLED + +typedef struct _xmlXPathContext xmlXPathContext; +typedef xmlXPathContext *xmlXPathContextPtr; +typedef struct _xmlXPathParserContext xmlXPathParserContext; +typedef xmlXPathParserContext *xmlXPathParserContextPtr; + +/** + * The set of XPath error codes. + */ + +typedef enum { + XPATH_EXPRESSION_OK = 0, + XPATH_NUMBER_ERROR, + XPATH_UNFINISHED_LITERAL_ERROR, + XPATH_START_LITERAL_ERROR, + XPATH_VARIABLE_REF_ERROR, + XPATH_UNDEF_VARIABLE_ERROR, + XPATH_INVALID_PREDICATE_ERROR, + XPATH_EXPR_ERROR, + XPATH_UNCLOSED_ERROR, + XPATH_UNKNOWN_FUNC_ERROR, + XPATH_INVALID_OPERAND, + XPATH_INVALID_TYPE, + XPATH_INVALID_ARITY, + XPATH_INVALID_CTXT_SIZE, + XPATH_INVALID_CTXT_POSITION, + XPATH_MEMORY_ERROR, + XPTR_SYNTAX_ERROR, + XPTR_RESOURCE_ERROR, + XPTR_SUB_RESOURCE_ERROR, + XPATH_UNDEF_PREFIX_ERROR, + XPATH_ENCODING_ERROR, + XPATH_INVALID_CHAR_ERROR, + XPATH_INVALID_CTXT, + XPATH_STACK_ERROR, + XPATH_FORBID_VARIABLE_ERROR +} xmlXPathError; + +/* + * A node-set (an unordered collection of nodes without duplicates). + */ +typedef struct _xmlNodeSet xmlNodeSet; +typedef xmlNodeSet *xmlNodeSetPtr; +struct _xmlNodeSet { + int nodeNr; /* number of nodes in the set */ + int nodeMax; /* size of the array as allocated */ + xmlNodePtr *nodeTab; /* array of nodes in no particular order */ + /* @@ with_ns to check wether namespace nodes should be looked at @@ */ +}; + +/* + * An expression is evaluated to yield an object, which + * has one of the following four basic types: + * - node-set + * - boolean + * - number + * - string + * + * @@ XPointer will add more types ! + */ + +typedef enum { + XPATH_UNDEFINED = 0, + XPATH_NODESET = 1, + XPATH_BOOLEAN = 2, + XPATH_NUMBER = 3, + XPATH_STRING = 4, + XPATH_POINT = 5, + XPATH_RANGE = 6, + XPATH_LOCATIONSET = 7, + XPATH_USERS = 8, + XPATH_XSLT_TREE = 9 /* An XSLT value tree, non modifiable */ +} xmlXPathObjectType; + +typedef struct _xmlXPathObject xmlXPathObject; +typedef xmlXPathObject *xmlXPathObjectPtr; +struct _xmlXPathObject { + xmlXPathObjectType type; + xmlNodeSetPtr nodesetval; + int boolval; + double floatval; + xmlChar *stringval; + void *user; + int index; + void *user2; + int index2; +}; + +/** + * xmlXPathConvertFunc: + * @obj: an XPath object + * @type: the number of the target type + * + * A conversion function is associated to a type and used to cast + * the new type to primitive values. + * + * Returns -1 in case of error, 0 otherwise + */ +typedef int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, int type); + +/* + * Extra type: a name and a conversion function. + */ + +typedef struct _xmlXPathType xmlXPathType; +typedef xmlXPathType *xmlXPathTypePtr; +struct _xmlXPathType { + const xmlChar *name; /* the type name */ + xmlXPathConvertFunc func; /* the conversion function */ +}; + +/* + * Extra variable: a name and a value. + */ + +typedef struct _xmlXPathVariable xmlXPathVariable; +typedef xmlXPathVariable *xmlXPathVariablePtr; +struct _xmlXPathVariable { + const xmlChar *name; /* the variable name */ + xmlXPathObjectPtr value; /* the value */ +}; + +/** + * xmlXPathEvalFunc: + * @ctxt: an XPath parser context + * @nargs: the number of arguments passed to the function + * + * An XPath evaluation function, the parameters are on the XPath context stack. + */ + +typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt, + int nargs); + +/* + * Extra function: a name and a evaluation function. + */ + +typedef struct _xmlXPathFunct xmlXPathFunct; +typedef xmlXPathFunct *xmlXPathFuncPtr; +struct _xmlXPathFunct { + const xmlChar *name; /* the function name */ + xmlXPathEvalFunc func; /* the evaluation function */ +}; + +/** + * xmlXPathAxisFunc: + * @ctxt: the XPath interpreter context + * @cur: the previous node being explored on that axis + * + * An axis traversal function. To traverse an axis, the engine calls + * the first time with cur == NULL and repeat until the function returns + * NULL indicating the end of the axis traversal. + * + * Returns the next node in that axis or NULL if at the end of the axis. + */ + +typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctxt, + xmlXPathObjectPtr cur); + +/* + * Extra axis: a name and an axis function. + */ + +typedef struct _xmlXPathAxis xmlXPathAxis; +typedef xmlXPathAxis *xmlXPathAxisPtr; +struct _xmlXPathAxis { + const xmlChar *name; /* the axis name */ + xmlXPathAxisFunc func; /* the search function */ +}; + +/** + * xmlXPathFunction: + * @ctxt: the XPath interprestation context + * @nargs: the number of arguments + * + * An XPath function. + * The arguments (if any) are popped out from the context stack + * and the result is pushed on the stack. + */ + +typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int nargs); + +/* + * Function and Variable Lookup. + */ + +/** + * xmlXPathVariableLookupFunc: + * @ctxt: an XPath context + * @name: name of the variable + * @ns_uri: the namespace name hosting this variable + * + * Prototype for callbacks used to plug variable lookup in the XPath + * engine. + * + * Returns the XPath object value or NULL if not found. + */ +typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt, + const xmlChar *name, + const xmlChar *ns_uri); + +/** + * xmlXPathFuncLookupFunc: + * @ctxt: an XPath context + * @name: name of the function + * @ns_uri: the namespace name hosting this function + * + * Prototype for callbacks used to plug function lookup in the XPath + * engine. + * + * Returns the XPath function or NULL if not found. + */ +typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt, + const xmlChar *name, + const xmlChar *ns_uri); + +/** + * xmlXPathFlags: + * Flags for XPath engine compilation and runtime + */ +/** + * XML_XPATH_CHECKNS: + * + * check namespaces at compilation + */ +#define XML_XPATH_CHECKNS (1<<0) +/** + * XML_XPATH_NOVAR: + * + * forbid variables in expression + */ +#define XML_XPATH_NOVAR (1<<1) + +/** + * xmlXPathContext: + * + * Expression evaluation occurs with respect to a context. + * he context consists of: + * - a node (the context node) + * - a node list (the context node list) + * - a set of variable bindings + * - a function library + * - the set of namespace declarations in scope for the expression + * Following the switch to hash tables, this need to be trimmed up at + * the next binary incompatible release. + * The node may be modified when the context is passed to libxml2 + * for an XPath evaluation so you may need to initialize it again + * before the next call. + */ + +struct _xmlXPathContext { + xmlDocPtr doc; /* The current document */ + xmlNodePtr node; /* The current node */ + + int nb_variables_unused; /* unused (hash table) */ + int max_variables_unused; /* unused (hash table) */ + xmlHashTablePtr varHash; /* Hash table of defined variables */ + + int nb_types; /* number of defined types */ + int max_types; /* max number of types */ + xmlXPathTypePtr types; /* Array of defined types */ + + int nb_funcs_unused; /* unused (hash table) */ + int max_funcs_unused; /* unused (hash table) */ + xmlHashTablePtr funcHash; /* Hash table of defined funcs */ + + int nb_axis; /* number of defined axis */ + int max_axis; /* max number of axis */ + xmlXPathAxisPtr axis; /* Array of defined axis */ + + /* the namespace nodes of the context node */ + xmlNsPtr *namespaces; /* Array of namespaces */ + int nsNr; /* number of namespace in scope */ + void *user; /* function to free */ + + /* extra variables */ + int contextSize; /* the context size */ + int proximityPosition; /* the proximity position */ + + /* extra stuff for XPointer */ + int xptr; /* is this an XPointer context? */ + xmlNodePtr here; /* for here() */ + xmlNodePtr origin; /* for origin() */ + + /* the set of namespace declarations in scope for the expression */ + xmlHashTablePtr nsHash; /* The namespaces hash table */ + xmlXPathVariableLookupFunc varLookupFunc;/* variable lookup func */ + void *varLookupData; /* variable lookup data */ + + /* Possibility to link in an extra item */ + void *extra; /* needed for XSLT */ + + /* The function name and URI when calling a function */ + const xmlChar *function; + const xmlChar *functionURI; + + /* function lookup function and data */ + xmlXPathFuncLookupFunc funcLookupFunc;/* function lookup func */ + void *funcLookupData; /* function lookup data */ + + /* temporary namespace lists kept for walking the namespace axis */ + xmlNsPtr *tmpNsList; /* Array of namespaces */ + int tmpNsNr; /* number of namespaces in scope */ + + /* error reporting mechanism */ + void *userData; /* user specific data block */ + xmlStructuredErrorFunc error; /* the callback in case of errors */ + xmlError lastError; /* the last error */ + xmlNodePtr debugNode; /* the source node XSLT */ + + /* dictionary */ + xmlDictPtr dict; /* dictionary if any */ + + int flags; /* flags to control compilation */ + + /* Cache for reusal of XPath objects */ + void *cache; +}; + +/* + * The structure of a compiled expression form is not public. + */ + +typedef struct _xmlXPathCompExpr xmlXPathCompExpr; +typedef xmlXPathCompExpr *xmlXPathCompExprPtr; + +/** + * xmlXPathParserContext: + * + * An XPath parser context. It contains pure parsing informations, + * an xmlXPathContext, and the stack of objects. + */ +struct _xmlXPathParserContext { + const xmlChar *cur; /* the current char being parsed */ + const xmlChar *base; /* the full expression */ + + int error; /* error code */ + + xmlXPathContextPtr context; /* the evaluation context */ + xmlXPathObjectPtr value; /* the current value */ + int valueNr; /* number of values stacked */ + int valueMax; /* max number of values stacked */ + xmlXPathObjectPtr *valueTab; /* stack of values */ + + xmlXPathCompExprPtr comp; /* the precompiled expression */ + int xptr; /* it this an XPointer expression */ + xmlNodePtr ancestor; /* used for walking preceding axis */ + + int valueFrame; /* used to limit Pop on the stack */ +}; + +/************************************************************************ + * * + * Public API * + * * + ************************************************************************/ + +/** + * Objects and Nodesets handling + */ + +XMLPUBVAR double xmlXPathNAN; +XMLPUBVAR double xmlXPathPINF; +XMLPUBVAR double xmlXPathNINF; + +/* These macros may later turn into functions */ +/** + * xmlXPathNodeSetGetLength: + * @ns: a node-set + * + * Implement a functionality similar to the DOM NodeList.length. + * + * Returns the number of nodes in the node-set. + */ +#define xmlXPathNodeSetGetLength(ns) ((ns) ? (ns)->nodeNr : 0) +/** + * xmlXPathNodeSetItem: + * @ns: a node-set + * @index: index of a node in the set + * + * Implements a functionality similar to the DOM NodeList.item(). + * + * Returns the xmlNodePtr at the given @index in @ns or NULL if + * @index is out of range (0 to length-1) + */ +#define xmlXPathNodeSetItem(ns, index) \ + ((((ns) != NULL) && \ + ((index) >= 0) && ((index) < (ns)->nodeNr)) ? \ + (ns)->nodeTab[(index)] \ + : NULL) +/** + * xmlXPathNodeSetIsEmpty: + * @ns: a node-set + * + * Checks whether @ns is empty or not. + * + * Returns %TRUE if @ns is an empty node-set. + */ +#define xmlXPathNodeSetIsEmpty(ns) \ + (((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL)) + + +XMLPUBFUN void XMLCALL + xmlXPathFreeObject (xmlXPathObjectPtr obj); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathNodeSetCreate (xmlNodePtr val); +XMLPUBFUN void XMLCALL + xmlXPathFreeNodeSetList (xmlXPathObjectPtr obj); +XMLPUBFUN void XMLCALL + xmlXPathFreeNodeSet (xmlNodeSetPtr obj); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathObjectCopy (xmlXPathObjectPtr val); +XMLPUBFUN int XMLCALL + xmlXPathCmpNodes (xmlNodePtr node1, + xmlNodePtr node2); +/** + * Conversion functions to basic types. + */ +XMLPUBFUN int XMLCALL + xmlXPathCastNumberToBoolean (double val); +XMLPUBFUN int XMLCALL + xmlXPathCastStringToBoolean (const xmlChar * val); +XMLPUBFUN int XMLCALL + xmlXPathCastNodeSetToBoolean(xmlNodeSetPtr ns); +XMLPUBFUN int XMLCALL + xmlXPathCastToBoolean (xmlXPathObjectPtr val); + +XMLPUBFUN double XMLCALL + xmlXPathCastBooleanToNumber (int val); +XMLPUBFUN double XMLCALL + xmlXPathCastStringToNumber (const xmlChar * val); +XMLPUBFUN double XMLCALL + xmlXPathCastNodeToNumber (xmlNodePtr node); +XMLPUBFUN double XMLCALL + xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns); +XMLPUBFUN double XMLCALL + xmlXPathCastToNumber (xmlXPathObjectPtr val); + +XMLPUBFUN xmlChar * XMLCALL + xmlXPathCastBooleanToString (int val); +XMLPUBFUN xmlChar * XMLCALL + xmlXPathCastNumberToString (double val); +XMLPUBFUN xmlChar * XMLCALL + xmlXPathCastNodeToString (xmlNodePtr node); +XMLPUBFUN xmlChar * XMLCALL + xmlXPathCastNodeSetToString (xmlNodeSetPtr ns); +XMLPUBFUN xmlChar * XMLCALL + xmlXPathCastToString (xmlXPathObjectPtr val); + +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathConvertBoolean (xmlXPathObjectPtr val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathConvertNumber (xmlXPathObjectPtr val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathConvertString (xmlXPathObjectPtr val); + +/** + * Context handling. + */ +XMLPUBFUN xmlXPathContextPtr XMLCALL + xmlXPathNewContext (xmlDocPtr doc); +XMLPUBFUN void XMLCALL + xmlXPathFreeContext (xmlXPathContextPtr ctxt); +XMLPUBFUN int XMLCALL + xmlXPathContextSetCache(xmlXPathContextPtr ctxt, + int active, + int value, + int options); +/** + * Evaluation functions. + */ +XMLPUBFUN long XMLCALL + xmlXPathOrderDocElems (xmlDocPtr doc); +XMLPUBFUN int XMLCALL + xmlXPathSetContextNode (xmlNodePtr node, + xmlXPathContextPtr ctx); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathNodeEval (xmlNodePtr node, + const xmlChar *str, + xmlXPathContextPtr ctx); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathEval (const xmlChar *str, + xmlXPathContextPtr ctx); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathEvalExpression (const xmlChar *str, + xmlXPathContextPtr ctxt); +XMLPUBFUN int XMLCALL + xmlXPathEvalPredicate (xmlXPathContextPtr ctxt, + xmlXPathObjectPtr res); +/** + * Separate compilation/evaluation entry points. + */ +XMLPUBFUN xmlXPathCompExprPtr XMLCALL + xmlXPathCompile (const xmlChar *str); +XMLPUBFUN xmlXPathCompExprPtr XMLCALL + xmlXPathCtxtCompile (xmlXPathContextPtr ctxt, + const xmlChar *str); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathCompiledEval (xmlXPathCompExprPtr comp, + xmlXPathContextPtr ctx); +XMLPUBFUN int XMLCALL + xmlXPathCompiledEvalToBoolean(xmlXPathCompExprPtr comp, + xmlXPathContextPtr ctxt); +XMLPUBFUN void XMLCALL + xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp); +#endif /* LIBXML_XPATH_ENABLED */ +#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +XMLPUBFUN void XMLCALL + xmlXPathInit (void); +XMLPUBFUN int XMLCALL + xmlXPathIsNaN (double val); +XMLPUBFUN int XMLCALL + xmlXPathIsInf (double val); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED*/ +#endif /* ! __XML_XPATH_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xpathInternals.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xpathInternals.h new file mode 100644 index 0000000..76a6b48 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xpathInternals.h @@ -0,0 +1,632 @@ +/* + * Summary: internal interfaces for XML Path Language implementation + * Description: internal interfaces for XML Path Language implementation + * used to build new modules on top of XPath like XPointer and + * XSLT + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XPATH_INTERNALS_H__ +#define __XML_XPATH_INTERNALS_H__ + +#include +#include + +#ifdef LIBXML_XPATH_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +/************************************************************************ + * * + * Helpers * + * * + ************************************************************************/ + +/* + * Many of these macros may later turn into functions. They + * shouldn't be used in #ifdef's preprocessor instructions. + */ +/** + * xmlXPathSetError: + * @ctxt: an XPath parser context + * @err: an xmlXPathError code + * + * Raises an error. + */ +#define xmlXPathSetError(ctxt, err) \ + { xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \ + if ((ctxt) != NULL) (ctxt)->error = (err); } + +/** + * xmlXPathSetArityError: + * @ctxt: an XPath parser context + * + * Raises an XPATH_INVALID_ARITY error. + */ +#define xmlXPathSetArityError(ctxt) \ + xmlXPathSetError((ctxt), XPATH_INVALID_ARITY) + +/** + * xmlXPathSetTypeError: + * @ctxt: an XPath parser context + * + * Raises an XPATH_INVALID_TYPE error. + */ +#define xmlXPathSetTypeError(ctxt) \ + xmlXPathSetError((ctxt), XPATH_INVALID_TYPE) + +/** + * xmlXPathGetError: + * @ctxt: an XPath parser context + * + * Get the error code of an XPath context. + * + * Returns the context error. + */ +#define xmlXPathGetError(ctxt) ((ctxt)->error) + +/** + * xmlXPathCheckError: + * @ctxt: an XPath parser context + * + * Check if an XPath error was raised. + * + * Returns true if an error has been raised, false otherwise. + */ +#define xmlXPathCheckError(ctxt) ((ctxt)->error != XPATH_EXPRESSION_OK) + +/** + * xmlXPathGetDocument: + * @ctxt: an XPath parser context + * + * Get the document of an XPath context. + * + * Returns the context document. + */ +#define xmlXPathGetDocument(ctxt) ((ctxt)->context->doc) + +/** + * xmlXPathGetContextNode: + * @ctxt: an XPath parser context + * + * Get the context node of an XPath context. + * + * Returns the context node. + */ +#define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node) + +XMLPUBFUN int XMLCALL + xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt); +XMLPUBFUN double XMLCALL + xmlXPathPopNumber (xmlXPathParserContextPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlXPathPopString (xmlXPathParserContextPtr ctxt); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt); +XMLPUBFUN void * XMLCALL + xmlXPathPopExternal (xmlXPathParserContextPtr ctxt); + +/** + * xmlXPathReturnBoolean: + * @ctxt: an XPath parser context + * @val: a boolean + * + * Pushes the boolean @val on the context stack. + */ +#define xmlXPathReturnBoolean(ctxt, val) \ + valuePush((ctxt), xmlXPathNewBoolean(val)) + +/** + * xmlXPathReturnTrue: + * @ctxt: an XPath parser context + * + * Pushes true on the context stack. + */ +#define xmlXPathReturnTrue(ctxt) xmlXPathReturnBoolean((ctxt), 1) + +/** + * xmlXPathReturnFalse: + * @ctxt: an XPath parser context + * + * Pushes false on the context stack. + */ +#define xmlXPathReturnFalse(ctxt) xmlXPathReturnBoolean((ctxt), 0) + +/** + * xmlXPathReturnNumber: + * @ctxt: an XPath parser context + * @val: a double + * + * Pushes the double @val on the context stack. + */ +#define xmlXPathReturnNumber(ctxt, val) \ + valuePush((ctxt), xmlXPathNewFloat(val)) + +/** + * xmlXPathReturnString: + * @ctxt: an XPath parser context + * @str: a string + * + * Pushes the string @str on the context stack. + */ +#define xmlXPathReturnString(ctxt, str) \ + valuePush((ctxt), xmlXPathWrapString(str)) + +/** + * xmlXPathReturnEmptyString: + * @ctxt: an XPath parser context + * + * Pushes an empty string on the stack. + */ +#define xmlXPathReturnEmptyString(ctxt) \ + valuePush((ctxt), xmlXPathNewCString("")) + +/** + * xmlXPathReturnNodeSet: + * @ctxt: an XPath parser context + * @ns: a node-set + * + * Pushes the node-set @ns on the context stack. + */ +#define xmlXPathReturnNodeSet(ctxt, ns) \ + valuePush((ctxt), xmlXPathWrapNodeSet(ns)) + +/** + * xmlXPathReturnEmptyNodeSet: + * @ctxt: an XPath parser context + * + * Pushes an empty node-set on the context stack. + */ +#define xmlXPathReturnEmptyNodeSet(ctxt) \ + valuePush((ctxt), xmlXPathNewNodeSet(NULL)) + +/** + * xmlXPathReturnExternal: + * @ctxt: an XPath parser context + * @val: user data + * + * Pushes user data on the context stack. + */ +#define xmlXPathReturnExternal(ctxt, val) \ + valuePush((ctxt), xmlXPathWrapExternal(val)) + +/** + * xmlXPathStackIsNodeSet: + * @ctxt: an XPath parser context + * + * Check if the current value on the XPath stack is a node set or + * an XSLT value tree. + * + * Returns true if the current object on the stack is a node-set. + */ +#define xmlXPathStackIsNodeSet(ctxt) \ + (((ctxt)->value != NULL) \ + && (((ctxt)->value->type == XPATH_NODESET) \ + || ((ctxt)->value->type == XPATH_XSLT_TREE))) + +/** + * xmlXPathStackIsExternal: + * @ctxt: an XPath parser context + * + * Checks if the current value on the XPath stack is an external + * object. + * + * Returns true if the current object on the stack is an external + * object. + */ +#define xmlXPathStackIsExternal(ctxt) \ + ((ctxt->value != NULL) && (ctxt->value->type == XPATH_USERS)) + +/** + * xmlXPathEmptyNodeSet: + * @ns: a node-set + * + * Empties a node-set. + */ +#define xmlXPathEmptyNodeSet(ns) \ + { while ((ns)->nodeNr > 0) (ns)->nodeTab[--(ns)->nodeNr] = NULL; } + +/** + * CHECK_ERROR: + * + * Macro to return from the function if an XPath error was detected. + */ +#define CHECK_ERROR \ + if (ctxt->error != XPATH_EXPRESSION_OK) return + +/** + * CHECK_ERROR0: + * + * Macro to return 0 from the function if an XPath error was detected. + */ +#define CHECK_ERROR0 \ + if (ctxt->error != XPATH_EXPRESSION_OK) return(0) + +/** + * XP_ERROR: + * @X: the error code + * + * Macro to raise an XPath error and return. + */ +#define XP_ERROR(X) \ + { xmlXPathErr(ctxt, X); return; } + +/** + * XP_ERROR0: + * @X: the error code + * + * Macro to raise an XPath error and return 0. + */ +#define XP_ERROR0(X) \ + { xmlXPathErr(ctxt, X); return(0); } + +/** + * CHECK_TYPE: + * @typeval: the XPath type + * + * Macro to check that the value on top of the XPath stack is of a given + * type. + */ +#define CHECK_TYPE(typeval) \ + if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ + XP_ERROR(XPATH_INVALID_TYPE) + +/** + * CHECK_TYPE0: + * @typeval: the XPath type + * + * Macro to check that the value on top of the XPath stack is of a given + * type. Return(0) in case of failure + */ +#define CHECK_TYPE0(typeval) \ + if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ + XP_ERROR0(XPATH_INVALID_TYPE) + +/** + * CHECK_ARITY: + * @x: the number of expected args + * + * Macro to check that the number of args passed to an XPath function matches. + */ +#define CHECK_ARITY(x) \ + if (ctxt == NULL) return; \ + if (nargs != (x)) \ + XP_ERROR(XPATH_INVALID_ARITY); \ + if (ctxt->valueNr < ctxt->valueFrame + (x)) \ + XP_ERROR(XPATH_STACK_ERROR); + +/** + * CAST_TO_STRING: + * + * Macro to try to cast the value on the top of the XPath stack to a string. + */ +#define CAST_TO_STRING \ + if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING)) \ + xmlXPathStringFunction(ctxt, 1); + +/** + * CAST_TO_NUMBER: + * + * Macro to try to cast the value on the top of the XPath stack to a number. + */ +#define CAST_TO_NUMBER \ + if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER)) \ + xmlXPathNumberFunction(ctxt, 1); + +/** + * CAST_TO_BOOLEAN: + * + * Macro to try to cast the value on the top of the XPath stack to a boolean. + */ +#define CAST_TO_BOOLEAN \ + if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_BOOLEAN)) \ + xmlXPathBooleanFunction(ctxt, 1); + +/* + * Variable Lookup forwarding. + */ + +XMLPUBFUN void XMLCALL + xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt, + xmlXPathVariableLookupFunc f, + void *data); + +/* + * Function Lookup forwarding. + */ + +XMLPUBFUN void XMLCALL + xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt, + xmlXPathFuncLookupFunc f, + void *funcCtxt); + +/* + * Error reporting. + */ +XMLPUBFUN void XMLCALL + xmlXPatherror (xmlXPathParserContextPtr ctxt, + const char *file, + int line, + int no); + +XMLPUBFUN void XMLCALL + xmlXPathErr (xmlXPathParserContextPtr ctxt, + int error); + +#ifdef LIBXML_DEBUG_ENABLED +XMLPUBFUN void XMLCALL + xmlXPathDebugDumpObject (FILE *output, + xmlXPathObjectPtr cur, + int depth); +XMLPUBFUN void XMLCALL + xmlXPathDebugDumpCompExpr(FILE *output, + xmlXPathCompExprPtr comp, + int depth); +#endif +/** + * NodeSet handling. + */ +XMLPUBFUN int XMLCALL + xmlXPathNodeSetContains (xmlNodeSetPtr cur, + xmlNodePtr val); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathDifference (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathIntersection (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); + +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathDistinctSorted (xmlNodeSetPtr nodes); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathDistinct (xmlNodeSetPtr nodes); + +XMLPUBFUN int XMLCALL + xmlXPathHasSameNodes (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); + +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes, + xmlNodePtr node); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathLeadingSorted (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathNodeLeading (xmlNodeSetPtr nodes, + xmlNodePtr node); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathLeading (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); + +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes, + xmlNodePtr node); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathTrailingSorted (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathNodeTrailing (xmlNodeSetPtr nodes, + xmlNodePtr node); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathTrailing (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); + + +/** + * Extending a context. + */ + +XMLPUBFUN int XMLCALL + xmlXPathRegisterNs (xmlXPathContextPtr ctxt, + const xmlChar *prefix, + const xmlChar *ns_uri); +XMLPUBFUN const xmlChar * XMLCALL + xmlXPathNsLookup (xmlXPathContextPtr ctxt, + const xmlChar *prefix); +XMLPUBFUN void XMLCALL + xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt); + +XMLPUBFUN int XMLCALL + xmlXPathRegisterFunc (xmlXPathContextPtr ctxt, + const xmlChar *name, + xmlXPathFunction f); +XMLPUBFUN int XMLCALL + xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt, + const xmlChar *name, + const xmlChar *ns_uri, + xmlXPathFunction f); +XMLPUBFUN int XMLCALL + xmlXPathRegisterVariable (xmlXPathContextPtr ctxt, + const xmlChar *name, + xmlXPathObjectPtr value); +XMLPUBFUN int XMLCALL + xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt, + const xmlChar *name, + const xmlChar *ns_uri, + xmlXPathObjectPtr value); +XMLPUBFUN xmlXPathFunction XMLCALL + xmlXPathFunctionLookup (xmlXPathContextPtr ctxt, + const xmlChar *name); +XMLPUBFUN xmlXPathFunction XMLCALL + xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt, + const xmlChar *name, + const xmlChar *ns_uri); +XMLPUBFUN void XMLCALL + xmlXPathRegisteredFuncsCleanup (xmlXPathContextPtr ctxt); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathVariableLookup (xmlXPathContextPtr ctxt, + const xmlChar *name); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt, + const xmlChar *name, + const xmlChar *ns_uri); +XMLPUBFUN void XMLCALL + xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt); + +/** + * Utilities to extend XPath. + */ +XMLPUBFUN xmlXPathParserContextPtr XMLCALL + xmlXPathNewParserContext (const xmlChar *str, + xmlXPathContextPtr ctxt); +XMLPUBFUN void XMLCALL + xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt); + +/* TODO: remap to xmlXPathValuePop and Push. */ +XMLPUBFUN xmlXPathObjectPtr XMLCALL + valuePop (xmlXPathParserContextPtr ctxt); +XMLPUBFUN int XMLCALL + valuePush (xmlXPathParserContextPtr ctxt, + xmlXPathObjectPtr value); + +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathNewString (const xmlChar *val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathNewCString (const char *val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathWrapString (xmlChar *val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathWrapCString (char * val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathNewFloat (double val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathNewBoolean (int val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathNewNodeSet (xmlNodePtr val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathNewValueTree (xmlNodePtr val); +XMLPUBFUN int XMLCALL + xmlXPathNodeSetAdd (xmlNodeSetPtr cur, + xmlNodePtr val); +XMLPUBFUN int XMLCALL + xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur, + xmlNodePtr val); +XMLPUBFUN int XMLCALL + xmlXPathNodeSetAddNs (xmlNodeSetPtr cur, + xmlNodePtr node, + xmlNsPtr ns); +XMLPUBFUN void XMLCALL + xmlXPathNodeSetSort (xmlNodeSetPtr set); + +XMLPUBFUN void XMLCALL + xmlXPathRoot (xmlXPathParserContextPtr ctxt); +XMLPUBFUN void XMLCALL + xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlXPathParseName (xmlXPathParserContextPtr ctxt); +XMLPUBFUN xmlChar * XMLCALL + xmlXPathParseNCName (xmlXPathParserContextPtr ctxt); + +/* + * Existing functions. + */ +XMLPUBFUN double XMLCALL + xmlXPathStringEvalNumber (const xmlChar *str); +XMLPUBFUN int XMLCALL + xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt, + xmlXPathObjectPtr res); +XMLPUBFUN void XMLCALL + xmlXPathRegisterAllFunctions (xmlXPathContextPtr ctxt); +XMLPUBFUN xmlNodeSetPtr XMLCALL + xmlXPathNodeSetMerge (xmlNodeSetPtr val1, + xmlNodeSetPtr val2); +XMLPUBFUN void XMLCALL + xmlXPathNodeSetDel (xmlNodeSetPtr cur, + xmlNodePtr val); +XMLPUBFUN void XMLCALL + xmlXPathNodeSetRemove (xmlNodeSetPtr cur, + int val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathNewNodeSetList (xmlNodeSetPtr val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathWrapNodeSet (xmlNodeSetPtr val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPathWrapExternal (void *val); + +XMLPUBFUN int XMLCALL xmlXPathEqualValues(xmlXPathParserContextPtr ctxt); +XMLPUBFUN int XMLCALL xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt); +XMLPUBFUN int XMLCALL xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict); +XMLPUBFUN void XMLCALL xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt); +XMLPUBFUN void XMLCALL xmlXPathAddValues(xmlXPathParserContextPtr ctxt); +XMLPUBFUN void XMLCALL xmlXPathSubValues(xmlXPathParserContextPtr ctxt); +XMLPUBFUN void XMLCALL xmlXPathMultValues(xmlXPathParserContextPtr ctxt); +XMLPUBFUN void XMLCALL xmlXPathDivValues(xmlXPathParserContextPtr ctxt); +XMLPUBFUN void XMLCALL xmlXPathModValues(xmlXPathParserContextPtr ctxt); + +XMLPUBFUN int XMLCALL xmlXPathIsNodeType(const xmlChar *name); + +/* + * Some of the axis navigation routines. + */ +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextSelf(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextChild(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextParent(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +/* + * The official core of XPath functions. + */ +XMLPUBFUN void XMLCALL xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs); +XMLPUBFUN void XMLCALL xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs); + +/** + * Really internal functions + */ +XMLPUBFUN void XMLCALL xmlXPathNodeSetFreeNs(xmlNsPtr ns); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_XPATH_ENABLED */ +#endif /* ! __XML_XPATH_INTERNALS_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xpointer.h b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xpointer.h new file mode 100644 index 0000000..b99112b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/libxml2/libxml/xpointer.h @@ -0,0 +1,114 @@ +/* + * Summary: API to handle XML Pointers + * Description: API to handle XML Pointers + * Base implementation was made accordingly to + * W3C Candidate Recommendation 7 June 2000 + * http://www.w3.org/TR/2000/CR-xptr-20000607 + * + * Added support for the element() scheme described in: + * W3C Proposed Recommendation 13 November 2002 + * http://www.w3.org/TR/2002/PR-xptr-element-20021113/ + * + * Copy: See Copyright for the status of this software. + * + * Author: Daniel Veillard + */ + +#ifndef __XML_XPTR_H__ +#define __XML_XPTR_H__ + +#include + +#ifdef LIBXML_XPTR_ENABLED + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * A Location Set + */ +typedef struct _xmlLocationSet xmlLocationSet; +typedef xmlLocationSet *xmlLocationSetPtr; +struct _xmlLocationSet { + int locNr; /* number of locations in the set */ + int locMax; /* size of the array as allocated */ + xmlXPathObjectPtr *locTab;/* array of locations */ +}; + +/* + * Handling of location sets. + */ + +XMLPUBFUN xmlLocationSetPtr XMLCALL + xmlXPtrLocationSetCreate (xmlXPathObjectPtr val); +XMLPUBFUN void XMLCALL + xmlXPtrFreeLocationSet (xmlLocationSetPtr obj); +XMLPUBFUN xmlLocationSetPtr XMLCALL + xmlXPtrLocationSetMerge (xmlLocationSetPtr val1, + xmlLocationSetPtr val2); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPtrNewRange (xmlNodePtr start, + int startindex, + xmlNodePtr end, + int endindex); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPtrNewRangePoints (xmlXPathObjectPtr start, + xmlXPathObjectPtr end); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPtrNewRangeNodePoint (xmlNodePtr start, + xmlXPathObjectPtr end); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPtrNewRangePointNode (xmlXPathObjectPtr start, + xmlNodePtr end); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPtrNewRangeNodes (xmlNodePtr start, + xmlNodePtr end); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPtrNewLocationSetNodes (xmlNodePtr start, + xmlNodePtr end); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPtrNewRangeNodeObject (xmlNodePtr start, + xmlXPathObjectPtr end); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPtrNewCollapsedRange (xmlNodePtr start); +XMLPUBFUN void XMLCALL + xmlXPtrLocationSetAdd (xmlLocationSetPtr cur, + xmlXPathObjectPtr val); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPtrWrapLocationSet (xmlLocationSetPtr val); +XMLPUBFUN void XMLCALL + xmlXPtrLocationSetDel (xmlLocationSetPtr cur, + xmlXPathObjectPtr val); +XMLPUBFUN void XMLCALL + xmlXPtrLocationSetRemove (xmlLocationSetPtr cur, + int val); + +/* + * Functions. + */ +XMLPUBFUN xmlXPathContextPtr XMLCALL + xmlXPtrNewContext (xmlDocPtr doc, + xmlNodePtr here, + xmlNodePtr origin); +XMLPUBFUN xmlXPathObjectPtr XMLCALL + xmlXPtrEval (const xmlChar *str, + xmlXPathContextPtr ctx); +XMLPUBFUN void XMLCALL + xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt, + int nargs); +XMLPUBFUN xmlNodePtr XMLCALL + xmlXPtrBuildNodeList (xmlXPathObjectPtr obj); +XMLPUBFUN void XMLCALL + xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt); +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_XPTR_ENABLED */ +#endif /* __XML_XPTR_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/ltdl.h b/dingux/opt/mipsel-linux-uclibc/include/ltdl.h new file mode 100644 index 0000000..f811399 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ltdl.h @@ -0,0 +1,163 @@ +/* ltdl.h -- generic dlopen functions + + Copyright (C) 1998-2000, 2004-2005, 2007-2008, 2011-2015 Free + Software Foundation, Inc. + Written by Thomas Tanner, 1998 + + NOTE: The canonical source of this file is maintained with the + GNU Libtool package. Report bugs to bug-libtool@gnu.org. + +GNU Libltdl is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +As a special exception to the GNU Lesser General Public License, +if you distribute this file as part of a program or library that +is built using GNU Libtool, you may include this file under the +same distribution terms that you use for the rest of that program. + +GNU Libltdl is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with GNU Libltdl; see the file COPYING.LIB. If not, a +copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, +or obtained by writing to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +/* Only include this header file once. */ +#if !defined LTDL_H +#define LTDL_H 1 + +#include +#include +#include + +LT_BEGIN_C_DECLS + + +/* LT_STRLEN can be used safely on NULL pointers. */ +#define LT_STRLEN(s) (((s) && (s)[0]) ? strlen (s) : 0) + + +/* --- DYNAMIC MODULE LOADING API --- */ + + +typedef struct lt__handle *lt_dlhandle; /* A loaded module. */ + +/* Initialisation and finalisation functions for libltdl. */ +LT_SCOPE int lt_dlinit (void); +LT_SCOPE int lt_dlexit (void); + +/* Module search path manipulation. */ +LT_SCOPE int lt_dladdsearchdir (const char *search_dir); +LT_SCOPE int lt_dlinsertsearchdir (const char *before, + const char *search_dir); +LT_SCOPE int lt_dlsetsearchpath (const char *search_path); +LT_SCOPE const char *lt_dlgetsearchpath (void); +LT_SCOPE int lt_dlforeachfile ( + const char *search_path, + int (*func) (const char *filename, void *data), + void *data); + +/* User module loading advisors. */ +LT_SCOPE int lt_dladvise_init (lt_dladvise *advise); +LT_SCOPE int lt_dladvise_destroy (lt_dladvise *advise); +LT_SCOPE int lt_dladvise_ext (lt_dladvise *advise); +LT_SCOPE int lt_dladvise_resident (lt_dladvise *advise); +LT_SCOPE int lt_dladvise_local (lt_dladvise *advise); +LT_SCOPE int lt_dladvise_global (lt_dladvise *advise); +LT_SCOPE int lt_dladvise_preload (lt_dladvise *advise); + +/* Portable libltdl versions of the system dlopen() API. */ +LT_SCOPE lt_dlhandle lt_dlopen (const char *filename); +LT_SCOPE lt_dlhandle lt_dlopenext (const char *filename); +LT_SCOPE lt_dlhandle lt_dlopenadvise (const char *filename, + lt_dladvise advise); +LT_SCOPE void * lt_dlsym (lt_dlhandle handle, const char *name); +LT_SCOPE const char *lt_dlerror (void); +LT_SCOPE int lt_dlclose (lt_dlhandle handle); + + + +/* --- PRELOADED MODULE SUPPORT --- */ + + +/* A preopened symbol. Arrays of this type comprise the exported + symbols for a dlpreopened module. */ +typedef struct { + const char *name; + void *address; +} lt_dlsymlist; + +typedef int lt_dlpreload_callback_func (lt_dlhandle handle); + +LT_SCOPE int lt_dlpreload (const lt_dlsymlist *preloaded); +LT_SCOPE int lt_dlpreload_default (const lt_dlsymlist *preloaded); +LT_SCOPE int lt_dlpreload_open (const char *originator, + lt_dlpreload_callback_func *func); + +#define lt_preloaded_symbols lt__PROGRAM__LTX_preloaded_symbols +/* Ensure C linkage. */ +extern LT_DLSYM_CONST lt_dlsymlist lt__PROGRAM__LTX_preloaded_symbols[]; + +#define LTDL_SET_PRELOADED_SYMBOLS() \ + lt_dlpreload_default(lt_preloaded_symbols) + + + + +/* --- MODULE INFORMATION --- */ + + +/* Associating user data with loaded modules. */ +typedef void * lt_dlinterface_id; +typedef int lt_dlhandle_interface (lt_dlhandle handle, const char *id_string); + +LT_SCOPE lt_dlinterface_id lt_dlinterface_register (const char *id_string, + lt_dlhandle_interface *iface); +LT_SCOPE void lt_dlinterface_free (lt_dlinterface_id key); +LT_SCOPE void * lt_dlcaller_set_data (lt_dlinterface_id key, + lt_dlhandle handle, void *data); +LT_SCOPE void * lt_dlcaller_get_data (lt_dlinterface_id key, + lt_dlhandle handle); + + +/* Read only information pertaining to a loaded module. */ +typedef struct { + char * filename; /* file name */ + char * name; /* module name */ + int ref_count; /* number of times lt_dlopened minus + number of times lt_dlclosed. */ + unsigned int is_resident:1; /* module can't be unloaded. */ + unsigned int is_symglobal:1; /* module symbols can satisfy + subsequently loaded modules. */ + unsigned int is_symlocal:1; /* module symbols are only available + locally. */ +} lt_dlinfo; + +LT_SCOPE const lt_dlinfo *lt_dlgetinfo (lt_dlhandle handle); + +LT_SCOPE lt_dlhandle lt_dlhandle_iterate (lt_dlinterface_id iface, + lt_dlhandle place); +LT_SCOPE lt_dlhandle lt_dlhandle_fetch (lt_dlinterface_id iface, + const char *module_name); +LT_SCOPE int lt_dlhandle_map (lt_dlinterface_id iface, + int (*func) (lt_dlhandle handle, void *data), + void *data); + + + +/* Deprecated module residency management API. */ +LT_SCOPE int lt_dlmakeresident (lt_dlhandle handle); +LT_SCOPE int lt_dlisresident (lt_dlhandle handle); + +#define lt_ptr void * + +LT_END_C_DECLS + +#endif /*!defined LTDL_H*/ diff --git a/dingux/opt/mipsel-linux-uclibc/include/mpc.h b/dingux/opt/mipsel-linux-uclibc/include/mpc.h new file mode 100644 index 0000000..f6e1bee --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/mpc.h @@ -0,0 +1,269 @@ +/* mpc.h -- Include file for mpc. + +Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012, 2014, 2015 INRIA + +This file is part of GNU MPC. + +GNU MPC is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +GNU MPC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for +more details. + +You should have received a copy of the GNU Lesser General Public License +along with this program. If not, see http://www.gnu.org/licenses/ . +*/ + +#ifndef __MPC_H +#define __MPC_H + +#include "gmp.h" +#include "mpfr.h" + +/* Backwards compatibility with mpfr<3.0.0 */ +#ifndef mpfr_exp_t +#define mpfr_exp_t mp_exp_t +#endif + +/* Define MPC version number */ +#define MPC_VERSION_MAJOR 1 +#define MPC_VERSION_MINOR 0 +#define MPC_VERSION_PATCHLEVEL 3 +#define MPC_VERSION_STRING "1.0.3" + +/* Macros dealing with MPC VERSION */ +#define MPC_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) +#define MPC_VERSION \ + MPC_VERSION_NUM(MPC_VERSION_MAJOR,MPC_VERSION_MINOR,MPC_VERSION_PATCHLEVEL) + +/* Check if stdint.h/inttypes.h is included */ +#if defined (INTMAX_C) && defined (UINTMAX_C) +#define _MPC_H_HAVE_INTMAX_T 1 +#endif + +/* Return values */ + +/* Transform negative to 2, positive to 1, leave 0 unchanged */ +#define MPC_INEX_POS(inex) (((inex) < 0) ? 2 : ((inex) == 0) ? 0 : 1) +/* Transform 2 to negative, 1 to positive, leave 0 unchanged */ +#define MPC_INEX_NEG(inex) (((inex) == 2) ? -1 : ((inex) == 0) ? 0 : 1) + +/* The global inexact flag is made of (real flag) + 4 * (imaginary flag), where + each of the real and imaginary inexact flag are: + 0 when the result is exact (no rounding error) + 1 when the result is larger than the exact value + 2 when the result is smaller than the exact value */ +#define MPC_INEX(inex_re, inex_im) \ + (MPC_INEX_POS(inex_re) | (MPC_INEX_POS(inex_im) << 2)) +#define MPC_INEX_RE(inex) MPC_INEX_NEG((inex) & 3) +#define MPC_INEX_IM(inex) MPC_INEX_NEG((inex) >> 2) + +/* For functions computing two results, the return value is + inexact1+16*inexact2, which is 0 iif both results are exact. */ +#define MPC_INEX12(inex1, inex2) (inex1 | (inex2 << 4)) +#define MPC_INEX1(inex) (inex & 15) +#define MPC_INEX2(inex) (inex >> 4) + +/* Definition of rounding modes */ + +/* a complex rounding mode is just a pair of two real rounding modes + we reserve four bits for a real rounding mode. */ +typedef int mpc_rnd_t; + +#define MPC_RND(r1,r2) (((int)(r1)) + ((int)(r2) << 4)) +#define MPC_RND_RE(x) ((mpfr_rnd_t)((x) & 0x0F)) +#define MPC_RND_IM(x) ((mpfr_rnd_t)((x) >> 4)) + +#define MPC_RNDNN MPC_RND (GMP_RNDN,GMP_RNDN) +#define MPC_RNDNZ MPC_RND (GMP_RNDN,GMP_RNDZ) +#define MPC_RNDNU MPC_RND (GMP_RNDN,GMP_RNDU) +#define MPC_RNDND MPC_RND (GMP_RNDN,GMP_RNDD) + +#define MPC_RNDZN MPC_RND (GMP_RNDZ,GMP_RNDN) +#define MPC_RNDZZ MPC_RND (GMP_RNDZ,GMP_RNDZ) +#define MPC_RNDZU MPC_RND (GMP_RNDZ,GMP_RNDU) +#define MPC_RNDZD MPC_RND (GMP_RNDZ,GMP_RNDD) + +#define MPC_RNDUN MPC_RND (GMP_RNDU,GMP_RNDN) +#define MPC_RNDUZ MPC_RND (GMP_RNDU,GMP_RNDZ) +#define MPC_RNDUU MPC_RND (GMP_RNDU,GMP_RNDU) +#define MPC_RNDUD MPC_RND (GMP_RNDU,GMP_RNDD) + +#define MPC_RNDDN MPC_RND (GMP_RNDD,GMP_RNDN) +#define MPC_RNDDZ MPC_RND (GMP_RNDD,GMP_RNDZ) +#define MPC_RNDDU MPC_RND (GMP_RNDD,GMP_RNDU) +#define MPC_RNDDD MPC_RND (GMP_RNDD,GMP_RNDD) + + +/* Definitions of types and their semantics */ + +typedef struct { + mpfr_t re; + mpfr_t im; +} +__mpc_struct; + +typedef __mpc_struct mpc_t[1]; +typedef __mpc_struct *mpc_ptr; +typedef const __mpc_struct *mpc_srcptr; + +/* Support for WINDOWS DLL, see + http://lists.gforge.inria.fr/pipermail/mpc-discuss/2011-November/000990.html; + when building the DLL, export symbols, otherwise behave as GMP */ +#if defined (__MPC_LIBRARY_BUILD) && __GMP_LIBGMP_DLL +#define __MPC_DECLSPEC __GMP_DECLSPEC_EXPORT +#else +#define __MPC_DECLSPEC __GMP_DECLSPEC +#endif + +#if defined (__cplusplus) +extern "C" { +#endif + +__MPC_DECLSPEC int mpc_add (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_add_fr (mpc_ptr, mpc_srcptr, mpfr_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_add_si (mpc_ptr, mpc_srcptr, long int, mpc_rnd_t); +__MPC_DECLSPEC int mpc_add_ui (mpc_ptr, mpc_srcptr, unsigned long int, mpc_rnd_t); +__MPC_DECLSPEC int mpc_sub (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_sub_fr (mpc_ptr, mpc_srcptr, mpfr_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_fr_sub (mpc_ptr, mpfr_srcptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_sub_ui (mpc_ptr, mpc_srcptr, unsigned long int, mpc_rnd_t); +__MPC_DECLSPEC int mpc_ui_ui_sub (mpc_ptr, unsigned long int, unsigned long int, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_mul (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_mul_fr (mpc_ptr, mpc_srcptr, mpfr_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_mul_ui (mpc_ptr, mpc_srcptr, unsigned long int, mpc_rnd_t); +__MPC_DECLSPEC int mpc_mul_si (mpc_ptr, mpc_srcptr, long int, mpc_rnd_t); +__MPC_DECLSPEC int mpc_mul_i (mpc_ptr, mpc_srcptr, int, mpc_rnd_t); +__MPC_DECLSPEC int mpc_sqr (mpc_ptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_div (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_pow (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_pow_fr (mpc_ptr, mpc_srcptr, mpfr_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_pow_ld (mpc_ptr, mpc_srcptr, long double, mpc_rnd_t); +__MPC_DECLSPEC int mpc_pow_d (mpc_ptr, mpc_srcptr, double, mpc_rnd_t); +__MPC_DECLSPEC int mpc_pow_si (mpc_ptr, mpc_srcptr, long, mpc_rnd_t); +__MPC_DECLSPEC int mpc_pow_ui (mpc_ptr, mpc_srcptr, unsigned long, mpc_rnd_t); +__MPC_DECLSPEC int mpc_pow_z (mpc_ptr, mpc_srcptr, mpz_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_div_fr (mpc_ptr, mpc_srcptr, mpfr_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_fr_div (mpc_ptr, mpfr_srcptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_div_ui (mpc_ptr, mpc_srcptr, unsigned long int, mpc_rnd_t); +__MPC_DECLSPEC int mpc_ui_div (mpc_ptr, unsigned long int, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_div_2ui (mpc_ptr, mpc_srcptr, unsigned long int, mpc_rnd_t); +__MPC_DECLSPEC int mpc_mul_2ui (mpc_ptr, mpc_srcptr, unsigned long int, mpc_rnd_t); +__MPC_DECLSPEC int mpc_div_2si (mpc_ptr, mpc_srcptr, long int, mpc_rnd_t); +__MPC_DECLSPEC int mpc_mul_2si (mpc_ptr, mpc_srcptr, long int, mpc_rnd_t); +__MPC_DECLSPEC int mpc_conj (mpc_ptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_neg (mpc_ptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_norm (mpfr_ptr, mpc_srcptr, mpfr_rnd_t); +__MPC_DECLSPEC int mpc_abs (mpfr_ptr, mpc_srcptr, mpfr_rnd_t); +__MPC_DECLSPEC int mpc_sqrt (mpc_ptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_set (mpc_ptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_set_d (mpc_ptr, double, mpc_rnd_t); +__MPC_DECLSPEC int mpc_set_d_d (mpc_ptr, double, double, mpc_rnd_t); +__MPC_DECLSPEC int mpc_set_ld (mpc_ptr, long double, mpc_rnd_t); +__MPC_DECLSPEC int mpc_set_ld_ld (mpc_ptr, long double, long double, mpc_rnd_t); +__MPC_DECLSPEC int mpc_set_f (mpc_ptr, mpf_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_set_f_f (mpc_ptr, mpf_srcptr, mpf_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_set_fr (mpc_ptr, mpfr_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_set_fr_fr (mpc_ptr, mpfr_srcptr, mpfr_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_set_q (mpc_ptr, mpq_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_set_q_q (mpc_ptr, mpq_srcptr, mpq_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_set_si (mpc_ptr, long int, mpc_rnd_t); +__MPC_DECLSPEC int mpc_set_si_si (mpc_ptr, long int, long int, mpc_rnd_t); +__MPC_DECLSPEC int mpc_set_ui (mpc_ptr, unsigned long int, mpc_rnd_t); +__MPC_DECLSPEC int mpc_set_ui_ui (mpc_ptr, unsigned long int, unsigned long int, mpc_rnd_t); +__MPC_DECLSPEC int mpc_set_z (mpc_ptr, mpz_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_set_z_z (mpc_ptr, mpz_srcptr, mpz_srcptr, mpc_rnd_t); +__MPC_DECLSPEC void mpc_swap (mpc_ptr, mpc_ptr); +__MPC_DECLSPEC int mpc_fma (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t); + +__MPC_DECLSPEC void mpc_set_nan (mpc_ptr); + +__MPC_DECLSPEC int mpc_real (mpfr_ptr, mpc_srcptr, mpfr_rnd_t); +__MPC_DECLSPEC int mpc_imag (mpfr_ptr, mpc_srcptr, mpfr_rnd_t); +__MPC_DECLSPEC int mpc_arg (mpfr_ptr, mpc_srcptr, mpfr_rnd_t); +__MPC_DECLSPEC int mpc_proj (mpc_ptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_cmp (mpc_srcptr, mpc_srcptr); +__MPC_DECLSPEC int mpc_cmp_si_si (mpc_srcptr, long int, long int); +__MPC_DECLSPEC int mpc_exp (mpc_ptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_log (mpc_ptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_log10 (mpc_ptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_sin (mpc_ptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_cos (mpc_ptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_sin_cos (mpc_ptr, mpc_ptr, mpc_srcptr, mpc_rnd_t, mpc_rnd_t); +__MPC_DECLSPEC int mpc_tan (mpc_ptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_sinh (mpc_ptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_cosh (mpc_ptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_tanh (mpc_ptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_asin (mpc_ptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_acos (mpc_ptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_atan (mpc_ptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_asinh (mpc_ptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_acosh (mpc_ptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC int mpc_atanh (mpc_ptr, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC void mpc_clear (mpc_ptr); +__MPC_DECLSPEC int mpc_urandom (mpc_ptr, gmp_randstate_t); +__MPC_DECLSPEC void mpc_init2 (mpc_ptr, mpfr_prec_t); +__MPC_DECLSPEC void mpc_init3 (mpc_ptr, mpfr_prec_t, mpfr_prec_t); +__MPC_DECLSPEC mpfr_prec_t mpc_get_prec (mpc_srcptr x); +__MPC_DECLSPEC void mpc_get_prec2 (mpfr_prec_t *pr, mpfr_prec_t *pi, mpc_srcptr x); +__MPC_DECLSPEC void mpc_set_prec (mpc_ptr, mpfr_prec_t); +__MPC_DECLSPEC const char * mpc_get_version (void); + +__MPC_DECLSPEC int mpc_strtoc (mpc_ptr, const char *, char **, int, mpc_rnd_t); +__MPC_DECLSPEC int mpc_set_str (mpc_ptr, const char *, int, mpc_rnd_t); +__MPC_DECLSPEC char * mpc_get_str (int, size_t, mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC void mpc_free_str (char *); + +/* declare certain functions only if appropriate headers have been included */ +#ifdef _MPC_H_HAVE_INTMAX_T +__MPC_DECLSPEC int mpc_set_sj (mpc_ptr, intmax_t, mpc_rnd_t); +__MPC_DECLSPEC int mpc_set_uj (mpc_ptr, uintmax_t, mpc_rnd_t); +__MPC_DECLSPEC int mpc_set_sj_sj (mpc_ptr, intmax_t, intmax_t, mpc_rnd_t); +__MPC_DECLSPEC int mpc_set_uj_uj (mpc_ptr, uintmax_t, uintmax_t, mpc_rnd_t); +#endif + +#ifdef _Complex_I +__MPC_DECLSPEC int mpc_set_dc (mpc_ptr, double _Complex, mpc_rnd_t); +__MPC_DECLSPEC int mpc_set_ldc (mpc_ptr, long double _Complex, mpc_rnd_t); +__MPC_DECLSPEC double _Complex mpc_get_dc (mpc_srcptr, mpc_rnd_t); +__MPC_DECLSPEC long double _Complex mpc_get_ldc (mpc_srcptr, mpc_rnd_t); +#endif + +#ifdef _GMP_H_HAVE_FILE +__MPC_DECLSPEC int mpc_inp_str (mpc_ptr, FILE *, size_t *, int, mpc_rnd_t); +__MPC_DECLSPEC size_t mpc_out_str (FILE *, int, size_t, mpc_srcptr, mpc_rnd_t); +#endif + +#if defined (__cplusplus) +} +#endif + +#define mpc_realref(x) ((x)->re) +#define mpc_imagref(x) ((x)->im) + +#define mpc_cmp_si(x, y) \ + ( mpc_cmp_si_si ((x), (y), 0l) ) +#define mpc_ui_sub(x, y, z, r) mpc_ui_ui_sub (x, y, 0ul, z, r) + +/* + Define a fake mpfr_set_fr so that, for instance, mpc_set_fr_z would + be defined as follows: + mpc_set_fr_z (mpc_t rop, mpfr_t x, mpz_t y, mpc_rnd_t rnd) + MPC_SET_X_Y (fr, z, rop, x, y, rnd) +*/ +#ifndef mpfr_set_fr +#define mpfr_set_fr mpfr_set +#endif +#define MPC_SET_X_Y(real_t, imag_t, z, real_value, imag_value, rnd) \ + { \ + int _inex_re, _inex_im; \ + _inex_re = (mpfr_set_ ## real_t) (mpc_realref (z), (real_value), MPC_RND_RE (rnd)); \ + _inex_im = (mpfr_set_ ## imag_t) (mpc_imagref (z), (imag_value), MPC_RND_IM (rnd)); \ + return MPC_INEX (_inex_re, _inex_im); \ + } + +#endif /* ifndef __MPC_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/mpf2mpfr.h b/dingux/opt/mipsel-linux-uclibc/include/mpf2mpfr.h new file mode 100644 index 0000000..17b70fc --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/mpf2mpfr.h @@ -0,0 +1,175 @@ +/* mpf2mpfr.h -- Compatibility include file with mpf. + +Copyright 1999-2002, 2004-2017 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef __MPFR_FROM_MPF__ +#define __MPFR_FROM_MPF__ + +/* types */ +#define mpf_t mpfr_t +#define mpf_srcptr mpfr_srcptr +#define mpf_ptr mpfr_ptr + +/* Get current Rounding Mode */ +#ifndef MPFR_DEFAULT_RND +# define MPFR_DEFAULT_RND mpfr_get_default_rounding_mode () +#endif + +/* mpf_init initalizes at 0 */ +#undef mpf_init +#define mpf_init(x) mpfr_init_set_ui ((x), 0, MPFR_DEFAULT_RND) +#undef mpf_init2 +#define mpf_init2(x,p) (mpfr_init2((x),(p)), mpfr_set_ui ((x), 0, MPFR_DEFAULT_RND)) + +/* functions which don't take as argument the rounding mode */ +#undef mpf_ceil +#define mpf_ceil mpfr_ceil +#undef mpf_clear +#define mpf_clear mpfr_clear +#undef mpf_cmp +#define mpf_cmp mpfr_cmp +#undef mpf_cmp_si +#define mpf_cmp_si mpfr_cmp_si +#undef mpf_cmp_ui +#define mpf_cmp_ui mpfr_cmp_ui +#undef mpf_cmp_d +#define mpf_cmp_d mpfr_cmp_d +#undef mpf_eq +#define mpf_eq mpfr_eq +#undef mpf_floor +#define mpf_floor mpfr_floor +#undef mpf_get_prec +#define mpf_get_prec mpfr_get_prec +#undef mpf_integer_p +#define mpf_integer_p mpfr_integer_p +#undef mpf_random2 +#define mpf_random2 mpfr_random2 +#undef mpf_set_default_prec +#define mpf_set_default_prec mpfr_set_default_prec +#undef mpf_get_default_prec +#define mpf_get_default_prec mpfr_get_default_prec +#undef mpf_set_prec +#define mpf_set_prec mpfr_set_prec +#undef mpf_set_prec_raw +#define mpf_set_prec_raw(x,p) mpfr_prec_round(x,p,MPFR_DEFAULT_RND) +#undef mpf_trunc +#define mpf_trunc mpfr_trunc +#undef mpf_sgn +#define mpf_sgn mpfr_sgn +#undef mpf_swap +#define mpf_swap mpfr_swap +#undef mpf_dump +#define mpf_dump mpfr_dump + +/* functions which take as argument the rounding mode */ +#undef mpf_abs +#define mpf_abs(x,y) mpfr_abs(x,y,MPFR_DEFAULT_RND) +#undef mpf_add +#define mpf_add(x,y,z) mpfr_add(x,y,z,MPFR_DEFAULT_RND) +#undef mpf_add_ui +#define mpf_add_ui(x,y,z) mpfr_add_ui(x,y,z,MPFR_DEFAULT_RND) +#undef mpf_div +#define mpf_div(x,y,z) mpfr_div(x,y,z,MPFR_DEFAULT_RND) +#undef mpf_div_ui +#define mpf_div_ui(x,y,z) mpfr_div_ui(x,y,z,MPFR_DEFAULT_RND) +#undef mpf_div_2exp +#define mpf_div_2exp(x,y,z) mpfr_div_2exp(x,y,z,MPFR_DEFAULT_RND) +#undef mpf_fits_slong_p +#define mpf_fits_slong_p(x) mpfr_fits_slong_p(x,MPFR_DEFAULT_RND) +#undef mpf_fits_ulong_p +#define mpf_fits_ulong_p(x) mpfr_fits_ulong_p(x,MPFR_DEFAULT_RND) +#undef mpf_fits_sint_p +#define mpf_fits_sint_p(x) mpfr_fits_sint_p(x,MPFR_DEFAULT_RND) +#undef mpf_fits_uint_p +#define mpf_fits_uint_p(x) mpfr_fits_uint_p(x,MPFR_DEFAULT_RND) +#undef mpf_fits_sshort_p +#define mpf_fits_sshort_p(x) mpfr_fits_sshort_p(x,MPFR_DEFAULT_RND) +#undef mpf_fits_ushort_p +#define mpf_fits_ushort_p(x) mpfr_fits_ushort_p(x,MPFR_DEFAULT_RND) +#undef mpf_get_str +#define mpf_get_str(x,y,z,t,u) mpfr_get_str(x,y,z,t,u,MPFR_DEFAULT_RND) +#undef mpf_get_d +#define mpf_get_d(x) mpfr_get_d(x,MPFR_DEFAULT_RND) +#undef mpf_get_d_2exp +#define mpf_get_d_2exp(e,x) mpfr_get_d_2exp(e,x,MPFR_DEFAULT_RND) +#undef mpf_get_ui +#define mpf_get_ui(x) mpfr_get_ui(x,MPFR_DEFAULT_RND) +#undef mpf_get_si +#define mpf_get_si(x) mpfr_get_si(x,MPFR_DEFAULT_RND) +#undef mpf_inp_str +#define mpf_inp_str(x,y,z) mpfr_inp_str(x,y,z,MPFR_DEFAULT_RND) +#undef mpf_set_str +#define mpf_set_str(x,y,z) mpfr_set_str(x,y,z,MPFR_DEFAULT_RND) +#undef mpf_init_set +#define mpf_init_set(x,y) mpfr_init_set(x,y,MPFR_DEFAULT_RND) +#undef mpf_init_set_d +#define mpf_init_set_d(x,y) mpfr_init_set_d(x,y,MPFR_DEFAULT_RND) +#undef mpf_init_set_si +#define mpf_init_set_si(x,y) mpfr_init_set_si(x,y,MPFR_DEFAULT_RND) +#undef mpf_init_set_str +#define mpf_init_set_str(x,y,z) mpfr_init_set_str(x,y,z,MPFR_DEFAULT_RND) +#undef mpf_init_set_ui +#define mpf_init_set_ui(x,y) mpfr_init_set_ui(x,y,MPFR_DEFAULT_RND) +#undef mpf_mul +#define mpf_mul(x,y,z) mpfr_mul(x,y,z,MPFR_DEFAULT_RND) +#undef mpf_mul_2exp +#define mpf_mul_2exp(x,y,z) mpfr_mul_2exp(x,y,z,MPFR_DEFAULT_RND) +#undef mpf_mul_ui +#define mpf_mul_ui(x,y,z) mpfr_mul_ui(x,y,z,MPFR_DEFAULT_RND) +#undef mpf_neg +#define mpf_neg(x,y) mpfr_neg(x,y,MPFR_DEFAULT_RND) +#undef mpf_out_str +#define mpf_out_str(x,y,z,t) mpfr_out_str(x,y,z,t,MPFR_DEFAULT_RND) +#undef mpf_pow_ui +#define mpf_pow_ui(x,y,z) mpfr_pow_ui(x,y,z,MPFR_DEFAULT_RND) +#undef mpf_reldiff +#define mpf_reldiff(x,y,z) mpfr_reldiff(x,y,z,MPFR_DEFAULT_RND) +#undef mpf_set +#define mpf_set(x,y) mpfr_set(x,y,MPFR_DEFAULT_RND) +#undef mpf_set_d +#define mpf_set_d(x,y) mpfr_set_d(x,y,MPFR_DEFAULT_RND) +#undef mpf_set_q +#define mpf_set_q(x,y) mpfr_set_q(x,y,MPFR_DEFAULT_RND) +#undef mpf_set_si +#define mpf_set_si(x,y) mpfr_set_si(x,y,MPFR_DEFAULT_RND) +#undef mpf_set_ui +#define mpf_set_ui(x,y) mpfr_set_ui(x,y,MPFR_DEFAULT_RND) +#undef mpf_set_z +#define mpf_set_z(x,y) mpfr_set_z(x,y,MPFR_DEFAULT_RND) +#undef mpf_sqrt +#define mpf_sqrt(x,y) mpfr_sqrt(x,y,MPFR_DEFAULT_RND) +#undef mpf_sqrt_ui +#define mpf_sqrt_ui(x,y) mpfr_sqrt_ui(x,y,MPFR_DEFAULT_RND) +#undef mpf_sub +#define mpf_sub(x,y,z) mpfr_sub(x,y,z,MPFR_DEFAULT_RND) +#undef mpf_sub_ui +#define mpf_sub_ui(x,y,z) mpfr_sub_ui(x,y,z,MPFR_DEFAULT_RND) +#undef mpf_ui_div +#define mpf_ui_div(x,y,z) mpfr_ui_div(x,y,z,MPFR_DEFAULT_RND) +#undef mpf_ui_sub +#define mpf_ui_sub(x,y,z) mpfr_ui_sub(x,y,z,MPFR_DEFAULT_RND) +#undef mpf_urandomb +#define mpf_urandomb(x,y,n) mpfr_urandomb(x,y) + +#undef mpz_set_f +#define mpz_set_f(z,f) mpfr_get_z(z,f,MPFR_DEFAULT_RND) + +#endif /* __MPFR_FROM_MPF__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/mpfr.h b/dingux/opt/mipsel-linux-uclibc/include/mpfr.h new file mode 100644 index 0000000..6dba95f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/mpfr.h @@ -0,0 +1,1059 @@ +/* mpfr.h -- Include file for mpfr. + +Copyright 1999-2017 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU MPFR Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +The GNU MPFR Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see +http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef __MPFR_H +#define __MPFR_H + +/* Define MPFR version number */ +#define MPFR_VERSION_MAJOR 3 +#define MPFR_VERSION_MINOR 1 +#define MPFR_VERSION_PATCHLEVEL 6 +#define MPFR_VERSION_STRING "3.1.6" + +/* Macros dealing with MPFR VERSION */ +#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) +#define MPFR_VERSION \ +MPFR_VERSION_NUM(MPFR_VERSION_MAJOR,MPFR_VERSION_MINOR,MPFR_VERSION_PATCHLEVEL) + +/* Check if GMP is included, and try to include it (Works with local GMP) */ +#ifndef __GMP_H__ +# include +#endif + +/* GMP's internal __gmp_const macro has been removed on 2012-03-04: + http://gmplib.org:8000/gmp/rev/d287cfaf6732 + const is standard and now assumed to be available. If the __gmp_const + definition is no longer present in GMP, this probably means that GMP + assumes that const is available; thus let's define it to const. + Note: this is a temporary fix that can be backported to previous MPFR + versions. In the future, __gmp_const should be replaced by const like + in GMP. */ +#ifndef __gmp_const +# define __gmp_const const +#endif + +/* Avoid some problems with macro expansion if the user defines macros + with the same name as keywords. By convention, identifiers and macro + names starting with mpfr_ are reserved by MPFR. */ +typedef void mpfr_void; +typedef int mpfr_int; +typedef unsigned int mpfr_uint; +typedef long mpfr_long; +typedef unsigned long mpfr_ulong; +typedef size_t mpfr_size_t; + +/* Definition of rounding modes (DON'T USE MPFR_RNDNA!). + Warning! Changing the contents of this enum should be seen as an + interface change since the old and the new types are not compatible + (the integer type compatible with the enumerated type can even change, + see ISO C99, 6.7.2.2#4), and in Makefile.am, AGE should be set to 0. + + MPFR_RNDU must appear just before MPFR_RNDD (see + MPFR_IS_RNDUTEST_OR_RNDDNOTTEST in mpfr-impl.h). + + MPFR_RNDF has been added, though not implemented yet, in order to avoid + to break the ABI once faithful rounding gets implemented. + + If you change the order of the rounding modes, please update the routines + in texceptions.c which assume 0=RNDN, 1=RNDZ, 2=RNDU, 3=RNDD, 4=RNDA. +*/ +typedef enum { + MPFR_RNDN=0, /* round to nearest, with ties to even */ + MPFR_RNDZ, /* round toward zero */ + MPFR_RNDU, /* round toward +Inf */ + MPFR_RNDD, /* round toward -Inf */ + MPFR_RNDA, /* round away from zero */ + MPFR_RNDF, /* faithful rounding (not implemented yet) */ + MPFR_RNDNA=-1 /* round to nearest, with ties away from zero (mpfr_round) */ +} mpfr_rnd_t; + +/* kept for compatibility with MPFR 2.4.x and before */ +#define GMP_RNDN MPFR_RNDN +#define GMP_RNDZ MPFR_RNDZ +#define GMP_RNDU MPFR_RNDU +#define GMP_RNDD MPFR_RNDD + +/* Note: With the following default choices for _MPFR_PREC_FORMAT and + _MPFR_EXP_FORMAT, mpfr_exp_t will be the same as [mp_exp_t] (at least + up to GMP 5). */ + +/* Define precision: 1 (short), 2 (int) or 3 (long) (DON'T USE IT!) */ +#ifndef _MPFR_PREC_FORMAT +# if __GMP_MP_SIZE_T_INT == 1 +# define _MPFR_PREC_FORMAT 2 +# else +# define _MPFR_PREC_FORMAT 3 +# endif +#endif + +/* Define exponent: 1 (short), 2 (int), 3 (long) or 4 (intmax_t) + (DON'T USE IT!) */ +#ifndef _MPFR_EXP_FORMAT +# define _MPFR_EXP_FORMAT _MPFR_PREC_FORMAT +#endif + +#if _MPFR_PREC_FORMAT > _MPFR_EXP_FORMAT +# error "mpfr_prec_t must not be larger than mpfr_exp_t" +#endif + +/* Let's make mpfr_prec_t signed in order to avoid problems due to the + usual arithmetic conversions when mixing mpfr_prec_t and mpfr_exp_t + in an expression (for error analysis) if casts are forgotten. */ +#if _MPFR_PREC_FORMAT == 1 +typedef short mpfr_prec_t; +typedef unsigned short mpfr_uprec_t; +#elif _MPFR_PREC_FORMAT == 2 +typedef int mpfr_prec_t; +typedef unsigned int mpfr_uprec_t; +#elif _MPFR_PREC_FORMAT == 3 +typedef long mpfr_prec_t; +typedef unsigned long mpfr_uprec_t; +#else +# error "Invalid MPFR Prec format" +#endif + +/* Definition of precision limits without needing */ +/* Note: the casts allows the expression to yield the wanted behavior + for _MPFR_PREC_FORMAT == 1 (due to integer promotion rules). */ +#define MPFR_PREC_MIN 2 +#define MPFR_PREC_MAX ((mpfr_prec_t)((mpfr_uprec_t)(~(mpfr_uprec_t)0)>>1)) + +/* Definition of sign */ +typedef int mpfr_sign_t; + +/* Definition of the exponent. _MPFR_EXP_FORMAT must be large enough + so that mpfr_exp_t has at least 32 bits. */ +#if _MPFR_EXP_FORMAT == 1 +typedef short mpfr_exp_t; +typedef unsigned short mpfr_uexp_t; +#elif _MPFR_EXP_FORMAT == 2 +typedef int mpfr_exp_t; +typedef unsigned int mpfr_uexp_t; +#elif _MPFR_EXP_FORMAT == 3 +typedef long mpfr_exp_t; +typedef unsigned long mpfr_uexp_t; +#elif _MPFR_EXP_FORMAT == 4 +/* Note: in this case, intmax_t and uintmax_t must be defined before + the inclusion of mpfr.h (we do not include here because + of some non-ISO C99 implementations that support these types). */ +typedef intmax_t mpfr_exp_t; +typedef uintmax_t mpfr_uexp_t; +#else +# error "Invalid MPFR Exp format" +#endif + +/* Definition of the standard exponent limits */ +#define MPFR_EMAX_DEFAULT ((mpfr_exp_t) (((mpfr_ulong) 1 << 30) - 1)) +#define MPFR_EMIN_DEFAULT (-(MPFR_EMAX_DEFAULT)) + +/* DON'T USE THIS! (For MPFR-public macros only, see below.) + The mpfr_sgn macro uses the fact that __MPFR_EXP_NAN and __MPFR_EXP_ZERO + are the smallest values. */ +#define __MPFR_EXP_MAX ((mpfr_exp_t) (((mpfr_uexp_t) -1) >> 1)) +#define __MPFR_EXP_NAN (1 - __MPFR_EXP_MAX) +#define __MPFR_EXP_ZERO (0 - __MPFR_EXP_MAX) +#define __MPFR_EXP_INF (2 - __MPFR_EXP_MAX) + +/* Definition of the main structure */ +typedef struct { + mpfr_prec_t _mpfr_prec; + mpfr_sign_t _mpfr_sign; + mpfr_exp_t _mpfr_exp; + mp_limb_t *_mpfr_d; +} __mpfr_struct; + +/* Compatibility with previous types of MPFR */ +#ifndef mp_rnd_t +# define mp_rnd_t mpfr_rnd_t +#endif +#ifndef mp_prec_t +# define mp_prec_t mpfr_prec_t +#endif + +/* + The represented number is + _sign*(_d[k-1]/B+_d[k-2]/B^2+...+_d[0]/B^k)*2^_exp + where k=ceil(_mp_prec/GMP_NUMB_BITS) and B=2^GMP_NUMB_BITS. + + For the msb (most significant bit) normalized representation, we must have + _d[k-1]>=B/2, unless the number is singular. + + We must also have the last k*GMP_NUMB_BITS-_prec bits set to zero. +*/ + +typedef __mpfr_struct mpfr_t[1]; +typedef __mpfr_struct *mpfr_ptr; +typedef __gmp_const __mpfr_struct *mpfr_srcptr; + +/* For those who need a direct and fast access to the sign field. + However it is not in the API, thus use it at your own risk: it might + not be supported, or change name, in further versions! + Unfortunately, it must be defined here (instead of MPFR's internal + header file mpfr-impl.h) because it is used by some macros below. +*/ +#define MPFR_SIGN(x) ((x)->_mpfr_sign) + +/* Stack interface */ +typedef enum { + MPFR_NAN_KIND = 0, + MPFR_INF_KIND = 1, MPFR_ZERO_KIND = 2, MPFR_REGULAR_KIND = 3 +} mpfr_kind_t; + +/* GMP defines: + + size_t: Standard size_t + + __GMP_ATTRIBUTE_PURE Attribute for math functions. + + __GMP_NOTHROW For C++: can't throw . + + __GMP_EXTERN_INLINE Attribute for inline function. + * __gmp_const const (Supports for K&R compiler only for mpfr.h). + + __GMP_DECLSPEC_EXPORT compiling to go into a DLL + + __GMP_DECLSPEC_IMPORT compiling to go into a application +*/ +/* Extra MPFR defines */ +#define __MPFR_SENTINEL_ATTR +#if defined (__GNUC__) +# if __GNUC__ >= 4 +# undef __MPFR_SENTINEL_ATTR +# define __MPFR_SENTINEL_ATTR __attribute__ ((sentinel)) +# endif +#endif + +/* Prototypes: Support of K&R compiler */ +#if defined (__GMP_PROTO) +# define _MPFR_PROTO __GMP_PROTO +#elif defined (__STDC__) || defined (__cplusplus) +# define _MPFR_PROTO(x) x +#else +# define _MPFR_PROTO(x) () +#endif +/* Support for WINDOWS Dll: + Check if we are inside a MPFR build, and if so export the functions. + Otherwise does the same thing as GMP */ +#if defined(__MPFR_WITHIN_MPFR) && __GMP_LIBGMP_DLL +# define __MPFR_DECLSPEC __GMP_DECLSPEC_EXPORT +#else +# define __MPFR_DECLSPEC __GMP_DECLSPEC +#endif + +/* Use MPFR_DEPRECATED to mark MPFR functions, types or variables as + deprecated. Code inspired by Apache Subversion's svn_types.h file. */ +#if defined(__GNUC__) && \ + (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) +# define MPFR_DEPRECATED __attribute__ ((deprecated)) +#elif defined(_MSC_VER) && _MSC_VER >= 1300 +# define MPFR_DEPRECATED __declspec(deprecated) +#else +# define MPFR_DEPRECATED +#endif + +/* Note: In order to be declared, some functions need a specific + system header to be included *before* "mpfr.h". If the user + forgets to include the header, the MPFR function prototype in + the user object file is not correct. To avoid wrong results, + we raise a linker error in that case by changing their internal + name in the library (prefixed by __gmpfr instead of mpfr). See + the lines of the form "#define mpfr_xxx __gmpfr_xxx" below. */ + +#if defined (__cplusplus) +extern "C" { +#endif + +__MPFR_DECLSPEC __gmp_const char * mpfr_get_version _MPFR_PROTO ((void)); +__MPFR_DECLSPEC __gmp_const char * mpfr_get_patches _MPFR_PROTO ((void)); +__MPFR_DECLSPEC int mpfr_buildopt_tls_p _MPFR_PROTO ((void)); +__MPFR_DECLSPEC int mpfr_buildopt_decimal_p _MPFR_PROTO ((void)); +__MPFR_DECLSPEC int mpfr_buildopt_gmpinternals_p _MPFR_PROTO ((void)); +__MPFR_DECLSPEC __gmp_const char * mpfr_buildopt_tune_case _MPFR_PROTO ((void)); + +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin _MPFR_PROTO ((void)); +__MPFR_DECLSPEC int mpfr_set_emin _MPFR_PROTO ((mpfr_exp_t)); +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin_min _MPFR_PROTO ((void)); +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emin_max _MPFR_PROTO ((void)); +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax _MPFR_PROTO ((void)); +__MPFR_DECLSPEC int mpfr_set_emax _MPFR_PROTO ((mpfr_exp_t)); +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax_min _MPFR_PROTO ((void)); +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_emax_max _MPFR_PROTO ((void)); + +__MPFR_DECLSPEC void mpfr_set_default_rounding_mode _MPFR_PROTO((mpfr_rnd_t)); +__MPFR_DECLSPEC mpfr_rnd_t mpfr_get_default_rounding_mode _MPFR_PROTO((void)); +__MPFR_DECLSPEC __gmp_const char * + mpfr_print_rnd_mode _MPFR_PROTO((mpfr_rnd_t)); + +__MPFR_DECLSPEC void mpfr_clear_flags _MPFR_PROTO ((void)); +__MPFR_DECLSPEC void mpfr_clear_underflow _MPFR_PROTO ((void)); +__MPFR_DECLSPEC void mpfr_clear_overflow _MPFR_PROTO ((void)); +__MPFR_DECLSPEC void mpfr_clear_divby0 _MPFR_PROTO ((void)); +__MPFR_DECLSPEC void mpfr_clear_nanflag _MPFR_PROTO ((void)); +__MPFR_DECLSPEC void mpfr_clear_inexflag _MPFR_PROTO ((void)); +__MPFR_DECLSPEC void mpfr_clear_erangeflag _MPFR_PROTO ((void)); + +__MPFR_DECLSPEC void mpfr_set_underflow _MPFR_PROTO ((void)); +__MPFR_DECLSPEC void mpfr_set_overflow _MPFR_PROTO ((void)); +__MPFR_DECLSPEC void mpfr_set_divby0 _MPFR_PROTO ((void)); +__MPFR_DECLSPEC void mpfr_set_nanflag _MPFR_PROTO ((void)); +__MPFR_DECLSPEC void mpfr_set_inexflag _MPFR_PROTO ((void)); +__MPFR_DECLSPEC void mpfr_set_erangeflag _MPFR_PROTO ((void)); + +__MPFR_DECLSPEC int mpfr_underflow_p _MPFR_PROTO ((void)); +__MPFR_DECLSPEC int mpfr_overflow_p _MPFR_PROTO ((void)); +__MPFR_DECLSPEC int mpfr_divby0_p _MPFR_PROTO ((void)); +__MPFR_DECLSPEC int mpfr_nanflag_p _MPFR_PROTO ((void)); +__MPFR_DECLSPEC int mpfr_inexflag_p _MPFR_PROTO ((void)); +__MPFR_DECLSPEC int mpfr_erangeflag_p _MPFR_PROTO ((void)); + +__MPFR_DECLSPEC int + mpfr_check_range _MPFR_PROTO ((mpfr_ptr, int, mpfr_rnd_t)); + +__MPFR_DECLSPEC void mpfr_init2 _MPFR_PROTO ((mpfr_ptr, mpfr_prec_t)); +__MPFR_DECLSPEC void mpfr_init _MPFR_PROTO ((mpfr_ptr)); +__MPFR_DECLSPEC void mpfr_clear _MPFR_PROTO ((mpfr_ptr)); + +__MPFR_DECLSPEC void + mpfr_inits2 _MPFR_PROTO ((mpfr_prec_t, mpfr_ptr, ...)) __MPFR_SENTINEL_ATTR; +__MPFR_DECLSPEC void + mpfr_inits _MPFR_PROTO ((mpfr_ptr, ...)) __MPFR_SENTINEL_ATTR; +__MPFR_DECLSPEC void + mpfr_clears _MPFR_PROTO ((mpfr_ptr, ...)) __MPFR_SENTINEL_ATTR; + +__MPFR_DECLSPEC int + mpfr_prec_round _MPFR_PROTO ((mpfr_ptr, mpfr_prec_t, mpfr_rnd_t)); +__MPFR_DECLSPEC int + mpfr_can_round _MPFR_PROTO ((mpfr_srcptr, mpfr_exp_t, mpfr_rnd_t, mpfr_rnd_t, + mpfr_prec_t)); +__MPFR_DECLSPEC mpfr_prec_t mpfr_min_prec _MPFR_PROTO ((mpfr_srcptr)); + +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_exp _MPFR_PROTO ((mpfr_srcptr)); +__MPFR_DECLSPEC int mpfr_set_exp _MPFR_PROTO ((mpfr_ptr, mpfr_exp_t)); +__MPFR_DECLSPEC mpfr_prec_t mpfr_get_prec _MPFR_PROTO((mpfr_srcptr)); +__MPFR_DECLSPEC void mpfr_set_prec _MPFR_PROTO((mpfr_ptr, mpfr_prec_t)); +__MPFR_DECLSPEC void mpfr_set_prec_raw _MPFR_PROTO((mpfr_ptr, mpfr_prec_t)); +__MPFR_DECLSPEC void mpfr_set_default_prec _MPFR_PROTO((mpfr_prec_t)); +__MPFR_DECLSPEC mpfr_prec_t mpfr_get_default_prec _MPFR_PROTO((void)); + +__MPFR_DECLSPEC int mpfr_set_d _MPFR_PROTO ((mpfr_ptr, double, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_set_flt _MPFR_PROTO ((mpfr_ptr, float, mpfr_rnd_t)); +#ifdef MPFR_WANT_DECIMAL_FLOATS +__MPFR_DECLSPEC int mpfr_set_decimal64 _MPFR_PROTO ((mpfr_ptr, _Decimal64, + mpfr_rnd_t)); +#endif +__MPFR_DECLSPEC int + mpfr_set_ld _MPFR_PROTO ((mpfr_ptr, long double, mpfr_rnd_t)); +__MPFR_DECLSPEC int + mpfr_set_z _MPFR_PROTO ((mpfr_ptr, mpz_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int + mpfr_set_z_2exp _MPFR_PROTO ((mpfr_ptr, mpz_srcptr, mpfr_exp_t, mpfr_rnd_t)); +__MPFR_DECLSPEC void mpfr_set_nan _MPFR_PROTO ((mpfr_ptr)); +__MPFR_DECLSPEC void mpfr_set_inf _MPFR_PROTO ((mpfr_ptr, int)); +__MPFR_DECLSPEC void mpfr_set_zero _MPFR_PROTO ((mpfr_ptr, int)); +__MPFR_DECLSPEC int + mpfr_set_f _MPFR_PROTO ((mpfr_ptr, mpf_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int + mpfr_get_f _MPFR_PROTO ((mpf_ptr, mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_set_si _MPFR_PROTO ((mpfr_ptr, long, mpfr_rnd_t)); +__MPFR_DECLSPEC int + mpfr_set_ui _MPFR_PROTO ((mpfr_ptr, unsigned long, mpfr_rnd_t)); +__MPFR_DECLSPEC int + mpfr_set_si_2exp _MPFR_PROTO ((mpfr_ptr, long, mpfr_exp_t, mpfr_rnd_t)); +__MPFR_DECLSPEC int + mpfr_set_ui_2exp _MPFR_PROTO ((mpfr_ptr,unsigned long,mpfr_exp_t,mpfr_rnd_t)); +__MPFR_DECLSPEC int + mpfr_set_q _MPFR_PROTO ((mpfr_ptr, mpq_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int + mpfr_set_str _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, int, mpfr_rnd_t)); +__MPFR_DECLSPEC int + mpfr_init_set_str _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, int, + mpfr_rnd_t)); +__MPFR_DECLSPEC int + mpfr_set4 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t, int)); +__MPFR_DECLSPEC int + mpfr_abs _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int + mpfr_set _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_neg _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_signbit _MPFR_PROTO ((mpfr_srcptr)); +__MPFR_DECLSPEC int + mpfr_setsign _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, int, mpfr_rnd_t)); +__MPFR_DECLSPEC int + mpfr_copysign _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, mpfr_rnd_t)); + +__MPFR_DECLSPEC mpfr_exp_t mpfr_get_z_2exp _MPFR_PROTO ((mpz_ptr, mpfr_srcptr)); +__MPFR_DECLSPEC float mpfr_get_flt _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC double mpfr_get_d _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t)); +#ifdef MPFR_WANT_DECIMAL_FLOATS +__MPFR_DECLSPEC _Decimal64 mpfr_get_decimal64 _MPFR_PROTO ((mpfr_srcptr, + mpfr_rnd_t)); +#endif +__MPFR_DECLSPEC long double mpfr_get_ld _MPFR_PROTO ((mpfr_srcptr, + mpfr_rnd_t)); +__MPFR_DECLSPEC double mpfr_get_d1 _MPFR_PROTO ((mpfr_srcptr)); +__MPFR_DECLSPEC double mpfr_get_d_2exp _MPFR_PROTO ((long*, mpfr_srcptr, + mpfr_rnd_t)); +__MPFR_DECLSPEC long double mpfr_get_ld_2exp _MPFR_PROTO ((long*, mpfr_srcptr, + mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_frexp _MPFR_PROTO ((mpfr_exp_t*, mpfr_ptr, + mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC long mpfr_get_si _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC unsigned long mpfr_get_ui _MPFR_PROTO ((mpfr_srcptr, + mpfr_rnd_t)); +__MPFR_DECLSPEC char*mpfr_get_str _MPFR_PROTO ((char*, mpfr_exp_t*, int, size_t, + mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_get_z _MPFR_PROTO ((mpz_ptr z, mpfr_srcptr f, + mpfr_rnd_t)); + +__MPFR_DECLSPEC void mpfr_free_str _MPFR_PROTO ((char *)); + +__MPFR_DECLSPEC int mpfr_urandom _MPFR_PROTO ((mpfr_ptr, gmp_randstate_t, + mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_grandom _MPFR_PROTO ((mpfr_ptr, mpfr_ptr, gmp_randstate_t, + mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_urandomb _MPFR_PROTO ((mpfr_ptr, gmp_randstate_t)); + +__MPFR_DECLSPEC void mpfr_nextabove _MPFR_PROTO ((mpfr_ptr)); +__MPFR_DECLSPEC void mpfr_nextbelow _MPFR_PROTO ((mpfr_ptr)); +__MPFR_DECLSPEC void mpfr_nexttoward _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr)); + +__MPFR_DECLSPEC int mpfr_printf _MPFR_PROTO ((__gmp_const char*, ...)); +__MPFR_DECLSPEC int mpfr_asprintf _MPFR_PROTO ((char**, __gmp_const char*, + ...)); +__MPFR_DECLSPEC int mpfr_sprintf _MPFR_PROTO ((char*, __gmp_const char*, + ...)); +__MPFR_DECLSPEC int mpfr_snprintf _MPFR_PROTO ((char*, size_t, + __gmp_const char*, ...)); + +__MPFR_DECLSPEC int mpfr_pow _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_pow_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + long int, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_pow_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + unsigned long int, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_ui_pow_ui _MPFR_PROTO ((mpfr_ptr, unsigned long int, + unsigned long int, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_ui_pow _MPFR_PROTO ((mpfr_ptr, unsigned long int, + mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_pow_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpz_srcptr, mpfr_rnd_t)); + +__MPFR_DECLSPEC int mpfr_sqrt _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_sqrt_ui _MPFR_PROTO ((mpfr_ptr, unsigned long, + mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_rec_sqrt _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpfr_rnd_t)); + +__MPFR_DECLSPEC int mpfr_add _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_sub _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_mul _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_div _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpfr_srcptr, mpfr_rnd_t)); + +__MPFR_DECLSPEC int mpfr_add_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + unsigned long, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_sub_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + unsigned long, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_ui_sub _MPFR_PROTO ((mpfr_ptr, unsigned long, + mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_mul_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + unsigned long, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_div_ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + unsigned long, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_ui_div _MPFR_PROTO ((mpfr_ptr, unsigned long, + mpfr_srcptr, mpfr_rnd_t)); + +__MPFR_DECLSPEC int mpfr_add_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + long int, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_sub_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + long int, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_si_sub _MPFR_PROTO ((mpfr_ptr, long int, + mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_mul_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + long int, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_div_si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + long int, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_si_div _MPFR_PROTO ((mpfr_ptr, long int, + mpfr_srcptr, mpfr_rnd_t)); + +__MPFR_DECLSPEC int mpfr_add_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + double, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_sub_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + double, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_d_sub _MPFR_PROTO ((mpfr_ptr, double, + mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_mul_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + double, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_div_d _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + double, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_d_div _MPFR_PROTO ((mpfr_ptr, double, + mpfr_srcptr, mpfr_rnd_t)); + +__MPFR_DECLSPEC int mpfr_sqr _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); + +__MPFR_DECLSPEC int mpfr_const_pi _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_const_log2 _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_const_euler _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_const_catalan _MPFR_PROTO ((mpfr_ptr, mpfr_rnd_t)); + +__MPFR_DECLSPEC int mpfr_agm _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, + mpfr_rnd_t)); + +__MPFR_DECLSPEC int mpfr_log _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_log2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_log10 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_log1p _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpfr_rnd_t)); + +__MPFR_DECLSPEC int mpfr_exp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_exp2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_exp10 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_expm1 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_eint _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_li2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); + +__MPFR_DECLSPEC int mpfr_cmp _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr)); +__MPFR_DECLSPEC int mpfr_cmp3 _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr, int)); +__MPFR_DECLSPEC int mpfr_cmp_d _MPFR_PROTO ((mpfr_srcptr, double)); +__MPFR_DECLSPEC int mpfr_cmp_ld _MPFR_PROTO ((mpfr_srcptr, long double)); +__MPFR_DECLSPEC int mpfr_cmpabs _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr)); +__MPFR_DECLSPEC int mpfr_cmp_ui _MPFR_PROTO ((mpfr_srcptr, unsigned long)); +__MPFR_DECLSPEC int mpfr_cmp_si _MPFR_PROTO ((mpfr_srcptr, long)); +__MPFR_DECLSPEC int mpfr_cmp_ui_2exp _MPFR_PROTO ((mpfr_srcptr, unsigned long, + mpfr_exp_t)); +__MPFR_DECLSPEC int mpfr_cmp_si_2exp _MPFR_PROTO ((mpfr_srcptr, long, + mpfr_exp_t)); +__MPFR_DECLSPEC void mpfr_reldiff _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_eq _MPFR_PROTO((mpfr_srcptr, mpfr_srcptr, + unsigned long)); +__MPFR_DECLSPEC int mpfr_sgn _MPFR_PROTO ((mpfr_srcptr)); + +__MPFR_DECLSPEC int mpfr_mul_2exp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + unsigned long, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_div_2exp _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + unsigned long, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_mul_2ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + unsigned long, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_div_2ui _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + unsigned long, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_mul_2si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + long, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_div_2si _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + long, mpfr_rnd_t)); + +__MPFR_DECLSPEC int mpfr_rint _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_round _MPFR_PROTO((mpfr_ptr, mpfr_srcptr)); +__MPFR_DECLSPEC int mpfr_trunc _MPFR_PROTO((mpfr_ptr, mpfr_srcptr)); +__MPFR_DECLSPEC int mpfr_ceil _MPFR_PROTO((mpfr_ptr, mpfr_srcptr)); +__MPFR_DECLSPEC int mpfr_floor _MPFR_PROTO((mpfr_ptr, mpfr_srcptr)); +__MPFR_DECLSPEC int mpfr_rint_round _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_rint_trunc _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_rint_ceil _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_rint_floor _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_frac _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_modf _MPFR_PROTO ((mpfr_ptr, mpfr_ptr, mpfr_srcptr, + mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_remquo _MPFR_PROTO ((mpfr_ptr, long*, mpfr_srcptr, + mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_remainder _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_fmod _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpfr_srcptr, mpfr_rnd_t)); + +__MPFR_DECLSPEC int mpfr_fits_ulong_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_fits_slong_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_fits_uint_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_fits_sint_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_fits_ushort_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_fits_sshort_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_fits_uintmax_p _MPFR_PROTO((mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_fits_intmax_p _MPFR_PROTO((mpfr_srcptr, mpfr_rnd_t)); + +__MPFR_DECLSPEC void mpfr_extract _MPFR_PROTO ((mpz_ptr, mpfr_srcptr, + unsigned int)); +__MPFR_DECLSPEC void mpfr_swap _MPFR_PROTO ((mpfr_ptr, mpfr_ptr)); +__MPFR_DECLSPEC void mpfr_dump _MPFR_PROTO ((mpfr_srcptr)); + +__MPFR_DECLSPEC int mpfr_nan_p _MPFR_PROTO((mpfr_srcptr)); +__MPFR_DECLSPEC int mpfr_inf_p _MPFR_PROTO((mpfr_srcptr)); +__MPFR_DECLSPEC int mpfr_number_p _MPFR_PROTO((mpfr_srcptr)); +__MPFR_DECLSPEC int mpfr_integer_p _MPFR_PROTO ((mpfr_srcptr)); +__MPFR_DECLSPEC int mpfr_zero_p _MPFR_PROTO ((mpfr_srcptr)); +__MPFR_DECLSPEC int mpfr_regular_p _MPFR_PROTO ((mpfr_srcptr)); + +__MPFR_DECLSPEC int mpfr_greater_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr)); +__MPFR_DECLSPEC int mpfr_greaterequal_p _MPFR_PROTO ((mpfr_srcptr, + mpfr_srcptr)); +__MPFR_DECLSPEC int mpfr_less_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr)); +__MPFR_DECLSPEC int mpfr_lessequal_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr)); +__MPFR_DECLSPEC int mpfr_lessgreater_p _MPFR_PROTO((mpfr_srcptr,mpfr_srcptr)); +__MPFR_DECLSPEC int mpfr_equal_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr)); +__MPFR_DECLSPEC int mpfr_unordered_p _MPFR_PROTO ((mpfr_srcptr, mpfr_srcptr)); + +__MPFR_DECLSPEC int mpfr_atanh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_acosh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_asinh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_cosh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_sinh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_tanh _MPFR_PROTO((mpfr_ptr,mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_sinh_cosh _MPFR_PROTO ((mpfr_ptr, mpfr_ptr, + mpfr_srcptr, mpfr_rnd_t)); + +__MPFR_DECLSPEC int mpfr_sech _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_csch _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_coth _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); + +__MPFR_DECLSPEC int mpfr_acos _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_asin _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_atan _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_sin _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_sin_cos _MPFR_PROTO ((mpfr_ptr, mpfr_ptr, + mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_cos _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_tan _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_atan2 _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_srcptr, + mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_sec _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_csc _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_cot _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); + +__MPFR_DECLSPEC int mpfr_hypot _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_erf _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_erfc _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_cbrt _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_root _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,unsigned long,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_gamma _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_lngamma _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_lgamma _MPFR_PROTO((mpfr_ptr,int*,mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_digamma _MPFR_PROTO((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_zeta _MPFR_PROTO ((mpfr_ptr,mpfr_srcptr,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_zeta_ui _MPFR_PROTO ((mpfr_ptr,unsigned long,mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_fac_ui _MPFR_PROTO ((mpfr_ptr, unsigned long int, + mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_j0 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_j1 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_jn _MPFR_PROTO ((mpfr_ptr, long, mpfr_srcptr, + mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_y0 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_y1 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_yn _MPFR_PROTO ((mpfr_ptr, long, mpfr_srcptr, + mpfr_rnd_t)); + +__MPFR_DECLSPEC int mpfr_ai _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_rnd_t)); + +__MPFR_DECLSPEC int mpfr_min _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, + mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_max _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, + mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_dim _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, + mpfr_rnd_t)); + +__MPFR_DECLSPEC int mpfr_mul_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpz_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_div_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpz_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_add_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpz_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_sub_z _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpz_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_z_sub _MPFR_PROTO ((mpfr_ptr, mpz_srcptr, + mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_cmp_z _MPFR_PROTO ((mpfr_srcptr, mpz_srcptr)); + +__MPFR_DECLSPEC int mpfr_mul_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpq_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_div_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpq_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_add_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpq_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_sub_q _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpq_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_cmp_q _MPFR_PROTO ((mpfr_srcptr, mpq_srcptr)); + +__MPFR_DECLSPEC int mpfr_cmp_f _MPFR_PROTO ((mpfr_srcptr, mpf_srcptr)); + +__MPFR_DECLSPEC int mpfr_fma _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, + mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_fms _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, mpfr_srcptr, + mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_sum _MPFR_PROTO ((mpfr_ptr, mpfr_ptr *__gmp_const, + unsigned long, mpfr_rnd_t)); + +__MPFR_DECLSPEC void mpfr_free_cache _MPFR_PROTO ((void)); + +__MPFR_DECLSPEC int mpfr_subnormalize _MPFR_PROTO ((mpfr_ptr, int, + mpfr_rnd_t)); + +__MPFR_DECLSPEC int mpfr_strtofr _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, + char **, int, mpfr_rnd_t)); + +__MPFR_DECLSPEC size_t mpfr_custom_get_size _MPFR_PROTO ((mpfr_prec_t)); +__MPFR_DECLSPEC void mpfr_custom_init _MPFR_PROTO ((void *, mpfr_prec_t)); +__MPFR_DECLSPEC void * mpfr_custom_get_significand _MPFR_PROTO ((mpfr_srcptr)); +__MPFR_DECLSPEC mpfr_exp_t mpfr_custom_get_exp _MPFR_PROTO ((mpfr_srcptr)); +__MPFR_DECLSPEC void mpfr_custom_move _MPFR_PROTO ((mpfr_ptr, void *)); +__MPFR_DECLSPEC void mpfr_custom_init_set _MPFR_PROTO ((mpfr_ptr, int, + mpfr_exp_t, mpfr_prec_t, void *)); +__MPFR_DECLSPEC int mpfr_custom_get_kind _MPFR_PROTO ((mpfr_srcptr)); + +#if defined (__cplusplus) +} +#endif + +/* Define MPFR_USE_EXTENSION to avoid "gcc -pedantic" warnings. */ +#ifndef MPFR_EXTENSION +# if defined(MPFR_USE_EXTENSION) +# define MPFR_EXTENSION __extension__ +# else +# define MPFR_EXTENSION +# endif +#endif + +/* Warning! This macro doesn't work with K&R C (e.g., compare the "gcc -E" + output with and without -traditional) and shouldn't be used internally. + For public use only, but see the MPFR manual. */ +#define MPFR_DECL_INIT(_x, _p) \ + MPFR_EXTENSION mp_limb_t __gmpfr_local_tab_##_x[((_p)-1)/GMP_NUMB_BITS+1]; \ + MPFR_EXTENSION mpfr_t _x = {{(_p),1,__MPFR_EXP_NAN,__gmpfr_local_tab_##_x}} + +/* Fast access macros to replace function interface. + If the USER don't want to use the macro interface, let him make happy + even if it produces faster and smaller code. */ +#ifndef MPFR_USE_NO_MACRO + +/* Inlining theses functions is both faster and smaller */ +#define mpfr_nan_p(_x) ((_x)->_mpfr_exp == __MPFR_EXP_NAN) +#define mpfr_inf_p(_x) ((_x)->_mpfr_exp == __MPFR_EXP_INF) +#define mpfr_zero_p(_x) ((_x)->_mpfr_exp == __MPFR_EXP_ZERO) +#define mpfr_regular_p(_x) ((_x)->_mpfr_exp > __MPFR_EXP_INF) +#define mpfr_sgn(_x) \ + ((_x)->_mpfr_exp < __MPFR_EXP_INF ? \ + (mpfr_nan_p (_x) ? mpfr_set_erangeflag () : (mpfr_void) 0), 0 : \ + MPFR_SIGN (_x)) + +/* Prevent them from using as lvalues */ +#define MPFR_VALUE_OF(x) (0 ? (x) : (x)) +#define mpfr_get_prec(_x) MPFR_VALUE_OF((_x)->_mpfr_prec) +#define mpfr_get_exp(_x) MPFR_VALUE_OF((_x)->_mpfr_exp) +/* Note: if need be, the MPFR_VALUE_OF can be used for other expressions + (of any type). Thanks to Wojtek Lerch and Tim Rentsch for the idea. */ + +#define mpfr_round(a,b) mpfr_rint((a), (b), MPFR_RNDNA) +#define mpfr_trunc(a,b) mpfr_rint((a), (b), MPFR_RNDZ) +#define mpfr_ceil(a,b) mpfr_rint((a), (b), MPFR_RNDU) +#define mpfr_floor(a,b) mpfr_rint((a), (b), MPFR_RNDD) + +#define mpfr_cmp_ui(b,i) mpfr_cmp_ui_2exp((b),(i),0) +#define mpfr_cmp_si(b,i) mpfr_cmp_si_2exp((b),(i),0) +#define mpfr_set(a,b,r) mpfr_set4(a,b,r,MPFR_SIGN(b)) +#define mpfr_abs(a,b,r) mpfr_set4(a,b,r,1) +#define mpfr_copysign(a,b,c,r) mpfr_set4(a,b,r,MPFR_SIGN(c)) +#define mpfr_setsign(a,b,s,r) mpfr_set4(a,b,r,(s) ? -1 : 1) +#define mpfr_signbit(x) (MPFR_SIGN(x) < 0) +#define mpfr_cmp(b, c) mpfr_cmp3(b, c, 1) +#define mpfr_mul_2exp(y,x,n,r) mpfr_mul_2ui((y),(x),(n),(r)) +#define mpfr_div_2exp(y,x,n,r) mpfr_div_2ui((y),(x),(n),(r)) + + +/* When using GCC, optimize certain common comparisons and affectations. + + Remove ICC since it defines __GNUC__ but produces a + huge number of warnings if you use this code. + VL: I couldn't reproduce a single warning when enabling these macros + with icc 10.1 20080212 on Itanium. But with this version, __ICC isn't + defined (__INTEL_COMPILER is, though), so that these macros are enabled + anyway. Checking with other ICC versions is needed. Possibly detect + whether warnings are produced or not with a configure test. + + Remove C++ too, since it complains too much. */ +/* Added casts to improve robustness in case of undefined behavior and + compiler extensions based on UB (in particular -fwrapv). MPFR doesn't + use such extensions, but these macros will be used by 3rd-party code, + where such extensions may be required. + Moreover casts to unsigned long have been added to avoid warnings in + programs that use MPFR and are compiled with -Wconversion; such casts + are OK since if X is a constant expression, then (unsigned long) X is + also a constant expression, so that the optimizations still work. The + warnings are probably related to the following two bugs: + http://gcc.gnu.org/bugzilla/show_bug.cgi?id=4210 + http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38470 (possibly a variant) + and the casts could be removed once these bugs are fixed. + Casts shouldn't be used on the generic calls (to the ..._2exp functions), + where implicit conversions are performed. Indeed, having at least one + implicit conversion in the macro allows the compiler to emit diagnostics + when normally expected, for instance in the following call: + mpfr_set_ui (x, "foo", MPFR_RNDN); + If this is not possible (for future macros), one of the tricks described + on http://groups.google.com/group/comp.std.c/msg/e92abd24bf9eaf7b could + be used. */ +#if defined (__GNUC__) && !defined(__ICC) && !defined(__cplusplus) +#if (__GNUC__ >= 2) +#undef mpfr_cmp_ui +/* We use the fact that mpfr_sgn on NaN sets the erange flag and returns 0. + But warning! mpfr_sgn is specified as a macro in the API, thus the macro + mustn't be used if side effects are possible, like here. */ +#define mpfr_cmp_ui(_f,_u) \ + (__builtin_constant_p (_u) && (mpfr_ulong) (_u) == 0 ? \ + (mpfr_sgn) (_f) : \ + mpfr_cmp_ui_2exp ((_f), (_u), 0)) +#undef mpfr_cmp_si +#define mpfr_cmp_si(_f,_s) \ + (__builtin_constant_p (_s) && (mpfr_long) (_s) >= 0 ? \ + mpfr_cmp_ui ((_f), (mpfr_ulong) (mpfr_long) (_s)) : \ + mpfr_cmp_si_2exp ((_f), (_s), 0)) +#if __GNUC__ > 2 || __GNUC_MINOR__ >= 95 +#undef mpfr_set_ui +#define mpfr_set_ui(_f,_u,_r) \ + (__builtin_constant_p (_u) && (mpfr_ulong) (_u) == 0 ? \ + __extension__ ({ \ + mpfr_ptr _p = (_f); \ + _p->_mpfr_sign = 1; \ + _p->_mpfr_exp = __MPFR_EXP_ZERO; \ + (mpfr_void) (_r); 0; }) : \ + mpfr_set_ui_2exp ((_f), (_u), 0, (_r))) +#endif +#undef mpfr_set_si +#define mpfr_set_si(_f,_s,_r) \ + (__builtin_constant_p (_s) && (mpfr_long) (_s) >= 0 ? \ + mpfr_set_ui ((_f), (mpfr_ulong) (mpfr_long) (_s), (_r)) : \ + mpfr_set_si_2exp ((_f), (_s), 0, (_r))) +#endif +#endif + +/* Macro version of mpfr_stack interface for fast access */ +#define mpfr_custom_get_size(p) ((mpfr_size_t) \ + (((p)+GMP_NUMB_BITS-1)/GMP_NUMB_BITS*sizeof (mp_limb_t))) +#define mpfr_custom_init(m,p) do {} while (0) +#define mpfr_custom_get_significand(x) ((mpfr_void*)((x)->_mpfr_d)) +#define mpfr_custom_get_exp(x) ((x)->_mpfr_exp) +#define mpfr_custom_move(x,m) do { ((x)->_mpfr_d = (mp_limb_t*)(m)); } while (0) +#define mpfr_custom_init_set(x,k,e,p,m) do { \ + mpfr_ptr _x = (x); \ + mpfr_exp_t _e; \ + mpfr_kind_t _t; \ + mpfr_int _s, _k; \ + _k = (k); \ + if (_k >= 0) { \ + _t = (mpfr_kind_t) _k; \ + _s = 1; \ + } else { \ + _t = (mpfr_kind_t) - _k; \ + _s = -1; \ + } \ + _e = _t == MPFR_REGULAR_KIND ? (e) : \ + _t == MPFR_NAN_KIND ? __MPFR_EXP_NAN : \ + _t == MPFR_INF_KIND ? __MPFR_EXP_INF : __MPFR_EXP_ZERO; \ + _x->_mpfr_prec = (p); \ + _x->_mpfr_sign = _s; \ + _x->_mpfr_exp = _e; \ + _x->_mpfr_d = (mp_limb_t*) (m); \ + } while (0) +#define mpfr_custom_get_kind(x) \ + ( (x)->_mpfr_exp > __MPFR_EXP_INF ? \ + (mpfr_int) MPFR_REGULAR_KIND * MPFR_SIGN (x) \ + : (x)->_mpfr_exp == __MPFR_EXP_INF ? \ + (mpfr_int) MPFR_INF_KIND * MPFR_SIGN (x) \ + : (x)->_mpfr_exp == __MPFR_EXP_NAN ? (mpfr_int) MPFR_NAN_KIND \ + : (mpfr_int) MPFR_ZERO_KIND * MPFR_SIGN (x) ) + + +#endif /* MPFR_USE_NO_MACRO */ + +/* Theses are defined to be macros */ +#define mpfr_init_set_si(x, i, rnd) \ + ( mpfr_init(x), mpfr_set_si((x), (i), (rnd)) ) +#define mpfr_init_set_ui(x, i, rnd) \ + ( mpfr_init(x), mpfr_set_ui((x), (i), (rnd)) ) +#define mpfr_init_set_d(x, d, rnd) \ + ( mpfr_init(x), mpfr_set_d((x), (d), (rnd)) ) +#define mpfr_init_set_ld(x, d, rnd) \ + ( mpfr_init(x), mpfr_set_ld((x), (d), (rnd)) ) +#define mpfr_init_set_z(x, i, rnd) \ + ( mpfr_init(x), mpfr_set_z((x), (i), (rnd)) ) +#define mpfr_init_set_q(x, i, rnd) \ + ( mpfr_init(x), mpfr_set_q((x), (i), (rnd)) ) +#define mpfr_init_set(x, y, rnd) \ + ( mpfr_init(x), mpfr_set((x), (y), (rnd)) ) +#define mpfr_init_set_f(x, y, rnd) \ + ( mpfr_init(x), mpfr_set_f((x), (y), (rnd)) ) + +/* Compatibility layer -- obsolete functions and macros */ +/* Note: it is not possible to output warnings, unless one defines + * a deprecated variable and uses it, e.g. + * MPFR_DEPRECATED extern int mpfr_deprecated_feature; + * #define MPFR_EMIN_MIN ((void)mpfr_deprecated_feature,mpfr_get_emin_min()) + * (the cast to void avoids a warning because the left-hand operand + * has no effect). + */ +#define mpfr_cmp_abs mpfr_cmpabs +#define mpfr_round_prec(x,r,p) mpfr_prec_round(x,p,r) +#define __gmp_default_rounding_mode (mpfr_get_default_rounding_mode()) +#define __mpfr_emin (mpfr_get_emin()) +#define __mpfr_emax (mpfr_get_emax()) +#define __mpfr_default_fp_bit_precision (mpfr_get_default_fp_bit_precision()) +#define MPFR_EMIN_MIN mpfr_get_emin_min() +#define MPFR_EMIN_MAX mpfr_get_emin_max() +#define MPFR_EMAX_MIN mpfr_get_emax_min() +#define MPFR_EMAX_MAX mpfr_get_emax_max() +#define mpfr_version (mpfr_get_version()) +#ifndef mpz_set_fr +# define mpz_set_fr mpfr_get_z +#endif +#define mpfr_add_one_ulp(x,r) \ + (mpfr_sgn (x) > 0 ? mpfr_nextabove (x) : mpfr_nextbelow (x)) +#define mpfr_sub_one_ulp(x,r) \ + (mpfr_sgn (x) > 0 ? mpfr_nextbelow (x) : mpfr_nextabove (x)) +#define mpfr_get_z_exp mpfr_get_z_2exp +#define mpfr_custom_get_mantissa mpfr_custom_get_significand + +#endif /* __MPFR_H */ + + +/* Check if / is included or if the user + explicitly wants intmax_t. Automatical detection is done by + checking: + - INTMAX_C and UINTMAX_C, but not if the compiler is a C++ one + (as suggested by Patrick Pelissier) because the test does not + work well in this case. See: + https://sympa.inria.fr/sympa/arc/mpfr/2010-02/msg00025.html + We do not check INTMAX_MAX and UINTMAX_MAX because under Solaris, + these macros are always defined by (i.e. even when + and are not included). + - _STDINT_H (defined by the glibc), _STDINT_H_ (defined under + Mac OS X) and _STDINT (defined under MS Visual Studio), but + this test may not work with all implementations. + Portable software should not rely on these tests. +*/ +#if (defined (INTMAX_C) && defined (UINTMAX_C) && !defined(__cplusplus)) || \ + defined (MPFR_USE_INTMAX_T) || \ + defined (_STDINT_H) || defined (_STDINT_H_) || defined (_STDINT) +# ifndef _MPFR_H_HAVE_INTMAX_T +# define _MPFR_H_HAVE_INTMAX_T 1 + +#if defined (__cplusplus) +extern "C" { +#endif + +#define mpfr_set_sj __gmpfr_set_sj +#define mpfr_set_sj_2exp __gmpfr_set_sj_2exp +#define mpfr_set_uj __gmpfr_set_uj +#define mpfr_set_uj_2exp __gmpfr_set_uj_2exp +#define mpfr_get_sj __gmpfr_mpfr_get_sj +#define mpfr_get_uj __gmpfr_mpfr_get_uj +__MPFR_DECLSPEC int mpfr_set_sj _MPFR_PROTO ((mpfr_t, intmax_t, mpfr_rnd_t)); +__MPFR_DECLSPEC int + mpfr_set_sj_2exp _MPFR_PROTO ((mpfr_t, intmax_t, intmax_t, mpfr_rnd_t)); +__MPFR_DECLSPEC int mpfr_set_uj _MPFR_PROTO ((mpfr_t, uintmax_t, mpfr_rnd_t)); +__MPFR_DECLSPEC int + mpfr_set_uj_2exp _MPFR_PROTO ((mpfr_t, uintmax_t, intmax_t, mpfr_rnd_t)); +__MPFR_DECLSPEC intmax_t mpfr_get_sj _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t)); +__MPFR_DECLSPEC uintmax_t mpfr_get_uj _MPFR_PROTO ((mpfr_srcptr, mpfr_rnd_t)); + +#if defined (__cplusplus) +} +#endif + +# endif /* _MPFR_H_HAVE_INTMAX_T */ +#endif + + +/* Check if has been included or if the user wants FILE */ +#if defined (_GMP_H_HAVE_FILE) || defined (MPFR_USE_FILE) +# ifndef _MPFR_H_HAVE_FILE +# define _MPFR_H_HAVE_FILE 1 + +#if defined (__cplusplus) +extern "C" { +#endif + +#define mpfr_inp_str __gmpfr_inp_str +#define mpfr_out_str __gmpfr_out_str +__MPFR_DECLSPEC size_t mpfr_inp_str _MPFR_PROTO ((mpfr_ptr, FILE*, int, + mpfr_rnd_t)); +__MPFR_DECLSPEC size_t mpfr_out_str _MPFR_PROTO ((FILE*, int, size_t, + mpfr_srcptr, mpfr_rnd_t)); +#define mpfr_fprintf __gmpfr_fprintf +__MPFR_DECLSPEC int mpfr_fprintf _MPFR_PROTO ((FILE*, __gmp_const char*, + ...)); + +#if defined (__cplusplus) +} +#endif + +# endif /* _MPFR_H_HAVE_FILE */ +#endif + + +/* check if has been included or if the user wants va_list */ +#if defined (_GMP_H_HAVE_VA_LIST) || defined (MPFR_USE_VA_LIST) +# ifndef _MPFR_H_HAVE_VA_LIST +# define _MPFR_H_HAVE_VA_LIST 1 + +#if defined (__cplusplus) +extern "C" { +#endif + +#define mpfr_vprintf __gmpfr_vprintf +#define mpfr_vasprintf __gmpfr_vasprintf +#define mpfr_vsprintf __gmpfr_vsprintf +#define mpfr_vsnprintf __gmpfr_vsnprintf +__MPFR_DECLSPEC int mpfr_vprintf _MPFR_PROTO ((__gmp_const char*, va_list)); +__MPFR_DECLSPEC int mpfr_vasprintf _MPFR_PROTO ((char**, __gmp_const char*, + va_list)); +__MPFR_DECLSPEC int mpfr_vsprintf _MPFR_PROTO ((char*, __gmp_const char*, + va_list)); +__MPFR_DECLSPEC int mpfr_vsnprintf _MPFR_PROTO ((char*, size_t, + __gmp_const char*, va_list)); + +#if defined (__cplusplus) +} +#endif + +# endif /* _MPFR_H_HAVE_VA_LIST */ +#endif + + +/* check if has been included and if FILE is available + (see above) */ +#if defined (_MPFR_H_HAVE_VA_LIST) && defined (_MPFR_H_HAVE_FILE) +# ifndef _MPFR_H_HAVE_VA_LIST_FILE +# define _MPFR_H_HAVE_VA_LIST_FILE 1 + +#if defined (__cplusplus) +extern "C" { +#endif + +#define mpfr_vfprintf __gmpfr_vfprintf +__MPFR_DECLSPEC int mpfr_vfprintf _MPFR_PROTO ((FILE*, __gmp_const char*, + va_list)); + +#if defined (__cplusplus) +} +#endif + +# endif /* _MPFR_H_HAVE_VA_LIST_FILE */ +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/ncurses/curses.h b/dingux/opt/mipsel-linux-uclibc/include/ncurses/curses.h new file mode 100644 index 0000000..c37aa1f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ncurses/curses.h @@ -0,0 +1,1712 @@ +/**************************************************************************** + * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * + ****************************************************************************/ + +/* $Id: curses.h.in,v 1.241 2014/08/09 20:39:44 tom Exp $ */ + +#ifndef __NCURSES_H +#define __NCURSES_H + +#define CURSES 1 +#define CURSES_H 1 + +/* These are defined only in curses.h, and are used for conditional compiles */ +#define NCURSES_VERSION_MAJOR 6 +#define NCURSES_VERSION_MINOR 0 +#define NCURSES_VERSION_PATCH 20150808 + +/* This is defined in more than one ncurses header, for identification */ +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.0" + +/* + * Identify the mouse encoding version. + */ +#define NCURSES_MOUSE_VERSION 2 + +/* + * Definitions to facilitate DLL's. + */ +#include + +#if 1 +#include +#endif + +/* + * User-definable tweak to disable the include of . + */ +#ifndef NCURSES_ENABLE_STDBOOL_H +#define NCURSES_ENABLE_STDBOOL_H 1 +#endif + +/* + * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses + * configured using --disable-macros. + */ +#ifndef NCURSES_ATTR_T +#define NCURSES_ATTR_T int +#endif + +/* + * Expands to 'const' if ncurses is configured using --enable-const. Note that + * doing so makes it incompatible with other implementations of X/Open Curses. + */ +#undef NCURSES_CONST +#define NCURSES_CONST const + +#undef NCURSES_INLINE +#define NCURSES_INLINE inline + +/* + * The internal type used for color values, and for color-pairs. The latter + * allows the curses library to enumerate the combinations of foreground and + * background colors used by an application, and is normally the product of the + * total foreground and background colors. + * + * X/Open uses "short" for both of these types, ultimately because they are + * numbers from the terminal database, which uses 16-bit signed values. + */ +#undef NCURSES_COLOR_T +#define NCURSES_COLOR_T short + +#undef NCURSES_PAIRS_T +#define NCURSES_PAIRS_T short + +/* + * Definition used to make WINDOW and similar structs opaque. + */ +#ifndef NCURSES_OPAQUE +#define NCURSES_OPAQUE 0 +#endif + +/* + * The reentrant code relies on the opaque setting, but adds features. + */ +#ifndef NCURSES_REENTRANT +#define NCURSES_REENTRANT 0 +#endif + +/* + * Control whether bindings for interop support are added. + */ +#undef NCURSES_INTEROP_FUNCS +#define NCURSES_INTEROP_FUNCS 1 + +/* + * The internal type used for window dimensions. + */ +#undef NCURSES_SIZE_T +#define NCURSES_SIZE_T short + +/* + * Control whether tparm() supports varargs or fixed-parameter list. + */ +#undef NCURSES_TPARM_VARARGS +#define NCURSES_TPARM_VARARGS 1 + +/* + * Control type used for tparm's arguments. While X/Open equates long and + * char* values, this is not always workable for 64-bit platforms. + */ +#undef NCURSES_TPARM_ARG +#define NCURSES_TPARM_ARG intptr_t + +/* + * NCURSES_CH_T is used in building the library, but not used otherwise in + * this header file, since that would make the normal/wide-character versions + * of the header incompatible. + */ +#undef NCURSES_CH_T +#define NCURSES_CH_T chtype + +#if 1 && defined(_LP64) +typedef unsigned chtype; +typedef unsigned mmask_t; +#else +typedef uint32_t chtype; +typedef uint32_t mmask_t; +#endif + +/* + * We need FILE, etc. Include this before checking any feature symbols. + */ +#include + +/* + * With XPG4, you must define _XOPEN_SOURCE_EXTENDED, it is redundant (or + * conflicting) when _XOPEN_SOURCE is 500 or greater. If NCURSES_WIDECHAR is + * not already defined, e.g., if the platform relies upon nonstandard feature + * test macros, define it at this point if the standard feature test macros + * indicate that it should be defined. + */ +#ifndef NCURSES_WIDECHAR +#if defined(_XOPEN_SOURCE_EXTENDED) || (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 >= 500)) +#define NCURSES_WIDECHAR 1 +#else +#define NCURSES_WIDECHAR 0 +#endif +#endif /* NCURSES_WIDECHAR */ + +#include /* we need va_list */ +#if NCURSES_WIDECHAR +#include /* we want wchar_t */ +#endif + +/* X/Open and SVr4 specify that curses implements 'bool'. However, C++ may also + * implement it. If so, we must use the C++ compiler's type to avoid conflict + * with other interfaces. + * + * A further complication is that may declare 'bool' to be a + * different type, such as an enum which is not necessarily compatible with + * C++. If we have , make 'bool' a macro, so users may #undef it. + * Otherwise, let it remain a typedef to avoid conflicts with other #define's. + * In either case, make a typedef for NCURSES_BOOL which can be used if needed + * from either C or C++. + */ + +#undef TRUE +#define TRUE 1 + +#undef FALSE +#define FALSE 0 + +typedef unsigned char NCURSES_BOOL; + +#if defined(__cplusplus) /* __cplusplus, etc. */ + +/* use the C++ compiler's bool type */ +#define NCURSES_BOOL bool + +#else /* c89, c99, etc. */ + +#if NCURSES_ENABLE_STDBOOL_H +#include +/* use whatever the C compiler decides bool really is */ +#define NCURSES_BOOL bool +#else +/* there is no predefined bool - use our own */ +#undef bool +#define bool NCURSES_BOOL +#endif + +#endif /* !__cplusplus, etc. */ + +#ifdef __cplusplus +extern "C" { +#define NCURSES_CAST(type,value) static_cast(value) +#else +#define NCURSES_CAST(type,value) (type)(value) +#endif + +/* + * X/Open attributes. In the ncurses implementation, they are identical to the + * A_ attributes. + */ +#define WA_ATTRIBUTES A_ATTRIBUTES +#define WA_NORMAL A_NORMAL +#define WA_STANDOUT A_STANDOUT +#define WA_UNDERLINE A_UNDERLINE +#define WA_REVERSE A_REVERSE +#define WA_BLINK A_BLINK +#define WA_DIM A_DIM +#define WA_BOLD A_BOLD +#define WA_ALTCHARSET A_ALTCHARSET +#define WA_INVIS A_INVIS +#define WA_PROTECT A_PROTECT +#define WA_HORIZONTAL A_HORIZONTAL +#define WA_LEFT A_LEFT +#define WA_LOW A_LOW +#define WA_RIGHT A_RIGHT +#define WA_TOP A_TOP +#define WA_VERTICAL A_VERTICAL + +#if 1 +#define WA_ITALIC A_ITALIC /* ncurses extension */ +#endif + +/* colors */ +#define COLOR_BLACK 0 +#define COLOR_RED 1 +#define COLOR_GREEN 2 +#define COLOR_YELLOW 3 +#define COLOR_BLUE 4 +#define COLOR_MAGENTA 5 +#define COLOR_CYAN 6 +#define COLOR_WHITE 7 + +/* line graphics */ + +#if 0 || NCURSES_REENTRANT +NCURSES_WRAPPED_VAR(chtype*, acs_map); +#define acs_map NCURSES_PUBLIC_VAR(acs_map()) +#else +extern NCURSES_EXPORT_VAR(chtype) acs_map[]; +#endif + +#define NCURSES_ACS(c) (acs_map[NCURSES_CAST(unsigned char,(c))]) + +/* VT100 symbols begin here */ +#define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */ +#define ACS_LLCORNER NCURSES_ACS('m') /* lower left corner */ +#define ACS_URCORNER NCURSES_ACS('k') /* upper right corner */ +#define ACS_LRCORNER NCURSES_ACS('j') /* lower right corner */ +#define ACS_LTEE NCURSES_ACS('t') /* tee pointing right */ +#define ACS_RTEE NCURSES_ACS('u') /* tee pointing left */ +#define ACS_BTEE NCURSES_ACS('v') /* tee pointing up */ +#define ACS_TTEE NCURSES_ACS('w') /* tee pointing down */ +#define ACS_HLINE NCURSES_ACS('q') /* horizontal line */ +#define ACS_VLINE NCURSES_ACS('x') /* vertical line */ +#define ACS_PLUS NCURSES_ACS('n') /* large plus or crossover */ +#define ACS_S1 NCURSES_ACS('o') /* scan line 1 */ +#define ACS_S9 NCURSES_ACS('s') /* scan line 9 */ +#define ACS_DIAMOND NCURSES_ACS('`') /* diamond */ +#define ACS_CKBOARD NCURSES_ACS('a') /* checker board (stipple) */ +#define ACS_DEGREE NCURSES_ACS('f') /* degree symbol */ +#define ACS_PLMINUS NCURSES_ACS('g') /* plus/minus */ +#define ACS_BULLET NCURSES_ACS('~') /* bullet */ +/* Teletype 5410v1 symbols begin here */ +#define ACS_LARROW NCURSES_ACS(',') /* arrow pointing left */ +#define ACS_RARROW NCURSES_ACS('+') /* arrow pointing right */ +#define ACS_DARROW NCURSES_ACS('.') /* arrow pointing down */ +#define ACS_UARROW NCURSES_ACS('-') /* arrow pointing up */ +#define ACS_BOARD NCURSES_ACS('h') /* board of squares */ +#define ACS_LANTERN NCURSES_ACS('i') /* lantern symbol */ +#define ACS_BLOCK NCURSES_ACS('0') /* solid square block */ +/* + * These aren't documented, but a lot of System Vs have them anyway + * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings). + * The ACS_names may not match AT&T's, our source didn't know them. + */ +#define ACS_S3 NCURSES_ACS('p') /* scan line 3 */ +#define ACS_S7 NCURSES_ACS('r') /* scan line 7 */ +#define ACS_LEQUAL NCURSES_ACS('y') /* less/equal */ +#define ACS_GEQUAL NCURSES_ACS('z') /* greater/equal */ +#define ACS_PI NCURSES_ACS('{') /* Pi */ +#define ACS_NEQUAL NCURSES_ACS('|') /* not equal */ +#define ACS_STERLING NCURSES_ACS('}') /* UK pound sign */ + +/* + * Line drawing ACS names are of the form ACS_trbl, where t is the top, r + * is the right, b is the bottom, and l is the left. t, r, b, and l might + * be B (blank), S (single), D (double), or T (thick). The subset defined + * here only uses B and S. + */ +#define ACS_BSSB ACS_ULCORNER +#define ACS_SSBB ACS_LLCORNER +#define ACS_BBSS ACS_URCORNER +#define ACS_SBBS ACS_LRCORNER +#define ACS_SBSS ACS_RTEE +#define ACS_SSSB ACS_LTEE +#define ACS_SSBS ACS_BTEE +#define ACS_BSSS ACS_TTEE +#define ACS_BSBS ACS_HLINE +#define ACS_SBSB ACS_VLINE +#define ACS_SSSS ACS_PLUS + +#undef ERR +#define ERR (-1) + +#undef OK +#define OK (0) + +/* values for the _flags member */ +#define _SUBWIN 0x01 /* is this a sub-window? */ +#define _ENDLINE 0x02 /* is the window flush right? */ +#define _FULLWIN 0x04 /* is the window full-screen? */ +#define _SCROLLWIN 0x08 /* bottom edge is at screen bottom? */ +#define _ISPAD 0x10 /* is this window a pad? */ +#define _HASMOVED 0x20 /* has cursor moved since last refresh? */ +#define _WRAPPED 0x40 /* cursor was just wrappped */ + +/* + * this value is used in the firstchar and lastchar fields to mark + * unchanged lines + */ +#define _NOCHANGE -1 + +/* + * this value is used in the oldindex field to mark lines created by insertions + * and scrolls. + */ +#define _NEWINDEX -1 + +typedef struct screen SCREEN; +typedef struct _win_st WINDOW; + +typedef chtype attr_t; /* ...must be at least as wide as chtype */ + +#if NCURSES_WIDECHAR + +#if 0 +#ifdef mblen /* libutf8.h defines it w/o undefining first */ +#undef mblen +#endif +#include +#endif + +#if 0 +#include /* ...to get mbstate_t, etc. */ +#endif + +#if 0 +typedef unsigned short wchar_t; +#endif + +#if 0 +typedef unsigned int wint_t; +#endif + +/* + * cchar_t stores an array of CCHARW_MAX wide characters. The first is + * normally a spacing character. The others are non-spacing. If those + * (spacing and nonspacing) do not fill the array, a null L'\0' follows. + * Otherwise, a null is assumed to follow when extracting via getcchar(). + */ +#define CCHARW_MAX 5 +typedef struct +{ + attr_t attr; + wchar_t chars[CCHARW_MAX]; +#if 0 +#undef NCURSES_EXT_COLORS +#define NCURSES_EXT_COLORS 20150808 + int ext_color; /* color pair, must be more than 16-bits */ +#endif +} +cchar_t; + +#endif /* NCURSES_WIDECHAR */ + +#if !NCURSES_OPAQUE +struct ldat; + +struct _win_st +{ + NCURSES_SIZE_T _cury, _curx; /* current cursor position */ + + /* window location and size */ + NCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */ + NCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */ + + short _flags; /* window state flags */ + + /* attribute tracking */ + attr_t _attrs; /* current attribute for non-space character */ + chtype _bkgd; /* current background char/attribute pair */ + + /* option values set by user */ + bool _notimeout; /* no time out on function-key entry? */ + bool _clear; /* consider all data in the window invalid? */ + bool _leaveok; /* OK to not reset cursor on exit? */ + bool _scroll; /* OK to scroll this window? */ + bool _idlok; /* OK to use insert/delete line? */ + bool _idcok; /* OK to use insert/delete char? */ + bool _immed; /* window in immed mode? (not yet used) */ + bool _sync; /* window in sync mode? */ + bool _use_keypad; /* process function keys into KEY_ symbols? */ + int _delay; /* 0 = nodelay, <0 = blocking, >0 = delay */ + + struct ldat *_line; /* the actual line data */ + + /* global screen state */ + NCURSES_SIZE_T _regtop; /* top line of scrolling region */ + NCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */ + + /* these are used only if this is a sub-window */ + int _parx; /* x coordinate of this window in parent */ + int _pary; /* y coordinate of this window in parent */ + WINDOW *_parent; /* pointer to parent if a sub-window */ + + /* these are used only if this is a pad */ + struct pdat + { + NCURSES_SIZE_T _pad_y, _pad_x; + NCURSES_SIZE_T _pad_top, _pad_left; + NCURSES_SIZE_T _pad_bottom, _pad_right; + } _pad; + + NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */ + +#if NCURSES_WIDECHAR + cchar_t _bkgrnd; /* current background char/attribute pair */ +#if 0 + int _color; /* current color-pair for non-space character */ +#endif +#endif +}; +#endif /* NCURSES_OPAQUE */ + +/* + * This is an extension to support events... + */ +#if 1 +#ifdef NCURSES_WGETCH_EVENTS +#if !defined(__BEOS__) || defined(__HAIKU__) + /* Fix _nc_timed_wait() on BEOS... */ +# define NCURSES_EVENT_VERSION 1 +#endif /* !defined(__BEOS__) */ + +/* + * Bits to set in _nc_event.data.flags + */ +# define _NC_EVENT_TIMEOUT_MSEC 1 +# define _NC_EVENT_FILE 2 +# define _NC_EVENT_FILE_READABLE 2 +# if 0 /* Not supported yet... */ +# define _NC_EVENT_FILE_WRITABLE 4 +# define _NC_EVENT_FILE_EXCEPTION 8 +# endif + +typedef struct +{ + int type; + union + { + long timeout_msec; /* _NC_EVENT_TIMEOUT_MSEC */ + struct + { + unsigned int flags; + int fd; + unsigned int result; + } fev; /* _NC_EVENT_FILE */ + } data; +} _nc_event; + +typedef struct +{ + int count; + int result_flags; /* _NC_EVENT_TIMEOUT_MSEC or _NC_EVENT_FILE_READABLE */ + _nc_event *events[1]; +} _nc_eventlist; + +extern NCURSES_EXPORT(int) wgetch_events (WINDOW *, _nc_eventlist *); /* experimental */ +extern NCURSES_EXPORT(int) wgetnstr_events (WINDOW *,char *,int,_nc_eventlist *);/* experimental */ + +#endif /* NCURSES_WGETCH_EVENTS */ +#endif /* NCURSES_EXT_FUNCS */ + +/* + * GCC (and some other compilers) define '__attribute__'; we're using this + * macro to alert the compiler to flag inconsistencies in printf/scanf-like + * function calls. Just in case '__attribute__' isn't defined, make a dummy. + * Old versions of G++ do not accept it anyway, at least not consistently with + * GCC. + */ +#if !(defined(__GNUC__) || defined(__GNUG__) || defined(__attribute__)) +#define __attribute__(p) /* nothing */ +#endif + +/* + * We cannot define these in ncurses_cfg.h, since they require parameters to be + * passed (that is non-portable). If you happen to be using gcc with warnings + * enabled, define + * GCC_PRINTF + * GCC_SCANF + * to improve checking of calls to printw(), etc. + */ +#ifndef GCC_PRINTFLIKE +#if defined(GCC_PRINTF) && !defined(printf) +#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) +#else +#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ +#endif +#endif + +#ifndef GCC_SCANFLIKE +#if defined(GCC_SCANF) && !defined(scanf) +#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) +#else +#define GCC_SCANFLIKE(fmt,var) /*nothing*/ +#endif +#endif + +#ifndef GCC_NORETURN +#define GCC_NORETURN /* nothing */ +#endif + +#ifndef GCC_UNUSED +#define GCC_UNUSED /* nothing */ +#endif + +/* + * Curses uses a helper function. Define our type for this to simplify + * extending it for the sp-funcs feature. + */ +typedef int (*NCURSES_OUTC)(int); + +/* + * Function prototypes. This is the complete X/Open Curses list of required + * functions. Those marked `generated' will have sources generated from the + * macro definitions later in this file, in order to satisfy XPG4.2 + * requirements. + */ + +extern NCURSES_EXPORT(int) addch (const chtype); /* generated */ +extern NCURSES_EXPORT(int) addchnstr (const chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) addchstr (const chtype *); /* generated */ +extern NCURSES_EXPORT(int) addnstr (const char *, int); /* generated */ +extern NCURSES_EXPORT(int) addstr (const char *); /* generated */ +extern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T); /* generated */ +extern NCURSES_EXPORT(int) attr_get (attr_t *, NCURSES_PAIRS_T *, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_off (attr_t, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_on (attr_t, void *); /* generated */ +extern NCURSES_EXPORT(int) attr_set (attr_t, NCURSES_PAIRS_T, void *); /* generated */ +extern NCURSES_EXPORT(int) baudrate (void); /* implemented */ +extern NCURSES_EXPORT(int) beep (void); /* implemented */ +extern NCURSES_EXPORT(int) bkgd (chtype); /* generated */ +extern NCURSES_EXPORT(void) bkgdset (chtype); /* generated */ +extern NCURSES_EXPORT(int) border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* generated */ +extern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype); /* generated */ +extern NCURSES_EXPORT(bool) can_change_color (void); /* implemented */ +extern NCURSES_EXPORT(int) cbreak (void); /* implemented */ +extern NCURSES_EXPORT(int) chgat (int, attr_t, NCURSES_PAIRS_T, const void *); /* generated */ +extern NCURSES_EXPORT(int) clear (void); /* generated */ +extern NCURSES_EXPORT(int) clearok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) clrtobot (void); /* generated */ +extern NCURSES_EXPORT(int) clrtoeol (void); /* generated */ +extern NCURSES_EXPORT(int) color_content (NCURSES_COLOR_T,NCURSES_COLOR_T*,NCURSES_COLOR_T*,NCURSES_COLOR_T*); /* implemented */ +extern NCURSES_EXPORT(int) color_set (NCURSES_PAIRS_T,void*); /* generated */ +extern NCURSES_EXPORT(int) COLOR_PAIR (int); /* generated */ +extern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) curs_set (int); /* implemented */ +extern NCURSES_EXPORT(int) def_prog_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) def_shell_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) delay_output (int); /* implemented */ +extern NCURSES_EXPORT(int) delch (void); /* generated */ +extern NCURSES_EXPORT(void) delscreen (SCREEN *); /* implemented */ +extern NCURSES_EXPORT(int) delwin (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) deleteln (void); /* generated */ +extern NCURSES_EXPORT(WINDOW *) derwin (WINDOW *,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) doupdate (void); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) dupwin (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) echo (void); /* implemented */ +extern NCURSES_EXPORT(int) echochar (const chtype); /* generated */ +extern NCURSES_EXPORT(int) erase (void); /* generated */ +extern NCURSES_EXPORT(int) endwin (void); /* implemented */ +extern NCURSES_EXPORT(char) erasechar (void); /* implemented */ +extern NCURSES_EXPORT(void) filter (void); /* implemented */ +extern NCURSES_EXPORT(int) flash (void); /* implemented */ +extern NCURSES_EXPORT(int) flushinp (void); /* implemented */ +extern NCURSES_EXPORT(chtype) getbkgd (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getch (void); /* generated */ +extern NCURSES_EXPORT(int) getnstr (char *, int); /* generated */ +extern NCURSES_EXPORT(int) getstr (char *); /* generated */ +extern NCURSES_EXPORT(WINDOW *) getwin (FILE *); /* implemented */ +extern NCURSES_EXPORT(int) halfdelay (int); /* implemented */ +extern NCURSES_EXPORT(bool) has_colors (void); /* implemented */ +extern NCURSES_EXPORT(bool) has_ic (void); /* implemented */ +extern NCURSES_EXPORT(bool) has_il (void); /* implemented */ +extern NCURSES_EXPORT(int) hline (chtype, int); /* generated */ +extern NCURSES_EXPORT(void) idcok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(int) idlok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(void) immedok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) inch (void); /* generated */ +extern NCURSES_EXPORT(int) inchnstr (chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) inchstr (chtype *); /* generated */ +extern NCURSES_EXPORT(WINDOW *) initscr (void); /* implemented */ +extern NCURSES_EXPORT(int) init_color (NCURSES_COLOR_T,NCURSES_COLOR_T,NCURSES_COLOR_T,NCURSES_COLOR_T); /* implemented */ +extern NCURSES_EXPORT(int) init_pair (NCURSES_PAIRS_T,NCURSES_COLOR_T,NCURSES_COLOR_T); /* implemented */ +extern NCURSES_EXPORT(int) innstr (char *, int); /* generated */ +extern NCURSES_EXPORT(int) insch (chtype); /* generated */ +extern NCURSES_EXPORT(int) insdelln (int); /* generated */ +extern NCURSES_EXPORT(int) insertln (void); /* generated */ +extern NCURSES_EXPORT(int) insnstr (const char *, int); /* generated */ +extern NCURSES_EXPORT(int) insstr (const char *); /* generated */ +extern NCURSES_EXPORT(int) instr (char *); /* generated */ +extern NCURSES_EXPORT(int) intrflush (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(bool) isendwin (void); /* implemented */ +extern NCURSES_EXPORT(bool) is_linetouched (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(bool) is_wintouched (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int); /* implemented */ +extern NCURSES_EXPORT(int) keypad (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(char) killchar (void); /* implemented */ +extern NCURSES_EXPORT(int) leaveok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(char *) longname (void); /* implemented */ +extern NCURSES_EXPORT(int) meta (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) move (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddch (int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) mvaddchnstr (int, int, const chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvaddstr (int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, NCURSES_PAIRS_T, const void *); /* generated */ +extern NCURSES_EXPORT(int) mvcur (int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) mvdelch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int); /* implemented */ +extern NCURSES_EXPORT(int) mvgetch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetnstr (int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvgetstr (int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvhline (int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(chtype) mvinch (int, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchnstr (int, int, chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvinchstr (int, int, chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvinnstr (int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsch (int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) mvinsnstr (int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvinsstr (int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvinstr (int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvprintw (int,int, const char *,...) /* implemented */ + GCC_PRINTFLIKE(3,4); +extern NCURSES_EXPORT(int) mvscanw (int,int, NCURSES_CONST char *,...) /* implemented */ + GCC_SCANFLIKE(3,4); +extern NCURSES_EXPORT(int) mvvline (int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvwaddch (WINDOW *, int, int, const chtype); /* generated */ +extern NCURSES_EXPORT(int) mvwaddchnstr (WINDOW *, int, int, const chtype *, int);/* generated */ +extern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, NCURSES_PAIRS_T, const void *);/* generated */ +extern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwgetstr (WINDOW *, int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvwhline (WINDOW *, int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) mvwin (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(chtype) mvwinch (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinchnstr (WINDOW *, int, int, chtype *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinchstr (WINDOW *, int, int, chtype *); /* generated */ +extern NCURSES_EXPORT(int) mvwinnstr (WINDOW *, int, int, char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinsch (WINDOW *, int, int, chtype); /* generated */ +extern NCURSES_EXPORT(int) mvwinsnstr (WINDOW *, int, int, const char *, int); /* generated */ +extern NCURSES_EXPORT(int) mvwinsstr (WINDOW *, int, int, const char *); /* generated */ +extern NCURSES_EXPORT(int) mvwinstr (WINDOW *, int, int, char *); /* generated */ +extern NCURSES_EXPORT(int) mvwprintw (WINDOW*,int,int, const char *,...) /* implemented */ + GCC_PRINTFLIKE(4,5); +extern NCURSES_EXPORT(int) mvwscanw (WINDOW *,int,int, NCURSES_CONST char *,...) /* implemented */ + GCC_SCANFLIKE(4,5); +extern NCURSES_EXPORT(int) mvwvline (WINDOW *,int, int, chtype, int); /* generated */ +extern NCURSES_EXPORT(int) napms (int); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) newpad (int,int); /* implemented */ +extern NCURSES_EXPORT(SCREEN *) newterm (NCURSES_CONST char *,FILE *,FILE *); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) newwin (int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) nl (void); /* implemented */ +extern NCURSES_EXPORT(int) nocbreak (void); /* implemented */ +extern NCURSES_EXPORT(int) nodelay (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) noecho (void); /* implemented */ +extern NCURSES_EXPORT(int) nonl (void); /* implemented */ +extern NCURSES_EXPORT(void) noqiflush (void); /* implemented */ +extern NCURSES_EXPORT(int) noraw (void); /* implemented */ +extern NCURSES_EXPORT(int) notimeout (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) pair_content (NCURSES_PAIRS_T,NCURSES_COLOR_T*,NCURSES_COLOR_T*); /* implemented */ +extern NCURSES_EXPORT(int) PAIR_NUMBER (int); /* generated */ +extern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */ +extern NCURSES_EXPORT(int) prefresh (WINDOW *,int,int,int,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) printw (const char *,...) /* implemented */ + GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT(int) putwin (WINDOW *, FILE *); /* implemented */ +extern NCURSES_EXPORT(void) qiflush (void); /* implemented */ +extern NCURSES_EXPORT(int) raw (void); /* implemented */ +extern NCURSES_EXPORT(int) redrawwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) refresh (void); /* generated */ +extern NCURSES_EXPORT(int) resetty (void); /* implemented */ +extern NCURSES_EXPORT(int) reset_prog_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) reset_shell_mode (void); /* implemented */ +extern NCURSES_EXPORT(int) ripoffline (int, int (*)(WINDOW *, int)); /* implemented */ +extern NCURSES_EXPORT(int) savetty (void); /* implemented */ +extern NCURSES_EXPORT(int) scanw (NCURSES_CONST char *,...) /* implemented */ + GCC_SCANFLIKE(1,2); +extern NCURSES_EXPORT(int) scr_dump (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scr_init (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scrl (int); /* generated */ +extern NCURSES_EXPORT(int) scroll (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) scrollok (WINDOW *,bool); /* implemented */ +extern NCURSES_EXPORT(int) scr_restore (const char *); /* implemented */ +extern NCURSES_EXPORT(int) scr_set (const char *); /* implemented */ +extern NCURSES_EXPORT(int) setscrreg (int,int); /* generated */ +extern NCURSES_EXPORT(SCREEN *) set_term (SCREEN *); /* implemented */ +extern NCURSES_EXPORT(int) slk_attroff (const chtype); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_off (const attr_t, void *); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attron (const chtype); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*); /* generated:WIDEC */ +extern NCURSES_EXPORT(int) slk_attrset (const chtype); /* implemented */ +extern NCURSES_EXPORT(attr_t) slk_attr (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_attr_set (const attr_t,NCURSES_PAIRS_T,void*); /* implemented */ +extern NCURSES_EXPORT(int) slk_clear (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_color (NCURSES_PAIRS_T); /* implemented */ +extern NCURSES_EXPORT(int) slk_init (int); /* implemented */ +extern NCURSES_EXPORT(char *) slk_label (int); /* implemented */ +extern NCURSES_EXPORT(int) slk_noutrefresh (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_refresh (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_restore (void); /* implemented */ +extern NCURSES_EXPORT(int) slk_set (int,const char *,int); /* implemented */ +extern NCURSES_EXPORT(int) slk_touch (void); /* implemented */ +extern NCURSES_EXPORT(int) standout (void); /* generated */ +extern NCURSES_EXPORT(int) standend (void); /* generated */ +extern NCURSES_EXPORT(int) start_color (void); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) subpad (WINDOW *, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(WINDOW *) subwin (WINDOW *, int, int, int, int); /* implemented */ +extern NCURSES_EXPORT(int) syncok (WINDOW *, bool); /* implemented */ +extern NCURSES_EXPORT(chtype) termattrs (void); /* implemented */ +extern NCURSES_EXPORT(char *) termname (void); /* implemented */ +extern NCURSES_EXPORT(void) timeout (int); /* generated */ +extern NCURSES_EXPORT(int) touchline (WINDOW *, int, int); /* generated */ +extern NCURSES_EXPORT(int) touchwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) typeahead (int); /* implemented */ +extern NCURSES_EXPORT(int) ungetch (int); /* implemented */ +extern NCURSES_EXPORT(int) untouchwin (WINDOW *); /* generated */ +extern NCURSES_EXPORT(void) use_env (bool); /* implemented */ +extern NCURSES_EXPORT(void) use_tioctl (bool); /* implemented */ +extern NCURSES_EXPORT(int) vidattr (chtype); /* implemented */ +extern NCURSES_EXPORT(int) vidputs (chtype, NCURSES_OUTC); /* implemented */ +extern NCURSES_EXPORT(int) vline (chtype, int); /* generated */ +extern NCURSES_EXPORT(int) vwprintw (WINDOW *, const char *,va_list); /* implemented */ +extern NCURSES_EXPORT(int) vw_printw (WINDOW *, const char *,va_list); /* generated */ +extern NCURSES_EXPORT(int) vwscanw (WINDOW *, NCURSES_CONST char *,va_list); /* implemented */ +extern NCURSES_EXPORT(int) vw_scanw (WINDOW *, NCURSES_CONST char *,va_list); /* generated */ +extern NCURSES_EXPORT(int) waddch (WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) waddchnstr (WINDOW *,const chtype *,int); /* implemented */ +extern NCURSES_EXPORT(int) waddchstr (WINDOW *,const chtype *); /* generated */ +extern NCURSES_EXPORT(int) waddnstr (WINDOW *,const char *,int); /* implemented */ +extern NCURSES_EXPORT(int) waddstr (WINDOW *,const char *); /* generated */ +extern NCURSES_EXPORT(int) wattron (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattroff (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattrset (WINDOW *, int); /* generated */ +extern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, NCURSES_PAIRS_T *, void *); /* generated */ +extern NCURSES_EXPORT(int) wattr_on (WINDOW *, attr_t, void *); /* implemented */ +extern NCURSES_EXPORT(int) wattr_off (WINDOW *, attr_t, void *); /* implemented */ +extern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, NCURSES_PAIRS_T, void *); /* generated */ +extern NCURSES_EXPORT(int) wbkgd (WINDOW *, chtype); /* implemented */ +extern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype); /* implemented */ +extern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype); /* implemented */ +extern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, NCURSES_PAIRS_T, const void *);/* implemented */ +extern NCURSES_EXPORT(int) wclear (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wclrtobot (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wclrtoeol (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wcolor_set (WINDOW*,NCURSES_PAIRS_T,void*); /* implemented */ +extern NCURSES_EXPORT(void) wcursyncup (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wdelch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wdeleteln (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) wechochar (WINDOW *, const chtype); /* implemented */ +extern NCURSES_EXPORT(int) werase (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wgetch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wgetnstr (WINDOW *,char *,int); /* implemented */ +extern NCURSES_EXPORT(int) wgetstr (WINDOW *, char *); /* generated */ +extern NCURSES_EXPORT(int) whline (WINDOW *, chtype, int); /* implemented */ +extern NCURSES_EXPORT(chtype) winch (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) winchnstr (WINDOW *, chtype *, int); /* implemented */ +extern NCURSES_EXPORT(int) winchstr (WINDOW *, chtype *); /* generated */ +extern NCURSES_EXPORT(int) winnstr (WINDOW *, char *, int); /* implemented */ +extern NCURSES_EXPORT(int) winsch (WINDOW *, chtype); /* implemented */ +extern NCURSES_EXPORT(int) winsdelln (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) winsertln (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) winsnstr (WINDOW *, const char *,int); /* implemented */ +extern NCURSES_EXPORT(int) winsstr (WINDOW *, const char *); /* generated */ +extern NCURSES_EXPORT(int) winstr (WINDOW *, char *); /* generated */ +extern NCURSES_EXPORT(int) wmove (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wnoutrefresh (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wprintw (WINDOW *, const char *,...) /* implemented */ + GCC_PRINTFLIKE(2,3); +extern NCURSES_EXPORT(int) wredrawln (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wrefresh (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(int) wscanw (WINDOW *, NCURSES_CONST char *,...) /* implemented */ + GCC_SCANFLIKE(2,3); +extern NCURSES_EXPORT(int) wscrl (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) wsetscrreg (WINDOW *,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wstandout (WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) wstandend (WINDOW *); /* generated */ +extern NCURSES_EXPORT(void) wsyncdown (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(void) wsyncup (WINDOW *); /* implemented */ +extern NCURSES_EXPORT(void) wtimeout (WINDOW *,int); /* implemented */ +extern NCURSES_EXPORT(int) wtouchln (WINDOW *,int,int,int); /* implemented */ +extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */ + +/* + * These are also declared in : + */ +extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *); /* implemented */ +extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *); /* implemented */ +extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *); /* implemented */ +extern NCURSES_EXPORT(int) putp (const char *); /* implemented */ + +#if NCURSES_TPARM_VARARGS +extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* special */ +#else +extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG,NCURSES_TPARM_ARG); /* special */ +extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...); /* special */ +#endif + +extern NCURSES_EXPORT(char *) tiparm (const char *, ...); /* special */ + +/* + * These functions are not in X/Open, but we use them in macro definitions: + */ +extern NCURSES_EXPORT(int) getattrs (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getcurx (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getcury (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getbegx (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getbegy (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getmaxx (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getmaxy (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getparx (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) getpary (const WINDOW *); /* generated */ + +/* + * vid_attr() was implemented originally based on a draft of X/Open curses. + */ +#if !NCURSES_WIDECHAR +#define vid_attr(a,pair,opts) vidattr(a) +#endif + +/* + * These functions are extensions - not in X/Open Curses. + */ +#if 1 +#undef NCURSES_EXT_FUNCS +#define NCURSES_EXT_FUNCS 20150808 +typedef int (*NCURSES_WINDOW_CB)(WINDOW *, void *); +typedef int (*NCURSES_SCREEN_CB)(SCREEN *, void *); +extern NCURSES_EXPORT(bool) is_term_resized (int, int); +extern NCURSES_EXPORT(char *) keybound (int, int); +extern NCURSES_EXPORT(const char *) curses_version (void); +extern NCURSES_EXPORT(int) assume_default_colors (int, int); +extern NCURSES_EXPORT(int) define_key (const char *, int); +extern NCURSES_EXPORT(int) get_escdelay (void); +extern NCURSES_EXPORT(int) key_defined (const char *); +extern NCURSES_EXPORT(int) keyok (int, bool); +extern NCURSES_EXPORT(int) resize_term (int, int); +extern NCURSES_EXPORT(int) resizeterm (int, int); +extern NCURSES_EXPORT(int) set_escdelay (int); +extern NCURSES_EXPORT(int) set_tabsize (int); +extern NCURSES_EXPORT(int) use_default_colors (void); +extern NCURSES_EXPORT(int) use_extended_names (bool); +extern NCURSES_EXPORT(int) use_legacy_coding (int); +extern NCURSES_EXPORT(int) use_screen (SCREEN *, NCURSES_SCREEN_CB, void *); +extern NCURSES_EXPORT(int) use_window (WINDOW *, NCURSES_WINDOW_CB, void *); +extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int); +extern NCURSES_EXPORT(void) nofilter(void); + +/* + * These extensions provide access to information stored in the WINDOW even + * when NCURSES_OPAQUE is set: + */ +extern NCURSES_EXPORT(WINDOW *) wgetparent (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_cleared (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_idcok (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_idlok (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_immedok (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_keypad (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_leaveok (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_nodelay (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_notimeout (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_pad (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_scrollok (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_subwin (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(bool) is_syncok (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) wgetdelay (const WINDOW *); /* generated */ +extern NCURSES_EXPORT(int) wgetscrreg (const WINDOW *, int *, int *); /* generated */ + +#else +#define curses_version() NCURSES_VERSION +#endif + +/* + * Extra extension-functions, which pass a SCREEN pointer rather than using + * a global variable SP. + */ +#if 1 +#undef NCURSES_SP_FUNCS +#define NCURSES_SP_FUNCS 20150808 +#define NCURSES_SP_NAME(name) name##_sp + +/* Define the sp-funcs helper function */ +#define NCURSES_SP_OUTC NCURSES_SP_NAME(NCURSES_OUTC) +typedef int (*NCURSES_SP_OUTC)(SCREEN*, int); + +extern NCURSES_EXPORT(SCREEN *) new_prescr (void); /* implemented:SP_FUNC */ + +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(baudrate) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(beep) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(can_change_color) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(cbreak) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(curs_set) (SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(color_content) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T*, NCURSES_COLOR_T*, NCURSES_COLOR_T*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(def_prog_mode) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(def_shell_mode) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(delay_output) (SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(doupdate) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(echo) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(endwin) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char) NCURSES_SP_NAME(erasechar) (SCREEN*);/* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(filter) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(flash) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(flushinp) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(getwin) (SCREEN*, FILE *); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(halfdelay) (SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_colors) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_ic) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_il) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_color) (SCREEN*, NCURSES_COLOR_T, NCURSES_COLOR_T, NCURSES_COLOR_T, NCURSES_COLOR_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(init_pair) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T, NCURSES_COLOR_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(intrflush) (SCREEN*, WINDOW*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(isendwin) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(keyname) (SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char) NCURSES_SP_NAME(killchar) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(longname) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mvcur) (SCREEN*, int, int, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(napms) (SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(newpad) (SCREEN*, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(SCREEN *) NCURSES_SP_NAME(newterm) (SCREEN*, NCURSES_CONST char *, FILE *, FILE *); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(WINDOW *) NCURSES_SP_NAME(newwin) (SCREEN*, int, int, int, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nl) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nocbreak) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(noecho) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(nonl) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(noqiflush) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(noraw) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(pair_content) (SCREEN*, NCURSES_PAIRS_T, NCURSES_COLOR_T*, NCURSES_COLOR_T*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(qiflush) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(raw) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(reset_prog_mode) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(reset_shell_mode) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resetty) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ripoffline) (SCREEN*, int, int (*)(WINDOW *, int)); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(savetty) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_init) (SCREEN*, const char *); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_restore) (SCREEN*, const char *); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(scr_set) (SCREEN*, const char *); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attroff) (SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attron) (SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attrset) (SCREEN*, const chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(attr_t) NCURSES_SP_NAME(slk_attr) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_attr_set) (SCREEN*, const attr_t, NCURSES_PAIRS_T, void*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_clear) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_color) (SCREEN*, NCURSES_PAIRS_T); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_init) (SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(slk_label) (SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_noutrefresh) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_refresh) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_restore) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_set) (SCREEN*, int, const char *, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(slk_touch) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(start_color) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(chtype) NCURSES_SP_NAME(termattrs) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(termname) (SCREEN*); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(typeahead) (SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetch) (SCREEN*, int); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_env) (SCREEN*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_tioctl) (SCREEN*, bool); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidattr) (SCREEN*, chtype); /* implemented:SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidputs) (SCREEN*, chtype, NCURSES_SP_OUTC); /* implemented:SP_FUNC */ +#if 1 +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(keybound) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(assume_default_colors) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(define_key) (SCREEN*, const char *, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(get_escdelay) (SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(is_term_resized) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(key_defined) (SCREEN*, const char *); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(keyok) (SCREEN*, int, bool); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(nofilter) (SCREEN*); /* implemented */ /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resize_term) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(resizeterm) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(set_escdelay) (SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(set_tabsize) (SCREEN*, int); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_default_colors) (SCREEN*); /* implemented:EXT_SP_FUNC */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /* implemented:EXT_SP_FUNC */ +#endif +#else +#undef NCURSES_SP_FUNCS +#define NCURSES_SP_FUNCS 0 +#define NCURSES_SP_NAME(name) name +#define NCURSES_SP_OUTC NCURSES_OUTC +#endif + +/* attributes */ + +#define NCURSES_ATTR_SHIFT 8 +#define NCURSES_BITS(mask,shift) (NCURSES_CAST(chtype,(mask)) << ((shift) + NCURSES_ATTR_SHIFT)) + +#define A_NORMAL (1U - 1U) +#define A_ATTRIBUTES NCURSES_BITS(~(1U - 1U),0) +#define A_CHARTEXT (NCURSES_BITS(1U,0) - 1U) +#define A_COLOR NCURSES_BITS(((1U) << 8) - 1U,0) +#define A_STANDOUT NCURSES_BITS(1U,8) +#define A_UNDERLINE NCURSES_BITS(1U,9) +#define A_REVERSE NCURSES_BITS(1U,10) +#define A_BLINK NCURSES_BITS(1U,11) +#define A_DIM NCURSES_BITS(1U,12) +#define A_BOLD NCURSES_BITS(1U,13) +#define A_ALTCHARSET NCURSES_BITS(1U,14) +#define A_INVIS NCURSES_BITS(1U,15) +#define A_PROTECT NCURSES_BITS(1U,16) +#define A_HORIZONTAL NCURSES_BITS(1U,17) +#define A_LEFT NCURSES_BITS(1U,18) +#define A_LOW NCURSES_BITS(1U,19) +#define A_RIGHT NCURSES_BITS(1U,20) +#define A_TOP NCURSES_BITS(1U,21) +#define A_VERTICAL NCURSES_BITS(1U,22) + +#if 1 +#define A_ITALIC NCURSES_BITS(1U,23) /* ncurses extension */ +#endif + +/* + * Most of the pseudo functions are macros that either provide compatibility + * with older versions of curses, or provide inline functionality to improve + * performance. + */ + +/* + * These pseudo functions are always implemented as macros: + */ + +#define getyx(win,y,x) (y = getcury(win), x = getcurx(win)) +#define getbegyx(win,y,x) (y = getbegy(win), x = getbegx(win)) +#define getmaxyx(win,y,x) (y = getmaxy(win), x = getmaxx(win)) +#define getparyx(win,y,x) (y = getpary(win), x = getparx(win)) + +#define getsyx(y,x) do { if (newscr) { \ + if (is_leaveok(newscr)) \ + (y) = (x) = -1; \ + else \ + getyx(newscr,(y), (x)); \ + } \ + } while(0) + +#define setsyx(y,x) do { if (newscr) { \ + if ((y) == -1 && (x) == -1) \ + leaveok(newscr, TRUE); \ + else { \ + leaveok(newscr, FALSE); \ + wmove(newscr, (y), (x)); \ + } \ + } \ + } while(0) + +#ifndef NCURSES_NOMACROS + +/* + * These miscellaneous pseudo functions are provided for compatibility: + */ + +#define wgetstr(w, s) wgetnstr(w, s, -1) +#define getnstr(s, n) wgetnstr(stdscr, s, (n)) + +#define setterm(term) setupterm(term, 1, (int *)0) + +#define fixterm() reset_prog_mode() +#define resetterm() reset_shell_mode() +#define saveterm() def_prog_mode() +#define crmode() cbreak() +#define nocrmode() nocbreak() +#define gettmode() + +/* It seems older SYSV curses versions define these */ +#if !NCURSES_OPAQUE +#define getattrs(win) NCURSES_CAST(int, (win) ? (win)->_attrs : A_NORMAL) +#define getcurx(win) ((win) ? (win)->_curx : ERR) +#define getcury(win) ((win) ? (win)->_cury : ERR) +#define getbegx(win) ((win) ? (win)->_begx : ERR) +#define getbegy(win) ((win) ? (win)->_begy : ERR) +#define getmaxx(win) ((win) ? ((win)->_maxx + 1) : ERR) +#define getmaxy(win) ((win) ? ((win)->_maxy + 1) : ERR) +#define getparx(win) ((win) ? (win)->_parx : ERR) +#define getpary(win) ((win) ? (win)->_pary : ERR) +#endif /* NCURSES_OPAQUE */ + +#define wstandout(win) (wattrset(win,A_STANDOUT)) +#define wstandend(win) (wattrset(win,A_NORMAL)) + +#define wattron(win,at) wattr_on(win, NCURSES_CAST(attr_t, at), NULL) +#define wattroff(win,at) wattr_off(win, NCURSES_CAST(attr_t, at), NULL) + +#if !NCURSES_OPAQUE +#if NCURSES_WIDECHAR && 0 +#define wattrset(win,at) ((win) \ + ? ((win)->_color = NCURSES_CAST(int, PAIR_NUMBER(at)), \ + (win)->_attrs = NCURSES_CAST(attr_t, at), \ + OK) \ + : ERR) +#else +#define wattrset(win,at) ((win) \ + ? ((win)->_attrs = NCURSES_CAST(attr_t, at), \ + OK) \ + : ERR) +#endif +#endif /* NCURSES_OPAQUE */ + +#define scroll(win) wscrl(win,1) + +#define touchwin(win) wtouchln((win), 0, getmaxy(win), 1) +#define touchline(win, s, c) wtouchln((win), s, c, 1) +#define untouchwin(win) wtouchln((win), 0, getmaxy(win), 0) + +#define box(win, v, h) wborder(win, v, v, h, h, 0, 0, 0, 0) +#define border(ls, rs, ts, bs, tl, tr, bl, br) wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br) +#define hline(ch, n) whline(stdscr, ch, (n)) +#define vline(ch, n) wvline(stdscr, ch, (n)) + +#define winstr(w, s) winnstr(w, s, -1) +#define winchstr(w, s) winchnstr(w, s, -1) +#define winsstr(w, s) winsnstr(w, s, -1) + +#if !NCURSES_OPAQUE +#define redrawwin(win) wredrawln(win, 0, ((win) ? (win)->_maxy+1 : -1)) +#endif /* NCURSES_OPAQUE */ + +#define waddstr(win,str) waddnstr(win,str,-1) +#define waddchstr(win,str) waddchnstr(win,str,-1) + +/* + * These apply to the first 256 color pairs. + */ +#define COLOR_PAIR(n) NCURSES_BITS((n), 0) +#define PAIR_NUMBER(a) (NCURSES_CAST(int,((NCURSES_CAST(unsigned long,(a)) & A_COLOR) >> NCURSES_ATTR_SHIFT))) + +/* + * pseudo functions for standard screen + */ + +#define addch(ch) waddch(stdscr,(ch)) +#define addchnstr(str,n) waddchnstr(stdscr,(str),(n)) +#define addchstr(str) waddchstr(stdscr,(str)) +#define addnstr(str,n) waddnstr(stdscr,(str),(n)) +#define addstr(str) waddnstr(stdscr,(str),-1) +#define attroff(at) wattroff(stdscr,(at)) +#define attron(at) wattron(stdscr,(at)) +#define attrset(at) wattrset(stdscr,(at)) +#define attr_get(ap,cp,o) wattr_get(stdscr,(ap),(cp),(o)) +#define attr_off(a,o) wattr_off(stdscr,(a),(o)) +#define attr_on(a,o) wattr_on(stdscr,(a),(o)) +#define attr_set(a,c,o) wattr_set(stdscr,(a),(c),(o)) +#define bkgd(ch) wbkgd(stdscr,(ch)) +#define bkgdset(ch) wbkgdset(stdscr,(ch)) +#define chgat(n,a,c,o) wchgat(stdscr,(n),(a),(c),(o)) +#define clear() wclear(stdscr) +#define clrtobot() wclrtobot(stdscr) +#define clrtoeol() wclrtoeol(stdscr) +#define color_set(c,o) wcolor_set(stdscr,(c),(o)) +#define delch() wdelch(stdscr) +#define deleteln() winsdelln(stdscr,-1) +#define echochar(c) wechochar(stdscr,(c)) +#define erase() werase(stdscr) +#define getch() wgetch(stdscr) +#define getstr(str) wgetstr(stdscr,(str)) +#define inch() winch(stdscr) +#define inchnstr(s,n) winchnstr(stdscr,(s),(n)) +#define inchstr(s) winchstr(stdscr,(s)) +#define innstr(s,n) winnstr(stdscr,(s),(n)) +#define insch(c) winsch(stdscr,(c)) +#define insdelln(n) winsdelln(stdscr,(n)) +#define insertln() winsdelln(stdscr,1) +#define insnstr(s,n) winsnstr(stdscr,(s),(n)) +#define insstr(s) winsstr(stdscr,(s)) +#define instr(s) winstr(stdscr,(s)) +#define move(y,x) wmove(stdscr,(y),(x)) +#define refresh() wrefresh(stdscr) +#define scrl(n) wscrl(stdscr,(n)) +#define setscrreg(t,b) wsetscrreg(stdscr,(t),(b)) +#define standend() wstandend(stdscr) +#define standout() wstandout(stdscr) +#define timeout(delay) wtimeout(stdscr,(delay)) +#define wdeleteln(win) winsdelln(win,-1) +#define winsertln(win) winsdelln(win,1) + +/* + * mv functions + */ + +#define mvwaddch(win,y,x,ch) (wmove((win),(y),(x)) == ERR ? ERR : waddch((win),(ch))) +#define mvwaddchnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : waddchnstr((win),(str),(n))) +#define mvwaddchstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : waddchnstr((win),(str),-1)) +#define mvwaddnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : waddnstr((win),(str),(n))) +#define mvwaddstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : waddnstr((win),(str),-1)) +#define mvwdelch(win,y,x) (wmove((win),(y),(x)) == ERR ? ERR : wdelch(win)) +#define mvwchgat(win,y,x,n,a,c,o) (wmove((win),(y),(x)) == ERR ? ERR : wchgat((win),(n),(a),(c),(o))) +#define mvwgetch(win,y,x) (wmove((win),(y),(x)) == ERR ? ERR : wgetch(win)) +#define mvwgetnstr(win,y,x,str,n) (wmove((win),(y),(x)) == ERR ? ERR : wgetnstr((win),(str),(n))) +#define mvwgetstr(win,y,x,str) (wmove((win),(y),(x)) == ERR ? ERR : wgetstr((win),(str))) +#define mvwhline(win,y,x,c,n) (wmove((win),(y),(x)) == ERR ? ERR : whline((win),(c),(n))) +#define mvwinch(win,y,x) (wmove((win),(y),(x)) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win)) +#define mvwinchnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winchnstr((win),(s),(n))) +#define mvwinchstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winchstr((win),(s))) +#define mvwinnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winnstr((win),(s),(n))) +#define mvwinsch(win,y,x,c) (wmove((win),(y),(x)) == ERR ? ERR : winsch((win),(c))) +#define mvwinsnstr(win,y,x,s,n) (wmove((win),(y),(x)) == ERR ? ERR : winsnstr((win),(s),(n))) +#define mvwinsstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winsstr((win),(s))) +#define mvwinstr(win,y,x,s) (wmove((win),(y),(x)) == ERR ? ERR : winstr((win),(s))) +#define mvwvline(win,y,x,c,n) (wmove((win),(y),(x)) == ERR ? ERR : wvline((win),(c),(n))) + +#define mvaddch(y,x,ch) mvwaddch(stdscr,(y),(x),(ch)) +#define mvaddchnstr(y,x,str,n) mvwaddchnstr(stdscr,(y),(x),(str),(n)) +#define mvaddchstr(y,x,str) mvwaddchstr(stdscr,(y),(x),(str)) +#define mvaddnstr(y,x,str,n) mvwaddnstr(stdscr,(y),(x),(str),(n)) +#define mvaddstr(y,x,str) mvwaddstr(stdscr,(y),(x),(str)) +#define mvchgat(y,x,n,a,c,o) mvwchgat(stdscr,(y),(x),(n),(a),(c),(o)) +#define mvdelch(y,x) mvwdelch(stdscr,(y),(x)) +#define mvgetch(y,x) mvwgetch(stdscr,(y),(x)) +#define mvgetnstr(y,x,str,n) mvwgetnstr(stdscr,(y),(x),(str),(n)) +#define mvgetstr(y,x,str) mvwgetstr(stdscr,(y),(x),(str)) +#define mvhline(y,x,c,n) mvwhline(stdscr,(y),(x),(c),(n)) +#define mvinch(y,x) mvwinch(stdscr,(y),(x)) +#define mvinchnstr(y,x,s,n) mvwinchnstr(stdscr,(y),(x),(s),(n)) +#define mvinchstr(y,x,s) mvwinchstr(stdscr,(y),(x),(s)) +#define mvinnstr(y,x,s,n) mvwinnstr(stdscr,(y),(x),(s),(n)) +#define mvinsch(y,x,c) mvwinsch(stdscr,(y),(x),(c)) +#define mvinsnstr(y,x,s,n) mvwinsnstr(stdscr,(y),(x),(s),(n)) +#define mvinsstr(y,x,s) mvwinsstr(stdscr,(y),(x),(s)) +#define mvinstr(y,x,s) mvwinstr(stdscr,(y),(x),(s)) +#define mvvline(y,x,c,n) mvwvline(stdscr,(y),(x),(c),(n)) + +/* + * Some wide-character functions can be implemented without the extensions. + */ +#if !NCURSES_OPAQUE +#define getbkgd(win) ((win) ? ((win)->_bkgd) : 0) +#endif /* NCURSES_OPAQUE */ + +#define slk_attr_off(a,v) ((v) ? ERR : slk_attroff(a)) +#define slk_attr_on(a,v) ((v) ? ERR : slk_attron(a)) + +#if !NCURSES_OPAQUE +#if NCURSES_WIDECHAR && 0 +#define wattr_set(win,a,p,opts) (((win) \ + ? ((win)->_attrs = ((a) & ~A_COLOR), \ + (win)->_color = (p)) \ + : OK), \ + OK) +#define wattr_get(win,a,p,opts) ((void)(((a) != (void *)0) ? (*(a) = (win) ? (win)->_attrs : 0) : OK), \ + (void)(((p) != (void *)0) ? (*(p) = (NCURSES_PAIRS_T) ((win) ? (win)->_color : 0)) : OK), \ + OK) +#else +#define wattr_set(win,a,p,opts) (((win) \ + ? ((win)->_attrs = (((a) & ~A_COLOR) | (attr_t)COLOR_PAIR(p))) \ + : OK), \ + OK) +#define wattr_get(win,a,p,opts) ((void)(((a) != (void *)0) ? (*(a) = (win) ? (win)->_attrs : 0) : OK), \ + (void)(((p) != (void *)0) ? (*(p) = (NCURSES_PAIRS_T) ((win) ? PAIR_NUMBER((win)->_attrs) : 0)) : OK), \ + OK) +#endif +#endif /* NCURSES_OPAQUE */ + +/* + * X/Open curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use + * varargs.h. It adds new calls vw_printw/vw_scanw, which are supposed to + * use POSIX stdarg.h. The ncurses versions of vwprintw/vwscanw already + * use stdarg.h, so... + */ +#define vw_printw vwprintw +#define vw_scanw vwscanw + +/* + * Export fallback function for use in C++ binding. + */ +#if !1 +#define vsscanf(a,b,c) _nc_vsscanf(a,b,c) +NCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list); +#endif + +/* + * These macros are extensions - not in X/Open Curses. + */ +#if 1 +#if !NCURSES_OPAQUE +#define is_cleared(win) ((win) ? (win)->_clear : FALSE) +#define is_idcok(win) ((win) ? (win)->_idcok : FALSE) +#define is_idlok(win) ((win) ? (win)->_idlok : FALSE) +#define is_immedok(win) ((win) ? (win)->_immed : FALSE) +#define is_keypad(win) ((win) ? (win)->_use_keypad : FALSE) +#define is_leaveok(win) ((win) ? (win)->_leaveok : FALSE) +#define is_nodelay(win) ((win) ? ((win)->_delay == 0) : FALSE) +#define is_notimeout(win) ((win) ? (win)->_notimeout : FALSE) +#define is_pad(win) ((win) ? ((win)->_flags & _ISPAD) != 0 : FALSE) +#define is_scrollok(win) ((win) ? (win)->_scroll : FALSE) +#define is_subwin(win) ((win) ? ((win)->_flags & _SUBWIN) != 0 : FALSE) +#define is_syncok(win) ((win) ? (win)->_sync : FALSE) +#define wgetdelay(win) ((win) ? (win)->_delay : 0) +#define wgetparent(win) ((win) ? (win)->_parent : 0) +#define wgetscrreg(win,t,b) ((win) ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) : ERR) +#endif +#endif + +#endif /* NCURSES_NOMACROS */ + +/* + * Public variables. + * + * Notes: + * a. ESCDELAY was an undocumented feature under AIX curses. + * It gives the ESC expire time in milliseconds. + * b. ttytype is needed for backward compatibility + */ +#if NCURSES_REENTRANT + +NCURSES_WRAPPED_VAR(WINDOW *, curscr); +NCURSES_WRAPPED_VAR(WINDOW *, newscr); +NCURSES_WRAPPED_VAR(WINDOW *, stdscr); +NCURSES_WRAPPED_VAR(char *, ttytype); +NCURSES_WRAPPED_VAR(int, COLORS); +NCURSES_WRAPPED_VAR(int, COLOR_PAIRS); +NCURSES_WRAPPED_VAR(int, COLS); +NCURSES_WRAPPED_VAR(int, ESCDELAY); +NCURSES_WRAPPED_VAR(int, LINES); +NCURSES_WRAPPED_VAR(int, TABSIZE); + +#define curscr NCURSES_PUBLIC_VAR(curscr()) +#define newscr NCURSES_PUBLIC_VAR(newscr()) +#define stdscr NCURSES_PUBLIC_VAR(stdscr()) +#define ttytype NCURSES_PUBLIC_VAR(ttytype()) +#define COLORS NCURSES_PUBLIC_VAR(COLORS()) +#define COLOR_PAIRS NCURSES_PUBLIC_VAR(COLOR_PAIRS()) +#define COLS NCURSES_PUBLIC_VAR(COLS()) +#define ESCDELAY NCURSES_PUBLIC_VAR(ESCDELAY()) +#define LINES NCURSES_PUBLIC_VAR(LINES()) +#define TABSIZE NCURSES_PUBLIC_VAR(TABSIZE()) + +#else + +extern NCURSES_EXPORT_VAR(WINDOW *) curscr; +extern NCURSES_EXPORT_VAR(WINDOW *) newscr; +extern NCURSES_EXPORT_VAR(WINDOW *) stdscr; +extern NCURSES_EXPORT_VAR(char) ttytype[]; +extern NCURSES_EXPORT_VAR(int) COLORS; +extern NCURSES_EXPORT_VAR(int) COLOR_PAIRS; +extern NCURSES_EXPORT_VAR(int) COLS; +extern NCURSES_EXPORT_VAR(int) ESCDELAY; +extern NCURSES_EXPORT_VAR(int) LINES; +extern NCURSES_EXPORT_VAR(int) TABSIZE; + +#endif + +/* + * Pseudo-character tokens outside ASCII range. The curses wgetch() function + * will return any given one of these only if the corresponding k- capability + * is defined in your terminal's terminfo entry. + * + * Some keys (KEY_A1, etc) are arranged like this: + * a1 up a3 + * left b2 right + * c1 down c3 + * + * A few key codes do not depend upon the terminfo entry. + */ +#define KEY_CODE_YES 0400 /* A wchar_t contains a key code */ +#define KEY_MIN 0401 /* Minimum curses key */ +#define KEY_BREAK 0401 /* Break key (unreliable) */ +#define KEY_SRESET 0530 /* Soft (partial) reset (unreliable) */ +#define KEY_RESET 0531 /* Reset or hard reset (unreliable) */ +/* + * These definitions were generated by ./MKkey_defs.sh ./Caps + */ +#define KEY_DOWN 0402 /* down-arrow key */ +#define KEY_UP 0403 /* up-arrow key */ +#define KEY_LEFT 0404 /* left-arrow key */ +#define KEY_RIGHT 0405 /* right-arrow key */ +#define KEY_HOME 0406 /* home key */ +#define KEY_BACKSPACE 0407 /* backspace key */ +#define KEY_F0 0410 /* Function keys. Space for 64 */ +#define KEY_F(n) (KEY_F0+(n)) /* Value of function key n */ +#define KEY_DL 0510 /* delete-line key */ +#define KEY_IL 0511 /* insert-line key */ +#define KEY_DC 0512 /* delete-character key */ +#define KEY_IC 0513 /* insert-character key */ +#define KEY_EIC 0514 /* sent by rmir or smir in insert mode */ +#define KEY_CLEAR 0515 /* clear-screen or erase key */ +#define KEY_EOS 0516 /* clear-to-end-of-screen key */ +#define KEY_EOL 0517 /* clear-to-end-of-line key */ +#define KEY_SF 0520 /* scroll-forward key */ +#define KEY_SR 0521 /* scroll-backward key */ +#define KEY_NPAGE 0522 /* next-page key */ +#define KEY_PPAGE 0523 /* previous-page key */ +#define KEY_STAB 0524 /* set-tab key */ +#define KEY_CTAB 0525 /* clear-tab key */ +#define KEY_CATAB 0526 /* clear-all-tabs key */ +#define KEY_ENTER 0527 /* enter/send key */ +#define KEY_PRINT 0532 /* print key */ +#define KEY_LL 0533 /* lower-left key (home down) */ +#define KEY_A1 0534 /* upper left of keypad */ +#define KEY_A3 0535 /* upper right of keypad */ +#define KEY_B2 0536 /* center of keypad */ +#define KEY_C1 0537 /* lower left of keypad */ +#define KEY_C3 0540 /* lower right of keypad */ +#define KEY_BTAB 0541 /* back-tab key */ +#define KEY_BEG 0542 /* begin key */ +#define KEY_CANCEL 0543 /* cancel key */ +#define KEY_CLOSE 0544 /* close key */ +#define KEY_COMMAND 0545 /* command key */ +#define KEY_COPY 0546 /* copy key */ +#define KEY_CREATE 0547 /* create key */ +#define KEY_END 0550 /* end key */ +#define KEY_EXIT 0551 /* exit key */ +#define KEY_FIND 0552 /* find key */ +#define KEY_HELP 0553 /* help key */ +#define KEY_MARK 0554 /* mark key */ +#define KEY_MESSAGE 0555 /* message key */ +#define KEY_MOVE 0556 /* move key */ +#define KEY_NEXT 0557 /* next key */ +#define KEY_OPEN 0560 /* open key */ +#define KEY_OPTIONS 0561 /* options key */ +#define KEY_PREVIOUS 0562 /* previous key */ +#define KEY_REDO 0563 /* redo key */ +#define KEY_REFERENCE 0564 /* reference key */ +#define KEY_REFRESH 0565 /* refresh key */ +#define KEY_REPLACE 0566 /* replace key */ +#define KEY_RESTART 0567 /* restart key */ +#define KEY_RESUME 0570 /* resume key */ +#define KEY_SAVE 0571 /* save key */ +#define KEY_SBEG 0572 /* shifted begin key */ +#define KEY_SCANCEL 0573 /* shifted cancel key */ +#define KEY_SCOMMAND 0574 /* shifted command key */ +#define KEY_SCOPY 0575 /* shifted copy key */ +#define KEY_SCREATE 0576 /* shifted create key */ +#define KEY_SDC 0577 /* shifted delete-character key */ +#define KEY_SDL 0600 /* shifted delete-line key */ +#define KEY_SELECT 0601 /* select key */ +#define KEY_SEND 0602 /* shifted end key */ +#define KEY_SEOL 0603 /* shifted clear-to-end-of-line key */ +#define KEY_SEXIT 0604 /* shifted exit key */ +#define KEY_SFIND 0605 /* shifted find key */ +#define KEY_SHELP 0606 /* shifted help key */ +#define KEY_SHOME 0607 /* shifted home key */ +#define KEY_SIC 0610 /* shifted insert-character key */ +#define KEY_SLEFT 0611 /* shifted left-arrow key */ +#define KEY_SMESSAGE 0612 /* shifted message key */ +#define KEY_SMOVE 0613 /* shifted move key */ +#define KEY_SNEXT 0614 /* shifted next key */ +#define KEY_SOPTIONS 0615 /* shifted options key */ +#define KEY_SPREVIOUS 0616 /* shifted previous key */ +#define KEY_SPRINT 0617 /* shifted print key */ +#define KEY_SREDO 0620 /* shifted redo key */ +#define KEY_SREPLACE 0621 /* shifted replace key */ +#define KEY_SRIGHT 0622 /* shifted right-arrow key */ +#define KEY_SRSUME 0623 /* shifted resume key */ +#define KEY_SSAVE 0624 /* shifted save key */ +#define KEY_SSUSPEND 0625 /* shifted suspend key */ +#define KEY_SUNDO 0626 /* shifted undo key */ +#define KEY_SUSPEND 0627 /* suspend key */ +#define KEY_UNDO 0630 /* undo key */ +#define KEY_MOUSE 0631 /* Mouse event has occurred */ +#define KEY_RESIZE 0632 /* Terminal resize event */ +#define KEY_EVENT 0633 /* We were interrupted by an event */ + +#define KEY_MAX 0777 /* Maximum key value is 0633 */ +/* $Id: curses.tail,v 1.21 2011/10/29 20:03:22 tom Exp $ */ +/* + * vile:cmode: + * This file is part of ncurses, designed to be appended after curses.h.in + * (see that file for the relevant copyright). + */ + +/* mouse interface */ + +#if NCURSES_MOUSE_VERSION > 1 +#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 5)) +#else +#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 6)) +#endif + +#define NCURSES_BUTTON_RELEASED 001L +#define NCURSES_BUTTON_PRESSED 002L +#define NCURSES_BUTTON_CLICKED 004L +#define NCURSES_DOUBLE_CLICKED 010L +#define NCURSES_TRIPLE_CLICKED 020L +#define NCURSES_RESERVED_EVENT 040L + +/* event masks */ +#define BUTTON1_RELEASED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED) +#define BUTTON1_PRESSED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED) +#define BUTTON1_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED) +#define BUTTON1_DOUBLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED) +#define BUTTON1_TRIPLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED) + +#define BUTTON2_RELEASED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED) +#define BUTTON2_PRESSED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED) +#define BUTTON2_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED) +#define BUTTON2_DOUBLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED) +#define BUTTON2_TRIPLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED) + +#define BUTTON3_RELEASED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED) +#define BUTTON3_PRESSED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED) +#define BUTTON3_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED) +#define BUTTON3_DOUBLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED) +#define BUTTON3_TRIPLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED) + +#define BUTTON4_RELEASED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED) +#define BUTTON4_PRESSED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED) +#define BUTTON4_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED) +#define BUTTON4_DOUBLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED) +#define BUTTON4_TRIPLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED) + +/* + * In 32 bits the version-1 scheme does not provide enough space for a 5th + * button, unless we choose to change the ABI by omitting the reserved-events. + */ +#if NCURSES_MOUSE_VERSION > 1 + +#define BUTTON5_RELEASED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED) +#define BUTTON5_PRESSED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED) +#define BUTTON5_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED) +#define BUTTON5_DOUBLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED) +#define BUTTON5_TRIPLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED) + +#define BUTTON_CTRL NCURSES_MOUSE_MASK(6, 0001L) +#define BUTTON_SHIFT NCURSES_MOUSE_MASK(6, 0002L) +#define BUTTON_ALT NCURSES_MOUSE_MASK(6, 0004L) +#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(6, 0010L) + +#else + +#define BUTTON1_RESERVED_EVENT NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT) +#define BUTTON2_RESERVED_EVENT NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT) +#define BUTTON3_RESERVED_EVENT NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT) +#define BUTTON4_RESERVED_EVENT NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT) + +#define BUTTON_CTRL NCURSES_MOUSE_MASK(5, 0001L) +#define BUTTON_SHIFT NCURSES_MOUSE_MASK(5, 0002L) +#define BUTTON_ALT NCURSES_MOUSE_MASK(5, 0004L) +#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(5, 0010L) + +#endif + +#define ALL_MOUSE_EVENTS (REPORT_MOUSE_POSITION - 1) + +/* macros to extract single event-bits from masks */ +#define BUTTON_RELEASE(e, x) ((e) & NCURSES_MOUSE_MASK(x, 001)) +#define BUTTON_PRESS(e, x) ((e) & NCURSES_MOUSE_MASK(x, 002)) +#define BUTTON_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 004)) +#define BUTTON_DOUBLE_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 010)) +#define BUTTON_TRIPLE_CLICK(e, x) ((e) & NCURSES_MOUSE_MASK(x, 020)) +#define BUTTON_RESERVED_EVENT(e, x) ((e) & NCURSES_MOUSE_MASK(x, 040)) + +typedef struct +{ + short id; /* ID to distinguish multiple devices */ + int x, y, z; /* event coordinates (character-cell) */ + mmask_t bstate; /* button state bits */ +} +MEVENT; + +extern NCURSES_EXPORT(bool) has_mouse(void); +extern NCURSES_EXPORT(int) getmouse (MEVENT *); +extern NCURSES_EXPORT(int) ungetmouse (MEVENT *); +extern NCURSES_EXPORT(mmask_t) mousemask (mmask_t, mmask_t *); +extern NCURSES_EXPORT(bool) wenclose (const WINDOW *, int, int); +extern NCURSES_EXPORT(int) mouseinterval (int); +extern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW*, int*, int*, bool); +extern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool); /* generated */ + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_mouse) (SCREEN*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(getmouse) (SCREEN*, MEVENT *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetmouse) (SCREEN*,MEVENT *); +extern NCURSES_EXPORT(mmask_t) NCURSES_SP_NAME(mousemask) (SCREEN*, mmask_t, mmask_t *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mouseinterval) (SCREEN*, int); +#endif + +#define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen) + +/* other non-XSI functions */ + +extern NCURSES_EXPORT(int) mcprint (char *, int); /* direct data to printer */ +extern NCURSES_EXPORT(int) has_key (int); /* do we have given key? */ + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(has_key) (SCREEN*, int); /* do we have given key? */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mcprint) (SCREEN*, char *, int); /* direct data to printer */ +#endif + +/* Debugging : use with libncurses_g.a */ + +extern NCURSES_EXPORT(void) _tracef (const char *, ...) GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT(void) _tracedump (const char *, WINDOW *); +extern NCURSES_EXPORT(char *) _traceattr (attr_t); +extern NCURSES_EXPORT(char *) _traceattr2 (int, chtype); +extern NCURSES_EXPORT(char *) _nc_tracebits (void); +extern NCURSES_EXPORT(char *) _tracechar (int); +extern NCURSES_EXPORT(char *) _tracechtype (chtype); +extern NCURSES_EXPORT(char *) _tracechtype2 (int, chtype); +#if NCURSES_WIDECHAR +#define _tracech_t _tracecchar_t +extern NCURSES_EXPORT(char *) _tracecchar_t (const cchar_t *); +#define _tracech_t2 _tracecchar_t2 +extern NCURSES_EXPORT(char *) _tracecchar_t2 (int, const cchar_t *); +#else +#define _tracech_t _tracechtype +#define _tracech_t2 _tracechtype2 +#endif +extern NCURSES_EXPORT(char *) _tracemouse (const MEVENT *); +extern NCURSES_EXPORT(void) trace (const unsigned int); + +/* trace masks */ +#define TRACE_DISABLE 0x0000 /* turn off tracing */ +#define TRACE_TIMES 0x0001 /* trace user and system times of updates */ +#define TRACE_TPUTS 0x0002 /* trace tputs calls */ +#define TRACE_UPDATE 0x0004 /* trace update actions, old & new screens */ +#define TRACE_MOVE 0x0008 /* trace cursor moves and scrolls */ +#define TRACE_CHARPUT 0x0010 /* trace all character outputs */ +#define TRACE_ORDINARY 0x001F /* trace all update actions */ +#define TRACE_CALLS 0x0020 /* trace all curses calls */ +#define TRACE_VIRTPUT 0x0040 /* trace virtual character puts */ +#define TRACE_IEVENT 0x0080 /* trace low-level input processing */ +#define TRACE_BITS 0x0100 /* trace state of TTY control bits */ +#define TRACE_ICALLS 0x0200 /* trace internal/nested calls */ +#define TRACE_CCALLS 0x0400 /* trace per-character calls */ +#define TRACE_DATABASE 0x0800 /* trace read/write of terminfo/termcap data */ +#define TRACE_ATTRS 0x1000 /* trace attribute updates */ + +#define TRACE_SHIFT 13 /* number of bits in the trace masks */ +#define TRACE_MAXIMUM ((1 << TRACE_SHIFT) - 1) /* maximum trace level */ + +#if defined(TRACE) || defined(NCURSES_TEST) +extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable; /* enable optimizations */ +extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *); +#define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */ +#define OPTIMIZE_HASHMAP 0x02 /* diff hashing to detect scrolls */ +#define OPTIMIZE_SCROLL 0x04 /* scroll optimization */ +#define OPTIMIZE_ALL 0xff /* enable all optimizations (dflt) */ +#endif + +#include + +#ifdef __cplusplus + +#ifndef NCURSES_NOMACROS + +/* these names conflict with STL */ +#undef box +#undef clear +#undef erase +#undef move +#undef refresh + +#endif /* NCURSES_NOMACROS */ + +} +#endif + +#endif /* __NCURSES_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/ncurses/eti.h b/dingux/opt/mipsel-linux-uclibc/include/ncurses/eti.h new file mode 100644 index 0000000..baa6190 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ncurses/eti.h @@ -0,0 +1,54 @@ +/**************************************************************************** + * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1995,1997 * + ****************************************************************************/ + +/* $Id: eti.h,v 1.8 2003/10/25 15:24:29 tom Exp $ */ + +#ifndef NCURSES_ETI_H_incl +#define NCURSES_ETI_H_incl 1 + +#define E_OK (0) +#define E_SYSTEM_ERROR (-1) +#define E_BAD_ARGUMENT (-2) +#define E_POSTED (-3) +#define E_CONNECTED (-4) +#define E_BAD_STATE (-5) +#define E_NO_ROOM (-6) +#define E_NOT_POSTED (-7) +#define E_UNKNOWN_COMMAND (-8) +#define E_NO_MATCH (-9) +#define E_NOT_SELECTABLE (-10) +#define E_NOT_CONNECTED (-11) +#define E_REQUEST_DENIED (-12) +#define E_INVALID_FIELD (-13) +#define E_CURRENT (-14) + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/ncurses/form.h b/dingux/opt/mipsel-linux-uclibc/include/ncurses/form.h new file mode 100644 index 0000000..fa8a602 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ncurses/form.h @@ -0,0 +1,428 @@ +/**************************************************************************** + * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1995,1997 * + ****************************************************************************/ + +/* $Id: form.h,v 0.24 2014/07/26 20:52:28 tom Exp $ */ + +#ifndef FORM_H +#define FORM_H +/* *INDENT-OFF*/ + +#include +#include + +#ifdef __cplusplus + extern "C" { +#endif + +#ifndef FORM_PRIV_H +typedef void *FIELD_CELL; +#endif + +#ifndef NCURSES_FIELD_INTERNALS +#define NCURSES_FIELD_INTERNALS /* nothing */ +#endif + +typedef int Form_Options; +typedef int Field_Options; + + /********** + * _PAGE * + **********/ + +typedef struct { + short pmin; /* index of first field on page */ + short pmax; /* index of last field on page */ + short smin; /* index of top leftmost field on page */ + short smax; /* index of bottom rightmost field on page */ +} _PAGE; + + /********** + * FIELD * + **********/ + +typedef struct fieldnode { + unsigned short status; /* flags */ + short rows; /* size in rows */ + short cols; /* size in cols */ + short frow; /* first row */ + short fcol; /* first col */ + int drows; /* dynamic rows */ + int dcols; /* dynamic cols */ + int maxgrow; /* maximum field growth */ + int nrow; /* off-screen rows */ + short nbuf; /* additional buffers */ + short just; /* justification */ + short page; /* page on form */ + short index; /* into form -> field */ + int pad; /* pad character */ + chtype fore; /* foreground attribute */ + chtype back; /* background attribute */ + Field_Options opts; /* options */ + struct fieldnode * snext; /* sorted order pointer */ + struct fieldnode * sprev; /* sorted order pointer */ + struct fieldnode * link; /* linked field chain */ + struct formnode * form; /* containing form */ + struct typenode * type; /* field type */ + void * arg; /* argument for type */ + FIELD_CELL * buf; /* field buffers */ + void * usrptr; /* user pointer */ + /* + * The wide-character configuration requires extra information. Because + * there are existing applications that manipulate the members of FIELD + * directly, we cannot make the struct opaque. Offsets of members up to + * this point are the same in the narrow- and wide-character configuration. + * But note that the type of buf depends on the configuration, and is made + * opaque for that reason. + */ + NCURSES_FIELD_INTERNALS +} FIELD; + + + /********* + * FORM * + *********/ + +typedef struct formnode { + unsigned short status; /* flags */ + short rows; /* size in rows */ + short cols; /* size in cols */ + int currow; /* current row in field window */ + int curcol; /* current col in field window */ + int toprow; /* in scrollable field window */ + int begincol; /* in horiz. scrollable field */ + short maxfield; /* number of fields */ + short maxpage; /* number of pages */ + short curpage; /* index into page */ + Form_Options opts; /* options */ + WINDOW * win; /* window */ + WINDOW * sub; /* subwindow */ + WINDOW * w; /* window for current field */ + FIELD ** field; /* field [maxfield] */ + FIELD * current; /* current field */ + _PAGE * page; /* page [maxpage] */ + void * usrptr; /* user pointer */ + + void (*forminit)(struct formnode *); + void (*formterm)(struct formnode *); + void (*fieldinit)(struct formnode *); + void (*fieldterm)(struct formnode *); + +} FORM; + + + /************** + * FIELDTYPE * + **************/ + +typedef struct typenode { + unsigned short status; /* flags */ + long ref; /* reference count */ + struct typenode * left; /* ptr to operand for | */ + struct typenode * right; /* ptr to operand for | */ + + void* (*makearg)(va_list *); /* make fieldtype arg */ + void* (*copyarg)(const void *); /* copy fieldtype arg */ + void (*freearg)(void *); /* free fieldtype arg */ + +#if NCURSES_INTEROP_FUNCS + union { + bool (*ofcheck)(FIELD *,const void *); /* field validation */ + bool (*gfcheck)(FORM*,FIELD *,const void*); /* generic field validation */ + } fieldcheck; + union { + bool (*occheck)(int,const void *); /* character validation */ + bool (*gccheck)(int,FORM*, + FIELD*,const void*); /* generic char validation */ + } charcheck; + union { + bool (*onext)(FIELD *,const void *); /* enumerate next value */ + bool (*gnext)(FORM*,FIELD*,const void*); /* generic enumerate next */ + } enum_next; + union { + bool (*oprev)(FIELD *,const void *); /* enumerate prev value */ + bool (*gprev)(FORM*,FIELD*,const void*); /* generic enumerate prev */ + } enum_prev; + void* (*genericarg)(void*); /* Alternate Arg method */ +#else + bool (*fcheck)(FIELD *,const void *); /* field validation */ + bool (*ccheck)(int,const void *); /* character validation */ + + bool (*next)(FIELD *,const void *); /* enumerate next value */ + bool (*prev)(FIELD *,const void *); /* enumerate prev value */ +#endif +} FIELDTYPE; + +typedef void (*Form_Hook)(FORM *); + + /*************************** + * miscellaneous #defines * + ***************************/ + +/* field justification */ +#define NO_JUSTIFICATION (0) +#define JUSTIFY_LEFT (1) +#define JUSTIFY_CENTER (2) +#define JUSTIFY_RIGHT (3) + +/* field options */ +#define O_VISIBLE (0x0001U) +#define O_ACTIVE (0x0002U) +#define O_PUBLIC (0x0004U) +#define O_EDIT (0x0008U) +#define O_WRAP (0x0010U) +#define O_BLANK (0x0020U) +#define O_AUTOSKIP (0x0040U) +#define O_NULLOK (0x0080U) +#define O_PASSOK (0x0100U) +#define O_STATIC (0x0200U) +#define O_DYNAMIC_JUSTIFY (0x0400U) /* ncurses extension */ + +/* form options */ +#define O_NL_OVERLOAD (0x0001U) +#define O_BS_OVERLOAD (0x0002U) + +/* form driver commands */ +#define REQ_NEXT_PAGE (KEY_MAX + 1) /* move to next page */ +#define REQ_PREV_PAGE (KEY_MAX + 2) /* move to previous page */ +#define REQ_FIRST_PAGE (KEY_MAX + 3) /* move to first page */ +#define REQ_LAST_PAGE (KEY_MAX + 4) /* move to last page */ + +#define REQ_NEXT_FIELD (KEY_MAX + 5) /* move to next field */ +#define REQ_PREV_FIELD (KEY_MAX + 6) /* move to previous field */ +#define REQ_FIRST_FIELD (KEY_MAX + 7) /* move to first field */ +#define REQ_LAST_FIELD (KEY_MAX + 8) /* move to last field */ +#define REQ_SNEXT_FIELD (KEY_MAX + 9) /* move to sorted next field */ +#define REQ_SPREV_FIELD (KEY_MAX + 10) /* move to sorted prev field */ +#define REQ_SFIRST_FIELD (KEY_MAX + 11) /* move to sorted first field */ +#define REQ_SLAST_FIELD (KEY_MAX + 12) /* move to sorted last field */ +#define REQ_LEFT_FIELD (KEY_MAX + 13) /* move to left to field */ +#define REQ_RIGHT_FIELD (KEY_MAX + 14) /* move to right to field */ +#define REQ_UP_FIELD (KEY_MAX + 15) /* move to up to field */ +#define REQ_DOWN_FIELD (KEY_MAX + 16) /* move to down to field */ + +#define REQ_NEXT_CHAR (KEY_MAX + 17) /* move to next char in field */ +#define REQ_PREV_CHAR (KEY_MAX + 18) /* move to prev char in field */ +#define REQ_NEXT_LINE (KEY_MAX + 19) /* move to next line in field */ +#define REQ_PREV_LINE (KEY_MAX + 20) /* move to prev line in field */ +#define REQ_NEXT_WORD (KEY_MAX + 21) /* move to next word in field */ +#define REQ_PREV_WORD (KEY_MAX + 22) /* move to prev word in field */ +#define REQ_BEG_FIELD (KEY_MAX + 23) /* move to first char in field */ +#define REQ_END_FIELD (KEY_MAX + 24) /* move after last char in fld */ +#define REQ_BEG_LINE (KEY_MAX + 25) /* move to beginning of line */ +#define REQ_END_LINE (KEY_MAX + 26) /* move after last char in line */ +#define REQ_LEFT_CHAR (KEY_MAX + 27) /* move left in field */ +#define REQ_RIGHT_CHAR (KEY_MAX + 28) /* move right in field */ +#define REQ_UP_CHAR (KEY_MAX + 29) /* move up in field */ +#define REQ_DOWN_CHAR (KEY_MAX + 30) /* move down in field */ + +#define REQ_NEW_LINE (KEY_MAX + 31) /* insert/overlay new line */ +#define REQ_INS_CHAR (KEY_MAX + 32) /* insert blank char at cursor */ +#define REQ_INS_LINE (KEY_MAX + 33) /* insert blank line at cursor */ +#define REQ_DEL_CHAR (KEY_MAX + 34) /* delete char at cursor */ +#define REQ_DEL_PREV (KEY_MAX + 35) /* delete char before cursor */ +#define REQ_DEL_LINE (KEY_MAX + 36) /* delete line at cursor */ +#define REQ_DEL_WORD (KEY_MAX + 37) /* delete word at cursor */ +#define REQ_CLR_EOL (KEY_MAX + 38) /* clear to end of line */ +#define REQ_CLR_EOF (KEY_MAX + 39) /* clear to end of field */ +#define REQ_CLR_FIELD (KEY_MAX + 40) /* clear entire field */ +#define REQ_OVL_MODE (KEY_MAX + 41) /* begin overlay mode */ +#define REQ_INS_MODE (KEY_MAX + 42) /* begin insert mode */ +#define REQ_SCR_FLINE (KEY_MAX + 43) /* scroll field forward a line */ +#define REQ_SCR_BLINE (KEY_MAX + 44) /* scroll field backward a line */ +#define REQ_SCR_FPAGE (KEY_MAX + 45) /* scroll field forward a page */ +#define REQ_SCR_BPAGE (KEY_MAX + 46) /* scroll field backward a page */ +#define REQ_SCR_FHPAGE (KEY_MAX + 47) /* scroll field forward half page */ +#define REQ_SCR_BHPAGE (KEY_MAX + 48) /* scroll field backward half page */ +#define REQ_SCR_FCHAR (KEY_MAX + 49) /* horizontal scroll char */ +#define REQ_SCR_BCHAR (KEY_MAX + 50) /* horizontal scroll char */ +#define REQ_SCR_HFLINE (KEY_MAX + 51) /* horizontal scroll line */ +#define REQ_SCR_HBLINE (KEY_MAX + 52) /* horizontal scroll line */ +#define REQ_SCR_HFHALF (KEY_MAX + 53) /* horizontal scroll half line */ +#define REQ_SCR_HBHALF (KEY_MAX + 54) /* horizontal scroll half line */ + +#define REQ_VALIDATION (KEY_MAX + 55) /* validate field */ +#define REQ_NEXT_CHOICE (KEY_MAX + 56) /* display next field choice */ +#define REQ_PREV_CHOICE (KEY_MAX + 57) /* display prev field choice */ + +#define MIN_FORM_COMMAND (KEY_MAX + 1) /* used by form_driver */ +#define MAX_FORM_COMMAND (KEY_MAX + 57) /* used by form_driver */ + +#if defined(MAX_COMMAND) +# if (MAX_FORM_COMMAND > MAX_COMMAND) +# error Something is wrong -- MAX_FORM_COMMAND is greater than MAX_COMMAND +# elif (MAX_COMMAND != (KEY_MAX + 128)) +# error Something is wrong -- MAX_COMMAND is already inconsistently defined. +# endif +#else +# define MAX_COMMAND (KEY_MAX + 128) +#endif + + /************************* + * standard field types * + *************************/ +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA; +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM; +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM; +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER; +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC; +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP; + + /************************************ + * built-in additional field types * + * They are not defined in SVr4 * + ************************************/ +extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4; /* Internet IP Version 4 address */ + + /*********************** + * FIELDTYPE routines * + ***********************/ +extern NCURSES_EXPORT(FIELDTYPE *) new_fieldtype ( + bool (* const field_check)(FIELD *,const void *), + bool (* const char_check)(int,const void *)); +extern NCURSES_EXPORT(FIELDTYPE *) link_fieldtype( + FIELDTYPE *, FIELDTYPE *); + +extern NCURSES_EXPORT(int) free_fieldtype (FIELDTYPE *); +extern NCURSES_EXPORT(int) set_fieldtype_arg (FIELDTYPE *, + void * (* const make_arg)(va_list *), + void * (* const copy_arg)(const void *), + void (* const free_arg)(void *)); +extern NCURSES_EXPORT(int) set_fieldtype_choice (FIELDTYPE *, + bool (* const next_choice)(FIELD *,const void *), + bool (* const prev_choice)(FIELD *,const void *)); + + /******************* + * FIELD routines * + *******************/ +extern NCURSES_EXPORT(FIELD *) new_field (int,int,int,int,int,int); +extern NCURSES_EXPORT(FIELD *) dup_field (FIELD *,int,int); +extern NCURSES_EXPORT(FIELD *) link_field (FIELD *,int,int); + +extern NCURSES_EXPORT(int) free_field (FIELD *); +extern NCURSES_EXPORT(int) field_info (const FIELD *,int *,int *,int *,int *,int *,int *); +extern NCURSES_EXPORT(int) dynamic_field_info (const FIELD *,int *,int *,int *); +extern NCURSES_EXPORT(int) set_max_field ( FIELD *,int); +extern NCURSES_EXPORT(int) move_field (FIELD *,int,int); +extern NCURSES_EXPORT(int) set_field_type (FIELD *,FIELDTYPE *,...); +extern NCURSES_EXPORT(int) set_new_page (FIELD *,bool); +extern NCURSES_EXPORT(int) set_field_just (FIELD *,int); +extern NCURSES_EXPORT(int) field_just (const FIELD *); +extern NCURSES_EXPORT(int) set_field_fore (FIELD *,chtype); +extern NCURSES_EXPORT(int) set_field_back (FIELD *,chtype); +extern NCURSES_EXPORT(int) set_field_pad (FIELD *,int); +extern NCURSES_EXPORT(int) field_pad (const FIELD *); +extern NCURSES_EXPORT(int) set_field_buffer (FIELD *,int,const char *); +extern NCURSES_EXPORT(int) set_field_status (FIELD *,bool); +extern NCURSES_EXPORT(int) set_field_userptr (FIELD *, void *); +extern NCURSES_EXPORT(int) set_field_opts (FIELD *,Field_Options); +extern NCURSES_EXPORT(int) field_opts_on (FIELD *,Field_Options); +extern NCURSES_EXPORT(int) field_opts_off (FIELD *,Field_Options); + +extern NCURSES_EXPORT(chtype) field_fore (const FIELD *); +extern NCURSES_EXPORT(chtype) field_back (const FIELD *); + +extern NCURSES_EXPORT(bool) new_page (const FIELD *); +extern NCURSES_EXPORT(bool) field_status (const FIELD *); + +extern NCURSES_EXPORT(void *) field_arg (const FIELD *); + +extern NCURSES_EXPORT(void *) field_userptr (const FIELD *); + +extern NCURSES_EXPORT(FIELDTYPE *) field_type (const FIELD *); + +extern NCURSES_EXPORT(char *) field_buffer (const FIELD *,int); + +extern NCURSES_EXPORT(Field_Options) field_opts (const FIELD *); + + /****************** + * FORM routines * + ******************/ + +extern NCURSES_EXPORT(FORM *) new_form (FIELD **); + +extern NCURSES_EXPORT(FIELD **) form_fields (const FORM *); +extern NCURSES_EXPORT(FIELD *) current_field (const FORM *); + +extern NCURSES_EXPORT(WINDOW *) form_win (const FORM *); +extern NCURSES_EXPORT(WINDOW *) form_sub (const FORM *); + +extern NCURSES_EXPORT(Form_Hook) form_init (const FORM *); +extern NCURSES_EXPORT(Form_Hook) form_term (const FORM *); +extern NCURSES_EXPORT(Form_Hook) field_init (const FORM *); +extern NCURSES_EXPORT(Form_Hook) field_term (const FORM *); + +extern NCURSES_EXPORT(int) free_form (FORM *); +extern NCURSES_EXPORT(int) set_form_fields (FORM *,FIELD **); +extern NCURSES_EXPORT(int) field_count (const FORM *); +extern NCURSES_EXPORT(int) set_form_win (FORM *,WINDOW *); +extern NCURSES_EXPORT(int) set_form_sub (FORM *,WINDOW *); +extern NCURSES_EXPORT(int) set_current_field (FORM *,FIELD *); +extern NCURSES_EXPORT(int) field_index (const FIELD *); +extern NCURSES_EXPORT(int) set_form_page (FORM *,int); +extern NCURSES_EXPORT(int) form_page (const FORM *); +extern NCURSES_EXPORT(int) scale_form (const FORM *,int *,int *); +extern NCURSES_EXPORT(int) set_form_init (FORM *,Form_Hook); +extern NCURSES_EXPORT(int) set_form_term (FORM *,Form_Hook); +extern NCURSES_EXPORT(int) set_field_init (FORM *,Form_Hook); +extern NCURSES_EXPORT(int) set_field_term (FORM *,Form_Hook); +extern NCURSES_EXPORT(int) post_form (FORM *); +extern NCURSES_EXPORT(int) unpost_form (FORM *); +extern NCURSES_EXPORT(int) pos_form_cursor (FORM *); +extern NCURSES_EXPORT(int) form_driver (FORM *,int); +# if NCURSES_WIDECHAR +extern NCURSES_EXPORT(int) form_driver_w (FORM *,int,wchar_t); +# endif +extern NCURSES_EXPORT(int) set_form_userptr (FORM *,void *); +extern NCURSES_EXPORT(int) set_form_opts (FORM *,Form_Options); +extern NCURSES_EXPORT(int) form_opts_on (FORM *,Form_Options); +extern NCURSES_EXPORT(int) form_opts_off (FORM *,Form_Options); +extern NCURSES_EXPORT(int) form_request_by_name (const char *); + +extern NCURSES_EXPORT(const char *) form_request_name (int); + +extern NCURSES_EXPORT(void *) form_userptr (const FORM *); + +extern NCURSES_EXPORT(Form_Options) form_opts (const FORM *); + +extern NCURSES_EXPORT(bool) data_ahead (const FORM *); +extern NCURSES_EXPORT(bool) data_behind (const FORM *); + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(FORM *) NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **); +#endif + +#ifdef __cplusplus + } +#endif +/* *INDENT-ON*/ + +#endif /* FORM_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/ncurses/menu.h b/dingux/opt/mipsel-linux-uclibc/include/ncurses/menu.h new file mode 100644 index 0000000..48eaa3f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ncurses/menu.h @@ -0,0 +1,260 @@ +/**************************************************************************** + * Copyright (c) 1998-2007,2009 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Juergen Pfeifer, 1995,1997 * + ****************************************************************************/ + +/* $Id: menu.h,v 1.20 2009/04/05 00:28:07 tom Exp $ */ + +#ifndef ETI_MENU +#define ETI_MENU + +#ifdef AMIGA +#define TEXT TEXT_ncurses +#endif + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef int Menu_Options; +typedef int Item_Options; + +/* Menu options: */ +#define O_ONEVALUE (0x01) +#define O_SHOWDESC (0x02) +#define O_ROWMAJOR (0x04) +#define O_IGNORECASE (0x08) +#define O_SHOWMATCH (0x10) +#define O_NONCYCLIC (0x20) + +/* Item options: */ +#define O_SELECTABLE (0x01) + +typedef struct +{ + const char* str; + unsigned short length; +} TEXT; + +typedef struct tagITEM +{ + TEXT name; /* name of menu item */ + TEXT description; /* description of item, optional in display */ + struct tagMENU *imenu; /* Pointer to parent menu */ + void *userptr; /* Pointer to user defined per item data */ + Item_Options opt; /* Item options */ + short index; /* Item number if connected to a menu */ + short y; /* y and x location of item in menu */ + short x; + bool value; /* Selection value */ + + struct tagITEM *left; /* neighbor items */ + struct tagITEM *right; + struct tagITEM *up; + struct tagITEM *down; + +} ITEM; + +typedef void (*Menu_Hook)(struct tagMENU *); + +typedef struct tagMENU +{ + short height; /* Nr. of chars high */ + short width; /* Nr. of chars wide */ + short rows; /* Nr. of items high */ + short cols; /* Nr. of items wide */ + short frows; /* Nr. of formatted items high */ + short fcols; /* Nr. of formatted items wide */ + short arows; /* Nr. of items high (actual) */ + short namelen; /* Max. name length */ + short desclen; /* Max. description length */ + short marklen; /* Length of mark, if any */ + short itemlen; /* Length of one item */ + short spc_desc; /* Spacing for descriptor */ + short spc_cols; /* Spacing for columns */ + short spc_rows; /* Spacing for rows */ + char *pattern; /* Buffer to store match chars */ + short pindex; /* Index into pattern buffer */ + WINDOW *win; /* Window containing menu */ + WINDOW *sub; /* Subwindow for menu display */ + WINDOW *userwin; /* User's window */ + WINDOW *usersub; /* User's subwindow */ + ITEM **items; /* array of items */ + short nitems; /* Nr. of items in menu */ + ITEM *curitem; /* Current item */ + short toprow; /* Top row of menu */ + chtype fore; /* Selection attribute */ + chtype back; /* Nonselection attribute */ + chtype grey; /* Inactive attribute */ + unsigned char pad; /* Pad character */ + + Menu_Hook menuinit; /* User hooks */ + Menu_Hook menuterm; + Menu_Hook iteminit; + Menu_Hook itemterm; + + void *userptr; /* Pointer to menus user data */ + char *mark; /* Pointer to marker string */ + + Menu_Options opt; /* Menu options */ + unsigned short status; /* Internal state of menu */ + +} MENU; + + +/* Define keys */ + +#define REQ_LEFT_ITEM (KEY_MAX + 1) +#define REQ_RIGHT_ITEM (KEY_MAX + 2) +#define REQ_UP_ITEM (KEY_MAX + 3) +#define REQ_DOWN_ITEM (KEY_MAX + 4) +#define REQ_SCR_ULINE (KEY_MAX + 5) +#define REQ_SCR_DLINE (KEY_MAX + 6) +#define REQ_SCR_DPAGE (KEY_MAX + 7) +#define REQ_SCR_UPAGE (KEY_MAX + 8) +#define REQ_FIRST_ITEM (KEY_MAX + 9) +#define REQ_LAST_ITEM (KEY_MAX + 10) +#define REQ_NEXT_ITEM (KEY_MAX + 11) +#define REQ_PREV_ITEM (KEY_MAX + 12) +#define REQ_TOGGLE_ITEM (KEY_MAX + 13) +#define REQ_CLEAR_PATTERN (KEY_MAX + 14) +#define REQ_BACK_PATTERN (KEY_MAX + 15) +#define REQ_NEXT_MATCH (KEY_MAX + 16) +#define REQ_PREV_MATCH (KEY_MAX + 17) + +#define MIN_MENU_COMMAND (KEY_MAX + 1) +#define MAX_MENU_COMMAND (KEY_MAX + 17) + +/* + * Some AT&T code expects MAX_COMMAND to be out-of-band not + * just for menu commands but for forms ones as well. + */ +#if defined(MAX_COMMAND) +# if (MAX_MENU_COMMAND > MAX_COMMAND) +# error Something is wrong -- MAX_MENU_COMMAND is greater than MAX_COMMAND +# elif (MAX_COMMAND != (KEY_MAX + 128)) +# error Something is wrong -- MAX_COMMAND is already inconsistently defined. +# endif +#else +# define MAX_COMMAND (KEY_MAX + 128) +#endif + + +/* --------- prototypes for libmenu functions ----------------------------- */ + +extern NCURSES_EXPORT(ITEM **) menu_items (const MENU *); +extern NCURSES_EXPORT(ITEM *) current_item (const MENU *); +extern NCURSES_EXPORT(ITEM *) new_item (const char *,const char *); + +extern NCURSES_EXPORT(MENU *) new_menu (ITEM **); + +extern NCURSES_EXPORT(Item_Options) item_opts (const ITEM *); +extern NCURSES_EXPORT(Menu_Options) menu_opts (const MENU *); + +extern NCURSES_EXPORT(Menu_Hook) item_init (const MENU *); +extern NCURSES_EXPORT(Menu_Hook) item_term (const MENU *); +extern NCURSES_EXPORT(Menu_Hook) menu_init (const MENU *); +extern NCURSES_EXPORT(Menu_Hook) menu_term (const MENU *); + +extern NCURSES_EXPORT(WINDOW *) menu_sub (const MENU *); +extern NCURSES_EXPORT(WINDOW *) menu_win (const MENU *); + +extern NCURSES_EXPORT(const char *) item_description (const ITEM *); +extern NCURSES_EXPORT(const char *) item_name (const ITEM *); +extern NCURSES_EXPORT(const char *) menu_mark (const MENU *); +extern NCURSES_EXPORT(const char *) menu_request_name (int); + +extern NCURSES_EXPORT(char *) menu_pattern (const MENU *); + +extern NCURSES_EXPORT(void *) menu_userptr (const MENU *); +extern NCURSES_EXPORT(void *) item_userptr (const ITEM *); + +extern NCURSES_EXPORT(chtype) menu_back (const MENU *); +extern NCURSES_EXPORT(chtype) menu_fore (const MENU *); +extern NCURSES_EXPORT(chtype) menu_grey (const MENU *); + +extern NCURSES_EXPORT(int) free_item (ITEM *); +extern NCURSES_EXPORT(int) free_menu (MENU *); +extern NCURSES_EXPORT(int) item_count (const MENU *); +extern NCURSES_EXPORT(int) item_index (const ITEM *); +extern NCURSES_EXPORT(int) item_opts_off (ITEM *,Item_Options); +extern NCURSES_EXPORT(int) item_opts_on (ITEM *,Item_Options); +extern NCURSES_EXPORT(int) menu_driver (MENU *,int); +extern NCURSES_EXPORT(int) menu_opts_off (MENU *,Menu_Options); +extern NCURSES_EXPORT(int) menu_opts_on (MENU *,Menu_Options); +extern NCURSES_EXPORT(int) menu_pad (const MENU *); +extern NCURSES_EXPORT(int) pos_menu_cursor (const MENU *); +extern NCURSES_EXPORT(int) post_menu (MENU *); +extern NCURSES_EXPORT(int) scale_menu (const MENU *,int *,int *); +extern NCURSES_EXPORT(int) set_current_item (MENU *menu,ITEM *item); +extern NCURSES_EXPORT(int) set_item_init (MENU *, Menu_Hook); +extern NCURSES_EXPORT(int) set_item_opts (ITEM *,Item_Options); +extern NCURSES_EXPORT(int) set_item_term (MENU *, Menu_Hook); +extern NCURSES_EXPORT(int) set_item_userptr (ITEM *, void *); +extern NCURSES_EXPORT(int) set_item_value (ITEM *,bool); +extern NCURSES_EXPORT(int) set_menu_back (MENU *,chtype); +extern NCURSES_EXPORT(int) set_menu_fore (MENU *,chtype); +extern NCURSES_EXPORT(int) set_menu_format (MENU *,int,int); +extern NCURSES_EXPORT(int) set_menu_grey (MENU *,chtype); +extern NCURSES_EXPORT(int) set_menu_init (MENU *, Menu_Hook); +extern NCURSES_EXPORT(int) set_menu_items (MENU *,ITEM **); +extern NCURSES_EXPORT(int) set_menu_mark (MENU *, const char *); +extern NCURSES_EXPORT(int) set_menu_opts (MENU *,Menu_Options); +extern NCURSES_EXPORT(int) set_menu_pad (MENU *,int); +extern NCURSES_EXPORT(int) set_menu_pattern (MENU *,const char *); +extern NCURSES_EXPORT(int) set_menu_sub (MENU *,WINDOW *); +extern NCURSES_EXPORT(int) set_menu_term (MENU *, Menu_Hook); +extern NCURSES_EXPORT(int) set_menu_userptr (MENU *,void *); +extern NCURSES_EXPORT(int) set_menu_win (MENU *,WINDOW *); +extern NCURSES_EXPORT(int) set_top_row (MENU *,int); +extern NCURSES_EXPORT(int) top_row (const MENU *); +extern NCURSES_EXPORT(int) unpost_menu (MENU *); +extern NCURSES_EXPORT(int) menu_request_by_name (const char *); +extern NCURSES_EXPORT(int) set_menu_spacing (MENU *,int,int,int); +extern NCURSES_EXPORT(int) menu_spacing (const MENU *,int *,int *,int *); + + +extern NCURSES_EXPORT(bool) item_value (const ITEM *); +extern NCURSES_EXPORT(bool) item_visible (const ITEM *); + +extern NCURSES_EXPORT(void) menu_format (const MENU *,int *,int *); + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(MENU *) NCURSES_SP_NAME(new_menu) (SCREEN*, ITEM **); +#endif + +#ifdef __cplusplus + } +#endif + +#endif /* ETI_MENU */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/ncurses/nc_tparm.h b/dingux/opt/mipsel-linux-uclibc/include/ncurses/nc_tparm.h new file mode 100644 index 0000000..248f6c0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ncurses/nc_tparm.h @@ -0,0 +1,77 @@ +/**************************************************************************** + * Copyright (c) 2006-2010,2012 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Thomas E. Dickey 2006 * + ****************************************************************************/ + +/* $Id: nc_tparm.h,v 1.6 2012/02/18 21:34:42 tom Exp $ */ + +#ifndef NC_TPARM_included +#define NC_TPARM_included 1 + +/* + * Cast parameters past the formatting-string for tparm() to match the + * assumption of the varargs code. + */ +#ifndef TPARM_ARG +#ifdef NCURSES_TPARM_ARG +#define TPARM_ARG NCURSES_TPARM_ARG +#else +#define TPARM_ARG long +#endif +#endif /* TPARAM_ARG */ + +#define TPARM_N(n) (TPARM_ARG)(n) + +#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)) + +#if NCURSES_TPARM_VARARGS +#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)) +#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)) +#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)) +#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)) +#define TPARM_4(a,b,c,d,e) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e)) +#define TPARM_3(a,b,c,d) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d)) +#define TPARM_2(a,b,c) tparm(a,TPARM_N(b),TPARM_N(c)) +#define TPARM_1(a,b) tparm(a,TPARM_N(b)) +#define TPARM_0(a) tparm(a) +#else +#define TPARM_8(a,b,c,d,e,f,g,h,i) TPARM_9(a,b,c,d,e,f,g,h,i,0) +#define TPARM_7(a,b,c,d,e,f,g,h) TPARM_8(a,b,c,d,e,f,g,h,0) +#define TPARM_6(a,b,c,d,e,f,g) TPARM_7(a,b,c,d,e,f,g,0) +#define TPARM_5(a,b,c,d,e,f) TPARM_6(a,b,c,d,e,f,0) +#define TPARM_4(a,b,c,d,e) TPARM_5(a,b,c,d,e,0) +#define TPARM_3(a,b,c,d) TPARM_4(a,b,c,d,0) +#define TPARM_2(a,b,c) TPARM_3(a,b,c,0) +#define TPARM_1(a,b) TPARM_2(a,b,0) +#define TPARM_1(a,b) TPARM_2(a,b,0) +#define TPARM_0(a) TPARM_1(a,0) +#endif + +#endif /* NC_TPARM_included */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/ncurses/ncurses.h b/dingux/opt/mipsel-linux-uclibc/include/ncurses/ncurses.h new file mode 120000 index 0000000..149de6c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ncurses/ncurses.h @@ -0,0 +1 @@ +curses.h \ No newline at end of file diff --git a/dingux/opt/mipsel-linux-uclibc/include/ncurses/ncurses_dll.h b/dingux/opt/mipsel-linux-uclibc/include/ncurses/ncurses_dll.h new file mode 100644 index 0000000..249493f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ncurses/ncurses_dll.h @@ -0,0 +1,102 @@ +/**************************************************************************** + * Copyright (c) 1998-2009,2014 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ +/* $Id: ncurses_dll.h.in,v 1.9 2014/08/02 21:30:20 tom Exp $ */ + +#ifndef NCURSES_DLL_H_incl +#define NCURSES_DLL_H_incl 1 + +/* 2014-08-02 workaround for broken MinGW compiler. + * Oddly, only TRACE is mapped to trace - the other -D's are okay. + * suggest TDM as an alternative. + */ +#if defined(__MINGW64__) +#elif defined(__MINGW32__) +#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8) + +#ifdef trace +#undef trace +#define TRACE +#endif + +#endif /* broken compiler */ +#endif /* MingW */ + +/* + * For reentrant code, we map the various global variables into SCREEN by + * using functions to access them. + */ +#define NCURSES_PUBLIC_VAR(name) _nc_##name +#define NCURSES_WRAPPED_VAR(type,name) extern type NCURSES_PUBLIC_VAR(name)(void) + +/* no longer needed on cygwin or mingw, thanks to auto-import */ +/* but this structure may be useful at some point for an MSVC build */ +/* so, for now unconditionally define the important flags */ +/* "the right way" for proper static and dll+auto-import behavior */ +#undef NCURSES_DLL +#define NCURSES_STATIC + +#if defined(__CYGWIN__) || defined(__MINGW32__) +# if defined(NCURSES_DLL) +# if defined(NCURSES_STATIC) +# undef NCURSES_STATIC +# endif +# endif +# undef NCURSES_IMPEXP +# undef NCURSES_API +# undef NCURSES_EXPORT +# undef NCURSES_EXPORT_VAR +# if defined(NCURSES_DLL) +/* building a DLL */ +# define NCURSES_IMPEXP __declspec(dllexport) +# elif defined(NCURSES_STATIC) +/* building or linking to a static library */ +# define NCURSES_IMPEXP /* nothing */ +# else +/* linking to the DLL */ +# define NCURSES_IMPEXP __declspec(dllimport) +# endif +# define NCURSES_API __cdecl +# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type +#endif + +/* Take care of non-cygwin platforms */ +#if !defined(NCURSES_IMPEXP) +# define NCURSES_IMPEXP /* nothing */ +#endif +#if !defined(NCURSES_API) +# define NCURSES_API /* nothing */ +#endif +#if !defined(NCURSES_EXPORT) +# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API +#endif +#if !defined(NCURSES_EXPORT_VAR) +# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type +#endif + +#endif /* NCURSES_DLL_H_incl */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/ncurses/panel.h b/dingux/opt/mipsel-linux-uclibc/include/ncurses/panel.h new file mode 100644 index 0000000..4d5aca2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ncurses/panel.h @@ -0,0 +1,85 @@ +/**************************************************************************** + * Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1995 * + * and: Eric S. Raymond * + * and: Juergen Pfeifer 1996-1999,2008 * + ****************************************************************************/ + +/* $Id: panel.h,v 1.11 2009/04/11 19:50:40 tom Exp $ */ + +/* panel.h -- interface file for panels library */ + +#ifndef NCURSES_PANEL_H_incl +#define NCURSES_PANEL_H_incl 1 + +#include + +typedef struct panel +{ + WINDOW *win; + struct panel *below; + struct panel *above; + NCURSES_CONST void *user; +} PANEL; + +#if defined(__cplusplus) +extern "C" { +#endif + +extern NCURSES_EXPORT(WINDOW*) panel_window (const PANEL *); +extern NCURSES_EXPORT(void) update_panels (void); +extern NCURSES_EXPORT(int) hide_panel (PANEL *); +extern NCURSES_EXPORT(int) show_panel (PANEL *); +extern NCURSES_EXPORT(int) del_panel (PANEL *); +extern NCURSES_EXPORT(int) top_panel (PANEL *); +extern NCURSES_EXPORT(int) bottom_panel (PANEL *); +extern NCURSES_EXPORT(PANEL*) new_panel (WINDOW *); +extern NCURSES_EXPORT(PANEL*) panel_above (const PANEL *); +extern NCURSES_EXPORT(PANEL*) panel_below (const PANEL *); +extern NCURSES_EXPORT(int) set_panel_userptr (PANEL *, NCURSES_CONST void *); +extern NCURSES_EXPORT(NCURSES_CONST void*) panel_userptr (const PANEL *); +extern NCURSES_EXPORT(int) move_panel (PANEL *, int, int); +extern NCURSES_EXPORT(int) replace_panel (PANEL *,WINDOW *); +extern NCURSES_EXPORT(int) panel_hidden (const PANEL *); + +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(PANEL *) ground_panel(SCREEN *); +extern NCURSES_EXPORT(PANEL *) ceiling_panel(SCREEN *); + +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(update_panels) (SCREEN*); +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /* NCURSES_PANEL_H_incl */ + +/* end of panel.h */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/ncurses/term.h b/dingux/opt/mipsel-linux-uclibc/include/ncurses/term.h new file mode 100644 index 0000000..b250b70 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ncurses/term.h @@ -0,0 +1,806 @@ +/**************************************************************************** + * Copyright (c) 1998-2011,2013 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/****************************************************************************/ +/* Author: Zeyd M. Ben-Halim 1992,1995 */ +/* and: Eric S. Raymond */ +/* and: Thomas E. Dickey 1995-on */ +/****************************************************************************/ + +/* $Id: MKterm.h.awk.in,v 1.62 2013/08/17 19:21:56 tom Exp $ */ + +/* +** term.h -- Definition of struct term +*/ + +#ifndef NCURSES_TERM_H_incl +#define NCURSES_TERM_H_incl 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.0" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H + * definition (based on the system for which this was configured). + */ + +#undef NCURSES_CONST +#define NCURSES_CONST const + +#undef NCURSES_SBOOL +#define NCURSES_SBOOL char + +#undef NCURSES_USE_DATABASE +#define NCURSES_USE_DATABASE 1 + +#undef NCURSES_USE_TERMCAP +#define NCURSES_USE_TERMCAP 0 + +#undef NCURSES_XNAMES +#define NCURSES_XNAMES 1 + +/* We will use these symbols to hide differences between + * termios/termio/sgttyb interfaces. + */ +#undef TTY +#undef SET_TTY +#undef GET_TTY + +/* Assume POSIX termio if we have the header and function */ +/* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */ +#if 1 && 1 + +#undef TERMIOS +#define TERMIOS 1 + +#include +#define TTY struct termios + +#else /* !HAVE_TERMIOS_H */ + +/* #if HAVE_TERMIO_H */ +#if 1 + +#undef TERMIOS +#define TERMIOS 1 + +#include +#define TTY struct termio + +#else /* !HAVE_TERMIO_H */ + +#if __MINGW32__ +# include +# define TTY struct termios +#else +#undef TERMIOS +#include +#include +#define TTY struct sgttyb +#endif /* MINGW32 */ +#endif /* HAVE_TERMIO_H */ + +#endif /* HAVE_TERMIOS_H */ + +#ifdef TERMIOS +#define GET_TTY(fd, buf) tcgetattr(fd, buf) +#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf) +#else +#define GET_TTY(fd, buf) gtty(fd, buf) +#define SET_TTY(fd, buf) stty(fd, buf) +#endif + +#define NAMESIZE 256 + +#define CUR cur_term->type. + +#define auto_left_margin CUR Booleans[0] +#define auto_right_margin CUR Booleans[1] +#define no_esc_ctlc CUR Booleans[2] +#define ceol_standout_glitch CUR Booleans[3] +#define eat_newline_glitch CUR Booleans[4] +#define erase_overstrike CUR Booleans[5] +#define generic_type CUR Booleans[6] +#define hard_copy CUR Booleans[7] +#define has_meta_key CUR Booleans[8] +#define has_status_line CUR Booleans[9] +#define insert_null_glitch CUR Booleans[10] +#define memory_above CUR Booleans[11] +#define memory_below CUR Booleans[12] +#define move_insert_mode CUR Booleans[13] +#define move_standout_mode CUR Booleans[14] +#define over_strike CUR Booleans[15] +#define status_line_esc_ok CUR Booleans[16] +#define dest_tabs_magic_smso CUR Booleans[17] +#define tilde_glitch CUR Booleans[18] +#define transparent_underline CUR Booleans[19] +#define xon_xoff CUR Booleans[20] +#define needs_xon_xoff CUR Booleans[21] +#define prtr_silent CUR Booleans[22] +#define hard_cursor CUR Booleans[23] +#define non_rev_rmcup CUR Booleans[24] +#define no_pad_char CUR Booleans[25] +#define non_dest_scroll_region CUR Booleans[26] +#define can_change CUR Booleans[27] +#define back_color_erase CUR Booleans[28] +#define hue_lightness_saturation CUR Booleans[29] +#define col_addr_glitch CUR Booleans[30] +#define cr_cancels_micro_mode CUR Booleans[31] +#define has_print_wheel CUR Booleans[32] +#define row_addr_glitch CUR Booleans[33] +#define semi_auto_right_margin CUR Booleans[34] +#define cpi_changes_res CUR Booleans[35] +#define lpi_changes_res CUR Booleans[36] +#define columns CUR Numbers[0] +#define init_tabs CUR Numbers[1] +#define lines CUR Numbers[2] +#define lines_of_memory CUR Numbers[3] +#define magic_cookie_glitch CUR Numbers[4] +#define padding_baud_rate CUR Numbers[5] +#define virtual_terminal CUR Numbers[6] +#define width_status_line CUR Numbers[7] +#define num_labels CUR Numbers[8] +#define label_height CUR Numbers[9] +#define label_width CUR Numbers[10] +#define max_attributes CUR Numbers[11] +#define maximum_windows CUR Numbers[12] +#define max_colors CUR Numbers[13] +#define max_pairs CUR Numbers[14] +#define no_color_video CUR Numbers[15] +#define buffer_capacity CUR Numbers[16] +#define dot_vert_spacing CUR Numbers[17] +#define dot_horz_spacing CUR Numbers[18] +#define max_micro_address CUR Numbers[19] +#define max_micro_jump CUR Numbers[20] +#define micro_col_size CUR Numbers[21] +#define micro_line_size CUR Numbers[22] +#define number_of_pins CUR Numbers[23] +#define output_res_char CUR Numbers[24] +#define output_res_line CUR Numbers[25] +#define output_res_horz_inch CUR Numbers[26] +#define output_res_vert_inch CUR Numbers[27] +#define print_rate CUR Numbers[28] +#define wide_char_size CUR Numbers[29] +#define buttons CUR Numbers[30] +#define bit_image_entwining CUR Numbers[31] +#define bit_image_type CUR Numbers[32] +#define back_tab CUR Strings[0] +#define bell CUR Strings[1] +#define carriage_return CUR Strings[2] +#define change_scroll_region CUR Strings[3] +#define clear_all_tabs CUR Strings[4] +#define clear_screen CUR Strings[5] +#define clr_eol CUR Strings[6] +#define clr_eos CUR Strings[7] +#define column_address CUR Strings[8] +#define command_character CUR Strings[9] +#define cursor_address CUR Strings[10] +#define cursor_down CUR Strings[11] +#define cursor_home CUR Strings[12] +#define cursor_invisible CUR Strings[13] +#define cursor_left CUR Strings[14] +#define cursor_mem_address CUR Strings[15] +#define cursor_normal CUR Strings[16] +#define cursor_right CUR Strings[17] +#define cursor_to_ll CUR Strings[18] +#define cursor_up CUR Strings[19] +#define cursor_visible CUR Strings[20] +#define delete_character CUR Strings[21] +#define delete_line CUR Strings[22] +#define dis_status_line CUR Strings[23] +#define down_half_line CUR Strings[24] +#define enter_alt_charset_mode CUR Strings[25] +#define enter_blink_mode CUR Strings[26] +#define enter_bold_mode CUR Strings[27] +#define enter_ca_mode CUR Strings[28] +#define enter_delete_mode CUR Strings[29] +#define enter_dim_mode CUR Strings[30] +#define enter_insert_mode CUR Strings[31] +#define enter_secure_mode CUR Strings[32] +#define enter_protected_mode CUR Strings[33] +#define enter_reverse_mode CUR Strings[34] +#define enter_standout_mode CUR Strings[35] +#define enter_underline_mode CUR Strings[36] +#define erase_chars CUR Strings[37] +#define exit_alt_charset_mode CUR Strings[38] +#define exit_attribute_mode CUR Strings[39] +#define exit_ca_mode CUR Strings[40] +#define exit_delete_mode CUR Strings[41] +#define exit_insert_mode CUR Strings[42] +#define exit_standout_mode CUR Strings[43] +#define exit_underline_mode CUR Strings[44] +#define flash_screen CUR Strings[45] +#define form_feed CUR Strings[46] +#define from_status_line CUR Strings[47] +#define init_1string CUR Strings[48] +#define init_2string CUR Strings[49] +#define init_3string CUR Strings[50] +#define init_file CUR Strings[51] +#define insert_character CUR Strings[52] +#define insert_line CUR Strings[53] +#define insert_padding CUR Strings[54] +#define key_backspace CUR Strings[55] +#define key_catab CUR Strings[56] +#define key_clear CUR Strings[57] +#define key_ctab CUR Strings[58] +#define key_dc CUR Strings[59] +#define key_dl CUR Strings[60] +#define key_down CUR Strings[61] +#define key_eic CUR Strings[62] +#define key_eol CUR Strings[63] +#define key_eos CUR Strings[64] +#define key_f0 CUR Strings[65] +#define key_f1 CUR Strings[66] +#define key_f10 CUR Strings[67] +#define key_f2 CUR Strings[68] +#define key_f3 CUR Strings[69] +#define key_f4 CUR Strings[70] +#define key_f5 CUR Strings[71] +#define key_f6 CUR Strings[72] +#define key_f7 CUR Strings[73] +#define key_f8 CUR Strings[74] +#define key_f9 CUR Strings[75] +#define key_home CUR Strings[76] +#define key_ic CUR Strings[77] +#define key_il CUR Strings[78] +#define key_left CUR Strings[79] +#define key_ll CUR Strings[80] +#define key_npage CUR Strings[81] +#define key_ppage CUR Strings[82] +#define key_right CUR Strings[83] +#define key_sf CUR Strings[84] +#define key_sr CUR Strings[85] +#define key_stab CUR Strings[86] +#define key_up CUR Strings[87] +#define keypad_local CUR Strings[88] +#define keypad_xmit CUR Strings[89] +#define lab_f0 CUR Strings[90] +#define lab_f1 CUR Strings[91] +#define lab_f10 CUR Strings[92] +#define lab_f2 CUR Strings[93] +#define lab_f3 CUR Strings[94] +#define lab_f4 CUR Strings[95] +#define lab_f5 CUR Strings[96] +#define lab_f6 CUR Strings[97] +#define lab_f7 CUR Strings[98] +#define lab_f8 CUR Strings[99] +#define lab_f9 CUR Strings[100] +#define meta_off CUR Strings[101] +#define meta_on CUR Strings[102] +#define newline CUR Strings[103] +#define pad_char CUR Strings[104] +#define parm_dch CUR Strings[105] +#define parm_delete_line CUR Strings[106] +#define parm_down_cursor CUR Strings[107] +#define parm_ich CUR Strings[108] +#define parm_index CUR Strings[109] +#define parm_insert_line CUR Strings[110] +#define parm_left_cursor CUR Strings[111] +#define parm_right_cursor CUR Strings[112] +#define parm_rindex CUR Strings[113] +#define parm_up_cursor CUR Strings[114] +#define pkey_key CUR Strings[115] +#define pkey_local CUR Strings[116] +#define pkey_xmit CUR Strings[117] +#define print_screen CUR Strings[118] +#define prtr_off CUR Strings[119] +#define prtr_on CUR Strings[120] +#define repeat_char CUR Strings[121] +#define reset_1string CUR Strings[122] +#define reset_2string CUR Strings[123] +#define reset_3string CUR Strings[124] +#define reset_file CUR Strings[125] +#define restore_cursor CUR Strings[126] +#define row_address CUR Strings[127] +#define save_cursor CUR Strings[128] +#define scroll_forward CUR Strings[129] +#define scroll_reverse CUR Strings[130] +#define set_attributes CUR Strings[131] +#define set_tab CUR Strings[132] +#define set_window CUR Strings[133] +#define tab CUR Strings[134] +#define to_status_line CUR Strings[135] +#define underline_char CUR Strings[136] +#define up_half_line CUR Strings[137] +#define init_prog CUR Strings[138] +#define key_a1 CUR Strings[139] +#define key_a3 CUR Strings[140] +#define key_b2 CUR Strings[141] +#define key_c1 CUR Strings[142] +#define key_c3 CUR Strings[143] +#define prtr_non CUR Strings[144] +#define char_padding CUR Strings[145] +#define acs_chars CUR Strings[146] +#define plab_norm CUR Strings[147] +#define key_btab CUR Strings[148] +#define enter_xon_mode CUR Strings[149] +#define exit_xon_mode CUR Strings[150] +#define enter_am_mode CUR Strings[151] +#define exit_am_mode CUR Strings[152] +#define xon_character CUR Strings[153] +#define xoff_character CUR Strings[154] +#define ena_acs CUR Strings[155] +#define label_on CUR Strings[156] +#define label_off CUR Strings[157] +#define key_beg CUR Strings[158] +#define key_cancel CUR Strings[159] +#define key_close CUR Strings[160] +#define key_command CUR Strings[161] +#define key_copy CUR Strings[162] +#define key_create CUR Strings[163] +#define key_end CUR Strings[164] +#define key_enter CUR Strings[165] +#define key_exit CUR Strings[166] +#define key_find CUR Strings[167] +#define key_help CUR Strings[168] +#define key_mark CUR Strings[169] +#define key_message CUR Strings[170] +#define key_move CUR Strings[171] +#define key_next CUR Strings[172] +#define key_open CUR Strings[173] +#define key_options CUR Strings[174] +#define key_previous CUR Strings[175] +#define key_print CUR Strings[176] +#define key_redo CUR Strings[177] +#define key_reference CUR Strings[178] +#define key_refresh CUR Strings[179] +#define key_replace CUR Strings[180] +#define key_restart CUR Strings[181] +#define key_resume CUR Strings[182] +#define key_save CUR Strings[183] +#define key_suspend CUR Strings[184] +#define key_undo CUR Strings[185] +#define key_sbeg CUR Strings[186] +#define key_scancel CUR Strings[187] +#define key_scommand CUR Strings[188] +#define key_scopy CUR Strings[189] +#define key_screate CUR Strings[190] +#define key_sdc CUR Strings[191] +#define key_sdl CUR Strings[192] +#define key_select CUR Strings[193] +#define key_send CUR Strings[194] +#define key_seol CUR Strings[195] +#define key_sexit CUR Strings[196] +#define key_sfind CUR Strings[197] +#define key_shelp CUR Strings[198] +#define key_shome CUR Strings[199] +#define key_sic CUR Strings[200] +#define key_sleft CUR Strings[201] +#define key_smessage CUR Strings[202] +#define key_smove CUR Strings[203] +#define key_snext CUR Strings[204] +#define key_soptions CUR Strings[205] +#define key_sprevious CUR Strings[206] +#define key_sprint CUR Strings[207] +#define key_sredo CUR Strings[208] +#define key_sreplace CUR Strings[209] +#define key_sright CUR Strings[210] +#define key_srsume CUR Strings[211] +#define key_ssave CUR Strings[212] +#define key_ssuspend CUR Strings[213] +#define key_sundo CUR Strings[214] +#define req_for_input CUR Strings[215] +#define key_f11 CUR Strings[216] +#define key_f12 CUR Strings[217] +#define key_f13 CUR Strings[218] +#define key_f14 CUR Strings[219] +#define key_f15 CUR Strings[220] +#define key_f16 CUR Strings[221] +#define key_f17 CUR Strings[222] +#define key_f18 CUR Strings[223] +#define key_f19 CUR Strings[224] +#define key_f20 CUR Strings[225] +#define key_f21 CUR Strings[226] +#define key_f22 CUR Strings[227] +#define key_f23 CUR Strings[228] +#define key_f24 CUR Strings[229] +#define key_f25 CUR Strings[230] +#define key_f26 CUR Strings[231] +#define key_f27 CUR Strings[232] +#define key_f28 CUR Strings[233] +#define key_f29 CUR Strings[234] +#define key_f30 CUR Strings[235] +#define key_f31 CUR Strings[236] +#define key_f32 CUR Strings[237] +#define key_f33 CUR Strings[238] +#define key_f34 CUR Strings[239] +#define key_f35 CUR Strings[240] +#define key_f36 CUR Strings[241] +#define key_f37 CUR Strings[242] +#define key_f38 CUR Strings[243] +#define key_f39 CUR Strings[244] +#define key_f40 CUR Strings[245] +#define key_f41 CUR Strings[246] +#define key_f42 CUR Strings[247] +#define key_f43 CUR Strings[248] +#define key_f44 CUR Strings[249] +#define key_f45 CUR Strings[250] +#define key_f46 CUR Strings[251] +#define key_f47 CUR Strings[252] +#define key_f48 CUR Strings[253] +#define key_f49 CUR Strings[254] +#define key_f50 CUR Strings[255] +#define key_f51 CUR Strings[256] +#define key_f52 CUR Strings[257] +#define key_f53 CUR Strings[258] +#define key_f54 CUR Strings[259] +#define key_f55 CUR Strings[260] +#define key_f56 CUR Strings[261] +#define key_f57 CUR Strings[262] +#define key_f58 CUR Strings[263] +#define key_f59 CUR Strings[264] +#define key_f60 CUR Strings[265] +#define key_f61 CUR Strings[266] +#define key_f62 CUR Strings[267] +#define key_f63 CUR Strings[268] +#define clr_bol CUR Strings[269] +#define clear_margins CUR Strings[270] +#define set_left_margin CUR Strings[271] +#define set_right_margin CUR Strings[272] +#define label_format CUR Strings[273] +#define set_clock CUR Strings[274] +#define display_clock CUR Strings[275] +#define remove_clock CUR Strings[276] +#define create_window CUR Strings[277] +#define goto_window CUR Strings[278] +#define hangup CUR Strings[279] +#define dial_phone CUR Strings[280] +#define quick_dial CUR Strings[281] +#define tone CUR Strings[282] +#define pulse CUR Strings[283] +#define flash_hook CUR Strings[284] +#define fixed_pause CUR Strings[285] +#define wait_tone CUR Strings[286] +#define user0 CUR Strings[287] +#define user1 CUR Strings[288] +#define user2 CUR Strings[289] +#define user3 CUR Strings[290] +#define user4 CUR Strings[291] +#define user5 CUR Strings[292] +#define user6 CUR Strings[293] +#define user7 CUR Strings[294] +#define user8 CUR Strings[295] +#define user9 CUR Strings[296] +#define orig_pair CUR Strings[297] +#define orig_colors CUR Strings[298] +#define initialize_color CUR Strings[299] +#define initialize_pair CUR Strings[300] +#define set_color_pair CUR Strings[301] +#define set_foreground CUR Strings[302] +#define set_background CUR Strings[303] +#define change_char_pitch CUR Strings[304] +#define change_line_pitch CUR Strings[305] +#define change_res_horz CUR Strings[306] +#define change_res_vert CUR Strings[307] +#define define_char CUR Strings[308] +#define enter_doublewide_mode CUR Strings[309] +#define enter_draft_quality CUR Strings[310] +#define enter_italics_mode CUR Strings[311] +#define enter_leftward_mode CUR Strings[312] +#define enter_micro_mode CUR Strings[313] +#define enter_near_letter_quality CUR Strings[314] +#define enter_normal_quality CUR Strings[315] +#define enter_shadow_mode CUR Strings[316] +#define enter_subscript_mode CUR Strings[317] +#define enter_superscript_mode CUR Strings[318] +#define enter_upward_mode CUR Strings[319] +#define exit_doublewide_mode CUR Strings[320] +#define exit_italics_mode CUR Strings[321] +#define exit_leftward_mode CUR Strings[322] +#define exit_micro_mode CUR Strings[323] +#define exit_shadow_mode CUR Strings[324] +#define exit_subscript_mode CUR Strings[325] +#define exit_superscript_mode CUR Strings[326] +#define exit_upward_mode CUR Strings[327] +#define micro_column_address CUR Strings[328] +#define micro_down CUR Strings[329] +#define micro_left CUR Strings[330] +#define micro_right CUR Strings[331] +#define micro_row_address CUR Strings[332] +#define micro_up CUR Strings[333] +#define order_of_pins CUR Strings[334] +#define parm_down_micro CUR Strings[335] +#define parm_left_micro CUR Strings[336] +#define parm_right_micro CUR Strings[337] +#define parm_up_micro CUR Strings[338] +#define select_char_set CUR Strings[339] +#define set_bottom_margin CUR Strings[340] +#define set_bottom_margin_parm CUR Strings[341] +#define set_left_margin_parm CUR Strings[342] +#define set_right_margin_parm CUR Strings[343] +#define set_top_margin CUR Strings[344] +#define set_top_margin_parm CUR Strings[345] +#define start_bit_image CUR Strings[346] +#define start_char_set_def CUR Strings[347] +#define stop_bit_image CUR Strings[348] +#define stop_char_set_def CUR Strings[349] +#define subscript_characters CUR Strings[350] +#define superscript_characters CUR Strings[351] +#define these_cause_cr CUR Strings[352] +#define zero_motion CUR Strings[353] +#define char_set_names CUR Strings[354] +#define key_mouse CUR Strings[355] +#define mouse_info CUR Strings[356] +#define req_mouse_pos CUR Strings[357] +#define get_mouse CUR Strings[358] +#define set_a_foreground CUR Strings[359] +#define set_a_background CUR Strings[360] +#define pkey_plab CUR Strings[361] +#define device_type CUR Strings[362] +#define code_set_init CUR Strings[363] +#define set0_des_seq CUR Strings[364] +#define set1_des_seq CUR Strings[365] +#define set2_des_seq CUR Strings[366] +#define set3_des_seq CUR Strings[367] +#define set_lr_margin CUR Strings[368] +#define set_tb_margin CUR Strings[369] +#define bit_image_repeat CUR Strings[370] +#define bit_image_newline CUR Strings[371] +#define bit_image_carriage_return CUR Strings[372] +#define color_names CUR Strings[373] +#define define_bit_image_region CUR Strings[374] +#define end_bit_image_region CUR Strings[375] +#define set_color_band CUR Strings[376] +#define set_page_length CUR Strings[377] +#define display_pc_char CUR Strings[378] +#define enter_pc_charset_mode CUR Strings[379] +#define exit_pc_charset_mode CUR Strings[380] +#define enter_scancode_mode CUR Strings[381] +#define exit_scancode_mode CUR Strings[382] +#define pc_term_options CUR Strings[383] +#define scancode_escape CUR Strings[384] +#define alt_scancode_esc CUR Strings[385] +#define enter_horizontal_hl_mode CUR Strings[386] +#define enter_left_hl_mode CUR Strings[387] +#define enter_low_hl_mode CUR Strings[388] +#define enter_right_hl_mode CUR Strings[389] +#define enter_top_hl_mode CUR Strings[390] +#define enter_vertical_hl_mode CUR Strings[391] +#define set_a_attributes CUR Strings[392] +#define set_pglen_inch CUR Strings[393] + +#define BOOLWRITE 37 +#define NUMWRITE 33 +#define STRWRITE 394 + +/* older synonyms for some capabilities */ +#define beehive_glitch no_esc_ctlc +#define teleray_glitch dest_tabs_magic_smso +#define micro_char_size micro_col_size + +#ifdef __INTERNAL_CAPS_VISIBLE +#define termcap_init2 CUR Strings[394] +#define termcap_reset CUR Strings[395] +#define magic_cookie_glitch_ul CUR Numbers[33] +#define backspaces_with_bs CUR Booleans[37] +#define crt_no_scrolling CUR Booleans[38] +#define no_correctly_working_cr CUR Booleans[39] +#define carriage_return_delay CUR Numbers[34] +#define new_line_delay CUR Numbers[35] +#define linefeed_if_not_lf CUR Strings[396] +#define backspace_if_not_bs CUR Strings[397] +#define gnu_has_meta_key CUR Booleans[40] +#define linefeed_is_newline CUR Booleans[41] +#define backspace_delay CUR Numbers[36] +#define horizontal_tab_delay CUR Numbers[37] +#define number_of_function_keys CUR Numbers[38] +#define other_non_function_keys CUR Strings[398] +#define arrow_key_map CUR Strings[399] +#define has_hardware_tabs CUR Booleans[42] +#define return_does_clr_eol CUR Booleans[43] +#define acs_ulcorner CUR Strings[400] +#define acs_llcorner CUR Strings[401] +#define acs_urcorner CUR Strings[402] +#define acs_lrcorner CUR Strings[403] +#define acs_ltee CUR Strings[404] +#define acs_rtee CUR Strings[405] +#define acs_btee CUR Strings[406] +#define acs_ttee CUR Strings[407] +#define acs_hline CUR Strings[408] +#define acs_vline CUR Strings[409] +#define acs_plus CUR Strings[410] +#define memory_lock CUR Strings[411] +#define memory_unlock CUR Strings[412] +#define box_chars_1 CUR Strings[413] +#endif /* __INTERNAL_CAPS_VISIBLE */ + + +/* + * Predefined terminfo array sizes + */ +#define BOOLCOUNT 44 +#define NUMCOUNT 39 +#define STRCOUNT 414 + +/* used by code for comparing entries */ +#define acs_chars_index 146 + +typedef struct termtype { /* in-core form of terminfo data */ + char *term_names; /* str_table offset of term names */ + char *str_table; /* pointer to string table */ + NCURSES_SBOOL *Booleans; /* array of boolean values */ + short *Numbers; /* array of integer values */ + char **Strings; /* array of string offsets */ + +#if NCURSES_XNAMES + char *ext_str_table; /* pointer to extended string table */ + char **ext_Names; /* corresponding names */ + + unsigned short num_Booleans;/* count total Booleans */ + unsigned short num_Numbers; /* count total Numbers */ + unsigned short num_Strings; /* count total Strings */ + + unsigned short ext_Booleans;/* count extensions to Booleans */ + unsigned short ext_Numbers; /* count extensions to Numbers */ + unsigned short ext_Strings; /* count extensions to Strings */ +#endif /* NCURSES_XNAMES */ + +} TERMTYPE; + +typedef struct term { /* describe an actual terminal */ + TERMTYPE type; /* terminal type description */ + short Filedes; /* file description being written to */ + TTY Ottyb, /* original state of the terminal */ + Nttyb; /* current state of the terminal */ + int _baudrate; /* used to compute padding */ + char * _termname; /* used for termname() */ +} TERMINAL; + +#if 0 && !0 +extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term; +#elif 0 +NCURSES_WRAPPED_VAR(TERMINAL *, cur_term); +#define cur_term NCURSES_PUBLIC_VAR(cur_term()) +#else +extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term; +#endif + +#if 0 || 0 +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolfnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numcodes); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numfnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strnames); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strcodes); +NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strfnames); + +#define boolnames NCURSES_PUBLIC_VAR(boolnames()) +#define boolcodes NCURSES_PUBLIC_VAR(boolcodes()) +#define boolfnames NCURSES_PUBLIC_VAR(boolfnames()) +#define numnames NCURSES_PUBLIC_VAR(numnames()) +#define numcodes NCURSES_PUBLIC_VAR(numcodes()) +#define numfnames NCURSES_PUBLIC_VAR(numfnames()) +#define strnames NCURSES_PUBLIC_VAR(strnames()) +#define strcodes NCURSES_PUBLIC_VAR(strcodes()) +#define strfnames NCURSES_PUBLIC_VAR(strfnames()) + +#else + +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[]; +extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[]; + +#endif + +/* internals */ +extern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf); +extern NCURSES_EXPORT(int) _nc_get_tty_mode (TTY *buf); +extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const); +extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE *); +extern NCURSES_EXPORT(void) _nc_init_termtype (TERMTYPE *const); +extern NCURSES_EXPORT(int) _nc_read_termtype (TERMTYPE *, char *, int); +extern NCURSES_EXPORT(char *) _nc_first_name (const char *const); +extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const); +extern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *); + +/* entry points */ +extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *); +extern NCURSES_EXPORT(int) del_curterm (TERMINAL *); + +/* miscellaneous entry points */ +extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *); +extern NCURSES_EXPORT(int) setupterm (NCURSES_CONST char *,int,int *); + +/* terminfo entry points, also declared in curses.h */ +#if !defined(__NCURSES_H) +extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *); +extern NCURSES_EXPORT_VAR(char) ttytype[]; +extern NCURSES_EXPORT(int) putp (const char *); +extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *); + +#if 1 /* NCURSES_TPARM_VARARGS */ +extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* special */ +#else +extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */ +extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...); /* special */ +#endif + +extern NCURSES_EXPORT(char *) tiparm (const char *, ...); /* special */ + +#endif /* __NCURSES_H */ + +/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */ +#if !defined(NCURSES_TERMCAP_H_incl) +extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **); +extern NCURSES_EXPORT(char *) tgoto (const char *, int, int); +extern NCURSES_EXPORT(int) tgetent (char *, const char *); +extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int)); +#endif /* NCURSES_TERMCAP_H_incl */ + +/* + * Include curses.h before term.h to enable these extensions. + */ +#if defined(NCURSES_SP_FUNCS) && (NCURSES_SP_FUNCS != 0) + +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tigetstr) (SCREEN*, NCURSES_CONST char *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(putp) (SCREEN*, const char *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetflag) (SCREEN*, NCURSES_CONST char *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetnum) (SCREEN*, NCURSES_CONST char *); + +#if 1 /* NCURSES_TPARM_VARARGS */ +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, NCURSES_CONST char *, ...); /* special */ +#else +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */ +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm_varargs) (SCREEN*, NCURSES_CONST char *, ...); /* special */ +#endif + +/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */ +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgetstr) (SCREEN*, NCURSES_CONST char *, char **); +extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgoto) (SCREEN*, const char *, int, int); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetent) (SCREEN*, char *, const char *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetflag) (SCREEN*, NCURSES_CONST char *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetnum) (SCREEN*, NCURSES_CONST char *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tputs) (SCREEN*, const char *, int, NCURSES_SP_OUTC); + +extern NCURSES_EXPORT(TERMINAL *) NCURSES_SP_NAME(set_curterm) (SCREEN*, TERMINAL *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(del_curterm) (SCREEN*, TERMINAL *); + +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(restartterm) (SCREEN*, NCURSES_CONST char *, int, int *); +#endif /* NCURSES_SP_FUNCS */ + +#ifdef __cplusplus +} +#endif + +#endif /* NCURSES_TERM_H_incl */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/ncurses/term_entry.h b/dingux/opt/mipsel-linux-uclibc/include/ncurses/term_entry.h new file mode 100644 index 0000000..31e525f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ncurses/term_entry.h @@ -0,0 +1,192 @@ +/**************************************************************************** + * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1998-on * + ****************************************************************************/ + +/* $Id: term_entry.h,v 1.45 2014/11/01 14:47:00 tom Exp $ */ + +/* + * term_entry.h -- interface to entry-manipulation code + */ + +#ifndef NCURSES_TERM_ENTRY_H_incl +#define NCURSES_TERM_ENTRY_H_incl 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#include + + /* + * see db_iterator.c - this enumeration lists the places searched for a + * terminal description and defines the order in which they are searched. + */ + typedef enum { + dbdTIC = 0, /* special, used by tic when writing entry */ +#if NCURSES_USE_DATABASE + dbdEnvOnce, /* the $TERMINFO environment variable */ + dbdHome, /* $HOME/.terminfo */ + dbdEnvList, /* the $TERMINFO_DIRS environment variable */ + dbdCfgList, /* the compiled-in TERMINFO_DIRS value */ + dbdCfgOnce, /* the compiled-in TERMINFO value */ +#endif +#if NCURSES_USE_TERMCAP + dbdEnvOnce2, /* the $TERMCAP environment variable */ + dbdEnvList2, /* the $TERMPATH environment variable */ + dbdCfgList2, /* the compiled-in TERMPATH */ +#endif + dbdLAST + } DBDIRS; + +#define MAX_USES 32 +#define MAX_CROSSLINKS 16 + + typedef struct entry { + TERMTYPE tterm; + unsigned nuses; + struct { + char *name; + struct entry *link; + long line; + } uses[MAX_USES]; + int ncrosslinks; + struct entry *crosslinks[MAX_CROSSLINKS]; + long cstart, cend; + long startline; + struct entry *next; + struct entry *last; + } ENTRY; +/* *INDENT-OFF* */ +#if NCURSES_XNAMES +#define NUM_BOOLEANS(tp) (tp)->num_Booleans +#define NUM_NUMBERS(tp) (tp)->num_Numbers +#define NUM_STRINGS(tp) (tp)->num_Strings +#define EXT_NAMES(tp,i,limit,index,table) (i >= limit) ? tp->ext_Names[index] : table[i] +#else +#define NUM_BOOLEANS(tp) BOOLCOUNT +#define NUM_NUMBERS(tp) NUMCOUNT +#define NUM_STRINGS(tp) STRCOUNT +#define EXT_NAMES(tp,i,limit,index,table) table[i] +#endif + +#define NUM_EXT_NAMES(tp) (unsigned) ((tp)->ext_Booleans + (tp)->ext_Numbers + (tp)->ext_Strings) + +#define for_each_boolean(n,tp) for(n = 0; n < NUM_BOOLEANS(tp); n++) +#define for_each_number(n,tp) for(n = 0; n < NUM_NUMBERS(tp); n++) +#define for_each_string(n,tp) for(n = 0; n < NUM_STRINGS(tp); n++) + +#if NCURSES_XNAMES +#define for_each_ext_boolean(n,tp) for(n = BOOLCOUNT; n < NUM_BOOLEANS(tp); n++) +#define for_each_ext_number(n,tp) for(n = NUMCOUNT; n < NUM_NUMBERS(tp); n++) +#define for_each_ext_string(n,tp) for(n = STRCOUNT; n < NUM_STRINGS(tp); n++) +#endif + +#define ExtBoolname(tp,i,names) EXT_NAMES(tp, i, BOOLCOUNT, (i - (tp->num_Booleans - tp->ext_Booleans)), names) +#define ExtNumname(tp,i,names) EXT_NAMES(tp, i, NUMCOUNT, (i - (tp->num_Numbers - tp->ext_Numbers)) + tp->ext_Booleans, names) +#define ExtStrname(tp,i,names) EXT_NAMES(tp, i, STRCOUNT, (i - (tp->num_Strings - tp->ext_Strings)) + (tp->ext_Numbers + tp->ext_Booleans), names) + +extern NCURSES_EXPORT_VAR(ENTRY *) _nc_head; +extern NCURSES_EXPORT_VAR(ENTRY *) _nc_tail; +#define for_entry_list(qp) for (qp = _nc_head; qp; qp = qp->next) + +#define MAX_LINE 132 + +#define NULLHOOK (bool(*)(ENTRY *))0 + +/* + * Note that WANTED and PRESENT are not simple inverses! If a capability + * has been explicitly cancelled, it's not considered WANTED. + */ +#define WANTED(s) ((s) == ABSENT_STRING) +#define PRESENT(s) (((s) != ABSENT_STRING) && ((s) != CANCELLED_STRING)) + +#define ANDMISSING(p,q) \ + {if (PRESENT(p) && !PRESENT(q)) _nc_warning(#p " but no " #q);} + +#define PAIRED(p,q) \ + { \ + if (PRESENT(q) && !PRESENT(p)) \ + _nc_warning(#q " but no " #p); \ + if (PRESENT(p) && !PRESENT(q)) \ + _nc_warning(#p " but no " #q); \ + } + +/* alloc_entry.c: elementary allocation code */ +extern NCURSES_EXPORT(ENTRY *) _nc_copy_entry (ENTRY *oldp); +extern NCURSES_EXPORT(char *) _nc_save_str (const char *const); +extern NCURSES_EXPORT(void) _nc_init_entry (TERMTYPE *const); +extern NCURSES_EXPORT(void) _nc_merge_entry (TERMTYPE *const, TERMTYPE *const); +extern NCURSES_EXPORT(void) _nc_wrap_entry (ENTRY *const, bool); + +/* alloc_ttype.c: elementary allocation code */ +extern NCURSES_EXPORT(void) _nc_align_termtype (TERMTYPE *, TERMTYPE *); +extern NCURSES_EXPORT(void) _nc_copy_termtype (TERMTYPE *, const TERMTYPE *); + +/* free_ttype.c: elementary allocation code */ +extern NCURSES_EXPORT(void) _nc_free_termtype (TERMTYPE *); + +/* lib_acs.c */ +extern NCURSES_EXPORT(void) _nc_init_acs (void); /* corresponds to traditional 'init_acs()' */ + +/* lib_termcap.c: trim sgr0 string for termcap users */ +extern NCURSES_EXPORT(char *) _nc_trim_sgr0 (TERMTYPE *); + +/* parse_entry.c: entry-parsing code */ +#if NCURSES_XNAMES +extern NCURSES_EXPORT_VAR(bool) _nc_user_definable; +extern NCURSES_EXPORT_VAR(bool) _nc_disable_period; +#endif +extern NCURSES_EXPORT(int) _nc_parse_entry (ENTRY *, int, bool); +extern NCURSES_EXPORT(int) _nc_capcmp (const char *, const char *); + +/* write_entry.c: writing an entry to the file system */ +extern NCURSES_EXPORT(void) _nc_set_writedir (const char *); +extern NCURSES_EXPORT(void) _nc_write_entry (TERMTYPE *const); + +/* comp_parse.c: entry list handling */ +extern NCURSES_EXPORT(void) _nc_read_entry_source (FILE*, char*, int, bool, bool (*)(ENTRY*)); +extern NCURSES_EXPORT(bool) _nc_entry_match (char *, char *); +extern NCURSES_EXPORT(int) _nc_resolve_uses (bool); /* obs 20040705 */ +extern NCURSES_EXPORT(int) _nc_resolve_uses2 (bool, bool); +extern NCURSES_EXPORT(void) _nc_free_entries (ENTRY *); +extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype)(TERMTYPE *); /* obs 20040705 */ +extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype2)(TERMTYPE *, bool); + +/* trace_xnames.c */ +extern NCURSES_EXPORT(void) _nc_trace_xnames (TERMTYPE *); +/* *INDENT-ON* */ + +#ifdef __cplusplus +} +#endif +#endif /* NCURSES_TERM_ENTRY_H_incl */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/ncurses/termcap.h b/dingux/opt/mipsel-linux-uclibc/include/ncurses/termcap.h new file mode 100644 index 0000000..e759abc --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ncurses/termcap.h @@ -0,0 +1,75 @@ +/**************************************************************************** + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* $Id: termcap.h.in,v 1.16 2001/03/24 21:53:27 tom Exp $ */ + +#ifndef NCURSES_TERMCAP_H_incl +#define NCURSES_TERMCAP_H_incl 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.0" + +#include + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#include + +#undef NCURSES_CONST +#define NCURSES_CONST const + +#undef NCURSES_OSPEED +#define NCURSES_OSPEED short + +extern NCURSES_EXPORT_VAR(char) PC; +extern NCURSES_EXPORT_VAR(char *) UP; +extern NCURSES_EXPORT_VAR(char *) BC; +extern NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed; + +#if !defined(NCURSES_TERM_H_incl) +extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **); +extern NCURSES_EXPORT(char *) tgoto (const char *, int, int); +extern NCURSES_EXPORT(int) tgetent (char *, const char *); +extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *); +extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int)); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* NCURSES_TERMCAP_H_incl */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/ncurses/tic.h b/dingux/opt/mipsel-linux-uclibc/include/ncurses/tic.h new file mode 100644 index 0000000..89746e5 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ncurses/tic.h @@ -0,0 +1,341 @@ +/**************************************************************************** + * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996 on * + ****************************************************************************/ + +/* + * $Id: tic.h,v 1.69 2012/03/17 18:22:10 tom Exp $ + * tic.h - Global variables and structures for the terminfo + * compiler. + */ + +#ifndef __TIC_H +#define __TIC_H +/* *INDENT-OFF* */ +#ifdef __cplusplus +extern "C" { +#endif + +#include /* for the _tracef() prototype, ERR/OK, bool defs */ + +/* +** The format of compiled terminfo files is as follows: +** +** Header (12 bytes), containing information given below +** Names Section, containing the names of the terminal +** Boolean Section, containing the values of all of the +** boolean capabilities +** A null byte may be inserted here to make +** sure that the Number Section begins on an +** even word boundary. +** Number Section, containing the values of all of the numeric +** capabilities, each as a short integer +** String Section, containing short integer offsets into the +** String Table, one per string capability +** String Table, containing the actual characters of the string +** capabilities. +** +** NOTE that all short integers in the file are stored using VAX/PDP-style +** byte-order, i.e., least-significant byte first. +** +** There is no structure definition here because it would only confuse +** matters. Terminfo format is a raw byte layout, not a structure +** dump. If you happen to be on a little-endian machine with 16-bit +** shorts that requires no padding between short members in a struct, +** then there is a natural C structure that captures the header, but +** not very helpfully. +*/ + +#define MAGIC 0432 /* first two bytes of a compiled entry */ + +#undef BYTE +#define BYTE(p,n) (unsigned char)((p)[n]) + +#define IS_NEG1(p) ((BYTE(p,0) == 0377) && (BYTE(p,1) == 0377)) +#define IS_NEG2(p) ((BYTE(p,0) == 0376) && (BYTE(p,1) == 0377)) +#define LOW_MSB(p) (BYTE(p,0) + 256*BYTE(p,1)) + +#define IS_TIC_MAGIC(p) (LOW_MSB(p) == MAGIC) + +/* + * The "maximum" here is misleading; XSI guarantees minimum values, which a + * given implementation may exceed. + */ +#define MAX_NAME_SIZE 512 /* maximum legal name field size (XSI:127) */ +#define MAX_ENTRY_SIZE 4096 /* maximum legal entry size */ + +/* + * The maximum size of individual name or alias is guaranteed in XSI to be at + * least 14, since that corresponds to the older filename lengths. Newer + * systems allow longer aliases, though not many terminal descriptions are + * written to use them. The MAX_ALIAS symbol is used for warnings. + */ +#if HAVE_LONG_FILE_NAMES +#define MAX_ALIAS 32 /* smaller than POSIX minimum for PATH_MAX */ +#else +#define MAX_ALIAS 14 /* SVr3 filename length */ +#endif + +/* location of user's personal info directory */ +#define PRIVATE_INFO "%s/.terminfo" /* plug getenv("HOME") into %s */ + +/* + * Some traces are designed to be used via tic's verbose option (and similar in + * infocmp and toe) rather than the 'trace()' function. So we use the bits + * above the normal trace() parameter as a debug-level. + */ + +#define MAX_DEBUG_LEVEL 15 +#define DEBUG_LEVEL(n) ((n) << TRACE_SHIFT) + +#define set_trace_level(n) \ + _nc_tracing &= DEBUG_LEVEL(MAX_DEBUG_LEVEL), \ + _nc_tracing |= DEBUG_LEVEL(n) + +#ifdef TRACE +#define DEBUG(n, a) if (_nc_tracing >= DEBUG_LEVEL(n)) _tracef a +#else +#define DEBUG(n, a) /*nothing*/ +#endif + +extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing; +extern NCURSES_EXPORT(void) _nc_tracef (char *, ...) GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *); +extern NCURSES_EXPORT(const char *) _nc_visbuf2 (int, const char *); + +/* + * These are the types of tokens returned by the scanner. The first + * three are also used in the hash table of capability names. The scanner + * returns one of these values after loading the specifics into the global + * structure curr_token. + */ + +#define BOOLEAN 0 /* Boolean capability */ +#define NUMBER 1 /* Numeric capability */ +#define STRING 2 /* String-valued capability */ +#define CANCEL 3 /* Capability to be cancelled in following tc's */ +#define NAMES 4 /* The names for a terminal type */ +#define UNDEF 5 /* Undefined */ + +#define NO_PUSHBACK -1 /* used in pushtype to indicate no pushback */ + + /* + * The global structure in which the specific parts of a + * scanned token are returned. + * + */ + +struct token +{ + char *tk_name; /* name of capability */ + int tk_valnumber; /* value of capability (if a number) */ + char *tk_valstring; /* value of capability (if a string) */ +}; + +extern NCURSES_EXPORT_VAR(struct token) _nc_curr_token; + + /* + * Offsets to string capabilities, with the corresponding functionkey + * codes. + */ +struct tinfo_fkeys { + unsigned offset; + chtype code; + }; + +#if BROKEN_LINKER + +#define _nc_tinfo_fkeys _nc_tinfo_fkeysf() +extern NCURSES_EXPORT(const struct tinfo_fkeys *) _nc_tinfo_fkeysf (void); + +#else + +extern NCURSES_EXPORT_VAR(const struct tinfo_fkeys) _nc_tinfo_fkeys[]; + +#endif + +typedef short HashValue; + + /* + * The file comp_captab.c contains an array of these structures, one + * per possible capability. These are indexed by a hash table array of + * pointers to the same structures for use by the parser. + */ + +struct name_table_entry +{ + const char *nte_name; /* name to hash on */ + int nte_type; /* BOOLEAN, NUMBER or STRING */ + HashValue nte_index; /* index of associated variable in its array */ + HashValue nte_link; /* index in table of next hash, or -1 */ +}; + + /* + * Use this structure to hide differences between terminfo and termcap + * tables. + */ +typedef struct { + unsigned table_size; + const HashValue *table_data; + HashValue (*hash_of)(const char *); + int (*compare_names)(const char *, const char *); +} HashData; + +struct alias +{ + const char *from; + const char *to; + const char *source; +}; + +extern NCURSES_EXPORT(const struct name_table_entry *) _nc_get_table (bool); +extern NCURSES_EXPORT(const HashData *) _nc_get_hash_info (bool); +extern NCURSES_EXPORT(const HashValue *) _nc_get_hash_table (bool); +extern NCURSES_EXPORT(const struct alias *) _nc_get_alias_table (bool); + +#define NOTFOUND ((struct name_table_entry *) 0) + +/* + * The casts are required for correct sign-propagation with systems such as + * AIX, IRIX64, Solaris which default to unsigned characters. The C standard + * leaves this detail unspecified. + */ + +/* out-of-band values for representing absent capabilities */ +#define ABSENT_BOOLEAN ((signed char)-1) /* 255 */ +#define ABSENT_NUMERIC (-1) +#define ABSENT_STRING (char *)0 + +/* out-of-band values for representing cancels */ +#define CANCELLED_BOOLEAN ((signed char)-2) /* 254 */ +#define CANCELLED_NUMERIC (-2) +#define CANCELLED_STRING (char *)(-1) + +#define VALID_BOOLEAN(s) ((unsigned char)(s) <= 1) /* reject "-1" */ +#define VALID_NUMERIC(s) ((s) >= 0) +#define VALID_STRING(s) ((s) != CANCELLED_STRING && (s) != ABSENT_STRING) + +/* termcap entries longer than this may break old binaries */ +#define MAX_TERMCAP_LENGTH 1023 + +/* this is a documented limitation of terminfo */ +#define MAX_TERMINFO_LENGTH 4096 + +#ifndef TERMINFO +#define TERMINFO "/usr/share/terminfo" +#endif + +#ifdef NCURSES_TERM_ENTRY_H_incl + +/* access.c */ +extern NCURSES_EXPORT(unsigned) _nc_pathlast (const char *); +extern NCURSES_EXPORT(bool) _nc_is_abs_path (const char *); +extern NCURSES_EXPORT(bool) _nc_is_dir_path (const char *); +extern NCURSES_EXPORT(bool) _nc_is_file_path (const char *); +extern NCURSES_EXPORT(char *) _nc_basename (char *); +extern NCURSES_EXPORT(char *) _nc_rootname (char *); + +/* comp_hash.c: name lookup */ +extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_entry + (const char *, const HashValue *); +extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_type_entry + (const char *, int, bool); + +/* comp_scan.c: lexical analysis */ +extern NCURSES_EXPORT(int) _nc_get_token (bool); +extern NCURSES_EXPORT(void) _nc_panic_mode (char); +extern NCURSES_EXPORT(void) _nc_push_token (int); +extern NCURSES_EXPORT(void) _nc_reset_input (FILE *, char *); +extern NCURSES_EXPORT_VAR(int) _nc_curr_col; +extern NCURSES_EXPORT_VAR(int) _nc_curr_line; +extern NCURSES_EXPORT_VAR(int) _nc_syntax; +extern NCURSES_EXPORT_VAR(int) _nc_strict_bsd; +extern NCURSES_EXPORT_VAR(long) _nc_comment_end; +extern NCURSES_EXPORT_VAR(long) _nc_comment_start; +extern NCURSES_EXPORT_VAR(long) _nc_curr_file_pos; +extern NCURSES_EXPORT_VAR(long) _nc_start_line; +#define SYN_TERMINFO 0 +#define SYN_TERMCAP 1 + +/* comp_error.c: warning & abort messages */ +extern NCURSES_EXPORT(const char *) _nc_get_source (void); +extern NCURSES_EXPORT(void) _nc_err_abort (const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; +extern NCURSES_EXPORT(void) _nc_get_type (char *name); +extern NCURSES_EXPORT(void) _nc_set_source (const char *const); +extern NCURSES_EXPORT(void) _nc_set_type (const char *const); +extern NCURSES_EXPORT(void) _nc_syserr_abort (const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; +extern NCURSES_EXPORT(void) _nc_warning (const char *const,...) GCC_PRINTFLIKE(1,2); +extern NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings; + +/* comp_expand.c: expand string into readable form */ +extern NCURSES_EXPORT(char *) _nc_tic_expand (const char *, bool, int); + +/* comp_scan.c: decode string from readable form */ +extern NCURSES_EXPORT(int) _nc_trans_string (char *, char *); + +/* captoinfo.c: capability conversion */ +extern NCURSES_EXPORT(char *) _nc_captoinfo (const char *, const char *, int const); +extern NCURSES_EXPORT(char *) _nc_infotocap (const char *, const char *, int const); + +/* home_terminfo.c */ +extern NCURSES_EXPORT(char *) _nc_home_terminfo (void); + +/* lib_tparm.c */ +#define NUM_PARM 9 + +extern NCURSES_EXPORT_VAR(int) _nc_tparm_err; + +extern NCURSES_EXPORT(int) _nc_tparm_analyze(const char *, char **, int *); + +/* lib_tputs.c */ +extern NCURSES_EXPORT_VAR(int) _nc_nulls_sent; /* Add one for every null sent */ + +/* comp_main.c: compiler main */ +extern const char * _nc_progname; + +/* db_iterator.c */ +extern NCURSES_EXPORT(const char *) _nc_next_db(DBDIRS *, int *); +extern NCURSES_EXPORT(const char *) _nc_tic_dir (const char *); +extern NCURSES_EXPORT(void) _nc_first_db(DBDIRS *, int *); +extern NCURSES_EXPORT(void) _nc_last_db(void); + +/* write_entry.c */ +extern NCURSES_EXPORT(int) _nc_tic_written (void); + +#endif /* NCURSES_TERM_ENTRY_H_incl */ + +#ifdef __cplusplus +} +#endif + +/* *INDENT-ON* */ +#endif /* __TIC_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/ncurses/unctrl.h b/dingux/opt/mipsel-linux-uclibc/include/ncurses/unctrl.h new file mode 100644 index 0000000..a50b6c0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ncurses/unctrl.h @@ -0,0 +1,67 @@ +/**************************************************************************** + * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ + +/* + * unctrl.h + * + * Display a printable version of a control character. + * Control characters are displayed in caret notation (^x), DELETE is displayed + * as ^?. Printable characters are displayed as is. + */ + +/* $Id: unctrl.h.in,v 1.11 2009/04/18 21:00:52 tom Exp $ */ + +#ifndef NCURSES_UNCTRL_H_incl +#define NCURSES_UNCTRL_H_incl 1 + +#undef NCURSES_VERSION +#define NCURSES_VERSION "6.0" + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#undef unctrl +NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype); + +#if 1 +NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(unctrl) (SCREEN*, chtype); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* NCURSES_UNCTRL_H_incl */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/Python-ast.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/Python-ast.h new file mode 100644 index 0000000..3f35bbb --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/Python-ast.h @@ -0,0 +1,535 @@ +/* File automatically generated by Parser/asdl_c.py. */ + +#include "asdl.h" + +typedef struct _mod *mod_ty; + +typedef struct _stmt *stmt_ty; + +typedef struct _expr *expr_ty; + +typedef enum _expr_context { Load=1, Store=2, Del=3, AugLoad=4, AugStore=5, + Param=6 } expr_context_ty; + +typedef struct _slice *slice_ty; + +typedef enum _boolop { And=1, Or=2 } boolop_ty; + +typedef enum _operator { Add=1, Sub=2, Mult=3, Div=4, Mod=5, Pow=6, LShift=7, + RShift=8, BitOr=9, BitXor=10, BitAnd=11, FloorDiv=12 } + operator_ty; + +typedef enum _unaryop { Invert=1, Not=2, UAdd=3, USub=4 } unaryop_ty; + +typedef enum _cmpop { Eq=1, NotEq=2, Lt=3, LtE=4, Gt=5, GtE=6, Is=7, IsNot=8, + In=9, NotIn=10 } cmpop_ty; + +typedef struct _comprehension *comprehension_ty; + +typedef struct _excepthandler *excepthandler_ty; + +typedef struct _arguments *arguments_ty; + +typedef struct _keyword *keyword_ty; + +typedef struct _alias *alias_ty; + + +enum _mod_kind {Module_kind=1, Interactive_kind=2, Expression_kind=3, + Suite_kind=4}; +struct _mod { + enum _mod_kind kind; + union { + struct { + asdl_seq *body; + } Module; + + struct { + asdl_seq *body; + } Interactive; + + struct { + expr_ty body; + } Expression; + + struct { + asdl_seq *body; + } Suite; + + } v; +}; + +enum _stmt_kind {FunctionDef_kind=1, ClassDef_kind=2, Return_kind=3, + Delete_kind=4, Assign_kind=5, AugAssign_kind=6, Print_kind=7, + For_kind=8, While_kind=9, If_kind=10, With_kind=11, + Raise_kind=12, TryExcept_kind=13, TryFinally_kind=14, + Assert_kind=15, Import_kind=16, ImportFrom_kind=17, + Exec_kind=18, Global_kind=19, Expr_kind=20, Pass_kind=21, + Break_kind=22, Continue_kind=23}; +struct _stmt { + enum _stmt_kind kind; + union { + struct { + identifier name; + arguments_ty args; + asdl_seq *body; + asdl_seq *decorator_list; + } FunctionDef; + + struct { + identifier name; + asdl_seq *bases; + asdl_seq *body; + asdl_seq *decorator_list; + } ClassDef; + + struct { + expr_ty value; + } Return; + + struct { + asdl_seq *targets; + } Delete; + + struct { + asdl_seq *targets; + expr_ty value; + } Assign; + + struct { + expr_ty target; + operator_ty op; + expr_ty value; + } AugAssign; + + struct { + expr_ty dest; + asdl_seq *values; + bool nl; + } Print; + + struct { + expr_ty target; + expr_ty iter; + asdl_seq *body; + asdl_seq *orelse; + } For; + + struct { + expr_ty test; + asdl_seq *body; + asdl_seq *orelse; + } While; + + struct { + expr_ty test; + asdl_seq *body; + asdl_seq *orelse; + } If; + + struct { + expr_ty context_expr; + expr_ty optional_vars; + asdl_seq *body; + } With; + + struct { + expr_ty type; + expr_ty inst; + expr_ty tback; + } Raise; + + struct { + asdl_seq *body; + asdl_seq *handlers; + asdl_seq *orelse; + } TryExcept; + + struct { + asdl_seq *body; + asdl_seq *finalbody; + } TryFinally; + + struct { + expr_ty test; + expr_ty msg; + } Assert; + + struct { + asdl_seq *names; + } Import; + + struct { + identifier module; + asdl_seq *names; + int level; + } ImportFrom; + + struct { + expr_ty body; + expr_ty globals; + expr_ty locals; + } Exec; + + struct { + asdl_seq *names; + } Global; + + struct { + expr_ty value; + } Expr; + + } v; + int lineno; + int col_offset; +}; + +enum _expr_kind {BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4, + IfExp_kind=5, Dict_kind=6, Set_kind=7, ListComp_kind=8, + SetComp_kind=9, DictComp_kind=10, GeneratorExp_kind=11, + Yield_kind=12, Compare_kind=13, Call_kind=14, Repr_kind=15, + Num_kind=16, Str_kind=17, Attribute_kind=18, + Subscript_kind=19, Name_kind=20, List_kind=21, Tuple_kind=22}; +struct _expr { + enum _expr_kind kind; + union { + struct { + boolop_ty op; + asdl_seq *values; + } BoolOp; + + struct { + expr_ty left; + operator_ty op; + expr_ty right; + } BinOp; + + struct { + unaryop_ty op; + expr_ty operand; + } UnaryOp; + + struct { + arguments_ty args; + expr_ty body; + } Lambda; + + struct { + expr_ty test; + expr_ty body; + expr_ty orelse; + } IfExp; + + struct { + asdl_seq *keys; + asdl_seq *values; + } Dict; + + struct { + asdl_seq *elts; + } Set; + + struct { + expr_ty elt; + asdl_seq *generators; + } ListComp; + + struct { + expr_ty elt; + asdl_seq *generators; + } SetComp; + + struct { + expr_ty key; + expr_ty value; + asdl_seq *generators; + } DictComp; + + struct { + expr_ty elt; + asdl_seq *generators; + } GeneratorExp; + + struct { + expr_ty value; + } Yield; + + struct { + expr_ty left; + asdl_int_seq *ops; + asdl_seq *comparators; + } Compare; + + struct { + expr_ty func; + asdl_seq *args; + asdl_seq *keywords; + expr_ty starargs; + expr_ty kwargs; + } Call; + + struct { + expr_ty value; + } Repr; + + struct { + object n; + } Num; + + struct { + string s; + } Str; + + struct { + expr_ty value; + identifier attr; + expr_context_ty ctx; + } Attribute; + + struct { + expr_ty value; + slice_ty slice; + expr_context_ty ctx; + } Subscript; + + struct { + identifier id; + expr_context_ty ctx; + } Name; + + struct { + asdl_seq *elts; + expr_context_ty ctx; + } List; + + struct { + asdl_seq *elts; + expr_context_ty ctx; + } Tuple; + + } v; + int lineno; + int col_offset; +}; + +enum _slice_kind {Ellipsis_kind=1, Slice_kind=2, ExtSlice_kind=3, Index_kind=4}; +struct _slice { + enum _slice_kind kind; + union { + struct { + expr_ty lower; + expr_ty upper; + expr_ty step; + } Slice; + + struct { + asdl_seq *dims; + } ExtSlice; + + struct { + expr_ty value; + } Index; + + } v; +}; + +struct _comprehension { + expr_ty target; + expr_ty iter; + asdl_seq *ifs; +}; + +enum _excepthandler_kind {ExceptHandler_kind=1}; +struct _excepthandler { + enum _excepthandler_kind kind; + union { + struct { + expr_ty type; + expr_ty name; + asdl_seq *body; + } ExceptHandler; + + } v; + int lineno; + int col_offset; +}; + +struct _arguments { + asdl_seq *args; + identifier vararg; + identifier kwarg; + asdl_seq *defaults; +}; + +struct _keyword { + identifier arg; + expr_ty value; +}; + +struct _alias { + identifier name; + identifier asname; +}; + + +#define Module(a0, a1) _Py_Module(a0, a1) +mod_ty _Py_Module(asdl_seq * body, PyArena *arena); +#define Interactive(a0, a1) _Py_Interactive(a0, a1) +mod_ty _Py_Interactive(asdl_seq * body, PyArena *arena); +#define Expression(a0, a1) _Py_Expression(a0, a1) +mod_ty _Py_Expression(expr_ty body, PyArena *arena); +#define Suite(a0, a1) _Py_Suite(a0, a1) +mod_ty _Py_Suite(asdl_seq * body, PyArena *arena); +#define FunctionDef(a0, a1, a2, a3, a4, a5, a6) _Py_FunctionDef(a0, a1, a2, a3, a4, a5, a6) +stmt_ty _Py_FunctionDef(identifier name, arguments_ty args, asdl_seq * body, + asdl_seq * decorator_list, int lineno, int col_offset, + PyArena *arena); +#define ClassDef(a0, a1, a2, a3, a4, a5, a6) _Py_ClassDef(a0, a1, a2, a3, a4, a5, a6) +stmt_ty _Py_ClassDef(identifier name, asdl_seq * bases, asdl_seq * body, + asdl_seq * decorator_list, int lineno, int col_offset, + PyArena *arena); +#define Return(a0, a1, a2, a3) _Py_Return(a0, a1, a2, a3) +stmt_ty _Py_Return(expr_ty value, int lineno, int col_offset, PyArena *arena); +#define Delete(a0, a1, a2, a3) _Py_Delete(a0, a1, a2, a3) +stmt_ty _Py_Delete(asdl_seq * targets, int lineno, int col_offset, PyArena + *arena); +#define Assign(a0, a1, a2, a3, a4) _Py_Assign(a0, a1, a2, a3, a4) +stmt_ty _Py_Assign(asdl_seq * targets, expr_ty value, int lineno, int + col_offset, PyArena *arena); +#define AugAssign(a0, a1, a2, a3, a4, a5) _Py_AugAssign(a0, a1, a2, a3, a4, a5) +stmt_ty _Py_AugAssign(expr_ty target, operator_ty op, expr_ty value, int + lineno, int col_offset, PyArena *arena); +#define Print(a0, a1, a2, a3, a4, a5) _Py_Print(a0, a1, a2, a3, a4, a5) +stmt_ty _Py_Print(expr_ty dest, asdl_seq * values, bool nl, int lineno, int + col_offset, PyArena *arena); +#define For(a0, a1, a2, a3, a4, a5, a6) _Py_For(a0, a1, a2, a3, a4, a5, a6) +stmt_ty _Py_For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * + orelse, int lineno, int col_offset, PyArena *arena); +#define While(a0, a1, a2, a3, a4, a5) _Py_While(a0, a1, a2, a3, a4, a5) +stmt_ty _Py_While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, + int col_offset, PyArena *arena); +#define If(a0, a1, a2, a3, a4, a5) _Py_If(a0, a1, a2, a3, a4, a5) +stmt_ty _Py_If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, + int col_offset, PyArena *arena); +#define With(a0, a1, a2, a3, a4, a5) _Py_With(a0, a1, a2, a3, a4, a5) +stmt_ty _Py_With(expr_ty context_expr, expr_ty optional_vars, asdl_seq * body, + int lineno, int col_offset, PyArena *arena); +#define Raise(a0, a1, a2, a3, a4, a5) _Py_Raise(a0, a1, a2, a3, a4, a5) +stmt_ty _Py_Raise(expr_ty type, expr_ty inst, expr_ty tback, int lineno, int + col_offset, PyArena *arena); +#define TryExcept(a0, a1, a2, a3, a4, a5) _Py_TryExcept(a0, a1, a2, a3, a4, a5) +stmt_ty _Py_TryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, + int lineno, int col_offset, PyArena *arena); +#define TryFinally(a0, a1, a2, a3, a4) _Py_TryFinally(a0, a1, a2, a3, a4) +stmt_ty _Py_TryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno, int + col_offset, PyArena *arena); +#define Assert(a0, a1, a2, a3, a4) _Py_Assert(a0, a1, a2, a3, a4) +stmt_ty _Py_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, + PyArena *arena); +#define Import(a0, a1, a2, a3) _Py_Import(a0, a1, a2, a3) +stmt_ty _Py_Import(asdl_seq * names, int lineno, int col_offset, PyArena + *arena); +#define ImportFrom(a0, a1, a2, a3, a4, a5) _Py_ImportFrom(a0, a1, a2, a3, a4, a5) +stmt_ty _Py_ImportFrom(identifier module, asdl_seq * names, int level, int + lineno, int col_offset, PyArena *arena); +#define Exec(a0, a1, a2, a3, a4, a5) _Py_Exec(a0, a1, a2, a3, a4, a5) +stmt_ty _Py_Exec(expr_ty body, expr_ty globals, expr_ty locals, int lineno, int + col_offset, PyArena *arena); +#define Global(a0, a1, a2, a3) _Py_Global(a0, a1, a2, a3) +stmt_ty _Py_Global(asdl_seq * names, int lineno, int col_offset, PyArena + *arena); +#define Expr(a0, a1, a2, a3) _Py_Expr(a0, a1, a2, a3) +stmt_ty _Py_Expr(expr_ty value, int lineno, int col_offset, PyArena *arena); +#define Pass(a0, a1, a2) _Py_Pass(a0, a1, a2) +stmt_ty _Py_Pass(int lineno, int col_offset, PyArena *arena); +#define Break(a0, a1, a2) _Py_Break(a0, a1, a2) +stmt_ty _Py_Break(int lineno, int col_offset, PyArena *arena); +#define Continue(a0, a1, a2) _Py_Continue(a0, a1, a2) +stmt_ty _Py_Continue(int lineno, int col_offset, PyArena *arena); +#define BoolOp(a0, a1, a2, a3, a4) _Py_BoolOp(a0, a1, a2, a3, a4) +expr_ty _Py_BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset, + PyArena *arena); +#define BinOp(a0, a1, a2, a3, a4, a5) _Py_BinOp(a0, a1, a2, a3, a4, a5) +expr_ty _Py_BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int + col_offset, PyArena *arena); +#define UnaryOp(a0, a1, a2, a3, a4) _Py_UnaryOp(a0, a1, a2, a3, a4) +expr_ty _Py_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, + PyArena *arena); +#define Lambda(a0, a1, a2, a3, a4) _Py_Lambda(a0, a1, a2, a3, a4) +expr_ty _Py_Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset, + PyArena *arena); +#define IfExp(a0, a1, a2, a3, a4, a5) _Py_IfExp(a0, a1, a2, a3, a4, a5) +expr_ty _Py_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int + col_offset, PyArena *arena); +#define Dict(a0, a1, a2, a3, a4) _Py_Dict(a0, a1, a2, a3, a4) +expr_ty _Py_Dict(asdl_seq * keys, asdl_seq * values, int lineno, int + col_offset, PyArena *arena); +#define Set(a0, a1, a2, a3) _Py_Set(a0, a1, a2, a3) +expr_ty _Py_Set(asdl_seq * elts, int lineno, int col_offset, PyArena *arena); +#define ListComp(a0, a1, a2, a3, a4) _Py_ListComp(a0, a1, a2, a3, a4) +expr_ty _Py_ListComp(expr_ty elt, asdl_seq * generators, int lineno, int + col_offset, PyArena *arena); +#define SetComp(a0, a1, a2, a3, a4) _Py_SetComp(a0, a1, a2, a3, a4) +expr_ty _Py_SetComp(expr_ty elt, asdl_seq * generators, int lineno, int + col_offset, PyArena *arena); +#define DictComp(a0, a1, a2, a3, a4, a5) _Py_DictComp(a0, a1, a2, a3, a4, a5) +expr_ty _Py_DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int + lineno, int col_offset, PyArena *arena); +#define GeneratorExp(a0, a1, a2, a3, a4) _Py_GeneratorExp(a0, a1, a2, a3, a4) +expr_ty _Py_GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int + col_offset, PyArena *arena); +#define Yield(a0, a1, a2, a3) _Py_Yield(a0, a1, a2, a3) +expr_ty _Py_Yield(expr_ty value, int lineno, int col_offset, PyArena *arena); +#define Compare(a0, a1, a2, a3, a4, a5) _Py_Compare(a0, a1, a2, a3, a4, a5) +expr_ty _Py_Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators, + int lineno, int col_offset, PyArena *arena); +#define Call(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Call(a0, a1, a2, a3, a4, a5, a6, a7) +expr_ty _Py_Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty + starargs, expr_ty kwargs, int lineno, int col_offset, PyArena + *arena); +#define Repr(a0, a1, a2, a3) _Py_Repr(a0, a1, a2, a3) +expr_ty _Py_Repr(expr_ty value, int lineno, int col_offset, PyArena *arena); +#define Num(a0, a1, a2, a3) _Py_Num(a0, a1, a2, a3) +expr_ty _Py_Num(object n, int lineno, int col_offset, PyArena *arena); +#define Str(a0, a1, a2, a3) _Py_Str(a0, a1, a2, a3) +expr_ty _Py_Str(string s, int lineno, int col_offset, PyArena *arena); +#define Attribute(a0, a1, a2, a3, a4, a5) _Py_Attribute(a0, a1, a2, a3, a4, a5) +expr_ty _Py_Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int + lineno, int col_offset, PyArena *arena); +#define Subscript(a0, a1, a2, a3, a4, a5) _Py_Subscript(a0, a1, a2, a3, a4, a5) +expr_ty _Py_Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int + lineno, int col_offset, PyArena *arena); +#define Name(a0, a1, a2, a3, a4) _Py_Name(a0, a1, a2, a3, a4) +expr_ty _Py_Name(identifier id, expr_context_ty ctx, int lineno, int + col_offset, PyArena *arena); +#define List(a0, a1, a2, a3, a4) _Py_List(a0, a1, a2, a3, a4) +expr_ty _Py_List(asdl_seq * elts, expr_context_ty ctx, int lineno, int + col_offset, PyArena *arena); +#define Tuple(a0, a1, a2, a3, a4) _Py_Tuple(a0, a1, a2, a3, a4) +expr_ty _Py_Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int + col_offset, PyArena *arena); +#define Ellipsis(a0) _Py_Ellipsis(a0) +slice_ty _Py_Ellipsis(PyArena *arena); +#define Slice(a0, a1, a2, a3) _Py_Slice(a0, a1, a2, a3) +slice_ty _Py_Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena); +#define ExtSlice(a0, a1) _Py_ExtSlice(a0, a1) +slice_ty _Py_ExtSlice(asdl_seq * dims, PyArena *arena); +#define Index(a0, a1) _Py_Index(a0, a1) +slice_ty _Py_Index(expr_ty value, PyArena *arena); +#define comprehension(a0, a1, a2, a3) _Py_comprehension(a0, a1, a2, a3) +comprehension_ty _Py_comprehension(expr_ty target, expr_ty iter, asdl_seq * + ifs, PyArena *arena); +#define ExceptHandler(a0, a1, a2, a3, a4, a5) _Py_ExceptHandler(a0, a1, a2, a3, a4, a5) +excepthandler_ty _Py_ExceptHandler(expr_ty type, expr_ty name, asdl_seq * body, + int lineno, int col_offset, PyArena *arena); +#define arguments(a0, a1, a2, a3, a4) _Py_arguments(a0, a1, a2, a3, a4) +arguments_ty _Py_arguments(asdl_seq * args, identifier vararg, identifier + kwarg, asdl_seq * defaults, PyArena *arena); +#define keyword(a0, a1, a2) _Py_keyword(a0, a1, a2) +keyword_ty _Py_keyword(identifier arg, expr_ty value, PyArena *arena); +#define alias(a0, a1, a2) _Py_alias(a0, a1, a2) +alias_ty _Py_alias(identifier name, identifier asname, PyArena *arena); + +PyObject* PyAST_mod2obj(mod_ty t); +mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode); +int PyAST_Check(PyObject* obj); diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/Python.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/Python.h new file mode 100644 index 0000000..a9327b0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/Python.h @@ -0,0 +1,181 @@ +#ifndef Py_PYTHON_H +#define Py_PYTHON_H +/* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */ + +/* Include nearly all Python header files */ + +#include "patchlevel.h" +#include "pyconfig.h" +#include "pymacconfig.h" + +/* Cyclic gc is always enabled, starting with release 2.3a1. Supply the + * old symbol for the benefit of extension modules written before then + * that may be conditionalizing on it. The core doesn't use it anymore. + */ +#ifndef WITH_CYCLE_GC +#define WITH_CYCLE_GC 1 +#endif + +#include + +#ifndef UCHAR_MAX +#error "Something's broken. UCHAR_MAX should be defined in limits.h." +#endif + +#if UCHAR_MAX != 255 +#error "Python's source code assumes C's unsigned char is an 8-bit type." +#endif + +#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE) +#define _SGI_MP_SOURCE +#endif + +#include +#ifndef NULL +# error "Python.h requires that stdio.h define NULL." +#endif + +#include +#ifdef HAVE_ERRNO_H +#include +#endif +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_CRYPT_H +#include +#endif + +/* For size_t? */ +#ifdef HAVE_STDDEF_H +#include +#endif + +/* CAUTION: Build setups should ensure that NDEBUG is defined on the + * compiler command line when building Python in release mode; else + * assert() calls won't be removed. + */ +#include + +#include "pyport.h" + +/* pyconfig.h or pyport.h may or may not define DL_IMPORT */ +#ifndef DL_IMPORT /* declarations for DLL import/export */ +#define DL_IMPORT(RTYPE) RTYPE +#endif +#ifndef DL_EXPORT /* declarations for DLL import/export */ +#define DL_EXPORT(RTYPE) RTYPE +#endif + +/* Debug-mode build with pymalloc implies PYMALLOC_DEBUG. + * PYMALLOC_DEBUG is in error if pymalloc is not in use. + */ +#if defined(Py_DEBUG) && defined(WITH_PYMALLOC) && !defined(PYMALLOC_DEBUG) +#define PYMALLOC_DEBUG +#endif +#if defined(PYMALLOC_DEBUG) && !defined(WITH_PYMALLOC) +#error "PYMALLOC_DEBUG requires WITH_PYMALLOC" +#endif +#include "pymath.h" +#include "pymem.h" + +#include "object.h" +#include "objimpl.h" + +#include "pydebug.h" + +#include "unicodeobject.h" +#include "intobject.h" +#include "boolobject.h" +#include "longobject.h" +#include "floatobject.h" +#ifndef WITHOUT_COMPLEX +#include "complexobject.h" +#endif +#include "rangeobject.h" +#include "stringobject.h" +#include "memoryobject.h" +#include "bufferobject.h" +#include "bytesobject.h" +#include "bytearrayobject.h" +#include "tupleobject.h" +#include "listobject.h" +#include "dictobject.h" +#include "enumobject.h" +#include "setobject.h" +#include "methodobject.h" +#include "moduleobject.h" +#include "funcobject.h" +#include "classobject.h" +#include "fileobject.h" +#include "cobject.h" +#include "pycapsule.h" +#include "traceback.h" +#include "sliceobject.h" +#include "cellobject.h" +#include "iterobject.h" +#include "genobject.h" +#include "descrobject.h" +#include "warnings.h" +#include "weakrefobject.h" + +#include "codecs.h" +#include "pyerrors.h" + +#include "pystate.h" + +#include "pyarena.h" +#include "modsupport.h" +#include "pythonrun.h" +#include "ceval.h" +#include "sysmodule.h" +#include "intrcheck.h" +#include "import.h" + +#include "abstract.h" + +#include "compile.h" +#include "eval.h" + +#include "pyctype.h" +#include "pystrtod.h" +#include "pystrcmp.h" +#include "dtoa.h" + +/* _Py_Mangle is defined in compile.c */ +PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name); + +/* PyArg_GetInt is deprecated and should not be used, use PyArg_Parse(). */ +#define PyArg_GetInt(v, a) PyArg_Parse((v), "i", (a)) + +/* PyArg_NoArgs should not be necessary. + Set ml_flags in the PyMethodDef to METH_NOARGS. */ +#define PyArg_NoArgs(v) PyArg_Parse(v, "") + +/* Argument must be a char or an int in [-128, 127] or [0, 255]. */ +#define Py_CHARMASK(c) ((unsigned char)((c) & 0xff)) + +#include "pyfpe.h" + +/* These definitions must match corresponding definitions in graminit.h. + There's code in compile.c that checks that they are the same. */ +#define Py_single_input 256 +#define Py_file_input 257 +#define Py_eval_input 258 + +#ifdef HAVE_PTH +/* GNU pth user-space thread support */ +#include +#endif + +/* Define macros for inline documentation. */ +#define PyDoc_VAR(name) static char name[] +#define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str) +#ifdef WITH_DOC_STRINGS +#define PyDoc_STR(str) str +#else +#define PyDoc_STR(str) "" +#endif + +#endif /* !Py_PYTHON_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/abstract.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/abstract.h new file mode 100644 index 0000000..66b5fc5 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/abstract.h @@ -0,0 +1,1396 @@ +#ifndef Py_ABSTRACTOBJECT_H +#define Py_ABSTRACTOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef PY_SSIZE_T_CLEAN +#define PyObject_CallFunction _PyObject_CallFunction_SizeT +#define PyObject_CallMethod _PyObject_CallMethod_SizeT +#endif + +/* Abstract Object Interface (many thanks to Jim Fulton) */ + +/* + PROPOSAL: A Generic Python Object Interface for Python C Modules + +Problem + + Python modules written in C that must access Python objects must do + so through routines whose interfaces are described by a set of + include files. Unfortunately, these routines vary according to the + object accessed. To use these routines, the C programmer must check + the type of the object being used and must call a routine based on + the object type. For example, to access an element of a sequence, + the programmer must determine whether the sequence is a list or a + tuple: + + if(is_tupleobject(o)) + e=gettupleitem(o,i) + else if(is_listitem(o)) + e=getlistitem(o,i) + + If the programmer wants to get an item from another type of object + that provides sequence behavior, there is no clear way to do it + correctly. + + The persistent programmer may peruse object.h and find that the + _typeobject structure provides a means of invoking up to (currently + about) 41 special operators. So, for example, a routine can get an + item from any object that provides sequence behavior. However, to + use this mechanism, the programmer must make their code dependent on + the current Python implementation. + + Also, certain semantics, especially memory management semantics, may + differ by the type of object being used. Unfortunately, these + semantics are not clearly described in the current include files. + An abstract interface providing more consistent semantics is needed. + +Proposal + + I propose the creation of a standard interface (with an associated + library of routines and/or macros) for generically obtaining the + services of Python objects. This proposal can be viewed as one + components of a Python C interface consisting of several components. + + From the viewpoint of C access to Python services, we have (as + suggested by Guido in off-line discussions): + + - "Very high level layer": two or three functions that let you exec or + eval arbitrary Python code given as a string in a module whose name is + given, passing C values in and getting C values out using + mkvalue/getargs style format strings. This does not require the user + to declare any variables of type "PyObject *". This should be enough + to write a simple application that gets Python code from the user, + execs it, and returns the output or errors. (Error handling must also + be part of this API.) + + - "Abstract objects layer": which is the subject of this proposal. + It has many functions operating on objects, and lest you do many + things from C that you can also write in Python, without going + through the Python parser. + + - "Concrete objects layer": This is the public type-dependent + interface provided by the standard built-in types, such as floats, + strings, and lists. This interface exists and is currently + documented by the collection of include files provided with the + Python distributions. + + From the point of view of Python accessing services provided by C + modules: + + - "Python module interface": this interface consist of the basic + routines used to define modules and their members. Most of the + current extensions-writing guide deals with this interface. + + - "Built-in object interface": this is the interface that a new + built-in type must provide and the mechanisms and rules that a + developer of a new built-in type must use and follow. + + This proposal is a "first-cut" that is intended to spur + discussion. See especially the lists of notes. + + The Python C object interface will provide four protocols: object, + numeric, sequence, and mapping. Each protocol consists of a + collection of related operations. If an operation that is not + provided by a particular type is invoked, then a standard exception, + NotImplementedError is raised with an operation name as an argument. + In addition, for convenience this interface defines a set of + constructors for building objects of built-in types. This is needed + so new objects can be returned from C functions that otherwise treat + objects generically. + +Memory Management + + For all of the functions described in this proposal, if a function + retains a reference to a Python object passed as an argument, then the + function will increase the reference count of the object. It is + unnecessary for the caller to increase the reference count of an + argument in anticipation of the object's retention. + + All Python objects returned from functions should be treated as new + objects. Functions that return objects assume that the caller will + retain a reference and the reference count of the object has already + been incremented to account for this fact. A caller that does not + retain a reference to an object that is returned from a function + must decrement the reference count of the object (using + DECREF(object)) to prevent memory leaks. + + Note that the behavior mentioned here is different from the current + behavior for some objects (e.g. lists and tuples) when certain + type-specific routines are called directly (e.g. setlistitem). The + proposed abstraction layer will provide a consistent memory + management interface, correcting for inconsistent behavior for some + built-in types. + +Protocols + +xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ + +/* Object Protocol: */ + + /* Implemented elsewhere: + + int PyObject_Print(PyObject *o, FILE *fp, int flags); + + Print an object, o, on file, fp. Returns -1 on + error. The flags argument is used to enable certain printing + options. The only option currently supported is Py_Print_RAW. + + (What should be said about Py_Print_RAW?) + + */ + + /* Implemented elsewhere: + + int PyObject_HasAttrString(PyObject *o, char *attr_name); + + Returns 1 if o has the attribute attr_name, and 0 otherwise. + This is equivalent to the Python expression: + hasattr(o,attr_name). + + This function always succeeds. + + */ + + /* Implemented elsewhere: + + PyObject* PyObject_GetAttrString(PyObject *o, char *attr_name); + + Retrieve an attributed named attr_name form object o. + Returns the attribute value on success, or NULL on failure. + This is the equivalent of the Python expression: o.attr_name. + + */ + + /* Implemented elsewhere: + + int PyObject_HasAttr(PyObject *o, PyObject *attr_name); + + Returns 1 if o has the attribute attr_name, and 0 otherwise. + This is equivalent to the Python expression: + hasattr(o,attr_name). + + This function always succeeds. + + */ + + /* Implemented elsewhere: + + PyObject* PyObject_GetAttr(PyObject *o, PyObject *attr_name); + + Retrieve an attributed named attr_name form object o. + Returns the attribute value on success, or NULL on failure. + This is the equivalent of the Python expression: o.attr_name. + + */ + + + /* Implemented elsewhere: + + int PyObject_SetAttrString(PyObject *o, char *attr_name, PyObject *v); + + Set the value of the attribute named attr_name, for object o, + to the value v. Raise an exception and return -1 on failure; return 0 on + success. This is the equivalent of the Python statement o.attr_name=v. + + */ + + /* Implemented elsewhere: + + int PyObject_SetAttr(PyObject *o, PyObject *attr_name, PyObject *v); + + Set the value of the attribute named attr_name, for object o, + to the value v. Raise an exception and return -1 on failure; return 0 on + success. This is the equivalent of the Python statement o.attr_name=v. + + */ + + /* implemented as a macro: + + int PyObject_DelAttrString(PyObject *o, char *attr_name); + + Delete attribute named attr_name, for object o. Returns + -1 on failure. This is the equivalent of the Python + statement: del o.attr_name. + + */ +#define PyObject_DelAttrString(O,A) PyObject_SetAttrString((O),(A),NULL) + + /* implemented as a macro: + + int PyObject_DelAttr(PyObject *o, PyObject *attr_name); + + Delete attribute named attr_name, for object o. Returns -1 + on failure. This is the equivalent of the Python + statement: del o.attr_name. + + */ +#define PyObject_DelAttr(O,A) PyObject_SetAttr((O),(A),NULL) + + PyAPI_FUNC(int) PyObject_Cmp(PyObject *o1, PyObject *o2, int *result); + + /* + Compare the values of o1 and o2 using a routine provided by + o1, if one exists, otherwise with a routine provided by o2. + The result of the comparison is returned in result. Returns + -1 on failure. This is the equivalent of the Python + statement: result=cmp(o1,o2). + + */ + + /* Implemented elsewhere: + + int PyObject_Compare(PyObject *o1, PyObject *o2); + + Compare the values of o1 and o2 using a routine provided by + o1, if one exists, otherwise with a routine provided by o2. + Returns the result of the comparison on success. On error, + the value returned is undefined. This is equivalent to the + Python expression: cmp(o1,o2). + + */ + + /* Implemented elsewhere: + + PyObject *PyObject_Repr(PyObject *o); + + Compute the string representation of object, o. Returns the + string representation on success, NULL on failure. This is + the equivalent of the Python expression: repr(o). + + Called by the repr() built-in function and by reverse quotes. + + */ + + /* Implemented elsewhere: + + PyObject *PyObject_Str(PyObject *o); + + Compute the string representation of object, o. Returns the + string representation on success, NULL on failure. This is + the equivalent of the Python expression: str(o).) + + Called by the str() built-in function and by the print + statement. + + */ + + /* Implemented elsewhere: + + PyObject *PyObject_Unicode(PyObject *o); + + Compute the unicode representation of object, o. Returns the + unicode representation on success, NULL on failure. This is + the equivalent of the Python expression: unistr(o).) + + Called by the unistr() built-in function. + + */ + + /* Declared elsewhere + + PyAPI_FUNC(int) PyCallable_Check(PyObject *o); + + Determine if the object, o, is callable. Return 1 if the + object is callable and 0 otherwise. + + This function always succeeds. + + */ + + + + PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable_object, + PyObject *args, PyObject *kw); + + /* + Call a callable Python object, callable_object, with + arguments and keywords arguments. The 'args' argument can not be + NULL, but the 'kw' argument can be NULL. + + */ + + PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable_object, + PyObject *args); + + /* + Call a callable Python object, callable_object, with + arguments given by the tuple, args. If no arguments are + needed, then args may be NULL. Returns the result of the + call on success, or NULL on failure. This is the equivalent + of the Python expression: apply(o,args). + + */ + + PyAPI_FUNC(PyObject *) PyObject_CallFunction(PyObject *callable_object, + char *format, ...); + + /* + Call a callable Python object, callable_object, with a + variable number of C arguments. The C arguments are described + using a mkvalue-style format string. The format may be NULL, + indicating that no arguments are provided. Returns the + result of the call on success, or NULL on failure. This is + the equivalent of the Python expression: apply(o,args). + + */ + + + PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *o, char *m, + char *format, ...); + + /* + Call the method named m of object o with a variable number of + C arguments. The C arguments are described by a mkvalue + format string. The format may be NULL, indicating that no + arguments are provided. Returns the result of the call on + success, or NULL on failure. This is the equivalent of the + Python expression: o.method(args). + */ + + PyAPI_FUNC(PyObject *) _PyObject_CallFunction_SizeT(PyObject *callable, + char *format, ...); + PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *o, + char *name, + char *format, ...); + + PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable, + ...); + + /* + Call a callable Python object, callable_object, with a + variable number of C arguments. The C arguments are provided + as PyObject * values, terminated by a NULL. Returns the + result of the call on success, or NULL on failure. This is + the equivalent of the Python expression: apply(o,args). + */ + + + PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs(PyObject *o, + PyObject *m, ...); + + /* + Call the method named m of object o with a variable number of + C arguments. The C arguments are provided as PyObject * + values, terminated by NULL. Returns the result of the call + on success, or NULL on failure. This is the equivalent of + the Python expression: o.method(args). + */ + + + /* Implemented elsewhere: + + long PyObject_Hash(PyObject *o); + + Compute and return the hash, hash_value, of an object, o. On + failure, return -1. This is the equivalent of the Python + expression: hash(o). + + */ + + + /* Implemented elsewhere: + + int PyObject_IsTrue(PyObject *o); + + Returns 1 if the object, o, is considered to be true, 0 if o is + considered to be false and -1 on failure. This is equivalent to the + Python expression: not not o + + */ + + /* Implemented elsewhere: + + int PyObject_Not(PyObject *o); + + Returns 0 if the object, o, is considered to be true, 1 if o is + considered to be false and -1 on failure. This is equivalent to the + Python expression: not o + + */ + + PyAPI_FUNC(PyObject *) PyObject_Type(PyObject *o); + + /* + On success, returns a type object corresponding to the object + type of object o. On failure, returns NULL. This is + equivalent to the Python expression: type(o). + */ + + PyAPI_FUNC(Py_ssize_t) PyObject_Size(PyObject *o); + + /* + Return the size of object o. If the object, o, provides + both sequence and mapping protocols, the sequence size is + returned. On error, -1 is returned. This is the equivalent + to the Python expression: len(o). + + */ + + /* For DLL compatibility */ +#undef PyObject_Length + PyAPI_FUNC(Py_ssize_t) PyObject_Length(PyObject *o); +#define PyObject_Length PyObject_Size + + PyAPI_FUNC(Py_ssize_t) _PyObject_LengthHint(PyObject *o, Py_ssize_t); + + /* + Guess the size of object o using len(o) or o.__length_hint__(). + If neither of those return a non-negative value, then return the + default value. If one of the calls fails, this function returns -1. + */ + + PyAPI_FUNC(PyObject *) PyObject_GetItem(PyObject *o, PyObject *key); + + /* + Return element of o corresponding to the object, key, or NULL + on failure. This is the equivalent of the Python expression: + o[key]. + + */ + + PyAPI_FUNC(int) PyObject_SetItem(PyObject *o, PyObject *key, PyObject *v); + + /* + Map the object key to the value v. Raise an exception and return -1 + on failure; return 0 on success. This is the equivalent of the Python + statement o[key]=v. + */ + + PyAPI_FUNC(int) PyObject_DelItemString(PyObject *o, char *key); + + /* + Remove the mapping for object, key, from the object *o. + Returns -1 on failure. This is equivalent to + the Python statement: del o[key]. + */ + + PyAPI_FUNC(int) PyObject_DelItem(PyObject *o, PyObject *key); + + /* + Delete the mapping for key from *o. Returns -1 on failure. + This is the equivalent of the Python statement: del o[key]. + */ + + PyAPI_FUNC(int) PyObject_AsCharBuffer(PyObject *obj, + const char **buffer, + Py_ssize_t *buffer_len); + + /* + Takes an arbitrary object which must support the (character, + single segment) buffer interface and returns a pointer to a + read-only memory location useable as character based input + for subsequent processing. + + 0 is returned on success. buffer and buffer_len are only + set in case no error occurs. Otherwise, -1 is returned and + an exception set. + + */ + + PyAPI_FUNC(int) PyObject_CheckReadBuffer(PyObject *obj); + + /* + Checks whether an arbitrary object supports the (character, + single segment) buffer interface. Returns 1 on success, 0 + on failure. + + */ + + PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj, + const void **buffer, + Py_ssize_t *buffer_len); + + /* + Same as PyObject_AsCharBuffer() except that this API expects + (readable, single segment) buffer interface and returns a + pointer to a read-only memory location which can contain + arbitrary data. + + 0 is returned on success. buffer and buffer_len are only + set in case no error occurs. Otherwise, -1 is returned and + an exception set. + + */ + + PyAPI_FUNC(int) PyObject_AsWriteBuffer(PyObject *obj, + void **buffer, + Py_ssize_t *buffer_len); + + /* + Takes an arbitrary object which must support the (writeable, + single segment) buffer interface and returns a pointer to a + writeable memory location in buffer of size buffer_len. + + 0 is returned on success. buffer and buffer_len are only + set in case no error occurs. Otherwise, -1 is returned and + an exception set. + + */ + + /* new buffer API */ + +#define PyObject_CheckBuffer(obj) \ + (((obj)->ob_type->tp_as_buffer != NULL) && \ + (PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_NEWBUFFER)) && \ + ((obj)->ob_type->tp_as_buffer->bf_getbuffer != NULL)) + + /* Return 1 if the getbuffer function is available, otherwise + return 0 */ + + PyAPI_FUNC(int) PyObject_GetBuffer(PyObject *obj, Py_buffer *view, + int flags); + + /* This is a C-API version of the getbuffer function call. It checks + to make sure object has the required function pointer and issues the + call. Returns -1 and raises an error on failure and returns 0 on + success + */ + + + PyAPI_FUNC(void *) PyBuffer_GetPointer(Py_buffer *view, Py_ssize_t *indices); + + /* Get the memory area pointed to by the indices for the buffer given. + Note that view->ndim is the assumed size of indices + */ + + PyAPI_FUNC(int) PyBuffer_SizeFromFormat(const char *); + + /* Return the implied itemsize of the data-format area from a + struct-style description */ + + + + PyAPI_FUNC(int) PyBuffer_ToContiguous(void *buf, Py_buffer *view, + Py_ssize_t len, char fort); + + PyAPI_FUNC(int) PyBuffer_FromContiguous(Py_buffer *view, void *buf, + Py_ssize_t len, char fort); + + + /* Copy len bytes of data from the contiguous chunk of memory + pointed to by buf into the buffer exported by obj. Return + 0 on success and return -1 and raise a PyBuffer_Error on + error (i.e. the object does not have a buffer interface or + it is not working). + + If fort is 'F' and the object is multi-dimensional, + then the data will be copied into the array in + Fortran-style (first dimension varies the fastest). If + fort is 'C', then the data will be copied into the array + in C-style (last dimension varies the fastest). If fort + is 'A', then it does not matter and the copy will be made + in whatever way is more efficient. + + */ + + PyAPI_FUNC(int) PyObject_CopyData(PyObject *dest, PyObject *src); + + /* Copy the data from the src buffer to the buffer of destination + */ + + PyAPI_FUNC(int) PyBuffer_IsContiguous(Py_buffer *view, char fort); + + + PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims, + Py_ssize_t *shape, + Py_ssize_t *strides, + int itemsize, + char fort); + + /* Fill the strides array with byte-strides of a contiguous + (Fortran-style if fort is 'F' or C-style otherwise) + array of the given shape with the given number of bytes + per element. + */ + + PyAPI_FUNC(int) PyBuffer_FillInfo(Py_buffer *view, PyObject *o, void *buf, + Py_ssize_t len, int readonly, + int flags); + + /* Fills in a buffer-info structure correctly for an exporter + that can only share a contiguous chunk of memory of + "unsigned bytes" of the given length. Returns 0 on success + and -1 (with raising an error) on error. + */ + + PyAPI_FUNC(void) PyBuffer_Release(Py_buffer *view); + + /* Releases a Py_buffer obtained from getbuffer ParseTuple's s*. + */ + + PyAPI_FUNC(PyObject *) PyObject_Format(PyObject* obj, + PyObject *format_spec); + /* + Takes an arbitrary object and returns the result of + calling obj.__format__(format_spec). + */ + +/* Iterators */ + + PyAPI_FUNC(PyObject *) PyObject_GetIter(PyObject *); + /* Takes an object and returns an iterator for it. + This is typically a new iterator but if the argument + is an iterator, this returns itself. */ + +#define PyIter_Check(obj) \ + (PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_ITER) && \ + (obj)->ob_type->tp_iternext != NULL && \ + (obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented) + + PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *); + /* Takes an iterator object and calls its tp_iternext slot, + returning the next value. If the iterator is exhausted, + this returns NULL without setting an exception. + NULL with an exception means an error occurred. */ + +/* Number Protocol:*/ + + PyAPI_FUNC(int) PyNumber_Check(PyObject *o); + + /* + Returns 1 if the object, o, provides numeric protocols, and + false otherwise. + + This function always succeeds. + + */ + + PyAPI_FUNC(PyObject *) PyNumber_Add(PyObject *o1, PyObject *o2); + + /* + Returns the result of adding o1 and o2, or null on failure. + This is the equivalent of the Python expression: o1+o2. + + + */ + + PyAPI_FUNC(PyObject *) PyNumber_Subtract(PyObject *o1, PyObject *o2); + + /* + Returns the result of subtracting o2 from o1, or null on + failure. This is the equivalent of the Python expression: + o1-o2. + + */ + + PyAPI_FUNC(PyObject *) PyNumber_Multiply(PyObject *o1, PyObject *o2); + + /* + Returns the result of multiplying o1 and o2, or null on + failure. This is the equivalent of the Python expression: + o1*o2. + + + */ + + PyAPI_FUNC(PyObject *) PyNumber_Divide(PyObject *o1, PyObject *o2); + + /* + Returns the result of dividing o1 by o2, or null on failure. + This is the equivalent of the Python expression: o1/o2. + + + */ + + PyAPI_FUNC(PyObject *) PyNumber_FloorDivide(PyObject *o1, PyObject *o2); + + /* + Returns the result of dividing o1 by o2 giving an integral result, + or null on failure. + This is the equivalent of the Python expression: o1//o2. + + + */ + + PyAPI_FUNC(PyObject *) PyNumber_TrueDivide(PyObject *o1, PyObject *o2); + + /* + Returns the result of dividing o1 by o2 giving a float result, + or null on failure. + This is the equivalent of the Python expression: o1/o2. + + + */ + + PyAPI_FUNC(PyObject *) PyNumber_Remainder(PyObject *o1, PyObject *o2); + + /* + Returns the remainder of dividing o1 by o2, or null on + failure. This is the equivalent of the Python expression: + o1%o2. + + + */ + + PyAPI_FUNC(PyObject *) PyNumber_Divmod(PyObject *o1, PyObject *o2); + + /* + See the built-in function divmod. Returns NULL on failure. + This is the equivalent of the Python expression: + divmod(o1,o2). + + + */ + + PyAPI_FUNC(PyObject *) PyNumber_Power(PyObject *o1, PyObject *o2, + PyObject *o3); + + /* + See the built-in function pow. Returns NULL on failure. + This is the equivalent of the Python expression: + pow(o1,o2,o3), where o3 is optional. + + */ + + PyAPI_FUNC(PyObject *) PyNumber_Negative(PyObject *o); + + /* + Returns the negation of o on success, or null on failure. + This is the equivalent of the Python expression: -o. + + */ + + PyAPI_FUNC(PyObject *) PyNumber_Positive(PyObject *o); + + /* + Returns the (what?) of o on success, or NULL on failure. + This is the equivalent of the Python expression: +o. + + */ + + PyAPI_FUNC(PyObject *) PyNumber_Absolute(PyObject *o); + + /* + Returns the absolute value of o, or null on failure. This is + the equivalent of the Python expression: abs(o). + + */ + + PyAPI_FUNC(PyObject *) PyNumber_Invert(PyObject *o); + + /* + Returns the bitwise negation of o on success, or NULL on + failure. This is the equivalent of the Python expression: + ~o. + + + */ + + PyAPI_FUNC(PyObject *) PyNumber_Lshift(PyObject *o1, PyObject *o2); + + /* + Returns the result of left shifting o1 by o2 on success, or + NULL on failure. This is the equivalent of the Python + expression: o1 << o2. + + + */ + + PyAPI_FUNC(PyObject *) PyNumber_Rshift(PyObject *o1, PyObject *o2); + + /* + Returns the result of right shifting o1 by o2 on success, or + NULL on failure. This is the equivalent of the Python + expression: o1 >> o2. + + */ + + PyAPI_FUNC(PyObject *) PyNumber_And(PyObject *o1, PyObject *o2); + + /* + Returns the result of bitwise and of o1 and o2 on success, or + NULL on failure. This is the equivalent of the Python + expression: o1&o2. + + + */ + + PyAPI_FUNC(PyObject *) PyNumber_Xor(PyObject *o1, PyObject *o2); + + /* + Returns the bitwise exclusive or of o1 by o2 on success, or + NULL on failure. This is the equivalent of the Python + expression: o1^o2. + + + */ + + PyAPI_FUNC(PyObject *) PyNumber_Or(PyObject *o1, PyObject *o2); + + /* + Returns the result of bitwise or on o1 and o2 on success, or + NULL on failure. This is the equivalent of the Python + expression: o1|o2. + + */ + + /* Implemented elsewhere: + + int PyNumber_Coerce(PyObject **p1, PyObject **p2); + + This function takes the addresses of two variables of type + PyObject*. + + If the objects pointed to by *p1 and *p2 have the same type, + increment their reference count and return 0 (success). + If the objects can be converted to a common numeric type, + replace *p1 and *p2 by their converted value (with 'new' + reference counts), and return 0. + If no conversion is possible, or if some other error occurs, + return -1 (failure) and don't increment the reference counts. + The call PyNumber_Coerce(&o1, &o2) is equivalent to the Python + statement o1, o2 = coerce(o1, o2). + + */ + +#define PyIndex_Check(obj) \ + ((obj)->ob_type->tp_as_number != NULL && \ + PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_INDEX) && \ + (obj)->ob_type->tp_as_number->nb_index != NULL) + + PyAPI_FUNC(PyObject *) PyNumber_Index(PyObject *o); + + /* + Returns the object converted to a Python long or int + or NULL with an error raised on failure. + */ + + PyAPI_FUNC(Py_ssize_t) PyNumber_AsSsize_t(PyObject *o, PyObject *exc); + + /* + Returns the Integral instance converted to an int. The + instance is expected to be int or long or have an __int__ + method. Steals integral's reference. error_format will be + used to create the TypeError if integral isn't actually an + Integral instance. error_format should be a format string + that can accept a char* naming integral's type. + */ + + PyAPI_FUNC(PyObject *) _PyNumber_ConvertIntegralToInt( + PyObject *integral, + const char* error_format); + + /* + Returns the object converted to Py_ssize_t by going through + PyNumber_Index first. If an overflow error occurs while + converting the int-or-long to Py_ssize_t, then the second argument + is the error-type to return. If it is NULL, then the overflow error + is cleared and the value is clipped. + */ + + PyAPI_FUNC(PyObject *) PyNumber_Int(PyObject *o); + + /* + Returns the o converted to an integer object on success, or + NULL on failure. This is the equivalent of the Python + expression: int(o). + + */ + + PyAPI_FUNC(PyObject *) PyNumber_Long(PyObject *o); + + /* + Returns the o converted to a long integer object on success, + or NULL on failure. This is the equivalent of the Python + expression: long(o). + + */ + + PyAPI_FUNC(PyObject *) PyNumber_Float(PyObject *o); + + /* + Returns the o converted to a float object on success, or NULL + on failure. This is the equivalent of the Python expression: + float(o). + */ + +/* In-place variants of (some of) the above number protocol functions */ + + PyAPI_FUNC(PyObject *) PyNumber_InPlaceAdd(PyObject *o1, PyObject *o2); + + /* + Returns the result of adding o2 to o1, possibly in-place, or null + on failure. This is the equivalent of the Python expression: + o1 += o2. + + */ + + PyAPI_FUNC(PyObject *) PyNumber_InPlaceSubtract(PyObject *o1, PyObject *o2); + + /* + Returns the result of subtracting o2 from o1, possibly in-place or + null on failure. This is the equivalent of the Python expression: + o1 -= o2. + + */ + + PyAPI_FUNC(PyObject *) PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2); + + /* + Returns the result of multiplying o1 by o2, possibly in-place, or + null on failure. This is the equivalent of the Python expression: + o1 *= o2. + + */ + + PyAPI_FUNC(PyObject *) PyNumber_InPlaceDivide(PyObject *o1, PyObject *o2); + + /* + Returns the result of dividing o1 by o2, possibly in-place, or null + on failure. This is the equivalent of the Python expression: + o1 /= o2. + + */ + + PyAPI_FUNC(PyObject *) PyNumber_InPlaceFloorDivide(PyObject *o1, + PyObject *o2); + + /* + Returns the result of dividing o1 by o2 giving an integral result, + possibly in-place, or null on failure. + This is the equivalent of the Python expression: + o1 /= o2. + + */ + + PyAPI_FUNC(PyObject *) PyNumber_InPlaceTrueDivide(PyObject *o1, + PyObject *o2); + + /* + Returns the result of dividing o1 by o2 giving a float result, + possibly in-place, or null on failure. + This is the equivalent of the Python expression: + o1 /= o2. + + */ + + PyAPI_FUNC(PyObject *) PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2); + + /* + Returns the remainder of dividing o1 by o2, possibly in-place, or + null on failure. This is the equivalent of the Python expression: + o1 %= o2. + + */ + + PyAPI_FUNC(PyObject *) PyNumber_InPlacePower(PyObject *o1, PyObject *o2, + PyObject *o3); + + /* + Returns the result of raising o1 to the power of o2, possibly + in-place, or null on failure. This is the equivalent of the Python + expression: o1 **= o2, or pow(o1, o2, o3) if o3 is present. + + */ + + PyAPI_FUNC(PyObject *) PyNumber_InPlaceLshift(PyObject *o1, PyObject *o2); + + /* + Returns the result of left shifting o1 by o2, possibly in-place, or + null on failure. This is the equivalent of the Python expression: + o1 <<= o2. + + */ + + PyAPI_FUNC(PyObject *) PyNumber_InPlaceRshift(PyObject *o1, PyObject *o2); + + /* + Returns the result of right shifting o1 by o2, possibly in-place or + null on failure. This is the equivalent of the Python expression: + o1 >>= o2. + + */ + + PyAPI_FUNC(PyObject *) PyNumber_InPlaceAnd(PyObject *o1, PyObject *o2); + + /* + Returns the result of bitwise and of o1 and o2, possibly in-place, + or null on failure. This is the equivalent of the Python + expression: o1 &= o2. + + */ + + PyAPI_FUNC(PyObject *) PyNumber_InPlaceXor(PyObject *o1, PyObject *o2); + + /* + Returns the bitwise exclusive or of o1 by o2, possibly in-place, or + null on failure. This is the equivalent of the Python expression: + o1 ^= o2. + + */ + + PyAPI_FUNC(PyObject *) PyNumber_InPlaceOr(PyObject *o1, PyObject *o2); + + /* + Returns the result of bitwise or of o1 and o2, possibly in-place, + or null on failure. This is the equivalent of the Python + expression: o1 |= o2. + + */ + + + PyAPI_FUNC(PyObject *) PyNumber_ToBase(PyObject *n, int base); + + /* + Returns the integer n converted to a string with a base, with a base + marker of 0b, 0o or 0x prefixed if applicable. + If n is not an int object, it is converted with PyNumber_Index first. + */ + + +/* Sequence protocol:*/ + + PyAPI_FUNC(int) PySequence_Check(PyObject *o); + + /* + Return 1 if the object provides sequence protocol, and zero + otherwise. + + This function always succeeds. + + */ + + PyAPI_FUNC(Py_ssize_t) PySequence_Size(PyObject *o); + + /* + Return the size of sequence object o, or -1 on failure. + + */ + + /* For DLL compatibility */ +#undef PySequence_Length + PyAPI_FUNC(Py_ssize_t) PySequence_Length(PyObject *o); +#define PySequence_Length PySequence_Size + + + PyAPI_FUNC(PyObject *) PySequence_Concat(PyObject *o1, PyObject *o2); + + /* + Return the concatenation of o1 and o2 on success, and NULL on + failure. This is the equivalent of the Python + expression: o1+o2. + + */ + + PyAPI_FUNC(PyObject *) PySequence_Repeat(PyObject *o, Py_ssize_t count); + + /* + Return the result of repeating sequence object o count times, + or NULL on failure. This is the equivalent of the Python + expression: o1*count. + + */ + + PyAPI_FUNC(PyObject *) PySequence_GetItem(PyObject *o, Py_ssize_t i); + + /* + Return the ith element of o, or NULL on failure. This is the + equivalent of the Python expression: o[i]. + */ + + PyAPI_FUNC(PyObject *) PySequence_GetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2); + + /* + Return the slice of sequence object o between i1 and i2, or + NULL on failure. This is the equivalent of the Python + expression: o[i1:i2]. + + */ + + PyAPI_FUNC(int) PySequence_SetItem(PyObject *o, Py_ssize_t i, PyObject *v); + + /* + Assign object v to the ith element of o. Raise an exception and return + -1 on failure; return 0 on success. This is the equivalent of the + Python statement o[i]=v. + */ + + PyAPI_FUNC(int) PySequence_DelItem(PyObject *o, Py_ssize_t i); + + /* + Delete the ith element of object v. Returns + -1 on failure. This is the equivalent of the Python + statement: del o[i]. + */ + + PyAPI_FUNC(int) PySequence_SetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2, + PyObject *v); + + /* + Assign the sequence object, v, to the slice in sequence + object, o, from i1 to i2. Raise an exception and return + -1 on failure; return 0 on success. This is the + equivalent of the Python statement: o[i1:i2]=v. + */ + + PyAPI_FUNC(int) PySequence_DelSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2); + + /* + Delete the slice in sequence object, o, from i1 to i2. + Returns -1 on failure. This is the equivalent of the Python + statement: del o[i1:i2]. + */ + + PyAPI_FUNC(PyObject *) PySequence_Tuple(PyObject *o); + + /* + Returns the sequence, o, as a tuple on success, and NULL on failure. + This is equivalent to the Python expression: tuple(o) + */ + + + PyAPI_FUNC(PyObject *) PySequence_List(PyObject *o); + /* + Returns the sequence, o, as a list on success, and NULL on failure. + This is equivalent to the Python expression: list(o) + */ + + PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m); + /* + Return the sequence, o, as a list, unless it's already a + tuple or list. Use PySequence_Fast_GET_ITEM to access the + members of this list, and PySequence_Fast_GET_SIZE to get its length. + + Returns NULL on failure. If the object does not support iteration, + raises a TypeError exception with m as the message text. + */ + +#define PySequence_Fast_GET_SIZE(o) \ + (PyList_Check(o) ? PyList_GET_SIZE(o) : PyTuple_GET_SIZE(o)) + /* + Return the size of o, assuming that o was returned by + PySequence_Fast and is not NULL. + */ + +#define PySequence_Fast_GET_ITEM(o, i)\ + (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i)) + /* + Return the ith element of o, assuming that o was returned by + PySequence_Fast, and that i is within bounds. + */ + +#define PySequence_ITEM(o, i)\ + ( Py_TYPE(o)->tp_as_sequence->sq_item(o, i) ) + /* Assume tp_as_sequence and sq_item exist and that i does not + need to be corrected for a negative index + */ + +#define PySequence_Fast_ITEMS(sf) \ + (PyList_Check(sf) ? ((PyListObject *)(sf))->ob_item \ + : ((PyTupleObject *)(sf))->ob_item) + /* Return a pointer to the underlying item array for + an object retured by PySequence_Fast */ + + PyAPI_FUNC(Py_ssize_t) PySequence_Count(PyObject *o, PyObject *value); + + /* + Return the number of occurrences on value on o, that is, + return the number of keys for which o[key]==value. On + failure, return -1. This is equivalent to the Python + expression: o.count(value). + */ + + PyAPI_FUNC(int) PySequence_Contains(PyObject *seq, PyObject *ob); + /* + Return -1 if error; 1 if ob in seq; 0 if ob not in seq. + Use __contains__ if possible, else _PySequence_IterSearch(). + */ + +#define PY_ITERSEARCH_COUNT 1 +#define PY_ITERSEARCH_INDEX 2 +#define PY_ITERSEARCH_CONTAINS 3 + PyAPI_FUNC(Py_ssize_t) _PySequence_IterSearch(PyObject *seq, + PyObject *obj, int operation); + /* + Iterate over seq. Result depends on the operation: + PY_ITERSEARCH_COUNT: return # of times obj appears in seq; -1 if + error. + PY_ITERSEARCH_INDEX: return 0-based index of first occurrence of + obj in seq; set ValueError and return -1 if none found; + also return -1 on error. + PY_ITERSEARCH_CONTAINS: return 1 if obj in seq, else 0; -1 on + error. + */ + +/* For DLL-level backwards compatibility */ +#undef PySequence_In + PyAPI_FUNC(int) PySequence_In(PyObject *o, PyObject *value); + +/* For source-level backwards compatibility */ +#define PySequence_In PySequence_Contains + + /* + Determine if o contains value. If an item in o is equal to + X, return 1, otherwise return 0. On error, return -1. This + is equivalent to the Python expression: value in o. + */ + + PyAPI_FUNC(Py_ssize_t) PySequence_Index(PyObject *o, PyObject *value); + + /* + Return the first index for which o[i]=value. On error, + return -1. This is equivalent to the Python + expression: o.index(value). + */ + +/* In-place versions of some of the above Sequence functions. */ + + PyAPI_FUNC(PyObject *) PySequence_InPlaceConcat(PyObject *o1, PyObject *o2); + + /* + Append o2 to o1, in-place when possible. Return the resulting + object, which could be o1, or NULL on failure. This is the + equivalent of the Python expression: o1 += o2. + + */ + + PyAPI_FUNC(PyObject *) PySequence_InPlaceRepeat(PyObject *o, Py_ssize_t count); + + /* + Repeat o1 by count, in-place when possible. Return the resulting + object, which could be o1, or NULL on failure. This is the + equivalent of the Python expression: o1 *= count. + + */ + +/* Mapping protocol:*/ + + PyAPI_FUNC(int) PyMapping_Check(PyObject *o); + + /* + Return 1 if the object provides mapping protocol, and zero + otherwise. + + This function always succeeds. + */ + + PyAPI_FUNC(Py_ssize_t) PyMapping_Size(PyObject *o); + + /* + Returns the number of keys in object o on success, and -1 on + failure. For objects that do not provide sequence protocol, + this is equivalent to the Python expression: len(o). + */ + + /* For DLL compatibility */ +#undef PyMapping_Length + PyAPI_FUNC(Py_ssize_t) PyMapping_Length(PyObject *o); +#define PyMapping_Length PyMapping_Size + + + /* implemented as a macro: + + int PyMapping_DelItemString(PyObject *o, char *key); + + Remove the mapping for object, key, from the object *o. + Returns -1 on failure. This is equivalent to + the Python statement: del o[key]. + */ +#define PyMapping_DelItemString(O,K) PyObject_DelItemString((O),(K)) + + /* implemented as a macro: + + int PyMapping_DelItem(PyObject *o, PyObject *key); + + Remove the mapping for object, key, from the object *o. + Returns -1 on failure. This is equivalent to + the Python statement: del o[key]. + */ +#define PyMapping_DelItem(O,K) PyObject_DelItem((O),(K)) + + PyAPI_FUNC(int) PyMapping_HasKeyString(PyObject *o, char *key); + + /* + On success, return 1 if the mapping object has the key, key, + and 0 otherwise. This is equivalent to the Python expression: + o.has_key(key). + + This function always succeeds. + */ + + PyAPI_FUNC(int) PyMapping_HasKey(PyObject *o, PyObject *key); + + /* + Return 1 if the mapping object has the key, key, + and 0 otherwise. This is equivalent to the Python expression: + o.has_key(key). + + This function always succeeds. + + */ + + /* Implemented as macro: + + PyObject *PyMapping_Keys(PyObject *o); + + On success, return a list of the keys in object o. On + failure, return NULL. This is equivalent to the Python + expression: o.keys(). + */ +#define PyMapping_Keys(O) PyObject_CallMethod(O,"keys",NULL) + + /* Implemented as macro: + + PyObject *PyMapping_Values(PyObject *o); + + On success, return a list of the values in object o. On + failure, return NULL. This is equivalent to the Python + expression: o.values(). + */ +#define PyMapping_Values(O) PyObject_CallMethod(O,"values",NULL) + + /* Implemented as macro: + + PyObject *PyMapping_Items(PyObject *o); + + On success, return a list of the items in object o, where + each item is a tuple containing a key-value pair. On + failure, return NULL. This is equivalent to the Python + expression: o.items(). + + */ +#define PyMapping_Items(O) PyObject_CallMethod(O,"items",NULL) + + PyAPI_FUNC(PyObject *) PyMapping_GetItemString(PyObject *o, char *key); + + /* + Return element of o corresponding to the object, key, or NULL + on failure. This is the equivalent of the Python expression: + o[key]. + */ + + PyAPI_FUNC(int) PyMapping_SetItemString(PyObject *o, char *key, + PyObject *value); + + /* + Map the object, key, to the value, v. Returns + -1 on failure. This is the equivalent of the Python + statement: o[key]=v. + */ + + +PyAPI_FUNC(int) PyObject_IsInstance(PyObject *object, PyObject *typeorclass); + /* isinstance(object, typeorclass) */ + +PyAPI_FUNC(int) PyObject_IsSubclass(PyObject *object, PyObject *typeorclass); + /* issubclass(object, typeorclass) */ + + +PyAPI_FUNC(int) _PyObject_RealIsInstance(PyObject *inst, PyObject *cls); + +PyAPI_FUNC(int) _PyObject_RealIsSubclass(PyObject *derived, PyObject *cls); + + +/* For internal use by buffer API functions */ +PyAPI_FUNC(void) _Py_add_one_to_index_F(int nd, Py_ssize_t *index, + const Py_ssize_t *shape); +PyAPI_FUNC(void) _Py_add_one_to_index_C(int nd, Py_ssize_t *index, + const Py_ssize_t *shape); + + +#ifdef __cplusplus +} +#endif +#endif /* Py_ABSTRACTOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/asdl.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/asdl.h new file mode 100644 index 0000000..84e837e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/asdl.h @@ -0,0 +1,45 @@ +#ifndef Py_ASDL_H +#define Py_ASDL_H + +typedef PyObject * identifier; +typedef PyObject * string; +typedef PyObject * object; + +#ifndef __cplusplus +typedef enum {false, true} bool; +#endif + +/* It would be nice if the code generated by asdl_c.py was completely + independent of Python, but it is a goal the requires too much work + at this stage. So, for example, I'll represent identifiers as + interned Python strings. +*/ + +/* XXX A sequence should be typed so that its use can be typechecked. */ + +typedef struct { + int size; + void *elements[1]; +} asdl_seq; + +typedef struct { + int size; + int elements[1]; +} asdl_int_seq; + +asdl_seq *asdl_seq_new(int size, PyArena *arena); +asdl_int_seq *asdl_int_seq_new(int size, PyArena *arena); + +#define asdl_seq_GET(S, I) (S)->elements[(I)] +#define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size) +#ifdef Py_DEBUG +#define asdl_seq_SET(S, I, V) { \ + int _asdl_i = (I); \ + assert((S) && _asdl_i < (S)->size); \ + (S)->elements[_asdl_i] = (V); \ +} +#else +#define asdl_seq_SET(S, I, V) (S)->elements[I] = (V) +#endif + +#endif /* !Py_ASDL_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/ast.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/ast.h new file mode 100644 index 0000000..cc14b7f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/ast.h @@ -0,0 +1,13 @@ +#ifndef Py_AST_H +#define Py_AST_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_FUNC(mod_ty) PyAST_FromNode(const node *, PyCompilerFlags *flags, + const char *, PyArena *); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_AST_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/bitset.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/bitset.h new file mode 100644 index 0000000..faeb419 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/bitset.h @@ -0,0 +1,32 @@ + +#ifndef Py_BITSET_H +#define Py_BITSET_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Bitset interface */ + +#define BYTE char + +typedef BYTE *bitset; + +bitset newbitset(int nbits); +void delbitset(bitset bs); +#define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0) +int addbit(bitset bs, int ibit); /* Returns 0 if already set */ +int samebitset(bitset bs1, bitset bs2, int nbits); +void mergebitset(bitset bs1, bitset bs2, int nbits); + +#define BITSPERBYTE (8*sizeof(BYTE)) +#define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE) + +#define BIT2BYTE(ibit) ((ibit) / BITSPERBYTE) +#define BIT2SHIFT(ibit) ((ibit) % BITSPERBYTE) +#define BIT2MASK(ibit) (1 << BIT2SHIFT(ibit)) +#define BYTE2BIT(ibyte) ((ibyte) * BITSPERBYTE) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_BITSET_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/boolobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/boolobject.h new file mode 100644 index 0000000..74e854f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/boolobject.h @@ -0,0 +1,36 @@ +/* Boolean object interface */ + +#ifndef Py_BOOLOBJECT_H +#define Py_BOOLOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + + +typedef PyIntObject PyBoolObject; + +PyAPI_DATA(PyTypeObject) PyBool_Type; + +#define PyBool_Check(x) (Py_TYPE(x) == &PyBool_Type) + +/* Py_False and Py_True are the only two bools in existence. +Don't forget to apply Py_INCREF() when returning either!!! */ + +/* Don't use these directly */ +PyAPI_DATA(PyIntObject) _Py_ZeroStruct, _Py_TrueStruct; + +/* Use these macros */ +#define Py_False ((PyObject *) &_Py_ZeroStruct) +#define Py_True ((PyObject *) &_Py_TrueStruct) + +/* Macros for returning Py_True or Py_False, respectively */ +#define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True +#define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False + +/* Function to return a bool from a C long */ +PyAPI_FUNC(PyObject *) PyBool_FromLong(long); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_BOOLOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/bufferobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/bufferobject.h new file mode 100644 index 0000000..6dd8345 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/bufferobject.h @@ -0,0 +1,33 @@ + +/* Buffer object interface */ + +/* Note: the object's structure is private */ + +#ifndef Py_BUFFEROBJECT_H +#define Py_BUFFEROBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + + +PyAPI_DATA(PyTypeObject) PyBuffer_Type; + +#define PyBuffer_Check(op) (Py_TYPE(op) == &PyBuffer_Type) + +#define Py_END_OF_BUFFER (-1) + +PyAPI_FUNC(PyObject *) PyBuffer_FromObject(PyObject *base, + Py_ssize_t offset, Py_ssize_t size); +PyAPI_FUNC(PyObject *) PyBuffer_FromReadWriteObject(PyObject *base, + Py_ssize_t offset, + Py_ssize_t size); + +PyAPI_FUNC(PyObject *) PyBuffer_FromMemory(void *ptr, Py_ssize_t size); +PyAPI_FUNC(PyObject *) PyBuffer_FromReadWriteMemory(void *ptr, Py_ssize_t size); + +PyAPI_FUNC(PyObject *) PyBuffer_New(Py_ssize_t size); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_BUFFEROBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/bytearrayobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/bytearrayobject.h new file mode 100644 index 0000000..e1281a6 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/bytearrayobject.h @@ -0,0 +1,57 @@ +/* ByteArray object interface */ + +#ifndef Py_BYTEARRAYOBJECT_H +#define Py_BYTEARRAYOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* Type PyByteArrayObject represents a mutable array of bytes. + * The Python API is that of a sequence; + * the bytes are mapped to ints in [0, 256). + * Bytes are not characters; they may be used to encode characters. + * The only way to go between bytes and str/unicode is via encoding + * and decoding. + * For the convenience of C programmers, the bytes type is considered + * to contain a char pointer, not an unsigned char pointer. + */ + +/* Object layout */ +typedef struct { + PyObject_VAR_HEAD + /* XXX(nnorwitz): should ob_exports be Py_ssize_t? */ + int ob_exports; /* how many buffer exports */ + Py_ssize_t ob_alloc; /* How many bytes allocated */ + char *ob_bytes; +} PyByteArrayObject; + +/* Type object */ +PyAPI_DATA(PyTypeObject) PyByteArray_Type; +PyAPI_DATA(PyTypeObject) PyByteArrayIter_Type; + +/* Type check macros */ +#define PyByteArray_Check(self) PyObject_TypeCheck(self, &PyByteArray_Type) +#define PyByteArray_CheckExact(self) (Py_TYPE(self) == &PyByteArray_Type) + +/* Direct API functions */ +PyAPI_FUNC(PyObject *) PyByteArray_FromObject(PyObject *); +PyAPI_FUNC(PyObject *) PyByteArray_Concat(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyByteArray_FromStringAndSize(const char *, Py_ssize_t); +PyAPI_FUNC(Py_ssize_t) PyByteArray_Size(PyObject *); +PyAPI_FUNC(char *) PyByteArray_AsString(PyObject *); +PyAPI_FUNC(int) PyByteArray_Resize(PyObject *, Py_ssize_t); + +/* Macros, trading safety for speed */ +#define PyByteArray_AS_STRING(self) \ + (assert(PyByteArray_Check(self)), \ + Py_SIZE(self) ? ((PyByteArrayObject *)(self))->ob_bytes : _PyByteArray_empty_string) +#define PyByteArray_GET_SIZE(self) (assert(PyByteArray_Check(self)),Py_SIZE(self)) + +PyAPI_DATA(char) _PyByteArray_empty_string[]; + +#ifdef __cplusplus +} +#endif +#endif /* !Py_BYTEARRAYOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/bytes_methods.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/bytes_methods.h new file mode 100644 index 0000000..4125666 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/bytes_methods.h @@ -0,0 +1,75 @@ +#ifndef Py_BYTES_CTYPE_H +#define Py_BYTES_CTYPE_H + +/* + * The internal implementation behind PyString (bytes) and PyBytes (buffer) + * methods of the given names, they operate on ASCII byte strings. + */ +extern PyObject* _Py_bytes_isspace(const char *cptr, Py_ssize_t len); +extern PyObject* _Py_bytes_isalpha(const char *cptr, Py_ssize_t len); +extern PyObject* _Py_bytes_isalnum(const char *cptr, Py_ssize_t len); +extern PyObject* _Py_bytes_isdigit(const char *cptr, Py_ssize_t len); +extern PyObject* _Py_bytes_islower(const char *cptr, Py_ssize_t len); +extern PyObject* _Py_bytes_isupper(const char *cptr, Py_ssize_t len); +extern PyObject* _Py_bytes_istitle(const char *cptr, Py_ssize_t len); + +/* These store their len sized answer in the given preallocated *result arg. */ +extern void _Py_bytes_lower(char *result, const char *cptr, Py_ssize_t len); +extern void _Py_bytes_upper(char *result, const char *cptr, Py_ssize_t len); +extern void _Py_bytes_title(char *result, char *s, Py_ssize_t len); +extern void _Py_bytes_capitalize(char *result, char *s, Py_ssize_t len); +extern void _Py_bytes_swapcase(char *result, char *s, Py_ssize_t len); + +/* Shared __doc__ strings. */ +extern const char _Py_isspace__doc__[]; +extern const char _Py_isalpha__doc__[]; +extern const char _Py_isalnum__doc__[]; +extern const char _Py_isdigit__doc__[]; +extern const char _Py_islower__doc__[]; +extern const char _Py_isupper__doc__[]; +extern const char _Py_istitle__doc__[]; +extern const char _Py_lower__doc__[]; +extern const char _Py_upper__doc__[]; +extern const char _Py_title__doc__[]; +extern const char _Py_capitalize__doc__[]; +extern const char _Py_swapcase__doc__[]; + +/* These are left in for backward compatibility and will be removed + in 2.8/3.2 */ +#define ISLOWER(c) Py_ISLOWER(c) +#define ISUPPER(c) Py_ISUPPER(c) +#define ISALPHA(c) Py_ISALPHA(c) +#define ISDIGIT(c) Py_ISDIGIT(c) +#define ISXDIGIT(c) Py_ISXDIGIT(c) +#define ISALNUM(c) Py_ISALNUM(c) +#define ISSPACE(c) Py_ISSPACE(c) + +#undef islower +#define islower(c) undefined_islower(c) +#undef isupper +#define isupper(c) undefined_isupper(c) +#undef isalpha +#define isalpha(c) undefined_isalpha(c) +#undef isdigit +#define isdigit(c) undefined_isdigit(c) +#undef isxdigit +#define isxdigit(c) undefined_isxdigit(c) +#undef isalnum +#define isalnum(c) undefined_isalnum(c) +#undef isspace +#define isspace(c) undefined_isspace(c) + +/* These are left in for backward compatibility and will be removed + in 2.8/3.2 */ +#define TOLOWER(c) Py_TOLOWER(c) +#define TOUPPER(c) Py_TOUPPER(c) + +#undef tolower +#define tolower(c) undefined_tolower(c) +#undef toupper +#define toupper(c) undefined_toupper(c) + +/* this is needed because some docs are shared from the .o, not static */ +#define PyDoc_STRVAR_shared(name,str) const char name[] = PyDoc_STR(str) + +#endif /* !Py_BYTES_CTYPE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/bytesobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/bytesobject.h new file mode 100644 index 0000000..1083da9 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/bytesobject.h @@ -0,0 +1,27 @@ +#define PyBytesObject PyStringObject +#define PyBytes_Type PyString_Type + +#define PyBytes_Check PyString_Check +#define PyBytes_CheckExact PyString_CheckExact +#define PyBytes_CHECK_INTERNED PyString_CHECK_INTERNED +#define PyBytes_AS_STRING PyString_AS_STRING +#define PyBytes_GET_SIZE PyString_GET_SIZE +#define Py_TPFLAGS_BYTES_SUBCLASS Py_TPFLAGS_STRING_SUBCLASS + +#define PyBytes_FromStringAndSize PyString_FromStringAndSize +#define PyBytes_FromString PyString_FromString +#define PyBytes_FromFormatV PyString_FromFormatV +#define PyBytes_FromFormat PyString_FromFormat +#define PyBytes_Size PyString_Size +#define PyBytes_AsString PyString_AsString +#define PyBytes_Repr PyString_Repr +#define PyBytes_Concat PyString_Concat +#define PyBytes_ConcatAndDel PyString_ConcatAndDel +#define _PyBytes_Resize _PyString_Resize +#define _PyBytes_Eq _PyString_Eq +#define PyBytes_Format PyString_Format +#define _PyBytes_FormatLong _PyString_FormatLong +#define PyBytes_DecodeEscape PyString_DecodeEscape +#define _PyBytes_Join _PyString_Join +#define PyBytes_AsStringAndSize PyString_AsStringAndSize +#define _PyBytes_InsertThousandsGrouping _PyString_InsertThousandsGrouping diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/cStringIO.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/cStringIO.h new file mode 100644 index 0000000..973a471 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/cStringIO.h @@ -0,0 +1,73 @@ +#ifndef Py_CSTRINGIO_H +#define Py_CSTRINGIO_H +#ifdef __cplusplus +extern "C" { +#endif +/* + + This header provides access to cStringIO objects from C. + Functions are provided for calling cStringIO objects and + macros are provided for testing whether you have cStringIO + objects. + + Before calling any of the functions or macros, you must initialize + the routines with: + + PycString_IMPORT + + This would typically be done in your init function. + +*/ + +#define PycStringIO_CAPSULE_NAME "cStringIO.cStringIO_CAPI" + +#define PycString_IMPORT \ + PycStringIO = ((struct PycStringIO_CAPI*)PyCapsule_Import(\ + PycStringIO_CAPSULE_NAME, 0)) + +/* Basic functions to manipulate cStringIO objects from C */ + +static struct PycStringIO_CAPI { + + /* Read a string from an input object. If the last argument + is -1, the remainder will be read. + */ + int(*cread)(PyObject *, char **, Py_ssize_t); + + /* Read a line from an input object. Returns the length of the read + line as an int and a pointer inside the object buffer as char** (so + the caller doesn't have to provide its own buffer as destination). + */ + int(*creadline)(PyObject *, char **); + + /* Write a string to an output object*/ + int(*cwrite)(PyObject *, const char *, Py_ssize_t); + + /* Get the output object as a Python string (returns new reference). */ + PyObject *(*cgetvalue)(PyObject *); + + /* Create a new output object */ + PyObject *(*NewOutput)(int); + + /* Create an input object from a Python string + (copies the Python string reference). + */ + PyObject *(*NewInput)(PyObject *); + + /* The Python types for cStringIO input and output objects. + Note that you can do input on an output object. + */ + PyTypeObject *InputType, *OutputType; + +} *PycStringIO; + +/* These can be used to test if you have one */ +#define PycStringIO_InputCheck(O) \ + (Py_TYPE(O)==PycStringIO->InputType) +#define PycStringIO_OutputCheck(O) \ + (Py_TYPE(O)==PycStringIO->OutputType) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_CSTRINGIO_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/cellobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/cellobject.h new file mode 100644 index 0000000..c927ee5 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/cellobject.h @@ -0,0 +1,28 @@ +/* Cell object interface */ + +#ifndef Py_CELLOBJECT_H +#define Py_CELLOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + PyObject_HEAD + PyObject *ob_ref; /* Content of the cell or NULL when empty */ +} PyCellObject; + +PyAPI_DATA(PyTypeObject) PyCell_Type; + +#define PyCell_Check(op) (Py_TYPE(op) == &PyCell_Type) + +PyAPI_FUNC(PyObject *) PyCell_New(PyObject *); +PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *); +PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *); + +#define PyCell_GET(op) (((PyCellObject *)(op))->ob_ref) +#define PyCell_SET(op, v) (((PyCellObject *)(op))->ob_ref = v) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_TUPLEOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/ceval.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/ceval.h new file mode 100644 index 0000000..f461601 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/ceval.h @@ -0,0 +1,154 @@ +#ifndef Py_CEVAL_H +#define Py_CEVAL_H +#ifdef __cplusplus +extern "C" { +#endif + + +/* Interface to random parts in ceval.c */ + +PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords( + PyObject *, PyObject *, PyObject *); + +/* Inline this */ +#define PyEval_CallObject(func,arg) \ + PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL) + +PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *obj, + const char *format, ...); +PyAPI_FUNC(PyObject *) PyEval_CallMethod(PyObject *obj, + const char *methodname, + const char *format, ...); + +PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *); +PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *); + +struct _frame; /* Avoid including frameobject.h */ + +PyAPI_FUNC(PyObject *) PyEval_GetBuiltins(void); +PyAPI_FUNC(PyObject *) PyEval_GetGlobals(void); +PyAPI_FUNC(PyObject *) PyEval_GetLocals(void); +PyAPI_FUNC(struct _frame *) PyEval_GetFrame(void); +PyAPI_FUNC(int) PyEval_GetRestricted(void); + +/* Look at the current frame's (if any) code's co_flags, and turn on + the corresponding compiler flags in cf->cf_flags. Return 1 if any + flag was set, else return 0. */ +PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf); + +PyAPI_FUNC(int) Py_FlushLine(void); + +PyAPI_FUNC(int) Py_AddPendingCall(int (*func)(void *), void *arg); +PyAPI_FUNC(int) Py_MakePendingCalls(void); + +/* Protection against deeply nested recursive calls */ +PyAPI_FUNC(void) Py_SetRecursionLimit(int); +PyAPI_FUNC(int) Py_GetRecursionLimit(void); + +#define Py_EnterRecursiveCall(where) \ + (_Py_MakeRecCheck(PyThreadState_GET()->recursion_depth) && \ + _Py_CheckRecursiveCall(where)) +#define Py_LeaveRecursiveCall() \ + (--PyThreadState_GET()->recursion_depth) +PyAPI_FUNC(int) _Py_CheckRecursiveCall(const char *where); +PyAPI_DATA(int) _Py_CheckRecursionLimit; +#ifdef USE_STACKCHECK +# define _Py_MakeRecCheck(x) (++(x) > --_Py_CheckRecursionLimit) +#else +# define _Py_MakeRecCheck(x) (++(x) > _Py_CheckRecursionLimit) +#endif + +PyAPI_FUNC(const char *) PyEval_GetFuncName(PyObject *); +PyAPI_FUNC(const char *) PyEval_GetFuncDesc(PyObject *); + +PyAPI_FUNC(PyObject *) PyEval_GetCallStats(PyObject *); +PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *); +PyAPI_FUNC(PyObject *) PyEval_EvalFrameEx(struct _frame *f, int exc); + +/* this used to be handled on a per-thread basis - now just two globals */ +PyAPI_DATA(volatile int) _Py_Ticker; +PyAPI_DATA(int) _Py_CheckInterval; + +/* Interface for threads. + + A module that plans to do a blocking system call (or something else + that lasts a long time and doesn't touch Python data) can allow other + threads to run as follows: + + ...preparations here... + Py_BEGIN_ALLOW_THREADS + ...blocking system call here... + Py_END_ALLOW_THREADS + ...interpret result here... + + The Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS pair expands to a + {}-surrounded block. + To leave the block in the middle (e.g., with return), you must insert + a line containing Py_BLOCK_THREADS before the return, e.g. + + if (...premature_exit...) { + Py_BLOCK_THREADS + PyErr_SetFromErrno(PyExc_IOError); + return NULL; + } + + An alternative is: + + Py_BLOCK_THREADS + if (...premature_exit...) { + PyErr_SetFromErrno(PyExc_IOError); + return NULL; + } + Py_UNBLOCK_THREADS + + For convenience, that the value of 'errno' is restored across + Py_END_ALLOW_THREADS and Py_BLOCK_THREADS. + + WARNING: NEVER NEST CALLS TO Py_BEGIN_ALLOW_THREADS AND + Py_END_ALLOW_THREADS!!! + + The function PyEval_InitThreads() should be called only from + initthread() in "threadmodule.c". + + Note that not yet all candidates have been converted to use this + mechanism! +*/ + +PyAPI_FUNC(PyThreadState *) PyEval_SaveThread(void); +PyAPI_FUNC(void) PyEval_RestoreThread(PyThreadState *); + +#ifdef WITH_THREAD + +PyAPI_FUNC(int) PyEval_ThreadsInitialized(void); +PyAPI_FUNC(void) PyEval_InitThreads(void); +PyAPI_FUNC(void) PyEval_AcquireLock(void); +PyAPI_FUNC(void) PyEval_ReleaseLock(void); +PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState *tstate); +PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate); +PyAPI_FUNC(void) PyEval_ReInitThreads(void); + +#define Py_BEGIN_ALLOW_THREADS { \ + PyThreadState *_save; \ + _save = PyEval_SaveThread(); +#define Py_BLOCK_THREADS PyEval_RestoreThread(_save); +#define Py_UNBLOCK_THREADS _save = PyEval_SaveThread(); +#define Py_END_ALLOW_THREADS PyEval_RestoreThread(_save); \ + } + +#else /* !WITH_THREAD */ + +#define Py_BEGIN_ALLOW_THREADS { +#define Py_BLOCK_THREADS +#define Py_UNBLOCK_THREADS +#define Py_END_ALLOW_THREADS } + +#endif /* !WITH_THREAD */ + +PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *); +PyAPI_FUNC(int) _PyEval_SliceIndexNotNone(PyObject *, Py_ssize_t *); + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_CEVAL_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/classobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/classobject.h new file mode 100644 index 0000000..bc03e0d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/classobject.h @@ -0,0 +1,83 @@ + +/* Class object interface */ + +/* Revealing some structures (not for general use) */ + +#ifndef Py_CLASSOBJECT_H +#define Py_CLASSOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + PyObject_HEAD + PyObject *cl_bases; /* A tuple of class objects */ + PyObject *cl_dict; /* A dictionary */ + PyObject *cl_name; /* A string */ + /* The following three are functions or NULL */ + PyObject *cl_getattr; + PyObject *cl_setattr; + PyObject *cl_delattr; + PyObject *cl_weakreflist; /* List of weak references */ +} PyClassObject; + +typedef struct { + PyObject_HEAD + PyClassObject *in_class; /* The class object */ + PyObject *in_dict; /* A dictionary */ + PyObject *in_weakreflist; /* List of weak references */ +} PyInstanceObject; + +typedef struct { + PyObject_HEAD + PyObject *im_func; /* The callable object implementing the method */ + PyObject *im_self; /* The instance it is bound to, or NULL */ + PyObject *im_class; /* The class that asked for the method */ + PyObject *im_weakreflist; /* List of weak references */ +} PyMethodObject; + +PyAPI_DATA(PyTypeObject) PyClass_Type, PyInstance_Type, PyMethod_Type; + +#define PyClass_Check(op) ((op)->ob_type == &PyClass_Type) +#define PyInstance_Check(op) ((op)->ob_type == &PyInstance_Type) +#define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type) + +PyAPI_FUNC(PyObject *) PyClass_New(PyObject *, PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyInstance_New(PyObject *, PyObject *, + PyObject *); +PyAPI_FUNC(PyObject *) PyInstance_NewRaw(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *, PyObject *); + +PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *); +PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *); +PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *); + +/* Look up attribute with name (a string) on instance object pinst, using + * only the instance and base class dicts. If a descriptor is found in + * a class dict, the descriptor is returned without calling it. + * Returns NULL if nothing found, else a borrowed reference to the + * value associated with name in the dict in which name was found. + * The point of this routine is that it never calls arbitrary Python + * code, so is always "safe": all it does is dict lookups. The function + * can't fail, never sets an exception, and NULL is not an error (it just + * means "not found"). + */ +PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name); + +/* Macros for direct access to these values. Type checks are *not* + done, so use with care. */ +#define PyMethod_GET_FUNCTION(meth) \ + (((PyMethodObject *)meth) -> im_func) +#define PyMethod_GET_SELF(meth) \ + (((PyMethodObject *)meth) -> im_self) +#define PyMethod_GET_CLASS(meth) \ + (((PyMethodObject *)meth) -> im_class) + +PyAPI_FUNC(int) PyClass_IsSubclass(PyObject *, PyObject *); + +PyAPI_FUNC(int) PyMethod_ClearFreeList(void); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_CLASSOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/cobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/cobject.h new file mode 100644 index 0000000..ad3cd9c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/cobject.h @@ -0,0 +1,89 @@ +/* + CObjects are marked Pending Deprecation as of Python 2.7. + The full schedule for 2.x is as follows: + - CObjects are marked Pending Deprecation in Python 2.7. + - CObjects will be marked Deprecated in Python 2.8 + (if there is one). + - CObjects will be removed in Python 2.9 (if there is one). + + Additionally, for the Python 3.x series: + - CObjects were marked Deprecated in Python 3.1. + - CObjects will be removed in Python 3.2. + + You should switch all use of CObjects to capsules. Capsules + have a safer and more consistent API. For more information, + see Include/pycapsule.h, or read the "Capsules" topic in + the "Python/C API Reference Manual". + + Python 2.7 no longer uses CObjects itself; all objects which + were formerly CObjects are now capsules. Note that this change + does not by itself break binary compatibility with extensions + built for previous versions of Python--PyCObject_AsVoidPtr() + has been changed to also understand capsules. + +*/ + +/* original file header comment follows: */ + +/* C objects to be exported from one extension module to another. + + C objects are used for communication between extension modules. + They provide a way for an extension module to export a C interface + to other extension modules, so that extension modules can use the + Python import mechanism to link to one another. + +*/ + +#ifndef Py_COBJECT_H +#define Py_COBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_DATA(PyTypeObject) PyCObject_Type; + +#define PyCObject_Check(op) (Py_TYPE(op) == &PyCObject_Type) + +/* Create a PyCObject from a pointer to a C object and an optional + destructor function. If the second argument is non-null, then it + will be called with the first argument if and when the PyCObject is + destroyed. + +*/ +PyAPI_FUNC(PyObject *) PyCObject_FromVoidPtr( + void *cobj, void (*destruct)(void*)); + + +/* Create a PyCObject from a pointer to a C object, a description object, + and an optional destructor function. If the third argument is non-null, + then it will be called with the first and second arguments if and when + the PyCObject is destroyed. +*/ +PyAPI_FUNC(PyObject *) PyCObject_FromVoidPtrAndDesc( + void *cobj, void *desc, void (*destruct)(void*,void*)); + +/* Retrieve a pointer to a C object from a PyCObject. */ +PyAPI_FUNC(void *) PyCObject_AsVoidPtr(PyObject *); + +/* Retrieve a pointer to a description object from a PyCObject. */ +PyAPI_FUNC(void *) PyCObject_GetDesc(PyObject *); + +/* Import a pointer to a C object from a module using a PyCObject. */ +PyAPI_FUNC(void *) PyCObject_Import(char *module_name, char *cobject_name); + +/* Modify a C object. Fails (==0) if object has a destructor. */ +PyAPI_FUNC(int) PyCObject_SetVoidPtr(PyObject *self, void *cobj); + + +typedef struct { + PyObject_HEAD + void *cobject; + void *desc; + void (*destructor)(void *); +} PyCObject; + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_COBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/code.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/code.h new file mode 100644 index 0000000..7456fd6 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/code.h @@ -0,0 +1,116 @@ +/* Definitions for bytecode */ + +#ifndef Py_CODE_H +#define Py_CODE_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Bytecode object */ +typedef struct { + PyObject_HEAD + int co_argcount; /* #arguments, except *args */ + int co_nlocals; /* #local variables */ + int co_stacksize; /* #entries needed for evaluation stack */ + int co_flags; /* CO_..., see below */ + PyObject *co_code; /* instruction opcodes */ + PyObject *co_consts; /* list (constants used) */ + PyObject *co_names; /* list of strings (names used) */ + PyObject *co_varnames; /* tuple of strings (local variable names) */ + PyObject *co_freevars; /* tuple of strings (free variable names) */ + PyObject *co_cellvars; /* tuple of strings (cell variable names) */ + /* The rest doesn't count for hash/cmp */ + PyObject *co_filename; /* string (where it was loaded from) */ + PyObject *co_name; /* string (name, for reference) */ + int co_firstlineno; /* first source line number */ + PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) See + Objects/lnotab_notes.txt for details. */ + void *co_zombieframe; /* for optimization only (see frameobject.c) */ + PyObject *co_weakreflist; /* to support weakrefs to code objects */ +} PyCodeObject; + +/* Masks for co_flags above */ +#define CO_OPTIMIZED 0x0001 +#define CO_NEWLOCALS 0x0002 +#define CO_VARARGS 0x0004 +#define CO_VARKEYWORDS 0x0008 +#define CO_NESTED 0x0010 +#define CO_GENERATOR 0x0020 +/* The CO_NOFREE flag is set if there are no free or cell variables. + This information is redundant, but it allows a single flag test + to determine whether there is any extra work to be done when the + call frame it setup. +*/ +#define CO_NOFREE 0x0040 + +#if 0 +/* This is no longer used. Stopped defining in 2.5, do not re-use. */ +#define CO_GENERATOR_ALLOWED 0x1000 +#endif +#define CO_FUTURE_DIVISION 0x2000 +#define CO_FUTURE_ABSOLUTE_IMPORT 0x4000 /* do absolute imports by default */ +#define CO_FUTURE_WITH_STATEMENT 0x8000 +#define CO_FUTURE_PRINT_FUNCTION 0x10000 +#define CO_FUTURE_UNICODE_LITERALS 0x20000 + +/* This should be defined if a future statement modifies the syntax. + For example, when a keyword is added. +*/ +#if 1 +#define PY_PARSER_REQUIRES_FUTURE_KEYWORD +#endif + +#define CO_MAXBLOCKS 20 /* Max static block nesting within a function */ + +PyAPI_DATA(PyTypeObject) PyCode_Type; + +#define PyCode_Check(op) (Py_TYPE(op) == &PyCode_Type) +#define PyCode_GetNumFree(op) (PyTuple_GET_SIZE((op)->co_freevars)) + +/* Public interface */ +PyAPI_FUNC(PyCodeObject *) PyCode_New( + int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *, + PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *); + /* same as struct above */ + +/* Creates a new empty code object with the specified source location. */ +PyAPI_FUNC(PyCodeObject *) +PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno); + +/* Return the line number associated with the specified bytecode index + in this code object. If you just need the line number of a frame, + use PyFrame_GetLineNumber() instead. */ +PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int); + +/* for internal use only */ +#define _PyCode_GETCODEPTR(co, pp) \ + ((*Py_TYPE((co)->co_code)->tp_as_buffer->bf_getreadbuffer) \ + ((co)->co_code, 0, (void **)(pp))) + +typedef struct _addr_pair { + int ap_lower; + int ap_upper; +} PyAddrPair; + +/* Update *bounds to describe the first and one-past-the-last instructions in the + same line as lasti. Return the number of that line. +*/ +PyAPI_FUNC(int) _PyCode_CheckLineNumber(PyCodeObject* co, + int lasti, PyAddrPair *bounds); + +/* Create a comparable key used to compare constants taking in account the + * object type. It is used to make sure types are not coerced (e.g., float and + * complex) _and_ to distinguish 0.0 from -0.0 e.g. on IEEE platforms + * + * Return (type(obj), obj, ...): a tuple with variable size (at least 2 items) + * depending on the type and the value. The type is the first item to not + * compare bytes and str which can raise a BytesWarning exception. */ +PyAPI_FUNC(PyObject*) _PyCode_ConstantKey(PyObject *obj); + +PyAPI_FUNC(PyObject*) PyCode_Optimize(PyObject *code, PyObject* consts, + PyObject *names, PyObject *lineno_obj); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_CODE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/codecs.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/codecs.h new file mode 100644 index 0000000..851bc9f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/codecs.h @@ -0,0 +1,212 @@ +#ifndef Py_CODECREGISTRY_H +#define Py_CODECREGISTRY_H +#ifdef __cplusplus +extern "C" { +#endif + +/* ------------------------------------------------------------------------ + + Python Codec Registry and support functions + + +Written by Marc-Andre Lemburg (mal@lemburg.com). + +Copyright (c) Corporation for National Research Initiatives. + + ------------------------------------------------------------------------ */ + +/* Register a new codec search function. + + As side effect, this tries to load the encodings package, if not + yet done, to make sure that it is always first in the list of + search functions. + + The search_function's refcount is incremented by this function. */ + +PyAPI_FUNC(int) PyCodec_Register( + PyObject *search_function + ); + +/* Codec register lookup API. + + Looks up the given encoding and returns a CodecInfo object with + function attributes which implement the different aspects of + processing the encoding. + + The encoding string is looked up converted to all lower-case + characters. This makes encodings looked up through this mechanism + effectively case-insensitive. + + If no codec is found, a KeyError is set and NULL returned. + + As side effect, this tries to load the encodings package, if not + yet done. This is part of the lazy load strategy for the encodings + package. + + */ + +PyAPI_FUNC(PyObject *) _PyCodec_Lookup( + const char *encoding + ); + +/* Generic codec based encoding API. + + object is passed through the encoder function found for the given + encoding using the error handling method defined by errors. errors + may be NULL to use the default method defined for the codec. + + Raises a LookupError in case no encoder can be found. + + */ + +PyAPI_FUNC(PyObject *) PyCodec_Encode( + PyObject *object, + const char *encoding, + const char *errors + ); + +/* Generic codec based decoding API. + + object is passed through the decoder function found for the given + encoding using the error handling method defined by errors. errors + may be NULL to use the default method defined for the codec. + + Raises a LookupError in case no encoder can be found. + + */ + +PyAPI_FUNC(PyObject *) PyCodec_Decode( + PyObject *object, + const char *encoding, + const char *errors + ); + +/* Text codec specific encoding and decoding API. + + Checks the encoding against a list of codecs which do not + implement a unicode<->bytes encoding before attempting the + operation. + + Please note that these APIs are internal and should not + be used in Python C extensions. + + XXX (ncoghlan): should we make these, or something like them, public + in Python 3.5+? + + */ +PyAPI_FUNC(PyObject *) _PyCodec_LookupTextEncoding( + const char *encoding, + const char *alternate_command + ); + +PyAPI_FUNC(PyObject *) _PyCodec_EncodeText( + PyObject *object, + const char *encoding, + const char *errors + ); + +PyAPI_FUNC(PyObject *) _PyCodec_DecodeText( + PyObject *object, + const char *encoding, + const char *errors + ); + +/* These two aren't actually text encoding specific, but _io.TextIOWrapper + * is the only current API consumer. + */ +PyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalDecoder( + PyObject *codec_info, + const char *errors + ); + +PyAPI_FUNC(PyObject *) _PyCodecInfo_GetIncrementalEncoder( + PyObject *codec_info, + const char *errors + ); + + + +/* --- Codec Lookup APIs -------------------------------------------------- + + All APIs return a codec object with incremented refcount and are + based on _PyCodec_Lookup(). The same comments w/r to the encoding + name also apply to these APIs. + +*/ + +/* Get an encoder function for the given encoding. */ + +PyAPI_FUNC(PyObject *) PyCodec_Encoder( + const char *encoding + ); + +/* Get a decoder function for the given encoding. */ + +PyAPI_FUNC(PyObject *) PyCodec_Decoder( + const char *encoding + ); + +/* Get an IncrementalEncoder object for the given encoding. */ + +PyAPI_FUNC(PyObject *) PyCodec_IncrementalEncoder( + const char *encoding, + const char *errors + ); + +/* Get an IncrementalDecoder object function for the given encoding. */ + +PyAPI_FUNC(PyObject *) PyCodec_IncrementalDecoder( + const char *encoding, + const char *errors + ); + +/* Get a StreamReader factory function for the given encoding. */ + +PyAPI_FUNC(PyObject *) PyCodec_StreamReader( + const char *encoding, + PyObject *stream, + const char *errors + ); + +/* Get a StreamWriter factory function for the given encoding. */ + +PyAPI_FUNC(PyObject *) PyCodec_StreamWriter( + const char *encoding, + PyObject *stream, + const char *errors + ); + +/* Unicode encoding error handling callback registry API */ + +/* Register the error handling callback function error under the given + name. This function will be called by the codec when it encounters + unencodable characters/undecodable bytes and doesn't know the + callback name, when name is specified as the error parameter + in the call to the encode/decode function. + Return 0 on success, -1 on error */ +PyAPI_FUNC(int) PyCodec_RegisterError(const char *name, PyObject *error); + +/* Lookup the error handling callback function registered under the given + name. As a special case NULL can be passed, in which case + the error handling callback for "strict" will be returned. */ +PyAPI_FUNC(PyObject *) PyCodec_LookupError(const char *name); + +/* raise exc as an exception */ +PyAPI_FUNC(PyObject *) PyCodec_StrictErrors(PyObject *exc); + +/* ignore the unicode error, skipping the faulty input */ +PyAPI_FUNC(PyObject *) PyCodec_IgnoreErrors(PyObject *exc); + +/* replace the unicode encode error with ? or U+FFFD */ +PyAPI_FUNC(PyObject *) PyCodec_ReplaceErrors(PyObject *exc); + +/* replace the unicode encode error with XML character references */ +PyAPI_FUNC(PyObject *) PyCodec_XMLCharRefReplaceErrors(PyObject *exc); + +/* replace the unicode encode error with backslash escapes (\x, \u and \U) */ +PyAPI_FUNC(PyObject *) PyCodec_BackslashReplaceErrors(PyObject *exc); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_CODECREGISTRY_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/compile.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/compile.h new file mode 100644 index 0000000..6100101 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/compile.h @@ -0,0 +1,40 @@ + +#ifndef Py_COMPILE_H +#define Py_COMPILE_H + +#include "code.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Public interface */ +struct _node; /* Declare the existence of this type */ +PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *); + +/* Future feature support */ + +typedef struct { + int ff_features; /* flags set by future statements */ + int ff_lineno; /* line number of last future statement */ +} PyFutureFeatures; + +#define FUTURE_NESTED_SCOPES "nested_scopes" +#define FUTURE_GENERATORS "generators" +#define FUTURE_DIVISION "division" +#define FUTURE_ABSOLUTE_IMPORT "absolute_import" +#define FUTURE_WITH_STATEMENT "with_statement" +#define FUTURE_PRINT_FUNCTION "print_function" +#define FUTURE_UNICODE_LITERALS "unicode_literals" + + +struct _mod; /* Declare the existence of this type */ +PyAPI_FUNC(PyCodeObject *) PyAST_Compile(struct _mod *, const char *, + PyCompilerFlags *, PyArena *); +PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *); + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_COMPILE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/complexobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/complexobject.h new file mode 100644 index 0000000..c9a9500 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/complexobject.h @@ -0,0 +1,66 @@ +/* Complex number structure */ + +#ifndef Py_COMPLEXOBJECT_H +#define Py_COMPLEXOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + double real; + double imag; +} Py_complex; + +/* Operations on complex numbers from complexmodule.c */ + +#define c_sum _Py_c_sum +#define c_diff _Py_c_diff +#define c_neg _Py_c_neg +#define c_prod _Py_c_prod +#define c_quot _Py_c_quot +#define c_pow _Py_c_pow +#define c_abs _Py_c_abs + +PyAPI_FUNC(Py_complex) c_sum(Py_complex, Py_complex); +PyAPI_FUNC(Py_complex) c_diff(Py_complex, Py_complex); +PyAPI_FUNC(Py_complex) c_neg(Py_complex); +PyAPI_FUNC(Py_complex) c_prod(Py_complex, Py_complex); +PyAPI_FUNC(Py_complex) c_quot(Py_complex, Py_complex); +PyAPI_FUNC(Py_complex) c_pow(Py_complex, Py_complex); +PyAPI_FUNC(double) c_abs(Py_complex); + + +/* Complex object interface */ + +/* +PyComplexObject represents a complex number with double-precision +real and imaginary parts. +*/ + +typedef struct { + PyObject_HEAD + Py_complex cval; +} PyComplexObject; + +PyAPI_DATA(PyTypeObject) PyComplex_Type; + +#define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type) +#define PyComplex_CheckExact(op) (Py_TYPE(op) == &PyComplex_Type) + +PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex); +PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag); + +PyAPI_FUNC(double) PyComplex_RealAsDouble(PyObject *op); +PyAPI_FUNC(double) PyComplex_ImagAsDouble(PyObject *op); +PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op); + +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +PyAPI_FUNC(PyObject *) _PyComplex_FormatAdvanced(PyObject *obj, + char *format_spec, + Py_ssize_t format_spec_len); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_COMPLEXOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/datetime.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/datetime.h new file mode 100644 index 0000000..c0e7ffd --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/datetime.h @@ -0,0 +1,239 @@ +/* datetime.h + */ + +#ifndef DATETIME_H +#define DATETIME_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Fields are packed into successive bytes, each viewed as unsigned and + * big-endian, unless otherwise noted: + * + * byte offset + * 0 year 2 bytes, 1-9999 + * 2 month 1 byte, 1-12 + * 3 day 1 byte, 1-31 + * 4 hour 1 byte, 0-23 + * 5 minute 1 byte, 0-59 + * 6 second 1 byte, 0-59 + * 7 usecond 3 bytes, 0-999999 + * 10 + */ + +/* # of bytes for year, month, and day. */ +#define _PyDateTime_DATE_DATASIZE 4 + +/* # of bytes for hour, minute, second, and usecond. */ +#define _PyDateTime_TIME_DATASIZE 6 + +/* # of bytes for year, month, day, hour, minute, second, and usecond. */ +#define _PyDateTime_DATETIME_DATASIZE 10 + + +typedef struct +{ + PyObject_HEAD + long hashcode; /* -1 when unknown */ + int days; /* -MAX_DELTA_DAYS <= days <= MAX_DELTA_DAYS */ + int seconds; /* 0 <= seconds < 24*3600 is invariant */ + int microseconds; /* 0 <= microseconds < 1000000 is invariant */ +} PyDateTime_Delta; + +typedef struct +{ + PyObject_HEAD /* a pure abstract base class */ +} PyDateTime_TZInfo; + + +/* The datetime and time types have hashcodes, and an optional tzinfo member, + * present if and only if hastzinfo is true. + */ +#define _PyTZINFO_HEAD \ + PyObject_HEAD \ + long hashcode; \ + char hastzinfo; /* boolean flag */ + +/* No _PyDateTime_BaseTZInfo is allocated; it's just to have something + * convenient to cast to, when getting at the hastzinfo member of objects + * starting with _PyTZINFO_HEAD. + */ +typedef struct +{ + _PyTZINFO_HEAD +} _PyDateTime_BaseTZInfo; + +/* All time objects are of PyDateTime_TimeType, but that can be allocated + * in two ways, with or without a tzinfo member. Without is the same as + * tzinfo == None, but consumes less memory. _PyDateTime_BaseTime is an + * internal struct used to allocate the right amount of space for the + * "without" case. + */ +#define _PyDateTime_TIMEHEAD \ + _PyTZINFO_HEAD \ + unsigned char data[_PyDateTime_TIME_DATASIZE]; + +typedef struct +{ + _PyDateTime_TIMEHEAD +} _PyDateTime_BaseTime; /* hastzinfo false */ + +typedef struct +{ + _PyDateTime_TIMEHEAD + PyObject *tzinfo; +} PyDateTime_Time; /* hastzinfo true */ + + +/* All datetime objects are of PyDateTime_DateTimeType, but that can be + * allocated in two ways too, just like for time objects above. In addition, + * the plain date type is a base class for datetime, so it must also have + * a hastzinfo member (although it's unused there). + */ +typedef struct +{ + _PyTZINFO_HEAD + unsigned char data[_PyDateTime_DATE_DATASIZE]; +} PyDateTime_Date; + +#define _PyDateTime_DATETIMEHEAD \ + _PyTZINFO_HEAD \ + unsigned char data[_PyDateTime_DATETIME_DATASIZE]; + +typedef struct +{ + _PyDateTime_DATETIMEHEAD +} _PyDateTime_BaseDateTime; /* hastzinfo false */ + +typedef struct +{ + _PyDateTime_DATETIMEHEAD + PyObject *tzinfo; +} PyDateTime_DateTime; /* hastzinfo true */ + + +/* Apply for date and datetime instances. */ +#define PyDateTime_GET_YEAR(o) ((((PyDateTime_Date*)o)->data[0] << 8) | \ + ((PyDateTime_Date*)o)->data[1]) +#define PyDateTime_GET_MONTH(o) (((PyDateTime_Date*)o)->data[2]) +#define PyDateTime_GET_DAY(o) (((PyDateTime_Date*)o)->data[3]) + +#define PyDateTime_DATE_GET_HOUR(o) (((PyDateTime_DateTime*)o)->data[4]) +#define PyDateTime_DATE_GET_MINUTE(o) (((PyDateTime_DateTime*)o)->data[5]) +#define PyDateTime_DATE_GET_SECOND(o) (((PyDateTime_DateTime*)o)->data[6]) +#define PyDateTime_DATE_GET_MICROSECOND(o) \ + ((((PyDateTime_DateTime*)o)->data[7] << 16) | \ + (((PyDateTime_DateTime*)o)->data[8] << 8) | \ + ((PyDateTime_DateTime*)o)->data[9]) + +/* Apply for time instances. */ +#define PyDateTime_TIME_GET_HOUR(o) (((PyDateTime_Time*)o)->data[0]) +#define PyDateTime_TIME_GET_MINUTE(o) (((PyDateTime_Time*)o)->data[1]) +#define PyDateTime_TIME_GET_SECOND(o) (((PyDateTime_Time*)o)->data[2]) +#define PyDateTime_TIME_GET_MICROSECOND(o) \ + ((((PyDateTime_Time*)o)->data[3] << 16) | \ + (((PyDateTime_Time*)o)->data[4] << 8) | \ + ((PyDateTime_Time*)o)->data[5]) + + +/* Define structure for C API. */ +typedef struct { + /* type objects */ + PyTypeObject *DateType; + PyTypeObject *DateTimeType; + PyTypeObject *TimeType; + PyTypeObject *DeltaType; + PyTypeObject *TZInfoType; + + /* constructors */ + PyObject *(*Date_FromDate)(int, int, int, PyTypeObject*); + PyObject *(*DateTime_FromDateAndTime)(int, int, int, int, int, int, int, + PyObject*, PyTypeObject*); + PyObject *(*Time_FromTime)(int, int, int, int, PyObject*, PyTypeObject*); + PyObject *(*Delta_FromDelta)(int, int, int, int, PyTypeObject*); + + /* constructors for the DB API */ + PyObject *(*DateTime_FromTimestamp)(PyObject*, PyObject*, PyObject*); + PyObject *(*Date_FromTimestamp)(PyObject*, PyObject*); + +} PyDateTime_CAPI; + +#define PyDateTime_CAPSULE_NAME "datetime.datetime_CAPI" + + +/* "magic" constant used to partially protect against developer mistakes. */ +#define DATETIME_API_MAGIC 0x414548d5 + +#ifdef Py_BUILD_CORE + +/* Macros for type checking when building the Python core. */ +#define PyDate_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateType) +#define PyDate_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateType) + +#define PyDateTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateTimeType) +#define PyDateTime_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateTimeType) + +#define PyTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_TimeType) +#define PyTime_CheckExact(op) (Py_TYPE(op) == &PyDateTime_TimeType) + +#define PyDelta_Check(op) PyObject_TypeCheck(op, &PyDateTime_DeltaType) +#define PyDelta_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DeltaType) + +#define PyTZInfo_Check(op) PyObject_TypeCheck(op, &PyDateTime_TZInfoType) +#define PyTZInfo_CheckExact(op) (Py_TYPE(op) == &PyDateTime_TZInfoType) + +#else + +/* Define global variable for the C API and a macro for setting it. */ +static PyDateTime_CAPI *PyDateTimeAPI = NULL; + +#define PyDateTime_IMPORT \ + PyDateTimeAPI = (PyDateTime_CAPI *)PyCapsule_Import(PyDateTime_CAPSULE_NAME, 0) + +/* Macros for type checking when not building the Python core. */ +#define PyDate_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateType) +#define PyDate_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DateType) + +#define PyDateTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateTimeType) +#define PyDateTime_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DateTimeType) + +#define PyTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TimeType) +#define PyTime_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->TimeType) + +#define PyDelta_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DeltaType) +#define PyDelta_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DeltaType) + +#define PyTZInfo_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TZInfoType) +#define PyTZInfo_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->TZInfoType) + +/* Macros for accessing constructors in a simplified fashion. */ +#define PyDate_FromDate(year, month, day) \ + PyDateTimeAPI->Date_FromDate(year, month, day, PyDateTimeAPI->DateType) + +#define PyDateTime_FromDateAndTime(year, month, day, hour, min, sec, usec) \ + PyDateTimeAPI->DateTime_FromDateAndTime(year, month, day, hour, \ + min, sec, usec, Py_None, PyDateTimeAPI->DateTimeType) + +#define PyTime_FromTime(hour, minute, second, usecond) \ + PyDateTimeAPI->Time_FromTime(hour, minute, second, usecond, \ + Py_None, PyDateTimeAPI->TimeType) + +#define PyDelta_FromDSU(days, seconds, useconds) \ + PyDateTimeAPI->Delta_FromDelta(days, seconds, useconds, 1, \ + PyDateTimeAPI->DeltaType) + +/* Macros supporting the DB API. */ +#define PyDateTime_FromTimestamp(args) \ + PyDateTimeAPI->DateTime_FromTimestamp( \ + (PyObject*) (PyDateTimeAPI->DateTimeType), args, NULL) + +#define PyDate_FromTimestamp(args) \ + PyDateTimeAPI->Date_FromTimestamp( \ + (PyObject*) (PyDateTimeAPI->DateType), args) + +#endif /* Py_BUILD_CORE */ + +#ifdef __cplusplus +} +#endif +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/descrobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/descrobject.h new file mode 100644 index 0000000..b542732 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/descrobject.h @@ -0,0 +1,94 @@ +/* Descriptors */ +#ifndef Py_DESCROBJECT_H +#define Py_DESCROBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef PyObject *(*getter)(PyObject *, void *); +typedef int (*setter)(PyObject *, PyObject *, void *); + +typedef struct PyGetSetDef { + char *name; + getter get; + setter set; + char *doc; + void *closure; +} PyGetSetDef; + +typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args, + void *wrapped); + +typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args, + void *wrapped, PyObject *kwds); + +struct wrapperbase { + char *name; + int offset; + void *function; + wrapperfunc wrapper; + char *doc; + int flags; + PyObject *name_strobj; +}; + +/* Flags for above struct */ +#define PyWrapperFlag_KEYWORDS 1 /* wrapper function takes keyword args */ + +/* Various kinds of descriptor objects */ + +#define PyDescr_COMMON \ + PyObject_HEAD \ + PyTypeObject *d_type; \ + PyObject *d_name + +typedef struct { + PyDescr_COMMON; +} PyDescrObject; + +typedef struct { + PyDescr_COMMON; + PyMethodDef *d_method; +} PyMethodDescrObject; + +typedef struct { + PyDescr_COMMON; + struct PyMemberDef *d_member; +} PyMemberDescrObject; + +typedef struct { + PyDescr_COMMON; + PyGetSetDef *d_getset; +} PyGetSetDescrObject; + +typedef struct { + PyDescr_COMMON; + struct wrapperbase *d_base; + void *d_wrapped; /* This can be any function pointer */ +} PyWrapperDescrObject; + +PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type; +PyAPI_DATA(PyTypeObject) PyDictProxy_Type; +PyAPI_DATA(PyTypeObject) PyGetSetDescr_Type; +PyAPI_DATA(PyTypeObject) PyMemberDescr_Type; + +PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *); +PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *); +PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *, + struct PyMemberDef *); +PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *, + struct PyGetSetDef *); +PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *, + struct wrapperbase *, void *); +#define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL) + +PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *); +PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *); + + +PyAPI_DATA(PyTypeObject) PyProperty_Type; +#ifdef __cplusplus +} +#endif +#endif /* !Py_DESCROBJECT_H */ + diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/dictobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/dictobject.h new file mode 100644 index 0000000..5a1e9fe --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/dictobject.h @@ -0,0 +1,160 @@ +#ifndef Py_DICTOBJECT_H +#define Py_DICTOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + + +/* Dictionary object type -- mapping from hashable object to object */ + +/* The distribution includes a separate file, Objects/dictnotes.txt, + describing explorations into dictionary design and optimization. + It covers typical dictionary use patterns, the parameters for + tuning dictionaries, and several ideas for possible optimizations. +*/ + +/* +There are three kinds of slots in the table: + +1. Unused. me_key == me_value == NULL + Does not hold an active (key, value) pair now and never did. Unused can + transition to Active upon key insertion. This is the only case in which + me_key is NULL, and is each slot's initial state. + +2. Active. me_key != NULL and me_key != dummy and me_value != NULL + Holds an active (key, value) pair. Active can transition to Dummy upon + key deletion. This is the only case in which me_value != NULL. + +3. Dummy. me_key == dummy and me_value == NULL + Previously held an active (key, value) pair, but that was deleted and an + active pair has not yet overwritten the slot. Dummy can transition to + Active upon key insertion. Dummy slots cannot be made Unused again + (cannot have me_key set to NULL), else the probe sequence in case of + collision would have no way to know they were once active. + +Note: .popitem() abuses the me_hash field of an Unused or Dummy slot to +hold a search finger. The me_hash field of Unused or Dummy slots has no +meaning otherwise. +*/ + +/* PyDict_MINSIZE is the minimum size of a dictionary. This many slots are + * allocated directly in the dict object (in the ma_smalltable member). + * It must be a power of 2, and at least 4. 8 allows dicts with no more + * than 5 active entries to live in ma_smalltable (and so avoid an + * additional malloc); instrumentation suggested this suffices for the + * majority of dicts (consisting mostly of usually-small instance dicts and + * usually-small dicts created to pass keyword arguments). + */ +#define PyDict_MINSIZE 8 + +typedef struct { + /* Cached hash code of me_key. Note that hash codes are C longs. + * We have to use Py_ssize_t instead because dict_popitem() abuses + * me_hash to hold a search finger. + */ + Py_ssize_t me_hash; + PyObject *me_key; + PyObject *me_value; +} PyDictEntry; + +/* +To ensure the lookup algorithm terminates, there must be at least one Unused +slot (NULL key) in the table. +The value ma_fill is the number of non-NULL keys (sum of Active and Dummy); +ma_used is the number of non-NULL, non-dummy keys (== the number of non-NULL +values == the number of Active items). +To avoid slowing down lookups on a near-full table, we resize the table when +it's two-thirds full. +*/ +typedef struct _dictobject PyDictObject; +struct _dictobject { + PyObject_HEAD + Py_ssize_t ma_fill; /* # Active + # Dummy */ + Py_ssize_t ma_used; /* # Active */ + + /* The table contains ma_mask + 1 slots, and that's a power of 2. + * We store the mask instead of the size because the mask is more + * frequently needed. + */ + Py_ssize_t ma_mask; + + /* ma_table points to ma_smalltable for small tables, else to + * additional malloc'ed memory. ma_table is never NULL! This rule + * saves repeated runtime null-tests in the workhorse getitem and + * setitem calls. + */ + PyDictEntry *ma_table; + PyDictEntry *(*ma_lookup)(PyDictObject *mp, PyObject *key, long hash); + PyDictEntry ma_smalltable[PyDict_MINSIZE]; +}; + +PyAPI_DATA(PyTypeObject) PyDict_Type; +PyAPI_DATA(PyTypeObject) PyDictIterKey_Type; +PyAPI_DATA(PyTypeObject) PyDictIterValue_Type; +PyAPI_DATA(PyTypeObject) PyDictIterItem_Type; +PyAPI_DATA(PyTypeObject) PyDictKeys_Type; +PyAPI_DATA(PyTypeObject) PyDictItems_Type; +PyAPI_DATA(PyTypeObject) PyDictValues_Type; + +#define PyDict_Check(op) \ + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS) +#define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) +#define PyDictKeys_Check(op) (Py_TYPE(op) == &PyDictKeys_Type) +#define PyDictItems_Check(op) (Py_TYPE(op) == &PyDictItems_Type) +#define PyDictValues_Check(op) (Py_TYPE(op) == &PyDictValues_Type) +/* This excludes Values, since they are not sets. */ +# define PyDictViewSet_Check(op) \ + (PyDictKeys_Check(op) || PyDictItems_Check(op)) + +PyAPI_FUNC(PyObject *) PyDict_New(void); +PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key); +PyAPI_FUNC(PyObject *) _PyDict_GetItemWithError(PyObject *mp, PyObject *key); +PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item); +PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key); +PyAPI_FUNC(int) _PyDict_DelItemIf(PyObject *mp, PyObject *key, + int (*predicate)(PyObject *value)); + +PyAPI_FUNC(void) PyDict_Clear(PyObject *mp); +PyAPI_FUNC(int) PyDict_Next( + PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value); +PyAPI_FUNC(int) _PyDict_Next( + PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, long *hash); +PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp); +PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp); +PyAPI_FUNC(PyObject *) PyDict_Items(PyObject *mp); +PyAPI_FUNC(Py_ssize_t) PyDict_Size(PyObject *mp); +PyAPI_FUNC(PyObject *) PyDict_Copy(PyObject *mp); +PyAPI_FUNC(int) PyDict_Contains(PyObject *mp, PyObject *key); +PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, long hash); +PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused); +PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp); + +/* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */ +PyAPI_FUNC(int) PyDict_Update(PyObject *mp, PyObject *other); + +/* PyDict_Merge updates/merges from a mapping object (an object that + supports PyMapping_Keys() and PyObject_GetItem()). If override is true, + the last occurrence of a key wins, else the first. The Python + dict.update(other) is equivalent to PyDict_Merge(dict, other, 1). +*/ +PyAPI_FUNC(int) PyDict_Merge(PyObject *mp, + PyObject *other, + int override); + +/* PyDict_MergeFromSeq2 updates/merges from an iterable object producing + iterable objects of length 2. If override is true, the last occurrence + of a key wins, else the first. The Python dict constructor dict(seq2) + is equivalent to dict={}; PyDict_MergeFromSeq(dict, seq2, 1). +*/ +PyAPI_FUNC(int) PyDict_MergeFromSeq2(PyObject *d, + PyObject *seq2, + int override); + +PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key); +PyAPI_FUNC(int) PyDict_SetItemString(PyObject *dp, const char *key, PyObject *item); +PyAPI_FUNC(int) PyDict_DelItemString(PyObject *dp, const char *key); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_DICTOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/dtoa.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/dtoa.h new file mode 100644 index 0000000..9b434b7 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/dtoa.h @@ -0,0 +1,15 @@ +#ifndef PY_NO_SHORT_FLOAT_REPR +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_FUNC(double) _Py_dg_strtod(const char *str, char **ptr); +PyAPI_FUNC(char *) _Py_dg_dtoa(double d, int mode, int ndigits, + int *decpt, int *sign, char **rve); +PyAPI_FUNC(void) _Py_dg_freedtoa(char *s); + + +#ifdef __cplusplus +} +#endif +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/enumobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/enumobject.h new file mode 100644 index 0000000..c14dbfc --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/enumobject.h @@ -0,0 +1,17 @@ +#ifndef Py_ENUMOBJECT_H +#define Py_ENUMOBJECT_H + +/* Enumerate Object */ + +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_DATA(PyTypeObject) PyEnum_Type; +PyAPI_DATA(PyTypeObject) PyReversed_Type; + +#ifdef __cplusplus +} +#endif + +#endif /* !Py_ENUMOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/errcode.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/errcode.h new file mode 100644 index 0000000..becec80 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/errcode.h @@ -0,0 +1,36 @@ +#ifndef Py_ERRCODE_H +#define Py_ERRCODE_H +#ifdef __cplusplus +extern "C" { +#endif + + +/* Error codes passed around between file input, tokenizer, parser and + interpreter. This is necessary so we can turn them into Python + exceptions at a higher level. Note that some errors have a + slightly different meaning when passed from the tokenizer to the + parser than when passed from the parser to the interpreter; e.g. + the parser only returns E_EOF when it hits EOF immediately, and it + never returns E_OK. */ + +#define E_OK 10 /* No error */ +#define E_EOF 11 /* End Of File */ +#define E_INTR 12 /* Interrupted */ +#define E_TOKEN 13 /* Bad token */ +#define E_SYNTAX 14 /* Syntax error */ +#define E_NOMEM 15 /* Ran out of memory */ +#define E_DONE 16 /* Parsing complete */ +#define E_ERROR 17 /* Execution error */ +#define E_TABSPACE 18 /* Inconsistent mixing of tabs and spaces */ +#define E_OVERFLOW 19 /* Node had too many children */ +#define E_TOODEEP 20 /* Too many indentation levels */ +#define E_DEDENT 21 /* No matching outer block for dedent */ +#define E_DECODE 22 /* Error in decoding into Unicode */ +#define E_EOFS 23 /* EOF in triple-quoted string */ +#define E_EOLS 24 /* EOL in single-quoted string */ +#define E_LINECONT 25 /* Unexpected characters after a line continuation */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_ERRCODE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/eval.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/eval.h new file mode 100644 index 0000000..b78dfe0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/eval.h @@ -0,0 +1,25 @@ + +/* Interface to execute compiled code */ + +#ifndef Py_EVAL_H +#define Py_EVAL_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyCodeObject *, PyObject *, PyObject *); + +PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyCodeObject *co, + PyObject *globals, + PyObject *locals, + PyObject **args, int argc, + PyObject **kwds, int kwdc, + PyObject **defs, int defc, + PyObject *closure); + +PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_EVAL_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/fileobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/fileobject.h new file mode 100644 index 0000000..1b540f9 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/fileobject.h @@ -0,0 +1,97 @@ + +/* File object interface */ + +#ifndef Py_FILEOBJECT_H +#define Py_FILEOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + PyObject_HEAD + FILE *f_fp; + PyObject *f_name; + PyObject *f_mode; + int (*f_close)(FILE *); + int f_softspace; /* Flag used by 'print' command */ + int f_binary; /* Flag which indicates whether the file is + open in binary (1) or text (0) mode */ + char* f_buf; /* Allocated readahead buffer */ + char* f_bufend; /* Points after last occupied position */ + char* f_bufptr; /* Current buffer position */ + char *f_setbuf; /* Buffer for setbuf(3) and setvbuf(3) */ + int f_univ_newline; /* Handle any newline convention */ + int f_newlinetypes; /* Types of newlines seen */ + int f_skipnextlf; /* Skip next \n */ + PyObject *f_encoding; + PyObject *f_errors; + PyObject *weakreflist; /* List of weak references */ + int unlocked_count; /* Num. currently running sections of code + using f_fp with the GIL released. */ + int readable; + int writable; +} PyFileObject; + +PyAPI_DATA(PyTypeObject) PyFile_Type; + +#define PyFile_Check(op) PyObject_TypeCheck(op, &PyFile_Type) +#define PyFile_CheckExact(op) (Py_TYPE(op) == &PyFile_Type) + +PyAPI_FUNC(PyObject *) PyFile_FromString(char *, char *); +PyAPI_FUNC(void) PyFile_SetBufSize(PyObject *, int); +PyAPI_FUNC(int) PyFile_SetEncoding(PyObject *, const char *); +PyAPI_FUNC(int) PyFile_SetEncodingAndErrors(PyObject *, const char *, char *errors); +PyAPI_FUNC(PyObject *) PyFile_FromFile(FILE *, char *, char *, + int (*)(FILE *)); +PyAPI_FUNC(FILE *) PyFile_AsFile(PyObject *); +PyAPI_FUNC(void) PyFile_IncUseCount(PyFileObject *); +PyAPI_FUNC(void) PyFile_DecUseCount(PyFileObject *); +PyAPI_FUNC(PyObject *) PyFile_Name(PyObject *); +PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int); +PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int); +PyAPI_FUNC(int) PyFile_SoftSpace(PyObject *, int); +PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *); +PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *); + +/* The default encoding used by the platform file system APIs + If non-NULL, this is different than the default encoding for strings +*/ +PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding; + +/* Routines to replace fread() and fgets() which accept any of \r, \n + or \r\n as line terminators. +*/ +#define PY_STDIOTEXTMODE "b" +char *Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *); +size_t Py_UniversalNewlineFread(char *, size_t, FILE *, PyObject *); + +/* A routine to do sanity checking on the file mode string. returns + non-zero on if an exception occurred +*/ +int _PyFile_SanitizeMode(char *mode); + +#if defined _MSC_VER && _MSC_VER >= 1400 +/* A routine to check if a file descriptor is valid on Windows. Returns 0 + * and sets errno to EBADF if it isn't. This is to avoid Assertions + * from various functions in the Windows CRT beginning with + * Visual Studio 2005 + */ +int _PyVerify_fd(int fd); +#elif defined _MSC_VER && _MSC_VER >= 1200 +/* fdopen doesn't set errno EBADF and crashes for large fd on debug build */ +#define _PyVerify_fd(fd) (_get_osfhandle(fd) >= 0) +#else +#define _PyVerify_fd(A) (1) /* dummy */ +#endif + +/* A routine to check if a file descriptor can be select()-ed. */ +#ifdef HAVE_SELECT + #define _PyIsSelectable_fd(FD) (((FD) >= 0) && ((FD) < FD_SETSIZE)) +#else + #define _PyIsSelectable_fd(FD) (1) +#endif /* HAVE_SELECT */ + +#ifdef __cplusplus +} +#endif +#endif /* !Py_FILEOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/floatobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/floatobject.h new file mode 100644 index 0000000..54e8825 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/floatobject.h @@ -0,0 +1,140 @@ + +/* Float object interface */ + +/* +PyFloatObject represents a (double precision) floating point number. +*/ + +#ifndef Py_FLOATOBJECT_H +#define Py_FLOATOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + PyObject_HEAD + double ob_fval; +} PyFloatObject; + +PyAPI_DATA(PyTypeObject) PyFloat_Type; + +#define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type) +#define PyFloat_CheckExact(op) (Py_TYPE(op) == &PyFloat_Type) + +/* The str() precision PyFloat_STR_PRECISION is chosen so that in most cases, + the rounding noise created by various operations is suppressed, while + giving plenty of precision for practical use. */ + +#define PyFloat_STR_PRECISION 12 + +#ifdef Py_NAN +#define Py_RETURN_NAN return PyFloat_FromDouble(Py_NAN) +#endif + +#define Py_RETURN_INF(sign) do \ + if (copysign(1., sign) == 1.) { \ + return PyFloat_FromDouble(Py_HUGE_VAL); \ + } else { \ + return PyFloat_FromDouble(-Py_HUGE_VAL); \ + } while(0) + +PyAPI_FUNC(double) PyFloat_GetMax(void); +PyAPI_FUNC(double) PyFloat_GetMin(void); +PyAPI_FUNC(PyObject *) PyFloat_GetInfo(void); + +/* Return Python float from string PyObject. Second argument ignored on + input, and, if non-NULL, NULL is stored into *junk (this tried to serve a + purpose once but can't be made to work as intended). */ +PyAPI_FUNC(PyObject *) PyFloat_FromString(PyObject*, char** junk); + +/* Return Python float from C double. */ +PyAPI_FUNC(PyObject *) PyFloat_FromDouble(double); + +/* Extract C double from Python float. The macro version trades safety for + speed. */ +PyAPI_FUNC(double) PyFloat_AsDouble(PyObject *); +#define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval) + +/* Write repr(v) into the char buffer argument, followed by null byte. The + buffer must be "big enough"; >= 100 is very safe. + PyFloat_AsReprString(buf, x) strives to print enough digits so that + PyFloat_FromString(buf) then reproduces x exactly. */ +PyAPI_FUNC(void) PyFloat_AsReprString(char*, PyFloatObject *v); + +/* Write str(v) into the char buffer argument, followed by null byte. The + buffer must be "big enough"; >= 100 is very safe. Note that it's + unusual to be able to get back the float you started with from + PyFloat_AsString's result -- use PyFloat_AsReprString() if you want to + preserve precision across conversions. */ +PyAPI_FUNC(void) PyFloat_AsString(char*, PyFloatObject *v); + +/* _PyFloat_{Pack,Unpack}{4,8} + * + * The struct and pickle (at least) modules need an efficient platform- + * independent way to store floating-point values as byte strings. + * The Pack routines produce a string from a C double, and the Unpack + * routines produce a C double from such a string. The suffix (4 or 8) + * specifies the number of bytes in the string. + * + * On platforms that appear to use (see _PyFloat_Init()) IEEE-754 formats + * these functions work by copying bits. On other platforms, the formats the + * 4- byte format is identical to the IEEE-754 single precision format, and + * the 8-byte format to the IEEE-754 double precision format, although the + * packing of INFs and NaNs (if such things exist on the platform) isn't + * handled correctly, and attempting to unpack a string containing an IEEE + * INF or NaN will raise an exception. + * + * On non-IEEE platforms with more precision, or larger dynamic range, than + * 754 supports, not all values can be packed; on non-IEEE platforms with less + * precision, or smaller dynamic range, not all values can be unpacked. What + * happens in such cases is partly accidental (alas). + */ + +/* The pack routines write 4 or 8 bytes, starting at p. le is a bool + * argument, true if you want the string in little-endian format (exponent + * last, at p+3 or p+7), false if you want big-endian format (exponent + * first, at p). + * Return value: 0 if all is OK, -1 if error (and an exception is + * set, most likely OverflowError). + * There are two problems on non-IEEE platforms: + * 1): What this does is undefined if x is a NaN or infinity. + * 2): -0.0 and +0.0 produce the same string. + */ +PyAPI_FUNC(int) _PyFloat_Pack4(double x, unsigned char *p, int le); +PyAPI_FUNC(int) _PyFloat_Pack8(double x, unsigned char *p, int le); + +/* Used to get the important decimal digits of a double */ +PyAPI_FUNC(int) _PyFloat_Digits(char *buf, double v, int *signum); +PyAPI_FUNC(void) _PyFloat_DigitsInit(void); + +/* The unpack routines read 4 or 8 bytes, starting at p. le is a bool + * argument, true if the string is in little-endian format (exponent + * last, at p+3 or p+7), false if big-endian (exponent first, at p). + * Return value: The unpacked double. On error, this is -1.0 and + * PyErr_Occurred() is true (and an exception is set, most likely + * OverflowError). Note that on a non-IEEE platform this will refuse + * to unpack a string that represents a NaN or infinity. + */ +PyAPI_FUNC(double) _PyFloat_Unpack4(const unsigned char *p, int le); +PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char *p, int le); + +/* free list api */ +PyAPI_FUNC(int) PyFloat_ClearFreeList(void); + +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +PyAPI_FUNC(PyObject *) _PyFloat_FormatAdvanced(PyObject *obj, + char *format_spec, + Py_ssize_t format_spec_len); + +/* Round a C double x to the closest multiple of 10**-ndigits. Returns a + Python float on success, or NULL (with an appropriate exception set) on + failure. Used in builtin_round in bltinmodule.c. */ +PyAPI_FUNC(PyObject *) _Py_double_round(double x, int ndigits); + + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_FLOATOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/frameobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/frameobject.h new file mode 100644 index 0000000..8439081 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/frameobject.h @@ -0,0 +1,89 @@ + +/* Frame object interface */ + +#ifndef Py_FRAMEOBJECT_H +#define Py_FRAMEOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + int b_type; /* what kind of block this is */ + int b_handler; /* where to jump to find handler */ + int b_level; /* value stack level to pop to */ +} PyTryBlock; + +typedef struct _frame { + PyObject_VAR_HEAD + struct _frame *f_back; /* previous frame, or NULL */ + PyCodeObject *f_code; /* code segment */ + PyObject *f_builtins; /* builtin symbol table (PyDictObject) */ + PyObject *f_globals; /* global symbol table (PyDictObject) */ + PyObject *f_locals; /* local symbol table (any mapping) */ + PyObject **f_valuestack; /* points after the last local */ + /* Next free slot in f_valuestack. Frame creation sets to f_valuestack. + Frame evaluation usually NULLs it, but a frame that yields sets it + to the current stack top. */ + PyObject **f_stacktop; + PyObject *f_trace; /* Trace function */ + + /* If an exception is raised in this frame, the next three are used to + * record the exception info (if any) originally in the thread state. See + * comments before set_exc_info() -- it's not obvious. + * Invariant: if _type is NULL, then so are _value and _traceback. + * Desired invariant: all three are NULL, or all three are non-NULL. That + * one isn't currently true, but "should be". + */ + PyObject *f_exc_type, *f_exc_value, *f_exc_traceback; + + PyThreadState *f_tstate; + int f_lasti; /* Last instruction if called */ + /* Call PyFrame_GetLineNumber() instead of reading this field + directly. As of 2.3 f_lineno is only valid when tracing is + active (i.e. when f_trace is set). At other times we use + PyCode_Addr2Line to calculate the line from the current + bytecode index. */ + int f_lineno; /* Current line number */ + int f_iblock; /* index in f_blockstack */ + PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */ + PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */ +} PyFrameObject; + + +/* Standard object interface */ + +PyAPI_DATA(PyTypeObject) PyFrame_Type; + +#define PyFrame_Check(op) (Py_TYPE(op) == &PyFrame_Type) +#define PyFrame_IsRestricted(f) \ + ((f)->f_builtins != (f)->f_tstate->interp->builtins) + +PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *, + PyObject *, PyObject *); + + +/* The rest of the interface is specific for frame objects */ + +/* Block management functions */ + +PyAPI_FUNC(void) PyFrame_BlockSetup(PyFrameObject *, int, int, int); +PyAPI_FUNC(PyTryBlock *) PyFrame_BlockPop(PyFrameObject *); + +/* Extend the value stack */ + +PyAPI_FUNC(PyObject **) PyFrame_ExtendStack(PyFrameObject *, int, int); + +/* Conversions between "fast locals" and locals in dictionary */ + +PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int); +PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *); + +PyAPI_FUNC(int) PyFrame_ClearFreeList(void); + +/* Return the line of code the frame is currently executing. */ +PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_FRAMEOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/funcobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/funcobject.h new file mode 100644 index 0000000..eb19f4c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/funcobject.h @@ -0,0 +1,76 @@ + +/* Function object interface */ + +#ifndef Py_FUNCOBJECT_H +#define Py_FUNCOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Function objects and code objects should not be confused with each other: + * + * Function objects are created by the execution of the 'def' statement. + * They reference a code object in their func_code attribute, which is a + * purely syntactic object, i.e. nothing more than a compiled version of some + * source code lines. There is one code object per source code "fragment", + * but each code object can be referenced by zero or many function objects + * depending only on how many times the 'def' statement in the source was + * executed so far. + */ + +typedef struct { + PyObject_HEAD + PyObject *func_code; /* A code object */ + PyObject *func_globals; /* A dictionary (other mappings won't do) */ + PyObject *func_defaults; /* NULL or a tuple */ + PyObject *func_closure; /* NULL or a tuple of cell objects */ + PyObject *func_doc; /* The __doc__ attribute, can be anything */ + PyObject *func_name; /* The __name__ attribute, a string object */ + PyObject *func_dict; /* The __dict__ attribute, a dict or NULL */ + PyObject *func_weakreflist; /* List of weak references */ + PyObject *func_module; /* The __module__ attribute, can be anything */ + + /* Invariant: + * func_closure contains the bindings for func_code->co_freevars, so + * PyTuple_Size(func_closure) == PyCode_GetNumFree(func_code) + * (func_closure may be NULL if PyCode_GetNumFree(func_code) == 0). + */ +} PyFunctionObject; + +PyAPI_DATA(PyTypeObject) PyFunction_Type; + +#define PyFunction_Check(op) (Py_TYPE(op) == &PyFunction_Type) + +PyAPI_FUNC(PyObject *) PyFunction_New(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyFunction_GetCode(PyObject *); +PyAPI_FUNC(PyObject *) PyFunction_GetGlobals(PyObject *); +PyAPI_FUNC(PyObject *) PyFunction_GetModule(PyObject *); +PyAPI_FUNC(PyObject *) PyFunction_GetDefaults(PyObject *); +PyAPI_FUNC(int) PyFunction_SetDefaults(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyFunction_GetClosure(PyObject *); +PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *); + +/* Macros for direct access to these values. Type checks are *not* + done, so use with care. */ +#define PyFunction_GET_CODE(func) \ + (((PyFunctionObject *)func) -> func_code) +#define PyFunction_GET_GLOBALS(func) \ + (((PyFunctionObject *)func) -> func_globals) +#define PyFunction_GET_MODULE(func) \ + (((PyFunctionObject *)func) -> func_module) +#define PyFunction_GET_DEFAULTS(func) \ + (((PyFunctionObject *)func) -> func_defaults) +#define PyFunction_GET_CLOSURE(func) \ + (((PyFunctionObject *)func) -> func_closure) + +/* The classmethod and staticmethod types lives here, too */ +PyAPI_DATA(PyTypeObject) PyClassMethod_Type; +PyAPI_DATA(PyTypeObject) PyStaticMethod_Type; + +PyAPI_FUNC(PyObject *) PyClassMethod_New(PyObject *); +PyAPI_FUNC(PyObject *) PyStaticMethod_New(PyObject *); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_FUNCOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/genobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/genobject.h new file mode 100644 index 0000000..135561b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/genobject.h @@ -0,0 +1,40 @@ + +/* Generator object interface */ + +#ifndef Py_GENOBJECT_H +#define Py_GENOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +struct _frame; /* Avoid including frameobject.h */ + +typedef struct { + PyObject_HEAD + /* The gi_ prefix is intended to remind of generator-iterator. */ + + /* Note: gi_frame can be NULL if the generator is "finished" */ + struct _frame *gi_frame; + + /* True if generator is being executed. */ + int gi_running; + + /* The code object backing the generator */ + PyObject *gi_code; + + /* List of weak reference. */ + PyObject *gi_weakreflist; +} PyGenObject; + +PyAPI_DATA(PyTypeObject) PyGen_Type; + +#define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type) +#define PyGen_CheckExact(op) (Py_TYPE(op) == &PyGen_Type) + +PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *); +PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_GENOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/graminit.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/graminit.h new file mode 100644 index 0000000..40d531e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/graminit.h @@ -0,0 +1,87 @@ +/* Generated by Parser/pgen */ + +#define single_input 256 +#define file_input 257 +#define eval_input 258 +#define decorator 259 +#define decorators 260 +#define decorated 261 +#define funcdef 262 +#define parameters 263 +#define varargslist 264 +#define fpdef 265 +#define fplist 266 +#define stmt 267 +#define simple_stmt 268 +#define small_stmt 269 +#define expr_stmt 270 +#define augassign 271 +#define print_stmt 272 +#define del_stmt 273 +#define pass_stmt 274 +#define flow_stmt 275 +#define break_stmt 276 +#define continue_stmt 277 +#define return_stmt 278 +#define yield_stmt 279 +#define raise_stmt 280 +#define import_stmt 281 +#define import_name 282 +#define import_from 283 +#define import_as_name 284 +#define dotted_as_name 285 +#define import_as_names 286 +#define dotted_as_names 287 +#define dotted_name 288 +#define global_stmt 289 +#define exec_stmt 290 +#define assert_stmt 291 +#define compound_stmt 292 +#define if_stmt 293 +#define while_stmt 294 +#define for_stmt 295 +#define try_stmt 296 +#define with_stmt 297 +#define with_item 298 +#define except_clause 299 +#define suite 300 +#define testlist_safe 301 +#define old_test 302 +#define old_lambdef 303 +#define test 304 +#define or_test 305 +#define and_test 306 +#define not_test 307 +#define comparison 308 +#define comp_op 309 +#define expr 310 +#define xor_expr 311 +#define and_expr 312 +#define shift_expr 313 +#define arith_expr 314 +#define term 315 +#define factor 316 +#define power 317 +#define atom 318 +#define listmaker 319 +#define testlist_comp 320 +#define lambdef 321 +#define trailer 322 +#define subscriptlist 323 +#define subscript 324 +#define sliceop 325 +#define exprlist 326 +#define testlist 327 +#define dictorsetmaker 328 +#define classdef 329 +#define arglist 330 +#define argument 331 +#define list_iter 332 +#define list_for 333 +#define list_if 334 +#define comp_iter 335 +#define comp_for 336 +#define comp_if 337 +#define testlist1 338 +#define encoding_decl 339 +#define yield_expr 340 diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/grammar.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/grammar.h new file mode 100644 index 0000000..8426da3 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/grammar.h @@ -0,0 +1,93 @@ + +/* Grammar interface */ + +#ifndef Py_GRAMMAR_H +#define Py_GRAMMAR_H +#ifdef __cplusplus +extern "C" { +#endif + +#include "bitset.h" /* Sigh... */ + +/* A label of an arc */ + +typedef struct { + int lb_type; + char *lb_str; +} label; + +#define EMPTY 0 /* Label number 0 is by definition the empty label */ + +/* A list of labels */ + +typedef struct { + int ll_nlabels; + label *ll_label; +} labellist; + +/* An arc from one state to another */ + +typedef struct { + short a_lbl; /* Label of this arc */ + short a_arrow; /* State where this arc goes to */ +} arc; + +/* A state in a DFA */ + +typedef struct { + int s_narcs; + arc *s_arc; /* Array of arcs */ + + /* Optional accelerators */ + int s_lower; /* Lowest label index */ + int s_upper; /* Highest label index */ + int *s_accel; /* Accelerator */ + int s_accept; /* Nonzero for accepting state */ +} state; + +/* A DFA */ + +typedef struct { + int d_type; /* Non-terminal this represents */ + char *d_name; /* For printing */ + int d_initial; /* Initial state */ + int d_nstates; + state *d_state; /* Array of states */ + bitset d_first; +} dfa; + +/* A grammar */ + +typedef struct { + int g_ndfas; + dfa *g_dfa; /* Array of DFAs */ + labellist g_ll; + int g_start; /* Start symbol of the grammar */ + int g_accel; /* Set if accelerators present */ +} grammar; + +/* FUNCTIONS */ + +grammar *newgrammar(int start); +dfa *adddfa(grammar *g, int type, char *name); +int addstate(dfa *d); +void addarc(dfa *d, int from, int to, int lbl); +dfa *PyGrammar_FindDFA(grammar *g, int type); + +int addlabel(labellist *ll, int type, char *str); +int findlabel(labellist *ll, int type, char *str); +char *PyGrammar_LabelRepr(label *lb); +void translatelabels(grammar *g); + +void addfirstsets(grammar *g); + +void PyGrammar_AddAccelerators(grammar *g); +void PyGrammar_RemoveAccelerators(grammar *); + +void printgrammar(grammar *g, FILE *fp); +void printnonterminals(grammar *g, FILE *fp); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_GRAMMAR_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/import.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/import.h new file mode 100644 index 0000000..89f51b5 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/import.h @@ -0,0 +1,71 @@ + +/* Module definition and import interface */ + +#ifndef Py_IMPORT_H +#define Py_IMPORT_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_FUNC(long) PyImport_GetMagicNumber(void); +PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(char *name, PyObject *co); +PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx( + char *name, PyObject *co, char *pathname); +PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void); +PyAPI_FUNC(PyObject *) PyImport_AddModule(const char *name); +PyAPI_FUNC(PyObject *) PyImport_ImportModule(const char *name); +PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(const char *); +PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(char *name, + PyObject *globals, PyObject *locals, PyObject *fromlist, int level); + +#define PyImport_ImportModuleEx(n, g, l, f) \ + PyImport_ImportModuleLevel(n, g, l, f, -1) + +PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path); +PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name); +PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m); +PyAPI_FUNC(void) PyImport_Cleanup(void); +PyAPI_FUNC(int) PyImport_ImportFrozenModule(char *); + +#ifdef WITH_THREAD +PyAPI_FUNC(void) _PyImport_AcquireLock(void); +PyAPI_FUNC(int) _PyImport_ReleaseLock(void); +#else +#define _PyImport_AcquireLock() +#define _PyImport_ReleaseLock() 1 +#endif + +PyAPI_FUNC(struct filedescr *) _PyImport_FindModule( + const char *, PyObject *, char *, size_t, FILE **, PyObject **); +PyAPI_FUNC(int) _PyImport_IsScript(struct filedescr *); +PyAPI_FUNC(void) _PyImport_ReInitLock(void); + +PyAPI_FUNC(PyObject *) _PyImport_FindExtension(char *, char *); +PyAPI_FUNC(PyObject *) _PyImport_FixupExtension(char *, char *); + +struct _inittab { + char *name; + void (*initfunc)(void); +}; + +PyAPI_DATA(PyTypeObject) PyNullImporter_Type; +PyAPI_DATA(struct _inittab *) PyImport_Inittab; + +PyAPI_FUNC(int) PyImport_AppendInittab(const char *name, void (*initfunc)(void)); +PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab); + +struct _frozen { + char *name; + unsigned char *code; + int size; +}; + +/* Embedding apps may change this pointer to point to their favorite + collection of frozen modules: */ + +PyAPI_DATA(struct _frozen *) PyImport_FrozenModules; + +#ifdef __cplusplus +} +#endif +#endif /* !Py_IMPORT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/intobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/intobject.h new file mode 100644 index 0000000..59d0616 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/intobject.h @@ -0,0 +1,81 @@ + +/* Integer object interface */ + +/* +PyIntObject represents a (long) integer. This is an immutable object; +an integer cannot change its value after creation. + +There are functions to create new integer objects, to test an object +for integer-ness, and to get the integer value. The latter functions +returns -1 and sets errno to EBADF if the object is not an PyIntObject. +None of the functions should be applied to nil objects. + +The type PyIntObject is (unfortunately) exposed here so we can declare +_Py_TrueStruct and _Py_ZeroStruct in boolobject.h; don't use this. +*/ + +#ifndef Py_INTOBJECT_H +#define Py_INTOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + PyObject_HEAD + long ob_ival; +} PyIntObject; + +PyAPI_DATA(PyTypeObject) PyInt_Type; + +#define PyInt_Check(op) \ + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_INT_SUBCLASS) +#define PyInt_CheckExact(op) (Py_TYPE(op) == &PyInt_Type) + +PyAPI_FUNC(PyObject *) PyInt_FromString(char*, char**, int); +#ifdef Py_USING_UNICODE +PyAPI_FUNC(PyObject *) PyInt_FromUnicode(Py_UNICODE*, Py_ssize_t, int); +#endif +PyAPI_FUNC(PyObject *) PyInt_FromLong(long); +PyAPI_FUNC(PyObject *) PyInt_FromSize_t(size_t); +PyAPI_FUNC(PyObject *) PyInt_FromSsize_t(Py_ssize_t); +PyAPI_FUNC(long) PyInt_AsLong(PyObject *); +PyAPI_FUNC(Py_ssize_t) PyInt_AsSsize_t(PyObject *); +PyAPI_FUNC(int) _PyInt_AsInt(PyObject *); +PyAPI_FUNC(unsigned long) PyInt_AsUnsignedLongMask(PyObject *); +#ifdef HAVE_LONG_LONG +PyAPI_FUNC(unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *); +#endif + +PyAPI_FUNC(long) PyInt_GetMax(void); + +/* Macro, trading safety for speed */ +#define PyInt_AS_LONG(op) (((PyIntObject *)(op))->ob_ival) + +/* These aren't really part of the Int object, but they're handy; the protos + * are necessary for systems that need the magic of PyAPI_FUNC and that want + * to have stropmodule as a dynamically loaded module instead of building it + * into the main Python shared library/DLL. Guido thinks I'm weird for + * building it this way. :-) [cjh] + */ +PyAPI_FUNC(unsigned long) PyOS_strtoul(char *, char **, int); +PyAPI_FUNC(long) PyOS_strtol(char *, char **, int); + +/* free list api */ +PyAPI_FUNC(int) PyInt_ClearFreeList(void); + +/* Convert an integer to the given base. Returns a string. + If base is 2, 8 or 16, add the proper prefix '0b', '0o' or '0x'. + If newstyle is zero, then use the pre-2.6 behavior of octal having + a leading "0" */ +PyAPI_FUNC(PyObject*) _PyInt_Format(PyIntObject* v, int base, int newstyle); + +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +PyAPI_FUNC(PyObject *) _PyInt_FormatAdvanced(PyObject *obj, + char *format_spec, + Py_ssize_t format_spec_len); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/intrcheck.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/intrcheck.h new file mode 100644 index 0000000..3b67ed0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/intrcheck.h @@ -0,0 +1,15 @@ + +#ifndef Py_INTRCHECK_H +#define Py_INTRCHECK_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_FUNC(int) PyOS_InterruptOccurred(void); +PyAPI_FUNC(void) PyOS_InitInterrupts(void); +PyAPI_FUNC(void) PyOS_AfterFork(void); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_INTRCHECK_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/iterobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/iterobject.h new file mode 100644 index 0000000..4bd19c2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/iterobject.h @@ -0,0 +1,23 @@ +#ifndef Py_ITEROBJECT_H +#define Py_ITEROBJECT_H +/* Iterators (the basic kind, over a sequence) */ +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_DATA(PyTypeObject) PySeqIter_Type; + +#define PySeqIter_Check(op) (Py_TYPE(op) == &PySeqIter_Type) + +PyAPI_FUNC(PyObject *) PySeqIter_New(PyObject *); + +PyAPI_DATA(PyTypeObject) PyCallIter_Type; + +#define PyCallIter_Check(op) (Py_TYPE(op) == &PyCallIter_Type) + +PyAPI_FUNC(PyObject *) PyCallIter_New(PyObject *, PyObject *); +#ifdef __cplusplus +} +#endif +#endif /* !Py_ITEROBJECT_H */ + diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/listobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/listobject.h new file mode 100644 index 0000000..f19b1c5 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/listobject.h @@ -0,0 +1,68 @@ + +/* List object interface */ + +/* +Another generally useful object type is a list of object pointers. +This is a mutable type: the list items can be changed, and items can be +added or removed. Out-of-range indices or non-list objects are ignored. + +*** WARNING *** PyList_SetItem does not increment the new item's reference +count, but does decrement the reference count of the item it replaces, +if not nil. It does *decrement* the reference count if it is *not* +inserted in the list. Similarly, PyList_GetItem does not increment the +returned item's reference count. +*/ + +#ifndef Py_LISTOBJECT_H +#define Py_LISTOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + PyObject_VAR_HEAD + /* Vector of pointers to list elements. list[0] is ob_item[0], etc. */ + PyObject **ob_item; + + /* ob_item contains space for 'allocated' elements. The number + * currently in use is ob_size. + * Invariants: + * 0 <= ob_size <= allocated + * len(list) == ob_size + * ob_item == NULL implies ob_size == allocated == 0 + * list.sort() temporarily sets allocated to -1 to detect mutations. + * + * Items must normally not be NULL, except during construction when + * the list is not yet visible outside the function that builds it. + */ + Py_ssize_t allocated; +} PyListObject; + +PyAPI_DATA(PyTypeObject) PyList_Type; + +#define PyList_Check(op) \ + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS) +#define PyList_CheckExact(op) (Py_TYPE(op) == &PyList_Type) + +PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size); +PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *); +PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, Py_ssize_t); +PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *); +PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *); +PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t); +PyAPI_FUNC(int) PyList_SetSlice(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *); +PyAPI_FUNC(int) PyList_Sort(PyObject *); +PyAPI_FUNC(int) PyList_Reverse(PyObject *); +PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *); +PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *); + +/* Macro, trading safety for speed */ +#define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i]) +#define PyList_SET_ITEM(op, i, v) (((PyListObject *)(op))->ob_item[i] = (v)) +#define PyList_GET_SIZE(op) Py_SIZE(op) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_LISTOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/longintrepr.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/longintrepr.h new file mode 100644 index 0000000..6425c30 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/longintrepr.h @@ -0,0 +1,103 @@ +#ifndef Py_LONGINTREPR_H +#define Py_LONGINTREPR_H +#ifdef __cplusplus +extern "C" { +#endif + + +/* This is published for the benefit of "friend" marshal.c only. */ + +/* Parameters of the long integer representation. There are two different + sets of parameters: one set for 30-bit digits, stored in an unsigned 32-bit + integer type, and one set for 15-bit digits with each digit stored in an + unsigned short. The value of PYLONG_BITS_IN_DIGIT, defined either at + configure time or in pyport.h, is used to decide which digit size to use. + + Type 'digit' should be able to hold 2*PyLong_BASE-1, and type 'twodigits' + should be an unsigned integer type able to hold all integers up to + PyLong_BASE*PyLong_BASE-1. x_sub assumes that 'digit' is an unsigned type, + and that overflow is handled by taking the result modulo 2**N for some N > + PyLong_SHIFT. The majority of the code doesn't care about the precise + value of PyLong_SHIFT, but there are some notable exceptions: + + - long_pow() requires that PyLong_SHIFT be divisible by 5 + + - PyLong_{As,From}ByteArray require that PyLong_SHIFT be at least 8 + + - long_hash() requires that PyLong_SHIFT is *strictly* less than the number + of bits in an unsigned long, as do the PyLong <-> long (or unsigned long) + conversion functions + + - the long <-> size_t/Py_ssize_t conversion functions expect that + PyLong_SHIFT is strictly less than the number of bits in a size_t + + - the marshal code currently expects that PyLong_SHIFT is a multiple of 15 + + The values 15 and 30 should fit all of the above requirements, on any + platform. +*/ + +#if PYLONG_BITS_IN_DIGIT == 30 +#if !(defined HAVE_UINT64_T && defined HAVE_UINT32_T && \ + defined HAVE_INT64_T && defined HAVE_INT32_T) +#error "30-bit long digits requested, but the necessary types are not available on this platform" +#endif +typedef PY_UINT32_T digit; +typedef PY_INT32_T sdigit; /* signed variant of digit */ +typedef PY_UINT64_T twodigits; +typedef PY_INT64_T stwodigits; /* signed variant of twodigits */ +#define PyLong_SHIFT 30 +#define _PyLong_DECIMAL_SHIFT 9 /* max(e such that 10**e fits in a digit) */ +#define _PyLong_DECIMAL_BASE ((digit)1000000000) /* 10 ** DECIMAL_SHIFT */ +#elif PYLONG_BITS_IN_DIGIT == 15 +typedef unsigned short digit; +typedef short sdigit; /* signed variant of digit */ +typedef unsigned long twodigits; +typedef long stwodigits; /* signed variant of twodigits */ +#define PyLong_SHIFT 15 +#define _PyLong_DECIMAL_SHIFT 4 /* max(e such that 10**e fits in a digit) */ +#define _PyLong_DECIMAL_BASE ((digit)10000) /* 10 ** DECIMAL_SHIFT */ +#else +#error "PYLONG_BITS_IN_DIGIT should be 15 or 30" +#endif +#define PyLong_BASE ((digit)1 << PyLong_SHIFT) +#define PyLong_MASK ((digit)(PyLong_BASE - 1)) + +/* b/w compatibility with Python 2.5 */ +#define SHIFT PyLong_SHIFT +#define BASE PyLong_BASE +#define MASK PyLong_MASK + +#if PyLong_SHIFT % 5 != 0 +#error "longobject.c requires that PyLong_SHIFT be divisible by 5" +#endif + +/* Long integer representation. + The absolute value of a number is equal to + SUM(for i=0 through abs(ob_size)-1) ob_digit[i] * 2**(SHIFT*i) + Negative numbers are represented with ob_size < 0; + zero is represented by ob_size == 0. + In a normalized number, ob_digit[abs(ob_size)-1] (the most significant + digit) is never zero. Also, in all cases, for all valid i, + 0 <= ob_digit[i] <= MASK. + The allocation function takes care of allocating extra memory + so that ob_digit[0] ... ob_digit[abs(ob_size)-1] are actually available. + + CAUTION: Generic code manipulating subtypes of PyVarObject has to + aware that longs abuse ob_size's sign bit. +*/ + +struct _longobject { + PyObject_VAR_HEAD + digit ob_digit[1]; +}; + +PyAPI_FUNC(PyLongObject *) _PyLong_New(Py_ssize_t); + +/* Return a copy of src. */ +PyAPI_FUNC(PyObject *) _PyLong_Copy(PyLongObject *src); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_LONGINTREPR_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/longobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/longobject.h new file mode 100644 index 0000000..4e33ff2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/longobject.h @@ -0,0 +1,135 @@ +#ifndef Py_LONGOBJECT_H +#define Py_LONGOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + + +/* Long (arbitrary precision) integer object interface */ + +typedef struct _longobject PyLongObject; /* Revealed in longintrepr.h */ + +PyAPI_DATA(PyTypeObject) PyLong_Type; + +#define PyLong_Check(op) \ + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS) +#define PyLong_CheckExact(op) (Py_TYPE(op) == &PyLong_Type) + +PyAPI_FUNC(PyObject *) PyLong_FromLong(long); +PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLong(unsigned long); +PyAPI_FUNC(PyObject *) PyLong_FromDouble(double); +PyAPI_FUNC(PyObject *) PyLong_FromSize_t(size_t); +PyAPI_FUNC(PyObject *) PyLong_FromSsize_t(Py_ssize_t); +PyAPI_FUNC(long) PyLong_AsLong(PyObject *); +PyAPI_FUNC(long) PyLong_AsLongAndOverflow(PyObject *, int *); +PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *); +PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLongMask(PyObject *); +PyAPI_FUNC(Py_ssize_t) PyLong_AsSsize_t(PyObject *); +PyAPI_FUNC(int) _PyLong_AsInt(PyObject *); +PyAPI_FUNC(PyObject *) PyLong_GetInfo(void); + +/* For use by intobject.c only */ +#define _PyLong_AsSsize_t PyLong_AsSsize_t +#define _PyLong_FromSize_t PyLong_FromSize_t +#define _PyLong_FromSsize_t PyLong_FromSsize_t +PyAPI_DATA(int) _PyLong_DigitValue[256]; + +/* _PyLong_Frexp returns a double x and an exponent e such that the + true value is approximately equal to x * 2**e. e is >= 0. x is + 0.0 if and only if the input is 0 (in which case, e and x are both + zeroes); otherwise, 0.5 <= abs(x) < 1.0. On overflow, which is + possible if the number of bits doesn't fit into a Py_ssize_t, sets + OverflowError and returns -1.0 for x, 0 for e. */ +PyAPI_FUNC(double) _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e); + +PyAPI_FUNC(double) PyLong_AsDouble(PyObject *); +PyAPI_FUNC(PyObject *) PyLong_FromVoidPtr(void *); +PyAPI_FUNC(void *) PyLong_AsVoidPtr(PyObject *); + +#ifdef HAVE_LONG_LONG +PyAPI_FUNC(PyObject *) PyLong_FromLongLong(PY_LONG_LONG); +PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG); +PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLong(PyObject *); +PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *); +PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *); +PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLongAndOverflow(PyObject *, int *); +#endif /* HAVE_LONG_LONG */ + +PyAPI_FUNC(PyObject *) PyLong_FromString(char *, char **, int); +#ifdef Py_USING_UNICODE +PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int); +#endif + +/* _PyLong_Sign. Return 0 if v is 0, -1 if v < 0, +1 if v > 0. + v must not be NULL, and must be a normalized long. + There are no error cases. +*/ +PyAPI_FUNC(int) _PyLong_Sign(PyObject *v); + + +/* _PyLong_NumBits. Return the number of bits needed to represent the + absolute value of a long. For example, this returns 1 for 1 and -1, 2 + for 2 and -2, and 2 for 3 and -3. It returns 0 for 0. + v must not be NULL, and must be a normalized long. + (size_t)-1 is returned and OverflowError set if the true result doesn't + fit in a size_t. +*/ +PyAPI_FUNC(size_t) _PyLong_NumBits(PyObject *v); + +/* _PyLong_FromByteArray: View the n unsigned bytes as a binary integer in + base 256, and return a Python long with the same numeric value. + If n is 0, the integer is 0. Else: + If little_endian is 1/true, bytes[n-1] is the MSB and bytes[0] the LSB; + else (little_endian is 0/false) bytes[0] is the MSB and bytes[n-1] the + LSB. + If is_signed is 0/false, view the bytes as a non-negative integer. + If is_signed is 1/true, view the bytes as a 2's-complement integer, + non-negative if bit 0x80 of the MSB is clear, negative if set. + Error returns: + + Return NULL with the appropriate exception set if there's not + enough memory to create the Python long. +*/ +PyAPI_FUNC(PyObject *) _PyLong_FromByteArray( + const unsigned char* bytes, size_t n, + int little_endian, int is_signed); + +/* _PyLong_AsByteArray: Convert the least-significant 8*n bits of long + v to a base-256 integer, stored in array bytes. Normally return 0, + return -1 on error. + If little_endian is 1/true, store the MSB at bytes[n-1] and the LSB at + bytes[0]; else (little_endian is 0/false) store the MSB at bytes[0] and + the LSB at bytes[n-1]. + If is_signed is 0/false, it's an error if v < 0; else (v >= 0) n bytes + are filled and there's nothing special about bit 0x80 of the MSB. + If is_signed is 1/true, bytes is filled with the 2's-complement + representation of v's value. Bit 0x80 of the MSB is the sign bit. + Error returns (-1): + + is_signed is 0 and v < 0. TypeError is set in this case, and bytes + isn't altered. + + n isn't big enough to hold the full mathematical value of v. For + example, if is_signed is 0 and there are more digits in the v than + fit in n; or if is_signed is 1, v < 0, and n is just 1 bit shy of + being large enough to hold a sign bit. OverflowError is set in this + case, but bytes holds the least-significant n bytes of the true value. +*/ +PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v, + unsigned char* bytes, size_t n, + int little_endian, int is_signed); + +/* _PyLong_Format: Convert the long to a string object with given base, + appending a base prefix of 0[box] if base is 2, 8 or 16. + Add a trailing "L" if addL is non-zero. + If newstyle is zero, then use the pre-2.6 behavior of octal having + a leading "0", instead of the prefix "0o" */ +PyAPI_FUNC(PyObject *) _PyLong_Format(PyObject *aa, int base, int addL, int newstyle); + +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +PyAPI_FUNC(PyObject *) _PyLong_FormatAdvanced(PyObject *obj, + char *format_spec, + Py_ssize_t format_spec_len); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_LONGOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/marshal.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/marshal.h new file mode 100644 index 0000000..411fdca --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/marshal.h @@ -0,0 +1,25 @@ + +/* Interface for marshal.c */ + +#ifndef Py_MARSHAL_H +#define Py_MARSHAL_H +#ifdef __cplusplus +extern "C" { +#endif + +#define Py_MARSHAL_VERSION 2 + +PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *, int); +PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *, int); +PyAPI_FUNC(PyObject *) PyMarshal_WriteObjectToString(PyObject *, int); + +PyAPI_FUNC(long) PyMarshal_ReadLongFromFile(FILE *); +PyAPI_FUNC(int) PyMarshal_ReadShortFromFile(FILE *); +PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromFile(FILE *); +PyAPI_FUNC(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *); +PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(char *, Py_ssize_t); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_MARSHAL_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/memoryobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/memoryobject.h new file mode 100644 index 0000000..e6a5c45 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/memoryobject.h @@ -0,0 +1,74 @@ +/* Memory view object. In Python this is available as "memoryview". */ + +#ifndef Py_MEMORYOBJECT_H +#define Py_MEMORYOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_DATA(PyTypeObject) PyMemoryView_Type; + +#define PyMemoryView_Check(op) (Py_TYPE(op) == &PyMemoryView_Type) + +/* Get a pointer to the underlying Py_buffer of a memoryview object. */ +#define PyMemoryView_GET_BUFFER(op) (&((PyMemoryViewObject *)(op))->view) +/* Get a pointer to the PyObject from which originates a memoryview object. */ +#define PyMemoryView_GET_BASE(op) (((PyMemoryViewObject *)(op))->view.obj) + + +PyAPI_FUNC(PyObject *) PyMemoryView_GetContiguous(PyObject *base, + int buffertype, + char fort); + + /* Return a contiguous chunk of memory representing the buffer + from an object in a memory view object. If a copy is made then the + base object for the memory view will be a *new* bytes object. + + Otherwise, the base-object will be the object itself and no + data-copying will be done. + + The buffertype argument can be PyBUF_READ, PyBUF_WRITE, + PyBUF_SHADOW to determine whether the returned buffer + should be READONLY, WRITABLE, or set to update the + original buffer if a copy must be made. If buffertype is + PyBUF_WRITE and the buffer is not contiguous an error will + be raised. In this circumstance, the user can use + PyBUF_SHADOW to ensure that a writable temporary + contiguous buffer is returned. The contents of this + contiguous buffer will be copied back into the original + object after the memoryview object is deleted as long as + the original object is writable and allows setting an + exclusive write lock. If this is not allowed by the + original object, then a BufferError is raised. + + If the object is multi-dimensional and if fortran is 'F', + the first dimension of the underlying array will vary the + fastest in the buffer. If fortran is 'C', then the last + dimension will vary the fastest (C-style contiguous). If + fortran is 'A', then it does not matter and you will get + whatever the object decides is more efficient. + + A new reference is returned that must be DECREF'd when finished. + */ + +PyAPI_FUNC(PyObject *) PyMemoryView_FromObject(PyObject *base); + +PyAPI_FUNC(PyObject *) PyMemoryView_FromBuffer(Py_buffer *info); + /* create new if bufptr is NULL + will be a new bytesobject in base */ + + +/* The struct is declared here so that macros can work, but it shouldn't + be considered public. Don't access those fields directly, use the macros + and functions instead! */ +typedef struct { + PyObject_HEAD + PyObject *base; + Py_buffer view; +} PyMemoryViewObject; + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_MEMORYOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/metagrammar.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/metagrammar.h new file mode 100644 index 0000000..15c8ef8 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/metagrammar.h @@ -0,0 +1,18 @@ +#ifndef Py_METAGRAMMAR_H +#define Py_METAGRAMMAR_H +#ifdef __cplusplus +extern "C" { +#endif + + +#define MSTART 256 +#define RULE 257 +#define RHS 258 +#define ALT 259 +#define ITEM 260 +#define ATOM 261 + +#ifdef __cplusplus +} +#endif +#endif /* !Py_METAGRAMMAR_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/methodobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/methodobject.h new file mode 100644 index 0000000..6e160b6 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/methodobject.h @@ -0,0 +1,93 @@ + +/* Method object interface */ + +#ifndef Py_METHODOBJECT_H +#define Py_METHODOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +/* This is about the type 'builtin_function_or_method', + not Python methods in user-defined classes. See classobject.h + for the latter. */ + +PyAPI_DATA(PyTypeObject) PyCFunction_Type; + +#define PyCFunction_Check(op) (Py_TYPE(op) == &PyCFunction_Type) + +typedef PyObject *(*PyCFunction)(PyObject *, PyObject *); +typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *, + PyObject *); +typedef PyObject *(*PyNoArgsFunction)(PyObject *); + +PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *); +PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *); +PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *); + +/* Macros for direct access to these values. Type checks are *not* + done, so use with care. */ +#define PyCFunction_GET_FUNCTION(func) \ + (((PyCFunctionObject *)func) -> m_ml -> ml_meth) +#define PyCFunction_GET_SELF(func) \ + (((PyCFunctionObject *)func) -> m_self) +#define PyCFunction_GET_FLAGS(func) \ + (((PyCFunctionObject *)func) -> m_ml -> ml_flags) +PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *); + +struct PyMethodDef { + const char *ml_name; /* The name of the built-in function/method */ + PyCFunction ml_meth; /* The C function that implements it */ + int ml_flags; /* Combination of METH_xxx flags, which mostly + describe the args expected by the C func */ + const char *ml_doc; /* The __doc__ attribute, or NULL */ +}; +typedef struct PyMethodDef PyMethodDef; + +PyAPI_FUNC(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, const char *); + +#define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL) +PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *, + PyObject *); + +/* Flag passed to newmethodobject */ +#define METH_OLDARGS 0x0000 +#define METH_VARARGS 0x0001 +#define METH_KEYWORDS 0x0002 +/* METH_NOARGS and METH_O must not be combined with the flags above. */ +#define METH_NOARGS 0x0004 +#define METH_O 0x0008 + +/* METH_CLASS and METH_STATIC are a little different; these control + the construction of methods for a class. These cannot be used for + functions in modules. */ +#define METH_CLASS 0x0010 +#define METH_STATIC 0x0020 + +/* METH_COEXIST allows a method to be entered eventhough a slot has + already filled the entry. When defined, the flag allows a separate + method, "__contains__" for example, to coexist with a defined + slot like sq_contains. */ + +#define METH_COEXIST 0x0040 + +typedef struct PyMethodChain { + PyMethodDef *methods; /* Methods of this type */ + struct PyMethodChain *link; /* NULL or base type */ +} PyMethodChain; + +PyAPI_FUNC(PyObject *) Py_FindMethodInChain(PyMethodChain *, PyObject *, + const char *); + +typedef struct { + PyObject_HEAD + PyMethodDef *m_ml; /* Description of the C function to call */ + PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */ + PyObject *m_module; /* The __module__ attribute, can be anything */ +} PyCFunctionObject; + +PyAPI_FUNC(int) PyCFunction_ClearFreeList(void); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_METHODOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/modsupport.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/modsupport.h new file mode 100644 index 0000000..d4dddef --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/modsupport.h @@ -0,0 +1,134 @@ + +#ifndef Py_MODSUPPORT_H +#define Py_MODSUPPORT_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Module support interface */ + +#include + +/* If PY_SSIZE_T_CLEAN is defined, each functions treats #-specifier + to mean Py_ssize_t */ +#ifdef PY_SSIZE_T_CLEAN +#define PyArg_Parse _PyArg_Parse_SizeT +#define PyArg_ParseTuple _PyArg_ParseTuple_SizeT +#define PyArg_ParseTupleAndKeywords _PyArg_ParseTupleAndKeywords_SizeT +#define PyArg_VaParse _PyArg_VaParse_SizeT +#define PyArg_VaParseTupleAndKeywords _PyArg_VaParseTupleAndKeywords_SizeT +#define Py_BuildValue _Py_BuildValue_SizeT +#define Py_VaBuildValue _Py_VaBuildValue_SizeT +#else +PyAPI_FUNC(PyObject *) _Py_VaBuildValue_SizeT(const char *, va_list); +#endif + +PyAPI_FUNC(int) PyArg_Parse(PyObject *, const char *, ...); +PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...) Py_FORMAT_PARSETUPLE(PyArg_ParseTuple, 2, 3); +PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *, + const char *, char **, ...); +PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, const char *, Py_ssize_t, Py_ssize_t, ...); +PyAPI_FUNC(PyObject *) Py_BuildValue(const char *, ...); +PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...); +PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kw); + +PyAPI_FUNC(int) PyArg_VaParse(PyObject *, const char *, va_list); +PyAPI_FUNC(int) PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *, + const char *, char **, va_list); +PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list); + +PyAPI_FUNC(int) PyModule_AddObject(PyObject *, const char *, PyObject *); +PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long); +PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char *); +#define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c) +#define PyModule_AddStringMacro(m, c) PyModule_AddStringConstant(m, #c, c) + +#define PYTHON_API_VERSION 1013 +#define PYTHON_API_STRING "1013" +/* The API version is maintained (independently from the Python version) + so we can detect mismatches between the interpreter and dynamically + loaded modules. These are diagnosed by an error message but + the module is still loaded (because the mismatch can only be tested + after loading the module). The error message is intended to + explain the core dump a few seconds later. + + The symbol PYTHON_API_STRING defines the same value as a string + literal. *** PLEASE MAKE SURE THE DEFINITIONS MATCH. *** + + Please add a line or two to the top of this log for each API + version change: + + 22-Feb-2006 MvL 1013 PEP 353 - long indices for sequence lengths + + 19-Aug-2002 GvR 1012 Changes to string object struct for + interning changes, saving 3 bytes. + + 17-Jul-2001 GvR 1011 Descr-branch, just to be on the safe side + + 25-Jan-2001 FLD 1010 Parameters added to PyCode_New() and + PyFrame_New(); Python 2.1a2 + + 14-Mar-2000 GvR 1009 Unicode API added + + 3-Jan-1999 GvR 1007 Decided to change back! (Don't reuse 1008!) + + 3-Dec-1998 GvR 1008 Python 1.5.2b1 + + 18-Jan-1997 GvR 1007 string interning and other speedups + + 11-Oct-1996 GvR renamed Py_Ellipses to Py_Ellipsis :-( + + 30-Jul-1996 GvR Slice and ellipses syntax added + + 23-Jul-1996 GvR For 1.4 -- better safe than sorry this time :-) + + 7-Nov-1995 GvR Keyword arguments (should've been done at 1.3 :-( ) + + 10-Jan-1995 GvR Renamed globals to new naming scheme + + 9-Jan-1995 GvR Initial version (incompatible with older API) +*/ + +#ifdef MS_WINDOWS +/* Special defines for Windows versions used to live here. Things + have changed, and the "Version" is now in a global string variable. + Reason for this is that this for easier branding of a "custom DLL" + without actually needing a recompile. */ +#endif /* MS_WINDOWS */ + +#if SIZEOF_SIZE_T != SIZEOF_INT +/* On a 64-bit system, rename the Py_InitModule4 so that 2.4 + modules cannot get loaded into a 2.5 interpreter */ +#define Py_InitModule4 Py_InitModule4_64 +#endif + +#ifdef Py_TRACE_REFS + /* When we are tracing reference counts, rename Py_InitModule4 so + modules compiled with incompatible settings will generate a + link-time error. */ + #if SIZEOF_SIZE_T != SIZEOF_INT + #undef Py_InitModule4 + #define Py_InitModule4 Py_InitModule4TraceRefs_64 + #else + #define Py_InitModule4 Py_InitModule4TraceRefs + #endif +#endif + +PyAPI_FUNC(PyObject *) Py_InitModule4(const char *name, PyMethodDef *methods, + const char *doc, PyObject *self, + int apiver); + +#define Py_InitModule(name, methods) \ + Py_InitModule4(name, methods, (char *)NULL, (PyObject *)NULL, \ + PYTHON_API_VERSION) + +#define Py_InitModule3(name, methods, doc) \ + Py_InitModule4(name, methods, doc, (PyObject *)NULL, \ + PYTHON_API_VERSION) + +PyAPI_DATA(char *) _Py_PackageContext; + +#ifdef __cplusplus +} +#endif +#endif /* !Py_MODSUPPORT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/moduleobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/moduleobject.h new file mode 100644 index 0000000..b387f5b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/moduleobject.h @@ -0,0 +1,24 @@ + +/* Module object interface */ + +#ifndef Py_MODULEOBJECT_H +#define Py_MODULEOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_DATA(PyTypeObject) PyModule_Type; + +#define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type) +#define PyModule_CheckExact(op) (Py_TYPE(op) == &PyModule_Type) + +PyAPI_FUNC(PyObject *) PyModule_New(const char *); +PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *); +PyAPI_FUNC(char *) PyModule_GetName(PyObject *); +PyAPI_FUNC(char *) PyModule_GetFilename(PyObject *); +PyAPI_FUNC(void) _PyModule_Clear(PyObject *); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_MODULEOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/node.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/node.h new file mode 100644 index 0000000..517c3dc --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/node.h @@ -0,0 +1,41 @@ + +/* Parse tree node interface */ + +#ifndef Py_NODE_H +#define Py_NODE_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _node { + short n_type; + char *n_str; + int n_lineno; + int n_col_offset; + int n_nchildren; + struct _node *n_child; +} node; + +PyAPI_FUNC(node *) PyNode_New(int type); +PyAPI_FUNC(int) PyNode_AddChild(node *n, int type, + char *str, int lineno, int col_offset); +PyAPI_FUNC(void) PyNode_Free(node *n); +PyAPI_FUNC(Py_ssize_t) _PyNode_SizeOf(node *n); + +/* Node access functions */ +#define NCH(n) ((n)->n_nchildren) + +#define CHILD(n, i) (&(n)->n_child[i]) +#define RCHILD(n, i) (CHILD(n, NCH(n) + i)) +#define TYPE(n) ((n)->n_type) +#define STR(n) ((n)->n_str) + +/* Assert that the type of a node is what we expect */ +#define REQ(n, type) assert(TYPE(n) == (type)) + +PyAPI_FUNC(void) PyNode_ListTree(node *); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_NODE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/object.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/object.h new file mode 100644 index 0000000..807b241 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/object.h @@ -0,0 +1,1046 @@ +#ifndef Py_OBJECT_H +#define Py_OBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + + +/* Object and type object interface */ + +/* +Objects are structures allocated on the heap. Special rules apply to +the use of objects to ensure they are properly garbage-collected. +Objects are never allocated statically or on the stack; they must be +accessed through special macros and functions only. (Type objects are +exceptions to the first rule; the standard types are represented by +statically initialized type objects, although work on type/class unification +for Python 2.2 made it possible to have heap-allocated type objects too). + +An object has a 'reference count' that is increased or decreased when a +pointer to the object is copied or deleted; when the reference count +reaches zero there are no references to the object left and it can be +removed from the heap. + +An object has a 'type' that determines what it represents and what kind +of data it contains. An object's type is fixed when it is created. +Types themselves are represented as objects; an object contains a +pointer to the corresponding type object. The type itself has a type +pointer pointing to the object representing the type 'type', which +contains a pointer to itself!). + +Objects do not float around in memory; once allocated an object keeps +the same size and address. Objects that must hold variable-size data +can contain pointers to variable-size parts of the object. Not all +objects of the same type have the same size; but the size cannot change +after allocation. (These restrictions are made so a reference to an +object can be simply a pointer -- moving an object would require +updating all the pointers, and changing an object's size would require +moving it if there was another object right next to it.) + +Objects are always accessed through pointers of the type 'PyObject *'. +The type 'PyObject' is a structure that only contains the reference count +and the type pointer. The actual memory allocated for an object +contains other data that can only be accessed after casting the pointer +to a pointer to a longer structure type. This longer type must start +with the reference count and type fields; the macro PyObject_HEAD should be +used for this (to accommodate for future changes). The implementation +of a particular object type can cast the object pointer to the proper +type and back. + +A standard interface exists for objects that contain an array of items +whose size is determined when the object is allocated. +*/ + +/* Py_DEBUG implies Py_TRACE_REFS. */ +#if defined(Py_DEBUG) && !defined(Py_TRACE_REFS) +#define Py_TRACE_REFS +#endif + +/* Py_TRACE_REFS implies Py_REF_DEBUG. */ +#if defined(Py_TRACE_REFS) && !defined(Py_REF_DEBUG) +#define Py_REF_DEBUG +#endif + +#ifdef Py_TRACE_REFS +/* Define pointers to support a doubly-linked list of all live heap objects. */ +#define _PyObject_HEAD_EXTRA \ + struct _object *_ob_next; \ + struct _object *_ob_prev; + +#define _PyObject_EXTRA_INIT 0, 0, + +#else +#define _PyObject_HEAD_EXTRA +#define _PyObject_EXTRA_INIT +#endif + +/* PyObject_HEAD defines the initial segment of every PyObject. */ +#define PyObject_HEAD \ + _PyObject_HEAD_EXTRA \ + Py_ssize_t ob_refcnt; \ + struct _typeobject *ob_type; + +#define PyObject_HEAD_INIT(type) \ + _PyObject_EXTRA_INIT \ + 1, type, + +#define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + +/* PyObject_VAR_HEAD defines the initial segment of all variable-size + * container objects. These end with a declaration of an array with 1 + * element, but enough space is malloc'ed so that the array actually + * has room for ob_size elements. Note that ob_size is an element count, + * not necessarily a byte count. + */ +#define PyObject_VAR_HEAD \ + PyObject_HEAD \ + Py_ssize_t ob_size; /* Number of items in variable part */ +#define Py_INVALID_SIZE (Py_ssize_t)-1 + +/* Nothing is actually declared to be a PyObject, but every pointer to + * a Python object can be cast to a PyObject*. This is inheritance built + * by hand. Similarly every pointer to a variable-size Python object can, + * in addition, be cast to PyVarObject*. + */ +typedef struct _object { + PyObject_HEAD +} PyObject; + +typedef struct { + PyObject_VAR_HEAD +} PyVarObject; + +#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) +#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) +#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + +/* +Type objects contain a string containing the type name (to help somewhat +in debugging), the allocation parameters (see PyObject_New() and +PyObject_NewVar()), +and methods for accessing objects of the type. Methods are optional, a +nil pointer meaning that particular kind of access is not available for +this type. The Py_DECREF() macro uses the tp_dealloc method without +checking for a nil pointer; it should always be implemented except if +the implementation can guarantee that the reference count will never +reach zero (e.g., for statically allocated type objects). + +NB: the methods for certain type groups are now contained in separate +method blocks. +*/ + +typedef PyObject * (*unaryfunc)(PyObject *); +typedef PyObject * (*binaryfunc)(PyObject *, PyObject *); +typedef PyObject * (*ternaryfunc)(PyObject *, PyObject *, PyObject *); +typedef int (*inquiry)(PyObject *); +typedef Py_ssize_t (*lenfunc)(PyObject *); +typedef int (*coercion)(PyObject **, PyObject **); +typedef PyObject *(*intargfunc)(PyObject *, int) Py_DEPRECATED(2.5); +typedef PyObject *(*intintargfunc)(PyObject *, int, int) Py_DEPRECATED(2.5); +typedef PyObject *(*ssizeargfunc)(PyObject *, Py_ssize_t); +typedef PyObject *(*ssizessizeargfunc)(PyObject *, Py_ssize_t, Py_ssize_t); +typedef int(*intobjargproc)(PyObject *, int, PyObject *); +typedef int(*intintobjargproc)(PyObject *, int, int, PyObject *); +typedef int(*ssizeobjargproc)(PyObject *, Py_ssize_t, PyObject *); +typedef int(*ssizessizeobjargproc)(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *); +typedef int(*objobjargproc)(PyObject *, PyObject *, PyObject *); + + + +/* int-based buffer interface */ +typedef int (*getreadbufferproc)(PyObject *, int, void **); +typedef int (*getwritebufferproc)(PyObject *, int, void **); +typedef int (*getsegcountproc)(PyObject *, int *); +typedef int (*getcharbufferproc)(PyObject *, int, char **); +/* ssize_t-based buffer interface */ +typedef Py_ssize_t (*readbufferproc)(PyObject *, Py_ssize_t, void **); +typedef Py_ssize_t (*writebufferproc)(PyObject *, Py_ssize_t, void **); +typedef Py_ssize_t (*segcountproc)(PyObject *, Py_ssize_t *); +typedef Py_ssize_t (*charbufferproc)(PyObject *, Py_ssize_t, char **); + + +/* Py3k buffer interface */ +typedef struct bufferinfo { + void *buf; + PyObject *obj; /* owned reference */ + Py_ssize_t len; + Py_ssize_t itemsize; /* This is Py_ssize_t so it can be + pointed to by strides in simple case.*/ + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + Py_ssize_t smalltable[2]; /* static store for shape and strides of + mono-dimensional buffers. */ + void *internal; +} Py_buffer; + +typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); +typedef void (*releasebufferproc)(PyObject *, Py_buffer *); + + /* Flags for getting buffers */ +#define PyBUF_SIMPLE 0 +#define PyBUF_WRITABLE 0x0001 +/* we used to include an E, backwards compatible alias */ +#define PyBUF_WRITEABLE PyBUF_WRITABLE +#define PyBUF_FORMAT 0x0004 +#define PyBUF_ND 0x0008 +#define PyBUF_STRIDES (0x0010 | PyBUF_ND) +#define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) +#define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) +#define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) +#define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#define PyBUF_CONTIG (PyBUF_ND | PyBUF_WRITABLE) +#define PyBUF_CONTIG_RO (PyBUF_ND) + +#define PyBUF_STRIDED (PyBUF_STRIDES | PyBUF_WRITABLE) +#define PyBUF_STRIDED_RO (PyBUF_STRIDES) + +#define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_WRITABLE | PyBUF_FORMAT) +#define PyBUF_RECORDS_RO (PyBUF_STRIDES | PyBUF_FORMAT) + +#define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_WRITABLE | PyBUF_FORMAT) +#define PyBUF_FULL_RO (PyBUF_INDIRECT | PyBUF_FORMAT) + + +#define PyBUF_READ 0x100 +#define PyBUF_WRITE 0x200 +#define PyBUF_SHADOW 0x400 +/* end Py3k buffer interface */ + +typedef int (*objobjproc)(PyObject *, PyObject *); +typedef int (*visitproc)(PyObject *, void *); +typedef int (*traverseproc)(PyObject *, visitproc, void *); + +typedef struct { + /* For numbers without flag bit Py_TPFLAGS_CHECKTYPES set, all + arguments are guaranteed to be of the object's type (modulo + coercion hacks -- i.e. if the type's coercion function + returns other types, then these are allowed as well). Numbers that + have the Py_TPFLAGS_CHECKTYPES flag bit set should check *both* + arguments for proper type and implement the necessary conversions + in the slot functions themselves. */ + + binaryfunc nb_add; + binaryfunc nb_subtract; + binaryfunc nb_multiply; + binaryfunc nb_divide; + binaryfunc nb_remainder; + binaryfunc nb_divmod; + ternaryfunc nb_power; + unaryfunc nb_negative; + unaryfunc nb_positive; + unaryfunc nb_absolute; + inquiry nb_nonzero; + unaryfunc nb_invert; + binaryfunc nb_lshift; + binaryfunc nb_rshift; + binaryfunc nb_and; + binaryfunc nb_xor; + binaryfunc nb_or; + coercion nb_coerce; + unaryfunc nb_int; + unaryfunc nb_long; + unaryfunc nb_float; + unaryfunc nb_oct; + unaryfunc nb_hex; + /* Added in release 2.0 */ + binaryfunc nb_inplace_add; + binaryfunc nb_inplace_subtract; + binaryfunc nb_inplace_multiply; + binaryfunc nb_inplace_divide; + binaryfunc nb_inplace_remainder; + ternaryfunc nb_inplace_power; + binaryfunc nb_inplace_lshift; + binaryfunc nb_inplace_rshift; + binaryfunc nb_inplace_and; + binaryfunc nb_inplace_xor; + binaryfunc nb_inplace_or; + + /* Added in release 2.2 */ + /* The following require the Py_TPFLAGS_HAVE_CLASS flag */ + binaryfunc nb_floor_divide; + binaryfunc nb_true_divide; + binaryfunc nb_inplace_floor_divide; + binaryfunc nb_inplace_true_divide; + + /* Added in release 2.5 */ + unaryfunc nb_index; +} PyNumberMethods; + +typedef struct { + lenfunc sq_length; + binaryfunc sq_concat; + ssizeargfunc sq_repeat; + ssizeargfunc sq_item; + ssizessizeargfunc sq_slice; + ssizeobjargproc sq_ass_item; + ssizessizeobjargproc sq_ass_slice; + objobjproc sq_contains; + /* Added in release 2.0 */ + binaryfunc sq_inplace_concat; + ssizeargfunc sq_inplace_repeat; +} PySequenceMethods; + +typedef struct { + lenfunc mp_length; + binaryfunc mp_subscript; + objobjargproc mp_ass_subscript; +} PyMappingMethods; + +typedef struct { + readbufferproc bf_getreadbuffer; + writebufferproc bf_getwritebuffer; + segcountproc bf_getsegcount; + charbufferproc bf_getcharbuffer; + getbufferproc bf_getbuffer; + releasebufferproc bf_releasebuffer; +} PyBufferProcs; + + +typedef void (*freefunc)(void *); +typedef void (*destructor)(PyObject *); +typedef int (*printfunc)(PyObject *, FILE *, int); +typedef PyObject *(*getattrfunc)(PyObject *, char *); +typedef PyObject *(*getattrofunc)(PyObject *, PyObject *); +typedef int (*setattrfunc)(PyObject *, char *, PyObject *); +typedef int (*setattrofunc)(PyObject *, PyObject *, PyObject *); +typedef int (*cmpfunc)(PyObject *, PyObject *); +typedef PyObject *(*reprfunc)(PyObject *); +typedef long (*hashfunc)(PyObject *); +typedef PyObject *(*richcmpfunc) (PyObject *, PyObject *, int); +typedef PyObject *(*getiterfunc) (PyObject *); +typedef PyObject *(*iternextfunc) (PyObject *); +typedef PyObject *(*descrgetfunc) (PyObject *, PyObject *, PyObject *); +typedef int (*descrsetfunc) (PyObject *, PyObject *, PyObject *); +typedef int (*initproc)(PyObject *, PyObject *, PyObject *); +typedef PyObject *(*newfunc)(struct _typeobject *, PyObject *, PyObject *); +typedef PyObject *(*allocfunc)(struct _typeobject *, Py_ssize_t); + +typedef struct _typeobject { + PyObject_VAR_HEAD + const char *tp_name; /* For printing, in format "." */ + Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */ + + /* Methods to implement standard operations */ + + destructor tp_dealloc; + printfunc tp_print; + getattrfunc tp_getattr; + setattrfunc tp_setattr; + cmpfunc tp_compare; + reprfunc tp_repr; + + /* Method suites for standard classes */ + + PyNumberMethods *tp_as_number; + PySequenceMethods *tp_as_sequence; + PyMappingMethods *tp_as_mapping; + + /* More standard operations (here for binary compatibility) */ + + hashfunc tp_hash; + ternaryfunc tp_call; + reprfunc tp_str; + getattrofunc tp_getattro; + setattrofunc tp_setattro; + + /* Functions to access object as input/output buffer */ + PyBufferProcs *tp_as_buffer; + + /* Flags to define presence of optional/expanded features */ + long tp_flags; + + const char *tp_doc; /* Documentation string */ + + /* Assigned meaning in release 2.0 */ + /* call function for all accessible objects */ + traverseproc tp_traverse; + + /* delete references to contained objects */ + inquiry tp_clear; + + /* Assigned meaning in release 2.1 */ + /* rich comparisons */ + richcmpfunc tp_richcompare; + + /* weak reference enabler */ + Py_ssize_t tp_weaklistoffset; + + /* Added in release 2.2 */ + /* Iterators */ + getiterfunc tp_iter; + iternextfunc tp_iternext; + + /* Attribute descriptor and subclassing stuff */ + struct PyMethodDef *tp_methods; + struct PyMemberDef *tp_members; + struct PyGetSetDef *tp_getset; + struct _typeobject *tp_base; + PyObject *tp_dict; + descrgetfunc tp_descr_get; + descrsetfunc tp_descr_set; + Py_ssize_t tp_dictoffset; + initproc tp_init; + allocfunc tp_alloc; + newfunc tp_new; + freefunc tp_free; /* Low-level free-memory routine */ + inquiry tp_is_gc; /* For PyObject_IS_GC */ + PyObject *tp_bases; + PyObject *tp_mro; /* method resolution order */ + PyObject *tp_cache; + PyObject *tp_subclasses; + PyObject *tp_weaklist; + destructor tp_del; + + /* Type attribute cache version tag. Added in version 2.6 */ + unsigned int tp_version_tag; + +#ifdef COUNT_ALLOCS + /* these must be last and never explicitly initialized */ + Py_ssize_t tp_allocs; + Py_ssize_t tp_frees; + Py_ssize_t tp_maxalloc; + struct _typeobject *tp_prev; + struct _typeobject *tp_next; +#endif +} PyTypeObject; + + +/* The *real* layout of a type object when allocated on the heap */ +typedef struct _heaptypeobject { + /* Note: there's a dependency on the order of these members + in slotptr() in typeobject.c . */ + PyTypeObject ht_type; + PyNumberMethods as_number; + PyMappingMethods as_mapping; + PySequenceMethods as_sequence; /* as_sequence comes after as_mapping, + so that the mapping wins when both + the mapping and the sequence define + a given operator (e.g. __getitem__). + see add_operators() in typeobject.c . */ + PyBufferProcs as_buffer; + PyObject *ht_name, *ht_slots; + /* here are optional user slots, followed by the members. */ +} PyHeapTypeObject; + +/* access macro to the members which are floating "behind" the object */ +#define PyHeapType_GET_MEMBERS(etype) \ + ((PyMemberDef *)(((char *)etype) + Py_TYPE(etype)->tp_basicsize)) + + +/* Generic type check */ +PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *); +#define PyObject_TypeCheck(ob, tp) \ + (Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp))) + +PyAPI_DATA(PyTypeObject) PyType_Type; /* built-in 'type' */ +PyAPI_DATA(PyTypeObject) PyBaseObject_Type; /* built-in 'object' */ +PyAPI_DATA(PyTypeObject) PySuper_Type; /* built-in 'super' */ + +#define PyType_Check(op) \ + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TYPE_SUBCLASS) +#define PyType_CheckExact(op) (Py_TYPE(op) == &PyType_Type) + +PyAPI_FUNC(int) PyType_Ready(PyTypeObject *); +PyAPI_FUNC(PyObject *) PyType_GenericAlloc(PyTypeObject *, Py_ssize_t); +PyAPI_FUNC(PyObject *) PyType_GenericNew(PyTypeObject *, + PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *); +PyAPI_FUNC(PyObject *) _PyObject_LookupSpecial(PyObject *, char *, PyObject **); +PyAPI_FUNC(unsigned int) PyType_ClearCache(void); +PyAPI_FUNC(void) PyType_Modified(PyTypeObject *); + +/* Generic operations on objects */ +PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int); +PyAPI_FUNC(void) _PyObject_Dump(PyObject *); +PyAPI_FUNC(PyObject *) PyObject_Repr(PyObject *); +PyAPI_FUNC(PyObject *) _PyObject_Str(PyObject *); +PyAPI_FUNC(PyObject *) PyObject_Str(PyObject *); +#define PyObject_Bytes PyObject_Str +#ifdef Py_USING_UNICODE +PyAPI_FUNC(PyObject *) PyObject_Unicode(PyObject *); +#endif +PyAPI_FUNC(int) PyObject_Compare(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyObject_RichCompare(PyObject *, PyObject *, int); +PyAPI_FUNC(int) PyObject_RichCompareBool(PyObject *, PyObject *, int); +PyAPI_FUNC(PyObject *) PyObject_GetAttrString(PyObject *, const char *); +PyAPI_FUNC(int) PyObject_SetAttrString(PyObject *, const char *, PyObject *); +PyAPI_FUNC(int) PyObject_HasAttrString(PyObject *, const char *); +PyAPI_FUNC(PyObject *) PyObject_GetAttr(PyObject *, PyObject *); +PyAPI_FUNC(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *); +PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *); +PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *); +PyAPI_FUNC(PyObject *) PyObject_SelfIter(PyObject *); +PyAPI_FUNC(PyObject *) _PyObject_NextNotImplemented(PyObject *); +PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *); +PyAPI_FUNC(int) PyObject_GenericSetAttr(PyObject *, + PyObject *, PyObject *); +PyAPI_FUNC(long) PyObject_Hash(PyObject *); +PyAPI_FUNC(long) PyObject_HashNotImplemented(PyObject *); +PyAPI_FUNC(int) PyObject_IsTrue(PyObject *); +PyAPI_FUNC(int) PyObject_Not(PyObject *); +PyAPI_FUNC(int) PyCallable_Check(PyObject *); +PyAPI_FUNC(int) PyNumber_Coerce(PyObject **, PyObject **); +PyAPI_FUNC(int) PyNumber_CoerceEx(PyObject **, PyObject **); + +PyAPI_FUNC(void) PyObject_ClearWeakRefs(PyObject *); + +/* A slot function whose address we need to compare */ +extern int _PyObject_SlotCompare(PyObject *, PyObject *); +/* Same as PyObject_Generic{Get,Set}Attr, but passing the attributes + dict as the last parameter. */ +PyAPI_FUNC(PyObject *) +_PyObject_GenericGetAttrWithDict(PyObject *, PyObject *, PyObject *); +PyAPI_FUNC(int) +_PyObject_GenericSetAttrWithDict(PyObject *, PyObject *, + PyObject *, PyObject *); + + +/* PyObject_Dir(obj) acts like Python __builtin__.dir(obj), returning a + list of strings. PyObject_Dir(NULL) is like __builtin__.dir(), + returning the names of the current locals. In this case, if there are + no current locals, NULL is returned, and PyErr_Occurred() is false. +*/ +PyAPI_FUNC(PyObject *) PyObject_Dir(PyObject *); + + +/* Helpers for printing recursive container types */ +PyAPI_FUNC(int) Py_ReprEnter(PyObject *); +PyAPI_FUNC(void) Py_ReprLeave(PyObject *); + +/* Helpers for hash functions */ +PyAPI_FUNC(long) _Py_HashDouble(double); +PyAPI_FUNC(long) _Py_HashPointer(void*); + +typedef struct { + long prefix; + long suffix; +} _Py_HashSecret_t; +PyAPI_DATA(_Py_HashSecret_t) _Py_HashSecret; + +#ifdef Py_DEBUG +PyAPI_DATA(int) _Py_HashSecret_Initialized; +#endif + +/* Helper for passing objects to printf and the like. + Leaks refcounts. Don't use it! +*/ +#define PyObject_REPR(obj) PyString_AS_STRING(PyObject_Repr(obj)) + +/* Flag bits for printing: */ +#define Py_PRINT_RAW 1 /* No string quotes etc. */ + +/* +`Type flags (tp_flags) + +These flags are used to extend the type structure in a backwards-compatible +fashion. Extensions can use the flags to indicate (and test) when a given +type structure contains a new feature. The Python core will use these when +introducing new functionality between major revisions (to avoid mid-version +changes in the PYTHON_API_VERSION). + +Arbitration of the flag bit positions will need to be coordinated among +all extension writers who publically release their extensions (this will +be fewer than you might expect!).. + +Python 1.5.2 introduced the bf_getcharbuffer slot into PyBufferProcs. + +Type definitions should use Py_TPFLAGS_DEFAULT for their tp_flags value. + +Code can use PyType_HasFeature(type_ob, flag_value) to test whether the +given type object has a specified feature. + +NOTE: when building the core, Py_TPFLAGS_DEFAULT includes +Py_TPFLAGS_HAVE_VERSION_TAG; outside the core, it doesn't. This is so +that extensions that modify tp_dict of their own types directly don't +break, since this was allowed in 2.5. In 3.0 they will have to +manually remove this flag though! +*/ + +/* PyBufferProcs contains bf_getcharbuffer */ +#define Py_TPFLAGS_HAVE_GETCHARBUFFER (1L<<0) + +/* PySequenceMethods contains sq_contains */ +#define Py_TPFLAGS_HAVE_SEQUENCE_IN (1L<<1) + +/* This is here for backwards compatibility. Extensions that use the old GC + * API will still compile but the objects will not be tracked by the GC. */ +#define Py_TPFLAGS_GC 0 /* used to be (1L<<2) */ + +/* PySequenceMethods and PyNumberMethods contain in-place operators */ +#define Py_TPFLAGS_HAVE_INPLACEOPS (1L<<3) + +/* PyNumberMethods do their own coercion */ +#define Py_TPFLAGS_CHECKTYPES (1L<<4) + +/* tp_richcompare is defined */ +#define Py_TPFLAGS_HAVE_RICHCOMPARE (1L<<5) + +/* Objects which are weakly referencable if their tp_weaklistoffset is >0 */ +#define Py_TPFLAGS_HAVE_WEAKREFS (1L<<6) + +/* tp_iter is defined */ +#define Py_TPFLAGS_HAVE_ITER (1L<<7) + +/* New members introduced by Python 2.2 exist */ +#define Py_TPFLAGS_HAVE_CLASS (1L<<8) + +/* Set if the type object is dynamically allocated */ +#define Py_TPFLAGS_HEAPTYPE (1L<<9) + +/* Set if the type allows subclassing */ +#define Py_TPFLAGS_BASETYPE (1L<<10) + +/* Set if the type is 'ready' -- fully initialized */ +#define Py_TPFLAGS_READY (1L<<12) + +/* Set while the type is being 'readied', to prevent recursive ready calls */ +#define Py_TPFLAGS_READYING (1L<<13) + +/* Objects support garbage collection (see objimp.h) */ +#define Py_TPFLAGS_HAVE_GC (1L<<14) + +/* These two bits are preserved for Stackless Python, next after this is 17 */ +#ifdef STACKLESS +#define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION (3L<<15) +#else +#define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION 0 +#endif + +/* Objects support nb_index in PyNumberMethods */ +#define Py_TPFLAGS_HAVE_INDEX (1L<<17) + +/* Objects support type attribute cache */ +#define Py_TPFLAGS_HAVE_VERSION_TAG (1L<<18) +#define Py_TPFLAGS_VALID_VERSION_TAG (1L<<19) + +/* Type is abstract and cannot be instantiated */ +#define Py_TPFLAGS_IS_ABSTRACT (1L<<20) + +/* Has the new buffer protocol */ +#define Py_TPFLAGS_HAVE_NEWBUFFER (1L<<21) + +/* These flags are used to determine if a type is a subclass. */ +#define Py_TPFLAGS_INT_SUBCLASS (1L<<23) +#define Py_TPFLAGS_LONG_SUBCLASS (1L<<24) +#define Py_TPFLAGS_LIST_SUBCLASS (1L<<25) +#define Py_TPFLAGS_TUPLE_SUBCLASS (1L<<26) +#define Py_TPFLAGS_STRING_SUBCLASS (1L<<27) +#define Py_TPFLAGS_UNICODE_SUBCLASS (1L<<28) +#define Py_TPFLAGS_DICT_SUBCLASS (1L<<29) +#define Py_TPFLAGS_BASE_EXC_SUBCLASS (1L<<30) +#define Py_TPFLAGS_TYPE_SUBCLASS (1L<<31) + +#define Py_TPFLAGS_DEFAULT_EXTERNAL ( \ + Py_TPFLAGS_HAVE_GETCHARBUFFER | \ + Py_TPFLAGS_HAVE_SEQUENCE_IN | \ + Py_TPFLAGS_HAVE_INPLACEOPS | \ + Py_TPFLAGS_HAVE_RICHCOMPARE | \ + Py_TPFLAGS_HAVE_WEAKREFS | \ + Py_TPFLAGS_HAVE_ITER | \ + Py_TPFLAGS_HAVE_CLASS | \ + Py_TPFLAGS_HAVE_STACKLESS_EXTENSION | \ + Py_TPFLAGS_HAVE_INDEX | \ + 0) +#define Py_TPFLAGS_DEFAULT_CORE (Py_TPFLAGS_DEFAULT_EXTERNAL | \ + Py_TPFLAGS_HAVE_VERSION_TAG) + +#ifdef Py_BUILD_CORE +#define Py_TPFLAGS_DEFAULT Py_TPFLAGS_DEFAULT_CORE +#else +#define Py_TPFLAGS_DEFAULT Py_TPFLAGS_DEFAULT_EXTERNAL +#endif + +#define PyType_HasFeature(t,f) (((t)->tp_flags & (f)) != 0) +#define PyType_FastSubclass(t,f) PyType_HasFeature(t,f) + + +/* +The macros Py_INCREF(op) and Py_DECREF(op) are used to increment or decrement +reference counts. Py_DECREF calls the object's deallocator function when +the refcount falls to 0; for +objects that don't contain references to other objects or heap memory +this can be the standard function free(). Both macros can be used +wherever a void expression is allowed. The argument must not be a +NULL pointer. If it may be NULL, use Py_XINCREF/Py_XDECREF instead. +The macro _Py_NewReference(op) initialize reference counts to 1, and +in special builds (Py_REF_DEBUG, Py_TRACE_REFS) performs additional +bookkeeping appropriate to the special build. + +We assume that the reference count field can never overflow; this can +be proven when the size of the field is the same as the pointer size, so +we ignore the possibility. Provided a C int is at least 32 bits (which +is implicitly assumed in many parts of this code), that's enough for +about 2**31 references to an object. + +XXX The following became out of date in Python 2.2, but I'm not sure +XXX what the full truth is now. Certainly, heap-allocated type objects +XXX can and should be deallocated. +Type objects should never be deallocated; the type pointer in an object +is not considered to be a reference to the type object, to save +complications in the deallocation function. (This is actually a +decision that's up to the implementer of each new type so if you want, +you can count such references to the type object.) + +*** WARNING*** The Py_DECREF macro must have a side-effect-free argument +since it may evaluate its argument multiple times. (The alternative +would be to mace it a proper function or assign it to a global temporary +variable first, both of which are slower; and in a multi-threaded +environment the global variable trick is not safe.) +*/ + +/* First define a pile of simple helper macros, one set per special + * build symbol. These either expand to the obvious things, or to + * nothing at all when the special mode isn't in effect. The main + * macros can later be defined just once then, yet expand to different + * things depending on which special build options are and aren't in effect. + * Trust me : while painful, this is 20x easier to understand than, + * e.g, defining _Py_NewReference five different times in a maze of nested + * #ifdefs (we used to do that -- it was impenetrable). + */ +#ifdef Py_REF_DEBUG +PyAPI_DATA(Py_ssize_t) _Py_RefTotal; +PyAPI_FUNC(void) _Py_NegativeRefcount(const char *fname, + int lineno, PyObject *op); +PyAPI_FUNC(PyObject *) _PyDict_Dummy(void); +PyAPI_FUNC(PyObject *) _PySet_Dummy(void); +PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void); +#define _Py_INC_REFTOTAL _Py_RefTotal++ +#define _Py_DEC_REFTOTAL _Py_RefTotal-- +#define _Py_REF_DEBUG_COMMA , +#define _Py_CHECK_REFCNT(OP) \ +{ if (((PyObject*)OP)->ob_refcnt < 0) \ + _Py_NegativeRefcount(__FILE__, __LINE__, \ + (PyObject *)(OP)); \ +} +#else +#define _Py_INC_REFTOTAL +#define _Py_DEC_REFTOTAL +#define _Py_REF_DEBUG_COMMA +#define _Py_CHECK_REFCNT(OP) /* a semicolon */; +#endif /* Py_REF_DEBUG */ + +#ifdef COUNT_ALLOCS +PyAPI_FUNC(void) inc_count(PyTypeObject *); +PyAPI_FUNC(void) dec_count(PyTypeObject *); +#define _Py_INC_TPALLOCS(OP) inc_count(Py_TYPE(OP)) +#define _Py_INC_TPFREES(OP) dec_count(Py_TYPE(OP)) +#define _Py_DEC_TPFREES(OP) Py_TYPE(OP)->tp_frees-- +#define _Py_COUNT_ALLOCS_COMMA , +#else +#define _Py_INC_TPALLOCS(OP) +#define _Py_INC_TPFREES(OP) +#define _Py_DEC_TPFREES(OP) +#define _Py_COUNT_ALLOCS_COMMA +#endif /* COUNT_ALLOCS */ + +#ifdef Py_TRACE_REFS +/* Py_TRACE_REFS is such major surgery that we call external routines. */ +PyAPI_FUNC(void) _Py_NewReference(PyObject *); +PyAPI_FUNC(void) _Py_ForgetReference(PyObject *); +PyAPI_FUNC(void) _Py_Dealloc(PyObject *); +PyAPI_FUNC(void) _Py_PrintReferences(FILE *); +PyAPI_FUNC(void) _Py_PrintReferenceAddresses(FILE *); +PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force); + +#else +/* Without Py_TRACE_REFS, there's little enough to do that we expand code + * inline. + */ +#define _Py_NewReference(op) ( \ + _Py_INC_TPALLOCS(op) _Py_COUNT_ALLOCS_COMMA \ + _Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA \ + Py_REFCNT(op) = 1) + +#define _Py_ForgetReference(op) _Py_INC_TPFREES(op) + +#define _Py_Dealloc(op) ( \ + _Py_INC_TPFREES(op) _Py_COUNT_ALLOCS_COMMA \ + (*Py_TYPE(op)->tp_dealloc)((PyObject *)(op))) +#endif /* !Py_TRACE_REFS */ + +#define Py_INCREF(op) ( \ + _Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA \ + ((PyObject*)(op))->ob_refcnt++) + +#define Py_DECREF(op) \ + do { \ + if (_Py_DEC_REFTOTAL _Py_REF_DEBUG_COMMA \ + --((PyObject*)(op))->ob_refcnt != 0) \ + _Py_CHECK_REFCNT(op) \ + else \ + _Py_Dealloc((PyObject *)(op)); \ + } while (0) + +/* Safely decref `op` and set `op` to NULL, especially useful in tp_clear + * and tp_dealloc implementations. + * + * Note that "the obvious" code can be deadly: + * + * Py_XDECREF(op); + * op = NULL; + * + * Typically, `op` is something like self->containee, and `self` is done + * using its `containee` member. In the code sequence above, suppose + * `containee` is non-NULL with a refcount of 1. Its refcount falls to + * 0 on the first line, which can trigger an arbitrary amount of code, + * possibly including finalizers (like __del__ methods or weakref callbacks) + * coded in Python, which in turn can release the GIL and allow other threads + * to run, etc. Such code may even invoke methods of `self` again, or cause + * cyclic gc to trigger, but-- oops! --self->containee still points to the + * object being torn down, and it may be in an insane state while being torn + * down. This has in fact been a rich historic source of miserable (rare & + * hard-to-diagnose) segfaulting (and other) bugs. + * + * The safe way is: + * + * Py_CLEAR(op); + * + * That arranges to set `op` to NULL _before_ decref'ing, so that any code + * triggered as a side-effect of `op` getting torn down no longer believes + * `op` points to a valid object. + * + * There are cases where it's safe to use the naive code, but they're brittle. + * For example, if `op` points to a Python integer, you know that destroying + * one of those can't cause problems -- but in part that relies on that + * Python integers aren't currently weakly referencable. Best practice is + * to use Py_CLEAR() even if you can't think of a reason for why you need to. + */ +#define Py_CLEAR(op) \ + do { \ + if (op) { \ + PyObject *_py_tmp = (PyObject *)(op); \ + (op) = NULL; \ + Py_DECREF(_py_tmp); \ + } \ + } while (0) + +/* Macros to use in case the object pointer may be NULL: */ +#define Py_XINCREF(op) do { if ((op) == NULL) ; else Py_INCREF(op); } while (0) +#define Py_XDECREF(op) do { if ((op) == NULL) ; else Py_DECREF(op); } while (0) + +/* Safely decref `op` and set `op` to `op2`. + * + * As in case of Py_CLEAR "the obvious" code can be deadly: + * + * Py_DECREF(op); + * op = op2; + * + * The safe way is: + * + * Py_SETREF(op, op2); + * + * That arranges to set `op` to `op2` _before_ decref'ing, so that any code + * triggered as a side-effect of `op` getting torn down no longer believes + * `op` points to a valid object. + * + * Py_XSETREF is a variant of Py_SETREF that uses Py_XDECREF instead of + * Py_DECREF. + */ + +#define Py_SETREF(op, op2) \ + do { \ + PyObject *_py_tmp = (PyObject *)(op); \ + (op) = (op2); \ + Py_DECREF(_py_tmp); \ + } while (0) + +#define Py_XSETREF(op, op2) \ + do { \ + PyObject *_py_tmp = (PyObject *)(op); \ + (op) = (op2); \ + Py_XDECREF(_py_tmp); \ + } while (0) + +/* +These are provided as conveniences to Python runtime embedders, so that +they can have object code that is not dependent on Python compilation flags. +*/ +PyAPI_FUNC(void) Py_IncRef(PyObject *); +PyAPI_FUNC(void) Py_DecRef(PyObject *); + +/* +_Py_NoneStruct is an object of undefined type which can be used in contexts +where NULL (nil) is not suitable (since NULL often means 'error'). + +Don't forget to apply Py_INCREF() when returning this value!!! +*/ +PyAPI_DATA(PyObject) _Py_NoneStruct; /* Don't use this directly */ +#define Py_None (&_Py_NoneStruct) + +/* Macro for returning Py_None from a function */ +#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None + +/* +Py_NotImplemented is a singleton used to signal that an operation is +not implemented for a given type combination. +*/ +PyAPI_DATA(PyObject) _Py_NotImplementedStruct; /* Don't use this directly */ +#define Py_NotImplemented (&_Py_NotImplementedStruct) + +/* Rich comparison opcodes */ +#define Py_LT 0 +#define Py_LE 1 +#define Py_EQ 2 +#define Py_NE 3 +#define Py_GT 4 +#define Py_GE 5 + +/* Maps Py_LT to Py_GT, ..., Py_GE to Py_LE. + * Defined in object.c. + */ +PyAPI_DATA(int) _Py_SwappedOp[]; + +/* +Define staticforward and statichere for source compatibility with old +C extensions. + +The staticforward define was needed to support certain broken C +compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the +static keyword when it was used with a forward declaration of a static +initialized structure. Standard C allows the forward declaration with +static, and we've decided to stop catering to broken C compilers. +(In fact, we expect that the compilers are all fixed eight years later.) +*/ + +#define staticforward static +#define statichere static + + +/* +More conventions +================ + +Argument Checking +----------------- + +Functions that take objects as arguments normally don't check for nil +arguments, but they do check the type of the argument, and return an +error if the function doesn't apply to the type. + +Failure Modes +------------- + +Functions may fail for a variety of reasons, including running out of +memory. This is communicated to the caller in two ways: an error string +is set (see errors.h), and the function result differs: functions that +normally return a pointer return NULL for failure, functions returning +an integer return -1 (which could be a legal return value too!), and +other functions return 0 for success and -1 for failure. +Callers should always check for errors before using the result. If +an error was set, the caller must either explicitly clear it, or pass +the error on to its caller. + +Reference Counts +---------------- + +It takes a while to get used to the proper usage of reference counts. + +Functions that create an object set the reference count to 1; such new +objects must be stored somewhere or destroyed again with Py_DECREF(). +Some functions that 'store' objects, such as PyTuple_SetItem() and +PyList_SetItem(), +don't increment the reference count of the object, since the most +frequent use is to store a fresh object. Functions that 'retrieve' +objects, such as PyTuple_GetItem() and PyDict_GetItemString(), also +don't increment +the reference count, since most frequently the object is only looked at +quickly. Thus, to retrieve an object and store it again, the caller +must call Py_INCREF() explicitly. + +NOTE: functions that 'consume' a reference count, like +PyList_SetItem(), consume the reference even if the object wasn't +successfully stored, to simplify error handling. + +It seems attractive to make other functions that take an object as +argument consume a reference count; however, this may quickly get +confusing (even the current practice is already confusing). Consider +it carefully, it may save lots of calls to Py_INCREF() and Py_DECREF() at +times. +*/ + + +/* Trashcan mechanism, thanks to Christian Tismer. + +When deallocating a container object, it's possible to trigger an unbounded +chain of deallocations, as each Py_DECREF in turn drops the refcount on "the +next" object in the chain to 0. This can easily lead to stack faults, and +especially in threads (which typically have less stack space to work with). + +A container object that participates in cyclic gc can avoid this by +bracketing the body of its tp_dealloc function with a pair of macros: + +static void +mytype_dealloc(mytype *p) +{ + ... declarations go here ... + + PyObject_GC_UnTrack(p); // must untrack first + Py_TRASHCAN_SAFE_BEGIN(p) + ... The body of the deallocator goes here, including all calls ... + ... to Py_DECREF on contained objects. ... + Py_TRASHCAN_SAFE_END(p) +} + +CAUTION: Never return from the middle of the body! If the body needs to +"get out early", put a label immediately before the Py_TRASHCAN_SAFE_END +call, and goto it. Else the call-depth counter (see below) will stay +above 0 forever, and the trashcan will never get emptied. + +How it works: The BEGIN macro increments a call-depth counter. So long +as this counter is small, the body of the deallocator is run directly without +further ado. But if the counter gets large, it instead adds p to a list of +objects to be deallocated later, skips the body of the deallocator, and +resumes execution after the END macro. The tp_dealloc routine then returns +without deallocating anything (and so unbounded call-stack depth is avoided). + +When the call stack finishes unwinding again, code generated by the END macro +notices this, and calls another routine to deallocate all the objects that +may have been added to the list of deferred deallocations. In effect, a +chain of N deallocations is broken into N / PyTrash_UNWIND_LEVEL pieces, +with the call stack never exceeding a depth of PyTrash_UNWIND_LEVEL. +*/ + +/* This is the old private API, invoked by the macros before 2.7.4. + Kept for binary compatibility of extensions. */ +PyAPI_FUNC(void) _PyTrash_deposit_object(PyObject*); +PyAPI_FUNC(void) _PyTrash_destroy_chain(void); +PyAPI_DATA(int) _PyTrash_delete_nesting; +PyAPI_DATA(PyObject *) _PyTrash_delete_later; + +/* The new thread-safe private API, invoked by the macros below. */ +PyAPI_FUNC(void) _PyTrash_thread_deposit_object(PyObject*); +PyAPI_FUNC(void) _PyTrash_thread_destroy_chain(void); + +#define PyTrash_UNWIND_LEVEL 50 + +/* Note the workaround for when the thread state is NULL (issue #17703) */ +#define Py_TRASHCAN_SAFE_BEGIN(op) \ + do { \ + PyThreadState *_tstate = PyThreadState_GET(); \ + if (!_tstate || \ + _tstate->trash_delete_nesting < PyTrash_UNWIND_LEVEL) { \ + if (_tstate) \ + ++_tstate->trash_delete_nesting; + /* The body of the deallocator is here. */ +#define Py_TRASHCAN_SAFE_END(op) \ + if (_tstate) { \ + --_tstate->trash_delete_nesting; \ + if (_tstate->trash_delete_later \ + && _tstate->trash_delete_nesting <= 0) \ + _PyTrash_thread_destroy_chain(); \ + } \ + } \ + else \ + _PyTrash_thread_deposit_object((PyObject*)op); \ + } while (0); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_OBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/objimpl.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/objimpl.h new file mode 100644 index 0000000..cbf6bc3 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/objimpl.h @@ -0,0 +1,369 @@ +/* The PyObject_ memory family: high-level object memory interfaces. + See pymem.h for the low-level PyMem_ family. +*/ + +#ifndef Py_OBJIMPL_H +#define Py_OBJIMPL_H + +#include "pymem.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* BEWARE: + + Each interface exports both functions and macros. Extension modules should + use the functions, to ensure binary compatibility across Python versions. + Because the Python implementation is free to change internal details, and + the macros may (or may not) expose details for speed, if you do use the + macros you must recompile your extensions with each Python release. + + Never mix calls to PyObject_ memory functions with calls to the platform + malloc/realloc/ calloc/free, or with calls to PyMem_. +*/ + +/* +Functions and macros for modules that implement new object types. + + - PyObject_New(type, typeobj) allocates memory for a new object of the given + type, and initializes part of it. 'type' must be the C structure type used + to represent the object, and 'typeobj' the address of the corresponding + type object. Reference count and type pointer are filled in; the rest of + the bytes of the object are *undefined*! The resulting expression type is + 'type *'. The size of the object is determined by the tp_basicsize field + of the type object. + + - PyObject_NewVar(type, typeobj, n) is similar but allocates a variable-size + object with room for n items. In addition to the refcount and type pointer + fields, this also fills in the ob_size field. + + - PyObject_Del(op) releases the memory allocated for an object. It does not + run a destructor -- it only frees the memory. PyObject_Free is identical. + + - PyObject_Init(op, typeobj) and PyObject_InitVar(op, typeobj, n) don't + allocate memory. Instead of a 'type' parameter, they take a pointer to a + new object (allocated by an arbitrary allocator), and initialize its object + header fields. + +Note that objects created with PyObject_{New, NewVar} are allocated using the +specialized Python allocator (implemented in obmalloc.c), if WITH_PYMALLOC is +enabled. In addition, a special debugging allocator is used if PYMALLOC_DEBUG +is also #defined. + +In case a specific form of memory management is needed (for example, if you +must use the platform malloc heap(s), or shared memory, or C++ local storage or +operator new), you must first allocate the object with your custom allocator, +then pass its pointer to PyObject_{Init, InitVar} for filling in its Python- +specific fields: reference count, type pointer, possibly others. You should +be aware that Python has no control over these objects because they don't +cooperate with the Python memory manager. Such objects may not be eligible +for automatic garbage collection and you have to make sure that they are +released accordingly whenever their destructor gets called (cf. the specific +form of memory management you're using). + +Unless you have specific memory management requirements, use +PyObject_{New, NewVar, Del}. +*/ + +/* + * Raw object memory interface + * =========================== + */ + +/* Functions to call the same malloc/realloc/free as used by Python's + object allocator. If WITH_PYMALLOC is enabled, these may differ from + the platform malloc/realloc/free. The Python object allocator is + designed for fast, cache-conscious allocation of many "small" objects, + and with low hidden memory overhead. + + PyObject_Malloc(0) returns a unique non-NULL pointer if possible. + + PyObject_Realloc(NULL, n) acts like PyObject_Malloc(n). + PyObject_Realloc(p != NULL, 0) does not return NULL, or free the memory + at p. + + Returned pointers must be checked for NULL explicitly; no action is + performed on failure other than to return NULL (no warning it printed, no + exception is set, etc). + + For allocating objects, use PyObject_{New, NewVar} instead whenever + possible. The PyObject_{Malloc, Realloc, Free} family is exposed + so that you can exploit Python's small-block allocator for non-object + uses. If you must use these routines to allocate object memory, make sure + the object gets initialized via PyObject_{Init, InitVar} after obtaining + the raw memory. +*/ +PyAPI_FUNC(void *) PyObject_Malloc(size_t); +PyAPI_FUNC(void *) PyObject_Realloc(void *, size_t); +PyAPI_FUNC(void) PyObject_Free(void *); + + +/* Macros */ +#ifdef WITH_PYMALLOC +#ifdef PYMALLOC_DEBUG /* WITH_PYMALLOC && PYMALLOC_DEBUG */ +PyAPI_FUNC(void *) _PyObject_DebugMalloc(size_t nbytes); +PyAPI_FUNC(void *) _PyObject_DebugRealloc(void *p, size_t nbytes); +PyAPI_FUNC(void) _PyObject_DebugFree(void *p); +PyAPI_FUNC(void) _PyObject_DebugDumpAddress(const void *p); +PyAPI_FUNC(void) _PyObject_DebugCheckAddress(const void *p); +PyAPI_FUNC(void) _PyObject_DebugMallocStats(void); +PyAPI_FUNC(void *) _PyObject_DebugMallocApi(char api, size_t nbytes); +PyAPI_FUNC(void *) _PyObject_DebugReallocApi(char api, void *p, size_t nbytes); +PyAPI_FUNC(void) _PyObject_DebugFreeApi(char api, void *p); +PyAPI_FUNC(void) _PyObject_DebugCheckAddressApi(char api, const void *p); +PyAPI_FUNC(void *) _PyMem_DebugMalloc(size_t nbytes); +PyAPI_FUNC(void *) _PyMem_DebugRealloc(void *p, size_t nbytes); +PyAPI_FUNC(void) _PyMem_DebugFree(void *p); +#define PyObject_MALLOC _PyObject_DebugMalloc +#define PyObject_Malloc _PyObject_DebugMalloc +#define PyObject_REALLOC _PyObject_DebugRealloc +#define PyObject_Realloc _PyObject_DebugRealloc +#define PyObject_FREE _PyObject_DebugFree +#define PyObject_Free _PyObject_DebugFree + +#else /* WITH_PYMALLOC && ! PYMALLOC_DEBUG */ +#define PyObject_MALLOC PyObject_Malloc +#define PyObject_REALLOC PyObject_Realloc +#define PyObject_FREE PyObject_Free +#endif + +#else /* ! WITH_PYMALLOC */ +#define PyObject_MALLOC PyMem_MALLOC +#define PyObject_REALLOC PyMem_REALLOC +#define PyObject_FREE PyMem_FREE + +#endif /* WITH_PYMALLOC */ + +#define PyObject_Del PyObject_Free +#define PyObject_DEL PyObject_FREE + +/* for source compatibility with 2.2 */ +#define _PyObject_Del PyObject_Free + +/* + * Generic object allocator interface + * ================================== + */ + +/* Functions */ +PyAPI_FUNC(PyObject *) PyObject_Init(PyObject *, PyTypeObject *); +PyAPI_FUNC(PyVarObject *) PyObject_InitVar(PyVarObject *, + PyTypeObject *, Py_ssize_t); +PyAPI_FUNC(PyObject *) _PyObject_New(PyTypeObject *); +PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t); + +#define PyObject_New(type, typeobj) \ + ( (type *) _PyObject_New(typeobj) ) +#define PyObject_NewVar(type, typeobj, n) \ + ( (type *) _PyObject_NewVar((typeobj), (n)) ) + +/* Macros trading binary compatibility for speed. See also pymem.h. + Note that these macros expect non-NULL object pointers.*/ +#define PyObject_INIT(op, typeobj) \ + ( Py_TYPE(op) = (typeobj), _Py_NewReference((PyObject *)(op)), (op) ) +#define PyObject_INIT_VAR(op, typeobj, size) \ + ( Py_SIZE(op) = (size), PyObject_INIT((op), (typeobj)) ) + +#define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize ) + +/* _PyObject_VAR_SIZE returns the number of bytes (as size_t) allocated for a + vrbl-size object with nitems items, exclusive of gc overhead (if any). The + value is rounded up to the closest multiple of sizeof(void *), in order to + ensure that pointer fields at the end of the object are correctly aligned + for the platform (this is of special importance for subclasses of, e.g., + str or long, so that pointers can be stored after the embedded data). + + Note that there's no memory wastage in doing this, as malloc has to + return (at worst) pointer-aligned memory anyway. +*/ +#if ((SIZEOF_VOID_P - 1) & SIZEOF_VOID_P) != 0 +# error "_PyObject_VAR_SIZE requires SIZEOF_VOID_P be a power of 2" +#endif + +#define _PyObject_VAR_SIZE(typeobj, nitems) \ + (size_t) \ + ( ( (typeobj)->tp_basicsize + \ + (nitems)*(typeobj)->tp_itemsize + \ + (SIZEOF_VOID_P - 1) \ + ) & ~(SIZEOF_VOID_P - 1) \ + ) + +#define PyObject_NEW(type, typeobj) \ +( (type *) PyObject_Init( \ + (PyObject *) PyObject_MALLOC( _PyObject_SIZE(typeobj) ), (typeobj)) ) + +#define PyObject_NEW_VAR(type, typeobj, n) \ +( (type *) PyObject_InitVar( \ + (PyVarObject *) PyObject_MALLOC(_PyObject_VAR_SIZE((typeobj),(n)) ),\ + (typeobj), (n)) ) + +/* This example code implements an object constructor with a custom + allocator, where PyObject_New is inlined, and shows the important + distinction between two steps (at least): + 1) the actual allocation of the object storage; + 2) the initialization of the Python specific fields + in this storage with PyObject_{Init, InitVar}. + + PyObject * + YourObject_New(...) + { + PyObject *op; + + op = (PyObject *) Your_Allocator(_PyObject_SIZE(YourTypeStruct)); + if (op == NULL) + return PyErr_NoMemory(); + + PyObject_Init(op, &YourTypeStruct); + + op->ob_field = value; + ... + return op; + } + + Note that in C++, the use of the new operator usually implies that + the 1st step is performed automatically for you, so in a C++ class + constructor you would start directly with PyObject_Init/InitVar +*/ + +/* + * Garbage Collection Support + * ========================== + */ + +/* C equivalent of gc.collect(). */ +PyAPI_FUNC(Py_ssize_t) PyGC_Collect(void); + +/* Test if a type has a GC head */ +#define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC) + +/* Test if an object has a GC head */ +#define PyObject_IS_GC(o) (PyType_IS_GC(Py_TYPE(o)) && \ + (Py_TYPE(o)->tp_is_gc == NULL || Py_TYPE(o)->tp_is_gc(o))) + +PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, Py_ssize_t); +#define PyObject_GC_Resize(type, op, n) \ + ( (type *) _PyObject_GC_Resize((PyVarObject *)(op), (n)) ) + +/* for source compatibility with 2.2 */ +#define _PyObject_GC_Del PyObject_GC_Del + +/* + * Former over-aligned definition of PyGC_Head, used to compute the size of the + * padding for the new version below. + */ +union _gc_head; +union _gc_head_old { + struct { + union _gc_head_old *gc_next; + union _gc_head_old *gc_prev; + Py_ssize_t gc_refs; + } gc; + long double dummy; +}; + +/* GC information is stored BEFORE the object structure. */ +typedef union _gc_head { + struct { + union _gc_head *gc_next; + union _gc_head *gc_prev; + Py_ssize_t gc_refs; + } gc; + double dummy; /* Force at least 8-byte alignment. */ + char dummy_padding[sizeof(union _gc_head_old)]; +} PyGC_Head; + +extern PyGC_Head *_PyGC_generation0; + +#define _Py_AS_GC(o) ((PyGC_Head *)(o)-1) + +#define _PyGC_REFS_UNTRACKED (-2) +#define _PyGC_REFS_REACHABLE (-3) +#define _PyGC_REFS_TENTATIVELY_UNREACHABLE (-4) + +/* Tell the GC to track this object. NB: While the object is tracked the + * collector it must be safe to call the ob_traverse method. */ +#define _PyObject_GC_TRACK(o) do { \ + PyGC_Head *g = _Py_AS_GC(o); \ + if (g->gc.gc_refs != _PyGC_REFS_UNTRACKED) \ + Py_FatalError("GC object already tracked"); \ + g->gc.gc_refs = _PyGC_REFS_REACHABLE; \ + g->gc.gc_next = _PyGC_generation0; \ + g->gc.gc_prev = _PyGC_generation0->gc.gc_prev; \ + g->gc.gc_prev->gc.gc_next = g; \ + _PyGC_generation0->gc.gc_prev = g; \ + } while (0); + +/* Tell the GC to stop tracking this object. + * gc_next doesn't need to be set to NULL, but doing so is a good + * way to provoke memory errors if calling code is confused. + */ +#define _PyObject_GC_UNTRACK(o) do { \ + PyGC_Head *g = _Py_AS_GC(o); \ + assert(g->gc.gc_refs != _PyGC_REFS_UNTRACKED); \ + g->gc.gc_refs = _PyGC_REFS_UNTRACKED; \ + g->gc.gc_prev->gc.gc_next = g->gc.gc_next; \ + g->gc.gc_next->gc.gc_prev = g->gc.gc_prev; \ + g->gc.gc_next = NULL; \ + } while (0); + +/* True if the object is currently tracked by the GC. */ +#define _PyObject_GC_IS_TRACKED(o) \ + ((_Py_AS_GC(o))->gc.gc_refs != _PyGC_REFS_UNTRACKED) + +/* True if the object may be tracked by the GC in the future, or already is. + This can be useful to implement some optimizations. */ +#define _PyObject_GC_MAY_BE_TRACKED(obj) \ + (PyObject_IS_GC(obj) && \ + (!PyTuple_CheckExact(obj) || _PyObject_GC_IS_TRACKED(obj))) + + +PyAPI_FUNC(PyObject *) _PyObject_GC_Malloc(size_t); +PyAPI_FUNC(PyObject *) _PyObject_GC_New(PyTypeObject *); +PyAPI_FUNC(PyVarObject *) _PyObject_GC_NewVar(PyTypeObject *, Py_ssize_t); +PyAPI_FUNC(void) PyObject_GC_Track(void *); +PyAPI_FUNC(void) PyObject_GC_UnTrack(void *); +PyAPI_FUNC(void) PyObject_GC_Del(void *); + +#define PyObject_GC_New(type, typeobj) \ + ( (type *) _PyObject_GC_New(typeobj) ) +#define PyObject_GC_NewVar(type, typeobj, n) \ + ( (type *) _PyObject_GC_NewVar((typeobj), (n)) ) + + +/* Utility macro to help write tp_traverse functions. + * To use this macro, the tp_traverse function must name its arguments + * "visit" and "arg". This is intended to keep tp_traverse functions + * looking as much alike as possible. + */ +#define Py_VISIT(op) \ + do { \ + if (op) { \ + int vret = visit((PyObject *)(op), arg); \ + if (vret) \ + return vret; \ + } \ + } while (0) + +/* This is here for the sake of backwards compatibility. Extensions that + * use the old GC API will still compile but the objects will not be + * tracked by the GC. */ +#define PyGC_HEAD_SIZE 0 +#define PyObject_GC_Init(op) +#define PyObject_GC_Fini(op) +#define PyObject_AS_GC(op) (op) +#define PyObject_FROM_GC(op) (op) + + +/* Test if a type supports weak references */ +#define PyType_SUPPORTS_WEAKREFS(t) \ + (PyType_HasFeature((t), Py_TPFLAGS_HAVE_WEAKREFS) \ + && ((t)->tp_weaklistoffset > 0)) + +#define PyObject_GET_WEAKREFS_LISTPTR(o) \ + ((PyObject **) (((char *) (o)) + Py_TYPE(o)->tp_weaklistoffset)) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_OBJIMPL_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/opcode.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/opcode.h new file mode 100644 index 0000000..9ed5487 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/opcode.h @@ -0,0 +1,171 @@ +#ifndef Py_OPCODE_H +#define Py_OPCODE_H +#ifdef __cplusplus +extern "C" { +#endif + + +/* Instruction opcodes for compiled code */ + +#define STOP_CODE 0 +#define POP_TOP 1 +#define ROT_TWO 2 +#define ROT_THREE 3 +#define DUP_TOP 4 +#define ROT_FOUR 5 +#define NOP 9 + +#define UNARY_POSITIVE 10 +#define UNARY_NEGATIVE 11 +#define UNARY_NOT 12 +#define UNARY_CONVERT 13 + +#define UNARY_INVERT 15 + +#define BINARY_POWER 19 + +#define BINARY_MULTIPLY 20 +#define BINARY_DIVIDE 21 +#define BINARY_MODULO 22 +#define BINARY_ADD 23 +#define BINARY_SUBTRACT 24 +#define BINARY_SUBSCR 25 +#define BINARY_FLOOR_DIVIDE 26 +#define BINARY_TRUE_DIVIDE 27 +#define INPLACE_FLOOR_DIVIDE 28 +#define INPLACE_TRUE_DIVIDE 29 + +#define SLICE 30 +/* Also uses 31-33 */ +#define SLICE_1 31 +#define SLICE_2 32 +#define SLICE_3 33 + +#define STORE_SLICE 40 +/* Also uses 41-43 */ +#define STORE_SLICE_1 41 +#define STORE_SLICE_2 42 +#define STORE_SLICE_3 43 + +#define DELETE_SLICE 50 +/* Also uses 51-53 */ +#define DELETE_SLICE_1 51 +#define DELETE_SLICE_2 52 +#define DELETE_SLICE_3 53 + +#define STORE_MAP 54 +#define INPLACE_ADD 55 +#define INPLACE_SUBTRACT 56 +#define INPLACE_MULTIPLY 57 +#define INPLACE_DIVIDE 58 +#define INPLACE_MODULO 59 +#define STORE_SUBSCR 60 +#define DELETE_SUBSCR 61 + +#define BINARY_LSHIFT 62 +#define BINARY_RSHIFT 63 +#define BINARY_AND 64 +#define BINARY_XOR 65 +#define BINARY_OR 66 +#define INPLACE_POWER 67 +#define GET_ITER 68 + +#define PRINT_EXPR 70 +#define PRINT_ITEM 71 +#define PRINT_NEWLINE 72 +#define PRINT_ITEM_TO 73 +#define PRINT_NEWLINE_TO 74 +#define INPLACE_LSHIFT 75 +#define INPLACE_RSHIFT 76 +#define INPLACE_AND 77 +#define INPLACE_XOR 78 +#define INPLACE_OR 79 +#define BREAK_LOOP 80 +#define WITH_CLEANUP 81 +#define LOAD_LOCALS 82 +#define RETURN_VALUE 83 +#define IMPORT_STAR 84 +#define EXEC_STMT 85 +#define YIELD_VALUE 86 +#define POP_BLOCK 87 +#define END_FINALLY 88 +#define BUILD_CLASS 89 + +#define HAVE_ARGUMENT 90 /* Opcodes from here have an argument: */ + +#define STORE_NAME 90 /* Index in name list */ +#define DELETE_NAME 91 /* "" */ +#define UNPACK_SEQUENCE 92 /* Number of sequence items */ +#define FOR_ITER 93 +#define LIST_APPEND 94 + +#define STORE_ATTR 95 /* Index in name list */ +#define DELETE_ATTR 96 /* "" */ +#define STORE_GLOBAL 97 /* "" */ +#define DELETE_GLOBAL 98 /* "" */ +#define DUP_TOPX 99 /* number of items to duplicate */ +#define LOAD_CONST 100 /* Index in const list */ +#define LOAD_NAME 101 /* Index in name list */ +#define BUILD_TUPLE 102 /* Number of tuple items */ +#define BUILD_LIST 103 /* Number of list items */ +#define BUILD_SET 104 /* Number of set items */ +#define BUILD_MAP 105 /* Always zero for now */ +#define LOAD_ATTR 106 /* Index in name list */ +#define COMPARE_OP 107 /* Comparison operator */ +#define IMPORT_NAME 108 /* Index in name list */ +#define IMPORT_FROM 109 /* Index in name list */ +#define JUMP_FORWARD 110 /* Number of bytes to skip */ + +#define JUMP_IF_FALSE_OR_POP 111 /* Target byte offset from beginning + of code */ +#define JUMP_IF_TRUE_OR_POP 112 /* "" */ +#define JUMP_ABSOLUTE 113 /* "" */ +#define POP_JUMP_IF_FALSE 114 /* "" */ +#define POP_JUMP_IF_TRUE 115 /* "" */ + +#define LOAD_GLOBAL 116 /* Index in name list */ + +#define CONTINUE_LOOP 119 /* Start of loop (absolute) */ +#define SETUP_LOOP 120 /* Target address (relative) */ +#define SETUP_EXCEPT 121 /* "" */ +#define SETUP_FINALLY 122 /* "" */ + +#define LOAD_FAST 124 /* Local variable number */ +#define STORE_FAST 125 /* Local variable number */ +#define DELETE_FAST 126 /* Local variable number */ + +#define RAISE_VARARGS 130 /* Number of raise arguments (1, 2 or 3) */ +/* CALL_FUNCTION_XXX opcodes defined below depend on this definition */ +#define CALL_FUNCTION 131 /* #args + (#kwargs<<8) */ +#define MAKE_FUNCTION 132 /* #defaults */ +#define BUILD_SLICE 133 /* Number of items */ + +#define MAKE_CLOSURE 134 /* #free vars */ +#define LOAD_CLOSURE 135 /* Load free variable from closure */ +#define LOAD_DEREF 136 /* Load and dereference from closure cell */ +#define STORE_DEREF 137 /* Store into cell */ + +/* The next 3 opcodes must be contiguous and satisfy + (CALL_FUNCTION_VAR - CALL_FUNCTION) & 3 == 1 */ +#define CALL_FUNCTION_VAR 140 /* #args + (#kwargs<<8) */ +#define CALL_FUNCTION_KW 141 /* #args + (#kwargs<<8) */ +#define CALL_FUNCTION_VAR_KW 142 /* #args + (#kwargs<<8) */ + +#define SETUP_WITH 143 + +/* Support for opargs more than 16 bits long */ +#define EXTENDED_ARG 145 + +#define SET_ADD 146 +#define MAP_ADD 147 + + +enum cmp_op {PyCmp_LT=Py_LT, PyCmp_LE=Py_LE, PyCmp_EQ=Py_EQ, PyCmp_NE=Py_NE, PyCmp_GT=Py_GT, PyCmp_GE=Py_GE, + PyCmp_IN, PyCmp_NOT_IN, PyCmp_IS, PyCmp_IS_NOT, PyCmp_EXC_MATCH, PyCmp_BAD}; + +#define HAS_ARG(op) ((op) >= HAVE_ARGUMENT) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_OPCODE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/osdefs.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/osdefs.h new file mode 100644 index 0000000..77af923 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/osdefs.h @@ -0,0 +1,63 @@ +#ifndef Py_OSDEFS_H +#define Py_OSDEFS_H +#ifdef __cplusplus +extern "C" { +#endif + + +/* Operating system dependencies */ + +/* Mod by chrish: QNX has WATCOM, but isn't DOS */ +#if !defined(__QNX__) +#if defined(MS_WINDOWS) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__DJGPP__) || defined(PYOS_OS2) +#if defined(PYOS_OS2) && defined(PYCC_GCC) +#define MAXPATHLEN 260 +#define SEP '/' +#define ALTSEP '\\' +#else +#define SEP '\\' +#define ALTSEP '/' +#define MAXPATHLEN 256 +#endif +#define DELIM ';' +#endif +#endif + +#ifdef RISCOS +#define SEP '.' +#define MAXPATHLEN 256 +#define DELIM ',' +#endif + + +/* Filename separator */ +#ifndef SEP +#define SEP '/' +#endif + +/* Max pathname length */ +#ifdef __hpux +#include +#include +#ifndef PATH_MAX +#define PATH_MAX MAXPATHLEN +#endif +#endif + +#ifndef MAXPATHLEN +#if defined(PATH_MAX) && PATH_MAX > 1024 +#define MAXPATHLEN PATH_MAX +#else +#define MAXPATHLEN 1024 +#endif +#endif + +/* Search path entry delimiter */ +#ifndef DELIM +#define DELIM ':' +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_OSDEFS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/parsetok.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/parsetok.h new file mode 100644 index 0000000..ec1eb6f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/parsetok.h @@ -0,0 +1,64 @@ + +/* Parser-tokenizer link interface */ + +#ifndef Py_PARSETOK_H +#define Py_PARSETOK_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + int error; + const char *filename; + int lineno; + int offset; + char *text; + int token; + int expected; +} perrdetail; + +#if 0 +#define PyPARSE_YIELD_IS_KEYWORD 0x0001 +#endif + +#define PyPARSE_DONT_IMPLY_DEDENT 0x0002 + +#if 0 +#define PyPARSE_WITH_IS_KEYWORD 0x0003 +#endif + +#define PyPARSE_PRINT_IS_FUNCTION 0x0004 +#define PyPARSE_UNICODE_LITERALS 0x0008 + + + +PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int, + perrdetail *); +PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, const char *, grammar *, int, + char *, char *, perrdetail *); + +PyAPI_FUNC(node *) PyParser_ParseStringFlags(const char *, grammar *, int, + perrdetail *, int); +PyAPI_FUNC(node *) PyParser_ParseFileFlags(FILE *, const char *, grammar *, + int, char *, char *, + perrdetail *, int); +PyAPI_FUNC(node *) PyParser_ParseFileFlagsEx(FILE *, const char *, grammar *, + int, char *, char *, + perrdetail *, int *); + +PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename(const char *, + const char *, + grammar *, int, + perrdetail *, int); +PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilenameEx(const char *, + const char *, + grammar *, int, + perrdetail *, int *); + +/* Note that he following function is defined in pythonrun.c not parsetok.c. */ +PyAPI_FUNC(void) PyParser_SetError(perrdetail *); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_PARSETOK_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/patchlevel.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/patchlevel.h new file mode 100644 index 0000000..99e8370 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/patchlevel.h @@ -0,0 +1,43 @@ + +/* Newfangled version identification scheme. + + This scheme was added in Python 1.5.2b2; before that time, only PATCHLEVEL + was available. To test for presence of the scheme, test for + defined(PY_MAJOR_VERSION). + + When the major or minor version changes, the VERSION variable in + configure.ac must also be changed. + + There is also (independent) API version information in modsupport.h. +*/ + +/* Values for PY_RELEASE_LEVEL */ +#define PY_RELEASE_LEVEL_ALPHA 0xA +#define PY_RELEASE_LEVEL_BETA 0xB +#define PY_RELEASE_LEVEL_GAMMA 0xC /* For release candidates */ +#define PY_RELEASE_LEVEL_FINAL 0xF /* Serial should be 0 here */ + /* Higher for patch releases */ + +/* Version parsed out into numeric values */ +/*--start constants--*/ +#define PY_MAJOR_VERSION 2 +#define PY_MINOR_VERSION 7 +#define PY_MICRO_VERSION 15 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL +#define PY_RELEASE_SERIAL 0 + +/* Version as a string */ +#define PY_VERSION "2.7.15" +/*--end constants--*/ + +/* Subversion Revision number of this file (not of the repository). Empty + since Mercurial migration. */ +#define PY_PATCHLEVEL_REVISION "" + +/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. + Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */ +#define PY_VERSION_HEX ((PY_MAJOR_VERSION << 24) | \ + (PY_MINOR_VERSION << 16) | \ + (PY_MICRO_VERSION << 8) | \ + (PY_RELEASE_LEVEL << 4) | \ + (PY_RELEASE_SERIAL << 0)) diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/pgen.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pgen.h new file mode 100644 index 0000000..8a325ed --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pgen.h @@ -0,0 +1,18 @@ +#ifndef Py_PGEN_H +#define Py_PGEN_H +#ifdef __cplusplus +extern "C" { +#endif + + +/* Parser generator interface */ + +extern grammar *meta_grammar(void); + +struct _node; +extern grammar *pgen(struct _node *); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_PGEN_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/pgenheaders.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pgenheaders.h new file mode 100644 index 0000000..2049ae3 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pgenheaders.h @@ -0,0 +1,42 @@ +#ifndef Py_PGENHEADERS_H +#define Py_PGENHEADERS_H +#ifdef __cplusplus +extern "C" { +#endif + + +/* Include files and extern declarations used by most of the parser. */ + +#include "Python.h" + +PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) + Py_GCC_ATTRIBUTE((format(printf, 1, 2))); +PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) + Py_GCC_ATTRIBUTE((format(printf, 1, 2))); + +#define addarc _Py_addarc +#define addbit _Py_addbit +#define adddfa _Py_adddfa +#define addfirstsets _Py_addfirstsets +#define addlabel _Py_addlabel +#define addstate _Py_addstate +#define delbitset _Py_delbitset +#define dumptree _Py_dumptree +#define findlabel _Py_findlabel +#define mergebitset _Py_mergebitset +#define meta_grammar _Py_meta_grammar +#define newbitset _Py_newbitset +#define newgrammar _Py_newgrammar +#define pgen _Py_pgen +#define printgrammar _Py_printgrammar +#define printnonterminals _Py_printnonterminals +#define printtree _Py_printtree +#define samebitset _Py_samebitset +#define showtree _Py_showtree +#define tok_dump _Py_tok_dump +#define translatelabels _Py_translatelabels + +#ifdef __cplusplus +} +#endif +#endif /* !Py_PGENHEADERS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/py_curses.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/py_curses.h new file mode 100644 index 0000000..eb77e35 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/py_curses.h @@ -0,0 +1,177 @@ + +#ifndef Py_CURSES_H +#define Py_CURSES_H + +#ifdef __APPLE__ +/* +** On Mac OS X 10.2 [n]curses.h and stdlib.h use different guards +** against multiple definition of wchar_t. +*/ +#ifdef _BSD_WCHAR_T_DEFINED_ +#define _WCHAR_T +#endif +#endif /* __APPLE__ */ + +#ifdef __FreeBSD__ +/* +** On FreeBSD, [n]curses.h and stdlib.h/wchar.h use different guards +** against multiple definition of wchar_t and wint_t. +*/ +#ifdef _XOPEN_SOURCE_EXTENDED +#ifndef __FreeBSD_version +#include +#endif +#if __FreeBSD_version >= 500000 +#ifndef __wchar_t +#define __wchar_t +#endif +#ifndef __wint_t +#define __wint_t +#endif +#else +#ifndef _WCHAR_T +#define _WCHAR_T +#endif +#ifndef _WINT_T +#define _WINT_T +#endif +#endif +#endif +#endif + +#if !defined(HAVE_CURSES_IS_PAD) && defined(WINDOW_HAS_FLAGS) +/* The following definition is necessary for ncurses 5.7; without it, + some of [n]curses.h set NCURSES_OPAQUE to 1, and then Python + can't get at the WINDOW flags field. */ +#define NCURSES_OPAQUE 0 +#endif + +#ifdef HAVE_NCURSES_H +#include +#else +#include +#endif + +#ifdef HAVE_NCURSES_H +/* configure was checking , but we will + use , which has some or all these features. */ +#if !defined(WINDOW_HAS_FLAGS) && !(NCURSES_OPAQUE+0) +#define WINDOW_HAS_FLAGS 1 +#endif +#if !defined(HAVE_CURSES_IS_PAD) && NCURSES_VERSION_PATCH+0 >= 20090906 +#define HAVE_CURSES_IS_PAD 1 +#endif +#ifndef MVWDELCH_IS_EXPRESSION +#define MVWDELCH_IS_EXPRESSION 1 +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define PyCurses_API_pointers 4 + +/* Type declarations */ + +typedef struct { + PyObject_HEAD + WINDOW *win; +} PyCursesWindowObject; + +#define PyCursesWindow_Check(v) (Py_TYPE(v) == &PyCursesWindow_Type) + +#define PyCurses_CAPSULE_NAME "_curses._C_API" + + +#ifdef CURSES_MODULE +/* This section is used when compiling _cursesmodule.c */ + +#else +/* This section is used in modules that use the _cursesmodule API */ + +static void **PyCurses_API; + +#define PyCursesWindow_Type (*(PyTypeObject *) PyCurses_API[0]) +#define PyCursesSetupTermCalled {if (! ((int (*)(void))PyCurses_API[1]) () ) return NULL;} +#define PyCursesInitialised {if (! ((int (*)(void))PyCurses_API[2]) () ) return NULL;} +#define PyCursesInitialisedColor {if (! ((int (*)(void))PyCurses_API[3]) () ) return NULL;} + +#define import_curses() \ + PyCurses_API = (void **)PyCapsule_Import(PyCurses_CAPSULE_NAME, 1); + +#endif + +/* general error messages */ +static char *catchall_ERR = "curses function returned ERR"; +static char *catchall_NULL = "curses function returned NULL"; + +/* Function Prototype Macros - They are ugly but very, very useful. ;-) + + X - function name + TYPE - parameter Type + ERGSTR - format string for construction of the return value + PARSESTR - format string for argument parsing + */ + +#define NoArgNoReturnFunction(X) \ +static PyObject *PyCurses_ ## X (PyObject *self) \ +{ \ + PyCursesInitialised \ + return PyCursesCheckERR(X(), # X); } + +#define NoArgOrFlagNoReturnFunction(X) \ +static PyObject *PyCurses_ ## X (PyObject *self, PyObject *args) \ +{ \ + int flag = 0; \ + PyCursesInitialised \ + switch(PyTuple_Size(args)) { \ + case 0: \ + return PyCursesCheckERR(X(), # X); \ + case 1: \ + if (!PyArg_ParseTuple(args, "i;True(1) or False(0)", &flag)) return NULL; \ + if (flag) return PyCursesCheckERR(X(), # X); \ + else return PyCursesCheckERR(no ## X (), # X); \ + default: \ + PyErr_SetString(PyExc_TypeError, # X " requires 0 or 1 arguments"); \ + return NULL; } } + +#define NoArgReturnIntFunction(X) \ +static PyObject *PyCurses_ ## X (PyObject *self) \ +{ \ + PyCursesInitialised \ + return PyInt_FromLong((long) X()); } + + +#define NoArgReturnStringFunction(X) \ +static PyObject *PyCurses_ ## X (PyObject *self) \ +{ \ + PyCursesInitialised \ + return PyString_FromString(X()); } + +#define NoArgTrueFalseFunction(X) \ +static PyObject *PyCurses_ ## X (PyObject *self) \ +{ \ + PyCursesInitialised \ + if (X () == FALSE) { \ + Py_INCREF(Py_False); \ + return Py_False; \ + } \ + Py_INCREF(Py_True); \ + return Py_True; } + +#define NoArgNoReturnVoidFunction(X) \ +static PyObject *PyCurses_ ## X (PyObject *self) \ +{ \ + PyCursesInitialised \ + X(); \ + Py_INCREF(Py_None); \ + return Py_None; } + +#ifdef __cplusplus +} +#endif + +#endif /* !defined(Py_CURSES_H) */ + + diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/pyarena.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pyarena.h new file mode 100644 index 0000000..5f193fe --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pyarena.h @@ -0,0 +1,62 @@ +/* An arena-like memory interface for the compiler. + */ + +#ifndef Py_PYARENA_H +#define Py_PYARENA_H + +#ifdef __cplusplus +extern "C" { +#endif + + typedef struct _arena PyArena; + + /* PyArena_New() and PyArena_Free() create a new arena and free it, + respectively. Once an arena has been created, it can be used + to allocate memory via PyArena_Malloc(). Pointers to PyObject can + also be registered with the arena via PyArena_AddPyObject(), and the + arena will ensure that the PyObjects stay alive at least until + PyArena_Free() is called. When an arena is freed, all the memory it + allocated is freed, the arena releases internal references to registered + PyObject*, and none of its pointers are valid. + XXX (tim) What does "none of its pointers are valid" mean? Does it + XXX mean that pointers previously obtained via PyArena_Malloc() are + XXX no longer valid? (That's clearly true, but not sure that's what + XXX the text is trying to say.) + + PyArena_New() returns an arena pointer. On error, it + returns a negative number and sets an exception. + XXX (tim): Not true. On error, PyArena_New() actually returns NULL, + XXX and looks like it may or may not set an exception (e.g., if the + XXX internal PyList_New(0) returns NULL, PyArena_New() passes that on + XXX and an exception is set; OTOH, if the internal + XXX block_new(DEFAULT_BLOCK_SIZE) returns NULL, that's passed on but + XXX an exception is not set in that case). + */ + PyAPI_FUNC(PyArena *) PyArena_New(void); + PyAPI_FUNC(void) PyArena_Free(PyArena *); + + /* Mostly like malloc(), return the address of a block of memory spanning + * `size` bytes, or return NULL (without setting an exception) if enough + * new memory can't be obtained. Unlike malloc(0), PyArena_Malloc() with + * size=0 does not guarantee to return a unique pointer (the pointer + * returned may equal one or more other pointers obtained from + * PyArena_Malloc()). + * Note that pointers obtained via PyArena_Malloc() must never be passed to + * the system free() or realloc(), or to any of Python's similar memory- + * management functions. PyArena_Malloc()-obtained pointers remain valid + * until PyArena_Free(ar) is called, at which point all pointers obtained + * from the arena `ar` become invalid simultaneously. + */ + PyAPI_FUNC(void *) PyArena_Malloc(PyArena *, size_t size); + + /* This routine isn't a proper arena allocation routine. It takes + * a PyObject* and records it so that it can be DECREFed when the + * arena is freed. + */ + PyAPI_FUNC(int) PyArena_AddPyObject(PyArena *, PyObject *); + +#ifdef __cplusplus +} +#endif + +#endif /* !Py_PYARENA_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/pycapsule.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pycapsule.h new file mode 100644 index 0000000..cd682fc --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pycapsule.h @@ -0,0 +1,56 @@ + +/* Capsule objects let you wrap a C "void *" pointer in a Python + object. They're a way of passing data through the Python interpreter + without creating your own custom type. + + Capsules are used for communication between extension modules. + They provide a way for an extension module to export a C interface + to other extension modules, so that extension modules can use the + Python import mechanism to link to one another. + + For more information, please see "c-api/capsule.html" in the + documentation. +*/ + +#ifndef Py_CAPSULE_H +#define Py_CAPSULE_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_DATA(PyTypeObject) PyCapsule_Type; + +typedef void (*PyCapsule_Destructor)(PyObject *); + +#define PyCapsule_CheckExact(op) (Py_TYPE(op) == &PyCapsule_Type) + + +PyAPI_FUNC(PyObject *) PyCapsule_New( + void *pointer, + const char *name, + PyCapsule_Destructor destructor); + +PyAPI_FUNC(void *) PyCapsule_GetPointer(PyObject *capsule, const char *name); + +PyAPI_FUNC(PyCapsule_Destructor) PyCapsule_GetDestructor(PyObject *capsule); + +PyAPI_FUNC(const char *) PyCapsule_GetName(PyObject *capsule); + +PyAPI_FUNC(void *) PyCapsule_GetContext(PyObject *capsule); + +PyAPI_FUNC(int) PyCapsule_IsValid(PyObject *capsule, const char *name); + +PyAPI_FUNC(int) PyCapsule_SetPointer(PyObject *capsule, void *pointer); + +PyAPI_FUNC(int) PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor); + +PyAPI_FUNC(int) PyCapsule_SetName(PyObject *capsule, const char *name); + +PyAPI_FUNC(int) PyCapsule_SetContext(PyObject *capsule, void *context); + +PyAPI_FUNC(void *) PyCapsule_Import(const char *name, int no_block); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_CAPSULE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/pyconfig.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pyconfig.h new file mode 100644 index 0000000..9149818 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pyconfig.h @@ -0,0 +1,1317 @@ +/* pyconfig.h. Generated from pyconfig.h.in by configure. */ +/* pyconfig.h.in. Generated from configure.ac by autoheader. */ + + +#ifndef Py_PYCONFIG_H +#define Py_PYCONFIG_H + + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Define for AIX if your compiler is a genuine IBM xlC/xlC_r and you want + support for AIX C++ shared extension modules. */ +/* #undef AIX_GENUINE_CPLUSPLUS */ + +/* Define this if you have AtheOS threads. */ +/* #undef ATHEOS_THREADS */ + +/* Define this if you have BeOS threads. */ +/* #undef BEOS_THREADS */ + +/* Define if you have the Mach cthreads package */ +/* #undef C_THREADS */ + +/* Define if C doubles are 64-bit IEEE 754 binary format, stored in ARM + mixed-endian order (byte order 45670123) */ +/* #undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 */ + +/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the most + significant byte first */ +/* #undef DOUBLE_IS_BIG_ENDIAN_IEEE754 */ + +/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the + least significant byte first */ +#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 1 + +/* Define if --enable-ipv6 is specified */ +#define ENABLE_IPV6 1 + +/* Define if flock needs to be linked with bsd library. */ +/* #undef FLOCK_NEEDS_LIBBSD */ + +/* Define if getpgrp() must be called as getpgrp(0). */ +/* #undef GETPGRP_HAVE_ARG */ + +/* Define if gettimeofday() does not have second (timezone) argument This is + the case on Motorola V4 (R40V4.2) */ +/* #undef GETTIMEOFDAY_NO_TZ */ + +/* Define to 1 if you have the `acosh' function. */ +#define HAVE_ACOSH 1 + +/* struct addrinfo (netdb.h) */ +#define HAVE_ADDRINFO 1 + +/* Define to 1 if you have the `alarm' function. */ +#define HAVE_ALARM 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ALLOCA_H 1 + +/* Define this if your time.h defines altzone. */ +/* #undef HAVE_ALTZONE */ + +/* Define to 1 if you have the `asinh' function. */ +#define HAVE_ASINH 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ASM_TYPES_H 1 + +/* Define to 1 if you have the `atanh' function. */ +#define HAVE_ATANH 1 + +/* Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3))) */ +/* #undef HAVE_ATTRIBUTE_FORMAT_PARSETUPLE */ + +/* Define to 1 if you have the `bind_textdomain_codeset' function. */ +#define HAVE_BIND_TEXTDOMAIN_CODESET 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_BLUETOOTH_BLUETOOTH_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BLUETOOTH_H */ + +/* Define if nice() returns success/failure instead of the new priority. */ +/* #undef HAVE_BROKEN_NICE */ + +/* Define if the system reports an invalid PIPE_BUF value. */ +/* #undef HAVE_BROKEN_PIPE_BUF */ + +/* Define if poll() sets errno on invalid file descriptors. */ +/* #undef HAVE_BROKEN_POLL */ + +/* Define if the Posix semaphores do not work on your system */ +/* #undef HAVE_BROKEN_POSIX_SEMAPHORES */ + +/* Define if pthread_sigmask() does not work on your system. */ +/* #undef HAVE_BROKEN_PTHREAD_SIGMASK */ + +/* define to 1 if your sem_getvalue is broken. */ +/* #undef HAVE_BROKEN_SEM_GETVALUE */ + +/* Define if `unsetenv` does not return an int. */ +/* #undef HAVE_BROKEN_UNSETENV */ + +/* Define this if you have the type _Bool. */ +#define HAVE_C99_BOOL 1 + +/* Define to 1 if you have the 'chflags' function. */ +/* #undef HAVE_CHFLAGS */ + +/* Define to 1 if you have the `chown' function. */ +#define HAVE_CHOWN 1 + +/* Define if you have the 'chroot' function. */ +#define HAVE_CHROOT 1 + +/* Define to 1 if you have the `clock' function. */ +#define HAVE_CLOCK 1 + +/* Define if the C compiler supports computed gotos. */ +#define HAVE_COMPUTED_GOTOS 1 + +/* Define to 1 if you have the `confstr' function. */ +#define HAVE_CONFSTR 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CONIO_H */ + +/* Define to 1 if you have the `copysign' function. */ +#define HAVE_COPYSIGN 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_CRYPT_H 1 + +/* Define to 1 if you have the `ctermid' function. */ +#define HAVE_CTERMID 1 + +/* Define if you have the 'ctermid_r' function. */ +/* #undef HAVE_CTERMID_R */ + +/* Define if you have the 'filter' function. */ +#define HAVE_CURSES_FILTER 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_CURSES_H 1 + +/* Define if you have the 'has_key' function. */ +#define HAVE_CURSES_HAS_KEY 1 + +/* Define if you have the 'immedok' function. */ +#define HAVE_CURSES_IMMEDOK 1 + +/* Define if you have the 'is_pad' function or macro. */ +#define HAVE_CURSES_IS_PAD 1 + +/* Define if you have the 'is_term_resized' function. */ +#define HAVE_CURSES_IS_TERM_RESIZED 1 + +/* Define if you have the 'resizeterm' function. */ +#define HAVE_CURSES_RESIZETERM 1 + +/* Define if you have the 'resize_term' function. */ +#define HAVE_CURSES_RESIZE_TERM 1 + +/* Define if you have the 'syncok' function. */ +#define HAVE_CURSES_SYNCOK 1 + +/* Define if you have the 'typeahead' function. */ +#define HAVE_CURSES_TYPEAHEAD 1 + +/* Define if you have the 'use_env' function. */ +#define HAVE_CURSES_USE_ENV 1 + +/* Define if you have the 'wchgat' function. */ +#define HAVE_CURSES_WCHGAT 1 + +/* Define to 1 if you have the declaration of `isfinite', and to 0 if you + don't. */ +#define HAVE_DECL_ISFINITE 1 + +/* Define to 1 if you have the declaration of `isinf', and to 0 if you don't. + */ +#define HAVE_DECL_ISINF 1 + +/* Define to 1 if you have the declaration of `isnan', and to 0 if you don't. + */ +#define HAVE_DECL_ISNAN 1 + +/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. + */ +/* #undef HAVE_DECL_TZNAME */ + +/* Define to 1 if you have the device macros. */ +#define HAVE_DEVICE_MACROS 1 + +/* Define to 1 if you have the /dev/ptc device file. */ +/* #undef HAVE_DEV_PTC */ + +/* Define to 1 if you have the /dev/ptmx device file. */ +#define HAVE_DEV_PTMX 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DIRECT_H */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the `dlopen' function. */ +#define HAVE_DLOPEN 1 + +/* Define to 1 if you have the `dup2' function. */ +#define HAVE_DUP2 1 + +/* Defined when any dynamic module loading is enabled. */ +#define HAVE_DYNAMIC_LOADING 1 + +/* Define if you have the 'epoll' functions. */ +#define HAVE_EPOLL 1 + +/* Define to 1 if you have the `erf' function. */ +#define HAVE_ERF 1 + +/* Define to 1 if you have the `erfc' function. */ +#define HAVE_ERFC 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the `execv' function. */ +#define HAVE_EXECV 1 + +/* Define to 1 if you have the `expm1' function. */ +#define HAVE_EXPM1 1 + +/* Define if you have the 'fchdir' function. */ +#define HAVE_FCHDIR 1 + +/* Define to 1 if you have the `fchmod' function. */ +#define HAVE_FCHMOD 1 + +/* Define to 1 if you have the `fchown' function. */ +#define HAVE_FCHOWN 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define if you have the 'fdatasync' function. */ +#define HAVE_FDATASYNC 1 + +/* Define to 1 if you have the `finite' function. */ +#define HAVE_FINITE 1 + +/* Define to 1 if you have the `flock' function. */ +#define HAVE_FLOCK 1 + +/* Define to 1 if you have the `fork' function. */ +#define HAVE_FORK 1 + +/* Define to 1 if you have the `forkpty' function. */ +#define HAVE_FORKPTY 1 + +/* Define to 1 if you have the `fpathconf' function. */ +#define HAVE_FPATHCONF 1 + +/* Define to 1 if you have the `fseek64' function. */ +/* #undef HAVE_FSEEK64 */ + +/* Define to 1 if you have the `fseeko' function. */ +#define HAVE_FSEEKO 1 + +/* Define to 1 if you have the `fstatvfs' function. */ +#define HAVE_FSTATVFS 1 + +/* Define if you have the 'fsync' function. */ +#define HAVE_FSYNC 1 + +/* Define to 1 if you have the `ftell64' function. */ +/* #undef HAVE_FTELL64 */ + +/* Define to 1 if you have the `ftello' function. */ +#define HAVE_FTELLO 1 + +/* Define to 1 if you have the `ftime' function. */ +#define HAVE_FTIME 1 + +/* Define to 1 if you have the `ftruncate' function. */ +#define HAVE_FTRUNCATE 1 + +/* Define to 1 if you have the `gai_strerror' function. */ +#define HAVE_GAI_STRERROR 1 + +/* Define to 1 if you have the `gamma' function. */ +#define HAVE_GAMMA 1 + +/* Define if we can use gcc inline assembler to get and set x87 control word + */ +#define HAVE_GCC_ASM_FOR_X87 1 + +/* Define if you have the getaddrinfo function. */ +#define HAVE_GETADDRINFO 1 + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */ +#define HAVE_GETC_UNLOCKED 1 + +/* Define to 1 if you have the `getentropy' function. */ +#define HAVE_GETENTROPY 1 + +/* Define to 1 if you have the `getgroups' function. */ +#define HAVE_GETGROUPS 1 + +/* Define to 1 if you have the `gethostbyname' function. */ +/* #undef HAVE_GETHOSTBYNAME */ + +/* Define this if you have some version of gethostbyname_r() */ +#define HAVE_GETHOSTBYNAME_R 1 + +/* Define this if you have the 3-arg version of gethostbyname_r(). */ +/* #undef HAVE_GETHOSTBYNAME_R_3_ARG */ + +/* Define this if you have the 5-arg version of gethostbyname_r(). */ +/* #undef HAVE_GETHOSTBYNAME_R_5_ARG */ + +/* Define this if you have the 6-arg version of gethostbyname_r(). */ +#define HAVE_GETHOSTBYNAME_R_6_ARG 1 + +/* Define to 1 if you have the `getitimer' function. */ +#define HAVE_GETITIMER 1 + +/* Define to 1 if you have the `getloadavg' function. */ +#define HAVE_GETLOADAVG 1 + +/* Define to 1 if you have the `getlogin' function. */ +#define HAVE_GETLOGIN 1 + +/* Define to 1 if you have the `getnameinfo' function. */ +#define HAVE_GETNAMEINFO 1 + +/* Define if you have the 'getpagesize' function. */ +#define HAVE_GETPAGESIZE 1 + +/* Define to 1 if you have the `getpeername' function. */ +#define HAVE_GETPEERNAME 1 + +/* Define to 1 if you have the `getpgid' function. */ +#define HAVE_GETPGID 1 + +/* Define to 1 if you have the `getpgrp' function. */ +#define HAVE_GETPGRP 1 + +/* Define to 1 if you have the `getpid' function. */ +#define HAVE_GETPID 1 + +/* Define to 1 if you have the `getpriority' function. */ +#define HAVE_GETPRIORITY 1 + +/* Define to 1 if you have the `getpwent' function. */ +#define HAVE_GETPWENT 1 + +/* Define to 1 if you have the `getresgid' function. */ +#define HAVE_GETRESGID 1 + +/* Define to 1 if you have the `getresuid' function. */ +#define HAVE_GETRESUID 1 + +/* Define to 1 if you have the `getsid' function. */ +#define HAVE_GETSID 1 + +/* Define to 1 if you have the `getspent' function. */ +#define HAVE_GETSPENT 1 + +/* Define to 1 if you have the `getspnam' function. */ +#define HAVE_GETSPNAM 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the `getwd' function. */ +#define HAVE_GETWD 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_GRP_H 1 + +/* Define if you have the 'hstrerror' function. */ +#define HAVE_HSTRERROR 1 + +/* Define to 1 if you have the `hypot' function. */ +#define HAVE_HYPOT 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IEEEFP_H */ + +/* Define if you have the 'inet_aton' function. */ +#define HAVE_INET_ATON 1 + +/* Define if you have the 'inet_pton' function. */ +#define HAVE_INET_PTON 1 + +/* Define to 1 if you have the `initgroups' function. */ +#define HAVE_INITGROUPS 1 + +/* Define if your compiler provides int32_t. */ +#define HAVE_INT32_T 1 + +/* Define if your compiler provides int64_t. */ +#define HAVE_INT64_T 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IO_H */ + +/* Define to 1 if you have the `kill' function. */ +#define HAVE_KILL 1 + +/* Define to 1 if you have the `killpg' function. */ +#define HAVE_KILLPG 1 + +/* Define if you have the 'kqueue' functions. */ +/* #undef HAVE_KQUEUE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LANGINFO_H 1 + +/* Defined to enable large file support when an off_t is bigger than a long + and long long is available and at least as big as an off_t. You may need to + add some flags for configuration and compilation to enable this mode. (For + Solaris and Linux, the necessary defines are already defined.) */ +/* #undef HAVE_LARGEFILE_SUPPORT */ + +/* Define to 1 if you have the 'lchflags' function. */ +/* #undef HAVE_LCHFLAGS */ + +/* Define to 1 if you have the `lchmod' function. */ +/* #undef HAVE_LCHMOD */ + +/* Define to 1 if you have the `lchown' function. */ +#define HAVE_LCHOWN 1 + +/* Define to 1 if you have the `lgamma' function. */ +#define HAVE_LGAMMA 1 + +/* Define to 1 if you have the `dl' library (-ldl). */ +#define HAVE_LIBDL 1 + +/* Define to 1 if you have the `dld' library (-ldld). */ +/* #undef HAVE_LIBDLD */ + +/* Define to 1 if you have the `ieee' library (-lieee). */ +/* #undef HAVE_LIBIEEE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIBINTL_H 1 + +/* Define if you have the readline library (-lreadline). */ +#define HAVE_LIBREADLINE 1 + +/* Define to 1 if you have the `resolv' library (-lresolv). */ +/* #undef HAVE_LIBRESOLV */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LIBUTIL_H */ + +/* Define if you have the 'link' function. */ +#define HAVE_LINK 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_NETLINK_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LINUX_TIPC_H 1 + +/* Define to 1 if you have the `log1p' function. */ +#define HAVE_LOG1P 1 + +/* Define this if you have the type long double. */ +#define HAVE_LONG_DOUBLE 1 + +/* Define this if you have the type long long. */ +#define HAVE_LONG_LONG 1 + +/* Define to 1 if you have the `lstat' function. */ +#define HAVE_LSTAT 1 + +/* Define this if you have the makedev macro. */ +#define HAVE_MAKEDEV 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mkfifo' function. */ +#define HAVE_MKFIFO 1 + +/* Define to 1 if you have the `mknod' function. */ +#define HAVE_MKNOD 1 + +/* Define to 1 if you have the `mktime' function. */ +#define HAVE_MKTIME 1 + +/* Define to 1 if you have the `mmap' function. */ +#define HAVE_MMAP 1 + +/* Define to 1 if you have the `mremap' function. */ +#define HAVE_MREMAP 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NCURSES_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +/* #undef HAVE_NDIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_NETPACKET_PACKET_H 1 + +/* Define to 1 if you have the `nice' function. */ +#define HAVE_NICE 1 + +/* Define to 1 if you have the `openpty' function. */ +#define HAVE_OPENPTY 1 + +/* Define if compiling using MacOS X 10.5 SDK or later. */ +/* #undef HAVE_OSX105_SDK */ + +/* Define to 1 if you have the `pathconf' function. */ +#define HAVE_PATHCONF 1 + +/* Define to 1 if you have the `pause' function. */ +#define HAVE_PAUSE 1 + +/* Define to 1 if you have the `plock' function. */ +/* #undef HAVE_PLOCK */ + +/* Define to 1 if you have the `poll' function. */ +#define HAVE_POLL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_POLL_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PROCESS_H */ + +/* Define if your compiler supports function prototype */ +#define HAVE_PROTOTYPES 1 + +/* Define if you have GNU PTH threads. */ +/* #undef HAVE_PTH */ + +/* Define to 1 if you have the `pthread_atfork' function. */ +#define HAVE_PTHREAD_ATFORK 1 + +/* Defined for Solaris 2.6 bug in pthread header. */ +/* #undef HAVE_PTHREAD_DESTRUCTOR */ + +/* Define to 1 if you have the header file. */ +#define HAVE_PTHREAD_H 1 + +/* Define to 1 if you have the `pthread_init' function. */ +/* #undef HAVE_PTHREAD_INIT */ + +/* Define to 1 if you have the `pthread_sigmask' function. */ +#define HAVE_PTHREAD_SIGMASK 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_PTY_H 1 + +/* Define to 1 if you have the `putenv' function. */ +#define HAVE_PUTENV 1 + +/* Define to 1 if you have the `readlink' function. */ +#define HAVE_READLINK 1 + +/* Define to 1 if you have the `realpath' function. */ +#define HAVE_REALPATH 1 + +/* Define if you have readline 2.1 */ +#define HAVE_RL_CALLBACK 1 + +/* Define if you can turn off readline's signal handling. */ +#define HAVE_RL_CATCH_SIGNAL 1 + +/* Define if you have readline 2.2 */ +#define HAVE_RL_COMPLETION_APPEND_CHARACTER 1 + +/* Define if you have readline 4.0 */ +#define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1 + +/* Define if you have readline 4.2 */ +#define HAVE_RL_COMPLETION_MATCHES 1 + +/* Define if you have rl_completion_suppress_append */ +#define HAVE_RL_COMPLETION_SUPPRESS_APPEND 1 + +/* Define if you have readline 4.0 */ +#define HAVE_RL_PRE_INPUT_HOOK 1 + +/* Define if you have readline 4.0 */ +#define HAVE_RL_RESIZE_TERMINAL 1 + +/* Define to 1 if you have the `round' function. */ +#define HAVE_ROUND 1 + +/* Define to 1 if you have the `select' function. */ +#define HAVE_SELECT 1 + +/* Define to 1 if you have the `sem_getvalue' function. */ +#define HAVE_SEM_GETVALUE 1 + +/* Define to 1 if you have the `sem_open' function. */ +#define HAVE_SEM_OPEN 1 + +/* Define to 1 if you have the `sem_timedwait' function. */ +#define HAVE_SEM_TIMEDWAIT 1 + +/* Define to 1 if you have the `sem_unlink' function. */ +#define HAVE_SEM_UNLINK 1 + +/* Define to 1 if you have the `setegid' function. */ +#define HAVE_SETEGID 1 + +/* Define to 1 if you have the `seteuid' function. */ +#define HAVE_SETEUID 1 + +/* Define to 1 if you have the `setgid' function. */ +#define HAVE_SETGID 1 + +/* Define if you have the 'setgroups' function. */ +#define HAVE_SETGROUPS 1 + +/* Define to 1 if you have the `setitimer' function. */ +#define HAVE_SETITIMER 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if you have the `setpgid' function. */ +#define HAVE_SETPGID 1 + +/* Define to 1 if you have the `setpgrp' function. */ +#define HAVE_SETPGRP 1 + +/* Define to 1 if you have the `setregid' function. */ +#define HAVE_SETREGID 1 + +/* Define to 1 if you have the `setresgid' function. */ +#define HAVE_SETRESGID 1 + +/* Define to 1 if you have the `setresuid' function. */ +#define HAVE_SETRESUID 1 + +/* Define to 1 if you have the `setreuid' function. */ +#define HAVE_SETREUID 1 + +/* Define to 1 if you have the `setsid' function. */ +#define HAVE_SETSID 1 + +/* Define to 1 if you have the `setuid' function. */ +#define HAVE_SETUID 1 + +/* Define to 1 if you have the `setvbuf' function. */ +#define HAVE_SETVBUF 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SHADOW_H 1 + +/* Define to 1 if you have the `sigaction' function. */ +#define HAVE_SIGACTION 1 + +/* Define to 1 if you have the `siginterrupt' function. */ +#define HAVE_SIGINTERRUPT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define to 1 if you have the `sigrelse' function. */ +#define HAVE_SIGRELSE 1 + +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 + +/* Define if sockaddr has sa_len member */ +/* #undef HAVE_SOCKADDR_SA_LEN */ + +/* struct sockaddr_storage (sys/socket.h) */ +#define HAVE_SOCKADDR_STORAGE 1 + +/* Define if you have the 'socketpair' function. */ +#define HAVE_SOCKETPAIR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SPAWN_H 1 + +/* Define if your compiler provides ssize_t */ +#define HAVE_SSIZE_T 1 + +/* Define to 1 if you have the `statvfs' function. */ +#define HAVE_STATVFS 1 + +/* Define if you have struct stat.st_mtim.tv_nsec */ +#define HAVE_STAT_TV_NSEC 1 + +/* Define if you have struct stat.st_mtimensec */ +/* #undef HAVE_STAT_TV_NSEC2 */ + +/* Define if your compiler supports variable length function prototypes (e.g. + void fprintf(FILE *, char *, ...);) *and* */ +#define HAVE_STDARG_PROTOTYPES 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strftime' function. */ +#define HAVE_STRFTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STROPTS_H 1 + +/* Define to 1 if `st_birthtime' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_BIRTHTIME */ + +/* Define to 1 if `st_blksize' is a member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 + +/* Define to 1 if `st_blocks' is a member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_BLOCKS 1 + +/* Define to 1 if `st_flags' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_FLAGS */ + +/* Define to 1 if `st_gen' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_GEN */ + +/* Define to 1 if `st_rdev' is a member of `struct stat'. */ +#define HAVE_STRUCT_STAT_ST_RDEV 1 + +/* Define to 1 if `tm_zone' is a member of `struct tm'. */ +#define HAVE_STRUCT_TM_TM_ZONE 1 + +/* Define if you have the 'symlink' function. */ +#define HAVE_SYMLINK 1 + +/* Define to 1 if you have the `sysconf' function. */ +#define HAVE_SYSCONF 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYSEXITS_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_AUDIOIO_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_BSDTTY_H */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_EPOLL_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_EVENT_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_FILE_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_LOADAVG_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_LOCK_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MKDEV_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MODEM_H */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_POLL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_RANDOM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STATVFS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SYSMACROS_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_TERMIO_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIMES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UTSNAME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the `tcgetpgrp' function. */ +#define HAVE_TCGETPGRP 1 + +/* Define to 1 if you have the `tcsetpgrp' function. */ +#define HAVE_TCSETPGRP 1 + +/* Define to 1 if you have the `tempnam' function. */ +#define HAVE_TEMPNAM 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TERMIOS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TERM_H 1 + +/* Define to 1 if you have the `tgamma' function. */ +#define HAVE_TGAMMA 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_THREAD_H */ + +/* Define to 1 if you have the `timegm' function. */ +#define HAVE_TIMEGM 1 + +/* Define to 1 if you have the `times' function. */ +#define HAVE_TIMES 1 + +/* Define to 1 if you have the `tmpfile' function. */ +#define HAVE_TMPFILE 1 + +/* Define to 1 if you have the `tmpnam' function. */ +#define HAVE_TMPNAM 1 + +/* Define to 1 if you have the `tmpnam_r' function. */ +#define HAVE_TMPNAM_R 1 + +/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use + `HAVE_STRUCT_TM_TM_ZONE' instead. */ +#define HAVE_TM_ZONE 1 + +/* Define to 1 if you have the `truncate' function. */ +#define HAVE_TRUNCATE 1 + +/* Define to 1 if you don't have `tm_zone' but do have the external array + `tzname'. */ +/* #undef HAVE_TZNAME */ + +/* Define this if you have tcl and TCL_UTF_MAX==6 */ +/* #undef HAVE_UCS4_TCL */ + +/* Define if your compiler provides uint32_t. */ +#define HAVE_UINT32_T 1 + +/* Define if your compiler provides uint64_t. */ +#define HAVE_UINT64_T 1 + +/* Define to 1 if the system has the type `uintptr_t'. */ +#define HAVE_UINTPTR_T 1 + +/* Define to 1 if you have the `uname' function. */ +#define HAVE_UNAME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `unsetenv' function. */ +#define HAVE_UNSETENV 1 + +/* Define if you have a useable wchar_t type defined in wchar.h; useable means + wchar_t must be an unsigned type with at least 16 bits. (see + Include/unicodeobject.h). */ +/* #undef HAVE_USABLE_WCHAR_T */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_UTIL_H */ + +/* Define to 1 if you have the `utimes' function. */ +#define HAVE_UTIMES 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UTIME_H 1 + +/* Define to 1 if you have the `wait3' function. */ +#define HAVE_WAIT3 1 + +/* Define to 1 if you have the `wait4' function. */ +#define HAVE_WAIT4 1 + +/* Define to 1 if you have the `waitpid' function. */ +#define HAVE_WAITPID 1 + +/* Define if the compiler provides a wchar.h header file. */ +#define HAVE_WCHAR_H 1 + +/* Define to 1 if you have the `wcscoll' function. */ +#define HAVE_WCSCOLL 1 + +/* Define if tzset() actually switches the local timezone in a meaningful way. + */ +#define HAVE_WORKING_TZSET 1 + +/* Define if the zlib library has inflateCopy */ +#define HAVE_ZLIB_COPY 1 + +/* Define to 1 if you have the `_getpty' function. */ +/* #undef HAVE__GETPTY */ + +/* Define if you are using Mach cthreads directly under /include */ +/* #undef HURD_C_THREADS */ + +/* Define if you are using Mach cthreads under mach / */ +/* #undef MACH_C_THREADS */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in . + */ +/* #undef MAJOR_IN_MKDEV */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in + . */ +#define MAJOR_IN_SYSMACROS 1 + +/* Define if mvwdelch in curses.h is an expression. */ +#define MVWDELCH_IS_EXPRESSION 1 + +/* Define to the address where bug reports for this package should be sent. */ +/* #undef PACKAGE_BUGREPORT */ + +/* Define to the full name of this package. */ +/* #undef PACKAGE_NAME */ + +/* Define to the full name and version of this package. */ +/* #undef PACKAGE_STRING */ + +/* Define to the one symbol short name of this package. */ +/* #undef PACKAGE_TARNAME */ + +/* Define to the home page for this package. */ +/* #undef PACKAGE_URL */ + +/* Define to the version of this package. */ +/* #undef PACKAGE_VERSION */ + +/* Define if POSIX semaphores aren't enabled on your system */ +/* #undef POSIX_SEMAPHORES_NOT_ENABLED */ + +/* Defined if PTHREAD_SCOPE_SYSTEM supported. */ +#define PTHREAD_SYSTEM_SCHED_SUPPORTED 1 + +/* Define as the preferred size in bits of long digits */ +/* #undef PYLONG_BITS_IN_DIGIT */ + +/* Define to printf format modifier for long long type */ +#define PY_FORMAT_LONG_LONG "ll" + +/* Define to printf format modifier for Py_ssize_t */ +#define PY_FORMAT_SIZE_T "z" + +/* Define as the integral type used for Unicode representation. */ +#define PY_UNICODE_TYPE unsigned short + +/* Define if you want to build an interpreter with many run-time checks. */ +/* #undef Py_DEBUG */ + +/* Defined if Python is built as a shared library. */ +#define Py_ENABLE_SHARED 1 + +/* Define as the size of the unicode type. */ +#define Py_UNICODE_SIZE 2 + +/* Define if you want to have a Unicode type. */ +#define Py_USING_UNICODE 1 + +/* assume C89 semantics that RETSIGTYPE is always void */ +#define RETSIGTYPE void + +/* Define if setpgrp() must be called as setpgrp(0, 0). */ +/* #undef SETPGRP_HAVE_ARG */ + +/* Define this to be extension of shared libraries (including the dot!). */ +#define SHLIB_EXT ".so" + +/* Define if i>>j for signed int i does not extend the sign bit when i < 0 */ +/* #undef SIGNED_RIGHT_SHIFT_ZERO_FILLS */ + +/* The size of `double', as computed by sizeof. */ +#define SIZEOF_DOUBLE 8 + +/* The size of `float', as computed by sizeof. */ +#define SIZEOF_FLOAT 4 + +/* The size of `fpos_t', as computed by sizeof. */ +#define SIZEOF_FPOS_T 16 + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 8 + +/* The size of `long double', as computed by sizeof. */ +#define SIZEOF_LONG_DOUBLE 16 + +/* The size of `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* The size of `off_t', as computed by sizeof. */ +#define SIZEOF_OFF_T 8 + +/* The size of `pid_t', as computed by sizeof. */ +#define SIZEOF_PID_T 4 + +/* The size of `pthread_t', as computed by sizeof. */ +#define SIZEOF_PTHREAD_T 8 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 8 + +/* The size of `time_t', as computed by sizeof. */ +#define SIZEOF_TIME_T 8 + +/* The size of `uintptr_t', as computed by sizeof. */ +#define SIZEOF_UINTPTR_T 8 + +/* The size of `void *', as computed by sizeof. */ +#define SIZEOF_VOID_P 8 + +/* The size of `wchar_t', as computed by sizeof. */ +#define SIZEOF_WCHAR_T 4 + +/* The size of `_Bool', as computed by sizeof. */ +#define SIZEOF__BOOL 1 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you can safely include both and + (which you can't on SCO ODT 3.0). */ +#define SYS_SELECT_WITH_SYS_TIME 1 + +/* Define if tanh(-0.) is -0., or if platform doesn't have signed zeros */ +#define TANH_PRESERVES_ZERO_SIGN 1 + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define to 1 if your declares `struct tm'. */ +/* #undef TM_IN_SYS_TIME */ + +/* Define if you want to use computed gotos in ceval.c. */ +/* #undef USE_COMPUTED_GOTOS */ + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif + + +/* Define if you want to use MacPython modules on MacOSX in unix-Python. */ +/* #undef USE_TOOLBOX_OBJECT_GLUE */ + +/* Define if a va_list is an array of some kind */ +#define VA_LIST_IS_ARRAY 1 + +/* Define if you want SIGFPE handled (see Include/pyfpe.h). */ +/* #undef WANT_SIGFPE_HANDLER */ + +/* Define if you want wctype.h functions to be used instead of the one + supplied by Python itself. (see Include/unicodectype.h). */ +/* #undef WANT_WCTYPE_FUNCTIONS */ + +/* Define if WINDOW in curses.h offers a field _flags. */ +#define WINDOW_HAS_FLAGS 1 + +/* Define if you want documentation strings in extension modules */ +#define WITH_DOC_STRINGS 1 + +/* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) dynamic + linker (dyld) instead of the old-style (NextStep) dynamic linker (rld). + Dyld is necessary to support frameworks. */ +/* #undef WITH_DYLD */ + +/* Define to 1 if libintl is needed for locale functions. */ +/* #undef WITH_LIBINTL */ + +/* Define if you want to produce an OpenStep/Rhapsody framework (shared + library plus accessory files). */ +/* #undef WITH_NEXT_FRAMEWORK */ + +/* Define if you want to compile in Python-specific mallocs */ +#define WITH_PYMALLOC 1 + +/* Define if you want to compile in rudimentary thread support */ +#define WITH_THREAD 1 + +/* Define to profile with the Pentium timestamp counter */ +/* #undef WITH_TSC */ + +/* Define if you want pymalloc to be disabled when running under valgrind */ +/* #undef WITH_VALGRIND */ + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Define if arithmetic is subject to x87-style double rounding issue */ +/* #undef X87_DOUBLE_ROUNDING */ + +/* Define on OpenBSD to activate all library features */ +/* #undef _BSD_SOURCE */ + +/* Define on Irix to enable u_int */ +#define _BSD_TYPES 1 + +/* Define on Darwin to activate all library features */ +#define _DARWIN_C_SOURCE 1 + +/* This must be set to 64 on some systems to enable large file support. */ +#define _FILE_OFFSET_BITS 64 + +/* Define on Linux to activate all library features */ +#define _GNU_SOURCE 1 + +/* This must be defined on some systems to enable large file support. */ +#define _LARGEFILE_SOURCE 1 + +/* This must be defined on AIX systems to enable large file support. */ +/* #undef _LARGE_FILES */ + +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + +/* Define on NetBSD to activate all library features */ +#define _NETBSD_SOURCE 1 + +/* Define _OSF_SOURCE to get the makedev macro. */ +/* #undef _OSF_SOURCE */ + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to activate features from IEEE Stds 1003.1-2001 */ +#define _POSIX_C_SOURCE 200112L + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +/* #undef _POSIX_SOURCE */ + +/* Define if you have POSIX threads, and your system does not define that. */ +/* #undef _POSIX_THREADS */ + +/* Define to force use of thread-safe errno, h_errno, and other functions */ +/* #undef _REENTRANT */ + +/* Define for Solaris 2.5.1 so the uint32_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT32_T */ + +/* Define for Solaris 2.5.1 so the uint64_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT64_T */ + +/* Define to the level of X/Open that your system supports */ +#define _XOPEN_SOURCE 600 + +/* Define to activate Unix95-and-earlier features */ +#define _XOPEN_SOURCE_EXTENDED 1 + +/* Define on FreeBSD to activate all library features */ +#define __BSD_VISIBLE 1 + +/* Define to 1 if type `char' is unsigned and you are not using gcc. */ +#ifndef __CHAR_UNSIGNED__ +/* # undef __CHAR_UNSIGNED__ */ +#endif + +/* Defined on Solaris to see additional function prototypes. */ +#define __EXTENSIONS__ 1 + +/* Define to 'long' if doesn't define. */ +/* #undef clock_t */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `int' if doesn't define. */ +/* #undef gid_t */ + +/* Define to the type of a signed integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +/* #undef int32_t */ + +/* Define to the type of a signed integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +/* #undef int64_t */ + +/* Define to `int' if does not define. */ +/* #undef mode_t */ + +/* Define to `long int' if does not define. */ +/* #undef off_t */ + +/* Define to `int' if does not define. */ +/* #undef pid_t */ + +/* Define to empty if the keyword does not work. */ +/* #undef signed */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +/* Define to `int' if does not define. */ +/* #undef socklen_t */ + +/* Define to `int' if doesn't define. */ +/* #undef uid_t */ + +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint32_t */ + +/* Define to the type of an unsigned integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint64_t */ + +/* Define to empty if the keyword does not work. */ +/* #undef volatile */ + + +/* Define the macros needed if on a UnixWare 7.x system. */ +#if defined(__USLC__) && defined(__SCO_VERSION__) +#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ +#endif + +#endif /*Py_PYCONFIG_H*/ + diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/pyctype.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pyctype.h new file mode 100644 index 0000000..673cf2e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pyctype.h @@ -0,0 +1,31 @@ +#ifndef PYCTYPE_H +#define PYCTYPE_H + +#define PY_CTF_LOWER 0x01 +#define PY_CTF_UPPER 0x02 +#define PY_CTF_ALPHA (PY_CTF_LOWER|PY_CTF_UPPER) +#define PY_CTF_DIGIT 0x04 +#define PY_CTF_ALNUM (PY_CTF_ALPHA|PY_CTF_DIGIT) +#define PY_CTF_SPACE 0x08 +#define PY_CTF_XDIGIT 0x10 + +PyAPI_DATA(const unsigned int) _Py_ctype_table[256]; + +/* Unlike their C counterparts, the following macros are not meant to + * handle an int with any of the values [EOF, 0-UCHAR_MAX]. The argument + * must be a signed/unsigned char. */ +#define Py_ISLOWER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_LOWER) +#define Py_ISUPPER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_UPPER) +#define Py_ISALPHA(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALPHA) +#define Py_ISDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_DIGIT) +#define Py_ISXDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_XDIGIT) +#define Py_ISALNUM(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALNUM) +#define Py_ISSPACE(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_SPACE) + +PyAPI_DATA(const unsigned char) _Py_ctype_tolower[256]; +PyAPI_DATA(const unsigned char) _Py_ctype_toupper[256]; + +#define Py_TOLOWER(c) (_Py_ctype_tolower[Py_CHARMASK(c)]) +#define Py_TOUPPER(c) (_Py_ctype_toupper[Py_CHARMASK(c)]) + +#endif /* !PYCTYPE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/pydebug.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pydebug.h new file mode 100644 index 0000000..0f45960 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pydebug.h @@ -0,0 +1,41 @@ + +#ifndef Py_PYDEBUG_H +#define Py_PYDEBUG_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_DATA(int) Py_DebugFlag; +PyAPI_DATA(int) Py_VerboseFlag; +PyAPI_DATA(int) Py_InteractiveFlag; +PyAPI_DATA(int) Py_InspectFlag; +PyAPI_DATA(int) Py_OptimizeFlag; +PyAPI_DATA(int) Py_NoSiteFlag; +PyAPI_DATA(int) Py_BytesWarningFlag; +PyAPI_DATA(int) Py_UseClassExceptionsFlag; +PyAPI_DATA(int) Py_FrozenFlag; +PyAPI_DATA(int) Py_TabcheckFlag; +PyAPI_DATA(int) Py_UnicodeFlag; +PyAPI_DATA(int) Py_IgnoreEnvironmentFlag; +PyAPI_DATA(int) Py_DivisionWarningFlag; +PyAPI_DATA(int) Py_DontWriteBytecodeFlag; +PyAPI_DATA(int) Py_NoUserSiteDirectory; +/* _XXX Py_QnewFlag should go away in 3.0. It's true iff -Qnew is passed, + on the command line, and is used in 2.2 by ceval.c to make all "/" divisions + true divisions (which they will be in 3.0). */ +PyAPI_DATA(int) _Py_QnewFlag; +/* Warn about 3.x issues */ +PyAPI_DATA(int) Py_Py3kWarningFlag; +PyAPI_DATA(int) Py_HashRandomizationFlag; + +/* this is a wrapper around getenv() that pays attention to + Py_IgnoreEnvironmentFlag. It should be used for getting variables like + PYTHONPATH and PYTHONHOME from the environment */ +#define Py_GETENV(s) (Py_IgnoreEnvironmentFlag ? NULL : getenv(s)) + +PyAPI_FUNC(void) Py_FatalError(const char *message); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_PYDEBUG_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/pyerrors.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pyerrors.h new file mode 100644 index 0000000..51134ef --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pyerrors.h @@ -0,0 +1,329 @@ +#ifndef Py_ERRORS_H +#define Py_ERRORS_H +#ifdef __cplusplus +extern "C" { +#endif + +/* Error objects */ + +typedef struct { + PyObject_HEAD + PyObject *dict; + PyObject *args; + PyObject *message; +} PyBaseExceptionObject; + +typedef struct { + PyObject_HEAD + PyObject *dict; + PyObject *args; + PyObject *message; + PyObject *msg; + PyObject *filename; + PyObject *lineno; + PyObject *offset; + PyObject *text; + PyObject *print_file_and_line; +} PySyntaxErrorObject; + +#ifdef Py_USING_UNICODE +typedef struct { + PyObject_HEAD + PyObject *dict; + PyObject *args; + PyObject *message; + PyObject *encoding; + PyObject *object; + Py_ssize_t start; + Py_ssize_t end; + PyObject *reason; +} PyUnicodeErrorObject; +#endif + +typedef struct { + PyObject_HEAD + PyObject *dict; + PyObject *args; + PyObject *message; + PyObject *code; +} PySystemExitObject; + +typedef struct { + PyObject_HEAD + PyObject *dict; + PyObject *args; + PyObject *message; + PyObject *myerrno; + PyObject *strerror; + PyObject *filename; +} PyEnvironmentErrorObject; + +#ifdef MS_WINDOWS +typedef struct { + PyObject_HEAD + PyObject *dict; + PyObject *args; + PyObject *message; + PyObject *myerrno; + PyObject *strerror; + PyObject *filename; + PyObject *winerror; +} PyWindowsErrorObject; +#endif + +/* Error handling definitions */ + +PyAPI_FUNC(void) PyErr_SetNone(PyObject *); +PyAPI_FUNC(void) PyErr_SetObject(PyObject *, PyObject *); +PyAPI_FUNC(void) PyErr_SetString(PyObject *, const char *); +PyAPI_FUNC(PyObject *) PyErr_Occurred(void); +PyAPI_FUNC(void) PyErr_Clear(void); +PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **); +PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *); + +#ifdef Py_DEBUG +#define _PyErr_OCCURRED() PyErr_Occurred() +#else +#define _PyErr_OCCURRED() (_PyThreadState_Current->curexc_type) +#endif + +/* Error testing and normalization */ +PyAPI_FUNC(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *); +PyAPI_FUNC(int) PyErr_ExceptionMatches(PyObject *); +PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**); +PyAPI_FUNC(void) _PyErr_ReplaceException(PyObject *, PyObject *, PyObject *); + +/* */ + +#define PyExceptionClass_Check(x) \ + (PyClass_Check((x)) || (PyType_Check((x)) && \ + PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS))) + +#define PyExceptionInstance_Check(x) \ + (PyInstance_Check((x)) || \ + PyType_FastSubclass((x)->ob_type, Py_TPFLAGS_BASE_EXC_SUBCLASS)) + +#define PyExceptionClass_Name(x) \ + (PyClass_Check((x)) \ + ? PyString_AS_STRING(((PyClassObject*)(x))->cl_name) \ + : (char *)(((PyTypeObject*)(x))->tp_name)) + +#define PyExceptionInstance_Class(x) \ + ((PyInstance_Check((x)) \ + ? (PyObject*)((PyInstanceObject*)(x))->in_class \ + : (PyObject*)((x)->ob_type))) + + +/* Predefined exceptions */ + +PyAPI_DATA(PyObject *) PyExc_BaseException; +PyAPI_DATA(PyObject *) PyExc_Exception; +PyAPI_DATA(PyObject *) PyExc_StopIteration; +PyAPI_DATA(PyObject *) PyExc_GeneratorExit; +PyAPI_DATA(PyObject *) PyExc_StandardError; +PyAPI_DATA(PyObject *) PyExc_ArithmeticError; +PyAPI_DATA(PyObject *) PyExc_LookupError; + +PyAPI_DATA(PyObject *) PyExc_AssertionError; +PyAPI_DATA(PyObject *) PyExc_AttributeError; +PyAPI_DATA(PyObject *) PyExc_EOFError; +PyAPI_DATA(PyObject *) PyExc_FloatingPointError; +PyAPI_DATA(PyObject *) PyExc_EnvironmentError; +PyAPI_DATA(PyObject *) PyExc_IOError; +PyAPI_DATA(PyObject *) PyExc_OSError; +PyAPI_DATA(PyObject *) PyExc_ImportError; +PyAPI_DATA(PyObject *) PyExc_IndexError; +PyAPI_DATA(PyObject *) PyExc_KeyError; +PyAPI_DATA(PyObject *) PyExc_KeyboardInterrupt; +PyAPI_DATA(PyObject *) PyExc_MemoryError; +PyAPI_DATA(PyObject *) PyExc_NameError; +PyAPI_DATA(PyObject *) PyExc_OverflowError; +PyAPI_DATA(PyObject *) PyExc_RuntimeError; +PyAPI_DATA(PyObject *) PyExc_NotImplementedError; +PyAPI_DATA(PyObject *) PyExc_SyntaxError; +PyAPI_DATA(PyObject *) PyExc_IndentationError; +PyAPI_DATA(PyObject *) PyExc_TabError; +PyAPI_DATA(PyObject *) PyExc_ReferenceError; +PyAPI_DATA(PyObject *) PyExc_SystemError; +PyAPI_DATA(PyObject *) PyExc_SystemExit; +PyAPI_DATA(PyObject *) PyExc_TypeError; +PyAPI_DATA(PyObject *) PyExc_UnboundLocalError; +PyAPI_DATA(PyObject *) PyExc_UnicodeError; +PyAPI_DATA(PyObject *) PyExc_UnicodeEncodeError; +PyAPI_DATA(PyObject *) PyExc_UnicodeDecodeError; +PyAPI_DATA(PyObject *) PyExc_UnicodeTranslateError; +PyAPI_DATA(PyObject *) PyExc_ValueError; +PyAPI_DATA(PyObject *) PyExc_ZeroDivisionError; +#ifdef MS_WINDOWS +PyAPI_DATA(PyObject *) PyExc_WindowsError; +#endif +#ifdef __VMS +PyAPI_DATA(PyObject *) PyExc_VMSError; +#endif + +PyAPI_DATA(PyObject *) PyExc_BufferError; + +PyAPI_DATA(PyObject *) PyExc_MemoryErrorInst; +PyAPI_DATA(PyObject *) PyExc_RecursionErrorInst; + +/* Predefined warning categories */ +PyAPI_DATA(PyObject *) PyExc_Warning; +PyAPI_DATA(PyObject *) PyExc_UserWarning; +PyAPI_DATA(PyObject *) PyExc_DeprecationWarning; +PyAPI_DATA(PyObject *) PyExc_PendingDeprecationWarning; +PyAPI_DATA(PyObject *) PyExc_SyntaxWarning; +PyAPI_DATA(PyObject *) PyExc_RuntimeWarning; +PyAPI_DATA(PyObject *) PyExc_FutureWarning; +PyAPI_DATA(PyObject *) PyExc_ImportWarning; +PyAPI_DATA(PyObject *) PyExc_UnicodeWarning; +PyAPI_DATA(PyObject *) PyExc_BytesWarning; + + +/* Convenience functions */ + +PyAPI_FUNC(int) PyErr_BadArgument(void); +PyAPI_FUNC(PyObject *) PyErr_NoMemory(void); +PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *); +PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject( + PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename( + PyObject *, const char *); +#ifdef MS_WINDOWS +PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename( + PyObject *, const Py_UNICODE *); +#endif /* MS_WINDOWS */ + +PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *, const char *, ...) + Py_GCC_ATTRIBUTE((format(printf, 2, 3))); + +#ifdef MS_WINDOWS +PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilenameObject( + int, const char *); +PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename( + int, const char *); +PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename( + int, const Py_UNICODE *); +PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int); +PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject( + PyObject *,int, PyObject *); +PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename( + PyObject *,int, const char *); +PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename( + PyObject *,int, const Py_UNICODE *); +PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int); +#endif /* MS_WINDOWS */ + +/* Export the old function so that the existing API remains available: */ +PyAPI_FUNC(void) PyErr_BadInternalCall(void); +PyAPI_FUNC(void) _PyErr_BadInternalCall(const char *filename, int lineno); +/* Mask the old API with a call to the new API for code compiled under + Python 2.0: */ +#define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__) + +/* Function to create a new exception */ +PyAPI_FUNC(PyObject *) PyErr_NewException( + char *name, PyObject *base, PyObject *dict); +PyAPI_FUNC(PyObject *) PyErr_NewExceptionWithDoc( + char *name, char *doc, PyObject *base, PyObject *dict); +PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *); + +/* In sigcheck.c or signalmodule.c */ +PyAPI_FUNC(int) PyErr_CheckSignals(void); +PyAPI_FUNC(void) PyErr_SetInterrupt(void); + +/* In signalmodule.c */ +int PySignal_SetWakeupFd(int fd); + +/* Support for adding program text to SyntaxErrors */ +PyAPI_FUNC(void) PyErr_SyntaxLocation(const char *, int); +PyAPI_FUNC(PyObject *) PyErr_ProgramText(const char *, int); + +#ifdef Py_USING_UNICODE +/* The following functions are used to create and modify unicode + exceptions from C */ + +/* create a UnicodeDecodeError object */ +PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_Create( + const char *, const char *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *); + +/* create a UnicodeEncodeError object */ +PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create( + const char *, const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *); + +/* create a UnicodeTranslateError object */ +PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create( + const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *); + +/* get the encoding attribute */ +PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetEncoding(PyObject *); +PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetEncoding(PyObject *); + +/* get the object attribute */ +PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetObject(PyObject *); +PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetObject(PyObject *); +PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetObject(PyObject *); + +/* get the value of the start attribute (the int * may not be NULL) + return 0 on success, -1 on failure */ +PyAPI_FUNC(int) PyUnicodeEncodeError_GetStart(PyObject *, Py_ssize_t *); +PyAPI_FUNC(int) PyUnicodeDecodeError_GetStart(PyObject *, Py_ssize_t *); +PyAPI_FUNC(int) PyUnicodeTranslateError_GetStart(PyObject *, Py_ssize_t *); + +/* assign a new value to the start attribute + return 0 on success, -1 on failure */ +PyAPI_FUNC(int) PyUnicodeEncodeError_SetStart(PyObject *, Py_ssize_t); +PyAPI_FUNC(int) PyUnicodeDecodeError_SetStart(PyObject *, Py_ssize_t); +PyAPI_FUNC(int) PyUnicodeTranslateError_SetStart(PyObject *, Py_ssize_t); + +/* get the value of the end attribute (the int *may not be NULL) + return 0 on success, -1 on failure */ +PyAPI_FUNC(int) PyUnicodeEncodeError_GetEnd(PyObject *, Py_ssize_t *); +PyAPI_FUNC(int) PyUnicodeDecodeError_GetEnd(PyObject *, Py_ssize_t *); +PyAPI_FUNC(int) PyUnicodeTranslateError_GetEnd(PyObject *, Py_ssize_t *); + +/* assign a new value to the end attribute + return 0 on success, -1 on failure */ +PyAPI_FUNC(int) PyUnicodeEncodeError_SetEnd(PyObject *, Py_ssize_t); +PyAPI_FUNC(int) PyUnicodeDecodeError_SetEnd(PyObject *, Py_ssize_t); +PyAPI_FUNC(int) PyUnicodeTranslateError_SetEnd(PyObject *, Py_ssize_t); + +/* get the value of the reason attribute */ +PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetReason(PyObject *); +PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetReason(PyObject *); +PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetReason(PyObject *); + +/* assign a new value to the reason attribute + return 0 on success, -1 on failure */ +PyAPI_FUNC(int) PyUnicodeEncodeError_SetReason( + PyObject *, const char *); +PyAPI_FUNC(int) PyUnicodeDecodeError_SetReason( + PyObject *, const char *); +PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason( + PyObject *, const char *); +#endif + + +/* These APIs aren't really part of the error implementation, but + often needed to format error messages; the native C lib APIs are + not available on all platforms, which is why we provide emulations + for those platforms in Python/mysnprintf.c, + WARNING: The return value of snprintf varies across platforms; do + not rely on any particular behavior; eventually the C99 defn may + be reliable. +*/ +#if defined(MS_WIN32) && !defined(HAVE_SNPRINTF) +# define HAVE_SNPRINTF +# define snprintf _snprintf +# define vsnprintf _vsnprintf +#endif + +#include +PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...) + Py_GCC_ATTRIBUTE((format(printf, 3, 4))); +PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) + Py_GCC_ATTRIBUTE((format(printf, 3, 0))); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_ERRORS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/pyexpat.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pyexpat.h new file mode 100644 index 0000000..5340ef5 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pyexpat.h @@ -0,0 +1,48 @@ +/* Stuff to export relevant 'expat' entry points from pyexpat to other + * parser modules, such as cElementTree. */ + +/* note: you must import expat.h before importing this module! */ + +#define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.0" +#define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI" + +struct PyExpat_CAPI +{ + char* magic; /* set to PyExpat_CAPI_MAGIC */ + int size; /* set to sizeof(struct PyExpat_CAPI) */ + int MAJOR_VERSION; + int MINOR_VERSION; + int MICRO_VERSION; + /* pointers to selected expat functions. add new functions at + the end, if needed */ + const XML_LChar * (*ErrorString)(enum XML_Error code); + enum XML_Error (*GetErrorCode)(XML_Parser parser); + XML_Size (*GetErrorColumnNumber)(XML_Parser parser); + XML_Size (*GetErrorLineNumber)(XML_Parser parser); + enum XML_Status (*Parse)( + XML_Parser parser, const char *s, int len, int isFinal); + XML_Parser (*ParserCreate_MM)( + const XML_Char *encoding, const XML_Memory_Handling_Suite *memsuite, + const XML_Char *namespaceSeparator); + void (*ParserFree)(XML_Parser parser); + void (*SetCharacterDataHandler)( + XML_Parser parser, XML_CharacterDataHandler handler); + void (*SetCommentHandler)( + XML_Parser parser, XML_CommentHandler handler); + void (*SetDefaultHandlerExpand)( + XML_Parser parser, XML_DefaultHandler handler); + void (*SetElementHandler)( + XML_Parser parser, XML_StartElementHandler start, + XML_EndElementHandler end); + void (*SetNamespaceDeclHandler)( + XML_Parser parser, XML_StartNamespaceDeclHandler start, + XML_EndNamespaceDeclHandler end); + void (*SetProcessingInstructionHandler)( + XML_Parser parser, XML_ProcessingInstructionHandler handler); + void (*SetUnknownEncodingHandler)( + XML_Parser parser, XML_UnknownEncodingHandler handler, + void *encodingHandlerData); + void (*SetUserData)(XML_Parser parser, void *userData); + /* always add new stuff to the end! */ +}; + diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/pyfpe.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pyfpe.h new file mode 100644 index 0000000..f9a15e6 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pyfpe.h @@ -0,0 +1,176 @@ +#ifndef Py_PYFPE_H +#define Py_PYFPE_H +#ifdef __cplusplus +extern "C" { +#endif +/* + --------------------------------------------------------------------- + / Copyright (c) 1996. \ + | The Regents of the University of California. | + | All rights reserved. | + | | + | Permission to use, copy, modify, and distribute this software for | + | any purpose without fee is hereby granted, provided that this en- | + | tire notice is included in all copies of any software which is or | + | includes a copy or modification of this software and in all | + | copies of the supporting documentation for such software. | + | | + | This work was produced at the University of California, Lawrence | + | Livermore National Laboratory under contract no. W-7405-ENG-48 | + | between the U.S. Department of Energy and The Regents of the | + | University of California for the operation of UC LLNL. | + | | + | DISCLAIMER | + | | + | This software was prepared as an account of work sponsored by an | + | agency of the United States Government. Neither the United States | + | Government nor the University of California nor any of their em- | + | ployees, makes any warranty, express or implied, or assumes any | + | liability or responsibility for the accuracy, completeness, or | + | usefulness of any information, apparatus, product, or process | + | disclosed, or represents that its use would not infringe | + | privately-owned rights. Reference herein to any specific commer- | + | cial products, process, or service by trade name, trademark, | + | manufacturer, or otherwise, does not necessarily constitute or | + | imply its endorsement, recommendation, or favoring by the United | + | States Government or the University of California. The views and | + | opinions of authors expressed herein do not necessarily state or | + | reflect those of the United States Government or the University | + | of California, and shall not be used for advertising or product | + \ endorsement purposes. / + --------------------------------------------------------------------- +*/ + +/* + * Define macros for handling SIGFPE. + * Lee Busby, LLNL, November, 1996 + * busby1@llnl.gov + * + ********************************************* + * Overview of the system for handling SIGFPE: + * + * This file (Include/pyfpe.h) defines a couple of "wrapper" macros for + * insertion into your Python C code of choice. Their proper use is + * discussed below. The file Python/pyfpe.c defines a pair of global + * variables PyFPE_jbuf and PyFPE_counter which are used by the signal + * handler for SIGFPE to decide if a particular exception was protected + * by the macros. The signal handler itself, and code for enabling the + * generation of SIGFPE in the first place, is in a (new) Python module + * named fpectl. This module is standard in every respect. It can be loaded + * either statically or dynamically as you choose, and like any other + * Python module, has no effect until you import it. + * + * In the general case, there are three steps toward handling SIGFPE in any + * Python code: + * + * 1) Add the *_PROTECT macros to your C code as required to protect + * dangerous floating point sections. + * + * 2) Turn on the inclusion of the code by adding the ``--with-fpectl'' + * flag at the time you run configure. If the fpectl or other modules + * which use the *_PROTECT macros are to be dynamically loaded, be + * sure they are compiled with WANT_SIGFPE_HANDLER defined. + * + * 3) When python is built and running, import fpectl, and execute + * fpectl.turnon_sigfpe(). This sets up the signal handler and enables + * generation of SIGFPE whenever an exception occurs. From this point + * on, any properly trapped SIGFPE should result in the Python + * FloatingPointError exception. + * + * Step 1 has been done already for the Python kernel code, and should be + * done soon for the NumPy array package. Step 2 is usually done once at + * python install time. Python's behavior with respect to SIGFPE is not + * changed unless you also do step 3. Thus you can control this new + * facility at compile time, or run time, or both. + * + ******************************** + * Using the macros in your code: + * + * static PyObject *foobar(PyObject *self,PyObject *args) + * { + * .... + * PyFPE_START_PROTECT("Error in foobar", return 0) + * result = dangerous_op(somearg1, somearg2, ...); + * PyFPE_END_PROTECT(result) + * .... + * } + * + * If a floating point error occurs in dangerous_op, foobar returns 0 (NULL), + * after setting the associated value of the FloatingPointError exception to + * "Error in foobar". ``Dangerous_op'' can be a single operation, or a block + * of code, function calls, or any combination, so long as no alternate + * return is possible before the PyFPE_END_PROTECT macro is reached. + * + * The macros can only be used in a function context where an error return + * can be recognized as signaling a Python exception. (Generally, most + * functions that return a PyObject * will qualify.) + * + * Guido's original design suggestion for PyFPE_START_PROTECT and + * PyFPE_END_PROTECT had them open and close a local block, with a locally + * defined jmp_buf and jmp_buf pointer. This would allow recursive nesting + * of the macros. The Ansi C standard makes it clear that such local + * variables need to be declared with the "volatile" type qualifier to keep + * setjmp from corrupting their values. Some current implementations seem + * to be more restrictive. For example, the HPUX man page for setjmp says + * + * Upon the return from a setjmp() call caused by a longjmp(), the + * values of any non-static local variables belonging to the routine + * from which setjmp() was called are undefined. Code which depends on + * such values is not guaranteed to be portable. + * + * I therefore decided on a more limited form of nesting, using a counter + * variable (PyFPE_counter) to keep track of any recursion. If an exception + * occurs in an ``inner'' pair of macros, the return will apparently + * come from the outermost level. + * + */ + +#ifdef WANT_SIGFPE_HANDLER +#include +#include +#include +extern jmp_buf PyFPE_jbuf; +extern int PyFPE_counter; +extern double PyFPE_dummy(void *); + +#define PyFPE_START_PROTECT(err_string, leave_stmt) \ +if (!PyFPE_counter++ && setjmp(PyFPE_jbuf)) { \ + PyErr_SetString(PyExc_FloatingPointError, err_string); \ + PyFPE_counter = 0; \ + leave_stmt; \ +} + +/* + * This (following) is a heck of a way to decrement a counter. However, + * unless the macro argument is provided, code optimizers will sometimes move + * this statement so that it gets executed *before* the unsafe expression + * which we're trying to protect. That pretty well messes things up, + * of course. + * + * If the expression(s) you're trying to protect don't happen to return a + * value, you will need to manufacture a dummy result just to preserve the + * correct ordering of statements. Note that the macro passes the address + * of its argument (so you need to give it something which is addressable). + * If your expression returns multiple results, pass the last such result + * to PyFPE_END_PROTECT. + * + * Note that PyFPE_dummy returns a double, which is cast to int. + * This seeming insanity is to tickle the Floating Point Unit (FPU). + * If an exception has occurred in a preceding floating point operation, + * some architectures (notably Intel 80x86) will not deliver the interrupt + * until the *next* floating point operation. This is painful if you've + * already decremented PyFPE_counter. + */ +#define PyFPE_END_PROTECT(v) PyFPE_counter -= (int)PyFPE_dummy(&(v)); + +#else + +#define PyFPE_START_PROTECT(err_string, leave_stmt) +#define PyFPE_END_PROTECT(v) + +#endif + +#ifdef __cplusplus +} +#endif +#endif /* !Py_PYFPE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/pygetopt.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pygetopt.h new file mode 100644 index 0000000..9860d36 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pygetopt.h @@ -0,0 +1,18 @@ + +#ifndef Py_PYGETOPT_H +#define Py_PYGETOPT_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_DATA(int) _PyOS_opterr; +PyAPI_DATA(int) _PyOS_optind; +PyAPI_DATA(char *) _PyOS_optarg; + +PyAPI_FUNC(void) _PyOS_ResetGetOpt(void); +PyAPI_FUNC(int) _PyOS_GetOpt(int argc, char **argv, char *optstring); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_PYGETOPT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/pymacconfig.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pymacconfig.h new file mode 100644 index 0000000..9dde11b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pymacconfig.h @@ -0,0 +1,102 @@ +#ifndef PYMACCONFIG_H +#define PYMACCONFIG_H + /* + * This file moves some of the autoconf magic to compile-time + * when building on MacOSX. This is needed for building 4-way + * universal binaries and for 64-bit universal binaries because + * the values redefined below aren't configure-time constant but + * only compile-time constant in these scenarios. + */ + +#if defined(__APPLE__) + +# undef SIZEOF_LONG +# undef SIZEOF_PTHREAD_T +# undef SIZEOF_SIZE_T +# undef SIZEOF_TIME_T +# undef SIZEOF_VOID_P +# undef SIZEOF__BOOL +# undef SIZEOF_UINTPTR_T +# undef SIZEOF_PTHREAD_T +# undef WORDS_BIGENDIAN +# undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 +# undef DOUBLE_IS_BIG_ENDIAN_IEEE754 +# undef DOUBLE_IS_LITTLE_ENDIAN_IEEE754 +# undef HAVE_GCC_ASM_FOR_X87 + +# undef VA_LIST_IS_ARRAY +# if defined(__LP64__) && defined(__x86_64__) +# define VA_LIST_IS_ARRAY 1 +# endif + +# undef HAVE_LARGEFILE_SUPPORT +# ifndef __LP64__ +# define HAVE_LARGEFILE_SUPPORT 1 +# endif + +# undef SIZEOF_LONG +# ifdef __LP64__ +# define SIZEOF__BOOL 1 +# define SIZEOF__BOOL 1 +# define SIZEOF_LONG 8 +# define SIZEOF_PTHREAD_T 8 +# define SIZEOF_SIZE_T 8 +# define SIZEOF_TIME_T 8 +# define SIZEOF_VOID_P 8 +# define SIZEOF_UINTPTR_T 8 +# define SIZEOF_PTHREAD_T 8 +# else +# ifdef __ppc__ +# define SIZEOF__BOOL 4 +# else +# define SIZEOF__BOOL 1 +# endif +# define SIZEOF_LONG 4 +# define SIZEOF_PTHREAD_T 4 +# define SIZEOF_SIZE_T 4 +# define SIZEOF_TIME_T 4 +# define SIZEOF_VOID_P 4 +# define SIZEOF_UINTPTR_T 4 +# define SIZEOF_PTHREAD_T 4 +# endif + +# if defined(__LP64__) + /* MacOSX 10.4 (the first release to support 64-bit code + * at all) only supports 64-bit in the UNIX layer. + * Therefore suppress the toolbox-glue in 64-bit mode. + */ + + /* In 64-bit mode setpgrp always has no arguments, in 32-bit + * mode that depends on the compilation environment + */ +# undef SETPGRP_HAVE_ARG + +# endif + +#ifdef __BIG_ENDIAN__ +#define WORDS_BIGENDIAN 1 +#define DOUBLE_IS_BIG_ENDIAN_IEEE754 +#else +#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 +#endif /* __BIG_ENDIAN */ + +#ifdef __i386__ +# define HAVE_GCC_ASM_FOR_X87 +#endif + + /* + * The definition in pyconfig.h is only valid on the OS release + * where configure ran on and not necessarily for all systems where + * the executable can be used on. + * + * Specifically: OSX 10.4 has limited supported for '%zd', while + * 10.5 has full support for '%zd'. A binary built on 10.5 won't + * work properly on 10.4 unless we suppress the definition + * of PY_FORMAT_SIZE_T + */ +#undef PY_FORMAT_SIZE_T + + +#endif /* defined(_APPLE__) */ + +#endif /* PYMACCONFIG_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/pymactoolbox.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pymactoolbox.h new file mode 100644 index 0000000..6e48ca3 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pymactoolbox.h @@ -0,0 +1,232 @@ +/* +** pymactoolbox.h - globals defined in mactoolboxglue.c +*/ +#ifndef Py_PYMACTOOLBOX_H +#define Py_PYMACTOOLBOX_H +#ifdef __cplusplus + extern "C" { +#endif + +#include + +/* +** Issue #27806: Workaround for gcc 4.x which does not have _has_include. +*/ +#ifndef __has_include +#define __has_include(x) 0 +#endif +/* Workaround */ + +#if __has_include() +#include +#define APPLE_SUPPORTS_QUICKTIME (__MAC_OS_X_VERSION_MAX_ALLOWED < 101200) && !__LP64__ +#else +#define APPLE_SUPPORTS_QUICKTIME !__LP64__ +#endif + +#if APPLE_SUPPORTS_QUICKTIME +#include +#endif /* APPLE_SUPPORTS_QUICKTIME */ + +/* +** Helper routines for error codes and such. +*/ +char *PyMac_StrError(int); /* strerror with mac errors */ +extern PyObject *PyMac_OSErrException; /* Exception for OSErr */ +PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */ +PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */ +PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */ +#if APPLE_SUPPORTS_QUICKTIME +extern OSErr PyMac_GetFullPathname(FSSpec *, char *, int); /* convert + fsspec->path */ +#endif /* APPLE_SUPPORTS_QUICKTIME */ + +/* +** These conversion routines are defined in mactoolboxglue.c itself. +*/ +int PyMac_GetOSType(PyObject *, OSType *); /* argument parser for OSType */ +PyObject *PyMac_BuildOSType(OSType); /* Convert OSType to PyObject */ + +PyObject *PyMac_BuildNumVersion(NumVersion);/* Convert NumVersion to PyObject */ + +int PyMac_GetStr255(PyObject *, Str255); /* argument parser for Str255 */ +PyObject *PyMac_BuildStr255(Str255); /* Convert Str255 to PyObject */ +PyObject *PyMac_BuildOptStr255(Str255); /* Convert Str255 to PyObject, + NULL to None */ + +int PyMac_GetRect(PyObject *, Rect *); /* argument parser for Rect */ +PyObject *PyMac_BuildRect(Rect *); /* Convert Rect to PyObject */ + +int PyMac_GetPoint(PyObject *, Point *); /* argument parser for Point */ +PyObject *PyMac_BuildPoint(Point); /* Convert Point to PyObject */ + +int PyMac_GetEventRecord(PyObject *, EventRecord *); /* argument parser for + EventRecord */ +PyObject *PyMac_BuildEventRecord(EventRecord *); /* Convert EventRecord to + PyObject */ + +int PyMac_GetFixed(PyObject *, Fixed *); /* argument parser for Fixed */ +PyObject *PyMac_BuildFixed(Fixed); /* Convert Fixed to PyObject */ +int PyMac_Getwide(PyObject *, wide *); /* argument parser for wide */ +PyObject *PyMac_Buildwide(wide *); /* Convert wide to PyObject */ + +/* +** The rest of the routines are implemented by extension modules. If they are +** dynamically loaded mactoolboxglue will contain a stub implementation of the +** routine, which imports the module, whereupon the module's init routine will +** communicate the routine pointer back to the stub. +** If USE_TOOLBOX_OBJECT_GLUE is not defined there is no glue code, and the +** extension modules simply declare the routine. This is the case for static +** builds (and could be the case for MacPython CFM builds, because CFM extension +** modules can reference each other without problems). +*/ + +#ifdef USE_TOOLBOX_OBJECT_GLUE +/* +** These macros are used in the module init code. If we use toolbox object glue +** it sets the function pointer to point to the real function. +*/ +#define PyMac_INIT_TOOLBOX_OBJECT_NEW(object, rtn) { \ + extern PyObject *(*PyMacGluePtr_##rtn)(object); \ + PyMacGluePtr_##rtn = _##rtn; \ +} +#define PyMac_INIT_TOOLBOX_OBJECT_CONVERT(object, rtn) { \ + extern int (*PyMacGluePtr_##rtn)(PyObject *, object *); \ + PyMacGluePtr_##rtn = _##rtn; \ +} +#else +/* +** If we don't use toolbox object glue the init macros are empty. Moreover, we define +** _xxx_New to be the same as xxx_New, and the code in mactoolboxglue isn't included. +*/ +#define PyMac_INIT_TOOLBOX_OBJECT_NEW(object, rtn) +#define PyMac_INIT_TOOLBOX_OBJECT_CONVERT(object, rtn) +#endif /* USE_TOOLBOX_OBJECT_GLUE */ + +/* macfs exports */ +#ifndef __LP64__ +int PyMac_GetFSSpec(PyObject *, FSSpec *); /* argument parser for FSSpec */ +PyObject *PyMac_BuildFSSpec(FSSpec *); /* Convert FSSpec to PyObject */ +#endif /* !__LP64__ */ + +int PyMac_GetFSRef(PyObject *, FSRef *); /* argument parser for FSRef */ +PyObject *PyMac_BuildFSRef(FSRef *); /* Convert FSRef to PyObject */ + +/* AE exports */ +extern PyObject *AEDesc_New(AppleEvent *); /* XXXX Why passed by address?? */ +extern PyObject *AEDesc_NewBorrowed(AppleEvent *); +extern int AEDesc_Convert(PyObject *, AppleEvent *); + +/* Cm exports */ +extern PyObject *CmpObj_New(Component); +extern int CmpObj_Convert(PyObject *, Component *); +extern PyObject *CmpInstObj_New(ComponentInstance); +extern int CmpInstObj_Convert(PyObject *, ComponentInstance *); + +/* Ctl exports */ +#if APPLE_SUPPORTS_QUICKTIME +extern PyObject *CtlObj_New(ControlHandle); +extern int CtlObj_Convert(PyObject *, ControlHandle *); +#endif /* APPLE_SUPPORTS_QUICKTIME */ + +/* Dlg exports */ +#if APPLE_SUPPORTS_QUICKTIME +extern PyObject *DlgObj_New(DialogPtr); +extern int DlgObj_Convert(PyObject *, DialogPtr *); +extern PyObject *DlgObj_WhichDialog(DialogPtr); +#endif /* APPLE_SUPPORTS_QUICKTIME */ + +/* Drag exports */ +#if APPLE_SUPPORTS_QUICKTIME +extern PyObject *DragObj_New(DragReference); +extern int DragObj_Convert(PyObject *, DragReference *); +#endif /* APPLE_SUPPORTS_QUICKTIME */ + +/* List exports */ +#if APPLE_SUPPORTS_QUICKTIME +extern PyObject *ListObj_New(ListHandle); +extern int ListObj_Convert(PyObject *, ListHandle *); +#endif /* APPLE_SUPPORTS_QUICKTIME */ + +/* Menu exports */ +#if APPLE_SUPPORTS_QUICKTIME +extern PyObject *MenuObj_New(MenuHandle); +extern int MenuObj_Convert(PyObject *, MenuHandle *); +#endif /* APPLE_SUPPORTS_QUICKTIME */ + +/* Qd exports */ +#if APPLE_SUPPORTS_QUICKTIME +extern PyObject *GrafObj_New(GrafPtr); +extern int GrafObj_Convert(PyObject *, GrafPtr *); +extern PyObject *BMObj_New(BitMapPtr); +extern int BMObj_Convert(PyObject *, BitMapPtr *); +extern PyObject *QdRGB_New(RGBColor *); +extern int QdRGB_Convert(PyObject *, RGBColor *); +#endif /* APPLE_SUPPORTS_QUICKTIME */ + +/* Qdoffs exports */ +#if APPLE_SUPPORTS_QUICKTIME +extern PyObject *GWorldObj_New(GWorldPtr); +extern int GWorldObj_Convert(PyObject *, GWorldPtr *); +#endif /* APPLE_SUPPORTS_QUICKTIME */ + +/* Qt exports */ +#if APPLE_SUPPORTS_QUICKTIME +extern PyObject *TrackObj_New(Track); +extern int TrackObj_Convert(PyObject *, Track *); +extern PyObject *MovieObj_New(Movie); +extern int MovieObj_Convert(PyObject *, Movie *); +extern PyObject *MovieCtlObj_New(MovieController); +extern int MovieCtlObj_Convert(PyObject *, MovieController *); +extern PyObject *TimeBaseObj_New(TimeBase); +extern int TimeBaseObj_Convert(PyObject *, TimeBase *); +extern PyObject *UserDataObj_New(UserData); +extern int UserDataObj_Convert(PyObject *, UserData *); +extern PyObject *MediaObj_New(Media); +extern int MediaObj_Convert(PyObject *, Media *); +#endif /* APPLE_SUPPORTS_QUICKTIME */ + +/* Res exports */ +extern PyObject *ResObj_New(Handle); +extern int ResObj_Convert(PyObject *, Handle *); +extern PyObject *OptResObj_New(Handle); +extern int OptResObj_Convert(PyObject *, Handle *); + +/* TE exports */ +#if APPLE_SUPPORTS_QUICKTIME +extern PyObject *TEObj_New(TEHandle); +extern int TEObj_Convert(PyObject *, TEHandle *); +#endif /* APPLE_SUPPORTS_QUICKTIME */ + +/* Win exports */ +#if APPLE_SUPPORTS_QUICKTIME +extern PyObject *WinObj_New(WindowPtr); +extern int WinObj_Convert(PyObject *, WindowPtr *); +extern PyObject *WinObj_WhichWindow(WindowPtr); +#endif /* APPLE_SUPPORTS_QUICKTIME */ + +/* CF exports */ +extern PyObject *CFObj_New(CFTypeRef); +extern int CFObj_Convert(PyObject *, CFTypeRef *); +extern PyObject *CFTypeRefObj_New(CFTypeRef); +extern int CFTypeRefObj_Convert(PyObject *, CFTypeRef *); +extern PyObject *CFStringRefObj_New(CFStringRef); +extern int CFStringRefObj_Convert(PyObject *, CFStringRef *); +extern PyObject *CFMutableStringRefObj_New(CFMutableStringRef); +extern int CFMutableStringRefObj_Convert(PyObject *, CFMutableStringRef *); +extern PyObject *CFArrayRefObj_New(CFArrayRef); +extern int CFArrayRefObj_Convert(PyObject *, CFArrayRef *); +extern PyObject *CFMutableArrayRefObj_New(CFMutableArrayRef); +extern int CFMutableArrayRefObj_Convert(PyObject *, CFMutableArrayRef *); +extern PyObject *CFDictionaryRefObj_New(CFDictionaryRef); +extern int CFDictionaryRefObj_Convert(PyObject *, CFDictionaryRef *); +extern PyObject *CFMutableDictionaryRefObj_New(CFMutableDictionaryRef); +extern int CFMutableDictionaryRefObj_Convert(PyObject *, CFMutableDictionaryRef *); +extern PyObject *CFURLRefObj_New(CFURLRef); +extern int CFURLRefObj_Convert(PyObject *, CFURLRef *); +extern int OptionalCFURLRefObj_Convert(PyObject *, CFURLRef *); + +#ifdef __cplusplus + } +#endif +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/pymath.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pymath.h new file mode 100644 index 0000000..b234f97 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pymath.h @@ -0,0 +1,214 @@ +#ifndef Py_PYMATH_H +#define Py_PYMATH_H + +#include "pyconfig.h" /* include for defines */ + +/************************************************************************** +Symbols and macros to supply platform-independent interfaces to mathematical +functions and constants +**************************************************************************/ + +/* Python provides implementations for copysign, round and hypot in + * Python/pymath.c just in case your math library doesn't provide the + * functions. + * + *Note: PC/pyconfig.h defines copysign as _copysign + */ +#ifndef HAVE_COPYSIGN +extern double copysign(double, double); +#endif + +#ifndef HAVE_ROUND +extern double round(double); +#endif + +#ifndef HAVE_HYPOT +extern double hypot(double, double); +#endif + +/* extra declarations */ +#ifndef _MSC_VER +#ifndef __STDC__ +extern double fmod (double, double); +extern double frexp (double, int *); +extern double ldexp (double, int); +extern double modf (double, double *); +extern double pow(double, double); +#endif /* __STDC__ */ +#endif /* _MSC_VER */ + +#ifdef _OSF_SOURCE +/* OSF1 5.1 doesn't make these available with XOPEN_SOURCE_EXTENDED defined */ +extern int finite(double); +extern double copysign(double, double); +#endif + +/* High precision definition of pi and e (Euler) + * The values are taken from libc6's math.h. + */ +#ifndef Py_MATH_PIl +#define Py_MATH_PIl 3.1415926535897932384626433832795029L +#endif +#ifndef Py_MATH_PI +#define Py_MATH_PI 3.14159265358979323846 +#endif + +#ifndef Py_MATH_El +#define Py_MATH_El 2.7182818284590452353602874713526625L +#endif + +#ifndef Py_MATH_E +#define Py_MATH_E 2.7182818284590452354 +#endif + +/* On x86, Py_FORCE_DOUBLE forces a floating-point number out of an x87 FPU + register and into a 64-bit memory location, rounding from extended + precision to double precision in the process. On other platforms it does + nothing. */ + +/* we take double rounding as evidence of x87 usage */ +#ifndef Py_FORCE_DOUBLE +# ifdef X87_DOUBLE_ROUNDING +PyAPI_FUNC(double) _Py_force_double(double); +# define Py_FORCE_DOUBLE(X) (_Py_force_double(X)) +# else +# define Py_FORCE_DOUBLE(X) (X) +# endif +#endif + +#ifdef HAVE_GCC_ASM_FOR_X87 +PyAPI_FUNC(unsigned short) _Py_get_387controlword(void); +PyAPI_FUNC(void) _Py_set_387controlword(unsigned short); +#endif + +/* Py_IS_NAN(X) + * Return 1 if float or double arg is a NaN, else 0. + * Caution: + * X is evaluated more than once. + * This may not work on all platforms. Each platform has *some* + * way to spell this, though -- override in pyconfig.h if you have + * a platform where it doesn't work. + * Note: PC/pyconfig.h defines Py_IS_NAN as _isnan + */ +#ifndef Py_IS_NAN +#if defined HAVE_DECL_ISNAN && HAVE_DECL_ISNAN == 1 +#define Py_IS_NAN(X) isnan(X) +#else +#define Py_IS_NAN(X) ((X) != (X)) +#endif +#endif + +/* Py_IS_INFINITY(X) + * Return 1 if float or double arg is an infinity, else 0. + * Caution: + * X is evaluated more than once. + * This implementation may set the underflow flag if |X| is very small; + * it really can't be implemented correctly (& easily) before C99. + * Override in pyconfig.h if you have a better spelling on your platform. + * Py_FORCE_DOUBLE is used to avoid getting false negatives from a + * non-infinite value v sitting in an 80-bit x87 register such that + * v becomes infinite when spilled from the register to 64-bit memory. + * Note: PC/pyconfig.h defines Py_IS_INFINITY as _isinf + */ +#ifndef Py_IS_INFINITY +# if defined HAVE_DECL_ISINF && HAVE_DECL_ISINF == 1 +# define Py_IS_INFINITY(X) isinf(X) +# else +# define Py_IS_INFINITY(X) ((X) && \ + (Py_FORCE_DOUBLE(X)*0.5 == Py_FORCE_DOUBLE(X))) +# endif +#endif + +/* Py_IS_FINITE(X) + * Return 1 if float or double arg is neither infinite nor NAN, else 0. + * Some compilers (e.g. VisualStudio) have intrisics for this, so a special + * macro for this particular test is useful + * Note: PC/pyconfig.h defines Py_IS_FINITE as _finite + */ +#ifndef Py_IS_FINITE +#if defined HAVE_DECL_ISFINITE && HAVE_DECL_ISFINITE == 1 +#define Py_IS_FINITE(X) isfinite(X) +#elif defined HAVE_FINITE +#define Py_IS_FINITE(X) finite(X) +#else +#define Py_IS_FINITE(X) (!Py_IS_INFINITY(X) && !Py_IS_NAN(X)) +#endif +#endif + +/* HUGE_VAL is supposed to expand to a positive double infinity. Python + * uses Py_HUGE_VAL instead because some platforms are broken in this + * respect. We used to embed code in pyport.h to try to worm around that, + * but different platforms are broken in conflicting ways. If you're on + * a platform where HUGE_VAL is defined incorrectly, fiddle your Python + * config to #define Py_HUGE_VAL to something that works on your platform. + */ +#ifndef Py_HUGE_VAL +#define Py_HUGE_VAL HUGE_VAL +#endif + +/* Py_NAN + * A value that evaluates to a NaN. On IEEE 754 platforms INF*0 or + * INF/INF works. Define Py_NO_NAN in pyconfig.h if your platform + * doesn't support NaNs. + */ +#if !defined(Py_NAN) && !defined(Py_NO_NAN) +#if !defined(__INTEL_COMPILER) + #define Py_NAN (Py_HUGE_VAL * 0.) +#else /* __INTEL_COMPILER */ + #if defined(ICC_NAN_STRICT) + #pragma float_control(push) + #pragma float_control(precise, on) + #pragma float_control(except, on) + #if defined(_MSC_VER) + __declspec(noinline) + #else /* Linux */ + __attribute__((noinline)) + #endif /* _MSC_VER */ + static double __icc_nan() + { + return sqrt(-1.0); + } + #pragma float_control (pop) + #define Py_NAN __icc_nan() + #else /* ICC_NAN_RELAXED as default for Intel Compiler */ + static union { unsigned char buf[8]; double __icc_nan; } __nan_store = {0,0,0,0,0,0,0xf8,0x7f}; + #define Py_NAN (__nan_store.__icc_nan) + #endif /* ICC_NAN_STRICT */ +#endif /* __INTEL_COMPILER */ +#endif + +/* Py_OVERFLOWED(X) + * Return 1 iff a libm function overflowed. Set errno to 0 before calling + * a libm function, and invoke this macro after, passing the function + * result. + * Caution: + * This isn't reliable. C99 no longer requires libm to set errno under + * any exceptional condition, but does require +- HUGE_VAL return + * values on overflow. A 754 box *probably* maps HUGE_VAL to a + * double infinity, and we're cool if that's so, unless the input + * was an infinity and an infinity is the expected result. A C89 + * system sets errno to ERANGE, so we check for that too. We're + * out of luck if a C99 754 box doesn't map HUGE_VAL to +Inf, or + * if the returned result is a NaN, or if a C89 box returns HUGE_VAL + * in non-overflow cases. + * X is evaluated more than once. + * Some platforms have better way to spell this, so expect some #ifdef'ery. + * + * OpenBSD uses 'isinf()' because a compiler bug on that platform causes + * the longer macro version to be mis-compiled. This isn't optimal, and + * should be removed once a newer compiler is available on that platform. + * The system that had the failure was running OpenBSD 3.2 on Intel, with + * gcc 2.95.3. + * + * According to Tim's checkin, the FreeBSD systems use isinf() to work + * around a FPE bug on that platform. + */ +#if defined(__FreeBSD__) || defined(__OpenBSD__) +#define Py_OVERFLOWED(X) isinf(X) +#else +#define Py_OVERFLOWED(X) ((X) != 0.0 && (errno == ERANGE || \ + (X) == Py_HUGE_VAL || \ + (X) == -Py_HUGE_VAL)) +#endif + +#endif /* Py_PYMATH_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/pymem.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pymem.h new file mode 100644 index 0000000..2c239df --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pymem.h @@ -0,0 +1,122 @@ +/* The PyMem_ family: low-level memory allocation interfaces. + See objimpl.h for the PyObject_ memory family. +*/ + +#ifndef Py_PYMEM_H +#define Py_PYMEM_H + +#include "pyport.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* BEWARE: + + Each interface exports both functions and macros. Extension modules should + use the functions, to ensure binary compatibility across Python versions. + Because the Python implementation is free to change internal details, and + the macros may (or may not) expose details for speed, if you do use the + macros you must recompile your extensions with each Python release. + + Never mix calls to PyMem_ with calls to the platform malloc/realloc/ + calloc/free. For example, on Windows different DLLs may end up using + different heaps, and if you use PyMem_Malloc you'll get the memory from the + heap used by the Python DLL; it could be a disaster if you free()'ed that + directly in your own extension. Using PyMem_Free instead ensures Python + can return the memory to the proper heap. As another example, in + PYMALLOC_DEBUG mode, Python wraps all calls to all PyMem_ and PyObject_ + memory functions in special debugging wrappers that add additional + debugging info to dynamic memory blocks. The system routines have no idea + what to do with that stuff, and the Python wrappers have no idea what to do + with raw blocks obtained directly by the system routines then. + + The GIL must be held when using these APIs. +*/ + +/* + * Raw memory interface + * ==================== + */ + +/* Functions + + Functions supplying platform-independent semantics for malloc/realloc/ + free. These functions make sure that allocating 0 bytes returns a distinct + non-NULL pointer (whenever possible -- if we're flat out of memory, NULL + may be returned), even if the platform malloc and realloc don't. + Returned pointers must be checked for NULL explicitly. No action is + performed on failure (no exception is set, no warning is printed, etc). +*/ + +PyAPI_FUNC(void *) PyMem_Malloc(size_t); +PyAPI_FUNC(void *) PyMem_Realloc(void *, size_t); +PyAPI_FUNC(void) PyMem_Free(void *); + +/* Starting from Python 1.6, the wrappers Py_{Malloc,Realloc,Free} are + no longer supported. They used to call PyErr_NoMemory() on failure. */ + +/* Macros. */ +#ifdef PYMALLOC_DEBUG +/* Redirect all memory operations to Python's debugging allocator. */ +#define PyMem_MALLOC _PyMem_DebugMalloc +#define PyMem_REALLOC _PyMem_DebugRealloc +#define PyMem_FREE _PyMem_DebugFree + +#else /* ! PYMALLOC_DEBUG */ + +/* PyMem_MALLOC(0) means malloc(1). Some systems would return NULL + for malloc(0), which would be treated as an error. Some platforms + would return a pointer with no memory behind it, which would break + pymalloc. To solve these problems, allocate an extra byte. */ +/* Returns NULL to indicate error if a negative size or size larger than + Py_ssize_t can represent is supplied. Helps prevents security holes. */ +#define PyMem_MALLOC(n) ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \ + : malloc(((n) != 0) ? (n) : 1)) +#define PyMem_REALLOC(p, n) ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \ + : realloc((p), ((n) != 0) ? (n) : 1)) +#define PyMem_FREE free + +#endif /* PYMALLOC_DEBUG */ + +/* + * Type-oriented memory interface + * ============================== + * + * Allocate memory for n objects of the given type. Returns a new pointer + * or NULL if the request was too large or memory allocation failed. Use + * these macros rather than doing the multiplication yourself so that proper + * overflow checking is always done. + */ + +#define PyMem_New(type, n) \ + ( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ + ( (type *) PyMem_Malloc((n) * sizeof(type)) ) ) +#define PyMem_NEW(type, n) \ + ( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ + ( (type *) PyMem_MALLOC((n) * sizeof(type)) ) ) + +/* + * The value of (p) is always clobbered by this macro regardless of success. + * The caller MUST check if (p) is NULL afterwards and deal with the memory + * error if so. This means the original value of (p) MUST be saved for the + * caller's memory error handler to not lose track of it. + */ +#define PyMem_Resize(p, type, n) \ + ( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ + (type *) PyMem_Realloc((p), (n) * sizeof(type)) ) +#define PyMem_RESIZE(p, type, n) \ + ( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ + (type *) PyMem_REALLOC((p), (n) * sizeof(type)) ) + +/* PyMem{Del,DEL} are left over from ancient days, and shouldn't be used + * anymore. They're just confusing aliases for PyMem_{Free,FREE} now. + */ +#define PyMem_Del PyMem_Free +#define PyMem_DEL PyMem_FREE + +#ifdef __cplusplus +} +#endif + +#endif /* !Py_PYMEM_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/pyport.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pyport.h new file mode 100644 index 0000000..0c78a1e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pyport.h @@ -0,0 +1,950 @@ +#ifndef Py_PYPORT_H +#define Py_PYPORT_H + +#include "pyconfig.h" /* include for defines */ + +/* Some versions of HP-UX & Solaris need inttypes.h for int32_t, + INT32_MAX, etc. */ +#ifdef HAVE_INTTYPES_H +#include +#endif + +#ifdef HAVE_STDINT_H +#include +#endif + +/************************************************************************** +Symbols and macros to supply platform-independent interfaces to basic +C language & library operations whose spellings vary across platforms. + +Please try to make documentation here as clear as possible: by definition, +the stuff here is trying to illuminate C's darkest corners. + +Config #defines referenced here: + +SIGNED_RIGHT_SHIFT_ZERO_FILLS +Meaning: To be defined iff i>>j does not extend the sign bit when i is a + signed integral type and i < 0. +Used in: Py_ARITHMETIC_RIGHT_SHIFT + +Py_DEBUG +Meaning: Extra checks compiled in for debug mode. +Used in: Py_SAFE_DOWNCAST + +HAVE_UINTPTR_T +Meaning: The C9X type uintptr_t is supported by the compiler +Used in: Py_uintptr_t + +HAVE_LONG_LONG +Meaning: The compiler supports the C type "long long" +Used in: PY_LONG_LONG + +**************************************************************************/ + + +/* For backward compatibility only. Obsolete, do not use. */ +#ifdef HAVE_PROTOTYPES +#define Py_PROTO(x) x +#else +#define Py_PROTO(x) () +#endif +#ifndef Py_FPROTO +#define Py_FPROTO(x) Py_PROTO(x) +#endif + +/* typedefs for some C9X-defined synonyms for integral types. + * + * The names in Python are exactly the same as the C9X names, except with a + * Py_ prefix. Until C9X is universally implemented, this is the only way + * to ensure that Python gets reliable names that don't conflict with names + * in non-Python code that are playing their own tricks to define the C9X + * names. + * + * NOTE: don't go nuts here! Python has no use for *most* of the C9X + * integral synonyms. Only define the ones we actually need. + */ + +#ifdef HAVE_LONG_LONG +#ifndef PY_LONG_LONG +#define PY_LONG_LONG long long +#if defined(LLONG_MAX) +/* If LLONG_MAX is defined in limits.h, use that. */ +#define PY_LLONG_MIN LLONG_MIN +#define PY_LLONG_MAX LLONG_MAX +#define PY_ULLONG_MAX ULLONG_MAX +#elif defined(__LONG_LONG_MAX__) +/* Otherwise, if GCC has a builtin define, use that. */ +#define PY_LLONG_MAX __LONG_LONG_MAX__ +#define PY_LLONG_MIN (-PY_LLONG_MAX-1) +#define PY_ULLONG_MAX (__LONG_LONG_MAX__*2ULL + 1ULL) +#else +/* Otherwise, rely on two's complement. */ +#define PY_ULLONG_MAX (~0ULL) +#define PY_LLONG_MAX ((long long)(PY_ULLONG_MAX>>1)) +#define PY_LLONG_MIN (-PY_LLONG_MAX-1) +#endif /* LLONG_MAX */ +#endif +#endif /* HAVE_LONG_LONG */ + +/* a build with 30-bit digits for Python long integers needs an exact-width + * 32-bit unsigned integer type to store those digits. (We could just use + * type 'unsigned long', but that would be wasteful on a system where longs + * are 64-bits.) On Unix systems, the autoconf macro AC_TYPE_UINT32_T defines + * uint32_t to be such a type unless stdint.h or inttypes.h defines uint32_t. + * However, it doesn't set HAVE_UINT32_T, so we do that here. + */ +#ifdef uint32_t +#define HAVE_UINT32_T 1 +#endif + +#ifdef HAVE_UINT32_T +#ifndef PY_UINT32_T +#define PY_UINT32_T uint32_t +#endif +#endif + +/* Macros for a 64-bit unsigned integer type; used for type 'twodigits' in the + * long integer implementation, when 30-bit digits are enabled. + */ +#ifdef uint64_t +#define HAVE_UINT64_T 1 +#endif + +#ifdef HAVE_UINT64_T +#ifndef PY_UINT64_T +#define PY_UINT64_T uint64_t +#endif +#endif + +/* Signed variants of the above */ +#ifdef int32_t +#define HAVE_INT32_T 1 +#endif + +#ifdef HAVE_INT32_T +#ifndef PY_INT32_T +#define PY_INT32_T int32_t +#endif +#endif + +#ifdef int64_t +#define HAVE_INT64_T 1 +#endif + +#ifdef HAVE_INT64_T +#ifndef PY_INT64_T +#define PY_INT64_T int64_t +#endif +#endif + +/* If PYLONG_BITS_IN_DIGIT is not defined then we'll use 30-bit digits if all + the necessary integer types are available, and we're on a 64-bit platform + (as determined by SIZEOF_VOID_P); otherwise we use 15-bit digits. */ + +#ifndef PYLONG_BITS_IN_DIGIT +#if (defined HAVE_UINT64_T && defined HAVE_INT64_T && \ + defined HAVE_UINT32_T && defined HAVE_INT32_T && SIZEOF_VOID_P >= 8) +#define PYLONG_BITS_IN_DIGIT 30 +#else +#define PYLONG_BITS_IN_DIGIT 15 +#endif +#endif + +/* uintptr_t is the C9X name for an unsigned integral type such that a + * legitimate void* can be cast to uintptr_t and then back to void* again + * without loss of information. Similarly for intptr_t, wrt a signed + * integral type. + */ +#ifdef HAVE_UINTPTR_T +typedef uintptr_t Py_uintptr_t; +typedef intptr_t Py_intptr_t; + +#elif SIZEOF_VOID_P <= SIZEOF_INT +typedef unsigned int Py_uintptr_t; +typedef int Py_intptr_t; + +#elif SIZEOF_VOID_P <= SIZEOF_LONG +typedef unsigned long Py_uintptr_t; +typedef long Py_intptr_t; + +#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG) +typedef unsigned PY_LONG_LONG Py_uintptr_t; +typedef PY_LONG_LONG Py_intptr_t; + +#else +# error "Python needs a typedef for Py_uintptr_t in pyport.h." +#endif /* HAVE_UINTPTR_T */ + +/* Py_ssize_t is a signed integral type such that sizeof(Py_ssize_t) == + * sizeof(size_t). C99 doesn't define such a thing directly (size_t is an + * unsigned integral type). See PEP 353 for details. + */ +#ifdef HAVE_SSIZE_T +typedef ssize_t Py_ssize_t; +#elif SIZEOF_VOID_P == SIZEOF_SIZE_T +typedef Py_intptr_t Py_ssize_t; +#else +# error "Python needs a typedef for Py_ssize_t in pyport.h." +#endif + +/* Largest possible value of size_t. + SIZE_MAX is part of C99, so it might be defined on some + platforms. If it is not defined, (size_t)-1 is a portable + definition for C89, due to the way signed->unsigned + conversion is defined. */ +#ifdef SIZE_MAX +#define PY_SIZE_MAX SIZE_MAX +#else +#define PY_SIZE_MAX ((size_t)-1) +#endif + +/* Largest positive value of type Py_ssize_t. */ +#define PY_SSIZE_T_MAX ((Py_ssize_t)(((size_t)-1)>>1)) +/* Smallest negative value of type Py_ssize_t. */ +#define PY_SSIZE_T_MIN (-PY_SSIZE_T_MAX-1) + +#if SIZEOF_PID_T > SIZEOF_LONG +# error "Python doesn't support sizeof(pid_t) > sizeof(long)" +#endif + +/* PY_FORMAT_SIZE_T is a platform-specific modifier for use in a printf + * format to convert an argument with the width of a size_t or Py_ssize_t. + * C99 introduced "z" for this purpose, but not all platforms support that; + * e.g., MS compilers use "I" instead. + * + * These "high level" Python format functions interpret "z" correctly on + * all platforms (Python interprets the format string itself, and does whatever + * the platform C requires to convert a size_t/Py_ssize_t argument): + * + * PyString_FromFormat + * PyErr_Format + * PyString_FromFormatV + * + * Lower-level uses require that you interpolate the correct format modifier + * yourself (e.g., calling printf, fprintf, sprintf, PyOS_snprintf); for + * example, + * + * Py_ssize_t index; + * fprintf(stderr, "index %" PY_FORMAT_SIZE_T "d sucks\n", index); + * + * That will expand to %ld, or %Id, or to something else correct for a + * Py_ssize_t on the platform. + */ +#ifndef PY_FORMAT_SIZE_T +# if SIZEOF_SIZE_T == SIZEOF_INT && !defined(__APPLE__) +# define PY_FORMAT_SIZE_T "" +# elif SIZEOF_SIZE_T == SIZEOF_LONG +# define PY_FORMAT_SIZE_T "l" +# elif defined(MS_WINDOWS) +# define PY_FORMAT_SIZE_T "I" +# else +# error "This platform's pyconfig.h needs to define PY_FORMAT_SIZE_T" +# endif +#endif + +/* PY_FORMAT_LONG_LONG is analogous to PY_FORMAT_SIZE_T above, but for + * the long long type instead of the size_t type. It's only available + * when HAVE_LONG_LONG is defined. The "high level" Python format + * functions listed above will interpret "lld" or "llu" correctly on + * all platforms. + */ +#ifdef HAVE_LONG_LONG +# ifndef PY_FORMAT_LONG_LONG +# if defined(MS_WIN64) || defined(MS_WINDOWS) +# define PY_FORMAT_LONG_LONG "I64" +# else +# error "This platform's pyconfig.h needs to define PY_FORMAT_LONG_LONG" +# endif +# endif +#endif + +/* Py_LOCAL can be used instead of static to get the fastest possible calling + * convention for functions that are local to a given module. + * + * Py_LOCAL_INLINE does the same thing, and also explicitly requests inlining, + * for platforms that support that. + * + * If PY_LOCAL_AGGRESSIVE is defined before python.h is included, more + * "aggressive" inlining/optimization is enabled for the entire module. This + * may lead to code bloat, and may slow things down for those reasons. It may + * also lead to errors, if the code relies on pointer aliasing. Use with + * care. + * + * NOTE: You can only use this for functions that are entirely local to a + * module; functions that are exported via method tables, callbacks, etc, + * should keep using static. + */ + +#undef USE_INLINE /* XXX - set via configure? */ + +#if defined(_MSC_VER) +#if defined(PY_LOCAL_AGGRESSIVE) +/* enable more aggressive optimization for visual studio */ +#pragma optimize("agtw", on) +#endif +/* ignore warnings if the compiler decides not to inline a function */ +#pragma warning(disable: 4710) +/* fastest possible local call under MSVC */ +#define Py_LOCAL(type) static type __fastcall +#define Py_LOCAL_INLINE(type) static __inline type __fastcall +#elif defined(USE_INLINE) +#define Py_LOCAL(type) static type +#define Py_LOCAL_INLINE(type) static inline type +#else +#define Py_LOCAL(type) static type +#define Py_LOCAL_INLINE(type) static type +#endif + +/* Py_MEMCPY can be used instead of memcpy in cases where the copied blocks + * are often very short. While most platforms have highly optimized code for + * large transfers, the setup costs for memcpy are often quite high. MEMCPY + * solves this by doing short copies "in line". + */ + +#if defined(_MSC_VER) +#define Py_MEMCPY(target, source, length) do { \ + size_t i_, n_ = (length); \ + char *t_ = (void*) (target); \ + const char *s_ = (void*) (source); \ + if (n_ >= 16) \ + memcpy(t_, s_, n_); \ + else \ + for (i_ = 0; i_ < n_; i_++) \ + t_[i_] = s_[i_]; \ + } while (0) +#else +#define Py_MEMCPY memcpy +#endif + +#include + +#ifdef HAVE_IEEEFP_H +#include /* needed for 'finite' declaration on some platforms */ +#endif + +#include /* Moved here from the math section, before extern "C" */ + +/******************************************** + * WRAPPER FOR and/or * + ********************************************/ + +#ifdef TIME_WITH_SYS_TIME +#include +#include +#else /* !TIME_WITH_SYS_TIME */ +#ifdef HAVE_SYS_TIME_H +#include +#else /* !HAVE_SYS_TIME_H */ +#include +#endif /* !HAVE_SYS_TIME_H */ +#endif /* !TIME_WITH_SYS_TIME */ + + +/****************************** + * WRAPPER FOR * + ******************************/ + +/* NB caller must include */ + +#ifdef HAVE_SYS_SELECT_H + +#include + +#endif /* !HAVE_SYS_SELECT_H */ + +/******************************* + * stat() and fstat() fiddling * + *******************************/ + +/* We expect that stat and fstat exist on most systems. + * It's confirmed on Unix, Mac and Windows. + * If you don't have them, add + * #define DONT_HAVE_STAT + * and/or + * #define DONT_HAVE_FSTAT + * to your pyconfig.h. Python code beyond this should check HAVE_STAT and + * HAVE_FSTAT instead. + * Also + * #define HAVE_SYS_STAT_H + * if exists on your platform, and + * #define HAVE_STAT_H + * if does. + */ +#ifndef DONT_HAVE_STAT +#define HAVE_STAT +#endif + +#ifndef DONT_HAVE_FSTAT +#define HAVE_FSTAT +#endif + +#ifdef RISCOS +#include +#include "unixstuff.h" +#endif + +#ifdef HAVE_SYS_STAT_H +#if defined(PYOS_OS2) && defined(PYCC_GCC) +#include +#endif +#include +#elif defined(HAVE_STAT_H) +#include +#endif + +#if defined(PYCC_VACPP) +/* VisualAge C/C++ Failed to Define MountType Field in sys/stat.h */ +#define S_IFMT (S_IFDIR|S_IFCHR|S_IFREG) +#endif + +#ifndef S_ISREG +#define S_ISREG(x) (((x) & S_IFMT) == S_IFREG) +#endif + +#ifndef S_ISDIR +#define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR) +#endif + + +#ifdef __cplusplus +/* Move this down here since some C++ #include's don't like to be included + inside an extern "C" */ +extern "C" { +#endif + + +/* Py_ARITHMETIC_RIGHT_SHIFT + * C doesn't define whether a right-shift of a signed integer sign-extends + * or zero-fills. Here a macro to force sign extension: + * Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) + * Return I >> J, forcing sign extension. Arithmetically, return the + * floor of I/2**J. + * Requirements: + * I should have signed integer type. In the terminology of C99, this can + * be either one of the five standard signed integer types (signed char, + * short, int, long, long long) or an extended signed integer type. + * J is an integer >= 0 and strictly less than the number of bits in the + * type of I (because C doesn't define what happens for J outside that + * range either). + * TYPE used to specify the type of I, but is now ignored. It's been left + * in for backwards compatibility with versions <= 2.6 or 3.0. + * Caution: + * I may be evaluated more than once. + */ +#ifdef SIGNED_RIGHT_SHIFT_ZERO_FILLS +#define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) \ + ((I) < 0 ? -1-((-1-(I)) >> (J)) : (I) >> (J)) +#else +#define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) ((I) >> (J)) +#endif + +/* Py_FORCE_EXPANSION(X) + * "Simply" returns its argument. However, macro expansions within the + * argument are evaluated. This unfortunate trickery is needed to get + * token-pasting to work as desired in some cases. + */ +#define Py_FORCE_EXPANSION(X) X + +/* Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) + * Cast VALUE to type NARROW from type WIDE. In Py_DEBUG mode, this + * assert-fails if any information is lost. + * Caution: + * VALUE may be evaluated more than once. + */ +#ifdef Py_DEBUG +#define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) \ + (assert((WIDE)(NARROW)(VALUE) == (VALUE)), (NARROW)(VALUE)) +#else +#define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) (NARROW)(VALUE) +#endif + +/* Py_SET_ERRNO_ON_MATH_ERROR(x) + * If a libm function did not set errno, but it looks like the result + * overflowed or not-a-number, set errno to ERANGE or EDOM. Set errno + * to 0 before calling a libm function, and invoke this macro after, + * passing the function result. + * Caution: + * This isn't reliable. See Py_OVERFLOWED comments. + * X is evaluated more than once. + */ +#if defined(__FreeBSD__) || defined(__OpenBSD__) || (defined(__hpux) && defined(__ia64)) +#define _Py_SET_EDOM_FOR_NAN(X) if (isnan(X)) errno = EDOM; +#else +#define _Py_SET_EDOM_FOR_NAN(X) ; +#endif +#define Py_SET_ERRNO_ON_MATH_ERROR(X) \ + do { \ + if (errno == 0) { \ + if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \ + errno = ERANGE; \ + else _Py_SET_EDOM_FOR_NAN(X) \ + } \ + } while(0) + +/* Py_SET_ERANGE_ON_OVERFLOW(x) + * An alias of Py_SET_ERRNO_ON_MATH_ERROR for backward-compatibility. + */ +#define Py_SET_ERANGE_IF_OVERFLOW(X) Py_SET_ERRNO_ON_MATH_ERROR(X) + +/* Py_ADJUST_ERANGE1(x) + * Py_ADJUST_ERANGE2(x, y) + * Set errno to 0 before calling a libm function, and invoke one of these + * macros after, passing the function result(s) (Py_ADJUST_ERANGE2 is useful + * for functions returning complex results). This makes two kinds of + * adjustments to errno: (A) If it looks like the platform libm set + * errno=ERANGE due to underflow, clear errno. (B) If it looks like the + * platform libm overflowed but didn't set errno, force errno to ERANGE. In + * effect, we're trying to force a useful implementation of C89 errno + * behavior. + * Caution: + * This isn't reliable. See Py_OVERFLOWED comments. + * X and Y may be evaluated more than once. + */ +#define Py_ADJUST_ERANGE1(X) \ + do { \ + if (errno == 0) { \ + if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \ + errno = ERANGE; \ + } \ + else if (errno == ERANGE && (X) == 0.0) \ + errno = 0; \ + } while(0) + +#define Py_ADJUST_ERANGE2(X, Y) \ + do { \ + if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL || \ + (Y) == Py_HUGE_VAL || (Y) == -Py_HUGE_VAL) { \ + if (errno == 0) \ + errno = ERANGE; \ + } \ + else if (errno == ERANGE) \ + errno = 0; \ + } while(0) + +/* The functions _Py_dg_strtod and _Py_dg_dtoa in Python/dtoa.c (which are + * required to support the short float repr introduced in Python 3.1) require + * that the floating-point unit that's being used for arithmetic operations + * on C doubles is set to use 53-bit precision. It also requires that the + * FPU rounding mode is round-half-to-even, but that's less often an issue. + * + * If your FPU isn't already set to 53-bit precision/round-half-to-even, and + * you want to make use of _Py_dg_strtod and _Py_dg_dtoa, then you should + * + * #define HAVE_PY_SET_53BIT_PRECISION 1 + * + * and also give appropriate definitions for the following three macros: + * + * _PY_SET_53BIT_PRECISION_START : store original FPU settings, and + * set FPU to 53-bit precision/round-half-to-even + * _PY_SET_53BIT_PRECISION_END : restore original FPU settings + * _PY_SET_53BIT_PRECISION_HEADER : any variable declarations needed to + * use the two macros above. + * + * The macros are designed to be used within a single C function: see + * Python/pystrtod.c for an example of their use. + */ + +/* get and set x87 control word for gcc/x86 */ +#ifdef HAVE_GCC_ASM_FOR_X87 +#define HAVE_PY_SET_53BIT_PRECISION 1 +/* _Py_get/set_387controlword functions are defined in Python/pymath.c */ +#define _Py_SET_53BIT_PRECISION_HEADER \ + unsigned short old_387controlword, new_387controlword +#define _Py_SET_53BIT_PRECISION_START \ + do { \ + old_387controlword = _Py_get_387controlword(); \ + new_387controlword = (old_387controlword & ~0x0f00) | 0x0200; \ + if (new_387controlword != old_387controlword) \ + _Py_set_387controlword(new_387controlword); \ + } while (0) +#define _Py_SET_53BIT_PRECISION_END \ + if (new_387controlword != old_387controlword) \ + _Py_set_387controlword(old_387controlword) +#endif + +/* get and set x87 control word for VisualStudio/x86 */ +#if defined(_MSC_VER) && !defined(_WIN64) /* x87 not supported in 64-bit */ +#define HAVE_PY_SET_53BIT_PRECISION 1 +#define _Py_SET_53BIT_PRECISION_HEADER \ + unsigned int old_387controlword, new_387controlword, out_387controlword +/* We use the __control87_2 function to set only the x87 control word. + The SSE control word is unaffected. */ +#define _Py_SET_53BIT_PRECISION_START \ + do { \ + __control87_2(0, 0, &old_387controlword, NULL); \ + new_387controlword = \ + (old_387controlword & ~(_MCW_PC | _MCW_RC)) | (_PC_53 | _RC_NEAR); \ + if (new_387controlword != old_387controlword) \ + __control87_2(new_387controlword, _MCW_PC | _MCW_RC, \ + &out_387controlword, NULL); \ + } while (0) +#define _Py_SET_53BIT_PRECISION_END \ + do { \ + if (new_387controlword != old_387controlword) \ + __control87_2(old_387controlword, _MCW_PC | _MCW_RC, \ + &out_387controlword, NULL); \ + } while (0) +#endif + +/* default definitions are empty */ +#ifndef HAVE_PY_SET_53BIT_PRECISION +#define _Py_SET_53BIT_PRECISION_HEADER +#define _Py_SET_53BIT_PRECISION_START +#define _Py_SET_53BIT_PRECISION_END +#endif + +/* If we can't guarantee 53-bit precision, don't use the code + in Python/dtoa.c, but fall back to standard code. This + means that repr of a float will be long (17 sig digits). + + Realistically, there are two things that could go wrong: + + (1) doubles aren't IEEE 754 doubles, or + (2) we're on x86 with the rounding precision set to 64-bits + (extended precision), and we don't know how to change + the rounding precision. + */ + +#if !defined(DOUBLE_IS_LITTLE_ENDIAN_IEEE754) && \ + !defined(DOUBLE_IS_BIG_ENDIAN_IEEE754) && \ + !defined(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754) +#define PY_NO_SHORT_FLOAT_REPR +#endif + +/* double rounding is symptomatic of use of extended precision on x86. If + we're seeing double rounding, and we don't have any mechanism available for + changing the FPU rounding precision, then don't use Python/dtoa.c. */ +#if defined(X87_DOUBLE_ROUNDING) && !defined(HAVE_PY_SET_53BIT_PRECISION) +#define PY_NO_SHORT_FLOAT_REPR +#endif + +/* Py_DEPRECATED(version) + * Declare a variable, type, or function deprecated. + * Usage: + * extern int old_var Py_DEPRECATED(2.3); + * typedef int T1 Py_DEPRECATED(2.4); + * extern int x() Py_DEPRECATED(2.5); + */ +#if defined(__GNUC__) && ((__GNUC__ >= 4) || \ + (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)) +#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__)) +#else +#define Py_DEPRECATED(VERSION_UNUSED) +#endif + +/************************************************************************** +Prototypes that are missing from the standard include files on some systems +(and possibly only some versions of such systems.) + +Please be conservative with adding new ones, document them and enclose them +in platform-specific #ifdefs. +**************************************************************************/ + +#ifdef SOLARIS +/* Unchecked */ +extern int gethostname(char *, int); +#endif + +#ifdef __BEOS__ +/* Unchecked */ +/* It's in the libs, but not the headers... - [cjh] */ +int shutdown( int, int ); +#endif + +#ifdef HAVE__GETPTY +#include /* we need to import mode_t */ +extern char * _getpty(int *, int, mode_t, int); +#endif + +/* On QNX 6, struct termio must be declared by including sys/termio.h + if TCGETA, TCSETA, TCSETAW, or TCSETAF are used. sys/termio.h must + be included before termios.h or it will generate an error. */ +#if defined(HAVE_SYS_TERMIO_H) && !defined(__hpux) +#include +#endif + +#if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) +#if !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) && !defined(HAVE_UTIL_H) +/* BSDI does not supply a prototype for the 'openpty' and 'forkpty' + functions, even though they are included in libutil. */ +#include +extern int openpty(int *, int *, char *, struct termios *, struct winsize *); +extern pid_t forkpty(int *, char *, struct termios *, struct winsize *); +#endif /* !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) */ +#endif /* defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) */ + + +/* These are pulled from various places. It isn't obvious on what platforms + they are necessary, nor what the exact prototype should look like (which + is likely to vary between platforms!) If you find you need one of these + declarations, please move them to a platform-specific block and include + proper prototypes. */ +#if 0 + +/* From Modules/resource.c */ +extern int getrusage(); +extern int getpagesize(); + +/* From Python/sysmodule.c and Modules/posixmodule.c */ +extern int fclose(FILE *); + +/* From Modules/posixmodule.c */ +extern int fdatasync(int); +#endif /* 0 */ + + +/* On 4.4BSD-descendants, ctype functions serves the whole range of + * wchar_t character set rather than single byte code points only. + * This characteristic can break some operations of string object + * including str.upper() and str.split() on UTF-8 locales. This + * workaround was provided by Tim Robbins of FreeBSD project. + */ + +#ifdef __FreeBSD__ +#include +#if (__FreeBSD_version >= 500040 && __FreeBSD_version < 602113) || \ + (__FreeBSD_version >= 700000 && __FreeBSD_version < 700054) || \ + (__FreeBSD_version >= 800000 && __FreeBSD_version < 800001) +# define _PY_PORT_CTYPE_UTF8_ISSUE +#endif +#endif + + +#if defined(__APPLE__) +# define _PY_PORT_CTYPE_UTF8_ISSUE +#endif + +#ifdef _PY_PORT_CTYPE_UTF8_ISSUE +#ifndef __cplusplus + /* The workaround below is unsafe in C++ because + * the defines these symbols as real functions, + * with a slightly different signature. + * See issue #10910 + */ +#include +#include +#undef isalnum +#define isalnum(c) iswalnum(btowc(c)) +#undef isalpha +#define isalpha(c) iswalpha(btowc(c)) +#undef islower +#define islower(c) iswlower(btowc(c)) +#undef isspace +#define isspace(c) iswspace(btowc(c)) +#undef isupper +#define isupper(c) iswupper(btowc(c)) +#undef tolower +#define tolower(c) towlower(btowc(c)) +#undef toupper +#define toupper(c) towupper(btowc(c)) +#endif +#endif + + +/* Declarations for symbol visibility. + + PyAPI_FUNC(type): Declares a public Python API function and return type + PyAPI_DATA(type): Declares public Python data and its type + PyMODINIT_FUNC: A Python module init function. If these functions are + inside the Python core, they are private to the core. + If in an extension module, it may be declared with + external linkage depending on the platform. + + As a number of platforms support/require "__declspec(dllimport/dllexport)", + we support a HAVE_DECLSPEC_DLL macro to save duplication. +*/ + +/* + All windows ports, except cygwin, are handled in PC/pyconfig.h. + + BeOS and cygwin are the only other autoconf platform requiring special + linkage handling and both of these use __declspec(). +*/ +#if defined(__CYGWIN__) || defined(__BEOS__) +# define HAVE_DECLSPEC_DLL +#endif + +/* only get special linkage if built as shared or platform is Cygwin */ +#if defined(Py_ENABLE_SHARED) || defined(__CYGWIN__) +# if defined(HAVE_DECLSPEC_DLL) +# ifdef Py_BUILD_CORE +# define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE +# define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE + /* module init functions inside the core need no external linkage */ + /* except for Cygwin to handle embedding (FIXME: BeOS too?) */ +# if defined(__CYGWIN__) +# define PyMODINIT_FUNC __declspec(dllexport) void +# else /* __CYGWIN__ */ +# define PyMODINIT_FUNC void +# endif /* __CYGWIN__ */ +# else /* Py_BUILD_CORE */ + /* Building an extension module, or an embedded situation */ + /* public Python functions and data are imported */ + /* Under Cygwin, auto-import functions to prevent compilation */ + /* failures similar to those described at the bottom of 4.1: */ + /* http://docs.python.org/extending/windows.html#a-cookbook-approach */ +# if !defined(__CYGWIN__) +# define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE +# endif /* !__CYGWIN__ */ +# define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE + /* module init functions outside the core must be exported */ +# if defined(__cplusplus) +# define PyMODINIT_FUNC extern "C" __declspec(dllexport) void +# else /* __cplusplus */ +# define PyMODINIT_FUNC __declspec(dllexport) void +# endif /* __cplusplus */ +# endif /* Py_BUILD_CORE */ +# endif /* HAVE_DECLSPEC */ +#endif /* Py_ENABLE_SHARED */ + +/* If no external linkage macros defined by now, create defaults */ +#ifndef PyAPI_FUNC +# define PyAPI_FUNC(RTYPE) RTYPE +#endif +#ifndef PyAPI_DATA +# define PyAPI_DATA(RTYPE) extern RTYPE +#endif +#ifndef PyMODINIT_FUNC +# if defined(__cplusplus) +# define PyMODINIT_FUNC extern "C" void +# else /* __cplusplus */ +# define PyMODINIT_FUNC void +# endif /* __cplusplus */ +#endif + +/* Deprecated DL_IMPORT and DL_EXPORT macros */ +#if defined(Py_ENABLE_SHARED) && defined (HAVE_DECLSPEC_DLL) +# if defined(Py_BUILD_CORE) +# define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE +# define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE +# else +# define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE +# define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE +# endif +#endif +#ifndef DL_EXPORT +# define DL_EXPORT(RTYPE) RTYPE +#endif +#ifndef DL_IMPORT +# define DL_IMPORT(RTYPE) RTYPE +#endif +/* End of deprecated DL_* macros */ + +/* If the fd manipulation macros aren't defined, + here is a set that should do the job */ + +#if 0 /* disabled and probably obsolete */ + +#ifndef FD_SETSIZE +#define FD_SETSIZE 256 +#endif + +#ifndef FD_SET + +typedef long fd_mask; + +#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ +#ifndef howmany +#define howmany(x, y) (((x)+((y)-1))/(y)) +#endif /* howmany */ + +typedef struct fd_set { + fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; +} fd_set; + +#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) +#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) +#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) +#define FD_ZERO(p) memset((char *)(p), '\0', sizeof(*(p))) + +#endif /* FD_SET */ + +#endif /* fd manipulation macros */ + + +/* limits.h constants that may be missing */ + +#ifndef INT_MAX +#define INT_MAX 2147483647 +#endif + +#ifndef LONG_MAX +#if SIZEOF_LONG == 4 +#define LONG_MAX 0X7FFFFFFFL +#elif SIZEOF_LONG == 8 +#define LONG_MAX 0X7FFFFFFFFFFFFFFFL +#else +#error "could not set LONG_MAX in pyport.h" +#endif +#endif + +#ifndef LONG_MIN +#define LONG_MIN (-LONG_MAX-1) +#endif + +#ifndef LONG_BIT +#define LONG_BIT (8 * SIZEOF_LONG) +#endif + +#if LONG_BIT != 8 * SIZEOF_LONG +/* 04-Oct-2000 LONG_BIT is apparently (mis)defined as 64 on some recent + * 32-bit platforms using gcc. We try to catch that here at compile-time + * rather than waiting for integer multiplication to trigger bogus + * overflows. + */ +#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)." +#endif + +#ifdef __cplusplus +} +#endif + +/* + * Hide GCC attributes from compilers that don't support them. + */ +#if (!defined(__GNUC__) || __GNUC__ < 2 || \ + (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ) && \ + !defined(RISCOS) +#define Py_GCC_ATTRIBUTE(x) +#else +#define Py_GCC_ATTRIBUTE(x) __attribute__(x) +#endif + +/* + * Add PyArg_ParseTuple format where available. + */ +#ifdef HAVE_ATTRIBUTE_FORMAT_PARSETUPLE +#define Py_FORMAT_PARSETUPLE(func,p1,p2) __attribute__((format(func,p1,p2))) +#else +#define Py_FORMAT_PARSETUPLE(func,p1,p2) +#endif + +/* + * Specify alignment on compilers that support it. + */ +#if defined(__GNUC__) && __GNUC__ >= 3 +#define Py_ALIGNED(x) __attribute__((aligned(x))) +#else +#define Py_ALIGNED(x) +#endif + +/* Eliminate end-of-loop code not reached warnings from SunPro C + * when using do{...}while(0) macros + */ +#ifdef __SUNPRO_C +#pragma error_messages (off,E_END_OF_LOOP_CODE_NOT_REACHED) +#endif + +/* + * Older Microsoft compilers don't support the C99 long long literal suffixes, + * so these will be defined in PC/pyconfig.h for those compilers. + */ +#ifndef Py_LL +#define Py_LL(x) x##LL +#endif + +#ifndef Py_ULL +#define Py_ULL(x) Py_LL(x##U) +#endif + +#endif /* Py_PYPORT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/pystate.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pystate.h new file mode 100644 index 0000000..f2cfc30 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pystate.h @@ -0,0 +1,200 @@ + +/* Thread and interpreter state structures and their interfaces */ + + +#ifndef Py_PYSTATE_H +#define Py_PYSTATE_H +#ifdef __cplusplus +extern "C" { +#endif + +/* State shared between threads */ + +struct _ts; /* Forward */ +struct _is; /* Forward */ + +typedef struct _is { + + struct _is *next; + struct _ts *tstate_head; + + PyObject *modules; + PyObject *sysdict; + PyObject *builtins; + PyObject *modules_reloading; + + PyObject *codec_search_path; + PyObject *codec_search_cache; + PyObject *codec_error_registry; + +#ifdef HAVE_DLOPEN + int dlopenflags; +#endif +#ifdef WITH_TSC + int tscdump; +#endif + +} PyInterpreterState; + + +/* State unique per thread */ + +struct _frame; /* Avoid including frameobject.h */ + +/* Py_tracefunc return -1 when raising an exception, or 0 for success. */ +typedef int (*Py_tracefunc)(PyObject *, struct _frame *, int, PyObject *); + +/* The following values are used for 'what' for tracefunc functions: */ +#define PyTrace_CALL 0 +#define PyTrace_EXCEPTION 1 +#define PyTrace_LINE 2 +#define PyTrace_RETURN 3 +#define PyTrace_C_CALL 4 +#define PyTrace_C_EXCEPTION 5 +#define PyTrace_C_RETURN 6 + +typedef struct _ts { + /* See Python/ceval.c for comments explaining most fields */ + + struct _ts *next; + PyInterpreterState *interp; + + struct _frame *frame; + int recursion_depth; + /* 'tracing' keeps track of the execution depth when tracing/profiling. + This is to prevent the actual trace/profile code from being recorded in + the trace/profile. */ + int tracing; + int use_tracing; + + Py_tracefunc c_profilefunc; + Py_tracefunc c_tracefunc; + PyObject *c_profileobj; + PyObject *c_traceobj; + + PyObject *curexc_type; + PyObject *curexc_value; + PyObject *curexc_traceback; + + PyObject *exc_type; + PyObject *exc_value; + PyObject *exc_traceback; + + PyObject *dict; /* Stores per-thread state */ + + /* tick_counter is incremented whenever the check_interval ticker + * reaches zero. The purpose is to give a useful measure of the number + * of interpreted bytecode instructions in a given thread. This + * extremely lightweight statistic collector may be of interest to + * profilers (like psyco.jit()), although nothing in the core uses it. + */ + int tick_counter; + + int gilstate_counter; + + PyObject *async_exc; /* Asynchronous exception to raise */ + long thread_id; /* Thread id where this tstate was created */ + + int trash_delete_nesting; + PyObject *trash_delete_later; + + /* XXX signal handlers should also be here */ + +} PyThreadState; + + +PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void); +PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState *); +PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState *); + +PyAPI_FUNC(PyThreadState *) PyThreadState_New(PyInterpreterState *); +PyAPI_FUNC(PyThreadState *) _PyThreadState_Prealloc(PyInterpreterState *); +PyAPI_FUNC(void) _PyThreadState_Init(PyThreadState *); +PyAPI_FUNC(void) PyThreadState_Clear(PyThreadState *); +PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState *); +#ifdef WITH_THREAD +PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void); +#endif + +PyAPI_FUNC(PyThreadState *) PyThreadState_Get(void); +PyAPI_FUNC(PyThreadState *) PyThreadState_Swap(PyThreadState *); +PyAPI_FUNC(PyObject *) PyThreadState_GetDict(void); +PyAPI_FUNC(int) PyThreadState_SetAsyncExc(long, PyObject *); + + +/* Variable and macro for in-line access to current thread state */ + +PyAPI_DATA(PyThreadState *) _PyThreadState_Current; + +#ifdef Py_DEBUG +#define PyThreadState_GET() PyThreadState_Get() +#else +#define PyThreadState_GET() (_PyThreadState_Current) +#endif + +typedef + enum {PyGILState_LOCKED, PyGILState_UNLOCKED} + PyGILState_STATE; + +/* Ensure that the current thread is ready to call the Python + C API, regardless of the current state of Python, or of its + thread lock. This may be called as many times as desired + by a thread so long as each call is matched with a call to + PyGILState_Release(). In general, other thread-state APIs may + be used between _Ensure() and _Release() calls, so long as the + thread-state is restored to its previous state before the Release(). + For example, normal use of the Py_BEGIN_ALLOW_THREADS/ + Py_END_ALLOW_THREADS macros are acceptable. + + The return value is an opaque "handle" to the thread state when + PyGILState_Ensure() was called, and must be passed to + PyGILState_Release() to ensure Python is left in the same state. Even + though recursive calls are allowed, these handles can *not* be shared - + each unique call to PyGILState_Ensure must save the handle for its + call to PyGILState_Release. + + When the function returns, the current thread will hold the GIL. + + Failure is a fatal error. +*/ +PyAPI_FUNC(PyGILState_STATE) PyGILState_Ensure(void); + +/* Release any resources previously acquired. After this call, Python's + state will be the same as it was prior to the corresponding + PyGILState_Ensure() call (but generally this state will be unknown to + the caller, hence the use of the GILState API.) + + Every call to PyGILState_Ensure must be matched by a call to + PyGILState_Release on the same thread. +*/ +PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE); + +/* Helper/diagnostic function - get the current thread state for + this thread. May return NULL if no GILState API has been used + on the current thread. Note that the main thread always has such a + thread-state, even if no auto-thread-state call has been made + on the main thread. +*/ +PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void); + +/* The implementation of sys._current_frames() Returns a dict mapping + thread id to that thread's current frame. +*/ +PyAPI_FUNC(PyObject *) _PyThread_CurrentFrames(void); + +/* Routines for advanced debuggers, requested by David Beazley. + Don't use unless you know what you are doing! */ +PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Head(void); +PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *); +PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *); +PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *); + +typedef struct _frame *(*PyThreadFrameGetter)(PyThreadState *self_); + +/* hook for PyEval_GetFrame(), requested for Psyco */ +PyAPI_DATA(PyThreadFrameGetter) _PyThreadState_GetFrame; + +#ifdef __cplusplus +} +#endif +#endif /* !Py_PYSTATE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/pystrcmp.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pystrcmp.h new file mode 100644 index 0000000..369c7e7 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pystrcmp.h @@ -0,0 +1,23 @@ +#ifndef Py_STRCMP_H +#define Py_STRCMP_H + +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_FUNC(int) PyOS_mystrnicmp(const char *, const char *, Py_ssize_t); +PyAPI_FUNC(int) PyOS_mystricmp(const char *, const char *); + +#if defined(MS_WINDOWS) || defined(PYOS_OS2) +#define PyOS_strnicmp strnicmp +#define PyOS_stricmp stricmp +#else +#define PyOS_strnicmp PyOS_mystrnicmp +#define PyOS_stricmp PyOS_mystricmp +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* !Py_STRCMP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/pystrtod.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pystrtod.h new file mode 100644 index 0000000..eec434f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pystrtod.h @@ -0,0 +1,45 @@ +#ifndef Py_STRTOD_H +#define Py_STRTOD_H + +#ifdef __cplusplus +extern "C" { +#endif + + +PyAPI_FUNC(double) PyOS_ascii_strtod(const char *str, char **ptr); +PyAPI_FUNC(double) PyOS_ascii_atof(const char *str); + +/* Deprecated in 2.7 and 3.1. Will disappear in 2.8 (if it exists) and 3.2 */ +PyAPI_FUNC(char *) PyOS_ascii_formatd(char *buffer, size_t buf_len, + const char *format, double d); +PyAPI_FUNC(double) PyOS_string_to_double(const char *str, + char **endptr, + PyObject *overflow_exception); + +/* The caller is responsible for calling PyMem_Free to free the buffer + that's is returned. */ +PyAPI_FUNC(char *) PyOS_double_to_string(double val, + char format_code, + int precision, + int flags, + int *type); + +PyAPI_FUNC(double) _Py_parse_inf_or_nan(const char *p, char **endptr); + + +/* PyOS_double_to_string's "flags" parameter can be set to 0 or more of: */ +#define Py_DTSF_SIGN 0x01 /* always add the sign */ +#define Py_DTSF_ADD_DOT_0 0x02 /* if the result is an integer add ".0" */ +#define Py_DTSF_ALT 0x04 /* "alternate" formatting. it's format_code + specific */ + +/* PyOS_double_to_string's "type", if non-NULL, will be set to one of: */ +#define Py_DTST_FINITE 0 +#define Py_DTST_INFINITE 1 +#define Py_DTST_NAN 2 + +#ifdef __cplusplus +} +#endif + +#endif /* !Py_STRTOD_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/pythonrun.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pythonrun.h new file mode 100644 index 0000000..f0f4e38 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pythonrun.h @@ -0,0 +1,181 @@ + +/* Interfaces to parse and execute pieces of python code */ + +#ifndef Py_PYTHONRUN_H +#define Py_PYTHONRUN_H +#ifdef __cplusplus +extern "C" { +#endif + +#define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \ + CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \ + CO_FUTURE_UNICODE_LITERALS) +#define PyCF_MASK_OBSOLETE (CO_NESTED) +#define PyCF_SOURCE_IS_UTF8 0x0100 +#define PyCF_DONT_IMPLY_DEDENT 0x0200 +#define PyCF_ONLY_AST 0x0400 + +typedef struct { + int cf_flags; /* bitmask of CO_xxx flags relevant to future */ +} PyCompilerFlags; + +PyAPI_FUNC(void) Py_SetProgramName(char *); +PyAPI_FUNC(char *) Py_GetProgramName(void); + +PyAPI_FUNC(void) Py_SetPythonHome(char *); +PyAPI_FUNC(char *) Py_GetPythonHome(void); + +PyAPI_FUNC(void) Py_Initialize(void); +PyAPI_FUNC(void) Py_InitializeEx(int); +PyAPI_FUNC(void) Py_Finalize(void); +PyAPI_FUNC(int) Py_IsInitialized(void); +PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void); +PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *); + +PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *); +PyAPI_FUNC(int) PyRun_AnyFileExFlags(FILE *, const char *, int, PyCompilerFlags *); +PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *); +PyAPI_FUNC(int) PyRun_SimpleFileExFlags(FILE *, const char *, int, PyCompilerFlags *); +PyAPI_FUNC(int) PyRun_InteractiveOneFlags(FILE *, const char *, PyCompilerFlags *); +PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *, const char *, PyCompilerFlags *); + +PyAPI_FUNC(struct _mod *) PyParser_ASTFromString(const char *, const char *, + int, PyCompilerFlags *flags, + PyArena *); +PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(FILE *, const char *, int, + char *, char *, + PyCompilerFlags *, int *, + PyArena *); +#define PyParser_SimpleParseString(S, B) \ + PyParser_SimpleParseStringFlags(S, B, 0) +#define PyParser_SimpleParseFile(FP, S, B) \ + PyParser_SimpleParseFileFlags(FP, S, B, 0) +PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int, + int); +PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *, + int, int); + +PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *, + PyObject *, PyCompilerFlags *); + +PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, const char *, int, + PyObject *, PyObject *, int, + PyCompilerFlags *); + +#define Py_CompileString(str, p, s) Py_CompileStringFlags(str, p, s, NULL) +PyAPI_FUNC(PyObject *) Py_CompileStringFlags(const char *, const char *, int, + PyCompilerFlags *); +PyAPI_FUNC(struct symtable *) Py_SymtableString(const char *, const char *, int); + +PyAPI_FUNC(void) PyErr_Print(void); +PyAPI_FUNC(void) PyErr_PrintEx(int); +PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *); + +PyAPI_FUNC(int) Py_AtExit(void (*func)(void)); + +PyAPI_FUNC(void) Py_Exit(int); + +PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *); + +/* Bootstrap */ +PyAPI_FUNC(int) Py_Main(int argc, char **argv); + +/* Use macros for a bunch of old variants */ +#define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL) +#define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL) +#define PyRun_AnyFileEx(fp, name, closeit) \ + PyRun_AnyFileExFlags(fp, name, closeit, NULL) +#define PyRun_AnyFileFlags(fp, name, flags) \ + PyRun_AnyFileExFlags(fp, name, 0, flags) +#define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL) +#define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL) +#define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL) +#define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL) +#define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL) +#define PyRun_File(fp, p, s, g, l) \ + PyRun_FileExFlags(fp, p, s, g, l, 0, NULL) +#define PyRun_FileEx(fp, p, s, g, l, c) \ + PyRun_FileExFlags(fp, p, s, g, l, c, NULL) +#define PyRun_FileFlags(fp, p, s, g, l, flags) \ + PyRun_FileExFlags(fp, p, s, g, l, 0, flags) + +/* In getpath.c */ +PyAPI_FUNC(char *) Py_GetProgramFullPath(void); +PyAPI_FUNC(char *) Py_GetPrefix(void); +PyAPI_FUNC(char *) Py_GetExecPrefix(void); +PyAPI_FUNC(char *) Py_GetPath(void); + +/* In their own files */ +PyAPI_FUNC(const char *) Py_GetVersion(void); +PyAPI_FUNC(const char *) Py_GetPlatform(void); +PyAPI_FUNC(const char *) Py_GetCopyright(void); +PyAPI_FUNC(const char *) Py_GetCompiler(void); +PyAPI_FUNC(const char *) Py_GetBuildInfo(void); +PyAPI_FUNC(const char *) Py_SubversionRevision(void); +PyAPI_FUNC(const char *) Py_SubversionShortBranch(void); +PyAPI_FUNC(const char *) _Py_gitidentifier(void); +PyAPI_FUNC(const char *) _Py_gitversion(void); + +/* Internal -- various one-time initializations */ +PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void); +PyAPI_FUNC(PyObject *) _PySys_Init(void); +PyAPI_FUNC(void) _PyImport_Init(void); +PyAPI_FUNC(void) _PyExc_Init(void); +PyAPI_FUNC(void) _PyImportHooks_Init(void); +PyAPI_FUNC(int) _PyFrame_Init(void); +PyAPI_FUNC(int) _PyInt_Init(void); +PyAPI_FUNC(int) _PyLong_Init(void); +PyAPI_FUNC(void) _PyFloat_Init(void); +PyAPI_FUNC(int) PyByteArray_Init(void); +PyAPI_FUNC(void) _PyRandom_Init(void); + +/* Various internal finalizers */ +PyAPI_FUNC(void) _PyExc_Fini(void); +PyAPI_FUNC(void) _PyImport_Fini(void); +PyAPI_FUNC(void) PyMethod_Fini(void); +PyAPI_FUNC(void) PyFrame_Fini(void); +PyAPI_FUNC(void) PyCFunction_Fini(void); +PyAPI_FUNC(void) PyDict_Fini(void); +PyAPI_FUNC(void) PyTuple_Fini(void); +PyAPI_FUNC(void) PyList_Fini(void); +PyAPI_FUNC(void) PySet_Fini(void); +PyAPI_FUNC(void) PyString_Fini(void); +PyAPI_FUNC(void) PyInt_Fini(void); +PyAPI_FUNC(void) PyFloat_Fini(void); +PyAPI_FUNC(void) PyOS_FiniInterrupts(void); +PyAPI_FUNC(void) PyByteArray_Fini(void); +PyAPI_FUNC(void) _PyRandom_Fini(void); + +/* Stuff with no proper home (yet) */ +PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, char *); +PyAPI_DATA(int) (*PyOS_InputHook)(void); +PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *); +PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState; + +/* Stack size, in "pointers" (so we get extra safety margins + on 64-bit platforms). On a 32-bit platform, this translates + to an 8k margin. */ +#define PYOS_STACK_MARGIN 2048 + +#if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER) && _MSC_VER >= 1300 +/* Enable stack checking under Microsoft C */ +#define USE_STACKCHECK +#endif + +#ifdef USE_STACKCHECK +/* Check that we aren't overflowing our stack */ +PyAPI_FUNC(int) PyOS_CheckStack(void); +#endif + +/* Signals */ +typedef void (*PyOS_sighandler_t)(int); +PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int); +PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t); + +/* Random */ +PyAPI_FUNC(int) _PyOS_URandom (void *buffer, Py_ssize_t size); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_PYTHONRUN_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/pythread.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pythread.h new file mode 100644 index 0000000..dfd6157 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/pythread.h @@ -0,0 +1,41 @@ + +#ifndef Py_PYTHREAD_H +#define Py_PYTHREAD_H + +typedef void *PyThread_type_lock; +typedef void *PyThread_type_sema; + +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_FUNC(void) PyThread_init_thread(void); +PyAPI_FUNC(long) PyThread_start_new_thread(void (*)(void *), void *); +PyAPI_FUNC(void) PyThread_exit_thread(void); +PyAPI_FUNC(long) PyThread_get_thread_ident(void); + +PyAPI_FUNC(PyThread_type_lock) PyThread_allocate_lock(void); +PyAPI_FUNC(void) PyThread_free_lock(PyThread_type_lock); +PyAPI_FUNC(int) PyThread_acquire_lock(PyThread_type_lock, int); +#define WAIT_LOCK 1 +#define NOWAIT_LOCK 0 +PyAPI_FUNC(void) PyThread_release_lock(PyThread_type_lock); + +PyAPI_FUNC(size_t) PyThread_get_stacksize(void); +PyAPI_FUNC(int) PyThread_set_stacksize(size_t); + +/* Thread Local Storage (TLS) API */ +PyAPI_FUNC(int) PyThread_create_key(void); +PyAPI_FUNC(void) PyThread_delete_key(int); +PyAPI_FUNC(int) PyThread_set_key_value(int, void *); +PyAPI_FUNC(void *) PyThread_get_key_value(int); +PyAPI_FUNC(void) PyThread_delete_key_value(int key); + +/* Cleanup after a fork */ +PyAPI_FUNC(void) PyThread_ReInitTLS(void); + +#ifdef __cplusplus +} +#endif + +#endif /* !Py_PYTHREAD_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/rangeobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/rangeobject.h new file mode 100644 index 0000000..36c9cee --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/rangeobject.h @@ -0,0 +1,28 @@ + +/* Range object interface */ + +#ifndef Py_RANGEOBJECT_H +#define Py_RANGEOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +/* This is about the type 'xrange', not the built-in function range(), which + returns regular lists. */ + +/* +A range object represents an integer range. This is an immutable object; +a range cannot change its value after creation. + +Range objects behave like the corresponding tuple objects except that +they are represented by a start, stop, and step datamembers. +*/ + +PyAPI_DATA(PyTypeObject) PyRange_Type; + +#define PyRange_Check(op) (Py_TYPE(op) == &PyRange_Type) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_RANGEOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/setobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/setobject.h new file mode 100644 index 0000000..52b07d5 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/setobject.h @@ -0,0 +1,99 @@ +/* Set object interface */ + +#ifndef Py_SETOBJECT_H +#define Py_SETOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + + +/* +There are three kinds of slots in the table: + +1. Unused: key == NULL +2. Active: key != NULL and key != dummy +3. Dummy: key == dummy + +Note: .pop() abuses the hash field of an Unused or Dummy slot to +hold a search finger. The hash field of Unused or Dummy slots has +no meaning otherwise. +*/ + +#define PySet_MINSIZE 8 + +typedef struct { + long hash; /* cached hash code for the entry key */ + PyObject *key; +} setentry; + + +/* +This data structure is shared by set and frozenset objects. +*/ + +typedef struct _setobject PySetObject; +struct _setobject { + PyObject_HEAD + + Py_ssize_t fill; /* # Active + # Dummy */ + Py_ssize_t used; /* # Active */ + + /* The table contains mask + 1 slots, and that's a power of 2. + * We store the mask instead of the size because the mask is more + * frequently needed. + */ + Py_ssize_t mask; + + /* table points to smalltable for small tables, else to + * additional malloc'ed memory. table is never NULL! This rule + * saves repeated runtime null-tests. + */ + setentry *table; + setentry *(*lookup)(PySetObject *so, PyObject *key, long hash); + setentry smalltable[PySet_MINSIZE]; + + long hash; /* only used by frozenset objects */ + PyObject *weakreflist; /* List of weak references */ +}; + +PyAPI_DATA(PyTypeObject) PySet_Type; +PyAPI_DATA(PyTypeObject) PyFrozenSet_Type; + +/* Invariants for frozensets: + * data is immutable. + * hash is the hash of the frozenset or -1 if not computed yet. + * Invariants for sets: + * hash is -1 + */ + +#define PyFrozenSet_CheckExact(ob) (Py_TYPE(ob) == &PyFrozenSet_Type) +#define PyAnySet_CheckExact(ob) \ + (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type) +#define PyAnySet_Check(ob) \ + (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type || \ + PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \ + PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type)) +#define PySet_Check(ob) \ + (Py_TYPE(ob) == &PySet_Type || \ + PyType_IsSubtype(Py_TYPE(ob), &PySet_Type)) +#define PyFrozenSet_Check(ob) \ + (Py_TYPE(ob) == &PyFrozenSet_Type || \ + PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type)) + +PyAPI_FUNC(PyObject *) PySet_New(PyObject *); +PyAPI_FUNC(PyObject *) PyFrozenSet_New(PyObject *); +PyAPI_FUNC(Py_ssize_t) PySet_Size(PyObject *anyset); +#define PySet_GET_SIZE(so) (((PySetObject *)(so))->used) +PyAPI_FUNC(int) PySet_Clear(PyObject *set); +PyAPI_FUNC(int) PySet_Contains(PyObject *anyset, PyObject *key); +PyAPI_FUNC(int) PySet_Discard(PyObject *set, PyObject *key); +PyAPI_FUNC(int) PySet_Add(PyObject *set, PyObject *key); +PyAPI_FUNC(int) _PySet_Next(PyObject *set, Py_ssize_t *pos, PyObject **key); +PyAPI_FUNC(int) _PySet_NextEntry(PyObject *set, Py_ssize_t *pos, PyObject **key, long *hash); +PyAPI_FUNC(PyObject *) PySet_Pop(PyObject *set); +PyAPI_FUNC(int) _PySet_Update(PyObject *set, PyObject *iterable); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_SETOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/sliceobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/sliceobject.h new file mode 100644 index 0000000..a10cc05 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/sliceobject.h @@ -0,0 +1,50 @@ +#ifndef Py_SLICEOBJECT_H +#define Py_SLICEOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +/* The unique ellipsis object "..." */ + +PyAPI_DATA(PyObject) _Py_EllipsisObject; /* Don't use this directly */ + +#define Py_Ellipsis (&_Py_EllipsisObject) + +/* Slice object interface */ + +/* + +A slice object containing start, stop, and step data members (the +names are from range). After much talk with Guido, it was decided to +let these be any arbitrary python type. Py_None stands for omitted values. +*/ + +typedef struct { + PyObject_HEAD + PyObject *start, *stop, *step; /* not NULL */ +} PySliceObject; + +PyAPI_DATA(PyTypeObject) PySlice_Type; +PyAPI_DATA(PyTypeObject) PyEllipsis_Type; + +#define PySlice_Check(op) (Py_TYPE(op) == &PySlice_Type) + +PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop, + PyObject* step); +PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop); +PyAPI_FUNC(int) PySlice_GetIndices(PySliceObject *r, Py_ssize_t length, + Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); +PyAPI_FUNC(int) PySlice_GetIndicesEx(PySliceObject *r, Py_ssize_t length, + Py_ssize_t *start, Py_ssize_t *stop, + Py_ssize_t *step, Py_ssize_t *slicelength); + +PyAPI_FUNC(int) _PySlice_Unpack(PyObject *slice, + Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); +PyAPI_FUNC(Py_ssize_t) _PySlice_AdjustIndices(Py_ssize_t length, + Py_ssize_t *start, Py_ssize_t *stop, + Py_ssize_t step); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_SLICEOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/stringobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/stringobject.h new file mode 100644 index 0000000..12cc093 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/stringobject.h @@ -0,0 +1,210 @@ + +/* String (str/bytes) object interface */ + +#ifndef Py_STRINGOBJECT_H +#define Py_STRINGOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* +Type PyStringObject represents a character string. An extra zero byte is +reserved at the end to ensure it is zero-terminated, but a size is +present so strings with null bytes in them can be represented. This +is an immutable object type. + +There are functions to create new string objects, to test +an object for string-ness, and to get the +string value. The latter function returns a null pointer +if the object is not of the proper type. +There is a variant that takes an explicit size as well as a +variant that assumes a zero-terminated string. Note that none of the +functions should be applied to nil objects. +*/ + +/* Caching the hash (ob_shash) saves recalculation of a string's hash value. + Interning strings (ob_sstate) tries to ensure that only one string + object with a given value exists, so equality tests can be one pointer + comparison. This is generally restricted to strings that "look like" + Python identifiers, although the intern() builtin can be used to force + interning of any string. + Together, these sped the interpreter by up to 20%. */ + +typedef struct { + PyObject_VAR_HEAD + long ob_shash; + int ob_sstate; + char ob_sval[1]; + + /* Invariants: + * ob_sval contains space for 'ob_size+1' elements. + * ob_sval[ob_size] == 0. + * ob_shash is the hash of the string or -1 if not computed yet. + * ob_sstate != 0 iff the string object is in stringobject.c's + * 'interned' dictionary; in this case the two references + * from 'interned' to this object are *not counted* in ob_refcnt. + */ +} PyStringObject; + +#define SSTATE_NOT_INTERNED 0 +#define SSTATE_INTERNED_MORTAL 1 +#define SSTATE_INTERNED_IMMORTAL 2 + +PyAPI_DATA(PyTypeObject) PyBaseString_Type; +PyAPI_DATA(PyTypeObject) PyString_Type; + +#define PyString_Check(op) \ + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_STRING_SUBCLASS) +#define PyString_CheckExact(op) (Py_TYPE(op) == &PyString_Type) + +PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t); +PyAPI_FUNC(PyObject *) PyString_FromString(const char *); +PyAPI_FUNC(PyObject *) PyString_FromFormatV(const char*, va_list) + Py_GCC_ATTRIBUTE((format(printf, 1, 0))); +PyAPI_FUNC(PyObject *) PyString_FromFormat(const char*, ...) + Py_GCC_ATTRIBUTE((format(printf, 1, 2))); +PyAPI_FUNC(Py_ssize_t) PyString_Size(PyObject *); +PyAPI_FUNC(char *) PyString_AsString(PyObject *); +PyAPI_FUNC(PyObject *) PyString_Repr(PyObject *, int); +PyAPI_FUNC(void) PyString_Concat(PyObject **, PyObject *); +PyAPI_FUNC(void) PyString_ConcatAndDel(PyObject **, PyObject *); +PyAPI_FUNC(int) _PyString_Resize(PyObject **, Py_ssize_t); +PyAPI_FUNC(int) _PyString_Eq(PyObject *, PyObject*); +PyAPI_FUNC(PyObject *) PyString_Format(PyObject *, PyObject *); +PyAPI_FUNC(PyObject *) _PyString_FormatLong(PyObject*, int, int, + int, char**, int*); +PyAPI_FUNC(PyObject *) PyString_DecodeEscape(const char *, Py_ssize_t, + const char *, Py_ssize_t, + const char *); + +PyAPI_FUNC(void) PyString_InternInPlace(PyObject **); +PyAPI_FUNC(void) PyString_InternImmortal(PyObject **); +PyAPI_FUNC(PyObject *) PyString_InternFromString(const char *); +PyAPI_FUNC(void) _Py_ReleaseInternedStrings(void); + +/* Use only if you know it's a string */ +#define PyString_CHECK_INTERNED(op) (((PyStringObject *)(op))->ob_sstate) + +/* Macro, trading safety for speed */ +#define PyString_AS_STRING(op) (((PyStringObject *)(op))->ob_sval) +#define PyString_GET_SIZE(op) Py_SIZE(op) + +/* _PyString_Join(sep, x) is like sep.join(x). sep must be PyStringObject*, + x must be an iterable object. */ +PyAPI_FUNC(PyObject *) _PyString_Join(PyObject *sep, PyObject *x); + +/* --- Generic Codecs ----------------------------------------------------- */ + +/* Create an object by decoding the encoded string s of the + given size. */ + +PyAPI_FUNC(PyObject*) PyString_Decode( + const char *s, /* encoded string */ + Py_ssize_t size, /* size of buffer */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Encodes a char buffer of the given size and returns a + Python object. */ + +PyAPI_FUNC(PyObject*) PyString_Encode( + const char *s, /* string char buffer */ + Py_ssize_t size, /* number of chars to encode */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Encodes a string object and returns the result as Python + object. */ + +PyAPI_FUNC(PyObject*) PyString_AsEncodedObject( + PyObject *str, /* string object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Encodes a string object and returns the result as Python string + object. + + If the codec returns a Unicode object, the object is converted + back to a string using the default encoding. + + DEPRECATED - use PyString_AsEncodedObject() instead. */ + +PyAPI_FUNC(PyObject*) PyString_AsEncodedString( + PyObject *str, /* string object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Decodes a string object and returns the result as Python + object. */ + +PyAPI_FUNC(PyObject*) PyString_AsDecodedObject( + PyObject *str, /* string object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Decodes a string object and returns the result as Python string + object. + + If the codec returns a Unicode object, the object is converted + back to a string using the default encoding. + + DEPRECATED - use PyString_AsDecodedObject() instead. */ + +PyAPI_FUNC(PyObject*) PyString_AsDecodedString( + PyObject *str, /* string object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Provides access to the internal data buffer and size of a string + object or the default encoded version of a Unicode object. Passing + NULL as *len parameter will force the string buffer to be + 0-terminated (passing a string with embedded NULL characters will + cause an exception). */ + +PyAPI_FUNC(int) PyString_AsStringAndSize( + register PyObject *obj, /* string or Unicode object */ + register char **s, /* pointer to buffer variable */ + register Py_ssize_t *len /* pointer to length variable or NULL + (only possible for 0-terminated + strings) */ + ); + + +/* Using the current locale, insert the thousands grouping + into the string pointed to by buffer. For the argument descriptions, + see Objects/stringlib/localeutil.h */ +PyAPI_FUNC(Py_ssize_t) _PyString_InsertThousandsGroupingLocale(char *buffer, + Py_ssize_t n_buffer, + char *digits, + Py_ssize_t n_digits, + Py_ssize_t min_width); + +/* Using explicit passed-in values, insert the thousands grouping + into the string pointed to by buffer. For the argument descriptions, + see Objects/stringlib/localeutil.h */ +PyAPI_FUNC(Py_ssize_t) _PyString_InsertThousandsGrouping(char *buffer, + Py_ssize_t n_buffer, + char *digits, + Py_ssize_t n_digits, + Py_ssize_t min_width, + const char *grouping, + const char *thousands_sep); + +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +PyAPI_FUNC(PyObject *) _PyBytes_FormatAdvanced(PyObject *obj, + char *format_spec, + Py_ssize_t format_spec_len); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_STRINGOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/structmember.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/structmember.h new file mode 100644 index 0000000..fe5b44e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/structmember.h @@ -0,0 +1,99 @@ +#ifndef Py_STRUCTMEMBER_H +#define Py_STRUCTMEMBER_H +#ifdef __cplusplus +extern "C" { +#endif + + +/* Interface to map C struct members to Python object attributes */ + +#include /* For offsetof */ + +/* The offsetof() macro calculates the offset of a structure member + in its structure. Unfortunately this cannot be written down + portably, hence it is provided by a Standard C header file. + For pre-Standard C compilers, here is a version that usually works + (but watch out!): */ + +#ifndef offsetof +#define offsetof(type, member) ( (int) & ((type*)0) -> member ) +#endif + +/* An array of memberlist structures defines the name, type and offset + of selected members of a C structure. These can be read by + PyMember_Get() and set by PyMember_Set() (except if their READONLY flag + is set). The array must be terminated with an entry whose name + pointer is NULL. */ + +struct memberlist { + /* Obsolete version, for binary backwards compatibility */ + char *name; + int type; + int offset; + int flags; +}; + +typedef struct PyMemberDef { + /* Current version, use this */ + char *name; + int type; + Py_ssize_t offset; + int flags; + char *doc; +} PyMemberDef; + +/* Types */ +#define T_SHORT 0 +#define T_INT 1 +#define T_LONG 2 +#define T_FLOAT 3 +#define T_DOUBLE 4 +#define T_STRING 5 +#define T_OBJECT 6 +/* XXX the ordering here is weird for binary compatibility */ +#define T_CHAR 7 /* 1-character string */ +#define T_BYTE 8 /* 8-bit signed int */ +/* unsigned variants: */ +#define T_UBYTE 9 +#define T_USHORT 10 +#define T_UINT 11 +#define T_ULONG 12 + +/* Added by Jack: strings contained in the structure */ +#define T_STRING_INPLACE 13 + +/* Added by Lillo: bools contained in the structure (assumed char) */ +#define T_BOOL 14 + +#define T_OBJECT_EX 16 /* Like T_OBJECT, but raises AttributeError + when the value is NULL, instead of + converting to None. */ +#ifdef HAVE_LONG_LONG +#define T_LONGLONG 17 +#define T_ULONGLONG 18 +#endif /* HAVE_LONG_LONG */ + +#define T_PYSSIZET 19 /* Py_ssize_t */ + + +/* Flags */ +#define READONLY 1 +#define RO READONLY /* Shorthand */ +#define READ_RESTRICTED 2 +#define PY_WRITE_RESTRICTED 4 +#define RESTRICTED (READ_RESTRICTED | PY_WRITE_RESTRICTED) + + +/* Obsolete API, for binary backwards compatibility */ +PyAPI_FUNC(PyObject *) PyMember_Get(const char *, struct memberlist *, const char *); +PyAPI_FUNC(int) PyMember_Set(char *, struct memberlist *, const char *, PyObject *); + +/* Current API, use this */ +PyAPI_FUNC(PyObject *) PyMember_GetOne(const char *, struct PyMemberDef *); +PyAPI_FUNC(int) PyMember_SetOne(char *, struct PyMemberDef *, PyObject *); + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_STRUCTMEMBER_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/structseq.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/structseq.h new file mode 100644 index 0000000..e662916 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/structseq.h @@ -0,0 +1,41 @@ + +/* Tuple object interface */ + +#ifndef Py_STRUCTSEQ_H +#define Py_STRUCTSEQ_H +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct PyStructSequence_Field { + char *name; + char *doc; +} PyStructSequence_Field; + +typedef struct PyStructSequence_Desc { + char *name; + char *doc; + struct PyStructSequence_Field *fields; + int n_in_sequence; +} PyStructSequence_Desc; + +extern char* PyStructSequence_UnnamedField; + +PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type, + PyStructSequence_Desc *desc); + +PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type); + +typedef struct { + PyObject_VAR_HEAD + PyObject *ob_item[1]; +} PyStructSequence; + +/* Macro, *only* to be used to fill in brand new objects */ +#define PyStructSequence_SET_ITEM(op, i, v) \ + (((PyStructSequence *)(op))->ob_item[i] = v) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_STRUCTSEQ_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/symtable.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/symtable.h new file mode 100644 index 0000000..e0a0be4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/symtable.h @@ -0,0 +1,98 @@ +#ifndef Py_SYMTABLE_H +#define Py_SYMTABLE_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum _block_type { FunctionBlock, ClassBlock, ModuleBlock } + _Py_block_ty; + +struct _symtable_entry; + +struct symtable { + const char *st_filename; /* name of file being compiled */ + struct _symtable_entry *st_cur; /* current symbol table entry */ + struct _symtable_entry *st_top; /* module entry */ + PyObject *st_symbols; /* dictionary of symbol table entries */ + PyObject *st_stack; /* stack of namespace info */ + PyObject *st_global; /* borrowed ref to MODULE in st_symbols */ + int st_nblocks; /* number of blocks */ + PyObject *st_private; /* name of current class or NULL */ + PyFutureFeatures *st_future; /* module's future features */ +}; + +typedef struct _symtable_entry { + PyObject_HEAD + PyObject *ste_id; /* int: key in st_symbols */ + PyObject *ste_symbols; /* dict: name to flags */ + PyObject *ste_name; /* string: name of block */ + PyObject *ste_varnames; /* list of variable names */ + PyObject *ste_children; /* list of child ids */ + _Py_block_ty ste_type; /* module, class, or function */ + int ste_unoptimized; /* false if namespace is optimized */ + int ste_nested; /* true if block is nested */ + unsigned ste_free : 1; /* true if block has free variables */ + unsigned ste_child_free : 1; /* true if a child block has free vars, + including free refs to globals */ + unsigned ste_generator : 1; /* true if namespace is a generator */ + unsigned ste_varargs : 1; /* true if block has varargs */ + unsigned ste_varkeywords : 1; /* true if block has varkeywords */ + unsigned ste_returns_value : 1; /* true if namespace uses return with + an argument */ + int ste_lineno; /* first line of block */ + int ste_opt_lineno; /* lineno of last exec or import * */ + int ste_tmpname; /* counter for listcomp temp vars */ + struct symtable *ste_table; +} PySTEntryObject; + +PyAPI_DATA(PyTypeObject) PySTEntry_Type; + +#define PySTEntry_Check(op) (Py_TYPE(op) == &PySTEntry_Type) + +PyAPI_FUNC(int) PyST_GetScope(PySTEntryObject *, PyObject *); + +PyAPI_FUNC(struct symtable *) PySymtable_Build(mod_ty, const char *, + PyFutureFeatures *); +PyAPI_FUNC(PySTEntryObject *) PySymtable_Lookup(struct symtable *, void *); + +PyAPI_FUNC(void) PySymtable_Free(struct symtable *); + +/* Flags for def-use information */ + +#define DEF_GLOBAL 1 /* global stmt */ +#define DEF_LOCAL 2 /* assignment in code block */ +#define DEF_PARAM 2<<1 /* formal parameter */ +#define USE 2<<2 /* name is used */ +#define DEF_FREE 2<<3 /* name used but not defined in nested block */ +#define DEF_FREE_CLASS 2<<4 /* free variable from class's method */ +#define DEF_IMPORT 2<<5 /* assignment occurred via import */ + +#define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT) + +/* GLOBAL_EXPLICIT and GLOBAL_IMPLICIT are used internally by the symbol + table. GLOBAL is returned from PyST_GetScope() for either of them. + It is stored in ste_symbols at bits 12-14. +*/ +#define SCOPE_OFF 11 +#define SCOPE_MASK 7 + +#define LOCAL 1 +#define GLOBAL_EXPLICIT 2 +#define GLOBAL_IMPLICIT 3 +#define FREE 4 +#define CELL 5 + +/* The following three names are used for the ste_unoptimized bit field */ +#define OPT_IMPORT_STAR 1 +#define OPT_EXEC 2 +#define OPT_BARE_EXEC 4 +#define OPT_TOPLEVEL 8 /* top-level names, including eval and exec */ + +#define GENERATOR 1 +#define GENERATOR_EXPRESSION 2 + +#ifdef __cplusplus +} +#endif +#endif /* !Py_SYMTABLE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/sysmodule.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/sysmodule.h new file mode 100644 index 0000000..6787978 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/sysmodule.h @@ -0,0 +1,31 @@ + +/* System module interface */ + +#ifndef Py_SYSMODULE_H +#define Py_SYSMODULE_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_FUNC(PyObject *) PySys_GetObject(char *); +PyAPI_FUNC(int) PySys_SetObject(char *, PyObject *); +PyAPI_FUNC(FILE *) PySys_GetFile(char *, FILE *); +PyAPI_FUNC(void) PySys_SetArgv(int, char **); +PyAPI_FUNC(void) PySys_SetArgvEx(int, char **, int); +PyAPI_FUNC(void) PySys_SetPath(char *); + +PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) + Py_GCC_ATTRIBUTE((format(printf, 1, 2))); +PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) + Py_GCC_ATTRIBUTE((format(printf, 1, 2))); + +PyAPI_FUNC(void) PySys_ResetWarnOptions(void); +PyAPI_FUNC(void) PySys_AddWarnOption(char *); +PyAPI_FUNC(int) PySys_HasWarnOptions(void); + +PyAPI_FUNC(size_t) _PySys_GetSizeOf(PyObject *); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_SYSMODULE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/timefuncs.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/timefuncs.h new file mode 100644 index 0000000..a9d26a7 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/timefuncs.h @@ -0,0 +1,26 @@ +/* timefuncs.h + */ + +/* Utility function related to timemodule.c. */ + +#ifndef TIMEFUNCS_H +#define TIMEFUNCS_H +#ifdef __cplusplus +extern "C" { +#endif + + +/* Cast double x to time_t, but raise ValueError if x is too large + * to fit in a time_t. ValueError is set on return iff the return + * value is (time_t)-1 and PyErr_Occurred(). + */ +PyAPI_FUNC(time_t) _PyTime_DoubleToTimet(double x); + +/* Get the current time since the epoch in seconds */ +PyAPI_FUNC(double) _PyTime_FloatTime(void); + + +#ifdef __cplusplus +} +#endif +#endif /* TIMEFUNCS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/token.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/token.h new file mode 100644 index 0000000..72659ac --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/token.h @@ -0,0 +1,85 @@ + +/* Token types */ + +#ifndef Py_TOKEN_H +#define Py_TOKEN_H +#ifdef __cplusplus +extern "C" { +#endif + +#undef TILDE /* Prevent clash of our definition with system macro. Ex AIX, ioctl.h */ + +#define ENDMARKER 0 +#define NAME 1 +#define NUMBER 2 +#define STRING 3 +#define NEWLINE 4 +#define INDENT 5 +#define DEDENT 6 +#define LPAR 7 +#define RPAR 8 +#define LSQB 9 +#define RSQB 10 +#define COLON 11 +#define COMMA 12 +#define SEMI 13 +#define PLUS 14 +#define MINUS 15 +#define STAR 16 +#define SLASH 17 +#define VBAR 18 +#define AMPER 19 +#define LESS 20 +#define GREATER 21 +#define EQUAL 22 +#define DOT 23 +#define PERCENT 24 +#define BACKQUOTE 25 +#define LBRACE 26 +#define RBRACE 27 +#define EQEQUAL 28 +#define NOTEQUAL 29 +#define LESSEQUAL 30 +#define GREATEREQUAL 31 +#define TILDE 32 +#define CIRCUMFLEX 33 +#define LEFTSHIFT 34 +#define RIGHTSHIFT 35 +#define DOUBLESTAR 36 +#define PLUSEQUAL 37 +#define MINEQUAL 38 +#define STAREQUAL 39 +#define SLASHEQUAL 40 +#define PERCENTEQUAL 41 +#define AMPEREQUAL 42 +#define VBAREQUAL 43 +#define CIRCUMFLEXEQUAL 44 +#define LEFTSHIFTEQUAL 45 +#define RIGHTSHIFTEQUAL 46 +#define DOUBLESTAREQUAL 47 +#define DOUBLESLASH 48 +#define DOUBLESLASHEQUAL 49 +#define AT 50 +/* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */ +#define OP 51 +#define ERRORTOKEN 52 +#define N_TOKENS 53 + +/* Special definitions for cooperation with parser */ + +#define NT_OFFSET 256 + +#define ISTERMINAL(x) ((x) < NT_OFFSET) +#define ISNONTERMINAL(x) ((x) >= NT_OFFSET) +#define ISEOF(x) ((x) == ENDMARKER) + + +PyAPI_DATA(char *) _PyParser_TokenNames[]; /* Token names */ +PyAPI_FUNC(int) PyToken_OneChar(int); +PyAPI_FUNC(int) PyToken_TwoChars(int, int); +PyAPI_FUNC(int) PyToken_ThreeChars(int, int, int); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_TOKEN_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/traceback.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/traceback.h new file mode 100644 index 0000000..e7943da --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/traceback.h @@ -0,0 +1,31 @@ + +#ifndef Py_TRACEBACK_H +#define Py_TRACEBACK_H +#ifdef __cplusplus +extern "C" { +#endif + +struct _frame; + +/* Traceback interface */ + +typedef struct _traceback { + PyObject_HEAD + struct _traceback *tb_next; + struct _frame *tb_frame; + int tb_lasti; + int tb_lineno; +} PyTracebackObject; + +PyAPI_FUNC(int) PyTraceBack_Here(struct _frame *); +PyAPI_FUNC(int) PyTraceBack_Print(PyObject *, PyObject *); +PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, const char *, int, int); + +/* Reveal traceback type so we can typecheck traceback objects */ +PyAPI_DATA(PyTypeObject) PyTraceBack_Type; +#define PyTraceBack_Check(v) (Py_TYPE(v) == &PyTraceBack_Type) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_TRACEBACK_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/tupleobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/tupleobject.h new file mode 100644 index 0000000..a5ab733 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/tupleobject.h @@ -0,0 +1,61 @@ + +/* Tuple object interface */ + +#ifndef Py_TUPLEOBJECT_H +#define Py_TUPLEOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +/* +Another generally useful object type is a tuple of object pointers. +For Python, this is an immutable type. C code can change the tuple items +(but not their number), and even use tuples are general-purpose arrays of +object references, but in general only brand new tuples should be mutated, +not ones that might already have been exposed to Python code. + +*** WARNING *** PyTuple_SetItem does not increment the new item's reference +count, but does decrement the reference count of the item it replaces, +if not nil. It does *decrement* the reference count if it is *not* +inserted in the tuple. Similarly, PyTuple_GetItem does not increment the +returned item's reference count. +*/ + +typedef struct { + PyObject_VAR_HEAD + PyObject *ob_item[1]; + + /* ob_item contains space for 'ob_size' elements. + * Items must normally not be NULL, except during construction when + * the tuple is not yet visible outside the function that builds it. + */ +} PyTupleObject; + +PyAPI_DATA(PyTypeObject) PyTuple_Type; + +#define PyTuple_Check(op) \ + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS) +#define PyTuple_CheckExact(op) (Py_TYPE(op) == &PyTuple_Type) + +PyAPI_FUNC(PyObject *) PyTuple_New(Py_ssize_t size); +PyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject *); +PyAPI_FUNC(PyObject *) PyTuple_GetItem(PyObject *, Py_ssize_t); +PyAPI_FUNC(int) PyTuple_SetItem(PyObject *, Py_ssize_t, PyObject *); +PyAPI_FUNC(PyObject *) PyTuple_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t); +PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, Py_ssize_t); +PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...); +PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *); + +/* Macro, trading safety for speed */ +#define PyTuple_GET_ITEM(op, i) (((PyTupleObject *)(op))->ob_item[i]) +#define PyTuple_GET_SIZE(op) Py_SIZE(op) + +/* Macro, *only* to be used to fill in brand new tuples */ +#define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v) + +PyAPI_FUNC(int) PyTuple_ClearFreeList(void); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_TUPLEOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/ucnhash.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/ucnhash.h new file mode 100644 index 0000000..69b7774 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/ucnhash.h @@ -0,0 +1,33 @@ +/* Unicode name database interface */ + +#ifndef Py_UCNHASH_H +#define Py_UCNHASH_H +#ifdef __cplusplus +extern "C" { +#endif + +/* revised ucnhash CAPI interface (exported through a "wrapper") */ + +#define PyUnicodeData_CAPSULE_NAME "unicodedata.ucnhash_CAPI" + +typedef struct { + + /* Size of this struct */ + int size; + + /* Get name for a given character code. Returns non-zero if + success, zero if not. Does not set Python exceptions. + If self is NULL, data come from the default version of the database. + If it is not NULL, it should be a unicodedata.ucd_X_Y_Z object */ + int (*getname)(PyObject *self, Py_UCS4 code, char* buffer, int buflen); + + /* Get character code for a given name. Same error handling + as for getname. */ + int (*getcode)(PyObject *self, const char* name, int namelen, Py_UCS4* code); + +} _PyUnicode_Name_CAPI; + +#ifdef __cplusplus +} +#endif +#endif /* !Py_UCNHASH_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/unicodeobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/unicodeobject.h new file mode 100644 index 0000000..7781f96 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/unicodeobject.h @@ -0,0 +1,1413 @@ +#ifndef Py_UNICODEOBJECT_H +#define Py_UNICODEOBJECT_H + +#include + +/* + +Unicode implementation based on original code by Fredrik Lundh, +modified by Marc-Andre Lemburg (mal@lemburg.com) according to the +Unicode Integration Proposal (see file Misc/unicode.txt). + +Copyright (c) Corporation for National Research Initiatives. + + + Original header: + -------------------------------------------------------------------- + + * Yet another Unicode string type for Python. This type supports the + * 16-bit Basic Multilingual Plane (BMP) only. + * + * Written by Fredrik Lundh, January 1999. + * + * Copyright (c) 1999 by Secret Labs AB. + * Copyright (c) 1999 by Fredrik Lundh. + * + * fredrik@pythonware.com + * http://www.pythonware.com + * + * -------------------------------------------------------------------- + * This Unicode String Type is + * + * Copyright (c) 1999 by Secret Labs AB + * Copyright (c) 1999 by Fredrik Lundh + * + * By obtaining, using, and/or copying this software and/or its + * associated documentation, you agree that you have read, understood, + * and will comply with the following terms and conditions: + * + * Permission to use, copy, modify, and distribute this software and its + * associated documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appears in all + * copies, and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of Secret Labs + * AB or the author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. + * + * SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * -------------------------------------------------------------------- */ + +#include + +/* === Internal API ======================================================= */ + +/* --- Internal Unicode Format -------------------------------------------- */ + +#ifndef Py_USING_UNICODE + +#define PyUnicode_Check(op) 0 +#define PyUnicode_CheckExact(op) 0 + +#else + +/* FIXME: MvL's new implementation assumes that Py_UNICODE_SIZE is + properly set, but the default rules below doesn't set it. I'll + sort this out some other day -- fredrik@pythonware.com */ + +#ifndef Py_UNICODE_SIZE +#error Must define Py_UNICODE_SIZE +#endif + +/* Setting Py_UNICODE_WIDE enables UCS-4 storage. Otherwise, Unicode + strings are stored as UCS-2 (with limited support for UTF-16) */ + +#if Py_UNICODE_SIZE >= 4 +#define Py_UNICODE_WIDE +#endif + +/* Set these flags if the platform has "wchar.h", "wctype.h" and the + wchar_t type is a 16-bit unsigned type */ +/* #define HAVE_WCHAR_H */ +/* #define HAVE_USABLE_WCHAR_T */ + +/* Defaults for various platforms */ +#ifndef PY_UNICODE_TYPE + +/* Windows has a usable wchar_t type (unless we're using UCS-4) */ +# if defined(MS_WIN32) && Py_UNICODE_SIZE == 2 +# define HAVE_USABLE_WCHAR_T +# define PY_UNICODE_TYPE wchar_t +# endif + +# if defined(Py_UNICODE_WIDE) +# define PY_UNICODE_TYPE Py_UCS4 +# endif + +#endif + +/* If the compiler provides a wchar_t type we try to support it + through the interface functions PyUnicode_FromWideChar() and + PyUnicode_AsWideChar(). */ + +#ifdef HAVE_USABLE_WCHAR_T +# ifndef HAVE_WCHAR_H +# define HAVE_WCHAR_H +# endif +#endif + +#ifdef HAVE_WCHAR_H +/* Work around a cosmetic bug in BSDI 4.x wchar.h; thanks to Thomas Wouters */ +# ifdef _HAVE_BSDI +# include +# endif +# include +#endif + +/* + * Use this typedef when you need to represent a UTF-16 surrogate pair + * as single unsigned integer. + */ +#if SIZEOF_INT >= 4 +typedef unsigned int Py_UCS4; +#elif SIZEOF_LONG >= 4 +typedef unsigned long Py_UCS4; +#endif + +/* Py_UNICODE is the native Unicode storage format (code unit) used by + Python and represents a single Unicode element in the Unicode + type. */ + +typedef PY_UNICODE_TYPE Py_UNICODE; + +/* --- UCS-2/UCS-4 Name Mangling ------------------------------------------ */ + +/* Unicode API names are mangled to assure that UCS-2 and UCS-4 builds + produce different external names and thus cause import errors in + case Python interpreters and extensions with mixed compiled in + Unicode width assumptions are combined. */ + +#ifndef Py_UNICODE_WIDE + +# define PyUnicode_AsASCIIString PyUnicodeUCS2_AsASCIIString +# define PyUnicode_AsCharmapString PyUnicodeUCS2_AsCharmapString +# define PyUnicode_AsEncodedObject PyUnicodeUCS2_AsEncodedObject +# define PyUnicode_AsEncodedString PyUnicodeUCS2_AsEncodedString +# define PyUnicode_AsLatin1String PyUnicodeUCS2_AsLatin1String +# define PyUnicode_AsRawUnicodeEscapeString PyUnicodeUCS2_AsRawUnicodeEscapeString +# define PyUnicode_AsUTF32String PyUnicodeUCS2_AsUTF32String +# define PyUnicode_AsUTF16String PyUnicodeUCS2_AsUTF16String +# define PyUnicode_AsUTF8String PyUnicodeUCS2_AsUTF8String +# define PyUnicode_AsUnicode PyUnicodeUCS2_AsUnicode +# define PyUnicode_AsUnicodeEscapeString PyUnicodeUCS2_AsUnicodeEscapeString +# define PyUnicode_AsWideChar PyUnicodeUCS2_AsWideChar +# define PyUnicode_ClearFreeList PyUnicodeUCS2_ClearFreelist +# define PyUnicode_Compare PyUnicodeUCS2_Compare +# define PyUnicode_Concat PyUnicodeUCS2_Concat +# define PyUnicode_Contains PyUnicodeUCS2_Contains +# define PyUnicode_Count PyUnicodeUCS2_Count +# define PyUnicode_Decode PyUnicodeUCS2_Decode +# define PyUnicode_DecodeASCII PyUnicodeUCS2_DecodeASCII +# define PyUnicode_DecodeCharmap PyUnicodeUCS2_DecodeCharmap +# define PyUnicode_DecodeLatin1 PyUnicodeUCS2_DecodeLatin1 +# define PyUnicode_DecodeRawUnicodeEscape PyUnicodeUCS2_DecodeRawUnicodeEscape +# define PyUnicode_DecodeUTF32 PyUnicodeUCS2_DecodeUTF32 +# define PyUnicode_DecodeUTF32Stateful PyUnicodeUCS2_DecodeUTF32Stateful +# define PyUnicode_DecodeUTF16 PyUnicodeUCS2_DecodeUTF16 +# define PyUnicode_DecodeUTF16Stateful PyUnicodeUCS2_DecodeUTF16Stateful +# define PyUnicode_DecodeUTF8 PyUnicodeUCS2_DecodeUTF8 +# define PyUnicode_DecodeUTF8Stateful PyUnicodeUCS2_DecodeUTF8Stateful +# define PyUnicode_DecodeUnicodeEscape PyUnicodeUCS2_DecodeUnicodeEscape +# define PyUnicode_Encode PyUnicodeUCS2_Encode +# define PyUnicode_EncodeASCII PyUnicodeUCS2_EncodeASCII +# define PyUnicode_EncodeCharmap PyUnicodeUCS2_EncodeCharmap +# define PyUnicode_EncodeDecimal PyUnicodeUCS2_EncodeDecimal +# define PyUnicode_EncodeLatin1 PyUnicodeUCS2_EncodeLatin1 +# define PyUnicode_EncodeRawUnicodeEscape PyUnicodeUCS2_EncodeRawUnicodeEscape +# define PyUnicode_EncodeUTF32 PyUnicodeUCS2_EncodeUTF32 +# define PyUnicode_EncodeUTF16 PyUnicodeUCS2_EncodeUTF16 +# define PyUnicode_EncodeUTF8 PyUnicodeUCS2_EncodeUTF8 +# define PyUnicode_EncodeUnicodeEscape PyUnicodeUCS2_EncodeUnicodeEscape +# define PyUnicode_Find PyUnicodeUCS2_Find +# define PyUnicode_Format PyUnicodeUCS2_Format +# define PyUnicode_FromEncodedObject PyUnicodeUCS2_FromEncodedObject +# define PyUnicode_FromFormat PyUnicodeUCS2_FromFormat +# define PyUnicode_FromFormatV PyUnicodeUCS2_FromFormatV +# define PyUnicode_FromObject PyUnicodeUCS2_FromObject +# define PyUnicode_FromOrdinal PyUnicodeUCS2_FromOrdinal +# define PyUnicode_FromString PyUnicodeUCS2_FromString +# define PyUnicode_FromStringAndSize PyUnicodeUCS2_FromStringAndSize +# define PyUnicode_FromUnicode PyUnicodeUCS2_FromUnicode +# define PyUnicode_FromWideChar PyUnicodeUCS2_FromWideChar +# define PyUnicode_GetDefaultEncoding PyUnicodeUCS2_GetDefaultEncoding +# define PyUnicode_GetMax PyUnicodeUCS2_GetMax +# define PyUnicode_GetSize PyUnicodeUCS2_GetSize +# define PyUnicode_Join PyUnicodeUCS2_Join +# define PyUnicode_Partition PyUnicodeUCS2_Partition +# define PyUnicode_RPartition PyUnicodeUCS2_RPartition +# define PyUnicode_RSplit PyUnicodeUCS2_RSplit +# define PyUnicode_Replace PyUnicodeUCS2_Replace +# define PyUnicode_Resize PyUnicodeUCS2_Resize +# define PyUnicode_RichCompare PyUnicodeUCS2_RichCompare +# define PyUnicode_SetDefaultEncoding PyUnicodeUCS2_SetDefaultEncoding +# define PyUnicode_Split PyUnicodeUCS2_Split +# define PyUnicode_Splitlines PyUnicodeUCS2_Splitlines +# define PyUnicode_Tailmatch PyUnicodeUCS2_Tailmatch +# define PyUnicode_Translate PyUnicodeUCS2_Translate +# define PyUnicode_TranslateCharmap PyUnicodeUCS2_TranslateCharmap +# define _PyUnicode_AsDefaultEncodedString _PyUnicodeUCS2_AsDefaultEncodedString +# define _PyUnicode_Fini _PyUnicodeUCS2_Fini +# define _PyUnicode_Init _PyUnicodeUCS2_Init +# define _PyUnicode_IsAlpha _PyUnicodeUCS2_IsAlpha +# define _PyUnicode_IsDecimalDigit _PyUnicodeUCS2_IsDecimalDigit +# define _PyUnicode_IsDigit _PyUnicodeUCS2_IsDigit +# define _PyUnicode_IsLinebreak _PyUnicodeUCS2_IsLinebreak +# define _PyUnicode_IsLowercase _PyUnicodeUCS2_IsLowercase +# define _PyUnicode_IsNumeric _PyUnicodeUCS2_IsNumeric +# define _PyUnicode_IsTitlecase _PyUnicodeUCS2_IsTitlecase +# define _PyUnicode_IsUppercase _PyUnicodeUCS2_IsUppercase +# define _PyUnicode_IsWhitespace _PyUnicodeUCS2_IsWhitespace +# define _PyUnicode_ToDecimalDigit _PyUnicodeUCS2_ToDecimalDigit +# define _PyUnicode_ToDigit _PyUnicodeUCS2_ToDigit +# define _PyUnicode_ToLowercase _PyUnicodeUCS2_ToLowercase +# define _PyUnicode_ToNumeric _PyUnicodeUCS2_ToNumeric +# define _PyUnicode_ToTitlecase _PyUnicodeUCS2_ToTitlecase +# define _PyUnicode_ToUppercase _PyUnicodeUCS2_ToUppercase + +#else + +# define PyUnicode_AsASCIIString PyUnicodeUCS4_AsASCIIString +# define PyUnicode_AsCharmapString PyUnicodeUCS4_AsCharmapString +# define PyUnicode_AsEncodedObject PyUnicodeUCS4_AsEncodedObject +# define PyUnicode_AsEncodedString PyUnicodeUCS4_AsEncodedString +# define PyUnicode_AsLatin1String PyUnicodeUCS4_AsLatin1String +# define PyUnicode_AsRawUnicodeEscapeString PyUnicodeUCS4_AsRawUnicodeEscapeString +# define PyUnicode_AsUTF32String PyUnicodeUCS4_AsUTF32String +# define PyUnicode_AsUTF16String PyUnicodeUCS4_AsUTF16String +# define PyUnicode_AsUTF8String PyUnicodeUCS4_AsUTF8String +# define PyUnicode_AsUnicode PyUnicodeUCS4_AsUnicode +# define PyUnicode_AsUnicodeEscapeString PyUnicodeUCS4_AsUnicodeEscapeString +# define PyUnicode_AsWideChar PyUnicodeUCS4_AsWideChar +# define PyUnicode_ClearFreeList PyUnicodeUCS4_ClearFreelist +# define PyUnicode_Compare PyUnicodeUCS4_Compare +# define PyUnicode_Concat PyUnicodeUCS4_Concat +# define PyUnicode_Contains PyUnicodeUCS4_Contains +# define PyUnicode_Count PyUnicodeUCS4_Count +# define PyUnicode_Decode PyUnicodeUCS4_Decode +# define PyUnicode_DecodeASCII PyUnicodeUCS4_DecodeASCII +# define PyUnicode_DecodeCharmap PyUnicodeUCS4_DecodeCharmap +# define PyUnicode_DecodeLatin1 PyUnicodeUCS4_DecodeLatin1 +# define PyUnicode_DecodeRawUnicodeEscape PyUnicodeUCS4_DecodeRawUnicodeEscape +# define PyUnicode_DecodeUTF32 PyUnicodeUCS4_DecodeUTF32 +# define PyUnicode_DecodeUTF32Stateful PyUnicodeUCS4_DecodeUTF32Stateful +# define PyUnicode_DecodeUTF16 PyUnicodeUCS4_DecodeUTF16 +# define PyUnicode_DecodeUTF16Stateful PyUnicodeUCS4_DecodeUTF16Stateful +# define PyUnicode_DecodeUTF8 PyUnicodeUCS4_DecodeUTF8 +# define PyUnicode_DecodeUTF8Stateful PyUnicodeUCS4_DecodeUTF8Stateful +# define PyUnicode_DecodeUnicodeEscape PyUnicodeUCS4_DecodeUnicodeEscape +# define PyUnicode_Encode PyUnicodeUCS4_Encode +# define PyUnicode_EncodeASCII PyUnicodeUCS4_EncodeASCII +# define PyUnicode_EncodeCharmap PyUnicodeUCS4_EncodeCharmap +# define PyUnicode_EncodeDecimal PyUnicodeUCS4_EncodeDecimal +# define PyUnicode_EncodeLatin1 PyUnicodeUCS4_EncodeLatin1 +# define PyUnicode_EncodeRawUnicodeEscape PyUnicodeUCS4_EncodeRawUnicodeEscape +# define PyUnicode_EncodeUTF32 PyUnicodeUCS4_EncodeUTF32 +# define PyUnicode_EncodeUTF16 PyUnicodeUCS4_EncodeUTF16 +# define PyUnicode_EncodeUTF8 PyUnicodeUCS4_EncodeUTF8 +# define PyUnicode_EncodeUnicodeEscape PyUnicodeUCS4_EncodeUnicodeEscape +# define PyUnicode_Find PyUnicodeUCS4_Find +# define PyUnicode_Format PyUnicodeUCS4_Format +# define PyUnicode_FromEncodedObject PyUnicodeUCS4_FromEncodedObject +# define PyUnicode_FromFormat PyUnicodeUCS4_FromFormat +# define PyUnicode_FromFormatV PyUnicodeUCS4_FromFormatV +# define PyUnicode_FromObject PyUnicodeUCS4_FromObject +# define PyUnicode_FromOrdinal PyUnicodeUCS4_FromOrdinal +# define PyUnicode_FromString PyUnicodeUCS4_FromString +# define PyUnicode_FromStringAndSize PyUnicodeUCS4_FromStringAndSize +# define PyUnicode_FromUnicode PyUnicodeUCS4_FromUnicode +# define PyUnicode_FromWideChar PyUnicodeUCS4_FromWideChar +# define PyUnicode_GetDefaultEncoding PyUnicodeUCS4_GetDefaultEncoding +# define PyUnicode_GetMax PyUnicodeUCS4_GetMax +# define PyUnicode_GetSize PyUnicodeUCS4_GetSize +# define PyUnicode_Join PyUnicodeUCS4_Join +# define PyUnicode_Partition PyUnicodeUCS4_Partition +# define PyUnicode_RPartition PyUnicodeUCS4_RPartition +# define PyUnicode_RSplit PyUnicodeUCS4_RSplit +# define PyUnicode_Replace PyUnicodeUCS4_Replace +# define PyUnicode_Resize PyUnicodeUCS4_Resize +# define PyUnicode_RichCompare PyUnicodeUCS4_RichCompare +# define PyUnicode_SetDefaultEncoding PyUnicodeUCS4_SetDefaultEncoding +# define PyUnicode_Split PyUnicodeUCS4_Split +# define PyUnicode_Splitlines PyUnicodeUCS4_Splitlines +# define PyUnicode_Tailmatch PyUnicodeUCS4_Tailmatch +# define PyUnicode_Translate PyUnicodeUCS4_Translate +# define PyUnicode_TranslateCharmap PyUnicodeUCS4_TranslateCharmap +# define _PyUnicode_AsDefaultEncodedString _PyUnicodeUCS4_AsDefaultEncodedString +# define _PyUnicode_Fini _PyUnicodeUCS4_Fini +# define _PyUnicode_Init _PyUnicodeUCS4_Init +# define _PyUnicode_IsAlpha _PyUnicodeUCS4_IsAlpha +# define _PyUnicode_IsDecimalDigit _PyUnicodeUCS4_IsDecimalDigit +# define _PyUnicode_IsDigit _PyUnicodeUCS4_IsDigit +# define _PyUnicode_IsLinebreak _PyUnicodeUCS4_IsLinebreak +# define _PyUnicode_IsLowercase _PyUnicodeUCS4_IsLowercase +# define _PyUnicode_IsNumeric _PyUnicodeUCS4_IsNumeric +# define _PyUnicode_IsTitlecase _PyUnicodeUCS4_IsTitlecase +# define _PyUnicode_IsUppercase _PyUnicodeUCS4_IsUppercase +# define _PyUnicode_IsWhitespace _PyUnicodeUCS4_IsWhitespace +# define _PyUnicode_ToDecimalDigit _PyUnicodeUCS4_ToDecimalDigit +# define _PyUnicode_ToDigit _PyUnicodeUCS4_ToDigit +# define _PyUnicode_ToLowercase _PyUnicodeUCS4_ToLowercase +# define _PyUnicode_ToNumeric _PyUnicodeUCS4_ToNumeric +# define _PyUnicode_ToTitlecase _PyUnicodeUCS4_ToTitlecase +# define _PyUnicode_ToUppercase _PyUnicodeUCS4_ToUppercase + + +#endif + +/* --- Internal Unicode Operations ---------------------------------------- */ + +/* If you want Python to use the compiler's wctype.h functions instead + of the ones supplied with Python, define WANT_WCTYPE_FUNCTIONS or + configure Python using --with-wctype-functions. This reduces the + interpreter's code size. */ + +#if defined(HAVE_USABLE_WCHAR_T) && defined(WANT_WCTYPE_FUNCTIONS) + +#include + +#define Py_UNICODE_ISSPACE(ch) iswspace(ch) + +#define Py_UNICODE_ISLOWER(ch) iswlower(ch) +#define Py_UNICODE_ISUPPER(ch) iswupper(ch) +#define Py_UNICODE_ISTITLE(ch) _PyUnicode_IsTitlecase(ch) +#define Py_UNICODE_ISLINEBREAK(ch) _PyUnicode_IsLinebreak(ch) + +#define Py_UNICODE_TOLOWER(ch) towlower(ch) +#define Py_UNICODE_TOUPPER(ch) towupper(ch) +#define Py_UNICODE_TOTITLE(ch) _PyUnicode_ToTitlecase(ch) + +#define Py_UNICODE_ISDECIMAL(ch) _PyUnicode_IsDecimalDigit(ch) +#define Py_UNICODE_ISDIGIT(ch) _PyUnicode_IsDigit(ch) +#define Py_UNICODE_ISNUMERIC(ch) _PyUnicode_IsNumeric(ch) + +#define Py_UNICODE_TODECIMAL(ch) _PyUnicode_ToDecimalDigit(ch) +#define Py_UNICODE_TODIGIT(ch) _PyUnicode_ToDigit(ch) +#define Py_UNICODE_TONUMERIC(ch) _PyUnicode_ToNumeric(ch) + +#define Py_UNICODE_ISALPHA(ch) iswalpha(ch) + +#else + +/* Since splitting on whitespace is an important use case, and + whitespace in most situations is solely ASCII whitespace, we + optimize for the common case by using a quick look-up table + _Py_ascii_whitespace (see below) with an inlined check. + + */ +#define Py_UNICODE_ISSPACE(ch) \ + ((ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch)) + +#define Py_UNICODE_ISLOWER(ch) _PyUnicode_IsLowercase(ch) +#define Py_UNICODE_ISUPPER(ch) _PyUnicode_IsUppercase(ch) +#define Py_UNICODE_ISTITLE(ch) _PyUnicode_IsTitlecase(ch) +#define Py_UNICODE_ISLINEBREAK(ch) _PyUnicode_IsLinebreak(ch) + +#define Py_UNICODE_TOLOWER(ch) _PyUnicode_ToLowercase(ch) +#define Py_UNICODE_TOUPPER(ch) _PyUnicode_ToUppercase(ch) +#define Py_UNICODE_TOTITLE(ch) _PyUnicode_ToTitlecase(ch) + +#define Py_UNICODE_ISDECIMAL(ch) _PyUnicode_IsDecimalDigit(ch) +#define Py_UNICODE_ISDIGIT(ch) _PyUnicode_IsDigit(ch) +#define Py_UNICODE_ISNUMERIC(ch) _PyUnicode_IsNumeric(ch) + +#define Py_UNICODE_TODECIMAL(ch) _PyUnicode_ToDecimalDigit(ch) +#define Py_UNICODE_TODIGIT(ch) _PyUnicode_ToDigit(ch) +#define Py_UNICODE_TONUMERIC(ch) _PyUnicode_ToNumeric(ch) + +#define Py_UNICODE_ISALPHA(ch) _PyUnicode_IsAlpha(ch) + +#endif + +#define Py_UNICODE_ISALNUM(ch) \ + (Py_UNICODE_ISALPHA(ch) || \ + Py_UNICODE_ISDECIMAL(ch) || \ + Py_UNICODE_ISDIGIT(ch) || \ + Py_UNICODE_ISNUMERIC(ch)) + +#define Py_UNICODE_COPY(target, source, length) \ + Py_MEMCPY((target), (source), (length)*sizeof(Py_UNICODE)) + +#define Py_UNICODE_FILL(target, value, length) \ + do {Py_ssize_t i_; Py_UNICODE *t_ = (target); Py_UNICODE v_ = (value);\ + for (i_ = 0; i_ < (length); i_++) t_[i_] = v_;\ + } while (0) + +/* Check if substring matches at given offset. the offset must be + valid, and the substring must not be empty */ + +#define Py_UNICODE_MATCH(string, offset, substring) \ + ((*((string)->str + (offset)) == *((substring)->str)) && \ + ((*((string)->str + (offset) + (substring)->length-1) == *((substring)->str + (substring)->length-1))) && \ + !memcmp((string)->str + (offset), (substring)->str, (substring)->length*sizeof(Py_UNICODE))) + +#ifdef __cplusplus +extern "C" { +#endif + +/* --- Unicode Type ------------------------------------------------------- */ + +typedef struct { + PyObject_HEAD + Py_ssize_t length; /* Length of raw Unicode data in buffer */ + Py_UNICODE *str; /* Raw Unicode buffer */ + long hash; /* Hash value; -1 if not set */ + PyObject *defenc; /* (Default) Encoded version as Python + string, or NULL; this is used for + implementing the buffer protocol */ +} PyUnicodeObject; + +PyAPI_DATA(PyTypeObject) PyUnicode_Type; + +#define PyUnicode_Check(op) \ + PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS) +#define PyUnicode_CheckExact(op) (Py_TYPE(op) == &PyUnicode_Type) + +/* Fast access macros */ +#define PyUnicode_GET_SIZE(op) \ + (((PyUnicodeObject *)(op))->length) +#define PyUnicode_GET_DATA_SIZE(op) \ + (((PyUnicodeObject *)(op))->length * sizeof(Py_UNICODE)) +#define PyUnicode_AS_UNICODE(op) \ + (((PyUnicodeObject *)(op))->str) +#define PyUnicode_AS_DATA(op) \ + ((const char *)((PyUnicodeObject *)(op))->str) + +/* --- Constants ---------------------------------------------------------- */ + +/* This Unicode character will be used as replacement character during + decoding if the errors argument is set to "replace". Note: the + Unicode character U+FFFD is the official REPLACEMENT CHARACTER in + Unicode 3.0. */ + +#define Py_UNICODE_REPLACEMENT_CHARACTER ((Py_UNICODE) 0xFFFD) + +/* === Public API ========================================================= */ + +/* --- Plain Py_UNICODE --------------------------------------------------- */ + +/* Create a Unicode Object from the Py_UNICODE buffer u of the given + size. + + u may be NULL which causes the contents to be undefined. It is the + user's responsibility to fill in the needed data afterwards. Note + that modifying the Unicode object contents after construction is + only allowed if u was set to NULL. + + The buffer is copied into the new object. */ + +PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode( + const Py_UNICODE *u, /* Unicode buffer */ + Py_ssize_t size /* size of buffer */ + ); + +/* Similar to PyUnicode_FromUnicode(), but u points to Latin-1 encoded bytes */ +PyAPI_FUNC(PyObject*) PyUnicode_FromStringAndSize( + const char *u, /* char buffer */ + Py_ssize_t size /* size of buffer */ + ); + +/* Similar to PyUnicode_FromUnicode(), but u points to null-terminated + Latin-1 encoded bytes */ +PyAPI_FUNC(PyObject*) PyUnicode_FromString( + const char *u /* string */ + ); + +/* Return a read-only pointer to the Unicode object's internal + Py_UNICODE buffer. */ + +PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode( + PyObject *unicode /* Unicode object */ + ); + +/* Get the length of the Unicode object. */ + +PyAPI_FUNC(Py_ssize_t) PyUnicode_GetSize( + PyObject *unicode /* Unicode object */ + ); + +/* Get the maximum ordinal for a Unicode character. */ +PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void); + +/* Resize an already allocated Unicode object to the new size length. + + *unicode is modified to point to the new (resized) object and 0 + returned on success. + + This API may only be called by the function which also called the + Unicode constructor. The refcount on the object must be 1. Otherwise, + an error is returned. + + Error handling is implemented as follows: an exception is set, -1 + is returned and *unicode left untouched. + +*/ + +PyAPI_FUNC(int) PyUnicode_Resize( + PyObject **unicode, /* Pointer to the Unicode object */ + Py_ssize_t length /* New length */ + ); + +/* Coerce obj to a Unicode object and return a reference with + *incremented* refcount. + + Coercion is done in the following way: + + 1. String and other char buffer compatible objects are decoded + under the assumptions that they contain data using the current + default encoding. Decoding is done in "strict" mode. + + 2. All other objects (including Unicode objects) raise an + exception. + + The API returns NULL in case of an error. The caller is responsible + for decref'ing the returned objects. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_FromEncodedObject( + register PyObject *obj, /* Object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Coerce obj to a Unicode object and return a reference with + *incremented* refcount. + + Unicode objects are passed back as-is (subclasses are converted to + true Unicode objects), all other objects are delegated to + PyUnicode_FromEncodedObject(obj, NULL, "strict") which results in + using the default encoding as basis for decoding the object. + + The API returns NULL in case of an error. The caller is responsible + for decref'ing the returned objects. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_FromObject( + register PyObject *obj /* Object */ + ); + +PyAPI_FUNC(PyObject *) PyUnicode_FromFormatV(const char*, va_list); +PyAPI_FUNC(PyObject *) PyUnicode_FromFormat(const char*, ...); + +/* Format the object based on the format_spec, as defined in PEP 3101 + (Advanced String Formatting). */ +PyAPI_FUNC(PyObject *) _PyUnicode_FormatAdvanced(PyObject *obj, + Py_UNICODE *format_spec, + Py_ssize_t format_spec_len); + +/* --- wchar_t support for platforms which support it --------------------- */ + +#ifdef HAVE_WCHAR_H + +/* Create a Unicode Object from the whcar_t buffer w of the given + size. + + The buffer is copied into the new object. */ + +PyAPI_FUNC(PyObject*) PyUnicode_FromWideChar( + register const wchar_t *w, /* wchar_t buffer */ + Py_ssize_t size /* size of buffer */ + ); + +/* Copies the Unicode Object contents into the wchar_t buffer w. At + most size wchar_t characters are copied. + + Note that the resulting wchar_t string may or may not be + 0-terminated. It is the responsibility of the caller to make sure + that the wchar_t string is 0-terminated in case this is required by + the application. + + Returns the number of wchar_t characters copied (excluding a + possibly trailing 0-termination character) or -1 in case of an + error. */ + +PyAPI_FUNC(Py_ssize_t) PyUnicode_AsWideChar( + PyUnicodeObject *unicode, /* Unicode object */ + register wchar_t *w, /* wchar_t buffer */ + Py_ssize_t size /* size of buffer */ + ); + +#endif + +/* --- Unicode ordinals --------------------------------------------------- */ + +/* Create a Unicode Object from the given Unicode code point ordinal. + + The ordinal must be in range(0x10000) on narrow Python builds + (UCS2), and range(0x110000) on wide builds (UCS4). A ValueError is + raised in case it is not. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_FromOrdinal(int ordinal); + +/* --- Free-list management ----------------------------------------------- */ + +/* Clear the free list used by the Unicode implementation. + + This can be used to release memory used for objects on the free + list back to the Python memory allocator. + +*/ + +PyAPI_FUNC(int) PyUnicode_ClearFreeList(void); + +/* === Builtin Codecs ===================================================== + + Many of these APIs take two arguments encoding and errors. These + parameters encoding and errors have the same semantics as the ones + of the builtin unicode() API. + + Setting encoding to NULL causes the default encoding to be used. + + Error handling is set by errors which may also be set to NULL + meaning to use the default handling defined for the codec. Default + error handling for all builtin codecs is "strict" (ValueErrors are + raised). + + The codecs all use a similar interface. Only deviation from the + generic ones are documented. + +*/ + +/* --- Manage the default encoding ---------------------------------------- */ + +/* Return a Python string holding the default encoded value of the + Unicode object. + + The resulting string is cached in the Unicode object for subsequent + usage by this function. The cached version is needed to implement + the character buffer interface and will live (at least) as long as + the Unicode object itself. + + The refcount of the string is *not* incremented. + + *** Exported for internal use by the interpreter only !!! *** + +*/ + +PyAPI_FUNC(PyObject *) _PyUnicode_AsDefaultEncodedString( + PyObject *, const char *); + +/* Returns the currently active default encoding. + + The default encoding is currently implemented as run-time settable + process global. This may change in future versions of the + interpreter to become a parameter which is managed on a per-thread + basis. + + */ + +PyAPI_FUNC(const char*) PyUnicode_GetDefaultEncoding(void); + +/* Sets the currently active default encoding. + + Returns 0 on success, -1 in case of an error. + + */ + +PyAPI_FUNC(int) PyUnicode_SetDefaultEncoding( + const char *encoding /* Encoding name in standard form */ + ); + +/* --- Generic Codecs ----------------------------------------------------- */ + +/* Create a Unicode object by decoding the encoded string s of the + given size. */ + +PyAPI_FUNC(PyObject*) PyUnicode_Decode( + const char *s, /* encoded string */ + Py_ssize_t size, /* size of buffer */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Encodes a Py_UNICODE buffer of the given size and returns a + Python string object. */ + +PyAPI_FUNC(PyObject*) PyUnicode_Encode( + const Py_UNICODE *s, /* Unicode char buffer */ + Py_ssize_t size, /* number of Py_UNICODE chars to encode */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Encodes a Unicode object and returns the result as Python + object. */ + +PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedObject( + PyObject *unicode, /* Unicode object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +/* Encodes a Unicode object and returns the result as Python string + object. */ + +PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedString( + PyObject *unicode, /* Unicode object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_BuildEncodingMap( + PyObject* string /* 256 character map */ + ); + + +/* --- UTF-7 Codecs ------------------------------------------------------- */ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7( + const char *string, /* UTF-7 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7Stateful( + const char *string, /* UTF-7 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + Py_ssize_t *consumed /* bytes consumed */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF7( + const Py_UNICODE *data, /* Unicode char buffer */ + Py_ssize_t length, /* number of Py_UNICODE chars to encode */ + int base64SetO, /* Encode RFC2152 Set O characters in base64 */ + int base64WhiteSpace, /* Encode whitespace (sp, ht, nl, cr) in base64 */ + const char *errors /* error handling */ + ); + +/* --- UTF-8 Codecs ------------------------------------------------------- */ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8( + const char *string, /* UTF-8 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8Stateful( + const char *string, /* UTF-8 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + Py_ssize_t *consumed /* bytes consumed */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_AsUTF8String( + PyObject *unicode /* Unicode object */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8( + const Py_UNICODE *data, /* Unicode char buffer */ + Py_ssize_t length, /* number of Py_UNICODE chars to encode */ + const char *errors /* error handling */ + ); + +/* --- UTF-32 Codecs ------------------------------------------------------ */ + +/* Decodes length bytes from a UTF-32 encoded buffer string and returns + the corresponding Unicode object. + + errors (if non-NULL) defines the error handling. It defaults + to "strict". + + If byteorder is non-NULL, the decoder starts decoding using the + given byte order: + + *byteorder == -1: little endian + *byteorder == 0: native order + *byteorder == 1: big endian + + In native mode, the first four bytes of the stream are checked for a + BOM mark. If found, the BOM mark is analysed, the byte order + adjusted and the BOM skipped. In the other modes, no BOM mark + interpretation is done. After completion, *byteorder is set to the + current byte order at the end of input data. + + If byteorder is NULL, the codec starts in native order mode. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32( + const char *string, /* UTF-32 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + int *byteorder /* pointer to byteorder to use + 0=native;-1=LE,1=BE; updated on + exit */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32Stateful( + const char *string, /* UTF-32 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + int *byteorder, /* pointer to byteorder to use + 0=native;-1=LE,1=BE; updated on + exit */ + Py_ssize_t *consumed /* bytes consumed */ + ); + +/* Returns a Python string using the UTF-32 encoding in native byte + order. The string always starts with a BOM mark. */ + +PyAPI_FUNC(PyObject*) PyUnicode_AsUTF32String( + PyObject *unicode /* Unicode object */ + ); + +/* Returns a Python string object holding the UTF-32 encoded value of + the Unicode data. + + If byteorder is not 0, output is written according to the following + byte order: + + byteorder == -1: little endian + byteorder == 0: native byte order (writes a BOM mark) + byteorder == 1: big endian + + If byteorder is 0, the output string will always start with the + Unicode BOM mark (U+FEFF). In the other two modes, no BOM mark is + prepended. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF32( + const Py_UNICODE *data, /* Unicode char buffer */ + Py_ssize_t length, /* number of Py_UNICODE chars to encode */ + const char *errors, /* error handling */ + int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ + ); + +/* --- UTF-16 Codecs ------------------------------------------------------ */ + +/* Decodes length bytes from a UTF-16 encoded buffer string and returns + the corresponding Unicode object. + + errors (if non-NULL) defines the error handling. It defaults + to "strict". + + If byteorder is non-NULL, the decoder starts decoding using the + given byte order: + + *byteorder == -1: little endian + *byteorder == 0: native order + *byteorder == 1: big endian + + In native mode, the first two bytes of the stream are checked for a + BOM mark. If found, the BOM mark is analysed, the byte order + adjusted and the BOM skipped. In the other modes, no BOM mark + interpretation is done. After completion, *byteorder is set to the + current byte order at the end of input data. + + If byteorder is NULL, the codec starts in native order mode. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16( + const char *string, /* UTF-16 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + int *byteorder /* pointer to byteorder to use + 0=native;-1=LE,1=BE; updated on + exit */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16Stateful( + const char *string, /* UTF-16 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + int *byteorder, /* pointer to byteorder to use + 0=native;-1=LE,1=BE; updated on + exit */ + Py_ssize_t *consumed /* bytes consumed */ + ); + +/* Returns a Python string using the UTF-16 encoding in native byte + order. The string always starts with a BOM mark. */ + +PyAPI_FUNC(PyObject*) PyUnicode_AsUTF16String( + PyObject *unicode /* Unicode object */ + ); + +/* Returns a Python string object holding the UTF-16 encoded value of + the Unicode data. + + If byteorder is not 0, output is written according to the following + byte order: + + byteorder == -1: little endian + byteorder == 0: native byte order (writes a BOM mark) + byteorder == 1: big endian + + If byteorder is 0, the output string will always start with the + Unicode BOM mark (U+FEFF). In the other two modes, no BOM mark is + prepended. + + Note that Py_UNICODE data is being interpreted as UTF-16 reduced to + UCS-2. This trick makes it possible to add full UTF-16 capabilities + at a later point without compromising the APIs. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF16( + const Py_UNICODE *data, /* Unicode char buffer */ + Py_ssize_t length, /* number of Py_UNICODE chars to encode */ + const char *errors, /* error handling */ + int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ + ); + +/* --- Unicode-Escape Codecs ---------------------------------------------- */ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeUnicodeEscape( + const char *string, /* Unicode-Escape encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_AsUnicodeEscapeString( + PyObject *unicode /* Unicode object */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_EncodeUnicodeEscape( + const Py_UNICODE *data, /* Unicode char buffer */ + Py_ssize_t length /* Number of Py_UNICODE chars to encode */ + ); + +/* --- Raw-Unicode-Escape Codecs ------------------------------------------ */ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeRawUnicodeEscape( + const char *string, /* Raw-Unicode-Escape encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_AsRawUnicodeEscapeString( + PyObject *unicode /* Unicode object */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_EncodeRawUnicodeEscape( + const Py_UNICODE *data, /* Unicode char buffer */ + Py_ssize_t length /* Number of Py_UNICODE chars to encode */ + ); + +/* --- Unicode Internal Codec --------------------------------------------- + + Only for internal use in _codecsmodule.c */ + +PyObject *_PyUnicode_DecodeUnicodeInternal( + const char *string, + Py_ssize_t length, + const char *errors + ); + +/* --- Latin-1 Codecs ----------------------------------------------------- + + Note: Latin-1 corresponds to the first 256 Unicode ordinals. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeLatin1( + const char *string, /* Latin-1 encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_AsLatin1String( + PyObject *unicode /* Unicode object */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_EncodeLatin1( + const Py_UNICODE *data, /* Unicode char buffer */ + Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ + const char *errors /* error handling */ + ); + +/* --- ASCII Codecs ------------------------------------------------------- + + Only 7-bit ASCII data is excepted. All other codes generate errors. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeASCII( + const char *string, /* ASCII encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_AsASCIIString( + PyObject *unicode /* Unicode object */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_EncodeASCII( + const Py_UNICODE *data, /* Unicode char buffer */ + Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ + const char *errors /* error handling */ + ); + +/* --- Character Map Codecs ----------------------------------------------- + + This codec uses mappings to encode and decode characters. + + Decoding mappings must map single string characters to single + Unicode characters, integers (which are then interpreted as Unicode + ordinals) or None (meaning "undefined mapping" and causing an + error). + + Encoding mappings must map single Unicode characters to single + string characters, integers (which are then interpreted as Latin-1 + ordinals) or None (meaning "undefined mapping" and causing an + error). + + If a character lookup fails with a LookupError, the character is + copied as-is meaning that its ordinal value will be interpreted as + Unicode or Latin-1 ordinal resp. Because of this mappings only need + to contain those mappings which map characters to different code + points. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeCharmap( + const char *string, /* Encoded string */ + Py_ssize_t length, /* size of string */ + PyObject *mapping, /* character mapping + (char ordinal -> unicode ordinal) */ + const char *errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_AsCharmapString( + PyObject *unicode, /* Unicode object */ + PyObject *mapping /* character mapping + (unicode ordinal -> char ordinal) */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap( + const Py_UNICODE *data, /* Unicode char buffer */ + Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ + PyObject *mapping, /* character mapping + (unicode ordinal -> char ordinal) */ + const char *errors /* error handling */ + ); + +/* Translate a Py_UNICODE buffer of the given length by applying a + character mapping table to it and return the resulting Unicode + object. + + The mapping table must map Unicode ordinal integers to Unicode + ordinal integers or None (causing deletion of the character). + + Mapping tables may be dictionaries or sequences. Unmapped character + ordinals (ones which cause a LookupError) are left untouched and + are copied as-is. + +*/ + +PyAPI_FUNC(PyObject *) PyUnicode_TranslateCharmap( + const Py_UNICODE *data, /* Unicode char buffer */ + Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ + PyObject *table, /* Translate table */ + const char *errors /* error handling */ + ); + +#ifdef MS_WIN32 + +/* --- MBCS codecs for Windows -------------------------------------------- */ + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCS( + const char *string, /* MBCS encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors /* error handling */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCSStateful( + const char *string, /* MBCS encoded string */ + Py_ssize_t length, /* size of string */ + const char *errors, /* error handling */ + Py_ssize_t *consumed /* bytes consumed */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_AsMBCSString( + PyObject *unicode /* Unicode object */ + ); + +PyAPI_FUNC(PyObject*) PyUnicode_EncodeMBCS( + const Py_UNICODE *data, /* Unicode char buffer */ + Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ + const char *errors /* error handling */ + ); + +#endif /* MS_WIN32 */ + +/* --- Decimal Encoder ---------------------------------------------------- */ + +/* Takes a Unicode string holding a decimal value and writes it into + an output buffer using standard ASCII digit codes. + + The output buffer has to provide at least length+1 bytes of storage + area. The output string is 0-terminated. + + The encoder converts whitespace to ' ', decimal characters to their + corresponding ASCII digit and all other Latin-1 characters except + \0 as-is. Characters outside this range (Unicode ordinals 1-256) + are treated as errors. This includes embedded NULL bytes. + + Error handling is defined by the errors argument: + + NULL or "strict": raise a ValueError + "ignore": ignore the wrong characters (these are not copied to the + output buffer) + "replace": replaces illegal characters with '?' + + Returns 0 on success, -1 on failure. + +*/ + +PyAPI_FUNC(int) PyUnicode_EncodeDecimal( + Py_UNICODE *s, /* Unicode buffer */ + Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ + char *output, /* Output buffer; must have size >= length */ + const char *errors /* error handling */ + ); + +/* --- Methods & Slots ---------------------------------------------------- + + These are capable of handling Unicode objects and strings on input + (we refer to them as strings in the descriptions) and return + Unicode objects or integers as appropriate. */ + +/* Concat two strings giving a new Unicode string. */ + +PyAPI_FUNC(PyObject*) PyUnicode_Concat( + PyObject *left, /* Left string */ + PyObject *right /* Right string */ + ); + +/* Split a string giving a list of Unicode strings. + + If sep is NULL, splitting will be done at all whitespace + substrings. Otherwise, splits occur at the given separator. + + At most maxsplit splits will be done. If negative, no limit is set. + + Separators are not included in the resulting list. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_Split( + PyObject *s, /* String to split */ + PyObject *sep, /* String separator */ + Py_ssize_t maxsplit /* Maxsplit count */ + ); + +/* Dito, but split at line breaks. + + CRLF is considered to be one line break. Line breaks are not + included in the resulting list. */ + +PyAPI_FUNC(PyObject*) PyUnicode_Splitlines( + PyObject *s, /* String to split */ + int keepends /* If true, line end markers are included */ + ); + +/* Partition a string using a given separator. */ + +PyAPI_FUNC(PyObject*) PyUnicode_Partition( + PyObject *s, /* String to partition */ + PyObject *sep /* String separator */ + ); + +/* Partition a string using a given separator, searching from the end of the + string. */ + +PyAPI_FUNC(PyObject*) PyUnicode_RPartition( + PyObject *s, /* String to partition */ + PyObject *sep /* String separator */ + ); + +/* Split a string giving a list of Unicode strings. + + If sep is NULL, splitting will be done at all whitespace + substrings. Otherwise, splits occur at the given separator. + + At most maxsplit splits will be done. But unlike PyUnicode_Split + PyUnicode_RSplit splits from the end of the string. If negative, + no limit is set. + + Separators are not included in the resulting list. + +*/ + +PyAPI_FUNC(PyObject*) PyUnicode_RSplit( + PyObject *s, /* String to split */ + PyObject *sep, /* String separator */ + Py_ssize_t maxsplit /* Maxsplit count */ + ); + +/* Translate a string by applying a character mapping table to it and + return the resulting Unicode object. + + The mapping table must map Unicode ordinal integers to Unicode + ordinal integers or None (causing deletion of the character). + + Mapping tables may be dictionaries or sequences. Unmapped character + ordinals (ones which cause a LookupError) are left untouched and + are copied as-is. + +*/ + +PyAPI_FUNC(PyObject *) PyUnicode_Translate( + PyObject *str, /* String */ + PyObject *table, /* Translate table */ + const char *errors /* error handling */ + ); + +/* Join a sequence of strings using the given separator and return + the resulting Unicode string. */ + +PyAPI_FUNC(PyObject*) PyUnicode_Join( + PyObject *separator, /* Separator string */ + PyObject *seq /* Sequence object */ + ); + +/* Return 1 if substr matches str[start:end] at the given tail end, 0 + otherwise. */ + +PyAPI_FUNC(Py_ssize_t) PyUnicode_Tailmatch( + PyObject *str, /* String */ + PyObject *substr, /* Prefix or Suffix string */ + Py_ssize_t start, /* Start index */ + Py_ssize_t end, /* Stop index */ + int direction /* Tail end: -1 prefix, +1 suffix */ + ); + +/* Return the first position of substr in str[start:end] using the + given search direction or -1 if not found. -2 is returned in case + an error occurred and an exception is set. */ + +PyAPI_FUNC(Py_ssize_t) PyUnicode_Find( + PyObject *str, /* String */ + PyObject *substr, /* Substring to find */ + Py_ssize_t start, /* Start index */ + Py_ssize_t end, /* Stop index */ + int direction /* Find direction: +1 forward, -1 backward */ + ); + +/* Count the number of occurrences of substr in str[start:end]. */ + +PyAPI_FUNC(Py_ssize_t) PyUnicode_Count( + PyObject *str, /* String */ + PyObject *substr, /* Substring to count */ + Py_ssize_t start, /* Start index */ + Py_ssize_t end /* Stop index */ + ); + +/* Replace at most maxcount occurrences of substr in str with replstr + and return the resulting Unicode object. */ + +PyAPI_FUNC(PyObject *) PyUnicode_Replace( + PyObject *str, /* String */ + PyObject *substr, /* Substring to find */ + PyObject *replstr, /* Substring to replace */ + Py_ssize_t maxcount /* Max. number of replacements to apply; + -1 = all */ + ); + +/* Compare two strings and return -1, 0, 1 for less than, equal, + greater than resp. */ + +PyAPI_FUNC(int) PyUnicode_Compare( + PyObject *left, /* Left string */ + PyObject *right /* Right string */ + ); + +/* Rich compare two strings and return one of the following: + + - NULL in case an exception was raised + - Py_True or Py_False for successful comparisons + - Py_NotImplemented in case the type combination is unknown + + Note that Py_EQ and Py_NE comparisons can cause a UnicodeWarning in + case the conversion of the arguments to Unicode fails with a + UnicodeDecodeError. + + Possible values for op: + + Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE + +*/ + +PyAPI_FUNC(PyObject *) PyUnicode_RichCompare( + PyObject *left, /* Left string */ + PyObject *right, /* Right string */ + int op /* Operation: Py_EQ, Py_NE, Py_GT, etc. */ + ); + +/* Apply an argument tuple or dictionary to a format string and return + the resulting Unicode string. */ + +PyAPI_FUNC(PyObject *) PyUnicode_Format( + PyObject *format, /* Format string */ + PyObject *args /* Argument tuple or dictionary */ + ); + +/* Checks whether element is contained in container and return 1/0 + accordingly. + + element has to coerce to a one element Unicode string. -1 is + returned in case of an error. */ + +PyAPI_FUNC(int) PyUnicode_Contains( + PyObject *container, /* Container string */ + PyObject *element /* Element string */ + ); + +/* Externally visible for str.strip(unicode) */ +PyAPI_FUNC(PyObject *) _PyUnicode_XStrip( + PyUnicodeObject *self, + int striptype, + PyObject *sepobj + ); + +/* === Characters Type APIs =============================================== */ + +/* Helper array used by Py_UNICODE_ISSPACE(). */ + +PyAPI_DATA(const unsigned char) _Py_ascii_whitespace[]; + +/* These should not be used directly. Use the Py_UNICODE_IS* and + Py_UNICODE_TO* macros instead. + + These APIs are implemented in Objects/unicodectype.c. + +*/ + +PyAPI_FUNC(int) _PyUnicode_IsLowercase( + Py_UNICODE ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsUppercase( + Py_UNICODE ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsTitlecase( + Py_UNICODE ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsWhitespace( + const Py_UNICODE ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsLinebreak( + const Py_UNICODE ch /* Unicode character */ + ); + +PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToLowercase( + Py_UNICODE ch /* Unicode character */ + ); + +PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToUppercase( + Py_UNICODE ch /* Unicode character */ + ); + +PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToTitlecase( + Py_UNICODE ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_ToDecimalDigit( + Py_UNICODE ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_ToDigit( + Py_UNICODE ch /* Unicode character */ + ); + +PyAPI_FUNC(double) _PyUnicode_ToNumeric( + Py_UNICODE ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsDecimalDigit( + Py_UNICODE ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsDigit( + Py_UNICODE ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsNumeric( + Py_UNICODE ch /* Unicode character */ + ); + +PyAPI_FUNC(int) _PyUnicode_IsAlpha( + Py_UNICODE ch /* Unicode character */ + ); + +#ifdef __cplusplus +} +#endif +#endif /* Py_USING_UNICODE */ +#endif /* !Py_UNICODEOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/warnings.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/warnings.h new file mode 100644 index 0000000..0818d7a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/warnings.h @@ -0,0 +1,23 @@ +#ifndef Py_WARNINGS_H +#define Py_WARNINGS_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_FUNC(void) _PyWarnings_Init(void); + +PyAPI_FUNC(int) PyErr_WarnEx(PyObject *, const char *, Py_ssize_t); +PyAPI_FUNC(int) PyErr_WarnExplicit(PyObject *, const char *, const char *, int, + const char *, PyObject *); + +#define PyErr_WarnPy3k(msg, stacklevel) \ + (Py_Py3kWarningFlag ? PyErr_WarnEx(PyExc_DeprecationWarning, msg, stacklevel) : 0) + +/* DEPRECATED: Use PyErr_WarnEx() instead. */ +#define PyErr_Warn(category, msg) PyErr_WarnEx(category, msg, 1) + +#ifdef __cplusplus +} +#endif +#endif /* !Py_WARNINGS_H */ + diff --git a/dingux/opt/mipsel-linux-uclibc/include/python2.7/weakrefobject.h b/dingux/opt/mipsel-linux-uclibc/include/python2.7/weakrefobject.h new file mode 100644 index 0000000..e7c0eae --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/python2.7/weakrefobject.h @@ -0,0 +1,82 @@ +/* Weak references objects for Python. */ + +#ifndef Py_WEAKREFOBJECT_H +#define Py_WEAKREFOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + + +typedef struct _PyWeakReference PyWeakReference; + +/* PyWeakReference is the base struct for the Python ReferenceType, ProxyType, + * and CallableProxyType. + */ +struct _PyWeakReference { + PyObject_HEAD + + /* The object to which this is a weak reference, or Py_None if none. + * Note that this is a stealth reference: wr_object's refcount is + * not incremented to reflect this pointer. + */ + PyObject *wr_object; + + /* A callable to invoke when wr_object dies, or NULL if none. */ + PyObject *wr_callback; + + /* A cache for wr_object's hash code. As usual for hashes, this is -1 + * if the hash code isn't known yet. + */ + long hash; + + /* If wr_object is weakly referenced, wr_object has a doubly-linked NULL- + * terminated list of weak references to it. These are the list pointers. + * If wr_object goes away, wr_object is set to Py_None, and these pointers + * have no meaning then. + */ + PyWeakReference *wr_prev; + PyWeakReference *wr_next; +}; + +PyAPI_DATA(PyTypeObject) _PyWeakref_RefType; +PyAPI_DATA(PyTypeObject) _PyWeakref_ProxyType; +PyAPI_DATA(PyTypeObject) _PyWeakref_CallableProxyType; + +#define PyWeakref_CheckRef(op) PyObject_TypeCheck(op, &_PyWeakref_RefType) +#define PyWeakref_CheckRefExact(op) \ + (Py_TYPE(op) == &_PyWeakref_RefType) +#define PyWeakref_CheckProxy(op) \ + ((Py_TYPE(op) == &_PyWeakref_ProxyType) || \ + (Py_TYPE(op) == &_PyWeakref_CallableProxyType)) + +#define PyWeakref_Check(op) \ + (PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op)) + + +PyAPI_FUNC(PyObject *) PyWeakref_NewRef(PyObject *ob, + PyObject *callback); +PyAPI_FUNC(PyObject *) PyWeakref_NewProxy(PyObject *ob, + PyObject *callback); +PyAPI_FUNC(PyObject *) PyWeakref_GetObject(PyObject *ref); + +PyAPI_FUNC(Py_ssize_t) _PyWeakref_GetWeakrefCount(PyWeakReference *head); + +PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self); + +/* Explanation for the Py_REFCNT() check: when a weakref's target is part + of a long chain of deallocations which triggers the trashcan mechanism, + clearing the weakrefs can be delayed long after the target's refcount + has dropped to zero. In the meantime, code accessing the weakref will + be able to "see" the target object even though it is supposed to be + unreachable. See issue #16602. */ + +#define PyWeakref_GET_OBJECT(ref) \ + (Py_REFCNT(((PyWeakReference *)(ref))->wr_object) > 0 \ + ? ((PyWeakReference *)(ref))->wr_object \ + : Py_None) + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_WEAKREFOBJECT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/ss/ss.h b/dingux/opt/mipsel-linux-uclibc/include/ss/ss.h new file mode 100644 index 0000000..7333ffc --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ss/ss.h @@ -0,0 +1,96 @@ +/* + * Copyright 1987, 1988 by MIT Student Information Processing Board + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose is hereby granted, provided that + * the names of M.I.T. and the M.I.T. S.I.P.B. not be used in + * advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. M.I.T. and the + * M.I.T. S.I.P.B. make no representations about the suitability of + * this software for any purpose. It is provided "as is" without + * express or implied warranty. + * + * This quote is just too good to not pass on: + * + * "BTW, I would have rejected the name Story Server because its + * initials are SS, the name of the secret police in Nazi + * Germany, probably the most despised pair of letters in western + * culture." --- http://scriptingnewsarchive.userland.com/1999/12/13 + * + * Let no one say political correctness isn't dead.... + */ + +#ifndef _ss_h +#define _ss_h __FILE__ + +#include + +#define __SS_CONST const +#define __SS_PROTO (int, const char * const *, int, void *) + +#ifdef __GNUC__ +#define __SS_ATTR(x) __attribute__(x) +#else +#define __SS_ATTR(x) +#endif + + +typedef __SS_CONST struct _ss_request_entry { + __SS_CONST char * __SS_CONST *command_names; /* whatever */ + void (* __SS_CONST function) __SS_PROTO; /* foo */ + __SS_CONST char * __SS_CONST info_string; /* NULL */ + int flags; /* 0 */ +} ss_request_entry; + +typedef __SS_CONST struct _ss_request_table { + int version; + ss_request_entry *requests; +} ss_request_table; + +#define SS_RQT_TBL_V2 2 + +typedef struct _ss_rp_options { /* DEFAULT VALUES */ + int version; /* SS_RP_V1 */ + void (*unknown) __SS_PROTO; /* call for unknown command */ + int allow_suspend; + int catch_int; +} ss_rp_options; + +#define SS_RP_V1 1 + +#define SS_OPT_DONT_LIST 0x0001 +#define SS_OPT_DONT_SUMMARIZE 0x0002 + +void ss_help __SS_PROTO; +#if 0 +char *ss_current_request(); /* This is actually a macro */ +#endif + +char *ss_name(int sci_idx); +void ss_error (int, long, char const *, ...) + __SS_ATTR((format(printf, 3, 4))); +void ss_perror (int, long, char const *); + +int ss_create_invocation(const char *, const char *, void *, + ss_request_table *, int *); +void ss_delete_invocation(int); +int ss_listen(int); +int ss_execute_line(int, char *); +void ss_add_request_table(int, ss_request_table *, int, int *); +void ss_delete_request_table(int, ss_request_table *, int *); +void ss_abort_subsystem(int sci_idx, int code); +void ss_quit(int argc, const char * const *argv, int sci_idx, void *infop); +void ss_self_identify(int argc, const char * const *argv, int sci_idx, void *infop); +void ss_subsystem_name(int argc, const char * const *argv, + int sci_idx, void *infop); +void ss_subsystem_version(int argc, const char * const *argv, + int sci_idx, void *infop); +void ss_unimplemented(int argc, const char * const *argv, + int sci_idx, void *infop); +void ss_set_prompt(int sci_idx, char *new_prompt); +char *ss_get_prompt(int sci_idx); +void ss_get_readline(int sci_idx); +char *ss_safe_getenv(const char *arg); + +extern ss_request_table ss_std_requests; +#endif /* _ss_h */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/ss/ss_err.h b/dingux/opt/mipsel-linux-uclibc/include/ss/ss_err.h new file mode 100644 index 0000000..930776a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/ss/ss_err.h @@ -0,0 +1,30 @@ +/* + * ss_err.h: + * This file is automatically generated; please do not edit it. + */ + +#include + +#define SS_ET_SUBSYSTEM_ABORTED (748800L) +#define SS_ET_VERSION_MISMATCH (748801L) +#define SS_ET_NULL_INV (748802L) +#define SS_ET_NO_INFO_DIR (748803L) +#define SS_ET_COMMAND_NOT_FOUND (748804L) +#define SS_ET_LINE_ABORTED (748805L) +#define SS_ET_EOF (748806L) +#define SS_ET_PERMISSION_DENIED (748807L) +#define SS_ET_TABLE_NOT_FOUND (748808L) +#define SS_ET_NO_HELP_FILE (748809L) +#define SS_ET_ESCAPE_DISABLED (748810L) +#define SS_ET_UNIMPLEMENTED (748811L) +extern const struct error_table et_ss_error_table; +extern void initialize_ss_error_table(void); + +/* For compatibility with Heimdal */ +extern void initialize_ss_error_table_r(struct et_list **list); + +#define ERROR_TABLE_BASE_ss (748800L) + +/* for compatibility with older versions... */ +#define init_ss_err_tbl initialize_ss_error_table +#define ss_err_base ERROR_TABLE_BASE_ss diff --git a/dingux/opt/mipsel-linux-uclibc/include/sys/acl.h b/dingux/opt/mipsel-linux-uclibc/include/sys/acl.h new file mode 100644 index 0000000..6a4d2fc --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/sys/acl.h @@ -0,0 +1,128 @@ +/* + File: sys/acl.h + + (C) 1999 Andreas Gruenbacher, + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef __SYS_ACL_H +#define __SYS_ACL_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/*=== Data types ===*/ + +struct __acl_ext; +struct __acl_entry_ext; +struct __acl_permset_ext; + +typedef unsigned int acl_type_t; +typedef int acl_tag_t; +typedef unsigned int acl_perm_t; + +typedef struct __acl_ext *acl_t; +typedef struct __acl_entry_ext *acl_entry_t; +typedef struct __acl_permset_ext *acl_permset_t; + +/*=== Constants ===*/ + +/* 23.2.2 acl_perm_t values */ + +#define ACL_READ (0x04) +#define ACL_WRITE (0x02) +#define ACL_EXECUTE (0x01) + +/* 23.2.5 acl_tag_t values */ + +#define ACL_UNDEFINED_TAG (0x00) +#define ACL_USER_OBJ (0x01) +#define ACL_USER (0x02) +#define ACL_GROUP_OBJ (0x04) +#define ACL_GROUP (0x08) +#define ACL_MASK (0x10) +#define ACL_OTHER (0x20) + +/* 23.3.6 acl_type_t values */ + +#define ACL_TYPE_ACCESS (0x8000) +#define ACL_TYPE_DEFAULT (0x4000) + +/* 23.2.7 ACL qualifier constants */ + +#define ACL_UNDEFINED_ID ((id_t)-1) + +/* 23.2.8 ACL Entry Constants */ + +#define ACL_FIRST_ENTRY 0 +#define ACL_NEXT_ENTRY 1 + +/*=== ACL manipulation ===*/ + +extern acl_t acl_init(int count); +extern acl_t acl_dup(acl_t acl); +extern int acl_free(void *obj_p); +extern int acl_valid(acl_t acl); + +/*=== Entry manipulation ===*/ + +extern int +acl_copy_entry(acl_entry_t dest_d, acl_entry_t src_d); +extern int acl_create_entry(acl_t *acl_p, acl_entry_t *entry_p); +extern int acl_delete_entry(acl_t acl, acl_entry_t entry_d); +extern int acl_get_entry(acl_t acl, int entry_id, acl_entry_t *entry_p); + +/* Manipulate ACL entry permissions */ + +extern int acl_add_perm(acl_permset_t permset_d, acl_perm_t perm); +extern int acl_calc_mask(acl_t *acl_p); +extern int acl_clear_perms(acl_permset_t permset_d); +extern int acl_delete_perm(acl_permset_t permset_d, acl_perm_t perm); +extern int acl_get_permset(acl_entry_t entry_d, acl_permset_t *permset_p); +extern int acl_set_permset(acl_entry_t entry_d, acl_permset_t permset_d); + +/* Manipulate ACL entry tag type and qualifier */ + +extern void * acl_get_qualifier(acl_entry_t entry_d); +extern int acl_get_tag_type(acl_entry_t entry_d, acl_tag_t *tag_type_p); +extern int acl_set_qualifier(acl_entry_t entry_d, const void *tag_qualifier_p); +extern int acl_set_tag_type(acl_entry_t entry_d, acl_tag_t tag_type); + +/*=== Format translation ===*/ + +extern ssize_t acl_copy_ext(void *buf_p, acl_t acl, ssize_t size); +extern acl_t acl_copy_int(const void *buf_p); +extern acl_t acl_from_text(const char *buf_p); +extern ssize_t acl_size(acl_t acl); +extern char *acl_to_text(acl_t acl, ssize_t *len_p); + +/*=== Object manipulation ===*/ + +extern int acl_delete_def_file(const char *path_p); +extern acl_t acl_get_fd(int fd); +extern acl_t acl_get_file(const char *path_p, acl_type_t type); +extern int acl_set_fd(int fd, acl_t acl); +extern int acl_set_file(const char *path_p, acl_type_t type, acl_t acl); + +#ifdef __cplusplus +} +#endif + +#endif /* __SYS_ACL_H */ + diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/alphaindex.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/alphaindex.h new file mode 100644 index 0000000..1442f75 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/alphaindex.h @@ -0,0 +1,755 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2011-2014 International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +*/ + +#ifndef INDEXCHARS_H +#define INDEXCHARS_H + +#include "unicode/utypes.h" +#include "unicode/uobject.h" +#include "unicode/locid.h" +#include "unicode/unistr.h" + +#if !UCONFIG_NO_COLLATION + +/** + * \file + * \brief C++ API: Index Characters + */ + +U_CDECL_BEGIN + +/** + * Constants for Alphabetic Index Label Types. + * The form of these enum constants anticipates having a plain C API + * for Alphabetic Indexes that will also use them. + * @stable ICU 4.8 + */ +typedef enum UAlphabeticIndexLabelType { + /** + * Normal Label, typically the starting letter of the names + * in the bucket with this label. + * @stable ICU 4.8 + */ + U_ALPHAINDEX_NORMAL = 0, + + /** + * Undeflow Label. The bucket with this label contains names + * in scripts that sort before any of the bucket labels in this index. + * @stable ICU 4.8 + */ + U_ALPHAINDEX_UNDERFLOW = 1, + + /** + * Inflow Label. The bucket with this label contains names + * in scripts that sort between two of the bucket labels in this index. + * Inflow labels are created when an index contains normal labels for + * multiple scripts, and skips other scripts that sort between some of the + * included scripts. + * @stable ICU 4.8 + */ + U_ALPHAINDEX_INFLOW = 2, + + /** + * Overflow Label. Te bucket with this label contains names in scripts + * that sort after all of the bucket labels in this index. + * @stable ICU 4.8 + */ + U_ALPHAINDEX_OVERFLOW = 3 +} UAlphabeticIndexLabelType; + + +struct UHashtable; +U_CDECL_END + +U_NAMESPACE_BEGIN + +// Forward Declarations + +class BucketList; +class Collator; +class RuleBasedCollator; +class StringEnumeration; +class UnicodeSet; +class UVector; + +/** + * AlphabeticIndex supports the creation of a UI index appropriate for a given language. + * It can support either direct use, or use with a client that doesn't support localized collation. + * The following is an example of what an index might look like in a UI: + * + *
+ *  ... A B C D E F G H I J K L M N O P Q R S T U V W X Y Z  ...
+ *
+ *  A
+ *     Addison
+ *     Albertson
+ *     Azensky
+ *  B
+ *     Baker
+ *  ...
+ * 
+ * + * The class can generate a list of labels for use as a UI "index", that is, a list of + * clickable characters (or character sequences) that allow the user to see a segment + * (bucket) of a larger "target" list. That is, each label corresponds to a bucket in + * the target list, where everything in the bucket is greater than or equal to the character + * (according to the locale's collation). Strings can be added to the index; + * they will be in sorted order in the right bucket. + *

+ * The class also supports having buckets for strings before the first (underflow), + * after the last (overflow), and between scripts (inflow). For example, if the index + * is constructed with labels for Russian and English, Greek characters would fall + * into an inflow bucket between the other two scripts. + *

+ * The AlphabeticIndex class is not intended for public subclassing. + * + *

Note: If you expect to have a lot of ASCII or Latin characters + * as well as characters from the user's language, + * then it is a good idea to call addLabels(Locale::getEnglish(), status).

+ * + *

Direct Use

+ *

The following shows an example of building an index directly. + * The "show..." methods below are just to illustrate usage. + * + *

+ * // Create a simple index.  "Item" is assumed to be an application
+ * // defined type that the application's UI and other processing knows about,
+ * //  and that has a name.
+ *
+ * UErrorCode status = U_ZERO_ERROR;
+ * AlphabeticIndex index = new AlphabeticIndex(desiredLocale, status);
+ * index->addLabels(additionalLocale, status);
+ * for (Item *item in some source of Items ) {
+ *     index->addRecord(item->name(), item, status);
+ * }
+ * ...
+ * // Show index at top. We could skip or gray out empty buckets
+ *
+ * while (index->nextBucket(status)) {
+ *     if (showAll || index->getBucketRecordCount() != 0) {
+ *         showLabelAtTop(UI, index->getBucketLabel());
+ *     }
+ * }
+ *  ...
+ * // Show the buckets with their contents, skipping empty buckets
+ *
+ * index->resetBucketIterator(status);
+ * while (index->nextBucket(status)) {
+ *    if (index->getBucketRecordCount() != 0) {
+ *        showLabelInList(UI, index->getBucketLabel());
+ *        while (index->nextRecord(status)) {
+ *            showIndexedItem(UI, static_cast(index->getRecordData()))
+ * 
+ * + * The caller can build different UIs using this class. + * For example, an index character could be omitted or grayed-out + * if its bucket is empty. Small buckets could also be combined based on size, such as: + * + *
+ * ... A-F G-N O-Z ...
+ * 
+ * + *

Client Support

+ *

Callers can also use the AlphabeticIndex::ImmutableIndex, or the AlphabeticIndex itself, + * to support sorting on a client that doesn't support AlphabeticIndex functionality. + * + *

The ImmutableIndex is both immutable and thread-safe. + * The corresponding AlphabeticIndex methods are not thread-safe because + * they "lazily" build the index buckets. + *

    + *
  • ImmutableIndex.getBucket(index) provides random access to all + * buckets and their labels and label types. + *
  • The AlphabeticIndex bucket iterator or ImmutableIndex.getBucket(0..getBucketCount-1) + * can be used to get a list of the labels, + * such as "...", "A", "B",..., and send that list to the client. + *
  • When the client has a new name, it sends that name to the server. + * The server needs to call the following methods, + * and communicate the bucketIndex and collationKey back to the client. + * + *
    + * int32_t bucketIndex = index.getBucketIndex(name, status);
    + * const UnicodeString &label = immutableIndex.getBucket(bucketIndex)->getLabel();  // optional
    + * int32_t skLength = collator.getSortKey(name, sk, skCapacity);
    + * 
    + * + *
  • The client would put the name (and associated information) into its bucket for bucketIndex. The sort key sk is a + * sequence of bytes that can be compared with a binary compare, and produce the right localized result.
  • + *
+ * + * @stable ICU 4.8 + */ +class U_I18N_API AlphabeticIndex: public UObject { +public: + /** + * An index "bucket" with a label string and type. + * It is referenced by getBucketIndex(), + * and returned by ImmutableIndex.getBucket(). + * + * The Bucket class is not intended for public subclassing. + * @stable ICU 51 + */ + class U_I18N_API Bucket : public UObject { + public: + /** + * Destructor. + * @stable ICU 51 + */ + virtual ~Bucket(); + + /** + * Returns the label string. + * + * @return the label string for the bucket + * @stable ICU 51 + */ + const UnicodeString &getLabel() const { return label_; } + /** + * Returns whether this bucket is a normal, underflow, overflow, or inflow bucket. + * + * @return the bucket label type + * @stable ICU 51 + */ + UAlphabeticIndexLabelType getLabelType() const { return labelType_; } + + private: + friend class AlphabeticIndex; + friend class BucketList; + + UnicodeString label_; + UnicodeString lowerBoundary_; + UAlphabeticIndexLabelType labelType_; + Bucket *displayBucket_; + int32_t displayIndex_; + UVector *records_; // Records are owned by the inputList_ vector. + + Bucket(const UnicodeString &label, // Parameter strings are copied. + const UnicodeString &lowerBoundary, + UAlphabeticIndexLabelType type); + }; + + /** + * Immutable, thread-safe version of AlphabeticIndex. + * This class provides thread-safe methods for bucketing, + * and random access to buckets and their properties, + * but does not offer adding records to the index. + * + * The ImmutableIndex class is not intended for public subclassing. + * + * @stable ICU 51 + */ + class U_I18N_API ImmutableIndex : public UObject { + public: + /** + * Destructor. + * @stable ICU 51 + */ + virtual ~ImmutableIndex(); + + /** + * Returns the number of index buckets and labels, including underflow/inflow/overflow. + * + * @return the number of index buckets + * @stable ICU 51 + */ + int32_t getBucketCount() const; + + /** + * Finds the index bucket for the given name and returns the number of that bucket. + * Use getBucket() to get the bucket's properties. + * + * @param name the string to be sorted into an index bucket + * @return the bucket number for the name + * @stable ICU 51 + */ + int32_t getBucketIndex(const UnicodeString &name, UErrorCode &errorCode) const; + + /** + * Returns the index-th bucket. Returns NULL if the index is out of range. + * + * @param index bucket number + * @return the index-th bucket + * @stable ICU 51 + */ + const Bucket *getBucket(int32_t index) const; + + private: + friend class AlphabeticIndex; + + ImmutableIndex(BucketList *bucketList, Collator *collatorPrimaryOnly) + : buckets_(bucketList), collatorPrimaryOnly_(collatorPrimaryOnly) {} + + BucketList *buckets_; + Collator *collatorPrimaryOnly_; + }; + + /** + * Construct an AlphabeticIndex object for the specified locale. If the locale's + * data does not include index characters, a set of them will be + * synthesized based on the locale's exemplar characters. The locale + * determines the sorting order for both the index characters and the + * user item names appearing under each Index character. + * + * @param locale the desired locale. + * @param status Error code, will be set with the reason if the construction + * of the AlphabeticIndex object fails. + * @stable ICU 4.8 + */ + AlphabeticIndex(const Locale &locale, UErrorCode &status); + + /** + * Construct an AlphabeticIndex that uses a specific collator. + * + * The index will be created with no labels; the addLabels() function must be called + * after creation to add the desired labels to the index. + * + * The index adopts the collator, and is responsible for deleting it. + * The caller should make no further use of the collator after creating the index. + * + * @param collator The collator to use to order the contents of this index. + * @param status Error code, will be set with the reason if the + * operation fails. + * @stable ICU 51 + */ + AlphabeticIndex(RuleBasedCollator *collator, UErrorCode &status); + + /** + * Add Labels to this Index. The labels are additions to those + * that are already in the index; they do not replace the existing + * ones. + * @param additions The additional characters to add to the index, such as A-Z. + * @param status Error code, will be set with the reason if the + * operation fails. + * @return this, for chaining + * @stable ICU 4.8 + */ + virtual AlphabeticIndex &addLabels(const UnicodeSet &additions, UErrorCode &status); + + /** + * Add the index characters from a Locale to the index. The labels + * are added to those that are already in the index; they do not replace the + * existing index characters. The collation order for this index is not + * changed; it remains that of the locale that was originally specified + * when creating this Index. + * + * @param locale The locale whose index characters are to be added. + * @param status Error code, will be set with the reason if the + * operation fails. + * @return this, for chaining + * @stable ICU 4.8 + */ + virtual AlphabeticIndex &addLabels(const Locale &locale, UErrorCode &status); + + /** + * Destructor + * @stable ICU 4.8 + */ + virtual ~AlphabeticIndex(); + + /** + * Builds an immutable, thread-safe version of this instance, without data records. + * + * @return an immutable index instance + * @stable ICU 51 + */ + ImmutableIndex *buildImmutableIndex(UErrorCode &errorCode); + + /** + * Get the Collator that establishes the ordering of the items in this index. + * Ownership of the collator remains with the AlphabeticIndex instance. + * + * The returned collator is a reference to the internal collator used by this + * index. It may be safely used to compare the names of items or to get + * sort keys for names. However if any settings need to be changed, + * or other non-const methods called, a cloned copy must be made first. + * + * @return The collator + * @stable ICU 4.8 + */ + virtual const RuleBasedCollator &getCollator() const; + + + /** + * Get the default label used for abbreviated buckets between other index characters. + * For example, consider the labels when Latin and Greek are used: + * X Y Z ... Α Β Γ. + * + * @return inflow label + * @stable ICU 4.8 + */ + virtual const UnicodeString &getInflowLabel() const; + + /** + * Set the default label used for abbreviated buckets between other index characters. + * An inflow label will be automatically inserted if two otherwise-adjacent label characters + * are from different scripts, e.g. Latin and Cyrillic, and a third script, e.g. Greek, + * sorts between the two. The default inflow character is an ellipsis (...) + * + * @param inflowLabel the new Inflow label. + * @param status Error code, will be set with the reason if the operation fails. + * @return this + * @stable ICU 4.8 + */ + virtual AlphabeticIndex &setInflowLabel(const UnicodeString &inflowLabel, UErrorCode &status); + + + /** + * Get the special label used for items that sort after the last normal label, + * and that would not otherwise have an appropriate label. + * + * @return the overflow label + * @stable ICU 4.8 + */ + virtual const UnicodeString &getOverflowLabel() const; + + + /** + * Set the label used for items that sort after the last normal label, + * and that would not otherwise have an appropriate label. + * + * @param overflowLabel the new overflow label. + * @param status Error code, will be set with the reason if the operation fails. + * @return this + * @stable ICU 4.8 + */ + virtual AlphabeticIndex &setOverflowLabel(const UnicodeString &overflowLabel, UErrorCode &status); + + /** + * Get the special label used for items that sort before the first normal label, + * and that would not otherwise have an appropriate label. + * + * @return underflow label + * @stable ICU 4.8 + */ + virtual const UnicodeString &getUnderflowLabel() const; + + /** + * Set the label used for items that sort before the first normal label, + * and that would not otherwise have an appropriate label. + * + * @param underflowLabel the new underflow label. + * @param status Error code, will be set with the reason if the operation fails. + * @return this + * @stable ICU 4.8 + */ + virtual AlphabeticIndex &setUnderflowLabel(const UnicodeString &underflowLabel, UErrorCode &status); + + + /** + * Get the limit on the number of labels permitted in the index. + * The number does not include over, under and inflow labels. + * + * @return maxLabelCount maximum number of labels. + * @stable ICU 4.8 + */ + virtual int32_t getMaxLabelCount() const; + + /** + * Set a limit on the number of labels permitted in the index. + * The number does not include over, under and inflow labels. + * Currently, if the number is exceeded, then every + * nth item is removed to bring the count down. + * A more sophisticated mechanism may be available in the future. + * + * @param maxLabelCount the maximum number of labels. + * @param status error code + * @return This, for chaining + * @stable ICU 4.8 + */ + virtual AlphabeticIndex &setMaxLabelCount(int32_t maxLabelCount, UErrorCode &status); + + + /** + * Add a record to the index. Each record will be associated with an index Bucket + * based on the record's name. The list of records for each bucket will be sorted + * based on the collation ordering of the names in the index's locale. + * Records with duplicate names are permitted; they will be kept in the order + * that they were added. + * + * @param name The display name for the Record. The Record will be placed in + * a bucket based on this name. + * @param data An optional pointer to user data associated with this + * item. When iterating the contents of a bucket, both the + * data pointer the name will be available for each Record. + * @param status Error code, will be set with the reason if the operation fails. + * @return This, for chaining. + * @stable ICU 4.8 + */ + virtual AlphabeticIndex &addRecord(const UnicodeString &name, const void *data, UErrorCode &status); + + /** + * Remove all Records from the Index. The set of Buckets, which define the headings under + * which records are classified, is not altered. + * + * @param status Error code, will be set with the reason if the operation fails. + * @return This, for chaining. + * @stable ICU 4.8 + */ + virtual AlphabeticIndex &clearRecords(UErrorCode &status); + + + /** Get the number of labels in this index. + * Note: may trigger lazy index construction. + * + * @param status Error code, will be set with the reason if the operation fails. + * @return The number of labels in this index, including any under, over or + * in-flow labels. + * @stable ICU 4.8 + */ + virtual int32_t getBucketCount(UErrorCode &status); + + + /** Get the total number of Records in this index, that is, the number + * of pairs added. + * + * @param status Error code, will be set with the reason if the operation fails. + * @return The number of records in this index, that is, the total number + * of (name, data) items added with addRecord(). + * @stable ICU 4.8 + */ + virtual int32_t getRecordCount(UErrorCode &status); + + + + /** + * Given the name of a record, return the zero-based index of the Bucket + * in which the item should appear. The name need not be in the index. + * A Record will not be added to the index by this function. + * Bucket numbers are zero-based, in Bucket iteration order. + * + * @param itemName The name whose bucket position in the index is to be determined. + * @param status Error code, will be set with the reason if the operation fails. + * @return The bucket number for this name. + * @stable ICU 4.8 + * + */ + virtual int32_t getBucketIndex(const UnicodeString &itemName, UErrorCode &status); + + + /** + * Get the zero based index of the current Bucket from an iteration + * over the Buckets of this index. Return -1 if no iteration is in process. + * @return the index of the current Bucket + * @stable ICU 4.8 + */ + virtual int32_t getBucketIndex() const; + + + /** + * Advance the iteration over the Buckets of this index. Return FALSE if + * there are no more Buckets. + * + * @param status Error code, will be set with the reason if the operation fails. + * U_ENUM_OUT_OF_SYNC_ERROR will be reported if the index is modified while + * an enumeration of its contents are in process. + * + * @return TRUE if success, FALSE if at end of iteration + * @stable ICU 4.8 + */ + virtual UBool nextBucket(UErrorCode &status); + + /** + * Return the name of the Label of the current bucket from an iteration over the buckets. + * If the iteration is before the first Bucket (nextBucket() has not been called), + * or after the last, return an empty string. + * + * @return the bucket label. + * @stable ICU 4.8 + */ + virtual const UnicodeString &getBucketLabel() const; + + /** + * Return the type of the label for the current Bucket (selected by the + * iteration over Buckets.) + * + * @return the label type. + * @stable ICU 4.8 + */ + virtual UAlphabeticIndexLabelType getBucketLabelType() const; + + /** + * Get the number of Records in the current Bucket. + * If the current bucket iteration position is before the first label or after the + * last, return 0. + * + * @return the number of Records. + * @stable ICU 4.8 + */ + virtual int32_t getBucketRecordCount() const; + + + /** + * Reset the Bucket iteration for this index. The next call to nextBucket() + * will restart the iteration at the first label. + * + * @param status Error code, will be set with the reason if the operation fails. + * @return this, for chaining. + * @stable ICU 4.8 + */ + virtual AlphabeticIndex &resetBucketIterator(UErrorCode &status); + + /** + * Advance to the next record in the current Bucket. + * When nextBucket() is called, Record iteration is reset to just before the + * first Record in the new Bucket. + * + * @param status Error code, will be set with the reason if the operation fails. + * U_ENUM_OUT_OF_SYNC_ERROR will be reported if the index is modified while + * an enumeration of its contents are in process. + * @return TRUE if successful, FALSE when the iteration advances past the last item. + * @stable ICU 4.8 + */ + virtual UBool nextRecord(UErrorCode &status); + + /** + * Get the name of the current Record. + * Return an empty string if the Record iteration position is before first + * or after the last. + * + * @return The name of the current index item. + * @stable ICU 4.8 + */ + virtual const UnicodeString &getRecordName() const; + + + /** + * Return the data pointer of the Record currently being iterated over. + * Return NULL if the current iteration position before the first item in this Bucket, + * or after the last. + * + * @return The current Record's data pointer. + * @stable ICU 4.8 + */ + virtual const void *getRecordData() const; + + + /** + * Reset the Record iterator position to before the first Record in the current Bucket. + * + * @return This, for chaining. + * @stable ICU 4.8 + */ + virtual AlphabeticIndex &resetRecordIterator(); + +private: + /** + * No Copy constructor. + * @internal + */ + AlphabeticIndex(const AlphabeticIndex &other); + + /** + * No assignment. + */ + AlphabeticIndex &operator =(const AlphabeticIndex & /*other*/) { return *this;}; + + /** + * No Equality operators. + * @internal + */ + virtual UBool operator==(const AlphabeticIndex& other) const; + + /** + * Inequality operator. + * @internal + */ + virtual UBool operator!=(const AlphabeticIndex& other) const; + + // Common initialization, for use from all constructors. + void init(const Locale *locale, UErrorCode &status); + + /** + * This method is called to get the index exemplars. Normally these come from the locale directly, + * but if they aren't available, we have to synthesize them. + */ + void addIndexExemplars(const Locale &locale, UErrorCode &status); + /** + * Add Chinese index characters from the tailoring. + */ + UBool addChineseIndexCharacters(UErrorCode &errorCode); + + UVector *firstStringsInScript(UErrorCode &status); + + static UnicodeString separated(const UnicodeString &item); + + /** + * Determine the best labels to use. + * This is based on the exemplars, but we also process to make sure that they are unique, + * and sort differently, and that the overall list is small enough. + */ + void initLabels(UVector &indexCharacters, UErrorCode &errorCode) const; + BucketList *createBucketList(UErrorCode &errorCode) const; + void initBuckets(UErrorCode &errorCode); + void clearBuckets(); + void internalResetBucketIterator(); + +public: + + // The Record is declared public only to allow access from + // implementation code written in plain C. + // It is not intended for public use. + +#ifndef U_HIDE_INTERNAL_API + /** + * A (name, data) pair, to be sorted by name into one of the index buckets. + * The user data is not used by the index implementation. + * @internal + */ + struct Record: public UMemory { + const UnicodeString name_; + const void *data_; + Record(const UnicodeString &name, const void *data); + ~Record(); + }; +#endif /* U_HIDE_INTERNAL_API */ + +private: + + /** + * Holds all user records before they are distributed into buckets. + * Type of contents is (Record *) + * @internal + */ + UVector *inputList_; + + int32_t labelsIterIndex_; // Index of next item to return. + int32_t itemsIterIndex_; + Bucket *currentBucket_; // While an iteration of the index in underway, + // point to the bucket for the current label. + // NULL when no iteration underway. + + int32_t maxLabelCount_; // Limit on # of labels permitted in the index. + + UnicodeSet *initialLabels_; // Initial (unprocessed) set of Labels. Union + // of those explicitly set by the user plus + // those from locales. Raw values, before + // crunching into bucket labels. + + UVector *firstCharsInScripts_; // The first character from each script, + // in collation order. + + RuleBasedCollator *collator_; + RuleBasedCollator *collatorPrimaryOnly_; + + // Lazy evaluated: null means that we have not built yet. + BucketList *buckets_; + + UnicodeString inflowLabel_; + UnicodeString overflowLabel_; + UnicodeString underflowLabel_; + UnicodeString overflowComparisonString_; + + UnicodeString emptyString_; +}; + +U_NAMESPACE_END + +#endif // !UCONFIG_NO_COLLATION +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/appendable.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/appendable.h new file mode 100644 index 0000000..8512c2f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/appendable.h @@ -0,0 +1,234 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2011-2012, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* file name: appendable.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2010dec07 +* created by: Markus W. Scherer +*/ + +#ifndef __APPENDABLE_H__ +#define __APPENDABLE_H__ + +/** + * \file + * \brief C++ API: Appendable class: Sink for Unicode code points and 16-bit code units (char16_ts). + */ + +#include "unicode/utypes.h" +#include "unicode/uobject.h" + +U_NAMESPACE_BEGIN + +class UnicodeString; + +/** + * Base class for objects to which Unicode characters and strings can be appended. + * Combines elements of Java Appendable and ICU4C ByteSink. + * + * This class can be used in APIs where it does not matter whether the actual destination is + * a UnicodeString, a char16_t[] array, a UnicodeSet, or any other object + * that receives and processes characters and/or strings. + * + * Implementation classes must implement at least appendCodeUnit(char16_t). + * The base class provides default implementations for the other methods. + * + * The methods do not take UErrorCode parameters. + * If an error occurs (e.g., out-of-memory), + * in addition to returning FALSE from failing operations, + * the implementation must prevent unexpected behavior (e.g., crashes) + * from further calls and should make the error condition available separately + * (e.g., store a UErrorCode, make/keep a UnicodeString bogus). + * @stable ICU 4.8 + */ +class U_COMMON_API Appendable : public UObject { +public: + /** + * Destructor. + * @stable ICU 4.8 + */ + ~Appendable(); + + /** + * Appends a 16-bit code unit. + * @param c code unit + * @return TRUE if the operation succeeded + * @stable ICU 4.8 + */ + virtual UBool appendCodeUnit(char16_t c) = 0; + + /** + * Appends a code point. + * The default implementation calls appendCodeUnit(char16_t) once or twice. + * @param c code point 0..0x10ffff + * @return TRUE if the operation succeeded + * @stable ICU 4.8 + */ + virtual UBool appendCodePoint(UChar32 c); + + /** + * Appends a string. + * The default implementation calls appendCodeUnit(char16_t) for each code unit. + * @param s string, must not be NULL if length!=0 + * @param length string length, or -1 if NUL-terminated + * @return TRUE if the operation succeeded + * @stable ICU 4.8 + */ + virtual UBool appendString(const char16_t *s, int32_t length); + + /** + * Tells the object that the caller is going to append roughly + * appendCapacity char16_ts. A subclass might use this to pre-allocate + * a larger buffer if necessary. + * The default implementation does nothing. (It always returns TRUE.) + * @param appendCapacity estimated number of char16_ts that will be appended + * @return TRUE if the operation succeeded + * @stable ICU 4.8 + */ + virtual UBool reserveAppendCapacity(int32_t appendCapacity); + + /** + * Returns a writable buffer for appending and writes the buffer's capacity to + * *resultCapacity. Guarantees *resultCapacity>=minCapacity. + * May return a pointer to the caller-owned scratch buffer which must have + * scratchCapacity>=minCapacity. + * The returned buffer is only valid until the next operation + * on this Appendable. + * + * After writing at most *resultCapacity char16_ts, call appendString() with the + * pointer returned from this function and the number of char16_ts written. + * Many appendString() implementations will avoid copying char16_ts if this function + * returned an internal buffer. + * + * Partial usage example: + * \code + * int32_t capacity; + * char16_t* buffer = app.getAppendBuffer(..., &capacity); + * ... Write n char16_ts into buffer, with n <= capacity. + * app.appendString(buffer, n); + * \endcode + * In many implementations, that call to append will avoid copying char16_ts. + * + * If the Appendable allocates or reallocates an internal buffer, it should use + * the desiredCapacityHint if appropriate. + * If a caller cannot provide a reasonable guess at the desired capacity, + * it should pass desiredCapacityHint=0. + * + * If a non-scratch buffer is returned, the caller may only pass + * a prefix to it to appendString(). + * That is, it is not correct to pass an interior pointer to appendString(). + * + * The default implementation always returns the scratch buffer. + * + * @param minCapacity required minimum capacity of the returned buffer; + * must be non-negative + * @param desiredCapacityHint desired capacity of the returned buffer; + * must be non-negative + * @param scratch default caller-owned buffer + * @param scratchCapacity capacity of the scratch buffer + * @param resultCapacity pointer to an integer which will be set to the + * capacity of the returned buffer + * @return a buffer with *resultCapacity>=minCapacity + * @stable ICU 4.8 + */ + virtual char16_t *getAppendBuffer(int32_t minCapacity, + int32_t desiredCapacityHint, + char16_t *scratch, int32_t scratchCapacity, + int32_t *resultCapacity); +}; + +/** + * An Appendable implementation which writes to a UnicodeString. + * + * This class is not intended for public subclassing. + * @stable ICU 4.8 + */ +class U_COMMON_API UnicodeStringAppendable : public Appendable { +public: + /** + * Aliases the UnicodeString (keeps its reference) for writing. + * @param s The UnicodeString to which this Appendable will write. + * @stable ICU 4.8 + */ + explicit UnicodeStringAppendable(UnicodeString &s) : str(s) {} + + /** + * Destructor. + * @stable ICU 4.8 + */ + ~UnicodeStringAppendable(); + + /** + * Appends a 16-bit code unit to the string. + * @param c code unit + * @return TRUE if the operation succeeded + * @stable ICU 4.8 + */ + virtual UBool appendCodeUnit(char16_t c); + + /** + * Appends a code point to the string. + * @param c code point 0..0x10ffff + * @return TRUE if the operation succeeded + * @stable ICU 4.8 + */ + virtual UBool appendCodePoint(UChar32 c); + + /** + * Appends a string to the UnicodeString. + * @param s string, must not be NULL if length!=0 + * @param length string length, or -1 if NUL-terminated + * @return TRUE if the operation succeeded + * @stable ICU 4.8 + */ + virtual UBool appendString(const char16_t *s, int32_t length); + + /** + * Tells the UnicodeString that the caller is going to append roughly + * appendCapacity char16_ts. + * @param appendCapacity estimated number of char16_ts that will be appended + * @return TRUE if the operation succeeded + * @stable ICU 4.8 + */ + virtual UBool reserveAppendCapacity(int32_t appendCapacity); + + /** + * Returns a writable buffer for appending and writes the buffer's capacity to + * *resultCapacity. Guarantees *resultCapacity>=minCapacity. + * May return a pointer to the caller-owned scratch buffer which must have + * scratchCapacity>=minCapacity. + * The returned buffer is only valid until the next write operation + * on the UnicodeString. + * + * For details see Appendable::getAppendBuffer(). + * + * @param minCapacity required minimum capacity of the returned buffer; + * must be non-negative + * @param desiredCapacityHint desired capacity of the returned buffer; + * must be non-negative + * @param scratch default caller-owned buffer + * @param scratchCapacity capacity of the scratch buffer + * @param resultCapacity pointer to an integer which will be set to the + * capacity of the returned buffer + * @return a buffer with *resultCapacity>=minCapacity + * @stable ICU 4.8 + */ + virtual char16_t *getAppendBuffer(int32_t minCapacity, + int32_t desiredCapacityHint, + char16_t *scratch, int32_t scratchCapacity, + int32_t *resultCapacity); + +private: + UnicodeString &str; +}; + +U_NAMESPACE_END + +#endif // __APPENDABLE_H__ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/basictz.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/basictz.h new file mode 100644 index 0000000..3541207 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/basictz.h @@ -0,0 +1,216 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2007-2013, International Business Machines Corporation and +* others. All Rights Reserved. +******************************************************************************* +*/ +#ifndef BASICTZ_H +#define BASICTZ_H + +/** + * \file + * \brief C++ API: ICU TimeZone base class + */ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/timezone.h" +#include "unicode/tzrule.h" +#include "unicode/tztrans.h" + +U_NAMESPACE_BEGIN + +// forward declarations +class UVector; + +/** + * BasicTimeZone is an abstract class extending TimeZone. + * This class provides some additional methods to access time zone transitions and rules. + * All ICU TimeZone concrete subclasses extend this class. + * @stable ICU 3.8 + */ +class U_I18N_API BasicTimeZone: public TimeZone { +public: + /** + * Destructor. + * @stable ICU 3.8 + */ + virtual ~BasicTimeZone(); + + /** + * Gets the first time zone transition after the base time. + * @param base The base time. + * @param inclusive Whether the base time is inclusive or not. + * @param result Receives the first transition after the base time. + * @return TRUE if the transition is found. + * @stable ICU 3.8 + */ + virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const = 0; + + /** + * Gets the most recent time zone transition before the base time. + * @param base The base time. + * @param inclusive Whether the base time is inclusive or not. + * @param result Receives the most recent transition before the base time. + * @return TRUE if the transition is found. + * @stable ICU 3.8 + */ + virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const = 0; + + /** + * Checks if the time zone has equivalent transitions in the time range. + * This method returns true when all of transition times, from/to standard + * offsets and DST savings used by this time zone match the other in the + * time range. + * @param tz The BasicTimeZone object to be compared with. + * @param start The start time of the evaluated time range (inclusive) + * @param end The end time of the evaluated time range (inclusive) + * @param ignoreDstAmount + * When true, any transitions with only daylight saving amount + * changes will be ignored, except either of them is zero. + * For example, a transition from rawoffset 3:00/dstsavings 1:00 + * to rawoffset 2:00/dstsavings 2:00 is excluded from the comparison, + * but a transtion from rawoffset 2:00/dstsavings 1:00 to + * rawoffset 3:00/dstsavings 0:00 is included. + * @param ec Output param to filled in with a success or an error. + * @return true if the other time zone has the equivalent transitions in the + * time range. + * @stable ICU 3.8 + */ + virtual UBool hasEquivalentTransitions(const BasicTimeZone& tz, UDate start, UDate end, + UBool ignoreDstAmount, UErrorCode& ec) const; + + /** + * Returns the number of TimeZoneRules which represents time transitions, + * for this time zone, that is, all TimeZoneRules for this time zone except + * InitialTimeZoneRule. The return value range is 0 or any positive value. + * @param status Receives error status code. + * @return The number of TimeZoneRules representing time transitions. + * @stable ICU 3.8 + */ + virtual int32_t countTransitionRules(UErrorCode& status) const = 0; + + /** + * Gets the InitialTimeZoneRule and the set of TimeZoneRule + * which represent time transitions for this time zone. On successful return, + * the argument initial points to non-NULL InitialTimeZoneRule and + * the array trsrules is filled with 0 or multiple TimeZoneRule + * instances up to the size specified by trscount. The results are referencing the + * rule instance held by this time zone instance. Therefore, after this time zone + * is destructed, they are no longer available. + * @param initial Receives the initial timezone rule + * @param trsrules Receives the timezone transition rules + * @param trscount On input, specify the size of the array 'transitions' receiving + * the timezone transition rules. On output, actual number of + * rules filled in the array will be set. + * @param status Receives error status code. + * @stable ICU 3.8 + */ + virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial, + const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) const = 0; + + /** + * Gets the set of time zone rules valid at the specified time. Some known external time zone + * implementations are not capable to handle historic time zone rule changes. Also some + * implementations can only handle certain type of rule definitions. + * If this time zone does not use any daylight saving time within about 1 year from the specified + * time, only the InitialTimeZone is returned. Otherwise, the rule for standard + * time and daylight saving time transitions are returned in addition to the + * InitialTimeZoneRule. The standard and daylight saving time transition rules are + * represented by AnnualTimeZoneRule with DateTimeRule::DOW for its date + * rule and DateTimeRule::WALL_TIME for its time rule. Because daylight saving time + * rule is changing time to time in many time zones and also mapping a transition time rule to + * different type is lossy transformation, the set of rules returned by this method may be valid + * for short period of time. + * The time zone rule objects returned by this method is owned by the caller, so the caller is + * responsible for deleting them after use. + * @param date The date used for extracting time zone rules. + * @param initial Receives the InitialTimeZone, always not NULL. + * @param std Receives the AnnualTimeZoneRule for standard time transitions. + * When this time time zone does not observe daylight saving times around the + * specified date, NULL is set. + * @param dst Receives the AnnualTimeZoneRule for daylight saving time + * transitions. When this time zone does not observer daylight saving times + * around the specified date, NULL is set. + * @param status Receives error status code. + * @stable ICU 3.8 + */ + virtual void getSimpleRulesNear(UDate date, InitialTimeZoneRule*& initial, + AnnualTimeZoneRule*& std, AnnualTimeZoneRule*& dst, UErrorCode& status) const; + + +#ifndef U_HIDE_INTERNAL_API + /** + * The time type option bit flags used by getOffsetFromLocal + * @internal + */ + enum { + kStandard = 0x01, + kDaylight = 0x03, + kFormer = 0x04, + kLatter = 0x0C + }; +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Get time zone offsets from local wall time. + * @internal + */ + virtual void getOffsetFromLocal(UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt, + int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) const; + +protected: + +#ifndef U_HIDE_INTERNAL_API + /** + * The time type option bit masks used by getOffsetFromLocal + * @internal + */ + enum { + kStdDstMask = kDaylight, + kFormerLatterMask = kLatter + }; +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Default constructor. + * @stable ICU 3.8 + */ + BasicTimeZone(); + + /** + * Construct a timezone with a given ID. + * @param id a system time zone ID + * @stable ICU 3.8 + */ + BasicTimeZone(const UnicodeString &id); + + /** + * Copy constructor. + * @param source the object to be copied. + * @stable ICU 3.8 + */ + BasicTimeZone(const BasicTimeZone& source); + + /** + * Gets the set of TimeZoneRule instances applicable to the specified time and after. + * @param start The start date used for extracting time zone rules + * @param initial Receives the InitialTimeZone, always not NULL + * @param transitionRules Receives the transition rules, could be NULL + * @param status Receives error status code + */ + void getTimeZoneRulesAfter(UDate start, InitialTimeZoneRule*& initial, UVector*& transitionRules, + UErrorCode& status) const; +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // BASICTZ_H + +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/brkiter.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/brkiter.h new file mode 100644 index 0000000..9c1ac75 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/brkiter.h @@ -0,0 +1,661 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************** +* Copyright (C) 1997-2016, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************** +* +* File brkiter.h +* +* Modification History: +* +* Date Name Description +* 02/18/97 aliu Added typedef for TextCount. Made DONE const. +* 05/07/97 aliu Fixed DLL declaration. +* 07/09/97 jfitz Renamed BreakIterator and interface synced with JDK +* 08/11/98 helena Sync-up JDK1.2. +* 01/13/2000 helena Added UErrorCode parameter to createXXXInstance methods. +******************************************************************************** +*/ + +#ifndef BRKITER_H +#define BRKITER_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Break Iterator. + */ + +#if UCONFIG_NO_BREAK_ITERATION + +U_NAMESPACE_BEGIN + +/* + * Allow the declaration of APIs with pointers to BreakIterator + * even when break iteration is removed from the build. + */ +class BreakIterator; + +U_NAMESPACE_END + +#else + +#include "unicode/uobject.h" +#include "unicode/unistr.h" +#include "unicode/chariter.h" +#include "unicode/locid.h" +#include "unicode/ubrk.h" +#include "unicode/strenum.h" +#include "unicode/utext.h" +#include "unicode/umisc.h" + +U_NAMESPACE_BEGIN + +/** + * The BreakIterator class implements methods for finding the location + * of boundaries in text. BreakIterator is an abstract base class. + * Instances of BreakIterator maintain a current position and scan over + * text returning the index of characters where boundaries occur. + *

+ * Line boundary analysis determines where a text string can be broken + * when line-wrapping. The mechanism correctly handles punctuation and + * hyphenated words. + *

+ * Sentence boundary analysis allows selection with correct + * interpretation of periods within numbers and abbreviations, and + * trailing punctuation marks such as quotation marks and parentheses. + *

+ * Word boundary analysis is used by search and replace functions, as + * well as within text editing applications that allow the user to + * select words with a double click. Word selection provides correct + * interpretation of punctuation marks within and following + * words. Characters that are not part of a word, such as symbols or + * punctuation marks, have word-breaks on both sides. + *

+ * Character boundary analysis allows users to interact with + * characters as they expect to, for example, when moving the cursor + * through a text string. Character boundary analysis provides correct + * navigation of through character strings, regardless of how the + * character is stored. For example, an accented character might be + * stored as a base character and a diacritical mark. What users + * consider to be a character can differ between languages. + *

+ * The text boundary positions are found according to the rules + * described in Unicode Standard Annex #29, Text Boundaries, and + * Unicode Standard Annex #14, Line Breaking Properties. These + * are available at http://www.unicode.org/reports/tr14/ and + * http://www.unicode.org/reports/tr29/. + *

+ * In addition to the C++ API defined in this header file, a + * plain C API with equivalent functionality is defined in the + * file ubrk.h + *

+ * Code snippets illustrating the use of the Break Iterator APIs + * are available in the ICU User Guide, + * http://icu-project.org/userguide/boundaryAnalysis.html + * and in the sample program icu/source/samples/break/break.cpp + * + */ +class U_COMMON_API BreakIterator : public UObject { +public: + /** + * destructor + * @stable ICU 2.0 + */ + virtual ~BreakIterator(); + + /** + * Return true if another object is semantically equal to this + * one. The other object should be an instance of the same subclass of + * BreakIterator. Objects of different subclasses are considered + * unequal. + *

+ * Return true if this BreakIterator is at the same position in the + * same text, and is the same class and type (word, line, etc.) of + * BreakIterator, as the argument. Text is considered the same if + * it contains the same characters, it need not be the same + * object, and styles are not considered. + * @stable ICU 2.0 + */ + virtual UBool operator==(const BreakIterator&) const = 0; + + /** + * Returns the complement of the result of operator== + * @param rhs The BreakIterator to be compared for inequality + * @return the complement of the result of operator== + * @stable ICU 2.0 + */ + UBool operator!=(const BreakIterator& rhs) const { return !operator==(rhs); } + + /** + * Return a polymorphic copy of this object. This is an abstract + * method which subclasses implement. + * @stable ICU 2.0 + */ + virtual BreakIterator* clone(void) const = 0; + + /** + * Return a polymorphic class ID for this object. Different subclasses + * will return distinct unequal values. + * @stable ICU 2.0 + */ + virtual UClassID getDynamicClassID(void) const = 0; + + /** + * Return a CharacterIterator over the text being analyzed. + * @stable ICU 2.0 + */ + virtual CharacterIterator& getText(void) const = 0; + + + /** + * Get a UText for the text being analyzed. + * The returned UText is a shallow clone of the UText used internally + * by the break iterator implementation. It can safely be used to + * access the text without impacting any break iterator operations, + * but the underlying text itself must not be altered. + * + * @param fillIn A UText to be filled in. If NULL, a new UText will be + * allocated to hold the result. + * @param status receives any error codes. + * @return The current UText for this break iterator. If an input + * UText was provided, it will always be returned. + * @stable ICU 3.4 + */ + virtual UText *getUText(UText *fillIn, UErrorCode &status) const = 0; + + /** + * Change the text over which this operates. The text boundary is + * reset to the start. + * + * The BreakIterator will retain a reference to the supplied string. + * The caller must not modify or delete the text while the BreakIterator + * retains the reference. + * + * @param text The UnicodeString used to change the text. + * @stable ICU 2.0 + */ + virtual void setText(const UnicodeString &text) = 0; + + /** + * Reset the break iterator to operate over the text represented by + * the UText. The iterator position is reset to the start. + * + * This function makes a shallow clone of the supplied UText. This means + * that the caller is free to immediately close or otherwise reuse the + * Utext that was passed as a parameter, but that the underlying text itself + * must not be altered while being referenced by the break iterator. + * + * All index positions returned by break iterator functions are + * native indices from the UText. For example, when breaking UTF-8 + * encoded text, the break positions returned by next(), previous(), etc. + * will be UTF-8 string indices, not UTF-16 positions. + * + * @param text The UText used to change the text. + * @param status receives any error codes. + * @stable ICU 3.4 + */ + virtual void setText(UText *text, UErrorCode &status) = 0; + + /** + * Change the text over which this operates. The text boundary is + * reset to the start. + * Note that setText(UText *) provides similar functionality to this function, + * and is more efficient. + * @param it The CharacterIterator used to change the text. + * @stable ICU 2.0 + */ + virtual void adoptText(CharacterIterator* it) = 0; + + enum { + /** + * DONE is returned by previous() and next() after all valid + * boundaries have been returned. + * @stable ICU 2.0 + */ + DONE = (int32_t)-1 + }; + + /** + * Sets the current iteration position to the beginning of the text, position zero. + * @return The offset of the beginning of the text, zero. + * @stable ICU 2.0 + */ + virtual int32_t first(void) = 0; + + /** + * Set the iterator position to the index immediately BEYOND the last character in the text being scanned. + * @return The index immediately BEYOND the last character in the text being scanned. + * @stable ICU 2.0 + */ + virtual int32_t last(void) = 0; + + /** + * Set the iterator position to the boundary preceding the current boundary. + * @return The character index of the previous text boundary or DONE if all + * boundaries have been returned. + * @stable ICU 2.0 + */ + virtual int32_t previous(void) = 0; + + /** + * Advance the iterator to the boundary following the current boundary. + * @return The character index of the next text boundary or DONE if all + * boundaries have been returned. + * @stable ICU 2.0 + */ + virtual int32_t next(void) = 0; + + /** + * Return character index of the current iterator position within the text. + * @return The boundary most recently returned. + * @stable ICU 2.0 + */ + virtual int32_t current(void) const = 0; + + /** + * Advance the iterator to the first boundary following the specified offset. + * The value returned is always greater than the offset or + * the value BreakIterator.DONE + * @param offset the offset to begin scanning. + * @return The first boundary after the specified offset. + * @stable ICU 2.0 + */ + virtual int32_t following(int32_t offset) = 0; + + /** + * Set the iterator position to the first boundary preceding the specified offset. + * The value returned is always smaller than the offset or + * the value BreakIterator.DONE + * @param offset the offset to begin scanning. + * @return The first boundary before the specified offset. + * @stable ICU 2.0 + */ + virtual int32_t preceding(int32_t offset) = 0; + + /** + * Return true if the specified position is a boundary position. + * As a side effect, the current position of the iterator is set + * to the first boundary position at or following the specified offset. + * @param offset the offset to check. + * @return True if "offset" is a boundary position. + * @stable ICU 2.0 + */ + virtual UBool isBoundary(int32_t offset) = 0; + + /** + * Set the iterator position to the nth boundary from the current boundary + * @param n the number of boundaries to move by. A value of 0 + * does nothing. Negative values move to previous boundaries + * and positive values move to later boundaries. + * @return The new iterator position, or + * DONE if there are fewer than |n| boundaries in the specfied direction. + * @stable ICU 2.0 + */ + virtual int32_t next(int32_t n) = 0; + + /** + * For RuleBasedBreakIterators, return the status tag from the + * break rule that determined the most recently + * returned break position. + *

+ * For break iterator types that do not support a rule status, + * a default value of 0 is returned. + *

+ * @return the status from the break rule that determined the most recently + * returned break position. + * @see RuleBaseBreakIterator::getRuleStatus() + * @see UWordBreak + * @stable ICU 52 + */ + virtual int32_t getRuleStatus() const; + + /** + * For RuleBasedBreakIterators, get the status (tag) values from the break rule(s) + * that determined the most recently returned break position. + *

+ * For break iterator types that do not support rule status, + * no values are returned. + *

+ * The returned status value(s) are stored into an array provided by the caller. + * The values are stored in sorted (ascending) order. + * If the capacity of the output array is insufficient to hold the data, + * the output will be truncated to the available length, and a + * U_BUFFER_OVERFLOW_ERROR will be signaled. + *

+ * @see RuleBaseBreakIterator::getRuleStatusVec + * + * @param fillInVec an array to be filled in with the status values. + * @param capacity the length of the supplied vector. A length of zero causes + * the function to return the number of status values, in the + * normal way, without attempting to store any values. + * @param status receives error codes. + * @return The number of rule status values from rules that determined + * the most recent boundary returned by the break iterator. + * In the event of a U_BUFFER_OVERFLOW_ERROR, the return value + * is the total number of status values that were available, + * not the reduced number that were actually returned. + * @see getRuleStatus + * @stable ICU 52 + */ + virtual int32_t getRuleStatusVec(int32_t *fillInVec, int32_t capacity, UErrorCode &status); + + /** + * Create BreakIterator for word-breaks using the given locale. + * Returns an instance of a BreakIterator implementing word breaks. + * WordBreak is useful for word selection (ex. double click) + * @param where the locale. + * @param status the error code + * @return A BreakIterator for word-breaks. The UErrorCode& status + * parameter is used to return status information to the user. + * To check whether the construction succeeded or not, you should check + * the value of U_SUCCESS(err). If you wish more detailed information, you + * can check for informational error results which still indicate success. + * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For + * example, 'de_CH' was requested, but nothing was found there, so 'de' was + * used. U_USING_DEFAULT_WARNING indicates that the default locale data was + * used; neither the requested locale nor any of its fall back locales + * could be found. + * The caller owns the returned object and is responsible for deleting it. + * @stable ICU 2.0 + */ + static BreakIterator* U_EXPORT2 + createWordInstance(const Locale& where, UErrorCode& status); + + /** + * Create BreakIterator for line-breaks using specified locale. + * Returns an instance of a BreakIterator implementing line breaks. Line + * breaks are logically possible line breaks, actual line breaks are + * usually determined based on display width. + * LineBreak is useful for word wrapping text. + * @param where the locale. + * @param status The error code. + * @return A BreakIterator for line-breaks. The UErrorCode& status + * parameter is used to return status information to the user. + * To check whether the construction succeeded or not, you should check + * the value of U_SUCCESS(err). If you wish more detailed information, you + * can check for informational error results which still indicate success. + * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For + * example, 'de_CH' was requested, but nothing was found there, so 'de' was + * used. U_USING_DEFAULT_WARNING indicates that the default locale data was + * used; neither the requested locale nor any of its fall back locales + * could be found. + * The caller owns the returned object and is responsible for deleting it. + * @stable ICU 2.0 + */ + static BreakIterator* U_EXPORT2 + createLineInstance(const Locale& where, UErrorCode& status); + + /** + * Create BreakIterator for character-breaks using specified locale + * Returns an instance of a BreakIterator implementing character breaks. + * Character breaks are boundaries of combining character sequences. + * @param where the locale. + * @param status The error code. + * @return A BreakIterator for character-breaks. The UErrorCode& status + * parameter is used to return status information to the user. + * To check whether the construction succeeded or not, you should check + * the value of U_SUCCESS(err). If you wish more detailed information, you + * can check for informational error results which still indicate success. + * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For + * example, 'de_CH' was requested, but nothing was found there, so 'de' was + * used. U_USING_DEFAULT_WARNING indicates that the default locale data was + * used; neither the requested locale nor any of its fall back locales + * could be found. + * The caller owns the returned object and is responsible for deleting it. + * @stable ICU 2.0 + */ + static BreakIterator* U_EXPORT2 + createCharacterInstance(const Locale& where, UErrorCode& status); + + /** + * Create BreakIterator for sentence-breaks using specified locale + * Returns an instance of a BreakIterator implementing sentence breaks. + * @param where the locale. + * @param status The error code. + * @return A BreakIterator for sentence-breaks. The UErrorCode& status + * parameter is used to return status information to the user. + * To check whether the construction succeeded or not, you should check + * the value of U_SUCCESS(err). If you wish more detailed information, you + * can check for informational error results which still indicate success. + * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For + * example, 'de_CH' was requested, but nothing was found there, so 'de' was + * used. U_USING_DEFAULT_WARNING indicates that the default locale data was + * used; neither the requested locale nor any of its fall back locales + * could be found. + * The caller owns the returned object and is responsible for deleting it. + * @stable ICU 2.0 + */ + static BreakIterator* U_EXPORT2 + createSentenceInstance(const Locale& where, UErrorCode& status); + + /** + * Create BreakIterator for title-casing breaks using the specified locale + * Returns an instance of a BreakIterator implementing title breaks. + * The iterator returned locates title boundaries as described for + * Unicode 3.2 only. For Unicode 4.0 and above title boundary iteration, + * please use Word Boundary iterator.{@link #createWordInstance } + * + * @param where the locale. + * @param status The error code. + * @return A BreakIterator for title-breaks. The UErrorCode& status + * parameter is used to return status information to the user. + * To check whether the construction succeeded or not, you should check + * the value of U_SUCCESS(err). If you wish more detailed information, you + * can check for informational error results which still indicate success. + * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For + * example, 'de_CH' was requested, but nothing was found there, so 'de' was + * used. U_USING_DEFAULT_WARNING indicates that the default locale data was + * used; neither the requested locale nor any of its fall back locales + * could be found. + * The caller owns the returned object and is responsible for deleting it. + * @stable ICU 2.1 + */ + static BreakIterator* U_EXPORT2 + createTitleInstance(const Locale& where, UErrorCode& status); + + /** + * Get the set of Locales for which TextBoundaries are installed. + *

Note: this will not return locales added through the register + * call. To see the registered locales too, use the getAvailableLocales + * function that returns a StringEnumeration object

+ * @param count the output parameter of number of elements in the locale list + * @return available locales + * @stable ICU 2.0 + */ + static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count); + + /** + * Get name of the object for the desired Locale, in the desired language. + * @param objectLocale must be from getAvailableLocales. + * @param displayLocale specifies the desired locale for output. + * @param name the fill-in parameter of the return value + * Uses best match. + * @return user-displayable name + * @stable ICU 2.0 + */ + static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale, + const Locale& displayLocale, + UnicodeString& name); + + /** + * Get name of the object for the desired Locale, in the language of the + * default locale. + * @param objectLocale must be from getMatchingLocales + * @param name the fill-in parameter of the return value + * @return user-displayable name + * @stable ICU 2.0 + */ + static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale, + UnicodeString& name); + + /** + * Deprecated functionality. Use clone() instead. + * + * Thread safe client-buffer-based cloning operation + * Do NOT call delete on a safeclone, since 'new' is not used to create it. + * @param stackBuffer user allocated space for the new clone. If NULL new memory will be allocated. + * If buffer is not large enough, new memory will be allocated. + * @param BufferSize reference to size of allocated space. + * If BufferSize == 0, a sufficient size for use in cloning will + * be returned ('pre-flighting') + * If BufferSize is not enough for a stack-based safe clone, + * new memory will be allocated. + * @param status to indicate whether the operation went on smoothly or there were errors + * An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any allocations were + * necessary. + * @return pointer to the new clone + * + * @deprecated ICU 52. Use clone() instead. + */ + virtual BreakIterator * createBufferClone(void *stackBuffer, + int32_t &BufferSize, + UErrorCode &status) = 0; + +#ifndef U_HIDE_DEPRECATED_API + + /** + * Determine whether the BreakIterator was created in user memory by + * createBufferClone(), and thus should not be deleted. Such objects + * must be closed by an explicit call to the destructor (not delete). + * @deprecated ICU 52. Always delete the BreakIterator. + */ + inline UBool isBufferClone(void); + +#endif /* U_HIDE_DEPRECATED_API */ + +#if !UCONFIG_NO_SERVICE + /** + * Register a new break iterator of the indicated kind, to use in the given locale. + * The break iterator will be adopted. Clones of the iterator will be returned + * if a request for a break iterator of the given kind matches or falls back to + * this locale. + * Because ICU may choose to cache BreakIterators internally, this must + * be called at application startup, prior to any calls to + * BreakIterator::createXXXInstance to avoid undefined behavior. + * @param toAdopt the BreakIterator instance to be adopted + * @param locale the Locale for which this instance is to be registered + * @param kind the type of iterator for which this instance is to be registered + * @param status the in/out status code, no special meanings are assigned + * @return a registry key that can be used to unregister this instance + * @stable ICU 2.4 + */ + static URegistryKey U_EXPORT2 registerInstance(BreakIterator* toAdopt, + const Locale& locale, + UBreakIteratorType kind, + UErrorCode& status); + + /** + * Unregister a previously-registered BreakIterator using the key returned from the + * register call. Key becomes invalid after a successful call and should not be used again. + * The BreakIterator corresponding to the key will be deleted. + * Because ICU may choose to cache BreakIterators internally, this should + * be called during application shutdown, after all calls to + * BreakIterator::createXXXInstance to avoid undefined behavior. + * @param key the registry key returned by a previous call to registerInstance + * @param status the in/out status code, no special meanings are assigned + * @return TRUE if the iterator for the key was successfully unregistered + * @stable ICU 2.4 + */ + static UBool U_EXPORT2 unregister(URegistryKey key, UErrorCode& status); + + /** + * Return a StringEnumeration over the locales available at the time of the call, + * including registered locales. + * @return a StringEnumeration over the locales available at the time of the call + * @stable ICU 2.4 + */ + static StringEnumeration* U_EXPORT2 getAvailableLocales(void); +#endif + + /** + * Returns the locale for this break iterator. Two flavors are available: valid and + * actual locale. + * @stable ICU 2.8 + */ + Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const; + +#ifndef U_HIDE_INTERNAL_API + /** Get the locale for this break iterator object. You can choose between valid and actual locale. + * @param type type of the locale we're looking for (valid or actual) + * @param status error code for the operation + * @return the locale + * @internal + */ + const char *getLocaleID(ULocDataLocaleType type, UErrorCode& status) const; +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Set the subject text string upon which the break iterator is operating + * without changing any other aspect of the matching state. + * The new and previous text strings must have the same content. + * + * This function is intended for use in environments where ICU is operating on + * strings that may move around in memory. It provides a mechanism for notifying + * ICU that the string has been relocated, and providing a new UText to access the + * string in its new position. + * + * Note that the break iterator implementation never copies the underlying text + * of a string being processed, but always operates directly on the original text + * provided by the user. Refreshing simply drops the references to the old text + * and replaces them with references to the new. + * + * Caution: this function is normally used only by very specialized, + * system-level code. One example use case is with garbage collection that moves + * the text in memory. + * + * @param input The new (moved) text string. + * @param status Receives errors detected by this function. + * @return *this + * + * @stable ICU 49 + */ + virtual BreakIterator &refreshInputText(UText *input, UErrorCode &status) = 0; + + private: + static BreakIterator* buildInstance(const Locale& loc, const char *type, int32_t kind, UErrorCode& status); + static BreakIterator* createInstance(const Locale& loc, int32_t kind, UErrorCode& status); + static BreakIterator* makeInstance(const Locale& loc, int32_t kind, UErrorCode& status); + + friend class ICUBreakIteratorFactory; + friend class ICUBreakIteratorService; + +protected: + // Do not enclose protected default/copy constructors with #ifndef U_HIDE_INTERNAL_API + // or else the compiler will create a public ones. + /** @internal */ + BreakIterator(); + /** @internal */ + BreakIterator (const BreakIterator &other); +#ifndef U_HIDE_INTERNAL_API + /** @internal */ + BreakIterator (const Locale& valid, const Locale &actual); + /** @internal. Assignment Operator, used by RuleBasedBreakIterator. */ + BreakIterator &operator = (const BreakIterator &other); +#endif /* U_HIDE_INTERNAL_API */ + +private: + + /** @internal */ + char actualLocale[ULOC_FULLNAME_CAPACITY]; + char validLocale[ULOC_FULLNAME_CAPACITY]; +}; + +#ifndef U_HIDE_DEPRECATED_API + +inline UBool BreakIterator::isBufferClone() +{ + return FALSE; +} + +#endif /* U_HIDE_DEPRECATED_API */ + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_BREAK_ITERATION */ + +#endif // BRKITER_H +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/bytestream.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/bytestream.h new file mode 100644 index 0000000..6f61c38 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/bytestream.h @@ -0,0 +1,272 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +// Copyright (C) 2009-2012, International Business Machines +// Corporation and others. All Rights Reserved. +// +// Copyright 2007 Google Inc. All Rights Reserved. +// Author: sanjay@google.com (Sanjay Ghemawat) +// +// Abstract interface that consumes a sequence of bytes (ByteSink). +// +// Used so that we can write a single piece of code that can operate +// on a variety of output string types. +// +// Various implementations of this interface are provided: +// ByteSink: +// CheckedArrayByteSink Write to a flat array, with bounds checking +// StringByteSink Write to an STL string + +// This code is a contribution of Google code, and the style used here is +// a compromise between the original Google code and the ICU coding guidelines. +// For example, data types are ICU-ified (size_t,int->int32_t), +// and API comments doxygen-ified, but function names and behavior are +// as in the original, if possible. +// Assertion-style error handling, not available in ICU, was changed to +// parameter "pinning" similar to UnicodeString. +// +// In addition, this is only a partial port of the original Google code, +// limited to what was needed so far. The (nearly) complete original code +// is in the ICU svn repository at icuhtml/trunk/design/strings/contrib +// (see ICU ticket 6765, r25517). + +#ifndef __BYTESTREAM_H__ +#define __BYTESTREAM_H__ + +/** + * \file + * \brief C++ API: Interface for writing bytes, and implementation classes. + */ + +#include "unicode/utypes.h" +#include "unicode/uobject.h" +#include "unicode/std_string.h" + +U_NAMESPACE_BEGIN + +/** + * A ByteSink can be filled with bytes. + * @stable ICU 4.2 + */ +class U_COMMON_API ByteSink : public UMemory { +public: + /** + * Default constructor. + * @stable ICU 4.2 + */ + ByteSink() { } + /** + * Virtual destructor. + * @stable ICU 4.2 + */ + virtual ~ByteSink(); + + /** + * Append "bytes[0,n-1]" to this. + * @param bytes the pointer to the bytes + * @param n the number of bytes; must be non-negative + * @stable ICU 4.2 + */ + virtual void Append(const char* bytes, int32_t n) = 0; + + /** + * Returns a writable buffer for appending and writes the buffer's capacity to + * *result_capacity. Guarantees *result_capacity>=min_capacity. + * May return a pointer to the caller-owned scratch buffer which must have + * scratch_capacity>=min_capacity. + * The returned buffer is only valid until the next operation + * on this ByteSink. + * + * After writing at most *result_capacity bytes, call Append() with the + * pointer returned from this function and the number of bytes written. + * Many Append() implementations will avoid copying bytes if this function + * returned an internal buffer. + * + * Partial usage example: + * int32_t capacity; + * char* buffer = sink->GetAppendBuffer(..., &capacity); + * ... Write n bytes into buffer, with n <= capacity. + * sink->Append(buffer, n); + * In many implementations, that call to Append will avoid copying bytes. + * + * If the ByteSink allocates or reallocates an internal buffer, it should use + * the desired_capacity_hint if appropriate. + * If a caller cannot provide a reasonable guess at the desired capacity, + * it should pass desired_capacity_hint=0. + * + * If a non-scratch buffer is returned, the caller may only pass + * a prefix to it to Append(). + * That is, it is not correct to pass an interior pointer to Append(). + * + * The default implementation always returns the scratch buffer. + * + * @param min_capacity required minimum capacity of the returned buffer; + * must be non-negative + * @param desired_capacity_hint desired capacity of the returned buffer; + * must be non-negative + * @param scratch default caller-owned buffer + * @param scratch_capacity capacity of the scratch buffer + * @param result_capacity pointer to an integer which will be set to the + * capacity of the returned buffer + * @return a buffer with *result_capacity>=min_capacity + * @stable ICU 4.2 + */ + virtual char* GetAppendBuffer(int32_t min_capacity, + int32_t desired_capacity_hint, + char* scratch, int32_t scratch_capacity, + int32_t* result_capacity); + + /** + * Flush internal buffers. + * Some byte sinks use internal buffers or provide buffering + * and require calling Flush() at the end of the stream. + * The ByteSink should be ready for further Append() calls after Flush(). + * The default implementation of Flush() does nothing. + * @stable ICU 4.2 + */ + virtual void Flush(); + +private: + ByteSink(const ByteSink &) = delete; + ByteSink &operator=(const ByteSink &) = delete; +}; + +// ------------------------------------------------------------- +// Some standard implementations + +/** + * Implementation of ByteSink that writes to a flat byte array, + * with bounds-checking: + * This sink will not write more than capacity bytes to outbuf. + * If more than capacity bytes are Append()ed, then excess bytes are ignored, + * and Overflowed() will return true. + * Overflow does not cause a runtime error. + * @stable ICU 4.2 + */ +class U_COMMON_API CheckedArrayByteSink : public ByteSink { +public: + /** + * Constructs a ByteSink that will write to outbuf[0..capacity-1]. + * @param outbuf buffer to write to + * @param capacity size of the buffer + * @stable ICU 4.2 + */ + CheckedArrayByteSink(char* outbuf, int32_t capacity); + /** + * Destructor. + * @stable ICU 4.2 + */ + virtual ~CheckedArrayByteSink(); + /** + * Returns the sink to its original state, without modifying the buffer. + * Useful for reusing both the buffer and the sink for multiple streams. + * Resets the state to NumberOfBytesWritten()=NumberOfBytesAppended()=0 + * and Overflowed()=FALSE. + * @return *this + * @stable ICU 4.6 + */ + virtual CheckedArrayByteSink& Reset(); + /** + * Append "bytes[0,n-1]" to this. + * @param bytes the pointer to the bytes + * @param n the number of bytes; must be non-negative + * @stable ICU 4.2 + */ + virtual void Append(const char* bytes, int32_t n); + /** + * Returns a writable buffer for appending and writes the buffer's capacity to + * *result_capacity. For details see the base class documentation. + * @param min_capacity required minimum capacity of the returned buffer; + * must be non-negative + * @param desired_capacity_hint desired capacity of the returned buffer; + * must be non-negative + * @param scratch default caller-owned buffer + * @param scratch_capacity capacity of the scratch buffer + * @param result_capacity pointer to an integer which will be set to the + * capacity of the returned buffer + * @return a buffer with *result_capacity>=min_capacity + * @stable ICU 4.2 + */ + virtual char* GetAppendBuffer(int32_t min_capacity, + int32_t desired_capacity_hint, + char* scratch, int32_t scratch_capacity, + int32_t* result_capacity); + /** + * Returns the number of bytes actually written to the sink. + * @return number of bytes written to the buffer + * @stable ICU 4.2 + */ + int32_t NumberOfBytesWritten() const { return size_; } + /** + * Returns true if any bytes were discarded, i.e., if there was an + * attempt to write more than 'capacity' bytes. + * @return TRUE if more than 'capacity' bytes were Append()ed + * @stable ICU 4.2 + */ + UBool Overflowed() const { return overflowed_; } + /** + * Returns the number of bytes appended to the sink. + * If Overflowed() then NumberOfBytesAppended()>NumberOfBytesWritten() + * else they return the same number. + * @return number of bytes written to the buffer + * @stable ICU 4.6 + */ + int32_t NumberOfBytesAppended() const { return appended_; } +private: + char* outbuf_; + const int32_t capacity_; + int32_t size_; + int32_t appended_; + UBool overflowed_; + + CheckedArrayByteSink() = delete; + CheckedArrayByteSink(const CheckedArrayByteSink &) = delete; + CheckedArrayByteSink &operator=(const CheckedArrayByteSink &) = delete; +}; + +/** + * Implementation of ByteSink that writes to a "string". + * The StringClass is usually instantiated with a std::string. + * @stable ICU 4.2 + */ +template +class StringByteSink : public ByteSink { + public: + /** + * Constructs a ByteSink that will append bytes to the dest string. + * @param dest pointer to string object to append to + * @stable ICU 4.2 + */ + StringByteSink(StringClass* dest) : dest_(dest) { } +#ifndef U_HIDE_DRAFT_API + /** + * Constructs a ByteSink that reserves append capacity and will append bytes to the dest string. + * + * @param dest pointer to string object to append to + * @param initialAppendCapacity capacity beyond dest->length() to be reserve()d + * @draft ICU 60 + */ + StringByteSink(StringClass* dest, int32_t initialAppendCapacity) : dest_(dest) { + if (initialAppendCapacity > 0 && + (uint32_t)initialAppendCapacity > (dest->capacity() - dest->length())) { + dest->reserve(dest->length() + initialAppendCapacity); + } + } +#endif // U_HIDE_DRAFT_API + /** + * Append "bytes[0,n-1]" to this. + * @param data the pointer to the bytes + * @param n the number of bytes; must be non-negative + * @stable ICU 4.2 + */ + virtual void Append(const char* data, int32_t n) { dest_->append(data, n); } + private: + StringClass* dest_; + + StringByteSink() = delete; + StringByteSink(const StringByteSink &) = delete; + StringByteSink &operator=(const StringByteSink &) = delete; +}; + +U_NAMESPACE_END + +#endif // __BYTESTREAM_H__ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/bytestrie.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/bytestrie.h new file mode 100644 index 0000000..c57b8cc --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/bytestrie.h @@ -0,0 +1,520 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2010-2012, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* file name: bytestrie.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2010sep25 +* created by: Markus W. Scherer +*/ + +#ifndef __BYTESTRIE_H__ +#define __BYTESTRIE_H__ + +/** + * \file + * \brief C++ API: Trie for mapping byte sequences to integer values. + */ + +#include "unicode/utypes.h" +#include "unicode/stringpiece.h" +#include "unicode/uobject.h" +#include "unicode/ustringtrie.h" + +U_NAMESPACE_BEGIN + +class ByteSink; +class BytesTrieBuilder; +class CharString; +class UVector32; + +/** + * Light-weight, non-const reader class for a BytesTrie. + * Traverses a byte-serialized data structure with minimal state, + * for mapping byte sequences to non-negative integer values. + * + * This class owns the serialized trie data only if it was constructed by + * the builder's build() method. + * The public constructor and the copy constructor only alias the data (only copy the pointer). + * There is no assignment operator. + * + * This class is not intended for public subclassing. + * @stable ICU 4.8 + */ +class U_COMMON_API BytesTrie : public UMemory { +public: + /** + * Constructs a BytesTrie reader instance. + * + * The trieBytes must contain a copy of a byte sequence from the BytesTrieBuilder, + * starting with the first byte of that sequence. + * The BytesTrie object will not read more bytes than + * the BytesTrieBuilder generated in the corresponding build() call. + * + * The array is not copied/cloned and must not be modified while + * the BytesTrie object is in use. + * + * @param trieBytes The byte array that contains the serialized trie. + * @stable ICU 4.8 + */ + BytesTrie(const void *trieBytes) + : ownedArray_(NULL), bytes_(static_cast(trieBytes)), + pos_(bytes_), remainingMatchLength_(-1) {} + + /** + * Destructor. + * @stable ICU 4.8 + */ + ~BytesTrie(); + + /** + * Copy constructor, copies the other trie reader object and its state, + * but not the byte array which will be shared. (Shallow copy.) + * @param other Another BytesTrie object. + * @stable ICU 4.8 + */ + BytesTrie(const BytesTrie &other) + : ownedArray_(NULL), bytes_(other.bytes_), + pos_(other.pos_), remainingMatchLength_(other.remainingMatchLength_) {} + + /** + * Resets this trie to its initial state. + * @return *this + * @stable ICU 4.8 + */ + BytesTrie &reset() { + pos_=bytes_; + remainingMatchLength_=-1; + return *this; + } + + /** + * BytesTrie state object, for saving a trie's current state + * and resetting the trie back to this state later. + * @stable ICU 4.8 + */ + class State : public UMemory { + public: + /** + * Constructs an empty State. + * @stable ICU 4.8 + */ + State() { bytes=NULL; } + private: + friend class BytesTrie; + + const uint8_t *bytes; + const uint8_t *pos; + int32_t remainingMatchLength; + }; + + /** + * Saves the state of this trie. + * @param state The State object to hold the trie's state. + * @return *this + * @see resetToState + * @stable ICU 4.8 + */ + const BytesTrie &saveState(State &state) const { + state.bytes=bytes_; + state.pos=pos_; + state.remainingMatchLength=remainingMatchLength_; + return *this; + } + + /** + * Resets this trie to the saved state. + * If the state object contains no state, or the state of a different trie, + * then this trie remains unchanged. + * @param state The State object which holds a saved trie state. + * @return *this + * @see saveState + * @see reset + * @stable ICU 4.8 + */ + BytesTrie &resetToState(const State &state) { + if(bytes_==state.bytes && bytes_!=NULL) { + pos_=state.pos; + remainingMatchLength_=state.remainingMatchLength; + } + return *this; + } + + /** + * Determines whether the byte sequence so far matches, whether it has a value, + * and whether another input byte can continue a matching byte sequence. + * @return The match/value Result. + * @stable ICU 4.8 + */ + UStringTrieResult current() const; + + /** + * Traverses the trie from the initial state for this input byte. + * Equivalent to reset().next(inByte). + * @param inByte Input byte value. Values -0x100..-1 are treated like 0..0xff. + * Values below -0x100 and above 0xff will never match. + * @return The match/value Result. + * @stable ICU 4.8 + */ + inline UStringTrieResult first(int32_t inByte) { + remainingMatchLength_=-1; + if(inByte<0) { + inByte+=0x100; + } + return nextImpl(bytes_, inByte); + } + + /** + * Traverses the trie from the current state for this input byte. + * @param inByte Input byte value. Values -0x100..-1 are treated like 0..0xff. + * Values below -0x100 and above 0xff will never match. + * @return The match/value Result. + * @stable ICU 4.8 + */ + UStringTrieResult next(int32_t inByte); + + /** + * Traverses the trie from the current state for this byte sequence. + * Equivalent to + * \code + * Result result=current(); + * for(each c in s) + * if(!USTRINGTRIE_HAS_NEXT(result)) return USTRINGTRIE_NO_MATCH; + * result=next(c); + * return result; + * \endcode + * @param s A string or byte sequence. Can be NULL if length is 0. + * @param length The length of the byte sequence. Can be -1 if NUL-terminated. + * @return The match/value Result. + * @stable ICU 4.8 + */ + UStringTrieResult next(const char *s, int32_t length); + + /** + * Returns a matching byte sequence's value if called immediately after + * current()/first()/next() returned USTRINGTRIE_INTERMEDIATE_VALUE or USTRINGTRIE_FINAL_VALUE. + * getValue() can be called multiple times. + * + * Do not call getValue() after USTRINGTRIE_NO_MATCH or USTRINGTRIE_NO_VALUE! + * @return The value for the byte sequence so far. + * @stable ICU 4.8 + */ + inline int32_t getValue() const { + const uint8_t *pos=pos_; + int32_t leadByte=*pos++; + // U_ASSERT(leadByte>=kMinValueLead); + return readValue(pos, leadByte>>1); + } + + /** + * Determines whether all byte sequences reachable from the current state + * map to the same value. + * @param uniqueValue Receives the unique value, if this function returns TRUE. + * (output-only) + * @return TRUE if all byte sequences reachable from the current state + * map to the same value. + * @stable ICU 4.8 + */ + inline UBool hasUniqueValue(int32_t &uniqueValue) const { + const uint8_t *pos=pos_; + // Skip the rest of a pending linear-match node. + return pos!=NULL && findUniqueValue(pos+remainingMatchLength_+1, FALSE, uniqueValue); + } + + /** + * Finds each byte which continues the byte sequence from the current state. + * That is, each byte b for which it would be next(b)!=USTRINGTRIE_NO_MATCH now. + * @param out Each next byte is appended to this object. + * (Only uses the out.Append(s, length) method.) + * @return the number of bytes which continue the byte sequence from here + * @stable ICU 4.8 + */ + int32_t getNextBytes(ByteSink &out) const; + + /** + * Iterator for all of the (byte sequence, value) pairs in a BytesTrie. + * @stable ICU 4.8 + */ + class U_COMMON_API Iterator : public UMemory { + public: + /** + * Iterates from the root of a byte-serialized BytesTrie. + * @param trieBytes The trie bytes. + * @param maxStringLength If 0, the iterator returns full strings/byte sequences. + * Otherwise, the iterator returns strings with this maximum length. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @stable ICU 4.8 + */ + Iterator(const void *trieBytes, int32_t maxStringLength, UErrorCode &errorCode); + + /** + * Iterates from the current state of the specified BytesTrie. + * @param trie The trie whose state will be copied for iteration. + * @param maxStringLength If 0, the iterator returns full strings/byte sequences. + * Otherwise, the iterator returns strings with this maximum length. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @stable ICU 4.8 + */ + Iterator(const BytesTrie &trie, int32_t maxStringLength, UErrorCode &errorCode); + + /** + * Destructor. + * @stable ICU 4.8 + */ + ~Iterator(); + + /** + * Resets this iterator to its initial state. + * @return *this + * @stable ICU 4.8 + */ + Iterator &reset(); + + /** + * @return TRUE if there are more elements. + * @stable ICU 4.8 + */ + UBool hasNext() const; + + /** + * Finds the next (byte sequence, value) pair if there is one. + * + * If the byte sequence is truncated to the maximum length and does not + * have a real value, then the value is set to -1. + * In this case, this "not a real value" is indistinguishable from + * a real value of -1. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return TRUE if there is another element. + * @stable ICU 4.8 + */ + UBool next(UErrorCode &errorCode); + + /** + * @return The NUL-terminated byte sequence for the last successful next(). + * @stable ICU 4.8 + */ + StringPiece getString() const; + /** + * @return The value for the last successful next(). + * @stable ICU 4.8 + */ + int32_t getValue() const { return value_; } + + private: + UBool truncateAndStop(); + + const uint8_t *branchNext(const uint8_t *pos, int32_t length, UErrorCode &errorCode); + + const uint8_t *bytes_; + const uint8_t *pos_; + const uint8_t *initialPos_; + int32_t remainingMatchLength_; + int32_t initialRemainingMatchLength_; + + CharString *str_; + int32_t maxLength_; + int32_t value_; + + // The stack stores pairs of integers for backtracking to another + // outbound edge of a branch node. + // The first integer is an offset from bytes_. + // The second integer has the str_->length() from before the node in bits 15..0, + // and the remaining branch length in bits 24..16. (Bits 31..25 are unused.) + // (We could store the remaining branch length minus 1 in bits 23..16 and not use bits 31..24, + // but the code looks more confusing that way.) + UVector32 *stack_; + }; + +private: + friend class BytesTrieBuilder; + + /** + * Constructs a BytesTrie reader instance. + * Unlike the public constructor which just aliases an array, + * this constructor adopts the builder's array. + * This constructor is only called by the builder. + */ + BytesTrie(void *adoptBytes, const void *trieBytes) + : ownedArray_(static_cast(adoptBytes)), + bytes_(static_cast(trieBytes)), + pos_(bytes_), remainingMatchLength_(-1) {} + + // No assignment operator. + BytesTrie &operator=(const BytesTrie &other); + + inline void stop() { + pos_=NULL; + } + + // Reads a compact 32-bit integer. + // pos is already after the leadByte, and the lead byte is already shifted right by 1. + static int32_t readValue(const uint8_t *pos, int32_t leadByte); + static inline const uint8_t *skipValue(const uint8_t *pos, int32_t leadByte) { + // U_ASSERT(leadByte>=kMinValueLead); + if(leadByte>=(kMinTwoByteValueLead<<1)) { + if(leadByte<(kMinThreeByteValueLead<<1)) { + ++pos; + } else if(leadByte<(kFourByteValueLead<<1)) { + pos+=2; + } else { + pos+=3+((leadByte>>1)&1); + } + } + return pos; + } + static inline const uint8_t *skipValue(const uint8_t *pos) { + int32_t leadByte=*pos++; + return skipValue(pos, leadByte); + } + + // Reads a jump delta and jumps. + static const uint8_t *jumpByDelta(const uint8_t *pos); + + static inline const uint8_t *skipDelta(const uint8_t *pos) { + int32_t delta=*pos++; + if(delta>=kMinTwoByteDeltaLead) { + if(delta>8)+1; // 0x6c + static const int32_t kFourByteValueLead=0x7e; + + // A little more than Unicode code points. (0x11ffff) + static const int32_t kMaxThreeByteValue=((kFourByteValueLead-kMinThreeByteValueLead)<<16)-1; + + static const int32_t kFiveByteValueLead=0x7f; + + // Compact delta integers. + static const int32_t kMaxOneByteDelta=0xbf; + static const int32_t kMinTwoByteDeltaLead=kMaxOneByteDelta+1; // 0xc0 + static const int32_t kMinThreeByteDeltaLead=0xf0; + static const int32_t kFourByteDeltaLead=0xfe; + static const int32_t kFiveByteDeltaLead=0xff; + + static const int32_t kMaxTwoByteDelta=((kMinThreeByteDeltaLead-kMinTwoByteDeltaLead)<<8)-1; // 0x2fff + static const int32_t kMaxThreeByteDelta=((kFourByteDeltaLead-kMinThreeByteDeltaLead)<<16)-1; // 0xdffff + + uint8_t *ownedArray_; + + // Fixed value referencing the BytesTrie bytes. + const uint8_t *bytes_; + + // Iterator variables. + + // Pointer to next trie byte to read. NULL if no more matches. + const uint8_t *pos_; + // Remaining length of a linear-match node, minus 1. Negative if not in such a node. + int32_t remainingMatchLength_; +}; + +U_NAMESPACE_END + +#endif // __BYTESTRIE_H__ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/bytestriebuilder.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/bytestriebuilder.h new file mode 100644 index 0000000..a8412d3 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/bytestriebuilder.h @@ -0,0 +1,183 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2010-2016, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* file name: bytestriebuilder.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2010sep25 +* created by: Markus W. Scherer +*/ + +/** + * \file + * \brief C++ API: Builder for icu::BytesTrie + */ + +#ifndef __BYTESTRIEBUILDER_H__ +#define __BYTESTRIEBUILDER_H__ + +#include "unicode/utypes.h" +#include "unicode/bytestrie.h" +#include "unicode/stringpiece.h" +#include "unicode/stringtriebuilder.h" + +U_NAMESPACE_BEGIN + +class BytesTrieElement; +class CharString; +/** + * Builder class for BytesTrie. + * + * This class is not intended for public subclassing. + * @stable ICU 4.8 + */ +class U_COMMON_API BytesTrieBuilder : public StringTrieBuilder { +public: + /** + * Constructs an empty builder. + * @param errorCode Standard ICU error code. + * @stable ICU 4.8 + */ + BytesTrieBuilder(UErrorCode &errorCode); + + /** + * Destructor. + * @stable ICU 4.8 + */ + virtual ~BytesTrieBuilder(); + + /** + * Adds a (byte sequence, value) pair. + * The byte sequence must be unique. + * The bytes will be copied; the builder does not keep + * a reference to the input StringPiece or its data(). + * @param s The input byte sequence. + * @param value The value associated with this byte sequence. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return *this + * @stable ICU 4.8 + */ + BytesTrieBuilder &add(StringPiece s, int32_t value, UErrorCode &errorCode); + + /** + * Builds a BytesTrie for the add()ed data. + * Once built, no further data can be add()ed until clear() is called. + * + * A BytesTrie cannot be empty. At least one (byte sequence, value) pair + * must have been add()ed. + * + * This method passes ownership of the builder's internal result array to the new trie object. + * Another call to any build() variant will re-serialize the trie. + * After clear() has been called, a new array will be used as well. + * @param buildOption Build option, see UStringTrieBuildOption. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return A new BytesTrie for the add()ed data. + * @stable ICU 4.8 + */ + BytesTrie *build(UStringTrieBuildOption buildOption, UErrorCode &errorCode); + + /** + * Builds a BytesTrie for the add()ed data and byte-serializes it. + * Once built, no further data can be add()ed until clear() is called. + * + * A BytesTrie cannot be empty. At least one (byte sequence, value) pair + * must have been add()ed. + * + * Multiple calls to buildStringPiece() return StringPieces referring to the + * builder's same byte array, without rebuilding. + * If buildStringPiece() is called after build(), the trie will be + * re-serialized into a new array. + * If build() is called after buildStringPiece(), the trie object will become + * the owner of the previously returned array. + * After clear() has been called, a new array will be used as well. + * @param buildOption Build option, see UStringTrieBuildOption. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return A StringPiece which refers to the byte-serialized BytesTrie for the add()ed data. + * @stable ICU 4.8 + */ + StringPiece buildStringPiece(UStringTrieBuildOption buildOption, UErrorCode &errorCode); + + /** + * Removes all (byte sequence, value) pairs. + * New data can then be add()ed and a new trie can be built. + * @return *this + * @stable ICU 4.8 + */ + BytesTrieBuilder &clear(); + +private: + BytesTrieBuilder(const BytesTrieBuilder &other); // no copy constructor + BytesTrieBuilder &operator=(const BytesTrieBuilder &other); // no assignment operator + + void buildBytes(UStringTrieBuildOption buildOption, UErrorCode &errorCode); + + virtual int32_t getElementStringLength(int32_t i) const; + virtual char16_t getElementUnit(int32_t i, int32_t byteIndex) const; + virtual int32_t getElementValue(int32_t i) const; + + virtual int32_t getLimitOfLinearMatch(int32_t first, int32_t last, int32_t byteIndex) const; + + virtual int32_t countElementUnits(int32_t start, int32_t limit, int32_t byteIndex) const; + virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t byteIndex, int32_t count) const; + virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t byteIndex, char16_t byte) const; + + virtual UBool matchNodesCanHaveValues() const { return FALSE; } + + virtual int32_t getMaxBranchLinearSubNodeLength() const { return BytesTrie::kMaxBranchLinearSubNodeLength; } + virtual int32_t getMinLinearMatch() const { return BytesTrie::kMinLinearMatch; } + virtual int32_t getMaxLinearMatchLength() const { return BytesTrie::kMaxLinearMatchLength; } + + /** + * @internal + */ + class BTLinearMatchNode : public LinearMatchNode { + public: + BTLinearMatchNode(const char *units, int32_t len, Node *nextNode); + virtual UBool operator==(const Node &other) const; + virtual void write(StringTrieBuilder &builder); + private: + const char *s; + }; + + // don't use #ifndef U_HIDE_INTERNAL_API with private class members or virtual methods. + virtual Node *createLinearMatchNode(int32_t i, int32_t byteIndex, int32_t length, + Node *nextNode) const; + + UBool ensureCapacity(int32_t length); + virtual int32_t write(int32_t byte); + int32_t write(const char *b, int32_t length); + virtual int32_t writeElementUnits(int32_t i, int32_t byteIndex, int32_t length); + virtual int32_t writeValueAndFinal(int32_t i, UBool isFinal); + virtual int32_t writeValueAndType(UBool hasValue, int32_t value, int32_t node); + virtual int32_t writeDeltaTo(int32_t jumpTarget); + + CharString *strings; // Pointer not object so we need not #include internal charstr.h. + BytesTrieElement *elements; + int32_t elementsCapacity; + int32_t elementsLength; + + // Byte serialization of the trie. + // Grows from the back: bytesLength measures from the end of the buffer! + char *bytes; + int32_t bytesCapacity; + int32_t bytesLength; +}; + +U_NAMESPACE_END + +#endif // __BYTESTRIEBUILDER_H__ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/calendar.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/calendar.h new file mode 100644 index 0000000..4802153 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/calendar.h @@ -0,0 +1,2551 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************** +* Copyright (C) 1997-2014, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************** +* +* File CALENDAR.H +* +* Modification History: +* +* Date Name Description +* 04/22/97 aliu Expanded and corrected comments and other header +* contents. +* 05/01/97 aliu Made equals(), before(), after() arguments const. +* 05/20/97 aliu Replaced fAreFieldsSet with fAreFieldsInSync and +* fAreAllFieldsSet. +* 07/27/98 stephen Sync up with JDK 1.2 +* 11/15/99 weiv added YEAR_WOY and DOW_LOCAL +* to EDateFields +* 8/19/2002 srl Removed Javaisms +* 11/07/2003 srl Update, clean up documentation. +******************************************************************************** +*/ + +#ifndef CALENDAR_H +#define CALENDAR_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Calendar object + */ +#if !UCONFIG_NO_FORMATTING + +#include "unicode/uobject.h" +#include "unicode/locid.h" +#include "unicode/timezone.h" +#include "unicode/ucal.h" +#include "unicode/umisc.h" + +U_NAMESPACE_BEGIN + +class ICUServiceFactory; + +/** + * @internal + */ +typedef int32_t UFieldResolutionTable[12][8]; + +class BasicTimeZone; +/** + * Calendar is an abstract base class for converting between + * a UDate object and a set of integer fields such as + * YEAR, MONTH, DAY, HOUR, + * and so on. (A UDate object represents a specific instant in + * time with millisecond precision. See UDate + * for information about the UDate class.) + * + *

+ * Subclasses of Calendar interpret a UDate + * according to the rules of a specific calendar system. + * The most commonly used subclass of Calendar is + * GregorianCalendar. Other subclasses could represent + * the various types of lunar calendars in use in many parts of the world. + * + *

+ * NOTE: (ICU 2.6) The subclass interface should be considered unstable + * - it WILL change. + * + *

+ * Like other locale-sensitive classes, Calendar provides a + * static method, createInstance, for getting a generally useful + * object of this type. Calendar's createInstance method + * returns the appropriate Calendar subclass whose + * time fields have been initialized with the current date and time: + * \htmlonly

\endhtmlonly + *
+ * Calendar *rightNow = Calendar::createInstance(errCode);
+ * 
+ * \htmlonly
\endhtmlonly + * + *

+ * A Calendar object can produce all the time field values + * needed to implement the date-time formatting for a particular language + * and calendar style (for example, Japanese-Gregorian, Japanese-Traditional). + * + *

+ * When computing a UDate from time fields, some special circumstances + * may arise: there may be insufficient information to compute the + * UDate (such as only year and month but no day in the month), + * there may be inconsistent information (such as "Tuesday, July 15, 1996" + * -- July 15, 1996 is actually a Monday), or the input time might be ambiguous + * because of time zone transition. + * + *

+ * Insufficient information. The calendar will use default + * information to specify the missing fields. This may vary by calendar; for + * the Gregorian calendar, the default for a field is the same as that of the + * start of the epoch: i.e., YEAR = 1970, MONTH = JANUARY, DATE = 1, etc. + * + *

+ * Inconsistent information. If fields conflict, the calendar + * will give preference to fields set more recently. For example, when + * determining the day, the calendar will look for one of the following + * combinations of fields. The most recent combination, as determined by the + * most recently set single field, will be used. + * + * \htmlonly

\endhtmlonly + *
+ * MONTH + DAY_OF_MONTH
+ * MONTH + WEEK_OF_MONTH + DAY_OF_WEEK
+ * MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK
+ * DAY_OF_YEAR
+ * DAY_OF_WEEK + WEEK_OF_YEAR
+ * 
+ * \htmlonly
\endhtmlonly + * + * For the time of day: + * + * \htmlonly
\endhtmlonly + *
+ * HOUR_OF_DAY
+ * AM_PM + HOUR
+ * 
+ * \htmlonly
\endhtmlonly + * + *

+ * Ambiguous Wall Clock Time. When time offset from UTC has + * changed, it produces an ambiguous time slot around the transition. For example, + * many US locations observe daylight saving time. On the date switching to daylight + * saving time in US, wall clock time jumps from 12:59 AM (standard) to 2:00 AM + * (daylight). Therefore, wall clock time from 1:00 AM to 1:59 AM do not exist on + * the date. When the input wall time fall into this missing time slot, the ICU + * Calendar resolves the time using the UTC offset before the transition by default. + * In this example, 1:30 AM is interpreted as 1:30 AM standard time (non-exist), + * so the final result will be 2:30 AM daylight time. + * + *

On the date switching back to standard time, wall clock time is moved back one + * hour at 2:00 AM. So wall clock time from 1:00 AM to 1:59 AM occur twice. In this + * case, the ICU Calendar resolves the time using the UTC offset after the transition + * by default. For example, 1:30 AM on the date is resolved as 1:30 AM standard time. + * + *

Ambiguous wall clock time resolution behaviors can be customized by Calendar APIs + * {@link #setRepeatedWallTimeOption} and {@link #setSkippedWallTimeOption}. + * These methods are available in ICU 49 or later versions. + * + *

+ * Note: for some non-Gregorian calendars, different + * fields may be necessary for complete disambiguation. For example, a full + * specification of the historial Arabic astronomical calendar requires year, + * month, day-of-month and day-of-week in some cases. + * + *

+ * Note: There are certain possible ambiguities in + * interpretation of certain singular times, which are resolved in the + * following ways: + *

    + *
  1. 24:00:00 "belongs" to the following day. That is, + * 23:59 on Dec 31, 1969 < 24:00 on Jan 1, 1970 < 24:01:00 on Jan 1, 1970 + * + *
  2. Although historically not precise, midnight also belongs to "am", + * and noon belongs to "pm", so on the same day, + * 12:00 am (midnight) < 12:01 am, and 12:00 pm (noon) < 12:01 pm + *
+ * + *

+ * The date or time format strings are not part of the definition of a + * calendar, as those must be modifiable or overridable by the user at + * runtime. Use {@link DateFormat} + * to format dates. + * + *

+ * Calendar provides an API for field "rolling", where fields + * can be incremented or decremented, but wrap around. For example, rolling the + * month up in the date December 12, 1996 results in + * January 12, 1996. + * + *

+ * Calendar also provides a date arithmetic function for + * adding the specified (signed) amount of time to a particular time field. + * For example, subtracting 5 days from the date September 12, 1996 + * results in September 7, 1996. + * + *

Supported range + * + *

The allowable range of Calendar has been + * narrowed. GregorianCalendar used to attempt to support + * the range of dates with millisecond values from + * Long.MIN_VALUE to Long.MAX_VALUE. + * The new Calendar protocol specifies the + * maximum range of supportable dates as those having Julian day numbers + * of -0x7F000000 to +0x7F000000. This + * corresponds to years from ~5,800,000 BCE to ~5,800,000 CE. Programmers + * should use the protected constants in Calendar to + * specify an extremely early or extremely late date.

+ * + * @stable ICU 2.0 + */ +class U_I18N_API Calendar : public UObject { +public: + + /** + * Field IDs for date and time. Used to specify date/time fields. ERA is calendar + * specific. Example ranges given are for illustration only; see specific Calendar + * subclasses for actual ranges. + * @deprecated ICU 2.6. Use C enum UCalendarDateFields defined in ucal.h + */ + enum EDateFields { +#ifndef U_HIDE_DEPRECATED_API +/* + * ERA may be defined on other platforms. To avoid any potential problems undefined it here. + */ +#ifdef ERA +#undef ERA +#endif + ERA, // Example: 0..1 + YEAR, // Example: 1..big number + MONTH, // Example: 0..11 + WEEK_OF_YEAR, // Example: 1..53 + WEEK_OF_MONTH, // Example: 1..4 + DATE, // Example: 1..31 + DAY_OF_YEAR, // Example: 1..365 + DAY_OF_WEEK, // Example: 1..7 + DAY_OF_WEEK_IN_MONTH, // Example: 1..4, may be specified as -1 + AM_PM, // Example: 0..1 + HOUR, // Example: 0..11 + HOUR_OF_DAY, // Example: 0..23 + MINUTE, // Example: 0..59 + SECOND, // Example: 0..59 + MILLISECOND, // Example: 0..999 + ZONE_OFFSET, // Example: -12*U_MILLIS_PER_HOUR..12*U_MILLIS_PER_HOUR + DST_OFFSET, // Example: 0 or U_MILLIS_PER_HOUR + YEAR_WOY, // 'Y' Example: 1..big number - Year of Week of Year + DOW_LOCAL, // 'e' Example: 1..7 - Day of Week / Localized + + EXTENDED_YEAR, + JULIAN_DAY, + MILLISECONDS_IN_DAY, + IS_LEAP_MONTH, + + FIELD_COUNT = UCAL_FIELD_COUNT // See ucal.h for other fields. +#endif /* U_HIDE_DEPRECATED_API */ + }; + +#ifndef U_HIDE_DEPRECATED_API + /** + * Useful constant for days of week. Note: Calendar day-of-week is 1-based. Clients + * who create locale resources for the field of first-day-of-week should be aware of + * this. For instance, in US locale, first-day-of-week is set to 1, i.e., SUNDAY. + * @deprecated ICU 2.6. Use C enum UCalendarDaysOfWeek defined in ucal.h + */ + enum EDaysOfWeek { + SUNDAY = 1, + MONDAY, + TUESDAY, + WEDNESDAY, + THURSDAY, + FRIDAY, + SATURDAY + }; + + /** + * Useful constants for month. Note: Calendar month is 0-based. + * @deprecated ICU 2.6. Use C enum UCalendarMonths defined in ucal.h + */ + enum EMonths { + JANUARY, + FEBRUARY, + MARCH, + APRIL, + MAY, + JUNE, + JULY, + AUGUST, + SEPTEMBER, + OCTOBER, + NOVEMBER, + DECEMBER, + UNDECIMBER + }; + + /** + * Useful constants for hour in 12-hour clock. Used in GregorianCalendar. + * @deprecated ICU 2.6. Use C enum UCalendarAMPMs defined in ucal.h + */ + enum EAmpm { + AM, + PM + }; +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * destructor + * @stable ICU 2.0 + */ + virtual ~Calendar(); + + /** + * Create and return a polymorphic copy of this calendar. + * + * @return a polymorphic copy of this calendar. + * @stable ICU 2.0 + */ + virtual Calendar* clone(void) const = 0; + + /** + * Creates a Calendar using the default timezone and locale. Clients are responsible + * for deleting the object returned. + * + * @param success Indicates the success/failure of Calendar creation. Filled in + * with U_ZERO_ERROR if created successfully, set to a failure result + * otherwise. U_MISSING_RESOURCE_ERROR will be returned if the resource data + * requests a calendar type which has not been installed. + * @return A Calendar if created successfully. NULL otherwise. + * @stable ICU 2.0 + */ + static Calendar* U_EXPORT2 createInstance(UErrorCode& success); + + /** + * Creates a Calendar using the given timezone and the default locale. + * The Calendar takes ownership of zoneToAdopt; the + * client must not delete it. + * + * @param zoneToAdopt The given timezone to be adopted. + * @param success Indicates the success/failure of Calendar creation. Filled in + * with U_ZERO_ERROR if created successfully, set to a failure result + * otherwise. + * @return A Calendar if created successfully. NULL otherwise. + * @stable ICU 2.0 + */ + static Calendar* U_EXPORT2 createInstance(TimeZone* zoneToAdopt, UErrorCode& success); + + /** + * Creates a Calendar using the given timezone and the default locale. The TimeZone + * is _not_ adopted; the client is still responsible for deleting it. + * + * @param zone The timezone. + * @param success Indicates the success/failure of Calendar creation. Filled in + * with U_ZERO_ERROR if created successfully, set to a failure result + * otherwise. + * @return A Calendar if created successfully. NULL otherwise. + * @stable ICU 2.0 + */ + static Calendar* U_EXPORT2 createInstance(const TimeZone& zone, UErrorCode& success); + + /** + * Creates a Calendar using the default timezone and the given locale. + * + * @param aLocale The given locale. + * @param success Indicates the success/failure of Calendar creation. Filled in + * with U_ZERO_ERROR if created successfully, set to a failure result + * otherwise. + * @return A Calendar if created successfully. NULL otherwise. + * @stable ICU 2.0 + */ + static Calendar* U_EXPORT2 createInstance(const Locale& aLocale, UErrorCode& success); + + /** + * Creates a Calendar using the given timezone and given locale. + * The Calendar takes ownership of zoneToAdopt; the + * client must not delete it. + * + * @param zoneToAdopt The given timezone to be adopted. + * @param aLocale The given locale. + * @param success Indicates the success/failure of Calendar creation. Filled in + * with U_ZERO_ERROR if created successfully, set to a failure result + * otherwise. + * @return A Calendar if created successfully. NULL otherwise. + * @stable ICU 2.0 + */ + static Calendar* U_EXPORT2 createInstance(TimeZone* zoneToAdopt, const Locale& aLocale, UErrorCode& success); + + /** + * Gets a Calendar using the given timezone and given locale. The TimeZone + * is _not_ adopted; the client is still responsible for deleting it. + * + * @param zone The given timezone. + * @param aLocale The given locale. + * @param success Indicates the success/failure of Calendar creation. Filled in + * with U_ZERO_ERROR if created successfully, set to a failure result + * otherwise. + * @return A Calendar if created successfully. NULL otherwise. + * @stable ICU 2.0 + */ + static Calendar* U_EXPORT2 createInstance(const TimeZone& zone, const Locale& aLocale, UErrorCode& success); + + /** + * Returns a list of the locales for which Calendars are installed. + * + * @param count Number of locales returned. + * @return An array of Locale objects representing the set of locales for which + * Calendars are installed. The system retains ownership of this list; + * the caller must NOT delete it. Does not include user-registered Calendars. + * @stable ICU 2.0 + */ + static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count); + + + /** + * Given a key and a locale, returns an array of string values in a preferred + * order that would make a difference. These are all and only those values where + * the open (creation) of the service with the locale formed from the input locale + * plus input keyword and that value has different behavior than creation with the + * input locale alone. + * @param key one of the keys supported by this service. For now, only + * "calendar" is supported. + * @param locale the locale + * @param commonlyUsed if set to true it will return only commonly used values + * with the given locale in preferred order. Otherwise, + * it will return all the available values for the locale. + * @param status ICU Error Code + * @return a string enumeration over keyword values for the given key and the locale. + * @stable ICU 4.2 + */ + static StringEnumeration* U_EXPORT2 getKeywordValuesForLocale(const char* key, + const Locale& locale, UBool commonlyUsed, UErrorCode& status); + + /** + * Returns the current UTC (GMT) time measured in milliseconds since 0:00:00 on 1/1/70 + * (derived from the system time). + * + * @return The current UTC time in milliseconds. + * @stable ICU 2.0 + */ + static UDate U_EXPORT2 getNow(void); + + /** + * Gets this Calendar's time as milliseconds. May involve recalculation of time due + * to previous calls to set time field values. The time specified is non-local UTC + * (GMT) time. Although this method is const, this object may actually be changed + * (semantically const). + * + * @param status Output param set to success/failure code on exit. If any value + * previously set in the time field is invalid or restricted by + * leniency, this will be set to an error status. + * @return The current time in UTC (GMT) time, or zero if the operation + * failed. + * @stable ICU 2.0 + */ + inline UDate getTime(UErrorCode& status) const { return getTimeInMillis(status); } + + /** + * Sets this Calendar's current time with the given UDate. The time specified should + * be in non-local UTC (GMT) time. + * + * @param date The given UDate in UTC (GMT) time. + * @param status Output param set to success/failure code on exit. If any value + * set in the time field is invalid or restricted by + * leniency, this will be set to an error status. + * @stable ICU 2.0 + */ + inline void setTime(UDate date, UErrorCode& status) { setTimeInMillis(date, status); } + + /** + * Compares the equality of two Calendar objects. Objects of different subclasses + * are considered unequal. This comparison is very exacting; two Calendar objects + * must be in exactly the same state to be considered equal. To compare based on the + * represented time, use equals() instead. + * + * @param that The Calendar object to be compared with. + * @return True if the given Calendar is the same as this Calendar; false + * otherwise. + * @stable ICU 2.0 + */ + virtual UBool operator==(const Calendar& that) const; + + /** + * Compares the inequality of two Calendar objects. + * + * @param that The Calendar object to be compared with. + * @return True if the given Calendar is not the same as this Calendar; false + * otherwise. + * @stable ICU 2.0 + */ + UBool operator!=(const Calendar& that) const {return !operator==(that);} + + /** + * Returns TRUE if the given Calendar object is equivalent to this + * one. An equivalent Calendar will behave exactly as this one + * does, but it may be set to a different time. By contrast, for + * the operator==() method to return TRUE, the other Calendar must + * be set to the same time. + * + * @param other the Calendar to be compared with this Calendar + * @stable ICU 2.4 + */ + virtual UBool isEquivalentTo(const Calendar& other) const; + + /** + * Compares the Calendar time, whereas Calendar::operator== compares the equality of + * Calendar objects. + * + * @param when The Calendar to be compared with this Calendar. Although this is a + * const parameter, the object may be modified physically + * (semantically const). + * @param status Output param set to success/failure code on exit. If any value + * previously set in the time field is invalid or restricted by + * leniency, this will be set to an error status. + * @return True if the current time of this Calendar is equal to the time of + * Calendar when; false otherwise. + * @stable ICU 2.0 + */ + UBool equals(const Calendar& when, UErrorCode& status) const; + + /** + * Returns true if this Calendar's current time is before "when"'s current time. + * + * @param when The Calendar to be compared with this Calendar. Although this is a + * const parameter, the object may be modified physically + * (semantically const). + * @param status Output param set to success/failure code on exit. If any value + * previously set in the time field is invalid or restricted by + * leniency, this will be set to an error status. + * @return True if the current time of this Calendar is before the time of + * Calendar when; false otherwise. + * @stable ICU 2.0 + */ + UBool before(const Calendar& when, UErrorCode& status) const; + + /** + * Returns true if this Calendar's current time is after "when"'s current time. + * + * @param when The Calendar to be compared with this Calendar. Although this is a + * const parameter, the object may be modified physically + * (semantically const). + * @param status Output param set to success/failure code on exit. If any value + * previously set in the time field is invalid or restricted by + * leniency, this will be set to an error status. + * @return True if the current time of this Calendar is after the time of + * Calendar when; false otherwise. + * @stable ICU 2.0 + */ + UBool after(const Calendar& when, UErrorCode& status) const; + + /** + * UDate Arithmetic function. Adds the specified (signed) amount of time to the given + * time field, based on the calendar's rules. For example, to subtract 5 days from + * the current time of the calendar, call add(Calendar::DATE, -5). When adding on + * the month or Calendar::MONTH field, other fields like date might conflict and + * need to be changed. For instance, adding 1 month on the date 01/31/96 will result + * in 02/29/96. + * Adding a positive value always means moving forward in time, so for the Gregorian calendar, + * starting with 100 BC and adding +1 to year results in 99 BC (even though this actually reduces + * the numeric value of the field itself). + * + * @param field Specifies which date field to modify. + * @param amount The amount of time to be added to the field, in the natural unit + * for that field (e.g., days for the day fields, hours for the hour + * field.) + * @param status Output param set to success/failure code on exit. If any value + * previously set in the time field is invalid or restricted by + * leniency, this will be set to an error status. + * @deprecated ICU 2.6. use add(UCalendarDateFields field, int32_t amount, UErrorCode& status) instead. + */ + virtual void add(EDateFields field, int32_t amount, UErrorCode& status); + + /** + * UDate Arithmetic function. Adds the specified (signed) amount of time to the given + * time field, based on the calendar's rules. For example, to subtract 5 days from + * the current time of the calendar, call add(Calendar::DATE, -5). When adding on + * the month or Calendar::MONTH field, other fields like date might conflict and + * need to be changed. For instance, adding 1 month on the date 01/31/96 will result + * in 02/29/96. + * Adding a positive value always means moving forward in time, so for the Gregorian calendar, + * starting with 100 BC and adding +1 to year results in 99 BC (even though this actually reduces + * the numeric value of the field itself). + * + * @param field Specifies which date field to modify. + * @param amount The amount of time to be added to the field, in the natural unit + * for that field (e.g., days for the day fields, hours for the hour + * field.) + * @param status Output param set to success/failure code on exit. If any value + * previously set in the time field is invalid or restricted by + * leniency, this will be set to an error status. + * @stable ICU 2.6. + */ + virtual void add(UCalendarDateFields field, int32_t amount, UErrorCode& status); + +#ifndef U_HIDE_DEPRECATED_API + /** + * Time Field Rolling function. Rolls (up/down) a single unit of time on the given + * time field. For example, to roll the current date up by one day, call + * roll(Calendar::DATE, true). When rolling on the year or Calendar::YEAR field, it + * will roll the year value in the range between getMinimum(Calendar::YEAR) and the + * value returned by getMaximum(Calendar::YEAR). When rolling on the month or + * Calendar::MONTH field, other fields like date might conflict and, need to be + * changed. For instance, rolling the month up on the date 01/31/96 will result in + * 02/29/96. Rolling up always means rolling forward in time (unless the limit of the + * field is reached, in which case it may pin or wrap), so for Gregorian calendar, + * starting with 100 BC and rolling the year up results in 99 BC. + * When eras have a definite beginning and end (as in the Chinese calendar, or as in + * most eras in the Japanese calendar) then rolling the year past either limit of the + * era will cause the year to wrap around. When eras only have a limit at one end, + * then attempting to roll the year past that limit will result in pinning the year + * at that limit. Note that for most calendars in which era 0 years move forward in + * time (such as Buddhist, Hebrew, or Islamic), it is possible for add or roll to + * result in negative years for era 0 (that is the only way to represent years before + * the calendar epoch). + * When rolling on the hour-in-day or Calendar::HOUR_OF_DAY field, it will roll the + * hour value in the range between 0 and 23, which is zero-based. + *

+ * NOTE: Do not use this method -- use roll(EDateFields, int, UErrorCode&) instead. + * + * @param field The time field. + * @param up Indicates if the value of the specified time field is to be rolled + * up or rolled down. Use true if rolling up, false otherwise. + * @param status Output param set to success/failure code on exit. If any value + * previously set in the time field is invalid or restricted by + * leniency, this will be set to an error status. + * @deprecated ICU 2.6. Use roll(UCalendarDateFields field, UBool up, UErrorCode& status) instead. + */ + inline void roll(EDateFields field, UBool up, UErrorCode& status); +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Time Field Rolling function. Rolls (up/down) a single unit of time on the given + * time field. For example, to roll the current date up by one day, call + * roll(Calendar::DATE, true). When rolling on the year or Calendar::YEAR field, it + * will roll the year value in the range between getMinimum(Calendar::YEAR) and the + * value returned by getMaximum(Calendar::YEAR). When rolling on the month or + * Calendar::MONTH field, other fields like date might conflict and, need to be + * changed. For instance, rolling the month up on the date 01/31/96 will result in + * 02/29/96. Rolling up always means rolling forward in time (unless the limit of the + * field is reached, in which case it may pin or wrap), so for Gregorian calendar, + * starting with 100 BC and rolling the year up results in 99 BC. + * When eras have a definite beginning and end (as in the Chinese calendar, or as in + * most eras in the Japanese calendar) then rolling the year past either limit of the + * era will cause the year to wrap around. When eras only have a limit at one end, + * then attempting to roll the year past that limit will result in pinning the year + * at that limit. Note that for most calendars in which era 0 years move forward in + * time (such as Buddhist, Hebrew, or Islamic), it is possible for add or roll to + * result in negative years for era 0 (that is the only way to represent years before + * the calendar epoch). + * When rolling on the hour-in-day or Calendar::HOUR_OF_DAY field, it will roll the + * hour value in the range between 0 and 23, which is zero-based. + *

+ * NOTE: Do not use this method -- use roll(UCalendarDateFields, int, UErrorCode&) instead. + * + * @param field The time field. + * @param up Indicates if the value of the specified time field is to be rolled + * up or rolled down. Use true if rolling up, false otherwise. + * @param status Output param set to success/failure code on exit. If any value + * previously set in the time field is invalid or restricted by + * leniency, this will be set to an error status. + * @stable ICU 2.6. + */ + inline void roll(UCalendarDateFields field, UBool up, UErrorCode& status); + + /** + * Time Field Rolling function. Rolls by the given amount on the given + * time field. For example, to roll the current date up by one day, call + * roll(Calendar::DATE, +1, status). When rolling on the month or + * Calendar::MONTH field, other fields like date might conflict and, need to be + * changed. For instance, rolling the month up on the date 01/31/96 will result in + * 02/29/96. Rolling by a positive value always means rolling forward in time (unless + * the limit of the field is reached, in which case it may pin or wrap), so for + * Gregorian calendar, starting with 100 BC and rolling the year by + 1 results in 99 BC. + * When eras have a definite beginning and end (as in the Chinese calendar, or as in + * most eras in the Japanese calendar) then rolling the year past either limit of the + * era will cause the year to wrap around. When eras only have a limit at one end, + * then attempting to roll the year past that limit will result in pinning the year + * at that limit. Note that for most calendars in which era 0 years move forward in + * time (such as Buddhist, Hebrew, or Islamic), it is possible for add or roll to + * result in negative years for era 0 (that is the only way to represent years before + * the calendar epoch). + * When rolling on the hour-in-day or Calendar::HOUR_OF_DAY field, it will roll the + * hour value in the range between 0 and 23, which is zero-based. + *

+ * The only difference between roll() and add() is that roll() does not change + * the value of more significant fields when it reaches the minimum or maximum + * of its range, whereas add() does. + * + * @param field The time field. + * @param amount Indicates amount to roll. + * @param status Output param set to success/failure code on exit. If any value + * previously set in the time field is invalid, this will be set to + * an error status. + * @deprecated ICU 2.6. Use roll(UCalendarDateFields field, int32_t amount, UErrorCode& status) instead. + */ + virtual void roll(EDateFields field, int32_t amount, UErrorCode& status); + + /** + * Time Field Rolling function. Rolls by the given amount on the given + * time field. For example, to roll the current date up by one day, call + * roll(Calendar::DATE, +1, status). When rolling on the month or + * Calendar::MONTH field, other fields like date might conflict and, need to be + * changed. For instance, rolling the month up on the date 01/31/96 will result in + * 02/29/96. Rolling by a positive value always means rolling forward in time (unless + * the limit of the field is reached, in which case it may pin or wrap), so for + * Gregorian calendar, starting with 100 BC and rolling the year by + 1 results in 99 BC. + * When eras have a definite beginning and end (as in the Chinese calendar, or as in + * most eras in the Japanese calendar) then rolling the year past either limit of the + * era will cause the year to wrap around. When eras only have a limit at one end, + * then attempting to roll the year past that limit will result in pinning the year + * at that limit. Note that for most calendars in which era 0 years move forward in + * time (such as Buddhist, Hebrew, or Islamic), it is possible for add or roll to + * result in negative years for era 0 (that is the only way to represent years before + * the calendar epoch). + * When rolling on the hour-in-day or Calendar::HOUR_OF_DAY field, it will roll the + * hour value in the range between 0 and 23, which is zero-based. + *

+ * The only difference between roll() and add() is that roll() does not change + * the value of more significant fields when it reaches the minimum or maximum + * of its range, whereas add() does. + * + * @param field The time field. + * @param amount Indicates amount to roll. + * @param status Output param set to success/failure code on exit. If any value + * previously set in the time field is invalid, this will be set to + * an error status. + * @stable ICU 2.6. + */ + virtual void roll(UCalendarDateFields field, int32_t amount, UErrorCode& status); + + /** + * Return the difference between the given time and the time this + * calendar object is set to. If this calendar is set + * before the given time, the returned value will be + * positive. If this calendar is set after the given + * time, the returned value will be negative. The + * field parameter specifies the units of the return + * value. For example, if fieldDifference(when, + * Calendar::MONTH) returns 3, then this calendar is set to + * 3 months before when, and possibly some addition + * time less than one month. + * + *

As a side effect of this call, this calendar is advanced + * toward when by the given amount. That is, calling + * this method has the side effect of calling add(field, + * n), where n is the return value. + * + *

Usage: To use this method, call it first with the largest + * field of interest, then with progressively smaller fields. For + * example: + * + *

+     * int y = cal->fieldDifference(when, Calendar::YEAR, err);
+     * int m = cal->fieldDifference(when, Calendar::MONTH, err);
+     * int d = cal->fieldDifference(when, Calendar::DATE, err);
+ * + * computes the difference between cal and + * when in years, months, and days. + * + *

Note: fieldDifference() is + * asymmetrical. That is, in the following code: + * + *

+     * cal->setTime(date1, err);
+     * int m1 = cal->fieldDifference(date2, Calendar::MONTH, err);
+     * int d1 = cal->fieldDifference(date2, Calendar::DATE, err);
+     * cal->setTime(date2, err);
+     * int m2 = cal->fieldDifference(date1, Calendar::MONTH, err);
+     * int d2 = cal->fieldDifference(date1, Calendar::DATE, err);
+ * + * one might expect that m1 == -m2 && d1 == -d2. + * However, this is not generally the case, because of + * irregularities in the underlying calendar system (e.g., the + * Gregorian calendar has a varying number of days per month). + * + * @param when the date to compare this calendar's time to + * @param field the field in which to compute the result + * @param status Output param set to success/failure code on exit. If any value + * previously set in the time field is invalid, this will be set to + * an error status. + * @return the difference, either positive or negative, between + * this calendar's time and when, in terms of + * field. + * @deprecated ICU 2.6. Use fieldDifference(UDate when, UCalendarDateFields field, UErrorCode& status). + */ + virtual int32_t fieldDifference(UDate when, EDateFields field, UErrorCode& status); + + /** + * Return the difference between the given time and the time this + * calendar object is set to. If this calendar is set + * before the given time, the returned value will be + * positive. If this calendar is set after the given + * time, the returned value will be negative. The + * field parameter specifies the units of the return + * value. For example, if fieldDifference(when, + * Calendar::MONTH) returns 3, then this calendar is set to + * 3 months before when, and possibly some addition + * time less than one month. + * + *

As a side effect of this call, this calendar is advanced + * toward when by the given amount. That is, calling + * this method has the side effect of calling add(field, + * n), where n is the return value. + * + *

Usage: To use this method, call it first with the largest + * field of interest, then with progressively smaller fields. For + * example: + * + *

+     * int y = cal->fieldDifference(when, Calendar::YEAR, err);
+     * int m = cal->fieldDifference(when, Calendar::MONTH, err);
+     * int d = cal->fieldDifference(when, Calendar::DATE, err);
+ * + * computes the difference between cal and + * when in years, months, and days. + * + *

Note: fieldDifference() is + * asymmetrical. That is, in the following code: + * + *

+     * cal->setTime(date1, err);
+     * int m1 = cal->fieldDifference(date2, Calendar::MONTH, err);
+     * int d1 = cal->fieldDifference(date2, Calendar::DATE, err);
+     * cal->setTime(date2, err);
+     * int m2 = cal->fieldDifference(date1, Calendar::MONTH, err);
+     * int d2 = cal->fieldDifference(date1, Calendar::DATE, err);
+ * + * one might expect that m1 == -m2 && d1 == -d2. + * However, this is not generally the case, because of + * irregularities in the underlying calendar system (e.g., the + * Gregorian calendar has a varying number of days per month). + * + * @param when the date to compare this calendar's time to + * @param field the field in which to compute the result + * @param status Output param set to success/failure code on exit. If any value + * previously set in the time field is invalid, this will be set to + * an error status. + * @return the difference, either positive or negative, between + * this calendar's time and when, in terms of + * field. + * @stable ICU 2.6. + */ + virtual int32_t fieldDifference(UDate when, UCalendarDateFields field, UErrorCode& status); + + /** + * Sets the calendar's time zone to be the one passed in. The Calendar takes ownership + * of the TimeZone; the caller is no longer responsible for deleting it. If the + * given time zone is NULL, this function has no effect. + * + * @param value The given time zone. + * @stable ICU 2.0 + */ + void adoptTimeZone(TimeZone* value); + + /** + * Sets the calendar's time zone to be the same as the one passed in. The TimeZone + * passed in is _not_ adopted; the client is still responsible for deleting it. + * + * @param zone The given time zone. + * @stable ICU 2.0 + */ + void setTimeZone(const TimeZone& zone); + + /** + * Returns a reference to the time zone owned by this calendar. The returned reference + * is only valid until clients make another call to adoptTimeZone or setTimeZone, + * or this Calendar is destroyed. + * + * @return The time zone object associated with this calendar. + * @stable ICU 2.0 + */ + const TimeZone& getTimeZone(void) const; + + /** + * Returns the time zone owned by this calendar. The caller owns the returned object + * and must delete it when done. After this call, the new time zone associated + * with this Calendar is the default TimeZone as returned by TimeZone::createDefault(). + * + * @return The time zone object which was associated with this calendar. + * @stable ICU 2.0 + */ + TimeZone* orphanTimeZone(void); + + /** + * Queries if the current date for this Calendar is in Daylight Savings Time. + * + * @param status Fill-in parameter which receives the status of this operation. + * @return True if the current date for this Calendar is in Daylight Savings Time, + * false, otherwise. + * @stable ICU 2.0 + */ + virtual UBool inDaylightTime(UErrorCode& status) const = 0; + + /** + * Specifies whether or not date/time interpretation is to be lenient. With lenient + * interpretation, a date such as "February 942, 1996" will be treated as being + * equivalent to the 941st day after February 1, 1996. With strict interpretation, + * such dates will cause an error when computing time from the time field values + * representing the dates. + * + * @param lenient True specifies date/time interpretation to be lenient. + * + * @see DateFormat#setLenient + * @stable ICU 2.0 + */ + void setLenient(UBool lenient); + + /** + * Tells whether date/time interpretation is to be lenient. + * + * @return True tells that date/time interpretation is to be lenient. + * @stable ICU 2.0 + */ + UBool isLenient(void) const; + + /** + * Sets the behavior for handling wall time repeating multiple times + * at negative time zone offset transitions. For example, 1:30 AM on + * November 6, 2011 in US Eastern time (Ameirca/New_York) occurs twice; + * 1:30 AM EDT, then 1:30 AM EST one hour later. When UCAL_WALLTIME_FIRST + * is used, the wall time 1:30AM in this example will be interpreted as 1:30 AM EDT + * (first occurrence). When UCAL_WALLTIME_LAST is used, it will be + * interpreted as 1:30 AM EST (last occurrence). The default value is + * UCAL_WALLTIME_LAST. + *

+ * Note:When UCAL_WALLTIME_NEXT_VALID is not a valid + * option for this. When the argument is neither UCAL_WALLTIME_FIRST + * nor UCAL_WALLTIME_LAST, this method has no effect and will keep + * the current setting. + * + * @param option the behavior for handling repeating wall time, either + * UCAL_WALLTIME_FIRST or UCAL_WALLTIME_LAST. + * @see #getRepeatedWallTimeOption + * @stable ICU 49 + */ + void setRepeatedWallTimeOption(UCalendarWallTimeOption option); + + /** + * Gets the behavior for handling wall time repeating multiple times + * at negative time zone offset transitions. + * + * @return the behavior for handling repeating wall time, either + * UCAL_WALLTIME_FIRST or UCAL_WALLTIME_LAST. + * @see #setRepeatedWallTimeOption + * @stable ICU 49 + */ + UCalendarWallTimeOption getRepeatedWallTimeOption(void) const; + + /** + * Sets the behavior for handling skipped wall time at positive time zone offset + * transitions. For example, 2:30 AM on March 13, 2011 in US Eastern time (America/New_York) + * does not exist because the wall time jump from 1:59 AM EST to 3:00 AM EDT. When + * UCAL_WALLTIME_FIRST is used, 2:30 AM is interpreted as 30 minutes before 3:00 AM + * EDT, therefore, it will be resolved as 1:30 AM EST. When UCAL_WALLTIME_LAST + * is used, 2:30 AM is interpreted as 31 minutes after 1:59 AM EST, therefore, it will be + * resolved as 3:30 AM EDT. When UCAL_WALLTIME_NEXT_VALID is used, 2:30 AM will + * be resolved as next valid wall time, that is 3:00 AM EDT. The default value is + * UCAL_WALLTIME_LAST. + *

+ * Note:This option is effective only when this calendar is lenient. + * When the calendar is strict, such non-existing wall time will cause an error. + * + * @param option the behavior for handling skipped wall time at positive time zone + * offset transitions, one of UCAL_WALLTIME_FIRST, UCAL_WALLTIME_LAST and + * UCAL_WALLTIME_NEXT_VALID. + * @see #getSkippedWallTimeOption + * + * @stable ICU 49 + */ + void setSkippedWallTimeOption(UCalendarWallTimeOption option); + + /** + * Gets the behavior for handling skipped wall time at positive time zone offset + * transitions. + * + * @return the behavior for handling skipped wall time, one of + * UCAL_WALLTIME_FIRST, UCAL_WALLTIME_LAST + * and UCAL_WALLTIME_NEXT_VALID. + * @see #setSkippedWallTimeOption + * @stable ICU 49 + */ + UCalendarWallTimeOption getSkippedWallTimeOption(void) const; + +#ifndef U_HIDE_DEPRECATED_API + /** + * Sets what the first day of the week is; e.g., Sunday in US, Monday in France. + * + * @param value The given first day of the week. + * @deprecated ICU 2.6. Use setFirstDayOfWeek(UCalendarDaysOfWeek value) instead. + */ + void setFirstDayOfWeek(EDaysOfWeek value); +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Sets what the first day of the week is; e.g., Sunday in US, Monday in France. + * + * @param value The given first day of the week. + * @stable ICU 2.6. + */ + void setFirstDayOfWeek(UCalendarDaysOfWeek value); + +#ifndef U_HIDE_DEPRECATED_API + /** + * Gets what the first day of the week is; e.g., Sunday in US, Monday in France. + * + * @return The first day of the week. + * @deprecated ICU 2.6 use the overload with error code + */ + EDaysOfWeek getFirstDayOfWeek(void) const; +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Gets what the first day of the week is; e.g., Sunday in US, Monday in France. + * + * @param status error code + * @return The first day of the week. + * @stable ICU 2.6 + */ + UCalendarDaysOfWeek getFirstDayOfWeek(UErrorCode &status) const; + + /** + * Sets what the minimal days required in the first week of the year are; For + * example, if the first week is defined as one that contains the first day of the + * first month of a year, call the method with value 1. If it must be a full week, + * use value 7. + * + * @param value The given minimal days required in the first week of the year. + * @stable ICU 2.0 + */ + void setMinimalDaysInFirstWeek(uint8_t value); + + /** + * Gets what the minimal days required in the first week of the year are; e.g., if + * the first week is defined as one that contains the first day of the first month + * of a year, getMinimalDaysInFirstWeek returns 1. If the minimal days required must + * be a full week, getMinimalDaysInFirstWeek returns 7. + * + * @return The minimal days required in the first week of the year. + * @stable ICU 2.0 + */ + uint8_t getMinimalDaysInFirstWeek(void) const; + + /** + * Gets the minimum value for the given time field. e.g., for Gregorian + * DAY_OF_MONTH, 1. + * + * @param field The given time field. + * @return The minimum value for the given time field. + * @deprecated ICU 2.6. Use getMinimum(UCalendarDateFields field) instead. + */ + virtual int32_t getMinimum(EDateFields field) const; + + /** + * Gets the minimum value for the given time field. e.g., for Gregorian + * DAY_OF_MONTH, 1. + * + * @param field The given time field. + * @return The minimum value for the given time field. + * @stable ICU 2.6. + */ + virtual int32_t getMinimum(UCalendarDateFields field) const; + + /** + * Gets the maximum value for the given time field. e.g. for Gregorian DAY_OF_MONTH, + * 31. + * + * @param field The given time field. + * @return The maximum value for the given time field. + * @deprecated ICU 2.6. Use getMaximum(UCalendarDateFields field) instead. + */ + virtual int32_t getMaximum(EDateFields field) const; + + /** + * Gets the maximum value for the given time field. e.g. for Gregorian DAY_OF_MONTH, + * 31. + * + * @param field The given time field. + * @return The maximum value for the given time field. + * @stable ICU 2.6. + */ + virtual int32_t getMaximum(UCalendarDateFields field) const; + + /** + * Gets the highest minimum value for the given field if varies. Otherwise same as + * getMinimum(). For Gregorian, no difference. + * + * @param field The given time field. + * @return The highest minimum value for the given time field. + * @deprecated ICU 2.6. Use getGreatestMinimum(UCalendarDateFields field) instead. + */ + virtual int32_t getGreatestMinimum(EDateFields field) const; + + /** + * Gets the highest minimum value for the given field if varies. Otherwise same as + * getMinimum(). For Gregorian, no difference. + * + * @param field The given time field. + * @return The highest minimum value for the given time field. + * @stable ICU 2.6. + */ + virtual int32_t getGreatestMinimum(UCalendarDateFields field) const; + + /** + * Gets the lowest maximum value for the given field if varies. Otherwise same as + * getMaximum(). e.g., for Gregorian DAY_OF_MONTH, 28. + * + * @param field The given time field. + * @return The lowest maximum value for the given time field. + * @deprecated ICU 2.6. Use getLeastMaximum(UCalendarDateFields field) instead. + */ + virtual int32_t getLeastMaximum(EDateFields field) const; + + /** + * Gets the lowest maximum value for the given field if varies. Otherwise same as + * getMaximum(). e.g., for Gregorian DAY_OF_MONTH, 28. + * + * @param field The given time field. + * @return The lowest maximum value for the given time field. + * @stable ICU 2.6. + */ + virtual int32_t getLeastMaximum(UCalendarDateFields field) const; + +#ifndef U_HIDE_DEPRECATED_API + /** + * Return the minimum value that this field could have, given the current date. + * For the Gregorian calendar, this is the same as getMinimum() and getGreatestMinimum(). + * + * The version of this function on Calendar uses an iterative algorithm to determine the + * actual minimum value for the field. There is almost always a more efficient way to + * accomplish this (in most cases, you can simply return getMinimum()). GregorianCalendar + * overrides this function with a more efficient implementation. + * + * @param field the field to determine the minimum of + * @param status Fill-in parameter which receives the status of this operation. + * @return the minimum of the given field for the current date of this Calendar + * @deprecated ICU 2.6. Use getActualMinimum(UCalendarDateFields field, UErrorCode& status) instead. + */ + int32_t getActualMinimum(EDateFields field, UErrorCode& status) const; +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Return the minimum value that this field could have, given the current date. + * For the Gregorian calendar, this is the same as getMinimum() and getGreatestMinimum(). + * + * The version of this function on Calendar uses an iterative algorithm to determine the + * actual minimum value for the field. There is almost always a more efficient way to + * accomplish this (in most cases, you can simply return getMinimum()). GregorianCalendar + * overrides this function with a more efficient implementation. + * + * @param field the field to determine the minimum of + * @param status Fill-in parameter which receives the status of this operation. + * @return the minimum of the given field for the current date of this Calendar + * @stable ICU 2.6. + */ + virtual int32_t getActualMinimum(UCalendarDateFields field, UErrorCode& status) const; + +#ifndef U_HIDE_DEPRECATED_API + /** + * Return the maximum value that this field could have, given the current date. + * For example, with the date "Feb 3, 1997" and the DAY_OF_MONTH field, the actual + * maximum would be 28; for "Feb 3, 1996" it s 29. Similarly for a Hebrew calendar, + * for some years the actual maximum for MONTH is 12, and for others 13. + * + * The version of this function on Calendar uses an iterative algorithm to determine the + * actual maximum value for the field. There is almost always a more efficient way to + * accomplish this (in most cases, you can simply return getMaximum()). GregorianCalendar + * overrides this function with a more efficient implementation. + * + * @param field the field to determine the maximum of + * @param status Fill-in parameter which receives the status of this operation. + * @return the maximum of the given field for the current date of this Calendar + * @deprecated ICU 2.6. Use getActualMaximum(UCalendarDateFields field, UErrorCode& status) instead. + */ + int32_t getActualMaximum(EDateFields field, UErrorCode& status) const; +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Return the maximum value that this field could have, given the current date. + * For example, with the date "Feb 3, 1997" and the DAY_OF_MONTH field, the actual + * maximum would be 28; for "Feb 3, 1996" it s 29. Similarly for a Hebrew calendar, + * for some years the actual maximum for MONTH is 12, and for others 13. + * + * The version of this function on Calendar uses an iterative algorithm to determine the + * actual maximum value for the field. There is almost always a more efficient way to + * accomplish this (in most cases, you can simply return getMaximum()). GregorianCalendar + * overrides this function with a more efficient implementation. + * + * @param field the field to determine the maximum of + * @param status Fill-in parameter which receives the status of this operation. + * @return the maximum of the given field for the current date of this Calendar + * @stable ICU 2.6. + */ + virtual int32_t getActualMaximum(UCalendarDateFields field, UErrorCode& status) const; + +#ifndef U_HIDE_DEPRECATED_API + /** + * Gets the value for a given time field. Recalculate the current time field values + * if the time value has been changed by a call to setTime(). Return zero for unset + * fields if any fields have been explicitly set by a call to set(). To force a + * recomputation of all fields regardless of the previous state, call complete(). + * This method is semantically const, but may alter the object in memory. + * + * @param field The given time field. + * @param status Fill-in parameter which receives the status of the operation. + * @return The value for the given time field, or zero if the field is unset, + * and set() has been called for any other field. + * @deprecated ICU 2.6. Use get(UCalendarDateFields field, UErrorCode& status) instead. + */ + int32_t get(EDateFields field, UErrorCode& status) const; +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Gets the value for a given time field. Recalculate the current time field values + * if the time value has been changed by a call to setTime(). Return zero for unset + * fields if any fields have been explicitly set by a call to set(). To force a + * recomputation of all fields regardless of the previous state, call complete(). + * This method is semantically const, but may alter the object in memory. + * + * @param field The given time field. + * @param status Fill-in parameter which receives the status of the operation. + * @return The value for the given time field, or zero if the field is unset, + * and set() has been called for any other field. + * @stable ICU 2.6. + */ + int32_t get(UCalendarDateFields field, UErrorCode& status) const; + +#ifndef U_HIDE_DEPRECATED_API + /** + * Determines if the given time field has a value set. This can affect in the + * resolving of time in Calendar. Unset fields have a value of zero, by definition. + * + * @param field The given time field. + * @return True if the given time field has a value set; false otherwise. + * @deprecated ICU 2.6. Use isSet(UCalendarDateFields field) instead. + */ + UBool isSet(EDateFields field) const; +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Determines if the given time field has a value set. This can affect in the + * resolving of time in Calendar. Unset fields have a value of zero, by definition. + * + * @param field The given time field. + * @return True if the given time field has a value set; false otherwise. + * @stable ICU 2.6. + */ + UBool isSet(UCalendarDateFields field) const; + +#ifndef U_HIDE_DEPRECATED_API + /** + * Sets the given time field with the given value. + * + * @param field The given time field. + * @param value The value to be set for the given time field. + * @deprecated ICU 2.6. Use set(UCalendarDateFields field, int32_t value) instead. + */ + void set(EDateFields field, int32_t value); +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Sets the given time field with the given value. + * + * @param field The given time field. + * @param value The value to be set for the given time field. + * @stable ICU 2.6. + */ + void set(UCalendarDateFields field, int32_t value); + + /** + * Sets the values for the fields YEAR, MONTH, and DATE. Other field values are + * retained; call clear() first if this is not desired. + * + * @param year The value used to set the YEAR time field. + * @param month The value used to set the MONTH time field. Month value is 0-based. + * e.g., 0 for January. + * @param date The value used to set the DATE time field. + * @stable ICU 2.0 + */ + void set(int32_t year, int32_t month, int32_t date); + + /** + * Sets the values for the fields YEAR, MONTH, DATE, HOUR_OF_DAY, and MINUTE. Other + * field values are retained; call clear() first if this is not desired. + * + * @param year The value used to set the YEAR time field. + * @param month The value used to set the MONTH time field. Month value is + * 0-based. E.g., 0 for January. + * @param date The value used to set the DATE time field. + * @param hour The value used to set the HOUR_OF_DAY time field. + * @param minute The value used to set the MINUTE time field. + * @stable ICU 2.0 + */ + void set(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute); + + /** + * Sets the values for the fields YEAR, MONTH, DATE, HOUR_OF_DAY, MINUTE, and SECOND. + * Other field values are retained; call clear() first if this is not desired. + * + * @param year The value used to set the YEAR time field. + * @param month The value used to set the MONTH time field. Month value is + * 0-based. E.g., 0 for January. + * @param date The value used to set the DATE time field. + * @param hour The value used to set the HOUR_OF_DAY time field. + * @param minute The value used to set the MINUTE time field. + * @param second The value used to set the SECOND time field. + * @stable ICU 2.0 + */ + void set(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute, int32_t second); + + /** + * Clears the values of all the time fields, making them both unset and assigning + * them a value of zero. The field values will be determined during the next + * resolving of time into time fields. + * @stable ICU 2.0 + */ + void clear(void); + +#ifndef U_HIDE_DEPRECATED_API + /** + * Clears the value in the given time field, both making it unset and assigning it a + * value of zero. This field value will be determined during the next resolving of + * time into time fields. + * + * @param field The time field to be cleared. + * @deprecated ICU 2.6. Use clear(UCalendarDateFields field) instead. + */ + void clear(EDateFields field); +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Clears the value in the given time field, both making it unset and assigning it a + * value of zero. This field value will be determined during the next resolving of + * time into time fields. + * + * @param field The time field to be cleared. + * @stable ICU 2.6. + */ + void clear(UCalendarDateFields field); + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual method. This method is to + * implement a simple version of RTTI, since not all C++ compilers support genuine + * RTTI. Polymorphic operator==() and clone() methods call this method. + *

+ * Concrete subclasses of Calendar must implement getDynamicClassID() and also a + * static method and data member: + * + * static UClassID getStaticClassID() { return (UClassID)&fgClassID; } + * static char fgClassID; + * + * @return The class ID for this object. All objects of a given class have the + * same class ID. Objects of other classes have different class IDs. + * @stable ICU 2.0 + */ + virtual UClassID getDynamicClassID(void) const = 0; + + /** + * Returns the calendar type name string for this Calendar object. + * The returned string is the legacy ICU calendar attribute value, + * for example, "gregorian" or "japanese". + * + * See type="old type name" for the calendar attribute of locale IDs + * at http://www.unicode.org/reports/tr35/#Key_Type_Definitions + * + * Sample code for getting the LDML/BCP 47 calendar key value: + * \code + * const char *calType = cal->getType(); + * if (0 == strcmp(calType, "unknown")) { + * // deal with unknown calendar type + * } else { + * string localeID("root@calendar="); + * localeID.append(calType); + * char langTag[100]; + * UErrorCode errorCode = U_ZERO_ERROR; + * int32_t length = uloc_toLanguageTag(localeID.c_str(), langTag, (int32_t)sizeof(langTag), TRUE, &errorCode); + * if (U_FAILURE(errorCode)) { + * // deal with errors & overflow + * } + * string lang(langTag, length); + * size_t caPos = lang.find("-ca-"); + * lang.erase(0, caPos + 4); + * // lang now contains the LDML calendar type + * } + * \endcode + * + * @return legacy calendar type name string + * @stable ICU 49 + */ + virtual const char * getType() const = 0; + + /** + * Returns whether the given day of the week is a weekday, a weekend day, + * or a day that transitions from one to the other, for the locale and + * calendar system associated with this Calendar (the locale's region is + * often the most determinant factor). If a transition occurs at midnight, + * then the days before and after the transition will have the + * type UCAL_WEEKDAY or UCAL_WEEKEND. If a transition occurs at a time + * other than midnight, then the day of the transition will have + * the type UCAL_WEEKEND_ONSET or UCAL_WEEKEND_CEASE. In this case, the + * method getWeekendTransition() will return the point of + * transition. + * @param dayOfWeek The day of the week whose type is desired (UCAL_SUNDAY..UCAL_SATURDAY). + * @param status The error code for the operation. + * @return The UCalendarWeekdayType for the day of the week. + * @stable ICU 4.4 + */ + virtual UCalendarWeekdayType getDayOfWeekType(UCalendarDaysOfWeek dayOfWeek, UErrorCode &status) const; + + /** + * Returns the time during the day at which the weekend begins or ends in + * this calendar system. If getDayOfWeekType() returns UCAL_WEEKEND_ONSET + * for the specified dayOfWeek, return the time at which the weekend begins. + * If getDayOfWeekType() returns UCAL_WEEKEND_CEASE for the specified dayOfWeek, + * return the time at which the weekend ends. If getDayOfWeekType() returns + * some other UCalendarWeekdayType for the specified dayOfWeek, is it an error condition + * (U_ILLEGAL_ARGUMENT_ERROR). + * @param dayOfWeek The day of the week for which the weekend transition time is + * desired (UCAL_SUNDAY..UCAL_SATURDAY). + * @param status The error code for the operation. + * @return The milliseconds after midnight at which the weekend begins or ends. + * @stable ICU 4.4 + */ + virtual int32_t getWeekendTransition(UCalendarDaysOfWeek dayOfWeek, UErrorCode &status) const; + + /** + * Returns TRUE if the given UDate is in the weekend in + * this calendar system. + * @param date The UDate in question. + * @param status The error code for the operation. + * @return TRUE if the given UDate is in the weekend in + * this calendar system, FALSE otherwise. + * @stable ICU 4.4 + */ + virtual UBool isWeekend(UDate date, UErrorCode &status) const; + + /** + * Returns TRUE if this Calendar's current date-time is in the weekend in + * this calendar system. + * @return TRUE if this Calendar's current date-time is in the weekend in + * this calendar system, FALSE otherwise. + * @stable ICU 4.4 + */ + virtual UBool isWeekend(void) const; + +protected: + + /** + * Constructs a Calendar with the default time zone as returned by + * TimeZone::createInstance(), and the default locale. + * + * @param success Indicates the status of Calendar object construction. Returns + * U_ZERO_ERROR if constructed successfully. + * @stable ICU 2.0 + */ + Calendar(UErrorCode& success); + + /** + * Copy constructor + * + * @param source Calendar object to be copied from + * @stable ICU 2.0 + */ + Calendar(const Calendar& source); + + /** + * Default assignment operator + * + * @param right Calendar object to be copied + * @stable ICU 2.0 + */ + Calendar& operator=(const Calendar& right); + + /** + * Constructs a Calendar with the given time zone and locale. Clients are no longer + * responsible for deleting the given time zone object after it's adopted. + * + * @param zone The given time zone. + * @param aLocale The given locale. + * @param success Indicates the status of Calendar object construction. Returns + * U_ZERO_ERROR if constructed successfully. + * @stable ICU 2.0 + */ + Calendar(TimeZone* zone, const Locale& aLocale, UErrorCode& success); + + /** + * Constructs a Calendar with the given time zone and locale. + * + * @param zone The given time zone. + * @param aLocale The given locale. + * @param success Indicates the status of Calendar object construction. Returns + * U_ZERO_ERROR if constructed successfully. + * @stable ICU 2.0 + */ + Calendar(const TimeZone& zone, const Locale& aLocale, UErrorCode& success); + + /** + * Converts Calendar's time field values to GMT as milliseconds. + * + * @param status Output param set to success/failure code on exit. If any value + * previously set in the time field is invalid or restricted by + * leniency, this will be set to an error status. + * @stable ICU 2.0 + */ + virtual void computeTime(UErrorCode& status); + + /** + * Converts GMT as milliseconds to time field values. This allows you to sync up the + * time field values with a new time that is set for the calendar. This method + * does NOT recompute the time first; to recompute the time, then the fields, use + * the method complete(). + * + * @param status Output param set to success/failure code on exit. If any value + * previously set in the time field is invalid or restricted by + * leniency, this will be set to an error status. + * @stable ICU 2.0 + */ + virtual void computeFields(UErrorCode& status); + + /** + * Gets this Calendar's current time as a long. + * + * @param status Output param set to success/failure code on exit. If any value + * previously set in the time field is invalid or restricted by + * leniency, this will be set to an error status. + * @return the current time as UTC milliseconds from the epoch. + * @stable ICU 2.0 + */ + double getTimeInMillis(UErrorCode& status) const; + + /** + * Sets this Calendar's current time from the given long value. + * @param millis the new time in UTC milliseconds from the epoch. + * @param status Output param set to success/failure code on exit. If any value + * previously set in the time field is invalid or restricted by + * leniency, this will be set to an error status. + * @stable ICU 2.0 + */ + void setTimeInMillis( double millis, UErrorCode& status ); + + /** + * Recomputes the current time from currently set fields, and then fills in any + * unset fields in the time field list. + * + * @param status Output param set to success/failure code on exit. If any value + * previously set in the time field is invalid or restricted by + * leniency, this will be set to an error status. + * @stable ICU 2.0 + */ + void complete(UErrorCode& status); + +#ifndef U_HIDE_DEPRECATED_API + /** + * Gets the value for a given time field. Subclasses can use this function to get + * field values without forcing recomputation of time. + * + * @param field The given time field. + * @return The value for the given time field. + * @deprecated ICU 2.6. Use internalGet(UCalendarDateFields field) instead. + */ + inline int32_t internalGet(EDateFields field) const {return fFields[field];} +#endif /* U_HIDE_DEPRECATED_API */ + +#ifndef U_HIDE_INTERNAL_API + /** + * Gets the value for a given time field. Subclasses can use this function to get + * field values without forcing recomputation of time. If the field's stamp is UNSET, + * the defaultValue is used. + * + * @param field The given time field. + * @param defaultValue a default value used if the field is unset. + * @return The value for the given time field. + * @internal + */ + inline int32_t internalGet(UCalendarDateFields field, int32_t defaultValue) const {return fStamp[field]>kUnset ? fFields[field] : defaultValue;} + + /** + * Gets the value for a given time field. Subclasses can use this function to get + * field values without forcing recomputation of time. + * + * @param field The given time field. + * @return The value for the given time field. + * @internal + */ + inline int32_t internalGet(UCalendarDateFields field) const {return fFields[field];} +#endif /* U_HIDE_INTERNAL_API */ + +#ifndef U_HIDE_DEPRECATED_API + /** + * Sets the value for a given time field. This is a fast internal method for + * subclasses. It does not affect the areFieldsInSync, isTimeSet, or areAllFieldsSet + * flags. + * + * @param field The given time field. + * @param value The value for the given time field. + * @deprecated ICU 2.6. Use internalSet(UCalendarDateFields field, int32_t value) instead. + */ + void internalSet(EDateFields field, int32_t value); +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Sets the value for a given time field. This is a fast internal method for + * subclasses. It does not affect the areFieldsInSync, isTimeSet, or areAllFieldsSet + * flags. + * + * @param field The given time field. + * @param value The value for the given time field. + * @stable ICU 2.6. + */ + inline void internalSet(UCalendarDateFields field, int32_t value); + + /** + * Prepare this calendar for computing the actual minimum or maximum. + * This method modifies this calendar's fields; it is called on a + * temporary calendar. + * @internal + */ + virtual void prepareGetActual(UCalendarDateFields field, UBool isMinimum, UErrorCode &status); + + /** + * Limit enums. Not in sync with UCalendarLimitType (refers to internal fields). + * @internal + */ + enum ELimitType { +#ifndef U_HIDE_INTERNAL_API + UCAL_LIMIT_MINIMUM = 0, + UCAL_LIMIT_GREATEST_MINIMUM, + UCAL_LIMIT_LEAST_MAXIMUM, + UCAL_LIMIT_MAXIMUM, + UCAL_LIMIT_COUNT +#endif /* U_HIDE_INTERNAL_API */ + }; + + /** + * Subclass API for defining limits of different types. + * Subclasses must implement this method to return limits for the + * following fields: + * + *

UCAL_ERA
+     * UCAL_YEAR
+     * UCAL_MONTH
+     * UCAL_WEEK_OF_YEAR
+     * UCAL_WEEK_OF_MONTH
+     * UCAL_DATE (DAY_OF_MONTH on Java)
+     * UCAL_DAY_OF_YEAR
+     * UCAL_DAY_OF_WEEK_IN_MONTH
+     * UCAL_YEAR_WOY
+     * UCAL_EXTENDED_YEAR
+ * + * @param field one of the above field numbers + * @param limitType one of MINIMUM, GREATEST_MINIMUM, + * LEAST_MAXIMUM, or MAXIMUM + * @internal + */ + virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const = 0; + + /** + * Return a limit for a field. + * @param field the field, from 0..UCAL_MAX_FIELD + * @param limitType the type specifier for the limit + * @see #ELimitType + * @internal + */ + virtual int32_t getLimit(UCalendarDateFields field, ELimitType limitType) const; + + + /** + * Return the Julian day number of day before the first day of the + * given month in the given extended year. Subclasses should override + * this method to implement their calendar system. + * @param eyear the extended year + * @param month the zero-based month, or 0 if useMonth is false + * @param useMonth if false, compute the day before the first day of + * the given year, otherwise, compute the day before the first day of + * the given month + * @return the Julian day number of the day before the first + * day of the given month and year + * @internal + */ + virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month, + UBool useMonth) const = 0; + + /** + * Return the number of days in the given month of the given extended + * year of this calendar system. Subclasses should override this + * method if they can provide a more correct or more efficient + * implementation than the default implementation in Calendar. + * @internal + */ + virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const ; + + /** + * Return the number of days in the given extended year of this + * calendar system. Subclasses should override this method if they can + * provide a more correct or more efficient implementation than the + * default implementation in Calendar. + * @stable ICU 2.0 + */ + virtual int32_t handleGetYearLength(int32_t eyear) const; + + + /** + * Return the extended year defined by the current fields. This will + * use the UCAL_EXTENDED_YEAR field or the UCAL_YEAR and supra-year fields (such + * as UCAL_ERA) specific to the calendar system, depending on which set of + * fields is newer. + * @return the extended year + * @internal + */ + virtual int32_t handleGetExtendedYear() = 0; + + /** + * Subclasses may override this. This method calls + * handleGetMonthLength() to obtain the calendar-specific month + * length. + * @param bestField which field to use to calculate the date + * @return julian day specified by calendar fields. + * @internal + */ + virtual int32_t handleComputeJulianDay(UCalendarDateFields bestField); + + /** + * Subclasses must override this to convert from week fields + * (YEAR_WOY and WEEK_OF_YEAR) to an extended year in the case + * where YEAR, EXTENDED_YEAR are not set. + * The Calendar implementation assumes yearWoy is in extended gregorian form + * @return the extended year, UCAL_EXTENDED_YEAR + * @internal + */ + virtual int32_t handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t woy); + + /** + * Validate a single field of this calendar. Subclasses should + * override this method to validate any calendar-specific fields. + * Generic fields can be handled by + * Calendar::validateField(). + * @see #validateField(int, int, int, int&) + * @internal + */ + virtual void validateField(UCalendarDateFields field, UErrorCode &status); + +#ifndef U_HIDE_INTERNAL_API + /** + * Compute the Julian day from fields. Will determine whether to use + * the JULIAN_DAY field directly, or other fields. + * @return the julian day + * @internal + */ + int32_t computeJulianDay(); + + /** + * Compute the milliseconds in the day from the fields. This is a + * value from 0 to 23:59:59.999 inclusive, unless fields are out of + * range, in which case it can be an arbitrary value. This value + * reflects local zone wall time. + * @internal + */ + double computeMillisInDay(); + + /** + * This method can assume EXTENDED_YEAR has been set. + * @param millis milliseconds of the date fields + * @param millisInDay milliseconds of the time fields; may be out + * or range. + * @param ec Output param set to failure code on function return + * when this function fails. + * @internal + */ + int32_t computeZoneOffset(double millis, double millisInDay, UErrorCode &ec); + + + /** + * Determine the best stamp in a range. + * @param start first enum to look at + * @param end last enum to look at + * @param bestSoFar stamp prior to function call + * @return the stamp value of the best stamp + * @internal + */ + int32_t newestStamp(UCalendarDateFields start, UCalendarDateFields end, int32_t bestSoFar) const; + + /** + * Values for field resolution tables + * @see #resolveFields + * @internal + */ + enum { + /** Marker for end of resolve set (row or group). */ + kResolveSTOP = -1, + /** Value to be bitwised "ORed" against resolve table field values for remapping. Example: (UCAL_DATE | kResolveRemap) in 1st column will cause 'UCAL_DATE' to be returned, but will not examine the value of UCAL_DATE. */ + kResolveRemap = 32 + }; + + /** + * Precedence table for Dates + * @see #resolveFields + * @internal + */ + static const UFieldResolutionTable kDatePrecedence[]; + + /** + * Precedence table for Year + * @see #resolveFields + * @internal + */ + static const UFieldResolutionTable kYearPrecedence[]; + + /** + * Precedence table for Day of Week + * @see #resolveFields + * @internal + */ + static const UFieldResolutionTable kDOWPrecedence[]; + + /** + * Given a precedence table, return the newest field combination in + * the table, or UCAL_FIELD_COUNT if none is found. + * + *

The precedence table is a 3-dimensional array of integers. It + * may be thought of as an array of groups. Each group is an array of + * lines. Each line is an array of field numbers. Within a line, if + * all fields are set, then the time stamp of the line is taken to be + * the stamp of the most recently set field. If any field of a line is + * unset, then the line fails to match. Within a group, the line with + * the newest time stamp is selected. The first field of the line is + * returned to indicate which line matched. + * + *

In some cases, it may be desirable to map a line to field that + * whose stamp is NOT examined. For example, if the best field is + * DAY_OF_WEEK then the DAY_OF_WEEK_IN_MONTH algorithm may be used. In + * order to do this, insert the value kResolveRemap | F at + * the start of the line, where F is the desired return + * field value. This field will NOT be examined; it only determines + * the return value if the other fields in the line are the newest. + * + *

If all lines of a group contain at least one unset field, then no + * line will match, and the group as a whole will fail to match. In + * that case, the next group will be processed. If all groups fail to + * match, then UCAL_FIELD_COUNT is returned. + * @internal + */ + UCalendarDateFields resolveFields(const UFieldResolutionTable *precedenceTable); +#endif /* U_HIDE_INTERNAL_API */ + + + /** + * @internal + */ + virtual const UFieldResolutionTable* getFieldResolutionTable() const; + +#ifndef U_HIDE_INTERNAL_API + /** + * Return the field that is newer, either defaultField, or + * alternateField. If neither is newer or neither is set, return defaultField. + * @internal + */ + UCalendarDateFields newerField(UCalendarDateFields defaultField, UCalendarDateFields alternateField) const; +#endif /* U_HIDE_INTERNAL_API */ + + +private: + /** + * Helper function for calculating limits by trial and error + * @param field The field being investigated + * @param startValue starting (least max) value of field + * @param endValue ending (greatest max) value of field + * @param status return type + * @internal + */ + int32_t getActualHelper(UCalendarDateFields field, int32_t startValue, int32_t endValue, UErrorCode &status) const; + + +protected: + /** + * The flag which indicates if the current time is set in the calendar. + * @stable ICU 2.0 + */ + UBool fIsTimeSet; + + /** + * True if the fields are in sync with the currently set time of this Calendar. + * If false, then the next attempt to get the value of a field will + * force a recomputation of all fields from the current value of the time + * field. + *

+ * This should really be named areFieldsInSync, but the old name is retained + * for backward compatibility. + * @stable ICU 2.0 + */ + UBool fAreFieldsSet; + + /** + * True if all of the fields have been set. This is initially false, and set to + * true by computeFields(). + * @stable ICU 2.0 + */ + UBool fAreAllFieldsSet; + + /** + * True if all fields have been virtually set, but have not yet been + * computed. This occurs only in setTimeInMillis(). A calendar set + * to this state will compute all fields from the time if it becomes + * necessary, but otherwise will delay such computation. + * @stable ICU 3.0 + */ + UBool fAreFieldsVirtuallySet; + + /** + * Get the current time without recomputing. + * + * @return the current time without recomputing. + * @stable ICU 2.0 + */ + UDate internalGetTime(void) const { return fTime; } + + /** + * Set the current time without affecting flags or fields. + * + * @param time The time to be set + * @return the current time without recomputing. + * @stable ICU 2.0 + */ + void internalSetTime(UDate time) { fTime = time; } + + /** + * The time fields containing values into which the millis is computed. + * @stable ICU 2.0 + */ + int32_t fFields[UCAL_FIELD_COUNT]; + + /** + * The flags which tell if a specified time field for the calendar is set. + * @deprecated ICU 2.8 use (fStamp[n]!=kUnset) + */ + UBool fIsSet[UCAL_FIELD_COUNT]; + + /** Special values of stamp[] + * @stable ICU 2.0 + */ + enum { + kUnset = 0, + kInternallySet, + kMinimumUserStamp + }; + + /** + * Pseudo-time-stamps which specify when each field was set. There + * are two special values, UNSET and INTERNALLY_SET. Values from + * MINIMUM_USER_SET to Integer.MAX_VALUE are legal user set values. + * @stable ICU 2.0 + */ + int32_t fStamp[UCAL_FIELD_COUNT]; + + /** + * Subclasses may override this method to compute several fields + * specific to each calendar system. These are: + * + *

  • ERA + *
  • YEAR + *
  • MONTH + *
  • DAY_OF_MONTH + *
  • DAY_OF_YEAR + *
  • EXTENDED_YEAR
+ * + * Subclasses can refer to the DAY_OF_WEEK and DOW_LOCAL fields, which + * will be set when this method is called. Subclasses can also call + * the getGregorianXxx() methods to obtain Gregorian calendar + * equivalents for the given Julian day. + * + *

In addition, subclasses should compute any subclass-specific + * fields, that is, fields from BASE_FIELD_COUNT to + * getFieldCount() - 1. + * + *

The default implementation in Calendar implements + * a pure proleptic Gregorian calendar. + * @internal + */ + virtual void handleComputeFields(int32_t julianDay, UErrorCode &status); + +#ifndef U_HIDE_INTERNAL_API + /** + * Return the extended year on the Gregorian calendar as computed by + * computeGregorianFields(). + * @internal + */ + int32_t getGregorianYear() const { + return fGregorianYear; + } + + /** + * Return the month (0-based) on the Gregorian calendar as computed by + * computeGregorianFields(). + * @internal + */ + int32_t getGregorianMonth() const { + return fGregorianMonth; + } + + /** + * Return the day of year (1-based) on the Gregorian calendar as + * computed by computeGregorianFields(). + * @internal + */ + int32_t getGregorianDayOfYear() const { + return fGregorianDayOfYear; + } + + /** + * Return the day of month (1-based) on the Gregorian calendar as + * computed by computeGregorianFields(). + * @internal + */ + int32_t getGregorianDayOfMonth() const { + return fGregorianDayOfMonth; + } +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Called by computeJulianDay. Returns the default month (0-based) for the year, + * taking year and era into account. Defaults to 0 for Gregorian, which doesn't care. + * @param eyear The extended year + * @internal + */ + virtual int32_t getDefaultMonthInYear(int32_t eyear) ; + + + /** + * Called by computeJulianDay. Returns the default day (1-based) for the month, + * taking currently-set year and era into account. Defaults to 1 for Gregorian. + * @param eyear the extended year + * @param month the month in the year + * @internal + */ + virtual int32_t getDefaultDayInMonth(int32_t eyear, int32_t month); + + //------------------------------------------------------------------------- + // Protected utility methods for use by subclasses. These are very handy + // for implementing add, roll, and computeFields. + //------------------------------------------------------------------------- + + /** + * Adjust the specified field so that it is within + * the allowable range for the date to which this calendar is set. + * For example, in a Gregorian calendar pinning the {@link #UCalendarDateFields DAY_OF_MONTH} + * field for a calendar set to April 31 would cause it to be set + * to April 30. + *

+ * Subclassing: + *
+ * This utility method is intended for use by subclasses that need to implement + * their own overrides of {@link #roll roll} and {@link #add add}. + *

+ * Note: + * pinField is implemented in terms of + * {@link #getActualMinimum getActualMinimum} + * and {@link #getActualMaximum getActualMaximum}. If either of those methods uses + * a slow, iterative algorithm for a particular field, it would be + * unwise to attempt to call pinField for that field. If you + * really do need to do so, you should override this method to do + * something more efficient for that field. + *

+ * @param field The calendar field whose value should be pinned. + * @param status Output param set to failure code on function return + * when this function fails. + * + * @see #getActualMinimum + * @see #getActualMaximum + * @stable ICU 2.0 + */ + virtual void pinField(UCalendarDateFields field, UErrorCode& status); + + /** + * Return the week number of a day, within a period. This may be the week number in + * a year or the week number in a month. Usually this will be a value >= 1, but if + * some initial days of the period are excluded from week 1, because + * {@link #getMinimalDaysInFirstWeek getMinimalDaysInFirstWeek} is > 1, then + * the week number will be zero for those + * initial days. This method requires the day number and day of week for some + * known date in the period in order to determine the day of week + * on the desired day. + *

+ * Subclassing: + *
+ * This method is intended for use by subclasses in implementing their + * {@link #computeTime computeTime} and/or {@link #computeFields computeFields} methods. + * It is often useful in {@link #getActualMinimum getActualMinimum} and + * {@link #getActualMaximum getActualMaximum} as well. + *

+ * This variant is handy for computing the week number of some other + * day of a period (often the first or last day of the period) when its day + * of the week is not known but the day number and day of week for some other + * day in the period (e.g. the current date) is known. + *

+ * @param desiredDay The {@link #UCalendarDateFields DAY_OF_YEAR} or + * {@link #UCalendarDateFields DAY_OF_MONTH} whose week number is desired. + * Should be 1 for the first day of the period. + * + * @param dayOfPeriod The {@link #UCalendarDateFields DAY_OF_YEAR} + * or {@link #UCalendarDateFields DAY_OF_MONTH} for a day in the period whose + * {@link #UCalendarDateFields DAY_OF_WEEK} is specified by the + * knownDayOfWeek parameter. + * Should be 1 for first day of period. + * + * @param dayOfWeek The {@link #UCalendarDateFields DAY_OF_WEEK} for the day + * corresponding to the knownDayOfPeriod parameter. + * 1-based with 1=Sunday. + * + * @return The week number (one-based), or zero if the day falls before + * the first week because + * {@link #getMinimalDaysInFirstWeek getMinimalDaysInFirstWeek} + * is more than one. + * + * @stable ICU 2.8 + */ + int32_t weekNumber(int32_t desiredDay, int32_t dayOfPeriod, int32_t dayOfWeek); + + +#ifndef U_HIDE_INTERNAL_API + /** + * Return the week number of a day, within a period. This may be the week number in + * a year, or the week number in a month. Usually this will be a value >= 1, but if + * some initial days of the period are excluded from week 1, because + * {@link #getMinimalDaysInFirstWeek getMinimalDaysInFirstWeek} is > 1, + * then the week number will be zero for those + * initial days. This method requires the day of week for the given date in order to + * determine the result. + *

+ * Subclassing: + *
+ * This method is intended for use by subclasses in implementing their + * {@link #computeTime computeTime} and/or {@link #computeFields computeFields} methods. + * It is often useful in {@link #getActualMinimum getActualMinimum} and + * {@link #getActualMaximum getActualMaximum} as well. + *

+ * @param dayOfPeriod The {@link #UCalendarDateFields DAY_OF_YEAR} or + * {@link #UCalendarDateFields DAY_OF_MONTH} whose week number is desired. + * Should be 1 for the first day of the period. + * + * @param dayOfWeek The {@link #UCalendarDateFields DAY_OF_WEEK} for the day + * corresponding to the dayOfPeriod parameter. + * 1-based with 1=Sunday. + * + * @return The week number (one-based), or zero if the day falls before + * the first week because + * {@link #getMinimalDaysInFirstWeek getMinimalDaysInFirstWeek} + * is more than one. + * @internal + */ + inline int32_t weekNumber(int32_t dayOfPeriod, int32_t dayOfWeek); + + /** + * returns the local DOW, valid range 0..6 + * @internal + */ + int32_t getLocalDOW(); +#endif /* U_HIDE_INTERNAL_API */ + +private: + + /** + * The next available value for fStamp[] + */ + int32_t fNextStamp;// = MINIMUM_USER_STAMP; + + /** + * Recalculates the time stamp array (fStamp). + * Resets fNextStamp to lowest next stamp value. + */ + void recalculateStamp(); + + /** + * The current time set for the calendar. + */ + UDate fTime; + + /** + * @see #setLenient + */ + UBool fLenient; + + /** + * Time zone affects the time calculation done by Calendar. Calendar subclasses use + * the time zone data to produce the local time. Always set; never NULL. + */ + TimeZone* fZone; + + /** + * Option for rpeated wall time + * @see #setRepeatedWallTimeOption + */ + UCalendarWallTimeOption fRepeatedWallTime; + + /** + * Option for skipped wall time + * @see #setSkippedWallTimeOption + */ + UCalendarWallTimeOption fSkippedWallTime; + + /** + * Both firstDayOfWeek and minimalDaysInFirstWeek are locale-dependent. They are + * used to figure out the week count for a specific date for a given locale. These + * must be set when a Calendar is constructed. For example, in US locale, + * firstDayOfWeek is SUNDAY; minimalDaysInFirstWeek is 1. They are used to figure + * out the week count for a specific date for a given locale. These must be set when + * a Calendar is constructed. + */ + UCalendarDaysOfWeek fFirstDayOfWeek; + uint8_t fMinimalDaysInFirstWeek; + UCalendarDaysOfWeek fWeekendOnset; + int32_t fWeekendOnsetMillis; + UCalendarDaysOfWeek fWeekendCease; + int32_t fWeekendCeaseMillis; + + /** + * Sets firstDayOfWeek and minimalDaysInFirstWeek. Called at Calendar construction + * time. + * + * @param desiredLocale The given locale. + * @param type The calendar type identifier, e.g: gregorian, buddhist, etc. + * @param success Indicates the status of setting the week count data from + * the resource for the given locale. Returns U_ZERO_ERROR if + * constructed successfully. + */ + void setWeekData(const Locale& desiredLocale, const char *type, UErrorCode& success); + + /** + * Recompute the time and update the status fields isTimeSet + * and areFieldsSet. Callers should check isTimeSet and only + * call this method if isTimeSet is false. + * + * @param status Output param set to success/failure code on exit. If any value + * previously set in the time field is invalid or restricted by + * leniency, this will be set to an error status. + */ + void updateTime(UErrorCode& status); + + /** + * The Gregorian year, as computed by computeGregorianFields() and + * returned by getGregorianYear(). + * @see #computeGregorianFields + */ + int32_t fGregorianYear; + + /** + * The Gregorian month, as computed by computeGregorianFields() and + * returned by getGregorianMonth(). + * @see #computeGregorianFields + */ + int32_t fGregorianMonth; + + /** + * The Gregorian day of the year, as computed by + * computeGregorianFields() and returned by getGregorianDayOfYear(). + * @see #computeGregorianFields + */ + int32_t fGregorianDayOfYear; + + /** + * The Gregorian day of the month, as computed by + * computeGregorianFields() and returned by getGregorianDayOfMonth(). + * @see #computeGregorianFields + */ + int32_t fGregorianDayOfMonth; + + /* calculations */ + + /** + * Compute the Gregorian calendar year, month, and day of month from + * the given Julian day. These values are not stored in fields, but in + * member variables gregorianXxx. Also compute the DAY_OF_WEEK and + * DOW_LOCAL fields. + */ + void computeGregorianAndDOWFields(int32_t julianDay, UErrorCode &ec); + +protected: + + /** + * Compute the Gregorian calendar year, month, and day of month from the + * Julian day. These values are not stored in fields, but in member + * variables gregorianXxx. They are used for time zone computations and by + * subclasses that are Gregorian derivatives. Subclasses may call this + * method to perform a Gregorian calendar millis->fields computation. + */ + void computeGregorianFields(int32_t julianDay, UErrorCode &ec); + +private: + + /** + * Compute the fields WEEK_OF_YEAR, YEAR_WOY, WEEK_OF_MONTH, + * DAY_OF_WEEK_IN_MONTH, and DOW_LOCAL from EXTENDED_YEAR, YEAR, + * DAY_OF_WEEK, and DAY_OF_YEAR. The latter fields are computed by the + * subclass based on the calendar system. + * + *

The YEAR_WOY field is computed simplistically. It is equal to YEAR + * most of the time, but at the year boundary it may be adjusted to YEAR-1 + * or YEAR+1 to reflect the overlap of a week into an adjacent year. In + * this case, a simple increment or decrement is performed on YEAR, even + * though this may yield an invalid YEAR value. For instance, if the YEAR + * is part of a calendar system with an N-year cycle field CYCLE, then + * incrementing the YEAR may involve incrementing CYCLE and setting YEAR + * back to 0 or 1. This is not handled by this code, and in fact cannot be + * simply handled without having subclasses define an entire parallel set of + * fields for fields larger than or equal to a year. This additional + * complexity is not warranted, since the intention of the YEAR_WOY field is + * to support ISO 8601 notation, so it will typically be used with a + * proleptic Gregorian calendar, which has no field larger than a year. + */ + void computeWeekFields(UErrorCode &ec); + + + /** + * Ensure that each field is within its valid range by calling {@link + * #validateField(int, int&)} on each field that has been set. This method + * should only be called if this calendar is not lenient. + * @see #isLenient + * @see #validateField(int, int&) + * @internal + */ + void validateFields(UErrorCode &status); + + /** + * Validate a single field of this calendar given its minimum and + * maximum allowed value. If the field is out of range, + * U_ILLEGAL_ARGUMENT_ERROR will be set. Subclasses may + * use this method in their implementation of {@link + * #validateField(int, int&)}. + * @internal + */ + void validateField(UCalendarDateFields field, int32_t min, int32_t max, UErrorCode& status); + + protected: +#ifndef U_HIDE_INTERNAL_API + /** + * Convert a quasi Julian date to the day of the week. The Julian date used here is + * not a true Julian date, since it is measured from midnight, not noon. Return + * value is one-based. + * + * @param julian The given Julian date number. + * @return Day number from 1..7 (SUN..SAT). + * @internal + */ + static uint8_t julianDayToDayOfWeek(double julian); +#endif /* U_HIDE_INTERNAL_API */ + + private: + char validLocale[ULOC_FULLNAME_CAPACITY]; + char actualLocale[ULOC_FULLNAME_CAPACITY]; + + public: +#if !UCONFIG_NO_SERVICE + /** + * INTERNAL FOR 2.6 -- Registration. + */ + +#ifndef U_HIDE_INTERNAL_API + /** + * Return a StringEnumeration over the locales available at the time of the call, + * including registered locales. + * @return a StringEnumeration over the locales available at the time of the call + * @internal + */ + static StringEnumeration* getAvailableLocales(void); + + /** + * Register a new Calendar factory. The factory will be adopted. + * INTERNAL in 2.6 + * + * Because ICU may choose to cache Calendars internally, this must + * be called at application startup, prior to any calls to + * Calendar::createInstance to avoid undefined behavior. + * + * @param toAdopt the factory instance to be adopted + * @param status the in/out status code, no special meanings are assigned + * @return a registry key that can be used to unregister this factory + * @internal + */ + static URegistryKey registerFactory(ICUServiceFactory* toAdopt, UErrorCode& status); + + /** + * Unregister a previously-registered CalendarFactory using the key returned from the + * register call. Key becomes invalid after a successful call and should not be used again. + * The CalendarFactory corresponding to the key will be deleted. + * INTERNAL in 2.6 + * + * Because ICU may choose to cache Calendars internally, this should + * be called during application shutdown, after all calls to + * Calendar::createInstance to avoid undefined behavior. + * + * @param key the registry key returned by a previous call to registerFactory + * @param status the in/out status code, no special meanings are assigned + * @return TRUE if the factory for the key was successfully unregistered + * @internal + */ + static UBool unregister(URegistryKey key, UErrorCode& status); +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Multiple Calendar Implementation + * @internal + */ + friend class CalendarFactory; + + /** + * Multiple Calendar Implementation + * @internal + */ + friend class CalendarService; + + /** + * Multiple Calendar Implementation + * @internal + */ + friend class DefaultCalendarFactory; +#endif /* !UCONFIG_NO_SERVICE */ + + /** + * @return TRUE if this calendar has a default century (i.e. 03 -> 2003) + * @internal + */ + virtual UBool haveDefaultCentury() const = 0; + + /** + * @return the start of the default century, as a UDate + * @internal + */ + virtual UDate defaultCenturyStart() const = 0; + /** + * @return the beginning year of the default century, as a year + * @internal + */ + virtual int32_t defaultCenturyStartYear() const = 0; + + /** Get the locale for this calendar object. You can choose between valid and actual locale. + * @param type type of the locale we're looking for (valid or actual) + * @param status error code for the operation + * @return the locale + * @stable ICU 2.8 + */ + Locale getLocale(ULocDataLocaleType type, UErrorCode &status) const; + + /** + * @return The related Gregorian year; will be obtained by modifying the value + * obtained by get from UCAL_EXTENDED_YEAR field + * @internal + */ + virtual int32_t getRelatedYear(UErrorCode &status) const; + + /** + * @param year The related Gregorian year to set; will be modified as necessary then + * set in UCAL_EXTENDED_YEAR field + * @internal + */ + virtual void setRelatedYear(int32_t year); + +#ifndef U_HIDE_INTERNAL_API + /** Get the locale for this calendar object. You can choose between valid and actual locale. + * @param type type of the locale we're looking for (valid or actual) + * @param status error code for the operation + * @return the locale + * @internal + */ + const char* getLocaleID(ULocDataLocaleType type, UErrorCode &status) const; +#endif /* U_HIDE_INTERNAL_API */ + +private: + /** + * Cast TimeZone used by this object to BasicTimeZone, or NULL if the TimeZone + * is not an instance of BasicTimeZone. + */ + BasicTimeZone* getBasicTimeZone() const; + + /** + * Find the previous zone transtion near the given time. + * @param base The base time, inclusive + * @param transitionTime Receives the result time + * @param status The error status + * @return TRUE if a transition is found. + */ + UBool getImmediatePreviousZoneTransition(UDate base, UDate *transitionTime, UErrorCode& status) const; + +public: +#ifndef U_HIDE_INTERNAL_API + /** + * Creates a new Calendar from a Locale for the cache. + * This method does not set the time or timezone in returned calendar. + * @param locale the locale. + * @param status any error returned here. + * @return the new Calendar object with no time or timezone set. + * @internal For ICU use only. + */ + static Calendar * U_EXPORT2 makeInstance( + const Locale &locale, UErrorCode &status); + + /** + * Get the calendar type for given locale. + * @param locale the locale + * @param typeBuffer calendar type returned here + * @param typeBufferSize The size of typeBuffer in bytes. If the type + * can't fit in the buffer, this method sets status to + * U_BUFFER_OVERFLOW_ERROR + * @param status error, if any, returned here. + * @internal For ICU use only. + */ + static void U_EXPORT2 getCalendarTypeFromLocale( + const Locale &locale, + char *typeBuffer, + int32_t typeBufferSize, + UErrorCode &status); +#endif /* U_HIDE_INTERNAL_API */ +}; + +// ------------------------------------- + +inline Calendar* +Calendar::createInstance(TimeZone* zone, UErrorCode& errorCode) +{ + // since the Locale isn't specified, use the default locale + return createInstance(zone, Locale::getDefault(), errorCode); +} + +// ------------------------------------- + +inline void +Calendar::roll(UCalendarDateFields field, UBool up, UErrorCode& status) +{ + roll(field, (int32_t)(up ? +1 : -1), status); +} + +#ifndef U_HIDE_DEPRECATED_API +inline void +Calendar::roll(EDateFields field, UBool up, UErrorCode& status) +{ + roll((UCalendarDateFields) field, up, status); +} +#endif /* U_HIDE_DEPRECATED_API */ + + +// ------------------------------------- + +/** + * Fast method for subclasses. The caller must maintain fUserSetDSTOffset and + * fUserSetZoneOffset, as well as the isSet[] array. + */ + +inline void +Calendar::internalSet(UCalendarDateFields field, int32_t value) +{ + fFields[field] = value; + fStamp[field] = kInternallySet; + fIsSet[field] = TRUE; // Remove later +} + + +#ifndef U_HIDE_INTERNAL_API +inline int32_t Calendar::weekNumber(int32_t dayOfPeriod, int32_t dayOfWeek) +{ + return weekNumber(dayOfPeriod, dayOfPeriod, dayOfWeek); +} +#endif /* U_HIDE_INTERNAL_API */ + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // _CALENDAR diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/caniter.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/caniter.h new file mode 100644 index 0000000..5a882fb --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/caniter.h @@ -0,0 +1,210 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ******************************************************************************* + * Copyright (C) 1996-2014, International Business Machines Corporation and + * others. All Rights Reserved. + ******************************************************************************* + */ + +#ifndef CANITER_H +#define CANITER_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_NORMALIZATION + +#include "unicode/uobject.h" +#include "unicode/unistr.h" + +/** + * \file + * \brief C++ API: Canonical Iterator + */ + +/** Should permutation skip characters with combining class zero + * Should be either TRUE or FALSE. This is a compile time option + * @stable ICU 2.4 + */ +#ifndef CANITER_SKIP_ZEROES +#define CANITER_SKIP_ZEROES TRUE +#endif + +U_NAMESPACE_BEGIN + +class Hashtable; +class Normalizer2; +class Normalizer2Impl; + +/** + * This class allows one to iterate through all the strings that are canonically equivalent to a given + * string. For example, here are some sample results: +Results for: {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA} +1: \\u0041\\u030A\\u0064\\u0307\\u0327 + = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA} +2: \\u0041\\u030A\\u0064\\u0327\\u0307 + = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D}{COMBINING CEDILLA}{COMBINING DOT ABOVE} +3: \\u0041\\u030A\\u1E0B\\u0327 + = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D WITH DOT ABOVE}{COMBINING CEDILLA} +4: \\u0041\\u030A\\u1E11\\u0307 + = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D WITH CEDILLA}{COMBINING DOT ABOVE} +5: \\u00C5\\u0064\\u0307\\u0327 + = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA} +6: \\u00C5\\u0064\\u0327\\u0307 + = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D}{COMBINING CEDILLA}{COMBINING DOT ABOVE} +7: \\u00C5\\u1E0B\\u0327 + = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D WITH DOT ABOVE}{COMBINING CEDILLA} +8: \\u00C5\\u1E11\\u0307 + = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D WITH CEDILLA}{COMBINING DOT ABOVE} +9: \\u212B\\u0064\\u0307\\u0327 + = {ANGSTROM SIGN}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA} +10: \\u212B\\u0064\\u0327\\u0307 + = {ANGSTROM SIGN}{LATIN SMALL LETTER D}{COMBINING CEDILLA}{COMBINING DOT ABOVE} +11: \\u212B\\u1E0B\\u0327 + = {ANGSTROM SIGN}{LATIN SMALL LETTER D WITH DOT ABOVE}{COMBINING CEDILLA} +12: \\u212B\\u1E11\\u0307 + = {ANGSTROM SIGN}{LATIN SMALL LETTER D WITH CEDILLA}{COMBINING DOT ABOVE} + *
Note: the code is intended for use with small strings, and is not suitable for larger ones, + * since it has not been optimized for that situation. + * Note, CanonicalIterator is not intended to be subclassed. + * @author M. Davis + * @author C++ port by V. Weinstein + * @stable ICU 2.4 + */ +class U_COMMON_API CanonicalIterator U_FINAL : public UObject { +public: + /** + * Construct a CanonicalIterator object + * @param source string to get results for + * @param status Fill-in parameter which receives the status of this operation. + * @stable ICU 2.4 + */ + CanonicalIterator(const UnicodeString &source, UErrorCode &status); + + /** Destructor + * Cleans pieces + * @stable ICU 2.4 + */ + virtual ~CanonicalIterator(); + + /** + * Gets the NFD form of the current source we are iterating over. + * @return gets the source: NOTE: it is the NFD form of source + * @stable ICU 2.4 + */ + UnicodeString getSource(); + + /** + * Resets the iterator so that one can start again from the beginning. + * @stable ICU 2.4 + */ + void reset(); + + /** + * Get the next canonically equivalent string. + *
Warning: The strings are not guaranteed to be in any particular order. + * @return the next string that is canonically equivalent. A bogus string is returned when + * the iteration is done. + * @stable ICU 2.4 + */ + UnicodeString next(); + + /** + * Set a new source for this iterator. Allows object reuse. + * @param newSource the source string to iterate against. This allows the same iterator to be used + * while changing the source string, saving object creation. + * @param status Fill-in parameter which receives the status of this operation. + * @stable ICU 2.4 + */ + void setSource(const UnicodeString &newSource, UErrorCode &status); + +#ifndef U_HIDE_INTERNAL_API + /** + * Dumb recursive implementation of permutation. + * TODO: optimize + * @param source the string to find permutations for + * @param skipZeros determine if skip zeros + * @param result the results in a set. + * @param status Fill-in parameter which receives the status of this operation. + * @internal + */ + static void U_EXPORT2 permute(UnicodeString &source, UBool skipZeros, Hashtable *result, UErrorCode &status); +#endif /* U_HIDE_INTERNAL_API */ + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.2 + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.2 + */ + virtual UClassID getDynamicClassID() const; + +private: + // ===================== PRIVATES ============================== + // private default constructor + CanonicalIterator(); + + + /** + * Copy constructor. Private for now. + * @internal + */ + CanonicalIterator(const CanonicalIterator& other); + + /** + * Assignment operator. Private for now. + * @internal + */ + CanonicalIterator& operator=(const CanonicalIterator& other); + + // fields + UnicodeString source; + UBool done; + + // 2 dimensional array holds the pieces of the string with + // their different canonically equivalent representations + UnicodeString **pieces; + int32_t pieces_length; + int32_t *pieces_lengths; + + // current is used in iterating to combine pieces + int32_t *current; + int32_t current_length; + + // transient fields + UnicodeString buffer; + + const Normalizer2 &nfd; + const Normalizer2Impl &nfcImpl; + + // we have a segment, in NFD. Find all the strings that are canonically equivalent to it. + UnicodeString *getEquivalents(const UnicodeString &segment, int32_t &result_len, UErrorCode &status); //private String[] getEquivalents(String segment) + + //Set getEquivalents2(String segment); + Hashtable *getEquivalents2(Hashtable *fillinResult, const char16_t *segment, int32_t segLen, UErrorCode &status); + //Hashtable *getEquivalents2(const UnicodeString &segment, int32_t segLen, UErrorCode &status); + + /** + * See if the decomposition of cp2 is at segment starting at segmentPos + * (with canonical rearrangment!) + * If so, take the remainder, and return the equivalents + */ + //Set extract(int comp, String segment, int segmentPos, StringBuffer buffer); + Hashtable *extract(Hashtable *fillinResult, UChar32 comp, const char16_t *segment, int32_t segLen, int32_t segmentPos, UErrorCode &status); + //Hashtable *extract(UChar32 comp, const UnicodeString &segment, int32_t segLen, int32_t segmentPos, UErrorCode &status); + + void cleanPieces(); + +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_NORMALIZATION */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/casemap.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/casemap.h new file mode 100644 index 0000000..4a4917b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/casemap.h @@ -0,0 +1,496 @@ +// © 2017 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// casemap.h +// created: 2017jan12 Markus W. Scherer + +#ifndef __CASEMAP_H__ +#define __CASEMAP_H__ + +#include "unicode/utypes.h" +#include "unicode/stringpiece.h" +#include "unicode/uobject.h" + +/** + * \file + * \brief C++ API: Low-level C++ case mapping functions. + */ + +U_NAMESPACE_BEGIN + +#ifndef U_HIDE_DRAFT_API + +class BreakIterator; +class ByteSink; +class Edits; + +/** + * Low-level C++ case mapping functions. + * + * @draft ICU 59 + */ +class U_COMMON_API CaseMap U_FINAL : public UMemory { +public: + /** + * Lowercases a UTF-16 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see u_strToLower + * @draft ICU 59 + */ + static int32_t toLower( + const char *locale, uint32_t options, + const char16_t *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + + /** + * Uppercases a UTF-16 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see u_strToUpper + * @draft ICU 59 + */ + static int32_t toUpper( + const char *locale, uint32_t options, + const char16_t *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + +#if !UCONFIG_NO_BREAK_ITERATION + + /** + * Titlecases a UTF-16 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * Titlecasing uses a break iterator to find the first characters of words + * that are to be titlecased. It titlecases those characters and lowercases + * all others. (This can be modified with options bits.) + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET, + * U_TITLECASE_NO_LOWERCASE, + * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED, + * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES. + * @param iter A break iterator to find the first characters of words that are to be titlecased. + * It is set to the source string (setText()) + * and used one or more times for iteration (first() and next()). + * If NULL, then a word break iterator for the locale is used + * (or something equivalent). + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see u_strToTitle + * @see ucasemap_toTitle + * @draft ICU 59 + */ + static int32_t toTitle( + const char *locale, uint32_t options, BreakIterator *iter, + const char16_t *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + +#endif // UCONFIG_NO_BREAK_ITERATION + + /** + * Case-folds a UTF-16 string and optionally records edits. + * + * Case folding is locale-independent and not context-sensitive, + * but there is an option for whether to include or exclude mappings for dotted I + * and dotless i that are marked with 'T' in CaseFolding.txt. + * + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET, + * U_FOLD_CASE_DEFAULT, U_FOLD_CASE_EXCLUDE_SPECIAL_I. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see u_strFoldCase + * @draft ICU 59 + */ + static int32_t fold( + uint32_t options, + const char16_t *src, int32_t srcLength, + char16_t *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + + /** + * Lowercases a UTF-8 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src The original string. + * @param sink A ByteSink to which the result string is written. + * sink.Flush() is called at the end. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * + * @see ucasemap_utf8ToLower + * @draft ICU 60 + */ + static void utf8ToLower( + const char *locale, uint32_t options, + StringPiece src, ByteSink &sink, Edits *edits, + UErrorCode &errorCode); + + /** + * Uppercases a UTF-8 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src The original string. + * @param sink A ByteSink to which the result string is written. + * sink.Flush() is called at the end. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * + * @see ucasemap_utf8ToUpper + * @draft ICU 60 + */ + static void utf8ToUpper( + const char *locale, uint32_t options, + StringPiece src, ByteSink &sink, Edits *edits, + UErrorCode &errorCode); + +#if !UCONFIG_NO_BREAK_ITERATION + + /** + * Titlecases a UTF-8 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * + * Titlecasing uses a break iterator to find the first characters of words + * that are to be titlecased. It titlecases those characters and lowercases + * all others. (This can be modified with options bits.) + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET, + * U_TITLECASE_NO_LOWERCASE, + * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED, + * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES. + * @param iter A break iterator to find the first characters of words that are to be titlecased. + * It is set to the source string (setUText()) + * and used one or more times for iteration (first() and next()). + * If NULL, then a word break iterator for the locale is used + * (or something equivalent). + * @param src The original string. + * @param sink A ByteSink to which the result string is written. + * sink.Flush() is called at the end. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * + * @see ucasemap_utf8ToTitle + * @draft ICU 60 + */ + static void utf8ToTitle( + const char *locale, uint32_t options, BreakIterator *iter, + StringPiece src, ByteSink &sink, Edits *edits, + UErrorCode &errorCode); + +#endif // UCONFIG_NO_BREAK_ITERATION + + /** + * Case-folds a UTF-8 string and optionally records edits. + * + * Case folding is locale-independent and not context-sensitive, + * but there is an option for whether to include or exclude mappings for dotted I + * and dotless i that are marked with 'T' in CaseFolding.txt. + * + * The result may be longer or shorter than the original. + * + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src The original string. + * @param sink A ByteSink to which the result string is written. + * sink.Flush() is called at the end. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * + * @see ucasemap_utf8FoldCase + * @draft ICU 60 + */ + static void utf8Fold( + uint32_t options, + StringPiece src, ByteSink &sink, Edits *edits, + UErrorCode &errorCode); + + /** + * Lowercases a UTF-8 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of bytes). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see ucasemap_utf8ToLower + * @draft ICU 59 + */ + static int32_t utf8ToLower( + const char *locale, uint32_t options, + const char *src, int32_t srcLength, + char *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + + /** + * Uppercases a UTF-8 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of bytes). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see ucasemap_utf8ToUpper + * @draft ICU 59 + */ + static int32_t utf8ToUpper( + const char *locale, uint32_t options, + const char *src, int32_t srcLength, + char *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + +#if !UCONFIG_NO_BREAK_ITERATION + + /** + * Titlecases a UTF-8 string and optionally records edits. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * Titlecasing uses a break iterator to find the first characters of words + * that are to be titlecased. It titlecases those characters and lowercases + * all others. (This can be modified with options bits.) + * + * @param locale The locale ID. ("" = root locale, NULL = default locale.) + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET, + * U_TITLECASE_NO_LOWERCASE, + * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED, + * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES. + * @param iter A break iterator to find the first characters of words that are to be titlecased. + * It is set to the source string (setUText()) + * and used one or more times for iteration (first() and next()). + * If NULL, then a word break iterator for the locale is used + * (or something equivalent). + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of bytes). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see ucasemap_utf8ToTitle + * @draft ICU 59 + */ + static int32_t utf8ToTitle( + const char *locale, uint32_t options, BreakIterator *iter, + const char *src, int32_t srcLength, + char *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + +#endif // UCONFIG_NO_BREAK_ITERATION + + /** + * Case-folds a UTF-8 string and optionally records edits. + * + * Case folding is locale-independent and not context-sensitive, + * but there is an option for whether to include or exclude mappings for dotted I + * and dotless i that are marked with 'T' in CaseFolding.txt. + * + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET, + * U_FOLD_CASE_DEFAULT, U_FOLD_CASE_EXCLUDE_SPECIAL_I. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of bytes). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be NULL. + * @param errorCode Reference to an in/out error code value + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful. + * When the result would be longer than destCapacity, + * the full length is returned and a U_BUFFER_OVERFLOW_ERROR is set. + * + * @see ucasemap_utf8FoldCase + * @draft ICU 59 + */ + static int32_t utf8Fold( + uint32_t options, + const char *src, int32_t srcLength, + char *dest, int32_t destCapacity, Edits *edits, + UErrorCode &errorCode); + +private: + CaseMap() = delete; + CaseMap(const CaseMap &other) = delete; + CaseMap &operator=(const CaseMap &other) = delete; +}; + +#endif // U_HIDE_DRAFT_API + +U_NAMESPACE_END + +#endif // __CASEMAP_H__ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/char16ptr.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/char16ptr.h new file mode 100644 index 0000000..fbce177 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/char16ptr.h @@ -0,0 +1,306 @@ +// © 2017 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// char16ptr.h +// created: 2017feb28 Markus W. Scherer + +#ifndef __CHAR16PTR_H__ +#define __CHAR16PTR_H__ + +#include +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: char16_t pointer wrappers with + * implicit conversion from bit-compatible raw pointer types. + * Also conversion functions from char16_t * to UChar * and OldUChar *. + */ + +U_NAMESPACE_BEGIN + +/** + * \def U_ALIASING_BARRIER + * Barrier for pointer anti-aliasing optimizations even across function boundaries. + * @internal + */ +#ifdef U_ALIASING_BARRIER + // Use the predefined value. +#elif (defined(__clang__) || defined(__GNUC__)) && U_PLATFORM != U_PF_BROWSER_NATIVE_CLIENT +# define U_ALIASING_BARRIER(ptr) asm volatile("" : : "rm"(ptr) : "memory") +#endif + +// Do not use #ifndef U_HIDE_DRAFT_API for the following class, it +// is now used in place of UChar* in several stable C++ methods +/** + * char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types. + * @draft ICU 59 + */ +class U_COMMON_API Char16Ptr U_FINAL { +public: + /** + * Copies the pointer. + * @param p pointer + * @draft ICU 59 + */ + inline Char16Ptr(char16_t *p); +#if !U_CHAR16_IS_TYPEDEF + /** + * Converts the pointer to char16_t *. + * @param p pointer to be converted + * @draft ICU 59 + */ + inline Char16Ptr(uint16_t *p); +#endif +#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN) + /** + * Converts the pointer to char16_t *. + * (Only defined if U_SIZEOF_WCHAR_T==2.) + * @param p pointer to be converted + * @draft ICU 59 + */ + inline Char16Ptr(wchar_t *p); +#endif + /** + * nullptr constructor. + * @param p nullptr + * @draft ICU 59 + */ + inline Char16Ptr(std::nullptr_t p); + /** + * Destructor. + * @draft ICU 59 + */ + inline ~Char16Ptr(); + + /** + * Pointer access. + * @return the wrapped pointer + * @draft ICU 59 + */ + inline char16_t *get() const; + /** + * char16_t pointer access via type conversion (e.g., static_cast). + * @return the wrapped pointer + * @draft ICU 59 + */ + inline operator char16_t *() const { return get(); } + +private: + Char16Ptr() = delete; + +#ifdef U_ALIASING_BARRIER + template static char16_t *cast(T *t) { + U_ALIASING_BARRIER(t); + return reinterpret_cast(t); + } + + char16_t *p_; +#else + union { + char16_t *cp; + uint16_t *up; + wchar_t *wp; + } u_; +#endif +}; + +#ifdef U_ALIASING_BARRIER + +Char16Ptr::Char16Ptr(char16_t *p) : p_(p) {} +#if !U_CHAR16_IS_TYPEDEF +Char16Ptr::Char16Ptr(uint16_t *p) : p_(cast(p)) {} +#endif +#if U_SIZEOF_WCHAR_T==2 +Char16Ptr::Char16Ptr(wchar_t *p) : p_(cast(p)) {} +#endif +Char16Ptr::Char16Ptr(std::nullptr_t p) : p_(p) {} +Char16Ptr::~Char16Ptr() { + U_ALIASING_BARRIER(p_); +} + +char16_t *Char16Ptr::get() const { return p_; } + +#else + +Char16Ptr::Char16Ptr(char16_t *p) { u_.cp = p; } +#if !U_CHAR16_IS_TYPEDEF +Char16Ptr::Char16Ptr(uint16_t *p) { u_.up = p; } +#endif +#if U_SIZEOF_WCHAR_T==2 +Char16Ptr::Char16Ptr(wchar_t *p) { u_.wp = p; } +#endif +Char16Ptr::Char16Ptr(std::nullptr_t p) { u_.cp = p; } +Char16Ptr::~Char16Ptr() {} + +char16_t *Char16Ptr::get() const { return u_.cp; } + +#endif + +// Do not use #ifndef U_HIDE_DRAFT_API for the following class, it is +// now used in place of const UChar* in several stable C++ methods +/** + * const char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types. + * @draft ICU 59 + */ +class U_COMMON_API ConstChar16Ptr U_FINAL { +public: + /** + * Copies the pointer. + * @param p pointer + * @draft ICU 59 + */ + inline ConstChar16Ptr(const char16_t *p); +#if !U_CHAR16_IS_TYPEDEF + /** + * Converts the pointer to char16_t *. + * @param p pointer to be converted + * @draft ICU 59 + */ + inline ConstChar16Ptr(const uint16_t *p); +#endif +#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN) + /** + * Converts the pointer to char16_t *. + * (Only defined if U_SIZEOF_WCHAR_T==2.) + * @param p pointer to be converted + * @draft ICU 59 + */ + inline ConstChar16Ptr(const wchar_t *p); +#endif + /** + * nullptr constructor. + * @param p nullptr + * @draft ICU 59 + */ + inline ConstChar16Ptr(const std::nullptr_t p); + + /** + * Destructor. + * @draft ICU 59 + */ + inline ~ConstChar16Ptr(); + + /** + * Pointer access. + * @return the wrapped pointer + * @draft ICU 59 + */ + inline const char16_t *get() const; + /** + * char16_t pointer access via type conversion (e.g., static_cast). + * @return the wrapped pointer + * @draft ICU 59 + */ + inline operator const char16_t *() const { return get(); } + +private: + ConstChar16Ptr() = delete; + +#ifdef U_ALIASING_BARRIER + template static const char16_t *cast(const T *t) { + U_ALIASING_BARRIER(t); + return reinterpret_cast(t); + } + + const char16_t *p_; +#else + union { + const char16_t *cp; + const uint16_t *up; + const wchar_t *wp; + } u_; +#endif +}; + +#ifdef U_ALIASING_BARRIER + +ConstChar16Ptr::ConstChar16Ptr(const char16_t *p) : p_(p) {} +#if !U_CHAR16_IS_TYPEDEF +ConstChar16Ptr::ConstChar16Ptr(const uint16_t *p) : p_(cast(p)) {} +#endif +#if U_SIZEOF_WCHAR_T==2 +ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) : p_(cast(p)) {} +#endif +ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) : p_(p) {} +ConstChar16Ptr::~ConstChar16Ptr() { + U_ALIASING_BARRIER(p_); +} + +const char16_t *ConstChar16Ptr::get() const { return p_; } + +#else + +ConstChar16Ptr::ConstChar16Ptr(const char16_t *p) { u_.cp = p; } +#if !U_CHAR16_IS_TYPEDEF +ConstChar16Ptr::ConstChar16Ptr(const uint16_t *p) { u_.up = p; } +#endif +#if U_SIZEOF_WCHAR_T==2 +ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) { u_.wp = p; } +#endif +ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) { u_.cp = p; } +ConstChar16Ptr::~ConstChar16Ptr() {} + +const char16_t *ConstChar16Ptr::get() const { return u_.cp; } + +#endif + +/** + * Converts from const char16_t * to const UChar *. + * Includes an aliasing barrier if available. + * @param p pointer + * @return p as const UChar * + * @draft ICU 59 + */ +inline const UChar *toUCharPtr(const char16_t *p) { +#ifdef U_ALIASING_BARRIER + U_ALIASING_BARRIER(p); +#endif + return reinterpret_cast(p); +} + +/** + * Converts from char16_t * to UChar *. + * Includes an aliasing barrier if available. + * @param p pointer + * @return p as UChar * + * @draft ICU 59 + */ +inline UChar *toUCharPtr(char16_t *p) { +#ifdef U_ALIASING_BARRIER + U_ALIASING_BARRIER(p); +#endif + return reinterpret_cast(p); +} + +/** + * Converts from const char16_t * to const OldUChar *. + * Includes an aliasing barrier if available. + * @param p pointer + * @return p as const OldUChar * + * @draft ICU 59 + */ +inline const OldUChar *toOldUCharPtr(const char16_t *p) { +#ifdef U_ALIASING_BARRIER + U_ALIASING_BARRIER(p); +#endif + return reinterpret_cast(p); +} + +/** + * Converts from char16_t * to OldUChar *. + * Includes an aliasing barrier if available. + * @param p pointer + * @return p as OldUChar * + * @draft ICU 59 + */ +inline OldUChar *toOldUCharPtr(char16_t *p) { +#ifdef U_ALIASING_BARRIER + U_ALIASING_BARRIER(p); +#endif + return reinterpret_cast(p); +} + +U_NAMESPACE_END + +#endif // __CHAR16PTR_H__ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/chariter.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/chariter.h new file mode 100644 index 0000000..7a4e1a2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/chariter.h @@ -0,0 +1,728 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************** +* +* Copyright (C) 1997-2011, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************** +*/ + +#ifndef CHARITER_H +#define CHARITER_H + +#include "unicode/utypes.h" +#include "unicode/uobject.h" +#include "unicode/unistr.h" +/** + * \file + * \brief C++ API: Character Iterator + */ + +U_NAMESPACE_BEGIN +/** + * Abstract class that defines an API for forward-only iteration + * on text objects. + * This is a minimal interface for iteration without random access + * or backwards iteration. It is especially useful for wrapping + * streams with converters into an object for collation or + * normalization. + * + *

Characters can be accessed in two ways: as code units or as + * code points. + * Unicode code points are 21-bit integers and are the scalar values + * of Unicode characters. ICU uses the type UChar32 for them. + * Unicode code units are the storage units of a given + * Unicode/UCS Transformation Format (a character encoding scheme). + * With UTF-16, all code points can be represented with either one + * or two code units ("surrogates"). + * String storage is typically based on code units, while properties + * of characters are typically determined using code point values. + * Some processes may be designed to work with sequences of code units, + * or it may be known that all characters that are important to an + * algorithm can be represented with single code units. + * Other processes will need to use the code point access functions.

+ * + *

ForwardCharacterIterator provides nextPostInc() to access + * a code unit and advance an internal position into the text object, + * similar to a return text[position++].
+ * It provides next32PostInc() to access a code point and advance an internal + * position.

+ * + *

next32PostInc() assumes that the current position is that of + * the beginning of a code point, i.e., of its first code unit. + * After next32PostInc(), this will be true again. + * In general, access to code units and code points in the same + * iteration loop should not be mixed. In UTF-16, if the current position + * is on a second code unit (Low Surrogate), then only that code unit + * is returned even by next32PostInc().

+ * + *

For iteration with either function, there are two ways to + * check for the end of the iteration. When there are no more + * characters in the text object: + *

    + *
  • The hasNext() function returns FALSE.
  • + *
  • nextPostInc() and next32PostInc() return DONE + * when one attempts to read beyond the end of the text object.
  • + *
+ * + * Example: + * \code + * void function1(ForwardCharacterIterator &it) { + * UChar32 c; + * while(it.hasNext()) { + * c=it.next32PostInc(); + * // use c + * } + * } + * + * void function1(ForwardCharacterIterator &it) { + * char16_t c; + * while((c=it.nextPostInc())!=ForwardCharacterIterator::DONE) { + * // use c + * } + * } + * \endcode + *

+ * + * @stable ICU 2.0 + */ +class U_COMMON_API ForwardCharacterIterator : public UObject { +public: + /** + * Value returned by most of ForwardCharacterIterator's functions + * when the iterator has reached the limits of its iteration. + * @stable ICU 2.0 + */ + enum { DONE = 0xffff }; + + /** + * Destructor. + * @stable ICU 2.0 + */ + virtual ~ForwardCharacterIterator(); + + /** + * Returns true when both iterators refer to the same + * character in the same character-storage object. + * @param that The ForwardCharacterIterator to be compared for equality + * @return true when both iterators refer to the same + * character in the same character-storage object + * @stable ICU 2.0 + */ + virtual UBool operator==(const ForwardCharacterIterator& that) const = 0; + + /** + * Returns true when the iterators refer to different + * text-storage objects, or to different characters in the + * same text-storage object. + * @param that The ForwardCharacterIterator to be compared for inequality + * @return true when the iterators refer to different + * text-storage objects, or to different characters in the + * same text-storage object + * @stable ICU 2.0 + */ + inline UBool operator!=(const ForwardCharacterIterator& that) const; + + /** + * Generates a hash code for this iterator. + * @return the hash code. + * @stable ICU 2.0 + */ + virtual int32_t hashCode(void) const = 0; + + /** + * Returns a UClassID for this ForwardCharacterIterator ("poor man's + * RTTI").

Despite the fact that this function is public, + * DO NOT CONSIDER IT PART OF CHARACTERITERATOR'S API! + * @return a UClassID for this ForwardCharacterIterator + * @stable ICU 2.0 + */ + virtual UClassID getDynamicClassID(void) const = 0; + + /** + * Gets the current code unit for returning and advances to the next code unit + * in the iteration range + * (toward endIndex()). If there are + * no more code units to return, returns DONE. + * @return the current code unit. + * @stable ICU 2.0 + */ + virtual char16_t nextPostInc(void) = 0; + + /** + * Gets the current code point for returning and advances to the next code point + * in the iteration range + * (toward endIndex()). If there are + * no more code points to return, returns DONE. + * @return the current code point. + * @stable ICU 2.0 + */ + virtual UChar32 next32PostInc(void) = 0; + + /** + * Returns FALSE if there are no more code units or code points + * at or after the current position in the iteration range. + * This is used with nextPostInc() or next32PostInc() in forward + * iteration. + * @returns FALSE if there are no more code units or code points + * at or after the current position in the iteration range. + * @stable ICU 2.0 + */ + virtual UBool hasNext() = 0; + +protected: + /** Default constructor to be overridden in the implementing class. @stable ICU 2.0*/ + ForwardCharacterIterator(); + + /** Copy constructor to be overridden in the implementing class. @stable ICU 2.0*/ + ForwardCharacterIterator(const ForwardCharacterIterator &other); + + /** + * Assignment operator to be overridden in the implementing class. + * @stable ICU 2.0 + */ + ForwardCharacterIterator &operator=(const ForwardCharacterIterator&) { return *this; } +}; + +/** + * Abstract class that defines an API for iteration + * on text objects. + * This is an interface for forward and backward iteration + * and random access into a text object. + * + *

The API provides backward compatibility to the Java and older ICU + * CharacterIterator classes but extends them significantly: + *

    + *
  1. CharacterIterator is now a subclass of ForwardCharacterIterator.
  2. + *
  3. While the old API functions provided forward iteration with + * "pre-increment" semantics, the new one also provides functions + * with "post-increment" semantics. They are more efficient and should + * be the preferred iterator functions for new implementations. + * The backward iteration always had "pre-decrement" semantics, which + * are efficient.
  4. + *
  5. Just like ForwardCharacterIterator, it provides access to + * both code units and code points. Code point access versions are available + * for the old and the new iteration semantics.
  6. + *
  7. There are new functions for setting and moving the current position + * without returning a character, for efficiency.
  8. + *
+ * + * See ForwardCharacterIterator for examples for using the new forward iteration + * functions. For backward iteration, there is also a hasPrevious() function + * that can be used analogously to hasNext(). + * The old functions work as before and are shown below.

+ * + *

Examples for some of the new functions:

+ * + * Forward iteration with hasNext(): + * \code + * void forward1(CharacterIterator &it) { + * UChar32 c; + * for(it.setToStart(); it.hasNext();) { + * c=it.next32PostInc(); + * // use c + * } + * } + * \endcode + * Forward iteration more similar to loops with the old forward iteration, + * showing a way to convert simple for() loops: + * \code + * void forward2(CharacterIterator &it) { + * char16_t c; + * for(c=it.firstPostInc(); c!=CharacterIterator::DONE; c=it.nextPostInc()) { + * // use c + * } + * } + * \endcode + * Backward iteration with setToEnd() and hasPrevious(): + * \code + * void backward1(CharacterIterator &it) { + * UChar32 c; + * for(it.setToEnd(); it.hasPrevious();) { + * c=it.previous32(); + * // use c + * } + * } + * \endcode + * Backward iteration with a more traditional for() loop: + * \code + * void backward2(CharacterIterator &it) { + * char16_t c; + * for(c=it.last(); c!=CharacterIterator::DONE; c=it.previous()) { + * // use c + * } + * } + * \endcode + * + * Example for random access: + * \code + * void random(CharacterIterator &it) { + * // set to the third code point from the beginning + * it.move32(3, CharacterIterator::kStart); + * // get a code point from here without moving the position + * UChar32 c=it.current32(); + * // get the position + * int32_t pos=it.getIndex(); + * // get the previous code unit + * char16_t u=it.previous(); + * // move back one more code unit + * it.move(-1, CharacterIterator::kCurrent); + * // set the position back to where it was + * // and read the same code point c and move beyond it + * it.setIndex(pos); + * if(c!=it.next32PostInc()) { + * exit(1); // CharacterIterator inconsistent + * } + * } + * \endcode + * + *

Examples, especially for the old API:

+ * + * Function processing characters, in this example simple output + *
+ * \code
+ *  void processChar( char16_t c )
+ *  {
+ *      cout << " " << c;
+ *  }
+ * \endcode
+ * 
+ * Traverse the text from start to finish + *
 
+ * \code
+ *  void traverseForward(CharacterIterator& iter)
+ *  {
+ *      for(char16_t c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
+ *          processChar(c);
+ *      }
+ *  }
+ * \endcode
+ * 
+ * Traverse the text backwards, from end to start + *
+ * \code
+ *  void traverseBackward(CharacterIterator& iter)
+ *  {
+ *      for(char16_t c = iter.last(); c != CharacterIterator.DONE; c = iter.previous()) {
+ *          processChar(c);
+ *      }
+ *  }
+ * \endcode
+ * 
+ * Traverse both forward and backward from a given position in the text. + * Calls to notBoundary() in this example represents some additional stopping criteria. + *
+ * \code
+ * void traverseOut(CharacterIterator& iter, int32_t pos)
+ * {
+ *      char16_t c;
+ *      for (c = iter.setIndex(pos);
+ *      c != CharacterIterator.DONE && (Unicode::isLetter(c) || Unicode::isDigit(c));
+ *          c = iter.next()) {}
+ *      int32_t end = iter.getIndex();
+ *      for (c = iter.setIndex(pos);
+ *          c != CharacterIterator.DONE && (Unicode::isLetter(c) || Unicode::isDigit(c));
+ *          c = iter.previous()) {}
+ *      int32_t start = iter.getIndex() + 1;
+ *  
+ *      cout << "start: " << start << " end: " << end << endl;
+ *      for (c = iter.setIndex(start); iter.getIndex() < end; c = iter.next() ) {
+ *          processChar(c);
+ *     }
+ *  }
+ * \endcode
+ * 
+ * Creating a StringCharacterIterator and calling the test functions + *
+ * \code
+ *  void CharacterIterator_Example( void )
+ *   {
+ *       cout << endl << "===== CharacterIterator_Example: =====" << endl;
+ *       UnicodeString text("Ein kleiner Satz.");
+ *       StringCharacterIterator iterator(text);
+ *       cout << "----- traverseForward: -----------" << endl;
+ *       traverseForward( iterator );
+ *       cout << endl << endl << "----- traverseBackward: ----------" << endl;
+ *       traverseBackward( iterator );
+ *       cout << endl << endl << "----- traverseOut: ---------------" << endl;
+ *       traverseOut( iterator, 7 );
+ *       cout << endl << endl << "-----" << endl;
+ *   }
+ * \endcode
+ * 
+ * + * @stable ICU 2.0 + */ +class U_COMMON_API CharacterIterator : public ForwardCharacterIterator { +public: + /** + * Origin enumeration for the move() and move32() functions. + * @stable ICU 2.0 + */ + enum EOrigin { kStart, kCurrent, kEnd }; + + /** + * Destructor. + * @stable ICU 2.0 + */ + virtual ~CharacterIterator(); + + /** + * Returns a pointer to a new CharacterIterator of the same + * concrete class as this one, and referring to the same + * character in the same text-storage object as this one. The + * caller is responsible for deleting the new clone. + * @return a pointer to a new CharacterIterator + * @stable ICU 2.0 + */ + virtual CharacterIterator* clone(void) const = 0; + + /** + * Sets the iterator to refer to the first code unit in its + * iteration range, and returns that code unit. + * This can be used to begin an iteration with next(). + * @return the first code unit in its iteration range. + * @stable ICU 2.0 + */ + virtual char16_t first(void) = 0; + + /** + * Sets the iterator to refer to the first code unit in its + * iteration range, returns that code unit, and moves the position + * to the second code unit. This is an alternative to setToStart() + * for forward iteration with nextPostInc(). + * @return the first code unit in its iteration range. + * @stable ICU 2.0 + */ + virtual char16_t firstPostInc(void); + + /** + * Sets the iterator to refer to the first code point in its + * iteration range, and returns that code unit, + * This can be used to begin an iteration with next32(). + * Note that an iteration with next32PostInc(), beginning with, + * e.g., setToStart() or firstPostInc(), is more efficient. + * @return the first code point in its iteration range. + * @stable ICU 2.0 + */ + virtual UChar32 first32(void) = 0; + + /** + * Sets the iterator to refer to the first code point in its + * iteration range, returns that code point, and moves the position + * to the second code point. This is an alternative to setToStart() + * for forward iteration with next32PostInc(). + * @return the first code point in its iteration range. + * @stable ICU 2.0 + */ + virtual UChar32 first32PostInc(void); + + /** + * Sets the iterator to refer to the first code unit or code point in its + * iteration range. This can be used to begin a forward + * iteration with nextPostInc() or next32PostInc(). + * @return the start position of the iteration range + * @stable ICU 2.0 + */ + inline int32_t setToStart(); + + /** + * Sets the iterator to refer to the last code unit in its + * iteration range, and returns that code unit. + * This can be used to begin an iteration with previous(). + * @return the last code unit. + * @stable ICU 2.0 + */ + virtual char16_t last(void) = 0; + + /** + * Sets the iterator to refer to the last code point in its + * iteration range, and returns that code unit. + * This can be used to begin an iteration with previous32(). + * @return the last code point. + * @stable ICU 2.0 + */ + virtual UChar32 last32(void) = 0; + + /** + * Sets the iterator to the end of its iteration range, just behind + * the last code unit or code point. This can be used to begin a backward + * iteration with previous() or previous32(). + * @return the end position of the iteration range + * @stable ICU 2.0 + */ + inline int32_t setToEnd(); + + /** + * Sets the iterator to refer to the "position"-th code unit + * in the text-storage object the iterator refers to, and + * returns that code unit. + * @param position the "position"-th code unit in the text-storage object + * @return the "position"-th code unit. + * @stable ICU 2.0 + */ + virtual char16_t setIndex(int32_t position) = 0; + + /** + * Sets the iterator to refer to the beginning of the code point + * that contains the "position"-th code unit + * in the text-storage object the iterator refers to, and + * returns that code point. + * The current position is adjusted to the beginning of the code point + * (its first code unit). + * @param position the "position"-th code unit in the text-storage object + * @return the "position"-th code point. + * @stable ICU 2.0 + */ + virtual UChar32 setIndex32(int32_t position) = 0; + + /** + * Returns the code unit the iterator currently refers to. + * @return the current code unit. + * @stable ICU 2.0 + */ + virtual char16_t current(void) const = 0; + + /** + * Returns the code point the iterator currently refers to. + * @return the current code point. + * @stable ICU 2.0 + */ + virtual UChar32 current32(void) const = 0; + + /** + * Advances to the next code unit in the iteration range + * (toward endIndex()), and returns that code unit. If there are + * no more code units to return, returns DONE. + * @return the next code unit. + * @stable ICU 2.0 + */ + virtual char16_t next(void) = 0; + + /** + * Advances to the next code point in the iteration range + * (toward endIndex()), and returns that code point. If there are + * no more code points to return, returns DONE. + * Note that iteration with "pre-increment" semantics is less + * efficient than iteration with "post-increment" semantics + * that is provided by next32PostInc(). + * @return the next code point. + * @stable ICU 2.0 + */ + virtual UChar32 next32(void) = 0; + + /** + * Advances to the previous code unit in the iteration range + * (toward startIndex()), and returns that code unit. If there are + * no more code units to return, returns DONE. + * @return the previous code unit. + * @stable ICU 2.0 + */ + virtual char16_t previous(void) = 0; + + /** + * Advances to the previous code point in the iteration range + * (toward startIndex()), and returns that code point. If there are + * no more code points to return, returns DONE. + * @return the previous code point. + * @stable ICU 2.0 + */ + virtual UChar32 previous32(void) = 0; + + /** + * Returns FALSE if there are no more code units or code points + * before the current position in the iteration range. + * This is used with previous() or previous32() in backward + * iteration. + * @return FALSE if there are no more code units or code points + * before the current position in the iteration range, return TRUE otherwise. + * @stable ICU 2.0 + */ + virtual UBool hasPrevious() = 0; + + /** + * Returns the numeric index in the underlying text-storage + * object of the character returned by first(). Since it's + * possible to create an iterator that iterates across only + * part of a text-storage object, this number isn't + * necessarily 0. + * @returns the numeric index in the underlying text-storage + * object of the character returned by first(). + * @stable ICU 2.0 + */ + inline int32_t startIndex(void) const; + + /** + * Returns the numeric index in the underlying text-storage + * object of the position immediately BEYOND the character + * returned by last(). + * @return the numeric index in the underlying text-storage + * object of the position immediately BEYOND the character + * returned by last(). + * @stable ICU 2.0 + */ + inline int32_t endIndex(void) const; + + /** + * Returns the numeric index in the underlying text-storage + * object of the character the iterator currently refers to + * (i.e., the character returned by current()). + * @return the numberic index in the text-storage object of + * the character the iterator currently refers to + * @stable ICU 2.0 + */ + inline int32_t getIndex(void) const; + + /** + * Returns the length of the entire text in the underlying + * text-storage object. + * @return the length of the entire text in the text-storage object + * @stable ICU 2.0 + */ + inline int32_t getLength() const; + + /** + * Moves the current position relative to the start or end of the + * iteration range, or relative to the current position itself. + * The movement is expressed in numbers of code units forward + * or backward by specifying a positive or negative delta. + * @param delta the position relative to origin. A positive delta means forward; + * a negative delta means backward. + * @param origin Origin enumeration {kStart, kCurrent, kEnd} + * @return the new position + * @stable ICU 2.0 + */ + virtual int32_t move(int32_t delta, EOrigin origin) = 0; + + /** + * Moves the current position relative to the start or end of the + * iteration range, or relative to the current position itself. + * The movement is expressed in numbers of code points forward + * or backward by specifying a positive or negative delta. + * @param delta the position relative to origin. A positive delta means forward; + * a negative delta means backward. + * @param origin Origin enumeration {kStart, kCurrent, kEnd} + * @return the new position + * @stable ICU 2.0 + */ +#ifdef move32 + // One of the system headers right now is sometimes defining a conflicting macro we don't use +#undef move32 +#endif + virtual int32_t move32(int32_t delta, EOrigin origin) = 0; + + /** + * Copies the text under iteration into the UnicodeString + * referred to by "result". + * @param result Receives a copy of the text under iteration. + * @stable ICU 2.0 + */ + virtual void getText(UnicodeString& result) = 0; + +protected: + /** + * Empty constructor. + * @stable ICU 2.0 + */ + CharacterIterator(); + + /** + * Constructor, just setting the length field in this base class. + * @stable ICU 2.0 + */ + CharacterIterator(int32_t length); + + /** + * Constructor, just setting the length and position fields in this base class. + * @stable ICU 2.0 + */ + CharacterIterator(int32_t length, int32_t position); + + /** + * Constructor, just setting the length, start, end, and position fields in this base class. + * @stable ICU 2.0 + */ + CharacterIterator(int32_t length, int32_t textBegin, int32_t textEnd, int32_t position); + + /** + * Copy constructor. + * + * @param that The CharacterIterator to be copied + * @stable ICU 2.0 + */ + CharacterIterator(const CharacterIterator &that); + + /** + * Assignment operator. Sets this CharacterIterator to have the same behavior, + * as the one passed in. + * @param that The CharacterIterator passed in. + * @return the newly set CharacterIterator. + * @stable ICU 2.0 + */ + CharacterIterator &operator=(const CharacterIterator &that); + + /** + * Base class text length field. + * Necessary this for correct getText() and hashCode(). + * @stable ICU 2.0 + */ + int32_t textLength; + + /** + * Base class field for the current position. + * @stable ICU 2.0 + */ + int32_t pos; + + /** + * Base class field for the start of the iteration range. + * @stable ICU 2.0 + */ + int32_t begin; + + /** + * Base class field for the end of the iteration range. + * @stable ICU 2.0 + */ + int32_t end; +}; + +inline UBool +ForwardCharacterIterator::operator!=(const ForwardCharacterIterator& that) const { + return !operator==(that); +} + +inline int32_t +CharacterIterator::setToStart() { + return move(0, kStart); +} + +inline int32_t +CharacterIterator::setToEnd() { + return move(0, kEnd); +} + +inline int32_t +CharacterIterator::startIndex(void) const { + return begin; +} + +inline int32_t +CharacterIterator::endIndex(void) const { + return end; +} + +inline int32_t +CharacterIterator::getIndex(void) const { + return pos; +} + +inline int32_t +CharacterIterator::getLength(void) const { + return textLength; +} + +U_NAMESPACE_END +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/choicfmt.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/choicfmt.h new file mode 100644 index 0000000..c9f0f11 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/choicfmt.h @@ -0,0 +1,596 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************** +* Copyright (C) 1997-2013, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************** +* +* File CHOICFMT.H +* +* Modification History: +* +* Date Name Description +* 02/19/97 aliu Converted from java. +* 03/20/97 helena Finished first cut of implementation and got rid +* of nextDouble/previousDouble and replaced with +* boolean array. +* 4/10/97 aliu Clean up. Modified to work on AIX. +* 8/6/97 nos Removed overloaded constructor, member var 'buffer'. +* 07/22/98 stephen Removed operator!= (implemented in Format) +******************************************************************************** +*/ + +#ifndef CHOICFMT_H +#define CHOICFMT_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Choice Format. + */ + +#if !UCONFIG_NO_FORMATTING +#ifndef U_HIDE_DEPRECATED_API + +#include "unicode/fieldpos.h" +#include "unicode/format.h" +#include "unicode/messagepattern.h" +#include "unicode/numfmt.h" +#include "unicode/unistr.h" + +U_NAMESPACE_BEGIN + +class MessageFormat; + +/** + * ChoiceFormat converts between ranges of numeric values and strings for those ranges. + * The strings must conform to the MessageFormat pattern syntax. + * + *

ChoiceFormat is probably not what you need. + * Please use MessageFormat + * with plural arguments for proper plural selection, + * and select arguments for simple selection among a fixed set of choices!

+ * + *

A ChoiceFormat splits + * the real number line \htmlonly-∞ to + * +∞\endhtmlonly into two + * or more contiguous ranges. Each range is mapped to a + * string.

+ * + *

ChoiceFormat was originally intended + * for displaying grammatically correct + * plurals such as "There is one file." vs. "There are 2 files." + * However, plural rules for many languages + * are too complex for the capabilities of ChoiceFormat, + * and its requirement of specifying the precise rules for each message + * is unmanageable for translators.

+ * + *

There are two methods of defining a ChoiceFormat; both + * are equivalent. The first is by using a string pattern. This is the + * preferred method in most cases. The second method is through direct + * specification of the arrays that logically make up the + * ChoiceFormat.

+ * + *

Note: Typically, choice formatting is done (if done at all) via MessageFormat + * with a choice argument type, + * rather than using a stand-alone ChoiceFormat.

+ * + *
Patterns and Their Interpretation
+ * + *

The pattern string defines the range boundaries and the strings for each number range. + * Syntax: + *

+ * choiceStyle = number separator message ('|' number separator message)*
+ * number = normal_number | ['-'] \htmlonly∞\endhtmlonly (U+221E, infinity)
+ * normal_number = double value (unlocalized ASCII string)
+ * separator = less_than | less_than_or_equal
+ * less_than = '<'
+ * less_than_or_equal = '#' | \htmlonly≤\endhtmlonly (U+2264)
+ * message: see {@link MessageFormat}
+ * 
+ * Pattern_White_Space between syntax elements is ignored, except + * around each range's sub-message.

+ * + *

Each numeric sub-range extends from the current range's number + * to the next range's number. + * The number itself is included in its range if a less_than_or_equal sign is used, + * and excluded from its range (and instead included in the previous range) + * if a less_than sign is used.

+ * + *

When a ChoiceFormat is constructed from + * arrays of numbers, closure flags and strings, + * they are interpreted just like + * the sequence of (number separator string) in an equivalent pattern string. + * closure[i]==TRUE corresponds to a less_than separator sign. + * The equivalent pattern string will be constructed automatically.

+ * + *

During formatting, a number is mapped to the first range + * where the number is not greater than the range's upper limit. + * That range's message string is returned. A NaN maps to the very first range.

+ * + *

During parsing, a range is selected for the longest match of + * any range's message. That range's number is returned, ignoring the separator/closure. + * Only a simple string match is performed, without parsing of arguments that + * might be specified in the message strings.

+ * + *

Note that the first range's number is ignored in formatting + * but may be returned from parsing.

+ * + *
Examples
+ * + *

Here is an example of two arrays that map the number + * 1..7 to the English day of the week abbreviations + * Sun..Sat. No closures array is given; this is the same as + * specifying all closures to be FALSE.

+ * + *
    {1,2,3,4,5,6,7},
+ *     {"Sun","Mon","Tue","Wed","Thur","Fri","Sat"}
+ * + *

Here is an example that maps the ranges [-Inf, 1), [1, 1], and (1, + * +Inf] to three strings. That is, the number line is split into three + * ranges: x < 1.0, x = 1.0, and x > 1.0. + * (The round parentheses in the notation above indicate an exclusive boundary, + * like the turned bracket in European notation: [-Inf, 1) == [-Inf, 1[ )

+ * + *
    {0, 1, 1},
+ *     {FALSE, FALSE, TRUE},
+ *     {"no files", "one file", "many files"}
+ * + *

Here is an example that shows formatting and parsing:

+ * + * \code + * #include + * #include + * #include + * + * int main(int argc, char *argv[]) { + * double limits[] = {1,2,3,4,5,6,7}; + * UnicodeString monthNames[] = { + * "Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; + * ChoiceFormat fmt(limits, monthNames, 7); + * UnicodeString str; + * char buf[256]; + * for (double x = 1.0; x <= 8.0; x += 1.0) { + * fmt.format(x, str); + * str.extract(0, str.length(), buf, 256, ""); + * str.truncate(0); + * cout << x << " -> " + * << buf << endl; + * } + * cout << endl; + * return 0; + * } + * \endcode + * + *

User subclasses are not supported. While clients may write + * subclasses, such code will not necessarily work and will not be + * guaranteed to work stably from release to release. + * + * @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments. + */ +class U_I18N_API ChoiceFormat: public NumberFormat { +public: + /** + * Constructs a new ChoiceFormat from the pattern string. + * + * @param pattern Pattern used to construct object. + * @param status Output param to receive success code. If the + * pattern cannot be parsed, set to failure code. + * @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments. + */ + ChoiceFormat(const UnicodeString& pattern, + UErrorCode& status); + + + /** + * Constructs a new ChoiceFormat with the given limits and message strings. + * All closure flags default to FALSE, + * equivalent to less_than_or_equal separators. + * + * Copies the limits and formats instead of adopting them. + * + * @param limits Array of limit values. + * @param formats Array of formats. + * @param count Size of 'limits' and 'formats' arrays. + * @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments. + */ + ChoiceFormat(const double* limits, + const UnicodeString* formats, + int32_t count ); + + /** + * Constructs a new ChoiceFormat with the given limits, closure flags and message strings. + * + * Copies the limits and formats instead of adopting them. + * + * @param limits Array of limit values + * @param closures Array of booleans specifying whether each + * element of 'limits' is open or closed. If FALSE, then the + * corresponding limit number is a member of its range. + * If TRUE, then the limit number belongs to the previous range it. + * @param formats Array of formats + * @param count Size of 'limits', 'closures', and 'formats' arrays + * @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments. + */ + ChoiceFormat(const double* limits, + const UBool* closures, + const UnicodeString* formats, + int32_t count); + + /** + * Copy constructor. + * + * @param that ChoiceFormat object to be copied from + * @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments. + */ + ChoiceFormat(const ChoiceFormat& that); + + /** + * Assignment operator. + * + * @param that ChoiceFormat object to be copied + * @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments. + */ + const ChoiceFormat& operator=(const ChoiceFormat& that); + + /** + * Destructor. + * @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments. + */ + virtual ~ChoiceFormat(); + + /** + * Clones this Format object. The caller owns the + * result and must delete it when done. + * + * @return a copy of this object + * @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments. + */ + virtual Format* clone(void) const; + + /** + * Returns true if the given Format objects are semantically equal. + * Objects of different subclasses are considered unequal. + * + * @param other ChoiceFormat object to be compared + * @return true if other is the same as this. + * @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments. + */ + virtual UBool operator==(const Format& other) const; + + /** + * Sets the pattern. + * @param pattern The pattern to be applied. + * @param status Output param set to success/failure code on + * exit. If the pattern is invalid, this will be + * set to a failure result. + * @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments. + */ + virtual void applyPattern(const UnicodeString& pattern, + UErrorCode& status); + + /** + * Sets the pattern. + * @param pattern The pattern to be applied. + * @param parseError Struct to receive information on position + * of error if an error is encountered + * @param status Output param set to success/failure code on + * exit. If the pattern is invalid, this will be + * set to a failure result. + * @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments. + */ + virtual void applyPattern(const UnicodeString& pattern, + UParseError& parseError, + UErrorCode& status); + /** + * Gets the pattern. + * + * @param pattern Output param which will receive the pattern + * Previous contents are deleted. + * @return A reference to 'pattern' + * @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments. + */ + virtual UnicodeString& toPattern(UnicodeString &pattern) const; + + /** + * Sets the choices to be used in formatting. + * For details see the constructor with the same parameter list. + * + * @param limitsToCopy Contains the top value that you want + * parsed with that format,and should be in + * ascending sorted order. When formatting X, + * the choice will be the i, where limit[i] + * <= X < limit[i+1]. + * @param formatsToCopy The format strings you want to use for each limit. + * @param count The size of the above arrays. + * @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments. + */ + virtual void setChoices(const double* limitsToCopy, + const UnicodeString* formatsToCopy, + int32_t count ); + + /** + * Sets the choices to be used in formatting. + * For details see the constructor with the same parameter list. + * + * @param limits Array of limits + * @param closures Array of limit booleans + * @param formats Array of format string + * @param count The size of the above arrays + * @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments. + */ + virtual void setChoices(const double* limits, + const UBool* closures, + const UnicodeString* formats, + int32_t count); + + /** + * Returns NULL and 0. + * Before ICU 4.8, this used to return the choice limits array. + * + * @param count Will be set to 0. + * @return NULL + * @deprecated ICU 4.8 Use the MessagePattern class to analyze a ChoiceFormat pattern. + */ + virtual const double* getLimits(int32_t& count) const; + + /** + * Returns NULL and 0. + * Before ICU 4.8, this used to return the limit booleans array. + * + * @param count Will be set to 0. + * @return NULL + * @deprecated ICU 4.8 Use the MessagePattern class to analyze a ChoiceFormat pattern. + */ + virtual const UBool* getClosures(int32_t& count) const; + + /** + * Returns NULL and 0. + * Before ICU 4.8, this used to return the array of choice strings. + * + * @param count Will be set to 0. + * @return NULL + * @deprecated ICU 4.8 Use the MessagePattern class to analyze a ChoiceFormat pattern. + */ + virtual const UnicodeString* getFormats(int32_t& count) const; + + + using NumberFormat::format; + + /** + * Formats a double number using this object's choices. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @return Reference to 'appendTo' parameter. + * @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments. + */ + virtual UnicodeString& format(double number, + UnicodeString& appendTo, + FieldPosition& pos) const; + /** + * Formats an int32_t number using this object's choices. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @return Reference to 'appendTo' parameter. + * @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments. + */ + virtual UnicodeString& format(int32_t number, + UnicodeString& appendTo, + FieldPosition& pos) const; + + /** + * Formats an int64_t number using this object's choices. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @return Reference to 'appendTo' parameter. + * @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments. + */ + virtual UnicodeString& format(int64_t number, + UnicodeString& appendTo, + FieldPosition& pos) const; + + /** + * Formats an array of objects using this object's choices. + * + * @param objs The array of objects to be formatted. + * @param cnt The size of objs. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @param success Output param set to success/failure code on + * exit. + * @return Reference to 'appendTo' parameter. + * @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments. + */ + virtual UnicodeString& format(const Formattable* objs, + int32_t cnt, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode& success) const; + + using NumberFormat::parse; + + /** + * Looks for the longest match of any message string on the input text and, + * if there is a match, sets the result object to the corresponding range's number. + * + * If no string matches, then the parsePosition is unchanged. + * + * @param text The text to be parsed. + * @param result Formattable to be set to the parse result. + * If parse fails, return contents are undefined. + * @param parsePosition The position to start parsing at on input. + * On output, moved to after the last successfully + * parse character. On parse failure, does not change. + * @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments. + */ + virtual void parse(const UnicodeString& text, + Formattable& result, + ParsePosition& parsePosition) const; + + /** + * Returns a unique class ID POLYMORPHICALLY. Part of ICU's "poor man's RTTI". + * + * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments. + */ + virtual UClassID getDynamicClassID(void) const; + + /** + * Returns the class ID for this class. This is useful only for + * comparing to a return value from getDynamicClassID(). For example: + *

+     * .       Base* polymorphic_pointer = createPolymorphicObject();
+     * .       if (polymorphic_pointer->getDynamicClassID() ==
+     * .           Derived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @deprecated ICU 49 Use MessageFormat instead, with plural and select arguments. + */ + static UClassID U_EXPORT2 getStaticClassID(void); + +private: + /** + * Converts a double value to a string. + * @param value the double number to be converted. + * @param string the result string. + * @return the converted string. + */ + static UnicodeString& dtos(double value, UnicodeString& string); + + ChoiceFormat(); // default constructor not implemented + + /** + * Construct a new ChoiceFormat with the limits and the corresponding formats + * based on the pattern. + * + * @param newPattern Pattern used to construct object. + * @param parseError Struct to receive information on position + * of error if an error is encountered. + * @param status Output param to receive success code. If the + * pattern cannot be parsed, set to failure code. + */ + ChoiceFormat(const UnicodeString& newPattern, + UParseError& parseError, + UErrorCode& status); + + friend class MessageFormat; + + virtual void setChoices(const double* limits, + const UBool* closures, + const UnicodeString* formats, + int32_t count, + UErrorCode &errorCode); + + /** + * Finds the ChoiceFormat sub-message for the given number. + * @param pattern A MessagePattern. + * @param partIndex the index of the first ChoiceFormat argument style part. + * @param number a number to be mapped to one of the ChoiceFormat argument's intervals + * @return the sub-message start part index. + */ + static int32_t findSubMessage(const MessagePattern &pattern, int32_t partIndex, double number); + + static double parseArgument( + const MessagePattern &pattern, int32_t partIndex, + const UnicodeString &source, ParsePosition &pos); + + /** + * Matches the pattern string from the end of the partIndex to + * the beginning of the limitPartIndex, + * including all syntax except SKIP_SYNTAX, + * against the source string starting at sourceOffset. + * If they match, returns the length of the source string match. + * Otherwise returns -1. + */ + static int32_t matchStringUntilLimitPart( + const MessagePattern &pattern, int32_t partIndex, int32_t limitPartIndex, + const UnicodeString &source, int32_t sourceOffset); + + /** + * Some of the ChoiceFormat constructors do not have a UErrorCode paramater. + * We need _some_ way to provide one for the MessagePattern constructor. + * Alternatively, the MessagePattern could be a pointer field, but that is + * not nice either. + */ + UErrorCode constructorErrorCode; + + /** + * The MessagePattern which contains the parsed structure of the pattern string. + * + * Starting with ICU 4.8, the MessagePattern contains a sequence of + * numeric/selector/message parts corresponding to the parsed pattern. + * For details see the MessagePattern class API docs. + */ + MessagePattern msgPattern; + + /** + * Docs & fields from before ICU 4.8, before MessagePattern was used. + * Commented out, and left only for explanation of semantics. + * -------- + * Each ChoiceFormat divides the range -Inf..+Inf into fCount + * intervals. The intervals are: + * + * 0: fChoiceLimits[0]..fChoiceLimits[1] + * 1: fChoiceLimits[1]..fChoiceLimits[2] + * ... + * fCount-2: fChoiceLimits[fCount-2]..fChoiceLimits[fCount-1] + * fCount-1: fChoiceLimits[fCount-1]..+Inf + * + * Interval 0 is special; during formatting (mapping numbers to + * strings), it also contains all numbers less than + * fChoiceLimits[0], as well as NaN values. + * + * Interval i maps to and from string fChoiceFormats[i]. When + * parsing (mapping strings to numbers), then intervals map to + * their lower limit, that is, interval i maps to fChoiceLimit[i]. + * + * The intervals may be closed, half open, or open. This affects + * formatting but does not affect parsing. Interval i is affected + * by fClosures[i] and fClosures[i+1]. If fClosures[i] + * is FALSE, then the value fChoiceLimits[i] is in interval i. + * That is, intervals i and i are: + * + * i-1: ... x < fChoiceLimits[i] + * i: fChoiceLimits[i] <= x ... + * + * If fClosures[i] is TRUE, then the value fChoiceLimits[i] is + * in interval i-1. That is, intervals i-1 and i are: + * + * i-1: ... x <= fChoiceLimits[i] + * i: fChoiceLimits[i] < x ... + * + * Because of the nature of interval 0, fClosures[0] has no + * effect. + */ + // double* fChoiceLimits; + // UBool* fClosures; + // UnicodeString* fChoiceFormats; + // int32_t fCount; +}; + + +U_NAMESPACE_END + +#endif // U_HIDE_DEPRECATED_API +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // CHOICFMT_H +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/coleitr.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/coleitr.h new file mode 100644 index 0000000..f2bd2ec --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/coleitr.h @@ -0,0 +1,407 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ****************************************************************************** + * Copyright (C) 1997-2014, International Business Machines + * Corporation and others. All Rights Reserved. + ****************************************************************************** + */ + +/** + * \file + * \brief C++ API: Collation Element Iterator. + */ + +/** +* File coleitr.h +* +* Created by: Helena Shih +* +* Modification History: +* +* Date Name Description +* +* 8/18/97 helena Added internal API documentation. +* 08/03/98 erm Synched with 1.2 version CollationElementIterator.java +* 12/10/99 aliu Ported Thai collation support from Java. +* 01/25/01 swquek Modified into a C++ wrapper calling C APIs (ucoliter.h) +* 02/19/01 swquek Removed CollationElementsIterator() since it is +* private constructor and no calls are made to it +* 2012-2014 markus Rewritten in C++ again. +*/ + +#ifndef COLEITR_H +#define COLEITR_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_COLLATION + +#include "unicode/unistr.h" +#include "unicode/uobject.h" + +struct UCollationElements; +struct UHashtable; + +U_NAMESPACE_BEGIN + +struct CollationData; + +class CharacterIterator; +class CollationIterator; +class RuleBasedCollator; +class UCollationPCE; +class UVector32; + +/** +* The CollationElementIterator class is used as an iterator to walk through +* each character of an international string. Use the iterator to return the +* ordering priority of the positioned character. The ordering priority of a +* character, which we refer to as a key, defines how a character is collated in +* the given collation object. +* For example, consider the following in Slovak and in traditional Spanish collation: +*
+*        "ca" -> the first key is key('c') and second key is key('a').
+*        "cha" -> the first key is key('ch') and second key is key('a').
+* And in German phonebook collation, +*
 \htmlonly       "æb"-> the first key is key('a'), the second key is key('e'), and
+*        the third key is key('b'). \endhtmlonly 
+* The key of a character, is an integer composed of primary order(short), +* secondary order(char), and tertiary order(char). Java strictly defines the +* size and signedness of its primitive data types. Therefore, the static +* functions primaryOrder(), secondaryOrder(), and tertiaryOrder() return +* int32_t to ensure the correctness of the key value. +*

Example of the iterator usage: (without error checking) +*

+* \code
+*   void CollationElementIterator_Example()
+*   {
+*       UnicodeString str = "This is a test";
+*       UErrorCode success = U_ZERO_ERROR;
+*       RuleBasedCollator* rbc =
+*           (RuleBasedCollator*) RuleBasedCollator::createInstance(success);
+*       CollationElementIterator* c =
+*           rbc->createCollationElementIterator( str );
+*       int32_t order = c->next(success);
+*       c->reset();
+*       order = c->previous(success);
+*       delete c;
+*       delete rbc;
+*   }
+* \endcode
+* 
+*

+* The method next() returns the collation order of the next character based on +* the comparison level of the collator. The method previous() returns the +* collation order of the previous character based on the comparison level of +* the collator. The Collation Element Iterator moves only in one direction +* between calls to reset(), setOffset(), or setText(). That is, next() +* and previous() can not be inter-used. Whenever previous() is to be called after +* next() or vice versa, reset(), setOffset() or setText() has to be called first +* to reset the status, shifting pointers to either the end or the start of +* the string (reset() or setText()), or the specified position (setOffset()). +* Hence at the next call of next() or previous(), the first or last collation order, +* or collation order at the spefcifieid position will be returned. If a change of +* direction is done without one of these calls, the result is undefined. +*

+* The result of a forward iterate (next()) and reversed result of the backward +* iterate (previous()) on the same string are equivalent, if collation orders +* with the value 0 are ignored. +* Character based on the comparison level of the collator. A collation order +* consists of primary order, secondary order and tertiary order. The data +* type of the collation order is int32_t. +* +* Note, CollationElementIterator should not be subclassed. +* @see Collator +* @see RuleBasedCollator +* @version 1.8 Jan 16 2001 +*/ +class U_I18N_API CollationElementIterator U_FINAL : public UObject { +public: + + // CollationElementIterator public data member ------------------------------ + + enum { + /** + * NULLORDER indicates that an error has occured while processing + * @stable ICU 2.0 + */ + NULLORDER = (int32_t)0xffffffff + }; + + // CollationElementIterator public constructor/destructor ------------------- + + /** + * Copy constructor. + * + * @param other the object to be copied from + * @stable ICU 2.0 + */ + CollationElementIterator(const CollationElementIterator& other); + + /** + * Destructor + * @stable ICU 2.0 + */ + virtual ~CollationElementIterator(); + + // CollationElementIterator public methods ---------------------------------- + + /** + * Returns true if "other" is the same as "this" + * + * @param other the object to be compared + * @return true if "other" is the same as "this" + * @stable ICU 2.0 + */ + UBool operator==(const CollationElementIterator& other) const; + + /** + * Returns true if "other" is not the same as "this". + * + * @param other the object to be compared + * @return true if "other" is not the same as "this" + * @stable ICU 2.0 + */ + UBool operator!=(const CollationElementIterator& other) const; + + /** + * Resets the cursor to the beginning of the string. + * @stable ICU 2.0 + */ + void reset(void); + + /** + * Gets the ordering priority of the next character in the string. + * @param status the error code status. + * @return the next character's ordering. otherwise returns NULLORDER if an + * error has occured or if the end of string has been reached + * @stable ICU 2.0 + */ + int32_t next(UErrorCode& status); + + /** + * Get the ordering priority of the previous collation element in the string. + * @param status the error code status. + * @return the previous element's ordering. otherwise returns NULLORDER if an + * error has occured or if the start of string has been reached + * @stable ICU 2.0 + */ + int32_t previous(UErrorCode& status); + + /** + * Gets the primary order of a collation order. + * @param order the collation order + * @return the primary order of a collation order. + * @stable ICU 2.0 + */ + static inline int32_t primaryOrder(int32_t order); + + /** + * Gets the secondary order of a collation order. + * @param order the collation order + * @return the secondary order of a collation order. + * @stable ICU 2.0 + */ + static inline int32_t secondaryOrder(int32_t order); + + /** + * Gets the tertiary order of a collation order. + * @param order the collation order + * @return the tertiary order of a collation order. + * @stable ICU 2.0 + */ + static inline int32_t tertiaryOrder(int32_t order); + + /** + * Return the maximum length of any expansion sequences that end with the + * specified comparison order. + * @param order a collation order returned by previous or next. + * @return maximum size of the expansion sequences ending with the collation + * element or 1 if collation element does not occur at the end of any + * expansion sequence + * @stable ICU 2.0 + */ + int32_t getMaxExpansion(int32_t order) const; + + /** + * Gets the comparison order in the desired strength. Ignore the other + * differences. + * @param order The order value + * @stable ICU 2.0 + */ + int32_t strengthOrder(int32_t order) const; + + /** + * Sets the source string. + * @param str the source string. + * @param status the error code status. + * @stable ICU 2.0 + */ + void setText(const UnicodeString& str, UErrorCode& status); + + /** + * Sets the source string. + * @param str the source character iterator. + * @param status the error code status. + * @stable ICU 2.0 + */ + void setText(CharacterIterator& str, UErrorCode& status); + + /** + * Checks if a comparison order is ignorable. + * @param order the collation order. + * @return TRUE if a character is ignorable, FALSE otherwise. + * @stable ICU 2.0 + */ + static inline UBool isIgnorable(int32_t order); + + /** + * Gets the offset of the currently processed character in the source string. + * @return the offset of the character. + * @stable ICU 2.0 + */ + int32_t getOffset(void) const; + + /** + * Sets the offset of the currently processed character in the source string. + * @param newOffset the new offset. + * @param status the error code status. + * @return the offset of the character. + * @stable ICU 2.0 + */ + void setOffset(int32_t newOffset, UErrorCode& status); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.2 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.2 + */ + static UClassID U_EXPORT2 getStaticClassID(); + +#ifndef U_HIDE_INTERNAL_API + /** @internal */ + static inline CollationElementIterator *fromUCollationElements(UCollationElements *uc) { + return reinterpret_cast(uc); + } + /** @internal */ + static inline const CollationElementIterator *fromUCollationElements(const UCollationElements *uc) { + return reinterpret_cast(uc); + } + /** @internal */ + inline UCollationElements *toUCollationElements() { + return reinterpret_cast(this); + } + /** @internal */ + inline const UCollationElements *toUCollationElements() const { + return reinterpret_cast(this); + } +#endif // U_HIDE_INTERNAL_API + +private: + friend class RuleBasedCollator; + friend class UCollationPCE; + + /** + * CollationElementIterator constructor. This takes the source string and the + * collation object. The cursor will walk thru the source string based on the + * predefined collation rules. If the source string is empty, NULLORDER will + * be returned on the calls to next(). + * @param sourceText the source string. + * @param order the collation object. + * @param status the error code status. + */ + CollationElementIterator(const UnicodeString& sourceText, + const RuleBasedCollator* order, UErrorCode& status); + // Note: The constructors should take settings & tailoring, not a collator, + // to avoid circular dependencies. + // However, for operator==() we would need to be able to compare tailoring data for equality + // without making CollationData or CollationTailoring depend on TailoredSet. + // (See the implementation of RuleBasedCollator::operator==().) + // That might require creating an intermediate class that would be used + // by both CollationElementIterator and RuleBasedCollator + // but only contain the part of RBC== related to data and rules. + + /** + * CollationElementIterator constructor. This takes the source string and the + * collation object. The cursor will walk thru the source string based on the + * predefined collation rules. If the source string is empty, NULLORDER will + * be returned on the calls to next(). + * @param sourceText the source string. + * @param order the collation object. + * @param status the error code status. + */ + CollationElementIterator(const CharacterIterator& sourceText, + const RuleBasedCollator* order, UErrorCode& status); + + /** + * Assignment operator + * + * @param other the object to be copied + */ + const CollationElementIterator& + operator=(const CollationElementIterator& other); + + CollationElementIterator(); // default constructor not implemented + + /** Normalizes dir_=1 (just after setOffset()) to dir_=0 (just after reset()). */ + inline int8_t normalizeDir() const { return dir_ == 1 ? 0 : dir_; } + + static UHashtable *computeMaxExpansions(const CollationData *data, UErrorCode &errorCode); + + static int32_t getMaxExpansion(const UHashtable *maxExpansions, int32_t order); + + // CollationElementIterator private data members ---------------------------- + + CollationIterator *iter_; // owned + const RuleBasedCollator *rbc_; // aliased + uint32_t otherHalf_; + /** + * <0: backwards; 0: just after reset() (previous() begins from end); + * 1: just after setOffset(); >1: forward + */ + int8_t dir_; + /** + * Stores offsets from expansions and from unsafe-backwards iteration, + * so that getOffset() returns intermediate offsets for the CEs + * that are consistent with forward iteration. + */ + UVector32 *offsets_; + + UnicodeString string_; +}; + +// CollationElementIterator inline method definitions -------------------------- + +inline int32_t CollationElementIterator::primaryOrder(int32_t order) +{ + return (order >> 16) & 0xffff; +} + +inline int32_t CollationElementIterator::secondaryOrder(int32_t order) +{ + return (order >> 8) & 0xff; +} + +inline int32_t CollationElementIterator::tertiaryOrder(int32_t order) +{ + return order & 0xff; +} + +inline UBool CollationElementIterator::isIgnorable(int32_t order) +{ + return (order & 0xffff0000) == 0; +} + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_COLLATION */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/coll.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/coll.h new file mode 100644 index 0000000..d035705 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/coll.h @@ -0,0 +1,1274 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* Copyright (C) 1996-2016, International Business Machines +* Corporation and others. All Rights Reserved. +****************************************************************************** +*/ + +/** + * \file + * \brief C++ API: Collation Service. + */ + +/** +* File coll.h +* +* Created by: Helena Shih +* +* Modification History: +* +* Date Name Description +* 02/5/97 aliu Modified createDefault to load collation data from +* binary files when possible. Added related methods +* createCollationFromFile, chopLocale, createPathName. +* 02/11/97 aliu Added members addToCache, findInCache, and fgCache. +* 02/12/97 aliu Modified to create objects from RuleBasedCollator cache. +* Moved cache out of Collation class. +* 02/13/97 aliu Moved several methods out of this class and into +* RuleBasedCollator, with modifications. Modified +* createDefault() to call new RuleBasedCollator(Locale&) +* constructor. General clean up and documentation. +* 02/20/97 helena Added clone, operator==, operator!=, operator=, copy +* constructor and getDynamicClassID. +* 03/25/97 helena Updated with platform independent data types. +* 05/06/97 helena Added memory allocation error detection. +* 06/20/97 helena Java class name change. +* 09/03/97 helena Added createCollationKeyValues(). +* 02/10/98 damiba Added compare() with length as parameter. +* 04/23/99 stephen Removed EDecompositionMode, merged with +* Normalizer::EMode. +* 11/02/99 helena Collator performance enhancements. Eliminates the +* UnicodeString construction and special case for NO_OP. +* 11/23/99 srl More performance enhancements. Inlining of +* critical accessors. +* 05/15/00 helena Added version information API. +* 01/29/01 synwee Modified into a C++ wrapper which calls C apis +* (ucol.h). +* 2012-2014 markus Rewritten in C++ again. +*/ + +#ifndef COLL_H +#define COLL_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_COLLATION + +#include "unicode/uobject.h" +#include "unicode/ucol.h" +#include "unicode/unorm.h" +#include "unicode/locid.h" +#include "unicode/uniset.h" +#include "unicode/umisc.h" +#include "unicode/uiter.h" +#include "unicode/stringpiece.h" + +U_NAMESPACE_BEGIN + +class StringEnumeration; + +#if !UCONFIG_NO_SERVICE +/** + * @stable ICU 2.6 + */ +class CollatorFactory; +#endif + +/** +* @stable ICU 2.0 +*/ +class CollationKey; + +/** +* The Collator class performs locale-sensitive string +* comparison.
+* You use this class to build searching and sorting routines for natural +* language text. +*

+* Collator is an abstract base class. Subclasses implement +* specific collation strategies. One subclass, +* RuleBasedCollator, is currently provided and is applicable +* to a wide set of languages. Other subclasses may be created to handle more +* specialized needs. +*

+* Like other locale-sensitive classes, you can use the static factory method, +* createInstance, to obtain the appropriate +* Collator object for a given locale. You will only need to +* look at the subclasses of Collator if you need to +* understand the details of a particular collation strategy or if you need to +* modify that strategy. +*

+* The following example shows how to compare two strings using the +* Collator for the default locale. +* \htmlonly

\endhtmlonly +*
+* \code
+* // Compare two strings in the default locale
+* UErrorCode success = U_ZERO_ERROR;
+* Collator* myCollator = Collator::createInstance(success);
+* if (myCollator->compare("abc", "ABC") < 0)
+*   cout << "abc is less than ABC" << endl;
+* else
+*   cout << "abc is greater than or equal to ABC" << endl;
+* \endcode
+* 
+* \htmlonly
\endhtmlonly +*

+* You can set a Collator's strength attribute to +* determine the level of difference considered significant in comparisons. +* Five strengths are provided: PRIMARY, SECONDARY, +* TERTIARY, QUATERNARY and IDENTICAL. +* The exact assignment of strengths to language features is locale dependent. +* For example, in Czech, "e" and "f" are considered primary differences, +* while "e" and "\u00EA" are secondary differences, "e" and "E" are tertiary +* differences and "e" and "e" are identical. The following shows how both case +* and accents could be ignored for US English. +* \htmlonly

\endhtmlonly +*
+* \code
+* //Get the Collator for US English and set its strength to PRIMARY
+* UErrorCode success = U_ZERO_ERROR;
+* Collator* usCollator = Collator::createInstance(Locale::getUS(), success);
+* usCollator->setStrength(Collator::PRIMARY);
+* if (usCollator->compare("abc", "ABC") == 0)
+*     cout << "'abc' and 'ABC' strings are equivalent with strength PRIMARY" << endl;
+* \endcode
+* 
+* \htmlonly
\endhtmlonly +* +* The getSortKey methods +* convert a string to a series of bytes that can be compared bitwise against +* other sort keys using strcmp(). Sort keys are written as +* zero-terminated byte strings. +* +* Another set of APIs returns a CollationKey object that wraps +* the sort key bytes instead of returning the bytes themselves. +*

+*

+* Note: Collators with different Locale, +* and CollationStrength settings will return different sort +* orders for the same set of strings. Locales have specific collation rules, +* and the way in which secondary and tertiary differences are taken into +* account, for example, will result in a different sorting order for same +* strings. +*

+* @see RuleBasedCollator +* @see CollationKey +* @see CollationElementIterator +* @see Locale +* @see Normalizer2 +* @version 2.0 11/15/01 +*/ + +class U_I18N_API Collator : public UObject { +public: + + // Collator public enums ----------------------------------------------- + + /** + * Base letter represents a primary difference. Set comparison level to + * PRIMARY to ignore secondary and tertiary differences.
+ * Use this to set the strength of a Collator object.
+ * Example of primary difference, "abc" < "abd" + * + * Diacritical differences on the same base letter represent a secondary + * difference. Set comparison level to SECONDARY to ignore tertiary + * differences. Use this to set the strength of a Collator object.
+ * Example of secondary difference, "ä" >> "a". + * + * Uppercase and lowercase versions of the same character represents a + * tertiary difference. Set comparison level to TERTIARY to include all + * comparison differences. Use this to set the strength of a Collator + * object.
+ * Example of tertiary difference, "abc" <<< "ABC". + * + * Two characters are considered "identical" when they have the same unicode + * spellings.
+ * For example, "ä" == "ä". + * + * UCollationStrength is also used to determine the strength of sort keys + * generated from Collator objects. + * @stable ICU 2.0 + */ + enum ECollationStrength + { + PRIMARY = UCOL_PRIMARY, // 0 + SECONDARY = UCOL_SECONDARY, // 1 + TERTIARY = UCOL_TERTIARY, // 2 + QUATERNARY = UCOL_QUATERNARY, // 3 + IDENTICAL = UCOL_IDENTICAL // 15 + }; + + + // Cannot use #ifndef U_HIDE_DEPRECATED_API for the following, it is + // used by virtual methods that cannot have that conditional. + /** + * LESS is returned if source string is compared to be less than target + * string in the compare() method. + * EQUAL is returned if source string is compared to be equal to target + * string in the compare() method. + * GREATER is returned if source string is compared to be greater than + * target string in the compare() method. + * @see Collator#compare + * @deprecated ICU 2.6. Use C enum UCollationResult defined in ucol.h + */ + enum EComparisonResult + { + LESS = UCOL_LESS, // -1 + EQUAL = UCOL_EQUAL, // 0 + GREATER = UCOL_GREATER // 1 + }; + + // Collator public destructor ----------------------------------------- + + /** + * Destructor + * @stable ICU 2.0 + */ + virtual ~Collator(); + + // Collator public methods -------------------------------------------- + + /** + * Returns TRUE if "other" is the same as "this". + * + * The base class implementation returns TRUE if "other" has the same type/class as "this": + * typeid(*this) == typeid(other). + * + * Subclass implementations should do something like the following: + *
+     *   if (this == &other) { return TRUE; }
+     *   if (!Collator::operator==(other)) { return FALSE; }  // not the same class
+     *
+     *   const MyCollator &o = (const MyCollator&)other;
+     *   (compare this vs. o's subclass fields)
+     * 
+ * @param other Collator object to be compared + * @return TRUE if other is the same as this. + * @stable ICU 2.0 + */ + virtual UBool operator==(const Collator& other) const; + + /** + * Returns true if "other" is not the same as "this". + * Calls ! operator==(const Collator&) const which works for all subclasses. + * @param other Collator object to be compared + * @return TRUE if other is not the same as this. + * @stable ICU 2.0 + */ + virtual UBool operator!=(const Collator& other) const; + + /** + * Makes a copy of this object. + * @return a copy of this object, owned by the caller + * @stable ICU 2.0 + */ + virtual Collator* clone(void) const = 0; + + /** + * Creates the Collator object for the current default locale. + * The default locale is determined by Locale::getDefault. + * The UErrorCode& err parameter is used to return status information to the user. + * To check whether the construction succeeded or not, you should check the + * value of U_SUCCESS(err). If you wish more detailed information, you can + * check for informational error results which still indicate success. + * U_USING_FALLBACK_ERROR indicates that a fall back locale was used. For + * example, 'de_CH' was requested, but nothing was found there, so 'de' was + * used. U_USING_DEFAULT_ERROR indicates that the default locale data was + * used; neither the requested locale nor any of its fall back locales + * could be found. + * The caller owns the returned object and is responsible for deleting it. + * + * @param err the error code status. + * @return the collation object of the default locale.(for example, en_US) + * @see Locale#getDefault + * @stable ICU 2.0 + */ + static Collator* U_EXPORT2 createInstance(UErrorCode& err); + + /** + * Gets the collation object for the desired locale. The + * resource of the desired locale will be loaded. + * + * Locale::getRoot() is the base collation table and all other languages are + * built on top of it with additional language-specific modifications. + * + * For some languages, multiple collation types are available; + * for example, "de@collation=phonebook". + * Starting with ICU 54, collation attributes can be specified via locale keywords as well, + * in the old locale extension syntax ("el@colCaseFirst=upper") + * or in language tag syntax ("el-u-kf-upper"). + * See User Guide: Collation API. + * + * The UErrorCode& err parameter is used to return status information to the user. + * To check whether the construction succeeded or not, you should check + * the value of U_SUCCESS(err). If you wish more detailed information, you + * can check for informational error results which still indicate success. + * U_USING_FALLBACK_ERROR indicates that a fall back locale was used. For + * example, 'de_CH' was requested, but nothing was found there, so 'de' was + * used. U_USING_DEFAULT_ERROR indicates that the default locale data was + * used; neither the requested locale nor any of its fall back locales + * could be found. + * + * The caller owns the returned object and is responsible for deleting it. + * @param loc The locale ID for which to open a collator. + * @param err the error code status. + * @return the created table-based collation object based on the desired + * locale. + * @see Locale + * @see ResourceLoader + * @stable ICU 2.2 + */ + static Collator* U_EXPORT2 createInstance(const Locale& loc, UErrorCode& err); + + /** + * The comparison function compares the character data stored in two + * different strings. Returns information about whether a string is less + * than, greater than or equal to another string. + * @param source the source string to be compared with. + * @param target the string that is to be compared with the source string. + * @return Returns a byte value. GREATER if source is greater + * than target; EQUAL if source is equal to target; LESS if source is less + * than target + * @deprecated ICU 2.6 use the overload with UErrorCode & + */ + virtual EComparisonResult compare(const UnicodeString& source, + const UnicodeString& target) const; + + /** + * The comparison function compares the character data stored in two + * different strings. Returns information about whether a string is less + * than, greater than or equal to another string. + * @param source the source string to be compared with. + * @param target the string that is to be compared with the source string. + * @param status possible error code + * @return Returns an enum value. UCOL_GREATER if source is greater + * than target; UCOL_EQUAL if source is equal to target; UCOL_LESS if source is less + * than target + * @stable ICU 2.6 + */ + virtual UCollationResult compare(const UnicodeString& source, + const UnicodeString& target, + UErrorCode &status) const = 0; + + /** + * Does the same thing as compare but limits the comparison to a specified + * length + * @param source the source string to be compared with. + * @param target the string that is to be compared with the source string. + * @param length the length the comparison is limited to + * @return Returns a byte value. GREATER if source (up to the specified + * length) is greater than target; EQUAL if source (up to specified + * length) is equal to target; LESS if source (up to the specified + * length) is less than target. + * @deprecated ICU 2.6 use the overload with UErrorCode & + */ + virtual EComparisonResult compare(const UnicodeString& source, + const UnicodeString& target, + int32_t length) const; + + /** + * Does the same thing as compare but limits the comparison to a specified + * length + * @param source the source string to be compared with. + * @param target the string that is to be compared with the source string. + * @param length the length the comparison is limited to + * @param status possible error code + * @return Returns an enum value. UCOL_GREATER if source (up to the specified + * length) is greater than target; UCOL_EQUAL if source (up to specified + * length) is equal to target; UCOL_LESS if source (up to the specified + * length) is less than target. + * @stable ICU 2.6 + */ + virtual UCollationResult compare(const UnicodeString& source, + const UnicodeString& target, + int32_t length, + UErrorCode &status) const = 0; + + /** + * The comparison function compares the character data stored in two + * different string arrays. Returns information about whether a string array + * is less than, greater than or equal to another string array. + *

Example of use: + *

+     * .       char16_t ABC[] = {0x41, 0x42, 0x43, 0};  // = "ABC"
+     * .       char16_t abc[] = {0x61, 0x62, 0x63, 0};  // = "abc"
+     * .       UErrorCode status = U_ZERO_ERROR;
+     * .       Collator *myCollation =
+     * .                         Collator::createInstance(Locale::getUS(), status);
+     * .       if (U_FAILURE(status)) return;
+     * .       myCollation->setStrength(Collator::PRIMARY);
+     * .       // result would be Collator::EQUAL ("abc" == "ABC")
+     * .       // (no primary difference between "abc" and "ABC")
+     * .       Collator::EComparisonResult result =
+     * .                             myCollation->compare(abc, 3, ABC, 3);
+     * .       myCollation->setStrength(Collator::TERTIARY);
+     * .       // result would be Collator::LESS ("abc" <<< "ABC")
+     * .       // (with tertiary difference between "abc" and "ABC")
+     * .       result = myCollation->compare(abc, 3, ABC, 3);
+     * 
+ * @param source the source string array to be compared with. + * @param sourceLength the length of the source string array. If this value + * is equal to -1, the string array is null-terminated. + * @param target the string that is to be compared with the source string. + * @param targetLength the length of the target string array. If this value + * is equal to -1, the string array is null-terminated. + * @return Returns a byte value. GREATER if source is greater than target; + * EQUAL if source is equal to target; LESS if source is less than + * target + * @deprecated ICU 2.6 use the overload with UErrorCode & + */ + virtual EComparisonResult compare(const char16_t* source, int32_t sourceLength, + const char16_t* target, int32_t targetLength) + const; + + /** + * The comparison function compares the character data stored in two + * different string arrays. Returns information about whether a string array + * is less than, greater than or equal to another string array. + * @param source the source string array to be compared with. + * @param sourceLength the length of the source string array. If this value + * is equal to -1, the string array is null-terminated. + * @param target the string that is to be compared with the source string. + * @param targetLength the length of the target string array. If this value + * is equal to -1, the string array is null-terminated. + * @param status possible error code + * @return Returns an enum value. UCOL_GREATER if source is greater + * than target; UCOL_EQUAL if source is equal to target; UCOL_LESS if source is less + * than target + * @stable ICU 2.6 + */ + virtual UCollationResult compare(const char16_t* source, int32_t sourceLength, + const char16_t* target, int32_t targetLength, + UErrorCode &status) const = 0; + + /** + * Compares two strings using the Collator. + * Returns whether the first one compares less than/equal to/greater than + * the second one. + * This version takes UCharIterator input. + * @param sIter the first ("source") string iterator + * @param tIter the second ("target") string iterator + * @param status ICU status + * @return UCOL_LESS, UCOL_EQUAL or UCOL_GREATER + * @stable ICU 4.2 + */ + virtual UCollationResult compare(UCharIterator &sIter, + UCharIterator &tIter, + UErrorCode &status) const; + + /** + * Compares two UTF-8 strings using the Collator. + * Returns whether the first one compares less than/equal to/greater than + * the second one. + * This version takes UTF-8 input. + * Note that a StringPiece can be implicitly constructed + * from a std::string or a NUL-terminated const char * string. + * @param source the first UTF-8 string + * @param target the second UTF-8 string + * @param status ICU status + * @return UCOL_LESS, UCOL_EQUAL or UCOL_GREATER + * @stable ICU 4.2 + */ + virtual UCollationResult compareUTF8(const StringPiece &source, + const StringPiece &target, + UErrorCode &status) const; + + /** + * Transforms the string into a series of characters that can be compared + * with CollationKey::compareTo. It is not possible to restore the original + * string from the chars in the sort key. + *

Use CollationKey::equals or CollationKey::compare to compare the + * generated sort keys. + * If the source string is null, a null collation key will be returned. + * + * Note that sort keys are often less efficient than simply doing comparison. + * For more details, see the ICU User Guide. + * + * @param source the source string to be transformed into a sort key. + * @param key the collation key to be filled in + * @param status the error code status. + * @return the collation key of the string based on the collation rules. + * @see CollationKey#compare + * @stable ICU 2.0 + */ + virtual CollationKey& getCollationKey(const UnicodeString& source, + CollationKey& key, + UErrorCode& status) const = 0; + + /** + * Transforms the string into a series of characters that can be compared + * with CollationKey::compareTo. It is not possible to restore the original + * string from the chars in the sort key. + *

Use CollationKey::equals or CollationKey::compare to compare the + * generated sort keys. + *

If the source string is null, a null collation key will be returned. + * + * Note that sort keys are often less efficient than simply doing comparison. + * For more details, see the ICU User Guide. + * + * @param source the source string to be transformed into a sort key. + * @param sourceLength length of the collation key + * @param key the collation key to be filled in + * @param status the error code status. + * @return the collation key of the string based on the collation rules. + * @see CollationKey#compare + * @stable ICU 2.0 + */ + virtual CollationKey& getCollationKey(const char16_t*source, + int32_t sourceLength, + CollationKey& key, + UErrorCode& status) const = 0; + /** + * Generates the hash code for the collation object + * @stable ICU 2.0 + */ + virtual int32_t hashCode(void) const = 0; + + /** + * Gets the locale of the Collator + * + * @param type can be either requested, valid or actual locale. For more + * information see the definition of ULocDataLocaleType in + * uloc.h + * @param status the error code status. + * @return locale where the collation data lives. If the collator + * was instantiated from rules, locale is empty. + * @deprecated ICU 2.8 This API is under consideration for revision + * in ICU 3.0. + */ + virtual Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const = 0; + + /** + * Convenience method for comparing two strings based on the collation rules. + * @param source the source string to be compared with. + * @param target the target string to be compared with. + * @return true if the first string is greater than the second one, + * according to the collation rules. false, otherwise. + * @see Collator#compare + * @stable ICU 2.0 + */ + UBool greater(const UnicodeString& source, const UnicodeString& target) + const; + + /** + * Convenience method for comparing two strings based on the collation rules. + * @param source the source string to be compared with. + * @param target the target string to be compared with. + * @return true if the first string is greater than or equal to the second + * one, according to the collation rules. false, otherwise. + * @see Collator#compare + * @stable ICU 2.0 + */ + UBool greaterOrEqual(const UnicodeString& source, + const UnicodeString& target) const; + + /** + * Convenience method for comparing two strings based on the collation rules. + * @param source the source string to be compared with. + * @param target the target string to be compared with. + * @return true if the strings are equal according to the collation rules. + * false, otherwise. + * @see Collator#compare + * @stable ICU 2.0 + */ + UBool equals(const UnicodeString& source, const UnicodeString& target) const; + + /** + * Determines the minimum strength that will be used in comparison or + * transformation. + *

E.g. with strength == SECONDARY, the tertiary difference is ignored + *

E.g. with strength == PRIMARY, the secondary and tertiary difference + * are ignored. + * @return the current comparison level. + * @see Collator#setStrength + * @deprecated ICU 2.6 Use getAttribute(UCOL_STRENGTH...) instead + */ + virtual ECollationStrength getStrength(void) const; + + /** + * Sets the minimum strength to be used in comparison or transformation. + *

Example of use: + *

+     *  \code
+     *  UErrorCode status = U_ZERO_ERROR;
+     *  Collator*myCollation = Collator::createInstance(Locale::getUS(), status);
+     *  if (U_FAILURE(status)) return;
+     *  myCollation->setStrength(Collator::PRIMARY);
+     *  // result will be "abc" == "ABC"
+     *  // tertiary differences will be ignored
+     *  Collator::ComparisonResult result = myCollation->compare("abc", "ABC");
+     * \endcode
+     * 
+ * @see Collator#getStrength + * @param newStrength the new comparison level. + * @deprecated ICU 2.6 Use setAttribute(UCOL_STRENGTH...) instead + */ + virtual void setStrength(ECollationStrength newStrength); + + /** + * Retrieves the reordering codes for this collator. + * @param dest The array to fill with the script ordering. + * @param destCapacity The length of dest. If it is 0, then dest may be NULL and the function + * will only return the length of the result without writing any codes (pre-flighting). + * @param status A reference to an error code value, which must not indicate + * a failure before the function call. + * @return The length of the script ordering array. + * @see ucol_setReorderCodes + * @see Collator#getEquivalentReorderCodes + * @see Collator#setReorderCodes + * @see UScriptCode + * @see UColReorderCode + * @stable ICU 4.8 + */ + virtual int32_t getReorderCodes(int32_t *dest, + int32_t destCapacity, + UErrorCode& status) const; + + /** + * Sets the ordering of scripts for this collator. + * + *

The reordering codes are a combination of script codes and reorder codes. + * @param reorderCodes An array of script codes in the new order. This can be NULL if the + * length is also set to 0. An empty array will clear any reordering codes on the collator. + * @param reorderCodesLength The length of reorderCodes. + * @param status error code + * @see ucol_setReorderCodes + * @see Collator#getReorderCodes + * @see Collator#getEquivalentReorderCodes + * @see UScriptCode + * @see UColReorderCode + * @stable ICU 4.8 + */ + virtual void setReorderCodes(const int32_t* reorderCodes, + int32_t reorderCodesLength, + UErrorCode& status) ; + + /** + * Retrieves the reorder codes that are grouped with the given reorder code. Some reorder + * codes will be grouped and must reorder together. + * Beginning with ICU 55, scripts only reorder together if they are primary-equal, + * for example Hiragana and Katakana. + * + * @param reorderCode The reorder code to determine equivalence for. + * @param dest The array to fill with the script equivalence reordering codes. + * @param destCapacity The length of dest. If it is 0, then dest may be NULL and the + * function will only return the length of the result without writing any codes (pre-flighting). + * @param status A reference to an error code value, which must not indicate + * a failure before the function call. + * @return The length of the of the reordering code equivalence array. + * @see ucol_setReorderCodes + * @see Collator#getReorderCodes + * @see Collator#setReorderCodes + * @see UScriptCode + * @see UColReorderCode + * @stable ICU 4.8 + */ + static int32_t U_EXPORT2 getEquivalentReorderCodes(int32_t reorderCode, + int32_t* dest, + int32_t destCapacity, + UErrorCode& status); + + /** + * Get name of the object for the desired Locale, in the desired language + * @param objectLocale must be from getAvailableLocales + * @param displayLocale specifies the desired locale for output + * @param name the fill-in parameter of the return value + * @return display-able name of the object for the object locale in the + * desired language + * @stable ICU 2.0 + */ + static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale, + const Locale& displayLocale, + UnicodeString& name); + + /** + * Get name of the object for the desired Locale, in the language of the + * default locale. + * @param objectLocale must be from getAvailableLocales + * @param name the fill-in parameter of the return value + * @return name of the object for the desired locale in the default language + * @stable ICU 2.0 + */ + static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale, + UnicodeString& name); + + /** + * Get the set of Locales for which Collations are installed. + * + *

Note this does not include locales supported by registered collators. + * If collators might have been registered, use the overload of getAvailableLocales + * that returns a StringEnumeration.

+ * + * @param count the output parameter of number of elements in the locale list + * @return the list of available locales for which collations are installed + * @stable ICU 2.0 + */ + static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count); + + /** + * Return a StringEnumeration over the locales available at the time of the call, + * including registered locales. If a severe error occurs (such as out of memory + * condition) this will return null. If there is no locale data, an empty enumeration + * will be returned. + * @return a StringEnumeration over the locales available at the time of the call + * @stable ICU 2.6 + */ + static StringEnumeration* U_EXPORT2 getAvailableLocales(void); + + /** + * Create a string enumerator of all possible keywords that are relevant to + * collation. At this point, the only recognized keyword for this + * service is "collation". + * @param status input-output error code + * @return a string enumeration over locale strings. The caller is + * responsible for closing the result. + * @stable ICU 3.0 + */ + static StringEnumeration* U_EXPORT2 getKeywords(UErrorCode& status); + + /** + * Given a keyword, create a string enumeration of all values + * for that keyword that are currently in use. + * @param keyword a particular keyword as enumerated by + * ucol_getKeywords. If any other keyword is passed in, status is set + * to U_ILLEGAL_ARGUMENT_ERROR. + * @param status input-output error code + * @return a string enumeration over collation keyword values, or NULL + * upon error. The caller is responsible for deleting the result. + * @stable ICU 3.0 + */ + static StringEnumeration* U_EXPORT2 getKeywordValues(const char *keyword, UErrorCode& status); + + /** + * Given a key and a locale, returns an array of string values in a preferred + * order that would make a difference. These are all and only those values where + * the open (creation) of the service with the locale formed from the input locale + * plus input keyword and that value has different behavior than creation with the + * input locale alone. + * @param keyword one of the keys supported by this service. For now, only + * "collation" is supported. + * @param locale the locale + * @param commonlyUsed if set to true it will return only commonly used values + * with the given locale in preferred order. Otherwise, + * it will return all the available values for the locale. + * @param status ICU status + * @return a string enumeration over keyword values for the given key and the locale. + * @stable ICU 4.2 + */ + static StringEnumeration* U_EXPORT2 getKeywordValuesForLocale(const char* keyword, const Locale& locale, + UBool commonlyUsed, UErrorCode& status); + + /** + * Return the functionally equivalent locale for the given + * requested locale, with respect to given keyword, for the + * collation service. If two locales return the same result, then + * collators instantiated for these locales will behave + * equivalently. The converse is not always true; two collators + * may in fact be equivalent, but return different results, due to + * internal details. The return result has no other meaning than + * that stated above, and implies nothing as to the relationship + * between the two locales. This is intended for use by + * applications who wish to cache collators, or otherwise reuse + * collators when possible. The functional equivalent may change + * over time. For more information, please see the + * Locales and Services section of the ICU User Guide. + * @param keyword a particular keyword as enumerated by + * ucol_getKeywords. + * @param locale the requested locale + * @param isAvailable reference to a fillin parameter that + * indicates whether the requested locale was 'available' to the + * collation service. A locale is defined as 'available' if it + * physically exists within the collation locale data. + * @param status reference to input-output error code + * @return the functionally equivalent collation locale, or the root + * locale upon error. + * @stable ICU 3.0 + */ + static Locale U_EXPORT2 getFunctionalEquivalent(const char* keyword, const Locale& locale, + UBool& isAvailable, UErrorCode& status); + +#if !UCONFIG_NO_SERVICE + /** + * Register a new Collator. The collator will be adopted. + * Because ICU may choose to cache collators internally, this must be + * called at application startup, prior to any calls to + * Collator::createInstance to avoid undefined behavior. + * @param toAdopt the Collator instance to be adopted + * @param locale the locale with which the collator will be associated + * @param status the in/out status code, no special meanings are assigned + * @return a registry key that can be used to unregister this collator + * @stable ICU 2.6 + */ + static URegistryKey U_EXPORT2 registerInstance(Collator* toAdopt, const Locale& locale, UErrorCode& status); + + /** + * Register a new CollatorFactory. The factory will be adopted. + * Because ICU may choose to cache collators internally, this must be + * called at application startup, prior to any calls to + * Collator::createInstance to avoid undefined behavior. + * @param toAdopt the CollatorFactory instance to be adopted + * @param status the in/out status code, no special meanings are assigned + * @return a registry key that can be used to unregister this collator + * @stable ICU 2.6 + */ + static URegistryKey U_EXPORT2 registerFactory(CollatorFactory* toAdopt, UErrorCode& status); + + /** + * Unregister a previously-registered Collator or CollatorFactory + * using the key returned from the register call. Key becomes + * invalid after a successful call and should not be used again. + * The object corresponding to the key will be deleted. + * Because ICU may choose to cache collators internally, this should + * be called during application shutdown, after all calls to + * Collator::createInstance to avoid undefined behavior. + * @param key the registry key returned by a previous call to registerInstance + * @param status the in/out status code, no special meanings are assigned + * @return TRUE if the collator for the key was successfully unregistered + * @stable ICU 2.6 + */ + static UBool U_EXPORT2 unregister(URegistryKey key, UErrorCode& status); +#endif /* UCONFIG_NO_SERVICE */ + + /** + * Gets the version information for a Collator. + * @param info the version # information, the result will be filled in + * @stable ICU 2.0 + */ + virtual void getVersion(UVersionInfo info) const = 0; + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual method. + * This method is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and clone() + * methods call this method. + * @return The class ID for this object. All objects of a given class have + * the same class ID. Objects of other classes have different class + * IDs. + * @stable ICU 2.0 + */ + virtual UClassID getDynamicClassID(void) const = 0; + + /** + * Universal attribute setter + * @param attr attribute type + * @param value attribute value + * @param status to indicate whether the operation went on smoothly or + * there were errors + * @stable ICU 2.2 + */ + virtual void setAttribute(UColAttribute attr, UColAttributeValue value, + UErrorCode &status) = 0; + + /** + * Universal attribute getter + * @param attr attribute type + * @param status to indicate whether the operation went on smoothly or + * there were errors + * @return attribute value + * @stable ICU 2.2 + */ + virtual UColAttributeValue getAttribute(UColAttribute attr, + UErrorCode &status) const = 0; + + /** + * Sets the variable top to the top of the specified reordering group. + * The variable top determines the highest-sorting character + * which is affected by UCOL_ALTERNATE_HANDLING. + * If that attribute is set to UCOL_NON_IGNORABLE, then the variable top has no effect. + * + * The base class implementation sets U_UNSUPPORTED_ERROR. + * @param group one of UCOL_REORDER_CODE_SPACE, UCOL_REORDER_CODE_PUNCTUATION, + * UCOL_REORDER_CODE_SYMBOL, UCOL_REORDER_CODE_CURRENCY; + * or UCOL_REORDER_CODE_DEFAULT to restore the default max variable group + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return *this + * @see getMaxVariable + * @stable ICU 53 + */ + virtual Collator &setMaxVariable(UColReorderCode group, UErrorCode &errorCode); + + /** + * Returns the maximum reordering group whose characters are affected by UCOL_ALTERNATE_HANDLING. + * + * The base class implementation returns UCOL_REORDER_CODE_PUNCTUATION. + * @return the maximum variable reordering group. + * @see setMaxVariable + * @stable ICU 53 + */ + virtual UColReorderCode getMaxVariable() const; + + /** + * Sets the variable top to the primary weight of the specified string. + * + * Beginning with ICU 53, the variable top is pinned to + * the top of one of the supported reordering groups, + * and it must not be beyond the last of those groups. + * See setMaxVariable(). + * @param varTop one or more (if contraction) char16_ts to which the variable top should be set + * @param len length of variable top string. If -1 it is considered to be zero terminated. + * @param status error code. If error code is set, the return value is undefined. Errors set by this function are:
+ * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such contraction
+ * U_ILLEGAL_ARGUMENT_ERROR if the variable top is beyond + * the last reordering group supported by setMaxVariable() + * @return variable top primary weight + * @deprecated ICU 53 Call setMaxVariable() instead. + */ + virtual uint32_t setVariableTop(const char16_t *varTop, int32_t len, UErrorCode &status) = 0; + + /** + * Sets the variable top to the primary weight of the specified string. + * + * Beginning with ICU 53, the variable top is pinned to + * the top of one of the supported reordering groups, + * and it must not be beyond the last of those groups. + * See setMaxVariable(). + * @param varTop a UnicodeString size 1 or more (if contraction) of char16_ts to which the variable top should be set + * @param status error code. If error code is set, the return value is undefined. Errors set by this function are:
+ * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such contraction
+ * U_ILLEGAL_ARGUMENT_ERROR if the variable top is beyond + * the last reordering group supported by setMaxVariable() + * @return variable top primary weight + * @deprecated ICU 53 Call setMaxVariable() instead. + */ + virtual uint32_t setVariableTop(const UnicodeString &varTop, UErrorCode &status) = 0; + + /** + * Sets the variable top to the specified primary weight. + * + * Beginning with ICU 53, the variable top is pinned to + * the top of one of the supported reordering groups, + * and it must not be beyond the last of those groups. + * See setMaxVariable(). + * @param varTop primary weight, as returned by setVariableTop or ucol_getVariableTop + * @param status error code + * @deprecated ICU 53 Call setMaxVariable() instead. + */ + virtual void setVariableTop(uint32_t varTop, UErrorCode &status) = 0; + + /** + * Gets the variable top value of a Collator. + * @param status error code (not changed by function). If error code is set, the return value is undefined. + * @return the variable top primary weight + * @see getMaxVariable + * @stable ICU 2.0 + */ + virtual uint32_t getVariableTop(UErrorCode &status) const = 0; + + /** + * Get a UnicodeSet that contains all the characters and sequences + * tailored in this collator. + * @param status error code of the operation + * @return a pointer to a UnicodeSet object containing all the + * code points and sequences that may sort differently than + * in the root collator. The object must be disposed of by using delete + * @stable ICU 2.4 + */ + virtual UnicodeSet *getTailoredSet(UErrorCode &status) const; + + /** + * Same as clone(). + * The base class implementation simply calls clone(). + * @return a copy of this object, owned by the caller + * @see clone() + * @deprecated ICU 50 no need to have two methods for cloning + */ + virtual Collator* safeClone(void) const; + + /** + * Get the sort key as an array of bytes from a UnicodeString. + * Sort key byte arrays are zero-terminated and can be compared using + * strcmp(). + * + * Note that sort keys are often less efficient than simply doing comparison. + * For more details, see the ICU User Guide. + * + * @param source string to be processed. + * @param result buffer to store result in. If NULL, number of bytes needed + * will be returned. + * @param resultLength length of the result buffer. If if not enough the + * buffer will be filled to capacity. + * @return Number of bytes needed for storing the sort key + * @stable ICU 2.2 + */ + virtual int32_t getSortKey(const UnicodeString& source, + uint8_t* result, + int32_t resultLength) const = 0; + + /** + * Get the sort key as an array of bytes from a char16_t buffer. + * Sort key byte arrays are zero-terminated and can be compared using + * strcmp(). + * + * Note that sort keys are often less efficient than simply doing comparison. + * For more details, see the ICU User Guide. + * + * @param source string to be processed. + * @param sourceLength length of string to be processed. + * If -1, the string is 0 terminated and length will be decided by the + * function. + * @param result buffer to store result in. If NULL, number of bytes needed + * will be returned. + * @param resultLength length of the result buffer. If if not enough the + * buffer will be filled to capacity. + * @return Number of bytes needed for storing the sort key + * @stable ICU 2.2 + */ + virtual int32_t getSortKey(const char16_t*source, int32_t sourceLength, + uint8_t*result, int32_t resultLength) const = 0; + + /** + * Produce a bound for a given sortkey and a number of levels. + * Return value is always the number of bytes needed, regardless of + * whether the result buffer was big enough or even valid.
+ * Resulting bounds can be used to produce a range of strings that are + * between upper and lower bounds. For example, if bounds are produced + * for a sortkey of string "smith", strings between upper and lower + * bounds with one level would include "Smith", "SMITH", "sMiTh".
+ * There are two upper bounds that can be produced. If UCOL_BOUND_UPPER + * is produced, strings matched would be as above. However, if bound + * produced using UCOL_BOUND_UPPER_LONG is used, the above example will + * also match "Smithsonian" and similar.
+ * For more on usage, see example in cintltst/capitst.c in procedure + * TestBounds. + * Sort keys may be compared using strcmp. + * @param source The source sortkey. + * @param sourceLength The length of source, or -1 if null-terminated. + * (If an unmodified sortkey is passed, it is always null + * terminated). + * @param boundType Type of bound required. It can be UCOL_BOUND_LOWER, which + * produces a lower inclusive bound, UCOL_BOUND_UPPER, that + * produces upper bound that matches strings of the same length + * or UCOL_BOUND_UPPER_LONG that matches strings that have the + * same starting substring as the source string. + * @param noOfLevels Number of levels required in the resulting bound (for most + * uses, the recommended value is 1). See users guide for + * explanation on number of levels a sortkey can have. + * @param result A pointer to a buffer to receive the resulting sortkey. + * @param resultLength The maximum size of result. + * @param status Used for returning error code if something went wrong. If the + * number of levels requested is higher than the number of levels + * in the source key, a warning (U_SORT_KEY_TOO_SHORT_WARNING) is + * issued. + * @return The size needed to fully store the bound. + * @see ucol_keyHashCode + * @stable ICU 2.1 + */ + static int32_t U_EXPORT2 getBound(const uint8_t *source, + int32_t sourceLength, + UColBoundMode boundType, + uint32_t noOfLevels, + uint8_t *result, + int32_t resultLength, + UErrorCode &status); + + +protected: + + // Collator protected constructors ------------------------------------- + + /** + * Default constructor. + * Constructor is different from the old default Collator constructor. + * The task for determing the default collation strength and normalization + * mode is left to the child class. + * @stable ICU 2.0 + */ + Collator(); + +#ifndef U_HIDE_DEPRECATED_API + /** + * Constructor. + * Empty constructor, does not handle the arguments. + * This constructor is done for backward compatibility with 1.7 and 1.8. + * The task for handling the argument collation strength and normalization + * mode is left to the child class. + * @param collationStrength collation strength + * @param decompositionMode + * @deprecated ICU 2.4. Subclasses should use the default constructor + * instead and handle the strength and normalization mode themselves. + */ + Collator(UCollationStrength collationStrength, + UNormalizationMode decompositionMode); +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Copy constructor. + * @param other Collator object to be copied from + * @stable ICU 2.0 + */ + Collator(const Collator& other); + +public: + /** + * Used internally by registration to define the requested and valid locales. + * @param requestedLocale the requested locale + * @param validLocale the valid locale + * @param actualLocale the actual locale + * @internal + */ + virtual void setLocales(const Locale& requestedLocale, const Locale& validLocale, const Locale& actualLocale); + + /** Get the short definition string for a collator. This internal API harvests the collator's + * locale and the attribute set and produces a string that can be used for opening + * a collator with the same attributes using the ucol_openFromShortString API. + * This string will be normalized. + * The structure and the syntax of the string is defined in the "Naming collators" + * section of the users guide: + * http://userguide.icu-project.org/collation/concepts#TOC-Collator-naming-scheme + * This function supports preflighting. + * + * This is internal, and intended to be used with delegate converters. + * + * @param locale a locale that will appear as a collators locale in the resulting + * short string definition. If NULL, the locale will be harvested + * from the collator. + * @param buffer space to hold the resulting string + * @param capacity capacity of the buffer + * @param status for returning errors. All the preflighting errors are featured + * @return length of the resulting string + * @see ucol_openFromShortString + * @see ucol_normalizeShortDefinitionString + * @see ucol_getShortDefinitionString + * @internal + */ + virtual int32_t internalGetShortDefinitionString(const char *locale, + char *buffer, + int32_t capacity, + UErrorCode &status) const; + + /** + * Implements ucol_strcollUTF8(). + * @internal + */ + virtual UCollationResult internalCompareUTF8( + const char *left, int32_t leftLength, + const char *right, int32_t rightLength, + UErrorCode &errorCode) const; + + /** + * Implements ucol_nextSortKeyPart(). + * @internal + */ + virtual int32_t + internalNextSortKeyPart( + UCharIterator *iter, uint32_t state[2], + uint8_t *dest, int32_t count, UErrorCode &errorCode) const; + +#ifndef U_HIDE_INTERNAL_API + /** @internal */ + static inline Collator *fromUCollator(UCollator *uc) { + return reinterpret_cast(uc); + } + /** @internal */ + static inline const Collator *fromUCollator(const UCollator *uc) { + return reinterpret_cast(uc); + } + /** @internal */ + inline UCollator *toUCollator() { + return reinterpret_cast(this); + } + /** @internal */ + inline const UCollator *toUCollator() const { + return reinterpret_cast(this); + } +#endif // U_HIDE_INTERNAL_API + +private: + /** + * Assignment operator. Private for now. + */ + Collator& operator=(const Collator& other); + + friend class CFactory; + friend class SimpleCFactory; + friend class ICUCollatorFactory; + friend class ICUCollatorService; + static Collator* makeInstance(const Locale& desiredLocale, + UErrorCode& status); +}; + +#if !UCONFIG_NO_SERVICE +/** + * A factory, used with registerFactory, the creates multiple collators and provides + * display names for them. A factory supports some number of locales-- these are the + * locales for which it can create collators. The factory can be visible, in which + * case the supported locales will be enumerated by getAvailableLocales, or invisible, + * in which they are not. Invisible locales are still supported, they are just not + * listed by getAvailableLocales. + *

+ * If standard locale display names are sufficient, Collator instances can + * be registered using registerInstance instead.

+ *

+ * Note: if the collators are to be used from C APIs, they must be instances + * of RuleBasedCollator.

+ * + * @stable ICU 2.6 + */ +class U_I18N_API CollatorFactory : public UObject { +public: + + /** + * Destructor + * @stable ICU 3.0 + */ + virtual ~CollatorFactory(); + + /** + * Return true if this factory is visible. Default is true. + * If not visible, the locales supported by this factory will not + * be listed by getAvailableLocales. + * @return true if the factory is visible. + * @stable ICU 2.6 + */ + virtual UBool visible(void) const; + + /** + * Return a collator for the provided locale. If the locale + * is not supported, return NULL. + * @param loc the locale identifying the collator to be created. + * @return a new collator if the locale is supported, otherwise NULL. + * @stable ICU 2.6 + */ + virtual Collator* createCollator(const Locale& loc) = 0; + + /** + * Return the name of the collator for the objectLocale, localized for the displayLocale. + * If objectLocale is not supported, or the factory is not visible, set the result string + * to bogus. + * @param objectLocale the locale identifying the collator + * @param displayLocale the locale for which the display name of the collator should be localized + * @param result an output parameter for the display name, set to bogus if not supported. + * @return the display name + * @stable ICU 2.6 + */ + virtual UnicodeString& getDisplayName(const Locale& objectLocale, + const Locale& displayLocale, + UnicodeString& result); + + /** + * Return an array of all the locale names directly supported by this factory. + * The number of names is returned in count. This array is owned by the factory. + * Its contents must never change. + * @param count output parameter for the number of locales supported by the factory + * @param status the in/out error code + * @return a pointer to an array of count UnicodeStrings. + * @stable ICU 2.6 + */ + virtual const UnicodeString * getSupportedIDs(int32_t &count, UErrorCode& status) = 0; +}; +#endif /* UCONFIG_NO_SERVICE */ + +// Collator inline methods ----------------------------------------------- + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_COLLATION */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/compactdecimalformat.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/compactdecimalformat.h new file mode 100644 index 0000000..3fbe5da --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/compactdecimalformat.h @@ -0,0 +1,415 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************** +* Copyright (C) 2012-2016, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************** +* +* File COMPACTDECIMALFORMAT.H +******************************************************************************** +*/ + +#ifndef __COMPACT_DECIMAL_FORMAT_H__ +#define __COMPACT_DECIMAL_FORMAT_H__ + +#include "unicode/utypes.h" +/** + * \file + * \brief C++ API: Formats decimal numbers in compact form. + */ + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/decimfmt.h" + +struct UHashtable; + +U_NAMESPACE_BEGIN + +class PluralRules; + +/** + * The CompactDecimalFormat produces abbreviated numbers, suitable for display in + * environments will limited real estate. For example, 'Hits: 1.2B' instead of + * 'Hits: 1,200,000,000'. The format will be appropriate for the given language, + * such as "1,2 Mrd." for German. + *

+ * For numbers under 1000 trillion (under 10^15, such as 123,456,789,012,345), + * the result will be short for supported languages. However, the result may + * sometimes exceed 7 characters, such as when there are combining marks or thin + * characters. In such cases, the visual width in fonts should still be short. + *

+ * By default, there are 3 significant digits. After creation, if more than + * three significant digits are set (with setMaximumSignificantDigits), or if a + * fixed number of digits are set (with setMaximumIntegerDigits or + * setMaximumFractionDigits), then result may be wider. + *

+ * At this time, parsing is not supported, and will produce a U_UNSUPPORTED_ERROR. + * Resetting the pattern prefixes or suffixes is not supported; the method calls + * are ignored. + *

+ * @stable ICU 51 + */ +class U_I18N_API CompactDecimalFormat : public DecimalFormat { +public: + + /** + * Returns a compact decimal instance for specified locale. + * @param inLocale the given locale. + * @param style whether to use short or long style. + * @param status error code returned here. + * @stable ICU 51 + */ + static CompactDecimalFormat* U_EXPORT2 createInstance( + const Locale& inLocale, UNumberCompactStyle style, UErrorCode& status); + + /** + * Copy constructor. + * + * @param source the DecimalFormat object to be copied from. + * @stable ICU 51 + */ + CompactDecimalFormat(const CompactDecimalFormat& source); + + /** + * Destructor. + * @stable ICU 51 + */ + virtual ~CompactDecimalFormat(); + + /** + * Assignment operator. + * + * @param rhs the DecimalFormat object to be copied. + * @stable ICU 51 + */ + CompactDecimalFormat& operator=(const CompactDecimalFormat& rhs); + + /** + * Clone this Format object polymorphically. The caller owns the + * result and should delete it when done. + * + * @return a polymorphic copy of this CompactDecimalFormat. + * @stable ICU 51 + */ + virtual Format* clone() const; + + /** + * Return TRUE if the given Format objects are semantically equal. + * Objects of different subclasses are considered unequal. + * + * @param other the object to be compared with. + * @return TRUE if the given Format objects are semantically equal. + * @stable ICU 51 + */ + virtual UBool operator==(const Format& other) const; + + + using DecimalFormat::format; + + /** + * Format a double or long number using base-10 representation. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @return Reference to 'appendTo' parameter. + * @stable ICU 51 + */ + virtual UnicodeString& format(double number, + UnicodeString& appendTo, + FieldPosition& pos) const; + + /** + * Format a double or long number using base-10 representation. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @param status + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format(double number, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode &status) const; + + /** + * Format a double or long number using base-10 representation. + * Currently sets status to U_UNSUPPORTED_ERROR. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param posIter On return, can be used to iterate over positions + * of fields generated by this format call. + * Can be NULL. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format(double number, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; + + /** + * Format a long number using base-10 representation. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @return Reference to 'appendTo' parameter. + * @stable ICU 56 + */ + virtual UnicodeString& format(int32_t number, + UnicodeString& appendTo, + FieldPosition& pos) const; + + /** + * Format a long number using base-10 representation. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format(int32_t number, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode &status) const; + + /** + * Format a long number using base-10 representation. + * Currently sets status to U_UNSUPPORTED_ERROR + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param posIter On return, can be used to iterate over positions + * of fields generated by this format call. + * Can be NULL. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format(int32_t number, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; + + /** + * Format an int64 number using base-10 representation. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @return Reference to 'appendTo' parameter. + * @stable ICU 51 + */ + virtual UnicodeString& format(int64_t number, + UnicodeString& appendTo, + FieldPosition& pos) const; + + /** + * Format an int64 number using base-10 representation. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format(int64_t number, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode &status) const; + + /** + * Format an int64 number using base-10 representation. + * Currently sets status to U_UNSUPPORTED_ERROR + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param posIter On return, can be used to iterate over positions + * of fields generated by this format call. + * Can be NULL. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format(int64_t number, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; + + /** + * Format a decimal number. Currently sets status to U_UNSUPPORTED_ERROR + * The syntax of the unformatted number is a "numeric string" + * as defined in the Decimal Arithmetic Specification, available at + * http://speleotrove.com/decimal + * + * @param number The unformatted number, as a string. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param posIter On return, can be used to iterate over positions + * of fields generated by this format call. + * Can be NULL. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format(StringPiece number, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; + + /** + * Format a decimal number. Currently sets status to U_UNSUPPORTED_ERROR + * The number is a DigitList wrapper onto a floating point decimal number. + * The default implementation in NumberFormat converts the decimal number + * to a double and formats that. + * + * @param number The number, a DigitList format Decimal Floating Point. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param posIter On return, can be used to iterate over positions + * of fields generated by this format call. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format(const DigitList &number, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; + + /** + * Format a decimal number. Currently sets status to U_UNSUPPORTED_ERROR. + * The number is a DigitList wrapper onto a floating point decimal number. + * The default implementation in NumberFormat converts the decimal number + * to a double and formats that. + * + * @param number The number, a DigitList format Decimal Floating Point. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format(const DigitList &number, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode& status) const; + + /** + * CompactDecimalFormat does not support parsing. This implementation + * does nothing. + * @param text Unused. + * @param result Does not change. + * @param parsePosition Does not change. + * @see Formattable + * @stable ICU 51 + */ + virtual void parse(const UnicodeString& text, + Formattable& result, + ParsePosition& parsePosition) const; + + /** + * CompactDecimalFormat does not support parsing. This implementation + * sets status to U_UNSUPPORTED_ERROR + * + * @param text Unused. + * @param result Does not change. + * @param status Always set to U_UNSUPPORTED_ERROR. + * @stable ICU 51 + */ + virtual void parse(const UnicodeString& text, + Formattable& result, + UErrorCode& status) const; + + /** + * Parses text from the given string as a currency amount. Unlike + * the parse() method, this method will attempt to parse a generic + * currency name, searching for a match of this object's locale's + * currency display names, or for a 3-letter ISO currency code. + * This method will fail if this format is not a currency format, + * that is, if it does not contain the currency pattern symbol + * (U+00A4) in its prefix or suffix. This implementation always returns + * NULL. + * + * @param text the string to parse + * @param pos input-output position; on input, the position within text + * to match; must have 0 <= pos.getIndex() < text.length(); + * on output, the position after the last matched character. + * If the parse fails, the position in unchanged upon output. + * @return if parse succeeds, a pointer to a newly-created CurrencyAmount + * object (owned by the caller) containing information about + * the parsed currency; if parse fails, this is NULL. + * @internal + */ + virtual CurrencyAmount* parseCurrency(const UnicodeString& text, + ParsePosition& pos) const; + + /** + * Return the class ID for this class. This is useful only for + * comparing to a return value from getDynamicClassID(). For example: + *

+     * .      Base* polymorphic_pointer = createPolymorphicObject();
+     * .      if (polymorphic_pointer->getDynamicClassID() ==
+     * .          Derived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @stable ICU 51 + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. + * This method is to implement a simple version of RTTI, since not all + * C++ compilers support genuine RTTI. Polymorphic operator==() and + * clone() methods call this method. + * + * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @stable ICU 51 + */ + virtual UClassID getDynamicClassID() const; + +private: + + const UHashtable* _unitsByVariant; + const double* _divisors; + PluralRules* _pluralRules; + + // Default constructor not implemented. + CompactDecimalFormat(const DecimalFormat &, const UHashtable* unitsByVariant, const double* divisors, PluralRules* pluralRules); + + UBool eqHelper(const CompactDecimalFormat& that) const; +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // __COMPACT_DECIMAL_FORMAT_H__ +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/curramt.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/curramt.h new file mode 100644 index 0000000..e321df8 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/curramt.h @@ -0,0 +1,132 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2004-2006, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Author: Alan Liu +* Created: April 26, 2004 +* Since: ICU 3.0 +********************************************************************** +*/ +#ifndef __CURRENCYAMOUNT_H__ +#define __CURRENCYAMOUNT_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/measure.h" +#include "unicode/currunit.h" + +/** + * \file + * \brief C++ API: Currency Amount Object. + */ + +U_NAMESPACE_BEGIN + +/** + * + * A currency together with a numeric amount, such as 200 USD. + * + * @author Alan Liu + * @stable ICU 3.0 + */ +class U_I18N_API CurrencyAmount: public Measure { + public: + /** + * Construct an object with the given numeric amount and the given + * ISO currency code. + * @param amount a numeric object; amount.isNumeric() must be TRUE + * @param isoCode the 3-letter ISO 4217 currency code; must not be + * NULL and must have length 3 + * @param ec input-output error code. If the amount or the isoCode + * is invalid, then this will be set to a failing value. + * @stable ICU 3.0 + */ + CurrencyAmount(const Formattable& amount, ConstChar16Ptr isoCode, + UErrorCode &ec); + + /** + * Construct an object with the given numeric amount and the given + * ISO currency code. + * @param amount the amount of the given currency + * @param isoCode the 3-letter ISO 4217 currency code; must not be + * NULL and must have length 3 + * @param ec input-output error code. If the isoCode is invalid, + * then this will be set to a failing value. + * @stable ICU 3.0 + */ + CurrencyAmount(double amount, ConstChar16Ptr isoCode, + UErrorCode &ec); + + /** + * Copy constructor + * @stable ICU 3.0 + */ + CurrencyAmount(const CurrencyAmount& other); + + /** + * Assignment operator + * @stable ICU 3.0 + */ + CurrencyAmount& operator=(const CurrencyAmount& other); + + /** + * Return a polymorphic clone of this object. The result will + * have the same class as returned by getDynamicClassID(). + * @stable ICU 3.0 + */ + virtual UObject* clone() const; + + /** + * Destructor + * @stable ICU 3.0 + */ + virtual ~CurrencyAmount(); + + /** + * Returns a unique class ID for this object POLYMORPHICALLY. + * This method implements a simple form of RTTI used by ICU. + * @return The class ID for this object. All objects of a given + * class have the same class ID. Objects of other classes have + * different class IDs. + * @stable ICU 3.0 + */ + virtual UClassID getDynamicClassID() const; + + /** + * Returns the class ID for this class. This is used to compare to + * the return value of getDynamicClassID(). + * @return The class ID for all objects of this class. + * @stable ICU 3.0 + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * Return the currency unit object of this object. + * @stable ICU 3.0 + */ + inline const CurrencyUnit& getCurrency() const; + + /** + * Return the ISO currency code of this object. + * @stable ICU 3.0 + */ + inline const char16_t* getISOCurrency() const; +}; + +inline const CurrencyUnit& CurrencyAmount::getCurrency() const { + return (const CurrencyUnit&) getUnit(); +} + +inline const char16_t* CurrencyAmount::getISOCurrency() const { + return getCurrency().getISOCurrency(); +} + +U_NAMESPACE_END + +#endif // !UCONFIG_NO_FORMATTING +#endif // __CURRENCYAMOUNT_H__ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/currpinf.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/currpinf.h new file mode 100644 index 0000000..33c18b0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/currpinf.h @@ -0,0 +1,261 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ******************************************************************************* + * Copyright (C) 2009-2015, International Business Machines Corporation and * + * others. All Rights Reserved. * + ******************************************************************************* + */ +#ifndef CURRPINF_H +#define CURRPINF_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Currency Plural Information used by Decimal Format + */ + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/unistr.h" + +U_NAMESPACE_BEGIN + +class Locale; +class PluralRules; +class Hashtable; + +/** + * This class represents the information needed by + * DecimalFormat to format currency plural, + * such as "3.00 US dollars" or "1.00 US dollar". + * DecimalFormat creates for itself an instance of + * CurrencyPluralInfo from its locale data. + * If you need to change any of these symbols, you can get the + * CurrencyPluralInfo object from your + * DecimalFormat and modify it. + * + * Following are the information needed for currency plural format and parse: + * locale information, + * plural rule of the locale, + * currency plural pattern of the locale. + * + * @stable ICU 4.2 + */ +class U_I18N_API CurrencyPluralInfo : public UObject { +public: + + /** + * Create a CurrencyPluralInfo object for the default locale. + * @param status output param set to success/failure code on exit + * @stable ICU 4.2 + */ + CurrencyPluralInfo(UErrorCode& status); + + /** + * Create a CurrencyPluralInfo object for the given locale. + * @param locale the locale + * @param status output param set to success/failure code on exit + * @stable ICU 4.2 + */ + CurrencyPluralInfo(const Locale& locale, UErrorCode& status); + + /** + * Copy constructor + * + * @stable ICU 4.2 + */ + CurrencyPluralInfo(const CurrencyPluralInfo& info); + + + /** + * Assignment operator + * + * @stable ICU 4.2 + */ + CurrencyPluralInfo& operator=(const CurrencyPluralInfo& info); + + + /** + * Destructor + * + * @stable ICU 4.2 + */ + virtual ~CurrencyPluralInfo(); + + + /** + * Equal operator. + * + * @stable ICU 4.2 + */ + UBool operator==(const CurrencyPluralInfo& info) const; + + + /** + * Not equal operator + * + * @stable ICU 4.2 + */ + UBool operator!=(const CurrencyPluralInfo& info) const; + + + /** + * Clone + * + * @stable ICU 4.2 + */ + CurrencyPluralInfo* clone() const; + + + /** + * Gets plural rules of this locale, used for currency plural format + * + * @return plural rule + * @stable ICU 4.2 + */ + const PluralRules* getPluralRules() const; + + /** + * Given a plural count, gets currency plural pattern of this locale, + * used for currency plural format + * + * @param pluralCount currency plural count + * @param result output param to receive the pattern + * @return a currency plural pattern based on plural count + * @stable ICU 4.2 + */ + UnicodeString& getCurrencyPluralPattern(const UnicodeString& pluralCount, + UnicodeString& result) const; + + /** + * Get locale + * + * @return locale + * @stable ICU 4.2 + */ + const Locale& getLocale() const; + + /** + * Set plural rules. + * The plural rule is set when CurrencyPluralInfo + * instance is created. + * You can call this method to reset plural rules only if you want + * to modify the default plural rule of the locale. + * + * @param ruleDescription new plural rule description + * @param status output param set to success/failure code on exit + * @stable ICU 4.2 + */ + void setPluralRules(const UnicodeString& ruleDescription, + UErrorCode& status); + + /** + * Set currency plural pattern. + * The currency plural pattern is set when CurrencyPluralInfo + * instance is created. + * You can call this method to reset currency plural pattern only if + * you want to modify the default currency plural pattern of the locale. + * + * @param pluralCount the plural count for which the currency pattern will + * be overridden. + * @param pattern the new currency plural pattern + * @param status output param set to success/failure code on exit + * @stable ICU 4.2 + */ + void setCurrencyPluralPattern(const UnicodeString& pluralCount, + const UnicodeString& pattern, + UErrorCode& status); + + /** + * Set locale + * + * @param loc the new locale to set + * @param status output param set to success/failure code on exit + * @stable ICU 4.2 + */ + void setLocale(const Locale& loc, UErrorCode& status); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 4.2 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 4.2 + */ + static UClassID U_EXPORT2 getStaticClassID(); + +private: + friend class DecimalFormat; + friend class DecimalFormatImpl; + + void initialize(const Locale& loc, UErrorCode& status); + + void setupCurrencyPluralPattern(const Locale& loc, UErrorCode& status); + + /* + * delete hash table + * + * @param hTable hash table to be deleted + */ + void deleteHash(Hashtable* hTable); + + + /* + * initialize hash table + * + * @param status output param set to success/failure code on exit + * @return hash table initialized + */ + Hashtable* initHash(UErrorCode& status); + + + + /** + * copy hash table + * + * @param source the source to copy from + * @param target the target to copy to + * @param status error code + */ + void copyHash(const Hashtable* source, Hashtable* target, UErrorCode& status); + + //-------------------- private data member --------------------- + // map from plural count to currency plural pattern, for example + // a plural pattern defined in "CurrencyUnitPatterns" is + // "one{{0} {1}}", in which "one" is a plural count + // and "{0} {1}" is a currency plural pattern". + // The currency plural pattern saved in this mapping is the pattern + // defined in "CurrencyUnitPattern" by replacing + // {0} with the number format pattern, + // and {1} with 3 currency sign. + Hashtable* fPluralCountToCurrencyUnitPattern; + + /* + * The plural rule is used to format currency plural name, + * for example: "3.00 US Dollars". + * If there are 3 currency signs in the currency patttern, + * the 3 currency signs will be replaced by currency plural name. + */ + PluralRules* fPluralRules; + + // locale + Locale* fLocale; +}; + + +inline UBool +CurrencyPluralInfo::operator!=(const CurrencyPluralInfo& info) const { return !operator==(info); } + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // _CURRPINFO +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/currunit.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/currunit.h new file mode 100644 index 0000000..5ad23b1 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/currunit.h @@ -0,0 +1,130 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2004-2014, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Author: Alan Liu +* Created: April 26, 2004 +* Since: ICU 3.0 +********************************************************************** +*/ +#ifndef __CURRENCYUNIT_H__ +#define __CURRENCYUNIT_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/measunit.h" + +/** + * \file + * \brief C++ API: Currency Unit Information. + */ + +U_NAMESPACE_BEGIN + +/** + * A unit of currency, such as USD (U.S. dollars) or JPY (Japanese + * yen). This class is a thin wrapper over a char16_t string that + * subclasses MeasureUnit, for use with Measure and MeasureFormat. + * + * @author Alan Liu + * @stable ICU 3.0 + */ +class U_I18N_API CurrencyUnit: public MeasureUnit { + public: + /** + * Default constructor. Initializes currency code to "XXX" (no currency). + * @draft ICU 60 + */ + CurrencyUnit(); + + /** + * Construct an object with the given ISO currency code. + * @param isoCode the 3-letter ISO 4217 currency code; must not be + * NULL and must have length 3 + * @param ec input-output error code. If the isoCode is invalid, + * then this will be set to a failing value. + * @stable ICU 3.0 + */ + CurrencyUnit(ConstChar16Ptr isoCode, UErrorCode &ec); + + /** + * Copy constructor + * @stable ICU 3.0 + */ + CurrencyUnit(const CurrencyUnit& other); + +#ifndef U_HIDE_DRAFT_API + /** + * Copy constructor from MeasureUnit. This constructor allows you to + * restore a CurrencyUnit that was sliced to MeasureUnit. + * + * @param measureUnit The MeasureUnit to copy from. + * @param ec Set to a failing value if the MeasureUnit is not a currency. + * @draft ICU 60 + */ + CurrencyUnit(const MeasureUnit& measureUnit, UErrorCode &ec); +#endif /* U_HIDE_DRAFT_API */ + + /** + * Assignment operator + * @stable ICU 3.0 + */ + CurrencyUnit& operator=(const CurrencyUnit& other); + + /** + * Return a polymorphic clone of this object. The result will + * have the same class as returned by getDynamicClassID(). + * @stable ICU 3.0 + */ + virtual UObject* clone() const; + + /** + * Destructor + * @stable ICU 3.0 + */ + virtual ~CurrencyUnit(); + + /** + * Returns a unique class ID for this object POLYMORPHICALLY. + * This method implements a simple form of RTTI used by ICU. + * @return The class ID for this object. All objects of a given + * class have the same class ID. Objects of other classes have + * different class IDs. + * @stable ICU 3.0 + */ + virtual UClassID getDynamicClassID() const; + + /** + * Returns the class ID for this class. This is used to compare to + * the return value of getDynamicClassID(). + * @return The class ID for all objects of this class. + * @stable ICU 3.0 + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * Return the ISO currency code of this object. + * @stable ICU 3.0 + */ + inline const char16_t* getISOCurrency() const; + + private: + /** + * The ISO 4217 code of this object. + */ + char16_t isoCode[4]; +}; + +inline const char16_t* CurrencyUnit::getISOCurrency() const { + return isoCode; +} + +U_NAMESPACE_END + +#endif // !UCONFIG_NO_FORMATTING +#endif // __CURRENCYUNIT_H__ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/datefmt.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/datefmt.h new file mode 100644 index 0000000..3da0797 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/datefmt.h @@ -0,0 +1,952 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ******************************************************************************** + * Copyright (C) 1997-2016, International Business Machines + * Corporation and others. All Rights Reserved. + ******************************************************************************** + * + * File DATEFMT.H + * + * Modification History: + * + * Date Name Description + * 02/19/97 aliu Converted from java. + * 04/01/97 aliu Added support for centuries. + * 07/23/98 stephen JDK 1.2 sync + * 11/15/99 weiv Added support for week of year/day of week formatting + ******************************************************************************** + */ + +#ifndef DATEFMT_H +#define DATEFMT_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/udat.h" +#include "unicode/calendar.h" +#include "unicode/numfmt.h" +#include "unicode/format.h" +#include "unicode/locid.h" +#include "unicode/enumset.h" +#include "unicode/udisplaycontext.h" + +/** + * \file + * \brief C++ API: Abstract class for converting dates. + */ + +U_NAMESPACE_BEGIN + +class TimeZone; +class DateTimePatternGenerator; + +// explicit template instantiation. see digitlst.h +#if defined (_MSC_VER) +template class U_I18N_API EnumSet; +#endif + +/** + * DateFormat is an abstract class for a family of classes that convert dates and + * times from their internal representations to textual form and back again in a + * language-independent manner. Converting from the internal representation (milliseconds + * since midnight, January 1, 1970) to text is known as "formatting," and converting + * from text to millis is known as "parsing." We currently define only one concrete + * subclass of DateFormat: SimpleDateFormat, which can handle pretty much all normal + * date formatting and parsing actions. + *

+ * DateFormat helps you to format and parse dates for any locale. Your code can + * be completely independent of the locale conventions for months, days of the + * week, or even the calendar format: lunar vs. solar. + *

+ * To format a date for the current Locale, use one of the static factory + * methods: + *

+ * \code
+ *      DateFormat* dfmt = DateFormat::createDateInstance();
+ *      UDate myDate = Calendar::getNow();
+ *      UnicodeString myString;
+ *      myString = dfmt->format( myDate, myString );
+ * \endcode
+ * 
+ * If you are formatting multiple numbers, it is more efficient to get the + * format and use it multiple times so that the system doesn't have to fetch the + * information about the local language and country conventions multiple times. + *
+ * \code
+ *      DateFormat* df = DateFormat::createDateInstance();
+ *      UnicodeString myString;
+ *      UDate myDateArr[] = { 0.0, 100000000.0, 2000000000.0 }; // test values
+ *      for (int32_t i = 0; i < 3; ++i) {
+ *          myString.remove();
+ *          cout << df->format( myDateArr[i], myString ) << endl;
+ *      }
+ * \endcode
+ * 
+ * To get specific fields of a date, you can use UFieldPosition to + * get specific fields. + *
+ * \code
+ *      DateFormat* dfmt = DateFormat::createDateInstance();
+ *      FieldPosition pos(DateFormat::YEAR_FIELD);
+ *      UnicodeString myString;
+ *      myString = dfmt->format( myDate, myString );
+ *      cout << myString << endl;
+ *      cout << pos.getBeginIndex() << "," << pos. getEndIndex() << endl;
+ * \endcode
+ * 
+ * To format a date for a different Locale, specify it in the call to + * createDateInstance(). + *
+ * \code
+ *       DateFormat* df =
+ *           DateFormat::createDateInstance( DateFormat::SHORT, Locale::getFrance());
+ * \endcode
+ * 
+ * You can use a DateFormat to parse also. + *
+ * \code
+ *       UErrorCode status = U_ZERO_ERROR;
+ *       UDate myDate = df->parse(myString, status);
+ * \endcode
+ * 
+ * Use createDateInstance() to produce the normal date format for that country. + * There are other static factory methods available. Use createTimeInstance() + * to produce the normal time format for that country. Use createDateTimeInstance() + * to produce a DateFormat that formats both date and time. You can pass in + * different options to these factory methods to control the length of the + * result; from SHORT to MEDIUM to LONG to FULL. The exact result depends on the + * locale, but generally: + *
    + *
  • SHORT is completely numeric, such as 12/13/52 or 3:30pm + *
  • MEDIUM is longer, such as Jan 12, 1952 + *
  • LONG is longer, such as January 12, 1952 or 3:30:32pm + *
  • FULL is pretty completely specified, such as + * Tuesday, April 12, 1952 AD or 3:30:42pm PST. + *
+ * You can also set the time zone on the format if you wish. If you want even + * more control over the format or parsing, (or want to give your users more + * control), you can try casting the DateFormat you get from the factory methods + * to a SimpleDateFormat. This will work for the majority of countries; just + * remember to chck getDynamicClassID() before carrying out the cast. + *

+ * You can also use forms of the parse and format methods with ParsePosition and + * FieldPosition to allow you to + *

    + *
  • Progressively parse through pieces of a string. + *
  • Align any particular field, or find out where it is for selection + * on the screen. + *
+ * + *

User subclasses are not supported. While clients may write + * subclasses, such code will not necessarily work and will not be + * guaranteed to work stably from release to release. + */ +class U_I18N_API DateFormat : public Format { +public: + + /** + * Constants for various style patterns. These reflect the order of items in + * the DateTimePatterns resource. There are 4 time patterns, 4 date patterns, + * the default date-time pattern, and 4 date-time patterns. Each block of 4 values + * in the resource occurs in the order full, long, medium, short. + * @stable ICU 2.4 + */ + enum EStyle + { + kNone = -1, + + kFull = 0, + kLong = 1, + kMedium = 2, + kShort = 3, + + kDateOffset = kShort + 1, + // kFull + kDateOffset = 4 + // kLong + kDateOffset = 5 + // kMedium + kDateOffset = 6 + // kShort + kDateOffset = 7 + + kDateTime = 8, + // Default DateTime + + kDateTimeOffset = kDateTime + 1, + // kFull + kDateTimeOffset = 9 + // kLong + kDateTimeOffset = 10 + // kMedium + kDateTimeOffset = 11 + // kShort + kDateTimeOffset = 12 + + // relative dates + kRelative = (1 << 7), + + kFullRelative = (kFull | kRelative), + + kLongRelative = kLong | kRelative, + + kMediumRelative = kMedium | kRelative, + + kShortRelative = kShort | kRelative, + + + kDefault = kMedium, + + + + /** + * These constants are provided for backwards compatibility only. + * Please use the C++ style constants defined above. + */ + FULL = kFull, + LONG = kLong, + MEDIUM = kMedium, + SHORT = kShort, + DEFAULT = kDefault, + DATE_OFFSET = kDateOffset, + NONE = kNone, + DATE_TIME = kDateTime + }; + + /** + * Destructor. + * @stable ICU 2.0 + */ + virtual ~DateFormat(); + + /** + * Equality operator. Returns true if the two formats have the same behavior. + * @stable ICU 2.0 + */ + virtual UBool operator==(const Format&) const; + + + using Format::format; + + /** + * Format an object to produce a string. This method handles Formattable + * objects with a UDate type. If a the Formattable object type is not a Date, + * then it returns a failing UErrorCode. + * + * @param obj The object to format. Must be a Date. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @stable ICU 2.0 + */ + virtual UnicodeString& format(const Formattable& obj, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode& status) const; + + /** + * Format an object to produce a string. This method handles Formattable + * objects with a UDate type. If a the Formattable object type is not a Date, + * then it returns a failing UErrorCode. + * + * @param obj The object to format. Must be a Date. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param posIter On return, can be used to iterate over positions + * of fields generated by this format call. Field values + * are defined in UDateFormatField. Can be NULL. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @stable ICU 4.4 + */ + virtual UnicodeString& format(const Formattable& obj, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; + /** + * Formats a date into a date/time string. This is an abstract method which + * concrete subclasses must implement. + *

+ * On input, the FieldPosition parameter may have its "field" member filled with + * an enum value specifying a field. On output, the FieldPosition will be filled + * in with the text offsets for that field. + *

For example, given a time text + * "1996.07.10 AD at 15:08:56 PDT", if the given fieldPosition.field is + * UDAT_YEAR_FIELD, the offsets fieldPosition.beginIndex and + * statfieldPositionus.getEndIndex will be set to 0 and 4, respectively. + *

Notice + * that if the same time field appears more than once in a pattern, the status will + * be set for the first occurence of that time field. For instance, + * formatting a UDate to the time string "1 PM PDT (Pacific Daylight Time)" + * using the pattern "h a z (zzzz)" and the alignment field + * DateFormat::TIMEZONE_FIELD, the offsets fieldPosition.beginIndex and + * fieldPosition.getEndIndex will be set to 5 and 8, respectively, for the first + * occurence of the timezone pattern character 'z'. + * + * @param cal Calendar set to the date and time to be formatted + * into a date/time string. When the calendar type is + * different from the internal calendar held by this + * DateFormat instance, the date and the time zone will + * be inherited from the input calendar, but other calendar + * field values will be calculated by the internal calendar. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param fieldPosition On input: an alignment field, if desired (see examples above) + * On output: the offsets of the alignment field (see examples above) + * @return Reference to 'appendTo' parameter. + * @stable ICU 2.1 + */ + virtual UnicodeString& format( Calendar& cal, + UnicodeString& appendTo, + FieldPosition& fieldPosition) const = 0; + + /** + * Formats a date into a date/time string. Subclasses should implement this method. + * + * @param cal Calendar set to the date and time to be formatted + * into a date/time string. When the calendar type is + * different from the internal calendar held by this + * DateFormat instance, the date and the time zone will + * be inherited from the input calendar, but other calendar + * field values will be calculated by the internal calendar. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param posIter On return, can be used to iterate over positions + * of fields generated by this format call. Field values + * are defined in UDateFormatField. Can be NULL. + * @param status error status. + * @return Reference to 'appendTo' parameter. + * @stable ICU 4.4 + */ + virtual UnicodeString& format(Calendar& cal, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; + /** + * Formats a UDate into a date/time string. + *

+ * On input, the FieldPosition parameter may have its "field" member filled with + * an enum value specifying a field. On output, the FieldPosition will be filled + * in with the text offsets for that field. + *

For example, given a time text + * "1996.07.10 AD at 15:08:56 PDT", if the given fieldPosition.field is + * UDAT_YEAR_FIELD, the offsets fieldPosition.beginIndex and + * statfieldPositionus.getEndIndex will be set to 0 and 4, respectively. + *

Notice + * that if the same time field appears more than once in a pattern, the status will + * be set for the first occurence of that time field. For instance, + * formatting a UDate to the time string "1 PM PDT (Pacific Daylight Time)" + * using the pattern "h a z (zzzz)" and the alignment field + * DateFormat::TIMEZONE_FIELD, the offsets fieldPosition.beginIndex and + * fieldPosition.getEndIndex will be set to 5 and 8, respectively, for the first + * occurence of the timezone pattern character 'z'. + * + * @param date UDate to be formatted into a date/time string. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param fieldPosition On input: an alignment field, if desired (see examples above) + * On output: the offsets of the alignment field (see examples above) + * @return Reference to 'appendTo' parameter. + * @stable ICU 2.0 + */ + UnicodeString& format( UDate date, + UnicodeString& appendTo, + FieldPosition& fieldPosition) const; + + /** + * Formats a UDate into a date/time string. + * + * @param date UDate to be formatted into a date/time string. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param posIter On return, can be used to iterate over positions + * of fields generated by this format call. Field values + * are defined in UDateFormatField. Can be NULL. + * @param status error status. + * @return Reference to 'appendTo' parameter. + * @stable ICU 4.4 + */ + UnicodeString& format(UDate date, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; + /** + * Formats a UDate into a date/time string. If there is a problem, you won't + * know, using this method. Use the overloaded format() method which takes a + * FieldPosition& to detect formatting problems. + * + * @param date The UDate value to be formatted into a string. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @return Reference to 'appendTo' parameter. + * @stable ICU 2.0 + */ + UnicodeString& format(UDate date, UnicodeString& appendTo) const; + + /** + * Parse a date/time string. For example, a time text "07/10/96 4:5 PM, PDT" + * will be parsed into a UDate that is equivalent to Date(837039928046). + * Parsing begins at the beginning of the string and proceeds as far as + * possible. Assuming no parse errors were encountered, this function + * doesn't return any information about how much of the string was consumed + * by the parsing. If you need that information, use the version of + * parse() that takes a ParsePosition. + *

+ * By default, parsing is lenient: If the input is not in the form used by + * this object's format method but can still be parsed as a date, then the + * parse succeeds. Clients may insist on strict adherence to the format by + * calling setLenient(false). + * @see DateFormat::setLenient(boolean) + *

+ * Note that the normal date formats associated with some calendars - such + * as the Chinese lunar calendar - do not specify enough fields to enable + * dates to be parsed unambiguously. In the case of the Chinese lunar + * calendar, while the year within the current 60-year cycle is specified, + * the number of such cycles since the start date of the calendar (in the + * ERA field of the Calendar object) is not normally part of the format, + * and parsing may assume the wrong era. For cases such as this it is + * recommended that clients parse using the method + * parse(const UnicodeString&, Calendar& cal, ParsePosition&) + * with the Calendar passed in set to the current date, or to a date + * within the era/cycle that should be assumed if absent in the format. + * + * @param text The date/time string to be parsed into a UDate value. + * @param status Output param to be set to success/failure code. If + * 'text' cannot be parsed, it will be set to a failure + * code. + * @return The parsed UDate value, if successful. + * @stable ICU 2.0 + */ + virtual UDate parse( const UnicodeString& text, + UErrorCode& status) const; + + /** + * Parse a date/time string beginning at the given parse position. For + * example, a time text "07/10/96 4:5 PM, PDT" will be parsed into a Date + * that is equivalent to Date(837039928046). + *

+ * By default, parsing is lenient: If the input is not in the form used by + * this object's format method but can still be parsed as a date, then the + * parse succeeds. Clients may insist on strict adherence to the format by + * calling setLenient(false). + * @see DateFormat::setLenient(boolean) + * + * @param text The date/time string to be parsed. + * @param cal A Calendar set on input to the date and time to be used for + * missing values in the date/time string being parsed, and set + * on output to the parsed date/time. When the calendar type is + * different from the internal calendar held by this DateFormat + * instance, the internal calendar will be cloned to a work + * calendar set to the same milliseconds and time zone as the + * cal parameter, field values will be parsed based on the work + * calendar, then the result (milliseconds and time zone) will + * be set in this calendar. + * @param pos On input, the position at which to start parsing; on + * output, the position at which parsing terminated, or the + * start position if the parse failed. + * @stable ICU 2.1 + */ + virtual void parse( const UnicodeString& text, + Calendar& cal, + ParsePosition& pos) const = 0; + + /** + * Parse a date/time string beginning at the given parse position. For + * example, a time text "07/10/96 4:5 PM, PDT" will be parsed into a Date + * that is equivalent to Date(837039928046). + *

+ * By default, parsing is lenient: If the input is not in the form used by + * this object's format method but can still be parsed as a date, then the + * parse succeeds. Clients may insist on strict adherence to the format by + * calling setLenient(false). + * @see DateFormat::setLenient(boolean) + *

+ * Note that the normal date formats associated with some calendars - such + * as the Chinese lunar calendar - do not specify enough fields to enable + * dates to be parsed unambiguously. In the case of the Chinese lunar + * calendar, while the year within the current 60-year cycle is specified, + * the number of such cycles since the start date of the calendar (in the + * ERA field of the Calendar object) is not normally part of the format, + * and parsing may assume the wrong era. For cases such as this it is + * recommended that clients parse using the method + * parse(const UnicodeString&, Calendar& cal, ParsePosition&) + * with the Calendar passed in set to the current date, or to a date + * within the era/cycle that should be assumed if absent in the format. + * + * @param text The date/time string to be parsed into a UDate value. + * @param pos On input, the position at which to start parsing; on + * output, the position at which parsing terminated, or the + * start position if the parse failed. + * @return A valid UDate if the input could be parsed. + * @stable ICU 2.0 + */ + UDate parse( const UnicodeString& text, + ParsePosition& pos) const; + + /** + * Parse a string to produce an object. This methods handles parsing of + * date/time strings into Formattable objects with UDate types. + *

+ * Before calling, set parse_pos.index to the offset you want to start + * parsing at in the source. After calling, parse_pos.index is the end of + * the text you parsed. If error occurs, index is unchanged. + *

+ * When parsing, leading whitespace is discarded (with a successful parse), + * while trailing whitespace is left as is. + *

+ * See Format::parseObject() for more. + * + * @param source The string to be parsed into an object. + * @param result Formattable to be set to the parse result. + * If parse fails, return contents are undefined. + * @param parse_pos The position to start parsing at. Upon return + * this param is set to the position after the + * last character successfully parsed. If the + * source is not parsed successfully, this param + * will remain unchanged. + * @stable ICU 2.0 + */ + virtual void parseObject(const UnicodeString& source, + Formattable& result, + ParsePosition& parse_pos) const; + + /** + * Create a default date/time formatter that uses the SHORT style for both + * the date and the time. + * + * @return A date/time formatter which the caller owns. + * @stable ICU 2.0 + */ + static DateFormat* U_EXPORT2 createInstance(void); + + /** + * Creates a time formatter with the given formatting style for the given + * locale. + * + * @param style The given formatting style. For example, + * SHORT for "h:mm a" in the US locale. Relative + * time styles are not currently supported. + * @param aLocale The given locale. + * @return A time formatter which the caller owns. + * @stable ICU 2.0 + */ + static DateFormat* U_EXPORT2 createTimeInstance(EStyle style = kDefault, + const Locale& aLocale = Locale::getDefault()); + + /** + * Creates a date formatter with the given formatting style for the given + * const locale. + * + * @param style The given formatting style. For example, SHORT for "M/d/yy" in the + * US locale. As currently implemented, relative date formatting only + * affects a limited range of calendar days before or after the + * current date, based on the CLDR <field type="day">/<relative> data: + * For example, in English, "Yesterday", "Today", and "Tomorrow". + * Outside of this range, dates are formatted using the corresponding + * non-relative style. + * @param aLocale The given locale. + * @return A date formatter which the caller owns. + * @stable ICU 2.0 + */ + static DateFormat* U_EXPORT2 createDateInstance(EStyle style = kDefault, + const Locale& aLocale = Locale::getDefault()); + + /** + * Creates a date/time formatter with the given formatting styles for the + * given locale. + * + * @param dateStyle The given formatting style for the date portion of the result. + * For example, SHORT for "M/d/yy" in the US locale. As currently + * implemented, relative date formatting only affects a limited range + * of calendar days before or after the current date, based on the + * CLDR <field type="day">/<relative> data: For example, in English, + * "Yesterday", "Today", and "Tomorrow". Outside of this range, dates + * are formatted using the corresponding non-relative style. + * @param timeStyle The given formatting style for the time portion of the result. + * For example, SHORT for "h:mm a" in the US locale. Relative + * time styles are not currently supported. + * @param aLocale The given locale. + * @return A date/time formatter which the caller owns. + * @stable ICU 2.0 + */ + static DateFormat* U_EXPORT2 createDateTimeInstance(EStyle dateStyle = kDefault, + EStyle timeStyle = kDefault, + const Locale& aLocale = Locale::getDefault()); + +#ifndef U_HIDE_INTERNAL_API + /** + * Returns the best pattern given a skeleton and locale. + * @param locale the locale + * @param skeleton the skeleton + * @param status ICU error returned here + * @return the best pattern. + * @internal For ICU use only. + */ + static UnicodeString getBestPattern( + const Locale &locale, + const UnicodeString &skeleton, + UErrorCode &status); +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Creates a date/time formatter for the given skeleton and + * default locale. + * + * @param skeleton The skeleton e.g "yMMMMd." Fields in the skeleton can + * be in any order, and this method uses the locale to + * map the skeleton to a pattern that includes locale + * specific separators with the fields in the appropriate + * order for that locale. + * @param status Any error returned here. + * @return A date/time formatter which the caller owns. + * @stable ICU 55 + */ + static DateFormat* U_EXPORT2 createInstanceForSkeleton( + const UnicodeString& skeleton, + UErrorCode &status); + + /** + * Creates a date/time formatter for the given skeleton and locale. + * + * @param skeleton The skeleton e.g "yMMMMd." Fields in the skeleton can + * be in any order, and this method uses the locale to + * map the skeleton to a pattern that includes locale + * specific separators with the fields in the appropriate + * order for that locale. + * @param locale The given locale. + * @param status Any error returned here. + * @return A date/time formatter which the caller owns. + * @stable ICU 55 + */ + static DateFormat* U_EXPORT2 createInstanceForSkeleton( + const UnicodeString& skeleton, + const Locale &locale, + UErrorCode &status); + + /** + * Creates a date/time formatter for the given skeleton and locale. + * + * @param calendarToAdopt the calendar returned DateFormat is to use. + * @param skeleton The skeleton e.g "yMMMMd." Fields in the skeleton can + * be in any order, and this method uses the locale to + * map the skeleton to a pattern that includes locale + * specific separators with the fields in the appropriate + * order for that locale. + * @param locale The given locale. + * @param status Any error returned here. + * @return A date/time formatter which the caller owns. + * @stable ICU 55 + */ + static DateFormat* U_EXPORT2 createInstanceForSkeleton( + Calendar *calendarToAdopt, + const UnicodeString& skeleton, + const Locale &locale, + UErrorCode &status); + + + /** + * Gets the set of locales for which DateFormats are installed. + * @param count Filled in with the number of locales in the list that is returned. + * @return the set of locales for which DateFormats are installed. The caller + * does NOT own this list and must not delete it. + * @stable ICU 2.0 + */ + static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count); + + /** + * Returns whether both date/time parsing in the encapsulated Calendar object and DateFormat whitespace & + * numeric processing is lenient. + * @stable ICU 2.0 + */ + virtual UBool isLenient(void) const; + + /** + * Specifies whether date/time parsing is to be lenient. With + * lenient parsing, the parser may use heuristics to interpret inputs that + * do not precisely match this object's format. Without lenient parsing, + * inputs must match this object's format more closely. + * + * Note: ICU 53 introduced finer grained control of leniency (and added + * new control points) making the preferred method a combination of + * setCalendarLenient() & setBooleanAttribute() calls. + * This method supports prior functionality but may not support all + * future leniency control & behavior of DateFormat. For control of pre 53 leniency, + * Calendar and DateFormat whitespace & numeric tolerance, this method is safe to + * use. However, mixing leniency control via this method and modification of the + * newer attributes via setBooleanAttribute() may produce undesirable + * results. + * + * @param lenient True specifies date/time interpretation to be lenient. + * @see Calendar::setLenient + * @stable ICU 2.0 + */ + virtual void setLenient(UBool lenient); + + + /** + * Returns whether date/time parsing in the encapsulated Calendar object processing is lenient. + * @stable ICU 53 + */ + virtual UBool isCalendarLenient(void) const; + + + /** + * Specifies whether encapsulated Calendar date/time parsing is to be lenient. With + * lenient parsing, the parser may use heuristics to interpret inputs that + * do not precisely match this object's format. Without lenient parsing, + * inputs must match this object's format more closely. + * @param lenient when true, parsing is lenient + * @see com.ibm.icu.util.Calendar#setLenient + * @stable ICU 53 + */ + virtual void setCalendarLenient(UBool lenient); + + + /** + * Gets the calendar associated with this date/time formatter. + * The calendar is owned by the formatter and must not be modified. + * Also, the calendar does not reflect the results of a parse operation. + * To parse to a calendar, use {@link #parse(const UnicodeString&, Calendar& cal, ParsePosition&) const parse(const UnicodeString&, Calendar& cal, ParsePosition&)} + * @return the calendar associated with this date/time formatter. + * @stable ICU 2.0 + */ + virtual const Calendar* getCalendar(void) const; + + /** + * Set the calendar to be used by this date format. Initially, the default + * calendar for the specified or default locale is used. The caller should + * not delete the Calendar object after it is adopted by this call. + * Adopting a new calendar will change to the default symbols. + * + * @param calendarToAdopt Calendar object to be adopted. + * @stable ICU 2.0 + */ + virtual void adoptCalendar(Calendar* calendarToAdopt); + + /** + * Set the calendar to be used by this date format. Initially, the default + * calendar for the specified or default locale is used. + * + * @param newCalendar Calendar object to be set. + * @stable ICU 2.0 + */ + virtual void setCalendar(const Calendar& newCalendar); + + + /** + * Gets the number formatter which this date/time formatter uses to format + * and parse the numeric portions of the pattern. + * @return the number formatter which this date/time formatter uses. + * @stable ICU 2.0 + */ + virtual const NumberFormat* getNumberFormat(void) const; + + /** + * Allows you to set the number formatter. The caller should + * not delete the NumberFormat object after it is adopted by this call. + * @param formatToAdopt NumberFormat object to be adopted. + * @stable ICU 2.0 + */ + virtual void adoptNumberFormat(NumberFormat* formatToAdopt); + + /** + * Allows you to set the number formatter. + * @param newNumberFormat NumberFormat object to be set. + * @stable ICU 2.0 + */ + virtual void setNumberFormat(const NumberFormat& newNumberFormat); + + /** + * Returns a reference to the TimeZone used by this DateFormat's calendar. + * @return the time zone associated with the calendar of DateFormat. + * @stable ICU 2.0 + */ + virtual const TimeZone& getTimeZone(void) const; + + /** + * Sets the time zone for the calendar of this DateFormat object. The caller + * no longer owns the TimeZone object and should not delete it after this call. + * @param zoneToAdopt the TimeZone to be adopted. + * @stable ICU 2.0 + */ + virtual void adoptTimeZone(TimeZone* zoneToAdopt); + + /** + * Sets the time zone for the calendar of this DateFormat object. + * @param zone the new time zone. + * @stable ICU 2.0 + */ + virtual void setTimeZone(const TimeZone& zone); + + /** + * Set a particular UDisplayContext value in the formatter, such as + * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. + * @param value The UDisplayContext value to set. + * @param status Input/output status. If at entry this indicates a failure + * status, the function will do nothing; otherwise this will be + * updated with any new status from the function. + * @stable ICU 53 + */ + virtual void setContext(UDisplayContext value, UErrorCode& status); + + /** + * Get the formatter's UDisplayContext value for the specified UDisplayContextType, + * such as UDISPCTX_TYPE_CAPITALIZATION. + * @param type The UDisplayContextType whose value to return + * @param status Input/output status. If at entry this indicates a failure + * status, the function will do nothing; otherwise this will be + * updated with any new status from the function. + * @return The UDisplayContextValue for the specified type. + * @stable ICU 53 + */ + virtual UDisplayContext getContext(UDisplayContextType type, UErrorCode& status) const; + + /** + * Sets an boolean attribute on this DateFormat. + * May return U_UNSUPPORTED_ERROR if this instance does not support + * the specified attribute. + * @param attr the attribute to set + * @param newvalue new value + * @param status the error type + * @return *this - for chaining (example: format.setAttribute(...).setAttribute(...) ) + * @stable ICU 53 + */ + + virtual DateFormat& U_EXPORT2 setBooleanAttribute(UDateFormatBooleanAttribute attr, + UBool newvalue, + UErrorCode &status); + + /** + * Returns a boolean from this DateFormat + * May return U_UNSUPPORTED_ERROR if this instance does not support + * the specified attribute. + * @param attr the attribute to set + * @param status the error type + * @return the attribute value. Undefined if there is an error. + * @stable ICU 53 + */ + virtual UBool U_EXPORT2 getBooleanAttribute(UDateFormatBooleanAttribute attr, UErrorCode &status) const; + +protected: + /** + * Default constructor. Creates a DateFormat with no Calendar or NumberFormat + * associated with it. This constructor depends on the subclasses to fill in + * the calendar and numberFormat fields. + * @stable ICU 2.0 + */ + DateFormat(); + + /** + * Copy constructor. + * @stable ICU 2.0 + */ + DateFormat(const DateFormat&); + + /** + * Default assignment operator. + * @stable ICU 2.0 + */ + DateFormat& operator=(const DateFormat&); + + /** + * The calendar that DateFormat uses to produce the time field values needed + * to implement date/time formatting. Subclasses should generally initialize + * this to the default calendar for the locale associated with this DateFormat. + * @stable ICU 2.4 + */ + Calendar* fCalendar; + + /** + * The number formatter that DateFormat uses to format numbers in dates and + * times. Subclasses should generally initialize this to the default number + * format for the locale associated with this DateFormat. + * @stable ICU 2.4 + */ + NumberFormat* fNumberFormat; + + +private: + + /** + * Gets the date/time formatter with the given formatting styles for the + * given locale. + * @param dateStyle the given date formatting style. + * @param timeStyle the given time formatting style. + * @param inLocale the given locale. + * @return a date/time formatter, or 0 on failure. + */ + static DateFormat* U_EXPORT2 create(EStyle timeStyle, EStyle dateStyle, const Locale& inLocale); + + + /** + * enum set of active boolean attributes for this instance + */ + EnumSet fBoolFlags; + + + UDisplayContext fCapitalizationContext; + friend class DateFmtKeyByStyle; + +public: +#ifndef U_HIDE_OBSOLETE_API + /** + * Field selector for FieldPosition for DateFormat fields. + * @obsolete ICU 3.4 use UDateFormatField instead, since this API will be + * removed in that release + */ + enum EField + { + // Obsolete; use UDateFormatField instead + kEraField = UDAT_ERA_FIELD, + kYearField = UDAT_YEAR_FIELD, + kMonthField = UDAT_MONTH_FIELD, + kDateField = UDAT_DATE_FIELD, + kHourOfDay1Field = UDAT_HOUR_OF_DAY1_FIELD, + kHourOfDay0Field = UDAT_HOUR_OF_DAY0_FIELD, + kMinuteField = UDAT_MINUTE_FIELD, + kSecondField = UDAT_SECOND_FIELD, + kMillisecondField = UDAT_FRACTIONAL_SECOND_FIELD, + kDayOfWeekField = UDAT_DAY_OF_WEEK_FIELD, + kDayOfYearField = UDAT_DAY_OF_YEAR_FIELD, + kDayOfWeekInMonthField = UDAT_DAY_OF_WEEK_IN_MONTH_FIELD, + kWeekOfYearField = UDAT_WEEK_OF_YEAR_FIELD, + kWeekOfMonthField = UDAT_WEEK_OF_MONTH_FIELD, + kAmPmField = UDAT_AM_PM_FIELD, + kHour1Field = UDAT_HOUR1_FIELD, + kHour0Field = UDAT_HOUR0_FIELD, + kTimezoneField = UDAT_TIMEZONE_FIELD, + kYearWOYField = UDAT_YEAR_WOY_FIELD, + kDOWLocalField = UDAT_DOW_LOCAL_FIELD, + kExtendedYearField = UDAT_EXTENDED_YEAR_FIELD, + kJulianDayField = UDAT_JULIAN_DAY_FIELD, + kMillisecondsInDayField = UDAT_MILLISECONDS_IN_DAY_FIELD, + + // Obsolete; use UDateFormatField instead + ERA_FIELD = UDAT_ERA_FIELD, + YEAR_FIELD = UDAT_YEAR_FIELD, + MONTH_FIELD = UDAT_MONTH_FIELD, + DATE_FIELD = UDAT_DATE_FIELD, + HOUR_OF_DAY1_FIELD = UDAT_HOUR_OF_DAY1_FIELD, + HOUR_OF_DAY0_FIELD = UDAT_HOUR_OF_DAY0_FIELD, + MINUTE_FIELD = UDAT_MINUTE_FIELD, + SECOND_FIELD = UDAT_SECOND_FIELD, + MILLISECOND_FIELD = UDAT_FRACTIONAL_SECOND_FIELD, + DAY_OF_WEEK_FIELD = UDAT_DAY_OF_WEEK_FIELD, + DAY_OF_YEAR_FIELD = UDAT_DAY_OF_YEAR_FIELD, + DAY_OF_WEEK_IN_MONTH_FIELD = UDAT_DAY_OF_WEEK_IN_MONTH_FIELD, + WEEK_OF_YEAR_FIELD = UDAT_WEEK_OF_YEAR_FIELD, + WEEK_OF_MONTH_FIELD = UDAT_WEEK_OF_MONTH_FIELD, + AM_PM_FIELD = UDAT_AM_PM_FIELD, + HOUR1_FIELD = UDAT_HOUR1_FIELD, + HOUR0_FIELD = UDAT_HOUR0_FIELD, + TIMEZONE_FIELD = UDAT_TIMEZONE_FIELD + }; +#endif /* U_HIDE_OBSOLETE_API */ +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // _DATEFMT +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/dbbi.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/dbbi.h new file mode 100644 index 0000000..a2c3d7d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/dbbi.h @@ -0,0 +1,42 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2006,2013 IBM Corp. All rights reserved. +********************************************************************** +* Date Name Description +* 12/1/99 rgillam Complete port from Java. +* 01/13/2000 helena Added UErrorCode to ctors. +********************************************************************** +*/ + +#ifndef DBBI_H +#define DBBI_H + +#include "unicode/rbbi.h" + +#if !UCONFIG_NO_BREAK_ITERATION + +/** + * \file + * \brief C++ API: Dictionary Based Break Iterator + */ + +U_NAMESPACE_BEGIN + +#ifndef U_HIDE_DEPRECATED_API +/** + * An obsolete subclass of RuleBasedBreakIterator. Handling of dictionary- + * based break iteration has been folded into the base class. This class + * is deprecated as of ICU 3.6. + * @deprecated ICU 3.6 + */ +typedef RuleBasedBreakIterator DictionaryBasedBreakIterator; + +#endif /* U_HIDE_DEPRECATED_API */ + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_BREAK_ITERATION */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/dcfmtsym.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/dcfmtsym.h new file mode 100644 index 0000000..4dc6f95 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/dcfmtsym.h @@ -0,0 +1,530 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************** +* Copyright (C) 1997-2016, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************** +* +* File DCFMTSYM.H +* +* Modification History: +* +* Date Name Description +* 02/19/97 aliu Converted from java. +* 03/18/97 clhuang Updated per C++ implementation. +* 03/27/97 helena Updated to pass the simple test after code review. +* 08/26/97 aliu Added currency/intl currency symbol support. +* 07/22/98 stephen Changed to match C++ style +* currencySymbol -> fCurrencySymbol +* Constants changed from CAPS to kCaps +* 06/24/99 helena Integrated Alan's NF enhancements and Java2 bug fixes +* 09/22/00 grhoten Marked deprecation tags with a pointer to replacement +* functions. +******************************************************************************** +*/ + +#ifndef DCFMTSYM_H +#define DCFMTSYM_H + +#include "unicode/utypes.h" +#include "unicode/uchar.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/uobject.h" +#include "unicode/locid.h" +#include "unicode/numsys.h" +#include "unicode/unum.h" +#include "unicode/unistr.h" + +/** + * \file + * \brief C++ API: Symbols for formatting numbers. + */ + + +U_NAMESPACE_BEGIN + +/** + * This class represents the set of symbols needed by DecimalFormat + * to format numbers. DecimalFormat creates for itself an instance of + * DecimalFormatSymbols from its locale data. If you need to change any + * of these symbols, you can get the DecimalFormatSymbols object from + * your DecimalFormat and modify it. + *

+ * Here are the special characters used in the parts of the + * subpattern, with notes on their usage. + *

+ * \code
+ *        Symbol   Meaning
+ *          0      a digit
+ *          #      a digit, zero shows as absent
+ *          .      placeholder for decimal separator
+ *          ,      placeholder for grouping separator.
+ *          ;      separates formats.
+ *          -      default negative prefix.
+ *          %      divide by 100 and show as percentage
+ *          X      any other characters can be used in the prefix or suffix
+ *          '      used to quote special characters in a prefix or suffix.
+ * \endcode
+ *  
+ * [Notes] + *

+ * If there is no explicit negative subpattern, - is prefixed to the + * positive form. That is, "0.00" alone is equivalent to "0.00;-0.00". + *

+ * The grouping separator is commonly used for thousands, but in some + * countries for ten-thousands. The interval is a constant number of + * digits between the grouping characters, such as 100,000,000 or 1,0000,0000. + * If you supply a pattern with multiple grouping characters, the interval + * between the last one and the end of the integer is the one that is + * used. So "#,##,###,####" == "######,####" == "##,####,####". + *

+ * This class only handles localized digits where the 10 digits are + * contiguous in Unicode, from 0 to 9. Other digits sets (such as + * superscripts) would need a different subclass. + */ +class U_I18N_API DecimalFormatSymbols : public UObject { +public: + /** + * Constants for specifying a number format symbol. + * @stable ICU 2.0 + */ + enum ENumberFormatSymbol { + /** The decimal separator */ + kDecimalSeparatorSymbol, + /** The grouping separator */ + kGroupingSeparatorSymbol, + /** The pattern separator */ + kPatternSeparatorSymbol, + /** The percent sign */ + kPercentSymbol, + /** Zero*/ + kZeroDigitSymbol, + /** Character representing a digit in the pattern */ + kDigitSymbol, + /** The minus sign */ + kMinusSignSymbol, + /** The plus sign */ + kPlusSignSymbol, + /** The currency symbol */ + kCurrencySymbol, + /** The international currency symbol */ + kIntlCurrencySymbol, + /** The monetary separator */ + kMonetarySeparatorSymbol, + /** The exponential symbol */ + kExponentialSymbol, + /** Per mill symbol - replaces kPermillSymbol */ + kPerMillSymbol, + /** Escape padding character */ + kPadEscapeSymbol, + /** Infinity symbol */ + kInfinitySymbol, + /** Nan symbol */ + kNaNSymbol, + /** Significant digit symbol + * @stable ICU 3.0 */ + kSignificantDigitSymbol, + /** The monetary grouping separator + * @stable ICU 3.6 + */ + kMonetaryGroupingSeparatorSymbol, + /** One + * @stable ICU 4.6 + */ + kOneDigitSymbol, + /** Two + * @stable ICU 4.6 + */ + kTwoDigitSymbol, + /** Three + * @stable ICU 4.6 + */ + kThreeDigitSymbol, + /** Four + * @stable ICU 4.6 + */ + kFourDigitSymbol, + /** Five + * @stable ICU 4.6 + */ + kFiveDigitSymbol, + /** Six + * @stable ICU 4.6 + */ + kSixDigitSymbol, + /** Seven + * @stable ICU 4.6 + */ + kSevenDigitSymbol, + /** Eight + * @stable ICU 4.6 + */ + kEightDigitSymbol, + /** Nine + * @stable ICU 4.6 + */ + kNineDigitSymbol, + /** Multiplication sign. + * @stable ICU 54 + */ + kExponentMultiplicationSymbol, + /** count symbol constants */ + kFormatSymbolCount = kNineDigitSymbol + 2 + }; + + /** + * Create a DecimalFormatSymbols object for the given locale. + * + * @param locale The locale to get symbols for. + * @param status Input/output parameter, set to success or + * failure code upon return. + * @stable ICU 2.0 + */ + DecimalFormatSymbols(const Locale& locale, UErrorCode& status); + +#ifndef U_HIDE_DRAFT_API + /** + * Creates a DecimalFormatSymbols instance for the given locale with digits and symbols + * corresponding to the given NumberingSystem. + * + * This constructor behaves equivalently to the normal constructor called with a locale having a + * "numbers=xxxx" keyword specifying the numbering system by name. + * + * In this constructor, the NumberingSystem argument will be used even if the locale has its own + * "numbers=xxxx" keyword. + * + * @param locale The locale to get symbols for. + * @param ns The numbering system. + * @param status Input/output parameter, set to success or + * failure code upon return. + * @draft ICU 60 + */ + DecimalFormatSymbols(const Locale& locale, const NumberingSystem& ns, UErrorCode& status); +#endif /* U_HIDE_DRAFT_API */ + + /** + * Create a DecimalFormatSymbols object for the default locale. + * This constructor will not fail. If the resource file data is + * not available, it will use hard-coded last-resort data and + * set status to U_USING_FALLBACK_ERROR. + * + * @param status Input/output parameter, set to success or + * failure code upon return. + * @stable ICU 2.0 + */ + DecimalFormatSymbols(UErrorCode& status); + + /** + * Creates a DecimalFormatSymbols object with last-resort data. + * Intended for callers who cache the symbols data and + * set all symbols on the resulting object. + * + * The last-resort symbols are similar to those for the root data, + * except that the grouping separators are empty, + * the NaN symbol is U+FFFD rather than "NaN", + * and the CurrencySpacing patterns are empty. + * + * @param status Input/output parameter, set to success or + * failure code upon return. + * @return last-resort symbols + * @stable ICU 52 + */ + static DecimalFormatSymbols* createWithLastResortData(UErrorCode& status); + + /** + * Copy constructor. + * @stable ICU 2.0 + */ + DecimalFormatSymbols(const DecimalFormatSymbols&); + + /** + * Assignment operator. + * @stable ICU 2.0 + */ + DecimalFormatSymbols& operator=(const DecimalFormatSymbols&); + + /** + * Destructor. + * @stable ICU 2.0 + */ + virtual ~DecimalFormatSymbols(); + + /** + * Return true if another object is semantically equal to this one. + * + * @param other the object to be compared with. + * @return true if another object is semantically equal to this one. + * @stable ICU 2.0 + */ + UBool operator==(const DecimalFormatSymbols& other) const; + + /** + * Return true if another object is semantically unequal to this one. + * + * @param other the object to be compared with. + * @return true if another object is semantically unequal to this one. + * @stable ICU 2.0 + */ + UBool operator!=(const DecimalFormatSymbols& other) const { return !operator==(other); } + + /** + * Get one of the format symbols by its enum constant. + * Each symbol is stored as a string so that graphemes + * (characters with modifier letters) can be used. + * + * @param symbol Constant to indicate a number format symbol. + * @return the format symbols by the param 'symbol' + * @stable ICU 2.0 + */ + inline UnicodeString getSymbol(ENumberFormatSymbol symbol) const; + + /** + * Set one of the format symbols by its enum constant. + * Each symbol is stored as a string so that graphemes + * (characters with modifier letters) can be used. + * + * @param symbol Constant to indicate a number format symbol. + * @param value value of the format symbol + * @param propogateDigits If false, setting the zero digit will not automatically set 1-9. + * The default behavior is to automatically set 1-9 if zero is being set and the value + * it is being set to corresponds to a known Unicode zero digit. + * @stable ICU 2.0 + */ + void setSymbol(ENumberFormatSymbol symbol, const UnicodeString &value, const UBool propogateDigits); + + /** + * Returns the locale for which this object was constructed. + * @stable ICU 2.6 + */ + inline Locale getLocale() const; + + /** + * Returns the locale for this object. Two flavors are available: + * valid and actual locale. + * @stable ICU 2.8 + */ + Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const; + + /** + * Get pattern string for 'CurrencySpacing' that can be applied to + * currency format. + * This API gets the CurrencySpacing data from ResourceBundle. The pattern can + * be empty if there is no data from current locale and its parent locales. + * + * @param type : UNUM_CURRENCY_MATCH, UNUM_CURRENCY_SURROUNDING_MATCH or UNUM_CURRENCY_INSERT. + * @param beforeCurrency : true if the pattern is for before currency symbol. + * false if the pattern is for after currency symbol. + * @param status: Input/output parameter, set to success or + * failure code upon return. + * @return pattern string for currencyMatch, surroundingMatch or spaceInsert. + * Return empty string if there is no data for this locale and its parent + * locales. + * @stable ICU 4.8 + */ + const UnicodeString& getPatternForCurrencySpacing(UCurrencySpacing type, + UBool beforeCurrency, + UErrorCode& status) const; + /** + * Set pattern string for 'CurrencySpacing' that can be applied to + * currency format. + * + * @param type : UNUM_CURRENCY_MATCH, UNUM_CURRENCY_SURROUNDING_MATCH or UNUM_CURRENCY_INSERT. + * @param beforeCurrency : true if the pattern is for before currency symbol. + * false if the pattern is for after currency symbol. + * @param pattern : pattern string to override current setting. + * @stable ICU 4.8 + */ + void setPatternForCurrencySpacing(UCurrencySpacing type, + UBool beforeCurrency, + const UnicodeString& pattern); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.2 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.2 + */ + static UClassID U_EXPORT2 getStaticClassID(); + +private: + DecimalFormatSymbols(); + + /** + * Initializes the symbols from the LocaleElements resource bundle. + * Note: The organization of LocaleElements badly needs to be + * cleaned up. + * + * @param locale The locale to get symbols for. + * @param success Input/output parameter, set to success or + * failure code upon return. + * @param useLastResortData determine if use last resort data + * @param ns The NumberingSystem to use; otherwise, fall + * back to the locale. + */ + void initialize(const Locale& locale, UErrorCode& success, + UBool useLastResortData = FALSE, const NumberingSystem* ns = nullptr); + + /** + * Initialize the symbols with default values. + */ + void initialize(); + + void setCurrencyForSymbols(); + +public: + +#ifndef U_HIDE_INTERNAL_API + /** + * @internal For ICU use only + */ + inline UBool isCustomCurrencySymbol() const { + return fIsCustomCurrencySymbol; + } + + /** + * @internal For ICU use only + */ + inline UBool isCustomIntlCurrencySymbol() const { + return fIsCustomIntlCurrencySymbol; + } +#endif /* U_HIDE_INTERNAL_API */ + + /** + * _Internal_ function - more efficient version of getSymbol, + * returning a const reference to one of the symbol strings. + * The returned reference becomes invalid when the symbol is changed + * or when the DecimalFormatSymbols are destroyed. + * ### TODO markus 2002oct11: Consider proposing getConstSymbol() to be really public. + * Note: moved #ifndef U_HIDE_INTERNAL_API after this, since this is needed for inline in DecimalFormat + * + * @param symbol Constant to indicate a number format symbol. + * @return the format symbol by the param 'symbol' + * @internal + */ + inline const UnicodeString &getConstSymbol(ENumberFormatSymbol symbol) const; + +#ifndef U_HIDE_INTERNAL_API + /** + * Returns that pattern stored in currecy info. Internal API for use by NumberFormat API. + * @internal + */ + inline const char16_t* getCurrencyPattern(void) const; +#endif /* U_HIDE_INTERNAL_API */ + +private: + /** + * Private symbol strings. + * They are either loaded from a resource bundle or otherwise owned. + * setSymbol() clones the symbol string. + * Readonly aliases can only come from a resource bundle, so that we can always + * use fastCopyFrom() with them. + * + * If DecimalFormatSymbols becomes subclassable and the status of fSymbols changes + * from private to protected, + * or when fSymbols can be set any other way that allows them to be readonly aliases + * to non-resource bundle strings, + * then regular UnicodeString copies must be used instead of fastCopyFrom(). + * + * @internal + */ + UnicodeString fSymbols[kFormatSymbolCount]; + + /** + * Non-symbol variable for getConstSymbol(). Always empty. + * @internal + */ + UnicodeString fNoSymbol; + + Locale locale; + + char actualLocale[ULOC_FULLNAME_CAPACITY]; + char validLocale[ULOC_FULLNAME_CAPACITY]; + const char16_t* currPattern; + + UnicodeString currencySpcBeforeSym[UNUM_CURRENCY_SPACING_COUNT]; + UnicodeString currencySpcAfterSym[UNUM_CURRENCY_SPACING_COUNT]; + UBool fIsCustomCurrencySymbol; + UBool fIsCustomIntlCurrencySymbol; +}; + +// ------------------------------------- + +inline UnicodeString +DecimalFormatSymbols::getSymbol(ENumberFormatSymbol symbol) const { + const UnicodeString *strPtr; + if(symbol < kFormatSymbolCount) { + strPtr = &fSymbols[symbol]; + } else { + strPtr = &fNoSymbol; + } + return *strPtr; +} + +// See comments above for this function. Not hidden with #ifndef U_HIDE_INTERNAL_API +inline const UnicodeString & +DecimalFormatSymbols::getConstSymbol(ENumberFormatSymbol symbol) const { + const UnicodeString *strPtr; + if(symbol < kFormatSymbolCount) { + strPtr = &fSymbols[symbol]; + } else { + strPtr = &fNoSymbol; + } + return *strPtr; +} + +// ------------------------------------- + +inline void +DecimalFormatSymbols::setSymbol(ENumberFormatSymbol symbol, const UnicodeString &value, const UBool propogateDigits = TRUE) { + if (symbol == kCurrencySymbol) { + fIsCustomCurrencySymbol = TRUE; + } + else if (symbol == kIntlCurrencySymbol) { + fIsCustomIntlCurrencySymbol = TRUE; + } + if(symbol; +#endif + +/** + * DecimalFormat is a concrete subclass of NumberFormat that formats decimal + * numbers. It has a variety of features designed to make it possible to parse + * and format numbers in any locale, including support for Western, Arabic, or + * Indic digits. It also supports different flavors of numbers, including + * integers ("123"), fixed-point numbers ("123.4"), scientific notation + * ("1.23E4"), percentages ("12%"), and currency amounts ("$123", "USD123", + * "123 US dollars"). All of these flavors can be easily localized. + * + *

To obtain a NumberFormat for a specific locale (including the default + * locale) call one of NumberFormat's factory methods such as + * createInstance(). Do not call the DecimalFormat constructors directly, unless + * you know what you are doing, since the NumberFormat factory methods may + * return subclasses other than DecimalFormat. + * + *

Example Usage + * + * \code + * // Normally we would have a GUI with a menu for this + * int32_t locCount; + * const Locale* locales = NumberFormat::getAvailableLocales(locCount); + * + * double myNumber = -1234.56; + * UErrorCode success = U_ZERO_ERROR; + * NumberFormat* form; + * + * // Print out a number with the localized number, currency and percent + * // format for each locale. + * UnicodeString countryName; + * UnicodeString displayName; + * UnicodeString str; + * UnicodeString pattern; + * Formattable fmtable; + * for (int32_t j = 0; j < 3; ++j) { + * cout << endl << "FORMAT " << j << endl; + * for (int32_t i = 0; i < locCount; ++i) { + * if (locales[i].getCountry(countryName).size() == 0) { + * // skip language-only + * continue; + * } + * switch (j) { + * case 0: + * form = NumberFormat::createInstance(locales[i], success ); break; + * case 1: + * form = NumberFormat::createCurrencyInstance(locales[i], success ); break; + * default: + * form = NumberFormat::createPercentInstance(locales[i], success ); break; + * } + * if (form) { + * str.remove(); + * pattern = ((DecimalFormat*)form)->toPattern(pattern); + * cout << locales[i].getDisplayName(displayName) << ": " << pattern; + * cout << " -> " << form->format(myNumber,str) << endl; + * form->parse(form->format(myNumber,str), fmtable, success); + * delete form; + * } + * } + * } + * \endcode + *

+ * Another example use createInstance(style) + *

+ *

+ * // Print out a number using the localized number, currency,
+ * // percent, scientific, integer, iso currency, and plural currency
+ * // format for each locale
+ * Locale* locale = new Locale("en", "US");
+ * double myNumber = 1234.56;
+ * UErrorCode success = U_ZERO_ERROR;
+ * UnicodeString str;
+ * Formattable fmtable;
+ * for (int j=NumberFormat::kNumberStyle;
+ *      j<=NumberFormat::kPluralCurrencyStyle;
+ *      ++j) {
+ *     NumberFormat* format = NumberFormat::createInstance(locale, j, success);
+ *     str.remove();
+ *     cout << "format result " << form->format(myNumber, str) << endl;
+ *     format->parse(form->format(myNumber, str), fmtable, success);
+ * }
+ * + * + *

Patterns + * + *

A DecimalFormat consists of a pattern and a set of + * symbols. The pattern may be set directly using + * applyPattern(), or indirectly using other API methods which + * manipulate aspects of the pattern, such as the minimum number of integer + * digits. The symbols are stored in a DecimalFormatSymbols + * object. When using the NumberFormat factory methods, the + * pattern and symbols are read from ICU's locale data. + * + *

Special Pattern Characters + * + *

Many characters in a pattern are taken literally; they are matched during + * parsing and output unchanged during formatting. Special characters, on the + * other hand, stand for other characters, strings, or classes of characters. + * For example, the '#' character is replaced by a localized digit. Often the + * replacement character is the same as the pattern character; in the U.S. locale, + * the ',' grouping character is replaced by ','. However, the replacement is + * still happening, and if the symbols are modified, the grouping character + * changes. Some special characters affect the behavior of the formatter by + * their presence; for example, if the percent character is seen, then the + * value is multiplied by 100 before being displayed. + * + *

To insert a special character in a pattern as a literal, that is, without + * any special meaning, the character must be quoted. There are some exceptions to + * this which are noted below. + * + *

The characters listed here are used in non-localized patterns. Localized + * patterns use the corresponding characters taken from this formatter's + * DecimalFormatSymbols object instead, and these characters lose + * their special status. Two exceptions are the currency sign and quote, which + * are not localized. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Symbol + * Location + * Localized? + * Meaning + *
0 + * Number + * Yes + * Digit + *
1-9 + * Number + * Yes + * '1' through '9' indicate rounding. + *
\htmlonly@\endhtmlonly + * Number + * No + * Significant digit + *
# + * Number + * Yes + * Digit, zero shows as absent + *
. + * Number + * Yes + * Decimal separator or monetary decimal separator + *
- + * Number + * Yes + * Minus sign + *
, + * Number + * Yes + * Grouping separator + *
E + * Number + * Yes + * Separates mantissa and exponent in scientific notation. + * Need not be quoted in prefix or suffix. + *
+ + * Exponent + * Yes + * Prefix positive exponents with localized plus sign. + * Need not be quoted in prefix or suffix. + *
; + * Subpattern boundary + * Yes + * Separates positive and negative subpatterns + *
\% + * Prefix or suffix + * Yes + * Multiply by 100 and show as percentage + *
\\u2030 + * Prefix or suffix + * Yes + * Multiply by 1000 and show as per mille + *
\htmlonly¤\endhtmlonly (\\u00A4) + * Prefix or suffix + * No + * Currency sign, replaced by currency symbol. If + * doubled, replaced by international currency symbol. + * If tripled, replaced by currency plural names, for example, + * "US dollar" or "US dollars" for America. + * If present in a pattern, the monetary decimal separator + * is used instead of the decimal separator. + *
' + * Prefix or suffix + * No + * Used to quote special characters in a prefix or suffix, + * for example, "'#'#" formats 123 to + * "#123". To create a single quote + * itself, use two in a row: "# o''clock". + *
* + * Prefix or suffix boundary + * Yes + * Pad escape, precedes pad character + *
+ * + *

A DecimalFormat pattern contains a postive and negative + * subpattern, for example, "#,##0.00;(#,##0.00)". Each subpattern has a + * prefix, a numeric part, and a suffix. If there is no explicit negative + * subpattern, the negative subpattern is the localized minus sign prefixed to the + * positive subpattern. That is, "0.00" alone is equivalent to "0.00;-0.00". If there + * is an explicit negative subpattern, it serves only to specify the negative + * prefix and suffix; the number of digits, minimal digits, and other + * characteristics are ignored in the negative subpattern. That means that + * "#,##0.0#;(#)" has precisely the same result as "#,##0.0#;(#,##0.0#)". + * + *

The prefixes, suffixes, and various symbols used for infinity, digits, + * thousands separators, decimal separators, etc. may be set to arbitrary + * values, and they will appear properly during formatting. However, care must + * be taken that the symbols and strings do not conflict, or parsing will be + * unreliable. For example, either the positive and negative prefixes or the + * suffixes must be distinct for parse() to be able + * to distinguish positive from negative values. Another example is that the + * decimal separator and thousands separator should be distinct characters, or + * parsing will be impossible. + * + *

The grouping separator is a character that separates clusters of + * integer digits to make large numbers more legible. It commonly used for + * thousands, but in some locales it separates ten-thousands. The grouping + * size is the number of digits between the grouping separators, such as 3 + * for "100,000,000" or 4 for "1 0000 0000". There are actually two different + * grouping sizes: One used for the least significant integer digits, the + * primary grouping size, and one used for all others, the + * secondary grouping size. In most locales these are the same, but + * sometimes they are different. For example, if the primary grouping interval + * is 3, and the secondary is 2, then this corresponds to the pattern + * "#,##,##0", and the number 123456789 is formatted as "12,34,56,789". If a + * pattern contains multiple grouping separators, the interval between the last + * one and the end of the integer defines the primary grouping size, and the + * interval between the last two defines the secondary grouping size. All others + * are ignored, so "#,##,###,####" == "###,###,####" == "##,#,###,####". + * + *

Illegal patterns, such as "#.#.#" or "#.###,###", will cause + * DecimalFormat to set a failing UErrorCode. + * + *

Pattern BNF + * + *

+ * pattern    := subpattern (';' subpattern)?
+ * subpattern := prefix? number exponent? suffix?
+ * number     := (integer ('.' fraction)?) | sigDigits
+ * prefix     := '\\u0000'..'\\uFFFD' - specialCharacters
+ * suffix     := '\\u0000'..'\\uFFFD' - specialCharacters
+ * integer    := '#'* '0'* '0'
+ * fraction   := '0'* '#'*
+ * sigDigits  := '#'* '@' '@'* '#'*
+ * exponent   := 'E' '+'? '0'* '0'
+ * padSpec    := '*' padChar
+ * padChar    := '\\u0000'..'\\uFFFD' - quote
+ *  
+ * Notation:
+ *   X*       0 or more instances of X
+ *   X?       0 or 1 instances of X
+ *   X|Y      either X or Y
+ *   C..D     any character from C up to D, inclusive
+ *   S-T      characters in S, except those in T
+ * 
+ * The first subpattern is for positive numbers. The second (optional) + * subpattern is for negative numbers. + * + *

Not indicated in the BNF syntax above: + * + *

  • The grouping separator ',' can occur inside the integer and + * sigDigits elements, between any two pattern characters of that + * element, as long as the integer or sigDigits element is not + * followed by the exponent element. + * + *
  • Two grouping intervals are recognized: That between the + * decimal point and the first grouping symbol, and that + * between the first and second grouping symbols. These + * intervals are identical in most locales, but in some + * locales they differ. For example, the pattern + * "#,##,###" formats the number 123456789 as + * "12,34,56,789".
  • + * + *
  • The pad specifier padSpec may appear before the prefix, + * after the prefix, before the suffix, after the suffix, or not at all. + * + *
  • In place of '0', the digits '1' through '9' may be used to + * indicate a rounding increment. + *
+ * + *

Parsing + * + *

DecimalFormat parses all Unicode characters that represent + * decimal digits, as defined by u_charDigitValue(). In addition, + * DecimalFormat also recognizes as digits the ten consecutive + * characters starting with the localized zero digit defined in the + * DecimalFormatSymbols object. During formatting, the + * DecimalFormatSymbols-based digits are output. + * + *

During parsing, grouping separators are ignored if in lenient mode; + * otherwise, if present, they must be in appropriate positions. + * + *

For currency parsing, the formatter is able to parse every currency + * style formats no matter which style the formatter is constructed with. + * For example, a formatter instance gotten from + * NumberFormat.getInstance(ULocale, NumberFormat.CURRENCYSTYLE) can parse + * formats such as "USD1.00" and "3.00 US dollars". + * + *

If parse(UnicodeString&,Formattable&,ParsePosition&) + * fails to parse a string, it leaves the parse position unchanged. + * The convenience method parse(UnicodeString&,Formattable&,UErrorCode&) + * indicates parse failure by setting a failing + * UErrorCode. + * + *

Formatting + * + *

Formatting is guided by several parameters, all of which can be + * specified either using a pattern or using the API. The following + * description applies to formats that do not use scientific + * notation or significant digits. + * + *

  • If the number of actual integer digits exceeds the + * maximum integer digits, then only the least significant + * digits are shown. For example, 1997 is formatted as "97" if the + * maximum integer digits is set to 2. + * + *
  • If the number of actual integer digits is less than the + * minimum integer digits, then leading zeros are added. For + * example, 1997 is formatted as "01997" if the minimum integer digits + * is set to 5. + * + *
  • If the number of actual fraction digits exceeds the maximum + * fraction digits, then rounding is performed to the + * maximum fraction digits. For example, 0.125 is formatted as "0.12" + * if the maximum fraction digits is 2. This behavior can be changed + * by specifying a rounding increment and/or a rounding mode. + * + *
  • If the number of actual fraction digits is less than the + * minimum fraction digits, then trailing zeros are added. + * For example, 0.125 is formatted as "0.1250" if the mimimum fraction + * digits is set to 4. + * + *
  • Trailing fractional zeros are not displayed if they occur + * j positions after the decimal, where j is less + * than the maximum fraction digits. For example, 0.10004 is + * formatted as "0.1" if the maximum fraction digits is four or less. + *
+ * + *

Special Values + * + *

NaN is represented as a single character, typically + * \\uFFFD. This character is determined by the + * DecimalFormatSymbols object. This is the only value for which + * the prefixes and suffixes are not used. + * + *

Infinity is represented as a single character, typically + * \\u221E, with the positive or negative prefixes and suffixes + * applied. The infinity character is determined by the + * DecimalFormatSymbols object. + * + * Scientific Notation + * + *

Numbers in scientific notation are expressed as the product of a mantissa + * and a power of ten, for example, 1234 can be expressed as 1.234 x 103. The + * mantissa is typically in the half-open interval [1.0, 10.0) or sometimes [0.0, 1.0), + * but it need not be. DecimalFormat supports arbitrary mantissas. + * DecimalFormat can be instructed to use scientific + * notation through the API or through the pattern. In a pattern, the exponent + * character immediately followed by one or more digit characters indicates + * scientific notation. Example: "0.###E0" formats the number 1234 as + * "1.234E3". + * + *

    + *
  • The number of digit characters after the exponent character gives the + * minimum exponent digit count. There is no maximum. Negative exponents are + * formatted using the localized minus sign, not the prefix and suffix + * from the pattern. This allows patterns such as "0.###E0 m/s". To prefix + * positive exponents with a localized plus sign, specify '+' between the + * exponent and the digits: "0.###E+0" will produce formats "1E+1", "1E+0", + * "1E-1", etc. (In localized patterns, use the localized plus sign rather than + * '+'.) + * + *
  • The minimum number of integer digits is achieved by adjusting the + * exponent. Example: 0.00123 formatted with "00.###E0" yields "12.3E-4". This + * only happens if there is no maximum number of integer digits. If there is a + * maximum, then the minimum number of integer digits is fixed at one. + * + *
  • The maximum number of integer digits, if present, specifies the exponent + * grouping. The most common use of this is to generate engineering + * notation, in which the exponent is a multiple of three, e.g., + * "##0.###E0". The number 12345 is formatted using "##0.####E0" as "12.345E3". + * + *
  • When using scientific notation, the formatter controls the + * digit counts using significant digits logic. The maximum number of + * significant digits limits the total number of integer and fraction + * digits that will be shown in the mantissa; it does not affect + * parsing. For example, 12345 formatted with "##0.##E0" is "12.3E3". + * See the section on significant digits for more details. + * + *
  • The number of significant digits shown is determined as + * follows: If areSignificantDigitsUsed() returns false, then the + * minimum number of significant digits shown is one, and the maximum + * number of significant digits shown is the sum of the minimum + * integer and maximum fraction digits, and is + * unaffected by the maximum integer digits. If this sum is zero, + * then all significant digits are shown. If + * areSignificantDigitsUsed() returns true, then the significant digit + * counts are specified by getMinimumSignificantDigits() and + * getMaximumSignificantDigits(). In this case, the number of + * integer digits is fixed at one, and there is no exponent grouping. + * + *
  • Exponential patterns may not contain grouping separators. + *
+ * + * Significant Digits + * + * DecimalFormat has two ways of controlling how many + * digits are shows: (a) significant digits counts, or (b) integer and + * fraction digit counts. Integer and fraction digit counts are + * described above. When a formatter is using significant digits + * counts, the number of integer and fraction digits is not specified + * directly, and the formatter settings for these counts are ignored. + * Instead, the formatter uses however many integer and fraction + * digits are required to display the specified number of significant + * digits. Examples: + * + * + * + * + * + * + * + *
Pattern + * Minimum significant digits + * Maximum significant digits + * Number + * Output of format() + *
\@\@\@ + * 3 + * 3 + * 12345 + * 12300 + *
\@\@\@ + * 3 + * 3 + * 0.12345 + * 0.123 + *
\@\@## + * 2 + * 4 + * 3.14159 + * 3.142 + *
\@\@## + * 2 + * 4 + * 1.23004 + * 1.23 + *
+ * + *
    + *
  • Significant digit counts may be expressed using patterns that + * specify a minimum and maximum number of significant digits. These + * are indicated by the '@' and '#' + * characters. The minimum number of significant digits is the number + * of '@' characters. The maximum number of significant + * digits is the number of '@' characters plus the number + * of '#' characters following on the right. For + * example, the pattern "@@@" indicates exactly 3 + * significant digits. The pattern "@##" indicates from + * 1 to 3 significant digits. Trailing zero digits to the right of + * the decimal separator are suppressed after the minimum number of + * significant digits have been shown. For example, the pattern + * "@##" formats the number 0.1203 as + * "0.12". + * + *
  • If a pattern uses significant digits, it may not contain a + * decimal separator, nor the '0' pattern character. + * Patterns such as "@00" or "@.###" are + * disallowed. + * + *
  • Any number of '#' characters may be prepended to + * the left of the leftmost '@' character. These have no + * effect on the minimum and maximum significant digits counts, but + * may be used to position grouping separators. For example, + * "#,#@#" indicates a minimum of one significant digits, + * a maximum of two significant digits, and a grouping size of three. + * + *
  • In order to enable significant digits formatting, use a pattern + * containing the '@' pattern character. Alternatively, + * call setSignificantDigitsUsed(TRUE). + * + *
  • In order to disable significant digits formatting, use a + * pattern that does not contain the '@' pattern + * character. Alternatively, call setSignificantDigitsUsed(FALSE). + * + *
  • The number of significant digits has no effect on parsing. + * + *
  • Significant digits may be used together with exponential notation. Such + * patterns are equivalent to a normal exponential pattern with a minimum and + * maximum integer digit count of one, a minimum fraction digit count of + * getMinimumSignificantDigits() - 1, and a maximum fraction digit + * count of getMaximumSignificantDigits() - 1. For example, the + * pattern "@@###E0" is equivalent to "0.0###E0". + * + *
  • If signficant digits are in use, then the integer and fraction + * digit counts, as set via the API, are ignored. If significant + * digits are not in use, then the signficant digit counts, as set via + * the API, are ignored. + * + *
+ * + *

Padding + * + *

DecimalFormat supports padding the result of + * format() to a specific width. Padding may be specified either + * through the API or through the pattern syntax. In a pattern the pad escape + * character, followed by a single pad character, causes padding to be parsed + * and formatted. The pad escape character is '*' in unlocalized patterns, and + * can be localized using DecimalFormatSymbols::setSymbol() with a + * DecimalFormatSymbols::kPadEscapeSymbol + * selector. For example, "$*x#,##0.00" formats 123 to + * "$xx123.00", and 1234 to "$1,234.00". + * + *

    + *
  • When padding is in effect, the width of the positive subpattern, + * including prefix and suffix, determines the format width. For example, in + * the pattern "* #0 o''clock", the format width is 10. + * + *
  • The width is counted in 16-bit code units (char16_ts). + * + *
  • Some parameters which usually do not matter have meaning when padding is + * used, because the pattern width is significant with padding. In the pattern + * "* ##,##,#,##0.##", the format width is 14. The initial characters "##,##," + * do not affect the grouping size or maximum integer digits, but they do affect + * the format width. + * + *
  • Padding may be inserted at one of four locations: before the prefix, + * after the prefix, before the suffix, or after the suffix. If padding is + * specified in any other location, applyPattern() + * sets a failing UErrorCode. If there is no prefix, + * before the prefix and after the prefix are equivalent, likewise for the + * suffix. + * + *
  • When specified in a pattern, the 32-bit code point immediately + * following the pad escape is the pad character. This may be any character, + * including a special pattern character. That is, the pad escape + * escapes the following character. If there is no character after + * the pad escape, then the pattern is illegal. + * + *
+ * + *

Rounding + * + *

DecimalFormat supports rounding to a specific increment. For + * example, 1230 rounded to the nearest 50 is 1250. 1.234 rounded to the + * nearest 0.65 is 1.3. The rounding increment may be specified through the API + * or in a pattern. To specify a rounding increment in a pattern, include the + * increment in the pattern itself. "#,#50" specifies a rounding increment of + * 50. "#,##0.05" specifies a rounding increment of 0.05. + * + *

In the absense of an explicit rounding increment numbers are + * rounded to their formatted width. + * + *

    + *
  • Rounding only affects the string produced by formatting. It does + * not affect parsing or change any numerical values. + * + *
  • A rounding mode determines how values are rounded; see + * DecimalFormat::ERoundingMode. The default rounding mode is + * DecimalFormat::kRoundHalfEven. The rounding mode can only be set + * through the API; it can not be set with a pattern. + * + *
  • Some locales use rounding in their currency formats to reflect the + * smallest currency denomination. + * + *
  • In a pattern, digits '1' through '9' specify rounding, but otherwise + * behave identically to digit '0'. + *
+ * + *

Synchronization + * + *

DecimalFormat objects are not synchronized. Multiple + * threads should not access one formatter concurrently. + * + *

Subclassing + * + *

User subclasses are not supported. While clients may write + * subclasses, such code will not necessarily work and will not be + * guaranteed to work stably from release to release. + */ +class U_I18N_API DecimalFormat: public NumberFormat { +public: + /** + * Pad position. + * @stable ICU 2.4 + */ + enum EPadPosition { + kPadBeforePrefix, + kPadAfterPrefix, + kPadBeforeSuffix, + kPadAfterSuffix + }; + + /** + * Create a DecimalFormat using the default pattern and symbols + * for the default locale. This is a convenient way to obtain a + * DecimalFormat when internationalization is not the main concern. + *

+ * To obtain standard formats for a given locale, use the factory methods + * on NumberFormat such as createInstance. These factories will + * return the most appropriate sub-class of NumberFormat for a given + * locale. + * @param status Output param set to success/failure code. If the + * pattern is invalid this will be set to a failure code. + * @stable ICU 2.0 + */ + DecimalFormat(UErrorCode& status); + + /** + * Create a DecimalFormat from the given pattern and the symbols + * for the default locale. This is a convenient way to obtain a + * DecimalFormat when internationalization is not the main concern. + *

+ * To obtain standard formats for a given locale, use the factory methods + * on NumberFormat such as createInstance. These factories will + * return the most appropriate sub-class of NumberFormat for a given + * locale. + * @param pattern A non-localized pattern string. + * @param status Output param set to success/failure code. If the + * pattern is invalid this will be set to a failure code. + * @stable ICU 2.0 + */ + DecimalFormat(const UnicodeString& pattern, + UErrorCode& status); + + /** + * Create a DecimalFormat from the given pattern and symbols. + * Use this constructor when you need to completely customize the + * behavior of the format. + *

+ * To obtain standard formats for a given + * locale, use the factory methods on NumberFormat such as + * createInstance or createCurrencyInstance. If you need only minor adjustments + * to a standard format, you can modify the format returned by + * a NumberFormat factory method. + * + * @param pattern a non-localized pattern string + * @param symbolsToAdopt the set of symbols to be used. The caller should not + * delete this object after making this call. + * @param status Output param set to success/failure code. If the + * pattern is invalid this will be set to a failure code. + * @stable ICU 2.0 + */ + DecimalFormat( const UnicodeString& pattern, + DecimalFormatSymbols* symbolsToAdopt, + UErrorCode& status); + +#ifndef U_HIDE_INTERNAL_API + /** + * This API is for ICU use only. + * Create a DecimalFormat from the given pattern, symbols, and style. + * + * @param pattern a non-localized pattern string + * @param symbolsToAdopt the set of symbols to be used. The caller should not + * delete this object after making this call. + * @param style style of decimal format + * @param status Output param set to success/failure code. If the + * pattern is invalid this will be set to a failure code. + * @internal + */ + DecimalFormat( const UnicodeString& pattern, + DecimalFormatSymbols* symbolsToAdopt, + UNumberFormatStyle style, + UErrorCode& status); + +#if UCONFIG_HAVE_PARSEALLINPUT + /** + * @internal + */ + void setParseAllInput(UNumberFormatAttributeValue value); +#endif + +#endif /* U_HIDE_INTERNAL_API */ + + + /** + * Set an integer attribute on this DecimalFormat. + * May return U_UNSUPPORTED_ERROR if this instance does not support + * the specified attribute. + * @param attr the attribute to set + * @param newvalue new value + * @param status the error type + * @return *this - for chaining (example: format.setAttribute(...).setAttribute(...) ) + * @stable ICU 51 + */ + virtual DecimalFormat& setAttribute( UNumberFormatAttribute attr, + int32_t newvalue, + UErrorCode &status); + + /** + * Get an integer + * May return U_UNSUPPORTED_ERROR if this instance does not support + * the specified attribute. + * @param attr the attribute to set + * @param status the error type + * @return the attribute value. Undefined if there is an error. + * @stable ICU 51 + */ + virtual int32_t getAttribute( UNumberFormatAttribute attr, + UErrorCode &status) const; + + + /** + * Set whether or not grouping will be used in this format. + * @param newValue True, grouping will be used in this format. + * @see getGroupingUsed + * @stable ICU 53 + */ + virtual void setGroupingUsed(UBool newValue); + + /** + * Sets whether or not numbers should be parsed as integers only. + * @param value set True, this format will parse numbers as integers + * only. + * @see isParseIntegerOnly + * @stable ICU 53 + */ + virtual void setParseIntegerOnly(UBool value); + + /** + * Set a particular UDisplayContext value in the formatter, such as + * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. + * @param value The UDisplayContext value to set. + * @param status Input/output status. If at entry this indicates a failure + * status, the function will do nothing; otherwise this will be + * updated with any new status from the function. + * @stable ICU 53 + */ + virtual void setContext(UDisplayContext value, UErrorCode& status); + + /** + * Create a DecimalFormat from the given pattern and symbols. + * Use this constructor when you need to completely customize the + * behavior of the format. + *

+ * To obtain standard formats for a given + * locale, use the factory methods on NumberFormat such as + * createInstance or createCurrencyInstance. If you need only minor adjustments + * to a standard format, you can modify the format returned by + * a NumberFormat factory method. + * + * @param pattern a non-localized pattern string + * @param symbolsToAdopt the set of symbols to be used. The caller should not + * delete this object after making this call. + * @param parseError Output param to receive errors occured during parsing + * @param status Output param set to success/failure code. If the + * pattern is invalid this will be set to a failure code. + * @stable ICU 2.0 + */ + DecimalFormat( const UnicodeString& pattern, + DecimalFormatSymbols* symbolsToAdopt, + UParseError& parseError, + UErrorCode& status); + /** + * Create a DecimalFormat from the given pattern and symbols. + * Use this constructor when you need to completely customize the + * behavior of the format. + *

+ * To obtain standard formats for a given + * locale, use the factory methods on NumberFormat such as + * createInstance or createCurrencyInstance. If you need only minor adjustments + * to a standard format, you can modify the format returned by + * a NumberFormat factory method. + * + * @param pattern a non-localized pattern string + * @param symbols the set of symbols to be used + * @param status Output param set to success/failure code. If the + * pattern is invalid this will be set to a failure code. + * @stable ICU 2.0 + */ + DecimalFormat( const UnicodeString& pattern, + const DecimalFormatSymbols& symbols, + UErrorCode& status); + + /** + * Copy constructor. + * + * @param source the DecimalFormat object to be copied from. + * @stable ICU 2.0 + */ + DecimalFormat(const DecimalFormat& source); + + /** + * Assignment operator. + * + * @param rhs the DecimalFormat object to be copied. + * @stable ICU 2.0 + */ + DecimalFormat& operator=(const DecimalFormat& rhs); + + /** + * Destructor. + * @stable ICU 2.0 + */ + virtual ~DecimalFormat(); + + /** + * Clone this Format object polymorphically. The caller owns the + * result and should delete it when done. + * + * @return a polymorphic copy of this DecimalFormat. + * @stable ICU 2.0 + */ + virtual Format* clone(void) const; + + /** + * Return true if the given Format objects are semantically equal. + * Objects of different subclasses are considered unequal. + * + * @param other the object to be compared with. + * @return true if the given Format objects are semantically equal. + * @stable ICU 2.0 + */ + virtual UBool operator==(const Format& other) const; + + + using NumberFormat::format; + + /** + * Format a double or long number using base-10 representation. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @return Reference to 'appendTo' parameter. + * @stable ICU 2.0 + */ + virtual UnicodeString& format(double number, + UnicodeString& appendTo, + FieldPosition& pos) const; + + + /** + * Format a double or long number using base-10 representation. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @param status + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format(double number, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode &status) const; + + /** + * Format a double or long number using base-10 representation. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param posIter On return, can be used to iterate over positions + * of fields generated by this format call. + * Can be NULL. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @stable ICU 4.4 + */ + virtual UnicodeString& format(double number, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; + + /** + * Format a long number using base-10 representation. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @return Reference to 'appendTo' parameter. + * @stable ICU 2.0 + */ + virtual UnicodeString& format(int32_t number, + UnicodeString& appendTo, + FieldPosition& pos) const; + + /** + * Format a long number using base-10 representation. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format(int32_t number, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode &status) const; + + /** + * Format a long number using base-10 representation. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param posIter On return, can be used to iterate over positions + * of fields generated by this format call. + * Can be NULL. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @stable ICU 4.4 + */ + virtual UnicodeString& format(int32_t number, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; + + /** + * Format an int64 number using base-10 representation. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @return Reference to 'appendTo' parameter. + * @stable ICU 2.8 + */ + virtual UnicodeString& format(int64_t number, + UnicodeString& appendTo, + FieldPosition& pos) const; + + /** + * Format an int64 number using base-10 representation. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format(int64_t number, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode &status) const; + + /** + * Format an int64 number using base-10 representation. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param posIter On return, can be used to iterate over positions + * of fields generated by this format call. + * Can be NULL. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @stable ICU 4.4 + */ + virtual UnicodeString& format(int64_t number, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; + + /** + * Format a decimal number. + * The syntax of the unformatted number is a "numeric string" + * as defined in the Decimal Arithmetic Specification, available at + * http://speleotrove.com/decimal + * + * @param number The unformatted number, as a string. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param posIter On return, can be used to iterate over positions + * of fields generated by this format call. + * Can be NULL. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @stable ICU 4.4 + */ + virtual UnicodeString& format(StringPiece number, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; + + + /** + * Format a decimal number. + * The number is a DigitList wrapper onto a floating point decimal number. + * The default implementation in NumberFormat converts the decimal number + * to a double and formats that. + * + * @param number The number, a DigitList format Decimal Floating Point. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param posIter On return, can be used to iterate over positions + * of fields generated by this format call. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format(const DigitList &number, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; + + /** + * Format a decimal number. + * @param number The number + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format( + const VisibleDigitsWithExponent &number, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode& status) const; + + /** + * Format a decimal number. + * @param number The number + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param posIter On return, can be used to iterate over positions + * of fields generated by this format call. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format( + const VisibleDigitsWithExponent &number, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; + + /** + * Format a decimal number. + * The number is a DigitList wrapper onto a floating point decimal number. + * The default implementation in NumberFormat converts the decimal number + * to a double and formats that. + * + * @param number The number, a DigitList format Decimal Floating Point. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format(const DigitList &number, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode& status) const; + + using NumberFormat::parse; + + /** + * Parse the given string using this object's choices. The method + * does string comparisons to try to find an optimal match. + * If no object can be parsed, index is unchanged, and NULL is + * returned. The result is returned as the most parsimonious + * type of Formattable that will accomodate all of the + * necessary precision. For example, if the result is exactly 12, + * it will be returned as a long. However, if it is 1.5, it will + * be returned as a double. + * + * @param text The text to be parsed. + * @param result Formattable to be set to the parse result. + * If parse fails, return contents are undefined. + * @param parsePosition The position to start parsing at on input. + * On output, moved to after the last successfully + * parse character. On parse failure, does not change. + * @see Formattable + * @stable ICU 2.0 + */ + virtual void parse(const UnicodeString& text, + Formattable& result, + ParsePosition& parsePosition) const; + + /** + * Parses text from the given string as a currency amount. Unlike + * the parse() method, this method will attempt to parse a generic + * currency name, searching for a match of this object's locale's + * currency display names, or for a 3-letter ISO currency code. + * This method will fail if this format is not a currency format, + * that is, if it does not contain the currency pattern symbol + * (U+00A4) in its prefix or suffix. + * + * @param text the string to parse + * @param pos input-output position; on input, the position within text + * to match; must have 0 <= pos.getIndex() < text.length(); + * on output, the position after the last matched character. + * If the parse fails, the position in unchanged upon output. + * @return if parse succeeds, a pointer to a newly-created CurrencyAmount + * object (owned by the caller) containing information about + * the parsed currency; if parse fails, this is NULL. + * @stable ICU 49 + */ + virtual CurrencyAmount* parseCurrency(const UnicodeString& text, + ParsePosition& pos) const; + + /** + * Returns the decimal format symbols, which is generally not changed + * by the programmer or user. + * @return desired DecimalFormatSymbols + * @see DecimalFormatSymbols + * @stable ICU 2.0 + */ + virtual const DecimalFormatSymbols* getDecimalFormatSymbols(void) const; + + /** + * Sets the decimal format symbols, which is generally not changed + * by the programmer or user. + * @param symbolsToAdopt DecimalFormatSymbols to be adopted. + * @stable ICU 2.0 + */ + virtual void adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt); + + /** + * Sets the decimal format symbols, which is generally not changed + * by the programmer or user. + * @param symbols DecimalFormatSymbols. + * @stable ICU 2.0 + */ + virtual void setDecimalFormatSymbols(const DecimalFormatSymbols& symbols); + + + /** + * Returns the currency plural format information, + * which is generally not changed by the programmer or user. + * @return desired CurrencyPluralInfo + * @stable ICU 4.2 + */ + virtual const CurrencyPluralInfo* getCurrencyPluralInfo(void) const; + + /** + * Sets the currency plural format information, + * which is generally not changed by the programmer or user. + * @param toAdopt CurrencyPluralInfo to be adopted. + * @stable ICU 4.2 + */ + virtual void adoptCurrencyPluralInfo(CurrencyPluralInfo* toAdopt); + + /** + * Sets the currency plural format information, + * which is generally not changed by the programmer or user. + * @param info Currency Plural Info. + * @stable ICU 4.2 + */ + virtual void setCurrencyPluralInfo(const CurrencyPluralInfo& info); + + + /** + * Get the positive prefix. + * + * @param result Output param which will receive the positive prefix. + * @return A reference to 'result'. + * Examples: +123, $123, sFr123 + * @stable ICU 2.0 + */ + UnicodeString& getPositivePrefix(UnicodeString& result) const; + + /** + * Set the positive prefix. + * + * @param newValue the new value of the the positive prefix to be set. + * Examples: +123, $123, sFr123 + * @stable ICU 2.0 + */ + virtual void setPositivePrefix(const UnicodeString& newValue); + + /** + * Get the negative prefix. + * + * @param result Output param which will receive the negative prefix. + * @return A reference to 'result'. + * Examples: -123, ($123) (with negative suffix), sFr-123 + * @stable ICU 2.0 + */ + UnicodeString& getNegativePrefix(UnicodeString& result) const; + + /** + * Set the negative prefix. + * + * @param newValue the new value of the the negative prefix to be set. + * Examples: -123, ($123) (with negative suffix), sFr-123 + * @stable ICU 2.0 + */ + virtual void setNegativePrefix(const UnicodeString& newValue); + + /** + * Get the positive suffix. + * + * @param result Output param which will receive the positive suffix. + * @return A reference to 'result'. + * Example: 123% + * @stable ICU 2.0 + */ + UnicodeString& getPositiveSuffix(UnicodeString& result) const; + + /** + * Set the positive suffix. + * + * @param newValue the new value of the positive suffix to be set. + * Example: 123% + * @stable ICU 2.0 + */ + virtual void setPositiveSuffix(const UnicodeString& newValue); + + /** + * Get the negative suffix. + * + * @param result Output param which will receive the negative suffix. + * @return A reference to 'result'. + * Examples: -123%, ($123) (with positive suffixes) + * @stable ICU 2.0 + */ + UnicodeString& getNegativeSuffix(UnicodeString& result) const; + + /** + * Set the negative suffix. + * + * @param newValue the new value of the negative suffix to be set. + * Examples: 123% + * @stable ICU 2.0 + */ + virtual void setNegativeSuffix(const UnicodeString& newValue); + + /** + * Get the multiplier for use in percent, permill, etc. + * For a percentage, set the suffixes to have "%" and the multiplier to be 100. + * (For Arabic, use arabic percent symbol). + * For a permill, set the suffixes to have "\\u2031" and the multiplier to be 1000. + * + * @return the multiplier for use in percent, permill, etc. + * Examples: with 100, 1.23 -> "123", and "123" -> 1.23 + * @stable ICU 2.0 + */ + int32_t getMultiplier(void) const; + + /** + * Set the multiplier for use in percent, permill, etc. + * For a percentage, set the suffixes to have "%" and the multiplier to be 100. + * (For Arabic, use arabic percent symbol). + * For a permill, set the suffixes to have "\\u2031" and the multiplier to be 1000. + * + * @param newValue the new value of the multiplier for use in percent, permill, etc. + * Examples: with 100, 1.23 -> "123", and "123" -> 1.23 + * @stable ICU 2.0 + */ + virtual void setMultiplier(int32_t newValue); + + /** + * Get the rounding increment. + * @return A positive rounding increment, or 0.0 if a custom rounding + * increment is not in effect. + * @see #setRoundingIncrement + * @see #getRoundingMode + * @see #setRoundingMode + * @stable ICU 2.0 + */ + virtual double getRoundingIncrement(void) const; + + /** + * Set the rounding increment. In the absence of a rounding increment, + * numbers will be rounded to the number of digits displayed. + * @param newValue A positive rounding increment, or 0.0 to + * use the default rounding increment. + * Negative increments are equivalent to 0.0. + * @see #getRoundingIncrement + * @see #getRoundingMode + * @see #setRoundingMode + * @stable ICU 2.0 + */ + virtual void setRoundingIncrement(double newValue); + + /** + * Get the rounding mode. + * @return A rounding mode + * @see #setRoundingIncrement + * @see #getRoundingIncrement + * @see #setRoundingMode + * @stable ICU 2.0 + */ + virtual ERoundingMode getRoundingMode(void) const; + + /** + * Set the rounding mode. + * @param roundingMode A rounding mode + * @see #setRoundingIncrement + * @see #getRoundingIncrement + * @see #getRoundingMode + * @stable ICU 2.0 + */ + virtual void setRoundingMode(ERoundingMode roundingMode); + + /** + * Get the width to which the output of format() is padded. + * The width is counted in 16-bit code units. + * @return the format width, or zero if no padding is in effect + * @see #setFormatWidth + * @see #getPadCharacterString + * @see #setPadCharacter + * @see #getPadPosition + * @see #setPadPosition + * @stable ICU 2.0 + */ + virtual int32_t getFormatWidth(void) const; + + /** + * Set the width to which the output of format() is padded. + * The width is counted in 16-bit code units. + * This method also controls whether padding is enabled. + * @param width the width to which to pad the result of + * format(), or zero to disable padding. A negative + * width is equivalent to 0. + * @see #getFormatWidth + * @see #getPadCharacterString + * @see #setPadCharacter + * @see #getPadPosition + * @see #setPadPosition + * @stable ICU 2.0 + */ + virtual void setFormatWidth(int32_t width); + + /** + * Get the pad character used to pad to the format width. The + * default is ' '. + * @return a string containing the pad character. This will always + * have a length of one 32-bit code point. + * @see #setFormatWidth + * @see #getFormatWidth + * @see #setPadCharacter + * @see #getPadPosition + * @see #setPadPosition + * @stable ICU 2.0 + */ + virtual UnicodeString getPadCharacterString() const; + + /** + * Set the character used to pad to the format width. If padding + * is not enabled, then this will take effect if padding is later + * enabled. + * @param padChar a string containing the pad charcter. If the string + * has length 0, then the pad characer is set to ' '. Otherwise + * padChar.char32At(0) will be used as the pad character. + * @see #setFormatWidth + * @see #getFormatWidth + * @see #getPadCharacterString + * @see #getPadPosition + * @see #setPadPosition + * @stable ICU 2.0 + */ + virtual void setPadCharacter(const UnicodeString &padChar); + + /** + * Get the position at which padding will take place. This is the location + * at which padding will be inserted if the result of format() + * is shorter than the format width. + * @return the pad position, one of kPadBeforePrefix, + * kPadAfterPrefix, kPadBeforeSuffix, or + * kPadAfterSuffix. + * @see #setFormatWidth + * @see #getFormatWidth + * @see #setPadCharacter + * @see #getPadCharacterString + * @see #setPadPosition + * @see #EPadPosition + * @stable ICU 2.0 + */ + virtual EPadPosition getPadPosition(void) const; + + /** + * Set the position at which padding will take place. This is the location + * at which padding will be inserted if the result of format() + * is shorter than the format width. This has no effect unless padding is + * enabled. + * @param padPos the pad position, one of kPadBeforePrefix, + * kPadAfterPrefix, kPadBeforeSuffix, or + * kPadAfterSuffix. + * @see #setFormatWidth + * @see #getFormatWidth + * @see #setPadCharacter + * @see #getPadCharacterString + * @see #getPadPosition + * @see #EPadPosition + * @stable ICU 2.0 + */ + virtual void setPadPosition(EPadPosition padPos); + + /** + * Return whether or not scientific notation is used. + * @return TRUE if this object formats and parses scientific notation + * @see #setScientificNotation + * @see #getMinimumExponentDigits + * @see #setMinimumExponentDigits + * @see #isExponentSignAlwaysShown + * @see #setExponentSignAlwaysShown + * @stable ICU 2.0 + */ + virtual UBool isScientificNotation(void) const; + + /** + * Set whether or not scientific notation is used. When scientific notation + * is used, the effective maximum number of integer digits is <= 8. If the + * maximum number of integer digits is set to more than 8, the effective + * maximum will be 1. This allows this call to generate a 'default' scientific + * number format without additional changes. + * @param useScientific TRUE if this object formats and parses scientific + * notation + * @see #isScientificNotation + * @see #getMinimumExponentDigits + * @see #setMinimumExponentDigits + * @see #isExponentSignAlwaysShown + * @see #setExponentSignAlwaysShown + * @stable ICU 2.0 + */ + virtual void setScientificNotation(UBool useScientific); + + /** + * Return the minimum exponent digits that will be shown. + * @return the minimum exponent digits that will be shown + * @see #setScientificNotation + * @see #isScientificNotation + * @see #setMinimumExponentDigits + * @see #isExponentSignAlwaysShown + * @see #setExponentSignAlwaysShown + * @stable ICU 2.0 + */ + virtual int8_t getMinimumExponentDigits(void) const; + + /** + * Set the minimum exponent digits that will be shown. This has no + * effect unless scientific notation is in use. + * @param minExpDig a value >= 1 indicating the fewest exponent digits + * that will be shown. Values less than 1 will be treated as 1. + * @see #setScientificNotation + * @see #isScientificNotation + * @see #getMinimumExponentDigits + * @see #isExponentSignAlwaysShown + * @see #setExponentSignAlwaysShown + * @stable ICU 2.0 + */ + virtual void setMinimumExponentDigits(int8_t minExpDig); + + /** + * Return whether the exponent sign is always shown. + * @return TRUE if the exponent is always prefixed with either the + * localized minus sign or the localized plus sign, false if only negative + * exponents are prefixed with the localized minus sign. + * @see #setScientificNotation + * @see #isScientificNotation + * @see #setMinimumExponentDigits + * @see #getMinimumExponentDigits + * @see #setExponentSignAlwaysShown + * @stable ICU 2.0 + */ + virtual UBool isExponentSignAlwaysShown(void) const; + + /** + * Set whether the exponent sign is always shown. This has no effect + * unless scientific notation is in use. + * @param expSignAlways TRUE if the exponent is always prefixed with either + * the localized minus sign or the localized plus sign, false if only + * negative exponents are prefixed with the localized minus sign. + * @see #setScientificNotation + * @see #isScientificNotation + * @see #setMinimumExponentDigits + * @see #getMinimumExponentDigits + * @see #isExponentSignAlwaysShown + * @stable ICU 2.0 + */ + virtual void setExponentSignAlwaysShown(UBool expSignAlways); + + /** + * Return the grouping size. Grouping size is the number of digits between + * grouping separators in the integer portion of a number. For example, + * in the number "123,456.78", the grouping size is 3. + * + * @return the grouping size. + * @see setGroupingSize + * @see NumberFormat::isGroupingUsed + * @see DecimalFormatSymbols::getGroupingSeparator + * @stable ICU 2.0 + */ + int32_t getGroupingSize(void) const; + + /** + * Set the grouping size. Grouping size is the number of digits between + * grouping separators in the integer portion of a number. For example, + * in the number "123,456.78", the grouping size is 3. + * + * @param newValue the new value of the grouping size. + * @see getGroupingSize + * @see NumberFormat::setGroupingUsed + * @see DecimalFormatSymbols::setGroupingSeparator + * @stable ICU 2.0 + */ + virtual void setGroupingSize(int32_t newValue); + + /** + * Return the secondary grouping size. In some locales one + * grouping interval is used for the least significant integer + * digits (the primary grouping size), and another is used for all + * others (the secondary grouping size). A formatter supporting a + * secondary grouping size will return a positive integer unequal + * to the primary grouping size returned by + * getGroupingSize(). For example, if the primary + * grouping size is 4, and the secondary grouping size is 2, then + * the number 123456789 formats as "1,23,45,6789", and the pattern + * appears as "#,##,###0". + * @return the secondary grouping size, or a value less than + * one if there is none + * @see setSecondaryGroupingSize + * @see NumberFormat::isGroupingUsed + * @see DecimalFormatSymbols::getGroupingSeparator + * @stable ICU 2.4 + */ + int32_t getSecondaryGroupingSize(void) const; + + /** + * Set the secondary grouping size. If set to a value less than 1, + * then secondary grouping is turned off, and the primary grouping + * size is used for all intervals, not just the least significant. + * + * @param newValue the new value of the secondary grouping size. + * @see getSecondaryGroupingSize + * @see NumberFormat#setGroupingUsed + * @see DecimalFormatSymbols::setGroupingSeparator + * @stable ICU 2.4 + */ + virtual void setSecondaryGroupingSize(int32_t newValue); + +#ifndef U_HIDE_INTERNAL_API + + /** + * Returns the minimum number of grouping digits. + * Grouping separators are output if there are at least this many + * digits to the left of the first (rightmost) grouping separator, + * that is, there are at least (minimum grouping + grouping size) integer digits. + * (Subject to isGroupingUsed().) + * + * For example, if this value is 2, and the grouping size is 3, then + * 9999 -> "9999" and 10000 -> "10,000" + * + * This is a technology preview. This API may change behavior or may be removed. + * + * The default value for this attribute is 0. + * A value of 1, 0, or lower, means that the use of grouping separators + * only depends on the grouping size (and on isGroupingUsed()). + * Currently, the corresponding CLDR data is not used; this is likely to change. + * + * @see setMinimumGroupingDigits + * @see getGroupingSize + * @internal technology preview + */ + int32_t getMinimumGroupingDigits() const; + +#endif /* U_HIDE_INTERNAL_API */ + + /* Cannot use #ifndef U_HIDE_INTERNAL_API for the following draft method since it is virtual. */ + /** + * Sets the minimum grouping digits. Setting to a value less than or + * equal to 1 turns off minimum grouping digits. + * + * @param newValue the new value of minimum grouping digits. + * @see getMinimumGroupingDigits + * @internal technology preview + */ + virtual void setMinimumGroupingDigits(int32_t newValue); + + + /** + * Allows you to get the behavior of the decimal separator with integers. + * (The decimal separator will always appear with decimals.) + * + * @return TRUE if the decimal separator always appear with decimals. + * Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345 + * @stable ICU 2.0 + */ + UBool isDecimalSeparatorAlwaysShown(void) const; + + /** + * Allows you to set the behavior of the decimal separator with integers. + * (The decimal separator will always appear with decimals.) + * + * @param newValue set TRUE if the decimal separator will always appear with decimals. + * Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345 + * @stable ICU 2.0 + */ + virtual void setDecimalSeparatorAlwaysShown(UBool newValue); + + /** + * Allows you to get the parse behavior of the pattern decimal mark. + * + * @return TRUE if input must contain a match to decimal mark in pattern + * @stable ICU 54 + */ + UBool isDecimalPatternMatchRequired(void) const; + + /** + * Allows you to set the behavior of the pattern decimal mark. + * + * if TRUE, the input must have a decimal mark if one was specified in the pattern. When + * FALSE the decimal mark may be omitted from the input. + * + * @param newValue set TRUE if input must contain a match to decimal mark in pattern + * @stable ICU 54 + */ + virtual void setDecimalPatternMatchRequired(UBool newValue); + + + /** + * Synthesizes a pattern string that represents the current state + * of this Format object. + * + * @param result Output param which will receive the pattern. + * Previous contents are deleted. + * @return A reference to 'result'. + * @see applyPattern + * @stable ICU 2.0 + */ + virtual UnicodeString& toPattern(UnicodeString& result) const; + + /** + * Synthesizes a localized pattern string that represents the current + * state of this Format object. + * + * @param result Output param which will receive the localized pattern. + * Previous contents are deleted. + * @return A reference to 'result'. + * @see applyPattern + * @stable ICU 2.0 + */ + virtual UnicodeString& toLocalizedPattern(UnicodeString& result) const; + + /** + * Apply the given pattern to this Format object. A pattern is a + * short-hand specification for the various formatting properties. + * These properties can also be changed individually through the + * various setter methods. + *

+ * There is no limit to integer digits are set + * by this routine, since that is the typical end-user desire; + * use setMaximumInteger if you want to set a real value. + * For negative numbers, use a second pattern, separated by a semicolon + *

+     * .      Example "#,#00.0#" -> 1,234.56
+     * 
+ * This means a minimum of 2 integer digits, 1 fraction digit, and + * a maximum of 2 fraction digits. + *
+     * .      Example: "#,#00.0#;(#,#00.0#)" for negatives in parantheses.
+     * 
+ * In negative patterns, the minimum and maximum counts are ignored; + * these are presumed to be set in the positive pattern. + * + * @param pattern The pattern to be applied. + * @param parseError Struct to recieve information on position + * of error if an error is encountered + * @param status Output param set to success/failure code on + * exit. If the pattern is invalid, this will be + * set to a failure result. + * @stable ICU 2.0 + */ + virtual void applyPattern(const UnicodeString& pattern, + UParseError& parseError, + UErrorCode& status); + /** + * Sets the pattern. + * @param pattern The pattern to be applied. + * @param status Output param set to success/failure code on + * exit. If the pattern is invalid, this will be + * set to a failure result. + * @stable ICU 2.0 + */ + virtual void applyPattern(const UnicodeString& pattern, + UErrorCode& status); + + /** + * Apply the given pattern to this Format object. The pattern + * is assumed to be in a localized notation. A pattern is a + * short-hand specification for the various formatting properties. + * These properties can also be changed individually through the + * various setter methods. + *

+ * There is no limit to integer digits are set + * by this routine, since that is the typical end-user desire; + * use setMaximumInteger if you want to set a real value. + * For negative numbers, use a second pattern, separated by a semicolon + *

+     * .      Example "#,#00.0#" -> 1,234.56
+     * 
+ * This means a minimum of 2 integer digits, 1 fraction digit, and + * a maximum of 2 fraction digits. + * + * Example: "#,#00.0#;(#,#00.0#)" for negatives in parantheses. + * + * In negative patterns, the minimum and maximum counts are ignored; + * these are presumed to be set in the positive pattern. + * + * @param pattern The localized pattern to be applied. + * @param parseError Struct to recieve information on position + * of error if an error is encountered + * @param status Output param set to success/failure code on + * exit. If the pattern is invalid, this will be + * set to a failure result. + * @stable ICU 2.0 + */ + virtual void applyLocalizedPattern(const UnicodeString& pattern, + UParseError& parseError, + UErrorCode& status); + + /** + * Apply the given pattern to this Format object. + * + * @param pattern The localized pattern to be applied. + * @param status Output param set to success/failure code on + * exit. If the pattern is invalid, this will be + * set to a failure result. + * @stable ICU 2.0 + */ + virtual void applyLocalizedPattern(const UnicodeString& pattern, + UErrorCode& status); + + + /** + * Sets the maximum number of digits allowed in the integer portion of a + * number. This override limits the integer digit count to 309. + * + * @param newValue the new value of the maximum number of digits + * allowed in the integer portion of a number. + * @see NumberFormat#setMaximumIntegerDigits + * @stable ICU 2.0 + */ + virtual void setMaximumIntegerDigits(int32_t newValue); + + /** + * Sets the minimum number of digits allowed in the integer portion of a + * number. This override limits the integer digit count to 309. + * + * @param newValue the new value of the minimum number of digits + * allowed in the integer portion of a number. + * @see NumberFormat#setMinimumIntegerDigits + * @stable ICU 2.0 + */ + virtual void setMinimumIntegerDigits(int32_t newValue); + + /** + * Sets the maximum number of digits allowed in the fraction portion of a + * number. This override limits the fraction digit count to 340. + * + * @param newValue the new value of the maximum number of digits + * allowed in the fraction portion of a number. + * @see NumberFormat#setMaximumFractionDigits + * @stable ICU 2.0 + */ + virtual void setMaximumFractionDigits(int32_t newValue); + + /** + * Sets the minimum number of digits allowed in the fraction portion of a + * number. This override limits the fraction digit count to 340. + * + * @param newValue the new value of the minimum number of digits + * allowed in the fraction portion of a number. + * @see NumberFormat#setMinimumFractionDigits + * @stable ICU 2.0 + */ + virtual void setMinimumFractionDigits(int32_t newValue); + + /** + * Returns the minimum number of significant digits that will be + * displayed. This value has no effect unless areSignificantDigitsUsed() + * returns true. + * @return the fewest significant digits that will be shown + * @stable ICU 3.0 + */ + int32_t getMinimumSignificantDigits() const; + + /** + * Returns the maximum number of significant digits that will be + * displayed. This value has no effect unless areSignificantDigitsUsed() + * returns true. + * @return the most significant digits that will be shown + * @stable ICU 3.0 + */ + int32_t getMaximumSignificantDigits() const; + + /** + * Sets the minimum number of significant digits that will be + * displayed. If min is less than one then it is set + * to one. If the maximum significant digits count is less than + * min, then it is set to min. + * This function also enables the use of significant digits + * by this formatter - areSignificantDigitsUsed() will return TRUE. + * @see #areSignificantDigitsUsed + * @param min the fewest significant digits to be shown + * @stable ICU 3.0 + */ + void setMinimumSignificantDigits(int32_t min); + + /** + * Sets the maximum number of significant digits that will be + * displayed. If max is less than one then it is set + * to one. If the minimum significant digits count is greater + * than max, then it is set to max. + * This function also enables the use of significant digits + * by this formatter - areSignificantDigitsUsed() will return TRUE. + * @see #areSignificantDigitsUsed + * @param max the most significant digits to be shown + * @stable ICU 3.0 + */ + void setMaximumSignificantDigits(int32_t max); + + /** + * Returns true if significant digits are in use, or false if + * integer and fraction digit counts are in use. + * @return true if significant digits are in use + * @stable ICU 3.0 + */ + UBool areSignificantDigitsUsed() const; + + /** + * Sets whether significant digits are in use, or integer and + * fraction digit counts are in use. + * @param useSignificantDigits true to use significant digits, or + * false to use integer and fraction digit counts + * @stable ICU 3.0 + */ + void setSignificantDigitsUsed(UBool useSignificantDigits); + + public: + /** + * Sets the currency used to display currency + * amounts. This takes effect immediately, if this format is a + * currency format. If this format is not a currency format, then + * the currency is used if and when this object becomes a + * currency format through the application of a new pattern. + * @param theCurrency a 3-letter ISO code indicating new currency + * to use. It need not be null-terminated. May be the empty + * string or NULL to indicate no currency. + * @param ec input-output error code + * @stable ICU 3.0 + */ + virtual void setCurrency(const char16_t* theCurrency, UErrorCode& ec); + + /** + * Sets the currency used to display currency amounts. See + * setCurrency(const char16_t*, UErrorCode&). + * @deprecated ICU 3.0. Use setCurrency(const char16_t*, UErrorCode&). + */ + virtual void setCurrency(const char16_t* theCurrency); + + /** + * Sets the Currency Context object used to display currency. + * This takes effect immediately, if this format is a + * currency format. + * @param currencyContext new currency context object to use. + * @stable ICU 54 + */ + void setCurrencyUsage(UCurrencyUsage newUsage, UErrorCode* ec); + + /** + * Returns the Currency Context object used to display currency + * @stable ICU 54 + */ + UCurrencyUsage getCurrencyUsage() const; + + + /** + * The resource tags we use to retrieve decimal format data from + * locale resource bundles. + * @deprecated ICU 3.4. This string has no public purpose. Please don't use it. + */ + static const char fgNumberPatterns[]; + +#ifndef U_HIDE_INTERNAL_API + /** + * Get a FixedDecimal corresponding to a double as it would be + * formatted by this DecimalFormat. + * Internal, not intended for public use. + * @internal + */ + FixedDecimal getFixedDecimal(double number, UErrorCode &status) const; + + /** + * Get a FixedDecimal corresponding to a formattable as it would be + * formatted by this DecimalFormat. + * Internal, not intended for public use. + * @internal + */ + FixedDecimal getFixedDecimal(const Formattable &number, UErrorCode &status) const; + + /** + * Get a FixedDecimal corresponding to a DigitList as it would be + * formatted by this DecimalFormat. Note: the DigitList may be modified. + * Internal, not intended for public use. + * @internal + */ + FixedDecimal getFixedDecimal(DigitList &number, UErrorCode &status) const; + + /** + * Get a VisibleDigitsWithExponent corresponding to a double + * as it would be formatted by this DecimalFormat. + * Internal, not intended for public use. + * @internal + */ + VisibleDigitsWithExponent &initVisibleDigitsWithExponent( + double number, + VisibleDigitsWithExponent &digits, + UErrorCode &status) const; + + /** + * Get a VisibleDigitsWithExponent corresponding to a formattable + * as it would be formatted by this DecimalFormat. + * Internal, not intended for public use. + * @internal + */ + VisibleDigitsWithExponent &initVisibleDigitsWithExponent( + const Formattable &number, + VisibleDigitsWithExponent &digits, + UErrorCode &status) const; + + /** + * Get a VisibleDigitsWithExponent corresponding to a DigitList + * as it would be formatted by this DecimalFormat. + * Note: the DigitList may be modified. + * Internal, not intended for public use. + * @internal + */ + VisibleDigitsWithExponent &initVisibleDigitsWithExponent( + DigitList &number, + VisibleDigitsWithExponent &digits, + UErrorCode &status) const; + +#endif /* U_HIDE_INTERNAL_API */ + +public: + + /** + * Return the class ID for this class. This is useful only for + * comparing to a return value from getDynamicClassID(). For example: + *
+     * .      Base* polymorphic_pointer = createPolymorphicObject();
+     * .      if (polymorphic_pointer->getDynamicClassID() ==
+     * .          Derived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @stable ICU 2.0 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. + * This method is to implement a simple version of RTTI, since not all + * C++ compilers support genuine RTTI. Polymorphic operator==() and + * clone() methods call this method. + * + * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @stable ICU 2.0 + */ + virtual UClassID getDynamicClassID(void) const; + +private: + + DecimalFormat(); // default constructor not implemented + + /** + * Initialize all fields of a new DecimalFormatter to a safe default value. + * Common code for use by constructors. + */ + void init(); + + /** + * Do real work of constructing a new DecimalFormat. + */ + void construct(UErrorCode& status, + UParseError& parseErr, + const UnicodeString* pattern = 0, + DecimalFormatSymbols* symbolsToAdopt = 0 + ); + + void handleCurrencySignInPattern(UErrorCode& status); + + void parse(const UnicodeString& text, + Formattable& result, + ParsePosition& pos, + char16_t* currency) const; + + enum { + fgStatusInfinite, + fgStatusLength // Leave last in list. + } StatusFlags; + + UBool subparse(const UnicodeString& text, + const UnicodeString* negPrefix, + const UnicodeString* negSuffix, + const UnicodeString* posPrefix, + const UnicodeString* posSuffix, + UBool complexCurrencyParsing, + int8_t type, + ParsePosition& parsePosition, + DigitList& digits, UBool* status, + char16_t* currency) const; + + // Mixed style parsing for currency. + // It parses against the current currency pattern + // using complex affix comparison + // parses against the currency plural patterns using complex affix comparison, + // and parses against the current pattern using simple affix comparison. + UBool parseForCurrency(const UnicodeString& text, + ParsePosition& parsePosition, + DigitList& digits, + UBool* status, + char16_t* currency) const; + + int32_t skipPadding(const UnicodeString& text, int32_t position) const; + + int32_t compareAffix(const UnicodeString& input, + int32_t pos, + UBool isNegative, + UBool isPrefix, + const UnicodeString* affixPat, + UBool complexCurrencyParsing, + int8_t type, + char16_t* currency) const; + + static UnicodeString& trimMarksFromAffix(const UnicodeString& affix, UnicodeString& trimmedAffix); + + UBool equalWithSignCompatibility(UChar32 lhs, UChar32 rhs) const; + + int32_t compareSimpleAffix(const UnicodeString& affix, + const UnicodeString& input, + int32_t pos, + UBool lenient) const; + + static int32_t skipPatternWhiteSpace(const UnicodeString& text, int32_t pos); + + static int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos); + + static int32_t skipUWhiteSpaceAndMarks(const UnicodeString& text, int32_t pos); + + static int32_t skipBidiMarks(const UnicodeString& text, int32_t pos); + + int32_t compareComplexAffix(const UnicodeString& affixPat, + const UnicodeString& input, + int32_t pos, + int8_t type, + char16_t* currency) const; + + static int32_t match(const UnicodeString& text, int32_t pos, UChar32 ch); + + static int32_t match(const UnicodeString& text, int32_t pos, const UnicodeString& str); + + static UBool matchSymbol(const UnicodeString &text, int32_t position, int32_t length, const UnicodeString &symbol, + UnicodeSet *sset, UChar32 schar); + + static UBool matchDecimal(UChar32 symbolChar, + UBool sawDecimal, UChar32 sawDecimalChar, + const UnicodeSet *sset, UChar32 schar); + + static UBool matchGrouping(UChar32 groupingChar, + UBool sawGrouping, UChar32 sawGroupingChar, + const UnicodeSet *sset, + UChar32 decimalChar, const UnicodeSet *decimalSet, + UChar32 schar); + + // set up currency affix patterns for mix parsing. + // The patterns saved here are the affix patterns of default currency + // pattern and the unique affix patterns of the plural currency patterns. + // Those patterns are used by parseForCurrency(). + void setupCurrencyAffixPatterns(UErrorCode& status); + + // get the currency rounding with respect to currency usage + double getCurrencyRounding(const char16_t* currency, + UErrorCode* ec) const; + + // get the currency fraction with respect to currency usage + int getCurrencyFractionDigits(const char16_t* currency, + UErrorCode* ec) const; + + // hashtable operations + Hashtable* initHashForAffixPattern(UErrorCode& status); + + void deleteHashForAffixPattern(); + + void copyHashForAffixPattern(const Hashtable* source, + Hashtable* target, UErrorCode& status); + + DecimalFormatImpl *fImpl; + + /** + * Constants. + */ + + + EnumSet + fBoolFlags; + + + // style is only valid when decimal formatter is constructed by + // DecimalFormat(pattern, decimalFormatSymbol, style) + int fStyle; + + + // Affix pattern set for currency. + // It is a set of AffixPatternsForCurrency, + // each element of the set saves the negative prefix pattern, + // negative suffix pattern, positive prefix pattern, + // and positive suffix pattern of a pattern. + // It is used for currency mixed style parsing. + // It is actually is a set. + // The set contains the default currency pattern from the locale, + // and the currency plural patterns. + // Since it is a set, it does not contain duplicated items. + // For example, if 2 currency plural patterns are the same, only one pattern + // is included in the set. When parsing, we do not check whether the plural + // count match or not. + Hashtable* fAffixPatternsForCurrency; + + // Information needed for DecimalFormat to format/parse currency plural. + CurrencyPluralInfo* fCurrencyPluralInfo; + +#if UCONFIG_HAVE_PARSEALLINPUT + UNumberFormatAttributeValue fParseAllInput; +#endif + + // Decimal Format Static Sets singleton. + const DecimalFormatStaticSets *fStaticSets; + +protected: + +#ifndef U_HIDE_INTERNAL_API + /** + * Rounds a value according to the rules of this object. + * @internal + */ + DigitList& _round(const DigitList& number, DigitList& adjustedNum, UBool& isNegative, UErrorCode& status) const; +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Returns the currency in effect for this formatter. Subclasses + * should override this method as needed. Unlike getCurrency(), + * this method should never return "". + * @result output parameter for null-terminated result, which must + * have a capacity of at least 4 + * @internal + */ + virtual void getEffectiveCurrency(char16_t* result, UErrorCode& ec) const; + + /** number of integer digits + * @stable ICU 2.4 + */ + static const int32_t kDoubleIntegerDigits; + /** number of fraction digits + * @stable ICU 2.4 + */ + static const int32_t kDoubleFractionDigits; + + /** + * When someone turns on scientific mode, we assume that more than this + * number of digits is due to flipping from some other mode that didn't + * restrict the maximum, and so we force 1 integer digit. We don't bother + * to track and see if someone is using exponential notation with more than + * this number, it wouldn't make sense anyway, and this is just to make sure + * that someone turning on scientific mode with default settings doesn't + * end up with lots of zeroes. + * @stable ICU 2.8 + */ + static const int32_t kMaxScientificIntegerDigits; + +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // _DECIMFMT +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/docmain.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/docmain.h new file mode 100644 index 0000000..636931c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/docmain.h @@ -0,0 +1,222 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/******************************************************************** + * COPYRIGHT: + * Copyright (c) 1997-2012, International Business Machines Corporation and + * others. All Rights Reserved. + * + * FILE NAME: DOCMAIN.h + * + * Date Name Description + * 12/11/2000 Ram Creation. + */ + +/** + * \file + * \brief (Non API- contains Doxygen definitions) + * + * This file contains documentation for Doxygen and doesnot have + * any significance with respect to C or C++ API + */ + +/*! \mainpage + * + * \section API API Reference Usage + * + *

C++ Programmers:

+ *

Use Class Hierarchy or Alphabetical List + * or Compound List + * to find the class you are interested in. For example, to find BreakIterator, + * you can go to the Alphabetical List, then click on + * "BreakIterator". Once you are at the class, you will find an inheritance + * chart, a list of the public members, a detailed description of the class, + * then detailed member descriptions.

+ * + *

C Programmers:

+ *

Use Module List or File Members + * to find a list of all the functions and constants. + * For example, to find BreakIterator functions you would click on + * File List, + * then find "ubrk.h" and click on it. You will find descriptions of Defines, + * Typedefs, Enumerations, and Functions, with detailed descriptions below. + * If you want to find a specific function, such as ubrk_next(), then click + * first on File Members, then use your browser + * Find dialog to search for "ubrk_next()".

+ * + * + *

API References for Previous Releases

+ *

The API References for each release of ICU are also available as + * a zip file from the ICU + * download page.

+ * + *
+ * + *

Architecture (User's Guide)

+ * + * + *
+ *\htmlonly

Module List

\endhtmlonly + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Module NameCC++
Basic Types and Constantsutypes.hutypes.h
Strings and Character Iterationustring.h, utf8.h, utf16.h, UText, UCharIteratoricu::UnicodeString, icu::CharacterIterator, icu::Appendable, icu::StringPiece,icu::ByteSink
Unicode Character
Properties and Names
uchar.h, uscript.hC API
Sets of Unicode Code Points and Stringsuset.hicu::UnicodeSet
Maps from Strings to Integer Values(no C API)icu::BytesTrie, icu::UCharsTrie
Codepage Conversionucnv.h, ucnvsel.hbC API
Codepage Detectionucsdet.hC API
Unicode Text Compressionucnv.h
(encoding name "SCSU" or "BOCU-1")
C API
Locales uloc.hicu::Locale
Resource Bundlesures.hicu::ResourceBundle
Normalizationunorm2.hicu::Normalizer2
Calendarsucal.hicu::Calendar
Date and Time Formattingudat.hicu::DateFormat
Message Formattingumsg.hicu::MessageFormat
Number Formattingunum.hicu::number::NumberFormatter (ICU 60+) or icu::NumberFormat (older versions)
Number Spellout
(Rule Based Number Formatting)
unum.h
(use UNUM_SPELLOUT)
icu::RuleBasedNumberFormat
Text Transformation
(Transliteration)
utrans.hicu::Transliterator
Bidirectional Algorithmubidi.h, ubiditransform.hC API
Arabic Shapingushape.hC API
Collationucol.hicu::Collator
String Searchingusearch.hicu::StringSearch
Index Characters/
Bucketing for Sorted Lists
(no C API)icu::AlphabeticIndex
Text Boundary Analysis
(Break Iteration)
ubrk.hicu::BreakIterator
Regular Expressionsuregex.hicu::RegexPattern, icu::RegexMatcher
StringPrepusprep.hC API
International Domain Names in Applications:
+ * UTS #46 in C/C++, IDNA2003 only via C API
uidna.hidna.h
Identifier Spoofing & Confusabilityuspoof.hC API
Universal Time Scaleutmscale.hC API
Layout Engine/Complex Text Layoutloengine.hicu::LayoutEngine,icu::ParagraphLayout
ICU I/Oustdio.hustream.h
+ * This main page is generated from docmain.h + */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/dtfmtsym.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/dtfmtsym.h new file mode 100644 index 0000000..fe914b4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/dtfmtsym.h @@ -0,0 +1,1015 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************** +* Copyright (C) 1997-2016, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************** +* +* File DTFMTSYM.H +* +* Modification History: +* +* Date Name Description +* 02/19/97 aliu Converted from java. +* 07/21/98 stephen Added getZoneIndex() +* Changed to match C++ conventions +******************************************************************************** +*/ + +#ifndef DTFMTSYM_H +#define DTFMTSYM_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/calendar.h" +#include "unicode/strenum.h" +#include "unicode/uobject.h" +#include "unicode/locid.h" +#include "unicode/udat.h" +#include "unicode/ures.h" + +/** + * \file + * \brief C++ API: Symbols for formatting dates. + */ + +U_NAMESPACE_BEGIN + +/* forward declaration */ +class SimpleDateFormat; +class Hashtable; + +/** + * DateFormatSymbols is a public class for encapsulating localizable date-time + * formatting data -- including timezone data. DateFormatSymbols is used by + * DateFormat and SimpleDateFormat. + *

+ * Rather than first creating a DateFormatSymbols to get a date-time formatter + * by using a SimpleDateFormat constructor, clients are encouraged to create a + * date-time formatter using the getTimeInstance(), getDateInstance(), or + * getDateTimeInstance() method in DateFormat. Each of these methods can return a + * date/time formatter initialized with a default format pattern along with the + * date-time formatting data for a given or default locale. After a formatter is + * created, clients may modify the format pattern using the setPattern function + * as so desired. For more information on using these formatter factory + * functions, see DateFormat. + *

+ * If clients decide to create a date-time formatter with a particular format + * pattern and locale, they can do so with new SimpleDateFormat(aPattern, + * new DateFormatSymbols(aLocale)). This will load the appropriate date-time + * formatting data from the locale. + *

+ * DateFormatSymbols objects are clonable. When clients obtain a + * DateFormatSymbols object, they can feel free to modify the date-time + * formatting data as necessary. For instance, clients can + * replace the localized date-time format pattern characters with the ones that + * they feel easy to remember. Or they can change the representative cities + * originally picked by default to using their favorite ones. + *

+ * DateFormatSymbols are not expected to be subclassed. Data for a calendar is + * loaded out of resource bundles. The 'type' parameter indicates the type of + * calendar, for example, "gregorian" or "japanese". If the type is not gregorian + * (or NULL, or an empty string) then the type is appended to the resource name, + * for example, 'Eras_japanese' instead of 'Eras'. If the resource 'Eras_japanese' did + * not exist (even in root), then this class will fall back to just 'Eras', that is, + * Gregorian data. Therefore, the calendar implementor MUST ensure that the root + * locale at least contains any resources that are to be particularized for the + * calendar type. + */ +class U_I18N_API DateFormatSymbols U_FINAL : public UObject { +public: + /** + * Construct a DateFormatSymbols object by loading format data from + * resources for the default locale, in the default calendar (Gregorian). + *

+ * NOTE: This constructor will never fail; if it cannot get resource + * data for the default locale, it will return a last-resort object + * based on hard-coded strings. + * + * @param status Status code. Failure + * results if the resources for the default cannot be + * found or cannot be loaded + * @stable ICU 2.0 + */ + DateFormatSymbols(UErrorCode& status); + + /** + * Construct a DateFormatSymbols object by loading format data from + * resources for the given locale, in the default calendar (Gregorian). + * + * @param locale Locale to load format data from. + * @param status Status code. Failure + * results if the resources for the locale cannot be + * found or cannot be loaded + * @stable ICU 2.0 + */ + DateFormatSymbols(const Locale& locale, + UErrorCode& status); + +#ifndef U_HIDE_INTERNAL_API + /** + * Construct a DateFormatSymbols object by loading format data from + * resources for the default locale, in the default calendar (Gregorian). + *

+ * NOTE: This constructor will never fail; if it cannot get resource + * data for the default locale, it will return a last-resort object + * based on hard-coded strings. + * + * @param type Type of calendar (as returned by Calendar::getType). + * Will be used to access the correct set of strings. + * (NULL or empty string defaults to "gregorian".) + * @param status Status code. Failure + * results if the resources for the default cannot be + * found or cannot be loaded + * @internal + */ + DateFormatSymbols(const char *type, UErrorCode& status); + + /** + * Construct a DateFormatSymbols object by loading format data from + * resources for the given locale, in the default calendar (Gregorian). + * + * @param locale Locale to load format data from. + * @param type Type of calendar (as returned by Calendar::getType). + * Will be used to access the correct set of strings. + * (NULL or empty string defaults to "gregorian".) + * @param status Status code. Failure + * results if the resources for the locale cannot be + * found or cannot be loaded + * @internal + */ + DateFormatSymbols(const Locale& locale, + const char *type, + UErrorCode& status); +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Copy constructor. + * @stable ICU 2.0 + */ + DateFormatSymbols(const DateFormatSymbols&); + + /** + * Assignment operator. + * @stable ICU 2.0 + */ + DateFormatSymbols& operator=(const DateFormatSymbols&); + + /** + * Destructor. This is nonvirtual because this class is not designed to be + * subclassed. + * @stable ICU 2.0 + */ + virtual ~DateFormatSymbols(); + + /** + * Return true if another object is semantically equal to this one. + * + * @param other the DateFormatSymbols object to be compared with. + * @return true if other is semantically equal to this. + * @stable ICU 2.0 + */ + UBool operator==(const DateFormatSymbols& other) const; + + /** + * Return true if another object is semantically unequal to this one. + * + * @param other the DateFormatSymbols object to be compared with. + * @return true if other is semantically unequal to this. + * @stable ICU 2.0 + */ + UBool operator!=(const DateFormatSymbols& other) const { return !operator==(other); } + + /** + * Gets abbreviated era strings. For example: "AD" and "BC". + * + * @param count Filled in with length of the array. + * @return the era strings. + * @stable ICU 2.0 + */ + const UnicodeString* getEras(int32_t& count) const; + + /** + * Sets abbreviated era strings. For example: "AD" and "BC". + * @param eras Array of era strings (DateFormatSymbols retains ownership.) + * @param count Filled in with length of the array. + * @stable ICU 2.0 + */ + void setEras(const UnicodeString* eras, int32_t count); + + /** + * Gets era name strings. For example: "Anno Domini" and "Before Christ". + * + * @param count Filled in with length of the array. + * @return the era name strings. + * @stable ICU 3.4 + */ + const UnicodeString* getEraNames(int32_t& count) const; + + /** + * Sets era name strings. For example: "Anno Domini" and "Before Christ". + * @param eraNames Array of era name strings (DateFormatSymbols retains ownership.) + * @param count Filled in with length of the array. + * @stable ICU 3.6 + */ + void setEraNames(const UnicodeString* eraNames, int32_t count); + + /** + * Gets narrow era strings. For example: "A" and "B". + * + * @param count Filled in with length of the array. + * @return the narrow era strings. + * @stable ICU 4.2 + */ + const UnicodeString* getNarrowEras(int32_t& count) const; + + /** + * Sets narrow era strings. For example: "A" and "B". + * @param narrowEras Array of narrow era strings (DateFormatSymbols retains ownership.) + * @param count Filled in with length of the array. + * @stable ICU 4.2 + */ + void setNarrowEras(const UnicodeString* narrowEras, int32_t count); + + /** + * Gets month strings. For example: "January", "February", etc. + * @param count Filled in with length of the array. + * @return the month strings. (DateFormatSymbols retains ownership.) + * @stable ICU 2.0 + */ + const UnicodeString* getMonths(int32_t& count) const; + + /** + * Sets month strings. For example: "January", "February", etc. + * + * @param months the new month strings. (not adopted; caller retains ownership) + * @param count Filled in with length of the array. + * @stable ICU 2.0 + */ + void setMonths(const UnicodeString* months, int32_t count); + + /** + * Gets short month strings. For example: "Jan", "Feb", etc. + * + * @param count Filled in with length of the array. + * @return the short month strings. (DateFormatSymbols retains ownership.) + * @stable ICU 2.0 + */ + const UnicodeString* getShortMonths(int32_t& count) const; + + /** + * Sets short month strings. For example: "Jan", "Feb", etc. + * @param count Filled in with length of the array. + * @param shortMonths the new short month strings. (not adopted; caller retains ownership) + * @stable ICU 2.0 + */ + void setShortMonths(const UnicodeString* shortMonths, int32_t count); + + /** + * Selector for date formatting context + * @stable ICU 3.6 + */ + enum DtContextType { + FORMAT, + STANDALONE, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal DtContextType value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + DT_CONTEXT_COUNT +#endif // U_HIDE_DEPRECATED_API + }; + + /** + * Selector for date formatting width + * @stable ICU 3.6 + */ + enum DtWidthType { + ABBREVIATED, + WIDE, + NARROW, + /** + * Short width is currently only supported for weekday names. + * @stable ICU 51 + */ + SHORT, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal DtWidthType value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + DT_WIDTH_COUNT = 4 +#endif // U_HIDE_DEPRECATED_API + }; + + /** + * Gets month strings by width and context. For example: "January", "February", etc. + * @param count Filled in with length of the array. + * @param context The formatting context, either FORMAT or STANDALONE + * @param width The width of returned strings, either WIDE, ABBREVIATED, or NARROW. + * @return the month strings. (DateFormatSymbols retains ownership.) + * @stable ICU 3.4 + */ + const UnicodeString* getMonths(int32_t& count, DtContextType context, DtWidthType width) const; + + /** + * Sets month strings by width and context. For example: "January", "February", etc. + * + * @param months The new month strings. (not adopted; caller retains ownership) + * @param count Filled in with length of the array. + * @param context The formatting context, either FORMAT or STANDALONE + * @param width The width of returned strings, either WIDE, ABBREVIATED, or NARROW. + * @stable ICU 3.6 + */ + void setMonths(const UnicodeString* months, int32_t count, DtContextType context, DtWidthType width); + + /** + * Gets wide weekday strings. For example: "Sunday", "Monday", etc. + * @param count Filled in with length of the array. + * @return the weekday strings. (DateFormatSymbols retains ownership.) + * @stable ICU 2.0 + */ + const UnicodeString* getWeekdays(int32_t& count) const; + + + /** + * Sets wide weekday strings. For example: "Sunday", "Monday", etc. + * @param weekdays the new weekday strings. (not adopted; caller retains ownership) + * @param count Filled in with length of the array. + * @stable ICU 2.0 + */ + void setWeekdays(const UnicodeString* weekdays, int32_t count); + + /** + * Gets abbreviated weekday strings. For example: "Sun", "Mon", etc. (Note: The method name is + * misleading; it does not get the CLDR-style "short" weekday strings, e.g. "Su", "Mo", etc.) + * @param count Filled in with length of the array. + * @return the abbreviated weekday strings. (DateFormatSymbols retains ownership.) + * @stable ICU 2.0 + */ + const UnicodeString* getShortWeekdays(int32_t& count) const; + + /** + * Sets abbreviated weekday strings. For example: "Sun", "Mon", etc. (Note: The method name is + * misleading; it does not set the CLDR-style "short" weekday strings, e.g. "Su", "Mo", etc.) + * @param abbrevWeekdays the new abbreviated weekday strings. (not adopted; caller retains ownership) + * @param count Filled in with length of the array. + * @stable ICU 2.0 + */ + void setShortWeekdays(const UnicodeString* abbrevWeekdays, int32_t count); + + /** + * Gets weekday strings by width and context. For example: "Sunday", "Monday", etc. + * @param count Filled in with length of the array. + * @param context The formatting context, either FORMAT or STANDALONE + * @param width The width of returned strings, either WIDE, ABBREVIATED, SHORT, or NARROW + * @return the month strings. (DateFormatSymbols retains ownership.) + * @stable ICU 3.4 + */ + const UnicodeString* getWeekdays(int32_t& count, DtContextType context, DtWidthType width) const; + + /** + * Sets weekday strings by width and context. For example: "Sunday", "Monday", etc. + * @param weekdays The new weekday strings. (not adopted; caller retains ownership) + * @param count Filled in with length of the array. + * @param context The formatting context, either FORMAT or STANDALONE + * @param width The width of returned strings, either WIDE, ABBREVIATED, SHORT, or NARROW + * @stable ICU 3.6 + */ + void setWeekdays(const UnicodeString* weekdays, int32_t count, DtContextType context, DtWidthType width); + + /** + * Gets quarter strings by width and context. For example: "1st Quarter", "2nd Quarter", etc. + * @param count Filled in with length of the array. + * @param context The formatting context, either FORMAT or STANDALONE + * @param width The width of returned strings, either WIDE or ABBREVIATED. There + * are no NARROW quarters. + * @return the quarter strings. (DateFormatSymbols retains ownership.) + * @stable ICU 3.6 + */ + const UnicodeString* getQuarters(int32_t& count, DtContextType context, DtWidthType width) const; + + /** + * Sets quarter strings by width and context. For example: "1st Quarter", "2nd Quarter", etc. + * + * @param quarters The new quarter strings. (not adopted; caller retains ownership) + * @param count Filled in with length of the array. + * @param context The formatting context, either FORMAT or STANDALONE + * @param width The width of returned strings, either WIDE or ABBREVIATED. There + * are no NARROW quarters. + * @stable ICU 3.6 + */ + void setQuarters(const UnicodeString* quarters, int32_t count, DtContextType context, DtWidthType width); + + /** + * Gets AM/PM strings. For example: "AM" and "PM". + * @param count Filled in with length of the array. + * @return the weekday strings. (DateFormatSymbols retains ownership.) + * @stable ICU 2.0 + */ + const UnicodeString* getAmPmStrings(int32_t& count) const; + + /** + * Sets ampm strings. For example: "AM" and "PM". + * @param ampms the new ampm strings. (not adopted; caller retains ownership) + * @param count Filled in with length of the array. + * @stable ICU 2.0 + */ + void setAmPmStrings(const UnicodeString* ampms, int32_t count); + +#ifndef U_HIDE_INTERNAL_API + /** + * This default time separator is used for formatting when the locale + * doesn't specify any time separator, and always recognized when parsing. + * @internal + */ + static const char16_t DEFAULT_TIME_SEPARATOR = 0x003a; // ':' + + /** + * This alternate time separator is always recognized when parsing. + * @internal + */ + static const char16_t ALTERNATE_TIME_SEPARATOR = 0x002e; // '.' + + /** + * Gets the time separator string. For example: ":". + * @param result Output param which will receive the time separator string. + * @return A reference to 'result'. + * @internal + */ + UnicodeString& getTimeSeparatorString(UnicodeString& result) const; + + /** + * Sets the time separator string. For example: ":". + * @param newTimeSeparator the new time separator string. + * @internal + */ + void setTimeSeparatorString(const UnicodeString& newTimeSeparator); +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Gets cyclic year name strings if the calendar has them, by width and context. + * For example: "jia-zi", "yi-chou", etc. + * @param count Filled in with length of the array. + * @param context The usage context: FORMAT, STANDALONE. + * @param width The requested name width: WIDE, ABBREVIATED, NARROW. + * @return The year name strings (DateFormatSymbols retains ownership), + * or null if they are not available for this calendar. + * @stable ICU 54 + */ + const UnicodeString* getYearNames(int32_t& count, + DtContextType context, DtWidthType width) const; + + /** + * Sets cyclic year name strings by width and context. For example: "jia-zi", "yi-chou", etc. + * + * @param yearNames The new cyclic year name strings (not adopted; caller retains ownership). + * @param count The length of the array. + * @param context The usage context: FORMAT, STANDALONE (currently only FORMAT is supported). + * @param width The name width: WIDE, ABBREVIATED, NARROW (currently only ABBREVIATED is supported). + * @stable ICU 54 + */ + void setYearNames(const UnicodeString* yearNames, int32_t count, + DtContextType context, DtWidthType width); + + /** + * Gets calendar zodiac name strings if the calendar has them, by width and context. + * For example: "Rat", "Ox", "Tiger", etc. + * @param count Filled in with length of the array. + * @param context The usage context: FORMAT, STANDALONE. + * @param width The requested name width: WIDE, ABBREVIATED, NARROW. + * @return The zodiac name strings (DateFormatSymbols retains ownership), + * or null if they are not available for this calendar. + * @stable ICU 54 + */ + const UnicodeString* getZodiacNames(int32_t& count, + DtContextType context, DtWidthType width) const; + + /** + * Sets calendar zodiac name strings by width and context. For example: "Rat", "Ox", "Tiger", etc. + * + * @param zodiacNames The new zodiac name strings (not adopted; caller retains ownership). + * @param count The length of the array. + * @param context The usage context: FORMAT, STANDALONE (currently only FORMAT is supported). + * @param width The name width: WIDE, ABBREVIATED, NARROW (currently only ABBREVIATED is supported). + * @stable ICU 54 + */ + void setZodiacNames(const UnicodeString* zodiacNames, int32_t count, + DtContextType context, DtWidthType width); + +#ifndef U_HIDE_INTERNAL_API + /** + * Somewhat temporary constants for leap month pattern types, adequate for supporting + * just leap month patterns as needed for Chinese lunar calendar. + * Eventually we will add full support for different month pattern types (needed for + * other calendars such as Hindu) at which point this approach will be replaced by a + * more complete approach. + * @internal + */ + enum EMonthPatternType + { + kLeapMonthPatternFormatWide, + kLeapMonthPatternFormatAbbrev, + kLeapMonthPatternFormatNarrow, + kLeapMonthPatternStandaloneWide, + kLeapMonthPatternStandaloneAbbrev, + kLeapMonthPatternStandaloneNarrow, + kLeapMonthPatternNumeric, + kMonthPatternsCount + }; + + /** + * Somewhat temporary function for getting complete set of leap month patterns for all + * contexts & widths, indexed by EMonthPatternType values. Returns NULL if calendar + * does not have leap month patterns. Note, there is currently no setter for this. + * Eventually we will add full support for different month pattern types (needed for + * other calendars such as Hindu) at which point this approach will be replaced by a + * more complete approach. + * @param count Filled in with length of the array (may be 0). + * @return The leap month patterns (DateFormatSymbols retains ownership). + * May be NULL if there are no leap month patterns for this calendar. + * @internal + */ + const UnicodeString* getLeapMonthPatterns(int32_t& count) const; + +#endif /* U_HIDE_INTERNAL_API */ + +#ifndef U_HIDE_DEPRECATED_API + /** + * Gets timezone strings. These strings are stored in a 2-dimensional array. + * @param rowCount Output param to receive number of rows. + * @param columnCount Output param to receive number of columns. + * @return The timezone strings as a 2-d array. (DateFormatSymbols retains ownership.) + * @deprecated ICU 3.6 + */ + const UnicodeString** getZoneStrings(int32_t& rowCount, int32_t& columnCount) const; +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Sets timezone strings. These strings are stored in a 2-dimensional array. + *

Note: SimpleDateFormat no longer use the zone strings stored in + * a DateFormatSymbols. Therefore, the time zone strings set by this mthod + * have no effects in an instance of SimpleDateFormat for formatting time + * zones. + * @param strings The timezone strings as a 2-d array to be copied. (not adopted; caller retains ownership) + * @param rowCount The number of rows (count of first index). + * @param columnCount The number of columns (count of second index). + * @stable ICU 2.0 + */ + void setZoneStrings(const UnicodeString* const* strings, int32_t rowCount, int32_t columnCount); + + /** + * Get the non-localized date-time pattern characters. + * @return the non-localized date-time pattern characters + * @stable ICU 2.0 + */ + static const char16_t * U_EXPORT2 getPatternUChars(void); + + /** + * Gets localized date-time pattern characters. For example: 'u', 't', etc. + *

+ * Note: ICU no longer provides localized date-time pattern characters for a locale + * starting ICU 3.8. This method returns the non-localized date-time pattern + * characters unless user defined localized data is set by setLocalPatternChars. + * @param result Output param which will receive the localized date-time pattern characters. + * @return A reference to 'result'. + * @stable ICU 2.0 + */ + UnicodeString& getLocalPatternChars(UnicodeString& result) const; + + /** + * Sets localized date-time pattern characters. For example: 'u', 't', etc. + * @param newLocalPatternChars the new localized date-time + * pattern characters. + * @stable ICU 2.0 + */ + void setLocalPatternChars(const UnicodeString& newLocalPatternChars); + + /** + * Returns the locale for this object. Two flavors are available: + * valid and actual locale. + * @stable ICU 2.8 + */ + Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const; + + /* The following type and kCapContextUsageTypeCount cannot be #ifndef U_HIDE_INTERNAL_API, + they are needed for .h file declarations. */ + /** + * Constants for capitalization context usage types. + * @internal + */ + enum ECapitalizationContextUsageType + { +#ifndef U_HIDE_INTERNAL_API + kCapContextUsageOther = 0, + kCapContextUsageMonthFormat, /* except narrow */ + kCapContextUsageMonthStandalone, /* except narrow */ + kCapContextUsageMonthNarrow, + kCapContextUsageDayFormat, /* except narrow */ + kCapContextUsageDayStandalone, /* except narrow */ + kCapContextUsageDayNarrow, + kCapContextUsageEraWide, + kCapContextUsageEraAbbrev, + kCapContextUsageEraNarrow, + kCapContextUsageZoneLong, + kCapContextUsageZoneShort, + kCapContextUsageMetazoneLong, + kCapContextUsageMetazoneShort, +#endif /* U_HIDE_INTERNAL_API */ + kCapContextUsageTypeCount = 14 + }; + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.2 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.2 + */ + static UClassID U_EXPORT2 getStaticClassID(); + +private: + + friend class SimpleDateFormat; + friend class DateFormatSymbolsSingleSetter; // see udat.cpp + + /** + * Abbreviated era strings. For example: "AD" and "BC". + */ + UnicodeString* fEras; + int32_t fErasCount; + + /** + * Era name strings. For example: "Anno Domini" and "Before Christ". + */ + UnicodeString* fEraNames; + int32_t fEraNamesCount; + + /** + * Narrow era strings. For example: "A" and "B". + */ + UnicodeString* fNarrowEras; + int32_t fNarrowErasCount; + + /** + * Month strings. For example: "January", "February", etc. + */ + UnicodeString* fMonths; + int32_t fMonthsCount; + + /** + * Short month strings. For example: "Jan", "Feb", etc. + */ + UnicodeString* fShortMonths; + int32_t fShortMonthsCount; + + /** + * Narrow month strings. For example: "J", "F", etc. + */ + UnicodeString* fNarrowMonths; + int32_t fNarrowMonthsCount; + + /** + * Standalone Month strings. For example: "January", "February", etc. + */ + UnicodeString* fStandaloneMonths; + int32_t fStandaloneMonthsCount; + + /** + * Standalone Short month strings. For example: "Jan", "Feb", etc. + */ + UnicodeString* fStandaloneShortMonths; + int32_t fStandaloneShortMonthsCount; + + /** + * Standalone Narrow month strings. For example: "J", "F", etc. + */ + UnicodeString* fStandaloneNarrowMonths; + int32_t fStandaloneNarrowMonthsCount; + + /** + * CLDR-style format wide weekday strings. For example: "Sunday", "Monday", etc. + */ + UnicodeString* fWeekdays; + int32_t fWeekdaysCount; + + /** + * CLDR-style format abbreviated (not short) weekday strings. For example: "Sun", "Mon", etc. + */ + UnicodeString* fShortWeekdays; + int32_t fShortWeekdaysCount; + + /** + * CLDR-style format short weekday strings. For example: "Su", "Mo", etc. + */ + UnicodeString* fShorterWeekdays; + int32_t fShorterWeekdaysCount; + + /** + * CLDR-style format narrow weekday strings. For example: "S", "M", etc. + */ + UnicodeString* fNarrowWeekdays; + int32_t fNarrowWeekdaysCount; + + /** + * CLDR-style standalone wide weekday strings. For example: "Sunday", "Monday", etc. + */ + UnicodeString* fStandaloneWeekdays; + int32_t fStandaloneWeekdaysCount; + + /** + * CLDR-style standalone abbreviated (not short) weekday strings. For example: "Sun", "Mon", etc. + */ + UnicodeString* fStandaloneShortWeekdays; + int32_t fStandaloneShortWeekdaysCount; + + /** + * CLDR-style standalone short weekday strings. For example: "Su", "Mo", etc. + */ + UnicodeString* fStandaloneShorterWeekdays; + int32_t fStandaloneShorterWeekdaysCount; + + /** + * Standalone Narrow weekday strings. For example: "Sun", "Mon", etc. + */ + UnicodeString* fStandaloneNarrowWeekdays; + int32_t fStandaloneNarrowWeekdaysCount; + + /** + * Ampm strings. For example: "AM" and "PM". + */ + UnicodeString* fAmPms; + int32_t fAmPmsCount; + + /** + * Narrow Ampm strings. For example: "a" and "p". + */ + UnicodeString* fNarrowAmPms; + int32_t fNarrowAmPmsCount; + + /** + * Time separator string. For example: ":". + */ + UnicodeString fTimeSeparator; + + /** + * Quarter strings. For example: "1st quarter", "2nd quarter", etc. + */ + UnicodeString *fQuarters; + int32_t fQuartersCount; + + /** + * Short quarters. For example: "Q1", "Q2", etc. + */ + UnicodeString *fShortQuarters; + int32_t fShortQuartersCount; + + /** + * Standalone quarter strings. For example: "1st quarter", "2nd quarter", etc. + */ + UnicodeString *fStandaloneQuarters; + int32_t fStandaloneQuartersCount; + + /** + * Standalone short quarter strings. For example: "Q1", "Q2", etc. + */ + UnicodeString *fStandaloneShortQuarters; + int32_t fStandaloneShortQuartersCount; + + /** + * All leap month patterns, for example "{0}bis". + */ + UnicodeString *fLeapMonthPatterns; + int32_t fLeapMonthPatternsCount; + + /** + * Cyclic year names, for example: "jia-zi", "yi-chou", ... "gui-hai"; + * currently we only have data for format/abbreviated. + * For the others, just get from format/abbreviated, ignore set. + */ + UnicodeString *fShortYearNames; + int32_t fShortYearNamesCount; + + /** + * Cyclic zodiac names, for example "Rat", "Ox", "Tiger", etc.; + * currently we only have data for format/abbreviated. + * For the others, just get from format/abbreviated, ignore set. + */ + UnicodeString *fShortZodiacNames; + int32_t fShortZodiacNamesCount; + + /** + * Localized names of time zones in this locale. This is a + * two-dimensional array of strings of size n by m, + * where m is at least 5 and up to 7. Each of the n rows is an + * entry containing the localized names for a single TimeZone. + * + * Each such row contains (with i ranging from 0..n-1): + * + * zoneStrings[i][0] - time zone ID + * example: America/Los_Angeles + * zoneStrings[i][1] - long name of zone in standard time + * example: Pacific Standard Time + * zoneStrings[i][2] - short name of zone in standard time + * example: PST + * zoneStrings[i][3] - long name of zone in daylight savings time + * example: Pacific Daylight Time + * zoneStrings[i][4] - short name of zone in daylight savings time + * example: PDT + * zoneStrings[i][5] - location name of zone + * example: United States (Los Angeles) + * zoneStrings[i][6] - long generic name of zone + * example: Pacific Time + * zoneStrings[i][7] - short generic of zone + * example: PT + * + * The zone ID is not localized; it corresponds to the ID + * value associated with a system time zone object. All other entries + * are localized names. If a zone does not implement daylight savings + * time, the daylight savings time names are ignored. + * + * Note:CLDR 1.5 introduced metazone and its historical mappings. + * This simple two-dimensional array is no longer sufficient to represent + * localized names and its historic changes. Since ICU 3.8.1, localized + * zone names extracted from ICU locale data is stored in a ZoneStringFormat + * instance. But we still need to support the old way of customizing + * localized zone names, so we keep this field for the purpose. + */ + UnicodeString **fZoneStrings; // Zone string array set by setZoneStrings + UnicodeString **fLocaleZoneStrings; // Zone string array created by the locale + int32_t fZoneStringsRowCount; + int32_t fZoneStringsColCount; + + Locale fZSFLocale; // Locale used for getting ZoneStringFormat + + /** + * Localized date-time pattern characters. For example: use 'u' as 'y'. + */ + UnicodeString fLocalPatternChars; + + /** + * Capitalization transforms. For each usage type, the first array element indicates + * whether to titlecase for uiListOrMenu context, the second indicates whether to + * titlecase for stand-alone context. + */ + UBool fCapitalization[kCapContextUsageTypeCount][2]; + + /** + * Abbreviated (== short) day period strings. + */ + UnicodeString *fAbbreviatedDayPeriods; + int32_t fAbbreviatedDayPeriodsCount; + + /** + * Wide day period strings. + */ + UnicodeString *fWideDayPeriods; + int32_t fWideDayPeriodsCount; + + /** + * Narrow day period strings. + */ + UnicodeString *fNarrowDayPeriods; + int32_t fNarrowDayPeriodsCount; + + /** + * Stand-alone abbreviated (== short) day period strings. + */ + UnicodeString *fStandaloneAbbreviatedDayPeriods; + int32_t fStandaloneAbbreviatedDayPeriodsCount; + + /** + * Stand-alone wide day period strings. + */ + UnicodeString *fStandaloneWideDayPeriods; + int32_t fStandaloneWideDayPeriodsCount; + + /** + * Stand-alone narrow day period strings. + */ + UnicodeString *fStandaloneNarrowDayPeriods; + int32_t fStandaloneNarrowDayPeriodsCount; + +private: + /** valid/actual locale information + * these are always ICU locales, so the length should not be a problem + */ + char validLocale[ULOC_FULLNAME_CAPACITY]; + char actualLocale[ULOC_FULLNAME_CAPACITY]; + + DateFormatSymbols(); // default constructor not implemented + + /** + * Called by the constructors to actually load data from the resources + * + * @param locale The locale to get symbols for. + * @param type Calendar Type (as from Calendar::getType()) + * @param status Input/output parameter, set to success or + * failure code upon return. + * @param useLastResortData determine if use last resort data + */ + void initializeData(const Locale& locale, const char *type, UErrorCode& status, UBool useLastResortData = FALSE); + + /** + * Copy or alias an array in another object, as appropriate. + * + * @param dstArray the copy destination array. + * @param dstCount fill in with the lenth of 'dstArray'. + * @param srcArray the source array to be copied. + * @param srcCount the length of items to be copied from the 'srcArray'. + */ + static void assignArray(UnicodeString*& dstArray, + int32_t& dstCount, + const UnicodeString* srcArray, + int32_t srcCount); + + /** + * Return true if the given arrays' contents are equal, or if the arrays are + * identical (pointers are equal). + * + * @param array1 one array to be compared with. + * @param array2 another array to be compared with. + * @param count the length of items to be copied. + * @return true if the given arrays' contents are equal, or if the arrays are + * identical (pointers are equal). + */ + static UBool arrayCompare(const UnicodeString* array1, + const UnicodeString* array2, + int32_t count); + + /** + * Create a copy, in fZoneStrings, of the given zone strings array. The + * member variables fZoneStringsRowCount and fZoneStringsColCount should be + * set already by the caller. + */ + void createZoneStrings(const UnicodeString *const * otherStrings); + + /** + * Delete all the storage owned by this object. + */ + void dispose(void); + + /** + * Copy all of the other's data to this. + * @param other the object to be copied. + */ + void copyData(const DateFormatSymbols& other); + + /** + * Create zone strings array by locale if not yet available + */ + void initZoneStringsArray(void); + + /** + * Delete just the zone strings. + */ + void disposeZoneStrings(void); + + /** + * Returns the date format field index of the pattern character c, + * or UDAT_FIELD_COUNT if c is not a pattern character. + */ + static UDateFormatField U_EXPORT2 getPatternCharIndex(char16_t c); + + /** + * Returns TRUE if f (with its pattern character repeated count times) is a numeric field. + */ + static UBool U_EXPORT2 isNumericField(UDateFormatField f, int32_t count); + + /** + * Returns TRUE if c (repeated count times) is the pattern character for a numeric field. + */ + static UBool U_EXPORT2 isNumericPatternChar(char16_t c, int32_t count); +public: +#ifndef U_HIDE_INTERNAL_API + /** + * Gets a DateFormatSymbols by locale. + * Unlike the constructors which always use gregorian calendar, this + * method uses the calendar in the locale. If the locale contains no + * explicit calendar, this method uses the default calendar for that + * locale. + * @param locale the locale. + * @param status error returned here. + * @return the new DateFormatSymbols which the caller owns. + * @internal For ICU use only. + */ + static DateFormatSymbols * U_EXPORT2 createForLocale( + const Locale &locale, UErrorCode &status); +#endif /* U_HIDE_INTERNAL_API */ +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // _DTFMTSYM +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/dtintrv.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/dtintrv.h new file mode 100644 index 0000000..10b566a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/dtintrv.h @@ -0,0 +1,160 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2008-2009, International Business Machines Corporation and +* others. All Rights Reserved. +******************************************************************************* +* +* File DTINTRV.H +* +******************************************************************************* +*/ + +#ifndef __DTINTRV_H__ +#define __DTINTRV_H__ + +#include "unicode/utypes.h" +#include "unicode/uobject.h" + +/** + * \file + * \brief C++ API: Date Interval data type + */ + + +U_NAMESPACE_BEGIN + + +/** + * This class represents a date interval. + * It is a pair of UDate representing from UDate 1 to UDate 2. + * @stable ICU 4.0 +**/ +class U_COMMON_API DateInterval : public UObject { +public: + + /** + * Construct a DateInterval given a from date and a to date. + * @param fromDate The from date in date interval. + * @param toDate The to date in date interval. + * @stable ICU 4.0 + */ + DateInterval(UDate fromDate, UDate toDate); + + /** + * destructor + * @stable ICU 4.0 + */ + virtual ~DateInterval(); + + /** + * Get the from date. + * @return the from date in dateInterval. + * @stable ICU 4.0 + */ + UDate getFromDate() const; + + /** + * Get the to date. + * @return the to date in dateInterval. + * @stable ICU 4.0 + */ + UDate getToDate() const; + + + /** + * Return the class ID for this class. This is useful only for comparing to + * a return value from getDynamicClassID(). For example: + *

+     * .   Base* polymorphic_pointer = createPolymorphicObject();
+     * .   if (polymorphic_pointer->getDynamicClassID() ==
+     * .       erived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @stable ICU 4.0 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This + * method is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and clone() + * methods call this method. + * + * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @stable ICU 4.0 + */ + virtual UClassID getDynamicClassID(void) const; + + + /** + * Copy constructor. + * @stable ICU 4.0 + */ + DateInterval(const DateInterval& other); + + /** + * Default assignment operator + * @stable ICU 4.0 + */ + DateInterval& operator=(const DateInterval&); + + /** + * Equality operator. + * @return TRUE if the two DateIntervals are the same + * @stable ICU 4.0 + */ + virtual UBool operator==(const DateInterval& other) const; + + /** + * Non-equality operator + * @return TRUE if the two DateIntervals are not the same + * @stable ICU 4.0 + */ + UBool operator!=(const DateInterval& other) const; + + + /** + * clone this object. + * The caller owns the result and should delete it when done. + * @return a cloned DateInterval + * @stable ICU 4.0 + */ + virtual DateInterval* clone() const; + +private: + /** + * Default constructor, not implemented. + */ + DateInterval(); + + UDate fromDate; + UDate toDate; + +} ;// end class DateInterval + + +inline UDate +DateInterval::getFromDate() const { + return fromDate; +} + + +inline UDate +DateInterval::getToDate() const { + return toDate; +} + + +inline UBool +DateInterval::operator!=(const DateInterval& other) const { + return ( !operator==(other) ); +} + + +U_NAMESPACE_END + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/dtitvfmt.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/dtitvfmt.h new file mode 100644 index 0000000..5eaa559 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/dtitvfmt.h @@ -0,0 +1,1046 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/******************************************************************************** +* Copyright (C) 2008-2016, International Business Machines Corporation and +* others. All Rights Reserved. +******************************************************************************* +* +* File DTITVFMT.H +* +******************************************************************************* +*/ + +#ifndef __DTITVFMT_H__ +#define __DTITVFMT_H__ + + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Format and parse date interval in a language-independent manner. + */ + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/ucal.h" +#include "unicode/smpdtfmt.h" +#include "unicode/dtintrv.h" +#include "unicode/dtitvinf.h" +#include "unicode/dtptngen.h" + +U_NAMESPACE_BEGIN + + + +/** + * DateIntervalFormat is a class for formatting and parsing date + * intervals in a language-independent manner. + * Only formatting is supported, parsing is not supported. + * + *

+ * Date interval means from one date to another date, + * for example, from "Jan 11, 2008" to "Jan 18, 2008". + * We introduced class DateInterval to represent it. + * DateInterval is a pair of UDate, which is + * the standard milliseconds since 24:00 GMT, Jan 1, 1970. + * + *

+ * DateIntervalFormat formats a DateInterval into + * text as compactly as possible. + * For example, the date interval format from "Jan 11, 2008" to "Jan 18,. 2008" + * is "Jan 11-18, 2008" for English. + * And it parses text into DateInterval, + * although initially, parsing is not supported. + * + *

+ * There is no structural information in date time patterns. + * For any punctuations and string literals inside a date time pattern, + * we do not know whether it is just a separator, or a prefix, or a suffix. + * Without such information, so, it is difficult to generate a sub-pattern + * (or super-pattern) by algorithm. + * So, formatting a DateInterval is pattern-driven. It is very + * similar to formatting in SimpleDateFormat. + * We introduce class DateIntervalInfo to save date interval + * patterns, similar to date time pattern in SimpleDateFormat. + * + *

+ * Logically, the interval patterns are mappings + * from (skeleton, the_largest_different_calendar_field) + * to (date_interval_pattern). + * + *

+ * A skeleton + *

    + *
  1. + * only keeps the field pattern letter and ignores all other parts + * in a pattern, such as space, punctuations, and string literals. + *
  2. + *
  3. + * hides the order of fields. + *
  4. + *
  5. + * might hide a field's pattern letter length. + *
  6. + *
+ * + * For those non-digit calendar fields, the pattern letter length is + * important, such as MMM, MMMM, and MMMMM; EEE and EEEE, + * and the field's pattern letter length is honored. + * + * For the digit calendar fields, such as M or MM, d or dd, yy or yyyy, + * the field pattern length is ignored and the best match, which is defined + * in date time patterns, will be returned without honor the field pattern + * letter length in skeleton. + * + *

+ * The calendar fields we support for interval formatting are: + * year, month, date, day-of-week, am-pm, hour, hour-of-day, minute, and second + * (though we do not currently have specific intervalFormat date for skeletons + * with seconds). + * Those calendar fields can be defined in the following order: + * year > month > date > hour (in day) > minute > second + * + * The largest different calendar fields between 2 calendars is the + * first different calendar field in above order. + * + * For example: the largest different calendar fields between "Jan 10, 2007" + * and "Feb 20, 2008" is year. + * + *

+ * For other calendar fields, the compact interval formatting is not + * supported. And the interval format will be fall back to fall-back + * patterns, which is mostly "{date0} - {date1}". + * + *

+ * There is a set of pre-defined static skeleton strings. + * There are pre-defined interval patterns for those pre-defined skeletons + * in locales' resource files. + * For example, for a skeleton UDAT_YEAR_ABBR_MONTH_DAY, which is "yMMMd", + * in en_US, if the largest different calendar field between date1 and date2 + * is "year", the date interval pattern is "MMM d, yyyy - MMM d, yyyy", + * such as "Jan 10, 2007 - Jan 10, 2008". + * If the largest different calendar field between date1 and date2 is "month", + * the date interval pattern is "MMM d - MMM d, yyyy", + * such as "Jan 10 - Feb 10, 2007". + * If the largest different calendar field between date1 and date2 is "day", + * the date interval pattern is "MMM d-d, yyyy", such as "Jan 10-20, 2007". + * + * For date skeleton, the interval patterns when year, or month, or date is + * different are defined in resource files. + * For time skeleton, the interval patterns when am/pm, or hour, or minute is + * different are defined in resource files. + * + *

+ * If a skeleton is not found in a locale's DateIntervalInfo, which means + * the interval patterns for the skeleton is not defined in resource file, + * the interval pattern will falls back to the interval "fallback" pattern + * defined in resource file. + * If the interval "fallback" pattern is not defined, the default fall-back + * is "{date0} - {data1}". + * + *

+ * For the combination of date and time, + * The rule to generate interval patterns are: + *

    + *
  1. + * when the year, month, or day differs, falls back to fall-back + * interval pattern, which mostly is the concatenate the two original + * expressions with a separator between, + * For example, interval pattern from "Jan 10, 2007 10:10 am" + * to "Jan 11, 2007 10:10am" is + * "Jan 10, 2007 10:10 am - Jan 11, 2007 10:10am" + *
  2. + *
  3. + * otherwise, present the date followed by the range expression + * for the time. + * For example, interval pattern from "Jan 10, 2007 10:10 am" + * to "Jan 10, 2007 11:10am" is "Jan 10, 2007 10:10 am - 11:10am" + *
  4. + *
+ * + * + *

+ * If two dates are the same, the interval pattern is the single date pattern. + * For example, interval pattern from "Jan 10, 2007" to "Jan 10, 2007" is + * "Jan 10, 2007". + * + * Or if the presenting fields between 2 dates have the exact same values, + * the interval pattern is the single date pattern. + * For example, if user only requests year and month, + * the interval pattern from "Jan 10, 2007" to "Jan 20, 2007" is "Jan 2007". + * + *

+ * DateIntervalFormat needs the following information for correct + * formatting: time zone, calendar type, pattern, date format symbols, + * and date interval patterns. + * It can be instantiated in 2 ways: + *

    + *
  1. + * create an instance using default or given locale plus given skeleton. + * Users are encouraged to created date interval formatter this way and + * to use the pre-defined skeleton macros, such as + * UDAT_YEAR_NUM_MONTH, which consists the calendar fields and + * the format style. + *
  2. + *
  3. + * create an instance using default or given locale plus given skeleton + * plus a given DateIntervalInfo. + * This factory method is for powerful users who want to provide their own + * interval patterns. + * Locale provides the timezone, calendar, and format symbols information. + * Local plus skeleton provides full pattern information. + * DateIntervalInfo provides the date interval patterns. + *
  4. + *
+ * + *

+ * For the calendar field pattern letter, such as G, y, M, d, a, h, H, m, s etc. + * DateIntervalFormat uses the same syntax as that of + * DateTime format. + * + *

+ * Code Sample: general usage + *

+ * \code
+ *   // the date interval object which the DateIntervalFormat formats on
+ *   // and parses into
+ *   DateInterval*  dtInterval = new DateInterval(1000*3600*24, 1000*3600*24*2);
+ *   UErrorCode status = U_ZERO_ERROR;
+ *   DateIntervalFormat* dtIntervalFmt = DateIntervalFormat::createInstance(
+ *                           UDAT_YEAR_MONTH_DAY,
+ *                           Locale("en", "GB", ""), status);
+ *   UnicodeUnicodeString dateIntervalString;
+ *   FieldPosition pos = 0;
+ *   // formatting
+ *   dtIntervalFmt->format(dtInterval, dateIntervalUnicodeString, pos, status);
+ *   delete dtIntervalFmt;
+ * \endcode
+ * 
+ */ + +class U_I18N_API DateIntervalFormat : public Format { +public: + + /** + * Construct a DateIntervalFormat from skeleton and the default locale. + * + * This is a convenient override of + * createInstance(const UnicodeString& skeleton, const Locale& locale, + * UErrorCode&) + * with the value of locale as default locale. + * + * @param skeleton the skeleton on which interval format based. + * @param status output param set to success/failure code on exit + * @return a date time interval formatter which the caller owns. + * @stable ICU 4.0 + */ + static DateIntervalFormat* U_EXPORT2 createInstance( + const UnicodeString& skeleton, + UErrorCode& status); + + /** + * Construct a DateIntervalFormat from skeleton and a given locale. + *

+ * In this factory method, + * the date interval pattern information is load from resource files. + * Users are encouraged to created date interval formatter this way and + * to use the pre-defined skeleton macros. + * + *

+ * There are pre-defined skeletons (defined in udate.h) having predefined + * interval patterns in resource files. + * Users are encouraged to use those macros. + * For example: + * DateIntervalFormat::createInstance(UDAT_MONTH_DAY, status) + * + * The given Locale provides the interval patterns. + * For example, for en_GB, if skeleton is UDAT_YEAR_ABBR_MONTH_WEEKDAY_DAY, + * which is "yMMMEEEd", + * the interval patterns defined in resource file to above skeleton are: + * "EEE, d MMM, yyyy - EEE, d MMM, yyyy" for year differs, + * "EEE, d MMM - EEE, d MMM, yyyy" for month differs, + * "EEE, d - EEE, d MMM, yyyy" for day differs, + * @param skeleton the skeleton on which the interval format is based. + * @param locale the given locale + * @param status output param set to success/failure code on exit + * @return a date time interval formatter which the caller owns. + * @stable ICU 4.0 + *

+ *

Sample code

+ * \snippet samples/dtitvfmtsample/dtitvfmtsample.cpp dtitvfmtPreDefined1 + * \snippet samples/dtitvfmtsample/dtitvfmtsample.cpp dtitvfmtPreDefined + *

+ */ + + static DateIntervalFormat* U_EXPORT2 createInstance( + const UnicodeString& skeleton, + const Locale& locale, + UErrorCode& status); + + /** + * Construct a DateIntervalFormat from skeleton + * DateIntervalInfo, and default locale. + * + * This is a convenient override of + * createInstance(const UnicodeString& skeleton, const Locale& locale, + * const DateIntervalInfo& dtitvinf, UErrorCode&) + * with the locale value as default locale. + * + * @param skeleton the skeleton on which interval format based. + * @param dtitvinf the DateIntervalInfo object. + * @param status output param set to success/failure code on exit + * @return a date time interval formatter which the caller owns. + * @stable ICU 4.0 + */ + static DateIntervalFormat* U_EXPORT2 createInstance( + const UnicodeString& skeleton, + const DateIntervalInfo& dtitvinf, + UErrorCode& status); + + /** + * Construct a DateIntervalFormat from skeleton + * a DateIntervalInfo, and the given locale. + * + *

+ * In this factory method, user provides its own date interval pattern + * information, instead of using those pre-defined data in resource file. + * This factory method is for powerful users who want to provide their own + * interval patterns. + *

+ * There are pre-defined skeletons (defined in udate.h) having predefined + * interval patterns in resource files. + * Users are encouraged to use those macros. + * For example: + * DateIntervalFormat::createInstance(UDAT_MONTH_DAY, status) + * + * The DateIntervalInfo provides the interval patterns. + * and the DateIntervalInfo ownership remains to the caller. + * + * User are encouraged to set default interval pattern in DateIntervalInfo + * as well, if they want to set other interval patterns ( instead of + * reading the interval patterns from resource files). + * When the corresponding interval pattern for a largest calendar different + * field is not found ( if user not set it ), interval format fallback to + * the default interval pattern. + * If user does not provide default interval pattern, it fallback to + * "{date0} - {date1}" + * + * @param skeleton the skeleton on which interval format based. + * @param locale the given locale + * @param dtitvinf the DateIntervalInfo object. + * @param status output param set to success/failure code on exit + * @return a date time interval formatter which the caller owns. + * @stable ICU 4.0 + *

+ *

Sample code

+ * \snippet samples/dtitvfmtsample/dtitvfmtsample.cpp dtitvfmtPreDefined1 + * \snippet samples/dtitvfmtsample/dtitvfmtsample.cpp dtitvfmtCustomized + *

+ */ + static DateIntervalFormat* U_EXPORT2 createInstance( + const UnicodeString& skeleton, + const Locale& locale, + const DateIntervalInfo& dtitvinf, + UErrorCode& status); + + /** + * Destructor. + * @stable ICU 4.0 + */ + virtual ~DateIntervalFormat(); + + /** + * Clone this Format object polymorphically. The caller owns the result and + * should delete it when done. + * @return A copy of the object. + * @stable ICU 4.0 + */ + virtual Format* clone(void) const; + + /** + * Return true if the given Format objects are semantically equal. Objects + * of different subclasses are considered unequal. + * @param other the object to be compared with. + * @return true if the given Format objects are semantically equal. + * @stable ICU 4.0 + */ + virtual UBool operator==(const Format& other) const; + + /** + * Return true if the given Format objects are not semantically equal. + * Objects of different subclasses are considered unequal. + * @param other the object to be compared with. + * @return true if the given Format objects are not semantically equal. + * @stable ICU 4.0 + */ + UBool operator!=(const Format& other) const; + + + using Format::format; + + /** + * Format an object to produce a string. This method handles Formattable + * objects with a DateInterval type. + * If a the Formattable object type is not a DateInterval, + * then it returns a failing UErrorCode. + * + * @param obj The object to format. + * Must be a DateInterval. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param fieldPosition On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * There may be multiple instances of a given field type + * in an interval format; in this case the fieldPosition + * offsets refer to the first instance. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @stable ICU 4.0 + */ + virtual UnicodeString& format(const Formattable& obj, + UnicodeString& appendTo, + FieldPosition& fieldPosition, + UErrorCode& status) const ; + + + + /** + * Format a DateInterval to produce a string. + * + * @param dtInterval DateInterval to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param fieldPosition On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * There may be multiple instances of a given field type + * in an interval format; in this case the fieldPosition + * offsets refer to the first instance. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @stable ICU 4.0 + */ + UnicodeString& format(const DateInterval* dtInterval, + UnicodeString& appendTo, + FieldPosition& fieldPosition, + UErrorCode& status) const ; + + + /** + * Format 2 Calendars to produce a string. + * + * Note: "fromCalendar" and "toCalendar" are not const, + * since calendar is not const in SimpleDateFormat::format(Calendar&), + * + * @param fromCalendar calendar set to the from date in date interval + * to be formatted into date interval string + * @param toCalendar calendar set to the to date in date interval + * to be formatted into date interval string + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param fieldPosition On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * There may be multiple instances of a given field type + * in an interval format; in this case the fieldPosition + * offsets refer to the first instance. + * @param status Output param filled with success/failure status. + * Caller needs to make sure it is SUCCESS + * at the function entrance + * @return Reference to 'appendTo' parameter. + * @stable ICU 4.0 + */ + UnicodeString& format(Calendar& fromCalendar, + Calendar& toCalendar, + UnicodeString& appendTo, + FieldPosition& fieldPosition, + UErrorCode& status) const ; + + /** + * Date interval parsing is not supported. Please do not use. + *

+ * This method should handle parsing of + * date time interval strings into Formattable objects with + * DateInterval type, which is a pair of UDate. + *

+ * Before calling, set parse_pos.index to the offset you want to start + * parsing at in the source. After calling, parse_pos.index is the end of + * the text you parsed. If error occurs, index is unchanged. + *

+ * When parsing, leading whitespace is discarded (with a successful parse), + * while trailing whitespace is left as is. + *

+ * See Format::parseObject() for more. + * + * @param source The string to be parsed into an object. + * @param result Formattable to be set to the parse result. + * If parse fails, return contents are undefined. + * @param parse_pos The position to start parsing at. Since no parsing + * is supported, upon return this param is unchanged. + * @return A newly created Formattable* object, or NULL + * on failure. The caller owns this and should + * delete it when done. + * @internal ICU 4.0 + */ + virtual void parseObject(const UnicodeString& source, + Formattable& result, + ParsePosition& parse_pos) const; + + + /** + * Gets the date time interval patterns. + * @return the date time interval patterns associated with + * this date interval formatter. + * @stable ICU 4.0 + */ + const DateIntervalInfo* getDateIntervalInfo(void) const; + + + /** + * Set the date time interval patterns. + * @param newIntervalPatterns the given interval patterns to copy. + * @param status output param set to success/failure code on exit + * @stable ICU 4.0 + */ + void setDateIntervalInfo(const DateIntervalInfo& newIntervalPatterns, + UErrorCode& status); + + + /** + * Gets the date formatter. The DateIntervalFormat instance continues to own + * the returned DateFormatter object, and will use and possibly modify it + * during format operations. In a multi-threaded environment, the returned + * DateFormat can only be used if it is certain that no other threads are + * concurrently using this DateIntervalFormatter, even for nominally const + * functions. + * + * @return the date formatter associated with this date interval formatter. + * @stable ICU 4.0 + */ + const DateFormat* getDateFormat(void) const; + + /** + * Returns a reference to the TimeZone used by this DateIntervalFormat's calendar. + * @return the time zone associated with the calendar of DateIntervalFormat. + * @stable ICU 4.8 + */ + virtual const TimeZone& getTimeZone(void) const; + + /** + * Sets the time zone for the calendar used by this DateIntervalFormat object. The + * caller no longer owns the TimeZone object and should not delete it after this call. + * @param zoneToAdopt the TimeZone to be adopted. + * @stable ICU 4.8 + */ + virtual void adoptTimeZone(TimeZone* zoneToAdopt); + + /** + * Sets the time zone for the calendar used by this DateIntervalFormat object. + * @param zone the new time zone. + * @stable ICU 4.8 + */ + virtual void setTimeZone(const TimeZone& zone); + + /** + * Return the class ID for this class. This is useful only for comparing to + * a return value from getDynamicClassID(). For example: + *

+     * .   Base* polymorphic_pointer = createPolymorphicObject();
+     * .   if (polymorphic_pointer->getDynamicClassID() ==
+     * .       erived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @stable ICU 4.0 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This + * method is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and clone() + * methods call this method. + * + * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @stable ICU 4.0 + */ + virtual UClassID getDynamicClassID(void) const; + +protected: + + /** + * Copy constructor. + * @stable ICU 4.0 + */ + DateIntervalFormat(const DateIntervalFormat&); + + /** + * Assignment operator. + * @stable ICU 4.0 + */ + DateIntervalFormat& operator=(const DateIntervalFormat&); + +private: + + /* + * This is for ICU internal use only. Please do not use. + * Save the interval pattern information. + * Interval pattern consists of 2 single date patterns and the separator. + * For example, interval pattern "MMM d - MMM d, yyyy" consists + * a single date pattern "MMM d", another single date pattern "MMM d, yyyy", + * and a separator "-". + * The pattern is divided into 2 parts. For above example, + * the first part is "MMM d - ", and the second part is "MMM d, yyyy". + * Also, the first date appears in an interval pattern could be + * the earlier date or the later date. + * And such information is saved in the interval pattern as well. + */ + struct PatternInfo { + UnicodeString firstPart; + UnicodeString secondPart; + /** + * Whether the first date in interval pattern is later date or not. + * Fallback format set the default ordering. + * And for a particular interval pattern, the order can be + * overriden by prefixing the interval pattern with "latestFirst:" or + * "earliestFirst:" + * For example, given 2 date, Jan 10, 2007 to Feb 10, 2007. + * if the fallback format is "{0} - {1}", + * and the pattern is "d MMM - d MMM yyyy", the interval format is + * "10 Jan - 10 Feb, 2007". + * If the pattern is "latestFirst:d MMM - d MMM yyyy", + * the interval format is "10 Feb - 10 Jan, 2007" + */ + UBool laterDateFirst; + }; + + + /** + * default constructor + * @internal (private) + */ + DateIntervalFormat(); + + /** + * Construct a DateIntervalFormat from DateFormat, + * a DateIntervalInfo, and skeleton. + * DateFormat provides the timezone, calendar, + * full pattern, and date format symbols information. + * It should be a SimpleDateFormat object which + * has a pattern in it. + * the DateIntervalInfo provides the interval patterns. + * + * Note: the DateIntervalFormat takes ownership of both + * DateFormat and DateIntervalInfo objects. + * Caller should not delete them. + * + * @param locale the locale of this date interval formatter. + * @param dtItvInfo the DateIntervalInfo object to be adopted. + * @param skeleton the skeleton of the date formatter + * @param status output param set to success/failure code on exit + */ + DateIntervalFormat(const Locale& locale, DateIntervalInfo* dtItvInfo, + const UnicodeString* skeleton, UErrorCode& status); + + + /** + * Construct a DateIntervalFormat from DateFormat + * and a DateIntervalInfo. + * + * It is a wrapper of the constructor. + * + * @param locale the locale of this date interval formatter. + * @param dtitvinf the DateIntervalInfo object to be adopted. + * @param skeleton the skeleton of this formatter. + * @param status Output param set to success/failure code. + * @return a date time interval formatter which the caller owns. + */ + static DateIntervalFormat* U_EXPORT2 create(const Locale& locale, + DateIntervalInfo* dtitvinf, + const UnicodeString* skeleton, + UErrorCode& status); + + /** + * Below are for generating interval patterns local to the formatter + */ + + /** + * Provide an updated FieldPosition posResult based on two formats, + * the FieldPosition values for each of them, and the pattern used + * to combine them. The idea is for posResult to indicate the first + * instance (if any) of the specified field in the combined result, + * with correct offsets. + * + * @param combiningPattern Pattern used to combine pat0 and pat1 + * @param pat0 Formatted date/time value to replace {0} + * @param pos0 FieldPosition within pat0 + * @param pat1 Formatted date/time value to replace {1} + * @param pos1 FieldPosition within pat1 + * @param posResult FieldPosition to be set to the correct + * position of the first field instance when + * pat0 and pat1 are combined using combiningPattern + */ + static void + adjustPosition(UnicodeString& combiningPattern, // has {0} and {1} in it + UnicodeString& pat0, FieldPosition& pos0, // pattern and pos corresponding to {0} + UnicodeString& pat1, FieldPosition& pos1, // pattern and pos corresponding to {1} + FieldPosition& posResult); + + + /** + * Format 2 Calendars using fall-back interval pattern + * + * The full pattern used in this fall-back format is the + * full pattern of the date formatter. + * + * gFormatterMutex must already be locked when calling this function. + * + * @param fromCalendar calendar set to the from date in date interval + * to be formatted into date interval string + * @param toCalendar calendar set to the to date in date interval + * to be formatted into date interval string + * @param fromToOnSameDay TRUE iff from and to dates are on the same day + * (any difference is in ampm/hours or below) + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @param status output param set to success/failure code on exit + * @return Reference to 'appendTo' parameter. + * @internal (private) + */ + UnicodeString& fallbackFormat(Calendar& fromCalendar, + Calendar& toCalendar, + UBool fromToOnSameDay, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode& status) const; + + + + /** + * Initialize interval patterns locale to this formatter + * + * This code is a bit complicated since + * 1. the interval patterns saved in resource bundle files are interval + * patterns based on date or time only. + * It does not have interval patterns based on both date and time. + * Interval patterns on both date and time are algorithm generated. + * + * For example, it has interval patterns on skeleton "dMy" and "hm", + * but it does not have interval patterns on skeleton "dMyhm". + * + * The rule to generate interval patterns for both date and time skeleton are + * 1) when the year, month, or day differs, concatenate the two original + * expressions with a separator between, + * For example, interval pattern from "Jan 10, 2007 10:10 am" + * to "Jan 11, 2007 10:10am" is + * "Jan 10, 2007 10:10 am - Jan 11, 2007 10:10am" + * + * 2) otherwise, present the date followed by the range expression + * for the time. + * For example, interval pattern from "Jan 10, 2007 10:10 am" + * to "Jan 10, 2007 11:10am" is + * "Jan 10, 2007 10:10 am - 11:10am" + * + * 2. even a pattern does not request a certain calendar field, + * the interval pattern needs to include such field if such fields are + * different between 2 dates. + * For example, a pattern/skeleton is "hm", but the interval pattern + * includes year, month, and date when year, month, and date differs. + * + * + * @param status output param set to success/failure code on exit + */ + void initializePattern(UErrorCode& status); + + + + /** + * Set fall back interval pattern given a calendar field, + * a skeleton, and a date time pattern generator. + * @param field the largest different calendar field + * @param skeleton a skeleton + * @param status output param set to success/failure code on exit + */ + void setFallbackPattern(UCalendarDateFields field, + const UnicodeString& skeleton, + UErrorCode& status); + + + + /** + * get separated date and time skeleton from a combined skeleton. + * + * The difference between date skeleton and normalizedDateSkeleton are: + * 1. both 'y' and 'd' are appeared only once in normalizeDateSkeleton + * 2. 'E' and 'EE' are normalized into 'EEE' + * 3. 'MM' is normalized into 'M' + * + ** the difference between time skeleton and normalizedTimeSkeleton are: + * 1. both 'H' and 'h' are normalized as 'h' in normalized time skeleton, + * 2. 'a' is omitted in normalized time skeleton. + * 3. there is only one appearance for 'h', 'm','v', 'z' in normalized time + * skeleton + * + * + * @param skeleton given combined skeleton. + * @param date Output parameter for date only skeleton. + * @param normalizedDate Output parameter for normalized date only + * + * @param time Output parameter for time only skeleton. + * @param normalizedTime Output parameter for normalized time only + * skeleton. + * + */ + static void U_EXPORT2 getDateTimeSkeleton(const UnicodeString& skeleton, + UnicodeString& date, + UnicodeString& normalizedDate, + UnicodeString& time, + UnicodeString& normalizedTime); + + + + /** + * Generate date or time interval pattern from resource, + * and set them into the interval pattern locale to this formatter. + * + * It needs to handle the following: + * 1. need to adjust field width. + * For example, the interval patterns saved in DateIntervalInfo + * includes "dMMMy", but not "dMMMMy". + * Need to get interval patterns for dMMMMy from dMMMy. + * Another example, the interval patterns saved in DateIntervalInfo + * includes "hmv", but not "hmz". + * Need to get interval patterns for "hmz' from 'hmv' + * + * 2. there might be no pattern for 'y' differ for skeleton "Md", + * in order to get interval patterns for 'y' differ, + * need to look for it from skeleton 'yMd' + * + * @param dateSkeleton normalized date skeleton + * @param timeSkeleton normalized time skeleton + * @return whether the resource is found for the skeleton. + * TRUE if interval pattern found for the skeleton, + * FALSE otherwise. + */ + UBool setSeparateDateTimePtn(const UnicodeString& dateSkeleton, + const UnicodeString& timeSkeleton); + + + + + /** + * Generate interval pattern from existing resource + * + * It not only save the interval patterns, + * but also return the extended skeleton and its best match skeleton. + * + * @param field largest different calendar field + * @param skeleton skeleton + * @param bestSkeleton the best match skeleton which has interval pattern + * defined in resource + * @param differenceInfo the difference between skeleton and best skeleton + * 0 means the best matched skeleton is the same as input skeleton + * 1 means the fields are the same, but field width are different + * 2 means the only difference between fields are v/z, + * -1 means there are other fields difference + * + * @param extendedSkeleton extended skeleton + * @param extendedBestSkeleton extended best match skeleton + * @return whether the interval pattern is found + * through extending skeleton or not. + * TRUE if interval pattern is found by + * extending skeleton, FALSE otherwise. + */ + UBool setIntervalPattern(UCalendarDateFields field, + const UnicodeString* skeleton, + const UnicodeString* bestSkeleton, + int8_t differenceInfo, + UnicodeString* extendedSkeleton = NULL, + UnicodeString* extendedBestSkeleton = NULL); + + /** + * Adjust field width in best match interval pattern to match + * the field width in input skeleton. + * + * TODO (xji) make a general solution + * The adjusting rule can be: + * 1. always adjust + * 2. never adjust + * 3. default adjust, which means adjust according to the following rules + * 3.1 always adjust string, such as MMM and MMMM + * 3.2 never adjust between string and numeric, such as MM and MMM + * 3.3 always adjust year + * 3.4 do not adjust 'd', 'h', or 'm' if h presents + * 3.5 do not adjust 'M' if it is numeric(?) + * + * Since date interval format is well-formed format, + * date and time skeletons are normalized previously, + * till this stage, the adjust here is only "adjust strings, such as MMM + * and MMMM, EEE and EEEE. + * + * @param inputSkeleton the input skeleton + * @param bestMatchSkeleton the best match skeleton + * @param bestMatchIntervalPattern the best match interval pattern + * @param differenceInfo the difference between 2 skeletons + * 1 means only field width differs + * 2 means v/z exchange + * @param adjustedIntervalPattern adjusted interval pattern + */ + static void U_EXPORT2 adjustFieldWidth( + const UnicodeString& inputSkeleton, + const UnicodeString& bestMatchSkeleton, + const UnicodeString& bestMatchIntervalPattern, + int8_t differenceInfo, + UnicodeString& adjustedIntervalPattern); + + /** + * Concat a single date pattern with a time interval pattern, + * set it into the intervalPatterns, while field is time field. + * This is used to handle time interval patterns on skeleton with + * both time and date. Present the date followed by + * the range expression for the time. + * @param format date and time format + * @param datePattern date pattern + * @param field time calendar field: AM_PM, HOUR, MINUTE + * @param status output param set to success/failure code on exit + */ + void concatSingleDate2TimeInterval(UnicodeString& format, + const UnicodeString& datePattern, + UCalendarDateFields field, + UErrorCode& status); + + /** + * check whether a calendar field present in a skeleton. + * @param field calendar field need to check + * @param skeleton given skeleton on which to check the calendar field + * @return true if field present in a skeleton. + */ + static UBool U_EXPORT2 fieldExistsInSkeleton(UCalendarDateFields field, + const UnicodeString& skeleton); + + + /** + * Split interval patterns into 2 part. + * @param intervalPattern interval pattern + * @return the index in interval pattern which split the pattern into 2 part + */ + static int32_t U_EXPORT2 splitPatternInto2Part(const UnicodeString& intervalPattern); + + + /** + * Break interval patterns as 2 part and save them into pattern info. + * @param field calendar field + * @param intervalPattern interval pattern + */ + void setIntervalPattern(UCalendarDateFields field, + const UnicodeString& intervalPattern); + + + /** + * Break interval patterns as 2 part and save them into pattern info. + * @param field calendar field + * @param intervalPattern interval pattern + * @param laterDateFirst whether later date appear first in interval pattern + */ + void setIntervalPattern(UCalendarDateFields field, + const UnicodeString& intervalPattern, + UBool laterDateFirst); + + + /** + * Set pattern information. + * + * @param field calendar field + * @param firstPart the first part in interval pattern + * @param secondPart the second part in interval pattern + * @param laterDateFirst whether the first date in intervalPattern + * is earlier date or later date + */ + void setPatternInfo(UCalendarDateFields field, + const UnicodeString* firstPart, + const UnicodeString* secondPart, + UBool laterDateFirst); + + /** + * Format 2 Calendars to produce a string. + * Implementation of the similar public format function. + * Must be called with gFormatterMutex already locked. + * + * Note: "fromCalendar" and "toCalendar" are not const, + * since calendar is not const in SimpleDateFormat::format(Calendar&), + * + * @param fromCalendar calendar set to the from date in date interval + * to be formatted into date interval string + * @param toCalendar calendar set to the to date in date interval + * to be formatted into date interval string + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param fieldPosition On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * There may be multiple instances of a given field type + * in an interval format; in this case the fieldPosition + * offsets refer to the first instance. + * @param status Output param filled with success/failure status. + * Caller needs to make sure it is SUCCESS + * at the function entrance + * @return Reference to 'appendTo' parameter. + * @internal (private) + */ + UnicodeString& formatImpl(Calendar& fromCalendar, + Calendar& toCalendar, + UnicodeString& appendTo, + FieldPosition& fieldPosition, + UErrorCode& status) const ; + + + // from calendar field to pattern letter + static const char16_t fgCalendarFieldToPatternLetter[]; + + + /** + * The interval patterns for this locale. + */ + DateIntervalInfo* fInfo; + + /** + * The DateFormat object used to format single pattern + */ + SimpleDateFormat* fDateFormat; + + /** + * The 2 calendars with the from and to date. + * could re-use the calendar in fDateFormat, + * but keeping 2 calendars make it clear and clean. + */ + Calendar* fFromCalendar; + Calendar* fToCalendar; + + Locale fLocale; + + /** + * Following are interval information relevant (locale) to this formatter. + */ + UnicodeString fSkeleton; + PatternInfo fIntervalPatterns[DateIntervalInfo::kIPI_MAX_INDEX]; + + /** + * Patterns for fallback formatting. + */ + UnicodeString* fDatePattern; + UnicodeString* fTimePattern; + UnicodeString* fDateTimeFormat; +}; + +inline UBool +DateIntervalFormat::operator!=(const Format& other) const { + return !operator==(other); +} + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // _DTITVFMT_H__ +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/dtitvinf.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/dtitvinf.h new file mode 100644 index 0000000..726e34a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/dtitvinf.h @@ -0,0 +1,520 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ******************************************************************************* + * Copyright (C) 2008-2016, International Business Machines Corporation and + * others. All Rights Reserved. + ******************************************************************************* + * + * File DTITVINF.H + * + ******************************************************************************* + */ + +#ifndef __DTITVINF_H__ +#define __DTITVINF_H__ + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Date/Time interval patterns for formatting date/time interval + */ + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/udat.h" +#include "unicode/locid.h" +#include "unicode/ucal.h" +#include "unicode/dtptngen.h" + +U_NAMESPACE_BEGIN + +/** + * DateIntervalInfo is a public class for encapsulating localizable + * date time interval patterns. It is used by DateIntervalFormat. + * + *

+ * For most users, ordinary use of DateIntervalFormat does not need to create + * DateIntervalInfo object directly. + * DateIntervalFormat will take care of it when creating a date interval + * formatter when user pass in skeleton and locale. + * + *

+ * For power users, who want to create their own date interval patterns, + * or want to re-set date interval patterns, they could do so by + * directly creating DateIntervalInfo and manupulating it. + * + *

+ * Logically, the interval patterns are mappings + * from (skeleton, the_largest_different_calendar_field) + * to (date_interval_pattern). + * + *

+ * A skeleton + *

    + *
  1. + * only keeps the field pattern letter and ignores all other parts + * in a pattern, such as space, punctuations, and string literals. + *
  2. + * hides the order of fields. + *
  3. + * might hide a field's pattern letter length. + * + * For those non-digit calendar fields, the pattern letter length is + * important, such as MMM, MMMM, and MMMMM; EEE and EEEE, + * and the field's pattern letter length is honored. + * + * For the digit calendar fields, such as M or MM, d or dd, yy or yyyy, + * the field pattern length is ignored and the best match, which is defined + * in date time patterns, will be returned without honor the field pattern + * letter length in skeleton. + *
+ * + *

+ * The calendar fields we support for interval formatting are: + * year, month, date, day-of-week, am-pm, hour, hour-of-day, and minute. + * Those calendar fields can be defined in the following order: + * year > month > date > am-pm > hour > minute + * + * The largest different calendar fields between 2 calendars is the + * first different calendar field in above order. + * + * For example: the largest different calendar fields between "Jan 10, 2007" + * and "Feb 20, 2008" is year. + * + *

+ * There is a set of pre-defined static skeleton strings. + * There are pre-defined interval patterns for those pre-defined skeletons + * in locales' resource files. + * For example, for a skeleton UDAT_YEAR_ABBR_MONTH_DAY, which is "yMMMd", + * in en_US, if the largest different calendar field between date1 and date2 + * is "year", the date interval pattern is "MMM d, yyyy - MMM d, yyyy", + * such as "Jan 10, 2007 - Jan 10, 2008". + * If the largest different calendar field between date1 and date2 is "month", + * the date interval pattern is "MMM d - MMM d, yyyy", + * such as "Jan 10 - Feb 10, 2007". + * If the largest different calendar field between date1 and date2 is "day", + * the date interval pattern is "MMM d-d, yyyy", such as "Jan 10-20, 2007". + * + * For date skeleton, the interval patterns when year, or month, or date is + * different are defined in resource files. + * For time skeleton, the interval patterns when am/pm, or hour, or minute is + * different are defined in resource files. + * + * + *

+ * There are 2 dates in interval pattern. For most locales, the first date + * in an interval pattern is the earlier date. There might be a locale in which + * the first date in an interval pattern is the later date. + * We use fallback format for the default order for the locale. + * For example, if the fallback format is "{0} - {1}", it means + * the first date in the interval pattern for this locale is earlier date. + * If the fallback format is "{1} - {0}", it means the first date is the + * later date. + * For a particular interval pattern, the default order can be overriden + * by prefixing "latestFirst:" or "earliestFirst:" to the interval pattern. + * For example, if the fallback format is "{0}-{1}", + * but for skeleton "yMMMd", the interval pattern when day is different is + * "latestFirst:d-d MMM yy", it means by default, the first date in interval + * pattern is the earlier date. But for skeleton "yMMMd", when day is different, + * the first date in "d-d MMM yy" is the later date. + * + *

+ * The recommended way to create a DateIntervalFormat object is to pass in + * the locale. + * By using a Locale parameter, the DateIntervalFormat object is + * initialized with the pre-defined interval patterns for a given or + * default locale. + *

+ * Users can also create DateIntervalFormat object + * by supplying their own interval patterns. + * It provides flexibility for power users. + * + *

+ * After a DateIntervalInfo object is created, clients may modify + * the interval patterns using setIntervalPattern function as so desired. + * Currently, users can only set interval patterns when the following + * calendar fields are different: ERA, YEAR, MONTH, DATE, DAY_OF_MONTH, + * DAY_OF_WEEK, AM_PM, HOUR, HOUR_OF_DAY, and MINUTE. + * Interval patterns when other calendar fields are different is not supported. + *

+ * DateIntervalInfo objects are cloneable. + * When clients obtain a DateIntervalInfo object, + * they can feel free to modify it as necessary. + *

+ * DateIntervalInfo are not expected to be subclassed. + * Data for a calendar is loaded out of resource bundles. + * Through ICU 4.4, date interval patterns are only supported in the Gregorian + * calendar; non-Gregorian calendars are supported from ICU 4.4.1. + * @stable ICU 4.0 +**/ + +class U_I18N_API DateIntervalInfo U_FINAL : public UObject { +public: + /** + * Default constructor. + * It does not initialize any interval patterns except + * that it initialize default fall-back pattern as "{0} - {1}", + * which can be reset by setFallbackIntervalPattern(). + * It should be followed by setFallbackIntervalPattern() and + * setIntervalPattern(), + * and is recommended to be used only for power users who + * wants to create their own interval patterns and use them to create + * date interval formatter. + * @param status output param set to success/failure code on exit + * @internal ICU 4.0 + */ + DateIntervalInfo(UErrorCode& status); + + + /** + * Construct DateIntervalInfo for the given locale, + * @param locale the interval patterns are loaded from the appropriate calendar + * data (specified calendar or default calendar) in this locale. + * @param status output param set to success/failure code on exit + * @stable ICU 4.0 + */ + DateIntervalInfo(const Locale& locale, UErrorCode& status); + + + /** + * Copy constructor. + * @stable ICU 4.0 + */ + DateIntervalInfo(const DateIntervalInfo&); + + /** + * Assignment operator + * @stable ICU 4.0 + */ + DateIntervalInfo& operator=(const DateIntervalInfo&); + + /** + * Clone this object polymorphically. + * The caller owns the result and should delete it when done. + * @return a copy of the object + * @stable ICU 4.0 + */ + virtual DateIntervalInfo* clone(void) const; + + /** + * Destructor. + * It is virtual to be safe, but it is not designed to be subclassed. + * @stable ICU 4.0 + */ + virtual ~DateIntervalInfo(); + + + /** + * Return true if another object is semantically equal to this one. + * + * @param other the DateIntervalInfo object to be compared with. + * @return true if other is semantically equal to this. + * @stable ICU 4.0 + */ + virtual UBool operator==(const DateIntervalInfo& other) const; + + /** + * Return true if another object is semantically unequal to this one. + * + * @param other the DateIntervalInfo object to be compared with. + * @return true if other is semantically unequal to this. + * @stable ICU 4.0 + */ + UBool operator!=(const DateIntervalInfo& other) const; + + + + /** + * Provides a way for client to build interval patterns. + * User could construct DateIntervalInfo by providing a list of skeletons + * and their patterns. + *

+ * For example: + *

+     * UErrorCode status = U_ZERO_ERROR;
+     * DateIntervalInfo dIntervalInfo = new DateIntervalInfo();
+     * dIntervalInfo->setFallbackIntervalPattern("{0} ~ {1}");
+     * dIntervalInfo->setIntervalPattern("yMd", UCAL_YEAR, "'from' yyyy-M-d 'to' yyyy-M-d", status);
+     * dIntervalInfo->setIntervalPattern("yMMMd", UCAL_MONTH, "'from' yyyy MMM d 'to' MMM d", status);
+     * dIntervalInfo->setIntervalPattern("yMMMd", UCAL_DAY, "yyyy MMM d-d", status, status);
+     * 
+ * + * Restriction: + * Currently, users can only set interval patterns when the following + * calendar fields are different: ERA, YEAR, MONTH, DATE, DAY_OF_MONTH, + * DAY_OF_WEEK, AM_PM, HOUR, HOUR_OF_DAY, and MINUTE. + * Interval patterns when other calendar fields are different are + * not supported. + * + * @param skeleton the skeleton on which interval pattern based + * @param lrgDiffCalUnit the largest different calendar unit. + * @param intervalPattern the interval pattern on the largest different + * calendar unit. + * For example, if lrgDiffCalUnit is + * "year", the interval pattern for en_US when year + * is different could be "'from' yyyy 'to' yyyy". + * @param status output param set to success/failure code on exit + * @stable ICU 4.0 + */ + void setIntervalPattern(const UnicodeString& skeleton, + UCalendarDateFields lrgDiffCalUnit, + const UnicodeString& intervalPattern, + UErrorCode& status); + + /** + * Get the interval pattern given skeleton and + * the largest different calendar field. + * @param skeleton the skeleton + * @param field the largest different calendar field + * @param result output param to receive the pattern + * @param status output param set to success/failure code on exit + * @return a reference to 'result' + * @stable ICU 4.0 + */ + UnicodeString& getIntervalPattern(const UnicodeString& skeleton, + UCalendarDateFields field, + UnicodeString& result, + UErrorCode& status) const; + + /** + * Get the fallback interval pattern. + * @param result output param to receive the pattern + * @return a reference to 'result' + * @stable ICU 4.0 + */ + UnicodeString& getFallbackIntervalPattern(UnicodeString& result) const; + + + /** + * Re-set the fallback interval pattern. + * + * In construction, default fallback pattern is set as "{0} - {1}". + * And constructor taking locale as parameter will set the + * fallback pattern as what defined in the locale resource file. + * + * This method provides a way for user to replace the fallback pattern. + * + * @param fallbackPattern fall-back interval pattern. + * @param status output param set to success/failure code on exit + * @stable ICU 4.0 + */ + void setFallbackIntervalPattern(const UnicodeString& fallbackPattern, + UErrorCode& status); + + + /** Get default order -- whether the first date in pattern is later date + or not. + * return default date ordering in interval pattern. TRUE if the first date + * in pattern is later date, FALSE otherwise. + * @stable ICU 4.0 + */ + UBool getDefaultOrder() const; + + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 4.0 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 4.0 + */ + static UClassID U_EXPORT2 getStaticClassID(); + + +private: + /** + * DateIntervalFormat will need access to + * getBestSkeleton(), parseSkeleton(), enum IntervalPatternIndex, + * and calendarFieldToPatternIndex(). + * + * Instead of making above public, + * make DateIntervalFormat a friend of DateIntervalInfo. + */ + friend class DateIntervalFormat; + + /** + * Internal struct used to load resource bundle data. + */ + struct DateIntervalSink; + + /** + * Following is for saving the interval patterns. + * We only support interval patterns on + * ERA, YEAR, MONTH, DAY, AM_PM, HOUR, and MINUTE + */ + enum IntervalPatternIndex + { + kIPI_ERA, + kIPI_YEAR, + kIPI_MONTH, + kIPI_DATE, + kIPI_AM_PM, + kIPI_HOUR, + kIPI_MINUTE, + kIPI_SECOND, + kIPI_MAX_INDEX + }; +public: +#ifndef U_HIDE_INTERNAL_API + /** + * Max index for stored interval patterns + * @internal ICU 4.4 + */ + enum { + kMaxIntervalPatternIndex = kIPI_MAX_INDEX + }; +#endif /* U_HIDE_INTERNAL_API */ +private: + + + /** + * Initialize the DateIntervalInfo from locale + * @param locale the given locale. + * @param status output param set to success/failure code on exit + */ + void initializeData(const Locale& locale, UErrorCode& status); + + + /* Set Interval pattern. + * + * It sets interval pattern into the hash map. + * + * @param skeleton skeleton on which the interval pattern based + * @param lrgDiffCalUnit the largest different calendar unit. + * @param intervalPattern the interval pattern on the largest different + * calendar unit. + * @param status output param set to success/failure code on exit + */ + void setIntervalPatternInternally(const UnicodeString& skeleton, + UCalendarDateFields lrgDiffCalUnit, + const UnicodeString& intervalPattern, + UErrorCode& status); + + + /**given an input skeleton, get the best match skeleton + * which has pre-defined interval pattern in resource file. + * Also return the difference between the input skeleton + * and the best match skeleton. + * + * TODO (xji): set field weight or + * isolate the funtionality in DateTimePatternGenerator + * @param skeleton input skeleton + * @param bestMatchDistanceInfo the difference between input skeleton + * and best match skeleton. + * 0, if there is exact match for input skeleton + * 1, if there is only field width difference between + * the best match and the input skeleton + * 2, the only field difference is 'v' and 'z' + * -1, if there is calendar field difference between + * the best match and the input skeleton + * @return best match skeleton + */ + const UnicodeString* getBestSkeleton(const UnicodeString& skeleton, + int8_t& bestMatchDistanceInfo) const; + + + /** + * Parse skeleton, save each field's width. + * It is used for looking for best match skeleton, + * and adjust pattern field width. + * @param skeleton skeleton to be parsed + * @param skeletonFieldWidth parsed skeleton field width + */ + static void U_EXPORT2 parseSkeleton(const UnicodeString& skeleton, + int32_t* skeletonFieldWidth); + + + /** + * Check whether one field width is numeric while the other is string. + * + * TODO (xji): make it general + * + * @param fieldWidth one field width + * @param anotherFieldWidth another field width + * @param patternLetter pattern letter char + * @return true if one field width is numeric and the other is string, + * false otherwise. + */ + static UBool U_EXPORT2 stringNumeric(int32_t fieldWidth, + int32_t anotherFieldWidth, + char patternLetter); + + + /** + * Convert calendar field to the interval pattern index in + * hash table. + * + * Since we only support the following calendar fields: + * ERA, YEAR, MONTH, DATE, DAY_OF_MONTH, DAY_OF_WEEK, + * AM_PM, HOUR, HOUR_OF_DAY, and MINUTE, + * We reserve only 4 interval patterns for a skeleton. + * + * @param field calendar field + * @param status output param set to success/failure code on exit + * @return interval pattern index in hash table + */ + static IntervalPatternIndex U_EXPORT2 calendarFieldToIntervalIndex( + UCalendarDateFields field, + UErrorCode& status); + + + /** + * delete hash table (of type fIntervalPatterns). + * + * @param hTable hash table to be deleted + */ + void deleteHash(Hashtable* hTable); + + + /** + * initialize hash table (of type fIntervalPatterns). + * + * @param status output param set to success/failure code on exit + * @return hash table initialized + */ + Hashtable* initHash(UErrorCode& status); + + + + /** + * copy hash table (of type fIntervalPatterns). + * + * @param source the source to copy from + * @param target the target to copy to + * @param status output param set to success/failure code on exit + */ + void copyHash(const Hashtable* source, Hashtable* target, UErrorCode& status); + + + // data members + // fallback interval pattern + UnicodeString fFallbackIntervalPattern; + // default order + UBool fFirstDateInPtnIsLaterDate; + + // HashMap + // HashMap( skeleton, pattern[largest_different_field] ) + Hashtable* fIntervalPatterns; + +};// end class DateIntervalInfo + + +inline UBool +DateIntervalInfo::operator!=(const DateIntervalInfo& other) const { + return !operator==(other); +} + + +U_NAMESPACE_END + +#endif + +#endif + diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/dtptngen.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/dtptngen.h new file mode 100644 index 0000000..5712edb --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/dtptngen.h @@ -0,0 +1,569 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2007-2016, International Business Machines Corporation and +* others. All Rights Reserved. +******************************************************************************* +* +* File DTPTNGEN.H +* +******************************************************************************* +*/ + +#ifndef __DTPTNGEN_H__ +#define __DTPTNGEN_H__ + +#include "unicode/datefmt.h" +#include "unicode/locid.h" +#include "unicode/udat.h" +#include "unicode/udatpg.h" +#include "unicode/unistr.h" + +U_NAMESPACE_BEGIN + +/** + * \file + * \brief C++ API: Date/Time Pattern Generator + */ + + +class CharString; +class Hashtable; +class FormatParser; +class DateTimeMatcher; +class DistanceInfo; +class PatternMap; +class PtnSkeleton; +class SharedDateTimePatternGenerator; + +/** + * This class provides flexible generation of date format patterns, like "yy-MM-dd". + * The user can build up the generator by adding successive patterns. Once that + * is done, a query can be made using a "skeleton", which is a pattern which just + * includes the desired fields and lengths. The generator will return the "best fit" + * pattern corresponding to that skeleton. + *

The main method people will use is getBestPattern(String skeleton), + * since normally this class is pre-built with data from a particular locale. + * However, generators can be built directly from other data as well. + *

Issue: may be useful to also have a function that returns the list of + * fields in a pattern, in order, since we have that internally. + * That would be useful for getting the UI order of field elements. + * @stable ICU 3.8 +**/ +class U_I18N_API DateTimePatternGenerator : public UObject { +public: + /** + * Construct a flexible generator according to default locale. + * @param status Output param set to success/failure code on exit, + * which must not indicate a failure before the function call. + * @stable ICU 3.8 + */ + static DateTimePatternGenerator* U_EXPORT2 createInstance(UErrorCode& status); + + /** + * Construct a flexible generator according to data for a given locale. + * @param uLocale + * @param status Output param set to success/failure code on exit, + * which must not indicate a failure before the function call. + * @stable ICU 3.8 + */ + static DateTimePatternGenerator* U_EXPORT2 createInstance(const Locale& uLocale, UErrorCode& status); + +#ifndef U_HIDE_INTERNAL_API + + /** + * For ICU use only + * + * @internal + */ + static DateTimePatternGenerator* U_EXPORT2 internalMakeInstance(const Locale& uLocale, UErrorCode& status); + +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Create an empty generator, to be constructed with addPattern(...) etc. + * @param status Output param set to success/failure code on exit, + * which must not indicate a failure before the function call. + * @stable ICU 3.8 + */ + static DateTimePatternGenerator* U_EXPORT2 createEmptyInstance(UErrorCode& status); + + /** + * Destructor. + * @stable ICU 3.8 + */ + virtual ~DateTimePatternGenerator(); + + /** + * Clone DateTimePatternGenerator object. Clients are responsible for + * deleting the DateTimePatternGenerator object cloned. + * @stable ICU 3.8 + */ + DateTimePatternGenerator* clone() const; + + /** + * Return true if another object is semantically equal to this one. + * + * @param other the DateTimePatternGenerator object to be compared with. + * @return true if other is semantically equal to this. + * @stable ICU 3.8 + */ + UBool operator==(const DateTimePatternGenerator& other) const; + + /** + * Return true if another object is semantically unequal to this one. + * + * @param other the DateTimePatternGenerator object to be compared with. + * @return true if other is semantically unequal to this. + * @stable ICU 3.8 + */ + UBool operator!=(const DateTimePatternGenerator& other) const; + + /** + * Utility to return a unique skeleton from a given pattern. For example, + * both "MMM-dd" and "dd/MMM" produce the skeleton "MMMdd". + * + * @param pattern Input pattern, such as "dd/MMM" + * @param status Output param set to success/failure code on exit, + * which must not indicate a failure before the function call. + * @return skeleton such as "MMMdd" + * @stable ICU 56 + */ + static UnicodeString staticGetSkeleton(const UnicodeString& pattern, UErrorCode& status); + + /** + * Utility to return a unique skeleton from a given pattern. For example, + * both "MMM-dd" and "dd/MMM" produce the skeleton "MMMdd". + * getSkeleton() works exactly like staticGetSkeleton(). + * Use staticGetSkeleton() instead of getSkeleton(). + * + * @param pattern Input pattern, such as "dd/MMM" + * @param status Output param set to success/failure code on exit, + * which must not indicate a failure before the function call. + * @return skeleton such as "MMMdd" + * @stable ICU 3.8 + */ + UnicodeString getSkeleton(const UnicodeString& pattern, UErrorCode& status); /* { + The function is commented out because it is a stable API calling a draft API. + After staticGetSkeleton becomes stable, staticGetSkeleton can be used and + these comments and the definition of getSkeleton in dtptngen.cpp should be removed. + return staticGetSkeleton(pattern, status); + }*/ + + /** + * Utility to return a unique base skeleton from a given pattern. This is + * the same as the skeleton, except that differences in length are minimized + * so as to only preserve the difference between string and numeric form. So + * for example, both "MMM-dd" and "d/MMM" produce the skeleton "MMMd" + * (notice the single d). + * + * @param pattern Input pattern, such as "dd/MMM" + * @param status Output param set to success/failure code on exit, + * which must not indicate a failure before the function call. + * @return base skeleton, such as "MMMd" + * @stable ICU 56 + */ + static UnicodeString staticGetBaseSkeleton(const UnicodeString& pattern, UErrorCode& status); + + /** + * Utility to return a unique base skeleton from a given pattern. This is + * the same as the skeleton, except that differences in length are minimized + * so as to only preserve the difference between string and numeric form. So + * for example, both "MMM-dd" and "d/MMM" produce the skeleton "MMMd" + * (notice the single d). + * getBaseSkeleton() works exactly like staticGetBaseSkeleton(). + * Use staticGetBaseSkeleton() instead of getBaseSkeleton(). + * + * @param pattern Input pattern, such as "dd/MMM" + * @param status Output param set to success/failure code on exit, + * which must not indicate a failure before the function call. + * @return base skeleton, such as "MMMd" + * @stable ICU 3.8 + */ + UnicodeString getBaseSkeleton(const UnicodeString& pattern, UErrorCode& status); /* { + The function is commented out because it is a stable API calling a draft API. + After staticGetBaseSkeleton becomes stable, staticGetBaseSkeleton can be used and + these comments and the definition of getBaseSkeleton in dtptngen.cpp should be removed. + return staticGetBaseSkeleton(pattern, status); + }*/ + + /** + * Adds a pattern to the generator. If the pattern has the same skeleton as + * an existing pattern, and the override parameter is set, then the previous + * value is overriden. Otherwise, the previous value is retained. In either + * case, the conflicting status is set and previous vale is stored in + * conflicting pattern. + *

+ * Note that single-field patterns (like "MMM") are automatically added, and + * don't need to be added explicitly! + * + * @param pattern Input pattern, such as "dd/MMM" + * @param override When existing values are to be overridden use true, + * otherwise use false. + * @param conflictingPattern Previous pattern with the same skeleton. + * @param status Output param set to success/failure code on exit, + * which must not indicate a failure before the function call. + * @return conflicting status. The value could be UDATPG_NO_CONFLICT, + * UDATPG_BASE_CONFLICT or UDATPG_CONFLICT. + * @stable ICU 3.8 + *

+ *

Sample code

+ * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1 + * \snippet samples/dtptngsample/dtptngsample.cpp addPatternExample + *

+ */ + UDateTimePatternConflict addPattern(const UnicodeString& pattern, + UBool override, + UnicodeString& conflictingPattern, + UErrorCode& status); + + /** + * An AppendItem format is a pattern used to append a field if there is no + * good match. For example, suppose that the input skeleton is "GyyyyMMMd", + * and there is no matching pattern internally, but there is a pattern + * matching "yyyyMMMd", say "d-MM-yyyy". Then that pattern is used, plus the + * G. The way these two are conjoined is by using the AppendItemFormat for G + * (era). So if that value is, say "{0}, {1}" then the final resulting + * pattern is "d-MM-yyyy, G". + *

+ * There are actually three available variables: {0} is the pattern so far, + * {1} is the element we are adding, and {2} is the name of the element. + *

+ * This reflects the way that the CLDR data is organized. + * + * @param field such as UDATPG_ERA_FIELD. + * @param value pattern, such as "{0}, {1}" + * @stable ICU 3.8 + */ + void setAppendItemFormat(UDateTimePatternField field, const UnicodeString& value); + + /** + * Getter corresponding to setAppendItemFormat. Values below 0 or at or + * above UDATPG_FIELD_COUNT are illegal arguments. + * + * @param field such as UDATPG_ERA_FIELD. + * @return append pattern for field + * @stable ICU 3.8 + */ + const UnicodeString& getAppendItemFormat(UDateTimePatternField field) const; + + /** + * Sets the names of field, eg "era" in English for ERA. These are only + * used if the corresponding AppendItemFormat is used, and if it contains a + * {2} variable. + *

+ * This reflects the way that the CLDR data is organized. + * + * @param field such as UDATPG_ERA_FIELD. + * @param value name of the field + * @stable ICU 3.8 + */ + void setAppendItemName(UDateTimePatternField field, const UnicodeString& value); + + /** + * Getter corresponding to setAppendItemNames. Values below 0 or at or above + * UDATPG_FIELD_COUNT are illegal arguments. + * + * @param field such as UDATPG_ERA_FIELD. + * @return name for field + * @stable ICU 3.8 + */ + const UnicodeString& getAppendItemName(UDateTimePatternField field) const; + + /** + * The DateTimeFormat is a message format pattern used to compose date and + * time patterns. The default pattern in the root locale is "{1} {0}", where + * {1} will be replaced by the date pattern and {0} will be replaced by the + * time pattern; however, other locales may specify patterns such as + * "{1}, {0}" or "{1} 'at' {0}", etc. + *

+ * This is used when the input skeleton contains both date and time fields, + * but there is not a close match among the added patterns. For example, + * suppose that this object was created by adding "dd-MMM" and "hh:mm", and + * its datetimeFormat is the default "{1} {0}". Then if the input skeleton + * is "MMMdhmm", there is not an exact match, so the input skeleton is + * broken up into two components "MMMd" and "hmm". There are close matches + * for those two skeletons, so the result is put together with this pattern, + * resulting in "d-MMM h:mm". + * + * @param dateTimeFormat + * message format pattern, here {1} will be replaced by the date + * pattern and {0} will be replaced by the time pattern. + * @stable ICU 3.8 + */ + void setDateTimeFormat(const UnicodeString& dateTimeFormat); + + /** + * Getter corresponding to setDateTimeFormat. + * @return DateTimeFormat. + * @stable ICU 3.8 + */ + const UnicodeString& getDateTimeFormat() const; + + /** + * Return the best pattern matching the input skeleton. It is guaranteed to + * have all of the fields in the skeleton. + * + * @param skeleton + * The skeleton is a pattern containing only the variable fields. + * For example, "MMMdd" and "mmhh" are skeletons. + * @param status Output param set to success/failure code on exit, + * which must not indicate a failure before the function call. + * @return bestPattern + * The best pattern found from the given skeleton. + * @stable ICU 3.8 + *

+ *

Sample code

+ * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1 + * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample + *

+ */ + UnicodeString getBestPattern(const UnicodeString& skeleton, UErrorCode& status); + + + /** + * Return the best pattern matching the input skeleton. It is guaranteed to + * have all of the fields in the skeleton. + * + * @param skeleton + * The skeleton is a pattern containing only the variable fields. + * For example, "MMMdd" and "mmhh" are skeletons. + * @param options + * Options for forcing the length of specified fields in the + * returned pattern to match those in the skeleton (when this + * would not happen otherwise). For default behavior, use + * UDATPG_MATCH_NO_OPTIONS. + * @param status + * Output param set to success/failure code on exit, + * which must not indicate a failure before the function call. + * @return bestPattern + * The best pattern found from the given skeleton. + * @stable ICU 4.4 + */ + UnicodeString getBestPattern(const UnicodeString& skeleton, + UDateTimePatternMatchOptions options, + UErrorCode& status); + + + /** + * Adjusts the field types (width and subtype) of a pattern to match what is + * in a skeleton. That is, if you supply a pattern like "d-M H:m", and a + * skeleton of "MMMMddhhmm", then the input pattern is adjusted to be + * "dd-MMMM hh:mm". This is used internally to get the best match for the + * input skeleton, but can also be used externally. + * + * @param pattern Input pattern + * @param skeleton + * The skeleton is a pattern containing only the variable fields. + * For example, "MMMdd" and "mmhh" are skeletons. + * @param status Output param set to success/failure code on exit, + * which must not indicate a failure before the function call. + * @return pattern adjusted to match the skeleton fields widths and subtypes. + * @stable ICU 3.8 + *

+ *

Sample code

+ * \snippet samples/dtptngsample/dtptngsample.cpp getBestPatternExample1 + * \snippet samples/dtptngsample/dtptngsample.cpp replaceFieldTypesExample + *

+ */ + UnicodeString replaceFieldTypes(const UnicodeString& pattern, + const UnicodeString& skeleton, + UErrorCode& status); + + /** + * Adjusts the field types (width and subtype) of a pattern to match what is + * in a skeleton. That is, if you supply a pattern like "d-M H:m", and a + * skeleton of "MMMMddhhmm", then the input pattern is adjusted to be + * "dd-MMMM hh:mm". This is used internally to get the best match for the + * input skeleton, but can also be used externally. + * + * @param pattern Input pattern + * @param skeleton + * The skeleton is a pattern containing only the variable fields. + * For example, "MMMdd" and "mmhh" are skeletons. + * @param options + * Options controlling whether the length of specified fields in the + * pattern are adjusted to match those in the skeleton (when this + * would not happen otherwise). For default behavior, use + * UDATPG_MATCH_NO_OPTIONS. + * @param status + * Output param set to success/failure code on exit, + * which must not indicate a failure before the function call. + * @return pattern adjusted to match the skeleton fields widths and subtypes. + * @stable ICU 4.4 + */ + UnicodeString replaceFieldTypes(const UnicodeString& pattern, + const UnicodeString& skeleton, + UDateTimePatternMatchOptions options, + UErrorCode& status); + + /** + * Return a list of all the skeletons (in canonical form) from this class. + * + * Call getPatternForSkeleton() to get the corresponding pattern. + * + * @param status Output param set to success/failure code on exit, + * which must not indicate a failure before the function call. + * @return StringEnumeration with the skeletons. + * The caller must delete the object. + * @stable ICU 3.8 + */ + StringEnumeration* getSkeletons(UErrorCode& status) const; + + /** + * Get the pattern corresponding to a given skeleton. + * @param skeleton + * @return pattern corresponding to a given skeleton. + * @stable ICU 3.8 + */ + const UnicodeString& getPatternForSkeleton(const UnicodeString& skeleton) const; + + /** + * Return a list of all the base skeletons (in canonical form) from this class. + * + * @param status Output param set to success/failure code on exit, + * which must not indicate a failure before the function call. + * @return a StringEnumeration with the base skeletons. + * The caller must delete the object. + * @stable ICU 3.8 + */ + StringEnumeration* getBaseSkeletons(UErrorCode& status) const; + +#ifndef U_HIDE_INTERNAL_API + /** + * Return a list of redundant patterns are those which if removed, make no + * difference in the resulting getBestPattern values. This method returns a + * list of them, to help check the consistency of the patterns used to build + * this generator. + * + * @param status Output param set to success/failure code on exit, + * which must not indicate a failure before the function call. + * @return a StringEnumeration with the redundant pattern. + * The caller must delete the object. + * @internal ICU 3.8 + */ + StringEnumeration* getRedundants(UErrorCode& status); +#endif /* U_HIDE_INTERNAL_API */ + + /** + * The decimal value is used in formatting fractions of seconds. If the + * skeleton contains fractional seconds, then this is used with the + * fractional seconds. For example, suppose that the input pattern is + * "hhmmssSSSS", and the best matching pattern internally is "H:mm:ss", and + * the decimal string is ",". Then the resulting pattern is modified to be + * "H:mm:ss,SSSS" + * + * @param decimal + * @stable ICU 3.8 + */ + void setDecimal(const UnicodeString& decimal); + + /** + * Getter corresponding to setDecimal. + * @return UnicodeString corresponding to the decimal point + * @stable ICU 3.8 + */ + const UnicodeString& getDecimal() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 3.8 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 3.8 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + +private: + /** + * Constructor. + * @stable ICU 3.8 + */ + DateTimePatternGenerator(UErrorCode & status); + + /** + * Constructor. + * @stable ICU 3.8 + */ + DateTimePatternGenerator(const Locale& locale, UErrorCode & status); + + /** + * Copy constructor. + * @param other DateTimePatternGenerator to copy + * @stable ICU 3.8 + */ + DateTimePatternGenerator(const DateTimePatternGenerator& other); + + /** + * Default assignment operator. + * @param other DateTimePatternGenerator to copy + * @stable ICU 3.8 + */ + DateTimePatternGenerator& operator=(const DateTimePatternGenerator& other); + + Locale pLocale; // pattern locale + FormatParser *fp; + DateTimeMatcher* dtMatcher; + DistanceInfo *distanceInfo; + PatternMap *patternMap; + UnicodeString appendItemFormats[UDATPG_FIELD_COUNT]; + UnicodeString appendItemNames[UDATPG_FIELD_COUNT]; + UnicodeString dateTimeFormat; + UnicodeString decimal; + DateTimeMatcher *skipMatcher; + Hashtable *fAvailableFormatKeyHash; + UnicodeString emptyString; + char16_t fDefaultHourFormatChar; + + int32_t fAllowedHourFormats[7]; // Actually an array of AllowedHourFormat enum type, ending with UNKNOWN. + + /* internal flags masks for adjustFieldTypes etc. */ + enum { + kDTPGNoFlags = 0, + kDTPGFixFractionalSeconds = 1, + kDTPGSkeletonUsesCapJ = 2 + // with #13183, no longer need flags for b, B + }; + + void initData(const Locale &locale, UErrorCode &status); + void addCanonicalItems(UErrorCode &status); + void addICUPatterns(const Locale& locale, UErrorCode& status); + void hackTimes(const UnicodeString& hackPattern, UErrorCode& status); + void getCalendarTypeToUse(const Locale& locale, CharString& destination, UErrorCode& err); + void consumeShortTimePattern(const UnicodeString& shortTimePattern, UErrorCode& status); + void addCLDRData(const Locale& locale, UErrorCode& status); + UDateTimePatternConflict addPatternWithSkeleton(const UnicodeString& pattern, const UnicodeString * skeletonToUse, UBool override, UnicodeString& conflictingPattern, UErrorCode& status); + void initHashtable(UErrorCode& status); + void setDateTimeFromCalendar(const Locale& locale, UErrorCode& status); + void setDecimalSymbols(const Locale& locale, UErrorCode& status); + UDateTimePatternField getAppendFormatNumber(const char* field) const; + UDateTimePatternField getAppendNameNumber(const char* field) const; + UnicodeString& getMutableAppendItemName(UDateTimePatternField field); + void getAppendName(UDateTimePatternField field, UnicodeString& value); + UnicodeString mapSkeletonMetacharacters(const UnicodeString& patternForm, int32_t* flags, UErrorCode& status); + int32_t getCanonicalIndex(const UnicodeString& field); + const UnicodeString* getBestRaw(DateTimeMatcher& source, int32_t includeMask, DistanceInfo* missingFields, const PtnSkeleton** specifiedSkeletonPtr = 0); + UnicodeString adjustFieldTypes(const UnicodeString& pattern, const PtnSkeleton* specifiedSkeleton, int32_t flags, UDateTimePatternMatchOptions options = UDATPG_MATCH_NO_OPTIONS); + UnicodeString getBestAppending(int32_t missingFields, int32_t flags, UDateTimePatternMatchOptions options = UDATPG_MATCH_NO_OPTIONS); + int32_t getTopBitNumber(int32_t foundMask); + void setAvailableFormat(const UnicodeString &key, UErrorCode& status); + UBool isAvailableFormatSet(const UnicodeString &key) const; + void copyHashtable(Hashtable *other, UErrorCode &status); + UBool isCanonicalItem(const UnicodeString& item) const; + static void U_CALLCONV loadAllowedHourFormatsData(UErrorCode &status); + void getAllowedHourFormats(const Locale &locale, UErrorCode &status); + + struct AppendItemFormatsSink; + struct AppendItemNamesSink; + struct AvailableFormatsSink; +} ;// end class DateTimePatternGenerator + +U_NAMESPACE_END + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/dtrule.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/dtrule.h new file mode 100644 index 0000000..0767249 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/dtrule.h @@ -0,0 +1,252 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2007-2008, International Business Machines Corporation and * +* others. All Rights Reserved. * +******************************************************************************* +*/ +#ifndef DTRULE_H +#define DTRULE_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Rule for specifying date and time in an year + */ + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/uobject.h" + +U_NAMESPACE_BEGIN +/** + * DateTimeRule is a class representing a time in a year by + * a rule specified by month, day of month, day of week and + * time in the day. + * + * @stable ICU 3.8 + */ +class U_I18N_API DateTimeRule : public UObject { +public: + + /** + * Date rule type constants. + * @stable ICU 3.8 + */ + enum DateRuleType { + DOM = 0, /**< The exact day of month, + for example, March 11. */ + DOW, /**< The Nth occurence of the day of week, + for example, 2nd Sunday in March. */ + DOW_GEQ_DOM, /**< The first occurence of the day of week on or after the day of monnth, + for example, first Sunday on or after March 8. */ + DOW_LEQ_DOM /**< The last occurence of the day of week on or before the day of month, + for example, first Sunday on or before March 14. */ + }; + + /** + * Time rule type constants. + * @stable ICU 3.8 + */ + enum TimeRuleType { + WALL_TIME = 0, /**< The local wall clock time */ + STANDARD_TIME, /**< The local standard time */ + UTC_TIME /**< The UTC time */ + }; + + /** + * Constructs a DateTimeRule by the day of month and + * the time rule. The date rule type for an instance created by + * this constructor is DOM. + * + * @param month The rule month, for example, Calendar::JANUARY + * @param dayOfMonth The day of month, 1-based. + * @param millisInDay The milliseconds in the rule date. + * @param timeType The time type, WALL_TIME or STANDARD_TIME + * or UTC_TIME. + * @stable ICU 3.8 + */ + DateTimeRule(int32_t month, int32_t dayOfMonth, + int32_t millisInDay, TimeRuleType timeType); + + /** + * Constructs a DateTimeRule by the day of week and its oridinal + * number and the time rule. The date rule type for an instance created + * by this constructor is DOW. + * + * @param month The rule month, for example, Calendar::JANUARY. + * @param weekInMonth The ordinal number of the day of week. Negative number + * may be used for specifying a rule date counted from the + * end of the rule month. + * @param dayOfWeek The day of week, for example, Calendar::SUNDAY. + * @param millisInDay The milliseconds in the rule date. + * @param timeType The time type, WALL_TIME or STANDARD_TIME + * or UTC_TIME. + * @stable ICU 3.8 + */ + DateTimeRule(int32_t month, int32_t weekInMonth, int32_t dayOfWeek, + int32_t millisInDay, TimeRuleType timeType); + + /** + * Constructs a DateTimeRule by the first/last day of week + * on or after/before the day of month and the time rule. The date rule + * type for an instance created by this constructor is either + * DOM_GEQ_DOM or DOM_LEQ_DOM. + * + * @param month The rule month, for example, Calendar::JANUARY + * @param dayOfMonth The day of month, 1-based. + * @param dayOfWeek The day of week, for example, Calendar::SUNDAY. + * @param after true if the rule date is on or after the day of month. + * @param millisInDay The milliseconds in the rule date. + * @param timeType The time type, WALL_TIME or STANDARD_TIME + * or UTC_TIME. + * @stable ICU 3.8 + */ + DateTimeRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, UBool after, + int32_t millisInDay, TimeRuleType timeType); + + /** + * Copy constructor. + * @param source The DateTimeRule object to be copied. + * @stable ICU 3.8 + */ + DateTimeRule(const DateTimeRule& source); + + /** + * Destructor. + * @stable ICU 3.8 + */ + ~DateTimeRule(); + + /** + * Clone this DateTimeRule object polymorphically. The caller owns the result and + * should delete it when done. + * @return A copy of the object. + * @stable ICU 3.8 + */ + DateTimeRule* clone(void) const; + + /** + * Assignment operator. + * @param right The object to be copied. + * @stable ICU 3.8 + */ + DateTimeRule& operator=(const DateTimeRule& right); + + /** + * Return true if the given DateTimeRule objects are semantically equal. Objects + * of different subclasses are considered unequal. + * @param that The object to be compared with. + * @return true if the given DateTimeRule objects are semantically equal. + * @stable ICU 3.8 + */ + UBool operator==(const DateTimeRule& that) const; + + /** + * Return true if the given DateTimeRule objects are semantically unequal. Objects + * of different subclasses are considered unequal. + * @param that The object to be compared with. + * @return true if the given DateTimeRule objects are semantically unequal. + * @stable ICU 3.8 + */ + UBool operator!=(const DateTimeRule& that) const; + + /** + * Gets the date rule type, such as DOM + * @return The date rule type. + * @stable ICU 3.8 + */ + DateRuleType getDateRuleType(void) const; + + /** + * Gets the time rule type + * @return The time rule type, either WALL_TIME or STANDARD_TIME + * or UTC_TIME. + * @stable ICU 3.8 + */ + TimeRuleType getTimeRuleType(void) const; + + /** + * Gets the rule month. + * @return The rule month. + * @stable ICU 3.8 + */ + int32_t getRuleMonth(void) const; + + /** + * Gets the rule day of month. When the date rule type + * is DOW, the value is always 0. + * @return The rule day of month + * @stable ICU 3.8 + */ + int32_t getRuleDayOfMonth(void) const; + + /** + * Gets the rule day of week. When the date rule type + * is DOM, the value is always 0. + * @return The rule day of week. + * @stable ICU 3.8 + */ + int32_t getRuleDayOfWeek(void) const; + + /** + * Gets the ordinal number of the occurence of the day of week + * in the month. When the date rule type is not DOW, + * the value is always 0. + * @return The rule day of week ordinal number in the month. + * @stable ICU 3.8 + */ + int32_t getRuleWeekInMonth(void) const; + + /** + * Gets the rule time in the rule day. + * @return The time in the rule day in milliseconds. + * @stable ICU 3.8 + */ + int32_t getRuleMillisInDay(void) const; + +private: + int32_t fMonth; + int32_t fDayOfMonth; + int32_t fDayOfWeek; + int32_t fWeekInMonth; + int32_t fMillisInDay; + DateRuleType fDateRuleType; + TimeRuleType fTimeRuleType; + +public: + /** + * Return the class ID for this class. This is useful only for comparing to + * a return value from getDynamicClassID(). For example: + *

+     * .   Base* polymorphic_pointer = createPolymorphicObject();
+     * .   if (polymorphic_pointer->getDynamicClassID() ==
+     * .       erived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @stable ICU 3.8 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This + * method is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and clone() + * methods call this method. + * + * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @stable ICU 3.8 + */ + virtual UClassID getDynamicClassID(void) const; +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // DTRULE_H +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/edits.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/edits.h new file mode 100644 index 0000000..082c373 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/edits.h @@ -0,0 +1,422 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// edits.h +// created: 2016dec30 Markus W. Scherer + +#ifndef __EDITS_H__ +#define __EDITS_H__ + +#include "unicode/utypes.h" +#include "unicode/uobject.h" + +/** + * \file + * \brief C++ API: C++ class Edits for low-level string transformations on styled text. + */ + +U_NAMESPACE_BEGIN + +#ifndef U_HIDE_DRAFT_API + +/** + * Records lengths of string edits but not replacement text. + * Supports replacements, insertions, deletions in linear progression. + * Does not support moving/reordering of text. + * + * An Edits object tracks a separate UErrorCode, but ICU string transformation functions + * (e.g., case mapping functions) merge any such errors into their API's UErrorCode. + * + * @draft ICU 59 + */ +class U_COMMON_API Edits U_FINAL : public UMemory { +public: + /** + * Constructs an empty object. + * @draft ICU 59 + */ + Edits() : + array(stackArray), capacity(STACK_CAPACITY), length(0), delta(0), numChanges(0), + errorCode_(U_ZERO_ERROR) {} + /** + * Copy constructor. + * @param other source edits + * @draft ICU 60 + */ + Edits(const Edits &other) : + array(stackArray), capacity(STACK_CAPACITY), length(other.length), + delta(other.delta), numChanges(other.numChanges), + errorCode_(other.errorCode_) { + copyArray(other); + } + /** + * Move constructor, might leave src empty. + * This object will have the same contents that the source object had. + * @param src source edits + * @draft ICU 60 + */ + Edits(Edits &&src) U_NOEXCEPT : + array(stackArray), capacity(STACK_CAPACITY), length(src.length), + delta(src.delta), numChanges(src.numChanges), + errorCode_(src.errorCode_) { + moveArray(src); + } + + /** + * Destructor. + * @draft ICU 59 + */ + ~Edits(); + + /** + * Assignment operator. + * @param other source edits + * @return *this + * @draft ICU 60 + */ + Edits &operator=(const Edits &other); + + /** + * Move assignment operator, might leave src empty. + * This object will have the same contents that the source object had. + * The behavior is undefined if *this and src are the same object. + * @param src source edits + * @return *this + * @draft ICU 60 + */ + Edits &operator=(Edits &&src) U_NOEXCEPT; + + /** + * Resets the data but may not release memory. + * @draft ICU 59 + */ + void reset() U_NOEXCEPT; + + /** + * Adds a record for an unchanged segment of text. + * Normally called from inside ICU string transformation functions, not user code. + * @draft ICU 59 + */ + void addUnchanged(int32_t unchangedLength); + /** + * Adds a record for a text replacement/insertion/deletion. + * Normally called from inside ICU string transformation functions, not user code. + * @draft ICU 59 + */ + void addReplace(int32_t oldLength, int32_t newLength); + /** + * Sets the UErrorCode if an error occurred while recording edits. + * Preserves older error codes in the outErrorCode. + * Normally called from inside ICU string transformation functions, not user code. + * @param outErrorCode Set to an error code if it does not contain one already + * and an error occurred while recording edits. + * Otherwise unchanged. + * @return TRUE if U_FAILURE(outErrorCode) + * @draft ICU 59 + */ + UBool copyErrorTo(UErrorCode &outErrorCode); + + /** + * How much longer is the new text compared with the old text? + * @return new length minus old length + * @draft ICU 59 + */ + int32_t lengthDelta() const { return delta; } + /** + * @return TRUE if there are any change edits + * @draft ICU 59 + */ + UBool hasChanges() const { return numChanges != 0; } + + /** + * @return the number of change edits + * @draft ICU 60 + */ + int32_t numberOfChanges() const { return numChanges; } + + /** + * Access to the list of edits. + * @see getCoarseIterator + * @see getFineIterator + * @draft ICU 59 + */ + struct U_COMMON_API Iterator U_FINAL : public UMemory { + /** + * Default constructor, empty iterator. + * @draft ICU 60 + */ + Iterator() : + array(nullptr), index(0), length(0), + remaining(0), onlyChanges_(FALSE), coarse(FALSE), + dir(0), changed(FALSE), oldLength_(0), newLength_(0), + srcIndex(0), replIndex(0), destIndex(0) {} + /** + * Copy constructor. + * @draft ICU 59 + */ + Iterator(const Iterator &other) = default; + /** + * Assignment operator. + * @draft ICU 59 + */ + Iterator &operator=(const Iterator &other) = default; + + /** + * Advances to the next edit. + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return TRUE if there is another edit + * @draft ICU 59 + */ + UBool next(UErrorCode &errorCode) { return next(onlyChanges_, errorCode); } + + /** + * Finds the edit that contains the source index. + * The source index may be found in a non-change + * even if normal iteration would skip non-changes. + * Normal iteration can continue from a found edit. + * + * The iterator state before this search logically does not matter. + * (It may affect the performance of the search.) + * + * The iterator state after this search is undefined + * if the source index is out of bounds for the source string. + * + * @param i source index + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return TRUE if the edit for the source index was found + * @draft ICU 59 + */ + UBool findSourceIndex(int32_t i, UErrorCode &errorCode) { + return findIndex(i, TRUE, errorCode) == 0; + } + + /** + * Finds the edit that contains the destination index. + * The destination index may be found in a non-change + * even if normal iteration would skip non-changes. + * Normal iteration can continue from a found edit. + * + * The iterator state before this search logically does not matter. + * (It may affect the performance of the search.) + * + * The iterator state after this search is undefined + * if the source index is out of bounds for the source string. + * + * @param i destination index + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return TRUE if the edit for the destination index was found + * @draft ICU 60 + */ + UBool findDestinationIndex(int32_t i, UErrorCode &errorCode) { + return findIndex(i, FALSE, errorCode) == 0; + } + + /** + * Returns the destination index corresponding to the given source index. + * If the source index is inside a change edit (not at its start), + * then the destination index at the end of that edit is returned, + * since there is no information about index mapping inside a change edit. + * + * (This means that indexes to the start and middle of an edit, + * for example around a grapheme cluster, are mapped to indexes + * encompassing the entire edit. + * The alternative, mapping an interior index to the start, + * would map such an interval to an empty one.) + * + * This operation will usually but not always modify this object. + * The iterator state after this search is undefined. + * + * @param i source index + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return destination index; undefined if i is not 0..string length + * @draft ICU 60 + */ + int32_t destinationIndexFromSourceIndex(int32_t i, UErrorCode &errorCode); + + /** + * Returns the source index corresponding to the given destination index. + * If the destination index is inside a change edit (not at its start), + * then the source index at the end of that edit is returned, + * since there is no information about index mapping inside a change edit. + * + * (This means that indexes to the start and middle of an edit, + * for example around a grapheme cluster, are mapped to indexes + * encompassing the entire edit. + * The alternative, mapping an interior index to the start, + * would map such an interval to an empty one.) + * + * This operation will usually but not always modify this object. + * The iterator state after this search is undefined. + * + * @param i destination index + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return source index; undefined if i is not 0..string length + * @draft ICU 60 + */ + int32_t sourceIndexFromDestinationIndex(int32_t i, UErrorCode &errorCode); + + /** + * @return TRUE if this edit replaces oldLength() units with newLength() different ones. + * FALSE if oldLength units remain unchanged. + * @draft ICU 59 + */ + UBool hasChange() const { return changed; } + /** + * @return the number of units in the original string which are replaced or remain unchanged. + * @draft ICU 59 + */ + int32_t oldLength() const { return oldLength_; } + /** + * @return the number of units in the modified string, if hasChange() is TRUE. + * Same as oldLength if hasChange() is FALSE. + * @draft ICU 59 + */ + int32_t newLength() const { return newLength_; } + + /** + * @return the current index into the source string + * @draft ICU 59 + */ + int32_t sourceIndex() const { return srcIndex; } + /** + * @return the current index into the replacement-characters-only string, + * not counting unchanged spans + * @draft ICU 59 + */ + int32_t replacementIndex() const { return replIndex; } + /** + * @return the current index into the full destination string + * @draft ICU 59 + */ + int32_t destinationIndex() const { return destIndex; } + + private: + friend class Edits; + + Iterator(const uint16_t *a, int32_t len, UBool oc, UBool crs); + + int32_t readLength(int32_t head); + void updateNextIndexes(); + void updatePreviousIndexes(); + UBool noNext(); + UBool next(UBool onlyChanges, UErrorCode &errorCode); + UBool previous(UErrorCode &errorCode); + /** @return -1: error or i<0; 0: found; 1: i>=string length */ + int32_t findIndex(int32_t i, UBool findSource, UErrorCode &errorCode); + + const uint16_t *array; + int32_t index, length; + // 0 if we are not within compressed equal-length changes. + // Otherwise the number of remaining changes, including the current one. + int32_t remaining; + UBool onlyChanges_, coarse; + + int8_t dir; // iteration direction: back(<0), initial(0), forward(>0) + UBool changed; + int32_t oldLength_, newLength_; + int32_t srcIndex, replIndex, destIndex; + }; + + /** + * Returns an Iterator for coarse-grained changes for simple string updates. + * Skips non-changes. + * @return an Iterator that merges adjacent changes. + * @draft ICU 59 + */ + Iterator getCoarseChangesIterator() const { + return Iterator(array, length, TRUE, TRUE); + } + + /** + * Returns an Iterator for coarse-grained changes and non-changes for simple string updates. + * @return an Iterator that merges adjacent changes. + * @draft ICU 59 + */ + Iterator getCoarseIterator() const { + return Iterator(array, length, FALSE, TRUE); + } + + /** + * Returns an Iterator for fine-grained changes for modifying styled text. + * Skips non-changes. + * @return an Iterator that separates adjacent changes. + * @draft ICU 59 + */ + Iterator getFineChangesIterator() const { + return Iterator(array, length, TRUE, FALSE); + } + + /** + * Returns an Iterator for fine-grained changes and non-changes for modifying styled text. + * @return an Iterator that separates adjacent changes. + * @draft ICU 59 + */ + Iterator getFineIterator() const { + return Iterator(array, length, FALSE, FALSE); + } + + /** + * Merges the two input Edits and appends the result to this object. + * + * Consider two string transformations (for example, normalization and case mapping) + * where each records Edits in addition to writing an output string.
+ * Edits ab reflect how substrings of input string a + * map to substrings of intermediate string b.
+ * Edits bc reflect how substrings of intermediate string b + * map to substrings of output string c.
+ * This function merges ab and bc such that the additional edits + * recorded in this object reflect how substrings of input string a + * map to substrings of output string c. + * + * If unrelated Edits are passed in where the output string of the first + * has a different length than the input string of the second, + * then a U_ILLEGAL_ARGUMENT_ERROR is reported. + * + * @param ab reflects how substrings of input string a + * map to substrings of intermediate string b. + * @param bc reflects how substrings of intermediate string b + * map to substrings of output string c. + * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test, + * or else the function returns immediately. Check for U_FAILURE() + * on output or use with function chaining. (See User Guide for details.) + * @return *this, with the merged edits appended + * @draft ICU 60 + */ + Edits &mergeAndAppend(const Edits &ab, const Edits &bc, UErrorCode &errorCode); + +private: + void releaseArray() U_NOEXCEPT; + Edits ©Array(const Edits &other); + Edits &moveArray(Edits &src) U_NOEXCEPT; + + void setLastUnit(int32_t last) { array[length - 1] = (uint16_t)last; } + int32_t lastUnit() const { return length > 0 ? array[length - 1] : 0xffff; } + + void append(int32_t r); + UBool growArray(); + + static const int32_t STACK_CAPACITY = 100; + uint16_t *array; + int32_t capacity; + int32_t length; + int32_t delta; + int32_t numChanges; + UErrorCode errorCode_; + uint16_t stackArray[STACK_CAPACITY]; +}; + +#endif // U_HIDE_DRAFT_API + +U_NAMESPACE_END + +#endif // __EDITS_H__ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/enumset.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/enumset.h new file mode 100644 index 0000000..f63dd16 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/enumset.h @@ -0,0 +1,66 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2012,2014 International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +*/ + +/** + * \file + * \brief C++: internal template EnumSet<> + */ + +#ifndef ENUMSET_H +#define ENUMSET_H + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/* Can't use #ifndef U_HIDE_INTERNAL_API for the entire EnumSet class, needed in .h file declarations */ +/** + * enum bitset for boolean fields. Similar to Java EnumSet<>. + * Needs to range check. Used for private instance variables. + * @internal + */ +template +class EnumSet { +public: + inline EnumSet() : fBools(0) {} + inline EnumSet(const EnumSet& other) : fBools(other.fBools) {} + inline ~EnumSet() {} +#ifndef U_HIDE_INTERNAL_API + inline void clear() { fBools=0; } + inline void add(T toAdd) { set(toAdd, 1); } + inline void remove(T toRemove) { set(toRemove, 0); } + inline int32_t contains(T toCheck) const { return get(toCheck); } + inline void set(T toSet, int32_t v) { fBools=(fBools&(~flag(toSet)))|(v?(flag(toSet)):0); } + inline int32_t get(T toCheck) const { return (fBools & flag(toCheck))?1:0; } + inline UBool isValidEnum(T toCheck) const { return (toCheck>=minValue&&toCheck& operator=(const EnumSet& other) { + fBools = other.fBools; + return *this; + } + + inline uint32_t getAll() const { + return fBools; + } +#endif /* U_HIDE_INTERNAL_API */ + +private: + inline uint32_t flag(T toCheck) const { return (1<<(toCheck-minValue)); } +private: + uint32_t fBools; +}; + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ +#endif /* ENUMSET_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/errorcode.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/errorcode.h new file mode 100644 index 0000000..81cad20 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/errorcode.h @@ -0,0 +1,139 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2009-2011, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: errorcode.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2009mar10 +* created by: Markus W. Scherer +*/ + +#ifndef __ERRORCODE_H__ +#define __ERRORCODE_H__ + +/** + * \file + * \brief C++ API: ErrorCode class intended to make it easier to use + * ICU C and C++ APIs from C++ user code. + */ + +#include "unicode/utypes.h" +#include "unicode/uobject.h" + +U_NAMESPACE_BEGIN + +/** + * Wrapper class for UErrorCode, with conversion operators for direct use + * in ICU C and C++ APIs. + * Intended to be used as a base class, where a subclass overrides + * the handleFailure() function so that it throws an exception, + * does an assert(), logs an error, etc. + * This is not an abstract base class. This class can be used and instantiated + * by itself, although it will be more useful when subclassed. + * + * Features: + * - The constructor initializes the internal UErrorCode to U_ZERO_ERROR, + * removing one common source of errors. + * - Same use in C APIs taking a UErrorCode * (pointer) + * and C++ taking UErrorCode & (reference) via conversion operators. + * - Possible automatic checking for success when it goes out of scope. + * + * Note: For automatic checking for success in the destructor, a subclass + * must implement such logic in its own destructor because the base class + * destructor cannot call a subclass function (like handleFailure()). + * The ErrorCode base class destructor does nothing. + * + * Note also: While it is possible for a destructor to throw an exception, + * it is generally unsafe to do so. This means that in a subclass the destructor + * and the handleFailure() function may need to take different actions. + * + * Sample code: + * \code + * class IcuErrorCode: public icu::ErrorCode { + * public: + * virtual ~IcuErrorCode() { // should be defined in .cpp as "key function" + * // Safe because our handleFailure() does not throw exceptions. + * if(isFailure()) { handleFailure(); } + * } + * protected: + * virtual void handleFailure() const { + * log_failure(u_errorName(errorCode)); + * exit(errorCode); + * } + * }; + * IcuErrorCode error_code; + * UConverter *cnv = ucnv_open("Shift-JIS", error_code); + * length = ucnv_fromUChars(dest, capacity, src, length, error_code); + * ucnv_close(cnv); + * // IcuErrorCode destructor checks for success. + * \endcode + * + * @stable ICU 4.2 + */ +class U_COMMON_API ErrorCode: public UMemory { +public: + /** + * Default constructor. Initializes its UErrorCode to U_ZERO_ERROR. + * @stable ICU 4.2 + */ + ErrorCode() : errorCode(U_ZERO_ERROR) {} + /** Destructor, does nothing. See class documentation for details. @stable ICU 4.2 */ + virtual ~ErrorCode(); + /** Conversion operator, returns a reference. @stable ICU 4.2 */ + operator UErrorCode & () { return errorCode; } + /** Conversion operator, returns a pointer. @stable ICU 4.2 */ + operator UErrorCode * () { return &errorCode; } + /** Tests for U_SUCCESS(). @stable ICU 4.2 */ + UBool isSuccess() const { return U_SUCCESS(errorCode); } + /** Tests for U_FAILURE(). @stable ICU 4.2 */ + UBool isFailure() const { return U_FAILURE(errorCode); } + /** Returns the UErrorCode value. @stable ICU 4.2 */ + UErrorCode get() const { return errorCode; } + /** Sets the UErrorCode value. @stable ICU 4.2 */ + void set(UErrorCode value) { errorCode=value; } + /** Returns the UErrorCode value and resets it to U_ZERO_ERROR. @stable ICU 4.2 */ + UErrorCode reset(); + /** + * Asserts isSuccess(). + * In other words, this method checks for a failure code, + * and the base class handles it like this: + * \code + * if(isFailure()) { handleFailure(); } + * \endcode + * @stable ICU 4.4 + */ + void assertSuccess() const; + /** + * Return a string for the UErrorCode value. + * The string will be the same as the name of the error code constant + * in the UErrorCode enum. + * @stable ICU 4.4 + */ + const char* errorName() const; + +protected: + /** + * Internal UErrorCode, accessible to subclasses. + * @stable ICU 4.2 + */ + UErrorCode errorCode; + /** + * Called by assertSuccess() if isFailure() is true. + * A subclass should override this function to deal with a failure code: + * Throw an exception, log an error, terminate the program, or similar. + * @stable ICU 4.2 + */ + virtual void handleFailure() const {} +}; + +U_NAMESPACE_END + +#endif // __ERRORCODE_H__ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/fieldpos.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/fieldpos.h new file mode 100644 index 0000000..0bcc8da --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/fieldpos.h @@ -0,0 +1,294 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ******************************************************************************** + * Copyright (C) 1997-2006, International Business Machines + * Corporation and others. All Rights Reserved. + ******************************************************************************** + * + * File FIELDPOS.H + * + * Modification History: + * + * Date Name Description + * 02/25/97 aliu Converted from java. + * 03/17/97 clhuang Updated per Format implementation. + * 07/17/98 stephen Added default/copy ctors, and operators =, ==, != + ******************************************************************************** + */ + +// ***************************************************************************** +// This file was generated from the java source file FieldPosition.java +// ***************************************************************************** + +#ifndef FIELDPOS_H +#define FIELDPOS_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: FieldPosition identifies the fields in a formatted output. + */ + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/uobject.h" + +U_NAMESPACE_BEGIN + +/** + * FieldPosition is a simple class used by Format + * and its subclasses to identify fields in formatted output. Fields are + * identified by constants, whose names typically end with _FIELD, + * defined in the various subclasses of Format. See + * ERA_FIELD and its friends in DateFormat for + * an example. + * + *

+ * FieldPosition keeps track of the position of the + * field within the formatted output with two indices: the index + * of the first character of the field and the index of the last + * character of the field. + * + *

+ * One version of the format method in the various + * Format classes requires a FieldPosition + * object as an argument. You use this format method + * to perform partial formatting or to get information about the + * formatted output (such as the position of a field). + * + * The FieldPosition class is not intended for public subclassing. + * + *

+ * Below is an example of using FieldPosition to aid + * alignment of an array of formatted floating-point numbers on + * their decimal points: + *

+ * \code
+ *       double doubleNum[] = {123456789.0, -12345678.9, 1234567.89, -123456.789,
+ *                  12345.6789, -1234.56789, 123.456789, -12.3456789, 1.23456789};
+ *       int dNumSize = (int)(sizeof(doubleNum)/sizeof(double));
+ *       
+ *       UErrorCode status = U_ZERO_ERROR;
+ *       DecimalFormat* fmt = (DecimalFormat*) NumberFormat::createInstance(status);
+ *       fmt->setDecimalSeparatorAlwaysShown(true);
+ *       
+ *       const int tempLen = 20;
+ *       char temp[tempLen];
+ *       
+ *       for (int i=0; iformat(doubleNum[i], buf, pos), fmtText);
+ *           for (int j=0; j
+ * 

+ * The code will generate the following output: + *

+ * \code
+ *           123,456,789.000
+ *           -12,345,678.900
+ *             1,234,567.880
+ *              -123,456.789
+ *                12,345.678
+ *                -1,234.567
+ *                   123.456
+ *                   -12.345
+ *                     1.234
+ *  \endcode
+ * 
+ */ +class U_I18N_API FieldPosition : public UObject { +public: + /** + * DONT_CARE may be specified as the field to indicate that the + * caller doesn't need to specify a field. + * @stable ICU 2.0 + */ + enum { DONT_CARE = -1 }; + + /** + * Creates a FieldPosition object with a non-specified field. + * @stable ICU 2.0 + */ + FieldPosition() + : UObject(), fField(DONT_CARE), fBeginIndex(0), fEndIndex(0) {} + + /** + * Creates a FieldPosition object for the given field. Fields are + * identified by constants, whose names typically end with _FIELD, + * in the various subclasses of Format. + * + * @see NumberFormat#INTEGER_FIELD + * @see NumberFormat#FRACTION_FIELD + * @see DateFormat#YEAR_FIELD + * @see DateFormat#MONTH_FIELD + * @stable ICU 2.0 + */ + FieldPosition(int32_t field) + : UObject(), fField(field), fBeginIndex(0), fEndIndex(0) {} + + /** + * Copy constructor + * @param copy the object to be copied from. + * @stable ICU 2.0 + */ + FieldPosition(const FieldPosition& copy) + : UObject(copy), fField(copy.fField), fBeginIndex(copy.fBeginIndex), fEndIndex(copy.fEndIndex) {} + + /** + * Destructor + * @stable ICU 2.0 + */ + virtual ~FieldPosition(); + + /** + * Assignment operator + * @param copy the object to be copied from. + * @stable ICU 2.0 + */ + FieldPosition& operator=(const FieldPosition& copy); + + /** + * Equality operator. + * @param that the object to be compared with. + * @return TRUE if the two field positions are equal, FALSE otherwise. + * @stable ICU 2.0 + */ + UBool operator==(const FieldPosition& that) const; + + /** + * Equality operator. + * @param that the object to be compared with. + * @return TRUE if the two field positions are not equal, FALSE otherwise. + * @stable ICU 2.0 + */ + UBool operator!=(const FieldPosition& that) const; + + /** + * Clone this object. + * Clones can be used concurrently in multiple threads. + * If an error occurs, then NULL is returned. + * The caller must delete the clone. + * + * @return a clone of this object + * + * @see getDynamicClassID + * @stable ICU 2.8 + */ + FieldPosition *clone() const; + + /** + * Retrieve the field identifier. + * @return the field identifier. + * @stable ICU 2.0 + */ + int32_t getField(void) const { return fField; } + + /** + * Retrieve the index of the first character in the requested field. + * @return the index of the first character in the requested field. + * @stable ICU 2.0 + */ + int32_t getBeginIndex(void) const { return fBeginIndex; } + + /** + * Retrieve the index of the character following the last character in the + * requested field. + * @return the index of the character following the last character in the + * requested field. + * @stable ICU 2.0 + */ + int32_t getEndIndex(void) const { return fEndIndex; } + + /** + * Set the field. + * @param f the new value of the field. + * @stable ICU 2.0 + */ + void setField(int32_t f) { fField = f; } + + /** + * Set the begin index. For use by subclasses of Format. + * @param bi the new value of the begin index + * @stable ICU 2.0 + */ + void setBeginIndex(int32_t bi) { fBeginIndex = bi; } + + /** + * Set the end index. For use by subclasses of Format. + * @param ei the new value of the end index + * @stable ICU 2.0 + */ + void setEndIndex(int32_t ei) { fEndIndex = ei; } + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.2 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.2 + */ + static UClassID U_EXPORT2 getStaticClassID(); + +private: + /** + * Input: Desired field to determine start and end offsets for. + * The meaning depends on the subclass of Format. + */ + int32_t fField; + + /** + * Output: Start offset of field in text. + * If the field does not occur in the text, 0 is returned. + */ + int32_t fBeginIndex; + + /** + * Output: End offset of field in text. + * If the field does not occur in the text, 0 is returned. + */ + int32_t fEndIndex; +}; + +inline FieldPosition& +FieldPosition::operator=(const FieldPosition& copy) +{ + fField = copy.fField; + fEndIndex = copy.fEndIndex; + fBeginIndex = copy.fBeginIndex; + return *this; +} + +inline UBool +FieldPosition::operator==(const FieldPosition& copy) const +{ + return (fField == copy.fField && + fEndIndex == copy.fEndIndex && + fBeginIndex == copy.fBeginIndex); +} + +inline UBool +FieldPosition::operator!=(const FieldPosition& copy) const +{ + return !operator==(copy); +} + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // _FIELDPOS +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/filteredbrk.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/filteredbrk.h new file mode 100644 index 0000000..a0319bf --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/filteredbrk.h @@ -0,0 +1,153 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************** +* Copyright (C) 1997-2015, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************** +*/ + +#ifndef FILTEREDBRK_H +#define FILTEREDBRK_H + +#include "unicode/utypes.h" +#include "unicode/brkiter.h" + +#if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION + +U_NAMESPACE_BEGIN + +/** + * \file + * \brief C++ API: FilteredBreakIteratorBuilder + */ + +/** + * The BreakIteratorFilter is used to modify the behavior of a BreakIterator + * by constructing a new BreakIterator which suppresses certain segment boundaries. + * See http://www.unicode.org/reports/tr35/tr35-general.html#Segmentation_Exceptions . + * For example, a typical English Sentence Break Iterator would break on the space + * in the string "Mr. Smith" (resulting in two segments), + * but with "Mr." as an exception, a filtered break iterator + * would consider the string "Mr. Smith" to be a single segment. + * + * @stable ICU 56 + */ +class U_COMMON_API FilteredBreakIteratorBuilder : public UObject { + public: + /** + * destructor. + * @stable ICU 56 + */ + virtual ~FilteredBreakIteratorBuilder(); + + /** + * Construct a FilteredBreakIteratorBuilder based on rules in a locale. + * The rules are taken from CLDR exception data for the locale, + * see http://www.unicode.org/reports/tr35/tr35-general.html#Segmentation_Exceptions + * This is the equivalent of calling createInstance(UErrorCode&) + * and then repeatedly calling addNoBreakAfter(...) with the contents + * of the CLDR exception data. + * @param where the locale. + * @param status The error code. + * @return the new builder + * @stable ICU 56 + */ + static FilteredBreakIteratorBuilder *createInstance(const Locale& where, UErrorCode& status); + +#ifndef U_HIDE_DEPRECATED_API + /** + * This function has been deprecated in favor of createEmptyInstance, which has + * identical behavior. + * @param status The error code. + * @return the new builder + * @deprecated ICU 60 use createEmptyInstance instead + * @see createEmptyInstance() + */ + static inline FilteredBreakIteratorBuilder *createInstance(UErrorCode &status) { + return createEmptyInstance(status); + } +#endif /* U_HIDE_DEPRECATED_API */ + +#ifndef U_HIDE_DRAFT_API + /** + * Construct an empty FilteredBreakIteratorBuilder. + * In this state, it will not suppress any segment boundaries. + * @param status The error code. + * @return the new builder + * @draft ICU 60 + */ + static FilteredBreakIteratorBuilder *createEmptyInstance(UErrorCode &status); +#endif /* U_HIDE_DRAFT_API */ + + /** + * Suppress a certain string from being the end of a segment. + * For example, suppressing "Mr.", then segments ending in "Mr." will not be returned + * by the iterator. + * @param string the string to suppress, such as "Mr." + * @param status error code + * @return returns TRUE if the string was not present and now added, + * FALSE if the call was a no-op because the string was already being suppressed. + * @stable ICU 56 + */ + virtual UBool suppressBreakAfter(const UnicodeString& string, UErrorCode& status) = 0; + + /** + * Stop suppressing a certain string from being the end of the segment. + * This function does not create any new segment boundaries, but only serves to un-do + * the effect of earlier calls to suppressBreakAfter, or to un-do the effect of + * locale data which may be suppressing certain strings. + * @param exception the exception to remove + * @param status error code + * @return returns TRUE if the string was present and now removed, + * FALSE if the call was a no-op because the string was not being suppressed. + * @stable ICU 56 + */ + virtual UBool unsuppressBreakAfter(const UnicodeString& string, UErrorCode& status) = 0; + +#ifndef U_HIDE_DEPRECATED_API + /** + * This function has been deprecated in favor of wrapIteratorWithFilter() + * The behavior is identical. + * @param adoptBreakIterator the break iterator to adopt + * @param status error code + * @return the new BreakIterator, owned by the caller. + * @deprecated ICU 60 use wrapIteratorWithFilter() instead + * @see wrapBreakIteratorWithFilter() + */ + virtual BreakIterator *build(BreakIterator* adoptBreakIterator, UErrorCode& status) = 0; +#endif /* U_HIDE_DEPRECATED_API */ + +#ifndef U_HIDE_DRAFT_API + /** + * Wrap (adopt) an existing break iterator in a new filtered instance. + * The resulting BreakIterator is owned by the caller. + * The BreakIteratorFilter may be destroyed before the BreakIterator is destroyed. + * Note that the adoptBreakIterator is adopted by the new BreakIterator + * and should no longer be used by the caller. + * The FilteredBreakIteratorBuilder may be reused. + * This function is an alias for build() + * @param adoptBreakIterator the break iterator to adopt + * @param status error code + * @return the new BreakIterator, owned by the caller. + * @draft ICU 60 + */ + inline BreakIterator *wrapIteratorWithFilter(BreakIterator* adoptBreakIterator, UErrorCode& status) { + return build(adoptBreakIterator, status); + } +#endif /* U_HIDE_DRAFT_API */ + + protected: + /** + * For subclass use + * @stable ICU 56 + */ + FilteredBreakIteratorBuilder(); +}; + + +U_NAMESPACE_END + +#endif // #if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION + +#endif // #ifndef FILTEREDBRK_H diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/fmtable.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/fmtable.h new file mode 100644 index 0000000..766a719 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/fmtable.h @@ -0,0 +1,762 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************** +* Copyright (C) 1997-2014, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************** +* +* File FMTABLE.H +* +* Modification History: +* +* Date Name Description +* 02/29/97 aliu Creation. +******************************************************************************** +*/ +#ifndef FMTABLE_H +#define FMTABLE_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Formattable is a thin wrapper for primitive types used for formatting and parsing + */ + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/unistr.h" +#include "unicode/stringpiece.h" +#include "unicode/uformattable.h" + +U_NAMESPACE_BEGIN + +class CharString; +class DigitList; + +/** + * \def UNUM_INTERNAL_STACKARRAY_SIZE + * @internal + */ +#if U_PLATFORM == U_PF_OS400 +#define UNUM_INTERNAL_STACKARRAY_SIZE 144 +#else +#define UNUM_INTERNAL_STACKARRAY_SIZE 128 +#endif + +/** + * Formattable objects can be passed to the Format class or + * its subclasses for formatting. Formattable is a thin wrapper + * class which interconverts between the primitive numeric types + * (double, long, etc.) as well as UDate and UnicodeString. + * + *

Internally, a Formattable object is a union of primitive types. + * As such, it can only store one flavor of data at a time. To + * determine what flavor of data it contains, use the getType method. + * + *

As of ICU 3.0, Formattable may also wrap a UObject pointer, + * which it owns. This allows an instance of any ICU class to be + * encapsulated in a Formattable. For legacy reasons and for + * efficiency, primitive numeric types are still stored directly + * within a Formattable. + * + *

The Formattable class is not suitable for subclassing. + * + *

See UFormattable for a C wrapper. + */ +class U_I18N_API Formattable : public UObject { +public: + /** + * This enum is only used to let callers distinguish between + * the Formattable(UDate) constructor and the Formattable(double) + * constructor; the compiler cannot distinguish the signatures, + * since UDate is currently typedefed to be either double or long. + * If UDate is changed later to be a bonafide class + * or struct, then we no longer need this enum. + * @stable ICU 2.4 + */ + enum ISDATE { kIsDate }; + + /** + * Default constructor + * @stable ICU 2.4 + */ + Formattable(); // Type kLong, value 0 + + /** + * Creates a Formattable object with a UDate instance. + * @param d the UDate instance. + * @param flag the flag to indicate this is a date. Always set it to kIsDate + * @stable ICU 2.0 + */ + Formattable(UDate d, ISDATE flag); + + /** + * Creates a Formattable object with a double number. + * @param d the double number. + * @stable ICU 2.0 + */ + Formattable(double d); + + /** + * Creates a Formattable object with a long number. + * @param l the long number. + * @stable ICU 2.0 + */ + Formattable(int32_t l); + + /** + * Creates a Formattable object with an int64_t number + * @param ll the int64_t number. + * @stable ICU 2.8 + */ + Formattable(int64_t ll); + +#if !UCONFIG_NO_CONVERSION + /** + * Creates a Formattable object with a char string pointer. + * Assumes that the char string is null terminated. + * @param strToCopy the char string. + * @stable ICU 2.0 + */ + Formattable(const char* strToCopy); +#endif + + /** + * Creates a Formattable object of an appropriate numeric type from a + * a decimal number in string form. The Formattable will retain the + * full precision of the input in decimal format, even when it exceeds + * what can be represented by a double or int64_t. + * + * @param number the unformatted (not localized) string representation + * of the Decimal number. + * @param status the error code. Possible errors include U_INVALID_FORMAT_ERROR + * if the format of the string does not conform to that of a + * decimal number. + * @stable ICU 4.4 + */ + Formattable(StringPiece number, UErrorCode &status); + + /** + * Creates a Formattable object with a UnicodeString object to copy from. + * @param strToCopy the UnicodeString string. + * @stable ICU 2.0 + */ + Formattable(const UnicodeString& strToCopy); + + /** + * Creates a Formattable object with a UnicodeString object to adopt from. + * @param strToAdopt the UnicodeString string. + * @stable ICU 2.0 + */ + Formattable(UnicodeString* strToAdopt); + + /** + * Creates a Formattable object with an array of Formattable objects. + * @param arrayToCopy the Formattable object array. + * @param count the array count. + * @stable ICU 2.0 + */ + Formattable(const Formattable* arrayToCopy, int32_t count); + + /** + * Creates a Formattable object that adopts the given UObject. + * @param objectToAdopt the UObject to set this object to + * @stable ICU 3.0 + */ + Formattable(UObject* objectToAdopt); + + /** + * Copy constructor. + * @stable ICU 2.0 + */ + Formattable(const Formattable&); + + /** + * Assignment operator. + * @param rhs The Formattable object to copy into this object. + * @stable ICU 2.0 + */ + Formattable& operator=(const Formattable &rhs); + + /** + * Equality comparison. + * @param other the object to be compared with. + * @return TRUE if other are equal to this, FALSE otherwise. + * @stable ICU 2.0 + */ + UBool operator==(const Formattable &other) const; + + /** + * Equality operator. + * @param other the object to be compared with. + * @return TRUE if other are unequal to this, FALSE otherwise. + * @stable ICU 2.0 + */ + UBool operator!=(const Formattable& other) const + { return !operator==(other); } + + /** + * Destructor. + * @stable ICU 2.0 + */ + virtual ~Formattable(); + + /** + * Clone this object. + * Clones can be used concurrently in multiple threads. + * If an error occurs, then NULL is returned. + * The caller must delete the clone. + * + * @return a clone of this object + * + * @see getDynamicClassID + * @stable ICU 2.8 + */ + Formattable *clone() const; + + /** + * Selector for flavor of data type contained within a + * Formattable object. Formattable is a union of several + * different types, and at any time contains exactly one type. + * @stable ICU 2.4 + */ + enum Type { + /** + * Selector indicating a UDate value. Use getDate to retrieve + * the value. + * @stable ICU 2.4 + */ + kDate, + + /** + * Selector indicating a double value. Use getDouble to + * retrieve the value. + * @stable ICU 2.4 + */ + kDouble, + + /** + * Selector indicating a 32-bit integer value. Use getLong to + * retrieve the value. + * @stable ICU 2.4 + */ + kLong, + + /** + * Selector indicating a UnicodeString value. Use getString + * to retrieve the value. + * @stable ICU 2.4 + */ + kString, + + /** + * Selector indicating an array of Formattables. Use getArray + * to retrieve the value. + * @stable ICU 2.4 + */ + kArray, + + /** + * Selector indicating a 64-bit integer value. Use getInt64 + * to retrieve the value. + * @stable ICU 2.8 + */ + kInt64, + + /** + * Selector indicating a UObject value. Use getObject to + * retrieve the value. + * @stable ICU 3.0 + */ + kObject + }; + + /** + * Gets the data type of this Formattable object. + * @return the data type of this Formattable object. + * @stable ICU 2.0 + */ + Type getType(void) const; + + /** + * Returns TRUE if the data type of this Formattable object + * is kDouble, kLong, or kInt64 + * @return TRUE if this is a pure numeric object + * @stable ICU 3.0 + */ + UBool isNumeric() const; + + /** + * Gets the double value of this object. If this object is not of type + * kDouble then the result is undefined. + * @return the double value of this object. + * @stable ICU 2.0 + */ + double getDouble(void) const { return fValue.fDouble; } + + /** + * Gets the double value of this object. If this object is of type + * long, int64 or Decimal Number then a conversion is peformed, with + * possible loss of precision. If the type is kObject and the + * object is a Measure, then the result of + * getNumber().getDouble(status) is returned. If this object is + * neither a numeric type nor a Measure, then 0 is returned and + * the status is set to U_INVALID_FORMAT_ERROR. + * @param status the error code + * @return the double value of this object. + * @stable ICU 3.0 + */ + double getDouble(UErrorCode& status) const; + + /** + * Gets the long value of this object. If this object is not of type + * kLong then the result is undefined. + * @return the long value of this object. + * @stable ICU 2.0 + */ + int32_t getLong(void) const { return (int32_t)fValue.fInt64; } + + /** + * Gets the long value of this object. If the magnitude is too + * large to fit in a long, then the maximum or minimum long value, + * as appropriate, is returned and the status is set to + * U_INVALID_FORMAT_ERROR. If this object is of type kInt64 and + * it fits within a long, then no precision is lost. If it is of + * type kDouble, then a conversion is peformed, with + * truncation of any fractional part. If the type is kObject and + * the object is a Measure, then the result of + * getNumber().getLong(status) is returned. If this object is + * neither a numeric type nor a Measure, then 0 is returned and + * the status is set to U_INVALID_FORMAT_ERROR. + * @param status the error code + * @return the long value of this object. + * @stable ICU 3.0 + */ + int32_t getLong(UErrorCode& status) const; + + /** + * Gets the int64 value of this object. If this object is not of type + * kInt64 then the result is undefined. + * @return the int64 value of this object. + * @stable ICU 2.8 + */ + int64_t getInt64(void) const { return fValue.fInt64; } + + /** + * Gets the int64 value of this object. If this object is of a numeric + * type and the magnitude is too large to fit in an int64, then + * the maximum or minimum int64 value, as appropriate, is returned + * and the status is set to U_INVALID_FORMAT_ERROR. If the + * magnitude fits in an int64, then a casting conversion is + * peformed, with truncation of any fractional part. If the type + * is kObject and the object is a Measure, then the result of + * getNumber().getDouble(status) is returned. If this object is + * neither a numeric type nor a Measure, then 0 is returned and + * the status is set to U_INVALID_FORMAT_ERROR. + * @param status the error code + * @return the int64 value of this object. + * @stable ICU 3.0 + */ + int64_t getInt64(UErrorCode& status) const; + + /** + * Gets the Date value of this object. If this object is not of type + * kDate then the result is undefined. + * @return the Date value of this object. + * @stable ICU 2.0 + */ + UDate getDate() const { return fValue.fDate; } + + /** + * Gets the Date value of this object. If the type is not a date, + * status is set to U_INVALID_FORMAT_ERROR and the return value is + * undefined. + * @param status the error code. + * @return the Date value of this object. + * @stable ICU 3.0 + */ + UDate getDate(UErrorCode& status) const; + + /** + * Gets the string value of this object. If this object is not of type + * kString then the result is undefined. + * @param result Output param to receive the Date value of this object. + * @return A reference to 'result'. + * @stable ICU 2.0 + */ + UnicodeString& getString(UnicodeString& result) const + { result=*fValue.fString; return result; } + + /** + * Gets the string value of this object. If the type is not a + * string, status is set to U_INVALID_FORMAT_ERROR and a bogus + * string is returned. + * @param result Output param to receive the Date value of this object. + * @param status the error code. + * @return A reference to 'result'. + * @stable ICU 3.0 + */ + UnicodeString& getString(UnicodeString& result, UErrorCode& status) const; + + /** + * Gets a const reference to the string value of this object. If + * this object is not of type kString then the result is + * undefined. + * @return a const reference to the string value of this object. + * @stable ICU 2.0 + */ + inline const UnicodeString& getString(void) const; + + /** + * Gets a const reference to the string value of this object. If + * the type is not a string, status is set to + * U_INVALID_FORMAT_ERROR and the result is a bogus string. + * @param status the error code. + * @return a const reference to the string value of this object. + * @stable ICU 3.0 + */ + const UnicodeString& getString(UErrorCode& status) const; + + /** + * Gets a reference to the string value of this object. If this + * object is not of type kString then the result is undefined. + * @return a reference to the string value of this object. + * @stable ICU 2.0 + */ + inline UnicodeString& getString(void); + + /** + * Gets a reference to the string value of this object. If the + * type is not a string, status is set to U_INVALID_FORMAT_ERROR + * and the result is a bogus string. + * @param status the error code. + * @return a reference to the string value of this object. + * @stable ICU 3.0 + */ + UnicodeString& getString(UErrorCode& status); + + /** + * Gets the array value and count of this object. If this object + * is not of type kArray then the result is undefined. + * @param count fill-in with the count of this object. + * @return the array value of this object. + * @stable ICU 2.0 + */ + const Formattable* getArray(int32_t& count) const + { count=fValue.fArrayAndCount.fCount; return fValue.fArrayAndCount.fArray; } + + /** + * Gets the array value and count of this object. If the type is + * not an array, status is set to U_INVALID_FORMAT_ERROR, count is + * set to 0, and the result is NULL. + * @param count fill-in with the count of this object. + * @param status the error code. + * @return the array value of this object. + * @stable ICU 3.0 + */ + const Formattable* getArray(int32_t& count, UErrorCode& status) const; + + /** + * Accesses the specified element in the array value of this + * Formattable object. If this object is not of type kArray then + * the result is undefined. + * @param index the specified index. + * @return the accessed element in the array. + * @stable ICU 2.0 + */ + Formattable& operator[](int32_t index) { return fValue.fArrayAndCount.fArray[index]; } + + /** + * Returns a pointer to the UObject contained within this + * formattable, or NULL if this object does not contain a UObject. + * @return a UObject pointer, or NULL + * @stable ICU 3.0 + */ + const UObject* getObject() const; + + /** + * Returns a numeric string representation of the number contained within this + * formattable, or NULL if this object does not contain numeric type. + * For values obtained by parsing, the returned decimal number retains + * the full precision and range of the original input, unconstrained by + * the limits of a double floating point or a 64 bit int. + * + * This function is not thread safe, and therfore is not declared const, + * even though it is logically const. + * + * Possible errors include U_MEMORY_ALLOCATION_ERROR, and + * U_INVALID_STATE if the formattable object has not been set to + * a numeric type. + * + * @param status the error code. + * @return the unformatted string representation of a number. + * @stable ICU 4.4 + */ + StringPiece getDecimalNumber(UErrorCode &status); + + /** + * Sets the double value of this object and changes the type to + * kDouble. + * @param d the new double value to be set. + * @stable ICU 2.0 + */ + void setDouble(double d); + + /** + * Sets the long value of this object and changes the type to + * kLong. + * @param l the new long value to be set. + * @stable ICU 2.0 + */ + void setLong(int32_t l); + + /** + * Sets the int64 value of this object and changes the type to + * kInt64. + * @param ll the new int64 value to be set. + * @stable ICU 2.8 + */ + void setInt64(int64_t ll); + + /** + * Sets the Date value of this object and changes the type to + * kDate. + * @param d the new Date value to be set. + * @stable ICU 2.0 + */ + void setDate(UDate d); + + /** + * Sets the string value of this object and changes the type to + * kString. + * @param stringToCopy the new string value to be set. + * @stable ICU 2.0 + */ + void setString(const UnicodeString& stringToCopy); + + /** + * Sets the array value and count of this object and changes the + * type to kArray. + * @param array the array value. + * @param count the number of array elements to be copied. + * @stable ICU 2.0 + */ + void setArray(const Formattable* array, int32_t count); + + /** + * Sets and adopts the string value and count of this object and + * changes the type to kArray. + * @param stringToAdopt the new string value to be adopted. + * @stable ICU 2.0 + */ + void adoptString(UnicodeString* stringToAdopt); + + /** + * Sets and adopts the array value and count of this object and + * changes the type to kArray. + * @stable ICU 2.0 + */ + void adoptArray(Formattable* array, int32_t count); + + /** + * Sets and adopts the UObject value of this object and changes + * the type to kObject. After this call, the caller must not + * delete the given object. + * @param objectToAdopt the UObject value to be adopted + * @stable ICU 3.0 + */ + void adoptObject(UObject* objectToAdopt); + + /** + * Sets the the numeric value from a decimal number string, and changes + * the type to to a numeric type appropriate for the number. + * The syntax of the number is a "numeric string" + * as defined in the Decimal Arithmetic Specification, available at + * http://speleotrove.com/decimal + * The full precision and range of the input number will be retained, + * even when it exceeds what can be represented by a double or an int64. + * + * @param numberString a string representation of the unformatted decimal number. + * @param status the error code. Set to U_INVALID_FORMAT_ERROR if the + * incoming string is not a valid decimal number. + * @stable ICU 4.4 + */ + void setDecimalNumber(StringPiece numberString, + UErrorCode &status); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.2 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.2 + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * Convert the UFormattable to a Formattable. Internally, this is a reinterpret_cast. + * @param fmt a valid UFormattable + * @return the UFormattable as a Formattable object pointer. This is an alias to the original + * UFormattable, and so is only valid while the original argument remains in scope. + * @stable ICU 52 + */ + static inline Formattable *fromUFormattable(UFormattable *fmt); + + /** + * Convert the const UFormattable to a const Formattable. Internally, this is a reinterpret_cast. + * @param fmt a valid UFormattable + * @return the UFormattable as a Formattable object pointer. This is an alias to the original + * UFormattable, and so is only valid while the original argument remains in scope. + * @stable ICU 52 + */ + static inline const Formattable *fromUFormattable(const UFormattable *fmt); + + /** + * Convert this object pointer to a UFormattable. + * @return this object as a UFormattable pointer. This is an alias to this object, + * and so is only valid while this object remains in scope. + * @stable ICU 52 + */ + inline UFormattable *toUFormattable(); + + /** + * Convert this object pointer to a UFormattable. + * @return this object as a UFormattable pointer. This is an alias to this object, + * and so is only valid while this object remains in scope. + * @stable ICU 52 + */ + inline const UFormattable *toUFormattable() const; + +#ifndef U_HIDE_DEPRECATED_API + /** + * Deprecated variant of getLong(UErrorCode&). + * @param status the error code + * @return the long value of this object. + * @deprecated ICU 3.0 use getLong(UErrorCode&) instead + */ + inline int32_t getLong(UErrorCode* status) const; +#endif /* U_HIDE_DEPRECATED_API */ + +#ifndef U_HIDE_INTERNAL_API + /** + * Internal function, do not use. + * TODO: figure out how to make this be non-public. + * NumberFormat::format(Formattable, ... + * needs to get at the DigitList, if it exists, for + * big decimal formatting. + * @internal + */ + DigitList *getDigitList() const { return fDecimalNum;} + + /** + * @internal + */ + DigitList *getInternalDigitList(); + + /** + * Adopt, and set value from, a DigitList + * Internal Function, do not use. + * @param dl the Digit List to be adopted + * @internal + */ + void adoptDigitList(DigitList *dl); + + /** + * Internal function to return the CharString pointer. + * @param status error code + * @return pointer to the CharString - may become invalid if the object is modified + * @internal + */ + CharString *internalGetCharString(UErrorCode &status); + +#endif /* U_HIDE_INTERNAL_API */ + +private: + /** + * Cleans up the memory for unwanted values. For example, the adopted + * string or array objects. + */ + void dispose(void); + + /** + * Common initialization, for use by constructors. + */ + void init(); + + UnicodeString* getBogus() const; + + union { + UObject* fObject; + UnicodeString* fString; + double fDouble; + int64_t fInt64; + UDate fDate; + struct { + Formattable* fArray; + int32_t fCount; + } fArrayAndCount; + } fValue; + + CharString *fDecimalStr; + + DigitList *fDecimalNum; + + char fStackData[UNUM_INTERNAL_STACKARRAY_SIZE]; // must be big enough for DigitList + + Type fType; + UnicodeString fBogus; // Bogus string when it's needed. +}; + +inline UDate Formattable::getDate(UErrorCode& status) const { + if (fType != kDate) { + if (U_SUCCESS(status)) { + status = U_INVALID_FORMAT_ERROR; + } + return 0; + } + return fValue.fDate; +} + +inline const UnicodeString& Formattable::getString(void) const { + return *fValue.fString; +} + +inline UnicodeString& Formattable::getString(void) { + return *fValue.fString; +} + +#ifndef U_HIDE_DEPRECATED_API +inline int32_t Formattable::getLong(UErrorCode* status) const { + return getLong(*status); +} +#endif /* U_HIDE_DEPRECATED_API */ + +inline UFormattable* Formattable::toUFormattable() { + return reinterpret_cast(this); +} + +inline const UFormattable* Formattable::toUFormattable() const { + return reinterpret_cast(this); +} + +inline Formattable* Formattable::fromUFormattable(UFormattable *fmt) { + return reinterpret_cast(fmt); +} + +inline const Formattable* Formattable::fromUFormattable(const UFormattable *fmt) { + return reinterpret_cast(fmt); +} + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif //_FMTABLE +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/format.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/format.h new file mode 100644 index 0000000..b05318d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/format.h @@ -0,0 +1,307 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************** +* Copyright (C) 1997-2011, International Business Machines Corporation and others. +* All Rights Reserved. +******************************************************************************** +* +* File FORMAT.H +* +* Modification History: +* +* Date Name Description +* 02/19/97 aliu Converted from java. +* 03/17/97 clhuang Updated per C++ implementation. +* 03/27/97 helena Updated to pass the simple test after code review. +******************************************************************************** +*/ +// ***************************************************************************** +// This file was generated from the java source file Format.java +// ***************************************************************************** + +#ifndef FORMAT_H +#define FORMAT_H + + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Base class for all formats. + */ + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/unistr.h" +#include "unicode/fmtable.h" +#include "unicode/fieldpos.h" +#include "unicode/fpositer.h" +#include "unicode/parsepos.h" +#include "unicode/parseerr.h" +#include "unicode/locid.h" + +U_NAMESPACE_BEGIN + +/** + * Base class for all formats. This is an abstract base class which + * specifies the protocol for classes which convert other objects or + * values, such as numeric values and dates, and their string + * representations. In some cases these representations may be + * localized or contain localized characters or strings. For example, + * a numeric formatter such as DecimalFormat may convert a numeric + * value such as 12345 to the string "$12,345". It may also parse + * the string back into a numeric value. A date and time formatter + * like SimpleDateFormat may represent a specific date, encoded + * numerically, as a string such as "Wednesday, February 26, 1997 AD". + *

+ * Many of the concrete subclasses of Format employ the notion of + * a pattern. A pattern is a string representation of the rules which + * govern the interconversion between values and strings. For example, + * a DecimalFormat object may be associated with the pattern + * "$#,##0.00;($#,##0.00)", which is a common US English format for + * currency values, yielding strings such as "$1,234.45" for 1234.45, + * and "($987.65)" for 987.6543. The specific syntax of a pattern + * is defined by each subclass. + *

+ * Even though many subclasses use patterns, the notion of a pattern + * is not inherent to Format classes in general, and is not part of + * the explicit base class protocol. + *

+ * Two complex formatting classes bear mentioning. These are + * MessageFormat and ChoiceFormat. ChoiceFormat is a subclass of + * NumberFormat which allows the user to format different number ranges + * as strings. For instance, 0 may be represented as "no files", 1 as + * "one file", and any number greater than 1 as "many files". + * MessageFormat is a formatter which utilizes other Format objects to + * format a string containing with multiple values. For instance, + * A MessageFormat object might produce the string "There are no files + * on the disk MyDisk on February 27, 1997." given the arguments 0, + * "MyDisk", and the date value of 2/27/97. See the ChoiceFormat + * and MessageFormat headers for further information. + *

+ * If formatting is unsuccessful, a failing UErrorCode is returned when + * the Format cannot format the type of object, otherwise if there is + * something illformed about the the Unicode replacement character + * 0xFFFD is returned. + *

+ * If there is no match when parsing, a parse failure UErrorCode is + * retured for methods which take no ParsePosition. For the method + * that takes a ParsePosition, the index parameter is left unchanged. + *

+ * User subclasses are not supported. While clients may write + * subclasses, such code will not necessarily work and will not be + * guaranteed to work stably from release to release. + */ +class U_I18N_API Format : public UObject { +public: + + /** Destructor + * @stable ICU 2.4 + */ + virtual ~Format(); + + /** + * Return true if the given Format objects are semantically equal. + * Objects of different subclasses are considered unequal. + * @param other the object to be compared with. + * @return Return true if the given Format objects are semantically equal. + * Objects of different subclasses are considered unequal. + * @stable ICU 2.0 + */ + virtual UBool operator==(const Format& other) const = 0; + + /** + * Return true if the given Format objects are not semantically + * equal. + * @param other the object to be compared with. + * @return Return true if the given Format objects are not semantically. + * @stable ICU 2.0 + */ + UBool operator!=(const Format& other) const { return !operator==(other); } + + /** + * Clone this object polymorphically. The caller is responsible + * for deleting the result when done. + * @return A copy of the object + * @stable ICU 2.0 + */ + virtual Format* clone() const = 0; + + /** + * Formats an object to produce a string. + * + * @param obj The object to format. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param status Output parameter filled in with success or failure status. + * @return Reference to 'appendTo' parameter. + * @stable ICU 2.0 + */ + UnicodeString& format(const Formattable& obj, + UnicodeString& appendTo, + UErrorCode& status) const; + + /** + * Format an object to produce a string. This is a pure virtual method which + * subclasses must implement. This method allows polymorphic formatting + * of Formattable objects. If a subclass of Format receives a Formattable + * object type it doesn't handle (e.g., if a numeric Formattable is passed + * to a DateFormat object) then it returns a failing UErrorCode. + * + * @param obj The object to format. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @stable ICU 2.0 + */ + virtual UnicodeString& format(const Formattable& obj, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode& status) const = 0; + /** + * Format an object to produce a string. Subclasses should override this + * method. This method allows polymorphic formatting of Formattable objects. + * If a subclass of Format receives a Formattable object type it doesn't + * handle (e.g., if a numeric Formattable is passed to a DateFormat object) + * then it returns a failing UErrorCode. + * + * @param obj The object to format. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param posIter On return, can be used to iterate over positions + * of fields generated by this format call. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @stable ICU 4.4 + */ + virtual UnicodeString& format(const Formattable& obj, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; + + /** + * Parse a string to produce an object. This is a pure virtual + * method which subclasses must implement. This method allows + * polymorphic parsing of strings into Formattable objects. + *

+ * Before calling, set parse_pos.index to the offset you want to + * start parsing at in the source. After calling, parse_pos.index + * is the end of the text you parsed. If error occurs, index is + * unchanged. + *

+ * When parsing, leading whitespace is discarded (with successful + * parse), while trailing whitespace is left as is. + *

+ * Example: + *

+ * Parsing "_12_xy" (where _ represents a space) for a number, + * with index == 0 will result in the number 12, with + * parse_pos.index updated to 3 (just before the second space). + * Parsing a second time will result in a failing UErrorCode since + * "xy" is not a number, and leave index at 3. + *

+ * Subclasses will typically supply specific parse methods that + * return different types of values. Since methods can't overload + * on return types, these will typically be named "parse", while + * this polymorphic method will always be called parseObject. Any + * parse method that does not take a parse_pos should set status + * to an error value when no text in the required format is at the + * start position. + * + * @param source The string to be parsed into an object. + * @param result Formattable to be set to the parse result. + * If parse fails, return contents are undefined. + * @param parse_pos The position to start parsing at. Upon return + * this param is set to the position after the + * last character successfully parsed. If the + * source is not parsed successfully, this param + * will remain unchanged. + * @stable ICU 2.0 + */ + virtual void parseObject(const UnicodeString& source, + Formattable& result, + ParsePosition& parse_pos) const = 0; + + /** + * Parses a string to produce an object. This is a convenience method + * which calls the pure virtual parseObject() method, and returns a + * failure UErrorCode if the ParsePosition indicates failure. + * + * @param source The string to be parsed into an object. + * @param result Formattable to be set to the parse result. + * If parse fails, return contents are undefined. + * @param status Output param to be filled with success/failure + * result code. + * @stable ICU 2.0 + */ + void parseObject(const UnicodeString& source, + Formattable& result, + UErrorCode& status) const; + + /** Get the locale for this format object. You can choose between valid and actual locale. + * @param type type of the locale we're looking for (valid or actual) + * @param status error code for the operation + * @return the locale + * @stable ICU 2.8 + */ + Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const; + +#ifndef U_HIDE_INTERNAL_API + /** Get the locale for this format object. You can choose between valid and actual locale. + * @param type type of the locale we're looking for (valid or actual) + * @param status error code for the operation + * @return the locale + * @internal + */ + const char* getLocaleID(ULocDataLocaleType type, UErrorCode &status) const; +#endif /* U_HIDE_INTERNAL_API */ + + protected: + /** @stable ICU 2.8 */ + void setLocaleIDs(const char* valid, const char* actual); + +protected: + /** + * Default constructor for subclass use only. Does nothing. + * @stable ICU 2.0 + */ + Format(); + + /** + * @stable ICU 2.0 + */ + Format(const Format&); // Does nothing; for subclasses only + + /** + * @stable ICU 2.0 + */ + Format& operator=(const Format&); // Does nothing; for subclasses + + + /** + * Simple function for initializing a UParseError from a UnicodeString. + * + * @param pattern The pattern to copy into the parseError + * @param pos The position in pattern where the error occured + * @param parseError The UParseError object to fill in + * @stable ICU 2.4 + */ + static void syntaxError(const UnicodeString& pattern, + int32_t pos, + UParseError& parseError); + + private: + char actualLocale[ULOC_FULLNAME_CAPACITY]; + char validLocale[ULOC_FULLNAME_CAPACITY]; +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // _FORMAT +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/fpositer.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/fpositer.h new file mode 100644 index 0000000..38ccd8f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/fpositer.h @@ -0,0 +1,127 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************** +* Copyright (C) 2010-2012, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************** +* +* File attiter.h +* +* Modification History: +* +* Date Name Description +* 12/15/2009 dougfelt Created +******************************************************************************** +*/ + +#ifndef FPOSITER_H +#define FPOSITER_H + +#include "unicode/utypes.h" +#include "unicode/uobject.h" + +/** + * \file + * \brief C++ API: FieldPosition Iterator. + */ + +#if UCONFIG_NO_FORMATTING + +U_NAMESPACE_BEGIN + +/* + * Allow the declaration of APIs with pointers to FieldPositionIterator + * even when formatting is removed from the build. + */ +class FieldPositionIterator; + +U_NAMESPACE_END + +#else + +#include "unicode/fieldpos.h" +#include "unicode/umisc.h" + +U_NAMESPACE_BEGIN + +class UVector32; + +// Forward declaration for number formatting: +namespace number { +namespace impl { +class NumberStringBuilder; +} +} + +/** + * FieldPositionIterator returns the field ids and their start/limit positions generated + * by a call to Format::format. See Format, NumberFormat, DecimalFormat. + * @stable ICU 4.4 + */ +class U_I18N_API FieldPositionIterator : public UObject { +public: + /** + * Destructor. + * @stable ICU 4.4 + */ + ~FieldPositionIterator(); + + /** + * Constructs a new, empty iterator. + * @stable ICU 4.4 + */ + FieldPositionIterator(void); + + /** + * Copy constructor. If the copy failed for some reason, the new iterator will + * be empty. + * @stable ICU 4.4 + */ + FieldPositionIterator(const FieldPositionIterator&); + + /** + * Return true if another object is semantically equal to this + * one. + *

+ * Return true if this FieldPositionIterator is at the same position in an + * equal array of run values. + * @stable ICU 4.4 + */ + UBool operator==(const FieldPositionIterator&) const; + + /** + * Returns the complement of the result of operator== + * @param rhs The FieldPositionIterator to be compared for inequality + * @return the complement of the result of operator== + * @stable ICU 4.4 + */ + UBool operator!=(const FieldPositionIterator& rhs) const { return !operator==(rhs); } + + /** + * If the current position is valid, updates the FieldPosition values, advances the iterator, + * and returns TRUE, otherwise returns FALSE. + * @stable ICU 4.4 + */ + UBool next(FieldPosition& fp); + +private: + /** + * Sets the data used by the iterator, and resets the position. + * Returns U_ILLEGAL_ARGUMENT_ERROR in status if the data is not valid + * (length is not a multiple of 3, or start >= limit for any run). + */ + void setData(UVector32 *adopt, UErrorCode& status); + + friend class FieldPositionIteratorHandler; + friend class number::impl::NumberStringBuilder; + + UVector32 *data; + int32_t pos; +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // FPOSITER_H diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/gender.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/gender.h new file mode 100644 index 0000000..e3c27d0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/gender.h @@ -0,0 +1,113 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2008-2013, International Business Machines Corporation and +* others. All Rights Reserved. +******************************************************************************* +* +* +* File GENDER.H +* +* Modification History:* +* Date Name Description +* +******************************************************************************** +*/ + +#ifndef _GENDER +#define _GENDER + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/locid.h" +#include "unicode/ugender.h" +#include "unicode/uobject.h" + +class GenderInfoTest; + +U_NAMESPACE_BEGIN + +// Forward Declaration +void U_CALLCONV GenderInfo_initCache(UErrorCode &status); + +/** + * GenderInfo computes the gender of a list as a whole given the gender of + * each element. + * @stable ICU 50 + */ +class U_I18N_API GenderInfo : public UObject { +public: + + /** + * Provides access to the predefined GenderInfo object for a given + * locale. + * + * @param locale The locale for which a GenderInfo object is + * returned. + * @param status Output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @return The predefined GenderInfo object pointer for + * this locale. The returned object is immutable, so it is + * declared as const. Caller does not own the returned + * pointer, so it must not attempt to free it. + * @stable ICU 50 + */ + static const GenderInfo* U_EXPORT2 getInstance(const Locale& locale, UErrorCode& status); + + /** + * Determines the gender of a list as a whole given the gender of each + * of the elements. + * + * @param genders the gender of each element in the list. + * @param length the length of gender array. + * @param status Output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @return the gender of the whole list. + * @stable ICU 50 + */ + UGender getListGender(const UGender* genders, int32_t length, UErrorCode& status) const; + + /** + * Destructor. + * + * @stable ICU 50 + */ + virtual ~GenderInfo(); + +private: + int32_t _style; + + /** + * Copy constructor. One object per locale invariant. Clients + * must never copy GenderInfo objects. + */ + GenderInfo(const GenderInfo& other); + + /** + * Assignment operator. Not applicable to immutable objects. + */ + GenderInfo& operator=(const GenderInfo&); + + GenderInfo(); + + static const GenderInfo* getNeutralInstance(); + + static const GenderInfo* getMixedNeutralInstance(); + + static const GenderInfo* getMaleTaintsInstance(); + + static const GenderInfo* loadInstance(const Locale& locale, UErrorCode& status); + + friend class ::GenderInfoTest; + friend void U_CALLCONV GenderInfo_initCache(UErrorCode &status); +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // _GENDER +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/gregocal.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/gregocal.h new file mode 100644 index 0000000..2b4fe1d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/gregocal.h @@ -0,0 +1,779 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +* Copyright (C) 1997-2013, International Business Machines Corporation and others. +* All Rights Reserved. +******************************************************************************** +* +* File GREGOCAL.H +* +* Modification History: +* +* Date Name Description +* 04/22/97 aliu Overhauled header. +* 07/28/98 stephen Sync with JDK 1.2 +* 09/04/98 stephen Re-sync with JDK 8/31 putback +* 09/14/98 stephen Changed type of kOneDay, kOneWeek to double. +* Fixed bug in roll() +* 10/15/99 aliu Fixed j31, incorrect WEEK_OF_YEAR computation. +* Added documentation of WEEK_OF_YEAR computation. +* 10/15/99 aliu Fixed j32, cannot set date to Feb 29 2000 AD. +* {JDK bug 4210209 4209272} +* 11/07/2003 srl Update, clean up documentation. +******************************************************************************** +*/ + +#ifndef GREGOCAL_H +#define GREGOCAL_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/calendar.h" + +/** + * \file + * \brief C++ API: Concrete class which provides the standard calendar. + */ + +U_NAMESPACE_BEGIN + +/** + * Concrete class which provides the standard calendar used by most of the world. + *

+ * The standard (Gregorian) calendar has 2 eras, BC and AD. + *

+ * This implementation handles a single discontinuity, which corresponds by default to + * the date the Gregorian calendar was originally instituted (October 15, 1582). Not all + * countries adopted the Gregorian calendar then, so this cutover date may be changed by + * the caller. + *

+ * Prior to the institution of the Gregorian Calendar, New Year's Day was March 25. To + * avoid confusion, this Calendar always uses January 1. A manual adjustment may be made + * if desired for dates that are prior to the Gregorian changeover and which fall + * between January 1 and March 24. + * + *

Values calculated for the WEEK_OF_YEAR field range from 1 to + * 53. Week 1 for a year is the first week that contains at least + * getMinimalDaysInFirstWeek() days from that year. It thus + * depends on the values of getMinimalDaysInFirstWeek(), + * getFirstDayOfWeek(), and the day of the week of January 1. + * Weeks between week 1 of one year and week 1 of the following year are + * numbered sequentially from 2 to 52 or 53 (as needed). + * + *

For example, January 1, 1998 was a Thursday. If + * getFirstDayOfWeek() is MONDAY and + * getMinimalDaysInFirstWeek() is 4 (these are the values + * reflecting ISO 8601 and many national standards), then week 1 of 1998 starts + * on December 29, 1997, and ends on January 4, 1998. If, however, + * getFirstDayOfWeek() is SUNDAY, then week 1 of 1998 + * starts on January 4, 1998, and ends on January 10, 1998; the first three days + * of 1998 then are part of week 53 of 1997. + * + *

Example for using GregorianCalendar: + *

+ * \code
+ *     // get the supported ids for GMT-08:00 (Pacific Standard Time)
+ *     UErrorCode success = U_ZERO_ERROR;
+ *     const StringEnumeration *ids = TimeZone::createEnumeration(-8 * 60 * 60 * 1000);
+ *     // if no ids were returned, something is wrong. get out.
+ *     if (ids == 0 || ids->count(success) == 0) {
+ *         return;
+ *     }
+ *
+ *     // begin output
+ *     cout << "Current Time" << endl;
+ *
+ *     // create a Pacific Standard Time time zone
+ *     SimpleTimeZone* pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids->unext(NULL, success)));
+ *
+ *     // set up rules for daylight savings time
+ *     pdt->setStartRule(UCAL_MARCH, 1, UCAL_SUNDAY, 2 * 60 * 60 * 1000);
+ *     pdt->setEndRule(UCAL_NOVEMBER, 2, UCAL_SUNDAY, 2 * 60 * 60 * 1000);
+ *
+ *     // create a GregorianCalendar with the Pacific Daylight time zone
+ *     // and the current date and time
+ *     Calendar* calendar = new GregorianCalendar( pdt, success );
+ *
+ *     // print out a bunch of interesting things
+ *     cout << "ERA: " << calendar->get( UCAL_ERA, success ) << endl;
+ *     cout << "YEAR: " << calendar->get( UCAL_YEAR, success ) << endl;
+ *     cout << "MONTH: " << calendar->get( UCAL_MONTH, success ) << endl;
+ *     cout << "WEEK_OF_YEAR: " << calendar->get( UCAL_WEEK_OF_YEAR, success ) << endl;
+ *     cout << "WEEK_OF_MONTH: " << calendar->get( UCAL_WEEK_OF_MONTH, success ) << endl;
+ *     cout << "DATE: " << calendar->get( UCAL_DATE, success ) << endl;
+ *     cout << "DAY_OF_MONTH: " << calendar->get( UCAL_DAY_OF_MONTH, success ) << endl;
+ *     cout << "DAY_OF_YEAR: " << calendar->get( UCAL_DAY_OF_YEAR, success ) << endl;
+ *     cout << "DAY_OF_WEEK: " << calendar->get( UCAL_DAY_OF_WEEK, success ) << endl;
+ *     cout << "DAY_OF_WEEK_IN_MONTH: " << calendar->get( UCAL_DAY_OF_WEEK_IN_MONTH, success ) << endl;
+ *     cout << "AM_PM: " << calendar->get( UCAL_AM_PM, success ) << endl;
+ *     cout << "HOUR: " << calendar->get( UCAL_HOUR, success ) << endl;
+ *     cout << "HOUR_OF_DAY: " << calendar->get( UCAL_HOUR_OF_DAY, success ) << endl;
+ *     cout << "MINUTE: " << calendar->get( UCAL_MINUTE, success ) << endl;
+ *     cout << "SECOND: " << calendar->get( UCAL_SECOND, success ) << endl;
+ *     cout << "MILLISECOND: " << calendar->get( UCAL_MILLISECOND, success ) << endl;
+ *     cout << "ZONE_OFFSET: " << (calendar->get( UCAL_ZONE_OFFSET, success )/(60*60*1000)) << endl;
+ *     cout << "DST_OFFSET: " << (calendar->get( UCAL_DST_OFFSET, success )/(60*60*1000)) << endl;
+ *
+ *     cout << "Current Time, with hour reset to 3" << endl;
+ *     calendar->clear(UCAL_HOUR_OF_DAY); // so doesn't override
+ *     calendar->set(UCAL_HOUR, 3);
+ *     cout << "ERA: " << calendar->get( UCAL_ERA, success ) << endl;
+ *     cout << "YEAR: " << calendar->get( UCAL_YEAR, success ) << endl;
+ *     cout << "MONTH: " << calendar->get( UCAL_MONTH, success ) << endl;
+ *     cout << "WEEK_OF_YEAR: " << calendar->get( UCAL_WEEK_OF_YEAR, success ) << endl;
+ *     cout << "WEEK_OF_MONTH: " << calendar->get( UCAL_WEEK_OF_MONTH, success ) << endl;
+ *     cout << "DATE: " << calendar->get( UCAL_DATE, success ) << endl;
+ *     cout << "DAY_OF_MONTH: " << calendar->get( UCAL_DAY_OF_MONTH, success ) << endl;
+ *     cout << "DAY_OF_YEAR: " << calendar->get( UCAL_DAY_OF_YEAR, success ) << endl;
+ *     cout << "DAY_OF_WEEK: " << calendar->get( UCAL_DAY_OF_WEEK, success ) << endl;
+ *     cout << "DAY_OF_WEEK_IN_MONTH: " << calendar->get( UCAL_DAY_OF_WEEK_IN_MONTH, success ) << endl;
+ *     cout << "AM_PM: " << calendar->get( UCAL_AM_PM, success ) << endl;
+ *     cout << "HOUR: " << calendar->get( UCAL_HOUR, success ) << endl;
+ *     cout << "HOUR_OF_DAY: " << calendar->get( UCAL_HOUR_OF_DAY, success ) << endl;
+ *     cout << "MINUTE: " << calendar->get( UCAL_MINUTE, success ) << endl;
+ *     cout << "SECOND: " << calendar->get( UCAL_SECOND, success ) << endl;
+ *     cout << "MILLISECOND: " << calendar->get( UCAL_MILLISECOND, success ) << endl;
+ *     cout << "ZONE_OFFSET: " << (calendar->get( UCAL_ZONE_OFFSET, success )/(60*60*1000)) << endl; // in hours
+ *     cout << "DST_OFFSET: " << (calendar->get( UCAL_DST_OFFSET, success )/(60*60*1000)) << endl; // in hours
+ *
+ *     if (U_FAILURE(success)) {
+ *         cout << "An error occured. success=" << u_errorName(success) << endl;
+ *     }
+ *
+ *     delete ids;
+ *     delete calendar; // also deletes pdt
+ * \endcode
+ * 
+ * @stable ICU 2.0 + */ +class U_I18N_API GregorianCalendar: public Calendar { +public: + + /** + * Useful constants for GregorianCalendar and TimeZone. + * @stable ICU 2.0 + */ + enum EEras { + BC, + AD + }; + + /** + * Constructs a default GregorianCalendar using the current time in the default time + * zone with the default locale. + * + * @param success Indicates the status of GregorianCalendar object construction. + * Returns U_ZERO_ERROR if constructed successfully. + * @stable ICU 2.0 + */ + GregorianCalendar(UErrorCode& success); + + /** + * Constructs a GregorianCalendar based on the current time in the given time zone + * with the default locale. Clients are no longer responsible for deleting the given + * time zone object after it's adopted. + * + * @param zoneToAdopt The given timezone. + * @param success Indicates the status of GregorianCalendar object construction. + * Returns U_ZERO_ERROR if constructed successfully. + * @stable ICU 2.0 + */ + GregorianCalendar(TimeZone* zoneToAdopt, UErrorCode& success); + + /** + * Constructs a GregorianCalendar based on the current time in the given time zone + * with the default locale. + * + * @param zone The given timezone. + * @param success Indicates the status of GregorianCalendar object construction. + * Returns U_ZERO_ERROR if constructed successfully. + * @stable ICU 2.0 + */ + GregorianCalendar(const TimeZone& zone, UErrorCode& success); + + /** + * Constructs a GregorianCalendar based on the current time in the default time zone + * with the given locale. + * + * @param aLocale The given locale. + * @param success Indicates the status of GregorianCalendar object construction. + * Returns U_ZERO_ERROR if constructed successfully. + * @stable ICU 2.0 + */ + GregorianCalendar(const Locale& aLocale, UErrorCode& success); + + /** + * Constructs a GregorianCalendar based on the current time in the given time zone + * with the given locale. Clients are no longer responsible for deleting the given + * time zone object after it's adopted. + * + * @param zoneToAdopt The given timezone. + * @param aLocale The given locale. + * @param success Indicates the status of GregorianCalendar object construction. + * Returns U_ZERO_ERROR if constructed successfully. + * @stable ICU 2.0 + */ + GregorianCalendar(TimeZone* zoneToAdopt, const Locale& aLocale, UErrorCode& success); + + /** + * Constructs a GregorianCalendar based on the current time in the given time zone + * with the given locale. + * + * @param zone The given timezone. + * @param aLocale The given locale. + * @param success Indicates the status of GregorianCalendar object construction. + * Returns U_ZERO_ERROR if constructed successfully. + * @stable ICU 2.0 + */ + GregorianCalendar(const TimeZone& zone, const Locale& aLocale, UErrorCode& success); + + /** + * Constructs a GregorianCalendar with the given AD date set in the default time + * zone with the default locale. + * + * @param year The value used to set the YEAR time field in the calendar. + * @param month The value used to set the MONTH time field in the calendar. Month + * value is 0-based. e.g., 0 for January. + * @param date The value used to set the DATE time field in the calendar. + * @param success Indicates the status of GregorianCalendar object construction. + * Returns U_ZERO_ERROR if constructed successfully. + * @stable ICU 2.0 + */ + GregorianCalendar(int32_t year, int32_t month, int32_t date, UErrorCode& success); + + /** + * Constructs a GregorianCalendar with the given AD date and time set for the + * default time zone with the default locale. + * + * @param year The value used to set the YEAR time field in the calendar. + * @param month The value used to set the MONTH time field in the calendar. Month + * value is 0-based. e.g., 0 for January. + * @param date The value used to set the DATE time field in the calendar. + * @param hour The value used to set the HOUR_OF_DAY time field in the calendar. + * @param minute The value used to set the MINUTE time field in the calendar. + * @param success Indicates the status of GregorianCalendar object construction. + * Returns U_ZERO_ERROR if constructed successfully. + * @stable ICU 2.0 + */ + GregorianCalendar(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute, UErrorCode& success); + + /** + * Constructs a GregorianCalendar with the given AD date and time set for the + * default time zone with the default locale. + * + * @param year The value used to set the YEAR time field in the calendar. + * @param month The value used to set the MONTH time field in the calendar. Month + * value is 0-based. e.g., 0 for January. + * @param date The value used to set the DATE time field in the calendar. + * @param hour The value used to set the HOUR_OF_DAY time field in the calendar. + * @param minute The value used to set the MINUTE time field in the calendar. + * @param second The value used to set the SECOND time field in the calendar. + * @param success Indicates the status of GregorianCalendar object construction. + * Returns U_ZERO_ERROR if constructed successfully. + * @stable ICU 2.0 + */ + GregorianCalendar(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute, int32_t second, UErrorCode& success); + + /** + * Destructor + * @stable ICU 2.0 + */ + virtual ~GregorianCalendar(); + + /** + * Copy constructor + * @param source the object to be copied. + * @stable ICU 2.0 + */ + GregorianCalendar(const GregorianCalendar& source); + + /** + * Default assignment operator + * @param right the object to be copied. + * @stable ICU 2.0 + */ + GregorianCalendar& operator=(const GregorianCalendar& right); + + /** + * Create and return a polymorphic copy of this calendar. + * @return return a polymorphic copy of this calendar. + * @stable ICU 2.0 + */ + virtual Calendar* clone(void) const; + + /** + * Sets the GregorianCalendar change date. This is the point when the switch from + * Julian dates to Gregorian dates occurred. Default is 00:00:00 local time, October + * 15, 1582. Previous to this time and date will be Julian dates. + * + * @param date The given Gregorian cutover date. + * @param success Output param set to success/failure code on exit. + * @stable ICU 2.0 + */ + void setGregorianChange(UDate date, UErrorCode& success); + + /** + * Gets the Gregorian Calendar change date. This is the point when the switch from + * Julian dates to Gregorian dates occurred. Default is 00:00:00 local time, October + * 15, 1582. Previous to this time and date will be Julian dates. + * + * @return The Gregorian cutover time for this calendar. + * @stable ICU 2.0 + */ + UDate getGregorianChange(void) const; + + /** + * Return true if the given year is a leap year. Determination of whether a year is + * a leap year is actually very complicated. We do something crude and mostly + * correct here, but for a real determination you need a lot of contextual + * information. For example, in Sweden, the change from Julian to Gregorian happened + * in a complex way resulting in missed leap years and double leap years between + * 1700 and 1753. Another example is that after the start of the Julian calendar in + * 45 B.C., the leap years did not regularize until 8 A.D. This method ignores these + * quirks, and pays attention only to the Julian onset date and the Gregorian + * cutover (which can be changed). + * + * @param year The given year. + * @return True if the given year is a leap year; false otherwise. + * @stable ICU 2.0 + */ + UBool isLeapYear(int32_t year) const; + + /** + * Returns TRUE if the given Calendar object is equivalent to this + * one. Calendar override. + * + * @param other the Calendar to be compared with this Calendar + * @stable ICU 2.4 + */ + virtual UBool isEquivalentTo(const Calendar& other) const; + + /** + * (Overrides Calendar) Rolls up or down by the given amount in the specified field. + * For more information, see the documentation for Calendar::roll(). + * + * @param field The time field. + * @param amount Indicates amount to roll. + * @param status Output param set to success/failure code on exit. If any value + * previously set in the time field is invalid, this will be set to + * an error status. + * @deprecated ICU 2.6. Use roll(UCalendarDateFields field, int32_t amount, UErrorCode& status) instead. + */ + virtual void roll(EDateFields field, int32_t amount, UErrorCode& status); + + /** + * (Overrides Calendar) Rolls up or down by the given amount in the specified field. + * For more information, see the documentation for Calendar::roll(). + * + * @param field The time field. + * @param amount Indicates amount to roll. + * @param status Output param set to success/failure code on exit. If any value + * previously set in the time field is invalid, this will be set to + * an error status. + * @stable ICU 2.6. + */ + virtual void roll(UCalendarDateFields field, int32_t amount, UErrorCode& status); + +#ifndef U_HIDE_DEPRECATED_API + /** + * Return the minimum value that this field could have, given the current date. + * For the Gregorian calendar, this is the same as getMinimum() and getGreatestMinimum(). + * @param field the time field. + * @return the minimum value that this field could have, given the current date. + * @deprecated ICU 2.6. Use getActualMinimum(UCalendarDateFields field) instead. + */ + int32_t getActualMinimum(EDateFields field) const; + + /** + * Return the minimum value that this field could have, given the current date. + * For the Gregorian calendar, this is the same as getMinimum() and getGreatestMinimum(). + * @param field the time field. + * @param status + * @return the minimum value that this field could have, given the current date. + * @deprecated ICU 2.6. Use getActualMinimum(UCalendarDateFields field) instead. (Added to ICU 3.0 for signature consistency) + */ + int32_t getActualMinimum(EDateFields field, UErrorCode& status) const; +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Return the minimum value that this field could have, given the current date. + * For the Gregorian calendar, this is the same as getMinimum() and getGreatestMinimum(). + * @param field the time field. + * @param status error result. + * @return the minimum value that this field could have, given the current date. + * @stable ICU 3.0 + */ + int32_t getActualMinimum(UCalendarDateFields field, UErrorCode &status) const; + +#ifndef U_HIDE_DEPRECATED_API + /** + * Return the maximum value that this field could have, given the current date. + * For example, with the date "Feb 3, 1997" and the DAY_OF_MONTH field, the actual + * maximum would be 28; for "Feb 3, 1996" it s 29. Similarly for a Hebrew calendar, + * for some years the actual maximum for MONTH is 12, and for others 13. + * @param field the time field. + * @return the maximum value that this field could have, given the current date. + * @deprecated ICU 2.6. Use getActualMaximum(UCalendarDateFields field) instead. + */ + int32_t getActualMaximum(EDateFields field) const; +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Return the maximum value that this field could have, given the current date. + * For example, with the date "Feb 3, 1997" and the DAY_OF_MONTH field, the actual + * maximum would be 28; for "Feb 3, 1996" it s 29. Similarly for a Hebrew calendar, + * for some years the actual maximum for MONTH is 12, and for others 13. + * @param field the time field. + * @param status returns any errors that may result from this function call. + * @return the maximum value that this field could have, given the current date. + * @stable ICU 2.6 + */ + virtual int32_t getActualMaximum(UCalendarDateFields field, UErrorCode& status) const; + + /** + * (Overrides Calendar) Return true if the current date for this Calendar is in + * Daylight Savings Time. Recognizes DST_OFFSET, if it is set. + * + * @param status Fill-in parameter which receives the status of this operation. + * @return True if the current date for this Calendar is in Daylight Savings Time, + * false, otherwise. + * @stable ICU 2.0 + */ + virtual UBool inDaylightTime(UErrorCode& status) const; + +public: + + /** + * Override Calendar Returns a unique class ID POLYMORPHICALLY. Pure virtual + * override. This method is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and clone() methods call + * this method. + * + * @return The class ID for this object. All objects of a given class have the + * same class ID. Objects of other classes have different class IDs. + * @stable ICU 2.0 + */ + virtual UClassID getDynamicClassID(void) const; + + /** + * Return the class ID for this class. This is useful only for comparing to a return + * value from getDynamicClassID(). For example: + * + * Base* polymorphic_pointer = createPolymorphicObject(); + * if (polymorphic_pointer->getDynamicClassID() == + * Derived::getStaticClassID()) ... + * + * @return The class ID for all objects of this class. + * @stable ICU 2.0 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Returns the calendar type name string for this Calendar object. + * The returned string is the legacy ICU calendar attribute value, + * for example, "gregorian" or "japanese". + * + * For more details see the Calendar::getType() documentation. + * + * @return legacy calendar type name string + * @stable ICU 49 + */ + virtual const char * getType() const; + + private: + GregorianCalendar(); // default constructor not implemented + + protected: + /** + * Return the ERA. We need a special method for this because the + * default ERA is AD, but a zero (unset) ERA is BC. + * @return the ERA. + * @internal + */ + virtual int32_t internalGetEra() const; + + /** + * Return the Julian day number of day before the first day of the + * given month in the given extended year. Subclasses should override + * this method to implement their calendar system. + * @param eyear the extended year + * @param month the zero-based month, or 0 if useMonth is false + * @param useMonth if false, compute the day before the first day of + * the given year, otherwise, compute the day before the first day of + * the given month + * @return the Julian day number of the day before the first + * day of the given month and year + * @internal + */ + virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month, + UBool useMonth) const; + + /** + * Subclasses may override this. This method calls + * handleGetMonthLength() to obtain the calendar-specific month + * length. + * @param bestField which field to use to calculate the date + * @return julian day specified by calendar fields. + * @internal + */ + virtual int32_t handleComputeJulianDay(UCalendarDateFields bestField) ; + + /** + * Return the number of days in the given month of the given extended + * year of this calendar system. Subclasses should override this + * method if they can provide a more correct or more efficient + * implementation than the default implementation in Calendar. + * @internal + */ + virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const; + + /** + * Return the number of days in the given extended year of this + * calendar system. Subclasses should override this method if they can + * provide a more correct or more efficient implementation than the + * default implementation in Calendar. + * @stable ICU 2.0 + */ + virtual int32_t handleGetYearLength(int32_t eyear) const; + + /** + * return the length of the given month. + * @param month the given month. + * @return the length of the given month. + * @internal + */ + virtual int32_t monthLength(int32_t month) const; + + /** + * return the length of the month according to the given year. + * @param month the given month. + * @param year the given year. + * @return the length of the month + * @internal + */ + virtual int32_t monthLength(int32_t month, int32_t year) const; + +#ifndef U_HIDE_INTERNAL_API + /** + * return the length of the given year. + * @param year the given year. + * @return the length of the given year. + * @internal + */ + int32_t yearLength(int32_t year) const; + + /** + * return the length of the year field. + * @return the length of the year field + * @internal + */ + int32_t yearLength(void) const; + + /** + * After adjustments such as add(MONTH), add(YEAR), we don't want the + * month to jump around. E.g., we don't want Jan 31 + 1 month to go to Mar + * 3, we want it to go to Feb 28. Adjustments which might run into this + * problem call this method to retain the proper month. + * @internal + */ + void pinDayOfMonth(void); +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Return the day number with respect to the epoch. January 1, 1970 (Gregorian) + * is day zero. + * @param status Fill-in parameter which receives the status of this operation. + * @return the day number with respect to the epoch. + * @internal + */ + virtual UDate getEpochDay(UErrorCode& status); + + /** + * Subclass API for defining limits of different types. + * Subclasses must implement this method to return limits for the + * following fields: + * + *
UCAL_ERA
+     * UCAL_YEAR
+     * UCAL_MONTH
+     * UCAL_WEEK_OF_YEAR
+     * UCAL_WEEK_OF_MONTH
+     * UCAL_DATE (DAY_OF_MONTH on Java)
+     * UCAL_DAY_OF_YEAR
+     * UCAL_DAY_OF_WEEK_IN_MONTH
+     * UCAL_YEAR_WOY
+     * UCAL_EXTENDED_YEAR
+ * + * @param field one of the above field numbers + * @param limitType one of MINIMUM, GREATEST_MINIMUM, + * LEAST_MAXIMUM, or MAXIMUM + * @internal + */ + virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const; + + /** + * Return the extended year defined by the current fields. This will + * use the UCAL_EXTENDED_YEAR field or the UCAL_YEAR and supra-year fields (such + * as UCAL_ERA) specific to the calendar system, depending on which set of + * fields is newer. + * @return the extended year + * @internal + */ + virtual int32_t handleGetExtendedYear(); + + /** + * Subclasses may override this to convert from week fields + * (YEAR_WOY and WEEK_OF_YEAR) to an extended year in the case + * where YEAR, EXTENDED_YEAR are not set. + * The Gregorian implementation assumes a yearWoy in gregorian format, according to the current era. + * @return the extended year, UCAL_EXTENDED_YEAR + * @internal + */ + virtual int32_t handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t woy); + + + /** + * Subclasses may override this method to compute several fields + * specific to each calendar system. These are: + * + *
  • ERA + *
  • YEAR + *
  • MONTH + *
  • DAY_OF_MONTH + *
  • DAY_OF_YEAR + *
  • EXTENDED_YEAR
+ * + *

The GregorianCalendar implementation implements + * a calendar with the specified Julian/Gregorian cutover date. + * @internal + */ + virtual void handleComputeFields(int32_t julianDay, UErrorCode &status); + + private: + /** + * Compute the julian day number of the given year. + * @param isGregorian if true, using Gregorian calendar, otherwise using Julian calendar + * @param year the given year. + * @param isLeap true if the year is a leap year. + * @return + */ + static double computeJulianDayOfYear(UBool isGregorian, int32_t year, + UBool& isLeap); + + /** + * Validates the values of the set time fields. True if they're all valid. + * @return True if the set time fields are all valid. + */ + UBool validateFields(void) const; + + /** + * Validates the value of the given time field. True if it's valid. + */ + UBool boundsCheck(int32_t value, UCalendarDateFields field) const; + + /** + * Return the pseudo-time-stamp for two fields, given their + * individual pseudo-time-stamps. If either of the fields + * is unset, then the aggregate is unset. Otherwise, the + * aggregate is the later of the two stamps. + * @param stamp_a One given field. + * @param stamp_b Another given field. + * @return the pseudo-time-stamp for two fields + */ + int32_t aggregateStamp(int32_t stamp_a, int32_t stamp_b); + + /** + * The point at which the Gregorian calendar rules are used, measured in + * milliseconds from the standard epoch. Default is October 15, 1582 + * (Gregorian) 00:00:00 UTC, that is, October 4, 1582 (Julian) is followed + * by October 15, 1582 (Gregorian). This corresponds to Julian day number + * 2299161. This is measured from the standard epoch, not in Julian Days. + */ + UDate fGregorianCutover; + + /** + * Julian day number of the Gregorian cutover + */ + int32_t fCutoverJulianDay; + + /** + * Midnight, local time (using this Calendar's TimeZone) at or before the + * gregorianCutover. This is a pure date value with no time of day or + * timezone component. + */ + UDate fNormalizedGregorianCutover;// = gregorianCutover; + + /** + * The year of the gregorianCutover, with 0 representing + * 1 BC, -1 representing 2 BC, etc. + */ + int32_t fGregorianCutoverYear;// = 1582; + + /** + * The year of the gregorianCutover, with 0 representing + * 1 BC, -1 representing 2 BC, etc. + */ + int32_t fGregorianCutoverJulianDay;// = 2299161; + + /** + * Converts time as milliseconds to Julian date. The Julian date used here is not a + * true Julian date, since it is measured from midnight, not noon. + * + * @param millis The given milliseconds. + * @return The Julian date number. + */ + static double millisToJulianDay(UDate millis); + + /** + * Converts Julian date to time as milliseconds. The Julian date used here is not a + * true Julian date, since it is measured from midnight, not noon. + * + * @param julian The given Julian date number. + * @return Time as milliseconds. + */ + static UDate julianDayToMillis(double julian); + + /** + * Used by handleComputeJulianDay() and handleComputeMonthStart(). + * Temporary field indicating whether the calendar is currently Gregorian as opposed to Julian. + */ + UBool fIsGregorian; + + /** + * Used by handleComputeJulianDay() and handleComputeMonthStart(). + * Temporary field indicating that the sense of the gregorian cutover should be inverted + * to handle certain calculations on and around the cutover date. + */ + UBool fInvertGregorian; + + + public: // internal implementation + + /** + * @return TRUE if this calendar has the notion of a default century + * @internal + */ + virtual UBool haveDefaultCentury() const; + + /** + * @return the start of the default century + * @internal + */ + virtual UDate defaultCenturyStart() const; + + /** + * @return the beginning year of the default century + * @internal + */ + virtual int32_t defaultCenturyStartYear() const; +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // _GREGOCAL +//eof + diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/icudataver.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/icudataver.h new file mode 100644 index 0000000..1cb202e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/icudataver.h @@ -0,0 +1,43 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2009-2013, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +*/ + + +/** + * \file + * \brief C API: access to ICU Data Version number + */ + +#ifndef __ICU_DATA_VER_H__ +#define __ICU_DATA_VER_H__ + +#include "unicode/utypes.h" + +/** + * @stable ICU 49 + */ +#define U_ICU_VERSION_BUNDLE "icuver" + +/** + * @stable ICU 49 + */ +#define U_ICU_DATA_KEY "DataVersion" + +/** + * Retrieves the data version from icuver and stores it in dataVersionFillin. + * + * @param dataVersionFillin icuver data version information to be filled in if not-null + * @param status stores the error code from the calls to resource bundle + * + * @stable ICU 49 + */ +U_STABLE void U_EXPORT2 u_getDataVersion(UVersionInfo dataVersionFillin, UErrorCode *status); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/icuplug.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/icuplug.h new file mode 100644 index 0000000..1a894a7 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/icuplug.h @@ -0,0 +1,388 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2009-2015, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* +* FILE NAME : icuplug.h +* +* Date Name Description +* 10/29/2009 sl New. +****************************************************************************** +*/ + +/** + * \file + * \brief C API: ICU Plugin API + * + *

C API: ICU Plugin API

+ * + *

C API allowing run-time loadable modules that extend or modify ICU functionality.

+ * + *

Loading and Configuration

+ * + *

At ICU startup time, the environment variable "ICU_PLUGINS" will be + * queried for a directory name. If it is not set, the preprocessor symbol + * "DEFAULT_ICU_PLUGINS" will be checked for a default value.

+ * + *

Within the above-named directory, the file "icuplugins##.txt" will be + * opened, if present, where ## is the major+minor number of the currently + * running ICU (such as, 44 for ICU 4.4, thus icuplugins44.txt)

+ * + *

The configuration file has this format:

+ * + *
    + *
  • Hash (#) begins a comment line
  • + * + *
  • Non-comment lines have two or three components: + * LIBRARYNAME ENTRYPOINT [ CONFIGURATION .. ]
  • + * + *
  • Tabs or spaces separate the three items.
  • + * + *
  • LIBRARYNAME is the name of a shared library, either a short name if + * it is on the loader path, or a full pathname.
  • + * + *
  • ENTRYPOINT is the short (undecorated) symbol name of the plugin's + * entrypoint, as above.
  • + * + *
  • CONFIGURATION is the entire rest of the line . It's passed as-is to + * the plugin.
  • + *
+ * + *

An example configuration file is, in its entirety:

+ * + * \code + * # this is icuplugins44.txt + * testplug.dll myPlugin hello=world + * \endcode + *

Plugins are categorized as "high" or "low" level. Low level are those + * which must be run BEFORE high level plugins, and before any operations + * which cause ICU to be 'initialized'. If a plugin is low level but + * causes ICU to allocate memory or become initialized, that plugin is said + * to cause a 'level change'.

+ * + *

At load time, ICU first queries all plugins to determine their level, + * then loads all 'low' plugins first, and then loads all 'high' plugins. + * Plugins are otherwise loaded in the order listed in the configuration file.

+ * + *

Implementing a Plugin

+ * \code + * U_CAPI UPlugTokenReturn U_EXPORT2 + * myPlugin (UPlugData *plug, UPlugReason reason, UErrorCode *status) { + * if(reason==UPLUG_REASON_QUERY) { + * uplug_setPlugName(plug, "Simple Plugin"); + * uplug_setPlugLevel(plug, UPLUG_LEVEL_HIGH); + * } else if(reason==UPLUG_REASON_LOAD) { + * ... Set up some ICU things here.... + * } else if(reason==UPLUG_REASON_UNLOAD) { + * ... unload, clean up ... + * } + * return UPLUG_TOKEN; + * } + * \endcode + * + *

The UPlugData* is an opaque pointer to the plugin-specific data, and is + * used in all other API calls.

+ * + *

The API contract is:

+ *
  1. The plugin MUST always return UPLUG_TOKEN as a return value- to + * indicate that it is a valid plugin.
  2. + * + *
  3. When the 'reason' parameter is set to UPLUG_REASON_QUERY, the + * plugin MUST call uplug_setPlugLevel() to indicate whether it is a high + * level or low level plugin.
  4. + * + *
  5. When the 'reason' parameter is UPLUG_REASON_QUERY, the plugin + * SHOULD call uplug_setPlugName to indicate a human readable plugin name.
+ * + * + * \internal ICU 4.4 Technology Preview + */ + + +#ifndef ICUPLUG_H +#define ICUPLUG_H + +#include "unicode/utypes.h" + + +#if UCONFIG_ENABLE_PLUGINS + + + +/* === Basic types === */ + +#ifndef U_HIDE_INTERNAL_API +/** + * @{ + * Opaque structure passed to/from a plugin. + * use the APIs to access it. + * @internal ICU 4.4 Technology Preview + */ + +struct UPlugData; +typedef struct UPlugData UPlugData; + +/** @} */ + +/** + * Random Token to identify a valid ICU plugin. Plugins must return this + * from the entrypoint. + * @internal ICU 4.4 Technology Preview + */ +#define UPLUG_TOKEN 0x54762486 + +/** + * Max width of names, symbols, and configuration strings + * @internal ICU 4.4 Technology Preview + */ +#define UPLUG_NAME_MAX 100 + + +/** + * Return value from a plugin entrypoint. + * Must always be set to UPLUG_TOKEN + * @see UPLUG_TOKEN + * @internal ICU 4.4 Technology Preview + */ +typedef uint32_t UPlugTokenReturn; + +/** + * Reason code for the entrypoint's call + * @internal ICU 4.4 Technology Preview + */ +typedef enum { + UPLUG_REASON_QUERY = 0, /**< The plugin is being queried for info. **/ + UPLUG_REASON_LOAD = 1, /**< The plugin is being loaded. **/ + UPLUG_REASON_UNLOAD = 2, /**< The plugin is being unloaded. **/ + /** + * Number of known reasons. + * @internal The numeric value may change over time, see ICU ticket #12420. + */ + UPLUG_REASON_COUNT +} UPlugReason; + + +/** + * Level of plugin loading + * INITIAL: UNKNOWN + * QUERY: INVALID -> { LOW | HIGH } + * ERR -> INVALID + * @internal ICU 4.4 Technology Preview + */ +typedef enum { + UPLUG_LEVEL_INVALID = 0, /**< The plugin is invalid, hasn't called uplug_setLevel, or can't load. **/ + UPLUG_LEVEL_UNKNOWN = 1, /**< The plugin is waiting to be installed. **/ + UPLUG_LEVEL_LOW = 2, /**< The plugin must be called before u_init completes **/ + UPLUG_LEVEL_HIGH = 3, /**< The plugin can run at any time. **/ + /** + * Number of known levels. + * @internal The numeric value may change over time, see ICU ticket #12420. + */ + UPLUG_LEVEL_COUNT +} UPlugLevel; + +/** + * Entrypoint for an ICU plugin. + * @param plug the UPlugData handle. + * @param status the plugin's extended status code. + * @return A valid plugin must return UPLUG_TOKEN + * @internal ICU 4.4 Technology Preview + */ +typedef UPlugTokenReturn (U_EXPORT2 UPlugEntrypoint) ( + UPlugData *plug, + UPlugReason reason, + UErrorCode *status); + +/* === Needed for Implementing === */ + +/** + * Request that this plugin not be unloaded at cleanup time. + * This is appropriate for plugins which cannot be cleaned up. + * @see u_cleanup() + * @param plug plugin + * @param dontUnload set true if this plugin can't be unloaded + * @internal ICU 4.4 Technology Preview + */ +U_INTERNAL void U_EXPORT2 +uplug_setPlugNoUnload(UPlugData *plug, UBool dontUnload); + +/** + * Set the level of this plugin. + * @param plug plugin data handle + * @param level the level of this plugin + * @internal ICU 4.4 Technology Preview + */ +U_INTERNAL void U_EXPORT2 +uplug_setPlugLevel(UPlugData *plug, UPlugLevel level); + +/** + * Get the level of this plugin. + * @param plug plugin data handle + * @return the level of this plugin + * @internal ICU 4.4 Technology Preview + */ +U_INTERNAL UPlugLevel U_EXPORT2 +uplug_getPlugLevel(UPlugData *plug); + +/** + * Get the lowest level of plug which can currently load. + * For example, if UPLUG_LEVEL_LOW is returned, then low level plugins may load + * if UPLUG_LEVEL_HIGH is returned, then only high level plugins may load. + * @return the lowest level of plug which can currently load + * @internal ICU 4.4 Technology Preview + */ +U_INTERNAL UPlugLevel U_EXPORT2 +uplug_getCurrentLevel(void); + + +/** + * Get plug load status + * @return The error code of this plugin's load attempt. + * @internal ICU 4.4 Technology Preview + */ +U_INTERNAL UErrorCode U_EXPORT2 +uplug_getPlugLoadStatus(UPlugData *plug); + +/** + * Set the human-readable name of this plugin. + * @param plug plugin data handle + * @param name the name of this plugin. The first UPLUG_NAME_MAX characters willi be copied into a new buffer. + * @internal ICU 4.4 Technology Preview + */ +U_INTERNAL void U_EXPORT2 +uplug_setPlugName(UPlugData *plug, const char *name); + +/** + * Get the human-readable name of this plugin. + * @param plug plugin data handle + * @return the name of this plugin + * @internal ICU 4.4 Technology Preview + */ +U_INTERNAL const char * U_EXPORT2 +uplug_getPlugName(UPlugData *plug); + +/** + * Return the symbol name for this plugin, if known. + * @param plug plugin data handle + * @return the symbol name, or NULL + * @internal ICU 4.4 Technology Preview + */ +U_INTERNAL const char * U_EXPORT2 +uplug_getSymbolName(UPlugData *plug); + +/** + * Return the library name for this plugin, if known. + * @param plug plugin data handle + * @param status error code + * @return the library name, or NULL + * @internal ICU 4.4 Technology Preview + */ +U_INTERNAL const char * U_EXPORT2 +uplug_getLibraryName(UPlugData *plug, UErrorCode *status); + +/** + * Return the library used for this plugin, if known. + * Plugins could use this to load data out of their + * @param plug plugin data handle + * @return the library, or NULL + * @internal ICU 4.4 Technology Preview + */ +U_INTERNAL void * U_EXPORT2 +uplug_getLibrary(UPlugData *plug); + +/** + * Return the plugin-specific context data. + * @param plug plugin data handle + * @return the context, or NULL if not set + * @internal ICU 4.4 Technology Preview + */ +U_INTERNAL void * U_EXPORT2 +uplug_getContext(UPlugData *plug); + +/** + * Set the plugin-specific context data. + * @param plug plugin data handle + * @param context new context to set + * @internal ICU 4.4 Technology Preview + */ +U_INTERNAL void U_EXPORT2 +uplug_setContext(UPlugData *plug, void *context); + + +/** + * Get the configuration string, if available. + * The string is in the platform default codepage. + * @param plug plugin data handle + * @return configuration string, or else null. + * @internal ICU 4.4 Technology Preview + */ +U_INTERNAL const char * U_EXPORT2 +uplug_getConfiguration(UPlugData *plug); + +/** + * Return all currently installed plugins, from newest to oldest + * Usage Example: + * \code + * UPlugData *plug = NULL; + * while(plug=uplug_nextPlug(plug)) { + * ... do something with 'plug' ... + * } + * \endcode + * Not thread safe- do not call while plugs are added or removed. + * @param prior pass in 'NULL' to get the first (most recent) plug, + * otherwise pass the value returned on a prior call to uplug_nextPlug + * @return the next oldest plugin, or NULL if no more. + * @internal ICU 4.4 Technology Preview + */ +U_INTERNAL UPlugData* U_EXPORT2 +uplug_nextPlug(UPlugData *prior); + +/** + * Inject a plugin as if it were loaded from a library. + * This is useful for testing plugins. + * Note that it will have a 'NULL' library pointer associated + * with it, and therefore no llibrary will be closed at cleanup time. + * Low level plugins may not be able to load, as ordering can't be enforced. + * @param entrypoint entrypoint to install + * @param config user specified configuration string, if available, or NULL. + * @param status error result + * @return the new UPlugData associated with this plugin, or NULL if error. + * @internal ICU 4.4 Technology Preview + */ +U_INTERNAL UPlugData* U_EXPORT2 +uplug_loadPlugFromEntrypoint(UPlugEntrypoint *entrypoint, const char *config, UErrorCode *status); + + +/** + * Inject a plugin from a library, as if the information came from a config file. + * Low level plugins may not be able to load, and ordering can't be enforced. + * @param libName DLL name to load + * @param sym symbol of plugin (UPlugEntrypoint function) + * @param config configuration string, or NULL + * @param status error result + * @return the new UPlugData associated with this plugin, or NULL if error. + * @internal ICU 4.4 Technology Preview + */ +U_INTERNAL UPlugData* U_EXPORT2 +uplug_loadPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status); + +/** + * Remove a plugin. + * Will request the plugin to be unloaded, and close the library if needed + * @param plug plugin handle to close + * @param status error result + * @internal ICU 4.4 Technology Preview + */ +U_INTERNAL void U_EXPORT2 +uplug_removePlug(UPlugData *plug, UErrorCode *status); +#endif /* U_HIDE_INTERNAL_API */ + +#endif /* UCONFIG_ENABLE_PLUGINS */ + +#endif /* _ICUPLUG */ + diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/idna.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/idna.h new file mode 100644 index 0000000..f08658e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/idna.h @@ -0,0 +1,325 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2010-2012, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* file name: idna.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2010mar05 +* created by: Markus W. Scherer +*/ + +#ifndef __IDNA_H__ +#define __IDNA_H__ + +/** + * \file + * \brief C++ API: Internationalizing Domain Names in Applications (IDNA) + */ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_IDNA + +#include "unicode/bytestream.h" +#include "unicode/stringpiece.h" +#include "unicode/uidna.h" +#include "unicode/unistr.h" + +U_NAMESPACE_BEGIN + +class IDNAInfo; + +/** + * Abstract base class for IDNA processing. + * See http://www.unicode.org/reports/tr46/ + * and http://www.ietf.org/rfc/rfc3490.txt + * + * The IDNA class is not intended for public subclassing. + * + * This C++ API currently only implements UTS #46. + * The uidna.h C API implements both UTS #46 (functions using UIDNA service object) + * and IDNA2003 (functions that do not use a service object). + * @stable ICU 4.6 + */ +class U_COMMON_API IDNA : public UObject { +public: + /** + * Destructor. + * @stable ICU 4.6 + */ + ~IDNA(); + + /** + * Returns an IDNA instance which implements UTS #46. + * Returns an unmodifiable instance, owned by the caller. + * Cache it for multiple operations, and delete it when done. + * The instance is thread-safe, that is, it can be used concurrently. + * + * UTS #46 defines Unicode IDNA Compatibility Processing, + * updated to the latest version of Unicode and compatible with both + * IDNA2003 and IDNA2008. + * + * The worker functions use transitional processing, including deviation mappings, + * unless UIDNA_NONTRANSITIONAL_TO_ASCII or UIDNA_NONTRANSITIONAL_TO_UNICODE + * is used in which case the deviation characters are passed through without change. + * + * Disallowed characters are mapped to U+FFFD. + * + * For available options see the uidna.h header. + * Operations with the UTS #46 instance do not support the + * UIDNA_ALLOW_UNASSIGNED option. + * + * By default, the UTS #46 implementation allows all ASCII characters (as valid or mapped). + * When the UIDNA_USE_STD3_RULES option is used, ASCII characters other than + * letters, digits, hyphen (LDH) and dot/full stop are disallowed and mapped to U+FFFD. + * + * @param options Bit set to modify the processing and error checking. + * See option bit set values in uidna.h. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the UTS #46 IDNA instance, if successful + * @stable ICU 4.6 + */ + static IDNA * + createUTS46Instance(uint32_t options, UErrorCode &errorCode); + + /** + * Converts a single domain name label into its ASCII form for DNS lookup. + * If any processing step fails, then info.hasErrors() will be TRUE and + * the result might not be an ASCII string. + * The label might be modified according to the types of errors. + * Labels with severe errors will be left in (or turned into) their Unicode form. + * + * The UErrorCode indicates an error only in exceptional cases, + * such as a U_MEMORY_ALLOCATION_ERROR. + * + * @param label Input domain name label + * @param dest Destination string object + * @param info Output container of IDNA processing details. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return dest + * @stable ICU 4.6 + */ + virtual UnicodeString & + labelToASCII(const UnicodeString &label, UnicodeString &dest, + IDNAInfo &info, UErrorCode &errorCode) const = 0; + + /** + * Converts a single domain name label into its Unicode form for human-readable display. + * If any processing step fails, then info.hasErrors() will be TRUE. + * The label might be modified according to the types of errors. + * + * The UErrorCode indicates an error only in exceptional cases, + * such as a U_MEMORY_ALLOCATION_ERROR. + * + * @param label Input domain name label + * @param dest Destination string object + * @param info Output container of IDNA processing details. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return dest + * @stable ICU 4.6 + */ + virtual UnicodeString & + labelToUnicode(const UnicodeString &label, UnicodeString &dest, + IDNAInfo &info, UErrorCode &errorCode) const = 0; + + /** + * Converts a whole domain name into its ASCII form for DNS lookup. + * If any processing step fails, then info.hasErrors() will be TRUE and + * the result might not be an ASCII string. + * The domain name might be modified according to the types of errors. + * Labels with severe errors will be left in (or turned into) their Unicode form. + * + * The UErrorCode indicates an error only in exceptional cases, + * such as a U_MEMORY_ALLOCATION_ERROR. + * + * @param name Input domain name + * @param dest Destination string object + * @param info Output container of IDNA processing details. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return dest + * @stable ICU 4.6 + */ + virtual UnicodeString & + nameToASCII(const UnicodeString &name, UnicodeString &dest, + IDNAInfo &info, UErrorCode &errorCode) const = 0; + + /** + * Converts a whole domain name into its Unicode form for human-readable display. + * If any processing step fails, then info.hasErrors() will be TRUE. + * The domain name might be modified according to the types of errors. + * + * The UErrorCode indicates an error only in exceptional cases, + * such as a U_MEMORY_ALLOCATION_ERROR. + * + * @param name Input domain name + * @param dest Destination string object + * @param info Output container of IDNA processing details. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return dest + * @stable ICU 4.6 + */ + virtual UnicodeString & + nameToUnicode(const UnicodeString &name, UnicodeString &dest, + IDNAInfo &info, UErrorCode &errorCode) const = 0; + + // UTF-8 versions of the processing methods ---------------------------- *** + + /** + * Converts a single domain name label into its ASCII form for DNS lookup. + * UTF-8 version of labelToASCII(), same behavior. + * + * @param label Input domain name label + * @param dest Destination byte sink; Flush()ed if successful + * @param info Output container of IDNA processing details. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return dest + * @stable ICU 4.6 + */ + virtual void + labelToASCII_UTF8(StringPiece label, ByteSink &dest, + IDNAInfo &info, UErrorCode &errorCode) const; + + /** + * Converts a single domain name label into its Unicode form for human-readable display. + * UTF-8 version of labelToUnicode(), same behavior. + * + * @param label Input domain name label + * @param dest Destination byte sink; Flush()ed if successful + * @param info Output container of IDNA processing details. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return dest + * @stable ICU 4.6 + */ + virtual void + labelToUnicodeUTF8(StringPiece label, ByteSink &dest, + IDNAInfo &info, UErrorCode &errorCode) const; + + /** + * Converts a whole domain name into its ASCII form for DNS lookup. + * UTF-8 version of nameToASCII(), same behavior. + * + * @param name Input domain name + * @param dest Destination byte sink; Flush()ed if successful + * @param info Output container of IDNA processing details. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return dest + * @stable ICU 4.6 + */ + virtual void + nameToASCII_UTF8(StringPiece name, ByteSink &dest, + IDNAInfo &info, UErrorCode &errorCode) const; + + /** + * Converts a whole domain name into its Unicode form for human-readable display. + * UTF-8 version of nameToUnicode(), same behavior. + * + * @param name Input domain name + * @param dest Destination byte sink; Flush()ed if successful + * @param info Output container of IDNA processing details. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return dest + * @stable ICU 4.6 + */ + virtual void + nameToUnicodeUTF8(StringPiece name, ByteSink &dest, + IDNAInfo &info, UErrorCode &errorCode) const; +}; + +class UTS46; + +/** + * Output container for IDNA processing errors. + * The IDNAInfo class is not suitable for subclassing. + * @stable ICU 4.6 + */ +class U_COMMON_API IDNAInfo : public UMemory { +public: + /** + * Constructor for stack allocation. + * @stable ICU 4.6 + */ + IDNAInfo() : errors(0), labelErrors(0), isTransDiff(FALSE), isBiDi(FALSE), isOkBiDi(TRUE) {} + /** + * Were there IDNA processing errors? + * @return TRUE if there were processing errors + * @stable ICU 4.6 + */ + UBool hasErrors() const { return errors!=0; } + /** + * Returns a bit set indicating IDNA processing errors. + * See UIDNA_ERROR_... constants in uidna.h. + * @return bit set of processing errors + * @stable ICU 4.6 + */ + uint32_t getErrors() const { return errors; } + /** + * Returns TRUE if transitional and nontransitional processing produce different results. + * This is the case when the input label or domain name contains + * one or more deviation characters outside a Punycode label (see UTS #46). + *
    + *
  • With nontransitional processing, such characters are + * copied to the destination string. + *
  • With transitional processing, such characters are + * mapped (sharp s/sigma) or removed (joiner/nonjoiner). + *
+ * @return TRUE if transitional and nontransitional processing produce different results + * @stable ICU 4.6 + */ + UBool isTransitionalDifferent() const { return isTransDiff; } + +private: + friend class UTS46; + + IDNAInfo(const IDNAInfo &other); // no copying + IDNAInfo &operator=(const IDNAInfo &other); // no copying + + void reset() { + errors=labelErrors=0; + isTransDiff=FALSE; + isBiDi=FALSE; + isOkBiDi=TRUE; + } + + uint32_t errors, labelErrors; + UBool isTransDiff; + UBool isBiDi; + UBool isOkBiDi; +}; + +U_NAMESPACE_END + +#endif // UCONFIG_NO_IDNA +#endif // __IDNA_H__ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/listformatter.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/listformatter.h new file mode 100644 index 0000000..180fbcb --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/listformatter.h @@ -0,0 +1,171 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2012-2016, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: listformatter.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 20120426 +* created by: Umesh P. Nair +*/ + +#ifndef __LISTFORMATTER_H__ +#define __LISTFORMATTER_H__ + +#include "unicode/utypes.h" + +#include "unicode/unistr.h" +#include "unicode/locid.h" + +U_NAMESPACE_BEGIN + +/** @internal */ +class Hashtable; + +/** @internal */ +struct ListFormatInternal; + +/* The following can't be #ifndef U_HIDE_INTERNAL_API, needed for other .h file declarations */ +/** @internal */ +struct ListFormatData : public UMemory { + UnicodeString twoPattern; + UnicodeString startPattern; + UnicodeString middlePattern; + UnicodeString endPattern; + + ListFormatData(const UnicodeString& two, const UnicodeString& start, const UnicodeString& middle, const UnicodeString& end) : + twoPattern(two), startPattern(start), middlePattern(middle), endPattern(end) {} +}; + + +/** + * \file + * \brief C++ API: API for formatting a list. + */ + + +/** + * An immutable class for formatting a list, using data from CLDR (or supplied + * separately). + * + * Example: Input data ["Alice", "Bob", "Charlie", "Delta"] will be formatted + * as "Alice, Bob, Charlie and Delta" in English. + * + * The ListFormatter class is not intended for public subclassing. + * @stable ICU 50 + */ +class U_COMMON_API ListFormatter : public UObject{ + + public: + + /** + * Copy constructor. + * @stable ICU 52 + */ + ListFormatter(const ListFormatter&); + + /** + * Assignment operator. + * @stable ICU 52 + */ + ListFormatter& operator=(const ListFormatter& other); + + /** + * Creates a ListFormatter appropriate for the default locale. + * + * @param errorCode ICU error code, set if no data available for default locale. + * @return Pointer to a ListFormatter object for the default locale, + * created from internal data derived from CLDR data. + * @stable ICU 50 + */ + static ListFormatter* createInstance(UErrorCode& errorCode); + + /** + * Creates a ListFormatter appropriate for a locale. + * + * @param locale The locale. + * @param errorCode ICU error code, set if no data available for the given locale. + * @return A ListFormatter object created from internal data derived from + * CLDR data. + * @stable ICU 50 + */ + static ListFormatter* createInstance(const Locale& locale, UErrorCode& errorCode); + +#ifndef U_HIDE_INTERNAL_API + /** + * Creates a ListFormatter appropriate for a locale and style. + * + * @param locale The locale. + * @param style the style, either "standard", "duration", or "duration-short" + * @param errorCode ICU error code, set if no data available for the given locale. + * @return A ListFormatter object created from internal data derived from + * CLDR data. + * @internal + */ + static ListFormatter* createInstance(const Locale& locale, const char* style, UErrorCode& errorCode); +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Destructor. + * + * @stable ICU 50 + */ + virtual ~ListFormatter(); + + + /** + * Formats a list of strings. + * + * @param items An array of strings to be combined and formatted. + * @param n_items Length of the array items. + * @param appendTo The string to which the result should be appended to. + * @param errorCode ICU error code, set if there is an error. + * @return Formatted string combining the elements of items, appended to appendTo. + * @stable ICU 50 + */ + UnicodeString& format(const UnicodeString items[], int32_t n_items, + UnicodeString& appendTo, UErrorCode& errorCode) const; + +#ifndef U_HIDE_INTERNAL_API + /** + @internal for MeasureFormat + */ + UnicodeString& format( + const UnicodeString items[], + int32_t n_items, + UnicodeString& appendTo, + int32_t index, + int32_t &offset, + UErrorCode& errorCode) const; + /** + * @internal constructor made public for testing. + */ + ListFormatter(const ListFormatData &data, UErrorCode &errorCode); + /** + * @internal constructor made public for testing. + */ + ListFormatter(const ListFormatInternal* listFormatterInternal); +#endif /* U_HIDE_INTERNAL_API */ + + private: + static void initializeHash(UErrorCode& errorCode); + static const ListFormatInternal* getListFormatInternal(const Locale& locale, const char *style, UErrorCode& errorCode); + struct ListPatternsSink; + static ListFormatInternal* loadListFormatInternal(const Locale& locale, const char* style, UErrorCode& errorCode); + + ListFormatter(); + + ListFormatInternal* owned; + const ListFormatInternal* data; +}; + +U_NAMESPACE_END + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/localpointer.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/localpointer.h new file mode 100644 index 0000000..e17ee3d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/localpointer.h @@ -0,0 +1,524 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2009-2016, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: localpointer.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2009nov13 +* created by: Markus W. Scherer +*/ + +#ifndef __LOCALPOINTER_H__ +#define __LOCALPOINTER_H__ + +/** + * \file + * \brief C++ API: "Smart pointers" for use with and in ICU4C C++ code. + * + * These classes are inspired by + * - std::auto_ptr + * - boost::scoped_ptr & boost::scoped_array + * - Taligent Safe Pointers (TOnlyPointerTo) + * + * but none of those provide for all of the goals for ICU smart pointers: + * - Smart pointer owns the object and releases it when it goes out of scope. + * - No transfer of ownership via copy/assignment to reduce misuse. Simpler & more robust. + * - ICU-compatible: No exceptions. + * - Need to be able to orphan/release the pointer and its ownership. + * - Need variants for normal C++ object pointers, C++ arrays, and ICU C service objects. + * + * For details see http://site.icu-project.org/design/cpp/scoped_ptr + */ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * "Smart pointer" base class; do not use directly: use LocalPointer etc. + * + * Base class for smart pointer classes that do not throw exceptions. + * + * Do not use this base class directly, since it does not delete its pointer. + * A subclass must implement methods that delete the pointer: + * Destructor and adoptInstead(). + * + * There is no operator T *() provided because the programmer must decide + * whether to use getAlias() (without transfer of ownership) or orphan() + * (with transfer of ownership and NULLing of the pointer). + * + * @see LocalPointer + * @see LocalArray + * @see U_DEFINE_LOCAL_OPEN_POINTER + * @stable ICU 4.4 + */ +template +class LocalPointerBase { +public: + /** + * Constructor takes ownership. + * @param p simple pointer to an object that is adopted + * @stable ICU 4.4 + */ + explicit LocalPointerBase(T *p=NULL) : ptr(p) {} + /** + * Destructor deletes the object it owns. + * Subclass must override: Base class does nothing. + * @stable ICU 4.4 + */ + ~LocalPointerBase() { /* delete ptr; */ } + /** + * NULL check. + * @return TRUE if ==NULL + * @stable ICU 4.4 + */ + UBool isNull() const { return ptr==NULL; } + /** + * NULL check. + * @return TRUE if !=NULL + * @stable ICU 4.4 + */ + UBool isValid() const { return ptr!=NULL; } + /** + * Comparison with a simple pointer, so that existing code + * with ==NULL need not be changed. + * @param other simple pointer for comparison + * @return true if this pointer value equals other + * @stable ICU 4.4 + */ + bool operator==(const T *other) const { return ptr==other; } + /** + * Comparison with a simple pointer, so that existing code + * with !=NULL need not be changed. + * @param other simple pointer for comparison + * @return true if this pointer value differs from other + * @stable ICU 4.4 + */ + bool operator!=(const T *other) const { return ptr!=other; } + /** + * Access without ownership change. + * @return the pointer value + * @stable ICU 4.4 + */ + T *getAlias() const { return ptr; } + /** + * Access without ownership change. + * @return the pointer value as a reference + * @stable ICU 4.4 + */ + T &operator*() const { return *ptr; } + /** + * Access without ownership change. + * @return the pointer value + * @stable ICU 4.4 + */ + T *operator->() const { return ptr; } + /** + * Gives up ownership; the internal pointer becomes NULL. + * @return the pointer value; + * caller becomes responsible for deleting the object + * @stable ICU 4.4 + */ + T *orphan() { + T *p=ptr; + ptr=NULL; + return p; + } + /** + * Deletes the object it owns, + * and adopts (takes ownership of) the one passed in. + * Subclass must override: Base class does not delete the object. + * @param p simple pointer to an object that is adopted + * @stable ICU 4.4 + */ + void adoptInstead(T *p) { + // delete ptr; + ptr=p; + } +protected: + /** + * Actual pointer. + * @internal + */ + T *ptr; +private: + // No comparison operators with other LocalPointerBases. + bool operator==(const LocalPointerBase &other); + bool operator!=(const LocalPointerBase &other); + // No ownership sharing: No copy constructor, no assignment operator. + LocalPointerBase(const LocalPointerBase &other); + void operator=(const LocalPointerBase &other); + // No heap allocation. Use only on the stack. + static void * U_EXPORT2 operator new(size_t size); + static void * U_EXPORT2 operator new[](size_t size); +#if U_HAVE_PLACEMENT_NEW + static void * U_EXPORT2 operator new(size_t, void *ptr); +#endif +}; + +/** + * "Smart pointer" class, deletes objects via the standard C++ delete operator. + * For most methods see the LocalPointerBase base class. + * + * Usage example: + * \code + * LocalPointer s(new UnicodeString((UChar32)0x50005)); + * int32_t length=s->length(); // 2 + * char16_t lead=s->charAt(0); // 0xd900 + * if(some condition) { return; } // no need to explicitly delete the pointer + * s.adoptInstead(new UnicodeString((char16_t)0xfffc)); + * length=s->length(); // 1 + * // no need to explicitly delete the pointer + * \endcode + * + * @see LocalPointerBase + * @stable ICU 4.4 + */ +template +class LocalPointer : public LocalPointerBase { +public: + using LocalPointerBase::operator*; + using LocalPointerBase::operator->; + /** + * Constructor takes ownership. + * @param p simple pointer to an object that is adopted + * @stable ICU 4.4 + */ + explicit LocalPointer(T *p=NULL) : LocalPointerBase(p) {} + /** + * Constructor takes ownership and reports an error if NULL. + * + * This constructor is intended to be used with other-class constructors + * that may report a failure UErrorCode, + * so that callers need to check only for U_FAILURE(errorCode) + * and not also separately for isNull(). + * + * @param p simple pointer to an object that is adopted + * @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR + * if p==NULL and no other failure code had been set + * @stable ICU 55 + */ + LocalPointer(T *p, UErrorCode &errorCode) : LocalPointerBase(p) { + if(p==NULL && U_SUCCESS(errorCode)) { + errorCode=U_MEMORY_ALLOCATION_ERROR; + } + } + /** + * Move constructor, leaves src with isNull(). + * @param src source smart pointer + * @stable ICU 56 + */ + LocalPointer(LocalPointer &&src) U_NOEXCEPT : LocalPointerBase(src.ptr) { + src.ptr=NULL; + } + /** + * Destructor deletes the object it owns. + * @stable ICU 4.4 + */ + ~LocalPointer() { + delete LocalPointerBase::ptr; + } + /** + * Move assignment operator, leaves src with isNull(). + * The behavior is undefined if *this and src are the same object. + * @param src source smart pointer + * @return *this + * @stable ICU 56 + */ + LocalPointer &operator=(LocalPointer &&src) U_NOEXCEPT { + return moveFrom(src); + } + // do not use #ifndef U_HIDE_DRAFT_API for moveFrom, needed by non-draft API + /** + * Move assignment, leaves src with isNull(). + * The behavior is undefined if *this and src are the same object. + * + * Can be called explicitly, does not need C++11 support. + * @param src source smart pointer + * @return *this + * @draft ICU 56 + */ + LocalPointer &moveFrom(LocalPointer &src) U_NOEXCEPT { + delete LocalPointerBase::ptr; + LocalPointerBase::ptr=src.ptr; + src.ptr=NULL; + return *this; + } + /** + * Swap pointers. + * @param other other smart pointer + * @stable ICU 56 + */ + void swap(LocalPointer &other) U_NOEXCEPT { + T *temp=LocalPointerBase::ptr; + LocalPointerBase::ptr=other.ptr; + other.ptr=temp; + } + /** + * Non-member LocalPointer swap function. + * @param p1 will get p2's pointer + * @param p2 will get p1's pointer + * @stable ICU 56 + */ + friend inline void swap(LocalPointer &p1, LocalPointer &p2) U_NOEXCEPT { + p1.swap(p2); + } + /** + * Deletes the object it owns, + * and adopts (takes ownership of) the one passed in. + * @param p simple pointer to an object that is adopted + * @stable ICU 4.4 + */ + void adoptInstead(T *p) { + delete LocalPointerBase::ptr; + LocalPointerBase::ptr=p; + } + /** + * Deletes the object it owns, + * and adopts (takes ownership of) the one passed in. + * + * If U_FAILURE(errorCode), then the current object is retained and the new one deleted. + * + * If U_SUCCESS(errorCode) but the input pointer is NULL, + * then U_MEMORY_ALLOCATION_ERROR is set, + * the current object is deleted, and NULL is set. + * + * @param p simple pointer to an object that is adopted + * @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR + * if p==NULL and no other failure code had been set + * @stable ICU 55 + */ + void adoptInsteadAndCheckErrorCode(T *p, UErrorCode &errorCode) { + if(U_SUCCESS(errorCode)) { + delete LocalPointerBase::ptr; + LocalPointerBase::ptr=p; + if(p==NULL) { + errorCode=U_MEMORY_ALLOCATION_ERROR; + } + } else { + delete p; + } + } +}; + +/** + * "Smart pointer" class, deletes objects via the C++ array delete[] operator. + * For most methods see the LocalPointerBase base class. + * Adds operator[] for array item access. + * + * Usage example: + * \code + * LocalArray a(new UnicodeString[2]); + * a[0].append((char16_t)0x61); + * if(some condition) { return; } // no need to explicitly delete the array + * a.adoptInstead(new UnicodeString[4]); + * a[3].append((char16_t)0x62).append((char16_t)0x63).reverse(); + * // no need to explicitly delete the array + * \endcode + * + * @see LocalPointerBase + * @stable ICU 4.4 + */ +template +class LocalArray : public LocalPointerBase { +public: + using LocalPointerBase::operator*; + using LocalPointerBase::operator->; + /** + * Constructor takes ownership. + * @param p simple pointer to an array of T objects that is adopted + * @stable ICU 4.4 + */ + explicit LocalArray(T *p=NULL) : LocalPointerBase(p) {} + /** + * Constructor takes ownership and reports an error if NULL. + * + * This constructor is intended to be used with other-class constructors + * that may report a failure UErrorCode, + * so that callers need to check only for U_FAILURE(errorCode) + * and not also separately for isNull(). + * + * @param p simple pointer to an array of T objects that is adopted + * @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR + * if p==NULL and no other failure code had been set + * @stable ICU 56 + */ + LocalArray(T *p, UErrorCode &errorCode) : LocalPointerBase(p) { + if(p==NULL && U_SUCCESS(errorCode)) { + errorCode=U_MEMORY_ALLOCATION_ERROR; + } + } + /** + * Move constructor, leaves src with isNull(). + * @param src source smart pointer + * @stable ICU 56 + */ + LocalArray(LocalArray &&src) U_NOEXCEPT : LocalPointerBase(src.ptr) { + src.ptr=NULL; + } + /** + * Destructor deletes the array it owns. + * @stable ICU 4.4 + */ + ~LocalArray() { + delete[] LocalPointerBase::ptr; + } + /** + * Move assignment operator, leaves src with isNull(). + * The behavior is undefined if *this and src are the same object. + * @param src source smart pointer + * @return *this + * @stable ICU 56 + */ + LocalArray &operator=(LocalArray &&src) U_NOEXCEPT { + return moveFrom(src); + } + // do not use #ifndef U_HIDE_DRAFT_API for moveFrom, needed by non-draft API + /** + * Move assignment, leaves src with isNull(). + * The behavior is undefined if *this and src are the same object. + * + * Can be called explicitly, does not need C++11 support. + * @param src source smart pointer + * @return *this + * @draft ICU 56 + */ + LocalArray &moveFrom(LocalArray &src) U_NOEXCEPT { + delete[] LocalPointerBase::ptr; + LocalPointerBase::ptr=src.ptr; + src.ptr=NULL; + return *this; + } + /** + * Swap pointers. + * @param other other smart pointer + * @stable ICU 56 + */ + void swap(LocalArray &other) U_NOEXCEPT { + T *temp=LocalPointerBase::ptr; + LocalPointerBase::ptr=other.ptr; + other.ptr=temp; + } + /** + * Non-member LocalArray swap function. + * @param p1 will get p2's pointer + * @param p2 will get p1's pointer + * @stable ICU 56 + */ + friend inline void swap(LocalArray &p1, LocalArray &p2) U_NOEXCEPT { + p1.swap(p2); + } + /** + * Deletes the array it owns, + * and adopts (takes ownership of) the one passed in. + * @param p simple pointer to an array of T objects that is adopted + * @stable ICU 4.4 + */ + void adoptInstead(T *p) { + delete[] LocalPointerBase::ptr; + LocalPointerBase::ptr=p; + } + /** + * Deletes the array it owns, + * and adopts (takes ownership of) the one passed in. + * + * If U_FAILURE(errorCode), then the current array is retained and the new one deleted. + * + * If U_SUCCESS(errorCode) but the input pointer is NULL, + * then U_MEMORY_ALLOCATION_ERROR is set, + * the current array is deleted, and NULL is set. + * + * @param p simple pointer to an array of T objects that is adopted + * @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR + * if p==NULL and no other failure code had been set + * @stable ICU 56 + */ + void adoptInsteadAndCheckErrorCode(T *p, UErrorCode &errorCode) { + if(U_SUCCESS(errorCode)) { + delete[] LocalPointerBase::ptr; + LocalPointerBase::ptr=p; + if(p==NULL) { + errorCode=U_MEMORY_ALLOCATION_ERROR; + } + } else { + delete[] p; + } + } + /** + * Array item access (writable). + * No index bounds check. + * @param i array index + * @return reference to the array item + * @stable ICU 4.4 + */ + T &operator[](ptrdiff_t i) const { return LocalPointerBase::ptr[i]; } +}; + +/** + * \def U_DEFINE_LOCAL_OPEN_POINTER + * "Smart pointer" definition macro, deletes objects via the closeFunction. + * Defines a subclass of LocalPointerBase which works just + * like LocalPointer except that this subclass will use the closeFunction + * rather than the C++ delete operator. + * + * Usage example: + * \code + * LocalUCaseMapPointer csm(ucasemap_open(localeID, options, &errorCode)); + * utf8OutLength=ucasemap_utf8ToLower(csm.getAlias(), + * utf8Out, (int32_t)sizeof(utf8Out), + * utf8In, utf8InLength, &errorCode); + * if(U_FAILURE(errorCode)) { return; } // no need to explicitly delete the UCaseMap + * \endcode + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction) \ + class LocalPointerClassName : public LocalPointerBase { \ + public: \ + using LocalPointerBase::operator*; \ + using LocalPointerBase::operator->; \ + explicit LocalPointerClassName(Type *p=NULL) : LocalPointerBase(p) {} \ + LocalPointerClassName(LocalPointerClassName &&src) U_NOEXCEPT \ + : LocalPointerBase(src.ptr) { \ + src.ptr=NULL; \ + } \ + ~LocalPointerClassName() { if (ptr != NULL) { closeFunction(ptr); } } \ + LocalPointerClassName &operator=(LocalPointerClassName &&src) U_NOEXCEPT { \ + return moveFrom(src); \ + } \ + LocalPointerClassName &moveFrom(LocalPointerClassName &src) U_NOEXCEPT { \ + if (ptr != NULL) { closeFunction(ptr); } \ + LocalPointerBase::ptr=src.ptr; \ + src.ptr=NULL; \ + return *this; \ + } \ + void swap(LocalPointerClassName &other) U_NOEXCEPT { \ + Type *temp=LocalPointerBase::ptr; \ + LocalPointerBase::ptr=other.ptr; \ + other.ptr=temp; \ + } \ + friend inline void swap(LocalPointerClassName &p1, LocalPointerClassName &p2) U_NOEXCEPT { \ + p1.swap(p2); \ + } \ + void adoptInstead(Type *p) { \ + if (ptr != NULL) { closeFunction(ptr); } \ + ptr=p; \ + } \ + } + +U_NAMESPACE_END + +#endif /* U_SHOW_CPLUSPLUS_API */ +#endif /* __LOCALPOINTER_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/locdspnm.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/locdspnm.h new file mode 100644 index 0000000..7f22782 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/locdspnm.h @@ -0,0 +1,207 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* Copyright (C) 2010-2016, International Business Machines Corporation and +* others. All Rights Reserved. +****************************************************************************** +*/ + +#ifndef LOCDSPNM_H +#define LOCDSPNM_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Provides display names of Locale and its components. + */ + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/locid.h" +#include "unicode/strenum.h" +#include "unicode/uscript.h" +#include "unicode/uldnames.h" +#include "unicode/udisplaycontext.h" + +U_NAMESPACE_BEGIN + +/** + * Returns display names of Locales and components of Locales. For + * more information on language, script, region, variant, key, and + * values, see Locale. + * @stable ICU 4.4 + */ +class U_COMMON_API LocaleDisplayNames : public UObject { +public: + /** + * Destructor. + * @stable ICU 4.4 + */ + virtual ~LocaleDisplayNames(); + + /** + * Convenience overload of + * {@link #createInstance(const Locale& locale, UDialectHandling dialectHandling)} + * that specifies STANDARD dialect handling. + * @param locale the display locale + * @return a LocaleDisplayNames instance + * @stable ICU 4.4 + */ + static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale); + + /** + * Returns an instance of LocaleDisplayNames that returns names + * formatted for the provided locale, using the provided + * dialectHandling. + * + * @param locale the display locale + * @param dialectHandling how to select names for locales + * @return a LocaleDisplayNames instance + * @stable ICU 4.4 + */ + static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale, + UDialectHandling dialectHandling); + + /** + * Returns an instance of LocaleDisplayNames that returns names formatted + * for the provided locale, using the provided UDisplayContext settings. + * + * @param locale the display locale + * @param contexts List of one or more context settings (e.g. for dialect + * handling, capitalization, etc. + * @param length Number of items in the contexts list + * @return a LocaleDisplayNames instance + * @stable ICU 51 + */ + static LocaleDisplayNames* U_EXPORT2 createInstance(const Locale& locale, + UDisplayContext *contexts, int32_t length); + + // getters for state + /** + * Returns the locale used to determine the display names. This is + * not necessarily the same locale passed to {@link #createInstance}. + * @return the display locale + * @stable ICU 4.4 + */ + virtual const Locale& getLocale() const = 0; + + /** + * Returns the dialect handling used in the display names. + * @return the dialect handling enum + * @stable ICU 4.4 + */ + virtual UDialectHandling getDialectHandling() const = 0; + + /** + * Returns the UDisplayContext value for the specified UDisplayContextType. + * @param type the UDisplayContextType whose value to return + * @return the UDisplayContext for the specified type. + * @stable ICU 51 + */ + virtual UDisplayContext getContext(UDisplayContextType type) const = 0; + + // names for entire locales + /** + * Returns the display name of the provided locale. + * @param locale the locale whose display name to return + * @param result receives the locale's display name + * @return the display name of the provided locale + * @stable ICU 4.4 + */ + virtual UnicodeString& localeDisplayName(const Locale& locale, + UnicodeString& result) const = 0; + + /** + * Returns the display name of the provided locale id. + * @param localeId the id of the locale whose display name to return + * @param result receives the locale's display name + * @return the display name of the provided locale + * @stable ICU 4.4 + */ + virtual UnicodeString& localeDisplayName(const char* localeId, + UnicodeString& result) const = 0; + + // names for components of a locale id + /** + * Returns the display name of the provided language code. + * @param lang the language code + * @param result receives the language code's display name + * @return the display name of the provided language code + * @stable ICU 4.4 + */ + virtual UnicodeString& languageDisplayName(const char* lang, + UnicodeString& result) const = 0; + + /** + * Returns the display name of the provided script code. + * @param script the script code + * @param result receives the script code's display name + * @return the display name of the provided script code + * @stable ICU 4.4 + */ + virtual UnicodeString& scriptDisplayName(const char* script, + UnicodeString& result) const = 0; + + /** + * Returns the display name of the provided script code. + * @param scriptCode the script code number + * @param result receives the script code's display name + * @return the display name of the provided script code + * @stable ICU 4.4 + */ + virtual UnicodeString& scriptDisplayName(UScriptCode scriptCode, + UnicodeString& result) const = 0; + + /** + * Returns the display name of the provided region code. + * @param region the region code + * @param result receives the region code's display name + * @return the display name of the provided region code + * @stable ICU 4.4 + */ + virtual UnicodeString& regionDisplayName(const char* region, + UnicodeString& result) const = 0; + + /** + * Returns the display name of the provided variant. + * @param variant the variant string + * @param result receives the variant's display name + * @return the display name of the provided variant + * @stable ICU 4.4 + */ + virtual UnicodeString& variantDisplayName(const char* variant, + UnicodeString& result) const = 0; + + /** + * Returns the display name of the provided locale key. + * @param key the locale key name + * @param result receives the locale key's display name + * @return the display name of the provided locale key + * @stable ICU 4.4 + */ + virtual UnicodeString& keyDisplayName(const char* key, + UnicodeString& result) const = 0; + + /** + * Returns the display name of the provided value (used with the provided key). + * @param key the locale key name + * @param value the locale key's value + * @param result receives the value's display name + * @return the display name of the provided value + * @stable ICU 4.4 + */ + virtual UnicodeString& keyValueDisplayName(const char* key, const char* value, + UnicodeString& result) const = 0; +}; + +inline LocaleDisplayNames* LocaleDisplayNames::createInstance(const Locale& locale) { + return LocaleDisplayNames::createInstance(locale, ULDN_STANDARD_NAMES); +} + +U_NAMESPACE_END + +#endif + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/locid.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/locid.h new file mode 100644 index 0000000..dd7d068 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/locid.h @@ -0,0 +1,815 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1996-2015, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* +* File locid.h +* +* Created by: Helena Shih +* +* Modification History: +* +* Date Name Description +* 02/11/97 aliu Changed gLocPath to fgLocPath and added methods to +* get and set it. +* 04/02/97 aliu Made operator!= inline; fixed return value of getName(). +* 04/15/97 aliu Cleanup for AIX/Win32. +* 04/24/97 aliu Numerous changes per code review. +* 08/18/98 stephen Added tokenizeString(),changed getDisplayName() +* 09/08/98 stephen Moved definition of kEmptyString for Mac Port +* 11/09/99 weiv Added const char * getName() const; +* 04/12/00 srl removing unicodestring api's and cached hash code +* 08/10/01 grhoten Change the static Locales to accessor functions +****************************************************************************** +*/ + +#ifndef LOCID_H +#define LOCID_H + +#include "unicode/utypes.h" +#include "unicode/uobject.h" +#include "unicode/putil.h" +#include "unicode/uloc.h" + +/** + * \file + * \brief C++ API: Locale ID object. + */ + +U_NAMESPACE_BEGIN + +// Forward Declarations +void U_CALLCONV locale_available_init(); /**< @internal */ + +class StringEnumeration; +class UnicodeString; + +/** + * A Locale object represents a specific geographical, political, + * or cultural region. An operation that requires a Locale to perform + * its task is called locale-sensitive and uses the Locale + * to tailor information for the user. For example, displaying a number + * is a locale-sensitive operation--the number should be formatted + * according to the customs/conventions of the user's native country, + * region, or culture. + * + * The Locale class is not suitable for subclassing. + * + *

+ * You can create a Locale object using the constructor in + * this class: + * \htmlonly

\endhtmlonly + *
+ *       Locale( const   char*  language,
+ *               const   char*  country,
+ *               const   char*  variant);
+ * 
+ * \htmlonly
\endhtmlonly + * The first argument to the constructors is a valid ISO + * Language Code. These codes are the lower-case two-letter + * codes as defined by ISO-639. + * You can find a full list of these codes at: + *
+ * http://www.loc.gov/standards/iso639-2/ + * + *

+ * The second argument to the constructors is a valid ISO Country + * Code. These codes are the upper-case two-letter codes + * as defined by ISO-3166. + * You can find a full list of these codes at a number of sites, such as: + *
+ * http://www.iso.org/iso/en/prods-services/iso3166ma/index.html + * + *

+ * The third constructor requires a third argument--the Variant. + * The Variant codes are vendor and browser-specific. + * For example, use REVISED for a language's revised script orthography, and POSIX for POSIX. + * Where there are two variants, separate them with an underscore, and + * put the most important one first. For + * example, a Traditional Spanish collation might be referenced, with + * "ES", "ES", "Traditional_POSIX". + * + *

+ * Because a Locale object is just an identifier for a region, + * no validity check is performed when you construct a Locale. + * If you want to see whether particular resources are available for the + * Locale you construct, you must query those resources. For + * example, ask the NumberFormat for the locales it supports + * using its getAvailableLocales method. + *
Note: When you ask for a resource for a particular + * locale, you get back the best available match, not necessarily + * precisely what you asked for. For more information, look at + * ResourceBundle. + * + *

+ * The Locale class provides a number of convenient constants + * that you can use to create Locale objects for commonly used + * locales. For example, the following refers to a Locale object + * for the United States: + * \htmlonly

\endhtmlonly + *
+ *       Locale::getUS()
+ * 
+ * \htmlonly
\endhtmlonly + * + *

+ * Once you've created a Locale you can query it for information about + * itself. Use getCountry to get the ISO Country Code and + * getLanguage to get the ISO Language Code. You can + * use getDisplayCountry to get the + * name of the country suitable for displaying to the user. Similarly, + * you can use getDisplayLanguage to get the name of + * the language suitable for displaying to the user. Interestingly, + * the getDisplayXXX methods are themselves locale-sensitive + * and have two versions: one that uses the default locale and one + * that takes a locale as an argument and displays the name or country in + * a language appropriate to that locale. + * + *

+ * ICU provides a number of classes that perform locale-sensitive + * operations. For example, the NumberFormat class formats + * numbers, currency, or percentages in a locale-sensitive manner. Classes + * such as NumberFormat have a number of convenience methods + * for creating a default object of that type. For example, the + * NumberFormat class provides these three convenience methods + * for creating a default NumberFormat object: + * \htmlonly

\endhtmlonly + *
+ *     UErrorCode success = U_ZERO_ERROR;
+ *     Locale myLocale;
+ *     NumberFormat *nf;
+ *
+ *     nf = NumberFormat::createInstance( success );          delete nf;
+ *     nf = NumberFormat::createCurrencyInstance( success );  delete nf;
+ *     nf = NumberFormat::createPercentInstance( success );   delete nf;
+ * 
+ * \htmlonly
\endhtmlonly + * Each of these methods has two variants; one with an explicit locale + * and one without; the latter using the default locale. + * \htmlonly
\endhtmlonly + *
+ *     nf = NumberFormat::createInstance( myLocale, success );          delete nf;
+ *     nf = NumberFormat::createCurrencyInstance( myLocale, success );  delete nf;
+ *     nf = NumberFormat::createPercentInstance( myLocale, success );   delete nf;
+ * 
+ * \htmlonly
\endhtmlonly + * A Locale is the mechanism for identifying the kind of object + * (NumberFormat) that you would like to get. The locale is + * just a mechanism for identifying objects, + * not a container for the objects themselves. + * + *

+ * Each class that performs locale-sensitive operations allows you + * to get all the available objects of that type. You can sift + * through these objects by language, country, or variant, + * and use the display names to present a menu to the user. + * For example, you can create a menu of all the collation objects + * suitable for a given language. Such classes implement these + * three class methods: + * \htmlonly

\endhtmlonly + *
+ *       static Locale* getAvailableLocales(int32_t& numLocales)
+ *       static UnicodeString& getDisplayName(const Locale&  objectLocale,
+ *                                            const Locale&  displayLocale,
+ *                                            UnicodeString& displayName)
+ *       static UnicodeString& getDisplayName(const Locale&  objectLocale,
+ *                                            UnicodeString& displayName)
+ * 
+ * \htmlonly
\endhtmlonly + * + * @stable ICU 2.0 + * @see ResourceBundle + */ +class U_COMMON_API Locale : public UObject { +public: + /** Useful constant for the Root locale. @stable ICU 4.4 */ + static const Locale &U_EXPORT2 getRoot(void); + /** Useful constant for this language. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getEnglish(void); + /** Useful constant for this language. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getFrench(void); + /** Useful constant for this language. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getGerman(void); + /** Useful constant for this language. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getItalian(void); + /** Useful constant for this language. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getJapanese(void); + /** Useful constant for this language. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getKorean(void); + /** Useful constant for this language. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getChinese(void); + /** Useful constant for this language. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getSimplifiedChinese(void); + /** Useful constant for this language. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getTraditionalChinese(void); + + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getFrance(void); + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getGermany(void); + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getItaly(void); + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getJapan(void); + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getKorea(void); + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getChina(void); + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getPRC(void); + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getTaiwan(void); + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getUK(void); + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getUS(void); + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getCanada(void); + /** Useful constant for this country/region. @stable ICU 2.0 */ + static const Locale &U_EXPORT2 getCanadaFrench(void); + + + /** + * Construct a default locale object, a Locale for the default locale ID. + * + * @see getDefault + * @see uloc_getDefault + * @stable ICU 2.0 + */ + Locale(); + + /** + * Construct a locale from language, country, variant. + * If an error occurs, then the constructed object will be "bogus" + * (isBogus() will return TRUE). + * + * @param language Lowercase two-letter or three-letter ISO-639 code. + * This parameter can instead be an ICU style C locale (e.g. "en_US"), + * but the other parameters must not be used. + * This parameter can be NULL; if so, + * the locale is initialized to match the current default locale. + * (This is the same as using the default constructor.) + * Please note: The Java Locale class does NOT accept the form + * 'new Locale("en_US")' but only 'new Locale("en","US")' + * + * @param country Uppercase two-letter ISO-3166 code. (optional) + * @param variant Uppercase vendor and browser specific code. See class + * description. (optional) + * @param keywordsAndValues A string consisting of keyword/values pairs, such as + * "collation=phonebook;currency=euro" + * + * @see getDefault + * @see uloc_getDefault + * @stable ICU 2.0 + */ + Locale( const char * language, + const char * country = 0, + const char * variant = 0, + const char * keywordsAndValues = 0); + + /** + * Initializes a Locale object from another Locale object. + * + * @param other The Locale object being copied in. + * @stable ICU 2.0 + */ + Locale(const Locale& other); + + + /** + * Destructor + * @stable ICU 2.0 + */ + virtual ~Locale() ; + + /** + * Replaces the entire contents of *this with the specified value. + * + * @param other The Locale object being copied in. + * @return *this + * @stable ICU 2.0 + */ + Locale& operator=(const Locale& other); + + /** + * Checks if two locale keys are the same. + * + * @param other The locale key object to be compared with this. + * @return True if the two locale keys are the same, false otherwise. + * @stable ICU 2.0 + */ + UBool operator==(const Locale& other) const; + + /** + * Checks if two locale keys are not the same. + * + * @param other The locale key object to be compared with this. + * @return True if the two locale keys are not the same, false + * otherwise. + * @stable ICU 2.0 + */ + UBool operator!=(const Locale& other) const; + + /** + * Clone this object. + * Clones can be used concurrently in multiple threads. + * If an error occurs, then NULL is returned. + * The caller must delete the clone. + * + * @return a clone of this object + * + * @see getDynamicClassID + * @stable ICU 2.8 + */ + Locale *clone() const; + +#ifndef U_HIDE_SYSTEM_API + /** + * Common methods of getting the current default Locale. Used for the + * presentation: menus, dialogs, etc. Generally set once when your applet or + * application is initialized, then never reset. (If you do reset the + * default locale, you probably want to reload your GUI, so that the change + * is reflected in your interface.) + * + * More advanced programs will allow users to use different locales for + * different fields, e.g. in a spreadsheet. + * + * Note that the initial setting will match the host system. + * @return a reference to the Locale object for the default locale ID + * @system + * @stable ICU 2.0 + */ + static const Locale& U_EXPORT2 getDefault(void); + + /** + * Sets the default. Normally set once at the beginning of a process, + * then never reset. + * setDefault() only changes ICU's default locale ID, not + * the default locale ID of the runtime environment. + * + * @param newLocale Locale to set to. If NULL, set to the value obtained + * from the runtime environement. + * @param success The error code. + * @system + * @stable ICU 2.0 + */ + static void U_EXPORT2 setDefault(const Locale& newLocale, + UErrorCode& success); +#endif /* U_HIDE_SYSTEM_API */ + + /** + * Creates a locale which has had minimal canonicalization + * as per uloc_getName(). + * @param name The name to create from. If name is null, + * the default Locale is used. + * @return new locale object + * @stable ICU 2.0 + * @see uloc_getName + */ + static Locale U_EXPORT2 createFromName(const char *name); + + /** + * Creates a locale from the given string after canonicalizing + * the string by calling uloc_canonicalize(). + * @param name the locale ID to create from. Must not be NULL. + * @return a new locale object corresponding to the given name + * @stable ICU 3.0 + * @see uloc_canonicalize + */ + static Locale U_EXPORT2 createCanonical(const char* name); + + /** + * Returns the locale's ISO-639 language code. + * @return An alias to the code + * @stable ICU 2.0 + */ + inline const char * getLanguage( ) const; + + /** + * Returns the locale's ISO-15924 abbreviation script code. + * @return An alias to the code + * @see uscript_getShortName + * @see uscript_getCode + * @stable ICU 2.8 + */ + inline const char * getScript( ) const; + + /** + * Returns the locale's ISO-3166 country code. + * @return An alias to the code + * @stable ICU 2.0 + */ + inline const char * getCountry( ) const; + + /** + * Returns the locale's variant code. + * @return An alias to the code + * @stable ICU 2.0 + */ + inline const char * getVariant( ) const; + + /** + * Returns the programmatic name of the entire locale, with the language, + * country and variant separated by underbars. If a field is missing, up + * to two leading underbars will occur. Example: "en", "de_DE", "en_US_WIN", + * "de__POSIX", "fr__MAC", "__MAC", "_MT", "_FR_EURO" + * @return A pointer to "name". + * @stable ICU 2.0 + */ + inline const char * getName() const; + + /** + * Returns the programmatic name of the entire locale as getName() would return, + * but without keywords. + * @return A pointer to "name". + * @see getName + * @stable ICU 2.8 + */ + const char * getBaseName() const; + + + /** + * Gets the list of keywords for the specified locale. + * + * @param status the status code + * @return pointer to StringEnumeration class, or NULL if there are no keywords. + * Client must dispose of it by calling delete. + * @stable ICU 2.8 + */ + StringEnumeration * createKeywords(UErrorCode &status) const; + + /** + * Gets the value for a keyword. + * + * @param keywordName name of the keyword for which we want the value. Case insensitive. + * @param buffer The buffer to receive the keyword value. + * @param bufferCapacity The capacity of receiving buffer + * @param status Returns any error information while performing this operation. + * @return the length of the keyword value + * + * @stable ICU 2.8 + */ + int32_t getKeywordValue(const char* keywordName, char *buffer, int32_t bufferCapacity, UErrorCode &status) const; + + /** + * Sets or removes the value for a keyword. + * + * For removing all keywords, use getBaseName(), + * and construct a new Locale if it differs from getName(). + * + * @param keywordName name of the keyword to be set. Case insensitive. + * @param keywordValue value of the keyword to be set. If 0-length or + * NULL, will result in the keyword being removed. No error is given if + * that keyword does not exist. + * @param status Returns any error information while performing this operation. + * + * @stable ICU 49 + */ + void setKeywordValue(const char* keywordName, const char* keywordValue, UErrorCode &status); + + /** + * returns the locale's three-letter language code, as specified + * in ISO draft standard ISO-639-2. + * @return An alias to the code, or an empty string + * @stable ICU 2.0 + */ + const char * getISO3Language() const; + + /** + * Fills in "name" with the locale's three-letter ISO-3166 country code. + * @return An alias to the code, or an empty string + * @stable ICU 2.0 + */ + const char * getISO3Country() const; + + /** + * Returns the Windows LCID value corresponding to this locale. + * This value is stored in the resource data for the locale as a one-to-four-digit + * hexadecimal number. If the resource is missing, in the wrong format, or + * there is no Windows LCID value that corresponds to this locale, returns 0. + * @stable ICU 2.0 + */ + uint32_t getLCID(void) const; + + /** + * Returns whether this locale's script is written right-to-left. + * If there is no script subtag, then the likely script is used, see uloc_addLikelySubtags(). + * If no likely script is known, then FALSE is returned. + * + * A script is right-to-left according to the CLDR script metadata + * which corresponds to whether the script's letters have Bidi_Class=R or AL. + * + * Returns TRUE for "ar" and "en-Hebr", FALSE for "zh" and "fa-Cyrl". + * + * @return TRUE if the locale's script is written right-to-left + * @stable ICU 54 + */ + UBool isRightToLeft() const; + + /** + * Fills in "dispLang" with the name of this locale's language in a format suitable for + * user display in the default locale. For example, if the locale's language code is + * "fr" and the default locale's language code is "en", this function would set + * dispLang to "French". + * @param dispLang Receives the language's display name. + * @return A reference to "dispLang". + * @stable ICU 2.0 + */ + UnicodeString& getDisplayLanguage(UnicodeString& dispLang) const; + + /** + * Fills in "dispLang" with the name of this locale's language in a format suitable for + * user display in the locale specified by "displayLocale". For example, if the locale's + * language code is "en" and displayLocale's language code is "fr", this function would set + * dispLang to "Anglais". + * @param displayLocale Specifies the locale to be used to display the name. In other words, + * if the locale's language code is "en", passing Locale::getFrench() for + * displayLocale would result in "Anglais", while passing Locale::getGerman() + * for displayLocale would result in "Englisch". + * @param dispLang Receives the language's display name. + * @return A reference to "dispLang". + * @stable ICU 2.0 + */ + UnicodeString& getDisplayLanguage( const Locale& displayLocale, + UnicodeString& dispLang) const; + + /** + * Fills in "dispScript" with the name of this locale's script in a format suitable + * for user display in the default locale. For example, if the locale's script code + * is "LATN" and the default locale's language code is "en", this function would set + * dispScript to "Latin". + * @param dispScript Receives the scripts's display name. + * @return A reference to "dispScript". + * @stable ICU 2.8 + */ + UnicodeString& getDisplayScript( UnicodeString& dispScript) const; + + /** + * Fills in "dispScript" with the name of this locale's country in a format suitable + * for user display in the locale specified by "displayLocale". For example, if the locale's + * script code is "LATN" and displayLocale's language code is "en", this function would set + * dispScript to "Latin". + * @param displayLocale Specifies the locale to be used to display the name. In other + * words, if the locale's script code is "LATN", passing + * Locale::getFrench() for displayLocale would result in "", while + * passing Locale::getGerman() for displayLocale would result in + * "". + * @param dispScript Receives the scripts's display name. + * @return A reference to "dispScript". + * @stable ICU 2.8 + */ + UnicodeString& getDisplayScript( const Locale& displayLocale, + UnicodeString& dispScript) const; + + /** + * Fills in "dispCountry" with the name of this locale's country in a format suitable + * for user display in the default locale. For example, if the locale's country code + * is "FR" and the default locale's language code is "en", this function would set + * dispCountry to "France". + * @param dispCountry Receives the country's display name. + * @return A reference to "dispCountry". + * @stable ICU 2.0 + */ + UnicodeString& getDisplayCountry( UnicodeString& dispCountry) const; + + /** + * Fills in "dispCountry" with the name of this locale's country in a format suitable + * for user display in the locale specified by "displayLocale". For example, if the locale's + * country code is "US" and displayLocale's language code is "fr", this function would set + * dispCountry to "États-Unis". + * @param displayLocale Specifies the locale to be used to display the name. In other + * words, if the locale's country code is "US", passing + * Locale::getFrench() for displayLocale would result in "États-Unis", while + * passing Locale::getGerman() for displayLocale would result in + * "Vereinigte Staaten". + * @param dispCountry Receives the country's display name. + * @return A reference to "dispCountry". + * @stable ICU 2.0 + */ + UnicodeString& getDisplayCountry( const Locale& displayLocale, + UnicodeString& dispCountry) const; + + /** + * Fills in "dispVar" with the name of this locale's variant code in a format suitable + * for user display in the default locale. + * @param dispVar Receives the variant's name. + * @return A reference to "dispVar". + * @stable ICU 2.0 + */ + UnicodeString& getDisplayVariant( UnicodeString& dispVar) const; + + /** + * Fills in "dispVar" with the name of this locale's variant code in a format + * suitable for user display in the locale specified by "displayLocale". + * @param displayLocale Specifies the locale to be used to display the name. + * @param dispVar Receives the variant's display name. + * @return A reference to "dispVar". + * @stable ICU 2.0 + */ + UnicodeString& getDisplayVariant( const Locale& displayLocale, + UnicodeString& dispVar) const; + + /** + * Fills in "name" with the name of this locale in a format suitable for user display + * in the default locale. This function uses getDisplayLanguage(), getDisplayCountry(), + * and getDisplayVariant() to do its work, and outputs the display name in the format + * "language (country[,variant])". For example, if the default locale is en_US, then + * fr_FR's display name would be "French (France)", and es_MX_Traditional's display name + * would be "Spanish (Mexico,Traditional)". + * @param name Receives the locale's display name. + * @return A reference to "name". + * @stable ICU 2.0 + */ + UnicodeString& getDisplayName( UnicodeString& name) const; + + /** + * Fills in "name" with the name of this locale in a format suitable for user display + * in the locale specfied by "displayLocale". This function uses getDisplayLanguage(), + * getDisplayCountry(), and getDisplayVariant() to do its work, and outputs the display + * name in the format "language (country[,variant])". For example, if displayLocale is + * fr_FR, then en_US's display name would be "Anglais (États-Unis)", and no_NO_NY's + * display name would be "norvégien (Norvège,NY)". + * @param displayLocale Specifies the locale to be used to display the name. + * @param name Receives the locale's display name. + * @return A reference to "name". + * @stable ICU 2.0 + */ + UnicodeString& getDisplayName( const Locale& displayLocale, + UnicodeString& name) const; + + /** + * Generates a hash code for the locale. + * @stable ICU 2.0 + */ + int32_t hashCode(void) const; + + /** + * Sets the locale to bogus + * A bogus locale represents a non-existing locale associated + * with services that can be instantiated from non-locale data + * in addition to locale (for example, collation can be + * instantiated from a locale and from a rule set). + * @stable ICU 2.1 + */ + void setToBogus(); + + /** + * Gets the bogus state. Locale object can be bogus if it doesn't exist + * @return FALSE if it is a real locale, TRUE if it is a bogus locale + * @stable ICU 2.1 + */ + UBool isBogus(void) const; + + /** + * Returns a list of all installed locales. + * @param count Receives the number of locales in the list. + * @return A pointer to an array of Locale objects. This array is the list + * of all locales with installed resource files. The called does NOT + * get ownership of this list, and must NOT delete it. + * @stable ICU 2.0 + */ + static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count); + + /** + * Gets a list of all available 2-letter country codes defined in ISO 3166. This is a + * pointer to an array of pointers to arrays of char. All of these pointers are + * owned by ICU-- do not delete them, and do not write through them. The array is + * terminated with a null pointer. + * @return a list of all available country codes + * @stable ICU 2.0 + */ + static const char* const* U_EXPORT2 getISOCountries(); + + /** + * Gets a list of all available language codes defined in ISO 639. This is a pointer + * to an array of pointers to arrays of char. All of these pointers are owned + * by ICU-- do not delete them, and do not write through them. The array is + * terminated with a null pointer. + * @return a list of all available language codes + * @stable ICU 2.0 + */ + static const char* const* U_EXPORT2 getISOLanguages(); + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.2 + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.2 + */ + virtual UClassID getDynamicClassID() const; + +protected: /* only protected for testing purposes. DO NOT USE. */ +#ifndef U_HIDE_INTERNAL_API + /** + * Set this from a single POSIX style locale string. + * @internal + */ + void setFromPOSIXID(const char *posixID); +#endif /* U_HIDE_INTERNAL_API */ + +private: + /** + * Initialize the locale object with a new name. + * Was deprecated - used in implementation - moved internal + * + * @param cLocaleID The new locale name. + * @param canonicalize whether to call uloc_canonicalize on cLocaleID + */ + Locale& init(const char* cLocaleID, UBool canonicalize); + + /* + * Internal constructor to allow construction of a locale object with + * NO side effects. (Default constructor tries to get + * the default locale.) + */ + enum ELocaleType { + eBOGUS + }; + Locale(ELocaleType); + + /** + * Initialize the locale cache for commonly used locales + */ + static Locale *getLocaleCache(void); + + char language[ULOC_LANG_CAPACITY]; + char script[ULOC_SCRIPT_CAPACITY]; + char country[ULOC_COUNTRY_CAPACITY]; + int32_t variantBegin; + char* fullName; + char fullNameBuffer[ULOC_FULLNAME_CAPACITY]; + // name without keywords + char* baseName; + void initBaseName(UErrorCode& status); + + UBool fIsBogus; + + static const Locale &getLocale(int locid); + + /** + * A friend to allow the default locale to be set by either the C or C++ API. + * @internal + */ + friend Locale *locale_set_default_internal(const char *, UErrorCode& status); + + /** + * @internal + */ + friend void U_CALLCONV locale_available_init(); +}; + +inline UBool +Locale::operator!=(const Locale& other) const +{ + return !operator==(other); +} + +inline const char * +Locale::getCountry() const +{ + return country; +} + +inline const char * +Locale::getLanguage() const +{ + return language; +} + +inline const char * +Locale::getScript() const +{ + return script; +} + +inline const char * +Locale::getVariant() const +{ + return &baseName[variantBegin]; +} + +inline const char * +Locale::getName() const +{ + return fullName; +} + +inline UBool +Locale::isBogus(void) const { + return fIsBogus; +} + +U_NAMESPACE_END + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/measfmt.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/measfmt.h new file mode 100644 index 0000000..156bb81 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/measfmt.h @@ -0,0 +1,399 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2004-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Author: Alan Liu +* Created: April 20, 2004 +* Since: ICU 3.0 +********************************************************************** +*/ +#ifndef MEASUREFORMAT_H +#define MEASUREFORMAT_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/format.h" +#include "unicode/udat.h" + +/** + * \file + * \brief C++ API: Formatter for measure objects. + */ + +/** + * Constants for various widths. + * There are 4 widths: Wide, Short, Narrow, Numeric. + * For example, for English, when formatting "3 hours" + * Wide is "3 hours"; short is "3 hrs"; narrow is "3h"; + * formatting "3 hours 17 minutes" as numeric give "3:17" + * @stable ICU 53 + */ +enum UMeasureFormatWidth { + + // Wide, short, and narrow must be first and in this order. + /** + * Spell out measure units. + * @stable ICU 53 + */ + UMEASFMT_WIDTH_WIDE, + + /** + * Abbreviate measure units. + * @stable ICU 53 + */ + UMEASFMT_WIDTH_SHORT, + + /** + * Use symbols for measure units when possible. + * @stable ICU 53 + */ + UMEASFMT_WIDTH_NARROW, + + /** + * Completely omit measure units when possible. For example, format + * '5 hours, 37 minutes' as '5:37' + * @stable ICU 53 + */ + UMEASFMT_WIDTH_NUMERIC, + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UMeasureFormatWidth value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UMEASFMT_WIDTH_COUNT = 4 +#endif // U_HIDE_DEPRECATED_API +}; +/** @stable ICU 53 */ +typedef enum UMeasureFormatWidth UMeasureFormatWidth; + +U_NAMESPACE_BEGIN + +class Measure; +class MeasureUnit; +class NumberFormat; +class PluralRules; +class MeasureFormatCacheData; +class SharedNumberFormat; +class SharedPluralRules; +class QuantityFormatter; +class SimpleFormatter; +class ListFormatter; +class DateFormat; + +/** + * + * A formatter for measure objects. + * + * @see Format + * @author Alan Liu + * @stable ICU 3.0 + */ +class U_I18N_API MeasureFormat : public Format { + public: + using Format::parseObject; + using Format::format; + + /** + * Constructor. + * @stable ICU 53 + */ + MeasureFormat( + const Locale &locale, UMeasureFormatWidth width, UErrorCode &status); + + /** + * Constructor. + * @stable ICU 53 + */ + MeasureFormat( + const Locale &locale, + UMeasureFormatWidth width, + NumberFormat *nfToAdopt, + UErrorCode &status); + + /** + * Copy constructor. + * @stable ICU 3.0 + */ + MeasureFormat(const MeasureFormat &other); + + /** + * Assignment operator. + * @stable ICU 3.0 + */ + MeasureFormat &operator=(const MeasureFormat &rhs); + + /** + * Destructor. + * @stable ICU 3.0 + */ + virtual ~MeasureFormat(); + + /** + * Return true if given Format objects are semantically equal. + * @stable ICU 53 + */ + virtual UBool operator==(const Format &other) const; + + /** + * Clones this object polymorphically. + * @stable ICU 53 + */ + virtual Format *clone() const; + + /** + * Formats object to produce a string. + * @stable ICU 53 + */ + virtual UnicodeString &format( + const Formattable &obj, + UnicodeString &appendTo, + FieldPosition &pos, + UErrorCode &status) const; + + /** + * Parse a string to produce an object. This implementation sets + * status to U_UNSUPPORTED_ERROR. + * + * @draft ICU 53 + */ + virtual void parseObject( + const UnicodeString &source, + Formattable &reslt, + ParsePosition &pos) const; + + /** + * Formats measure objects to produce a string. An example of such a + * formatted string is 3 meters, 3.5 centimeters. Measure objects appear + * in the formatted string in the same order they appear in the "measures" + * array. The NumberFormat of this object is used only to format the amount + * of the very last measure. The other amounts are formatted with zero + * decimal places while rounding toward zero. + * @param measures array of measure objects. + * @param measureCount the number of measure objects. + * @param appendTo formatted string appended here. + * @param pos the field position. + * @param status the error. + * @return appendTo reference + * + * @stable ICU 53 + */ + UnicodeString &formatMeasures( + const Measure *measures, + int32_t measureCount, + UnicodeString &appendTo, + FieldPosition &pos, + UErrorCode &status) const; + + /** + * Formats a single measure per unit. An example of such a + * formatted string is 3.5 meters per second. + * @param measure The measure object. In above example, 3.5 meters. + * @param perUnit The per unit. In above example, it is + * *MeasureUnit::createSecond(status). + * @param appendTo formatted string appended here. + * @param pos the field position. + * @param status the error. + * @return appendTo reference + * + * @stable ICU 55 + */ + UnicodeString &formatMeasurePerUnit( + const Measure &measure, + const MeasureUnit &perUnit, + UnicodeString &appendTo, + FieldPosition &pos, + UErrorCode &status) const; + + /** + * Gets the display name of the specified {@link MeasureUnit} corresponding to the current + * locale and format width. + * @param unit The unit for which to get a display name. + * @param status the error. + * @return The display name in the locale and width specified in + * {@link MeasureFormat#getInstance}, or null if there is no display name available + * for the specified unit. + * + * @stable ICU 58 + */ + UnicodeString getUnitDisplayName(const MeasureUnit& unit, UErrorCode &status) const; + + + /** + * Return a formatter for CurrencyAmount objects in the given + * locale. + * @param locale desired locale + * @param ec input-output error code + * @return a formatter object, or NULL upon error + * @stable ICU 3.0 + */ + static MeasureFormat* U_EXPORT2 createCurrencyFormat(const Locale& locale, + UErrorCode& ec); + + /** + * Return a formatter for CurrencyAmount objects in the default + * locale. + * @param ec input-output error code + * @return a formatter object, or NULL upon error + * @stable ICU 3.0 + */ + static MeasureFormat* U_EXPORT2 createCurrencyFormat(UErrorCode& ec); + + /** + * Return the class ID for this class. This is useful only for comparing to + * a return value from getDynamicClassID(). For example: + *
+     * .   Base* polymorphic_pointer = createPolymorphicObject();
+     * .   if (polymorphic_pointer->getDynamicClassID() ==
+     * .       erived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @stable ICU 53 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This + * method is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and clone() + * methods call this method. + * + * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @stable ICU 53 + */ + virtual UClassID getDynamicClassID(void) const; + + protected: + /** + * Default constructor. + * @stable ICU 3.0 + */ + MeasureFormat(); + +#ifndef U_HIDE_INTERNAL_API + + /** + * ICU use only. + * Initialize or change MeasureFormat class from subclass. + * @internal. + */ + void initMeasureFormat( + const Locale &locale, + UMeasureFormatWidth width, + NumberFormat *nfToAdopt, + UErrorCode &status); + /** + * ICU use only. + * Allows subclass to change locale. Note that this method also changes + * the NumberFormat object. Returns TRUE if locale changed; FALSE if no + * change was made. + * @internal. + */ + UBool setMeasureFormatLocale(const Locale &locale, UErrorCode &status); + + /** + * ICU use only. + * Let subclass change NumberFormat. + * @internal. + */ + void adoptNumberFormat(NumberFormat *nfToAdopt, UErrorCode &status); + + /** + * ICU use only. + * @internal. + */ + const NumberFormat &getNumberFormat() const; + + /** + * ICU use only. + * @internal. + */ + const PluralRules &getPluralRules() const; + + /** + * ICU use only. + * @internal. + */ + Locale getLocale(UErrorCode &status) const; + + /** + * ICU use only. + * @internal. + */ + const char *getLocaleID(UErrorCode &status) const; + +#endif /* U_HIDE_INTERNAL_API */ + + private: + const MeasureFormatCacheData *cache; + const SharedNumberFormat *numberFormat; + const SharedPluralRules *pluralRules; + UMeasureFormatWidth width; + + // Declared outside of MeasureFormatSharedData because ListFormatter + // objects are relatively cheap to copy; therefore, they don't need to be + // shared across instances. + ListFormatter *listFormatter; + + const SimpleFormatter *getFormatterOrNull( + const MeasureUnit &unit, UMeasureFormatWidth width, int32_t index) const; + + const SimpleFormatter *getFormatter( + const MeasureUnit &unit, UMeasureFormatWidth width, int32_t index, + UErrorCode &errorCode) const; + + const SimpleFormatter *getPluralFormatter( + const MeasureUnit &unit, UMeasureFormatWidth width, int32_t index, + UErrorCode &errorCode) const; + + const SimpleFormatter *getPerFormatter( + UMeasureFormatWidth width, + UErrorCode &status) const; + + int32_t withPerUnitAndAppend( + const UnicodeString &formatted, + const MeasureUnit &perUnit, + UnicodeString &appendTo, + UErrorCode &status) const; + + UnicodeString &formatMeasure( + const Measure &measure, + const NumberFormat &nf, + UnicodeString &appendTo, + FieldPosition &pos, + UErrorCode &status) const; + + UnicodeString &formatMeasuresSlowTrack( + const Measure *measures, + int32_t measureCount, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode& status) const; + + UnicodeString &formatNumeric( + const Formattable *hms, // always length 3: [0] is hour; [1] is + // minute; [2] is second. + int32_t bitMap, // 1=hour set, 2=minute set, 4=second set + UnicodeString &appendTo, + UErrorCode &status) const; + + UnicodeString &formatNumeric( + UDate date, + const DateFormat &dateFmt, + UDateFormatField smallestField, + const Formattable &smallestAmount, + UnicodeString &appendTo, + UErrorCode &status) const; +}; + +U_NAMESPACE_END + +#endif // #if !UCONFIG_NO_FORMATTING +#endif // #ifndef MEASUREFORMAT_H diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/measunit.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/measunit.h new file mode 100644 index 0000000..4140ae3 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/measunit.h @@ -0,0 +1,1343 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2004-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Author: Alan Liu +* Created: April 26, 2004 +* Since: ICU 3.0 +********************************************************************** +*/ +#ifndef __MEASUREUNIT_H__ +#define __MEASUREUNIT_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/unistr.h" + +/** + * \file + * \brief C++ API: A unit for measuring a quantity. + */ + +U_NAMESPACE_BEGIN + +class StringEnumeration; + +/** + * A unit such as length, mass, volume, currency, etc. A unit is + * coupled with a numeric amount to produce a Measure. + * + * @author Alan Liu + * @stable ICU 3.0 + */ +class U_I18N_API MeasureUnit: public UObject { + public: + + /** + * Default constructor. + * Populates the instance with the base dimensionless unit. + * @stable ICU 3.0 + */ + MeasureUnit(); + + /** + * Copy constructor. + * @stable ICU 3.0 + */ + MeasureUnit(const MeasureUnit &other); + + /** + * Assignment operator. + * @stable ICU 3.0 + */ + MeasureUnit &operator=(const MeasureUnit &other); + + /** + * Returns a polymorphic clone of this object. The result will + * have the same class as returned by getDynamicClassID(). + * @stable ICU 3.0 + */ + virtual UObject* clone() const; + + /** + * Destructor + * @stable ICU 3.0 + */ + virtual ~MeasureUnit(); + + /** + * Equality operator. Return true if this object is equal + * to the given object. + * @stable ICU 3.0 + */ + virtual UBool operator==(const UObject& other) const; + + /** + * Inequality operator. Return true if this object is not equal + * to the given object. + * @stable ICU 53 + */ + UBool operator!=(const UObject& other) const { + return !(*this == other); + } + + /** + * Get the type. + * @stable ICU 53 + */ + const char *getType() const; + + /** + * Get the sub type. + * @stable ICU 53 + */ + const char *getSubtype() const; + + /** + * getAvailable gets all of the available units. + * If there are too many units to fit into destCapacity then the + * error code is set to U_BUFFER_OVERFLOW_ERROR. + * + * @param destArray destination buffer. + * @param destCapacity number of MeasureUnit instances available at dest. + * @param errorCode ICU error code. + * @return number of available units. + * @stable ICU 53 + */ + static int32_t getAvailable( + MeasureUnit *destArray, + int32_t destCapacity, + UErrorCode &errorCode); + + /** + * getAvailable gets all of the available units for a specific type. + * If there are too many units to fit into destCapacity then the + * error code is set to U_BUFFER_OVERFLOW_ERROR. + * + * @param type the type + * @param destArray destination buffer. + * @param destCapacity number of MeasureUnit instances available at dest. + * @param errorCode ICU error code. + * @return number of available units for type. + * @stable ICU 53 + */ + static int32_t getAvailable( + const char *type, + MeasureUnit *destArray, + int32_t destCapacity, + UErrorCode &errorCode); + + /** + * getAvailableTypes gets all of the available types. Caller owns the + * returned StringEnumeration and must delete it when finished using it. + * + * @param errorCode ICU error code. + * @return the types. + * @stable ICU 53 + */ + static StringEnumeration* getAvailableTypes(UErrorCode &errorCode); + + /** + * Return the class ID for this class. This is useful only for comparing to + * a return value from getDynamicClassID(). For example: + *
+     * .   Base* polymorphic_pointer = createPolymorphicObject();
+     * .   if (polymorphic_pointer->getDynamicClassID() ==
+     * .       Derived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @stable ICU 53 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This + * method is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and clone() + * methods call this method. + * + * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @stable ICU 53 + */ + virtual UClassID getDynamicClassID(void) const; + +#ifndef U_HIDE_INTERNAL_API + /** + * ICU use only. + * Returns associated array index for this measure unit. Only valid for + * non-currency measure units. + * @internal + */ + int32_t getIndex() const; + + /** + * ICU use only. + * Returns maximum value from getIndex plus 1. + * @internal + */ + static int32_t getIndexCount(); + + /** + * ICU use only. + * @return the unit.getIndex() of the unit which has this unit.getType() and unit.getSubtype(), + * or a negative value if there is no such unit + * @internal + */ + static int32_t internalGetIndexForTypeAndSubtype(const char *type, const char *subtype); + + /** + * ICU use only. + * @internal + */ + static MeasureUnit *resolveUnitPerUnit( + const MeasureUnit &unit, const MeasureUnit &perUnit); +#endif /* U_HIDE_INTERNAL_API */ + +// All code between the "Start generated createXXX methods" comment and +// the "End generated createXXX methods" comment is auto generated code +// and must not be edited manually. For instructions on how to correctly +// update this code, refer to: +// http://site.icu-project.org/design/formatting/measureformat/updating-measure-unit +// +// Start generated createXXX methods + + /** + * Returns unit of acceleration: g-force. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createGForce(UErrorCode &status); + + /** + * Returns unit of acceleration: meter-per-second-squared. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createMeterPerSecondSquared(UErrorCode &status); + + /** + * Returns unit of angle: arc-minute. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createArcMinute(UErrorCode &status); + + /** + * Returns unit of angle: arc-second. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createArcSecond(UErrorCode &status); + + /** + * Returns unit of angle: degree. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createDegree(UErrorCode &status); + + /** + * Returns unit of angle: radian. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createRadian(UErrorCode &status); + + /** + * Returns unit of angle: revolution. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 56 + */ + static MeasureUnit *createRevolutionAngle(UErrorCode &status); + + /** + * Returns unit of area: acre. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createAcre(UErrorCode &status); + + /** + * Returns unit of area: hectare. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createHectare(UErrorCode &status); + + /** + * Returns unit of area: square-centimeter. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createSquareCentimeter(UErrorCode &status); + + /** + * Returns unit of area: square-foot. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createSquareFoot(UErrorCode &status); + + /** + * Returns unit of area: square-inch. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createSquareInch(UErrorCode &status); + + /** + * Returns unit of area: square-kilometer. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createSquareKilometer(UErrorCode &status); + + /** + * Returns unit of area: square-meter. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createSquareMeter(UErrorCode &status); + + /** + * Returns unit of area: square-mile. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createSquareMile(UErrorCode &status); + + /** + * Returns unit of area: square-yard. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createSquareYard(UErrorCode &status); + + /** + * Returns unit of concentr: karat. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createKarat(UErrorCode &status); + + /** + * Returns unit of concentr: milligram-per-deciliter. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 57 + */ + static MeasureUnit *createMilligramPerDeciliter(UErrorCode &status); + + /** + * Returns unit of concentr: millimole-per-liter. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 57 + */ + static MeasureUnit *createMillimolePerLiter(UErrorCode &status); + + /** + * Returns unit of concentr: part-per-million. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 57 + */ + static MeasureUnit *createPartPerMillion(UErrorCode &status); + + /** + * Returns unit of consumption: liter-per-100kilometers. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 56 + */ + static MeasureUnit *createLiterPer100Kilometers(UErrorCode &status); + + /** + * Returns unit of consumption: liter-per-kilometer. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createLiterPerKilometer(UErrorCode &status); + + /** + * Returns unit of consumption: mile-per-gallon. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createMilePerGallon(UErrorCode &status); + + /** + * Returns unit of consumption: mile-per-gallon-imperial. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 57 + */ + static MeasureUnit *createMilePerGallonImperial(UErrorCode &status); + + /* + * The following were draft ICU 58, but have been withdrawn: + * static MeasureUnit *createEast(UErrorCode &status); + * static MeasureUnit *createNorth(UErrorCode &status); + * static MeasureUnit *createSouth(UErrorCode &status); + * static MeasureUnit *createWest(UErrorCode &status); + */ + + /** + * Returns unit of digital: bit. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createBit(UErrorCode &status); + + /** + * Returns unit of digital: byte. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createByte(UErrorCode &status); + + /** + * Returns unit of digital: gigabit. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createGigabit(UErrorCode &status); + + /** + * Returns unit of digital: gigabyte. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createGigabyte(UErrorCode &status); + + /** + * Returns unit of digital: kilobit. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createKilobit(UErrorCode &status); + + /** + * Returns unit of digital: kilobyte. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createKilobyte(UErrorCode &status); + + /** + * Returns unit of digital: megabit. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createMegabit(UErrorCode &status); + + /** + * Returns unit of digital: megabyte. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createMegabyte(UErrorCode &status); + + /** + * Returns unit of digital: terabit. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createTerabit(UErrorCode &status); + + /** + * Returns unit of digital: terabyte. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createTerabyte(UErrorCode &status); + + /** + * Returns unit of duration: century. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 56 + */ + static MeasureUnit *createCentury(UErrorCode &status); + + /** + * Returns unit of duration: day. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createDay(UErrorCode &status); + + /** + * Returns unit of duration: hour. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createHour(UErrorCode &status); + + /** + * Returns unit of duration: microsecond. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createMicrosecond(UErrorCode &status); + + /** + * Returns unit of duration: millisecond. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createMillisecond(UErrorCode &status); + + /** + * Returns unit of duration: minute. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createMinute(UErrorCode &status); + + /** + * Returns unit of duration: month. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createMonth(UErrorCode &status); + + /** + * Returns unit of duration: nanosecond. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createNanosecond(UErrorCode &status); + + /** + * Returns unit of duration: second. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createSecond(UErrorCode &status); + + /** + * Returns unit of duration: week. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createWeek(UErrorCode &status); + + /** + * Returns unit of duration: year. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createYear(UErrorCode &status); + + /** + * Returns unit of electric: ampere. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createAmpere(UErrorCode &status); + + /** + * Returns unit of electric: milliampere. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createMilliampere(UErrorCode &status); + + /** + * Returns unit of electric: ohm. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createOhm(UErrorCode &status); + + /** + * Returns unit of electric: volt. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createVolt(UErrorCode &status); + + /** + * Returns unit of energy: calorie. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createCalorie(UErrorCode &status); + + /** + * Returns unit of energy: foodcalorie. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createFoodcalorie(UErrorCode &status); + + /** + * Returns unit of energy: joule. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createJoule(UErrorCode &status); + + /** + * Returns unit of energy: kilocalorie. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createKilocalorie(UErrorCode &status); + + /** + * Returns unit of energy: kilojoule. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createKilojoule(UErrorCode &status); + + /** + * Returns unit of energy: kilowatt-hour. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createKilowattHour(UErrorCode &status); + + /** + * Returns unit of frequency: gigahertz. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createGigahertz(UErrorCode &status); + + /** + * Returns unit of frequency: hertz. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createHertz(UErrorCode &status); + + /** + * Returns unit of frequency: kilohertz. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createKilohertz(UErrorCode &status); + + /** + * Returns unit of frequency: megahertz. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createMegahertz(UErrorCode &status); + + /** + * Returns unit of length: astronomical-unit. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createAstronomicalUnit(UErrorCode &status); + + /** + * Returns unit of length: centimeter. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createCentimeter(UErrorCode &status); + + /** + * Returns unit of length: decimeter. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createDecimeter(UErrorCode &status); + + /** + * Returns unit of length: fathom. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createFathom(UErrorCode &status); + + /** + * Returns unit of length: foot. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createFoot(UErrorCode &status); + + /** + * Returns unit of length: furlong. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createFurlong(UErrorCode &status); + + /** + * Returns unit of length: inch. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createInch(UErrorCode &status); + + /** + * Returns unit of length: kilometer. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createKilometer(UErrorCode &status); + + /** + * Returns unit of length: light-year. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createLightYear(UErrorCode &status); + + /** + * Returns unit of length: meter. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createMeter(UErrorCode &status); + + /** + * Returns unit of length: micrometer. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createMicrometer(UErrorCode &status); + + /** + * Returns unit of length: mile. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createMile(UErrorCode &status); + + /** + * Returns unit of length: mile-scandinavian. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 56 + */ + static MeasureUnit *createMileScandinavian(UErrorCode &status); + + /** + * Returns unit of length: millimeter. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createMillimeter(UErrorCode &status); + + /** + * Returns unit of length: nanometer. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createNanometer(UErrorCode &status); + + /** + * Returns unit of length: nautical-mile. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createNauticalMile(UErrorCode &status); + + /** + * Returns unit of length: parsec. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createParsec(UErrorCode &status); + + /** + * Returns unit of length: picometer. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createPicometer(UErrorCode &status); + +#ifndef U_HIDE_DRAFT_API + /** + * Returns unit of length: point. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @draft ICU 59 + */ + static MeasureUnit *createPoint(UErrorCode &status); +#endif /* U_HIDE_DRAFT_API */ + + /** + * Returns unit of length: yard. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createYard(UErrorCode &status); + + /** + * Returns unit of light: lux. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createLux(UErrorCode &status); + + /** + * Returns unit of mass: carat. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createCarat(UErrorCode &status); + + /** + * Returns unit of mass: gram. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createGram(UErrorCode &status); + + /** + * Returns unit of mass: kilogram. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createKilogram(UErrorCode &status); + + /** + * Returns unit of mass: metric-ton. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createMetricTon(UErrorCode &status); + + /** + * Returns unit of mass: microgram. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createMicrogram(UErrorCode &status); + + /** + * Returns unit of mass: milligram. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createMilligram(UErrorCode &status); + + /** + * Returns unit of mass: ounce. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createOunce(UErrorCode &status); + + /** + * Returns unit of mass: ounce-troy. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createOunceTroy(UErrorCode &status); + + /** + * Returns unit of mass: pound. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createPound(UErrorCode &status); + + /** + * Returns unit of mass: stone. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createStone(UErrorCode &status); + + /** + * Returns unit of mass: ton. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createTon(UErrorCode &status); + + /** + * Returns unit of power: gigawatt. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createGigawatt(UErrorCode &status); + + /** + * Returns unit of power: horsepower. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createHorsepower(UErrorCode &status); + + /** + * Returns unit of power: kilowatt. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createKilowatt(UErrorCode &status); + + /** + * Returns unit of power: megawatt. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createMegawatt(UErrorCode &status); + + /** + * Returns unit of power: milliwatt. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createMilliwatt(UErrorCode &status); + + /** + * Returns unit of power: watt. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createWatt(UErrorCode &status); + + /** + * Returns unit of pressure: hectopascal. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createHectopascal(UErrorCode &status); + + /** + * Returns unit of pressure: inch-hg. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createInchHg(UErrorCode &status); + + /** + * Returns unit of pressure: millibar. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createMillibar(UErrorCode &status); + + /** + * Returns unit of pressure: millimeter-of-mercury. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createMillimeterOfMercury(UErrorCode &status); + + /** + * Returns unit of pressure: pound-per-square-inch. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createPoundPerSquareInch(UErrorCode &status); + + /** + * Returns unit of speed: kilometer-per-hour. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createKilometerPerHour(UErrorCode &status); + + /** + * Returns unit of speed: knot. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 56 + */ + static MeasureUnit *createKnot(UErrorCode &status); + + /** + * Returns unit of speed: meter-per-second. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createMeterPerSecond(UErrorCode &status); + + /** + * Returns unit of speed: mile-per-hour. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createMilePerHour(UErrorCode &status); + + /** + * Returns unit of temperature: celsius. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createCelsius(UErrorCode &status); + + /** + * Returns unit of temperature: fahrenheit. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createFahrenheit(UErrorCode &status); + + /** + * Returns unit of temperature: generic. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 56 + */ + static MeasureUnit *createGenericTemperature(UErrorCode &status); + + /** + * Returns unit of temperature: kelvin. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createKelvin(UErrorCode &status); + + /** + * Returns unit of volume: acre-foot. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createAcreFoot(UErrorCode &status); + + /** + * Returns unit of volume: bushel. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createBushel(UErrorCode &status); + + /** + * Returns unit of volume: centiliter. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createCentiliter(UErrorCode &status); + + /** + * Returns unit of volume: cubic-centimeter. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createCubicCentimeter(UErrorCode &status); + + /** + * Returns unit of volume: cubic-foot. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createCubicFoot(UErrorCode &status); + + /** + * Returns unit of volume: cubic-inch. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createCubicInch(UErrorCode &status); + + /** + * Returns unit of volume: cubic-kilometer. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createCubicKilometer(UErrorCode &status); + + /** + * Returns unit of volume: cubic-meter. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createCubicMeter(UErrorCode &status); + + /** + * Returns unit of volume: cubic-mile. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createCubicMile(UErrorCode &status); + + /** + * Returns unit of volume: cubic-yard. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createCubicYard(UErrorCode &status); + + /** + * Returns unit of volume: cup. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createCup(UErrorCode &status); + + /** + * Returns unit of volume: cup-metric. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 56 + */ + static MeasureUnit *createCupMetric(UErrorCode &status); + + /** + * Returns unit of volume: deciliter. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createDeciliter(UErrorCode &status); + + /** + * Returns unit of volume: fluid-ounce. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createFluidOunce(UErrorCode &status); + + /** + * Returns unit of volume: gallon. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createGallon(UErrorCode &status); + + /** + * Returns unit of volume: gallon-imperial. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 57 + */ + static MeasureUnit *createGallonImperial(UErrorCode &status); + + /** + * Returns unit of volume: hectoliter. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createHectoliter(UErrorCode &status); + + /** + * Returns unit of volume: liter. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 53 + */ + static MeasureUnit *createLiter(UErrorCode &status); + + /** + * Returns unit of volume: megaliter. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createMegaliter(UErrorCode &status); + + /** + * Returns unit of volume: milliliter. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createMilliliter(UErrorCode &status); + + /** + * Returns unit of volume: pint. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createPint(UErrorCode &status); + + /** + * Returns unit of volume: pint-metric. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 56 + */ + static MeasureUnit *createPintMetric(UErrorCode &status); + + /** + * Returns unit of volume: quart. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createQuart(UErrorCode &status); + + /** + * Returns unit of volume: tablespoon. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createTablespoon(UErrorCode &status); + + /** + * Returns unit of volume: teaspoon. + * Caller owns returned value and must free it. + * @param status ICU error code. + * @stable ICU 54 + */ + static MeasureUnit *createTeaspoon(UErrorCode &status); + + +// End generated createXXX methods + + protected: + +#ifndef U_HIDE_INTERNAL_API + /** + * For ICU use only. + * @internal + */ + void initTime(const char *timeId); + + /** + * For ICU use only. + * @internal + */ + void initCurrency(const char *isoCurrency); + + /** + * For ICU use only. + * @internal + */ + void initNoUnit(const char *subtype); + +#endif /* U_HIDE_INTERNAL_API */ + +private: + int32_t fTypeId; + int32_t fSubTypeId; + char fCurrency[4]; + + MeasureUnit(int32_t typeId, int32_t subTypeId) : fTypeId(typeId), fSubTypeId(subTypeId) { + fCurrency[0] = 0; + } + void setTo(int32_t typeId, int32_t subTypeId); + int32_t getOffset() const; + static MeasureUnit *create(int typeId, int subTypeId, UErrorCode &status); +}; + +U_NAMESPACE_END + +#endif // !UNCONFIG_NO_FORMATTING +#endif // __MEASUREUNIT_H__ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/measure.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/measure.h new file mode 100644 index 0000000..99b7d7a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/measure.h @@ -0,0 +1,161 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2004-2015, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Author: Alan Liu +* Created: April 26, 2004 +* Since: ICU 3.0 +********************************************************************** +*/ +#ifndef __MEASURE_H__ +#define __MEASURE_H__ + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: MeasureUnit object. + */ + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/fmtable.h" + +U_NAMESPACE_BEGIN + +class MeasureUnit; + +/** + * An amount of a specified unit, consisting of a number and a Unit. + * For example, a length measure consists of a number and a length + * unit, such as feet or meters. + * + *

Measure objects are formatted by MeasureFormat. + * + *

Measure objects are immutable. + * + * @author Alan Liu + * @stable ICU 3.0 + */ +class U_I18N_API Measure: public UObject { + public: + /** + * Construct an object with the given numeric amount and the given + * unit. After this call, the caller must not delete the given + * unit object. + * @param number a numeric object; amount.isNumeric() must be TRUE + * @param adoptedUnit the unit object, which must not be NULL + * @param ec input-output error code. If the amount or the unit + * is invalid, then this will be set to a failing value. + * @stable ICU 3.0 + */ + Measure(const Formattable& number, MeasureUnit* adoptedUnit, + UErrorCode& ec); + + /** + * Copy constructor + * @stable ICU 3.0 + */ + Measure(const Measure& other); + + /** + * Assignment operator + * @stable ICU 3.0 + */ + Measure& operator=(const Measure& other); + + /** + * Return a polymorphic clone of this object. The result will + * have the same class as returned by getDynamicClassID(). + * @stable ICU 3.0 + */ + virtual UObject* clone() const; + + /** + * Destructor + * @stable ICU 3.0 + */ + virtual ~Measure(); + + /** + * Equality operator. Return true if this object is equal + * to the given object. + * @stable ICU 3.0 + */ + UBool operator==(const UObject& other) const; + + /** + * Return a reference to the numeric value of this object. The + * numeric value may be of any numeric type supported by + * Formattable. + * @stable ICU 3.0 + */ + inline const Formattable& getNumber() const; + + /** + * Return a reference to the unit of this object. + * @stable ICU 3.0 + */ + inline const MeasureUnit& getUnit() const; + + /** + * Return the class ID for this class. This is useful only for comparing to + * a return value from getDynamicClassID(). For example: + *

+     * .   Base* polymorphic_pointer = createPolymorphicObject();
+     * .   if (polymorphic_pointer->getDynamicClassID() ==
+     * .       erived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @stable ICU 53 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This + * method is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and clone() + * methods call this method. + * + * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @stable ICU 53 + */ + virtual UClassID getDynamicClassID(void) const; + + protected: + /** + * Default constructor. + * @stable ICU 3.0 + */ + Measure(); + + private: + /** + * The numeric value of this object, e.g. 2.54 or 100. + */ + Formattable number; + + /** + * The unit of this object, e.g., "millimeter" or "JPY". This is + * owned by this object. + */ + MeasureUnit* unit; +}; + +inline const Formattable& Measure::getNumber() const { + return number; +} + +inline const MeasureUnit& Measure::getUnit() const { + return *unit; +} + +U_NAMESPACE_END + +#endif // !UCONFIG_NO_FORMATTING +#endif // __MEASURE_H__ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/messagepattern.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/messagepattern.h new file mode 100644 index 0000000..f28adaf --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/messagepattern.h @@ -0,0 +1,945 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2011-2013, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* file name: messagepattern.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2011mar14 +* created by: Markus W. Scherer +*/ + +#ifndef __MESSAGEPATTERN_H__ +#define __MESSAGEPATTERN_H__ + +/** + * \file + * \brief C++ API: MessagePattern class: Parses and represents ICU MessageFormat patterns. + */ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/parseerr.h" +#include "unicode/unistr.h" + +/** + * Mode for when an apostrophe starts quoted literal text for MessageFormat output. + * The default is DOUBLE_OPTIONAL unless overridden via uconfig.h + * (UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE). + *

+ * A pair of adjacent apostrophes always results in a single apostrophe in the output, + * even when the pair is between two single, text-quoting apostrophes. + *

+ * The following table shows examples of desired MessageFormat.format() output + * with the pattern strings that yield that output. + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Desired outputDOUBLE_OPTIONALDOUBLE_REQUIRED
I see {many}I see '{many}'(same)
I said {'Wow!'}I said '{''Wow!''}'(same)
I don't knowI don't know OR
I don''t know
I don''t know
+ * @stable ICU 4.8 + * @see UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE + */ +enum UMessagePatternApostropheMode { + /** + * A literal apostrophe is represented by + * either a single or a double apostrophe pattern character. + * Within a MessageFormat pattern, a single apostrophe only starts quoted literal text + * if it immediately precedes a curly brace {}, + * or a pipe symbol | if inside a choice format, + * or a pound symbol # if inside a plural format. + *

+ * This is the default behavior starting with ICU 4.8. + * @stable ICU 4.8 + */ + UMSGPAT_APOS_DOUBLE_OPTIONAL, + /** + * A literal apostrophe must be represented by + * a double apostrophe pattern character. + * A single apostrophe always starts quoted literal text. + *

+ * This is the behavior of ICU 4.6 and earlier, and of the JDK. + * @stable ICU 4.8 + */ + UMSGPAT_APOS_DOUBLE_REQUIRED +}; +/** + * @stable ICU 4.8 + */ +typedef enum UMessagePatternApostropheMode UMessagePatternApostropheMode; + +/** + * MessagePattern::Part type constants. + * @stable ICU 4.8 + */ +enum UMessagePatternPartType { + /** + * Start of a message pattern (main or nested). + * The length is 0 for the top-level message + * and for a choice argument sub-message, otherwise 1 for the '{'. + * The value indicates the nesting level, starting with 0 for the main message. + *

+ * There is always a later MSG_LIMIT part. + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_MSG_START, + /** + * End of a message pattern (main or nested). + * The length is 0 for the top-level message and + * the last sub-message of a choice argument, + * otherwise 1 for the '}' or (in a choice argument style) the '|'. + * The value indicates the nesting level, starting with 0 for the main message. + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_MSG_LIMIT, + /** + * Indicates a substring of the pattern string which is to be skipped when formatting. + * For example, an apostrophe that begins or ends quoted text + * would be indicated with such a part. + * The value is undefined and currently always 0. + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_SKIP_SYNTAX, + /** + * Indicates that a syntax character needs to be inserted for auto-quoting. + * The length is 0. + * The value is the character code of the insertion character. (U+0027=APOSTROPHE) + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_INSERT_CHAR, + /** + * Indicates a syntactic (non-escaped) # symbol in a plural variant. + * When formatting, replace this part's substring with the + * (value-offset) for the plural argument value. + * The value is undefined and currently always 0. + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_REPLACE_NUMBER, + /** + * Start of an argument. + * The length is 1 for the '{'. + * The value is the ordinal value of the ArgType. Use getArgType(). + *

+ * This part is followed by either an ARG_NUMBER or ARG_NAME, + * followed by optional argument sub-parts (see UMessagePatternArgType constants) + * and finally an ARG_LIMIT part. + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_ARG_START, + /** + * End of an argument. + * The length is 1 for the '}'. + * The value is the ordinal value of the ArgType. Use getArgType(). + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_ARG_LIMIT, + /** + * The argument number, provided by the value. + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_ARG_NUMBER, + /** + * The argument name. + * The value is undefined and currently always 0. + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_ARG_NAME, + /** + * The argument type. + * The value is undefined and currently always 0. + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_ARG_TYPE, + /** + * The argument style text. + * The value is undefined and currently always 0. + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_ARG_STYLE, + /** + * A selector substring in a "complex" argument style. + * The value is undefined and currently always 0. + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_ARG_SELECTOR, + /** + * An integer value, for example the offset or an explicit selector value + * in a PluralFormat style. + * The part value is the integer value. + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_ARG_INT, + /** + * A numeric value, for example the offset or an explicit selector value + * in a PluralFormat style. + * The part value is an index into an internal array of numeric values; + * use getNumericValue(). + * @stable ICU 4.8 + */ + UMSGPAT_PART_TYPE_ARG_DOUBLE +}; +/** + * @stable ICU 4.8 + */ +typedef enum UMessagePatternPartType UMessagePatternPartType; + +/** + * Argument type constants. + * Returned by Part.getArgType() for ARG_START and ARG_LIMIT parts. + * + * Messages nested inside an argument are each delimited by MSG_START and MSG_LIMIT, + * with a nesting level one greater than the surrounding message. + * @stable ICU 4.8 + */ +enum UMessagePatternArgType { + /** + * The argument has no specified type. + * @stable ICU 4.8 + */ + UMSGPAT_ARG_TYPE_NONE, + /** + * The argument has a "simple" type which is provided by the ARG_TYPE part. + * An ARG_STYLE part might follow that. + * @stable ICU 4.8 + */ + UMSGPAT_ARG_TYPE_SIMPLE, + /** + * The argument is a ChoiceFormat with one or more + * ((ARG_INT | ARG_DOUBLE), ARG_SELECTOR, message) tuples. + * @stable ICU 4.8 + */ + UMSGPAT_ARG_TYPE_CHOICE, + /** + * The argument is a cardinal-number PluralFormat with an optional ARG_INT or ARG_DOUBLE offset + * (e.g., offset:1) + * and one or more (ARG_SELECTOR [explicit-value] message) tuples. + * If the selector has an explicit value (e.g., =2), then + * that value is provided by the ARG_INT or ARG_DOUBLE part preceding the message. + * Otherwise the message immediately follows the ARG_SELECTOR. + * @stable ICU 4.8 + */ + UMSGPAT_ARG_TYPE_PLURAL, + /** + * The argument is a SelectFormat with one or more (ARG_SELECTOR, message) pairs. + * @stable ICU 4.8 + */ + UMSGPAT_ARG_TYPE_SELECT, + /** + * The argument is an ordinal-number PluralFormat + * with the same style parts sequence and semantics as UMSGPAT_ARG_TYPE_PLURAL. + * @stable ICU 50 + */ + UMSGPAT_ARG_TYPE_SELECTORDINAL +}; +/** + * @stable ICU 4.8 + */ +typedef enum UMessagePatternArgType UMessagePatternArgType; + +/** + * \def UMSGPAT_ARG_TYPE_HAS_PLURAL_STYLE + * Returns TRUE if the argument type has a plural style part sequence and semantics, + * for example UMSGPAT_ARG_TYPE_PLURAL and UMSGPAT_ARG_TYPE_SELECTORDINAL. + * @stable ICU 50 + */ +#define UMSGPAT_ARG_TYPE_HAS_PLURAL_STYLE(argType) \ + ((argType)==UMSGPAT_ARG_TYPE_PLURAL || (argType)==UMSGPAT_ARG_TYPE_SELECTORDINAL) + +enum { + /** + * Return value from MessagePattern.validateArgumentName() for when + * the string is a valid "pattern identifier" but not a number. + * @stable ICU 4.8 + */ + UMSGPAT_ARG_NAME_NOT_NUMBER=-1, + + /** + * Return value from MessagePattern.validateArgumentName() for when + * the string is invalid. + * It might not be a valid "pattern identifier", + * or it have only ASCII digits but there is a leading zero or the number is too large. + * @stable ICU 4.8 + */ + UMSGPAT_ARG_NAME_NOT_VALID=-2 +}; + +/** + * Special value that is returned by getNumericValue(Part) when no + * numeric value is defined for a part. + * @see MessagePattern.getNumericValue() + * @stable ICU 4.8 + */ +#define UMSGPAT_NO_NUMERIC_VALUE ((double)(-123456789)) + +U_NAMESPACE_BEGIN + +class MessagePatternDoubleList; +class MessagePatternPartsList; + +/** + * Parses and represents ICU MessageFormat patterns. + * Also handles patterns for ChoiceFormat, PluralFormat and SelectFormat. + * Used in the implementations of those classes as well as in tools + * for message validation, translation and format conversion. + *

+ * The parser handles all syntax relevant for identifying message arguments. + * This includes "complex" arguments whose style strings contain + * nested MessageFormat pattern substrings. + * For "simple" arguments (with no nested MessageFormat pattern substrings), + * the argument style is not parsed any further. + *

+ * The parser handles named and numbered message arguments and allows both in one message. + *

+ * Once a pattern has been parsed successfully, iterate through the parsed data + * with countParts(), getPart() and related methods. + *

+ * The data logically represents a parse tree, but is stored and accessed + * as a list of "parts" for fast and simple parsing and to minimize object allocations. + * Arguments and nested messages are best handled via recursion. + * For every _START "part", MessagePattern.getLimitPartIndex() efficiently returns + * the index of the corresponding _LIMIT "part". + *

+ * List of "parts": + *

+ * message = MSG_START (SKIP_SYNTAX | INSERT_CHAR | REPLACE_NUMBER | argument)* MSG_LIMIT
+ * argument = noneArg | simpleArg | complexArg
+ * complexArg = choiceArg | pluralArg | selectArg
+ *
+ * noneArg = ARG_START.NONE (ARG_NAME | ARG_NUMBER) ARG_LIMIT.NONE
+ * simpleArg = ARG_START.SIMPLE (ARG_NAME | ARG_NUMBER) ARG_TYPE [ARG_STYLE] ARG_LIMIT.SIMPLE
+ * choiceArg = ARG_START.CHOICE (ARG_NAME | ARG_NUMBER) choiceStyle ARG_LIMIT.CHOICE
+ * pluralArg = ARG_START.PLURAL (ARG_NAME | ARG_NUMBER) pluralStyle ARG_LIMIT.PLURAL
+ * selectArg = ARG_START.SELECT (ARG_NAME | ARG_NUMBER) selectStyle ARG_LIMIT.SELECT
+ *
+ * choiceStyle = ((ARG_INT | ARG_DOUBLE) ARG_SELECTOR message)+
+ * pluralStyle = [ARG_INT | ARG_DOUBLE] (ARG_SELECTOR [ARG_INT | ARG_DOUBLE] message)+
+ * selectStyle = (ARG_SELECTOR message)+
+ * 
+ *
    + *
  • Literal output text is not represented directly by "parts" but accessed + * between parts of a message, from one part's getLimit() to the next part's getIndex(). + *
  • ARG_START.CHOICE stands for an ARG_START Part with ArgType CHOICE. + *
  • In the choiceStyle, the ARG_SELECTOR has the '<', the '#' or + * the less-than-or-equal-to sign (U+2264). + *
  • In the pluralStyle, the first, optional numeric Part has the "offset:" value. + * The optional numeric Part between each (ARG_SELECTOR, message) pair + * is the value of an explicit-number selector like "=2", + * otherwise the selector is a non-numeric identifier. + *
  • The REPLACE_NUMBER Part can occur only in an immediate sub-message of the pluralStyle. + *
+ *

+ * This class is not intended for public subclassing. + * + * @stable ICU 4.8 + */ +class U_COMMON_API MessagePattern : public UObject { +public: + /** + * Constructs an empty MessagePattern with default UMessagePatternApostropheMode. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @stable ICU 4.8 + */ + MessagePattern(UErrorCode &errorCode); + + /** + * Constructs an empty MessagePattern. + * @param mode Explicit UMessagePatternApostropheMode. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @stable ICU 4.8 + */ + MessagePattern(UMessagePatternApostropheMode mode, UErrorCode &errorCode); + + /** + * Constructs a MessagePattern with default UMessagePatternApostropheMode and + * parses the MessageFormat pattern string. + * @param pattern a MessageFormat pattern string + * @param parseError Struct to receive information on the position + * of an error within the pattern. + * Can be NULL. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * TODO: turn @throws into UErrorCode specifics? + * @throws IllegalArgumentException for syntax errors in the pattern string + * @throws IndexOutOfBoundsException if certain limits are exceeded + * (e.g., argument number too high, argument name too long, etc.) + * @throws NumberFormatException if a number could not be parsed + * @stable ICU 4.8 + */ + MessagePattern(const UnicodeString &pattern, UParseError *parseError, UErrorCode &errorCode); + + /** + * Copy constructor. + * @param other Object to copy. + * @stable ICU 4.8 + */ + MessagePattern(const MessagePattern &other); + + /** + * Assignment operator. + * @param other Object to copy. + * @return *this=other + * @stable ICU 4.8 + */ + MessagePattern &operator=(const MessagePattern &other); + + /** + * Destructor. + * @stable ICU 4.8 + */ + virtual ~MessagePattern(); + + /** + * Parses a MessageFormat pattern string. + * @param pattern a MessageFormat pattern string + * @param parseError Struct to receive information on the position + * of an error within the pattern. + * Can be NULL. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return *this + * @throws IllegalArgumentException for syntax errors in the pattern string + * @throws IndexOutOfBoundsException if certain limits are exceeded + * (e.g., argument number too high, argument name too long, etc.) + * @throws NumberFormatException if a number could not be parsed + * @stable ICU 4.8 + */ + MessagePattern &parse(const UnicodeString &pattern, + UParseError *parseError, UErrorCode &errorCode); + + /** + * Parses a ChoiceFormat pattern string. + * @param pattern a ChoiceFormat pattern string + * @param parseError Struct to receive information on the position + * of an error within the pattern. + * Can be NULL. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return *this + * @throws IllegalArgumentException for syntax errors in the pattern string + * @throws IndexOutOfBoundsException if certain limits are exceeded + * (e.g., argument number too high, argument name too long, etc.) + * @throws NumberFormatException if a number could not be parsed + * @stable ICU 4.8 + */ + MessagePattern &parseChoiceStyle(const UnicodeString &pattern, + UParseError *parseError, UErrorCode &errorCode); + + /** + * Parses a PluralFormat pattern string. + * @param pattern a PluralFormat pattern string + * @param parseError Struct to receive information on the position + * of an error within the pattern. + * Can be NULL. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return *this + * @throws IllegalArgumentException for syntax errors in the pattern string + * @throws IndexOutOfBoundsException if certain limits are exceeded + * (e.g., argument number too high, argument name too long, etc.) + * @throws NumberFormatException if a number could not be parsed + * @stable ICU 4.8 + */ + MessagePattern &parsePluralStyle(const UnicodeString &pattern, + UParseError *parseError, UErrorCode &errorCode); + + /** + * Parses a SelectFormat pattern string. + * @param pattern a SelectFormat pattern string + * @param parseError Struct to receive information on the position + * of an error within the pattern. + * Can be NULL. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return *this + * @throws IllegalArgumentException for syntax errors in the pattern string + * @throws IndexOutOfBoundsException if certain limits are exceeded + * (e.g., argument number too high, argument name too long, etc.) + * @throws NumberFormatException if a number could not be parsed + * @stable ICU 4.8 + */ + MessagePattern &parseSelectStyle(const UnicodeString &pattern, + UParseError *parseError, UErrorCode &errorCode); + + /** + * Clears this MessagePattern. + * countParts() will return 0. + * @stable ICU 4.8 + */ + void clear(); + + /** + * Clears this MessagePattern and sets the UMessagePatternApostropheMode. + * countParts() will return 0. + * @param mode The new UMessagePatternApostropheMode. + * @stable ICU 4.8 + */ + void clearPatternAndSetApostropheMode(UMessagePatternApostropheMode mode) { + clear(); + aposMode=mode; + } + + /** + * @param other another object to compare with. + * @return TRUE if this object is equivalent to the other one. + * @stable ICU 4.8 + */ + UBool operator==(const MessagePattern &other) const; + + /** + * @param other another object to compare with. + * @return FALSE if this object is equivalent to the other one. + * @stable ICU 4.8 + */ + inline UBool operator!=(const MessagePattern &other) const { + return !operator==(other); + } + + /** + * @return A hash code for this object. + * @stable ICU 4.8 + */ + int32_t hashCode() const; + + /** + * @return this instance's UMessagePatternApostropheMode. + * @stable ICU 4.8 + */ + UMessagePatternApostropheMode getApostropheMode() const { + return aposMode; + } + + // Java has package-private jdkAposMode() here. + // In C++, this is declared in the MessageImpl class. + + /** + * @return the parsed pattern string (null if none was parsed). + * @stable ICU 4.8 + */ + const UnicodeString &getPatternString() const { + return msg; + } + + /** + * Does the parsed pattern have named arguments like {first_name}? + * @return TRUE if the parsed pattern has at least one named argument. + * @stable ICU 4.8 + */ + UBool hasNamedArguments() const { + return hasArgNames; + } + + /** + * Does the parsed pattern have numbered arguments like {2}? + * @return TRUE if the parsed pattern has at least one numbered argument. + * @stable ICU 4.8 + */ + UBool hasNumberedArguments() const { + return hasArgNumbers; + } + + /** + * Validates and parses an argument name or argument number string. + * An argument name must be a "pattern identifier", that is, it must contain + * no Unicode Pattern_Syntax or Pattern_White_Space characters. + * If it only contains ASCII digits, then it must be a small integer with no leading zero. + * @param name Input string. + * @return >=0 if the name is a valid number, + * ARG_NAME_NOT_NUMBER (-1) if it is a "pattern identifier" but not all ASCII digits, + * ARG_NAME_NOT_VALID (-2) if it is neither. + * @stable ICU 4.8 + */ + static int32_t validateArgumentName(const UnicodeString &name); + + /** + * Returns a version of the parsed pattern string where each ASCII apostrophe + * is doubled (escaped) if it is not already, and if it is not interpreted as quoting syntax. + *

+ * For example, this turns "I don't '{know}' {gender,select,female{h''er}other{h'im}}." + * into "I don''t '{know}' {gender,select,female{h''er}other{h''im}}." + * @return the deep-auto-quoted version of the parsed pattern string. + * @see MessageFormat.autoQuoteApostrophe() + * @stable ICU 4.8 + */ + UnicodeString autoQuoteApostropheDeep() const; + + class Part; + + /** + * Returns the number of "parts" created by parsing the pattern string. + * Returns 0 if no pattern has been parsed or clear() was called. + * @return the number of pattern parts. + * @stable ICU 4.8 + */ + int32_t countParts() const { + return partsLength; + } + + /** + * Gets the i-th pattern "part". + * @param i The index of the Part data. (0..countParts()-1) + * @return the i-th pattern "part". + * @stable ICU 4.8 + */ + const Part &getPart(int32_t i) const { + return parts[i]; + } + + /** + * Returns the UMessagePatternPartType of the i-th pattern "part". + * Convenience method for getPart(i).getType(). + * @param i The index of the Part data. (0..countParts()-1) + * @return The UMessagePatternPartType of the i-th Part. + * @stable ICU 4.8 + */ + UMessagePatternPartType getPartType(int32_t i) const { + return getPart(i).type; + } + + /** + * Returns the pattern index of the specified pattern "part". + * Convenience method for getPart(partIndex).getIndex(). + * @param partIndex The index of the Part data. (0..countParts()-1) + * @return The pattern index of this Part. + * @stable ICU 4.8 + */ + int32_t getPatternIndex(int32_t partIndex) const { + return getPart(partIndex).index; + } + + /** + * Returns the substring of the pattern string indicated by the Part. + * Convenience method for getPatternString().substring(part.getIndex(), part.getLimit()). + * @param part a part of this MessagePattern. + * @return the substring associated with part. + * @stable ICU 4.8 + */ + UnicodeString getSubstring(const Part &part) const { + return msg.tempSubString(part.index, part.length); + } + + /** + * Compares the part's substring with the input string s. + * @param part a part of this MessagePattern. + * @param s a string. + * @return TRUE if getSubstring(part).equals(s). + * @stable ICU 4.8 + */ + UBool partSubstringMatches(const Part &part, const UnicodeString &s) const { + return 0==msg.compare(part.index, part.length, s); + } + + /** + * Returns the numeric value associated with an ARG_INT or ARG_DOUBLE. + * @param part a part of this MessagePattern. + * @return the part's numeric value, or UMSGPAT_NO_NUMERIC_VALUE if this is not a numeric part. + * @stable ICU 4.8 + */ + double getNumericValue(const Part &part) const; + + /** + * Returns the "offset:" value of a PluralFormat argument, or 0 if none is specified. + * @param pluralStart the index of the first PluralFormat argument style part. (0..countParts()-1) + * @return the "offset:" value. + * @stable ICU 4.8 + */ + double getPluralOffset(int32_t pluralStart) const; + + /** + * Returns the index of the ARG|MSG_LIMIT part corresponding to the ARG|MSG_START at start. + * @param start The index of some Part data (0..countParts()-1); + * this Part should be of Type ARG_START or MSG_START. + * @return The first i>start where getPart(i).getType()==ARG|MSG_LIMIT at the same nesting level, + * or start itself if getPartType(msgStart)!=ARG|MSG_START. + * @stable ICU 4.8 + */ + int32_t getLimitPartIndex(int32_t start) const { + int32_t limit=getPart(start).limitPartIndex; + if(limit parts=new ArrayList(); + MessagePatternPartsList *partsList; + Part *parts; + int32_t partsLength; + // ArrayList numericValues; + MessagePatternDoubleList *numericValuesList; + double *numericValues; + int32_t numericValuesLength; + UBool hasArgNames; + UBool hasArgNumbers; + UBool needsAutoQuoting; +}; + +U_NAMESPACE_END + +#endif // !UCONFIG_NO_FORMATTING + +#endif // __MESSAGEPATTERN_H__ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/msgfmt.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/msgfmt.h new file mode 100644 index 0000000..fef8010 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/msgfmt.h @@ -0,0 +1,1095 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +* Copyright (C) 2007-2013, International Business Machines Corporation and +* others. All Rights Reserved. +******************************************************************************** +* +* File MSGFMT.H +* +* Modification History: +* +* Date Name Description +* 02/19/97 aliu Converted from java. +* 03/20/97 helena Finished first cut of implementation. +* 07/22/98 stephen Removed operator!= (defined in Format) +* 08/19/2002 srl Removing Javaisms +*******************************************************************************/ + +#ifndef MSGFMT_H +#define MSGFMT_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Formats messages in a language-neutral way. + */ + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/format.h" +#include "unicode/locid.h" +#include "unicode/messagepattern.h" +#include "unicode/parseerr.h" +#include "unicode/plurfmt.h" +#include "unicode/plurrule.h" + +U_CDECL_BEGIN +// Forward declaration. +struct UHashtable; +typedef struct UHashtable UHashtable; /**< @internal */ +U_CDECL_END + +U_NAMESPACE_BEGIN + +class AppendableWrapper; +class DateFormat; +class NumberFormat; + +/** + *

MessageFormat prepares strings for display to users, + * with optional arguments (variables/placeholders). + * The arguments can occur in any order, which is necessary for translation + * into languages with different grammars. + * + *

A MessageFormat is constructed from a pattern string + * with arguments in {curly braces} which will be replaced by formatted values. + * + *

MessageFormat differs from the other Format + * classes in that you create a MessageFormat object with one + * of its constructors (not with a createInstance style factory + * method). Factory methods aren't necessary because MessageFormat + * itself doesn't implement locale-specific behavior. Any locale-specific + * behavior is defined by the pattern that you provide and the + * subformats used for inserted arguments. + * + *

Arguments can be named (using identifiers) or numbered (using small ASCII-digit integers). + * Some of the API methods work only with argument numbers and throw an exception + * if the pattern has named arguments (see {@link #usesNamedArguments()}). + * + *

An argument might not specify any format type. In this case, + * a Number value is formatted with a default (for the locale) NumberFormat, + * a Date value is formatted with a default (for the locale) DateFormat, + * and for any other value its toString() value is used. + * + *

An argument might specify a "simple" type for which the specified + * Format object is created, cached and used. + * + *

An argument might have a "complex" type with nested MessageFormat sub-patterns. + * During formatting, one of these sub-messages is selected according to the argument value + * and recursively formatted. + * + *

After construction, a custom Format object can be set for + * a top-level argument, overriding the default formatting and parsing behavior + * for that argument. + * However, custom formatting can be achieved more simply by writing + * a typeless argument in the pattern string + * and supplying it with a preformatted string value. + * + *

When formatting, MessageFormat takes a collection of argument values + * and writes an output string. + * The argument values may be passed as an array + * (when the pattern contains only numbered arguments) + * or as an array of names and and an array of arguments (which works for both named + * and numbered arguments). + * + *

Each argument is matched with one of the input values by array index or argument name + * and formatted according to its pattern specification + * (or using a custom Format object if one was set). + * A numbered pattern argument is matched with an argument name that contains that number + * as an ASCII-decimal-digit string (without leading zero). + * + *

Patterns and Their Interpretation

+ * + * MessageFormat uses patterns of the following form: + *
+ * message = messageText (argument messageText)*
+ * argument = noneArg | simpleArg | complexArg
+ * complexArg = choiceArg | pluralArg | selectArg | selectordinalArg
+ *
+ * noneArg = '{' argNameOrNumber '}'
+ * simpleArg = '{' argNameOrNumber ',' argType [',' argStyle] '}'
+ * choiceArg = '{' argNameOrNumber ',' "choice" ',' choiceStyle '}'
+ * pluralArg = '{' argNameOrNumber ',' "plural" ',' pluralStyle '}'
+ * selectArg = '{' argNameOrNumber ',' "select" ',' selectStyle '}'
+ * selectordinalArg = '{' argNameOrNumber ',' "selectordinal" ',' pluralStyle '}'
+ *
+ * choiceStyle: see {@link ChoiceFormat}
+ * pluralStyle: see {@link PluralFormat}
+ * selectStyle: see {@link SelectFormat}
+ *
+ * argNameOrNumber = argName | argNumber
+ * argName = [^[[:Pattern_Syntax:][:Pattern_White_Space:]]]+
+ * argNumber = '0' | ('1'..'9' ('0'..'9')*)
+ *
+ * argType = "number" | "date" | "time" | "spellout" | "ordinal" | "duration"
+ * argStyle = "short" | "medium" | "long" | "full" | "integer" | "currency" | "percent" | argStyleText
+ * 
+ * + *
    + *
  • messageText can contain quoted literal strings including syntax characters. + * A quoted literal string begins with an ASCII apostrophe and a syntax character + * (usually a {curly brace}) and continues until the next single apostrophe. + * A double ASCII apostrohpe inside or outside of a quoted string represents + * one literal apostrophe. + *
  • Quotable syntax characters are the {curly braces} in all messageText parts, + * plus the '#' sign in a messageText immediately inside a pluralStyle, + * and the '|' symbol in a messageText immediately inside a choiceStyle. + *
  • See also {@link #UMessagePatternApostropheMode} + *
  • In argStyleText, every single ASCII apostrophe begins and ends quoted literal text, + * and unquoted {curly braces} must occur in matched pairs. + *
+ * + *

Recommendation: Use the real apostrophe (single quote) character + * \htmlonly’\endhtmlonly (U+2019) for + * human-readable text, and use the ASCII apostrophe ' (U+0027) + * only in program syntax, like quoting in MessageFormat. + * See the annotations for U+0027 Apostrophe in The Unicode Standard. + * + *

The choice argument type is deprecated. + * Use plural arguments for proper plural selection, + * and select arguments for simple selection among a fixed set of choices. + * + *

The argType and argStyle values are used to create + * a Format instance for the format element. The following + * table shows how the values map to Format instances. Combinations not + * shown in the table are illegal. Any argStyleText must + * be a valid pattern string for the Format subclass used. + * + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
argType + * argStyle + * resulting Format object + *
(none) + * null + *
number + * (none) + * NumberFormat.createInstance(getLocale(), status) + *
integer + * NumberFormat.createInstance(getLocale(), kNumberStyle, status) + *
currency + * NumberFormat.createCurrencyInstance(getLocale(), status) + *
percent + * NumberFormat.createPercentInstance(getLocale(), status) + *
argStyleText + * new DecimalFormat(argStyleText, new DecimalFormatSymbols(getLocale(), status), status) + *
date + * (none) + * DateFormat.createDateInstance(kDefault, getLocale(), status) + *
short + * DateFormat.createDateInstance(kShort, getLocale(), status) + *
medium + * DateFormat.createDateInstance(kDefault, getLocale(), status) + *
long + * DateFormat.createDateInstance(kLong, getLocale(), status) + *
full + * DateFormat.createDateInstance(kFull, getLocale(), status) + *
argStyleText + * new SimpleDateFormat(argStyleText, getLocale(), status) + *
time + * (none) + * DateFormat.createTimeInstance(kDefault, getLocale(), status) + *
short + * DateFormat.createTimeInstance(kShort, getLocale(), status) + *
medium + * DateFormat.createTimeInstance(kDefault, getLocale(), status) + *
long + * DateFormat.createTimeInstance(kLong, getLocale(), status) + *
full + * DateFormat.createTimeInstance(kFull, getLocale(), status) + *
argStyleText + * new SimpleDateFormat(argStyleText, getLocale(), status) + *
spellout + * argStyleText (optional) + * new RuleBasedNumberFormat(URBNF_SPELLOUT, getLocale(), status) + *
    .setDefaultRuleset(argStyleText, status);
+ *
ordinal + * argStyleText (optional) + * new RuleBasedNumberFormat(URBNF_ORDINAL, getLocale(), status) + *
    .setDefaultRuleset(argStyleText, status);
+ *
duration + * argStyleText (optional) + * new RuleBasedNumberFormat(URBNF_DURATION, getLocale(), status) + *
    .setDefaultRuleset(argStyleText, status);
+ *
+ *

+ * + *

Usage Information

+ * + *

Here are some examples of usage: + * Example 1: + * + *

+ * \code
+ *     UErrorCode success = U_ZERO_ERROR;
+ *     GregorianCalendar cal(success);
+ *     Formattable arguments[] = {
+ *         7L,
+ *         Formattable( (Date) cal.getTime(success), Formattable::kIsDate),
+ *         "a disturbance in the Force"
+ *     };
+ *
+ *     UnicodeString result;
+ *     MessageFormat::format(
+ *          "At {1,time} on {1,date}, there was {2} on planet {0,number}.",
+ *          arguments, 3, result, success );
+ *
+ *     cout << "result: " << result << endl;
+ *     //: At 4:34:20 PM on 23-Mar-98, there was a disturbance
+ *     //             in the Force on planet 7.
+ * \endcode
+ * 
+ * + * Typically, the message format will come from resources, and the + * arguments will be dynamically set at runtime. + * + *

Example 2: + * + *

+ *  \code
+ *     success = U_ZERO_ERROR;
+ *     Formattable testArgs[] = {3L, "MyDisk"};
+ *
+ *     MessageFormat form(
+ *         "The disk \"{1}\" contains {0} file(s).", success );
+ *
+ *     UnicodeString string;
+ *     FieldPosition fpos = 0;
+ *     cout << "format: " << form.format(testArgs, 2, string, fpos, success ) << endl;
+ *
+ *     // output, with different testArgs:
+ *     // output: The disk "MyDisk" contains 0 file(s).
+ *     // output: The disk "MyDisk" contains 1 file(s).
+ *     // output: The disk "MyDisk" contains 1,273 file(s).
+ *  \endcode
+ *  
+ * + * + *

For messages that include plural forms, you can use a plural argument: + *

+ * \code
+ *  success = U_ZERO_ERROR;
+ *  MessageFormat msgFmt(
+ *       "{num_files, plural, "
+ *       "=0{There are no files on disk \"{disk_name}\".}"
+ *       "=1{There is one file on disk \"{disk_name}\".}"
+ *       "other{There are # files on disk \"{disk_name}\".}}",
+ *      Locale("en"),
+ *      success);
+ *  FieldPosition fpos = 0;
+ *  Formattable testArgs[] = {0L, "MyDisk"};
+ *  UnicodeString testArgsNames[] = {"num_files", "disk_name"};
+ *  UnicodeString result;
+ *  cout << msgFmt.format(testArgs, testArgsNames, 2, result, fpos, 0, success);
+ *  testArgs[0] = 3L;
+ *  cout << msgFmt.format(testArgs, testArgsNames, 2, result, fpos, 0, success);
+ * \endcode
+ * output:
+ * There are no files on disk "MyDisk".
+ * There are 3 files on "MyDisk".
+ * 
+ * See {@link PluralFormat} and {@link PluralRules} for details. + * + *

Synchronization

+ * + *

MessageFormats are not synchronized. + * It is recommended to create separate format instances for each thread. + * If multiple threads access a format concurrently, it must be synchronized + * externally. + * + * @stable ICU 2.0 + */ +class U_I18N_API MessageFormat : public Format { +public: +#ifndef U_HIDE_OBSOLETE_API + /** + * Enum type for kMaxFormat. + * @obsolete ICU 3.0. The 10-argument limit was removed as of ICU 2.6, + * rendering this enum type obsolete. + */ + enum EFormatNumber { + /** + * The maximum number of arguments. + * @obsolete ICU 3.0. The 10-argument limit was removed as of ICU 2.6, + * rendering this constant obsolete. + */ + kMaxFormat = 10 + }; +#endif /* U_HIDE_OBSOLETE_API */ + + /** + * Constructs a new MessageFormat using the given pattern and the + * default locale. + * + * @param pattern Pattern used to construct object. + * @param status Input/output error code. If the + * pattern cannot be parsed, set to failure code. + * @stable ICU 2.0 + */ + MessageFormat(const UnicodeString& pattern, + UErrorCode &status); + + /** + * Constructs a new MessageFormat using the given pattern and locale. + * @param pattern Pattern used to construct object. + * @param newLocale The locale to use for formatting dates and numbers. + * @param status Input/output error code. If the + * pattern cannot be parsed, set to failure code. + * @stable ICU 2.0 + */ + MessageFormat(const UnicodeString& pattern, + const Locale& newLocale, + UErrorCode& status); + /** + * Constructs a new MessageFormat using the given pattern and locale. + * @param pattern Pattern used to construct object. + * @param newLocale The locale to use for formatting dates and numbers. + * @param parseError Struct to receive information on the position + * of an error within the pattern. + * @param status Input/output error code. If the + * pattern cannot be parsed, set to failure code. + * @stable ICU 2.0 + */ + MessageFormat(const UnicodeString& pattern, + const Locale& newLocale, + UParseError& parseError, + UErrorCode& status); + /** + * Constructs a new MessageFormat from an existing one. + * @stable ICU 2.0 + */ + MessageFormat(const MessageFormat&); + + /** + * Assignment operator. + * @stable ICU 2.0 + */ + const MessageFormat& operator=(const MessageFormat&); + + /** + * Destructor. + * @stable ICU 2.0 + */ + virtual ~MessageFormat(); + + /** + * Clones this Format object polymorphically. The caller owns the + * result and should delete it when done. + * @stable ICU 2.0 + */ + virtual Format* clone(void) const; + + /** + * Returns true if the given Format objects are semantically equal. + * Objects of different subclasses are considered unequal. + * @param other the object to be compared with. + * @return true if the given Format objects are semantically equal. + * @stable ICU 2.0 + */ + virtual UBool operator==(const Format& other) const; + + /** + * Sets the locale to be used for creating argument Format objects. + * @param theLocale the new locale value to be set. + * @stable ICU 2.0 + */ + virtual void setLocale(const Locale& theLocale); + + /** + * Gets the locale used for creating argument Format objects. + * format information. + * @return the locale of the object. + * @stable ICU 2.0 + */ + virtual const Locale& getLocale(void) const; + + /** + * Applies the given pattern string to this message format. + * + * @param pattern The pattern to be applied. + * @param status Input/output error code. If the + * pattern cannot be parsed, set to failure code. + * @stable ICU 2.0 + */ + virtual void applyPattern(const UnicodeString& pattern, + UErrorCode& status); + /** + * Applies the given pattern string to this message format. + * + * @param pattern The pattern to be applied. + * @param parseError Struct to receive information on the position + * of an error within the pattern. + * @param status Input/output error code. If the + * pattern cannot be parsed, set to failure code. + * @stable ICU 2.0 + */ + virtual void applyPattern(const UnicodeString& pattern, + UParseError& parseError, + UErrorCode& status); + + /** + * Sets the UMessagePatternApostropheMode and the pattern used by this message format. + * Parses the pattern and caches Format objects for simple argument types. + * Patterns and their interpretation are specified in the + * class description. + *

+ * This method is best used only once on a given object to avoid confusion about the mode, + * and after constructing the object with an empty pattern string to minimize overhead. + * + * @param pattern The pattern to be applied. + * @param aposMode The new apostrophe mode. + * @param parseError Struct to receive information on the position + * of an error within the pattern. + * Can be NULL. + * @param status Input/output error code. If the + * pattern cannot be parsed, set to failure code. + * @stable ICU 4.8 + */ + virtual void applyPattern(const UnicodeString& pattern, + UMessagePatternApostropheMode aposMode, + UParseError* parseError, + UErrorCode& status); + + /** + * @return this instance's UMessagePatternApostropheMode. + * @stable ICU 4.8 + */ + UMessagePatternApostropheMode getApostropheMode() const { + return msgPattern.getApostropheMode(); + } + + /** + * Returns a pattern that can be used to recreate this object. + * + * @param appendTo Output parameter to receive the pattern. + * Result is appended to existing contents. + * @return Reference to 'appendTo' parameter. + * @stable ICU 2.0 + */ + virtual UnicodeString& toPattern(UnicodeString& appendTo) const; + + /** + * Sets subformats. + * See the class description about format numbering. + * The caller should not delete the Format objects after this call. + * The array formatsToAdopt is not itself adopted. Its + * ownership is retained by the caller. If the call fails because + * memory cannot be allocated, then the formats will be deleted + * by this method, and this object will remain unchanged. + * + *

If this format uses named arguments, the new formats are discarded + * and this format remains unchanged. + * + * @stable ICU 2.0 + * @param formatsToAdopt the format to be adopted. + * @param count the size of the array. + */ + virtual void adoptFormats(Format** formatsToAdopt, int32_t count); + + /** + * Sets subformats. + * See the class description about format numbering. + * Each item in the array is cloned into the internal array. + * If the call fails because memory cannot be allocated, then this + * object will remain unchanged. + * + *

If this format uses named arguments, the new formats are discarded + * and this format remains unchanged. + * + * @stable ICU 2.0 + * @param newFormats the new format to be set. + * @param cnt the size of the array. + */ + virtual void setFormats(const Format** newFormats, int32_t cnt); + + + /** + * Sets one subformat. + * See the class description about format numbering. + * The caller should not delete the Format object after this call. + * If the number is over the number of formats already set, + * the item will be deleted and ignored. + * + *

If this format uses named arguments, the new format is discarded + * and this format remains unchanged. + * + * @stable ICU 2.0 + * @param formatNumber index of the subformat. + * @param formatToAdopt the format to be adopted. + */ + virtual void adoptFormat(int32_t formatNumber, Format* formatToAdopt); + + /** + * Sets one subformat. + * See the class description about format numbering. + * If the number is over the number of formats already set, + * the item will be ignored. + * @param formatNumber index of the subformat. + * @param format the format to be set. + * @stable ICU 2.0 + */ + virtual void setFormat(int32_t formatNumber, const Format& format); + + /** + * Gets format names. This function returns formatNames in StringEnumerations + * which can be used with getFormat() and setFormat() to export formattable + * array from current MessageFormat to another. It is the caller's responsibility + * to delete the returned formatNames. + * @param status output param set to success/failure code. + * @stable ICU 4.0 + */ + virtual StringEnumeration* getFormatNames(UErrorCode& status); + + /** + * Gets subformat pointer for given format name. + * This function supports both named and numbered + * arguments. If numbered, the formatName is the + * corresponding UnicodeStrings (e.g. "0", "1", "2"...). + * The returned Format object should not be deleted by the caller, + * nor should the ponter of other object . The pointer and its + * contents remain valid only until the next call to any method + * of this class is made with this object. + * @param formatName the name or number specifying a format + * @param status output param set to success/failure code. + * @stable ICU 4.0 + */ + virtual Format* getFormat(const UnicodeString& formatName, UErrorCode& status); + + /** + * Sets one subformat for given format name. + * See the class description about format name. + * This function supports both named and numbered + * arguments-- if numbered, the formatName is the + * corresponding UnicodeStrings (e.g. "0", "1", "2"...). + * If there is no matched formatName or wrong type, + * the item will be ignored. + * @param formatName Name of the subformat. + * @param format the format to be set. + * @param status output param set to success/failure code. + * @stable ICU 4.0 + */ + virtual void setFormat(const UnicodeString& formatName, const Format& format, UErrorCode& status); + + /** + * Sets one subformat for given format name. + * See the class description about format name. + * This function supports both named and numbered + * arguments-- if numbered, the formatName is the + * corresponding UnicodeStrings (e.g. "0", "1", "2"...). + * If there is no matched formatName or wrong type, + * the item will be ignored. + * The caller should not delete the Format object after this call. + * @param formatName Name of the subformat. + * @param formatToAdopt Format to be adopted. + * @param status output param set to success/failure code. + * @stable ICU 4.0 + */ + virtual void adoptFormat(const UnicodeString& formatName, Format* formatToAdopt, UErrorCode& status); + + /** + * Gets an array of subformats of this object. The returned array + * should not be deleted by the caller, nor should the pointers + * within the array. The array and its contents remain valid only + * until the next call to this format. See the class description + * about format numbering. + * + * @param count output parameter to receive the size of the array + * @return an array of count Format* objects, or NULL if out of + * memory. Any or all of the array elements may be NULL. + * @stable ICU 2.0 + */ + virtual const Format** getFormats(int32_t& count) const; + + + using Format::format; + + /** + * Formats the given array of arguments into a user-readable string. + * Does not take ownership of the Formattable* array or its contents. + * + *

If this format uses named arguments, appendTo is unchanged and + * status is set to U_ILLEGAL_ARGUMENT_ERROR. + * + * @param source An array of objects to be formatted. + * @param count The number of elements of 'source'. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param ignore Not used; inherited from base class API. + * @param status Input/output error code. If the + * pattern cannot be parsed, set to failure code. + * @return Reference to 'appendTo' parameter. + * @stable ICU 2.0 + */ + UnicodeString& format(const Formattable* source, + int32_t count, + UnicodeString& appendTo, + FieldPosition& ignore, + UErrorCode& status) const; + + /** + * Formats the given array of arguments into a user-readable string + * using the given pattern. + * + *

If this format uses named arguments, appendTo is unchanged and + * status is set to U_ILLEGAL_ARGUMENT_ERROR. + * + * @param pattern The pattern. + * @param arguments An array of objects to be formatted. + * @param count The number of elements of 'source'. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param status Input/output error code. If the + * pattern cannot be parsed, set to failure code. + * @return Reference to 'appendTo' parameter. + * @stable ICU 2.0 + */ + static UnicodeString& format(const UnicodeString& pattern, + const Formattable* arguments, + int32_t count, + UnicodeString& appendTo, + UErrorCode& status); + + /** + * Formats the given array of arguments into a user-readable + * string. The array must be stored within a single Formattable + * object of type kArray. If the Formattable object type is not of + * type kArray, then returns a failing UErrorCode. + * + *

If this format uses named arguments, appendTo is unchanged and + * status is set to U_ILLEGAL_ARGUMENT_ERROR. + * + * @param obj A Formattable of type kArray containing + * arguments to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @param status Input/output error code. If the + * pattern cannot be parsed, set to failure code. + * @return Reference to 'appendTo' parameter. + * @stable ICU 2.0 + */ + virtual UnicodeString& format(const Formattable& obj, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode& status) const; + + /** + * Formats the given array of arguments into a user-defined argument name + * array. This function supports both named and numbered + * arguments-- if numbered, the formatName is the + * corresponding UnicodeStrings (e.g. "0", "1", "2"...). + * + * @param argumentNames argument name array + * @param arguments An array of objects to be formatted. + * @param count The number of elements of 'argumentNames' and + * arguments. The number of argumentNames and arguments + * must be the same. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param status Input/output error code. If the + * pattern cannot be parsed, set to failure code. + * @return Reference to 'appendTo' parameter. + * @stable ICU 4.0 + */ + UnicodeString& format(const UnicodeString* argumentNames, + const Formattable* arguments, + int32_t count, + UnicodeString& appendTo, + UErrorCode& status) const; + /** + * Parses the given string into an array of output arguments. + * + * @param source String to be parsed. + * @param pos On input, starting position for parse. On output, + * final position after parse. Unchanged if parse + * fails. + * @param count Output parameter to receive the number of arguments + * parsed. + * @return an array of parsed arguments. The caller owns both + * the array and its contents. + * @stable ICU 2.0 + */ + virtual Formattable* parse(const UnicodeString& source, + ParsePosition& pos, + int32_t& count) const; + + /** + * Parses the given string into an array of output arguments. + * + *

If this format uses named arguments, status is set to + * U_ARGUMENT_TYPE_MISMATCH. + * + * @param source String to be parsed. + * @param count Output param to receive size of returned array. + * @param status Input/output error code. If the + * pattern cannot be parsed, set to failure code. + * @return an array of parsed arguments. The caller owns both + * the array and its contents. Returns NULL if status is not U_ZERO_ERROR. + * + * @stable ICU 2.0 + */ + virtual Formattable* parse(const UnicodeString& source, + int32_t& count, + UErrorCode& status) const; + + /** + * Parses the given string into an array of output arguments + * stored within a single Formattable of type kArray. + * + * @param source The string to be parsed into an object. + * @param result Formattable to be set to the parse result. + * If parse fails, return contents are undefined. + * @param pos On input, starting position for parse. On output, + * final position after parse. Unchanged if parse + * fails. + * @stable ICU 2.0 + */ + virtual void parseObject(const UnicodeString& source, + Formattable& result, + ParsePosition& pos) const; + + /** + * Convert an 'apostrophe-friendly' pattern into a standard + * pattern. Standard patterns treat all apostrophes as + * quotes, which is problematic in some languages, e.g. + * French, where apostrophe is commonly used. This utility + * assumes that only an unpaired apostrophe immediately before + * a brace is a true quote. Other unpaired apostrophes are paired, + * and the resulting standard pattern string is returned. + * + *

Note it is not guaranteed that the returned pattern + * is indeed a valid pattern. The only effect is to convert + * between patterns having different quoting semantics. + * + * @param pattern the 'apostrophe-friendly' patttern to convert + * @param status Input/output error code. If the pattern + * cannot be parsed, the failure code is set. + * @return the standard equivalent of the original pattern + * @stable ICU 3.4 + */ + static UnicodeString autoQuoteApostrophe(const UnicodeString& pattern, + UErrorCode& status); + + + /** + * Returns true if this MessageFormat uses named arguments, + * and false otherwise. See class description. + * + * @return true if named arguments are used. + * @stable ICU 4.0 + */ + UBool usesNamedArguments() const; + + +#ifndef U_HIDE_INTERNAL_API + /** + * This API is for ICU internal use only. + * Please do not use it. + * + * Returns argument types count in the parsed pattern. + * Used to distinguish pattern "{0} d" and "d". + * + * @return The number of formattable types in the pattern + * @internal + */ + int32_t getArgTypeCount() const; +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. + * This method is to implement a simple version of RTTI, since not all + * C++ compilers support genuine RTTI. Polymorphic operator==() and + * clone() methods call this method. + * + * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @stable ICU 2.0 + */ + virtual UClassID getDynamicClassID(void) const; + + /** + * Return the class ID for this class. This is useful only for + * comparing to a return value from getDynamicClassID(). For example: + *

+     * .   Base* polymorphic_pointer = createPolymorphicObject();
+     * .   if (polymorphic_pointer->getDynamicClassID() ==
+     * .      Derived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @stable ICU 2.0 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + +#ifndef U_HIDE_INTERNAL_API + /** + * Compares two Format objects. This is used for constructing the hash + * tables. + * + * @param left pointer to a Format object. Must not be NULL. + * @param right pointer to a Format object. Must not be NULL. + * + * @return whether the two objects are the same + * @internal + */ + static UBool equalFormats(const void* left, const void* right); +#endif /* U_HIDE_INTERNAL_API */ + +private: + + Locale fLocale; + MessagePattern msgPattern; + Format** formatAliases; // see getFormats + int32_t formatAliasesCapacity; + + MessageFormat(); // default constructor not implemented + + /** + * This provider helps defer instantiation of a PluralRules object + * until we actually need to select a keyword. + * For example, if the number matches an explicit-value selector like "=1" + * we do not need any PluralRules. + */ + class U_I18N_API PluralSelectorProvider : public PluralFormat::PluralSelector { + public: + PluralSelectorProvider(const MessageFormat &mf, UPluralType type); + virtual ~PluralSelectorProvider(); + virtual UnicodeString select(void *ctx, double number, UErrorCode& ec) const; + + void reset(); + private: + const MessageFormat &msgFormat; + PluralRules* rules; + UPluralType type; + }; + + /** + * A MessageFormat formats an array of arguments. Each argument + * has an expected type, based on the pattern. For example, if + * the pattern contains the subformat "{3,number,integer}", then + * we expect argument 3 to have type Formattable::kLong. This + * array needs to grow dynamically if the MessageFormat is + * modified. + */ + Formattable::Type* argTypes; + int32_t argTypeCount; + int32_t argTypeCapacity; + + /** + * TRUE if there are different argTypes for the same argument. + * This only matters when the MessageFormat is used in the plain C (umsg_xxx) API + * where the pattern argTypes determine how the va_arg list is read. + */ + UBool hasArgTypeConflicts; + + // Variable-size array management + UBool allocateArgTypes(int32_t capacity, UErrorCode& status); + + /** + * Default Format objects used when no format is specified and a + * numeric or date argument is formatted. These are volatile + * cache objects maintained only for performance. They do not + * participate in operator=(), copy constructor(), nor + * operator==(). + */ + NumberFormat* defaultNumberFormat; + DateFormat* defaultDateFormat; + + UHashtable* cachedFormatters; + UHashtable* customFormatArgStarts; + + PluralSelectorProvider pluralProvider; + PluralSelectorProvider ordinalProvider; + + /** + * Method to retrieve default formats (or NULL on failure). + * These are semantically const, but may modify *this. + */ + const NumberFormat* getDefaultNumberFormat(UErrorCode&) const; + const DateFormat* getDefaultDateFormat(UErrorCode&) const; + + /** + * Finds the word s, in the keyword list and returns the located index. + * @param s the keyword to be searched for. + * @param list the list of keywords to be searched with. + * @return the index of the list which matches the keyword s. + */ + static int32_t findKeyword( const UnicodeString& s, + const char16_t * const *list); + + /** + * Thin wrapper around the format(... AppendableWrapper ...) variant. + * Wraps the destination UnicodeString into an AppendableWrapper and + * supplies default values for some other parameters. + */ + UnicodeString& format(const Formattable* arguments, + const UnicodeString *argumentNames, + int32_t cnt, + UnicodeString& appendTo, + FieldPosition* pos, + UErrorCode& status) const; + + /** + * Formats the arguments and writes the result into the + * AppendableWrapper, updates the field position. + * + * @param msgStart Index to msgPattern part to start formatting from. + * @param plNumber NULL except when formatting a plural argument sub-message + * where a '#' is replaced by the format string for this number. + * @param arguments The formattable objects array. (Must not be NULL.) + * @param argumentNames NULL if numbered values are used. Otherwise the same + * length as "arguments", and each entry is the name of the + * corresponding argument in "arguments". + * @param cnt The length of arguments (and of argumentNames if that is not NULL). + * @param appendTo Output parameter to receive the result. + * The result string is appended to existing contents. + * @param pos Field position status. + * @param success The error code status. + */ + void format(int32_t msgStart, + const void *plNumber, + const Formattable* arguments, + const UnicodeString *argumentNames, + int32_t cnt, + AppendableWrapper& appendTo, + FieldPosition* pos, + UErrorCode& success) const; + + UnicodeString getArgName(int32_t partIndex); + + void setArgStartFormat(int32_t argStart, Format* formatter, UErrorCode& status); + + void setCustomArgStartFormat(int32_t argStart, Format* formatter, UErrorCode& status); + + int32_t nextTopLevelArgStart(int32_t partIndex) const; + + UBool argNameMatches(int32_t partIndex, const UnicodeString& argName, int32_t argNumber); + + void cacheExplicitFormats(UErrorCode& status); + + Format* createAppropriateFormat(UnicodeString& type, + UnicodeString& style, + Formattable::Type& formattableType, + UParseError& parseError, + UErrorCode& ec); + + const Formattable* getArgFromListByName(const Formattable* arguments, + const UnicodeString *argumentNames, + int32_t cnt, UnicodeString& name) const; + + Formattable* parse(int32_t msgStart, + const UnicodeString& source, + ParsePosition& pos, + int32_t& count, + UErrorCode& ec) const; + + FieldPosition* updateMetaData(AppendableWrapper& dest, int32_t prevLength, + FieldPosition* fp, const Formattable* argId) const; + + /** + * Finds the "other" sub-message. + * @param partIndex the index of the first PluralFormat argument style part. + * @return the "other" sub-message start part index. + */ + int32_t findOtherSubMessage(int32_t partIndex) const; + + /** + * Returns the ARG_START index of the first occurrence of the plural number in a sub-message. + * Returns -1 if it is a REPLACE_NUMBER. + * Returns 0 if there is neither. + */ + int32_t findFirstPluralNumberArg(int32_t msgStart, const UnicodeString &argName) const; + + Format* getCachedFormatter(int32_t argumentNumber) const; + + UnicodeString getLiteralStringUntilNextArgument(int32_t from) const; + + void copyObjects(const MessageFormat& that, UErrorCode& ec); + + void formatComplexSubMessage(int32_t msgStart, + const void *plNumber, + const Formattable* arguments, + const UnicodeString *argumentNames, + int32_t cnt, + AppendableWrapper& appendTo, + UErrorCode& success) const; + + /** + * Convenience method that ought to be in NumberFormat + */ + NumberFormat* createIntegerFormat(const Locale& locale, UErrorCode& status) const; + + /** + * Returns array of argument types in the parsed pattern + * for use in C API. Only for the use of umsg_vformat(). Not + * for public consumption. + * @param listCount Output parameter to receive the size of array + * @return The array of formattable types in the pattern + */ + const Formattable::Type* getArgTypeList(int32_t& listCount) const { + listCount = argTypeCount; + return argTypes; + } + + /** + * Resets the internal MessagePattern, and other associated caches. + */ + void resetPattern(); + + /** + * A DummyFormatter that we use solely to store a NULL value. UHash does + * not support storing NULL values. + */ + class U_I18N_API DummyFormat : public Format { + public: + virtual UBool operator==(const Format&) const; + virtual Format* clone() const; + virtual UnicodeString& format(const Formattable& obj, + UnicodeString& appendTo, + UErrorCode& status) const; + virtual UnicodeString& format(const Formattable&, + UnicodeString& appendTo, + FieldPosition&, + UErrorCode& status) const; + virtual UnicodeString& format(const Formattable& obj, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; + virtual void parseObject(const UnicodeString&, + Formattable&, + ParsePosition&) const; + }; + + friend class MessageFormatAdapter; // getFormatTypeList() access +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // _MSGFMT +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/normalizer2.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/normalizer2.h new file mode 100644 index 0000000..8a6d713 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/normalizer2.h @@ -0,0 +1,774 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2009-2013, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: normalizer2.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2009nov22 +* created by: Markus W. Scherer +*/ + +#ifndef __NORMALIZER2_H__ +#define __NORMALIZER2_H__ + +/** + * \file + * \brief C++ API: New API for Unicode Normalization. + */ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_NORMALIZATION + +#include "unicode/stringpiece.h" +#include "unicode/uniset.h" +#include "unicode/unistr.h" +#include "unicode/unorm2.h" + +U_NAMESPACE_BEGIN + +class ByteSink; + +/** + * Unicode normalization functionality for standard Unicode normalization or + * for using custom mapping tables. + * All instances of this class are unmodifiable/immutable. + * Instances returned by getInstance() are singletons that must not be deleted by the caller. + * The Normalizer2 class is not intended for public subclassing. + * + * The primary functions are to produce a normalized string and to detect whether + * a string is already normalized. + * The most commonly used normalization forms are those defined in + * http://www.unicode.org/unicode/reports/tr15/ + * However, this API supports additional normalization forms for specialized purposes. + * For example, NFKC_Casefold is provided via getInstance("nfkc_cf", COMPOSE) + * and can be used in implementations of UTS #46. + * + * Not only are the standard compose and decompose modes supplied, + * but additional modes are provided as documented in the Mode enum. + * + * Some of the functions in this class identify normalization boundaries. + * At a normalization boundary, the portions of the string + * before it and starting from it do not interact and can be handled independently. + * + * The spanQuickCheckYes() stops at a normalization boundary. + * When the goal is a normalized string, then the text before the boundary + * can be copied, and the remainder can be processed with normalizeSecondAndAppend(). + * + * The hasBoundaryBefore(), hasBoundaryAfter() and isInert() functions test whether + * a character is guaranteed to be at a normalization boundary, + * regardless of context. + * This is used for moving from one normalization boundary to the next + * or preceding boundary, and for performing iterative normalization. + * + * Iterative normalization is useful when only a small portion of a + * longer string needs to be processed. + * For example, in ICU, iterative normalization is used by the NormalizationTransliterator + * (to avoid replacing already-normalized text) and ucol_nextSortKeyPart() + * (to process only the substring for which sort key bytes are computed). + * + * The set of normalization boundaries returned by these functions may not be + * complete: There may be more boundaries that could be returned. + * Different functions may return different boundaries. + * @stable ICU 4.4 + */ +class U_COMMON_API Normalizer2 : public UObject { +public: + /** + * Destructor. + * @stable ICU 4.4 + */ + ~Normalizer2(); + + /** + * Returns a Normalizer2 instance for Unicode NFC normalization. + * Same as getInstance(NULL, "nfc", UNORM2_COMPOSE, errorCode). + * Returns an unmodifiable singleton instance. Do not delete it. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested Normalizer2, if successful + * @stable ICU 49 + */ + static const Normalizer2 * + getNFCInstance(UErrorCode &errorCode); + + /** + * Returns a Normalizer2 instance for Unicode NFD normalization. + * Same as getInstance(NULL, "nfc", UNORM2_DECOMPOSE, errorCode). + * Returns an unmodifiable singleton instance. Do not delete it. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested Normalizer2, if successful + * @stable ICU 49 + */ + static const Normalizer2 * + getNFDInstance(UErrorCode &errorCode); + + /** + * Returns a Normalizer2 instance for Unicode NFKC normalization. + * Same as getInstance(NULL, "nfkc", UNORM2_COMPOSE, errorCode). + * Returns an unmodifiable singleton instance. Do not delete it. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested Normalizer2, if successful + * @stable ICU 49 + */ + static const Normalizer2 * + getNFKCInstance(UErrorCode &errorCode); + + /** + * Returns a Normalizer2 instance for Unicode NFKD normalization. + * Same as getInstance(NULL, "nfkc", UNORM2_DECOMPOSE, errorCode). + * Returns an unmodifiable singleton instance. Do not delete it. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested Normalizer2, if successful + * @stable ICU 49 + */ + static const Normalizer2 * + getNFKDInstance(UErrorCode &errorCode); + + /** + * Returns a Normalizer2 instance for Unicode NFKC_Casefold normalization. + * Same as getInstance(NULL, "nfkc_cf", UNORM2_COMPOSE, errorCode). + * Returns an unmodifiable singleton instance. Do not delete it. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested Normalizer2, if successful + * @stable ICU 49 + */ + static const Normalizer2 * + getNFKCCasefoldInstance(UErrorCode &errorCode); + + /** + * Returns a Normalizer2 instance which uses the specified data file + * (packageName/name similar to ucnv_openPackage() and ures_open()/ResourceBundle) + * and which composes or decomposes text according to the specified mode. + * Returns an unmodifiable singleton instance. Do not delete it. + * + * Use packageName=NULL for data files that are part of ICU's own data. + * Use name="nfc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFC/NFD. + * Use name="nfkc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFKC/NFKD. + * Use name="nfkc_cf" and UNORM2_COMPOSE for Unicode standard NFKC_CF=NFKC_Casefold. + * + * @param packageName NULL for ICU built-in data, otherwise application data package name + * @param name "nfc" or "nfkc" or "nfkc_cf" or name of custom data file + * @param mode normalization mode (compose or decompose etc.) + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested Normalizer2, if successful + * @stable ICU 4.4 + */ + static const Normalizer2 * + getInstance(const char *packageName, + const char *name, + UNormalization2Mode mode, + UErrorCode &errorCode); + + /** + * Returns the normalized form of the source string. + * @param src source string + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return normalized src + * @stable ICU 4.4 + */ + UnicodeString + normalize(const UnicodeString &src, UErrorCode &errorCode) const { + UnicodeString result; + normalize(src, result, errorCode); + return result; + } + /** + * Writes the normalized form of the source string to the destination string + * (replacing its contents) and returns the destination string. + * The source and destination strings must be different objects. + * @param src source string + * @param dest destination string; its contents is replaced with normalized src + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return dest + * @stable ICU 4.4 + */ + virtual UnicodeString & + normalize(const UnicodeString &src, + UnicodeString &dest, + UErrorCode &errorCode) const = 0; + + /** + * Normalizes a UTF-8 string and optionally records how source substrings + * relate to changed and unchanged result substrings. + * + * Currently implemented completely only for "compose" modes, + * such as for NFC, NFKC, and NFKC_Casefold + * (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS). + * Otherwise currently converts to & from UTF-16 and does not support edits. + * + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src Source UTF-8 string. + * @param sink A ByteSink to which the normalized UTF-8 result string is written. + * sink.Flush() is called at the end. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be nullptr. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @draft ICU 60 + */ + virtual void + normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink, + Edits *edits, UErrorCode &errorCode) const; + + /** + * Appends the normalized form of the second string to the first string + * (merging them at the boundary) and returns the first string. + * The result is normalized if the first string was normalized. + * The first and second strings must be different objects. + * @param first string, should be normalized + * @param second string, will be normalized + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return first + * @stable ICU 4.4 + */ + virtual UnicodeString & + normalizeSecondAndAppend(UnicodeString &first, + const UnicodeString &second, + UErrorCode &errorCode) const = 0; + /** + * Appends the second string to the first string + * (merging them at the boundary) and returns the first string. + * The result is normalized if both the strings were normalized. + * The first and second strings must be different objects. + * @param first string, should be normalized + * @param second string, should be normalized + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return first + * @stable ICU 4.4 + */ + virtual UnicodeString & + append(UnicodeString &first, + const UnicodeString &second, + UErrorCode &errorCode) const = 0; + + /** + * Gets the decomposition mapping of c. + * Roughly equivalent to normalizing the String form of c + * on a UNORM2_DECOMPOSE Normalizer2 instance, but much faster, and except that this function + * returns FALSE and does not write a string + * if c does not have a decomposition mapping in this instance's data. + * This function is independent of the mode of the Normalizer2. + * @param c code point + * @param decomposition String object which will be set to c's + * decomposition mapping, if there is one. + * @return TRUE if c has a decomposition, otherwise FALSE + * @stable ICU 4.6 + */ + virtual UBool + getDecomposition(UChar32 c, UnicodeString &decomposition) const = 0; + + /** + * Gets the raw decomposition mapping of c. + * + * This is similar to the getDecomposition() method but returns the + * raw decomposition mapping as specified in UnicodeData.txt or + * (for custom data) in the mapping files processed by the gennorm2 tool. + * By contrast, getDecomposition() returns the processed, + * recursively-decomposed version of this mapping. + * + * When used on a standard NFKC Normalizer2 instance, + * getRawDecomposition() returns the Unicode Decomposition_Mapping (dm) property. + * + * When used on a standard NFC Normalizer2 instance, + * it returns the Decomposition_Mapping only if the Decomposition_Type (dt) is Canonical (Can); + * in this case, the result contains either one or two code points (=1..4 char16_ts). + * + * This function is independent of the mode of the Normalizer2. + * The default implementation returns FALSE. + * @param c code point + * @param decomposition String object which will be set to c's + * raw decomposition mapping, if there is one. + * @return TRUE if c has a decomposition, otherwise FALSE + * @stable ICU 49 + */ + virtual UBool + getRawDecomposition(UChar32 c, UnicodeString &decomposition) const; + + /** + * Performs pairwise composition of a & b and returns the composite if there is one. + * + * Returns a composite code point c only if c has a two-way mapping to a+b. + * In standard Unicode normalization, this means that + * c has a canonical decomposition to a+b + * and c does not have the Full_Composition_Exclusion property. + * + * This function is independent of the mode of the Normalizer2. + * The default implementation returns a negative value. + * @param a A (normalization starter) code point. + * @param b Another code point. + * @return The non-negative composite code point if there is one; otherwise a negative value. + * @stable ICU 49 + */ + virtual UChar32 + composePair(UChar32 a, UChar32 b) const; + + /** + * Gets the combining class of c. + * The default implementation returns 0 + * but all standard implementations return the Unicode Canonical_Combining_Class value. + * @param c code point + * @return c's combining class + * @stable ICU 49 + */ + virtual uint8_t + getCombiningClass(UChar32 c) const; + + /** + * Tests if the string is normalized. + * Internally, in cases where the quickCheck() method would return "maybe" + * (which is only possible for the two COMPOSE modes) this method + * resolves to "yes" or "no" to provide a definitive result, + * at the cost of doing more work in those cases. + * @param s input string + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return TRUE if s is normalized + * @stable ICU 4.4 + */ + virtual UBool + isNormalized(const UnicodeString &s, UErrorCode &errorCode) const = 0; + /** + * Tests if the UTF-8 string is normalized. + * Internally, in cases where the quickCheck() method would return "maybe" + * (which is only possible for the two COMPOSE modes) this method + * resolves to "yes" or "no" to provide a definitive result, + * at the cost of doing more work in those cases. + * + * This works for all normalization modes, + * but it is currently optimized for UTF-8 only for "compose" modes, + * such as for NFC, NFKC, and NFKC_Casefold + * (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS). + * For other modes it currently converts to UTF-16 and calls isNormalized(). + * + * @param s UTF-8 input string + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return TRUE if s is normalized + * @draft ICU 60 + */ + virtual UBool + isNormalizedUTF8(StringPiece s, UErrorCode &errorCode) const; + + + /** + * Tests if the string is normalized. + * For the two COMPOSE modes, the result could be "maybe" in cases that + * would take a little more work to resolve definitively. + * Use spanQuickCheckYes() and normalizeSecondAndAppend() for a faster + * combination of quick check + normalization, to avoid + * re-checking the "yes" prefix. + * @param s input string + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return UNormalizationCheckResult + * @stable ICU 4.4 + */ + virtual UNormalizationCheckResult + quickCheck(const UnicodeString &s, UErrorCode &errorCode) const = 0; + + /** + * Returns the end of the normalized substring of the input string. + * In other words, with end=spanQuickCheckYes(s, ec); + * the substring UnicodeString(s, 0, end) + * will pass the quick check with a "yes" result. + * + * The returned end index is usually one or more characters before the + * "no" or "maybe" character: The end index is at a normalization boundary. + * (See the class documentation for more about normalization boundaries.) + * + * When the goal is a normalized string and most input strings are expected + * to be normalized already, then call this method, + * and if it returns a prefix shorter than the input string, + * copy that prefix and use normalizeSecondAndAppend() for the remainder. + * @param s input string + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return "yes" span end index + * @stable ICU 4.4 + */ + virtual int32_t + spanQuickCheckYes(const UnicodeString &s, UErrorCode &errorCode) const = 0; + + /** + * Tests if the character always has a normalization boundary before it, + * regardless of context. + * If true, then the character does not normalization-interact with + * preceding characters. + * In other words, a string containing this character can be normalized + * by processing portions before this character and starting from this + * character independently. + * This is used for iterative normalization. See the class documentation for details. + * @param c character to test + * @return TRUE if c has a normalization boundary before it + * @stable ICU 4.4 + */ + virtual UBool hasBoundaryBefore(UChar32 c) const = 0; + + /** + * Tests if the character always has a normalization boundary after it, + * regardless of context. + * If true, then the character does not normalization-interact with + * following characters. + * In other words, a string containing this character can be normalized + * by processing portions up to this character and after this + * character independently. + * This is used for iterative normalization. See the class documentation for details. + * Note that this operation may be significantly slower than hasBoundaryBefore(). + * @param c character to test + * @return TRUE if c has a normalization boundary after it + * @stable ICU 4.4 + */ + virtual UBool hasBoundaryAfter(UChar32 c) const = 0; + + /** + * Tests if the character is normalization-inert. + * If true, then the character does not change, nor normalization-interact with + * preceding or following characters. + * In other words, a string containing this character can be normalized + * by processing portions before this character and after this + * character independently. + * This is used for iterative normalization. See the class documentation for details. + * Note that this operation may be significantly slower than hasBoundaryBefore(). + * @param c character to test + * @return TRUE if c is normalization-inert + * @stable ICU 4.4 + */ + virtual UBool isInert(UChar32 c) const = 0; +}; + +/** + * Normalization filtered by a UnicodeSet. + * Normalizes portions of the text contained in the filter set and leaves + * portions not contained in the filter set unchanged. + * Filtering is done via UnicodeSet::span(..., USET_SPAN_SIMPLE). + * Not-in-the-filter text is treated as "is normalized" and "quick check yes". + * This class implements all of (and only) the Normalizer2 API. + * An instance of this class is unmodifiable/immutable but is constructed and + * must be destructed by the owner. + * @stable ICU 4.4 + */ +class U_COMMON_API FilteredNormalizer2 : public Normalizer2 { +public: + /** + * Constructs a filtered normalizer wrapping any Normalizer2 instance + * and a filter set. + * Both are aliased and must not be modified or deleted while this object + * is used. + * The filter set should be frozen; otherwise the performance will suffer greatly. + * @param n2 wrapped Normalizer2 instance + * @param filterSet UnicodeSet which determines the characters to be normalized + * @stable ICU 4.4 + */ + FilteredNormalizer2(const Normalizer2 &n2, const UnicodeSet &filterSet) : + norm2(n2), set(filterSet) {} + + /** + * Destructor. + * @stable ICU 4.4 + */ + ~FilteredNormalizer2(); + + /** + * Writes the normalized form of the source string to the destination string + * (replacing its contents) and returns the destination string. + * The source and destination strings must be different objects. + * @param src source string + * @param dest destination string; its contents is replaced with normalized src + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return dest + * @stable ICU 4.4 + */ + virtual UnicodeString & + normalize(const UnicodeString &src, + UnicodeString &dest, + UErrorCode &errorCode) const U_OVERRIDE; + + /** + * Normalizes a UTF-8 string and optionally records how source substrings + * relate to changed and unchanged result substrings. + * + * Currently implemented completely only for "compose" modes, + * such as for NFC, NFKC, and NFKC_Casefold + * (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS). + * Otherwise currently converts to & from UTF-16 and does not support edits. + * + * @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET. + * @param src Source UTF-8 string. + * @param sink A ByteSink to which the normalized UTF-8 result string is written. + * sink.Flush() is called at the end. + * @param edits Records edits for index mapping, working with styled text, + * and getting only changes (if any). + * The Edits contents is undefined if any error occurs. + * This function calls edits->reset() first unless + * options includes U_EDITS_NO_RESET. edits can be nullptr. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @draft ICU 60 + */ + virtual void + normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink, + Edits *edits, UErrorCode &errorCode) const U_OVERRIDE; + + /** + * Appends the normalized form of the second string to the first string + * (merging them at the boundary) and returns the first string. + * The result is normalized if the first string was normalized. + * The first and second strings must be different objects. + * @param first string, should be normalized + * @param second string, will be normalized + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return first + * @stable ICU 4.4 + */ + virtual UnicodeString & + normalizeSecondAndAppend(UnicodeString &first, + const UnicodeString &second, + UErrorCode &errorCode) const U_OVERRIDE; + /** + * Appends the second string to the first string + * (merging them at the boundary) and returns the first string. + * The result is normalized if both the strings were normalized. + * The first and second strings must be different objects. + * @param first string, should be normalized + * @param second string, should be normalized + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return first + * @stable ICU 4.4 + */ + virtual UnicodeString & + append(UnicodeString &first, + const UnicodeString &second, + UErrorCode &errorCode) const U_OVERRIDE; + + /** + * Gets the decomposition mapping of c. + * For details see the base class documentation. + * + * This function is independent of the mode of the Normalizer2. + * @param c code point + * @param decomposition String object which will be set to c's + * decomposition mapping, if there is one. + * @return TRUE if c has a decomposition, otherwise FALSE + * @stable ICU 4.6 + */ + virtual UBool + getDecomposition(UChar32 c, UnicodeString &decomposition) const U_OVERRIDE; + + /** + * Gets the raw decomposition mapping of c. + * For details see the base class documentation. + * + * This function is independent of the mode of the Normalizer2. + * @param c code point + * @param decomposition String object which will be set to c's + * raw decomposition mapping, if there is one. + * @return TRUE if c has a decomposition, otherwise FALSE + * @stable ICU 49 + */ + virtual UBool + getRawDecomposition(UChar32 c, UnicodeString &decomposition) const U_OVERRIDE; + + /** + * Performs pairwise composition of a & b and returns the composite if there is one. + * For details see the base class documentation. + * + * This function is independent of the mode of the Normalizer2. + * @param a A (normalization starter) code point. + * @param b Another code point. + * @return The non-negative composite code point if there is one; otherwise a negative value. + * @stable ICU 49 + */ + virtual UChar32 + composePair(UChar32 a, UChar32 b) const U_OVERRIDE; + + /** + * Gets the combining class of c. + * The default implementation returns 0 + * but all standard implementations return the Unicode Canonical_Combining_Class value. + * @param c code point + * @return c's combining class + * @stable ICU 49 + */ + virtual uint8_t + getCombiningClass(UChar32 c) const U_OVERRIDE; + + /** + * Tests if the string is normalized. + * For details see the Normalizer2 base class documentation. + * @param s input string + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return TRUE if s is normalized + * @stable ICU 4.4 + */ + virtual UBool + isNormalized(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE; + /** + * Tests if the UTF-8 string is normalized. + * Internally, in cases where the quickCheck() method would return "maybe" + * (which is only possible for the two COMPOSE modes) this method + * resolves to "yes" or "no" to provide a definitive result, + * at the cost of doing more work in those cases. + * + * This works for all normalization modes, + * but it is currently optimized for UTF-8 only for "compose" modes, + * such as for NFC, NFKC, and NFKC_Casefold + * (UNORM2_COMPOSE and UNORM2_COMPOSE_CONTIGUOUS). + * For other modes it currently converts to UTF-16 and calls isNormalized(). + * + * @param s UTF-8 input string + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return TRUE if s is normalized + * @draft ICU 60 + */ + virtual UBool + isNormalizedUTF8(StringPiece s, UErrorCode &errorCode) const U_OVERRIDE; + /** + * Tests if the string is normalized. + * For details see the Normalizer2 base class documentation. + * @param s input string + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return UNormalizationCheckResult + * @stable ICU 4.4 + */ + virtual UNormalizationCheckResult + quickCheck(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE; + /** + * Returns the end of the normalized substring of the input string. + * For details see the Normalizer2 base class documentation. + * @param s input string + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return "yes" span end index + * @stable ICU 4.4 + */ + virtual int32_t + spanQuickCheckYes(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE; + + /** + * Tests if the character always has a normalization boundary before it, + * regardless of context. + * For details see the Normalizer2 base class documentation. + * @param c character to test + * @return TRUE if c has a normalization boundary before it + * @stable ICU 4.4 + */ + virtual UBool hasBoundaryBefore(UChar32 c) const U_OVERRIDE; + + /** + * Tests if the character always has a normalization boundary after it, + * regardless of context. + * For details see the Normalizer2 base class documentation. + * @param c character to test + * @return TRUE if c has a normalization boundary after it + * @stable ICU 4.4 + */ + virtual UBool hasBoundaryAfter(UChar32 c) const U_OVERRIDE; + + /** + * Tests if the character is normalization-inert. + * For details see the Normalizer2 base class documentation. + * @param c character to test + * @return TRUE if c is normalization-inert + * @stable ICU 4.4 + */ + virtual UBool isInert(UChar32 c) const U_OVERRIDE; +private: + UnicodeString & + normalize(const UnicodeString &src, + UnicodeString &dest, + USetSpanCondition spanCondition, + UErrorCode &errorCode) const; + + void + normalizeUTF8(uint32_t options, const char *src, int32_t length, + ByteSink &sink, Edits *edits, + USetSpanCondition spanCondition, + UErrorCode &errorCode) const; + + UnicodeString & + normalizeSecondAndAppend(UnicodeString &first, + const UnicodeString &second, + UBool doNormalize, + UErrorCode &errorCode) const; + + const Normalizer2 &norm2; + const UnicodeSet &set; +}; + +U_NAMESPACE_END + +#endif // !UCONFIG_NO_NORMALIZATION +#endif // __NORMALIZER2_H__ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/normlzr.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/normlzr.h new file mode 100644 index 0000000..0141058 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/normlzr.h @@ -0,0 +1,809 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ******************************************************************** + * COPYRIGHT: + * Copyright (c) 1996-2015, International Business Machines Corporation and + * others. All Rights Reserved. + ******************************************************************** + */ + +#ifndef NORMLZR_H +#define NORMLZR_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Unicode Normalization + */ + +#if !UCONFIG_NO_NORMALIZATION + +#include "unicode/chariter.h" +#include "unicode/normalizer2.h" +#include "unicode/unistr.h" +#include "unicode/unorm.h" +#include "unicode/uobject.h" + +U_NAMESPACE_BEGIN +/** + * Old Unicode normalization API. + * + * This API has been replaced by the Normalizer2 class and is only available + * for backward compatibility. This class simply delegates to the Normalizer2 class. + * There is one exception: The new API does not provide a replacement for Normalizer::compare(). + * + * The Normalizer class supports the standard normalization forms described in + * + * Unicode Standard Annex #15: Unicode Normalization Forms. + * + * The Normalizer class consists of two parts: + * - static functions that normalize strings or test if strings are normalized + * - a Normalizer object is an iterator that takes any kind of text and + * provides iteration over its normalized form + * + * The Normalizer class is not suitable for subclassing. + * + * For basic information about normalization forms and details about the C API + * please see the documentation in unorm.h. + * + * The iterator API with the Normalizer constructors and the non-static functions + * use a CharacterIterator as input. It is possible to pass a string which + * is then internally wrapped in a CharacterIterator. + * The input text is not normalized all at once, but incrementally where needed + * (providing efficient random access). + * This allows to pass in a large text but spend only a small amount of time + * normalizing a small part of that text. + * However, if the entire text is normalized, then the iterator will be + * slower than normalizing the entire text at once and iterating over the result. + * A possible use of the Normalizer iterator is also to report an index into the + * original text that is close to where the normalized characters come from. + * + * Important: The iterator API was cleaned up significantly for ICU 2.0. + * The earlier implementation reported the getIndex() inconsistently, + * and previous() could not be used after setIndex(), next(), first(), and current(). + * + * Normalizer allows to start normalizing from anywhere in the input text by + * calling setIndexOnly(), first(), or last(). + * Without calling any of these, the iterator will start at the beginning of the text. + * + * At any time, next() returns the next normalized code point (UChar32), + * with post-increment semantics (like CharacterIterator::next32PostInc()). + * previous() returns the previous normalized code point (UChar32), + * with pre-decrement semantics (like CharacterIterator::previous32()). + * + * current() returns the current code point + * (respectively the one at the newly set index) without moving + * the getIndex(). Note that if the text at the current position + * needs to be normalized, then these functions will do that. + * (This is why current() is not const.) + * It is more efficient to call setIndexOnly() instead, which does not + * normalize. + * + * getIndex() always refers to the position in the input text where the normalized + * code points are returned from. It does not always change with each returned + * code point. + * The code point that is returned from any of the functions + * corresponds to text at or after getIndex(), according to the + * function's iteration semantics (post-increment or pre-decrement). + * + * next() returns a code point from at or after the getIndex() + * from before the next() call. After the next() call, the getIndex() + * might have moved to where the next code point will be returned from + * (from a next() or current() call). + * This is semantically equivalent to array access with array[index++] + * (post-increment semantics). + * + * previous() returns a code point from at or after the getIndex() + * from after the previous() call. + * This is semantically equivalent to array access with array[--index] + * (pre-decrement semantics). + * + * Internally, the Normalizer iterator normalizes a small piece of text + * starting at the getIndex() and ending at a following "safe" index. + * The normalized results is stored in an internal string buffer, and + * the code points are iterated from there. + * With multiple iteration calls, this is repeated until the next piece + * of text needs to be normalized, and the getIndex() needs to be moved. + * + * The following "safe" index, the internal buffer, and the secondary + * iteration index into that buffer are not exposed on the API. + * This also means that it is currently not practical to return to + * a particular, arbitrary position in the text because one would need to + * know, and be able to set, in addition to the getIndex(), at least also the + * current index into the internal buffer. + * It is currently only possible to observe when getIndex() changes + * (with careful consideration of the iteration semantics), + * at which time the internal index will be 0. + * For example, if getIndex() is different after next() than before it, + * then the internal index is 0 and one can return to this getIndex() + * later with setIndexOnly(). + * + * Note: While the setIndex() and getIndex() refer to indices in the + * underlying Unicode input text, the next() and previous() methods + * iterate through characters in the normalized output. + * This means that there is not necessarily a one-to-one correspondence + * between characters returned by next() and previous() and the indices + * passed to and returned from setIndex() and getIndex(). + * It is for this reason that Normalizer does not implement the CharacterIterator interface. + * + * @author Laura Werner, Mark Davis, Markus Scherer + * @stable ICU 2.0 + */ +class U_COMMON_API Normalizer : public UObject { +public: +#ifndef U_HIDE_DEPRECATED_API + /** + * If DONE is returned from an iteration function that returns a code point, + * then there are no more normalization results available. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + enum { + DONE=0xffff + }; + + // Constructors + + /** + * Creates a new Normalizer object for iterating over the + * normalized form of a given string. + *

+ * @param str The string to be normalized. The normalization + * will start at the beginning of the string. + * + * @param mode The normalization mode. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + Normalizer(const UnicodeString& str, UNormalizationMode mode); + + /** + * Creates a new Normalizer object for iterating over the + * normalized form of a given string. + *

+ * @param str The string to be normalized. The normalization + * will start at the beginning of the string. + * + * @param length Length of the string, or -1 if NUL-terminated. + * @param mode The normalization mode. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + Normalizer(ConstChar16Ptr str, int32_t length, UNormalizationMode mode); + + /** + * Creates a new Normalizer object for iterating over the + * normalized form of the given text. + *

+ * @param iter The input text to be normalized. The normalization + * will start at the beginning of the string. + * + * @param mode The normalization mode. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + Normalizer(const CharacterIterator& iter, UNormalizationMode mode); +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Copy constructor. + * @param copy The object to be copied. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + Normalizer(const Normalizer& copy); + + /** + * Destructor + * @deprecated ICU 56 Use Normalizer2 instead. + */ + virtual ~Normalizer(); + + + //------------------------------------------------------------------------- + // Static utility methods + //------------------------------------------------------------------------- + +#ifndef U_HIDE_DEPRECATED_API + /** + * Normalizes a UnicodeString according to the specified normalization mode. + * This is a wrapper for unorm_normalize(), using UnicodeString's. + * + * The options parameter specifies which optional + * Normalizer features are to be enabled for this operation. + * + * @param source the input string to be normalized. + * @param mode the normalization mode + * @param options the optional features to be enabled (0 for no options) + * @param result The normalized string (on output). + * @param status The error code. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + static void U_EXPORT2 normalize(const UnicodeString& source, + UNormalizationMode mode, int32_t options, + UnicodeString& result, + UErrorCode &status); + + /** + * Compose a UnicodeString. + * This is equivalent to normalize() with mode UNORM_NFC or UNORM_NFKC. + * This is a wrapper for unorm_normalize(), using UnicodeString's. + * + * The options parameter specifies which optional + * Normalizer features are to be enabled for this operation. + * + * @param source the string to be composed. + * @param compat Perform compatibility decomposition before composition. + * If this argument is FALSE, only canonical + * decomposition will be performed. + * @param options the optional features to be enabled (0 for no options) + * @param result The composed string (on output). + * @param status The error code. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + static void U_EXPORT2 compose(const UnicodeString& source, + UBool compat, int32_t options, + UnicodeString& result, + UErrorCode &status); + + /** + * Static method to decompose a UnicodeString. + * This is equivalent to normalize() with mode UNORM_NFD or UNORM_NFKD. + * This is a wrapper for unorm_normalize(), using UnicodeString's. + * + * The options parameter specifies which optional + * Normalizer features are to be enabled for this operation. + * + * @param source the string to be decomposed. + * @param compat Perform compatibility decomposition. + * If this argument is FALSE, only canonical + * decomposition will be performed. + * @param options the optional features to be enabled (0 for no options) + * @param result The decomposed string (on output). + * @param status The error code. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + static void U_EXPORT2 decompose(const UnicodeString& source, + UBool compat, int32_t options, + UnicodeString& result, + UErrorCode &status); + + /** + * Performing quick check on a string, to quickly determine if the string is + * in a particular normalization format. + * This is a wrapper for unorm_quickCheck(), using a UnicodeString. + * + * Three types of result can be returned UNORM_YES, UNORM_NO or + * UNORM_MAYBE. Result UNORM_YES indicates that the argument + * string is in the desired normalized format, UNORM_NO determines that + * argument string is not in the desired normalized format. A + * UNORM_MAYBE result indicates that a more thorough check is required, + * the user may have to put the string in its normalized form and compare the + * results. + * @param source string for determining if it is in a normalized format + * @param mode normalization format + * @param status A reference to a UErrorCode to receive any errors + * @return UNORM_YES, UNORM_NO or UNORM_MAYBE + * + * @see isNormalized + * @deprecated ICU 56 Use Normalizer2 instead. + */ + static inline UNormalizationCheckResult + quickCheck(const UnicodeString &source, UNormalizationMode mode, UErrorCode &status); + + /** + * Performing quick check on a string; same as the other version of quickCheck + * but takes an extra options parameter like most normalization functions. + * + * @param source string for determining if it is in a normalized format + * @param mode normalization format + * @param options the optional features to be enabled (0 for no options) + * @param status A reference to a UErrorCode to receive any errors + * @return UNORM_YES, UNORM_NO or UNORM_MAYBE + * + * @see isNormalized + * @deprecated ICU 56 Use Normalizer2 instead. + */ + static UNormalizationCheckResult + quickCheck(const UnicodeString &source, UNormalizationMode mode, int32_t options, UErrorCode &status); + + /** + * Test if a string is in a given normalization form. + * This is semantically equivalent to source.equals(normalize(source, mode)) . + * + * Unlike unorm_quickCheck(), this function returns a definitive result, + * never a "maybe". + * For NFD, NFKD, and FCD, both functions work exactly the same. + * For NFC and NFKC where quickCheck may return "maybe", this function will + * perform further tests to arrive at a TRUE/FALSE result. + * + * @param src String that is to be tested if it is in a normalization format. + * @param mode Which normalization form to test for. + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return Boolean value indicating whether the source string is in the + * "mode" normalization form. + * + * @see quickCheck + * @deprecated ICU 56 Use Normalizer2 instead. + */ + static inline UBool + isNormalized(const UnicodeString &src, UNormalizationMode mode, UErrorCode &errorCode); + + /** + * Test if a string is in a given normalization form; same as the other version of isNormalized + * but takes an extra options parameter like most normalization functions. + * + * @param src String that is to be tested if it is in a normalization format. + * @param mode Which normalization form to test for. + * @param options the optional features to be enabled (0 for no options) + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return Boolean value indicating whether the source string is in the + * "mode" normalization form. + * + * @see quickCheck + * @deprecated ICU 56 Use Normalizer2 instead. + */ + static UBool + isNormalized(const UnicodeString &src, UNormalizationMode mode, int32_t options, UErrorCode &errorCode); + + /** + * Concatenate normalized strings, making sure that the result is normalized as well. + * + * If both the left and the right strings are in + * the normalization form according to "mode/options", + * then the result will be + * + * \code + * dest=normalize(left+right, mode, options) + * \endcode + * + * For details see unorm_concatenate in unorm.h. + * + * @param left Left source string. + * @param right Right source string. + * @param result The output string. + * @param mode The normalization mode. + * @param options A bit set of normalization options. + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return result + * + * @see unorm_concatenate + * @see normalize + * @see unorm_next + * @see unorm_previous + * + * @deprecated ICU 56 Use Normalizer2 instead. + */ + static UnicodeString & + U_EXPORT2 concatenate(const UnicodeString &left, const UnicodeString &right, + UnicodeString &result, + UNormalizationMode mode, int32_t options, + UErrorCode &errorCode); +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Compare two strings for canonical equivalence. + * Further options include case-insensitive comparison and + * code point order (as opposed to code unit order). + * + * Canonical equivalence between two strings is defined as their normalized + * forms (NFD or NFC) being identical. + * This function compares strings incrementally instead of normalizing + * (and optionally case-folding) both strings entirely, + * improving performance significantly. + * + * Bulk normalization is only necessary if the strings do not fulfill the FCD + * conditions. Only in this case, and only if the strings are relatively long, + * is memory allocated temporarily. + * For FCD strings and short non-FCD strings there is no memory allocation. + * + * Semantically, this is equivalent to + * strcmp[CodePointOrder](NFD(foldCase(s1)), NFD(foldCase(s2))) + * where code point order and foldCase are all optional. + * + * UAX 21 2.5 Caseless Matching specifies that for a canonical caseless match + * the case folding must be performed first, then the normalization. + * + * @param s1 First source string. + * @param s2 Second source string. + * + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Case-sensitive comparison in code unit order, and the input strings + * are quick-checked for FCD. + * + * - UNORM_INPUT_IS_FCD + * Set if the caller knows that both s1 and s2 fulfill the FCD conditions. + * If not set, the function will quickCheck for FCD + * and normalize if necessary. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_COMPARE_IGNORE_CASE + * Set to compare strings case-insensitively using case folding, + * instead of case-sensitively. + * If set, then the following case folding options are used. + * + * - Options as used with case-insensitive comparisons, currently: + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * (see u_strCaseCompare for details) + * + * - regular normalization options shifted left by UNORM_COMPARE_NORM_OPTIONS_SHIFT + * + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return <0 or 0 or >0 as usual for string comparisons + * + * @see unorm_compare + * @see normalize + * @see UNORM_FCD + * @see u_strCompare + * @see u_strCaseCompare + * + * @stable ICU 2.2 + */ + static inline int32_t + compare(const UnicodeString &s1, const UnicodeString &s2, + uint32_t options, + UErrorCode &errorCode); + +#ifndef U_HIDE_DEPRECATED_API + //------------------------------------------------------------------------- + // Iteration API + //------------------------------------------------------------------------- + + /** + * Return the current character in the normalized text. + * current() may need to normalize some text at getIndex(). + * The getIndex() is not changed. + * + * @return the current normalized code point + * @deprecated ICU 56 Use Normalizer2 instead. + */ + UChar32 current(void); + + /** + * Return the first character in the normalized text. + * This is equivalent to setIndexOnly(startIndex()) followed by next(). + * (Post-increment semantics.) + * + * @return the first normalized code point + * @deprecated ICU 56 Use Normalizer2 instead. + */ + UChar32 first(void); + + /** + * Return the last character in the normalized text. + * This is equivalent to setIndexOnly(endIndex()) followed by previous(). + * (Pre-decrement semantics.) + * + * @return the last normalized code point + * @deprecated ICU 56 Use Normalizer2 instead. + */ + UChar32 last(void); + + /** + * Return the next character in the normalized text. + * (Post-increment semantics.) + * If the end of the text has already been reached, DONE is returned. + * The DONE value could be confused with a U+FFFF non-character code point + * in the text. If this is possible, you can test getIndex()startIndex() || first()!=DONE). (Calling first() will change + * the iterator state!) + * + * The C API unorm_previous() is more efficient and does not have this ambiguity. + * + * @return the previous normalized code point + * @deprecated ICU 56 Use Normalizer2 instead. + */ + UChar32 previous(void); + + /** + * Set the iteration position in the input text that is being normalized, + * without any immediate normalization. + * After setIndexOnly(), getIndex() will return the same index that is + * specified here. + * + * @param index the desired index in the input text. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + void setIndexOnly(int32_t index); + + /** + * Reset the index to the beginning of the text. + * This is equivalent to setIndexOnly(startIndex)). + * @deprecated ICU 56 Use Normalizer2 instead. + */ + void reset(void); + + /** + * Retrieve the current iteration position in the input text that is + * being normalized. + * + * A following call to next() will return a normalized code point from + * the input text at or after this index. + * + * After a call to previous(), getIndex() will point at or before the + * position in the input text where the normalized code point + * was returned from with previous(). + * + * @return the current index in the input text + * @deprecated ICU 56 Use Normalizer2 instead. + */ + int32_t getIndex(void) const; + + /** + * Retrieve the index of the start of the input text. This is the begin index + * of the CharacterIterator or the start (i.e. index 0) of the string + * over which this Normalizer is iterating. + * + * @return the smallest index in the input text where the Normalizer operates + * @deprecated ICU 56 Use Normalizer2 instead. + */ + int32_t startIndex(void) const; + + /** + * Retrieve the index of the end of the input text. This is the end index + * of the CharacterIterator or the length of the string + * over which this Normalizer is iterating. + * This end index is exclusive, i.e., the Normalizer operates only on characters + * before this index. + * + * @return the first index in the input text where the Normalizer does not operate + * @deprecated ICU 56 Use Normalizer2 instead. + */ + int32_t endIndex(void) const; + + /** + * Returns TRUE when both iterators refer to the same character in the same + * input text. + * + * @param that a Normalizer object to compare this one to + * @return comparison result + * @deprecated ICU 56 Use Normalizer2 instead. + */ + UBool operator==(const Normalizer& that) const; + + /** + * Returns FALSE when both iterators refer to the same character in the same + * input text. + * + * @param that a Normalizer object to compare this one to + * @return comparison result + * @deprecated ICU 56 Use Normalizer2 instead. + */ + inline UBool operator!=(const Normalizer& that) const; + + /** + * Returns a pointer to a new Normalizer that is a clone of this one. + * The caller is responsible for deleting the new clone. + * @return a pointer to a new Normalizer + * @deprecated ICU 56 Use Normalizer2 instead. + */ + Normalizer* clone(void) const; + + /** + * Generates a hash code for this iterator. + * + * @return the hash code + * @deprecated ICU 56 Use Normalizer2 instead. + */ + int32_t hashCode(void) const; + + //------------------------------------------------------------------------- + // Property access methods + //------------------------------------------------------------------------- + + /** + * Set the normalization mode for this object. + *

+ * Note:If the normalization mode is changed while iterating + * over a string, calls to {@link #next() } and {@link #previous() } may + * return previously buffers characters in the old normalization mode + * until the iteration is able to re-sync at the next base character. + * It is safest to call {@link #setIndexOnly }, {@link #reset() }, + * {@link #setText }, {@link #first() }, + * {@link #last() }, etc. after calling setMode. + *

+ * @param newMode the new mode for this Normalizer. + * @see #getUMode + * @deprecated ICU 56 Use Normalizer2 instead. + */ + void setMode(UNormalizationMode newMode); + + /** + * Return the normalization mode for this object. + * + * This is an unusual name because there used to be a getMode() that + * returned a different type. + * + * @return the mode for this Normalizer + * @see #setMode + * @deprecated ICU 56 Use Normalizer2 instead. + */ + UNormalizationMode getUMode(void) const; + + /** + * Set options that affect this Normalizer's operation. + * Options do not change the basic composition or decomposition operation + * that is being performed, but they control whether + * certain optional portions of the operation are done. + * Currently the only available option is obsolete. + * + * It is possible to specify multiple options that are all turned on or off. + * + * @param option the option(s) whose value is/are to be set. + * @param value the new setting for the option. Use TRUE to + * turn the option(s) on and FALSE to turn it/them off. + * + * @see #getOption + * @deprecated ICU 56 Use Normalizer2 instead. + */ + void setOption(int32_t option, + UBool value); + + /** + * Determine whether an option is turned on or off. + * If multiple options are specified, then the result is TRUE if any + * of them are set. + *

+ * @param option the option(s) that are to be checked + * @return TRUE if any of the option(s) are set + * @see #setOption + * @deprecated ICU 56 Use Normalizer2 instead. + */ + UBool getOption(int32_t option) const; + + /** + * Set the input text over which this Normalizer will iterate. + * The iteration position is set to the beginning. + * + * @param newText a string that replaces the current input text + * @param status a UErrorCode + * @deprecated ICU 56 Use Normalizer2 instead. + */ + void setText(const UnicodeString& newText, + UErrorCode &status); + + /** + * Set the input text over which this Normalizer will iterate. + * The iteration position is set to the beginning. + * + * @param newText a CharacterIterator object that replaces the current input text + * @param status a UErrorCode + * @deprecated ICU 56 Use Normalizer2 instead. + */ + void setText(const CharacterIterator& newText, + UErrorCode &status); + + /** + * Set the input text over which this Normalizer will iterate. + * The iteration position is set to the beginning. + * + * @param newText a string that replaces the current input text + * @param length the length of the string, or -1 if NUL-terminated + * @param status a UErrorCode + * @deprecated ICU 56 Use Normalizer2 instead. + */ + void setText(ConstChar16Ptr newText, + int32_t length, + UErrorCode &status); + /** + * Copies the input text into the UnicodeString argument. + * + * @param result Receives a copy of the text under iteration. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + void getText(UnicodeString& result); + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * @returns a UClassID for this class. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + static UClassID U_EXPORT2 getStaticClassID(); +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * @return a UClassID for the actual class. + * @deprecated ICU 56 Use Normalizer2 instead. + */ + virtual UClassID getDynamicClassID() const; + +private: + //------------------------------------------------------------------------- + // Private functions + //------------------------------------------------------------------------- + + Normalizer(); // default constructor not implemented + Normalizer &operator=(const Normalizer &that); // assignment operator not implemented + + // Private utility methods for iteration + // For documentation, see the source code + UBool nextNormalize(); + UBool previousNormalize(); + + void init(); + void clearBuffer(void); + + //------------------------------------------------------------------------- + // Private data + //------------------------------------------------------------------------- + + FilteredNormalizer2*fFilteredNorm2; // owned if not NULL + const Normalizer2 *fNorm2; // not owned; may be equal to fFilteredNorm2 + UNormalizationMode fUMode; // deprecated + int32_t fOptions; + + // The input text and our position in it + CharacterIterator *text; + + // The normalization buffer is the result of normalization + // of the source in [currentIndex..nextIndex[ . + int32_t currentIndex, nextIndex; + + // A buffer for holding intermediate results + UnicodeString buffer; + int32_t bufferPos; +}; + +//------------------------------------------------------------------------- +// Inline implementations +//------------------------------------------------------------------------- + +#ifndef U_HIDE_DEPRECATED_API +inline UBool +Normalizer::operator!= (const Normalizer& other) const +{ return ! operator==(other); } + +inline UNormalizationCheckResult +Normalizer::quickCheck(const UnicodeString& source, + UNormalizationMode mode, + UErrorCode &status) { + return quickCheck(source, mode, 0, status); +} + +inline UBool +Normalizer::isNormalized(const UnicodeString& source, + UNormalizationMode mode, + UErrorCode &status) { + return isNormalized(source, mode, 0, status); +} +#endif /* U_HIDE_DEPRECATED_API */ + +inline int32_t +Normalizer::compare(const UnicodeString &s1, const UnicodeString &s2, + uint32_t options, + UErrorCode &errorCode) { + // all argument checking is done in unorm_compare + return unorm_compare(toUCharPtr(s1.getBuffer()), s1.length(), + toUCharPtr(s2.getBuffer()), s2.length(), + options, + &errorCode); +} + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_NORMALIZATION */ + +#endif // NORMLZR_H diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/nounit.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/nounit.h new file mode 100644 index 0000000..04fc84b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/nounit.h @@ -0,0 +1,111 @@ +// © 2017 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ******************************************************************************* + * Copyright (C) 2009-2017, International Business Machines Corporation, * + * Google, and others. All Rights Reserved. * + ******************************************************************************* + */ + +#ifndef __NOUNIT_H__ +#define __NOUNIT_H__ + + +/** + * \file + * \brief C++ API: units for percent and permille + */ + + +#include "unicode/measunit.h" + +#if !UCONFIG_NO_FORMATTING + +U_NAMESPACE_BEGIN + +#ifndef U_HIDE_DRAFT_API +/** + * Dimensionless unit for percent and permille. + * @see NumberFormatter + * @draft ICU 60 + */ +class U_I18N_API NoUnit: public MeasureUnit { +public: + /** + * Returns an instance for the base unit (dimensionless and no scaling). + * + * @return a NoUnit instance + * @draft ICU 60 + */ + static NoUnit U_EXPORT2 base(); + + /** + * Returns an instance for percent, or 1/100 of a base unit. + * + * @return a NoUnit instance + * @draft ICU 60 + */ + static NoUnit U_EXPORT2 percent(); + + /** + * Returns an instance for permille, or 1/1000 of a base unit. + * + * @return a NoUnit instance + * @draft ICU 60 + */ + static NoUnit U_EXPORT2 permille(); + + /** + * Copy operator. + * @draft ICU 60 + */ + NoUnit(const NoUnit& other); + + /** + * Return a polymorphic clone of this object. The result will + * have the same class as returned by getDynamicClassID(). + * @draft ICU 60 + */ + virtual UObject* clone() const; + + /** + * Returns a unique class ID for this object POLYMORPHICALLY. + * This method implements a simple form of RTTI used by ICU. + * @return The class ID for this object. All objects of a given + * class have the same class ID. Objects of other classes have + * different class IDs. + * @draft ICU 60 + */ + virtual UClassID getDynamicClassID() const; + + /** + * Returns the class ID for this class. This is used to compare to + * the return value of getDynamicClassID(). + * @return The class ID for all objects of this class. + * @draft ICU 60 + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * Destructor. + * @draft ICU 60 + */ + virtual ~NoUnit(); + +private: + /** + * Constructor + * @internal (private) + */ + NoUnit(const char* subtype); + +}; +#endif /* U_HIDE_DRAFT_API */ + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // __NOUNIT_H__ +//eof +// diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/numberformatter.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/numberformatter.h new file mode 100644 index 0000000..4a11c2f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/numberformatter.h @@ -0,0 +1,1998 @@ +// © 2017 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING +#ifndef __NUMBERFORMATTER_H__ +#define __NUMBERFORMATTER_H__ + +#include "unicode/appendable.h" +#include "unicode/dcfmtsym.h" +#include "unicode/currunit.h" +#include "unicode/fieldpos.h" +#include "unicode/fpositer.h" +#include "unicode/measunit.h" +#include "unicode/nounit.h" +#include "unicode/plurrule.h" +#include "unicode/ucurr.h" +#include "unicode/unum.h" + +#ifndef U_HIDE_DRAFT_API + +/** + * \file + * \brief C++ API: Library for localized number formatting introduced in ICU 60. + * + * This library was introduced in ICU 60 to simplify the process of formatting localized number strings. + * Basic usage examples: + * + *

+ * // Most basic usage:
+ * NumberFormatter::withLocale(...).format(123).toString();  // 1,234 in en-US
+ *
+ * // Custom notation, unit, and rounding strategy:
+ * NumberFormatter::with()
+ *     .notation(Notation::compactShort())
+ *     .unit(CurrencyUnit("EUR", status))
+ *     .rounding(Rounder::maxDigits(2))
+ *     .locale(...)
+ *     .format(1234)
+ *     .toString();  // €1.2K in en-US
+ *
+ * // Create a formatter in a singleton for use later:
+ * static const LocalizedNumberFormatter formatter = NumberFormatter::withLocale(...)
+ *     .unit(NoUnit::percent())
+ *     .rounding(Rounder::fixedFraction(3));
+ * formatter.format(5.9831).toString();  // 5.983% in en-US
+ *
+ * // Create a "template" in a singleton but without setting a locale until the call site:
+ * static const UnlocalizedNumberFormatter template = NumberFormatter::with()
+ *     .sign(UNumberSignDisplay::UNUM_SIGN_ALWAYS)
+ *     .adoptUnit(MeasureUnit::createMeter(status))
+ *     .unitWidth(UNumberUnitWidth::UNUM_UNIT_WIDTH_FULL_NAME);
+ * template.locale(...).format(1234).toString();  // +1,234 meters in en-US
+ * 
+ * + *

+ * This API offers more features than DecimalFormat and is geared toward new users of ICU. + * + *

+ * NumberFormatter instances are immutable and thread safe. This means that invoking a configuration method has no + * effect on the receiving instance; you must store and use the new number formatter instance it returns instead. + * + *

+ * UnlocalizedNumberFormatter formatter = UnlocalizedNumberFormatter::with().notation(Notation::scientific());
+ * formatter.rounding(Rounder.maxFraction(2)); // does nothing!
+ * formatter.locale(Locale.getEnglish()).format(9.8765).toString(); // prints "9.8765E0", not "9.88E0"
+ * 
+ * + *

+ * This API is based on the fluent design pattern popularized by libraries such as Google's Guava. For + * extensive details on the design of this API, read the design doc. + * + * @author Shane Carr + */ + +/** + * An enum declaring how to render units, including currencies. Example outputs when formatting 123 USD and 123 + * meters in en-CA: + * + *

+ *

    + *
  • NARROW*: "$123.00" and "123 m" + *
  • SHORT: "US$ 123.00" and "123 m" + *
  • FULL_NAME: "123.00 US dollars" and "123 meters" + *
  • ISO_CODE: "USD 123.00" and undefined behavior + *
  • HIDDEN: "123.00" and "123" + *
+ * + *

+ * * The narrow format for currencies is not currently supported; this is a known issue that will be fixed in a + * future version. See #11666 for more information. + * + *

+ * This enum is similar to {@link com.ibm.icu.text.MeasureFormat.FormatWidth}. + * + * @draft ICU 60 + */ +typedef enum UNumberUnitWidth { + /** + * Print an abbreviated version of the unit name. Similar to SHORT, but always use the shortest available + * abbreviation or symbol. This option can be used when the context hints at the identity of the unit. For more + * information on the difference between NARROW and SHORT, see SHORT. + * + *

+ * In CLDR, this option corresponds to the "Narrow" format for measure units and the "¤¤¤¤¤" placeholder for + * currencies. + * + * @draft ICU 60 + */ + UNUM_UNIT_WIDTH_NARROW, + + /** + * Print an abbreviated version of the unit name. Similar to NARROW, but use a slightly wider abbreviation or + * symbol when there may be ambiguity. This is the default behavior. + * + *

+ * For example, in es-US, the SHORT form for Fahrenheit is "{0} °F", but the NARROW form is "{0}°", + * since Fahrenheit is the customary unit for temperature in that locale. + * + *

+ * In CLDR, this option corresponds to the "Short" format for measure units and the "¤" placeholder for + * currencies. + * + * @draft ICU 60 + */ + UNUM_UNIT_WIDTH_SHORT, + + /** + * Print the full name of the unit, without any abbreviations. + * + *

+ * In CLDR, this option corresponds to the default format for measure units and the "¤¤¤" placeholder for + * currencies. + * + * @draft ICU 60 + */ + UNUM_UNIT_WIDTH_FULL_NAME, + + /** + * Use the three-digit ISO XXX code in place of the symbol for displaying currencies. The behavior of this + * option is currently undefined for use with measure units. + * + *

+ * In CLDR, this option corresponds to the "¤¤" placeholder for currencies. + * + * @draft ICU 60 + */ + UNUM_UNIT_WIDTH_ISO_CODE, + + /** + * Format the number according to the specified unit, but do not display the unit. For currencies, apply + * monetary symbols and formats as with SHORT, but omit the currency symbol. For measure units, the behavior is + * equivalent to not specifying the unit at all. + * + * @draft ICU 60 + */ + UNUM_UNIT_WIDTH_HIDDEN, + + /** + * One more than the highest UNumberUnitWidth value. + * + * @internal ICU 60: The numeric value may change over time; see ICU ticket #12420. + */ + UNUM_UNIT_WIDTH_COUNT +} UNumberUnitWidth; + +/** + * An enum declaring how to denote positive and negative numbers. Example outputs when formatting 123 and -123 in + * en-US: + * + *

+ *

    + *
  • AUTO: "123", "-123" + *
  • ALWAYS: "+123", "-123" + *
  • NEVER: "123", "123" + *
  • ACCOUNTING: "$123", "($123)" + *
  • ACCOUNTING_ALWAYS: "+$123", "($123)" + *
+ * + *

+ * The exact format, including the position and the code point of the sign, differ by locale. + * + * @draft ICU 60 + */ +typedef enum UNumberSignDisplay { + /** + * Show the minus sign on negative numbers, and do not show the sign on positive numbers. This is the default + * behavior. + * + * @draft ICU 60 + */ + UNUM_SIGN_AUTO, + + /** + * Show the minus sign on negative numbers and the plus sign on positive numbers. + * + * @draft ICU 60 + */ + UNUM_SIGN_ALWAYS, + + /** + * Do not show the sign on positive or negative numbers. + * + * @draft ICU 60 + */ + UNUM_SIGN_NEVER, + + /** + * Use the locale-dependent accounting format on negative numbers, and do not show the sign on positive numbers. + * + *

+ * The accounting format is defined in CLDR and varies by locale; in many Western locales, the format is a pair + * of parentheses around the number. + * + *

+ * Note: Since CLDR defines the accounting format in the monetary context only, this option falls back to the + * AUTO sign display strategy when formatting without a currency unit. This limitation may be lifted in the + * future. + * + * @draft ICU 60 + */ + UNUM_SIGN_ACCOUNTING, + + /** + * Use the locale-dependent accounting format on negative numbers, and show the plus sign on positive numbers. + * For more information on the accounting format, see the ACCOUNTING sign display strategy. + * + * @draft ICU 60 + */ + UNUM_SIGN_ACCOUNTING_ALWAYS, + + /** + * One more than the highest UNumberSignDisplay value. + * + * @internal ICU 60: The numeric value may change over time; see ICU ticket #12420. + */ + UNUM_SIGN_COUNT +} UNumberSignDisplay; + +/** + * An enum declaring how to render the decimal separator. + * + *

+ *

    + *
  • UNUM_DECIMAL_SEPARATOR_AUTO: "1", "1.1" + *
  • UNUM_DECIMAL_SEPARATOR_ALWAYS: "1.", "1.1" + *
+ */ +typedef enum UNumberDecimalSeparatorDisplay { + /** + * Show the decimal separator when there are one or more digits to display after the separator, and do not show + * it otherwise. This is the default behavior. + * + * @draft ICU 60 + */ + UNUM_DECIMAL_SEPARATOR_AUTO, + + /** + * Always show the decimal separator, even if there are no digits to display after the separator. + * + * @draft ICU 60 + */ + UNUM_DECIMAL_SEPARATOR_ALWAYS, + + /** + * One more than the highest UNumberDecimalSeparatorDisplay value. + * + * @internal ICU 60: The numeric value may change over time; see ICU ticket #12420. + */ + UNUM_DECIMAL_SEPARATOR_COUNT +} UNumberDecimalMarkDisplay; + +U_NAMESPACE_BEGIN namespace number { // icu::number + +// Forward declarations: +class UnlocalizedNumberFormatter; +class LocalizedNumberFormatter; +class FormattedNumber; +class Notation; +class ScientificNotation; +class Rounder; +class FractionRounder; +class CurrencyRounder; +class IncrementRounder; +class Grouper; +class IntegerWidth; + +namespace impl { + +// Forward declarations: +class Padder; +struct MacroProps; +struct MicroProps; +class DecimalQuantity; +struct NumberFormatterResults; +class NumberFormatterImpl; +struct ParsedPatternInfo; +class ScientificModifier; +class MultiplierProducer; +class MutablePatternModifier; +class LongNameHandler; +class ScientificHandler; +class CompactHandler; +class Modifier; +class NumberStringBuilder; + +} // namespace impl + +// Reserve extra names in case they are added as classes in the future: +typedef Notation CompactNotation; +typedef Notation SimpleNotation; + +/** + * A class that defines the notation style to be used when formatting numbers in NumberFormatter. + * + * @draft ICU 60 + */ +class U_I18N_API Notation : public UMemory { + public: + /** + * Print the number using scientific notation (also known as scientific form, standard index form, or standard form + * in the UK). The format for scientific notation varies by locale; for example, many Western locales display the + * number in the form "#E0", where the number is displayed with one digit before the decimal separator, zero or more + * digits after the decimal separator, and the corresponding power of 10 displayed after the "E". + * + *

+ * Example outputs in en-US when printing 8.765E4 through 8.765E-3: + * + *

+     * 8.765E4
+     * 8.765E3
+     * 8.765E2
+     * 8.765E1
+     * 8.765E0
+     * 8.765E-1
+     * 8.765E-2
+     * 8.765E-3
+     * 0E0
+     * 
+ * + * @return A ScientificNotation for chaining or passing to the NumberFormatter notation() setter. + * @draft ICU 60 + */ + static ScientificNotation scientific(); + + /** + * Print the number using engineering notation, a variant of scientific notation in which the exponent must be + * divisible by 3. + * + *

+ * Example outputs in en-US when printing 8.765E4 through 8.765E-3: + * + *

+     * 87.65E3
+     * 8.765E3
+     * 876.5E0
+     * 87.65E0
+     * 8.765E0
+     * 876.5E-3
+     * 87.65E-3
+     * 8.765E-3
+     * 0E0
+     * 
+ * + * @return A ScientificNotation for chaining or passing to the NumberFormatter notation() setter. + * @draft ICU 60 + */ + static ScientificNotation engineering(); + + /** + * Print the number using short-form compact notation. + * + *

+ * Compact notation, defined in Unicode Technical Standard #35 Part 3 Section 2.4.1, prints numbers with + * localized prefixes or suffixes corresponding to different powers of ten. Compact notation is similar to + * engineering notation in how it scales numbers. + * + *

+ * Compact notation is ideal for displaying large numbers (over ~1000) to humans while at the same time minimizing + * screen real estate. + * + *

+ * In short form, the powers of ten are abbreviated. In en-US, the abbreviations are "K" for thousands, "M" + * for millions, "B" for billions, and "T" for trillions. Example outputs in en-US when printing 8.765E7 + * through 8.765E0: + * + *

+     * 88M
+     * 8.8M
+     * 876K
+     * 88K
+     * 8.8K
+     * 876
+     * 88
+     * 8.8
+     * 
+ * + *

+ * When compact notation is specified without an explicit rounding strategy, numbers are rounded off to the closest + * integer after scaling the number by the corresponding power of 10, but with a digit shown after the decimal + * separator if there is only one digit before the decimal separator. The default compact notation rounding strategy + * is equivalent to: + * + *

+     * Rounder.integer().withMinDigits(2)
+     * 
+ * + * @return A CompactNotation for passing to the NumberFormatter notation() setter. + * @draft ICU 60 + */ + static CompactNotation compactShort(); + + /** + * Print the number using long-form compact notation. For more information on compact notation, see + * {@link #compactShort}. + * + *

+ * In long form, the powers of ten are spelled out fully. Example outputs in en-US when printing 8.765E7 + * through 8.765E0: + * + *

+     * 88 million
+     * 8.8 million
+     * 876 thousand
+     * 88 thousand
+     * 8.8 thousand
+     * 876
+     * 88
+     * 8.8
+     * 
+ * + * @return A CompactNotation for passing to the NumberFormatter notation() setter. + * @draft ICU 60 + */ + static CompactNotation compactLong(); + + /** + * Print the number using simple notation without any scaling by powers of ten. This is the default behavior. + * + *

+ * Since this is the default behavior, this method needs to be called only when it is necessary to override a + * previous setting. + * + *

+ * Example outputs in en-US when printing 8.765E7 through 8.765E0: + * + *

+     * 87,650,000
+     * 8,765,000
+     * 876,500
+     * 87,650
+     * 8,765
+     * 876.5
+     * 87.65
+     * 8.765
+     * 
+ * + * @return A SimpleNotation for passing to the NumberFormatter notation() setter. + * @draft ICU 60 + */ + static SimpleNotation simple(); + + private: + enum NotationType { + NTN_SCIENTIFIC, NTN_COMPACT, NTN_SIMPLE, NTN_ERROR + } fType; + + union NotationUnion { + // For NTN_SCIENTIFIC + struct ScientificSettings { + int8_t fEngineeringInterval; + bool fRequireMinInt; + int8_t fMinExponentDigits; + UNumberSignDisplay fExponentSignDisplay; + } scientific; + + // For NTN_COMPACT + UNumberCompactStyle compactStyle; + + // For NTN_ERROR + UErrorCode errorCode; + } fUnion; + + typedef NotationUnion::ScientificSettings ScientificSettings; + + Notation(const NotationType &type, const NotationUnion &union_) : fType(type), fUnion(union_) {} + + Notation(UErrorCode errorCode) : fType(NTN_ERROR) { + fUnion.errorCode = errorCode; + } + + Notation() : fType(NTN_SIMPLE), fUnion() {} + + UBool copyErrorTo(UErrorCode &status) const { + if (fType == NTN_ERROR) { + status = fUnion.errorCode; + return TRUE; + } + return FALSE; + } + + // To allow MacroProps to initialize empty instances: + friend struct impl::MacroProps; + friend class ScientificNotation; + + // To allow implementation to access internal types: + friend class impl::NumberFormatterImpl; + friend class impl::ScientificModifier; + friend class impl::ScientificHandler; +}; + +/** + * A class that defines the scientific notation style to be used when formatting numbers in NumberFormatter. + * + *

+ * To create a ScientificNotation, use one of the factory methods in {@link Notation}. + * + * @draft ICU 60 + */ +class U_I18N_API ScientificNotation : public Notation { + public: + /** + * Sets the minimum number of digits to show in the exponent of scientific notation, padding with zeros if + * necessary. Useful for fixed-width display. + * + *

+ * For example, with minExponentDigits=2, the number 123 will be printed as "1.23E02" in en-US instead of + * the default "1.23E2". + * + * @param minExponentDigits + * The minimum number of digits to show in the exponent. + * @return A ScientificNotation, for chaining. + * @draft ICU 60 + */ + ScientificNotation withMinExponentDigits(int32_t minExponentDigits) const; + + /** + * Sets whether to show the sign on positive and negative exponents in scientific notation. The default is AUTO, + * showing the minus sign but not the plus sign. + * + *

+ * For example, with exponentSignDisplay=ALWAYS, the number 123 will be printed as "1.23E+2" in en-US + * instead of the default "1.23E2". + * + * @param exponentSignDisplay + * The strategy for displaying the sign in the exponent. + * @return A ScientificNotation, for chaining. + * @draft ICU 60 + */ + ScientificNotation withExponentSignDisplay(UNumberSignDisplay exponentSignDisplay) const; + + private: + // Inherit constructor + using Notation::Notation; + + friend class Notation; +}; + +// Reserve extra names in case they are added as classes in the future: +typedef Rounder DigitRounder; + +/** + * A class that defines the rounding strategy to be used when formatting numbers in NumberFormatter. + * + *

+ * To create a Rounder, use one of the factory methods. + * + * @draft ICU 60 + */ +class U_I18N_API Rounder : public UMemory { + + public: + /** + * Show all available digits to full precision. + * + *

+ * NOTE: When formatting a double, this method, along with {@link #minFraction} and + * {@link #minDigits}, will trigger complex algorithm similar to Dragon4 to determine the low-order digits + * and the number of digits to display based on the value of the double. If the number of fraction places or + * significant digits can be bounded, consider using {@link #maxFraction} or {@link #maxDigits} instead to maximize + * performance. For more information, read the following blog post. + * + *

+ * http://www.serpentine.com/blog/2011/06/29/here-be-dragons-advances-in-problems-you-didnt-even-know-you-had/ + * + * @return A Rounder for chaining or passing to the NumberFormatter rounding() setter. + * @draft ICU 60 + */ + static Rounder unlimited(); + + /** + * Show numbers rounded if necessary to the nearest integer. + * + * @return A FractionRounder for chaining or passing to the NumberFormatter rounding() setter. + * @draft ICU 60 + */ + static FractionRounder integer(); + + /** + * Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator). + * Additionally, pad with zeros to ensure that this number of places are always shown. + * + *

+ * Example output with minMaxFractionPlaces = 3: + * + *

+ * 87,650.000
+ * 8,765.000
+ * 876.500
+ * 87.650
+ * 8.765
+ * 0.876
+ * 0.088
+ * 0.009
+ * 0.000 (zero) + * + *

+ * This method is equivalent to {@link #minMaxFraction} with both arguments equal. + * + * @param minMaxFractionPlaces + * The minimum and maximum number of numerals to display after the decimal separator (rounding if too + * long or padding with zeros if too short). + * @return A FractionRounder for chaining or passing to the NumberFormatter rounding() setter. + * @draft ICU 60 + */ + static FractionRounder fixedFraction(int32_t minMaxFractionPlaces); + + /** + * Always show at least a certain number of fraction places after the decimal separator, padding with zeros if + * necessary. Do not perform rounding (display numbers to their full precision). + * + *

+ * NOTE: If you are formatting doubles, see the performance note in {@link #unlimited}. + * + * @param minFractionPlaces + * The minimum number of numerals to display after the decimal separator (padding with zeros if + * necessary). + * @return A FractionRounder for chaining or passing to the NumberFormatter rounding() setter. + * @draft ICU 60 + */ + static FractionRounder minFraction(int32_t minFractionPlaces); + + /** + * Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator). + * Unlike the other fraction rounding strategies, this strategy does not pad zeros to the end of the + * number. + * + * @param maxFractionPlaces + * The maximum number of numerals to display after the decimal mark (rounding if necessary). + * @return A FractionRounder for chaining or passing to the NumberFormatter rounding() setter. + * @draft ICU 60 + */ + static FractionRounder maxFraction(int32_t maxFractionPlaces); + + /** + * Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator); + * in addition, always show at least a certain number of places after the decimal separator, padding with zeros if + * necessary. + * + * @param minFractionPlaces + * The minimum number of numerals to display after the decimal separator (padding with zeros if + * necessary). + * @param maxFractionPlaces + * The maximum number of numerals to display after the decimal separator (rounding if necessary). + * @return A FractionRounder for chaining or passing to the NumberFormatter rounding() setter. + * @draft ICU 60 + */ + static FractionRounder minMaxFraction(int32_t minFractionPlaces, int32_t maxFractionPlaces); + + /** + * Show numbers rounded if necessary to a certain number of significant digits or significant figures. Additionally, + * pad with zeros to ensure that this number of significant digits/figures are always shown. + * + *

+ * This method is equivalent to {@link #minMaxDigits} with both arguments equal. + * + * @param minMaxSignificantDigits + * The minimum and maximum number of significant digits to display (rounding if too long or padding with + * zeros if too short). + * @return A Rounder for chaining or passing to the NumberFormatter rounding() setter. + * @draft ICU 60 + */ + static DigitRounder fixedDigits(int32_t minMaxSignificantDigits); + + /** + * Always show at least a certain number of significant digits/figures, padding with zeros if necessary. Do not + * perform rounding (display numbers to their full precision). + * + *

+ * NOTE: If you are formatting doubles, see the performance note in {@link #unlimited}. + * + * @param minSignificantDigits + * The minimum number of significant digits to display (padding with zeros if too short). + * @return A Rounder for chaining or passing to the NumberFormatter rounding() setter. + * @draft ICU 60 + */ + static DigitRounder minDigits(int32_t minSignificantDigits); + + /** + * Show numbers rounded if necessary to a certain number of significant digits/figures. + * + * @param maxSignificantDigits + * The maximum number of significant digits to display (rounding if too long). + * @return A Rounder for chaining or passing to the NumberFormatter rounding() setter. + * @draft ICU 60 + */ + static DigitRounder maxDigits(int32_t maxSignificantDigits); + + /** + * Show numbers rounded if necessary to a certain number of significant digits/figures; in addition, always show at + * least a certain number of significant digits, padding with zeros if necessary. + * + * @param minSignificantDigits + * The minimum number of significant digits to display (padding with zeros if necessary). + * @param maxSignificantDigits + * The maximum number of significant digits to display (rounding if necessary). + * @return A Rounder for chaining or passing to the NumberFormatter rounding() setter. + * @draft ICU 60 + */ + static DigitRounder minMaxDigits(int32_t minSignificantDigits, int32_t maxSignificantDigits); + + /** + * Show numbers rounded if necessary to the closest multiple of a certain rounding increment. For example, if the + * rounding increment is 0.5, then round 1.2 to 1 and round 1.3 to 1.5. + * + *

+ * In order to ensure that numbers are padded to the appropriate number of fraction places, call + * withMinFraction() on the return value of this method. + * For example, to round to the nearest 0.5 and always display 2 numerals after the + * decimal separator (to display 1.2 as "1.00" and 1.3 as "1.50"), you can run: + * + *

+     * Rounder::increment(0.5).withMinFraction(2)
+     * 
+ * + * @param roundingIncrement + * The increment to which to round numbers. + * @return A Rounder for chaining or passing to the NumberFormatter rounding() setter. + * @draft ICU 60 + */ + static IncrementRounder increment(double roundingIncrement); + + /** + * Show numbers rounded and padded according to the rules for the currency unit. The most common rounding settings + * for currencies include Rounder.fixedFraction(2), Rounder.integer(), and + * Rounder.increment(0.05) for cash transactions ("nickel rounding"). + * + *

+ * The exact rounding details will be resolved at runtime based on the currency unit specified in the + * NumberFormatter chain. To round according to the rules for one currency while displaying the symbol for another + * currency, the withCurrency() method can be called on the return value of this method. + * + * @param currencyUsage + * Either STANDARD (for digital transactions) or CASH (for transactions where the rounding increment may + * be limited by the available denominations of cash or coins). + * @return A CurrencyRounder for chaining or passing to the NumberFormatter rounding() setter. + * @draft ICU 60 + */ + static CurrencyRounder currency(UCurrencyUsage currencyUsage); + + /** + * Sets the rounding mode to use when picking the direction to round (up or down). Common values + * include HALF_EVEN, HALF_UP, and FLOOR. The default is HALF_EVEN. + * + * @param roundingMode + * The RoundingMode to use. + * @return A Rounder for passing to the NumberFormatter rounding() setter. + * @draft ICU 60 + */ + Rounder withMode(UNumberFormatRoundingMode roundingMode) const; + + private: + enum RounderType { + RND_BOGUS, + RND_NONE, + RND_FRACTION, + RND_SIGNIFICANT, + RND_FRACTION_SIGNIFICANT, + RND_INCREMENT, + RND_CURRENCY, + RND_PASS_THROUGH, + RND_ERROR + } fType; + + union RounderUnion { + struct FractionSignificantSettings { + // For RND_FRACTION, RND_SIGNIFICANT, and RND_FRACTION_SIGNIFICANT + int8_t fMinFrac; + int8_t fMaxFrac; + int8_t fMinSig; + int8_t fMaxSig; + } fracSig; + struct IncrementSettings { + double fIncrement; + int32_t fMinFrac; + } increment; // For RND_INCREMENT + UCurrencyUsage currencyUsage; // For RND_CURRENCY + UErrorCode errorCode; // For RND_ERROR + } fUnion; + + typedef RounderUnion::FractionSignificantSettings FractionSignificantSettings; + typedef RounderUnion::IncrementSettings IncrementSettings; + + UNumberFormatRoundingMode fRoundingMode; + + Rounder(const RounderType &type, const RounderUnion &union_, UNumberFormatRoundingMode roundingMode) + : fType(type), fUnion(union_), fRoundingMode(roundingMode) {} + + Rounder(UErrorCode errorCode) : fType(RND_ERROR) { + fUnion.errorCode = errorCode; + } + + Rounder() : fType(RND_BOGUS) {} + + bool isBogus() const { + return fType == RND_BOGUS; + } + + UBool copyErrorTo(UErrorCode &status) const { + if (fType == RND_ERROR) { + status = fUnion.errorCode; + return TRUE; + } + return FALSE; + } + + // On the parent type so that this method can be called internally on Rounder instances. + Rounder withCurrency(const CurrencyUnit ¤cy, UErrorCode &status) const; + + /** NON-CONST: mutates the current instance. */ + void setLocaleData(const CurrencyUnit ¤cy, UErrorCode &status); + + void apply(impl::DecimalQuantity &value, UErrorCode &status) const; + + /** Version of {@link #apply} that obeys minInt constraints. Used for scientific notation compatibility mode. */ + void apply(impl::DecimalQuantity &value, int32_t minInt, UErrorCode status); + + int32_t + chooseMultiplierAndApply(impl::DecimalQuantity &input, const impl::MultiplierProducer &producer, + UErrorCode &status); + + static FractionRounder constructFraction(int32_t minFrac, int32_t maxFrac); + + static Rounder constructSignificant(int32_t minSig, int32_t maxSig); + + static Rounder + constructFractionSignificant(const FractionRounder &base, int32_t minSig, int32_t maxSig); + + static IncrementRounder constructIncrement(double increment, int32_t minFrac); + + static CurrencyRounder constructCurrency(UCurrencyUsage usage); + + static Rounder constructPassThrough(); + + // To allow MacroProps/MicroProps to initialize bogus instances: + friend struct impl::MacroProps; + friend struct impl::MicroProps; + + // To allow NumberFormatterImpl to access isBogus() and other internal methods: + friend class impl::NumberFormatterImpl; + + // To give access to apply() and chooseMultiplierAndApply(): + friend class impl::MutablePatternModifier; + friend class impl::LongNameHandler; + friend class impl::ScientificHandler; + friend class impl::CompactHandler; + + // To allow child classes to call private methods: + friend class FractionRounder; + friend class CurrencyRounder; + friend class IncrementRounder; +}; + +/** + * A class that defines a rounding strategy based on a number of fraction places and optionally significant digits to be + * used when formatting numbers in NumberFormatter. + * + *

+ * To create a FractionRounder, use one of the factory methods on Rounder. + * + * @draft ICU 60 + */ +class U_I18N_API FractionRounder : public Rounder { + public: + /** + * Ensure that no less than this number of significant digits are retained when rounding according to fraction + * rules. + * + *

+ * For example, with integer rounding, the number 3.141 becomes "3". However, with minimum figures set to 2, 3.141 + * becomes "3.1" instead. + * + *

+ * This setting does not affect the number of trailing zeros. For example, 3.01 would print as "3", not "3.0". + * + * @param minSignificantDigits + * The number of significant figures to guarantee. + * @return A Rounder for chaining or passing to the NumberFormatter rounding() setter. + * @draft ICU 60 + */ + Rounder withMinDigits(int32_t minSignificantDigits) const; + + /** + * Ensure that no more than this number of significant digits are retained when rounding according to fraction + * rules. + * + *

+ * For example, with integer rounding, the number 123.4 becomes "123". However, with maximum figures set to 2, 123.4 + * becomes "120" instead. + * + *

+ * This setting does not affect the number of trailing zeros. For example, with fixed fraction of 2, 123.4 would + * become "120.00". + * + * @param maxSignificantDigits + * Round the number to no more than this number of significant figures. + * @return A Rounder for chaining or passing to the NumberFormatter rounding() setter. + * @draft ICU 60 + */ + Rounder withMaxDigits(int32_t maxSignificantDigits) const; + + private: + // Inherit constructor + using Rounder::Rounder; + + // To allow parent class to call this class's constructor: + friend class Rounder; +}; + +/** + * A class that defines a rounding strategy parameterized by a currency to be used when formatting numbers in + * NumberFormatter. + * + *

+ * To create a CurrencyRounder, use one of the factory methods on Rounder. + * + * @draft ICU 60 + */ +class U_I18N_API CurrencyRounder : public Rounder { + public: + /** + * Associates a currency with this rounding strategy. + * + *

+ * Calling this method is not required, because the currency specified in unit() + * is automatically applied to currency rounding strategies. However, + * this method enables you to override that automatic association. + * + *

+ * This method also enables numbers to be formatted using currency rounding rules without explicitly using a + * currency format. + * + * @param currency + * The currency to associate with this rounding strategy. + * @return A Rounder for chaining or passing to the NumberFormatter rounding() setter. + * @draft ICU 60 + */ + Rounder withCurrency(const CurrencyUnit ¤cy) const; + + private: + // Inherit constructor + using Rounder::Rounder; + + // To allow parent class to call this class's constructor: + friend class Rounder; +}; + +/** + * A class that defines a rounding strategy parameterized by a rounding increment to be used when formatting numbers in + * NumberFormatter. + * + *

+ * To create an IncrementRounder, use one of the factory methods on Rounder. + * + * @draft ICU 60 + */ +class U_I18N_API IncrementRounder : public Rounder { + public: + /** + * Specifies the minimum number of fraction digits to render after the decimal separator, padding with zeros if + * necessary. By default, no trailing zeros are added. + * + *

+ * For example, if the rounding increment is 0.5 and minFrac is 2, then the resulting strings include "0.00", + * "0.50", "1.00", and "1.50". + * + *

+ * Note: In ICU4J, this functionality is accomplished via the scale of the BigDecimal rounding increment. + * + * @param minFrac The minimum number of digits after the decimal separator. + * @return A Rounder for chaining or passing to the NumberFormatter rounding() setter. + * @draft ICU 60 + */ + Rounder withMinFraction(int32_t minFrac) const; + + private: + // Inherit constructor + using Rounder::Rounder; + + // To allow parent class to call this class's constructor: + friend class Rounder; +}; + +/** + * @internal This API is a technical preview. It is likely to change in an upcoming release. + */ +class U_I18N_API Grouper : public UMemory { + public: + /** + * @internal This API is a technical preview. It is likely to change in an upcoming release. + */ + static Grouper defaults(); + + /** + * @internal This API is a technical preview. It is likely to change in an upcoming release. + */ + static Grouper minTwoDigits(); + + /** + * @internal This API is a technical preview. It is likely to change in an upcoming release. + */ + static Grouper none(); + + private: + int8_t fGrouping1; // -3 means "bogus"; -2 means "needs locale data"; -1 means "no grouping" + int8_t fGrouping2; + bool fMin2; + + Grouper(int8_t grouping1, int8_t grouping2, bool min2) + : fGrouping1(grouping1), fGrouping2(grouping2), fMin2(min2) {} + + Grouper() : fGrouping1(-3) {}; + + bool isBogus() const { + return fGrouping1 == -3; + } + + /** NON-CONST: mutates the current instance. */ + void setLocaleData(const impl::ParsedPatternInfo &patternInfo); + + bool groupAtPosition(int32_t position, const impl::DecimalQuantity &value) const; + + // To allow MacroProps/MicroProps to initialize empty instances: + friend struct impl::MacroProps; + friend struct impl::MicroProps; + + // To allow NumberFormatterImpl to access isBogus() and perform other operations: + friend class impl::NumberFormatterImpl; +}; + +/** + * A class that defines the strategy for padding and truncating integers before the decimal separator. + * + *

+ * To create an IntegerWidth, use one of the factory methods. + * + * @draft ICU 60 + * @see NumberFormatter + */ +class U_I18N_API IntegerWidth : public UMemory { + public: + /** + * Pad numbers at the beginning with zeros to guarantee a certain number of numerals before the decimal separator. + * + *

+ * For example, with minInt=3, the number 55 will get printed as "055". + * + * @param minInt + * The minimum number of places before the decimal separator. + * @return An IntegerWidth for chaining or passing to the NumberFormatter integerWidth() setter. + * @draft ICU 60 + * @see NumberFormatter + */ + static IntegerWidth zeroFillTo(int32_t minInt); + + /** + * Truncate numbers exceeding a certain number of numerals before the decimal separator. + * + * For example, with maxInt=3, the number 1234 will get printed as "234". + * + * @param maxInt + * The maximum number of places before the decimal separator. + * @return An IntegerWidth for passing to the NumberFormatter integerWidth() setter. + * @draft ICU 60 + * @see NumberFormatter + */ + IntegerWidth truncateAt(int32_t maxInt); + + private: + union { + struct { + int8_t fMinInt; + int8_t fMaxInt; + } minMaxInt; + UErrorCode errorCode; + } fUnion; + bool fHasError = false; + + IntegerWidth(int8_t minInt, int8_t maxInt); + + IntegerWidth(UErrorCode errorCode) { // NOLINT + fUnion.errorCode = errorCode; + fHasError = true; + } + + IntegerWidth() { // NOLINT + fUnion.minMaxInt.fMinInt = -1; + } + + bool isBogus() const { + return !fHasError && fUnion.minMaxInt.fMinInt == -1; + } + + UBool copyErrorTo(UErrorCode &status) const { + if (fHasError) { + status = fUnion.errorCode; + return TRUE; + } + return FALSE; + } + + void apply(impl::DecimalQuantity &quantity, UErrorCode &status) const; + + // To allow MacroProps/MicroProps to initialize empty instances: + friend struct impl::MacroProps; + friend struct impl::MicroProps; + + // To allow NumberFormatterImpl to access isBogus() and perform other operations: + friend class impl::NumberFormatterImpl; +}; + +namespace impl { + +/** + * Use a default threshold of 3. This means that the third time .format() is called, the data structures get built + * using the "safe" code path. The first two calls to .format() will trigger the unsafe code path. + * + * @internal + */ +static constexpr int32_t DEFAULT_THRESHOLD = 3; + +/** @internal */ +class U_I18N_API SymbolsWrapper : public UMemory { + public: + /** @internal */ + SymbolsWrapper() : fType(SYMPTR_NONE), fPtr{nullptr} {} + + /** @internal */ + SymbolsWrapper(const SymbolsWrapper &other); + + /** @internal */ + ~SymbolsWrapper(); + + /** @internal */ + SymbolsWrapper &operator=(const SymbolsWrapper &other); + + /** + * The provided object is copied, but we do not adopt it. + * @internal + */ + void setTo(const DecimalFormatSymbols &dfs); + + /** + * Adopt the provided object. + * @internal + */ + void setTo(const NumberingSystem *ns); + + /** + * Whether the object is currently holding a DecimalFormatSymbols. + * @internal + */ + bool isDecimalFormatSymbols() const; + + /** + * Whether the object is currently holding a NumberingSystem. + * @internal + */ + bool isNumberingSystem() const; + + /** + * Get the DecimalFormatSymbols pointer. No ownership change. + * @internal + */ + const DecimalFormatSymbols *getDecimalFormatSymbols() const; + + /** + * Get the NumberingSystem pointer. No ownership change. + * @internal + */ + const NumberingSystem *getNumberingSystem() const; + + /** @internal */ + UBool copyErrorTo(UErrorCode &status) const { + if (fType == SYMPTR_DFS && fPtr.dfs == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return TRUE; + } else if (fType == SYMPTR_NS && fPtr.ns == nullptr) { + status = U_MEMORY_ALLOCATION_ERROR; + return TRUE; + } + return FALSE; + } + + private: + enum SymbolsPointerType { + SYMPTR_NONE, SYMPTR_DFS, SYMPTR_NS + } fType; + + union { + const DecimalFormatSymbols *dfs; + const NumberingSystem *ns; + } fPtr; + + void doCopyFrom(const SymbolsWrapper &other); + + void doCleanup(); +}; + +/** @internal */ +class U_I18N_API Padder : public UMemory { + public: + /** @internal */ + static Padder none(); + + /** @internal */ + static Padder codePoints(UChar32 cp, int32_t targetWidth, UNumberFormatPadPosition position); + + private: + UChar32 fWidth; // -3 = error; -2 = bogus; -1 = no padding + union { + struct { + int32_t fCp; + UNumberFormatPadPosition fPosition; + } padding; + UErrorCode errorCode; + } fUnion; + + Padder(UChar32 cp, int32_t width, UNumberFormatPadPosition position); + + Padder(int32_t width); + + Padder(UErrorCode errorCode) : fWidth(-3) { // NOLINT + fUnion.errorCode = errorCode; + } + + Padder() : fWidth(-2) {} // NOLINT + + bool isBogus() const { + return fWidth == -2; + } + + UBool copyErrorTo(UErrorCode &status) const { + if (fWidth == -3) { + status = fUnion.errorCode; + return TRUE; + } + return FALSE; + } + + bool isValid() const { + return fWidth > 0; + } + + int32_t padAndApply(const impl::Modifier &mod1, const impl::Modifier &mod2, + impl::NumberStringBuilder &string, int32_t leftIndex, int32_t rightIndex, + UErrorCode &status) const; + + // To allow MacroProps/MicroProps to initialize empty instances: + friend struct MacroProps; + friend struct MicroProps; + + // To allow NumberFormatterImpl to access isBogus() and perform other operations: + friend class impl::NumberFormatterImpl; +}; + +/** @internal */ +struct U_I18N_API MacroProps : public UMemory { + /** @internal */ + Notation notation; + + /** @internal */ + MeasureUnit unit; // = NoUnit::base(); + + /** @internal */ + Rounder rounder; // = Rounder(); (bogus) + + /** @internal */ + Grouper grouper; // = Grouper(); (bogus) + + /** @internal */ + Padder padder; // = Padder(); (bogus) + + /** @internal */ + IntegerWidth integerWidth; // = IntegerWidth(); (bogus) + + /** @internal */ + SymbolsWrapper symbols; + + // UNUM_XYZ_COUNT denotes null (bogus) values. + + /** @internal */ + UNumberUnitWidth unitWidth = UNUM_UNIT_WIDTH_COUNT; + + /** @internal */ + UNumberSignDisplay sign = UNUM_SIGN_COUNT; + + /** @internal */ + UNumberDecimalSeparatorDisplay decimal = UNUM_DECIMAL_SEPARATOR_COUNT; + + /** @internal */ + PluralRules *rules = nullptr; // no ownership + + /** @internal */ + int32_t threshold = DEFAULT_THRESHOLD; + Locale locale; + + /** + * Check all members for errors. + * @internal + */ + bool copyErrorTo(UErrorCode &status) const { + return notation.copyErrorTo(status) || rounder.copyErrorTo(status) || + padder.copyErrorTo(status) || integerWidth.copyErrorTo(status) || + symbols.copyErrorTo(status); + } +}; + +} // namespace impl + +/** + * An abstract base class for specifying settings related to number formatting. This class is implemented by + * {@link UnlocalizedNumberFormatter} and {@link LocalizedNumberFormatter}. + */ +template +class U_I18N_API NumberFormatterSettings { + public: + /** + * Specifies the notation style (simple, scientific, or compact) for rendering numbers. + * + *

    + *
  • Simple notation: "12,300" + *
  • Scientific notation: "1.23E4" + *
  • Compact notation: "12K" + *
+ * + *

+ * All notation styles will be properly localized with locale data, and all notation styles are compatible with + * units, rounding strategies, and other number formatter settings. + * + *

+ * Pass this method the return value of a {@link Notation} factory method. For example: + * + *

+     * NumberFormatter::with().notation(Notation::compactShort())
+     * 
+ * + * The default is to use simple notation. + * + * @param notation + * The notation strategy to use. + * @return The fluent chain. + * @see Notation + * @draft ICU 60 + */ + Derived notation(const Notation ¬ation) const; + + /** + * Specifies the unit (unit of measure, currency, or percent) to associate with rendered numbers. + * + *
    + *
  • Unit of measure: "12.3 meters" + *
  • Currency: "$12.30" + *
  • Percent: "12.3%" + *
+ * + *

+ * All units will be properly localized with locale data, and all units are compatible with notation styles, + * rounding strategies, and other number formatter settings. + * + *

+ * Pass this method any instance of {@link MeasureUnit}. For units of measure: + * + *

+     * NumberFormatter.with().adoptUnit(MeasureUnit::createMeter(status))
+     * 
+ * + * Currency: + * + *
+     * NumberFormatter.with()::unit(CurrencyUnit(u"USD", status))
+     * 
+ * + * Percent: + * + *
+     * NumberFormatter.with()::unit(NoUnit.percent())
+     * 
+ * + * The default is to render without units (equivalent to NoUnit.base()). + * + * @param unit + * The unit to render. + * @return The fluent chain. + * @see MeasureUnit + * @see Currency + * @see NoUnit + * @draft ICU 60 + */ + Derived unit(const icu::MeasureUnit &unit) const; + + /** + * Like unit(), but takes ownership of a pointer. Convenient for use with the MeasureFormat factory + * methods, which return pointers that need ownership. + * + * @param unit + * The unit to render. + * @return The fluent chain. + * @see #unit + * @see MeasureUnit + * @draft ICU 60 + */ + Derived adoptUnit(const icu::MeasureUnit *unit) const; + + /** + * Specifies the rounding strategy to use when formatting numbers. + * + *
    + *
  • Round to 3 decimal places: "3.142" + *
  • Round to 3 significant figures: "3.14" + *
  • Round to the closest nickel: "3.15" + *
  • Do not perform rounding: "3.1415926..." + *
+ * + *

+ * Pass this method the return value of one of the factory methods on {@link Rounder}. For example: + * + *

+     * NumberFormatter::with().rounding(Rounder::fixedFraction(2))
+     * 
+ * + *

+ * In most cases, the default rounding strategy is to round to 6 fraction places; i.e., + * Rounder.maxFraction(6). The exceptions are if compact notation is being used, then the compact + * notation rounding strategy is used (see {@link Notation#compactShort} for details), or if the unit is a currency, + * then standard currency rounding is used, which varies from currency to currency (see {@link Rounder#currency} for + * details). + * + * @param rounder + * The rounding strategy to use. + * @return The fluent chain. + * @see Rounder + * @provisional This API might change or be removed in a future release. + * @draft ICU 60 + */ + Derived rounding(const Rounder &rounder) const; + +#ifndef U_HIDE_INTERNAL_API + + /** + * Specifies the grouping strategy to use when formatting numbers. + * + *

    + *
  • Default grouping: "12,300" and "1,230" + *
  • Grouping with at least 2 digits: "12,300" and "1230" + *
  • No grouping: "12300" and "1230" + *
+ * + *

+ * The exact grouping widths will be chosen based on the locale. + * + *

+ * Pass this method the return value of one of the factory methods on {@link Grouper}. For example: + * + *

+     * NumberFormatter::with().grouping(Grouper::min2())
+     * 
+ * + * The default is to perform grouping without concern for the minimum grouping digits. + * + * @param grouper + * The grouping strategy to use. + * @return The fluent chain. + * @see Grouper + * @see Notation + * @internal + * @internal ICU 60: This API is technical preview. + */ + Derived grouping(const Grouper &grouper) const; + +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Specifies the minimum and maximum number of digits to render before the decimal mark. + * + *
    + *
  • Zero minimum integer digits: ".08" + *
  • One minimum integer digit: "0.08" + *
  • Two minimum integer digits: "00.08" + *
+ * + *

+ * Pass this method the return value of {@link IntegerWidth#zeroFillTo(int)}. For example: + * + *

+     * NumberFormatter::with().integerWidth(IntegerWidth::zeroFillTo(2))
+     * 
+ * + * The default is to have one minimum integer digit. + * + * @param style + * The integer width to use. + * @return The fluent chain. + * @see IntegerWidth + * @draft ICU 60 + */ + Derived integerWidth(const IntegerWidth &style) const; + + /** + * Specifies the symbols (decimal separator, grouping separator, percent sign, numerals, etc.) to use when rendering + * numbers. + * + *
    + *
  • en_US symbols: "12,345.67" + *
  • fr_FR symbols: "12 345,67" + *
  • de_CH symbols: "12’345.67" + *
  • my_MY symbols: "áá‚,áƒá„á….á†á‡" + *
+ * + *

+ * Pass this method an instance of {@link DecimalFormatSymbols}. For example: + * + *

+     * NumberFormatter::with().symbols(DecimalFormatSymbols(Locale("de_CH"), status))
+     * 
+ * + *

+ * Note: DecimalFormatSymbols automatically chooses the best numbering system based on the locale. + * In the examples above, the first three are using the Latin numbering system, and the fourth is using the Myanmar + * numbering system. + * + *

+ * Note: The instance of DecimalFormatSymbols will be copied: changes made to the symbols object + * after passing it into the fluent chain will not be seen. + * + *

+ * Note: Calling this method will override the NumberingSystem previously specified in + * {@link #symbols(NumberingSystem)}. + * + *

+ * The default is to choose the symbols based on the locale specified in the fluent chain. + * + * @param symbols + * The DecimalFormatSymbols to use. + * @return The fluent chain. + * @see DecimalFormatSymbols + * @draft ICU 60 + */ + Derived symbols(const DecimalFormatSymbols &symbols) const; + + /** + * Specifies that the given numbering system should be used when fetching symbols. + * + *

    + *
  • Latin numbering system: "12,345" + *
  • Myanmar numbering system: "áá‚,áƒá„á…" + *
  • Math Sans Bold numbering system: "ðŸ­ðŸ®,ðŸ¯ðŸ°ðŸ±" + *
+ * + *

+ * Pass this method an instance of {@link NumberingSystem}. For example, to force the locale to always use the Latin + * alphabet numbering system (ASCII digits): + * + *

+     * NumberFormatter::with().adoptSymbols(NumberingSystem::createInstanceByName("latn", status))
+     * 
+ * + *

+ * Note: Calling this method will override the DecimalFormatSymbols previously specified in + * {@link #symbols(DecimalFormatSymbols)}. + * + *

+ * The default is to choose the best numbering system for the locale. + * + *

+ * This method takes ownership of a pointer in order to work nicely with the NumberingSystem factory methods. + * + * @param symbols + * The NumberingSystem to use. + * @return The fluent chain. + * @see NumberingSystem + * @draft ICU 60 + */ + Derived adoptSymbols(const NumberingSystem *symbols) const; + + /** + * Sets the width of the unit (measure unit or currency). Most common values: + * + *

    + *
  • Short: "$12.00", "12 m" + *
  • ISO Code: "USD 12.00" + *
  • Full name: "12.00 US dollars", "12 meters" + *
+ * + *

+ * Pass an element from the {@link UNumberUnitWidth} enum to this setter. For example: + * + *

+     * NumberFormatter::with().unitWidth(UNumberUnitWidth::UNUM_UNIT_WIDTH_FULL_NAME)
+     * 
+ * + *

+ * The default is the SHORT width. + * + * @param width + * The width to use when rendering numbers. + * @return The fluent chain + * @see UNumberUnitWidth + * @draft ICU 60 + */ + Derived unitWidth(const UNumberUnitWidth &width) const; + + /** + * Sets the plus/minus sign display strategy. Most common values: + * + *

    + *
  • Auto: "123", "-123" + *
  • Always: "+123", "-123" + *
  • Accounting: "$123", "($123)" + *
+ * + *

+ * Pass an element from the {@link UNumberSignDisplay} enum to this setter. For example: + * + *

+     * NumberFormatter::with().sign(UNumberSignDisplay::UNUM_SIGN_ALWAYS)
+     * 
+ * + *

+ * The default is AUTO sign display. + * + * @param width + * The sign display strategy to use when rendering numbers. + * @return The fluent chain + * @see UNumberSignDisplay + * @provisional This API might change or be removed in a future release. + * @draft ICU 60 + */ + Derived sign(const UNumberSignDisplay &width) const; + + /** + * Sets the decimal separator display strategy. This affects integer numbers with no fraction part. Most common + * values: + * + *

    + *
  • Auto: "1" + *
  • Always: "1." + *
+ * + *

+ * Pass an element from the {@link UNumberDecimalSeparatorDisplay} enum to this setter. For example: + * + *

+     * NumberFormatter::with().decimal(UNumberDecimalSeparatorDisplay::UNUM_DECIMAL_SEPARATOR_ALWAYS)
+     * 
+ * + *

+ * The default is AUTO decimal separator display. + * + * @param width + * The decimal separator display strategy to use when rendering numbers. + * @return The fluent chain + * @see UNumberDecimalSeparatorDisplay + * @provisional This API might change or be removed in a future release. + * @draft ICU 60 + */ + Derived decimal(const UNumberDecimalSeparatorDisplay &width) const; + +#ifndef U_HIDE_INTERNAL_API + + /** + * Set the padding strategy. May be added to ICU 61; see #13338. + * + * @internal ICU 60: This API is ICU internal only. + */ + Derived padding(const impl::Padder &padder) const; + + /** + * Internal fluent setter to support a custom regulation threshold. A threshold of 1 causes the data structures to + * be built right away. A threshold of 0 prevents the data structures from being built. + * + * @internal ICU 60: This API is ICU internal only. + */ + Derived threshold(int32_t threshold) const; + +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Sets the UErrorCode if an error occurred in the fluent chain. + * Preserves older error codes in the outErrorCode. + * @return TRUE if U_FAILURE(outErrorCode) + * @draft ICU 60 + */ + UBool copyErrorTo(UErrorCode &outErrorCode) const { + if (U_FAILURE(outErrorCode)) { + // Do not overwrite the older error code + return TRUE; + } + fMacros.copyErrorTo(outErrorCode); + return U_FAILURE(outErrorCode); + } + + protected: + impl::MacroProps fMacros; + + private: + // Don't construct me directly! Use (Un)LocalizedNumberFormatter. + NumberFormatterSettings() = default; + + friend class LocalizedNumberFormatter; + friend class UnlocalizedNumberFormatter; +}; + +/** + * A NumberFormatter that does not yet have a locale. In order to format numbers, a locale must be specified. + * + * @see NumberFormatter + * @draft ICU 60 + */ +class U_I18N_API UnlocalizedNumberFormatter + : public NumberFormatterSettings, public UMemory { + + public: + /** + * Associate the given locale with the number formatter. The locale is used for picking the appropriate symbols, + * formats, and other data for number display. + * + *

+ * To use the Java default locale, call Locale::getDefault(): + * + *

+     * NumberFormatter::with(). ... .locale(Locale::getDefault())
+     * 
+ * + * @param locale + * The locale to use when loading data for number formatting. + * @return The fluent chain. + * @draft ICU 60 + */ + LocalizedNumberFormatter locale(const icu::Locale &locale) const; + + // Make default copy constructor call the NumberFormatterSettings copy constructor. + /** + * Returns a copy of this UnlocalizedNumberFormatter. + * @draft ICU 60 + */ + UnlocalizedNumberFormatter(const UnlocalizedNumberFormatter &other) : UnlocalizedNumberFormatter( + static_cast &>(other)) {} + + private: + UnlocalizedNumberFormatter() = default; + + explicit UnlocalizedNumberFormatter( + const NumberFormatterSettings &other); + + // To give the fluent setters access to this class's constructor: + friend class NumberFormatterSettings; + + // To give NumberFormatter::with() access to this class's constructor: + friend class NumberFormatter; +}; + +/** + * A NumberFormatter that has a locale associated with it; this means .format() methods are available. + * + * @see NumberFormatter + * @draft ICU 60 + */ +class U_I18N_API LocalizedNumberFormatter + : public NumberFormatterSettings, public UMemory { + public: + /** + * Format the given integer number to a string using the settings specified in the NumberFormatter fluent + * setting chain. + * + * @param value + * The number to format. + * @param status + * Set to an ErrorCode if one occurred in the setter chain or during formatting. + * @return A FormattedNumber object; call .toString() to get the string. + * @draft ICU 60 + */ + FormattedNumber formatInt(int64_t value, UErrorCode &status) const; + + /** + * Format the given float or double to a string using the settings specified in the NumberFormatter fluent setting + * chain. + * + * @param value + * The number to format. + * @param status + * Set to an ErrorCode if one occurred in the setter chain or during formatting. + * @return A FormattedNumber object; call .toString() to get the string. + * @draft ICU 60 + */ + FormattedNumber formatDouble(double value, UErrorCode &status) const; + + /** + * Format the given decimal number to a string using the settings + * specified in the NumberFormatter fluent setting chain. + * The syntax of the unformatted number is a "numeric string" + * as defined in the Decimal Arithmetic Specification, available at + * http://speleotrove.com/decimal + * + * @param value + * The number to format. + * @param status + * Set to an ErrorCode if one occurred in the setter chain or during formatting. + * @return A FormattedNumber object; call .toString() to get the string. + * @draft ICU 60 + */ + FormattedNumber formatDecimal(StringPiece value, UErrorCode &status) const; + + // Make default copy constructor call the NumberFormatterSettings copy constructor. + /** + * Returns a copy of this LocalizedNumberFormatter. + * @draft ICU 60 + */ + LocalizedNumberFormatter(const LocalizedNumberFormatter &other) : LocalizedNumberFormatter( + static_cast &>(other)) {} + + /** + * Destruct this LocalizedNumberFormatter, cleaning up any memory it might own. + * @draft ICU 60 + */ + ~LocalizedNumberFormatter(); + + private: + const impl::NumberFormatterImpl* fCompiled {nullptr}; + char fUnsafeCallCount[8] {}; // internally cast to u_atomic_int32_t + + LocalizedNumberFormatter() = default; + + explicit LocalizedNumberFormatter(const NumberFormatterSettings &other); + + LocalizedNumberFormatter(const impl::MacroProps ¯os, const Locale &locale); + + /** + * This is the core entrypoint to the number formatting pipeline. It performs self-regulation: a static code path + * for the first few calls, and compiling a more efficient data structure if called repeatedly. + * + *

+ * This function is very hot, being called in every call to the number formatting pipeline. + * + * @param results + * The results object. This method takes ownership. + * @return The formatted number result. + */ + FormattedNumber formatImpl(impl::NumberFormatterResults *results, UErrorCode &status) const; + + // To give the fluent setters access to this class's constructor: + friend class NumberFormatterSettings; + friend class NumberFormatterSettings; + + // To give UnlocalizedNumberFormatter::locale() access to this class's constructor: + friend class UnlocalizedNumberFormatter; +}; + +/** + * The result of a number formatting operation. This class allows the result to be exported in several data types, + * including a UnicodeString and a FieldPositionIterator. + * + * @draft ICU 60 + */ +class U_I18N_API FormattedNumber : public UMemory { + public: + /** + * Returns a UnicodeString representation of the formatted number. + * + * @return a UnicodeString containing the localized number. + * @draft ICU 60 + */ + UnicodeString toString() const; + + /** + * Appends the formatted number to an Appendable. + * + * @param appendable + * The Appendable to which to append the formatted number string. + * @return The same Appendable, for chaining. + * @draft ICU 60 + * @see Appendable + */ + Appendable &appendTo(Appendable &appendable); + + /** + * Determine the start and end indices of the first occurrence of the given field in the output string. + * This allows you to determine the locations of the integer part, fraction part, and sign. + * + *

+ * If multiple different field attributes are needed, this method can be called repeatedly, or if all field + * attributes are needed, consider using populateFieldPositionIterator(). + * + *

+ * If a field occurs multiple times in an output string, such as a grouping separator, this method will only ever + * return the first occurrence. Use populateFieldPositionIterator() to access all occurrences of an attribute. + * + * @param fieldPosition + * The FieldPosition to populate with the start and end indices of the desired field. + * @param status + * Set if an error occurs while populating the FieldPosition. + * @draft ICU 60 + * @see UNumberFormatFields + */ + void populateFieldPosition(FieldPosition &fieldPosition, UErrorCode &status); + + /** + * Export the formatted number to a FieldPositionIterator. This allows you to determine which characters in + * the output string correspond to which fields, such as the integer part, fraction part, and sign. + * + *

+ * If information on only one field is needed, consider using populateFieldPosition() instead. + * + * @param iterator + * The FieldPositionIterator to populate with all of the fields present in the formatted number. + * @param status + * Set if an error occurs while populating the FieldPositionIterator. + * @draft ICU 60 + * @see UNumberFormatFields + */ + void populateFieldPositionIterator(FieldPositionIterator &iterator, UErrorCode &status); + + /** + * Destruct an instance of FormattedNumber, cleaning up any memory it might own. + * @draft ICU 60 + */ + ~FormattedNumber(); + + private: + // Can't use LocalPointer because NumberFormatterResults is forward-declared + const impl::NumberFormatterResults *fResults; + + // Error code for the terminal methods + UErrorCode fErrorCode; + + explicit FormattedNumber(impl::NumberFormatterResults *results) + : fResults(results), fErrorCode(U_ZERO_ERROR) {}; + + explicit FormattedNumber(UErrorCode errorCode) + : fResults(nullptr), fErrorCode(errorCode) {}; + + // To give LocalizedNumberFormatter format methods access to this class's constructor: + friend class LocalizedNumberFormatter; +}; + +/** + * See the main description in numberformatter.h for documentation and examples. + * + * @draft ICU 60 + */ +class U_I18N_API NumberFormatter final { + public: + /** + * Call this method at the beginning of a NumberFormatter fluent chain in which the locale is not currently known at + * the call site. + * + * @return An {@link UnlocalizedNumberFormatter}, to be used for chaining. + * @draft ICU 60 + */ + static UnlocalizedNumberFormatter with(); + + /** + * Call this method at the beginning of a NumberFormatter fluent chain in which the locale is known at the call + * site. + * + * @param locale + * The locale from which to load formats and symbols for number formatting. + * @return A {@link LocalizedNumberFormatter}, to be used for chaining. + * @draft ICU 60 + */ + static LocalizedNumberFormatter withLocale(const Locale &locale); + + /** + * Use factory methods instead of the constructor to create a NumberFormatter. + * @draft ICU 60 + */ + NumberFormatter() = delete; +}; + +} // namespace number +U_NAMESPACE_END + +#endif // U_HIDE_DRAFT_API + +#endif // __NUMBERFORMATTER_H__ + +#endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/numfmt.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/numfmt.h new file mode 100644 index 0000000..68be021 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/numfmt.h @@ -0,0 +1,1227 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************** +* Copyright (C) 1997-2016, International Business Machines Corporation and others. +* All Rights Reserved. +******************************************************************************** +* +* File NUMFMT.H +* +* Modification History: +* +* Date Name Description +* 02/19/97 aliu Converted from java. +* 03/18/97 clhuang Updated per C++ implementation. +* 04/17/97 aliu Changed DigitCount to int per code review. +* 07/20/98 stephen JDK 1.2 sync up. Added scientific support. +* Changed naming conventions to match C++ guidelines +* Derecated Java style constants (eg, INTEGER_FIELD) +******************************************************************************** +*/ + +#ifndef NUMFMT_H +#define NUMFMT_H + + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Abstract base class for all number formats. + */ + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/unistr.h" +#include "unicode/format.h" +#include "unicode/unum.h" // UNumberFormatStyle +#include "unicode/locid.h" +#include "unicode/stringpiece.h" +#include "unicode/curramt.h" +#include "unicode/udisplaycontext.h" + +class NumberFormatTest; + +U_NAMESPACE_BEGIN + +class SharedNumberFormat; + +#if !UCONFIG_NO_SERVICE +class NumberFormatFactory; +class StringEnumeration; +#endif + +/** + * + * Abstract base class for all number formats. Provides interface for + * formatting and parsing a number. Also provides methods for + * determining which locales have number formats, and what their names + * are. + * + *

NOTE: Starting in ICU 60, there is a new set of APIs for localized number + * formatting that are designed to be an improvement over DecimalFormat. New users are discouraged + * from using DecimalFormat. For more information, see numberformatter.h. + * + * \headerfile unicode/numfmt.h "unicode/numfmt.h" + *

+ * NumberFormat helps you to format and parse numbers for any locale. + * Your code can be completely independent of the locale conventions + * for decimal points, thousands-separators, or even the particular + * decimal digits used, or whether the number format is even decimal. + *

+ * To format a number for the current Locale, use one of the static + * factory methods: + * \code + * #include + * #include "unicode/numfmt.h" + * #include "unicode/unistr.h" + * #include "unicode/ustream.h" + * using namespace std; + * + * int main() { + * double myNumber = 7.0; + * UnicodeString myString; + * UErrorCode success = U_ZERO_ERROR; + * NumberFormat* nf = NumberFormat::createInstance(success); + * nf->format(myNumber, myString); + * cout << " Example 1: " << myString << endl; + * } + * \endcode + * Note that there are additional factory methods within subclasses of + * NumberFormat. + *

+ * If you are formatting multiple numbers, it is more efficient to get + * the format and use it multiple times so that the system doesn't + * have to fetch the information about the local language and country + * conventions multiple times. + * \code + * UnicodeString myString; + * UErrorCode success = U_ZERO_ERROR; + * NumberFormat *nf = NumberFormat::createInstance( success ); + * for (int32_t number: {123, 3333, -1234567}) { + * nf->format(number, myString); + * myString += "; "; + * } + * cout << " Example 2: " << myString << endl; + * \endcode + * To format a number for a different Locale, specify it in the + * call to \c createInstance(). + * \code + * nf = NumberFormat::createInstance(Locale::getFrench(), success); + * \endcode + * You can use a \c NumberFormat to parse also. + * \code + * UErrorCode success; + * Formattable result(-999); // initialized with error code + * nf->parse(myString, result, success); + * \endcode + * Use \c createInstance() to get the normal number format for a \c Locale. + * There are other static factory methods available. Use \c createCurrencyInstance() + * to get the currency number format for that country. Use \c createPercentInstance() + * to get a format for displaying percentages. With this format, a + * fraction from 0.53 is displayed as 53%. + *

+ * The type of number formatting can be specified by passing a 'style' parameter to \c createInstance(). + * For example, use\n + * \c createInstance(locale, UNUM_DECIMAL, errorCode) to get the normal number format,\n + * \c createInstance(locale, UNUM_PERCENT, errorCode) to get a format for displaying percentage,\n + * \c createInstance(locale, UNUM_SCIENTIFIC, errorCode) to get a format for displaying scientific number,\n + * \c createInstance(locale, UNUM_CURRENCY, errorCode) to get the currency number format, + * in which the currency is represented by its symbol, for example, "$3.00".\n + * \c createInstance(locale, UNUM_CURRENCY_ISO, errorCode) to get the currency number format, + * in which the currency is represented by its ISO code, for example "USD3.00".\n + * \c createInstance(locale, UNUM_CURRENCY_PLURAL, errorCode) to get the currency number format, + * in which the currency is represented by its full name in plural format, + * for example, "3.00 US dollars" or "1.00 US dollar". + *

+ * You can also control the display of numbers with such methods as + * \c getMinimumFractionDigits(). If you want even more control over the + * format or parsing, or want to give your users more control, you can + * try dynamic_casting the \c NumberFormat you get from the factory methods to a + * \c DecimalFormat. This will work for the vast majority of + * countries; just remember to test for NULL in case you + * encounter an unusual one. + *

+ * You can also use forms of the parse and format methods with + * \c ParsePosition and \c FieldPosition to allow you to: + *

    + *
  • (a) progressively parse through pieces of a string. + *
  • (b) align the decimal point and other areas. + *
+ * For example, you can align numbers in two ways. + *

+ * If you are using a monospaced font with spacing for alignment, you + * can pass the \c FieldPosition in your format call, with field = + * \c UNUM_INTEGER_FIELD. On output, \c getEndIndex will be set to the offset + * between the last character of the integer and the decimal. Add + * (desiredSpaceCount - getEndIndex) spaces at the front of the + * string. + *

+ * If you are using proportional fonts, instead of padding with + * spaces, measure the width of the string in pixels from the start to + * getEndIndex. Then move the pen by (desiredPixelWidth - + * widthToAlignmentPoint) before drawing the text. It also works + * where there is no decimal, but possibly additional characters at + * the end, e.g. with parentheses in negative numbers: "(12)" for -12. + *

+ * User subclasses are not supported. While clients may write + * subclasses, such code will not necessarily work and will not be + * guaranteed to work stably from release to release. + * + * @stable ICU 2.0 + */ +class U_I18N_API NumberFormat : public Format { +public: + /** + * Rounding mode. + * + *

+ * For more detail on rounding modes, see: + * http://userguide.icu-project.org/formatparse/numbers/rounding-modes + * + * @stable ICU 2.4 + */ + enum ERoundingMode { + kRoundCeiling, /**< Round towards positive infinity */ + kRoundFloor, /**< Round towards negative infinity */ + kRoundDown, /**< Round towards zero */ + kRoundUp, /**< Round away from zero */ + kRoundHalfEven, /**< Round towards the nearest integer, or + towards the nearest even integer if equidistant */ + kRoundHalfDown, /**< Round towards the nearest integer, or + towards zero if equidistant */ + kRoundHalfUp, /**< Round towards the nearest integer, or + away from zero if equidistant */ + /** + * Return U_FORMAT_INEXACT_ERROR if number does not format exactly. + * @stable ICU 4.8 + */ + kRoundUnnecessary + }; + + /** + * Alignment Field constants used to construct a FieldPosition object. + * Signifies that the position of the integer part or fraction part of + * a formatted number should be returned. + * + * Note: as of ICU 4.4, the values in this enum have been extended to + * support identification of all number format fields, not just those + * pertaining to alignment. + * + * These constants are provided for backwards compatibility only. + * Please use the C style constants defined in the header file unum.h. + * + * @see FieldPosition + * @stable ICU 2.0 + */ + enum EAlignmentFields { + /** @stable ICU 2.0 */ + kIntegerField = UNUM_INTEGER_FIELD, + /** @stable ICU 2.0 */ + kFractionField = UNUM_FRACTION_FIELD, + /** @stable ICU 2.0 */ + kDecimalSeparatorField = UNUM_DECIMAL_SEPARATOR_FIELD, + /** @stable ICU 2.0 */ + kExponentSymbolField = UNUM_EXPONENT_SYMBOL_FIELD, + /** @stable ICU 2.0 */ + kExponentSignField = UNUM_EXPONENT_SIGN_FIELD, + /** @stable ICU 2.0 */ + kExponentField = UNUM_EXPONENT_FIELD, + /** @stable ICU 2.0 */ + kGroupingSeparatorField = UNUM_GROUPING_SEPARATOR_FIELD, + /** @stable ICU 2.0 */ + kCurrencyField = UNUM_CURRENCY_FIELD, + /** @stable ICU 2.0 */ + kPercentField = UNUM_PERCENT_FIELD, + /** @stable ICU 2.0 */ + kPermillField = UNUM_PERMILL_FIELD, + /** @stable ICU 2.0 */ + kSignField = UNUM_SIGN_FIELD, + + /** + * These constants are provided for backwards compatibility only. + * Please use the constants defined in the header file unum.h. + */ + /** @stable ICU 2.0 */ + INTEGER_FIELD = UNUM_INTEGER_FIELD, + /** @stable ICU 2.0 */ + FRACTION_FIELD = UNUM_FRACTION_FIELD + }; + + /** + * Destructor. + * @stable ICU 2.0 + */ + virtual ~NumberFormat(); + + /** + * Return true if the given Format objects are semantically equal. + * Objects of different subclasses are considered unequal. + * @return true if the given Format objects are semantically equal. + * @stable ICU 2.0 + */ + virtual UBool operator==(const Format& other) const; + + + using Format::format; + + /** + * Format an object to produce a string. This method handles + * Formattable objects with numeric types. If the Formattable + * object type is not a numeric type, then it returns a failing + * UErrorCode. + * + * @param obj The object to format. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @stable ICU 2.0 + */ + virtual UnicodeString& format(const Formattable& obj, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode& status) const; + + /** + * Format an object to produce a string. This method handles + * Formattable objects with numeric types. If the Formattable + * object type is not a numeric type, then it returns a failing + * UErrorCode. + * + * @param obj The object to format. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param posIter On return, can be used to iterate over positions + * of fields generated by this format call. Can be + * NULL. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @stable ICU 4.4 + */ + virtual UnicodeString& format(const Formattable& obj, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; + + /** + * Parse a string to produce an object. This methods handles + * parsing of numeric strings into Formattable objects with numeric + * types. + *

+ * Before calling, set parse_pos.index to the offset you want to + * start parsing at in the source. After calling, parse_pos.index + * indicates the position after the successfully parsed text. If + * an error occurs, parse_pos.index is unchanged. + *

+ * When parsing, leading whitespace is discarded (with successful + * parse), while trailing whitespace is left as is. + *

+ * See Format::parseObject() for more. + * + * @param source The string to be parsed into an object. + * @param result Formattable to be set to the parse result. + * If parse fails, return contents are undefined. + * @param parse_pos The position to start parsing at. Upon return + * this param is set to the position after the + * last character successfully parsed. If the + * source is not parsed successfully, this param + * will remain unchanged. + * @return A newly created Formattable* object, or NULL + * on failure. The caller owns this and should + * delete it when done. + * @stable ICU 2.0 + */ + virtual void parseObject(const UnicodeString& source, + Formattable& result, + ParsePosition& parse_pos) const; + + /** + * Format a double number. These methods call the NumberFormat + * pure virtual format() methods with the default FieldPosition. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @return Reference to 'appendTo' parameter. + * @stable ICU 2.0 + */ + UnicodeString& format( double number, + UnicodeString& appendTo) const; + + /** + * Format a long number. These methods call the NumberFormat + * pure virtual format() methods with the default FieldPosition. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @return Reference to 'appendTo' parameter. + * @stable ICU 2.0 + */ + UnicodeString& format( int32_t number, + UnicodeString& appendTo) const; + + /** + * Format an int64 number. These methods call the NumberFormat + * pure virtual format() methods with the default FieldPosition. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @return Reference to 'appendTo' parameter. + * @stable ICU 2.8 + */ + UnicodeString& format( int64_t number, + UnicodeString& appendTo) const; + + /** + * Format a double number. Concrete subclasses must implement + * these pure virtual methods. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @return Reference to 'appendTo' parameter. + * @stable ICU 2.0 + */ + virtual UnicodeString& format(double number, + UnicodeString& appendTo, + FieldPosition& pos) const = 0; + /** + * Format a double number. By default, the parent function simply + * calls the base class and does not return an error status. + * Therefore, the status may be ignored in some subclasses. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @param status error status + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format(double number, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode &status) const; + /** + * Format a double number. Subclasses must implement + * this method. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param posIter On return, can be used to iterate over positions + * of fields generated by this format call. + * Can be NULL. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @stable ICU 4.4 + */ + virtual UnicodeString& format(double number, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; + /** + * Format a long number. Concrete subclasses must implement + * these pure virtual methods. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @return Reference to 'appendTo' parameter. + * @stable ICU 2.0 + */ + virtual UnicodeString& format(int32_t number, + UnicodeString& appendTo, + FieldPosition& pos) const = 0; + + /** + * Format a long number. Concrete subclasses may override + * this function to provide status return. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @param status the output status. + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format(int32_t number, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode &status) const; + + /** + * Format an int32 number. Subclasses must implement + * this method. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param posIter On return, can be used to iterate over positions + * of fields generated by this format call. + * Can be NULL. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @stable ICU 4.4 + */ + virtual UnicodeString& format(int32_t number, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; + /** + * Format an int64 number. (Not abstract to retain compatibility + * with earlier releases, however subclasses should override this + * method as it just delegates to format(int32_t number...); + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @return Reference to 'appendTo' parameter. + * @stable ICU 2.8 + */ + virtual UnicodeString& format(int64_t number, + UnicodeString& appendTo, + FieldPosition& pos) const; + + /** + * Format an int64 number. (Not abstract to retain compatibility + * with earlier releases, however subclasses should override this + * method as it just delegates to format(int32_t number...); + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format(int64_t number, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode& status) const; + /** + * Format an int64 number. Subclasses must implement + * this method. + * + * @param number The value to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param posIter On return, can be used to iterate over positions + * of fields generated by this format call. + * Can be NULL. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @stable ICU 4.4 + */ + virtual UnicodeString& format(int64_t number, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; + + /** + * Format a decimal number. Subclasses must implement + * this method. The syntax of the unformatted number is a "numeric string" + * as defined in the Decimal Arithmetic Specification, available at + * http://speleotrove.com/decimal + * + * @param number The unformatted number, as a string, to be formatted. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param posIter On return, can be used to iterate over positions + * of fields generated by this format call. + * Can be NULL. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @stable ICU 4.4 + */ + virtual UnicodeString& format(StringPiece number, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; +public: + /** + * Format a decimal number. + * The number is a DigitList wrapper onto a floating point decimal number. + * The default implementation in NumberFormat converts the decimal number + * to a double and formats that. Subclasses of NumberFormat that want + * to specifically handle big decimal numbers must override this method. + * class DecimalFormat does so. + * + * @param number The number, a DigitList format Decimal Floating Point. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param posIter On return, can be used to iterate over positions + * of fields generated by this format call. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format(const DigitList &number, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; + + /** + * Format a decimal number. + * The number is a DigitList wrapper onto a floating point decimal number. + * The default implementation in NumberFormat converts the decimal number + * to a double and formats that. Subclasses of NumberFormat that want + * to specifically handle big decimal numbers must override this method. + * class DecimalFormat does so. + * + * @param number The number, a DigitList format Decimal Floating Point. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format(const DigitList &number, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode& status) const; + +public: + + /** + * Return a long if possible (e.g. within range LONG_MAX, + * LONG_MAX], and with no decimals), otherwise a double. If + * IntegerOnly is set, will stop at a decimal point (or equivalent; + * e.g. for rational numbers "1 2/3", will stop after the 1). + *

+ * If no object can be parsed, index is unchanged, and NULL is + * returned. + *

+ * This is a pure virtual which concrete subclasses must implement. + * + * @param text The text to be parsed. + * @param result Formattable to be set to the parse result. + * If parse fails, return contents are undefined. + * @param parsePosition The position to start parsing at on input. + * On output, moved to after the last successfully + * parse character. On parse failure, does not change. + * @stable ICU 2.0 + */ + virtual void parse(const UnicodeString& text, + Formattable& result, + ParsePosition& parsePosition) const = 0; + + /** + * Parse a string as a numeric value, and return a Formattable + * numeric object. This method parses integers only if IntegerOnly + * is set. + * + * @param text The text to be parsed. + * @param result Formattable to be set to the parse result. + * If parse fails, return contents are undefined. + * @param status Output parameter set to a failure error code + * when a failure occurs. + * @see NumberFormat::isParseIntegerOnly + * @stable ICU 2.0 + */ + virtual void parse(const UnicodeString& text, + Formattable& result, + UErrorCode& status) const; + + /** + * Parses text from the given string as a currency amount. Unlike + * the parse() method, this method will attempt to parse a generic + * currency name, searching for a match of this object's locale's + * currency display names, or for a 3-letter ISO currency code. + * This method will fail if this format is not a currency format, + * that is, if it does not contain the currency pattern symbol + * (U+00A4) in its prefix or suffix. + * + * @param text the string to parse + * @param pos input-output position; on input, the position within text + * to match; must have 0 <= pos.getIndex() < text.length(); + * on output, the position after the last matched character. + * If the parse fails, the position in unchanged upon output. + * @return if parse succeeds, a pointer to a newly-created CurrencyAmount + * object (owned by the caller) containing information about + * the parsed currency; if parse fails, this is NULL. + * @stable ICU 49 + */ + virtual CurrencyAmount* parseCurrency(const UnicodeString& text, + ParsePosition& pos) const; + + /** + * Return true if this format will parse numbers as integers + * only. For example in the English locale, with ParseIntegerOnly + * true, the string "1234." would be parsed as the integer value + * 1234 and parsing would stop at the "." character. Of course, + * the exact format accepted by the parse operation is locale + * dependant and determined by sub-classes of NumberFormat. + * @return true if this format will parse numbers as integers + * only. + * @stable ICU 2.0 + */ + UBool isParseIntegerOnly(void) const; + + /** + * Sets whether or not numbers should be parsed as integers only. + * @param value set True, this format will parse numbers as integers + * only. + * @see isParseIntegerOnly + * @stable ICU 2.0 + */ + virtual void setParseIntegerOnly(UBool value); + + /** + * Sets whether lenient parsing should be enabled (it is off by default). + * + * @param enable \c TRUE if lenient parsing should be used, + * \c FALSE otherwise. + * @stable ICU 4.8 + */ + virtual void setLenient(UBool enable); + + /** + * Returns whether lenient parsing is enabled (it is off by default). + * + * @return \c TRUE if lenient parsing is enabled, + * \c FALSE otherwise. + * @see #setLenient + * @stable ICU 4.8 + */ + virtual UBool isLenient(void) const; + + /** + * Create a default style NumberFormat for the current default locale. + * The default formatting style is locale dependent. + * @stable ICU 2.0 + */ + static NumberFormat* U_EXPORT2 createInstance(UErrorCode&); + + /** + * Create a default style NumberFormat for the specified locale. + * The default formatting style is locale dependent. + * @param inLocale the given locale. + * @stable ICU 2.0 + */ + static NumberFormat* U_EXPORT2 createInstance(const Locale& inLocale, + UErrorCode&); + + /** + * Create a specific style NumberFormat for the specified locale. + * @param desiredLocale the given locale. + * @param style the given style. + * @param errorCode Output param filled with success/failure status. + * @return A new NumberFormat instance. + * @stable ICU 4.8 + */ + static NumberFormat* U_EXPORT2 createInstance(const Locale& desiredLocale, + UNumberFormatStyle style, + UErrorCode& errorCode); + +#ifndef U_HIDE_INTERNAL_API + + /** + * ICU use only. + * Creates NumberFormat instance without using the cache. + * @internal + */ + static NumberFormat* internalCreateInstance( + const Locale& desiredLocale, + UNumberFormatStyle style, + UErrorCode& errorCode); + + /** + * ICU use only. + * Returns handle to the shared, cached NumberFormat instance for given + * locale. On success, caller must call removeRef() on returned value + * once it is done with the shared instance. + * @internal + */ + static const SharedNumberFormat* U_EXPORT2 createSharedInstance( + const Locale& inLocale, UNumberFormatStyle style, UErrorCode& status); + +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Returns a currency format for the current default locale. + * @stable ICU 2.0 + */ + static NumberFormat* U_EXPORT2 createCurrencyInstance(UErrorCode&); + + /** + * Returns a currency format for the specified locale. + * @param inLocale the given locale. + * @stable ICU 2.0 + */ + static NumberFormat* U_EXPORT2 createCurrencyInstance(const Locale& inLocale, + UErrorCode&); + + /** + * Returns a percentage format for the current default locale. + * @stable ICU 2.0 + */ + static NumberFormat* U_EXPORT2 createPercentInstance(UErrorCode&); + + /** + * Returns a percentage format for the specified locale. + * @param inLocale the given locale. + * @stable ICU 2.0 + */ + static NumberFormat* U_EXPORT2 createPercentInstance(const Locale& inLocale, + UErrorCode&); + + /** + * Returns a scientific format for the current default locale. + * @stable ICU 2.0 + */ + static NumberFormat* U_EXPORT2 createScientificInstance(UErrorCode&); + + /** + * Returns a scientific format for the specified locale. + * @param inLocale the given locale. + * @stable ICU 2.0 + */ + static NumberFormat* U_EXPORT2 createScientificInstance(const Locale& inLocale, + UErrorCode&); + + /** + * Get the set of Locales for which NumberFormats are installed. + * @param count Output param to receive the size of the locales + * @stable ICU 2.0 + */ + static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count); + +#if !UCONFIG_NO_SERVICE + /** + * Register a new NumberFormatFactory. The factory will be adopted. + * Because ICU may choose to cache NumberFormat objects internally, + * this must be called at application startup, prior to any calls to + * NumberFormat::createInstance to avoid undefined behavior. + * @param toAdopt the NumberFormatFactory instance to be adopted + * @param status the in/out status code, no special meanings are assigned + * @return a registry key that can be used to unregister this factory + * @stable ICU 2.6 + */ + static URegistryKey U_EXPORT2 registerFactory(NumberFormatFactory* toAdopt, UErrorCode& status); + + /** + * Unregister a previously-registered NumberFormatFactory using the key returned from the + * register call. Key becomes invalid after a successful call and should not be used again. + * The NumberFormatFactory corresponding to the key will be deleted. + * Because ICU may choose to cache NumberFormat objects internally, + * this should be called during application shutdown, after all calls to + * NumberFormat::createInstance to avoid undefined behavior. + * @param key the registry key returned by a previous call to registerFactory + * @param status the in/out status code, no special meanings are assigned + * @return TRUE if the factory for the key was successfully unregistered + * @stable ICU 2.6 + */ + static UBool U_EXPORT2 unregister(URegistryKey key, UErrorCode& status); + + /** + * Return a StringEnumeration over the locales available at the time of the call, + * including registered locales. + * @return a StringEnumeration over the locales available at the time of the call + * @stable ICU 2.6 + */ + static StringEnumeration* U_EXPORT2 getAvailableLocales(void); +#endif /* UCONFIG_NO_SERVICE */ + + /** + * Returns true if grouping is used in this format. For example, + * in the English locale, with grouping on, the number 1234567 + * might be formatted as "1,234,567". The grouping separator as + * well as the size of each group is locale dependent and is + * determined by sub-classes of NumberFormat. + * @see setGroupingUsed + * @stable ICU 2.0 + */ + UBool isGroupingUsed(void) const; + + /** + * Set whether or not grouping will be used in this format. + * @param newValue True, grouping will be used in this format. + * @see getGroupingUsed + * @stable ICU 2.0 + */ + virtual void setGroupingUsed(UBool newValue); + + /** + * Returns the maximum number of digits allowed in the integer portion of a + * number. + * @return the maximum number of digits allowed in the integer portion of a + * number. + * @see setMaximumIntegerDigits + * @stable ICU 2.0 + */ + int32_t getMaximumIntegerDigits(void) const; + + /** + * Sets the maximum number of digits allowed in the integer portion of a + * number. maximumIntegerDigits must be >= minimumIntegerDigits. If the + * new value for maximumIntegerDigits is less than the current value + * of minimumIntegerDigits, then minimumIntegerDigits will also be set to + * the new value. + * + * @param newValue the new value for the maximum number of digits + * allowed in the integer portion of a number. + * @see getMaximumIntegerDigits + * @stable ICU 2.0 + */ + virtual void setMaximumIntegerDigits(int32_t newValue); + + /** + * Returns the minimum number of digits allowed in the integer portion of a + * number. + * @return the minimum number of digits allowed in the integer portion of a + * number. + * @see setMinimumIntegerDigits + * @stable ICU 2.0 + */ + int32_t getMinimumIntegerDigits(void) const; + + /** + * Sets the minimum number of digits allowed in the integer portion of a + * number. minimumIntegerDigits must be <= maximumIntegerDigits. If the + * new value for minimumIntegerDigits exceeds the current value + * of maximumIntegerDigits, then maximumIntegerDigits will also be set to + * the new value. + * @param newValue the new value to be set. + * @see getMinimumIntegerDigits + * @stable ICU 2.0 + */ + virtual void setMinimumIntegerDigits(int32_t newValue); + + /** + * Returns the maximum number of digits allowed in the fraction portion of a + * number. + * @return the maximum number of digits allowed in the fraction portion of a + * number. + * @see setMaximumFractionDigits + * @stable ICU 2.0 + */ + int32_t getMaximumFractionDigits(void) const; + + /** + * Sets the maximum number of digits allowed in the fraction portion of a + * number. maximumFractionDigits must be >= minimumFractionDigits. If the + * new value for maximumFractionDigits is less than the current value + * of minimumFractionDigits, then minimumFractionDigits will also be set to + * the new value. + * @param newValue the new value to be set. + * @see getMaximumFractionDigits + * @stable ICU 2.0 + */ + virtual void setMaximumFractionDigits(int32_t newValue); + + /** + * Returns the minimum number of digits allowed in the fraction portion of a + * number. + * @return the minimum number of digits allowed in the fraction portion of a + * number. + * @see setMinimumFractionDigits + * @stable ICU 2.0 + */ + int32_t getMinimumFractionDigits(void) const; + + /** + * Sets the minimum number of digits allowed in the fraction portion of a + * number. minimumFractionDigits must be <= maximumFractionDigits. If the + * new value for minimumFractionDigits exceeds the current value + * of maximumFractionDigits, then maximumIntegerDigits will also be set to + * the new value + * @param newValue the new value to be set. + * @see getMinimumFractionDigits + * @stable ICU 2.0 + */ + virtual void setMinimumFractionDigits(int32_t newValue); + + /** + * Sets the currency used to display currency + * amounts. This takes effect immediately, if this format is a + * currency format. If this format is not a currency format, then + * the currency is used if and when this object becomes a + * currency format. + * @param theCurrency a 3-letter ISO code indicating new currency + * to use. It need not be null-terminated. May be the empty + * string or NULL to indicate no currency. + * @param ec input-output error code + * @stable ICU 3.0 + */ + virtual void setCurrency(const char16_t* theCurrency, UErrorCode& ec); + + /** + * Gets the currency used to display currency + * amounts. This may be an empty string for some subclasses. + * @return a 3-letter null-terminated ISO code indicating + * the currency in use, or a pointer to the empty string. + * @stable ICU 2.6 + */ + const char16_t* getCurrency() const; + + /** + * Set a particular UDisplayContext value in the formatter, such as + * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. + * @param value The UDisplayContext value to set. + * @param status Input/output status. If at entry this indicates a failure + * status, the function will do nothing; otherwise this will be + * updated with any new status from the function. + * @stable ICU 53 + */ + virtual void setContext(UDisplayContext value, UErrorCode& status); + + /** + * Get the formatter's UDisplayContext value for the specified UDisplayContextType, + * such as UDISPCTX_TYPE_CAPITALIZATION. + * @param type The UDisplayContextType whose value to return + * @param status Input/output status. If at entry this indicates a failure + * status, the function will do nothing; otherwise this will be + * updated with any new status from the function. + * @return The UDisplayContextValue for the specified type. + * @stable ICU 53 + */ + virtual UDisplayContext getContext(UDisplayContextType type, UErrorCode& status) const; + + /** + * Get the rounding mode. This will always return NumberFormat::ERoundingMode::kRoundUnnecessary + * if the subclass does not support rounding. + * @return A rounding mode + * @draft ICU 60 + */ + virtual ERoundingMode getRoundingMode(void) const; + + /** + * Set the rounding mode. If a subclass does not support rounding, this will do nothing. + * @param roundingMode A rounding mode + * @draft ICU 60 + */ + virtual void setRoundingMode(ERoundingMode roundingMode); + +public: + + /** + * Return the class ID for this class. This is useful for + * comparing to a return value from getDynamicClassID(). Note that, + * because NumberFormat is an abstract base class, no fully constructed object + * will have the class ID returned by NumberFormat::getStaticClassID(). + * @return The class ID for all objects of this class. + * @stable ICU 2.0 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. + * This method is to implement a simple version of RTTI, since not all + * C++ compilers support genuine RTTI. Polymorphic operator==() and + * clone() methods call this method. + *

+ * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @stable ICU 2.0 + */ + virtual UClassID getDynamicClassID(void) const = 0; + +protected: + + /** + * Default constructor for subclass use only. + * @stable ICU 2.0 + */ + NumberFormat(); + + /** + * Copy constructor. + * @stable ICU 2.0 + */ + NumberFormat(const NumberFormat&); + + /** + * Assignment operator. + * @stable ICU 2.0 + */ + NumberFormat& operator=(const NumberFormat&); + + /** + * Returns the currency in effect for this formatter. Subclasses + * should override this method as needed. Unlike getCurrency(), + * this method should never return "". + * @result output parameter for null-terminated result, which must + * have a capacity of at least 4 + * @internal + */ + virtual void getEffectiveCurrency(char16_t* result, UErrorCode& ec) const; + +#ifndef U_HIDE_INTERNAL_API + /** + * Creates the specified number format style of the desired locale. + * If mustBeDecimalFormat is TRUE, then the returned pointer is + * either a DecimalFormat or it is NULL. + * @internal + */ + static NumberFormat* makeInstance(const Locale& desiredLocale, + UNumberFormatStyle style, + UBool mustBeDecimalFormat, + UErrorCode& errorCode); +#endif /* U_HIDE_INTERNAL_API */ + +private: + + static UBool isStyleSupported(UNumberFormatStyle style); + + /** + * Creates the specified decimal format style of the desired locale. + * @param desiredLocale the given locale. + * @param style the given style. + * @param errorCode Output param filled with success/failure status. + * @return A new NumberFormat instance. + */ + static NumberFormat* makeInstance(const Locale& desiredLocale, + UNumberFormatStyle style, + UErrorCode& errorCode); + + UBool fGroupingUsed; + int32_t fMaxIntegerDigits; + int32_t fMinIntegerDigits; + int32_t fMaxFractionDigits; + int32_t fMinFractionDigits; + + protected: + /** \internal */ + static const int32_t gDefaultMaxIntegerDigits; + /** \internal */ + static const int32_t gDefaultMinIntegerDigits; + + private: + UBool fParseIntegerOnly; + UBool fLenient; // TRUE => lenient parse is enabled + + // ISO currency code + char16_t fCurrency[4]; + + UDisplayContext fCapitalizationContext; + + friend class ICUNumberFormatFactory; // access to makeInstance + friend class ICUNumberFormatService; + friend class ::NumberFormatTest; // access to isStyleSupported() +}; + +#if !UCONFIG_NO_SERVICE +/** + * A NumberFormatFactory is used to register new number formats. The factory + * should be able to create any of the predefined formats for each locale it + * supports. When registered, the locales it supports extend or override the + * locale already supported by ICU. + * + * @stable ICU 2.6 + */ +class U_I18N_API NumberFormatFactory : public UObject { +public: + + /** + * Destructor + * @stable ICU 3.0 + */ + virtual ~NumberFormatFactory(); + + /** + * Return true if this factory will be visible. Default is true. + * If not visible, the locales supported by this factory will not + * be listed by getAvailableLocales. + * @stable ICU 2.6 + */ + virtual UBool visible(void) const = 0; + + /** + * Return the locale names directly supported by this factory. The number of names + * is returned in count; + * @stable ICU 2.6 + */ + virtual const UnicodeString * getSupportedIDs(int32_t &count, UErrorCode& status) const = 0; + + /** + * Return a number format of the appropriate type. If the locale + * is not supported, return null. If the locale is supported, but + * the type is not provided by this service, return null. Otherwise + * return an appropriate instance of NumberFormat. + * @stable ICU 2.6 + */ + virtual NumberFormat* createFormat(const Locale& loc, UNumberFormatStyle formatType) = 0; +}; + +/** + * A NumberFormatFactory that supports a single locale. It can be visible or invisible. + * @stable ICU 2.6 + */ +class U_I18N_API SimpleNumberFormatFactory : public NumberFormatFactory { +protected: + /** + * True if the locale supported by this factory is visible. + * @stable ICU 2.6 + */ + const UBool _visible; + + /** + * The locale supported by this factory, as a UnicodeString. + * @stable ICU 2.6 + */ + UnicodeString _id; + +public: + /** + * @stable ICU 2.6 + */ + SimpleNumberFormatFactory(const Locale& locale, UBool visible = TRUE); + + /** + * @stable ICU 3.0 + */ + virtual ~SimpleNumberFormatFactory(); + + /** + * @stable ICU 2.6 + */ + virtual UBool visible(void) const; + + /** + * @stable ICU 2.6 + */ + virtual const UnicodeString * getSupportedIDs(int32_t &count, UErrorCode& status) const; +}; +#endif /* #if !UCONFIG_NO_SERVICE */ + +// ------------------------------------- + +inline UBool +NumberFormat::isParseIntegerOnly() const +{ + return fParseIntegerOnly; +} + +inline UBool +NumberFormat::isLenient() const +{ + return fLenient; +} + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // _NUMFMT +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/numsys.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/numsys.h new file mode 100644 index 0000000..9ec3f13 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/numsys.h @@ -0,0 +1,210 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2010-2014, International Business Machines Corporation and +* others. All Rights Reserved. +******************************************************************************* +* +* +* File NUMSYS.H +* +* Modification History:* +* Date Name Description +* +******************************************************************************** +*/ + +#ifndef NUMSYS +#define NUMSYS + +#include "unicode/utypes.h" + +/** + * \def NUMSYS_NAME_CAPACITY + * Size of a numbering system name. + * @internal + */ +#define NUMSYS_NAME_CAPACITY 8 + + +/** + * \file + * \brief C++ API: NumberingSystem object + */ + +#if !UCONFIG_NO_FORMATTING + + +#include "unicode/format.h" +#include "unicode/uobject.h" + +U_NAMESPACE_BEGIN + +/** + * Defines numbering systems. A numbering system describes the scheme by which + * numbers are to be presented to the end user. In its simplest form, a numbering + * system describes the set of digit characters that are to be used to display + * numbers, such as Western digits, Thai digits, Arabic-Indic digits, etc., in a + * positional numbering system with a specified radix (typically 10). + * More complicated numbering systems are algorithmic in nature, and require use + * of an RBNF formatter ( rule based number formatter ), in order to calculate + * the characters to be displayed for a given number. Examples of algorithmic + * numbering systems include Roman numerals, Chinese numerals, and Hebrew numerals. + * Formatting rules for many commonly used numbering systems are included in + * the ICU package, based on the numbering system rules defined in CLDR. + * Alternate numbering systems can be specified to a locale by using the + * numbers locale keyword. + */ + +class U_I18N_API NumberingSystem : public UObject { +public: + + /** + * Default Constructor. + * + * @stable ICU 4.2 + */ + NumberingSystem(); + + /** + * Copy constructor. + * @stable ICU 4.2 + */ + NumberingSystem(const NumberingSystem& other); + + /** + * Destructor. + * @stable ICU 4.2 + */ + virtual ~NumberingSystem(); + + /** + * Create the default numbering system associated with the specified locale. + * @param inLocale The given locale. + * @param status ICU status + * @stable ICU 4.2 + */ + static NumberingSystem* U_EXPORT2 createInstance(const Locale & inLocale, UErrorCode& status); + + /** + * Create the default numbering system associated with the default locale. + * @stable ICU 4.2 + */ + static NumberingSystem* U_EXPORT2 createInstance(UErrorCode& status); + + /** + * Create a numbering system using the specified radix, type, and description. + * @param radix The radix (base) for this numbering system. + * @param isAlgorithmic TRUE if the numbering system is algorithmic rather than numeric. + * @param description The string representing the set of digits used in a numeric system, or the name of the RBNF + * ruleset to be used in an algorithmic system. + * @param status ICU status + * @stable ICU 4.2 + */ + static NumberingSystem* U_EXPORT2 createInstance(int32_t radix, UBool isAlgorithmic, const UnicodeString& description, UErrorCode& status ); + + /** + * Return a StringEnumeration over all the names of numbering systems known to ICU. + * @stable ICU 4.2 + */ + + static StringEnumeration * U_EXPORT2 getAvailableNames(UErrorCode& status); + + /** + * Create a numbering system from one of the predefined numbering systems specified + * by CLDR and known to ICU, such as "latn", "arabext", or "hanidec"; the full list + * is returned by unumsys_openAvailableNames. Note that some of the names listed at + * http://unicode.org/repos/cldr/tags/latest/common/bcp47/number.xml - e.g. + * default, native, traditional, finance - do not identify specific numbering systems, + * but rather key values that may only be used as part of a locale, which in turn + * defines how they are mapped to a specific numbering system such as "latn" or "hant". + * @param name The name of the numbering system. + * @param status ICU status + * @stable ICU 4.2 + */ + static NumberingSystem* U_EXPORT2 createInstanceByName(const char* name, UErrorCode& status); + + + /** + * Returns the radix of this numbering system. Simple positional numbering systems + * typically have radix 10, but might have a radix of e.g. 16 for hexadecimal. The + * radix is less well-defined for non-positional algorithmic systems. + * @stable ICU 4.2 + */ + int32_t getRadix() const; + + /** + * Returns the name of this numbering system if it was created using one of the predefined names + * known to ICU. Otherwise, returns NULL. + * The predefined names are identical to the numbering system names as defined by + * the BCP47 definition in Unicode CLDR. + * See also, http://www.unicode.org/repos/cldr/tags/latest/common/bcp47/number.xml + * @stable ICU 4.6 + */ + const char * getName() const; + + /** + * Returns the description string of this numbering system. For simple + * positional systems this is the ordered string of digits (with length matching + * the radix), e.g. "\u3007\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D" + * for "hanidec"; it would be "0123456789ABCDEF" for hexadecimal. For + * algorithmic systems this is the name of the RBNF ruleset used for formatting, + * e.g. "zh/SpelloutRules/%spellout-cardinal" for "hans" or "%greek-upper" for + * "grek". + * @stable ICU 4.2 + */ + virtual UnicodeString getDescription() const; + + + + /** + * Returns TRUE if the given numbering system is algorithmic + * + * @return TRUE if the numbering system is algorithmic. + * Otherwise, return FALSE. + * @stable ICU 4.2 + */ + UBool isAlgorithmic() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 4.2 + * + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 4.2 + */ + virtual UClassID getDynamicClassID() const; + + +private: + UnicodeString desc; + int32_t radix; + UBool algorithmic; + char name[NUMSYS_NAME_CAPACITY+1]; + + void setRadix(int32_t radix); + + void setAlgorithmic(UBool algorithmic); + + void setDesc(const UnicodeString &desc); + + void setName(const char* name); + + static UBool isValidDigitString(const UnicodeString &str); + + UBool hasContiguousDecimalDigits() const; +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // _NUMSYS +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/parseerr.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/parseerr.h new file mode 100644 index 0000000..fc1e3f4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/parseerr.h @@ -0,0 +1,94 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2005, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Date Name Description +* 03/14/00 aliu Creation. +* 06/27/00 aliu Change from C++ class to C struct +********************************************************************** +*/ +#ifndef PARSEERR_H +#define PARSEERR_H + +#include "unicode/utypes.h" + + +/** + * \file + * \brief C API: Parse Error Information + */ +/** + * The capacity of the context strings in UParseError. + * @stable ICU 2.0 + */ +enum { U_PARSE_CONTEXT_LEN = 16 }; + +/** + * A UParseError struct is used to returned detailed information about + * parsing errors. It is used by ICU parsing engines that parse long + * rules, patterns, or programs, where the text being parsed is long + * enough that more information than a UErrorCode is needed to + * localize the error. + * + *

The line, offset, and context fields are optional; parsing + * engines may choose not to use to use them. + * + *

The preContext and postContext strings include some part of the + * context surrounding the error. If the source text is "let for=7" + * and "for" is the error (e.g., because it is a reserved word), then + * some examples of what a parser might produce are the following: + * + *

+ * preContext   postContext
+ * ""           ""            The parser does not support context
+ * "let "       "=7"          Pre- and post-context only
+ * "let "       "for=7"       Pre- and post-context and error text
+ * ""           "for"         Error text only
+ * 
+ * + *

Examples of engines which use UParseError (or may use it in the + * future) are Transliterator, RuleBasedBreakIterator, and + * RegexPattern. + * + * @stable ICU 2.0 + */ +typedef struct UParseError { + + /** + * The line on which the error occured. If the parser uses this + * field, it sets it to the line number of the source text line on + * which the error appears, which will be be a value >= 1. If the + * parse does not support line numbers, the value will be <= 0. + * @stable ICU 2.0 + */ + int32_t line; + + /** + * The character offset to the error. If the line field is >= 1, + * then this is the offset from the start of the line. Otherwise, + * this is the offset from the start of the text. If the parser + * does not support this field, it will have a value < 0. + * @stable ICU 2.0 + */ + int32_t offset; + + /** + * Textual context before the error. Null-terminated. The empty + * string if not supported by parser. + * @stable ICU 2.0 + */ + UChar preContext[U_PARSE_CONTEXT_LEN]; + + /** + * The error itself and/or textual context after the error. + * Null-terminated. The empty string if not supported by parser. + * @stable ICU 2.0 + */ + UChar postContext[U_PARSE_CONTEXT_LEN]; + +} UParseError; + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/parsepos.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/parsepos.h new file mode 100644 index 0000000..bbebca7 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/parsepos.h @@ -0,0 +1,232 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +* Copyright (C) 1997-2005, International Business Machines Corporation and others. All Rights Reserved. +******************************************************************************* +* +* File PARSEPOS.H +* +* Modification History: +* +* Date Name Description +* 07/09/97 helena Converted from java. +* 07/17/98 stephen Added errorIndex support. +* 05/11/99 stephen Cleaned up. +******************************************************************************* +*/ + +#ifndef PARSEPOS_H +#define PARSEPOS_H + +#include "unicode/utypes.h" +#include "unicode/uobject.h" + + +U_NAMESPACE_BEGIN + +/** + * \file + * \brief C++ API: Canonical Iterator + */ +/** + * ParsePosition is a simple class used by Format + * and its subclasses to keep track of the current position during parsing. + * The parseObject method in the various Format + * classes requires a ParsePosition object as an argument. + * + *

+ * By design, as you parse through a string with different formats, + * you can use the same ParsePosition, since the index parameter + * records the current position. + * + * The ParsePosition class is not suitable for subclassing. + * + * @version 1.3 10/30/97 + * @author Mark Davis, Helena Shih + * @see java.text.Format + */ + +class U_COMMON_API ParsePosition : public UObject { +public: + /** + * Default constructor, the index starts with 0 as default. + * @stable ICU 2.0 + */ + ParsePosition() + : UObject(), + index(0), + errorIndex(-1) + {} + + /** + * Create a new ParsePosition with the given initial index. + * @param newIndex the new text offset. + * @stable ICU 2.0 + */ + ParsePosition(int32_t newIndex) + : UObject(), + index(newIndex), + errorIndex(-1) + {} + + /** + * Copy constructor + * @param copy the object to be copied from. + * @stable ICU 2.0 + */ + ParsePosition(const ParsePosition& copy) + : UObject(copy), + index(copy.index), + errorIndex(copy.errorIndex) + {} + + /** + * Destructor + * @stable ICU 2.0 + */ + virtual ~ParsePosition(); + + /** + * Assignment operator + * @stable ICU 2.0 + */ + ParsePosition& operator=(const ParsePosition& copy); + + /** + * Equality operator. + * @return TRUE if the two parse positions are equal, FALSE otherwise. + * @stable ICU 2.0 + */ + UBool operator==(const ParsePosition& that) const; + + /** + * Equality operator. + * @return TRUE if the two parse positions are not equal, FALSE otherwise. + * @stable ICU 2.0 + */ + UBool operator!=(const ParsePosition& that) const; + + /** + * Clone this object. + * Clones can be used concurrently in multiple threads. + * If an error occurs, then NULL is returned. + * The caller must delete the clone. + * + * @return a clone of this object + * + * @see getDynamicClassID + * @stable ICU 2.8 + */ + ParsePosition *clone() const; + + /** + * Retrieve the current parse position. On input to a parse method, this + * is the index of the character at which parsing will begin; on output, it + * is the index of the character following the last character parsed. + * @return the current index. + * @stable ICU 2.0 + */ + int32_t getIndex(void) const; + + /** + * Set the current parse position. + * @param index the new index. + * @stable ICU 2.0 + */ + void setIndex(int32_t index); + + /** + * Set the index at which a parse error occurred. Formatters + * should set this before returning an error code from their + * parseObject method. The default value is -1 if this is not + * set. + * @stable ICU 2.0 + */ + void setErrorIndex(int32_t ei); + + /** + * Retrieve the index at which an error occurred, or -1 if the + * error index has not been set. + * @stable ICU 2.0 + */ + int32_t getErrorIndex(void) const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.2 + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.2 + */ + virtual UClassID getDynamicClassID() const; + +private: + /** + * Input: the place you start parsing. + *
Output: position where the parse stopped. + * This is designed to be used serially, + * with each call setting index up for the next one. + */ + int32_t index; + + /** + * The index at which a parse error occurred. + */ + int32_t errorIndex; + +}; + +inline ParsePosition& +ParsePosition::operator=(const ParsePosition& copy) +{ + index = copy.index; + errorIndex = copy.errorIndex; + return *this; +} + +inline UBool +ParsePosition::operator==(const ParsePosition& copy) const +{ + if(index != copy.index || errorIndex != copy.errorIndex) + return FALSE; + else + return TRUE; +} + +inline UBool +ParsePosition::operator!=(const ParsePosition& copy) const +{ + return !operator==(copy); +} + +inline int32_t +ParsePosition::getIndex() const +{ + return index; +} + +inline void +ParsePosition::setIndex(int32_t offset) +{ + this->index = offset; +} + +inline int32_t +ParsePosition::getErrorIndex() const +{ + return errorIndex; +} + +inline void +ParsePosition::setErrorIndex(int32_t ei) +{ + this->errorIndex = ei; +} +U_NAMESPACE_END + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/platform.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/platform.h new file mode 100644 index 0000000..f220b1f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/platform.h @@ -0,0 +1,863 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1997-2016, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* +* FILE NAME : platform.h +* +* Date Name Description +* 05/13/98 nos Creation (content moved here from ptypes.h). +* 03/02/99 stephen Added AS400 support. +* 03/30/99 stephen Added Linux support. +* 04/13/99 stephen Reworked for autoconf. +****************************************************************************** +*/ + +#ifndef _PLATFORM_H +#define _PLATFORM_H + +#include "unicode/uconfig.h" +#include "unicode/uvernum.h" + +/** + * \file + * \brief Basic types for the platform. + * + * This file used to be generated by autoconf/configure. + * Starting with ICU 49, platform.h is a normal source file, + * to simplify cross-compiling and working with non-autoconf/make build systems. + * + * When a value in this file does not work on a platform, then please + * try to derive it from the U_PLATFORM value + * (for which we might need a new value constant in rare cases) + * and/or from other macros that are predefined by the compiler + * or defined in standard (POSIX or platform or compiler) headers. + * + * As a temporary workaround, you can add an explicit #define for some macros + * before it is first tested, or add an equivalent -D macro definition + * to the compiler's command line. + * + * Note: Some compilers provide ways to show the predefined macros. + * For example, with gcc you can compile an empty .c file and have the compiler + * print the predefined macros with + * \code + * gcc -E -dM -x c /dev/null | sort + * \endcode + * (You can provide an actual empty .c file rather than /dev/null. + * -x c++ is for C++.) + */ + +/** + * Define some things so that they can be documented. + * @internal + */ +#ifdef U_IN_DOXYGEN +/* + * Problem: "platform.h:335: warning: documentation for unknown define U_HAVE_STD_STRING found." means that U_HAVE_STD_STRING is not documented. + * Solution: #define any defines for non @internal API here, so that they are visible in the docs. If you just set PREDEFINED in Doxyfile.in, they won't be documented. + */ + +/* None for now. */ +#endif + +/** + * \def U_PLATFORM + * The U_PLATFORM macro defines the platform we're on. + * + * We used to define one different, value-less macro per platform. + * That made it hard to know the set of relevant platforms and macros, + * and hard to deal with variants of platforms. + * + * Starting with ICU 49, we define platforms as numeric macros, + * with ranges of values for related platforms and their variants. + * The U_PLATFORM macro is set to one of these values. + * + * Historical note from the Solaris Wikipedia article: + * AT&T and Sun collaborated on a project to merge the most popular Unix variants + * on the market at that time: BSD, System V, and Xenix. + * This became Unix System V Release 4 (SVR4). + * + * @internal + */ + +/** Unknown platform. @internal */ +#define U_PF_UNKNOWN 0 +/** Windows @internal */ +#define U_PF_WINDOWS 1000 +/** MinGW. Windows, calls to Win32 API, but using GNU gcc and binutils. @internal */ +#define U_PF_MINGW 1800 +/** + * Cygwin. Windows, calls to cygwin1.dll for Posix functions, + * using MSVC or GNU gcc and binutils. + * @internal + */ +#define U_PF_CYGWIN 1900 +/* Reserve 2000 for U_PF_UNIX? */ +/** HP-UX is based on UNIX System V. @internal */ +#define U_PF_HPUX 2100 +/** Solaris is a Unix operating system based on SVR4. @internal */ +#define U_PF_SOLARIS 2600 +/** BSD is a UNIX operating system derivative. @internal */ +#define U_PF_BSD 3000 +/** AIX is based on UNIX System V Releases and 4.3 BSD. @internal */ +#define U_PF_AIX 3100 +/** IRIX is based on UNIX System V with BSD extensions. @internal */ +#define U_PF_IRIX 3200 +/** + * Darwin is a POSIX-compliant operating system, composed of code developed by Apple, + * as well as code derived from NeXTSTEP, BSD, and other projects, + * built around the Mach kernel. + * Darwin forms the core set of components upon which Mac OS X, Apple TV, and iOS are based. + * (Original description modified from WikiPedia.) + * @internal + */ +#define U_PF_DARWIN 3500 +/** iPhone OS (iOS) is a derivative of Mac OS X. @internal */ +#define U_PF_IPHONE 3550 +/** QNX is a commercial Unix-like real-time operating system related to BSD. @internal */ +#define U_PF_QNX 3700 +/** Linux is a Unix-like operating system. @internal */ +#define U_PF_LINUX 4000 +/** + * Native Client is pretty close to Linux. + * See https://developer.chrome.com/native-client and + * http://www.chromium.org/nativeclient + * @internal + */ +#define U_PF_BROWSER_NATIVE_CLIENT 4020 +/** Android is based on Linux. @internal */ +#define U_PF_ANDROID 4050 +/** Fuchsia is a POSIX-ish platform. @internal */ +#define U_PF_FUCHSIA 4100 +/* Maximum value for Linux-based platform is 4499 */ +/** z/OS is the successor to OS/390 which was the successor to MVS. @internal */ +#define U_PF_OS390 9000 +/** "IBM i" is the current name of what used to be i5/OS and earlier OS/400. @internal */ +#define U_PF_OS400 9400 + +#ifdef U_PLATFORM + /* Use the predefined value. */ +#elif defined(__MINGW32__) +# define U_PLATFORM U_PF_MINGW +#elif defined(__CYGWIN__) +# define U_PLATFORM U_PF_CYGWIN +#elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) +# define U_PLATFORM U_PF_WINDOWS +#elif defined(__ANDROID__) +# define U_PLATFORM U_PF_ANDROID + /* Android wchar_t support depends on the API level. */ +# include +#elif defined(__pnacl__) || defined(__native_client__) +# define U_PLATFORM U_PF_BROWSER_NATIVE_CLIENT +#elif defined(__Fuchsia__) +# define U_PLATFORM U_PF_FUCHSIA +#elif defined(linux) || defined(__linux__) || defined(__linux) +# define U_PLATFORM U_PF_LINUX +#elif defined(__APPLE__) && defined(__MACH__) +# include +# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE /* variant of TARGET_OS_MAC */ +# define U_PLATFORM U_PF_IPHONE +# else +# define U_PLATFORM U_PF_DARWIN +# endif +#elif defined(BSD) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__MirBSD__) +# if defined(__FreeBSD__) +# include +# endif +# define U_PLATFORM U_PF_BSD +#elif defined(sun) || defined(__sun) + /* Check defined(__SVR4) || defined(__svr4__) to distinguish Solaris from SunOS? */ +# define U_PLATFORM U_PF_SOLARIS +# if defined(__GNUC__) + /* Solaris/GCC needs this header file to get the proper endianness. Normally, this + * header file is included with stddef.h but on Solairs/GCC, the GCC version of stddef.h + * is included which does not include this header file. + */ +# include +# endif +#elif defined(_AIX) || defined(__TOS_AIX__) +# define U_PLATFORM U_PF_AIX +#elif defined(_hpux) || defined(hpux) || defined(__hpux) +# define U_PLATFORM U_PF_HPUX +#elif defined(sgi) || defined(__sgi) +# define U_PLATFORM U_PF_IRIX +#elif defined(__QNX__) || defined(__QNXNTO__) +# define U_PLATFORM U_PF_QNX +#elif defined(__TOS_MVS__) +# define U_PLATFORM U_PF_OS390 +#elif defined(__OS400__) || defined(__TOS_OS400__) +# define U_PLATFORM U_PF_OS400 +#else +# define U_PLATFORM U_PF_UNKNOWN +#endif + +/** + * \def UPRV_INCOMPLETE_CPP11_SUPPORT + * This switch turns off ICU 60 NumberFormatter code. + * By default, this switch is enabled on AIX and z/OS, + * which have poor C++11 support. + * + * NOTE: This switch is intended to be temporary; see #13393. + * + * @internal + */ +#ifndef UPRV_INCOMPLETE_CPP11_SUPPORT +# define UPRV_INCOMPLETE_CPP11_SUPPORT (U_PLATFORM == U_PF_AIX || U_PLATFORM == U_PF_OS390 || U_PLATFORM == U_PF_SOLARIS ) +#endif + +/** + * \def CYGWINMSVC + * Defined if this is Windows with Cygwin, but using MSVC rather than gcc. + * Otherwise undefined. + * @internal + */ +/* Commented out because this is already set in mh-cygwin-msvc +#if U_PLATFORM == U_PF_CYGWIN && defined(_MSC_VER) +# define CYGWINMSVC +#endif +*/ + +/** + * \def U_PLATFORM_USES_ONLY_WIN32_API + * Defines whether the platform uses only the Win32 API. + * Set to 1 for Windows/MSVC and MinGW but not Cygwin. + * @internal + */ +#ifdef U_PLATFORM_USES_ONLY_WIN32_API + /* Use the predefined value. */ +#elif (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_MINGW) || defined(CYGWINMSVC) +# define U_PLATFORM_USES_ONLY_WIN32_API 1 +#else + /* Cygwin implements POSIX. */ +# define U_PLATFORM_USES_ONLY_WIN32_API 0 +#endif + +/** + * \def U_PLATFORM_HAS_WIN32_API + * Defines whether the Win32 API is available on the platform. + * Set to 1 for Windows/MSVC, MinGW and Cygwin. + * @internal + */ +#ifdef U_PLATFORM_HAS_WIN32_API + /* Use the predefined value. */ +#elif U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN +# define U_PLATFORM_HAS_WIN32_API 1 +#else +# define U_PLATFORM_HAS_WIN32_API 0 +#endif + +/** + * \def U_PLATFORM_HAS_WINUWP_API + * Defines whether target is intended for Universal Windows Platform API + * Set to 1 for Windows10 Release Solution Configuration + * @internal + */ +#ifdef U_PLATFORM_HAS_WINUWP_API + /* Use the predefined value. */ +#else +# define U_PLATFORM_HAS_WINUWP_API 0 +#endif + +/** + * \def U_PLATFORM_IMPLEMENTS_POSIX + * Defines whether the platform implements (most of) the POSIX API. + * Set to 1 for Cygwin and most other platforms. + * @internal + */ +#ifdef U_PLATFORM_IMPLEMENTS_POSIX + /* Use the predefined value. */ +#elif U_PLATFORM_USES_ONLY_WIN32_API +# define U_PLATFORM_IMPLEMENTS_POSIX 0 +#else +# define U_PLATFORM_IMPLEMENTS_POSIX 1 +#endif + +/** + * \def U_PLATFORM_IS_LINUX_BASED + * Defines whether the platform is Linux or one of its derivatives. + * @internal + */ +#ifdef U_PLATFORM_IS_LINUX_BASED + /* Use the predefined value. */ +#elif U_PF_LINUX <= U_PLATFORM && U_PLATFORM <= 4499 +# define U_PLATFORM_IS_LINUX_BASED 1 +#else +# define U_PLATFORM_IS_LINUX_BASED 0 +#endif + +/** + * \def U_PLATFORM_IS_DARWIN_BASED + * Defines whether the platform is Darwin or one of its derivatives. + * @internal + */ +#ifdef U_PLATFORM_IS_DARWIN_BASED + /* Use the predefined value. */ +#elif U_PF_DARWIN <= U_PLATFORM && U_PLATFORM <= U_PF_IPHONE +# define U_PLATFORM_IS_DARWIN_BASED 1 +#else +# define U_PLATFORM_IS_DARWIN_BASED 0 +#endif + +/** + * \def U_HAVE_STDINT_H + * Defines whether stdint.h is available. It is a C99 standard header. + * We used to include inttypes.h which includes stdint.h but we usually do not need + * the additional definitions from inttypes.h. + * @internal + */ +#ifdef U_HAVE_STDINT_H + /* Use the predefined value. */ +#elif U_PLATFORM_USES_ONLY_WIN32_API +# if defined(__BORLANDC__) || U_PLATFORM == U_PF_MINGW || (defined(_MSC_VER) && _MSC_VER>=1600) + /* Windows Visual Studio 9 and below do not have stdint.h & inttypes.h, but VS 2010 adds them. */ +# define U_HAVE_STDINT_H 1 +# else +# define U_HAVE_STDINT_H 0 +# endif +#elif U_PLATFORM == U_PF_SOLARIS + /* Solaris has inttypes.h but not stdint.h. */ +# define U_HAVE_STDINT_H 0 +#elif U_PLATFORM == U_PF_AIX && !defined(_AIX51) && defined(_POWER) + /* PPC AIX <= 4.3 has inttypes.h but not stdint.h. */ +# define U_HAVE_STDINT_H 0 +#else +# define U_HAVE_STDINT_H 1 +#endif + +/** + * \def U_HAVE_INTTYPES_H + * Defines whether inttypes.h is available. It is a C99 standard header. + * We include inttypes.h where it is available but stdint.h is not. + * @internal + */ +#ifdef U_HAVE_INTTYPES_H + /* Use the predefined value. */ +#elif U_PLATFORM == U_PF_SOLARIS + /* Solaris has inttypes.h but not stdint.h. */ +# define U_HAVE_INTTYPES_H 1 +#elif U_PLATFORM == U_PF_AIX && !defined(_AIX51) && defined(_POWER) + /* PPC AIX <= 4.3 has inttypes.h but not stdint.h. */ +# define U_HAVE_INTTYPES_H 1 +#else + /* Most platforms have both inttypes.h and stdint.h, or neither. */ +# define U_HAVE_INTTYPES_H U_HAVE_STDINT_H +#endif + +/*===========================================================================*/ +/** @{ Compiler and environment features */ +/*===========================================================================*/ + +/** + * \def U_GCC_MAJOR_MINOR + * Indicates whether the compiler is gcc (test for != 0), + * and if so, contains its major (times 100) and minor version numbers. + * If the compiler is not gcc, then U_GCC_MAJOR_MINOR == 0. + * + * For example, for testing for whether we have gcc, and whether it's 4.6 or higher, + * use "#if U_GCC_MAJOR_MINOR >= 406". + * @internal + */ +#ifdef __GNUC__ +# define U_GCC_MAJOR_MINOR (__GNUC__ * 100 + __GNUC_MINOR__) +#else +# define U_GCC_MAJOR_MINOR 0 +#endif + +/** + * \def U_IS_BIG_ENDIAN + * Determines the endianness of the platform. + * @internal + */ +#ifdef U_IS_BIG_ENDIAN + /* Use the predefined value. */ +#elif defined(BYTE_ORDER) && defined(BIG_ENDIAN) +# define U_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN) +#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) + /* gcc */ +# define U_IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) +#elif defined(__BIG_ENDIAN__) || defined(_BIG_ENDIAN) +# define U_IS_BIG_ENDIAN 1 +#elif defined(__LITTLE_ENDIAN__) || defined(_LITTLE_ENDIAN) +# define U_IS_BIG_ENDIAN 0 +#elif U_PLATFORM == U_PF_OS390 || U_PLATFORM == U_PF_OS400 || defined(__s390__) || defined(__s390x__) + /* These platforms do not appear to predefine any endianness macros. */ +# define U_IS_BIG_ENDIAN 1 +#elif defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0) + /* HPPA do not appear to predefine any endianness macros. */ +# define U_IS_BIG_ENDIAN 1 +#elif defined(sparc) || defined(__sparc) || defined(__sparc__) + /* Some sparc based systems (e.g. Linux) do not predefine any endianness macros. */ +# define U_IS_BIG_ENDIAN 1 +#else +# define U_IS_BIG_ENDIAN 0 +#endif + +/** + * \def U_HAVE_PLACEMENT_NEW + * Determines whether to override placement new and delete for STL. + * @stable ICU 2.6 + */ +#ifdef U_HAVE_PLACEMENT_NEW + /* Use the predefined value. */ +#elif defined(__BORLANDC__) +# define U_HAVE_PLACEMENT_NEW 0 +#else +# define U_HAVE_PLACEMENT_NEW 1 +#endif + +/** + * \def U_HAVE_DEBUG_LOCATION_NEW + * Define this to define the MFC debug version of the operator new. + * + * @stable ICU 3.4 + */ +#ifdef U_HAVE_DEBUG_LOCATION_NEW + /* Use the predefined value. */ +#elif defined(_MSC_VER) +# define U_HAVE_DEBUG_LOCATION_NEW 1 +#else +# define U_HAVE_DEBUG_LOCATION_NEW 0 +#endif + +/* Compatibility with compilers other than clang: http://clang.llvm.org/docs/LanguageExtensions.html */ +#ifndef __has_attribute +# define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute +# define __has_cpp_attribute(x) 0 +#endif +#ifndef __has_builtin +# define __has_builtin(x) 0 +#endif +#ifndef __has_feature +# define __has_feature(x) 0 +#endif +#ifndef __has_extension +# define __has_extension(x) 0 +#endif +#ifndef __has_warning +# define __has_warning(x) 0 +#endif + +/** + * \def U_MALLOC_ATTR + * Attribute to mark functions as malloc-like + * @internal + */ +#if defined(__GNUC__) && __GNUC__>=3 +# define U_MALLOC_ATTR __attribute__ ((__malloc__)) +#else +# define U_MALLOC_ATTR +#endif + +/** + * \def U_ALLOC_SIZE_ATTR + * Attribute to specify the size of the allocated buffer for malloc-like functions + * @internal + */ +#if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) || __has_attribute(alloc_size) +# define U_ALLOC_SIZE_ATTR(X) __attribute__ ((alloc_size(X))) +# define U_ALLOC_SIZE_ATTR2(X,Y) __attribute__ ((alloc_size(X,Y))) +#else +# define U_ALLOC_SIZE_ATTR(X) +# define U_ALLOC_SIZE_ATTR2(X,Y) +#endif + +/** + * \def U_CPLUSPLUS_VERSION + * 0 if no C++; 1, 11, 14, ... if C++. + * Support for specific features cannot always be determined by the C++ version alone. + * @internal + */ +#ifdef U_CPLUSPLUS_VERSION +# if U_CPLUSPLUS_VERSION != 0 && !defined(__cplusplus) +# undef U_CPLUSPLUS_VERSION +# define U_CPLUSPLUS_VERSION 0 +# endif + /* Otherwise use the predefined value. */ +#elif !defined(__cplusplus) +# define U_CPLUSPLUS_VERSION 0 +#elif __cplusplus >= 201402L +# define U_CPLUSPLUS_VERSION 14 +#elif __cplusplus >= 201103L +# define U_CPLUSPLUS_VERSION 11 +#else + // C++98 or C++03 +# define U_CPLUSPLUS_VERSION 1 +#endif + +#if (U_PLATFORM == U_PF_AIX || U_PLATFORM == U_PF_OS390) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11) +// add in std::nullptr_t +namespace std { + typedef decltype(nullptr) nullptr_t; +}; +#endif + +/** + * \def U_NOEXCEPT + * "noexcept" if supported, otherwise empty. + * Some code, especially STL containers, uses move semantics of objects only + * if the move constructor and the move operator are declared as not throwing exceptions. + * @internal + */ +#ifdef U_NOEXCEPT + /* Use the predefined value. */ +#elif defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS /* Visual Studio */ +# define U_NOEXCEPT +#elif U_CPLUSPLUS_VERSION >= 11 || __has_feature(cxx_noexcept) || __has_extension(cxx_noexcept) \ + || (defined(_MSC_VER) && _MSC_VER >= 1900) /* Visual Studio 2015 */ +# define U_NOEXCEPT noexcept +#else +# define U_NOEXCEPT +#endif + +/** + * \def U_FALLTHROUGH + * Annotate intentional fall-through between switch labels. + * http://clang.llvm.org/docs/AttributeReference.html#fallthrough-clang-fallthrough + * @internal + */ +#ifndef __cplusplus + // Not for C. +#elif defined(U_FALLTHROUGH) + // Use the predefined value. +#elif defined(__clang__) + // Test for compiler vs. feature separately. + // Other compilers might choke on the feature test. +# if __has_cpp_attribute(clang::fallthrough) || \ + (__has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")) +# define U_FALLTHROUGH [[clang::fallthrough]] +# endif +#endif + +#ifndef U_FALLTHROUGH +# define U_FALLTHROUGH +#endif + +/** @} */ + +/*===========================================================================*/ +/** @{ Character data types */ +/*===========================================================================*/ + +/** + * U_CHARSET_FAMILY is equal to this value when the platform is an ASCII based platform. + * @stable ICU 2.0 + */ +#define U_ASCII_FAMILY 0 + +/** + * U_CHARSET_FAMILY is equal to this value when the platform is an EBCDIC based platform. + * @stable ICU 2.0 + */ +#define U_EBCDIC_FAMILY 1 + +/** + * \def U_CHARSET_FAMILY + * + *

These definitions allow to specify the encoding of text + * in the char data type as defined by the platform and the compiler. + * It is enough to determine the code point values of "invariant characters", + * which are the ones shared by all encodings that are in use + * on a given platform.

+ * + *

Those "invariant characters" should be all the uppercase and lowercase + * latin letters, the digits, the space, and "basic punctuation". + * Also, '\\n', '\\r', '\\t' should be available.

+ * + *

The list of "invariant characters" is:
+ * \code + * A-Z a-z 0-9 SPACE " % & ' ( ) * + , - . / : ; < = > ? _ + * \endcode + *
+ * (52 letters + 10 numbers + 20 punc/sym/space = 82 total)

+ * + *

This matches the IBM Syntactic Character Set (CS 640).

+ * + *

In other words, all the graphic characters in 7-bit ASCII should + * be safely accessible except the following:

+ * + * \code + * '\' + * '[' + * ']' + * '{' + * '}' + * '^' + * '~' + * '!' + * '#' + * '|' + * '$' + * '@' + * '`' + * \endcode + * @stable ICU 2.0 + */ +#ifdef U_CHARSET_FAMILY + /* Use the predefined value. */ +#elif U_PLATFORM == U_PF_OS390 && (!defined(__CHARSET_LIB) || !__CHARSET_LIB) +# define U_CHARSET_FAMILY U_EBCDIC_FAMILY +#elif U_PLATFORM == U_PF_OS400 && !defined(__UTF32__) +# define U_CHARSET_FAMILY U_EBCDIC_FAMILY +#else +# define U_CHARSET_FAMILY U_ASCII_FAMILY +#endif + +/** + * \def U_CHARSET_IS_UTF8 + * + * Hardcode the default charset to UTF-8. + * + * If this is set to 1, then + * - ICU will assume that all non-invariant char*, StringPiece, std::string etc. + * contain UTF-8 text, regardless of what the system API uses + * - some ICU code will use fast functions like u_strFromUTF8() + * rather than the more general and more heavy-weight conversion API (ucnv.h) + * - ucnv_getDefaultName() always returns "UTF-8" + * - ucnv_setDefaultName() is disabled and will not change the default charset + * - static builds of ICU are smaller + * - more functionality is available with the UCONFIG_NO_CONVERSION build-time + * configuration option (see unicode/uconfig.h) + * - the UCONFIG_NO_CONVERSION build option in uconfig.h is more usable + * + * @stable ICU 4.2 + * @see UCONFIG_NO_CONVERSION + */ +#ifdef U_CHARSET_IS_UTF8 + /* Use the predefined value. */ +#elif U_PLATFORM == U_PF_ANDROID || U_PLATFORM_IS_DARWIN_BASED +# define U_CHARSET_IS_UTF8 1 +#else +# define U_CHARSET_IS_UTF8 0 +#endif + +/** @} */ + +/*===========================================================================*/ +/** @{ Information about wchar support */ +/*===========================================================================*/ + +/** + * \def U_HAVE_WCHAR_H + * Indicates whether is available (1) or not (0). Set to 1 by default. + * + * @stable ICU 2.0 + */ +#ifdef U_HAVE_WCHAR_H + /* Use the predefined value. */ +#elif U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9 + /* + * Android before Gingerbread (Android 2.3, API level 9) did not support wchar_t. + * The type and header existed, but the library functions did not work as expected. + * The size of wchar_t was 1 but L"xyz" string literals had 32-bit units anyway. + */ +# define U_HAVE_WCHAR_H 0 +#else +# define U_HAVE_WCHAR_H 1 +#endif + +/** + * \def U_SIZEOF_WCHAR_T + * U_SIZEOF_WCHAR_T==sizeof(wchar_t) + * + * @stable ICU 2.0 + */ +#ifdef U_SIZEOF_WCHAR_T + /* Use the predefined value. */ +#elif (U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9) + /* + * Classic Mac OS and Mac OS X before 10.3 (Panther) did not support wchar_t or wstring. + * Newer Mac OS X has size 4. + */ +# define U_SIZEOF_WCHAR_T 1 +#elif U_PLATFORM_HAS_WIN32_API || U_PLATFORM == U_PF_CYGWIN +# define U_SIZEOF_WCHAR_T 2 +#elif U_PLATFORM == U_PF_AIX + /* + * AIX 6.1 information, section "Wide character data representation": + * "... the wchar_t datatype is 32-bit in the 64-bit environment and + * 16-bit in the 32-bit environment." + * and + * "All locales use Unicode for their wide character code values (process code), + * except the IBM-eucTW codeset." + */ +# ifdef __64BIT__ +# define U_SIZEOF_WCHAR_T 4 +# else +# define U_SIZEOF_WCHAR_T 2 +# endif +#elif U_PLATFORM == U_PF_OS390 + /* + * z/OS V1R11 information center, section "LP64 | ILP32": + * "In 31-bit mode, the size of long and pointers is 4 bytes and the size of wchar_t is 2 bytes. + * Under LP64, the size of long and pointer is 8 bytes and the size of wchar_t is 4 bytes." + */ +# ifdef _LP64 +# define U_SIZEOF_WCHAR_T 4 +# else +# define U_SIZEOF_WCHAR_T 2 +# endif +#elif U_PLATFORM == U_PF_OS400 +# if defined(__UTF32__) + /* + * LOCALETYPE(*LOCALEUTF) is specified. + * Wide-character strings are in UTF-32, + * narrow-character strings are in UTF-8. + */ +# define U_SIZEOF_WCHAR_T 4 +# elif defined(__UCS2__) + /* + * LOCALETYPE(*LOCALEUCS2) is specified. + * Wide-character strings are in UCS-2, + * narrow-character strings are in EBCDIC. + */ +# define U_SIZEOF_WCHAR_T 2 +#else + /* + * LOCALETYPE(*CLD) or LOCALETYPE(*LOCALE) is specified. + * Wide-character strings are in 16-bit EBCDIC, + * narrow-character strings are in EBCDIC. + */ +# define U_SIZEOF_WCHAR_T 2 +# endif +#else +# define U_SIZEOF_WCHAR_T 4 +#endif + +#ifndef U_HAVE_WCSCPY +#define U_HAVE_WCSCPY U_HAVE_WCHAR_H +#endif + +/** @} */ + +/** + * \def U_HAVE_CHAR16_T + * Defines whether the char16_t type is available for UTF-16 + * and u"abc" UTF-16 string literals are supported. + * This is a new standard type and standard string literal syntax in C++0x + * but has been available in some compilers before. + * @internal + */ +#ifdef U_HAVE_CHAR16_T + /* Use the predefined value. */ +#else + /* + * Notes: + * Visual Studio 10 (_MSC_VER>=1600) defines char16_t but + * does not support u"abc" string literals. + * gcc 4.4 defines the __CHAR16_TYPE__ macro to a usable type but + * does not support u"abc" string literals. + * C++11 and C11 require support for UTF-16 literals + * TODO: Fix for plain C. Doesn't work on Mac. + */ +# if U_CPLUSPLUS_VERSION >= 11 || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) +# define U_HAVE_CHAR16_T 1 +# else +# define U_HAVE_CHAR16_T 0 +# endif +#endif + +/** + * @{ + * \def U_DECLARE_UTF16 + * Do not use this macro because it is not defined on all platforms. + * Use the UNICODE_STRING or U_STRING_DECL macros instead. + * @internal + */ +#ifdef U_DECLARE_UTF16 + /* Use the predefined value. */ +#elif U_HAVE_CHAR16_T \ + || (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \ + || (defined(__HP_aCC) && __HP_aCC >= 035000) \ + || (defined(__HP_cc) && __HP_cc >= 111106) +# define U_DECLARE_UTF16(string) u ## string +#elif U_SIZEOF_WCHAR_T == 2 \ + && (U_CHARSET_FAMILY == 0 || (U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400 && defined(__UCS2__))) +# define U_DECLARE_UTF16(string) L ## string +#else + /* Leave U_DECLARE_UTF16 undefined. See unistr.h. */ +#endif + +/** @} */ + +/*===========================================================================*/ +/** @{ Symbol import-export control */ +/*===========================================================================*/ + +#ifdef U_EXPORT + /* Use the predefined value. */ +#elif defined(U_STATIC_IMPLEMENTATION) +# define U_EXPORT +#elif defined(__GNUC__) +# define U_EXPORT __attribute__((visibility("default"))) +#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \ + || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550) +# define U_EXPORT __global +/*#elif defined(__HP_aCC) || defined(__HP_cc) +# define U_EXPORT __declspec(dllexport)*/ +#elif defined(_MSC_VER) +# define U_EXPORT __declspec(dllexport) +#else +# define U_EXPORT +#endif + +/* U_CALLCONV is releated to U_EXPORT2 */ +#ifdef U_EXPORT2 + /* Use the predefined value. */ +#elif defined(_MSC_VER) +# define U_EXPORT2 __cdecl +#else +# define U_EXPORT2 +#endif + +#ifdef U_IMPORT + /* Use the predefined value. */ +#elif defined(_MSC_VER) + /* Windows needs to export/import data. */ +# define U_IMPORT __declspec(dllimport) +#else +# define U_IMPORT +#endif + +/** + * \def U_CALLCONV + * Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary + * in callback function typedefs to make sure that the calling convention + * is compatible. + * + * This is only used for non-ICU-API functions. + * When a function is a public ICU API, + * you must use the U_CAPI and U_EXPORT2 qualifiers. + * + * Please note, you need to use U_CALLCONV after the *. + * + * NO : "static const char U_CALLCONV *func( . . . )" + * YES: "static const char* U_CALLCONV func( . . . )" + * + * @stable ICU 2.0 + */ +#if U_PLATFORM == U_PF_OS390 && defined(__cplusplus) +# define U_CALLCONV __cdecl +#else +# define U_CALLCONV U_EXPORT2 +#endif + +/** + * \def U_CALLCONV_FPTR + * Similar to U_CALLCONV, but only used on function pointers. + * @internal + */ +#if U_PLATFORM == U_PF_OS390 && defined(__cplusplus) +# define U_CALLCONV_FPTR U_CALLCONV +#else +# define U_CALLCONV_FPTR +#endif +/* @} */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/plurfmt.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/plurfmt.h new file mode 100644 index 0000000..fd537c2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/plurfmt.h @@ -0,0 +1,617 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2007-2014, International Business Machines Corporation and +* others. All Rights Reserved. +******************************************************************************* +* + +* File PLURFMT.H +******************************************************************************** +*/ + +#ifndef PLURFMT +#define PLURFMT + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: PluralFormat object + */ + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/messagepattern.h" +#include "unicode/numfmt.h" +#include "unicode/plurrule.h" + +U_NAMESPACE_BEGIN + +class Hashtable; +class NFRule; + +/** + *

+ * PluralFormat supports the creation of internationalized + * messages with plural inflection. It is based on plural + * selection, i.e. the caller specifies messages for each + * plural case that can appear in the user's language and the + * PluralFormat selects the appropriate message based on + * the number. + *

+ *

The Problem of Plural Forms in Internationalized Messages

+ *

+ * Different languages have different ways to inflect + * plurals. Creating internationalized messages that include plural + * forms is only feasible when the framework is able to handle plural + * forms of all languages correctly. ChoiceFormat + * doesn't handle this well, because it attaches a number interval to + * each message and selects the message whose interval contains a + * given number. This can only handle a finite number of + * intervals. But in some languages, like Polish, one plural case + * applies to infinitely many intervals (e.g., the plural case applies to + * numbers ending with 2, 3, or 4 except those ending with 12, 13, or + * 14). Thus ChoiceFormat is not adequate. + *

+ * PluralFormat deals with this by breaking the problem + * into two parts: + *

    + *
  • It uses PluralRules that can define more complex + * conditions for a plural case than just a single interval. These plural + * rules define both what plural cases exist in a language, and to + * which numbers these cases apply. + *
  • It provides predefined plural rules for many languages. Thus, the programmer + * need not worry about the plural cases of a language and + * does not have to define the plural cases; they can simply + * use the predefined keywords. The whole plural formatting of messages can + * be done using localized patterns from resource bundles. For predefined plural + * rules, see the CLDR Language Plural Rules page at + * http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html + *
+ *

+ *

Usage of PluralFormat

+ *

Note: Typically, plural formatting is done via MessageFormat + * with a plural argument type, + * rather than using a stand-alone PluralFormat. + *

+ * This discussion assumes that you use PluralFormat with + * a predefined set of plural rules. You can create one using one of + * the constructors that takes a locale object. To + * specify the message pattern, you can either pass it to the + * constructor or set it explicitly using the + * applyPattern() method. The format() + * method takes a number object and selects the message of the + * matching plural case. This message will be returned. + *

+ *
Patterns and Their Interpretation
+ *

+ * The pattern text defines the message output for each plural case of the + * specified locale. Syntax: + *

+ * pluralStyle = [offsetValue] (selector '{' message '}')+
+ * offsetValue = "offset:" number
+ * selector = explicitValue | keyword
+ * explicitValue = '=' number  // adjacent, no white space in between
+ * keyword = [^[[:Pattern_Syntax:][:Pattern_White_Space:]]]+
+ * message: see {@link MessageFormat}
+ * 
+ * Pattern_White_Space between syntax elements is ignored, except + * between the {curly braces} and their sub-message, + * and between the '=' and the number of an explicitValue. + * + *

+ * There are 6 predefined casekeyword in CLDR/ICU - 'zero', 'one', 'two', 'few', 'many' and + * 'other'. You always have to define a message text for the default plural case + * other which is contained in every rule set. + * If you do not specify a message text for a particular plural case, the + * message text of the plural case other gets assigned to this + * plural case. + *

+ * When formatting, the input number is first matched against the explicitValue clauses. + * If there is no exact-number match, then a keyword is selected by calling + * the PluralRules with the input number minus the offset. + * (The offset defaults to 0 if it is omitted from the pattern string.) + * If there is no clause with that keyword, then the "other" clauses is returned. + *

+ * An unquoted pound sign (#) in the selected sub-message + * itself (i.e., outside of arguments nested in the sub-message) + * is replaced by the input number minus the offset. + * The number-minus-offset value is formatted using a + * NumberFormat for the PluralFormat's locale. If you + * need special number formatting, you have to use a MessageFormat + * and explicitly specify a NumberFormat argument. + * Note: That argument is formatting without subtracting the offset! + * If you need a custom format and have a non-zero offset, then you need to pass the + * number-minus-offset value as a separate parameter. + *

+ * For a usage example, see the {@link MessageFormat} class documentation. + * + *

Defining Custom Plural Rules

+ *

If you need to use PluralFormat with custom rules, you can + * create a PluralRules object and pass it to + * PluralFormat's constructor. If you also specify a locale in this + * constructor, this locale will be used to format the number in the message + * texts. + *

+ * For more information about PluralRules, see + * {@link PluralRules}. + *

+ * + * ported from Java + * @stable ICU 4.0 + */ + +class U_I18N_API PluralFormat : public Format { +public: + + /** + * Creates a new cardinal-number PluralFormat for the default locale. + * This locale will be used to get the set of plural rules and for standard + * number formatting. + * @param status output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @stable ICU 4.0 + */ + PluralFormat(UErrorCode& status); + + /** + * Creates a new cardinal-number PluralFormat for a given locale. + * @param locale the PluralFormat will be configured with + * rules for this locale. This locale will also be used for + * standard number formatting. + * @param status output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @stable ICU 4.0 + */ + PluralFormat(const Locale& locale, UErrorCode& status); + + /** + * Creates a new PluralFormat for a given set of rules. + * The standard number formatting will be done using the default locale. + * @param rules defines the behavior of the PluralFormat + * object. + * @param status output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @stable ICU 4.0 + */ + PluralFormat(const PluralRules& rules, UErrorCode& status); + + /** + * Creates a new PluralFormat for a given set of rules. + * The standard number formatting will be done using the given locale. + * @param locale the default number formatting will be done using this + * locale. + * @param rules defines the behavior of the PluralFormat + * object. + * @param status output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @stable ICU 4.0 + *

+ *

Sample code

+ * \snippet samples/plurfmtsample/plurfmtsample.cpp PluralFormatExample1 + * \snippet samples/plurfmtsample/plurfmtsample.cpp PluralFormatExample + *

+ */ + PluralFormat(const Locale& locale, const PluralRules& rules, UErrorCode& status); + + /** + * Creates a new PluralFormat for the plural type. + * The standard number formatting will be done using the given locale. + * @param locale the default number formatting will be done using this + * locale. + * @param type The plural type (e.g., cardinal or ordinal). + * @param status output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @stable ICU 50 + */ + PluralFormat(const Locale& locale, UPluralType type, UErrorCode& status); + + /** + * Creates a new cardinal-number PluralFormat for a given pattern string. + * The default locale will be used to get the set of plural rules and for + * standard number formatting. + * @param pattern the pattern for this PluralFormat. + * errors are returned to status if the pattern is invalid. + * @param status output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @stable ICU 4.0 + */ + PluralFormat(const UnicodeString& pattern, UErrorCode& status); + + /** + * Creates a new cardinal-number PluralFormat for a given pattern string and + * locale. + * The locale will be used to get the set of plural rules and for + * standard number formatting. + * @param locale the PluralFormat will be configured with + * rules for this locale. This locale will also be used for + * standard number formatting. + * @param pattern the pattern for this PluralFormat. + * errors are returned to status if the pattern is invalid. + * @param status output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @stable ICU 4.0 + */ + PluralFormat(const Locale& locale, const UnicodeString& pattern, UErrorCode& status); + + /** + * Creates a new PluralFormat for a given set of rules, a + * pattern and a locale. + * @param rules defines the behavior of the PluralFormat + * object. + * @param pattern the pattern for this PluralFormat. + * errors are returned to status if the pattern is invalid. + * @param status output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @stable ICU 4.0 + */ + PluralFormat(const PluralRules& rules, + const UnicodeString& pattern, + UErrorCode& status); + + /** + * Creates a new PluralFormat for a given set of rules, a + * pattern and a locale. + * @param locale the PluralFormat will be configured with + * rules for this locale. This locale will also be used for + * standard number formatting. + * @param rules defines the behavior of the PluralFormat + * object. + * @param pattern the pattern for this PluralFormat. + * errors are returned to status if the pattern is invalid. + * @param status output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @stable ICU 4.0 + */ + PluralFormat(const Locale& locale, + const PluralRules& rules, + const UnicodeString& pattern, + UErrorCode& status); + + /** + * Creates a new PluralFormat for a plural type, a + * pattern and a locale. + * @param locale the PluralFormat will be configured with + * rules for this locale. This locale will also be used for + * standard number formatting. + * @param type The plural type (e.g., cardinal or ordinal). + * @param pattern the pattern for this PluralFormat. + * errors are returned to status if the pattern is invalid. + * @param status output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @stable ICU 50 + */ + PluralFormat(const Locale& locale, + UPluralType type, + const UnicodeString& pattern, + UErrorCode& status); + + /** + * copy constructor. + * @stable ICU 4.0 + */ + PluralFormat(const PluralFormat& other); + + /** + * Destructor. + * @stable ICU 4.0 + */ + virtual ~PluralFormat(); + + /** + * Sets the pattern used by this plural format. + * The method parses the pattern and creates a map of format strings + * for the plural rules. + * Patterns and their interpretation are specified in the class description. + * + * @param pattern the pattern for this plural format + * errors are returned to status if the pattern is invalid. + * @param status output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @stable ICU 4.0 + */ + void applyPattern(const UnicodeString& pattern, UErrorCode& status); + + + using Format::format; + + /** + * Formats a plural message for a given number. + * + * @param number a number for which the plural message should be formatted + * for. If no pattern has been applied to this + * PluralFormat object yet, the formatted number + * will be returned. + * @param status output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @return the string containing the formatted plural message. + * @stable ICU 4.0 + */ + UnicodeString format(int32_t number, UErrorCode& status) const; + + /** + * Formats a plural message for a given number. + * + * @param number a number for which the plural message should be formatted + * for. If no pattern has been applied to this + * PluralFormat object yet, the formatted number + * will be returned. + * @param status output param set to success or failure code on exit, which + * must not indicate a failure before the function call. + * @return the string containing the formatted plural message. + * @stable ICU 4.0 + */ + UnicodeString format(double number, UErrorCode& status) const; + + /** + * Formats a plural message for a given number. + * + * @param number a number for which the plural message should be formatted + * for. If no pattern has been applied to this + * PluralFormat object yet, the formatted number + * will be returned. + * @param appendTo output parameter to receive result. + * result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @param status output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @return the string containing the formatted plural message. + * @stable ICU 4.0 + */ + UnicodeString& format(int32_t number, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode& status) const; + + /** + * Formats a plural message for a given number. + * + * @param number a number for which the plural message should be formatted + * for. If no pattern has been applied to this + * PluralFormat object yet, the formatted number + * will be returned. + * @param appendTo output parameter to receive result. + * result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @param status output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @return the string containing the formatted plural message. + * @stable ICU 4.0 + */ + UnicodeString& format(double number, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode& status) const; + +#ifndef U_HIDE_DEPRECATED_API + /** + * Sets the locale used by this PluraFormat object. + * Note: Calling this method resets this PluraFormat object, + * i.e., a pattern that was applied previously will be removed, + * and the NumberFormat is set to the default number format for + * the locale. The resulting format behaves the same as one + * constructed from {@link #PluralFormat(const Locale& locale, UPluralType type, UErrorCode& status)} + * with UPLURAL_TYPE_CARDINAL. + * @param locale the locale to use to configure the formatter. + * @param status output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @deprecated ICU 50 This method clears the pattern and might create + * a different kind of PluralRules instance; + * use one of the constructors to create a new instance instead. + */ + void setLocale(const Locale& locale, UErrorCode& status); +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Sets the number format used by this formatter. You only need to + * call this if you want a different number format than the default + * formatter for the locale. + * @param format the number format to use. + * @param status output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @stable ICU 4.0 + */ + void setNumberFormat(const NumberFormat* format, UErrorCode& status); + + /** + * Assignment operator + * + * @param other the PluralFormat object to copy from. + * @stable ICU 4.0 + */ + PluralFormat& operator=(const PluralFormat& other); + + /** + * Return true if another object is semantically equal to this one. + * + * @param other the PluralFormat object to be compared with. + * @return true if other is semantically equal to this. + * @stable ICU 4.0 + */ + virtual UBool operator==(const Format& other) const; + + /** + * Return true if another object is semantically unequal to this one. + * + * @param other the PluralFormat object to be compared with. + * @return true if other is semantically unequal to this. + * @stable ICU 4.0 + */ + virtual UBool operator!=(const Format& other) const; + + /** + * Clones this Format object polymorphically. The caller owns the + * result and should delete it when done. + * @stable ICU 4.0 + */ + virtual Format* clone(void) const; + + /** + * Formats a plural message for a number taken from a Formattable object. + * + * @param obj The object containing a number for which the + * plural message should be formatted. + * The object must be of a numeric type. + * @param appendTo output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @param status output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @stable ICU 4.0 + */ + UnicodeString& format(const Formattable& obj, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode& status) const; + + /** + * Returns the pattern from applyPattern() or constructor(). + * + * @param appendTo output parameter to receive result. + * Result is appended to existing contents. + * @return the UnicodeString with inserted pattern. + * @stable ICU 4.0 + */ + UnicodeString& toPattern(UnicodeString& appendTo); + + /** + * This method is not yet supported by PluralFormat. + *

+ * Before calling, set parse_pos.index to the offset you want to start + * parsing at in the source. After calling, parse_pos.index is the end of + * the text you parsed. If error occurs, index is unchanged. + *

+ * When parsing, leading whitespace is discarded (with a successful parse), + * while trailing whitespace is left as is. + *

+ * See Format::parseObject() for more. + * + * @param source The string to be parsed into an object. + * @param result Formattable to be set to the parse result. + * If parse fails, return contents are undefined. + * @param parse_pos The position to start parsing at. Upon return + * this param is set to the position after the + * last character successfully parsed. If the + * source is not parsed successfully, this param + * will remain unchanged. + * @stable ICU 4.0 + */ + virtual void parseObject(const UnicodeString& source, + Formattable& result, + ParsePosition& parse_pos) const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 4.0 + * + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 4.0 + */ + virtual UClassID getDynamicClassID() const; + +#if (defined(__xlC__) && (__xlC__ < 0x0C00)) || (U_PLATFORM == U_PF_OS390) || (U_PLATFORM ==U_PF_OS400) +// Work around a compiler bug on xlC 11.1 on AIX 7.1 that would +// prevent PluralSelectorAdapter from implementing private PluralSelector. +// xlC error message: +// 1540-0300 (S) The "private" member "class icu_49::PluralFormat::PluralSelector" cannot be accessed. +public: +#else +private: +#endif + /** + * @internal + */ + class U_I18N_API PluralSelector : public UMemory { + public: + virtual ~PluralSelector(); + /** + * Given a number, returns the appropriate PluralFormat keyword. + * + * @param context worker object for the selector. + * @param number The number to be plural-formatted. + * @param ec Error code. + * @return The selected PluralFormat keyword. + * @internal + */ + virtual UnicodeString select(void *context, double number, UErrorCode& ec) const = 0; + }; + + /** + * @internal + */ + class U_I18N_API PluralSelectorAdapter : public PluralSelector { + public: + PluralSelectorAdapter() : pluralRules(NULL) { + } + + virtual ~PluralSelectorAdapter(); + + virtual UnicodeString select(void *context, double number, UErrorCode& /*ec*/) const; /**< @internal */ + + void reset(); + + PluralRules* pluralRules; + }; + +#if defined(__xlC__) +// End of xlC bug workaround, keep remaining definitions private. +private: +#endif + Locale locale; + MessagePattern msgPattern; + NumberFormat* numberFormat; + double offset; + PluralSelectorAdapter pluralRulesWrapper; + + PluralFormat(); // default constructor not implemented + void init(const PluralRules* rules, UPluralType type, UErrorCode& status); + /** + * Copies dynamically allocated values (pointer fields). + * Others are copied using their copy constructors and assignment operators. + */ + void copyObjects(const PluralFormat& other); + + UnicodeString& format(const Formattable& numberObject, double number, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode& status) const; /**< @internal */ + + /** + * Finds the PluralFormat sub-message for the given number, or the "other" sub-message. + * @param pattern A MessagePattern. + * @param partIndex the index of the first PluralFormat argument style part. + * @param selector the PluralSelector for mapping the number (minus offset) to a keyword. + * @param context worker object for the selector. + * @param number a number to be matched to one of the PluralFormat argument's explicit values, + * or mapped via the PluralSelector. + * @param ec ICU error code. + * @return the sub-message start part index. + */ + static int32_t findSubMessage( + const MessagePattern& pattern, int32_t partIndex, + const PluralSelector& selector, void *context, double number, UErrorCode& ec); /**< @internal */ + + void parseType(const UnicodeString& source, const NFRule *rbnfLenientScanner, + Formattable& result, FieldPosition& pos) const; + + friend class MessageFormat; + friend class NFRule; +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // _PLURFMT +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/plurrule.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/plurrule.h new file mode 100644 index 0000000..d372d79 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/plurrule.h @@ -0,0 +1,531 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2008-2015, International Business Machines Corporation and +* others. All Rights Reserved. +******************************************************************************* +* +* +* File PLURRULE.H +* +* Modification History:* +* Date Name Description +* +******************************************************************************** +*/ + +#ifndef PLURRULE +#define PLURRULE + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: PluralRules object + */ + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/format.h" +#include "unicode/upluralrules.h" +#ifndef U_HIDE_INTERNAL_API +#include "unicode/numfmt.h" +#endif /* U_HIDE_INTERNAL_API */ + +/** + * Value returned by PluralRules::getUniqueKeywordValue() when there is no + * unique value to return. + * @stable ICU 4.8 + */ +#define UPLRULES_NO_UNIQUE_VALUE ((double)-0.00123456777) + +U_NAMESPACE_BEGIN + +class Hashtable; +class IFixedDecimal; +class VisibleDigitsWithExponent; +class RuleChain; +class PluralRuleParser; +class PluralKeywordEnumeration; +class AndConstraint; +class SharedPluralRules; + +/** + * Defines rules for mapping non-negative numeric values onto a small set of + * keywords. Rules are constructed from a text description, consisting + * of a series of keywords and conditions. The {@link #select} method + * examines each condition in order and returns the keyword for the + * first condition that matches the number. If none match, + * default rule(other) is returned. + * + * For more information, details, and tips for writing rules, see the + * LDML spec, C.11 Language Plural Rules: + * http://www.unicode.org/draft/reports/tr35/tr35.html#Language_Plural_Rules + * + * Examples:

+ *   "one: n is 1; few: n in 2..4"
+ * This defines two rules, for 'one' and 'few'. The condition for + * 'one' is "n is 1" which means that the number must be equal to + * 1 for this condition to pass. The condition for 'few' is + * "n in 2..4" which means that the number must be between 2 and + * 4 inclusive for this condition to pass. All other numbers + * are assigned the keyword "other" by the default rule. + *

+ *    "zero: n is 0; one: n is 1; zero: n mod 100 in 1..19"
+ * This illustrates that the same keyword can be defined multiple times. + * Each rule is examined in order, and the first keyword whose condition + * passes is the one returned. Also notes that a modulus is applied + * to n in the last rule. Thus its condition holds for 119, 219, 319... + *

+ *    "one: n is 1; few: n mod 10 in 2..4 and n mod 100 not in 12..14"
+ * This illustrates conjunction and negation. The condition for 'few' + * has two parts, both of which must be met: "n mod 10 in 2..4" and + * "n mod 100 not in 12..14". The first part applies a modulus to n + * before the test as in the previous example. The second part applies + * a different modulus and also uses negation, thus it matches all + * numbers _not_ in 12, 13, 14, 112, 113, 114, 212, 213, 214... + *

+ *

+ * Syntax:

+ * \code
+ * rules         = rule (';' rule)*
+ * rule          = keyword ':' condition
+ * keyword       = 
+ * condition     = and_condition ('or' and_condition)*
+ * and_condition = relation ('and' relation)*
+ * relation      = is_relation | in_relation | within_relation | 'n' 
+ * is_relation   = expr 'is' ('not')? value
+ * in_relation   = expr ('not')? 'in' range_list
+ * within_relation = expr ('not')? 'within' range
+ * expr          = ('n' | 'i' | 'f' | 'v' | 'j') ('mod' value)?
+ * range_list    = (range | value) (',' range_list)*
+ * value         = digit+  ('.' digit+)?
+ * digit         = 0|1|2|3|4|5|6|7|8|9
+ * range         = value'..'value
+ * \endcode
+ * 

+ *

+ *

+ * The i, f, and v values are defined as follows: + *

+ *
    + *
  • i to be the integer digits.
  • + *
  • f to be the visible fractional digits, as an integer.
  • + *
  • v to be the number of visible fraction digits.
  • + *
  • j is defined to only match integers. That is j is 3 fails if v != 0 (eg for 3.1 or 3.0).
  • + *
+ *

+ * Examples are in the following table: + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
nifv
1.0101
1.00102
1.3131
1.03132
1.231232
+ *

+ * The difference between 'in' and 'within' is that 'in' only includes integers in the specified range, while 'within' + * includes all values. Using 'within' with a range_list consisting entirely of values is the same as using 'in' (it's + * not an error). + *

+ + * An "identifier" is a sequence of characters that do not have the + * Unicode Pattern_Syntax or Pattern_White_Space properties. + *

+ * The difference between 'in' and 'within' is that 'in' only includes + * integers in the specified range, while 'within' includes all values. + * Using 'within' with a range_list consisting entirely of values is the + * same as using 'in' (it's not an error). + *

+ *

+ * Keywords + * could be defined by users or from ICU locale data. There are 6 + * predefined values in ICU - 'zero', 'one', 'two', 'few', 'many' and + * 'other'. Callers need to check the value of keyword returned by + * {@link #select} method. + *

+ * + * Examples:
+ * UnicodeString keyword = pl->select(number);
+ * if (keyword== UnicodeString("one") {
+ *     ...
+ * }
+ * else if ( ... )
+ * 
+ * Note:
+ *

+ * ICU defines plural rules for many locales based on CLDR Language Plural Rules. + * For these predefined rules, see CLDR page at + * http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html + *

+ */ +class U_I18N_API PluralRules : public UObject { +public: + + /** + * Constructor. + * @param status Output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * + * @stable ICU 4.0 + */ + PluralRules(UErrorCode& status); + + /** + * Copy constructor. + * @stable ICU 4.0 + */ + PluralRules(const PluralRules& other); + + /** + * Destructor. + * @stable ICU 4.0 + */ + virtual ~PluralRules(); + + /** + * Clone + * @stable ICU 4.0 + */ + PluralRules* clone() const; + + /** + * Assignment operator. + * @stable ICU 4.0 + */ + PluralRules& operator=(const PluralRules&); + + /** + * Creates a PluralRules from a description if it is parsable, otherwise + * returns NULL. + * + * @param description rule description + * @param status Output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @return new PluralRules pointer. NULL if there is an error. + * @stable ICU 4.0 + */ + static PluralRules* U_EXPORT2 createRules(const UnicodeString& description, + UErrorCode& status); + + /** + * The default rules that accept any number. + * + * @param status Output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @return new PluralRules pointer. NULL if there is an error. + * @stable ICU 4.0 + */ + static PluralRules* U_EXPORT2 createDefaultRules(UErrorCode& status); + + /** + * Provides access to the predefined cardinal-number PluralRules for a given + * locale. + * Same as forLocale(locale, UPLURAL_TYPE_CARDINAL, status). + * + * @param locale The locale for which a PluralRules object is + * returned. + * @param status Output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @return The predefined PluralRules object pointer for + * this locale. If there's no predefined rules for this locale, + * the rules for the closest parent in the locale hierarchy + * that has one will be returned. The final fallback always + * returns the default 'other' rules. + * @stable ICU 4.0 + */ + static PluralRules* U_EXPORT2 forLocale(const Locale& locale, UErrorCode& status); + + /** + * Provides access to the predefined PluralRules for a given + * locale and the plural type. + * + * @param locale The locale for which a PluralRules object is + * returned. + * @param type The plural type (e.g., cardinal or ordinal). + * @param status Output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @return The predefined PluralRules object pointer for + * this locale. If there's no predefined rules for this locale, + * the rules for the closest parent in the locale hierarchy + * that has one will be returned. The final fallback always + * returns the default 'other' rules. + * @stable ICU 50 + */ + static PluralRules* U_EXPORT2 forLocale(const Locale& locale, UPluralType type, UErrorCode& status); + +#ifndef U_HIDE_INTERNAL_API + /** + * Return a StringEnumeration over the locales for which there is plurals data. + * @return a StringEnumeration over the locales available. + * @internal + */ + static StringEnumeration* U_EXPORT2 getAvailableLocales(UErrorCode &status); + + /** + * Returns whether or not there are overrides. + * @param locale the locale to check. + * @return + * @internal + */ + static UBool hasOverride(const Locale &locale); + + /** + * For ICU use only. + * creates a SharedPluralRules object + * @internal + */ + static PluralRules* U_EXPORT2 internalForLocale(const Locale& locale, UPluralType type, UErrorCode& status); + + /** + * For ICU use only. + * Returns handle to the shared, cached PluralRules instance. + * Caller must call removeRef() on returned value once it is done with + * the shared instance. + * @internal + */ + static const SharedPluralRules* U_EXPORT2 createSharedInstance( + const Locale& locale, UPluralType type, UErrorCode& status); + + +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Given a number, returns the keyword of the first rule that applies to + * the number. This function can be used with isKeyword* functions to + * determine the keyword for default plural rules. + * + * @param number The number for which the rule has to be determined. + * @return The keyword of the selected rule. + * @stable ICU 4.0 + */ + UnicodeString select(int32_t number) const; + + /** + * Given a number, returns the keyword of the first rule that applies to + * the number. This function can be used with isKeyword* functions to + * determine the keyword for default plural rules. + * + * @param number The number for which the rule has to be determined. + * @return The keyword of the selected rule. + * @stable ICU 4.0 + */ + UnicodeString select(double number) const; + +#ifndef U_HIDE_INTERNAL_API + /** + * Given a number and a format, returns the keyword of the first applicable + * rule for this PluralRules object. + * Note: This internal preview interface may be removed in the future if + * an architecturally cleaner solution reaches stable status. + * @param obj The numeric object for which the rule should be determined. + * @param fmt The NumberFormat specifying how the number will be formatted + * (this can affect the plural form, e.g. "1 dollar" vs "1.0 dollars"). + * @param status Input/output parameter. If at entry this indicates a + * failure status, the method returns immediately; otherwise + * this is set to indicate the outcome of the call. + * @return The keyword of the selected rule. Undefined in the case of an error. + * @internal ICU 59 technology preview, may be removed in the future + */ + UnicodeString select(const Formattable& obj, const NumberFormat& fmt, UErrorCode& status) const; + + /** + * @internal + */ + UnicodeString select(const IFixedDecimal &number) const; + /** + * @internal + */ + UnicodeString select(const VisibleDigitsWithExponent &number) const; +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Returns a list of all rule keywords used in this PluralRules + * object. The rule 'other' is always present by default. + * + * @param status Output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @return StringEnumeration with the keywords. + * The caller must delete the object. + * @stable ICU 4.0 + */ + StringEnumeration* getKeywords(UErrorCode& status) const; + +#ifndef U_HIDE_DEPRECATED_API + /** + * Deprecated Function, does not return useful results. + * + * Originally intended to return a unique value for this keyword if it exists, + * else the constant UPLRULES_NO_UNIQUE_VALUE. + * + * @param keyword The keyword. + * @return Stub deprecated function returns UPLRULES_NO_UNIQUE_VALUE always. + * @deprecated ICU 55 + */ + double getUniqueKeywordValue(const UnicodeString& keyword); + + /** + * Deprecated Function, does not produce useful results. + * + * Originally intended to return all the values for which select() would return the keyword. + * If the keyword is unknown, returns no values, but this is not an error. If + * the number of values is unlimited, returns no values and -1 as the + * count. + * + * The number of returned values is typically small. + * + * @param keyword The keyword. + * @param dest Array into which to put the returned values. May + * be NULL if destCapacity is 0. + * @param destCapacity The capacity of the array, must be at least 0. + * @param status The error code. Deprecated function, always sets U_UNSUPPORTED_ERROR. + * @return The count of values available, or -1. This count + * can be larger than destCapacity, but no more than + * destCapacity values will be written. + * @deprecated ICU 55 + */ + int32_t getAllKeywordValues(const UnicodeString &keyword, + double *dest, int32_t destCapacity, + UErrorCode& status); +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Returns sample values for which select() would return the keyword. If + * the keyword is unknown, returns no values, but this is not an error. + * + * The number of returned values is typically small. + * + * @param keyword The keyword. + * @param dest Array into which to put the returned values. May + * be NULL if destCapacity is 0. + * @param destCapacity The capacity of the array, must be at least 0. + * @param status The error code. + * @return The count of values written. + * If more than destCapacity samples are available, then + * only destCapacity are written, and destCapacity is returned as the count, + * rather than setting a U_BUFFER_OVERFLOW_ERROR. + * (The actual number of keyword values could be unlimited.) + * @stable ICU 4.8 + */ + int32_t getSamples(const UnicodeString &keyword, + double *dest, int32_t destCapacity, + UErrorCode& status); + + /** + * Returns TRUE if the given keyword is defined in this + * PluralRules object. + * + * @param keyword the input keyword. + * @return TRUE if the input keyword is defined. + * Otherwise, return FALSE. + * @stable ICU 4.0 + */ + UBool isKeyword(const UnicodeString& keyword) const; + + + /** + * Returns keyword for default plural form. + * + * @return keyword for default plural form. + * @stable ICU 4.0 + */ + UnicodeString getKeywordOther() const; + +#ifndef U_HIDE_INTERNAL_API + /** + * + * @internal + */ + UnicodeString getRules() const; +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Compares the equality of two PluralRules objects. + * + * @param other The other PluralRules object to be compared with. + * @return True if the given PluralRules is the same as this + * PluralRules; false otherwise. + * @stable ICU 4.0 + */ + virtual UBool operator==(const PluralRules& other) const; + + /** + * Compares the inequality of two PluralRules objects. + * + * @param other The PluralRules object to be compared with. + * @return True if the given PluralRules is not the same as this + * PluralRules; false otherwise. + * @stable ICU 4.0 + */ + UBool operator!=(const PluralRules& other) const {return !operator==(other);} + + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 4.0 + * + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 4.0 + */ + virtual UClassID getDynamicClassID() const; + + +private: + RuleChain *mRules; + + PluralRules(); // default constructor not implemented + void parseDescription(const UnicodeString& ruleData, UErrorCode &status); + int32_t getNumberValue(const UnicodeString& token) const; + UnicodeString getRuleFromResource(const Locale& locale, UPluralType type, UErrorCode& status); + RuleChain *rulesForKeyword(const UnicodeString &keyword) const; + + friend class PluralRuleParser; +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // _PLURRULE +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ptypes.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ptypes.h new file mode 100644 index 0000000..6eaf2db --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ptypes.h @@ -0,0 +1,128 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1997-2012, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* +* FILE NAME : ptypes.h +* +* Date Name Description +* 05/13/98 nos Creation (content moved here from ptypes.h). +* 03/02/99 stephen Added AS400 support. +* 03/30/99 stephen Added Linux support. +* 04/13/99 stephen Reworked for autoconf. +* 09/18/08 srl Moved basic types back to ptypes.h from platform.h +****************************************************************************** +*/ + +/** + * \file + * \brief C API: Definitions of integer types of various widths + */ + +#ifndef _PTYPES_H +#define _PTYPES_H + +/** + * \def __STDC_LIMIT_MACROS + * According to the Linux stdint.h, the ISO C99 standard specifies that in C++ implementations + * macros like INT32_MIN and UINTPTR_MAX should only be defined if explicitly requested. + * We need to define __STDC_LIMIT_MACROS before including stdint.h in C++ code + * that uses such limit macros. + * @internal + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS +#endif + +/* NULL, size_t, wchar_t */ +#include + +/* + * If all compilers provided all of the C99 headers and types, + * we would just unconditionally #include here + * and not need any of the stuff after including platform.h. + */ + +/* Find out if we have stdint.h etc. */ +#include "unicode/platform.h" + +/*===========================================================================*/ +/* Generic data types */ +/*===========================================================================*/ + +/* If your platform does not have the header, you may + need to edit the typedefs in the #else section below. + Use #if...#else...#endif with predefined compiler macros if possible. */ +#if U_HAVE_STDINT_H + +/* + * We mostly need (which defines the standard integer types) but not . + * includes and adds the printf/scanf helpers PRId32, SCNx16 etc. + * which we almost never use, plus stuff like imaxabs() which we never use. + */ +#include + +#if U_PLATFORM == U_PF_OS390 +/* The features header is needed to get (u)int64_t sometimes. */ +#include +/* z/OS has , but some versions are missing uint8_t (APAR PK62248). */ +#if !defined(__uint8_t) +#define __uint8_t 1 +typedef unsigned char uint8_t; +#endif +#endif /* U_PLATFORM == U_PF_OS390 */ + +#elif U_HAVE_INTTYPES_H + +# include + +#else /* neither U_HAVE_STDINT_H nor U_HAVE_INTTYPES_H */ + +#if ! U_HAVE_INT8_T +typedef signed char int8_t; +#endif + +#if ! U_HAVE_UINT8_T +typedef unsigned char uint8_t; +#endif + +#if ! U_HAVE_INT16_T +typedef signed short int16_t; +#endif + +#if ! U_HAVE_UINT16_T +typedef unsigned short uint16_t; +#endif + +#if ! U_HAVE_INT32_T +typedef signed int int32_t; +#endif + +#if ! U_HAVE_UINT32_T +typedef unsigned int uint32_t; +#endif + +#if ! U_HAVE_INT64_T +#ifdef _MSC_VER + typedef signed __int64 int64_t; +#else + typedef signed long long int64_t; +#endif +#endif + +#if ! U_HAVE_UINT64_T +#ifdef _MSC_VER + typedef unsigned __int64 uint64_t; +#else + typedef unsigned long long uint64_t; +#endif +#endif + +#endif /* U_HAVE_STDINT_H / U_HAVE_INTTYPES_H */ + +#endif /* _PTYPES_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/putil.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/putil.h new file mode 100644 index 0000000..406551a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/putil.h @@ -0,0 +1,183 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1997-2014, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* +* FILE NAME : putil.h +* +* Date Name Description +* 05/14/98 nos Creation (content moved here from utypes.h). +* 06/17/99 erm Added IEEE_754 +* 07/22/98 stephen Added IEEEremainder, max, min, trunc +* 08/13/98 stephen Added isNegativeInfinity, isPositiveInfinity +* 08/24/98 stephen Added longBitsFromDouble +* 03/02/99 stephen Removed openFile(). Added AS400 support. +* 04/15/99 stephen Converted to C +* 11/15/99 helena Integrated S/390 changes for IEEE support. +* 01/11/00 helena Added u_getVersion. +****************************************************************************** +*/ + +#ifndef PUTIL_H +#define PUTIL_H + +#include "unicode/utypes.h" + /** + * \file + * \brief C API: Platform Utilities + */ + +/*==========================================================================*/ +/* Platform utilities */ +/*==========================================================================*/ + +/** + * Platform utilities isolates the platform dependencies of the + * libarary. For each platform which this code is ported to, these + * functions may have to be re-implemented. + */ + +/** + * Return the ICU data directory. + * The data directory is where common format ICU data files (.dat files) + * are loaded from. Note that normal use of the built-in ICU + * facilities does not require loading of an external data file; + * unless you are adding custom data to ICU, the data directory + * does not need to be set. + * + * The data directory is determined as follows: + * If u_setDataDirectory() has been called, that is it, otherwise + * if the ICU_DATA environment variable is set, use that, otherwise + * If a data directory was specifed at ICU build time + * + * \code + * #define ICU_DATA_DIR "path" + * \endcode + * use that, + * otherwise no data directory is available. + * + * @return the data directory, or an empty string ("") if no data directory has + * been specified. + * + * @stable ICU 2.0 + */ +U_STABLE const char* U_EXPORT2 u_getDataDirectory(void); + + +/** + * Set the ICU data directory. + * The data directory is where common format ICU data files (.dat files) + * are loaded from. Note that normal use of the built-in ICU + * facilities does not require loading of an external data file; + * unless you are adding custom data to ICU, the data directory + * does not need to be set. + * + * This function should be called at most once in a process, before the + * first ICU operation (e.g., u_init()) that will require the loading of an + * ICU data file. + * This function is not thread-safe. Use it before calling ICU APIs from + * multiple threads. + * + * @param directory The directory to be set. + * + * @see u_init + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 u_setDataDirectory(const char *directory); + +#ifndef U_HIDE_INTERNAL_API +/** + * Return the time zone files override directory, or an empty string if + * no directory was specified. Certain time zone resources will be preferrentially + * loaded from individual files in this directory. + * + * @return the time zone data override directory. + * @internal + */ +U_INTERNAL const char * U_EXPORT2 u_getTimeZoneFilesDirectory(UErrorCode *status); + +/** + * Set the time zone files override directory. + * This function is not thread safe; it must not be called concurrently with + * u_getTimeZoneFilesDirectory() or any other use of ICU time zone functions. + * This function should only be called before using any ICU service that + * will access the time zone data. + * @internal + */ +U_INTERNAL void U_EXPORT2 u_setTimeZoneFilesDirectory(const char *path, UErrorCode *status); +#endif /* U_HIDE_INTERNAL_API */ + + +/** + * @{ + * Filesystem file and path separator characters. + * Example: '/' and ':' on Unix, '\\' and ';' on Windows. + * @stable ICU 2.0 + */ +#if U_PLATFORM_USES_ONLY_WIN32_API +# define U_FILE_SEP_CHAR '\\' +# define U_FILE_ALT_SEP_CHAR '/' +# define U_PATH_SEP_CHAR ';' +# define U_FILE_SEP_STRING "\\" +# define U_FILE_ALT_SEP_STRING "/" +# define U_PATH_SEP_STRING ";" +#else +# define U_FILE_SEP_CHAR '/' +# define U_FILE_ALT_SEP_CHAR '/' +# define U_PATH_SEP_CHAR ':' +# define U_FILE_SEP_STRING "/" +# define U_FILE_ALT_SEP_STRING "/" +# define U_PATH_SEP_STRING ":" +#endif + +/** @} */ + +/** + * Convert char characters to UChar characters. + * This utility function is useful only for "invariant characters" + * that are encoded in the platform default encoding. + * They are a small, constant subset of the encoding and include + * just the latin letters, digits, and some punctuation. + * For details, see U_CHARSET_FAMILY. + * + * @param cs Input string, points to length + * character bytes from a subset of the platform encoding. + * @param us Output string, points to memory for length + * Unicode characters. + * @param length The number of characters to convert; this may + * include the terminating NUL. + * + * @see U_CHARSET_FAMILY + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +u_charsToUChars(const char *cs, UChar *us, int32_t length); + +/** + * Convert UChar characters to char characters. + * This utility function is useful only for "invariant characters" + * that can be encoded in the platform default encoding. + * They are a small, constant subset of the encoding and include + * just the latin letters, digits, and some punctuation. + * For details, see U_CHARSET_FAMILY. + * + * @param us Input string, points to length + * Unicode characters that can be encoded with the + * codepage-invariant subset of the platform encoding. + * @param cs Output string, points to memory for length + * character bytes. + * @param length The number of characters to convert; this may + * include the terminating NUL. + * + * @see U_CHARSET_FAMILY + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +u_UCharsToChars(const UChar *us, char *cs, int32_t length); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/rbbi.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/rbbi.h new file mode 100644 index 0000000..521e502 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/rbbi.h @@ -0,0 +1,717 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +*************************************************************************** +* Copyright (C) 1999-2016 International Business Machines Corporation * +* and others. All rights reserved. * +*************************************************************************** + +********************************************************************** +* Date Name Description +* 10/22/99 alan Creation. +* 11/11/99 rgillam Complete port from Java. +********************************************************************** +*/ + +#ifndef RBBI_H +#define RBBI_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Rule Based Break Iterator + */ + +#if !UCONFIG_NO_BREAK_ITERATION + +#include "unicode/brkiter.h" +#include "unicode/udata.h" +#include "unicode/parseerr.h" +#include "unicode/schriter.h" +#include "unicode/uchriter.h" + +U_NAMESPACE_BEGIN + +/** @internal */ +class LanguageBreakEngine; +struct RBBIDataHeader; +class RBBIDataWrapper; +class UnhandledEngine; +class UStack; + +/** + * + * A subclass of BreakIterator whose behavior is specified using a list of rules. + *

Instances of this class are most commonly created by the factory methods of + * BreakIterator::createWordInstance(), BreakIterator::createLineInstance(), etc., + * and then used via the abstract API in class BreakIterator

+ * + *

See the ICU User Guide for information on Break Iterator Rules.

+ * + *

This class is not intended to be subclassed.

+ */ +class U_COMMON_API RuleBasedBreakIterator /*U_FINAL*/ : public BreakIterator { + +private: + /** + * The UText through which this BreakIterator accesses the text + * @internal + */ + UText *fText; + + /** + * A character iterator that refers to the same text as the UText, above. + * Only included for compatibility with old API, which was based on CharacterIterators. + * Value may be adopted from outside, or one of fSCharIter or fDCharIter, below. + */ + CharacterIterator *fCharIter; + + /** + * When the input text is provided by a UnicodeString, this will point to + * a characterIterator that wraps that data. Needed only for the + * implementation of getText(), a backwards compatibility issue. + */ + StringCharacterIterator *fSCharIter; + + /** + * When the input text is provided by a UText, this + * dummy CharacterIterator over an empty string will + * be returned from getText() + */ + UCharCharacterIterator *fDCharIter; + + /** + * The rule data for this BreakIterator instance + * @internal + */ + RBBIDataWrapper *fData; + + /** + * The iteration state - current position, rule status for the current position, + * and whether the iterator ran off the end, yielding UBRK_DONE. + * Current position is pinned to be 0 < position <= text.length. + * Current position is always set to a boundary. + * @internal + */ + /** + * The current position of the iterator. Pinned, 0 < fPosition <= text.length. + * Never has the value UBRK_DONE (-1). + */ + int32_t fPosition; + + /** + * TODO: + */ + int32_t fRuleStatusIndex; + + /** + * True when iteration has run off the end, and iterator functions should return UBRK_DONE. + */ + UBool fDone; + + /** + * Cache of previously determined boundary positions. + */ + public: // TODO: debug, return to private. + class BreakCache; + BreakCache *fBreakCache; + private: + /** + * Counter for the number of characters encountered with the "dictionary" + * flag set. + * @internal + */ + uint32_t fDictionaryCharCount; + + /** + * Cache of boundary positions within a region of text that has been + * sub-divided by dictionary based breaking. + */ + class DictionaryCache; + DictionaryCache *fDictionaryCache; + + /** + * + * If present, UStack of LanguageBreakEngine objects that might handle + * dictionary characters. Searched from top to bottom to find an object to + * handle a given character. + * @internal + */ + UStack *fLanguageBreakEngines; + + /** + * + * If present, the special LanguageBreakEngine used for handling + * characters that are in the dictionary set, but not handled by any + * LangugageBreakEngine. + * @internal + */ + UnhandledEngine *fUnhandledBreakEngine; + + /** + * + * The type of the break iterator, or -1 if it has not been set. + * @internal + */ + int32_t fBreakType; + + //======================================================================= + // constructors + //======================================================================= + + /** + * Constructor from a flattened set of RBBI data in malloced memory. + * RulesBasedBreakIterators built from a custom set of rules + * are created via this constructor; the rules are compiled + * into memory, then the break iterator is constructed here. + * + * The break iterator adopts the memory, and will + * free it when done. + * @internal + */ + RuleBasedBreakIterator(RBBIDataHeader* data, UErrorCode &status); + + /** @internal */ + friend class RBBIRuleBuilder; + /** @internal */ + friend class BreakIterator; + +public: + + /** Default constructor. Creates an empty shell of an iterator, with no + * rules or text to iterate over. Object can subsequently be assigned to. + * @stable ICU 2.2 + */ + RuleBasedBreakIterator(); + + /** + * Copy constructor. Will produce a break iterator with the same behavior, + * and which iterates over the same text, as the one passed in. + * @param that The RuleBasedBreakIterator passed to be copied + * @stable ICU 2.0 + */ + RuleBasedBreakIterator(const RuleBasedBreakIterator& that); + + /** + * Construct a RuleBasedBreakIterator from a set of rules supplied as a string. + * @param rules The break rules to be used. + * @param parseError In the event of a syntax error in the rules, provides the location + * within the rules of the problem. + * @param status Information on any errors encountered. + * @stable ICU 2.2 + */ + RuleBasedBreakIterator( const UnicodeString &rules, + UParseError &parseError, + UErrorCode &status); + + /** + * Contruct a RuleBasedBreakIterator from a set of precompiled binary rules. + * Binary rules are obtained from RulesBasedBreakIterator::getBinaryRules(). + * Construction of a break iterator in this way is substantially faster than + * constuction from source rules. + * + * Ownership of the storage containing the compiled rules remains with the + * caller of this function. The compiled rules must not be modified or + * deleted during the life of the break iterator. + * + * The compiled rules are not compatible across different major versions of ICU. + * The compiled rules are comaptible only between machines with the same + * byte ordering (little or big endian) and the same base character set family + * (ASCII or EBCDIC). + * + * @see #getBinaryRules + * @param compiledRules A pointer to the compiled break rules to be used. + * @param ruleLength The length of the compiled break rules, in bytes. This + * corresponds to the length value produced by getBinaryRules(). + * @param status Information on any errors encountered, including invalid + * binary rules. + * @stable ICU 4.8 + */ + RuleBasedBreakIterator(const uint8_t *compiledRules, + uint32_t ruleLength, + UErrorCode &status); + + /** + * This constructor uses the udata interface to create a BreakIterator + * whose internal tables live in a memory-mapped file. "image" is an + * ICU UDataMemory handle for the pre-compiled break iterator tables. + * @param image handle to the memory image for the break iterator data. + * Ownership of the UDataMemory handle passes to the Break Iterator, + * which will be responsible for closing it when it is no longer needed. + * @param status Information on any errors encountered. + * @see udata_open + * @see #getBinaryRules + * @stable ICU 2.8 + */ + RuleBasedBreakIterator(UDataMemory* image, UErrorCode &status); + + /** + * Destructor + * @stable ICU 2.0 + */ + virtual ~RuleBasedBreakIterator(); + + /** + * Assignment operator. Sets this iterator to have the same behavior, + * and iterate over the same text, as the one passed in. + * @param that The RuleBasedBreakItertor passed in + * @return the newly created RuleBasedBreakIterator + * @stable ICU 2.0 + */ + RuleBasedBreakIterator& operator=(const RuleBasedBreakIterator& that); + + /** + * Equality operator. Returns TRUE if both BreakIterators are of the + * same class, have the same behavior, and iterate over the same text. + * @param that The BreakIterator to be compared for equality + * @return TRUE if both BreakIterators are of the + * same class, have the same behavior, and iterate over the same text. + * @stable ICU 2.0 + */ + virtual UBool operator==(const BreakIterator& that) const; + + /** + * Not-equal operator. If operator== returns TRUE, this returns FALSE, + * and vice versa. + * @param that The BreakIterator to be compared for inequality + * @return TRUE if both BreakIterators are not same. + * @stable ICU 2.0 + */ + UBool operator!=(const BreakIterator& that) const; + + /** + * Returns a newly-constructed RuleBasedBreakIterator with the same + * behavior, and iterating over the same text, as this one. + * Differs from the copy constructor in that it is polymorphic, and + * will correctly clone (copy) a derived class. + * clone() is thread safe. Multiple threads may simultaeneously + * clone the same source break iterator. + * @return a newly-constructed RuleBasedBreakIterator + * @stable ICU 2.0 + */ + virtual BreakIterator* clone() const; + + /** + * Compute a hash code for this BreakIterator + * @return A hash code + * @stable ICU 2.0 + */ + virtual int32_t hashCode(void) const; + + /** + * Returns the description used to create this iterator + * @return the description used to create this iterator + * @stable ICU 2.0 + */ + virtual const UnicodeString& getRules(void) const; + + //======================================================================= + // BreakIterator overrides + //======================================================================= + + /** + *

+ * Return a CharacterIterator over the text being analyzed. + * The returned character iterator is owned by the break iterator, and must + * not be deleted by the caller. Repeated calls to this function may + * return the same CharacterIterator. + *

+ *

+ * The returned character iterator must not be used concurrently with + * the break iterator. If concurrent operation is needed, clone the + * returned character iterator first and operate on the clone. + *

+ *

+ * When the break iterator is operating on text supplied via a UText, + * this function will fail. Lacking any way to signal failures, it + * returns an CharacterIterator containing no text. + * The function getUText() provides similar functionality, + * is reliable, and is more efficient. + *

+ * + * TODO: deprecate this function? + * + * @return An iterator over the text being analyzed. + * @stable ICU 2.0 + */ + virtual CharacterIterator& getText(void) const; + + + /** + * Get a UText for the text being analyzed. + * The returned UText is a shallow clone of the UText used internally + * by the break iterator implementation. It can safely be used to + * access the text without impacting any break iterator operations, + * but the underlying text itself must not be altered. + * + * @param fillIn A UText to be filled in. If NULL, a new UText will be + * allocated to hold the result. + * @param status receives any error codes. + * @return The current UText for this break iterator. If an input + * UText was provided, it will always be returned. + * @stable ICU 3.4 + */ + virtual UText *getUText(UText *fillIn, UErrorCode &status) const; + + /** + * Set the iterator to analyze a new piece of text. This function resets + * the current iteration position to the beginning of the text. + * @param newText An iterator over the text to analyze. The BreakIterator + * takes ownership of the character iterator. The caller MUST NOT delete it! + * @stable ICU 2.0 + */ + virtual void adoptText(CharacterIterator* newText); + + /** + * Set the iterator to analyze a new piece of text. This function resets + * the current iteration position to the beginning of the text. + * + * The BreakIterator will retain a reference to the supplied string. + * The caller must not modify or delete the text while the BreakIterator + * retains the reference. + * + * @param newText The text to analyze. + * @stable ICU 2.0 + */ + virtual void setText(const UnicodeString& newText); + + /** + * Reset the break iterator to operate over the text represented by + * the UText. The iterator position is reset to the start. + * + * This function makes a shallow clone of the supplied UText. This means + * that the caller is free to immediately close or otherwise reuse the + * Utext that was passed as a parameter, but that the underlying text itself + * must not be altered while being referenced by the break iterator. + * + * @param text The UText used to change the text. + * @param status Receives any error codes. + * @stable ICU 3.4 + */ + virtual void setText(UText *text, UErrorCode &status); + + /** + * Sets the current iteration position to the beginning of the text, position zero. + * @return The offset of the beginning of the text, zero. + * @stable ICU 2.0 + */ + virtual int32_t first(void); + + /** + * Sets the current iteration position to the end of the text. + * @return The text's past-the-end offset. + * @stable ICU 2.0 + */ + virtual int32_t last(void); + + /** + * Advances the iterator either forward or backward the specified number of steps. + * Negative values move backward, and positive values move forward. This is + * equivalent to repeatedly calling next() or previous(). + * @param n The number of steps to move. The sign indicates the direction + * (negative is backwards, and positive is forwards). + * @return The character offset of the boundary position n boundaries away from + * the current one. + * @stable ICU 2.0 + */ + virtual int32_t next(int32_t n); + + /** + * Advances the iterator to the next boundary position. + * @return The position of the first boundary after this one. + * @stable ICU 2.0 + */ + virtual int32_t next(void); + + /** + * Moves the iterator backwards, to the last boundary preceding this one. + * @return The position of the last boundary position preceding this one. + * @stable ICU 2.0 + */ + virtual int32_t previous(void); + + /** + * Sets the iterator to refer to the first boundary position following + * the specified position. + * @param offset The position from which to begin searching for a break position. + * @return The position of the first break after the current position. + * @stable ICU 2.0 + */ + virtual int32_t following(int32_t offset); + + /** + * Sets the iterator to refer to the last boundary position before the + * specified position. + * @param offset The position to begin searching for a break from. + * @return The position of the last boundary before the starting position. + * @stable ICU 2.0 + */ + virtual int32_t preceding(int32_t offset); + + /** + * Returns true if the specfied position is a boundary position. As a side + * effect, leaves the iterator pointing to the first boundary position at + * or after "offset". + * @param offset the offset to check. + * @return True if "offset" is a boundary position. + * @stable ICU 2.0 + */ + virtual UBool isBoundary(int32_t offset); + + /** + * Returns the current iteration position. Note that UBRK_DONE is never + * returned from this function; if iteration has run to the end of a + * string, current() will return the length of the string while + * next() will return UBRK_DONE). + * @return The current iteration position. + * @stable ICU 2.0 + */ + virtual int32_t current(void) const; + + + /** + * Return the status tag from the break rule that determined the most recently + * returned break position. For break rules that do not specify a + * status, a default value of 0 is returned. If more than one break rule + * would cause a boundary to be located at some position in the text, + * the numerically largest of the applicable status values is returned. + *

+ * Of the standard types of ICU break iterators, only word break and + * line break provide status values. The values are defined in + * the header file ubrk.h. For Word breaks, the status allows distinguishing between words + * that contain alphabetic letters, "words" that appear to be numbers, + * punctuation and spaces, words containing ideographic characters, and + * more. For Line Break, the status distinguishes between hard (mandatory) breaks + * and soft (potential) break positions. + *

+ * getRuleStatus() can be called after obtaining a boundary + * position from next(), previous(), or + * any other break iterator functions that returns a boundary position. + *

+ * When creating custom break rules, one is free to define whatever + * status values may be convenient for the application. + *

+ * Note: this function is not thread safe. It should not have been + * declared const, and the const remains only for compatibility + * reasons. (The function is logically const, but not bit-wise const). + * TODO: check this. Probably thread safe now. + *

+ * @return the status from the break rule that determined the most recently + * returned break position. + * + * @see UWordBreak + * @stable ICU 2.2 + */ + virtual int32_t getRuleStatus() const; + + /** + * Get the status (tag) values from the break rule(s) that determined the most + * recently returned break position. + *

+ * The returned status value(s) are stored into an array provided by the caller. + * The values are stored in sorted (ascending) order. + * If the capacity of the output array is insufficient to hold the data, + * the output will be truncated to the available length, and a + * U_BUFFER_OVERFLOW_ERROR will be signaled. + * + * @param fillInVec an array to be filled in with the status values. + * @param capacity the length of the supplied vector. A length of zero causes + * the function to return the number of status values, in the + * normal way, without attemtping to store any values. + * @param status receives error codes. + * @return The number of rule status values from rules that determined + * the most recent boundary returned by the break iterator. + * In the event of a U_BUFFER_OVERFLOW_ERROR, the return value + * is the total number of status values that were available, + * not the reduced number that were actually returned. + * @see getRuleStatus + * @stable ICU 3.0 + */ + virtual int32_t getRuleStatusVec(int32_t *fillInVec, int32_t capacity, UErrorCode &status); + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. + * This method is to implement a simple version of RTTI, since not all + * C++ compilers support genuine RTTI. Polymorphic operator==() and + * clone() methods call this method. + * + * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @stable ICU 2.0 + */ + virtual UClassID getDynamicClassID(void) const; + + /** + * Returns the class ID for this class. This is useful only for + * comparing to a return value from getDynamicClassID(). For example: + * + * Base* polymorphic_pointer = createPolymorphicObject(); + * if (polymorphic_pointer->getDynamicClassID() == + * Derived::getStaticClassID()) ... + * + * @return The class ID for all objects of this class. + * @stable ICU 2.0 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Deprecated functionality. Use clone() instead. + * + * Create a clone (copy) of this break iterator in memory provided + * by the caller. The idea is to increase performance by avoiding + * a storage allocation. Use of this functoin is NOT RECOMMENDED. + * Performance gains are minimal, and correct buffer management is + * tricky. Use clone() instead. + * + * @param stackBuffer The pointer to the memory into which the cloned object + * should be placed. If NULL, allocate heap memory + * for the cloned object. + * @param BufferSize The size of the buffer. If zero, return the required + * buffer size, but do not clone the object. If the + * size was too small (but not zero), allocate heap + * storage for the cloned object. + * + * @param status Error status. U_SAFECLONE_ALLOCATED_WARNING will be + * returned if the the provided buffer was too small, and + * the clone was therefore put on the heap. + * + * @return Pointer to the clone object. This may differ from the stackBuffer + * address if the byte alignment of the stack buffer was not suitable + * or if the stackBuffer was too small to hold the clone. + * @deprecated ICU 52. Use clone() instead. + */ + virtual BreakIterator * createBufferClone(void *stackBuffer, + int32_t &BufferSize, + UErrorCode &status); + + + /** + * Return the binary form of compiled break rules, + * which can then be used to create a new break iterator at some + * time in the future. Creating a break iterator from pre-compiled rules + * is much faster than building one from the source form of the + * break rules. + * + * The binary data can only be used with the same version of ICU + * and on the same platform type (processor endian-ness) + * + * @param length Returns the length of the binary data. (Out paramter.) + * + * @return A pointer to the binary (compiled) rule data. The storage + * belongs to the RulesBasedBreakIterator object, not the + * caller, and must not be modified or deleted. + * @stable ICU 4.8 + */ + virtual const uint8_t *getBinaryRules(uint32_t &length); + + /** + * Set the subject text string upon which the break iterator is operating + * without changing any other aspect of the matching state. + * The new and previous text strings must have the same content. + * + * This function is intended for use in environments where ICU is operating on + * strings that may move around in memory. It provides a mechanism for notifying + * ICU that the string has been relocated, and providing a new UText to access the + * string in its new position. + * + * Note that the break iterator implementation never copies the underlying text + * of a string being processed, but always operates directly on the original text + * provided by the user. Refreshing simply drops the references to the old text + * and replaces them with references to the new. + * + * Caution: this function is normally used only by very specialized, + * system-level code. One example use case is with garbage collection that moves + * the text in memory. + * + * @param input The new (moved) text string. + * @param status Receives errors detected by this function. + * @return *this + * + * @stable ICU 49 + */ + virtual RuleBasedBreakIterator &refreshInputText(UText *input, UErrorCode &status); + + +private: + //======================================================================= + // implementation + //======================================================================= + /** + * Dumps caches and performs other actions associated with a complete change + * in text or iteration position. + * @internal + */ + void reset(void); + + /** + * Set the type of the break iterator. + * @internal + */ + void setBreakType(int32_t type); + + /** + * Common initialization function, used by constructors and bufferClone. + * @internal + */ + void init(UErrorCode &status); + + /** + * Iterate backwards from an arbitrary position in the input text using the Safe Reverse rules. + * This locates a "Safe Position" from which the forward break rules + * will operate correctly. A Safe Position is not necessarily a boundary itself. + * + * @param fromPosition the position in the input text to begin the iteration. + * @internal + */ + int32_t handlePrevious(int32_t fromPosition); + + /** + * Find a rule-based boundary by running the state machine. + * Input + * fPosition, the position in the text to begin from. + * Output + * fPosition: the boundary following the starting position. + * fDictionaryCharCount the number of dictionary characters encountered. + * If > 0, the segment will be further subdivided + * fRuleStatusIndex Info from the state table indicating which rules caused the boundary. + * + * @internal + */ + int32_t handleNext(); + + + /** + * This function returns the appropriate LanguageBreakEngine for a + * given character c. + * @param c A character in the dictionary set + * @internal + */ + const LanguageBreakEngine *getLanguageBreakEngine(UChar32 c); + + public: +#ifndef U_HIDE_INTERNAL_API + /** + * Debugging function only. + * @internal + */ + void dumpCache(); +#endif /* U_HIDE_INTERNAL_API */ +}; + +//------------------------------------------------------------------------------ +// +// Inline Functions Definitions ... +// +//------------------------------------------------------------------------------ + +inline UBool RuleBasedBreakIterator::operator!=(const BreakIterator& that) const { + return !operator==(that); +} + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_BREAK_ITERATION */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/rbnf.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/rbnf.h new file mode 100644 index 0000000..1292544 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/rbnf.h @@ -0,0 +1,1140 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 1997-2015, International Business Machines Corporation and others. +* All Rights Reserved. +******************************************************************************* +*/ + +#ifndef RBNF_H +#define RBNF_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Rule Based Number Format + */ + +/** + * \def U_HAVE_RBNF + * This will be 0 if RBNF support is not included in ICU + * and 1 if it is. + * + * @stable ICU 2.4 + */ +#if UCONFIG_NO_FORMATTING +#define U_HAVE_RBNF 0 +#else +#define U_HAVE_RBNF 1 + +#include "unicode/dcfmtsym.h" +#include "unicode/fmtable.h" +#include "unicode/locid.h" +#include "unicode/numfmt.h" +#include "unicode/unistr.h" +#include "unicode/strenum.h" +#include "unicode/brkiter.h" +#include "unicode/upluralrules.h" + +U_NAMESPACE_BEGIN + +class NFRule; +class NFRuleSet; +class LocalizationInfo; +class PluralFormat; +class RuleBasedCollator; + +/** + * Tags for the predefined rulesets. + * + * @stable ICU 2.2 + */ +enum URBNFRuleSetTag { + URBNF_SPELLOUT, + URBNF_ORDINAL, + URBNF_DURATION, + URBNF_NUMBERING_SYSTEM, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal URBNFRuleSetTag value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + URBNF_COUNT +#endif // U_HIDE_DEPRECATED_API +}; + +/** + * The RuleBasedNumberFormat class formats numbers according to a set of rules. This number formatter is + * typically used for spelling out numeric values in words (e.g., 25,3476 as + * "twenty-five thousand three hundred seventy-six" or "vingt-cinq mille trois + * cents soixante-seize" or + * "fünfundzwanzigtausenddreihundertsechsundsiebzig"), but can also be used for + * other complicated formatting tasks, such as formatting a number of seconds as hours, + * minutes and seconds (e.g., 3,730 as "1:02:10"). + * + *

The resources contain three predefined formatters for each locale: spellout, which + * spells out a value in words (123 is "one hundred twenty-three"); ordinal, which + * appends an ordinal suffix to the end of a numeral (123 is "123rd"); and + * duration, which shows a duration in seconds as hours, minutes, and seconds (123 is + * "2:03").  The client can also define more specialized RuleBasedNumberFormats + * by supplying programmer-defined rule sets.

+ * + *

The behavior of a RuleBasedNumberFormat is specified by a textual description + * that is either passed to the constructor as a String or loaded from a resource + * bundle. In its simplest form, the description consists of a semicolon-delimited list of rules. + * Each rule has a string of output text and a value or range of values it is applicable to. + * In a typical spellout rule set, the first twenty rules are the words for the numbers from + * 0 to 19:

+ * + *
zero; one; two; three; four; five; six; seven; eight; nine;
+ * ten; eleven; twelve; thirteen; fourteen; fifteen; sixteen; seventeen; eighteen; nineteen;
+ * + *

For larger numbers, we can use the preceding set of rules to format the ones place, and + * we only have to supply the words for the multiples of 10:

+ * + *
 20: twenty[->>];
+ * 30: thirty[->>];
+ * 40: forty[->>];
+ * 50: fifty[->>];
+ * 60: sixty[->>];
+ * 70: seventy[->>];
+ * 80: eighty[->>];
+ * 90: ninety[->>];
+ * + *

In these rules, the base value is spelled out explicitly and set off from the + * rule's output text with a colon. The rules are in a sorted list, and a rule is applicable + * to all numbers from its own base value to one less than the next rule's base value. The + * ">>" token is called a substitution and tells the fomatter to + * isolate the number's ones digit, format it using this same set of rules, and place the + * result at the position of the ">>" token. Text in brackets is omitted if + * the number being formatted is an even multiple of 10 (the hyphen is a literal hyphen; 24 + * is "twenty-four," not "twenty four").

+ * + *

For even larger numbers, we can actually look up several parts of the number in the + * list:

+ * + *
100: << hundred[ >>];
+ * + *

The "<<" represents a new kind of substitution. The << isolates + * the hundreds digit (and any digits to its left), formats it using this same rule set, and + * places the result where the "<<" was. Notice also that the meaning of + * >> has changed: it now refers to both the tens and the ones digits. The meaning of + * both substitutions depends on the rule's base value. The base value determines the rule's divisor, + * which is the highest power of 10 that is less than or equal to the base value (the user + * can change this). To fill in the substitutions, the formatter divides the number being + * formatted by the divisor. The integral quotient is used to fill in the << + * substitution, and the remainder is used to fill in the >> substitution. The meaning + * of the brackets changes similarly: text in brackets is omitted if the value being + * formatted is an even multiple of the rule's divisor. The rules are applied recursively, so + * if a substitution is filled in with text that includes another substitution, that + * substitution is also filled in.

+ * + *

This rule covers values up to 999, at which point we add another rule:

+ * + *
1000: << thousand[ >>];
+ * + *

Again, the meanings of the brackets and substitution tokens shift because the rule's + * base value is a higher power of 10, changing the rule's divisor. This rule can actually be + * used all the way up to 999,999. This allows us to finish out the rules as follows:

+ * + *
 1,000,000: << million[ >>];
+ * 1,000,000,000: << billion[ >>];
+ * 1,000,000,000,000: << trillion[ >>];
+ * 1,000,000,000,000,000: OUT OF RANGE!;
+ * + *

Commas, periods, and spaces can be used in the base values to improve legibility and + * are ignored by the rule parser. The last rule in the list is customarily treated as an + * "overflow rule," applying to everything from its base value on up, and often (as + * in this example) being used to print out an error message or default representation. + * Notice also that the size of the major groupings in large numbers is controlled by the + * spacing of the rules: because in English we group numbers by thousand, the higher rules + * are separated from each other by a factor of 1,000.

+ * + *

To see how these rules actually work in practice, consider the following example: + * Formatting 25,430 with this rule set would work like this:

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
<< thousand >>[the rule whose base value is 1,000 is applicable to 25,340]
twenty->> thousand >>[25,340 over 1,000 is 25. The rule for 20 applies.]
twenty-five thousand >>[25 mod 10 is 5. The rule for 5 is "five."
twenty-five thousand << hundred >>[25,340 mod 1,000 is 340. The rule for 100 applies.]
twenty-five thousand three hundred >>[340 over 100 is 3. The rule for 3 is "three."]
twenty-five thousand three hundred forty[340 mod 100 is 40. The rule for 40 applies. Since 40 divides + * evenly by 10, the hyphen and substitution in the brackets are omitted.]
+ * + *

The above syntax suffices only to format positive integers. To format negative numbers, + * we add a special rule:

+ * + *
-x: minus >>;
+ * + *

This is called a negative-number rule, and is identified by "-x" + * where the base value would be. This rule is used to format all negative numbers. the + * >> token here means "find the number's absolute value, format it with these + * rules, and put the result here."

+ * + *

We also add a special rule called a fraction rule for numbers with fractional + * parts:

+ * + *
x.x: << point >>;
+ * + *

This rule is used for all positive non-integers (negative non-integers pass through the + * negative-number rule first and then through this rule). Here, the << token refers to + * the number's integral part, and the >> to the number's fractional part. The + * fractional part is formatted as a series of single-digit numbers (e.g., 123.456 would be + * formatted as "one hundred twenty-three point four five six").

+ * + *

To see how this rule syntax is applied to various languages, examine the resource data.

+ * + *

There is actually much more flexibility built into the rule language than the + * description above shows. A formatter may own multiple rule sets, which can be selected by + * the caller, and which can use each other to fill in their substitutions. Substitutions can + * also be filled in with digits, using a DecimalFormat object. There is syntax that can be + * used to alter a rule's divisor in various ways. And there is provision for much more + * flexible fraction handling. A complete description of the rule syntax follows:

+ * + *
+ * + *

The description of a RuleBasedNumberFormat's behavior consists of one or more rule + * sets. Each rule set consists of a name, a colon, and a list of rules. A rule + * set name must begin with a % sign. Rule sets with names that begin with a single % sign + * are public: the caller can specify that they be used to format and parse numbers. + * Rule sets with names that begin with %% are private: they exist only for the use + * of other rule sets. If a formatter only has one rule set, the name may be omitted.

+ * + *

The user can also specify a special "rule set" named %%lenient-parse. + * The body of %%lenient-parse isn't a set of number-formatting rules, but a RuleBasedCollator + * description which is used to define equivalences for lenient parsing. For more information + * on the syntax, see RuleBasedCollator. For more information on lenient parsing, + * see setLenientParse(). Note: symbols that have syntactic meaning + * in collation rules, such as '&', have no particular meaning when appearing outside + * of the lenient-parse rule set.

+ * + *

The body of a rule set consists of an ordered, semicolon-delimited list of rules. + * Internally, every rule has a base value, a divisor, rule text, and zero, one, or two substitutions. + * These parameters are controlled by the description syntax, which consists of a rule + * descriptor, a colon, and a rule body.

+ * + *

A rule descriptor can take one of the following forms (text in italics is the + * name of a token):

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
bv:bv specifies the rule's base value. bv is a decimal + * number expressed using ASCII digits. bv may contain spaces, period, and commas, + * which are ignored. The rule's divisor is the highest power of 10 less than or equal to + * the base value.
bv/rad:bv specifies the rule's base value. The rule's divisor is the + * highest power of rad less than or equal to the base value.
bv>:bv specifies the rule's base value. To calculate the divisor, + * let the radix be 10, and the exponent be the highest exponent of the radix that yields a + * result less than or equal to the base value. Every > character after the base value + * decreases the exponent by 1. If the exponent is positive or 0, the divisor is the radix + * raised to the power of the exponent; otherwise, the divisor is 1.
bv/rad>:bv specifies the rule's base value. To calculate the divisor, + * let the radix be rad, and the exponent be the highest exponent of the radix that + * yields a result less than or equal to the base value. Every > character after the radix + * decreases the exponent by 1. If the exponent is positive or 0, the divisor is the radix + * raised to the power of the exponent; otherwise, the divisor is 1.
-x:The rule is a negative-number rule.
x.x:The rule is an improper fraction rule. If the full stop in + * the middle of the rule name is replaced with the decimal point + * that is used in the language or DecimalFormatSymbols, then that rule will + * have precedence when formatting and parsing this rule. For example, some + * languages use the comma, and can thus be written as x,x instead. For example, + * you can use "x.x: << point >>;x,x: << comma >>;" to + * handle the decimal point that matches the language's natural spelling of + * the punctuation of either the full stop or comma.
0.x:The rule is a proper fraction rule. If the full stop in + * the middle of the rule name is replaced with the decimal point + * that is used in the language or DecimalFormatSymbols, then that rule will + * have precedence when formatting and parsing this rule. For example, some + * languages use the comma, and can thus be written as 0,x instead. For example, + * you can use "0.x: point >>;0,x: comma >>;" to + * handle the decimal point that matches the language's natural spelling of + * the punctuation of either the full stop or comma.
x.0:The rule is a master rule. If the full stop in + * the middle of the rule name is replaced with the decimal point + * that is used in the language or DecimalFormatSymbols, then that rule will + * have precedence when formatting and parsing this rule. For example, some + * languages use the comma, and can thus be written as x,0 instead. For example, + * you can use "x.0: << point;x,0: << comma;" to + * handle the decimal point that matches the language's natural spelling of + * the punctuation of either the full stop or comma.
Inf:The rule for infinity.
NaN:The rule for an IEEE 754 NaN (not a number).
nothingIf the rule's rule descriptor is left out, the base value is one plus the + * preceding rule's base value (or zero if this is the first rule in the list) in a normal + * rule set.  In a fraction rule set, the base value is the same as the preceding rule's + * base value.
+ * + *

A rule set may be either a regular rule set or a fraction rule set, depending + * on whether it is used to format a number's integral part (or the whole number) or a + * number's fractional part. Using a rule set to format a rule's fractional part makes it a + * fraction rule set.

+ * + *

Which rule is used to format a number is defined according to one of the following + * algorithms: If the rule set is a regular rule set, do the following: + * + *

    + *
  • If the rule set includes a master rule (and the number was passed in as a double), + * use the master rule.  (If the number being formatted was passed in as a long, + * the master rule is ignored.)
  • + *
  • If the number is negative, use the negative-number rule.
  • + *
  • If the number has a fractional part and is greater than 1, use the improper fraction + * rule.
  • + *
  • If the number has a fractional part and is between 0 and 1, use the proper fraction + * rule.
  • + *
  • Binary-search the rule list for the rule with the highest base value less than or equal + * to the number. If that rule has two substitutions, its base value is not an even multiple + * of its divisor, and the number is an even multiple of the rule's divisor, use the + * rule that precedes it in the rule list. Otherwise, use the rule itself.
  • + *
+ * + *

If the rule set is a fraction rule set, do the following: + * + *

    + *
  • Ignore negative-number and fraction rules.
  • + *
  • For each rule in the list, multiply the number being formatted (which will always be + * between 0 and 1) by the rule's base value. Keep track of the distance between the result + * the nearest integer.
  • + *
  • Use the rule that produced the result closest to zero in the above calculation. In the + * event of a tie or a direct hit, use the first matching rule encountered. (The idea here is + * to try each rule's base value as a possible denominator of a fraction. Whichever + * denominator produces the fraction closest in value to the number being formatted wins.) If + * the rule following the matching rule has the same base value, use it if the numerator of + * the fraction is anything other than 1; if the numerator is 1, use the original matching + * rule. (This is to allow singular and plural forms of the rule text without a lot of extra + * hassle.)
  • + *
+ * + *

A rule's body consists of a string of characters terminated by a semicolon. The rule + * may include zero, one, or two substitution tokens, and a range of text in + * brackets. The brackets denote optional text (and may also include one or both + * substitutions). The exact meanings of the substitution tokens, and under what conditions + * optional text is omitted, depend on the syntax of the substitution token and the context. + * The rest of the text in a rule body is literal text that is output when the rule matches + * the number being formatted.

+ * + *

A substitution token begins and ends with a token character. The token + * character and the context together specify a mathematical operation to be performed on the + * number being formatted. An optional substitution descriptor specifies how the + * value resulting from that operation is used to fill in the substitution. The position of + * the substitution token in the rule body specifies the location of the resultant text in + * the original rule text.

+ * + *

The meanings of the substitution token characters are as follows:

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
>>in normal ruleDivide the number by the rule's divisor and format the remainder
in negative-number ruleFind the absolute value of the number and format the result
in fraction or master ruleIsolate the number's fractional part and format it.
in rule in fraction rule setNot allowed.
>>>in normal ruleDivide the number by the rule's divisor and format the remainder, + * but bypass the normal rule-selection process and just use the + * rule that precedes this one in this rule list.
in all other rulesNot allowed.
<<in normal ruleDivide the number by the rule's divisor and format the quotient
in negative-number ruleNot allowed.
in fraction or master ruleIsolate the number's integral part and format it.
in rule in fraction rule setMultiply the number by the rule's base value and format the result.
==in all rule setsFormat the number unchanged
[]in normal ruleOmit the optional text if the number is an even multiple of the rule's divisor
in negative-number ruleNot allowed.
in improper-fraction ruleOmit the optional text if the number is between 0 and 1 (same as specifying both an + * x.x rule and a 0.x rule)
in master ruleOmit the optional text if the number is an integer (same as specifying both an x.x + * rule and an x.0 rule)
in proper-fraction ruleNot allowed.
in rule in fraction rule setOmit the optional text if multiplying the number by the rule's base value yields 1.
$(cardinal,plural syntax)$in all rule setsThis provides the ability to choose a word based on the number divided by the radix to the power of the + * exponent of the base value for the specified locale, which is normally equivalent to the << value. + * This uses the cardinal plural rules from PluralFormat. All strings used in the plural format are treated + * as the same base value for parsing.
$(ordinal,plural syntax)$in all rule setsThis provides the ability to choose a word based on the number divided by the radix to the power of the + * exponent of the base value for the specified locale, which is normally equivalent to the << value. + * This uses the ordinal plural rules from PluralFormat. All strings used in the plural format are treated + * as the same base value for parsing.
+ * + *

The substitution descriptor (i.e., the text between the token characters) may take one + * of three forms:

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
a rule set namePerform the mathematical operation on the number, and format the result using the + * named rule set.
a DecimalFormat patternPerform the mathematical operation on the number, and format the result using a + * DecimalFormat with the specified pattern.  The pattern must begin with 0 or #.
nothingPerform the mathematical operation on the number, and format the result using the rule + * set containing the current rule, except: + *
    + *
  • You can't have an empty substitution descriptor with a == substitution.
  • + *
  • If you omit the substitution descriptor in a >> substitution in a fraction rule, + * format the result one digit at a time using the rule set containing the current rule.
  • + *
  • If you omit the substitution descriptor in a << substitution in a rule in a + * fraction rule set, format the result using the default rule set for this formatter.
  • + *
+ *
+ * + *

Whitespace is ignored between a rule set name and a rule set body, between a rule + * descriptor and a rule body, or between rules. If a rule body begins with an apostrophe, + * the apostrophe is ignored, but all text after it becomes significant (this is how you can + * have a rule's rule text begin with whitespace). There is no escape function: the semicolon + * is not allowed in rule set names or in rule text, and the colon is not allowed in rule set + * names. The characters beginning a substitution token are always treated as the beginning + * of a substitution token.

+ * + *

See the resource data and the demo program for annotated examples of real rule sets + * using these features.

+ * + *

User subclasses are not supported. While clients may write + * subclasses, such code will not necessarily work and will not be + * guaranteed to work stably from release to release. + * + *

Localizations

+ *

Constructors are available that allow the specification of localizations for the + * public rule sets (and also allow more control over what public rule sets are available). + * Localization data is represented as a textual description. The description represents + * an array of arrays of string. The first element is an array of the public rule set names, + * each of these must be one of the public rule set names that appear in the rules. Only + * names in this array will be treated as public rule set names by the API. Each subsequent + * element is an array of localizations of these names. The first element of one of these + * subarrays is the locale name, and the remaining elements are localizations of the + * public rule set names, in the same order as they were listed in the first arrray.

+ *

In the syntax, angle brackets '<', '>' are used to delimit the arrays, and comma ',' is used + * to separate elements of an array. Whitespace is ignored, unless quoted.

+ *

For example:

+ * < < %foo, %bar, %baz >,
+ *   < en, Foo, Bar, Baz >,
+ *   < fr, 'le Foo', 'le Bar', 'le Baz' >
+ *   < zh, \\u7532, \\u4e59, \\u4e19 > >
+ * 

+ * @author Richard Gillam + * @see NumberFormat + * @see DecimalFormat + * @see PluralFormat + * @see PluralRules + * @stable ICU 2.0 + */ +class U_I18N_API RuleBasedNumberFormat : public NumberFormat { +public: + + //----------------------------------------------------------------------- + // constructors + //----------------------------------------------------------------------- + + /** + * Creates a RuleBasedNumberFormat that behaves according to the description + * passed in. The formatter uses the default locale. + * @param rules A description of the formatter's desired behavior. + * See the class documentation for a complete explanation of the description + * syntax. + * @param perror The parse error if an error was encountered. + * @param status The status indicating whether the constructor succeeded. + * @stable ICU 3.2 + */ + RuleBasedNumberFormat(const UnicodeString& rules, UParseError& perror, UErrorCode& status); + + /** + * Creates a RuleBasedNumberFormat that behaves according to the description + * passed in. The formatter uses the default locale. + *

+ * The localizations data provides information about the public + * rule sets and their localized display names for different + * locales. The first element in the list is an array of the names + * of the public rule sets. The first element in this array is + * the initial default ruleset. The remaining elements in the + * list are arrays of localizations of the names of the public + * rule sets. Each of these is one longer than the initial array, + * with the first String being the ULocale ID, and the remaining + * Strings being the localizations of the rule set names, in the + * same order as the initial array. Arrays are NULL-terminated. + * @param rules A description of the formatter's desired behavior. + * See the class documentation for a complete explanation of the description + * syntax. + * @param localizations the localization information. + * names in the description. These will be copied by the constructor. + * @param perror The parse error if an error was encountered. + * @param status The status indicating whether the constructor succeeded. + * @stable ICU 3.2 + */ + RuleBasedNumberFormat(const UnicodeString& rules, const UnicodeString& localizations, + UParseError& perror, UErrorCode& status); + + /** + * Creates a RuleBasedNumberFormat that behaves according to the rules + * passed in. The formatter uses the specified locale to determine the + * characters to use when formatting numerals, and to define equivalences + * for lenient parsing. + * @param rules The formatter rules. + * See the class documentation for a complete explanation of the rule + * syntax. + * @param locale A locale that governs which characters are used for + * formatting values in numerals and which characters are equivalent in + * lenient parsing. + * @param perror The parse error if an error was encountered. + * @param status The status indicating whether the constructor succeeded. + * @stable ICU 2.0 + */ + RuleBasedNumberFormat(const UnicodeString& rules, const Locale& locale, + UParseError& perror, UErrorCode& status); + + /** + * Creates a RuleBasedNumberFormat that behaves according to the description + * passed in. The formatter uses the default locale. + *

+ * The localizations data provides information about the public + * rule sets and their localized display names for different + * locales. The first element in the list is an array of the names + * of the public rule sets. The first element in this array is + * the initial default ruleset. The remaining elements in the + * list are arrays of localizations of the names of the public + * rule sets. Each of these is one longer than the initial array, + * with the first String being the ULocale ID, and the remaining + * Strings being the localizations of the rule set names, in the + * same order as the initial array. Arrays are NULL-terminated. + * @param rules A description of the formatter's desired behavior. + * See the class documentation for a complete explanation of the description + * syntax. + * @param localizations a list of localizations for the rule set + * names in the description. These will be copied by the constructor. + * @param locale A locale that governs which characters are used for + * formatting values in numerals and which characters are equivalent in + * lenient parsing. + * @param perror The parse error if an error was encountered. + * @param status The status indicating whether the constructor succeeded. + * @stable ICU 3.2 + */ + RuleBasedNumberFormat(const UnicodeString& rules, const UnicodeString& localizations, + const Locale& locale, UParseError& perror, UErrorCode& status); + + /** + * Creates a RuleBasedNumberFormat from a predefined ruleset. The selector + * code choosed among three possible predefined formats: spellout, ordinal, + * and duration. + * @param tag A selector code specifying which kind of formatter to create for that + * locale. There are four legal values: URBNF_SPELLOUT, which creates a formatter that + * spells out a value in words in the desired language, URBNF_ORDINAL, which attaches + * an ordinal suffix from the desired language to the end of a number (e.g. "123rd"), + * URBNF_DURATION, which formats a duration in seconds as hours, minutes, and seconds always rounding down, + * and URBNF_NUMBERING_SYSTEM, which is used to invoke rules for alternate numbering + * systems such as the Hebrew numbering system, or for Roman Numerals, etc. + * @param locale The locale for the formatter. + * @param status The status indicating whether the constructor succeeded. + * @stable ICU 2.0 + */ + RuleBasedNumberFormat(URBNFRuleSetTag tag, const Locale& locale, UErrorCode& status); + + //----------------------------------------------------------------------- + // boilerplate + //----------------------------------------------------------------------- + + /** + * Copy constructor + * @param rhs the object to be copied from. + * @stable ICU 2.6 + */ + RuleBasedNumberFormat(const RuleBasedNumberFormat& rhs); + + /** + * Assignment operator + * @param rhs the object to be copied from. + * @stable ICU 2.6 + */ + RuleBasedNumberFormat& operator=(const RuleBasedNumberFormat& rhs); + + /** + * Release memory allocated for a RuleBasedNumberFormat when you are finished with it. + * @stable ICU 2.6 + */ + virtual ~RuleBasedNumberFormat(); + + /** + * Clone this object polymorphically. The caller is responsible + * for deleting the result when done. + * @return A copy of the object. + * @stable ICU 2.6 + */ + virtual Format* clone(void) const; + + /** + * Return true if the given Format objects are semantically equal. + * Objects of different subclasses are considered unequal. + * @param other the object to be compared with. + * @return true if the given Format objects are semantically equal. + * @stable ICU 2.6 + */ + virtual UBool operator==(const Format& other) const; + +//----------------------------------------------------------------------- +// public API functions +//----------------------------------------------------------------------- + + /** + * return the rules that were provided to the RuleBasedNumberFormat. + * @return the result String that was passed in + * @stable ICU 2.0 + */ + virtual UnicodeString getRules() const; + + /** + * Return the number of public rule set names. + * @return the number of public rule set names. + * @stable ICU 2.0 + */ + virtual int32_t getNumberOfRuleSetNames() const; + + /** + * Return the name of the index'th public ruleSet. If index is not valid, + * the function returns null. + * @param index the index of the ruleset + * @return the name of the index'th public ruleSet. + * @stable ICU 2.0 + */ + virtual UnicodeString getRuleSetName(int32_t index) const; + + /** + * Return the number of locales for which we have localized rule set display names. + * @return the number of locales for which we have localized rule set display names. + * @stable ICU 3.2 + */ + virtual int32_t getNumberOfRuleSetDisplayNameLocales(void) const; + + /** + * Return the index'th display name locale. + * @param index the index of the locale + * @param status set to a failure code when this function fails + * @return the locale + * @see #getNumberOfRuleSetDisplayNameLocales + * @stable ICU 3.2 + */ + virtual Locale getRuleSetDisplayNameLocale(int32_t index, UErrorCode& status) const; + + /** + * Return the rule set display names for the provided locale. These are in the same order + * as those returned by getRuleSetName. The locale is matched against the locales for + * which there is display name data, using normal fallback rules. If no locale matches, + * the default display names are returned. (These are the internal rule set names minus + * the leading '%'.) + * @param index the index of the rule set + * @param locale the locale (returned by getRuleSetDisplayNameLocales) for which the localized + * display name is desired + * @return the display name for the given index, which might be bogus if there is an error + * @see #getRuleSetName + * @stable ICU 3.2 + */ + virtual UnicodeString getRuleSetDisplayName(int32_t index, + const Locale& locale = Locale::getDefault()); + + /** + * Return the rule set display name for the provided rule set and locale. + * The locale is matched against the locales for which there is display name data, using + * normal fallback rules. If no locale matches, the default display name is returned. + * @return the display name for the rule set + * @stable ICU 3.2 + * @see #getRuleSetDisplayName + */ + virtual UnicodeString getRuleSetDisplayName(const UnicodeString& ruleSetName, + const Locale& locale = Locale::getDefault()); + + + using NumberFormat::format; + + /** + * Formats the specified 32-bit number using the default ruleset. + * @param number The number to format. + * @param toAppendTo the string that will hold the (appended) result + * @param pos the fieldposition + * @return A textual representation of the number. + * @stable ICU 2.0 + */ + virtual UnicodeString& format(int32_t number, + UnicodeString& toAppendTo, + FieldPosition& pos) const; + + /** + * Formats the specified 64-bit number using the default ruleset. + * @param number The number to format. + * @param toAppendTo the string that will hold the (appended) result + * @param pos the fieldposition + * @return A textual representation of the number. + * @stable ICU 2.1 + */ + virtual UnicodeString& format(int64_t number, + UnicodeString& toAppendTo, + FieldPosition& pos) const; + /** + * Formats the specified number using the default ruleset. + * @param number The number to format. + * @param toAppendTo the string that will hold the (appended) result + * @param pos the fieldposition + * @return A textual representation of the number. + * @stable ICU 2.0 + */ + virtual UnicodeString& format(double number, + UnicodeString& toAppendTo, + FieldPosition& pos) const; + + /** + * Formats the specified number using the named ruleset. + * @param number The number to format. + * @param ruleSetName The name of the rule set to format the number with. + * This must be the name of a valid public rule set for this formatter. + * @param toAppendTo the string that will hold the (appended) result + * @param pos the fieldposition + * @param status the status + * @return A textual representation of the number. + * @stable ICU 2.0 + */ + virtual UnicodeString& format(int32_t number, + const UnicodeString& ruleSetName, + UnicodeString& toAppendTo, + FieldPosition& pos, + UErrorCode& status) const; + /** + * Formats the specified 64-bit number using the named ruleset. + * @param number The number to format. + * @param ruleSetName The name of the rule set to format the number with. + * This must be the name of a valid public rule set for this formatter. + * @param toAppendTo the string that will hold the (appended) result + * @param pos the fieldposition + * @param status the status + * @return A textual representation of the number. + * @stable ICU 2.1 + */ + virtual UnicodeString& format(int64_t number, + const UnicodeString& ruleSetName, + UnicodeString& toAppendTo, + FieldPosition& pos, + UErrorCode& status) const; + /** + * Formats the specified number using the named ruleset. + * @param number The number to format. + * @param ruleSetName The name of the rule set to format the number with. + * This must be the name of a valid public rule set for this formatter. + * @param toAppendTo the string that will hold the (appended) result + * @param pos the fieldposition + * @param status the status + * @return A textual representation of the number. + * @stable ICU 2.0 + */ + virtual UnicodeString& format(double number, + const UnicodeString& ruleSetName, + UnicodeString& toAppendTo, + FieldPosition& pos, + UErrorCode& status) const; + +protected: + /** + * Format a decimal number. + * The number is a DigitList wrapper onto a floating point decimal number. + * The default implementation in NumberFormat converts the decimal number + * to a double and formats that. Subclasses of NumberFormat that want + * to specifically handle big decimal numbers must override this method. + * class DecimalFormat does so. + * + * @param number The number, a DigitList format Decimal Floating Point. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param posIter On return, can be used to iterate over positions + * of fields generated by this format call. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format(const DigitList &number, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; + + /** + * Format a decimal number. + * The number is a DigitList wrapper onto a floating point decimal number. + * The default implementation in NumberFormat converts the decimal number + * to a double and formats that. Subclasses of NumberFormat that want + * to specifically handle big decimal numbers must override this method. + * class DecimalFormat does so. + * + * @param number The number, a DigitList format Decimal Floating Point. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @internal + */ + virtual UnicodeString& format(const DigitList &number, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode& status) const; +public: + + using NumberFormat::parse; + + /** + * Parses the specfied string, beginning at the specified position, according + * to this formatter's rules. This will match the string against all of the + * formatter's public rule sets and return the value corresponding to the longest + * parseable substring. This function's behavior is affected by the lenient + * parse mode. + * @param text The string to parse + * @param result the result of the parse, either a double or a long. + * @param parsePosition On entry, contains the position of the first character + * in "text" to examine. On exit, has been updated to contain the position + * of the first character in "text" that wasn't consumed by the parse. + * @see #setLenient + * @stable ICU 2.0 + */ + virtual void parse(const UnicodeString& text, + Formattable& result, + ParsePosition& parsePosition) const; + +#if !UCONFIG_NO_COLLATION + + /** + * Turns lenient parse mode on and off. + * + * When in lenient parse mode, the formatter uses a Collator for parsing the text. + * Only primary differences are treated as significant. This means that case + * differences, accent differences, alternate spellings of the same letter + * (e.g., ae and a-umlaut in German), ignorable characters, etc. are ignored in + * matching the text. In many cases, numerals will be accepted in place of words + * or phrases as well. + * + * For example, all of the following will correctly parse as 255 in English in + * lenient-parse mode: + *
"two hundred fifty-five" + *
"two hundred fifty five" + *
"TWO HUNDRED FIFTY-FIVE" + *
"twohundredfiftyfive" + *
"2 hundred fifty-5" + * + * The Collator used is determined by the locale that was + * passed to this object on construction. The description passed to this object + * on construction may supply additional collation rules that are appended to the + * end of the default collator for the locale, enabling additional equivalences + * (such as adding more ignorable characters or permitting spelled-out version of + * symbols; see the demo program for examples). + * + * It's important to emphasize that even strict parsing is relatively lenient: it + * will accept some text that it won't produce as output. In English, for example, + * it will correctly parse "two hundred zero" and "fifteen hundred". + * + * @param enabled If true, turns lenient-parse mode on; if false, turns it off. + * @see RuleBasedCollator + * @stable ICU 2.0 + */ + virtual void setLenient(UBool enabled); + + /** + * Returns true if lenient-parse mode is turned on. Lenient parsing is off + * by default. + * @return true if lenient-parse mode is turned on. + * @see #setLenient + * @stable ICU 2.0 + */ + virtual inline UBool isLenient(void) const; + +#endif + + /** + * Override the default rule set to use. If ruleSetName is null, reset + * to the initial default rule set. If the rule set is not a public rule set name, + * U_ILLEGAL_ARGUMENT_ERROR is returned in status. + * @param ruleSetName the name of the rule set, or null to reset the initial default. + * @param status set to failure code when a problem occurs. + * @stable ICU 2.6 + */ + virtual void setDefaultRuleSet(const UnicodeString& ruleSetName, UErrorCode& status); + + /** + * Return the name of the current default rule set. If the current rule set is + * not public, returns a bogus (and empty) UnicodeString. + * @return the name of the current default rule set + * @stable ICU 3.0 + */ + virtual UnicodeString getDefaultRuleSetName() const; + + /** + * Set a particular UDisplayContext value in the formatter, such as + * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. Note: For getContext, see + * NumberFormat. + * @param value The UDisplayContext value to set. + * @param status Input/output status. If at entry this indicates a failure + * status, the function will do nothing; otherwise this will be + * updated with any new status from the function. + * @stable ICU 53 + */ + virtual void setContext(UDisplayContext value, UErrorCode& status); + + /** + * Get the rounding mode. + * @return A rounding mode + * @draft ICU 60 + */ + virtual ERoundingMode getRoundingMode(void) const; + + /** + * Set the rounding mode. + * @param roundingMode A rounding mode + * @draft ICU 60 + */ + virtual void setRoundingMode(ERoundingMode roundingMode); + +public: + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.8 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.8 + */ + virtual UClassID getDynamicClassID(void) const; + + /** + * Sets the decimal format symbols, which is generally not changed + * by the programmer or user. The formatter takes ownership of + * symbolsToAdopt; the client must not delete it. + * + * @param symbolsToAdopt DecimalFormatSymbols to be adopted. + * @stable ICU 49 + */ + virtual void adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt); + + /** + * Sets the decimal format symbols, which is generally not changed + * by the programmer or user. A clone of the symbols is created and + * the symbols is _not_ adopted; the client is still responsible for + * deleting it. + * + * @param symbols DecimalFormatSymbols. + * @stable ICU 49 + */ + virtual void setDecimalFormatSymbols(const DecimalFormatSymbols& symbols); + +private: + RuleBasedNumberFormat(); // default constructor not implemented + + // this will ref the localizations if they are not NULL + // caller must deref to get adoption + RuleBasedNumberFormat(const UnicodeString& description, LocalizationInfo* localizations, + const Locale& locale, UParseError& perror, UErrorCode& status); + + void init(const UnicodeString& rules, LocalizationInfo* localizations, UParseError& perror, UErrorCode& status); + void initCapitalizationContextInfo(const Locale& thelocale); + void dispose(); + void stripWhitespace(UnicodeString& src); + void initDefaultRuleSet(); + NFRuleSet* findRuleSet(const UnicodeString& name, UErrorCode& status) const; + + /* friend access */ + friend class NFSubstitution; + friend class NFRule; + friend class NFRuleSet; + friend class FractionalPartSubstitution; + + inline NFRuleSet * getDefaultRuleSet() const; + const RuleBasedCollator * getCollator() const; + DecimalFormatSymbols * initializeDecimalFormatSymbols(UErrorCode &status); + const DecimalFormatSymbols * getDecimalFormatSymbols() const; + NFRule * initializeDefaultInfinityRule(UErrorCode &status); + const NFRule * getDefaultInfinityRule() const; + NFRule * initializeDefaultNaNRule(UErrorCode &status); + const NFRule * getDefaultNaNRule() const; + PluralFormat *createPluralFormat(UPluralType pluralType, const UnicodeString &pattern, UErrorCode& status) const; + UnicodeString& adjustForCapitalizationContext(int32_t startPos, UnicodeString& currentResult, UErrorCode& status) const; + UnicodeString& format(int64_t number, NFRuleSet *ruleSet, UnicodeString& toAppendTo, UErrorCode& status) const; + void format(double number, NFRuleSet& rs, UnicodeString& toAppendTo, UErrorCode& status) const; + +private: + NFRuleSet **ruleSets; + UnicodeString* ruleSetDescriptions; + int32_t numRuleSets; + NFRuleSet *defaultRuleSet; + Locale locale; + RuleBasedCollator* collator; + DecimalFormatSymbols* decimalFormatSymbols; + NFRule *defaultInfinityRule; + NFRule *defaultNaNRule; + ERoundingMode roundingMode; + UBool lenient; + UnicodeString* lenientParseRules; + LocalizationInfo* localizations; + UnicodeString originalDescription; + UBool capitalizationInfoSet; + UBool capitalizationForUIListMenu; + UBool capitalizationForStandAlone; + BreakIterator* capitalizationBrkIter; +}; + +// --------------- + +#if !UCONFIG_NO_COLLATION + +inline UBool +RuleBasedNumberFormat::isLenient(void) const { + return lenient; +} + +#endif + +inline NFRuleSet* +RuleBasedNumberFormat::getDefaultRuleSet() const { + return defaultRuleSet; +} + +U_NAMESPACE_END + +/* U_HAVE_RBNF */ +#endif + +/* RBNF_H */ +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/rbtz.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/rbtz.h new file mode 100644 index 0000000..6d652f6 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/rbtz.h @@ -0,0 +1,364 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2007-2013, International Business Machines Corporation and * +* others. All Rights Reserved. * +******************************************************************************* +*/ +#ifndef RBTZ_H +#define RBTZ_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Rule based customizable time zone + */ + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/basictz.h" +#include "unicode/unistr.h" + +U_NAMESPACE_BEGIN + +// forward declaration +class UVector; +struct Transition; + +/** + * a BasicTimeZone subclass implemented in terms of InitialTimeZoneRule and TimeZoneRule instances + * @see BasicTimeZone + * @see InitialTimeZoneRule + * @see TimeZoneRule + */ +class U_I18N_API RuleBasedTimeZone : public BasicTimeZone { +public: + /** + * Constructs a RuleBasedTimeZone object with the ID and the + * InitialTimeZoneRule. The input InitialTimeZoneRule + * is adopted by this RuleBasedTimeZone, thus the caller must not + * delete it. + * @param id The time zone ID. + * @param initialRule The initial time zone rule. + * @stable ICU 3.8 + */ + RuleBasedTimeZone(const UnicodeString& id, InitialTimeZoneRule* initialRule); + + /** + * Copy constructor. + * @param source The RuleBasedTimeZone object to be copied. + * @stable ICU 3.8 + */ + RuleBasedTimeZone(const RuleBasedTimeZone& source); + + /** + * Destructor. + * @stable ICU 3.8 + */ + virtual ~RuleBasedTimeZone(); + + /** + * Assignment operator. + * @param right The object to be copied. + * @stable ICU 3.8 + */ + RuleBasedTimeZone& operator=(const RuleBasedTimeZone& right); + + /** + * Return true if the given TimeZone objects are + * semantically equal. Objects of different subclasses are considered unequal. + * @param that The object to be compared with. + * @return true if the given TimeZone objects are + *semantically equal. + * @stable ICU 3.8 + */ + virtual UBool operator==(const TimeZone& that) const; + + /** + * Return true if the given TimeZone objects are + * semantically unequal. Objects of different subclasses are considered unequal. + * @param that The object to be compared with. + * @return true if the given TimeZone objects are + * semantically unequal. + * @stable ICU 3.8 + */ + virtual UBool operator!=(const TimeZone& that) const; + + /** + * Adds the TimeZoneRule which represents time transitions. + * The TimeZoneRule must have start times, that is, the result + * of isTransitionRule() must be true. Otherwise, U_ILLEGAL_ARGUMENT_ERROR + * is set to the error code. + * The input TimeZoneRule is adopted by this + * RuleBasedTimeZone on successful completion of this method, + * thus, the caller must not delete it when no error is returned. + * After all rules are added, the caller must call complete() method to + * make this RuleBasedTimeZone ready to handle common time + * zone functions. + * @param rule The TimeZoneRule. + * @param status Output param to filled in with a success or an error. + * @stable ICU 3.8 + */ + void addTransitionRule(TimeZoneRule* rule, UErrorCode& status); + + /** + * Makes the TimeZoneRule ready to handle actual timezone + * calcuation APIs. This method collects time zone rules specified + * by the caller via the constructor and addTransitionRule() and + * builds internal structure for making the object ready to support + * time zone APIs such as getOffset(), getNextTransition() and others. + * @param status Output param to filled in with a success or an error. + * @stable ICU 3.8 + */ + void complete(UErrorCode& status); + + /** + * Clones TimeZone objects polymorphically. Clients are responsible for deleting + * the TimeZone object cloned. + * + * @return A new copy of this TimeZone object. + * @stable ICU 3.8 + */ + virtual TimeZone* clone(void) const; + + /** + * Returns the TimeZone's adjusted GMT offset (i.e., the number of milliseconds to add + * to GMT to get local time in this time zone, taking daylight savings time into + * account) as of a particular reference date. The reference date is used to determine + * whether daylight savings time is in effect and needs to be figured into the offset + * that is returned (in other words, what is the adjusted GMT offset in this time zone + * at this particular date and time?). For the time zones produced by createTimeZone(), + * the reference data is specified according to the Gregorian calendar, and the date + * and time fields are local standard time. + * + *

Note: Don't call this method. Instead, call the getOffset(UDate...) overload, + * which returns both the raw and the DST offset for a given time. This method + * is retained only for backward compatibility. + * + * @param era The reference date's era + * @param year The reference date's year + * @param month The reference date's month (0-based; 0 is January) + * @param day The reference date's day-in-month (1-based) + * @param dayOfWeek The reference date's day-of-week (1-based; 1 is Sunday) + * @param millis The reference date's milliseconds in day, local standard time + * @param status Output param to filled in with a success or an error. + * @return The offset in milliseconds to add to GMT to get local time. + * @stable ICU 3.8 + */ + virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day, + uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const; + + /** + * Gets the time zone offset, for current date, modified in case of + * daylight savings. This is the offset to add *to* UTC to get local time. + * + *

Note: Don't call this method. Instead, call the getOffset(UDate...) overload, + * which returns both the raw and the DST offset for a given time. This method + * is retained only for backward compatibility. + * + * @param era The reference date's era + * @param year The reference date's year + * @param month The reference date's month (0-based; 0 is January) + * @param day The reference date's day-in-month (1-based) + * @param dayOfWeek The reference date's day-of-week (1-based; 1 is Sunday) + * @param millis The reference date's milliseconds in day, local standard time + * @param monthLength The length of the given month in days. + * @param status Output param to filled in with a success or an error. + * @return The offset in milliseconds to add to GMT to get local time. + * @stable ICU 3.8 + */ + virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day, + uint8_t dayOfWeek, int32_t millis, + int32_t monthLength, UErrorCode& status) const; + + /** + * Returns the time zone raw and GMT offset for the given moment + * in time. Upon return, local-millis = GMT-millis + rawOffset + + * dstOffset. All computations are performed in the proleptic + * Gregorian calendar. The default implementation in the TimeZone + * class delegates to the 8-argument getOffset(). + * + * @param date moment in time for which to return offsets, in + * units of milliseconds from January 1, 1970 0:00 GMT, either GMT + * time or local wall time, depending on `local'. + * @param local if true, `date' is local wall time; otherwise it + * is in GMT time. + * @param rawOffset output parameter to receive the raw offset, that + * is, the offset not including DST adjustments + * @param dstOffset output parameter to receive the DST offset, + * that is, the offset to be added to `rawOffset' to obtain the + * total offset between local and GMT time. If DST is not in + * effect, this value is zero; otherwise it is a positive value, + * typically one hour. + * @param ec input-output error code + * @stable ICU 3.8 + */ + virtual void getOffset(UDate date, UBool local, int32_t& rawOffset, + int32_t& dstOffset, UErrorCode& ec) const; + + /** + * Sets the TimeZone's raw GMT offset (i.e., the number of milliseconds to add + * to GMT to get local time, before taking daylight savings time into account). + * + * @param offsetMillis The new raw GMT offset for this time zone. + * @stable ICU 3.8 + */ + virtual void setRawOffset(int32_t offsetMillis); + + /** + * Returns the TimeZone's raw GMT offset (i.e., the number of milliseconds to add + * to GMT to get local time, before taking daylight savings time into account). + * + * @return The TimeZone's raw GMT offset. + * @stable ICU 3.8 + */ + virtual int32_t getRawOffset(void) const; + + /** + * Queries if this time zone uses daylight savings time. + * @return true if this time zone uses daylight savings time, + * false, otherwise. + * @stable ICU 3.8 + */ + virtual UBool useDaylightTime(void) const; + + /** + * Queries if the given date is in daylight savings time in + * this time zone. + * This method is wasteful since it creates a new GregorianCalendar and + * deletes it each time it is called. This is a deprecated method + * and provided only for Java compatibility. + * + * @param date the given UDate. + * @param status Output param filled in with success/error code. + * @return true if the given date is in daylight savings time, + * false, otherwise. + * @deprecated ICU 2.4. Use Calendar::inDaylightTime() instead. + */ + virtual UBool inDaylightTime(UDate date, UErrorCode& status) const; + + /** + * Returns true if this zone has the same rule and offset as another zone. + * That is, if this zone differs only in ID, if at all. + * @param other the TimeZone object to be compared with + * @return true if the given zone is the same as this one, + * with the possible exception of the ID + * @stable ICU 3.8 + */ + virtual UBool hasSameRules(const TimeZone& other) const; + + /** + * Gets the first time zone transition after the base time. + * @param base The base time. + * @param inclusive Whether the base time is inclusive or not. + * @param result Receives the first transition after the base time. + * @return TRUE if the transition is found. + * @stable ICU 3.8 + */ + virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const; + + /** + * Gets the most recent time zone transition before the base time. + * @param base The base time. + * @param inclusive Whether the base time is inclusive or not. + * @param result Receives the most recent transition before the base time. + * @return TRUE if the transition is found. + * @stable ICU 3.8 + */ + virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const; + + /** + * Returns the number of TimeZoneRules which represents time transitions, + * for this time zone, that is, all TimeZoneRules for this time zone except + * InitialTimeZoneRule. The return value range is 0 or any positive value. + * @param status Receives error status code. + * @return The number of TimeZoneRules representing time transitions. + * @stable ICU 3.8 + */ + virtual int32_t countTransitionRules(UErrorCode& status) const; + + /** + * Gets the InitialTimeZoneRule and the set of TimeZoneRule + * which represent time transitions for this time zone. On successful return, + * the argument initial points to non-NULL InitialTimeZoneRule and + * the array trsrules is filled with 0 or multiple TimeZoneRule + * instances up to the size specified by trscount. The results are referencing the + * rule instance held by this time zone instance. Therefore, after this time zone + * is destructed, they are no longer available. + * @param initial Receives the initial timezone rule + * @param trsrules Receives the timezone transition rules + * @param trscount On input, specify the size of the array 'transitions' receiving + * the timezone transition rules. On output, actual number of + * rules filled in the array will be set. + * @param status Receives error status code. + * @stable ICU 3.8 + */ + virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial, + const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) const; + + /** + * Get time zone offsets from local wall time. + * @internal + */ + virtual void getOffsetFromLocal(UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt, + int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) const; + +private: + void deleteRules(void); + void deleteTransitions(void); + UVector* copyRules(UVector* source); + TimeZoneRule* findRuleInFinal(UDate date, UBool local, + int32_t NonExistingTimeOpt, int32_t DuplicatedTimeOpt) const; + UBool findNext(UDate base, UBool inclusive, UDate& time, TimeZoneRule*& from, TimeZoneRule*& to) const; + UBool findPrev(UDate base, UBool inclusive, UDate& time, TimeZoneRule*& from, TimeZoneRule*& to) const; + int32_t getLocalDelta(int32_t rawBefore, int32_t dstBefore, int32_t rawAfter, int32_t dstAfter, + int32_t NonExistingTimeOpt, int32_t DuplicatedTimeOpt) const; + UDate getTransitionTime(Transition* transition, UBool local, + int32_t NonExistingTimeOpt, int32_t DuplicatedTimeOpt) const; + void getOffsetInternal(UDate date, UBool local, int32_t NonExistingTimeOpt, int32_t DuplicatedTimeOpt, + int32_t& rawOffset, int32_t& dstOffset, UErrorCode& ec) const; + void completeConst(UErrorCode &status) const; + + InitialTimeZoneRule *fInitialRule; + UVector *fHistoricRules; + UVector *fFinalRules; + UVector *fHistoricTransitions; + UBool fUpToDate; + +public: + /** + * Return the class ID for this class. This is useful only for comparing to + * a return value from getDynamicClassID(). For example: + *

+     * .   Base* polymorphic_pointer = createPolymorphicObject();
+     * .   if (polymorphic_pointer->getDynamicClassID() ==
+     * .       erived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @stable ICU 3.8 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This + * method is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and clone() + * methods call this method. + * + * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @stable ICU 3.8 + */ + virtual UClassID getDynamicClassID(void) const; +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // RBTZ_H + +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/regex.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/regex.h new file mode 100644 index 0000000..6829f7b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/regex.h @@ -0,0 +1,1885 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 2002-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* file name: regex.h +* encoding: UTF-8 +* indentation:4 +* +* created on: 2002oct22 +* created by: Andy Heninger +* +* ICU Regular Expressions, API for C++ +*/ + +#ifndef REGEX_H +#define REGEX_H + +//#define REGEX_DEBUG + +/** + * \file + * \brief C++ API: Regular Expressions + * + *

Regular Expression API

+ * + *

The ICU API for processing regular expressions consists of two classes, + * RegexPattern and RegexMatcher. + * RegexPattern objects represent a pre-processed, or compiled + * regular expression. They are created from a regular expression pattern string, + * and can be used to create RegexMatcher objects for the pattern.

+ * + *

Class RegexMatcher bundles together a regular expression + * pattern and a target string to which the search pattern will be applied. + * RegexMatcher includes API for doing plain find or search + * operations, for search and replace operations, and for obtaining detailed + * information about bounds of a match.

+ * + *

Note that by constructing RegexMatcher objects directly from regular + * expression pattern strings application code can be simplified and the explicit + * need for RegexPattern objects can usually be eliminated. + *

+ */ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_REGULAR_EXPRESSIONS + +#include "unicode/uobject.h" +#include "unicode/unistr.h" +#include "unicode/utext.h" +#include "unicode/parseerr.h" + +#include "unicode/uregex.h" + +// Forward Declarations + +struct UHashtable; + +U_NAMESPACE_BEGIN + +struct Regex8BitSet; +class RegexCImpl; +class RegexMatcher; +class RegexPattern; +struct REStackFrame; +class RuleBasedBreakIterator; +class UnicodeSet; +class UVector; +class UVector32; +class UVector64; + + +/** + * Class RegexPattern represents a compiled regular expression. It includes + * factory methods for creating a RegexPattern object from the source (string) form + * of a regular expression, methods for creating RegexMatchers that allow the pattern + * to be applied to input text, and a few convenience methods for simple common + * uses of regular expressions. + * + *

Class RegexPattern is not intended to be subclassed.

+ * + * @stable ICU 2.4 + */ +class U_I18N_API RegexPattern U_FINAL : public UObject { +public: + + /** + * default constructor. Create a RegexPattern object that refers to no actual + * pattern. Not normally needed; RegexPattern objects are usually + * created using the factory method compile(). + * + * @stable ICU 2.4 + */ + RegexPattern(); + + /** + * Copy Constructor. Create a new RegexPattern object that is equivalent + * to the source object. + * @param source the pattern object to be copied. + * @stable ICU 2.4 + */ + RegexPattern(const RegexPattern &source); + + /** + * Destructor. Note that a RegexPattern object must persist so long as any + * RegexMatcher objects that were created from the RegexPattern are active. + * @stable ICU 2.4 + */ + virtual ~RegexPattern(); + + /** + * Comparison operator. Two RegexPattern objects are considered equal if they + * were constructed from identical source patterns using the same match flag + * settings. + * @param that a RegexPattern object to compare with "this". + * @return TRUE if the objects are equivalent. + * @stable ICU 2.4 + */ + UBool operator==(const RegexPattern& that) const; + + /** + * Comparison operator. Two RegexPattern objects are considered equal if they + * were constructed from identical source patterns using the same match flag + * settings. + * @param that a RegexPattern object to compare with "this". + * @return TRUE if the objects are different. + * @stable ICU 2.4 + */ + inline UBool operator!=(const RegexPattern& that) const {return ! operator ==(that);} + + /** + * Assignment operator. After assignment, this RegexPattern will behave identically + * to the source object. + * @stable ICU 2.4 + */ + RegexPattern &operator =(const RegexPattern &source); + + /** + * Create an exact copy of this RegexPattern object. Since RegexPattern is not + * intended to be subclassed, clone() and the copy construction are + * equivalent operations. + * @return the copy of this RegexPattern + * @stable ICU 2.4 + */ + virtual RegexPattern *clone() const; + + + /** + * Compiles the regular expression in string form into a RegexPattern + * object. These compile methods, rather than the constructors, are the usual + * way that RegexPattern objects are created. + * + *

Note that RegexPattern objects must not be deleted while RegexMatcher + * objects created from the pattern are active. RegexMatchers keep a pointer + * back to their pattern, so premature deletion of the pattern is a + * catastrophic error.

+ * + *

All pattern match mode flags are set to their default values.

+ * + *

Note that it is often more convenient to construct a RegexMatcher directly + * from a pattern string rather than separately compiling the pattern and + * then creating a RegexMatcher object from the pattern.

+ * + * @param regex The regular expression to be compiled. + * @param pe Receives the position (line and column nubers) of any error + * within the regular expression.) + * @param status A reference to a UErrorCode to receive any errors. + * @return A regexPattern object for the compiled pattern. + * + * @stable ICU 2.4 + */ + static RegexPattern * U_EXPORT2 compile( const UnicodeString ®ex, + UParseError &pe, + UErrorCode &status); + + /** + * Compiles the regular expression in string form into a RegexPattern + * object. These compile methods, rather than the constructors, are the usual + * way that RegexPattern objects are created. + * + *

Note that RegexPattern objects must not be deleted while RegexMatcher + * objects created from the pattern are active. RegexMatchers keep a pointer + * back to their pattern, so premature deletion of the pattern is a + * catastrophic error.

+ * + *

All pattern match mode flags are set to their default values.

+ * + *

Note that it is often more convenient to construct a RegexMatcher directly + * from a pattern string rather than separately compiling the pattern and + * then creating a RegexMatcher object from the pattern.

+ * + * @param regex The regular expression to be compiled. Note, the text referred + * to by this UText must not be deleted during the lifetime of the + * RegexPattern object or any RegexMatcher object created from it. + * @param pe Receives the position (line and column nubers) of any error + * within the regular expression.) + * @param status A reference to a UErrorCode to receive any errors. + * @return A regexPattern object for the compiled pattern. + * + * @stable ICU 4.6 + */ + static RegexPattern * U_EXPORT2 compile( UText *regex, + UParseError &pe, + UErrorCode &status); + + /** + * Compiles the regular expression in string form into a RegexPattern + * object using the specified match mode flags. These compile methods, + * rather than the constructors, are the usual way that RegexPattern objects + * are created. + * + *

Note that RegexPattern objects must not be deleted while RegexMatcher + * objects created from the pattern are active. RegexMatchers keep a pointer + * back to their pattern, so premature deletion of the pattern is a + * catastrophic error.

+ * + *

Note that it is often more convenient to construct a RegexMatcher directly + * from a pattern string instead of than separately compiling the pattern and + * then creating a RegexMatcher object from the pattern.

+ * + * @param regex The regular expression to be compiled. + * @param flags The match mode flags to be used. + * @param pe Receives the position (line and column numbers) of any error + * within the regular expression.) + * @param status A reference to a UErrorCode to receive any errors. + * @return A regexPattern object for the compiled pattern. + * + * @stable ICU 2.4 + */ + static RegexPattern * U_EXPORT2 compile( const UnicodeString ®ex, + uint32_t flags, + UParseError &pe, + UErrorCode &status); + + /** + * Compiles the regular expression in string form into a RegexPattern + * object using the specified match mode flags. These compile methods, + * rather than the constructors, are the usual way that RegexPattern objects + * are created. + * + *

Note that RegexPattern objects must not be deleted while RegexMatcher + * objects created from the pattern are active. RegexMatchers keep a pointer + * back to their pattern, so premature deletion of the pattern is a + * catastrophic error.

+ * + *

Note that it is often more convenient to construct a RegexMatcher directly + * from a pattern string instead of than separately compiling the pattern and + * then creating a RegexMatcher object from the pattern.

+ * + * @param regex The regular expression to be compiled. Note, the text referred + * to by this UText must not be deleted during the lifetime of the + * RegexPattern object or any RegexMatcher object created from it. + * @param flags The match mode flags to be used. + * @param pe Receives the position (line and column numbers) of any error + * within the regular expression.) + * @param status A reference to a UErrorCode to receive any errors. + * @return A regexPattern object for the compiled pattern. + * + * @stable ICU 4.6 + */ + static RegexPattern * U_EXPORT2 compile( UText *regex, + uint32_t flags, + UParseError &pe, + UErrorCode &status); + + /** + * Compiles the regular expression in string form into a RegexPattern + * object using the specified match mode flags. These compile methods, + * rather than the constructors, are the usual way that RegexPattern objects + * are created. + * + *

Note that RegexPattern objects must not be deleted while RegexMatcher + * objects created from the pattern are active. RegexMatchers keep a pointer + * back to their pattern, so premature deletion of the pattern is a + * catastrophic error.

+ * + *

Note that it is often more convenient to construct a RegexMatcher directly + * from a pattern string instead of than separately compiling the pattern and + * then creating a RegexMatcher object from the pattern.

+ * + * @param regex The regular expression to be compiled. + * @param flags The match mode flags to be used. + * @param status A reference to a UErrorCode to receive any errors. + * @return A regexPattern object for the compiled pattern. + * + * @stable ICU 2.6 + */ + static RegexPattern * U_EXPORT2 compile( const UnicodeString ®ex, + uint32_t flags, + UErrorCode &status); + + /** + * Compiles the regular expression in string form into a RegexPattern + * object using the specified match mode flags. These compile methods, + * rather than the constructors, are the usual way that RegexPattern objects + * are created. + * + *

Note that RegexPattern objects must not be deleted while RegexMatcher + * objects created from the pattern are active. RegexMatchers keep a pointer + * back to their pattern, so premature deletion of the pattern is a + * catastrophic error.

+ * + *

Note that it is often more convenient to construct a RegexMatcher directly + * from a pattern string instead of than separately compiling the pattern and + * then creating a RegexMatcher object from the pattern.

+ * + * @param regex The regular expression to be compiled. Note, the text referred + * to by this UText must not be deleted during the lifetime of the + * RegexPattern object or any RegexMatcher object created from it. + * @param flags The match mode flags to be used. + * @param status A reference to a UErrorCode to receive any errors. + * @return A regexPattern object for the compiled pattern. + * + * @stable ICU 4.6 + */ + static RegexPattern * U_EXPORT2 compile( UText *regex, + uint32_t flags, + UErrorCode &status); + + /** + * Get the match mode flags that were used when compiling this pattern. + * @return the match mode flags + * @stable ICU 2.4 + */ + virtual uint32_t flags() const; + + /** + * Creates a RegexMatcher that will match the given input against this pattern. The + * RegexMatcher can then be used to perform match, find or replace operations + * on the input. Note that a RegexPattern object must not be deleted while + * RegexMatchers created from it still exist and might possibly be used again. + *

+ * The matcher will retain a reference to the supplied input string, and all regexp + * pattern matching operations happen directly on this original string. It is + * critical that the string not be altered or deleted before use by the regular + * expression operations is complete. + * + * @param input The input string to which the regular expression will be applied. + * @param status A reference to a UErrorCode to receive any errors. + * @return A RegexMatcher object for this pattern and input. + * + * @stable ICU 2.4 + */ + virtual RegexMatcher *matcher(const UnicodeString &input, + UErrorCode &status) const; + +private: + /** + * Cause a compilation error if an application accidentally attempts to + * create a matcher with a (char16_t *) string as input rather than + * a UnicodeString. Avoids a dangling reference to a temporary string. + *

+ * To efficiently work with char16_t *strings, wrap the data in a UnicodeString + * using one of the aliasing constructors, such as + * UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength); + * or in a UText, using + * utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status); + * + */ + RegexMatcher *matcher(const char16_t *input, + UErrorCode &status) const; +public: + + + /** + * Creates a RegexMatcher that will match against this pattern. The + * RegexMatcher can be used to perform match, find or replace operations. + * Note that a RegexPattern object must not be deleted while + * RegexMatchers created from it still exist and might possibly be used again. + * + * @param status A reference to a UErrorCode to receive any errors. + * @return A RegexMatcher object for this pattern and input. + * + * @stable ICU 2.6 + */ + virtual RegexMatcher *matcher(UErrorCode &status) const; + + + /** + * Test whether a string matches a regular expression. This convenience function + * both compiles the regular expression and applies it in a single operation. + * Note that if the same pattern needs to be applied repeatedly, this method will be + * less efficient than creating and reusing a RegexMatcher object. + * + * @param regex The regular expression + * @param input The string data to be matched + * @param pe Receives the position of any syntax errors within the regular expression + * @param status A reference to a UErrorCode to receive any errors. + * @return True if the regular expression exactly matches the full input string. + * + * @stable ICU 2.4 + */ + static UBool U_EXPORT2 matches(const UnicodeString ®ex, + const UnicodeString &input, + UParseError &pe, + UErrorCode &status); + + /** + * Test whether a string matches a regular expression. This convenience function + * both compiles the regular expression and applies it in a single operation. + * Note that if the same pattern needs to be applied repeatedly, this method will be + * less efficient than creating and reusing a RegexMatcher object. + * + * @param regex The regular expression + * @param input The string data to be matched + * @param pe Receives the position of any syntax errors within the regular expression + * @param status A reference to a UErrorCode to receive any errors. + * @return True if the regular expression exactly matches the full input string. + * + * @stable ICU 4.6 + */ + static UBool U_EXPORT2 matches(UText *regex, + UText *input, + UParseError &pe, + UErrorCode &status); + + /** + * Returns the regular expression from which this pattern was compiled. This method will work + * even if the pattern was compiled from a UText. + * + * Note: If the pattern was originally compiled from a UText, and that UText was modified, + * the returned string may no longer reflect the RegexPattern object. + * @stable ICU 2.4 + */ + virtual UnicodeString pattern() const; + + + /** + * Returns the regular expression from which this pattern was compiled. This method will work + * even if the pattern was compiled from a UnicodeString. + * + * Note: This is the original input, not a clone. If the pattern was originally compiled from a + * UText, and that UText was modified, the returned UText may no longer reflect the RegexPattern + * object. + * + * @stable ICU 4.6 + */ + virtual UText *patternText(UErrorCode &status) const; + + + /** + * Get the group number corresponding to a named capture group. + * The returned number can be used with any function that access + * capture groups by number. + * + * The function returns an error status if the specified name does not + * appear in the pattern. + * + * @param groupName The capture group name. + * @param status A UErrorCode to receive any errors. + * + * @stable ICU 55 + */ + virtual int32_t groupNumberFromName(const UnicodeString &groupName, UErrorCode &status) const; + + + /** + * Get the group number corresponding to a named capture group. + * The returned number can be used with any function that access + * capture groups by number. + * + * The function returns an error status if the specified name does not + * appear in the pattern. + * + * @param groupName The capture group name, + * platform invariant characters only. + * @param nameLength The length of the name, or -1 if the name is + * nul-terminated. + * @param status A UErrorCode to receive any errors. + * + * @stable ICU 55 + */ + virtual int32_t groupNumberFromName(const char *groupName, int32_t nameLength, UErrorCode &status) const; + + + /** + * Split a string into fields. Somewhat like split() from Perl or Java. + * Pattern matches identify delimiters that separate the input + * into fields. The input data between the delimiters becomes the + * fields themselves. + * + * If the delimiter pattern includes capture groups, the captured text will + * also appear in the destination array of output strings, interspersed + * with the fields. This is similar to Perl, but differs from Java, + * which ignores the presence of capture groups in the pattern. + * + * Trailing empty fields will always be returned, assuming sufficient + * destination capacity. This differs from the default behavior for Java + * and Perl where trailing empty fields are not returned. + * + * The number of strings produced by the split operation is returned. + * This count includes the strings from capture groups in the delimiter pattern. + * This behavior differs from Java, which ignores capture groups. + * + * For the best performance on split() operations, + * RegexMatcher::split is preferable to this function + * + * @param input The string to be split into fields. The field delimiters + * match the pattern (in the "this" object) + * @param dest An array of UnicodeStrings to receive the results of the split. + * This is an array of actual UnicodeString objects, not an + * array of pointers to strings. Local (stack based) arrays can + * work well here. + * @param destCapacity The number of elements in the destination array. + * If the number of fields found is less than destCapacity, the + * extra strings in the destination array are not altered. + * If the number of destination strings is less than the number + * of fields, the trailing part of the input string, including any + * field delimiters, is placed in the last destination string. + * @param status A reference to a UErrorCode to receive any errors. + * @return The number of fields into which the input string was split. + * @stable ICU 2.4 + */ + virtual int32_t split(const UnicodeString &input, + UnicodeString dest[], + int32_t destCapacity, + UErrorCode &status) const; + + + /** + * Split a string into fields. Somewhat like split() from Perl or Java. + * Pattern matches identify delimiters that separate the input + * into fields. The input data between the delimiters becomes the + * fields themselves. + * + * If the delimiter pattern includes capture groups, the captured text will + * also appear in the destination array of output strings, interspersed + * with the fields. This is similar to Perl, but differs from Java, + * which ignores the presence of capture groups in the pattern. + * + * Trailing empty fields will always be returned, assuming sufficient + * destination capacity. This differs from the default behavior for Java + * and Perl where trailing empty fields are not returned. + * + * The number of strings produced by the split operation is returned. + * This count includes the strings from capture groups in the delimiter pattern. + * This behavior differs from Java, which ignores capture groups. + * + * For the best performance on split() operations, + * RegexMatcher::split is preferable to this function + * + * @param input The string to be split into fields. The field delimiters + * match the pattern (in the "this" object) + * @param dest An array of mutable UText structs to receive the results of the split. + * If a field is NULL, a new UText is allocated to contain the results for + * that field. This new UText is not guaranteed to be mutable. + * @param destCapacity The number of elements in the destination array. + * If the number of fields found is less than destCapacity, the + * extra strings in the destination array are not altered. + * If the number of destination strings is less than the number + * of fields, the trailing part of the input string, including any + * field delimiters, is placed in the last destination string. + * @param status A reference to a UErrorCode to receive any errors. + * @return The number of destination strings used. + * + * @stable ICU 4.6 + */ + virtual int32_t split(UText *input, + UText *dest[], + int32_t destCapacity, + UErrorCode &status) const; + + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.4 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.4 + */ + static UClassID U_EXPORT2 getStaticClassID(); + +private: + // + // Implementation Data + // + UText *fPattern; // The original pattern string. + UnicodeString *fPatternString; // The original pattern UncodeString if relevant + uint32_t fFlags; // The flags used when compiling the pattern. + // + UVector64 *fCompiledPat; // The compiled pattern p-code. + UnicodeString fLiteralText; // Any literal string data from the pattern, + // after un-escaping, for use during the match. + + UVector *fSets; // Any UnicodeSets referenced from the pattern. + Regex8BitSet *fSets8; // (and fast sets for latin-1 range.) + + + UErrorCode fDeferredStatus; // status if some prior error has left this + // RegexPattern in an unusable state. + + int32_t fMinMatchLen; // Minimum Match Length. All matches will have length + // >= this value. For some patterns, this calculated + // value may be less than the true shortest + // possible match. + + int32_t fFrameSize; // Size of a state stack frame in the + // execution engine. + + int32_t fDataSize; // The size of the data needed by the pattern that + // does not go on the state stack, but has just + // a single copy per matcher. + + UVector32 *fGroupMap; // Map from capture group number to position of + // the group's variables in the matcher stack frame. + + UnicodeSet **fStaticSets; // Ptr to static (shared) sets for predefined + // regex character classes, e.g. Word. + + Regex8BitSet *fStaticSets8; // Ptr to the static (shared) latin-1 only + // sets for predefined regex classes. + + int32_t fStartType; // Info on how a match must start. + int32_t fInitialStringIdx; // + int32_t fInitialStringLen; + UnicodeSet *fInitialChars; + UChar32 fInitialChar; + Regex8BitSet *fInitialChars8; + UBool fNeedsAltInput; + + UHashtable *fNamedCaptureMap; // Map from capture group names to numbers. + + friend class RegexCompile; + friend class RegexMatcher; + friend class RegexCImpl; + + // + // Implementation Methods + // + void init(); // Common initialization, for use by constructors. + void zap(); // Common cleanup + + void dumpOp(int32_t index) const; + + public: +#ifndef U_HIDE_INTERNAL_API + /** + * Dump a compiled pattern. Internal debug function. + * @internal + */ + void dumpPattern() const; +#endif /* U_HIDE_INTERNAL_API */ +}; + + + +/** + * class RegexMatcher bundles together a regular expression pattern and + * input text to which the expression can be applied. It includes methods + * for testing for matches, and for find and replace operations. + * + *

Class RegexMatcher is not intended to be subclassed.

+ * + * @stable ICU 2.4 + */ +class U_I18N_API RegexMatcher U_FINAL : public UObject { +public: + + /** + * Construct a RegexMatcher for a regular expression. + * This is a convenience method that avoids the need to explicitly create + * a RegexPattern object. Note that if several RegexMatchers need to be + * created for the same expression, it will be more efficient to + * separately create and cache a RegexPattern object, and use + * its matcher() method to create the RegexMatcher objects. + * + * @param regexp The Regular Expression to be compiled. + * @param flags Regular expression options, such as case insensitive matching. + * @see UREGEX_CASE_INSENSITIVE + * @param status Any errors are reported by setting this UErrorCode variable. + * @stable ICU 2.6 + */ + RegexMatcher(const UnicodeString ®exp, uint32_t flags, UErrorCode &status); + + /** + * Construct a RegexMatcher for a regular expression. + * This is a convenience method that avoids the need to explicitly create + * a RegexPattern object. Note that if several RegexMatchers need to be + * created for the same expression, it will be more efficient to + * separately create and cache a RegexPattern object, and use + * its matcher() method to create the RegexMatcher objects. + * + * @param regexp The regular expression to be compiled. + * @param flags Regular expression options, such as case insensitive matching. + * @see UREGEX_CASE_INSENSITIVE + * @param status Any errors are reported by setting this UErrorCode variable. + * + * @stable ICU 4.6 + */ + RegexMatcher(UText *regexp, uint32_t flags, UErrorCode &status); + + /** + * Construct a RegexMatcher for a regular expression. + * This is a convenience method that avoids the need to explicitly create + * a RegexPattern object. Note that if several RegexMatchers need to be + * created for the same expression, it will be more efficient to + * separately create and cache a RegexPattern object, and use + * its matcher() method to create the RegexMatcher objects. + *

+ * The matcher will retain a reference to the supplied input string, and all regexp + * pattern matching operations happen directly on the original string. It is + * critical that the string not be altered or deleted before use by the regular + * expression operations is complete. + * + * @param regexp The Regular Expression to be compiled. + * @param input The string to match. The matcher retains a reference to the + * caller's string; mo copy is made. + * @param flags Regular expression options, such as case insensitive matching. + * @see UREGEX_CASE_INSENSITIVE + * @param status Any errors are reported by setting this UErrorCode variable. + * @stable ICU 2.6 + */ + RegexMatcher(const UnicodeString ®exp, const UnicodeString &input, + uint32_t flags, UErrorCode &status); + + /** + * Construct a RegexMatcher for a regular expression. + * This is a convenience method that avoids the need to explicitly create + * a RegexPattern object. Note that if several RegexMatchers need to be + * created for the same expression, it will be more efficient to + * separately create and cache a RegexPattern object, and use + * its matcher() method to create the RegexMatcher objects. + *

+ * The matcher will make a shallow clone of the supplied input text, and all regexp + * pattern matching operations happen on this clone. While read-only operations on + * the supplied text are permitted, it is critical that the underlying string not be + * altered or deleted before use by the regular expression operations is complete. + * + * @param regexp The Regular Expression to be compiled. + * @param input The string to match. The matcher retains a shallow clone of the text. + * @param flags Regular expression options, such as case insensitive matching. + * @see UREGEX_CASE_INSENSITIVE + * @param status Any errors are reported by setting this UErrorCode variable. + * + * @stable ICU 4.6 + */ + RegexMatcher(UText *regexp, UText *input, + uint32_t flags, UErrorCode &status); + +private: + /** + * Cause a compilation error if an application accidentally attempts to + * create a matcher with a (char16_t *) string as input rather than + * a UnicodeString. Avoids a dangling reference to a temporary string. + *

+ * To efficiently work with char16_t *strings, wrap the data in a UnicodeString + * using one of the aliasing constructors, such as + * UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength); + * or in a UText, using + * utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status); + * + */ + RegexMatcher(const UnicodeString ®exp, const char16_t *input, + uint32_t flags, UErrorCode &status); +public: + + + /** + * Destructor. + * + * @stable ICU 2.4 + */ + virtual ~RegexMatcher(); + + + /** + * Attempts to match the entire input region against the pattern. + * @param status A reference to a UErrorCode to receive any errors. + * @return TRUE if there is a match + * @stable ICU 2.4 + */ + virtual UBool matches(UErrorCode &status); + + + /** + * Resets the matcher, then attempts to match the input beginning + * at the specified startIndex, and extending to the end of the input. + * The input region is reset to include the entire input string. + * A successful match must extend to the end of the input. + * @param startIndex The input string (native) index at which to begin matching. + * @param status A reference to a UErrorCode to receive any errors. + * @return TRUE if there is a match + * @stable ICU 2.8 + */ + virtual UBool matches(int64_t startIndex, UErrorCode &status); + + + /** + * Attempts to match the input string, starting from the beginning of the region, + * against the pattern. Like the matches() method, this function + * always starts at the beginning of the input region; + * unlike that function, it does not require that the entire region be matched. + * + *

If the match succeeds then more information can be obtained via the start(), + * end(), and group() functions.

+ * + * @param status A reference to a UErrorCode to receive any errors. + * @return TRUE if there is a match at the start of the input string. + * @stable ICU 2.4 + */ + virtual UBool lookingAt(UErrorCode &status); + + + /** + * Attempts to match the input string, starting from the specified index, against the pattern. + * The match may be of any length, and is not required to extend to the end + * of the input string. Contrast with match(). + * + *

If the match succeeds then more information can be obtained via the start(), + * end(), and group() functions.

+ * + * @param startIndex The input string (native) index at which to begin matching. + * @param status A reference to a UErrorCode to receive any errors. + * @return TRUE if there is a match. + * @stable ICU 2.8 + */ + virtual UBool lookingAt(int64_t startIndex, UErrorCode &status); + + + /** + * Find the next pattern match in the input string. + * The find begins searching the input at the location following the end of + * the previous match, or at the start of the string if there is no previous match. + * If a match is found, start(), end() and group() + * will provide more information regarding the match. + *

Note that if the input string is changed by the application, + * use find(startPos, status) instead of find(), because the saved starting + * position may not be valid with the altered input string.

+ * @return TRUE if a match is found. + * @stable ICU 2.4 + */ + virtual UBool find(); + + + /** + * Find the next pattern match in the input string. + * The find begins searching the input at the location following the end of + * the previous match, or at the start of the string if there is no previous match. + * If a match is found, start(), end() and group() + * will provide more information regarding the match. + *

Note that if the input string is changed by the application, + * use find(startPos, status) instead of find(), because the saved starting + * position may not be valid with the altered input string.

+ * @param status A reference to a UErrorCode to receive any errors. + * @return TRUE if a match is found. + * @stable ICU 55 + */ + virtual UBool find(UErrorCode &status); + + /** + * Resets this RegexMatcher and then attempts to find the next substring of the + * input string that matches the pattern, starting at the specified index. + * + * @param start The (native) index in the input string to begin the search. + * @param status A reference to a UErrorCode to receive any errors. + * @return TRUE if a match is found. + * @stable ICU 2.4 + */ + virtual UBool find(int64_t start, UErrorCode &status); + + + /** + * Returns a string containing the text matched by the previous match. + * If the pattern can match an empty string, an empty string may be returned. + * @param status A reference to a UErrorCode to receive any errors. + * Possible errors are U_REGEX_INVALID_STATE if no match + * has been attempted or the last match failed. + * @return a string containing the matched input text. + * @stable ICU 2.4 + */ + virtual UnicodeString group(UErrorCode &status) const; + + + /** + * Returns a string containing the text captured by the given group + * during the previous match operation. Group(0) is the entire match. + * + * A zero length string is returned both for capture groups that did not + * participate in the match and for actual zero length matches. + * To distinguish between these two cases use the function start(), + * which returns -1 for non-participating groups. + * + * @param groupNum the capture group number + * @param status A reference to a UErrorCode to receive any errors. + * Possible errors are U_REGEX_INVALID_STATE if no match + * has been attempted or the last match failed and + * U_INDEX_OUTOFBOUNDS_ERROR for a bad capture group number. + * @return the captured text + * @stable ICU 2.4 + */ + virtual UnicodeString group(int32_t groupNum, UErrorCode &status) const; + + /** + * Returns the number of capturing groups in this matcher's pattern. + * @return the number of capture groups + * @stable ICU 2.4 + */ + virtual int32_t groupCount() const; + + + /** + * Returns a shallow clone of the entire live input string with the UText current native index + * set to the beginning of the requested group. + * + * @param dest The UText into which the input should be cloned, or NULL to create a new UText + * @param group_len A reference to receive the length of the desired capture group + * @param status A reference to a UErrorCode to receive any errors. + * Possible errors are U_REGEX_INVALID_STATE if no match + * has been attempted or the last match failed and + * U_INDEX_OUTOFBOUNDS_ERROR for a bad capture group number. + * @return dest if non-NULL, a shallow copy of the input text otherwise + * + * @stable ICU 4.6 + */ + virtual UText *group(UText *dest, int64_t &group_len, UErrorCode &status) const; + + /** + * Returns a shallow clone of the entire live input string with the UText current native index + * set to the beginning of the requested group. + * + * A group length of zero is returned both for capture groups that did not + * participate in the match and for actual zero length matches. + * To distinguish between these two cases use the function start(), + * which returns -1 for non-participating groups. + * + * @param groupNum The capture group number. + * @param dest The UText into which the input should be cloned, or NULL to create a new UText. + * @param group_len A reference to receive the length of the desired capture group + * @param status A reference to a UErrorCode to receive any errors. + * Possible errors are U_REGEX_INVALID_STATE if no match + * has been attempted or the last match failed and + * U_INDEX_OUTOFBOUNDS_ERROR for a bad capture group number. + * @return dest if non-NULL, a shallow copy of the input text otherwise + * + * @stable ICU 4.6 + */ + virtual UText *group(int32_t groupNum, UText *dest, int64_t &group_len, UErrorCode &status) const; + + /** + * Returns the index in the input string of the start of the text matched + * during the previous match operation. + * @param status a reference to a UErrorCode to receive any errors. + * @return The (native) position in the input string of the start of the last match. + * @stable ICU 2.4 + */ + virtual int32_t start(UErrorCode &status) const; + + /** + * Returns the index in the input string of the start of the text matched + * during the previous match operation. + * @param status a reference to a UErrorCode to receive any errors. + * @return The (native) position in the input string of the start of the last match. + * @stable ICU 4.6 + */ + virtual int64_t start64(UErrorCode &status) const; + + + /** + * Returns the index in the input string of the start of the text matched by the + * specified capture group during the previous match operation. Return -1 if + * the capture group exists in the pattern, but was not part of the last match. + * + * @param group the capture group number + * @param status A reference to a UErrorCode to receive any errors. Possible + * errors are U_REGEX_INVALID_STATE if no match has been + * attempted or the last match failed, and + * U_INDEX_OUTOFBOUNDS_ERROR for a bad capture group number + * @return the (native) start position of substring matched by the specified group. + * @stable ICU 2.4 + */ + virtual int32_t start(int32_t group, UErrorCode &status) const; + + /** + * Returns the index in the input string of the start of the text matched by the + * specified capture group during the previous match operation. Return -1 if + * the capture group exists in the pattern, but was not part of the last match. + * + * @param group the capture group number. + * @param status A reference to a UErrorCode to receive any errors. Possible + * errors are U_REGEX_INVALID_STATE if no match has been + * attempted or the last match failed, and + * U_INDEX_OUTOFBOUNDS_ERROR for a bad capture group number. + * @return the (native) start position of substring matched by the specified group. + * @stable ICU 4.6 + */ + virtual int64_t start64(int32_t group, UErrorCode &status) const; + + /** + * Returns the index in the input string of the first character following the + * text matched during the previous match operation. + * + * @param status A reference to a UErrorCode to receive any errors. Possible + * errors are U_REGEX_INVALID_STATE if no match has been + * attempted or the last match failed. + * @return the index of the last character matched, plus one. + * The index value returned is a native index, corresponding to + * code units for the underlying encoding type, for example, + * a byte index for UTF-8. + * @stable ICU 2.4 + */ + virtual int32_t end(UErrorCode &status) const; + + /** + * Returns the index in the input string of the first character following the + * text matched during the previous match operation. + * + * @param status A reference to a UErrorCode to receive any errors. Possible + * errors are U_REGEX_INVALID_STATE if no match has been + * attempted or the last match failed. + * @return the index of the last character matched, plus one. + * The index value returned is a native index, corresponding to + * code units for the underlying encoding type, for example, + * a byte index for UTF-8. + * @stable ICU 4.6 + */ + virtual int64_t end64(UErrorCode &status) const; + + + /** + * Returns the index in the input string of the character following the + * text matched by the specified capture group during the previous match operation. + * + * @param group the capture group number + * @param status A reference to a UErrorCode to receive any errors. Possible + * errors are U_REGEX_INVALID_STATE if no match has been + * attempted or the last match failed and + * U_INDEX_OUTOFBOUNDS_ERROR for a bad capture group number + * @return the index of the first character following the text + * captured by the specified group during the previous match operation. + * Return -1 if the capture group exists in the pattern but was not part of the match. + * The index value returned is a native index, corresponding to + * code units for the underlying encoding type, for example, + * a byte index for UTF8. + * @stable ICU 2.4 + */ + virtual int32_t end(int32_t group, UErrorCode &status) const; + + /** + * Returns the index in the input string of the character following the + * text matched by the specified capture group during the previous match operation. + * + * @param group the capture group number + * @param status A reference to a UErrorCode to receive any errors. Possible + * errors are U_REGEX_INVALID_STATE if no match has been + * attempted or the last match failed and + * U_INDEX_OUTOFBOUNDS_ERROR for a bad capture group number + * @return the index of the first character following the text + * captured by the specified group during the previous match operation. + * Return -1 if the capture group exists in the pattern but was not part of the match. + * The index value returned is a native index, corresponding to + * code units for the underlying encoding type, for example, + * a byte index for UTF8. + * @stable ICU 4.6 + */ + virtual int64_t end64(int32_t group, UErrorCode &status) const; + + /** + * Resets this matcher. The effect is to remove any memory of previous matches, + * and to cause subsequent find() operations to begin at the beginning of + * the input string. + * + * @return this RegexMatcher. + * @stable ICU 2.4 + */ + virtual RegexMatcher &reset(); + + + /** + * Resets this matcher, and set the current input position. + * The effect is to remove any memory of previous matches, + * and to cause subsequent find() operations to begin at + * the specified (native) position in the input string. + *

+ * The matcher's region is reset to its default, which is the entire + * input string. + *

+ * An alternative to this function is to set a match region + * beginning at the desired index. + * + * @return this RegexMatcher. + * @stable ICU 2.8 + */ + virtual RegexMatcher &reset(int64_t index, UErrorCode &status); + + + /** + * Resets this matcher with a new input string. This allows instances of RegexMatcher + * to be reused, which is more efficient than creating a new RegexMatcher for + * each input string to be processed. + * @param input The new string on which subsequent pattern matches will operate. + * The matcher retains a reference to the callers string, and operates + * directly on that. Ownership of the string remains with the caller. + * Because no copy of the string is made, it is essential that the + * caller not delete the string until after regexp operations on it + * are done. + * Note that while a reset on the matcher with an input string that is then + * modified across/during matcher operations may be supported currently for UnicodeString, + * this was not originally intended behavior, and support for this is not guaranteed + * in upcoming versions of ICU. + * @return this RegexMatcher. + * @stable ICU 2.4 + */ + virtual RegexMatcher &reset(const UnicodeString &input); + + + /** + * Resets this matcher with a new input string. This allows instances of RegexMatcher + * to be reused, which is more efficient than creating a new RegexMatcher for + * each input string to be processed. + * @param input The new string on which subsequent pattern matches will operate. + * The matcher makes a shallow clone of the given text; ownership of the + * original string remains with the caller. Because no deep copy of the + * text is made, it is essential that the caller not modify the string + * until after regexp operations on it are done. + * @return this RegexMatcher. + * + * @stable ICU 4.6 + */ + virtual RegexMatcher &reset(UText *input); + + + /** + * Set the subject text string upon which the regular expression is looking for matches + * without changing any other aspect of the matching state. + * The new and previous text strings must have the same content. + * + * This function is intended for use in environments where ICU is operating on + * strings that may move around in memory. It provides a mechanism for notifying + * ICU that the string has been relocated, and providing a new UText to access the + * string in its new position. + * + * Note that the regular expression implementation never copies the underlying text + * of a string being matched, but always operates directly on the original text + * provided by the user. Refreshing simply drops the references to the old text + * and replaces them with references to the new. + * + * Caution: this function is normally used only by very specialized, + * system-level code. One example use case is with garbage collection that moves + * the text in memory. + * + * @param input The new (moved) text string. + * @param status Receives errors detected by this function. + * + * @stable ICU 4.8 + */ + virtual RegexMatcher &refreshInputText(UText *input, UErrorCode &status); + +private: + /** + * Cause a compilation error if an application accidentally attempts to + * reset a matcher with a (char16_t *) string as input rather than + * a UnicodeString. Avoids a dangling reference to a temporary string. + *

+ * To efficiently work with char16_t *strings, wrap the data in a UnicodeString + * using one of the aliasing constructors, such as + * UnicodeString(UBool isTerminated, const char16_t *text, int32_t textLength); + * or in a UText, using + * utext_openUChars(UText *ut, const char16_t *text, int64_t textLength, UErrorCode *status); + * + */ + RegexMatcher &reset(const char16_t *input); +public: + + /** + * Returns the input string being matched. Ownership of the string belongs to + * the matcher; it should not be altered or deleted. This method will work even if the input + * was originally supplied as a UText. + * @return the input string + * @stable ICU 2.4 + */ + virtual const UnicodeString &input() const; + + /** + * Returns the input string being matched. This is the live input text; it should not be + * altered or deleted. This method will work even if the input was originally supplied as + * a UnicodeString. + * @return the input text + * + * @stable ICU 4.6 + */ + virtual UText *inputText() const; + + /** + * Returns the input string being matched, either by copying it into the provided + * UText parameter or by returning a shallow clone of the live input. Note that copying + * the entire input may cause significant performance and memory issues. + * @param dest The UText into which the input should be copied, or NULL to create a new UText + * @param status error code + * @return dest if non-NULL, a shallow copy of the input text otherwise + * + * @stable ICU 4.6 + */ + virtual UText *getInput(UText *dest, UErrorCode &status) const; + + + /** Sets the limits of this matcher's region. + * The region is the part of the input string that will be searched to find a match. + * Invoking this method resets the matcher, and then sets the region to start + * at the index specified by the start parameter and end at the index specified + * by the end parameter. + * + * Depending on the transparency and anchoring being used (see useTransparentBounds + * and useAnchoringBounds), certain constructs such as anchors may behave differently + * at or around the boundaries of the region + * + * The function will fail if start is greater than limit, or if either index + * is less than zero or greater than the length of the string being matched. + * + * @param start The (native) index to begin searches at. + * @param limit The index to end searches at (exclusive). + * @param status A reference to a UErrorCode to receive any errors. + * @stable ICU 4.0 + */ + virtual RegexMatcher ®ion(int64_t start, int64_t limit, UErrorCode &status); + + /** + * Identical to region(start, limit, status) but also allows a start position without + * resetting the region state. + * @param regionStart The region start + * @param regionLimit the limit of the region + * @param startIndex The (native) index within the region bounds at which to begin searches. + * @param status A reference to a UErrorCode to receive any errors. + * If startIndex is not within the specified region bounds, + * U_INDEX_OUTOFBOUNDS_ERROR is returned. + * @stable ICU 4.6 + */ + virtual RegexMatcher ®ion(int64_t regionStart, int64_t regionLimit, int64_t startIndex, UErrorCode &status); + + /** + * Reports the start index of this matcher's region. The searches this matcher + * conducts are limited to finding matches within regionStart (inclusive) and + * regionEnd (exclusive). + * + * @return The starting (native) index of this matcher's region. + * @stable ICU 4.0 + */ + virtual int32_t regionStart() const; + + /** + * Reports the start index of this matcher's region. The searches this matcher + * conducts are limited to finding matches within regionStart (inclusive) and + * regionEnd (exclusive). + * + * @return The starting (native) index of this matcher's region. + * @stable ICU 4.6 + */ + virtual int64_t regionStart64() const; + + + /** + * Reports the end (limit) index (exclusive) of this matcher's region. The searches + * this matcher conducts are limited to finding matches within regionStart + * (inclusive) and regionEnd (exclusive). + * + * @return The ending point (native) of this matcher's region. + * @stable ICU 4.0 + */ + virtual int32_t regionEnd() const; + + /** + * Reports the end (limit) index (exclusive) of this matcher's region. The searches + * this matcher conducts are limited to finding matches within regionStart + * (inclusive) and regionEnd (exclusive). + * + * @return The ending point (native) of this matcher's region. + * @stable ICU 4.6 + */ + virtual int64_t regionEnd64() const; + + /** + * Queries the transparency of region bounds for this matcher. + * See useTransparentBounds for a description of transparent and opaque bounds. + * By default, a matcher uses opaque region boundaries. + * + * @return TRUE if this matcher is using opaque bounds, false if it is not. + * @stable ICU 4.0 + */ + virtual UBool hasTransparentBounds() const; + + /** + * Sets the transparency of region bounds for this matcher. + * Invoking this function with an argument of true will set this matcher to use transparent bounds. + * If the boolean argument is false, then opaque bounds will be used. + * + * Using transparent bounds, the boundaries of this matcher's region are transparent + * to lookahead, lookbehind, and boundary matching constructs. Those constructs can + * see text beyond the boundaries of the region while checking for a match. + * + * With opaque bounds, no text outside of the matcher's region is visible to lookahead, + * lookbehind, and boundary matching constructs. + * + * By default, a matcher uses opaque bounds. + * + * @param b TRUE for transparent bounds; FALSE for opaque bounds + * @return This Matcher; + * @stable ICU 4.0 + **/ + virtual RegexMatcher &useTransparentBounds(UBool b); + + + /** + * Return true if this matcher is using anchoring bounds. + * By default, matchers use anchoring region bounds. + * + * @return TRUE if this matcher is using anchoring bounds. + * @stable ICU 4.0 + */ + virtual UBool hasAnchoringBounds() const; + + + /** + * Set whether this matcher is using Anchoring Bounds for its region. + * With anchoring bounds, pattern anchors such as ^ and $ will match at the start + * and end of the region. Without Anchoring Bounds, anchors will only match at + * the positions they would in the complete text. + * + * Anchoring Bounds are the default for regions. + * + * @param b TRUE if to enable anchoring bounds; FALSE to disable them. + * @return This Matcher + * @stable ICU 4.0 + */ + virtual RegexMatcher &useAnchoringBounds(UBool b); + + + /** + * Return TRUE if the most recent matching operation attempted to access + * additional input beyond the available input text. + * In this case, additional input text could change the results of the match. + * + * hitEnd() is defined for both successful and unsuccessful matches. + * In either case hitEnd() will return TRUE if if the end of the text was + * reached at any point during the matching process. + * + * @return TRUE if the most recent match hit the end of input + * @stable ICU 4.0 + */ + virtual UBool hitEnd() const; + + /** + * Return TRUE the most recent match succeeded and additional input could cause + * it to fail. If this method returns false and a match was found, then more input + * might change the match but the match won't be lost. If a match was not found, + * then requireEnd has no meaning. + * + * @return TRUE if more input could cause the most recent match to no longer match. + * @stable ICU 4.0 + */ + virtual UBool requireEnd() const; + + + /** + * Returns the pattern that is interpreted by this matcher. + * @return the RegexPattern for this RegexMatcher + * @stable ICU 2.4 + */ + virtual const RegexPattern &pattern() const; + + + /** + * Replaces every substring of the input that matches the pattern + * with the given replacement string. This is a convenience function that + * provides a complete find-and-replace-all operation. + * + * This method first resets this matcher. It then scans the input string + * looking for matches of the pattern. Input that is not part of any + * match is left unchanged; each match is replaced in the result by the + * replacement string. The replacement string may contain references to + * capture groups. + * + * @param replacement a string containing the replacement text. + * @param status a reference to a UErrorCode to receive any errors. + * @return a string containing the results of the find and replace. + * @stable ICU 2.4 + */ + virtual UnicodeString replaceAll(const UnicodeString &replacement, UErrorCode &status); + + + /** + * Replaces every substring of the input that matches the pattern + * with the given replacement string. This is a convenience function that + * provides a complete find-and-replace-all operation. + * + * This method first resets this matcher. It then scans the input string + * looking for matches of the pattern. Input that is not part of any + * match is left unchanged; each match is replaced in the result by the + * replacement string. The replacement string may contain references to + * capture groups. + * + * @param replacement a string containing the replacement text. + * @param dest a mutable UText in which the results are placed. + * If NULL, a new UText will be created (which may not be mutable). + * @param status a reference to a UErrorCode to receive any errors. + * @return a string containing the results of the find and replace. + * If a pre-allocated UText was provided, it will always be used and returned. + * + * @stable ICU 4.6 + */ + virtual UText *replaceAll(UText *replacement, UText *dest, UErrorCode &status); + + + /** + * Replaces the first substring of the input that matches + * the pattern with the replacement string. This is a convenience + * function that provides a complete find-and-replace operation. + * + *

This function first resets this RegexMatcher. It then scans the input string + * looking for a match of the pattern. Input that is not part + * of the match is appended directly to the result string; the match is replaced + * in the result by the replacement string. The replacement string may contain + * references to captured groups.

+ * + *

The state of the matcher (the position at which a subsequent find() + * would begin) after completing a replaceFirst() is not specified. The + * RegexMatcher should be reset before doing additional find() operations.

+ * + * @param replacement a string containing the replacement text. + * @param status a reference to a UErrorCode to receive any errors. + * @return a string containing the results of the find and replace. + * @stable ICU 2.4 + */ + virtual UnicodeString replaceFirst(const UnicodeString &replacement, UErrorCode &status); + + + /** + * Replaces the first substring of the input that matches + * the pattern with the replacement string. This is a convenience + * function that provides a complete find-and-replace operation. + * + *

This function first resets this RegexMatcher. It then scans the input string + * looking for a match of the pattern. Input that is not part + * of the match is appended directly to the result string; the match is replaced + * in the result by the replacement string. The replacement string may contain + * references to captured groups.

+ * + *

The state of the matcher (the position at which a subsequent find() + * would begin) after completing a replaceFirst() is not specified. The + * RegexMatcher should be reset before doing additional find() operations.

+ * + * @param replacement a string containing the replacement text. + * @param dest a mutable UText in which the results are placed. + * If NULL, a new UText will be created (which may not be mutable). + * @param status a reference to a UErrorCode to receive any errors. + * @return a string containing the results of the find and replace. + * If a pre-allocated UText was provided, it will always be used and returned. + * + * @stable ICU 4.6 + */ + virtual UText *replaceFirst(UText *replacement, UText *dest, UErrorCode &status); + + + /** + * Implements a replace operation intended to be used as part of an + * incremental find-and-replace. + * + *

The input string, starting from the end of the previous replacement and ending at + * the start of the current match, is appended to the destination string. Then the + * replacement string is appended to the output string, + * including handling any substitutions of captured text.

+ * + *

For simple, prepackaged, non-incremental find-and-replace + * operations, see replaceFirst() or replaceAll().

+ * + * @param dest A UnicodeString to which the results of the find-and-replace are appended. + * @param replacement A UnicodeString that provides the text to be substituted for + * the input text that matched the regexp pattern. The replacement + * text may contain references to captured text from the + * input. + * @param status A reference to a UErrorCode to receive any errors. Possible + * errors are U_REGEX_INVALID_STATE if no match has been + * attempted or the last match failed, and U_INDEX_OUTOFBOUNDS_ERROR + * if the replacement text specifies a capture group that + * does not exist in the pattern. + * + * @return this RegexMatcher + * @stable ICU 2.4 + * + */ + virtual RegexMatcher &appendReplacement(UnicodeString &dest, + const UnicodeString &replacement, UErrorCode &status); + + + /** + * Implements a replace operation intended to be used as part of an + * incremental find-and-replace. + * + *

The input string, starting from the end of the previous replacement and ending at + * the start of the current match, is appended to the destination string. Then the + * replacement string is appended to the output string, + * including handling any substitutions of captured text.

+ * + *

For simple, prepackaged, non-incremental find-and-replace + * operations, see replaceFirst() or replaceAll().

+ * + * @param dest A mutable UText to which the results of the find-and-replace are appended. + * Must not be NULL. + * @param replacement A UText that provides the text to be substituted for + * the input text that matched the regexp pattern. The replacement + * text may contain references to captured text from the input. + * @param status A reference to a UErrorCode to receive any errors. Possible + * errors are U_REGEX_INVALID_STATE if no match has been + * attempted or the last match failed, and U_INDEX_OUTOFBOUNDS_ERROR + * if the replacement text specifies a capture group that + * does not exist in the pattern. + * + * @return this RegexMatcher + * + * @stable ICU 4.6 + */ + virtual RegexMatcher &appendReplacement(UText *dest, + UText *replacement, UErrorCode &status); + + + /** + * As the final step in a find-and-replace operation, append the remainder + * of the input string, starting at the position following the last appendReplacement(), + * to the destination string. appendTail() is intended to be invoked after one + * or more invocations of the RegexMatcher::appendReplacement(). + * + * @param dest A UnicodeString to which the results of the find-and-replace are appended. + * @return the destination string. + * @stable ICU 2.4 + */ + virtual UnicodeString &appendTail(UnicodeString &dest); + + + /** + * As the final step in a find-and-replace operation, append the remainder + * of the input string, starting at the position following the last appendReplacement(), + * to the destination string. appendTail() is intended to be invoked after one + * or more invocations of the RegexMatcher::appendReplacement(). + * + * @param dest A mutable UText to which the results of the find-and-replace are appended. + * Must not be NULL. + * @param status error cod + * @return the destination string. + * + * @stable ICU 4.6 + */ + virtual UText *appendTail(UText *dest, UErrorCode &status); + + + /** + * Split a string into fields. Somewhat like split() from Perl. + * The pattern matches identify delimiters that separate the input + * into fields. The input data between the matches becomes the + * fields themselves. + * + * @param input The string to be split into fields. The field delimiters + * match the pattern (in the "this" object). This matcher + * will be reset to this input string. + * @param dest An array of UnicodeStrings to receive the results of the split. + * This is an array of actual UnicodeString objects, not an + * array of pointers to strings. Local (stack based) arrays can + * work well here. + * @param destCapacity The number of elements in the destination array. + * If the number of fields found is less than destCapacity, the + * extra strings in the destination array are not altered. + * If the number of destination strings is less than the number + * of fields, the trailing part of the input string, including any + * field delimiters, is placed in the last destination string. + * @param status A reference to a UErrorCode to receive any errors. + * @return The number of fields into which the input string was split. + * @stable ICU 2.6 + */ + virtual int32_t split(const UnicodeString &input, + UnicodeString dest[], + int32_t destCapacity, + UErrorCode &status); + + + /** + * Split a string into fields. Somewhat like split() from Perl. + * The pattern matches identify delimiters that separate the input + * into fields. The input data between the matches becomes the + * fields themselves. + * + * @param input The string to be split into fields. The field delimiters + * match the pattern (in the "this" object). This matcher + * will be reset to this input string. + * @param dest An array of mutable UText structs to receive the results of the split. + * If a field is NULL, a new UText is allocated to contain the results for + * that field. This new UText is not guaranteed to be mutable. + * @param destCapacity The number of elements in the destination array. + * If the number of fields found is less than destCapacity, the + * extra strings in the destination array are not altered. + * If the number of destination strings is less than the number + * of fields, the trailing part of the input string, including any + * field delimiters, is placed in the last destination string. + * @param status A reference to a UErrorCode to receive any errors. + * @return The number of fields into which the input string was split. + * + * @stable ICU 4.6 + */ + virtual int32_t split(UText *input, + UText *dest[], + int32_t destCapacity, + UErrorCode &status); + + /** + * Set a processing time limit for match operations with this Matcher. + * + * Some patterns, when matching certain strings, can run in exponential time. + * For practical purposes, the match operation may appear to be in an + * infinite loop. + * When a limit is set a match operation will fail with an error if the + * limit is exceeded. + *

+ * The units of the limit are steps of the match engine. + * Correspondence with actual processor time will depend on the speed + * of the processor and the details of the specific pattern, but will + * typically be on the order of milliseconds. + *

+ * By default, the matching time is not limited. + *

+ * + * @param limit The limit value, or 0 for no limit. + * @param status A reference to a UErrorCode to receive any errors. + * @stable ICU 4.0 + */ + virtual void setTimeLimit(int32_t limit, UErrorCode &status); + + /** + * Get the time limit, if any, for match operations made with this Matcher. + * + * @return the maximum allowed time for a match, in units of processing steps. + * @stable ICU 4.0 + */ + virtual int32_t getTimeLimit() const; + + /** + * Set the amount of heap storage available for use by the match backtracking stack. + * The matcher is also reset, discarding any results from previous matches. + *

+ * ICU uses a backtracking regular expression engine, with the backtrack stack + * maintained on the heap. This function sets the limit to the amount of memory + * that can be used for this purpose. A backtracking stack overflow will + * result in an error from the match operation that caused it. + *

+ * A limit is desirable because a malicious or poorly designed pattern can use + * excessive memory, potentially crashing the process. A limit is enabled + * by default. + *

+ * @param limit The maximum size, in bytes, of the matching backtrack stack. + * A value of zero means no limit. + * The limit must be greater or equal to zero. + * + * @param status A reference to a UErrorCode to receive any errors. + * + * @stable ICU 4.0 + */ + virtual void setStackLimit(int32_t limit, UErrorCode &status); + + /** + * Get the size of the heap storage available for use by the back tracking stack. + * + * @return the maximum backtracking stack size, in bytes, or zero if the + * stack size is unlimited. + * @stable ICU 4.0 + */ + virtual int32_t getStackLimit() const; + + + /** + * Set a callback function for use with this Matcher. + * During matching operations the function will be called periodically, + * giving the application the opportunity to terminate a long-running + * match. + * + * @param callback A pointer to the user-supplied callback function. + * @param context User context pointer. The value supplied at the + * time the callback function is set will be saved + * and passed to the callback each time that it is called. + * @param status A reference to a UErrorCode to receive any errors. + * @stable ICU 4.0 + */ + virtual void setMatchCallback(URegexMatchCallback *callback, + const void *context, + UErrorCode &status); + + + /** + * Get the callback function for this URegularExpression. + * + * @param callback Out parameter, receives a pointer to the user-supplied + * callback function. + * @param context Out parameter, receives the user context pointer that + * was set when uregex_setMatchCallback() was called. + * @param status A reference to a UErrorCode to receive any errors. + * @stable ICU 4.0 + */ + virtual void getMatchCallback(URegexMatchCallback *&callback, + const void *&context, + UErrorCode &status); + + + /** + * Set a progress callback function for use with find operations on this Matcher. + * During find operations, the callback will be invoked after each return from a + * match attempt, giving the application the opportunity to terminate a long-running + * find operation. + * + * @param callback A pointer to the user-supplied callback function. + * @param context User context pointer. The value supplied at the + * time the callback function is set will be saved + * and passed to the callback each time that it is called. + * @param status A reference to a UErrorCode to receive any errors. + * @stable ICU 4.6 + */ + virtual void setFindProgressCallback(URegexFindProgressCallback *callback, + const void *context, + UErrorCode &status); + + + /** + * Get the find progress callback function for this URegularExpression. + * + * @param callback Out parameter, receives a pointer to the user-supplied + * callback function. + * @param context Out parameter, receives the user context pointer that + * was set when uregex_setFindProgressCallback() was called. + * @param status A reference to a UErrorCode to receive any errors. + * @stable ICU 4.6 + */ + virtual void getFindProgressCallback(URegexFindProgressCallback *&callback, + const void *&context, + UErrorCode &status); + +#ifndef U_HIDE_INTERNAL_API + /** + * setTrace Debug function, enable/disable tracing of the matching engine. + * For internal ICU development use only. DO NO USE!!!! + * @internal + */ + void setTrace(UBool state); +#endif /* U_HIDE_INTERNAL_API */ + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.2 + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.2 + */ + virtual UClassID getDynamicClassID() const; + +private: + // Constructors and other object boilerplate are private. + // Instances of RegexMatcher can not be assigned, copied, cloned, etc. + RegexMatcher(); // default constructor not implemented + RegexMatcher(const RegexPattern *pat); + RegexMatcher(const RegexMatcher &other); + RegexMatcher &operator =(const RegexMatcher &rhs); + void init(UErrorCode &status); // Common initialization + void init2(UText *t, UErrorCode &e); // Common initialization, part 2. + + friend class RegexPattern; + friend class RegexCImpl; +public: +#ifndef U_HIDE_INTERNAL_API + /** @internal */ + void resetPreserveRegion(); // Reset matcher state, but preserve any region. +#endif /* U_HIDE_INTERNAL_API */ +private: + + // + // MatchAt This is the internal interface to the match engine itself. + // Match status comes back in matcher member variables. + // + void MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status); + inline void backTrack(int64_t &inputIdx, int32_t &patIdx); + UBool isWordBoundary(int64_t pos); // perform Perl-like \b test + UBool isUWordBoundary(int64_t pos); // perform RBBI based \b test + REStackFrame *resetStack(); + inline REStackFrame *StateSave(REStackFrame *fp, int64_t savePatIdx, UErrorCode &status); + void IncrementTime(UErrorCode &status); + + // Call user find callback function, if set. Return TRUE if operation should be interrupted. + inline UBool findProgressInterrupt(int64_t matchIndex, UErrorCode &status); + + int64_t appendGroup(int32_t groupNum, UText *dest, UErrorCode &status) const; + + UBool findUsingChunk(UErrorCode &status); + void MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &status); + UBool isChunkWordBoundary(int32_t pos); + + const RegexPattern *fPattern; + RegexPattern *fPatternOwned; // Non-NULL if this matcher owns the pattern, and + // should delete it when through. + + const UnicodeString *fInput; // The string being matched. Only used for input() + UText *fInputText; // The text being matched. Is never NULL. + UText *fAltInputText; // A shallow copy of the text being matched. + // Only created if the pattern contains backreferences. + int64_t fInputLength; // Full length of the input text. + int32_t fFrameSize; // The size of a frame in the backtrack stack. + + int64_t fRegionStart; // Start of the input region, default = 0. + int64_t fRegionLimit; // End of input region, default to input.length. + + int64_t fAnchorStart; // Region bounds for anchoring operations (^ or $). + int64_t fAnchorLimit; // See useAnchoringBounds + + int64_t fLookStart; // Region bounds for look-ahead/behind and + int64_t fLookLimit; // and other boundary tests. See + // useTransparentBounds + + int64_t fActiveStart; // Currently active bounds for matching. + int64_t fActiveLimit; // Usually is the same as region, but + // is changed to fLookStart/Limit when + // entering look around regions. + + UBool fTransparentBounds; // True if using transparent bounds. + UBool fAnchoringBounds; // True if using anchoring bounds. + + UBool fMatch; // True if the last attempted match was successful. + int64_t fMatchStart; // Position of the start of the most recent match + int64_t fMatchEnd; // First position after the end of the most recent match + // Zero if no previous match, even when a region + // is active. + int64_t fLastMatchEnd; // First position after the end of the previous match, + // or -1 if there was no previous match. + int64_t fAppendPosition; // First position after the end of the previous + // appendReplacement(). As described by the + // JavaDoc for Java Matcher, where it is called + // "append position" + UBool fHitEnd; // True if the last match touched the end of input. + UBool fRequireEnd; // True if the last match required end-of-input + // (matched $ or Z) + + UVector64 *fStack; + REStackFrame *fFrame; // After finding a match, the last active stack frame, + // which will contain the capture group results. + // NOT valid while match engine is running. + + int64_t *fData; // Data area for use by the compiled pattern. + int64_t fSmallData[8]; // Use this for data if it's enough. + + int32_t fTimeLimit; // Max time (in arbitrary steps) to let the + // match engine run. Zero for unlimited. + + int32_t fTime; // Match time, accumulates while matching. + int32_t fTickCounter; // Low bits counter for time. Counts down StateSaves. + // Kept separately from fTime to keep as much + // code as possible out of the inline + // StateSave function. + + int32_t fStackLimit; // Maximum memory size to use for the backtrack + // stack, in bytes. Zero for unlimited. + + URegexMatchCallback *fCallbackFn; // Pointer to match progress callback funct. + // NULL if there is no callback. + const void *fCallbackContext; // User Context ptr for callback function. + + URegexFindProgressCallback *fFindProgressCallbackFn; // Pointer to match progress callback funct. + // NULL if there is no callback. + const void *fFindProgressCallbackContext; // User Context ptr for callback function. + + + UBool fInputUniStrMaybeMutable; // Set when fInputText wraps a UnicodeString that may be mutable - compatibility. + + UBool fTraceDebug; // Set true for debug tracing of match engine. + + UErrorCode fDeferredStatus; // Save error state that cannot be immediately + // reported, or that permanently disables this matcher. + + RuleBasedBreakIterator *fWordBreakItr; +}; + +U_NAMESPACE_END +#endif // UCONFIG_NO_REGULAR_EXPRESSIONS +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/region.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/region.h new file mode 100644 index 0000000..80b2929 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/region.h @@ -0,0 +1,224 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ******************************************************************************* + * Copyright (C) 2014-2016, International Business Machines Corporation and others. + * All Rights Reserved. + ******************************************************************************* + */ + +#ifndef REGION_H +#define REGION_H + +/** + * \file + * \brief C++ API: Region classes (territory containment) + */ + +#include "unicode/utypes.h" +#include "unicode/uregion.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/uobject.h" +#include "unicode/uniset.h" +#include "unicode/unistr.h" +#include "unicode/strenum.h" + +U_NAMESPACE_BEGIN + +/** + * Region is the class representing a Unicode Region Code, also known as a + * Unicode Region Subtag, which is defined based upon the BCP 47 standard. We often think of + * "regions" as "countries" when defining the characteristics of a locale. Region codes There are different + * types of region codes that are important to distinguish. + *

+ * Macroregion - A code for a "macro geographical (continental) region, geographical sub-region, or + * selected economic and other grouping" as defined in + * UN M.49 (http://unstats.un.org/unsd/methods/m49/m49regin.htm). + * These are typically 3-digit codes, but contain some 2-letter codes, such as the LDML code QO + * added for Outlying Oceania. Not all UNM.49 codes are defined in LDML, but most of them are. + * Macroregions are represented in ICU by one of three region types: WORLD ( region code 001 ), + * CONTINENTS ( regions contained directly by WORLD ), and SUBCONTINENTS ( things contained directly + * by a continent ). + *

+ * TERRITORY - A Region that is not a Macroregion. These are typically codes for countries, but also + * include areas that are not separate countries, such as the code "AQ" for Antarctica or the code + * "HK" for Hong Kong (SAR China). Overseas dependencies of countries may or may not have separate + * codes. The codes are typically 2-letter codes aligned with the ISO 3166 standard, but BCP47 allows + * for the use of 3-digit codes in the future. + *

+ * UNKNOWN - The code ZZ is defined by Unicode LDML for use to indicate that the Region is unknown, + * or that the value supplied as a region was invalid. + *

+ * DEPRECATED - Region codes that have been defined in the past but are no longer in modern usage, + * usually due to a country splitting into multiple territories or changing its name. + *

+ * GROUPING - A widely understood grouping of territories that has a well defined membership such + * that a region code has been assigned for it. Some of these are UNM.49 codes that do't fall into + * the world/continent/sub-continent hierarchy, while others are just well known groupings that have + * their own region code. Region "EU" (European Union) is one such region code that is a grouping. + * Groupings will never be returned by the getContainingRegion() API, since a different type of region + * ( WORLD, CONTINENT, or SUBCONTINENT ) will always be the containing region instead. + * + * The Region class is not intended for public subclassing. + * + * @author John Emmons + * @stable ICU 51 + */ + +class U_I18N_API Region : public UObject { +public: + /** + * Destructor. + * @stable ICU 51 + */ + virtual ~Region(); + + /** + * Returns true if the two regions are equal. + * @stable ICU 51 + */ + UBool operator==(const Region &that) const; + + /** + * Returns true if the two regions are NOT equal; that is, if operator ==() returns false. + * @stable ICU 51 + */ + UBool operator!=(const Region &that) const; + + /** + * Returns a pointer to a Region using the given region code. The region code can be either 2-letter ISO code, + * 3-letter ISO code, UNM.49 numeric code, or other valid Unicode Region Code as defined by the LDML specification. + * The identifier will be canonicalized internally using the supplemental metadata as defined in the CLDR. + * If the region code is NULL or not recognized, the appropriate error code will be set ( U_ILLEGAL_ARGUMENT_ERROR ) + * @stable ICU 51 + */ + static const Region* U_EXPORT2 getInstance(const char *region_code, UErrorCode &status); + + /** + * Returns a pointer to a Region using the given numeric region code. If the numeric region code is not recognized, + * the appropriate error code will be set ( U_ILLEGAL_ARGUMENT_ERROR ). + * @stable ICU 51 + */ + static const Region* U_EXPORT2 getInstance (int32_t code, UErrorCode &status); + + /** + * Returns an enumeration over the IDs of all known regions that match the given type. + * @stable ICU 55 + */ + static StringEnumeration* U_EXPORT2 getAvailable(URegionType type, UErrorCode &status); + + /** + * Returns a pointer to the region that contains this region. Returns NULL if this region is code "001" (World) + * or "ZZ" (Unknown region). For example, calling this method with region "IT" (Italy) returns the + * region "039" (Southern Europe). + * @stable ICU 51 + */ + const Region* getContainingRegion() const; + + /** + * Return a pointer to the region that geographically contains this region and matches the given type, + * moving multiple steps up the containment chain if necessary. Returns NULL if no containing region can be found + * that matches the given type. Note: The URegionTypes = "URGN_GROUPING", "URGN_DEPRECATED", or "URGN_UNKNOWN" + * are not appropriate for use in this API. NULL will be returned in this case. For example, calling this method + * with region "IT" (Italy) for type "URGN_CONTINENT" returns the region "150" ( Europe ). + * @stable ICU 51 + */ + const Region* getContainingRegion(URegionType type) const; + + /** + * Return an enumeration over the IDs of all the regions that are immediate children of this region in the + * region hierarchy. These returned regions could be either macro regions, territories, or a mixture of the two, + * depending on the containment data as defined in CLDR. This API may return NULL if this region doesn't have + * any sub-regions. For example, calling this method with region "150" (Europe) returns an enumeration containing + * the various sub regions of Europe - "039" (Southern Europe) - "151" (Eastern Europe) - "154" (Northern Europe) + * and "155" (Western Europe). + * @stable ICU 55 + */ + StringEnumeration* getContainedRegions(UErrorCode &status) const; + + /** + * Returns an enumeration over the IDs of all the regions that are children of this region anywhere in the region + * hierarchy and match the given type. This API may return an empty enumeration if this region doesn't have any + * sub-regions that match the given type. For example, calling this method with region "150" (Europe) and type + * "URGN_TERRITORY" returns a set containing all the territories in Europe ( "FR" (France) - "IT" (Italy) - "DE" (Germany) etc. ) + * @stable ICU 55 + */ + StringEnumeration* getContainedRegions( URegionType type, UErrorCode &status ) const; + + /** + * Returns true if this region contains the supplied other region anywhere in the region hierarchy. + * @stable ICU 51 + */ + UBool contains(const Region &other) const; + + /** + * For deprecated regions, return an enumeration over the IDs of the regions that are the preferred replacement + * regions for this region. Returns null for a non-deprecated region. For example, calling this method with region + * "SU" (Soviet Union) would return a list of the regions containing "RU" (Russia), "AM" (Armenia), "AZ" (Azerbaijan), etc... + * @stable ICU 55 + */ + StringEnumeration* getPreferredValues(UErrorCode &status) const; + + /** + * Return this region's canonical region code. + * @stable ICU 51 + */ + const char* getRegionCode() const; + + /** + * Return this region's numeric code. + * Returns a negative value if the given region does not have a numeric code assigned to it. + * @stable ICU 51 + */ + int32_t getNumericCode() const; + + /** + * Returns the region type of this region. + * @stable ICU 51 + */ + URegionType getType() const; + +#ifndef U_HIDE_INTERNAL_API + /** + * Cleans up statically allocated memory. + * @internal + */ + static void cleanupRegionData(); +#endif /* U_HIDE_INTERNAL_API */ + +private: + char id[4]; + UnicodeString idStr; + int32_t code; + URegionType type; + Region *containingRegion; + UVector *containedRegions; + UVector *preferredValues; + + /** + * Default Constructor. Internal - use factory methods only. + */ + Region(); + + + /* + * Initializes the region data from the ICU resource bundles. The region data + * contains the basic relationships such as which regions are known, what the numeric + * codes are, any known aliases, and the territory containment data. + * + * If the region data has already loaded, then this method simply returns without doing + * anything meaningful. + */ + + static void U_CALLCONV loadRegionData(UErrorCode &status); + +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ +#endif // REGION_H + +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/reldatefmt.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/reldatefmt.h new file mode 100644 index 0000000..09d9620 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/reldatefmt.h @@ -0,0 +1,522 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +***************************************************************************** +* Copyright (C) 2014-2016, International Business Machines Corporation and +* others. +* All Rights Reserved. +***************************************************************************** +* +* File RELDATEFMT.H +***************************************************************************** +*/ + +#ifndef __RELDATEFMT_H +#define __RELDATEFMT_H + +#include "unicode/utypes.h" +#include "unicode/uobject.h" +#include "unicode/udisplaycontext.h" +#include "unicode/ureldatefmt.h" +#include "unicode/locid.h" + +/** + * \file + * \brief C++ API: Formats relative dates such as "1 day ago" or "tomorrow" + */ + +#if !UCONFIG_NO_FORMATTING + +/** + * Represents the unit for formatting a relative date. e.g "in 5 days" + * or "in 3 months" + * @stable ICU 53 + */ +typedef enum UDateRelativeUnit { + + /** + * Seconds + * @stable ICU 53 + */ + UDAT_RELATIVE_SECONDS, + + /** + * Minutes + * @stable ICU 53 + */ + UDAT_RELATIVE_MINUTES, + + /** + * Hours + * @stable ICU 53 + */ + UDAT_RELATIVE_HOURS, + + /** + * Days + * @stable ICU 53 + */ + UDAT_RELATIVE_DAYS, + + /** + * Weeks + * @stable ICU 53 + */ + UDAT_RELATIVE_WEEKS, + + /** + * Months + * @stable ICU 53 + */ + UDAT_RELATIVE_MONTHS, + + /** + * Years + * @stable ICU 53 + */ + UDAT_RELATIVE_YEARS, + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UDateRelativeUnit value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UDAT_RELATIVE_UNIT_COUNT +#endif // U_HIDE_DEPRECATED_API +} UDateRelativeUnit; + +/** + * Represents an absolute unit. + * @stable ICU 53 + */ +typedef enum UDateAbsoluteUnit { + + // Days of week have to remain together and in order from Sunday to + // Saturday. + /** + * Sunday + * @stable ICU 53 + */ + UDAT_ABSOLUTE_SUNDAY, + + /** + * Monday + * @stable ICU 53 + */ + UDAT_ABSOLUTE_MONDAY, + + /** + * Tuesday + * @stable ICU 53 + */ + UDAT_ABSOLUTE_TUESDAY, + + /** + * Wednesday + * @stable ICU 53 + */ + UDAT_ABSOLUTE_WEDNESDAY, + + /** + * Thursday + * @stable ICU 53 + */ + UDAT_ABSOLUTE_THURSDAY, + + /** + * Friday + * @stable ICU 53 + */ + UDAT_ABSOLUTE_FRIDAY, + + /** + * Saturday + * @stable ICU 53 + */ + UDAT_ABSOLUTE_SATURDAY, + + /** + * Day + * @stable ICU 53 + */ + UDAT_ABSOLUTE_DAY, + + /** + * Week + * @stable ICU 53 + */ + UDAT_ABSOLUTE_WEEK, + + /** + * Month + * @stable ICU 53 + */ + UDAT_ABSOLUTE_MONTH, + + /** + * Year + * @stable ICU 53 + */ + UDAT_ABSOLUTE_YEAR, + + /** + * Now + * @stable ICU 53 + */ + UDAT_ABSOLUTE_NOW, + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UDateAbsoluteUnit value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UDAT_ABSOLUTE_UNIT_COUNT +#endif // U_HIDE_DEPRECATED_API +} UDateAbsoluteUnit; + +/** + * Represents a direction for an absolute unit e.g "Next Tuesday" + * or "Last Tuesday" + * @stable ICU 53 + */ +typedef enum UDateDirection { + + /** + * Two before. Not fully supported in every locale. + * @stable ICU 53 + */ + UDAT_DIRECTION_LAST_2, + + /** + * Last + * @stable ICU 53 + */ + UDAT_DIRECTION_LAST, + + /** + * This + * @stable ICU 53 + */ + UDAT_DIRECTION_THIS, + + /** + * Next + * @stable ICU 53 + */ + UDAT_DIRECTION_NEXT, + + /** + * Two after. Not fully supported in every locale. + * @stable ICU 53 + */ + UDAT_DIRECTION_NEXT_2, + + /** + * Plain, which means the absence of a qualifier. + * @stable ICU 53 + */ + UDAT_DIRECTION_PLAIN, + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UDateDirection value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UDAT_DIRECTION_COUNT +#endif // U_HIDE_DEPRECATED_API +} UDateDirection; + +#if !UCONFIG_NO_BREAK_ITERATION + +U_NAMESPACE_BEGIN + +class BreakIterator; +class RelativeDateTimeCacheData; +class SharedNumberFormat; +class SharedPluralRules; +class SharedBreakIterator; +class NumberFormat; +class UnicodeString; + +/** + * Formats simple relative dates. There are two types of relative dates that + * it handles: + *

    + *
  • relative dates with a quantity e.g "in 5 days"
  • + *
  • relative dates without a quantity e.g "next Tuesday"
  • + *
+ *

+ * This API is very basic and is intended to be a building block for more + * fancy APIs. The caller tells it exactly what to display in a locale + * independent way. While this class automatically provides the correct plural + * forms, the grammatical form is otherwise as neutral as possible. It is the + * caller's responsibility to handle cut-off logic such as deciding between + * displaying "in 7 days" or "in 1 week." This API supports relative dates + * involving one single unit. This API does not support relative dates + * involving compound units, + * e.g "in 5 days and 4 hours" nor does it support parsing. + *

+ * This class is mostly thread safe and immutable with the following caveats: + * 1. The assignment operator violates Immutability. It must not be used + * concurrently with other operations. + * 2. Caller must not hold onto adopted pointers. + *

+ * This class is not intended for public subclassing. + *

+ * Here are some examples of use: + *

+ *
+ * UErrorCode status = U_ZERO_ERROR;
+ * UnicodeString appendTo;
+ * RelativeDateTimeFormatter fmt(status);
+ * // Appends "in 1 day"
+ * fmt.format(
+ *     1, UDAT_DIRECTION_NEXT, UDAT_RELATIVE_DAYS, appendTo, status);
+ * // Appends "in 3 days"
+ * fmt.format(
+ *     3, UDAT_DIRECTION_NEXT, UDAT_RELATIVE_DAYS, appendTo, status);
+ * // Appends "3.2 years ago"
+ * fmt.format(
+ *     3.2, UDAT_DIRECTION_LAST, UDAT_RELATIVE_YEARS, appendTo, status);
+ * // Appends "last Sunday"
+ * fmt.format(UDAT_DIRECTION_LAST, UDAT_ABSOLUTE_SUNDAY, appendTo, status);
+ * // Appends "this Sunday"
+ * fmt.format(UDAT_DIRECTION_THIS, UDAT_ABSOLUTE_SUNDAY, appendTo, status);
+ * // Appends "next Sunday"
+ * fmt.format(UDAT_DIRECTION_NEXT, UDAT_ABSOLUTE_SUNDAY, appendTo, status);
+ * // Appends "Sunday"
+ * fmt.format(UDAT_DIRECTION_PLAIN, UDAT_ABSOLUTE_SUNDAY, appendTo, status);
+ *
+ * // Appends "yesterday"
+ * fmt.format(UDAT_DIRECTION_LAST, UDAT_ABSOLUTE_DAY, appendTo, status);
+ * // Appends "today"
+ * fmt.format(UDAT_DIRECTION_THIS, UDAT_ABSOLUTE_DAY, appendTo, status);
+ * // Appends "tomorrow"
+ * fmt.format(UDAT_DIRECTION_NEXT, UDAT_ABSOLUTE_DAY, appendTo, status);
+ * // Appends "now"
+ * fmt.format(UDAT_DIRECTION_PLAIN, UDAT_ABSOLUTE_NOW, appendTo, status);
+ *
+ * 
+ *
+ *

+ * In the future, we may add more forms, such as abbreviated/short forms + * (3 secs ago), and relative day periods ("yesterday afternoon"), etc. + * + * The RelativeDateTimeFormatter class is not intended for public subclassing. + * + * @stable ICU 53 + */ +class U_I18N_API RelativeDateTimeFormatter : public UObject { +public: + + /** + * Create RelativeDateTimeFormatter with default locale. + * @stable ICU 53 + */ + RelativeDateTimeFormatter(UErrorCode& status); + + /** + * Create RelativeDateTimeFormatter with given locale. + * @stable ICU 53 + */ + RelativeDateTimeFormatter(const Locale& locale, UErrorCode& status); + + /** + * Create RelativeDateTimeFormatter with given locale and NumberFormat. + * + * @param locale the locale + * @param nfToAdopt Constructed object takes ownership of this pointer. + * It is an error for caller to delete this pointer or change its + * contents after calling this constructor. + * @status Any error is returned here. + * @stable ICU 53 + */ + RelativeDateTimeFormatter( + const Locale& locale, NumberFormat *nfToAdopt, UErrorCode& status); + + /** + * Create RelativeDateTimeFormatter with given locale, NumberFormat, + * and capitalization context. + * + * @param locale the locale + * @param nfToAdopt Constructed object takes ownership of this pointer. + * It is an error for caller to delete this pointer or change its + * contents after calling this constructor. Caller may pass NULL for + * this argument if they want default number format behavior. + * @param style the format style. The UDAT_RELATIVE bit field has no effect. + * @param capitalizationContext A value from UDisplayContext that pertains to + * capitalization. + * @status Any error is returned here. + * @stable ICU 54 + */ + RelativeDateTimeFormatter( + const Locale& locale, + NumberFormat *nfToAdopt, + UDateRelativeDateTimeFormatterStyle style, + UDisplayContext capitalizationContext, + UErrorCode& status); + + /** + * Copy constructor. + * @stable ICU 53 + */ + RelativeDateTimeFormatter(const RelativeDateTimeFormatter& other); + + /** + * Assignment operator. + * @stable ICU 53 + */ + RelativeDateTimeFormatter& operator=( + const RelativeDateTimeFormatter& other); + + /** + * Destructor. + * @stable ICU 53 + */ + virtual ~RelativeDateTimeFormatter(); + + /** + * Formats a relative date with a quantity such as "in 5 days" or + * "3 months ago" + * @param quantity The numerical amount e.g 5. This value is formatted + * according to this object's NumberFormat object. + * @param direction NEXT means a future relative date; LAST means a past + * relative date. If direction is anything else, this method sets + * status to U_ILLEGAL_ARGUMENT_ERROR. + * @param unit the unit e.g day? month? year? + * @param appendTo The string to which the formatted result will be + * appended + * @param status ICU error code returned here. + * @return appendTo + * @stable ICU 53 + */ + UnicodeString& format( + double quantity, + UDateDirection direction, + UDateRelativeUnit unit, + UnicodeString& appendTo, + UErrorCode& status) const; + + /** + * Formats a relative date without a quantity. + * @param direction NEXT, LAST, THIS, etc. + * @param unit e.g SATURDAY, DAY, MONTH + * @param appendTo The string to which the formatted result will be + * appended. If the value of direction is documented as not being fully + * supported in all locales then this method leaves appendTo unchanged if + * no format string is available. + * @param status ICU error code returned here. + * @return appendTo + * @stable ICU 53 + */ + UnicodeString& format( + UDateDirection direction, + UDateAbsoluteUnit unit, + UnicodeString& appendTo, + UErrorCode& status) const; + + /** + * Format a combination of URelativeDateTimeUnit and numeric offset + * using a numeric style, e.g. "1 week ago", "in 1 week", + * "5 weeks ago", "in 5 weeks". + * + * @param offset The signed offset for the specified unit. This + * will be formatted according to this object's + * NumberFormat object. + * @param unit The unit to use when formatting the relative + * date, e.g. UDAT_REL_UNIT_WEEK, + * UDAT_REL_UNIT_FRIDAY. + * @param appendTo The string to which the formatted result will be + * appended. + * @param status ICU error code returned here. + * @return appendTo + * @stable ICU 57 + */ + UnicodeString& formatNumeric( + double offset, + URelativeDateTimeUnit unit, + UnicodeString& appendTo, + UErrorCode& status) const; + + /** + * Format a combination of URelativeDateTimeUnit and numeric offset + * using a text style if possible, e.g. "last week", "this week", + * "next week", "yesterday", "tomorrow". Falls back to numeric + * style if no appropriate text term is available for the specified + * offset in the object's locale. + * + * @param offset The signed offset for the specified unit. + * @param unit The unit to use when formatting the relative + * date, e.g. UDAT_REL_UNIT_WEEK, + * UDAT_REL_UNIT_FRIDAY. + * @param appendTo The string to which the formatted result will be + * appended. + * @param status ICU error code returned here. + * @return appendTo + * @stable ICU 57 + */ + UnicodeString& format( + double offset, + URelativeDateTimeUnit unit, + UnicodeString& appendTo, + UErrorCode& status) const; + + /** + * Combines a relative date string and a time string in this object's + * locale. This is done with the same date-time separator used for the + * default calendar in this locale. + * + * @param relativeDateString the relative date, e.g 'yesterday' + * @param timeString the time e.g '3:45' + * @param appendTo concatenated date and time appended here + * @param status ICU error code returned here. + * @return appendTo + * @stable ICU 53 + */ + UnicodeString& combineDateAndTime( + const UnicodeString& relativeDateString, + const UnicodeString& timeString, + UnicodeString& appendTo, + UErrorCode& status) const; + + /** + * Returns the NumberFormat this object is using. + * + * @stable ICU 53 + */ + const NumberFormat& getNumberFormat() const; + + /** + * Returns the capitalization context. + * + * @stable ICU 54 + */ + UDisplayContext getCapitalizationContext() const; + + /** + * Returns the format style. + * + * @stable ICU 54 + */ + UDateRelativeDateTimeFormatterStyle getFormatStyle() const; + +private: + const RelativeDateTimeCacheData* fCache; + const SharedNumberFormat *fNumberFormat; + const SharedPluralRules *fPluralRules; + UDateRelativeDateTimeFormatterStyle fStyle; + UDisplayContext fContext; + const SharedBreakIterator *fOptBreakIterator; + Locale fLocale; + void init( + NumberFormat *nfToAdopt, + BreakIterator *brkIter, + UErrorCode &status); + void adjustForContext(UnicodeString &) const; +}; + +U_NAMESPACE_END + +#endif /* !UCONFIG_NO_BREAK_ITERATION */ +#endif /* !UCONFIG_NO_FORMATTING */ +#endif /* __RELDATEFMT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/rep.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/rep.h new file mode 100644 index 0000000..41fdc04 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/rep.h @@ -0,0 +1,263 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +************************************************************************** +* Copyright (C) 1999-2012, International Business Machines Corporation and +* others. All Rights Reserved. +************************************************************************** +* Date Name Description +* 11/17/99 aliu Creation. Ported from java. Modified to +* match current UnicodeString API. Forced +* to use name "handleReplaceBetween" because +* of existing methods in UnicodeString. +************************************************************************** +*/ + +#ifndef REP_H +#define REP_H + +#include "unicode/uobject.h" + +/** + * \file + * \brief C++ API: Replaceable String + */ + +U_NAMESPACE_BEGIN + +class UnicodeString; + +/** + * Replaceable is an abstract base class representing a + * string of characters that supports the replacement of a range of + * itself with a new string of characters. It is used by APIs that + * change a piece of text while retaining metadata. Metadata is data + * other than the Unicode characters returned by char32At(). One + * example of metadata is style attributes; another is an edit + * history, marking each character with an author and revision number. + * + *

An implicit aspect of the Replaceable API is that + * during a replace operation, new characters take on the metadata of + * the old characters. For example, if the string "the bold + * font" has range (4, 8) replaced with "strong", then it becomes "the + * strong font". + * + *

Replaceable specifies ranges using a start + * offset and a limit offset. The range of characters thus specified + * includes the characters at offset start..limit-1. That is, the + * start offset is inclusive, and the limit offset is exclusive. + * + *

Replaceable also includes API to access characters + * in the string: length(), charAt(), + * char32At(), and extractBetween(). + * + *

For a subclass to support metadata, typical behavior of + * replace() is the following: + *

    + *
  • Set the metadata of the new text to the metadata of the first + * character replaced
  • + *
  • If no characters are replaced, use the metadata of the + * previous character
  • + *
  • If there is no previous character (i.e. start == 0), use the + * following character
  • + *
  • If there is no following character (i.e. the replaceable was + * empty), use default metadata.
    + *
  • If the code point U+FFFF is seen, it should be interpreted as + * a special marker having no metadata
  • + *
  • + *
+ * If this is not the behavior, the subclass should document any differences. + * @author Alan Liu + * @stable ICU 2.0 + */ +class U_COMMON_API Replaceable : public UObject { + +public: + /** + * Destructor. + * @stable ICU 2.0 + */ + virtual ~Replaceable(); + + /** + * Returns the number of 16-bit code units in the text. + * @return number of 16-bit code units in text + * @stable ICU 1.8 + */ + inline int32_t length() const; + + /** + * Returns the 16-bit code unit at the given offset into the text. + * @param offset an integer between 0 and length()-1 + * inclusive + * @return 16-bit code unit of text at given offset + * @stable ICU 1.8 + */ + inline char16_t charAt(int32_t offset) const; + + /** + * Returns the 32-bit code point at the given 16-bit offset into + * the text. This assumes the text is stored as 16-bit code units + * with surrogate pairs intermixed. If the offset of a leading or + * trailing code unit of a surrogate pair is given, return the + * code point of the surrogate pair. + * + * @param offset an integer between 0 and length()-1 + * inclusive + * @return 32-bit code point of text at given offset + * @stable ICU 1.8 + */ + inline UChar32 char32At(int32_t offset) const; + + /** + * Copies characters in the range [start, limit) + * into the UnicodeString target. + * @param start offset of first character which will be copied + * @param limit offset immediately following the last character to + * be copied + * @param target UnicodeString into which to copy characters. + * @return A reference to target + * @stable ICU 2.1 + */ + virtual void extractBetween(int32_t start, + int32_t limit, + UnicodeString& target) const = 0; + + /** + * Replaces a substring of this object with the given text. If the + * characters being replaced have metadata, the new characters + * that replace them should be given the same metadata. + * + *

Subclasses must ensure that if the text between start and + * limit is equal to the replacement text, that replace has no + * effect. That is, any metadata + * should be unaffected. In addition, subclasses are encouraged to + * check for initial and trailing identical characters, and make a + * smaller replacement if possible. This will preserve as much + * metadata as possible. + * @param start the beginning index, inclusive; 0 <= start + * <= limit. + * @param limit the ending index, exclusive; start <= limit + * <= length(). + * @param text the text to replace characters start + * to limit - 1 + * @stable ICU 2.0 + */ + virtual void handleReplaceBetween(int32_t start, + int32_t limit, + const UnicodeString& text) = 0; + // Note: All other methods in this class take the names of + // existing UnicodeString methods. This method is the exception. + // It is named differently because all replace methods of + // UnicodeString return a UnicodeString&. The 'between' is + // required in order to conform to the UnicodeString naming + // convention; API taking start/length are named , and + // those taking start/limit are named . The + // 'handle' is added because 'replaceBetween' and + // 'doReplaceBetween' are already taken. + + /** + * Copies a substring of this object, retaining metadata. + * This method is used to duplicate or reorder substrings. + * The destination index must not overlap the source range. + * + * @param start the beginning index, inclusive; 0 <= start <= + * limit. + * @param limit the ending index, exclusive; start <= limit <= + * length(). + * @param dest the destination index. The characters from + * start..limit-1 will be copied to dest. + * Implementations of this method may assume that dest <= start || + * dest >= limit. + * @stable ICU 2.0 + */ + virtual void copy(int32_t start, int32_t limit, int32_t dest) = 0; + + /** + * Returns true if this object contains metadata. If a + * Replaceable object has metadata, calls to the Replaceable API + * must be made so as to preserve metadata. If it does not, calls + * to the Replaceable API may be optimized to improve performance. + * The default implementation returns true. + * @return true if this object contains metadata + * @stable ICU 2.2 + */ + virtual UBool hasMetaData() const; + + /** + * Clone this object, an instance of a subclass of Replaceable. + * Clones can be used concurrently in multiple threads. + * If a subclass does not implement clone(), or if an error occurs, + * then NULL is returned. + * The clone functions in all subclasses return a pointer to a Replaceable + * because some compilers do not support covariant (same-as-this) + * return types; cast to the appropriate subclass if necessary. + * The caller must delete the clone. + * + * @return a clone of this object + * + * @see getDynamicClassID + * @stable ICU 2.6 + */ + virtual Replaceable *clone() const; + +protected: + + /** + * Default constructor. + * @stable ICU 2.4 + */ + inline Replaceable(); + + /* + * Assignment operator not declared. The compiler will provide one + * which does nothing since this class does not contain any data members. + * API/code coverage may show the assignment operator as present and + * untested - ignore. + * Subclasses need this assignment operator if they use compiler-provided + * assignment operators of their own. An alternative to not declaring one + * here would be to declare and empty-implement a protected or public one. + Replaceable &Replaceable::operator=(const Replaceable &); + */ + + /** + * Virtual version of length(). + * @stable ICU 2.4 + */ + virtual int32_t getLength() const = 0; + + /** + * Virtual version of charAt(). + * @stable ICU 2.4 + */ + virtual char16_t getCharAt(int32_t offset) const = 0; + + /** + * Virtual version of char32At(). + * @stable ICU 2.4 + */ + virtual UChar32 getChar32At(int32_t offset) const = 0; +}; + +inline Replaceable::Replaceable() {} + +inline int32_t +Replaceable::length() const { + return getLength(); +} + +inline char16_t +Replaceable::charAt(int32_t offset) const { + return getCharAt(offset); +} + +inline UChar32 +Replaceable::char32At(int32_t offset) const { + return getChar32At(offset); +} + +// There is no rep.cpp, see unistr.cpp for Replaceable function implementations. + +U_NAMESPACE_END + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/resbund.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/resbund.h new file mode 100644 index 0000000..b522a7a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/resbund.h @@ -0,0 +1,492 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1996-2013, International Business Machines Corporation +* and others. All Rights Reserved. +* +****************************************************************************** +* +* File resbund.h +* +* CREATED BY +* Richard Gillam +* +* Modification History: +* +* Date Name Description +* 2/5/97 aliu Added scanForLocaleInFile. Added +* constructor which attempts to read resource bundle +* from a specific file, without searching other files. +* 2/11/97 aliu Added UErrorCode return values to constructors. Fixed +* infinite loops in scanForFile and scanForLocale. +* Modified getRawResourceData to not delete storage +* in localeData and resourceData which it doesn't own. +* Added Mac compatibility #ifdefs for tellp() and +* ios::nocreate. +* 2/18/97 helena Updated with 100% documentation coverage. +* 3/13/97 aliu Rewrote to load in entire resource bundle and store +* it as a Hashtable of ResourceBundleData objects. +* Added state table to govern parsing of files. +* Modified to load locale index out of new file +* distinct from default.txt. +* 3/25/97 aliu Modified to support 2-d arrays, needed for timezone +* data. Added support for custom file suffixes. Again, +* needed to support timezone data. +* 4/7/97 aliu Cleaned up. +* 03/02/99 stephen Removed dependency on FILE*. +* 03/29/99 helena Merged Bertrand and Stephen's changes. +* 06/11/99 stephen Removed parsing of .txt files. +* Reworked to use new binary format. +* Cleaned up. +* 06/14/99 stephen Removed methods taking a filename suffix. +* 11/09/99 weiv Added getLocale(), fRealLocale, removed fRealLocaleID +****************************************************************************** +*/ + +#ifndef RESBUND_H +#define RESBUND_H + +#include "unicode/utypes.h" +#include "unicode/uobject.h" +#include "unicode/ures.h" +#include "unicode/unistr.h" +#include "unicode/locid.h" + +/** + * \file + * \brief C++ API: Resource Bundle + */ + +U_NAMESPACE_BEGIN + +/** + * A class representing a collection of resource information pertaining to a given + * locale. A resource bundle provides a way of accessing locale- specfic information in + * a data file. You create a resource bundle that manages the resources for a given + * locale and then ask it for individual resources. + *

+ * Resource bundles in ICU4C are currently defined using text files which conform to the following + * BNF definition. + * More on resource bundle concepts and syntax can be found in the + * Users Guide. + *

+ * + * The ResourceBundle class is not suitable for subclassing. + * + * @stable ICU 2.0 + */ +class U_COMMON_API ResourceBundle : public UObject { +public: + /** + * Constructor + * + * @param packageName The packageName and locale together point to an ICU udata object, + * as defined by udata_open( packageName, "res", locale, err) + * or equivalent. Typically, packageName will refer to a (.dat) file, or to + * a package registered with udata_setAppData(). Using a full file or directory + * pathname for packageName is deprecated. + * @param locale This is the locale this resource bundle is for. To get resources + * for the French locale, for example, you would create a + * ResourceBundle passing Locale::FRENCH for the "locale" parameter, + * and all subsequent calls to that resource bundle will return + * resources that pertain to the French locale. If the caller doesn't + * pass a locale parameter, the default locale for the system (as + * returned by Locale::getDefault()) will be used. + * @param err The Error Code. + * The UErrorCode& err parameter is used to return status information to the user. To + * check whether the construction succeeded or not, you should check the value of + * U_SUCCESS(err). If you wish more detailed information, you can check for + * informational error results which still indicate success. U_USING_FALLBACK_WARNING + * indicates that a fall back locale was used. For example, 'de_CH' was requested, + * but nothing was found there, so 'de' was used. U_USING_DEFAULT_WARNING indicates that + * the default locale data was used; neither the requested locale nor any of its + * fall back locales could be found. + * @stable ICU 2.0 + */ + ResourceBundle(const UnicodeString& packageName, + const Locale& locale, + UErrorCode& err); + + /** + * Construct a resource bundle for the default bundle in the specified package. + * + * @param packageName The packageName and locale together point to an ICU udata object, + * as defined by udata_open( packageName, "res", locale, err) + * or equivalent. Typically, packageName will refer to a (.dat) file, or to + * a package registered with udata_setAppData(). Using a full file or directory + * pathname for packageName is deprecated. + * @param err A UErrorCode value + * @stable ICU 2.0 + */ + ResourceBundle(const UnicodeString& packageName, + UErrorCode& err); + + /** + * Construct a resource bundle for the ICU default bundle. + * + * @param err A UErrorCode value + * @stable ICU 2.0 + */ + ResourceBundle(UErrorCode &err); + + /** + * Standard constructor, onstructs a resource bundle for the locale-specific + * bundle in the specified package. + * + * @param packageName The packageName and locale together point to an ICU udata object, + * as defined by udata_open( packageName, "res", locale, err) + * or equivalent. Typically, packageName will refer to a (.dat) file, or to + * a package registered with udata_setAppData(). Using a full file or directory + * pathname for packageName is deprecated. + * NULL is used to refer to ICU data. + * @param locale The locale for which to open a resource bundle. + * @param err A UErrorCode value + * @stable ICU 2.0 + */ + ResourceBundle(const char* packageName, + const Locale& locale, + UErrorCode& err); + + /** + * Copy constructor. + * + * @param original The resource bundle to copy. + * @stable ICU 2.0 + */ + ResourceBundle(const ResourceBundle &original); + + /** + * Constructor from a C UResourceBundle. The resource bundle is + * copied and not adopted. ures_close will still need to be used on the + * original resource bundle. + * + * @param res A pointer to the C resource bundle. + * @param status A UErrorCode value. + * @stable ICU 2.0 + */ + ResourceBundle(UResourceBundle *res, + UErrorCode &status); + + /** + * Assignment operator. + * + * @param other The resource bundle to copy. + * @stable ICU 2.0 + */ + ResourceBundle& + operator=(const ResourceBundle& other); + + /** Destructor. + * @stable ICU 2.0 + */ + virtual ~ResourceBundle(); + + /** + * Clone this object. + * Clones can be used concurrently in multiple threads. + * If an error occurs, then NULL is returned. + * The caller must delete the clone. + * + * @return a clone of this object + * + * @see getDynamicClassID + * @stable ICU 2.8 + */ + ResourceBundle *clone() const; + + /** + * Returns the size of a resource. Size for scalar types is always 1, and for vector/table types is + * the number of child resources. + * @warning Integer array is treated as a scalar type. There are no + * APIs to access individual members of an integer array. It + * is always returned as a whole. + * + * @return number of resources in a given resource. + * @stable ICU 2.0 + */ + int32_t + getSize(void) const; + + /** + * returns a string from a string resource type + * + * @param status fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * could be a warning + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return a pointer to a zero-terminated char16_t array which lives in a memory mapped/DLL file. + * @stable ICU 2.0 + */ + UnicodeString + getString(UErrorCode& status) const; + + /** + * returns a binary data from a resource. Can be used at most primitive resource types (binaries, + * strings, ints) + * + * @param len fills in the length of resulting byte chunk + * @param status fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * could be a warning + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return a pointer to a chunk of unsigned bytes which live in a memory mapped/DLL file. + * @stable ICU 2.0 + */ + const uint8_t* + getBinary(int32_t& len, UErrorCode& status) const; + + + /** + * returns an integer vector from a resource. + * + * @param len fills in the length of resulting integer vector + * @param status fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * could be a warning + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return a pointer to a vector of integers that lives in a memory mapped/DLL file. + * @stable ICU 2.0 + */ + const int32_t* + getIntVector(int32_t& len, UErrorCode& status) const; + + /** + * returns an unsigned integer from a resource. + * This integer is originally 28 bits. + * + * @param status fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * could be a warning + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return an unsigned integer value + * @stable ICU 2.0 + */ + uint32_t + getUInt(UErrorCode& status) const; + + /** + * returns a signed integer from a resource. + * This integer is originally 28 bit and the sign gets propagated. + * + * @param status fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * could be a warning + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return a signed integer value + * @stable ICU 2.0 + */ + int32_t + getInt(UErrorCode& status) const; + + /** + * Checks whether the resource has another element to iterate over. + * + * @return TRUE if there are more elements, FALSE if there is no more elements + * @stable ICU 2.0 + */ + UBool + hasNext(void) const; + + /** + * Resets the internal context of a resource so that iteration starts from the first element. + * + * @stable ICU 2.0 + */ + void + resetIterator(void); + + /** + * Returns the key associated with this resource. Not all the resources have a key - only + * those that are members of a table. + * + * @return a key associated to this resource, or NULL if it doesn't have a key + * @stable ICU 2.0 + */ + const char* + getKey(void) const; + + /** + * Gets the locale ID of the resource bundle as a string. + * Same as getLocale().getName() . + * + * @return the locale ID of the resource bundle as a string + * @stable ICU 2.0 + */ + const char* + getName(void) const; + + + /** + * Returns the type of a resource. Available types are defined in enum UResType + * + * @return type of the given resource. + * @stable ICU 2.0 + */ + UResType + getType(void) const; + + /** + * Returns the next resource in a given resource or NULL if there are no more resources + * + * @param status fills in the outgoing error code + * @return ResourceBundle object. + * @stable ICU 2.0 + */ + ResourceBundle + getNext(UErrorCode& status); + + /** + * Returns the next string in a resource or NULL if there are no more resources + * to iterate over. + * + * @param status fills in the outgoing error code + * @return an UnicodeString object. + * @stable ICU 2.0 + */ + UnicodeString + getNextString(UErrorCode& status); + + /** + * Returns the next string in a resource or NULL if there are no more resources + * to iterate over. + * + * @param key fill in for key associated with this string + * @param status fills in the outgoing error code + * @return an UnicodeString object. + * @stable ICU 2.0 + */ + UnicodeString + getNextString(const char ** key, + UErrorCode& status); + + /** + * Returns the resource in a resource at the specified index. + * + * @param index an index to the wanted resource. + * @param status fills in the outgoing error code + * @return ResourceBundle object. If there is an error, resource is invalid. + * @stable ICU 2.0 + */ + ResourceBundle + get(int32_t index, + UErrorCode& status) const; + + /** + * Returns the string in a given resource at the specified index. + * + * @param index an index to the wanted string. + * @param status fills in the outgoing error code + * @return an UnicodeString object. If there is an error, string is bogus + * @stable ICU 2.0 + */ + UnicodeString + getStringEx(int32_t index, + UErrorCode& status) const; + + /** + * Returns a resource in a resource that has a given key. This procedure works only with table + * resources. + * + * @param key a key associated with the wanted resource + * @param status fills in the outgoing error code. + * @return ResourceBundle object. If there is an error, resource is invalid. + * @stable ICU 2.0 + */ + ResourceBundle + get(const char* key, + UErrorCode& status) const; + + /** + * Returns a string in a resource that has a given key. This procedure works only with table + * resources. + * + * @param key a key associated with the wanted string + * @param status fills in the outgoing error code + * @return an UnicodeString object. If there is an error, string is bogus + * @stable ICU 2.0 + */ + UnicodeString + getStringEx(const char* key, + UErrorCode& status) const; + +#ifndef U_HIDE_DEPRECATED_API + /** + * Return the version number associated with this ResourceBundle as a string. Please + * use getVersion, as this method is going to be deprecated. + * + * @return A version number string as specified in the resource bundle or its parent. + * The caller does not own this string. + * @see getVersion + * @deprecated ICU 2.8 Use getVersion instead. + */ + const char* + getVersionNumber(void) const; +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Return the version number associated with this ResourceBundle as a UVersionInfo array. + * + * @param versionInfo A UVersionInfo array that is filled with the version number + * as specified in the resource bundle or its parent. + * @stable ICU 2.0 + */ + void + getVersion(UVersionInfo versionInfo) const; + +#ifndef U_HIDE_DEPRECATED_API + /** + * Return the Locale associated with this ResourceBundle. + * + * @return a Locale object + * @deprecated ICU 2.8 Use getLocale(ULocDataLocaleType type, UErrorCode &status) overload instead. + */ + const Locale& + getLocale(void) const; +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Return the Locale associated with this ResourceBundle. + * @param type You can choose between requested, valid and actual + * locale. For description see the definition of + * ULocDataLocaleType in uloc.h + * @param status just for catching illegal arguments + * + * @return a Locale object + * @stable ICU 2.8 + */ + const Locale + getLocale(ULocDataLocaleType type, UErrorCode &status) const; +#ifndef U_HIDE_INTERNAL_API + /** + * This API implements multilevel fallback + * @internal + */ + ResourceBundle + getWithFallback(const char* key, UErrorCode& status); +#endif /* U_HIDE_INTERNAL_API */ + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.2 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.2 + */ + static UClassID U_EXPORT2 getStaticClassID(); + +private: + ResourceBundle(); // default constructor not implemented + + UResourceBundle *fResource; + void constructForLocale(const UnicodeString& path, const Locale& locale, UErrorCode& error); + Locale *fLocale; +}; + +U_NAMESPACE_END +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/schriter.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/schriter.h new file mode 100644 index 0000000..b1dc939 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/schriter.h @@ -0,0 +1,189 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1998-2005, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* +* File schriter.h +* +* Modification History: +* +* Date Name Description +* 05/05/99 stephen Cleaned up. +****************************************************************************** +*/ + +#ifndef SCHRITER_H +#define SCHRITER_H + +#include "unicode/utypes.h" +#include "unicode/chariter.h" +#include "unicode/uchriter.h" + +/** + * \file + * \brief C++ API: String Character Iterator + */ + +U_NAMESPACE_BEGIN +/** + * A concrete subclass of CharacterIterator that iterates over the + * characters (code units or code points) in a UnicodeString. + * It's possible not only to create an + * iterator that iterates over an entire UnicodeString, but also to + * create one that iterates over only a subrange of a UnicodeString + * (iterators over different subranges of the same UnicodeString don't + * compare equal). + * @see CharacterIterator + * @see ForwardCharacterIterator + * @stable ICU 2.0 + */ +class U_COMMON_API StringCharacterIterator : public UCharCharacterIterator { +public: + /** + * Create an iterator over the UnicodeString referred to by "textStr". + * The UnicodeString object is copied. + * The iteration range is the whole string, and the starting position is 0. + * @param textStr The unicode string used to create an iterator + * @stable ICU 2.0 + */ + StringCharacterIterator(const UnicodeString& textStr); + + /** + * Create an iterator over the UnicodeString referred to by "textStr". + * The iteration range is the whole string, and the starting + * position is specified by "textPos". If "textPos" is outside the valid + * iteration range, the behavior of this object is undefined. + * @param textStr The unicode string used to create an iterator + * @param textPos The starting position of the iteration + * @stable ICU 2.0 + */ + StringCharacterIterator(const UnicodeString& textStr, + int32_t textPos); + + /** + * Create an iterator over the UnicodeString referred to by "textStr". + * The UnicodeString object is copied. + * The iteration range begins with the code unit specified by + * "textBegin" and ends with the code unit BEFORE the code unit specfied + * by "textEnd". The starting position is specified by "textPos". If + * "textBegin" and "textEnd" don't form a valid range on "text" (i.e., + * textBegin >= textEnd or either is negative or greater than text.size()), + * or "textPos" is outside the range defined by "textBegin" and "textEnd", + * the behavior of this iterator is undefined. + * @param textStr The unicode string used to create the StringCharacterIterator + * @param textBegin The begin position of the iteration range + * @param textEnd The end position of the iteration range + * @param textPos The starting position of the iteration + * @stable ICU 2.0 + */ + StringCharacterIterator(const UnicodeString& textStr, + int32_t textBegin, + int32_t textEnd, + int32_t textPos); + + /** + * Copy constructor. The new iterator iterates over the same range + * of the same string as "that", and its initial position is the + * same as "that"'s current position. + * The UnicodeString object in "that" is copied. + * @param that The StringCharacterIterator to be copied + * @stable ICU 2.0 + */ + StringCharacterIterator(const StringCharacterIterator& that); + + /** + * Destructor. + * @stable ICU 2.0 + */ + virtual ~StringCharacterIterator(); + + /** + * Assignment operator. *this is altered to iterate over the same + * range of the same string as "that", and refers to the same + * character within that string as "that" does. + * @param that The object to be copied. + * @return the newly created object. + * @stable ICU 2.0 + */ + StringCharacterIterator& + operator=(const StringCharacterIterator& that); + + /** + * Returns true if the iterators iterate over the same range of the + * same string and are pointing at the same character. + * @param that The ForwardCharacterIterator to be compared for equality + * @return true if the iterators iterate over the same range of the + * same string and are pointing at the same character. + * @stable ICU 2.0 + */ + virtual UBool operator==(const ForwardCharacterIterator& that) const; + + /** + * Returns a new StringCharacterIterator referring to the same + * character in the same range of the same string as this one. The + * caller must delete the new iterator. + * @return the newly cloned object. + * @stable ICU 2.0 + */ + virtual CharacterIterator* clone(void) const; + + /** + * Sets the iterator to iterate over the provided string. + * @param newText The string to be iterated over + * @stable ICU 2.0 + */ + void setText(const UnicodeString& newText); + + /** + * Copies the UnicodeString under iteration into the UnicodeString + * referred to by "result". Even if this iterator iterates across + * only a part of this string, the whole string is copied. + * @param result Receives a copy of the text under iteration. + * @stable ICU 2.0 + */ + virtual void getText(UnicodeString& result); + + /** + * Return a class ID for this object (not really public) + * @return a class ID for this object. + * @stable ICU 2.0 + */ + virtual UClassID getDynamicClassID(void) const; + + /** + * Return a class ID for this class (not really public) + * @return a class ID for this class + * @stable ICU 2.0 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + +protected: + /** + * Default constructor, iteration over empty string. + * @stable ICU 2.0 + */ + StringCharacterIterator(); + + /** + * Sets the iterator to iterate over the provided string. + * @param newText The string to be iterated over + * @param newTextLength The length of the String + * @stable ICU 2.0 + */ + void setText(const char16_t* newText, int32_t newTextLength); + + /** + * Copy of the iterated string object. + * @stable ICU 2.0 + */ + UnicodeString text; + +}; + +U_NAMESPACE_END +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/scientificnumberformatter.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/scientificnumberformatter.h new file mode 100644 index 0000000..15023d5 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/scientificnumberformatter.h @@ -0,0 +1,222 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2014-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +*/ +#ifndef SCINUMBERFORMATTER_H +#define SCINUMBERFORMATTER_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + + +#include "unicode/unistr.h" + +/** + * \file + * \brief C++ API: Formats in scientific notation. + */ + +U_NAMESPACE_BEGIN + +class FieldPositionIterator; +class DecimalFormatStaticSets; +class DecimalFormatSymbols; +class DecimalFormat; +class Formattable; + +/** + * A formatter that formats numbers in user-friendly scientific notation. + * + * Sample code: + *

+ * UErrorCode status = U_ZERO_ERROR;
+ * LocalPointer fmt(
+ *         ScientificNumberFormatter::createMarkupInstance(
+ *                 "en", "", "", status));
+ * if (U_FAILURE(status)) {
+ *     return;
+ * }
+ * UnicodeString appendTo;
+ * // appendTo = "1.23456x10-78"
+ * fmt->format(1.23456e-78, appendTo, status);
+ * 
+ * + * @stable ICU 55 + */ +class U_I18N_API ScientificNumberFormatter : public UObject { +public: + + /** + * Creates a ScientificNumberFormatter instance that uses + * superscript characters for exponents. + * @param fmtToAdopt The DecimalFormat which must be configured for + * scientific notation. + * @param status error returned here. + * @return The new ScientificNumberFormatter instance. + * + * @stable ICU 55 + */ + static ScientificNumberFormatter *createSuperscriptInstance( + DecimalFormat *fmtToAdopt, UErrorCode &status); + + /** + * Creates a ScientificNumberFormatter instance that uses + * superscript characters for exponents for this locale. + * @param locale The locale + * @param status error returned here. + * @return The ScientificNumberFormatter instance. + * + * @stable ICU 55 + */ + static ScientificNumberFormatter *createSuperscriptInstance( + const Locale &locale, UErrorCode &status); + + + /** + * Creates a ScientificNumberFormatter instance that uses + * markup for exponents. + * @param fmtToAdopt The DecimalFormat which must be configured for + * scientific notation. + * @param beginMarkup the markup to start superscript. + * @param endMarkup the markup to end superscript. + * @param status error returned here. + * @return The new ScientificNumberFormatter instance. + * + * @stable ICU 55 + */ + static ScientificNumberFormatter *createMarkupInstance( + DecimalFormat *fmtToAdopt, + const UnicodeString &beginMarkup, + const UnicodeString &endMarkup, + UErrorCode &status); + + /** + * Creates a ScientificNumberFormatter instance that uses + * markup for exponents for this locale. + * @param locale The locale + * @param beginMarkup the markup to start superscript. + * @param endMarkup the markup to end superscript. + * @param status error returned here. + * @return The ScientificNumberFormatter instance. + * + * @stable ICU 55 + */ + static ScientificNumberFormatter *createMarkupInstance( + const Locale &locale, + const UnicodeString &beginMarkup, + const UnicodeString &endMarkup, + UErrorCode &status); + + + /** + * Returns a copy of this object. Caller must free returned copy. + * @stable ICU 55 + */ + ScientificNumberFormatter *clone() const { + return new ScientificNumberFormatter(*this); + } + + /** + * Destructor. + * @stable ICU 55 + */ + virtual ~ScientificNumberFormatter(); + + /** + * Formats a number into user friendly scientific notation. + * + * @param number the number to format. + * @param appendTo formatted string appended here. + * @param status any error returned here. + * @return appendTo + * + * @stable ICU 55 + */ + UnicodeString &format( + const Formattable &number, + UnicodeString &appendTo, + UErrorCode &status) const; + private: + class U_I18N_API Style : public UObject { + public: + virtual Style *clone() const = 0; + protected: + virtual UnicodeString &format( + const UnicodeString &original, + FieldPositionIterator &fpi, + const UnicodeString &preExponent, + const DecimalFormatStaticSets &decimalFormatSets, + UnicodeString &appendTo, + UErrorCode &status) const = 0; + private: + friend class ScientificNumberFormatter; + }; + + class U_I18N_API SuperscriptStyle : public Style { + public: + virtual Style *clone() const; + protected: + virtual UnicodeString &format( + const UnicodeString &original, + FieldPositionIterator &fpi, + const UnicodeString &preExponent, + const DecimalFormatStaticSets &decimalFormatSets, + UnicodeString &appendTo, + UErrorCode &status) const; + }; + + class U_I18N_API MarkupStyle : public Style { + public: + MarkupStyle( + const UnicodeString &beginMarkup, + const UnicodeString &endMarkup) + : Style(), + fBeginMarkup(beginMarkup), + fEndMarkup(endMarkup) { } + virtual Style *clone() const; + protected: + virtual UnicodeString &format( + const UnicodeString &original, + FieldPositionIterator &fpi, + const UnicodeString &preExponent, + const DecimalFormatStaticSets &decimalFormatSets, + UnicodeString &appendTo, + UErrorCode &status) const; + private: + UnicodeString fBeginMarkup; + UnicodeString fEndMarkup; + }; + + ScientificNumberFormatter( + DecimalFormat *fmtToAdopt, + Style *styleToAdopt, + UErrorCode &status); + + ScientificNumberFormatter(const ScientificNumberFormatter &other); + ScientificNumberFormatter &operator=(const ScientificNumberFormatter &); + + static void getPreExponent( + const DecimalFormatSymbols &dfs, UnicodeString &preExponent); + + static ScientificNumberFormatter *createInstance( + DecimalFormat *fmtToAdopt, + Style *styleToAdopt, + UErrorCode &status); + + UnicodeString fPreExponent; + DecimalFormat *fDecimalFormat; + Style *fStyle; + const DecimalFormatStaticSets *fStaticSets; + +}; + +U_NAMESPACE_END + + +#endif /* !UCONFIG_NO_FORMATTING */ +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/search.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/search.h new file mode 100644 index 0000000..65f7f10 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/search.h @@ -0,0 +1,577 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 2001-2011 IBM and others. All rights reserved. +********************************************************************** +* Date Name Description +* 03/22/2000 helena Creation. +********************************************************************** +*/ + +#ifndef SEARCH_H +#define SEARCH_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: SearchIterator object. + */ + +#if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION + +#include "unicode/uobject.h" +#include "unicode/unistr.h" +#include "unicode/chariter.h" +#include "unicode/brkiter.h" +#include "unicode/usearch.h" + +/** +* @stable ICU 2.0 +*/ +struct USearch; +/** +* @stable ICU 2.0 +*/ +typedef struct USearch USearch; + +U_NAMESPACE_BEGIN + +/** + * + * SearchIterator is an abstract base class that provides + * methods to search for a pattern within a text string. Instances of + * SearchIterator maintain a current position and scans over the + * target text, returning the indices the pattern is matched and the length + * of each match. + *

+ * SearchIterator defines a protocol for text searching. + * Subclasses provide concrete implementations of various search algorithms. + * For example, StringSearch implements language-sensitive pattern + * matching based on the comparison rules defined in a + * RuleBasedCollator object. + *

+ * Other options for searching includes using a BreakIterator to restrict + * the points at which matches are detected. + *

+ * SearchIterator provides an API that is similar to that of + * other text iteration classes such as BreakIterator. Using + * this class, it is easy to scan through text looking for all occurances of + * a given pattern. The following example uses a StringSearch + * object to find all instances of "fox" in the target string. Any other + * subclass of SearchIterator can be used in an identical + * manner. + *


+ * UnicodeString target("The quick brown fox jumped over the lazy fox");
+ * UnicodeString pattern("fox");
+ *
+ * SearchIterator *iter  = new StringSearch(pattern, target);
+ * UErrorCode      error = U_ZERO_ERROR;
+ * for (int pos = iter->first(error); pos != USEARCH_DONE; 
+ *                               pos = iter->next(error)) {
+ *     printf("Found match at %d pos, length is %d\n", pos, 
+ *                                             iter.getMatchLength());
+ * }
+ * 
+ * + * @see StringSearch + * @see RuleBasedCollator + */ +class U_I18N_API SearchIterator : public UObject { + +public: + + // public constructors and destructors ------------------------------- + + /** + * Copy constructor that creates a SearchIterator instance with the same + * behavior, and iterating over the same text. + * @param other the SearchIterator instance to be copied. + * @stable ICU 2.0 + */ + SearchIterator(const SearchIterator &other); + + /** + * Destructor. Cleans up the search iterator data struct. + * @stable ICU 2.0 + */ + virtual ~SearchIterator(); + + // public get and set methods ---------------------------------------- + + /** + * Sets the index to point to the given position, and clears any state + * that's affected. + *

+ * This method takes the argument index and sets the position in the text + * string accordingly without checking if the index is pointing to a + * valid starting point to begin searching. + * @param position within the text to be set. If position is less + * than or greater than the text range for searching, + * an U_INDEX_OUTOFBOUNDS_ERROR will be returned + * @param status for errors if it occurs + * @stable ICU 2.0 + */ + virtual void setOffset(int32_t position, UErrorCode &status) = 0; + + /** + * Return the current index in the text being searched. + * If the iteration has gone past the end of the text + * (or past the beginning for a backwards search), USEARCH_DONE + * is returned. + * @return current index in the text being searched. + * @stable ICU 2.0 + */ + virtual int32_t getOffset(void) const = 0; + + /** + * Sets the text searching attributes located in the enum + * USearchAttribute with values from the enum USearchAttributeValue. + * USEARCH_DEFAULT can be used for all attributes for resetting. + * @param attribute text attribute (enum USearchAttribute) to be set + * @param value text attribute value + * @param status for errors if it occurs + * @stable ICU 2.0 + */ + void setAttribute(USearchAttribute attribute, + USearchAttributeValue value, + UErrorCode &status); + + /** + * Gets the text searching attributes + * @param attribute text attribute (enum USearchAttribute) to be retrieve + * @return text attribute value + * @stable ICU 2.0 + */ + USearchAttributeValue getAttribute(USearchAttribute attribute) const; + + /** + * Returns the index to the match in the text string that was searched. + * This call returns a valid result only after a successful call to + * first, next, previous, or last. + * Just after construction, or after a searching method returns + * USEARCH_DONE, this method will return USEARCH_DONE. + *

+ * Use getMatchedLength to get the matched string length. + * @return index of a substring within the text string that is being + * searched. + * @see #first + * @see #next + * @see #previous + * @see #last + * @stable ICU 2.0 + */ + int32_t getMatchedStart(void) const; + + /** + * Returns the length of text in the string which matches the search + * pattern. This call returns a valid result only after a successful call + * to first, next, previous, or last. + * Just after construction, or after a searching method returns + * USEARCH_DONE, this method will return 0. + * @return The length of the match in the target text, or 0 if there + * is no match currently. + * @see #first + * @see #next + * @see #previous + * @see #last + * @stable ICU 2.0 + */ + int32_t getMatchedLength(void) const; + + /** + * Returns the text that was matched by the most recent call to + * first, next, previous, or last. + * If the iterator is not pointing at a valid match (e.g. just after + * construction or after USEARCH_DONE has been returned, + * returns an empty string. + * @param result stores the matched string or an empty string if a match + * is not found. + * @see #first + * @see #next + * @see #previous + * @see #last + * @stable ICU 2.0 + */ + void getMatchedText(UnicodeString &result) const; + + /** + * Set the BreakIterator that will be used to restrict the points + * at which matches are detected. The user is responsible for deleting + * the breakiterator. + * @param breakiter A BreakIterator that will be used to restrict the + * points at which matches are detected. If a match is + * found, but the match's start or end index is not a + * boundary as determined by the BreakIterator, + * the match will be rejected and another will be searched + * for. If this parameter is NULL, no break + * detection is attempted. + * @param status for errors if it occurs + * @see BreakIterator + * @stable ICU 2.0 + */ + void setBreakIterator(BreakIterator *breakiter, UErrorCode &status); + + /** + * Returns the BreakIterator that is used to restrict the points at + * which matches are detected. This will be the same object that was + * passed to the constructor or to setBreakIterator. + * Note that NULL is a legal value; it means that break + * detection should not be attempted. + * @return BreakIterator used to restrict matchings. + * @see #setBreakIterator + * @stable ICU 2.0 + */ + const BreakIterator * getBreakIterator(void) const; + + /** + * Set the string text to be searched. Text iteration will hence begin at + * the start of the text string. This method is useful if you want to + * re-use an iterator to search for the same pattern within a different + * body of text. The user is responsible for deleting the text. + * @param text string to be searched. + * @param status for errors. If the text length is 0, + * an U_ILLEGAL_ARGUMENT_ERROR is returned. + * @stable ICU 2.0 + */ + virtual void setText(const UnicodeString &text, UErrorCode &status); + + /** + * Set the string text to be searched. Text iteration will hence begin at + * the start of the text string. This method is useful if you want to + * re-use an iterator to search for the same pattern within a different + * body of text. + *

+ * Note: No parsing of the text within the CharacterIterator + * will be done during searching for this version. The block of text + * in CharacterIterator will be used as it is. + * The user is responsible for deleting the text. + * @param text string iterator to be searched. + * @param status for errors if any. If the text length is 0 then an + * U_ILLEGAL_ARGUMENT_ERROR is returned. + * @stable ICU 2.0 + */ + virtual void setText(CharacterIterator &text, UErrorCode &status); + + /** + * Return the string text to be searched. + * @return text string to be searched. + * @stable ICU 2.0 + */ + const UnicodeString & getText(void) const; + + // operator overloading ---------------------------------------------- + + /** + * Equality operator. + * @param that SearchIterator instance to be compared. + * @return TRUE if both BreakIterators are of the same class, have the + * same behavior, terates over the same text and have the same + * attributes. FALSE otherwise. + * @stable ICU 2.0 + */ + virtual UBool operator==(const SearchIterator &that) const; + + /** + * Not-equal operator. + * @param that SearchIterator instance to be compared. + * @return FALSE if operator== returns TRUE, and vice versa. + * @stable ICU 2.0 + */ + UBool operator!=(const SearchIterator &that) const; + + // public methods ---------------------------------------------------- + + /** + * Returns a copy of SearchIterator with the same behavior, and + * iterating over the same text, as this one. Note that all data will be + * replicated, except for the text string to be searched. + * @return cloned object + * @stable ICU 2.0 + */ + virtual SearchIterator* safeClone(void) const = 0; + + /** + * Returns the first index at which the string text matches the search + * pattern. The iterator is adjusted so that its current index (as + * returned by getOffset) is the match position if one + * was found. + * If a match is not found, USEARCH_DONE will be returned and + * the iterator will be adjusted to the index USEARCH_DONE + * @param status for errors if it occurs + * @return The character index of the first match, or + * USEARCH_DONE if there are no matches. + * @see #getOffset + * @stable ICU 2.0 + */ + int32_t first(UErrorCode &status); + + /** + * Returns the first index equal or greater than position at which the + * string text matches the search pattern. The iterator is adjusted so + * that its current index (as returned by getOffset) is the + * match position if one was found. + * If a match is not found, USEARCH_DONE will be returned and the + * iterator will be adjusted to the index USEARCH_DONE. + * @param position where search if to start from. If position is less + * than or greater than the text range for searching, + * an U_INDEX_OUTOFBOUNDS_ERROR will be returned + * @param status for errors if it occurs + * @return The character index of the first match following + * position, or USEARCH_DONE if there are no + * matches. + * @see #getOffset + * @stable ICU 2.0 + */ + int32_t following(int32_t position, UErrorCode &status); + + /** + * Returns the last index in the target text at which it matches the + * search pattern. The iterator is adjusted so that its current index + * (as returned by getOffset) is the match position if one was + * found. + * If a match is not found, USEARCH_DONE will be returned and + * the iterator will be adjusted to the index USEARCH_DONE. + * @param status for errors if it occurs + * @return The index of the first match, or USEARCH_DONE if + * there are no matches. + * @see #getOffset + * @stable ICU 2.0 + */ + int32_t last(UErrorCode &status); + + /** + * Returns the first index less than position at which the string + * text matches the search pattern. The iterator is adjusted so that its + * current index (as returned by getOffset) is the match + * position if one was found. If a match is not found, + * USEARCH_DONE will be returned and the iterator will be + * adjusted to the index USEARCH_DONE + *

+ * When USEARCH_OVERLAP option is off, the last index of the + * result match is always less than position. + * When USERARCH_OVERLAP is on, the result match may span across + * position. + * + * @param position where search is to start from. If position is less + * than or greater than the text range for searching, + * an U_INDEX_OUTOFBOUNDS_ERROR will be returned + * @param status for errors if it occurs + * @return The character index of the first match preceding + * position, or USEARCH_DONE if there are + * no matches. + * @see #getOffset + * @stable ICU 2.0 + */ + int32_t preceding(int32_t position, UErrorCode &status); + + /** + * Returns the index of the next point at which the text matches the + * search pattern, starting from the current position + * The iterator is adjusted so that its current index (as returned by + * getOffset) is the match position if one was found. + * If a match is not found, USEARCH_DONE will be returned and + * the iterator will be adjusted to a position after the end of the text + * string. + * @param status for errors if it occurs + * @return The index of the next match after the current position, + * or USEARCH_DONE if there are no more matches. + * @see #getOffset + * @stable ICU 2.0 + */ + int32_t next(UErrorCode &status); + + /** + * Returns the index of the previous point at which the string text + * matches the search pattern, starting at the current position. + * The iterator is adjusted so that its current index (as returned by + * getOffset) is the match position if one was found. + * If a match is not found, USEARCH_DONE will be returned and + * the iterator will be adjusted to the index USEARCH_DONE + * @param status for errors if it occurs + * @return The index of the previous match before the current position, + * or USEARCH_DONE if there are no more matches. + * @see #getOffset + * @stable ICU 2.0 + */ + int32_t previous(UErrorCode &status); + + /** + * Resets the iteration. + * Search will begin at the start of the text string if a forward + * iteration is initiated before a backwards iteration. Otherwise if a + * backwards iteration is initiated before a forwards iteration, the + * search will begin at the end of the text string. + * @stable ICU 2.0 + */ + virtual void reset(); + +protected: + // protected data members --------------------------------------------- + + /** + * C search data struct + * @stable ICU 2.0 + */ + USearch *m_search_; + + /** + * Break iterator. + * Currently the C++ breakiterator does not have getRules etc to reproduce + * another in C. Hence we keep the original around and do the verification + * at the end of the match. The user is responsible for deleting this + * break iterator. + * @stable ICU 2.0 + */ + BreakIterator *m_breakiterator_; + + /** + * Unicode string version of the search text + * @stable ICU 2.0 + */ + UnicodeString m_text_; + + // protected constructors and destructors ----------------------------- + + /** + * Default constructor. + * Initializes data to the default values. + * @stable ICU 2.0 + */ + SearchIterator(); + + /** + * Constructor for use by subclasses. + * @param text The target text to be searched. + * @param breakiter A {@link BreakIterator} that is used to restrict the + * points at which matches are detected. If + * handleNext or handlePrev finds a + * match, but the match's start or end index is not a + * boundary as determined by the BreakIterator, + * the match is rejected and handleNext or + * handlePrev is called again. If this parameter + * is NULL, no break detection is attempted. + * @see #handleNext + * @see #handlePrev + * @stable ICU 2.0 + */ + SearchIterator(const UnicodeString &text, + BreakIterator *breakiter = NULL); + + /** + * Constructor for use by subclasses. + *

+ * Note: No parsing of the text within the CharacterIterator + * will be done during searching for this version. The block of text + * in CharacterIterator will be used as it is. + * @param text The target text to be searched. + * @param breakiter A {@link BreakIterator} that is used to restrict the + * points at which matches are detected. If + * handleNext or handlePrev finds a + * match, but the match's start or end index is not a + * boundary as determined by the BreakIterator, + * the match is rejected and handleNext or + * handlePrev is called again. If this parameter + * is NULL, no break detection is attempted. + * @see #handleNext + * @see #handlePrev + * @stable ICU 2.0 + */ + SearchIterator(CharacterIterator &text, BreakIterator *breakiter = NULL); + + // protected methods -------------------------------------------------- + + /** + * Assignment operator. Sets this iterator to have the same behavior, + * and iterate over the same text, as the one passed in. + * @param that instance to be copied. + * @stable ICU 2.0 + */ + SearchIterator & operator=(const SearchIterator &that); + + /** + * Abstract method which subclasses override to provide the mechanism + * for finding the next match in the target text. This allows different + * subclasses to provide different search algorithms. + *

+ * If a match is found, the implementation should return the index at + * which the match starts and should call + * setMatchLength with the number of characters + * in the target text that make up the match. If no match is found, the + * method should return USEARCH_DONE. + *

+ * @param position The index in the target text at which the search + * should start. + * @param status for error codes if it occurs. + * @return index at which the match starts, else if match is not found + * USEARCH_DONE is returned + * @see #setMatchLength + * @stable ICU 2.0 + */ + virtual int32_t handleNext(int32_t position, UErrorCode &status) + = 0; + + /** + * Abstract method which subclasses override to provide the mechanism for + * finding the previous match in the target text. This allows different + * subclasses to provide different search algorithms. + *

+ * If a match is found, the implementation should return the index at + * which the match starts and should call + * setMatchLength with the number of characters + * in the target text that make up the match. If no match is found, the + * method should return USEARCH_DONE. + *

+ * @param position The index in the target text at which the search + * should start. + * @param status for error codes if it occurs. + * @return index at which the match starts, else if match is not found + * USEARCH_DONE is returned + * @see #setMatchLength + * @stable ICU 2.0 + */ + virtual int32_t handlePrev(int32_t position, UErrorCode &status) + = 0; + + /** + * Sets the length of the currently matched string in the text string to + * be searched. + * Subclasses' handleNext and handlePrev + * methods should call this when they find a match in the target text. + * @param length length of the matched text. + * @see #handleNext + * @see #handlePrev + * @stable ICU 2.0 + */ + virtual void setMatchLength(int32_t length); + + /** + * Sets the offset of the currently matched string in the text string to + * be searched. + * Subclasses' handleNext and handlePrev + * methods should call this when they find a match in the target text. + * @param position start offset of the matched text. + * @see #handleNext + * @see #handlePrev + * @stable ICU 2.0 + */ + virtual void setMatchStart(int32_t position); + + /** + * sets match not found + * @stable ICU 2.0 + */ + void setMatchNotFound(); +}; + +inline UBool SearchIterator::operator!=(const SearchIterator &that) const +{ + return !operator==(that); +} +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_COLLATION */ + +#endif + diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/selfmt.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/selfmt.h new file mode 100644 index 0000000..08e9d44 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/selfmt.h @@ -0,0 +1,369 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/******************************************************************** + * COPYRIGHT: + * Copyright (c) 1997-2011, International Business Machines Corporation and + * others. All Rights Reserved. + * Copyright (C) 2010 , Yahoo! Inc. + ******************************************************************** + * + * File SELFMT.H + * + * Modification History: + * + * Date Name Description + * 11/11/09 kirtig Finished first cut of implementation. + ********************************************************************/ + +#ifndef SELFMT +#define SELFMT + +#include "unicode/messagepattern.h" +#include "unicode/numfmt.h" +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: SelectFormat object + */ + +#if !UCONFIG_NO_FORMATTING + +U_NAMESPACE_BEGIN + +class MessageFormat; + +/** + *

SelectFormat supports the creation of internationalized + * messages by selecting phrases based on keywords. The pattern specifies + * how to map keywords to phrases and provides a default phrase. The + * object provided to the format method is a string that's matched + * against the keywords. If there is a match, the corresponding phrase + * is selected; otherwise, the default phrase is used.

+ * + *

Using SelectFormat for Gender Agreement

+ * + *

Note: Typically, select formatting is done via MessageFormat + * with a select argument type, + * rather than using a stand-alone SelectFormat.

+ * + *

The main use case for the select format is gender based inflection. + * When names or nouns are inserted into sentences, their gender can affect pronouns, + * verb forms, articles, and adjectives. Special care needs to be + * taken for the case where the gender cannot be determined. + * The impact varies between languages:

+ * \htmlonly + *
    + *
  • English has three genders, and unknown gender is handled as a special + * case. Names use the gender of the named person (if known), nouns referring + * to people use natural gender, and inanimate objects are usually neutral. + * The gender only affects pronouns: "he", "she", "it", "they". + * + *
  • German differs from English in that the gender of nouns is rather + * arbitrary, even for nouns referring to people ("Mädchen", girl, is neutral). + * The gender affects pronouns ("er", "sie", "es"), articles ("der", "die", + * "das"), and adjective forms ("guter Mann", "gute Frau", "gutes Mädchen"). + * + *
  • French has only two genders; as in German the gender of nouns + * is rather arbitrary - for sun and moon, the genders + * are the opposite of those in German. The gender affects + * pronouns ("il", "elle"), articles ("le", "la"), + * adjective forms ("bon", "bonne"), and sometimes + * verb forms ("allé", "allée"). + * + *
  • Polish distinguishes five genders (or noun classes), + * human masculine, animate non-human masculine, inanimate masculine, + * feminine, and neuter. + *
+ * \endhtmlonly + *

Some other languages have noun classes that are not related to gender, + * but similar in grammatical use. + * Some African languages have around 20 noun classes.

+ * + *

Note:For the gender of a person in a given sentence, + * we usually need to distinguish only between female, male and other/unknown.

+ * + *

To enable localizers to create sentence patterns that take their + * language's gender dependencies into consideration, software has to provide + * information about the gender associated with a noun or name to + * MessageFormat. + * Two main cases can be distinguished:

+ * + *
    + *
  • For people, natural gender information should be maintained for each person. + * Keywords like "male", "female", "mixed" (for groups of people) + * and "unknown" could be used. + * + *
  • For nouns, grammatical gender information should be maintained for + * each noun and per language, e.g., in resource bundles. + * The keywords "masculine", "feminine", and "neuter" are commonly used, + * but some languages may require other keywords. + *
+ * + *

The resulting keyword is provided to MessageFormat as a + * parameter separate from the name or noun it's associated with. For example, + * to generate a message such as "Jean went to Paris", three separate arguments + * would be provided: The name of the person as argument 0, the gender of + * the person as argument 1, and the name of the city as argument 2. + * The sentence pattern for English, where the gender of the person has + * no impact on this simple sentence, would not refer to argument 1 at all:

+ * + *
{0} went to {2}.
+ * + *

Note: The entire sentence should be included (and partially repeated) + * inside each phrase. Otherwise translators would have to be trained on how to + * move bits of the sentence in and out of the select argument of a message. + * (The examples below do not follow this recommendation!)

+ * + *

The sentence pattern for French, where the gender of the person affects + * the form of the participle, uses a select format based on argument 1:

+ * + * \htmlonly
{0} est {1, select, female {allée} other {allé}} à {2}.
\endhtmlonly + * + *

Patterns can be nested, so that it's possible to handle interactions of + * number and gender where necessary. For example, if the above sentence should + * allow for the names of several people to be inserted, the following sentence + * pattern can be used (with argument 0 the list of people's names, + * argument 1 the number of people, argument 2 their combined gender, and + * argument 3 the city name):

+ * + * \htmlonly + *
{0} {1, plural,
+  *                 one {est {2, select, female {allée} other  {allé}}}
+  *                 other {sont {2, select, female {allées} other {allés}}}
+  *          }à {3}.
+ * \endhtmlonly + * + *

Patterns and Their Interpretation

+ * + *

The SelectFormat pattern string defines the phrase output + * for each user-defined keyword. + * The pattern is a sequence of (keyword, message) pairs. + * A keyword is a "pattern identifier": [^[[:Pattern_Syntax:][:Pattern_White_Space:]]]+

+ * + *

Each message is a MessageFormat pattern string enclosed in {curly braces}.

+ * + *

You always have to define a phrase for the default keyword + * other; this phrase is returned when the keyword + * provided to + * the format method matches no other keyword. + * If a pattern does not provide a phrase for other, the method + * it's provided to returns the error U_DEFAULT_KEYWORD_MISSING. + *
+ * Pattern_White_Space between keywords and messages is ignored. + * Pattern_White_Space within a message is preserved and output.

+ * + *

Example:
+  * \htmlonly
+  *
+  * UErrorCode status = U_ZERO_ERROR;
+  * MessageFormat *msgFmt = new MessageFormat(UnicodeString("{0} est  {1, select, female {allée} other {allé}} à Paris."), Locale("fr"),  status);
+  * if (U_FAILURE(status)) {
+  *       return;
+  * }
+  * FieldPosition ignore(FieldPosition::DONT_CARE);
+  * UnicodeString result;
+  *
+  * char* str1= "Kirti,female";
+  * Formattable args1[] = {"Kirti","female"};
+  * msgFmt->format(args1, 2, result, ignore, status);
+  * cout << "Input is " << str1 << " and result is: " << result << endl;
+  * delete msgFmt;
+  *
+  * \endhtmlonly
+  * 
+ *

+ * + * Produces the output:
+ * \htmlonly + * Kirti est allée à Paris. + * \endhtmlonly + * + * @stable ICU 4.4 + */ + +class U_I18N_API SelectFormat : public Format { +public: + + /** + * Creates a new SelectFormat for a given pattern string. + * @param pattern the pattern for this SelectFormat. + * errors are returned to status if the pattern is invalid. + * @param status output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @stable ICU 4.4 + */ + SelectFormat(const UnicodeString& pattern, UErrorCode& status); + + /** + * copy constructor. + * @stable ICU 4.4 + */ + SelectFormat(const SelectFormat& other); + + /** + * Destructor. + * @stable ICU 4.4 + */ + virtual ~SelectFormat(); + + /** + * Sets the pattern used by this select format. + * for the keyword rules. + * Patterns and their interpretation are specified in the class description. + * + * @param pattern the pattern for this select format + * errors are returned to status if the pattern is invalid. + * @param status output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @stable ICU 4.4 + */ + void applyPattern(const UnicodeString& pattern, UErrorCode& status); + + + using Format::format; + + /** + * Selects the phrase for the given keyword + * + * @param keyword The keyword that is used to select an alternative. + * @param appendTo output parameter to receive result. + * result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @param status output param set to success/failure code on exit, which + * must not indicate a failure before the function call. + * @return Reference to 'appendTo' parameter. + * @stable ICU 4.4 + */ + UnicodeString& format(const UnicodeString& keyword, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode& status) const; + + /** + * Assignment operator + * + * @param other the SelectFormat object to copy from. + * @stable ICU 4.4 + */ + SelectFormat& operator=(const SelectFormat& other); + + /** + * Return true if another object is semantically equal to this one. + * + * @param other the SelectFormat object to be compared with. + * @return true if other is semantically equal to this. + * @stable ICU 4.4 + */ + virtual UBool operator==(const Format& other) const; + + /** + * Return true if another object is semantically unequal to this one. + * + * @param other the SelectFormat object to be compared with. + * @return true if other is semantically unequal to this. + * @stable ICU 4.4 + */ + virtual UBool operator!=(const Format& other) const; + + /** + * Clones this Format object polymorphically. The caller owns the + * result and should delete it when done. + * @stable ICU 4.4 + */ + virtual Format* clone(void) const; + + /** + * Format an object to produce a string. + * This method handles keyword strings. + * If the Formattable object is not a UnicodeString, + * then it returns a failing UErrorCode. + * + * @param obj A keyword string that is used to select an alternative. + * @param appendTo output parameter to receive result. + * Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. + * On output: the offsets of the alignment field. + * @param status output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @stable ICU 4.4 + */ + UnicodeString& format(const Formattable& obj, + UnicodeString& appendTo, + FieldPosition& pos, + UErrorCode& status) const; + + /** + * Returns the pattern from applyPattern() or constructor. + * + * @param appendTo output parameter to receive result. + * Result is appended to existing contents. + * @return the UnicodeString with inserted pattern. + * @stable ICU 4.4 + */ + UnicodeString& toPattern(UnicodeString& appendTo); + + /** + * This method is not yet supported by SelectFormat. + *

+ * Before calling, set parse_pos.index to the offset you want to start + * parsing at in the source. After calling, parse_pos.index is the end of + * the text you parsed. If error occurs, index is unchanged. + *

+ * When parsing, leading whitespace is discarded (with a successful parse), + * while trailing whitespace is left as is. + *

+ * See Format::parseObject() for more. + * + * @param source The string to be parsed into an object. + * @param result Formattable to be set to the parse result. + * If parse fails, return contents are undefined. + * @param parse_pos The position to start parsing at. Upon return + * this param is set to the position after the + * last character successfully parsed. If the + * source is not parsed successfully, this param + * will remain unchanged. + * @stable ICU 4.4 + */ + virtual void parseObject(const UnicodeString& source, + Formattable& result, + ParsePosition& parse_pos) const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * @stable ICU 4.4 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * @stable ICU 4.4 + */ + virtual UClassID getDynamicClassID() const; + +private: + friend class MessageFormat; + + SelectFormat(); // default constructor not implemented. + + /** + * Finds the SelectFormat sub-message for the given keyword, or the "other" sub-message. + * @param pattern A MessagePattern. + * @param partIndex the index of the first SelectFormat argument style part. + * @param keyword a keyword to be matched to one of the SelectFormat argument's keywords. + * @param ec Error code. + * @return the sub-message start part index. + */ + static int32_t findSubMessage(const MessagePattern& pattern, int32_t partIndex, + const UnicodeString& keyword, UErrorCode& ec); + + MessagePattern msgPattern; +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // _SELFMT +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/simpleformatter.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/simpleformatter.h new file mode 100644 index 0000000..850949c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/simpleformatter.h @@ -0,0 +1,303 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* Copyright (C) 2014-2016, International Business Machines +* Corporation and others. All Rights Reserved. +****************************************************************************** +* simpleformatter.h +*/ + +#ifndef __SIMPLEFORMATTER_H__ +#define __SIMPLEFORMATTER_H__ + +/** + * \file + * \brief C++ API: Simple formatter, minimal subset of MessageFormat. + */ + +#include "unicode/utypes.h" +#include "unicode/unistr.h" + +U_NAMESPACE_BEGIN + +// Forward declaration: +namespace number { +namespace impl { +class SimpleModifier; +} +} + +/** + * Formats simple patterns like "{1} was born in {0}". + * Minimal subset of MessageFormat; fast, simple, minimal dependencies. + * Supports only numbered arguments with no type nor style parameters, + * and formats only string values. + * Quoting via ASCII apostrophe compatible with ICU MessageFormat default behavior. + * + * Factory methods set error codes for syntax errors + * and for too few or too many arguments/placeholders. + * + * SimpleFormatter objects are thread-safe except for assignment and applying new patterns. + * + * Example: + *

+ * UErrorCode errorCode = U_ZERO_ERROR;
+ * SimpleFormatter fmt("{1} '{born}' in {0}", errorCode);
+ * UnicodeString result;
+ *
+ * // Output: "paul {born} in england"
+ * fmt.format("england", "paul", result, errorCode);
+ * 
+ * + * This class is not intended for public subclassing. + * + * @see MessageFormat + * @see UMessagePatternApostropheMode + * @stable ICU 57 + */ +class U_COMMON_API SimpleFormatter U_FINAL : public UMemory { +public: + /** + * Default constructor. + * @stable ICU 57 + */ + SimpleFormatter() : compiledPattern((char16_t)0) {} + + /** + * Constructs a formatter from the pattern string. + * + * @param pattern The pattern string. + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax. + * @stable ICU 57 + */ + SimpleFormatter(const UnicodeString& pattern, UErrorCode &errorCode) { + applyPattern(pattern, errorCode); + } + + /** + * Constructs a formatter from the pattern string. + * The number of arguments checked against the given limits is the + * highest argument number plus one, not the number of occurrences of arguments. + * + * @param pattern The pattern string. + * @param min The pattern must have at least this many arguments. + * @param max The pattern must have at most this many arguments. + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax and + * too few or too many arguments. + * @stable ICU 57 + */ + SimpleFormatter(const UnicodeString& pattern, int32_t min, int32_t max, + UErrorCode &errorCode) { + applyPatternMinMaxArguments(pattern, min, max, errorCode); + } + + /** + * Copy constructor. + * @stable ICU 57 + */ + SimpleFormatter(const SimpleFormatter& other) + : compiledPattern(other.compiledPattern) {} + + /** + * Assignment operator. + * @stable ICU 57 + */ + SimpleFormatter &operator=(const SimpleFormatter& other); + + /** + * Destructor. + * @stable ICU 57 + */ + ~SimpleFormatter(); + + /** + * Changes this object according to the new pattern. + * + * @param pattern The pattern string. + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax. + * @return TRUE if U_SUCCESS(errorCode). + * @stable ICU 57 + */ + UBool applyPattern(const UnicodeString &pattern, UErrorCode &errorCode) { + return applyPatternMinMaxArguments(pattern, 0, INT32_MAX, errorCode); + } + + /** + * Changes this object according to the new pattern. + * The number of arguments checked against the given limits is the + * highest argument number plus one, not the number of occurrences of arguments. + * + * @param pattern The pattern string. + * @param min The pattern must have at least this many arguments. + * @param max The pattern must have at most this many arguments. + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * Set to U_ILLEGAL_ARGUMENT_ERROR for bad argument syntax and + * too few or too many arguments. + * @return TRUE if U_SUCCESS(errorCode). + * @stable ICU 57 + */ + UBool applyPatternMinMaxArguments(const UnicodeString &pattern, + int32_t min, int32_t max, UErrorCode &errorCode); + + /** + * @return The max argument number + 1. + * @stable ICU 57 + */ + int32_t getArgumentLimit() const { + return getArgumentLimit(compiledPattern.getBuffer(), compiledPattern.length()); + } + + /** + * Formats the given value, appending to the appendTo builder. + * The argument value must not be the same object as appendTo. + * getArgumentLimit() must be at most 1. + * + * @param value0 Value for argument {0}. + * @param appendTo Gets the formatted pattern and value appended. + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return appendTo + * @stable ICU 57 + */ + UnicodeString &format( + const UnicodeString &value0, + UnicodeString &appendTo, UErrorCode &errorCode) const; + + /** + * Formats the given values, appending to the appendTo builder. + * An argument value must not be the same object as appendTo. + * getArgumentLimit() must be at most 2. + * + * @param value0 Value for argument {0}. + * @param value1 Value for argument {1}. + * @param appendTo Gets the formatted pattern and values appended. + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return appendTo + * @stable ICU 57 + */ + UnicodeString &format( + const UnicodeString &value0, + const UnicodeString &value1, + UnicodeString &appendTo, UErrorCode &errorCode) const; + + /** + * Formats the given values, appending to the appendTo builder. + * An argument value must not be the same object as appendTo. + * getArgumentLimit() must be at most 3. + * + * @param value0 Value for argument {0}. + * @param value1 Value for argument {1}. + * @param value2 Value for argument {2}. + * @param appendTo Gets the formatted pattern and values appended. + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return appendTo + * @stable ICU 57 + */ + UnicodeString &format( + const UnicodeString &value0, + const UnicodeString &value1, + const UnicodeString &value2, + UnicodeString &appendTo, UErrorCode &errorCode) const; + + /** + * Formats the given values, appending to the appendTo string. + * + * @param values The argument values. + * An argument value must not be the same object as appendTo. + * Can be NULL if valuesLength==getArgumentLimit()==0. + * @param valuesLength The length of the values array. + * Must be at least getArgumentLimit(). + * @param appendTo Gets the formatted pattern and values appended. + * @param offsets offsets[i] receives the offset of where + * values[i] replaced pattern argument {i}. + * Can be shorter or longer than values. Can be NULL if offsetsLength==0. + * If there is no {i} in the pattern, then offsets[i] is set to -1. + * @param offsetsLength The length of the offsets array. + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return appendTo + * @stable ICU 57 + */ + UnicodeString &formatAndAppend( + const UnicodeString *const *values, int32_t valuesLength, + UnicodeString &appendTo, + int32_t *offsets, int32_t offsetsLength, UErrorCode &errorCode) const; + + /** + * Formats the given values, replacing the contents of the result string. + * May optimize by actually appending to the result if it is the same object + * as the value corresponding to the initial argument in the pattern. + * + * @param values The argument values. + * An argument value may be the same object as result. + * Can be NULL if valuesLength==getArgumentLimit()==0. + * @param valuesLength The length of the values array. + * Must be at least getArgumentLimit(). + * @param result Gets its contents replaced by the formatted pattern and values. + * @param offsets offsets[i] receives the offset of where + * values[i] replaced pattern argument {i}. + * Can be shorter or longer than values. Can be NULL if offsetsLength==0. + * If there is no {i} in the pattern, then offsets[i] is set to -1. + * @param offsetsLength The length of the offsets array. + * @param errorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return result + * @stable ICU 57 + */ + UnicodeString &formatAndReplace( + const UnicodeString *const *values, int32_t valuesLength, + UnicodeString &result, + int32_t *offsets, int32_t offsetsLength, UErrorCode &errorCode) const; + + /** + * Returns the pattern text with none of the arguments. + * Like formatting with all-empty string values. + * @stable ICU 57 + */ + UnicodeString getTextWithNoArguments() const { + return getTextWithNoArguments(compiledPattern.getBuffer(), compiledPattern.length()); + } + +private: + /** + * Binary representation of the compiled pattern. + * Index 0: One more than the highest argument number. + * Followed by zero or more arguments or literal-text segments. + * + * An argument is stored as its number, less than ARG_NUM_LIMIT. + * A literal-text segment is stored as its length (at least 1) offset by ARG_NUM_LIMIT, + * followed by that many chars. + */ + UnicodeString compiledPattern; + + static inline int32_t getArgumentLimit(const char16_t *compiledPattern, + int32_t compiledPatternLength) { + return compiledPatternLength == 0 ? 0 : compiledPattern[0]; + } + + static UnicodeString getTextWithNoArguments(const char16_t *compiledPattern, int32_t compiledPatternLength); + + static UnicodeString &format( + const char16_t *compiledPattern, int32_t compiledPatternLength, + const UnicodeString *const *values, + UnicodeString &result, const UnicodeString *resultCopy, UBool forbidResultAsValue, + int32_t *offsets, int32_t offsetsLength, + UErrorCode &errorCode); + + // Give access to internals to SimpleModifier for number formatting + friend class number::impl::SimpleModifier; +}; + +U_NAMESPACE_END + +#endif // __SIMPLEFORMATTER_H__ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/simpletz.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/simpletz.h new file mode 100644 index 0000000..5b80263 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/simpletz.h @@ -0,0 +1,930 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ******************************************************************************** + * Copyright (C) 1997-2013, International Business Machines * + * Corporation and others. All Rights Reserved. * + ******************************************************************************** + * + * File SIMPLETZ.H + * + * Modification History: + * + * Date Name Description + * 04/21/97 aliu Overhauled header. + * 08/10/98 stephen JDK 1.2 sync + * Added setStartRule() / setEndRule() overloads + * Added hasSameRules() + * 09/02/98 stephen Added getOffset(monthLen) + * Changed getOffset() to take UErrorCode + * 07/09/99 stephen Removed millisPerHour (unused, for HP compiler) + * 12/02/99 aliu Added TimeMode and constructor and setStart/EndRule + * methods that take TimeMode. Added to docs. + ******************************************************************************** + */ + +#ifndef SIMPLETZ_H +#define SIMPLETZ_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: SimpleTimeZone is a concrete subclass of TimeZone. + */ + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/basictz.h" + +U_NAMESPACE_BEGIN + +// forward declaration +class InitialTimeZoneRule; +class TimeZoneTransition; +class AnnualTimeZoneRule; + +/** + * SimpleTimeZone is a concrete subclass of TimeZone + * that represents a time zone for use with a Gregorian calendar. This + * class does not handle historical changes. + *

+ * When specifying daylight-savings-time begin and end dates, use a negative value for + * dayOfWeekInMonth to indicate that SimpleTimeZone should + * count from the end of the month backwards. For example, if Daylight Savings + * Time starts or ends at the last Sunday a month, use dayOfWeekInMonth = -1 + * along with dayOfWeek = UCAL_SUNDAY to specify the rule. + * + * @see Calendar + * @see GregorianCalendar + * @see TimeZone + * @author D. Goldsmith, Mark Davis, Chen-Lieh Huang, Alan Liu + */ +class U_I18N_API SimpleTimeZone: public BasicTimeZone { +public: + + /** + * TimeMode is used, together with a millisecond offset after + * midnight, to specify a rule transition time. Most rules + * transition at a local wall time, that is, according to the + * current time in effect, either standard, or DST. However, some + * rules transition at local standard time, and some at a specific + * UTC time. Although it might seem that all times could be + * converted to wall time, thus eliminating the need for this + * parameter, this is not the case. + * @stable ICU 2.0 + */ + enum TimeMode { + WALL_TIME = 0, + STANDARD_TIME, + UTC_TIME + }; + + /** + * Copy constructor + * @param source the object to be copied. + * @stable ICU 2.0 + */ + SimpleTimeZone(const SimpleTimeZone& source); + + /** + * Default assignment operator + * @param right the object to be copied. + * @stable ICU 2.0 + */ + SimpleTimeZone& operator=(const SimpleTimeZone& right); + + /** + * Destructor + * @stable ICU 2.0 + */ + virtual ~SimpleTimeZone(); + + /** + * Returns true if the two TimeZone objects are equal; that is, they have + * the same ID, raw GMT offset, and DST rules. + * + * @param that The SimpleTimeZone object to be compared with. + * @return True if the given time zone is equal to this time zone; false + * otherwise. + * @stable ICU 2.0 + */ + virtual UBool operator==(const TimeZone& that) const; + + /** + * Constructs a SimpleTimeZone with the given raw GMT offset and time zone ID, + * and which doesn't observe daylight savings time. Normally you should use + * TimeZone::createInstance() to create a TimeZone instead of creating a + * SimpleTimeZone directly with this constructor. + * + * @param rawOffsetGMT The given base time zone offset to GMT. + * @param ID The timezone ID which is obtained from + * TimeZone.getAvailableIDs. + * @stable ICU 2.0 + */ + SimpleTimeZone(int32_t rawOffsetGMT, const UnicodeString& ID); + + /** + * Construct a SimpleTimeZone with the given raw GMT offset, time zone ID, + * and times to start and end daylight savings time. To create a TimeZone that + * doesn't observe daylight savings time, don't use this constructor; use + * SimpleTimeZone(rawOffset, ID) instead. Normally, you should use + * TimeZone.createInstance() to create a TimeZone instead of creating a + * SimpleTimeZone directly with this constructor. + *

+ * Various types of daylight-savings time rules can be specfied by using different + * values for startDay and startDayOfWeek and endDay and endDayOfWeek. For a + * complete explanation of how these parameters work, see the documentation for + * setStartRule(). + * + * @param rawOffsetGMT The new SimpleTimeZone's raw GMT offset + * @param ID The new SimpleTimeZone's time zone ID. + * @param savingsStartMonth The daylight savings starting month. Month is + * 0-based. eg, 0 for January. + * @param savingsStartDayOfWeekInMonth The daylight savings starting + * day-of-week-in-month. See setStartRule() for a + * complete explanation. + * @param savingsStartDayOfWeek The daylight savings starting day-of-week. + * See setStartRule() for a complete explanation. + * @param savingsStartTime The daylight savings starting time, expressed as the + * number of milliseconds after midnight. + * @param savingsEndMonth The daylight savings ending month. Month is + * 0-based. eg, 0 for January. + * @param savingsEndDayOfWeekInMonth The daylight savings ending day-of-week-in-month. + * See setStartRule() for a complete explanation. + * @param savingsEndDayOfWeek The daylight savings ending day-of-week. + * See setStartRule() for a complete explanation. + * @param savingsEndTime The daylight savings ending time, expressed as the + * number of milliseconds after midnight. + * @param status An UErrorCode to receive the status. + * @stable ICU 2.0 + */ + SimpleTimeZone(int32_t rawOffsetGMT, const UnicodeString& ID, + int8_t savingsStartMonth, int8_t savingsStartDayOfWeekInMonth, + int8_t savingsStartDayOfWeek, int32_t savingsStartTime, + int8_t savingsEndMonth, int8_t savingsEndDayOfWeekInMonth, + int8_t savingsEndDayOfWeek, int32_t savingsEndTime, + UErrorCode& status); + /** + * Construct a SimpleTimeZone with the given raw GMT offset, time zone ID, + * and times to start and end daylight savings time. To create a TimeZone that + * doesn't observe daylight savings time, don't use this constructor; use + * SimpleTimeZone(rawOffset, ID) instead. Normally, you should use + * TimeZone.createInstance() to create a TimeZone instead of creating a + * SimpleTimeZone directly with this constructor. + *

+ * Various types of daylight-savings time rules can be specfied by using different + * values for startDay and startDayOfWeek and endDay and endDayOfWeek. For a + * complete explanation of how these parameters work, see the documentation for + * setStartRule(). + * + * @param rawOffsetGMT The new SimpleTimeZone's raw GMT offset + * @param ID The new SimpleTimeZone's time zone ID. + * @param savingsStartMonth The daylight savings starting month. Month is + * 0-based. eg, 0 for January. + * @param savingsStartDayOfWeekInMonth The daylight savings starting + * day-of-week-in-month. See setStartRule() for a + * complete explanation. + * @param savingsStartDayOfWeek The daylight savings starting day-of-week. + * See setStartRule() for a complete explanation. + * @param savingsStartTime The daylight savings starting time, expressed as the + * number of milliseconds after midnight. + * @param savingsEndMonth The daylight savings ending month. Month is + * 0-based. eg, 0 for January. + * @param savingsEndDayOfWeekInMonth The daylight savings ending day-of-week-in-month. + * See setStartRule() for a complete explanation. + * @param savingsEndDayOfWeek The daylight savings ending day-of-week. + * See setStartRule() for a complete explanation. + * @param savingsEndTime The daylight savings ending time, expressed as the + * number of milliseconds after midnight. + * @param savingsDST The number of milliseconds added to standard time + * to get DST time. Default is one hour. + * @param status An UErrorCode to receive the status. + * @stable ICU 2.0 + */ + SimpleTimeZone(int32_t rawOffsetGMT, const UnicodeString& ID, + int8_t savingsStartMonth, int8_t savingsStartDayOfWeekInMonth, + int8_t savingsStartDayOfWeek, int32_t savingsStartTime, + int8_t savingsEndMonth, int8_t savingsEndDayOfWeekInMonth, + int8_t savingsEndDayOfWeek, int32_t savingsEndTime, + int32_t savingsDST, UErrorCode& status); + + /** + * Construct a SimpleTimeZone with the given raw GMT offset, time zone ID, + * and times to start and end daylight savings time. To create a TimeZone that + * doesn't observe daylight savings time, don't use this constructor; use + * SimpleTimeZone(rawOffset, ID) instead. Normally, you should use + * TimeZone.createInstance() to create a TimeZone instead of creating a + * SimpleTimeZone directly with this constructor. + *

+ * Various types of daylight-savings time rules can be specfied by using different + * values for startDay and startDayOfWeek and endDay and endDayOfWeek. For a + * complete explanation of how these parameters work, see the documentation for + * setStartRule(). + * + * @param rawOffsetGMT The new SimpleTimeZone's raw GMT offset + * @param ID The new SimpleTimeZone's time zone ID. + * @param savingsStartMonth The daylight savings starting month. Month is + * 0-based. eg, 0 for January. + * @param savingsStartDayOfWeekInMonth The daylight savings starting + * day-of-week-in-month. See setStartRule() for a + * complete explanation. + * @param savingsStartDayOfWeek The daylight savings starting day-of-week. + * See setStartRule() for a complete explanation. + * @param savingsStartTime The daylight savings starting time, expressed as the + * number of milliseconds after midnight. + * @param savingsStartTimeMode Whether the start time is local wall time, local + * standard time, or UTC time. Default is local wall time. + * @param savingsEndMonth The daylight savings ending month. Month is + * 0-based. eg, 0 for January. + * @param savingsEndDayOfWeekInMonth The daylight savings ending day-of-week-in-month. + * See setStartRule() for a complete explanation. + * @param savingsEndDayOfWeek The daylight savings ending day-of-week. + * See setStartRule() for a complete explanation. + * @param savingsEndTime The daylight savings ending time, expressed as the + * number of milliseconds after midnight. + * @param savingsEndTimeMode Whether the end time is local wall time, local + * standard time, or UTC time. Default is local wall time. + * @param savingsDST The number of milliseconds added to standard time + * to get DST time. Default is one hour. + * @param status An UErrorCode to receive the status. + * @stable ICU 2.0 + */ + SimpleTimeZone(int32_t rawOffsetGMT, const UnicodeString& ID, + int8_t savingsStartMonth, int8_t savingsStartDayOfWeekInMonth, + int8_t savingsStartDayOfWeek, int32_t savingsStartTime, + TimeMode savingsStartTimeMode, + int8_t savingsEndMonth, int8_t savingsEndDayOfWeekInMonth, + int8_t savingsEndDayOfWeek, int32_t savingsEndTime, TimeMode savingsEndTimeMode, + int32_t savingsDST, UErrorCode& status); + + /** + * Sets the daylight savings starting year, that is, the year this time zone began + * observing its specified daylight savings time rules. The time zone is considered + * not to observe daylight savings time prior to that year; SimpleTimeZone doesn't + * support historical daylight-savings-time rules. + * @param year the daylight savings starting year. + * @stable ICU 2.0 + */ + void setStartYear(int32_t year); + + /** + * Sets the daylight savings starting rule. For example, in the U.S., Daylight Savings + * Time starts at the second Sunday in March, at 2 AM in standard time. + * Therefore, you can set the start rule by calling: + * setStartRule(UCAL_MARCH, 2, UCAL_SUNDAY, 2*60*60*1000); + * The dayOfWeekInMonth and dayOfWeek parameters together specify how to calculate + * the exact starting date. Their exact meaning depend on their respective signs, + * allowing various types of rules to be constructed, as follows: + *

    + *
  • If both dayOfWeekInMonth and dayOfWeek are positive, they specify the + * day of week in the month (e.g., (2, WEDNESDAY) is the second Wednesday + * of the month).
  • + *
  • If dayOfWeek is positive and dayOfWeekInMonth is negative, they specify + * the day of week in the month counting backward from the end of the month. + * (e.g., (-1, MONDAY) is the last Monday in the month)
  • + *
  • If dayOfWeek is zero and dayOfWeekInMonth is positive, dayOfWeekInMonth + * specifies the day of the month, regardless of what day of the week it is. + * (e.g., (10, 0) is the tenth day of the month)
  • + *
  • If dayOfWeek is zero and dayOfWeekInMonth is negative, dayOfWeekInMonth + * specifies the day of the month counting backward from the end of the + * month, regardless of what day of the week it is (e.g., (-2, 0) is the + * next-to-last day of the month).
  • + *
  • If dayOfWeek is negative and dayOfWeekInMonth is positive, they specify the + * first specified day of the week on or after the specfied day of the month. + * (e.g., (15, -SUNDAY) is the first Sunday after the 15th of the month + * [or the 15th itself if the 15th is a Sunday].)
  • + *
  • If dayOfWeek and DayOfWeekInMonth are both negative, they specify the + * last specified day of the week on or before the specified day of the month. + * (e.g., (-20, -TUESDAY) is the last Tuesday before the 20th of the month + * [or the 20th itself if the 20th is a Tuesday].)
  • + *
+ * @param month the daylight savings starting month. Month is 0-based. + * eg, 0 for January. + * @param dayOfWeekInMonth the daylight savings starting + * day-of-week-in-month. Please see the member description for an example. + * @param dayOfWeek the daylight savings starting day-of-week. Please see + * the member description for an example. + * @param time the daylight savings starting time. Please see the member + * description for an example. + * @param status An UErrorCode + * @stable ICU 2.0 + */ + void setStartRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek, + int32_t time, UErrorCode& status); + /** + * Sets the daylight savings starting rule. For example, in the U.S., Daylight Savings + * Time starts at the second Sunday in March, at 2 AM in standard time. + * Therefore, you can set the start rule by calling: + * setStartRule(UCAL_MARCH, 2, UCAL_SUNDAY, 2*60*60*1000); + * The dayOfWeekInMonth and dayOfWeek parameters together specify how to calculate + * the exact starting date. Their exact meaning depend on their respective signs, + * allowing various types of rules to be constructed, as follows: + *
    + *
  • If both dayOfWeekInMonth and dayOfWeek are positive, they specify the + * day of week in the month (e.g., (2, WEDNESDAY) is the second Wednesday + * of the month).
  • + *
  • If dayOfWeek is positive and dayOfWeekInMonth is negative, they specify + * the day of week in the month counting backward from the end of the month. + * (e.g., (-1, MONDAY) is the last Monday in the month)
  • + *
  • If dayOfWeek is zero and dayOfWeekInMonth is positive, dayOfWeekInMonth + * specifies the day of the month, regardless of what day of the week it is. + * (e.g., (10, 0) is the tenth day of the month)
  • + *
  • If dayOfWeek is zero and dayOfWeekInMonth is negative, dayOfWeekInMonth + * specifies the day of the month counting backward from the end of the + * month, regardless of what day of the week it is (e.g., (-2, 0) is the + * next-to-last day of the month).
  • + *
  • If dayOfWeek is negative and dayOfWeekInMonth is positive, they specify the + * first specified day of the week on or after the specfied day of the month. + * (e.g., (15, -SUNDAY) is the first Sunday after the 15th of the month + * [or the 15th itself if the 15th is a Sunday].)
  • + *
  • If dayOfWeek and DayOfWeekInMonth are both negative, they specify the + * last specified day of the week on or before the specified day of the month. + * (e.g., (-20, -TUESDAY) is the last Tuesday before the 20th of the month + * [or the 20th itself if the 20th is a Tuesday].)
  • + *
+ * @param month the daylight savings starting month. Month is 0-based. + * eg, 0 for January. + * @param dayOfWeekInMonth the daylight savings starting + * day-of-week-in-month. Please see the member description for an example. + * @param dayOfWeek the daylight savings starting day-of-week. Please see + * the member description for an example. + * @param time the daylight savings starting time. Please see the member + * description for an example. + * @param mode whether the time is local wall time, local standard time, + * or UTC time. Default is local wall time. + * @param status An UErrorCode + * @stable ICU 2.0 + */ + void setStartRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek, + int32_t time, TimeMode mode, UErrorCode& status); + + /** + * Sets the DST start rule to a fixed date within a month. + * + * @param month The month in which this rule occurs (0-based). + * @param dayOfMonth The date in that month (1-based). + * @param time The time of that day (number of millis after midnight) + * when DST takes effect in local wall time, which is + * standard time in this case. + * @param status An UErrorCode + * @stable ICU 2.0 + */ + void setStartRule(int32_t month, int32_t dayOfMonth, int32_t time, + UErrorCode& status); + /** + * Sets the DST start rule to a fixed date within a month. + * + * @param month The month in which this rule occurs (0-based). + * @param dayOfMonth The date in that month (1-based). + * @param time The time of that day (number of millis after midnight) + * when DST takes effect in local wall time, which is + * standard time in this case. + * @param mode whether the time is local wall time, local standard time, + * or UTC time. Default is local wall time. + * @param status An UErrorCode + * @stable ICU 2.0 + */ + void setStartRule(int32_t month, int32_t dayOfMonth, int32_t time, + TimeMode mode, UErrorCode& status); + + /** + * Sets the DST start rule to a weekday before or after a give date within + * a month, e.g., the first Monday on or after the 8th. + * + * @param month The month in which this rule occurs (0-based). + * @param dayOfMonth A date within that month (1-based). + * @param dayOfWeek The day of the week on which this rule occurs. + * @param time The time of that day (number of millis after midnight) + * when DST takes effect in local wall time, which is + * standard time in this case. + * @param after If true, this rule selects the first dayOfWeek on + * or after dayOfMonth. If false, this rule selects + * the last dayOfWeek on or before dayOfMonth. + * @param status An UErrorCode + * @stable ICU 2.0 + */ + void setStartRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, + int32_t time, UBool after, UErrorCode& status); + /** + * Sets the DST start rule to a weekday before or after a give date within + * a month, e.g., the first Monday on or after the 8th. + * + * @param month The month in which this rule occurs (0-based). + * @param dayOfMonth A date within that month (1-based). + * @param dayOfWeek The day of the week on which this rule occurs. + * @param time The time of that day (number of millis after midnight) + * when DST takes effect in local wall time, which is + * standard time in this case. + * @param mode whether the time is local wall time, local standard time, + * or UTC time. Default is local wall time. + * @param after If true, this rule selects the first dayOfWeek on + * or after dayOfMonth. If false, this rule selects + * the last dayOfWeek on or before dayOfMonth. + * @param status An UErrorCode + * @stable ICU 2.0 + */ + void setStartRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, + int32_t time, TimeMode mode, UBool after, UErrorCode& status); + + /** + * Sets the daylight savings ending rule. For example, if Daylight + * Savings Time ends at the last (-1) Sunday in October, at 2 AM in standard time. + * Therefore, you can set the end rule by calling: + *
+     *    setEndRule(UCAL_OCTOBER, -1, UCAL_SUNDAY, 2*60*60*1000);
+     * 
+ * Various other types of rules can be specified by manipulating the dayOfWeek + * and dayOfWeekInMonth parameters. For complete details, see the documentation + * for setStartRule(). + * + * @param month the daylight savings ending month. Month is 0-based. + * eg, 0 for January. + * @param dayOfWeekInMonth the daylight savings ending + * day-of-week-in-month. See setStartRule() for a complete explanation. + * @param dayOfWeek the daylight savings ending day-of-week. See setStartRule() + * for a complete explanation. + * @param time the daylight savings ending time. Please see the member + * description for an example. + * @param status An UErrorCode + * @stable ICU 2.0 + */ + void setEndRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek, + int32_t time, UErrorCode& status); + + /** + * Sets the daylight savings ending rule. For example, if Daylight + * Savings Time ends at the last (-1) Sunday in October, at 2 AM in standard time. + * Therefore, you can set the end rule by calling: + *
+     *    setEndRule(UCAL_OCTOBER, -1, UCAL_SUNDAY, 2*60*60*1000);
+     * 
+ * Various other types of rules can be specified by manipulating the dayOfWeek + * and dayOfWeekInMonth parameters. For complete details, see the documentation + * for setStartRule(). + * + * @param month the daylight savings ending month. Month is 0-based. + * eg, 0 for January. + * @param dayOfWeekInMonth the daylight savings ending + * day-of-week-in-month. See setStartRule() for a complete explanation. + * @param dayOfWeek the daylight savings ending day-of-week. See setStartRule() + * for a complete explanation. + * @param time the daylight savings ending time. Please see the member + * description for an example. + * @param mode whether the time is local wall time, local standard time, + * or UTC time. Default is local wall time. + * @param status An UErrorCode + * @stable ICU 2.0 + */ + void setEndRule(int32_t month, int32_t dayOfWeekInMonth, int32_t dayOfWeek, + int32_t time, TimeMode mode, UErrorCode& status); + + /** + * Sets the DST end rule to a fixed date within a month. + * + * @param month The month in which this rule occurs (0-based). + * @param dayOfMonth The date in that month (1-based). + * @param time The time of that day (number of millis after midnight) + * when DST ends in local wall time, which is daylight + * time in this case. + * @param status An UErrorCode + * @stable ICU 2.0 + */ + void setEndRule(int32_t month, int32_t dayOfMonth, int32_t time, UErrorCode& status); + + /** + * Sets the DST end rule to a fixed date within a month. + * + * @param month The month in which this rule occurs (0-based). + * @param dayOfMonth The date in that month (1-based). + * @param time The time of that day (number of millis after midnight) + * when DST ends in local wall time, which is daylight + * time in this case. + * @param mode whether the time is local wall time, local standard time, + * or UTC time. Default is local wall time. + * @param status An UErrorCode + * @stable ICU 2.0 + */ + void setEndRule(int32_t month, int32_t dayOfMonth, int32_t time, + TimeMode mode, UErrorCode& status); + + /** + * Sets the DST end rule to a weekday before or after a give date within + * a month, e.g., the first Monday on or after the 8th. + * + * @param month The month in which this rule occurs (0-based). + * @param dayOfMonth A date within that month (1-based). + * @param dayOfWeek The day of the week on which this rule occurs. + * @param time The time of that day (number of millis after midnight) + * when DST ends in local wall time, which is daylight + * time in this case. + * @param after If true, this rule selects the first dayOfWeek on + * or after dayOfMonth. If false, this rule selects + * the last dayOfWeek on or before dayOfMonth. + * @param status An UErrorCode + * @stable ICU 2.0 + */ + void setEndRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, + int32_t time, UBool after, UErrorCode& status); + + /** + * Sets the DST end rule to a weekday before or after a give date within + * a month, e.g., the first Monday on or after the 8th. + * + * @param month The month in which this rule occurs (0-based). + * @param dayOfMonth A date within that month (1-based). + * @param dayOfWeek The day of the week on which this rule occurs. + * @param time The time of that day (number of millis after midnight) + * when DST ends in local wall time, which is daylight + * time in this case. + * @param mode whether the time is local wall time, local standard time, + * or UTC time. Default is local wall time. + * @param after If true, this rule selects the first dayOfWeek on + * or after dayOfMonth. If false, this rule selects + * the last dayOfWeek on or before dayOfMonth. + * @param status An UErrorCode + * @stable ICU 2.0 + */ + void setEndRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, + int32_t time, TimeMode mode, UBool after, UErrorCode& status); + + /** + * Returns the TimeZone's adjusted GMT offset (i.e., the number of milliseconds to add + * to GMT to get local time in this time zone, taking daylight savings time into + * account) as of a particular reference date. The reference date is used to determine + * whether daylight savings time is in effect and needs to be figured into the offset + * that is returned (in other words, what is the adjusted GMT offset in this time zone + * at this particular date and time?). For the time zones produced by createTimeZone(), + * the reference data is specified according to the Gregorian calendar, and the date + * and time fields are in GMT, NOT local time. + * + * @param era The reference date's era + * @param year The reference date's year + * @param month The reference date's month (0-based; 0 is January) + * @param day The reference date's day-in-month (1-based) + * @param dayOfWeek The reference date's day-of-week (1-based; 1 is Sunday) + * @param millis The reference date's milliseconds in day, UTT (NOT local time). + * @param status An UErrorCode to receive the status. + * @return The offset in milliseconds to add to GMT to get local time. + * @stable ICU 2.0 + */ + virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day, + uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const; + + /** + * Gets the time zone offset, for current date, modified in case of + * daylight savings. This is the offset to add *to* UTC to get local time. + * @param era the era of the given date. + * @param year the year in the given date. + * @param month the month in the given date. + * Month is 0-based. e.g., 0 for January. + * @param day the day-in-month of the given date. + * @param dayOfWeek the day-of-week of the given date. + * @param milliseconds the millis in day in standard local time. + * @param monthLength the length of the given month in days. + * @param status An UErrorCode to receive the status. + * @return the offset to add *to* GMT to get local time. + * @stable ICU 2.0 + */ + virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day, + uint8_t dayOfWeek, int32_t milliseconds, + int32_t monthLength, UErrorCode& status) const; + /** + * Gets the time zone offset, for current date, modified in case of + * daylight savings. This is the offset to add *to* UTC to get local time. + * @param era the era of the given date. + * @param year the year in the given date. + * @param month the month in the given date. + * Month is 0-based. e.g., 0 for January. + * @param day the day-in-month of the given date. + * @param dayOfWeek the day-of-week of the given date. + * @param milliseconds the millis in day in standard local time. + * @param monthLength the length of the given month in days. + * @param prevMonthLength length of the previous month in days. + * @param status An UErrorCode to receive the status. + * @return the offset to add *to* GMT to get local time. + * @stable ICU 2.0 + */ + virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day, + uint8_t dayOfWeek, int32_t milliseconds, + int32_t monthLength, int32_t prevMonthLength, + UErrorCode& status) const; + + /** + * Redeclared TimeZone method. This implementation simply calls + * the base class method, which otherwise would be hidden. + * @stable ICU 2.8 + */ + virtual void getOffset(UDate date, UBool local, int32_t& rawOffset, + int32_t& dstOffset, UErrorCode& ec) const; + + /** + * Get time zone offsets from local wall time. + * @internal + */ + virtual void getOffsetFromLocal(UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt, + int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) const; + + /** + * Returns the TimeZone's raw GMT offset (i.e., the number of milliseconds to add + * to GMT to get local time, before taking daylight savings time into account). + * + * @return The TimeZone's raw GMT offset. + * @stable ICU 2.0 + */ + virtual int32_t getRawOffset(void) const; + + /** + * Sets the TimeZone's raw GMT offset (i.e., the number of milliseconds to add + * to GMT to get local time, before taking daylight savings time into account). + * + * @param offsetMillis The new raw GMT offset for this time zone. + * @stable ICU 2.0 + */ + virtual void setRawOffset(int32_t offsetMillis); + + /** + * Sets the amount of time in ms that the clock is advanced during DST. + * @param millisSavedDuringDST the number of milliseconds the time is + * advanced with respect to standard time when the daylight savings rules + * are in effect. A positive number, typically one hour (3600000). + * @param status An UErrorCode to receive the status. + * @stable ICU 2.0 + */ + void setDSTSavings(int32_t millisSavedDuringDST, UErrorCode& status); + + /** + * Returns the amount of time in ms that the clock is advanced during DST. + * @return the number of milliseconds the time is + * advanced with respect to standard time when the daylight savings rules + * are in effect. A positive number, typically one hour (3600000). + * @stable ICU 2.0 + */ + virtual int32_t getDSTSavings(void) const; + + /** + * Queries if this TimeZone uses Daylight Savings Time. + * + * @return True if this TimeZone uses Daylight Savings Time; false otherwise. + * @stable ICU 2.0 + */ + virtual UBool useDaylightTime(void) const; + + /** + * Returns true if the given date is within the period when daylight savings time + * is in effect; false otherwise. If the TimeZone doesn't observe daylight savings + * time, this functions always returns false. + * This method is wasteful since it creates a new GregorianCalendar and + * deletes it each time it is called. This is a deprecated method + * and provided only for Java compatibility. + * + * @param date The date to test. + * @param status An UErrorCode to receive the status. + * @return true if the given date is in Daylight Savings Time; + * false otherwise. + * @deprecated ICU 2.4. Use Calendar::inDaylightTime() instead. + */ + virtual UBool inDaylightTime(UDate date, UErrorCode& status) const; + + /** + * Return true if this zone has the same rules and offset as another zone. + * @param other the TimeZone object to be compared with + * @return true if the given zone has the same rules and offset as this one + * @stable ICU 2.0 + */ + UBool hasSameRules(const TimeZone& other) const; + + /** + * Clones TimeZone objects polymorphically. Clients are responsible for deleting + * the TimeZone object cloned. + * + * @return A new copy of this TimeZone object. + * @stable ICU 2.0 + */ + virtual TimeZone* clone(void) const; + + /** + * Gets the first time zone transition after the base time. + * @param base The base time. + * @param inclusive Whether the base time is inclusive or not. + * @param result Receives the first transition after the base time. + * @return TRUE if the transition is found. + * @stable ICU 3.8 + */ + virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const; + + /** + * Gets the most recent time zone transition before the base time. + * @param base The base time. + * @param inclusive Whether the base time is inclusive or not. + * @param result Receives the most recent transition before the base time. + * @return TRUE if the transition is found. + * @stable ICU 3.8 + */ + virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const; + + /** + * Returns the number of TimeZoneRules which represents time transitions, + * for this time zone, that is, all TimeZoneRules for this time zone except + * InitialTimeZoneRule. The return value range is 0 or any positive value. + * @param status Receives error status code. + * @return The number of TimeZoneRules representing time transitions. + * @stable ICU 3.8 + */ + virtual int32_t countTransitionRules(UErrorCode& status) const; + + /** + * Gets the InitialTimeZoneRule and the set of TimeZoneRule + * which represent time transitions for this time zone. On successful return, + * the argument initial points to non-NULL InitialTimeZoneRule and + * the array trsrules is filled with 0 or multiple TimeZoneRule + * instances up to the size specified by trscount. The results are referencing the + * rule instance held by this time zone instance. Therefore, after this time zone + * is destructed, they are no longer available. + * @param initial Receives the initial timezone rule + * @param trsrules Receives the timezone transition rules + * @param trscount On input, specify the size of the array 'transitions' receiving + * the timezone transition rules. On output, actual number of + * rules filled in the array will be set. + * @param status Receives error status code. + * @stable ICU 3.8 + */ + virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial, + const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) const; + + +public: + + /** + * Override TimeZone Returns a unique class ID POLYMORPHICALLY. Pure virtual + * override. This method is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and clone() methods call + * this method. + * + * @return The class ID for this object. All objects of a given class have the + * same class ID. Objects of other classes have different class IDs. + * @stable ICU 2.0 + */ + virtual UClassID getDynamicClassID(void) const; + + /** + * Return the class ID for this class. This is useful only for comparing to a return + * value from getDynamicClassID(). For example: + *
+     * .   Base* polymorphic_pointer = createPolymorphicObject();
+     * .   if (polymorphic_pointer->getDynamicClassID() ==
+     * .       Derived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @stable ICU 2.0 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + +private: + /** + * Constants specifying values of startMode and endMode. + */ + enum EMode + { + DOM_MODE = 1, + DOW_IN_MONTH_MODE, + DOW_GE_DOM_MODE, + DOW_LE_DOM_MODE + }; + + SimpleTimeZone(); // default constructor not implemented + + /** + * Internal construction method. + * @param rawOffsetGMT The new SimpleTimeZone's raw GMT offset + * @param startMonth the month DST starts + * @param startDay the day DST starts + * @param startDayOfWeek the DOW DST starts + * @param startTime the time DST starts + * @param startTimeMode Whether the start time is local wall time, local + * standard time, or UTC time. Default is local wall time. + * @param endMonth the month DST ends + * @param endDay the day DST ends + * @param endDayOfWeek the DOW DST ends + * @param endTime the time DST ends + * @param endTimeMode Whether the end time is local wall time, local + * standard time, or UTC time. Default is local wall time. + * @param dstSavings The number of milliseconds added to standard time + * to get DST time. Default is one hour. + * @param status An UErrorCode to receive the status. + */ + void construct(int32_t rawOffsetGMT, + int8_t startMonth, int8_t startDay, int8_t startDayOfWeek, + int32_t startTime, TimeMode startTimeMode, + int8_t endMonth, int8_t endDay, int8_t endDayOfWeek, + int32_t endTime, TimeMode endTimeMode, + int32_t dstSavings, UErrorCode& status); + + /** + * Compare a given date in the year to a rule. Return 1, 0, or -1, depending + * on whether the date is after, equal to, or before the rule date. The + * millis are compared directly against the ruleMillis, so any + * standard-daylight adjustments must be handled by the caller. + * + * @return 1 if the date is after the rule date, -1 if the date is before + * the rule date, or 0 if the date is equal to the rule date. + */ + static int32_t compareToRule(int8_t month, int8_t monthLen, int8_t prevMonthLen, + int8_t dayOfMonth, + int8_t dayOfWeek, int32_t millis, int32_t millisDelta, + EMode ruleMode, int8_t ruleMonth, int8_t ruleDayOfWeek, + int8_t ruleDay, int32_t ruleMillis); + + /** + * Given a set of encoded rules in startDay and startDayOfMonth, decode + * them and set the startMode appropriately. Do the same for endDay and + * endDayOfMonth. + *

+ * Upon entry, the day of week variables may be zero or + * negative, in order to indicate special modes. The day of month + * variables may also be negative. + *

+ * Upon exit, the mode variables will be + * set, and the day of week and day of month variables will be positive. + *

+ * This method also recognizes a startDay or endDay of zero as indicating + * no DST. + */ + void decodeRules(UErrorCode& status); + void decodeStartRule(UErrorCode& status); + void decodeEndRule(UErrorCode& status); + + int8_t startMonth, startDay, startDayOfWeek; // the month, day, DOW, and time DST starts + int32_t startTime; + TimeMode startTimeMode, endTimeMode; // Mode for startTime, endTime; see TimeMode + int8_t endMonth, endDay, endDayOfWeek; // the month, day, DOW, and time DST ends + int32_t endTime; + int32_t startYear; // the year these DST rules took effect + int32_t rawOffset; // the TimeZone's raw GMT offset + UBool useDaylight; // flag indicating whether this TimeZone uses DST + static const int8_t STATICMONTHLENGTH[12]; // lengths of the months + EMode startMode, endMode; // flags indicating what kind of rules the DST rules are + + /** + * A positive value indicating the amount of time saved during DST in ms. + * Typically one hour; sometimes 30 minutes. + */ + int32_t dstSavings; + + /* Private for BasicTimeZone implementation */ + void checkTransitionRules(UErrorCode& status) const; + void initTransitionRules(UErrorCode& status); + void clearTransitionRules(void); + void deleteTransitionRules(void); + UBool transitionRulesInitialized; + InitialTimeZoneRule* initialRule; + TimeZoneTransition* firstTransition; + AnnualTimeZoneRule* stdRule; + AnnualTimeZoneRule* dstRule; +}; + +inline void SimpleTimeZone::setStartRule(int32_t month, int32_t dayOfWeekInMonth, + int32_t dayOfWeek, + int32_t time, UErrorCode& status) { + setStartRule(month, dayOfWeekInMonth, dayOfWeek, time, WALL_TIME, status); +} + +inline void SimpleTimeZone::setStartRule(int32_t month, int32_t dayOfMonth, + int32_t time, + UErrorCode& status) { + setStartRule(month, dayOfMonth, time, WALL_TIME, status); +} + +inline void SimpleTimeZone::setStartRule(int32_t month, int32_t dayOfMonth, + int32_t dayOfWeek, + int32_t time, UBool after, UErrorCode& status) { + setStartRule(month, dayOfMonth, dayOfWeek, time, WALL_TIME, after, status); +} + +inline void SimpleTimeZone::setEndRule(int32_t month, int32_t dayOfWeekInMonth, + int32_t dayOfWeek, + int32_t time, UErrorCode& status) { + setEndRule(month, dayOfWeekInMonth, dayOfWeek, time, WALL_TIME, status); +} + +inline void SimpleTimeZone::setEndRule(int32_t month, int32_t dayOfMonth, + int32_t time, UErrorCode& status) { + setEndRule(month, dayOfMonth, time, WALL_TIME, status); +} + +inline void SimpleTimeZone::setEndRule(int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, + int32_t time, UBool after, UErrorCode& status) { + setEndRule(month, dayOfMonth, dayOfWeek, time, WALL_TIME, after, status); +} + +inline void +SimpleTimeZone::getOffset(UDate date, UBool local, int32_t& rawOffsetRef, + int32_t& dstOffsetRef, UErrorCode& ec) const { + TimeZone::getOffset(date, local, rawOffsetRef, dstOffsetRef, ec); +} + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // _SIMPLETZ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/smpdtfmt.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/smpdtfmt.h new file mode 100644 index 0000000..9801b29 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/smpdtfmt.h @@ -0,0 +1,1630 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +* Copyright (C) 1997-2016, International Business Machines Corporation and +* others. All Rights Reserved. +******************************************************************************* +* +* File SMPDTFMT.H +* +* Modification History: +* +* Date Name Description +* 02/19/97 aliu Converted from java. +* 07/09/97 helena Make ParsePosition into a class. +* 07/21/98 stephen Added GMT_PLUS, GMT_MINUS +* Changed setTwoDigitStartDate to set2DigitYearStart +* Changed getTwoDigitStartDate to get2DigitYearStart +* Removed subParseLong +* Removed getZoneIndex (added in DateFormatSymbols) +* 06/14/99 stephen Removed fgTimeZoneDataSuffix +* 10/14/99 aliu Updated class doc to describe 2-digit year parsing +* {j28 4182066}. +******************************************************************************* +*/ + +#ifndef SMPDTFMT_H +#define SMPDTFMT_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Format and parse dates in a language-independent manner. + */ + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/datefmt.h" +#include "unicode/udisplaycontext.h" +#include "unicode/tzfmt.h" /* for UTimeZoneFormatTimeType */ +#include "unicode/brkiter.h" + +U_NAMESPACE_BEGIN + +class DateFormatSymbols; +class DateFormat; +class MessageFormat; +class FieldPositionHandler; +class TimeZoneFormat; +class SharedNumberFormat; +class SimpleDateFormatMutableNFs; + +/** + * + * SimpleDateFormat is a concrete class for formatting and parsing dates in a + * language-independent manner. It allows for formatting (millis -> text), + * parsing (text -> millis), and normalization. Formats/Parses a date or time, + * which is the standard milliseconds since 24:00 GMT, Jan 1, 1970. + *

+ * Clients are encouraged to create a date-time formatter using DateFormat::getInstance(), + * getDateInstance(), getDateInstance(), or getDateTimeInstance() rather than + * explicitly constructing an instance of SimpleDateFormat. This way, the client + * is guaranteed to get an appropriate formatting pattern for whatever locale the + * program is running in. However, if the client needs something more unusual than + * the default patterns in the locales, he can construct a SimpleDateFormat directly + * and give it an appropriate pattern (or use one of the factory methods on DateFormat + * and modify the pattern after the fact with toPattern() and applyPattern(). + * + *

Date and Time Patterns:

+ * + *

Date and time formats are specified by date and time pattern strings. + * Within date and time pattern strings, all unquoted ASCII letters [A-Za-z] are reserved + * as pattern letters representing calendar fields. SimpleDateFormat supports + * the date and time formatting algorithm and pattern letters defined by + * UTS#35 + * Unicode Locale Data Markup Language (LDML) and further documented for ICU in the + * ICU + * User Guide. The following pattern letters are currently available (note that the actual + * values depend on CLDR and may change from the examples shown here):

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
FieldSym.No.ExampleDescription
eraG1..3ADEra - Replaced with the Era string for the current date. One to three letters for the + * abbreviated form, four letters for the long (wide) form, five for the narrow form.
4Anno Domini
5A
yeary1..n1996Year. Normally the length specifies the padding, but for two letters it also specifies the maximum + * length. Example:
+ *
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Yearyyyyyyyyyyyyyyy
AD 1101001000100001
AD 121212012001200012
AD 12312323123012300123
AD 12341234341234123401234
AD 123451234545123451234512345
+ *
+ *
Y1..n1997Year (in "Week of Year" based calendars). Normally the length specifies the padding, + * but for two letters it also specifies the maximum length. This year designation is used in ISO + * year-week calendar as defined by ISO 8601, but can be used in non-Gregorian based calendar systems + * where week date processing is desired. May not always be the same value as calendar year.
u1..n4601Extended year. This is a single number designating the year of this calendar system, encompassing + * all supra-year fields. For example, for the Julian calendar system, year numbers are positive, with an + * era of BCE or CE. An extended year value for the Julian calendar system assigns positive values to CE + * years and negative values to BCE years, with 1 BCE being year 0.
U1..3甲子Cyclic year name. Calendars such as the Chinese lunar calendar (and related calendars) + * and the Hindu calendars use 60-year cycles of year names. Use one through three letters for the abbreviated + * name, four for the full (wide) name, or five for the narrow name (currently the data only provides abbreviated names, + * which will be used for all requested name widths). If the calendar does not provide cyclic year name data, + * or if the year value to be formatted is out of the range of years for which cyclic name data is provided, + * then numeric formatting is used (behaves like 'y').
4(currently also 甲子)
5(currently also 甲子)
quarterQ1..202Quarter - Use one or two for the numerical quarter, three for the abbreviation, or four for the + * full (wide) name (five for the narrow name is not yet supported).
3Q2
42nd quarter
q1..202Stand-Alone Quarter - Use one or two for the numerical quarter, three for the abbreviation, + * or four for the full name (five for the narrow name is not yet supported).
3Q2
42nd quarter
monthM1..209Month - Use one or two for the numerical month, three for the abbreviation, four for + * the full (wide) name, or five for the narrow name. With two ("MM"), the month number is zero-padded + * if necessary (e.g. "08")
3Sep
4September
5S
L1..209Stand-Alone Month - Use one or two for the numerical month, three for the abbreviation, + * four for the full (wide) name, or 5 for the narrow name. With two ("LL"), the month number is zero-padded if + * necessary (e.g. "08")
3Sep
4September
5S
weekw1..227Week of Year. Use "w" to show the minimum number of digits, or "ww" to always show two digits + * (zero-padding if necessary, e.g. "08").
W13Week of Month
dayd1..21Date - Day of the month. Use "d" to show the minimum number of digits, or "dd" to always show + * two digits (zero-padding if necessary, e.g. "08").
D1..3345Day of year
F12Day of Week in Month. The example is for the 2nd Wed in July
g1..n2451334Modified Julian day. This is different from the conventional Julian day number in two regards. + * First, it demarcates days at local zone midnight, rather than noon GMT. Second, it is a local number; + * that is, it depends on the local time zone. It can be thought of as a single number that encompasses + * all the date-related fields.
week
+ * day
E1..3TueDay of week - Use one through three letters for the short day, four for the full (wide) name, + * five for the narrow name, or six for the short name.
4Tuesday
5T
6Tu
e1..22Local day of week. Same as E except adds a numeric value that will depend on the local + * starting day of the week, using one or two letters. For this example, Monday is the first day of the week.
3Tue
4Tuesday
5T
6Tu
c12Stand-Alone local day of week - Use one letter for the local numeric value (same + * as 'e'), three for the short day, four for the full (wide) name, five for the narrow name, or six for + * the short name.
3Tue
4Tuesday
5T
6Tu
perioda1AMAM or PM
hourh1..211Hour [1-12]. When used in skeleton data or in a skeleton passed in an API for flexible data pattern + * generation, it should match the 12-hour-cycle format preferred by the locale (h or K); it should not match + * a 24-hour-cycle format (H or k). Use hh for zero padding.
H1..213Hour [0-23]. When used in skeleton data or in a skeleton passed in an API for flexible data pattern + * generation, it should match the 24-hour-cycle format preferred by the locale (H or k); it should not match a + * 12-hour-cycle format (h or K). Use HH for zero padding.
K1..20Hour [0-11]. When used in a skeleton, only matches K or h, see above. Use KK for zero padding.
k1..224Hour [1-24]. When used in a skeleton, only matches k or H, see above. Use kk for zero padding.
minutem1..259Minute. Use "m" to show the minimum number of digits, or "mm" to always show two digits + * (zero-padding if necessary, e.g. "08").
seconds1..212Second. Use "s" to show the minimum number of digits, or "ss" to always show two digits + * (zero-padding if necessary, e.g. "08").
S1..n3450Fractional Second - truncates (like other time fields) to the count of letters when formatting. + * Appends zeros if more than 3 letters specified. Truncates at three significant digits when parsing. + * (example shows display using pattern SSSS for seconds value 12.34567)
A1..n69540000Milliseconds in day. This field behaves exactly like a composite of all time-related fields, + * not including the zone fields. As such, it also reflects discontinuities of those fields on DST transition + * days. On a day of DST onset, it will jump forward. On a day of DST cessation, it will jump backward. This + * reflects the fact that is must be combined with the offset field to obtain a unique local time value.
zonez1..3PDTThe short specific non-location format. + * Where that is unavailable, falls back to the short localized GMT format ("O").
4Pacific Daylight TimeThe long specific non-location format. + * Where that is unavailable, falls back to the long localized GMT format ("OOOO").
Z1..3-0800The ISO8601 basic format with hours, minutes and optional seconds fields. + * The format is equivalent to RFC 822 zone format (when optional seconds field is absent). + * This is equivalent to the "xxxx" specifier.
4GMT-8:00The long localized GMT format. + * This is equivalent to the "OOOO" specifier.
5-08:00
+ * -07:52:58
The ISO8601 extended format with hours, minutes and optional seconds fields. + * The ISO8601 UTC indicator "Z" is used when local time offset is 0. + * This is equivalent to the "XXXXX" specifier.
O1GMT-8The short localized GMT format.
4GMT-08:00The long localized GMT format.
v1PTThe short generic non-location format. + * Where that is unavailable, falls back to the generic location format ("VVVV"), + * then the short localized GMT format as the final fallback.
4Pacific TimeThe long generic non-location format. + * Where that is unavailable, falls back to generic location format ("VVVV"). + *
V1uslaxThe short time zone ID. + * Where that is unavailable, the special short time zone ID unk (Unknown Zone) is used.
+ * Note: This specifier was originally used for a variant of the short specific non-location format, + * but it was deprecated in the later version of the LDML specification. In CLDR 23/ICU 51, the definition of + * the specifier was changed to designate a short time zone ID.
2America/Los_AngelesThe long time zone ID.
3Los AngelesThe exemplar city (location) for the time zone. + * Where that is unavailable, the localized exemplar city name for the special zone Etc/Unknown is used + * as the fallback (for example, "Unknown City").
4Los Angeles TimeThe generic location format. + * Where that is unavailable, falls back to the long localized GMT format ("OOOO"; + * Note: Fallback is only necessary with a GMT-style Time Zone ID, like Etc/GMT-830.)
+ * This is especially useful when presenting possible timezone choices for user selection, + * since the naming is more uniform than the "v" format.
X1-08
+ * +0530
+ * Z
The ISO8601 basic format with hours field and optional minutes field. + * The ISO8601 UTC indicator "Z" is used when local time offset is 0.
2-0800
+ * Z
The ISO8601 basic format with hours and minutes fields. + * The ISO8601 UTC indicator "Z" is used when local time offset is 0.
3-08:00
+ * Z
The ISO8601 extended format with hours and minutes fields. + * The ISO8601 UTC indicator "Z" is used when local time offset is 0.
4-0800
+ * -075258
+ * Z
The ISO8601 basic format with hours, minutes and optional seconds fields. + * (Note: The seconds field is not supported by the ISO8601 specification.) + * The ISO8601 UTC indicator "Z" is used when local time offset is 0.
5-08:00
+ * -07:52:58
+ * Z
The ISO8601 extended format with hours, minutes and optional seconds fields. + * (Note: The seconds field is not supported by the ISO8601 specification.) + * The ISO8601 UTC indicator "Z" is used when local time offset is 0.
x1-08
+ * +0530
The ISO8601 basic format with hours field and optional minutes field.
2-0800The ISO8601 basic format with hours and minutes fields.
3-08:00The ISO8601 extended format with hours and minutes fields.
4-0800
+ * -075258
The ISO8601 basic format with hours, minutes and optional seconds fields. + * (Note: The seconds field is not supported by the ISO8601 specification.)
5-08:00
+ * -07:52:58
The ISO8601 extended format with hours, minutes and optional seconds fields. + * (Note: The seconds field is not supported by the ISO8601 specification.)
+ * + *

+ * Any characters in the pattern that are not in the ranges of ['a'..'z'] and + * ['A'..'Z'] will be treated as quoted text. For instance, characters + * like ':', '.', ' ', '#' and '@' will appear in the resulting time text + * even they are not embraced within single quotes. + *

+ * A pattern containing any invalid pattern letter will result in a failing + * UErrorCode result during formatting or parsing. + *

+ * Examples using the US locale: + *

+ * \code
+ *    Format Pattern                         Result
+ *    --------------                         -------
+ *    "yyyy.MM.dd G 'at' HH:mm:ss vvvv" ->>  1996.07.10 AD at 15:08:56 Pacific Time
+ *    "EEE, MMM d, ''yy"                ->>  Wed, July 10, '96
+ *    "h:mm a"                          ->>  12:08 PM
+ *    "hh 'o''clock' a, zzzz"           ->>  12 o'clock PM, Pacific Daylight Time
+ *    "K:mm a, vvv"                     ->>  0:00 PM, PT
+ *    "yyyyy.MMMMM.dd GGG hh:mm aaa"    ->>  1996.July.10 AD 12:08 PM
+ * \endcode
+ * 
+ * Code Sample: + *
+ * \code
+ *     UErrorCode success = U_ZERO_ERROR;
+ *     SimpleTimeZone* pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, "PST");
+ *     pdt->setStartRule( Calendar::APRIL, 1, Calendar::SUNDAY, 2*60*60*1000);
+ *     pdt->setEndRule( Calendar::OCTOBER, -1, Calendar::SUNDAY, 2*60*60*1000);
+ *
+ *     // Format the current time.
+ *     SimpleDateFormat* formatter
+ *         = new SimpleDateFormat ("yyyy.MM.dd G 'at' hh:mm:ss a zzz", success );
+ *     GregorianCalendar cal(success);
+ *     UDate currentTime_1 = cal.getTime(success);
+ *     FieldPosition fp(FieldPosition::DONT_CARE);
+ *     UnicodeString dateString;
+ *     formatter->format( currentTime_1, dateString, fp );
+ *     cout << "result: " << dateString << endl;
+ *
+ *     // Parse the previous string back into a Date.
+ *     ParsePosition pp(0);
+ *     UDate currentTime_2 = formatter->parse(dateString, pp );
+ * \endcode
+ * 
+ * In the above example, the time value "currentTime_2" obtained from parsing + * will be equal to currentTime_1. However, they may not be equal if the am/pm + * marker 'a' is left out from the format pattern while the "hour in am/pm" + * pattern symbol is used. This information loss can happen when formatting the + * time in PM. + * + *

+ * When parsing a date string using the abbreviated year pattern ("y" or "yy"), + * SimpleDateFormat must interpret the abbreviated year + * relative to some century. It does this by adjusting dates to be + * within 80 years before and 20 years after the time the SimpleDateFormat + * instance is created. For example, using a pattern of "MM/dd/yy" and a + * SimpleDateFormat instance created on Jan 1, 1997, the string + * "01/11/12" would be interpreted as Jan 11, 2012 while the string "05/04/64" + * would be interpreted as May 4, 1964. + * During parsing, only strings consisting of exactly two digits, as defined by + * Unicode::isDigit(), will be parsed into the default century. + * Any other numeric string, such as a one digit string, a three or more digit + * string, or a two digit string that isn't all digits (for example, "-1"), is + * interpreted literally. So "01/02/3" or "01/02/003" are parsed (for the + * Gregorian calendar), using the same pattern, as Jan 2, 3 AD. Likewise (but + * only in lenient parse mode, the default) "01/02/-3" is parsed as Jan 2, 4 BC. + * + *

+ * If the year pattern has more than two 'y' characters, the year is + * interpreted literally, regardless of the number of digits. So using the + * pattern "MM/dd/yyyy", "01/11/12" parses to Jan 11, 12 A.D. + * + *

+ * When numeric fields abut one another directly, with no intervening delimiter + * characters, they constitute a run of abutting numeric fields. Such runs are + * parsed specially. For example, the format "HHmmss" parses the input text + * "123456" to 12:34:56, parses the input text "12345" to 1:23:45, and fails to + * parse "1234". In other words, the leftmost field of the run is flexible, + * while the others keep a fixed width. If the parse fails anywhere in the run, + * then the leftmost field is shortened by one character, and the entire run is + * parsed again. This is repeated until either the parse succeeds or the + * leftmost field is one character in length. If the parse still fails at that + * point, the parse of the run fails. + * + *

+ * For time zones that have no names, SimpleDateFormat uses strings GMT+hours:minutes or + * GMT-hours:minutes. + *

+ * The calendar defines what is the first day of the week, the first week of the + * year, whether hours are zero based or not (0 vs 12 or 24), and the timezone. + * There is one common number format to handle all the numbers; the digit count + * is handled programmatically according to the pattern. + * + *

User subclasses are not supported. While clients may write + * subclasses, such code will not necessarily work and will not be + * guaranteed to work stably from release to release. + */ +class U_I18N_API SimpleDateFormat: public DateFormat { +public: + /** + * Construct a SimpleDateFormat using the default pattern for the default + * locale. + *

+ * [Note:] Not all locales support SimpleDateFormat; for full generality, + * use the factory methods in the DateFormat class. + * @param status Output param set to success/failure code. + * @stable ICU 2.0 + */ + SimpleDateFormat(UErrorCode& status); + + /** + * Construct a SimpleDateFormat using the given pattern and the default locale. + * The locale is used to obtain the symbols used in formatting (e.g., the + * names of the months), but not to provide the pattern. + *

+ * [Note:] Not all locales support SimpleDateFormat; for full generality, + * use the factory methods in the DateFormat class. + * @param pattern the pattern for the format. + * @param status Output param set to success/failure code. + * @stable ICU 2.0 + */ + SimpleDateFormat(const UnicodeString& pattern, + UErrorCode& status); + + /** + * Construct a SimpleDateFormat using the given pattern, numbering system override, and the default locale. + * The locale is used to obtain the symbols used in formatting (e.g., the + * names of the months), but not to provide the pattern. + *

+ * A numbering system override is a string containing either the name of a known numbering system, + * or a set of field and numbering system pairs that specify which fields are to be formattied with + * the alternate numbering system. For example, to specify that all numeric fields in the specified + * date or time pattern are to be rendered using Thai digits, simply specify the numbering system override + * as "thai". To specify that just the year portion of the date be formatted using Hebrew numbering, + * use the override string "y=hebrew". Numbering system overrides can be combined using a semi-colon + * character in the override string, such as "d=decimal;M=arabic;y=hebrew", etc. + * + *

+ * [Note:] Not all locales support SimpleDateFormat; for full generality, + * use the factory methods in the DateFormat class. + * @param pattern the pattern for the format. + * @param override the override string. + * @param status Output param set to success/failure code. + * @stable ICU 4.2 + */ + SimpleDateFormat(const UnicodeString& pattern, + const UnicodeString& override, + UErrorCode& status); + + /** + * Construct a SimpleDateFormat using the given pattern and locale. + * The locale is used to obtain the symbols used in formatting (e.g., the + * names of the months), but not to provide the pattern. + *

+ * [Note:] Not all locales support SimpleDateFormat; for full generality, + * use the factory methods in the DateFormat class. + * @param pattern the pattern for the format. + * @param locale the given locale. + * @param status Output param set to success/failure code. + * @stable ICU 2.0 + */ + SimpleDateFormat(const UnicodeString& pattern, + const Locale& locale, + UErrorCode& status); + + /** + * Construct a SimpleDateFormat using the given pattern, numbering system override, and locale. + * The locale is used to obtain the symbols used in formatting (e.g., the + * names of the months), but not to provide the pattern. + *

+ * A numbering system override is a string containing either the name of a known numbering system, + * or a set of field and numbering system pairs that specify which fields are to be formattied with + * the alternate numbering system. For example, to specify that all numeric fields in the specified + * date or time pattern are to be rendered using Thai digits, simply specify the numbering system override + * as "thai". To specify that just the year portion of the date be formatted using Hebrew numbering, + * use the override string "y=hebrew". Numbering system overrides can be combined using a semi-colon + * character in the override string, such as "d=decimal;M=arabic;y=hebrew", etc. + *

+ * [Note:] Not all locales support SimpleDateFormat; for full generality, + * use the factory methods in the DateFormat class. + * @param pattern the pattern for the format. + * @param override the numbering system override. + * @param locale the given locale. + * @param status Output param set to success/failure code. + * @stable ICU 4.2 + */ + SimpleDateFormat(const UnicodeString& pattern, + const UnicodeString& override, + const Locale& locale, + UErrorCode& status); + + /** + * Construct a SimpleDateFormat using the given pattern and locale-specific + * symbol data. The formatter takes ownership of the DateFormatSymbols object; + * the caller is no longer responsible for deleting it. + * @param pattern the given pattern for the format. + * @param formatDataToAdopt the symbols to be adopted. + * @param status Output param set to success/faulure code. + * @stable ICU 2.0 + */ + SimpleDateFormat(const UnicodeString& pattern, + DateFormatSymbols* formatDataToAdopt, + UErrorCode& status); + + /** + * Construct a SimpleDateFormat using the given pattern and locale-specific + * symbol data. The DateFormatSymbols object is NOT adopted; the caller + * remains responsible for deleting it. + * @param pattern the given pattern for the format. + * @param formatData the formatting symbols to be use. + * @param status Output param set to success/faulure code. + * @stable ICU 2.0 + */ + SimpleDateFormat(const UnicodeString& pattern, + const DateFormatSymbols& formatData, + UErrorCode& status); + + /** + * Copy constructor. + * @stable ICU 2.0 + */ + SimpleDateFormat(const SimpleDateFormat&); + + /** + * Assignment operator. + * @stable ICU 2.0 + */ + SimpleDateFormat& operator=(const SimpleDateFormat&); + + /** + * Destructor. + * @stable ICU 2.0 + */ + virtual ~SimpleDateFormat(); + + /** + * Clone this Format object polymorphically. The caller owns the result and + * should delete it when done. + * @return A copy of the object. + * @stable ICU 2.0 + */ + virtual Format* clone(void) const; + + /** + * Return true if the given Format objects are semantically equal. Objects + * of different subclasses are considered unequal. + * @param other the object to be compared with. + * @return true if the given Format objects are semantically equal. + * @stable ICU 2.0 + */ + virtual UBool operator==(const Format& other) const; + + + using DateFormat::format; + + /** + * Format a date or time, which is the standard millis since 24:00 GMT, Jan + * 1, 1970. Overrides DateFormat pure virtual method. + *

+ * Example: using the US locale: "yyyy.MM.dd e 'at' HH:mm:ss zzz" ->> + * 1996.07.10 AD at 15:08:56 PDT + * + * @param cal Calendar set to the date and time to be formatted + * into a date/time string. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param pos The formatting position. On input: an alignment field, + * if desired. On output: the offsets of the alignment field. + * @return Reference to 'appendTo' parameter. + * @stable ICU 2.1 + */ + virtual UnicodeString& format( Calendar& cal, + UnicodeString& appendTo, + FieldPosition& pos) const; + + /** + * Format a date or time, which is the standard millis since 24:00 GMT, Jan + * 1, 1970. Overrides DateFormat pure virtual method. + *

+ * Example: using the US locale: "yyyy.MM.dd e 'at' HH:mm:ss zzz" ->> + * 1996.07.10 AD at 15:08:56 PDT + * + * @param cal Calendar set to the date and time to be formatted + * into a date/time string. + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param posIter On return, can be used to iterate over positions + * of fields generated by this format call. Field values + * are defined in UDateFormatField. + * @param status Input/output param set to success/failure code. + * @return Reference to 'appendTo' parameter. + * @stable ICU 4.4 + */ + virtual UnicodeString& format( Calendar& cal, + UnicodeString& appendTo, + FieldPositionIterator* posIter, + UErrorCode& status) const; + + using DateFormat::parse; + + /** + * Parse a date/time string beginning at the given parse position. For + * example, a time text "07/10/96 4:5 PM, PDT" will be parsed into a Date + * that is equivalent to Date(837039928046). + *

+ * By default, parsing is lenient: If the input is not in the form used by + * this object's format method but can still be parsed as a date, then the + * parse succeeds. Clients may insist on strict adherence to the format by + * calling setLenient(false). + * @see DateFormat::setLenient(boolean) + * + * @param text The date/time string to be parsed + * @param cal A Calendar set on input to the date and time to be used for + * missing values in the date/time string being parsed, and set + * on output to the parsed date/time. When the calendar type is + * different from the internal calendar held by this SimpleDateFormat + * instance, the internal calendar will be cloned to a work + * calendar set to the same milliseconds and time zone as the + * cal parameter, field values will be parsed based on the work + * calendar, then the result (milliseconds and time zone) will + * be set in this calendar. + * @param pos On input, the position at which to start parsing; on + * output, the position at which parsing terminated, or the + * start position if the parse failed. + * @stable ICU 2.1 + */ + virtual void parse( const UnicodeString& text, + Calendar& cal, + ParsePosition& pos) const; + + + /** + * Set the start UDate used to interpret two-digit year strings. + * When dates are parsed having 2-digit year strings, they are placed within + * a assumed range of 100 years starting on the two digit start date. For + * example, the string "24-Jan-17" may be in the year 1817, 1917, 2017, or + * some other year. SimpleDateFormat chooses a year so that the resultant + * date is on or after the two digit start date and within 100 years of the + * two digit start date. + *

+ * By default, the two digit start date is set to 80 years before the current + * time at which a SimpleDateFormat object is created. + * @param d start UDate used to interpret two-digit year strings. + * @param status Filled in with U_ZERO_ERROR if the parse was successful, and with + * an error value if there was a parse error. + * @stable ICU 2.0 + */ + virtual void set2DigitYearStart(UDate d, UErrorCode& status); + + /** + * Get the start UDate used to interpret two-digit year strings. + * When dates are parsed having 2-digit year strings, they are placed within + * a assumed range of 100 years starting on the two digit start date. For + * example, the string "24-Jan-17" may be in the year 1817, 1917, 2017, or + * some other year. SimpleDateFormat chooses a year so that the resultant + * date is on or after the two digit start date and within 100 years of the + * two digit start date. + *

+ * By default, the two digit start date is set to 80 years before the current + * time at which a SimpleDateFormat object is created. + * @param status Filled in with U_ZERO_ERROR if the parse was successful, and with + * an error value if there was a parse error. + * @stable ICU 2.0 + */ + UDate get2DigitYearStart(UErrorCode& status) const; + + /** + * Return a pattern string describing this date format. + * @param result Output param to receive the pattern. + * @return A reference to 'result'. + * @stable ICU 2.0 + */ + virtual UnicodeString& toPattern(UnicodeString& result) const; + + /** + * Return a localized pattern string describing this date format. + * In most cases, this will return the same thing as toPattern(), + * but a locale can specify characters to use in pattern descriptions + * in place of the ones described in this class's class documentation. + * (Presumably, letters that would be more mnemonic in that locale's + * language.) This function would produce a pattern using those + * letters. + *

+ * Note: This implementation depends on DateFormatSymbols::getLocalPatternChars() + * to get localized format pattern characters. ICU does not include + * localized pattern character data, therefore, unless user sets localized + * pattern characters manually, this method returns the same result as + * toPattern(). + * + * @param result Receives the localized pattern. + * @param status Output param set to success/failure code on + * exit. If the pattern is invalid, this will be + * set to a failure result. + * @return A reference to 'result'. + * @stable ICU 2.0 + */ + virtual UnicodeString& toLocalizedPattern(UnicodeString& result, + UErrorCode& status) const; + + /** + * Apply the given unlocalized pattern string to this date format. + * (i.e., after this call, this formatter will format dates according to + * the new pattern) + * + * @param pattern The pattern to be applied. + * @stable ICU 2.0 + */ + virtual void applyPattern(const UnicodeString& pattern); + + /** + * Apply the given localized pattern string to this date format. + * (see toLocalizedPattern() for more information on localized patterns.) + * + * @param pattern The localized pattern to be applied. + * @param status Output param set to success/failure code on + * exit. If the pattern is invalid, this will be + * set to a failure result. + * @stable ICU 2.0 + */ + virtual void applyLocalizedPattern(const UnicodeString& pattern, + UErrorCode& status); + + /** + * Gets the date/time formatting symbols (this is an object carrying + * the various strings and other symbols used in formatting: e.g., month + * names and abbreviations, time zone names, AM/PM strings, etc.) + * @return a copy of the date-time formatting data associated + * with this date-time formatter. + * @stable ICU 2.0 + */ + virtual const DateFormatSymbols* getDateFormatSymbols(void) const; + + /** + * Set the date/time formatting symbols. The caller no longer owns the + * DateFormatSymbols object and should not delete it after making this call. + * @param newFormatSymbols the given date-time formatting symbols to copy. + * @stable ICU 2.0 + */ + virtual void adoptDateFormatSymbols(DateFormatSymbols* newFormatSymbols); + + /** + * Set the date/time formatting data. + * @param newFormatSymbols the given date-time formatting symbols to copy. + * @stable ICU 2.0 + */ + virtual void setDateFormatSymbols(const DateFormatSymbols& newFormatSymbols); + + /** + * Return the class ID for this class. This is useful only for comparing to + * a return value from getDynamicClassID(). For example: + *

+     * .   Base* polymorphic_pointer = createPolymorphicObject();
+     * .   if (polymorphic_pointer->getDynamicClassID() ==
+     * .       erived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @stable ICU 2.0 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This + * method is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and clone() + * methods call this method. + * + * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @stable ICU 2.0 + */ + virtual UClassID getDynamicClassID(void) const; + + /** + * Set the calendar to be used by this date format. Initially, the default + * calendar for the specified or default locale is used. The caller should + * not delete the Calendar object after it is adopted by this call. + * Adopting a new calendar will change to the default symbols. + * + * @param calendarToAdopt Calendar object to be adopted. + * @stable ICU 2.0 + */ + virtual void adoptCalendar(Calendar* calendarToAdopt); + + /* Cannot use #ifndef U_HIDE_INTERNAL_API for the following methods since they are virtual */ + /** + * Sets the TimeZoneFormat to be used by this date/time formatter. + * The caller should not delete the TimeZoneFormat object after + * it is adopted by this call. + * @param timeZoneFormatToAdopt The TimeZoneFormat object to be adopted. + * @internal ICU 49 technology preview + */ + virtual void adoptTimeZoneFormat(TimeZoneFormat* timeZoneFormatToAdopt); + + /** + * Sets the TimeZoneFormat to be used by this date/time formatter. + * @param newTimeZoneFormat The TimeZoneFormat object to copy. + * @internal ICU 49 technology preview + */ + virtual void setTimeZoneFormat(const TimeZoneFormat& newTimeZoneFormat); + + /** + * Gets the time zone format object associated with this date/time formatter. + * @return the time zone format associated with this date/time formatter. + * @internal ICU 49 technology preview + */ + virtual const TimeZoneFormat* getTimeZoneFormat(void) const; + + /** + * Set a particular UDisplayContext value in the formatter, such as + * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. Note: For getContext, see + * DateFormat. + * @param value The UDisplayContext value to set. + * @param status Input/output status. If at entry this indicates a failure + * status, the function will do nothing; otherwise this will be + * updated with any new status from the function. + * @stable ICU 53 + */ + virtual void setContext(UDisplayContext value, UErrorCode& status); + + /** + * Overrides base class method and + * This method clears per field NumberFormat instances + * previously set by {@see adoptNumberFormat(const UnicodeString&, NumberFormat*, UErrorCode)} + * @param adoptNF the NumbeferFormat used + * @stable ICU 54 + */ + void adoptNumberFormat(NumberFormat *formatToAdopt); + + /** + * Allow the user to set the NumberFormat for several fields + * It can be a single field like: "y"(year) or "M"(month) + * It can be several field combined together: "yM"(year and month) + * Note: + * 1 symbol field is enough for multiple symbol field (so "y" will override "yy", "yyy") + * If the field is not numeric, then override has no effect (like "MMM" will use abbreviation, not numerical field) + * Per field NumberFormat can also be cleared in {@see DateFormat::setNumberFormat(const NumberFormat& newNumberFormat)} + * + * @param fields the fields to override(like y) + * @param adoptNF the NumbeferFormat used + * @param status Receives a status code, which will be U_ZERO_ERROR + * if the operation succeeds. + * @stable ICU 54 + */ + void adoptNumberFormat(const UnicodeString& fields, NumberFormat *formatToAdopt, UErrorCode &status); + + /** + * Get the numbering system to be used for a particular field. + * @param field The UDateFormatField to get + * @stable ICU 54 + */ + const NumberFormat * getNumberFormatForField(char16_t field) const; + +#ifndef U_HIDE_INTERNAL_API + /** + * This is for ICU internal use only. Please do not use. + * Check whether the 'field' is smaller than all the fields covered in + * pattern, return TRUE if it is. The sequence of calendar field, + * from large to small is: ERA, YEAR, MONTH, DATE, AM_PM, HOUR, MINUTE,... + * @param field the calendar field need to check against + * @return TRUE if the 'field' is smaller than all the fields + * covered in pattern. FALSE otherwise. + * @internal ICU 4.0 + */ + UBool isFieldUnitIgnored(UCalendarDateFields field) const; + + + /** + * This is for ICU internal use only. Please do not use. + * Check whether the 'field' is smaller than all the fields covered in + * pattern, return TRUE if it is. The sequence of calendar field, + * from large to small is: ERA, YEAR, MONTH, DATE, AM_PM, HOUR, MINUTE,... + * @param pattern the pattern to check against + * @param field the calendar field need to check against + * @return TRUE if the 'field' is smaller than all the fields + * covered in pattern. FALSE otherwise. + * @internal ICU 4.0 + */ + static UBool isFieldUnitIgnored(const UnicodeString& pattern, + UCalendarDateFields field); + + /** + * This is for ICU internal use only. Please do not use. + * Get the locale of this simple date formatter. + * It is used in DateIntervalFormat. + * + * @return locale in this simple date formatter + * @internal ICU 4.0 + */ + const Locale& getSmpFmtLocale(void) const; +#endif /* U_HIDE_INTERNAL_API */ + +private: + friend class DateFormat; + + void initializeDefaultCentury(void); + + void initializeBooleanAttributes(void); + + SimpleDateFormat(); // default constructor not implemented + + /** + * Used by the DateFormat factory methods to construct a SimpleDateFormat. + * @param timeStyle the time style. + * @param dateStyle the date style. + * @param locale the given locale. + * @param status Output param set to success/failure code on + * exit. + */ + SimpleDateFormat(EStyle timeStyle, EStyle dateStyle, const Locale& locale, UErrorCode& status); + + /** + * Construct a SimpleDateFormat for the given locale. If no resource data + * is available, create an object of last resort, using hard-coded strings. + * This is an internal method, called by DateFormat. It should never fail. + * @param locale the given locale. + * @param status Output param set to success/failure code on + * exit. + */ + SimpleDateFormat(const Locale& locale, UErrorCode& status); // Use default pattern + + /** + * Hook called by format(... FieldPosition& ...) and format(...FieldPositionIterator&...) + */ + UnicodeString& _format(Calendar& cal, UnicodeString& appendTo, FieldPositionHandler& handler, UErrorCode& status) const; + + /** + * Called by format() to format a single field. + * + * @param appendTo Output parameter to receive result. + * Result is appended to existing contents. + * @param ch The format character we encountered in the pattern. + * @param count Number of characters in the current pattern symbol (e.g., + * "yyyy" in the pattern would result in a call to this function + * with ch equal to 'y' and count equal to 4) + * @param capitalizationContext Capitalization context for this date format. + * @param fieldNum Zero-based numbering of current field within the overall format. + * @param handler Records information about field positions. + * @param cal Calendar to use + * @param status Receives a status code, which will be U_ZERO_ERROR if the operation + * succeeds. + */ + void subFormat(UnicodeString &appendTo, + char16_t ch, + int32_t count, + UDisplayContext capitalizationContext, + int32_t fieldNum, + FieldPositionHandler& handler, + Calendar& cal, + SimpleDateFormatMutableNFs &mutableNFs, + UErrorCode& status) const; // in case of illegal argument + + /** + * Used by subFormat() to format a numeric value. + * Appends to toAppendTo a string representation of "value" + * having a number of digits between "minDigits" and + * "maxDigits". Uses the DateFormat's NumberFormat. + * + * @param currentNumberFormat + * @param appendTo Output parameter to receive result. + * Formatted number is appended to existing contents. + * @param value Value to format. + * @param minDigits Minimum number of digits the result should have + * @param maxDigits Maximum number of digits the result should have + */ + void zeroPaddingNumber(NumberFormat *currentNumberFormat, + UnicodeString &appendTo, + int32_t value, + int32_t minDigits, + int32_t maxDigits) const; + + /** + * Return true if the given format character, occuring count + * times, represents a numeric field. + */ + static UBool isNumeric(char16_t formatChar, int32_t count); + + /** + * Returns TRUE if the patternOffset is at the start of a numeric field. + */ + static UBool isAtNumericField(const UnicodeString &pattern, int32_t patternOffset); + + /** + * Returns TRUE if the patternOffset is right after a non-numeric field. + */ + static UBool isAfterNonNumericField(const UnicodeString &pattern, int32_t patternOffset); + + /** + * initializes fCalendar from parameters. Returns fCalendar as a convenience. + * @param adoptZone Zone to be adopted, or NULL for TimeZone::createDefault(). + * @param locale Locale of the calendar + * @param status Error code + * @return the newly constructed fCalendar + */ + Calendar *initializeCalendar(TimeZone* adoptZone, const Locale& locale, UErrorCode& status); + + /** + * Called by several of the constructors to load pattern data and formatting symbols + * out of a resource bundle and initialize the locale based on it. + * @param timeStyle The time style, as passed to DateFormat::createDateInstance(). + * @param dateStyle The date style, as passed to DateFormat::createTimeInstance(). + * @param locale The locale to load the patterns from. + * @param status Filled in with an error code if loading the data from the + * resources fails. + */ + void construct(EStyle timeStyle, EStyle dateStyle, const Locale& locale, UErrorCode& status); + + /** + * Called by construct() and the various constructors to set up the SimpleDateFormat's + * Calendar and NumberFormat objects. + * @param locale The locale for which we want a Calendar and a NumberFormat. + * @param status Filled in with an error code if creating either subobject fails. + */ + void initialize(const Locale& locale, UErrorCode& status); + + /** + * Private code-size reduction function used by subParse. + * @param text the time text being parsed. + * @param start where to start parsing. + * @param field the date field being parsed. + * @param stringArray the string array to parsed. + * @param stringArrayCount the size of the array. + * @param monthPattern pointer to leap month pattern, or NULL if none. + * @param cal a Calendar set to the date and time to be formatted + * into a date/time string. + * @return the new start position if matching succeeded; a negative number + * indicating matching failure, otherwise. + */ + int32_t matchString(const UnicodeString& text, int32_t start, UCalendarDateFields field, + const UnicodeString* stringArray, int32_t stringArrayCount, + const UnicodeString* monthPattern, Calendar& cal) const; + + /** + * Private code-size reduction function used by subParse. + * @param text the time text being parsed. + * @param start where to start parsing. + * @param field the date field being parsed. + * @param stringArray the string array to parsed. + * @param stringArrayCount the size of the array. + * @param cal a Calendar set to the date and time to be formatted + * into a date/time string. + * @return the new start position if matching succeeded; a negative number + * indicating matching failure, otherwise. + */ + int32_t matchQuarterString(const UnicodeString& text, int32_t start, UCalendarDateFields field, + const UnicodeString* stringArray, int32_t stringArrayCount, Calendar& cal) const; + + /** + * Used by subParse() to match localized day period strings. + */ + int32_t matchDayPeriodStrings(const UnicodeString& text, int32_t start, + const UnicodeString* stringArray, int32_t stringArrayCount, + int32_t &dayPeriod) const; + + /** + * Private function used by subParse to match literal pattern text. + * + * @param pattern the pattern string + * @param patternOffset the starting offset into the pattern text. On + * outupt will be set the offset of the first non-literal character in the pattern + * @param text the text being parsed + * @param textOffset the starting offset into the text. On output + * will be set to the offset of the character after the match + * @param whitespaceLenient TRUE if whitespace parse is lenient, FALSE otherwise. + * @param partialMatchLenient TRUE if partial match parse is lenient, FALSE otherwise. + * @param oldLeniency TRUE if old leniency control is lenient, FALSE otherwise. + * + * @return TRUE if the literal text could be matched, FALSE otherwise. + */ + static UBool matchLiterals(const UnicodeString &pattern, int32_t &patternOffset, + const UnicodeString &text, int32_t &textOffset, + UBool whitespaceLenient, UBool partialMatchLenient, UBool oldLeniency); + + /** + * Private member function that converts the parsed date strings into + * timeFields. Returns -start (for ParsePosition) if failed. + * @param text the time text to be parsed. + * @param start where to start parsing. + * @param ch the pattern character for the date field text to be parsed. + * @param count the count of a pattern character. + * @param obeyCount if true then the count is strictly obeyed. + * @param allowNegative + * @param ambiguousYear If true then the two-digit year == the default start year. + * @param saveHebrewMonth Used to hang onto month until year is known. + * @param cal a Calendar set to the date and time to be formatted + * into a date/time string. + * @param patLoc + * @param numericLeapMonthFormatter If non-null, used to parse numeric leap months. + * @param tzTimeType the type of parsed time zone - standard, daylight or unknown (output). + * This parameter can be NULL if caller does not need the information. + * @return the new start position if matching succeeded; a negative number + * indicating matching failure, otherwise. + */ + int32_t subParse(const UnicodeString& text, int32_t& start, char16_t ch, int32_t count, + UBool obeyCount, UBool allowNegative, UBool ambiguousYear[], int32_t& saveHebrewMonth, Calendar& cal, + int32_t patLoc, MessageFormat * numericLeapMonthFormatter, UTimeZoneFormatTimeType *tzTimeType, SimpleDateFormatMutableNFs &mutableNFs, + int32_t *dayPeriod=NULL) const; + + void parseInt(const UnicodeString& text, + Formattable& number, + ParsePosition& pos, + UBool allowNegative, + NumberFormat *fmt) const; + + void parseInt(const UnicodeString& text, + Formattable& number, + int32_t maxDigits, + ParsePosition& pos, + UBool allowNegative, + NumberFormat *fmt) const; + + int32_t checkIntSuffix(const UnicodeString& text, int32_t start, + int32_t patLoc, UBool isNegative) const; + + /** + * Counts number of digit code points in the specified text. + * + * @param text input text + * @param start start index, inclusive + * @param end end index, exclusive + * @return number of digits found in the text in the specified range. + */ + int32_t countDigits(const UnicodeString& text, int32_t start, int32_t end) const; + + /** + * Translate a pattern, mapping each character in the from string to the + * corresponding character in the to string. Return an error if the original + * pattern contains an unmapped character, or if a quote is unmatched. + * Quoted (single quotes only) material is not translated. + * @param originalPattern the original pattern. + * @param translatedPattern Output param to receive the translited pattern. + * @param from the characters to be translited from. + * @param to the characters to be translited to. + * @param status Receives a status code, which will be U_ZERO_ERROR + * if the operation succeeds. + */ + static void translatePattern(const UnicodeString& originalPattern, + UnicodeString& translatedPattern, + const UnicodeString& from, + const UnicodeString& to, + UErrorCode& status); + + /** + * Sets the starting date of the 100-year window that dates with 2-digit years + * are considered to fall within. + * @param startDate the start date + * @param status Receives a status code, which will be U_ZERO_ERROR + * if the operation succeeds. + */ + void parseAmbiguousDatesAsAfter(UDate startDate, UErrorCode& status); + + /** + * Return the length matched by the given affix, or -1 if none. + * Runs of white space in the affix, match runs of white space in + * the input. + * @param affix pattern string, taken as a literal + * @param input input text + * @param pos offset into input at which to begin matching + * @return length of input that matches, or -1 if match failure + */ + int32_t compareSimpleAffix(const UnicodeString& affix, + const UnicodeString& input, + int32_t pos) const; + + /** + * Skip over a run of zero or more Pattern_White_Space characters at + * pos in text. + */ + int32_t skipPatternWhiteSpace(const UnicodeString& text, int32_t pos) const; + + /** + * Skip over a run of zero or more isUWhiteSpace() characters at pos + * in text. + */ + int32_t skipUWhiteSpace(const UnicodeString& text, int32_t pos) const; + + /** + * Initialize NumberFormat instances used for numbering system overrides. + */ + void initNumberFormatters(const Locale &locale,UErrorCode &status); + + /** + * Parse the given override string and set up structures for number formats + */ + void processOverrideString(const Locale &locale, const UnicodeString &str, int8_t type, UErrorCode &status); + + /** + * Used to map pattern characters to Calendar field identifiers. + */ + static const UCalendarDateFields fgPatternIndexToCalendarField[]; + + /** + * Map index into pattern character string to DateFormat field number + */ + static const UDateFormatField fgPatternIndexToDateFormatField[]; + + /** + * Lazy TimeZoneFormat instantiation, semantically const + */ + TimeZoneFormat *tzFormat() const; + + const NumberFormat* getNumberFormatByIndex(UDateFormatField index) const; + + /** + * Used to map Calendar field to field level. + * The larger the level, the smaller the field unit. + * For example, UCAL_ERA level is 0, UCAL_YEAR level is 10, + * UCAL_MONTH level is 20. + */ + static const int32_t fgCalendarFieldToLevel[]; + + /** + * Map calendar field letter into calendar field level. + */ + static int32_t getLevelFromChar(char16_t ch); + + /** + * Tell if a character can be used to define a field in a format string. + */ + static UBool isSyntaxChar(char16_t ch); + + /** + * The formatting pattern for this formatter. + */ + UnicodeString fPattern; + + /** + * The numbering system override for dates. + */ + UnicodeString fDateOverride; + + /** + * The numbering system override for times. + */ + UnicodeString fTimeOverride; + + + /** + * The original locale used (for reloading symbols) + */ + Locale fLocale; + + /** + * A pointer to an object containing the strings to use in formatting (e.g., + * month and day names, AM and PM strings, time zone names, etc.) + */ + DateFormatSymbols* fSymbols; // Owned + + /** + * The time zone formatter + */ + TimeZoneFormat* fTimeZoneFormat; + + /** + * If dates have ambiguous years, we map them into the century starting + * at defaultCenturyStart, which may be any date. If defaultCenturyStart is + * set to SYSTEM_DEFAULT_CENTURY, which it is by default, then the system + * values are used. The instance values defaultCenturyStart and + * defaultCenturyStartYear are only used if explicitly set by the user + * through the API method parseAmbiguousDatesAsAfter(). + */ + UDate fDefaultCenturyStart; + + UBool fHasMinute; + UBool fHasSecond; + + /** + * Sets fHasMinutes and fHasSeconds. + */ + void parsePattern(); + + /** + * See documentation for defaultCenturyStart. + */ + /*transient*/ int32_t fDefaultCenturyStartYear; + + struct NSOverride : public UMemory { + const SharedNumberFormat *snf; + int32_t hash; + NSOverride *next; + void free(); + NSOverride() : snf(NULL), hash(0), next(NULL) { + } + ~NSOverride(); + }; + + /** + * The number format in use for each date field. NULL means fall back + * to fNumberFormat in DateFormat. + */ + const SharedNumberFormat **fSharedNumberFormatters; + + UBool fHaveDefaultCentury; + + BreakIterator* fCapitalizationBrkIter; +}; + +inline UDate +SimpleDateFormat::get2DigitYearStart(UErrorCode& /*status*/) const +{ + return fDefaultCenturyStart; +} + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // _SMPDTFMT +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/sortkey.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/sortkey.h new file mode 100644 index 0000000..1f42460 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/sortkey.h @@ -0,0 +1,340 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ***************************************************************************** + * Copyright (C) 1996-2014, International Business Machines Corporation and others. + * All Rights Reserved. + ***************************************************************************** + * + * File sortkey.h + * + * Created by: Helena Shih + * + * Modification History: + * + * Date Name Description + * + * 6/20/97 helena Java class name change. + * 8/18/97 helena Added internal API documentation. + * 6/26/98 erm Changed to use byte arrays and memcmp. + ***************************************************************************** + */ + +#ifndef SORTKEY_H +#define SORTKEY_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Keys for comparing strings multiple times. + */ + +#if !UCONFIG_NO_COLLATION + +#include "unicode/uobject.h" +#include "unicode/unistr.h" +#include "unicode/coll.h" + +U_NAMESPACE_BEGIN + +/* forward declaration */ +class RuleBasedCollator; +class CollationKeyByteSink; + +/** + * + * Collation keys are generated by the Collator class. Use the CollationKey objects + * instead of Collator to compare strings multiple times. A CollationKey + * preprocesses the comparison information from the Collator object to + * make the comparison faster. If you are not going to comparing strings + * multiple times, then using the Collator object is generally faster, + * since it only processes as much of the string as needed to make a + * comparison. + *

For example (with strength == tertiary) + *

When comparing "Abernathy" to "Baggins-Smythworthy", Collator + * only needs to process a couple of characters, while a comparison + * with CollationKeys will process all of the characters. On the other hand, + * if you are doing a sort of a number of fields, it is much faster to use + * CollationKeys, since you will be comparing strings multiple times. + *

Typical use of CollationKeys are in databases, where you store a CollationKey + * in a hidden field, and use it for sorting or indexing. + * + *

Example of use: + *

+ * \code
+ *     UErrorCode success = U_ZERO_ERROR;
+ *     Collator* myCollator = Collator::createInstance(success);
+ *     CollationKey* keys = new CollationKey [3];
+ *     myCollator->getCollationKey("Tom", keys[0], success );
+ *     myCollator->getCollationKey("Dick", keys[1], success );
+ *     myCollator->getCollationKey("Harry", keys[2], success );
+ *
+ *     // Inside body of sort routine, compare keys this way:
+ *     CollationKey tmp;
+ *     if(keys[0].compareTo( keys[1] ) > 0 ) {
+ *         tmp = keys[0]; keys[0] = keys[1]; keys[1] = tmp;
+ *     }
+ *     //...
+ * \endcode
+ * 
+ *

Because Collator::compare()'s algorithm is complex, it is faster to sort + * long lists of words by retrieving collation keys with Collator::getCollationKey(). + * You can then cache the collation keys and compare them using CollationKey::compareTo(). + *

+ * Note: Collators with different Locale, + * CollationStrength and DecompositionMode settings will return different + * CollationKeys for the same set of strings. Locales have specific + * collation rules, and the way in which secondary and tertiary differences + * are taken into account, for example, will result in different CollationKeys + * for same strings. + *

+ + * @see Collator + * @see RuleBasedCollator + * @version 1.3 12/18/96 + * @author Helena Shih + * @stable ICU 2.0 + */ +class U_I18N_API CollationKey : public UObject { +public: + /** + * This creates an empty collation key based on the null string. An empty + * collation key contains no sorting information. When comparing two empty + * collation keys, the result is Collator::EQUAL. Comparing empty collation key + * with non-empty collation key is always Collator::LESS. + * @stable ICU 2.0 + */ + CollationKey(); + + + /** + * Creates a collation key based on the collation key values. + * @param values the collation key values + * @param count number of collation key values, including trailing nulls. + * @stable ICU 2.0 + */ + CollationKey(const uint8_t* values, + int32_t count); + + /** + * Copy constructor. + * @param other the object to be copied. + * @stable ICU 2.0 + */ + CollationKey(const CollationKey& other); + + /** + * Sort key destructor. + * @stable ICU 2.0 + */ + virtual ~CollationKey(); + + /** + * Assignment operator + * @param other the object to be copied. + * @stable ICU 2.0 + */ + const CollationKey& operator=(const CollationKey& other); + + /** + * Compare if two collation keys are the same. + * @param source the collation key to compare to. + * @return Returns true if two collation keys are equal, false otherwise. + * @stable ICU 2.0 + */ + UBool operator==(const CollationKey& source) const; + + /** + * Compare if two collation keys are not the same. + * @param source the collation key to compare to. + * @return Returns TRUE if two collation keys are different, FALSE otherwise. + * @stable ICU 2.0 + */ + UBool operator!=(const CollationKey& source) const; + + + /** + * Test to see if the key is in an invalid state. The key will be in an + * invalid state if it couldn't allocate memory for some operation. + * @return Returns TRUE if the key is in an invalid, FALSE otherwise. + * @stable ICU 2.0 + */ + UBool isBogus(void) const; + + /** + * Returns a pointer to the collation key values. The storage is owned + * by the collation key and the pointer will become invalid if the key + * is deleted. + * @param count the output parameter of number of collation key values, + * including any trailing nulls. + * @return a pointer to the collation key values. + * @stable ICU 2.0 + */ + const uint8_t* getByteArray(int32_t& count) const; + +#ifdef U_USE_COLLATION_KEY_DEPRECATES + /** + * Extracts the collation key values into a new array. The caller owns + * this storage and should free it. + * @param count the output parameter of number of collation key values, + * including any trailing nulls. + * @obsolete ICU 2.6. Use getByteArray instead since this API will be removed in that release. + */ + uint8_t* toByteArray(int32_t& count) const; +#endif + +#ifndef U_HIDE_DEPRECATED_API + /** + * Convenience method which does a string(bit-wise) comparison of the + * two collation keys. + * @param target target collation key to be compared with + * @return Returns Collator::LESS if sourceKey < targetKey, + * Collator::GREATER if sourceKey > targetKey and Collator::EQUAL + * otherwise. + * @deprecated ICU 2.6 use the overload with error code + */ + Collator::EComparisonResult compareTo(const CollationKey& target) const; +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Convenience method which does a string(bit-wise) comparison of the + * two collation keys. + * @param target target collation key to be compared with + * @param status error code + * @return Returns UCOL_LESS if sourceKey < targetKey, + * UCOL_GREATER if sourceKey > targetKey and UCOL_EQUAL + * otherwise. + * @stable ICU 2.6 + */ + UCollationResult compareTo(const CollationKey& target, UErrorCode &status) const; + + /** + * Creates an integer that is unique to the collation key. NOTE: this + * is not the same as String.hashCode. + *

Example of use: + *

+    * .    UErrorCode status = U_ZERO_ERROR;
+    * .    Collator *myCollation = Collator::createInstance(Locale::US, status);
+    * .    if (U_FAILURE(status)) return;
+    * .    CollationKey key1, key2;
+    * .    UErrorCode status1 = U_ZERO_ERROR, status2 = U_ZERO_ERROR;
+    * .    myCollation->getCollationKey("abc", key1, status1);
+    * .    if (U_FAILURE(status1)) { delete myCollation; return; }
+    * .    myCollation->getCollationKey("ABC", key2, status2);
+    * .    if (U_FAILURE(status2)) { delete myCollation; return; }
+    * .    // key1.hashCode() != key2.hashCode()
+    * 
+ * @return the hash value based on the string's collation order. + * @see UnicodeString#hashCode + * @stable ICU 2.0 + */ + int32_t hashCode(void) const; + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * @stable ICU 2.2 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * @stable ICU 2.2 + */ + static UClassID U_EXPORT2 getStaticClassID(); + +private: + /** + * Replaces the current bytes buffer with a new one of newCapacity + * and copies length bytes from the old buffer to the new one. + * @return the new buffer, or NULL if the allocation failed + */ + uint8_t *reallocate(int32_t newCapacity, int32_t length); + /** + * Set a new length for a new sort key in the existing fBytes. + */ + void setLength(int32_t newLength); + + uint8_t *getBytes() { + return (fFlagAndLength >= 0) ? fUnion.fStackBuffer : fUnion.fFields.fBytes; + } + const uint8_t *getBytes() const { + return (fFlagAndLength >= 0) ? fUnion.fStackBuffer : fUnion.fFields.fBytes; + } + int32_t getCapacity() const { + return (fFlagAndLength >= 0) ? (int32_t)sizeof(fUnion) : fUnion.fFields.fCapacity; + } + int32_t getLength() const { return fFlagAndLength & 0x7fffffff; } + + /** + * Set the CollationKey to a "bogus" or invalid state + * @return this CollationKey + */ + CollationKey& setToBogus(void); + /** + * Resets this CollationKey to an empty state + * @return this CollationKey + */ + CollationKey& reset(void); + + /** + * Allow private access to RuleBasedCollator + */ + friend class RuleBasedCollator; + friend class CollationKeyByteSink; + + // Class fields. sizeof(CollationKey) is intended to be 48 bytes + // on a machine with 64-bit pointers. + // We use a union to maximize the size of the internal buffer, + // similar to UnicodeString but not as tight and complex. + + // (implicit) *vtable; + /** + * Sort key length and flag. + * Bit 31 is set if the buffer is heap-allocated. + * Bits 30..0 contain the sort key length. + */ + int32_t fFlagAndLength; + /** + * Unique hash value of this CollationKey. + * Special value 2 if the key is bogus. + */ + mutable int32_t fHashCode; + /** + * fUnion provides 32 bytes for the internal buffer or for + * pointer+capacity. + */ + union StackBufferOrFields { + /** fStackBuffer is used iff fFlagAndLength>=0, else fFields is used */ + uint8_t fStackBuffer[32]; + struct { + uint8_t *fBytes; + int32_t fCapacity; + } fFields; + } fUnion; +}; + +inline UBool +CollationKey::operator!=(const CollationKey& other) const +{ + return !(*this == other); +} + +inline UBool +CollationKey::isBogus() const +{ + return fHashCode == 2; // kBogusHashCode +} + +inline const uint8_t* +CollationKey::getByteArray(int32_t &count) const +{ + count = getLength(); + return getBytes(); +} + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_COLLATION */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/std_string.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/std_string.h new file mode 100644 index 0000000..729c563 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/std_string.h @@ -0,0 +1,37 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2009-2014, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: std_string.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2009feb19 +* created by: Markus W. Scherer +*/ + +#ifndef __STD_STRING_H__ +#define __STD_STRING_H__ + +/** + * \file + * \brief C++ API: Central ICU header for including the C++ standard <string> + * header and for related definitions. + */ + +#include "unicode/utypes.h" + +// Workaround for a libstdc++ bug before libstdc++4.6 (2011). +// https://bugs.llvm.org/show_bug.cgi?id=13364 +#if defined(__GLIBCXX__) +namespace std { class type_info; } +#endif +#include + +#endif // __STD_STRING_H__ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/strenum.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/strenum.h new file mode 100644 index 0000000..61d5148 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/strenum.h @@ -0,0 +1,278 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2002-2012, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +*/ + +#ifndef STRENUM_H +#define STRENUM_H + +#include "unicode/uobject.h" +#include "unicode/unistr.h" + +/** + * \file + * \brief C++ API: String Enumeration + */ + +U_NAMESPACE_BEGIN + +/** + * Base class for 'pure' C++ implementations of uenum api. Adds a + * method that returns the next UnicodeString since in C++ this can + * be a common storage format for strings. + * + *

The model is that the enumeration is over strings maintained by + * a 'service.' At any point, the service might change, invalidating + * the enumerator (though this is expected to be rare). The iterator + * returns an error if this has occurred. Lack of the error is no + * guarantee that the service didn't change immediately after the + * call, so the returned string still might not be 'valid' on + * subsequent use.

+ * + *

Strings may take the form of const char*, const char16_t*, or const + * UnicodeString*. The type you get is determine by the variant of + * 'next' that you call. In general the StringEnumeration is + * optimized for one of these types, but all StringEnumerations can + * return all types. Returned strings are each terminated with a NUL. + * Depending on the service data, they might also include embedded NUL + * characters, so API is provided to optionally return the true + * length, counting the embedded NULs but not counting the terminating + * NUL.

+ * + *

The pointers returned by next, unext, and snext become invalid + * upon any subsequent call to the enumeration's destructor, next, + * unext, snext, or reset.

+ * + * ICU 2.8 adds some default implementations and helper functions + * for subclasses. + * + * @stable ICU 2.4 + */ +class U_COMMON_API StringEnumeration : public UObject { +public: + /** + * Destructor. + * @stable ICU 2.4 + */ + virtual ~StringEnumeration(); + + /** + * Clone this object, an instance of a subclass of StringEnumeration. + * Clones can be used concurrently in multiple threads. + * If a subclass does not implement clone(), or if an error occurs, + * then NULL is returned. + * The clone functions in all subclasses return a base class pointer + * because some compilers do not support covariant (same-as-this) + * return types; cast to the appropriate subclass if necessary. + * The caller must delete the clone. + * + * @return a clone of this object + * + * @see getDynamicClassID + * @stable ICU 2.8 + */ + virtual StringEnumeration *clone() const; + + /** + *

Return the number of elements that the iterator traverses. If + * the iterator is out of sync with its service, status is set to + * U_ENUM_OUT_OF_SYNC_ERROR, and the return value is zero.

+ * + *

The return value will not change except possibly as a result of + * a subsequent call to reset, or if the iterator becomes out of sync.

+ * + *

This is a convenience function. It can end up being very + * expensive as all the items might have to be pre-fetched + * (depending on the storage format of the data being + * traversed).

+ * + * @param status the error code. + * @return number of elements in the iterator. + * + * @stable ICU 2.4 */ + virtual int32_t count(UErrorCode& status) const = 0; + + /** + *

Returns the next element as a NUL-terminated char*. If there + * are no more elements, returns NULL. If the resultLength pointer + * is not NULL, the length of the string (not counting the + * terminating NUL) is returned at that address. If an error + * status is returned, the value at resultLength is undefined.

+ * + *

The returned pointer is owned by this iterator and must not be + * deleted by the caller. The pointer is valid until the next call + * to next, unext, snext, reset, or the enumerator's destructor.

+ * + *

If the iterator is out of sync with its service, status is set + * to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.

+ * + *

If the native service string is a char16_t* string, it is + * converted to char* with the invariant converter. If the + * conversion fails (because a character cannot be converted) then + * status is set to U_INVARIANT_CONVERSION_ERROR and the return + * value is undefined (though not NULL).

+ * + * Starting with ICU 2.8, the default implementation calls snext() + * and handles the conversion. + * Either next() or snext() must be implemented differently by a subclass. + * + * @param status the error code. + * @param resultLength a pointer to receive the length, can be NULL. + * @return a pointer to the string, or NULL. + * + * @stable ICU 2.4 + */ + virtual const char* next(int32_t *resultLength, UErrorCode& status); + + /** + *

Returns the next element as a NUL-terminated char16_t*. If there + * are no more elements, returns NULL. If the resultLength pointer + * is not NULL, the length of the string (not counting the + * terminating NUL) is returned at that address. If an error + * status is returned, the value at resultLength is undefined.

+ * + *

The returned pointer is owned by this iterator and must not be + * deleted by the caller. The pointer is valid until the next call + * to next, unext, snext, reset, or the enumerator's destructor.

+ * + *

If the iterator is out of sync with its service, status is set + * to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.

+ * + * Starting with ICU 2.8, the default implementation calls snext() + * and handles the conversion. + * + * @param status the error code. + * @param resultLength a ponter to receive the length, can be NULL. + * @return a pointer to the string, or NULL. + * + * @stable ICU 2.4 + */ + virtual const char16_t* unext(int32_t *resultLength, UErrorCode& status); + + /** + *

Returns the next element a UnicodeString*. If there are no + * more elements, returns NULL.

+ * + *

The returned pointer is owned by this iterator and must not be + * deleted by the caller. The pointer is valid until the next call + * to next, unext, snext, reset, or the enumerator's destructor.

+ * + *

If the iterator is out of sync with its service, status is set + * to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.

+ * + * Starting with ICU 2.8, the default implementation calls next() + * and handles the conversion. + * Either next() or snext() must be implemented differently by a subclass. + * + * @param status the error code. + * @return a pointer to the string, or NULL. + * + * @stable ICU 2.4 + */ + virtual const UnicodeString* snext(UErrorCode& status); + + /** + *

Resets the iterator. This re-establishes sync with the + * service and rewinds the iterator to start at the first + * element.

+ * + *

Previous pointers returned by next, unext, or snext become + * invalid, and the value returned by count might change.

+ * + * @param status the error code. + * + * @stable ICU 2.4 + */ + virtual void reset(UErrorCode& status) = 0; + + /** + * Compares this enumeration to other to check if both are equal + * + * @param that The other string enumeration to compare this object to + * @return TRUE if the enumerations are equal. FALSE if not. + * @stable ICU 3.6 + */ + virtual UBool operator==(const StringEnumeration& that)const; + /** + * Compares this enumeration to other to check if both are not equal + * + * @param that The other string enumeration to compare this object to + * @return TRUE if the enumerations are equal. FALSE if not. + * @stable ICU 3.6 + */ + virtual UBool operator!=(const StringEnumeration& that)const; + +protected: + /** + * UnicodeString field for use with default implementations and subclasses. + * @stable ICU 2.8 + */ + UnicodeString unistr; + /** + * char * default buffer for use with default implementations and subclasses. + * @stable ICU 2.8 + */ + char charsBuffer[32]; + /** + * char * buffer for use with default implementations and subclasses. + * Allocated in constructor and in ensureCharsCapacity(). + * @stable ICU 2.8 + */ + char *chars; + /** + * Capacity of chars, for use with default implementations and subclasses. + * @stable ICU 2.8 + */ + int32_t charsCapacity; + + /** + * Default constructor for use with default implementations and subclasses. + * @stable ICU 2.8 + */ + StringEnumeration(); + + /** + * Ensures that chars is at least as large as the requested capacity. + * For use with default implementations and subclasses. + * + * @param capacity Requested capacity. + * @param status ICU in/out error code. + * @stable ICU 2.8 + */ + void ensureCharsCapacity(int32_t capacity, UErrorCode &status); + + /** + * Converts s to Unicode and sets unistr to the result. + * For use with default implementations and subclasses, + * especially for implementations of snext() in terms of next(). + * This is provided with a helper function instead of a default implementation + * of snext() to avoid potential infinite loops between next() and snext(). + * + * For example: + * \code + * const UnicodeString* snext(UErrorCode& status) { + * int32_t resultLength=0; + * const char *s=next(&resultLength, status); + * return setChars(s, resultLength, status); + * } + * \endcode + * + * @param s String to be converted to Unicode. + * @param length Length of the string. + * @param status ICU in/out error code. + * @return A pointer to unistr. + * @stable ICU 2.8 + */ + UnicodeString *setChars(const char *s, int32_t length, UErrorCode &status); +}; + +U_NAMESPACE_END + +/* STRENUM_H */ +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/stringoptions.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/stringoptions.h new file mode 100644 index 0000000..f2de96e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/stringoptions.h @@ -0,0 +1,198 @@ +// © 2017 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html + +// stringoptions.h +// created: 2017jun08 Markus W. Scherer + +#ifndef __STRINGOPTIONS_H__ +#define __STRINGOPTIONS_H__ + +#include "unicode/utypes.h" + +/** + * \file + * \brief C API: Bit set option bit constants for various string and character processing functions. + */ + +/** + * Option value for case folding: Use default mappings defined in CaseFolding.txt. + * + * @stable ICU 2.0 + */ +#define U_FOLD_CASE_DEFAULT 0 + +/** + * Option value for case folding: + * + * Use the modified set of mappings provided in CaseFolding.txt to handle dotted I + * and dotless i appropriately for Turkic languages (tr, az). + * + * Before Unicode 3.2, CaseFolding.txt contains mappings marked with 'I' that + * are to be included for default mappings and + * excluded for the Turkic-specific mappings. + * + * Unicode 3.2 CaseFolding.txt instead contains mappings marked with 'T' that + * are to be excluded for default mappings and + * included for the Turkic-specific mappings. + * + * @stable ICU 2.0 + */ +#define U_FOLD_CASE_EXCLUDE_SPECIAL_I 1 + +#ifndef U_HIDE_DRAFT_API + +/** + * Titlecase the string as a whole rather than each word. + * (Titlecase only the character at index 0, possibly adjusted.) + * Option bits value for titlecasing APIs that take an options bit set. + * + * It is an error to specify multiple titlecasing iterator options together, + * including both an options bit and an explicit BreakIterator. + * + * @see U_TITLECASE_ADJUST_TO_CASED + * @draft ICU 60 + */ +#define U_TITLECASE_WHOLE_STRING 0x20 + +/** + * Titlecase sentences rather than words. + * (Titlecase only the first character of each sentence, possibly adjusted.) + * Option bits value for titlecasing APIs that take an options bit set. + * + * It is an error to specify multiple titlecasing iterator options together, + * including both an options bit and an explicit BreakIterator. + * + * @see U_TITLECASE_ADJUST_TO_CASED + * @draft ICU 60 + */ +#define U_TITLECASE_SENTENCES 0x40 + +#endif // U_HIDE_DRAFT_API + +/** + * Do not lowercase non-initial parts of words when titlecasing. + * Option bit for titlecasing APIs that take an options bit set. + * + * By default, titlecasing will titlecase the character at each + * (possibly adjusted) BreakIterator index and + * lowercase all other characters up to the next iterator index. + * With this option, the other characters will not be modified. + * + * @see U_TITLECASE_ADJUST_TO_CASED + * @see UnicodeString::toTitle + * @see CaseMap::toTitle + * @see ucasemap_setOptions + * @see ucasemap_toTitle + * @see ucasemap_utf8ToTitle + * @stable ICU 3.8 + */ +#define U_TITLECASE_NO_LOWERCASE 0x100 + +/** + * Do not adjust the titlecasing BreakIterator indexes; + * titlecase exactly the characters at breaks from the iterator. + * Option bit for titlecasing APIs that take an options bit set. + * + * By default, titlecasing will take each break iterator index, + * adjust it to the next relevant character (see U_TITLECASE_ADJUST_TO_CASED), + * and titlecase that one. + * + * Other characters are lowercased. + * + * It is an error to specify multiple titlecasing adjustment options together. + * + * @see U_TITLECASE_ADJUST_TO_CASED + * @see U_TITLECASE_NO_LOWERCASE + * @see UnicodeString::toTitle + * @see CaseMap::toTitle + * @see ucasemap_setOptions + * @see ucasemap_toTitle + * @see ucasemap_utf8ToTitle + * @stable ICU 3.8 + */ +#define U_TITLECASE_NO_BREAK_ADJUSTMENT 0x200 + +#ifndef U_HIDE_DRAFT_API + +/** + * Adjust each titlecasing BreakIterator index to the next cased character. + * (See the Unicode Standard, chapter 3, Default Case Conversion, R3 toTitlecase(X).) + * Option bit for titlecasing APIs that take an options bit set. + * + * This used to be the default index adjustment in ICU. + * Since ICU 60, the default index adjustment is to the next character that is + * a letter, number, symbol, or private use code point. + * (Uncased modifier letters are skipped.) + * The difference in behavior is small for word titlecasing, + * but the new adjustment is much better for whole-string and sentence titlecasing: + * It yields "49ers" and "«丰(abc)»" instead of "49Ers" and "«丰(Abc)»". + * + * It is an error to specify multiple titlecasing adjustment options together. + * + * @see U_TITLECASE_NO_BREAK_ADJUSTMENT + * @draft ICU 60 + */ +#define U_TITLECASE_ADJUST_TO_CASED 0x400 + +/** + * Option for string transformation functions to not first reset the Edits object. + * Used for example in some case-mapping and normalization functions. + * + * @see CaseMap + * @see Edits + * @see Normalizer2 + * @draft ICU 60 + */ +#define U_EDITS_NO_RESET 0x2000 + +/** + * Omit unchanged text when recording how source substrings + * relate to changed and unchanged result substrings. + * Used for example in some case-mapping and normalization functions. + * + * @see CaseMap + * @see Edits + * @see Normalizer2 + * @draft ICU 60 + */ +#define U_OMIT_UNCHANGED_TEXT 0x4000 + +#endif // U_HIDE_DRAFT_API + +/** + * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc: + * Compare strings in code point order instead of code unit order. + * @stable ICU 2.2 + */ +#define U_COMPARE_CODE_POINT_ORDER 0x8000 + +/** + * Option bit for unorm_compare: + * Perform case-insensitive comparison. + * @stable ICU 2.2 + */ +#define U_COMPARE_IGNORE_CASE 0x10000 + +/** + * Option bit for unorm_compare: + * Both input strings are assumed to fulfill FCD conditions. + * @stable ICU 2.2 + */ +#define UNORM_INPUT_IS_FCD 0x20000 + +// Related definitions elsewhere. +// Options that are not meaningful in the same functions +// can share the same bits. +// +// Public: +// unicode/unorm.h #define UNORM_COMPARE_NORM_OPTIONS_SHIFT 20 +// +// Internal: (may change or be removed) +// ucase.h #define _STRCASECMP_OPTIONS_MASK 0xffff +// ucase.h #define _FOLD_CASE_OPTIONS_MASK 7 +// ucasemap_imp.h #define U_TITLECASE_ITERATOR_MASK 0xe0 +// ucasemap_imp.h #define U_TITLECASE_ADJUSTMENT_MASK 0x600 +// ustr_imp.h #define _STRNCMP_STYLE 0x1000 +// unormcmp.cpp #define _COMPARE_EQUIV 0x80000 + +#endif // __STRINGOPTIONS_H__ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/stringpiece.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/stringpiece.h new file mode 100644 index 0000000..b0887ef --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/stringpiece.h @@ -0,0 +1,224 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +// Copyright (C) 2009-2013, International Business Machines +// Corporation and others. All Rights Reserved. +// +// Copyright 2001 and onwards Google Inc. +// Author: Sanjay Ghemawat + +// This code is a contribution of Google code, and the style used here is +// a compromise between the original Google code and the ICU coding guidelines. +// For example, data types are ICU-ified (size_t,int->int32_t), +// and API comments doxygen-ified, but function names and behavior are +// as in the original, if possible. +// Assertion-style error handling, not available in ICU, was changed to +// parameter "pinning" similar to UnicodeString. +// +// In addition, this is only a partial port of the original Google code, +// limited to what was needed so far. The (nearly) complete original code +// is in the ICU svn repository at icuhtml/trunk/design/strings/contrib +// (see ICU ticket 6765, r25517). + +#ifndef __STRINGPIECE_H__ +#define __STRINGPIECE_H__ + +/** + * \file + * \brief C++ API: StringPiece: Read-only byte string wrapper class. + */ + +#include "unicode/utypes.h" +#include "unicode/uobject.h" +#include "unicode/std_string.h" + +// Arghh! I wish C++ literals were "string". + +U_NAMESPACE_BEGIN + +/** + * A string-like object that points to a sized piece of memory. + * + * We provide non-explicit singleton constructors so users can pass + * in a "const char*" or a "string" wherever a "StringPiece" is + * expected. + * + * Functions or methods may use StringPiece parameters to accept either a + * "const char*" or a "string" value that will be implicitly converted to a + * StringPiece. + * + * Systematic usage of StringPiece is encouraged as it will reduce unnecessary + * conversions from "const char*" to "string" and back again. + * + * @stable ICU 4.2 + */ +class U_COMMON_API StringPiece : public UMemory { + private: + const char* ptr_; + int32_t length_; + + public: + /** + * Default constructor, creates an empty StringPiece. + * @stable ICU 4.2 + */ + StringPiece() : ptr_(NULL), length_(0) { } + /** + * Constructs from a NUL-terminated const char * pointer. + * @param str a NUL-terminated const char * pointer + * @stable ICU 4.2 + */ + StringPiece(const char* str); + /** + * Constructs from a std::string. + * @stable ICU 4.2 + */ + StringPiece(const std::string& str) + : ptr_(str.data()), length_(static_cast(str.size())) { } + /** + * Constructs from a const char * pointer and a specified length. + * @param offset a const char * pointer (need not be terminated) + * @param len the length of the string; must be non-negative + * @stable ICU 4.2 + */ + StringPiece(const char* offset, int32_t len) : ptr_(offset), length_(len) { } + /** + * Substring of another StringPiece. + * @param x the other StringPiece + * @param pos start position in x; must be non-negative and <= x.length(). + * @stable ICU 4.2 + */ + StringPiece(const StringPiece& x, int32_t pos); + /** + * Substring of another StringPiece. + * @param x the other StringPiece + * @param pos start position in x; must be non-negative and <= x.length(). + * @param len length of the substring; + * must be non-negative and will be pinned to at most x.length() - pos. + * @stable ICU 4.2 + */ + StringPiece(const StringPiece& x, int32_t pos, int32_t len); + + /** + * Returns the string pointer. May be NULL if it is empty. + * + * data() may return a pointer to a buffer with embedded NULs, and the + * returned buffer may or may not be null terminated. Therefore it is + * typically a mistake to pass data() to a routine that expects a NUL + * terminated string. + * @return the string pointer + * @stable ICU 4.2 + */ + const char* data() const { return ptr_; } + /** + * Returns the string length. Same as length(). + * @return the string length + * @stable ICU 4.2 + */ + int32_t size() const { return length_; } + /** + * Returns the string length. Same as size(). + * @return the string length + * @stable ICU 4.2 + */ + int32_t length() const { return length_; } + /** + * Returns whether the string is empty. + * @return TRUE if the string is empty + * @stable ICU 4.2 + */ + UBool empty() const { return length_ == 0; } + + /** + * Sets to an empty string. + * @stable ICU 4.2 + */ + void clear() { ptr_ = NULL; length_ = 0; } + + /** + * Reset the stringpiece to refer to new data. + * @param xdata pointer the new string data. Need not be nul terminated. + * @param len the length of the new data + * @stable ICU 4.8 + */ + void set(const char* xdata, int32_t len) { ptr_ = xdata; length_ = len; } + + /** + * Reset the stringpiece to refer to new data. + * @param str a pointer to a NUL-terminated string. + * @stable ICU 4.8 + */ + void set(const char* str); + + /** + * Removes the first n string units. + * @param n prefix length, must be non-negative and <=length() + * @stable ICU 4.2 + */ + void remove_prefix(int32_t n) { + if (n >= 0) { + if (n > length_) { + n = length_; + } + ptr_ += n; + length_ -= n; + } + } + + /** + * Removes the last n string units. + * @param n suffix length, must be non-negative and <=length() + * @stable ICU 4.2 + */ + void remove_suffix(int32_t n) { + if (n >= 0) { + if (n <= length_) { + length_ -= n; + } else { + length_ = 0; + } + } + } + + /** + * Maximum integer, used as a default value for substring methods. + * @stable ICU 4.2 + */ + static const int32_t npos; // = 0x7fffffff; + + /** + * Returns a substring of this StringPiece. + * @param pos start position; must be non-negative and <= length(). + * @param len length of the substring; + * must be non-negative and will be pinned to at most length() - pos. + * @return the substring StringPiece + * @stable ICU 4.2 + */ + StringPiece substr(int32_t pos, int32_t len = npos) const { + return StringPiece(*this, pos, len); + } +}; + +/** + * Global operator == for StringPiece + * @param x The first StringPiece to compare. + * @param y The second StringPiece to compare. + * @return TRUE if the string data is equal + * @stable ICU 4.8 + */ +U_EXPORT UBool U_EXPORT2 +operator==(const StringPiece& x, const StringPiece& y); + +/** + * Global operator != for StringPiece + * @param x The first StringPiece to compare. + * @param y The second StringPiece to compare. + * @return TRUE if the string data is not equal + * @stable ICU 4.8 + */ +inline UBool operator!=(const StringPiece& x, const StringPiece& y) { + return !(x == y); +} + +U_NAMESPACE_END + +#endif // __STRINGPIECE_H__ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/stringtriebuilder.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/stringtriebuilder.h new file mode 100644 index 0000000..caeae51 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/stringtriebuilder.h @@ -0,0 +1,414 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2010-2012,2014, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* file name: stringtriebuilder.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2010dec24 +* created by: Markus W. Scherer +*/ + +#ifndef __STRINGTRIEBUILDER_H__ +#define __STRINGTRIEBUILDER_H__ + +#include "unicode/utypes.h" +#include "unicode/uobject.h" + +/** + * \file + * \brief C++ API: Builder API for trie builders + */ + +// Forward declaration. +struct UHashtable; +typedef struct UHashtable UHashtable; + +/** + * Build options for BytesTrieBuilder and CharsTrieBuilder. + * @stable ICU 4.8 + */ +enum UStringTrieBuildOption { + /** + * Builds a trie quickly. + * @stable ICU 4.8 + */ + USTRINGTRIE_BUILD_FAST, + /** + * Builds a trie more slowly, attempting to generate + * a shorter but equivalent serialization. + * This build option also uses more memory. + * + * This option can be effective when many integer values are the same + * and string/byte sequence suffixes can be shared. + * Runtime speed is not expected to improve. + * @stable ICU 4.8 + */ + USTRINGTRIE_BUILD_SMALL +}; + +U_NAMESPACE_BEGIN + +/** + * Base class for string trie builder classes. + * + * This class is not intended for public subclassing. + * @stable ICU 4.8 + */ +class U_COMMON_API StringTrieBuilder : public UObject { +public: +#ifndef U_HIDE_INTERNAL_API + /** @internal */ + static UBool hashNode(const void *node); + /** @internal */ + static UBool equalNodes(const void *left, const void *right); +#endif /* U_HIDE_INTERNAL_API */ + +protected: + // Do not enclose the protected default constructor with #ifndef U_HIDE_INTERNAL_API + // or else the compiler will create a public default constructor. + /** @internal */ + StringTrieBuilder(); + /** @internal */ + virtual ~StringTrieBuilder(); + +#ifndef U_HIDE_INTERNAL_API + /** @internal */ + void createCompactBuilder(int32_t sizeGuess, UErrorCode &errorCode); + /** @internal */ + void deleteCompactBuilder(); + + /** @internal */ + void build(UStringTrieBuildOption buildOption, int32_t elementsLength, UErrorCode &errorCode); + + /** @internal */ + int32_t writeNode(int32_t start, int32_t limit, int32_t unitIndex); + /** @internal */ + int32_t writeBranchSubNode(int32_t start, int32_t limit, int32_t unitIndex, int32_t length); +#endif /* U_HIDE_INTERNAL_API */ + + class Node; + +#ifndef U_HIDE_INTERNAL_API + /** @internal */ + Node *makeNode(int32_t start, int32_t limit, int32_t unitIndex, UErrorCode &errorCode); + /** @internal */ + Node *makeBranchSubNode(int32_t start, int32_t limit, int32_t unitIndex, + int32_t length, UErrorCode &errorCode); +#endif /* U_HIDE_INTERNAL_API */ + + /** @internal */ + virtual int32_t getElementStringLength(int32_t i) const = 0; + /** @internal */ + virtual char16_t getElementUnit(int32_t i, int32_t unitIndex) const = 0; + /** @internal */ + virtual int32_t getElementValue(int32_t i) const = 0; + + // Finds the first unit index after this one where + // the first and last element have different units again. + /** @internal */ + virtual int32_t getLimitOfLinearMatch(int32_t first, int32_t last, int32_t unitIndex) const = 0; + + // Number of different units at unitIndex. + /** @internal */ + virtual int32_t countElementUnits(int32_t start, int32_t limit, int32_t unitIndex) const = 0; + /** @internal */ + virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t unitIndex, int32_t count) const = 0; + /** @internal */ + virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, char16_t unit) const = 0; + + /** @internal */ + virtual UBool matchNodesCanHaveValues() const = 0; + + /** @internal */ + virtual int32_t getMaxBranchLinearSubNodeLength() const = 0; + /** @internal */ + virtual int32_t getMinLinearMatch() const = 0; + /** @internal */ + virtual int32_t getMaxLinearMatchLength() const = 0; + +#ifndef U_HIDE_INTERNAL_API + // max(BytesTrie::kMaxBranchLinearSubNodeLength, UCharsTrie::kMaxBranchLinearSubNodeLength). + /** @internal */ + static const int32_t kMaxBranchLinearSubNodeLength=5; + + // Maximum number of nested split-branch levels for a branch on all 2^16 possible char16_t units. + // log2(2^16/kMaxBranchLinearSubNodeLength) rounded up. + /** @internal */ + static const int32_t kMaxSplitBranchLevels=14; + + /** + * Makes sure that there is only one unique node registered that is + * equivalent to newNode. + * @param newNode Input node. The builder takes ownership. + * @param errorCode ICU in/out UErrorCode. + Set to U_MEMORY_ALLOCATION_ERROR if it was success but newNode==NULL. + * @return newNode if it is the first of its kind, or + * an equivalent node if newNode is a duplicate. + * @internal + */ + Node *registerNode(Node *newNode, UErrorCode &errorCode); + /** + * Makes sure that there is only one unique FinalValueNode registered + * with this value. + * Avoids creating a node if the value is a duplicate. + * @param value A final value. + * @param errorCode ICU in/out UErrorCode. + Set to U_MEMORY_ALLOCATION_ERROR if it was success but newNode==NULL. + * @return A FinalValueNode with the given value. + * @internal + */ + Node *registerFinalValue(int32_t value, UErrorCode &errorCode); +#endif /* U_HIDE_INTERNAL_API */ + + /* + * C++ note: + * registerNode() and registerFinalValue() take ownership of their input nodes, + * and only return owned nodes. + * If they see a failure UErrorCode, they will delete the input node. + * If they get a NULL pointer, they will record a U_MEMORY_ALLOCATION_ERROR. + * If there is a failure, they return NULL. + * + * NULL Node pointers can be safely passed into other Nodes because + * they call the static Node::hashCode() which checks for a NULL pointer first. + * + * Therefore, as long as builder functions register a new node, + * they need to check for failures only before explicitly dereferencing + * a Node pointer, or before setting a new UErrorCode. + */ + + // Hash set of nodes, maps from nodes to integer 1. + /** @internal */ + UHashtable *nodes; + + // Do not conditionalize the following with #ifndef U_HIDE_INTERNAL_API, + // it is needed for layout of other objects. + /** @internal */ + class Node : public UObject { + public: + Node(int32_t initialHash) : hash(initialHash), offset(0) {} + inline int32_t hashCode() const { return hash; } + // Handles node==NULL. + static inline int32_t hashCode(const Node *node) { return node==NULL ? 0 : node->hashCode(); } + // Base class operator==() compares the actual class types. + virtual UBool operator==(const Node &other) const; + inline UBool operator!=(const Node &other) const { return !operator==(other); } + /** + * Traverses the Node graph and numbers branch edges, with rightmost edges first. + * This is to avoid writing a duplicate node twice. + * + * Branch nodes in this trie data structure are not symmetric. + * Most branch edges "jump" to other nodes but the rightmost branch edges + * just continue without a jump. + * Therefore, write() must write the rightmost branch edge last + * (trie units are written backwards), and must write it at that point even if + * it is a duplicate of a node previously written elsewhere. + * + * This function visits and marks right branch edges first. + * Edges are numbered with increasingly negative values because we share the + * offset field which gets positive values when nodes are written. + * A branch edge also remembers the first number for any of its edges. + * + * When a further-left branch edge has a number in the range of the rightmost + * edge's numbers, then it will be written as part of the required right edge + * and we can avoid writing it first. + * + * After root.markRightEdgesFirst(-1) the offsets of all nodes are negative + * edge numbers. + * + * @param edgeNumber The first edge number for this node and its sub-nodes. + * @return An edge number that is at least the maximum-negative + * of the input edge number and the numbers of this node and all of its sub-nodes. + */ + virtual int32_t markRightEdgesFirst(int32_t edgeNumber); + // write() must set the offset to a positive value. + virtual void write(StringTrieBuilder &builder) = 0; + // See markRightEdgesFirst. + inline void writeUnlessInsideRightEdge(int32_t firstRight, int32_t lastRight, + StringTrieBuilder &builder) { + // Note: Edge numbers are negative, lastRight<=firstRight. + // If offset>0 then this node and its sub-nodes have been written already + // and we need not write them again. + // If this node is part of the unwritten right branch edge, + // then we wait until that is written. + if(offset<0 && (offsetStringSearch is a SearchIterator that provides + * language-sensitive text searching based on the comparison rules defined + * in a {@link RuleBasedCollator} object. + * StringSearch ensures that language eccentricity can be + * handled, e.g. for the German collator, characters ß and SS will be matched + * if case is chosen to be ignored. + * See the + * "ICU Collation Design Document" for more information. + *

+ * There are 2 match options for selection:
+ * Let S' be the sub-string of a text string S between the offsets start and + * end [start, end]. + *
+ * A pattern string P matches a text string S at the offsets [start, end] + * if + *

 
+ * option 1. Some canonical equivalent of P matches some canonical equivalent
+ *           of S'
+ * option 2. P matches S' and if P starts or ends with a combining mark,
+ *           there exists no non-ignorable combining mark before or after S?
+ *           in S respectively.
+ * 
+ * Option 2. will be the default. + *

+ * This search has APIs similar to that of other text iteration mechanisms + * such as the break iterators in BreakIterator. Using these + * APIs, it is easy to scan through text looking for all occurrences of + * a given pattern. This search iterator allows changing of direction by + * calling a reset followed by a next or previous. + * Though a direction change can occur without calling reset first, + * this operation comes with some speed penalty. + * Match results in the forward direction will match the result matches in + * the backwards direction in the reverse order + *

+ * SearchIterator provides APIs to specify the starting position + * within the text string to be searched, e.g. setOffset, + * preceding and following. Since the + * starting position will be set as it is specified, please take note that + * there are some danger points which the search may render incorrect + * results: + *

    + *
  • The midst of a substring that requires normalization. + *
  • If the following match is to be found, the position should not be the + * second character which requires to be swapped with the preceding + * character. Vice versa, if the preceding match is to be found, + * position to search from should not be the first character which + * requires to be swapped with the next character. E.g certain Thai and + * Lao characters require swapping. + *
  • If a following pattern match is to be found, any position within a + * contracting sequence except the first will fail. Vice versa if a + * preceding pattern match is to be found, a invalid starting point + * would be any character within a contracting sequence except the last. + *
+ *

+ * A BreakIterator can be used if only matches at logical breaks are desired. + * Using a BreakIterator will only give you results that exactly matches the + * boundaries given by the breakiterator. For instance the pattern "e" will + * not be found in the string "\u00e9" if a character break iterator is used. + *

+ * Options are provided to handle overlapping matches. + * E.g. In English, overlapping matches produces the result 0 and 2 + * for the pattern "abab" in the text "ababab", where else mutually + * exclusive matches only produce the result of 0. + *

+ * Though collator attributes will be taken into consideration while + * performing matches, there are no APIs here for setting and getting the + * attributes. These attributes can be set by getting the collator + * from getCollator and using the APIs in coll.h. + * Lastly to update StringSearch to the new collator attributes, + * reset has to be called. + *

+ * Restriction:
+ * Currently there are no composite characters that consists of a + * character with combining class > 0 before a character with combining + * class == 0. However, if such a character exists in the future, + * StringSearch does not guarantee the results for option 1. + *

+ * Consult the SearchIterator documentation for information on + * and examples of how to use instances of this class to implement text + * searching. + *


+ * UnicodeString target("The quick brown fox jumps over the lazy dog.");
+ * UnicodeString pattern("fox");
+ *
+ * UErrorCode      error = U_ZERO_ERROR;
+ * StringSearch iter(pattern, target, Locale::getUS(), NULL, status);
+ * for (int pos = iter.first(error);
+ *      pos != USEARCH_DONE; 
+ *      pos = iter.next(error))
+ * {
+ *     printf("Found match at %d pos, length is %d\n", pos, 
+ *                                             iter.getMatchLength());
+ * }
+ * 
+ *

+ * Note, StringSearch is not to be subclassed. + *

+ * @see SearchIterator + * @see RuleBasedCollator + * @since ICU 2.0 + */ + +class U_I18N_API StringSearch U_FINAL : public SearchIterator +{ +public: + + // public constructors and destructors -------------------------------- + + /** + * Creating a StringSearch instance using the argument locale + * language rule set. A collator will be created in the process, which + * will be owned by this instance and will be deleted during + * destruction + * @param pattern The text for which this object will search. + * @param text The text in which to search for the pattern. + * @param locale A locale which defines the language-sensitive + * comparison rules used to determine whether text in the + * pattern and target matches. + * @param breakiter A BreakIterator object used to constrain + * the matches that are found. Matches whose start and end + * indices in the target text are not boundaries as + * determined by the BreakIterator are + * ignored. If this behavior is not desired, + * NULL can be passed in instead. + * @param status for errors if any. If pattern or text is NULL, or if + * either the length of pattern or text is 0 then an + * U_ILLEGAL_ARGUMENT_ERROR is returned. + * @stable ICU 2.0 + */ + StringSearch(const UnicodeString &pattern, const UnicodeString &text, + const Locale &locale, + BreakIterator *breakiter, + UErrorCode &status); + + /** + * Creating a StringSearch instance using the argument collator + * language rule set. Note, user retains the ownership of this collator, + * it does not get destroyed during this instance's destruction. + * @param pattern The text for which this object will search. + * @param text The text in which to search for the pattern. + * @param coll A RuleBasedCollator object which defines + * the language-sensitive comparison rules used to + * determine whether text in the pattern and target + * matches. User is responsible for the clearing of this + * object. + * @param breakiter A BreakIterator object used to constrain + * the matches that are found. Matches whose start and end + * indices in the target text are not boundaries as + * determined by the BreakIterator are + * ignored. If this behavior is not desired, + * NULL can be passed in instead. + * @param status for errors if any. If either the length of pattern or + * text is 0 then an U_ILLEGAL_ARGUMENT_ERROR is returned. + * @stable ICU 2.0 + */ + StringSearch(const UnicodeString &pattern, + const UnicodeString &text, + RuleBasedCollator *coll, + BreakIterator *breakiter, + UErrorCode &status); + + /** + * Creating a StringSearch instance using the argument locale + * language rule set. A collator will be created in the process, which + * will be owned by this instance and will be deleted during + * destruction + *

+ * Note: No parsing of the text within the CharacterIterator + * will be done during searching for this version. The block of text + * in CharacterIterator will be used as it is. + * @param pattern The text for which this object will search. + * @param text The text iterator in which to search for the pattern. + * @param locale A locale which defines the language-sensitive + * comparison rules used to determine whether text in the + * pattern and target matches. User is responsible for + * the clearing of this object. + * @param breakiter A BreakIterator object used to constrain + * the matches that are found. Matches whose start and end + * indices in the target text are not boundaries as + * determined by the BreakIterator are + * ignored. If this behavior is not desired, + * NULL can be passed in instead. + * @param status for errors if any. If either the length of pattern or + * text is 0 then an U_ILLEGAL_ARGUMENT_ERROR is returned. + * @stable ICU 2.0 + */ + StringSearch(const UnicodeString &pattern, CharacterIterator &text, + const Locale &locale, + BreakIterator *breakiter, + UErrorCode &status); + + /** + * Creating a StringSearch instance using the argument collator + * language rule set. Note, user retains the ownership of this collator, + * it does not get destroyed during this instance's destruction. + *

+ * Note: No parsing of the text within the CharacterIterator + * will be done during searching for this version. The block of text + * in CharacterIterator will be used as it is. + * @param pattern The text for which this object will search. + * @param text The text in which to search for the pattern. + * @param coll A RuleBasedCollator object which defines + * the language-sensitive comparison rules used to + * determine whether text in the pattern and target + * matches. User is responsible for the clearing of this + * object. + * @param breakiter A BreakIterator object used to constrain + * the matches that are found. Matches whose start and end + * indices in the target text are not boundaries as + * determined by the BreakIterator are + * ignored. If this behavior is not desired, + * NULL can be passed in instead. + * @param status for errors if any. If either the length of pattern or + * text is 0 then an U_ILLEGAL_ARGUMENT_ERROR is returned. + * @stable ICU 2.0 + */ + StringSearch(const UnicodeString &pattern, CharacterIterator &text, + RuleBasedCollator *coll, + BreakIterator *breakiter, + UErrorCode &status); + + /** + * Copy constructor that creates a StringSearch instance with the same + * behavior, and iterating over the same text. + * @param that StringSearch instance to be copied. + * @stable ICU 2.0 + */ + StringSearch(const StringSearch &that); + + /** + * Destructor. Cleans up the search iterator data struct. + * If a collator is created in the constructor, it will be destroyed here. + * @stable ICU 2.0 + */ + virtual ~StringSearch(void); + + /** + * Clone this object. + * Clones can be used concurrently in multiple threads. + * If an error occurs, then NULL is returned. + * The caller must delete the clone. + * + * @return a clone of this object + * + * @see getDynamicClassID + * @stable ICU 2.8 + */ + StringSearch *clone() const; + + // operator overloading --------------------------------------------- + + /** + * Assignment operator. Sets this iterator to have the same behavior, + * and iterate over the same text, as the one passed in. + * @param that instance to be copied. + * @stable ICU 2.0 + */ + StringSearch & operator=(const StringSearch &that); + + /** + * Equality operator. + * @param that instance to be compared. + * @return TRUE if both instances have the same attributes, + * breakiterators, collators and iterate over the same text + * while looking for the same pattern. + * @stable ICU 2.0 + */ + virtual UBool operator==(const SearchIterator &that) const; + + // public get and set methods ---------------------------------------- + + /** + * Sets the index to point to the given position, and clears any state + * that's affected. + *

+ * This method takes the argument index and sets the position in the text + * string accordingly without checking if the index is pointing to a + * valid starting point to begin searching. + * @param position within the text to be set. If position is less + * than or greater than the text range for searching, + * an U_INDEX_OUTOFBOUNDS_ERROR will be returned + * @param status for errors if it occurs + * @stable ICU 2.0 + */ + virtual void setOffset(int32_t position, UErrorCode &status); + + /** + * Return the current index in the text being searched. + * If the iteration has gone past the end of the text + * (or past the beginning for a backwards search), USEARCH_DONE + * is returned. + * @return current index in the text being searched. + * @stable ICU 2.0 + */ + virtual int32_t getOffset(void) const; + + /** + * Set the target text to be searched. + * Text iteration will hence begin at the start of the text string. + * This method is + * useful if you want to re-use an iterator to search for the same + * pattern within a different body of text. + * @param text text string to be searched + * @param status for errors if any. If the text length is 0 then an + * U_ILLEGAL_ARGUMENT_ERROR is returned. + * @stable ICU 2.0 + */ + virtual void setText(const UnicodeString &text, UErrorCode &status); + + /** + * Set the target text to be searched. + * Text iteration will hence begin at the start of the text string. + * This method is + * useful if you want to re-use an iterator to search for the same + * pattern within a different body of text. + * Note: No parsing of the text within the CharacterIterator + * will be done during searching for this version. The block of text + * in CharacterIterator will be used as it is. + * @param text text string to be searched + * @param status for errors if any. If the text length is 0 then an + * U_ILLEGAL_ARGUMENT_ERROR is returned. + * @stable ICU 2.0 + */ + virtual void setText(CharacterIterator &text, UErrorCode &status); + + /** + * Gets the collator used for the language rules. + *

+ * Caller may modify but must not delete the RuleBasedCollator! + * Modifications to this collator will affect the original collator passed in to + * the StringSearch> constructor or to setCollator, if any. + * @return collator used for string search + * @stable ICU 2.0 + */ + RuleBasedCollator * getCollator() const; + + /** + * Sets the collator used for the language rules. User retains the + * ownership of this collator, thus the responsibility of deletion lies + * with the user. The iterator's position will not be changed by this method. + * @param coll collator + * @param status for errors if any + * @stable ICU 2.0 + */ + void setCollator(RuleBasedCollator *coll, UErrorCode &status); + + /** + * Sets the pattern used for matching. + * The iterator's position will not be changed by this method. + * @param pattern search pattern to be found + * @param status for errors if any. If the pattern length is 0 then an + * U_ILLEGAL_ARGUMENT_ERROR is returned. + * @stable ICU 2.0 + */ + void setPattern(const UnicodeString &pattern, UErrorCode &status); + + /** + * Gets the search pattern. + * @return pattern used for matching + * @stable ICU 2.0 + */ + const UnicodeString & getPattern() const; + + // public methods ---------------------------------------------------- + + /** + * Reset the iteration. + * Search will begin at the start of the text string if a forward + * iteration is initiated before a backwards iteration. Otherwise if + * a backwards iteration is initiated before a forwards iteration, the + * search will begin at the end of the text string. + * @stable ICU 2.0 + */ + virtual void reset(); + + /** + * Returns a copy of StringSearch with the same behavior, and + * iterating over the same text, as this one. Note that all data will be + * replicated, except for the user-specified collator and the + * breakiterator. + * @return cloned object + * @stable ICU 2.0 + */ + virtual SearchIterator * safeClone(void) const; + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.2 + */ + virtual UClassID getDynamicClassID() const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.2 + */ + static UClassID U_EXPORT2 getStaticClassID(); + +protected: + + // protected method ------------------------------------------------- + + /** + * Search forward for matching text, starting at a given location. + * Clients should not call this method directly; instead they should + * call {@link SearchIterator#next }. + *

+ * If a match is found, this method returns the index at which the match + * starts and calls {@link SearchIterator#setMatchLength } with the number + * of characters in the target text that make up the match. If no match + * is found, the method returns USEARCH_DONE. + *

+ * The StringSearch is adjusted so that its current index + * (as returned by {@link #getOffset }) is the match position if one was + * found. + * If a match is not found, USEARCH_DONE will be returned and + * the StringSearch will be adjusted to the index USEARCH_DONE. + * @param position The index in the target text at which the search + * starts + * @param status for errors if any occurs + * @return The index at which the matched text in the target starts, or + * USEARCH_DONE if no match was found. + * @stable ICU 2.0 + */ + virtual int32_t handleNext(int32_t position, UErrorCode &status); + + /** + * Search backward for matching text, starting at a given location. + * Clients should not call this method directly; instead they should call + * SearchIterator.previous(), which this method overrides. + *

+ * If a match is found, this method returns the index at which the match + * starts and calls {@link SearchIterator#setMatchLength } with the number + * of characters in the target text that make up the match. If no match + * is found, the method returns USEARCH_DONE. + *

+ * The StringSearch is adjusted so that its current index + * (as returned by {@link #getOffset }) is the match position if one was + * found. + * If a match is not found, USEARCH_DONE will be returned and + * the StringSearch will be adjusted to the index USEARCH_DONE. + * @param position The index in the target text at which the search + * starts. + * @param status for errors if any occurs + * @return The index at which the matched text in the target starts, or + * USEARCH_DONE if no match was found. + * @stable ICU 2.0 + */ + virtual int32_t handlePrev(int32_t position, UErrorCode &status); + +private : + StringSearch(); // default constructor not implemented + + // private data members ---------------------------------------------- + + /** + * Pattern text + * @stable ICU 2.0 + */ + UnicodeString m_pattern_; + /** + * String search struct data + * @stable ICU 2.0 + */ + UStringSearch *m_strsrch_; + +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_COLLATION */ + +#endif + diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/symtable.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/symtable.h new file mode 100644 index 0000000..35e5f23 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/symtable.h @@ -0,0 +1,114 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2000-2005, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Date Name Description +* 02/04/00 aliu Creation. +********************************************************************** +*/ +#ifndef SYMTABLE_H +#define SYMTABLE_H + +#include "unicode/utypes.h" +#include "unicode/uobject.h" + +/** + * \file + * \brief C++ API: An interface that defines both lookup protocol and parsing of + * symbolic names. + */ + +U_NAMESPACE_BEGIN + +class ParsePosition; +class UnicodeFunctor; +class UnicodeSet; +class UnicodeString; + +/** + * An interface that defines both lookup protocol and parsing of + * symbolic names. + * + *

A symbol table maintains two kinds of mappings. The first is + * between symbolic names and their values. For example, if the + * variable with the name "start" is set to the value "alpha" + * (perhaps, though not necessarily, through an expression such as + * "$start=alpha"), then the call lookup("start") will return the + * char[] array ['a', 'l', 'p', 'h', 'a']. + * + *

The second kind of mapping is between character values and + * UnicodeMatcher objects. This is used by RuleBasedTransliterator, + * which uses characters in the private use area to represent objects + * such as UnicodeSets. If U+E015 is mapped to the UnicodeSet [a-z], + * then lookupMatcher(0xE015) will return the UnicodeSet [a-z]. + * + *

Finally, a symbol table defines parsing behavior for symbolic + * names. All symbolic names start with the SYMBOL_REF character. + * When a parser encounters this character, it calls parseReference() + * with the position immediately following the SYMBOL_REF. The symbol + * table parses the name, if there is one, and returns it. + * + * @stable ICU 2.8 + */ +class U_COMMON_API SymbolTable /* not : public UObject because this is an interface/mixin class */ { +public: + + /** + * The character preceding a symbol reference name. + * @stable ICU 2.8 + */ + enum { SYMBOL_REF = 0x0024 /*$*/ }; + + /** + * Destructor. + * @stable ICU 2.8 + */ + virtual ~SymbolTable(); + + /** + * Lookup the characters associated with this string and return it. + * Return NULL if no such name exists. The resultant + * string may have length zero. + * @param s the symbolic name to lookup + * @return a string containing the name's value, or NULL if + * there is no mapping for s. + * @stable ICU 2.8 + */ + virtual const UnicodeString* lookup(const UnicodeString& s) const = 0; + + /** + * Lookup the UnicodeMatcher associated with the given character, and + * return it. Return NULL if not found. + * @param ch a 32-bit code point from 0 to 0x10FFFF inclusive. + * @return the UnicodeMatcher object represented by the given + * character, or NULL if there is no mapping for ch. + * @stable ICU 2.8 + */ + virtual const UnicodeFunctor* lookupMatcher(UChar32 ch) const = 0; + + /** + * Parse a symbol reference name from the given string, starting + * at the given position. If no valid symbol reference name is + * found, return the empty string and leave pos unchanged. That is, if the + * character at pos cannot start a name, or if pos is at or after + * text.length(), then return an empty string. This indicates an + * isolated SYMBOL_REF character. + * @param text the text to parse for the name + * @param pos on entry, the index of the first character to parse. + * This is the character following the SYMBOL_REF character. On + * exit, the index after the last parsed character. If the parse + * failed, pos is unchanged on exit. + * @param limit the index after the last character to be parsed. + * @return the parsed name, or an empty string if there is no + * valid symbolic name at the given position. + * @stable ICU 2.8 + */ + virtual UnicodeString parseReference(const UnicodeString& text, + ParsePosition& pos, int32_t limit) const = 0; +}; +U_NAMESPACE_END + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/tblcoll.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/tblcoll.h new file mode 100644 index 0000000..24ba213 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/tblcoll.h @@ -0,0 +1,877 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* Copyright (C) 1996-2016, International Business Machines Corporation and +* others. All Rights Reserved. +****************************************************************************** +*/ + +/** + * \file + * \brief C++ API: The RuleBasedCollator class implements the Collator abstract base class. + */ + +/** +* File tblcoll.h +* +* Created by: Helena Shih +* +* Modification History: +* +* Date Name Description +* 2/5/97 aliu Added streamIn and streamOut methods. Added +* constructor which reads RuleBasedCollator object from +* a binary file. Added writeToFile method which streams +* RuleBasedCollator out to a binary file. The streamIn +* and streamOut methods use istream and ostream objects +* in binary mode. +* 2/12/97 aliu Modified to use TableCollationData sub-object to +* hold invariant data. +* 2/13/97 aliu Moved several methods into this class from Collation. +* Added a private RuleBasedCollator(Locale&) constructor, +* to be used by Collator::createDefault(). General +* clean up. +* 2/20/97 helena Added clone, operator==, operator!=, operator=, and copy +* constructor and getDynamicClassID. +* 3/5/97 aliu Modified constructFromFile() to add parameter +* specifying whether or not binary loading is to be +* attempted. This is required for dynamic rule loading. +* 05/07/97 helena Added memory allocation error detection. +* 6/17/97 helena Added IDENTICAL strength for compare, changed getRules to +* use MergeCollation::getPattern. +* 6/20/97 helena Java class name change. +* 8/18/97 helena Added internal API documentation. +* 09/03/97 helena Added createCollationKeyValues(). +* 02/10/98 damiba Added compare with "length" parameter +* 08/05/98 erm Synched with 1.2 version of RuleBasedCollator.java +* 04/23/99 stephen Removed EDecompositionMode, merged with +* Normalizer::EMode +* 06/14/99 stephen Removed kResourceBundleSuffix +* 11/02/99 helena Collator performance enhancements. Eliminates the +* UnicodeString construction and special case for NO_OP. +* 11/23/99 srl More performance enhancements. Updates to NormalizerIterator +* internal state management. +* 12/15/99 aliu Update to support Thai collation. Move NormalizerIterator +* to implementation file. +* 01/29/01 synwee Modified into a C++ wrapper which calls C API +* (ucol.h) +* 2012-2014 markus Rewritten in C++ again. +*/ + +#ifndef TBLCOLL_H +#define TBLCOLL_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_COLLATION + +#include "unicode/coll.h" +#include "unicode/locid.h" +#include "unicode/uiter.h" +#include "unicode/ucol.h" + +U_NAMESPACE_BEGIN + +struct CollationCacheEntry; +struct CollationData; +struct CollationSettings; +struct CollationTailoring; +/** +* @stable ICU 2.0 +*/ +class StringSearch; +/** +* @stable ICU 2.0 +*/ +class CollationElementIterator; +class CollationKey; +class SortKeyByteSink; +class UnicodeSet; +class UnicodeString; +class UVector64; + +/** + * The RuleBasedCollator class provides the implementation of + * Collator, using data-driven tables. The user can create a customized + * table-based collation. + *

+ * For more information about the collation service see + * the User Guide. + *

+ * Collation service provides correct sorting orders for most locales supported in ICU. + * If specific data for a locale is not available, the orders eventually falls back + * to the CLDR root sort order. + *

+ * Sort ordering may be customized by providing your own set of rules. For more on + * this subject see the + * Collation Customization section of the User Guide. + *

+ * Note, RuleBasedCollator is not to be subclassed. + * @see Collator + */ +class U_I18N_API RuleBasedCollator : public Collator { +public: + /** + * RuleBasedCollator constructor. This takes the table rules and builds a + * collation table out of them. Please see RuleBasedCollator class + * description for more details on the collation rule syntax. + * @param rules the collation rules to build the collation table from. + * @param status reporting a success or an error. + * @stable ICU 2.0 + */ + RuleBasedCollator(const UnicodeString& rules, UErrorCode& status); + + /** + * RuleBasedCollator constructor. This takes the table rules and builds a + * collation table out of them. Please see RuleBasedCollator class + * description for more details on the collation rule syntax. + * @param rules the collation rules to build the collation table from. + * @param collationStrength strength for comparison + * @param status reporting a success or an error. + * @stable ICU 2.0 + */ + RuleBasedCollator(const UnicodeString& rules, + ECollationStrength collationStrength, + UErrorCode& status); + + /** + * RuleBasedCollator constructor. This takes the table rules and builds a + * collation table out of them. Please see RuleBasedCollator class + * description for more details on the collation rule syntax. + * @param rules the collation rules to build the collation table from. + * @param decompositionMode the normalisation mode + * @param status reporting a success or an error. + * @stable ICU 2.0 + */ + RuleBasedCollator(const UnicodeString& rules, + UColAttributeValue decompositionMode, + UErrorCode& status); + + /** + * RuleBasedCollator constructor. This takes the table rules and builds a + * collation table out of them. Please see RuleBasedCollator class + * description for more details on the collation rule syntax. + * @param rules the collation rules to build the collation table from. + * @param collationStrength strength for comparison + * @param decompositionMode the normalisation mode + * @param status reporting a success or an error. + * @stable ICU 2.0 + */ + RuleBasedCollator(const UnicodeString& rules, + ECollationStrength collationStrength, + UColAttributeValue decompositionMode, + UErrorCode& status); + +#ifndef U_HIDE_INTERNAL_API + /** + * TODO: document & propose as public API + * @internal + */ + RuleBasedCollator(const UnicodeString &rules, + UParseError &parseError, UnicodeString &reason, + UErrorCode &errorCode); +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Copy constructor. + * @param other the RuleBasedCollator object to be copied + * @stable ICU 2.0 + */ + RuleBasedCollator(const RuleBasedCollator& other); + + + /** Opens a collator from a collator binary image created using + * cloneBinary. Binary image used in instantiation of the + * collator remains owned by the user and should stay around for + * the lifetime of the collator. The API also takes a base collator + * which must be the root collator. + * @param bin binary image owned by the user and required through the + * lifetime of the collator + * @param length size of the image. If negative, the API will try to + * figure out the length of the image + * @param base Base collator, for lookup of untailored characters. + * Must be the root collator, must not be NULL. + * The base is required to be present through the lifetime of the collator. + * @param status for catching errors + * @return newly created collator + * @see cloneBinary + * @stable ICU 3.4 + */ + RuleBasedCollator(const uint8_t *bin, int32_t length, + const RuleBasedCollator *base, + UErrorCode &status); + + /** + * Destructor. + * @stable ICU 2.0 + */ + virtual ~RuleBasedCollator(); + + /** + * Assignment operator. + * @param other other RuleBasedCollator object to copy from. + * @stable ICU 2.0 + */ + RuleBasedCollator& operator=(const RuleBasedCollator& other); + + /** + * Returns true if argument is the same as this object. + * @param other Collator object to be compared. + * @return true if arguments is the same as this object. + * @stable ICU 2.0 + */ + virtual UBool operator==(const Collator& other) const; + + /** + * Makes a copy of this object. + * @return a copy of this object, owned by the caller + * @stable ICU 2.0 + */ + virtual Collator* clone(void) const; + + /** + * Creates a collation element iterator for the source string. The caller of + * this method is responsible for the memory management of the return + * pointer. + * @param source the string over which the CollationElementIterator will + * iterate. + * @return the collation element iterator of the source string using this as + * the based Collator. + * @stable ICU 2.2 + */ + virtual CollationElementIterator* createCollationElementIterator( + const UnicodeString& source) const; + + /** + * Creates a collation element iterator for the source. The caller of this + * method is responsible for the memory management of the returned pointer. + * @param source the CharacterIterator which produces the characters over + * which the CollationElementItgerator will iterate. + * @return the collation element iterator of the source using this as the + * based Collator. + * @stable ICU 2.2 + */ + virtual CollationElementIterator* createCollationElementIterator( + const CharacterIterator& source) const; + + // Make deprecated versions of Collator::compare() visible. + using Collator::compare; + + /** + * The comparison function compares the character data stored in two + * different strings. Returns information about whether a string is less + * than, greater than or equal to another string. + * @param source the source string to be compared with. + * @param target the string that is to be compared with the source string. + * @param status possible error code + * @return Returns an enum value. UCOL_GREATER if source is greater + * than target; UCOL_EQUAL if source is equal to target; UCOL_LESS if source is less + * than target + * @stable ICU 2.6 + **/ + virtual UCollationResult compare(const UnicodeString& source, + const UnicodeString& target, + UErrorCode &status) const; + + /** + * Does the same thing as compare but limits the comparison to a specified + * length + * @param source the source string to be compared with. + * @param target the string that is to be compared with the source string. + * @param length the length the comparison is limited to + * @param status possible error code + * @return Returns an enum value. UCOL_GREATER if source (up to the specified + * length) is greater than target; UCOL_EQUAL if source (up to specified + * length) is equal to target; UCOL_LESS if source (up to the specified + * length) is less than target. + * @stable ICU 2.6 + */ + virtual UCollationResult compare(const UnicodeString& source, + const UnicodeString& target, + int32_t length, + UErrorCode &status) const; + + /** + * The comparison function compares the character data stored in two + * different string arrays. Returns information about whether a string array + * is less than, greater than or equal to another string array. + * @param source the source string array to be compared with. + * @param sourceLength the length of the source string array. If this value + * is equal to -1, the string array is null-terminated. + * @param target the string that is to be compared with the source string. + * @param targetLength the length of the target string array. If this value + * is equal to -1, the string array is null-terminated. + * @param status possible error code + * @return Returns an enum value. UCOL_GREATER if source is greater + * than target; UCOL_EQUAL if source is equal to target; UCOL_LESS if source is less + * than target + * @stable ICU 2.6 + */ + virtual UCollationResult compare(const char16_t* source, int32_t sourceLength, + const char16_t* target, int32_t targetLength, + UErrorCode &status) const; + + /** + * Compares two strings using the Collator. + * Returns whether the first one compares less than/equal to/greater than + * the second one. + * This version takes UCharIterator input. + * @param sIter the first ("source") string iterator + * @param tIter the second ("target") string iterator + * @param status ICU status + * @return UCOL_LESS, UCOL_EQUAL or UCOL_GREATER + * @stable ICU 4.2 + */ + virtual UCollationResult compare(UCharIterator &sIter, + UCharIterator &tIter, + UErrorCode &status) const; + + /** + * Compares two UTF-8 strings using the Collator. + * Returns whether the first one compares less than/equal to/greater than + * the second one. + * This version takes UTF-8 input. + * Note that a StringPiece can be implicitly constructed + * from a std::string or a NUL-terminated const char * string. + * @param source the first UTF-8 string + * @param target the second UTF-8 string + * @param status ICU status + * @return UCOL_LESS, UCOL_EQUAL or UCOL_GREATER + * @stable ICU 51 + */ + virtual UCollationResult compareUTF8(const StringPiece &source, + const StringPiece &target, + UErrorCode &status) const; + + /** + * Transforms the string into a series of characters + * that can be compared with CollationKey.compare(). + * + * Note that sort keys are often less efficient than simply doing comparison. + * For more details, see the ICU User Guide. + * + * @param source the source string. + * @param key the transformed key of the source string. + * @param status the error code status. + * @return the transformed key. + * @see CollationKey + * @stable ICU 2.0 + */ + virtual CollationKey& getCollationKey(const UnicodeString& source, + CollationKey& key, + UErrorCode& status) const; + + /** + * Transforms a specified region of the string into a series of characters + * that can be compared with CollationKey.compare. + * + * Note that sort keys are often less efficient than simply doing comparison. + * For more details, see the ICU User Guide. + * + * @param source the source string. + * @param sourceLength the length of the source string. + * @param key the transformed key of the source string. + * @param status the error code status. + * @return the transformed key. + * @see CollationKey + * @stable ICU 2.0 + */ + virtual CollationKey& getCollationKey(const char16_t *source, + int32_t sourceLength, + CollationKey& key, + UErrorCode& status) const; + + /** + * Generates the hash code for the rule-based collation object. + * @return the hash code. + * @stable ICU 2.0 + */ + virtual int32_t hashCode() const; + + /** + * Gets the locale of the Collator + * @param type can be either requested, valid or actual locale. For more + * information see the definition of ULocDataLocaleType in + * uloc.h + * @param status the error code status. + * @return locale where the collation data lives. If the collator + * was instantiated from rules, locale is empty. + * @deprecated ICU 2.8 likely to change in ICU 3.0, based on feedback + */ + virtual Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const; + + /** + * Gets the tailoring rules for this collator. + * @return the collation tailoring from which this collator was created + * @stable ICU 2.0 + */ + const UnicodeString& getRules() const; + + /** + * Gets the version information for a Collator. + * @param info the version # information, the result will be filled in + * @stable ICU 2.0 + */ + virtual void getVersion(UVersionInfo info) const; + +#ifndef U_HIDE_DEPRECATED_API + /** + * Returns the maximum length of any expansion sequences that end with the + * specified comparison order. + * + * This is specific to the kind of collation element values and sequences + * returned by the CollationElementIterator. + * Call CollationElementIterator::getMaxExpansion() instead. + * + * @param order a collation order returned by CollationElementIterator::previous + * or CollationElementIterator::next. + * @return maximum size of the expansion sequences ending with the collation + * element, or 1 if the collation element does not occur at the end of + * any expansion sequence + * @see CollationElementIterator#getMaxExpansion + * @deprecated ICU 51 Use CollationElementIterator::getMaxExpansion() instead. + */ + int32_t getMaxExpansion(int32_t order) const; +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This + * method is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and clone() + * methods call this method. + * @return The class ID for this object. All objects of a given class have + * the same class ID. Objects of other classes have different class + * IDs. + * @stable ICU 2.0 + */ + virtual UClassID getDynamicClassID(void) const; + + /** + * Returns the class ID for this class. This is useful only for comparing to + * a return value from getDynamicClassID(). For example: + *

+     * Base* polymorphic_pointer = createPolymorphicObject();
+     * if (polymorphic_pointer->getDynamicClassID() ==
+     *                                          Derived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @stable ICU 2.0 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + +#ifndef U_HIDE_DEPRECATED_API + /** + * Do not use this method: The caller and the ICU library might use different heaps. + * Use cloneBinary() instead which writes to caller-provided memory. + * + * Returns a binary format of this collator. + * @param length Returns the length of the data, in bytes + * @param status the error code status. + * @return memory, owned by the caller, of size 'length' bytes. + * @deprecated ICU 52. Use cloneBinary() instead. + */ + uint8_t *cloneRuleData(int32_t &length, UErrorCode &status) const; +#endif /* U_HIDE_DEPRECATED_API */ + + /** Creates a binary image of a collator. This binary image can be stored and + * later used to instantiate a collator using ucol_openBinary. + * This API supports preflighting. + * @param buffer a fill-in buffer to receive the binary image + * @param capacity capacity of the destination buffer + * @param status for catching errors + * @return size of the image + * @see ucol_openBinary + * @stable ICU 3.4 + */ + int32_t cloneBinary(uint8_t *buffer, int32_t capacity, UErrorCode &status) const; + + /** + * Returns current rules. Delta defines whether full rules are returned or + * just the tailoring. + * + * getRules(void) should normally be used instead. + * See http://userguide.icu-project.org/collation/customization#TOC-Building-on-Existing-Locales + * @param delta one of UCOL_TAILORING_ONLY, UCOL_FULL_RULES. + * @param buffer UnicodeString to store the result rules + * @stable ICU 2.2 + * @see UCOL_FULL_RULES + */ + void getRules(UColRuleOption delta, UnicodeString &buffer) const; + + /** + * Universal attribute setter + * @param attr attribute type + * @param value attribute value + * @param status to indicate whether the operation went on smoothly or there were errors + * @stable ICU 2.2 + */ + virtual void setAttribute(UColAttribute attr, UColAttributeValue value, + UErrorCode &status); + + /** + * Universal attribute getter. + * @param attr attribute type + * @param status to indicate whether the operation went on smoothly or there were errors + * @return attribute value + * @stable ICU 2.2 + */ + virtual UColAttributeValue getAttribute(UColAttribute attr, + UErrorCode &status) const; + + /** + * Sets the variable top to the top of the specified reordering group. + * The variable top determines the highest-sorting character + * which is affected by UCOL_ALTERNATE_HANDLING. + * If that attribute is set to UCOL_NON_IGNORABLE, then the variable top has no effect. + * @param group one of UCOL_REORDER_CODE_SPACE, UCOL_REORDER_CODE_PUNCTUATION, + * UCOL_REORDER_CODE_SYMBOL, UCOL_REORDER_CODE_CURRENCY; + * or UCOL_REORDER_CODE_DEFAULT to restore the default max variable group + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return *this + * @see getMaxVariable + * @stable ICU 53 + */ + virtual Collator &setMaxVariable(UColReorderCode group, UErrorCode &errorCode); + + /** + * Returns the maximum reordering group whose characters are affected by UCOL_ALTERNATE_HANDLING. + * @return the maximum variable reordering group. + * @see setMaxVariable + * @stable ICU 53 + */ + virtual UColReorderCode getMaxVariable() const; + + /** + * Sets the variable top to the primary weight of the specified string. + * + * Beginning with ICU 53, the variable top is pinned to + * the top of one of the supported reordering groups, + * and it must not be beyond the last of those groups. + * See setMaxVariable(). + * @param varTop one or more (if contraction) char16_ts to which the variable top should be set + * @param len length of variable top string. If -1 it is considered to be zero terminated. + * @param status error code. If error code is set, the return value is undefined. Errors set by this function are:
+ * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such contraction
+ * U_ILLEGAL_ARGUMENT_ERROR if the variable top is beyond + * the last reordering group supported by setMaxVariable() + * @return variable top primary weight + * @deprecated ICU 53 Call setMaxVariable() instead. + */ + virtual uint32_t setVariableTop(const char16_t *varTop, int32_t len, UErrorCode &status); + + /** + * Sets the variable top to the primary weight of the specified string. + * + * Beginning with ICU 53, the variable top is pinned to + * the top of one of the supported reordering groups, + * and it must not be beyond the last of those groups. + * See setMaxVariable(). + * @param varTop a UnicodeString size 1 or more (if contraction) of char16_ts to which the variable top should be set + * @param status error code. If error code is set, the return value is undefined. Errors set by this function are:
+ * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such contraction
+ * U_ILLEGAL_ARGUMENT_ERROR if the variable top is beyond + * the last reordering group supported by setMaxVariable() + * @return variable top primary weight + * @deprecated ICU 53 Call setMaxVariable() instead. + */ + virtual uint32_t setVariableTop(const UnicodeString &varTop, UErrorCode &status); + + /** + * Sets the variable top to the specified primary weight. + * + * Beginning with ICU 53, the variable top is pinned to + * the top of one of the supported reordering groups, + * and it must not be beyond the last of those groups. + * See setMaxVariable(). + * @param varTop primary weight, as returned by setVariableTop or ucol_getVariableTop + * @param status error code + * @deprecated ICU 53 Call setMaxVariable() instead. + */ + virtual void setVariableTop(uint32_t varTop, UErrorCode &status); + + /** + * Gets the variable top value of a Collator. + * @param status error code (not changed by function). If error code is set, the return value is undefined. + * @return the variable top primary weight + * @see getMaxVariable + * @stable ICU 2.0 + */ + virtual uint32_t getVariableTop(UErrorCode &status) const; + + /** + * Get a UnicodeSet that contains all the characters and sequences tailored in + * this collator. + * @param status error code of the operation + * @return a pointer to a UnicodeSet object containing all the + * code points and sequences that may sort differently than + * in the root collator. The object must be disposed of by using delete + * @stable ICU 2.4 + */ + virtual UnicodeSet *getTailoredSet(UErrorCode &status) const; + + /** + * Get the sort key as an array of bytes from a UnicodeString. + * + * Note that sort keys are often less efficient than simply doing comparison. + * For more details, see the ICU User Guide. + * + * @param source string to be processed. + * @param result buffer to store result in. If NULL, number of bytes needed + * will be returned. + * @param resultLength length of the result buffer. If if not enough the + * buffer will be filled to capacity. + * @return Number of bytes needed for storing the sort key + * @stable ICU 2.0 + */ + virtual int32_t getSortKey(const UnicodeString& source, uint8_t *result, + int32_t resultLength) const; + + /** + * Get the sort key as an array of bytes from a char16_t buffer. + * + * Note that sort keys are often less efficient than simply doing comparison. + * For more details, see the ICU User Guide. + * + * @param source string to be processed. + * @param sourceLength length of string to be processed. If -1, the string + * is 0 terminated and length will be decided by the function. + * @param result buffer to store result in. If NULL, number of bytes needed + * will be returned. + * @param resultLength length of the result buffer. If if not enough the + * buffer will be filled to capacity. + * @return Number of bytes needed for storing the sort key + * @stable ICU 2.2 + */ + virtual int32_t getSortKey(const char16_t *source, int32_t sourceLength, + uint8_t *result, int32_t resultLength) const; + + /** + * Retrieves the reordering codes for this collator. + * @param dest The array to fill with the script ordering. + * @param destCapacity The length of dest. If it is 0, then dest may be NULL and the function + * will only return the length of the result without writing any codes (pre-flighting). + * @param status A reference to an error code value, which must not indicate + * a failure before the function call. + * @return The length of the script ordering array. + * @see ucol_setReorderCodes + * @see Collator#getEquivalentReorderCodes + * @see Collator#setReorderCodes + * @stable ICU 4.8 + */ + virtual int32_t getReorderCodes(int32_t *dest, + int32_t destCapacity, + UErrorCode& status) const; + + /** + * Sets the ordering of scripts for this collator. + * @param reorderCodes An array of script codes in the new order. This can be NULL if the + * length is also set to 0. An empty array will clear any reordering codes on the collator. + * @param reorderCodesLength The length of reorderCodes. + * @param status error code + * @see ucol_setReorderCodes + * @see Collator#getReorderCodes + * @see Collator#getEquivalentReorderCodes + * @stable ICU 4.8 + */ + virtual void setReorderCodes(const int32_t* reorderCodes, + int32_t reorderCodesLength, + UErrorCode& status) ; + + /** + * Implements ucol_strcollUTF8(). + * @internal + */ + virtual UCollationResult internalCompareUTF8( + const char *left, int32_t leftLength, + const char *right, int32_t rightLength, + UErrorCode &errorCode) const; + + /** Get the short definition string for a collator. This internal API harvests the collator's + * locale and the attribute set and produces a string that can be used for opening + * a collator with the same attributes using the ucol_openFromShortString API. + * This string will be normalized. + * The structure and the syntax of the string is defined in the "Naming collators" + * section of the users guide: + * http://userguide.icu-project.org/collation/concepts#TOC-Collator-naming-scheme + * This function supports preflighting. + * + * This is internal, and intended to be used with delegate converters. + * + * @param locale a locale that will appear as a collators locale in the resulting + * short string definition. If NULL, the locale will be harvested + * from the collator. + * @param buffer space to hold the resulting string + * @param capacity capacity of the buffer + * @param status for returning errors. All the preflighting errors are featured + * @return length of the resulting string + * @see ucol_openFromShortString + * @see ucol_normalizeShortDefinitionString + * @see ucol_getShortDefinitionString + * @internal + */ + virtual int32_t internalGetShortDefinitionString(const char *locale, + char *buffer, + int32_t capacity, + UErrorCode &status) const; + + /** + * Implements ucol_nextSortKeyPart(). + * @internal + */ + virtual int32_t internalNextSortKeyPart( + UCharIterator *iter, uint32_t state[2], + uint8_t *dest, int32_t count, UErrorCode &errorCode) const; + + // Do not enclose the default constructor with #ifndef U_HIDE_INTERNAL_API + /** + * Only for use in ucol_openRules(). + * @internal + */ + RuleBasedCollator(); + +#ifndef U_HIDE_INTERNAL_API + /** + * Implements ucol_getLocaleByType(). + * Needed because the lifetime of the locale ID string must match that of the collator. + * getLocale() returns a copy of a Locale, with minimal lifetime in a C wrapper. + * @internal + */ + const char *internalGetLocaleID(ULocDataLocaleType type, UErrorCode &errorCode) const; + + /** + * Implements ucol_getContractionsAndExpansions(). + * Gets this collator's sets of contraction strings and/or + * characters and strings that map to multiple collation elements (expansions). + * If addPrefixes is TRUE, then contractions that are expressed as + * prefix/pre-context rules are included. + * @param contractions if not NULL, the set to hold the contractions + * @param expansions if not NULL, the set to hold the expansions + * @param addPrefixes include prefix contextual mappings + * @param errorCode in/out ICU error code + * @internal + */ + void internalGetContractionsAndExpansions( + UnicodeSet *contractions, UnicodeSet *expansions, + UBool addPrefixes, UErrorCode &errorCode) const; + + /** + * Adds the contractions that start with character c to the set. + * Ignores prefixes. Used by AlphabeticIndex. + * @internal + */ + void internalAddContractions(UChar32 c, UnicodeSet &set, UErrorCode &errorCode) const; + + /** + * Implements from-rule constructors, and ucol_openRules(). + * @internal + */ + void internalBuildTailoring( + const UnicodeString &rules, + int32_t strength, + UColAttributeValue decompositionMode, + UParseError *outParseError, UnicodeString *outReason, + UErrorCode &errorCode); + + /** @internal */ + static inline RuleBasedCollator *rbcFromUCollator(UCollator *uc) { + return dynamic_cast(fromUCollator(uc)); + } + /** @internal */ + static inline const RuleBasedCollator *rbcFromUCollator(const UCollator *uc) { + return dynamic_cast(fromUCollator(uc)); + } + + /** + * Appends the CEs for the string to the vector. + * @internal for tests & tools + */ + void internalGetCEs(const UnicodeString &str, UVector64 &ces, UErrorCode &errorCode) const; +#endif // U_HIDE_INTERNAL_API + +protected: + /** + * Used internally by registration to define the requested and valid locales. + * @param requestedLocale the requested locale + * @param validLocale the valid locale + * @param actualLocale the actual locale + * @internal + */ + virtual void setLocales(const Locale& requestedLocale, const Locale& validLocale, const Locale& actualLocale); + +private: + friend class CollationElementIterator; + friend class Collator; + + RuleBasedCollator(const CollationCacheEntry *entry); + + /** + * Enumeration of attributes that are relevant for short definition strings + * (e.g., ucol_getShortDefinitionString()). + * Effectively extends UColAttribute. + */ + enum Attributes { + ATTR_VARIABLE_TOP = UCOL_ATTRIBUTE_COUNT, + ATTR_LIMIT + }; + + void adoptTailoring(CollationTailoring *t, UErrorCode &errorCode); + + // Both lengths must be <0 or else both must be >=0. + UCollationResult doCompare(const char16_t *left, int32_t leftLength, + const char16_t *right, int32_t rightLength, + UErrorCode &errorCode) const; + UCollationResult doCompare(const uint8_t *left, int32_t leftLength, + const uint8_t *right, int32_t rightLength, + UErrorCode &errorCode) const; + + void writeSortKey(const char16_t *s, int32_t length, + SortKeyByteSink &sink, UErrorCode &errorCode) const; + + void writeIdenticalLevel(const char16_t *s, const char16_t *limit, + SortKeyByteSink &sink, UErrorCode &errorCode) const; + + const CollationSettings &getDefaultSettings() const; + + void setAttributeDefault(int32_t attribute) { + explicitlySetAttributes &= ~((uint32_t)1 << attribute); + } + void setAttributeExplicitly(int32_t attribute) { + explicitlySetAttributes |= (uint32_t)1 << attribute; + } + UBool attributeHasBeenSetExplicitly(int32_t attribute) const { + // assert(0 <= attribute < ATTR_LIMIT); + return (UBool)((explicitlySetAttributes & ((uint32_t)1 << attribute)) != 0); + } + + /** + * Tests whether a character is "unsafe" for use as a collation starting point. + * + * @param c code point or code unit + * @return TRUE if c is unsafe + * @see CollationElementIterator#setOffset(int) + */ + UBool isUnsafe(UChar32 c) const; + + static void U_CALLCONV computeMaxExpansions(const CollationTailoring *t, UErrorCode &errorCode); + UBool initMaxExpansions(UErrorCode &errorCode) const; + + void setFastLatinOptions(CollationSettings &ownedSettings) const; + + const CollationData *data; + const CollationSettings *settings; // reference-counted + const CollationTailoring *tailoring; // alias of cacheEntry->tailoring + const CollationCacheEntry *cacheEntry; // reference-counted + Locale validLocale; + uint32_t explicitlySetAttributes; + + UBool actualLocaleIsSameAsValid; +}; + +U_NAMESPACE_END + +#endif // !UCONFIG_NO_COLLATION +#endif // TBLCOLL_H diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/timezone.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/timezone.h new file mode 100644 index 0000000..83dee31 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/timezone.h @@ -0,0 +1,965 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/************************************************************************* +* Copyright (c) 1997-2016, International Business Machines Corporation +* and others. All Rights Reserved. +************************************************************************** +* +* File TIMEZONE.H +* +* Modification History: +* +* Date Name Description +* 04/21/97 aliu Overhauled header. +* 07/09/97 helena Changed createInstance to createDefault. +* 08/06/97 aliu Removed dependency on internal header for Hashtable. +* 08/10/98 stephen Changed getDisplayName() API conventions to match +* 08/19/98 stephen Changed createTimeZone() to never return 0 +* 09/02/98 stephen Sync to JDK 1.2 8/31 +* - Added getOffset(... monthlen ...) +* - Added hasSameRules() +* 09/15/98 stephen Added getStaticClassID +* 12/03/99 aliu Moved data out of static table into icudata.dll. +* Hashtable replaced by new static data structures. +* 12/14/99 aliu Made GMT public. +* 08/15/01 grhoten Made GMT private and added the getGMT() function +************************************************************************** +*/ + +#ifndef TIMEZONE_H +#define TIMEZONE_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: TimeZone object + */ + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/uobject.h" +#include "unicode/unistr.h" +#include "unicode/ures.h" +#include "unicode/ucal.h" + +U_NAMESPACE_BEGIN + +class StringEnumeration; + +/** + * + * TimeZone represents a time zone offset, and also figures out daylight + * savings. + * + *

+ * Typically, you get a TimeZone using createDefault + * which creates a TimeZone based on the time zone where the program + * is running. For example, for a program running in Japan, createDefault + * creates a TimeZone object based on Japanese Standard Time. + * + *

+ * You can also get a TimeZone using createTimeZone along + * with a time zone ID. For instance, the time zone ID for the US Pacific + * Time zone is "America/Los_Angeles". So, you can get a Pacific Time TimeZone object + * with: + * \htmlonly

\endhtmlonly + *
+ * TimeZone *tz = TimeZone::createTimeZone("America/Los_Angeles");
+ * 
+ * \htmlonly
\endhtmlonly + * You can use the createEnumeration method to iterate through + * all the supported time zone IDs, or the getCanonicalID method to check + * if a time zone ID is supported or not. You can then choose a + * supported ID to get a TimeZone. + * If the time zone you want is not represented by one of the + * supported IDs, then you can create a custom time zone ID with + * the following syntax: + * + * \htmlonly
\endhtmlonly + *
+ * GMT[+|-]hh[[:]mm]
+ * 
+ * \htmlonly
\endhtmlonly + * + * For example, you might specify GMT+14:00 as a custom + * time zone ID. The TimeZone that is returned + * when you specify a custom time zone ID uses the specified + * offset from GMT(=UTC) and does not observe daylight saving + * time. For example, you might specify GMT+14:00 as a custom + * time zone ID to create a TimeZone representing 14 hours ahead + * of GMT (with no daylight saving time). In addition, + * getCanonicalID can also be used to + * normalize a custom time zone ID. + * + * TimeZone is an abstract class representing a time zone. A TimeZone is needed for + * Calendar to produce local time for a particular time zone. A TimeZone comprises + * three basic pieces of information: + *
    + *
  • A time zone offset; that, is the number of milliseconds to add or subtract + * from a time expressed in terms of GMT to convert it to the same time in that + * time zone (without taking daylight savings time into account).
  • + *
  • Logic necessary to take daylight savings time into account if daylight savings + * time is observed in that time zone (e.g., the days and hours on which daylight + * savings time begins and ends).
  • + *
  • An ID. This is a text string that uniquely identifies the time zone.
  • + *
+ * + * (Only the ID is actually implemented in TimeZone; subclasses of TimeZone may handle + * daylight savings time and GMT offset in different ways. Currently we have the following + * TimeZone subclasses: RuleBasedTimeZone, SimpleTimeZone, and VTimeZone.) + *

+ * The TimeZone class contains a static list containing a TimeZone object for every + * combination of GMT offset and daylight-savings time rules currently in use in the + * world, each with a unique ID. Each ID consists of a region (usually a continent or + * ocean) and a city in that region, separated by a slash, (for example, US Pacific + * Time is "America/Los_Angeles.") Because older versions of this class used + * three- or four-letter abbreviations instead, there is also a table that maps the older + * abbreviations to the newer ones (for example, "PST" maps to "America/Los_Angeles"). + * Anywhere the API requires an ID, you can use either form. + *

+ * To create a new TimeZone, you call the factory function TimeZone::createTimeZone() + * and pass it a time zone ID. You can use the createEnumeration() function to + * obtain a list of all the time zone IDs recognized by createTimeZone(). + *

+ * You can also use TimeZone::createDefault() to create a TimeZone. This function uses + * platform-specific APIs to produce a TimeZone for the time zone corresponding to + * the client's computer's physical location. For example, if you're in Japan (assuming + * your machine is set up correctly), TimeZone::createDefault() will return a TimeZone + * for Japanese Standard Time ("Asia/Tokyo"). + */ +class U_I18N_API TimeZone : public UObject { +public: + /** + * @stable ICU 2.0 + */ + virtual ~TimeZone(); + + /** + * Returns the "unknown" time zone. + * It behaves like the GMT/UTC time zone but has the + * UCAL_UNKNOWN_ZONE_ID = "Etc/Unknown". + * createTimeZone() returns a mutable clone of this time zone if the input ID is not recognized. + * + * @return the "unknown" time zone. + * @see UCAL_UNKNOWN_ZONE_ID + * @see createTimeZone + * @see getGMT + * @stable ICU 49 + */ + static const TimeZone& U_EXPORT2 getUnknown(); + + /** + * The GMT (=UTC) time zone has a raw offset of zero and does not use daylight + * savings time. This is a commonly used time zone. + * + *

Note: For backward compatibility reason, the ID used by the time + * zone returned by this method is "GMT", although the ICU's canonical + * ID for the GMT time zone is "Etc/GMT". + * + * @return the GMT/UTC time zone. + * @see getUnknown + * @stable ICU 2.0 + */ + static const TimeZone* U_EXPORT2 getGMT(void); + + /** + * Creates a TimeZone for the given ID. + * @param ID the ID for a TimeZone, such as "America/Los_Angeles", + * or a custom ID such as "GMT-8:00". + * @return the specified TimeZone, or a mutable clone of getUnknown() + * if the given ID cannot be understood or if the given ID is "Etc/Unknown". + * The return result is guaranteed to be non-NULL. + * If you require that the specific zone asked for be returned, + * compare the result with getUnknown() or check the ID of the return result. + * @stable ICU 2.0 + */ + static TimeZone* U_EXPORT2 createTimeZone(const UnicodeString& ID); + + /** + * Returns an enumeration over system time zone IDs with the given + * filter conditions. + * @param zoneType The system time zone type. + * @param region The ISO 3166 two-letter country code or UN M.49 + * three-digit area code. When NULL, no filtering + * done by region. + * @param rawOffset An offset from GMT in milliseconds, ignoring + * the effect of daylight savings time, if any. + * When NULL, no filtering done by zone offset. + * @param ec Output param to filled in with a success or + * an error. + * @return an enumeration object, owned by the caller. + * @stable ICU 4.8 + */ + static StringEnumeration* U_EXPORT2 createTimeZoneIDEnumeration( + USystemTimeZoneType zoneType, + const char* region, + const int32_t* rawOffset, + UErrorCode& ec); + + /** + * Returns an enumeration over all recognized time zone IDs. (i.e., + * all strings that createTimeZone() accepts) + * + * @return an enumeration object, owned by the caller. + * @stable ICU 2.4 + */ + static StringEnumeration* U_EXPORT2 createEnumeration(); + + /** + * Returns an enumeration over time zone IDs with a given raw + * offset from GMT. There may be several times zones with the + * same GMT offset that differ in the way they handle daylight + * savings time. For example, the state of Arizona doesn't + * observe daylight savings time. If you ask for the time zone + * IDs corresponding to GMT-7:00, you'll get back an enumeration + * over two time zone IDs: "America/Denver," which corresponds to + * Mountain Standard Time in the winter and Mountain Daylight Time + * in the summer, and "America/Phoenix", which corresponds to + * Mountain Standard Time year-round, even in the summer. + * + * @param rawOffset an offset from GMT in milliseconds, ignoring + * the effect of daylight savings time, if any + * @return an enumeration object, owned by the caller + * @stable ICU 2.4 + */ + static StringEnumeration* U_EXPORT2 createEnumeration(int32_t rawOffset); + + /** + * Returns an enumeration over time zone IDs associated with the + * given country. Some zones are affiliated with no country + * (e.g., "UTC"); these may also be retrieved, as a group. + * + * @param country The ISO 3166 two-letter country code, or NULL to + * retrieve zones not affiliated with any country. + * @return an enumeration object, owned by the caller + * @stable ICU 2.4 + */ + static StringEnumeration* U_EXPORT2 createEnumeration(const char* country); + + /** + * Returns the number of IDs in the equivalency group that + * includes the given ID. An equivalency group contains zones + * that have the same GMT offset and rules. + * + *

The returned count includes the given ID; it is always >= 1. + * The given ID must be a system time zone. If it is not, returns + * zero. + * @param id a system time zone ID + * @return the number of zones in the equivalency group containing + * 'id', or zero if 'id' is not a valid system ID + * @see #getEquivalentID + * @stable ICU 2.0 + */ + static int32_t U_EXPORT2 countEquivalentIDs(const UnicodeString& id); + + /** + * Returns an ID in the equivalency group that + * includes the given ID. An equivalency group contains zones + * that have the same GMT offset and rules. + * + *

The given index must be in the range 0..n-1, where n is the + * value returned by countEquivalentIDs(id). For + * some value of 'index', the returned value will be equal to the + * given id. If the given id is not a valid system time zone, or + * if 'index' is out of range, then returns an empty string. + * @param id a system time zone ID + * @param index a value from 0 to n-1, where n is the value + * returned by countEquivalentIDs(id) + * @return the ID of the index-th zone in the equivalency group + * containing 'id', or an empty string if 'id' is not a valid + * system ID or 'index' is out of range + * @see #countEquivalentIDs + * @stable ICU 2.0 + */ + static const UnicodeString U_EXPORT2 getEquivalentID(const UnicodeString& id, + int32_t index); + + /** + * Creates an instance of TimeZone detected from the current host + * system configuration. Note that ICU4C does not change the default + * time zone unless TimeZone::adoptDefault(TimeZone*) or + * TimeZone::setDefault(const TimeZone&) is explicitly called by a + * user. This method does not update the current ICU's default, + * and may return a different TimeZone from the one returned by + * TimeZone::createDefault(). + * + * @return A new instance of TimeZone detected from the current host system + * configuration. + * @stable ICU 55 + */ + static TimeZone* U_EXPORT2 detectHostTimeZone(); + + /** + * Creates a new copy of the default TimeZone for this host. Unless the default time + * zone has already been set using adoptDefault() or setDefault(), the default is + * determined by querying the system using methods in TPlatformUtilities. If the + * system routines fail, or if they specify a TimeZone or TimeZone offset which is not + * recognized, the TimeZone indicated by the ID kLastResortID is instantiated + * and made the default. + * + * @return A default TimeZone. Clients are responsible for deleting the time zone + * object returned. + * @stable ICU 2.0 + */ + static TimeZone* U_EXPORT2 createDefault(void); + + /** + * Sets the default time zone (i.e., what's returned by createDefault()) to be the + * specified time zone. If NULL is specified for the time zone, the default time + * zone is set to the default host time zone. This call adopts the TimeZone object + * passed in; the client is no longer responsible for deleting it. + * + *

This function is not thread safe. It is an error for multiple threads + * to concurrently attempt to set the default time zone, or for any thread + * to attempt to reference the default zone while another thread is setting it. + * + * @param zone A pointer to the new TimeZone object to use as the default. + * @stable ICU 2.0 + */ + static void U_EXPORT2 adoptDefault(TimeZone* zone); + +#ifndef U_HIDE_SYSTEM_API + /** + * Same as adoptDefault(), except that the TimeZone object passed in is NOT adopted; + * the caller remains responsible for deleting it. + * + *

See the thread safety note under adoptDefault(). + * + * @param zone The given timezone. + * @system + * @stable ICU 2.0 + */ + static void U_EXPORT2 setDefault(const TimeZone& zone); +#endif /* U_HIDE_SYSTEM_API */ + + /** + * Returns the timezone data version currently used by ICU. + * @param status Output param to filled in with a success or an error. + * @return the version string, such as "2007f" + * @stable ICU 3.8 + */ + static const char* U_EXPORT2 getTZDataVersion(UErrorCode& status); + + /** + * Returns the canonical system timezone ID or the normalized + * custom time zone ID for the given time zone ID. + * @param id The input time zone ID to be canonicalized. + * @param canonicalID Receives the canonical system time zone ID + * or the custom time zone ID in normalized format. + * @param status Receives the status. When the given time zone ID + * is neither a known system time zone ID nor a + * valid custom time zone ID, U_ILLEGAL_ARGUMENT_ERROR + * is set. + * @return A reference to the result. + * @stable ICU 4.0 + */ + static UnicodeString& U_EXPORT2 getCanonicalID(const UnicodeString& id, + UnicodeString& canonicalID, UErrorCode& status); + + /** + * Returns the canonical system time zone ID or the normalized + * custom time zone ID for the given time zone ID. + * @param id The input time zone ID to be canonicalized. + * @param canonicalID Receives the canonical system time zone ID + * or the custom time zone ID in normalized format. + * @param isSystemID Receives if the given ID is a known system + * time zone ID. + * @param status Receives the status. When the given time zone ID + * is neither a known system time zone ID nor a + * valid custom time zone ID, U_ILLEGAL_ARGUMENT_ERROR + * is set. + * @return A reference to the result. + * @stable ICU 4.0 + */ + static UnicodeString& U_EXPORT2 getCanonicalID(const UnicodeString& id, + UnicodeString& canonicalID, UBool& isSystemID, UErrorCode& status); + + /** + * Converts a system time zone ID to an equivalent Windows time zone ID. For example, + * Windows time zone ID "Pacific Standard Time" is returned for input "America/Los_Angeles". + * + *

There are system time zones that cannot be mapped to Windows zones. When the input + * system time zone ID is unknown or unmappable to a Windows time zone, then the result will be + * empty, but the operation itself remains successful (no error status set on return). + * + *

This implementation utilizes + * Zone-Tzid mapping data. The mapping data is updated time to time. To get the latest changes, + * please read the ICU user guide section + * Updating the Time Zone Data. + * + * @param id A system time zone ID. + * @param winid Receives a Windows time zone ID. When the input system time zone ID is unknown + * or unmappable to a Windows time zone ID, then an empty string is set on return. + * @param status Receives the status. + * @return A reference to the result (winid). + * @see getIDForWindowsID + * + * @stable ICU 52 + */ + static UnicodeString& U_EXPORT2 getWindowsID(const UnicodeString& id, + UnicodeString& winid, UErrorCode& status); + + /** + * Converts a Windows time zone ID to an equivalent system time zone ID + * for a region. For example, system time zone ID "America/Los_Angeles" is returned + * for input Windows ID "Pacific Standard Time" and region "US" (or null), + * "America/Vancouver" is returned for the same Windows ID "Pacific Standard Time" and + * region "CA". + * + *

Not all Windows time zones can be mapped to system time zones. When the input + * Windows time zone ID is unknown or unmappable to a system time zone, then the result + * will be empty, but the operation itself remains successful (no error status set on return). + * + *

This implementation utilizes + * Zone-Tzid mapping data. The mapping data is updated time to time. To get the latest changes, + * please read the ICU user guide section + * Updating the Time Zone Data. + * + * @param winid A Windows time zone ID. + * @param region A null-terminated region code, or NULL if no regional preference. + * @param id Receives a system time zone ID. When the input Windows time zone ID is unknown + * or unmappable to a system time zone ID, then an empty string is set on return. + * @param status Receives the status. + * @return A reference to the result (id). + * @see getWindowsID + * + * @stable ICU 52 + */ + static UnicodeString& U_EXPORT2 getIDForWindowsID(const UnicodeString& winid, const char* region, + UnicodeString& id, UErrorCode& status); + + /** + * Returns true if the two TimeZones are equal. (The TimeZone version only compares + * IDs, but subclasses are expected to also compare the fields they add.) + * + * @param that The TimeZone object to be compared with. + * @return True if the given TimeZone is equal to this TimeZone; false + * otherwise. + * @stable ICU 2.0 + */ + virtual UBool operator==(const TimeZone& that) const; + + /** + * Returns true if the two TimeZones are NOT equal; that is, if operator==() returns + * false. + * + * @param that The TimeZone object to be compared with. + * @return True if the given TimeZone is not equal to this TimeZone; false + * otherwise. + * @stable ICU 2.0 + */ + UBool operator!=(const TimeZone& that) const {return !operator==(that);} + + /** + * Returns the TimeZone's adjusted GMT offset (i.e., the number of milliseconds to add + * to GMT to get local time in this time zone, taking daylight savings time into + * account) as of a particular reference date. The reference date is used to determine + * whether daylight savings time is in effect and needs to be figured into the offset + * that is returned (in other words, what is the adjusted GMT offset in this time zone + * at this particular date and time?). For the time zones produced by createTimeZone(), + * the reference data is specified according to the Gregorian calendar, and the date + * and time fields are local standard time. + * + *

Note: Don't call this method. Instead, call the getOffset(UDate...) overload, + * which returns both the raw and the DST offset for a given time. This method + * is retained only for backward compatibility. + * + * @param era The reference date's era + * @param year The reference date's year + * @param month The reference date's month (0-based; 0 is January) + * @param day The reference date's day-in-month (1-based) + * @param dayOfWeek The reference date's day-of-week (1-based; 1 is Sunday) + * @param millis The reference date's milliseconds in day, local standard time + * @param status Output param to filled in with a success or an error. + * @return The offset in milliseconds to add to GMT to get local time. + * @stable ICU 2.0 + */ + virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day, + uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const = 0; + + /** + * Gets the time zone offset, for current date, modified in case of + * daylight savings. This is the offset to add *to* UTC to get local time. + * + *

Note: Don't call this method. Instead, call the getOffset(UDate...) overload, + * which returns both the raw and the DST offset for a given time. This method + * is retained only for backward compatibility. + * + * @param era the era of the given date. + * @param year the year in the given date. + * @param month the month in the given date. + * Month is 0-based. e.g., 0 for January. + * @param day the day-in-month of the given date. + * @param dayOfWeek the day-of-week of the given date. + * @param milliseconds the millis in day in standard local time. + * @param monthLength the length of the given month in days. + * @param status Output param to filled in with a success or an error. + * @return the offset to add *to* GMT to get local time. + * @stable ICU 2.0 + */ + virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day, + uint8_t dayOfWeek, int32_t milliseconds, + int32_t monthLength, UErrorCode& status) const = 0; + + /** + * Returns the time zone raw and GMT offset for the given moment + * in time. Upon return, local-millis = GMT-millis + rawOffset + + * dstOffset. All computations are performed in the proleptic + * Gregorian calendar. The default implementation in the TimeZone + * class delegates to the 8-argument getOffset(). + * + * @param date moment in time for which to return offsets, in + * units of milliseconds from January 1, 1970 0:00 GMT, either GMT + * time or local wall time, depending on `local'. + * @param local if true, `date' is local wall time; otherwise it + * is in GMT time. + * @param rawOffset output parameter to receive the raw offset, that + * is, the offset not including DST adjustments + * @param dstOffset output parameter to receive the DST offset, + * that is, the offset to be added to `rawOffset' to obtain the + * total offset between local and GMT time. If DST is not in + * effect, this value is zero; otherwise it is a positive value, + * typically one hour. + * @param ec input-output error code + * + * @stable ICU 2.8 + */ + virtual void getOffset(UDate date, UBool local, int32_t& rawOffset, + int32_t& dstOffset, UErrorCode& ec) const; + + /** + * Sets the TimeZone's raw GMT offset (i.e., the number of milliseconds to add + * to GMT to get local time, before taking daylight savings time into account). + * + * @param offsetMillis The new raw GMT offset for this time zone. + * @stable ICU 2.0 + */ + virtual void setRawOffset(int32_t offsetMillis) = 0; + + /** + * Returns the TimeZone's raw GMT offset (i.e., the number of milliseconds to add + * to GMT to get local time, before taking daylight savings time into account). + * + * @return The TimeZone's raw GMT offset. + * @stable ICU 2.0 + */ + virtual int32_t getRawOffset(void) const = 0; + + /** + * Fills in "ID" with the TimeZone's ID. + * + * @param ID Receives this TimeZone's ID. + * @return A reference to 'ID' + * @stable ICU 2.0 + */ + UnicodeString& getID(UnicodeString& ID) const; + + /** + * Sets the TimeZone's ID to the specified value. This doesn't affect any other + * fields (for example, if you say< + * blockquote>

+     * .     TimeZone* foo = TimeZone::createTimeZone("America/New_York");
+     * .     foo.setID("America/Los_Angeles");
+     * 
\htmlonly\endhtmlonly + * the time zone's GMT offset and daylight-savings rules don't change to those for + * Los Angeles. They're still those for New York. Only the ID has changed.) + * + * @param ID The new time zone ID. + * @stable ICU 2.0 + */ + void setID(const UnicodeString& ID); + + /** + * Enum for use with getDisplayName + * @stable ICU 2.4 + */ + enum EDisplayType { + /** + * Selector for short display name + * @stable ICU 2.4 + */ + SHORT = 1, + /** + * Selector for long display name + * @stable ICU 2.4 + */ + LONG, + /** + * Selector for short generic display name + * @stable ICU 4.4 + */ + SHORT_GENERIC, + /** + * Selector for long generic display name + * @stable ICU 4.4 + */ + LONG_GENERIC, + /** + * Selector for short display name derived + * from time zone offset + * @stable ICU 4.4 + */ + SHORT_GMT, + /** + * Selector for long display name derived + * from time zone offset + * @stable ICU 4.4 + */ + LONG_GMT, + /** + * Selector for short display name derived + * from the time zone's fallback name + * @stable ICU 4.4 + */ + SHORT_COMMONLY_USED, + /** + * Selector for long display name derived + * from the time zone's fallback name + * @stable ICU 4.4 + */ + GENERIC_LOCATION + }; + + /** + * Returns a name of this time zone suitable for presentation to the user + * in the default locale. + * This method returns the long name, not including daylight savings. + * If the display name is not available for the locale, + * then this method returns a string in the localized GMT offset format + * such as GMT[+-]HH:mm. + * @param result the human-readable name of this time zone in the default locale. + * @return A reference to 'result'. + * @stable ICU 2.0 + */ + UnicodeString& getDisplayName(UnicodeString& result) const; + + /** + * Returns a name of this time zone suitable for presentation to the user + * in the specified locale. + * This method returns the long name, not including daylight savings. + * If the display name is not available for the locale, + * then this method returns a string in the localized GMT offset format + * such as GMT[+-]HH:mm. + * @param locale the locale in which to supply the display name. + * @param result the human-readable name of this time zone in the given locale + * or in the default locale if the given locale is not recognized. + * @return A reference to 'result'. + * @stable ICU 2.0 + */ + UnicodeString& getDisplayName(const Locale& locale, UnicodeString& result) const; + + /** + * Returns a name of this time zone suitable for presentation to the user + * in the default locale. + * If the display name is not available for the locale, + * then this method returns a string in the localized GMT offset format + * such as GMT[+-]HH:mm. + * @param daylight if true, return the daylight savings name. + * @param style + * @param result the human-readable name of this time zone in the default locale. + * @return A reference to 'result'. + * @stable ICU 2.0 + */ + UnicodeString& getDisplayName(UBool daylight, EDisplayType style, UnicodeString& result) const; + + /** + * Returns a name of this time zone suitable for presentation to the user + * in the specified locale. + * If the display name is not available for the locale, + * then this method returns a string in the localized GMT offset format + * such as GMT[+-]HH:mm. + * @param daylight if true, return the daylight savings name. + * @param style + * @param locale the locale in which to supply the display name. + * @param result the human-readable name of this time zone in the given locale + * or in the default locale if the given locale is not recognized. + * @return A refence to 'result'. + * @stable ICU 2.0 + */ + UnicodeString& getDisplayName(UBool daylight, EDisplayType style, const Locale& locale, UnicodeString& result) const; + + /** + * Queries if this time zone uses daylight savings time. + * @return true if this time zone uses daylight savings time, + * false, otherwise. + *

Note:The default implementation of + * ICU TimeZone uses the tz database, which supports historic + * rule changes, for system time zones. With the implementation, + * there are time zones that used daylight savings time in the + * past, but no longer used currently. For example, Asia/Tokyo has + * never used daylight savings time since 1951. Most clients would + * expect that this method to return FALSE for such case. + * The default implementation of this method returns TRUE + * when the time zone uses daylight savings time in the current + * (Gregorian) calendar year. + *

In Java 7, observesDaylightTime() was added in + * addition to useDaylightTime(). In Java, useDaylightTime() + * only checks if daylight saving time is observed by the last known + * rule. This specification might not be what most users would expect + * if daylight saving time is currently observed, but not scheduled + * in future. In this case, Java's userDaylightTime() returns + * false. To resolve the issue, Java 7 added observesDaylightTime(), + * which takes the current rule into account. The method observesDaylightTime() + * was added in ICU4J for supporting API signature compatibility with JDK. + * In general, ICU4C also provides JDK compatible methods, but the current + * implementation userDaylightTime() serves the purpose + * (takes the current rule into account), observesDaylightTime() + * is not added in ICU4C. In addition to useDaylightTime(), ICU4C + * BasicTimeZone class (Note that TimeZone::createTimeZone(const UnicodeString &ID) + * always returns a BasicTimeZone) provides a series of methods allowing + * historic and future time zone rule iteration, so you can check if daylight saving + * time is observed or not within a given period. + * + * @stable ICU 2.0 + */ + virtual UBool useDaylightTime(void) const = 0; + + /** + * Queries if the given date is in daylight savings time in + * this time zone. + * This method is wasteful since it creates a new GregorianCalendar and + * deletes it each time it is called. This is a deprecated method + * and provided only for Java compatibility. + * + * @param date the given UDate. + * @param status Output param filled in with success/error code. + * @return true if the given date is in daylight savings time, + * false, otherwise. + * @deprecated ICU 2.4. Use Calendar::inDaylightTime() instead. + */ + virtual UBool inDaylightTime(UDate date, UErrorCode& status) const = 0; + + /** + * Returns true if this zone has the same rule and offset as another zone. + * That is, if this zone differs only in ID, if at all. + * @param other the TimeZone object to be compared with + * @return true if the given zone is the same as this one, + * with the possible exception of the ID + * @stable ICU 2.0 + */ + virtual UBool hasSameRules(const TimeZone& other) const; + + /** + * Clones TimeZone objects polymorphically. Clients are responsible for deleting + * the TimeZone object cloned. + * + * @return A new copy of this TimeZone object. + * @stable ICU 2.0 + */ + virtual TimeZone* clone(void) const = 0; + + /** + * Return the class ID for this class. This is useful only for + * comparing to a return value from getDynamicClassID(). + * @return The class ID for all objects of this class. + * @stable ICU 2.0 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Returns a unique class ID POLYMORPHICALLY. This method is to + * implement a simple version of RTTI, since not all C++ compilers support genuine + * RTTI. Polymorphic operator==() and clone() methods call this method. + *

+ * Concrete subclasses of TimeZone must use the UOBJECT_DEFINE_RTTI_IMPLEMENTATION + * macro from uobject.h in their implementation to provide correct RTTI information. + * @return The class ID for this object. All objects of a given class have the + * same class ID. Objects of other classes have different class IDs. + * @stable ICU 2.0 + */ + virtual UClassID getDynamicClassID(void) const = 0; + + /** + * Returns the amount of time to be added to local standard time + * to get local wall clock time. + *

+ * The default implementation always returns 3600000 milliseconds + * (i.e., one hour) if this time zone observes Daylight Saving + * Time. Otherwise, 0 (zero) is returned. + *

+ * If an underlying TimeZone implementation subclass supports + * historical Daylight Saving Time changes, this method returns + * the known latest daylight saving value. + * + * @return the amount of saving time in milliseconds + * @stable ICU 3.6 + */ + virtual int32_t getDSTSavings() const; + + /** + * Gets the region code associated with the given + * system time zone ID. The region code is either ISO 3166 + * 2-letter country code or UN M.49 3-digit area code. + * When the time zone is not associated with a specific location, + * for example - "Etc/UTC", "EST5EDT", then this method returns + * "001" (UN M.49 area code for World). + * + * @param id The system time zone ID. + * @param region Output buffer for receiving the region code. + * @param capacity The size of the output buffer. + * @param status Receives the status. When the given time zone ID + * is not a known system time zone ID, + * U_ILLEGAL_ARGUMENT_ERROR is set. + * @return The length of the output region code. + * @stable ICU 4.8 + */ + static int32_t U_EXPORT2 getRegion(const UnicodeString& id, + char *region, int32_t capacity, UErrorCode& status); + +protected: + + /** + * Default constructor. ID is initialized to the empty string. + * @stable ICU 2.0 + */ + TimeZone(); + + /** + * Construct a TimeZone with a given ID. + * @param id a system time zone ID + * @stable ICU 2.0 + */ + TimeZone(const UnicodeString &id); + + /** + * Copy constructor. + * @param source the object to be copied. + * @stable ICU 2.0 + */ + TimeZone(const TimeZone& source); + + /** + * Default assignment operator. + * @param right the object to be copied. + * @stable ICU 2.0 + */ + TimeZone& operator=(const TimeZone& right); + +#ifndef U_HIDE_INTERNAL_API + /** + * Utility function. For internally loading rule data. + * @param top Top resource bundle for tz data + * @param ruleid ID of rule to load + * @param oldbundle Old bundle to reuse or NULL + * @param status Status parameter + * @return either a new bundle or *oldbundle + * @internal + */ + static UResourceBundle* loadRule(const UResourceBundle* top, const UnicodeString& ruleid, UResourceBundle* oldbundle, UErrorCode&status); +#endif /* U_HIDE_INTERNAL_API */ + +private: + friend class ZoneMeta; + + + static TimeZone* createCustomTimeZone(const UnicodeString&); // Creates a time zone based on the string. + + /** + * Finds the given ID in the Olson tzdata. If the given ID is found in the tzdata, + * returns the pointer to the ID resource. This method is exposed through ZoneMeta class + * for ICU internal implementation and useful for building hashtable using a time zone + * ID as a key. + * @param id zone id string + * @return the pointer of the ID resource, or NULL. + */ + static const char16_t* findID(const UnicodeString& id); + + /** + * Resolve a link in Olson tzdata. When the given id is known and it's not a link, + * the id itself is returned. When the given id is known and it is a link, then + * dereferenced zone id is returned. When the given id is unknown, then it returns + * NULL. + * @param id zone id string + * @return the dereferenced zone or NULL + */ + static const char16_t* dereferOlsonLink(const UnicodeString& id); + + /** + * Returns the region code associated with the given zone, + * or NULL if the zone is not known. + * @param id zone id string + * @return the region associated with the given zone + */ + static const char16_t* getRegion(const UnicodeString& id); + + public: +#ifndef U_HIDE_INTERNAL_API + /** + * Returns the region code associated with the given zone, + * or NULL if the zone is not known. + * @param id zone id string + * @param status Status parameter + * @return the region associated with the given zone + * @internal + */ + static const char16_t* getRegion(const UnicodeString& id, UErrorCode& status); +#endif /* U_HIDE_INTERNAL_API */ + + private: + /** + * Parses the given custom time zone identifier + * @param id id A string of the form GMT[+-]hh:mm, GMT[+-]hhmm, or + * GMT[+-]hh. + * @param sign Receves parsed sign, 1 for positive, -1 for negative. + * @param hour Receives parsed hour field + * @param minute Receives parsed minute field + * @param second Receives parsed second field + * @return Returns TRUE when the given custom id is valid. + */ + static UBool parseCustomID(const UnicodeString& id, int32_t& sign, int32_t& hour, + int32_t& minute, int32_t& second); + + /** + * Parse a custom time zone identifier and return the normalized + * custom time zone identifier for the given custom id string. + * @param id a string of the form GMT[+-]hh:mm, GMT[+-]hhmm, or + * GMT[+-]hh. + * @param normalized Receives the normalized custom ID + * @param status Receives the status. When the input ID string is invalid, + * U_ILLEGAL_ARGUMENT_ERROR is set. + * @return The normalized custom id string. + */ + static UnicodeString& getCustomID(const UnicodeString& id, UnicodeString& normalized, + UErrorCode& status); + + /** + * Returns the normalized custome time zone ID for the given offset fields. + * @param hour offset hours + * @param min offset minutes + * @param sec offset seconds + * @param negative sign of the offset, TRUE for negative offset. + * @param id Receves the format result (normalized custom ID) + * @return The reference to id + */ + static UnicodeString& formatCustomID(int32_t hour, int32_t min, int32_t sec, + UBool negative, UnicodeString& id); + + UnicodeString fID; // this time zone's ID + + friend class TZEnumeration; +}; + + +// ------------------------------------- + +inline UnicodeString& +TimeZone::getID(UnicodeString& ID) const +{ + ID = fID; + return ID; +} + +// ------------------------------------- + +inline void +TimeZone::setID(const UnicodeString& ID) +{ + fID = ID; +} +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif //_TIMEZONE +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/tmunit.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/tmunit.h new file mode 100644 index 0000000..fa59f10 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/tmunit.h @@ -0,0 +1,137 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ******************************************************************************* + * Copyright (C) 2009-2016, International Business Machines Corporation, * + * Google, and others. All Rights Reserved. * + ******************************************************************************* + */ + +#ifndef __TMUNIT_H__ +#define __TMUNIT_H__ + + +/** + * \file + * \brief C++ API: time unit object + */ + + +#include "unicode/measunit.h" + +#if !UCONFIG_NO_FORMATTING + +U_NAMESPACE_BEGIN + +/** + * Measurement unit for time units. + * @see TimeUnitAmount + * @see TimeUnit + * @stable ICU 4.2 + */ +class U_I18N_API TimeUnit: public MeasureUnit { +public: + /** + * Constants for all the time units we supported. + * @stable ICU 4.2 + */ + enum UTimeUnitFields { + UTIMEUNIT_YEAR, + UTIMEUNIT_MONTH, + UTIMEUNIT_DAY, + UTIMEUNIT_WEEK, + UTIMEUNIT_HOUR, + UTIMEUNIT_MINUTE, + UTIMEUNIT_SECOND, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UTimeUnitFields value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UTIMEUNIT_FIELD_COUNT +#endif // U_HIDE_DEPRECATED_API + }; + + /** + * Create Instance. + * @param timeUnitField time unit field based on which the instance + * is created. + * @param status input-output error code. + * If the timeUnitField is invalid, + * then this will be set to U_ILLEGAL_ARGUMENT_ERROR. + * @return a TimeUnit instance + * @stable ICU 4.2 + */ + static TimeUnit* U_EXPORT2 createInstance(UTimeUnitFields timeUnitField, + UErrorCode& status); + + + /** + * Override clone. + * @stable ICU 4.2 + */ + virtual UObject* clone() const; + + /** + * Copy operator. + * @stable ICU 4.2 + */ + TimeUnit(const TimeUnit& other); + + /** + * Assignment operator. + * @stable ICU 4.2 + */ + TimeUnit& operator=(const TimeUnit& other); + + /** + * Returns a unique class ID for this object POLYMORPHICALLY. + * This method implements a simple form of RTTI used by ICU. + * @return The class ID for this object. All objects of a given + * class have the same class ID. Objects of other classes have + * different class IDs. + * @stable ICU 4.2 + */ + virtual UClassID getDynamicClassID() const; + + /** + * Returns the class ID for this class. This is used to compare to + * the return value of getDynamicClassID(). + * @return The class ID for all objects of this class. + * @stable ICU 4.2 + */ + static UClassID U_EXPORT2 getStaticClassID(); + + + /** + * Get time unit field. + * @return time unit field. + * @stable ICU 4.2 + */ + UTimeUnitFields getTimeUnitField() const; + + /** + * Destructor. + * @stable ICU 4.2 + */ + virtual ~TimeUnit(); + +private: + UTimeUnitFields fTimeUnitField; + + /** + * Constructor + * @internal (private) + */ + TimeUnit(UTimeUnitFields timeUnitField); + +}; + + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // __TMUNIT_H__ +//eof +// diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/tmutamt.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/tmutamt.h new file mode 100644 index 0000000..274bfa6 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/tmutamt.h @@ -0,0 +1,170 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ******************************************************************************* + * Copyright (C) 2009-2010, Google, International Business Machines Corporation and * + * others. All Rights Reserved. * + ******************************************************************************* + */ + +#ifndef __TMUTAMT_H__ +#define __TMUTAMT_H__ + + +/** + * \file + * \brief C++ API: time unit amount object. + */ + +#include "unicode/measure.h" +#include "unicode/tmunit.h" + +#if !UCONFIG_NO_FORMATTING + +U_NAMESPACE_BEGIN + + +/** + * Express a duration as a time unit and number. Patterned after Currency. + * @see TimeUnitAmount + * @see TimeUnitFormat + * @stable ICU 4.2 + */ +class U_I18N_API TimeUnitAmount: public Measure { +public: + /** + * Construct TimeUnitAmount object with the given number and the + * given time unit. + * @param number a numeric object; number.isNumeric() must be TRUE + * @param timeUnitField the time unit field of a time unit + * @param status the input-output error code. + * If the number is not numeric or the timeUnitField + * is not valid, + * then this will be set to a failing value: + * U_ILLEGAL_ARGUMENT_ERROR. + * @stable ICU 4.2 + */ + TimeUnitAmount(const Formattable& number, + TimeUnit::UTimeUnitFields timeUnitField, + UErrorCode& status); + + /** + * Construct TimeUnitAmount object with the given numeric amount and the + * given time unit. + * @param amount a numeric amount. + * @param timeUnitField the time unit field on which a time unit amount + * object will be created. + * @param status the input-output error code. + * If the timeUnitField is not valid, + * then this will be set to a failing value: + * U_ILLEGAL_ARGUMENT_ERROR. + * @stable ICU 4.2 + */ + TimeUnitAmount(double amount, TimeUnit::UTimeUnitFields timeUnitField, + UErrorCode& status); + + + /** + * Copy constructor + * @stable ICU 4.2 + */ + TimeUnitAmount(const TimeUnitAmount& other); + + + /** + * Assignment operator + * @stable ICU 4.2 + */ + TimeUnitAmount& operator=(const TimeUnitAmount& other); + + + /** + * Clone. + * @return a polymorphic clone of this object. The result will have the same class as returned by getDynamicClassID(). + * @stable ICU 4.2 + */ + virtual UObject* clone() const; + + + /** + * Destructor + * @stable ICU 4.2 + */ + virtual ~TimeUnitAmount(); + + + /** + * Equality operator. + * @param other the object to compare to. + * @return true if this object is equal to the given object. + * @stable ICU 4.2 + */ + virtual UBool operator==(const UObject& other) const; + + + /** + * Not-equality operator. + * @param other the object to compare to. + * @return true if this object is not equal to the given object. + * @stable ICU 4.2 + */ + UBool operator!=(const UObject& other) const; + + + /** + * Return the class ID for this class. This is useful only for comparing to + * a return value from getDynamicClassID(). For example: + *

+     * .   Base* polymorphic_pointer = createPolymorphicObject();
+     * .   if (polymorphic_pointer->getDynamicClassID() ==
+     * .       erived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @stable ICU 4.2 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This + * method is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and clone() + * methods call this method. + * + * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @stable ICU 4.2 + */ + virtual UClassID getDynamicClassID(void) const; + + + /** + * Get the time unit. + * @return time unit object. + * @stable ICU 4.2 + */ + const TimeUnit& getTimeUnit() const; + + /** + * Get the time unit field value. + * @return time unit field value. + * @stable ICU 4.2 + */ + TimeUnit::UTimeUnitFields getTimeUnitField() const; +}; + + + +inline UBool +TimeUnitAmount::operator!=(const UObject& other) const { + return !operator==(other); +} + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // __TMUTAMT_H__ +//eof +// diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/tmutfmt.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/tmutfmt.h new file mode 100644 index 0000000..8f24585 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/tmutfmt.h @@ -0,0 +1,248 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ******************************************************************************* + * Copyright (C) 2008-2014, Google, International Business Machines Corporation + * and others. All Rights Reserved. + ******************************************************************************* + */ + +#ifndef __TMUTFMT_H__ +#define __TMUTFMT_H__ + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Format and parse duration in single time unit + */ + + +#if !UCONFIG_NO_FORMATTING +#ifndef U_HIDE_DEPRECATED_API + +#include "unicode/unistr.h" +#include "unicode/tmunit.h" +#include "unicode/tmutamt.h" +#include "unicode/measfmt.h" +#include "unicode/numfmt.h" +#include "unicode/plurrule.h" + + +/** + * Constants for various styles. + * There are 2 styles: full name and abbreviated name. + * For example, for English, the full name for hour duration is "3 hours", + * and the abbreviated name is "3 hrs". + * @deprecated ICU 53 Use MeasureFormat and UMeasureFormatWidth instead. + */ +enum UTimeUnitFormatStyle { + /** @deprecated ICU 53 */ + UTMUTFMT_FULL_STYLE, + /** @deprecated ICU 53 */ + UTMUTFMT_ABBREVIATED_STYLE, + /** @deprecated ICU 53 */ + UTMUTFMT_FORMAT_STYLE_COUNT +}; +typedef enum UTimeUnitFormatStyle UTimeUnitFormatStyle; /**< @deprecated ICU 53 */ + + +U_NAMESPACE_BEGIN + +class Hashtable; +class UVector; + +struct TimeUnitFormatReadSink; + +/** + * Format or parse a TimeUnitAmount, using plural rules for the units where available. + * + *

+ * Code Sample: + *

+ *   // create time unit amount instance - a combination of Number and time unit
+ *   UErrorCode status = U_ZERO_ERROR;
+ *   TimeUnitAmount* source = new TimeUnitAmount(2, TimeUnit::UTIMEUNIT_YEAR, status);
+ *   // create time unit format instance
+ *   TimeUnitFormat* format = new TimeUnitFormat(Locale("en"), status);
+ *   // format a time unit amount
+ *   UnicodeString formatted;
+ *   Formattable formattable;
+ *   if (U_SUCCESS(status)) {
+ *       formattable.adoptObject(source);
+ *       formatted = ((Format*)format)->format(formattable, formatted, status);
+ *       Formattable result;
+ *       ((Format*)format)->parseObject(formatted, result, status);
+ *       if (U_SUCCESS(status)) {
+ *           assert (result == formattable);
+ *       }
+ *   }
+ * 
+ * + *

+ * @see TimeUnitAmount + * @see TimeUnitFormat + * @deprecated ICU 53 Use the MeasureFormat class instead. + */ +class U_I18N_API TimeUnitFormat: public MeasureFormat { +public: + + /** + * Create TimeUnitFormat with default locale, and full name style. + * Use setLocale and/or setFormat to modify. + * @deprecated ICU 53 + */ + TimeUnitFormat(UErrorCode& status); + + /** + * Create TimeUnitFormat given locale, and full name style. + * @deprecated ICU 53 + */ + TimeUnitFormat(const Locale& locale, UErrorCode& status); + + /** + * Create TimeUnitFormat given locale and style. + * @deprecated ICU 53 + */ + TimeUnitFormat(const Locale& locale, UTimeUnitFormatStyle style, UErrorCode& status); + + /** + * Copy constructor. + * @deprecated ICU 53 + */ + TimeUnitFormat(const TimeUnitFormat&); + + /** + * deconstructor + * @deprecated ICU 53 + */ + virtual ~TimeUnitFormat(); + + /** + * Clone this Format object polymorphically. The caller owns the result and + * should delete it when done. + * @return A copy of the object. + * @deprecated ICU 53 + */ + virtual Format* clone(void) const; + + /** + * Assignment operator + * @deprecated ICU 53 + */ + TimeUnitFormat& operator=(const TimeUnitFormat& other); + + /** + * Return true if the given Format objects are not semantically equal. + * Objects of different subclasses are considered unequal. + * @param other the object to be compared with. + * @return true if the given Format objects are not semantically equal. + * @deprecated ICU 53 + */ + UBool operator!=(const Format& other) const; + + /** + * Set the locale used for formatting or parsing. + * @param locale the locale to be set + * @param status output param set to success/failure code on exit + * @deprecated ICU 53 + */ + void setLocale(const Locale& locale, UErrorCode& status); + + + /** + * Set the number format used for formatting or parsing. + * @param format the number formatter to be set + * @param status output param set to success/failure code on exit + * @deprecated ICU 53 + */ + void setNumberFormat(const NumberFormat& format, UErrorCode& status); + + /** + * Parse a TimeUnitAmount. + * @see Format#parseObject(const UnicodeString&, Formattable&, ParsePosition&) const; + * @deprecated ICU 53 + */ + virtual void parseObject(const UnicodeString& source, + Formattable& result, + ParsePosition& pos) const; + + /** + * Return the class ID for this class. This is useful only for comparing to + * a return value from getDynamicClassID(). For example: + *

+     * .   Base* polymorphic_pointer = createPolymorphicObject();
+     * .   if (polymorphic_pointer->getDynamicClassID() ==
+     * .       erived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @deprecated ICU 53 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This + * method is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and clone() + * methods call this method. + * + * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @deprecated ICU 53 + */ + virtual UClassID getDynamicClassID(void) const; + +private: + Hashtable* fTimeUnitToCountToPatterns[TimeUnit::UTIMEUNIT_FIELD_COUNT]; + UTimeUnitFormatStyle fStyle; + + void create(UTimeUnitFormatStyle style, UErrorCode& status); + + // it might actually be simpler to make them Decimal Formats later. + // initialize all private data members + void setup(UErrorCode& status); + + // initialize data member without fill in data for fTimeUnitToCountToPattern + void initDataMembers(UErrorCode& status); + + // initialize fTimeUnitToCountToPatterns from current locale's resource. + void readFromCurrentLocale(UTimeUnitFormatStyle style, const char* key, const UVector& pluralCounts, + UErrorCode& status); + + // check completeness of fTimeUnitToCountToPatterns against all time units, + // and all plural rules, fill in fallback as necessary. + void checkConsistency(UTimeUnitFormatStyle style, const char* key, UErrorCode& status); + + // fill in fTimeUnitToCountToPatterns from locale fall-back chain + void searchInLocaleChain(UTimeUnitFormatStyle style, const char* key, const char* localeName, + TimeUnit::UTimeUnitFields field, const UnicodeString&, + const char*, Hashtable*, UErrorCode&); + + // initialize hash table + Hashtable* initHash(UErrorCode& status); + + // delete hash table + void deleteHash(Hashtable* htable); + + // copy hash table + void copyHash(const Hashtable* source, Hashtable* target, UErrorCode& status); + // get time unit name, such as "year", from time unit field enum, such as + // UTIMEUNIT_YEAR. + static const char* getTimeUnitName(TimeUnit::UTimeUnitFields field, UErrorCode& status); + + friend struct TimeUnitFormatReadSink; +}; + +inline UBool +TimeUnitFormat::operator!=(const Format& other) const { + return !operator==(other); +} + +U_NAMESPACE_END + +#endif /* U_HIDE_DEPRECATED_API */ +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // __TMUTFMT_H__ +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/translit.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/translit.h new file mode 100644 index 0000000..bccba54 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/translit.h @@ -0,0 +1,1344 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2014, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Date Name Description +* 11/17/99 aliu Creation. +********************************************************************** +*/ +#ifndef TRANSLIT_H +#define TRANSLIT_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Tranforms text from one format to another. + */ + +#if !UCONFIG_NO_TRANSLITERATION + +#include "unicode/uobject.h" +#include "unicode/unistr.h" +#include "unicode/parseerr.h" +#include "unicode/utrans.h" // UTransPosition, UTransDirection +#include "unicode/strenum.h" + +U_NAMESPACE_BEGIN + +class UnicodeFilter; +class UnicodeSet; +class CompoundTransliterator; +class TransliteratorParser; +class NormalizationTransliterator; +class TransliteratorIDParser; + +/** + * + * Transliterator is an abstract class that + * transliterates text from one format to another. The most common + * kind of transliterator is a script, or alphabet, transliterator. + * For example, a Russian to Latin transliterator changes Russian text + * written in Cyrillic characters to phonetically equivalent Latin + * characters. It does not translate Russian to English! + * Transliteration, unlike translation, operates on characters, without + * reference to the meanings of words and sentences. + * + *

Although script conversion is its most common use, a + * transliterator can actually perform a more general class of tasks. + * In fact, Transliterator defines a very general API + * which specifies only that a segment of the input text is replaced + * by new text. The particulars of this conversion are determined + * entirely by subclasses of Transliterator. + * + *

Transliterators are stateless + * + *

Transliterator objects are stateless; they + * retain no information between calls to + * transliterate(). (However, this does not + * mean that threads may share transliterators without synchronizing + * them. Transliterators are not immutable, so they must be + * synchronized when shared between threads.) This might seem to + * limit the complexity of the transliteration operation. In + * practice, subclasses perform complex transliterations by delaying + * the replacement of text until it is known that no other + * replacements are possible. In other words, although the + * Transliterator objects are stateless, the source text + * itself embodies all the needed information, and delayed operation + * allows arbitrary complexity. + * + *

Batch transliteration + * + *

The simplest way to perform transliteration is all at once, on a + * string of existing text. This is referred to as batch + * transliteration. For example, given a string input + * and a transliterator t, the call + * + * \htmlonly

\endhtmlonlyString result = t.transliterate(input); + * \htmlonly
\endhtmlonly + * + * will transliterate it and return the result. Other methods allow + * the client to specify a substring to be transliterated and to use + * {@link Replaceable } objects instead of strings, in order to + * preserve out-of-band information (such as text styles). + * + *

Keyboard transliteration + * + *

Somewhat more involved is keyboard, or incremental + * transliteration. This is the transliteration of text that is + * arriving from some source (typically the user's keyboard) one + * character at a time, or in some other piecemeal fashion. + * + *

In keyboard transliteration, a Replaceable buffer + * stores the text. As text is inserted, as much as possible is + * transliterated on the fly. This means a GUI that displays the + * contents of the buffer may show text being modified as each new + * character arrives. + * + *

Consider the simple RuleBasedTransliterator: + * + * \htmlonly

\endhtmlonly + * th>{theta}
+ * t>{tau} + *
\htmlonly
\endhtmlonly + * + * When the user types 't', nothing will happen, since the + * transliterator is waiting to see if the next character is 'h'. To + * remedy this, we introduce the notion of a cursor, marked by a '|' + * in the output string: + * + * \htmlonly
\endhtmlonly + * t>|{tau}
+ * {tau}h>{theta} + *
\htmlonly
\endhtmlonly + * + * Now when the user types 't', tau appears, and if the next character + * is 'h', the tau changes to a theta. This is accomplished by + * maintaining a cursor position (independent of the insertion point, + * and invisible in the GUI) across calls to + * transliterate(). Typically, the cursor will + * be coincident with the insertion point, but in a case like the one + * above, it will precede the insertion point. + * + *

Keyboard transliteration methods maintain a set of three indices + * that are updated with each call to + * transliterate(), including the cursor, start, + * and limit. Since these indices are changed by the method, they are + * passed in an int[] array. The START index + * marks the beginning of the substring that the transliterator will + * look at. It is advanced as text becomes committed (but it is not + * the committed index; that's the CURSOR). The + * CURSOR index, described above, marks the point at + * which the transliterator last stopped, either because it reached + * the end, or because it required more characters to disambiguate + * between possible inputs. The CURSOR can also be + * explicitly set by rules in a RuleBasedTransliterator. + * Any characters before the CURSOR index are frozen; + * future keyboard transliteration calls within this input sequence + * will not change them. New text is inserted at the + * LIMIT index, which marks the end of the substring that + * the transliterator looks at. + * + *

Because keyboard transliteration assumes that more characters + * are to arrive, it is conservative in its operation. It only + * transliterates when it can do so unambiguously. Otherwise it waits + * for more characters to arrive. When the client code knows that no + * more characters are forthcoming, perhaps because the user has + * performed some input termination operation, then it should call + * finishTransliteration() to complete any + * pending transliterations. + * + *

Inverses + * + *

Pairs of transliterators may be inverses of one another. For + * example, if transliterator A transliterates characters by + * incrementing their Unicode value (so "abc" -> "def"), and + * transliterator B decrements character values, then A + * is an inverse of B and vice versa. If we compose A + * with B in a compound transliterator, the result is the + * indentity transliterator, that is, a transliterator that does not + * change its input text. + * + * The Transliterator method getInverse() + * returns a transliterator's inverse, if one exists, or + * null otherwise. However, the result of + * getInverse() usually will not be a true + * mathematical inverse. This is because true inverse transliterators + * are difficult to formulate. For example, consider two + * transliterators: AB, which transliterates the character 'A' + * to 'B', and BA, which transliterates 'B' to 'A'. It might + * seem that these are exact inverses, since + * + * \htmlonly

\endhtmlonly"A" x AB -> "B"
+ * "B" x BA -> "A"\htmlonly
\endhtmlonly + * + * where 'x' represents transliteration. However, + * + * \htmlonly
\endhtmlonly"ABCD" x AB -> "BBCD"
+ * "BBCD" x BA -> "AACD"\htmlonly
\endhtmlonly + * + * so AB composed with BA is not the + * identity. Nonetheless, BA may be usefully considered to be + * AB's inverse, and it is on this basis that + * AB.getInverse() could legitimately return + * BA. + * + *

IDs and display names + * + *

A transliterator is designated by a short identifier string or + * ID. IDs follow the format source-destination, + * where source describes the entity being replaced, and + * destination describes the entity replacing + * source. The entities may be the names of scripts, + * particular sequences of characters, or whatever else it is that the + * transliterator converts to or from. For example, a transliterator + * from Russian to Latin might be named "Russian-Latin". A + * transliterator from keyboard escape sequences to Latin-1 characters + * might be named "KeyboardEscape-Latin1". By convention, system + * entity names are in English, with the initial letters of words + * capitalized; user entity names may follow any format so long as + * they do not contain dashes. + * + *

In addition to programmatic IDs, transliterator objects have + * display names for presentation in user interfaces, returned by + * {@link #getDisplayName }. + * + *

Factory methods and registration + * + *

In general, client code should use the factory method + * {@link #createInstance } to obtain an instance of a + * transliterator given its ID. Valid IDs may be enumerated using + * getAvailableIDs(). Since transliterators are mutable, + * multiple calls to {@link #createInstance } with the same ID will + * return distinct objects. + * + *

In addition to the system transliterators registered at startup, + * user transliterators may be registered by calling + * registerInstance() at run time. A registered instance + * acts a template; future calls to {@link #createInstance } with the ID + * of the registered object return clones of that object. Thus any + * object passed to registerInstance() must implement + * clone() propertly. To register a transliterator subclass + * without instantiating it (until it is needed), users may call + * {@link #registerFactory }. In this case, the objects are + * instantiated by invoking the zero-argument public constructor of + * the class. + * + *

Subclassing + * + * Subclasses must implement the abstract method + * handleTransliterate().

Subclasses should override + * the transliterate() method taking a + * Replaceable and the transliterate() + * method taking a String and StringBuffer + * if the performance of these methods can be improved over the + * performance obtained by the default implementations in this class. + * + * @author Alan Liu + * @stable ICU 2.0 + */ +class U_I18N_API Transliterator : public UObject { + +private: + + /** + * Programmatic name, e.g., "Latin-Arabic". + */ + UnicodeString ID; + + /** + * This transliterator's filter. Any character for which + * filter.contains() returns false will not be + * altered by this transliterator. If filter is + * null then no filtering is applied. + */ + UnicodeFilter* filter; + + int32_t maximumContextLength; + + public: + + /** + * A context integer or pointer for a factory function, passed by + * value. + * @stable ICU 2.4 + */ + union Token { + /** + * This token, interpreted as a 32-bit integer. + * @stable ICU 2.4 + */ + int32_t integer; + /** + * This token, interpreted as a native pointer. + * @stable ICU 2.4 + */ + void* pointer; + }; + +#ifndef U_HIDE_INTERNAL_API + /** + * Return a token containing an integer. + * @return a token containing an integer. + * @internal + */ + inline static Token integerToken(int32_t); + + /** + * Return a token containing a pointer. + * @return a token containing a pointer. + * @internal + */ + inline static Token pointerToken(void*); +#endif /* U_HIDE_INTERNAL_API */ + + /** + * A function that creates and returns a Transliterator. When + * invoked, it will be passed the ID string that is being + * instantiated, together with the context pointer that was passed + * in when the factory function was first registered. Many + * factory functions will ignore both parameters, however, + * functions that are registered to more than one ID may use the + * ID or the context parameter to parameterize the transliterator + * they create. + * @param ID the string identifier for this transliterator + * @param context a context pointer that will be stored and + * later passed to the factory function when an ID matching + * the registration ID is being instantiated with this factory. + * @stable ICU 2.4 + */ + typedef Transliterator* (U_EXPORT2 *Factory)(const UnicodeString& ID, Token context); + +protected: + + /** + * Default constructor. + * @param ID the string identifier for this transliterator + * @param adoptedFilter the filter. Any character for which + * filter.contains() returns false will not be + * altered by this transliterator. If filter is + * null then no filtering is applied. + * @stable ICU 2.4 + */ + Transliterator(const UnicodeString& ID, UnicodeFilter* adoptedFilter); + + /** + * Copy constructor. + * @stable ICU 2.4 + */ + Transliterator(const Transliterator&); + + /** + * Assignment operator. + * @stable ICU 2.4 + */ + Transliterator& operator=(const Transliterator&); + + /** + * Create a transliterator from a basic ID. This is an ID + * containing only the forward direction source, target, and + * variant. + * @param id a basic ID of the form S-T or S-T/V. + * @param canon canonical ID to assign to the object, or + * NULL to leave the ID unchanged + * @return a newly created Transliterator or null if the ID is + * invalid. + * @stable ICU 2.4 + */ + static Transliterator* createBasicInstance(const UnicodeString& id, + const UnicodeString* canon); + + friend class TransliteratorParser; // for parseID() + friend class TransliteratorIDParser; // for createBasicInstance() + friend class TransliteratorAlias; // for setID() + +public: + + /** + * Destructor. + * @stable ICU 2.0 + */ + virtual ~Transliterator(); + + /** + * Implements Cloneable. + * All subclasses are encouraged to implement this method if it is + * possible and reasonable to do so. Subclasses that are to be + * registered with the system using registerInstance() + * are required to implement this method. If a subclass does not + * implement clone() properly and is registered with the system + * using registerInstance(), then the default clone() implementation + * will return null, and calls to createInstance() will fail. + * + * @return a copy of the object. + * @see #registerInstance + * @stable ICU 2.0 + */ + virtual Transliterator* clone() const; + + /** + * Transliterates a segment of a string, with optional filtering. + * + * @param text the string to be transliterated + * @param start the beginning index, inclusive; 0 <= start + * <= limit. + * @param limit the ending index, exclusive; start <= limit + * <= text.length(). + * @return The new limit index. The text previously occupying [start, + * limit) has been transliterated, possibly to a string of a different + * length, at [start, new-limit), where + * new-limit is the return value. If the input offsets are out of bounds, + * the returned value is -1 and the input string remains unchanged. + * @stable ICU 2.0 + */ + virtual int32_t transliterate(Replaceable& text, + int32_t start, int32_t limit) const; + + /** + * Transliterates an entire string in place. Convenience method. + * @param text the string to be transliterated + * @stable ICU 2.0 + */ + virtual void transliterate(Replaceable& text) const; + + /** + * Transliterates the portion of the text buffer that can be + * transliterated unambiguosly after new text has been inserted, + * typically as a result of a keyboard event. The new text in + * insertion will be inserted into text + * at index.limit, advancing + * index.limit by insertion.length(). + * Then the transliterator will try to transliterate characters of + * text between index.cursor and + * index.limit. Characters before + * index.cursor will not be changed. + * + *

Upon return, values in index will be updated. + * index.start will be advanced to the first + * character that future calls to this method will read. + * index.cursor and index.limit will + * be adjusted to delimit the range of text that future calls to + * this method may change. + * + *

Typical usage of this method begins with an initial call + * with index.start and index.limit + * set to indicate the portion of text to be + * transliterated, and index.cursor == index.start. + * Thereafter, index can be used without + * modification in future calls, provided that all changes to + * text are made via this method. + * + *

This method assumes that future calls may be made that will + * insert new text into the buffer. As a result, it only performs + * unambiguous transliterations. After the last call to this + * method, there may be untransliterated text that is waiting for + * more input to resolve an ambiguity. In order to perform these + * pending transliterations, clients should call {@link + * #finishTransliteration } after the last call to this + * method has been made. + * + * @param text the buffer holding transliterated and untransliterated text + * @param index an array of three integers. + * + *

  • index.start: the beginning index, + * inclusive; 0 <= index.start <= index.limit. + * + *
  • index.limit: the ending index, exclusive; + * index.start <= index.limit <= text.length(). + * insertion is inserted at + * index.limit. + * + *
  • index.cursor: the next character to be + * considered for transliteration; index.start <= + * index.cursor <= index.limit. Characters before + * index.cursor will not be changed by future calls + * to this method.
+ * + * @param insertion text to be inserted and possibly + * transliterated into the translation buffer at + * index.limit. If null then no text + * is inserted. + * @param status Output param to filled in with a success or an error. + * @see #handleTransliterate + * @exception IllegalArgumentException if index + * is invalid + * @see UTransPosition + * @stable ICU 2.0 + */ + virtual void transliterate(Replaceable& text, UTransPosition& index, + const UnicodeString& insertion, + UErrorCode& status) const; + + /** + * Transliterates the portion of the text buffer that can be + * transliterated unambiguosly after a new character has been + * inserted, typically as a result of a keyboard event. This is a + * convenience method. + * @param text the buffer holding transliterated and + * untransliterated text + * @param index an array of three integers. + * @param insertion text to be inserted and possibly + * transliterated into the translation buffer at + * index.limit. + * @param status Output param to filled in with a success or an error. + * @see #transliterate(Replaceable&, UTransPosition&, const UnicodeString&, UErrorCode&) const + * @stable ICU 2.0 + */ + virtual void transliterate(Replaceable& text, UTransPosition& index, + UChar32 insertion, + UErrorCode& status) const; + + /** + * Transliterates the portion of the text buffer that can be + * transliterated unambiguosly. This is a convenience method; see + * {@link + * #transliterate(Replaceable&, UTransPosition&, const UnicodeString&, UErrorCode&) const } + * for details. + * @param text the buffer holding transliterated and + * untransliterated text + * @param index an array of three integers. See {@link #transliterate(Replaceable&, UTransPosition&, const UnicodeString*, UErrorCode&) const }. + * @param status Output param to filled in with a success or an error. + * @see #transliterate(Replaceable, int[], String) + * @stable ICU 2.0 + */ + virtual void transliterate(Replaceable& text, UTransPosition& index, + UErrorCode& status) const; + + /** + * Finishes any pending transliterations that were waiting for + * more characters. Clients should call this method as the last + * call after a sequence of one or more calls to + * transliterate(). + * @param text the buffer holding transliterated and + * untransliterated text. + * @param index the array of indices previously passed to {@link + * #transliterate } + * @stable ICU 2.0 + */ + virtual void finishTransliteration(Replaceable& text, + UTransPosition& index) const; + +private: + + /** + * This internal method does incremental transliteration. If the + * 'insertion' is non-null then we append it to 'text' before + * proceeding. This method calls through to the pure virtual + * framework method handleTransliterate() to do the actual + * work. + * @param text the buffer holding transliterated and + * untransliterated text + * @param index an array of three integers. See {@link + * #transliterate(Replaceable, int[], String)}. + * @param insertion text to be inserted and possibly + * transliterated into the translation buffer at + * index.limit. + * @param status Output param to filled in with a success or an error. + */ + void _transliterate(Replaceable& text, + UTransPosition& index, + const UnicodeString* insertion, + UErrorCode &status) const; + +protected: + + /** + * Abstract method that concrete subclasses define to implement + * their transliteration algorithm. This method handles both + * incremental and non-incremental transliteration. Let + * originalStart refer to the value of + * pos.start upon entry. + * + *
    + *
  • If incremental is false, then this method + * should transliterate all characters between + * pos.start and pos.limit. Upon return + * pos.start must == pos.limit.
  • + * + *
  • If incremental is true, then this method + * should transliterate all characters between + * pos.start and pos.limit that can be + * unambiguously transliterated, regardless of future insertions + * of text at pos.limit. Upon return, + * pos.start should be in the range + * [originalStart, pos.limit). + * pos.start should be positioned such that + * characters [originalStart, + * pos.start) will not be changed in the future by this + * transliterator and characters [pos.start, + * pos.limit) are unchanged.
  • + *
+ * + *

Implementations of this method should also obey the + * following invariants:

+ * + *
    + *
  • pos.limit and pos.contextLimit + * should be updated to reflect changes in length of the text + * between pos.start and pos.limit. The + * difference pos.contextLimit - pos.limit should + * not change.
  • + * + *
  • pos.contextStart should not change.
  • + * + *
  • Upon return, neither pos.start nor + * pos.limit should be less than + * originalStart.
  • + * + *
  • Text before originalStart and text after + * pos.limit should not change.
  • + * + *
  • Text before pos.contextStart and text after + * pos.contextLimit should be ignored.
  • + *
+ * + *

Subclasses may safely assume that all characters in + * [pos.start, pos.limit) are filtered. + * In other words, the filter has already been applied by the time + * this method is called. See + * filteredTransliterate(). + * + *

This method is not for public consumption. Calling + * this method directly will transliterate + * [pos.start, pos.limit) without + * applying the filter. End user code should call + * transliterate() instead of this method. Subclass code + * and wrapping transliterators should call + * filteredTransliterate() instead of this method.

+ * + * @param text the buffer holding transliterated and + * untransliterated text + * + * @param pos the indices indicating the start, limit, context + * start, and context limit of the text. + * + * @param incremental if true, assume more text may be inserted at + * pos.limit and act accordingly. Otherwise, + * transliterate all text between pos.start and + * pos.limit and move pos.start up to + * pos.limit. + * + * @see #transliterate + * @stable ICU 2.4 + */ + virtual void handleTransliterate(Replaceable& text, + UTransPosition& pos, + UBool incremental) const = 0; + +public: + /** + * Transliterate a substring of text, as specified by index, taking filters + * into account. This method is for subclasses that need to delegate to + * another transliterator, such as CompoundTransliterator. + * @param text the text to be transliterated + * @param index the position indices + * @param incremental if TRUE, then assume more characters may be inserted + * at index.limit, and postpone processing to accomodate future incoming + * characters + * @stable ICU 2.4 + */ + virtual void filteredTransliterate(Replaceable& text, + UTransPosition& index, + UBool incremental) const; + +private: + + /** + * Top-level transliteration method, handling filtering, incremental and + * non-incremental transliteration, and rollback. All transliteration + * public API methods eventually call this method with a rollback argument + * of TRUE. Other entities may call this method but rollback should be + * FALSE. + * + *

If this transliterator has a filter, break up the input text into runs + * of unfiltered characters. Pass each run to + * subclass.handleTransliterate(). + * + *

In incremental mode, if rollback is TRUE, perform a special + * incremental procedure in which several passes are made over the input + * text, adding one character at a time, and committing successful + * transliterations as they occur. Unsuccessful transliterations are rolled + * back and retried with additional characters to give correct results. + * + * @param text the text to be transliterated + * @param index the position indices + * @param incremental if TRUE, then assume more characters may be inserted + * at index.limit, and postpone processing to accomodate future incoming + * characters + * @param rollback if TRUE and if incremental is TRUE, then perform special + * incremental processing, as described above, and undo partial + * transliterations where necessary. If incremental is FALSE then this + * parameter is ignored. + */ + virtual void filteredTransliterate(Replaceable& text, + UTransPosition& index, + UBool incremental, + UBool rollback) const; + +public: + + /** + * Returns the length of the longest context required by this transliterator. + * This is preceding context. The default implementation supplied + * by Transliterator returns zero; subclasses + * that use preceding context should override this method to return the + * correct value. For example, if a transliterator translates "ddd" (where + * d is any digit) to "555" when preceded by "(ddd)", then the preceding + * context length is 5, the length of "(ddd)". + * + * @return The maximum number of preceding context characters this + * transliterator needs to examine + * @stable ICU 2.0 + */ + int32_t getMaximumContextLength(void) const; + +protected: + + /** + * Method for subclasses to use to set the maximum context length. + * @param maxContextLength the new value to be set. + * @see #getMaximumContextLength + * @stable ICU 2.4 + */ + void setMaximumContextLength(int32_t maxContextLength); + +public: + + /** + * Returns a programmatic identifier for this transliterator. + * If this identifier is passed to createInstance(), it + * will return this object, if it has been registered. + * @return a programmatic identifier for this transliterator. + * @see #registerInstance + * @see #registerFactory + * @see #getAvailableIDs + * @stable ICU 2.0 + */ + virtual const UnicodeString& getID(void) const; + + /** + * Returns a name for this transliterator that is appropriate for + * display to the user in the default locale. See {@link + * #getDisplayName } for details. + * @param ID the string identifier for this transliterator + * @param result Output param to receive the display name + * @return A reference to 'result'. + * @stable ICU 2.0 + */ + static UnicodeString& U_EXPORT2 getDisplayName(const UnicodeString& ID, + UnicodeString& result); + + /** + * Returns a name for this transliterator that is appropriate for + * display to the user in the given locale. This name is taken + * from the locale resource data in the standard manner of the + * java.text package. + * + *

If no localized names exist in the system resource bundles, + * a name is synthesized using a localized + * MessageFormat pattern from the resource data. The + * arguments to this pattern are an integer followed by one or two + * strings. The integer is the number of strings, either 1 or 2. + * The strings are formed by splitting the ID for this + * transliterator at the first '-'. If there is no '-', then the + * entire ID forms the only string. + * @param ID the string identifier for this transliterator + * @param inLocale the Locale in which the display name should be + * localized. + * @param result Output param to receive the display name + * @return A reference to 'result'. + * @stable ICU 2.0 + */ + static UnicodeString& U_EXPORT2 getDisplayName(const UnicodeString& ID, + const Locale& inLocale, + UnicodeString& result); + + /** + * Returns the filter used by this transliterator, or NULL + * if this transliterator uses no filter. + * @return the filter used by this transliterator, or NULL + * if this transliterator uses no filter. + * @stable ICU 2.0 + */ + const UnicodeFilter* getFilter(void) const; + + /** + * Returns the filter used by this transliterator, or NULL if this + * transliterator uses no filter. The caller must eventually delete the + * result. After this call, this transliterator's filter is set to + * NULL. + * @return the filter used by this transliterator, or NULL if this + * transliterator uses no filter. + * @stable ICU 2.4 + */ + UnicodeFilter* orphanFilter(void); + + /** + * Changes the filter used by this transliterator. If the filter + * is set to null then no filtering will occur. + * + *

Callers must take care if a transliterator is in use by + * multiple threads. The filter should not be changed by one + * thread while another thread may be transliterating. + * @param adoptedFilter the new filter to be adopted. + * @stable ICU 2.0 + */ + void adoptFilter(UnicodeFilter* adoptedFilter); + + /** + * Returns this transliterator's inverse. See the class + * documentation for details. This implementation simply inverts + * the two entities in the ID and attempts to retrieve the + * resulting transliterator. That is, if getID() + * returns "A-B", then this method will return the result of + * createInstance("B-A"), or null if that + * call fails. + * + *

Subclasses with knowledge of their inverse may wish to + * override this method. + * + * @param status Output param to filled in with a success or an error. + * @return a transliterator that is an inverse, not necessarily + * exact, of this transliterator, or null if no such + * transliterator is registered. + * @see #registerInstance + * @stable ICU 2.0 + */ + Transliterator* createInverse(UErrorCode& status) const; + + /** + * Returns a Transliterator object given its ID. + * The ID must be either a system transliterator ID or a ID registered + * using registerInstance(). + * + * @param ID a valid ID, as enumerated by getAvailableIDs() + * @param dir either FORWARD or REVERSE. + * @param parseError Struct to recieve information on position + * of error if an error is encountered + * @param status Output param to filled in with a success or an error. + * @return A Transliterator object with the given ID + * @see #registerInstance + * @see #getAvailableIDs + * @see #getID + * @stable ICU 2.0 + */ + static Transliterator* U_EXPORT2 createInstance(const UnicodeString& ID, + UTransDirection dir, + UParseError& parseError, + UErrorCode& status); + + /** + * Returns a Transliterator object given its ID. + * The ID must be either a system transliterator ID or a ID registered + * using registerInstance(). + * @param ID a valid ID, as enumerated by getAvailableIDs() + * @param dir either FORWARD or REVERSE. + * @param status Output param to filled in with a success or an error. + * @return A Transliterator object with the given ID + * @stable ICU 2.0 + */ + static Transliterator* U_EXPORT2 createInstance(const UnicodeString& ID, + UTransDirection dir, + UErrorCode& status); + + /** + * Returns a Transliterator object constructed from + * the given rule string. This will be a RuleBasedTransliterator, + * if the rule string contains only rules, or a + * CompoundTransliterator, if it contains ID blocks, or a + * NullTransliterator, if it contains ID blocks which parse as + * empty for the given direction. + * @param ID the id for the transliterator. + * @param rules rules, separated by ';' + * @param dir either FORWARD or REVERSE. + * @param parseError Struct to recieve information on position + * of error if an error is encountered + * @param status Output param set to success/failure code. + * @stable ICU 2.0 + */ + static Transliterator* U_EXPORT2 createFromRules(const UnicodeString& ID, + const UnicodeString& rules, + UTransDirection dir, + UParseError& parseError, + UErrorCode& status); + + /** + * Create a rule string that can be passed to createFromRules() + * to recreate this transliterator. + * @param result the string to receive the rules. Previous + * contents will be deleted. + * @param escapeUnprintable if TRUE then convert unprintable + * character to their hex escape representations, \\uxxxx or + * \\Uxxxxxxxx. Unprintable characters are those other than + * U+000A, U+0020..U+007E. + * @stable ICU 2.0 + */ + virtual UnicodeString& toRules(UnicodeString& result, + UBool escapeUnprintable) const; + + /** + * Return the number of elements that make up this transliterator. + * For example, if the transliterator "NFD;Jamo-Latin;Latin-Greek" + * were created, the return value of this method would be 3. + * + *

If this transliterator is not composed of other + * transliterators, then this method returns 1. + * @return the number of transliterators that compose this + * transliterator, or 1 if this transliterator is not composed of + * multiple transliterators + * @stable ICU 3.0 + */ + int32_t countElements() const; + + /** + * Return an element that makes up this transliterator. For + * example, if the transliterator "NFD;Jamo-Latin;Latin-Greek" + * were created, the return value of this method would be one + * of the three transliterator objects that make up that + * transliterator: [NFD, Jamo-Latin, Latin-Greek]. + * + *

If this transliterator is not composed of other + * transliterators, then this method will return a reference to + * this transliterator when given the index 0. + * @param index a value from 0..countElements()-1 indicating the + * transliterator to return + * @param ec input-output error code + * @return one of the transliterators that makes up this + * transliterator, if this transliterator is made up of multiple + * transliterators, otherwise a reference to this object if given + * an index of 0 + * @stable ICU 3.0 + */ + const Transliterator& getElement(int32_t index, UErrorCode& ec) const; + + /** + * Returns the set of all characters that may be modified in the + * input text by this Transliterator. This incorporates this + * object's current filter; if the filter is changed, the return + * value of this function will change. The default implementation + * returns an empty set. Some subclasses may override {@link + * #handleGetSourceSet } to return a more precise result. The + * return result is approximate in any case and is intended for + * use by tests, tools, or utilities. + * @param result receives result set; previous contents lost + * @return a reference to result + * @see #getTargetSet + * @see #handleGetSourceSet + * @stable ICU 2.4 + */ + UnicodeSet& getSourceSet(UnicodeSet& result) const; + + /** + * Framework method that returns the set of all characters that + * may be modified in the input text by this Transliterator, + * ignoring the effect of this object's filter. The base class + * implementation returns the empty set. Subclasses that wish to + * implement this should override this method. + * @return the set of characters that this transliterator may + * modify. The set may be modified, so subclasses should return a + * newly-created object. + * @param result receives result set; previous contents lost + * @see #getSourceSet + * @see #getTargetSet + * @stable ICU 2.4 + */ + virtual void handleGetSourceSet(UnicodeSet& result) const; + + /** + * Returns the set of all characters that may be generated as + * replacement text by this transliterator. The default + * implementation returns the empty set. Some subclasses may + * override this method to return a more precise result. The + * return result is approximate in any case and is intended for + * use by tests, tools, or utilities requiring such + * meta-information. + * @param result receives result set; previous contents lost + * @return a reference to result + * @see #getTargetSet + * @stable ICU 2.4 + */ + virtual UnicodeSet& getTargetSet(UnicodeSet& result) const; + +public: + + /** + * Registers a factory function that creates transliterators of + * a given ID. + * + * Because ICU may choose to cache Transliterators internally, this must + * be called at application startup, prior to any calls to + * Transliterator::createXXX to avoid undefined behavior. + * + * @param id the ID being registered + * @param factory a function pointer that will be copied and + * called later when the given ID is passed to createInstance() + * @param context a context pointer that will be stored and + * later passed to the factory function when an ID matching + * the registration ID is being instantiated with this factory. + * @stable ICU 2.0 + */ + static void U_EXPORT2 registerFactory(const UnicodeString& id, + Factory factory, + Token context); + + /** + * Registers an instance obj of a subclass of + * Transliterator with the system. When + * createInstance() is called with an ID string that is + * equal to obj->getID(), then obj->clone() is + * returned. + * + * After this call the Transliterator class owns the adoptedObj + * and will delete it. + * + * Because ICU may choose to cache Transliterators internally, this must + * be called at application startup, prior to any calls to + * Transliterator::createXXX to avoid undefined behavior. + * + * @param adoptedObj an instance of subclass of + * Transliterator that defines clone() + * @see #createInstance + * @see #registerFactory + * @see #unregister + * @stable ICU 2.0 + */ + static void U_EXPORT2 registerInstance(Transliterator* adoptedObj); + + /** + * Registers an ID string as an alias of another ID string. + * That is, after calling this function, createInstance(aliasID) + * will return the same thing as createInstance(realID). + * This is generally used to create shorter, more mnemonic aliases + * for long compound IDs. + * + * @param aliasID The new ID being registered. + * @param realID The ID that the new ID is to be an alias for. + * This can be a compound ID and can include filters and should + * refer to transliterators that have already been registered with + * the framework, although this isn't checked. + * @stable ICU 3.6 + */ + static void U_EXPORT2 registerAlias(const UnicodeString& aliasID, + const UnicodeString& realID); + +protected: + +#ifndef U_HIDE_INTERNAL_API + /** + * @param id the ID being registered + * @param factory a function pointer that will be copied and + * called later when the given ID is passed to createInstance() + * @param context a context pointer that will be stored and + * later passed to the factory function when an ID matching + * the registration ID is being instantiated with this factory. + * @internal + */ + static void _registerFactory(const UnicodeString& id, + Factory factory, + Token context); + + /** + * @internal + */ + static void _registerInstance(Transliterator* adoptedObj); + + /** + * @internal + */ + static void _registerAlias(const UnicodeString& aliasID, const UnicodeString& realID); + + /** + * Register two targets as being inverses of one another. For + * example, calling registerSpecialInverse("NFC", "NFD", true) causes + * Transliterator to form the following inverse relationships: + * + *

NFC => NFD
+     * Any-NFC => Any-NFD
+     * NFD => NFC
+     * Any-NFD => Any-NFC
+ * + * (Without the special inverse registration, the inverse of NFC + * would be NFC-Any.) Note that NFD is shorthand for Any-NFD, but + * that the presence or absence of "Any-" is preserved. + * + *

The relationship is symmetrical; registering (a, b) is + * equivalent to registering (b, a). + * + *

The relevant IDs must still be registered separately as + * factories or classes. + * + *

Only the targets are specified. Special inverses always + * have the form Any-Target1 <=> Any-Target2. The target should + * have canonical casing (the casing desired to be produced when + * an inverse is formed) and should contain no whitespace or other + * extraneous characters. + * + * @param target the target against which to register the inverse + * @param inverseTarget the inverse of target, that is + * Any-target.getInverse() => Any-inverseTarget + * @param bidirectional if true, register the reverse relation + * as well, that is, Any-inverseTarget.getInverse() => Any-target + * @internal + */ + static void _registerSpecialInverse(const UnicodeString& target, + const UnicodeString& inverseTarget, + UBool bidirectional); +#endif /* U_HIDE_INTERNAL_API */ + +public: + + /** + * Unregisters a transliterator or class. This may be either + * a system transliterator or a user transliterator or class. + * Any attempt to construct an unregistered transliterator based + * on its ID will fail. + * + * Because ICU may choose to cache Transliterators internally, this should + * be called during application shutdown, after all calls to + * Transliterator::createXXX to avoid undefined behavior. + * + * @param ID the ID of the transliterator or class + * @return the Object that was registered with + * ID, or null if none was + * @see #registerInstance + * @see #registerFactory + * @stable ICU 2.0 + */ + static void U_EXPORT2 unregister(const UnicodeString& ID); + +public: + + /** + * Return a StringEnumeration over the IDs available at the time of the + * call, including user-registered IDs. + * @param ec input-output error code + * @return a newly-created StringEnumeration over the transliterators + * available at the time of the call. The caller should delete this object + * when done using it. + * @stable ICU 3.0 + */ + static StringEnumeration* U_EXPORT2 getAvailableIDs(UErrorCode& ec); + + /** + * Return the number of registered source specifiers. + * @return the number of registered source specifiers. + * @stable ICU 2.0 + */ + static int32_t U_EXPORT2 countAvailableSources(void); + + /** + * Return a registered source specifier. + * @param index which specifier to return, from 0 to n-1, where + * n = countAvailableSources() + * @param result fill-in paramter to receive the source specifier. + * If index is out of range, result will be empty. + * @return reference to result + * @stable ICU 2.0 + */ + static UnicodeString& U_EXPORT2 getAvailableSource(int32_t index, + UnicodeString& result); + + /** + * Return the number of registered target specifiers for a given + * source specifier. + * @param source the given source specifier. + * @return the number of registered target specifiers for a given + * source specifier. + * @stable ICU 2.0 + */ + static int32_t U_EXPORT2 countAvailableTargets(const UnicodeString& source); + + /** + * Return a registered target specifier for a given source. + * @param index which specifier to return, from 0 to n-1, where + * n = countAvailableTargets(source) + * @param source the source specifier + * @param result fill-in paramter to receive the target specifier. + * If source is invalid or if index is out of range, result will + * be empty. + * @return reference to result + * @stable ICU 2.0 + */ + static UnicodeString& U_EXPORT2 getAvailableTarget(int32_t index, + const UnicodeString& source, + UnicodeString& result); + + /** + * Return the number of registered variant specifiers for a given + * source-target pair. + * @param source the source specifiers. + * @param target the target specifiers. + * @stable ICU 2.0 + */ + static int32_t U_EXPORT2 countAvailableVariants(const UnicodeString& source, + const UnicodeString& target); + + /** + * Return a registered variant specifier for a given source-target + * pair. + * @param index which specifier to return, from 0 to n-1, where + * n = countAvailableVariants(source, target) + * @param source the source specifier + * @param target the target specifier + * @param result fill-in paramter to receive the variant + * specifier. If source is invalid or if target is invalid or if + * index is out of range, result will be empty. + * @return reference to result + * @stable ICU 2.0 + */ + static UnicodeString& U_EXPORT2 getAvailableVariant(int32_t index, + const UnicodeString& source, + const UnicodeString& target, + UnicodeString& result); + +protected: + +#ifndef U_HIDE_INTERNAL_API + /** + * Non-mutexed internal method + * @internal + */ + static int32_t _countAvailableSources(void); + + /** + * Non-mutexed internal method + * @internal + */ + static UnicodeString& _getAvailableSource(int32_t index, + UnicodeString& result); + + /** + * Non-mutexed internal method + * @internal + */ + static int32_t _countAvailableTargets(const UnicodeString& source); + + /** + * Non-mutexed internal method + * @internal + */ + static UnicodeString& _getAvailableTarget(int32_t index, + const UnicodeString& source, + UnicodeString& result); + + /** + * Non-mutexed internal method + * @internal + */ + static int32_t _countAvailableVariants(const UnicodeString& source, + const UnicodeString& target); + + /** + * Non-mutexed internal method + * @internal + */ + static UnicodeString& _getAvailableVariant(int32_t index, + const UnicodeString& source, + const UnicodeString& target, + UnicodeString& result); +#endif /* U_HIDE_INTERNAL_API */ + +protected: + + /** + * Set the ID of this transliterators. Subclasses shouldn't do + * this, unless the underlying script behavior has changed. + * @param id the new id t to be set. + * @stable ICU 2.4 + */ + void setID(const UnicodeString& id); + +public: + + /** + * Return the class ID for this class. This is useful only for + * comparing to a return value from getDynamicClassID(). + * Note that Transliterator is an abstract base class, and therefor + * no fully constructed object will have a dynamic + * UCLassID that equals the UClassID returned from + * TRansliterator::getStaticClassID(). + * @return The class ID for class Transliterator. + * @stable ICU 2.0 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Returns a unique class ID polymorphically. This method + * is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and + * clone() methods call this method. + * + *

Concrete subclasses of Transliterator must use the + * UOBJECT_DEFINE_RTTI_IMPLEMENTATION macro from + * uobject.h to provide the RTTI functions. + * + * @return The class ID for this object. All objects of a given + * class have the same class ID. Objects of other classes have + * different class IDs. + * @stable ICU 2.0 + */ + virtual UClassID getDynamicClassID(void) const = 0; + +private: + static UBool initializeRegistry(UErrorCode &status); + +public: +#ifndef U_HIDE_OBSOLETE_API + /** + * Return the number of IDs currently registered with the system. + * To retrieve the actual IDs, call getAvailableID(i) with + * i from 0 to countAvailableIDs() - 1. + * @return the number of IDs currently registered with the system. + * @obsolete ICU 3.4 use getAvailableIDs() instead + */ + static int32_t U_EXPORT2 countAvailableIDs(void); + + /** + * Return the index-th available ID. index must be between 0 + * and countAvailableIDs() - 1, inclusive. If index is out of + * range, the result of getAvailableID(0) is returned. + * @param index the given ID index. + * @return the index-th available ID. index must be between 0 + * and countAvailableIDs() - 1, inclusive. If index is out of + * range, the result of getAvailableID(0) is returned. + * @obsolete ICU 3.4 use getAvailableIDs() instead; this function + * is not thread safe, since it returns a reference to storage that + * may become invalid if another thread calls unregister + */ + static const UnicodeString& U_EXPORT2 getAvailableID(int32_t index); +#endif /* U_HIDE_OBSOLETE_API */ +}; + +inline int32_t Transliterator::getMaximumContextLength(void) const { + return maximumContextLength; +} + +inline void Transliterator::setID(const UnicodeString& id) { + ID = id; + // NUL-terminate the ID string, which is a non-aliased copy. + ID.append((char16_t)0); + ID.truncate(ID.length()-1); +} + +#ifndef U_HIDE_INTERNAL_API +inline Transliterator::Token Transliterator::integerToken(int32_t i) { + Token t; + t.integer = i; + return t; +} + +inline Transliterator::Token Transliterator::pointerToken(void* p) { + Token t; + t.pointer = p; + return t; +} +#endif /* U_HIDE_INTERNAL_API */ + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_TRANSLITERATION */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/tzfmt.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/tzfmt.h new file mode 100644 index 0000000..724ff4d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/tzfmt.h @@ -0,0 +1,1097 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2011-2015, International Business Machines Corporation and +* others. All Rights Reserved. +******************************************************************************* +*/ +#ifndef __TZFMT_H +#define __TZFMT_H + +/** + * \file + * \brief C++ API: TimeZoneFormat + */ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/format.h" +#include "unicode/timezone.h" +#include "unicode/tznames.h" + +U_CDECL_BEGIN +/** + * Constants for time zone display format style used by format/parse APIs + * in TimeZoneFormat. + * @stable ICU 50 + */ +typedef enum UTimeZoneFormatStyle { + /** + * Generic location format, such as "United States Time (New York)", "Italy Time" + * @stable ICU 50 + */ + UTZFMT_STYLE_GENERIC_LOCATION, + /** + * Generic long non-location format, such as "Eastern Time". + * @stable ICU 50 + */ + UTZFMT_STYLE_GENERIC_LONG, + /** + * Generic short non-location format, such as "ET". + * @stable ICU 50 + */ + UTZFMT_STYLE_GENERIC_SHORT, + /** + * Specific long format, such as "Eastern Standard Time". + * @stable ICU 50 + */ + UTZFMT_STYLE_SPECIFIC_LONG, + /** + * Specific short format, such as "EST", "PDT". + * @stable ICU 50 + */ + UTZFMT_STYLE_SPECIFIC_SHORT, + /** + * Localized GMT offset format, such as "GMT-05:00", "UTC+0100" + * @stable ICU 50 + */ + UTZFMT_STYLE_LOCALIZED_GMT, + /** + * Short localized GMT offset format, such as "GMT-5", "UTC+1:30" + * This style is equivalent to the LDML date format pattern "O". + * @stable ICU 51 + */ + UTZFMT_STYLE_LOCALIZED_GMT_SHORT, + /** + * Short ISO 8601 local time difference (basic format) or the UTC indicator. + * For example, "-05", "+0530", and "Z"(UTC). + * This style is equivalent to the LDML date format pattern "X". + * @stable ICU 51 + */ + UTZFMT_STYLE_ISO_BASIC_SHORT, + /** + * Short ISO 8601 locale time difference (basic format). + * For example, "-05" and "+0530". + * This style is equivalent to the LDML date format pattern "x". + * @stable ICU 51 + */ + UTZFMT_STYLE_ISO_BASIC_LOCAL_SHORT, + /** + * Fixed width ISO 8601 local time difference (basic format) or the UTC indicator. + * For example, "-0500", "+0530", and "Z"(UTC). + * This style is equivalent to the LDML date format pattern "XX". + * @stable ICU 51 + */ + UTZFMT_STYLE_ISO_BASIC_FIXED, + /** + * Fixed width ISO 8601 local time difference (basic format). + * For example, "-0500" and "+0530". + * This style is equivalent to the LDML date format pattern "xx". + * @stable ICU 51 + */ + UTZFMT_STYLE_ISO_BASIC_LOCAL_FIXED, + /** + * ISO 8601 local time difference (basic format) with optional seconds field, or the UTC indicator. + * For example, "-0500", "+052538", and "Z"(UTC). + * This style is equivalent to the LDML date format pattern "XXXX". + * @stable ICU 51 + */ + UTZFMT_STYLE_ISO_BASIC_FULL, + /** + * ISO 8601 local time difference (basic format) with optional seconds field. + * For example, "-0500" and "+052538". + * This style is equivalent to the LDML date format pattern "xxxx". + * @stable ICU 51 + */ + UTZFMT_STYLE_ISO_BASIC_LOCAL_FULL, + /** + * Fixed width ISO 8601 local time difference (extended format) or the UTC indicator. + * For example, "-05:00", "+05:30", and "Z"(UTC). + * This style is equivalent to the LDML date format pattern "XXX". + * @stable ICU 51 + */ + UTZFMT_STYLE_ISO_EXTENDED_FIXED, + /** + * Fixed width ISO 8601 local time difference (extended format). + * For example, "-05:00" and "+05:30". + * This style is equivalent to the LDML date format pattern "xxx" and "ZZZZZ". + * @stable ICU 51 + */ + UTZFMT_STYLE_ISO_EXTENDED_LOCAL_FIXED, + /** + * ISO 8601 local time difference (extended format) with optional seconds field, or the UTC indicator. + * For example, "-05:00", "+05:25:38", and "Z"(UTC). + * This style is equivalent to the LDML date format pattern "XXXXX". + * @stable ICU 51 + */ + UTZFMT_STYLE_ISO_EXTENDED_FULL, + /** + * ISO 8601 local time difference (extended format) with optional seconds field. + * For example, "-05:00" and "+05:25:38". + * This style is equivalent to the LDML date format pattern "xxxxx". + * @stable ICU 51 + */ + UTZFMT_STYLE_ISO_EXTENDED_LOCAL_FULL, + /** + * Time Zone ID, such as "America/Los_Angeles". + * @stable ICU 51 + */ + UTZFMT_STYLE_ZONE_ID, + /** + * Short Time Zone ID (BCP 47 Unicode location extension, time zone type value), such as "uslax". + * @stable ICU 51 + */ + UTZFMT_STYLE_ZONE_ID_SHORT, + /** + * Exemplar location, such as "Los Angeles" and "Paris". + * @stable ICU 51 + */ + UTZFMT_STYLE_EXEMPLAR_LOCATION +} UTimeZoneFormatStyle; + +/** + * Constants for GMT offset pattern types. + * @stable ICU 50 + */ +typedef enum UTimeZoneFormatGMTOffsetPatternType { + /** + * Positive offset with hours and minutes fields + * @stable ICU 50 + */ + UTZFMT_PAT_POSITIVE_HM, + /** + * Positive offset with hours, minutes and seconds fields + * @stable ICU 50 + */ + UTZFMT_PAT_POSITIVE_HMS, + /** + * Negative offset with hours and minutes fields + * @stable ICU 50 + */ + UTZFMT_PAT_NEGATIVE_HM, + /** + * Negative offset with hours, minutes and seconds fields + * @stable ICU 50 + */ + UTZFMT_PAT_NEGATIVE_HMS, + /** + * Positive offset with hours field + * @stable ICU 51 + */ + UTZFMT_PAT_POSITIVE_H, + /** + * Negative offset with hours field + * @stable ICU 51 + */ + UTZFMT_PAT_NEGATIVE_H, + + /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed for other .h declarations */ + /** + * Number of UTimeZoneFormatGMTOffsetPatternType types. + * @internal + */ + UTZFMT_PAT_COUNT = 6 +} UTimeZoneFormatGMTOffsetPatternType; + +/** + * Constants for time types used by TimeZoneFormat APIs for + * receiving time type (standard time, daylight time or unknown). + * @stable ICU 50 + */ +typedef enum UTimeZoneFormatTimeType { + /** + * Unknown + * @stable ICU 50 + */ + UTZFMT_TIME_TYPE_UNKNOWN, + /** + * Standard time + * @stable ICU 50 + */ + UTZFMT_TIME_TYPE_STANDARD, + /** + * Daylight saving time + * @stable ICU 50 + */ + UTZFMT_TIME_TYPE_DAYLIGHT +} UTimeZoneFormatTimeType; + +/** + * Constants for parse option flags, used for specifying optional parse behavior. + * @stable ICU 50 + */ +typedef enum UTimeZoneFormatParseOption { + /** + * No option. + * @stable ICU 50 + */ + UTZFMT_PARSE_OPTION_NONE = 0x00, + /** + * When a time zone display name is not found within a set of display names + * used for the specified style, look for the name from display names used + * by other styles. + * @stable ICU 50 + */ + UTZFMT_PARSE_OPTION_ALL_STYLES = 0x01, + /** + * When parsing a time zone display name in UTZFMT_STYLE_SPECIFIC_SHORT, + * look for the IANA tz database compatible zone abbreviations in addition + * to the localized names coming from the {@link TimeZoneNames} currently + * used by the {@link TimeZoneFormat}. + * @stable ICU 54 + */ + UTZFMT_PARSE_OPTION_TZ_DATABASE_ABBREVIATIONS = 0x02 +} UTimeZoneFormatParseOption; + +U_CDECL_END + +U_NAMESPACE_BEGIN + +class TimeZoneGenericNames; +class TZDBTimeZoneNames; +class UVector; + +/** + * TimeZoneFormat supports time zone display name formatting and parsing. + * An instance of TimeZoneFormat works as a subformatter of {@link SimpleDateFormat}, + * but you can also directly get a new instance of TimeZoneFormat and + * formatting/parsing time zone display names. + *

+ * ICU implements the time zone display names defined by UTS#35 + * Unicode Locale Data Markup Language (LDML). {@link TimeZoneNames} represents the + * time zone display name data model and this class implements the algorithm for actual + * formatting and parsing. + * + * @see SimpleDateFormat + * @see TimeZoneNames + * @stable ICU 50 + */ +class U_I18N_API TimeZoneFormat : public Format { +public: + /** + * Copy constructor. + * @stable ICU 50 + */ + TimeZoneFormat(const TimeZoneFormat& other); + + /** + * Destructor. + * @stable ICU 50 + */ + virtual ~TimeZoneFormat(); + + /** + * Assignment operator. + * @stable ICU 50 + */ + TimeZoneFormat& operator=(const TimeZoneFormat& other); + + /** + * Return true if the given Format objects are semantically equal. + * Objects of different subclasses are considered unequal. + * @param other The object to be compared with. + * @return Return TRUE if the given Format objects are semantically equal. + * Objects of different subclasses are considered unequal. + * @stable ICU 50 + */ + virtual UBool operator==(const Format& other) const; + + /** + * Clone this object polymorphically. The caller is responsible + * for deleting the result when done. + * @return A copy of the object + * @stable ICU 50 + */ + virtual Format* clone() const; + + /** + * Creates an instance of TimeZoneFormat for the given locale. + * @param locale The locale. + * @param status Receives the status. + * @return An instance of TimeZoneFormat for the given locale, + * owned by the caller. + * @stable ICU 50 + */ + static TimeZoneFormat* U_EXPORT2 createInstance(const Locale& locale, UErrorCode& status); + + /** + * Returns the time zone display name data used by this instance. + * @return The time zone display name data. + * @stable ICU 50 + */ + const TimeZoneNames* getTimeZoneNames() const; + + /** + * Sets the time zone display name data to this format instnace. + * The caller should not delete the TimeZoenNames object after it is adopted + * by this call. + * @param tznames TimeZoneNames object to be adopted. + * @stable ICU 50 + */ + void adoptTimeZoneNames(TimeZoneNames *tznames); + + /** + * Sets the time zone display name data to this format instnace. + * @param tznames TimeZoneNames object to be set. + * @stable ICU 50 + */ + void setTimeZoneNames(const TimeZoneNames &tznames); + + /** + * Returns the localized GMT format pattern. + * @param pattern Receives the localized GMT format pattern. + * @return A reference to the result pattern. + * @see #setGMTPattern + * @stable ICU 50 + */ + UnicodeString& getGMTPattern(UnicodeString& pattern) const; + + /** + * Sets the localized GMT format pattern. The pattern must contain + * a single argument {0}, for example "GMT {0}". + * @param pattern The localized GMT format pattern to be used by this object. + * @param status Recieves the status. + * @see #getGMTPattern + * @stable ICU 50 + */ + void setGMTPattern(const UnicodeString& pattern, UErrorCode& status); + + /** + * Returns the offset pattern used for localized GMT format. + * @param type The offset pattern type enum. + * @param pattern Receives the offset pattern. + * @return A reference to the result pattern. + * @see #setGMTOffsetPattern + * @stable ICU 50 + */ + UnicodeString& getGMTOffsetPattern(UTimeZoneFormatGMTOffsetPatternType type, UnicodeString& pattern) const; + + /** + * Sets the offset pattern for the given offset type. + * @param type The offset pattern type enum. + * @param pattern The offset pattern used for localized GMT format for the type. + * @param status Receives the status. + * @see #getGMTOffsetPattern + * @stable ICU 50 + */ + void setGMTOffsetPattern(UTimeZoneFormatGMTOffsetPatternType type, const UnicodeString& pattern, UErrorCode& status); + + /** + * Returns the decimal digit characters used for localized GMT format. + * The return string contains exactly 10 code points (may include Unicode + * supplementary character) representing digit 0 to digit 9 in the ascending + * order. + * @param digits Receives the decimal digits used for localized GMT format. + * @see #setGMTOffsetDigits + * @stable ICU 50 + */ + UnicodeString& getGMTOffsetDigits(UnicodeString& digits) const; + + /** + * Sets the decimal digit characters used for localized GMT format. + * The input digits must contain exactly 10 code points + * (Unicode supplementary characters are also allowed) representing + * digit 0 to digit 9 in the ascending order. When the input digits + * does not satisfy the condition, U_ILLEGAL_ARGUMENT_ERROR + * will be set to the return status. + * @param digits The decimal digits used for localized GMT format. + * @param status Receives the status. + * @see #getGMTOffsetDigits + * @stable ICU 50 + */ + void setGMTOffsetDigits(const UnicodeString& digits, UErrorCode& status); + + /** + * Returns the localized GMT format string for GMT(UTC) itself (GMT offset is 0). + * @param gmtZeroFormat Receives the localized GMT string string for GMT(UTC) itself. + * @return A reference to the result GMT string. + * @see #setGMTZeroFormat + * @stable ICU 50 + */ + UnicodeString& getGMTZeroFormat(UnicodeString& gmtZeroFormat) const; + + /** + * Sets the localized GMT format string for GMT(UTC) itself (GMT offset is 0). + * @param gmtZeroFormat The localized GMT format string for GMT(UTC). + * @param status Receives the status. + * @see #getGMTZeroFormat + * @stable ICU 50 + */ + void setGMTZeroFormat(const UnicodeString& gmtZeroFormat, UErrorCode& status); + + /** + * Returns the bitwise flags of UTimeZoneFormatParseOption representing the default parse + * options used by this object. + * @return the default parse options. + * @see ParseOption + * @stable ICU 50 + */ + uint32_t getDefaultParseOptions(void) const; + + /** + * Sets the default parse options. + *

Note: By default, an instance of TimeZoneFormat + * created by {@link #createInstance} has no parse options set (UTZFMT_PARSE_OPTION_NONE). + * To specify multipe options, use bitwise flags of UTimeZoneFormatParseOption. + * @see #UTimeZoneFormatParseOption + * @stable ICU 50 + */ + void setDefaultParseOptions(uint32_t flags); + + /** + * Returns the ISO 8601 basic time zone string for the given offset. + * For example, "-08", "-0830" and "Z" + * + * @param offset the offset from GMT(UTC) in milliseconds. + * @param useUtcIndicator true if ISO 8601 UTC indicator "Z" is used when the offset is 0. + * @param isShort true if shortest form is used. + * @param ignoreSeconds true if non-zero offset seconds is appended. + * @param result Receives the ISO format string. + * @param status Receives the status + * @return the ISO 8601 basic format. + * @see #formatOffsetISO8601Extended + * @see #parseOffsetISO8601 + * @stable ICU 51 + */ + UnicodeString& formatOffsetISO8601Basic(int32_t offset, UBool useUtcIndicator, UBool isShort, UBool ignoreSeconds, + UnicodeString& result, UErrorCode& status) const; + + /** + * Returns the ISO 8601 extended time zone string for the given offset. + * For example, "-08:00", "-08:30" and "Z" + * + * @param offset the offset from GMT(UTC) in milliseconds. + * @param useUtcIndicator true if ISO 8601 UTC indicator "Z" is used when the offset is 0. + * @param isShort true if shortest form is used. + * @param ignoreSeconds true if non-zero offset seconds is appended. + * @param result Receives the ISO format string. + * @param status Receives the status + * @return the ISO 8601 basic format. + * @see #formatOffsetISO8601Extended + * @see #parseOffsetISO8601 + * @stable ICU 51 + */ + UnicodeString& formatOffsetISO8601Extended(int32_t offset, UBool useUtcIndicator, UBool isShort, UBool ignoreSeconds, + UnicodeString& result, UErrorCode& status) const; + + /** + * Returns the localized GMT(UTC) offset format for the given offset. + * The localized GMT offset is defined by; + *

    + *
  • GMT format pattern (e.g. "GMT {0}" - see {@link #getGMTPattern}) + *
  • Offset time pattern (e.g. "+HH:mm" - see {@link #getGMTOffsetPattern}) + *
  • Offset digits (e.g. "0123456789" - see {@link #getGMTOffsetDigits}) + *
  • GMT zero format (e.g. "GMT" - see {@link #getGMTZeroFormat}) + *
+ * This format always uses 2 digit hours and minutes. When the given offset has non-zero + * seconds, 2 digit seconds field will be appended. For example, + * GMT+05:00 and GMT+05:28:06. + * @param offset the offset from GMT(UTC) in milliseconds. + * @param status Receives the status + * @param result Receives the localized GMT format string. + * @return A reference to the result. + * @see #parseOffsetLocalizedGMT + * @stable ICU 50 + */ + UnicodeString& formatOffsetLocalizedGMT(int32_t offset, UnicodeString& result, UErrorCode& status) const; + + /** + * Returns the short localized GMT(UTC) offset format for the given offset. + * The short localized GMT offset is defined by; + *
    + *
  • GMT format pattern (e.g. "GMT {0}" - see {@link #getGMTPattern}) + *
  • Offset time pattern (e.g. "+HH:mm" - see {@link #getGMTOffsetPattern}) + *
  • Offset digits (e.g. "0123456789" - see {@link #getGMTOffsetDigits}) + *
  • GMT zero format (e.g. "GMT" - see {@link #getGMTZeroFormat}) + *
+ * This format uses the shortest representation of offset. The hours field does not + * have leading zero and lower fields with zero will be truncated. For example, + * GMT+5 and GMT+530. + * @param offset the offset from GMT(UTC) in milliseconds. + * @param status Receives the status + * @param result Receives the short localized GMT format string. + * @return A reference to the result. + * @see #parseOffsetShortLocalizedGMT + * @stable ICU 51 + */ + UnicodeString& formatOffsetShortLocalizedGMT(int32_t offset, UnicodeString& result, UErrorCode& status) const; + + using Format::format; + + /** + * Returns the display name of the time zone at the given date for the style. + * @param style The style (e.g. UTZFMT_STYLE_GENERIC_LONG, UTZFMT_STYLE_LOCALIZED_GMT...) + * @param tz The time zone. + * @param date The date. + * @param name Receives the display name. + * @param timeType the output argument for receiving the time type (standard/daylight/unknown) + * used for the display name, or NULL if the information is not necessary. + * @return A reference to the result + * @see #UTimeZoneFormatStyle + * @see #UTimeZoneFormatTimeType + * @stable ICU 50 + */ + virtual UnicodeString& format(UTimeZoneFormatStyle style, const TimeZone& tz, UDate date, + UnicodeString& name, UTimeZoneFormatTimeType* timeType = NULL) const; + + /** + * Returns offset from GMT(UTC) in milliseconds for the given ISO 8601 + * style time zone string. When the given string is not an ISO 8601 time zone + * string, this method sets the current position as the error index + * to ParsePosition pos and returns 0. + * @param text The text contains ISO8601 style time zone string (e.g. "-08:00", "Z") + * at the position. + * @param pos The ParsePosition object. + * @return The offset from GMT(UTC) in milliseconds for the given ISO 8601 style + * time zone string. + * @see #formatOffsetISO8601Basic + * @see #formatOffsetISO8601Extended + * @stable ICU 50 + */ + int32_t parseOffsetISO8601(const UnicodeString& text, ParsePosition& pos) const; + + /** + * Returns offset from GMT(UTC) in milliseconds for the given localized GMT + * offset format string. When the given string cannot be parsed, this method + * sets the current position as the error index to ParsePosition pos + * and returns 0. + * @param text The text contains a localized GMT offset string at the position. + * @param pos The ParsePosition object. + * @return The offset from GMT(UTC) in milliseconds for the given localized GMT + * offset format string. + * @see #formatOffsetLocalizedGMT + * @stable ICU 50 + */ + int32_t parseOffsetLocalizedGMT(const UnicodeString& text, ParsePosition& pos) const; + + /** + * Returns offset from GMT(UTC) in milliseconds for the given short localized GMT + * offset format string. When the given string cannot be parsed, this method + * sets the current position as the error index to ParsePosition pos + * and returns 0. + * @param text The text contains a short localized GMT offset string at the position. + * @param pos The ParsePosition object. + * @return The offset from GMT(UTC) in milliseconds for the given short localized GMT + * offset format string. + * @see #formatOffsetShortLocalizedGMT + * @stable ICU 51 + */ + int32_t parseOffsetShortLocalizedGMT(const UnicodeString& text, ParsePosition& pos) const; + + /** + * Returns a TimeZone by parsing the time zone string according to + * the given parse position, the specified format style and parse options. + * + * @param text The text contains a time zone string at the position. + * @param style The format style + * @param pos The position. + * @param parseOptions The parse options repesented by bitwise flags of UTimeZoneFormatParseOption. + * @param timeType The output argument for receiving the time type (standard/daylight/unknown), + * or NULL if the information is not necessary. + * @return A TimeZone, or null if the input could not be parsed. + * @see UTimeZoneFormatStyle + * @see UTimeZoneFormatParseOption + * @see UTimeZoneFormatTimeType + * @stable ICU 50 + */ + virtual TimeZone* parse(UTimeZoneFormatStyle style, const UnicodeString& text, ParsePosition& pos, + int32_t parseOptions, UTimeZoneFormatTimeType* timeType = NULL) const; + + /** + * Returns a TimeZone by parsing the time zone string according to + * the given parse position, the specified format style and the default parse options. + * + * @param text The text contains a time zone string at the position. + * @param style The format style + * @param pos The position. + * @param timeType The output argument for receiving the time type (standard/daylight/unknown), + * or NULL if the information is not necessary. + * @return A TimeZone, or null if the input could not be parsed. + * @see UTimeZoneFormatStyle + * @see UTimeZoneFormatParseOption + * @see UTimeZoneFormatTimeType + * @stable ICU 50 + */ + TimeZone* parse(UTimeZoneFormatStyle style, const UnicodeString& text, ParsePosition& pos, + UTimeZoneFormatTimeType* timeType = NULL) const; + + /* ---------------------------------------------- + * Format APIs + * ---------------------------------------------- */ + + /** + * Format an object to produce a time zone display string using localized GMT offset format. + * This method handles Formattable objects with a TimeZone. If a the Formattable + * object type is not a TimeZone, then it returns a failing UErrorCode. + * @param obj The object to format. Must be a TimeZone. + * @param appendTo Output parameter to receive result. Result is appended to existing contents. + * @param pos On input: an alignment field, if desired. On output: the offsets of the alignment field. + * @param status Output param filled with success/failure status. + * @return Reference to 'appendTo' parameter. + * @stable ICU 50 + */ + virtual UnicodeString& format(const Formattable& obj, UnicodeString& appendTo, + FieldPosition& pos, UErrorCode& status) const; + + /** + * Parse a string to produce an object. This methods handles parsing of + * time zone display strings into Formattable objects with TimeZone. + * @param source The string to be parsed into an object. + * @param result Formattable to be set to the parse result. If parse fails, return contents are undefined. + * @param parse_pos The position to start parsing at. Upon return this param is set to the position after the + * last character successfully parsed. If the source is not parsed successfully, this param + * will remain unchanged. + * @return A newly created Formattable* object, or NULL on failure. The caller owns this and should + * delete it when done. + * @stable ICU 50 + */ + virtual void parseObject(const UnicodeString& source, Formattable& result, ParsePosition& parse_pos) const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * @stable ICU 50 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * @stable ICU 50 + */ + virtual UClassID getDynamicClassID() const; + +protected: + /** + * Constructs a TimeZoneFormat object for the specified locale. + * @param locale the locale + * @param status receives the status. + * @stable ICU 50 + */ + TimeZoneFormat(const Locale& locale, UErrorCode& status); + +private: + /* Locale of this object */ + Locale fLocale; + + /* Stores the region (could be implicit default) */ + char fTargetRegion[ULOC_COUNTRY_CAPACITY]; + + /* TimeZoneNames object used by this formatter */ + TimeZoneNames* fTimeZoneNames; + + /* TimeZoneGenericNames object used by this formatter - lazily instantiated */ + TimeZoneGenericNames* fTimeZoneGenericNames; + + /* Localized GMT format pattern - e.g. "GMT{0}" */ + UnicodeString fGMTPattern; + + /* Array of offset patterns used by Localized GMT format - e.g. "+HH:mm" */ + UnicodeString fGMTOffsetPatterns[UTZFMT_PAT_COUNT]; + + /* Localized decimal digits used by Localized GMT format */ + UChar32 fGMTOffsetDigits[10]; + + /* Localized GMT zero format - e.g. "GMT" */ + UnicodeString fGMTZeroFormat; + + /* Bit flags representing parse options */ + uint32_t fDefParseOptionFlags; + + /* Constant parts of GMT format pattern, populated from localized GMT format pattern*/ + UnicodeString fGMTPatternPrefix; /* Substring before {0} */ + UnicodeString fGMTPatternSuffix; /* Substring after {0} */ + + /* Compiled offset patterns generated from fGMTOffsetPatterns[] */ + UVector* fGMTOffsetPatternItems[UTZFMT_PAT_COUNT]; + + UBool fAbuttingOffsetHoursAndMinutes; + + /* TZDBTimeZoneNames object used for parsing */ + TZDBTimeZoneNames* fTZDBTimeZoneNames; + + /** + * Returns the time zone's specific format string. + * @param tz the time zone + * @param stdType the name type used for standard time + * @param dstType the name type used for daylight time + * @param date the date + * @param name receives the time zone's specific format name string + * @param timeType when null, actual time type is set + * @return a reference to name. + */ + UnicodeString& formatSpecific(const TimeZone& tz, UTimeZoneNameType stdType, UTimeZoneNameType dstType, + UDate date, UnicodeString& name, UTimeZoneFormatTimeType *timeType) const; + + /** + * Returns the time zone's generic format string. + * @param tz the time zone + * @param genType the generic name type + * @param date the date + * @param name receives the time zone's generic format name string + * @return a reference to name. + */ + UnicodeString& formatGeneric(const TimeZone& tz, int32_t genType, UDate date, UnicodeString& name) const; + + /** + * Lazily create a TimeZoneGenericNames instance + * @param status receives the status + * @return the cached TimeZoneGenericNames. + */ + const TimeZoneGenericNames* getTimeZoneGenericNames(UErrorCode& status) const; + + /** + * Lazily create a TZDBTimeZoneNames instance + * @param status receives the status + * @return the cached TZDBTimeZoneNames. + */ + const TZDBTimeZoneNames* getTZDBTimeZoneNames(UErrorCode& status) const; + + /** + * Private method returning the time zone's exemplar location string. + * This method will never return empty. + * @param tz the time zone + * @param name receives the time zone's exemplar location name + * @return a reference to name. + */ + UnicodeString& formatExemplarLocation(const TimeZone& tz, UnicodeString& name) const; + + /** + * Private enum specifying a combination of offset fields + */ + enum OffsetFields { + FIELDS_H, + FIELDS_HM, + FIELDS_HMS + }; + + /** + * Parses the localized GMT pattern string and initialize + * localized gmt pattern fields. + * @param gmtPattern the localized GMT pattern string such as "GMT {0}" + * @param status U_ILLEGAL_ARGUMENT_ERROR is set when the specified pattern does not + * contain an argument "{0}". + */ + void initGMTPattern(const UnicodeString& gmtPattern, UErrorCode& status); + + /** + * Parse the GMT offset pattern into runtime optimized format. + * @param pattern the offset pattern string + * @param required the required set of fields, such as FIELDS_HM + * @param status U_ILLEGAL_ARGUMENT is set when the specified pattern does not contain + * pattern letters for the required fields. + * @return A list of GMTOffsetField objects, or NULL on error. + */ + static UVector* parseOffsetPattern(const UnicodeString& pattern, OffsetFields required, UErrorCode& status); + + /** + * Appends seconds field to the offset pattern with hour/minute + * Note: This code will be obsoleted once we add hour-minute-second pattern data in CLDR. + * @param offsetHM the offset pattern including hours and minutes fields + * @param result the output offset pattern including hour, minute and seconds fields + * @param status receives the status + * @return a reference to result + */ + static UnicodeString& expandOffsetPattern(const UnicodeString& offsetHM, UnicodeString& result, UErrorCode& status); + + /** + * Truncates minutes field to the offset pattern with hour/minute + * Note: This code will be obsoleted once we add hour pattern data in CLDR. + * @param offsetHM the offset pattern including hours and minutes fields + * @param result the output offset pattern including only hours field + * @param status receives the status + * @return a reference to result + */ + static UnicodeString& truncateOffsetPattern(const UnicodeString& offsetHM, UnicodeString& result, UErrorCode& status); + + /** + * Break input string into UChar32[]. Each array element represents + * a code point. This method is used for parsing localized digit + * characters and support characters in Unicode supplemental planes. + * @param str the string + * @param codeArray receives the result + * @param capacity the capacity of codeArray + * @return TRUE when the specified code array is fully filled with code points + * (no under/overflow). + */ + static UBool toCodePoints(const UnicodeString& str, UChar32* codeArray, int32_t capacity); + + /** + * Private method supprting all of ISO8601 formats + * @param offset the offset from GMT(UTC) in milliseconds. + * @param useUtcIndicator true if ISO 8601 UTC indicator "Z" is used when the offset is 0. + * @param isShort true if shortest form is used. + * @param ignoreSeconds true if non-zero offset seconds is appended. + * @param result Receives the result + * @param status Receives the status + * @return the ISO 8601 basic format. + */ + UnicodeString& formatOffsetISO8601(int32_t offset, UBool isBasic, UBool useUtcIndicator, + UBool isShort, UBool ignoreSeconds, UnicodeString& result, UErrorCode& status) const; + + /** + * Private method used for localized GMT formatting. + * @param offset the zone's UTC offset + * @param isShort true if the short localized GMT format is desired. + * @param result receives the localized GMT format string + * @param status receives the status + */ + UnicodeString& formatOffsetLocalizedGMT(int32_t offset, UBool isShort, UnicodeString& result, UErrorCode& status) const; + + /** + * Returns offset from GMT(UTC) in milliseconds for the given ISO 8601 style + * (extended format) time zone string. When the given string is not an ISO 8601 time + * zone string, this method sets the current position as the error index + * to ParsePosition pos and returns 0. + * @param text the text contains ISO 8601 style time zone string (e.g. "-08:00", "Z") + * at the position. + * @param pos the position, non-negative error index will be set on failure. + * @param extendedOnly TRUE if parsing the text as ISO 8601 extended offset format (e.g. "-08:00"), + * or FALSE to evaluate the text as basic format. + * @param hasDigitOffset receiving if the parsed zone string contains offset digits. + * @return the offset from GMT(UTC) in milliseconds for the given ISO 8601 style + * time zone string. + */ + int32_t parseOffsetISO8601(const UnicodeString& text, ParsePosition& pos, UBool extendedOnly, + UBool* hasDigitOffset = NULL) const; + + /** + * Appends localized digits to the buffer. + * This code assumes that the input number is 0 - 59 + * @param buf the target buffer + * @param n the integer number + * @param minDigits the minimum digits width + */ + void appendOffsetDigits(UnicodeString& buf, int32_t n, uint8_t minDigits) const; + + /** + * Returns offset from GMT(UTC) in milliseconds for the given localized GMT + * offset format string. When the given string cannot be parsed, this method + * sets the current position as the error index to ParsePosition pos + * and returns 0. + * @param text the text contains a localized GMT offset string at the position. + * @param pos the position, non-negative error index will be set on failure. + * @param isShort true if this parser to try the short format first + * @param hasDigitOffset receiving if the parsed zone string contains offset digits. + * @return the offset from GMT(UTC) in milliseconds for the given localized GMT + * offset format string. + */ + int32_t parseOffsetLocalizedGMT(const UnicodeString& text, ParsePosition& pos, + UBool isShort, UBool* hasDigitOffset) const; + + /** + * Parse localized GMT format generated by the patter used by this formatter, except + * GMT Zero format. + * @param text the input text + * @param start the start index + * @param isShort true if the short localized format is parsed. + * @param parsedLen receives the parsed length + * @return the parsed offset in milliseconds + */ + int32_t parseOffsetLocalizedGMTPattern(const UnicodeString& text, int32_t start, + UBool isShort, int32_t& parsedLen) const; + + /** + * Parses localized GMT offset fields into offset. + * @param text the input text + * @param start the start index + * @param isShort true if this is a short format - currently not used + * @param parsedLen the parsed length, or 0 on failure. + * @return the parsed offset in milliseconds. + */ + int32_t parseOffsetFields(const UnicodeString& text, int32_t start, UBool isShort, int32_t& parsedLen) const; + + /** + * Parse localized GMT offset fields with the given pattern. + * @param text the input text + * @param start the start index + * @param pattenItems the pattern (already itemized) + * @param forceSingleHourDigit true if hours field is parsed as a single digit + * @param hour receives the hour offset field + * @param min receives the minute offset field + * @param sec receives the second offset field + * @return the parsed length + */ + int32_t parseOffsetFieldsWithPattern(const UnicodeString& text, int32_t start, + UVector* patternItems, UBool forceSingleHourDigit, int32_t& hour, int32_t& min, int32_t& sec) const; + + /** + * Parses abutting localized GMT offset fields (such as 0800) into offset. + * @param text the input text + * @param start the start index + * @param parsedLen the parsed length, or 0 on failure + * @return the parsed offset in milliseconds. + */ + int32_t parseAbuttingOffsetFields(const UnicodeString& text, int32_t start, int32_t& parsedLen) const; + + /** + * Parses the input text using the default format patterns (e.g. "UTC{0}"). + * @param text the input text + * @param start the start index + * @param parsedLen the parsed length, or 0 on failure + * @return the parsed offset in milliseconds. + */ + int32_t parseOffsetDefaultLocalizedGMT(const UnicodeString& text, int start, int32_t& parsedLen) const; + + /** + * Parses the input GMT offset fields with the default offset pattern. + * @param text the input text + * @param start the start index + * @param separator the separator character, e.g. ':' + * @param parsedLen the parsed length, or 0 on failure. + * @return the parsed offset in milliseconds. + */ + int32_t parseDefaultOffsetFields(const UnicodeString& text, int32_t start, char16_t separator, + int32_t& parsedLen) const; + + /** + * Reads an offset field value. This method will stop parsing when + * 1) number of digits reaches maxDigits + * 2) just before already parsed number exceeds maxVal + * + * @param text the text + * @param start the start offset + * @param minDigits the minimum number of required digits + * @param maxDigits the maximum number of digits + * @param minVal the minimum value + * @param maxVal the maximum value + * @param parsedLen the actual parsed length. + * @return the integer value parsed + */ + int32_t parseOffsetFieldWithLocalizedDigits(const UnicodeString& text, int32_t start, + uint8_t minDigits, uint8_t maxDigits, uint16_t minVal, uint16_t maxVal, int32_t& parsedLen) const; + + /** + * Reads a single decimal digit, either localized digits used by this object + * or any Unicode numeric character. + * @param text the text + * @param start the start index + * @param len the actual length read from the text + * the start index is not a decimal number. + * @return the integer value of the parsed digit, or -1 on failure. + */ + int32_t parseSingleLocalizedDigit(const UnicodeString& text, int32_t start, int32_t& len) const; + + /** + * Formats offset using ASCII digits. The input offset range must be + * within +/-24 hours (exclusive). + * @param offset The offset + * @param sep The field separator character or 0 if not required + * @param minFields The minimum fields + * @param maxFields The maximum fields + * @return The offset string + */ + static UnicodeString& formatOffsetWithAsciiDigits(int32_t offset, char16_t sep, + OffsetFields minFields, OffsetFields maxFields, UnicodeString& result); + + /** + * Parses offset represented by contiguous ASCII digits. + *

+ * Note: This method expects the input position is already at the start of + * ASCII digits and does not parse sign (+/-). + * @param text The text contains a sequence of ASCII digits + * @param pos The parse position + * @param minFields The minimum Fields to be parsed + * @param maxFields The maximum Fields to be parsed + * @param fixedHourWidth true if hours field must be width of 2 + * @return Parsed offset, 0 or positive number. + */ + static int32_t parseAbuttingAsciiOffsetFields(const UnicodeString& text, ParsePosition& pos, + OffsetFields minFields, OffsetFields maxFields, UBool fixedHourWidth); + + /** + * Parses offset represented by ASCII digits and separators. + *

+ * Note: This method expects the input position is already at the start of + * ASCII digits and does not parse sign (+/-). + * @param text The text + * @param pos The parse position + * @param sep The separator character + * @param minFields The minimum Fields to be parsed + * @param maxFields The maximum Fields to be parsed + * @return Parsed offset, 0 or positive number. + */ + static int32_t parseAsciiOffsetFields(const UnicodeString& text, ParsePosition& pos, char16_t sep, + OffsetFields minFields, OffsetFields maxFields); + + /** + * Unquotes the message format style pattern. + * @param pattern the pattern + * @param result receive the unquoted pattern. + * @return A reference to result. + */ + static UnicodeString& unquote(const UnicodeString& pattern, UnicodeString& result); + + /** + * Initialize localized GMT format offset hour/min/sec patterns. + * This method parses patterns into optimized run-time format. + * @param status receives the status. + */ + void initGMTOffsetPatterns(UErrorCode& status); + + /** + * Check if there are any GMT format offset patterns without + * any separators between hours field and minutes field and update + * fAbuttingOffsetHoursAndMinutes field. This method must be called + * after all patterns are parsed into pattern items. + */ + void checkAbuttingHoursAndMinutes(); + + /** + * Creates an instance of TimeZone for the given offset + * @param offset the offset + * @return A TimeZone with the given offset + */ + TimeZone* createTimeZoneForOffset(int32_t offset) const; + + /** + * Returns the time type for the given name type + * @param nameType the name type + * @return the time type (unknown/standard/daylight) + */ + static UTimeZoneFormatTimeType getTimeType(UTimeZoneNameType nameType); + + /** + * Returns the time zone ID of a match at the specified index within + * the MatchInfoCollection. + * @param matches the collection of matches + * @param idx the index withing matches + * @param tzID receives the resolved time zone ID + * @return a reference to tzID. + */ + UnicodeString& getTimeZoneID(const TimeZoneNames::MatchInfoCollection* matches, int32_t idx, UnicodeString& tzID) const; + + + /** + * Parse a zone ID. + * @param text the text contains a time zone ID string at the position. + * @param pos the position + * @param tzID receives the zone ID + * @return a reference to tzID + */ + UnicodeString& parseZoneID(const UnicodeString& text, ParsePosition& pos, UnicodeString& tzID) const; + + /** + * Parse a short zone ID. + * @param text the text contains a short time zone ID string at the position. + * @param pos the position + * @param tzID receives the short zone ID + * @return a reference to tzID + */ + UnicodeString& parseShortZoneID(const UnicodeString& text, ParsePosition& pos, UnicodeString& tzID) const; + + /** + * Parse an exemplar location string. + * @param text the text contains an exemplar location string at the position. + * @param pos the position. + * @param tzID receives the time zone ID + * @return a reference to tzID + */ + UnicodeString& parseExemplarLocation(const UnicodeString& text, ParsePosition& pos, UnicodeString& tzID) const; +}; + +U_NAMESPACE_END + +#endif /* !UCONFIG_NO_FORMATTING */ +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/tznames.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/tznames.h new file mode 100644 index 0000000..399265d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/tznames.h @@ -0,0 +1,414 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2011-2016, International Business Machines Corporation and +* others. All Rights Reserved. +******************************************************************************* +*/ +#ifndef __TZNAMES_H +#define __TZNAMES_H + +/** + * \file + * \brief C++ API: TimeZoneNames + */ +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/uloc.h" +#include "unicode/unistr.h" + +U_CDECL_BEGIN + +/** + * Constants for time zone display name types. + * @stable ICU 50 + */ +typedef enum UTimeZoneNameType { + /** + * Unknown display name type. + * @stable ICU 50 + */ + UTZNM_UNKNOWN = 0x00, + /** + * Long display name, such as "Eastern Time". + * @stable ICU 50 + */ + UTZNM_LONG_GENERIC = 0x01, + /** + * Long display name for standard time, such as "Eastern Standard Time". + * @stable ICU 50 + */ + UTZNM_LONG_STANDARD = 0x02, + /** + * Long display name for daylight saving time, such as "Eastern Daylight Time". + * @stable ICU 50 + */ + UTZNM_LONG_DAYLIGHT = 0x04, + /** + * Short display name, such as "ET". + * @stable ICU 50 + */ + UTZNM_SHORT_GENERIC = 0x08, + /** + * Short display name for standard time, such as "EST". + * @stable ICU 50 + */ + UTZNM_SHORT_STANDARD = 0x10, + /** + * Short display name for daylight saving time, such as "EDT". + * @stable ICU 50 + */ + UTZNM_SHORT_DAYLIGHT = 0x20, + /** + * Exemplar location name, such as "Los Angeles". + * @stable ICU 51 + */ + UTZNM_EXEMPLAR_LOCATION = 0x40 +} UTimeZoneNameType; + +U_CDECL_END + +U_NAMESPACE_BEGIN + +class UVector; +struct MatchInfo; + +/** + * TimeZoneNames is an abstract class representing the time zone display name data model defined + * by UTS#35 Unicode Locale Data Markup Language (LDML). + * The model defines meta zone, which is used for storing a set of display names. A meta zone can be shared + * by multiple time zones. Also a time zone may have multiple meta zone historic mappings. + *

+ * For example, people in the United States refer the zone used by the east part of North America as "Eastern Time". + * The tz database contains multiple time zones "America/New_York", "America/Detroit", "America/Montreal" and some + * others that belong to "Eastern Time". However, assigning different display names to these time zones does not make + * much sense for most of people. + *

+ * In CLDR (which uses LDML for representing locale data), the display name + * "Eastern Time" is stored as long generic display name of a meta zone identified by the ID "America_Eastern". + * Then, there is another table maintaining the historic mapping to meta zones for each time zone. The time zones in + * the above example ("America/New_York", "America/Detroit"...) are mapped to the meta zone "America_Eastern". + *

+ * Sometimes, a time zone is mapped to a different time zone in the past. For example, "America/Indiana/Knox" + * had been moving "Eastern Time" and "Central Time" back and forth. Therefore, it is necessary that time zone + * to meta zones mapping data are stored by date range. + * + *

Note: + * The methods in this class assume that time zone IDs are already canonicalized. For example, you may not get proper + * result returned by a method with time zone ID "America/Indiana/Indianapolis", because it's not a canonical time zone + * ID (the canonical time zone ID for the time zone is "America/Indianapolis". See + * {@link TimeZone#getCanonicalID(const UnicodeString& id, UnicodeString& canonicalID, UErrorCode& status)} about ICU + * canonical time zone IDs. + * + *

+ * In CLDR, most of time zone display names except location names are provided through meta zones. But a time zone may + * have a specific name that is not shared with other time zones. + * + * For example, time zone "Europe/London" has English long name for standard time "Greenwich Mean Time", which is also + * shared with other time zones. However, the long name for daylight saving time is "British Summer Time", which is only + * used for "Europe/London". + * + *

+ * {@link #getTimeZoneDisplayName} is designed for accessing a name only used by a single time zone. + * But is not necessarily mean that a subclass implementation use the same model with CLDR. A subclass implementation + * may provide time zone names only through {@link #getTimeZoneDisplayName}, or only through {@link #getMetaZoneDisplayName}, + * or both. + * + *

+ * The default TimeZoneNames implementation returned by {@link #createInstance} + * uses the locale data imported from CLDR. In CLDR, set of meta zone IDs and mappings between zone IDs and meta zone + * IDs are shared by all locales. Therefore, the behavior of {@link #getAvailableMetaZoneIDs}, + * {@link #getMetaZoneID}, and {@link #getReferenceZoneID} won't be changed no matter + * what locale is used for getting an instance of TimeZoneNames. + * + * @stable ICU 50 + */ +class U_I18N_API TimeZoneNames : public UObject { +public: + /** + * Destructor. + * @stable ICU 50 + */ + virtual ~TimeZoneNames(); + + /** + * Return true if the given TimeZoneNames objects are semantically equal. + * @param other the object to be compared with. + * @return Return TRUE if the given Format objects are semantically equal. + * @stable ICU 50 + */ + virtual UBool operator==(const TimeZoneNames& other) const = 0; + + /** + * Return true if the given TimeZoneNames objects are not semantically + * equal. + * @param other the object to be compared with. + * @return Return TRUE if the given Format objects are not semantically equal. + * @stable ICU 50 + */ + UBool operator!=(const TimeZoneNames& other) const { return !operator==(other); } + + /** + * Clone this object polymorphically. The caller is responsible + * for deleting the result when done. + * @return A copy of the object + * @stable ICU 50 + */ + virtual TimeZoneNames* clone() const = 0; + + /** + * Returns an instance of TimeZoneNames for the specified locale. + * + * @param locale The locale. + * @param status Receives the status. + * @return An instance of TimeZoneNames + * @stable ICU 50 + */ + static TimeZoneNames* U_EXPORT2 createInstance(const Locale& locale, UErrorCode& status); + + /** + * Returns an instance of TimeZoneNames containing only short specific + * zone names (SHORT_STANDARD and SHORT_DAYLIGHT), + * compatible with the IANA tz database's zone abbreviations (not localized). + *
+ * Note: The input locale is used for resolving ambiguous names (e.g. "IST" is parsed + * as Israel Standard Time for Israel, while it is parsed as India Standard Time for + * all other regions). The zone names returned by this instance are not localized. + * @stable ICU 54 + */ + static TimeZoneNames* U_EXPORT2 createTZDBInstance(const Locale& locale, UErrorCode& status); + + /** + * Returns an enumeration of all available meta zone IDs. + * @param status Receives the status. + * @return an enumeration object, owned by the caller. + * @stable ICU 50 + */ + virtual StringEnumeration* getAvailableMetaZoneIDs(UErrorCode& status) const = 0; + + /** + * Returns an enumeration of all available meta zone IDs used by the given time zone. + * @param tzID The canoical tiem zone ID. + * @param status Receives the status. + * @return an enumeration object, owned by the caller. + * @stable ICU 50 + */ + virtual StringEnumeration* getAvailableMetaZoneIDs(const UnicodeString& tzID, UErrorCode& status) const = 0; + + /** + * Returns the meta zone ID for the given canonical time zone ID at the given date. + * @param tzID The canonical time zone ID. + * @param date The date. + * @param mzID Receives the meta zone ID for the given time zone ID at the given date. If the time zone does not have a + * corresponding meta zone at the given date or the implementation does not support meta zones, "bogus" state + * is set. + * @return A reference to the result. + * @stable ICU 50 + */ + virtual UnicodeString& getMetaZoneID(const UnicodeString& tzID, UDate date, UnicodeString& mzID) const = 0; + + /** + * Returns the reference zone ID for the given meta zone ID for the region. + * + * Note: Each meta zone must have a reference zone associated with a special region "001" (world). + * Some meta zones may have region specific reference zone IDs other than the special region + * "001". When a meta zone does not have any region specific reference zone IDs, this method + * return the reference zone ID for the special region "001" (world). + * + * @param mzID The meta zone ID. + * @param region The region. + * @param tzID Receives the reference zone ID ("golden zone" in the LDML specification) for the given time zone ID for the + * region. If the meta zone is unknown or the implementation does not support meta zones, "bogus" state + * is set. + * @return A reference to the result. + * @stable ICU 50 + */ + virtual UnicodeString& getReferenceZoneID(const UnicodeString& mzID, const char* region, UnicodeString& tzID) const = 0; + + /** + * Returns the display name of the meta zone. + * @param mzID The meta zone ID. + * @param type The display name type. See {@link #UTimeZoneNameType}. + * @param name Receives the display name of the meta zone. When this object does not have a localized display name for the given + * meta zone with the specified type or the implementation does not provide any display names associated + * with meta zones, "bogus" state is set. + * @return A reference to the result. + * @stable ICU 50 + */ + virtual UnicodeString& getMetaZoneDisplayName(const UnicodeString& mzID, UTimeZoneNameType type, UnicodeString& name) const = 0; + + /** + * Returns the display name of the time zone. Unlike {@link #getDisplayName}, + * this method does not get a name from a meta zone used by the time zone. + * @param tzID The canonical time zone ID. + * @param type The display name type. See {@link #UTimeZoneNameType}. + * @param name Receives the display name for the time zone. When this object does not have a localized display name for the given + * time zone with the specified type, "bogus" state is set. + * @return A reference to the result. + * @stable ICU 50 + */ + virtual UnicodeString& getTimeZoneDisplayName(const UnicodeString& tzID, UTimeZoneNameType type, UnicodeString& name) const = 0; + + /** + * Returns the exemplar location name for the given time zone. When this object does not have a localized location + * name, the default implementation may still returns a programmatically generated name with the logic described + * below. + *

    + *
  1. Check if the ID contains "/". If not, return null. + *
  2. Check if the ID does not start with "Etc/" or "SystemV/". If it does, return null. + *
  3. Extract a substring after the last occurrence of "/". + *
  4. Replace "_" with " ". + *
+ * For example, "New York" is returned for the time zone ID "America/New_York" when this object does not have the + * localized location name. + * + * @param tzID The canonical time zone ID + * @param name Receives the exemplar location name for the given time zone, or "bogus" state is set when a localized + * location name is not available and the fallback logic described above cannot extract location from the ID. + * @return A reference to the result. + * @stable ICU 50 + */ + virtual UnicodeString& getExemplarLocationName(const UnicodeString& tzID, UnicodeString& name) const; + + /** + * Returns the display name of the time zone at the given date. + *

+ * Note: This method calls the subclass's {@link #getTimeZoneDisplayName} first. When the + * result is bogus, this method calls {@link #getMetaZoneID} to get the meta zone ID mapped from the + * time zone, then calls {@link #getMetaZoneDisplayName}. + * + * @param tzID The canonical time zone ID. + * @param type The display name type. See {@link #UTimeZoneNameType}. + * @param date The date. + * @param name Receives the display name for the time zone at the given date. When this object does not have a localized display + * name for the time zone with the specified type and date, "bogus" state is set. + * @return A reference to the result. + * @stable ICU 50 + */ + virtual UnicodeString& getDisplayName(const UnicodeString& tzID, UTimeZoneNameType type, UDate date, UnicodeString& name) const; + + /** + * @internal ICU internal only, for specific users only until proposed publicly. + */ + virtual void loadAllDisplayNames(UErrorCode& status); + + /** + * @internal ICU internal only, for specific users only until proposed publicly. + */ + virtual void getDisplayNames(const UnicodeString& tzID, const UTimeZoneNameType types[], int32_t numTypes, UDate date, UnicodeString dest[], UErrorCode& status) const; + + /** + * MatchInfoCollection represents a collection of time zone name matches used by + * {@link TimeZoneNames#find}. + * @internal + */ + class U_I18N_API MatchInfoCollection : public UMemory { + public: + /** + * Constructor. + * @internal + */ + MatchInfoCollection(); + /** + * Destructor. + * @internal + */ + virtual ~MatchInfoCollection(); + +#ifndef U_HIDE_INTERNAL_API + /** + * Adds a zone match. + * @param nameType The name type. + * @param matchLength The match length. + * @param tzID The time zone ID. + * @param status Receives the status + * @internal + */ + void addZone(UTimeZoneNameType nameType, int32_t matchLength, + const UnicodeString& tzID, UErrorCode& status); + + /** + * Adds a meata zone match. + * @param nameType The name type. + * @param matchLength The match length. + * @param mzID The metazone ID. + * @param status Receives the status + * @internal + */ + void addMetaZone(UTimeZoneNameType nameType, int32_t matchLength, + const UnicodeString& mzID, UErrorCode& status); + + /** + * Returns the number of entries available in this object. + * @return The number of entries. + * @internal + */ + int32_t size() const; + + /** + * Returns the time zone name type of a match at the specified index. + * @param idx The index + * @return The time zone name type. If the specified idx is out of range, + * it returns UTZNM_UNKNOWN. + * @see UTimeZoneNameType + * @internal + */ + UTimeZoneNameType getNameTypeAt(int32_t idx) const; + + /** + * Returns the match length of a match at the specified index. + * @param idx The index + * @return The match length. If the specified idx is out of range, + * it returns 0. + * @internal + */ + int32_t getMatchLengthAt(int32_t idx) const; + + /** + * Gets the zone ID of a match at the specified index. + * @param idx The index + * @param tzID Receives the zone ID. + * @return TRUE if the zone ID was set to tzID. + * @internal + */ + UBool getTimeZoneIDAt(int32_t idx, UnicodeString& tzID) const; + + /** + * Gets the metazone ID of a match at the specified index. + * @param idx The index + * @param mzID Receives the metazone ID + * @return TRUE if the meta zone ID was set to mzID. + * @internal + */ + UBool getMetaZoneIDAt(int32_t idx, UnicodeString& mzID) const; +#endif /* U_HIDE_INTERNAL_API */ + + private: + UVector* fMatches; // vector of MatchEntry + + UVector* matches(UErrorCode& status); + }; + + /** + * Finds time zone name prefix matches for the input text at the + * given offset and returns a collection of the matches. + * @param text The text. + * @param start The starting offset within the text. + * @param types The set of name types represented by bitwise flags of UTimeZoneNameType enums, + * or UTZNM_UNKNOWN for all name types. + * @param status Receives the status. + * @return A collection of matches (owned by the caller), or NULL if no matches are found. + * @see UTimeZoneNameType + * @see MatchInfoCollection + * @internal + */ + virtual MatchInfoCollection* find(const UnicodeString& text, int32_t start, uint32_t types, UErrorCode& status) const = 0; +}; + +U_NAMESPACE_END + +#endif +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/tzrule.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/tzrule.h new file mode 100644 index 0000000..1647fda --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/tzrule.h @@ -0,0 +1,830 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2007-2008, International Business Machines Corporation and * +* others. All Rights Reserved. * +******************************************************************************* +*/ +#ifndef TZRULE_H +#define TZRULE_H + +/** + * \file + * \brief C++ API: Time zone rule classes + */ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/uobject.h" +#include "unicode/unistr.h" +#include "unicode/dtrule.h" + +U_NAMESPACE_BEGIN + +/** + * TimeZoneRule is a class representing a rule for time zone. + * TimeZoneRule has a set of time zone attributes, such as zone name, + * raw offset (UTC offset for standard time) and daylight saving time offset. + * + * @stable ICU 3.8 + */ +class U_I18N_API TimeZoneRule : public UObject { +public: + /** + * Destructor. + * @stable ICU 3.8 + */ + virtual ~TimeZoneRule(); + + /** + * Clone this TimeZoneRule object polymorphically. The caller owns the result and + * should delete it when done. + * @return A copy of the object. + * @stable ICU 3.8 + */ + virtual TimeZoneRule* clone(void) const = 0; + + /** + * Return true if the given TimeZoneRule objects are semantically equal. Objects + * of different subclasses are considered unequal. + * @param that The object to be compared with. + * @return true if the given TimeZoneRule objects are semantically equal. + * @stable ICU 3.8 + */ + virtual UBool operator==(const TimeZoneRule& that) const; + + /** + * Return true if the given TimeZoneRule objects are semantically unequal. Objects + * of different subclasses are considered unequal. + * @param that The object to be compared with. + * @return true if the given TimeZoneRule objects are semantically unequal. + * @stable ICU 3.8 + */ + virtual UBool operator!=(const TimeZoneRule& that) const; + + /** + * Fills in "name" with the name of this time zone. + * @param name Receives the name of this time zone. + * @return A reference to "name" + * @stable ICU 3.8 + */ + UnicodeString& getName(UnicodeString& name) const; + + /** + * Gets the standard time offset. + * @return The standard time offset from UTC in milliseconds. + * @stable ICU 3.8 + */ + int32_t getRawOffset(void) const; + + /** + * Gets the amount of daylight saving delta time from the standard time. + * @return The amount of daylight saving offset used by this rule + * in milliseconds. + * @stable ICU 3.8 + */ + int32_t getDSTSavings(void) const; + + /** + * Returns if this rule represents the same rule and offsets as another. + * When two TimeZoneRule objects differ only its names, this method + * returns true. + * @param other The TimeZoneRule object to be compared with. + * @return true if the other TimeZoneRule is the same as this one. + * @stable ICU 3.8 + */ + virtual UBool isEquivalentTo(const TimeZoneRule& other) const; + + /** + * Gets the very first time when this rule takes effect. + * @param prevRawOffset The standard time offset from UTC before this rule + * takes effect in milliseconds. + * @param prevDSTSavings The amount of daylight saving offset from the + * standard time. + * @param result Receives the very first time when this rule takes effect. + * @return true if the start time is available. When false is returned, output parameter + * "result" is unchanged. + * @stable ICU 3.8 + */ + virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const = 0; + + /** + * Gets the final time when this rule takes effect. + * @param prevRawOffset The standard time offset from UTC before this rule + * takes effect in milliseconds. + * @param prevDSTSavings The amount of daylight saving offset from the + * standard time. + * @param result Receives the final time when this rule takes effect. + * @return true if the start time is available. When false is returned, output parameter + * "result" is unchanged. + * @stable ICU 3.8 + */ + virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const = 0; + + /** + * Gets the first time when this rule takes effect after the specified time. + * @param base The first start time after this base time will be returned. + * @param prevRawOffset The standard time offset from UTC before this rule + * takes effect in milliseconds. + * @param prevDSTSavings The amount of daylight saving offset from the + * standard time. + * @param inclusive Whether the base time is inclusive or not. + * @param result Receives The first time when this rule takes effect after + * the specified base time. + * @return true if the start time is available. When false is returned, output parameter + * "result" is unchanged. + * @stable ICU 3.8 + */ + virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings, + UBool inclusive, UDate& result) const = 0; + + /** + * Gets the most recent time when this rule takes effect before the specified time. + * @param base The most recent time before this base time will be returned. + * @param prevRawOffset The standard time offset from UTC before this rule + * takes effect in milliseconds. + * @param prevDSTSavings The amount of daylight saving offset from the + * standard time. + * @param inclusive Whether the base time is inclusive or not. + * @param result Receives The most recent time when this rule takes effect before + * the specified base time. + * @return true if the start time is available. When false is returned, output parameter + * "result" is unchanged. + * @stable ICU 3.8 + */ + virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings, + UBool inclusive, UDate& result) const = 0; + +protected: + + /** + * Constructs a TimeZoneRule with the name, the GMT offset of its + * standard time and the amount of daylight saving offset adjustment. + * @param name The time zone name. + * @param rawOffset The UTC offset of its standard time in milliseconds. + * @param dstSavings The amount of daylight saving offset adjustment in milliseconds. + * If this ia a rule for standard time, the value of this argument is 0. + * @stable ICU 3.8 + */ + TimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings); + + /** + * Copy constructor. + * @param source The TimeZoneRule object to be copied. + * @stable ICU 3.8 + */ + TimeZoneRule(const TimeZoneRule& source); + + /** + * Assignment operator. + * @param right The object to be copied. + * @stable ICU 3.8 + */ + TimeZoneRule& operator=(const TimeZoneRule& right); + +private: + UnicodeString fName; // time name + int32_t fRawOffset; // UTC offset of the standard time in milliseconds + int32_t fDSTSavings; // DST saving amount in milliseconds +}; + +/** + * InitialTimeZoneRule represents a time zone rule + * representing a time zone effective from the beginning and + * has no actual start times. + * @stable ICU 3.8 + */ +class U_I18N_API InitialTimeZoneRule : public TimeZoneRule { +public: + /** + * Constructs an InitialTimeZoneRule with the name, the GMT offset of its + * standard time and the amount of daylight saving offset adjustment. + * @param name The time zone name. + * @param rawOffset The UTC offset of its standard time in milliseconds. + * @param dstSavings The amount of daylight saving offset adjustment in milliseconds. + * If this ia a rule for standard time, the value of this argument is 0. + * @stable ICU 3.8 + */ + InitialTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings); + + /** + * Copy constructor. + * @param source The InitialTimeZoneRule object to be copied. + * @stable ICU 3.8 + */ + InitialTimeZoneRule(const InitialTimeZoneRule& source); + + /** + * Destructor. + * @stable ICU 3.8 + */ + virtual ~InitialTimeZoneRule(); + + /** + * Clone this InitialTimeZoneRule object polymorphically. The caller owns the result and + * should delete it when done. + * @return A copy of the object. + * @stable ICU 3.8 + */ + virtual InitialTimeZoneRule* clone(void) const; + + /** + * Assignment operator. + * @param right The object to be copied. + * @stable ICU 3.8 + */ + InitialTimeZoneRule& operator=(const InitialTimeZoneRule& right); + + /** + * Return true if the given TimeZoneRule objects are semantically equal. Objects + * of different subclasses are considered unequal. + * @param that The object to be compared with. + * @return true if the given TimeZoneRule objects are semantically equal. + * @stable ICU 3.8 + */ + virtual UBool operator==(const TimeZoneRule& that) const; + + /** + * Return true if the given TimeZoneRule objects are semantically unequal. Objects + * of different subclasses are considered unequal. + * @param that The object to be compared with. + * @return true if the given TimeZoneRule objects are semantically unequal. + * @stable ICU 3.8 + */ + virtual UBool operator!=(const TimeZoneRule& that) const; + + /** + * Gets the time when this rule takes effect in the given year. + * @param year The Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc. + * @param prevRawOffset The standard time offset from UTC before this rule + * takes effect in milliseconds. + * @param prevDSTSavings The amount of daylight saving offset from the + * standard time. + * @param result Receives the start time in the year. + * @return true if this rule takes effect in the year and the result is set to + * "result". + * @stable ICU 3.8 + */ + UBool getStartInYear(int32_t year, int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const; + + /** + * Returns if this rule represents the same rule and offsets as another. + * When two TimeZoneRule objects differ only its names, this method + * returns true. + * @param that The TimeZoneRule object to be compared with. + * @return true if the other TimeZoneRule is equivalent to this one. + * @stable ICU 3.8 + */ + virtual UBool isEquivalentTo(const TimeZoneRule& that) const; + + /** + * Gets the very first time when this rule takes effect. + * @param prevRawOffset The standard time offset from UTC before this rule + * takes effect in milliseconds. + * @param prevDSTSavings The amount of daylight saving offset from the + * standard time. + * @param result Receives the very first time when this rule takes effect. + * @return true if the start time is available. When false is returned, output parameter + * "result" is unchanged. + * @stable ICU 3.8 + */ + virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const; + + /** + * Gets the final time when this rule takes effect. + * @param prevRawOffset The standard time offset from UTC before this rule + * takes effect in milliseconds. + * @param prevDSTSavings The amount of daylight saving offset from the + * standard time. + * @param result Receives the final time when this rule takes effect. + * @return true if the start time is available. When false is returned, output parameter + * "result" is unchanged. + * @stable ICU 3.8 + */ + virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const; + + /** + * Gets the first time when this rule takes effect after the specified time. + * @param base The first start time after this base time will be returned. + * @param prevRawOffset The standard time offset from UTC before this rule + * takes effect in milliseconds. + * @param prevDSTSavings The amount of daylight saving offset from the + * standard time. + * @param inclusive Whether the base time is inclusive or not. + * @param result Receives The first time when this rule takes effect after + * the specified base time. + * @return true if the start time is available. When false is returned, output parameter + * "result" is unchanged. + * @stable ICU 3.8 + */ + virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings, + UBool inclusive, UDate& result) const; + + /** + * Gets the most recent time when this rule takes effect before the specified time. + * @param base The most recent time before this base time will be returned. + * @param prevRawOffset The standard time offset from UTC before this rule + * takes effect in milliseconds. + * @param prevDSTSavings The amount of daylight saving offset from the + * standard time. + * @param inclusive Whether the base time is inclusive or not. + * @param result Receives The most recent time when this rule takes effect before + * the specified base time. + * @return true if the start time is available. When false is returned, output parameter + * "result" is unchanged. + * @stable ICU 3.8 + */ + virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings, + UBool inclusive, UDate& result) const; + +public: + /** + * Return the class ID for this class. This is useful only for comparing to + * a return value from getDynamicClassID(). For example: + *

+     * .   Base* polymorphic_pointer = createPolymorphicObject();
+     * .   if (polymorphic_pointer->getDynamicClassID() ==
+     * .       erived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @stable ICU 3.8 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This + * method is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and clone() + * methods call this method. + * + * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @stable ICU 3.8 + */ + virtual UClassID getDynamicClassID(void) const; +}; + +/** + * AnnualTimeZoneRule is a class used for representing a time zone + * rule which takes effect annually. The calenday system used for the rule is + * is based on Gregorian calendar + * + * @stable ICU 3.8 + */ +class U_I18N_API AnnualTimeZoneRule : public TimeZoneRule { +public: + /** + * The constant representing the maximum year used for designating + * a rule is permanent. + */ + static const int32_t MAX_YEAR; + + /** + * Constructs a AnnualTimeZoneRule with the name, the GMT offset of its + * standard time, the amount of daylight saving offset adjustment, the annual start + * time rule and the start/until years. The input DateTimeRule is copied by this + * constructor, so the caller remains responsible for deleting the object. + * @param name The time zone name. + * @param rawOffset The GMT offset of its standard time in milliseconds. + * @param dstSavings The amount of daylight saving offset adjustment in + * milliseconds. If this ia a rule for standard time, + * the value of this argument is 0. + * @param dateTimeRule The start date/time rule repeated annually. + * @param startYear The first year when this rule takes effect. + * @param endYear The last year when this rule takes effect. If this + * rule is effective forever in future, specify MAX_YEAR. + * @stable ICU 3.8 + */ + AnnualTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings, + const DateTimeRule& dateTimeRule, int32_t startYear, int32_t endYear); + + /** + * Constructs a AnnualTimeZoneRule with the name, the GMT offset of its + * standard time, the amount of daylight saving offset adjustment, the annual start + * time rule and the start/until years. The input DateTimeRule object is adopted + * by this object, therefore, the caller must not delete the object. + * @param name The time zone name. + * @param rawOffset The GMT offset of its standard time in milliseconds. + * @param dstSavings The amount of daylight saving offset adjustment in + * milliseconds. If this ia a rule for standard time, + * the value of this argument is 0. + * @param dateTimeRule The start date/time rule repeated annually. + * @param startYear The first year when this rule takes effect. + * @param endYear The last year when this rule takes effect. If this + * rule is effective forever in future, specify MAX_YEAR. + * @stable ICU 3.8 + */ + AnnualTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings, + DateTimeRule* dateTimeRule, int32_t startYear, int32_t endYear); + + /** + * Copy constructor. + * @param source The AnnualTimeZoneRule object to be copied. + * @stable ICU 3.8 + */ + AnnualTimeZoneRule(const AnnualTimeZoneRule& source); + + /** + * Destructor. + * @stable ICU 3.8 + */ + virtual ~AnnualTimeZoneRule(); + + /** + * Clone this AnnualTimeZoneRule object polymorphically. The caller owns the result and + * should delete it when done. + * @return A copy of the object. + * @stable ICU 3.8 + */ + virtual AnnualTimeZoneRule* clone(void) const; + + /** + * Assignment operator. + * @param right The object to be copied. + * @stable ICU 3.8 + */ + AnnualTimeZoneRule& operator=(const AnnualTimeZoneRule& right); + + /** + * Return true if the given TimeZoneRule objects are semantically equal. Objects + * of different subclasses are considered unequal. + * @param that The object to be compared with. + * @return true if the given TimeZoneRule objects are semantically equal. + * @stable ICU 3.8 + */ + virtual UBool operator==(const TimeZoneRule& that) const; + + /** + * Return true if the given TimeZoneRule objects are semantically unequal. Objects + * of different subclasses are considered unequal. + * @param that The object to be compared with. + * @return true if the given TimeZoneRule objects are semantically unequal. + * @stable ICU 3.8 + */ + virtual UBool operator!=(const TimeZoneRule& that) const; + + /** + * Gets the start date/time rule used by this rule. + * @return The AnnualDateTimeRule which represents the start date/time + * rule used by this time zone rule. + * @stable ICU 3.8 + */ + const DateTimeRule* getRule(void) const; + + /** + * Gets the first year when this rule takes effect. + * @return The start year of this rule. The year is in Gregorian calendar + * with 0 == 1 BCE, -1 == 2 BCE, etc. + * @stable ICU 3.8 + */ + int32_t getStartYear(void) const; + + /** + * Gets the end year when this rule takes effect. + * @return The end year of this rule (inclusive). The year is in Gregorian calendar + * with 0 == 1 BCE, -1 == 2 BCE, etc. + * @stable ICU 3.8 + */ + int32_t getEndYear(void) const; + + /** + * Gets the time when this rule takes effect in the given year. + * @param year The Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc. + * @param prevRawOffset The standard time offset from UTC before this rule + * takes effect in milliseconds. + * @param prevDSTSavings The amount of daylight saving offset from the + * standard time. + * @param result Receives the start time in the year. + * @return true if this rule takes effect in the year and the result is set to + * "result". + * @stable ICU 3.8 + */ + UBool getStartInYear(int32_t year, int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const; + + /** + * Returns if this rule represents the same rule and offsets as another. + * When two TimeZoneRule objects differ only its names, this method + * returns true. + * @param that The TimeZoneRule object to be compared with. + * @return true if the other TimeZoneRule is equivalent to this one. + * @stable ICU 3.8 + */ + virtual UBool isEquivalentTo(const TimeZoneRule& that) const; + + /** + * Gets the very first time when this rule takes effect. + * @param prevRawOffset The standard time offset from UTC before this rule + * takes effect in milliseconds. + * @param prevDSTSavings The amount of daylight saving offset from the + * standard time. + * @param result Receives the very first time when this rule takes effect. + * @return true if the start time is available. When false is returned, output parameter + * "result" is unchanged. + * @stable ICU 3.8 + */ + virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const; + + /** + * Gets the final time when this rule takes effect. + * @param prevRawOffset The standard time offset from UTC before this rule + * takes effect in milliseconds. + * @param prevDSTSavings The amount of daylight saving offset from the + * standard time. + * @param result Receives the final time when this rule takes effect. + * @return true if the start time is available. When false is returned, output parameter + * "result" is unchanged. + * @stable ICU 3.8 + */ + virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const; + + /** + * Gets the first time when this rule takes effect after the specified time. + * @param base The first start time after this base time will be returned. + * @param prevRawOffset The standard time offset from UTC before this rule + * takes effect in milliseconds. + * @param prevDSTSavings The amount of daylight saving offset from the + * standard time. + * @param inclusive Whether the base time is inclusive or not. + * @param result Receives The first time when this rule takes effect after + * the specified base time. + * @return true if the start time is available. When false is returned, output parameter + * "result" is unchanged. + * @stable ICU 3.8 + */ + virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings, + UBool inclusive, UDate& result) const; + + /** + * Gets the most recent time when this rule takes effect before the specified time. + * @param base The most recent time before this base time will be returned. + * @param prevRawOffset The standard time offset from UTC before this rule + * takes effect in milliseconds. + * @param prevDSTSavings The amount of daylight saving offset from the + * standard time. + * @param inclusive Whether the base time is inclusive or not. + * @param result Receives The most recent time when this rule takes effect before + * the specified base time. + * @return true if the start time is available. When false is returned, output parameter + * "result" is unchanged. + * @stable ICU 3.8 + */ + virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings, + UBool inclusive, UDate& result) const; + + +private: + DateTimeRule* fDateTimeRule; + int32_t fStartYear; + int32_t fEndYear; + +public: + /** + * Return the class ID for this class. This is useful only for comparing to + * a return value from getDynamicClassID(). For example: + *
+     * .   Base* polymorphic_pointer = createPolymorphicObject();
+     * .   if (polymorphic_pointer->getDynamicClassID() ==
+     * .       erived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @stable ICU 3.8 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This + * method is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and clone() + * methods call this method. + * + * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @stable ICU 3.8 + */ + virtual UClassID getDynamicClassID(void) const; +}; + +/** + * TimeArrayTimeZoneRule represents a time zone rule whose start times are + * defined by an array of milliseconds since the standard base time. + * + * @stable ICU 3.8 + */ +class U_I18N_API TimeArrayTimeZoneRule : public TimeZoneRule { +public: + /** + * Constructs a TimeArrayTimeZoneRule with the name, the GMT offset of its + * standard time, the amount of daylight saving offset adjustment and + * the array of times when this rule takes effect. + * @param name The time zone name. + * @param rawOffset The UTC offset of its standard time in milliseconds. + * @param dstSavings The amount of daylight saving offset adjustment in + * milliseconds. If this ia a rule for standard time, + * the value of this argument is 0. + * @param startTimes The array start times in milliseconds since the base time + * (January 1, 1970, 00:00:00). + * @param numStartTimes The number of elements in the parameter "startTimes" + * @param timeRuleType The time type of the start times, which is one of + * DataTimeRule::WALL_TIME, STANDARD_TIME + * and UTC_TIME. + * @stable ICU 3.8 + */ + TimeArrayTimeZoneRule(const UnicodeString& name, int32_t rawOffset, int32_t dstSavings, + const UDate* startTimes, int32_t numStartTimes, DateTimeRule::TimeRuleType timeRuleType); + + /** + * Copy constructor. + * @param source The TimeArrayTimeZoneRule object to be copied. + * @stable ICU 3.8 + */ + TimeArrayTimeZoneRule(const TimeArrayTimeZoneRule& source); + + /** + * Destructor. + * @stable ICU 3.8 + */ + virtual ~TimeArrayTimeZoneRule(); + + /** + * Clone this TimeArrayTimeZoneRule object polymorphically. The caller owns the result and + * should delete it when done. + * @return A copy of the object. + * @stable ICU 3.8 + */ + virtual TimeArrayTimeZoneRule* clone(void) const; + + /** + * Assignment operator. + * @param right The object to be copied. + * @stable ICU 3.8 + */ + TimeArrayTimeZoneRule& operator=(const TimeArrayTimeZoneRule& right); + + /** + * Return true if the given TimeZoneRule objects are semantically equal. Objects + * of different subclasses are considered unequal. + * @param that The object to be compared with. + * @return true if the given TimeZoneRule objects are semantically equal. + * @stable ICU 3.8 + */ + virtual UBool operator==(const TimeZoneRule& that) const; + + /** + * Return true if the given TimeZoneRule objects are semantically unequal. Objects + * of different subclasses are considered unequal. + * @param that The object to be compared with. + * @return true if the given TimeZoneRule objects are semantically unequal. + * @stable ICU 3.8 + */ + virtual UBool operator!=(const TimeZoneRule& that) const; + + /** + * Gets the time type of the start times used by this rule. The return value + * is either DateTimeRule::WALL_TIME or STANDARD_TIME + * or UTC_TIME. + * + * @return The time type used of the start times used by this rule. + * @stable ICU 3.8 + */ + DateTimeRule::TimeRuleType getTimeType(void) const; + + /** + * Gets a start time at the index stored in this rule. + * @param index The index of start times + * @param result Receives the start time at the index + * @return true if the index is within the valid range and + * and the result is set. When false, the output + * parameger "result" is unchanged. + * @stable ICU 3.8 + */ + UBool getStartTimeAt(int32_t index, UDate& result) const; + + /** + * Returns the number of start times stored in this rule + * @return The number of start times. + * @stable ICU 3.8 + */ + int32_t countStartTimes(void) const; + + /** + * Returns if this rule represents the same rule and offsets as another. + * When two TimeZoneRule objects differ only its names, this method + * returns true. + * @param that The TimeZoneRule object to be compared with. + * @return true if the other TimeZoneRule is equivalent to this one. + * @stable ICU 3.8 + */ + virtual UBool isEquivalentTo(const TimeZoneRule& that) const; + + /** + * Gets the very first time when this rule takes effect. + * @param prevRawOffset The standard time offset from UTC before this rule + * takes effect in milliseconds. + * @param prevDSTSavings The amount of daylight saving offset from the + * standard time. + * @param result Receives the very first time when this rule takes effect. + * @return true if the start time is available. When false is returned, output parameter + * "result" is unchanged. + * @stable ICU 3.8 + */ + virtual UBool getFirstStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const; + + /** + * Gets the final time when this rule takes effect. + * @param prevRawOffset The standard time offset from UTC before this rule + * takes effect in milliseconds. + * @param prevDSTSavings The amount of daylight saving offset from the + * standard time. + * @param result Receives the final time when this rule takes effect. + * @return true if the start time is available. When false is returned, output parameter + * "result" is unchanged. + * @stable ICU 3.8 + */ + virtual UBool getFinalStart(int32_t prevRawOffset, int32_t prevDSTSavings, UDate& result) const; + + /** + * Gets the first time when this rule takes effect after the specified time. + * @param base The first start time after this base time will be returned. + * @param prevRawOffset The standard time offset from UTC before this rule + * takes effect in milliseconds. + * @param prevDSTSavings The amount of daylight saving offset from the + * standard time. + * @param inclusive Whether the base time is inclusive or not. + * @param result Receives The first time when this rule takes effect after + * the specified base time. + * @return true if the start time is available. When false is returned, output parameter + * "result" is unchanged. + * @stable ICU 3.8 + */ + virtual UBool getNextStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings, + UBool inclusive, UDate& result) const; + + /** + * Gets the most recent time when this rule takes effect before the specified time. + * @param base The most recent time before this base time will be returned. + * @param prevRawOffset The standard time offset from UTC before this rule + * takes effect in milliseconds. + * @param prevDSTSavings The amount of daylight saving offset from the + * standard time. + * @param inclusive Whether the base time is inclusive or not. + * @param result Receives The most recent time when this rule takes effect before + * the specified base time. + * @return true if the start time is available. When false is returned, output parameter + * "result" is unchanged. + * @stable ICU 3.8 + */ + virtual UBool getPreviousStart(UDate base, int32_t prevRawOffset, int32_t prevDSTSavings, + UBool inclusive, UDate& result) const; + + +private: + enum { TIMEARRAY_STACK_BUFFER_SIZE = 32 }; + UBool initStartTimes(const UDate source[], int32_t size, UErrorCode& ec); + UDate getUTC(UDate time, int32_t raw, int32_t dst) const; + + DateTimeRule::TimeRuleType fTimeRuleType; + int32_t fNumStartTimes; + UDate* fStartTimes; + UDate fLocalStartTimes[TIMEARRAY_STACK_BUFFER_SIZE]; + +public: + /** + * Return the class ID for this class. This is useful only for comparing to + * a return value from getDynamicClassID(). For example: + *
+     * .   Base* polymorphic_pointer = createPolymorphicObject();
+     * .   if (polymorphic_pointer->getDynamicClassID() ==
+     * .       erived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @stable ICU 3.8 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This + * method is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and clone() + * methods call this method. + * + * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @stable ICU 3.8 + */ + virtual UClassID getDynamicClassID(void) const; +}; + + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // TZRULE_H + +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/tztrans.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/tztrans.h new file mode 100644 index 0000000..a476c68 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/tztrans.h @@ -0,0 +1,197 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2007-2008, International Business Machines Corporation and * +* others. All Rights Reserved. * +******************************************************************************* +*/ +#ifndef TZTRANS_H +#define TZTRANS_H + +/** + * \file + * \brief C++ API: Time zone transition + */ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/uobject.h" + +U_NAMESPACE_BEGIN + +// Forward declaration +class TimeZoneRule; + +/** + * TimeZoneTransition is a class representing a time zone transition. + * An instance has a time of transition and rules for both before and after the transition. + * @stable ICU 3.8 + */ +class U_I18N_API TimeZoneTransition : public UObject { +public: + /** + * Constructs a TimeZoneTransition with the time and the rules before/after + * the transition. + * + * @param time The time of transition in milliseconds since the base time. + * @param from The time zone rule used before the transition. + * @param to The time zone rule used after the transition. + * @stable ICU 3.8 + */ + TimeZoneTransition(UDate time, const TimeZoneRule& from, const TimeZoneRule& to); + + /** + * Constructs an empty TimeZoneTransition + * @stable ICU 3.8 + */ + TimeZoneTransition(); + + /** + * Copy constructor. + * @param source The TimeZoneTransition object to be copied. + * @stable ICU 3.8 + */ + TimeZoneTransition(const TimeZoneTransition& source); + + /** + * Destructor. + * @stable ICU 3.8 + */ + ~TimeZoneTransition(); + + /** + * Clone this TimeZoneTransition object polymorphically. The caller owns the result and + * should delete it when done. + * @return A copy of the object. + * @stable ICU 3.8 + */ + TimeZoneTransition* clone(void) const; + + /** + * Assignment operator. + * @param right The object to be copied. + * @stable ICU 3.8 + */ + TimeZoneTransition& operator=(const TimeZoneTransition& right); + + /** + * Return true if the given TimeZoneTransition objects are semantically equal. Objects + * of different subclasses are considered unequal. + * @param that The object to be compared with. + * @return true if the given TimeZoneTransition objects are semantically equal. + * @stable ICU 3.8 + */ + UBool operator==(const TimeZoneTransition& that) const; + + /** + * Return true if the given TimeZoneTransition objects are semantically unequal. Objects + * of different subclasses are considered unequal. + * @param that The object to be compared with. + * @return true if the given TimeZoneTransition objects are semantically unequal. + * @stable ICU 3.8 + */ + UBool operator!=(const TimeZoneTransition& that) const; + + /** + * Returns the time of transition in milliseconds. + * @return The time of the transition in milliseconds since the 1970 Jan 1 epoch time. + * @stable ICU 3.8 + */ + UDate getTime(void) const; + + /** + * Sets the time of transition in milliseconds. + * @param time The time of the transition in milliseconds since the 1970 Jan 1 epoch time. + * @stable ICU 3.8 + */ + void setTime(UDate time); + + /** + * Returns the rule used before the transition. + * @return The time zone rule used after the transition. + * @stable ICU 3.8 + */ + const TimeZoneRule* getFrom(void) const; + + /** + * Sets the rule used before the transition. The caller remains + * responsible for deleting the TimeZoneRule object. + * @param from The time zone rule used before the transition. + * @stable ICU 3.8 + */ + void setFrom(const TimeZoneRule& from); + + /** + * Adopts the rule used before the transition. The caller must + * not delete the TimeZoneRule object passed in. + * @param from The time zone rule used before the transition. + * @stable ICU 3.8 + */ + void adoptFrom(TimeZoneRule* from); + + /** + * Sets the rule used after the transition. The caller remains + * responsible for deleting the TimeZoneRule object. + * @param to The time zone rule used after the transition. + * @stable ICU 3.8 + */ + void setTo(const TimeZoneRule& to); + + /** + * Adopts the rule used after the transition. The caller must + * not delete the TimeZoneRule object passed in. + * @param to The time zone rule used after the transition. + * @stable ICU 3.8 + */ + void adoptTo(TimeZoneRule* to); + + /** + * Returns the rule used after the transition. + * @return The time zone rule used after the transition. + * @stable ICU 3.8 + */ + const TimeZoneRule* getTo(void) const; + +private: + UDate fTime; + TimeZoneRule* fFrom; + TimeZoneRule* fTo; + +public: + /** + * Return the class ID for this class. This is useful only for comparing to + * a return value from getDynamicClassID(). For example: + *
+     * .   Base* polymorphic_pointer = createPolymorphicObject();
+     * .   if (polymorphic_pointer->getDynamicClassID() ==
+     * .       erived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @stable ICU 3.8 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This + * method is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and clone() + * methods call this method. + * + * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @stable ICU 3.8 + */ + virtual UClassID getDynamicClassID(void) const; +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // TZTRANS_H + +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ubidi.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ubidi.h new file mode 100644 index 0000000..ef21f24 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ubidi.h @@ -0,0 +1,2201 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1999-2013, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: ubidi.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 1999jul27 +* created by: Markus W. Scherer, updated by Matitiahu Allouche +*/ + +#ifndef UBIDI_H +#define UBIDI_H + +#include "unicode/utypes.h" +#include "unicode/uchar.h" +#include "unicode/localpointer.h" + +/** + *\file + * \brief C API: Bidi algorithm + * + *

Bidi algorithm for ICU

+ * + * This is an implementation of the Unicode Bidirectional Algorithm. + * The algorithm is defined in the + * Unicode Standard Annex #9.

+ * + * Note: Libraries that perform a bidirectional algorithm and + * reorder strings accordingly are sometimes called "Storage Layout Engines". + * ICU's Bidi and shaping (u_shapeArabic()) APIs can be used at the core of such + * "Storage Layout Engines". + * + *

General remarks about the API:

+ * + * In functions with an error code parameter, + * the pErrorCode pointer must be valid + * and the value that it points to must not indicate a failure before + * the function call. Otherwise, the function returns immediately. + * After the function call, the value indicates success or failure.

+ * + * The "limit" of a sequence of characters is the position just after their + * last character, i.e., one more than that position.

+ * + * Some of the API functions provide access to "runs". + * Such a "run" is defined as a sequence of characters + * that are at the same embedding level + * after performing the Bidi algorithm.

+ * + * @author Markus W. Scherer + * @version 1.0 + * + * + *

Sample code for the ICU Bidi API

+ * + *
Rendering a paragraph with the ICU Bidi API
+ * + * This is (hypothetical) sample code that illustrates + * how the ICU Bidi API could be used to render a paragraph of text. + * Rendering code depends highly on the graphics system, + * therefore this sample code must make a lot of assumptions, + * which may or may not match any existing graphics system's properties. + * + *

The basic assumptions are:

+ *
    + *
  • Rendering is done from left to right on a horizontal line.
  • + *
  • A run of single-style, unidirectional text can be rendered at once.
  • + *
  • Such a run of text is passed to the graphics system with + * characters (code units) in logical order.
  • + *
  • The line-breaking algorithm is very complicated + * and Locale-dependent - + * and therefore its implementation omitted from this sample code.
  • + *
+ * + *
+ * \code
+ *#include "unicode/ubidi.h"
+ *
+ *typedef enum {
+ *     styleNormal=0, styleSelected=1,
+ *     styleBold=2, styleItalics=4,
+ *     styleSuper=8, styleSub=16
+ *} Style;
+ *
+ *typedef struct { int32_t limit; Style style; } StyleRun;
+ *
+ *int getTextWidth(const UChar *text, int32_t start, int32_t limit,
+ *                  const StyleRun *styleRuns, int styleRunCount);
+ *
+ * // set *pLimit and *pStyleRunLimit for a line
+ * // from text[start] and from styleRuns[styleRunStart]
+ * // using ubidi_getLogicalRun(para, ...)
+ *void getLineBreak(const UChar *text, int32_t start, int32_t *pLimit,
+ *                  UBiDi *para,
+ *                  const StyleRun *styleRuns, int styleRunStart, int *pStyleRunLimit,
+ *                  int *pLineWidth);
+ *
+ * // render runs on a line sequentially, always from left to right
+ *
+ * // prepare rendering a new line
+ * void startLine(UBiDiDirection textDirection, int lineWidth);
+ *
+ * // render a run of text and advance to the right by the run width
+ * // the text[start..limit-1] is always in logical order
+ * void renderRun(const UChar *text, int32_t start, int32_t limit,
+ *               UBiDiDirection textDirection, Style style);
+ *
+ * // We could compute a cross-product
+ * // from the style runs with the directional runs
+ * // and then reorder it.
+ * // Instead, here we iterate over each run type
+ * // and render the intersections -
+ * // with shortcuts in simple (and common) cases.
+ * // renderParagraph() is the main function.
+ *
+ * // render a directional run with
+ * // (possibly) multiple style runs intersecting with it
+ * void renderDirectionalRun(const UChar *text,
+ *                           int32_t start, int32_t limit,
+ *                           UBiDiDirection direction,
+ *                           const StyleRun *styleRuns, int styleRunCount) {
+ *     int i;
+ *
+ *     // iterate over style runs
+ *     if(direction==UBIDI_LTR) {
+ *         int styleLimit;
+ *
+ *         for(i=0; ilimit) { styleLimit=limit; }
+ *                 renderRun(text, start, styleLimit,
+ *                           direction, styleRun[i].style);
+ *                 if(styleLimit==limit) { break; }
+ *                 start=styleLimit;
+ *             }
+ *         }
+ *     } else {
+ *         int styleStart;
+ *
+ *         for(i=styleRunCount-1; i>=0; --i) {
+ *             if(i>0) {
+ *                 styleStart=styleRun[i-1].limit;
+ *             } else {
+ *                 styleStart=0;
+ *             }
+ *             if(limit>=styleStart) {
+ *                 if(styleStart=length
+ *
+ *         width=getTextWidth(text, 0, length, styleRuns, styleRunCount);
+ *         if(width<=lineWidth) {
+ *             // everything fits onto one line
+ *
+ *            // prepare rendering a new line from either left or right
+ *             startLine(paraLevel, width);
+ *
+ *             renderLine(para, text, 0, length,
+ *                        styleRuns, styleRunCount);
+ *         } else {
+ *             UBiDi *line;
+ *
+ *             // we need to render several lines
+ *             line=ubidi_openSized(length, 0, pErrorCode);
+ *             if(line!=NULL) {
+ *                 int32_t start=0, limit;
+ *                 int styleRunStart=0, styleRunLimit;
+ *
+ *                 for(;;) {
+ *                     limit=length;
+ *                     styleRunLimit=styleRunCount;
+ *                     getLineBreak(text, start, &limit, para,
+ *                                  styleRuns, styleRunStart, &styleRunLimit,
+ *                                 &width);
+ *                     ubidi_setLine(para, start, limit, line, pErrorCode);
+ *                     if(U_SUCCESS(*pErrorCode)) {
+ *                         // prepare rendering a new line
+ *                         // from either left or right
+ *                         startLine(paraLevel, width);
+ *
+ *                         renderLine(line, text, start, limit,
+ *                                    styleRuns+styleRunStart,
+ *                                    styleRunLimit-styleRunStart);
+ *                     }
+ *                     if(limit==length) { break; }
+ *                     start=limit;
+ *                     styleRunStart=styleRunLimit-1;
+ *                     if(start>=styleRuns[styleRunStart].limit) {
+ *                         ++styleRunStart;
+ *                     }
+ *                 }
+ *
+ *                 ubidi_close(line);
+ *             }
+ *        }
+ *    }
+ *
+ *     ubidi_close(para);
+ *}
+ *\endcode
+ * 
+ */ + +/*DOCXX_TAG*/ +/*@{*/ + +/** + * UBiDiLevel is the type of the level values in this + * Bidi implementation. + * It holds an embedding level and indicates the visual direction + * by its bit 0 (even/odd value).

+ * + * It can also hold non-level values for the + * paraLevel and embeddingLevels + * arguments of ubidi_setPara(); there: + *

    + *
  • bit 7 of an embeddingLevels[] + * value indicates whether the using application is + * specifying the level of a character to override whatever the + * Bidi implementation would resolve it to.
  • + *
  • paraLevel can be set to the + * pseudo-level values UBIDI_DEFAULT_LTR + * and UBIDI_DEFAULT_RTL.
  • + *
+ * + * @see ubidi_setPara + * + *

The related constants are not real, valid level values. + * UBIDI_DEFAULT_XXX can be used to specify + * a default for the paragraph level for + * when the ubidi_setPara() function + * shall determine it but there is no + * strongly typed character in the input.

+ * + * Note that the value for UBIDI_DEFAULT_LTR is even + * and the one for UBIDI_DEFAULT_RTL is odd, + * just like with normal LTR and RTL level values - + * these special values are designed that way. Also, the implementation + * assumes that UBIDI_MAX_EXPLICIT_LEVEL is odd. + * + * @see UBIDI_DEFAULT_LTR + * @see UBIDI_DEFAULT_RTL + * @see UBIDI_LEVEL_OVERRIDE + * @see UBIDI_MAX_EXPLICIT_LEVEL + * @stable ICU 2.0 + */ +typedef uint8_t UBiDiLevel; + +/** Paragraph level setting.

+ * + * Constant indicating that the base direction depends on the first strong + * directional character in the text according to the Unicode Bidirectional + * Algorithm. If no strong directional character is present, + * then set the paragraph level to 0 (left-to-right).

+ * + * If this value is used in conjunction with reordering modes + * UBIDI_REORDER_INVERSE_LIKE_DIRECT or + * UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL, the text to reorder + * is assumed to be visual LTR, and the text after reordering is required + * to be the corresponding logical string with appropriate contextual + * direction. The direction of the result string will be RTL if either + * the righmost or leftmost strong character of the source text is RTL + * or Arabic Letter, the direction will be LTR otherwise.

+ * + * If reordering option UBIDI_OPTION_INSERT_MARKS is set, an RLM may + * be added at the beginning of the result string to ensure round trip + * (that the result string, when reordered back to visual, will produce + * the original source text). + * @see UBIDI_REORDER_INVERSE_LIKE_DIRECT + * @see UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL + * @stable ICU 2.0 + */ +#define UBIDI_DEFAULT_LTR 0xfe + +/** Paragraph level setting.

+ * + * Constant indicating that the base direction depends on the first strong + * directional character in the text according to the Unicode Bidirectional + * Algorithm. If no strong directional character is present, + * then set the paragraph level to 1 (right-to-left).

+ * + * If this value is used in conjunction with reordering modes + * UBIDI_REORDER_INVERSE_LIKE_DIRECT or + * UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL, the text to reorder + * is assumed to be visual LTR, and the text after reordering is required + * to be the corresponding logical string with appropriate contextual + * direction. The direction of the result string will be RTL if either + * the righmost or leftmost strong character of the source text is RTL + * or Arabic Letter, or if the text contains no strong character; + * the direction will be LTR otherwise.

+ * + * If reordering option UBIDI_OPTION_INSERT_MARKS is set, an RLM may + * be added at the beginning of the result string to ensure round trip + * (that the result string, when reordered back to visual, will produce + * the original source text). + * @see UBIDI_REORDER_INVERSE_LIKE_DIRECT + * @see UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL + * @stable ICU 2.0 + */ +#define UBIDI_DEFAULT_RTL 0xff + +/** + * Maximum explicit embedding level. + * (The maximum resolved level can be up to UBIDI_MAX_EXPLICIT_LEVEL+1). + * @stable ICU 2.0 + */ +#define UBIDI_MAX_EXPLICIT_LEVEL 125 + +/** Bit flag for level input. + * Overrides directional properties. + * @stable ICU 2.0 + */ +#define UBIDI_LEVEL_OVERRIDE 0x80 + +/** + * Special value which can be returned by the mapping functions when a logical + * index has no corresponding visual index or vice-versa. This may happen + * for the logical-to-visual mapping of a Bidi control when option + * #UBIDI_OPTION_REMOVE_CONTROLS is specified. This can also happen + * for the visual-to-logical mapping of a Bidi mark (LRM or RLM) inserted + * by option #UBIDI_OPTION_INSERT_MARKS. + * @see ubidi_getVisualIndex + * @see ubidi_getVisualMap + * @see ubidi_getLogicalIndex + * @see ubidi_getLogicalMap + * @stable ICU 3.6 + */ +#define UBIDI_MAP_NOWHERE (-1) + +/** + * UBiDiDirection values indicate the text direction. + * @stable ICU 2.0 + */ +enum UBiDiDirection { + /** Left-to-right text. This is a 0 value. + *

    + *
  • As return value for ubidi_getDirection(), it means + * that the source string contains no right-to-left characters, or + * that the source string is empty and the paragraph level is even. + *
  • As return value for ubidi_getBaseDirection(), it + * means that the first strong character of the source string has + * a left-to-right direction. + *
+ * @stable ICU 2.0 + */ + UBIDI_LTR, + /** Right-to-left text. This is a 1 value. + *
    + *
  • As return value for ubidi_getDirection(), it means + * that the source string contains no left-to-right characters, or + * that the source string is empty and the paragraph level is odd. + *
  • As return value for ubidi_getBaseDirection(), it + * means that the first strong character of the source string has + * a right-to-left direction. + *
+ * @stable ICU 2.0 + */ + UBIDI_RTL, + /** Mixed-directional text. + *

As return value for ubidi_getDirection(), it means + * that the source string contains both left-to-right and + * right-to-left characters. + * @stable ICU 2.0 + */ + UBIDI_MIXED, + /** No strongly directional text. + *

As return value for ubidi_getBaseDirection(), it means + * that the source string is missing or empty, or contains neither left-to-right + * nor right-to-left characters. + * @stable ICU 4.6 + */ + UBIDI_NEUTRAL +}; + +/** @stable ICU 2.0 */ +typedef enum UBiDiDirection UBiDiDirection; + +/** + * Forward declaration of the UBiDi structure for the declaration of + * the API functions. Its fields are implementation-specific.

+ * This structure holds information about a paragraph (or multiple paragraphs) + * of text with Bidi-algorithm-related details, or about one line of + * such a paragraph.

+ * Reordering can be done on a line, or on one or more paragraphs which are + * then interpreted each as one single line. + * @stable ICU 2.0 + */ +struct UBiDi; + +/** @stable ICU 2.0 */ +typedef struct UBiDi UBiDi; + +/** + * Allocate a UBiDi structure. + * Such an object is initially empty. It is assigned + * the Bidi properties of a piece of text containing one or more paragraphs + * by ubidi_setPara() + * or the Bidi properties of a line within a paragraph by + * ubidi_setLine().

+ * This object can be reused for as long as it is not deallocated + * by calling ubidi_close().

+ * ubidi_setPara() and ubidi_setLine() will allocate + * additional memory for internal structures as necessary. + * + * @return An empty UBiDi object. + * @stable ICU 2.0 + */ +U_STABLE UBiDi * U_EXPORT2 +ubidi_open(void); + +/** + * Allocate a UBiDi structure with preallocated memory + * for internal structures. + * This function provides a UBiDi object like ubidi_open() + * with no arguments, but it also preallocates memory for internal structures + * according to the sizings supplied by the caller.

+ * Subsequent functions will not allocate any more memory, and are thus + * guaranteed not to fail because of lack of memory.

+ * The preallocation can be limited to some of the internal memory + * by setting some values to 0 here. That means that if, e.g., + * maxRunCount cannot be reasonably predetermined and should not + * be set to maxLength (the only failproof value) to avoid + * wasting memory, then maxRunCount could be set to 0 here + * and the internal structures that are associated with it will be allocated + * on demand, just like with ubidi_open(). + * + * @param maxLength is the maximum text or line length that internal memory + * will be preallocated for. An attempt to associate this object with a + * longer text will fail, unless this value is 0, which leaves the allocation + * up to the implementation. + * + * @param maxRunCount is the maximum anticipated number of same-level runs + * that internal memory will be preallocated for. An attempt to access + * visual runs on an object that was not preallocated for as many runs + * as the text was actually resolved to will fail, + * unless this value is 0, which leaves the allocation up to the implementation.

+ * The number of runs depends on the actual text and maybe anywhere between + * 1 and maxLength. It is typically small. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @return An empty UBiDi object with preallocated memory. + * @stable ICU 2.0 + */ +U_STABLE UBiDi * U_EXPORT2 +ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode); + +/** + * ubidi_close() must be called to free the memory + * associated with a UBiDi object.

+ * + * Important: + * A parent UBiDi object must not be destroyed or reused if + * it still has children. + * If a UBiDi object has become the child + * of another one (its parent) by calling + * ubidi_setLine(), then the child object must + * be destroyed (closed) or reused (by calling + * ubidi_setPara() or ubidi_setLine()) + * before the parent object. + * + * @param pBiDi is a UBiDi object. + * + * @see ubidi_setPara + * @see ubidi_setLine + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ubidi_close(UBiDi *pBiDi); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUBiDiPointer + * "Smart pointer" class, closes a UBiDi via ubidi_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUBiDiPointer, UBiDi, ubidi_close); + +U_NAMESPACE_END + +#endif + +/** + * Modify the operation of the Bidi algorithm such that it + * approximates an "inverse Bidi" algorithm. This function + * must be called before ubidi_setPara(). + * + *

The normal operation of the Bidi algorithm as described + * in the Unicode Technical Report is to take text stored in logical + * (keyboard, typing) order and to determine the reordering of it for visual + * rendering. + * Some legacy systems store text in visual order, and for operations + * with standard, Unicode-based algorithms, the text needs to be transformed + * to logical order. This is effectively the inverse algorithm of the + * described Bidi algorithm. Note that there is no standard algorithm for + * this "inverse Bidi" and that the current implementation provides only an + * approximation of "inverse Bidi".

+ * + *

With isInverse set to TRUE, + * this function changes the behavior of some of the subsequent functions + * in a way that they can be used for the inverse Bidi algorithm. + * Specifically, runs of text with numeric characters will be treated in a + * special way and may need to be surrounded with LRM characters when they are + * written in reordered sequence.

+ * + *

Output runs should be retrieved using ubidi_getVisualRun(). + * Since the actual input for "inverse Bidi" is visually ordered text and + * ubidi_getVisualRun() gets the reordered runs, these are actually + * the runs of the logically ordered output.

+ * + *

Calling this function with argument isInverse set to + * TRUE is equivalent to calling + * ubidi_setReorderingMode with argument + * reorderingMode + * set to #UBIDI_REORDER_INVERSE_NUMBERS_AS_L.
+ * Calling this function with argument isInverse set to + * FALSE is equivalent to calling + * ubidi_setReorderingMode with argument + * reorderingMode + * set to #UBIDI_REORDER_DEFAULT. + * + * @param pBiDi is a UBiDi object. + * + * @param isInverse specifies "forward" or "inverse" Bidi operation. + * + * @see ubidi_setPara + * @see ubidi_writeReordered + * @see ubidi_setReorderingMode + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ubidi_setInverse(UBiDi *pBiDi, UBool isInverse); + +/** + * Is this Bidi object set to perform the inverse Bidi algorithm? + *

Note: calling this function after setting the reordering mode with + * ubidi_setReorderingMode will return TRUE if the + * reordering mode was set to #UBIDI_REORDER_INVERSE_NUMBERS_AS_L, + * FALSE for all other values.

+ * + * @param pBiDi is a UBiDi object. + * @return TRUE if the Bidi object is set to perform the inverse Bidi algorithm + * by handling numbers as L. + * + * @see ubidi_setInverse + * @see ubidi_setReorderingMode + * @stable ICU 2.0 + */ + +U_STABLE UBool U_EXPORT2 +ubidi_isInverse(UBiDi *pBiDi); + +/** + * Specify whether block separators must be allocated level zero, + * so that successive paragraphs will progress from left to right. + * This function must be called before ubidi_setPara(). + * Paragraph separators (B) may appear in the text. Setting them to level zero + * means that all paragraph separators (including one possibly appearing + * in the last text position) are kept in the reordered text after the text + * that they follow in the source text. + * When this feature is not enabled, a paragraph separator at the last + * position of the text before reordering will go to the first position + * of the reordered text when the paragraph level is odd. + * + * @param pBiDi is a UBiDi object. + * + * @param orderParagraphsLTR specifies whether paragraph separators (B) must + * receive level 0, so that successive paragraphs progress from left to right. + * + * @see ubidi_setPara + * @stable ICU 3.4 + */ +U_STABLE void U_EXPORT2 +ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR); + +/** + * Is this Bidi object set to allocate level 0 to block separators so that + * successive paragraphs progress from left to right? + * + * @param pBiDi is a UBiDi object. + * @return TRUE if the Bidi object is set to allocate level 0 to block + * separators. + * + * @see ubidi_orderParagraphsLTR + * @stable ICU 3.4 + */ +U_STABLE UBool U_EXPORT2 +ubidi_isOrderParagraphsLTR(UBiDi *pBiDi); + +/** + * UBiDiReorderingMode values indicate which variant of the Bidi + * algorithm to use. + * + * @see ubidi_setReorderingMode + * @stable ICU 3.6 + */ +typedef enum UBiDiReorderingMode { + /** Regular Logical to Visual Bidi algorithm according to Unicode. + * This is a 0 value. + * @stable ICU 3.6 */ + UBIDI_REORDER_DEFAULT = 0, + /** Logical to Visual algorithm which handles numbers in a way which + * mimicks the behavior of Windows XP. + * @stable ICU 3.6 */ + UBIDI_REORDER_NUMBERS_SPECIAL, + /** Logical to Visual algorithm grouping numbers with adjacent R characters + * (reversible algorithm). + * @stable ICU 3.6 */ + UBIDI_REORDER_GROUP_NUMBERS_WITH_R, + /** Reorder runs only to transform a Logical LTR string to the Logical RTL + * string with the same display, or vice-versa.
+ * If this mode is set together with option + * #UBIDI_OPTION_INSERT_MARKS, some Bidi controls in the source + * text may be removed and other controls may be added to produce the + * minimum combination which has the required display. + * @stable ICU 3.6 */ + UBIDI_REORDER_RUNS_ONLY, + /** Visual to Logical algorithm which handles numbers like L + * (same algorithm as selected by ubidi_setInverse(TRUE). + * @see ubidi_setInverse + * @stable ICU 3.6 */ + UBIDI_REORDER_INVERSE_NUMBERS_AS_L, + /** Visual to Logical algorithm equivalent to the regular Logical to Visual + * algorithm. + * @stable ICU 3.6 */ + UBIDI_REORDER_INVERSE_LIKE_DIRECT, + /** Inverse Bidi (Visual to Logical) algorithm for the + * UBIDI_REORDER_NUMBERS_SPECIAL Bidi algorithm. + * @stable ICU 3.6 */ + UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL, +#ifndef U_HIDE_DEPRECATED_API + /** + * Number of values for reordering mode. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UBIDI_REORDER_COUNT +#endif // U_HIDE_DEPRECATED_API +} UBiDiReorderingMode; + +/** + * Modify the operation of the Bidi algorithm such that it implements some + * variant to the basic Bidi algorithm or approximates an "inverse Bidi" + * algorithm, depending on different values of the "reordering mode". + * This function must be called before ubidi_setPara(), and stays + * in effect until called again with a different argument. + * + *

The normal operation of the Bidi algorithm as described + * in the Unicode Standard Annex #9 is to take text stored in logical + * (keyboard, typing) order and to determine how to reorder it for visual + * rendering.

+ * + *

With the reordering mode set to a value other than + * #UBIDI_REORDER_DEFAULT, this function changes the behavior of + * some of the subsequent functions in a way such that they implement an + * inverse Bidi algorithm or some other algorithm variants.

+ * + *

Some legacy systems store text in visual order, and for operations + * with standard, Unicode-based algorithms, the text needs to be transformed + * into logical order. This is effectively the inverse algorithm of the + * described Bidi algorithm. Note that there is no standard algorithm for + * this "inverse Bidi", so a number of variants are implemented here.

+ * + *

In other cases, it may be desirable to emulate some variant of the + * Logical to Visual algorithm (e.g. one used in MS Windows), or perform a + * Logical to Logical transformation.

+ * + *
    + *
  • When the reordering mode is set to #UBIDI_REORDER_DEFAULT, + * the standard Bidi Logical to Visual algorithm is applied.
  • + * + *
  • When the reordering mode is set to + * #UBIDI_REORDER_NUMBERS_SPECIAL, + * the algorithm used to perform Bidi transformations when calling + * ubidi_setPara should approximate the algorithm used in + * Microsoft Windows XP rather than strictly conform to the Unicode Bidi + * algorithm. + *
    + * The differences between the basic algorithm and the algorithm addressed + * by this option are as follows: + *
      + *
    • Within text at an even embedding level, the sequence "123AB" + * (where AB represent R or AL letters) is transformed to "123BA" by the + * Unicode algorithm and to "BA123" by the Windows algorithm.
    • + *
    • Arabic-Indic numbers (AN) are handled by the Windows algorithm just + * like regular numbers (EN).
    • + *
  • + * + *
  • When the reordering mode is set to + * #UBIDI_REORDER_GROUP_NUMBERS_WITH_R, + * numbers located between LTR text and RTL text are associated with the RTL + * text. For instance, an LTR paragraph with content "abc 123 DEF" (where + * upper case letters represent RTL characters) will be transformed to + * "abc FED 123" (and not "abc 123 FED"), "DEF 123 abc" will be transformed + * to "123 FED abc" and "123 FED abc" will be transformed to "DEF 123 abc". + * This makes the algorithm reversible and makes it useful when round trip + * (from visual to logical and back to visual) must be achieved without + * adding LRM characters. However, this is a variation from the standard + * Unicode Bidi algorithm.
    + * The source text should not contain Bidi control characters other than LRM + * or RLM.
  • + * + *
  • When the reordering mode is set to + * #UBIDI_REORDER_RUNS_ONLY, + * a "Logical to Logical" transformation must be performed: + *
      + *
    • If the default text level of the source text (argument paraLevel + * in ubidi_setPara) is even, the source text will be handled as + * LTR logical text and will be transformed to the RTL logical text which has + * the same LTR visual display.
    • + *
    • If the default level of the source text is odd, the source text + * will be handled as RTL logical text and will be transformed to the + * LTR logical text which has the same LTR visual display.
    • + *
    + * This mode may be needed when logical text which is basically Arabic or + * Hebrew, with possible included numbers or phrases in English, has to be + * displayed as if it had an even embedding level (this can happen if the + * displaying application treats all text as if it was basically LTR). + *
    + * This mode may also be needed in the reverse case, when logical text which is + * basically English, with possible included phrases in Arabic or Hebrew, has to + * be displayed as if it had an odd embedding level. + *
    + * Both cases could be handled by adding LRE or RLE at the head of the text, + * if the display subsystem supports these formatting controls. If it does not, + * the problem may be handled by transforming the source text in this mode + * before displaying it, so that it will be displayed properly.
    + * The source text should not contain Bidi control characters other than LRM + * or RLM.
  • + * + *
  • When the reordering mode is set to + * #UBIDI_REORDER_INVERSE_NUMBERS_AS_L, an "inverse Bidi" algorithm + * is applied. + * Runs of text with numeric characters will be treated like LTR letters and + * may need to be surrounded with LRM characters when they are written in + * reordered sequence (the option #UBIDI_INSERT_LRM_FOR_NUMERIC can + * be used with function ubidi_writeReordered to this end. This + * mode is equivalent to calling ubidi_setInverse() with + * argument isInverse set to TRUE.
  • + * + *
  • When the reordering mode is set to + * #UBIDI_REORDER_INVERSE_LIKE_DIRECT, the "direct" Logical to Visual + * Bidi algorithm is used as an approximation of an "inverse Bidi" algorithm. + * This mode is similar to mode #UBIDI_REORDER_INVERSE_NUMBERS_AS_L + * but is closer to the regular Bidi algorithm. + *
    + * For example, an LTR paragraph with the content "FED 123 456 CBA" (where + * upper case represents RTL characters) will be transformed to + * "ABC 456 123 DEF", as opposed to "DEF 123 456 ABC" + * with mode UBIDI_REORDER_INVERSE_NUMBERS_AS_L.
    + * When used in conjunction with option + * #UBIDI_OPTION_INSERT_MARKS, this mode generally + * adds Bidi marks to the output significantly more sparingly than mode + * #UBIDI_REORDER_INVERSE_NUMBERS_AS_L with option + * #UBIDI_INSERT_LRM_FOR_NUMERIC in calls to + * ubidi_writeReordered.
  • + * + *
  • When the reordering mode is set to + * #UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL, the Logical to Visual + * Bidi algorithm used in Windows XP is used as an approximation of an "inverse Bidi" algorithm. + *
    + * For example, an LTR paragraph with the content "abc FED123" (where + * upper case represents RTL characters) will be transformed to "abc 123DEF."
  • + *
+ * + *

In all the reordering modes specifying an "inverse Bidi" algorithm + * (i.e. those with a name starting with UBIDI_REORDER_INVERSE), + * output runs should be retrieved using + * ubidi_getVisualRun(), and the output text with + * ubidi_writeReordered(). The caller should keep in mind that in + * "inverse Bidi" modes the input is actually visually ordered text and + * reordered output returned by ubidi_getVisualRun() or + * ubidi_writeReordered() are actually runs or character string + * of logically ordered output.
+ * For all the "inverse Bidi" modes, the source text should not contain + * Bidi control characters other than LRM or RLM.

+ * + *

Note that option #UBIDI_OUTPUT_REVERSE of + * ubidi_writeReordered has no useful meaning and should not be + * used in conjunction with any value of the reordering mode specifying + * "inverse Bidi" or with value UBIDI_REORDER_RUNS_ONLY. + * + * @param pBiDi is a UBiDi object. + * @param reorderingMode specifies the required variant of the Bidi algorithm. + * + * @see UBiDiReorderingMode + * @see ubidi_setInverse + * @see ubidi_setPara + * @see ubidi_writeReordered + * @stable ICU 3.6 + */ +U_STABLE void U_EXPORT2 +ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode); + +/** + * What is the requested reordering mode for a given Bidi object? + * + * @param pBiDi is a UBiDi object. + * @return the current reordering mode of the Bidi object + * @see ubidi_setReorderingMode + * @stable ICU 3.6 + */ +U_STABLE UBiDiReorderingMode U_EXPORT2 +ubidi_getReorderingMode(UBiDi *pBiDi); + +/** + * UBiDiReorderingOption values indicate which options are + * specified to affect the Bidi algorithm. + * + * @see ubidi_setReorderingOptions + * @stable ICU 3.6 + */ +typedef enum UBiDiReorderingOption { + /** + * option value for ubidi_setReorderingOptions: + * disable all the options which can be set with this function + * @see ubidi_setReorderingOptions + * @stable ICU 3.6 + */ + UBIDI_OPTION_DEFAULT = 0, + + /** + * option bit for ubidi_setReorderingOptions: + * insert Bidi marks (LRM or RLM) when needed to ensure correct result of + * a reordering to a Logical order + * + *

This option must be set or reset before calling + * ubidi_setPara.

+ * + *

This option is significant only with reordering modes which generate + * a result with Logical order, specifically:

+ *
    + *
  • #UBIDI_REORDER_RUNS_ONLY
  • + *
  • #UBIDI_REORDER_INVERSE_NUMBERS_AS_L
  • + *
  • #UBIDI_REORDER_INVERSE_LIKE_DIRECT
  • + *
  • #UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL
  • + *
+ * + *

If this option is set in conjunction with reordering mode + * #UBIDI_REORDER_INVERSE_NUMBERS_AS_L or with calling + * ubidi_setInverse(TRUE), it implies + * option #UBIDI_INSERT_LRM_FOR_NUMERIC + * in calls to function ubidi_writeReordered().

+ * + *

For other reordering modes, a minimum number of LRM or RLM characters + * will be added to the source text after reordering it so as to ensure + * round trip, i.e. when applying the inverse reordering mode on the + * resulting logical text with removal of Bidi marks + * (option #UBIDI_OPTION_REMOVE_CONTROLS set before calling + * ubidi_setPara() or option #UBIDI_REMOVE_BIDI_CONTROLS + * in ubidi_writeReordered), the result will be identical to the + * source text in the first transformation. + * + *

This option will be ignored if specified together with option + * #UBIDI_OPTION_REMOVE_CONTROLS. It inhibits option + * UBIDI_REMOVE_BIDI_CONTROLS in calls to function + * ubidi_writeReordered() and it implies option + * #UBIDI_INSERT_LRM_FOR_NUMERIC in calls to function + * ubidi_writeReordered() if the reordering mode is + * #UBIDI_REORDER_INVERSE_NUMBERS_AS_L.

+ * + * @see ubidi_setReorderingMode + * @see ubidi_setReorderingOptions + * @stable ICU 3.6 + */ + UBIDI_OPTION_INSERT_MARKS = 1, + + /** + * option bit for ubidi_setReorderingOptions: + * remove Bidi control characters + * + *

This option must be set or reset before calling + * ubidi_setPara.

+ * + *

This option nullifies option #UBIDI_OPTION_INSERT_MARKS. + * It inhibits option #UBIDI_INSERT_LRM_FOR_NUMERIC in calls + * to function ubidi_writeReordered() and it implies option + * #UBIDI_REMOVE_BIDI_CONTROLS in calls to that function.

+ * + * @see ubidi_setReorderingMode + * @see ubidi_setReorderingOptions + * @stable ICU 3.6 + */ + UBIDI_OPTION_REMOVE_CONTROLS = 2, + + /** + * option bit for ubidi_setReorderingOptions: + * process the output as part of a stream to be continued + * + *

This option must be set or reset before calling + * ubidi_setPara.

+ * + *

This option specifies that the caller is interested in processing large + * text object in parts. + * The results of the successive calls are expected to be concatenated by the + * caller. Only the call for the last part will have this option bit off.

+ * + *

When this option bit is on, ubidi_setPara() may process + * less than the full source text in order to truncate the text at a meaningful + * boundary. The caller should call ubidi_getProcessedLength() + * immediately after calling ubidi_setPara() in order to + * determine how much of the source text has been processed. + * Source text beyond that length should be resubmitted in following calls to + * ubidi_setPara. The processed length may be less than + * the length of the source text if a character preceding the last character of + * the source text constitutes a reasonable boundary (like a block separator) + * for text to be continued.
+ * If the last character of the source text constitutes a reasonable + * boundary, the whole text will be processed at once.
+ * If nowhere in the source text there exists + * such a reasonable boundary, the processed length will be zero.
+ * The caller should check for such an occurrence and do one of the following: + *

  • submit a larger amount of text with a better chance to include + * a reasonable boundary.
  • + *
  • resubmit the same text after turning off option + * UBIDI_OPTION_STREAMING.
+ * In all cases, this option should be turned off before processing the last + * part of the text.

+ * + *

When the UBIDI_OPTION_STREAMING option is used, + * it is recommended to call ubidi_orderParagraphsLTR() with + * argument orderParagraphsLTR set to TRUE before + * calling ubidi_setPara so that later paragraphs may be + * concatenated to previous paragraphs on the right.

+ * + * @see ubidi_setReorderingMode + * @see ubidi_setReorderingOptions + * @see ubidi_getProcessedLength + * @see ubidi_orderParagraphsLTR + * @stable ICU 3.6 + */ + UBIDI_OPTION_STREAMING = 4 +} UBiDiReorderingOption; + +/** + * Specify which of the reordering options + * should be applied during Bidi transformations. + * + * @param pBiDi is a UBiDi object. + * @param reorderingOptions is a combination of zero or more of the following + * options: + * #UBIDI_OPTION_DEFAULT, #UBIDI_OPTION_INSERT_MARKS, + * #UBIDI_OPTION_REMOVE_CONTROLS, #UBIDI_OPTION_STREAMING. + * + * @see ubidi_getReorderingOptions + * @stable ICU 3.6 + */ +U_STABLE void U_EXPORT2 +ubidi_setReorderingOptions(UBiDi *pBiDi, uint32_t reorderingOptions); + +/** + * What are the reordering options applied to a given Bidi object? + * + * @param pBiDi is a UBiDi object. + * @return the current reordering options of the Bidi object + * @see ubidi_setReorderingOptions + * @stable ICU 3.6 + */ +U_STABLE uint32_t U_EXPORT2 +ubidi_getReorderingOptions(UBiDi *pBiDi); + +/** + * Set the context before a call to ubidi_setPara().

+ * + * ubidi_setPara() computes the left-right directionality for a given piece + * of text which is supplied as one of its arguments. Sometimes this piece + * of text (the "main text") should be considered in context, because text + * appearing before ("prologue") and/or after ("epilogue") the main text + * may affect the result of this computation.

+ * + * This function specifies the prologue and/or the epilogue for the next + * call to ubidi_setPara(). The characters specified as prologue and + * epilogue should not be modified by the calling program until the call + * to ubidi_setPara() has returned. If successive calls to ubidi_setPara() + * all need specification of a context, ubidi_setContext() must be called + * before each call to ubidi_setPara(). In other words, a context is not + * "remembered" after the following successful call to ubidi_setPara().

+ * + * If a call to ubidi_setPara() specifies UBIDI_DEFAULT_LTR or + * UBIDI_DEFAULT_RTL as paraLevel and is preceded by a call to + * ubidi_setContext() which specifies a prologue, the paragraph level will + * be computed taking in consideration the text in the prologue.

+ * + * When ubidi_setPara() is called without a previous call to + * ubidi_setContext, the main text is handled as if preceded and followed + * by strong directional characters at the current paragraph level. + * Calling ubidi_setContext() with specification of a prologue will change + * this behavior by handling the main text as if preceded by the last + * strong character appearing in the prologue, if any. + * Calling ubidi_setContext() with specification of an epilogue will change + * the behavior of ubidi_setPara() by handling the main text as if followed + * by the first strong character or digit appearing in the epilogue, if any.

+ * + * Note 1: if ubidi_setContext is called repeatedly without + * calling ubidi_setPara, the earlier calls have no effect, + * only the last call will be remembered for the next call to + * ubidi_setPara.

+ * + * Note 2: calling ubidi_setContext(pBiDi, NULL, 0, NULL, 0, &errorCode) + * cancels any previous setting of non-empty prologue or epilogue. + * The next call to ubidi_setPara() will process no + * prologue or epilogue.

+ * + * Note 3: users must be aware that even after setting the context + * before a call to ubidi_setPara() to perform e.g. a logical to visual + * transformation, the resulting string may not be identical to what it + * would have been if all the text, including prologue and epilogue, had + * been processed together.
+ * Example (upper case letters represent RTL characters):
+ *   prologue = "abc DE"
+ *   epilogue = none
+ *   main text = "FGH xyz"
+ *   paraLevel = UBIDI_LTR
+ *   display without prologue = "HGF xyz" + * ("HGF" is adjacent to "xyz")
+ *   display with prologue = "abc HGFED xyz" + * ("HGF" is not adjacent to "xyz")
+ * + * @param pBiDi is a paragraph UBiDi object. + * + * @param prologue is a pointer to the text which precedes the text that + * will be specified in a coming call to ubidi_setPara(). + * If there is no prologue to consider, then proLength + * must be zero and this pointer can be NULL. + * + * @param proLength is the length of the prologue; if proLength==-1 + * then the prologue must be zero-terminated. + * Otherwise proLength must be >= 0. If proLength==0, it means + * that there is no prologue to consider. + * + * @param epilogue is a pointer to the text which follows the text that + * will be specified in a coming call to ubidi_setPara(). + * If there is no epilogue to consider, then epiLength + * must be zero and this pointer can be NULL. + * + * @param epiLength is the length of the epilogue; if epiLength==-1 + * then the epilogue must be zero-terminated. + * Otherwise epiLength must be >= 0. If epiLength==0, it means + * that there is no epilogue to consider. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @see ubidi_setPara + * @stable ICU 4.8 + */ +U_STABLE void U_EXPORT2 +ubidi_setContext(UBiDi *pBiDi, + const UChar *prologue, int32_t proLength, + const UChar *epilogue, int32_t epiLength, + UErrorCode *pErrorCode); + +/** + * Perform the Unicode Bidi algorithm. It is defined in the + * Unicode Standard Anned #9, + * version 13, + * also described in The Unicode Standard, Version 4.0 .

+ * + * This function takes a piece of plain text containing one or more paragraphs, + * with or without externally specified embedding levels from styled + * text and computes the left-right-directionality of each character.

+ * + * If the entire text is all of the same directionality, then + * the function may not perform all the steps described by the algorithm, + * i.e., some levels may not be the same as if all steps were performed. + * This is not relevant for unidirectional text.
+ * For example, in pure LTR text with numbers the numbers would get + * a resolved level of 2 higher than the surrounding text according to + * the algorithm. This implementation may set all resolved levels to + * the same value in such a case.

+ * + * The text can be composed of multiple paragraphs. Occurrence of a block + * separator in the text terminates a paragraph, and whatever comes next starts + * a new paragraph. The exception to this rule is when a Carriage Return (CR) + * is followed by a Line Feed (LF). Both CR and LF are block separators, but + * in that case, the pair of characters is considered as terminating the + * preceding paragraph, and a new paragraph will be started by a character + * coming after the LF. + * + * @param pBiDi A UBiDi object allocated with ubidi_open() + * which will be set to contain the reordering information, + * especially the resolved levels for all the characters in text. + * + * @param text is a pointer to the text that the Bidi algorithm will be performed on. + * This pointer is stored in the UBiDi object and can be retrieved + * with ubidi_getText().
+ * Note: the text must be (at least) length long. + * + * @param length is the length of the text; if length==-1 then + * the text must be zero-terminated. + * + * @param paraLevel specifies the default level for the text; + * it is typically 0 (LTR) or 1 (RTL). + * If the function shall determine the paragraph level from the text, + * then paraLevel can be set to + * either #UBIDI_DEFAULT_LTR + * or #UBIDI_DEFAULT_RTL; if the text contains multiple + * paragraphs, the paragraph level shall be determined separately for + * each paragraph; if a paragraph does not include any strongly typed + * character, then the desired default is used (0 for LTR or 1 for RTL). + * Any other value between 0 and #UBIDI_MAX_EXPLICIT_LEVEL + * is also valid, with odd levels indicating RTL. + * + * @param embeddingLevels (in) may be used to preset the embedding and override levels, + * ignoring characters like LRE and PDF in the text. + * A level overrides the directional property of its corresponding + * (same index) character if the level has the + * #UBIDI_LEVEL_OVERRIDE bit set.

+ * Aside from that bit, it must be + * paraLevel<=embeddingLevels[]<=UBIDI_MAX_EXPLICIT_LEVEL, + * except that level 0 is always allowed. + * Level 0 for a paragraph separator prevents reordering of paragraphs; + * this only works reliably if #UBIDI_LEVEL_OVERRIDE + * is also set for paragraph separators. + * Level 0 for other characters is treated as a wildcard + * and is lifted up to the resolved level of the surrounding paragraph.

+ * Caution: A copy of this pointer, not of the levels, + * will be stored in the UBiDi object; + * the embeddingLevels array must not be + * deallocated before the UBiDi structure is destroyed or reused, + * and the embeddingLevels + * should not be modified to avoid unexpected results on subsequent Bidi operations. + * However, the ubidi_setPara() and + * ubidi_setLine() functions may modify some or all of the levels.

+ * After the UBiDi object is reused or destroyed, the caller + * must take care of the deallocation of the embeddingLevels array.

+ * Note: the embeddingLevels array must be + * at least length long. + * This pointer can be NULL if this + * value is not necessary. + * + * @param pErrorCode must be a valid pointer to an error code value. + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length, + UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels, + UErrorCode *pErrorCode); + +/** + * ubidi_setLine() sets a UBiDi to + * contain the reordering information, especially the resolved levels, + * for all the characters in a line of text. This line of text is + * specified by referring to a UBiDi object representing + * this information for a piece of text containing one or more paragraphs, + * and by specifying a range of indexes in this text.

+ * In the new line object, the indexes will range from 0 to limit-start-1.

+ * + * This is used after calling ubidi_setPara() + * for a piece of text, and after line-breaking on that text. + * It is not necessary if each paragraph is treated as a single line.

+ * + * After line-breaking, rules (L1) and (L2) for the treatment of + * trailing WS and for reordering are performed on + * a UBiDi object that represents a line.

+ * + * Important: pLineBiDi shares data with + * pParaBiDi. + * You must destroy or reuse pLineBiDi before pParaBiDi. + * In other words, you must destroy or reuse the UBiDi object for a line + * before the object for its parent paragraph.

+ * + * The text pointer that was stored in pParaBiDi is also copied, + * and start is added to it so that it points to the beginning of the + * line for this object. + * + * @param pParaBiDi is the parent paragraph object. It must have been set + * by a successful call to ubidi_setPara. + * + * @param start is the line's first index into the text. + * + * @param limit is just behind the line's last index into the text + * (its last index +1).
+ * It must be 0<=startcontaining paragraph limit. + * If the specified line crosses a paragraph boundary, the function + * will terminate with error code U_ILLEGAL_ARGUMENT_ERROR. + * + * @param pLineBiDi is the object that will now represent a line of the text. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @see ubidi_setPara + * @see ubidi_getProcessedLength + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ubidi_setLine(const UBiDi *pParaBiDi, + int32_t start, int32_t limit, + UBiDi *pLineBiDi, + UErrorCode *pErrorCode); + +/** + * Get the directionality of the text. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @return a value of UBIDI_LTR, UBIDI_RTL + * or UBIDI_MIXED + * that indicates if the entire text + * represented by this object is unidirectional, + * and which direction, or if it is mixed-directional. + * Note - The value UBIDI_NEUTRAL is never returned from this method. + * + * @see UBiDiDirection + * @stable ICU 2.0 + */ +U_STABLE UBiDiDirection U_EXPORT2 +ubidi_getDirection(const UBiDi *pBiDi); + +/** + * Gets the base direction of the text provided according + * to the Unicode Bidirectional Algorithm. The base direction + * is derived from the first character in the string with bidirectional + * character type L, R, or AL. If the first such character has type L, + * UBIDI_LTR is returned. If the first such character has + * type R or AL, UBIDI_RTL is returned. If the string does + * not contain any character of these types, then + * UBIDI_NEUTRAL is returned. + * + * This is a lightweight function for use when only the base direction + * is needed and no further bidi processing of the text is needed. + * + * @param text is a pointer to the text whose base + * direction is needed. + * Note: the text must be (at least) @c length long. + * + * @param length is the length of the text; + * if length==-1 then the text + * must be zero-terminated. + * + * @return UBIDI_LTR, UBIDI_RTL, + * UBIDI_NEUTRAL + * + * @see UBiDiDirection + * @stable ICU 4.6 + */ +U_STABLE UBiDiDirection U_EXPORT2 +ubidi_getBaseDirection(const UChar *text, int32_t length ); + +/** + * Get the pointer to the text. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @return The pointer to the text that the UBiDi object was created for. + * + * @see ubidi_setPara + * @see ubidi_setLine + * @stable ICU 2.0 + */ +U_STABLE const UChar * U_EXPORT2 +ubidi_getText(const UBiDi *pBiDi); + +/** + * Get the length of the text. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @return The length of the text that the UBiDi object was created for. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ubidi_getLength(const UBiDi *pBiDi); + +/** + * Get the paragraph level of the text. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @return The paragraph level. If there are multiple paragraphs, their + * level may vary if the required paraLevel is UBIDI_DEFAULT_LTR or + * UBIDI_DEFAULT_RTL. In that case, the level of the first paragraph + * is returned. + * + * @see UBiDiLevel + * @see ubidi_getParagraph + * @see ubidi_getParagraphByIndex + * @stable ICU 2.0 + */ +U_STABLE UBiDiLevel U_EXPORT2 +ubidi_getParaLevel(const UBiDi *pBiDi); + +/** + * Get the number of paragraphs. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @return The number of paragraphs. + * @stable ICU 3.4 + */ +U_STABLE int32_t U_EXPORT2 +ubidi_countParagraphs(UBiDi *pBiDi); + +/** + * Get a paragraph, given a position within the text. + * This function returns information about a paragraph.
+ * Note: if the paragraph index is known, it is more efficient to + * retrieve the paragraph information using ubidi_getParagraphByIndex().

+ * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @param charIndex is the index of a character within the text, in the + * range [0..ubidi_getProcessedLength(pBiDi)-1]. + * + * @param pParaStart will receive the index of the first character of the + * paragraph in the text. + * This pointer can be NULL if this + * value is not necessary. + * + * @param pParaLimit will receive the limit of the paragraph. + * The l-value that you point to here may be the + * same expression (variable) as the one for + * charIndex. + * This pointer can be NULL if this + * value is not necessary. + * + * @param pParaLevel will receive the level of the paragraph. + * This pointer can be NULL if this + * value is not necessary. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @return The index of the paragraph containing the specified position. + * + * @see ubidi_getProcessedLength + * @stable ICU 3.4 + */ +U_STABLE int32_t U_EXPORT2 +ubidi_getParagraph(const UBiDi *pBiDi, int32_t charIndex, int32_t *pParaStart, + int32_t *pParaLimit, UBiDiLevel *pParaLevel, + UErrorCode *pErrorCode); + +/** + * Get a paragraph, given the index of this paragraph. + * + * This function returns information about a paragraph.

+ * + * @param pBiDi is the paragraph UBiDi object. + * + * @param paraIndex is the number of the paragraph, in the + * range [0..ubidi_countParagraphs(pBiDi)-1]. + * + * @param pParaStart will receive the index of the first character of the + * paragraph in the text. + * This pointer can be NULL if this + * value is not necessary. + * + * @param pParaLimit will receive the limit of the paragraph. + * This pointer can be NULL if this + * value is not necessary. + * + * @param pParaLevel will receive the level of the paragraph. + * This pointer can be NULL if this + * value is not necessary. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @stable ICU 3.4 + */ +U_STABLE void U_EXPORT2 +ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex, + int32_t *pParaStart, int32_t *pParaLimit, + UBiDiLevel *pParaLevel, UErrorCode *pErrorCode); + +/** + * Get the level for one character. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @param charIndex the index of a character. It must be in the range + * [0..ubidi_getProcessedLength(pBiDi)]. + * + * @return The level for the character at charIndex (0 if charIndex is not + * in the valid range). + * + * @see UBiDiLevel + * @see ubidi_getProcessedLength + * @stable ICU 2.0 + */ +U_STABLE UBiDiLevel U_EXPORT2 +ubidi_getLevelAt(const UBiDi *pBiDi, int32_t charIndex); + +/** + * Get an array of levels for each character.

+ * + * Note that this function may allocate memory under some + * circumstances, unlike ubidi_getLevelAt(). + * + * @param pBiDi is the paragraph or line UBiDi object, whose + * text length must be strictly positive. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @return The levels array for the text, + * or NULL if an error occurs. + * + * @see UBiDiLevel + * @see ubidi_getProcessedLength + * @stable ICU 2.0 + */ +U_STABLE const UBiDiLevel * U_EXPORT2 +ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode); + +/** + * Get a logical run. + * This function returns information about a run and is used + * to retrieve runs in logical order.

+ * This is especially useful for line-breaking on a paragraph. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @param logicalPosition is a logical position within the source text. + * + * @param pLogicalLimit will receive the limit of the corresponding run. + * The l-value that you point to here may be the + * same expression (variable) as the one for + * logicalPosition. + * This pointer can be NULL if this + * value is not necessary. + * + * @param pLevel will receive the level of the corresponding run. + * This pointer can be NULL if this + * value is not necessary. + * + * @see ubidi_getProcessedLength + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalPosition, + int32_t *pLogicalLimit, UBiDiLevel *pLevel); + +/** + * Get the number of runs. + * This function may invoke the actual reordering on the + * UBiDi object, after ubidi_setPara() + * may have resolved only the levels of the text. Therefore, + * ubidi_countRuns() may have to allocate memory, + * and may fail doing so. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @return The number of runs. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode); + +/** + * Get one run's logical start, length, and directionality, + * which can be 0 for LTR or 1 for RTL. + * In an RTL run, the character at the logical start is + * visually on the right of the displayed run. + * The length is the number of characters in the run.

+ * ubidi_countRuns() should be called + * before the runs are retrieved. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @param runIndex is the number of the run in visual order, in the + * range [0..ubidi_countRuns(pBiDi)-1]. + * + * @param pLogicalStart is the first logical character index in the text. + * The pointer may be NULL if this index is not needed. + * + * @param pLength is the number of characters (at least one) in the run. + * The pointer may be NULL if this is not needed. + * + * @return the directionality of the run, + * UBIDI_LTR==0 or UBIDI_RTL==1, + * never UBIDI_MIXED, + * never UBIDI_NEUTRAL. + * + * @see ubidi_countRuns + * + * Example: + *

+ * \code
+ * int32_t i, count=ubidi_countRuns(pBiDi),
+ *         logicalStart, visualIndex=0, length;
+ * for(i=0; i0);
+ *     } else {
+ *         logicalStart+=length;  // logicalLimit
+ *         do { // RTL
+ *             show_char(text[--logicalStart], visualIndex++);
+ *         } while(--length>0);
+ *     }
+ * }
+ *\endcode
+ * 
+ * + * Note that in right-to-left runs, code like this places + * second surrogates before first ones (which is generally a bad idea) + * and combining characters before base characters. + *

+ * Use of ubidi_writeReordered(), optionally with the + * #UBIDI_KEEP_BASE_COMBINING option, can be considered in order + * to avoid these issues. + * @stable ICU 2.0 + */ +U_STABLE UBiDiDirection U_EXPORT2 +ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex, + int32_t *pLogicalStart, int32_t *pLength); + +/** + * Get the visual position from a logical text position. + * If such a mapping is used many times on the same + * UBiDi object, then calling + * ubidi_getLogicalMap() is more efficient.

+ * + * The value returned may be #UBIDI_MAP_NOWHERE if there is no + * visual position because the corresponding text character is a Bidi control + * removed from output by the option #UBIDI_OPTION_REMOVE_CONTROLS. + *

+ * When the visual output is altered by using options of + * ubidi_writeReordered() such as UBIDI_INSERT_LRM_FOR_NUMERIC, + * UBIDI_KEEP_BASE_COMBINING, UBIDI_OUTPUT_REVERSE, + * UBIDI_REMOVE_BIDI_CONTROLS, the visual position returned may not + * be correct. It is advised to use, when possible, reordering options + * such as UBIDI_OPTION_INSERT_MARKS and UBIDI_OPTION_REMOVE_CONTROLS. + *

+ * Note that in right-to-left runs, this mapping places + * second surrogates before first ones (which is generally a bad idea) + * and combining characters before base characters. + * Use of ubidi_writeReordered(), optionally with the + * #UBIDI_KEEP_BASE_COMBINING option can be considered instead + * of using the mapping, in order to avoid these issues. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @param logicalIndex is the index of a character in the text. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @return The visual position of this character. + * + * @see ubidi_getLogicalMap + * @see ubidi_getLogicalIndex + * @see ubidi_getProcessedLength + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode); + +/** + * Get the logical text position from a visual position. + * If such a mapping is used many times on the same + * UBiDi object, then calling + * ubidi_getVisualMap() is more efficient.

+ * + * The value returned may be #UBIDI_MAP_NOWHERE if there is no + * logical position because the corresponding text character is a Bidi mark + * inserted in the output by option #UBIDI_OPTION_INSERT_MARKS. + *

+ * This is the inverse function to ubidi_getVisualIndex(). + *

+ * When the visual output is altered by using options of + * ubidi_writeReordered() such as UBIDI_INSERT_LRM_FOR_NUMERIC, + * UBIDI_KEEP_BASE_COMBINING, UBIDI_OUTPUT_REVERSE, + * UBIDI_REMOVE_BIDI_CONTROLS, the logical position returned may not + * be correct. It is advised to use, when possible, reordering options + * such as UBIDI_OPTION_INSERT_MARKS and UBIDI_OPTION_REMOVE_CONTROLS. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @param visualIndex is the visual position of a character. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @return The index of this character in the text. + * + * @see ubidi_getVisualMap + * @see ubidi_getVisualIndex + * @see ubidi_getResultLength + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode); + +/** + * Get a logical-to-visual index map (array) for the characters in the UBiDi + * (paragraph or line) object. + *

+ * Some values in the map may be #UBIDI_MAP_NOWHERE if the + * corresponding text characters are Bidi controls removed from the visual + * output by the option #UBIDI_OPTION_REMOVE_CONTROLS. + *

+ * When the visual output is altered by using options of + * ubidi_writeReordered() such as UBIDI_INSERT_LRM_FOR_NUMERIC, + * UBIDI_KEEP_BASE_COMBINING, UBIDI_OUTPUT_REVERSE, + * UBIDI_REMOVE_BIDI_CONTROLS, the visual positions returned may not + * be correct. It is advised to use, when possible, reordering options + * such as UBIDI_OPTION_INSERT_MARKS and UBIDI_OPTION_REMOVE_CONTROLS. + *

+ * Note that in right-to-left runs, this mapping places + * second surrogates before first ones (which is generally a bad idea) + * and combining characters before base characters. + * Use of ubidi_writeReordered(), optionally with the + * #UBIDI_KEEP_BASE_COMBINING option can be considered instead + * of using the mapping, in order to avoid these issues. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @param indexMap is a pointer to an array of ubidi_getProcessedLength() + * indexes which will reflect the reordering of the characters. + * If option #UBIDI_OPTION_INSERT_MARKS is set, the number + * of elements allocated in indexMap must be no less than + * ubidi_getResultLength(). + * The array does not need to be initialized.

+ * The index map will result in indexMap[logicalIndex]==visualIndex. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @see ubidi_getVisualMap + * @see ubidi_getVisualIndex + * @see ubidi_getProcessedLength + * @see ubidi_getResultLength + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode); + +/** + * Get a visual-to-logical index map (array) for the characters in the UBiDi + * (paragraph or line) object. + *

+ * Some values in the map may be #UBIDI_MAP_NOWHERE if the + * corresponding text characters are Bidi marks inserted in the visual output + * by the option #UBIDI_OPTION_INSERT_MARKS. + *

+ * When the visual output is altered by using options of + * ubidi_writeReordered() such as UBIDI_INSERT_LRM_FOR_NUMERIC, + * UBIDI_KEEP_BASE_COMBINING, UBIDI_OUTPUT_REVERSE, + * UBIDI_REMOVE_BIDI_CONTROLS, the logical positions returned may not + * be correct. It is advised to use, when possible, reordering options + * such as UBIDI_OPTION_INSERT_MARKS and UBIDI_OPTION_REMOVE_CONTROLS. + * + * @param pBiDi is the paragraph or line UBiDi object. + * + * @param indexMap is a pointer to an array of ubidi_getResultLength() + * indexes which will reflect the reordering of the characters. + * If option #UBIDI_OPTION_REMOVE_CONTROLS is set, the number + * of elements allocated in indexMap must be no less than + * ubidi_getProcessedLength(). + * The array does not need to be initialized.

+ * The index map will result in indexMap[visualIndex]==logicalIndex. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @see ubidi_getLogicalMap + * @see ubidi_getLogicalIndex + * @see ubidi_getProcessedLength + * @see ubidi_getResultLength + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode); + +/** + * This is a convenience function that does not use a UBiDi object. + * It is intended to be used for when an application has determined the levels + * of objects (character sequences) and just needs to have them reordered (L2). + * This is equivalent to using ubidi_getLogicalMap() on a + * UBiDi object. + * + * @param levels is an array with length levels that have been determined by + * the application. + * + * @param length is the number of levels in the array, or, semantically, + * the number of objects to be reordered. + * It must be length>0. + * + * @param indexMap is a pointer to an array of length + * indexes which will reflect the reordering of the characters. + * The array does not need to be initialized.

+ * The index map will result in indexMap[logicalIndex]==visualIndex. + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap); + +/** + * This is a convenience function that does not use a UBiDi object. + * It is intended to be used for when an application has determined the levels + * of objects (character sequences) and just needs to have them reordered (L2). + * This is equivalent to using ubidi_getVisualMap() on a + * UBiDi object. + * + * @param levels is an array with length levels that have been determined by + * the application. + * + * @param length is the number of levels in the array, or, semantically, + * the number of objects to be reordered. + * It must be length>0. + * + * @param indexMap is a pointer to an array of length + * indexes which will reflect the reordering of the characters. + * The array does not need to be initialized.

+ * The index map will result in indexMap[visualIndex]==logicalIndex. + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap); + +/** + * Invert an index map. + * The index mapping of the first map is inverted and written to + * the second one. + * + * @param srcMap is an array with length elements + * which defines the original mapping from a source array containing + * length elements to a destination array. + * Some elements of the source array may have no mapping in the + * destination array. In that case, their value will be + * the special value UBIDI_MAP_NOWHERE. + * All elements must be >=0 or equal to UBIDI_MAP_NOWHERE. + * Some elements may have a value >= length, if the + * destination array has more elements than the source array. + * There must be no duplicate indexes (two or more elements with the + * same value except UBIDI_MAP_NOWHERE). + * + * @param destMap is an array with a number of elements equal to 1 + the highest + * value in srcMap. + * destMap will be filled with the inverse mapping. + * If element with index i in srcMap has a value k different + * from UBIDI_MAP_NOWHERE, this means that element i of + * the source array maps to element k in the destination array. + * The inverse map will have value i in its k-th element. + * For all elements of the destination array which do not map to + * an element in the source array, the corresponding element in the + * inverse map will have a value equal to UBIDI_MAP_NOWHERE. + * + * @param length is the length of each array. + * @see UBIDI_MAP_NOWHERE + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length); + +/** option flags for ubidi_writeReordered() */ + +/** + * option bit for ubidi_writeReordered(): + * keep combining characters after their base characters in RTL runs + * + * @see ubidi_writeReordered + * @stable ICU 2.0 + */ +#define UBIDI_KEEP_BASE_COMBINING 1 + +/** + * option bit for ubidi_writeReordered(): + * replace characters with the "mirrored" property in RTL runs + * by their mirror-image mappings + * + * @see ubidi_writeReordered + * @stable ICU 2.0 + */ +#define UBIDI_DO_MIRRORING 2 + +/** + * option bit for ubidi_writeReordered(): + * surround the run with LRMs if necessary; + * this is part of the approximate "inverse Bidi" algorithm + * + *

This option does not imply corresponding adjustment of the index + * mappings.

+ * + * @see ubidi_setInverse + * @see ubidi_writeReordered + * @stable ICU 2.0 + */ +#define UBIDI_INSERT_LRM_FOR_NUMERIC 4 + +/** + * option bit for ubidi_writeReordered(): + * remove Bidi control characters + * (this does not affect #UBIDI_INSERT_LRM_FOR_NUMERIC) + * + *

This option does not imply corresponding adjustment of the index + * mappings.

+ * + * @see ubidi_writeReordered + * @stable ICU 2.0 + */ +#define UBIDI_REMOVE_BIDI_CONTROLS 8 + +/** + * option bit for ubidi_writeReordered(): + * write the output in reverse order + * + *

This has the same effect as calling ubidi_writeReordered() + * first without this option, and then calling + * ubidi_writeReverse() without mirroring. + * Doing this in the same step is faster and avoids a temporary buffer. + * An example for using this option is output to a character terminal that + * is designed for RTL scripts and stores text in reverse order.

+ * + * @see ubidi_writeReordered + * @stable ICU 2.0 + */ +#define UBIDI_OUTPUT_REVERSE 16 + +/** + * Get the length of the source text processed by the last call to + * ubidi_setPara(). This length may be different from the length + * of the source text if option #UBIDI_OPTION_STREAMING + * has been set. + *
+ * Note that whenever the length of the text affects the execution or the + * result of a function, it is the processed length which must be considered, + * except for ubidi_setPara (which receives unprocessed source + * text) and ubidi_getLength (which returns the original length + * of the source text).
+ * In particular, the processed length is the one to consider in the following + * cases: + *
    + *
  • maximum value of the limit argument of + * ubidi_setLine
  • + *
  • maximum value of the charIndex argument of + * ubidi_getParagraph
  • + *
  • maximum value of the charIndex argument of + * ubidi_getLevelAt
  • + *
  • number of elements in the array returned by ubidi_getLevels
  • + *
  • maximum value of the logicalStart argument of + * ubidi_getLogicalRun
  • + *
  • maximum value of the logicalIndex argument of + * ubidi_getVisualIndex
  • + *
  • number of elements filled in the *indexMap argument of + * ubidi_getLogicalMap
  • + *
  • length of text processed by ubidi_writeReordered
  • + *
+ * + * @param pBiDi is the paragraph UBiDi object. + * + * @return The length of the part of the source text processed by + * the last call to ubidi_setPara. + * @see ubidi_setPara + * @see UBIDI_OPTION_STREAMING + * @stable ICU 3.6 + */ +U_STABLE int32_t U_EXPORT2 +ubidi_getProcessedLength(const UBiDi *pBiDi); + +/** + * Get the length of the reordered text resulting from the last call to + * ubidi_setPara(). This length may be different from the length + * of the source text if option #UBIDI_OPTION_INSERT_MARKS + * or option #UBIDI_OPTION_REMOVE_CONTROLS has been set. + *
+ * This resulting length is the one to consider in the following cases: + *
    + *
  • maximum value of the visualIndex argument of + * ubidi_getLogicalIndex
  • + *
  • number of elements of the *indexMap argument of + * ubidi_getVisualMap
  • + *
+ * Note that this length stays identical to the source text length if + * Bidi marks are inserted or removed using option bits of + * ubidi_writeReordered, or if option + * #UBIDI_REORDER_INVERSE_NUMBERS_AS_L has been set. + * + * @param pBiDi is the paragraph UBiDi object. + * + * @return The length of the reordered text resulting from + * the last call to ubidi_setPara. + * @see ubidi_setPara + * @see UBIDI_OPTION_INSERT_MARKS + * @see UBIDI_OPTION_REMOVE_CONTROLS + * @stable ICU 3.6 + */ +U_STABLE int32_t U_EXPORT2 +ubidi_getResultLength(const UBiDi *pBiDi); + +U_CDECL_BEGIN + +#ifndef U_HIDE_DEPRECATED_API +/** + * Value returned by UBiDiClassCallback callbacks when + * there is no need to override the standard Bidi class for a given code point. + * + * This constant is deprecated; use u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)+1 instead. + * + * @see UBiDiClassCallback + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ +#define U_BIDI_CLASS_DEFAULT U_CHAR_DIRECTION_COUNT +#endif // U_HIDE_DEPRECATED_API + +/** + * Callback type declaration for overriding default Bidi class values with + * custom ones. + *

Usually, the function pointer will be propagated to a UBiDi + * object by calling the ubidi_setClassCallback() function; + * then the callback will be invoked by the UBA implementation any time the + * class of a character is to be determined.

+ * + * @param context is a pointer to the callback private data. + * + * @param c is the code point to get a Bidi class for. + * + * @return The directional property / Bidi class for the given code point + * c if the default class has been overridden, or + * #U_BIDI_CLASS_DEFAULT=u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)+1 + * if the standard Bidi class value for c is to be used. + * @see ubidi_setClassCallback + * @see ubidi_getClassCallback + * @stable ICU 3.6 + */ +typedef UCharDirection U_CALLCONV +UBiDiClassCallback(const void *context, UChar32 c); + +U_CDECL_END + +/** + * Retrieve the Bidi class for a given code point. + *

If a #UBiDiClassCallback callback is defined and returns a + * value other than #U_BIDI_CLASS_DEFAULT=u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS)+1, + * that value is used; otherwise the default class determination mechanism is invoked.

+ * + * @param pBiDi is the paragraph UBiDi object. + * + * @param c is the code point whose Bidi class must be retrieved. + * + * @return The Bidi class for character c based + * on the given pBiDi instance. + * @see UBiDiClassCallback + * @stable ICU 3.6 + */ +U_STABLE UCharDirection U_EXPORT2 +ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c); + +/** + * Set the callback function and callback data used by the UBA + * implementation for Bidi class determination. + *

This may be useful for assigning Bidi classes to PUA characters, or + * for special application needs. For instance, an application may want to + * handle all spaces like L or R characters (according to the base direction) + * when creating the visual ordering of logical lines which are part of a report + * organized in columns: there should not be interaction between adjacent + * cells.

+ * + * @param pBiDi is the paragraph UBiDi object. + * + * @param newFn is the new callback function pointer. + * + * @param newContext is the new callback context pointer. This can be NULL. + * + * @param oldFn fillin: Returns the old callback function pointer. This can be + * NULL. + * + * @param oldContext fillin: Returns the old callback's context. This can be + * NULL. + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @see ubidi_getClassCallback + * @stable ICU 3.6 + */ +U_STABLE void U_EXPORT2 +ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn, + const void *newContext, UBiDiClassCallback **oldFn, + const void **oldContext, UErrorCode *pErrorCode); + +/** + * Get the current callback function used for Bidi class determination. + * + * @param pBiDi is the paragraph UBiDi object. + * + * @param fn fillin: Returns the callback function pointer. + * + * @param context fillin: Returns the callback's private context. + * + * @see ubidi_setClassCallback + * @stable ICU 3.6 + */ +U_STABLE void U_EXPORT2 +ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **context); + +/** + * Take a UBiDi object containing the reordering + * information for a piece of text (one or more paragraphs) set by + * ubidi_setPara() or for a line of text set by + * ubidi_setLine() and write a reordered string to the + * destination buffer. + * + * This function preserves the integrity of characters with multiple + * code units and (optionally) combining characters. + * Characters in RTL runs can be replaced by mirror-image characters + * in the destination buffer. Note that "real" mirroring has + * to be done in a rendering engine by glyph selection + * and that for many "mirrored" characters there are no + * Unicode characters as mirror-image equivalents. + * There are also options to insert or remove Bidi control + * characters; see the description of the destSize + * and options parameters and of the option bit flags. + * + * @param pBiDi A pointer to a UBiDi object that + * is set by ubidi_setPara() or + * ubidi_setLine() and contains the reordering + * information for the text that it was defined for, + * as well as a pointer to that text.

+ * The text was aliased (only the pointer was stored + * without copying the contents) and must not have been modified + * since the ubidi_setPara() call. + * + * @param dest A pointer to where the reordered text is to be copied. + * The source text and dest[destSize] + * must not overlap. + * + * @param destSize The size of the dest buffer, + * in number of UChars. + * If the UBIDI_INSERT_LRM_FOR_NUMERIC + * option is set, then the destination length could be + * as large as + * ubidi_getLength(pBiDi)+2*ubidi_countRuns(pBiDi). + * If the UBIDI_REMOVE_BIDI_CONTROLS option + * is set, then the destination length may be less than + * ubidi_getLength(pBiDi). + * If none of these options is set, then the destination length + * will be exactly ubidi_getProcessedLength(pBiDi). + * + * @param options A bit set of options for the reordering that control + * how the reordered text is written. + * The options include mirroring the characters on a code + * point basis and inserting LRM characters, which is used + * especially for transforming visually stored text + * to logically stored text (although this is still an + * imperfect implementation of an "inverse Bidi" algorithm + * because it uses the "forward Bidi" algorithm at its core). + * The available options are: + * #UBIDI_DO_MIRRORING, + * #UBIDI_INSERT_LRM_FOR_NUMERIC, + * #UBIDI_KEEP_BASE_COMBINING, + * #UBIDI_OUTPUT_REVERSE, + * #UBIDI_REMOVE_BIDI_CONTROLS + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @return The length of the output string. + * + * @see ubidi_getProcessedLength + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ubidi_writeReordered(UBiDi *pBiDi, + UChar *dest, int32_t destSize, + uint16_t options, + UErrorCode *pErrorCode); + +/** + * Reverse a Right-To-Left run of Unicode text. + * + * This function preserves the integrity of characters with multiple + * code units and (optionally) combining characters. + * Characters can be replaced by mirror-image characters + * in the destination buffer. Note that "real" mirroring has + * to be done in a rendering engine by glyph selection + * and that for many "mirrored" characters there are no + * Unicode characters as mirror-image equivalents. + * There are also options to insert or remove Bidi control + * characters. + * + * This function is the implementation for reversing RTL runs as part + * of ubidi_writeReordered(). For detailed descriptions + * of the parameters, see there. + * Since no Bidi controls are inserted here, the output string length + * will never exceed srcLength. + * + * @see ubidi_writeReordered + * + * @param src A pointer to the RTL run text. + * + * @param srcLength The length of the RTL run. + * + * @param dest A pointer to where the reordered text is to be copied. + * src[srcLength] and dest[destSize] + * must not overlap. + * + * @param destSize The size of the dest buffer, + * in number of UChars. + * If the UBIDI_REMOVE_BIDI_CONTROLS option + * is set, then the destination length may be less than + * srcLength. + * If this option is not set, then the destination length + * will be exactly srcLength. + * + * @param options A bit set of options for the reordering that control + * how the reordered text is written. + * See the options parameter in ubidi_writeReordered(). + * + * @param pErrorCode must be a valid pointer to an error code value. + * + * @return The length of the output string. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ubidi_writeReverse(const UChar *src, int32_t srcLength, + UChar *dest, int32_t destSize, + uint16_t options, + UErrorCode *pErrorCode); + +/*#define BIDI_SAMPLE_CODE*/ +/*@}*/ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ubiditransform.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ubiditransform.h new file mode 100644 index 0000000..627b005 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ubiditransform.h @@ -0,0 +1,318 @@ +/* +****************************************************************************** +* +* © 2016 and later: Unicode, Inc. and others. +* License & terms of use: http://www.unicode.org/copyright.html +* +****************************************************************************** +* file name: ubiditransform.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2016jul24 +* created by: Lina Kemmel +* +*/ + +#ifndef UBIDITRANSFORM_H +#define UBIDITRANSFORM_H + +#include "unicode/utypes.h" +#include "unicode/ubidi.h" +#include "unicode/uchar.h" +#include "unicode/localpointer.h" + +/** + * \file + * \brief Bidi Transformations + * + * UBiDiOrder indicates the order of text.

+ * This bidi transformation engine supports all possible combinations (4 in + * total) of input and output text order: + *

    + *
  • : unless the output direction is RTL, this + * corresponds to a normal operation of the Bidi algorithm as described in the + * Unicode Technical Report and implemented by UBiDi when the + * reordering mode is set to UBIDI_REORDER_DEFAULT. Visual RTL + * mode is not supported by UBiDi and is accomplished through + * reversing a visual LTR string,
  • + *
  • : unless the input direction is RTL, this + * corresponds to an "inverse bidi algorithm" in UBiDi with the + * reordering mode set to UBIDI_REORDER_INVERSE_LIKE_DIRECT. + * Visual RTL mode is not not supported by UBiDi and is + * accomplished through reversing a visual LTR string,
  • + *
  • : if the input and output base directions + * mismatch, this corresponds to the UBiDi implementation with the + * reordering mode set to UBIDI_REORDER_RUNS_ONLY; and if the + * input and output base directions are identical, the transformation engine + * will only handle character mirroring and Arabic shaping operations without + * reordering,
  • + *
  • : this reordering mode is not supported by + * the UBiDi engine; it implies character mirroring, Arabic + * shaping, and - if the input/output base directions mismatch - string + * reverse operations.
  • + *
+ * @see ubidi_setInverse + * @see ubidi_setReorderingMode + * @see UBIDI_REORDER_DEFAULT + * @see UBIDI_REORDER_INVERSE_LIKE_DIRECT + * @see UBIDI_REORDER_RUNS_ONLY + * @stable ICU 58 + */ +typedef enum { + /** 0: Constant indicating a logical order. + * This is the default for input text. + * @stable ICU 58 + */ + UBIDI_LOGICAL = 0, + /** 1: Constant indicating a visual order. + * This is a default for output text. + * @stable ICU 58 + */ + UBIDI_VISUAL +} UBiDiOrder; + +/** + * UBiDiMirroring indicates whether or not characters with the + * "mirrored" property in RTL runs should be replaced with their mirror-image + * counterparts. + * @see UBIDI_DO_MIRRORING + * @see ubidi_setReorderingOptions + * @see ubidi_writeReordered + * @see ubidi_writeReverse + * @stable ICU 58 + */ +typedef enum { + /** 0: Constant indicating that character mirroring should not be + * performed. + * This is the default. + * @stable ICU 58 + */ + UBIDI_MIRRORING_OFF = 0, + /** 1: Constant indicating that character mirroring should be performed. + * This corresponds to calling ubidi_writeReordered or + * ubidi_writeReverse with the + * UBIDI_DO_MIRRORING option bit set. + * @stable ICU 58 + */ + UBIDI_MIRRORING_ON +} UBiDiMirroring; + +/** + * Forward declaration of the UBiDiTransform structure that stores + * information used by the layout transformation engine. + * @stable ICU 58 + */ +typedef struct UBiDiTransform UBiDiTransform; + +/** + * Performs transformation of text from the bidi layout defined by the input + * ordering scheme to the bidi layout defined by the output ordering scheme, + * and applies character mirroring and Arabic shaping operations.

+ * In terms of UBiDi, such a transformation implies: + *

    + *
  • calling ubidi_setReorderingMode as needed (when the + * reordering mode is other than normal),
  • + *
  • calling ubidi_setInverse as needed (when text should be + * transformed from a visual to a logical form),
  • + *
  • resolving embedding levels of each character in the input text by + * calling ubidi_setPara,
  • + *
  • reordering the characters based on the computed embedding levels, also + * performing character mirroring as needed, and streaming the result to the + * output, by calling ubidi_writeReordered,
  • + *
  • performing Arabic digit and letter shaping on the output text by calling + * u_shapeArabic.
  • + *
+ * An "ordering scheme" encompasses the base direction and the order of text, + * and these characteristics must be defined by the caller for both input and + * output explicitly .

+ * There are 36 possible combinations of ordering schemes, + * which are partially supported by UBiDi already. Examples of the + * currently supported combinations: + *

    + *
  • : this is equivalent to calling + * ubidi_setPara with paraLevel == UBIDI_LTR,
  • + *
  • : this is equivalent to calling + * ubidi_setPara with paraLevel == UBIDI_RTL,
  • + *
  • : this is equivalent to + * calling ubidi_setPara with + * paraLevel == UBIDI_DEFAULT_LTR,
  • + *
  • : this is equivalent to + * calling ubidi_setPara with + * paraLevel == UBIDI_DEFAULT_RTL,
  • + *
  • : this is equivalent to + * calling ubidi_setInverse(UBiDi*, TRUE) and then + * ubidi_setPara with paraLevel == UBIDI_LTR,
  • + *
  • : this is equivalent to + * calling ubidi_setInverse(UBiDi*, TRUE) and then + * ubidi_setPara with paraLevel == UBIDI_RTL.
  • + *
+ * All combinations that involve the Visual RTL scheme are unsupported by + * UBiDi, for instance: + *
    + *
  • ,
  • + *
  • .
  • + *
+ *

Example of usage of the transformation engine:
+ *

+ * \code
+ * UChar text1[] = {'a', 'b', 'c', 0x0625, '1', 0};
+ * UChar text2[] = {'a', 'b', 'c', 0x0625, '1', 0};
+ * UErrorCode errorCode = U_ZERO_ERROR;
+ * // Run a transformation.
+ * ubiditransform_transform(pBidiTransform,
+ *          text1, -1, text2, -1,
+ *          UBIDI_LTR, UBIDI_VISUAL,
+ *          UBIDI_RTL, UBIDI_LOGICAL,
+ *          UBIDI_MIRRORING_OFF,
+ *          U_SHAPE_DIGITS_AN2EN | U_SHAPE_DIGIT_TYPE_AN_EXTENDED,
+ *          &errorCode);
+ * // Do something with text2.
+ *  text2[4] = '2';
+ * // Run a reverse transformation.
+ * ubiditransform_transform(pBidiTransform,
+ *          text2, -1, text1, -1,
+ *          UBIDI_RTL, UBIDI_LOGICAL,
+ *          UBIDI_LTR, UBIDI_VISUAL,
+ *          UBIDI_MIRRORING_OFF,
+ *          U_SHAPE_DIGITS_EN2AN | U_SHAPE_DIGIT_TYPE_AN_EXTENDED,
+ *          &errorCode);
+ *\endcode
+ * 
+ *

+ * + * @param pBiDiTransform A pointer to a UBiDiTransform object + * allocated with ubiditransform_open() or + * NULL.

+ * This object serves for one-time setup to amortize initialization + * overheads. Use of this object is not thread-safe. All other threads + * should allocate a new UBiDiTransform object by calling + * ubiditransform_open() before using it. Alternatively, + * a caller can set this parameter to NULL, in which case + * the object will be allocated by the engine on the fly.

+ * @param src A pointer to the text that the Bidi layout transformations will + * be performed on. + *

Note: the text must be (at least) + * srcLength long.

+ * @param srcLength The length of the text, in number of UChars. If + * length == -1 then the text must be zero-terminated. + * @param dest A pointer to where the processed text is to be copied. + * @param destSize The size of the dest buffer, in number of + * UChars. If the U_SHAPE_LETTERS_UNSHAPE option is set, + * then the destination length could be as large as + * srcLength * 2. Otherwise, the destination length will + * not exceed srcLength. If the caller reserves the last + * position for zero-termination, it should be excluded from + * destSize. + *

destSize == -1 is allowed and makes sense when + * dest was holds some meaningful value, e.g. that of + * src. In this case dest must be + * zero-terminated.

+ * @param inParaLevel A base embedding level of the input as defined in + * ubidi_setPara documentation for the + * paraLevel parameter. + * @param inOrder An order of the input, which can be one of the + * UBiDiOrder values. + * @param outParaLevel A base embedding level of the output as defined in + * ubidi_setPara documentation for the + * paraLevel parameter. + * @param outOrder An order of the output, which can be one of the + * UBiDiOrder values. + * @param doMirroring Indicates whether or not to perform character mirroring, + * and can accept one of the UBiDiMirroring values. + * @param shapingOptions Arabic digit and letter shaping options defined in the + * ushape.h documentation. + *

Note: Direction indicator options are computed by + * the transformation engine based on the effective ordering schemes, so + * user-defined direction indicators will be ignored.

+ * @param pErrorCode A pointer to an error code value. + * + * @return The destination length, i.e. the number of UChars written to + * dest. If the transformation fails, the return value + * will be 0 (and the error code will be written to + * pErrorCode). + * + * @see UBiDiLevel + * @see UBiDiOrder + * @see UBiDiMirroring + * @see ubidi_setPara + * @see u_shapeArabic + * @stable ICU 58 + */ +U_STABLE uint32_t U_EXPORT2 +ubiditransform_transform(UBiDiTransform *pBiDiTransform, + const UChar *src, int32_t srcLength, + UChar *dest, int32_t destSize, + UBiDiLevel inParaLevel, UBiDiOrder inOrder, + UBiDiLevel outParaLevel, UBiDiOrder outOrder, + UBiDiMirroring doMirroring, uint32_t shapingOptions, + UErrorCode *pErrorCode); + +/** + * Allocates a UBiDiTransform object. This object can be reused, + * e.g. with different ordering schemes, mirroring or shaping options.

+ * Note:The object can only be reused in the same thread. + * All other threads should allocate a new UBiDiTransform object + * before using it.

+ * Example of usage:

+ *

+ * \code
+ * UErrorCode errorCode = U_ZERO_ERROR;
+ * // Open a new UBiDiTransform.
+ * UBiDiTransform* transform = ubiditransform_open(&errorCode);
+ * // Run a transformation.
+ * ubiditransform_transform(transform,
+ *          text1, -1, text2, -1,
+ *          UBIDI_RTL, UBIDI_LOGICAL,
+ *          UBIDI_LTR, UBIDI_VISUAL,
+ *          UBIDI_MIRRORING_ON,
+ *          U_SHAPE_DIGITS_EN2AN,
+ *          &errorCode);
+ * // Do something with the output text and invoke another transformation using
+ * //   that text as input.
+ * ubiditransform_transform(transform,
+ *          text2, -1, text3, -1,
+ *          UBIDI_LTR, UBIDI_VISUAL,
+ *          UBIDI_RTL, UBIDI_VISUAL,
+ *          UBIDI_MIRRORING_ON,
+ *          0, &errorCode);
+ *\endcode
+ * 
+ *

+ * The UBiDiTransform object must be deallocated by calling + * ubiditransform_close(). + * + * @return An empty UBiDiTransform object. + * @stable ICU 58 + */ +U_STABLE UBiDiTransform* U_EXPORT2 +ubiditransform_open(UErrorCode *pErrorCode); + +/** + * Deallocates the given UBiDiTransform object. + * @stable ICU 58 + */ +U_STABLE void U_EXPORT2 +ubiditransform_close(UBiDiTransform *pBidiTransform); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUBiDiTransformPointer + * "Smart pointer" class, closes a UBiDiTransform via ubiditransform_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 58 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUBiDiTransformPointer, UBiDiTransform, ubiditransform_close); + +U_NAMESPACE_END + +#endif + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ubrk.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ubrk.h new file mode 100644 index 0000000..600328c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ubrk.h @@ -0,0 +1,634 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* Copyright (C) 1996-2015, International Business Machines Corporation and others. +* All Rights Reserved. +****************************************************************************** +*/ + +#ifndef UBRK_H +#define UBRK_H + +#include "unicode/utypes.h" +#include "unicode/uloc.h" +#include "unicode/utext.h" +#include "unicode/localpointer.h" + +/** + * A text-break iterator. + * For usage in C programs. + */ +#ifndef UBRK_TYPEDEF_UBREAK_ITERATOR +# define UBRK_TYPEDEF_UBREAK_ITERATOR + /** + * Opaque type representing an ICU Break iterator object. + * @stable ICU 2.0 + */ + typedef struct UBreakIterator UBreakIterator; +#endif + +#if !UCONFIG_NO_BREAK_ITERATION + +#include "unicode/parseerr.h" + +/** + * \file + * \brief C API: BreakIterator + * + *

BreakIterator C API

+ * + * The BreakIterator C API defines methods for finding the location + * of boundaries in text. Pointer to a UBreakIterator maintain a + * current position and scan over text returning the index of characters + * where boundaries occur. + *

+ * Line boundary analysis determines where a text string can be broken + * when line-wrapping. The mechanism correctly handles punctuation and + * hyphenated words. + *

+ * Note: The locale keyword "lb" can be used to modify line break + * behavior according to the CSS level 3 line-break options, see + * . For example: + * "ja@lb=strict", "zh@lb=loose". + *

+ * Sentence boundary analysis allows selection with correct + * interpretation of periods within numbers and abbreviations, and + * trailing punctuation marks such as quotation marks and parentheses. + *

+ * Note: The locale keyword "ss" can be used to enable use of + * segmentation suppression data (preventing breaks in English after + * abbreviations such as "Mr." or "Est.", for example), as follows: + * "en@ss=standard". + *

+ * Word boundary analysis is used by search and replace functions, as + * well as within text editing applications that allow the user to + * select words with a double click. Word selection provides correct + * interpretation of punctuation marks within and following + * words. Characters that are not part of a word, such as symbols or + * punctuation marks, have word-breaks on both sides. + *

+ * Character boundary analysis identifies the boundaries of + * "Extended Grapheme Clusters", which are groupings of codepoints + * that should be treated as character-like units for many text operations. + * Please see Unicode Standard Annex #29, Unicode Text Segmentation, + * http://www.unicode.org/reports/tr29/ for additional information + * on grapheme clusters and guidelines on their use. + *

+ * Title boundary analysis locates all positions, + * typically starts of words, that should be set to Title Case + * when title casing the text. + *

+ * The text boundary positions are found according to the rules + * described in Unicode Standard Annex #29, Text Boundaries, and + * Unicode Standard Annex #14, Line Breaking Properties. These + * are available at http://www.unicode.org/reports/tr14/ and + * http://www.unicode.org/reports/tr29/. + *

+ * In addition to the plain C API defined in this header file, an + * object oriented C++ API with equivalent functionality is defined in the + * file brkiter.h. + *

+ * Code snippets illustrating the use of the Break Iterator APIs + * are available in the ICU User Guide, + * http://icu-project.org/userguide/boundaryAnalysis.html + * and in the sample program icu/source/samples/break/break.cpp + */ + +/** The possible types of text boundaries. @stable ICU 2.0 */ +typedef enum UBreakIteratorType { + /** Character breaks @stable ICU 2.0 */ + UBRK_CHARACTER = 0, + /** Word breaks @stable ICU 2.0 */ + UBRK_WORD = 1, + /** Line breaks @stable ICU 2.0 */ + UBRK_LINE = 2, + /** Sentence breaks @stable ICU 2.0 */ + UBRK_SENTENCE = 3, + +#ifndef U_HIDE_DEPRECATED_API + /** + * Title Case breaks + * The iterator created using this type locates title boundaries as described for + * Unicode 3.2 only. For Unicode 4.0 and above title boundary iteration, + * please use Word Boundary iterator. + * + * @deprecated ICU 2.8 Use the word break iterator for titlecasing for Unicode 4 and later. + */ + UBRK_TITLE = 4, + /** + * One more than the highest normal UBreakIteratorType value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UBRK_COUNT = 5 +#endif // U_HIDE_DEPRECATED_API +} UBreakIteratorType; + +/** Value indicating all text boundaries have been returned. + * @stable ICU 2.0 + */ +#define UBRK_DONE ((int32_t) -1) + + +/** + * Enum constants for the word break tags returned by + * getRuleStatus(). A range of values is defined for each category of + * word, to allow for further subdivisions of a category in future releases. + * Applications should check for tag values falling within the range, rather + * than for single individual values. + * + * The numeric values of all of these constants are stable (will not change). + * + * @stable ICU 2.2 +*/ +typedef enum UWordBreak { + /** Tag value for "words" that do not fit into any of other categories. + * Includes spaces and most punctuation. */ + UBRK_WORD_NONE = 0, + /** Upper bound for tags for uncategorized words. */ + UBRK_WORD_NONE_LIMIT = 100, + /** Tag value for words that appear to be numbers, lower limit. */ + UBRK_WORD_NUMBER = 100, + /** Tag value for words that appear to be numbers, upper limit. */ + UBRK_WORD_NUMBER_LIMIT = 200, + /** Tag value for words that contain letters, excluding + * hiragana, katakana or ideographic characters, lower limit. */ + UBRK_WORD_LETTER = 200, + /** Tag value for words containing letters, upper limit */ + UBRK_WORD_LETTER_LIMIT = 300, + /** Tag value for words containing kana characters, lower limit */ + UBRK_WORD_KANA = 300, + /** Tag value for words containing kana characters, upper limit */ + UBRK_WORD_KANA_LIMIT = 400, + /** Tag value for words containing ideographic characters, lower limit */ + UBRK_WORD_IDEO = 400, + /** Tag value for words containing ideographic characters, upper limit */ + UBRK_WORD_IDEO_LIMIT = 500 +} UWordBreak; + +/** + * Enum constants for the line break tags returned by getRuleStatus(). + * A range of values is defined for each category of + * word, to allow for further subdivisions of a category in future releases. + * Applications should check for tag values falling within the range, rather + * than for single individual values. + * + * The numeric values of all of these constants are stable (will not change). + * + * @stable ICU 2.8 +*/ +typedef enum ULineBreakTag { + /** Tag value for soft line breaks, positions at which a line break + * is acceptable but not required */ + UBRK_LINE_SOFT = 0, + /** Upper bound for soft line breaks. */ + UBRK_LINE_SOFT_LIMIT = 100, + /** Tag value for a hard, or mandatory line break */ + UBRK_LINE_HARD = 100, + /** Upper bound for hard line breaks. */ + UBRK_LINE_HARD_LIMIT = 200 +} ULineBreakTag; + + + +/** + * Enum constants for the sentence break tags returned by getRuleStatus(). + * A range of values is defined for each category of + * sentence, to allow for further subdivisions of a category in future releases. + * Applications should check for tag values falling within the range, rather + * than for single individual values. + * + * The numeric values of all of these constants are stable (will not change). + * + * @stable ICU 2.8 +*/ +typedef enum USentenceBreakTag { + /** Tag value for for sentences ending with a sentence terminator + * ('.', '?', '!', etc.) character, possibly followed by a + * hard separator (CR, LF, PS, etc.) + */ + UBRK_SENTENCE_TERM = 0, + /** Upper bound for tags for sentences ended by sentence terminators. */ + UBRK_SENTENCE_TERM_LIMIT = 100, + /** Tag value for for sentences that do not contain an ending + * sentence terminator ('.', '?', '!', etc.) character, but + * are ended only by a hard separator (CR, LF, PS, etc.) or end of input. + */ + UBRK_SENTENCE_SEP = 100, + /** Upper bound for tags for sentences ended by a separator. */ + UBRK_SENTENCE_SEP_LIMIT = 200 + /** Tag value for a hard, or mandatory line break */ +} USentenceBreakTag; + + +/** + * Open a new UBreakIterator for locating text boundaries for a specified locale. + * A UBreakIterator may be used for detecting character, line, word, + * and sentence breaks in text. + * @param type The type of UBreakIterator to open: one of UBRK_CHARACTER, UBRK_WORD, + * UBRK_LINE, UBRK_SENTENCE + * @param locale The locale specifying the text-breaking conventions. Note that + * locale keys such as "lb" and "ss" may be used to modify text break behavior, + * see general discussion of BreakIterator C API. + * @param text The text to be iterated over. May be null, in which case ubrk_setText() is + * used to specify the text to be iterated. + * @param textLength The number of characters in text, or -1 if null-terminated. + * @param status A UErrorCode to receive any errors. + * @return A UBreakIterator for the specified locale. + * @see ubrk_openRules + * @stable ICU 2.0 + */ +U_STABLE UBreakIterator* U_EXPORT2 +ubrk_open(UBreakIteratorType type, + const char *locale, + const UChar *text, + int32_t textLength, + UErrorCode *status); + +/** + * Open a new UBreakIterator for locating text boundaries using specified breaking rules. + * The rule syntax is ... (TBD) + * @param rules A set of rules specifying the text breaking conventions. + * @param rulesLength The number of characters in rules, or -1 if null-terminated. + * @param text The text to be iterated over. May be null, in which case ubrk_setText() is + * used to specify the text to be iterated. + * @param textLength The number of characters in text, or -1 if null-terminated. + * @param parseErr Receives position and context information for any syntax errors + * detected while parsing the rules. + * @param status A UErrorCode to receive any errors. + * @return A UBreakIterator for the specified rules. + * @see ubrk_open + * @stable ICU 2.2 + */ +U_STABLE UBreakIterator* U_EXPORT2 +ubrk_openRules(const UChar *rules, + int32_t rulesLength, + const UChar *text, + int32_t textLength, + UParseError *parseErr, + UErrorCode *status); + +#ifndef U_HIDE_DRAFT_API +/** + * Open a new UBreakIterator for locating text boundaries using precompiled binary rules. + * Opening a UBreakIterator this way is substantially faster than using ubrk_openRules. + * Binary rules may be obtained using ubrk_getBinaryRules. The compiled rules are not + * compatible across different major versions of ICU, nor across platforms of different + * endianness or different base character set family (ASCII vs EBCDIC). + * @param binaryRules A set of compiled binary rules specifying the text breaking + * conventions. Ownership of the storage containing the compiled + * rules remains with the caller of this function. The compiled + * rules must not be modified or deleted during the life of the + * break iterator. + * @param rulesLength The length of binaryRules in bytes; must be >= 0. + * @param text The text to be iterated over. May be null, in which case + * ubrk_setText() is used to specify the text to be iterated. + * @param textLength The number of characters in text, or -1 if null-terminated. + * @param status Pointer to UErrorCode to receive any errors. + * @return UBreakIterator for the specified rules. + * @see ubrk_getBinaryRules + * @draft ICU 59 + */ +U_DRAFT UBreakIterator* U_EXPORT2 +ubrk_openBinaryRules(const uint8_t *binaryRules, int32_t rulesLength, + const UChar * text, int32_t textLength, + UErrorCode * status); + +#endif /* U_HIDE_DRAFT_API */ + +/** + * Thread safe cloning operation + * @param bi iterator to be cloned + * @param stackBuffer Deprecated functionality as of ICU 52, use NULL.
+ * user allocated space for the new clone. If NULL new memory will be allocated. + * If buffer is not large enough, new memory will be allocated. + * Clients can use the U_BRK_SAFECLONE_BUFFERSIZE. + * @param pBufferSize Deprecated functionality as of ICU 52, use NULL or 1.
+ * pointer to size of allocated space. + * If *pBufferSize == 0, a sufficient size for use in cloning will + * be returned ('pre-flighting') + * If *pBufferSize is not enough for a stack-based safe clone, + * new memory will be allocated. + * @param status to indicate whether the operation went on smoothly or there were errors + * An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any allocations were necessary. + * @return pointer to the new clone + * @stable ICU 2.0 + */ +U_STABLE UBreakIterator * U_EXPORT2 +ubrk_safeClone( + const UBreakIterator *bi, + void *stackBuffer, + int32_t *pBufferSize, + UErrorCode *status); + +#ifndef U_HIDE_DEPRECATED_API + +/** + * A recommended size (in bytes) for the memory buffer to be passed to ubrk_saveClone(). + * @deprecated ICU 52. Do not rely on ubrk_safeClone() cloning into any provided buffer. + */ +#define U_BRK_SAFECLONE_BUFFERSIZE 1 + +#endif /* U_HIDE_DEPRECATED_API */ + +/** +* Close a UBreakIterator. +* Once closed, a UBreakIterator may no longer be used. +* @param bi The break iterator to close. + * @stable ICU 2.0 +*/ +U_STABLE void U_EXPORT2 +ubrk_close(UBreakIterator *bi); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUBreakIteratorPointer + * "Smart pointer" class, closes a UBreakIterator via ubrk_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUBreakIteratorPointer, UBreakIterator, ubrk_close); + +U_NAMESPACE_END + +#endif + +/** + * Sets an existing iterator to point to a new piece of text. + * The break iterator retains a pointer to the supplied text. + * The caller must not modify or delete the text while the BreakIterator + * retains the reference. + * + * @param bi The iterator to use + * @param text The text to be set + * @param textLength The length of the text + * @param status The error code + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ubrk_setText(UBreakIterator* bi, + const UChar* text, + int32_t textLength, + UErrorCode* status); + + +/** + * Sets an existing iterator to point to a new piece of text. + * + * All index positions returned by break iterator functions are + * native indices from the UText. For example, when breaking UTF-8 + * encoded text, the break positions returned by \ref ubrk_next, \ref ubrk_previous, etc. + * will be UTF-8 string indices, not UTF-16 positions. + * + * @param bi The iterator to use + * @param text The text to be set. + * This function makes a shallow clone of the supplied UText. This means + * that the caller is free to immediately close or otherwise reuse the + * UText that was passed as a parameter, but that the underlying text itself + * must not be altered while being referenced by the break iterator. + * @param status The error code + * @stable ICU 3.4 + */ +U_STABLE void U_EXPORT2 +ubrk_setUText(UBreakIterator* bi, + UText* text, + UErrorCode* status); + + + +/** + * Determine the most recently-returned text boundary. + * + * @param bi The break iterator to use. + * @return The character index most recently returned by \ref ubrk_next, \ref ubrk_previous, + * \ref ubrk_first, or \ref ubrk_last. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ubrk_current(const UBreakIterator *bi); + +/** + * Advance the iterator to the boundary following the current boundary. + * + * @param bi The break iterator to use. + * @return The character index of the next text boundary, or UBRK_DONE + * if all text boundaries have been returned. + * @see ubrk_previous + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ubrk_next(UBreakIterator *bi); + +/** + * Set the iterator position to the boundary preceding the current boundary. + * + * @param bi The break iterator to use. + * @return The character index of the preceding text boundary, or UBRK_DONE + * if all text boundaries have been returned. + * @see ubrk_next + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ubrk_previous(UBreakIterator *bi); + +/** + * Set the iterator position to zero, the start of the text being scanned. + * @param bi The break iterator to use. + * @return The new iterator position (zero). + * @see ubrk_last + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ubrk_first(UBreakIterator *bi); + +/** + * Set the iterator position to the index immediately beyond the last character in the text being scanned. + * This is not the same as the last character. + * @param bi The break iterator to use. + * @return The character offset immediately beyond the last character in the + * text being scanned. + * @see ubrk_first + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ubrk_last(UBreakIterator *bi); + +/** + * Set the iterator position to the first boundary preceding the specified offset. + * The new position is always smaller than offset, or UBRK_DONE. + * @param bi The break iterator to use. + * @param offset The offset to begin scanning. + * @return The text boundary preceding offset, or UBRK_DONE. + * @see ubrk_following + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ubrk_preceding(UBreakIterator *bi, + int32_t offset); + +/** + * Advance the iterator to the first boundary following the specified offset. + * The value returned is always greater than offset, or UBRK_DONE. + * @param bi The break iterator to use. + * @param offset The offset to begin scanning. + * @return The text boundary following offset, or UBRK_DONE. + * @see ubrk_preceding + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ubrk_following(UBreakIterator *bi, + int32_t offset); + +/** +* Get a locale for which text breaking information is available. +* A UBreakIterator in a locale returned by this function will perform the correct +* text breaking for the locale. +* @param index The index of the desired locale. +* @return A locale for which number text breaking information is available, or 0 if none. +* @see ubrk_countAvailable +* @stable ICU 2.0 +*/ +U_STABLE const char* U_EXPORT2 +ubrk_getAvailable(int32_t index); + +/** +* Determine how many locales have text breaking information available. +* This function is most useful as determining the loop ending condition for +* calls to \ref ubrk_getAvailable. +* @return The number of locales for which text breaking information is available. +* @see ubrk_getAvailable +* @stable ICU 2.0 +*/ +U_STABLE int32_t U_EXPORT2 +ubrk_countAvailable(void); + + +/** +* Returns true if the specfied position is a boundary position. As a side +* effect, leaves the iterator pointing to the first boundary position at +* or after "offset". +* @param bi The break iterator to use. +* @param offset the offset to check. +* @return True if "offset" is a boundary position. +* @stable ICU 2.0 +*/ +U_STABLE UBool U_EXPORT2 +ubrk_isBoundary(UBreakIterator *bi, int32_t offset); + +/** + * Return the status from the break rule that determined the most recently + * returned break position. The values appear in the rule source + * within brackets, {123}, for example. For rules that do not specify a + * status, a default value of 0 is returned. + *

+ * For word break iterators, the possible values are defined in enum UWordBreak. + * @stable ICU 2.2 + */ +U_STABLE int32_t U_EXPORT2 +ubrk_getRuleStatus(UBreakIterator *bi); + +/** + * Get the statuses from the break rules that determined the most recently + * returned break position. The values appear in the rule source + * within brackets, {123}, for example. The default status value for rules + * that do not explicitly provide one is zero. + *

+ * For word break iterators, the possible values are defined in enum UWordBreak. + * @param bi The break iterator to use + * @param fillInVec an array to be filled in with the status values. + * @param capacity the length of the supplied vector. A length of zero causes + * the function to return the number of status values, in the + * normal way, without attemtping to store any values. + * @param status receives error codes. + * @return The number of rule status values from rules that determined + * the most recent boundary returned by the break iterator. + * @stable ICU 3.0 + */ +U_STABLE int32_t U_EXPORT2 +ubrk_getRuleStatusVec(UBreakIterator *bi, int32_t *fillInVec, int32_t capacity, UErrorCode *status); + +/** + * Return the locale of the break iterator. You can choose between the valid and + * the actual locale. + * @param bi break iterator + * @param type locale type (valid or actual) + * @param status error code + * @return locale string + * @stable ICU 2.8 + */ +U_STABLE const char* U_EXPORT2 +ubrk_getLocaleByType(const UBreakIterator *bi, ULocDataLocaleType type, UErrorCode* status); + +/** + * Set the subject text string upon which the break iterator is operating + * without changing any other aspect of the state. + * The new and previous text strings must have the same content. + * + * This function is intended for use in environments where ICU is operating on + * strings that may move around in memory. It provides a mechanism for notifying + * ICU that the string has been relocated, and providing a new UText to access the + * string in its new position. + * + * Note that the break iterator never copies the underlying text + * of a string being processed, but always operates directly on the original text + * provided by the user. Refreshing simply drops the references to the old text + * and replaces them with references to the new. + * + * Caution: this function is normally used only by very specialized + * system-level code. One example use case is with garbage collection + * that moves the text in memory. + * + * @param bi The break iterator. + * @param text The new (moved) text string. + * @param status Receives errors detected by this function. + * + * @stable ICU 49 + */ +U_STABLE void U_EXPORT2 +ubrk_refreshUText(UBreakIterator *bi, + UText *text, + UErrorCode *status); + + +#ifndef U_HIDE_DRAFT_API +/** + * Get a compiled binary version of the rules specifying the behavior of a UBreakIterator. + * The binary rules may be used with ubrk_openBinaryRules to open a new UBreakIterator + * more quickly than using ubrk_openRules. The compiled rules are not compatible across + * different major versions of ICU, nor across platforms of different endianness or + * different base character set family (ASCII vs EBCDIC). Supports preflighting (with + * binaryRules=NULL and rulesCapacity=0) to get the rules length without copying them to + * the binaryRules buffer. However, whether preflighting or not, if the actual length + * is greater than INT32_MAX, then the function returns 0 and sets *status to + * U_INDEX_OUTOFBOUNDS_ERROR. + + * @param bi The break iterator to use. + * @param binaryRules Buffer to receive the compiled binary rules; set to NULL for + * preflighting. + * @param rulesCapacity Capacity (in bytes) of the binaryRules buffer; set to 0 for + * preflighting. Must be >= 0. + * @param status Pointer to UErrorCode to receive any errors, such as + * U_BUFFER_OVERFLOW_ERROR, U_INDEX_OUTOFBOUNDS_ERROR, or + * U_ILLEGAL_ARGUMENT_ERROR. + * @return The actual byte length of the binary rules, if <= INT32_MAX; + * otherwise 0. If not preflighting and this is larger than + * rulesCapacity, *status will be set to an error. + * @see ubrk_openBinaryRules + * @draft ICU 59 + */ +U_DRAFT int32_t U_EXPORT2 +ubrk_getBinaryRules(UBreakIterator *bi, + uint8_t * binaryRules, int32_t rulesCapacity, + UErrorCode * status); + +#endif /* U_HIDE_DRAFT_API */ + +#endif /* #if !UCONFIG_NO_BREAK_ITERATION */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ucal.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucal.h new file mode 100644 index 0000000..c765e78 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucal.h @@ -0,0 +1,1564 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ******************************************************************************* + * Copyright (C) 1996-2015, International Business Machines Corporation and + * others. All Rights Reserved. + ******************************************************************************* + */ + +#ifndef UCAL_H +#define UCAL_H + +#include "unicode/utypes.h" +#include "unicode/uenum.h" +#include "unicode/uloc.h" +#include "unicode/localpointer.h" + +#if !UCONFIG_NO_FORMATTING + +/** + * \file + * \brief C API: Calendar + * + *

Calendar C API

+ * + * UCalendar C API is used for converting between a UDate object + * and a set of integer fields such as UCAL_YEAR, UCAL_MONTH, + * UCAL_DAY, UCAL_HOUR, and so on. + * (A UDate object represents a specific instant in + * time with millisecond precision. See UDate + * for information about the UDate .) + * + *

+ * Types of UCalendar interpret a UDate + * according to the rules of a specific calendar system. The U_STABLE + * provides the enum UCalendarType with UCAL_TRADITIONAL and + * UCAL_GREGORIAN. + *

+ * Like other locale-sensitive C API, calendar API provides a + * function, ucal_open(), which returns a pointer to + * UCalendar whose time fields have been initialized + * with the current date and time. We need to specify the type of + * calendar to be opened and the timezoneId. + * \htmlonly

\endhtmlonly + *
+ * \code
+ * UCalendar *caldef;
+ * UChar *tzId;
+ * UErrorCode status;
+ * tzId=(UChar*)malloc(sizeof(UChar) * (strlen("PST") +1) );
+ * u_uastrcpy(tzId, "PST");
+ * caldef=ucal_open(tzID, u_strlen(tzID), NULL, UCAL_TRADITIONAL, &status);
+ * \endcode
+ * 
+ * \htmlonly
\endhtmlonly + * + *

+ * A UCalendar object can produce all the time field values + * needed to implement the date-time formatting for a particular language + * and calendar style (for example, Japanese-Gregorian, Japanese-Traditional). + * + *

+ * When computing a UDate from time fields, two special circumstances + * may arise: there may be insufficient information to compute the + * UDate (such as only year and month but no day in the month), + * or there may be inconsistent information (such as "Tuesday, July 15, 1996" + * -- July 15, 1996 is actually a Monday). + * + *

+ * Insufficient information. The calendar will use default + * information to specify the missing fields. This may vary by calendar; for + * the Gregorian calendar, the default for a field is the same as that of the + * start of the epoch: i.e., UCAL_YEAR = 1970, UCAL_MONTH = JANUARY, UCAL_DATE = 1, etc. + * + *

+ * Inconsistent information. If fields conflict, the calendar + * will give preference to fields set more recently. For example, when + * determining the day, the calendar will look for one of the following + * combinations of fields. The most recent combination, as determined by the + * most recently set single field, will be used. + * + * \htmlonly

\endhtmlonly + *
+ * \code
+ * UCAL_MONTH + UCAL_DAY_OF_MONTH
+ * UCAL_MONTH + UCAL_WEEK_OF_MONTH + UCAL_DAY_OF_WEEK
+ * UCAL_MONTH + UCAL_DAY_OF_WEEK_IN_MONTH + UCAL_DAY_OF_WEEK
+ * UCAL_DAY_OF_YEAR
+ * UCAL_DAY_OF_WEEK + UCAL_WEEK_OF_YEAR
+ * \endcode
+ * 
+ * \htmlonly
\endhtmlonly + * + * For the time of day: + * + * \htmlonly
\endhtmlonly + *
+ * \code
+ * UCAL_HOUR_OF_DAY
+ * UCAL_AM_PM + UCAL_HOUR
+ * \endcode
+ * 
+ * \htmlonly
\endhtmlonly + * + *

+ * Note: for some non-Gregorian calendars, different + * fields may be necessary for complete disambiguation. For example, a full + * specification of the historial Arabic astronomical calendar requires year, + * month, day-of-month and day-of-week in some cases. + * + *

+ * Note: There are certain possible ambiguities in + * interpretation of certain singular times, which are resolved in the + * following ways: + *

    + *
  1. 24:00:00 "belongs" to the following day. That is, + * 23:59 on Dec 31, 1969 < 24:00 on Jan 1, 1970 < 24:01:00 on Jan 1, 1970 + * + *
  2. Although historically not precise, midnight also belongs to "am", + * and noon belongs to "pm", so on the same day, + * 12:00 am (midnight) < 12:01 am, and 12:00 pm (noon) < 12:01 pm + *
+ * + *

+ * The date or time format strings are not part of the definition of a + * calendar, as those must be modifiable or overridable by the user at + * runtime. Use {@link icu::DateFormat} + * to format dates. + * + *

+ * Calendar provides an API for field "rolling", where fields + * can be incremented or decremented, but wrap around. For example, rolling the + * month up in the date December 12, 1996 results in + * January 12, 1996. + * + *

+ * Calendar also provides a date arithmetic function for + * adding the specified (signed) amount of time to a particular time field. + * For example, subtracting 5 days from the date September 12, 1996 + * results in September 7, 1996. + * + * @stable ICU 2.0 + */ + +/** + * The time zone ID reserved for unknown time zone. + * @stable ICU 4.8 + */ +#define UCAL_UNKNOWN_ZONE_ID "Etc/Unknown" + +/** A calendar. + * For usage in C programs. + * @stable ICU 2.0 + */ +typedef void* UCalendar; + +/** Possible types of UCalendars + * @stable ICU 2.0 + */ +enum UCalendarType { + /** + * Despite the name, UCAL_TRADITIONAL designates the locale's default calendar, + * which may be the Gregorian calendar or some other calendar. + * @stable ICU 2.0 + */ + UCAL_TRADITIONAL, + /** + * A better name for UCAL_TRADITIONAL. + * @stable ICU 4.2 + */ + UCAL_DEFAULT = UCAL_TRADITIONAL, + /** + * Unambiguously designates the Gregorian calendar for the locale. + * @stable ICU 2.0 + */ + UCAL_GREGORIAN +}; + +/** @stable ICU 2.0 */ +typedef enum UCalendarType UCalendarType; + +/** Possible fields in a UCalendar + * @stable ICU 2.0 + */ +enum UCalendarDateFields { + /** + * Field number indicating the era, e.g., AD or BC in the Gregorian (Julian) calendar. + * This is a calendar-specific value. + * @stable ICU 2.6 + */ + UCAL_ERA, + + /** + * Field number indicating the year. This is a calendar-specific value. + * @stable ICU 2.6 + */ + UCAL_YEAR, + + /** + * Field number indicating the month. This is a calendar-specific value. + * The first month of the year is + * JANUARY; the last depends on the number of months in a year. + * @see #UCAL_JANUARY + * @see #UCAL_FEBRUARY + * @see #UCAL_MARCH + * @see #UCAL_APRIL + * @see #UCAL_MAY + * @see #UCAL_JUNE + * @see #UCAL_JULY + * @see #UCAL_AUGUST + * @see #UCAL_SEPTEMBER + * @see #UCAL_OCTOBER + * @see #UCAL_NOVEMBER + * @see #UCAL_DECEMBER + * @see #UCAL_UNDECIMBER + * @stable ICU 2.6 + */ + UCAL_MONTH, + + /** + * Field number indicating the + * week number within the current year. The first week of the year, as + * defined by UCAL_FIRST_DAY_OF_WEEK and UCAL_MINIMAL_DAYS_IN_FIRST_WEEK + * attributes, has value 1. Subclasses define + * the value of UCAL_WEEK_OF_YEAR for days before the first week of + * the year. + * @see ucal_getAttribute + * @see ucal_setAttribute + * @stable ICU 2.6 + */ + UCAL_WEEK_OF_YEAR, + + /** + * Field number indicating the + * week number within the current month. The first week of the month, as + * defined by UCAL_FIRST_DAY_OF_WEEK and UCAL_MINIMAL_DAYS_IN_FIRST_WEEK + * attributes, has value 1. Subclasses define + * the value of WEEK_OF_MONTH for days before the first week of + * the month. + * @see ucal_getAttribute + * @see ucal_setAttribute + * @see #UCAL_FIRST_DAY_OF_WEEK + * @see #UCAL_MINIMAL_DAYS_IN_FIRST_WEEK + * @stable ICU 2.6 + */ + UCAL_WEEK_OF_MONTH, + + /** + * Field number indicating the + * day of the month. This is a synonym for DAY_OF_MONTH. + * The first day of the month has value 1. + * @see #UCAL_DAY_OF_MONTH + * @stable ICU 2.6 + */ + UCAL_DATE, + + /** + * Field number indicating the day + * number within the current year. The first day of the year has value 1. + * @stable ICU 2.6 + */ + UCAL_DAY_OF_YEAR, + + /** + * Field number indicating the day + * of the week. This field takes values SUNDAY, + * MONDAY, TUESDAY, WEDNESDAY, + * THURSDAY, FRIDAY, and SATURDAY. + * @see #UCAL_SUNDAY + * @see #UCAL_MONDAY + * @see #UCAL_TUESDAY + * @see #UCAL_WEDNESDAY + * @see #UCAL_THURSDAY + * @see #UCAL_FRIDAY + * @see #UCAL_SATURDAY + * @stable ICU 2.6 + */ + UCAL_DAY_OF_WEEK, + + /** + * Field number indicating the + * ordinal number of the day of the week within the current month. Together + * with the DAY_OF_WEEK field, this uniquely specifies a day + * within a month. Unlike WEEK_OF_MONTH and + * WEEK_OF_YEAR, this field's value does not depend on + * getFirstDayOfWeek() or + * getMinimalDaysInFirstWeek(). DAY_OF_MONTH 1 + * through 7 always correspond to DAY_OF_WEEK_IN_MONTH + * 1; 8 through 15 correspond to + * DAY_OF_WEEK_IN_MONTH 2, and so on. + * DAY_OF_WEEK_IN_MONTH 0 indicates the week before + * DAY_OF_WEEK_IN_MONTH 1. Negative values count back from the + * end of the month, so the last Sunday of a month is specified as + * DAY_OF_WEEK = SUNDAY, DAY_OF_WEEK_IN_MONTH = -1. Because + * negative values count backward they will usually be aligned differently + * within the month than positive values. For example, if a month has 31 + * days, DAY_OF_WEEK_IN_MONTH -1 will overlap + * DAY_OF_WEEK_IN_MONTH 5 and the end of 4. + * @see #UCAL_DAY_OF_WEEK + * @see #UCAL_WEEK_OF_MONTH + * @stable ICU 2.6 + */ + UCAL_DAY_OF_WEEK_IN_MONTH, + + /** + * Field number indicating + * whether the HOUR is before or after noon. + * E.g., at 10:04:15.250 PM the AM_PM is PM. + * @see #UCAL_AM + * @see #UCAL_PM + * @see #UCAL_HOUR + * @stable ICU 2.6 + */ + UCAL_AM_PM, + + /** + * Field number indicating the + * hour of the morning or afternoon. HOUR is used for the 12-hour + * clock. + * E.g., at 10:04:15.250 PM the HOUR is 10. + * @see #UCAL_AM_PM + * @see #UCAL_HOUR_OF_DAY + * @stable ICU 2.6 + */ + UCAL_HOUR, + + /** + * Field number indicating the + * hour of the day. HOUR_OF_DAY is used for the 24-hour clock. + * E.g., at 10:04:15.250 PM the HOUR_OF_DAY is 22. + * @see #UCAL_HOUR + * @stable ICU 2.6 + */ + UCAL_HOUR_OF_DAY, + + /** + * Field number indicating the + * minute within the hour. + * E.g., at 10:04:15.250 PM the UCAL_MINUTE is 4. + * @stable ICU 2.6 + */ + UCAL_MINUTE, + + /** + * Field number indicating the + * second within the minute. + * E.g., at 10:04:15.250 PM the UCAL_SECOND is 15. + * @stable ICU 2.6 + */ + UCAL_SECOND, + + /** + * Field number indicating the + * millisecond within the second. + * E.g., at 10:04:15.250 PM the UCAL_MILLISECOND is 250. + * @stable ICU 2.6 + */ + UCAL_MILLISECOND, + + /** + * Field number indicating the + * raw offset from GMT in milliseconds. + * @stable ICU 2.6 + */ + UCAL_ZONE_OFFSET, + + /** + * Field number indicating the + * daylight savings offset in milliseconds. + * @stable ICU 2.6 + */ + UCAL_DST_OFFSET, + + /** + * Field number + * indicating the extended year corresponding to the + * UCAL_WEEK_OF_YEAR field. This may be one greater or less + * than the value of UCAL_EXTENDED_YEAR. + * @stable ICU 2.6 + */ + UCAL_YEAR_WOY, + + /** + * Field number + * indicating the localized day of week. This will be a value from 1 + * to 7 inclusive, with 1 being the localized first day of the week. + * @stable ICU 2.6 + */ + UCAL_DOW_LOCAL, + + /** + * Year of this calendar system, encompassing all supra-year fields. For example, + * in Gregorian/Julian calendars, positive Extended Year values indicate years AD, + * 1 BC = 0 extended, 2 BC = -1 extended, and so on. + * @stable ICU 2.8 + */ + UCAL_EXTENDED_YEAR, + + /** + * Field number + * indicating the modified Julian day number. This is different from + * the conventional Julian day number in two regards. First, it + * demarcates days at local zone midnight, rather than noon GMT. + * Second, it is a local number; that is, it depends on the local time + * zone. It can be thought of as a single number that encompasses all + * the date-related fields. + * @stable ICU 2.8 + */ + UCAL_JULIAN_DAY, + + /** + * Ranges from 0 to 23:59:59.999 (regardless of DST). This field behaves exactly + * like a composite of all time-related fields, not including the zone fields. As such, + * it also reflects discontinuities of those fields on DST transition days. On a day + * of DST onset, it will jump forward. On a day of DST cessation, it will jump + * backward. This reflects the fact that it must be combined with the DST_OFFSET field + * to obtain a unique local time value. + * @stable ICU 2.8 + */ + UCAL_MILLISECONDS_IN_DAY, + + /** + * Whether or not the current month is a leap month (0 or 1). See the Chinese calendar for + * an example of this. + */ + UCAL_IS_LEAP_MONTH, + + /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API, + * it is needed for layout of Calendar, DateFormat, and other objects */ + /** + * One more than the highest normal UCalendarDateFields value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UCAL_FIELD_COUNT, + + /** + * Field number indicating the + * day of the month. This is a synonym for UCAL_DATE. + * The first day of the month has value 1. + * @see #UCAL_DATE + * Synonym for UCAL_DATE + * @stable ICU 2.8 + **/ + UCAL_DAY_OF_MONTH=UCAL_DATE +}; + +/** @stable ICU 2.0 */ +typedef enum UCalendarDateFields UCalendarDateFields; + /** + * Useful constant for days of week. Note: Calendar day-of-week is 1-based. Clients + * who create locale resources for the field of first-day-of-week should be aware of + * this. For instance, in US locale, first-day-of-week is set to 1, i.e., UCAL_SUNDAY. + */ +/** Possible days of the week in a UCalendar + * @stable ICU 2.0 + */ +enum UCalendarDaysOfWeek { + /** Sunday */ + UCAL_SUNDAY = 1, + /** Monday */ + UCAL_MONDAY, + /** Tuesday */ + UCAL_TUESDAY, + /** Wednesday */ + UCAL_WEDNESDAY, + /** Thursday */ + UCAL_THURSDAY, + /** Friday */ + UCAL_FRIDAY, + /** Saturday */ + UCAL_SATURDAY +}; + +/** @stable ICU 2.0 */ +typedef enum UCalendarDaysOfWeek UCalendarDaysOfWeek; + +/** Possible months in a UCalendar. Note: Calendar month is 0-based. + * @stable ICU 2.0 + */ +enum UCalendarMonths { + /** January */ + UCAL_JANUARY, + /** February */ + UCAL_FEBRUARY, + /** March */ + UCAL_MARCH, + /** April */ + UCAL_APRIL, + /** May */ + UCAL_MAY, + /** June */ + UCAL_JUNE, + /** July */ + UCAL_JULY, + /** August */ + UCAL_AUGUST, + /** September */ + UCAL_SEPTEMBER, + /** October */ + UCAL_OCTOBER, + /** November */ + UCAL_NOVEMBER, + /** December */ + UCAL_DECEMBER, + /** Value of the UCAL_MONTH field indicating the + * thirteenth month of the year. Although the Gregorian calendar + * does not use this value, lunar calendars do. + */ + UCAL_UNDECIMBER +}; + +/** @stable ICU 2.0 */ +typedef enum UCalendarMonths UCalendarMonths; + +/** Possible AM/PM values in a UCalendar + * @stable ICU 2.0 + */ +enum UCalendarAMPMs { + /** AM */ + UCAL_AM, + /** PM */ + UCAL_PM +}; + +/** @stable ICU 2.0 */ +typedef enum UCalendarAMPMs UCalendarAMPMs; + +/** + * System time zone type constants used by filtering zones + * in ucal_openTimeZoneIDEnumeration. + * @see ucal_openTimeZoneIDEnumeration + * @stable ICU 4.8 + */ +enum USystemTimeZoneType { + /** + * Any system zones. + * @stable ICU 4.8 + */ + UCAL_ZONE_TYPE_ANY, + /** + * Canonical system zones. + * @stable ICU 4.8 + */ + UCAL_ZONE_TYPE_CANONICAL, + /** + * Canonical system zones associated with actual locations. + * @stable ICU 4.8 + */ + UCAL_ZONE_TYPE_CANONICAL_LOCATION +}; + +/** @stable ICU 4.8 */ +typedef enum USystemTimeZoneType USystemTimeZoneType; + +/** + * Create an enumeration over system time zone IDs with the given + * filter conditions. + * @param zoneType The system time zone type. + * @param region The ISO 3166 two-letter country code or UN M.49 + * three-digit area code. When NULL, no filtering + * done by region. + * @param rawOffset An offset from GMT in milliseconds, ignoring the + * effect of daylight savings time, if any. When NULL, + * no filtering done by zone offset. + * @param ec A pointer to an UErrorCode to receive any errors + * @return an enumeration object that the caller must dispose of + * using enum_close(), or NULL upon failure. In case of failure, + * *ec will indicate the error. + * @stable ICU 4.8 + */ +U_STABLE UEnumeration* U_EXPORT2 +ucal_openTimeZoneIDEnumeration(USystemTimeZoneType zoneType, const char* region, + const int32_t* rawOffset, UErrorCode* ec); + +/** + * Create an enumeration over all time zones. + * + * @param ec input/output error code + * + * @return an enumeration object that the caller must dispose of using + * uenum_close(), or NULL upon failure. In case of failure *ec will + * indicate the error. + * + * @stable ICU 2.6 + */ +U_STABLE UEnumeration* U_EXPORT2 +ucal_openTimeZones(UErrorCode* ec); + +/** + * Create an enumeration over all time zones associated with the given + * country. Some zones are affiliated with no country (e.g., "UTC"); + * these may also be retrieved, as a group. + * + * @param country the ISO 3166 two-letter country code, or NULL to + * retrieve zones not affiliated with any country + * + * @param ec input/output error code + * + * @return an enumeration object that the caller must dispose of using + * uenum_close(), or NULL upon failure. In case of failure *ec will + * indicate the error. + * + * @stable ICU 2.6 + */ +U_STABLE UEnumeration* U_EXPORT2 +ucal_openCountryTimeZones(const char* country, UErrorCode* ec); + +/** + * Return the default time zone. The default is determined initially + * by querying the host operating system. It may be changed with + * ucal_setDefaultTimeZone() or with the C++ TimeZone API. + * + * @param result A buffer to receive the result, or NULL + * + * @param resultCapacity The capacity of the result buffer + * + * @param ec input/output error code + * + * @return The result string length, not including the terminating + * null + * + * @stable ICU 2.6 + */ +U_STABLE int32_t U_EXPORT2 +ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec); + +/** + * Set the default time zone. + * + * @param zoneID null-terminated time zone ID + * + * @param ec input/output error code + * + * @stable ICU 2.6 + */ +U_STABLE void U_EXPORT2 +ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec); + +/** + * Return the amount of time in milliseconds that the clock is + * advanced during daylight savings time for the given time zone, or + * zero if the time zone does not observe daylight savings time. + * + * @param zoneID null-terminated time zone ID + * + * @param ec input/output error code + * + * @return the number of milliseconds the time is advanced with + * respect to standard time when the daylight savings rules are in + * effect. This is always a non-negative number, most commonly either + * 3,600,000 (one hour) or zero. + * + * @stable ICU 2.6 + */ +U_STABLE int32_t U_EXPORT2 +ucal_getDSTSavings(const UChar* zoneID, UErrorCode* ec); + +/** + * Get the current date and time. + * The value returned is represented as milliseconds from the epoch. + * @return The current date and time. + * @stable ICU 2.0 + */ +U_STABLE UDate U_EXPORT2 +ucal_getNow(void); + +/** + * Open a UCalendar. + * A UCalendar may be used to convert a millisecond value to a year, + * month, and day. + *

+ * Note: When unknown TimeZone ID is specified or if the TimeZone ID specified is "Etc/Unknown", + * the UCalendar returned by the function is initialized with GMT zone with TimeZone ID + * UCAL_UNKNOWN_ZONE_ID ("Etc/Unknown") without any errors/warnings. If you want + * to check if a TimeZone ID is valid prior to this function, use ucal_getCanonicalTimeZoneID. + * + * @param zoneID The desired TimeZone ID. If 0, use the default time zone. + * @param len The length of zoneID, or -1 if null-terminated. + * @param locale The desired locale + * @param type The type of UCalendar to open. This can be UCAL_GREGORIAN to open the Gregorian + * calendar for the locale, or UCAL_DEFAULT to open the default calendar for the locale (the + * default calendar may also be Gregorian). To open a specific non-Gregorian calendar for the + * locale, use uloc_setKeywordValue to set the value of the calendar keyword for the locale + * and then pass the locale to ucal_open with UCAL_DEFAULT as the type. + * @param status A pointer to an UErrorCode to receive any errors + * @return A pointer to a UCalendar, or 0 if an error occurred. + * @see #UCAL_UNKNOWN_ZONE_ID + * @stable ICU 2.0 + */ +U_STABLE UCalendar* U_EXPORT2 +ucal_open(const UChar* zoneID, + int32_t len, + const char* locale, + UCalendarType type, + UErrorCode* status); + +/** + * Close a UCalendar. + * Once closed, a UCalendar may no longer be used. + * @param cal The UCalendar to close. + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucal_close(UCalendar *cal); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUCalendarPointer + * "Smart pointer" class, closes a UCalendar via ucal_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUCalendarPointer, UCalendar, ucal_close); + +U_NAMESPACE_END + +#endif + +/** + * Open a copy of a UCalendar. + * This function performs a deep copy. + * @param cal The calendar to copy + * @param status A pointer to an UErrorCode to receive any errors. + * @return A pointer to a UCalendar identical to cal. + * @stable ICU 4.0 + */ +U_STABLE UCalendar* U_EXPORT2 +ucal_clone(const UCalendar* cal, + UErrorCode* status); + +/** + * Set the TimeZone used by a UCalendar. + * A UCalendar uses a timezone for converting from Greenwich time to local time. + * @param cal The UCalendar to set. + * @param zoneID The desired TimeZone ID. If 0, use the default time zone. + * @param len The length of zoneID, or -1 if null-terminated. + * @param status A pointer to an UErrorCode to receive any errors. + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucal_setTimeZone(UCalendar* cal, + const UChar* zoneID, + int32_t len, + UErrorCode* status); + +/** + * Get the ID of the UCalendar's time zone. + * + * @param cal The UCalendar to query. + * @param result Receives the UCalendar's time zone ID. + * @param resultLength The maximum size of result. + * @param status Receives the status. + * @return The total buffer size needed; if greater than resultLength, the output was truncated. + * @stable ICU 51 + */ +U_STABLE int32_t U_EXPORT2 +ucal_getTimeZoneID(const UCalendar *cal, + UChar *result, + int32_t resultLength, + UErrorCode *status); + +/** + * Possible formats for a UCalendar's display name + * @stable ICU 2.0 + */ +enum UCalendarDisplayNameType { + /** Standard display name */ + UCAL_STANDARD, + /** Short standard display name */ + UCAL_SHORT_STANDARD, + /** Daylight savings display name */ + UCAL_DST, + /** Short daylight savings display name */ + UCAL_SHORT_DST +}; + +/** @stable ICU 2.0 */ +typedef enum UCalendarDisplayNameType UCalendarDisplayNameType; + +/** + * Get the display name for a UCalendar's TimeZone. + * A display name is suitable for presentation to a user. + * @param cal The UCalendar to query. + * @param type The desired display name format; one of UCAL_STANDARD, UCAL_SHORT_STANDARD, + * UCAL_DST, UCAL_SHORT_DST + * @param locale The desired locale for the display name. + * @param result A pointer to a buffer to receive the formatted number. + * @param resultLength The maximum size of result. + * @param status A pointer to an UErrorCode to receive any errors + * @return The total buffer size needed; if greater than resultLength, the output was truncated. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ucal_getTimeZoneDisplayName(const UCalendar* cal, + UCalendarDisplayNameType type, + const char* locale, + UChar* result, + int32_t resultLength, + UErrorCode* status); + +/** + * Determine if a UCalendar is currently in daylight savings time. + * Daylight savings time is not used in all parts of the world. + * @param cal The UCalendar to query. + * @param status A pointer to an UErrorCode to receive any errors + * @return TRUE if cal is currently in daylight savings time, FALSE otherwise + * @stable ICU 2.0 + */ +U_STABLE UBool U_EXPORT2 +ucal_inDaylightTime(const UCalendar* cal, + UErrorCode* status ); + +/** + * Sets the GregorianCalendar change date. This is the point when the switch from + * Julian dates to Gregorian dates occurred. Default is 00:00:00 local time, October + * 15, 1582. Previous to this time and date will be Julian dates. + * + * This function works only for Gregorian calendars. If the UCalendar is not + * an instance of a Gregorian calendar, then a U_UNSUPPORTED_ERROR + * error code is set. + * + * @param cal The calendar object. + * @param date The given Gregorian cutover date. + * @param pErrorCode Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * + * @see GregorianCalendar::setGregorianChange + * @see ucal_getGregorianChange + * @stable ICU 3.6 + */ +U_STABLE void U_EXPORT2 +ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode); + +/** + * Gets the Gregorian Calendar change date. This is the point when the switch from + * Julian dates to Gregorian dates occurred. Default is 00:00:00 local time, October + * 15, 1582. Previous to this time and date will be Julian dates. + * + * This function works only for Gregorian calendars. If the UCalendar is not + * an instance of a Gregorian calendar, then a U_UNSUPPORTED_ERROR + * error code is set. + * + * @param cal The calendar object. + * @param pErrorCode Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The Gregorian cutover time for this calendar. + * + * @see GregorianCalendar::getGregorianChange + * @see ucal_setGregorianChange + * @stable ICU 3.6 + */ +U_STABLE UDate U_EXPORT2 +ucal_getGregorianChange(const UCalendar *cal, UErrorCode *pErrorCode); + +/** + * Types of UCalendar attributes + * @stable ICU 2.0 + */ +enum UCalendarAttribute { + /** + * Lenient parsing + * @stable ICU 2.0 + */ + UCAL_LENIENT, + /** + * First day of week + * @stable ICU 2.0 + */ + UCAL_FIRST_DAY_OF_WEEK, + /** + * Minimum number of days in first week + * @stable ICU 2.0 + */ + UCAL_MINIMAL_DAYS_IN_FIRST_WEEK, + /** + * The behavior for handling wall time repeating multiple times + * at negative time zone offset transitions + * @stable ICU 49 + */ + UCAL_REPEATED_WALL_TIME, + /** + * The behavior for handling skipped wall time at positive time + * zone offset transitions. + * @stable ICU 49 + */ + UCAL_SKIPPED_WALL_TIME +}; + +/** @stable ICU 2.0 */ +typedef enum UCalendarAttribute UCalendarAttribute; + +/** + * Options for handling ambiguous wall time at time zone + * offset transitions. + * @stable ICU 49 + */ +enum UCalendarWallTimeOption { + /** + * An ambiguous wall time to be interpreted as the latest. + * This option is valid for UCAL_REPEATED_WALL_TIME and + * UCAL_SKIPPED_WALL_TIME. + * @stable ICU 49 + */ + UCAL_WALLTIME_LAST, + /** + * An ambiguous wall time to be interpreted as the earliest. + * This option is valid for UCAL_REPEATED_WALL_TIME and + * UCAL_SKIPPED_WALL_TIME. + * @stable ICU 49 + */ + UCAL_WALLTIME_FIRST, + /** + * An ambiguous wall time to be interpreted as the next valid + * wall time. This option is valid for UCAL_SKIPPED_WALL_TIME. + * @stable ICU 49 + */ + UCAL_WALLTIME_NEXT_VALID +}; +/** @stable ICU 49 */ +typedef enum UCalendarWallTimeOption UCalendarWallTimeOption; + +/** + * Get a numeric attribute associated with a UCalendar. + * Numeric attributes include the first day of the week, or the minimal numbers + * of days in the first week of the month. + * @param cal The UCalendar to query. + * @param attr The desired attribute; one of UCAL_LENIENT, UCAL_FIRST_DAY_OF_WEEK, + * UCAL_MINIMAL_DAYS_IN_FIRST_WEEK, UCAL_REPEATED_WALL_TIME or UCAL_SKIPPED_WALL_TIME + * @return The value of attr. + * @see ucal_setAttribute + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ucal_getAttribute(const UCalendar* cal, + UCalendarAttribute attr); + +/** + * Set a numeric attribute associated with a UCalendar. + * Numeric attributes include the first day of the week, or the minimal numbers + * of days in the first week of the month. + * @param cal The UCalendar to set. + * @param attr The desired attribute; one of UCAL_LENIENT, UCAL_FIRST_DAY_OF_WEEK, + * UCAL_MINIMAL_DAYS_IN_FIRST_WEEK, UCAL_REPEATED_WALL_TIME or UCAL_SKIPPED_WALL_TIME + * @param newValue The new value of attr. + * @see ucal_getAttribute + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucal_setAttribute(UCalendar* cal, + UCalendarAttribute attr, + int32_t newValue); + +/** + * Get a locale for which calendars are available. + * A UCalendar in a locale returned by this function will contain the correct + * day and month names for the locale. + * @param localeIndex The index of the desired locale. + * @return A locale for which calendars are available, or 0 if none. + * @see ucal_countAvailable + * @stable ICU 2.0 + */ +U_STABLE const char* U_EXPORT2 +ucal_getAvailable(int32_t localeIndex); + +/** + * Determine how many locales have calendars available. + * This function is most useful as determining the loop ending condition for + * calls to \ref ucal_getAvailable. + * @return The number of locales for which calendars are available. + * @see ucal_getAvailable + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ucal_countAvailable(void); + +/** + * Get a UCalendar's current time in millis. + * The time is represented as milliseconds from the epoch. + * @param cal The UCalendar to query. + * @param status A pointer to an UErrorCode to receive any errors + * @return The calendar's current time in millis. + * @see ucal_setMillis + * @see ucal_setDate + * @see ucal_setDateTime + * @stable ICU 2.0 + */ +U_STABLE UDate U_EXPORT2 +ucal_getMillis(const UCalendar* cal, + UErrorCode* status); + +/** + * Set a UCalendar's current time in millis. + * The time is represented as milliseconds from the epoch. + * @param cal The UCalendar to set. + * @param dateTime The desired date and time. + * @param status A pointer to an UErrorCode to receive any errors + * @see ucal_getMillis + * @see ucal_setDate + * @see ucal_setDateTime + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucal_setMillis(UCalendar* cal, + UDate dateTime, + UErrorCode* status ); + +/** + * Set a UCalendar's current date. + * The date is represented as a series of 32-bit integers. + * @param cal The UCalendar to set. + * @param year The desired year. + * @param month The desired month; one of UCAL_JANUARY, UCAL_FEBRUARY, UCAL_MARCH, UCAL_APRIL, UCAL_MAY, + * UCAL_JUNE, UCAL_JULY, UCAL_AUGUST, UCAL_SEPTEMBER, UCAL_OCTOBER, UCAL_NOVEMBER, UCAL_DECEMBER, UCAL_UNDECIMBER + * @param date The desired day of the month. + * @param status A pointer to an UErrorCode to receive any errors + * @see ucal_getMillis + * @see ucal_setMillis + * @see ucal_setDateTime + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucal_setDate(UCalendar* cal, + int32_t year, + int32_t month, + int32_t date, + UErrorCode* status); + +/** + * Set a UCalendar's current date. + * The date is represented as a series of 32-bit integers. + * @param cal The UCalendar to set. + * @param year The desired year. + * @param month The desired month; one of UCAL_JANUARY, UCAL_FEBRUARY, UCAL_MARCH, UCAL_APRIL, UCAL_MAY, + * UCAL_JUNE, UCAL_JULY, UCAL_AUGUST, UCAL_SEPTEMBER, UCAL_OCTOBER, UCAL_NOVEMBER, UCAL_DECEMBER, UCAL_UNDECIMBER + * @param date The desired day of the month. + * @param hour The desired hour of day. + * @param minute The desired minute. + * @param second The desirec second. + * @param status A pointer to an UErrorCode to receive any errors + * @see ucal_getMillis + * @see ucal_setMillis + * @see ucal_setDate + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucal_setDateTime(UCalendar* cal, + int32_t year, + int32_t month, + int32_t date, + int32_t hour, + int32_t minute, + int32_t second, + UErrorCode* status); + +/** + * Returns TRUE if two UCalendars are equivalent. Equivalent + * UCalendars will behave identically, but they may be set to + * different times. + * @param cal1 The first of the UCalendars to compare. + * @param cal2 The second of the UCalendars to compare. + * @return TRUE if cal1 and cal2 are equivalent, FALSE otherwise. + * @stable ICU 2.0 + */ +U_STABLE UBool U_EXPORT2 +ucal_equivalentTo(const UCalendar* cal1, + const UCalendar* cal2); + +/** + * Add a specified signed amount to a particular field in a UCalendar. + * This can modify more significant fields in the calendar. + * Adding a positive value always means moving forward in time, so for the Gregorian calendar, + * starting with 100 BC and adding +1 to year results in 99 BC (even though this actually reduces + * the numeric value of the field itself). + * @param cal The UCalendar to which to add. + * @param field The field to which to add the signed value; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH, + * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, + * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, + * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET. + * @param amount The signed amount to add to field. If the amount causes the value + * to exceed to maximum or minimum values for that field, other fields are modified + * to preserve the magnitude of the change. + * @param status A pointer to an UErrorCode to receive any errors + * @see ucal_roll + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucal_add(UCalendar* cal, + UCalendarDateFields field, + int32_t amount, + UErrorCode* status); + +/** + * Add a specified signed amount to a particular field in a UCalendar. + * This will not modify more significant fields in the calendar. + * Rolling by a positive value always means moving forward in time (unless the limit of the + * field is reached, in which case it may pin or wrap), so for Gregorian calendar, + * starting with 100 BC and rolling the year by +1 results in 99 BC. + * When eras have a definite beginning and end (as in the Chinese calendar, or as in most eras in the + * Japanese calendar) then rolling the year past either limit of the era will cause the year to wrap around. + * When eras only have a limit at one end, then attempting to roll the year past that limit will result in + * pinning the year at that limit. Note that for most calendars in which era 0 years move forward in time + * (such as Buddhist, Hebrew, or Islamic), it is possible for add or roll to result in negative years for + * era 0 (that is the only way to represent years before the calendar epoch). + * @param cal The UCalendar to which to add. + * @param field The field to which to add the signed value; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH, + * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, + * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, + * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET. + * @param amount The signed amount to add to field. If the amount causes the value + * to exceed to maximum or minimum values for that field, the field is pinned to a permissible + * value. + * @param status A pointer to an UErrorCode to receive any errors + * @see ucal_add + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucal_roll(UCalendar* cal, + UCalendarDateFields field, + int32_t amount, + UErrorCode* status); + +/** + * Get the current value of a field from a UCalendar. + * All fields are represented as 32-bit integers. + * @param cal The UCalendar to query. + * @param field The desired field; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH, + * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, + * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, + * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET. + * @param status A pointer to an UErrorCode to receive any errors + * @return The value of the desired field. + * @see ucal_set + * @see ucal_isSet + * @see ucal_clearField + * @see ucal_clear + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ucal_get(const UCalendar* cal, + UCalendarDateFields field, + UErrorCode* status ); + +/** + * Set the value of a field in a UCalendar. + * All fields are represented as 32-bit integers. + * @param cal The UCalendar to set. + * @param field The field to set; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH, + * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, + * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, + * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET. + * @param value The desired value of field. + * @see ucal_get + * @see ucal_isSet + * @see ucal_clearField + * @see ucal_clear + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucal_set(UCalendar* cal, + UCalendarDateFields field, + int32_t value); + +/** + * Determine if a field in a UCalendar is set. + * All fields are represented as 32-bit integers. + * @param cal The UCalendar to query. + * @param field The desired field; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH, + * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, + * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, + * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET. + * @return TRUE if field is set, FALSE otherwise. + * @see ucal_get + * @see ucal_set + * @see ucal_clearField + * @see ucal_clear + * @stable ICU 2.0 + */ +U_STABLE UBool U_EXPORT2 +ucal_isSet(const UCalendar* cal, + UCalendarDateFields field); + +/** + * Clear a field in a UCalendar. + * All fields are represented as 32-bit integers. + * @param cal The UCalendar containing the field to clear. + * @param field The field to clear; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH, + * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, + * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, + * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET. + * @see ucal_get + * @see ucal_set + * @see ucal_isSet + * @see ucal_clear + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucal_clearField(UCalendar* cal, + UCalendarDateFields field); + +/** + * Clear all fields in a UCalendar. + * All fields are represented as 32-bit integers. + * @param calendar The UCalendar to clear. + * @see ucal_get + * @see ucal_set + * @see ucal_isSet + * @see ucal_clearField + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucal_clear(UCalendar* calendar); + +/** + * Possible limit values for a UCalendar + * @stable ICU 2.0 + */ +enum UCalendarLimitType { + /** Minimum value */ + UCAL_MINIMUM, + /** Maximum value */ + UCAL_MAXIMUM, + /** Greatest minimum value */ + UCAL_GREATEST_MINIMUM, + /** Leaest maximum value */ + UCAL_LEAST_MAXIMUM, + /** Actual minimum value */ + UCAL_ACTUAL_MINIMUM, + /** Actual maximum value */ + UCAL_ACTUAL_MAXIMUM +}; + +/** @stable ICU 2.0 */ +typedef enum UCalendarLimitType UCalendarLimitType; + +/** + * Determine a limit for a field in a UCalendar. + * A limit is a maximum or minimum value for a field. + * @param cal The UCalendar to query. + * @param field The desired field; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH, + * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, + * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, + * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET. + * @param type The desired critical point; one of UCAL_MINIMUM, UCAL_MAXIMUM, UCAL_GREATEST_MINIMUM, + * UCAL_LEAST_MAXIMUM, UCAL_ACTUAL_MINIMUM, UCAL_ACTUAL_MAXIMUM + * @param status A pointer to an UErrorCode to receive any errors. + * @return The requested value. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ucal_getLimit(const UCalendar* cal, + UCalendarDateFields field, + UCalendarLimitType type, + UErrorCode* status); + +/** Get the locale for this calendar object. You can choose between valid and actual locale. + * @param cal The calendar object + * @param type type of the locale we're looking for (valid or actual) + * @param status error code for the operation + * @return the locale name + * @stable ICU 2.8 + */ +U_STABLE const char * U_EXPORT2 +ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status); + +/** + * Returns the timezone data version currently used by ICU. + * @param status error code for the operation + * @return the version string, such as "2007f" + * @stable ICU 3.8 + */ +U_STABLE const char * U_EXPORT2 +ucal_getTZDataVersion(UErrorCode* status); + +/** + * Returns the canonical system timezone ID or the normalized + * custom time zone ID for the given time zone ID. + * @param id The input timezone ID to be canonicalized. + * @param len The length of id, or -1 if null-terminated. + * @param result The buffer receives the canonical system timezone ID + * or the custom timezone ID in normalized format. + * @param resultCapacity The capacity of the result buffer. + * @param isSystemID Receives if the given ID is a known system + * timezone ID. + * @param status Receives the status. When the given timezone ID + * is neither a known system time zone ID nor a + * valid custom timezone ID, U_ILLEGAL_ARGUMENT_ERROR + * is set. + * @return The result string length, not including the terminating + * null. + * @stable ICU 4.0 + */ +U_STABLE int32_t U_EXPORT2 +ucal_getCanonicalTimeZoneID(const UChar* id, int32_t len, + UChar* result, int32_t resultCapacity, UBool *isSystemID, UErrorCode* status); +/** + * Get the resource keyword value string designating the calendar type for the UCalendar. + * @param cal The UCalendar to query. + * @param status The error code for the operation. + * @return The resource keyword value string. + * @stable ICU 4.2 + */ +U_STABLE const char * U_EXPORT2 +ucal_getType(const UCalendar *cal, UErrorCode* status); + +/** + * Given a key and a locale, returns an array of string values in a preferred + * order that would make a difference. These are all and only those values where + * the open (creation) of the service with the locale formed from the input locale + * plus input keyword and that value has different behavior than creation with the + * input locale alone. + * @param key one of the keys supported by this service. For now, only + * "calendar" is supported. + * @param locale the locale + * @param commonlyUsed if set to true it will return only commonly used values + * with the given locale in preferred order. Otherwise, + * it will return all the available values for the locale. + * @param status error status + * @return a string enumeration over keyword values for the given key and the locale. + * @stable ICU 4.2 + */ +U_STABLE UEnumeration* U_EXPORT2 +ucal_getKeywordValuesForLocale(const char* key, + const char* locale, + UBool commonlyUsed, + UErrorCode* status); + + +/** Weekday types, as returned by ucal_getDayOfWeekType(). + * @stable ICU 4.4 + */ +enum UCalendarWeekdayType { + /** + * Designates a full weekday (no part of the day is included in the weekend). + * @stable ICU 4.4 + */ + UCAL_WEEKDAY, + /** + * Designates a full weekend day (the entire day is included in the weekend). + * @stable ICU 4.4 + */ + UCAL_WEEKEND, + /** + * Designates a day that starts as a weekday and transitions to the weekend. + * Call ucal_getWeekendTransition() to get the time of transition. + * @stable ICU 4.4 + */ + UCAL_WEEKEND_ONSET, + /** + * Designates a day that starts as the weekend and transitions to a weekday. + * Call ucal_getWeekendTransition() to get the time of transition. + * @stable ICU 4.4 + */ + UCAL_WEEKEND_CEASE +}; + +/** @stable ICU 4.4 */ +typedef enum UCalendarWeekdayType UCalendarWeekdayType; + +/** + * Returns whether the given day of the week is a weekday, a weekend day, + * or a day that transitions from one to the other, for the locale and + * calendar system associated with this UCalendar (the locale's region is + * often the most determinant factor). If a transition occurs at midnight, + * then the days before and after the transition will have the + * type UCAL_WEEKDAY or UCAL_WEEKEND. If a transition occurs at a time + * other than midnight, then the day of the transition will have + * the type UCAL_WEEKEND_ONSET or UCAL_WEEKEND_CEASE. In this case, the + * function ucal_getWeekendTransition() will return the point of + * transition. + * @param cal The UCalendar to query. + * @param dayOfWeek The day of the week whose type is desired (UCAL_SUNDAY..UCAL_SATURDAY). + * @param status The error code for the operation. + * @return The UCalendarWeekdayType for the day of the week. + * @stable ICU 4.4 + */ +U_STABLE UCalendarWeekdayType U_EXPORT2 +ucal_getDayOfWeekType(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode* status); + +/** + * Returns the time during the day at which the weekend begins or ends in + * this calendar system. If ucal_getDayOfWeekType() returns UCAL_WEEKEND_ONSET + * for the specified dayOfWeek, return the time at which the weekend begins. + * If ucal_getDayOfWeekType() returns UCAL_WEEKEND_CEASE for the specified dayOfWeek, + * return the time at which the weekend ends. If ucal_getDayOfWeekType() returns + * some other UCalendarWeekdayType for the specified dayOfWeek, is it an error condition + * (U_ILLEGAL_ARGUMENT_ERROR). + * @param cal The UCalendar to query. + * @param dayOfWeek The day of the week for which the weekend transition time is + * desired (UCAL_SUNDAY..UCAL_SATURDAY). + * @param status The error code for the operation. + * @return The milliseconds after midnight at which the weekend begins or ends. + * @stable ICU 4.4 + */ +U_STABLE int32_t U_EXPORT2 +ucal_getWeekendTransition(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode *status); + +/** + * Returns TRUE if the given UDate is in the weekend in + * this calendar system. + * @param cal The UCalendar to query. + * @param date The UDate in question. + * @param status The error code for the operation. + * @return TRUE if the given UDate is in the weekend in + * this calendar system, FALSE otherwise. + * @stable ICU 4.4 + */ +U_STABLE UBool U_EXPORT2 +ucal_isWeekend(const UCalendar *cal, UDate date, UErrorCode *status); + +/** + * Return the difference between the target time and the time this calendar object is currently set to. + * If the target time is after the current calendar setting, the the returned value will be positive. + * The field parameter specifies the units of the return value. For example, if field is UCAL_MONTH + * and ucal_getFieldDifference returns 3, then the target time is 3 to less than 4 months after the + * current calendar setting. + * + * As a side effect of this call, this calendar is advanced toward target by the given amount. That is, + * calling this function has the side effect of calling ucal_add on this calendar with the specified + * field and an amount equal to the return value from this function. + * + * A typical way of using this function is to call it first with the largest field of interest, then + * with progressively smaller fields. + * + * @param cal The UCalendar to compare and update. + * @param target The target date to compare to the current calendar setting. + * @param field The field to compare; one of UCAL_ERA, UCAL_YEAR, UCAL_MONTH, + * UCAL_WEEK_OF_YEAR, UCAL_WEEK_OF_MONTH, UCAL_DATE, UCAL_DAY_OF_YEAR, UCAL_DAY_OF_WEEK, + * UCAL_DAY_OF_WEEK_IN_MONTH, UCAL_AM_PM, UCAL_HOUR, UCAL_HOUR_OF_DAY, UCAL_MINUTE, UCAL_SECOND, + * UCAL_MILLISECOND, UCAL_ZONE_OFFSET, UCAL_DST_OFFSET. + * @param status A pointer to an UErrorCode to receive any errors + * @return The date difference for the specified field. + * @stable ICU 4.8 + */ +U_STABLE int32_t U_EXPORT2 +ucal_getFieldDifference(UCalendar* cal, + UDate target, + UCalendarDateFields field, + UErrorCode* status); + +/** + * Time zone transition types for ucal_getTimeZoneTransitionDate + * @stable ICU 50 + */ +enum UTimeZoneTransitionType { + /** + * Get the next transition after the current date, + * i.e. excludes the current date + * @stable ICU 50 + */ + UCAL_TZ_TRANSITION_NEXT, + /** + * Get the next transition on or after the current date, + * i.e. may include the current date + * @stable ICU 50 + */ + UCAL_TZ_TRANSITION_NEXT_INCLUSIVE, + /** + * Get the previous transition before the current date, + * i.e. excludes the current date + * @stable ICU 50 + */ + UCAL_TZ_TRANSITION_PREVIOUS, + /** + * Get the previous transition on or before the current date, + * i.e. may include the current date + * @stable ICU 50 + */ + UCAL_TZ_TRANSITION_PREVIOUS_INCLUSIVE +}; + +typedef enum UTimeZoneTransitionType UTimeZoneTransitionType; /**< @stable ICU 50 */ + +/** +* Get the UDate for the next/previous time zone transition relative to +* the calendar's current date, in the time zone to which the calendar +* is currently set. If there is no known time zone transition of the +* requested type relative to the calendar's date, the function returns +* FALSE. +* @param cal The UCalendar to query. +* @param type The type of transition desired. +* @param transition A pointer to a UDate to be set to the transition time. +* If the function returns FALSE, the value set is unspecified. +* @param status A pointer to a UErrorCode to receive any errors. +* @return TRUE if a valid transition time is set in *transition, FALSE +* otherwise. +* @stable ICU 50 +*/ +U_STABLE UBool U_EXPORT2 +ucal_getTimeZoneTransitionDate(const UCalendar* cal, UTimeZoneTransitionType type, + UDate* transition, UErrorCode* status); + +/** +* Converts a system time zone ID to an equivalent Windows time zone ID. For example, +* Windows time zone ID "Pacific Standard Time" is returned for input "America/Los_Angeles". +* +*

There are system time zones that cannot be mapped to Windows zones. When the input +* system time zone ID is unknown or unmappable to a Windows time zone, then this +* function returns 0 as the result length, but the operation itself remains successful +* (no error status set on return). +* +*

This implementation utilizes +* Zone-Tzid mapping data. The mapping data is updated time to time. To get the latest changes, +* please read the ICU user guide section +* Updating the Time Zone Data. +* +* @param id A system time zone ID. +* @param len The length of id, or -1 if null-terminated. +* @param winid A buffer to receive a Windows time zone ID. +* @param winidCapacity The capacity of the result buffer winid. +* @param status Receives the status. +* @return The result string length, not including the terminating null. +* @see ucal_getTimeZoneIDForWindowsID +* +* @stable ICU 52 +*/ +U_STABLE int32_t U_EXPORT2 +ucal_getWindowsTimeZoneID(const UChar* id, int32_t len, + UChar* winid, int32_t winidCapacity, UErrorCode* status); + +/** +* Converts a Windows time zone ID to an equivalent system time zone ID +* for a region. For example, system time zone ID "America/Los_Angeles" is returned +* for input Windows ID "Pacific Standard Time" and region "US" (or null), +* "America/Vancouver" is returned for the same Windows ID "Pacific Standard Time" and +* region "CA". +* +*

Not all Windows time zones can be mapped to system time zones. When the input +* Windows time zone ID is unknown or unmappable to a system time zone, then this +* function returns 0 as the result length, but the operation itself remains successful +* (no error status set on return). +* +*

This implementation utilizes +* Zone-Tzid mapping data. The mapping data is updated time to time. To get the latest changes, +* please read the ICU user guide section +* Updating the Time Zone Data. +* +* @param winid A Windows time zone ID. +* @param len The length of winid, or -1 if null-terminated. +* @param region A null-terminated region code, or NULL if no regional preference. +* @param id A buffer to receive a system time zone ID. +* @param idCapacity The capacity of the result buffer id. +* @param status Receives the status. +* @return The result string length, not including the terminating null. +* @see ucal_getWindowsTimeZoneID +* +* @stable ICU 52 +*/ +U_STABLE int32_t U_EXPORT2 +ucal_getTimeZoneIDForWindowsID(const UChar* winid, int32_t len, const char* region, + UChar* id, int32_t idCapacity, UErrorCode* status); + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ucasemap.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucasemap.h new file mode 100644 index 0000000..6b253e3 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucasemap.h @@ -0,0 +1,385 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2005-2012, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: ucasemap.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2005may06 +* created by: Markus W. Scherer +* +* Case mapping service object and functions using it. +*/ + +#ifndef __UCASEMAP_H__ +#define __UCASEMAP_H__ + +#include "unicode/utypes.h" +#include "unicode/localpointer.h" +#include "unicode/stringoptions.h" +#include "unicode/ustring.h" + +/** + * \file + * \brief C API: Unicode case mapping functions using a UCaseMap service object. + * + * The service object takes care of memory allocations, data loading, and setup + * for the attributes, as usual. + * + * Currently, the functionality provided here does not overlap with uchar.h + * and ustring.h, except for ucasemap_toTitle(). + * + * ucasemap_utf8XYZ() functions operate directly on UTF-8 strings. + */ + +/** + * UCaseMap is an opaque service object for newer ICU case mapping functions. + * Older functions did not use a service object. + * @stable ICU 3.4 + */ +struct UCaseMap; +typedef struct UCaseMap UCaseMap; /**< C typedef for struct UCaseMap. @stable ICU 3.4 */ + +/** + * Open a UCaseMap service object for a locale and a set of options. + * The locale ID and options are preprocessed so that functions using the + * service object need not process them in each call. + * + * @param locale ICU locale ID, used for language-dependent + * upper-/lower-/title-casing according to the Unicode standard. + * Usual semantics: ""=root, NULL=default locale, etc. + * @param options Options bit set, used for case folding and string comparisons. + * Same flags as for u_foldCase(), u_strFoldCase(), + * u_strCaseCompare(), etc. + * Use 0 or U_FOLD_CASE_DEFAULT for default behavior. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return Pointer to a UCaseMap service object, if successful. + * + * @see U_FOLD_CASE_DEFAULT + * @see U_FOLD_CASE_EXCLUDE_SPECIAL_I + * @see U_TITLECASE_NO_LOWERCASE + * @see U_TITLECASE_NO_BREAK_ADJUSTMENT + * @stable ICU 3.4 + */ +U_STABLE UCaseMap * U_EXPORT2 +ucasemap_open(const char *locale, uint32_t options, UErrorCode *pErrorCode); + +/** + * Close a UCaseMap service object. + * @param csm Object to be closed. + * @stable ICU 3.4 + */ +U_STABLE void U_EXPORT2 +ucasemap_close(UCaseMap *csm); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUCaseMapPointer + * "Smart pointer" class, closes a UCaseMap via ucasemap_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUCaseMapPointer, UCaseMap, ucasemap_close); + +U_NAMESPACE_END + +#endif + +/** + * Get the locale ID that is used for language-dependent case mappings. + * @param csm UCaseMap service object. + * @return locale ID + * @stable ICU 3.4 + */ +U_STABLE const char * U_EXPORT2 +ucasemap_getLocale(const UCaseMap *csm); + +/** + * Get the options bit set that is used for case folding and string comparisons. + * @param csm UCaseMap service object. + * @return options bit set + * @stable ICU 3.4 + */ +U_STABLE uint32_t U_EXPORT2 +ucasemap_getOptions(const UCaseMap *csm); + +/** + * Set the locale ID that is used for language-dependent case mappings. + * + * @param csm UCaseMap service object. + * @param locale Locale ID, see ucasemap_open(). + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * + * @see ucasemap_open + * @stable ICU 3.4 + */ +U_STABLE void U_EXPORT2 +ucasemap_setLocale(UCaseMap *csm, const char *locale, UErrorCode *pErrorCode); + +/** + * Set the options bit set that is used for case folding and string comparisons. + * + * @param csm UCaseMap service object. + * @param options Options bit set, see ucasemap_open(). + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * + * @see ucasemap_open + * @stable ICU 3.4 + */ +U_STABLE void U_EXPORT2 +ucasemap_setOptions(UCaseMap *csm, uint32_t options, UErrorCode *pErrorCode); + +#if !UCONFIG_NO_BREAK_ITERATION + +/** + * Get the break iterator that is used for titlecasing. + * Do not modify the returned break iterator. + * @param csm UCaseMap service object. + * @return titlecasing break iterator + * @stable ICU 3.8 + */ +U_STABLE const UBreakIterator * U_EXPORT2 +ucasemap_getBreakIterator(const UCaseMap *csm); + +/** + * Set the break iterator that is used for titlecasing. + * The UCaseMap service object releases a previously set break iterator + * and "adopts" this new one, taking ownership of it. + * It will be released in a subsequent call to ucasemap_setBreakIterator() + * or ucasemap_close(). + * + * Break iterator operations are not thread-safe. Therefore, titlecasing + * functions use non-const UCaseMap objects. It is not possible to titlecase + * strings concurrently using the same UCaseMap. + * + * @param csm UCaseMap service object. + * @param iterToAdopt Break iterator to be adopted for titlecasing. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * + * @see ucasemap_toTitle + * @see ucasemap_utf8ToTitle + * @stable ICU 3.8 + */ +U_STABLE void U_EXPORT2 +ucasemap_setBreakIterator(UCaseMap *csm, UBreakIterator *iterToAdopt, UErrorCode *pErrorCode); + +/** + * Titlecase a UTF-16 string. This function is almost a duplicate of u_strToTitle(), + * except that it takes ucasemap_setOptions() into account and has performance + * advantages from being able to use a UCaseMap object for multiple case mapping + * operations, saving setup time. + * + * Casing is locale-dependent and context-sensitive. + * Titlecasing uses a break iterator to find the first characters of words + * that are to be titlecased. It titlecases those characters and lowercases + * all others. (This can be modified with ucasemap_setOptions().) + * + * Note: This function takes a non-const UCaseMap pointer because it will + * open a default break iterator if no break iterator was set yet, + * and effectively call ucasemap_setBreakIterator(); + * also because the break iterator is stateful and will be modified during + * the iteration. + * + * The titlecase break iterator can be provided to customize for arbitrary + * styles, using rules and dictionaries beyond the standard iterators. + * The standard titlecase iterator for the root locale implements the + * algorithm of Unicode TR 21. + * + * This function uses only the setText(), first() and next() methods of the + * provided break iterator. + * + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param csm UCaseMap service object. This pointer is non-const! + * See the note above for details. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful - or in case of a buffer overflow, + * in which case it will be greater than destCapacity. + * + * @see u_strToTitle + * @stable ICU 3.8 + */ +U_STABLE int32_t U_EXPORT2 +ucasemap_toTitle(UCaseMap *csm, + UChar *dest, int32_t destCapacity, + const UChar *src, int32_t srcLength, + UErrorCode *pErrorCode); + +#endif // UCONFIG_NO_BREAK_ITERATION + +/** + * Lowercase the characters in a UTF-8 string. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param csm UCaseMap service object. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of bytes). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful - or in case of a buffer overflow, + * in which case it will be greater than destCapacity. + * + * @see u_strToLower + * @stable ICU 3.4 + */ +U_STABLE int32_t U_EXPORT2 +ucasemap_utf8ToLower(const UCaseMap *csm, + char *dest, int32_t destCapacity, + const char *src, int32_t srcLength, + UErrorCode *pErrorCode); + +/** + * Uppercase the characters in a UTF-8 string. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param csm UCaseMap service object. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of bytes). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful - or in case of a buffer overflow, + * in which case it will be greater than destCapacity. + * + * @see u_strToUpper + * @stable ICU 3.4 + */ +U_STABLE int32_t U_EXPORT2 +ucasemap_utf8ToUpper(const UCaseMap *csm, + char *dest, int32_t destCapacity, + const char *src, int32_t srcLength, + UErrorCode *pErrorCode); + +#if !UCONFIG_NO_BREAK_ITERATION + +/** + * Titlecase a UTF-8 string. + * Casing is locale-dependent and context-sensitive. + * Titlecasing uses a break iterator to find the first characters of words + * that are to be titlecased. It titlecases those characters and lowercases + * all others. (This can be modified with ucasemap_setOptions().) + * + * Note: This function takes a non-const UCaseMap pointer because it will + * open a default break iterator if no break iterator was set yet, + * and effectively call ucasemap_setBreakIterator(); + * also because the break iterator is stateful and will be modified during + * the iteration. + * + * The titlecase break iterator can be provided to customize for arbitrary + * styles, using rules and dictionaries beyond the standard iterators. + * The standard titlecase iterator for the root locale implements the + * algorithm of Unicode TR 21. + * + * This function uses only the setUText(), first(), next() and close() methods of the + * provided break iterator. + * + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param csm UCaseMap service object. This pointer is non-const! + * See the note above for details. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of bytes). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful - or in case of a buffer overflow, + * in which case it will be greater than destCapacity. + * + * @see u_strToTitle + * @see U_TITLECASE_NO_LOWERCASE + * @see U_TITLECASE_NO_BREAK_ADJUSTMENT + * @stable ICU 3.8 + */ +U_STABLE int32_t U_EXPORT2 +ucasemap_utf8ToTitle(UCaseMap *csm, + char *dest, int32_t destCapacity, + const char *src, int32_t srcLength, + UErrorCode *pErrorCode); + +#endif + +/** + * Case-folds the characters in a UTF-8 string. + * + * Case-folding is locale-independent and not context-sensitive, + * but there is an option for whether to include or exclude mappings for dotted I + * and dotless i that are marked with 'T' in CaseFolding.txt. + * + * The result may be longer or shorter than the original. + * The source string and the destination buffer must not overlap. + * + * @param csm UCaseMap service object. + * @param dest A buffer for the result string. The result will be NUL-terminated if + * the buffer is large enough. + * The contents is undefined in case of failure. + * @param destCapacity The size of the buffer (number of bytes). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param src The original string. + * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The length of the result string, if successful - or in case of a buffer overflow, + * in which case it will be greater than destCapacity. + * + * @see u_strFoldCase + * @see ucasemap_setOptions + * @see U_FOLD_CASE_DEFAULT + * @see U_FOLD_CASE_EXCLUDE_SPECIAL_I + * @stable ICU 3.8 + */ +U_STABLE int32_t U_EXPORT2 +ucasemap_utf8FoldCase(const UCaseMap *csm, + char *dest, int32_t destCapacity, + const char *src, int32_t srcLength, + UErrorCode *pErrorCode); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ucat.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucat.h new file mode 100644 index 0000000..4d1ff3f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucat.h @@ -0,0 +1,160 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2003-2004, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* Author: Alan Liu +* Created: March 19 2003 +* Since: ICU 2.6 +********************************************************************** +*/ +#ifndef UCAT_H +#define UCAT_H + +#include "unicode/utypes.h" +#include "unicode/ures.h" + +/** + * \file + * \brief C API: Message Catalog Wrappers + * + * This C API provides look-alike functions that deliberately resemble + * the POSIX catopen, catclose, and catgets functions. The underlying + * implementation is in terms of ICU resource bundles, rather than + * POSIX message catalogs. + * + * The ICU resource bundles obey standard ICU inheritance policies. + * To facilitate this, sets and messages are flattened into one tier. + * This is done by creating resource bundle keys of the form + * <set_num>%<msg_num> where set_num is the set number and msg_num is + * the message number, formatted as decimal strings. + * + * Example: Consider a message catalog containing two sets: + * + * Set 1: Message 4 = "Good morning." + * Message 5 = "Good afternoon." + * Message 7 = "Good evening." + * Message 8 = "Good night." + * Set 4: Message 14 = "Please " + * Message 19 = "Thank you." + * Message 20 = "Sincerely," + * + * The ICU resource bundle source file would, assuming it is named + * "greet.txt", would look like this: + * + * greet + * { + * 1%4 { "Good morning." } + * 1%5 { "Good afternoon." } + * 1%7 { "Good evening." } + * 1%8 { "Good night." } + * + * 4%14 { "Please " } + * 4%19 { "Thank you." } + * 4%20 { "Sincerely," } + * } + * + * The catgets function is commonly used in combination with functions + * like printf and strftime. ICU components like message format can + * be used instead, although they use a different format syntax. + * There is an ICU package, icuio, that provides some of + * the POSIX-style formatting API. + */ + +U_CDECL_BEGIN + +/** + * An ICU message catalog descriptor, analogous to nl_catd. + * + * @stable ICU 2.6 + */ +typedef UResourceBundle* u_nl_catd; + +/** + * Open and return an ICU message catalog descriptor. The descriptor + * may be passed to u_catgets() to retrieve localized strings. + * + * @param name string containing the full path pointing to the + * directory where the resources reside followed by the package name + * e.g. "/usr/resource/my_app/resources/guimessages" on a Unix system. + * If NULL, ICU default data files will be used. + * + * Unlike POSIX, environment variables are not interpolated within the + * name. + * + * @param locale the locale for which we want to open the resource. If + * NULL, the default ICU locale will be used (see uloc_getDefault). If + * strlen(locale) == 0, the root locale will be used. + * + * @param ec input/output error code. Upon output, + * U_USING_FALLBACK_WARNING indicates that a fallback locale was + * used. For example, 'de_CH' was requested, but nothing was found + * there, so 'de' was used. U_USING_DEFAULT_WARNING indicates that the + * default locale data or root locale data was used; neither the + * requested locale nor any of its fallback locales were found. + * + * @return a message catalog descriptor that may be passed to + * u_catgets(). If the ec parameter indicates success, then the caller + * is responsible for calling u_catclose() to close the message + * catalog. If the ec parameter indicates failure, then NULL will be + * returned. + * + * @stable ICU 2.6 + */ +U_STABLE u_nl_catd U_EXPORT2 +u_catopen(const char* name, const char* locale, UErrorCode* ec); + +/** + * Close an ICU message catalog, given its descriptor. + * + * @param catd a message catalog descriptor to be closed. May be NULL, + * in which case no action is taken. + * + * @stable ICU 2.6 + */ +U_STABLE void U_EXPORT2 +u_catclose(u_nl_catd catd); + +/** + * Retrieve a localized string from an ICU message catalog. + * + * @param catd a message catalog descriptor returned by u_catopen. + * + * @param set_num the message catalog set number. Sets need not be + * numbered consecutively. + * + * @param msg_num the message catalog message number within the + * set. Messages need not be numbered consecutively. + * + * @param s the default string. This is returned if the string + * specified by the set_num and msg_num is not found. It must be + * zero-terminated. + * + * @param len fill-in parameter to receive the length of the result. + * May be NULL, in which case it is ignored. + * + * @param ec input/output error code. May be U_USING_FALLBACK_WARNING + * or U_USING_DEFAULT_WARNING. U_MISSING_RESOURCE_ERROR indicates that + * the set_num/msg_num tuple does not specify a valid message string + * in this catalog. + * + * @return a pointer to a zero-terminated UChar array which lives in + * an internal buffer area, typically a memory mapped/DLL file. The + * caller must NOT delete this pointer. If the call is unsuccessful + * for any reason, then s is returned. This includes the situation in + * which ec indicates a failing error code upon entry to this + * function. + * + * @stable ICU 2.6 + */ +U_STABLE const UChar* U_EXPORT2 +u_catgets(u_nl_catd catd, int32_t set_num, int32_t msg_num, + const UChar* s, + int32_t* len, UErrorCode* ec); + +U_CDECL_END + +#endif /*UCAT_H*/ +/*eof*/ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/uchar.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/uchar.h new file mode 100644 index 0000000..3613374 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/uchar.h @@ -0,0 +1,3732 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1997-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* +* File UCHAR.H +* +* Modification History: +* +* Date Name Description +* 04/02/97 aliu Creation. +* 03/29/99 helena Updated for C APIs. +* 4/15/99 Madhu Updated for C Implementation and Javadoc +* 5/20/99 Madhu Added the function u_getVersion() +* 8/19/1999 srl Upgraded scripts to Unicode 3.0 +* 8/27/1999 schererm UCharDirection constants: U_... +* 11/11/1999 weiv added u_isalnum(), cleaned comments +* 01/11/2000 helena Renamed u_getVersion to u_getUnicodeVersion(). +****************************************************************************** +*/ + +#ifndef UCHAR_H +#define UCHAR_H + +#include "unicode/utypes.h" +#include "unicode/stringoptions.h" + +U_CDECL_BEGIN + +/*==========================================================================*/ +/* Unicode version number */ +/*==========================================================================*/ +/** + * Unicode version number, default for the current ICU version. + * The actual Unicode Character Database (UCD) data is stored in uprops.dat + * and may be generated from UCD files from a different Unicode version. + * Call u_getUnicodeVersion to get the actual Unicode version of the data. + * + * @see u_getUnicodeVersion + * @stable ICU 2.0 + */ +#define U_UNICODE_VERSION "10.0" + +/** + * \file + * \brief C API: Unicode Properties + * + * This C API provides low-level access to the Unicode Character Database. + * In addition to raw property values, some convenience functions calculate + * derived properties, for example for Java-style programming. + * + * Unicode assigns each code point (not just assigned character) values for + * many properties. + * Most of them are simple boolean flags, or constants from a small enumerated list. + * For some properties, values are strings or other relatively more complex types. + * + * For more information see + * "About the Unicode Character Database" (http://www.unicode.org/ucd/) + * and the ICU User Guide chapter on Properties (http://icu-project.org/userguide/properties.html). + * + * Many functions are designed to match java.lang.Character functions. + * See the individual function documentation, + * and see the JDK 1.4 java.lang.Character documentation + * at http://java.sun.com/j2se/1.4/docs/api/java/lang/Character.html + * + * There are also functions that provide easy migration from C/POSIX functions + * like isblank(). Their use is generally discouraged because the C/POSIX + * standards do not define their semantics beyond the ASCII range, which means + * that different implementations exhibit very different behavior. + * Instead, Unicode properties should be used directly. + * + * There are also only a few, broad C/POSIX character classes, and they tend + * to be used for conflicting purposes. For example, the "isalpha()" class + * is sometimes used to determine word boundaries, while a more sophisticated + * approach would at least distinguish initial letters from continuation + * characters (the latter including combining marks). + * (In ICU, BreakIterator is the most sophisticated API for word boundaries.) + * Another example: There is no "istitle()" class for titlecase characters. + * + * ICU 3.4 and later provides API access for all twelve C/POSIX character classes. + * ICU implements them according to the Standard Recommendations in + * Annex C: Compatibility Properties of UTS #18 Unicode Regular Expressions + * (http://www.unicode.org/reports/tr18/#Compatibility_Properties). + * + * API access for C/POSIX character classes is as follows: + * - alpha: u_isUAlphabetic(c) or u_hasBinaryProperty(c, UCHAR_ALPHABETIC) + * - lower: u_isULowercase(c) or u_hasBinaryProperty(c, UCHAR_LOWERCASE) + * - upper: u_isUUppercase(c) or u_hasBinaryProperty(c, UCHAR_UPPERCASE) + * - punct: u_ispunct(c) + * - digit: u_isdigit(c) or u_charType(c)==U_DECIMAL_DIGIT_NUMBER + * - xdigit: u_isxdigit(c) or u_hasBinaryProperty(c, UCHAR_POSIX_XDIGIT) + * - alnum: u_hasBinaryProperty(c, UCHAR_POSIX_ALNUM) + * - space: u_isUWhiteSpace(c) or u_hasBinaryProperty(c, UCHAR_WHITE_SPACE) + * - blank: u_isblank(c) or u_hasBinaryProperty(c, UCHAR_POSIX_BLANK) + * - cntrl: u_charType(c)==U_CONTROL_CHAR + * - graph: u_hasBinaryProperty(c, UCHAR_POSIX_GRAPH) + * - print: u_hasBinaryProperty(c, UCHAR_POSIX_PRINT) + * + * Note: Some of the u_isxyz() functions in uchar.h predate, and do not match, + * the Standard Recommendations in UTS #18. Instead, they match Java + * functions according to their API documentation. + * + * \htmlonly + * The C/POSIX character classes are also available in UnicodeSet patterns, + * using patterns like [:graph:] or \p{graph}. + * \endhtmlonly + * + * Note: There are several ICU whitespace functions. + * Comparison: + * - u_isUWhiteSpace=UCHAR_WHITE_SPACE: Unicode White_Space property; + * most of general categories "Z" (separators) + most whitespace ISO controls + * (including no-break spaces, but excluding IS1..IS4 and ZWSP) + * - u_isWhitespace: Java isWhitespace; Z + whitespace ISO controls but excluding no-break spaces + * - u_isJavaSpaceChar: Java isSpaceChar; just Z (including no-break spaces) + * - u_isspace: Z + whitespace ISO controls (including no-break spaces) + * - u_isblank: "horizontal spaces" = TAB + Zs - ZWSP + */ + +/** + * Constants. + */ + +/** The lowest Unicode code point value. Code points are non-negative. @stable ICU 2.0 */ +#define UCHAR_MIN_VALUE 0 + +/** + * The highest Unicode code point value (scalar value) according to + * The Unicode Standard. This is a 21-bit value (20.1 bits, rounded up). + * For a single character, UChar32 is a simple type that can hold any code point value. + * + * @see UChar32 + * @stable ICU 2.0 + */ +#define UCHAR_MAX_VALUE 0x10ffff + +/** + * Get a single-bit bit set (a flag) from a bit number 0..31. + * @stable ICU 2.1 + */ +#define U_MASK(x) ((uint32_t)1<<(x)) + +/** + * Selection constants for Unicode properties. + * These constants are used in functions like u_hasBinaryProperty to select + * one of the Unicode properties. + * + * The properties APIs are intended to reflect Unicode properties as defined + * in the Unicode Character Database (UCD) and Unicode Technical Reports (UTR). + * + * For details about the properties see + * UAX #44: Unicode Character Database (http://www.unicode.org/reports/tr44/). + * + * Important: If ICU is built with UCD files from Unicode versions below, e.g., 3.2, + * then properties marked with "new in Unicode 3.2" are not or not fully available. + * Check u_getUnicodeVersion to be sure. + * + * @see u_hasBinaryProperty + * @see u_getIntPropertyValue + * @see u_getUnicodeVersion + * @stable ICU 2.1 + */ +typedef enum UProperty { + /* + * Note: UProperty constants are parsed by preparseucd.py. + * It matches lines like + * UCHAR_=, + */ + + /* Note: Place UCHAR_ALPHABETIC before UCHAR_BINARY_START so that + debuggers display UCHAR_ALPHABETIC as the symbolic name for 0, + rather than UCHAR_BINARY_START. Likewise for other *_START + identifiers. */ + + /** Binary property Alphabetic. Same as u_isUAlphabetic, different from u_isalpha. + Lu+Ll+Lt+Lm+Lo+Nl+Other_Alphabetic @stable ICU 2.1 */ + UCHAR_ALPHABETIC=0, + /** First constant for binary Unicode properties. @stable ICU 2.1 */ + UCHAR_BINARY_START=UCHAR_ALPHABETIC, + /** Binary property ASCII_Hex_Digit. 0-9 A-F a-f @stable ICU 2.1 */ + UCHAR_ASCII_HEX_DIGIT=1, + /** Binary property Bidi_Control. + Format controls which have specific functions + in the Bidi Algorithm. @stable ICU 2.1 */ + UCHAR_BIDI_CONTROL=2, + /** Binary property Bidi_Mirrored. + Characters that may change display in RTL text. + Same as u_isMirrored. + See Bidi Algorithm, UTR 9. @stable ICU 2.1 */ + UCHAR_BIDI_MIRRORED=3, + /** Binary property Dash. Variations of dashes. @stable ICU 2.1 */ + UCHAR_DASH=4, + /** Binary property Default_Ignorable_Code_Point (new in Unicode 3.2). + Ignorable in most processing. + <2060..206F, FFF0..FFFB, E0000..E0FFF>+Other_Default_Ignorable_Code_Point+(Cf+Cc+Cs-White_Space) @stable ICU 2.1 */ + UCHAR_DEFAULT_IGNORABLE_CODE_POINT=5, + /** Binary property Deprecated (new in Unicode 3.2). + The usage of deprecated characters is strongly discouraged. @stable ICU 2.1 */ + UCHAR_DEPRECATED=6, + /** Binary property Diacritic. Characters that linguistically modify + the meaning of another character to which they apply. @stable ICU 2.1 */ + UCHAR_DIACRITIC=7, + /** Binary property Extender. + Extend the value or shape of a preceding alphabetic character, + e.g., length and iteration marks. @stable ICU 2.1 */ + UCHAR_EXTENDER=8, + /** Binary property Full_Composition_Exclusion. + CompositionExclusions.txt+Singleton Decompositions+ + Non-Starter Decompositions. @stable ICU 2.1 */ + UCHAR_FULL_COMPOSITION_EXCLUSION=9, + /** Binary property Grapheme_Base (new in Unicode 3.2). + For programmatic determination of grapheme cluster boundaries. + [0..10FFFF]-Cc-Cf-Cs-Co-Cn-Zl-Zp-Grapheme_Link-Grapheme_Extend-CGJ @stable ICU 2.1 */ + UCHAR_GRAPHEME_BASE=10, + /** Binary property Grapheme_Extend (new in Unicode 3.2). + For programmatic determination of grapheme cluster boundaries. + Me+Mn+Mc+Other_Grapheme_Extend-Grapheme_Link-CGJ @stable ICU 2.1 */ + UCHAR_GRAPHEME_EXTEND=11, + /** Binary property Grapheme_Link (new in Unicode 3.2). + For programmatic determination of grapheme cluster boundaries. @stable ICU 2.1 */ + UCHAR_GRAPHEME_LINK=12, + /** Binary property Hex_Digit. + Characters commonly used for hexadecimal numbers. @stable ICU 2.1 */ + UCHAR_HEX_DIGIT=13, + /** Binary property Hyphen. Dashes used to mark connections + between pieces of words, plus the Katakana middle dot. @stable ICU 2.1 */ + UCHAR_HYPHEN=14, + /** Binary property ID_Continue. + Characters that can continue an identifier. + DerivedCoreProperties.txt also says "NOTE: Cf characters should be filtered out." + ID_Start+Mn+Mc+Nd+Pc @stable ICU 2.1 */ + UCHAR_ID_CONTINUE=15, + /** Binary property ID_Start. + Characters that can start an identifier. + Lu+Ll+Lt+Lm+Lo+Nl @stable ICU 2.1 */ + UCHAR_ID_START=16, + /** Binary property Ideographic. + CJKV ideographs. @stable ICU 2.1 */ + UCHAR_IDEOGRAPHIC=17, + /** Binary property IDS_Binary_Operator (new in Unicode 3.2). + For programmatic determination of + Ideographic Description Sequences. @stable ICU 2.1 */ + UCHAR_IDS_BINARY_OPERATOR=18, + /** Binary property IDS_Trinary_Operator (new in Unicode 3.2). + For programmatic determination of + Ideographic Description Sequences. @stable ICU 2.1 */ + UCHAR_IDS_TRINARY_OPERATOR=19, + /** Binary property Join_Control. + Format controls for cursive joining and ligation. @stable ICU 2.1 */ + UCHAR_JOIN_CONTROL=20, + /** Binary property Logical_Order_Exception (new in Unicode 3.2). + Characters that do not use logical order and + require special handling in most processing. @stable ICU 2.1 */ + UCHAR_LOGICAL_ORDER_EXCEPTION=21, + /** Binary property Lowercase. Same as u_isULowercase, different from u_islower. + Ll+Other_Lowercase @stable ICU 2.1 */ + UCHAR_LOWERCASE=22, + /** Binary property Math. Sm+Other_Math @stable ICU 2.1 */ + UCHAR_MATH=23, + /** Binary property Noncharacter_Code_Point. + Code points that are explicitly defined as illegal + for the encoding of characters. @stable ICU 2.1 */ + UCHAR_NONCHARACTER_CODE_POINT=24, + /** Binary property Quotation_Mark. @stable ICU 2.1 */ + UCHAR_QUOTATION_MARK=25, + /** Binary property Radical (new in Unicode 3.2). + For programmatic determination of + Ideographic Description Sequences. @stable ICU 2.1 */ + UCHAR_RADICAL=26, + /** Binary property Soft_Dotted (new in Unicode 3.2). + Characters with a "soft dot", like i or j. + An accent placed on these characters causes + the dot to disappear. @stable ICU 2.1 */ + UCHAR_SOFT_DOTTED=27, + /** Binary property Terminal_Punctuation. + Punctuation characters that generally mark + the end of textual units. @stable ICU 2.1 */ + UCHAR_TERMINAL_PUNCTUATION=28, + /** Binary property Unified_Ideograph (new in Unicode 3.2). + For programmatic determination of + Ideographic Description Sequences. @stable ICU 2.1 */ + UCHAR_UNIFIED_IDEOGRAPH=29, + /** Binary property Uppercase. Same as u_isUUppercase, different from u_isupper. + Lu+Other_Uppercase @stable ICU 2.1 */ + UCHAR_UPPERCASE=30, + /** Binary property White_Space. + Same as u_isUWhiteSpace, different from u_isspace and u_isWhitespace. + Space characters+TAB+CR+LF-ZWSP-ZWNBSP @stable ICU 2.1 */ + UCHAR_WHITE_SPACE=31, + /** Binary property XID_Continue. + ID_Continue modified to allow closure under + normalization forms NFKC and NFKD. @stable ICU 2.1 */ + UCHAR_XID_CONTINUE=32, + /** Binary property XID_Start. ID_Start modified to allow + closure under normalization forms NFKC and NFKD. @stable ICU 2.1 */ + UCHAR_XID_START=33, + /** Binary property Case_Sensitive. Either the source of a case + mapping or _in_ the target of a case mapping. Not the same as + the general category Cased_Letter. @stable ICU 2.6 */ + UCHAR_CASE_SENSITIVE=34, + /** Binary property STerm (new in Unicode 4.0.1). + Sentence Terminal. Used in UAX #29: Text Boundaries + (http://www.unicode.org/reports/tr29/) + @stable ICU 3.0 */ + UCHAR_S_TERM=35, + /** Binary property Variation_Selector (new in Unicode 4.0.1). + Indicates all those characters that qualify as Variation Selectors. + For details on the behavior of these characters, + see StandardizedVariants.html and 15.6 Variation Selectors. + @stable ICU 3.0 */ + UCHAR_VARIATION_SELECTOR=36, + /** Binary property NFD_Inert. + ICU-specific property for characters that are inert under NFD, + i.e., they do not interact with adjacent characters. + See the documentation for the Normalizer2 class and the + Normalizer2::isInert() method. + @stable ICU 3.0 */ + UCHAR_NFD_INERT=37, + /** Binary property NFKD_Inert. + ICU-specific property for characters that are inert under NFKD, + i.e., they do not interact with adjacent characters. + See the documentation for the Normalizer2 class and the + Normalizer2::isInert() method. + @stable ICU 3.0 */ + UCHAR_NFKD_INERT=38, + /** Binary property NFC_Inert. + ICU-specific property for characters that are inert under NFC, + i.e., they do not interact with adjacent characters. + See the documentation for the Normalizer2 class and the + Normalizer2::isInert() method. + @stable ICU 3.0 */ + UCHAR_NFC_INERT=39, + /** Binary property NFKC_Inert. + ICU-specific property for characters that are inert under NFKC, + i.e., they do not interact with adjacent characters. + See the documentation for the Normalizer2 class and the + Normalizer2::isInert() method. + @stable ICU 3.0 */ + UCHAR_NFKC_INERT=40, + /** Binary Property Segment_Starter. + ICU-specific property for characters that are starters in terms of + Unicode normalization and combining character sequences. + They have ccc=0 and do not occur in non-initial position of the + canonical decomposition of any character + (like a-umlaut in NFD and a Jamo T in an NFD(Hangul LVT)). + ICU uses this property for segmenting a string for generating a set of + canonically equivalent strings, e.g. for canonical closure while + processing collation tailoring rules. + @stable ICU 3.0 */ + UCHAR_SEGMENT_STARTER=41, + /** Binary property Pattern_Syntax (new in Unicode 4.1). + See UAX #31 Identifier and Pattern Syntax + (http://www.unicode.org/reports/tr31/) + @stable ICU 3.4 */ + UCHAR_PATTERN_SYNTAX=42, + /** Binary property Pattern_White_Space (new in Unicode 4.1). + See UAX #31 Identifier and Pattern Syntax + (http://www.unicode.org/reports/tr31/) + @stable ICU 3.4 */ + UCHAR_PATTERN_WHITE_SPACE=43, + /** Binary property alnum (a C/POSIX character class). + Implemented according to the UTS #18 Annex C Standard Recommendation. + See the uchar.h file documentation. + @stable ICU 3.4 */ + UCHAR_POSIX_ALNUM=44, + /** Binary property blank (a C/POSIX character class). + Implemented according to the UTS #18 Annex C Standard Recommendation. + See the uchar.h file documentation. + @stable ICU 3.4 */ + UCHAR_POSIX_BLANK=45, + /** Binary property graph (a C/POSIX character class). + Implemented according to the UTS #18 Annex C Standard Recommendation. + See the uchar.h file documentation. + @stable ICU 3.4 */ + UCHAR_POSIX_GRAPH=46, + /** Binary property print (a C/POSIX character class). + Implemented according to the UTS #18 Annex C Standard Recommendation. + See the uchar.h file documentation. + @stable ICU 3.4 */ + UCHAR_POSIX_PRINT=47, + /** Binary property xdigit (a C/POSIX character class). + Implemented according to the UTS #18 Annex C Standard Recommendation. + See the uchar.h file documentation. + @stable ICU 3.4 */ + UCHAR_POSIX_XDIGIT=48, + /** Binary property Cased. For Lowercase, Uppercase and Titlecase characters. @stable ICU 4.4 */ + UCHAR_CASED=49, + /** Binary property Case_Ignorable. Used in context-sensitive case mappings. @stable ICU 4.4 */ + UCHAR_CASE_IGNORABLE=50, + /** Binary property Changes_When_Lowercased. @stable ICU 4.4 */ + UCHAR_CHANGES_WHEN_LOWERCASED=51, + /** Binary property Changes_When_Uppercased. @stable ICU 4.4 */ + UCHAR_CHANGES_WHEN_UPPERCASED=52, + /** Binary property Changes_When_Titlecased. @stable ICU 4.4 */ + UCHAR_CHANGES_WHEN_TITLECASED=53, + /** Binary property Changes_When_Casefolded. @stable ICU 4.4 */ + UCHAR_CHANGES_WHEN_CASEFOLDED=54, + /** Binary property Changes_When_Casemapped. @stable ICU 4.4 */ + UCHAR_CHANGES_WHEN_CASEMAPPED=55, + /** Binary property Changes_When_NFKC_Casefolded. @stable ICU 4.4 */ + UCHAR_CHANGES_WHEN_NFKC_CASEFOLDED=56, + /** + * Binary property Emoji. + * See http://www.unicode.org/reports/tr51/#Emoji_Properties + * + * @stable ICU 57 + */ + UCHAR_EMOJI=57, + /** + * Binary property Emoji_Presentation. + * See http://www.unicode.org/reports/tr51/#Emoji_Properties + * + * @stable ICU 57 + */ + UCHAR_EMOJI_PRESENTATION=58, + /** + * Binary property Emoji_Modifier. + * See http://www.unicode.org/reports/tr51/#Emoji_Properties + * + * @stable ICU 57 + */ + UCHAR_EMOJI_MODIFIER=59, + /** + * Binary property Emoji_Modifier_Base. + * See http://www.unicode.org/reports/tr51/#Emoji_Properties + * + * @stable ICU 57 + */ + UCHAR_EMOJI_MODIFIER_BASE=60, + /** + * Binary property Emoji_Component. + * See http://www.unicode.org/reports/tr51/#Emoji_Properties + * + * @stable ICU 60 + */ + UCHAR_EMOJI_COMPONENT=61, + /** + * Binary property Regional_Indicator. + * @stable ICU 60 + */ + UCHAR_REGIONAL_INDICATOR=62, + /** + * Binary property Prepended_Concatenation_Mark. + * @stable ICU 60 + */ + UCHAR_PREPENDED_CONCATENATION_MARK=63, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the last constant for binary Unicode properties. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UCHAR_BINARY_LIMIT, +#endif // U_HIDE_DEPRECATED_API + + /** Enumerated property Bidi_Class. + Same as u_charDirection, returns UCharDirection values. @stable ICU 2.2 */ + UCHAR_BIDI_CLASS=0x1000, + /** First constant for enumerated/integer Unicode properties. @stable ICU 2.2 */ + UCHAR_INT_START=UCHAR_BIDI_CLASS, + /** Enumerated property Block. + Same as ublock_getCode, returns UBlockCode values. @stable ICU 2.2 */ + UCHAR_BLOCK=0x1001, + /** Enumerated property Canonical_Combining_Class. + Same as u_getCombiningClass, returns 8-bit numeric values. @stable ICU 2.2 */ + UCHAR_CANONICAL_COMBINING_CLASS=0x1002, + /** Enumerated property Decomposition_Type. + Returns UDecompositionType values. @stable ICU 2.2 */ + UCHAR_DECOMPOSITION_TYPE=0x1003, + /** Enumerated property East_Asian_Width. + See http://www.unicode.org/reports/tr11/ + Returns UEastAsianWidth values. @stable ICU 2.2 */ + UCHAR_EAST_ASIAN_WIDTH=0x1004, + /** Enumerated property General_Category. + Same as u_charType, returns UCharCategory values. @stable ICU 2.2 */ + UCHAR_GENERAL_CATEGORY=0x1005, + /** Enumerated property Joining_Group. + Returns UJoiningGroup values. @stable ICU 2.2 */ + UCHAR_JOINING_GROUP=0x1006, + /** Enumerated property Joining_Type. + Returns UJoiningType values. @stable ICU 2.2 */ + UCHAR_JOINING_TYPE=0x1007, + /** Enumerated property Line_Break. + Returns ULineBreak values. @stable ICU 2.2 */ + UCHAR_LINE_BREAK=0x1008, + /** Enumerated property Numeric_Type. + Returns UNumericType values. @stable ICU 2.2 */ + UCHAR_NUMERIC_TYPE=0x1009, + /** Enumerated property Script. + Same as uscript_getScript, returns UScriptCode values. @stable ICU 2.2 */ + UCHAR_SCRIPT=0x100A, + /** Enumerated property Hangul_Syllable_Type, new in Unicode 4. + Returns UHangulSyllableType values. @stable ICU 2.6 */ + UCHAR_HANGUL_SYLLABLE_TYPE=0x100B, + /** Enumerated property NFD_Quick_Check. + Returns UNormalizationCheckResult values. @stable ICU 3.0 */ + UCHAR_NFD_QUICK_CHECK=0x100C, + /** Enumerated property NFKD_Quick_Check. + Returns UNormalizationCheckResult values. @stable ICU 3.0 */ + UCHAR_NFKD_QUICK_CHECK=0x100D, + /** Enumerated property NFC_Quick_Check. + Returns UNormalizationCheckResult values. @stable ICU 3.0 */ + UCHAR_NFC_QUICK_CHECK=0x100E, + /** Enumerated property NFKC_Quick_Check. + Returns UNormalizationCheckResult values. @stable ICU 3.0 */ + UCHAR_NFKC_QUICK_CHECK=0x100F, + /** Enumerated property Lead_Canonical_Combining_Class. + ICU-specific property for the ccc of the first code point + of the decomposition, or lccc(c)=ccc(NFD(c)[0]). + Useful for checking for canonically ordered text; + see UNORM_FCD and http://www.unicode.org/notes/tn5/#FCD . + Returns 8-bit numeric values like UCHAR_CANONICAL_COMBINING_CLASS. @stable ICU 3.0 */ + UCHAR_LEAD_CANONICAL_COMBINING_CLASS=0x1010, + /** Enumerated property Trail_Canonical_Combining_Class. + ICU-specific property for the ccc of the last code point + of the decomposition, or tccc(c)=ccc(NFD(c)[last]). + Useful for checking for canonically ordered text; + see UNORM_FCD and http://www.unicode.org/notes/tn5/#FCD . + Returns 8-bit numeric values like UCHAR_CANONICAL_COMBINING_CLASS. @stable ICU 3.0 */ + UCHAR_TRAIL_CANONICAL_COMBINING_CLASS=0x1011, + /** Enumerated property Grapheme_Cluster_Break (new in Unicode 4.1). + Used in UAX #29: Text Boundaries + (http://www.unicode.org/reports/tr29/) + Returns UGraphemeClusterBreak values. @stable ICU 3.4 */ + UCHAR_GRAPHEME_CLUSTER_BREAK=0x1012, + /** Enumerated property Sentence_Break (new in Unicode 4.1). + Used in UAX #29: Text Boundaries + (http://www.unicode.org/reports/tr29/) + Returns USentenceBreak values. @stable ICU 3.4 */ + UCHAR_SENTENCE_BREAK=0x1013, + /** Enumerated property Word_Break (new in Unicode 4.1). + Used in UAX #29: Text Boundaries + (http://www.unicode.org/reports/tr29/) + Returns UWordBreakValues values. @stable ICU 3.4 */ + UCHAR_WORD_BREAK=0x1014, + /** Enumerated property Bidi_Paired_Bracket_Type (new in Unicode 6.3). + Used in UAX #9: Unicode Bidirectional Algorithm + (http://www.unicode.org/reports/tr9/) + Returns UBidiPairedBracketType values. @stable ICU 52 */ + UCHAR_BIDI_PAIRED_BRACKET_TYPE=0x1015, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the last constant for enumerated/integer Unicode properties. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UCHAR_INT_LIMIT=0x1016, +#endif // U_HIDE_DEPRECATED_API + + /** Bitmask property General_Category_Mask. + This is the General_Category property returned as a bit mask. + When used in u_getIntPropertyValue(c), same as U_MASK(u_charType(c)), + returns bit masks for UCharCategory values where exactly one bit is set. + When used with u_getPropertyValueName() and u_getPropertyValueEnum(), + a multi-bit mask is used for sets of categories like "Letters". + Mask values should be cast to uint32_t. + @stable ICU 2.4 */ + UCHAR_GENERAL_CATEGORY_MASK=0x2000, + /** First constant for bit-mask Unicode properties. @stable ICU 2.4 */ + UCHAR_MASK_START=UCHAR_GENERAL_CATEGORY_MASK, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the last constant for bit-mask Unicode properties. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UCHAR_MASK_LIMIT=0x2001, +#endif // U_HIDE_DEPRECATED_API + + /** Double property Numeric_Value. + Corresponds to u_getNumericValue. @stable ICU 2.4 */ + UCHAR_NUMERIC_VALUE=0x3000, + /** First constant for double Unicode properties. @stable ICU 2.4 */ + UCHAR_DOUBLE_START=UCHAR_NUMERIC_VALUE, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the last constant for double Unicode properties. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UCHAR_DOUBLE_LIMIT=0x3001, +#endif // U_HIDE_DEPRECATED_API + + /** String property Age. + Corresponds to u_charAge. @stable ICU 2.4 */ + UCHAR_AGE=0x4000, + /** First constant for string Unicode properties. @stable ICU 2.4 */ + UCHAR_STRING_START=UCHAR_AGE, + /** String property Bidi_Mirroring_Glyph. + Corresponds to u_charMirror. @stable ICU 2.4 */ + UCHAR_BIDI_MIRRORING_GLYPH=0x4001, + /** String property Case_Folding. + Corresponds to u_strFoldCase in ustring.h. @stable ICU 2.4 */ + UCHAR_CASE_FOLDING=0x4002, +#ifndef U_HIDE_DEPRECATED_API + /** Deprecated string property ISO_Comment. + Corresponds to u_getISOComment. @deprecated ICU 49 */ + UCHAR_ISO_COMMENT=0x4003, +#endif /* U_HIDE_DEPRECATED_API */ + /** String property Lowercase_Mapping. + Corresponds to u_strToLower in ustring.h. @stable ICU 2.4 */ + UCHAR_LOWERCASE_MAPPING=0x4004, + /** String property Name. + Corresponds to u_charName. @stable ICU 2.4 */ + UCHAR_NAME=0x4005, + /** String property Simple_Case_Folding. + Corresponds to u_foldCase. @stable ICU 2.4 */ + UCHAR_SIMPLE_CASE_FOLDING=0x4006, + /** String property Simple_Lowercase_Mapping. + Corresponds to u_tolower. @stable ICU 2.4 */ + UCHAR_SIMPLE_LOWERCASE_MAPPING=0x4007, + /** String property Simple_Titlecase_Mapping. + Corresponds to u_totitle. @stable ICU 2.4 */ + UCHAR_SIMPLE_TITLECASE_MAPPING=0x4008, + /** String property Simple_Uppercase_Mapping. + Corresponds to u_toupper. @stable ICU 2.4 */ + UCHAR_SIMPLE_UPPERCASE_MAPPING=0x4009, + /** String property Titlecase_Mapping. + Corresponds to u_strToTitle in ustring.h. @stable ICU 2.4 */ + UCHAR_TITLECASE_MAPPING=0x400A, +#ifndef U_HIDE_DEPRECATED_API + /** String property Unicode_1_Name. + This property is of little practical value. + Beginning with ICU 49, ICU APIs return an empty string for this property. + Corresponds to u_charName(U_UNICODE_10_CHAR_NAME). @deprecated ICU 49 */ + UCHAR_UNICODE_1_NAME=0x400B, +#endif /* U_HIDE_DEPRECATED_API */ + /** String property Uppercase_Mapping. + Corresponds to u_strToUpper in ustring.h. @stable ICU 2.4 */ + UCHAR_UPPERCASE_MAPPING=0x400C, + /** String property Bidi_Paired_Bracket (new in Unicode 6.3). + Corresponds to u_getBidiPairedBracket. @stable ICU 52 */ + UCHAR_BIDI_PAIRED_BRACKET=0x400D, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the last constant for string Unicode properties. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UCHAR_STRING_LIMIT=0x400E, +#endif // U_HIDE_DEPRECATED_API + + /** Miscellaneous property Script_Extensions (new in Unicode 6.0). + Some characters are commonly used in multiple scripts. + For more information, see UAX #24: http://www.unicode.org/reports/tr24/. + Corresponds to uscript_hasScript and uscript_getScriptExtensions in uscript.h. + @stable ICU 4.6 */ + UCHAR_SCRIPT_EXTENSIONS=0x7000, + /** First constant for Unicode properties with unusual value types. @stable ICU 4.6 */ + UCHAR_OTHER_PROPERTY_START=UCHAR_SCRIPT_EXTENSIONS, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the last constant for Unicode properties with unusual value types. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UCHAR_OTHER_PROPERTY_LIMIT=0x7001, +#endif // U_HIDE_DEPRECATED_API + + /** Represents a nonexistent or invalid property or property value. @stable ICU 2.4 */ + UCHAR_INVALID_CODE = -1 +} UProperty; + +/** + * Data for enumerated Unicode general category types. + * See http://www.unicode.org/Public/UNIDATA/UnicodeData.html . + * @stable ICU 2.0 + */ +typedef enum UCharCategory +{ + /* + * Note: UCharCategory constants and their API comments are parsed by preparseucd.py. + * It matches pairs of lines like + * / ** comment... * / + * U_<[A-Z_]+> = , + */ + + /** Non-category for unassigned and non-character code points. @stable ICU 2.0 */ + U_UNASSIGNED = 0, + /** Cn "Other, Not Assigned (no characters in [UnicodeData.txt] have this property)" (same as U_UNASSIGNED!) @stable ICU 2.0 */ + U_GENERAL_OTHER_TYPES = 0, + /** Lu @stable ICU 2.0 */ + U_UPPERCASE_LETTER = 1, + /** Ll @stable ICU 2.0 */ + U_LOWERCASE_LETTER = 2, + /** Lt @stable ICU 2.0 */ + U_TITLECASE_LETTER = 3, + /** Lm @stable ICU 2.0 */ + U_MODIFIER_LETTER = 4, + /** Lo @stable ICU 2.0 */ + U_OTHER_LETTER = 5, + /** Mn @stable ICU 2.0 */ + U_NON_SPACING_MARK = 6, + /** Me @stable ICU 2.0 */ + U_ENCLOSING_MARK = 7, + /** Mc @stable ICU 2.0 */ + U_COMBINING_SPACING_MARK = 8, + /** Nd @stable ICU 2.0 */ + U_DECIMAL_DIGIT_NUMBER = 9, + /** Nl @stable ICU 2.0 */ + U_LETTER_NUMBER = 10, + /** No @stable ICU 2.0 */ + U_OTHER_NUMBER = 11, + /** Zs @stable ICU 2.0 */ + U_SPACE_SEPARATOR = 12, + /** Zl @stable ICU 2.0 */ + U_LINE_SEPARATOR = 13, + /** Zp @stable ICU 2.0 */ + U_PARAGRAPH_SEPARATOR = 14, + /** Cc @stable ICU 2.0 */ + U_CONTROL_CHAR = 15, + /** Cf @stable ICU 2.0 */ + U_FORMAT_CHAR = 16, + /** Co @stable ICU 2.0 */ + U_PRIVATE_USE_CHAR = 17, + /** Cs @stable ICU 2.0 */ + U_SURROGATE = 18, + /** Pd @stable ICU 2.0 */ + U_DASH_PUNCTUATION = 19, + /** Ps @stable ICU 2.0 */ + U_START_PUNCTUATION = 20, + /** Pe @stable ICU 2.0 */ + U_END_PUNCTUATION = 21, + /** Pc @stable ICU 2.0 */ + U_CONNECTOR_PUNCTUATION = 22, + /** Po @stable ICU 2.0 */ + U_OTHER_PUNCTUATION = 23, + /** Sm @stable ICU 2.0 */ + U_MATH_SYMBOL = 24, + /** Sc @stable ICU 2.0 */ + U_CURRENCY_SYMBOL = 25, + /** Sk @stable ICU 2.0 */ + U_MODIFIER_SYMBOL = 26, + /** So @stable ICU 2.0 */ + U_OTHER_SYMBOL = 27, + /** Pi @stable ICU 2.0 */ + U_INITIAL_PUNCTUATION = 28, + /** Pf @stable ICU 2.0 */ + U_FINAL_PUNCTUATION = 29, + /** + * One higher than the last enum UCharCategory constant. + * This numeric value is stable (will not change), see + * http://www.unicode.org/policies/stability_policy.html#Property_Value + * + * @stable ICU 2.0 + */ + U_CHAR_CATEGORY_COUNT +} UCharCategory; + +/** + * U_GC_XX_MASK constants are bit flags corresponding to Unicode + * general category values. + * For each category, the nth bit is set if the numeric value of the + * corresponding UCharCategory constant is n. + * + * There are also some U_GC_Y_MASK constants for groups of general categories + * like L for all letter categories. + * + * @see u_charType + * @see U_GET_GC_MASK + * @see UCharCategory + * @stable ICU 2.1 + */ +#define U_GC_CN_MASK U_MASK(U_GENERAL_OTHER_TYPES) + +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_LU_MASK U_MASK(U_UPPERCASE_LETTER) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_LL_MASK U_MASK(U_LOWERCASE_LETTER) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_LT_MASK U_MASK(U_TITLECASE_LETTER) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_LM_MASK U_MASK(U_MODIFIER_LETTER) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_LO_MASK U_MASK(U_OTHER_LETTER) + +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_MN_MASK U_MASK(U_NON_SPACING_MARK) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_ME_MASK U_MASK(U_ENCLOSING_MARK) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_MC_MASK U_MASK(U_COMBINING_SPACING_MARK) + +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_ND_MASK U_MASK(U_DECIMAL_DIGIT_NUMBER) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_NL_MASK U_MASK(U_LETTER_NUMBER) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_NO_MASK U_MASK(U_OTHER_NUMBER) + +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_ZS_MASK U_MASK(U_SPACE_SEPARATOR) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_ZL_MASK U_MASK(U_LINE_SEPARATOR) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_ZP_MASK U_MASK(U_PARAGRAPH_SEPARATOR) + +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_CC_MASK U_MASK(U_CONTROL_CHAR) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_CF_MASK U_MASK(U_FORMAT_CHAR) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_CO_MASK U_MASK(U_PRIVATE_USE_CHAR) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_CS_MASK U_MASK(U_SURROGATE) + +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_PD_MASK U_MASK(U_DASH_PUNCTUATION) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_PS_MASK U_MASK(U_START_PUNCTUATION) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_PE_MASK U_MASK(U_END_PUNCTUATION) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_PC_MASK U_MASK(U_CONNECTOR_PUNCTUATION) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_PO_MASK U_MASK(U_OTHER_PUNCTUATION) + +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_SM_MASK U_MASK(U_MATH_SYMBOL) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_SC_MASK U_MASK(U_CURRENCY_SYMBOL) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_SK_MASK U_MASK(U_MODIFIER_SYMBOL) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_SO_MASK U_MASK(U_OTHER_SYMBOL) + +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_PI_MASK U_MASK(U_INITIAL_PUNCTUATION) +/** Mask constant for a UCharCategory. @stable ICU 2.1 */ +#define U_GC_PF_MASK U_MASK(U_FINAL_PUNCTUATION) + + +/** Mask constant for multiple UCharCategory bits (L Letters). @stable ICU 2.1 */ +#define U_GC_L_MASK \ + (U_GC_LU_MASK|U_GC_LL_MASK|U_GC_LT_MASK|U_GC_LM_MASK|U_GC_LO_MASK) + +/** Mask constant for multiple UCharCategory bits (LC Cased Letters). @stable ICU 2.1 */ +#define U_GC_LC_MASK \ + (U_GC_LU_MASK|U_GC_LL_MASK|U_GC_LT_MASK) + +/** Mask constant for multiple UCharCategory bits (M Marks). @stable ICU 2.1 */ +#define U_GC_M_MASK (U_GC_MN_MASK|U_GC_ME_MASK|U_GC_MC_MASK) + +/** Mask constant for multiple UCharCategory bits (N Numbers). @stable ICU 2.1 */ +#define U_GC_N_MASK (U_GC_ND_MASK|U_GC_NL_MASK|U_GC_NO_MASK) + +/** Mask constant for multiple UCharCategory bits (Z Separators). @stable ICU 2.1 */ +#define U_GC_Z_MASK (U_GC_ZS_MASK|U_GC_ZL_MASK|U_GC_ZP_MASK) + +/** Mask constant for multiple UCharCategory bits (C Others). @stable ICU 2.1 */ +#define U_GC_C_MASK \ + (U_GC_CN_MASK|U_GC_CC_MASK|U_GC_CF_MASK|U_GC_CO_MASK|U_GC_CS_MASK) + +/** Mask constant for multiple UCharCategory bits (P Punctuation). @stable ICU 2.1 */ +#define U_GC_P_MASK \ + (U_GC_PD_MASK|U_GC_PS_MASK|U_GC_PE_MASK|U_GC_PC_MASK|U_GC_PO_MASK| \ + U_GC_PI_MASK|U_GC_PF_MASK) + +/** Mask constant for multiple UCharCategory bits (S Symbols). @stable ICU 2.1 */ +#define U_GC_S_MASK (U_GC_SM_MASK|U_GC_SC_MASK|U_GC_SK_MASK|U_GC_SO_MASK) + +/** + * This specifies the language directional property of a character set. + * @stable ICU 2.0 + */ +typedef enum UCharDirection { + /* + * Note: UCharDirection constants and their API comments are parsed by preparseucd.py. + * It matches pairs of lines like + * / ** comment... * / + * U_<[A-Z_]+> = , + */ + + /** L @stable ICU 2.0 */ + U_LEFT_TO_RIGHT = 0, + /** R @stable ICU 2.0 */ + U_RIGHT_TO_LEFT = 1, + /** EN @stable ICU 2.0 */ + U_EUROPEAN_NUMBER = 2, + /** ES @stable ICU 2.0 */ + U_EUROPEAN_NUMBER_SEPARATOR = 3, + /** ET @stable ICU 2.0 */ + U_EUROPEAN_NUMBER_TERMINATOR = 4, + /** AN @stable ICU 2.0 */ + U_ARABIC_NUMBER = 5, + /** CS @stable ICU 2.0 */ + U_COMMON_NUMBER_SEPARATOR = 6, + /** B @stable ICU 2.0 */ + U_BLOCK_SEPARATOR = 7, + /** S @stable ICU 2.0 */ + U_SEGMENT_SEPARATOR = 8, + /** WS @stable ICU 2.0 */ + U_WHITE_SPACE_NEUTRAL = 9, + /** ON @stable ICU 2.0 */ + U_OTHER_NEUTRAL = 10, + /** LRE @stable ICU 2.0 */ + U_LEFT_TO_RIGHT_EMBEDDING = 11, + /** LRO @stable ICU 2.0 */ + U_LEFT_TO_RIGHT_OVERRIDE = 12, + /** AL @stable ICU 2.0 */ + U_RIGHT_TO_LEFT_ARABIC = 13, + /** RLE @stable ICU 2.0 */ + U_RIGHT_TO_LEFT_EMBEDDING = 14, + /** RLO @stable ICU 2.0 */ + U_RIGHT_TO_LEFT_OVERRIDE = 15, + /** PDF @stable ICU 2.0 */ + U_POP_DIRECTIONAL_FORMAT = 16, + /** NSM @stable ICU 2.0 */ + U_DIR_NON_SPACING_MARK = 17, + /** BN @stable ICU 2.0 */ + U_BOUNDARY_NEUTRAL = 18, + /** FSI @stable ICU 52 */ + U_FIRST_STRONG_ISOLATE = 19, + /** LRI @stable ICU 52 */ + U_LEFT_TO_RIGHT_ISOLATE = 20, + /** RLI @stable ICU 52 */ + U_RIGHT_TO_LEFT_ISOLATE = 21, + /** PDI @stable ICU 52 */ + U_POP_DIRECTIONAL_ISOLATE = 22, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest UCharDirection value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_BIDI_CLASS). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_CHAR_DIRECTION_COUNT +#endif // U_HIDE_DEPRECATED_API +} UCharDirection; + +/** + * Bidi Paired Bracket Type constants. + * + * @see UCHAR_BIDI_PAIRED_BRACKET_TYPE + * @stable ICU 52 + */ +typedef enum UBidiPairedBracketType { + /* + * Note: UBidiPairedBracketType constants are parsed by preparseucd.py. + * It matches lines like + * U_BPT_ + */ + + /** Not a paired bracket. @stable ICU 52 */ + U_BPT_NONE, + /** Open paired bracket. @stable ICU 52 */ + U_BPT_OPEN, + /** Close paired bracket. @stable ICU 52 */ + U_BPT_CLOSE, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UBidiPairedBracketType value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_BIDI_PAIRED_BRACKET_TYPE). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_BPT_COUNT /* 3 */ +#endif // U_HIDE_DEPRECATED_API +} UBidiPairedBracketType; + +/** + * Constants for Unicode blocks, see the Unicode Data file Blocks.txt + * @stable ICU 2.0 + */ +enum UBlockCode { + /* + * Note: UBlockCode constants are parsed by preparseucd.py. + * It matches lines like + * UBLOCK_ = , + */ + + /** New No_Block value in Unicode 4. @stable ICU 2.6 */ + UBLOCK_NO_BLOCK = 0, /*[none]*/ /* Special range indicating No_Block */ + + /** @stable ICU 2.0 */ + UBLOCK_BASIC_LATIN = 1, /*[0000]*/ + + /** @stable ICU 2.0 */ + UBLOCK_LATIN_1_SUPPLEMENT=2, /*[0080]*/ + + /** @stable ICU 2.0 */ + UBLOCK_LATIN_EXTENDED_A =3, /*[0100]*/ + + /** @stable ICU 2.0 */ + UBLOCK_LATIN_EXTENDED_B =4, /*[0180]*/ + + /** @stable ICU 2.0 */ + UBLOCK_IPA_EXTENSIONS =5, /*[0250]*/ + + /** @stable ICU 2.0 */ + UBLOCK_SPACING_MODIFIER_LETTERS =6, /*[02B0]*/ + + /** @stable ICU 2.0 */ + UBLOCK_COMBINING_DIACRITICAL_MARKS =7, /*[0300]*/ + + /** + * Unicode 3.2 renames this block to "Greek and Coptic". + * @stable ICU 2.0 + */ + UBLOCK_GREEK =8, /*[0370]*/ + + /** @stable ICU 2.0 */ + UBLOCK_CYRILLIC =9, /*[0400]*/ + + /** @stable ICU 2.0 */ + UBLOCK_ARMENIAN =10, /*[0530]*/ + + /** @stable ICU 2.0 */ + UBLOCK_HEBREW =11, /*[0590]*/ + + /** @stable ICU 2.0 */ + UBLOCK_ARABIC =12, /*[0600]*/ + + /** @stable ICU 2.0 */ + UBLOCK_SYRIAC =13, /*[0700]*/ + + /** @stable ICU 2.0 */ + UBLOCK_THAANA =14, /*[0780]*/ + + /** @stable ICU 2.0 */ + UBLOCK_DEVANAGARI =15, /*[0900]*/ + + /** @stable ICU 2.0 */ + UBLOCK_BENGALI =16, /*[0980]*/ + + /** @stable ICU 2.0 */ + UBLOCK_GURMUKHI =17, /*[0A00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_GUJARATI =18, /*[0A80]*/ + + /** @stable ICU 2.0 */ + UBLOCK_ORIYA =19, /*[0B00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_TAMIL =20, /*[0B80]*/ + + /** @stable ICU 2.0 */ + UBLOCK_TELUGU =21, /*[0C00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_KANNADA =22, /*[0C80]*/ + + /** @stable ICU 2.0 */ + UBLOCK_MALAYALAM =23, /*[0D00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_SINHALA =24, /*[0D80]*/ + + /** @stable ICU 2.0 */ + UBLOCK_THAI =25, /*[0E00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_LAO =26, /*[0E80]*/ + + /** @stable ICU 2.0 */ + UBLOCK_TIBETAN =27, /*[0F00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_MYANMAR =28, /*[1000]*/ + + /** @stable ICU 2.0 */ + UBLOCK_GEORGIAN =29, /*[10A0]*/ + + /** @stable ICU 2.0 */ + UBLOCK_HANGUL_JAMO =30, /*[1100]*/ + + /** @stable ICU 2.0 */ + UBLOCK_ETHIOPIC =31, /*[1200]*/ + + /** @stable ICU 2.0 */ + UBLOCK_CHEROKEE =32, /*[13A0]*/ + + /** @stable ICU 2.0 */ + UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS =33, /*[1400]*/ + + /** @stable ICU 2.0 */ + UBLOCK_OGHAM =34, /*[1680]*/ + + /** @stable ICU 2.0 */ + UBLOCK_RUNIC =35, /*[16A0]*/ + + /** @stable ICU 2.0 */ + UBLOCK_KHMER =36, /*[1780]*/ + + /** @stable ICU 2.0 */ + UBLOCK_MONGOLIAN =37, /*[1800]*/ + + /** @stable ICU 2.0 */ + UBLOCK_LATIN_EXTENDED_ADDITIONAL =38, /*[1E00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_GREEK_EXTENDED =39, /*[1F00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_GENERAL_PUNCTUATION =40, /*[2000]*/ + + /** @stable ICU 2.0 */ + UBLOCK_SUPERSCRIPTS_AND_SUBSCRIPTS =41, /*[2070]*/ + + /** @stable ICU 2.0 */ + UBLOCK_CURRENCY_SYMBOLS =42, /*[20A0]*/ + + /** + * Unicode 3.2 renames this block to "Combining Diacritical Marks for Symbols". + * @stable ICU 2.0 + */ + UBLOCK_COMBINING_MARKS_FOR_SYMBOLS =43, /*[20D0]*/ + + /** @stable ICU 2.0 */ + UBLOCK_LETTERLIKE_SYMBOLS =44, /*[2100]*/ + + /** @stable ICU 2.0 */ + UBLOCK_NUMBER_FORMS =45, /*[2150]*/ + + /** @stable ICU 2.0 */ + UBLOCK_ARROWS =46, /*[2190]*/ + + /** @stable ICU 2.0 */ + UBLOCK_MATHEMATICAL_OPERATORS =47, /*[2200]*/ + + /** @stable ICU 2.0 */ + UBLOCK_MISCELLANEOUS_TECHNICAL =48, /*[2300]*/ + + /** @stable ICU 2.0 */ + UBLOCK_CONTROL_PICTURES =49, /*[2400]*/ + + /** @stable ICU 2.0 */ + UBLOCK_OPTICAL_CHARACTER_RECOGNITION =50, /*[2440]*/ + + /** @stable ICU 2.0 */ + UBLOCK_ENCLOSED_ALPHANUMERICS =51, /*[2460]*/ + + /** @stable ICU 2.0 */ + UBLOCK_BOX_DRAWING =52, /*[2500]*/ + + /** @stable ICU 2.0 */ + UBLOCK_BLOCK_ELEMENTS =53, /*[2580]*/ + + /** @stable ICU 2.0 */ + UBLOCK_GEOMETRIC_SHAPES =54, /*[25A0]*/ + + /** @stable ICU 2.0 */ + UBLOCK_MISCELLANEOUS_SYMBOLS =55, /*[2600]*/ + + /** @stable ICU 2.0 */ + UBLOCK_DINGBATS =56, /*[2700]*/ + + /** @stable ICU 2.0 */ + UBLOCK_BRAILLE_PATTERNS =57, /*[2800]*/ + + /** @stable ICU 2.0 */ + UBLOCK_CJK_RADICALS_SUPPLEMENT =58, /*[2E80]*/ + + /** @stable ICU 2.0 */ + UBLOCK_KANGXI_RADICALS =59, /*[2F00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_IDEOGRAPHIC_DESCRIPTION_CHARACTERS =60, /*[2FF0]*/ + + /** @stable ICU 2.0 */ + UBLOCK_CJK_SYMBOLS_AND_PUNCTUATION =61, /*[3000]*/ + + /** @stable ICU 2.0 */ + UBLOCK_HIRAGANA =62, /*[3040]*/ + + /** @stable ICU 2.0 */ + UBLOCK_KATAKANA =63, /*[30A0]*/ + + /** @stable ICU 2.0 */ + UBLOCK_BOPOMOFO =64, /*[3100]*/ + + /** @stable ICU 2.0 */ + UBLOCK_HANGUL_COMPATIBILITY_JAMO =65, /*[3130]*/ + + /** @stable ICU 2.0 */ + UBLOCK_KANBUN =66, /*[3190]*/ + + /** @stable ICU 2.0 */ + UBLOCK_BOPOMOFO_EXTENDED =67, /*[31A0]*/ + + /** @stable ICU 2.0 */ + UBLOCK_ENCLOSED_CJK_LETTERS_AND_MONTHS =68, /*[3200]*/ + + /** @stable ICU 2.0 */ + UBLOCK_CJK_COMPATIBILITY =69, /*[3300]*/ + + /** @stable ICU 2.0 */ + UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A =70, /*[3400]*/ + + /** @stable ICU 2.0 */ + UBLOCK_CJK_UNIFIED_IDEOGRAPHS =71, /*[4E00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_YI_SYLLABLES =72, /*[A000]*/ + + /** @stable ICU 2.0 */ + UBLOCK_YI_RADICALS =73, /*[A490]*/ + + /** @stable ICU 2.0 */ + UBLOCK_HANGUL_SYLLABLES =74, /*[AC00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_HIGH_SURROGATES =75, /*[D800]*/ + + /** @stable ICU 2.0 */ + UBLOCK_HIGH_PRIVATE_USE_SURROGATES =76, /*[DB80]*/ + + /** @stable ICU 2.0 */ + UBLOCK_LOW_SURROGATES =77, /*[DC00]*/ + + /** + * Same as UBLOCK_PRIVATE_USE. + * Until Unicode 3.1.1, the corresponding block name was "Private Use", + * and multiple code point ranges had this block. + * Unicode 3.2 renames the block for the BMP PUA to "Private Use Area" and + * adds separate blocks for the supplementary PUAs. + * + * @stable ICU 2.0 + */ + UBLOCK_PRIVATE_USE_AREA =78, /*[E000]*/ + /** + * Same as UBLOCK_PRIVATE_USE_AREA. + * Until Unicode 3.1.1, the corresponding block name was "Private Use", + * and multiple code point ranges had this block. + * Unicode 3.2 renames the block for the BMP PUA to "Private Use Area" and + * adds separate blocks for the supplementary PUAs. + * + * @stable ICU 2.0 + */ + UBLOCK_PRIVATE_USE = UBLOCK_PRIVATE_USE_AREA, + + /** @stable ICU 2.0 */ + UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS =79, /*[F900]*/ + + /** @stable ICU 2.0 */ + UBLOCK_ALPHABETIC_PRESENTATION_FORMS =80, /*[FB00]*/ + + /** @stable ICU 2.0 */ + UBLOCK_ARABIC_PRESENTATION_FORMS_A =81, /*[FB50]*/ + + /** @stable ICU 2.0 */ + UBLOCK_COMBINING_HALF_MARKS =82, /*[FE20]*/ + + /** @stable ICU 2.0 */ + UBLOCK_CJK_COMPATIBILITY_FORMS =83, /*[FE30]*/ + + /** @stable ICU 2.0 */ + UBLOCK_SMALL_FORM_VARIANTS =84, /*[FE50]*/ + + /** @stable ICU 2.0 */ + UBLOCK_ARABIC_PRESENTATION_FORMS_B =85, /*[FE70]*/ + + /** @stable ICU 2.0 */ + UBLOCK_SPECIALS =86, /*[FFF0]*/ + + /** @stable ICU 2.0 */ + UBLOCK_HALFWIDTH_AND_FULLWIDTH_FORMS =87, /*[FF00]*/ + + /* New blocks in Unicode 3.1 */ + + /** @stable ICU 2.0 */ + UBLOCK_OLD_ITALIC = 88, /*[10300]*/ + /** @stable ICU 2.0 */ + UBLOCK_GOTHIC = 89, /*[10330]*/ + /** @stable ICU 2.0 */ + UBLOCK_DESERET = 90, /*[10400]*/ + /** @stable ICU 2.0 */ + UBLOCK_BYZANTINE_MUSICAL_SYMBOLS = 91, /*[1D000]*/ + /** @stable ICU 2.0 */ + UBLOCK_MUSICAL_SYMBOLS = 92, /*[1D100]*/ + /** @stable ICU 2.0 */ + UBLOCK_MATHEMATICAL_ALPHANUMERIC_SYMBOLS = 93, /*[1D400]*/ + /** @stable ICU 2.0 */ + UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B = 94, /*[20000]*/ + /** @stable ICU 2.0 */ + UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT = 95, /*[2F800]*/ + /** @stable ICU 2.0 */ + UBLOCK_TAGS = 96, /*[E0000]*/ + + /* New blocks in Unicode 3.2 */ + + /** @stable ICU 3.0 */ + UBLOCK_CYRILLIC_SUPPLEMENT = 97, /*[0500]*/ + /** + * Unicode 4.0.1 renames the "Cyrillic Supplementary" block to "Cyrillic Supplement". + * @stable ICU 2.2 + */ + UBLOCK_CYRILLIC_SUPPLEMENTARY = UBLOCK_CYRILLIC_SUPPLEMENT, + /** @stable ICU 2.2 */ + UBLOCK_TAGALOG = 98, /*[1700]*/ + /** @stable ICU 2.2 */ + UBLOCK_HANUNOO = 99, /*[1720]*/ + /** @stable ICU 2.2 */ + UBLOCK_BUHID = 100, /*[1740]*/ + /** @stable ICU 2.2 */ + UBLOCK_TAGBANWA = 101, /*[1760]*/ + /** @stable ICU 2.2 */ + UBLOCK_MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A = 102, /*[27C0]*/ + /** @stable ICU 2.2 */ + UBLOCK_SUPPLEMENTAL_ARROWS_A = 103, /*[27F0]*/ + /** @stable ICU 2.2 */ + UBLOCK_SUPPLEMENTAL_ARROWS_B = 104, /*[2900]*/ + /** @stable ICU 2.2 */ + UBLOCK_MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B = 105, /*[2980]*/ + /** @stable ICU 2.2 */ + UBLOCK_SUPPLEMENTAL_MATHEMATICAL_OPERATORS = 106, /*[2A00]*/ + /** @stable ICU 2.2 */ + UBLOCK_KATAKANA_PHONETIC_EXTENSIONS = 107, /*[31F0]*/ + /** @stable ICU 2.2 */ + UBLOCK_VARIATION_SELECTORS = 108, /*[FE00]*/ + /** @stable ICU 2.2 */ + UBLOCK_SUPPLEMENTARY_PRIVATE_USE_AREA_A = 109, /*[F0000]*/ + /** @stable ICU 2.2 */ + UBLOCK_SUPPLEMENTARY_PRIVATE_USE_AREA_B = 110, /*[100000]*/ + + /* New blocks in Unicode 4 */ + + /** @stable ICU 2.6 */ + UBLOCK_LIMBU = 111, /*[1900]*/ + /** @stable ICU 2.6 */ + UBLOCK_TAI_LE = 112, /*[1950]*/ + /** @stable ICU 2.6 */ + UBLOCK_KHMER_SYMBOLS = 113, /*[19E0]*/ + /** @stable ICU 2.6 */ + UBLOCK_PHONETIC_EXTENSIONS = 114, /*[1D00]*/ + /** @stable ICU 2.6 */ + UBLOCK_MISCELLANEOUS_SYMBOLS_AND_ARROWS = 115, /*[2B00]*/ + /** @stable ICU 2.6 */ + UBLOCK_YIJING_HEXAGRAM_SYMBOLS = 116, /*[4DC0]*/ + /** @stable ICU 2.6 */ + UBLOCK_LINEAR_B_SYLLABARY = 117, /*[10000]*/ + /** @stable ICU 2.6 */ + UBLOCK_LINEAR_B_IDEOGRAMS = 118, /*[10080]*/ + /** @stable ICU 2.6 */ + UBLOCK_AEGEAN_NUMBERS = 119, /*[10100]*/ + /** @stable ICU 2.6 */ + UBLOCK_UGARITIC = 120, /*[10380]*/ + /** @stable ICU 2.6 */ + UBLOCK_SHAVIAN = 121, /*[10450]*/ + /** @stable ICU 2.6 */ + UBLOCK_OSMANYA = 122, /*[10480]*/ + /** @stable ICU 2.6 */ + UBLOCK_CYPRIOT_SYLLABARY = 123, /*[10800]*/ + /** @stable ICU 2.6 */ + UBLOCK_TAI_XUAN_JING_SYMBOLS = 124, /*[1D300]*/ + /** @stable ICU 2.6 */ + UBLOCK_VARIATION_SELECTORS_SUPPLEMENT = 125, /*[E0100]*/ + + /* New blocks in Unicode 4.1 */ + + /** @stable ICU 3.4 */ + UBLOCK_ANCIENT_GREEK_MUSICAL_NOTATION = 126, /*[1D200]*/ + /** @stable ICU 3.4 */ + UBLOCK_ANCIENT_GREEK_NUMBERS = 127, /*[10140]*/ + /** @stable ICU 3.4 */ + UBLOCK_ARABIC_SUPPLEMENT = 128, /*[0750]*/ + /** @stable ICU 3.4 */ + UBLOCK_BUGINESE = 129, /*[1A00]*/ + /** @stable ICU 3.4 */ + UBLOCK_CJK_STROKES = 130, /*[31C0]*/ + /** @stable ICU 3.4 */ + UBLOCK_COMBINING_DIACRITICAL_MARKS_SUPPLEMENT = 131, /*[1DC0]*/ + /** @stable ICU 3.4 */ + UBLOCK_COPTIC = 132, /*[2C80]*/ + /** @stable ICU 3.4 */ + UBLOCK_ETHIOPIC_EXTENDED = 133, /*[2D80]*/ + /** @stable ICU 3.4 */ + UBLOCK_ETHIOPIC_SUPPLEMENT = 134, /*[1380]*/ + /** @stable ICU 3.4 */ + UBLOCK_GEORGIAN_SUPPLEMENT = 135, /*[2D00]*/ + /** @stable ICU 3.4 */ + UBLOCK_GLAGOLITIC = 136, /*[2C00]*/ + /** @stable ICU 3.4 */ + UBLOCK_KHAROSHTHI = 137, /*[10A00]*/ + /** @stable ICU 3.4 */ + UBLOCK_MODIFIER_TONE_LETTERS = 138, /*[A700]*/ + /** @stable ICU 3.4 */ + UBLOCK_NEW_TAI_LUE = 139, /*[1980]*/ + /** @stable ICU 3.4 */ + UBLOCK_OLD_PERSIAN = 140, /*[103A0]*/ + /** @stable ICU 3.4 */ + UBLOCK_PHONETIC_EXTENSIONS_SUPPLEMENT = 141, /*[1D80]*/ + /** @stable ICU 3.4 */ + UBLOCK_SUPPLEMENTAL_PUNCTUATION = 142, /*[2E00]*/ + /** @stable ICU 3.4 */ + UBLOCK_SYLOTI_NAGRI = 143, /*[A800]*/ + /** @stable ICU 3.4 */ + UBLOCK_TIFINAGH = 144, /*[2D30]*/ + /** @stable ICU 3.4 */ + UBLOCK_VERTICAL_FORMS = 145, /*[FE10]*/ + + /* New blocks in Unicode 5.0 */ + + /** @stable ICU 3.6 */ + UBLOCK_NKO = 146, /*[07C0]*/ + /** @stable ICU 3.6 */ + UBLOCK_BALINESE = 147, /*[1B00]*/ + /** @stable ICU 3.6 */ + UBLOCK_LATIN_EXTENDED_C = 148, /*[2C60]*/ + /** @stable ICU 3.6 */ + UBLOCK_LATIN_EXTENDED_D = 149, /*[A720]*/ + /** @stable ICU 3.6 */ + UBLOCK_PHAGS_PA = 150, /*[A840]*/ + /** @stable ICU 3.6 */ + UBLOCK_PHOENICIAN = 151, /*[10900]*/ + /** @stable ICU 3.6 */ + UBLOCK_CUNEIFORM = 152, /*[12000]*/ + /** @stable ICU 3.6 */ + UBLOCK_CUNEIFORM_NUMBERS_AND_PUNCTUATION = 153, /*[12400]*/ + /** @stable ICU 3.6 */ + UBLOCK_COUNTING_ROD_NUMERALS = 154, /*[1D360]*/ + + /* New blocks in Unicode 5.1 */ + + /** @stable ICU 4.0 */ + UBLOCK_SUNDANESE = 155, /*[1B80]*/ + /** @stable ICU 4.0 */ + UBLOCK_LEPCHA = 156, /*[1C00]*/ + /** @stable ICU 4.0 */ + UBLOCK_OL_CHIKI = 157, /*[1C50]*/ + /** @stable ICU 4.0 */ + UBLOCK_CYRILLIC_EXTENDED_A = 158, /*[2DE0]*/ + /** @stable ICU 4.0 */ + UBLOCK_VAI = 159, /*[A500]*/ + /** @stable ICU 4.0 */ + UBLOCK_CYRILLIC_EXTENDED_B = 160, /*[A640]*/ + /** @stable ICU 4.0 */ + UBLOCK_SAURASHTRA = 161, /*[A880]*/ + /** @stable ICU 4.0 */ + UBLOCK_KAYAH_LI = 162, /*[A900]*/ + /** @stable ICU 4.0 */ + UBLOCK_REJANG = 163, /*[A930]*/ + /** @stable ICU 4.0 */ + UBLOCK_CHAM = 164, /*[AA00]*/ + /** @stable ICU 4.0 */ + UBLOCK_ANCIENT_SYMBOLS = 165, /*[10190]*/ + /** @stable ICU 4.0 */ + UBLOCK_PHAISTOS_DISC = 166, /*[101D0]*/ + /** @stable ICU 4.0 */ + UBLOCK_LYCIAN = 167, /*[10280]*/ + /** @stable ICU 4.0 */ + UBLOCK_CARIAN = 168, /*[102A0]*/ + /** @stable ICU 4.0 */ + UBLOCK_LYDIAN = 169, /*[10920]*/ + /** @stable ICU 4.0 */ + UBLOCK_MAHJONG_TILES = 170, /*[1F000]*/ + /** @stable ICU 4.0 */ + UBLOCK_DOMINO_TILES = 171, /*[1F030]*/ + + /* New blocks in Unicode 5.2 */ + + /** @stable ICU 4.4 */ + UBLOCK_SAMARITAN = 172, /*[0800]*/ + /** @stable ICU 4.4 */ + UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED = 173, /*[18B0]*/ + /** @stable ICU 4.4 */ + UBLOCK_TAI_THAM = 174, /*[1A20]*/ + /** @stable ICU 4.4 */ + UBLOCK_VEDIC_EXTENSIONS = 175, /*[1CD0]*/ + /** @stable ICU 4.4 */ + UBLOCK_LISU = 176, /*[A4D0]*/ + /** @stable ICU 4.4 */ + UBLOCK_BAMUM = 177, /*[A6A0]*/ + /** @stable ICU 4.4 */ + UBLOCK_COMMON_INDIC_NUMBER_FORMS = 178, /*[A830]*/ + /** @stable ICU 4.4 */ + UBLOCK_DEVANAGARI_EXTENDED = 179, /*[A8E0]*/ + /** @stable ICU 4.4 */ + UBLOCK_HANGUL_JAMO_EXTENDED_A = 180, /*[A960]*/ + /** @stable ICU 4.4 */ + UBLOCK_JAVANESE = 181, /*[A980]*/ + /** @stable ICU 4.4 */ + UBLOCK_MYANMAR_EXTENDED_A = 182, /*[AA60]*/ + /** @stable ICU 4.4 */ + UBLOCK_TAI_VIET = 183, /*[AA80]*/ + /** @stable ICU 4.4 */ + UBLOCK_MEETEI_MAYEK = 184, /*[ABC0]*/ + /** @stable ICU 4.4 */ + UBLOCK_HANGUL_JAMO_EXTENDED_B = 185, /*[D7B0]*/ + /** @stable ICU 4.4 */ + UBLOCK_IMPERIAL_ARAMAIC = 186, /*[10840]*/ + /** @stable ICU 4.4 */ + UBLOCK_OLD_SOUTH_ARABIAN = 187, /*[10A60]*/ + /** @stable ICU 4.4 */ + UBLOCK_AVESTAN = 188, /*[10B00]*/ + /** @stable ICU 4.4 */ + UBLOCK_INSCRIPTIONAL_PARTHIAN = 189, /*[10B40]*/ + /** @stable ICU 4.4 */ + UBLOCK_INSCRIPTIONAL_PAHLAVI = 190, /*[10B60]*/ + /** @stable ICU 4.4 */ + UBLOCK_OLD_TURKIC = 191, /*[10C00]*/ + /** @stable ICU 4.4 */ + UBLOCK_RUMI_NUMERAL_SYMBOLS = 192, /*[10E60]*/ + /** @stable ICU 4.4 */ + UBLOCK_KAITHI = 193, /*[11080]*/ + /** @stable ICU 4.4 */ + UBLOCK_EGYPTIAN_HIEROGLYPHS = 194, /*[13000]*/ + /** @stable ICU 4.4 */ + UBLOCK_ENCLOSED_ALPHANUMERIC_SUPPLEMENT = 195, /*[1F100]*/ + /** @stable ICU 4.4 */ + UBLOCK_ENCLOSED_IDEOGRAPHIC_SUPPLEMENT = 196, /*[1F200]*/ + /** @stable ICU 4.4 */ + UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C = 197, /*[2A700]*/ + + /* New blocks in Unicode 6.0 */ + + /** @stable ICU 4.6 */ + UBLOCK_MANDAIC = 198, /*[0840]*/ + /** @stable ICU 4.6 */ + UBLOCK_BATAK = 199, /*[1BC0]*/ + /** @stable ICU 4.6 */ + UBLOCK_ETHIOPIC_EXTENDED_A = 200, /*[AB00]*/ + /** @stable ICU 4.6 */ + UBLOCK_BRAHMI = 201, /*[11000]*/ + /** @stable ICU 4.6 */ + UBLOCK_BAMUM_SUPPLEMENT = 202, /*[16800]*/ + /** @stable ICU 4.6 */ + UBLOCK_KANA_SUPPLEMENT = 203, /*[1B000]*/ + /** @stable ICU 4.6 */ + UBLOCK_PLAYING_CARDS = 204, /*[1F0A0]*/ + /** @stable ICU 4.6 */ + UBLOCK_MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS = 205, /*[1F300]*/ + /** @stable ICU 4.6 */ + UBLOCK_EMOTICONS = 206, /*[1F600]*/ + /** @stable ICU 4.6 */ + UBLOCK_TRANSPORT_AND_MAP_SYMBOLS = 207, /*[1F680]*/ + /** @stable ICU 4.6 */ + UBLOCK_ALCHEMICAL_SYMBOLS = 208, /*[1F700]*/ + /** @stable ICU 4.6 */ + UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D = 209, /*[2B740]*/ + + /* New blocks in Unicode 6.1 */ + + /** @stable ICU 49 */ + UBLOCK_ARABIC_EXTENDED_A = 210, /*[08A0]*/ + /** @stable ICU 49 */ + UBLOCK_ARABIC_MATHEMATICAL_ALPHABETIC_SYMBOLS = 211, /*[1EE00]*/ + /** @stable ICU 49 */ + UBLOCK_CHAKMA = 212, /*[11100]*/ + /** @stable ICU 49 */ + UBLOCK_MEETEI_MAYEK_EXTENSIONS = 213, /*[AAE0]*/ + /** @stable ICU 49 */ + UBLOCK_MEROITIC_CURSIVE = 214, /*[109A0]*/ + /** @stable ICU 49 */ + UBLOCK_MEROITIC_HIEROGLYPHS = 215, /*[10980]*/ + /** @stable ICU 49 */ + UBLOCK_MIAO = 216, /*[16F00]*/ + /** @stable ICU 49 */ + UBLOCK_SHARADA = 217, /*[11180]*/ + /** @stable ICU 49 */ + UBLOCK_SORA_SOMPENG = 218, /*[110D0]*/ + /** @stable ICU 49 */ + UBLOCK_SUNDANESE_SUPPLEMENT = 219, /*[1CC0]*/ + /** @stable ICU 49 */ + UBLOCK_TAKRI = 220, /*[11680]*/ + + /* New blocks in Unicode 7.0 */ + + /** @stable ICU 54 */ + UBLOCK_BASSA_VAH = 221, /*[16AD0]*/ + /** @stable ICU 54 */ + UBLOCK_CAUCASIAN_ALBANIAN = 222, /*[10530]*/ + /** @stable ICU 54 */ + UBLOCK_COPTIC_EPACT_NUMBERS = 223, /*[102E0]*/ + /** @stable ICU 54 */ + UBLOCK_COMBINING_DIACRITICAL_MARKS_EXTENDED = 224, /*[1AB0]*/ + /** @stable ICU 54 */ + UBLOCK_DUPLOYAN = 225, /*[1BC00]*/ + /** @stable ICU 54 */ + UBLOCK_ELBASAN = 226, /*[10500]*/ + /** @stable ICU 54 */ + UBLOCK_GEOMETRIC_SHAPES_EXTENDED = 227, /*[1F780]*/ + /** @stable ICU 54 */ + UBLOCK_GRANTHA = 228, /*[11300]*/ + /** @stable ICU 54 */ + UBLOCK_KHOJKI = 229, /*[11200]*/ + /** @stable ICU 54 */ + UBLOCK_KHUDAWADI = 230, /*[112B0]*/ + /** @stable ICU 54 */ + UBLOCK_LATIN_EXTENDED_E = 231, /*[AB30]*/ + /** @stable ICU 54 */ + UBLOCK_LINEAR_A = 232, /*[10600]*/ + /** @stable ICU 54 */ + UBLOCK_MAHAJANI = 233, /*[11150]*/ + /** @stable ICU 54 */ + UBLOCK_MANICHAEAN = 234, /*[10AC0]*/ + /** @stable ICU 54 */ + UBLOCK_MENDE_KIKAKUI = 235, /*[1E800]*/ + /** @stable ICU 54 */ + UBLOCK_MODI = 236, /*[11600]*/ + /** @stable ICU 54 */ + UBLOCK_MRO = 237, /*[16A40]*/ + /** @stable ICU 54 */ + UBLOCK_MYANMAR_EXTENDED_B = 238, /*[A9E0]*/ + /** @stable ICU 54 */ + UBLOCK_NABATAEAN = 239, /*[10880]*/ + /** @stable ICU 54 */ + UBLOCK_OLD_NORTH_ARABIAN = 240, /*[10A80]*/ + /** @stable ICU 54 */ + UBLOCK_OLD_PERMIC = 241, /*[10350]*/ + /** @stable ICU 54 */ + UBLOCK_ORNAMENTAL_DINGBATS = 242, /*[1F650]*/ + /** @stable ICU 54 */ + UBLOCK_PAHAWH_HMONG = 243, /*[16B00]*/ + /** @stable ICU 54 */ + UBLOCK_PALMYRENE = 244, /*[10860]*/ + /** @stable ICU 54 */ + UBLOCK_PAU_CIN_HAU = 245, /*[11AC0]*/ + /** @stable ICU 54 */ + UBLOCK_PSALTER_PAHLAVI = 246, /*[10B80]*/ + /** @stable ICU 54 */ + UBLOCK_SHORTHAND_FORMAT_CONTROLS = 247, /*[1BCA0]*/ + /** @stable ICU 54 */ + UBLOCK_SIDDHAM = 248, /*[11580]*/ + /** @stable ICU 54 */ + UBLOCK_SINHALA_ARCHAIC_NUMBERS = 249, /*[111E0]*/ + /** @stable ICU 54 */ + UBLOCK_SUPPLEMENTAL_ARROWS_C = 250, /*[1F800]*/ + /** @stable ICU 54 */ + UBLOCK_TIRHUTA = 251, /*[11480]*/ + /** @stable ICU 54 */ + UBLOCK_WARANG_CITI = 252, /*[118A0]*/ + + /* New blocks in Unicode 8.0 */ + + /** @stable ICU 56 */ + UBLOCK_AHOM = 253, /*[11700]*/ + /** @stable ICU 56 */ + UBLOCK_ANATOLIAN_HIEROGLYPHS = 254, /*[14400]*/ + /** @stable ICU 56 */ + UBLOCK_CHEROKEE_SUPPLEMENT = 255, /*[AB70]*/ + /** @stable ICU 56 */ + UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_E = 256, /*[2B820]*/ + /** @stable ICU 56 */ + UBLOCK_EARLY_DYNASTIC_CUNEIFORM = 257, /*[12480]*/ + /** @stable ICU 56 */ + UBLOCK_HATRAN = 258, /*[108E0]*/ + /** @stable ICU 56 */ + UBLOCK_MULTANI = 259, /*[11280]*/ + /** @stable ICU 56 */ + UBLOCK_OLD_HUNGARIAN = 260, /*[10C80]*/ + /** @stable ICU 56 */ + UBLOCK_SUPPLEMENTAL_SYMBOLS_AND_PICTOGRAPHS = 261, /*[1F900]*/ + /** @stable ICU 56 */ + UBLOCK_SUTTON_SIGNWRITING = 262, /*[1D800]*/ + + /* New blocks in Unicode 9.0 */ + + /** @stable ICU 58 */ + UBLOCK_ADLAM = 263, /*[1E900]*/ + /** @stable ICU 58 */ + UBLOCK_BHAIKSUKI = 264, /*[11C00]*/ + /** @stable ICU 58 */ + UBLOCK_CYRILLIC_EXTENDED_C = 265, /*[1C80]*/ + /** @stable ICU 58 */ + UBLOCK_GLAGOLITIC_SUPPLEMENT = 266, /*[1E000]*/ + /** @stable ICU 58 */ + UBLOCK_IDEOGRAPHIC_SYMBOLS_AND_PUNCTUATION = 267, /*[16FE0]*/ + /** @stable ICU 58 */ + UBLOCK_MARCHEN = 268, /*[11C70]*/ + /** @stable ICU 58 */ + UBLOCK_MONGOLIAN_SUPPLEMENT = 269, /*[11660]*/ + /** @stable ICU 58 */ + UBLOCK_NEWA = 270, /*[11400]*/ + /** @stable ICU 58 */ + UBLOCK_OSAGE = 271, /*[104B0]*/ + /** @stable ICU 58 */ + UBLOCK_TANGUT = 272, /*[17000]*/ + /** @stable ICU 58 */ + UBLOCK_TANGUT_COMPONENTS = 273, /*[18800]*/ + + // New blocks in Unicode 10.0 + + /** @stable ICU 60 */ + UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_F = 274, /*[2CEB0]*/ + /** @stable ICU 60 */ + UBLOCK_KANA_EXTENDED_A = 275, /*[1B100]*/ + /** @stable ICU 60 */ + UBLOCK_MASARAM_GONDI = 276, /*[11D00]*/ + /** @stable ICU 60 */ + UBLOCK_NUSHU = 277, /*[1B170]*/ + /** @stable ICU 60 */ + UBLOCK_SOYOMBO = 278, /*[11A50]*/ + /** @stable ICU 60 */ + UBLOCK_SYRIAC_SUPPLEMENT = 279, /*[0860]*/ + /** @stable ICU 60 */ + UBLOCK_ZANABAZAR_SQUARE = 280, /*[11A00]*/ + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UBlockCode value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_BLOCK). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UBLOCK_COUNT = 281, +#endif // U_HIDE_DEPRECATED_API + + /** @stable ICU 2.0 */ + UBLOCK_INVALID_CODE=-1 +}; + +/** @stable ICU 2.0 */ +typedef enum UBlockCode UBlockCode; + +/** + * East Asian Width constants. + * + * @see UCHAR_EAST_ASIAN_WIDTH + * @see u_getIntPropertyValue + * @stable ICU 2.2 + */ +typedef enum UEastAsianWidth { + /* + * Note: UEastAsianWidth constants are parsed by preparseucd.py. + * It matches lines like + * U_EA_ + */ + + U_EA_NEUTRAL, /*[N]*/ + U_EA_AMBIGUOUS, /*[A]*/ + U_EA_HALFWIDTH, /*[H]*/ + U_EA_FULLWIDTH, /*[F]*/ + U_EA_NARROW, /*[Na]*/ + U_EA_WIDE, /*[W]*/ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UEastAsianWidth value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_EAST_ASIAN_WIDTH). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_EA_COUNT +#endif // U_HIDE_DEPRECATED_API +} UEastAsianWidth; + +/** + * Selector constants for u_charName(). + * u_charName() returns the "modern" name of a + * Unicode character; or the name that was defined in + * Unicode version 1.0, before the Unicode standard merged + * with ISO-10646; or an "extended" name that gives each + * Unicode code point a unique name. + * + * @see u_charName + * @stable ICU 2.0 + */ +typedef enum UCharNameChoice { + /** Unicode character name (Name property). @stable ICU 2.0 */ + U_UNICODE_CHAR_NAME, +#ifndef U_HIDE_DEPRECATED_API + /** + * The Unicode_1_Name property value which is of little practical value. + * Beginning with ICU 49, ICU APIs return an empty string for this name choice. + * @deprecated ICU 49 + */ + U_UNICODE_10_CHAR_NAME, +#endif /* U_HIDE_DEPRECATED_API */ + /** Standard or synthetic character name. @stable ICU 2.0 */ + U_EXTENDED_CHAR_NAME = U_UNICODE_CHAR_NAME+2, + /** Corrected name from NameAliases.txt. @stable ICU 4.4 */ + U_CHAR_NAME_ALIAS, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UCharNameChoice value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_CHAR_NAME_CHOICE_COUNT +#endif // U_HIDE_DEPRECATED_API +} UCharNameChoice; + +/** + * Selector constants for u_getPropertyName() and + * u_getPropertyValueName(). These selectors are used to choose which + * name is returned for a given property or value. All properties and + * values have a long name. Most have a short name, but some do not. + * Unicode allows for additional names, beyond the long and short + * name, which would be indicated by U_LONG_PROPERTY_NAME + i, where + * i=1, 2,... + * + * @see u_getPropertyName() + * @see u_getPropertyValueName() + * @stable ICU 2.4 + */ +typedef enum UPropertyNameChoice { + U_SHORT_PROPERTY_NAME, + U_LONG_PROPERTY_NAME, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UPropertyNameChoice value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_PROPERTY_NAME_CHOICE_COUNT +#endif // U_HIDE_DEPRECATED_API +} UPropertyNameChoice; + +/** + * Decomposition Type constants. + * + * @see UCHAR_DECOMPOSITION_TYPE + * @stable ICU 2.2 + */ +typedef enum UDecompositionType { + /* + * Note: UDecompositionType constants are parsed by preparseucd.py. + * It matches lines like + * U_DT_ + */ + + U_DT_NONE, /*[none]*/ + U_DT_CANONICAL, /*[can]*/ + U_DT_COMPAT, /*[com]*/ + U_DT_CIRCLE, /*[enc]*/ + U_DT_FINAL, /*[fin]*/ + U_DT_FONT, /*[font]*/ + U_DT_FRACTION, /*[fra]*/ + U_DT_INITIAL, /*[init]*/ + U_DT_ISOLATED, /*[iso]*/ + U_DT_MEDIAL, /*[med]*/ + U_DT_NARROW, /*[nar]*/ + U_DT_NOBREAK, /*[nb]*/ + U_DT_SMALL, /*[sml]*/ + U_DT_SQUARE, /*[sqr]*/ + U_DT_SUB, /*[sub]*/ + U_DT_SUPER, /*[sup]*/ + U_DT_VERTICAL, /*[vert]*/ + U_DT_WIDE, /*[wide]*/ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UDecompositionType value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_DECOMPOSITION_TYPE). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_DT_COUNT /* 18 */ +#endif // U_HIDE_DEPRECATED_API +} UDecompositionType; + +/** + * Joining Type constants. + * + * @see UCHAR_JOINING_TYPE + * @stable ICU 2.2 + */ +typedef enum UJoiningType { + /* + * Note: UJoiningType constants are parsed by preparseucd.py. + * It matches lines like + * U_JT_ + */ + + U_JT_NON_JOINING, /*[U]*/ + U_JT_JOIN_CAUSING, /*[C]*/ + U_JT_DUAL_JOINING, /*[D]*/ + U_JT_LEFT_JOINING, /*[L]*/ + U_JT_RIGHT_JOINING, /*[R]*/ + U_JT_TRANSPARENT, /*[T]*/ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UJoiningType value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_JOINING_TYPE). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_JT_COUNT /* 6 */ +#endif // U_HIDE_DEPRECATED_API +} UJoiningType; + +/** + * Joining Group constants. + * + * @see UCHAR_JOINING_GROUP + * @stable ICU 2.2 + */ +typedef enum UJoiningGroup { + /* + * Note: UJoiningGroup constants are parsed by preparseucd.py. + * It matches lines like + * U_JG_ + */ + + U_JG_NO_JOINING_GROUP, + U_JG_AIN, + U_JG_ALAPH, + U_JG_ALEF, + U_JG_BEH, + U_JG_BETH, + U_JG_DAL, + U_JG_DALATH_RISH, + U_JG_E, + U_JG_FEH, + U_JG_FINAL_SEMKATH, + U_JG_GAF, + U_JG_GAMAL, + U_JG_HAH, + U_JG_TEH_MARBUTA_GOAL, /**< @stable ICU 4.6 */ + U_JG_HAMZA_ON_HEH_GOAL=U_JG_TEH_MARBUTA_GOAL, + U_JG_HE, + U_JG_HEH, + U_JG_HEH_GOAL, + U_JG_HETH, + U_JG_KAF, + U_JG_KAPH, + U_JG_KNOTTED_HEH, + U_JG_LAM, + U_JG_LAMADH, + U_JG_MEEM, + U_JG_MIM, + U_JG_NOON, + U_JG_NUN, + U_JG_PE, + U_JG_QAF, + U_JG_QAPH, + U_JG_REH, + U_JG_REVERSED_PE, + U_JG_SAD, + U_JG_SADHE, + U_JG_SEEN, + U_JG_SEMKATH, + U_JG_SHIN, + U_JG_SWASH_KAF, + U_JG_SYRIAC_WAW, + U_JG_TAH, + U_JG_TAW, + U_JG_TEH_MARBUTA, + U_JG_TETH, + U_JG_WAW, + U_JG_YEH, + U_JG_YEH_BARREE, + U_JG_YEH_WITH_TAIL, + U_JG_YUDH, + U_JG_YUDH_HE, + U_JG_ZAIN, + U_JG_FE, /**< @stable ICU 2.6 */ + U_JG_KHAPH, /**< @stable ICU 2.6 */ + U_JG_ZHAIN, /**< @stable ICU 2.6 */ + U_JG_BURUSHASKI_YEH_BARREE, /**< @stable ICU 4.0 */ + U_JG_FARSI_YEH, /**< @stable ICU 4.4 */ + U_JG_NYA, /**< @stable ICU 4.4 */ + U_JG_ROHINGYA_YEH, /**< @stable ICU 49 */ + U_JG_MANICHAEAN_ALEPH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_AYIN, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_BETH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_DALETH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_DHAMEDH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_FIVE, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_GIMEL, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_HETH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_HUNDRED, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_KAPH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_LAMEDH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_MEM, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_NUN, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_ONE, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_PE, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_QOPH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_RESH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_SADHE, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_SAMEKH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_TAW, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_TEN, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_TETH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_THAMEDH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_TWENTY, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_WAW, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_YODH, /**< @stable ICU 54 */ + U_JG_MANICHAEAN_ZAYIN, /**< @stable ICU 54 */ + U_JG_STRAIGHT_WAW, /**< @stable ICU 54 */ + U_JG_AFRICAN_FEH, /**< @stable ICU 58 */ + U_JG_AFRICAN_NOON, /**< @stable ICU 58 */ + U_JG_AFRICAN_QAF, /**< @stable ICU 58 */ + + U_JG_MALAYALAM_BHA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_JA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_LLA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_LLLA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_NGA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_NNA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_NNNA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_NYA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_RA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_SSA, /**< @stable ICU 60 */ + U_JG_MALAYALAM_TTA, /**< @stable ICU 60 */ + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UJoiningGroup value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_JOINING_GROUP). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_JG_COUNT +#endif // U_HIDE_DEPRECATED_API +} UJoiningGroup; + +/** + * Grapheme Cluster Break constants. + * + * @see UCHAR_GRAPHEME_CLUSTER_BREAK + * @stable ICU 3.4 + */ +typedef enum UGraphemeClusterBreak { + /* + * Note: UGraphemeClusterBreak constants are parsed by preparseucd.py. + * It matches lines like + * U_GCB_ + */ + + U_GCB_OTHER = 0, /*[XX]*/ + U_GCB_CONTROL = 1, /*[CN]*/ + U_GCB_CR = 2, /*[CR]*/ + U_GCB_EXTEND = 3, /*[EX]*/ + U_GCB_L = 4, /*[L]*/ + U_GCB_LF = 5, /*[LF]*/ + U_GCB_LV = 6, /*[LV]*/ + U_GCB_LVT = 7, /*[LVT]*/ + U_GCB_T = 8, /*[T]*/ + U_GCB_V = 9, /*[V]*/ + /** @stable ICU 4.0 */ + U_GCB_SPACING_MARK = 10, /*[SM]*/ /* from here on: new in Unicode 5.1/ICU 4.0 */ + /** @stable ICU 4.0 */ + U_GCB_PREPEND = 11, /*[PP]*/ + /** @stable ICU 50 */ + U_GCB_REGIONAL_INDICATOR = 12, /*[RI]*/ /* new in Unicode 6.2/ICU 50 */ + /** @stable ICU 58 */ + U_GCB_E_BASE = 13, /*[EB]*/ /* from here on: new in Unicode 9.0/ICU 58 */ + /** @stable ICU 58 */ + U_GCB_E_BASE_GAZ = 14, /*[EBG]*/ + /** @stable ICU 58 */ + U_GCB_E_MODIFIER = 15, /*[EM]*/ + /** @stable ICU 58 */ + U_GCB_GLUE_AFTER_ZWJ = 16, /*[GAZ]*/ + /** @stable ICU 58 */ + U_GCB_ZWJ = 17, /*[ZWJ]*/ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UGraphemeClusterBreak value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_GRAPHEME_CLUSTER_BREAK). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_GCB_COUNT = 18 +#endif // U_HIDE_DEPRECATED_API +} UGraphemeClusterBreak; + +/** + * Word Break constants. + * (UWordBreak is a pre-existing enum type in ubrk.h for word break status tags.) + * + * @see UCHAR_WORD_BREAK + * @stable ICU 3.4 + */ +typedef enum UWordBreakValues { + /* + * Note: UWordBreakValues constants are parsed by preparseucd.py. + * It matches lines like + * U_WB_ + */ + + U_WB_OTHER = 0, /*[XX]*/ + U_WB_ALETTER = 1, /*[LE]*/ + U_WB_FORMAT = 2, /*[FO]*/ + U_WB_KATAKANA = 3, /*[KA]*/ + U_WB_MIDLETTER = 4, /*[ML]*/ + U_WB_MIDNUM = 5, /*[MN]*/ + U_WB_NUMERIC = 6, /*[NU]*/ + U_WB_EXTENDNUMLET = 7, /*[EX]*/ + /** @stable ICU 4.0 */ + U_WB_CR = 8, /*[CR]*/ /* from here on: new in Unicode 5.1/ICU 4.0 */ + /** @stable ICU 4.0 */ + U_WB_EXTEND = 9, /*[Extend]*/ + /** @stable ICU 4.0 */ + U_WB_LF = 10, /*[LF]*/ + /** @stable ICU 4.0 */ + U_WB_MIDNUMLET =11, /*[MB]*/ + /** @stable ICU 4.0 */ + U_WB_NEWLINE =12, /*[NL]*/ + /** @stable ICU 50 */ + U_WB_REGIONAL_INDICATOR = 13, /*[RI]*/ /* new in Unicode 6.2/ICU 50 */ + /** @stable ICU 52 */ + U_WB_HEBREW_LETTER = 14, /*[HL]*/ /* from here on: new in Unicode 6.3/ICU 52 */ + /** @stable ICU 52 */ + U_WB_SINGLE_QUOTE = 15, /*[SQ]*/ + /** @stable ICU 52 */ + U_WB_DOUBLE_QUOTE = 16, /*[DQ]*/ + /** @stable ICU 58 */ + U_WB_E_BASE = 17, /*[EB]*/ /* from here on: new in Unicode 9.0/ICU 58 */ + /** @stable ICU 58 */ + U_WB_E_BASE_GAZ = 18, /*[EBG]*/ + /** @stable ICU 58 */ + U_WB_E_MODIFIER = 19, /*[EM]*/ + /** @stable ICU 58 */ + U_WB_GLUE_AFTER_ZWJ = 20, /*[GAZ]*/ + /** @stable ICU 58 */ + U_WB_ZWJ = 21, /*[ZWJ]*/ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UWordBreakValues value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_WORD_BREAK). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_WB_COUNT = 22 +#endif // U_HIDE_DEPRECATED_API +} UWordBreakValues; + +/** + * Sentence Break constants. + * + * @see UCHAR_SENTENCE_BREAK + * @stable ICU 3.4 + */ +typedef enum USentenceBreak { + /* + * Note: USentenceBreak constants are parsed by preparseucd.py. + * It matches lines like + * U_SB_ + */ + + U_SB_OTHER = 0, /*[XX]*/ + U_SB_ATERM = 1, /*[AT]*/ + U_SB_CLOSE = 2, /*[CL]*/ + U_SB_FORMAT = 3, /*[FO]*/ + U_SB_LOWER = 4, /*[LO]*/ + U_SB_NUMERIC = 5, /*[NU]*/ + U_SB_OLETTER = 6, /*[LE]*/ + U_SB_SEP = 7, /*[SE]*/ + U_SB_SP = 8, /*[SP]*/ + U_SB_STERM = 9, /*[ST]*/ + U_SB_UPPER = 10, /*[UP]*/ + U_SB_CR = 11, /*[CR]*/ /* from here on: new in Unicode 5.1/ICU 4.0 */ + U_SB_EXTEND = 12, /*[EX]*/ + U_SB_LF = 13, /*[LF]*/ + U_SB_SCONTINUE = 14, /*[SC]*/ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal USentenceBreak value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_SENTENCE_BREAK). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_SB_COUNT = 15 +#endif // U_HIDE_DEPRECATED_API +} USentenceBreak; + +/** + * Line Break constants. + * + * @see UCHAR_LINE_BREAK + * @stable ICU 2.2 + */ +typedef enum ULineBreak { + /* + * Note: ULineBreak constants are parsed by preparseucd.py. + * It matches lines like + * U_LB_ + */ + + U_LB_UNKNOWN = 0, /*[XX]*/ + U_LB_AMBIGUOUS = 1, /*[AI]*/ + U_LB_ALPHABETIC = 2, /*[AL]*/ + U_LB_BREAK_BOTH = 3, /*[B2]*/ + U_LB_BREAK_AFTER = 4, /*[BA]*/ + U_LB_BREAK_BEFORE = 5, /*[BB]*/ + U_LB_MANDATORY_BREAK = 6, /*[BK]*/ + U_LB_CONTINGENT_BREAK = 7, /*[CB]*/ + U_LB_CLOSE_PUNCTUATION = 8, /*[CL]*/ + U_LB_COMBINING_MARK = 9, /*[CM]*/ + U_LB_CARRIAGE_RETURN = 10, /*[CR]*/ + U_LB_EXCLAMATION = 11, /*[EX]*/ + U_LB_GLUE = 12, /*[GL]*/ + U_LB_HYPHEN = 13, /*[HY]*/ + U_LB_IDEOGRAPHIC = 14, /*[ID]*/ + /** Renamed from the misspelled "inseperable" in Unicode 4.0.1/ICU 3.0 @stable ICU 3.0 */ + U_LB_INSEPARABLE = 15, /*[IN]*/ + U_LB_INSEPERABLE = U_LB_INSEPARABLE, + U_LB_INFIX_NUMERIC = 16, /*[IS]*/ + U_LB_LINE_FEED = 17, /*[LF]*/ + U_LB_NONSTARTER = 18, /*[NS]*/ + U_LB_NUMERIC = 19, /*[NU]*/ + U_LB_OPEN_PUNCTUATION = 20, /*[OP]*/ + U_LB_POSTFIX_NUMERIC = 21, /*[PO]*/ + U_LB_PREFIX_NUMERIC = 22, /*[PR]*/ + U_LB_QUOTATION = 23, /*[QU]*/ + U_LB_COMPLEX_CONTEXT = 24, /*[SA]*/ + U_LB_SURROGATE = 25, /*[SG]*/ + U_LB_SPACE = 26, /*[SP]*/ + U_LB_BREAK_SYMBOLS = 27, /*[SY]*/ + U_LB_ZWSPACE = 28, /*[ZW]*/ + /** @stable ICU 2.6 */ + U_LB_NEXT_LINE = 29, /*[NL]*/ /* from here on: new in Unicode 4/ICU 2.6 */ + /** @stable ICU 2.6 */ + U_LB_WORD_JOINER = 30, /*[WJ]*/ + /** @stable ICU 3.4 */ + U_LB_H2 = 31, /*[H2]*/ /* from here on: new in Unicode 4.1/ICU 3.4 */ + /** @stable ICU 3.4 */ + U_LB_H3 = 32, /*[H3]*/ + /** @stable ICU 3.4 */ + U_LB_JL = 33, /*[JL]*/ + /** @stable ICU 3.4 */ + U_LB_JT = 34, /*[JT]*/ + /** @stable ICU 3.4 */ + U_LB_JV = 35, /*[JV]*/ + /** @stable ICU 4.4 */ + U_LB_CLOSE_PARENTHESIS = 36, /*[CP]*/ /* new in Unicode 5.2/ICU 4.4 */ + /** @stable ICU 49 */ + U_LB_CONDITIONAL_JAPANESE_STARTER = 37,/*[CJ]*/ /* new in Unicode 6.1/ICU 49 */ + /** @stable ICU 49 */ + U_LB_HEBREW_LETTER = 38, /*[HL]*/ /* new in Unicode 6.1/ICU 49 */ + /** @stable ICU 50 */ + U_LB_REGIONAL_INDICATOR = 39,/*[RI]*/ /* new in Unicode 6.2/ICU 50 */ + /** @stable ICU 58 */ + U_LB_E_BASE = 40, /*[EB]*/ /* from here on: new in Unicode 9.0/ICU 58 */ + /** @stable ICU 58 */ + U_LB_E_MODIFIER = 41, /*[EM]*/ + /** @stable ICU 58 */ + U_LB_ZWJ = 42, /*[ZWJ]*/ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal ULineBreak value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_LINE_BREAK). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_LB_COUNT = 43 +#endif // U_HIDE_DEPRECATED_API +} ULineBreak; + +/** + * Numeric Type constants. + * + * @see UCHAR_NUMERIC_TYPE + * @stable ICU 2.2 + */ +typedef enum UNumericType { + /* + * Note: UNumericType constants are parsed by preparseucd.py. + * It matches lines like + * U_NT_ + */ + + U_NT_NONE, /*[None]*/ + U_NT_DECIMAL, /*[de]*/ + U_NT_DIGIT, /*[di]*/ + U_NT_NUMERIC, /*[nu]*/ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UNumericType value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_NUMERIC_TYPE). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_NT_COUNT +#endif // U_HIDE_DEPRECATED_API +} UNumericType; + +/** + * Hangul Syllable Type constants. + * + * @see UCHAR_HANGUL_SYLLABLE_TYPE + * @stable ICU 2.6 + */ +typedef enum UHangulSyllableType { + /* + * Note: UHangulSyllableType constants are parsed by preparseucd.py. + * It matches lines like + * U_HST_ + */ + + U_HST_NOT_APPLICABLE, /*[NA]*/ + U_HST_LEADING_JAMO, /*[L]*/ + U_HST_VOWEL_JAMO, /*[V]*/ + U_HST_TRAILING_JAMO, /*[T]*/ + U_HST_LV_SYLLABLE, /*[LV]*/ + U_HST_LVT_SYLLABLE, /*[LVT]*/ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UHangulSyllableType value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_HANGUL_SYLLABLE_TYPE). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_HST_COUNT +#endif // U_HIDE_DEPRECATED_API +} UHangulSyllableType; + +/** + * Check a binary Unicode property for a code point. + * + * Unicode, especially in version 3.2, defines many more properties than the + * original set in UnicodeData.txt. + * + * The properties APIs are intended to reflect Unicode properties as defined + * in the Unicode Character Database (UCD) and Unicode Technical Reports (UTR). + * For details about the properties see http://www.unicode.org/ucd/ . + * For names of Unicode properties see the UCD file PropertyAliases.txt. + * + * Important: If ICU is built with UCD files from Unicode versions below 3.2, + * then properties marked with "new in Unicode 3.2" are not or not fully available. + * + * @param c Code point to test. + * @param which UProperty selector constant, identifies which binary property to check. + * Must be UCHAR_BINARY_START<=which=0. + * True for characters with general category "Nd" (decimal digit numbers) + * as well as Latin letters a-f and A-F in both ASCII and Fullwidth ASCII. + * (That is, for letters with code points + * 0041..0046, 0061..0066, FF21..FF26, FF41..FF46.) + * + * In order to narrow the definition of hexadecimal digits to only ASCII + * characters, use (c<=0x7f && u_isxdigit(c)). + * + * This is a C/POSIX migration function. + * See the comments about C/POSIX character classification functions in the + * documentation at the top of this header file. + * + * @param c the code point to be tested + * @return TRUE if the code point is a hexadecimal digit + * + * @stable ICU 2.6 + */ +U_STABLE UBool U_EXPORT2 +u_isxdigit(UChar32 c); + +/** + * Determines whether the specified code point is a punctuation character. + * True for characters with general categories "P" (punctuation). + * + * This is a C/POSIX migration function. + * See the comments about C/POSIX character classification functions in the + * documentation at the top of this header file. + * + * @param c the code point to be tested + * @return TRUE if the code point is a punctuation character + * + * @stable ICU 2.6 + */ +U_STABLE UBool U_EXPORT2 +u_ispunct(UChar32 c); + +/** + * Determines whether the specified code point is a "graphic" character + * (printable, excluding spaces). + * TRUE for all characters except those with general categories + * "Cc" (control codes), "Cf" (format controls), "Cs" (surrogates), + * "Cn" (unassigned), and "Z" (separators). + * + * This is a C/POSIX migration function. + * See the comments about C/POSIX character classification functions in the + * documentation at the top of this header file. + * + * @param c the code point to be tested + * @return TRUE if the code point is a "graphic" character + * + * @stable ICU 2.6 + */ +U_STABLE UBool U_EXPORT2 +u_isgraph(UChar32 c); + +/** + * Determines whether the specified code point is a "blank" or "horizontal space", + * a character that visibly separates words on a line. + * The following are equivalent definitions: + * + * TRUE for Unicode White_Space characters except for "vertical space controls" + * where "vertical space controls" are the following characters: + * U+000A (LF) U+000B (VT) U+000C (FF) U+000D (CR) U+0085 (NEL) U+2028 (LS) U+2029 (PS) + * + * same as + * + * TRUE for U+0009 (TAB) and characters with general category "Zs" (space separators) + * except Zero Width Space (ZWSP, U+200B). + * + * Note: There are several ICU whitespace functions; please see the uchar.h + * file documentation for a detailed comparison. + * + * This is a C/POSIX migration function. + * See the comments about C/POSIX character classification functions in the + * documentation at the top of this header file. + * + * @param c the code point to be tested + * @return TRUE if the code point is a "blank" + * + * @stable ICU 2.6 + */ +U_STABLE UBool U_EXPORT2 +u_isblank(UChar32 c); + +/** + * Determines whether the specified code point is "defined", + * which usually means that it is assigned a character. + * True for general categories other than "Cn" (other, not assigned), + * i.e., true for all code points mentioned in UnicodeData.txt. + * + * Note that non-character code points (e.g., U+FDD0) are not "defined" + * (they are Cn), but surrogate code points are "defined" (Cs). + * + * Same as java.lang.Character.isDefined(). + * + * @param c the code point to be tested + * @return TRUE if the code point is assigned a character + * + * @see u_isdigit + * @see u_isalpha + * @see u_isalnum + * @see u_isupper + * @see u_islower + * @see u_istitle + * @stable ICU 2.0 + */ +U_STABLE UBool U_EXPORT2 +u_isdefined(UChar32 c); + +/** + * Determines if the specified character is a space character or not. + * + * Note: There are several ICU whitespace functions; please see the uchar.h + * file documentation for a detailed comparison. + * + * This is a C/POSIX migration function. + * See the comments about C/POSIX character classification functions in the + * documentation at the top of this header file. + * + * @param c the character to be tested + * @return true if the character is a space character; false otherwise. + * + * @see u_isJavaSpaceChar + * @see u_isWhitespace + * @see u_isUWhiteSpace + * @stable ICU 2.0 + */ +U_STABLE UBool U_EXPORT2 +u_isspace(UChar32 c); + +/** + * Determine if the specified code point is a space character according to Java. + * True for characters with general categories "Z" (separators), + * which does not include control codes (e.g., TAB or Line Feed). + * + * Same as java.lang.Character.isSpaceChar(). + * + * Note: There are several ICU whitespace functions; please see the uchar.h + * file documentation for a detailed comparison. + * + * @param c the code point to be tested + * @return TRUE if the code point is a space character according to Character.isSpaceChar() + * + * @see u_isspace + * @see u_isWhitespace + * @see u_isUWhiteSpace + * @stable ICU 2.6 + */ +U_STABLE UBool U_EXPORT2 +u_isJavaSpaceChar(UChar32 c); + +/** + * Determines if the specified code point is a whitespace character according to Java/ICU. + * A character is considered to be a Java whitespace character if and only + * if it satisfies one of the following criteria: + * + * - It is a Unicode Separator character (categories "Z" = "Zs" or "Zl" or "Zp"), but is not + * also a non-breaking space (U+00A0 NBSP or U+2007 Figure Space or U+202F Narrow NBSP). + * - It is U+0009 HORIZONTAL TABULATION. + * - It is U+000A LINE FEED. + * - It is U+000B VERTICAL TABULATION. + * - It is U+000C FORM FEED. + * - It is U+000D CARRIAGE RETURN. + * - It is U+001C FILE SEPARATOR. + * - It is U+001D GROUP SEPARATOR. + * - It is U+001E RECORD SEPARATOR. + * - It is U+001F UNIT SEPARATOR. + * + * This API tries to sync with the semantics of Java's + * java.lang.Character.isWhitespace(), but it may not return + * the exact same results because of the Unicode version + * difference. + * + * Note: Unicode 4.0.1 changed U+200B ZERO WIDTH SPACE from a Space Separator (Zs) + * to a Format Control (Cf). Since then, isWhitespace(0x200b) returns false. + * See http://www.unicode.org/versions/Unicode4.0.1/ + * + * Note: There are several ICU whitespace functions; please see the uchar.h + * file documentation for a detailed comparison. + * + * @param c the code point to be tested + * @return TRUE if the code point is a whitespace character according to Java/ICU + * + * @see u_isspace + * @see u_isJavaSpaceChar + * @see u_isUWhiteSpace + * @stable ICU 2.0 + */ +U_STABLE UBool U_EXPORT2 +u_isWhitespace(UChar32 c); + +/** + * Determines whether the specified code point is a control character + * (as defined by this function). + * A control character is one of the following: + * - ISO 8-bit control character (U+0000..U+001f and U+007f..U+009f) + * - U_CONTROL_CHAR (Cc) + * - U_FORMAT_CHAR (Cf) + * - U_LINE_SEPARATOR (Zl) + * - U_PARAGRAPH_SEPARATOR (Zp) + * + * This is a C/POSIX migration function. + * See the comments about C/POSIX character classification functions in the + * documentation at the top of this header file. + * + * @param c the code point to be tested + * @return TRUE if the code point is a control character + * + * @see UCHAR_DEFAULT_IGNORABLE_CODE_POINT + * @see u_isprint + * @stable ICU 2.0 + */ +U_STABLE UBool U_EXPORT2 +u_iscntrl(UChar32 c); + +/** + * Determines whether the specified code point is an ISO control code. + * True for U+0000..U+001f and U+007f..U+009f (general category "Cc"). + * + * Same as java.lang.Character.isISOControl(). + * + * @param c the code point to be tested + * @return TRUE if the code point is an ISO control code + * + * @see u_iscntrl + * @stable ICU 2.6 + */ +U_STABLE UBool U_EXPORT2 +u_isISOControl(UChar32 c); + +/** + * Determines whether the specified code point is a printable character. + * True for general categories other than "C" (controls). + * + * This is a C/POSIX migration function. + * See the comments about C/POSIX character classification functions in the + * documentation at the top of this header file. + * + * @param c the code point to be tested + * @return TRUE if the code point is a printable character + * + * @see UCHAR_DEFAULT_IGNORABLE_CODE_POINT + * @see u_iscntrl + * @stable ICU 2.0 + */ +U_STABLE UBool U_EXPORT2 +u_isprint(UChar32 c); + +/** + * Determines whether the specified code point is a base character. + * True for general categories "L" (letters), "N" (numbers), + * "Mc" (spacing combining marks), and "Me" (enclosing marks). + * + * Note that this is different from the Unicode definition in + * chapter 3.5, conformance clause D13, + * which defines base characters to be all characters (not Cn) + * that do not graphically combine with preceding characters (M) + * and that are neither control (Cc) or format (Cf) characters. + * + * @param c the code point to be tested + * @return TRUE if the code point is a base character according to this function + * + * @see u_isalpha + * @see u_isdigit + * @stable ICU 2.0 + */ +U_STABLE UBool U_EXPORT2 +u_isbase(UChar32 c); + +/** + * Returns the bidirectional category value for the code point, + * which is used in the Unicode bidirectional algorithm + * (UAX #9 http://www.unicode.org/reports/tr9/). + * Note that some unassigned code points have bidi values + * of R or AL because they are in blocks that are reserved + * for Right-To-Left scripts. + * + * Same as java.lang.Character.getDirectionality() + * + * @param c the code point to be tested + * @return the bidirectional category (UCharDirection) value + * + * @see UCharDirection + * @stable ICU 2.0 + */ +U_STABLE UCharDirection U_EXPORT2 +u_charDirection(UChar32 c); + +/** + * Determines whether the code point has the Bidi_Mirrored property. + * This property is set for characters that are commonly used in + * Right-To-Left contexts and need to be displayed with a "mirrored" + * glyph. + * + * Same as java.lang.Character.isMirrored(). + * Same as UCHAR_BIDI_MIRRORED + * + * @param c the code point to be tested + * @return TRUE if the character has the Bidi_Mirrored property + * + * @see UCHAR_BIDI_MIRRORED + * @stable ICU 2.0 + */ +U_STABLE UBool U_EXPORT2 +u_isMirrored(UChar32 c); + +/** + * Maps the specified character to a "mirror-image" character. + * For characters with the Bidi_Mirrored property, implementations + * sometimes need a "poor man's" mapping to another Unicode + * character (code point) such that the default glyph may serve + * as the mirror-image of the default glyph of the specified + * character. This is useful for text conversion to and from + * codepages with visual order, and for displays without glyph + * selection capabilities. + * + * @param c the code point to be mapped + * @return another Unicode code point that may serve as a mirror-image + * substitute, or c itself if there is no such mapping or c + * does not have the Bidi_Mirrored property + * + * @see UCHAR_BIDI_MIRRORED + * @see u_isMirrored + * @stable ICU 2.0 + */ +U_STABLE UChar32 U_EXPORT2 +u_charMirror(UChar32 c); + +/** + * Maps the specified character to its paired bracket character. + * For Bidi_Paired_Bracket_Type!=None, this is the same as u_charMirror(). + * Otherwise c itself is returned. + * See http://www.unicode.org/reports/tr9/ + * + * @param c the code point to be mapped + * @return the paired bracket code point, + * or c itself if there is no such mapping + * (Bidi_Paired_Bracket_Type=None) + * + * @see UCHAR_BIDI_PAIRED_BRACKET + * @see UCHAR_BIDI_PAIRED_BRACKET_TYPE + * @see u_charMirror + * @stable ICU 52 + */ +U_STABLE UChar32 U_EXPORT2 +u_getBidiPairedBracket(UChar32 c); + +/** + * Returns the general category value for the code point. + * + * Same as java.lang.Character.getType(). + * + * @param c the code point to be tested + * @return the general category (UCharCategory) value + * + * @see UCharCategory + * @stable ICU 2.0 + */ +U_STABLE int8_t U_EXPORT2 +u_charType(UChar32 c); + +/** + * Get a single-bit bit set for the general category of a character. + * This bit set can be compared bitwise with U_GC_SM_MASK, U_GC_L_MASK, etc. + * Same as U_MASK(u_charType(c)). + * + * @param c the code point to be tested + * @return a single-bit mask corresponding to the general category (UCharCategory) value + * + * @see u_charType + * @see UCharCategory + * @see U_GC_CN_MASK + * @stable ICU 2.1 + */ +#define U_GET_GC_MASK(c) U_MASK(u_charType(c)) + +/** + * Callback from u_enumCharTypes(), is called for each contiguous range + * of code points c (where start<=cnameChoice, the character name written + * into the buffer is the "modern" name or the name that was defined + * in Unicode version 1.0. + * The name contains only "invariant" characters + * like A-Z, 0-9, space, and '-'. + * Unicode 1.0 names are only retrieved if they are different from the modern + * names and if the data file contains the data for them. gennames may or may + * not be called with a command line option to include 1.0 names in unames.dat. + * + * @param code The character (code point) for which to get the name. + * It must be 0<=code<=0x10ffff. + * @param nameChoice Selector for which name to get. + * @param buffer Destination address for copying the name. + * The name will always be zero-terminated. + * If there is no name, then the buffer will be set to the empty string. + * @param bufferLength ==sizeof(buffer) + * @param pErrorCode Pointer to a UErrorCode variable; + * check for U_SUCCESS() after u_charName() + * returns. + * @return The length of the name, or 0 if there is no name for this character. + * If the bufferLength is less than or equal to the length, then the buffer + * contains the truncated name and the returned length indicates the full + * length of the name. + * The length does not include the zero-termination. + * + * @see UCharNameChoice + * @see u_charFromName + * @see u_enumCharNames + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_charName(UChar32 code, UCharNameChoice nameChoice, + char *buffer, int32_t bufferLength, + UErrorCode *pErrorCode); + +#ifndef U_HIDE_DEPRECATED_API +/** + * Returns an empty string. + * Used to return the ISO 10646 comment for a character. + * The Unicode ISO_Comment property is deprecated and has no values. + * + * @param c The character (code point) for which to get the ISO comment. + * It must be 0<=c<=0x10ffff. + * @param dest Destination address for copying the comment. + * The comment will be zero-terminated if possible. + * If there is no comment, then the buffer will be set to the empty string. + * @param destCapacity ==sizeof(dest) + * @param pErrorCode Pointer to a UErrorCode variable; + * check for U_SUCCESS() after u_getISOComment() + * returns. + * @return 0 + * + * @deprecated ICU 49 + */ +U_DEPRECATED int32_t U_EXPORT2 +u_getISOComment(UChar32 c, + char *dest, int32_t destCapacity, + UErrorCode *pErrorCode); +#endif /* U_HIDE_DEPRECATED_API */ + +/** + * Find a Unicode character by its name and return its code point value. + * The name is matched exactly and completely. + * If the name does not correspond to a code point, pErrorCode + * is set to U_INVALID_CHAR_FOUND. + * A Unicode 1.0 name is matched only if it differs from the modern name. + * Unicode names are all uppercase. Extended names are lowercase followed + * by an uppercase hexadecimal number, and within angle brackets. + * + * @param nameChoice Selector for which name to match. + * @param name The name to match. + * @param pErrorCode Pointer to a UErrorCode variable + * @return The Unicode value of the code point with the given name, + * or an undefined value if there is no such code point. + * + * @see UCharNameChoice + * @see u_charName + * @see u_enumCharNames + * @stable ICU 1.7 + */ +U_STABLE UChar32 U_EXPORT2 +u_charFromName(UCharNameChoice nameChoice, + const char *name, + UErrorCode *pErrorCode); + +/** + * Type of a callback function for u_enumCharNames() that gets called + * for each Unicode character with the code point value and + * the character name. + * If such a function returns FALSE, then the enumeration is stopped. + * + * @param context The context pointer that was passed to u_enumCharNames(). + * @param code The Unicode code point for the character with this name. + * @param nameChoice Selector for which kind of names is enumerated. + * @param name The character's name, zero-terminated. + * @param length The length of the name. + * @return TRUE if the enumeration should continue, FALSE to stop it. + * + * @see UCharNameChoice + * @see u_enumCharNames + * @stable ICU 1.7 + */ +typedef UBool U_CALLCONV UEnumCharNamesFn(void *context, + UChar32 code, + UCharNameChoice nameChoice, + const char *name, + int32_t length); + +/** + * Enumerate all assigned Unicode characters between the start and limit + * code points (start inclusive, limit exclusive) and call a function + * for each, passing the code point value and the character name. + * For Unicode 1.0 names, only those are enumerated that differ from the + * modern names. + * + * @param start The first code point in the enumeration range. + * @param limit One more than the last code point in the enumeration range + * (the first one after the range). + * @param fn The function that is to be called for each character name. + * @param context An arbitrary pointer that is passed to the function. + * @param nameChoice Selector for which kind of names to enumerate. + * @param pErrorCode Pointer to a UErrorCode variable + * + * @see UCharNameChoice + * @see UEnumCharNamesFn + * @see u_charName + * @see u_charFromName + * @stable ICU 1.7 + */ +U_STABLE void U_EXPORT2 +u_enumCharNames(UChar32 start, UChar32 limit, + UEnumCharNamesFn *fn, + void *context, + UCharNameChoice nameChoice, + UErrorCode *pErrorCode); + +/** + * Return the Unicode name for a given property, as given in the + * Unicode database file PropertyAliases.txt. + * + * In addition, this function maps the property + * UCHAR_GENERAL_CATEGORY_MASK to the synthetic names "gcm" / + * "General_Category_Mask". These names are not in + * PropertyAliases.txt. + * + * @param property UProperty selector other than UCHAR_INVALID_CODE. + * If out of range, NULL is returned. + * + * @param nameChoice selector for which name to get. If out of range, + * NULL is returned. All properties have a long name. Most + * have a short name, but some do not. Unicode allows for + * additional names; if present these will be returned by + * U_LONG_PROPERTY_NAME + i, where i=1, 2,... + * + * @return a pointer to the name, or NULL if either the + * property or the nameChoice is out of range. If a given + * nameChoice returns NULL, then all larger values of + * nameChoice will return NULL, with one exception: if NULL is + * returned for U_SHORT_PROPERTY_NAME, then + * U_LONG_PROPERTY_NAME (and higher) may still return a + * non-NULL value. The returned pointer is valid until + * u_cleanup() is called. + * + * @see UProperty + * @see UPropertyNameChoice + * @stable ICU 2.4 + */ +U_STABLE const char* U_EXPORT2 +u_getPropertyName(UProperty property, + UPropertyNameChoice nameChoice); + +/** + * Return the UProperty enum for a given property name, as specified + * in the Unicode database file PropertyAliases.txt. Short, long, and + * any other variants are recognized. + * + * In addition, this function maps the synthetic names "gcm" / + * "General_Category_Mask" to the property + * UCHAR_GENERAL_CATEGORY_MASK. These names are not in + * PropertyAliases.txt. + * + * @param alias the property name to be matched. The name is compared + * using "loose matching" as described in PropertyAliases.txt. + * + * @return a UProperty enum, or UCHAR_INVALID_CODE if the given name + * does not match any property. + * + * @see UProperty + * @stable ICU 2.4 + */ +U_STABLE UProperty U_EXPORT2 +u_getPropertyEnum(const char* alias); + +/** + * Return the Unicode name for a given property value, as given in the + * Unicode database file PropertyValueAliases.txt. + * + * Note: Some of the names in PropertyValueAliases.txt can only be + * retrieved using UCHAR_GENERAL_CATEGORY_MASK, not + * UCHAR_GENERAL_CATEGORY. These include: "C" / "Other", "L" / + * "Letter", "LC" / "Cased_Letter", "M" / "Mark", "N" / "Number", "P" + * / "Punctuation", "S" / "Symbol", and "Z" / "Separator". + * + * @param property UProperty selector constant. + * Must be UCHAR_BINARY_START<=which2<=radix<=36 or if the + * value of c is not a valid digit in the specified + * radix, -1 is returned. A character is a valid digit + * if at least one of the following is true: + *

    + *
  • The character has a decimal digit value. + * Such characters have the general category "Nd" (decimal digit numbers) + * and a Numeric_Type of Decimal. + * In this case the value is the character's decimal digit value.
  • + *
  • The character is one of the uppercase Latin letters + * 'A' through 'Z'. + * In this case the value is c-'A'+10.
  • + *
  • The character is one of the lowercase Latin letters + * 'a' through 'z'. + * In this case the value is ch-'a'+10.
  • + *
  • Latin letters from both the ASCII range (0061..007A, 0041..005A) + * as well as from the Fullwidth ASCII range (FF41..FF5A, FF21..FF3A) + * are recognized.
  • + *
+ * + * Same as java.lang.Character.digit(). + * + * @param ch the code point to be tested. + * @param radix the radix. + * @return the numeric value represented by the character in the + * specified radix, + * or -1 if there is no value or if the value exceeds the radix. + * + * @see UCHAR_NUMERIC_TYPE + * @see u_forDigit + * @see u_charDigitValue + * @see u_isdigit + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_digit(UChar32 ch, int8_t radix); + +/** + * Determines the character representation for a specific digit in + * the specified radix. If the value of radix is not a + * valid radix, or the value of digit is not a valid + * digit in the specified radix, the null character + * (U+0000) is returned. + *

+ * The radix argument is valid if it is greater than or + * equal to 2 and less than or equal to 36. + * The digit argument is valid if + * 0 <= digit < radix. + *

+ * If the digit is less than 10, then + * '0' + digit is returned. Otherwise, the value + * 'a' + digit - 10 is returned. + * + * Same as java.lang.Character.forDigit(). + * + * @param digit the number to convert to a character. + * @param radix the radix. + * @return the char representation of the specified digit + * in the specified radix. + * + * @see u_digit + * @see u_charDigitValue + * @see u_isdigit + * @stable ICU 2.0 + */ +U_STABLE UChar32 U_EXPORT2 +u_forDigit(int32_t digit, int8_t radix); + +/** + * Get the "age" of the code point. + * The "age" is the Unicode version when the code point was first + * designated (as a non-character or for Private Use) + * or assigned a character. + * This can be useful to avoid emitting code points to receiving + * processes that do not accept newer characters. + * The data is from the UCD file DerivedAge.txt. + * + * @param c The code point. + * @param versionArray The Unicode version number array, to be filled in. + * + * @stable ICU 2.1 + */ +U_STABLE void U_EXPORT2 +u_charAge(UChar32 c, UVersionInfo versionArray); + +/** + * Gets the Unicode version information. + * The version array is filled in with the version information + * for the Unicode standard that is currently used by ICU. + * For example, Unicode version 3.1.1 is represented as an array with + * the values { 3, 1, 1, 0 }. + * + * @param versionArray an output array that will be filled in with + * the Unicode version number + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +u_getUnicodeVersion(UVersionInfo versionArray); + +#if !UCONFIG_NO_NORMALIZATION +/** + * Get the FC_NFKC_Closure property string for a character. + * See Unicode Standard Annex #15 for details, search for "FC_NFKC_Closure" + * or for "FNC": http://www.unicode.org/reports/tr15/ + * + * @param c The character (code point) for which to get the FC_NFKC_Closure string. + * It must be 0<=c<=0x10ffff. + * @param dest Destination address for copying the string. + * The string will be zero-terminated if possible. + * If there is no FC_NFKC_Closure string, + * then the buffer will be set to the empty string. + * @param destCapacity ==sizeof(dest) + * @param pErrorCode Pointer to a UErrorCode variable. + * @return The length of the string, or 0 if there is no FC_NFKC_Closure string for this character. + * If the destCapacity is less than or equal to the length, then the buffer + * contains the truncated name and the returned length indicates the full + * length of the name. + * The length does not include the zero-termination. + * + * @stable ICU 2.2 + */ +U_STABLE int32_t U_EXPORT2 +u_getFC_NFKC_Closure(UChar32 c, UChar *dest, int32_t destCapacity, UErrorCode *pErrorCode); + +#endif + + +U_CDECL_END + +#endif /*_UCHAR*/ +/*eof*/ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ucharstrie.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucharstrie.h new file mode 100644 index 0000000..dfc93f6 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucharstrie.h @@ -0,0 +1,578 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2010-2012, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* file name: ucharstrie.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2010nov14 +* created by: Markus W. Scherer +*/ + +#ifndef __UCHARSTRIE_H__ +#define __UCHARSTRIE_H__ + +/** + * \file + * \brief C++ API: Trie for mapping Unicode strings (or 16-bit-unit sequences) + * to integer values. + */ + +#include "unicode/utypes.h" +#include "unicode/unistr.h" +#include "unicode/uobject.h" +#include "unicode/ustringtrie.h" + +U_NAMESPACE_BEGIN + +class Appendable; +class UCharsTrieBuilder; +class UVector32; + +/** + * Light-weight, non-const reader class for a UCharsTrie. + * Traverses a char16_t-serialized data structure with minimal state, + * for mapping strings (16-bit-unit sequences) to non-negative integer values. + * + * This class owns the serialized trie data only if it was constructed by + * the builder's build() method. + * The public constructor and the copy constructor only alias the data (only copy the pointer). + * There is no assignment operator. + * + * This class is not intended for public subclassing. + * @stable ICU 4.8 + */ +class U_COMMON_API UCharsTrie : public UMemory { +public: + /** + * Constructs a UCharsTrie reader instance. + * + * The trieUChars must contain a copy of a char16_t sequence from the UCharsTrieBuilder, + * starting with the first char16_t of that sequence. + * The UCharsTrie object will not read more char16_ts than + * the UCharsTrieBuilder generated in the corresponding build() call. + * + * The array is not copied/cloned and must not be modified while + * the UCharsTrie object is in use. + * + * @param trieUChars The char16_t array that contains the serialized trie. + * @stable ICU 4.8 + */ + UCharsTrie(ConstChar16Ptr trieUChars) + : ownedArray_(NULL), uchars_(trieUChars), + pos_(uchars_), remainingMatchLength_(-1) {} + + /** + * Destructor. + * @stable ICU 4.8 + */ + ~UCharsTrie(); + + /** + * Copy constructor, copies the other trie reader object and its state, + * but not the char16_t array which will be shared. (Shallow copy.) + * @param other Another UCharsTrie object. + * @stable ICU 4.8 + */ + UCharsTrie(const UCharsTrie &other) + : ownedArray_(NULL), uchars_(other.uchars_), + pos_(other.pos_), remainingMatchLength_(other.remainingMatchLength_) {} + + /** + * Resets this trie to its initial state. + * @return *this + * @stable ICU 4.8 + */ + UCharsTrie &reset() { + pos_=uchars_; + remainingMatchLength_=-1; + return *this; + } + + /** + * UCharsTrie state object, for saving a trie's current state + * and resetting the trie back to this state later. + * @stable ICU 4.8 + */ + class State : public UMemory { + public: + /** + * Constructs an empty State. + * @stable ICU 4.8 + */ + State() { uchars=NULL; } + private: + friend class UCharsTrie; + + const char16_t *uchars; + const char16_t *pos; + int32_t remainingMatchLength; + }; + + /** + * Saves the state of this trie. + * @param state The State object to hold the trie's state. + * @return *this + * @see resetToState + * @stable ICU 4.8 + */ + const UCharsTrie &saveState(State &state) const { + state.uchars=uchars_; + state.pos=pos_; + state.remainingMatchLength=remainingMatchLength_; + return *this; + } + + /** + * Resets this trie to the saved state. + * If the state object contains no state, or the state of a different trie, + * then this trie remains unchanged. + * @param state The State object which holds a saved trie state. + * @return *this + * @see saveState + * @see reset + * @stable ICU 4.8 + */ + UCharsTrie &resetToState(const State &state) { + if(uchars_==state.uchars && uchars_!=NULL) { + pos_=state.pos; + remainingMatchLength_=state.remainingMatchLength; + } + return *this; + } + + /** + * Determines whether the string so far matches, whether it has a value, + * and whether another input char16_t can continue a matching string. + * @return The match/value Result. + * @stable ICU 4.8 + */ + UStringTrieResult current() const; + + /** + * Traverses the trie from the initial state for this input char16_t. + * Equivalent to reset().next(uchar). + * @param uchar Input char value. Values below 0 and above 0xffff will never match. + * @return The match/value Result. + * @stable ICU 4.8 + */ + inline UStringTrieResult first(int32_t uchar) { + remainingMatchLength_=-1; + return nextImpl(uchars_, uchar); + } + + /** + * Traverses the trie from the initial state for the + * one or two UTF-16 code units for this input code point. + * Equivalent to reset().nextForCodePoint(cp). + * @param cp A Unicode code point 0..0x10ffff. + * @return The match/value Result. + * @stable ICU 4.8 + */ + UStringTrieResult firstForCodePoint(UChar32 cp); + + /** + * Traverses the trie from the current state for this input char16_t. + * @param uchar Input char value. Values below 0 and above 0xffff will never match. + * @return The match/value Result. + * @stable ICU 4.8 + */ + UStringTrieResult next(int32_t uchar); + + /** + * Traverses the trie from the current state for the + * one or two UTF-16 code units for this input code point. + * @param cp A Unicode code point 0..0x10ffff. + * @return The match/value Result. + * @stable ICU 4.8 + */ + UStringTrieResult nextForCodePoint(UChar32 cp); + + /** + * Traverses the trie from the current state for this string. + * Equivalent to + * \code + * Result result=current(); + * for(each c in s) + * if(!USTRINGTRIE_HAS_NEXT(result)) return USTRINGTRIE_NO_MATCH; + * result=next(c); + * return result; + * \endcode + * @param s A string. Can be NULL if length is 0. + * @param length The length of the string. Can be -1 if NUL-terminated. + * @return The match/value Result. + * @stable ICU 4.8 + */ + UStringTrieResult next(ConstChar16Ptr s, int32_t length); + + /** + * Returns a matching string's value if called immediately after + * current()/first()/next() returned USTRINGTRIE_INTERMEDIATE_VALUE or USTRINGTRIE_FINAL_VALUE. + * getValue() can be called multiple times. + * + * Do not call getValue() after USTRINGTRIE_NO_MATCH or USTRINGTRIE_NO_VALUE! + * @return The value for the string so far. + * @stable ICU 4.8 + */ + inline int32_t getValue() const { + const char16_t *pos=pos_; + int32_t leadUnit=*pos++; + // U_ASSERT(leadUnit>=kMinValueLead); + return leadUnit&kValueIsFinal ? + readValue(pos, leadUnit&0x7fff) : readNodeValue(pos, leadUnit); + } + + /** + * Determines whether all strings reachable from the current state + * map to the same value. + * @param uniqueValue Receives the unique value, if this function returns TRUE. + * (output-only) + * @return TRUE if all strings reachable from the current state + * map to the same value. + * @stable ICU 4.8 + */ + inline UBool hasUniqueValue(int32_t &uniqueValue) const { + const char16_t *pos=pos_; + // Skip the rest of a pending linear-match node. + return pos!=NULL && findUniqueValue(pos+remainingMatchLength_+1, FALSE, uniqueValue); + } + + /** + * Finds each char16_t which continues the string from the current state. + * That is, each char16_t c for which it would be next(c)!=USTRINGTRIE_NO_MATCH now. + * @param out Each next char16_t is appended to this object. + * @return the number of char16_ts which continue the string from here + * @stable ICU 4.8 + */ + int32_t getNextUChars(Appendable &out) const; + + /** + * Iterator for all of the (string, value) pairs in a UCharsTrie. + * @stable ICU 4.8 + */ + class U_COMMON_API Iterator : public UMemory { + public: + /** + * Iterates from the root of a char16_t-serialized UCharsTrie. + * @param trieUChars The trie char16_ts. + * @param maxStringLength If 0, the iterator returns full strings. + * Otherwise, the iterator returns strings with this maximum length. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @stable ICU 4.8 + */ + Iterator(ConstChar16Ptr trieUChars, int32_t maxStringLength, UErrorCode &errorCode); + + /** + * Iterates from the current state of the specified UCharsTrie. + * @param trie The trie whose state will be copied for iteration. + * @param maxStringLength If 0, the iterator returns full strings. + * Otherwise, the iterator returns strings with this maximum length. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @stable ICU 4.8 + */ + Iterator(const UCharsTrie &trie, int32_t maxStringLength, UErrorCode &errorCode); + + /** + * Destructor. + * @stable ICU 4.8 + */ + ~Iterator(); + + /** + * Resets this iterator to its initial state. + * @return *this + * @stable ICU 4.8 + */ + Iterator &reset(); + + /** + * @return TRUE if there are more elements. + * @stable ICU 4.8 + */ + UBool hasNext() const; + + /** + * Finds the next (string, value) pair if there is one. + * + * If the string is truncated to the maximum length and does not + * have a real value, then the value is set to -1. + * In this case, this "not a real value" is indistinguishable from + * a real value of -1. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return TRUE if there is another element. + * @stable ICU 4.8 + */ + UBool next(UErrorCode &errorCode); + + /** + * @return The string for the last successful next(). + * @stable ICU 4.8 + */ + const UnicodeString &getString() const { return str_; } + /** + * @return The value for the last successful next(). + * @stable ICU 4.8 + */ + int32_t getValue() const { return value_; } + + private: + UBool truncateAndStop() { + pos_=NULL; + value_=-1; // no real value for str + return TRUE; + } + + const char16_t *branchNext(const char16_t *pos, int32_t length, UErrorCode &errorCode); + + const char16_t *uchars_; + const char16_t *pos_; + const char16_t *initialPos_; + int32_t remainingMatchLength_; + int32_t initialRemainingMatchLength_; + UBool skipValue_; // Skip intermediate value which was already delivered. + + UnicodeString str_; + int32_t maxLength_; + int32_t value_; + + // The stack stores pairs of integers for backtracking to another + // outbound edge of a branch node. + // The first integer is an offset from uchars_. + // The second integer has the str_.length() from before the node in bits 15..0, + // and the remaining branch length in bits 31..16. + // (We could store the remaining branch length minus 1 in bits 30..16 and not use the sign bit, + // but the code looks more confusing that way.) + UVector32 *stack_; + }; + +private: + friend class UCharsTrieBuilder; + + /** + * Constructs a UCharsTrie reader instance. + * Unlike the public constructor which just aliases an array, + * this constructor adopts the builder's array. + * This constructor is only called by the builder. + */ + UCharsTrie(char16_t *adoptUChars, const char16_t *trieUChars) + : ownedArray_(adoptUChars), uchars_(trieUChars), + pos_(uchars_), remainingMatchLength_(-1) {} + + // No assignment operator. + UCharsTrie &operator=(const UCharsTrie &other); + + inline void stop() { + pos_=NULL; + } + + // Reads a compact 32-bit integer. + // pos is already after the leadUnit, and the lead unit has bit 15 reset. + static inline int32_t readValue(const char16_t *pos, int32_t leadUnit) { + int32_t value; + if(leadUnit=kMinTwoUnitValueLead) { + if(leadUnit>6)-1; + } else if(leadUnit=kMinTwoUnitNodeValueLead) { + if(leadUnit=kMinTwoUnitDeltaLead) { + if(delta==kThreeUnitDeltaLead) { + delta=(pos[0]<<16)|pos[1]; + pos+=2; + } else { + delta=((delta-kMinTwoUnitDeltaLead)<<16)|*pos++; + } + } + return pos+delta; + } + + static const char16_t *skipDelta(const char16_t *pos) { + int32_t delta=*pos++; + if(delta>=kMinTwoUnitDeltaLead) { + if(delta==kThreeUnitDeltaLead) { + pos+=2; + } else { + ++pos; + } + } + return pos; + } + + static inline UStringTrieResult valueResult(int32_t node) { + return (UStringTrieResult)(USTRINGTRIE_INTERMEDIATE_VALUE-(node>>15)); + } + + // Handles a branch node for both next(uchar) and next(string). + UStringTrieResult branchNext(const char16_t *pos, int32_t length, int32_t uchar); + + // Requires remainingLength_<0. + UStringTrieResult nextImpl(const char16_t *pos, int32_t uchar); + + // Helper functions for hasUniqueValue(). + // Recursively finds a unique value (or whether there is not a unique one) + // from a branch. + static const char16_t *findUniqueValueFromBranch(const char16_t *pos, int32_t length, + UBool haveUniqueValue, int32_t &uniqueValue); + // Recursively finds a unique value (or whether there is not a unique one) + // starting from a position on a node lead unit. + static UBool findUniqueValue(const char16_t *pos, UBool haveUniqueValue, int32_t &uniqueValue); + + // Helper functions for getNextUChars(). + // getNextUChars() when pos is on a branch node. + static void getNextBranchUChars(const char16_t *pos, int32_t length, Appendable &out); + + // UCharsTrie data structure + // + // The trie consists of a series of char16_t-serialized nodes for incremental + // Unicode string/char16_t sequence matching. (char16_t=16-bit unsigned integer) + // The root node is at the beginning of the trie data. + // + // Types of nodes are distinguished by their node lead unit ranges. + // After each node, except a final-value node, another node follows to + // encode match values or continue matching further units. + // + // Node types: + // - Final-value node: Stores a 32-bit integer in a compact, variable-length format. + // The value is for the string/char16_t sequence so far. + // - Match node, optionally with an intermediate value in a different compact format. + // The value, if present, is for the string/char16_t sequence so far. + // + // Aside from the value, which uses the node lead unit's high bits: + // + // - Linear-match node: Matches a number of units. + // - Branch node: Branches to other nodes according to the current input unit. + // The node unit is the length of the branch (number of units to select from) + // minus 1. It is followed by a sub-node: + // - If the length is at most kMaxBranchLinearSubNodeLength, then + // there are length-1 (key, value) pairs and then one more comparison unit. + // If one of the key units matches, then the value is either a final value for + // the string so far, or a "jump" delta to the next node. + // If the last unit matches, then matching continues with the next node. + // (Values have the same encoding as final-value nodes.) + // - If the length is greater than kMaxBranchLinearSubNodeLength, then + // there is one unit and one "jump" delta. + // If the input unit is less than the sub-node unit, then "jump" by delta to + // the next sub-node which will have a length of length/2. + // (The delta has its own compact encoding.) + // Otherwise, skip the "jump" delta to the next sub-node + // which will have a length of length-length/2. + + // Match-node lead unit values, after masking off intermediate-value bits: + + // 0000..002f: Branch node. If node!=0 then the length is node+1, otherwise + // the length is one more than the next unit. + + // For a branch sub-node with at most this many entries, we drop down + // to a linear search. + static const int32_t kMaxBranchLinearSubNodeLength=5; + + // 0030..003f: Linear-match node, match 1..16 units and continue reading the next node. + static const int32_t kMinLinearMatch=0x30; + static const int32_t kMaxLinearMatchLength=0x10; + + // Match-node lead unit bits 14..6 for the optional intermediate value. + // If these bits are 0, then there is no intermediate value. + // Otherwise, see the *NodeValue* constants below. + static const int32_t kMinValueLead=kMinLinearMatch+kMaxLinearMatchLength; // 0x0040 + static const int32_t kNodeTypeMask=kMinValueLead-1; // 0x003f + + // A final-value node has bit 15 set. + static const int32_t kValueIsFinal=0x8000; + + // Compact value: After testing and masking off bit 15, use the following thresholds. + static const int32_t kMaxOneUnitValue=0x3fff; + + static const int32_t kMinTwoUnitValueLead=kMaxOneUnitValue+1; // 0x4000 + static const int32_t kThreeUnitValueLead=0x7fff; + + static const int32_t kMaxTwoUnitValue=((kThreeUnitValueLead-kMinTwoUnitValueLead)<<16)-1; // 0x3ffeffff + + // Compact intermediate-value integer, lead unit shared with a branch or linear-match node. + static const int32_t kMaxOneUnitNodeValue=0xff; + static const int32_t kMinTwoUnitNodeValueLead=kMinValueLead+((kMaxOneUnitNodeValue+1)<<6); // 0x4040 + static const int32_t kThreeUnitNodeValueLead=0x7fc0; + + static const int32_t kMaxTwoUnitNodeValue= + ((kThreeUnitNodeValueLead-kMinTwoUnitNodeValueLead)<<10)-1; // 0xfdffff + + // Compact delta integers. + static const int32_t kMaxOneUnitDelta=0xfbff; + static const int32_t kMinTwoUnitDeltaLead=kMaxOneUnitDelta+1; // 0xfc00 + static const int32_t kThreeUnitDeltaLead=0xffff; + + static const int32_t kMaxTwoUnitDelta=((kThreeUnitDeltaLead-kMinTwoUnitDeltaLead)<<16)-1; // 0x03feffff + + char16_t *ownedArray_; + + // Fixed value referencing the UCharsTrie words. + const char16_t *uchars_; + + // Iterator variables. + + // Pointer to next trie unit to read. NULL if no more matches. + const char16_t *pos_; + // Remaining length of a linear-match node, minus 1. Negative if not in such a node. + int32_t remainingMatchLength_; +}; + +U_NAMESPACE_END + +#endif // __UCHARSTRIE_H__ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ucharstriebuilder.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucharstriebuilder.h new file mode 100644 index 0000000..2aa4757 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucharstriebuilder.h @@ -0,0 +1,187 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2010-2016, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* file name: ucharstriebuilder.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2010nov14 +* created by: Markus W. Scherer +*/ + +#ifndef __UCHARSTRIEBUILDER_H__ +#define __UCHARSTRIEBUILDER_H__ + +#include "unicode/utypes.h" +#include "unicode/stringtriebuilder.h" +#include "unicode/ucharstrie.h" +#include "unicode/unistr.h" + +/** + * \file + * \brief C++ API: Builder for icu::UCharsTrie + */ + +U_NAMESPACE_BEGIN + +class UCharsTrieElement; + +/** + * Builder class for UCharsTrie. + * + * This class is not intended for public subclassing. + * @stable ICU 4.8 + */ +class U_COMMON_API UCharsTrieBuilder : public StringTrieBuilder { +public: + /** + * Constructs an empty builder. + * @param errorCode Standard ICU error code. + * @stable ICU 4.8 + */ + UCharsTrieBuilder(UErrorCode &errorCode); + + /** + * Destructor. + * @stable ICU 4.8 + */ + virtual ~UCharsTrieBuilder(); + + /** + * Adds a (string, value) pair. + * The string must be unique. + * The string contents will be copied; the builder does not keep + * a reference to the input UnicodeString or its buffer. + * @param s The input string. + * @param value The value associated with this string. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return *this + * @stable ICU 4.8 + */ + UCharsTrieBuilder &add(const UnicodeString &s, int32_t value, UErrorCode &errorCode); + + /** + * Builds a UCharsTrie for the add()ed data. + * Once built, no further data can be add()ed until clear() is called. + * + * A UCharsTrie cannot be empty. At least one (string, value) pair + * must have been add()ed. + * + * This method passes ownership of the builder's internal result array to the new trie object. + * Another call to any build() variant will re-serialize the trie. + * After clear() has been called, a new array will be used as well. + * @param buildOption Build option, see UStringTrieBuildOption. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return A new UCharsTrie for the add()ed data. + * @stable ICU 4.8 + */ + UCharsTrie *build(UStringTrieBuildOption buildOption, UErrorCode &errorCode); + + /** + * Builds a UCharsTrie for the add()ed data and char16_t-serializes it. + * Once built, no further data can be add()ed until clear() is called. + * + * A UCharsTrie cannot be empty. At least one (string, value) pair + * must have been add()ed. + * + * Multiple calls to buildUnicodeString() set the UnicodeStrings to the + * builder's same char16_t array, without rebuilding. + * If buildUnicodeString() is called after build(), the trie will be + * re-serialized into a new array. + * If build() is called after buildUnicodeString(), the trie object will become + * the owner of the previously returned array. + * After clear() has been called, a new array will be used as well. + * @param buildOption Build option, see UStringTrieBuildOption. + * @param result A UnicodeString which will be set to the char16_t-serialized + * UCharsTrie for the add()ed data. + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return result + * @stable ICU 4.8 + */ + UnicodeString &buildUnicodeString(UStringTrieBuildOption buildOption, UnicodeString &result, + UErrorCode &errorCode); + + /** + * Removes all (string, value) pairs. + * New data can then be add()ed and a new trie can be built. + * @return *this + * @stable ICU 4.8 + */ + UCharsTrieBuilder &clear() { + strings.remove(); + elementsLength=0; + ucharsLength=0; + return *this; + } + +private: + UCharsTrieBuilder(const UCharsTrieBuilder &other); // no copy constructor + UCharsTrieBuilder &operator=(const UCharsTrieBuilder &other); // no assignment operator + + void buildUChars(UStringTrieBuildOption buildOption, UErrorCode &errorCode); + + virtual int32_t getElementStringLength(int32_t i) const; + virtual char16_t getElementUnit(int32_t i, int32_t unitIndex) const; + virtual int32_t getElementValue(int32_t i) const; + + virtual int32_t getLimitOfLinearMatch(int32_t first, int32_t last, int32_t unitIndex) const; + + virtual int32_t countElementUnits(int32_t start, int32_t limit, int32_t unitIndex) const; + virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t unitIndex, int32_t count) const; + virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, char16_t unit) const; + + virtual UBool matchNodesCanHaveValues() const { return TRUE; } + + virtual int32_t getMaxBranchLinearSubNodeLength() const { return UCharsTrie::kMaxBranchLinearSubNodeLength; } + virtual int32_t getMinLinearMatch() const { return UCharsTrie::kMinLinearMatch; } + virtual int32_t getMaxLinearMatchLength() const { return UCharsTrie::kMaxLinearMatchLength; } + + class UCTLinearMatchNode : public LinearMatchNode { + public: + UCTLinearMatchNode(const char16_t *units, int32_t len, Node *nextNode); + virtual UBool operator==(const Node &other) const; + virtual void write(StringTrieBuilder &builder); + private: + const char16_t *s; + }; + + virtual Node *createLinearMatchNode(int32_t i, int32_t unitIndex, int32_t length, + Node *nextNode) const; + + UBool ensureCapacity(int32_t length); + virtual int32_t write(int32_t unit); + int32_t write(const char16_t *s, int32_t length); + virtual int32_t writeElementUnits(int32_t i, int32_t unitIndex, int32_t length); + virtual int32_t writeValueAndFinal(int32_t i, UBool isFinal); + virtual int32_t writeValueAndType(UBool hasValue, int32_t value, int32_t node); + virtual int32_t writeDeltaTo(int32_t jumpTarget); + + UnicodeString strings; + UCharsTrieElement *elements; + int32_t elementsCapacity; + int32_t elementsLength; + + // char16_t serialization of the trie. + // Grows from the back: ucharsLength measures from the end of the buffer! + char16_t *uchars; + int32_t ucharsCapacity; + int32_t ucharsLength; +}; + +U_NAMESPACE_END + +#endif // __UCHARSTRIEBUILDER_H__ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/uchriter.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/uchriter.h new file mode 100644 index 0000000..efcd263 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/uchriter.h @@ -0,0 +1,387 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1998-2005, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +*/ + +#ifndef UCHRITER_H +#define UCHRITER_H + +#include "unicode/utypes.h" +#include "unicode/chariter.h" + +/** + * \file + * \brief C++ API: char16_t Character Iterator + */ + +U_NAMESPACE_BEGIN + +/** + * A concrete subclass of CharacterIterator that iterates over the + * characters (code units or code points) in a char16_t array. + * It's possible not only to create an + * iterator that iterates over an entire char16_t array, but also to + * create one that iterates over only a subrange of a char16_t array + * (iterators over different subranges of the same char16_t array don't + * compare equal). + * @see CharacterIterator + * @see ForwardCharacterIterator + * @stable ICU 2.0 + */ +class U_COMMON_API UCharCharacterIterator : public CharacterIterator { +public: + /** + * Create an iterator over the char16_t array referred to by "textPtr". + * The iteration range is 0 to length-1. + * text is only aliased, not adopted (the + * destructor will not delete it). + * @param textPtr The char16_t array to be iterated over + * @param length The length of the char16_t array + * @stable ICU 2.0 + */ + UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length); + + /** + * Create an iterator over the char16_t array referred to by "textPtr". + * The iteration range is 0 to length-1. + * text is only aliased, not adopted (the + * destructor will not delete it). + * The starting + * position is specified by "position". If "position" is outside the valid + * iteration range, the behavior of this object is undefined. + * @param textPtr The char16_t array to be iteratd over + * @param length The length of the char16_t array + * @param position The starting position of the iteration + * @stable ICU 2.0 + */ + UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length, + int32_t position); + + /** + * Create an iterator over the char16_t array referred to by "textPtr". + * The iteration range is 0 to end-1. + * text is only aliased, not adopted (the + * destructor will not delete it). + * The starting + * position is specified by "position". If begin and end do not + * form a valid iteration range or "position" is outside the valid + * iteration range, the behavior of this object is undefined. + * @param textPtr The char16_t array to be iterated over + * @param length The length of the char16_t array + * @param textBegin The begin position of the iteration range + * @param textEnd The end position of the iteration range + * @param position The starting position of the iteration + * @stable ICU 2.0 + */ + UCharCharacterIterator(ConstChar16Ptr textPtr, int32_t length, + int32_t textBegin, + int32_t textEnd, + int32_t position); + + /** + * Copy constructor. The new iterator iterates over the same range + * of the same string as "that", and its initial position is the + * same as "that"'s current position. + * @param that The UCharCharacterIterator to be copied + * @stable ICU 2.0 + */ + UCharCharacterIterator(const UCharCharacterIterator& that); + + /** + * Destructor. + * @stable ICU 2.0 + */ + virtual ~UCharCharacterIterator(); + + /** + * Assignment operator. *this is altered to iterate over the sane + * range of the same string as "that", and refers to the same + * character within that string as "that" does. + * @param that The object to be copied + * @return the newly created object + * @stable ICU 2.0 + */ + UCharCharacterIterator& + operator=(const UCharCharacterIterator& that); + + /** + * Returns true if the iterators iterate over the same range of the + * same string and are pointing at the same character. + * @param that The ForwardCharacterIterator used to be compared for equality + * @return true if the iterators iterate over the same range of the + * same string and are pointing at the same character. + * @stable ICU 2.0 + */ + virtual UBool operator==(const ForwardCharacterIterator& that) const; + + /** + * Generates a hash code for this iterator. + * @return the hash code. + * @stable ICU 2.0 + */ + virtual int32_t hashCode(void) const; + + /** + * Returns a new UCharCharacterIterator referring to the same + * character in the same range of the same string as this one. The + * caller must delete the new iterator. + * @return the CharacterIterator newly created + * @stable ICU 2.0 + */ + virtual CharacterIterator* clone(void) const; + + /** + * Sets the iterator to refer to the first code unit in its + * iteration range, and returns that code unit. + * This can be used to begin an iteration with next(). + * @return the first code unit in its iteration range. + * @stable ICU 2.0 + */ + virtual char16_t first(void); + + /** + * Sets the iterator to refer to the first code unit in its + * iteration range, returns that code unit, and moves the position + * to the second code unit. This is an alternative to setToStart() + * for forward iteration with nextPostInc(). + * @return the first code unit in its iteration range + * @stable ICU 2.0 + */ + virtual char16_t firstPostInc(void); + + /** + * Sets the iterator to refer to the first code point in its + * iteration range, and returns that code unit, + * This can be used to begin an iteration with next32(). + * Note that an iteration with next32PostInc(), beginning with, + * e.g., setToStart() or firstPostInc(), is more efficient. + * @return the first code point in its iteration range + * @stable ICU 2.0 + */ + virtual UChar32 first32(void); + + /** + * Sets the iterator to refer to the first code point in its + * iteration range, returns that code point, and moves the position + * to the second code point. This is an alternative to setToStart() + * for forward iteration with next32PostInc(). + * @return the first code point in its iteration range. + * @stable ICU 2.0 + */ + virtual UChar32 first32PostInc(void); + + /** + * Sets the iterator to refer to the last code unit in its + * iteration range, and returns that code unit. + * This can be used to begin an iteration with previous(). + * @return the last code unit in its iteration range. + * @stable ICU 2.0 + */ + virtual char16_t last(void); + + /** + * Sets the iterator to refer to the last code point in its + * iteration range, and returns that code unit. + * This can be used to begin an iteration with previous32(). + * @return the last code point in its iteration range. + * @stable ICU 2.0 + */ + virtual UChar32 last32(void); + + /** + * Sets the iterator to refer to the "position"-th code unit + * in the text-storage object the iterator refers to, and + * returns that code unit. + * @param position the position within the text-storage object + * @return the code unit + * @stable ICU 2.0 + */ + virtual char16_t setIndex(int32_t position); + + /** + * Sets the iterator to refer to the beginning of the code point + * that contains the "position"-th code unit + * in the text-storage object the iterator refers to, and + * returns that code point. + * The current position is adjusted to the beginning of the code point + * (its first code unit). + * @param position the position within the text-storage object + * @return the code unit + * @stable ICU 2.0 + */ + virtual UChar32 setIndex32(int32_t position); + + /** + * Returns the code unit the iterator currently refers to. + * @return the code unit the iterator currently refers to. + * @stable ICU 2.0 + */ + virtual char16_t current(void) const; + + /** + * Returns the code point the iterator currently refers to. + * @return the code point the iterator currently refers to. + * @stable ICU 2.0 + */ + virtual UChar32 current32(void) const; + + /** + * Advances to the next code unit in the iteration range (toward + * endIndex()), and returns that code unit. If there are no more + * code units to return, returns DONE. + * @return the next code unit in the iteration range. + * @stable ICU 2.0 + */ + virtual char16_t next(void); + + /** + * Gets the current code unit for returning and advances to the next code unit + * in the iteration range + * (toward endIndex()). If there are + * no more code units to return, returns DONE. + * @return the current code unit. + * @stable ICU 2.0 + */ + virtual char16_t nextPostInc(void); + + /** + * Advances to the next code point in the iteration range (toward + * endIndex()), and returns that code point. If there are no more + * code points to return, returns DONE. + * Note that iteration with "pre-increment" semantics is less + * efficient than iteration with "post-increment" semantics + * that is provided by next32PostInc(). + * @return the next code point in the iteration range. + * @stable ICU 2.0 + */ + virtual UChar32 next32(void); + + /** + * Gets the current code point for returning and advances to the next code point + * in the iteration range + * (toward endIndex()). If there are + * no more code points to return, returns DONE. + * @return the current point. + * @stable ICU 2.0 + */ + virtual UChar32 next32PostInc(void); + + /** + * Returns FALSE if there are no more code units or code points + * at or after the current position in the iteration range. + * This is used with nextPostInc() or next32PostInc() in forward + * iteration. + * @return FALSE if there are no more code units or code points + * at or after the current position in the iteration range. + * @stable ICU 2.0 + */ + virtual UBool hasNext(); + + /** + * Advances to the previous code unit in the iteration range (toward + * startIndex()), and returns that code unit. If there are no more + * code units to return, returns DONE. + * @return the previous code unit in the iteration range. + * @stable ICU 2.0 + */ + virtual char16_t previous(void); + + /** + * Advances to the previous code point in the iteration range (toward + * startIndex()), and returns that code point. If there are no more + * code points to return, returns DONE. + * @return the previous code point in the iteration range. + * @stable ICU 2.0 + */ + virtual UChar32 previous32(void); + + /** + * Returns FALSE if there are no more code units or code points + * before the current position in the iteration range. + * This is used with previous() or previous32() in backward + * iteration. + * @return FALSE if there are no more code units or code points + * before the current position in the iteration range. + * @stable ICU 2.0 + */ + virtual UBool hasPrevious(); + + /** + * Moves the current position relative to the start or end of the + * iteration range, or relative to the current position itself. + * The movement is expressed in numbers of code units forward + * or backward by specifying a positive or negative delta. + * @param delta the position relative to origin. A positive delta means forward; + * a negative delta means backward. + * @param origin Origin enumeration {kStart, kCurrent, kEnd} + * @return the new position + * @stable ICU 2.0 + */ + virtual int32_t move(int32_t delta, EOrigin origin); + + /** + * Moves the current position relative to the start or end of the + * iteration range, or relative to the current position itself. + * The movement is expressed in numbers of code points forward + * or backward by specifying a positive or negative delta. + * @param delta the position relative to origin. A positive delta means forward; + * a negative delta means backward. + * @param origin Origin enumeration {kStart, kCurrent, kEnd} + * @return the new position + * @stable ICU 2.0 + */ +#ifdef move32 + // One of the system headers right now is sometimes defining a conflicting macro we don't use +#undef move32 +#endif + virtual int32_t move32(int32_t delta, EOrigin origin); + + /** + * Sets the iterator to iterate over a new range of text + * @stable ICU 2.0 + */ + void setText(ConstChar16Ptr newText, int32_t newTextLength); + + /** + * Copies the char16_t array under iteration into the UnicodeString + * referred to by "result". Even if this iterator iterates across + * only a part of this string, the whole string is copied. + * @param result Receives a copy of the text under iteration. + * @stable ICU 2.0 + */ + virtual void getText(UnicodeString& result); + + /** + * Return a class ID for this class (not really public) + * @return a class ID for this class + * @stable ICU 2.0 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Return a class ID for this object (not really public) + * @return a class ID for this object. + * @stable ICU 2.0 + */ + virtual UClassID getDynamicClassID(void) const; + +protected: + /** + * Protected constructor + * @stable ICU 2.0 + */ + UCharCharacterIterator(); + /** + * Protected member text + * @stable ICU 2.0 + */ + const char16_t* text; + +}; + +U_NAMESPACE_END +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/uclean.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/uclean.h new file mode 100644 index 0000000..5b0486d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/uclean.h @@ -0,0 +1,262 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* Copyright (C) 2001-2014, International Business Machines +* Corporation and others. All Rights Reserved. +****************************************************************************** +* file name: uclean.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2001July05 +* created by: George Rhoten +*/ + +#ifndef __UCLEAN_H__ +#define __UCLEAN_H__ + +#include "unicode/utypes.h" +/** + * \file + * \brief C API: Initialize and clean up ICU + */ + +/** + * Initialize ICU. + * + * Use of this function is optional. It is OK to simply use ICU + * services and functions without first having initialized + * ICU by calling u_init(). + * + * u_init() will attempt to load some part of ICU's data, and is + * useful as a test for configuration or installation problems that + * leave the ICU data inaccessible. A successful invocation of u_init() + * does not, however, guarantee that all ICU data is accessible. + * + * Multiple calls to u_init() cause no harm, aside from the small amount + * of time required. + * + * In old versions of ICU, u_init() was required in multi-threaded applications + * to ensure the thread safety of ICU. u_init() is no longer needed for this purpose. + * + * @param status An ICU UErrorCode parameter. It must not be NULL. + * An Error will be returned if some required part of ICU data can not + * be loaded or initialized. + * The function returns immediately if the input error code indicates a + * failure, as usual. + * + * @stable ICU 2.6 + */ +U_STABLE void U_EXPORT2 +u_init(UErrorCode *status); + +#ifndef U_HIDE_SYSTEM_API +/** + * Clean up the system resources, such as allocated memory or open files, + * used in all ICU libraries. This will free/delete all memory owned by the + * ICU libraries, and return them to their original load state. All open ICU + * items (collators, resource bundles, converters, etc.) must be closed before + * calling this function, otherwise ICU may not free its allocated memory + * (e.g. close your converters and resource bundles before calling this + * function). Generally, this function should be called once just before + * an application exits. For applications that dynamically load and unload + * the ICU libraries (relatively uncommon), u_cleanup() should be called + * just before the library unload. + *

+ * u_cleanup() also clears any ICU heap functions, mutex functions or + * trace functions that may have been set for the process. + * This has the effect of restoring ICU to its initial condition, before + * any of these override functions were installed. Refer to + * u_setMemoryFunctions(), u_setMutexFunctions and + * utrace_setFunctions(). If ICU is to be reinitialized after after + * calling u_cleanup(), these runtime override functions will need to + * be set up again if they are still required. + *

+ * u_cleanup() is not thread safe. All other threads should stop using ICU + * before calling this function. + *

+ * Any open ICU items will be left in an undefined state by u_cleanup(), + * and any subsequent attempt to use such an item will give unpredictable + * results. + *

+ * After calling u_cleanup(), an application may continue to use ICU by + * calling u_init(). An application must invoke u_init() first from one single + * thread before allowing other threads call u_init(). All threads existing + * at the time of the first thread's call to u_init() must also call + * u_init() themselves before continuing with other ICU operations. + *

+ * The use of u_cleanup() just before an application terminates is optional, + * but it should be called only once for performance reasons. The primary + * benefit is to eliminate reports of memory or resource leaks originating + * in ICU code from the results generated by heap analysis tools. + *

+ * Use this function with great care! + *

+ * + * @stable ICU 2.0 + * @system + */ +U_STABLE void U_EXPORT2 +u_cleanup(void); + +U_CDECL_BEGIN +/** + * Pointer type for a user supplied memory allocation function. + * @param context user supplied value, obtained from from u_setMemoryFunctions(). + * @param size The number of bytes to be allocated + * @return Pointer to the newly allocated memory, or NULL if the allocation failed. + * @stable ICU 2.8 + * @system + */ +typedef void *U_CALLCONV UMemAllocFn(const void *context, size_t size); +/** + * Pointer type for a user supplied memory re-allocation function. + * @param context user supplied value, obtained from from u_setMemoryFunctions(). + * @param size The number of bytes to be allocated + * @return Pointer to the newly allocated memory, or NULL if the allocation failed. + * @stable ICU 2.8 + * @system + */ +typedef void *U_CALLCONV UMemReallocFn(const void *context, void *mem, size_t size); +/** + * Pointer type for a user supplied memory free function. Behavior should be + * similar the standard C library free(). + * @param context user supplied value, obtained from from u_setMemoryFunctions(). + * @param mem Pointer to the memory block to be resized + * @param size The new size for the block + * @return Pointer to the resized memory block, or NULL if the resizing failed. + * @stable ICU 2.8 + * @system + */ +typedef void U_CALLCONV UMemFreeFn (const void *context, void *mem); + +/** + * Set the functions that ICU will use for memory allocation. + * Use of this function is optional; by default (without this function), ICU will + * use the standard C library malloc() and free() functions. + * This function can only be used when ICU is in an initial, unused state, before + * u_init() has been called. + * @param context This pointer value will be saved, and then (later) passed as + * a parameter to the memory functions each time they + * are called. + * @param a Pointer to a user-supplied malloc function. + * @param r Pointer to a user-supplied realloc function. + * @param f Pointer to a user-supplied free function. + * @param status Receives error values. + * @stable ICU 2.8 + * @system + */ +U_STABLE void U_EXPORT2 +u_setMemoryFunctions(const void *context, UMemAllocFn * U_CALLCONV_FPTR a, UMemReallocFn * U_CALLCONV_FPTR r, UMemFreeFn * U_CALLCONV_FPTR f, + UErrorCode *status); + +U_CDECL_END + +#ifndef U_HIDE_DEPRECATED_API +/********************************************************************************* + * + * Deprecated Functions + * + * The following functions for user supplied mutexes are no longer supported. + * Any attempt to use them will return a U_UNSUPPORTED_ERROR. + * + **********************************************************************************/ + +/** + * An opaque pointer type that represents an ICU mutex. + * For user-implemented mutexes, the value will typically point to a + * struct or object that implements the mutex. + * @deprecated ICU 52. This type is no longer supported. + * @system + */ +typedef void *UMTX; + +U_CDECL_BEGIN +/** + * Function Pointer type for a user supplied mutex initialization function. + * The user-supplied function will be called by ICU whenever ICU needs to create a + * new mutex. The function implementation should create a mutex, and store a pointer + * to something that uniquely identifies the mutex into the UMTX that is supplied + * as a paramter. + * @param context user supplied value, obtained from from u_setMutexFunctions(). + * @param mutex Receives a pointer that identifies the new mutex. + * The mutex init function must set the UMTX to a non-null value. + * Subsequent calls by ICU to lock, unlock, or destroy a mutex will + * identify the mutex by the UMTX value. + * @param status Error status. Report errors back to ICU by setting this variable + * with an error code. + * @deprecated ICU 52. This function is no longer supported. + * @system + */ +typedef void U_CALLCONV UMtxInitFn (const void *context, UMTX *mutex, UErrorCode* status); + + +/** + * Function Pointer type for a user supplied mutex functions. + * One of the user-supplied functions with this signature will be called by ICU + * whenever ICU needs to lock, unlock, or destroy a mutex. + * @param context user supplied value, obtained from from u_setMutexFunctions(). + * @param mutex specify the mutex on which to operate. + * @deprecated ICU 52. This function is no longer supported. + * @system + */ +typedef void U_CALLCONV UMtxFn (const void *context, UMTX *mutex); +U_CDECL_END + +/** + * Set the functions that ICU will use for mutex operations + * Use of this function is optional; by default (without this function), ICU will + * directly access system functions for mutex operations + * This function can only be used when ICU is in an initial, unused state, before + * u_init() has been called. + * @param context This pointer value will be saved, and then (later) passed as + * a parameter to the user-supplied mutex functions each time they + * are called. + * @param init Pointer to a mutex initialization function. Must be non-null. + * @param destroy Pointer to the mutex destroy function. Must be non-null. + * @param lock pointer to the mutex lock function. Must be non-null. + * @param unlock Pointer to the mutex unlock function. Must be non-null. + * @param status Receives error values. + * @deprecated ICU 52. This function is no longer supported. + * @system + */ +U_DEPRECATED void U_EXPORT2 +u_setMutexFunctions(const void *context, UMtxInitFn *init, UMtxFn *destroy, UMtxFn *lock, UMtxFn *unlock, + UErrorCode *status); + + +/** + * Pointer type for a user supplied atomic increment or decrement function. + * @param context user supplied value, obtained from from u_setAtomicIncDecFunctions(). + * @param p Pointer to a 32 bit int to be incremented or decremented + * @return The value of the variable after the inc or dec operation. + * @deprecated ICU 52. This function is no longer supported. + * @system + */ +typedef int32_t U_CALLCONV UMtxAtomicFn(const void *context, int32_t *p); + +/** + * Set the functions that ICU will use for atomic increment and decrement of int32_t values. + * Use of this function is optional; by default (without this function), ICU will + * use its own internal implementation of atomic increment/decrement. + * This function can only be used when ICU is in an initial, unused state, before + * u_init() has been called. + * @param context This pointer value will be saved, and then (later) passed as + * a parameter to the increment and decrement functions each time they + * are called. This function can only be called + * @param inc Pointer to a function to do an atomic increment operation. Must be non-null. + * @param dec Pointer to a function to do an atomic decrement operation. Must be non-null. + * @param status Receives error values. + * @deprecated ICU 52. This function is no longer supported. + * @system + */ +U_DEPRECATED void U_EXPORT2 +u_setAtomicIncDecFunctions(const void *context, UMtxAtomicFn *inc, UMtxAtomicFn *dec, + UErrorCode *status); + +#endif /* U_HIDE_DEPRECATED_API */ +#endif /* U_HIDE_SYSTEM_API */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ucnv.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucnv.h new file mode 100644 index 0000000..86e3b84 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucnv.h @@ -0,0 +1,2043 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2014, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** + * ucnv.h: + * External APIs for the ICU's codeset conversion library + * Bertrand A. Damiba + * + * Modification History: + * + * Date Name Description + * 04/04/99 helena Fixed internal header inclusion. + * 05/11/00 helena Added setFallback and usesFallback APIs. + * 06/29/2000 helena Major rewrite of the callback APIs. + * 12/07/2000 srl Update of documentation + */ + +/** + * \file + * \brief C API: Character conversion + * + *

Character Conversion C API

+ * + *

This API is used to convert codepage or character encoded data to and + * from UTF-16. You can open a converter with {@link ucnv_open() }. With that + * converter, you can get its properties, set options, convert your data and + * close the converter.

+ * + *

Since many software programs recogize different converter names for + * different types of converters, there are other functions in this API to + * iterate over the converter aliases. The functions {@link ucnv_getAvailableName() }, + * {@link ucnv_getAlias() } and {@link ucnv_getStandardName() } are some of the + * more frequently used alias functions to get this information.

+ * + *

When a converter encounters an illegal, irregular, invalid or unmappable character + * its default behavior is to use a substitution character to replace the + * bad byte sequence. This behavior can be changed by using {@link ucnv_setFromUCallBack() } + * or {@link ucnv_setToUCallBack() } on the converter. The header ucnv_err.h defines + * many other callback actions that can be used instead of a character substitution.

+ * + *

More information about this API can be found in our + * User's + * Guide.

+ */ + +#ifndef UCNV_H +#define UCNV_H + +#include "unicode/ucnv_err.h" +#include "unicode/uenum.h" +#include "unicode/localpointer.h" + +#ifndef __USET_H__ + +/** + * USet is the C API type for Unicode sets. + * It is forward-declared here to avoid including the header file if related + * conversion APIs are not used. + * See unicode/uset.h + * + * @see ucnv_getUnicodeSet + * @stable ICU 2.6 + */ +struct USet; +/** @stable ICU 2.6 */ +typedef struct USet USet; + +#endif + +#if !UCONFIG_NO_CONVERSION + +U_CDECL_BEGIN + +/** Maximum length of a converter name including the terminating NULL @stable ICU 2.0 */ +#define UCNV_MAX_CONVERTER_NAME_LENGTH 60 +/** Maximum length of a converter name including path and terminating NULL @stable ICU 2.0 */ +#define UCNV_MAX_FULL_FILE_NAME_LENGTH (600+UCNV_MAX_CONVERTER_NAME_LENGTH) + +/** Shift in for EBDCDIC_STATEFUL and iso2022 states @stable ICU 2.0 */ +#define UCNV_SI 0x0F +/** Shift out for EBDCDIC_STATEFUL and iso2022 states @stable ICU 2.0 */ +#define UCNV_SO 0x0E + +/** + * Enum for specifying basic types of converters + * @see ucnv_getType + * @stable ICU 2.0 + */ +typedef enum { + /** @stable ICU 2.0 */ + UCNV_UNSUPPORTED_CONVERTER = -1, + /** @stable ICU 2.0 */ + UCNV_SBCS = 0, + /** @stable ICU 2.0 */ + UCNV_DBCS = 1, + /** @stable ICU 2.0 */ + UCNV_MBCS = 2, + /** @stable ICU 2.0 */ + UCNV_LATIN_1 = 3, + /** @stable ICU 2.0 */ + UCNV_UTF8 = 4, + /** @stable ICU 2.0 */ + UCNV_UTF16_BigEndian = 5, + /** @stable ICU 2.0 */ + UCNV_UTF16_LittleEndian = 6, + /** @stable ICU 2.0 */ + UCNV_UTF32_BigEndian = 7, + /** @stable ICU 2.0 */ + UCNV_UTF32_LittleEndian = 8, + /** @stable ICU 2.0 */ + UCNV_EBCDIC_STATEFUL = 9, + /** @stable ICU 2.0 */ + UCNV_ISO_2022 = 10, + + /** @stable ICU 2.0 */ + UCNV_LMBCS_1 = 11, + /** @stable ICU 2.0 */ + UCNV_LMBCS_2, + /** @stable ICU 2.0 */ + UCNV_LMBCS_3, + /** @stable ICU 2.0 */ + UCNV_LMBCS_4, + /** @stable ICU 2.0 */ + UCNV_LMBCS_5, + /** @stable ICU 2.0 */ + UCNV_LMBCS_6, + /** @stable ICU 2.0 */ + UCNV_LMBCS_8, + /** @stable ICU 2.0 */ + UCNV_LMBCS_11, + /** @stable ICU 2.0 */ + UCNV_LMBCS_16, + /** @stable ICU 2.0 */ + UCNV_LMBCS_17, + /** @stable ICU 2.0 */ + UCNV_LMBCS_18, + /** @stable ICU 2.0 */ + UCNV_LMBCS_19, + /** @stable ICU 2.0 */ + UCNV_LMBCS_LAST = UCNV_LMBCS_19, + /** @stable ICU 2.0 */ + UCNV_HZ, + /** @stable ICU 2.0 */ + UCNV_SCSU, + /** @stable ICU 2.0 */ + UCNV_ISCII, + /** @stable ICU 2.0 */ + UCNV_US_ASCII, + /** @stable ICU 2.0 */ + UCNV_UTF7, + /** @stable ICU 2.2 */ + UCNV_BOCU1, + /** @stable ICU 2.2 */ + UCNV_UTF16, + /** @stable ICU 2.2 */ + UCNV_UTF32, + /** @stable ICU 2.2 */ + UCNV_CESU8, + /** @stable ICU 2.4 */ + UCNV_IMAP_MAILBOX, + /** @stable ICU 4.8 */ + UCNV_COMPOUND_TEXT, + + /* Number of converter types for which we have conversion routines. */ + UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES +} UConverterType; + +/** + * Enum for specifying which platform a converter ID refers to. + * The use of platform/CCSID is not recommended. See ucnv_openCCSID(). + * + * @see ucnv_getPlatform + * @see ucnv_openCCSID + * @see ucnv_getCCSID + * @stable ICU 2.0 + */ +typedef enum { + UCNV_UNKNOWN = -1, + UCNV_IBM = 0 +} UConverterPlatform; + +/** + * Function pointer for error callback in the codepage to unicode direction. + * Called when an error has occured in conversion to unicode, or on open/close of the callback (see reason). + * @param context Pointer to the callback's private data + * @param args Information about the conversion in progress + * @param codeUnits Points to 'length' bytes of the concerned codepage sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param reason Defines the reason the callback was invoked + * @param pErrorCode ICU error code in/out parameter. + * For converter callback functions, set to a conversion error + * before the call, and the callback may reset it to U_ZERO_ERROR. + * @see ucnv_setToUCallBack + * @see UConverterToUnicodeArgs + * @stable ICU 2.0 + */ +typedef void (U_EXPORT2 *UConverterToUCallback) ( + const void* context, + UConverterToUnicodeArgs *args, + const char *codeUnits, + int32_t length, + UConverterCallbackReason reason, + UErrorCode *pErrorCode); + +/** + * Function pointer for error callback in the unicode to codepage direction. + * Called when an error has occured in conversion from unicode, or on open/close of the callback (see reason). + * @param context Pointer to the callback's private data + * @param args Information about the conversion in progress + * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. + * @param reason Defines the reason the callback was invoked + * @param pErrorCode ICU error code in/out parameter. + * For converter callback functions, set to a conversion error + * before the call, and the callback may reset it to U_ZERO_ERROR. + * @see ucnv_setFromUCallBack + * @stable ICU 2.0 + */ +typedef void (U_EXPORT2 *UConverterFromUCallback) ( + const void* context, + UConverterFromUnicodeArgs *args, + const UChar* codeUnits, + int32_t length, + UChar32 codePoint, + UConverterCallbackReason reason, + UErrorCode *pErrorCode); + +U_CDECL_END + +/** + * Character that separates converter names from options and options from each other. + * @see ucnv_open + * @stable ICU 2.0 + */ +#define UCNV_OPTION_SEP_CHAR ',' + +/** + * String version of UCNV_OPTION_SEP_CHAR. + * @see ucnv_open + * @stable ICU 2.0 + */ +#define UCNV_OPTION_SEP_STRING "," + +/** + * Character that separates a converter option from its value. + * @see ucnv_open + * @stable ICU 2.0 + */ +#define UCNV_VALUE_SEP_CHAR '=' + +/** + * String version of UCNV_VALUE_SEP_CHAR. + * @see ucnv_open + * @stable ICU 2.0 + */ +#define UCNV_VALUE_SEP_STRING "=" + +/** + * Converter option for specifying a locale. + * For example, ucnv_open("SCSU,locale=ja", &errorCode); + * See convrtrs.txt. + * + * @see ucnv_open + * @stable ICU 2.0 + */ +#define UCNV_LOCALE_OPTION_STRING ",locale=" + +/** + * Converter option for specifying a version selector (0..9) for some converters. + * For example, + * \code + * ucnv_open("UTF-7,version=1", &errorCode); + * \endcode + * See convrtrs.txt. + * + * @see ucnv_open + * @stable ICU 2.4 + */ +#define UCNV_VERSION_OPTION_STRING ",version=" + +/** + * Converter option for EBCDIC SBCS or mixed-SBCS/DBCS (stateful) codepages. + * Swaps Unicode mappings for EBCDIC LF and NL codes, as used on + * S/390 (z/OS) Unix System Services (Open Edition). + * For example, ucnv_open("ibm-1047,swaplfnl", &errorCode); + * See convrtrs.txt. + * + * @see ucnv_open + * @stable ICU 2.4 + */ +#define UCNV_SWAP_LFNL_OPTION_STRING ",swaplfnl" + +/** + * Do a fuzzy compare of two converter/alias names. + * The comparison is case-insensitive, ignores leading zeroes if they are not + * followed by further digits, and ignores all but letters and digits. + * Thus the strings "UTF-8", "utf_8", "u*T@f08" and "Utf 8" are exactly equivalent. + * See section 1.4, Charset Alias Matching in Unicode Technical Standard #22 + * at http://www.unicode.org/reports/tr22/ + * + * @param name1 a converter name or alias, zero-terminated + * @param name2 a converter name or alias, zero-terminated + * @return 0 if the names match, or a negative value if the name1 + * lexically precedes name2, or a positive value if the name1 + * lexically follows name2. + * @stable ICU 2.0 + */ +U_STABLE int U_EXPORT2 +ucnv_compareNames(const char *name1, const char *name2); + + +/** + * Creates a UConverter object with the name of a coded character set specified as a C string. + * The actual name will be resolved with the alias file + * using a case-insensitive string comparison that ignores + * leading zeroes and all non-alphanumeric characters. + * E.g., the names "UTF8", "utf-8", "u*T@f08" and "Utf 8" are all equivalent. + * (See also ucnv_compareNames().) + * If NULL is passed for the converter name, it will create one with the + * getDefaultName return value. + * + *

A converter name for ICU 1.5 and above may contain options + * like a locale specification to control the specific behavior of + * the newly instantiated converter. + * The meaning of the options depends on the particular converter. + * If an option is not defined for or recognized by a given converter, then it is ignored.

+ * + *

Options are appended to the converter name string, with a + * UCNV_OPTION_SEP_CHAR between the name and the first option and + * also between adjacent options.

+ * + *

If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING.

+ * + *

The conversion behavior and names can vary between platforms. ICU may + * convert some characters differently from other platforms. Details on this topic + * are in the User's + * Guide. Aliases starting with a "cp" prefix have no specific meaning + * other than its an alias starting with the letters "cp". Please do not + * associate any meaning to these aliases.

+ * + * \snippet samples/ucnv/convsamp.cpp ucnv_open + * + * @param converterName Name of the coded character set table. + * This may have options appended to the string. + * IANA alias character set names, IBM CCSIDs starting with "ibm-", + * Windows codepage numbers starting with "windows-" are frequently + * used for this parameter. See ucnv_getAvailableName and + * ucnv_getAlias for a complete list that is available. + * If this parameter is NULL, the default converter will be used. + * @param err outgoing error status U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR + * @return the created Unicode converter object, or NULL if an error occured + * @see ucnv_openU + * @see ucnv_openCCSID + * @see ucnv_getAvailableName + * @see ucnv_getAlias + * @see ucnv_getDefaultName + * @see ucnv_close + * @see ucnv_compareNames + * @stable ICU 2.0 + */ +U_STABLE UConverter* U_EXPORT2 +ucnv_open(const char *converterName, UErrorCode *err); + + +/** + * Creates a Unicode converter with the names specified as unicode string. + * The name should be limited to the ASCII-7 alphanumerics range. + * The actual name will be resolved with the alias file + * using a case-insensitive string comparison that ignores + * leading zeroes and all non-alphanumeric characters. + * E.g., the names "UTF8", "utf-8", "u*T@f08" and "Utf 8" are all equivalent. + * (See also ucnv_compareNames().) + * If NULL is passed for the converter name, it will create + * one with the ucnv_getDefaultName() return value. + * If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. + * + *

See ucnv_open for the complete details

+ * @param name Name of the UConverter table in a zero terminated + * Unicode string + * @param err outgoing error status U_MEMORY_ALLOCATION_ERROR, + * U_FILE_ACCESS_ERROR + * @return the created Unicode converter object, or NULL if an + * error occured + * @see ucnv_open + * @see ucnv_openCCSID + * @see ucnv_close + * @see ucnv_compareNames + * @stable ICU 2.0 + */ +U_STABLE UConverter* U_EXPORT2 +ucnv_openU(const UChar *name, + UErrorCode *err); + +/** + * Creates a UConverter object from a CCSID number and platform pair. + * Note that the usefulness of this function is limited to platforms with numeric + * encoding IDs. Only IBM and Microsoft platforms use numeric (16-bit) identifiers for + * encodings. + * + * In addition, IBM CCSIDs and Unicode conversion tables are not 1:1 related. + * For many IBM CCSIDs there are multiple (up to six) Unicode conversion tables, and + * for some Unicode conversion tables there are multiple CCSIDs. + * Some "alternate" Unicode conversion tables are provided by the + * IBM CDRA conversion table registry. + * The most prominent example of a systematic modification of conversion tables that is + * not provided in the form of conversion table files in the repository is + * that S/390 Unix System Services swaps the codes for Line Feed and New Line in all + * EBCDIC codepages, which requires such a swap in the Unicode conversion tables as well. + * + * Only IBM default conversion tables are accessible with ucnv_openCCSID(). + * ucnv_getCCSID() will return the same CCSID for all conversion tables that are associated + * with that CCSID. + * + * Currently, the only "platform" supported in the ICU converter API is UCNV_IBM. + * + * In summary, the use of CCSIDs and the associated API functions is not recommended. + * + * In order to open a converter with the default IBM CDRA Unicode conversion table, + * you can use this function or use the prefix "ibm-": + * \code + * char name[20]; + * sprintf(name, "ibm-%hu", ccsid); + * cnv=ucnv_open(name, &errorCode); + * \endcode + * + * In order to open a converter with the IBM S/390 Unix System Services variant + * of a Unicode/EBCDIC conversion table, + * you can use the prefix "ibm-" together with the option string UCNV_SWAP_LFNL_OPTION_STRING: + * \code + * char name[20]; + * sprintf(name, "ibm-%hu" UCNV_SWAP_LFNL_OPTION_STRING, ccsid); + * cnv=ucnv_open(name, &errorCode); + * \endcode + * + * In order to open a converter from a Microsoft codepage number, use the prefix "cp": + * \code + * char name[20]; + * sprintf(name, "cp%hu", codepageID); + * cnv=ucnv_open(name, &errorCode); + * \endcode + * + * If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. + * + * @param codepage codepage number to create + * @param platform the platform in which the codepage number exists + * @param err error status U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR + * @return the created Unicode converter object, or NULL if an error + * occured. + * @see ucnv_open + * @see ucnv_openU + * @see ucnv_close + * @see ucnv_getCCSID + * @see ucnv_getPlatform + * @see UConverterPlatform + * @stable ICU 2.0 + */ +U_STABLE UConverter* U_EXPORT2 +ucnv_openCCSID(int32_t codepage, + UConverterPlatform platform, + UErrorCode * err); + +/** + *

Creates a UConverter object specified from a packageName and a converterName.

+ * + *

The packageName and converterName must point to an ICU udata object, as defined by + * udata_open( packageName, "cnv", converterName, err) or equivalent. + * Typically, packageName will refer to a (.dat) file, or to a package registered with + * udata_setAppData(). Using a full file or directory pathname for packageName is deprecated.

+ * + *

The name will NOT be looked up in the alias mechanism, nor will the converter be + * stored in the converter cache or the alias table. The only way to open further converters + * is call this function multiple times, or use the ucnv_safeClone() function to clone a + * 'master' converter.

+ * + *

A future version of ICU may add alias table lookups and/or caching + * to this function.

+ * + *

Example Use: + * cnv = ucnv_openPackage("myapp", "myconverter", &err); + *

+ * + * @param packageName name of the package (equivalent to 'path' in udata_open() call) + * @param converterName name of the data item to be used, without suffix. + * @param err outgoing error status U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR + * @return the created Unicode converter object, or NULL if an error occured + * @see udata_open + * @see ucnv_open + * @see ucnv_safeClone + * @see ucnv_close + * @stable ICU 2.2 + */ +U_STABLE UConverter* U_EXPORT2 +ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err); + +/** + * Thread safe converter cloning operation. + * For most efficient operation, pass in a stackBuffer (and a *pBufferSize) + * with at least U_CNV_SAFECLONE_BUFFERSIZE bytes of space. + * If the buffer size is sufficient, then the clone will use the stack buffer; + * otherwise, it will be allocated, and *pBufferSize will indicate + * the actual size. (This should not occur with U_CNV_SAFECLONE_BUFFERSIZE.) + * + * You must ucnv_close() the clone in any case. + * + * If *pBufferSize==0, (regardless of whether stackBuffer==NULL or not) + * then *pBufferSize will be changed to a sufficient size + * for cloning this converter, + * without actually cloning the converter ("pure pre-flighting"). + * + * If *pBufferSize is greater than zero but not large enough for a stack-based + * clone, then the converter is cloned using newly allocated memory + * and *pBufferSize is changed to the necessary size. + * + * If the converter clone fits into the stack buffer but the stack buffer is not + * sufficiently aligned for the clone, then the clone will use an + * adjusted pointer and use an accordingly smaller buffer size. + * + * @param cnv converter to be cloned + * @param stackBuffer Deprecated functionality as of ICU 52, use NULL.
+ * user allocated space for the new clone. If NULL new memory will be allocated. + * If buffer is not large enough, new memory will be allocated. + * Clients can use the U_CNV_SAFECLONE_BUFFERSIZE. This will probably be enough to avoid memory allocations. + * @param pBufferSize Deprecated functionality as of ICU 52, use NULL or 1.
+ * pointer to size of allocated space. + * @param status to indicate whether the operation went on smoothly or there were errors + * An informational status value, U_SAFECLONE_ALLOCATED_WARNING, + * is used if any allocations were necessary. + * However, it is better to check if *pBufferSize grew for checking for + * allocations because warning codes can be overridden by subsequent + * function calls. + * @return pointer to the new clone + * @stable ICU 2.0 + */ +U_STABLE UConverter * U_EXPORT2 +ucnv_safeClone(const UConverter *cnv, + void *stackBuffer, + int32_t *pBufferSize, + UErrorCode *status); + +#ifndef U_HIDE_DEPRECATED_API + +/** + * \def U_CNV_SAFECLONE_BUFFERSIZE + * Definition of a buffer size that is designed to be large enough for + * converters to be cloned with ucnv_safeClone(). + * @deprecated ICU 52. Do not rely on ucnv_safeClone() cloning into any provided buffer. + */ +#define U_CNV_SAFECLONE_BUFFERSIZE 1024 + +#endif /* U_HIDE_DEPRECATED_API */ + +/** + * Deletes the unicode converter and releases resources associated + * with just this instance. + * Does not free up shared converter tables. + * + * @param converter the converter object to be deleted + * @see ucnv_open + * @see ucnv_openU + * @see ucnv_openCCSID + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucnv_close(UConverter * converter); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUConverterPointer + * "Smart pointer" class, closes a UConverter via ucnv_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterPointer, UConverter, ucnv_close); + +U_NAMESPACE_END + +#endif + +/** + * Fills in the output parameter, subChars, with the substitution characters + * as multiple bytes. + * If ucnv_setSubstString() set a Unicode string because the converter is + * stateful, then subChars will be an empty string. + * + * @param converter the Unicode converter + * @param subChars the subsitution characters + * @param len on input the capacity of subChars, on output the number + * of bytes copied to it + * @param err the outgoing error status code. + * If the substitution character array is too small, an + * U_INDEX_OUTOFBOUNDS_ERROR will be returned. + * @see ucnv_setSubstString + * @see ucnv_setSubstChars + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucnv_getSubstChars(const UConverter *converter, + char *subChars, + int8_t *len, + UErrorCode *err); + +/** + * Sets the substitution chars when converting from unicode to a codepage. The + * substitution is specified as a string of 1-4 bytes, and may contain + * NULL bytes. + * The subChars must represent a single character. The caller needs to know the + * byte sequence of a valid character in the converter's charset. + * For some converters, for example some ISO 2022 variants, only single-byte + * substitution characters may be supported. + * The newer ucnv_setSubstString() function relaxes these limitations. + * + * @param converter the Unicode converter + * @param subChars the substitution character byte sequence we want set + * @param len the number of bytes in subChars + * @param err the error status code. U_INDEX_OUTOFBOUNDS_ERROR if + * len is bigger than the maximum number of bytes allowed in subchars + * @see ucnv_setSubstString + * @see ucnv_getSubstChars + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucnv_setSubstChars(UConverter *converter, + const char *subChars, + int8_t len, + UErrorCode *err); + +/** + * Set a substitution string for converting from Unicode to a charset. + * The caller need not know the charset byte sequence for each charset. + * + * Unlike ucnv_setSubstChars() which is designed to set a charset byte sequence + * for a single character, this function takes a Unicode string with + * zero, one or more characters, and immediately verifies that the string can be + * converted to the charset. + * If not, or if the result is too long (more than 32 bytes as of ICU 3.6), + * then the function returns with an error accordingly. + * + * Also unlike ucnv_setSubstChars(), this function works for stateful charsets + * by converting on the fly at the point of substitution rather than setting + * a fixed byte sequence. + * + * @param cnv The UConverter object. + * @param s The Unicode string. + * @param length The number of UChars in s, or -1 for a NUL-terminated string. + * @param err Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * + * @see ucnv_setSubstChars + * @see ucnv_getSubstChars + * @stable ICU 3.6 + */ +U_STABLE void U_EXPORT2 +ucnv_setSubstString(UConverter *cnv, + const UChar *s, + int32_t length, + UErrorCode *err); + +/** + * Fills in the output parameter, errBytes, with the error characters from the + * last failing conversion. + * + * @param converter the Unicode converter + * @param errBytes the codepage bytes which were in error + * @param len on input the capacity of errBytes, on output the number of + * bytes which were copied to it + * @param err the error status code. + * If the substitution character array is too small, an + * U_INDEX_OUTOFBOUNDS_ERROR will be returned. + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucnv_getInvalidChars(const UConverter *converter, + char *errBytes, + int8_t *len, + UErrorCode *err); + +/** + * Fills in the output parameter, errChars, with the error characters from the + * last failing conversion. + * + * @param converter the Unicode converter + * @param errUChars the UChars which were in error + * @param len on input the capacity of errUChars, on output the number of + * UChars which were copied to it + * @param err the error status code. + * If the substitution character array is too small, an + * U_INDEX_OUTOFBOUNDS_ERROR will be returned. + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucnv_getInvalidUChars(const UConverter *converter, + UChar *errUChars, + int8_t *len, + UErrorCode *err); + +/** + * Resets the state of a converter to the default state. This is used + * in the case of an error, to restart a conversion from a known default state. + * It will also empty the internal output buffers. + * @param converter the Unicode converter + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucnv_reset(UConverter *converter); + +/** + * Resets the to-Unicode part of a converter state to the default state. + * This is used in the case of an error to restart a conversion to + * Unicode to a known default state. It will also empty the internal + * output buffers used for the conversion to Unicode codepoints. + * @param converter the Unicode converter + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucnv_resetToUnicode(UConverter *converter); + +/** + * Resets the from-Unicode part of a converter state to the default state. + * This is used in the case of an error to restart a conversion from + * Unicode to a known default state. It will also empty the internal output + * buffers used for the conversion from Unicode codepoints. + * @param converter the Unicode converter + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucnv_resetFromUnicode(UConverter *converter); + +/** + * Returns the maximum number of bytes that are output per UChar in conversion + * from Unicode using this converter. + * The returned number can be used with UCNV_GET_MAX_BYTES_FOR_STRING + * to calculate the size of a target buffer for conversion from Unicode. + * + * Note: Before ICU 2.8, this function did not return reliable numbers for + * some stateful converters (EBCDIC_STATEFUL, ISO-2022) and LMBCS. + * + * This number may not be the same as the maximum number of bytes per + * "conversion unit". In other words, it may not be the intuitively expected + * number of bytes per character that would be published for a charset, + * and may not fulfill any other purpose than the allocation of an output + * buffer of guaranteed sufficient size for a given input length and converter. + * + * Examples for special cases that are taken into account: + * - Supplementary code points may convert to more bytes than BMP code points. + * This function returns bytes per UChar (UTF-16 code unit), not per + * Unicode code point, for efficient buffer allocation. + * - State-shifting output (SI/SO, escapes, etc.) from stateful converters. + * - When m input UChars are converted to n output bytes, then the maximum m/n + * is taken into account. + * + * The number returned here does not take into account + * (see UCNV_GET_MAX_BYTES_FOR_STRING): + * - callbacks which output more than one charset character sequence per call, + * like escape callbacks + * - initial and final non-character bytes that are output by some converters + * (automatic BOMs, initial escape sequence, final SI, etc.) + * + * Examples for returned values: + * - SBCS charsets: 1 + * - Shift-JIS: 2 + * - UTF-16: 2 (2 per BMP, 4 per surrogate _pair_, BOM not counted) + * - UTF-8: 3 (3 per BMP, 4 per surrogate _pair_) + * - EBCDIC_STATEFUL (EBCDIC mixed SBCS/DBCS): 3 (SO + DBCS) + * - ISO-2022: 3 (always outputs UTF-8) + * - ISO-2022-JP: 6 (4-byte escape sequences + DBCS) + * - ISO-2022-CN: 8 (4-byte designator sequences + 2-byte SS2/SS3 + DBCS) + * + * @param converter The Unicode converter. + * @return The maximum number of bytes per UChar (16 bit code unit) + * that are output by ucnv_fromUnicode(), + * to be used together with UCNV_GET_MAX_BYTES_FOR_STRING + * for buffer allocation. + * + * @see UCNV_GET_MAX_BYTES_FOR_STRING + * @see ucnv_getMinCharSize + * @stable ICU 2.0 + */ +U_STABLE int8_t U_EXPORT2 +ucnv_getMaxCharSize(const UConverter *converter); + +/** + * Calculates the size of a buffer for conversion from Unicode to a charset. + * The calculated size is guaranteed to be sufficient for this conversion. + * + * It takes into account initial and final non-character bytes that are output + * by some converters. + * It does not take into account callbacks which output more than one charset + * character sequence per call, like escape callbacks. + * The default (substitution) callback only outputs one charset character sequence. + * + * @param length Number of UChars to be converted. + * @param maxCharSize Return value from ucnv_getMaxCharSize() for the converter + * that will be used. + * @return Size of a buffer that will be large enough to hold the output bytes of + * converting length UChars with the converter that returned the maxCharSize. + * + * @see ucnv_getMaxCharSize + * @stable ICU 2.8 + */ +#define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) \ + (((int32_t)(length)+10)*(int32_t)(maxCharSize)) + +/** + * Returns the minimum byte length (per codepoint) for characters in this codepage. + * This is usually either 1 or 2. + * @param converter the Unicode converter + * @return the minimum number of bytes per codepoint allowed by this particular converter + * @see ucnv_getMaxCharSize + * @stable ICU 2.0 + */ +U_STABLE int8_t U_EXPORT2 +ucnv_getMinCharSize(const UConverter *converter); + +/** + * Returns the display name of the converter passed in based on the Locale + * passed in. If the locale contains no display name, the internal ASCII + * name will be filled in. + * + * @param converter the Unicode converter. + * @param displayLocale is the specific Locale we want to localised for + * @param displayName user provided buffer to be filled in + * @param displayNameCapacity size of displayName Buffer + * @param err error status code + * @return displayNameLength number of UChar needed in displayName + * @see ucnv_getName + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ucnv_getDisplayName(const UConverter *converter, + const char *displayLocale, + UChar *displayName, + int32_t displayNameCapacity, + UErrorCode *err); + +/** + * Gets the internal, canonical name of the converter (zero-terminated). + * The lifetime of the returned string will be that of the converter + * passed to this function. + * @param converter the Unicode converter + * @param err UErrorCode status + * @return the internal name of the converter + * @see ucnv_getDisplayName + * @stable ICU 2.0 + */ +U_STABLE const char * U_EXPORT2 +ucnv_getName(const UConverter *converter, UErrorCode *err); + +/** + * Gets a codepage number associated with the converter. This is not guaranteed + * to be the one used to create the converter. Some converters do not represent + * platform registered codepages and return zero for the codepage number. + * The error code fill-in parameter indicates if the codepage number + * is available. + * Does not check if the converter is NULL or if converter's data + * table is NULL. + * + * Important: The use of CCSIDs is not recommended because it is limited + * to only two platforms in principle and only one (UCNV_IBM) in the current + * ICU converter API. + * Also, CCSIDs are insufficient to identify IBM Unicode conversion tables precisely. + * For more details see ucnv_openCCSID(). + * + * @param converter the Unicode converter + * @param err the error status code. + * @return If any error occurrs, -1 will be returned otherwise, the codepage number + * will be returned + * @see ucnv_openCCSID + * @see ucnv_getPlatform + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ucnv_getCCSID(const UConverter *converter, + UErrorCode *err); + +/** + * Gets a codepage platform associated with the converter. Currently, + * only UCNV_IBM will be returned. + * Does not test if the converter is NULL or if converter's data + * table is NULL. + * @param converter the Unicode converter + * @param err the error status code. + * @return The codepage platform + * @stable ICU 2.0 + */ +U_STABLE UConverterPlatform U_EXPORT2 +ucnv_getPlatform(const UConverter *converter, + UErrorCode *err); + +/** + * Gets the type of the converter + * e.g. SBCS, MBCS, DBCS, UTF8, UTF16_BE, UTF16_LE, ISO_2022, + * EBCDIC_STATEFUL, LATIN_1 + * @param converter a valid, opened converter + * @return the type of the converter + * @stable ICU 2.0 + */ +U_STABLE UConverterType U_EXPORT2 +ucnv_getType(const UConverter * converter); + +/** + * Gets the "starter" (lead) bytes for converters of type MBCS. + * Will fill in an U_ILLEGAL_ARGUMENT_ERROR if converter passed in + * is not MBCS. Fills in an array of type UBool, with the value of the byte + * as offset to the array. For example, if (starters[0x20] == TRUE) at return, + * it means that the byte 0x20 is a starter byte in this converter. + * Context pointers are always owned by the caller. + * + * @param converter a valid, opened converter of type MBCS + * @param starters an array of size 256 to be filled in + * @param err error status, U_ILLEGAL_ARGUMENT_ERROR if the + * converter is not a type which can return starters. + * @see ucnv_getType + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucnv_getStarters(const UConverter* converter, + UBool starters[256], + UErrorCode* err); + + +/** + * Selectors for Unicode sets that can be returned by ucnv_getUnicodeSet(). + * @see ucnv_getUnicodeSet + * @stable ICU 2.6 + */ +typedef enum UConverterUnicodeSet { + /** Select the set of roundtrippable Unicode code points. @stable ICU 2.6 */ + UCNV_ROUNDTRIP_SET, + /** Select the set of Unicode code points with roundtrip or fallback mappings. @stable ICU 4.0 */ + UCNV_ROUNDTRIP_AND_FALLBACK_SET, +#ifndef U_HIDE_DEPRECATED_API + /** + * Number of UConverterUnicodeSet selectors. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UCNV_SET_COUNT +#endif // U_HIDE_DEPRECATED_API +} UConverterUnicodeSet; + + +/** + * Returns the set of Unicode code points that can be converted by an ICU converter. + * + * Returns one of several kinds of set: + * + * 1. UCNV_ROUNDTRIP_SET + * + * The set of all Unicode code points that can be roundtrip-converted + * (converted without any data loss) with the converter (ucnv_fromUnicode()). + * This set will not include code points that have fallback mappings + * or are only the result of reverse fallback mappings. + * This set will also not include PUA code points with fallbacks, although + * ucnv_fromUnicode() will always uses those mappings despite ucnv_setFallback(). + * See UTR #22 "Character Mapping Markup Language" + * at http://www.unicode.org/reports/tr22/ + * + * This is useful for example for + * - checking that a string or document can be roundtrip-converted with a converter, + * without/before actually performing the conversion + * - testing if a converter can be used for text for typical text for a certain locale, + * by comparing its roundtrip set with the set of ExemplarCharacters from + * ICU's locale data or other sources + * + * 2. UCNV_ROUNDTRIP_AND_FALLBACK_SET + * + * The set of all Unicode code points that can be converted with the converter (ucnv_fromUnicode()) + * when fallbacks are turned on (see ucnv_setFallback()). + * This set includes all code points with roundtrips and fallbacks (but not reverse fallbacks). + * + * In the future, there may be more UConverterUnicodeSet choices to select + * sets with different properties. + * + * @param cnv The converter for which a set is requested. + * @param setFillIn A valid USet *. It will be cleared by this function before + * the converter's specific set is filled into the USet. + * @param whichSet A UConverterUnicodeSet selector; + * currently UCNV_ROUNDTRIP_SET is the only supported value. + * @param pErrorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * + * @see UConverterUnicodeSet + * @see uset_open + * @see uset_close + * @stable ICU 2.6 + */ +U_STABLE void U_EXPORT2 +ucnv_getUnicodeSet(const UConverter *cnv, + USet *setFillIn, + UConverterUnicodeSet whichSet, + UErrorCode *pErrorCode); + +/** + * Gets the current calback function used by the converter when an illegal + * or invalid codepage sequence is found. + * Context pointers are always owned by the caller. + * + * @param converter the unicode converter + * @param action fillin: returns the callback function pointer + * @param context fillin: returns the callback's private void* context + * @see ucnv_setToUCallBack + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucnv_getToUCallBack (const UConverter * converter, + UConverterToUCallback *action, + const void **context); + +/** + * Gets the current callback function used by the converter when illegal + * or invalid Unicode sequence is found. + * Context pointers are always owned by the caller. + * + * @param converter the unicode converter + * @param action fillin: returns the callback function pointer + * @param context fillin: returns the callback's private void* context + * @see ucnv_setFromUCallBack + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucnv_getFromUCallBack (const UConverter * converter, + UConverterFromUCallback *action, + const void **context); + +/** + * Changes the callback function used by the converter when + * an illegal or invalid sequence is found. + * Context pointers are always owned by the caller. + * Predefined actions and contexts can be found in the ucnv_err.h header. + * + * @param converter the unicode converter + * @param newAction the new callback function + * @param newContext the new toUnicode callback context pointer. This can be NULL. + * @param oldAction fillin: returns the old callback function pointer. This can be NULL. + * @param oldContext fillin: returns the old callback's private void* context. This can be NULL. + * @param err The error code status + * @see ucnv_getToUCallBack + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucnv_setToUCallBack (UConverter * converter, + UConverterToUCallback newAction, + const void* newContext, + UConverterToUCallback *oldAction, + const void** oldContext, + UErrorCode * err); + +/** + * Changes the current callback function used by the converter when + * an illegal or invalid sequence is found. + * Context pointers are always owned by the caller. + * Predefined actions and contexts can be found in the ucnv_err.h header. + * + * @param converter the unicode converter + * @param newAction the new callback function + * @param newContext the new fromUnicode callback context pointer. This can be NULL. + * @param oldAction fillin: returns the old callback function pointer. This can be NULL. + * @param oldContext fillin: returns the old callback's private void* context. This can be NULL. + * @param err The error code status + * @see ucnv_getFromUCallBack + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucnv_setFromUCallBack (UConverter * converter, + UConverterFromUCallback newAction, + const void *newContext, + UConverterFromUCallback *oldAction, + const void **oldContext, + UErrorCode * err); + +/** + * Converts an array of unicode characters to an array of codepage + * characters. This function is optimized for converting a continuous + * stream of data in buffer-sized chunks, where the entire source and + * target does not fit in available buffers. + * + * The source pointer is an in/out parameter. It starts out pointing where the + * conversion is to begin, and ends up pointing after the last UChar consumed. + * + * Target similarly starts out pointer at the first available byte in the output + * buffer, and ends up pointing after the last byte written to the output. + * + * The converter always attempts to consume the entire source buffer, unless + * (1.) the target buffer is full, or (2.) a failing error is returned from the + * current callback function. When a successful error status has been + * returned, it means that all of the source buffer has been + * consumed. At that point, the caller should reset the source and + * sourceLimit pointers to point to the next chunk. + * + * At the end of the stream (flush==TRUE), the input is completely consumed + * when *source==sourceLimit and no error code is set. + * The converter object is then automatically reset by this function. + * (This means that a converter need not be reset explicitly between data + * streams if it finishes the previous stream without errors.) + * + * This is a stateful conversion. Additionally, even when all source data has + * been consumed, some data may be in the converters' internal state. + * Call this function repeatedly, updating the target pointers with + * the next empty chunk of target in case of a + * U_BUFFER_OVERFLOW_ERROR, and updating the source pointers + * with the next chunk of source when a successful error status is + * returned, until there are no more chunks of source data. + * @param converter the Unicode converter + * @param target I/O parameter. Input : Points to the beginning of the buffer to copy + * codepage characters to. Output : points to after the last codepage character copied + * to target. + * @param targetLimit the pointer just after last of the target buffer + * @param source I/O parameter, pointer to pointer to the source Unicode character buffer. + * @param sourceLimit the pointer just after the last of the source buffer + * @param offsets if NULL is passed, nothing will happen to it, otherwise it needs to have the same number + * of allocated cells as target. Will fill in offsets from target to source pointer + * e.g: offsets[3] is equal to 6, it means that the target[3] was a result of transcoding source[6] + * For output data carried across calls, and other data without a specific source character + * (such as from escape sequences or callbacks) -1 will be placed for offsets. + * @param flush set to TRUE if the current source buffer is the last available + * chunk of the source, FALSE otherwise. Note that if a failing status is returned, + * this function may have to be called multiple times with flush set to TRUE until + * the source buffer is consumed. + * @param err the error status. U_ILLEGAL_ARGUMENT_ERROR will be set if the + * converter is NULL. + * U_BUFFER_OVERFLOW_ERROR will be set if the target is full and there is + * still data to be written to the target. + * @see ucnv_fromUChars + * @see ucnv_convert + * @see ucnv_getMinCharSize + * @see ucnv_setToUCallBack + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucnv_fromUnicode (UConverter * converter, + char **target, + const char *targetLimit, + const UChar ** source, + const UChar * sourceLimit, + int32_t* offsets, + UBool flush, + UErrorCode * err); + +/** + * Converts a buffer of codepage bytes into an array of unicode UChars + * characters. This function is optimized for converting a continuous + * stream of data in buffer-sized chunks, where the entire source and + * target does not fit in available buffers. + * + * The source pointer is an in/out parameter. It starts out pointing where the + * conversion is to begin, and ends up pointing after the last byte of source consumed. + * + * Target similarly starts out pointer at the first available UChar in the output + * buffer, and ends up pointing after the last UChar written to the output. + * It does NOT necessarily keep UChar sequences together. + * + * The converter always attempts to consume the entire source buffer, unless + * (1.) the target buffer is full, or (2.) a failing error is returned from the + * current callback function. When a successful error status has been + * returned, it means that all of the source buffer has been + * consumed. At that point, the caller should reset the source and + * sourceLimit pointers to point to the next chunk. + * + * At the end of the stream (flush==TRUE), the input is completely consumed + * when *source==sourceLimit and no error code is set + * The converter object is then automatically reset by this function. + * (This means that a converter need not be reset explicitly between data + * streams if it finishes the previous stream without errors.) + * + * This is a stateful conversion. Additionally, even when all source data has + * been consumed, some data may be in the converters' internal state. + * Call this function repeatedly, updating the target pointers with + * the next empty chunk of target in case of a + * U_BUFFER_OVERFLOW_ERROR, and updating the source pointers + * with the next chunk of source when a successful error status is + * returned, until there are no more chunks of source data. + * @param converter the Unicode converter + * @param target I/O parameter. Input : Points to the beginning of the buffer to copy + * UChars into. Output : points to after the last UChar copied. + * @param targetLimit the pointer just after the end of the target buffer + * @param source I/O parameter, pointer to pointer to the source codepage buffer. + * @param sourceLimit the pointer to the byte after the end of the source buffer + * @param offsets if NULL is passed, nothing will happen to it, otherwise it needs to have the same number + * of allocated cells as target. Will fill in offsets from target to source pointer + * e.g: offsets[3] is equal to 6, it means that the target[3] was a result of transcoding source[6] + * For output data carried across calls, and other data without a specific source character + * (such as from escape sequences or callbacks) -1 will be placed for offsets. + * @param flush set to TRUE if the current source buffer is the last available + * chunk of the source, FALSE otherwise. Note that if a failing status is returned, + * this function may have to be called multiple times with flush set to TRUE until + * the source buffer is consumed. + * @param err the error status. U_ILLEGAL_ARGUMENT_ERROR will be set if the + * converter is NULL. + * U_BUFFER_OVERFLOW_ERROR will be set if the target is full and there is + * still data to be written to the target. + * @see ucnv_fromUChars + * @see ucnv_convert + * @see ucnv_getMinCharSize + * @see ucnv_setFromUCallBack + * @see ucnv_getNextUChar + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucnv_toUnicode(UConverter *converter, + UChar **target, + const UChar *targetLimit, + const char **source, + const char *sourceLimit, + int32_t *offsets, + UBool flush, + UErrorCode *err); + +/** + * Convert the Unicode string into a codepage string using an existing UConverter. + * The output string is NUL-terminated if possible. + * + * This function is a more convenient but less powerful version of ucnv_fromUnicode(). + * It is only useful for whole strings, not for streaming conversion. + * + * The maximum output buffer capacity required (barring output from callbacks) will be + * UCNV_GET_MAX_BYTES_FOR_STRING(srcLength, ucnv_getMaxCharSize(cnv)). + * + * @param cnv the converter object to be used (ucnv_resetFromUnicode() will be called) + * @param src the input Unicode string + * @param srcLength the input string length, or -1 if NUL-terminated + * @param dest destination string buffer, can be NULL if destCapacity==0 + * @param destCapacity the number of chars available at dest + * @param pErrorCode normal ICU error code; + * common error codes that may be set by this function include + * U_BUFFER_OVERFLOW_ERROR, U_STRING_NOT_TERMINATED_WARNING, + * U_ILLEGAL_ARGUMENT_ERROR, and conversion errors + * @return the length of the output string, not counting the terminating NUL; + * if the length is greater than destCapacity, then the string will not fit + * and a buffer of the indicated length would need to be passed in + * @see ucnv_fromUnicode + * @see ucnv_convert + * @see UCNV_GET_MAX_BYTES_FOR_STRING + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ucnv_fromUChars(UConverter *cnv, + char *dest, int32_t destCapacity, + const UChar *src, int32_t srcLength, + UErrorCode *pErrorCode); + +/** + * Convert the codepage string into a Unicode string using an existing UConverter. + * The output string is NUL-terminated if possible. + * + * This function is a more convenient but less powerful version of ucnv_toUnicode(). + * It is only useful for whole strings, not for streaming conversion. + * + * The maximum output buffer capacity required (barring output from callbacks) will be + * 2*srcLength (each char may be converted into a surrogate pair). + * + * @param cnv the converter object to be used (ucnv_resetToUnicode() will be called) + * @param src the input codepage string + * @param srcLength the input string length, or -1 if NUL-terminated + * @param dest destination string buffer, can be NULL if destCapacity==0 + * @param destCapacity the number of UChars available at dest + * @param pErrorCode normal ICU error code; + * common error codes that may be set by this function include + * U_BUFFER_OVERFLOW_ERROR, U_STRING_NOT_TERMINATED_WARNING, + * U_ILLEGAL_ARGUMENT_ERROR, and conversion errors + * @return the length of the output string, not counting the terminating NUL; + * if the length is greater than destCapacity, then the string will not fit + * and a buffer of the indicated length would need to be passed in + * @see ucnv_toUnicode + * @see ucnv_convert + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ucnv_toUChars(UConverter *cnv, + UChar *dest, int32_t destCapacity, + const char *src, int32_t srcLength, + UErrorCode *pErrorCode); + +/** + * Convert a codepage buffer into Unicode one character at a time. + * The input is completely consumed when the U_INDEX_OUTOFBOUNDS_ERROR is set. + * + * Advantage compared to ucnv_toUnicode() or ucnv_toUChars(): + * - Faster for small amounts of data, for most converters, e.g., + * US-ASCII, ISO-8859-1, UTF-8/16/32, and most "normal" charsets. + * (For complex converters, e.g., SCSU, UTF-7 and ISO 2022 variants, + * it uses ucnv_toUnicode() internally.) + * - Convenient. + * + * Limitations compared to ucnv_toUnicode(): + * - Always assumes flush=TRUE. + * This makes ucnv_getNextUChar() unsuitable for "streaming" conversion, + * that is, for where the input is supplied in multiple buffers, + * because ucnv_getNextUChar() will assume the end of the input at the end + * of the first buffer. + * - Does not provide offset output. + * + * It is possible to "mix" ucnv_getNextUChar() and ucnv_toUnicode() because + * ucnv_getNextUChar() uses the current state of the converter + * (unlike ucnv_toUChars() which always resets first). + * However, if ucnv_getNextUChar() is called after ucnv_toUnicode() + * stopped in the middle of a character sequence (with flush=FALSE), + * then ucnv_getNextUChar() will always use the slower ucnv_toUnicode() + * internally until the next character boundary. + * (This is new in ICU 2.6. In earlier releases, ucnv_getNextUChar() had to + * start at a character boundary.) + * + * Instead of using ucnv_getNextUChar(), it is recommended + * to convert using ucnv_toUnicode() or ucnv_toUChars() + * and then iterate over the text using U16_NEXT() or a UCharIterator (uiter.h) + * or a C++ CharacterIterator or similar. + * This allows streaming conversion and offset output, for example. + * + *

Handling of surrogate pairs and supplementary-plane code points:
+ * There are two different kinds of codepages that provide mappings for surrogate characters: + *

    + *
  • Codepages like UTF-8, UTF-32, and GB 18030 provide direct representations for Unicode + * code points U+10000-U+10ffff as well as for single surrogates U+d800-U+dfff. + * Each valid sequence will result in exactly one returned code point. + * If a sequence results in a single surrogate, then that will be returned + * by itself, even if a neighboring sequence encodes the matching surrogate.
  • + *
  • Codepages like SCSU and LMBCS (and UTF-16) provide direct representations only for BMP code points + * including surrogates. Code points in supplementary planes are represented with + * two sequences, each encoding a surrogate. + * For these codepages, matching pairs of surrogates will be combined into single + * code points for returning from this function. + * (Note that SCSU is actually a mix of these codepage types.)
  • + *

+ * + * @param converter an open UConverter + * @param source the address of a pointer to the codepage buffer, will be + * updated to point after the bytes consumed in the conversion call. + * @param sourceLimit points to the end of the input buffer + * @param err fills in error status (see ucnv_toUnicode) + * U_INDEX_OUTOFBOUNDS_ERROR will be set if the input + * is empty or does not convert to any output (e.g.: pure state-change + * codes SI/SO, escape sequences for ISO 2022, + * or if the callback did not output anything, ...). + * This function will not set a U_BUFFER_OVERFLOW_ERROR because + * the "buffer" is the return code. However, there might be subsequent output + * stored in the converter object + * that will be returned in following calls to this function. + * @return a UChar32 resulting from the partial conversion of source + * @see ucnv_toUnicode + * @see ucnv_toUChars + * @see ucnv_convert + * @stable ICU 2.0 + */ +U_STABLE UChar32 U_EXPORT2 +ucnv_getNextUChar(UConverter * converter, + const char **source, + const char * sourceLimit, + UErrorCode * err); + +/** + * Convert from one external charset to another using two existing UConverters. + * Internally, two conversions - ucnv_toUnicode() and ucnv_fromUnicode() - + * are used, "pivoting" through 16-bit Unicode. + * + * Important: For streaming conversion (multiple function calls for successive + * parts of a text stream), the caller must provide a pivot buffer explicitly, + * and must preserve the pivot buffer and associated pointers from one + * call to another. (The buffer may be moved if its contents and the relative + * pointer positions are preserved.) + * + * There is a similar function, ucnv_convert(), + * which has the following limitations: + * - it takes charset names, not converter objects, so that + * - two converters are opened for each call + * - only single-string conversion is possible, not streaming operation + * - it does not provide enough information to find out, + * in case of failure, whether the toUnicode or + * the fromUnicode conversion failed + * + * By contrast, ucnv_convertEx() + * - takes UConverter parameters instead of charset names + * - fully exposes the pivot buffer for streaming conversion and complete error handling + * + * ucnv_convertEx() also provides further convenience: + * - an option to reset the converters at the beginning + * (if reset==TRUE, see parameters; + * also sets *pivotTarget=*pivotSource=pivotStart) + * - allow NUL-terminated input + * (only a single NUL byte, will not work for charsets with multi-byte NULs) + * (if sourceLimit==NULL, see parameters) + * - terminate with a NUL on output + * (only a single NUL byte, not useful for charsets with multi-byte NULs), + * or set U_STRING_NOT_TERMINATED_WARNING if the output exactly fills + * the target buffer + * - the pivot buffer can be provided internally; + * possible only for whole-string conversion, not streaming conversion; + * in this case, the caller will not be able to get details about where an + * error occurred + * (if pivotStart==NULL, see below) + * + * The function returns when one of the following is true: + * - the entire source text has been converted successfully to the target buffer + * - a target buffer overflow occurred (U_BUFFER_OVERFLOW_ERROR) + * - a conversion error occurred + * (other U_FAILURE(), see description of pErrorCode) + * + * Limitation compared to the direct use of + * ucnv_fromUnicode() and ucnv_toUnicode(): + * ucnv_convertEx() does not provide offset information. + * + * Limitation compared to ucnv_fromUChars() and ucnv_toUChars(): + * ucnv_convertEx() does not support preflighting directly. + * + * Sample code for converting a single string from + * one external charset to UTF-8, ignoring the location of errors: + * + * \code + * int32_t + * myToUTF8(UConverter *cnv, + * const char *s, int32_t length, + * char *u8, int32_t capacity, + * UErrorCode *pErrorCode) { + * UConverter *utf8Cnv; + * char *target; + * + * if(U_FAILURE(*pErrorCode)) { + * return 0; + * } + * + * utf8Cnv=myGetCachedUTF8Converter(pErrorCode); + * if(U_FAILURE(*pErrorCode)) { + * return 0; + * } + * + * if(length<0) { + * length=strlen(s); + * } + * target=u8; + * ucnv_convertEx(utf8Cnv, cnv, + * &target, u8+capacity, + * &s, s+length, + * NULL, NULL, NULL, NULL, + * TRUE, TRUE, + * pErrorCode); + * + * myReleaseCachedUTF8Converter(utf8Cnv); + * + * // return the output string length, but without preflighting + * return (int32_t)(target-u8); + * } + * \endcode + * + * @param targetCnv Output converter, used to convert from the UTF-16 pivot + * to the target using ucnv_fromUnicode(). + * @param sourceCnv Input converter, used to convert from the source to + * the UTF-16 pivot using ucnv_toUnicode(). + * @param target I/O parameter, same as for ucnv_fromUChars(). + * Input: *target points to the beginning of the target buffer. + * Output: *target points to the first unit after the last char written. + * @param targetLimit Pointer to the first unit after the target buffer. + * @param source I/O parameter, same as for ucnv_toUChars(). + * Input: *source points to the beginning of the source buffer. + * Output: *source points to the first unit after the last char read. + * @param sourceLimit Pointer to the first unit after the source buffer. + * @param pivotStart Pointer to the UTF-16 pivot buffer. If pivotStart==NULL, + * then an internal buffer is used and the other pivot + * arguments are ignored and can be NULL as well. + * @param pivotSource I/O parameter, same as source in ucnv_fromUChars() for + * conversion from the pivot buffer to the target buffer. + * @param pivotTarget I/O parameter, same as target in ucnv_toUChars() for + * conversion from the source buffer to the pivot buffer. + * It must be pivotStart<=*pivotSource<=*pivotTarget<=pivotLimit + * and pivotStart[0..ucnv_countAvaiable()]) + * @return a pointer a string (library owned), or NULL if the index is out of bounds. + * @see ucnv_countAvailable + * @stable ICU 2.0 + */ +U_STABLE const char* U_EXPORT2 +ucnv_getAvailableName(int32_t n); + +/** + * Returns a UEnumeration to enumerate all of the canonical converter + * names, as per the alias file, regardless of the ability to open each + * converter. + * + * @return A UEnumeration object for getting all the recognized canonical + * converter names. + * @see ucnv_getAvailableName + * @see uenum_close + * @see uenum_next + * @stable ICU 2.4 + */ +U_STABLE UEnumeration * U_EXPORT2 +ucnv_openAllNames(UErrorCode *pErrorCode); + +/** + * Gives the number of aliases for a given converter or alias name. + * If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. + * This method only enumerates the listed entries in the alias file. + * @param alias alias name + * @param pErrorCode error status + * @return number of names on alias list for given alias + * @stable ICU 2.0 + */ +U_STABLE uint16_t U_EXPORT2 +ucnv_countAliases(const char *alias, UErrorCode *pErrorCode); + +/** + * Gives the name of the alias at given index of alias list. + * This method only enumerates the listed entries in the alias file. + * If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. + * @param alias alias name + * @param n index in alias list + * @param pErrorCode result of operation + * @return returns the name of the alias at given index + * @see ucnv_countAliases + * @stable ICU 2.0 + */ +U_STABLE const char * U_EXPORT2 +ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode); + +/** + * Fill-up the list of alias names for the given alias. + * This method only enumerates the listed entries in the alias file. + * If the alias is ambiguous, then the preferred converter is used + * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. + * @param alias alias name + * @param aliases fill-in list, aliases is a pointer to an array of + * ucnv_countAliases() string-pointers + * (const char *) that will be filled in. + * The strings themselves are owned by the library. + * @param pErrorCode result of operation + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode); + +/** + * Return a new UEnumeration object for enumerating all the + * alias names for a given converter that are recognized by a standard. + * This method only enumerates the listed entries in the alias file. + * The convrtrs.txt file can be modified to change the results of + * this function. + * The first result in this list is the same result given by + * ucnv_getStandardName, which is the default alias for + * the specified standard name. The returned object must be closed with + * uenum_close when you are done with the object. + * + * @param convName original converter name + * @param standard name of the standard governing the names; MIME and IANA + * are such standards + * @param pErrorCode The error code + * @return A UEnumeration object for getting all aliases that are recognized + * by a standard. If any of the parameters are invalid, NULL + * is returned. + * @see ucnv_getStandardName + * @see uenum_close + * @see uenum_next + * @stable ICU 2.2 + */ +U_STABLE UEnumeration * U_EXPORT2 +ucnv_openStandardNames(const char *convName, + const char *standard, + UErrorCode *pErrorCode); + +/** + * Gives the number of standards associated to converter names. + * @return number of standards + * @stable ICU 2.0 + */ +U_STABLE uint16_t U_EXPORT2 +ucnv_countStandards(void); + +/** + * Gives the name of the standard at given index of standard list. + * @param n index in standard list + * @param pErrorCode result of operation + * @return returns the name of the standard at given index. Owned by the library. + * @stable ICU 2.0 + */ +U_STABLE const char * U_EXPORT2 +ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode); + +/** + * Returns a standard name for a given converter name. + *

+ * Example alias table:
+ * conv alias1 { STANDARD1 } alias2 { STANDARD1* } + *

+ * Result of ucnv_getStandardName("conv", "STANDARD1") from example + * alias table:
+ * "alias2" + * + * @param name original converter name + * @param standard name of the standard governing the names; MIME and IANA + * are such standards + * @param pErrorCode result of operation + * @return returns the standard converter name; + * if a standard converter name cannot be determined, + * then NULL is returned. Owned by the library. + * @stable ICU 2.0 + */ +U_STABLE const char * U_EXPORT2 +ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode); + +/** + * This function will return the internal canonical converter name of the + * tagged alias. This is the opposite of ucnv_openStandardNames, which + * returns the tagged alias given the canonical name. + *

+ * Example alias table:
+ * conv alias1 { STANDARD1 } alias2 { STANDARD1* } + *

+ * Result of ucnv_getStandardName("alias1", "STANDARD1") from example + * alias table:
+ * "conv" + * + * @return returns the canonical converter name; + * if a standard or alias name cannot be determined, + * then NULL is returned. The returned string is + * owned by the library. + * @see ucnv_getStandardName + * @stable ICU 2.4 + */ +U_STABLE const char * U_EXPORT2 +ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode); + +/** + * Returns the current default converter name. If you want to open + * a default converter, you do not need to use this function. + * It is faster if you pass a NULL argument to ucnv_open the + * default converter. + * + * If U_CHARSET_IS_UTF8 is defined to 1 in utypes.h then this function + * always returns "UTF-8". + * + * @return returns the current default converter name. + * Storage owned by the library + * @see ucnv_setDefaultName + * @stable ICU 2.0 + */ +U_STABLE const char * U_EXPORT2 +ucnv_getDefaultName(void); + +#ifndef U_HIDE_SYSTEM_API +/** + * This function is not thread safe. DO NOT call this function when ANY ICU + * function is being used from more than one thread! This function sets the + * current default converter name. If this function needs to be called, it + * should be called during application initialization. Most of the time, the + * results from ucnv_getDefaultName() or ucnv_open with a NULL string argument + * is sufficient for your application. + * + * If U_CHARSET_IS_UTF8 is defined to 1 in utypes.h then this function + * does nothing. + * + * @param name the converter name to be the default (must be known by ICU). + * @see ucnv_getDefaultName + * @system + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucnv_setDefaultName(const char *name); +#endif /* U_HIDE_SYSTEM_API */ + +/** + * Fixes the backslash character mismapping. For example, in SJIS, the backslash + * character in the ASCII portion is also used to represent the yen currency sign. + * When mapping from Unicode character 0x005C, it's unclear whether to map the + * character back to yen or backslash in SJIS. This function will take the input + * buffer and replace all the yen sign characters with backslash. This is necessary + * when the user tries to open a file with the input buffer on Windows. + * This function will test the converter to see whether such mapping is + * required. You can sometimes avoid using this function by using the correct version + * of Shift-JIS. + * + * @param cnv The converter representing the target codepage. + * @param source the input buffer to be fixed + * @param sourceLen the length of the input buffer + * @see ucnv_isAmbiguous + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen); + +/** + * Determines if the converter contains ambiguous mappings of the same + * character or not. + * @param cnv the converter to be tested + * @return TRUE if the converter contains ambiguous mapping of the same + * character, FALSE otherwise. + * @stable ICU 2.0 + */ +U_STABLE UBool U_EXPORT2 +ucnv_isAmbiguous(const UConverter *cnv); + +/** + * Sets the converter to use fallback mappings or not. + * Regardless of this flag, the converter will always use + * fallbacks from Unicode Private Use code points, as well as + * reverse fallbacks (to Unicode). + * For details see ".ucm File Format" + * in the Conversion Data chapter of the ICU User Guide: + * http://www.icu-project.org/userguide/conversion-data.html#ucmformat + * + * @param cnv The converter to set the fallback mapping usage on. + * @param usesFallback TRUE if the user wants the converter to take advantage of the fallback + * mapping, FALSE otherwise. + * @stable ICU 2.0 + * @see ucnv_usesFallback + */ +U_STABLE void U_EXPORT2 +ucnv_setFallback(UConverter *cnv, UBool usesFallback); + +/** + * Determines if the converter uses fallback mappings or not. + * This flag has restrictions, see ucnv_setFallback(). + * + * @param cnv The converter to be tested + * @return TRUE if the converter uses fallback, FALSE otherwise. + * @stable ICU 2.0 + * @see ucnv_setFallback + */ +U_STABLE UBool U_EXPORT2 +ucnv_usesFallback(const UConverter *cnv); + +/** + * Detects Unicode signature byte sequences at the start of the byte stream + * and returns the charset name of the indicated Unicode charset. + * NULL is returned when no Unicode signature is recognized. + * The number of bytes in the signature is output as well. + * + * The caller can ucnv_open() a converter using the charset name. + * The first code unit (UChar) from the start of the stream will be U+FEFF + * (the Unicode BOM/signature character) and can usually be ignored. + * + * For most Unicode charsets it is also possible to ignore the indicated + * number of initial stream bytes and start converting after them. + * However, there are stateful Unicode charsets (UTF-7 and BOCU-1) for which + * this will not work. Therefore, it is best to ignore the first output UChar + * instead of the input signature bytes. + *

+ * Usage: + * \snippet samples/ucnv/convsamp.cpp ucnv_detectUnicodeSignature + * + * @param source The source string in which the signature should be detected. + * @param sourceLength Length of the input string, or -1 if terminated with a NUL byte. + * @param signatureLength A pointer to int32_t to receive the number of bytes that make up the signature + * of the detected UTF. 0 if not detected. + * Can be a NULL pointer. + * @param pErrorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return The name of the encoding detected. NULL if encoding is not detected. + * @stable ICU 2.4 + */ +U_STABLE const char* U_EXPORT2 +ucnv_detectUnicodeSignature(const char* source, + int32_t sourceLength, + int32_t *signatureLength, + UErrorCode *pErrorCode); + +/** + * Returns the number of UChars held in the converter's internal state + * because more input is needed for completing the conversion. This function is + * useful for mapping semantics of ICU's converter interface to those of iconv, + * and this information is not needed for normal conversion. + * @param cnv The converter in which the input is held + * @param status ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return The number of UChars in the state. -1 if an error is encountered. + * @stable ICU 3.4 + */ +U_STABLE int32_t U_EXPORT2 +ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status); + +/** + * Returns the number of chars held in the converter's internal state + * because more input is needed for completing the conversion. This function is + * useful for mapping semantics of ICU's converter interface to those of iconv, + * and this information is not needed for normal conversion. + * @param cnv The converter in which the input is held as internal state + * @param status ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return The number of chars in the state. -1 if an error is encountered. + * @stable ICU 3.4 + */ +U_STABLE int32_t U_EXPORT2 +ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status); + +/** + * Returns whether or not the charset of the converter has a fixed number of bytes + * per charset character. + * An example of this are converters that are of the type UCNV_SBCS or UCNV_DBCS. + * Another example is UTF-32 which is always 4 bytes per character. + * A Unicode code point may be represented by more than one UTF-8 or UTF-16 code unit + * but a UTF-32 converter encodes each code point with 4 bytes. + * Note: This method is not intended to be used to determine whether the charset has a + * fixed ratio of bytes to Unicode codes units for any particular Unicode encoding form. + * FALSE is returned with the UErrorCode if error occurs or cnv is NULL. + * @param cnv The converter to be tested + * @param status ICU error code in/out paramter + * @return TRUE if the converter is fixed-width + * @stable ICU 4.8 + */ +U_STABLE UBool U_EXPORT2 +ucnv_isFixedWidth(UConverter *cnv, UErrorCode *status); + +#endif + +#endif +/*_UCNV*/ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ucnv_cb.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucnv_cb.h new file mode 100644 index 0000000..14169ed --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucnv_cb.h @@ -0,0 +1,164 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 2000-2004, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** + * ucnv_cb.h: + * External APIs for the ICU's codeset conversion library + * Helena Shih + * + * Modification History: + * + * Date Name Description + */ + +/** + * \file + * \brief C UConverter functions to aid the writers of callbacks + * + *

Callback API for UConverter

+ * + * These functions are provided here for the convenience of the callback + * writer. If you are just looking for callback functions to use, please + * see ucnv_err.h. DO NOT call these functions directly when you are + * working with converters, unless your code has been called as a callback + * via ucnv_setFromUCallback or ucnv_setToUCallback !! + * + * A note about error codes and overflow. Unlike other ICU functions, + * these functions do not expect the error status to be U_ZERO_ERROR. + * Callbacks must be much more careful about their error codes. + * The error codes used here are in/out parameters, which should be passed + * back in the callback's error parameter. + * + * For example, if you call ucnv_cbfromUWriteBytes to write data out + * to the output codepage, it may return U_BUFFER_OVERFLOW_ERROR if + * the data did not fit in the target. But this isn't a failing error, + * in fact, ucnv_cbfromUWriteBytes may be called AGAIN with the error + * status still U_BUFFER_OVERFLOW_ERROR to attempt to write further bytes, + * which will also go into the internal overflow buffers. + * + * Concerning offsets, the 'offset' parameters here are relative to the start + * of SOURCE. For example, Suppose the string "ABCD" was being converted + * from Unicode into a codepage which doesn't have a mapping for 'B'. + * 'A' will be written out correctly, but + * The FromU Callback will be called on an unassigned character for 'B'. + * At this point, this is the state of the world: + * Target: A [..] [points after A] + * Source: A B [C] D [points to C - B has been consumed] + * 0 1 2 3 + * codePoint = "B" [the unassigned codepoint] + * + * Now, suppose a callback wants to write the substitution character '?' to + * the target. It calls ucnv_cbFromUWriteBytes() to write the ?. + * It should pass ZERO as the offset, because the offset as far as the + * callback is concerned is relative to the SOURCE pointer [which points + * before 'C'.] If the callback goes into the args and consumes 'C' also, + * it would call FromUWriteBytes with an offset of 1 (and advance the source + * pointer). + * + */ + +#ifndef UCNV_CB_H +#define UCNV_CB_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_CONVERSION + +#include "unicode/ucnv.h" +#include "unicode/ucnv_err.h" + +/** + * ONLY used by FromU callback functions. + * Writes out the specified byte output bytes to the target byte buffer or to converter internal buffers. + * + * @param args callback fromUnicode arguments + * @param source source bytes to write + * @param length length of bytes to write + * @param offsetIndex the relative offset index from callback. + * @param err error status. If U_BUFFER_OVERFLOW is returned, then U_BUFFER_OVERFLOW must + * be returned to the user, because it means that not all data could be written into the target buffer, and some is + * in the converter error buffer. + * @see ucnv_cbFromUWriteSub + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucnv_cbFromUWriteBytes (UConverterFromUnicodeArgs *args, + const char* source, + int32_t length, + int32_t offsetIndex, + UErrorCode * err); + +/** + * ONLY used by FromU callback functions. + * This function will write out the correct substitution character sequence + * to the target. + * + * @param args callback fromUnicode arguments + * @param offsetIndex the relative offset index from the current source pointer to be used + * @param err error status. If U_BUFFER_OVERFLOW is returned, then U_BUFFER_OVERFLOW must + * be returned to the user, because it means that not all data could be written into the target buffer, and some is + * in the converter error buffer. + * @see ucnv_cbFromUWriteBytes + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucnv_cbFromUWriteSub (UConverterFromUnicodeArgs *args, + int32_t offsetIndex, + UErrorCode * err); + +/** + * ONLY used by fromU callback functions. + * This function will write out the error character(s) to the target UChar buffer. + * + * @param args callback fromUnicode arguments + * @param source pointer to pointer to first UChar to write [on exit: 1 after last UChar processed] + * @param sourceLimit pointer after last UChar to write + * @param offsetIndex the relative offset index from callback which will be set + * @param err error status U_BUFFER_OVERFLOW + * @see ucnv_cbToUWriteSub + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 ucnv_cbFromUWriteUChars(UConverterFromUnicodeArgs *args, + const UChar** source, + const UChar* sourceLimit, + int32_t offsetIndex, + UErrorCode * err); + +/** + * ONLY used by ToU callback functions. + * This function will write out the specified characters to the target + * UChar buffer. + * + * @param args callback toUnicode arguments + * @param source source string to write + * @param length the length of source string + * @param offsetIndex the relative offset index which will be written. + * @param err error status U_BUFFER_OVERFLOW + * @see ucnv_cbToUWriteSub + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 ucnv_cbToUWriteUChars (UConverterToUnicodeArgs *args, + const UChar* source, + int32_t length, + int32_t offsetIndex, + UErrorCode * err); + +/** + * ONLY used by ToU callback functions. + * This function will write out the Unicode substitution character (U+FFFD). + * + * @param args callback fromUnicode arguments + * @param offsetIndex the relative offset index from callback. + * @param err error status U_BUFFER_OVERFLOW + * @see ucnv_cbToUWriteUChars + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 ucnv_cbToUWriteSub (UConverterToUnicodeArgs *args, + int32_t offsetIndex, + UErrorCode * err); +#endif + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ucnv_err.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucnv_err.h new file mode 100644 index 0000000..2f74754 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucnv_err.h @@ -0,0 +1,465 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2009, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** + * + * + * ucnv_err.h: + */ + +/** + * \file + * \brief C UConverter predefined error callbacks + * + *

Error Behaviour Functions

+ * Defines some error behaviour functions called by ucnv_{from,to}Unicode + * These are provided as part of ICU and many are stable, but they + * can also be considered only as an example of what can be done with + * callbacks. You may of course write your own. + * + * If you want to write your own, you may also find the functions from + * ucnv_cb.h useful when writing your own callbacks. + * + * These functions, although public, should NEVER be called directly. + * They should be used as parameters to the ucnv_setFromUCallback + * and ucnv_setToUCallback functions, to set the behaviour of a converter + * when it encounters ILLEGAL/UNMAPPED/INVALID sequences. + * + * usage example: 'STOP' doesn't need any context, but newContext + * could be set to something other than 'NULL' if needed. The available + * contexts in this header can modify the default behavior of the callback. + * + * \code + * UErrorCode err = U_ZERO_ERROR; + * UConverter *myConverter = ucnv_open("ibm-949", &err); + * const void *oldContext; + * UConverterFromUCallback oldAction; + * + * + * if (U_SUCCESS(err)) + * { + * ucnv_setFromUCallBack(myConverter, + * UCNV_FROM_U_CALLBACK_STOP, + * NULL, + * &oldAction, + * &oldContext, + * &status); + * } + * \endcode + * + * The code above tells "myConverter" to stop when it encounters an + * ILLEGAL/TRUNCATED/INVALID sequences when it is used to convert from + * Unicode -> Codepage. The behavior from Codepage to Unicode is not changed, + * and ucnv_setToUCallBack would need to be called in order to change + * that behavior too. + * + * Here is an example with a context: + * + * \code + * UErrorCode err = U_ZERO_ERROR; + * UConverter *myConverter = ucnv_open("ibm-949", &err); + * const void *oldContext; + * UConverterFromUCallback oldAction; + * + * + * if (U_SUCCESS(err)) + * { + * ucnv_setToUCallBack(myConverter, + * UCNV_TO_U_CALLBACK_SUBSTITUTE, + * UCNV_SUB_STOP_ON_ILLEGAL, + * &oldAction, + * &oldContext, + * &status); + * } + * \endcode + * + * The code above tells "myConverter" to stop when it encounters an + * ILLEGAL/TRUNCATED/INVALID sequences when it is used to convert from + * Codepage -> Unicode. Any unmapped and legal characters will be + * substituted to be the default substitution character. + */ + +#ifndef UCNV_ERR_H +#define UCNV_ERR_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_CONVERSION + +/** Forward declaring the UConverter structure. @stable ICU 2.0 */ +struct UConverter; + +/** @stable ICU 2.0 */ +typedef struct UConverter UConverter; + +/** + * FROM_U, TO_U context options for sub callback + * @stable ICU 2.0 + */ +#define UCNV_SUB_STOP_ON_ILLEGAL "i" + +/** + * FROM_U, TO_U context options for skip callback + * @stable ICU 2.0 + */ +#define UCNV_SKIP_STOP_ON_ILLEGAL "i" + +/** + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to ICU (%UXXXX) + * @stable ICU 2.0 + */ +#define UCNV_ESCAPE_ICU NULL +/** + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to JAVA (\\uXXXX) + * @stable ICU 2.0 + */ +#define UCNV_ESCAPE_JAVA "J" +/** + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to C (\\uXXXX \\UXXXXXXXX) + * TO_U_CALLBACK_ESCAPE option to escape the character value accoding to C (\\xXXXX) + * @stable ICU 2.0 + */ +#define UCNV_ESCAPE_C "C" +/** + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Decimal escape \htmlonly(&#DDDD;)\endhtmlonly + * TO_U_CALLBACK_ESCAPE context option to escape the character value accoding to XML Decimal escape \htmlonly(&#DDDD;)\endhtmlonly + * @stable ICU 2.0 + */ +#define UCNV_ESCAPE_XML_DEC "D" +/** + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Hex escape \htmlonly(&#xXXXX;)\endhtmlonly + * TO_U_CALLBACK_ESCAPE context option to escape the character value accoding to XML Hex escape \htmlonly(&#xXXXX;)\endhtmlonly + * @stable ICU 2.0 + */ +#define UCNV_ESCAPE_XML_HEX "X" +/** + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to Unicode (U+XXXXX) + * @stable ICU 2.0 + */ +#define UCNV_ESCAPE_UNICODE "U" + +/** + * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to CSS2 conventions (\\HH..H, that is, + * a backslash, 1..6 hex digits, and a space) + * @stable ICU 4.0 + */ +#define UCNV_ESCAPE_CSS2 "S" + +/** + * The process condition code to be used with the callbacks. + * Codes which are greater than UCNV_IRREGULAR should be + * passed on to any chained callbacks. + * @stable ICU 2.0 + */ +typedef enum { + UCNV_UNASSIGNED = 0, /**< The code point is unassigned. + The error code U_INVALID_CHAR_FOUND will be set. */ + UCNV_ILLEGAL = 1, /**< The code point is illegal. For example, + \\x81\\x2E is illegal in SJIS because \\x2E + is not a valid trail byte for the \\x81 + lead byte. + Also, starting with Unicode 3.0.1, non-shortest byte sequences + in UTF-8 (like \\xC1\\xA1 instead of \\x61 for U+0061) + are also illegal, not just irregular. + The error code U_ILLEGAL_CHAR_FOUND will be set. */ + UCNV_IRREGULAR = 2, /**< The codepoint is not a regular sequence in + the encoding. For example, \\xED\\xA0\\x80..\\xED\\xBF\\xBF + are irregular UTF-8 byte sequences for single surrogate + code points. + The error code U_INVALID_CHAR_FOUND will be set. */ + UCNV_RESET = 3, /**< The callback is called with this reason when a + 'reset' has occured. Callback should reset all + state. */ + UCNV_CLOSE = 4, /**< Called when the converter is closed. The + callback should release any allocated memory.*/ + UCNV_CLONE = 5 /**< Called when ucnv_safeClone() is called on the + converter. the pointer available as the + 'context' is an alias to the original converters' + context pointer. If the context must be owned + by the new converter, the callback must clone + the data and call ucnv_setFromUCallback + (or setToUCallback) with the correct pointer. + @stable ICU 2.2 + */ +} UConverterCallbackReason; + + +/** + * The structure for the fromUnicode callback function parameter. + * @stable ICU 2.0 + */ +typedef struct { + uint16_t size; /**< The size of this struct. @stable ICU 2.0 */ + UBool flush; /**< The internal state of converter will be reset and data flushed if set to TRUE. @stable ICU 2.0 */ + UConverter *converter; /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0 */ + const UChar *source; /**< Pointer to the source source buffer. @stable ICU 2.0 */ + const UChar *sourceLimit; /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0 */ + char *target; /**< Pointer to the target buffer. @stable ICU 2.0 */ + const char *targetLimit; /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0 */ + int32_t *offsets; /**< Pointer to the buffer that recieves the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */ +} UConverterFromUnicodeArgs; + + +/** + * The structure for the toUnicode callback function parameter. + * @stable ICU 2.0 + */ +typedef struct { + uint16_t size; /**< The size of this struct @stable ICU 2.0 */ + UBool flush; /**< The internal state of converter will be reset and data flushed if set to TRUE. @stable ICU 2.0 */ + UConverter *converter; /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0 */ + const char *source; /**< Pointer to the source source buffer. @stable ICU 2.0 */ + const char *sourceLimit; /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0 */ + UChar *target; /**< Pointer to the target buffer. @stable ICU 2.0 */ + const UChar *targetLimit; /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0 */ + int32_t *offsets; /**< Pointer to the buffer that recieves the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */ +} UConverterToUnicodeArgs; + + +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This From Unicode callback STOPS at the ILLEGAL_SEQUENCE, + * returning the error code back to the caller immediately. + * + * @param context Pointer to the callback's private data + * @param fromUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. + * @param reason Defines the reason the callback was invoked + * @param err This should always be set to a failure status prior to calling. + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_STOP ( + const void *context, + UConverterFromUnicodeArgs *fromUArgs, + const UChar* codeUnits, + int32_t length, + UChar32 codePoint, + UConverterCallbackReason reason, + UErrorCode * err); + + + +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This To Unicode callback STOPS at the ILLEGAL_SEQUENCE, + * returning the error code back to the caller immediately. + * + * @param context Pointer to the callback's private data + * @param toUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' bytes of the concerned codepage sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param reason Defines the reason the callback was invoked + * @param err This should always be set to a failure status prior to calling. + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_STOP ( + const void *context, + UConverterToUnicodeArgs *toUArgs, + const char* codeUnits, + int32_t length, + UConverterCallbackReason reason, + UErrorCode * err); + +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This From Unicode callback skips any ILLEGAL_SEQUENCE, or + * skips only UNASSINGED_SEQUENCE depending on the context parameter + * simply ignoring those characters. + * + * @param context The function currently recognizes the callback options: + * UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE, + * returning the error code back to the caller immediately. + * NULL: Skips any ILLEGAL_SEQUENCE + * @param fromUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. + * @param reason Defines the reason the callback was invoked + * @param err Return value will be set to success if the callback was handled, + * otherwise this value will be set to a failure status. + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SKIP ( + const void *context, + UConverterFromUnicodeArgs *fromUArgs, + const UChar* codeUnits, + int32_t length, + UChar32 codePoint, + UConverterCallbackReason reason, + UErrorCode * err); + +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This From Unicode callback will Substitute the ILLEGAL SEQUENCE, or + * UNASSIGNED_SEQUENCE depending on context parameter, with the + * current substitution string for the converter. This is the default + * callback. + * + * @param context The function currently recognizes the callback options: + * UCNV_SUB_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE, + * returning the error code back to the caller immediately. + * NULL: Substitutes any ILLEGAL_SEQUENCE + * @param fromUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. + * @param reason Defines the reason the callback was invoked + * @param err Return value will be set to success if the callback was handled, + * otherwise this value will be set to a failure status. + * @see ucnv_setSubstChars + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SUBSTITUTE ( + const void *context, + UConverterFromUnicodeArgs *fromUArgs, + const UChar* codeUnits, + int32_t length, + UChar32 codePoint, + UConverterCallbackReason reason, + UErrorCode * err); + +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This From Unicode callback will Substitute the ILLEGAL SEQUENCE with the + * hexadecimal representation of the illegal codepoints + * + * @param context The function currently recognizes the callback options: + *
    + *
  • UCNV_ESCAPE_ICU: Substitues the ILLEGAL SEQUENCE with the hexadecimal + * representation in the format %UXXXX, e.g. "%uFFFE%u00AC%uC8FE"). + * In the Event the converter doesn't support the characters {%,U}[A-F][0-9], + * it will substitute the illegal sequence with the substitution characters. + * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as + * %UD84D%UDC56
  • + *
  • UCNV_ESCAPE_JAVA: Substitues the ILLEGAL SEQUENCE with the hexadecimal + * representation in the format \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE"). + * In the Event the converter doesn't support the characters {\,u}[A-F][0-9], + * it will substitute the illegal sequence with the substitution characters. + * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as + * \\uD84D\\uDC56
  • + *
  • UCNV_ESCAPE_C: Substitues the ILLEGAL SEQUENCE with the hexadecimal + * representation in the format \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE"). + * In the Event the converter doesn't support the characters {\,u,U}[A-F][0-9], + * it will substitute the illegal sequence with the substitution characters. + * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as + * \\U00023456
  • + *
  • UCNV_ESCAPE_XML_DEC: Substitues the ILLEGAL SEQUENCE with the decimal + * representation in the format \htmlonly&#DDDDDDDD;, e.g. "&#65534;&#172;&#51454;")\endhtmlonly. + * In the Event the converter doesn't support the characters {&,#}[0-9], + * it will substitute the illegal sequence with the substitution characters. + * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as + * &#144470; and Zero padding is ignored.
  • + *
  • UCNV_ESCAPE_XML_HEX:Substitues the ILLEGAL SEQUENCE with the decimal + * representation in the format \htmlonly&#xXXXX; e.g. "&#xFFFE;&#x00AC;&#xC8FE;")\endhtmlonly. + * In the Event the converter doesn't support the characters {&,#,x}[0-9], + * it will substitute the illegal sequence with the substitution characters. + * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as + * \htmlonly&#x23456;\endhtmlonly
  • + *
+ * @param fromUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. + * @param reason Defines the reason the callback was invoked + * @param err Return value will be set to success if the callback was handled, + * otherwise this value will be set to a failure status. + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_ESCAPE ( + const void *context, + UConverterFromUnicodeArgs *fromUArgs, + const UChar* codeUnits, + int32_t length, + UChar32 codePoint, + UConverterCallbackReason reason, + UErrorCode * err); + + +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This To Unicode callback skips any ILLEGAL_SEQUENCE, or + * skips only UNASSINGED_SEQUENCE depending on the context parameter + * simply ignoring those characters. + * + * @param context The function currently recognizes the callback options: + * UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE, + * returning the error code back to the caller immediately. + * NULL: Skips any ILLEGAL_SEQUENCE + * @param toUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' bytes of the concerned codepage sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param reason Defines the reason the callback was invoked + * @param err Return value will be set to success if the callback was handled, + * otherwise this value will be set to a failure status. + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_SKIP ( + const void *context, + UConverterToUnicodeArgs *toUArgs, + const char* codeUnits, + int32_t length, + UConverterCallbackReason reason, + UErrorCode * err); + +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This To Unicode callback will Substitute the ILLEGAL SEQUENCE,or + * UNASSIGNED_SEQUENCE depending on context parameter, with the + * Unicode substitution character, U+FFFD. + * + * @param context The function currently recognizes the callback options: + * UCNV_SUB_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE, + * returning the error code back to the caller immediately. + * NULL: Substitutes any ILLEGAL_SEQUENCE + * @param toUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' bytes of the concerned codepage sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param reason Defines the reason the callback was invoked + * @param err Return value will be set to success if the callback was handled, + * otherwise this value will be set to a failure status. + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_SUBSTITUTE ( + const void *context, + UConverterToUnicodeArgs *toUArgs, + const char* codeUnits, + int32_t length, + UConverterCallbackReason reason, + UErrorCode * err); + +/** + * DO NOT CALL THIS FUNCTION DIRECTLY! + * This To Unicode callback will Substitute the ILLEGAL SEQUENCE with the + * hexadecimal representation of the illegal bytes + * (in the format %XNN, e.g. "%XFF%X0A%XC8%X03"). + * + * @param context This function currently recognizes the callback options: + * UCNV_ESCAPE_ICU, UCNV_ESCAPE_JAVA, UCNV_ESCAPE_C, UCNV_ESCAPE_XML_DEC, + * UCNV_ESCAPE_XML_HEX and UCNV_ESCAPE_UNICODE. + * @param toUArgs Information about the conversion in progress + * @param codeUnits Points to 'length' bytes of the concerned codepage sequence + * @param length Size (in bytes) of the concerned codepage sequence + * @param reason Defines the reason the callback was invoked + * @param err Return value will be set to success if the callback was handled, + * otherwise this value will be set to a failure status. + * @stable ICU 2.0 + */ + +U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_ESCAPE ( + const void *context, + UConverterToUnicodeArgs *toUArgs, + const char* codeUnits, + int32_t length, + UConverterCallbackReason reason, + UErrorCode * err); + +#endif + +#endif + +/*UCNV_ERR_H*/ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ucnvsel.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucnvsel.h new file mode 100644 index 0000000..d423845 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucnvsel.h @@ -0,0 +1,189 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2008-2011, International Business Machines +* Corporation, Google and others. All Rights Reserved. +* +******************************************************************************* +*/ +/* + * Author : eldawy@google.com (Mohamed Eldawy) + * ucnvsel.h + * + * Purpose: To generate a list of encodings capable of handling + * a given Unicode text + * + * Started 09-April-2008 + */ + +#ifndef __ICU_UCNV_SEL_H__ +#define __ICU_UCNV_SEL_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_CONVERSION + +#include "unicode/uset.h" +#include "unicode/utf16.h" +#include "unicode/uenum.h" +#include "unicode/ucnv.h" +#include "unicode/localpointer.h" + +/** + * \file + * + * A converter selector is built with a set of encoding/charset names + * and given an input string returns the set of names of the + * corresponding converters which can convert the string. + * + * A converter selector can be serialized into a buffer and reopened + * from the serialized form. + */ + +/** + * @{ + * The selector data structure + */ +struct UConverterSelector; +typedef struct UConverterSelector UConverterSelector; +/** @} */ + +/** + * Open a selector. + * If converterListSize is 0, build for all available converters. + * If excludedCodePoints is NULL, don't exclude any code points. + * + * @param converterList a pointer to encoding names needed to be involved. + * Can be NULL if converterListSize==0. + * The list and the names will be cloned, and the caller + * retains ownership of the original. + * @param converterListSize number of encodings in above list. + * If 0, builds a selector for all available converters. + * @param excludedCodePoints a set of code points to be excluded from consideration. + * That is, excluded code points in a string do not change + * the selection result. (They might be handled by a callback.) + * Use NULL to exclude nothing. + * @param whichSet what converter set to use? Use this to determine whether + * to consider only roundtrip mappings or also fallbacks. + * @param status an in/out ICU UErrorCode + * @return the new selector + * + * @stable ICU 4.2 + */ +U_STABLE UConverterSelector* U_EXPORT2 +ucnvsel_open(const char* const* converterList, int32_t converterListSize, + const USet* excludedCodePoints, + const UConverterUnicodeSet whichSet, UErrorCode* status); + +/** + * Closes a selector. + * If any Enumerations were returned by ucnv_select*, they become invalid. + * They can be closed before or after calling ucnv_closeSelector, + * but should never be used after the selector is closed. + * + * @see ucnv_selectForString + * @see ucnv_selectForUTF8 + * + * @param sel selector to close + * + * @stable ICU 4.2 + */ +U_STABLE void U_EXPORT2 +ucnvsel_close(UConverterSelector *sel); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUConverterSelectorPointer + * "Smart pointer" class, closes a UConverterSelector via ucnvsel_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterSelectorPointer, UConverterSelector, ucnvsel_close); + +U_NAMESPACE_END + +#endif + +/** + * Open a selector from its serialized form. + * The buffer must remain valid and unchanged for the lifetime of the selector. + * This is much faster than creating a selector from scratch. + * Using a serialized form from a different machine (endianness/charset) is supported. + * + * @param buffer pointer to the serialized form of a converter selector; + * must be 32-bit-aligned + * @param length the capacity of this buffer (can be equal to or larger than + * the actual data length) + * @param status an in/out ICU UErrorCode + * @return the new selector + * + * @stable ICU 4.2 + */ +U_STABLE UConverterSelector* U_EXPORT2 +ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* status); + +/** + * Serialize a selector into a linear buffer. + * The serialized form is portable to different machines. + * + * @param sel selector to consider + * @param buffer pointer to 32-bit-aligned memory to be filled with the + * serialized form of this converter selector + * @param bufferCapacity the capacity of this buffer + * @param status an in/out ICU UErrorCode + * @return the required buffer capacity to hold serialize data (even if the call fails + * with a U_BUFFER_OVERFLOW_ERROR, it will return the required capacity) + * + * @stable ICU 4.2 + */ +U_STABLE int32_t U_EXPORT2 +ucnvsel_serialize(const UConverterSelector* sel, + void* buffer, int32_t bufferCapacity, UErrorCode* status); + +/** + * Select converters that can map all characters in a UTF-16 string, + * ignoring the excluded code points. + * + * @param sel a selector + * @param s UTF-16 string + * @param length length of the string, or -1 if NUL-terminated + * @param status an in/out ICU UErrorCode + * @return an enumeration containing encoding names. + * The returned encoding names and their order will be the same as + * supplied when building the selector. + * + * @stable ICU 4.2 + */ +U_STABLE UEnumeration * U_EXPORT2 +ucnvsel_selectForString(const UConverterSelector* sel, + const UChar *s, int32_t length, UErrorCode *status); + +/** + * Select converters that can map all characters in a UTF-8 string, + * ignoring the excluded code points. + * + * @param sel a selector + * @param s UTF-8 string + * @param length length of the string, or -1 if NUL-terminated + * @param status an in/out ICU UErrorCode + * @return an enumeration containing encoding names. + * The returned encoding names and their order will be the same as + * supplied when building the selector. + * + * @stable ICU 4.2 + */ +U_STABLE UEnumeration * U_EXPORT2 +ucnvsel_selectForUTF8(const UConverterSelector* sel, + const char *s, int32_t length, UErrorCode *status); + +#endif /* !UCONFIG_NO_CONVERSION */ + +#endif /* __ICU_UCNV_SEL_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ucol.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucol.h new file mode 100644 index 0000000..ecabd9e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucol.h @@ -0,0 +1,1497 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (c) 1996-2015, International Business Machines Corporation and others. +* All Rights Reserved. +******************************************************************************* +*/ + +#ifndef UCOL_H +#define UCOL_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_COLLATION + +#include "unicode/unorm.h" +#include "unicode/localpointer.h" +#include "unicode/parseerr.h" +#include "unicode/uloc.h" +#include "unicode/uset.h" +#include "unicode/uscript.h" + +/** + * \file + * \brief C API: Collator + * + *

Collator C API

+ * + * The C API for Collator performs locale-sensitive + * string comparison. You use this service to build + * searching and sorting routines for natural language text. + *

+ * For more information about the collation service see + * the User Guide. + *

+ * Collation service provides correct sorting orders for most locales supported in ICU. + * If specific data for a locale is not available, the orders eventually falls back + * to the CLDR root sort order. + *

+ * Sort ordering may be customized by providing your own set of rules. For more on + * this subject see the + * Collation Customization section of the User Guide. + *

+ * @see UCollationResult + * @see UNormalizationMode + * @see UCollationStrength + * @see UCollationElements + */ + +/** A collator. +* For usage in C programs. +*/ +struct UCollator; +/** structure representing a collator object instance + * @stable ICU 2.0 + */ +typedef struct UCollator UCollator; + + +/** + * UCOL_LESS is returned if source string is compared to be less than target + * string in the ucol_strcoll() method. + * UCOL_EQUAL is returned if source string is compared to be equal to target + * string in the ucol_strcoll() method. + * UCOL_GREATER is returned if source string is compared to be greater than + * target string in the ucol_strcoll() method. + * @see ucol_strcoll() + *

+ * Possible values for a comparison result + * @stable ICU 2.0 + */ +typedef enum { + /** string a == string b */ + UCOL_EQUAL = 0, + /** string a > string b */ + UCOL_GREATER = 1, + /** string a < string b */ + UCOL_LESS = -1 +} UCollationResult ; + + +/** Enum containing attribute values for controling collation behavior. + * Here are all the allowable values. Not every attribute can take every value. The only + * universal value is UCOL_DEFAULT, which resets the attribute value to the predefined + * value for that locale + * @stable ICU 2.0 + */ +typedef enum { + /** accepted by most attributes */ + UCOL_DEFAULT = -1, + + /** Primary collation strength */ + UCOL_PRIMARY = 0, + /** Secondary collation strength */ + UCOL_SECONDARY = 1, + /** Tertiary collation strength */ + UCOL_TERTIARY = 2, + /** Default collation strength */ + UCOL_DEFAULT_STRENGTH = UCOL_TERTIARY, + UCOL_CE_STRENGTH_LIMIT, + /** Quaternary collation strength */ + UCOL_QUATERNARY=3, + /** Identical collation strength */ + UCOL_IDENTICAL=15, + UCOL_STRENGTH_LIMIT, + + /** Turn the feature off - works for UCOL_FRENCH_COLLATION, + UCOL_CASE_LEVEL, UCOL_HIRAGANA_QUATERNARY_MODE + & UCOL_DECOMPOSITION_MODE*/ + UCOL_OFF = 16, + /** Turn the feature on - works for UCOL_FRENCH_COLLATION, + UCOL_CASE_LEVEL, UCOL_HIRAGANA_QUATERNARY_MODE + & UCOL_DECOMPOSITION_MODE*/ + UCOL_ON = 17, + + /** Valid for UCOL_ALTERNATE_HANDLING. Alternate handling will be shifted */ + UCOL_SHIFTED = 20, + /** Valid for UCOL_ALTERNATE_HANDLING. Alternate handling will be non ignorable */ + UCOL_NON_IGNORABLE = 21, + + /** Valid for UCOL_CASE_FIRST - + lower case sorts before upper case */ + UCOL_LOWER_FIRST = 24, + /** upper case sorts before lower case */ + UCOL_UPPER_FIRST = 25, + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UColAttributeValue value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UCOL_ATTRIBUTE_VALUE_COUNT +#endif /* U_HIDE_DEPRECATED_API */ +} UColAttributeValue; + +/** + * Enum containing the codes for reordering segments of the collation table that are not script + * codes. These reordering codes are to be used in conjunction with the script codes. + * @see ucol_getReorderCodes + * @see ucol_setReorderCodes + * @see ucol_getEquivalentReorderCodes + * @see UScriptCode + * @stable ICU 4.8 + */ + typedef enum { + /** + * A special reordering code that is used to specify the default + * reordering codes for a locale. + * @stable ICU 4.8 + */ + UCOL_REORDER_CODE_DEFAULT = -1, + /** + * A special reordering code that is used to specify no reordering codes. + * @stable ICU 4.8 + */ + UCOL_REORDER_CODE_NONE = USCRIPT_UNKNOWN, + /** + * A special reordering code that is used to specify all other codes used for + * reordering except for the codes lised as UColReorderCode values and those + * listed explicitly in a reordering. + * @stable ICU 4.8 + */ + UCOL_REORDER_CODE_OTHERS = USCRIPT_UNKNOWN, + /** + * Characters with the space property. + * This is equivalent to the rule value "space". + * @stable ICU 4.8 + */ + UCOL_REORDER_CODE_SPACE = 0x1000, + /** + * The first entry in the enumeration of reordering groups. This is intended for use in + * range checking and enumeration of the reorder codes. + * @stable ICU 4.8 + */ + UCOL_REORDER_CODE_FIRST = UCOL_REORDER_CODE_SPACE, + /** + * Characters with the punctuation property. + * This is equivalent to the rule value "punct". + * @stable ICU 4.8 + */ + UCOL_REORDER_CODE_PUNCTUATION = 0x1001, + /** + * Characters with the symbol property. + * This is equivalent to the rule value "symbol". + * @stable ICU 4.8 + */ + UCOL_REORDER_CODE_SYMBOL = 0x1002, + /** + * Characters with the currency property. + * This is equivalent to the rule value "currency". + * @stable ICU 4.8 + */ + UCOL_REORDER_CODE_CURRENCY = 0x1003, + /** + * Characters with the digit property. + * This is equivalent to the rule value "digit". + * @stable ICU 4.8 + */ + UCOL_REORDER_CODE_DIGIT = 0x1004, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UColReorderCode value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UCOL_REORDER_CODE_LIMIT = 0x1005 +#endif /* U_HIDE_DEPRECATED_API */ +} UColReorderCode; + +/** + * Base letter represents a primary difference. Set comparison + * level to UCOL_PRIMARY to ignore secondary and tertiary differences. + * Use this to set the strength of a Collator object. + * Example of primary difference, "abc" < "abd" + * + * Diacritical differences on the same base letter represent a secondary + * difference. Set comparison level to UCOL_SECONDARY to ignore tertiary + * differences. Use this to set the strength of a Collator object. + * Example of secondary difference, "ä" >> "a". + * + * Uppercase and lowercase versions of the same character represents a + * tertiary difference. Set comparison level to UCOL_TERTIARY to include + * all comparison differences. Use this to set the strength of a Collator + * object. + * Example of tertiary difference, "abc" <<< "ABC". + * + * Two characters are considered "identical" when they have the same + * unicode spellings. UCOL_IDENTICAL. + * For example, "ä" == "ä". + * + * UCollationStrength is also used to determine the strength of sort keys + * generated from UCollator objects + * These values can be now found in the UColAttributeValue enum. + * @stable ICU 2.0 + **/ +typedef UColAttributeValue UCollationStrength; + +/** Attributes that collation service understands. All the attributes can take UCOL_DEFAULT + * value, as well as the values specific to each one. + * @stable ICU 2.0 + */ +typedef enum { + /** Attribute for direction of secondary weights - used in Canadian French. + * Acceptable values are UCOL_ON, which results in secondary weights + * being considered backwards and UCOL_OFF which treats secondary + * weights in the order they appear. + * @stable ICU 2.0 + */ + UCOL_FRENCH_COLLATION, + /** Attribute for handling variable elements. + * Acceptable values are UCOL_NON_IGNORABLE (default) + * which treats all the codepoints with non-ignorable + * primary weights in the same way, + * and UCOL_SHIFTED which causes codepoints with primary + * weights that are equal or below the variable top value + * to be ignored on primary level and moved to the quaternary + * level. + * @stable ICU 2.0 + */ + UCOL_ALTERNATE_HANDLING, + /** Controls the ordering of upper and lower case letters. + * Acceptable values are UCOL_OFF (default), which orders + * upper and lower case letters in accordance to their tertiary + * weights, UCOL_UPPER_FIRST which forces upper case letters to + * sort before lower case letters, and UCOL_LOWER_FIRST which does + * the opposite. + * @stable ICU 2.0 + */ + UCOL_CASE_FIRST, + /** Controls whether an extra case level (positioned before the third + * level) is generated or not. Acceptable values are UCOL_OFF (default), + * when case level is not generated, and UCOL_ON which causes the case + * level to be generated. Contents of the case level are affected by + * the value of UCOL_CASE_FIRST attribute. A simple way to ignore + * accent differences in a string is to set the strength to UCOL_PRIMARY + * and enable case level. + * @stable ICU 2.0 + */ + UCOL_CASE_LEVEL, + /** Controls whether the normalization check and necessary normalizations + * are performed. When set to UCOL_OFF (default) no normalization check + * is performed. The correctness of the result is guaranteed only if the + * input data is in so-called FCD form (see users manual for more info). + * When set to UCOL_ON, an incremental check is performed to see whether + * the input data is in the FCD form. If the data is not in the FCD form, + * incremental NFD normalization is performed. + * @stable ICU 2.0 + */ + UCOL_NORMALIZATION_MODE, + /** An alias for UCOL_NORMALIZATION_MODE attribute. + * @stable ICU 2.0 + */ + UCOL_DECOMPOSITION_MODE = UCOL_NORMALIZATION_MODE, + /** The strength attribute. Can be either UCOL_PRIMARY, UCOL_SECONDARY, + * UCOL_TERTIARY, UCOL_QUATERNARY or UCOL_IDENTICAL. The usual strength + * for most locales (except Japanese) is tertiary. + * + * Quaternary strength + * is useful when combined with shifted setting for alternate handling + * attribute and for JIS X 4061 collation, when it is used to distinguish + * between Katakana and Hiragana. + * Otherwise, quaternary level + * is affected only by the number of non-ignorable code points in + * the string. + * + * Identical strength is rarely useful, as it amounts + * to codepoints of the NFD form of the string. + * @stable ICU 2.0 + */ + UCOL_STRENGTH, +#ifndef U_HIDE_DEPRECATED_API + /** When turned on, this attribute positions Hiragana before all + * non-ignorables on quaternary level This is a sneaky way to produce JIS + * sort order. + * + * This attribute was an implementation detail of the CLDR Japanese tailoring. + * Since ICU 50, this attribute is not settable any more via API functions. + * Since CLDR 25/ICU 53, explicit quaternary relations are used + * to achieve the same Japanese sort order. + * + * @deprecated ICU 50 Implementation detail, cannot be set via API, was removed from implementation. + */ + UCOL_HIRAGANA_QUATERNARY_MODE = UCOL_STRENGTH + 1, +#endif /* U_HIDE_DEPRECATED_API */ + /** + * When turned on, this attribute makes + * substrings of digits sort according to their numeric values. + * + * This is a way to get '100' to sort AFTER '2'. Note that the longest + * digit substring that can be treated as a single unit is + * 254 digits (not counting leading zeros). If a digit substring is + * longer than that, the digits beyond the limit will be treated as a + * separate digit substring. + * + * A "digit" in this sense is a code point with General_Category=Nd, + * which does not include circled numbers, roman numerals, etc. + * Only a contiguous digit substring is considered, that is, + * non-negative integers without separators. + * There is no support for plus/minus signs, decimals, exponents, etc. + * + * @stable ICU 2.8 + */ + UCOL_NUMERIC_COLLATION = UCOL_STRENGTH + 2, + + /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API, + * it is needed for layout of RuleBasedCollator object. */ + /** + * One more than the highest normal UColAttribute value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UCOL_ATTRIBUTE_COUNT +} UColAttribute; + +/** Options for retrieving the rule string + * @stable ICU 2.0 + */ +typedef enum { + /** + * Retrieves the tailoring rules only. + * Same as calling the version of getRules() without UColRuleOption. + * @stable ICU 2.0 + */ + UCOL_TAILORING_ONLY, + /** + * Retrieves the "UCA rules" concatenated with the tailoring rules. + * The "UCA rules" are an approximation of the root collator's sort order. + * They are almost never used or useful at runtime and can be removed from the data. + * See http://userguide.icu-project.org/collation/customization#TOC-Building-on-Existing-Locales + * @stable ICU 2.0 + */ + UCOL_FULL_RULES +} UColRuleOption ; + +/** + * Open a UCollator for comparing strings. + * + * For some languages, multiple collation types are available; + * for example, "de@collation=phonebook". + * Starting with ICU 54, collation attributes can be specified via locale keywords as well, + * in the old locale extension syntax ("el@colCaseFirst=upper") + * or in language tag syntax ("el-u-kf-upper"). + * See User Guide: Collation API. + * + * The UCollator pointer is used in all the calls to the Collation + * service. After finished, collator must be disposed of by calling + * {@link #ucol_close }. + * @param loc The locale containing the required collation rules. + * Special values for locales can be passed in - + * if NULL is passed for the locale, the default locale + * collation rules will be used. If empty string ("") or + * "root" are passed, the root collator will be returned. + * @param status A pointer to a UErrorCode to receive any errors + * @return A pointer to a UCollator, or 0 if an error occurred. + * @see ucol_openRules + * @see ucol_safeClone + * @see ucol_close + * @stable ICU 2.0 + */ +U_STABLE UCollator* U_EXPORT2 +ucol_open(const char *loc, UErrorCode *status); + +/** + * Produce a UCollator instance according to the rules supplied. + * The rules are used to change the default ordering, defined in the + * UCA in a process called tailoring. The resulting UCollator pointer + * can be used in the same way as the one obtained by {@link #ucol_strcoll }. + * @param rules A string describing the collation rules. For the syntax + * of the rules please see users guide. + * @param rulesLength The length of rules, or -1 if null-terminated. + * @param normalizationMode The normalization mode: One of + * UCOL_OFF (expect the text to not need normalization), + * UCOL_ON (normalize), or + * UCOL_DEFAULT (set the mode according to the rules) + * @param strength The default collation strength; one of UCOL_PRIMARY, UCOL_SECONDARY, + * UCOL_TERTIARY, UCOL_IDENTICAL,UCOL_DEFAULT_STRENGTH - can be also set in the rules. + * @param parseError A pointer to UParseError to recieve information about errors + * occurred during parsing. This argument can currently be set + * to NULL, but at users own risk. Please provide a real structure. + * @param status A pointer to a UErrorCode to receive any errors + * @return A pointer to a UCollator. It is not guaranteed that NULL be returned in case + * of error - please use status argument to check for errors. + * @see ucol_open + * @see ucol_safeClone + * @see ucol_close + * @stable ICU 2.0 + */ +U_STABLE UCollator* U_EXPORT2 +ucol_openRules( const UChar *rules, + int32_t rulesLength, + UColAttributeValue normalizationMode, + UCollationStrength strength, + UParseError *parseError, + UErrorCode *status); + +#ifndef U_HIDE_DEPRECATED_API +/** + * Open a collator defined by a short form string. + * The structure and the syntax of the string is defined in the "Naming collators" + * section of the users guide: + * http://userguide.icu-project.org/collation/concepts#TOC-Collator-naming-scheme + * Attributes are overriden by the subsequent attributes. So, for "S2_S3", final + * strength will be 3. 3066bis locale overrides individual locale parts. + * The call to this function is equivalent to a call to ucol_open, followed by a + * series of calls to ucol_setAttribute and ucol_setVariableTop. + * @param definition A short string containing a locale and a set of attributes. + * Attributes not explicitly mentioned are left at the default + * state for a locale. + * @param parseError if not NULL, structure that will get filled with error's pre + * and post context in case of error. + * @param forceDefaults if FALSE, the settings that are the same as the collator + * default settings will not be applied (for example, setting + * French secondary on a French collator would not be executed). + * If TRUE, all the settings will be applied regardless of the + * collator default value. If the definition + * strings are to be cached, should be set to FALSE. + * @param status Error code. Apart from regular error conditions connected to + * instantiating collators (like out of memory or similar), this + * API will return an error if an invalid attribute or attribute/value + * combination is specified. + * @return A pointer to a UCollator or 0 if an error occured (including an + * invalid attribute). + * @see ucol_open + * @see ucol_setAttribute + * @see ucol_setVariableTop + * @see ucol_getShortDefinitionString + * @see ucol_normalizeShortDefinitionString + * @deprecated ICU 54 Use ucol_open() with language tag collation keywords instead. + */ +U_DEPRECATED UCollator* U_EXPORT2 +ucol_openFromShortString( const char *definition, + UBool forceDefaults, + UParseError *parseError, + UErrorCode *status); +#endif /* U_HIDE_DEPRECATED_API */ + +#ifndef U_HIDE_DEPRECATED_API +/** + * Get a set containing the contractions defined by the collator. The set includes + * both the root collator's contractions and the contractions defined by the collator. This set + * will contain only strings. If a tailoring explicitly suppresses contractions from + * the root collator (like Russian), removed contractions will not be in the resulting set. + * @param coll collator + * @param conts the set to hold the result. It gets emptied before + * contractions are added. + * @param status to hold the error code + * @return the size of the contraction set + * + * @deprecated ICU 3.4, use ucol_getContractionsAndExpansions instead + */ +U_DEPRECATED int32_t U_EXPORT2 +ucol_getContractions( const UCollator *coll, + USet *conts, + UErrorCode *status); +#endif /* U_HIDE_DEPRECATED_API */ + +/** + * Get a set containing the expansions defined by the collator. The set includes + * both the root collator's expansions and the expansions defined by the tailoring + * @param coll collator + * @param contractions if not NULL, the set to hold the contractions + * @param expansions if not NULL, the set to hold the expansions + * @param addPrefixes add the prefix contextual elements to contractions + * @param status to hold the error code + * + * @stable ICU 3.4 + */ +U_STABLE void U_EXPORT2 +ucol_getContractionsAndExpansions( const UCollator *coll, + USet *contractions, USet *expansions, + UBool addPrefixes, UErrorCode *status); + +/** + * Close a UCollator. + * Once closed, a UCollator should not be used. Every open collator should + * be closed. Otherwise, a memory leak will result. + * @param coll The UCollator to close. + * @see ucol_open + * @see ucol_openRules + * @see ucol_safeClone + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucol_close(UCollator *coll); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUCollatorPointer + * "Smart pointer" class, closes a UCollator via ucol_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUCollatorPointer, UCollator, ucol_close); + +U_NAMESPACE_END + +#endif + +/** + * Compare two strings. + * The strings will be compared using the options already specified. + * @param coll The UCollator containing the comparison rules. + * @param source The source string. + * @param sourceLength The length of source, or -1 if null-terminated. + * @param target The target string. + * @param targetLength The length of target, or -1 if null-terminated. + * @return The result of comparing the strings; one of UCOL_EQUAL, + * UCOL_GREATER, UCOL_LESS + * @see ucol_greater + * @see ucol_greaterOrEqual + * @see ucol_equal + * @stable ICU 2.0 + */ +U_STABLE UCollationResult U_EXPORT2 +ucol_strcoll( const UCollator *coll, + const UChar *source, + int32_t sourceLength, + const UChar *target, + int32_t targetLength); + +/** +* Compare two strings in UTF-8. +* The strings will be compared using the options already specified. +* Note: When input string contains malformed a UTF-8 byte sequence, +* this function treats these bytes as REPLACEMENT CHARACTER (U+FFFD). +* @param coll The UCollator containing the comparison rules. +* @param source The source UTF-8 string. +* @param sourceLength The length of source, or -1 if null-terminated. +* @param target The target UTF-8 string. +* @param targetLength The length of target, or -1 if null-terminated. +* @param status A pointer to a UErrorCode to receive any errors +* @return The result of comparing the strings; one of UCOL_EQUAL, +* UCOL_GREATER, UCOL_LESS +* @see ucol_greater +* @see ucol_greaterOrEqual +* @see ucol_equal +* @stable ICU 50 +*/ +U_STABLE UCollationResult U_EXPORT2 +ucol_strcollUTF8( + const UCollator *coll, + const char *source, + int32_t sourceLength, + const char *target, + int32_t targetLength, + UErrorCode *status); + +/** + * Determine if one string is greater than another. + * This function is equivalent to {@link #ucol_strcoll } == UCOL_GREATER + * @param coll The UCollator containing the comparison rules. + * @param source The source string. + * @param sourceLength The length of source, or -1 if null-terminated. + * @param target The target string. + * @param targetLength The length of target, or -1 if null-terminated. + * @return TRUE if source is greater than target, FALSE otherwise. + * @see ucol_strcoll + * @see ucol_greaterOrEqual + * @see ucol_equal + * @stable ICU 2.0 + */ +U_STABLE UBool U_EXPORT2 +ucol_greater(const UCollator *coll, + const UChar *source, int32_t sourceLength, + const UChar *target, int32_t targetLength); + +/** + * Determine if one string is greater than or equal to another. + * This function is equivalent to {@link #ucol_strcoll } != UCOL_LESS + * @param coll The UCollator containing the comparison rules. + * @param source The source string. + * @param sourceLength The length of source, or -1 if null-terminated. + * @param target The target string. + * @param targetLength The length of target, or -1 if null-terminated. + * @return TRUE if source is greater than or equal to target, FALSE otherwise. + * @see ucol_strcoll + * @see ucol_greater + * @see ucol_equal + * @stable ICU 2.0 + */ +U_STABLE UBool U_EXPORT2 +ucol_greaterOrEqual(const UCollator *coll, + const UChar *source, int32_t sourceLength, + const UChar *target, int32_t targetLength); + +/** + * Compare two strings for equality. + * This function is equivalent to {@link #ucol_strcoll } == UCOL_EQUAL + * @param coll The UCollator containing the comparison rules. + * @param source The source string. + * @param sourceLength The length of source, or -1 if null-terminated. + * @param target The target string. + * @param targetLength The length of target, or -1 if null-terminated. + * @return TRUE if source is equal to target, FALSE otherwise + * @see ucol_strcoll + * @see ucol_greater + * @see ucol_greaterOrEqual + * @stable ICU 2.0 + */ +U_STABLE UBool U_EXPORT2 +ucol_equal(const UCollator *coll, + const UChar *source, int32_t sourceLength, + const UChar *target, int32_t targetLength); + +/** + * Compare two UTF-8 encoded trings. + * The strings will be compared using the options already specified. + * @param coll The UCollator containing the comparison rules. + * @param sIter The source string iterator. + * @param tIter The target string iterator. + * @return The result of comparing the strings; one of UCOL_EQUAL, + * UCOL_GREATER, UCOL_LESS + * @param status A pointer to a UErrorCode to receive any errors + * @see ucol_strcoll + * @stable ICU 2.6 + */ +U_STABLE UCollationResult U_EXPORT2 +ucol_strcollIter( const UCollator *coll, + UCharIterator *sIter, + UCharIterator *tIter, + UErrorCode *status); + +/** + * Get the collation strength used in a UCollator. + * The strength influences how strings are compared. + * @param coll The UCollator to query. + * @return The collation strength; one of UCOL_PRIMARY, UCOL_SECONDARY, + * UCOL_TERTIARY, UCOL_QUATERNARY, UCOL_IDENTICAL + * @see ucol_setStrength + * @stable ICU 2.0 + */ +U_STABLE UCollationStrength U_EXPORT2 +ucol_getStrength(const UCollator *coll); + +/** + * Set the collation strength used in a UCollator. + * The strength influences how strings are compared. + * @param coll The UCollator to set. + * @param strength The desired collation strength; one of UCOL_PRIMARY, + * UCOL_SECONDARY, UCOL_TERTIARY, UCOL_QUATERNARY, UCOL_IDENTICAL, UCOL_DEFAULT + * @see ucol_getStrength + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucol_setStrength(UCollator *coll, + UCollationStrength strength); + +/** + * Retrieves the reordering codes for this collator. + * These reordering codes are a combination of UScript codes and UColReorderCode entries. + * @param coll The UCollator to query. + * @param dest The array to fill with the script ordering. + * @param destCapacity The length of dest. If it is 0, then dest may be NULL and the function + * will only return the length of the result without writing any codes (pre-flighting). + * @param pErrorCode Must be a valid pointer to an error code value, which must not indicate a + * failure before the function call. + * @return The number of reordering codes written to the dest array. + * @see ucol_setReorderCodes + * @see ucol_getEquivalentReorderCodes + * @see UScriptCode + * @see UColReorderCode + * @stable ICU 4.8 + */ +U_STABLE int32_t U_EXPORT2 +ucol_getReorderCodes(const UCollator* coll, + int32_t* dest, + int32_t destCapacity, + UErrorCode *pErrorCode); +/** + * Sets the reordering codes for this collator. + * Collation reordering allows scripts and some other groups of characters + * to be moved relative to each other. This reordering is done on top of + * the DUCET/CLDR standard collation order. Reordering can specify groups to be placed + * at the start and/or the end of the collation order. These groups are specified using + * UScript codes and UColReorderCode entries. + * + *

By default, reordering codes specified for the start of the order are placed in the + * order given after several special non-script blocks. These special groups of characters + * are space, punctuation, symbol, currency, and digit. These special groups are represented with + * UColReorderCode entries. Script groups can be intermingled with + * these special non-script groups if those special groups are explicitly specified in the reordering. + * + *

The special code OTHERS stands for any script that is not explicitly + * mentioned in the list of reordering codes given. Anything that is after OTHERS + * will go at the very end of the reordering in the order given. + * + *

The special reorder code DEFAULT will reset the reordering for this collator + * to the default for this collator. The default reordering may be the DUCET/CLDR order or may be a reordering that + * was specified when this collator was created from resource data or from rules. The + * DEFAULT code must be the sole code supplied when it is used. + * If not, then U_ILLEGAL_ARGUMENT_ERROR will be set. + * + *

The special reorder code NONE will remove any reordering for this collator. + * The result of setting no reordering will be to have the DUCET/CLDR ordering used. The + * NONE code must be the sole code supplied when it is used. + * + * @param coll The UCollator to set. + * @param reorderCodes An array of script codes in the new order. This can be NULL if the + * length is also set to 0. An empty array will clear any reordering codes on the collator. + * @param reorderCodesLength The length of reorderCodes. + * @param pErrorCode Must be a valid pointer to an error code value, which must not indicate a + * failure before the function call. + * @see ucol_getReorderCodes + * @see ucol_getEquivalentReorderCodes + * @see UScriptCode + * @see UColReorderCode + * @stable ICU 4.8 + */ +U_STABLE void U_EXPORT2 +ucol_setReorderCodes(UCollator* coll, + const int32_t* reorderCodes, + int32_t reorderCodesLength, + UErrorCode *pErrorCode); + +/** + * Retrieves the reorder codes that are grouped with the given reorder code. Some reorder + * codes will be grouped and must reorder together. + * Beginning with ICU 55, scripts only reorder together if they are primary-equal, + * for example Hiragana and Katakana. + * + * @param reorderCode The reorder code to determine equivalence for. + * @param dest The array to fill with the script ordering. + * @param destCapacity The length of dest. If it is 0, then dest may be NULL and the function + * will only return the length of the result without writing any codes (pre-flighting). + * @param pErrorCode Must be a valid pointer to an error code value, which must not indicate + * a failure before the function call. + * @return The number of reordering codes written to the dest array. + * @see ucol_setReorderCodes + * @see ucol_getReorderCodes + * @see UScriptCode + * @see UColReorderCode + * @stable ICU 4.8 + */ +U_STABLE int32_t U_EXPORT2 +ucol_getEquivalentReorderCodes(int32_t reorderCode, + int32_t* dest, + int32_t destCapacity, + UErrorCode *pErrorCode); + +/** + * Get the display name for a UCollator. + * The display name is suitable for presentation to a user. + * @param objLoc The locale of the collator in question. + * @param dispLoc The locale for display. + * @param result A pointer to a buffer to receive the attribute. + * @param resultLength The maximum size of result. + * @param status A pointer to a UErrorCode to receive any errors + * @return The total buffer size needed; if greater than resultLength, + * the output was truncated. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ucol_getDisplayName( const char *objLoc, + const char *dispLoc, + UChar *result, + int32_t resultLength, + UErrorCode *status); + +/** + * Get a locale for which collation rules are available. + * A UCollator in a locale returned by this function will perform the correct + * collation for the locale. + * @param localeIndex The index of the desired locale. + * @return A locale for which collation rules are available, or 0 if none. + * @see ucol_countAvailable + * @stable ICU 2.0 + */ +U_STABLE const char* U_EXPORT2 +ucol_getAvailable(int32_t localeIndex); + +/** + * Determine how many locales have collation rules available. + * This function is most useful as determining the loop ending condition for + * calls to {@link #ucol_getAvailable }. + * @return The number of locales for which collation rules are available. + * @see ucol_getAvailable + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ucol_countAvailable(void); + +#if !UCONFIG_NO_SERVICE +/** + * Create a string enumerator of all locales for which a valid + * collator may be opened. + * @param status input-output error code + * @return a string enumeration over locale strings. The caller is + * responsible for closing the result. + * @stable ICU 3.0 + */ +U_STABLE UEnumeration* U_EXPORT2 +ucol_openAvailableLocales(UErrorCode *status); +#endif + +/** + * Create a string enumerator of all possible keywords that are relevant to + * collation. At this point, the only recognized keyword for this + * service is "collation". + * @param status input-output error code + * @return a string enumeration over locale strings. The caller is + * responsible for closing the result. + * @stable ICU 3.0 + */ +U_STABLE UEnumeration* U_EXPORT2 +ucol_getKeywords(UErrorCode *status); + +/** + * Given a keyword, create a string enumeration of all values + * for that keyword that are currently in use. + * @param keyword a particular keyword as enumerated by + * ucol_getKeywords. If any other keyword is passed in, *status is set + * to U_ILLEGAL_ARGUMENT_ERROR. + * @param status input-output error code + * @return a string enumeration over collation keyword values, or NULL + * upon error. The caller is responsible for closing the result. + * @stable ICU 3.0 + */ +U_STABLE UEnumeration* U_EXPORT2 +ucol_getKeywordValues(const char *keyword, UErrorCode *status); + +/** + * Given a key and a locale, returns an array of string values in a preferred + * order that would make a difference. These are all and only those values where + * the open (creation) of the service with the locale formed from the input locale + * plus input keyword and that value has different behavior than creation with the + * input locale alone. + * @param key one of the keys supported by this service. For now, only + * "collation" is supported. + * @param locale the locale + * @param commonlyUsed if set to true it will return only commonly used values + * with the given locale in preferred order. Otherwise, + * it will return all the available values for the locale. + * @param status error status + * @return a string enumeration over keyword values for the given key and the locale. + * @stable ICU 4.2 + */ +U_STABLE UEnumeration* U_EXPORT2 +ucol_getKeywordValuesForLocale(const char* key, + const char* locale, + UBool commonlyUsed, + UErrorCode* status); + +/** + * Return the functionally equivalent locale for the specified + * input locale, with respect to given keyword, for the + * collation service. If two different input locale + keyword + * combinations produce the same result locale, then collators + * instantiated for these two different input locales will behave + * equivalently. The converse is not always true; two collators + * may in fact be equivalent, but return different results, due to + * internal details. The return result has no other meaning than + * that stated above, and implies nothing as to the relationship + * between the two locales. This is intended for use by + * applications who wish to cache collators, or otherwise reuse + * collators when possible. The functional equivalent may change + * over time. For more information, please see the + * Locales and Services section of the ICU User Guide. + * @param result fillin for the functionally equivalent result locale + * @param resultCapacity capacity of the fillin buffer + * @param keyword a particular keyword as enumerated by + * ucol_getKeywords. + * @param locale the specified input locale + * @param isAvailable if non-NULL, pointer to a fillin parameter that + * on return indicates whether the specified input locale was 'available' + * to the collation service. A locale is defined as 'available' if it + * physically exists within the collation locale data. + * @param status pointer to input-output error code + * @return the actual buffer size needed for the locale. If greater + * than resultCapacity, the returned full name will be truncated and + * an error code will be returned. + * @stable ICU 3.0 + */ +U_STABLE int32_t U_EXPORT2 +ucol_getFunctionalEquivalent(char* result, int32_t resultCapacity, + const char* keyword, const char* locale, + UBool* isAvailable, UErrorCode* status); + +/** + * Get the collation tailoring rules from a UCollator. + * The rules will follow the rule syntax. + * @param coll The UCollator to query. + * @param length + * @return The collation tailoring rules. + * @stable ICU 2.0 + */ +U_STABLE const UChar* U_EXPORT2 +ucol_getRules( const UCollator *coll, + int32_t *length); + +#ifndef U_HIDE_DEPRECATED_API +/** Get the short definition string for a collator. This API harvests the collator's + * locale and the attribute set and produces a string that can be used for opening + * a collator with the same attributes using the ucol_openFromShortString API. + * This string will be normalized. + * The structure and the syntax of the string is defined in the "Naming collators" + * section of the users guide: + * http://userguide.icu-project.org/collation/concepts#TOC-Collator-naming-scheme + * This API supports preflighting. + * @param coll a collator + * @param locale a locale that will appear as a collators locale in the resulting + * short string definition. If NULL, the locale will be harvested + * from the collator. + * @param buffer space to hold the resulting string + * @param capacity capacity of the buffer + * @param status for returning errors. All the preflighting errors are featured + * @return length of the resulting string + * @see ucol_openFromShortString + * @see ucol_normalizeShortDefinitionString + * @deprecated ICU 54 + */ +U_DEPRECATED int32_t U_EXPORT2 +ucol_getShortDefinitionString(const UCollator *coll, + const char *locale, + char *buffer, + int32_t capacity, + UErrorCode *status); + +/** Verifies and normalizes short definition string. + * Normalized short definition string has all the option sorted by the argument name, + * so that equivalent definition strings are the same. + * This API supports preflighting. + * @param source definition string + * @param destination space to hold the resulting string + * @param capacity capacity of the buffer + * @param parseError if not NULL, structure that will get filled with error's pre + * and post context in case of error. + * @param status Error code. This API will return an error if an invalid attribute + * or attribute/value combination is specified. All the preflighting + * errors are also featured + * @return length of the resulting normalized string. + * + * @see ucol_openFromShortString + * @see ucol_getShortDefinitionString + * + * @deprecated ICU 54 + */ + +U_DEPRECATED int32_t U_EXPORT2 +ucol_normalizeShortDefinitionString(const char *source, + char *destination, + int32_t capacity, + UParseError *parseError, + UErrorCode *status); +#endif /* U_HIDE_DEPRECATED_API */ + + +/** + * Get a sort key for a string from a UCollator. + * Sort keys may be compared using strcmp. + * + * Note that sort keys are often less efficient than simply doing comparison. + * For more details, see the ICU User Guide. + * + * Like ICU functions that write to an output buffer, the buffer contents + * is undefined if the buffer capacity (resultLength parameter) is too small. + * Unlike ICU functions that write a string to an output buffer, + * the terminating zero byte is counted in the sort key length. + * @param coll The UCollator containing the collation rules. + * @param source The string to transform. + * @param sourceLength The length of source, or -1 if null-terminated. + * @param result A pointer to a buffer to receive the attribute. + * @param resultLength The maximum size of result. + * @return The size needed to fully store the sort key. + * If there was an internal error generating the sort key, + * a zero value is returned. + * @see ucol_keyHashCode + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ucol_getSortKey(const UCollator *coll, + const UChar *source, + int32_t sourceLength, + uint8_t *result, + int32_t resultLength); + + +/** Gets the next count bytes of a sort key. Caller needs + * to preserve state array between calls and to provide + * the same type of UCharIterator set with the same string. + * The destination buffer provided must be big enough to store + * the number of requested bytes. + * + * The generated sort key may or may not be compatible with + * sort keys generated using ucol_getSortKey(). + * @param coll The UCollator containing the collation rules. + * @param iter UCharIterator containing the string we need + * the sort key to be calculated for. + * @param state Opaque state of sortkey iteration. + * @param dest Buffer to hold the resulting sortkey part + * @param count number of sort key bytes required. + * @param status error code indicator. + * @return the actual number of bytes of a sortkey. It can be + * smaller than count if we have reached the end of + * the sort key. + * @stable ICU 2.6 + */ +U_STABLE int32_t U_EXPORT2 +ucol_nextSortKeyPart(const UCollator *coll, + UCharIterator *iter, + uint32_t state[2], + uint8_t *dest, int32_t count, + UErrorCode *status); + +/** enum that is taken by ucol_getBound API + * See below for explanation + * do not change the values assigned to the + * members of this enum. Underlying code + * depends on them having these numbers + * @stable ICU 2.0 + */ +typedef enum { + /** lower bound */ + UCOL_BOUND_LOWER = 0, + /** upper bound that will match strings of exact size */ + UCOL_BOUND_UPPER = 1, + /** upper bound that will match all the strings that have the same initial substring as the given string */ + UCOL_BOUND_UPPER_LONG = 2, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UColBoundMode value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UCOL_BOUND_VALUE_COUNT +#endif /* U_HIDE_DEPRECATED_API */ +} UColBoundMode; + +/** + * Produce a bound for a given sortkey and a number of levels. + * Return value is always the number of bytes needed, regardless of + * whether the result buffer was big enough or even valid.
+ * Resulting bounds can be used to produce a range of strings that are + * between upper and lower bounds. For example, if bounds are produced + * for a sortkey of string "smith", strings between upper and lower + * bounds with one level would include "Smith", "SMITH", "sMiTh".
+ * There are two upper bounds that can be produced. If UCOL_BOUND_UPPER + * is produced, strings matched would be as above. However, if bound + * produced using UCOL_BOUND_UPPER_LONG is used, the above example will + * also match "Smithsonian" and similar.
+ * For more on usage, see example in cintltst/capitst.c in procedure + * TestBounds. + * Sort keys may be compared using strcmp. + * @param source The source sortkey. + * @param sourceLength The length of source, or -1 if null-terminated. + * (If an unmodified sortkey is passed, it is always null + * terminated). + * @param boundType Type of bound required. It can be UCOL_BOUND_LOWER, which + * produces a lower inclusive bound, UCOL_BOUND_UPPER, that + * produces upper bound that matches strings of the same length + * or UCOL_BOUND_UPPER_LONG that matches strings that have the + * same starting substring as the source string. + * @param noOfLevels Number of levels required in the resulting bound (for most + * uses, the recommended value is 1). See users guide for + * explanation on number of levels a sortkey can have. + * @param result A pointer to a buffer to receive the resulting sortkey. + * @param resultLength The maximum size of result. + * @param status Used for returning error code if something went wrong. If the + * number of levels requested is higher than the number of levels + * in the source key, a warning (U_SORT_KEY_TOO_SHORT_WARNING) is + * issued. + * @return The size needed to fully store the bound. + * @see ucol_keyHashCode + * @stable ICU 2.1 + */ +U_STABLE int32_t U_EXPORT2 +ucol_getBound(const uint8_t *source, + int32_t sourceLength, + UColBoundMode boundType, + uint32_t noOfLevels, + uint8_t *result, + int32_t resultLength, + UErrorCode *status); + +/** + * Gets the version information for a Collator. Version is currently + * an opaque 32-bit number which depends, among other things, on major + * versions of the collator tailoring and UCA. + * @param coll The UCollator to query. + * @param info the version # information, the result will be filled in + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucol_getVersion(const UCollator* coll, UVersionInfo info); + +/** + * Gets the UCA version information for a Collator. Version is the + * UCA version number (3.1.1, 4.0). + * @param coll The UCollator to query. + * @param info the version # information, the result will be filled in + * @stable ICU 2.8 + */ +U_STABLE void U_EXPORT2 +ucol_getUCAVersion(const UCollator* coll, UVersionInfo info); + +/** + * Merges two sort keys. The levels are merged with their corresponding counterparts + * (primaries with primaries, secondaries with secondaries etc.). Between the values + * from the same level a separator is inserted. + * + * This is useful, for example, for combining sort keys from first and last names + * to sort such pairs. + * See http://www.unicode.org/reports/tr10/#Merging_Sort_Keys + * + * The recommended way to achieve "merged" sorting is by + * concatenating strings with U+FFFE between them. + * The concatenation has the same sort order as the merged sort keys, + * but merge(getSortKey(str1), getSortKey(str2)) may differ from getSortKey(str1 + '\uFFFE' + str2). + * Using strings with U+FFFE may yield shorter sort keys. + * + * For details about Sort Key Features see + * http://userguide.icu-project.org/collation/api#TOC-Sort-Key-Features + * + * It is possible to merge multiple sort keys by consecutively merging + * another one with the intermediate result. + * + * The length of the merge result is the sum of the lengths of the input sort keys. + * + * Example (uncompressed): + *

191B1D 01 050505 01 910505 00
+ * 1F2123 01 050505 01 910505 00
+ * will be merged as + *
191B1D 02 1F2123 01 050505 02 050505 01 910505 02 910505 00
+ * + * If the destination buffer is not big enough, then its contents are undefined. + * If any of source lengths are zero or any of the source pointers are NULL/undefined, + * the result is of size zero. + * + * @param src1 the first sort key + * @param src1Length the length of the first sort key, including the zero byte at the end; + * can be -1 if the function is to find the length + * @param src2 the second sort key + * @param src2Length the length of the second sort key, including the zero byte at the end; + * can be -1 if the function is to find the length + * @param dest the buffer where the merged sort key is written, + * can be NULL if destCapacity==0 + * @param destCapacity the number of bytes in the dest buffer + * @return the length of the merged sort key, src1Length+src2Length; + * can be larger than destCapacity, or 0 if an error occurs (only for illegal arguments), + * in which cases the contents of dest is undefined + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length, + const uint8_t *src2, int32_t src2Length, + uint8_t *dest, int32_t destCapacity); + +/** + * Universal attribute setter + * @param coll collator which attributes are to be changed + * @param attr attribute type + * @param value attribute value + * @param status to indicate whether the operation went on smoothly or there were errors + * @see UColAttribute + * @see UColAttributeValue + * @see ucol_getAttribute + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status); + +/** + * Universal attribute getter + * @param coll collator which attributes are to be changed + * @param attr attribute type + * @return attribute value + * @param status to indicate whether the operation went on smoothly or there were errors + * @see UColAttribute + * @see UColAttributeValue + * @see ucol_setAttribute + * @stable ICU 2.0 + */ +U_STABLE UColAttributeValue U_EXPORT2 +ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status); + +/** + * Sets the variable top to the top of the specified reordering group. + * The variable top determines the highest-sorting character + * which is affected by UCOL_ALTERNATE_HANDLING. + * If that attribute is set to UCOL_NON_IGNORABLE, then the variable top has no effect. + * @param coll the collator + * @param group one of UCOL_REORDER_CODE_SPACE, UCOL_REORDER_CODE_PUNCTUATION, + * UCOL_REORDER_CODE_SYMBOL, UCOL_REORDER_CODE_CURRENCY; + * or UCOL_REORDER_CODE_DEFAULT to restore the default max variable group + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @see ucol_getMaxVariable + * @stable ICU 53 + */ +U_STABLE void U_EXPORT2 +ucol_setMaxVariable(UCollator *coll, UColReorderCode group, UErrorCode *pErrorCode); + +/** + * Returns the maximum reordering group whose characters are affected by UCOL_ALTERNATE_HANDLING. + * @param coll the collator + * @return the maximum variable reordering group. + * @see ucol_setMaxVariable + * @stable ICU 53 + */ +U_STABLE UColReorderCode U_EXPORT2 +ucol_getMaxVariable(const UCollator *coll); + +#ifndef U_HIDE_DEPRECATED_API +/** + * Sets the variable top to the primary weight of the specified string. + * + * Beginning with ICU 53, the variable top is pinned to + * the top of one of the supported reordering groups, + * and it must not be beyond the last of those groups. + * See ucol_setMaxVariable(). + * @param coll the collator + * @param varTop one or more (if contraction) UChars to which the variable top should be set + * @param len length of variable top string. If -1 it is considered to be zero terminated. + * @param status error code. If error code is set, the return value is undefined. + * Errors set by this function are:
+ * U_CE_NOT_FOUND_ERROR if more than one character was passed and there is no such contraction
+ * U_ILLEGAL_ARGUMENT_ERROR if the variable top is beyond + * the last reordering group supported by ucol_setMaxVariable() + * @return variable top primary weight + * @see ucol_getVariableTop + * @see ucol_restoreVariableTop + * @deprecated ICU 53 Call ucol_setMaxVariable() instead. + */ +U_DEPRECATED uint32_t U_EXPORT2 +ucol_setVariableTop(UCollator *coll, + const UChar *varTop, int32_t len, + UErrorCode *status); +#endif /* U_HIDE_DEPRECATED_API */ + +/** + * Gets the variable top value of a Collator. + * @param coll collator which variable top needs to be retrieved + * @param status error code (not changed by function). If error code is set, + * the return value is undefined. + * @return the variable top primary weight + * @see ucol_getMaxVariable + * @see ucol_setVariableTop + * @see ucol_restoreVariableTop + * @stable ICU 2.0 + */ +U_STABLE uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status); + +#ifndef U_HIDE_DEPRECATED_API +/** + * Sets the variable top to the specified primary weight. + * + * Beginning with ICU 53, the variable top is pinned to + * the top of one of the supported reordering groups, + * and it must not be beyond the last of those groups. + * See ucol_setMaxVariable(). + * @param varTop primary weight, as returned by ucol_setVariableTop or ucol_getVariableTop + * @param status error code + * @see ucol_getVariableTop + * @see ucol_setVariableTop + * @deprecated ICU 53 Call ucol_setMaxVariable() instead. + */ +U_DEPRECATED void U_EXPORT2 +ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status); +#endif /* U_HIDE_DEPRECATED_API */ + +/** + * Thread safe cloning operation. The result is a clone of a given collator. + * @param coll collator to be cloned + * @param stackBuffer Deprecated functionality as of ICU 52, use NULL.
+ * user allocated space for the new clone. + * If NULL new memory will be allocated. + * If buffer is not large enough, new memory will be allocated. + * Clients can use the U_COL_SAFECLONE_BUFFERSIZE. + * @param pBufferSize Deprecated functionality as of ICU 52, use NULL or 1.
+ * pointer to size of allocated space. + * If *pBufferSize == 0, a sufficient size for use in cloning will + * be returned ('pre-flighting') + * If *pBufferSize is not enough for a stack-based safe clone, + * new memory will be allocated. + * @param status to indicate whether the operation went on smoothly or there were errors + * An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any + * allocations were necessary. + * @return pointer to the new clone + * @see ucol_open + * @see ucol_openRules + * @see ucol_close + * @stable ICU 2.0 + */ +U_STABLE UCollator* U_EXPORT2 +ucol_safeClone(const UCollator *coll, + void *stackBuffer, + int32_t *pBufferSize, + UErrorCode *status); + +#ifndef U_HIDE_DEPRECATED_API + +/** default memory size for the new clone. + * @deprecated ICU 52. Do not rely on ucol_safeClone() cloning into any provided buffer. + */ +#define U_COL_SAFECLONE_BUFFERSIZE 1 + +#endif /* U_HIDE_DEPRECATED_API */ + +/** + * Returns current rules. Delta defines whether full rules are returned or just the tailoring. + * Returns number of UChars needed to store rules. If buffer is NULL or bufferLen is not enough + * to store rules, will store up to available space. + * + * ucol_getRules() should normally be used instead. + * See http://userguide.icu-project.org/collation/customization#TOC-Building-on-Existing-Locales + * @param coll collator to get the rules from + * @param delta one of UCOL_TAILORING_ONLY, UCOL_FULL_RULES. + * @param buffer buffer to store the result in. If NULL, you'll get no rules. + * @param bufferLen length of buffer to store rules in. If less than needed you'll get only the part that fits in. + * @return current rules + * @stable ICU 2.0 + * @see UCOL_FULL_RULES + */ +U_STABLE int32_t U_EXPORT2 +ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen); + +#ifndef U_HIDE_DEPRECATED_API +/** + * gets the locale name of the collator. If the collator + * is instantiated from the rules, then this function returns + * NULL. + * @param coll The UCollator for which the locale is needed + * @param type You can choose between requested, valid and actual + * locale. For description see the definition of + * ULocDataLocaleType in uloc.h + * @param status error code of the operation + * @return real locale name from which the collation data comes. + * If the collator was instantiated from rules, returns + * NULL. + * @deprecated ICU 2.8 Use ucol_getLocaleByType instead + */ +U_DEPRECATED const char * U_EXPORT2 +ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status); +#endif /* U_HIDE_DEPRECATED_API */ + +/** + * gets the locale name of the collator. If the collator + * is instantiated from the rules, then this function returns + * NULL. + * @param coll The UCollator for which the locale is needed + * @param type You can choose between requested, valid and actual + * locale. For description see the definition of + * ULocDataLocaleType in uloc.h + * @param status error code of the operation + * @return real locale name from which the collation data comes. + * If the collator was instantiated from rules, returns + * NULL. + * @stable ICU 2.8 + */ +U_STABLE const char * U_EXPORT2 +ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status); + +/** + * Get a Unicode set that contains all the characters and sequences tailored in + * this collator. The result must be disposed of by using uset_close. + * @param coll The UCollator for which we want to get tailored chars + * @param status error code of the operation + * @return a pointer to newly created USet. Must be be disposed by using uset_close + * @see ucol_openRules + * @see uset_close + * @stable ICU 2.4 + */ +U_STABLE USet * U_EXPORT2 +ucol_getTailoredSet(const UCollator *coll, UErrorCode *status); + +#ifndef U_HIDE_INTERNAL_API +/** Calculates the set of unsafe code points, given a collator. + * A character is unsafe if you could append any character and cause the ordering to alter significantly. + * Collation sorts in normalized order, so anything that rearranges in normalization can cause this. + * Thus if you have a character like a_umlaut, and you add a lower_dot to it, + * then it normalizes to a_lower_dot + umlaut, and sorts differently. + * @param coll Collator + * @param unsafe a fill-in set to receive the unsafe points + * @param status for catching errors + * @return number of elements in the set + * @internal ICU 3.0 + */ +U_INTERNAL int32_t U_EXPORT2 +ucol_getUnsafeSet( const UCollator *coll, + USet *unsafe, + UErrorCode *status); + +/** Touches all resources needed for instantiating a collator from a short string definition, + * thus filling up the cache. + * @param definition A short string containing a locale and a set of attributes. + * Attributes not explicitly mentioned are left at the default + * state for a locale. + * @param parseError if not NULL, structure that will get filled with error's pre + * and post context in case of error. + * @param forceDefaults if FALSE, the settings that are the same as the collator + * default settings will not be applied (for example, setting + * French secondary on a French collator would not be executed). + * If TRUE, all the settings will be applied regardless of the + * collator default value. If the definition + * strings are to be cached, should be set to FALSE. + * @param status Error code. Apart from regular error conditions connected to + * instantiating collators (like out of memory or similar), this + * API will return an error if an invalid attribute or attribute/value + * combination is specified. + * @see ucol_openFromShortString + * @internal ICU 3.2.1 + */ +U_INTERNAL void U_EXPORT2 +ucol_prepareShortStringOpen( const char *definition, + UBool forceDefaults, + UParseError *parseError, + UErrorCode *status); +#endif /* U_HIDE_INTERNAL_API */ + +/** Creates a binary image of a collator. This binary image can be stored and + * later used to instantiate a collator using ucol_openBinary. + * This API supports preflighting. + * @param coll Collator + * @param buffer a fill-in buffer to receive the binary image + * @param capacity capacity of the destination buffer + * @param status for catching errors + * @return size of the image + * @see ucol_openBinary + * @stable ICU 3.2 + */ +U_STABLE int32_t U_EXPORT2 +ucol_cloneBinary(const UCollator *coll, + uint8_t *buffer, int32_t capacity, + UErrorCode *status); + +/** Opens a collator from a collator binary image created using + * ucol_cloneBinary. Binary image used in instantiation of the + * collator remains owned by the user and should stay around for + * the lifetime of the collator. The API also takes a base collator + * which must be the root collator. + * @param bin binary image owned by the user and required through the + * lifetime of the collator + * @param length size of the image. If negative, the API will try to + * figure out the length of the image + * @param base Base collator, for lookup of untailored characters. + * Must be the root collator, must not be NULL. + * The base is required to be present through the lifetime of the collator. + * @param status for catching errors + * @return newly created collator + * @see ucol_cloneBinary + * @stable ICU 3.2 + */ +U_STABLE UCollator* U_EXPORT2 +ucol_openBinary(const uint8_t *bin, int32_t length, + const UCollator *base, + UErrorCode *status); + + +#endif /* #if !UCONFIG_NO_COLLATION */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ucoleitr.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucoleitr.h new file mode 100644 index 0000000..85ec838 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucoleitr.h @@ -0,0 +1,268 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2001-2014, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* +* File ucoleitr.h +* +* Modification History: +* +* Date Name Description +* 02/15/2001 synwee Modified all methods to process its own function +* instead of calling the equivalent c++ api (coleitr.h) +*******************************************************************************/ + +#ifndef UCOLEITR_H +#define UCOLEITR_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_COLLATION + +/** + * This indicates an error has occured during processing or if no more CEs is + * to be returned. + * @stable ICU 2.0 + */ +#define UCOL_NULLORDER ((int32_t)0xFFFFFFFF) + +#include "unicode/ucol.h" + +/** + * The UCollationElements struct. + * For usage in C programs. + * @stable ICU 2.0 + */ +typedef struct UCollationElements UCollationElements; + +/** + * \file + * \brief C API: UCollationElements + * + * The UCollationElements API is used as an iterator to walk through each + * character of an international string. Use the iterator to return the + * ordering priority of the positioned character. The ordering priority of a + * character, which we refer to as a key, defines how a character is collated + * in the given collation object. + * For example, consider the following in Slovak and in traditional Spanish collation: + *
+ * .       "ca" -> the first key is key('c') and second key is key('a').
+ * .       "cha" -> the first key is key('ch') and second key is key('a').
+ * 
+ * And in German phonebook collation, + *
+ * .       "b"-> the first key is key('a'), the second key is key('e'), and
+ * .       the third key is key('b').
+ * 
+ *

Example of the iterator usage: (without error checking) + *

+ * .  void CollationElementIterator_Example()
+ * .  {
+ * .      UChar *s;
+ * .      t_int32 order, primaryOrder;
+ * .      UCollationElements *c;
+ * .      UCollatorOld *coll;
+ * .      UErrorCode success = U_ZERO_ERROR;
+ * .      s=(UChar*)malloc(sizeof(UChar) * (strlen("This is a test")+1) );
+ * .      u_uastrcpy(s, "This is a test");
+ * .      coll = ucol_open(NULL, &success);
+ * .      c = ucol_openElements(coll, str, u_strlen(str), &status);
+ * .      order = ucol_next(c, &success);
+ * .      ucol_reset(c);
+ * .      order = ucol_prev(c, &success);
+ * .      free(s);
+ * .      ucol_close(coll);
+ * .      ucol_closeElements(c);
+ * .  }
+ * 
+ *

+ * ucol_next() returns the collation order of the next. + * ucol_prev() returns the collation order of the previous character. + * The Collation Element Iterator moves only in one direction between calls to + * ucol_reset. That is, ucol_next() and ucol_prev can not be inter-used. + * Whenever ucol_prev is to be called after ucol_next() or vice versa, + * ucol_reset has to be called first to reset the status, shifting pointers to + * either the end or the start of the string. Hence at the next call of + * ucol_prev or ucol_next, the first or last collation order will be returned. + * If a change of direction is done without a ucol_reset, the result is + * undefined. + * The result of a forward iterate (ucol_next) and reversed result of the + * backward iterate (ucol_prev) on the same string are equivalent, if + * collation orders with the value 0 are ignored. + * Character based on the comparison level of the collator. A collation order + * consists of primary order, secondary order and tertiary order. The data + * type of the collation order is int32_t. + * + * @see UCollator + */ + +/** + * Open the collation elements for a string. + * + * @param coll The collator containing the desired collation rules. + * @param text The text to iterate over. + * @param textLength The number of characters in text, or -1 if null-terminated + * @param status A pointer to a UErrorCode to receive any errors. + * @return a struct containing collation element information + * @stable ICU 2.0 + */ +U_STABLE UCollationElements* U_EXPORT2 +ucol_openElements(const UCollator *coll, + const UChar *text, + int32_t textLength, + UErrorCode *status); + + +/** + * get a hash code for a key... Not very useful! + * @param key the given key. + * @param length the size of the key array. + * @return the hash code. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ucol_keyHashCode(const uint8_t* key, int32_t length); + +/** + * Close a UCollationElements. + * Once closed, a UCollationElements may no longer be used. + * @param elems The UCollationElements to close. + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucol_closeElements(UCollationElements *elems); + +/** + * Reset the collation elements to their initial state. + * This will move the 'cursor' to the beginning of the text. + * Property settings for collation will be reset to the current status. + * @param elems The UCollationElements to reset. + * @see ucol_next + * @see ucol_previous + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucol_reset(UCollationElements *elems); + +/** + * Get the ordering priority of the next collation element in the text. + * A single character may contain more than one collation element. + * @param elems The UCollationElements containing the text. + * @param status A pointer to a UErrorCode to receive any errors. + * @return The next collation elements ordering, otherwise returns UCOL_NULLORDER + * if an error has occured or if the end of string has been reached + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ucol_next(UCollationElements *elems, UErrorCode *status); + +/** + * Get the ordering priority of the previous collation element in the text. + * A single character may contain more than one collation element. + * Note that internally a stack is used to store buffered collation elements. + * @param elems The UCollationElements containing the text. + * @param status A pointer to a UErrorCode to receive any errors. Noteably + * a U_BUFFER_OVERFLOW_ERROR is returned if the internal stack + * buffer has been exhausted. + * @return The previous collation elements ordering, otherwise returns + * UCOL_NULLORDER if an error has occured or if the start of string has + * been reached. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ucol_previous(UCollationElements *elems, UErrorCode *status); + +/** + * Get the maximum length of any expansion sequences that end with the + * specified comparison order. + * This is useful for .... ? + * @param elems The UCollationElements containing the text. + * @param order A collation order returned by previous or next. + * @return maximum size of the expansion sequences ending with the collation + * element or 1 if collation element does not occur at the end of any + * expansion sequence + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ucol_getMaxExpansion(const UCollationElements *elems, int32_t order); + +/** + * Set the text containing the collation elements. + * Property settings for collation will remain the same. + * In order to reset the iterator to the current collation property settings, + * the API reset() has to be called. + * @param elems The UCollationElements to set. + * @param text The source text containing the collation elements. + * @param textLength The length of text, or -1 if null-terminated. + * @param status A pointer to a UErrorCode to receive any errors. + * @see ucol_getText + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucol_setText( UCollationElements *elems, + const UChar *text, + int32_t textLength, + UErrorCode *status); + +/** + * Get the offset of the current source character. + * This is an offset into the text of the character containing the current + * collation elements. + * @param elems The UCollationElements to query. + * @return The offset of the current source character. + * @see ucol_setOffset + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ucol_getOffset(const UCollationElements *elems); + +/** + * Set the offset of the current source character. + * This is an offset into the text of the character to be processed. + * Property settings for collation will remain the same. + * In order to reset the iterator to the current collation property settings, + * the API reset() has to be called. + * @param elems The UCollationElements to set. + * @param offset The desired character offset. + * @param status A pointer to a UErrorCode to receive any errors. + * @see ucol_getOffset + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ucol_setOffset(UCollationElements *elems, + int32_t offset, + UErrorCode *status); + +/** +* Get the primary order of a collation order. +* @param order the collation order +* @return the primary order of a collation order. +* @stable ICU 2.6 +*/ +U_STABLE int32_t U_EXPORT2 +ucol_primaryOrder (int32_t order); + +/** +* Get the secondary order of a collation order. +* @param order the collation order +* @return the secondary order of a collation order. +* @stable ICU 2.6 +*/ +U_STABLE int32_t U_EXPORT2 +ucol_secondaryOrder (int32_t order); + +/** +* Get the tertiary order of a collation order. +* @param order the collation order +* @return the tertiary order of a collation order. +* @stable ICU 2.6 +*/ +U_STABLE int32_t U_EXPORT2 +ucol_tertiaryOrder (int32_t order); + +#endif /* #if !UCONFIG_NO_COLLATION */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/uconfig.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/uconfig.h new file mode 100644 index 0000000..7ddf4e6 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/uconfig.h @@ -0,0 +1,455 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 2002-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* file name: uconfig.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2002sep19 +* created by: Markus W. Scherer +*/ + +#ifndef __UCONFIG_H__ +#define __UCONFIG_H__ + + +/*! + * \file + * \brief User-configurable settings + * + * Miscellaneous switches: + * + * A number of macros affect a variety of minor aspects of ICU. + * Most of them used to be defined elsewhere (e.g., in utypes.h or platform.h) + * and moved here to make them easier to find. + * + * Switches for excluding parts of ICU library code modules: + * + * Changing these macros allows building partial, smaller libraries for special purposes. + * By default, all modules are built. + * The switches are fairly coarse, controlling large modules. + * Basic services cannot be turned off. + * + * Building with any of these options does not guarantee that the + * ICU build process will completely work. It is recommended that + * the ICU libraries and data be built using the normal build. + * At that time you should remove the data used by those services. + * After building the ICU data library, you should rebuild the ICU + * libraries with these switches customized to your needs. + * + * @stable ICU 2.4 + */ + +/** + * If this switch is defined, ICU will attempt to load a header file named "uconfig_local.h" + * prior to determining default settings for uconfig variables. + * + * @internal ICU 4.0 + */ +#if defined(UCONFIG_USE_LOCAL) +#include "uconfig_local.h" +#endif + +/** + * \def U_DEBUG + * Determines whether to include debugging code. + * Automatically set on Windows, but most compilers do not have + * related predefined macros. + * @internal + */ +#ifdef U_DEBUG + /* Use the predefined value. */ +#elif defined(_DEBUG) + /* + * _DEBUG is defined by Visual Studio debug compilation. + * Do *not* test for its NDEBUG macro: It is an orthogonal macro + * which disables assert(). + */ +# define U_DEBUG 1 +# else +# define U_DEBUG 0 +#endif + +/** + * Determines whether to enable auto cleanup of libraries. + * @internal + */ +#ifndef UCLN_NO_AUTO_CLEANUP +#define UCLN_NO_AUTO_CLEANUP 1 +#endif + +/** + * \def U_DISABLE_RENAMING + * Determines whether to disable renaming or not. + * @internal + */ +#ifndef U_DISABLE_RENAMING +#define U_DISABLE_RENAMING 0 +#endif + +/** + * \def U_NO_DEFAULT_INCLUDE_UTF_HEADERS + * Determines whether utypes.h includes utf.h, utf8.h, utf16.h and utf_old.h. + * utypes.h includes those headers if this macro is defined to 0. + * Otherwise, each those headers must be included explicitly when using one of their macros. + * Defaults to 0 for backward compatibility, except inside ICU. + * @stable ICU 49 + */ +#ifdef U_NO_DEFAULT_INCLUDE_UTF_HEADERS + /* Use the predefined value. */ +#elif defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || \ + defined(U_IO_IMPLEMENTATION) || defined(U_LAYOUT_IMPLEMENTATION) || defined(U_LAYOUTEX_IMPLEMENTATION) || \ + defined(U_TOOLUTIL_IMPLEMENTATION) +# define U_NO_DEFAULT_INCLUDE_UTF_HEADERS 1 +#else +# define U_NO_DEFAULT_INCLUDE_UTF_HEADERS 0 +#endif + +/** + * \def U_OVERRIDE_CXX_ALLOCATION + * Determines whether to override new and delete. + * ICU is normally built such that all of its C++ classes, via their UMemory base, + * override operators new and delete to use its internal, customizable, + * non-exception-throwing memory allocation functions. (Default value 1 for this macro.) + * + * This is especially important when the application and its libraries use multiple heaps. + * For example, on Windows, this allows the ICU DLL to be used by + * applications that statically link the C Runtime library. + * + * @stable ICU 2.2 + */ +#ifndef U_OVERRIDE_CXX_ALLOCATION +#define U_OVERRIDE_CXX_ALLOCATION 1 +#endif + +/** + * \def U_ENABLE_TRACING + * Determines whether to enable tracing. + * @internal + */ +#ifndef U_ENABLE_TRACING +#define U_ENABLE_TRACING 0 +#endif + +/** + * \def UCONFIG_ENABLE_PLUGINS + * Determines whether to enable ICU plugins. + * @internal + */ +#ifndef UCONFIG_ENABLE_PLUGINS +#define UCONFIG_ENABLE_PLUGINS 0 +#endif + +/** + * \def U_ENABLE_DYLOAD + * Whether to enable Dynamic loading in ICU. + * @internal + */ +#ifndef U_ENABLE_DYLOAD +#define U_ENABLE_DYLOAD 1 +#endif + +/** + * \def U_CHECK_DYLOAD + * Whether to test Dynamic loading as an OS capability. + * @internal + */ +#ifndef U_CHECK_DYLOAD +#define U_CHECK_DYLOAD 1 +#endif + +/** + * \def U_DEFAULT_SHOW_DRAFT + * Do we allow ICU users to use the draft APIs by default? + * @internal + */ +#ifndef U_DEFAULT_SHOW_DRAFT +#define U_DEFAULT_SHOW_DRAFT 1 +#endif + +/*===========================================================================*/ +/* Custom icu entry point renaming */ +/*===========================================================================*/ + +/** + * \def U_HAVE_LIB_SUFFIX + * 1 if a custom library suffix is set. + * @internal + */ +#ifdef U_HAVE_LIB_SUFFIX + /* Use the predefined value. */ +#elif defined(U_LIB_SUFFIX_C_NAME) +# define U_HAVE_LIB_SUFFIX 1 +#endif + +/** + * \def U_LIB_SUFFIX_C_NAME_STRING + * Defines the library suffix as a string with C syntax. + * @internal + */ +#ifdef U_LIB_SUFFIX_C_NAME_STRING + /* Use the predefined value. */ +#elif defined(U_LIB_SUFFIX_C_NAME) +# define CONVERT_TO_STRING(s) #s +# define U_LIB_SUFFIX_C_NAME_STRING CONVERT_TO_STRING(U_LIB_SUFFIX_C_NAME) +#else +# define U_LIB_SUFFIX_C_NAME_STRING "" +#endif + +/* common/i18n library switches --------------------------------------------- */ + +/** + * \def UCONFIG_ONLY_COLLATION + * This switch turns off modules that are not needed for collation. + * + * It does not turn off legacy conversion because that is necessary + * for ICU to work on EBCDIC platforms (for the default converter). + * If you want "only collation" and do not build for EBCDIC, + * then you can define UCONFIG_NO_CONVERSION or UCONFIG_NO_LEGACY_CONVERSION to 1 as well. + * + * @stable ICU 2.4 + */ +#ifndef UCONFIG_ONLY_COLLATION +# define UCONFIG_ONLY_COLLATION 0 +#endif + +#if UCONFIG_ONLY_COLLATION + /* common library */ +# define UCONFIG_NO_BREAK_ITERATION 1 +# define UCONFIG_NO_IDNA 1 + + /* i18n library */ +# if UCONFIG_NO_COLLATION +# error Contradictory collation switches in uconfig.h. +# endif +# define UCONFIG_NO_FORMATTING 1 +# define UCONFIG_NO_TRANSLITERATION 1 +# define UCONFIG_NO_REGULAR_EXPRESSIONS 1 +#endif + +/* common library switches -------------------------------------------------- */ + +/** + * \def UCONFIG_NO_FILE_IO + * This switch turns off all file access in the common library + * where file access is only used for data loading. + * ICU data must then be provided in the form of a data DLL (or with an + * equivalent way to link to the data residing in an executable, + * as in building a combined library with both the common library's code and + * the data), or via udata_setCommonData(). + * Application data must be provided via udata_setAppData() or by using + * "open" functions that take pointers to data, for example ucol_openBinary(). + * + * File access is not used at all in the i18n library. + * + * File access cannot be turned off for the icuio library or for the ICU + * test suites and ICU tools. + * + * @stable ICU 3.6 + */ +#ifndef UCONFIG_NO_FILE_IO +# define UCONFIG_NO_FILE_IO 0 +#endif + +#if UCONFIG_NO_FILE_IO && defined(U_TIMEZONE_FILES_DIR) +# error Contradictory file io switches in uconfig.h. +#endif + +/** + * \def UCONFIG_NO_CONVERSION + * ICU will not completely build (compiling the tools fails) with this + * switch turned on. + * This switch turns off all converters. + * + * You may want to use this together with U_CHARSET_IS_UTF8 defined to 1 + * in utypes.h if char* strings in your environment are always in UTF-8. + * + * @stable ICU 3.2 + * @see U_CHARSET_IS_UTF8 + */ +#ifndef UCONFIG_NO_CONVERSION +# define UCONFIG_NO_CONVERSION 0 +#endif + +#if UCONFIG_NO_CONVERSION +# define UCONFIG_NO_LEGACY_CONVERSION 1 +#endif + +/** + * \def UCONFIG_ONLY_HTML_CONVERSION + * This switch turns off all of the converters NOT listed in + * the HTML encoding standard: + * http://www.w3.org/TR/encoding/#names-and-labels + * + * This is not possible on EBCDIC platforms + * because they need ibm-37 or ibm-1047 default converters. + * + * @stable ICU 55 + */ +#ifndef UCONFIG_ONLY_HTML_CONVERSION +# define UCONFIG_ONLY_HTML_CONVERSION 0 +#endif + +/** + * \def UCONFIG_NO_LEGACY_CONVERSION + * This switch turns off all converters except for + * - Unicode charsets (UTF-7/8/16/32, CESU-8, SCSU, BOCU-1) + * - US-ASCII + * - ISO-8859-1 + * + * Turning off legacy conversion is not possible on EBCDIC platforms + * because they need ibm-37 or ibm-1047 default converters. + * + * @stable ICU 2.4 + */ +#ifndef UCONFIG_NO_LEGACY_CONVERSION +# define UCONFIG_NO_LEGACY_CONVERSION 0 +#endif + +/** + * \def UCONFIG_NO_NORMALIZATION + * This switch turns off normalization. + * It implies turning off several other services as well, for example + * collation and IDNA. + * + * @stable ICU 2.6 + */ +#ifndef UCONFIG_NO_NORMALIZATION +# define UCONFIG_NO_NORMALIZATION 0 +#endif + +#if UCONFIG_NO_NORMALIZATION + /* common library */ + /* ICU 50 CJK dictionary BreakIterator uses normalization */ +# define UCONFIG_NO_BREAK_ITERATION 1 + /* IDNA (UTS #46) is implemented via normalization */ +# define UCONFIG_NO_IDNA 1 + + /* i18n library */ +# if UCONFIG_ONLY_COLLATION +# error Contradictory collation switches in uconfig.h. +# endif +# define UCONFIG_NO_COLLATION 1 +# define UCONFIG_NO_TRANSLITERATION 1 +#endif + +/** + * \def UCONFIG_NO_BREAK_ITERATION + * This switch turns off break iteration. + * + * @stable ICU 2.4 + */ +#ifndef UCONFIG_NO_BREAK_ITERATION +# define UCONFIG_NO_BREAK_ITERATION 0 +#endif + +/** + * \def UCONFIG_NO_IDNA + * This switch turns off IDNA. + * + * @stable ICU 2.6 + */ +#ifndef UCONFIG_NO_IDNA +# define UCONFIG_NO_IDNA 0 +#endif + +/** + * \def UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE + * Determines the default UMessagePatternApostropheMode. + * See the documentation for that enum. + * + * @stable ICU 4.8 + */ +#ifndef UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE +# define UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE UMSGPAT_APOS_DOUBLE_OPTIONAL +#endif + +/* i18n library switches ---------------------------------------------------- */ + +/** + * \def UCONFIG_NO_COLLATION + * This switch turns off collation and collation-based string search. + * + * @stable ICU 2.4 + */ +#ifndef UCONFIG_NO_COLLATION +# define UCONFIG_NO_COLLATION 0 +#endif + +/** + * \def UCONFIG_NO_FORMATTING + * This switch turns off formatting and calendar/timezone services. + * + * @stable ICU 2.4 + */ +#ifndef UCONFIG_NO_FORMATTING +# define UCONFIG_NO_FORMATTING 0 +#endif + +/** + * \def UCONFIG_NO_TRANSLITERATION + * This switch turns off transliteration. + * + * @stable ICU 2.4 + */ +#ifndef UCONFIG_NO_TRANSLITERATION +# define UCONFIG_NO_TRANSLITERATION 0 +#endif + +/** + * \def UCONFIG_NO_REGULAR_EXPRESSIONS + * This switch turns off regular expressions. + * + * @stable ICU 2.4 + */ +#ifndef UCONFIG_NO_REGULAR_EXPRESSIONS +# define UCONFIG_NO_REGULAR_EXPRESSIONS 0 +#endif + +/** + * \def UCONFIG_NO_SERVICE + * This switch turns off service registration. + * + * @stable ICU 3.2 + */ +#ifndef UCONFIG_NO_SERVICE +# define UCONFIG_NO_SERVICE 0 +#endif + +/** + * \def UCONFIG_HAVE_PARSEALLINPUT + * This switch turns on the "parse all input" attribute. Binary incompatible. + * + * @internal + */ +#ifndef UCONFIG_HAVE_PARSEALLINPUT +# define UCONFIG_HAVE_PARSEALLINPUT 1 +#endif + + +/** + * \def UCONFIG_FORMAT_FASTPATHS_49 + * This switch turns on other formatting fastpaths. Binary incompatible in object DecimalFormat and DecimalFormatSymbols + * + * @internal + */ +#ifndef UCONFIG_FORMAT_FASTPATHS_49 +# define UCONFIG_FORMAT_FASTPATHS_49 1 +#endif + +/** + * \def UCONFIG_NO_FILTERED_BREAK_ITERATION + * This switch turns off filtered break iteration code. + * + * @internal + */ +#ifndef UCONFIG_NO_FILTERED_BREAK_ITERATION +# define UCONFIG_NO_FILTERED_BREAK_ITERATION 0 +#endif + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ucsdet.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucsdet.h new file mode 100644 index 0000000..52ed5ad --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucsdet.h @@ -0,0 +1,419 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ********************************************************************** + * Copyright (C) 2005-2013, International Business Machines + * Corporation and others. All Rights Reserved. + ********************************************************************** + * file name: ucsdet.h + * encoding: UTF-8 + * indentation:4 + * + * created on: 2005Aug04 + * created by: Andy Heninger + * + * ICU Character Set Detection, API for C + * + * Draft version 18 Oct 2005 + * + */ + +#ifndef __UCSDET_H +#define __UCSDET_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_CONVERSION + +#include "unicode/localpointer.h" +#include "unicode/uenum.h" + +/** + * \file + * \brief C API: Charset Detection API + * + * This API provides a facility for detecting the + * charset or encoding of character data in an unknown text format. + * The input data can be from an array of bytes. + *

+ * Character set detection is at best an imprecise operation. The detection + * process will attempt to identify the charset that best matches the characteristics + * of the byte data, but the process is partly statistical in nature, and + * the results can not be guaranteed to always be correct. + *

+ * For best accuracy in charset detection, the input data should be primarily + * in a single language, and a minimum of a few hundred bytes worth of plain text + * in the language are needed. The detection process will attempt to + * ignore html or xml style markup that could otherwise obscure the content. + *

+ * An alternative to the ICU Charset Detector is the + * Compact Encoding Detector, https://github.com/google/compact_enc_det. + * It often gives more accurate results, especially with short input samples. + */ + + +struct UCharsetDetector; +/** + * Structure representing a charset detector + * @stable ICU 3.6 + */ +typedef struct UCharsetDetector UCharsetDetector; + +struct UCharsetMatch; +/** + * Opaque structure representing a match that was identified + * from a charset detection operation. + * @stable ICU 3.6 + */ +typedef struct UCharsetMatch UCharsetMatch; + +/** + * Open a charset detector. + * + * @param status Any error conditions occurring during the open + * operation are reported back in this variable. + * @return the newly opened charset detector. + * @stable ICU 3.6 + */ +U_STABLE UCharsetDetector * U_EXPORT2 +ucsdet_open(UErrorCode *status); + +/** + * Close a charset detector. All storage and any other resources + * owned by this charset detector will be released. Failure to + * close a charset detector when finished with it can result in + * memory leaks in the application. + * + * @param ucsd The charset detector to be closed. + * @stable ICU 3.6 + */ +U_STABLE void U_EXPORT2 +ucsdet_close(UCharsetDetector *ucsd); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUCharsetDetectorPointer + * "Smart pointer" class, closes a UCharsetDetector via ucsdet_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUCharsetDetectorPointer, UCharsetDetector, ucsdet_close); + +U_NAMESPACE_END + +#endif + +/** + * Set the input byte data whose charset is to detected. + * + * Ownership of the input text byte array remains with the caller. + * The input string must not be altered or deleted until the charset + * detector is either closed or reset to refer to different input text. + * + * @param ucsd the charset detector to be used. + * @param textIn the input text of unknown encoding. . + * @param len the length of the input text, or -1 if the text + * is NUL terminated. + * @param status any error conditions are reported back in this variable. + * + * @stable ICU 3.6 + */ +U_STABLE void U_EXPORT2 +ucsdet_setText(UCharsetDetector *ucsd, const char *textIn, int32_t len, UErrorCode *status); + + +/** Set the declared encoding for charset detection. + * The declared encoding of an input text is an encoding obtained + * by the user from an http header or xml declaration or similar source that + * can be provided as an additional hint to the charset detector. + * + * How and whether the declared encoding will be used during the + * detection process is TBD. + * + * @param ucsd the charset detector to be used. + * @param encoding an encoding for the current data obtained from + * a header or declaration or other source outside + * of the byte data itself. + * @param length the length of the encoding name, or -1 if the name string + * is NUL terminated. + * @param status any error conditions are reported back in this variable. + * + * @stable ICU 3.6 + */ +U_STABLE void U_EXPORT2 +ucsdet_setDeclaredEncoding(UCharsetDetector *ucsd, const char *encoding, int32_t length, UErrorCode *status); + + +/** + * Return the charset that best matches the supplied input data. + * + * Note though, that because the detection + * only looks at the start of the input data, + * there is a possibility that the returned charset will fail to handle + * the full set of input data. + *

+ * The returned UCharsetMatch object is owned by the UCharsetDetector. + * It will remain valid until the detector input is reset, or until + * the detector is closed. + *

+ * The function will fail if + *

    + *
  • no charset appears to match the data.
  • + *
  • no input text has been provided
  • + *
+ * + * @param ucsd the charset detector to be used. + * @param status any error conditions are reported back in this variable. + * @return a UCharsetMatch representing the best matching charset, + * or NULL if no charset matches the byte data. + * + * @stable ICU 3.6 + */ +U_STABLE const UCharsetMatch * U_EXPORT2 +ucsdet_detect(UCharsetDetector *ucsd, UErrorCode *status); + + +/** + * Find all charset matches that appear to be consistent with the input, + * returning an array of results. The results are ordered with the + * best quality match first. + * + * Because the detection only looks at a limited amount of the + * input byte data, some of the returned charsets may fail to handle + * the all of input data. + *

+ * The returned UCharsetMatch objects are owned by the UCharsetDetector. + * They will remain valid until the detector is closed or modified + * + *

+ * Return an error if + *

    + *
  • no charsets appear to match the input data.
  • + *
  • no input text has been provided
  • + *
+ * + * @param ucsd the charset detector to be used. + * @param matchesFound pointer to a variable that will be set to the + * number of charsets identified that are consistent with + * the input data. Output only. + * @param status any error conditions are reported back in this variable. + * @return A pointer to an array of pointers to UCharSetMatch objects. + * This array, and the UCharSetMatch instances to which it refers, + * are owned by the UCharsetDetector, and will remain valid until + * the detector is closed or modified. + * @stable ICU 3.6 + */ +U_STABLE const UCharsetMatch ** U_EXPORT2 +ucsdet_detectAll(UCharsetDetector *ucsd, int32_t *matchesFound, UErrorCode *status); + + + +/** + * Get the name of the charset represented by a UCharsetMatch. + * + * The storage for the returned name string is owned by the + * UCharsetMatch, and will remain valid while the UCharsetMatch + * is valid. + * + * The name returned is suitable for use with the ICU conversion APIs. + * + * @param ucsm The charset match object. + * @param status Any error conditions are reported back in this variable. + * @return The name of the matching charset. + * + * @stable ICU 3.6 + */ +U_STABLE const char * U_EXPORT2 +ucsdet_getName(const UCharsetMatch *ucsm, UErrorCode *status); + +/** + * Get a confidence number for the quality of the match of the byte + * data with the charset. Confidence numbers range from zero to 100, + * with 100 representing complete confidence and zero representing + * no confidence. + * + * The confidence values are somewhat arbitrary. They define an + * an ordering within the results for any single detection operation + * but are not generally comparable between the results for different input. + * + * A confidence value of ten does have a general meaning - it is used + * for charsets that can represent the input data, but for which there + * is no other indication that suggests that the charset is the correct one. + * Pure 7 bit ASCII data, for example, is compatible with a + * great many charsets, most of which will appear as possible matches + * with a confidence of 10. + * + * @param ucsm The charset match object. + * @param status Any error conditions are reported back in this variable. + * @return A confidence number for the charset match. + * + * @stable ICU 3.6 + */ +U_STABLE int32_t U_EXPORT2 +ucsdet_getConfidence(const UCharsetMatch *ucsm, UErrorCode *status); + +/** + * Get the RFC 3066 code for the language of the input data. + * + * The Charset Detection service is intended primarily for detecting + * charsets, not language. For some, but not all, charsets, a language is + * identified as a byproduct of the detection process, and that is what + * is returned by this function. + * + * CAUTION: + * 1. Language information is not available for input data encoded in + * all charsets. In particular, no language is identified + * for UTF-8 input data. + * + * 2. Closely related languages may sometimes be confused. + * + * If more accurate language detection is required, a linguistic + * analysis package should be used. + * + * The storage for the returned name string is owned by the + * UCharsetMatch, and will remain valid while the UCharsetMatch + * is valid. + * + * @param ucsm The charset match object. + * @param status Any error conditions are reported back in this variable. + * @return The RFC 3066 code for the language of the input data, or + * an empty string if the language could not be determined. + * + * @stable ICU 3.6 + */ +U_STABLE const char * U_EXPORT2 +ucsdet_getLanguage(const UCharsetMatch *ucsm, UErrorCode *status); + + +/** + * Get the entire input text as a UChar string, placing it into + * a caller-supplied buffer. A terminating + * NUL character will be appended to the buffer if space is available. + * + * The number of UChars in the output string, not including the terminating + * NUL, is returned. + * + * If the supplied buffer is smaller than required to hold the output, + * the contents of the buffer are undefined. The full output string length + * (in UChars) is returned as always, and can be used to allocate a buffer + * of the correct size. + * + * + * @param ucsm The charset match object. + * @param buf A UChar buffer to be filled with the converted text data. + * @param cap The capacity of the buffer in UChars. + * @param status Any error conditions are reported back in this variable. + * @return The number of UChars in the output string. + * + * @stable ICU 3.6 + */ +U_STABLE int32_t U_EXPORT2 +ucsdet_getUChars(const UCharsetMatch *ucsm, + UChar *buf, int32_t cap, UErrorCode *status); + + + +/** + * Get an iterator over the set of all detectable charsets - + * over the charsets that are known to the charset detection + * service. + * + * The returned UEnumeration provides access to the names of + * the charsets. + * + *

+ * The state of the Charset detector that is passed in does not + * affect the result of this function, but requiring a valid, open + * charset detector as a parameter insures that the charset detection + * service has been safely initialized and that the required detection + * data is available. + * + *

+ * Note: Multiple different charset encodings in a same family may use + * a single shared name in this implementation. For example, this method returns + * an array including "ISO-8859-1" (ISO Latin 1), but not including "windows-1252" + * (Windows Latin 1). However, actual detection result could be "windows-1252" + * when the input data matches Latin 1 code points with any points only available + * in "windows-1252". + * + * @param ucsd a Charset detector. + * @param status Any error conditions are reported back in this variable. + * @return an iterator providing access to the detectable charset names. + * @stable ICU 3.6 + */ +U_STABLE UEnumeration * U_EXPORT2 +ucsdet_getAllDetectableCharsets(const UCharsetDetector *ucsd, UErrorCode *status); + +/** + * Test whether input filtering is enabled for this charset detector. + * Input filtering removes text that appears to be HTML or xml + * markup from the input before applying the code page detection + * heuristics. + * + * @param ucsd The charset detector to check. + * @return TRUE if filtering is enabled. + * @stable ICU 3.6 + */ + +U_STABLE UBool U_EXPORT2 +ucsdet_isInputFilterEnabled(const UCharsetDetector *ucsd); + + +/** + * Enable filtering of input text. If filtering is enabled, + * text within angle brackets ("<" and ">") will be removed + * before detection, which will remove most HTML or xml markup. + * + * @param ucsd the charset detector to be modified. + * @param filter true to enable input text filtering. + * @return The previous setting. + * + * @stable ICU 3.6 + */ +U_STABLE UBool U_EXPORT2 +ucsdet_enableInputFilter(UCharsetDetector *ucsd, UBool filter); + +#ifndef U_HIDE_INTERNAL_API +/** + * Get an iterator over the set of detectable charsets - + * over the charsets that are enabled by the specified charset detector. + * + * The returned UEnumeration provides access to the names of + * the charsets. + * + * @param ucsd a Charset detector. + * @param status Any error conditions are reported back in this variable. + * @return an iterator providing access to the detectable charset names by + * the specified charset detector. + * @internal + */ +U_INTERNAL UEnumeration * U_EXPORT2 +ucsdet_getDetectableCharsets(const UCharsetDetector *ucsd, UErrorCode *status); + +/** + * Enable or disable individual charset encoding. + * A name of charset encoding must be included in the names returned by + * {@link #ucsdet_getAllDetectableCharsets()}. + * + * @param ucsd a Charset detector. + * @param encoding encoding the name of charset encoding. + * @param enabled TRUE to enable, or FALSE to disable the + * charset encoding. + * @param status receives the return status. When the name of charset encoding + * is not supported, U_ILLEGAL_ARGUMENT_ERROR is set. + * @internal + */ +U_INTERNAL void U_EXPORT2 +ucsdet_setDetectableCharset(UCharsetDetector *ucsd, const char *encoding, UBool enabled, UErrorCode *status); +#endif /* U_HIDE_INTERNAL_API */ + +#endif +#endif /* __UCSDET_H */ + + diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ucurr.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucurr.h new file mode 100644 index 0000000..1abb3b2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ucurr.h @@ -0,0 +1,420 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2002-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +*/ +#ifndef _UCURR_H_ +#define _UCURR_H_ + +#include "unicode/utypes.h" +#include "unicode/uenum.h" + +/** + * \file + * \brief C API: Encapsulates information about a currency. + * + * The ucurr API encapsulates information about a currency, as defined by + * ISO 4217. A currency is represented by a 3-character string + * containing its ISO 4217 code. This API can return various data + * necessary the proper display of a currency: + * + *

  • A display symbol, for a specific locale + *
  • The number of fraction digits to display + *
  • A rounding increment + *
+ * + * The DecimalFormat class uses these data to display + * currencies. + * @author Alan Liu + * @since ICU 2.2 + */ + +#if !UCONFIG_NO_FORMATTING + +/** + * Currency Usage used for Decimal Format + * @stable ICU 54 + */ +enum UCurrencyUsage { + /** + * a setting to specify currency usage which determines currency digit + * and rounding for standard usage, for example: "50.00 NT$" + * used as DEFAULT value + * @stable ICU 54 + */ + UCURR_USAGE_STANDARD=0, + /** + * a setting to specify currency usage which determines currency digit + * and rounding for cash usage, for example: "50 NT$" + * @stable ICU 54 + */ + UCURR_USAGE_CASH=1, +#ifndef U_HIDE_DEPRECATED_API + /** + * One higher than the last enum UCurrencyUsage constant. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UCURR_USAGE_COUNT=2 +#endif // U_HIDE_DEPRECATED_API +}; +typedef enum UCurrencyUsage UCurrencyUsage; + +/** + * Finds a currency code for the given locale. + * @param locale the locale for which to retrieve a currency code. + * Currency can be specified by the "currency" keyword + * in which case it overrides the default currency code + * @param buff fill in buffer. Can be NULL for preflighting. + * @param buffCapacity capacity of the fill in buffer. Can be 0 for + * preflighting. If it is non-zero, the buff parameter + * must not be NULL. + * @param ec error code + * @return length of the currency string. It should always be 3. If 0, + * currency couldn't be found or the input values are + * invalid. + * @stable ICU 2.8 + */ +U_STABLE int32_t U_EXPORT2 +ucurr_forLocale(const char* locale, + UChar* buff, + int32_t buffCapacity, + UErrorCode* ec); + +/** + * Selector constants for ucurr_getName(). + * + * @see ucurr_getName + * @stable ICU 2.6 + */ +typedef enum UCurrNameStyle { + /** + * Selector for ucurr_getName indicating a symbolic name for a + * currency, such as "$" for USD. + * @stable ICU 2.6 + */ + UCURR_SYMBOL_NAME, + + /** + * Selector for ucurr_getName indicating the long name for a + * currency, such as "US Dollar" for USD. + * @stable ICU 2.6 + */ + UCURR_LONG_NAME +} UCurrNameStyle; + +#if !UCONFIG_NO_SERVICE +/** + * @stable ICU 2.6 + */ +typedef const void* UCurrRegistryKey; + +/** + * Register an (existing) ISO 4217 currency code for the given locale. + * Only the country code and the two variants EURO and PRE_EURO are + * recognized. + * @param isoCode the three-letter ISO 4217 currency code + * @param locale the locale for which to register this currency code + * @param status the in/out status code + * @return a registry key that can be used to unregister this currency code, or NULL + * if there was an error. + * @stable ICU 2.6 + */ +U_STABLE UCurrRegistryKey U_EXPORT2 +ucurr_register(const UChar* isoCode, + const char* locale, + UErrorCode* status); +/** + * Unregister the previously-registered currency definitions using the + * URegistryKey returned from ucurr_register. Key becomes invalid after + * a successful call and should not be used again. Any currency + * that might have been hidden by the original ucurr_register call is + * restored. + * @param key the registry key returned by a previous call to ucurr_register + * @param status the in/out status code, no special meanings are assigned + * @return TRUE if the currency for this key was successfully unregistered + * @stable ICU 2.6 + */ +U_STABLE UBool U_EXPORT2 +ucurr_unregister(UCurrRegistryKey key, UErrorCode* status); +#endif /* UCONFIG_NO_SERVICE */ + +/** + * Returns the display name for the given currency in the + * given locale. For example, the display name for the USD + * currency object in the en_US locale is "$". + * @param currency null-terminated 3-letter ISO 4217 code + * @param locale locale in which to display currency + * @param nameStyle selector for which kind of name to return + * @param isChoiceFormat fill-in set to TRUE if the returned value + * is a ChoiceFormat pattern; otherwise it is a static string + * @param len fill-in parameter to receive length of result + * @param ec error code + * @return pointer to display string of 'len' UChars. If the resource + * data contains no entry for 'currency', then 'currency' itself is + * returned. If *isChoiceFormat is TRUE, then the result is a + * ChoiceFormat pattern. Otherwise it is a static string. + * @stable ICU 2.6 + */ +U_STABLE const UChar* U_EXPORT2 +ucurr_getName(const UChar* currency, + const char* locale, + UCurrNameStyle nameStyle, + UBool* isChoiceFormat, + int32_t* len, + UErrorCode* ec); + +/** + * Returns the plural name for the given currency in the + * given locale. For example, the plural name for the USD + * currency object in the en_US locale is "US dollar" or "US dollars". + * @param currency null-terminated 3-letter ISO 4217 code + * @param locale locale in which to display currency + * @param isChoiceFormat fill-in set to TRUE if the returned value + * is a ChoiceFormat pattern; otherwise it is a static string + * @param pluralCount plural count + * @param len fill-in parameter to receive length of result + * @param ec error code + * @return pointer to display string of 'len' UChars. If the resource + * data contains no entry for 'currency', then 'currency' itself is + * returned. + * @stable ICU 4.2 + */ +U_STABLE const UChar* U_EXPORT2 +ucurr_getPluralName(const UChar* currency, + const char* locale, + UBool* isChoiceFormat, + const char* pluralCount, + int32_t* len, + UErrorCode* ec); + +/** + * Returns the number of the number of fraction digits that should + * be displayed for the given currency. + * This is equivalent to ucurr_getDefaultFractionDigitsForUsage(currency,UCURR_USAGE_STANDARD,ec); + * @param currency null-terminated 3-letter ISO 4217 code + * @param ec input-output error code + * @return a non-negative number of fraction digits to be + * displayed, or 0 if there is an error + * @stable ICU 3.0 + */ +U_STABLE int32_t U_EXPORT2 +ucurr_getDefaultFractionDigits(const UChar* currency, + UErrorCode* ec); + +/** + * Returns the number of the number of fraction digits that should + * be displayed for the given currency with usage. + * @param currency null-terminated 3-letter ISO 4217 code + * @param usage enum usage for the currency + * @param ec input-output error code + * @return a non-negative number of fraction digits to be + * displayed, or 0 if there is an error + * @stable ICU 54 + */ +U_STABLE int32_t U_EXPORT2 +ucurr_getDefaultFractionDigitsForUsage(const UChar* currency, + const UCurrencyUsage usage, + UErrorCode* ec); + +/** + * Returns the rounding increment for the given currency, or 0.0 if no + * rounding is done by the currency. + * This is equivalent to ucurr_getRoundingIncrementForUsage(currency,UCURR_USAGE_STANDARD,ec); + * @param currency null-terminated 3-letter ISO 4217 code + * @param ec input-output error code + * @return the non-negative rounding increment, or 0.0 if none, + * or 0.0 if there is an error + * @stable ICU 3.0 + */ +U_STABLE double U_EXPORT2 +ucurr_getRoundingIncrement(const UChar* currency, + UErrorCode* ec); + +/** + * Returns the rounding increment for the given currency, or 0.0 if no + * rounding is done by the currency given usage. + * @param currency null-terminated 3-letter ISO 4217 code + * @param usage enum usage for the currency + * @param ec input-output error code + * @return the non-negative rounding increment, or 0.0 if none, + * or 0.0 if there is an error + * @stable ICU 54 + */ +U_STABLE double U_EXPORT2 +ucurr_getRoundingIncrementForUsage(const UChar* currency, + const UCurrencyUsage usage, + UErrorCode* ec); + +/** + * Selector constants for ucurr_openCurrencies(). + * + * @see ucurr_openCurrencies + * @stable ICU 3.2 + */ +typedef enum UCurrCurrencyType { + /** + * Select all ISO-4217 currency codes. + * @stable ICU 3.2 + */ + UCURR_ALL = INT32_MAX, + /** + * Select only ISO-4217 commonly used currency codes. + * These currencies can be found in common use, and they usually have + * bank notes or coins associated with the currency code. + * This does not include fund codes, precious metals and other + * various ISO-4217 codes limited to special financial products. + * @stable ICU 3.2 + */ + UCURR_COMMON = 1, + /** + * Select ISO-4217 uncommon currency codes. + * These codes respresent fund codes, precious metals and other + * various ISO-4217 codes limited to special financial products. + * A fund code is a monetary resource associated with a currency. + * @stable ICU 3.2 + */ + UCURR_UNCOMMON = 2, + /** + * Select only deprecated ISO-4217 codes. + * These codes are no longer in general public use. + * @stable ICU 3.2 + */ + UCURR_DEPRECATED = 4, + /** + * Select only non-deprecated ISO-4217 codes. + * These codes are in general public use. + * @stable ICU 3.2 + */ + UCURR_NON_DEPRECATED = 8 +} UCurrCurrencyType; + +/** + * Provides a UEnumeration object for listing ISO-4217 codes. + * @param currType You can use one of several UCurrCurrencyType values for this + * variable. You can also | (or) them together to get a specific list of + * currencies. Most people will want to use the (UCURR_CURRENCY|UCURR_NON_DEPRECATED) value to + * get a list of current currencies. + * @param pErrorCode Error code + * @stable ICU 3.2 + */ +U_STABLE UEnumeration * U_EXPORT2 +ucurr_openISOCurrencies(uint32_t currType, UErrorCode *pErrorCode); + +/** + * Queries if the given ISO 4217 3-letter code is available on the specified date range. + * + * Note: For checking availability of a currency on a specific date, specify the date on both 'from' and 'to' + * + * When 'from' is U_DATE_MIN and 'to' is U_DATE_MAX, this method checks if the specified currency is available any time. + * If 'from' and 'to' are same UDate value, this method checks if the specified currency is available on that date. + * + * @param isoCode + * The ISO 4217 3-letter code. + * + * @param from + * The lower bound of the date range, inclusive. When 'from' is U_DATE_MIN, check the availability + * of the currency any date before 'to' + * + * @param to + * The upper bound of the date range, inclusive. When 'to' is U_DATE_MAX, check the availability of + * the currency any date after 'from' + * + * @param errorCode + * ICU error code + * + * @return TRUE if the given ISO 4217 3-letter code is supported on the specified date range. + * + * @stable ICU 4.8 + */ +U_STABLE UBool U_EXPORT2 +ucurr_isAvailable(const UChar* isoCode, + UDate from, + UDate to, + UErrorCode* errorCode); + +/** + * Finds the number of valid currency codes for the + * given locale and date. + * @param locale the locale for which to retrieve the + * currency count. + * @param date the date for which to retrieve the + * currency count for the given locale. + * @param ec error code + * @return the number of currency codes for the + * given locale and date. If 0, currency + * codes couldn't be found for the input + * values are invalid. + * @stable ICU 4.0 + */ +U_STABLE int32_t U_EXPORT2 +ucurr_countCurrencies(const char* locale, + UDate date, + UErrorCode* ec); + +/** + * Finds a currency code for the given locale and date + * @param locale the locale for which to retrieve a currency code. + * Currency can be specified by the "currency" keyword + * in which case it overrides the default currency code + * @param date the date for which to retrieve a currency code for + * the given locale. + * @param index the index within the available list of currency codes + * for the given locale on the given date. + * @param buff fill in buffer. Can be NULL for preflighting. + * @param buffCapacity capacity of the fill in buffer. Can be 0 for + * preflighting. If it is non-zero, the buff parameter + * must not be NULL. + * @param ec error code + * @return length of the currency string. It should always be 3. + * If 0, currency couldn't be found or the input values are + * invalid. + * @stable ICU 4.0 + */ +U_STABLE int32_t U_EXPORT2 +ucurr_forLocaleAndDate(const char* locale, + UDate date, + int32_t index, + UChar* buff, + int32_t buffCapacity, + UErrorCode* ec); + +/** + * Given a key and a locale, returns an array of string values in a preferred + * order that would make a difference. These are all and only those values where + * the open (creation) of the service with the locale formed from the input locale + * plus input keyword and that value has different behavior than creation with the + * input locale alone. + * @param key one of the keys supported by this service. For now, only + * "currency" is supported. + * @param locale the locale + * @param commonlyUsed if set to true it will return only commonly used values + * with the given locale in preferred order. Otherwise, + * it will return all the available values for the locale. + * @param status error status + * @return a string enumeration over keyword values for the given key and the locale. + * @stable ICU 4.2 + */ +U_STABLE UEnumeration* U_EXPORT2 +ucurr_getKeywordValuesForLocale(const char* key, + const char* locale, + UBool commonlyUsed, + UErrorCode* status); + +/** + * Returns the ISO 4217 numeric code for the currency. + *

Note: If the ISO 4217 numeric code is not assigned for the currency or + * the currency is unknown, this function returns 0. + * + * @param currency null-terminated 3-letter ISO 4217 code + * @return The ISO 4217 numeric code of the currency + * @stable ICU 49 + */ +U_STABLE int32_t U_EXPORT2 +ucurr_getNumericCode(const UChar* currency); + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/udat.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/udat.h new file mode 100644 index 0000000..90aff20 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/udat.h @@ -0,0 +1,1660 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ******************************************************************************* + * Copyright (C) 1996-2016, International Business Machines + * Corporation and others. All Rights Reserved. + ******************************************************************************* +*/ + +#ifndef UDAT_H +#define UDAT_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/localpointer.h" +#include "unicode/ucal.h" +#include "unicode/unum.h" +#include "unicode/udisplaycontext.h" +#include "unicode/ufieldpositer.h" +/** + * \file + * \brief C API: DateFormat + * + *

Date Format C API

+ * + * Date Format C API consists of functions that convert dates and + * times from their internal representations to textual form and back again in a + * language-independent manner. Converting from the internal representation (milliseconds + * since midnight, January 1, 1970) to text is known as "formatting," and converting + * from text to millis is known as "parsing." We currently define only one concrete + * structure UDateFormat, which can handle pretty much all normal + * date formatting and parsing actions. + *

+ * Date Format helps you to format and parse dates for any locale. Your code can + * be completely independent of the locale conventions for months, days of the + * week, or even the calendar format: lunar vs. solar. + *

+ * To format a date for the current Locale with default time and date style, + * use one of the static factory methods: + *

+ * \code
+ *  UErrorCode status = U_ZERO_ERROR;
+ *  UChar *myString;
+ *  int32_t myStrlen = 0;
+ *  UDateFormat* dfmt = udat_open(UDAT_DEFAULT, UDAT_DEFAULT, NULL, NULL, -1, NULL, -1, &status);
+ *  myStrlen = udat_format(dfmt, myDate, NULL, myStrlen, NULL, &status);
+ *  if (status==U_BUFFER_OVERFLOW_ERROR){
+ *      status=U_ZERO_ERROR;
+ *      myString=(UChar*)malloc(sizeof(UChar) * (myStrlen+1) );
+ *      udat_format(dfmt, myDate, myString, myStrlen+1, NULL, &status);
+ *  }
+ * \endcode
+ * 
+ * If you are formatting multiple numbers, it is more efficient to get the + * format and use it multiple times so that the system doesn't have to fetch the + * information about the local language and country conventions multiple times. + *
+ * \code
+ *  UErrorCode status = U_ZERO_ERROR;
+ *  int32_t i, myStrlen = 0;
+ *  UChar* myString;
+ *  char buffer[1024];
+ *  UDate myDateArr[] = { 0.0, 100000000.0, 2000000000.0 }; // test values
+ *  UDateFormat* df = udat_open(UDAT_DEFAULT, UDAT_DEFAULT, NULL, NULL, -1, NULL, 0, &status);
+ *  for (i = 0; i < 3; i++) {
+ *      myStrlen = udat_format(df, myDateArr[i], NULL, myStrlen, NULL, &status);
+ *      if(status == U_BUFFER_OVERFLOW_ERROR){
+ *          status = U_ZERO_ERROR;
+ *          myString = (UChar*)malloc(sizeof(UChar) * (myStrlen+1) );
+ *          udat_format(df, myDateArr[i], myString, myStrlen+1, NULL, &status);
+ *          printf("%s\n", u_austrcpy(buffer, myString) );
+ *          free(myString);
+ *      }
+ *  }
+ * \endcode
+ * 
+ * To get specific fields of a date, you can use UFieldPosition to + * get specific fields. + *
+ * \code
+ *  UErrorCode status = U_ZERO_ERROR;
+ *  UFieldPosition pos;
+ *  UChar *myString;
+ *  int32_t myStrlen = 0;
+ *  char buffer[1024];
+ *
+ *  pos.field = 1;  // Same as the DateFormat::EField enum
+ *  UDateFormat* dfmt = udat_open(UDAT_DEFAULT, UDAT_DEFAULT, NULL, -1, NULL, 0, &status);
+ *  myStrlen = udat_format(dfmt, myDate, NULL, myStrlen, &pos, &status);
+ *  if (status==U_BUFFER_OVERFLOW_ERROR){
+ *      status=U_ZERO_ERROR;
+ *      myString=(UChar*)malloc(sizeof(UChar) * (myStrlen+1) );
+ *      udat_format(dfmt, myDate, myString, myStrlen+1, &pos, &status);
+ *  }
+ *  printf("date format: %s\n", u_austrcpy(buffer, myString));
+ *  buffer[pos.endIndex] = 0;   // NULL terminate the string.
+ *  printf("UFieldPosition position equals %s\n", &buffer[pos.beginIndex]);
+ * \endcode
+ * 
+ * To format a date for a different Locale, specify it in the call to + * udat_open() + *
+ * \code
+ *        UDateFormat* df = udat_open(UDAT_SHORT, UDAT_SHORT, "fr_FR", NULL, -1, NULL, 0, &status);
+ * \endcode
+ * 
+ * You can use a DateFormat API udat_parse() to parse. + *
+ * \code
+ *  UErrorCode status = U_ZERO_ERROR;
+ *  int32_t parsepos=0;
+ *  UDate myDate = udat_parse(df, myString, u_strlen(myString), &parsepos, &status);
+ * \endcode
+ * 
+ * You can pass in different options for the arguments for date and time style + * to control the length of the result; from SHORT to MEDIUM to LONG to FULL. + * The exact result depends on the locale, but generally: + * see UDateFormatStyle for more details + *
    + *
  • UDAT_SHORT is completely numeric, such as 12/13/52 or 3:30pm + *
  • UDAT_MEDIUM is longer, such as Jan 12, 1952 + *
  • UDAT_LONG is longer, such as January 12, 1952 or 3:30:32pm + *
  • UDAT_FULL is pretty completely specified, such as + * Tuesday, April 12, 1952 AD or 3:30:42pm PST. + *
+ * You can also set the time zone on the format if you wish. + *

+ * You can also use forms of the parse and format methods with Parse Position and + * UFieldPosition to allow you to + *

    + *
  • Progressively parse through pieces of a string. + *
  • Align any particular field, or find out where it is for selection + * on the screen. + *
+ *

Date and Time Patterns:

+ * + *

Date and time formats are specified by date and time pattern strings. + * Within date and time pattern strings, all unquoted ASCII letters [A-Za-z] are reserved + * as pattern letters representing calendar fields. UDateFormat supports + * the date and time formatting algorithm and pattern letters defined by + * UTS#35 + * Unicode Locale Data Markup Language (LDML) and further documented for ICU in the + * ICU + * User Guide.

+ */ + +/** A date formatter. + * For usage in C programs. + * @stable ICU 2.6 + */ +typedef void* UDateFormat; + +/** The possible date/time format styles + * @stable ICU 2.6 + */ +typedef enum UDateFormatStyle { + /** Full style */ + UDAT_FULL, + /** Long style */ + UDAT_LONG, + /** Medium style */ + UDAT_MEDIUM, + /** Short style */ + UDAT_SHORT, + /** Default style */ + UDAT_DEFAULT = UDAT_MEDIUM, + + /** Bitfield for relative date */ + UDAT_RELATIVE = (1 << 7), + + UDAT_FULL_RELATIVE = UDAT_FULL | UDAT_RELATIVE, + + UDAT_LONG_RELATIVE = UDAT_LONG | UDAT_RELATIVE, + + UDAT_MEDIUM_RELATIVE = UDAT_MEDIUM | UDAT_RELATIVE, + + UDAT_SHORT_RELATIVE = UDAT_SHORT | UDAT_RELATIVE, + + + /** No style */ + UDAT_NONE = -1, + + /** + * Use the pattern given in the parameter to udat_open + * @see udat_open + * @stable ICU 50 + */ + UDAT_PATTERN = -2, + +#ifndef U_HIDE_INTERNAL_API + /** @internal alias to UDAT_PATTERN */ + UDAT_IGNORE = UDAT_PATTERN +#endif /* U_HIDE_INTERNAL_API */ +} UDateFormatStyle; + +/* Skeletons for dates. */ + +/** + * Constant for date skeleton with year. + * @stable ICU 4.0 + */ +#define UDAT_YEAR "y" +/** + * Constant for date skeleton with quarter. + * @stable ICU 51 + */ +#define UDAT_QUARTER "QQQQ" +/** + * Constant for date skeleton with abbreviated quarter. + * @stable ICU 51 + */ +#define UDAT_ABBR_QUARTER "QQQ" +/** + * Constant for date skeleton with year and quarter. + * @stable ICU 4.0 + */ +#define UDAT_YEAR_QUARTER "yQQQQ" +/** + * Constant for date skeleton with year and abbreviated quarter. + * @stable ICU 4.0 + */ +#define UDAT_YEAR_ABBR_QUARTER "yQQQ" +/** + * Constant for date skeleton with month. + * @stable ICU 4.0 + */ +#define UDAT_MONTH "MMMM" +/** + * Constant for date skeleton with abbreviated month. + * @stable ICU 4.0 + */ +#define UDAT_ABBR_MONTH "MMM" +/** + * Constant for date skeleton with numeric month. + * @stable ICU 4.0 + */ +#define UDAT_NUM_MONTH "M" +/** + * Constant for date skeleton with year and month. + * @stable ICU 4.0 + */ +#define UDAT_YEAR_MONTH "yMMMM" +/** + * Constant for date skeleton with year and abbreviated month. + * @stable ICU 4.0 + */ +#define UDAT_YEAR_ABBR_MONTH "yMMM" +/** + * Constant for date skeleton with year and numeric month. + * @stable ICU 4.0 + */ +#define UDAT_YEAR_NUM_MONTH "yM" +/** + * Constant for date skeleton with day. + * @stable ICU 4.0 + */ +#define UDAT_DAY "d" +/** + * Constant for date skeleton with year, month, and day. + * Used in combinations date + time, date + time + zone, or time + zone. + * @stable ICU 4.0 + */ +#define UDAT_YEAR_MONTH_DAY "yMMMMd" +/** + * Constant for date skeleton with year, abbreviated month, and day. + * Used in combinations date + time, date + time + zone, or time + zone. + * @stable ICU 4.0 + */ +#define UDAT_YEAR_ABBR_MONTH_DAY "yMMMd" +/** + * Constant for date skeleton with year, numeric month, and day. + * Used in combinations date + time, date + time + zone, or time + zone. + * @stable ICU 4.0 + */ +#define UDAT_YEAR_NUM_MONTH_DAY "yMd" +/** + * Constant for date skeleton with weekday. + * @stable ICU 51 + */ +#define UDAT_WEEKDAY "EEEE" +/** + * Constant for date skeleton with abbreviated weekday. + * @stable ICU 51 + */ +#define UDAT_ABBR_WEEKDAY "E" +/** + * Constant for date skeleton with year, month, weekday, and day. + * Used in combinations date + time, date + time + zone, or time + zone. + * @stable ICU 4.0 + */ +#define UDAT_YEAR_MONTH_WEEKDAY_DAY "yMMMMEEEEd" +/** + * Constant for date skeleton with year, abbreviated month, weekday, and day. + * Used in combinations date + time, date + time + zone, or time + zone. + * @stable ICU 4.0 + */ +#define UDAT_YEAR_ABBR_MONTH_WEEKDAY_DAY "yMMMEd" +/** + * Constant for date skeleton with year, numeric month, weekday, and day. + * Used in combinations date + time, date + time + zone, or time + zone. + * @stable ICU 4.0 + */ +#define UDAT_YEAR_NUM_MONTH_WEEKDAY_DAY "yMEd" +/** + * Constant for date skeleton with long month and day. + * Used in combinations date + time, date + time + zone, or time + zone. + * @stable ICU 4.0 + */ +#define UDAT_MONTH_DAY "MMMMd" +/** + * Constant for date skeleton with abbreviated month and day. + * Used in combinations date + time, date + time + zone, or time + zone. + * @stable ICU 4.0 + */ +#define UDAT_ABBR_MONTH_DAY "MMMd" +/** + * Constant for date skeleton with numeric month and day. + * Used in combinations date + time, date + time + zone, or time + zone. + * @stable ICU 4.0 + */ +#define UDAT_NUM_MONTH_DAY "Md" +/** + * Constant for date skeleton with month, weekday, and day. + * Used in combinations date + time, date + time + zone, or time + zone. + * @stable ICU 4.0 + */ +#define UDAT_MONTH_WEEKDAY_DAY "MMMMEEEEd" +/** + * Constant for date skeleton with abbreviated month, weekday, and day. + * Used in combinations date + time, date + time + zone, or time + zone. + * @stable ICU 4.0 + */ +#define UDAT_ABBR_MONTH_WEEKDAY_DAY "MMMEd" +/** + * Constant for date skeleton with numeric month, weekday, and day. + * Used in combinations date + time, date + time + zone, or time + zone. + * @stable ICU 4.0 + */ +#define UDAT_NUM_MONTH_WEEKDAY_DAY "MEd" + +/* Skeletons for times. */ + +/** + * Constant for date skeleton with hour, with the locale's preferred hour format (12 or 24). + * @stable ICU 4.0 + */ +#define UDAT_HOUR "j" +/** + * Constant for date skeleton with hour in 24-hour presentation. + * @stable ICU 51 + */ +#define UDAT_HOUR24 "H" +/** + * Constant for date skeleton with minute. + * @stable ICU 51 + */ +#define UDAT_MINUTE "m" +/** + * Constant for date skeleton with hour and minute, with the locale's preferred hour format (12 or 24). + * Used in combinations date + time, date + time + zone, or time + zone. + * @stable ICU 4.0 + */ +#define UDAT_HOUR_MINUTE "jm" +/** + * Constant for date skeleton with hour and minute in 24-hour presentation. + * Used in combinations date + time, date + time + zone, or time + zone. + * @stable ICU 4.0 + */ +#define UDAT_HOUR24_MINUTE "Hm" +/** + * Constant for date skeleton with second. + * @stable ICU 51 + */ +#define UDAT_SECOND "s" +/** + * Constant for date skeleton with hour, minute, and second, + * with the locale's preferred hour format (12 or 24). + * Used in combinations date + time, date + time + zone, or time + zone. + * @stable ICU 4.0 + */ +#define UDAT_HOUR_MINUTE_SECOND "jms" +/** + * Constant for date skeleton with hour, minute, and second in + * 24-hour presentation. + * Used in combinations date + time, date + time + zone, or time + zone. + * @stable ICU 4.0 + */ +#define UDAT_HOUR24_MINUTE_SECOND "Hms" +/** + * Constant for date skeleton with minute and second. + * Used in combinations date + time, date + time + zone, or time + zone. + * @stable ICU 4.0 + */ +#define UDAT_MINUTE_SECOND "ms" + +/* Skeletons for time zones. */ + +/** + * Constant for generic location format, such as Los Angeles Time; + * used in combinations date + time + zone, or time + zone. + * @see LDML Date Format Patterns + * @see LDML Time Zone Fallback + * @stable ICU 51 + */ +#define UDAT_LOCATION_TZ "VVVV" +/** + * Constant for generic non-location format, such as Pacific Time; + * used in combinations date + time + zone, or time + zone. + * @see LDML Date Format Patterns + * @see LDML Time Zone Fallback + * @stable ICU 51 + */ +#define UDAT_GENERIC_TZ "vvvv" +/** + * Constant for generic non-location format, abbreviated if possible, such as PT; + * used in combinations date + time + zone, or time + zone. + * @see LDML Date Format Patterns + * @see LDML Time Zone Fallback + * @stable ICU 51 + */ +#define UDAT_ABBR_GENERIC_TZ "v" +/** + * Constant for specific non-location format, such as Pacific Daylight Time; + * used in combinations date + time + zone, or time + zone. + * @see LDML Date Format Patterns + * @see LDML Time Zone Fallback + * @stable ICU 51 + */ +#define UDAT_SPECIFIC_TZ "zzzz" +/** + * Constant for specific non-location format, abbreviated if possible, such as PDT; + * used in combinations date + time + zone, or time + zone. + * @see LDML Date Format Patterns + * @see LDML Time Zone Fallback + * @stable ICU 51 + */ +#define UDAT_ABBR_SPECIFIC_TZ "z" +/** + * Constant for localized GMT/UTC format, such as GMT+8:00 or HPG-8:00; + * used in combinations date + time + zone, or time + zone. + * @see LDML Date Format Patterns + * @see LDML Time Zone Fallback + * @stable ICU 51 + */ +#define UDAT_ABBR_UTC_TZ "ZZZZ" + +/* deprecated skeleton constants */ + +#ifndef U_HIDE_DEPRECATED_API +/** + * Constant for date skeleton with standalone month. + * @deprecated ICU 50 Use UDAT_MONTH instead. + */ +#define UDAT_STANDALONE_MONTH "LLLL" +/** + * Constant for date skeleton with standalone abbreviated month. + * @deprecated ICU 50 Use UDAT_ABBR_MONTH instead. + */ +#define UDAT_ABBR_STANDALONE_MONTH "LLL" + +/** + * Constant for date skeleton with hour, minute, and generic timezone. + * @deprecated ICU 50 Use instead UDAT_HOUR_MINUTE UDAT_ABBR_GENERIC_TZ or some other timezone presentation. + */ +#define UDAT_HOUR_MINUTE_GENERIC_TZ "jmv" +/** + * Constant for date skeleton with hour, minute, and timezone. + * @deprecated ICU 50 Use instead UDAT_HOUR_MINUTE UDAT_ABBR_SPECIFIC_TZ or some other timezone presentation. + */ +#define UDAT_HOUR_MINUTE_TZ "jmz" +/** + * Constant for date skeleton with hour and generic timezone. + * @deprecated ICU 50 Use instead UDAT_HOUR UDAT_ABBR_GENERIC_TZ or some other timezone presentation. + */ +#define UDAT_HOUR_GENERIC_TZ "jv" +/** + * Constant for date skeleton with hour and timezone. + * @deprecated ICU 50 Use instead UDAT_HOUR UDAT_ABBR_SPECIFIC_TZ or some other timezone presentation. + */ +#define UDAT_HOUR_TZ "jz" +#endif /* U_HIDE_DEPRECATED_API */ + +/** + * FieldPosition and UFieldPosition selectors for format fields + * defined by DateFormat and UDateFormat. + * @stable ICU 3.0 + */ +typedef enum UDateFormatField { + /** + * FieldPosition and UFieldPosition selector for 'G' field alignment, + * corresponding to the UCAL_ERA field. + * @stable ICU 3.0 + */ + UDAT_ERA_FIELD = 0, + + /** + * FieldPosition and UFieldPosition selector for 'y' field alignment, + * corresponding to the UCAL_YEAR field. + * @stable ICU 3.0 + */ + UDAT_YEAR_FIELD = 1, + + /** + * FieldPosition and UFieldPosition selector for 'M' field alignment, + * corresponding to the UCAL_MONTH field. + * @stable ICU 3.0 + */ + UDAT_MONTH_FIELD = 2, + + /** + * FieldPosition and UFieldPosition selector for 'd' field alignment, + * corresponding to the UCAL_DATE field. + * @stable ICU 3.0 + */ + UDAT_DATE_FIELD = 3, + + /** + * FieldPosition and UFieldPosition selector for 'k' field alignment, + * corresponding to the UCAL_HOUR_OF_DAY field. + * UDAT_HOUR_OF_DAY1_FIELD is used for the one-based 24-hour clock. + * For example, 23:59 + 01:00 results in 24:59. + * @stable ICU 3.0 + */ + UDAT_HOUR_OF_DAY1_FIELD = 4, + + /** + * FieldPosition and UFieldPosition selector for 'H' field alignment, + * corresponding to the UCAL_HOUR_OF_DAY field. + * UDAT_HOUR_OF_DAY0_FIELD is used for the zero-based 24-hour clock. + * For example, 23:59 + 01:00 results in 00:59. + * @stable ICU 3.0 + */ + UDAT_HOUR_OF_DAY0_FIELD = 5, + + /** + * FieldPosition and UFieldPosition selector for 'm' field alignment, + * corresponding to the UCAL_MINUTE field. + * @stable ICU 3.0 + */ + UDAT_MINUTE_FIELD = 6, + + /** + * FieldPosition and UFieldPosition selector for 's' field alignment, + * corresponding to the UCAL_SECOND field. + * @stable ICU 3.0 + */ + UDAT_SECOND_FIELD = 7, + + /** + * FieldPosition and UFieldPosition selector for 'S' field alignment, + * corresponding to the UCAL_MILLISECOND field. + * + * Note: Time formats that use 'S' can display a maximum of three + * significant digits for fractional seconds, corresponding to millisecond + * resolution and a fractional seconds sub-pattern of SSS. If the + * sub-pattern is S or SS, the fractional seconds value will be truncated + * (not rounded) to the number of display places specified. If the + * fractional seconds sub-pattern is longer than SSS, the additional + * display places will be filled with zeros. + * @stable ICU 3.0 + */ + UDAT_FRACTIONAL_SECOND_FIELD = 8, + + /** + * FieldPosition and UFieldPosition selector for 'E' field alignment, + * corresponding to the UCAL_DAY_OF_WEEK field. + * @stable ICU 3.0 + */ + UDAT_DAY_OF_WEEK_FIELD = 9, + + /** + * FieldPosition and UFieldPosition selector for 'D' field alignment, + * corresponding to the UCAL_DAY_OF_YEAR field. + * @stable ICU 3.0 + */ + UDAT_DAY_OF_YEAR_FIELD = 10, + + /** + * FieldPosition and UFieldPosition selector for 'F' field alignment, + * corresponding to the UCAL_DAY_OF_WEEK_IN_MONTH field. + * @stable ICU 3.0 + */ + UDAT_DAY_OF_WEEK_IN_MONTH_FIELD = 11, + + /** + * FieldPosition and UFieldPosition selector for 'w' field alignment, + * corresponding to the UCAL_WEEK_OF_YEAR field. + * @stable ICU 3.0 + */ + UDAT_WEEK_OF_YEAR_FIELD = 12, + + /** + * FieldPosition and UFieldPosition selector for 'W' field alignment, + * corresponding to the UCAL_WEEK_OF_MONTH field. + * @stable ICU 3.0 + */ + UDAT_WEEK_OF_MONTH_FIELD = 13, + + /** + * FieldPosition and UFieldPosition selector for 'a' field alignment, + * corresponding to the UCAL_AM_PM field. + * @stable ICU 3.0 + */ + UDAT_AM_PM_FIELD = 14, + + /** + * FieldPosition and UFieldPosition selector for 'h' field alignment, + * corresponding to the UCAL_HOUR field. + * UDAT_HOUR1_FIELD is used for the one-based 12-hour clock. + * For example, 11:30 PM + 1 hour results in 12:30 AM. + * @stable ICU 3.0 + */ + UDAT_HOUR1_FIELD = 15, + + /** + * FieldPosition and UFieldPosition selector for 'K' field alignment, + * corresponding to the UCAL_HOUR field. + * UDAT_HOUR0_FIELD is used for the zero-based 12-hour clock. + * For example, 11:30 PM + 1 hour results in 00:30 AM. + * @stable ICU 3.0 + */ + UDAT_HOUR0_FIELD = 16, + + /** + * FieldPosition and UFieldPosition selector for 'z' field alignment, + * corresponding to the UCAL_ZONE_OFFSET and + * UCAL_DST_OFFSET fields. + * @stable ICU 3.0 + */ + UDAT_TIMEZONE_FIELD = 17, + + /** + * FieldPosition and UFieldPosition selector for 'Y' field alignment, + * corresponding to the UCAL_YEAR_WOY field. + * @stable ICU 3.0 + */ + UDAT_YEAR_WOY_FIELD = 18, + + /** + * FieldPosition and UFieldPosition selector for 'e' field alignment, + * corresponding to the UCAL_DOW_LOCAL field. + * @stable ICU 3.0 + */ + UDAT_DOW_LOCAL_FIELD = 19, + + /** + * FieldPosition and UFieldPosition selector for 'u' field alignment, + * corresponding to the UCAL_EXTENDED_YEAR field. + * @stable ICU 3.0 + */ + UDAT_EXTENDED_YEAR_FIELD = 20, + + /** + * FieldPosition and UFieldPosition selector for 'g' field alignment, + * corresponding to the UCAL_JULIAN_DAY field. + * @stable ICU 3.0 + */ + UDAT_JULIAN_DAY_FIELD = 21, + + /** + * FieldPosition and UFieldPosition selector for 'A' field alignment, + * corresponding to the UCAL_MILLISECONDS_IN_DAY field. + * @stable ICU 3.0 + */ + UDAT_MILLISECONDS_IN_DAY_FIELD = 22, + + /** + * FieldPosition and UFieldPosition selector for 'Z' field alignment, + * corresponding to the UCAL_ZONE_OFFSET and + * UCAL_DST_OFFSET fields. + * @stable ICU 3.0 + */ + UDAT_TIMEZONE_RFC_FIELD = 23, + + /** + * FieldPosition and UFieldPosition selector for 'v' field alignment, + * corresponding to the UCAL_ZONE_OFFSET field. + * @stable ICU 3.4 + */ + UDAT_TIMEZONE_GENERIC_FIELD = 24, + /** + * FieldPosition selector for 'c' field alignment, + * corresponding to the {@link #UCAL_DOW_LOCAL} field. + * This displays the stand alone day name, if available. + * @stable ICU 3.4 + */ + UDAT_STANDALONE_DAY_FIELD = 25, + + /** + * FieldPosition selector for 'L' field alignment, + * corresponding to the {@link #UCAL_MONTH} field. + * This displays the stand alone month name, if available. + * @stable ICU 3.4 + */ + UDAT_STANDALONE_MONTH_FIELD = 26, + + /** + * FieldPosition selector for "Q" field alignment, + * corresponding to quarters. This is implemented + * using the {@link #UCAL_MONTH} field. This + * displays the quarter. + * @stable ICU 3.6 + */ + UDAT_QUARTER_FIELD = 27, + + /** + * FieldPosition selector for the "q" field alignment, + * corresponding to stand-alone quarters. This is + * implemented using the {@link #UCAL_MONTH} field. + * This displays the stand-alone quarter. + * @stable ICU 3.6 + */ + UDAT_STANDALONE_QUARTER_FIELD = 28, + + /** + * FieldPosition and UFieldPosition selector for 'V' field alignment, + * corresponding to the UCAL_ZONE_OFFSET field. + * @stable ICU 3.8 + */ + UDAT_TIMEZONE_SPECIAL_FIELD = 29, + + /** + * FieldPosition selector for "U" field alignment, + * corresponding to cyclic year names. This is implemented + * using the {@link #UCAL_YEAR} field. This displays + * the cyclic year name, if available. + * @stable ICU 49 + */ + UDAT_YEAR_NAME_FIELD = 30, + + /** + * FieldPosition selector for 'O' field alignment, + * corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OFFSETfields. + * This displays the localized GMT format. + * @stable ICU 51 + */ + UDAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD = 31, + + /** + * FieldPosition selector for 'X' field alignment, + * corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OFFSETfields. + * This displays the ISO 8601 local time offset format or UTC indicator ("Z"). + * @stable ICU 51 + */ + UDAT_TIMEZONE_ISO_FIELD = 32, + + /** + * FieldPosition selector for 'x' field alignment, + * corresponding to the UCAL_ZONE_OFFSET and UCAL_DST_OFFSET fields. + * This displays the ISO 8601 local time offset format. + * @stable ICU 51 + */ + UDAT_TIMEZONE_ISO_LOCAL_FIELD = 33, + +#ifndef U_HIDE_INTERNAL_API + /** + * FieldPosition and UFieldPosition selector for 'r' field alignment, + * no directly corresponding UCAL_ field. + * @internal ICU 53 + */ + UDAT_RELATED_YEAR_FIELD = 34, +#endif /* U_HIDE_INTERNAL_API */ + + /** + * FieldPosition selector for 'b' field alignment. + * Displays midnight and noon for 12am and 12pm, respectively, if available; + * otherwise fall back to AM / PM. + * @stable ICU 57 + */ + UDAT_AM_PM_MIDNIGHT_NOON_FIELD = 35, + + /* FieldPosition selector for 'B' field alignment. + * Displays flexible day periods, such as "in the morning", if available. + * @stable ICU 57 + */ + UDAT_FLEXIBLE_DAY_PERIOD_FIELD = 36, + +#ifndef U_HIDE_INTERNAL_API + /** + * FieldPosition and UFieldPosition selector for time separator, + * no corresponding UCAL_ field. No pattern character is currently + * defined for this. + * @internal + */ + UDAT_TIME_SEPARATOR_FIELD = 37, +#endif /* U_HIDE_INTERNAL_API */ + +#ifndef U_HIDE_DEPRECATED_API + /** + * Number of FieldPosition and UFieldPosition selectors for + * DateFormat and UDateFormat. + * Valid selectors range from 0 to UDAT_FIELD_COUNT-1. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UDAT_FIELD_COUNT = 38 +#endif /* U_HIDE_DEPRECATED_API */ +} UDateFormatField; + + +#ifndef U_HIDE_INTERNAL_API +/** + * Is a pattern character defined for UDAT_TIME_SEPARATOR_FIELD? + * In ICU 55 it was COLON, but that was withdrawn in ICU 56. + * @internal ICU 56 + */ +#define UDAT_HAS_PATTERN_CHAR_FOR_TIME_SEPARATOR 0 +#endif /* U_HIDE_INTERNAL_API */ + + +/** + * Maps from a UDateFormatField to the corresponding UCalendarDateFields. + * Note: since the mapping is many-to-one, there is no inverse mapping. + * @param field the UDateFormatField. + * @return the UCalendarDateField. This will be UCAL_FIELD_COUNT in case + * of error (e.g., the input field is UDAT_FIELD_COUNT). + * @stable ICU 4.4 + */ +U_CAPI UCalendarDateFields U_EXPORT2 +udat_toCalendarDateField(UDateFormatField field); + + +/** + * Open a new UDateFormat for formatting and parsing dates and times. + * A UDateFormat may be used to format dates in calls to {@link #udat_format }, + * and to parse dates in calls to {@link #udat_parse }. + * @param timeStyle The style used to format times; one of UDAT_FULL, UDAT_LONG, + * UDAT_MEDIUM, UDAT_SHORT, UDAT_DEFAULT, or UDAT_NONE (relative time styles + * are not currently supported). + * When the pattern parameter is used, pass in UDAT_PATTERN for both timeStyle and dateStyle. + * @param dateStyle The style used to format dates; one of UDAT_FULL, UDAT_LONG, + * UDAT_MEDIUM, UDAT_SHORT, UDAT_DEFAULT, UDAT_FULL_RELATIVE, UDAT_LONG_RELATIVE, + * UDAT_MEDIUM_RELATIVE, UDAT_SHORT_RELATIVE, or UDAT_NONE. + * When the pattern parameter is used, pass in UDAT_PATTERN for both timeStyle and dateStyle. + * As currently implemented, + * relative date formatting only affects a limited range of calendar days before or + * after the current date, based on the CLDR <field type="day">/<relative> data: For + * example, in English, "Yesterday", "Today", and "Tomorrow". Outside of this range, + * dates are formatted using the corresponding non-relative style. + * @param locale The locale specifying the formatting conventions + * @param tzID A timezone ID specifying the timezone to use. If 0, use + * the default timezone. + * @param tzIDLength The length of tzID, or -1 if null-terminated. + * @param pattern A pattern specifying the format to use. + * @param patternLength The number of characters in the pattern, or -1 if null-terminated. + * @param status A pointer to an UErrorCode to receive any errors + * @return A pointer to a UDateFormat to use for formatting dates and times, or 0 if + * an error occurred. + * @stable ICU 2.0 + */ +U_CAPI UDateFormat* U_EXPORT2 +udat_open(UDateFormatStyle timeStyle, + UDateFormatStyle dateStyle, + const char *locale, + const UChar *tzID, + int32_t tzIDLength, + const UChar *pattern, + int32_t patternLength, + UErrorCode *status); + + +/** +* Close a UDateFormat. +* Once closed, a UDateFormat may no longer be used. +* @param format The formatter to close. +* @stable ICU 2.0 +*/ +U_CAPI void U_EXPORT2 +udat_close(UDateFormat* format); + + +/** + * DateFormat boolean attributes + * + * @stable ICU 53 + */ +typedef enum UDateFormatBooleanAttribute { + /** + * indicates whether whitespace is allowed. Includes trailing dot tolerance. + * @stable ICU 53 + */ + UDAT_PARSE_ALLOW_WHITESPACE = 0, + /** + * indicates tolerance of numeric data when String data may be assumed. eg: UDAT_YEAR_NAME_FIELD, + * UDAT_STANDALONE_MONTH_FIELD, UDAT_DAY_OF_WEEK_FIELD + * @stable ICU 53 + */ + UDAT_PARSE_ALLOW_NUMERIC = 1, + /** + * indicates tolerance of a partial literal match + * e.g. accepting "--mon-02-march-2011" for a pattern of "'--: 'EEE-WW-MMMM-yyyy" + * @stable ICU 56 + */ + UDAT_PARSE_PARTIAL_LITERAL_MATCH = 2, + /** + * indicates tolerance of pattern mismatch between input data and specified format pattern. + * e.g. accepting "September" for a month pattern of MMM ("Sep") + * @stable ICU 56 + */ + UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH = 3, + + /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API, + * it is needed for layout of DateFormat object. */ + /** + * One more than the highest normal UDateFormatBooleanAttribute value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UDAT_BOOLEAN_ATTRIBUTE_COUNT = 4 +} UDateFormatBooleanAttribute; + +/** + * Get a boolean attribute associated with a UDateFormat. + * An example would be a true value for a key of UDAT_PARSE_ALLOW_WHITESPACE indicating allowing whitespace leniency. + * If the formatter does not understand the attribute, -1 is returned. + * @param fmt The formatter to query. + * @param attr The attribute to query; e.g. UDAT_PARSE_ALLOW_WHITESPACE. + * @param status A pointer to an UErrorCode to receive any errors + * @return The value of attr. + * @stable ICU 53 + */ +U_CAPI UBool U_EXPORT2 +udat_getBooleanAttribute(const UDateFormat* fmt, UDateFormatBooleanAttribute attr, UErrorCode* status); + +/** + * Set a boolean attribute associated with a UDateFormat. + * An example of a boolean attribute is parse leniency control. If the formatter does not understand + * the attribute, the call is ignored. + * @param fmt The formatter to set. + * @param attr The attribute to set; one of UDAT_PARSE_ALLOW_WHITESPACE or UDAT_PARSE_ALLOW_NUMERIC + * @param newValue The new value of attr. + * @param status A pointer to an UErrorCode to receive any errors + * @stable ICU 53 + */ +U_CAPI void U_EXPORT2 +udat_setBooleanAttribute(UDateFormat *fmt, UDateFormatBooleanAttribute attr, UBool newValue, UErrorCode* status); + + + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUDateFormatPointer + * "Smart pointer" class, closes a UDateFormat via udat_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateFormatPointer, UDateFormat, udat_close); + +U_NAMESPACE_END + +#endif + +/** + * Open a copy of a UDateFormat. + * This function performs a deep copy. + * @param fmt The format to copy + * @param status A pointer to an UErrorCode to receive any errors. + * @return A pointer to a UDateFormat identical to fmt. + * @stable ICU 2.0 + */ +U_CAPI UDateFormat* U_EXPORT2 +udat_clone(const UDateFormat *fmt, + UErrorCode *status); + +/** +* Format a date using a UDateFormat. +* The date will be formatted using the conventions specified in {@link #udat_open } +* @param format The formatter to use +* @param dateToFormat The date to format +* @param result A pointer to a buffer to receive the formatted number. +* @param resultLength The maximum size of result. +* @param position A pointer to a UFieldPosition. On input, position->field +* is read. On output, position->beginIndex and position->endIndex indicate +* the beginning and ending indices of field number position->field, if such +* a field exists. This parameter may be NULL, in which case no field +* position data is returned. +* @param status A pointer to an UErrorCode to receive any errors +* @return The total buffer size needed; if greater than resultLength, the output was truncated. +* @see udat_parse +* @see UFieldPosition +* @stable ICU 2.0 +*/ +U_CAPI int32_t U_EXPORT2 +udat_format( const UDateFormat* format, + UDate dateToFormat, + UChar* result, + int32_t resultLength, + UFieldPosition* position, + UErrorCode* status); + +/** +* Format a date using an UDateFormat. +* The date will be formatted using the conventions specified in {@link #udat_open } +* @param format The formatter to use +* @param calendar The calendar to format. The calendar instance might be +* mutated if fields are not yet fully calculated, though +* the function won't change the logical date and time held +* by the instance. +* @param result A pointer to a buffer to receive the formatted number. +* @param capacity The maximum size of result. +* @param position A pointer to a UFieldPosition. On input, position->field +* is read. On output, position->beginIndex and position->endIndex indicate +* the beginning and ending indices of field number position->field, if such +* a field exists. This parameter may be NULL, in which case no field +* position data is returned. +* @param status A pointer to an UErrorCode to receive any errors +* @return The total buffer size needed; if greater than resultLength, the output was truncated. +* @see udat_format +* @see udat_parseCalendar +* @see UFieldPosition +* @stable ICU 55 +*/ +U_CAPI int32_t U_EXPORT2 +udat_formatCalendar( const UDateFormat* format, + UCalendar* calendar, + UChar* result, + int32_t capacity, + UFieldPosition* position, + UErrorCode* status); + +/** +* Format a date using a UDateFormat. +* The date will be formatted using the conventions specified in {@link #udat_open} +* @param format +* The formatter to use +* @param dateToFormat +* The date to format +* @param result +* A pointer to a buffer to receive the formatted number. +* @param resultLength +* The maximum size of result. +* @param fpositer +* A pointer to a UFieldPositionIterator created by {@link #ufieldpositer_open} +* (may be NULL if field position information is not needed). Any +* iteration information already present in the UFieldPositionIterator +* will be deleted, and the iterator will be reset to apply to the +* fields in the formatted string created by this function call; the +* field values provided by {@link #ufieldpositer_next} will be from the +* UDateFormatField enum. +* @param status +* A pointer to a UErrorCode to receive any errors +* @return +* The total buffer size needed; if greater than resultLength, the output was truncated. +* @see udat_parse +* @see UFieldPositionIterator +* @stable ICU 55 +*/ +U_CAPI int32_t U_EXPORT2 +udat_formatForFields( const UDateFormat* format, + UDate dateToFormat, + UChar* result, + int32_t resultLength, + UFieldPositionIterator* fpositer, + UErrorCode* status); + +/** +* Format a date using a UDateFormat. +* The date will be formatted using the conventions specified in {@link #udat_open } +* @param format +* The formatter to use +* @param calendar +* The calendar to format. The calendar instance might be mutated if fields +* are not yet fully calculated, though the function won't change the logical +* date and time held by the instance. +* @param result +* A pointer to a buffer to receive the formatted number. +* @param capacity +* The maximum size of result. +* @param fpositer +* A pointer to a UFieldPositionIterator created by {@link #ufieldpositer_open} +* (may be NULL if field position information is not needed). Any +* iteration information already present in the UFieldPositionIterator +* will be deleted, and the iterator will be reset to apply to the +* fields in the formatted string created by this function call; the +* field values provided by {@link #ufieldpositer_next} will be from the +* UDateFormatField enum. +* @param status +* A pointer to a UErrorCode to receive any errors +* @return +* The total buffer size needed; if greater than resultLength, the output was truncated. +* @see udat_format +* @see udat_parseCalendar +* @see UFieldPositionIterator +* @stable ICU 55 +*/ +U_CAPI int32_t U_EXPORT2 +udat_formatCalendarForFields( const UDateFormat* format, + UCalendar* calendar, + UChar* result, + int32_t capacity, + UFieldPositionIterator* fpositer, + UErrorCode* status); + + +/** +* Parse a string into an date/time using a UDateFormat. +* The date will be parsed using the conventions specified in {@link #udat_open }. +*

+* Note that the normal date formats associated with some calendars - such +* as the Chinese lunar calendar - do not specify enough fields to enable +* dates to be parsed unambiguously. In the case of the Chinese lunar +* calendar, while the year within the current 60-year cycle is specified, +* the number of such cycles since the start date of the calendar (in the +* UCAL_ERA field of the UCalendar object) is not normally part of the format, +* and parsing may assume the wrong era. For cases such as this it is +* recommended that clients parse using udat_parseCalendar with the UCalendar +* passed in set to the current date, or to a date within the era/cycle that +* should be assumed if absent in the format. +* +* @param format The formatter to use. +* @param text The text to parse. +* @param textLength The length of text, or -1 if null-terminated. +* @param parsePos If not 0, on input a pointer to an integer specifying the offset at which +* to begin parsing. If not 0, on output the offset at which parsing ended. +* @param status A pointer to an UErrorCode to receive any errors +* @return The value of the parsed date/time +* @see udat_format +* @stable ICU 2.0 +*/ +U_CAPI UDate U_EXPORT2 +udat_parse(const UDateFormat* format, + const UChar* text, + int32_t textLength, + int32_t *parsePos, + UErrorCode *status); + +/** +* Parse a string into an date/time using a UDateFormat. +* The date will be parsed using the conventions specified in {@link #udat_open }. +* @param format The formatter to use. +* @param calendar A calendar set on input to the date and time to be used for +* missing values in the date/time string being parsed, and set +* on output to the parsed date/time. When the calendar type is +* different from the internal calendar held by the UDateFormat +* instance, the internal calendar will be cloned to a work +* calendar set to the same milliseconds and time zone as this +* calendar parameter, field values will be parsed based on the +* work calendar, then the result (milliseconds and time zone) +* will be set in this calendar. +* @param text The text to parse. +* @param textLength The length of text, or -1 if null-terminated. +* @param parsePos If not 0, on input a pointer to an integer specifying the offset at which +* to begin parsing. If not 0, on output the offset at which parsing ended. +* @param status A pointer to an UErrorCode to receive any errors +* @see udat_format +* @stable ICU 2.0 +*/ +U_CAPI void U_EXPORT2 +udat_parseCalendar(const UDateFormat* format, + UCalendar* calendar, + const UChar* text, + int32_t textLength, + int32_t *parsePos, + UErrorCode *status); + +/** +* Determine if an UDateFormat will perform lenient parsing. +* With lenient parsing, the parser may use heuristics to interpret inputs that do not +* precisely match the pattern. With strict parsing, inputs must match the pattern. +* @param fmt The formatter to query +* @return TRUE if fmt is set to perform lenient parsing, FALSE otherwise. +* @see udat_setLenient +* @stable ICU 2.0 +*/ +U_CAPI UBool U_EXPORT2 +udat_isLenient(const UDateFormat* fmt); + +/** +* Specify whether an UDateFormat will perform lenient parsing. +* With lenient parsing, the parser may use heuristics to interpret inputs that do not +* precisely match the pattern. With strict parsing, inputs must match the pattern. +* @param fmt The formatter to set +* @param isLenient TRUE if fmt should perform lenient parsing, FALSE otherwise. +* @see dat_isLenient +* @stable ICU 2.0 +*/ +U_CAPI void U_EXPORT2 +udat_setLenient( UDateFormat* fmt, + UBool isLenient); + +/** +* Get the UCalendar associated with an UDateFormat. +* A UDateFormat uses a UCalendar to convert a raw value to, for example, +* the day of the week. +* @param fmt The formatter to query. +* @return A pointer to the UCalendar used by fmt. +* @see udat_setCalendar +* @stable ICU 2.0 +*/ +U_CAPI const UCalendar* U_EXPORT2 +udat_getCalendar(const UDateFormat* fmt); + +/** +* Set the UCalendar associated with an UDateFormat. +* A UDateFormat uses a UCalendar to convert a raw value to, for example, +* the day of the week. +* @param fmt The formatter to set. +* @param calendarToSet A pointer to an UCalendar to be used by fmt. +* @see udat_setCalendar +* @stable ICU 2.0 +*/ +U_CAPI void U_EXPORT2 +udat_setCalendar( UDateFormat* fmt, + const UCalendar* calendarToSet); + +/** +* Get the UNumberFormat associated with an UDateFormat. +* A UDateFormat uses a UNumberFormat to format numbers within a date, +* for example the day number. +* @param fmt The formatter to query. +* @return A pointer to the UNumberFormat used by fmt to format numbers. +* @see udat_setNumberFormat +* @stable ICU 2.0 +*/ +U_CAPI const UNumberFormat* U_EXPORT2 +udat_getNumberFormat(const UDateFormat* fmt); + +/** +* Get the UNumberFormat for specific field associated with an UDateFormat. +* For example: 'y' for year and 'M' for month +* @param fmt The formatter to query. +* @param field the field to query +* @return A pointer to the UNumberFormat used by fmt to format field numbers. +* @see udat_setNumberFormatForField +* @stable ICU 54 +*/ +U_CAPI const UNumberFormat* U_EXPORT2 +udat_getNumberFormatForField(const UDateFormat* fmt, UChar field); + +/** +* Set the UNumberFormat for specific field associated with an UDateFormat. +* It can be a single field like: "y"(year) or "M"(month) +* It can be several field combined together: "yM"(year and month) +* Note: +* 1 symbol field is enough for multiple symbol field (so "y" will override "yy", "yyy") +* If the field is not numeric, then override has no effect (like "MMM" will use abbreviation, not numerical field) +* +* @param fields the fields to set +* @param fmt The formatter to set. +* @param numberFormatToSet A pointer to the UNumberFormat to be used by fmt to format numbers. +* @param status error code passed around (memory allocation or invalid fields) +* @see udat_getNumberFormatForField +* @stable ICU 54 +*/ +U_CAPI void U_EXPORT2 +udat_adoptNumberFormatForFields( UDateFormat* fmt, + const UChar* fields, + UNumberFormat* numberFormatToSet, + UErrorCode* status); +/** +* Set the UNumberFormat associated with an UDateFormat. +* A UDateFormat uses a UNumberFormat to format numbers within a date, +* for example the day number. +* This method also clears per field NumberFormat instances previously +* set by {@see udat_setNumberFormatForField} +* @param fmt The formatter to set. +* @param numberFormatToSet A pointer to the UNumberFormat to be used by fmt to format numbers. +* @see udat_getNumberFormat +* @see udat_setNumberFormatForField +* @stable ICU 2.0 +*/ +U_CAPI void U_EXPORT2 +udat_setNumberFormat( UDateFormat* fmt, + const UNumberFormat* numberFormatToSet); +/** +* Adopt the UNumberFormat associated with an UDateFormat. +* A UDateFormat uses a UNumberFormat to format numbers within a date, +* for example the day number. +* @param fmt The formatter to set. +* @param numberFormatToAdopt A pointer to the UNumberFormat to be used by fmt to format numbers. +* @see udat_getNumberFormat +* @stable ICU 54 +*/ +U_CAPI void U_EXPORT2 +udat_adoptNumberFormat( UDateFormat* fmt, + UNumberFormat* numberFormatToAdopt); +/** +* Get a locale for which date/time formatting patterns are available. +* A UDateFormat in a locale returned by this function will perform the correct +* formatting and parsing for the locale. +* @param localeIndex The index of the desired locale. +* @return A locale for which date/time formatting patterns are available, or 0 if none. +* @see udat_countAvailable +* @stable ICU 2.0 +*/ +U_CAPI const char* U_EXPORT2 +udat_getAvailable(int32_t localeIndex); + +/** +* Determine how many locales have date/time formatting patterns available. +* This function is most useful as determining the loop ending condition for +* calls to {@link #udat_getAvailable }. +* @return The number of locales for which date/time formatting patterns are available. +* @see udat_getAvailable +* @stable ICU 2.0 +*/ +U_CAPI int32_t U_EXPORT2 +udat_countAvailable(void); + +/** +* Get the year relative to which all 2-digit years are interpreted. +* For example, if the 2-digit start year is 2100, the year 99 will be +* interpreted as 2199. +* @param fmt The formatter to query. +* @param status A pointer to an UErrorCode to receive any errors +* @return The year relative to which all 2-digit years are interpreted. +* @see udat_Set2DigitYearStart +* @stable ICU 2.0 +*/ +U_CAPI UDate U_EXPORT2 +udat_get2DigitYearStart( const UDateFormat *fmt, + UErrorCode *status); + +/** +* Set the year relative to which all 2-digit years will be interpreted. +* For example, if the 2-digit start year is 2100, the year 99 will be +* interpreted as 2199. +* @param fmt The formatter to set. +* @param d The year relative to which all 2-digit years will be interpreted. +* @param status A pointer to an UErrorCode to receive any errors +* @see udat_Set2DigitYearStart +* @stable ICU 2.0 +*/ +U_CAPI void U_EXPORT2 +udat_set2DigitYearStart( UDateFormat *fmt, + UDate d, + UErrorCode *status); + +/** +* Extract the pattern from a UDateFormat. +* The pattern will follow the pattern syntax rules. +* @param fmt The formatter to query. +* @param localized TRUE if the pattern should be localized, FALSE otherwise. +* @param result A pointer to a buffer to receive the pattern. +* @param resultLength The maximum size of result. +* @param status A pointer to an UErrorCode to receive any errors +* @return The total buffer size needed; if greater than resultLength, the output was truncated. +* @see udat_applyPattern +* @stable ICU 2.0 +*/ +U_CAPI int32_t U_EXPORT2 +udat_toPattern( const UDateFormat *fmt, + UBool localized, + UChar *result, + int32_t resultLength, + UErrorCode *status); + +/** +* Set the pattern used by an UDateFormat. +* The pattern should follow the pattern syntax rules. +* @param format The formatter to set. +* @param localized TRUE if the pattern is localized, FALSE otherwise. +* @param pattern The new pattern +* @param patternLength The length of pattern, or -1 if null-terminated. +* @see udat_toPattern +* @stable ICU 2.0 +*/ +U_CAPI void U_EXPORT2 +udat_applyPattern( UDateFormat *format, + UBool localized, + const UChar *pattern, + int32_t patternLength); + +/** + * The possible types of date format symbols + * @stable ICU 2.6 + */ +typedef enum UDateFormatSymbolType { + /** The era names, for example AD */ + UDAT_ERAS, + /** The month names, for example February */ + UDAT_MONTHS, + /** The short month names, for example Feb. */ + UDAT_SHORT_MONTHS, + /** The CLDR-style format "wide" weekday names, for example Monday */ + UDAT_WEEKDAYS, + /** + * The CLDR-style format "abbreviated" (not "short") weekday names, for example "Mon." + * For the CLDR-style format "short" weekday names, use UDAT_SHORTER_WEEKDAYS. + */ + UDAT_SHORT_WEEKDAYS, + /** The AM/PM names, for example AM */ + UDAT_AM_PMS, + /** The localized characters */ + UDAT_LOCALIZED_CHARS, + /** The long era names, for example Anno Domini */ + UDAT_ERA_NAMES, + /** The narrow month names, for example F */ + UDAT_NARROW_MONTHS, + /** The CLDR-style format "narrow" weekday names, for example "M" */ + UDAT_NARROW_WEEKDAYS, + /** Standalone context versions of months */ + UDAT_STANDALONE_MONTHS, + UDAT_STANDALONE_SHORT_MONTHS, + UDAT_STANDALONE_NARROW_MONTHS, + /** The CLDR-style stand-alone "wide" weekday names */ + UDAT_STANDALONE_WEEKDAYS, + /** + * The CLDR-style stand-alone "abbreviated" (not "short") weekday names. + * For the CLDR-style stand-alone "short" weekday names, use UDAT_STANDALONE_SHORTER_WEEKDAYS. + */ + UDAT_STANDALONE_SHORT_WEEKDAYS, + /** The CLDR-style stand-alone "narrow" weekday names */ + UDAT_STANDALONE_NARROW_WEEKDAYS, + /** The quarters, for example 1st Quarter */ + UDAT_QUARTERS, + /** The short quarter names, for example Q1 */ + UDAT_SHORT_QUARTERS, + /** Standalone context versions of quarters */ + UDAT_STANDALONE_QUARTERS, + UDAT_STANDALONE_SHORT_QUARTERS, + /** + * The CLDR-style short weekday names, e.g. "Su", Mo", etc. + * These are named "SHORTER" to contrast with the constants using _SHORT_ + * above, which actually get the CLDR-style *abbreviated* versions of the + * corresponding names. + * @stable ICU 51 + */ + UDAT_SHORTER_WEEKDAYS, + /** + * Standalone version of UDAT_SHORTER_WEEKDAYS. + * @stable ICU 51 + */ + UDAT_STANDALONE_SHORTER_WEEKDAYS, + /** + * Cyclic year names (only supported for some calendars, and only for FORMAT usage; + * udat_setSymbols not supported for UDAT_CYCLIC_YEARS_WIDE) + * @stable ICU 54 + */ + UDAT_CYCLIC_YEARS_WIDE, + /** + * Cyclic year names (only supported for some calendars, and only for FORMAT usage) + * @stable ICU 54 + */ + UDAT_CYCLIC_YEARS_ABBREVIATED, + /** + * Cyclic year names (only supported for some calendars, and only for FORMAT usage; + * udat_setSymbols not supported for UDAT_CYCLIC_YEARS_NARROW) + * @stable ICU 54 + */ + UDAT_CYCLIC_YEARS_NARROW, + /** + * Calendar zodiac names (only supported for some calendars, and only for FORMAT usage; + * udat_setSymbols not supported for UDAT_ZODIAC_NAMES_WIDE) + * @stable ICU 54 + */ + UDAT_ZODIAC_NAMES_WIDE, + /** + * Calendar zodiac names (only supported for some calendars, and only for FORMAT usage) + * @stable ICU 54 + */ + UDAT_ZODIAC_NAMES_ABBREVIATED, + /** + * Calendar zodiac names (only supported for some calendars, and only for FORMAT usage; + * udat_setSymbols not supported for UDAT_ZODIAC_NAMES_NARROW) + * @stable ICU 54 + */ + UDAT_ZODIAC_NAMES_NARROW +} UDateFormatSymbolType; + +struct UDateFormatSymbols; +/** Date format symbols. + * For usage in C programs. + * @stable ICU 2.6 + */ +typedef struct UDateFormatSymbols UDateFormatSymbols; + +/** +* Get the symbols associated with an UDateFormat. +* The symbols are what a UDateFormat uses to represent locale-specific data, +* for example month or day names. +* @param fmt The formatter to query. +* @param type The type of symbols to get. One of UDAT_ERAS, UDAT_MONTHS, UDAT_SHORT_MONTHS, +* UDAT_WEEKDAYS, UDAT_SHORT_WEEKDAYS, UDAT_AM_PMS, or UDAT_LOCALIZED_CHARS +* @param symbolIndex The desired symbol of type type. +* @param result A pointer to a buffer to receive the pattern. +* @param resultLength The maximum size of result. +* @param status A pointer to an UErrorCode to receive any errors +* @return The total buffer size needed; if greater than resultLength, the output was truncated. +* @see udat_countSymbols +* @see udat_setSymbols +* @stable ICU 2.0 +*/ +U_CAPI int32_t U_EXPORT2 +udat_getSymbols(const UDateFormat *fmt, + UDateFormatSymbolType type, + int32_t symbolIndex, + UChar *result, + int32_t resultLength, + UErrorCode *status); + +/** +* Count the number of particular symbols for an UDateFormat. +* This function is most useful as for detemining the loop termination condition +* for calls to {@link #udat_getSymbols }. +* @param fmt The formatter to query. +* @param type The type of symbols to count. One of UDAT_ERAS, UDAT_MONTHS, UDAT_SHORT_MONTHS, +* UDAT_WEEKDAYS, UDAT_SHORT_WEEKDAYS, UDAT_AM_PMS, or UDAT_LOCALIZED_CHARS +* @return The number of symbols of type type. +* @see udat_getSymbols +* @see udat_setSymbols +* @stable ICU 2.0 +*/ +U_CAPI int32_t U_EXPORT2 +udat_countSymbols( const UDateFormat *fmt, + UDateFormatSymbolType type); + +/** +* Set the symbols associated with an UDateFormat. +* The symbols are what a UDateFormat uses to represent locale-specific data, +* for example month or day names. +* @param format The formatter to set +* @param type The type of symbols to set. One of UDAT_ERAS, UDAT_MONTHS, UDAT_SHORT_MONTHS, +* UDAT_WEEKDAYS, UDAT_SHORT_WEEKDAYS, UDAT_AM_PMS, or UDAT_LOCALIZED_CHARS +* @param symbolIndex The index of the symbol to set of type type. +* @param value The new value +* @param valueLength The length of value, or -1 if null-terminated +* @param status A pointer to an UErrorCode to receive any errors +* @see udat_getSymbols +* @see udat_countSymbols +* @stable ICU 2.0 +*/ +U_CAPI void U_EXPORT2 +udat_setSymbols( UDateFormat *format, + UDateFormatSymbolType type, + int32_t symbolIndex, + UChar *value, + int32_t valueLength, + UErrorCode *status); + +/** + * Get the locale for this date format object. + * You can choose between valid and actual locale. + * @param fmt The formatter to get the locale from + * @param type type of the locale we're looking for (valid or actual) + * @param status error code for the operation + * @return the locale name + * @stable ICU 2.8 + */ +U_CAPI const char* U_EXPORT2 +udat_getLocaleByType(const UDateFormat *fmt, + ULocDataLocaleType type, + UErrorCode* status); + +/** + * Set a particular UDisplayContext value in the formatter, such as + * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. + * @param fmt The formatter for which to set a UDisplayContext value. + * @param value The UDisplayContext value to set. + * @param status A pointer to an UErrorCode to receive any errors + * @stable ICU 51 + */ +U_CAPI void U_EXPORT2 +udat_setContext(UDateFormat* fmt, UDisplayContext value, UErrorCode* status); + +/** + * Get the formatter's UDisplayContext value for the specified UDisplayContextType, + * such as UDISPCTX_TYPE_CAPITALIZATION. + * @param fmt The formatter to query. + * @param type The UDisplayContextType whose value to return + * @param status A pointer to an UErrorCode to receive any errors + * @return The UDisplayContextValue for the specified type. + * @stable ICU 53 + */ +U_CAPI UDisplayContext U_EXPORT2 +udat_getContext(const UDateFormat* fmt, UDisplayContextType type, UErrorCode* status); + +#ifndef U_HIDE_INTERNAL_API +/** +* Extract the date pattern from a UDateFormat set for relative date formatting. +* The pattern will follow the pattern syntax rules. +* @param fmt The formatter to query. +* @param result A pointer to a buffer to receive the pattern. +* @param resultLength The maximum size of result. +* @param status A pointer to a UErrorCode to receive any errors +* @return The total buffer size needed; if greater than resultLength, the output was truncated. +* @see udat_applyPatternRelative +* @internal ICU 4.2 technology preview +*/ +U_INTERNAL int32_t U_EXPORT2 +udat_toPatternRelativeDate(const UDateFormat *fmt, + UChar *result, + int32_t resultLength, + UErrorCode *status); + +/** +* Extract the time pattern from a UDateFormat set for relative date formatting. +* The pattern will follow the pattern syntax rules. +* @param fmt The formatter to query. +* @param result A pointer to a buffer to receive the pattern. +* @param resultLength The maximum size of result. +* @param status A pointer to a UErrorCode to receive any errors +* @return The total buffer size needed; if greater than resultLength, the output was truncated. +* @see udat_applyPatternRelative +* @internal ICU 4.2 technology preview +*/ +U_INTERNAL int32_t U_EXPORT2 +udat_toPatternRelativeTime(const UDateFormat *fmt, + UChar *result, + int32_t resultLength, + UErrorCode *status); + +/** +* Set the date & time patterns used by a UDateFormat set for relative date formatting. +* The patterns should follow the pattern syntax rules. +* @param format The formatter to set. +* @param datePattern The new date pattern +* @param datePatternLength The length of datePattern, or -1 if null-terminated. +* @param timePattern The new time pattern +* @param timePatternLength The length of timePattern, or -1 if null-terminated. +* @param status A pointer to a UErrorCode to receive any errors +* @see udat_toPatternRelativeDate, udat_toPatternRelativeTime +* @internal ICU 4.2 technology preview +*/ +U_INTERNAL void U_EXPORT2 +udat_applyPatternRelative(UDateFormat *format, + const UChar *datePattern, + int32_t datePatternLength, + const UChar *timePattern, + int32_t timePatternLength, + UErrorCode *status); + +/** + * @internal + * @see udat_open + */ +typedef UDateFormat* (U_EXPORT2 *UDateFormatOpener) (UDateFormatStyle timeStyle, + UDateFormatStyle dateStyle, + const char *locale, + const UChar *tzID, + int32_t tzIDLength, + const UChar *pattern, + int32_t patternLength, + UErrorCode *status); + +/** + * Register a provider factory + * @internal ICU 49 + */ +U_INTERNAL void U_EXPORT2 +udat_registerOpener(UDateFormatOpener opener, UErrorCode *status); + +/** + * Un-Register a provider factory + * @internal ICU 49 + */ +U_INTERNAL UDateFormatOpener U_EXPORT2 +udat_unregisterOpener(UDateFormatOpener opener, UErrorCode *status); +#endif /* U_HIDE_INTERNAL_API */ + + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/udata.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/udata.h new file mode 100644 index 0000000..a0286e1 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/udata.h @@ -0,0 +1,437 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1999-2014, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: udata.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 1999oct25 +* created by: Markus W. Scherer +*/ + +#ifndef __UDATA_H__ +#define __UDATA_H__ + +#include "unicode/utypes.h" +#include "unicode/localpointer.h" + +U_CDECL_BEGIN + +/** + * \file + * \brief C API: Data loading interface + * + *

Information about data loading interface

+ * + * This API is used to find and efficiently load data for ICU and applications + * using ICU. It provides an abstract interface that specifies a data type and + * name to find and load the data. Normally this API is used by other ICU APIs + * to load required data out of the ICU data library, but it can be used to + * load data out of other places. + * + * See the User Guide Data Management chapter. + */ + +#ifndef U_HIDE_INTERNAL_API +/** + * Character used to separate package names from tree names + * @internal ICU 3.0 + */ +#define U_TREE_SEPARATOR '-' + +/** + * String used to separate package names from tree names + * @internal ICU 3.0 + */ +#define U_TREE_SEPARATOR_STRING "-" + +/** + * Character used to separate parts of entry names + * @internal ICU 3.0 + */ +#define U_TREE_ENTRY_SEP_CHAR '/' + +/** + * String used to separate parts of entry names + * @internal ICU 3.0 + */ +#define U_TREE_ENTRY_SEP_STRING "/" + +/** + * Alias for standard ICU data + * @internal ICU 3.0 + */ +#define U_ICUDATA_ALIAS "ICUDATA" + +#endif /* U_HIDE_INTERNAL_API */ + +/** + * UDataInfo contains the properties about the requested data. + * This is meta data. + * + *

This structure may grow in the future, indicated by the + * size field.

+ * + *

ICU data must be at least 8-aligned, and should be 16-aligned. + * The UDataInfo struct begins 4 bytes after the start of the data item, + * so it is 4-aligned. + * + *

The platform data property fields help determine if a data + * file can be efficiently used on a given machine. + * The particular fields are of importance only if the data + * is affected by the properties - if there is integer data + * with word sizes > 1 byte, char* text, or UChar* text.

+ * + *

The implementation for the udata_open[Choice]() + * functions may reject data based on the value in isBigEndian. + * No other field is used by the udata API implementation.

+ * + *

The dataFormat may be used to identify + * the kind of data, e.g. a converter table.

+ * + *

The formatVersion field should be used to + * make sure that the format can be interpreted. + * It may be a good idea to check only for the one or two highest + * of the version elements to allow the data memory to + * get more or somewhat rearranged contents, for as long + * as the using code can still interpret the older contents.

+ * + *

The dataVersion field is intended to be a + * common place to store the source version of the data; + * for data from the Unicode character database, this could + * reflect the Unicode version.

+ * + * @stable ICU 2.0 + */ +typedef struct { + /** sizeof(UDataInfo) + * @stable ICU 2.0 */ + uint16_t size; + + /** unused, set to 0 + * @stable ICU 2.0*/ + uint16_t reservedWord; + + /* platform data properties */ + /** 0 for little-endian machine, 1 for big-endian + * @stable ICU 2.0 */ + uint8_t isBigEndian; + + /** see U_CHARSET_FAMILY values in utypes.h + * @stable ICU 2.0*/ + uint8_t charsetFamily; + + /** sizeof(UChar), one of { 1, 2, 4 } + * @stable ICU 2.0*/ + uint8_t sizeofUChar; + + /** unused, set to 0 + * @stable ICU 2.0*/ + uint8_t reservedByte; + + /** data format identifier + * @stable ICU 2.0*/ + uint8_t dataFormat[4]; + + /** versions: [0] major [1] minor [2] milli [3] micro + * @stable ICU 2.0*/ + uint8_t formatVersion[4]; + + /** versions: [0] major [1] minor [2] milli [3] micro + * @stable ICU 2.0*/ + uint8_t dataVersion[4]; +} UDataInfo; + +/* API for reading data -----------------------------------------------------*/ + +/** + * Forward declaration of the data memory type. + * @stable ICU 2.0 + */ +typedef struct UDataMemory UDataMemory; + +/** + * Callback function for udata_openChoice(). + * @param context parameter passed into udata_openChoice(). + * @param type The type of the data as passed into udata_openChoice(). + * It may be NULL. + * @param name The name of the data as passed into udata_openChoice(). + * @param pInfo A pointer to the UDataInfo structure + * of data that has been loaded and will be returned + * by udata_openChoice() if this function + * returns TRUE. + * @return TRUE if the current data memory is acceptable + * @stable ICU 2.0 + */ +typedef UBool U_CALLCONV +UDataMemoryIsAcceptable(void *context, + const char *type, const char *name, + const UDataInfo *pInfo); + + +/** + * Convenience function. + * This function works the same as udata_openChoice + * except that any data that matches the type and name + * is assumed to be acceptable. + * @param path Specifies an absolute path and/or a basename for the + * finding of the data in the file system. + * NULL for ICU data. + * @param type A string that specifies the type of data to be loaded. + * For example, resource bundles are loaded with type "res", + * conversion tables with type "cnv". + * This may be NULL or empty. + * @param name A string that specifies the name of the data. + * @param pErrorCode An ICU UErrorCode parameter. It must not be NULL. + * @return A pointer (handle) to a data memory object, or NULL + * if an error occurs. Call udata_getMemory() + * to get a pointer to the actual data. + * + * @see udata_openChoice + * @stable ICU 2.0 + */ +U_STABLE UDataMemory * U_EXPORT2 +udata_open(const char *path, const char *type, const char *name, + UErrorCode *pErrorCode); + +/** + * Data loading function. + * This function is used to find and load efficiently data for + * ICU and applications using ICU. + * It provides an abstract interface that allows to specify a data + * type and name to find and load the data. + * + *

The implementation depends on platform properties and user preferences + * and may involve loading shared libraries (DLLs), mapping + * files into memory, or fopen()/fread() files. + * It may also involve using static memory or database queries etc. + * Several or all data items may be combined into one entity + * (DLL, memory-mappable file).

+ * + *

The data is always preceded by a header that includes + * a UDataInfo structure. + * The caller's isAcceptable() function is called to make + * sure that the data is useful. It may be called several times if it + * rejects the data and there is more than one location with data + * matching the type and name.

+ * + *

If path==NULL, then ICU data is loaded. + * Otherwise, it is separated into a basename and a basename-less directory string. + * The basename is used as the data package name, and the directory is + * logically prepended to the ICU data directory string.

+ * + *

For details about ICU data loading see the User Guide + * Data Management chapter. (http://icu-project.org/userguide/icudata.html)

+ * + * @param path Specifies an absolute path and/or a basename for the + * finding of the data in the file system. + * NULL for ICU data. + * @param type A string that specifies the type of data to be loaded. + * For example, resource bundles are loaded with type "res", + * conversion tables with type "cnv". + * This may be NULL or empty. + * @param name A string that specifies the name of the data. + * @param isAcceptable This function is called to verify that loaded data + * is useful for the client code. If it returns FALSE + * for all data items, then udata_openChoice() + * will return with an error. + * @param context Arbitrary parameter to be passed into isAcceptable. + * @param pErrorCode An ICU UErrorCode parameter. It must not be NULL. + * @return A pointer (handle) to a data memory object, or NULL + * if an error occurs. Call udata_getMemory() + * to get a pointer to the actual data. + * @stable ICU 2.0 + */ +U_STABLE UDataMemory * U_EXPORT2 +udata_openChoice(const char *path, const char *type, const char *name, + UDataMemoryIsAcceptable *isAcceptable, void *context, + UErrorCode *pErrorCode); + +/** + * Close the data memory. + * This function must be called to allow the system to + * release resources associated with this data memory. + * @param pData The pointer to data memory object + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +udata_close(UDataMemory *pData); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUDataMemoryPointer + * "Smart pointer" class, closes a UDataMemory via udata_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUDataMemoryPointer, UDataMemory, udata_close); + +U_NAMESPACE_END + +#endif + +/** + * Get the pointer to the actual data inside the data memory. + * The data is read-only. + * + * ICU data must be at least 8-aligned, and should be 16-aligned. + * + * @param pData The pointer to data memory object + * @stable ICU 2.0 + */ +U_STABLE const void * U_EXPORT2 +udata_getMemory(UDataMemory *pData); + +/** + * Get the information from the data memory header. + * This allows to get access to the header containing + * platform data properties etc. which is not part of + * the data itself and can therefore not be accessed + * via the pointer that udata_getMemory() returns. + * + * @param pData pointer to the data memory object + * @param pInfo pointer to a UDataInfo object; + * its size field must be set correctly, + * typically to sizeof(UDataInfo). + * + * *pInfo will be filled with the UDataInfo structure + * in the data memory object. If this structure is smaller than + * pInfo->size, then the size will be + * adjusted and only part of the structure will be filled. + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +udata_getInfo(UDataMemory *pData, UDataInfo *pInfo); + +/** + * This function bypasses the normal ICU data loading process and + * allows you to force ICU's system data to come out of a user-specified + * area in memory. + * + * ICU data must be at least 8-aligned, and should be 16-aligned. + * See http://userguide.icu-project.org/icudata + * + * The format of this data is that of the icu common data file, as is + * generated by the pkgdata tool with mode=common or mode=dll. + * You can read in a whole common mode file and pass the address to the start of the + * data, or (with the appropriate link options) pass in the pointer to + * the data that has been loaded from a dll by the operating system, + * as shown in this code: + * + * extern const char U_IMPORT U_ICUDATA_ENTRY_POINT []; + * // U_ICUDATA_ENTRY_POINT is same as entry point specified to pkgdata tool + * UErrorCode status = U_ZERO_ERROR; + * + * udata_setCommonData(&U_ICUDATA_ENTRY_POINT, &status); + * + * It is important that the declaration be as above. The entry point + * must not be declared as an extern void*. + * + * Starting with ICU 4.4, it is possible to set several data packages, + * one per call to this function. + * udata_open() will look for data in the multiple data packages in the order + * in which they were set. + * The position of the linked-in or default-name ICU .data package in the + * search list depends on when the first data item is loaded that is not contained + * in the already explicitly set packages. + * If data was loaded implicitly before the first call to this function + * (for example, via opening a converter, constructing a UnicodeString + * from default-codepage data, using formatting or collation APIs, etc.), + * then the default data will be first in the list. + * + * This function has no effect on application (non ICU) data. See udata_setAppData() + * for similar functionality for application data. + * + * @param data pointer to ICU common data + * @param err outgoing error status U_USING_DEFAULT_WARNING, U_UNSUPPORTED_ERROR + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +udata_setCommonData(const void *data, UErrorCode *err); + + +/** + * This function bypasses the normal ICU data loading process for application-specific + * data and allows you to force the it to come out of a user-specified + * pointer. + * + * ICU data must be at least 8-aligned, and should be 16-aligned. + * See http://userguide.icu-project.org/icudata + * + * The format of this data is that of the icu common data file, like 'icudt26l.dat' + * or the corresponding shared library (DLL) file. + * The application must read in or otherwise construct an image of the data and then + * pass the address of it to this function. + * + * + * Warning: setAppData will set a U_USING_DEFAULT_WARNING code if + * data with the specifed path that has already been opened, or + * if setAppData with the same path has already been called. + * Any such calls to setAppData will have no effect. + * + * + * @param packageName the package name by which the application will refer + * to (open) this data + * @param data pointer to the data + * @param err outgoing error status U_USING_DEFAULT_WARNING, U_UNSUPPORTED_ERROR + * @see udata_setCommonData + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +udata_setAppData(const char *packageName, const void *data, UErrorCode *err); + +/** + * Possible settings for udata_setFileAccess() + * @see udata_setFileAccess + * @stable ICU 3.4 + */ +typedef enum UDataFileAccess { + /** ICU looks for data in single files first, then in packages. (default) @stable ICU 3.4 */ + UDATA_FILES_FIRST, + /** An alias for the default access mode. @stable ICU 3.4 */ + UDATA_DEFAULT_ACCESS = UDATA_FILES_FIRST, + /** ICU only loads data from packages, not from single files. @stable ICU 3.4 */ + UDATA_ONLY_PACKAGES, + /** ICU loads data from packages first, and only from single files + if the data cannot be found in a package. @stable ICU 3.4 */ + UDATA_PACKAGES_FIRST, + /** ICU does not access the file system for data loading. @stable ICU 3.4 */ + UDATA_NO_FILES, +#ifndef U_HIDE_DEPRECATED_API + /** + * Number of real UDataFileAccess values. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UDATA_FILE_ACCESS_COUNT +#endif // U_HIDE_DEPRECATED_API +} UDataFileAccess; + +/** + * This function may be called to control how ICU loads data. It must be called + * before any ICU data is loaded, including application data loaded with + * ures/ResourceBundle or udata APIs. This function is not multithread safe. + * The results of calling it while other threads are loading data are undefined. + * @param access The type of file access to be used + * @param status Error code. + * @see UDataFileAccess + * @stable ICU 3.4 + */ +U_STABLE void U_EXPORT2 +udata_setFileAccess(UDataFileAccess access, UErrorCode *status); + +U_CDECL_END + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/udateintervalformat.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/udateintervalformat.h new file mode 100644 index 0000000..9300ddc --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/udateintervalformat.h @@ -0,0 +1,186 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +***************************************************************************************** +* Copyright (C) 2010-2012,2015 International Business Machines +* Corporation and others. All Rights Reserved. +***************************************************************************************** +*/ + +#ifndef UDATEINTERVALFORMAT_H +#define UDATEINTERVALFORMAT_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/umisc.h" +#include "unicode/localpointer.h" + +/** + * \file + * \brief C API: Format a date interval. + * + * A UDateIntervalFormat is used to format the range between two UDate values + * in a locale-sensitive way, using a skeleton that specifies the precision and + * completeness of the information to show. If the range smaller than the resolution + * specified by the skeleton, a single date format will be produced. If the range + * is larger than the format specified by the skeleton, a locale-specific fallback + * will be used to format the items missing from the skeleton. + * + * For example, if the range is 2010-03-04 07:56 - 2010-03-04 19:56 (12 hours) + * - The skeleton jm will produce + * for en_US, "7:56 AM - 7:56 PM" + * for en_GB, "7:56 - 19:56" + * - The skeleton MMMd will produce + * for en_US, "Mar 4" + * for en_GB, "4 Mar" + * If the range is 2010-03-04 07:56 - 2010-03-08 16:11 (4 days, 8 hours, 15 minutes) + * - The skeleton jm will produce + * for en_US, "3/4/2010 7:56 AM - 3/8/2010 4:11 PM" + * for en_GB, "4/3/2010 7:56 - 8/3/2010 16:11" + * - The skeleton MMMd will produce + * for en_US, "Mar 4-8" + * for en_GB, "4-8 Mar" + * + * Note: the "-" characters in the above sample output will actually be + * Unicode 2013, EN_DASH, in all but the last example. + * + * Note, in ICU 4.4 the standard skeletons for which date interval format data + * is usually available are as follows; best results will be obtained by using + * skeletons from this set, or those formed by combining these standard skeletons + * (note that for these skeletons, the length of digit field such as d, y, or + * M vs MM is irrelevant (but for non-digit fields such as MMM vs MMMM it is + * relevant). Note that a skeleton involving h or H generally explicitly requests + * that time style (12- or 24-hour time respectively). For a skeleton that + * requests the locale's default time style (h or H), use 'j' instead of h or H. + * h, H, hm, Hm, + * hv, Hv, hmv, Hmv, + * d, + * M, MMM, MMMM, + * Md, MMMd, + * MEd, MMMEd, + * y, + * yM, yMMM, yMMMM, + * yMd, yMMMd, + * yMEd, yMMMEd + * + * Locales for which ICU 4.4 seems to have a reasonable amount of this data + * include: + * af, am, ar, be, bg, bn, ca, cs, da, de (_AT), el, en (_AU,_CA,_GB,_IE,_IN...), + * eo, es (_AR,_CL,_CO,...,_US) et, fa, fi, fo, fr (_BE,_CH,_CA), fur, gsw, he, + * hr, hu, hy, is, it (_CH), ja, kk, km, ko, lt, lv, mk, ml, mt, nb, nl )_BE), + * nn, pl, pt (_PT), rm, ro, ru (_UA), sk, sl, so, sq, sr, sr_Latn, sv, th, to, + * tr, uk, ur, vi, zh (_SG), zh_Hant (_HK,_MO) + */ + +/** + * Opaque UDateIntervalFormat object for use in C programs. + * @stable ICU 4.8 + */ +struct UDateIntervalFormat; +typedef struct UDateIntervalFormat UDateIntervalFormat; /**< C typedef for struct UDateIntervalFormat. @stable ICU 4.8 */ + +/** + * Open a new UDateIntervalFormat object using the predefined rules for a + * given locale plus a specified skeleton. + * @param locale + * The locale for whose rules should be used; may be NULL for + * default locale. + * @param skeleton + * A pattern containing only the fields desired for the interval + * format, for example "Hm", "yMMMd", or "yMMMEdHm". + * @param skeletonLength + * The length of skeleton; may be -1 if the skeleton is zero-terminated. + * @param tzID + * A timezone ID specifying the timezone to use. If 0, use the default + * timezone. + * @param tzIDLength + * The length of tzID, or -1 if null-terminated. If 0, use the default + * timezone. + * @param status + * A pointer to a UErrorCode to receive any errors. + * @return + * A pointer to a UDateIntervalFormat object for the specified locale, + * or NULL if an error occurred. + * @stable ICU 4.8 + */ +U_STABLE UDateIntervalFormat* U_EXPORT2 +udtitvfmt_open(const char* locale, + const UChar* skeleton, + int32_t skeletonLength, + const UChar* tzID, + int32_t tzIDLength, + UErrorCode* status); + +/** + * Close a UDateIntervalFormat object. Once closed it may no longer be used. + * @param formatter + * The UDateIntervalFormat object to close. + * @stable ICU 4.8 + */ +U_STABLE void U_EXPORT2 +udtitvfmt_close(UDateIntervalFormat *formatter); + + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUDateIntervalFormatPointer + * "Smart pointer" class, closes a UDateIntervalFormat via udtitvfmt_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.8 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateIntervalFormatPointer, UDateIntervalFormat, udtitvfmt_close); + +U_NAMESPACE_END + +#endif + + +/** + * Formats a date/time range using the conventions established for the + * UDateIntervalFormat object. + * @param formatter + * The UDateIntervalFormat object specifying the format conventions. + * @param fromDate + * The starting point of the range. + * @param toDate + * The ending point of the range. + * @param result + * A pointer to a buffer to receive the formatted range. + * @param resultCapacity + * The maximum size of result. + * @param position + * A pointer to a UFieldPosition. On input, position->field is read. + * On output, position->beginIndex and position->endIndex indicate + * the beginning and ending indices of field number position->field, + * if such a field exists. This parameter may be NULL, in which case + * no field position data is returned. + * There may be multiple instances of a given field type in an + * interval format; in this case the position indices refer to the + * first instance. + * @param status + * A pointer to a UErrorCode to receive any errors. + * @return + * The total buffer size needed; if greater than resultLength, the + * output was truncated. + * @stable ICU 4.8 + */ +U_STABLE int32_t U_EXPORT2 +udtitvfmt_format(const UDateIntervalFormat* formatter, + UDate fromDate, + UDate toDate, + UChar* result, + int32_t resultCapacity, + UFieldPosition* position, + UErrorCode* status); + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/udatpg.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/udatpg.h new file mode 100644 index 0000000..76baa3d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/udatpg.h @@ -0,0 +1,605 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2007-2015, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: udatpg.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2007jul30 +* created by: Markus W. Scherer +*/ + +#ifndef __UDATPG_H__ +#define __UDATPG_H__ + +#include "unicode/utypes.h" +#include "unicode/uenum.h" +#include "unicode/localpointer.h" + +/** + * \file + * \brief C API: Wrapper for icu::DateTimePatternGenerator (unicode/dtptngen.h). + * + * UDateTimePatternGenerator provides flexible generation of date format patterns, + * like "yy-MM-dd". The user can build up the generator by adding successive + * patterns. Once that is done, a query can be made using a "skeleton", which is + * a pattern which just includes the desired fields and lengths. The generator + * will return the "best fit" pattern corresponding to that skeleton. + *

The main method people will use is udatpg_getBestPattern, since normally + * UDateTimePatternGenerator is pre-built with data from a particular locale. + * However, generators can be built directly from other data as well. + *

Issue: may be useful to also have a function that returns the list of + * fields in a pattern, in order, since we have that internally. + * That would be useful for getting the UI order of field elements. + */ + +/** + * Opaque type for a date/time pattern generator object. + * @stable ICU 3.8 + */ +typedef void *UDateTimePatternGenerator; + +/** + * Field number constants for udatpg_getAppendItemFormats() and similar functions. + * These constants are separate from UDateFormatField despite semantic overlap + * because some fields are merged for the date/time pattern generator. + * @stable ICU 3.8 + */ +typedef enum UDateTimePatternField { + /** @stable ICU 3.8 */ + UDATPG_ERA_FIELD, + /** @stable ICU 3.8 */ + UDATPG_YEAR_FIELD, + /** @stable ICU 3.8 */ + UDATPG_QUARTER_FIELD, + /** @stable ICU 3.8 */ + UDATPG_MONTH_FIELD, + /** @stable ICU 3.8 */ + UDATPG_WEEK_OF_YEAR_FIELD, + /** @stable ICU 3.8 */ + UDATPG_WEEK_OF_MONTH_FIELD, + /** @stable ICU 3.8 */ + UDATPG_WEEKDAY_FIELD, + /** @stable ICU 3.8 */ + UDATPG_DAY_OF_YEAR_FIELD, + /** @stable ICU 3.8 */ + UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD, + /** @stable ICU 3.8 */ + UDATPG_DAY_FIELD, + /** @stable ICU 3.8 */ + UDATPG_DAYPERIOD_FIELD, + /** @stable ICU 3.8 */ + UDATPG_HOUR_FIELD, + /** @stable ICU 3.8 */ + UDATPG_MINUTE_FIELD, + /** @stable ICU 3.8 */ + UDATPG_SECOND_FIELD, + /** @stable ICU 3.8 */ + UDATPG_FRACTIONAL_SECOND_FIELD, + /** @stable ICU 3.8 */ + UDATPG_ZONE_FIELD, + + /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API, + * it is needed for layout of DateTimePatternGenerator object. */ + /** + * One more than the highest normal UDateTimePatternField value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UDATPG_FIELD_COUNT +} UDateTimePatternField; + +/** + * Masks to control forcing the length of specified fields in the returned + * pattern to match those in the skeleton (when this would not happen + * otherwise). These may be combined to force the length of multiple fields. + * Used with udatpg_getBestPatternWithOptions, udatpg_replaceFieldTypesWithOptions. + * @stable ICU 4.4 + */ +typedef enum UDateTimePatternMatchOptions { + /** @stable ICU 4.4 */ + UDATPG_MATCH_NO_OPTIONS = 0, + /** @stable ICU 4.4 */ + UDATPG_MATCH_HOUR_FIELD_LENGTH = 1 << UDATPG_HOUR_FIELD, +#ifndef U_HIDE_INTERNAL_API + /** @internal ICU 4.4 */ + UDATPG_MATCH_MINUTE_FIELD_LENGTH = 1 << UDATPG_MINUTE_FIELD, + /** @internal ICU 4.4 */ + UDATPG_MATCH_SECOND_FIELD_LENGTH = 1 << UDATPG_SECOND_FIELD, +#endif /* U_HIDE_INTERNAL_API */ + /** @stable ICU 4.4 */ + UDATPG_MATCH_ALL_FIELDS_LENGTH = (1 << UDATPG_FIELD_COUNT) - 1 +} UDateTimePatternMatchOptions; + +/** + * Status return values from udatpg_addPattern(). + * @stable ICU 3.8 + */ +typedef enum UDateTimePatternConflict { + /** @stable ICU 3.8 */ + UDATPG_NO_CONFLICT, + /** @stable ICU 3.8 */ + UDATPG_BASE_CONFLICT, + /** @stable ICU 3.8 */ + UDATPG_CONFLICT, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UDateTimePatternConflict value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UDATPG_CONFLICT_COUNT +#endif // U_HIDE_DEPRECATED_API +} UDateTimePatternConflict; + +/** + * Open a generator according to a given locale. + * @param locale + * @param pErrorCode a pointer to the UErrorCode which must not indicate a + * failure before the function call. + * @return a pointer to UDateTimePatternGenerator. + * @stable ICU 3.8 + */ +U_STABLE UDateTimePatternGenerator * U_EXPORT2 +udatpg_open(const char *locale, UErrorCode *pErrorCode); + +/** + * Open an empty generator, to be constructed with udatpg_addPattern(...) etc. + * @param pErrorCode a pointer to the UErrorCode which must not indicate a + * failure before the function call. + * @return a pointer to UDateTimePatternGenerator. + * @stable ICU 3.8 + */ +U_STABLE UDateTimePatternGenerator * U_EXPORT2 +udatpg_openEmpty(UErrorCode *pErrorCode); + +/** + * Close a generator. + * @param dtpg a pointer to UDateTimePatternGenerator. + * @stable ICU 3.8 + */ +U_STABLE void U_EXPORT2 +udatpg_close(UDateTimePatternGenerator *dtpg); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUDateTimePatternGeneratorPointer + * "Smart pointer" class, closes a UDateTimePatternGenerator via udatpg_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateTimePatternGeneratorPointer, UDateTimePatternGenerator, udatpg_close); + +U_NAMESPACE_END + +#endif + +/** + * Create a copy pf a generator. + * @param dtpg a pointer to UDateTimePatternGenerator to be copied. + * @param pErrorCode a pointer to the UErrorCode which must not indicate a + * failure before the function call. + * @return a pointer to a new UDateTimePatternGenerator. + * @stable ICU 3.8 + */ +U_STABLE UDateTimePatternGenerator * U_EXPORT2 +udatpg_clone(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode); + +/** + * Get the best pattern matching the input skeleton. It is guaranteed to + * have all of the fields in the skeleton. + * + * Note that this function uses a non-const UDateTimePatternGenerator: + * It uses a stateful pattern parser which is set up for each generator object, + * rather than creating one for each function call. + * Consecutive calls to this function do not affect each other, + * but this function cannot be used concurrently on a single generator object. + * + * @param dtpg a pointer to UDateTimePatternGenerator. + * @param skeleton + * The skeleton is a pattern containing only the variable fields. + * For example, "MMMdd" and "mmhh" are skeletons. + * @param length the length of skeleton + * @param bestPattern + * The best pattern found from the given skeleton. + * @param capacity the capacity of bestPattern. + * @param pErrorCode a pointer to the UErrorCode which must not indicate a + * failure before the function call. + * @return the length of bestPattern. + * @stable ICU 3.8 + */ +U_STABLE int32_t U_EXPORT2 +udatpg_getBestPattern(UDateTimePatternGenerator *dtpg, + const UChar *skeleton, int32_t length, + UChar *bestPattern, int32_t capacity, + UErrorCode *pErrorCode); + +/** + * Get the best pattern matching the input skeleton. It is guaranteed to + * have all of the fields in the skeleton. + * + * Note that this function uses a non-const UDateTimePatternGenerator: + * It uses a stateful pattern parser which is set up for each generator object, + * rather than creating one for each function call. + * Consecutive calls to this function do not affect each other, + * but this function cannot be used concurrently on a single generator object. + * + * @param dtpg a pointer to UDateTimePatternGenerator. + * @param skeleton + * The skeleton is a pattern containing only the variable fields. + * For example, "MMMdd" and "mmhh" are skeletons. + * @param length the length of skeleton + * @param options + * Options for forcing the length of specified fields in the + * returned pattern to match those in the skeleton (when this + * would not happen otherwise). For default behavior, use + * UDATPG_MATCH_NO_OPTIONS. + * @param bestPattern + * The best pattern found from the given skeleton. + * @param capacity + * the capacity of bestPattern. + * @param pErrorCode + * a pointer to the UErrorCode which must not indicate a + * failure before the function call. + * @return the length of bestPattern. + * @stable ICU 4.4 + */ +U_STABLE int32_t U_EXPORT2 +udatpg_getBestPatternWithOptions(UDateTimePatternGenerator *dtpg, + const UChar *skeleton, int32_t length, + UDateTimePatternMatchOptions options, + UChar *bestPattern, int32_t capacity, + UErrorCode *pErrorCode); + +/** + * Get a unique skeleton from a given pattern. For example, + * both "MMM-dd" and "dd/MMM" produce the skeleton "MMMdd". + * + * Note that this function uses a non-const UDateTimePatternGenerator: + * It uses a stateful pattern parser which is set up for each generator object, + * rather than creating one for each function call. + * Consecutive calls to this function do not affect each other, + * but this function cannot be used concurrently on a single generator object. + * + * @param unusedDtpg a pointer to UDateTimePatternGenerator. + * This parameter is no longer used. Callers may pass NULL. + * @param pattern input pattern, such as "dd/MMM". + * @param length the length of pattern. + * @param skeleton such as "MMMdd" + * @param capacity the capacity of skeleton. + * @param pErrorCode a pointer to the UErrorCode which must not indicate a + * failure before the function call. + * @return the length of skeleton. + * @stable ICU 3.8 + */ +U_STABLE int32_t U_EXPORT2 +udatpg_getSkeleton(UDateTimePatternGenerator *unusedDtpg, + const UChar *pattern, int32_t length, + UChar *skeleton, int32_t capacity, + UErrorCode *pErrorCode); + +/** + * Get a unique base skeleton from a given pattern. This is the same + * as the skeleton, except that differences in length are minimized so + * as to only preserve the difference between string and numeric form. So + * for example, both "MMM-dd" and "d/MMM" produce the skeleton "MMMd" + * (notice the single d). + * + * Note that this function uses a non-const UDateTimePatternGenerator: + * It uses a stateful pattern parser which is set up for each generator object, + * rather than creating one for each function call. + * Consecutive calls to this function do not affect each other, + * but this function cannot be used concurrently on a single generator object. + * + * @param unusedDtpg a pointer to UDateTimePatternGenerator. + * This parameter is no longer used. Callers may pass NULL. + * @param pattern input pattern, such as "dd/MMM". + * @param length the length of pattern. + * @param baseSkeleton such as "Md" + * @param capacity the capacity of base skeleton. + * @param pErrorCode a pointer to the UErrorCode which must not indicate a + * failure before the function call. + * @return the length of baseSkeleton. + * @stable ICU 3.8 + */ +U_STABLE int32_t U_EXPORT2 +udatpg_getBaseSkeleton(UDateTimePatternGenerator *unusedDtpg, + const UChar *pattern, int32_t length, + UChar *baseSkeleton, int32_t capacity, + UErrorCode *pErrorCode); + +/** + * Adds a pattern to the generator. If the pattern has the same skeleton as + * an existing pattern, and the override parameter is set, then the previous + * value is overriden. Otherwise, the previous value is retained. In either + * case, the conflicting status is set and previous vale is stored in + * conflicting pattern. + *

+ * Note that single-field patterns (like "MMM") are automatically added, and + * don't need to be added explicitly! + * + * @param dtpg a pointer to UDateTimePatternGenerator. + * @param pattern input pattern, such as "dd/MMM" + * @param patternLength the length of pattern. + * @param override When existing values are to be overridden use true, + * otherwise use false. + * @param conflictingPattern Previous pattern with the same skeleton. + * @param capacity the capacity of conflictingPattern. + * @param pLength a pointer to the length of conflictingPattern. + * @param pErrorCode a pointer to the UErrorCode which must not indicate a + * failure before the function call. + * @return conflicting status. The value could be UDATPG_NO_CONFLICT, + * UDATPG_BASE_CONFLICT or UDATPG_CONFLICT. + * @stable ICU 3.8 + */ +U_STABLE UDateTimePatternConflict U_EXPORT2 +udatpg_addPattern(UDateTimePatternGenerator *dtpg, + const UChar *pattern, int32_t patternLength, + UBool override, + UChar *conflictingPattern, int32_t capacity, int32_t *pLength, + UErrorCode *pErrorCode); + +/** + * An AppendItem format is a pattern used to append a field if there is no + * good match. For example, suppose that the input skeleton is "GyyyyMMMd", + * and there is no matching pattern internally, but there is a pattern + * matching "yyyyMMMd", say "d-MM-yyyy". Then that pattern is used, plus the + * G. The way these two are conjoined is by using the AppendItemFormat for G + * (era). So if that value is, say "{0}, {1}" then the final resulting + * pattern is "d-MM-yyyy, G". + *

+ * There are actually three available variables: {0} is the pattern so far, + * {1} is the element we are adding, and {2} is the name of the element. + *

+ * This reflects the way that the CLDR data is organized. + * + * @param dtpg a pointer to UDateTimePatternGenerator. + * @param field UDateTimePatternField, such as UDATPG_ERA_FIELD + * @param value pattern, such as "{0}, {1}" + * @param length the length of value. + * @stable ICU 3.8 + */ +U_STABLE void U_EXPORT2 +udatpg_setAppendItemFormat(UDateTimePatternGenerator *dtpg, + UDateTimePatternField field, + const UChar *value, int32_t length); + +/** + * Getter corresponding to setAppendItemFormat. Values below 0 or at or + * above UDATPG_FIELD_COUNT are illegal arguments. + * + * @param dtpg A pointer to UDateTimePatternGenerator. + * @param field UDateTimePatternField, such as UDATPG_ERA_FIELD + * @param pLength A pointer that will receive the length of appendItemFormat. + * @return appendItemFormat for field. + * @stable ICU 3.8 + */ +U_STABLE const UChar * U_EXPORT2 +udatpg_getAppendItemFormat(const UDateTimePatternGenerator *dtpg, + UDateTimePatternField field, + int32_t *pLength); + +/** + * Set the name of field, eg "era" in English for ERA. These are only + * used if the corresponding AppendItemFormat is used, and if it contains a + * {2} variable. + *

+ * This reflects the way that the CLDR data is organized. + * + * @param dtpg a pointer to UDateTimePatternGenerator. + * @param field UDateTimePatternField + * @param value name for the field. + * @param length the length of value. + * @stable ICU 3.8 + */ +U_STABLE void U_EXPORT2 +udatpg_setAppendItemName(UDateTimePatternGenerator *dtpg, + UDateTimePatternField field, + const UChar *value, int32_t length); + +/** + * Getter corresponding to setAppendItemNames. Values below 0 or at or above + * UDATPG_FIELD_COUNT are illegal arguments. + * + * @param dtpg a pointer to UDateTimePatternGenerator. + * @param field UDateTimePatternField, such as UDATPG_ERA_FIELD + * @param pLength A pointer that will receive the length of the name for field. + * @return name for field + * @stable ICU 3.8 + */ +U_STABLE const UChar * U_EXPORT2 +udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg, + UDateTimePatternField field, + int32_t *pLength); + +/** + * The DateTimeFormat is a message format pattern used to compose date and + * time patterns. The default pattern in the root locale is "{1} {0}", where + * {1} will be replaced by the date pattern and {0} will be replaced by the + * time pattern; however, other locales may specify patterns such as + * "{1}, {0}" or "{1} 'at' {0}", etc. + *

+ * This is used when the input skeleton contains both date and time fields, + * but there is not a close match among the added patterns. For example, + * suppose that this object was created by adding "dd-MMM" and "hh:mm", and + * its DateTimeFormat is the default "{1} {0}". Then if the input skeleton + * is "MMMdhmm", there is not an exact match, so the input skeleton is + * broken up into two components "MMMd" and "hmm". There are close matches + * for those two skeletons, so the result is put together with this pattern, + * resulting in "d-MMM h:mm". + * + * @param dtpg a pointer to UDateTimePatternGenerator. + * @param dtFormat + * message format pattern, here {1} will be replaced by the date + * pattern and {0} will be replaced by the time pattern. + * @param length the length of dtFormat. + * @stable ICU 3.8 + */ +U_STABLE void U_EXPORT2 +udatpg_setDateTimeFormat(const UDateTimePatternGenerator *dtpg, + const UChar *dtFormat, int32_t length); + +/** + * Getter corresponding to setDateTimeFormat. + * @param dtpg a pointer to UDateTimePatternGenerator. + * @param pLength A pointer that will receive the length of the format + * @return dateTimeFormat. + * @stable ICU 3.8 + */ +U_STABLE const UChar * U_EXPORT2 +udatpg_getDateTimeFormat(const UDateTimePatternGenerator *dtpg, + int32_t *pLength); + +/** + * The decimal value is used in formatting fractions of seconds. If the + * skeleton contains fractional seconds, then this is used with the + * fractional seconds. For example, suppose that the input pattern is + * "hhmmssSSSS", and the best matching pattern internally is "H:mm:ss", and + * the decimal string is ",". Then the resulting pattern is modified to be + * "H:mm:ss,SSSS" + * + * @param dtpg a pointer to UDateTimePatternGenerator. + * @param decimal + * @param length the length of decimal. + * @stable ICU 3.8 + */ +U_STABLE void U_EXPORT2 +udatpg_setDecimal(UDateTimePatternGenerator *dtpg, + const UChar *decimal, int32_t length); + +/** + * Getter corresponding to setDecimal. + * + * @param dtpg a pointer to UDateTimePatternGenerator. + * @param pLength A pointer that will receive the length of the decimal string. + * @return corresponding to the decimal point. + * @stable ICU 3.8 + */ +U_STABLE const UChar * U_EXPORT2 +udatpg_getDecimal(const UDateTimePatternGenerator *dtpg, + int32_t *pLength); + +/** + * Adjusts the field types (width and subtype) of a pattern to match what is + * in a skeleton. That is, if you supply a pattern like "d-M H:m", and a + * skeleton of "MMMMddhhmm", then the input pattern is adjusted to be + * "dd-MMMM hh:mm". This is used internally to get the best match for the + * input skeleton, but can also be used externally. + * + * Note that this function uses a non-const UDateTimePatternGenerator: + * It uses a stateful pattern parser which is set up for each generator object, + * rather than creating one for each function call. + * Consecutive calls to this function do not affect each other, + * but this function cannot be used concurrently on a single generator object. + * + * @param dtpg a pointer to UDateTimePatternGenerator. + * @param pattern Input pattern + * @param patternLength the length of input pattern. + * @param skeleton + * @param skeletonLength the length of input skeleton. + * @param dest pattern adjusted to match the skeleton fields widths and subtypes. + * @param destCapacity the capacity of dest. + * @param pErrorCode a pointer to the UErrorCode which must not indicate a + * failure before the function call. + * @return the length of dest. + * @stable ICU 3.8 + */ +U_STABLE int32_t U_EXPORT2 +udatpg_replaceFieldTypes(UDateTimePatternGenerator *dtpg, + const UChar *pattern, int32_t patternLength, + const UChar *skeleton, int32_t skeletonLength, + UChar *dest, int32_t destCapacity, + UErrorCode *pErrorCode); + +/** + * Adjusts the field types (width and subtype) of a pattern to match what is + * in a skeleton. That is, if you supply a pattern like "d-M H:m", and a + * skeleton of "MMMMddhhmm", then the input pattern is adjusted to be + * "dd-MMMM hh:mm". This is used internally to get the best match for the + * input skeleton, but can also be used externally. + * + * Note that this function uses a non-const UDateTimePatternGenerator: + * It uses a stateful pattern parser which is set up for each generator object, + * rather than creating one for each function call. + * Consecutive calls to this function do not affect each other, + * but this function cannot be used concurrently on a single generator object. + * + * @param dtpg a pointer to UDateTimePatternGenerator. + * @param pattern Input pattern + * @param patternLength the length of input pattern. + * @param skeleton + * @param skeletonLength the length of input skeleton. + * @param options + * Options controlling whether the length of specified fields in the + * pattern are adjusted to match those in the skeleton (when this + * would not happen otherwise). For default behavior, use + * UDATPG_MATCH_NO_OPTIONS. + * @param dest pattern adjusted to match the skeleton fields widths and subtypes. + * @param destCapacity the capacity of dest. + * @param pErrorCode a pointer to the UErrorCode which must not indicate a + * failure before the function call. + * @return the length of dest. + * @stable ICU 4.4 + */ +U_STABLE int32_t U_EXPORT2 +udatpg_replaceFieldTypesWithOptions(UDateTimePatternGenerator *dtpg, + const UChar *pattern, int32_t patternLength, + const UChar *skeleton, int32_t skeletonLength, + UDateTimePatternMatchOptions options, + UChar *dest, int32_t destCapacity, + UErrorCode *pErrorCode); + +/** + * Return a UEnumeration list of all the skeletons in canonical form. + * Call udatpg_getPatternForSkeleton() to get the corresponding pattern. + * + * @param dtpg a pointer to UDateTimePatternGenerator. + * @param pErrorCode a pointer to the UErrorCode which must not indicate a + * failure before the function call + * @return a UEnumeration list of all the skeletons + * The caller must close the object. + * @stable ICU 3.8 + */ +U_STABLE UEnumeration * U_EXPORT2 +udatpg_openSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode); + +/** + * Return a UEnumeration list of all the base skeletons in canonical form. + * + * @param dtpg a pointer to UDateTimePatternGenerator. + * @param pErrorCode a pointer to the UErrorCode which must not indicate a + * failure before the function call. + * @return a UEnumeration list of all the base skeletons + * The caller must close the object. + * @stable ICU 3.8 + */ +U_STABLE UEnumeration * U_EXPORT2 +udatpg_openBaseSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode); + +/** + * Get the pattern corresponding to a given skeleton. + * + * @param dtpg a pointer to UDateTimePatternGenerator. + * @param skeleton + * @param skeletonLength pointer to the length of skeleton. + * @param pLength pointer to the length of return pattern. + * @return pattern corresponding to a given skeleton. + * @stable ICU 3.8 + */ +U_STABLE const UChar * U_EXPORT2 +udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg, + const UChar *skeleton, int32_t skeletonLength, + int32_t *pLength); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/udisplaycontext.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/udisplaycontext.h new file mode 100644 index 0000000..398481c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/udisplaycontext.h @@ -0,0 +1,172 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +***************************************************************************************** +* Copyright (C) 2014-2016, International Business Machines +* Corporation and others. All Rights Reserved. +***************************************************************************************** +*/ + +#ifndef UDISPLAYCONTEXT_H +#define UDISPLAYCONTEXT_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +/** + * \file + * \brief C API: Display context types (enum values) + */ + +/** + * Display context types, for getting values of a particular setting. + * Note, the specific numeric values are internal and may change. + * @stable ICU 51 + */ +enum UDisplayContextType { + /** + * Type to retrieve the dialect handling setting, e.g. + * UDISPCTX_STANDARD_NAMES or UDISPCTX_DIALECT_NAMES. + * @stable ICU 51 + */ + UDISPCTX_TYPE_DIALECT_HANDLING = 0, + /** + * Type to retrieve the capitalization context setting, e.g. + * UDISPCTX_CAPITALIZATION_NONE, UDISPCTX_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE, + * UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE, etc. + * @stable ICU 51 + */ + UDISPCTX_TYPE_CAPITALIZATION = 1, + /** + * Type to retrieve the display length setting, e.g. + * UDISPCTX_LENGTH_FULL, UDISPCTX_LENGTH_SHORT. + * @stable ICU 54 + */ + UDISPCTX_TYPE_DISPLAY_LENGTH = 2, + /** + * Type to retrieve the substitute handling setting, e.g. + * UDISPCTX_SUBSTITUTE, UDISPCTX_NO_SUBSTITUTE. + * @stable ICU 58 + */ + UDISPCTX_TYPE_SUBSTITUTE_HANDLING = 3 +}; +/** +* @stable ICU 51 +*/ +typedef enum UDisplayContextType UDisplayContextType; + +/** + * Display context settings. + * Note, the specific numeric values are internal and may change. + * @stable ICU 51 + */ +enum UDisplayContext { + /** + * ================================ + * DIALECT_HANDLING can be set to one of UDISPCTX_STANDARD_NAMES or + * UDISPCTX_DIALECT_NAMES. Use UDisplayContextType UDISPCTX_TYPE_DIALECT_HANDLING + * to get the value. + */ + /** + * A possible setting for DIALECT_HANDLING: + * use standard names when generating a locale name, + * e.g. en_GB displays as 'English (United Kingdom)'. + * @stable ICU 51 + */ + UDISPCTX_STANDARD_NAMES = (UDISPCTX_TYPE_DIALECT_HANDLING<<8) + 0, + /** + * A possible setting for DIALECT_HANDLING: + * use dialect names, when generating a locale name, + * e.g. en_GB displays as 'British English'. + * @stable ICU 51 + */ + UDISPCTX_DIALECT_NAMES = (UDISPCTX_TYPE_DIALECT_HANDLING<<8) + 1, + /** + * ================================ + * CAPITALIZATION can be set to one of UDISPCTX_CAPITALIZATION_NONE, + * UDISPCTX_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE, + * UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE, + * UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU, or + * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. + * Use UDisplayContextType UDISPCTX_TYPE_CAPITALIZATION to get the value. + */ + /** + * The capitalization context to be used is unknown (this is the default value). + * @stable ICU 51 + */ + UDISPCTX_CAPITALIZATION_NONE = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 0, + /** + * The capitalization context if a date, date symbol or display name is to be + * formatted with capitalization appropriate for the middle of a sentence. + * @stable ICU 51 + */ + UDISPCTX_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 1, + /** + * The capitalization context if a date, date symbol or display name is to be + * formatted with capitalization appropriate for the beginning of a sentence. + * @stable ICU 51 + */ + UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 2, + /** + * The capitalization context if a date, date symbol or display name is to be + * formatted with capitalization appropriate for a user-interface list or menu item. + * @stable ICU 51 + */ + UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 3, + /** + * The capitalization context if a date, date symbol or display name is to be + * formatted with capitalization appropriate for stand-alone usage such as an + * isolated name on a calendar page. + * @stable ICU 51 + */ + UDISPCTX_CAPITALIZATION_FOR_STANDALONE = (UDISPCTX_TYPE_CAPITALIZATION<<8) + 4, + /** + * ================================ + * DISPLAY_LENGTH can be set to one of UDISPCTX_LENGTH_FULL or + * UDISPCTX_LENGTH_SHORT. Use UDisplayContextType UDISPCTX_TYPE_DISPLAY_LENGTH + * to get the value. + */ + /** + * A possible setting for DISPLAY_LENGTH: + * use full names when generating a locale name, + * e.g. "United States" for US. + * @stable ICU 54 + */ + UDISPCTX_LENGTH_FULL = (UDISPCTX_TYPE_DISPLAY_LENGTH<<8) + 0, + /** + * A possible setting for DISPLAY_LENGTH: + * use short names when generating a locale name, + * e.g. "U.S." for US. + * @stable ICU 54 + */ + UDISPCTX_LENGTH_SHORT = (UDISPCTX_TYPE_DISPLAY_LENGTH<<8) + 1, + /** + * ================================ + * SUBSTITUTE_HANDLING can be set to one of UDISPCTX_SUBSTITUTE or + * UDISPCTX_NO_SUBSTITUTE. Use UDisplayContextType UDISPCTX_TYPE_SUBSTITUTE_HANDLING + * to get the value. + */ + /** + * A possible setting for SUBSTITUTE_HANDLING: + * Returns a fallback value (e.g., the input code) when no data is available. + * This is the default value. + * @stable ICU 58 + */ + UDISPCTX_SUBSTITUTE = (UDISPCTX_TYPE_SUBSTITUTE_HANDLING<<8) + 0, + /** + * A possible setting for SUBSTITUTE_HANDLING: + * Returns a null value when no data is available. + * @stable ICU 58 + */ + UDISPCTX_NO_SUBSTITUTE = (UDISPCTX_TYPE_SUBSTITUTE_HANDLING<<8) + 1 + +}; +/** +* @stable ICU 51 +*/ +typedef enum UDisplayContext UDisplayContext; + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/uenum.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/uenum.h new file mode 100644 index 0000000..fc6efa2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/uenum.h @@ -0,0 +1,210 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2002-2013, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: uenum.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:2 +* +* created on: 2002jul08 +* created by: Vladimir Weinstein +*/ + +#ifndef __UENUM_H +#define __UENUM_H + +#include "unicode/utypes.h" +#include "unicode/localpointer.h" + +#if U_SHOW_CPLUSPLUS_API +U_NAMESPACE_BEGIN +class StringEnumeration; +U_NAMESPACE_END +#endif + +/** + * \file + * \brief C API: String Enumeration + */ + +/** + * An enumeration object. + * For usage in C programs. + * @stable ICU 2.2 + */ +struct UEnumeration; +/** structure representing an enumeration object instance @stable ICU 2.2 */ +typedef struct UEnumeration UEnumeration; + +/** + * Disposes of resources in use by the iterator. If en is NULL, + * does nothing. After this call, any char* or UChar* pointer + * returned by uenum_unext() or uenum_next() is invalid. + * @param en UEnumeration structure pointer + * @stable ICU 2.2 + */ +U_STABLE void U_EXPORT2 +uenum_close(UEnumeration* en); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUEnumerationPointer + * "Smart pointer" class, closes a UEnumeration via uenum_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUEnumerationPointer, UEnumeration, uenum_close); + +U_NAMESPACE_END + +#endif + +/** + * Returns the number of elements that the iterator traverses. If + * the iterator is out-of-sync with its service, status is set to + * U_ENUM_OUT_OF_SYNC_ERROR. + * This is a convenience function. It can end up being very + * expensive as all the items might have to be pre-fetched (depending + * on the type of data being traversed). Use with caution and only + * when necessary. + * @param en UEnumeration structure pointer + * @param status error code, can be U_ENUM_OUT_OF_SYNC_ERROR if the + * iterator is out of sync. + * @return number of elements in the iterator + * @stable ICU 2.2 + */ +U_STABLE int32_t U_EXPORT2 +uenum_count(UEnumeration* en, UErrorCode* status); + +/** + * Returns the next element in the iterator's list. If there are + * no more elements, returns NULL. If the iterator is out-of-sync + * with its service, status is set to U_ENUM_OUT_OF_SYNC_ERROR and + * NULL is returned. If the native service string is a char* string, + * it is converted to UChar* with the invariant converter. + * The result is terminated by (UChar)0. + * @param en the iterator object + * @param resultLength pointer to receive the length of the result + * (not including the terminating \\0). + * If the pointer is NULL it is ignored. + * @param status the error code, set to U_ENUM_OUT_OF_SYNC_ERROR if + * the iterator is out of sync with its service. + * @return a pointer to the string. The string will be + * zero-terminated. The return pointer is owned by this iterator + * and must not be deleted by the caller. The pointer is valid + * until the next call to any uenum_... method, including + * uenum_next() or uenum_unext(). When all strings have been + * traversed, returns NULL. + * @stable ICU 2.2 + */ +U_STABLE const UChar* U_EXPORT2 +uenum_unext(UEnumeration* en, + int32_t* resultLength, + UErrorCode* status); + +/** + * Returns the next element in the iterator's list. If there are + * no more elements, returns NULL. If the iterator is out-of-sync + * with its service, status is set to U_ENUM_OUT_OF_SYNC_ERROR and + * NULL is returned. If the native service string is a UChar* + * string, it is converted to char* with the invariant converter. + * The result is terminated by (char)0. If the conversion fails + * (because a character cannot be converted) then status is set to + * U_INVARIANT_CONVERSION_ERROR and the return value is undefined + * (but non-NULL). + * @param en the iterator object + * @param resultLength pointer to receive the length of the result + * (not including the terminating \\0). + * If the pointer is NULL it is ignored. + * @param status the error code, set to U_ENUM_OUT_OF_SYNC_ERROR if + * the iterator is out of sync with its service. Set to + * U_INVARIANT_CONVERSION_ERROR if the underlying native string is + * UChar* and conversion to char* with the invariant converter + * fails. This error pertains only to current string, so iteration + * might be able to continue successfully. + * @return a pointer to the string. The string will be + * zero-terminated. The return pointer is owned by this iterator + * and must not be deleted by the caller. The pointer is valid + * until the next call to any uenum_... method, including + * uenum_next() or uenum_unext(). When all strings have been + * traversed, returns NULL. + * @stable ICU 2.2 + */ +U_STABLE const char* U_EXPORT2 +uenum_next(UEnumeration* en, + int32_t* resultLength, + UErrorCode* status); + +/** + * Resets the iterator to the current list of service IDs. This + * re-establishes sync with the service and rewinds the iterator + * to start at the first element. + * @param en the iterator object + * @param status the error code, set to U_ENUM_OUT_OF_SYNC_ERROR if + * the iterator is out of sync with its service. + * @stable ICU 2.2 + */ +U_STABLE void U_EXPORT2 +uenum_reset(UEnumeration* en, UErrorCode* status); + +#if U_SHOW_CPLUSPLUS_API + +/** + * Given a StringEnumeration, wrap it in a UEnumeration. The + * StringEnumeration is adopted; after this call, the caller must not + * delete it (regardless of error status). + * @param adopted the C++ StringEnumeration to be wrapped in a UEnumeration. + * @param ec the error code. + * @return a UEnumeration wrapping the adopted StringEnumeration. + * @stable ICU 4.2 + */ +U_STABLE UEnumeration* U_EXPORT2 +uenum_openFromStringEnumeration(icu::StringEnumeration* adopted, UErrorCode* ec); + +#endif + +/** + * Given an array of const UChar* strings, return a UEnumeration. String pointers from 0..count-1 must not be null. + * Do not free or modify either the string array or the characters it points to until this object has been destroyed with uenum_close. + * \snippet test/cintltst/uenumtst.c uenum_openUCharStringsEnumeration + * @param strings array of const UChar* strings (each null terminated). All storage is owned by the caller. + * @param count length of the array + * @param ec error code + * @return the new UEnumeration object. Caller is responsible for calling uenum_close to free memory. + * @see uenum_close + * @stable ICU 50 + */ +U_STABLE UEnumeration* U_EXPORT2 +uenum_openUCharStringsEnumeration(const UChar* const strings[], int32_t count, + UErrorCode* ec); + +/* Note: next function is not hidden as draft, as it is used internally (it was formerly an internal function). */ + +/** + * Given an array of const char* strings (invariant chars only), return a UEnumeration. String pointers from 0..count-1 must not be null. + * Do not free or modify either the string array or the characters it points to until this object has been destroyed with uenum_close. + * \snippet test/cintltst/uenumtst.c uenum_openCharStringsEnumeration + * @param strings array of char* strings (each null terminated). All storage is owned by the caller. + * @param count length of the array + * @param ec error code + * @return the new UEnumeration object. Caller is responsible for calling uenum_close to free memory + * @see uenum_close + * @stable ICU 50 + */ +U_STABLE UEnumeration* U_EXPORT2 +uenum_openCharStringsEnumeration(const char* const strings[], int32_t count, + UErrorCode* ec); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ufieldpositer.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ufieldpositer.h new file mode 100644 index 0000000..3ae73b6 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ufieldpositer.h @@ -0,0 +1,121 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +***************************************************************************************** +* Copyright (C) 2015-2016, International Business Machines +* Corporation and others. All Rights Reserved. +***************************************************************************************** +*/ + +#ifndef UFIELDPOSITER_H +#define UFIELDPOSITER_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/localpointer.h" + +/** + * \file + * \brief C API: UFieldPositionIterator for use with format APIs. + * + * Usage: + * ufieldpositer_open creates an empty (unset) UFieldPositionIterator. + * This can be passed to format functions such as {@link #udat_formatForFields}, + * which will set it to apply to the fields in a particular formatted string. + * ufieldpositer_next can then be used to iterate over those fields, + * providing for each field its type (using values that are specific to the + * particular format type, such as date or number formats), as well as the + * start and end positions of the field in the formatted string. + * A given UFieldPositionIterator can be re-used for different format calls; + * each such call resets it to apply to that format string. + * ufieldpositer_close should be called to dispose of the UFieldPositionIterator + * when it is no longer needed. + * + * @see FieldPositionIterator + */ + +/** + * Opaque UFieldPositionIterator object for use in C. + * @stable ICU 55 + */ +struct UFieldPositionIterator; +typedef struct UFieldPositionIterator UFieldPositionIterator; /**< C typedef for struct UFieldPositionIterator. @stable ICU 55 */ + +/** + * Open a new, unset UFieldPositionIterator object. + * @param status + * A pointer to a UErrorCode to receive any errors. + * @return + * A pointer to an empty (unset) UFieldPositionIterator object, + * or NULL if an error occurred. + * @stable ICU 55 + */ +U_STABLE UFieldPositionIterator* U_EXPORT2 +ufieldpositer_open(UErrorCode* status); + +/** + * Close a UFieldPositionIterator object. Once closed it may no longer be used. + * @param fpositer + * A pointer to the UFieldPositionIterator object to close. + * @stable ICU 55 + */ +U_STABLE void U_EXPORT2 +ufieldpositer_close(UFieldPositionIterator *fpositer); + + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUFieldPositionIteratorPointer + * "Smart pointer" class, closes a UFieldPositionIterator via ufieldpositer_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 55 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUFieldPositionIteratorPointer, UFieldPositionIterator, ufieldpositer_close); + +U_NAMESPACE_END + +#endif + +/** + * Get information for the next field in the formatted string to which this + * UFieldPositionIterator currently applies, or return a negative value if there + * are no more fields. + * @param fpositer + * A pointer to the UFieldPositionIterator object containing iteration + * state for the format fields. + * @param beginIndex + * A pointer to an int32_t to receive information about the start offset + * of the field in the formatted string (undefined if the function + * returns a negative value). May be NULL if this information is not needed. + * @param endIndex + * A pointer to an int32_t to receive information about the end offset + * of the field in the formatted string (undefined if the function + * returns a negative value). May be NULL if this information is not needed. + * @return + * The field type (non-negative value), or a negative value if there are + * no more fields for which to provide information. If negative, then any + * values pointed to by beginIndex and endIndex are undefined. + * + * The values for field type depend on what type of formatter the + * UFieldPositionIterator has been set by; for a date formatter, the + * values from the UDateFormatField enum. For more information, see the + * descriptions of format functions that take a UFieldPositionIterator* + * parameter, such as {@link #udat_formatForFields}. + * + * @stable ICU 55 + */ +U_STABLE int32_t U_EXPORT2 +ufieldpositer_next(UFieldPositionIterator *fpositer, + int32_t *beginIndex, int32_t *endIndex); + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/uformattable.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/uformattable.h new file mode 100644 index 0000000..9ba2a36 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/uformattable.h @@ -0,0 +1,288 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************** +* Copyright (C) 2013-2014, International Business Machines Corporation and others. +* All Rights Reserved. +******************************************************************************** +* +* File UFORMATTABLE.H +* +* Modification History: +* +* Date Name Description +* 2013 Jun 7 srl New +******************************************************************************** +*/ + +/** + * \file + * \brief C API: UFormattable is a thin wrapper for primitive types used for formatting and parsing. + * + * This is a C interface to the icu::Formattable class. Static functions on this class convert + * to and from this interface (via reinterpret_cast). Note that Formattables (and thus UFormattables) + * are mutable, and many operations (even getters) may actually modify the internal state. For this + * reason, UFormattables are not thread safe, and should not be shared between threads. + * + * See {@link unum_parseToUFormattable} for example code. + */ + +#ifndef UFORMATTABLE_H +#define UFORMATTABLE_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/localpointer.h" + +/** + * Enum designating the type of a UFormattable instance. + * Practically, this indicates which of the getters would return without conversion + * or error. + * @see icu::Formattable::Type + * @stable ICU 52 + */ +typedef enum UFormattableType { + UFMT_DATE = 0, /**< ufmt_getDate() will return without conversion. @see ufmt_getDate*/ + UFMT_DOUBLE, /**< ufmt_getDouble() will return without conversion. @see ufmt_getDouble*/ + UFMT_LONG, /**< ufmt_getLong() will return without conversion. @see ufmt_getLong */ + UFMT_STRING, /**< ufmt_getUChars() will return without conversion. @see ufmt_getUChars*/ + UFMT_ARRAY, /**< ufmt_countArray() and ufmt_getArray() will return the value. @see ufmt_getArrayItemByIndex */ + UFMT_INT64, /**< ufmt_getInt64() will return without conversion. @see ufmt_getInt64 */ + UFMT_OBJECT, /**< ufmt_getObject() will return without conversion. @see ufmt_getObject*/ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UFormattableType value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UFMT_COUNT +#endif /* U_HIDE_DEPRECATED_API */ +} UFormattableType; + + +/** + * Opaque type representing various types of data which may be used for formatting + * and parsing operations. + * @see icu::Formattable + * @stable ICU 52 + */ +typedef void *UFormattable; + +/** + * Initialize a UFormattable, to type UNUM_LONG, value 0 + * may return error if memory allocation failed. + * parameter status error code. + * See {@link unum_parseToUFormattable} for example code. + * @stable ICU 52 + * @return the new UFormattable + * @see ufmt_close + * @see icu::Formattable::Formattable() + */ +U_STABLE UFormattable* U_EXPORT2 +ufmt_open(UErrorCode* status); + +/** + * Cleanup any additional memory allocated by this UFormattable. + * @param fmt the formatter + * @stable ICU 52 + * @see ufmt_open + */ +U_STABLE void U_EXPORT2 +ufmt_close(UFormattable* fmt); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUFormattablePointer + * "Smart pointer" class, closes a UFormattable via ufmt_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 52 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattablePointer, UFormattable, ufmt_close); + +U_NAMESPACE_END + +#endif + +/** + * Return the type of this object + * @param fmt the UFormattable object + * @param status status code - U_ILLEGAL_ARGUMENT_ERROR is returned if the UFormattable contains data not supported by + * the API + * @return the value as a UFormattableType + * @see ufmt_isNumeric + * @see icu::Formattable::getType() const + * @stable ICU 52 + */ +U_STABLE UFormattableType U_EXPORT2 +ufmt_getType(const UFormattable* fmt, UErrorCode *status); + +/** + * Return whether the object is numeric. + * @param fmt the UFormattable object + * @return true if the object is a double, long, or int64 value, else false. + * @see ufmt_getType + * @see icu::Formattable::isNumeric() const + * @stable ICU 52 + */ +U_STABLE UBool U_EXPORT2 +ufmt_isNumeric(const UFormattable* fmt); + +/** + * Gets the UDate value of this object. If the type is not of type UFMT_DATE, + * status is set to U_INVALID_FORMAT_ERROR and the return value is + * undefined. + * @param fmt the UFormattable object + * @param status the error code - any conversion or format errors + * @return the value + * @stable ICU 52 + * @see icu::Formattable::getDate(UErrorCode&) const + */ +U_STABLE UDate U_EXPORT2 +ufmt_getDate(const UFormattable* fmt, UErrorCode *status); + +/** + * Gets the double value of this object. If the type is not a UFMT_DOUBLE, or + * if there are additional significant digits than fit in a double type, + * a conversion is performed with possible loss of precision. + * If the type is UFMT_OBJECT and the + * object is a Measure, then the result of + * getNumber().getDouble(status) is returned. If this object is + * neither a numeric type nor a Measure, then 0 is returned and + * the status is set to U_INVALID_FORMAT_ERROR. + * @param fmt the UFormattable object + * @param status the error code - any conversion or format errors + * @return the value + * @stable ICU 52 + * @see icu::Formattable::getDouble(UErrorCode&) const + */ +U_STABLE double U_EXPORT2 +ufmt_getDouble(UFormattable* fmt, UErrorCode *status); + +/** + * Gets the long (int32_t) value of this object. If the magnitude is too + * large to fit in a long, then the maximum or minimum long value, + * as appropriate, is returned and the status is set to + * U_INVALID_FORMAT_ERROR. If this object is of type UFMT_INT64 and + * it fits within a long, then no precision is lost. If it is of + * type kDouble or kDecimalNumber, then a conversion is peformed, with + * truncation of any fractional part. If the type is UFMT_OBJECT and + * the object is a Measure, then the result of + * getNumber().getLong(status) is returned. If this object is + * neither a numeric type nor a Measure, then 0 is returned and + * the status is set to U_INVALID_FORMAT_ERROR. + * @param fmt the UFormattable object + * @param status the error code - any conversion or format errors + * @return the value + * @stable ICU 52 + * @see icu::Formattable::getLong(UErrorCode&) const + */ +U_STABLE int32_t U_EXPORT2 +ufmt_getLong(UFormattable* fmt, UErrorCode *status); + + +/** + * Gets the int64_t value of this object. If this object is of a numeric + * type and the magnitude is too large to fit in an int64, then + * the maximum or minimum int64 value, as appropriate, is returned + * and the status is set to U_INVALID_FORMAT_ERROR. If the + * magnitude fits in an int64, then a casting conversion is + * peformed, with truncation of any fractional part. If the type + * is UFMT_OBJECT and the object is a Measure, then the result of + * getNumber().getDouble(status) is returned. If this object is + * neither a numeric type nor a Measure, then 0 is returned and + * the status is set to U_INVALID_FORMAT_ERROR. + * @param fmt the UFormattable object + * @param status the error code - any conversion or format errors + * @return the value + * @stable ICU 52 + * @see icu::Formattable::getInt64(UErrorCode&) const + */ +U_STABLE int64_t U_EXPORT2 +ufmt_getInt64(UFormattable* fmt, UErrorCode *status); + +/** + * Returns a pointer to the UObject contained within this + * formattable (as a const void*), or NULL if this object + * is not of type UFMT_OBJECT. + * @param fmt the UFormattable object + * @param status the error code - any conversion or format errors + * @return the value as a const void*. It is a polymorphic C++ object. + * @stable ICU 52 + * @see icu::Formattable::getObject() const + */ +U_STABLE const void *U_EXPORT2 +ufmt_getObject(const UFormattable* fmt, UErrorCode *status); + +/** + * Gets the string value of this object as a UChar string. If the type is not a + * string, status is set to U_INVALID_FORMAT_ERROR and a NULL pointer is returned. + * This function is not thread safe and may modify the UFormattable if need be to terminate the string. + * The returned pointer is not valid if any other functions are called on this UFormattable, or if the UFormattable is closed. + * @param fmt the UFormattable object + * @param status the error code - any conversion or format errors + * @param len if non null, contains the string length on return + * @return the null terminated string value - must not be referenced after any other functions are called on this UFormattable. + * @stable ICU 52 + * @see icu::Formattable::getString(UnicodeString&)const + */ +U_STABLE const UChar* U_EXPORT2 +ufmt_getUChars(UFormattable* fmt, int32_t *len, UErrorCode *status); + +/** + * Get the number of array objects contained, if an array type UFMT_ARRAY + * @param fmt the UFormattable object + * @param status the error code - any conversion or format errors. U_ILLEGAL_ARGUMENT_ERROR if not an array type. + * @return the number of array objects or undefined if not an array type + * @stable ICU 52 + * @see ufmt_getArrayItemByIndex + */ +U_STABLE int32_t U_EXPORT2 +ufmt_getArrayLength(const UFormattable* fmt, UErrorCode *status); + +/** + * Get the specified value from the array of UFormattables. Invalid if the object is not an array type UFMT_ARRAY + * @param fmt the UFormattable object + * @param n the number of the array to return (0 based). + * @param status the error code - any conversion or format errors. Returns an error if n is out of bounds. + * @return the nth array value, only valid while the containing UFormattable is valid. NULL if not an array. + * @stable ICU 52 + * @see icu::Formattable::getArray(int32_t&, UErrorCode&) const + */ +U_STABLE UFormattable * U_EXPORT2 +ufmt_getArrayItemByIndex(UFormattable* fmt, int32_t n, UErrorCode *status); + +/** + * Returns a numeric string representation of the number contained within this + * formattable, or NULL if this object does not contain numeric type. + * For values obtained by parsing, the returned decimal number retains + * the full precision and range of the original input, unconstrained by + * the limits of a double floating point or a 64 bit int. + * + * This function is not thread safe, and therfore is not declared const, + * even though it is logically const. + * The resulting buffer is owned by the UFormattable and is invalid if any other functions are + * called on the UFormattable. + * + * Possible errors include U_MEMORY_ALLOCATION_ERROR, and + * U_INVALID_STATE if the formattable object has not been set to + * a numeric type. + * @param fmt the UFormattable object + * @param len if non-null, on exit contains the string length (not including the terminating null) + * @param status the error code + * @return the character buffer as a NULL terminated string, which is owned by the object and must not be accessed if any other functions are called on this object. + * @stable ICU 52 + * @see icu::Formattable::getDecimalNumber(UErrorCode&) + */ +U_STABLE const char * U_EXPORT2 +ufmt_getDecNumChars(UFormattable *fmt, int32_t *len, UErrorCode *status); + +#endif + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ugender.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ugender.h new file mode 100644 index 0000000..d015a23 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ugender.h @@ -0,0 +1,84 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +***************************************************************************************** +* Copyright (C) 2010-2013, International Business Machines +* Corporation and others. All Rights Reserved. +***************************************************************************************** +*/ + +#ifndef UGENDER_H +#define UGENDER_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/localpointer.h" + +/** + * \file + * \brief C API: The purpose of this API is to compute the gender of a list as a + * whole given the gender of each element. + * + */ + +/** + * Genders + * @stable ICU 50 + */ +enum UGender { + /** + * Male gender. + * @stable ICU 50 + */ + UGENDER_MALE, + /** + * Female gender. + * @stable ICU 50 + */ + UGENDER_FEMALE, + /** + * Neutral gender. + * @stable ICU 50 + */ + UGENDER_OTHER +}; +/** + * @stable ICU 50 + */ +typedef enum UGender UGender; + +/** + * Opaque UGenderInfo object for use in C programs. + * @stable ICU 50 + */ +struct UGenderInfo; +typedef struct UGenderInfo UGenderInfo; + +/** + * Opens a new UGenderInfo object given locale. + * @param locale The locale for which the rules are desired. + * @param status UErrorCode pointer + * @return A UGenderInfo for the specified locale, or NULL if an error occurred. + * @stable ICU 50 + */ +U_STABLE const UGenderInfo* U_EXPORT2 +ugender_getInstance(const char *locale, UErrorCode *status); + + +/** + * Given a list, returns the gender of the list as a whole. + * @param genderInfo pointer that ugender_getInstance returns. + * @param genders the gender of each element in the list. + * @param size the size of the list. + * @param status A pointer to a UErrorCode to receive any errors. + * @return The gender of the list. + * @stable ICU 50 + */ +U_STABLE UGender U_EXPORT2 +ugender_getListGender(const UGenderInfo* genderinfo, const UGender *genders, int32_t size, UErrorCode *status); + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/uidna.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/uidna.h new file mode 100644 index 0000000..0dafb76 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/uidna.h @@ -0,0 +1,772 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ******************************************************************************* + * + * Copyright (C) 2003-2014, International Business Machines + * Corporation and others. All Rights Reserved. + * + ******************************************************************************* + * file name: uidna.h + * encoding: UTF-8 + * tab size: 8 (not used) + * indentation:4 + * + * created on: 2003feb1 + * created by: Ram Viswanadha + */ + +#ifndef __UIDNA_H__ +#define __UIDNA_H__ + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_IDNA + +#include "unicode/localpointer.h" +#include "unicode/parseerr.h" + +/** + * \file + * \brief C API: Internationalizing Domain Names in Applications (IDNA) + * + * IDNA2008 is implemented according to UTS #46, see the IDNA C++ class in idna.h. + * + * The C API functions which do take a UIDNA * service object pointer + * implement UTS #46 and IDNA2008. + * + * IDNA2003 is obsolete. + * The C API functions which do not take a service object pointer + * implement IDNA2003. They are all deprecated. + */ + +/* + * IDNA option bit set values. + */ +enum { + /** + * Default options value: None of the other options are set. + * For use in static worker and factory methods. + * @stable ICU 2.6 + */ + UIDNA_DEFAULT=0, +#ifndef U_HIDE_DEPRECATED_API + /** + * Option to allow unassigned code points in domain names and labels. + * For use in static worker and factory methods. + *

This option is ignored by the UTS46 implementation. + * (UTS #46 disallows unassigned code points.) + * @deprecated ICU 55 Use UTS #46 instead via uidna_openUTS46() or class IDNA. + */ + UIDNA_ALLOW_UNASSIGNED=1, +#endif /* U_HIDE_DEPRECATED_API */ + /** + * Option to check whether the input conforms to the STD3 ASCII rules, + * for example the restriction of labels to LDH characters + * (ASCII Letters, Digits and Hyphen-Minus). + * For use in static worker and factory methods. + * @stable ICU 2.6 + */ + UIDNA_USE_STD3_RULES=2, + /** + * IDNA option to check for whether the input conforms to the BiDi rules. + * For use in static worker and factory methods. + *

This option is ignored by the IDNA2003 implementation. + * (IDNA2003 always performs a BiDi check.) + * @stable ICU 4.6 + */ + UIDNA_CHECK_BIDI=4, + /** + * IDNA option to check for whether the input conforms to the CONTEXTJ rules. + * For use in static worker and factory methods. + *

This option is ignored by the IDNA2003 implementation. + * (The CONTEXTJ check is new in IDNA2008.) + * @stable ICU 4.6 + */ + UIDNA_CHECK_CONTEXTJ=8, + /** + * IDNA option for nontransitional processing in ToASCII(). + * For use in static worker and factory methods. + *

By default, ToASCII() uses transitional processing. + *

This option is ignored by the IDNA2003 implementation. + * (This is only relevant for compatibility of newer IDNA implementations with IDNA2003.) + * @stable ICU 4.6 + */ + UIDNA_NONTRANSITIONAL_TO_ASCII=0x10, + /** + * IDNA option for nontransitional processing in ToUnicode(). + * For use in static worker and factory methods. + *

By default, ToUnicode() uses transitional processing. + *

This option is ignored by the IDNA2003 implementation. + * (This is only relevant for compatibility of newer IDNA implementations with IDNA2003.) + * @stable ICU 4.6 + */ + UIDNA_NONTRANSITIONAL_TO_UNICODE=0x20, + /** + * IDNA option to check for whether the input conforms to the CONTEXTO rules. + * For use in static worker and factory methods. + *

This option is ignored by the IDNA2003 implementation. + * (The CONTEXTO check is new in IDNA2008.) + *

This is for use by registries for IDNA2008 conformance. + * UTS #46 does not require the CONTEXTO check. + * @stable ICU 49 + */ + UIDNA_CHECK_CONTEXTO=0x40 +}; + +/** + * Opaque C service object type for the new IDNA API. + * @stable ICU 4.6 + */ +struct UIDNA; +typedef struct UIDNA UIDNA; /**< C typedef for struct UIDNA. @stable ICU 4.6 */ + +/** + * Returns a UIDNA instance which implements UTS #46. + * Returns an unmodifiable instance, owned by the caller. + * Cache it for multiple operations, and uidna_close() it when done. + * The instance is thread-safe, that is, it can be used concurrently. + * + * For details about the UTS #46 implementation see the IDNA C++ class in idna.h. + * + * @param options Bit set to modify the processing and error checking. + * See option bit set values in uidna.h. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the UTS #46 UIDNA instance, if successful + * @stable ICU 4.6 + */ +U_STABLE UIDNA * U_EXPORT2 +uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode); + +/** + * Closes a UIDNA instance. + * @param idna UIDNA instance to be closed + * @stable ICU 4.6 + */ +U_STABLE void U_EXPORT2 +uidna_close(UIDNA *idna); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUIDNAPointer + * "Smart pointer" class, closes a UIDNA via uidna_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.6 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUIDNAPointer, UIDNA, uidna_close); + +U_NAMESPACE_END + +#endif + +/** + * Output container for IDNA processing errors. + * Initialize with UIDNA_INFO_INITIALIZER: + * \code + * UIDNAInfo info = UIDNA_INFO_INITIALIZER; + * int32_t length = uidna_nameToASCII(..., &info, &errorCode); + * if(U_SUCCESS(errorCode) && info.errors!=0) { ... } + * \endcode + * @stable ICU 4.6 + */ +typedef struct UIDNAInfo { + /** sizeof(UIDNAInfo) @stable ICU 4.6 */ + int16_t size; + /** + * Set to TRUE if transitional and nontransitional processing produce different results. + * For details see C++ IDNAInfo::isTransitionalDifferent(). + * @stable ICU 4.6 + */ + UBool isTransitionalDifferent; + UBool reservedB3; /**< Reserved field, do not use. @internal */ + /** + * Bit set indicating IDNA processing errors. 0 if no errors. + * See UIDNA_ERROR_... constants. + * @stable ICU 4.6 + */ + uint32_t errors; + int32_t reservedI2; /**< Reserved field, do not use. @internal */ + int32_t reservedI3; /**< Reserved field, do not use. @internal */ +} UIDNAInfo; + +/** + * Static initializer for a UIDNAInfo struct. + * @stable ICU 4.6 + */ +#define UIDNA_INFO_INITIALIZER { \ + (int16_t)sizeof(UIDNAInfo), \ + FALSE, FALSE, \ + 0, 0, 0 } + +/** + * Converts a single domain name label into its ASCII form for DNS lookup. + * If any processing step fails, then pInfo->errors will be non-zero and + * the result might not be an ASCII string. + * The label might be modified according to the types of errors. + * Labels with severe errors will be left in (or turned into) their Unicode form. + * + * The UErrorCode indicates an error only in exceptional cases, + * such as a U_MEMORY_ALLOCATION_ERROR. + * + * @param idna UIDNA instance + * @param label Input domain name label + * @param length Label length, or -1 if NUL-terminated + * @param dest Destination string buffer + * @param capacity Destination buffer capacity + * @param pInfo Output container of IDNA processing details. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return destination string length + * @stable ICU 4.6 + */ +U_STABLE int32_t U_EXPORT2 +uidna_labelToASCII(const UIDNA *idna, + const UChar *label, int32_t length, + UChar *dest, int32_t capacity, + UIDNAInfo *pInfo, UErrorCode *pErrorCode); + +/** + * Converts a single domain name label into its Unicode form for human-readable display. + * If any processing step fails, then pInfo->errors will be non-zero. + * The label might be modified according to the types of errors. + * + * The UErrorCode indicates an error only in exceptional cases, + * such as a U_MEMORY_ALLOCATION_ERROR. + * + * @param idna UIDNA instance + * @param label Input domain name label + * @param length Label length, or -1 if NUL-terminated + * @param dest Destination string buffer + * @param capacity Destination buffer capacity + * @param pInfo Output container of IDNA processing details. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return destination string length + * @stable ICU 4.6 + */ +U_STABLE int32_t U_EXPORT2 +uidna_labelToUnicode(const UIDNA *idna, + const UChar *label, int32_t length, + UChar *dest, int32_t capacity, + UIDNAInfo *pInfo, UErrorCode *pErrorCode); + +/** + * Converts a whole domain name into its ASCII form for DNS lookup. + * If any processing step fails, then pInfo->errors will be non-zero and + * the result might not be an ASCII string. + * The domain name might be modified according to the types of errors. + * Labels with severe errors will be left in (or turned into) their Unicode form. + * + * The UErrorCode indicates an error only in exceptional cases, + * such as a U_MEMORY_ALLOCATION_ERROR. + * + * @param idna UIDNA instance + * @param name Input domain name + * @param length Domain name length, or -1 if NUL-terminated + * @param dest Destination string buffer + * @param capacity Destination buffer capacity + * @param pInfo Output container of IDNA processing details. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return destination string length + * @stable ICU 4.6 + */ +U_STABLE int32_t U_EXPORT2 +uidna_nameToASCII(const UIDNA *idna, + const UChar *name, int32_t length, + UChar *dest, int32_t capacity, + UIDNAInfo *pInfo, UErrorCode *pErrorCode); + +/** + * Converts a whole domain name into its Unicode form for human-readable display. + * If any processing step fails, then pInfo->errors will be non-zero. + * The domain name might be modified according to the types of errors. + * + * The UErrorCode indicates an error only in exceptional cases, + * such as a U_MEMORY_ALLOCATION_ERROR. + * + * @param idna UIDNA instance + * @param name Input domain name + * @param length Domain name length, or -1 if NUL-terminated + * @param dest Destination string buffer + * @param capacity Destination buffer capacity + * @param pInfo Output container of IDNA processing details. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return destination string length + * @stable ICU 4.6 + */ +U_STABLE int32_t U_EXPORT2 +uidna_nameToUnicode(const UIDNA *idna, + const UChar *name, int32_t length, + UChar *dest, int32_t capacity, + UIDNAInfo *pInfo, UErrorCode *pErrorCode); + +/* UTF-8 versions of the processing methods --------------------------------- */ + +/** + * Converts a single domain name label into its ASCII form for DNS lookup. + * UTF-8 version of uidna_labelToASCII(), same behavior. + * + * @param idna UIDNA instance + * @param label Input domain name label + * @param length Label length, or -1 if NUL-terminated + * @param dest Destination string buffer + * @param capacity Destination buffer capacity + * @param pInfo Output container of IDNA processing details. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return destination string length + * @stable ICU 4.6 + */ +U_STABLE int32_t U_EXPORT2 +uidna_labelToASCII_UTF8(const UIDNA *idna, + const char *label, int32_t length, + char *dest, int32_t capacity, + UIDNAInfo *pInfo, UErrorCode *pErrorCode); + +/** + * Converts a single domain name label into its Unicode form for human-readable display. + * UTF-8 version of uidna_labelToUnicode(), same behavior. + * + * @param idna UIDNA instance + * @param label Input domain name label + * @param length Label length, or -1 if NUL-terminated + * @param dest Destination string buffer + * @param capacity Destination buffer capacity + * @param pInfo Output container of IDNA processing details. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return destination string length + * @stable ICU 4.6 + */ +U_STABLE int32_t U_EXPORT2 +uidna_labelToUnicodeUTF8(const UIDNA *idna, + const char *label, int32_t length, + char *dest, int32_t capacity, + UIDNAInfo *pInfo, UErrorCode *pErrorCode); + +/** + * Converts a whole domain name into its ASCII form for DNS lookup. + * UTF-8 version of uidna_nameToASCII(), same behavior. + * + * @param idna UIDNA instance + * @param name Input domain name + * @param length Domain name length, or -1 if NUL-terminated + * @param dest Destination string buffer + * @param capacity Destination buffer capacity + * @param pInfo Output container of IDNA processing details. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return destination string length + * @stable ICU 4.6 + */ +U_STABLE int32_t U_EXPORT2 +uidna_nameToASCII_UTF8(const UIDNA *idna, + const char *name, int32_t length, + char *dest, int32_t capacity, + UIDNAInfo *pInfo, UErrorCode *pErrorCode); + +/** + * Converts a whole domain name into its Unicode form for human-readable display. + * UTF-8 version of uidna_nameToUnicode(), same behavior. + * + * @param idna UIDNA instance + * @param name Input domain name + * @param length Domain name length, or -1 if NUL-terminated + * @param dest Destination string buffer + * @param capacity Destination buffer capacity + * @param pInfo Output container of IDNA processing details. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return destination string length + * @stable ICU 4.6 + */ +U_STABLE int32_t U_EXPORT2 +uidna_nameToUnicodeUTF8(const UIDNA *idna, + const char *name, int32_t length, + char *dest, int32_t capacity, + UIDNAInfo *pInfo, UErrorCode *pErrorCode); + +/* + * IDNA error bit set values. + * When a domain name or label fails a processing step or does not meet the + * validity criteria, then one or more of these error bits are set. + */ +enum { + /** + * A non-final domain name label (or the whole domain name) is empty. + * @stable ICU 4.6 + */ + UIDNA_ERROR_EMPTY_LABEL=1, + /** + * A domain name label is longer than 63 bytes. + * (See STD13/RFC1034 3.1. Name space specifications and terminology.) + * This is only checked in ToASCII operations, and only if the output label is all-ASCII. + * @stable ICU 4.6 + */ + UIDNA_ERROR_LABEL_TOO_LONG=2, + /** + * A domain name is longer than 255 bytes in its storage form. + * (See STD13/RFC1034 3.1. Name space specifications and terminology.) + * This is only checked in ToASCII operations, and only if the output domain name is all-ASCII. + * @stable ICU 4.6 + */ + UIDNA_ERROR_DOMAIN_NAME_TOO_LONG=4, + /** + * A label starts with a hyphen-minus ('-'). + * @stable ICU 4.6 + */ + UIDNA_ERROR_LEADING_HYPHEN=8, + /** + * A label ends with a hyphen-minus ('-'). + * @stable ICU 4.6 + */ + UIDNA_ERROR_TRAILING_HYPHEN=0x10, + /** + * A label contains hyphen-minus ('-') in the third and fourth positions. + * @stable ICU 4.6 + */ + UIDNA_ERROR_HYPHEN_3_4=0x20, + /** + * A label starts with a combining mark. + * @stable ICU 4.6 + */ + UIDNA_ERROR_LEADING_COMBINING_MARK=0x40, + /** + * A label or domain name contains disallowed characters. + * @stable ICU 4.6 + */ + UIDNA_ERROR_DISALLOWED=0x80, + /** + * A label starts with "xn--" but does not contain valid Punycode. + * That is, an xn-- label failed Punycode decoding. + * @stable ICU 4.6 + */ + UIDNA_ERROR_PUNYCODE=0x100, + /** + * A label contains a dot=full stop. + * This can occur in an input string for a single-label function. + * @stable ICU 4.6 + */ + UIDNA_ERROR_LABEL_HAS_DOT=0x200, + /** + * An ACE label does not contain a valid label string. + * The label was successfully ACE (Punycode) decoded but the resulting + * string had severe validation errors. For example, + * it might contain characters that are not allowed in ACE labels, + * or it might not be normalized. + * @stable ICU 4.6 + */ + UIDNA_ERROR_INVALID_ACE_LABEL=0x400, + /** + * A label does not meet the IDNA BiDi requirements (for right-to-left characters). + * @stable ICU 4.6 + */ + UIDNA_ERROR_BIDI=0x800, + /** + * A label does not meet the IDNA CONTEXTJ requirements. + * @stable ICU 4.6 + */ + UIDNA_ERROR_CONTEXTJ=0x1000, + /** + * A label does not meet the IDNA CONTEXTO requirements for punctuation characters. + * Some punctuation characters "Would otherwise have been DISALLOWED" + * but are allowed in certain contexts. (RFC 5892) + * @stable ICU 49 + */ + UIDNA_ERROR_CONTEXTO_PUNCTUATION=0x2000, + /** + * A label does not meet the IDNA CONTEXTO requirements for digits. + * Arabic-Indic Digits (U+066x) must not be mixed with Extended Arabic-Indic Digits (U+06Fx). + * @stable ICU 49 + */ + UIDNA_ERROR_CONTEXTO_DIGITS=0x4000 +}; + +#ifndef U_HIDE_DEPRECATED_API + +/* IDNA2003 API ------------------------------------------------------------- */ + +/** + * IDNA2003: This function implements the ToASCII operation as defined in the IDNA RFC. + * This operation is done on single labels before sending it to something that expects + * ASCII names. A label is an individual part of a domain name. Labels are usually + * separated by dots; e.g. "www.example.com" is composed of 3 labels "www","example", and "com". + * + * IDNA2003 API Overview: + * + * The uidna_ API implements the IDNA protocol as defined in the IDNA RFC + * (http://www.ietf.org/rfc/rfc3490.txt). + * The RFC defines 2 operations: ToASCII and ToUnicode. Domain name labels + * containing non-ASCII code points are processed by the + * ToASCII operation before passing it to resolver libraries. Domain names + * that are obtained from resolver libraries are processed by the + * ToUnicode operation before displaying the domain name to the user. + * IDNA requires that implementations process input strings with Nameprep + * (http://www.ietf.org/rfc/rfc3491.txt), + * which is a profile of Stringprep (http://www.ietf.org/rfc/rfc3454.txt), + * and then with Punycode (http://www.ietf.org/rfc/rfc3492.txt). + * Implementations of IDNA MUST fully implement Nameprep and Punycode; + * neither Nameprep nor Punycode are optional. + * The input and output of ToASCII and ToUnicode operations are Unicode + * and are designed to be chainable, i.e., applying ToASCII or ToUnicode operations + * multiple times to an input string will yield the same result as applying the operation + * once. + * ToUnicode(ToUnicode(ToUnicode...(ToUnicode(string)))) == ToUnicode(string) + * ToASCII(ToASCII(ToASCII...(ToASCII(string))) == ToASCII(string). + * + * @param src Input UChar array containing label in Unicode. + * @param srcLength Number of UChars in src, or -1 if NUL-terminated. + * @param dest Output UChar array with ASCII (ACE encoded) label. + * @param destCapacity Size of dest. + * @param options A bit set of options: + * + * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points + * and do not use STD3 ASCII rules + * If unassigned code points are found the operation fails with + * U_UNASSIGNED_ERROR error code. + * + * - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations + * If this option is set, the unassigned code points are in the input + * are treated as normal Unicode code points. + * + * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions + * If this option is set and the input does not satisfy STD3 rules, + * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR + * + * @param parseError Pointer to UParseError struct to receive information on position + * of error if an error is encountered. Can be NULL. + * @param status ICU in/out error code parameter. + * U_INVALID_CHAR_FOUND if src contains + * unmatched single surrogates. + * U_INDEX_OUTOFBOUNDS_ERROR if src contains + * too many code points. + * U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough + * @return The length of the result string, if successful - or in case of a buffer overflow, + * in which case it will be greater than destCapacity. + * @deprecated ICU 55 Use UTS #46 instead via uidna_openUTS46() or class IDNA. + */ +U_DEPRECATED int32_t U_EXPORT2 +uidna_toASCII(const UChar* src, int32_t srcLength, + UChar* dest, int32_t destCapacity, + int32_t options, + UParseError* parseError, + UErrorCode* status); + + +/** + * IDNA2003: This function implements the ToUnicode operation as defined in the IDNA RFC. + * This operation is done on single labels before sending it to something that expects + * Unicode names. A label is an individual part of a domain name. Labels are usually + * separated by dots; for e.g. "www.example.com" is composed of 3 labels "www","example", and "com". + * + * @param src Input UChar array containing ASCII (ACE encoded) label. + * @param srcLength Number of UChars in src, or -1 if NUL-terminated. + * @param dest Output Converted UChar array containing Unicode equivalent of label. + * @param destCapacity Size of dest. + * @param options A bit set of options: + * + * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points + * and do not use STD3 ASCII rules + * If unassigned code points are found the operation fails with + * U_UNASSIGNED_ERROR error code. + * + * - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations + * If this option is set, the unassigned code points are in the input + * are treated as normal Unicode code points. Note: This option is + * required on toUnicode operation because the RFC mandates + * verification of decoded ACE input by applying toASCII and comparing + * its output with source + * + * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions + * If this option is set and the input does not satisfy STD3 rules, + * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR + * + * @param parseError Pointer to UParseError struct to receive information on position + * of error if an error is encountered. Can be NULL. + * @param status ICU in/out error code parameter. + * U_INVALID_CHAR_FOUND if src contains + * unmatched single surrogates. + * U_INDEX_OUTOFBOUNDS_ERROR if src contains + * too many code points. + * U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough + * @return The length of the result string, if successful - or in case of a buffer overflow, + * in which case it will be greater than destCapacity. + * @deprecated ICU 55 Use UTS #46 instead via uidna_openUTS46() or class IDNA. + */ +U_DEPRECATED int32_t U_EXPORT2 +uidna_toUnicode(const UChar* src, int32_t srcLength, + UChar* dest, int32_t destCapacity, + int32_t options, + UParseError* parseError, + UErrorCode* status); + + +/** + * IDNA2003: Convenience function that implements the IDNToASCII operation as defined in the IDNA RFC. + * This operation is done on complete domain names, e.g: "www.example.com". + * It is important to note that this operation can fail. If it fails, then the input + * domain name cannot be used as an Internationalized Domain Name and the application + * should have methods defined to deal with the failure. + * + * Note: IDNA RFC specifies that a conformant application should divide a domain name + * into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each, + * and then convert. This function does not offer that level of granularity. The options once + * set will apply to all labels in the domain name + * + * @param src Input UChar array containing IDN in Unicode. + * @param srcLength Number of UChars in src, or -1 if NUL-terminated. + * @param dest Output UChar array with ASCII (ACE encoded) IDN. + * @param destCapacity Size of dest. + * @param options A bit set of options: + * + * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points + * and do not use STD3 ASCII rules + * If unassigned code points are found the operation fails with + * U_UNASSIGNED_CODE_POINT_FOUND error code. + * + * - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations + * If this option is set, the unassigned code points are in the input + * are treated as normal Unicode code points. + * + * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions + * If this option is set and the input does not satisfy STD3 rules, + * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR + * + * @param parseError Pointer to UParseError struct to receive information on position + * of error if an error is encountered. Can be NULL. + * @param status ICU in/out error code parameter. + * U_INVALID_CHAR_FOUND if src contains + * unmatched single surrogates. + * U_INDEX_OUTOFBOUNDS_ERROR if src contains + * too many code points. + * U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough + * @return The length of the result string, if successful - or in case of a buffer overflow, + * in which case it will be greater than destCapacity. + * @deprecated ICU 55 Use UTS #46 instead via uidna_openUTS46() or class IDNA. + */ +U_DEPRECATED int32_t U_EXPORT2 +uidna_IDNToASCII( const UChar* src, int32_t srcLength, + UChar* dest, int32_t destCapacity, + int32_t options, + UParseError* parseError, + UErrorCode* status); + +/** + * IDNA2003: Convenience function that implements the IDNToUnicode operation as defined in the IDNA RFC. + * This operation is done on complete domain names, e.g: "www.example.com". + * + * Note: IDNA RFC specifies that a conformant application should divide a domain name + * into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each, + * and then convert. This function does not offer that level of granularity. The options once + * set will apply to all labels in the domain name + * + * @param src Input UChar array containing IDN in ASCII (ACE encoded) form. + * @param srcLength Number of UChars in src, or -1 if NUL-terminated. + * @param dest Output UChar array containing Unicode equivalent of source IDN. + * @param destCapacity Size of dest. + * @param options A bit set of options: + * + * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points + * and do not use STD3 ASCII rules + * If unassigned code points are found the operation fails with + * U_UNASSIGNED_CODE_POINT_FOUND error code. + * + * - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations + * If this option is set, the unassigned code points are in the input + * are treated as normal Unicode code points. + * + * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions + * If this option is set and the input does not satisfy STD3 rules, + * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR + * + * @param parseError Pointer to UParseError struct to receive information on position + * of error if an error is encountered. Can be NULL. + * @param status ICU in/out error code parameter. + * U_INVALID_CHAR_FOUND if src contains + * unmatched single surrogates. + * U_INDEX_OUTOFBOUNDS_ERROR if src contains + * too many code points. + * U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough + * @return The length of the result string, if successful - or in case of a buffer overflow, + * in which case it will be greater than destCapacity. + * @deprecated ICU 55 Use UTS #46 instead via uidna_openUTS46() or class IDNA. + */ +U_DEPRECATED int32_t U_EXPORT2 +uidna_IDNToUnicode( const UChar* src, int32_t srcLength, + UChar* dest, int32_t destCapacity, + int32_t options, + UParseError* parseError, + UErrorCode* status); + +/** + * IDNA2003: Compare two IDN strings for equivalence. + * This function splits the domain names into labels and compares them. + * According to IDN RFC, whenever two labels are compared, they are + * considered equal if and only if their ASCII forms (obtained by + * applying toASCII) match using an case-insensitive ASCII comparison. + * Two domain names are considered a match if and only if all labels + * match regardless of whether label separators match. + * + * @param s1 First source string. + * @param length1 Length of first source string, or -1 if NUL-terminated. + * + * @param s2 Second source string. + * @param length2 Length of second source string, or -1 if NUL-terminated. + * @param options A bit set of options: + * + * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points + * and do not use STD3 ASCII rules + * If unassigned code points are found the operation fails with + * U_UNASSIGNED_CODE_POINT_FOUND error code. + * + * - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations + * If this option is set, the unassigned code points are in the input + * are treated as normal Unicode code points. + * + * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions + * If this option is set and the input does not satisfy STD3 rules, + * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR + * + * @param status ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return <0 or 0 or >0 as usual for string comparisons + * @deprecated ICU 55 Use UTS #46 instead via uidna_openUTS46() or class IDNA. + */ +U_DEPRECATED int32_t U_EXPORT2 +uidna_compare( const UChar *s1, int32_t length1, + const UChar *s2, int32_t length2, + int32_t options, + UErrorCode* status); + +#endif /* U_HIDE_DEPRECATED_API */ + +#endif /* #if !UCONFIG_NO_IDNA */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/uiter.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/uiter.h new file mode 100644 index 0000000..11ad75a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/uiter.h @@ -0,0 +1,709 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2002-2011 International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: uiter.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2002jan18 +* created by: Markus W. Scherer +*/ + +#ifndef __UITER_H__ +#define __UITER_H__ + +/** + * \file + * \brief C API: Unicode Character Iteration + * + * @see UCharIterator + */ + +#include "unicode/utypes.h" + +#if U_SHOW_CPLUSPLUS_API + U_NAMESPACE_BEGIN + + class CharacterIterator; + class Replaceable; + + U_NAMESPACE_END +#endif + +U_CDECL_BEGIN + +struct UCharIterator; +typedef struct UCharIterator UCharIterator; /**< C typedef for struct UCharIterator. @stable ICU 2.1 */ + +/** + * Origin constants for UCharIterator.getIndex() and UCharIterator.move(). + * @see UCharIteratorMove + * @see UCharIterator + * @stable ICU 2.1 + */ +typedef enum UCharIteratorOrigin { + UITER_START, UITER_CURRENT, UITER_LIMIT, UITER_ZERO, UITER_LENGTH +} UCharIteratorOrigin; + +/** Constants for UCharIterator. @stable ICU 2.6 */ +enum { + /** + * Constant value that may be returned by UCharIteratorMove + * indicating that the final UTF-16 index is not known, but that the move succeeded. + * This can occur when moving relative to limit or length, or + * when moving relative to the current index after a setState() + * when the current UTF-16 index is not known. + * + * It would be very inefficient to have to count from the beginning of the text + * just to get the current/limit/length index after moving relative to it. + * The actual index can be determined with getIndex(UITER_CURRENT) + * which will count the UChars if necessary. + * + * @stable ICU 2.6 + */ + UITER_UNKNOWN_INDEX=-2 +}; + + +/** + * Constant for UCharIterator getState() indicating an error or + * an unknown state. + * Returned by uiter_getState()/UCharIteratorGetState + * when an error occurs. + * Also, some UCharIterator implementations may not be able to return + * a valid state for each position. This will be clearly documented + * for each such iterator (none of the public ones here). + * + * @stable ICU 2.6 + */ +#define UITER_NO_STATE ((uint32_t)0xffffffff) + +/** + * Function type declaration for UCharIterator.getIndex(). + * + * Gets the current position, or the start or limit of the + * iteration range. + * + * This function may perform slowly for UITER_CURRENT after setState() was called, + * or for UITER_LENGTH, because an iterator implementation may have to count + * UChars if the underlying storage is not UTF-16. + * + * @param iter the UCharIterator structure ("this pointer") + * @param origin get the 0, start, limit, length, or current index + * @return the requested index, or U_SENTINEL in an error condition + * + * @see UCharIteratorOrigin + * @see UCharIterator + * @stable ICU 2.1 + */ +typedef int32_t U_CALLCONV +UCharIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin); + +/** + * Function type declaration for UCharIterator.move(). + * + * Use iter->move(iter, index, UITER_ZERO) like CharacterIterator::setIndex(index). + * + * Moves the current position relative to the start or limit of the + * iteration range, or relative to the current position itself. + * The movement is expressed in numbers of code units forward + * or backward by specifying a positive or negative delta. + * Out of bounds movement will be pinned to the start or limit. + * + * This function may perform slowly for moving relative to UITER_LENGTH + * because an iterator implementation may have to count the rest of the + * UChars if the native storage is not UTF-16. + * + * When moving relative to the limit or length, or + * relative to the current position after setState() was called, + * move() may return UITER_UNKNOWN_INDEX (-2) to avoid an inefficient + * determination of the actual UTF-16 index. + * The actual index can be determined with getIndex(UITER_CURRENT) + * which will count the UChars if necessary. + * See UITER_UNKNOWN_INDEX for details. + * + * @param iter the UCharIterator structure ("this pointer") + * @param delta can be positive, zero, or negative + * @param origin move relative to the 0, start, limit, length, or current index + * @return the new index, or U_SENTINEL on an error condition, + * or UITER_UNKNOWN_INDEX when the index is not known. + * + * @see UCharIteratorOrigin + * @see UCharIterator + * @see UITER_UNKNOWN_INDEX + * @stable ICU 2.1 + */ +typedef int32_t U_CALLCONV +UCharIteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin); + +/** + * Function type declaration for UCharIterator.hasNext(). + * + * Check if current() and next() can still + * return another code unit. + * + * @param iter the UCharIterator structure ("this pointer") + * @return boolean value for whether current() and next() can still return another code unit + * + * @see UCharIterator + * @stable ICU 2.1 + */ +typedef UBool U_CALLCONV +UCharIteratorHasNext(UCharIterator *iter); + +/** + * Function type declaration for UCharIterator.hasPrevious(). + * + * Check if previous() can still return another code unit. + * + * @param iter the UCharIterator structure ("this pointer") + * @return boolean value for whether previous() can still return another code unit + * + * @see UCharIterator + * @stable ICU 2.1 + */ +typedef UBool U_CALLCONV +UCharIteratorHasPrevious(UCharIterator *iter); + +/** + * Function type declaration for UCharIterator.current(). + * + * Return the code unit at the current position, + * or U_SENTINEL if there is none (index is at the limit). + * + * @param iter the UCharIterator structure ("this pointer") + * @return the current code unit + * + * @see UCharIterator + * @stable ICU 2.1 + */ +typedef UChar32 U_CALLCONV +UCharIteratorCurrent(UCharIterator *iter); + +/** + * Function type declaration for UCharIterator.next(). + * + * Return the code unit at the current index and increment + * the index (post-increment, like s[i++]), + * or return U_SENTINEL if there is none (index is at the limit). + * + * @param iter the UCharIterator structure ("this pointer") + * @return the current code unit (and post-increment the current index) + * + * @see UCharIterator + * @stable ICU 2.1 + */ +typedef UChar32 U_CALLCONV +UCharIteratorNext(UCharIterator *iter); + +/** + * Function type declaration for UCharIterator.previous(). + * + * Decrement the index and return the code unit from there + * (pre-decrement, like s[--i]), + * or return U_SENTINEL if there is none (index is at the start). + * + * @param iter the UCharIterator structure ("this pointer") + * @return the previous code unit (after pre-decrementing the current index) + * + * @see UCharIterator + * @stable ICU 2.1 + */ +typedef UChar32 U_CALLCONV +UCharIteratorPrevious(UCharIterator *iter); + +/** + * Function type declaration for UCharIterator.reservedFn(). + * Reserved for future use. + * + * @param iter the UCharIterator structure ("this pointer") + * @param something some integer argument + * @return some integer + * + * @see UCharIterator + * @stable ICU 2.1 + */ +typedef int32_t U_CALLCONV +UCharIteratorReserved(UCharIterator *iter, int32_t something); + +/** + * Function type declaration for UCharIterator.getState(). + * + * Get the "state" of the iterator in the form of a single 32-bit word. + * It is recommended that the state value be calculated to be as small as + * is feasible. For strings with limited lengths, fewer than 32 bits may + * be sufficient. + * + * This is used together with setState()/UCharIteratorSetState + * to save and restore the iterator position more efficiently than with + * getIndex()/move(). + * + * The iterator state is defined as a uint32_t value because it is designed + * for use in ucol_nextSortKeyPart() which provides 32 bits to store the state + * of the character iterator. + * + * With some UCharIterator implementations (e.g., UTF-8), + * getting and setting the UTF-16 index with existing functions + * (getIndex(UITER_CURRENT) followed by move(pos, UITER_ZERO)) is possible but + * relatively slow because the iterator has to "walk" from a known index + * to the requested one. + * This takes more time the farther it needs to go. + * + * An opaque state value allows an iterator implementation to provide + * an internal index (UTF-8: the source byte array index) for + * fast, constant-time restoration. + * + * After calling setState(), a getIndex(UITER_CURRENT) may be slow because + * the UTF-16 index may not be restored as well, but the iterator can deliver + * the correct text contents and move relative to the current position + * without performance degradation. + * + * Some UCharIterator implementations may not be able to return + * a valid state for each position, in which case they return UITER_NO_STATE instead. + * This will be clearly documented for each such iterator (none of the public ones here). + * + * @param iter the UCharIterator structure ("this pointer") + * @return the state word + * + * @see UCharIterator + * @see UCharIteratorSetState + * @see UITER_NO_STATE + * @stable ICU 2.6 + */ +typedef uint32_t U_CALLCONV +UCharIteratorGetState(const UCharIterator *iter); + +/** + * Function type declaration for UCharIterator.setState(). + * + * Restore the "state" of the iterator using a state word from a getState() call. + * The iterator object need not be the same one as for which getState() was called, + * but it must be of the same type (set up using the same uiter_setXYZ function) + * and it must iterate over the same string + * (binary identical regardless of memory address). + * For more about the state word see UCharIteratorGetState. + * + * After calling setState(), a getIndex(UITER_CURRENT) may be slow because + * the UTF-16 index may not be restored as well, but the iterator can deliver + * the correct text contents and move relative to the current position + * without performance degradation. + * + * @param iter the UCharIterator structure ("this pointer") + * @param state the state word from a getState() call + * on a same-type, same-string iterator + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * + * @see UCharIterator + * @see UCharIteratorGetState + * @stable ICU 2.6 + */ +typedef void U_CALLCONV +UCharIteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode); + + +/** + * C API for code unit iteration. + * This can be used as a C wrapper around + * CharacterIterator, Replaceable, or implemented using simple strings, etc. + * + * There are two roles for using UCharIterator: + * + * A "provider" sets the necessary function pointers and controls the "protected" + * fields of the UCharIterator structure. A "provider" passes a UCharIterator + * into C APIs that need a UCharIterator as an abstract, flexible string interface. + * + * Implementations of such C APIs are "callers" of UCharIterator functions; + * they only use the "public" function pointers and never access the "protected" + * fields directly. + * + * The current() and next() functions only check the current index against the + * limit, and previous() only checks the current index against the start, + * to see if the iterator already reached the end of the iteration range. + * + * The assumption - in all iterators - is that the index is moved via the API, + * which means it won't go out of bounds, or the index is modified by + * user code that knows enough about the iterator implementation to set valid + * index values. + * + * UCharIterator functions return code unit values 0..0xffff, + * or U_SENTINEL if the iteration bounds are reached. + * + * @stable ICU 2.1 + */ +struct UCharIterator { + /** + * (protected) Pointer to string or wrapped object or similar. + * Not used by caller. + * @stable ICU 2.1 + */ + const void *context; + + /** + * (protected) Length of string or similar. + * Not used by caller. + * @stable ICU 2.1 + */ + int32_t length; + + /** + * (protected) Start index or similar. + * Not used by caller. + * @stable ICU 2.1 + */ + int32_t start; + + /** + * (protected) Current index or similar. + * Not used by caller. + * @stable ICU 2.1 + */ + int32_t index; + + /** + * (protected) Limit index or similar. + * Not used by caller. + * @stable ICU 2.1 + */ + int32_t limit; + + /** + * (protected) Used by UTF-8 iterators and possibly others. + * @stable ICU 2.1 + */ + int32_t reservedField; + + /** + * (public) Returns the current position or the + * start or limit index of the iteration range. + * + * @see UCharIteratorGetIndex + * @stable ICU 2.1 + */ + UCharIteratorGetIndex *getIndex; + + /** + * (public) Moves the current position relative to the start or limit of the + * iteration range, or relative to the current position itself. + * The movement is expressed in numbers of code units forward + * or backward by specifying a positive or negative delta. + * + * @see UCharIteratorMove + * @stable ICU 2.1 + */ + UCharIteratorMove *move; + + /** + * (public) Check if current() and next() can still + * return another code unit. + * + * @see UCharIteratorHasNext + * @stable ICU 2.1 + */ + UCharIteratorHasNext *hasNext; + + /** + * (public) Check if previous() can still return another code unit. + * + * @see UCharIteratorHasPrevious + * @stable ICU 2.1 + */ + UCharIteratorHasPrevious *hasPrevious; + + /** + * (public) Return the code unit at the current position, + * or U_SENTINEL if there is none (index is at the limit). + * + * @see UCharIteratorCurrent + * @stable ICU 2.1 + */ + UCharIteratorCurrent *current; + + /** + * (public) Return the code unit at the current index and increment + * the index (post-increment, like s[i++]), + * or return U_SENTINEL if there is none (index is at the limit). + * + * @see UCharIteratorNext + * @stable ICU 2.1 + */ + UCharIteratorNext *next; + + /** + * (public) Decrement the index and return the code unit from there + * (pre-decrement, like s[--i]), + * or return U_SENTINEL if there is none (index is at the start). + * + * @see UCharIteratorPrevious + * @stable ICU 2.1 + */ + UCharIteratorPrevious *previous; + + /** + * (public) Reserved for future use. Currently NULL. + * + * @see UCharIteratorReserved + * @stable ICU 2.1 + */ + UCharIteratorReserved *reservedFn; + + /** + * (public) Return the state of the iterator, to be restored later with setState(). + * This function pointer is NULL if the iterator does not implement it. + * + * @see UCharIteratorGet + * @stable ICU 2.6 + */ + UCharIteratorGetState *getState; + + /** + * (public) Restore the iterator state from the state word from a call + * to getState(). + * This function pointer is NULL if the iterator does not implement it. + * + * @see UCharIteratorSet + * @stable ICU 2.6 + */ + UCharIteratorSetState *setState; +}; + +/** + * Helper function for UCharIterator to get the code point + * at the current index. + * + * Return the code point that includes the code unit at the current position, + * or U_SENTINEL if there is none (index is at the limit). + * If the current code unit is a lead or trail surrogate, + * then the following or preceding surrogate is used to form + * the code point value. + * + * @param iter the UCharIterator structure ("this pointer") + * @return the current code point + * + * @see UCharIterator + * @see U16_GET + * @see UnicodeString::char32At() + * @stable ICU 2.1 + */ +U_STABLE UChar32 U_EXPORT2 +uiter_current32(UCharIterator *iter); + +/** + * Helper function for UCharIterator to get the next code point. + * + * Return the code point at the current index and increment + * the index (post-increment, like s[i++]), + * or return U_SENTINEL if there is none (index is at the limit). + * + * @param iter the UCharIterator structure ("this pointer") + * @return the current code point (and post-increment the current index) + * + * @see UCharIterator + * @see U16_NEXT + * @stable ICU 2.1 + */ +U_STABLE UChar32 U_EXPORT2 +uiter_next32(UCharIterator *iter); + +/** + * Helper function for UCharIterator to get the previous code point. + * + * Decrement the index and return the code point from there + * (pre-decrement, like s[--i]), + * or return U_SENTINEL if there is none (index is at the start). + * + * @param iter the UCharIterator structure ("this pointer") + * @return the previous code point (after pre-decrementing the current index) + * + * @see UCharIterator + * @see U16_PREV + * @stable ICU 2.1 + */ +U_STABLE UChar32 U_EXPORT2 +uiter_previous32(UCharIterator *iter); + +/** + * Get the "state" of the iterator in the form of a single 32-bit word. + * This is a convenience function that calls iter->getState(iter) + * if iter->getState is not NULL; + * if it is NULL or any other error occurs, then UITER_NO_STATE is returned. + * + * Some UCharIterator implementations may not be able to return + * a valid state for each position, in which case they return UITER_NO_STATE instead. + * This will be clearly documented for each such iterator (none of the public ones here). + * + * @param iter the UCharIterator structure ("this pointer") + * @return the state word + * + * @see UCharIterator + * @see UCharIteratorGetState + * @see UITER_NO_STATE + * @stable ICU 2.6 + */ +U_STABLE uint32_t U_EXPORT2 +uiter_getState(const UCharIterator *iter); + +/** + * Restore the "state" of the iterator using a state word from a getState() call. + * This is a convenience function that calls iter->setState(iter, state, pErrorCode) + * if iter->setState is not NULL; if it is NULL, then U_UNSUPPORTED_ERROR is set. + * + * @param iter the UCharIterator structure ("this pointer") + * @param state the state word from a getState() call + * on a same-type, same-string iterator + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * + * @see UCharIterator + * @see UCharIteratorSetState + * @stable ICU 2.6 + */ +U_STABLE void U_EXPORT2 +uiter_setState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode); + +/** + * Set up a UCharIterator to iterate over a string. + * + * Sets the UCharIterator function pointers for iteration over the string s + * with iteration boundaries start=index=0 and length=limit=string length. + * The "provider" may set the start, index, and limit values at any time + * within the range 0..length. + * The length field will be ignored. + * + * The string pointer s is set into UCharIterator.context without copying + * or reallocating the string contents. + * + * getState() simply returns the current index. + * move() will always return the final index. + * + * @param iter UCharIterator structure to be set for iteration + * @param s String to iterate over + * @param length Length of s, or -1 if NUL-terminated + * + * @see UCharIterator + * @stable ICU 2.1 + */ +U_STABLE void U_EXPORT2 +uiter_setString(UCharIterator *iter, const UChar *s, int32_t length); + +/** + * Set up a UCharIterator to iterate over a UTF-16BE string + * (byte vector with a big-endian pair of bytes per UChar). + * + * Everything works just like with a normal UChar iterator (uiter_setString), + * except that UChars are assembled from byte pairs, + * and that the length argument here indicates an even number of bytes. + * + * getState() simply returns the current index. + * move() will always return the final index. + * + * @param iter UCharIterator structure to be set for iteration + * @param s UTF-16BE string to iterate over + * @param length Length of s as an even number of bytes, or -1 if NUL-terminated + * (NUL means pair of 0 bytes at even index from s) + * + * @see UCharIterator + * @see uiter_setString + * @stable ICU 2.6 + */ +U_STABLE void U_EXPORT2 +uiter_setUTF16BE(UCharIterator *iter, const char *s, int32_t length); + +/** + * Set up a UCharIterator to iterate over a UTF-8 string. + * + * Sets the UCharIterator function pointers for iteration over the UTF-8 string s + * with UTF-8 iteration boundaries 0 and length. + * The implementation counts the UTF-16 index on the fly and + * lazily evaluates the UTF-16 length of the text. + * + * The start field is used as the UTF-8 offset, the limit field as the UTF-8 length. + * When the reservedField is not 0, then it contains a supplementary code point + * and the UTF-16 index is between the two corresponding surrogates. + * At that point, the UTF-8 index is behind that code point. + * + * The UTF-8 string pointer s is set into UCharIterator.context without copying + * or reallocating the string contents. + * + * getState() returns a state value consisting of + * - the current UTF-8 source byte index (bits 31..1) + * - a flag (bit 0) that indicates whether the UChar position is in the middle + * of a surrogate pair + * (from a 4-byte UTF-8 sequence for the corresponding supplementary code point) + * + * getState() cannot also encode the UTF-16 index in the state value. + * move(relative to limit or length), or + * move(relative to current) after setState(), may return UITER_UNKNOWN_INDEX. + * + * @param iter UCharIterator structure to be set for iteration + * @param s UTF-8 string to iterate over + * @param length Length of s in bytes, or -1 if NUL-terminated + * + * @see UCharIterator + * @stable ICU 2.6 + */ +U_STABLE void U_EXPORT2 +uiter_setUTF8(UCharIterator *iter, const char *s, int32_t length); + +#if U_SHOW_CPLUSPLUS_API + +/** + * Set up a UCharIterator to wrap around a C++ CharacterIterator. + * + * Sets the UCharIterator function pointers for iteration using the + * CharacterIterator charIter. + * + * The CharacterIterator pointer charIter is set into UCharIterator.context + * without copying or cloning the CharacterIterator object. + * The other "protected" UCharIterator fields are set to 0 and will be ignored. + * The iteration index and boundaries are controlled by the CharacterIterator. + * + * getState() simply returns the current index. + * move() will always return the final index. + * + * @param iter UCharIterator structure to be set for iteration + * @param charIter CharacterIterator to wrap + * + * @see UCharIterator + * @stable ICU 2.1 + */ +U_STABLE void U_EXPORT2 +uiter_setCharacterIterator(UCharIterator *iter, icu::CharacterIterator *charIter); + +/** + * Set up a UCharIterator to iterate over a C++ Replaceable. + * + * Sets the UCharIterator function pointers for iteration over the + * Replaceable rep with iteration boundaries start=index=0 and + * length=limit=rep->length(). + * The "provider" may set the start, index, and limit values at any time + * within the range 0..length=rep->length(). + * The length field will be ignored. + * + * The Replaceable pointer rep is set into UCharIterator.context without copying + * or cloning/reallocating the Replaceable object. + * + * getState() simply returns the current index. + * move() will always return the final index. + * + * @param iter UCharIterator structure to be set for iteration + * @param rep Replaceable to iterate over + * + * @see UCharIterator + * @stable ICU 2.1 + */ +U_STABLE void U_EXPORT2 +uiter_setReplaceable(UCharIterator *iter, const icu::Replaceable *rep); + +#endif + +U_CDECL_END + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/uldnames.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/uldnames.h new file mode 100644 index 0000000..3ebffa2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/uldnames.h @@ -0,0 +1,304 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2010-2016, International Business Machines Corporation and +* others. All Rights Reserved. +******************************************************************************* +*/ + +#ifndef __ULDNAMES_H__ +#define __ULDNAMES_H__ + +/** + * \file + * \brief C API: Provides display names of Locale ids and their components. + */ + +#include "unicode/utypes.h" +#include "unicode/localpointer.h" +#include "unicode/uscript.h" +#include "unicode/udisplaycontext.h" + +/** + * Enum used in LocaleDisplayNames::createInstance. + * @stable ICU 4.4 + */ +typedef enum { + /** + * Use standard names when generating a locale name, + * e.g. en_GB displays as 'English (United Kingdom)'. + * @stable ICU 4.4 + */ + ULDN_STANDARD_NAMES = 0, + /** + * Use dialect names, when generating a locale name, + * e.g. en_GB displays as 'British English'. + * @stable ICU 4.4 + */ + ULDN_DIALECT_NAMES +} UDialectHandling; + +/** + * Opaque C service object type for the locale display names API + * @stable ICU 4.4 + */ +struct ULocaleDisplayNames; + +/** + * C typedef for struct ULocaleDisplayNames. + * @stable ICU 4.4 + */ +typedef struct ULocaleDisplayNames ULocaleDisplayNames; + +#if !UCONFIG_NO_FORMATTING + +/** + * Returns an instance of LocaleDisplayNames that returns names + * formatted for the provided locale, using the provided + * dialectHandling. The usual value for dialectHandling is + * ULOC_STANDARD_NAMES. + * + * @param locale the display locale + * @param dialectHandling how to select names for locales + * @return a ULocaleDisplayNames instance + * @param pErrorCode the status code + * @stable ICU 4.4 + */ +U_STABLE ULocaleDisplayNames * U_EXPORT2 +uldn_open(const char * locale, + UDialectHandling dialectHandling, + UErrorCode *pErrorCode); + +/** + * Closes a ULocaleDisplayNames instance obtained from uldn_open(). + * @param ldn the ULocaleDisplayNames instance to be closed + * @stable ICU 4.4 + */ +U_STABLE void U_EXPORT2 +uldn_close(ULocaleDisplayNames *ldn); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalULocaleDisplayNamesPointer + * "Smart pointer" class, closes a ULocaleDisplayNames via uldn_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalULocaleDisplayNamesPointer, ULocaleDisplayNames, uldn_close); + +U_NAMESPACE_END + +#endif + +/* getters for state */ + +/** + * Returns the locale used to determine the display names. This is + * not necessarily the same locale passed to {@link #uldn_open}. + * @param ldn the LocaleDisplayNames instance + * @return the display locale + * @stable ICU 4.4 + */ +U_STABLE const char * U_EXPORT2 +uldn_getLocale(const ULocaleDisplayNames *ldn); + +/** + * Returns the dialect handling used in the display names. + * @param ldn the LocaleDisplayNames instance + * @return the dialect handling enum + * @stable ICU 4.4 + */ +U_STABLE UDialectHandling U_EXPORT2 +uldn_getDialectHandling(const ULocaleDisplayNames *ldn); + +/* names for entire locales */ + +/** + * Returns the display name of the provided locale. + * @param ldn the LocaleDisplayNames instance + * @param locale the locale whose display name to return + * @param result receives the display name + * @param maxResultSize the size of the result buffer + * @param pErrorCode the status code + * @return the actual buffer size needed for the display name. If it's + * greater than maxResultSize, the returned name will be truncated. + * @stable ICU 4.4 + */ +U_STABLE int32_t U_EXPORT2 +uldn_localeDisplayName(const ULocaleDisplayNames *ldn, + const char *locale, + UChar *result, + int32_t maxResultSize, + UErrorCode *pErrorCode); + +/* names for components of a locale */ + +/** + * Returns the display name of the provided language code. + * @param ldn the LocaleDisplayNames instance + * @param lang the language code whose display name to return + * @param result receives the display name + * @param maxResultSize the size of the result buffer + * @param pErrorCode the status code + * @return the actual buffer size needed for the display name. If it's + * greater than maxResultSize, the returned name will be truncated. + * @stable ICU 4.4 + */ +U_STABLE int32_t U_EXPORT2 +uldn_languageDisplayName(const ULocaleDisplayNames *ldn, + const char *lang, + UChar *result, + int32_t maxResultSize, + UErrorCode *pErrorCode); + +/** + * Returns the display name of the provided script. + * @param ldn the LocaleDisplayNames instance + * @param script the script whose display name to return + * @param result receives the display name + * @param maxResultSize the size of the result buffer + * @param pErrorCode the status code + * @return the actual buffer size needed for the display name. If it's + * greater than maxResultSize, the returned name will be truncated. + * @stable ICU 4.4 + */ +U_STABLE int32_t U_EXPORT2 +uldn_scriptDisplayName(const ULocaleDisplayNames *ldn, + const char *script, + UChar *result, + int32_t maxResultSize, + UErrorCode *pErrorCode); + +/** + * Returns the display name of the provided script code. + * @param ldn the LocaleDisplayNames instance + * @param scriptCode the script code whose display name to return + * @param result receives the display name + * @param maxResultSize the size of the result buffer + * @param pErrorCode the status code + * @return the actual buffer size needed for the display name. If it's + * greater than maxResultSize, the returned name will be truncated. + * @stable ICU 4.4 + */ +U_STABLE int32_t U_EXPORT2 +uldn_scriptCodeDisplayName(const ULocaleDisplayNames *ldn, + UScriptCode scriptCode, + UChar *result, + int32_t maxResultSize, + UErrorCode *pErrorCode); + +/** + * Returns the display name of the provided region code. + * @param ldn the LocaleDisplayNames instance + * @param region the region code whose display name to return + * @param result receives the display name + * @param maxResultSize the size of the result buffer + * @param pErrorCode the status code + * @return the actual buffer size needed for the display name. If it's + * greater than maxResultSize, the returned name will be truncated. + * @stable ICU 4.4 + */ +U_STABLE int32_t U_EXPORT2 +uldn_regionDisplayName(const ULocaleDisplayNames *ldn, + const char *region, + UChar *result, + int32_t maxResultSize, + UErrorCode *pErrorCode); + +/** + * Returns the display name of the provided variant + * @param ldn the LocaleDisplayNames instance + * @param variant the variant whose display name to return + * @param result receives the display name + * @param maxResultSize the size of the result buffer + * @param pErrorCode the status code + * @return the actual buffer size needed for the display name. If it's + * greater than maxResultSize, the returned name will be truncated. + * @stable ICU 4.4 + */ +U_STABLE int32_t U_EXPORT2 +uldn_variantDisplayName(const ULocaleDisplayNames *ldn, + const char *variant, + UChar *result, + int32_t maxResultSize, + UErrorCode *pErrorCode); + +/** + * Returns the display name of the provided locale key + * @param ldn the LocaleDisplayNames instance + * @param key the locale key whose display name to return + * @param result receives the display name + * @param maxResultSize the size of the result buffer + * @param pErrorCode the status code + * @return the actual buffer size needed for the display name. If it's + * greater than maxResultSize, the returned name will be truncated. + * @stable ICU 4.4 + */ +U_STABLE int32_t U_EXPORT2 +uldn_keyDisplayName(const ULocaleDisplayNames *ldn, + const char *key, + UChar *result, + int32_t maxResultSize, + UErrorCode *pErrorCode); + +/** + * Returns the display name of the provided value (used with the provided key). + * @param ldn the LocaleDisplayNames instance + * @param key the locale key + * @param value the locale key's value + * @param result receives the display name + * @param maxResultSize the size of the result buffer + * @param pErrorCode the status code + * @return the actual buffer size needed for the display name. If it's + * greater than maxResultSize, the returned name will be truncated. + * @stable ICU 4.4 + */ +U_STABLE int32_t U_EXPORT2 +uldn_keyValueDisplayName(const ULocaleDisplayNames *ldn, + const char *key, + const char *value, + UChar *result, + int32_t maxResultSize, + UErrorCode *pErrorCode); + +/** +* Returns an instance of LocaleDisplayNames that returns names formatted +* for the provided locale, using the provided UDisplayContext settings. +* +* @param locale The display locale +* @param contexts List of one or more context settings (e.g. for dialect +* handling, capitalization, etc. +* @param length Number of items in the contexts list +* @param pErrorCode Pointer to UErrorCode input/output status. If at entry this indicates +* a failure status, the function will do nothing; otherwise this will be +* updated with any new status from the function. +* @return a ULocaleDisplayNames instance +* @stable ICU 51 +*/ +U_STABLE ULocaleDisplayNames * U_EXPORT2 +uldn_openForContext(const char * locale, UDisplayContext *contexts, + int32_t length, UErrorCode *pErrorCode); + +/** +* Returns the UDisplayContext value for the specified UDisplayContextType. +* @param ldn the ULocaleDisplayNames instance +* @param type the UDisplayContextType whose value to return +* @param pErrorCode Pointer to UErrorCode input/output status. If at entry this indicates +* a failure status, the function will do nothing; otherwise this will be +* updated with any new status from the function. +* @return the UDisplayContextValue for the specified type. +* @stable ICU 51 +*/ +U_STABLE UDisplayContext U_EXPORT2 +uldn_getContext(const ULocaleDisplayNames *ldn, UDisplayContextType type, + UErrorCode *pErrorCode); + +#endif /* !UCONFIG_NO_FORMATTING */ +#endif /* __ULDNAMES_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ulistformatter.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ulistformatter.h new file mode 100644 index 0000000..9fe24f7 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ulistformatter.h @@ -0,0 +1,130 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +***************************************************************************************** +* Copyright (C) 2015-2016, International Business Machines +* Corporation and others. All Rights Reserved. +***************************************************************************************** +*/ + +#ifndef ULISTFORMATTER_H +#define ULISTFORMATTER_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/localpointer.h" + +/** + * \file + * \brief C API: Format a list in a locale-appropriate way. + * + * A UListFormatter is used to format a list of items in a locale-appropriate way, + * using data from CLDR. + * Example: Input data ["Alice", "Bob", "Charlie", "Delta"] will be formatted + * as "Alice, Bob, Charlie, and Delta" in English. + */ + +/** + * Opaque UListFormatter object for use in C + * @stable ICU 55 + */ +struct UListFormatter; +typedef struct UListFormatter UListFormatter; /**< C typedef for struct UListFormatter. @stable ICU 55 */ + +/** + * Open a new UListFormatter object using the rules for a given locale. + * @param locale + * The locale whose rules should be used; may be NULL for + * default locale. + * @param status + * A pointer to a standard ICU UErrorCode (input/output parameter). + * Its input value must pass the U_SUCCESS() test, or else the + * function returns immediately. The caller should check its output + * value with U_FAILURE(), or use with function chaining (see User + * Guide for details). + * @return + * A pointer to a UListFormatter object for the specified locale, + * or NULL if an error occurred. + * @stable ICU 55 + */ +U_CAPI UListFormatter* U_EXPORT2 +ulistfmt_open(const char* locale, + UErrorCode* status); + +/** + * Close a UListFormatter object. Once closed it may no longer be used. + * @param listfmt + * The UListFormatter object to close. + * @stable ICU 55 + */ +U_CAPI void U_EXPORT2 +ulistfmt_close(UListFormatter *listfmt); + + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUListFormatterPointer + * "Smart pointer" class, closes a UListFormatter via ulistfmt_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 55 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUListFormatterPointer, UListFormatter, ulistfmt_close); + +U_NAMESPACE_END + +#endif + +/** + * Formats a list of strings using the conventions established for the + * UListFormatter object. + * @param listfmt + * The UListFormatter object specifying the list conventions. + * @param strings + * An array of pointers to UChar strings; the array length is + * specified by stringCount. Must be non-NULL if stringCount > 0. + * @param stringLengths + * An array of string lengths corresponding to the strings[] + * parameter; any individual length value may be negative to indicate + * that the corresponding strings[] entry is 0-terminated, or + * stringLengths itself may be NULL if all of the strings are + * 0-terminated. If non-NULL, the stringLengths array must have + * stringCount entries. + * @param stringCount + * the number of entries in strings[], and the number of entries + * in the stringLengths array if it is not NULL. Must be >= 0. + * @param result + * A pointer to a buffer to receive the formatted list. + * @param resultCapacity + * The maximum size of result. + * @param status + * A pointer to a standard ICU UErrorCode (input/output parameter). + * Its input value must pass the U_SUCCESS() test, or else the + * function returns immediately. The caller should check its output + * value with U_FAILURE(), or use with function chaining (see User + * Guide for details). + * @return + * The total buffer size needed; if greater than resultLength, the + * output was truncated. May be <=0 if unable to determine the + * total buffer size needed (e.g. for illegal arguments). + * @stable ICU 55 + */ +U_CAPI int32_t U_EXPORT2 +ulistfmt_format(const UListFormatter* listfmt, + const UChar* const strings[], + const int32_t * stringLengths, + int32_t stringCount, + UChar* result, + int32_t resultCapacity, + UErrorCode* status); + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/uloc.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/uloc.h new file mode 100644 index 0000000..23a54a9 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/uloc.h @@ -0,0 +1,1272 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1997-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* +* File ULOC.H +* +* Modification History: +* +* Date Name Description +* 04/01/97 aliu Creation. +* 08/22/98 stephen JDK 1.2 sync. +* 12/08/98 rtg New C API for Locale +* 03/30/99 damiba overhaul +* 03/31/99 helena Javadoc for uloc functions. +* 04/15/99 Madhu Updated Javadoc +******************************************************************************** +*/ + +#ifndef ULOC_H +#define ULOC_H + +#include "unicode/utypes.h" +#include "unicode/uenum.h" + +/** + * \file + * \brief C API: Locale + * + *

ULoc C API for Locale

+ * A Locale represents a specific geographical, political, + * or cultural region. An operation that requires a Locale to perform + * its task is called locale-sensitive and uses the Locale + * to tailor information for the user. For example, displaying a number + * is a locale-sensitive operation--the number should be formatted + * according to the customs/conventions of the user's native country, + * region, or culture. In the C APIs, a locales is simply a const char string. + * + *

+ * You create a Locale with one of the three options listed below. + * Each of the component is separated by '_' in the locale string. + * \htmlonly

\endhtmlonly + *
+ * \code
+ *       newLanguage
+ * 
+ *       newLanguage + newCountry
+ * 
+ *       newLanguage + newCountry + newVariant
+ * \endcode
+ * 
+ * \htmlonly
\endhtmlonly + * The first option is a valid ISO + * Language Code. These codes are the lower-case two-letter + * codes as defined by ISO-639. + * You can find a full list of these codes at a number of sites, such as: + *
+ * http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt + * + *

+ * The second option includes an additional ISO Country + * Code. These codes are the upper-case two-letter codes + * as defined by ISO-3166. + * You can find a full list of these codes at a number of sites, such as: + *
+ * http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html + * + *

+ * The third option requires another additional information--the + * Variant. + * The Variant codes are vendor and browser-specific. + * For example, use WIN for Windows, MAC for Macintosh, and POSIX for POSIX. + * Where there are two variants, separate them with an underscore, and + * put the most important one first. For + * example, a Traditional Spanish collation might be referenced, with + * "ES", "ES", "Traditional_WIN". + * + *

+ * Because a Locale is just an identifier for a region, + * no validity check is performed when you specify a Locale. + * If you want to see whether particular resources are available for the + * Locale you asked for, you must query those resources. For + * example, ask the UNumberFormat for the locales it supports + * using its getAvailable method. + *
Note: When you ask for a resource for a particular + * locale, you get back the best available match, not necessarily + * precisely what you asked for. For more information, look at + * UResourceBundle. + * + *

+ * The Locale provides a number of convenient constants + * that you can use to specify the commonly used + * locales. For example, the following refers to a locale + * for the United States: + * \htmlonly

\endhtmlonly + *
+ * \code
+ *       ULOC_US
+ * \endcode
+ * 
+ * \htmlonly
\endhtmlonly + * + *

+ * Once you've specified a locale you can query it for information about + * itself. Use uloc_getCountry to get the ISO Country Code and + * uloc_getLanguage to get the ISO Language Code. You can + * use uloc_getDisplayCountry to get the + * name of the country suitable for displaying to the user. Similarly, + * you can use uloc_getDisplayLanguage to get the name of + * the language suitable for displaying to the user. Interestingly, + * the uloc_getDisplayXXX methods are themselves locale-sensitive + * and have two versions: one that uses the default locale and one + * that takes a locale as an argument and displays the name or country in + * a language appropriate to that locale. + * + *

+ * The ICU provides a number of services that perform locale-sensitive + * operations. For example, the unum_xxx functions format + * numbers, currency, or percentages in a locale-sensitive manner. + *

+ * \htmlonly
\endhtmlonly + *
+ * \code
+ *     UErrorCode success = U_ZERO_ERROR;
+ *     UNumberFormat *nf;
+ *     const char* myLocale = "fr_FR";
+ * 
+ *     nf = unum_open( UNUM_DEFAULT, NULL, success );          
+ *     unum_close(nf);
+ *     nf = unum_open( UNUM_CURRENCY, NULL, success );
+ *     unum_close(nf);
+ *     nf = unum_open( UNUM_PERCENT, NULL, success );   
+ *     unum_close(nf);
+ * \endcode
+ * 
+ * \htmlonly
\endhtmlonly + * Each of these methods has two variants; one with an explicit locale + * and one without; the latter using the default locale. + * \htmlonly
\endhtmlonly + *
+ * \code 
+ * 
+ *     nf = unum_open( UNUM_DEFAULT, myLocale, success );          
+ *     unum_close(nf);
+ *     nf = unum_open( UNUM_CURRENCY, myLocale, success );
+ *     unum_close(nf);
+ *     nf = unum_open( UNUM_PERCENT, myLocale, success );   
+ *     unum_close(nf);
+ * \endcode
+ * 
+ * \htmlonly
\endhtmlonly + * A Locale is the mechanism for identifying the kind of services + * (UNumberFormat) that you would like to get. The locale is + * just a mechanism for identifying these services. + * + *

+ * Each international service that performs locale-sensitive operations + * allows you + * to get all the available objects of that type. You can sift + * through these objects by language, country, or variant, + * and use the display names to present a menu to the user. + * For example, you can create a menu of all the collation objects + * suitable for a given language. Such classes implement these + * three class methods: + * \htmlonly

\endhtmlonly + *
+ * \code
+ *       const char* uloc_getAvailable(int32_t index);
+ *       int32_t uloc_countAvailable();
+ *       int32_t
+ *       uloc_getDisplayName(const char* localeID,
+ *                 const char* inLocaleID, 
+ *                 UChar* result,
+ *                 int32_t maxResultSize,
+ *                  UErrorCode* err);
+ * 
+ * \endcode
+ * 
+ * \htmlonly
\endhtmlonly + *

+ * Concerning POSIX/RFC1766 Locale IDs, + * the getLanguage/getCountry/getVariant/getName functions do understand + * the POSIX type form of language_COUNTRY.ENCODING\@VARIANT + * and if there is not an ICU-stype variant, uloc_getVariant() for example + * will return the one listed after the \@at sign. As well, the hyphen + * "-" is recognized as a country/variant separator similarly to RFC1766. + * So for example, "en-us" will be interpreted as en_US. + * As a result, uloc_getName() is far from a no-op, and will have the + * effect of converting POSIX/RFC1766 IDs into ICU form, although it does + * NOT map any of the actual codes (i.e. russian->ru) in any way. + * Applications should call uloc_getName() at the point where a locale ID + * is coming from an external source (user entry, OS, web browser) + * and pass the resulting string to other ICU functions. For example, + * don't use de-de\@EURO as an argument to resourcebundle. + * + * @see UResourceBundle + */ + +/** Useful constant for this language. @stable ICU 2.0 */ +#define ULOC_CHINESE "zh" +/** Useful constant for this language. @stable ICU 2.0 */ +#define ULOC_ENGLISH "en" +/** Useful constant for this language. @stable ICU 2.0 */ +#define ULOC_FRENCH "fr" +/** Useful constant for this language. @stable ICU 2.0 */ +#define ULOC_GERMAN "de" +/** Useful constant for this language. @stable ICU 2.0 */ +#define ULOC_ITALIAN "it" +/** Useful constant for this language. @stable ICU 2.0 */ +#define ULOC_JAPANESE "ja" +/** Useful constant for this language. @stable ICU 2.0 */ +#define ULOC_KOREAN "ko" +/** Useful constant for this language. @stable ICU 2.0 */ +#define ULOC_SIMPLIFIED_CHINESE "zh_CN" +/** Useful constant for this language. @stable ICU 2.0 */ +#define ULOC_TRADITIONAL_CHINESE "zh_TW" + +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_CANADA "en_CA" +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_CANADA_FRENCH "fr_CA" +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_CHINA "zh_CN" +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_PRC "zh_CN" +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_FRANCE "fr_FR" +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_GERMANY "de_DE" +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_ITALY "it_IT" +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_JAPAN "ja_JP" +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_KOREA "ko_KR" +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_TAIWAN "zh_TW" +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_UK "en_GB" +/** Useful constant for this country/region. @stable ICU 2.0 */ +#define ULOC_US "en_US" + +/** + * Useful constant for the maximum size of the language part of a locale ID. + * (including the terminating NULL). + * @stable ICU 2.0 + */ +#define ULOC_LANG_CAPACITY 12 + +/** + * Useful constant for the maximum size of the country part of a locale ID + * (including the terminating NULL). + * @stable ICU 2.0 + */ +#define ULOC_COUNTRY_CAPACITY 4 +/** + * Useful constant for the maximum size of the whole locale ID + * (including the terminating NULL and all keywords). + * @stable ICU 2.0 + */ +#define ULOC_FULLNAME_CAPACITY 157 + +/** + * Useful constant for the maximum size of the script part of a locale ID + * (including the terminating NULL). + * @stable ICU 2.8 + */ +#define ULOC_SCRIPT_CAPACITY 6 + +/** + * Useful constant for the maximum size of keywords in a locale + * @stable ICU 2.8 + */ +#define ULOC_KEYWORDS_CAPACITY 96 + +/** + * Useful constant for the maximum total size of keywords and their values in a locale + * @stable ICU 2.8 + */ +#define ULOC_KEYWORD_AND_VALUES_CAPACITY 100 + +/** + * Invariant character separating keywords from the locale string + * @stable ICU 2.8 + */ +#define ULOC_KEYWORD_SEPARATOR '@' + +/** + * Unicode code point for '@' separating keywords from the locale string. + * @see ULOC_KEYWORD_SEPARATOR + * @stable ICU 4.6 + */ +#define ULOC_KEYWORD_SEPARATOR_UNICODE 0x40 + +/** + * Invariant character for assigning value to a keyword + * @stable ICU 2.8 + */ +#define ULOC_KEYWORD_ASSIGN '=' + +/** + * Unicode code point for '=' for assigning value to a keyword. + * @see ULOC_KEYWORD_ASSIGN + * @stable ICU 4.6 + */ +#define ULOC_KEYWORD_ASSIGN_UNICODE 0x3D + +/** + * Invariant character separating keywords + * @stable ICU 2.8 + */ +#define ULOC_KEYWORD_ITEM_SEPARATOR ';' + +/** + * Unicode code point for ';' separating keywords + * @see ULOC_KEYWORD_ITEM_SEPARATOR + * @stable ICU 4.6 + */ +#define ULOC_KEYWORD_ITEM_SEPARATOR_UNICODE 0x3B + +/** + * Constants for *_getLocale() + * Allow user to select whether she wants information on + * requested, valid or actual locale. + * For example, a collator for "en_US_CALIFORNIA" was + * requested. In the current state of ICU (2.0), + * the requested locale is "en_US_CALIFORNIA", + * the valid locale is "en_US" (most specific locale supported by ICU) + * and the actual locale is "root" (the collation data comes unmodified + * from the UCA) + * The locale is considered supported by ICU if there is a core ICU bundle + * for that locale (although it may be empty). + * @stable ICU 2.1 + */ +typedef enum { + /** This is locale the data actually comes from + * @stable ICU 2.1 + */ + ULOC_ACTUAL_LOCALE = 0, + /** This is the most specific locale supported by ICU + * @stable ICU 2.1 + */ + ULOC_VALID_LOCALE = 1, + +#ifndef U_HIDE_DEPRECATED_API + /** This is the requested locale + * @deprecated ICU 2.8 + */ + ULOC_REQUESTED_LOCALE = 2, + + /** + * One more than the highest normal ULocDataLocaleType value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + ULOC_DATA_LOCALE_TYPE_LIMIT = 3 +#endif // U_HIDE_DEPRECATED_API +} ULocDataLocaleType; + +#ifndef U_HIDE_SYSTEM_API +/** + * Gets ICU's default locale. + * The returned string is a snapshot in time, and will remain valid + * and unchanged even when uloc_setDefault() is called. + * The returned storage is owned by ICU, and must not be altered or deleted + * by the caller. + * + * @return the ICU default locale + * @system + * @stable ICU 2.0 + */ +U_STABLE const char* U_EXPORT2 +uloc_getDefault(void); + +/** + * Sets ICU's default locale. + * By default (without calling this function), ICU's default locale will be based + * on information obtained from the underlying system environment. + *

+ * Changes to ICU's default locale do not propagate back to the + * system environment. + *

+ * Changes to ICU's default locale to not affect any ICU services that + * may already be open based on the previous default locale value. + * + * @param localeID the new ICU default locale. A value of NULL will try to get + * the system's default locale. + * @param status the error information if the setting of default locale fails + * @system + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +uloc_setDefault(const char* localeID, + UErrorCode* status); +#endif /* U_HIDE_SYSTEM_API */ + +/** + * Gets the language code for the specified locale. + * + * @param localeID the locale to get the ISO language code with + * @param language the language code for localeID + * @param languageCapacity the size of the language buffer to store the + * language code with + * @param err error information if retrieving the language code failed + * @return the actual buffer size needed for the language code. If it's greater + * than languageCapacity, the returned language code will be truncated. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +uloc_getLanguage(const char* localeID, + char* language, + int32_t languageCapacity, + UErrorCode* err); + +/** + * Gets the script code for the specified locale. + * + * @param localeID the locale to get the ISO language code with + * @param script the language code for localeID + * @param scriptCapacity the size of the language buffer to store the + * language code with + * @param err error information if retrieving the language code failed + * @return the actual buffer size needed for the language code. If it's greater + * than scriptCapacity, the returned language code will be truncated. + * @stable ICU 2.8 + */ +U_STABLE int32_t U_EXPORT2 +uloc_getScript(const char* localeID, + char* script, + int32_t scriptCapacity, + UErrorCode* err); + +/** + * Gets the country code for the specified locale. + * + * @param localeID the locale to get the country code with + * @param country the country code for localeID + * @param countryCapacity the size of the country buffer to store the + * country code with + * @param err error information if retrieving the country code failed + * @return the actual buffer size needed for the country code. If it's greater + * than countryCapacity, the returned country code will be truncated. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +uloc_getCountry(const char* localeID, + char* country, + int32_t countryCapacity, + UErrorCode* err); + +/** + * Gets the variant code for the specified locale. + * + * @param localeID the locale to get the variant code with + * @param variant the variant code for localeID + * @param variantCapacity the size of the variant buffer to store the + * variant code with + * @param err error information if retrieving the variant code failed + * @return the actual buffer size needed for the variant code. If it's greater + * than variantCapacity, the returned variant code will be truncated. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +uloc_getVariant(const char* localeID, + char* variant, + int32_t variantCapacity, + UErrorCode* err); + + +/** + * Gets the full name for the specified locale. + * Note: This has the effect of 'canonicalizing' the ICU locale ID to + * a certain extent. Upper and lower case are set as needed. + * It does NOT map aliased names in any way. + * See the top of this header file. + * This API supports preflighting. + * + * @param localeID the locale to get the full name with + * @param name fill in buffer for the name without keywords. + * @param nameCapacity capacity of the fill in buffer. + * @param err error information if retrieving the full name failed + * @return the actual buffer size needed for the full name. If it's greater + * than nameCapacity, the returned full name will be truncated. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +uloc_getName(const char* localeID, + char* name, + int32_t nameCapacity, + UErrorCode* err); + +/** + * Gets the full name for the specified locale. + * Note: This has the effect of 'canonicalizing' the string to + * a certain extent. Upper and lower case are set as needed, + * and if the components were in 'POSIX' format they are changed to + * ICU format. It does NOT map aliased names in any way. + * See the top of this header file. + * + * @param localeID the locale to get the full name with + * @param name the full name for localeID + * @param nameCapacity the size of the name buffer to store the + * full name with + * @param err error information if retrieving the full name failed + * @return the actual buffer size needed for the full name. If it's greater + * than nameCapacity, the returned full name will be truncated. + * @stable ICU 2.8 + */ +U_STABLE int32_t U_EXPORT2 +uloc_canonicalize(const char* localeID, + char* name, + int32_t nameCapacity, + UErrorCode* err); + +/** + * Gets the ISO language code for the specified locale. + * + * @param localeID the locale to get the ISO language code with + * @return language the ISO language code for localeID + * @stable ICU 2.0 + */ +U_STABLE const char* U_EXPORT2 +uloc_getISO3Language(const char* localeID); + + +/** + * Gets the ISO country code for the specified locale. + * + * @param localeID the locale to get the ISO country code with + * @return country the ISO country code for localeID + * @stable ICU 2.0 + */ +U_STABLE const char* U_EXPORT2 +uloc_getISO3Country(const char* localeID); + +/** + * Gets the Win32 LCID value for the specified locale. + * If the ICU locale is not recognized by Windows, 0 will be returned. + * + * LCIDs were deprecated with Windows Vista and Microsoft recommends + * that developers use BCP47 style tags instead (uloc_toLanguageTag). + * + * @param localeID the locale to get the Win32 LCID value with + * @return country the Win32 LCID for localeID + * @stable ICU 2.0 + */ +U_STABLE uint32_t U_EXPORT2 +uloc_getLCID(const char* localeID); + +/** + * Gets the language name suitable for display for the specified locale. + * + * @param locale the locale to get the ISO language code with + * @param displayLocale Specifies the locale to be used to display the name. In other words, + * if the locale's language code is "en", passing Locale::getFrench() for + * inLocale would result in "Anglais", while passing Locale::getGerman() + * for inLocale would result in "Englisch". + * @param language the displayable language code for localeID + * @param languageCapacity the size of the language buffer to store the + * displayable language code with + * @param status error information if retrieving the displayable language code failed + * @return the actual buffer size needed for the displayable language code. If it's greater + * than languageCapacity, the returned language code will be truncated. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +uloc_getDisplayLanguage(const char* locale, + const char* displayLocale, + UChar* language, + int32_t languageCapacity, + UErrorCode* status); + +/** + * Gets the script name suitable for display for the specified locale. + * + * @param locale the locale to get the displayable script code with. NULL may be used to specify the default. + * @param displayLocale Specifies the locale to be used to display the name. In other words, + * if the locale's language code is "en", passing Locale::getFrench() for + * inLocale would result in "", while passing Locale::getGerman() + * for inLocale would result in "". NULL may be used to specify the default. + * @param script the displayable script for the localeID + * @param scriptCapacity the size of the script buffer to store the + * displayable script code with + * @param status error information if retrieving the displayable script code failed + * @return the actual buffer size needed for the displayable script code. If it's greater + * than scriptCapacity, the returned displayable script code will be truncated. + * @stable ICU 2.8 + */ +U_STABLE int32_t U_EXPORT2 +uloc_getDisplayScript(const char* locale, + const char* displayLocale, + UChar* script, + int32_t scriptCapacity, + UErrorCode* status); + +/** + * Gets the country name suitable for display for the specified locale. + * Warning: this is for the region part of a valid locale ID; it cannot just be the region code (like "FR"). + * To get the display name for a region alone, or for other options, use ULocaleDisplayNames instead. + * + * @param locale the locale to get the displayable country code with. NULL may be used to specify the default. + * @param displayLocale Specifies the locale to be used to display the name. In other words, + * if the locale's language code is "en", passing Locale::getFrench() for + * inLocale would result in "Anglais", while passing Locale::getGerman() + * for inLocale would result in "Englisch". NULL may be used to specify the default. + * @param country the displayable country code for localeID + * @param countryCapacity the size of the country buffer to store the + * displayable country code with + * @param status error information if retrieving the displayable country code failed + * @return the actual buffer size needed for the displayable country code. If it's greater + * than countryCapacity, the returned displayable country code will be truncated. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +uloc_getDisplayCountry(const char* locale, + const char* displayLocale, + UChar* country, + int32_t countryCapacity, + UErrorCode* status); + + +/** + * Gets the variant name suitable for display for the specified locale. + * + * @param locale the locale to get the displayable variant code with. NULL may be used to specify the default. + * @param displayLocale Specifies the locale to be used to display the name. In other words, + * if the locale's language code is "en", passing Locale::getFrench() for + * inLocale would result in "Anglais", while passing Locale::getGerman() + * for inLocale would result in "Englisch". NULL may be used to specify the default. + * @param variant the displayable variant code for localeID + * @param variantCapacity the size of the variant buffer to store the + * displayable variant code with + * @param status error information if retrieving the displayable variant code failed + * @return the actual buffer size needed for the displayable variant code. If it's greater + * than variantCapacity, the returned displayable variant code will be truncated. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +uloc_getDisplayVariant(const char* locale, + const char* displayLocale, + UChar* variant, + int32_t variantCapacity, + UErrorCode* status); + +/** + * Gets the keyword name suitable for display for the specified locale. + * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display + * string for the keyword collation. + * Usage: + * + * UErrorCode status = U_ZERO_ERROR; + * const char* keyword =NULL; + * int32_t keywordLen = 0; + * int32_t keywordCount = 0; + * UChar displayKeyword[256]; + * int32_t displayKeywordLen = 0; + * UEnumeration* keywordEnum = uloc_openKeywords("de_DE@collation=PHONEBOOK;calendar=TRADITIONAL", &status); + * for(keywordCount = uenum_count(keywordEnum, &status); keywordCount > 0 ; keywordCount--){ + * if(U_FAILURE(status)){ + * ...something went wrong so handle the error... + * break; + * } + * // the uenum_next returns NUL terminated string + * keyword = uenum_next(keywordEnum, &keywordLen, &status); + * displayKeywordLen = uloc_getDisplayKeyword(keyword, "en_US", displayKeyword, 256); + * ... do something interesting ..... + * } + * uenum_close(keywordEnum); + * + * @param keyword The keyword whose display string needs to be returned. + * @param displayLocale Specifies the locale to be used to display the name. In other words, + * if the locale's language code is "en", passing Locale::getFrench() for + * inLocale would result in "Anglais", while passing Locale::getGerman() + * for inLocale would result in "Englisch". NULL may be used to specify the default. + * @param dest the buffer to which the displayable keyword should be written. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param status error information if retrieving the displayable string failed. + * Should not be NULL and should not indicate failure on entry. + * @return the actual buffer size needed for the displayable variant code. + * @see #uloc_openKeywords + * @stable ICU 2.8 + */ +U_STABLE int32_t U_EXPORT2 +uloc_getDisplayKeyword(const char* keyword, + const char* displayLocale, + UChar* dest, + int32_t destCapacity, + UErrorCode* status); +/** + * Gets the value of the keyword suitable for display for the specified locale. + * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display + * string for PHONEBOOK, in the display locale, when "collation" is specified as the keyword. + * + * @param locale The locale to get the displayable variant code with. NULL may be used to specify the default. + * @param keyword The keyword for whose value should be used. + * @param displayLocale Specifies the locale to be used to display the name. In other words, + * if the locale's language code is "en", passing Locale::getFrench() for + * inLocale would result in "Anglais", while passing Locale::getGerman() + * for inLocale would result in "Englisch". NULL may be used to specify the default. + * @param dest the buffer to which the displayable keyword should be written. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param status error information if retrieving the displayable string failed. + * Should not be NULL and must not indicate failure on entry. + * @return the actual buffer size needed for the displayable variant code. + * @stable ICU 2.8 + */ +U_STABLE int32_t U_EXPORT2 +uloc_getDisplayKeywordValue( const char* locale, + const char* keyword, + const char* displayLocale, + UChar* dest, + int32_t destCapacity, + UErrorCode* status); +/** + * Gets the full name suitable for display for the specified locale. + * + * @param localeID the locale to get the displayable name with. NULL may be used to specify the default. + * @param inLocaleID Specifies the locale to be used to display the name. In other words, + * if the locale's language code is "en", passing Locale::getFrench() for + * inLocale would result in "Anglais", while passing Locale::getGerman() + * for inLocale would result in "Englisch". NULL may be used to specify the default. + * @param result the displayable name for localeID + * @param maxResultSize the size of the name buffer to store the + * displayable full name with + * @param err error information if retrieving the displayable name failed + * @return the actual buffer size needed for the displayable name. If it's greater + * than maxResultSize, the returned displayable name will be truncated. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +uloc_getDisplayName(const char* localeID, + const char* inLocaleID, + UChar* result, + int32_t maxResultSize, + UErrorCode* err); + + +/** + * Gets the specified locale from a list of all available locales. + * The return value is a pointer to an item of + * a locale name array. Both this array and the pointers + * it contains are owned by ICU and should not be deleted or written through + * by the caller. The locale name is terminated by a null pointer. + * @param n the specific locale name index of the available locale list + * @return a specified locale name of all available locales + * @stable ICU 2.0 + */ +U_STABLE const char* U_EXPORT2 +uloc_getAvailable(int32_t n); + +/** + * Gets the size of the all available locale list. + * + * @return the size of the locale list + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 uloc_countAvailable(void); + +/** + * + * Gets a list of all available 2-letter language codes defined in ISO 639, + * plus additional 3-letter codes determined to be useful for locale generation as + * defined by Unicode CLDR. This is a pointer + * to an array of pointers to arrays of char. All of these pointers are owned + * by ICU-- do not delete them, and do not write through them. The array is + * terminated with a null pointer. + * @return a list of all available language codes + * @stable ICU 2.0 + */ +U_STABLE const char* const* U_EXPORT2 +uloc_getISOLanguages(void); + +/** + * + * Gets a list of all available 2-letter country codes defined in ISO 639. This is a + * pointer to an array of pointers to arrays of char. All of these pointers are + * owned by ICU-- do not delete them, and do not write through them. The array is + * terminated with a null pointer. + * @return a list of all available country codes + * @stable ICU 2.0 + */ +U_STABLE const char* const* U_EXPORT2 +uloc_getISOCountries(void); + +/** + * Truncate the locale ID string to get the parent locale ID. + * Copies the part of the string before the last underscore. + * The parent locale ID will be an empty string if there is no + * underscore, or if there is only one underscore at localeID[0]. + * + * @param localeID Input locale ID string. + * @param parent Output string buffer for the parent locale ID. + * @param parentCapacity Size of the output buffer. + * @param err A UErrorCode value. + * @return The length of the parent locale ID. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +uloc_getParent(const char* localeID, + char* parent, + int32_t parentCapacity, + UErrorCode* err); + + + + +/** + * Gets the full name for the specified locale, like uloc_getName(), + * but without keywords. + * + * Note: This has the effect of 'canonicalizing' the string to + * a certain extent. Upper and lower case are set as needed, + * and if the components were in 'POSIX' format they are changed to + * ICU format. It does NOT map aliased names in any way. + * See the top of this header file. + * + * This API strips off the keyword part, so "de_DE\@collation=phonebook" + * will become "de_DE". + * This API supports preflighting. + * + * @param localeID the locale to get the full name with + * @param name fill in buffer for the name without keywords. + * @param nameCapacity capacity of the fill in buffer. + * @param err error information if retrieving the full name failed + * @return the actual buffer size needed for the full name. If it's greater + * than nameCapacity, the returned full name will be truncated. + * @stable ICU 2.8 + */ +U_STABLE int32_t U_EXPORT2 +uloc_getBaseName(const char* localeID, + char* name, + int32_t nameCapacity, + UErrorCode* err); + +/** + * Gets an enumeration of keywords for the specified locale. Enumeration + * must get disposed of by the client using uenum_close function. + * + * @param localeID the locale to get the variant code with + * @param status error information if retrieving the keywords failed + * @return enumeration of keywords or NULL if there are no keywords. + * @stable ICU 2.8 + */ +U_STABLE UEnumeration* U_EXPORT2 +uloc_openKeywords(const char* localeID, + UErrorCode* status); + +/** + * Get the value for a keyword. Locale name does not need to be normalized. + * + * @param localeID locale name containing the keyword ("de_DE@currency=EURO;collation=PHONEBOOK") + * @param keywordName name of the keyword for which we want the value; must not be + * NULL or empty, and must consist only of [A-Za-z0-9]. Case insensitive. + * @param buffer receiving buffer + * @param bufferCapacity capacity of receiving buffer + * @param status containing error code: e.g. buffer not big enough or ill-formed localeID + * or keywordName parameters. + * @return the length of keyword value + * @stable ICU 2.8 + */ +U_STABLE int32_t U_EXPORT2 +uloc_getKeywordValue(const char* localeID, + const char* keywordName, + char* buffer, int32_t bufferCapacity, + UErrorCode* status); + + +/** + * Sets or removes the value of the specified keyword. + * + * For removing all keywords, use uloc_getBaseName(). + * + * NOTE: Unlike almost every other ICU function which takes a + * buffer, this function will NOT truncate the output text, and will + * not update the buffer with unterminated text setting a status of + * U_STRING_NOT_TERMINATED_WARNING. If a BUFFER_OVERFLOW_ERROR is received, + * it means a terminated version of the updated locale ID would not fit + * in the buffer, and the original buffer is untouched. This is done to + * prevent incorrect or possibly even malformed locales from being generated + * and used. + * + * @param keywordName name of the keyword to be set; must not be + * NULL or empty, and must consist only of [A-Za-z0-9]. Case insensitive. + * @param keywordValue value of the keyword to be set. If 0-length or + * NULL, will result in the keyword being removed; no error is given if + * that keyword does not exist. Otherwise, must consist only of + * [A-Za-z0-9] and [/_+-]. + * @param buffer input buffer containing well-formed locale ID to be + * modified. + * @param bufferCapacity capacity of receiving buffer + * @param status containing error code: e.g. buffer not big enough + * or ill-formed keywordName or keywordValue parameters, or ill-formed + * locale ID in buffer on input. + * @return the length needed for the buffer + * @see uloc_getKeywordValue + * @stable ICU 3.2 + */ +U_STABLE int32_t U_EXPORT2 +uloc_setKeywordValue(const char* keywordName, + const char* keywordValue, + char* buffer, int32_t bufferCapacity, + UErrorCode* status); + +/** + * Returns whether the locale's script is written right-to-left. + * If there is no script subtag, then the likely script is used, see uloc_addLikelySubtags(). + * If no likely script is known, then FALSE is returned. + * + * A script is right-to-left according to the CLDR script metadata + * which corresponds to whether the script's letters have Bidi_Class=R or AL. + * + * Returns TRUE for "ar" and "en-Hebr", FALSE for "zh" and "fa-Cyrl". + * + * @param locale input locale ID + * @return TRUE if the locale's script is written right-to-left + * @stable ICU 54 + */ +U_STABLE UBool U_EXPORT2 +uloc_isRightToLeft(const char *locale); + +/** + * enums for the return value for the character and line orientation + * functions. + * @stable ICU 4.0 + */ +typedef enum { + ULOC_LAYOUT_LTR = 0, /* left-to-right. */ + ULOC_LAYOUT_RTL = 1, /* right-to-left. */ + ULOC_LAYOUT_TTB = 2, /* top-to-bottom. */ + ULOC_LAYOUT_BTT = 3, /* bottom-to-top. */ + ULOC_LAYOUT_UNKNOWN +} ULayoutType; + +/** + * Get the layout character orientation for the specified locale. + * + * @param localeId locale name + * @param status Error status + * @return an enum indicating the layout orientation for characters. + * @stable ICU 4.0 + */ +U_STABLE ULayoutType U_EXPORT2 +uloc_getCharacterOrientation(const char* localeId, + UErrorCode *status); + +/** + * Get the layout line orientation for the specified locale. + * + * @param localeId locale name + * @param status Error status + * @return an enum indicating the layout orientation for lines. + * @stable ICU 4.0 + */ +U_STABLE ULayoutType U_EXPORT2 +uloc_getLineOrientation(const char* localeId, + UErrorCode *status); + +/** + * enums for the 'outResult' parameter return value + * @see uloc_acceptLanguageFromHTTP + * @see uloc_acceptLanguage + * @stable ICU 3.2 + */ +typedef enum { + ULOC_ACCEPT_FAILED = 0, /* No exact match was found. */ + ULOC_ACCEPT_VALID = 1, /* An exact match was found. */ + ULOC_ACCEPT_FALLBACK = 2 /* A fallback was found, for example, + Accept list contained 'ja_JP' + which matched available locale 'ja'. */ +} UAcceptResult; + + +/** + * Based on a HTTP header from a web browser and a list of available locales, + * determine an acceptable locale for the user. + * @param result - buffer to accept the result locale + * @param resultAvailable the size of the result buffer. + * @param outResult - An out parameter that contains the fallback status + * @param httpAcceptLanguage - "Accept-Language:" header as per HTTP. + * @param availableLocales - list of available locales to match + * @param status Error status, may be BUFFER_OVERFLOW_ERROR + * @return length needed for the locale. + * @stable ICU 3.2 + */ +U_STABLE int32_t U_EXPORT2 +uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable, + UAcceptResult *outResult, + const char *httpAcceptLanguage, + UEnumeration* availableLocales, + UErrorCode *status); + +/** + * Based on a list of available locales, + * determine an acceptable locale for the user. + * @param result - buffer to accept the result locale + * @param resultAvailable the size of the result buffer. + * @param outResult - An out parameter that contains the fallback status + * @param acceptList - list of acceptable languages + * @param acceptListCount - count of acceptList items + * @param availableLocales - list of available locales to match + * @param status Error status, may be BUFFER_OVERFLOW_ERROR + * @return length needed for the locale. + * @stable ICU 3.2 + */ +U_STABLE int32_t U_EXPORT2 +uloc_acceptLanguage(char *result, int32_t resultAvailable, + UAcceptResult *outResult, const char **acceptList, + int32_t acceptListCount, + UEnumeration* availableLocales, + UErrorCode *status); + + +/** + * Gets the ICU locale ID for the specified Win32 LCID value. + * + * @param hostID the Win32 LCID to translate + * @param locale the output buffer for the ICU locale ID, which will be NUL-terminated + * if there is room. + * @param localeCapacity the size of the output buffer + * @param status an error is returned if the LCID is unrecognized or the output buffer + * is too small + * @return actual the actual size of the locale ID, not including NUL-termination + * @stable ICU 3.8 + */ +U_STABLE int32_t U_EXPORT2 +uloc_getLocaleForLCID(uint32_t hostID, char *locale, int32_t localeCapacity, + UErrorCode *status); + + +/** + * Add the likely subtags for a provided locale ID, per the algorithm described + * in the following CLDR technical report: + * + * http://www.unicode.org/reports/tr35/#Likely_Subtags + * + * If localeID is already in the maximal form, or there is no data available + * for maximization, it will be copied to the output buffer. For example, + * "und-Zzzz" cannot be maximized, since there is no reasonable maximization. + * + * Examples: + * + * "en" maximizes to "en_Latn_US" + * + * "de" maximizes to "de_Latn_US" + * + * "sr" maximizes to "sr_Cyrl_RS" + * + * "sh" maximizes to "sr_Latn_RS" (Note this will not reverse.) + * + * "zh_Hani" maximizes to "zh_Hans_CN" (Note this will not reverse.) + * + * @param localeID The locale to maximize + * @param maximizedLocaleID The maximized locale + * @param maximizedLocaleIDCapacity The capacity of the maximizedLocaleID buffer + * @param err Error information if maximizing the locale failed. If the length + * of the localeID and the null-terminator is greater than the maximum allowed size, + * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR. + * @return The actual buffer size needed for the maximized locale. If it's + * greater than maximizedLocaleIDCapacity, the returned ID will be truncated. + * On error, the return value is -1. + * @stable ICU 4.0 + */ +U_STABLE int32_t U_EXPORT2 +uloc_addLikelySubtags(const char* localeID, + char* maximizedLocaleID, + int32_t maximizedLocaleIDCapacity, + UErrorCode* err); + + +/** + * Minimize the subtags for a provided locale ID, per the algorithm described + * in the following CLDR technical report: + * + * http://www.unicode.org/reports/tr35/#Likely_Subtags + * + * If localeID is already in the minimal form, or there is no data available + * for minimization, it will be copied to the output buffer. Since the + * minimization algorithm relies on proper maximization, see the comments + * for uloc_addLikelySubtags for reasons why there might not be any data. + * + * Examples: + * + * "en_Latn_US" minimizes to "en" + * + * "de_Latn_US" minimizes to "de" + * + * "sr_Cyrl_RS" minimizes to "sr" + * + * "zh_Hant_TW" minimizes to "zh_TW" (The region is preferred to the + * script, and minimizing to "zh" would imply "zh_Hans_CN".) + * + * @param localeID The locale to minimize + * @param minimizedLocaleID The minimized locale + * @param minimizedLocaleIDCapacity The capacity of the minimizedLocaleID buffer + * @param err Error information if minimizing the locale failed. If the length + * of the localeID and the null-terminator is greater than the maximum allowed size, + * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR. + * @return The actual buffer size needed for the minimized locale. If it's + * greater than minimizedLocaleIDCapacity, the returned ID will be truncated. + * On error, the return value is -1. + * @stable ICU 4.0 + */ +U_STABLE int32_t U_EXPORT2 +uloc_minimizeSubtags(const char* localeID, + char* minimizedLocaleID, + int32_t minimizedLocaleIDCapacity, + UErrorCode* err); + +/** + * Returns a locale ID for the specified BCP47 language tag string. + * If the specified language tag contains any ill-formed subtags, + * the first such subtag and all following subtags are ignored. + *

+ * This implements the 'Language-Tag' production of BCP47, and so + * supports grandfathered (regular and irregular) as well as private + * use language tags. Private use tags are represented as 'x-whatever', + * and grandfathered tags are converted to their canonical replacements + * where they exist. Note that a few grandfathered tags have no modern + * replacement, these will be converted using the fallback described in + * the first paragraph, so some information might be lost. + * @param langtag the input BCP47 language tag. + * @param localeID the output buffer receiving a locale ID for the + * specified BCP47 language tag. + * @param localeIDCapacity the size of the locale ID output buffer. + * @param parsedLength if not NULL, successfully parsed length + * for the input language tag is set. + * @param err error information if receiving the locald ID + * failed. + * @return the length of the locale ID. + * @stable ICU 4.2 + */ +U_STABLE int32_t U_EXPORT2 +uloc_forLanguageTag(const char* langtag, + char* localeID, + int32_t localeIDCapacity, + int32_t* parsedLength, + UErrorCode* err); + +/** + * Returns a well-formed language tag for this locale ID. + *

+ * Note: When strict is FALSE, any locale + * fields which do not satisfy the BCP47 syntax requirement will + * be omitted from the result. When strict is + * TRUE, this function sets U_ILLEGAL_ARGUMENT_ERROR to the + * err if any locale fields do not satisfy the + * BCP47 syntax requirement. + * @param localeID the input locale ID + * @param langtag the output buffer receiving BCP47 language + * tag for the locale ID. + * @param langtagCapacity the size of the BCP47 language tag + * output buffer. + * @param strict boolean value indicating if the function returns + * an error for an ill-formed input locale ID. + * @param err error information if receiving the language + * tag failed. + * @return The length of the BCP47 language tag. + * @stable ICU 4.2 + */ +U_STABLE int32_t U_EXPORT2 +uloc_toLanguageTag(const char* localeID, + char* langtag, + int32_t langtagCapacity, + UBool strict, + UErrorCode* err); + +/** + * Converts the specified keyword (legacy key, or BCP 47 Unicode locale + * extension key) to the equivalent BCP 47 Unicode locale extension key. + * For example, BCP 47 Unicode locale extension key "co" is returned for + * the input keyword "collation". + *

+ * When the specified keyword is unknown, but satisfies the BCP syntax, + * then the pointer to the input keyword itself will be returned. + * For example, + * uloc_toUnicodeLocaleKey("ZZ") returns "ZZ". + * + * @param keyword the input locale keyword (either legacy key + * such as "collation" or BCP 47 Unicode locale extension + * key such as "co"). + * @return the well-formed BCP 47 Unicode locale extension key, + * or NULL if the specified locale keyword cannot be + * mapped to a well-formed BCP 47 Unicode locale extension + * key. + * @see uloc_toLegacyKey + * @stable ICU 54 + */ +U_STABLE const char* U_EXPORT2 +uloc_toUnicodeLocaleKey(const char* keyword); + +/** + * Converts the specified keyword value (legacy type, or BCP 47 + * Unicode locale extension type) to the well-formed BCP 47 Unicode locale + * extension type for the specified keyword (category). For example, BCP 47 + * Unicode locale extension type "phonebk" is returned for the input + * keyword value "phonebook", with the keyword "collation" (or "co"). + *

+ * When the specified keyword is not recognized, but the specified value + * satisfies the syntax of the BCP 47 Unicode locale extension type, + * or when the specified keyword allows 'variable' type and the specified + * value satisfies the syntax, then the pointer to the input type value itself + * will be returned. + * For example, + * uloc_toUnicodeLocaleType("Foo", "Bar") returns "Bar", + * uloc_toUnicodeLocaleType("variableTop", "00A4") returns "00A4". + * + * @param keyword the locale keyword (either legacy key such as + * "collation" or BCP 47 Unicode locale extension + * key such as "co"). + * @param value the locale keyword value (either legacy type + * such as "phonebook" or BCP 47 Unicode locale extension + * type such as "phonebk"). + * @return the well-formed BCP47 Unicode locale extension type, + * or NULL if the locale keyword value cannot be mapped to + * a well-formed BCP 47 Unicode locale extension type. + * @see uloc_toLegacyType + * @stable ICU 54 + */ +U_STABLE const char* U_EXPORT2 +uloc_toUnicodeLocaleType(const char* keyword, const char* value); + +/** + * Converts the specified keyword (BCP 47 Unicode locale extension key, or + * legacy key) to the legacy key. For example, legacy key "collation" is + * returned for the input BCP 47 Unicode locale extension key "co". + * + * @param keyword the input locale keyword (either BCP 47 Unicode locale + * extension key or legacy key). + * @return the well-formed legacy key, or NULL if the specified + * keyword cannot be mapped to a well-formed legacy key. + * @see toUnicodeLocaleKey + * @stable ICU 54 + */ +U_STABLE const char* U_EXPORT2 +uloc_toLegacyKey(const char* keyword); + +/** + * Converts the specified keyword value (BCP 47 Unicode locale extension type, + * or legacy type or type alias) to the canonical legacy type. For example, + * the legacy type "phonebook" is returned for the input BCP 47 Unicode + * locale extension type "phonebk" with the keyword "collation" (or "co"). + *

+ * When the specified keyword is not recognized, but the specified value + * satisfies the syntax of legacy key, or when the specified keyword + * allows 'variable' type and the specified value satisfies the syntax, + * then the pointer to the input type value itself will be returned. + * For example, + * uloc_toLegacyType("Foo", "Bar") returns "Bar", + * uloc_toLegacyType("vt", "00A4") returns "00A4". + * + * @param keyword the locale keyword (either legacy keyword such as + * "collation" or BCP 47 Unicode locale extension + * key such as "co"). + * @param value the locale keyword value (either BCP 47 Unicode locale + * extension type such as "phonebk" or legacy keyword value + * such as "phonebook"). + * @return the well-formed legacy type, or NULL if the specified + * keyword value cannot be mapped to a well-formed legacy + * type. + * @see toUnicodeLocaleType + * @stable ICU 54 + */ +U_STABLE const char* U_EXPORT2 +uloc_toLegacyType(const char* keyword, const char* value); + +#endif /*_ULOC*/ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ulocdata.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ulocdata.h new file mode 100644 index 0000000..de8d853 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ulocdata.h @@ -0,0 +1,296 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* * +* Copyright (C) 2003-2015, International Business Machines * +* Corporation and others. All Rights Reserved. * +* * +****************************************************************************** +* file name: ulocdata.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2003Oct21 +* created by: Ram Viswanadha +*/ + +#ifndef __ULOCDATA_H__ +#define __ULOCDATA_H__ + +#include "unicode/ures.h" +#include "unicode/uloc.h" +#include "unicode/uset.h" +#include "unicode/localpointer.h" + +/** + * \file + * \brief C API: Provides access to locale data. + */ + +/** Forward declaration of the ULocaleData structure. @stable ICU 3.6 */ +struct ULocaleData; + +/** A locale data object. @stable ICU 3.6 */ +typedef struct ULocaleData ULocaleData; + + + +/** The possible types of exemplar character sets. + * @stable ICU 3.4 + */ +typedef enum ULocaleDataExemplarSetType { + /** Basic set @stable ICU 3.4 */ + ULOCDATA_ES_STANDARD=0, + /** Auxiliary set @stable ICU 3.4 */ + ULOCDATA_ES_AUXILIARY=1, + /** Index Character set @stable ICU 4.8 */ + ULOCDATA_ES_INDEX=2, + /** Punctuation set @stable ICU 51 */ + ULOCDATA_ES_PUNCTUATION=3, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal ULocaleDataExemplarSetType value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + ULOCDATA_ES_COUNT=4 +#endif /* U_HIDE_DEPRECATED_API */ +} ULocaleDataExemplarSetType; + +/** The possible types of delimiters. + * @stable ICU 3.4 + */ +typedef enum ULocaleDataDelimiterType { + /** Quotation start @stable ICU 3.4 */ + ULOCDATA_QUOTATION_START = 0, + /** Quotation end @stable ICU 3.4 */ + ULOCDATA_QUOTATION_END = 1, + /** Alternate quotation start @stable ICU 3.4 */ + ULOCDATA_ALT_QUOTATION_START = 2, + /** Alternate quotation end @stable ICU 3.4 */ + ULOCDATA_ALT_QUOTATION_END = 3, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal ULocaleDataDelimiterType value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + ULOCDATA_DELIMITER_COUNT = 4 +#endif /* U_HIDE_DEPRECATED_API */ +} ULocaleDataDelimiterType; + +/** + * Opens a locale data object for the given locale + * + * @param localeID Specifies the locale associated with this locale + * data object. + * @param status Pointer to error status code. + * @stable ICU 3.4 + */ +U_STABLE ULocaleData* U_EXPORT2 +ulocdata_open(const char *localeID, UErrorCode *status); + +/** + * Closes a locale data object. + * + * @param uld The locale data object to close + * @stable ICU 3.4 + */ +U_STABLE void U_EXPORT2 +ulocdata_close(ULocaleData *uld); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalULocaleDataPointer + * "Smart pointer" class, closes a ULocaleData via ulocdata_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalULocaleDataPointer, ULocaleData, ulocdata_close); + +U_NAMESPACE_END + +#endif + +/** + * Sets the "no Substitute" attribute of the locale data + * object. If true, then any methods associated with the + * locale data object will return null when there is no + * data available for that method, given the locale ID + * supplied to ulocdata_open(). + * + * @param uld The locale data object to set. + * @param setting Value of the "no substitute" attribute. + * @stable ICU 3.4 + */ +U_STABLE void U_EXPORT2 +ulocdata_setNoSubstitute(ULocaleData *uld, UBool setting); + +/** + * Retrieves the current "no Substitute" value of the locale data + * object. If true, then any methods associated with the + * locale data object will return null when there is no + * data available for that method, given the locale ID + * supplied to ulocdata_open(). + * + * @param uld Pointer to the The locale data object to set. + * @return UBool Value of the "no substitute" attribute. + * @stable ICU 3.4 + */ +U_STABLE UBool U_EXPORT2 +ulocdata_getNoSubstitute(ULocaleData *uld); + +/** + * Returns the set of exemplar characters for a locale. + * + * @param uld Pointer to the locale data object from which the + * exemplar character set is to be retrieved. + * @param fillIn Pointer to a USet object to receive the + * exemplar character set for the given locale. Previous + * contents of fillIn are lost. If fillIn is NULL, + * then a new USet is created and returned. The caller + * owns the result and must dispose of it by calling + * uset_close. + * @param options Bitmask for options to apply to the exemplar pattern. + * Specify zero to retrieve the exemplar set as it is + * defined in the locale data. Specify + * USET_CASE_INSENSITIVE to retrieve a case-folded + * exemplar set. See uset_applyPattern for a complete + * list of valid options. The USET_IGNORE_SPACE bit is + * always set, regardless of the value of 'options'. + * @param extype Specifies the type of exemplar set to be retrieved. + * @param status Pointer to an input-output error code value; + * must not be NULL. Will be set to U_MISSING_RESOURCE_ERROR + * if the requested data is not available. + * @return USet* Either fillIn, or if fillIn is NULL, a pointer to + * a newly-allocated USet that the user must close. + * In case of error, NULL is returned. + * @stable ICU 3.4 + */ +U_STABLE USet* U_EXPORT2 +ulocdata_getExemplarSet(ULocaleData *uld, USet *fillIn, + uint32_t options, ULocaleDataExemplarSetType extype, UErrorCode *status); + +/** + * Returns one of the delimiter strings associated with a locale. + * + * @param uld Pointer to the locale data object from which the + * delimiter string is to be retrieved. + * @param type the type of delimiter to be retrieved. + * @param result A pointer to a buffer to receive the result. + * @param resultLength The maximum size of result. + * @param status Pointer to an error code value + * @return int32_t The total buffer size needed; if greater than resultLength, + * the output was truncated. + * @stable ICU 3.4 + */ +U_STABLE int32_t U_EXPORT2 +ulocdata_getDelimiter(ULocaleData *uld, ULocaleDataDelimiterType type, UChar *result, int32_t resultLength, UErrorCode *status); + +/** + * Enumeration for representing the measurement systems. + * @stable ICU 2.8 + */ +typedef enum UMeasurementSystem { + UMS_SI, /**< Measurement system specified by SI otherwise known as Metric system. @stable ICU 2.8 */ + UMS_US, /**< Measurement system followed in the United States of America. @stable ICU 2.8 */ + UMS_UK, /**< Mix of metric and imperial units used in Great Britain. @stable ICU 55 */ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UMeasurementSystem value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UMS_LIMIT +#endif /* U_HIDE_DEPRECATED_API */ +} UMeasurementSystem; + +/** + * Returns the measurement system used in the locale specified by the localeID. + * Please note that this API will change in ICU 3.6 and will use an ulocdata object. + * + * @param localeID The id of the locale for which the measurement system to be retrieved. + * @param status Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return UMeasurementSystem the measurement system used in the locale. + * @stable ICU 2.8 + */ +U_STABLE UMeasurementSystem U_EXPORT2 +ulocdata_getMeasurementSystem(const char *localeID, UErrorCode *status); + +/** + * Returns the element gives the normal business letter size, and customary units. + * The units for the numbers are always in milli-meters. + * For US since 8.5 and 11 do not yeild an integral value when converted to milli-meters, + * the values are rounded off. + * So for A4 size paper the height and width are 297 mm and 210 mm repectively, + * and for US letter size the height and width are 279 mm and 216 mm respectively. + * Please note that this API will change in ICU 3.6 and will use an ulocdata object. + * + * @param localeID The id of the locale for which the paper size information to be retrieved. + * @param height A pointer to int to recieve the height information. + * @param width A pointer to int to recieve the width information. + * @param status Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @stable ICU 2.8 + */ +U_STABLE void U_EXPORT2 +ulocdata_getPaperSize(const char *localeID, int32_t *height, int32_t *width, UErrorCode *status); + +/** + * Return the current CLDR version used by the library. + * @param versionArray fillin that will recieve the version number + * @param status error code - could be U_MISSING_RESOURCE_ERROR if the version was not found. + * @stable ICU 4.2 + */ +U_STABLE void U_EXPORT2 +ulocdata_getCLDRVersion(UVersionInfo versionArray, UErrorCode *status); + +/** + * Returns locale display pattern associated with a locale. + * + * @param uld Pointer to the locale data object from which the + * exemplar character set is to be retrieved. + * @param pattern locale display pattern for locale. + * @param patternCapacity the size of the buffer to store the locale display + * pattern with. + * @param status Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return the actual buffer size needed for localeDisplayPattern. If it's greater + * than patternCapacity, the returned pattern will be truncated. + * + * @stable ICU 4.2 + */ +U_STABLE int32_t U_EXPORT2 +ulocdata_getLocaleDisplayPattern(ULocaleData *uld, + UChar *pattern, + int32_t patternCapacity, + UErrorCode *status); + + +/** + * Returns locale separator associated with a locale. + * + * @param uld Pointer to the locale data object from which the + * exemplar character set is to be retrieved. + * @param separator locale separator for locale. + * @param separatorCapacity the size of the buffer to store the locale + * separator with. + * @param status Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return the actual buffer size needed for localeSeparator. If it's greater + * than separatorCapacity, the returned separator will be truncated. + * + * @stable ICU 4.2 + */ +U_STABLE int32_t U_EXPORT2 +ulocdata_getLocaleSeparator(ULocaleData *uld, + UChar *separator, + int32_t separatorCapacity, + UErrorCode *status); +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/umachine.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/umachine.h new file mode 100644 index 0000000..3ba9161 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/umachine.h @@ -0,0 +1,420 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 1999-2015, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: umachine.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 1999sep13 +* created by: Markus W. Scherer +* +* This file defines basic types and constants for ICU to be +* platform-independent. umachine.h and utf.h are included into +* utypes.h to provide all the general definitions for ICU. +* All of these definitions used to be in utypes.h before +* the UTF-handling macros made this unmaintainable. +*/ + +#ifndef __UMACHINE_H__ +#define __UMACHINE_H__ + + +/** + * \file + * \brief Basic types and constants for UTF + * + *

Basic types and constants for UTF

+ * This file defines basic types and constants for utf.h to be + * platform-independent. umachine.h and utf.h are included into + * utypes.h to provide all the general definitions for ICU. + * All of these definitions used to be in utypes.h before + * the UTF-handling macros made this unmaintainable. + * + */ +/*==========================================================================*/ +/* Include platform-dependent definitions */ +/* which are contained in the platform-specific file platform.h */ +/*==========================================================================*/ + +#include "unicode/ptypes.h" /* platform.h is included in ptypes.h */ + +/* + * ANSI C headers: + * stddef.h defines wchar_t + */ +#include + +/*==========================================================================*/ +/* For C wrappers, we use the symbol U_STABLE. */ +/* This works properly if the includer is C or C++. */ +/* Functions are declared U_STABLE return-type U_EXPORT2 function-name()... */ +/*==========================================================================*/ + +/** + * \def U_CFUNC + * This is used in a declaration of a library private ICU C function. + * @stable ICU 2.4 + */ + +/** + * \def U_CDECL_BEGIN + * This is used to begin a declaration of a library private ICU C API. + * @stable ICU 2.4 + */ + +/** + * \def U_CDECL_END + * This is used to end a declaration of a library private ICU C API + * @stable ICU 2.4 + */ + +#ifdef __cplusplus +# define U_CFUNC extern "C" +# define U_CDECL_BEGIN extern "C" { +# define U_CDECL_END } +#else +# define U_CFUNC extern +# define U_CDECL_BEGIN +# define U_CDECL_END +#endif + +#ifndef U_ATTRIBUTE_DEPRECATED +/** + * \def U_ATTRIBUTE_DEPRECATED + * This is used for GCC specific attributes + * @internal + */ +#if U_GCC_MAJOR_MINOR >= 302 +# define U_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated)) +/** + * \def U_ATTRIBUTE_DEPRECATED + * This is used for Visual C++ specific attributes + * @internal + */ +#elif defined(_MSC_VER) && (_MSC_VER >= 1400) +# define U_ATTRIBUTE_DEPRECATED __declspec(deprecated) +#else +# define U_ATTRIBUTE_DEPRECATED +#endif +#endif + +/** This is used to declare a function as a public ICU C API @stable ICU 2.0*/ +#define U_CAPI U_CFUNC U_EXPORT +/** This is used to declare a function as a stable public ICU C API*/ +#define U_STABLE U_CAPI +/** This is used to declare a function as a draft public ICU C API */ +#define U_DRAFT U_CAPI +/** This is used to declare a function as a deprecated public ICU C API */ +#define U_DEPRECATED U_CAPI U_ATTRIBUTE_DEPRECATED +/** This is used to declare a function as an obsolete public ICU C API */ +#define U_OBSOLETE U_CAPI +/** This is used to declare a function as an internal ICU C API */ +#define U_INTERNAL U_CAPI + +/** + * \def U_OVERRIDE + * Defined to the C++11 "override" keyword if available. + * Denotes a class or member which is an override of the base class. + * May result in an error if it applied to something not an override. + * @internal + */ + +/** + * \def U_FINAL + * Defined to the C++11 "final" keyword if available. + * Denotes a class or member which may not be overridden in subclasses. + * May result in an error if subclasses attempt to override. + * @internal + */ + +#if U_CPLUSPLUS_VERSION >= 11 +/* C++11 */ +#ifndef U_OVERRIDE +#define U_OVERRIDE override +#endif +#ifndef U_FINAL +#define U_FINAL final +#endif +#else +/* not C++11 - define to nothing */ +#ifndef U_OVERRIDE +#define U_OVERRIDE +#endif +#ifndef U_FINAL +#define U_FINAL +#endif +#endif + +/*==========================================================================*/ +/* limits for int32_t etc., like in POSIX inttypes.h */ +/*==========================================================================*/ + +#ifndef INT8_MIN +/** The smallest value an 8 bit signed integer can hold @stable ICU 2.0 */ +# define INT8_MIN ((int8_t)(-128)) +#endif +#ifndef INT16_MIN +/** The smallest value a 16 bit signed integer can hold @stable ICU 2.0 */ +# define INT16_MIN ((int16_t)(-32767-1)) +#endif +#ifndef INT32_MIN +/** The smallest value a 32 bit signed integer can hold @stable ICU 2.0 */ +# define INT32_MIN ((int32_t)(-2147483647-1)) +#endif + +#ifndef INT8_MAX +/** The largest value an 8 bit signed integer can hold @stable ICU 2.0 */ +# define INT8_MAX ((int8_t)(127)) +#endif +#ifndef INT16_MAX +/** The largest value a 16 bit signed integer can hold @stable ICU 2.0 */ +# define INT16_MAX ((int16_t)(32767)) +#endif +#ifndef INT32_MAX +/** The largest value a 32 bit signed integer can hold @stable ICU 2.0 */ +# define INT32_MAX ((int32_t)(2147483647)) +#endif + +#ifndef UINT8_MAX +/** The largest value an 8 bit unsigned integer can hold @stable ICU 2.0 */ +# define UINT8_MAX ((uint8_t)(255U)) +#endif +#ifndef UINT16_MAX +/** The largest value a 16 bit unsigned integer can hold @stable ICU 2.0 */ +# define UINT16_MAX ((uint16_t)(65535U)) +#endif +#ifndef UINT32_MAX +/** The largest value a 32 bit unsigned integer can hold @stable ICU 2.0 */ +# define UINT32_MAX ((uint32_t)(4294967295U)) +#endif + +#if defined(U_INT64_T_UNAVAILABLE) +# error int64_t is required for decimal format and rule-based number format. +#else +# ifndef INT64_C +/** + * Provides a platform independent way to specify a signed 64-bit integer constant. + * note: may be wrong for some 64 bit platforms - ensure your compiler provides INT64_C + * @stable ICU 2.8 + */ +# define INT64_C(c) c ## LL +# endif +# ifndef UINT64_C +/** + * Provides a platform independent way to specify an unsigned 64-bit integer constant. + * note: may be wrong for some 64 bit platforms - ensure your compiler provides UINT64_C + * @stable ICU 2.8 + */ +# define UINT64_C(c) c ## ULL +# endif +# ifndef U_INT64_MIN +/** The smallest value a 64 bit signed integer can hold @stable ICU 2.8 */ +# define U_INT64_MIN ((int64_t)(INT64_C(-9223372036854775807)-1)) +# endif +# ifndef U_INT64_MAX +/** The largest value a 64 bit signed integer can hold @stable ICU 2.8 */ +# define U_INT64_MAX ((int64_t)(INT64_C(9223372036854775807))) +# endif +# ifndef U_UINT64_MAX +/** The largest value a 64 bit unsigned integer can hold @stable ICU 2.8 */ +# define U_UINT64_MAX ((uint64_t)(UINT64_C(18446744073709551615))) +# endif +#endif + +/*==========================================================================*/ +/* Boolean data type */ +/*==========================================================================*/ + +/** The ICU boolean type @stable ICU 2.0 */ +typedef int8_t UBool; + +#ifndef TRUE +/** The TRUE value of a UBool @stable ICU 2.0 */ +# define TRUE 1 +#endif +#ifndef FALSE +/** The FALSE value of a UBool @stable ICU 2.0 */ +# define FALSE 0 +#endif + + +/*==========================================================================*/ +/* Unicode data types */ +/*==========================================================================*/ + +/* wchar_t-related definitions -------------------------------------------- */ + +/* + * \def U_WCHAR_IS_UTF16 + * Defined if wchar_t uses UTF-16. + * + * @stable ICU 2.0 + */ +/* + * \def U_WCHAR_IS_UTF32 + * Defined if wchar_t uses UTF-32. + * + * @stable ICU 2.0 + */ +#if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32) +# ifdef __STDC_ISO_10646__ +# if (U_SIZEOF_WCHAR_T==2) +# define U_WCHAR_IS_UTF16 +# elif (U_SIZEOF_WCHAR_T==4) +# define U_WCHAR_IS_UTF32 +# endif +# elif defined __UCS2__ +# if (U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400) && (U_SIZEOF_WCHAR_T==2) +# define U_WCHAR_IS_UTF16 +# endif +# elif defined(__UCS4__) || (U_PLATFORM == U_PF_OS400 && defined(__UTF32__)) +# if (U_SIZEOF_WCHAR_T==4) +# define U_WCHAR_IS_UTF32 +# endif +# elif U_PLATFORM_IS_DARWIN_BASED || (U_SIZEOF_WCHAR_T==4 && U_PLATFORM_IS_LINUX_BASED) +# define U_WCHAR_IS_UTF32 +# elif U_PLATFORM_HAS_WIN32_API +# define U_WCHAR_IS_UTF16 +# endif +#endif + +/* UChar and UChar32 definitions -------------------------------------------- */ + +/** Number of bytes in a UChar. @stable ICU 2.0 */ +#define U_SIZEOF_UCHAR 2 + +/** + * \def U_CHAR16_IS_TYPEDEF + * If 1, then char16_t is a typedef and not a real type (yet) + * @internal + */ +#if (U_PLATFORM == U_PF_AIX) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11) +// for AIX, uchar.h needs to be included +# include +# define U_CHAR16_IS_TYPEDEF 1 +#else +# define U_CHAR16_IS_TYPEDEF 0 +#endif + + +/** + * \var UChar + * + * The base type for UTF-16 code units and pointers. + * Unsigned 16-bit integer. + * Starting with ICU 59, C++ API uses char16_t directly, while C API continues to use UChar. + * + * UChar is configurable by defining the macro UCHAR_TYPE + * on the preprocessor or compiler command line: + * -DUCHAR_TYPE=uint16_t or -DUCHAR_TYPE=wchar_t (if U_SIZEOF_WCHAR_T==2) etc. + * (The UCHAR_TYPE can also be #defined earlier in this file, for outside the ICU library code.) + * This is for transitional use from application code that uses uint16_t or wchar_t for UTF-16. + * + * The default is UChar=char16_t. + * + * C++11 defines char16_t as bit-compatible with uint16_t, but as a distinct type. + * + * In C, char16_t is a simple typedef of uint_least16_t. + * ICU requires uint_least16_t=uint16_t for data memory mapping. + * On macOS, char16_t is not available because the uchar.h standard header is missing. + * + * @stable ICU 4.4 + */ + +#if 1 + // #if 1 is normal. UChar defaults to char16_t in C++. + // For configuration testing of UChar=uint16_t temporarily change this to #if 0. + // The intltest Makefile #defines UCHAR_TYPE=char16_t, + // so we only #define it to uint16_t if it is undefined so far. +#elif !defined(UCHAR_TYPE) +# define UCHAR_TYPE uint16_t +#endif + +#if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || \ + defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) + // Inside the ICU library code, never configurable. + typedef char16_t UChar; +#elif defined(UCHAR_TYPE) + typedef UCHAR_TYPE UChar; +#elif defined(__cplusplus) + typedef char16_t UChar; +#else + typedef uint16_t UChar; +#endif + +/** + * \var OldUChar + * Default ICU 58 definition of UChar. + * A base type for UTF-16 code units and pointers. + * Unsigned 16-bit integer. + * + * Define OldUChar to be wchar_t if that is 16 bits wide. + * If wchar_t is not 16 bits wide, then define UChar to be uint16_t. + * + * This makes the definition of OldUChar platform-dependent + * but allows direct string type compatibility with platforms with + * 16-bit wchar_t types. + * + * This is how UChar was defined in ICU 58, for transition convenience. + * Exception: ICU 58 UChar was defined to UCHAR_TYPE if that macro was defined. + * The current UChar responds to UCHAR_TYPE but OldUChar does not. + * + * @draft ICU 59 + */ +#if U_SIZEOF_WCHAR_T==2 + typedef wchar_t OldUChar; +#elif defined(__CHAR16_TYPE__) + typedef __CHAR16_TYPE__ OldUChar; +#else + typedef uint16_t OldUChar; +#endif + +/** + * Define UChar32 as a type for single Unicode code points. + * UChar32 is a signed 32-bit integer (same as int32_t). + * + * The Unicode code point range is 0..0x10ffff. + * All other values (negative or >=0x110000) are illegal as Unicode code points. + * They may be used as sentinel values to indicate "done", "error" + * or similar non-code point conditions. + * + * Before ICU 2.4 (Jitterbug 2146), UChar32 was defined + * to be wchar_t if that is 32 bits wide (wchar_t may be signed or unsigned) + * or else to be uint32_t. + * That is, the definition of UChar32 was platform-dependent. + * + * @see U_SENTINEL + * @stable ICU 2.4 + */ +typedef int32_t UChar32; + +/** + * This value is intended for sentinel values for APIs that + * (take or) return single code points (UChar32). + * It is outside of the Unicode code point range 0..0x10ffff. + * + * For example, a "done" or "error" value in a new API + * could be indicated with U_SENTINEL. + * + * ICU APIs designed before ICU 2.4 usually define service-specific "done" + * values, mostly 0xffff. + * Those may need to be distinguished from + * actual U+ffff text contents by calling functions like + * CharacterIterator::hasNext() or UnicodeString::length(). + * + * @return -1 + * @see UChar32 + * @stable ICU 2.4 + */ +#define U_SENTINEL (-1) + +#include "unicode/urename.h" + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/umisc.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/umisc.h new file mode 100644 index 0000000..213290b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/umisc.h @@ -0,0 +1,62 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2006, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* file name: umisc.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 1999oct15 +* created by: Markus W. Scherer +*/ + +#ifndef UMISC_H +#define UMISC_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C API:misc definitions + * + * This file contains miscellaneous definitions for the C APIs. + */ + +U_CDECL_BEGIN + +/** A struct representing a range of text containing a specific field + * @stable ICU 2.0 + */ +typedef struct UFieldPosition { + /** + * The field + * @stable ICU 2.0 + */ + int32_t field; + /** + * The start of the text range containing field + * @stable ICU 2.0 + */ + int32_t beginIndex; + /** + * The limit of the text range containing field + * @stable ICU 2.0 + */ + int32_t endIndex; +} UFieldPosition; + +#if !UCONFIG_NO_SERVICE +/** + * Opaque type returned by registerInstance, registerFactory and unregister for service registration. + * @stable ICU 2.6 + */ +typedef const void* URegistryKey; +#endif + +U_CDECL_END + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/umsg.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/umsg.h new file mode 100644 index 0000000..5d235e4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/umsg.h @@ -0,0 +1,625 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/******************************************************************** + * COPYRIGHT: + * Copyright (c) 1997-2011, International Business Machines Corporation and + * others. All Rights Reserved. + * Copyright (C) 2010 , Yahoo! Inc. + ******************************************************************** + * + * file name: umsg.h + * encoding: UTF-8 + * tab size: 8 (not used) + * indentation:4 + * + * Change history: + * + * 08/5/2001 Ram Added C wrappers for C++ API. + ********************************************************************/ + +#ifndef UMSG_H +#define UMSG_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/localpointer.h" +#include "unicode/uloc.h" +#include "unicode/parseerr.h" +#include + +/** + * \file + * \brief C API: MessageFormat + * + *

MessageFormat C API

+ * + *

MessageFormat prepares strings for display to users, + * with optional arguments (variables/placeholders). + * The arguments can occur in any order, which is necessary for translation + * into languages with different grammars. + * + *

The opaque UMessageFormat type is a thin C wrapper around + * a C++ MessageFormat. It is constructed from a pattern string + * with arguments in {curly braces} which will be replaced by formatted values. + * + *

Currently, the C API supports only numbered arguments. + * + *

For details about the pattern syntax and behavior, + * especially about the ASCII apostrophe vs. the + * real apostrophe (single quote) character \htmlonly’\endhtmlonly (U+2019), + * see the C++ MessageFormat class documentation. + * + *

Here are some examples of C API usage: + * Example 1: + *

+ * \code
+ *     UChar *result, *tzID, *str;
+ *     UChar pattern[100];
+ *     int32_t resultLengthOut, resultlength;
+ *     UCalendar *cal;
+ *     UDate d1;
+ *     UDateFormat *def1;
+ *     UErrorCode status = U_ZERO_ERROR;
+ *
+ *     str=(UChar*)malloc(sizeof(UChar) * (strlen("disturbance in force") +1));
+ *     u_uastrcpy(str, "disturbance in force");
+ *     tzID=(UChar*)malloc(sizeof(UChar) * 4);
+ *     u_uastrcpy(tzID, "PST");
+ *     cal=ucal_open(tzID, u_strlen(tzID), "en_US", UCAL_TRADITIONAL, &status);
+ *     ucal_setDateTime(cal, 1999, UCAL_MARCH, 18, 0, 0, 0, &status);
+ *     d1=ucal_getMillis(cal, &status);
+ *     u_uastrcpy(pattern, "On {0, date, long}, there was a {1} on planet {2,number,integer}");
+ *     resultlength=0;
+ *     resultLengthOut=u_formatMessage( "en_US", pattern, u_strlen(pattern), NULL, resultlength, &status, d1, str, 7);
+ *     if(status==U_BUFFER_OVERFLOW_ERROR){
+ *         status=U_ZERO_ERROR;
+ *         resultlength=resultLengthOut+1;
+ *         result=(UChar*)realloc(result, sizeof(UChar) * resultlength);
+ *         u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, d1, str, 7);
+ *     }
+ *     printf("%s\n", austrdup(result) );//austrdup( a function used to convert UChar* to char*)
+ *     //output>: "On March 18, 1999, there was a disturbance in force on planet 7
+ * \endcode
+ * 
+ * Typically, the message format will come from resources, and the + * arguments will be dynamically set at runtime. + *

+ * Example 2: + *

+ * \code
+ *     UChar* str;
+ *     UErrorCode status = U_ZERO_ERROR;
+ *     UChar *result;
+ *     UChar pattern[100];
+ *     int32_t resultlength, resultLengthOut, i;
+ *     double testArgs= { 100.0, 1.0, 0.0};
+ *
+ *     str=(UChar*)malloc(sizeof(UChar) * 10);
+ *     u_uastrcpy(str, "MyDisk");
+ *     u_uastrcpy(pattern, "The disk {1} contains {0,choice,0#no files|1#one file|1<{0,number,integer} files}");
+ *     for(i=0; i<3; i++){
+ *       resultlength=0; 
+ *       resultLengthOut=u_formatMessage( "en_US", pattern, u_strlen(pattern), NULL, resultlength, &status, testArgs[i], str); 
+ *       if(status==U_BUFFER_OVERFLOW_ERROR){
+ *         status=U_ZERO_ERROR;
+ *         resultlength=resultLengthOut+1;
+ *         result=(UChar*)malloc(sizeof(UChar) * resultlength);
+ *         u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, testArgs[i], str);
+ *       }
+ *       printf("%s\n", austrdup(result) );  //austrdup( a function used to convert UChar* to char*)
+ *       free(result);
+ *     }
+ *     // output, with different testArgs:
+ *     // output: The disk "MyDisk" contains 100 files.
+ *     // output: The disk "MyDisk" contains one file.
+ *     // output: The disk "MyDisk" contains no files.
+ * \endcode
+ *  
+ * + * + * Example 3: + *
+ * \code
+ * UChar* str;
+ * UChar* str1;
+ * UErrorCode status = U_ZERO_ERROR;
+ * UChar *result;
+ * UChar pattern[100];
+ * UChar expected[100];
+ * int32_t resultlength,resultLengthOut;
+
+ * str=(UChar*)malloc(sizeof(UChar) * 25);
+ * u_uastrcpy(str, "Kirti");
+ * str1=(UChar*)malloc(sizeof(UChar) * 25);
+ * u_uastrcpy(str1, "female");
+ * log_verbose("Testing message format with Select test #1\n:");
+ * u_uastrcpy(pattern, "{0} est {1, select, female {all\\u00E9e} other {all\\u00E9}} \\u00E0 Paris.");
+ * u_uastrcpy(expected, "Kirti est all\\u00E9e \\u00E0 Paris.");
+ * resultlength=0;
+ * resultLengthOut=u_formatMessage( "fr", pattern, u_strlen(pattern), NULL, resultlength, &status, str , str1);
+ * if(status==U_BUFFER_OVERFLOW_ERROR)
+ *  {
+ *      status=U_ZERO_ERROR;
+ *      resultlength=resultLengthOut+1;
+ *      result=(UChar*)malloc(sizeof(UChar) * resultlength);
+ *      u_formatMessage( "fr", pattern, u_strlen(pattern), result, resultlength, &status, str , str1);
+ *      if(u_strcmp(result, expected)==0)
+ *          log_verbose("PASS: MessagFormat successful on Select test#1\n");
+ *      else{
+ *          log_err("FAIL: Error in MessageFormat on Select test#1\n GOT %s EXPECTED %s\n", austrdup(result),
+ *          austrdup(expected) );
+ *      }
+ *      free(result);
+ * }
+ * \endcode
+ *  
+ */ + +/** + * Format a message for a locale. + * This function may perform re-ordering of the arguments depending on the + * locale. For all numeric arguments, double is assumed unless the type is + * explicitly integer. All choice format arguments must be of type double. + * @param locale The locale for which the message will be formatted + * @param pattern The pattern specifying the message's format + * @param patternLength The length of pattern + * @param result A pointer to a buffer to receive the formatted message. + * @param resultLength The maximum size of result. + * @param status A pointer to an UErrorCode to receive any errors + * @param ... A variable-length argument list containing the arguments specified + * in pattern. + * @return The total buffer size needed; if greater than resultLength, the + * output was truncated. + * @see u_parseMessage + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_formatMessage(const char *locale, + const UChar *pattern, + int32_t patternLength, + UChar *result, + int32_t resultLength, + UErrorCode *status, + ...); + +/** + * Format a message for a locale. + * This function may perform re-ordering of the arguments depending on the + * locale. For all numeric arguments, double is assumed unless the type is + * explicitly integer. All choice format arguments must be of type double. + * @param locale The locale for which the message will be formatted + * @param pattern The pattern specifying the message's format + * @param patternLength The length of pattern + * @param result A pointer to a buffer to receive the formatted message. + * @param resultLength The maximum size of result. + * @param ap A variable-length argument list containing the arguments specified + * @param status A pointer to an UErrorCode to receive any errors + * in pattern. + * @return The total buffer size needed; if greater than resultLength, the + * output was truncated. + * @see u_parseMessage + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_vformatMessage( const char *locale, + const UChar *pattern, + int32_t patternLength, + UChar *result, + int32_t resultLength, + va_list ap, + UErrorCode *status); + +/** + * Parse a message. + * For numeric arguments, this function will always use doubles. Integer types + * should not be passed. + * This function is not able to parse all output from {@link #u_formatMessage }. + * @param locale The locale for which the message is formatted + * @param pattern The pattern specifying the message's format + * @param patternLength The length of pattern + * @param source The text to parse. + * @param sourceLength The length of source, or -1 if null-terminated. + * @param status A pointer to an UErrorCode to receive any errors + * @param ... A variable-length argument list containing the arguments + * specified in pattern. + * @see u_formatMessage + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +u_parseMessage( const char *locale, + const UChar *pattern, + int32_t patternLength, + const UChar *source, + int32_t sourceLength, + UErrorCode *status, + ...); + +/** + * Parse a message. + * For numeric arguments, this function will always use doubles. Integer types + * should not be passed. + * This function is not able to parse all output from {@link #u_formatMessage }. + * @param locale The locale for which the message is formatted + * @param pattern The pattern specifying the message's format + * @param patternLength The length of pattern + * @param source The text to parse. + * @param sourceLength The length of source, or -1 if null-terminated. + * @param ap A variable-length argument list containing the arguments + * @param status A pointer to an UErrorCode to receive any errors + * specified in pattern. + * @see u_formatMessage + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +u_vparseMessage(const char *locale, + const UChar *pattern, + int32_t patternLength, + const UChar *source, + int32_t sourceLength, + va_list ap, + UErrorCode *status); + +/** + * Format a message for a locale. + * This function may perform re-ordering of the arguments depending on the + * locale. For all numeric arguments, double is assumed unless the type is + * explicitly integer. All choice format arguments must be of type double. + * @param locale The locale for which the message will be formatted + * @param pattern The pattern specifying the message's format + * @param patternLength The length of pattern + * @param result A pointer to a buffer to receive the formatted message. + * @param resultLength The maximum size of result. + * @param status A pointer to an UErrorCode to receive any errors + * @param ... A variable-length argument list containing the arguments specified + * in pattern. + * @param parseError A pointer to UParseError to receive information about errors + * occurred during parsing. + * @return The total buffer size needed; if greater than resultLength, the + * output was truncated. + * @see u_parseMessage + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_formatMessageWithError( const char *locale, + const UChar *pattern, + int32_t patternLength, + UChar *result, + int32_t resultLength, + UParseError *parseError, + UErrorCode *status, + ...); + +/** + * Format a message for a locale. + * This function may perform re-ordering of the arguments depending on the + * locale. For all numeric arguments, double is assumed unless the type is + * explicitly integer. All choice format arguments must be of type double. + * @param locale The locale for which the message will be formatted + * @param pattern The pattern specifying the message's format + * @param patternLength The length of pattern + * @param result A pointer to a buffer to receive the formatted message. + * @param resultLength The maximum size of result. + * @param parseError A pointer to UParseError to receive information about errors + * occurred during parsing. + * @param ap A variable-length argument list containing the arguments specified + * @param status A pointer to an UErrorCode to receive any errors + * in pattern. + * @return The total buffer size needed; if greater than resultLength, the + * output was truncated. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_vformatMessageWithError( const char *locale, + const UChar *pattern, + int32_t patternLength, + UChar *result, + int32_t resultLength, + UParseError* parseError, + va_list ap, + UErrorCode *status); + +/** + * Parse a message. + * For numeric arguments, this function will always use doubles. Integer types + * should not be passed. + * This function is not able to parse all output from {@link #u_formatMessage }. + * @param locale The locale for which the message is formatted + * @param pattern The pattern specifying the message's format + * @param patternLength The length of pattern + * @param source The text to parse. + * @param sourceLength The length of source, or -1 if null-terminated. + * @param parseError A pointer to UParseError to receive information about errors + * occurred during parsing. + * @param status A pointer to an UErrorCode to receive any errors + * @param ... A variable-length argument list containing the arguments + * specified in pattern. + * @see u_formatMessage + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +u_parseMessageWithError(const char *locale, + const UChar *pattern, + int32_t patternLength, + const UChar *source, + int32_t sourceLength, + UParseError *parseError, + UErrorCode *status, + ...); + +/** + * Parse a message. + * For numeric arguments, this function will always use doubles. Integer types + * should not be passed. + * This function is not able to parse all output from {@link #u_formatMessage }. + * @param locale The locale for which the message is formatted + * @param pattern The pattern specifying the message's format + * @param patternLength The length of pattern + * @param source The text to parse. + * @param sourceLength The length of source, or -1 if null-terminated. + * @param ap A variable-length argument list containing the arguments + * @param parseError A pointer to UParseError to receive information about errors + * occurred during parsing. + * @param status A pointer to an UErrorCode to receive any errors + * specified in pattern. + * @see u_formatMessage + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +u_vparseMessageWithError(const char *locale, + const UChar *pattern, + int32_t patternLength, + const UChar *source, + int32_t sourceLength, + va_list ap, + UParseError *parseError, + UErrorCode* status); + +/*----------------------- New experimental API --------------------------- */ +/** + * The message format object + * @stable ICU 2.0 + */ +typedef void* UMessageFormat; + + +/** + * Open a message formatter with given pattern and for the given locale. + * @param pattern A pattern specifying the format to use. + * @param patternLength Length of the pattern to use + * @param locale The locale for which the messages are formatted. + * @param parseError A pointer to UParseError struct to receive any errors + * occured during parsing. Can be NULL. + * @param status A pointer to an UErrorCode to receive any errors. + * @return A pointer to a UMessageFormat to use for formatting + * messages, or 0 if an error occurred. + * @stable ICU 2.0 + */ +U_STABLE UMessageFormat* U_EXPORT2 +umsg_open( const UChar *pattern, + int32_t patternLength, + const char *locale, + UParseError *parseError, + UErrorCode *status); + +/** + * Close a UMessageFormat. + * Once closed, a UMessageFormat may no longer be used. + * @param format The formatter to close. + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +umsg_close(UMessageFormat* format); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUMessageFormatPointer + * "Smart pointer" class, closes a UMessageFormat via umsg_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUMessageFormatPointer, UMessageFormat, umsg_close); + +U_NAMESPACE_END + +#endif + +/** + * Open a copy of a UMessageFormat. + * This function performs a deep copy. + * @param fmt The formatter to copy + * @param status A pointer to an UErrorCode to receive any errors. + * @return A pointer to a UDateFormat identical to fmt. + * @stable ICU 2.0 + */ +U_STABLE UMessageFormat U_EXPORT2 +umsg_clone(const UMessageFormat *fmt, + UErrorCode *status); + +/** + * Sets the locale. This locale is used for fetching default number or date + * format information. + * @param fmt The formatter to set + * @param locale The locale the formatter should use. + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +umsg_setLocale(UMessageFormat *fmt, + const char* locale); + +/** + * Gets the locale. This locale is used for fetching default number or date + * format information. + * @param fmt The formatter to querry + * @return the locale. + * @stable ICU 2.0 + */ +U_STABLE const char* U_EXPORT2 +umsg_getLocale(const UMessageFormat *fmt); + +/** + * Sets the pattern. + * @param fmt The formatter to use + * @param pattern The pattern to be applied. + * @param patternLength Length of the pattern to use + * @param parseError Struct to receive information on position + * of error if an error is encountered.Can be NULL. + * @param status Output param set to success/failure code on + * exit. If the pattern is invalid, this will be + * set to a failure result. + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +umsg_applyPattern( UMessageFormat *fmt, + const UChar* pattern, + int32_t patternLength, + UParseError* parseError, + UErrorCode* status); + +/** + * Gets the pattern. + * @param fmt The formatter to use + * @param result A pointer to a buffer to receive the pattern. + * @param resultLength The maximum size of result. + * @param status Output param set to success/failure code on + * exit. If the pattern is invalid, this will be + * set to a failure result. + * @return the pattern of the format + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +umsg_toPattern(const UMessageFormat *fmt, + UChar* result, + int32_t resultLength, + UErrorCode* status); + +/** + * Format a message for a locale. + * This function may perform re-ordering of the arguments depending on the + * locale. For all numeric arguments, double is assumed unless the type is + * explicitly integer. All choice format arguments must be of type double. + * @param fmt The formatter to use + * @param result A pointer to a buffer to receive the formatted message. + * @param resultLength The maximum size of result. + * @param status A pointer to an UErrorCode to receive any errors + * @param ... A variable-length argument list containing the arguments + * specified in pattern. + * @return The total buffer size needed; if greater than resultLength, + * the output was truncated. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +umsg_format( const UMessageFormat *fmt, + UChar *result, + int32_t resultLength, + UErrorCode *status, + ...); + +/** + * Format a message for a locale. + * This function may perform re-ordering of the arguments depending on the + * locale. For all numeric arguments, double is assumed unless the type is + * explicitly integer. All choice format arguments must be of type double. + * @param fmt The formatter to use + * @param result A pointer to a buffer to receive the formatted message. + * @param resultLength The maximum size of result. + * @param ap A variable-length argument list containing the arguments + * @param status A pointer to an UErrorCode to receive any errors + * specified in pattern. + * @return The total buffer size needed; if greater than resultLength, + * the output was truncated. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +umsg_vformat( const UMessageFormat *fmt, + UChar *result, + int32_t resultLength, + va_list ap, + UErrorCode *status); + +/** + * Parse a message. + * For numeric arguments, this function will always use doubles. Integer types + * should not be passed. + * This function is not able to parse all output from {@link #umsg_format }. + * @param fmt The formatter to use + * @param source The text to parse. + * @param sourceLength The length of source, or -1 if null-terminated. + * @param count Output param to receive number of elements returned. + * @param status A pointer to an UErrorCode to receive any errors + * @param ... A variable-length argument list containing the arguments + * specified in pattern. + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +umsg_parse( const UMessageFormat *fmt, + const UChar *source, + int32_t sourceLength, + int32_t *count, + UErrorCode *status, + ...); + +/** + * Parse a message. + * For numeric arguments, this function will always use doubles. Integer types + * should not be passed. + * This function is not able to parse all output from {@link #umsg_format }. + * @param fmt The formatter to use + * @param source The text to parse. + * @param sourceLength The length of source, or -1 if null-terminated. + * @param count Output param to receive number of elements returned. + * @param ap A variable-length argument list containing the arguments + * @param status A pointer to an UErrorCode to receive any errors + * specified in pattern. + * @see u_formatMessage + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +umsg_vparse(const UMessageFormat *fmt, + const UChar *source, + int32_t sourceLength, + int32_t *count, + va_list ap, + UErrorCode *status); + + +/** + * Convert an 'apostrophe-friendly' pattern into a standard + * pattern. Standard patterns treat all apostrophes as + * quotes, which is problematic in some languages, e.g. + * French, where apostrophe is commonly used. This utility + * assumes that only an unpaired apostrophe immediately before + * a brace is a true quote. Other unpaired apostrophes are paired, + * and the resulting standard pattern string is returned. + * + *

Note it is not guaranteed that the returned pattern + * is indeed a valid pattern. The only effect is to convert + * between patterns having different quoting semantics. + * + * @param pattern the 'apostrophe-friendly' patttern to convert + * @param patternLength the length of pattern, or -1 if unknown and pattern is null-terminated + * @param dest the buffer for the result, or NULL if preflight only + * @param destCapacity the length of the buffer, or 0 if preflighting + * @param ec the error code + * @return the length of the resulting text, not including trailing null + * if buffer has room for the trailing null, it is provided, otherwise + * not + * @stable ICU 3.4 + */ +U_STABLE int32_t U_EXPORT2 +umsg_autoQuoteApostrophe(const UChar* pattern, + int32_t patternLength, + UChar* dest, + int32_t destCapacity, + UErrorCode* ec); + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/unifilt.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/unifilt.h new file mode 100644 index 0000000..e105271 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/unifilt.h @@ -0,0 +1,122 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1999-2010, International Business Machines Corporation and others. +* All Rights Reserved. +********************************************************************** +* Date Name Description +* 11/17/99 aliu Creation. +********************************************************************** +*/ +#ifndef UNIFILT_H +#define UNIFILT_H + +#include "unicode/unifunct.h" +#include "unicode/unimatch.h" + +/** + * \file + * \brief C++ API: Unicode Filter + */ + +U_NAMESPACE_BEGIN + +/** + * U_ETHER is used to represent character values for positions outside + * a range. For example, transliterator uses this to represent + * characters outside the range contextStart..contextLimit-1. This + * allows explicit matching by rules and UnicodeSets of text outside a + * defined range. + * @stable ICU 3.0 + */ +#define U_ETHER ((char16_t)0xFFFF) + +/** + * + * UnicodeFilter defines a protocol for selecting a + * subset of the full range (U+0000 to U+10FFFF) of Unicode characters. + * Currently, filters are used in conjunction with classes like {@link + * Transliterator} to only process selected characters through a + * transformation. + * + *

Note: UnicodeFilter currently stubs out two pure virtual methods + * of its base class, UnicodeMatcher. These methods are toPattern() + * and matchesIndexValue(). This is done so that filter classes that + * are not actually used as matchers -- specifically, those in the + * UnicodeFilterLogic component, and those in tests -- can continue to + * work without defining these methods. As long as a filter is not + * used in an RBT during real transliteration, these methods will not + * be called. However, this breaks the UnicodeMatcher base class + * protocol, and it is not a correct solution. + * + *

In the future we may revisit the UnicodeMatcher / UnicodeFilter + * hierarchy and either redesign it, or simply remove the stubs in + * UnicodeFilter and force subclasses to implement the full + * UnicodeMatcher protocol. + * + * @see UnicodeFilterLogic + * @stable ICU 2.0 + */ +class U_COMMON_API UnicodeFilter : public UnicodeFunctor, public UnicodeMatcher { + +public: + /** + * Destructor + * @stable ICU 2.0 + */ + virtual ~UnicodeFilter(); + + /** + * Returns true for characters that are in the selected + * subset. In other words, if a character is to be + * filtered, then contains() returns + * false. + * @stable ICU 2.0 + */ + virtual UBool contains(UChar32 c) const = 0; + + /** + * UnicodeFunctor API. Cast 'this' to a UnicodeMatcher* pointer + * and return the pointer. + * @stable ICU 2.4 + */ + virtual UnicodeMatcher* toMatcher() const; + + /** + * Implement UnicodeMatcher API. + * @stable ICU 2.4 + */ + virtual UMatchDegree matches(const Replaceable& text, + int32_t& offset, + int32_t limit, + UBool incremental); + + /** + * UnicodeFunctor API. Nothing to do. + * @stable ICU 2.4 + */ + virtual void setData(const TransliterationRuleData*); + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.2 + */ + static UClassID U_EXPORT2 getStaticClassID(); + +protected: + + /* + * Since this class has pure virtual functions, + * a constructor can't be used. + * @stable ICU 2.0 + */ +/* UnicodeFilter();*/ +}; + +/*inline UnicodeFilter::UnicodeFilter() {}*/ + +U_NAMESPACE_END + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/unifunct.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/unifunct.h new file mode 100644 index 0000000..1c50759 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/unifunct.h @@ -0,0 +1,127 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2002-2005, International Business Machines Corporation +* and others. All Rights Reserved. +********************************************************************** +* Date Name Description +* 01/14/2002 aliu Creation. +********************************************************************** +*/ +#ifndef UNIFUNCT_H +#define UNIFUNCT_H + +#include "unicode/utypes.h" +#include "unicode/uobject.h" + +/** + * \file + * \brief C++ API: Unicode Functor + */ + +U_NAMESPACE_BEGIN + +class UnicodeMatcher; +class UnicodeReplacer; +class TransliterationRuleData; + +/** + * UnicodeFunctor is an abstract base class for objects + * that perform match and/or replace operations on Unicode strings. + * @author Alan Liu + * @stable ICU 2.4 + */ +class U_COMMON_API UnicodeFunctor : public UObject { + +public: + + /** + * Destructor + * @stable ICU 2.4 + */ + virtual ~UnicodeFunctor(); + + /** + * Return a copy of this object. All UnicodeFunctor objects + * have to support cloning in order to allow classes using + * UnicodeFunctor to implement cloning. + * @stable ICU 2.4 + */ + virtual UnicodeFunctor* clone() const = 0; + + /** + * Cast 'this' to a UnicodeMatcher* pointer and return the + * pointer, or null if this is not a UnicodeMatcher*. Subclasses + * that mix in UnicodeMatcher as a base class must override this. + * This protocol is required because a pointer to a UnicodeFunctor + * cannot be cast to a pointer to a UnicodeMatcher, since + * UnicodeMatcher is a mixin that does not derive from + * UnicodeFunctor. + * @stable ICU 2.4 + */ + virtual UnicodeMatcher* toMatcher() const; + + /** + * Cast 'this' to a UnicodeReplacer* pointer and return the + * pointer, or null if this is not a UnicodeReplacer*. Subclasses + * that mix in UnicodeReplacer as a base class must override this. + * This protocol is required because a pointer to a UnicodeFunctor + * cannot be cast to a pointer to a UnicodeReplacer, since + * UnicodeReplacer is a mixin that does not derive from + * UnicodeFunctor. + * @stable ICU 2.4 + */ + virtual UnicodeReplacer* toReplacer() const; + + /** + * Return the class ID for this class. This is useful only for + * comparing to a return value from getDynamicClassID(). + * @return The class ID for all objects of this class. + * @stable ICU 2.0 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Returns a unique class ID polymorphically. This method + * is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and + * clone() methods call this method. + * + *

Concrete subclasses of UnicodeFunctor should use the macro + * UOBJECT_DEFINE_RTTI_IMPLEMENTATION from uobject.h to + * provide definitios getStaticClassID and getDynamicClassID. + * + * @return The class ID for this object. All objects of a given + * class have the same class ID. Objects of other classes have + * different class IDs. + * @stable ICU 2.4 + */ + virtual UClassID getDynamicClassID(void) const = 0; + + /** + * Set the data object associated with this functor. The data + * object provides context for functor-to-standin mapping. This + * method is required when assigning a functor to a different data + * object. This function MAY GO AWAY later if the architecture is + * changed to pass data object pointers through the API. + * @internal ICU 2.1 + */ + virtual void setData(const TransliterationRuleData*) = 0; + +protected: + + /** + * Since this class has pure virtual functions, + * a constructor can't be used. + * @stable ICU 2.0 + */ + /*UnicodeFunctor();*/ + +}; + +/*inline UnicodeFunctor::UnicodeFunctor() {}*/ + +U_NAMESPACE_END + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/unimatch.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/unimatch.h new file mode 100644 index 0000000..ee4326f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/unimatch.h @@ -0,0 +1,165 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +* Copyright (C) 2001-2005, International Business Machines Corporation and others. All Rights Reserved. +********************************************************************** +* Date Name Description +* 07/18/01 aliu Creation. +********************************************************************** +*/ +#ifndef UNIMATCH_H +#define UNIMATCH_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Unicode Matcher + */ + + +U_NAMESPACE_BEGIN + +class Replaceable; +class UnicodeString; +class UnicodeSet; + +/** + * Constants returned by UnicodeMatcher::matches() + * indicating the degree of match. + * @stable ICU 2.4 + */ +enum UMatchDegree { + /** + * Constant returned by matches() indicating a + * mismatch between the text and this matcher. The text contains + * a character which does not match, or the text does not contain + * all desired characters for a non-incremental match. + * @stable ICU 2.4 + */ + U_MISMATCH, + + /** + * Constant returned by matches() indicating a + * partial match between the text and this matcher. This value is + * only returned for incremental match operations. All characters + * of the text match, but more characters are required for a + * complete match. Alternatively, for variable-length matchers, + * all characters of the text match, and if more characters were + * supplied at limit, they might also match. + * @stable ICU 2.4 + */ + U_PARTIAL_MATCH, + + /** + * Constant returned by matches() indicating a + * complete match between the text and this matcher. For an + * incremental variable-length match, this value is returned if + * the given text matches, and it is known that additional + * characters would not alter the extent of the match. + * @stable ICU 2.4 + */ + U_MATCH +}; + +/** + * UnicodeMatcher defines a protocol for objects that can + * match a range of characters in a Replaceable string. + * @stable ICU 2.4 + */ +class U_COMMON_API UnicodeMatcher /* not : public UObject because this is an interface/mixin class */ { + +public: + /** + * Destructor. + * @stable ICU 2.4 + */ + virtual ~UnicodeMatcher(); + + /** + * Return a UMatchDegree value indicating the degree of match for + * the given text at the given offset. Zero, one, or more + * characters may be matched. + * + * Matching in the forward direction is indicated by limit > + * offset. Characters from offset forwards to limit-1 will be + * considered for matching. + * + * Matching in the reverse direction is indicated by limit < + * offset. Characters from offset backwards to limit+1 will be + * considered for matching. + * + * If limit == offset then the only match possible is a zero + * character match (which subclasses may implement if desired). + * + * As a side effect, advance the offset parameter to the limit of + * the matched substring. In the forward direction, this will be + * the index of the last matched character plus one. In the + * reverse direction, this will be the index of the last matched + * character minus one. + * + *

Note: This method is not const because some classes may + * modify their state as the result of a match. + * + * @param text the text to be matched + * @param offset on input, the index into text at which to begin + * matching. On output, the limit of the matched text. The + * number of matched characters is the output value of offset + * minus the input value. Offset should always point to the + * HIGH SURROGATE (leading code unit) of a pair of surrogates, + * both on entry and upon return. + * @param limit the limit index of text to be matched. Greater + * than offset for a forward direction match, less than offset for + * a backward direction match. The last character to be + * considered for matching will be text.charAt(limit-1) in the + * forward direction or text.charAt(limit+1) in the backward + * direction. + * @param incremental if TRUE, then assume further characters may + * be inserted at limit and check for partial matching. Otherwise + * assume the text as given is complete. + * @return a match degree value indicating a full match, a partial + * match, or a mismatch. If incremental is FALSE then + * U_PARTIAL_MATCH should never be returned. + * @stable ICU 2.4 + */ + virtual UMatchDegree matches(const Replaceable& text, + int32_t& offset, + int32_t limit, + UBool incremental) = 0; + + /** + * Returns a string representation of this matcher. If the result of + * calling this function is passed to the appropriate parser, it + * will produce another matcher that is equal to this one. + * @param result the string to receive the pattern. Previous + * contents will be deleted. + * @param escapeUnprintable if TRUE then convert unprintable + * character to their hex escape representations, \\uxxxx or + * \\Uxxxxxxxx. Unprintable characters are those other than + * U+000A, U+0020..U+007E. + * @stable ICU 2.4 + */ + virtual UnicodeString& toPattern(UnicodeString& result, + UBool escapeUnprintable = FALSE) const = 0; + + /** + * Returns TRUE if this matcher will match a character c, where c + * & 0xFF == v, at offset, in the forward direction (with limit > + * offset). This is used by RuleBasedTransliterator for + * indexing. + * @stable ICU 2.4 + */ + virtual UBool matchesIndexValue(uint8_t v) const = 0; + + /** + * Union the set of all characters that may be matched by this object + * into the given set. + * @param toUnionTo the set into which to union the source characters + * @stable ICU 2.4 + */ + virtual void addMatchSetTo(UnicodeSet& toUnionTo) const = 0; +}; + +U_NAMESPACE_END + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/unirepl.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/unirepl.h new file mode 100644 index 0000000..ddcb0ad --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/unirepl.h @@ -0,0 +1,99 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2002-2005, International Business Machines Corporation +* and others. All Rights Reserved. +********************************************************************** +* Date Name Description +* 01/14/2002 aliu Creation. +********************************************************************** +*/ +#ifndef UNIREPL_H +#define UNIREPL_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: UnicodeReplacer + */ + +U_NAMESPACE_BEGIN + +class Replaceable; +class UnicodeString; +class UnicodeSet; + +/** + * UnicodeReplacer defines a protocol for objects that + * replace a range of characters in a Replaceable string with output + * text. The replacement is done via the Replaceable API so as to + * preserve out-of-band data. + * + *

This is a mixin class. + * @author Alan Liu + * @stable ICU 2.4 + */ +class U_I18N_API UnicodeReplacer /* not : public UObject because this is an interface/mixin class */ { + + public: + + /** + * Destructor. + * @stable ICU 2.4 + */ + virtual ~UnicodeReplacer(); + + /** + * Replace characters in 'text' from 'start' to 'limit' with the + * output text of this object. Update the 'cursor' parameter to + * give the cursor position and return the length of the + * replacement text. + * + * @param text the text to be matched + * @param start inclusive start index of text to be replaced + * @param limit exclusive end index of text to be replaced; + * must be greater than or equal to start + * @param cursor output parameter for the cursor position. + * Not all replacer objects will update this, but in a complete + * tree of replacer objects, representing the entire output side + * of a transliteration rule, at least one must update it. + * @return the number of 16-bit code units in the text replacing + * the characters at offsets start..(limit-1) in text + * @stable ICU 2.4 + */ + virtual int32_t replace(Replaceable& text, + int32_t start, + int32_t limit, + int32_t& cursor) = 0; + + /** + * Returns a string representation of this replacer. If the + * result of calling this function is passed to the appropriate + * parser, typically TransliteratorParser, it will produce another + * replacer that is equal to this one. + * @param result the string to receive the pattern. Previous + * contents will be deleted. + * @param escapeUnprintable if TRUE then convert unprintable + * character to their hex escape representations, \\uxxxx or + * \\Uxxxxxxxx. Unprintable characters are defined by + * Utility.isUnprintable(). + * @return a reference to 'result'. + * @stable ICU 2.4 + */ + virtual UnicodeString& toReplacerPattern(UnicodeString& result, + UBool escapeUnprintable) const = 0; + + /** + * Union the set of all characters that may output by this object + * into the given set. + * @param toUnionTo the set into which to union the output characters + * @stable ICU 2.4 + */ + virtual void addReplacementSetTo(UnicodeSet& toUnionTo) const = 0; +}; + +U_NAMESPACE_END + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/uniset.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/uniset.h new file mode 100644 index 0000000..4a4ce19 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/uniset.h @@ -0,0 +1,1715 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +*************************************************************************** +* Copyright (C) 1999-2016, International Business Machines Corporation +* and others. All Rights Reserved. +*************************************************************************** +* Date Name Description +* 10/20/99 alan Creation. +*************************************************************************** +*/ + +#ifndef UNICODESET_H +#define UNICODESET_H + +#include "unicode/unifilt.h" +#include "unicode/unistr.h" +#include "unicode/uset.h" + +/** + * \file + * \brief C++ API: Unicode Set + */ + +U_NAMESPACE_BEGIN + +// Forward Declarations. +void U_CALLCONV UnicodeSet_initInclusion(int32_t src, UErrorCode &status); /**< @internal */ + +class BMPSet; +class ParsePosition; +class RBBIRuleScanner; +class SymbolTable; +class UnicodeSetStringSpan; +class UVector; +class RuleCharacterIterator; + +/** + * A mutable set of Unicode characters and multicharacter strings. Objects of this class + * represent character classes used in regular expressions. + * A character specifies a subset of Unicode code points. Legal + * code points are U+0000 to U+10FFFF, inclusive. + * + *

The UnicodeSet class is not designed to be subclassed. + * + *

UnicodeSet supports two APIs. The first is the + * operand API that allows the caller to modify the value of + * a UnicodeSet object. It conforms to Java 2's + * java.util.Set interface, although + * UnicodeSet does not actually implement that + * interface. All methods of Set are supported, with the + * modification that they take a character range or single character + * instead of an Object, and they take a + * UnicodeSet instead of a Collection. The + * operand API may be thought of in terms of boolean logic: a boolean + * OR is implemented by add, a boolean AND is implemented + * by retain, a boolean XOR is implemented by + * complement taking an argument, and a boolean NOT is + * implemented by complement with no argument. In terms + * of traditional set theory function names, add is a + * union, retain is an intersection, remove + * is an asymmetric difference, and complement with no + * argument is a set complement with respect to the superset range + * MIN_VALUE-MAX_VALUE + * + *

The second API is the + * applyPattern()/toPattern() API from the + * java.text.Format-derived classes. Unlike the + * methods that add characters, add categories, and control the logic + * of the set, the method applyPattern() sets all + * attributes of a UnicodeSet at once, based on a + * string pattern. + * + *

Pattern syntax

+ * + * Patterns are accepted by the constructors and the + * applyPattern() methods and returned by the + * toPattern() method. These patterns follow a syntax + * similar to that employed by version 8 regular expression character + * classes. Here are some simple examples: + * + * \htmlonly
\endhtmlonly + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
[]No characters
[a]The character 'a'
[ae]The characters 'a' and 'e'
[a-e]The characters 'a' through 'e' inclusive, in Unicode code + * point order
[\\u4E01]The character U+4E01
[a{ab}{ac}]The character 'a' and the multicharacter strings "ab" and + * "ac"
[\\p{Lu}]All characters in the general category Uppercase Letter
+ * \htmlonly
\endhtmlonly + * + * Any character may be preceded by a backslash in order to remove any special + * meaning. White space characters, as defined by UCharacter.isWhitespace(), are + * ignored, unless they are escaped. + * + *

Property patterns specify a set of characters having a certain + * property as defined by the Unicode standard. Both the POSIX-like + * "[:Lu:]" and the Perl-like syntax "\\p{Lu}" are recognized. For a + * complete list of supported property patterns, see the User's Guide + * for UnicodeSet at + * + * http://icu-project.org/userguide/unicodeSet.html. + * Actual determination of property data is defined by the underlying + * Unicode database as implemented by UCharacter. + * + *

Patterns specify individual characters, ranges of characters, and + * Unicode property sets. When elements are concatenated, they + * specify their union. To complement a set, place a '^' immediately + * after the opening '['. Property patterns are inverted by modifying + * their delimiters; "[:^foo]" and "\\P{foo}". In any other location, + * '^' has no special meaning. + * + *

Ranges are indicated by placing two a '-' between two + * characters, as in "a-z". This specifies the range of all + * characters from the left to the right, in Unicode order. If the + * left character is greater than or equal to the + * right character it is a syntax error. If a '-' occurs as the first + * character after the opening '[' or '[^', or if it occurs as the + * last character before the closing ']', then it is taken as a + * literal. Thus "[a\-b]", "[-ab]", and "[ab-]" all indicate the same + * set of three characters, 'a', 'b', and '-'. + * + *

Sets may be intersected using the '&' operator or the asymmetric + * set difference may be taken using the '-' operator, for example, + * "[[:L:]&[\\u0000-\\u0FFF]]" indicates the set of all Unicode letters + * with values less than 4096. Operators ('&' and '|') have equal + * precedence and bind left-to-right. Thus + * "[[:L:]-[a-z]-[\\u0100-\\u01FF]]" is equivalent to + * "[[[:L:]-[a-z]]-[\\u0100-\\u01FF]]". This only really matters for + * difference; intersection is commutative. + * + * + *
[a]The set containing 'a' + *
[a-z]The set containing 'a' + * through 'z' and all letters in between, in Unicode order + *
[^a-z]The set containing + * all characters but 'a' through 'z', + * that is, U+0000 through 'a'-1 and 'z'+1 through U+10FFFF + *
[[pat1][pat2]] + * The union of sets specified by pat1 and pat2 + *
[[pat1]&[pat2]] + * The intersection of sets specified by pat1 and pat2 + *
[[pat1]-[pat2]] + * The asymmetric difference of sets specified by pat1 and + * pat2 + *
[:Lu:] or \\p{Lu} + * The set of characters having the specified + * Unicode property; in + * this case, Unicode uppercase letters + *
[:^Lu:] or \\P{Lu} + * The set of characters not having the given + * Unicode property + *
+ * + *

Warning: you cannot add an empty string ("") to a UnicodeSet.

+ * + *

Formal syntax

+ * + * \htmlonly
\endhtmlonly + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
pattern :=  ('[' '^'? item* ']') | + * property
item :=  char | (char '-' char) | pattern-expr
+ *
pattern-expr :=  pattern | pattern-expr pattern | + * pattern-expr op pattern
+ *
op :=  '&' | '-'
+ *
special :=  '[' | ']' | '-'
+ *
char :=  any character that is not special
+ * | ('\'
any character)
+ * | ('\\u' hex hex hex hex)
+ *
hex :=  any character for which + * Character.digit(c, 16) + * returns a non-negative result
property :=  a Unicode property set pattern
+ *
+ * + * + * + * + *
Legend: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
a := b  a may be replaced by b
a?zero or one instance of a
+ *
a*one or more instances of a
+ *
a | beither a or b
+ *
'a'the literal string between the quotes
+ *
+ * \htmlonly
\endhtmlonly + * + *

Note: + * - Most UnicodeSet methods do not take a UErrorCode parameter because + * there are usually very few opportunities for failure other than a shortage + * of memory, error codes in low-level C++ string methods would be inconvenient, + * and the error code as the last parameter (ICU convention) would prevent + * the use of default parameter values. + * Instead, such methods set the UnicodeSet into a "bogus" state + * (see isBogus()) if an error occurs. + * + * @author Alan Liu + * @stable ICU 2.0 + */ +class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter { + + int32_t len; // length of list used; 0 <= len <= capacity + int32_t capacity; // capacity of list + UChar32* list; // MUST be terminated with HIGH + BMPSet *bmpSet; // The set is frozen iff either bmpSet or stringSpan is not NULL. + UChar32* buffer; // internal buffer, may be NULL + int32_t bufferCapacity; // capacity of buffer + int32_t patLen; + + /** + * The pattern representation of this set. This may not be the + * most economical pattern. It is the pattern supplied to + * applyPattern(), with variables substituted and whitespace + * removed. For sets constructed without applyPattern(), or + * modified using the non-pattern API, this string will be empty, + * indicating that toPattern() must generate a pattern + * representation from the inversion list. + */ + char16_t *pat; + UVector* strings; // maintained in sorted order + UnicodeSetStringSpan *stringSpan; + +private: + enum { // constants + kIsBogus = 1 // This set is bogus (i.e. not valid) + }; + uint8_t fFlags; // Bit flag (see constants above) +public: + /** + * Determine if this object contains a valid set. + * A bogus set has no value. It is different from an empty set. + * It can be used to indicate that no set value is available. + * + * @return TRUE if the set is bogus/invalid, FALSE otherwise + * @see setToBogus() + * @stable ICU 4.0 + */ + inline UBool isBogus(void) const; + + /** + * Make this UnicodeSet object invalid. + * The string will test TRUE with isBogus(). + * + * A bogus set has no value. It is different from an empty set. + * It can be used to indicate that no set value is available. + * + * This utility function is used throughout the UnicodeSet + * implementation to indicate that a UnicodeSet operation failed, + * and may be used in other functions, + * especially but not exclusively when such functions do not + * take a UErrorCode for simplicity. + * + * @see isBogus() + * @stable ICU 4.0 + */ + void setToBogus(); + +public: + + enum { + /** + * Minimum value that can be stored in a UnicodeSet. + * @stable ICU 2.4 + */ + MIN_VALUE = 0, + + /** + * Maximum value that can be stored in a UnicodeSet. + * @stable ICU 2.4 + */ + MAX_VALUE = 0x10ffff + }; + + //---------------------------------------------------------------- + // Constructors &c + //---------------------------------------------------------------- + +public: + + /** + * Constructs an empty set. + * @stable ICU 2.0 + */ + UnicodeSet(); + + /** + * Constructs a set containing the given range. If end < + * start then an empty set is created. + * + * @param start first character, inclusive, of range + * @param end last character, inclusive, of range + * @stable ICU 2.4 + */ + UnicodeSet(UChar32 start, UChar32 end); + +#ifndef U_HIDE_INTERNAL_API + /** + * @internal + */ + enum ESerialization { + kSerialized /* result of serialize() */ + }; + + /** + * Constructs a set from the output of serialize(). + * + * @param buffer the 16 bit array + * @param bufferLen the original length returned from serialize() + * @param serialization the value 'kSerialized' + * @param status error code + * + * @internal + */ + UnicodeSet(const uint16_t buffer[], int32_t bufferLen, + ESerialization serialization, UErrorCode &status); +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Constructs a set from the given pattern. See the class + * description for the syntax of the pattern language. + * @param pattern a string specifying what characters are in the set + * @param status returns U_ILLEGAL_ARGUMENT_ERROR if the pattern + * contains a syntax error. + * @stable ICU 2.0 + */ + UnicodeSet(const UnicodeString& pattern, + UErrorCode& status); + +#ifndef U_HIDE_INTERNAL_API + /** + * Constructs a set from the given pattern. See the class + * description for the syntax of the pattern language. + * @param pattern a string specifying what characters are in the set + * @param options bitmask for options to apply to the pattern. + * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. + * @param symbols a symbol table mapping variable names to values + * and stand-in characters to UnicodeSets; may be NULL + * @param status returns U_ILLEGAL_ARGUMENT_ERROR if the pattern + * contains a syntax error. + * @internal + */ + UnicodeSet(const UnicodeString& pattern, + uint32_t options, + const SymbolTable* symbols, + UErrorCode& status); +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Constructs a set from the given pattern. See the class description + * for the syntax of the pattern language. + * @param pattern a string specifying what characters are in the set + * @param pos on input, the position in pattern at which to start parsing. + * On output, the position after the last character parsed. + * @param options bitmask for options to apply to the pattern. + * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. + * @param symbols a symbol table mapping variable names to values + * and stand-in characters to UnicodeSets; may be NULL + * @param status input-output error code + * @stable ICU 2.8 + */ + UnicodeSet(const UnicodeString& pattern, ParsePosition& pos, + uint32_t options, + const SymbolTable* symbols, + UErrorCode& status); + + /** + * Constructs a set that is identical to the given UnicodeSet. + * @stable ICU 2.0 + */ + UnicodeSet(const UnicodeSet& o); + + /** + * Destructs the set. + * @stable ICU 2.0 + */ + virtual ~UnicodeSet(); + + /** + * Assigns this object to be a copy of another. + * A frozen set will not be modified. + * @stable ICU 2.0 + */ + UnicodeSet& operator=(const UnicodeSet& o); + + /** + * Compares the specified object with this set for equality. Returns + * true if the two sets + * have the same size, and every member of the specified set is + * contained in this set (or equivalently, every member of this set is + * contained in the specified set). + * + * @param o set to be compared for equality with this set. + * @return true if the specified set is equal to this set. + * @stable ICU 2.0 + */ + virtual UBool operator==(const UnicodeSet& o) const; + + /** + * Compares the specified object with this set for equality. Returns + * true if the specified set is not equal to this set. + * @stable ICU 2.0 + */ + UBool operator!=(const UnicodeSet& o) const; + + /** + * Returns a copy of this object. All UnicodeFunctor objects have + * to support cloning in order to allow classes using + * UnicodeFunctors, such as Transliterator, to implement cloning. + * If this set is frozen, then the clone will be frozen as well. + * Use cloneAsThawed() for a mutable clone of a frozen set. + * @see cloneAsThawed + * @stable ICU 2.0 + */ + virtual UnicodeFunctor* clone() const; + + /** + * Returns the hash code value for this set. + * + * @return the hash code value for this set. + * @see Object#hashCode() + * @stable ICU 2.0 + */ + virtual int32_t hashCode(void) const; + + /** + * Get a UnicodeSet pointer from a USet + * + * @param uset a USet (the ICU plain C type for UnicodeSet) + * @return the corresponding UnicodeSet pointer. + * + * @stable ICU 4.2 + */ + inline static UnicodeSet *fromUSet(USet *uset); + + /** + * Get a UnicodeSet pointer from a const USet + * + * @param uset a const USet (the ICU plain C type for UnicodeSet) + * @return the corresponding UnicodeSet pointer. + * + * @stable ICU 4.2 + */ + inline static const UnicodeSet *fromUSet(const USet *uset); + + /** + * Produce a USet * pointer for this UnicodeSet. + * USet is the plain C type for UnicodeSet + * + * @return a USet pointer for this UnicodeSet + * @stable ICU 4.2 + */ + inline USet *toUSet(); + + + /** + * Produce a const USet * pointer for this UnicodeSet. + * USet is the plain C type for UnicodeSet + * + * @return a const USet pointer for this UnicodeSet + * @stable ICU 4.2 + */ + inline const USet * toUSet() const; + + + //---------------------------------------------------------------- + // Freezable API + //---------------------------------------------------------------- + + /** + * Determines whether the set has been frozen (made immutable) or not. + * See the ICU4J Freezable interface for details. + * @return TRUE/FALSE for whether the set has been frozen + * @see freeze + * @see cloneAsThawed + * @stable ICU 3.8 + */ + inline UBool isFrozen() const; + + /** + * Freeze the set (make it immutable). + * Once frozen, it cannot be unfrozen and is therefore thread-safe + * until it is deleted. + * See the ICU4J Freezable interface for details. + * Freezing the set may also make some operations faster, for example + * contains() and span(). + * A frozen set will not be modified. (It remains frozen.) + * @return this set. + * @see isFrozen + * @see cloneAsThawed + * @stable ICU 3.8 + */ + UnicodeFunctor *freeze(); + + /** + * Clone the set and make the clone mutable. + * See the ICU4J Freezable interface for details. + * @return the mutable clone + * @see freeze + * @see isFrozen + * @stable ICU 3.8 + */ + UnicodeFunctor *cloneAsThawed() const; + + //---------------------------------------------------------------- + // Public API + //---------------------------------------------------------------- + + /** + * Make this object represent the range start - end. + * If end > start then this object is set to an + * an empty range. + * A frozen set will not be modified. + * + * @param start first character in the set, inclusive + * @param end last character in the set, inclusive + * @stable ICU 2.4 + */ + UnicodeSet& set(UChar32 start, UChar32 end); + + /** + * Return true if the given position, in the given pattern, appears + * to be the start of a UnicodeSet pattern. + * @stable ICU 2.4 + */ + static UBool resemblesPattern(const UnicodeString& pattern, + int32_t pos); + + /** + * Modifies this set to represent the set specified by the given + * pattern, ignoring Unicode Pattern_White_Space characters. + * See the class description for the syntax of the pattern language. + * A frozen set will not be modified. + * @param pattern a string specifying what characters are in the set + * @param status returns U_ILLEGAL_ARGUMENT_ERROR if the pattern + * contains a syntax error. + * Empties the set passed before applying the pattern. + * @return a reference to this + * @stable ICU 2.0 + */ + UnicodeSet& applyPattern(const UnicodeString& pattern, + UErrorCode& status); + +#ifndef U_HIDE_INTERNAL_API + /** + * Modifies this set to represent the set specified by the given + * pattern, optionally ignoring Unicode Pattern_White_Space characters. + * See the class description for the syntax of the pattern language. + * A frozen set will not be modified. + * @param pattern a string specifying what characters are in the set + * @param options bitmask for options to apply to the pattern. + * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. + * @param symbols a symbol table mapping variable names to + * values and stand-ins to UnicodeSets; may be NULL + * @param status returns U_ILLEGAL_ARGUMENT_ERROR if the pattern + * contains a syntax error. + * Empties the set passed before applying the pattern. + * @return a reference to this + * @internal + */ + UnicodeSet& applyPattern(const UnicodeString& pattern, + uint32_t options, + const SymbolTable* symbols, + UErrorCode& status); +#endif /* U_HIDE_INTERNAL_API */ + + /** + * Parses the given pattern, starting at the given position. The + * character at pattern.charAt(pos.getIndex()) must be '[', or the + * parse fails. Parsing continues until the corresponding closing + * ']'. If a syntax error is encountered between the opening and + * closing brace, the parse fails. Upon return from a successful + * parse, the ParsePosition is updated to point to the character + * following the closing ']', and a StringBuffer containing a + * pairs list for the parsed pattern is returned. This method calls + * itself recursively to parse embedded subpatterns. + * Empties the set passed before applying the pattern. + * A frozen set will not be modified. + * + * @param pattern the string containing the pattern to be parsed. + * The portion of the string from pos.getIndex(), which must be a + * '[', to the corresponding closing ']', is parsed. + * @param pos upon entry, the position at which to being parsing. + * The character at pattern.charAt(pos.getIndex()) must be a '['. + * Upon return from a successful parse, pos.getIndex() is either + * the character after the closing ']' of the parsed pattern, or + * pattern.length() if the closing ']' is the last character of + * the pattern string. + * @param options bitmask for options to apply to the pattern. + * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. + * @param symbols a symbol table mapping variable names to + * values and stand-ins to UnicodeSets; may be NULL + * @param status returns U_ILLEGAL_ARGUMENT_ERROR if the pattern + * contains a syntax error. + * @return a reference to this + * @stable ICU 2.8 + */ + UnicodeSet& applyPattern(const UnicodeString& pattern, + ParsePosition& pos, + uint32_t options, + const SymbolTable* symbols, + UErrorCode& status); + + /** + * Returns a string representation of this set. If the result of + * calling this function is passed to a UnicodeSet constructor, it + * will produce another set that is equal to this one. + * A frozen set will not be modified. + * @param result the string to receive the rules. Previous + * contents will be deleted. + * @param escapeUnprintable if TRUE then convert unprintable + * character to their hex escape representations, \\uxxxx or + * \\Uxxxxxxxx. Unprintable characters are those other than + * U+000A, U+0020..U+007E. + * @stable ICU 2.0 + */ + virtual UnicodeString& toPattern(UnicodeString& result, + UBool escapeUnprintable = FALSE) const; + + /** + * Modifies this set to contain those code points which have the given value + * for the given binary or enumerated property, as returned by + * u_getIntPropertyValue. Prior contents of this set are lost. + * A frozen set will not be modified. + * + * @param prop a property in the range UCHAR_BIN_START..UCHAR_BIN_LIMIT-1 + * or UCHAR_INT_START..UCHAR_INT_LIMIT-1 + * or UCHAR_MASK_START..UCHAR_MASK_LIMIT-1. + * + * @param value a value in the range u_getIntPropertyMinValue(prop).. + * u_getIntPropertyMaxValue(prop), with one exception. If prop is + * UCHAR_GENERAL_CATEGORY_MASK, then value should not be a UCharCategory, but + * rather a mask value produced by U_GET_GC_MASK(). This allows grouped + * categories such as [:L:] to be represented. + * + * @param ec error code input/output parameter + * + * @return a reference to this set + * + * @stable ICU 2.4 + */ + UnicodeSet& applyIntPropertyValue(UProperty prop, + int32_t value, + UErrorCode& ec); + + /** + * Modifies this set to contain those code points which have the + * given value for the given property. Prior contents of this + * set are lost. + * A frozen set will not be modified. + * + * @param prop a property alias, either short or long. The name is matched + * loosely. See PropertyAliases.txt for names and a description of loose + * matching. If the value string is empty, then this string is interpreted + * as either a General_Category value alias, a Script value alias, a binary + * property alias, or a special ID. Special IDs are matched loosely and + * correspond to the following sets: + * + * "ANY" = [\\u0000-\\U0010FFFF], + * "ASCII" = [\\u0000-\\u007F], + * "Assigned" = [:^Cn:]. + * + * @param value a value alias, either short or long. The name is matched + * loosely. See PropertyValueAliases.txt for names and a description of + * loose matching. In addition to aliases listed, numeric values and + * canonical combining classes may be expressed numerically, e.g., ("nv", + * "0.5") or ("ccc", "220"). The value string may also be empty. + * + * @param ec error code input/output parameter + * + * @return a reference to this set + * + * @stable ICU 2.4 + */ + UnicodeSet& applyPropertyAlias(const UnicodeString& prop, + const UnicodeString& value, + UErrorCode& ec); + + /** + * Returns the number of elements in this set (its cardinality). + * Note than the elements of a set may include both individual + * codepoints and strings. + * + * @return the number of elements in this set (its cardinality). + * @stable ICU 2.0 + */ + virtual int32_t size(void) const; + + /** + * Returns true if this set contains no elements. + * + * @return true if this set contains no elements. + * @stable ICU 2.0 + */ + virtual UBool isEmpty(void) const; + + /** + * Returns true if this set contains the given character. + * This function works faster with a frozen set. + * @param c character to be checked for containment + * @return true if the test condition is met + * @stable ICU 2.0 + */ + virtual UBool contains(UChar32 c) const; + + /** + * Returns true if this set contains every character + * of the given range. + * @param start first character, inclusive, of the range + * @param end last character, inclusive, of the range + * @return true if the test condition is met + * @stable ICU 2.0 + */ + virtual UBool contains(UChar32 start, UChar32 end) const; + + /** + * Returns true if this set contains the given + * multicharacter string. + * @param s string to be checked for containment + * @return true if this set contains the specified string + * @stable ICU 2.4 + */ + UBool contains(const UnicodeString& s) const; + + /** + * Returns true if this set contains all the characters and strings + * of the given set. + * @param c set to be checked for containment + * @return true if the test condition is met + * @stable ICU 2.4 + */ + virtual UBool containsAll(const UnicodeSet& c) const; + + /** + * Returns true if this set contains all the characters + * of the given string. + * @param s string containing characters to be checked for containment + * @return true if the test condition is met + * @stable ICU 2.4 + */ + UBool containsAll(const UnicodeString& s) const; + + /** + * Returns true if this set contains none of the characters + * of the given range. + * @param start first character, inclusive, of the range + * @param end last character, inclusive, of the range + * @return true if the test condition is met + * @stable ICU 2.4 + */ + UBool containsNone(UChar32 start, UChar32 end) const; + + /** + * Returns true if this set contains none of the characters and strings + * of the given set. + * @param c set to be checked for containment + * @return true if the test condition is met + * @stable ICU 2.4 + */ + UBool containsNone(const UnicodeSet& c) const; + + /** + * Returns true if this set contains none of the characters + * of the given string. + * @param s string containing characters to be checked for containment + * @return true if the test condition is met + * @stable ICU 2.4 + */ + UBool containsNone(const UnicodeString& s) const; + + /** + * Returns true if this set contains one or more of the characters + * in the given range. + * @param start first character, inclusive, of the range + * @param end last character, inclusive, of the range + * @return true if the condition is met + * @stable ICU 2.4 + */ + inline UBool containsSome(UChar32 start, UChar32 end) const; + + /** + * Returns true if this set contains one or more of the characters + * and strings of the given set. + * @param s The set to be checked for containment + * @return true if the condition is met + * @stable ICU 2.4 + */ + inline UBool containsSome(const UnicodeSet& s) const; + + /** + * Returns true if this set contains one or more of the characters + * of the given string. + * @param s string containing characters to be checked for containment + * @return true if the condition is met + * @stable ICU 2.4 + */ + inline UBool containsSome(const UnicodeString& s) const; + + /** + * Returns the length of the initial substring of the input string which + * consists only of characters and strings that are contained in this set + * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), + * or only of characters and strings that are not contained + * in this set (USET_SPAN_NOT_CONTAINED). + * See USetSpanCondition for details. + * Similar to the strspn() C library function. + * Unpaired surrogates are treated according to contains() of their surrogate code points. + * This function works faster with a frozen set and with a non-negative string length argument. + * @param s start of the string + * @param length of the string; can be -1 for NUL-terminated + * @param spanCondition specifies the containment condition + * @return the length of the initial substring according to the spanCondition; + * 0 if the start of the string does not fit the spanCondition + * @stable ICU 3.8 + * @see USetSpanCondition + */ + int32_t span(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const; + + /** + * Returns the end of the substring of the input string according to the USetSpanCondition. + * Same as start+span(s.getBuffer()+start, s.length()-start, spanCondition) + * after pinning start to 0<=start<=s.length(). + * @param s the string + * @param start the start index in the string for the span operation + * @param spanCondition specifies the containment condition + * @return the exclusive end of the substring according to the spanCondition; + * the substring s.tempSubStringBetween(start, end) fulfills the spanCondition + * @stable ICU 4.4 + * @see USetSpanCondition + */ + inline int32_t span(const UnicodeString &s, int32_t start, USetSpanCondition spanCondition) const; + + /** + * Returns the start of the trailing substring of the input string which + * consists only of characters and strings that are contained in this set + * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), + * or only of characters and strings that are not contained + * in this set (USET_SPAN_NOT_CONTAINED). + * See USetSpanCondition for details. + * Unpaired surrogates are treated according to contains() of their surrogate code points. + * This function works faster with a frozen set and with a non-negative string length argument. + * @param s start of the string + * @param length of the string; can be -1 for NUL-terminated + * @param spanCondition specifies the containment condition + * @return the start of the trailing substring according to the spanCondition; + * the string length if the end of the string does not fit the spanCondition + * @stable ICU 3.8 + * @see USetSpanCondition + */ + int32_t spanBack(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const; + + /** + * Returns the start of the substring of the input string according to the USetSpanCondition. + * Same as spanBack(s.getBuffer(), limit, spanCondition) + * after pinning limit to 0<=end<=s.length(). + * @param s the string + * @param limit the exclusive-end index in the string for the span operation + * (use s.length() or INT32_MAX for spanning back from the end of the string) + * @param spanCondition specifies the containment condition + * @return the start of the substring according to the spanCondition; + * the substring s.tempSubStringBetween(start, limit) fulfills the spanCondition + * @stable ICU 4.4 + * @see USetSpanCondition + */ + inline int32_t spanBack(const UnicodeString &s, int32_t limit, USetSpanCondition spanCondition) const; + + /** + * Returns the length of the initial substring of the input string which + * consists only of characters and strings that are contained in this set + * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), + * or only of characters and strings that are not contained + * in this set (USET_SPAN_NOT_CONTAINED). + * See USetSpanCondition for details. + * Similar to the strspn() C library function. + * Malformed byte sequences are treated according to contains(0xfffd). + * This function works faster with a frozen set and with a non-negative string length argument. + * @param s start of the string (UTF-8) + * @param length of the string; can be -1 for NUL-terminated + * @param spanCondition specifies the containment condition + * @return the length of the initial substring according to the spanCondition; + * 0 if the start of the string does not fit the spanCondition + * @stable ICU 3.8 + * @see USetSpanCondition + */ + int32_t spanUTF8(const char *s, int32_t length, USetSpanCondition spanCondition) const; + + /** + * Returns the start of the trailing substring of the input string which + * consists only of characters and strings that are contained in this set + * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), + * or only of characters and strings that are not contained + * in this set (USET_SPAN_NOT_CONTAINED). + * See USetSpanCondition for details. + * Malformed byte sequences are treated according to contains(0xfffd). + * This function works faster with a frozen set and with a non-negative string length argument. + * @param s start of the string (UTF-8) + * @param length of the string; can be -1 for NUL-terminated + * @param spanCondition specifies the containment condition + * @return the start of the trailing substring according to the spanCondition; + * the string length if the end of the string does not fit the spanCondition + * @stable ICU 3.8 + * @see USetSpanCondition + */ + int32_t spanBackUTF8(const char *s, int32_t length, USetSpanCondition spanCondition) const; + + /** + * Implement UnicodeMatcher::matches() + * @stable ICU 2.4 + */ + virtual UMatchDegree matches(const Replaceable& text, + int32_t& offset, + int32_t limit, + UBool incremental); + +private: + /** + * Returns the longest match for s in text at the given position. + * If limit > start then match forward from start+1 to limit + * matching all characters except s.charAt(0). If limit < start, + * go backward starting from start-1 matching all characters + * except s.charAt(s.length()-1). This method assumes that the + * first character, text.charAt(start), matches s, so it does not + * check it. + * @param text the text to match + * @param start the first character to match. In the forward + * direction, text.charAt(start) is matched against s.charAt(0). + * In the reverse direction, it is matched against + * s.charAt(s.length()-1). + * @param limit the limit offset for matching, either last+1 in + * the forward direction, or last-1 in the reverse direction, + * where last is the index of the last character to match. + * @param s + * @return If part of s matches up to the limit, return |limit - + * start|. If all of s matches before reaching the limit, return + * s.length(). If there is a mismatch between s and text, return + * 0 + */ + static int32_t matchRest(const Replaceable& text, + int32_t start, int32_t limit, + const UnicodeString& s); + + /** + * Returns the smallest value i such that c < list[i]. Caller + * must ensure that c is a legal value or this method will enter + * an infinite loop. This method performs a binary search. + * @param c a character in the range MIN_VALUE..MAX_VALUE + * inclusive + * @return the smallest integer i in the range 0..len-1, + * inclusive, such that c < list[i] + */ + int32_t findCodePoint(UChar32 c) const; + +public: + + /** + * Implementation of UnicodeMatcher API. Union the set of all + * characters that may be matched by this object into the given + * set. + * @param toUnionTo the set into which to union the source characters + * @stable ICU 2.4 + */ + virtual void addMatchSetTo(UnicodeSet& toUnionTo) const; + + /** + * Returns the index of the given character within this set, where + * the set is ordered by ascending code point. If the character + * is not in this set, return -1. The inverse of this method is + * charAt(). + * @return an index from 0..size()-1, or -1 + * @stable ICU 2.4 + */ + int32_t indexOf(UChar32 c) const; + + /** + * Returns the character at the given index within this set, where + * the set is ordered by ascending code point. If the index is + * out of range, return (UChar32)-1. The inverse of this method is + * indexOf(). + * @param index an index from 0..size()-1 + * @return the character at the given index, or (UChar32)-1. + * @stable ICU 2.4 + */ + UChar32 charAt(int32_t index) const; + + /** + * Adds the specified range to this set if it is not already + * present. If this set already contains the specified range, + * the call leaves this set unchanged. If end > start + * then an empty range is added, leaving the set unchanged. + * This is equivalent to a boolean logic OR, or a set UNION. + * A frozen set will not be modified. + * + * @param start first character, inclusive, of range to be added + * to this set. + * @param end last character, inclusive, of range to be added + * to this set. + * @stable ICU 2.0 + */ + virtual UnicodeSet& add(UChar32 start, UChar32 end); + + /** + * Adds the specified character to this set if it is not already + * present. If this set already contains the specified character, + * the call leaves this set unchanged. + * A frozen set will not be modified. + * @stable ICU 2.0 + */ + UnicodeSet& add(UChar32 c); + + /** + * Adds the specified multicharacter to this set if it is not already + * present. If this set already contains the multicharacter, + * the call leaves this set unchanged. + * Thus "ch" => {"ch"} + *
Warning: you cannot add an empty string ("") to a UnicodeSet. + * A frozen set will not be modified. + * @param s the source string + * @return this object, for chaining + * @stable ICU 2.4 + */ + UnicodeSet& add(const UnicodeString& s); + + private: + /** + * @return a code point IF the string consists of a single one. + * otherwise returns -1. + * @param s string to test + */ + static int32_t getSingleCP(const UnicodeString& s); + + void _add(const UnicodeString& s); + + public: + /** + * Adds each of the characters in this string to the set. Thus "ch" => {"c", "h"} + * If this set already any particular character, it has no effect on that character. + * A frozen set will not be modified. + * @param s the source string + * @return this object, for chaining + * @stable ICU 2.4 + */ + UnicodeSet& addAll(const UnicodeString& s); + + /** + * Retains EACH of the characters in this string. Note: "ch" == {"c", "h"} + * If this set already any particular character, it has no effect on that character. + * A frozen set will not be modified. + * @param s the source string + * @return this object, for chaining + * @stable ICU 2.4 + */ + UnicodeSet& retainAll(const UnicodeString& s); + + /** + * Complement EACH of the characters in this string. Note: "ch" == {"c", "h"} + * If this set already any particular character, it has no effect on that character. + * A frozen set will not be modified. + * @param s the source string + * @return this object, for chaining + * @stable ICU 2.4 + */ + UnicodeSet& complementAll(const UnicodeString& s); + + /** + * Remove EACH of the characters in this string. Note: "ch" == {"c", "h"} + * If this set already any particular character, it has no effect on that character. + * A frozen set will not be modified. + * @param s the source string + * @return this object, for chaining + * @stable ICU 2.4 + */ + UnicodeSet& removeAll(const UnicodeString& s); + + /** + * Makes a set from a multicharacter string. Thus "ch" => {"ch"} + *
Warning: you cannot add an empty string ("") to a UnicodeSet. + * @param s the source string + * @return a newly created set containing the given string. + * The caller owns the return object and is responsible for deleting it. + * @stable ICU 2.4 + */ + static UnicodeSet* U_EXPORT2 createFrom(const UnicodeString& s); + + + /** + * Makes a set from each of the characters in the string. Thus "ch" => {"c", "h"} + * @param s the source string + * @return a newly created set containing the given characters + * The caller owns the return object and is responsible for deleting it. + * @stable ICU 2.4 + */ + static UnicodeSet* U_EXPORT2 createFromAll(const UnicodeString& s); + + /** + * Retain only the elements in this set that are contained in the + * specified range. If end > start then an empty range is + * retained, leaving the set empty. This is equivalent to + * a boolean logic AND, or a set INTERSECTION. + * A frozen set will not be modified. + * + * @param start first character, inclusive, of range to be retained + * to this set. + * @param end last character, inclusive, of range to be retained + * to this set. + * @stable ICU 2.0 + */ + virtual UnicodeSet& retain(UChar32 start, UChar32 end); + + + /** + * Retain the specified character from this set if it is present. + * A frozen set will not be modified. + * @stable ICU 2.0 + */ + UnicodeSet& retain(UChar32 c); + + /** + * Removes the specified range from this set if it is present. + * The set will not contain the specified range once the call + * returns. If end > start then an empty range is + * removed, leaving the set unchanged. + * A frozen set will not be modified. + * + * @param start first character, inclusive, of range to be removed + * from this set. + * @param end last character, inclusive, of range to be removed + * from this set. + * @stable ICU 2.0 + */ + virtual UnicodeSet& remove(UChar32 start, UChar32 end); + + /** + * Removes the specified character from this set if it is present. + * The set will not contain the specified range once the call + * returns. + * A frozen set will not be modified. + * @stable ICU 2.0 + */ + UnicodeSet& remove(UChar32 c); + + /** + * Removes the specified string from this set if it is present. + * The set will not contain the specified character once the call + * returns. + * A frozen set will not be modified. + * @param s the source string + * @return this object, for chaining + * @stable ICU 2.4 + */ + UnicodeSet& remove(const UnicodeString& s); + + /** + * Inverts this set. This operation modifies this set so that + * its value is its complement. This is equivalent to + * complement(MIN_VALUE, MAX_VALUE). + * A frozen set will not be modified. + * @stable ICU 2.0 + */ + virtual UnicodeSet& complement(void); + + /** + * Complements the specified range in this set. Any character in + * the range will be removed if it is in this set, or will be + * added if it is not in this set. If end > start + * then an empty range is complemented, leaving the set unchanged. + * This is equivalent to a boolean logic XOR. + * A frozen set will not be modified. + * + * @param start first character, inclusive, of range to be removed + * from this set. + * @param end last character, inclusive, of range to be removed + * from this set. + * @stable ICU 2.0 + */ + virtual UnicodeSet& complement(UChar32 start, UChar32 end); + + /** + * Complements the specified character in this set. The character + * will be removed if it is in this set, or will be added if it is + * not in this set. + * A frozen set will not be modified. + * @stable ICU 2.0 + */ + UnicodeSet& complement(UChar32 c); + + /** + * Complement the specified string in this set. + * The set will not contain the specified string once the call + * returns. + *
Warning: you cannot add an empty string ("") to a UnicodeSet. + * A frozen set will not be modified. + * @param s the string to complement + * @return this object, for chaining + * @stable ICU 2.4 + */ + UnicodeSet& complement(const UnicodeString& s); + + /** + * Adds all of the elements in the specified set to this set if + * they're not already present. This operation effectively + * modifies this set so that its value is the union of the two + * sets. The behavior of this operation is unspecified if the specified + * collection is modified while the operation is in progress. + * A frozen set will not be modified. + * + * @param c set whose elements are to be added to this set. + * @see #add(UChar32, UChar32) + * @stable ICU 2.0 + */ + virtual UnicodeSet& addAll(const UnicodeSet& c); + + /** + * Retains only the elements in this set that are contained in the + * specified set. In other words, removes from this set all of + * its elements that are not contained in the specified set. This + * operation effectively modifies this set so that its value is + * the intersection of the two sets. + * A frozen set will not be modified. + * + * @param c set that defines which elements this set will retain. + * @stable ICU 2.0 + */ + virtual UnicodeSet& retainAll(const UnicodeSet& c); + + /** + * Removes from this set all of its elements that are contained in the + * specified set. This operation effectively modifies this + * set so that its value is the asymmetric set difference of + * the two sets. + * A frozen set will not be modified. + * + * @param c set that defines which elements will be removed from + * this set. + * @stable ICU 2.0 + */ + virtual UnicodeSet& removeAll(const UnicodeSet& c); + + /** + * Complements in this set all elements contained in the specified + * set. Any character in the other set will be removed if it is + * in this set, or will be added if it is not in this set. + * A frozen set will not be modified. + * + * @param c set that defines which elements will be xor'ed from + * this set. + * @stable ICU 2.4 + */ + virtual UnicodeSet& complementAll(const UnicodeSet& c); + + /** + * Removes all of the elements from this set. This set will be + * empty after this call returns. + * A frozen set will not be modified. + * @stable ICU 2.0 + */ + virtual UnicodeSet& clear(void); + + /** + * Close this set over the given attribute. For the attribute + * USET_CASE, the result is to modify this set so that: + * + * 1. For each character or string 'a' in this set, all strings or + * characters 'b' such that foldCase(a) == foldCase(b) are added + * to this set. + * + * 2. For each string 'e' in the resulting set, if e != + * foldCase(e), 'e' will be removed. + * + * Example: [aq\\u00DF{Bc}{bC}{Fi}] => [aAqQ\\u00DF\\uFB01{ss}{bc}{fi}] + * + * (Here foldCase(x) refers to the operation u_strFoldCase, and a + * == b denotes that the contents are the same, not pointer + * comparison.) + * + * A frozen set will not be modified. + * + * @param attribute bitmask for attributes to close over. + * Currently only the USET_CASE bit is supported. Any undefined bits + * are ignored. + * @return a reference to this set. + * @stable ICU 4.2 + */ + UnicodeSet& closeOver(int32_t attribute); + + /** + * Remove all strings from this set. + * + * @return a reference to this set. + * @stable ICU 4.2 + */ + virtual UnicodeSet &removeAllStrings(); + + /** + * Iteration method that returns the number of ranges contained in + * this set. + * @see #getRangeStart + * @see #getRangeEnd + * @stable ICU 2.4 + */ + virtual int32_t getRangeCount(void) const; + + /** + * Iteration method that returns the first character in the + * specified range of this set. + * @see #getRangeCount + * @see #getRangeEnd + * @stable ICU 2.4 + */ + virtual UChar32 getRangeStart(int32_t index) const; + + /** + * Iteration method that returns the last character in the + * specified range of this set. + * @see #getRangeStart + * @see #getRangeEnd + * @stable ICU 2.4 + */ + virtual UChar32 getRangeEnd(int32_t index) const; + + /** + * Serializes this set into an array of 16-bit integers. Serialization + * (currently) only records the characters in the set; multicharacter + * strings are ignored. + * + * The array has following format (each line is one 16-bit + * integer): + * + * length = (n+2*m) | (m!=0?0x8000:0) + * bmpLength = n; present if m!=0 + * bmp[0] + * bmp[1] + * ... + * bmp[n-1] + * supp-high[0] + * supp-low[0] + * supp-high[1] + * supp-low[1] + * ... + * supp-high[m-1] + * supp-low[m-1] + * + * The array starts with a header. After the header are n bmp + * code points, then m supplementary code points. Either n or m + * or both may be zero. n+2*m is always <= 0x7FFF. + * + * If there are no supplementary characters (if m==0) then the + * header is one 16-bit integer, 'length', with value n. + * + * If there are supplementary characters (if m!=0) then the header + * is two 16-bit integers. The first, 'length', has value + * (n+2*m)|0x8000. The second, 'bmpLength', has value n. + * + * After the header the code points are stored in ascending order. + * Supplementary code points are stored as most significant 16 + * bits followed by least significant 16 bits. + * + * @param dest pointer to buffer of destCapacity 16-bit integers. + * May be NULL only if destCapacity is zero. + * @param destCapacity size of dest, or zero. Must not be negative. + * @param ec error code. Will be set to U_INDEX_OUTOFBOUNDS_ERROR + * if n+2*m > 0x7FFF. Will be set to U_BUFFER_OVERFLOW_ERROR if + * n+2*m+(m!=0?2:1) > destCapacity. + * @return the total length of the serialized format, including + * the header, that is, n+2*m+(m!=0?2:1), or 0 on error other + * than U_BUFFER_OVERFLOW_ERROR. + * @stable ICU 2.4 + */ + int32_t serialize(uint16_t *dest, int32_t destCapacity, UErrorCode& ec) const; + + /** + * Reallocate this objects internal structures to take up the least + * possible space, without changing this object's value. + * A frozen set will not be modified. + * @stable ICU 2.4 + */ + virtual UnicodeSet& compact(); + + /** + * Return the class ID for this class. This is useful only for + * comparing to a return value from getDynamicClassID(). For example: + *

+     * .      Base* polymorphic_pointer = createPolymorphicObject();
+     * .      if (polymorphic_pointer->getDynamicClassID() ==
+     * .          Derived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @stable ICU 2.0 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Implement UnicodeFunctor API. + * + * @return The class ID for this object. All objects of a given + * class have the same class ID. Objects of other classes have + * different class IDs. + * @stable ICU 2.4 + */ + virtual UClassID getDynamicClassID(void) const; + +private: + + // Private API for the USet API + + friend class USetAccess; + + int32_t getStringCount() const; + + const UnicodeString* getString(int32_t index) const; + + //---------------------------------------------------------------- + // RuleBasedTransliterator support + //---------------------------------------------------------------- + +private: + + /** + * Returns true if this set contains any character whose low byte + * is the given value. This is used by RuleBasedTransliterator for + * indexing. + */ + virtual UBool matchesIndexValue(uint8_t v) const; + +private: + friend class RBBIRuleScanner; + + //---------------------------------------------------------------- + // Implementation: Clone as thawed (see ICU4J Freezable) + //---------------------------------------------------------------- + + UnicodeSet(const UnicodeSet& o, UBool /* asThawed */); + + //---------------------------------------------------------------- + // Implementation: Pattern parsing + //---------------------------------------------------------------- + + void applyPatternIgnoreSpace(const UnicodeString& pattern, + ParsePosition& pos, + const SymbolTable* symbols, + UErrorCode& status); + + void applyPattern(RuleCharacterIterator& chars, + const SymbolTable* symbols, + UnicodeString& rebuiltPat, + uint32_t options, + UnicodeSet& (UnicodeSet::*caseClosure)(int32_t attribute), + UErrorCode& ec); + + //---------------------------------------------------------------- + // Implementation: Utility methods + //---------------------------------------------------------------- + + void ensureCapacity(int32_t newLen, UErrorCode& ec); + + void ensureBufferCapacity(int32_t newLen, UErrorCode& ec); + + void swapBuffers(void); + + UBool allocateStrings(UErrorCode &status); + + UnicodeString& _toPattern(UnicodeString& result, + UBool escapeUnprintable) const; + + UnicodeString& _generatePattern(UnicodeString& result, + UBool escapeUnprintable) const; + + static void _appendToPat(UnicodeString& buf, const UnicodeString& s, UBool escapeUnprintable); + + static void _appendToPat(UnicodeString& buf, UChar32 c, UBool escapeUnprintable); + + //---------------------------------------------------------------- + // Implementation: Fundamental operators + //---------------------------------------------------------------- + + void exclusiveOr(const UChar32* other, int32_t otherLen, int8_t polarity); + + void add(const UChar32* other, int32_t otherLen, int8_t polarity); + + void retain(const UChar32* other, int32_t otherLen, int8_t polarity); + + /** + * Return true if the given position, in the given pattern, appears + * to be the start of a property set pattern [:foo:], \\p{foo}, or + * \\P{foo}, or \\N{name}. + */ + static UBool resemblesPropertyPattern(const UnicodeString& pattern, + int32_t pos); + + static UBool resemblesPropertyPattern(RuleCharacterIterator& chars, + int32_t iterOpts); + + /** + * Parse the given property pattern at the given parse position + * and set this UnicodeSet to the result. + * + * The original design document is out of date, but still useful. + * Ignore the property and value names: + * http://source.icu-project.org/repos/icu/icuhtml/trunk/design/unicodeset_properties.html + * + * Recognized syntax: + * + * [:foo:] [:^foo:] - white space not allowed within "[:" or ":]" + * \\p{foo} \\P{foo} - white space not allowed within "\\p" or "\\P" + * \\N{name} - white space not allowed within "\\N" + * + * Other than the above restrictions, Unicode Pattern_White_Space characters are ignored. + * Case is ignored except in "\\p" and "\\P" and "\\N". In 'name' leading + * and trailing space is deleted, and internal runs of whitespace + * are collapsed to a single space. + * + * We support binary properties, enumerated properties, and the + * following non-enumerated properties: + * + * Numeric_Value + * Name + * Unicode_1_Name + * + * @param pattern the pattern string + * @param ppos on entry, the position at which to begin parsing. + * This should be one of the locations marked '^': + * + * [:blah:] \\p{blah} \\P{blah} \\N{name} + * ^ % ^ % ^ % ^ % + * + * On return, the position after the last character parsed, that is, + * the locations marked '%'. If the parse fails, ppos is returned + * unchanged. + * @param ec status + * @return a reference to this. + */ + UnicodeSet& applyPropertyPattern(const UnicodeString& pattern, + ParsePosition& ppos, + UErrorCode &ec); + + void applyPropertyPattern(RuleCharacterIterator& chars, + UnicodeString& rebuiltPat, + UErrorCode& ec); + + friend void U_CALLCONV UnicodeSet_initInclusion(int32_t src, UErrorCode &status); + static const UnicodeSet* getInclusions(int32_t src, UErrorCode &status); + + /** + * A filter that returns TRUE if the given code point should be + * included in the UnicodeSet being constructed. + */ + typedef UBool (*Filter)(UChar32 codePoint, void* context); + + /** + * Given a filter, set this UnicodeSet to the code points + * contained by that filter. The filter MUST be + * property-conformant. That is, if it returns value v for one + * code point, then it must return v for all affiliated code + * points, as defined by the inclusions list. See + * getInclusions(). + * src is a UPropertySource value. + */ + void applyFilter(Filter filter, + void* context, + int32_t src, + UErrorCode &status); + + /** + * Set the new pattern to cache. + */ + void setPattern(const UnicodeString& newPat); + /** + * Release existing cached pattern. + */ + void releasePattern(); + + friend class UnicodeSetIterator; +}; + + + +inline UBool UnicodeSet::operator!=(const UnicodeSet& o) const { + return !operator==(o); +} + +inline UBool UnicodeSet::isFrozen() const { + return (UBool)(bmpSet!=NULL || stringSpan!=NULL); +} + +inline UBool UnicodeSet::containsSome(UChar32 start, UChar32 end) const { + return !containsNone(start, end); +} + +inline UBool UnicodeSet::containsSome(const UnicodeSet& s) const { + return !containsNone(s); +} + +inline UBool UnicodeSet::containsSome(const UnicodeString& s) const { + return !containsNone(s); +} + +inline UBool UnicodeSet::isBogus() const { + return (UBool)(fFlags & kIsBogus); +} + +inline UnicodeSet *UnicodeSet::fromUSet(USet *uset) { + return reinterpret_cast(uset); +} + +inline const UnicodeSet *UnicodeSet::fromUSet(const USet *uset) { + return reinterpret_cast(uset); +} + +inline USet *UnicodeSet::toUSet() { + return reinterpret_cast(this); +} + +inline const USet *UnicodeSet::toUSet() const { + return reinterpret_cast(this); +} + +inline int32_t UnicodeSet::span(const UnicodeString &s, int32_t start, USetSpanCondition spanCondition) const { + int32_t sLength=s.length(); + if(start<0) { + start=0; + } else if(start>sLength) { + start=sLength; + } + return start+span(s.getBuffer()+start, sLength-start, spanCondition); +} + +inline int32_t UnicodeSet::spanBack(const UnicodeString &s, int32_t limit, USetSpanCondition spanCondition) const { + int32_t sLength=s.length(); + if(limit<0) { + limit=0; + } else if(limit>sLength) { + limit=sLength; + } + return spanBack(s.getBuffer(), limit, spanCondition); +} + +U_NAMESPACE_END + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/unistr.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/unistr.h new file mode 100644 index 0000000..b99a686 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/unistr.h @@ -0,0 +1,4807 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1998-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* +* File unistr.h +* +* Modification History: +* +* Date Name Description +* 09/25/98 stephen Creation. +* 11/11/98 stephen Changed per 11/9 code review. +* 04/20/99 stephen Overhauled per 4/16 code review. +* 11/18/99 aliu Made to inherit from Replaceable. Added method +* handleReplaceBetween(); other methods unchanged. +* 06/25/01 grhoten Remove dependency on iostream. +****************************************************************************** +*/ + +#ifndef UNISTR_H +#define UNISTR_H + +/** + * \file + * \brief C++ API: Unicode String + */ + +#include +#include "unicode/utypes.h" +#include "unicode/char16ptr.h" +#include "unicode/rep.h" +#include "unicode/std_string.h" +#include "unicode/stringpiece.h" +#include "unicode/bytestream.h" + +struct UConverter; // unicode/ucnv.h + +#ifndef USTRING_H +/** + * \ingroup ustring_ustrlen + */ +U_STABLE int32_t U_EXPORT2 +u_strlen(const UChar *s); +#endif + +U_NAMESPACE_BEGIN + +#if !UCONFIG_NO_BREAK_ITERATION +class BreakIterator; // unicode/brkiter.h +#endif +class Edits; + +U_NAMESPACE_END + +// Not #ifndef U_HIDE_INTERNAL_API because UnicodeString needs the UStringCaseMapper. +/** + * Internal string case mapping function type. + * All error checking must be done. + * src and dest must not overlap. + * @internal + */ +typedef int32_t U_CALLCONV +UStringCaseMapper(int32_t caseLocale, uint32_t options, +#if !UCONFIG_NO_BREAK_ITERATION + icu::BreakIterator *iter, +#endif + char16_t *dest, int32_t destCapacity, + const char16_t *src, int32_t srcLength, + icu::Edits *edits, + UErrorCode &errorCode); + +U_NAMESPACE_BEGIN + +class Locale; // unicode/locid.h +class StringCharacterIterator; +class UnicodeStringAppendable; // unicode/appendable.h + +/* The include has been moved to unicode/ustream.h */ + +/** + * Constant to be used in the UnicodeString(char *, int32_t, EInvariant) constructor + * which constructs a Unicode string from an invariant-character char * string. + * About invariant characters see utypes.h. + * This constructor has no runtime dependency on conversion code and is + * therefore recommended over ones taking a charset name string + * (where the empty string "" indicates invariant-character conversion). + * + * @stable ICU 3.2 + */ +#define US_INV icu::UnicodeString::kInvariant + +/** + * Unicode String literals in C++. + * + * Note: these macros are not recommended for new code. + * Prior to the availability of C++11 and u"unicode string literals", + * these macros were provided for portability and efficiency when + * initializing UnicodeStrings from literals. + * + * They work only for strings that contain "invariant characters", i.e., + * only latin letters, digits, and some punctuation. + * See utypes.h for details. + * + * The string parameter must be a C string literal. + * The length of the string, not including the terminating + * NUL, must be specified as a constant. + * @stable ICU 2.0 + */ +#if !U_CHAR16_IS_TYPEDEF +# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, u ## cs, _length) +#else +# define UNICODE_STRING(cs, _length) icu::UnicodeString(TRUE, (const char16_t*)u ## cs, _length) +#endif + +/** + * Unicode String literals in C++. + * Dependent on the platform properties, different UnicodeString + * constructors should be used to create a UnicodeString object from + * a string literal. + * The macros are defined for improved performance. + * They work only for strings that contain "invariant characters", i.e., + * only latin letters, digits, and some punctuation. + * See utypes.h for details. + * + * The string parameter must be a C string literal. + * @stable ICU 2.0 + */ +#define UNICODE_STRING_SIMPLE(cs) UNICODE_STRING(cs, -1) + +/** + * \def UNISTR_FROM_CHAR_EXPLICIT + * This can be defined to be empty or "explicit". + * If explicit, then the UnicodeString(char16_t) and UnicodeString(UChar32) + * constructors are marked as explicit, preventing their inadvertent use. + * @stable ICU 49 + */ +#ifndef UNISTR_FROM_CHAR_EXPLICIT +# if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) + // Auto-"explicit" in ICU library code. +# define UNISTR_FROM_CHAR_EXPLICIT explicit +# else + // Empty by default for source code compatibility. +# define UNISTR_FROM_CHAR_EXPLICIT +# endif +#endif + +/** + * \def UNISTR_FROM_STRING_EXPLICIT + * This can be defined to be empty or "explicit". + * If explicit, then the UnicodeString(const char *) and UnicodeString(const char16_t *) + * constructors are marked as explicit, preventing their inadvertent use. + * + * In particular, this helps prevent accidentally depending on ICU conversion code + * by passing a string literal into an API with a const UnicodeString & parameter. + * @stable ICU 49 + */ +#ifndef UNISTR_FROM_STRING_EXPLICIT +# if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) + // Auto-"explicit" in ICU library code. +# define UNISTR_FROM_STRING_EXPLICIT explicit +# else + // Empty by default for source code compatibility. +# define UNISTR_FROM_STRING_EXPLICIT +# endif +#endif + +/** + * \def UNISTR_OBJECT_SIZE + * Desired sizeof(UnicodeString) in bytes. + * It should be a multiple of sizeof(pointer) to avoid unusable space for padding. + * The object size may want to be a multiple of 16 bytes, + * which is a common granularity for heap allocation. + * + * Any space inside the object beyond sizeof(vtable pointer) + 2 + * is available for storing short strings inside the object. + * The bigger the object, the longer a string that can be stored inside the object, + * without additional heap allocation. + * + * Depending on a platform's pointer size, pointer alignment requirements, + * and struct padding, the compiler will usually round up sizeof(UnicodeString) + * to 4 * sizeof(pointer) (or 3 * sizeof(pointer) for P128 data models), + * to hold the fields for heap-allocated strings. + * Such a minimum size also ensures that the object is easily large enough + * to hold at least 2 char16_ts, for one supplementary code point (U16_MAX_LENGTH). + * + * sizeof(UnicodeString) >= 48 should work for all known platforms. + * + * For example, on a 64-bit machine where sizeof(vtable pointer) is 8, + * sizeof(UnicodeString) = 64 would leave space for + * (64 - sizeof(vtable pointer) - 2) / U_SIZEOF_UCHAR = (64 - 8 - 2) / 2 = 27 + * char16_ts stored inside the object. + * + * The minimum object size on a 64-bit machine would be + * 4 * sizeof(pointer) = 4 * 8 = 32 bytes, + * and the internal buffer would hold up to 11 char16_ts in that case. + * + * @see U16_MAX_LENGTH + * @stable ICU 56 + */ +#ifndef UNISTR_OBJECT_SIZE +# define UNISTR_OBJECT_SIZE 64 +#endif + +/** + * UnicodeString is a string class that stores Unicode characters directly and provides + * similar functionality as the Java String and StringBuffer/StringBuilder classes. + * It is a concrete implementation of the abstract class Replaceable (for transliteration). + * + * A UnicodeString may also "alias" an external array of characters + * (that is, point to it, rather than own the array) + * whose lifetime must then at least match the lifetime of the aliasing object. + * This aliasing may be preserved when returning a UnicodeString by value, + * depending on the compiler and the function implementation, + * via Return Value Optimization (RVO) or the move assignment operator. + * (However, the copy assignment operator does not preserve aliasing.) + * For details see the description of storage models at the end of the class API docs + * and in the User Guide chapter linked from there. + * + * The UnicodeString class is not suitable for subclassing. + * + *

For an overview of Unicode strings in C and C++ see the + * User Guide Strings chapter.

+ * + *

In ICU, a Unicode string consists of 16-bit Unicode code units. + * A Unicode character may be stored with either one code unit + * (the most common case) or with a matched pair of special code units + * ("surrogates"). The data type for code units is char16_t. + * For single-character handling, a Unicode character code point is a value + * in the range 0..0x10ffff. ICU uses the UChar32 type for code points.

+ * + *

Indexes and offsets into and lengths of strings always count code units, not code points. + * This is the same as with multi-byte char* strings in traditional string handling. + * Operations on partial strings typically do not test for code point boundaries. + * If necessary, the user needs to take care of such boundaries by testing for the code unit + * values or by using functions like + * UnicodeString::getChar32Start() and UnicodeString::getChar32Limit() + * (or, in C, the equivalent macros U16_SET_CP_START() and U16_SET_CP_LIMIT(), see utf.h).

+ * + * UnicodeString methods are more lenient with regard to input parameter values + * than other ICU APIs. In particular: + * - If indexes are out of bounds for a UnicodeString object + * (<0 or >length()) then they are "pinned" to the nearest boundary. + * - If primitive string pointer values (e.g., const char16_t * or char *) + * for input strings are NULL, then those input string parameters are treated + * as if they pointed to an empty string. + * However, this is not the case for char * parameters for charset names + * or other IDs. + * - Most UnicodeString methods do not take a UErrorCode parameter because + * there are usually very few opportunities for failure other than a shortage + * of memory, error codes in low-level C++ string methods would be inconvenient, + * and the error code as the last parameter (ICU convention) would prevent + * the use of default parameter values. + * Instead, such methods set the UnicodeString into a "bogus" state + * (see isBogus()) if an error occurs. + * + * In string comparisons, two UnicodeString objects that are both "bogus" + * compare equal (to be transitive and prevent endless loops in sorting), + * and a "bogus" string compares less than any non-"bogus" one. + * + * Const UnicodeString methods are thread-safe. Multiple threads can use + * const methods on the same UnicodeString object simultaneously, + * but non-const methods must not be called concurrently (in multiple threads) + * with any other (const or non-const) methods. + * + * Similarly, const UnicodeString & parameters are thread-safe. + * One object may be passed in as such a parameter concurrently in multiple threads. + * This includes the const UnicodeString & parameters for + * copy construction, assignment, and cloning. + * + *

UnicodeString uses several storage methods. + * String contents can be stored inside the UnicodeString object itself, + * in an allocated and shared buffer, or in an outside buffer that is "aliased". + * Most of this is done transparently, but careful aliasing in particular provides + * significant performance improvements. + * Also, the internal buffer is accessible via special functions. + * For details see the + * User Guide Strings chapter.

+ * + * @see utf.h + * @see CharacterIterator + * @stable ICU 2.0 + */ +class U_COMMON_API UnicodeString : public Replaceable +{ +public: + + /** + * Constant to be used in the UnicodeString(char *, int32_t, EInvariant) constructor + * which constructs a Unicode string from an invariant-character char * string. + * Use the macro US_INV instead of the full qualification for this value. + * + * @see US_INV + * @stable ICU 3.2 + */ + enum EInvariant { + /** + * @see EInvariant + * @stable ICU 3.2 + */ + kInvariant + }; + + //======================================== + // Read-only operations + //======================================== + + /* Comparison - bitwise only - for international comparison use collation */ + + /** + * Equality operator. Performs only bitwise comparison. + * @param text The UnicodeString to compare to this one. + * @return TRUE if text contains the same characters as this one, + * FALSE otherwise. + * @stable ICU 2.0 + */ + inline UBool operator== (const UnicodeString& text) const; + + /** + * Inequality operator. Performs only bitwise comparison. + * @param text The UnicodeString to compare to this one. + * @return FALSE if text contains the same characters as this one, + * TRUE otherwise. + * @stable ICU 2.0 + */ + inline UBool operator!= (const UnicodeString& text) const; + + /** + * Greater than operator. Performs only bitwise comparison. + * @param text The UnicodeString to compare to this one. + * @return TRUE if the characters in this are bitwise + * greater than the characters in text, FALSE otherwise + * @stable ICU 2.0 + */ + inline UBool operator> (const UnicodeString& text) const; + + /** + * Less than operator. Performs only bitwise comparison. + * @param text The UnicodeString to compare to this one. + * @return TRUE if the characters in this are bitwise + * less than the characters in text, FALSE otherwise + * @stable ICU 2.0 + */ + inline UBool operator< (const UnicodeString& text) const; + + /** + * Greater than or equal operator. Performs only bitwise comparison. + * @param text The UnicodeString to compare to this one. + * @return TRUE if the characters in this are bitwise + * greater than or equal to the characters in text, FALSE otherwise + * @stable ICU 2.0 + */ + inline UBool operator>= (const UnicodeString& text) const; + + /** + * Less than or equal operator. Performs only bitwise comparison. + * @param text The UnicodeString to compare to this one. + * @return TRUE if the characters in this are bitwise + * less than or equal to the characters in text, FALSE otherwise + * @stable ICU 2.0 + */ + inline UBool operator<= (const UnicodeString& text) const; + + /** + * Compare the characters bitwise in this UnicodeString to + * the characters in text. + * @param text The UnicodeString to compare to this one. + * @return The result of bitwise character comparison: 0 if this + * contains the same characters as text, -1 if the characters in + * this are bitwise less than the characters in text, +1 if the + * characters in this are bitwise greater than the characters + * in text. + * @stable ICU 2.0 + */ + inline int8_t compare(const UnicodeString& text) const; + + /** + * Compare the characters bitwise in the range + * [start, start + length) with the characters + * in the entire string text. + * (The parameters "start" and "length" are not applied to the other text "text".) + * @param start the offset at which the compare operation begins + * @param length the number of characters of text to compare. + * @param text the other text to be compared against this string. + * @return The result of bitwise character comparison: 0 if this + * contains the same characters as text, -1 if the characters in + * this are bitwise less than the characters in text, +1 if the + * characters in this are bitwise greater than the characters + * in text. + * @stable ICU 2.0 + */ + inline int8_t compare(int32_t start, + int32_t length, + const UnicodeString& text) const; + + /** + * Compare the characters bitwise in the range + * [start, start + length) with the characters + * in srcText in the range + * [srcStart, srcStart + srcLength). + * @param start the offset at which the compare operation begins + * @param length the number of characters in this to compare. + * @param srcText the text to be compared + * @param srcStart the offset into srcText to start comparison + * @param srcLength the number of characters in src to compare + * @return The result of bitwise character comparison: 0 if this + * contains the same characters as srcText, -1 if the characters in + * this are bitwise less than the characters in srcText, +1 if the + * characters in this are bitwise greater than the characters + * in srcText. + * @stable ICU 2.0 + */ + inline int8_t compare(int32_t start, + int32_t length, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const; + + /** + * Compare the characters bitwise in this UnicodeString with the first + * srcLength characters in srcChars. + * @param srcChars The characters to compare to this UnicodeString. + * @param srcLength the number of characters in srcChars to compare + * @return The result of bitwise character comparison: 0 if this + * contains the same characters as srcChars, -1 if the characters in + * this are bitwise less than the characters in srcChars, +1 if the + * characters in this are bitwise greater than the characters + * in srcChars. + * @stable ICU 2.0 + */ + inline int8_t compare(ConstChar16Ptr srcChars, + int32_t srcLength) const; + + /** + * Compare the characters bitwise in the range + * [start, start + length) with the first + * length characters in srcChars + * @param start the offset at which the compare operation begins + * @param length the number of characters to compare. + * @param srcChars the characters to be compared + * @return The result of bitwise character comparison: 0 if this + * contains the same characters as srcChars, -1 if the characters in + * this are bitwise less than the characters in srcChars, +1 if the + * characters in this are bitwise greater than the characters + * in srcChars. + * @stable ICU 2.0 + */ + inline int8_t compare(int32_t start, + int32_t length, + const char16_t *srcChars) const; + + /** + * Compare the characters bitwise in the range + * [start, start + length) with the characters + * in srcChars in the range + * [srcStart, srcStart + srcLength). + * @param start the offset at which the compare operation begins + * @param length the number of characters in this to compare + * @param srcChars the characters to be compared + * @param srcStart the offset into srcChars to start comparison + * @param srcLength the number of characters in srcChars to compare + * @return The result of bitwise character comparison: 0 if this + * contains the same characters as srcChars, -1 if the characters in + * this are bitwise less than the characters in srcChars, +1 if the + * characters in this are bitwise greater than the characters + * in srcChars. + * @stable ICU 2.0 + */ + inline int8_t compare(int32_t start, + int32_t length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) const; + + /** + * Compare the characters bitwise in the range + * [start, limit) with the characters + * in srcText in the range + * [srcStart, srcLimit). + * @param start the offset at which the compare operation begins + * @param limit the offset immediately following the compare operation + * @param srcText the text to be compared + * @param srcStart the offset into srcText to start comparison + * @param srcLimit the offset into srcText to limit comparison + * @return The result of bitwise character comparison: 0 if this + * contains the same characters as srcText, -1 if the characters in + * this are bitwise less than the characters in srcText, +1 if the + * characters in this are bitwise greater than the characters + * in srcText. + * @stable ICU 2.0 + */ + inline int8_t compareBetween(int32_t start, + int32_t limit, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLimit) const; + + /** + * Compare two Unicode strings in code point order. + * The result may be different from the results of compare(), operator<, etc. + * if supplementary characters are present: + * + * In UTF-16, supplementary characters (with code points U+10000 and above) are + * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, + * which means that they compare as less than some other BMP characters like U+feff. + * This function compares Unicode strings in code point order. + * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined. + * + * @param text Another string to compare this one to. + * @return a negative/zero/positive integer corresponding to whether + * this string is less than/equal to/greater than the second one + * in code point order + * @stable ICU 2.0 + */ + inline int8_t compareCodePointOrder(const UnicodeString& text) const; + + /** + * Compare two Unicode strings in code point order. + * The result may be different from the results of compare(), operator<, etc. + * if supplementary characters are present: + * + * In UTF-16, supplementary characters (with code points U+10000 and above) are + * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, + * which means that they compare as less than some other BMP characters like U+feff. + * This function compares Unicode strings in code point order. + * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined. + * + * @param start The start offset in this string at which the compare operation begins. + * @param length The number of code units from this string to compare. + * @param srcText Another string to compare this one to. + * @return a negative/zero/positive integer corresponding to whether + * this string is less than/equal to/greater than the second one + * in code point order + * @stable ICU 2.0 + */ + inline int8_t compareCodePointOrder(int32_t start, + int32_t length, + const UnicodeString& srcText) const; + + /** + * Compare two Unicode strings in code point order. + * The result may be different from the results of compare(), operator<, etc. + * if supplementary characters are present: + * + * In UTF-16, supplementary characters (with code points U+10000 and above) are + * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, + * which means that they compare as less than some other BMP characters like U+feff. + * This function compares Unicode strings in code point order. + * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined. + * + * @param start The start offset in this string at which the compare operation begins. + * @param length The number of code units from this string to compare. + * @param srcText Another string to compare this one to. + * @param srcStart The start offset in that string at which the compare operation begins. + * @param srcLength The number of code units from that string to compare. + * @return a negative/zero/positive integer corresponding to whether + * this string is less than/equal to/greater than the second one + * in code point order + * @stable ICU 2.0 + */ + inline int8_t compareCodePointOrder(int32_t start, + int32_t length, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const; + + /** + * Compare two Unicode strings in code point order. + * The result may be different from the results of compare(), operator<, etc. + * if supplementary characters are present: + * + * In UTF-16, supplementary characters (with code points U+10000 and above) are + * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, + * which means that they compare as less than some other BMP characters like U+feff. + * This function compares Unicode strings in code point order. + * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined. + * + * @param srcChars A pointer to another string to compare this one to. + * @param srcLength The number of code units from that string to compare. + * @return a negative/zero/positive integer corresponding to whether + * this string is less than/equal to/greater than the second one + * in code point order + * @stable ICU 2.0 + */ + inline int8_t compareCodePointOrder(ConstChar16Ptr srcChars, + int32_t srcLength) const; + + /** + * Compare two Unicode strings in code point order. + * The result may be different from the results of compare(), operator<, etc. + * if supplementary characters are present: + * + * In UTF-16, supplementary characters (with code points U+10000 and above) are + * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, + * which means that they compare as less than some other BMP characters like U+feff. + * This function compares Unicode strings in code point order. + * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined. + * + * @param start The start offset in this string at which the compare operation begins. + * @param length The number of code units from this string to compare. + * @param srcChars A pointer to another string to compare this one to. + * @return a negative/zero/positive integer corresponding to whether + * this string is less than/equal to/greater than the second one + * in code point order + * @stable ICU 2.0 + */ + inline int8_t compareCodePointOrder(int32_t start, + int32_t length, + const char16_t *srcChars) const; + + /** + * Compare two Unicode strings in code point order. + * The result may be different from the results of compare(), operator<, etc. + * if supplementary characters are present: + * + * In UTF-16, supplementary characters (with code points U+10000 and above) are + * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, + * which means that they compare as less than some other BMP characters like U+feff. + * This function compares Unicode strings in code point order. + * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined. + * + * @param start The start offset in this string at which the compare operation begins. + * @param length The number of code units from this string to compare. + * @param srcChars A pointer to another string to compare this one to. + * @param srcStart The start offset in that string at which the compare operation begins. + * @param srcLength The number of code units from that string to compare. + * @return a negative/zero/positive integer corresponding to whether + * this string is less than/equal to/greater than the second one + * in code point order + * @stable ICU 2.0 + */ + inline int8_t compareCodePointOrder(int32_t start, + int32_t length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) const; + + /** + * Compare two Unicode strings in code point order. + * The result may be different from the results of compare(), operator<, etc. + * if supplementary characters are present: + * + * In UTF-16, supplementary characters (with code points U+10000 and above) are + * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, + * which means that they compare as less than some other BMP characters like U+feff. + * This function compares Unicode strings in code point order. + * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined. + * + * @param start The start offset in this string at which the compare operation begins. + * @param limit The offset after the last code unit from this string to compare. + * @param srcText Another string to compare this one to. + * @param srcStart The start offset in that string at which the compare operation begins. + * @param srcLimit The offset after the last code unit from that string to compare. + * @return a negative/zero/positive integer corresponding to whether + * this string is less than/equal to/greater than the second one + * in code point order + * @stable ICU 2.0 + */ + inline int8_t compareCodePointOrderBetween(int32_t start, + int32_t limit, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLimit) const; + + /** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to this->foldCase(options).compare(text.foldCase(options)). + * + * @param text Another string to compare this one to. + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @return A negative, zero, or positive integer indicating the comparison result. + * @stable ICU 2.0 + */ + inline int8_t caseCompare(const UnicodeString& text, uint32_t options) const; + + /** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to this->foldCase(options).compare(srcText.foldCase(options)). + * + * @param start The start offset in this string at which the compare operation begins. + * @param length The number of code units from this string to compare. + * @param srcText Another string to compare this one to. + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @return A negative, zero, or positive integer indicating the comparison result. + * @stable ICU 2.0 + */ + inline int8_t caseCompare(int32_t start, + int32_t length, + const UnicodeString& srcText, + uint32_t options) const; + + /** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to this->foldCase(options).compare(srcText.foldCase(options)). + * + * @param start The start offset in this string at which the compare operation begins. + * @param length The number of code units from this string to compare. + * @param srcText Another string to compare this one to. + * @param srcStart The start offset in that string at which the compare operation begins. + * @param srcLength The number of code units from that string to compare. + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @return A negative, zero, or positive integer indicating the comparison result. + * @stable ICU 2.0 + */ + inline int8_t caseCompare(int32_t start, + int32_t length, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength, + uint32_t options) const; + + /** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to this->foldCase(options).compare(srcChars.foldCase(options)). + * + * @param srcChars A pointer to another string to compare this one to. + * @param srcLength The number of code units from that string to compare. + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @return A negative, zero, or positive integer indicating the comparison result. + * @stable ICU 2.0 + */ + inline int8_t caseCompare(ConstChar16Ptr srcChars, + int32_t srcLength, + uint32_t options) const; + + /** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to this->foldCase(options).compare(srcChars.foldCase(options)). + * + * @param start The start offset in this string at which the compare operation begins. + * @param length The number of code units from this string to compare. + * @param srcChars A pointer to another string to compare this one to. + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @return A negative, zero, or positive integer indicating the comparison result. + * @stable ICU 2.0 + */ + inline int8_t caseCompare(int32_t start, + int32_t length, + const char16_t *srcChars, + uint32_t options) const; + + /** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to this->foldCase(options).compare(srcChars.foldCase(options)). + * + * @param start The start offset in this string at which the compare operation begins. + * @param length The number of code units from this string to compare. + * @param srcChars A pointer to another string to compare this one to. + * @param srcStart The start offset in that string at which the compare operation begins. + * @param srcLength The number of code units from that string to compare. + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @return A negative, zero, or positive integer indicating the comparison result. + * @stable ICU 2.0 + */ + inline int8_t caseCompare(int32_t start, + int32_t length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength, + uint32_t options) const; + + /** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to this->foldCase(options).compareBetween(text.foldCase(options)). + * + * @param start The start offset in this string at which the compare operation begins. + * @param limit The offset after the last code unit from this string to compare. + * @param srcText Another string to compare this one to. + * @param srcStart The start offset in that string at which the compare operation begins. + * @param srcLimit The offset after the last code unit from that string to compare. + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @return A negative, zero, or positive integer indicating the comparison result. + * @stable ICU 2.0 + */ + inline int8_t caseCompareBetween(int32_t start, + int32_t limit, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLimit, + uint32_t options) const; + + /** + * Determine if this starts with the characters in text + * @param text The text to match. + * @return TRUE if this starts with the characters in text, + * FALSE otherwise + * @stable ICU 2.0 + */ + inline UBool startsWith(const UnicodeString& text) const; + + /** + * Determine if this starts with the characters in srcText + * in the range [srcStart, srcStart + srcLength). + * @param srcText The text to match. + * @param srcStart the offset into srcText to start matching + * @param srcLength the number of characters in srcText to match + * @return TRUE if this starts with the characters in text, + * FALSE otherwise + * @stable ICU 2.0 + */ + inline UBool startsWith(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const; + + /** + * Determine if this starts with the characters in srcChars + * @param srcChars The characters to match. + * @param srcLength the number of characters in srcChars + * @return TRUE if this starts with the characters in srcChars, + * FALSE otherwise + * @stable ICU 2.0 + */ + inline UBool startsWith(ConstChar16Ptr srcChars, + int32_t srcLength) const; + + /** + * Determine if this ends with the characters in srcChars + * in the range [srcStart, srcStart + srcLength). + * @param srcChars The characters to match. + * @param srcStart the offset into srcText to start matching + * @param srcLength the number of characters in srcChars to match + * @return TRUE if this ends with the characters in srcChars, FALSE otherwise + * @stable ICU 2.0 + */ + inline UBool startsWith(const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) const; + + /** + * Determine if this ends with the characters in text + * @param text The text to match. + * @return TRUE if this ends with the characters in text, + * FALSE otherwise + * @stable ICU 2.0 + */ + inline UBool endsWith(const UnicodeString& text) const; + + /** + * Determine if this ends with the characters in srcText + * in the range [srcStart, srcStart + srcLength). + * @param srcText The text to match. + * @param srcStart the offset into srcText to start matching + * @param srcLength the number of characters in srcText to match + * @return TRUE if this ends with the characters in text, + * FALSE otherwise + * @stable ICU 2.0 + */ + inline UBool endsWith(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const; + + /** + * Determine if this ends with the characters in srcChars + * @param srcChars The characters to match. + * @param srcLength the number of characters in srcChars + * @return TRUE if this ends with the characters in srcChars, + * FALSE otherwise + * @stable ICU 2.0 + */ + inline UBool endsWith(ConstChar16Ptr srcChars, + int32_t srcLength) const; + + /** + * Determine if this ends with the characters in srcChars + * in the range [srcStart, srcStart + srcLength). + * @param srcChars The characters to match. + * @param srcStart the offset into srcText to start matching + * @param srcLength the number of characters in srcChars to match + * @return TRUE if this ends with the characters in srcChars, + * FALSE otherwise + * @stable ICU 2.0 + */ + inline UBool endsWith(const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) const; + + + /* Searching - bitwise only */ + + /** + * Locate in this the first occurrence of the characters in text, + * using bitwise comparison. + * @param text The text to search for. + * @return The offset into this of the start of text, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(const UnicodeString& text) const; + + /** + * Locate in this the first occurrence of the characters in text + * starting at offset start, using bitwise comparison. + * @param text The text to search for. + * @param start The offset at which searching will start. + * @return The offset into this of the start of text, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(const UnicodeString& text, + int32_t start) const; + + /** + * Locate in this the first occurrence in the range + * [start, start + length) of the characters + * in text, using bitwise comparison. + * @param text The text to search for. + * @param start The offset at which searching will start. + * @param length The number of characters to search + * @return The offset into this of the start of text, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(const UnicodeString& text, + int32_t start, + int32_t length) const; + + /** + * Locate in this the first occurrence in the range + * [start, start + length) of the characters + * in srcText in the range + * [srcStart, srcStart + srcLength), + * using bitwise comparison. + * @param srcText The text to search for. + * @param srcStart the offset into srcText at which + * to start matching + * @param srcLength the number of characters in srcText to match + * @param start the offset into this at which to start matching + * @param length the number of characters in this to search + * @return The offset into this of the start of text, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength, + int32_t start, + int32_t length) const; + + /** + * Locate in this the first occurrence of the characters in + * srcChars + * starting at offset start, using bitwise comparison. + * @param srcChars The text to search for. + * @param srcLength the number of characters in srcChars to match + * @param start the offset into this at which to start matching + * @return The offset into this of the start of text, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(const char16_t *srcChars, + int32_t srcLength, + int32_t start) const; + + /** + * Locate in this the first occurrence in the range + * [start, start + length) of the characters + * in srcChars, using bitwise comparison. + * @param srcChars The text to search for. + * @param srcLength the number of characters in srcChars + * @param start The offset at which searching will start. + * @param length The number of characters to search + * @return The offset into this of the start of srcChars, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(ConstChar16Ptr srcChars, + int32_t srcLength, + int32_t start, + int32_t length) const; + + /** + * Locate in this the first occurrence in the range + * [start, start + length) of the characters + * in srcChars in the range + * [srcStart, srcStart + srcLength), + * using bitwise comparison. + * @param srcChars The text to search for. + * @param srcStart the offset into srcChars at which + * to start matching + * @param srcLength the number of characters in srcChars to match + * @param start the offset into this at which to start matching + * @param length the number of characters in this to search + * @return The offset into this of the start of text, + * or -1 if not found. + * @stable ICU 2.0 + */ + int32_t indexOf(const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength, + int32_t start, + int32_t length) const; + + /** + * Locate in this the first occurrence of the BMP code point c, + * using bitwise comparison. + * @param c The code unit to search for. + * @return The offset into this of c, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(char16_t c) const; + + /** + * Locate in this the first occurrence of the code point c, + * using bitwise comparison. + * + * @param c The code point to search for. + * @return The offset into this of c, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(UChar32 c) const; + + /** + * Locate in this the first occurrence of the BMP code point c, + * starting at offset start, using bitwise comparison. + * @param c The code unit to search for. + * @param start The offset at which searching will start. + * @return The offset into this of c, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(char16_t c, + int32_t start) const; + + /** + * Locate in this the first occurrence of the code point c + * starting at offset start, using bitwise comparison. + * + * @param c The code point to search for. + * @param start The offset at which searching will start. + * @return The offset into this of c, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(UChar32 c, + int32_t start) const; + + /** + * Locate in this the first occurrence of the BMP code point c + * in the range [start, start + length), + * using bitwise comparison. + * @param c The code unit to search for. + * @param start the offset into this at which to start matching + * @param length the number of characters in this to search + * @return The offset into this of c, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(char16_t c, + int32_t start, + int32_t length) const; + + /** + * Locate in this the first occurrence of the code point c + * in the range [start, start + length), + * using bitwise comparison. + * + * @param c The code point to search for. + * @param start the offset into this at which to start matching + * @param length the number of characters in this to search + * @return The offset into this of c, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t indexOf(UChar32 c, + int32_t start, + int32_t length) const; + + /** + * Locate in this the last occurrence of the characters in text, + * using bitwise comparison. + * @param text The text to search for. + * @return The offset into this of the start of text, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(const UnicodeString& text) const; + + /** + * Locate in this the last occurrence of the characters in text + * starting at offset start, using bitwise comparison. + * @param text The text to search for. + * @param start The offset at which searching will start. + * @return The offset into this of the start of text, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(const UnicodeString& text, + int32_t start) const; + + /** + * Locate in this the last occurrence in the range + * [start, start + length) of the characters + * in text, using bitwise comparison. + * @param text The text to search for. + * @param start The offset at which searching will start. + * @param length The number of characters to search + * @return The offset into this of the start of text, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(const UnicodeString& text, + int32_t start, + int32_t length) const; + + /** + * Locate in this the last occurrence in the range + * [start, start + length) of the characters + * in srcText in the range + * [srcStart, srcStart + srcLength), + * using bitwise comparison. + * @param srcText The text to search for. + * @param srcStart the offset into srcText at which + * to start matching + * @param srcLength the number of characters in srcText to match + * @param start the offset into this at which to start matching + * @param length the number of characters in this to search + * @return The offset into this of the start of text, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength, + int32_t start, + int32_t length) const; + + /** + * Locate in this the last occurrence of the characters in srcChars + * starting at offset start, using bitwise comparison. + * @param srcChars The text to search for. + * @param srcLength the number of characters in srcChars to match + * @param start the offset into this at which to start matching + * @return The offset into this of the start of text, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(const char16_t *srcChars, + int32_t srcLength, + int32_t start) const; + + /** + * Locate in this the last occurrence in the range + * [start, start + length) of the characters + * in srcChars, using bitwise comparison. + * @param srcChars The text to search for. + * @param srcLength the number of characters in srcChars + * @param start The offset at which searching will start. + * @param length The number of characters to search + * @return The offset into this of the start of srcChars, + * or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(ConstChar16Ptr srcChars, + int32_t srcLength, + int32_t start, + int32_t length) const; + + /** + * Locate in this the last occurrence in the range + * [start, start + length) of the characters + * in srcChars in the range + * [srcStart, srcStart + srcLength), + * using bitwise comparison. + * @param srcChars The text to search for. + * @param srcStart the offset into srcChars at which + * to start matching + * @param srcLength the number of characters in srcChars to match + * @param start the offset into this at which to start matching + * @param length the number of characters in this to search + * @return The offset into this of the start of text, + * or -1 if not found. + * @stable ICU 2.0 + */ + int32_t lastIndexOf(const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength, + int32_t start, + int32_t length) const; + + /** + * Locate in this the last occurrence of the BMP code point c, + * using bitwise comparison. + * @param c The code unit to search for. + * @return The offset into this of c, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(char16_t c) const; + + /** + * Locate in this the last occurrence of the code point c, + * using bitwise comparison. + * + * @param c The code point to search for. + * @return The offset into this of c, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(UChar32 c) const; + + /** + * Locate in this the last occurrence of the BMP code point c + * starting at offset start, using bitwise comparison. + * @param c The code unit to search for. + * @param start The offset at which searching will start. + * @return The offset into this of c, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(char16_t c, + int32_t start) const; + + /** + * Locate in this the last occurrence of the code point c + * starting at offset start, using bitwise comparison. + * + * @param c The code point to search for. + * @param start The offset at which searching will start. + * @return The offset into this of c, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(UChar32 c, + int32_t start) const; + + /** + * Locate in this the last occurrence of the BMP code point c + * in the range [start, start + length), + * using bitwise comparison. + * @param c The code unit to search for. + * @param start the offset into this at which to start matching + * @param length the number of characters in this to search + * @return The offset into this of c, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(char16_t c, + int32_t start, + int32_t length) const; + + /** + * Locate in this the last occurrence of the code point c + * in the range [start, start + length), + * using bitwise comparison. + * + * @param c The code point to search for. + * @param start the offset into this at which to start matching + * @param length the number of characters in this to search + * @return The offset into this of c, or -1 if not found. + * @stable ICU 2.0 + */ + inline int32_t lastIndexOf(UChar32 c, + int32_t start, + int32_t length) const; + + + /* Character access */ + + /** + * Return the code unit at offset offset. + * If the offset is not valid (0..length()-1) then U+ffff is returned. + * @param offset a valid offset into the text + * @return the code unit at offset offset + * or 0xffff if the offset is not valid for this string + * @stable ICU 2.0 + */ + inline char16_t charAt(int32_t offset) const; + + /** + * Return the code unit at offset offset. + * If the offset is not valid (0..length()-1) then U+ffff is returned. + * @param offset a valid offset into the text + * @return the code unit at offset offset + * @stable ICU 2.0 + */ + inline char16_t operator[] (int32_t offset) const; + + /** + * Return the code point that contains the code unit + * at offset offset. + * If the offset is not valid (0..length()-1) then U+ffff is returned. + * @param offset a valid offset into the text + * that indicates the text offset of any of the code units + * that will be assembled into a code point (21-bit value) and returned + * @return the code point of text at offset + * or 0xffff if the offset is not valid for this string + * @stable ICU 2.0 + */ + UChar32 char32At(int32_t offset) const; + + /** + * Adjust a random-access offset so that + * it points to the beginning of a Unicode character. + * The offset that is passed in points to + * any code unit of a code point, + * while the returned offset will point to the first code unit + * of the same code point. + * In UTF-16, if the input offset points to a second surrogate + * of a surrogate pair, then the returned offset will point + * to the first surrogate. + * @param offset a valid offset into one code point of the text + * @return offset of the first code unit of the same code point + * @see U16_SET_CP_START + * @stable ICU 2.0 + */ + int32_t getChar32Start(int32_t offset) const; + + /** + * Adjust a random-access offset so that + * it points behind a Unicode character. + * The offset that is passed in points behind + * any code unit of a code point, + * while the returned offset will point behind the last code unit + * of the same code point. + * In UTF-16, if the input offset points behind the first surrogate + * (i.e., to the second surrogate) + * of a surrogate pair, then the returned offset will point + * behind the second surrogate (i.e., to the first surrogate). + * @param offset a valid offset after any code unit of a code point of the text + * @return offset of the first code unit after the same code point + * @see U16_SET_CP_LIMIT + * @stable ICU 2.0 + */ + int32_t getChar32Limit(int32_t offset) const; + + /** + * Move the code unit index along the string by delta code points. + * Interpret the input index as a code unit-based offset into the string, + * move the index forward or backward by delta code points, and + * return the resulting index. + * The input index should point to the first code unit of a code point, + * if there is more than one. + * + * Both input and output indexes are code unit-based as for all + * string indexes/offsets in ICU (and other libraries, like MBCS char*). + * If delta<0 then the index is moved backward (toward the start of the string). + * If delta>0 then the index is moved forward (toward the end of the string). + * + * This behaves like CharacterIterator::move32(delta, kCurrent). + * + * Behavior for out-of-bounds indexes: + * moveIndex32 pins the input index to 0..length(), i.e., + * if the input index<0 then it is pinned to 0; + * if it is index>length() then it is pinned to length(). + * Afterwards, the index is moved by delta code points + * forward or backward, + * but no further backward than to 0 and no further forward than to length(). + * The resulting index return value will be in between 0 and length(), inclusively. + * + * Examples: + *
+   * // s has code points 'a' U+10000 'b' U+10ffff U+2029
+   * UnicodeString s=UNICODE_STRING("a\\U00010000b\\U0010ffff\\u2029", 31).unescape();
+   *
+   * // initial index: position of U+10000
+   * int32_t index=1;
+   *
+   * // the following examples will all result in index==4, position of U+10ffff
+   *
+   * // skip 2 code points from some position in the string
+   * index=s.moveIndex32(index, 2); // skips U+10000 and 'b'
+   *
+   * // go to the 3rd code point from the start of s (0-based)
+   * index=s.moveIndex32(0, 3); // skips 'a', U+10000, and 'b'
+   *
+   * // go to the next-to-last code point of s
+   * index=s.moveIndex32(s.length(), -2); // backward-skips U+2029 and U+10ffff
+   * 
+ * + * @param index input code unit index + * @param delta (signed) code point count to move the index forward or backward + * in the string + * @return the resulting code unit index + * @stable ICU 2.0 + */ + int32_t moveIndex32(int32_t index, int32_t delta) const; + + /* Substring extraction */ + + /** + * Copy the characters in the range + * [start, start + length) into the array dst, + * beginning at dstStart. + * If the string aliases to dst itself as an external buffer, + * then extract() will not copy the contents. + * + * @param start offset of first character which will be copied into the array + * @param length the number of characters to extract + * @param dst array in which to copy characters. The length of dst + * must be at least (dstStart + length). + * @param dstStart the offset in dst where the first character + * will be extracted + * @stable ICU 2.0 + */ + inline void extract(int32_t start, + int32_t length, + Char16Ptr dst, + int32_t dstStart = 0) const; + + /** + * Copy the contents of the string into dest. + * This is a convenience function that + * checks if there is enough space in dest, + * extracts the entire string if possible, + * and NUL-terminates dest if possible. + * + * If the string fits into dest but cannot be NUL-terminated + * (length()==destCapacity) then the error code is set to U_STRING_NOT_TERMINATED_WARNING. + * If the string itself does not fit into dest + * (length()>destCapacity) then the error code is set to U_BUFFER_OVERFLOW_ERROR. + * + * If the string aliases to dest itself as an external buffer, + * then extract() will not copy the contents. + * + * @param dest Destination string buffer. + * @param destCapacity Number of char16_ts available at dest. + * @param errorCode ICU error code. + * @return length() + * @stable ICU 2.0 + */ + int32_t + extract(Char16Ptr dest, int32_t destCapacity, + UErrorCode &errorCode) const; + + /** + * Copy the characters in the range + * [start, start + length) into the UnicodeString + * target. + * @param start offset of first character which will be copied + * @param length the number of characters to extract + * @param target UnicodeString into which to copy characters. + * @return A reference to target + * @stable ICU 2.0 + */ + inline void extract(int32_t start, + int32_t length, + UnicodeString& target) const; + + /** + * Copy the characters in the range [start, limit) + * into the array dst, beginning at dstStart. + * @param start offset of first character which will be copied into the array + * @param limit offset immediately following the last character to be copied + * @param dst array in which to copy characters. The length of dst + * must be at least (dstStart + (limit - start)). + * @param dstStart the offset in dst where the first character + * will be extracted + * @stable ICU 2.0 + */ + inline void extractBetween(int32_t start, + int32_t limit, + char16_t *dst, + int32_t dstStart = 0) const; + + /** + * Copy the characters in the range [start, limit) + * into the UnicodeString target. Replaceable API. + * @param start offset of first character which will be copied + * @param limit offset immediately following the last character to be copied + * @param target UnicodeString into which to copy characters. + * @return A reference to target + * @stable ICU 2.0 + */ + virtual void extractBetween(int32_t start, + int32_t limit, + UnicodeString& target) const; + + /** + * Copy the characters in the range + * [start, start + startLength) into an array of characters. + * All characters must be invariant (see utypes.h). + * Use US_INV as the last, signature-distinguishing parameter. + * + * This function does not write any more than targetCapacity + * characters but returns the length of the entire output string + * so that one can allocate a larger buffer and call the function again + * if necessary. + * The output string is NUL-terminated if possible. + * + * @param start offset of first character which will be copied + * @param startLength the number of characters to extract + * @param target the target buffer for extraction, can be NULL + * if targetLength is 0 + * @param targetCapacity the length of the target buffer + * @param inv Signature-distinguishing paramater, use US_INV. + * @return the output string length, not including the terminating NUL + * @stable ICU 3.2 + */ + int32_t extract(int32_t start, + int32_t startLength, + char *target, + int32_t targetCapacity, + enum EInvariant inv) const; + +#if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION + + /** + * Copy the characters in the range + * [start, start + length) into an array of characters + * in the platform's default codepage. + * This function does not write any more than targetLength + * characters but returns the length of the entire output string + * so that one can allocate a larger buffer and call the function again + * if necessary. + * The output string is NUL-terminated if possible. + * + * @param start offset of first character which will be copied + * @param startLength the number of characters to extract + * @param target the target buffer for extraction + * @param targetLength the length of the target buffer + * If target is NULL, then the number of bytes required for + * target is returned. + * @return the output string length, not including the terminating NUL + * @stable ICU 2.0 + */ + int32_t extract(int32_t start, + int32_t startLength, + char *target, + uint32_t targetLength) const; + +#endif + +#if !UCONFIG_NO_CONVERSION + + /** + * Copy the characters in the range + * [start, start + length) into an array of characters + * in a specified codepage. + * The output string is NUL-terminated. + * + * Recommendation: For invariant-character strings use + * extract(int32_t start, int32_t length, char *target, int32_t targetCapacity, enum EInvariant inv) const + * because it avoids object code dependencies of UnicodeString on + * the conversion code. + * + * @param start offset of first character which will be copied + * @param startLength the number of characters to extract + * @param target the target buffer for extraction + * @param codepage the desired codepage for the characters. 0 has + * the special meaning of the default codepage + * If codepage is an empty string (""), + * then a simple conversion is performed on the codepage-invariant + * subset ("invariant characters") of the platform encoding. See utypes.h. + * If target is NULL, then the number of bytes required for + * target is returned. It is assumed that the target is big enough + * to fit all of the characters. + * @return the output string length, not including the terminating NUL + * @stable ICU 2.0 + */ + inline int32_t extract(int32_t start, + int32_t startLength, + char *target, + const char *codepage = 0) const; + + /** + * Copy the characters in the range + * [start, start + length) into an array of characters + * in a specified codepage. + * This function does not write any more than targetLength + * characters but returns the length of the entire output string + * so that one can allocate a larger buffer and call the function again + * if necessary. + * The output string is NUL-terminated if possible. + * + * Recommendation: For invariant-character strings use + * extract(int32_t start, int32_t length, char *target, int32_t targetCapacity, enum EInvariant inv) const + * because it avoids object code dependencies of UnicodeString on + * the conversion code. + * + * @param start offset of first character which will be copied + * @param startLength the number of characters to extract + * @param target the target buffer for extraction + * @param targetLength the length of the target buffer + * @param codepage the desired codepage for the characters. 0 has + * the special meaning of the default codepage + * If codepage is an empty string (""), + * then a simple conversion is performed on the codepage-invariant + * subset ("invariant characters") of the platform encoding. See utypes.h. + * If target is NULL, then the number of bytes required for + * target is returned. + * @return the output string length, not including the terminating NUL + * @stable ICU 2.0 + */ + int32_t extract(int32_t start, + int32_t startLength, + char *target, + uint32_t targetLength, + const char *codepage) const; + + /** + * Convert the UnicodeString into a codepage string using an existing UConverter. + * The output string is NUL-terminated if possible. + * + * This function avoids the overhead of opening and closing a converter if + * multiple strings are extracted. + * + * @param dest destination string buffer, can be NULL if destCapacity==0 + * @param destCapacity the number of chars available at dest + * @param cnv the converter object to be used (ucnv_resetFromUnicode() will be called), + * or NULL for the default converter + * @param errorCode normal ICU error code + * @return the length of the output string, not counting the terminating NUL; + * if the length is greater than destCapacity, then the string will not fit + * and a buffer of the indicated length would need to be passed in + * @stable ICU 2.0 + */ + int32_t extract(char *dest, int32_t destCapacity, + UConverter *cnv, + UErrorCode &errorCode) const; + +#endif + + /** + * Create a temporary substring for the specified range. + * Unlike the substring constructor and setTo() functions, + * the object returned here will be a read-only alias (using getBuffer()) + * rather than copying the text. + * As a result, this substring operation is much faster but requires + * that the original string not be modified or deleted during the lifetime + * of the returned substring object. + * @param start offset of the first character visible in the substring + * @param length length of the substring + * @return a read-only alias UnicodeString object for the substring + * @stable ICU 4.4 + */ + UnicodeString tempSubString(int32_t start=0, int32_t length=INT32_MAX) const; + + /** + * Create a temporary substring for the specified range. + * Same as tempSubString(start, length) except that the substring range + * is specified as a (start, limit) pair (with an exclusive limit index) + * rather than a (start, length) pair. + * @param start offset of the first character visible in the substring + * @param limit offset immediately following the last character visible in the substring + * @return a read-only alias UnicodeString object for the substring + * @stable ICU 4.4 + */ + inline UnicodeString tempSubStringBetween(int32_t start, int32_t limit=INT32_MAX) const; + + /** + * Convert the UnicodeString to UTF-8 and write the result + * to a ByteSink. This is called by toUTF8String(). + * Unpaired surrogates are replaced with U+FFFD. + * Calls u_strToUTF8WithSub(). + * + * @param sink A ByteSink to which the UTF-8 version of the string is written. + * sink.Flush() is called at the end. + * @stable ICU 4.2 + * @see toUTF8String + */ + void toUTF8(ByteSink &sink) const; + + /** + * Convert the UnicodeString to UTF-8 and append the result + * to a standard string. + * Unpaired surrogates are replaced with U+FFFD. + * Calls toUTF8(). + * + * @param result A standard string (or a compatible object) + * to which the UTF-8 version of the string is appended. + * @return The string object. + * @stable ICU 4.2 + * @see toUTF8 + */ + template + StringClass &toUTF8String(StringClass &result) const { + StringByteSink sbs(&result, length()); + toUTF8(sbs); + return result; + } + + /** + * Convert the UnicodeString to UTF-32. + * Unpaired surrogates are replaced with U+FFFD. + * Calls u_strToUTF32WithSub(). + * + * @param utf32 destination string buffer, can be NULL if capacity==0 + * @param capacity the number of UChar32s available at utf32 + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The length of the UTF-32 string. + * @see fromUTF32 + * @stable ICU 4.2 + */ + int32_t toUTF32(UChar32 *utf32, int32_t capacity, UErrorCode &errorCode) const; + + /* Length operations */ + + /** + * Return the length of the UnicodeString object. + * The length is the number of char16_t code units are in the UnicodeString. + * If you want the number of code points, please use countChar32(). + * @return the length of the UnicodeString object + * @see countChar32 + * @stable ICU 2.0 + */ + inline int32_t length(void) const; + + /** + * Count Unicode code points in the length char16_t code units of the string. + * A code point may occupy either one or two char16_t code units. + * Counting code points involves reading all code units. + * + * This functions is basically the inverse of moveIndex32(). + * + * @param start the index of the first code unit to check + * @param length the number of char16_t code units to check + * @return the number of code points in the specified code units + * @see length + * @stable ICU 2.0 + */ + int32_t + countChar32(int32_t start=0, int32_t length=INT32_MAX) const; + + /** + * Check if the length char16_t code units of the string + * contain more Unicode code points than a certain number. + * This is more efficient than counting all code points in this part of the string + * and comparing that number with a threshold. + * This function may not need to scan the string at all if the length + * falls within a certain range, and + * never needs to count more than 'number+1' code points. + * Logically equivalent to (countChar32(start, length)>number). + * A Unicode code point may occupy either one or two char16_t code units. + * + * @param start the index of the first code unit to check (0 for the entire string) + * @param length the number of char16_t code units to check + * (use INT32_MAX for the entire string; remember that start/length + * values are pinned) + * @param number The number of code points in the (sub)string is compared against + * the 'number' parameter. + * @return Boolean value for whether the string contains more Unicode code points + * than 'number'. Same as (u_countChar32(s, length)>number). + * @see countChar32 + * @see u_strHasMoreChar32Than + * @stable ICU 2.4 + */ + UBool + hasMoreChar32Than(int32_t start, int32_t length, int32_t number) const; + + /** + * Determine if this string is empty. + * @return TRUE if this string contains 0 characters, FALSE otherwise. + * @stable ICU 2.0 + */ + inline UBool isEmpty(void) const; + + /** + * Return the capacity of the internal buffer of the UnicodeString object. + * This is useful together with the getBuffer functions. + * See there for details. + * + * @return the number of char16_ts available in the internal buffer + * @see getBuffer + * @stable ICU 2.0 + */ + inline int32_t getCapacity(void) const; + + /* Other operations */ + + /** + * Generate a hash code for this object. + * @return The hash code of this UnicodeString. + * @stable ICU 2.0 + */ + inline int32_t hashCode(void) const; + + /** + * Determine if this object contains a valid string. + * A bogus string has no value. It is different from an empty string, + * although in both cases isEmpty() returns TRUE and length() returns 0. + * setToBogus() and isBogus() can be used to indicate that no string value is available. + * For a bogus string, getBuffer() and getTerminatedBuffer() return NULL, and + * length() returns 0. + * + * @return TRUE if the string is bogus/invalid, FALSE otherwise + * @see setToBogus() + * @stable ICU 2.0 + */ + inline UBool isBogus(void) const; + + + //======================================== + // Write operations + //======================================== + + /* Assignment operations */ + + /** + * Assignment operator. Replace the characters in this UnicodeString + * with the characters from srcText. + * + * Starting with ICU 2.4, the assignment operator and the copy constructor + * allocate a new buffer and copy the buffer contents even for readonly aliases. + * By contrast, the fastCopyFrom() function implements the old, + * more efficient but less safe behavior + * of making this string also a readonly alias to the same buffer. + * + * If the source object has an "open" buffer from getBuffer(minCapacity), + * then the copy is an empty string. + * + * @param srcText The text containing the characters to replace + * @return a reference to this + * @stable ICU 2.0 + * @see fastCopyFrom + */ + UnicodeString &operator=(const UnicodeString &srcText); + + /** + * Almost the same as the assignment operator. + * Replace the characters in this UnicodeString + * with the characters from srcText. + * + * This function works the same as the assignment operator + * for all strings except for ones that are readonly aliases. + * + * Starting with ICU 2.4, the assignment operator and the copy constructor + * allocate a new buffer and copy the buffer contents even for readonly aliases. + * This function implements the old, more efficient but less safe behavior + * of making this string also a readonly alias to the same buffer. + * + * The fastCopyFrom function must be used only if it is known that the lifetime of + * this UnicodeString does not exceed the lifetime of the aliased buffer + * including its contents, for example for strings from resource bundles + * or aliases to string constants. + * + * If the source object has an "open" buffer from getBuffer(minCapacity), + * then the copy is an empty string. + * + * @param src The text containing the characters to replace. + * @return a reference to this + * @stable ICU 2.4 + */ + UnicodeString &fastCopyFrom(const UnicodeString &src); + + /** + * Move assignment operator, might leave src in bogus state. + * This string will have the same contents and state that the source string had. + * The behavior is undefined if *this and src are the same object. + * @param src source string + * @return *this + * @stable ICU 56 + */ + UnicodeString &operator=(UnicodeString &&src) U_NOEXCEPT { + return moveFrom(src); + } + + // do not use #ifndef U_HIDE_DRAFT_API for moveFrom, needed by non-draft API + /** + * Move assignment, might leave src in bogus state. + * This string will have the same contents and state that the source string had. + * The behavior is undefined if *this and src are the same object. + * + * Can be called explicitly, does not need C++11 support. + * @param src source string + * @return *this + * @draft ICU 56 + */ + UnicodeString &moveFrom(UnicodeString &src) U_NOEXCEPT; + + /** + * Swap strings. + * @param other other string + * @stable ICU 56 + */ + void swap(UnicodeString &other) U_NOEXCEPT; + + /** + * Non-member UnicodeString swap function. + * @param s1 will get s2's contents and state + * @param s2 will get s1's contents and state + * @stable ICU 56 + */ + friend U_COMMON_API inline void U_EXPORT2 + swap(UnicodeString &s1, UnicodeString &s2) U_NOEXCEPT { + s1.swap(s2); + } + + /** + * Assignment operator. Replace the characters in this UnicodeString + * with the code unit ch. + * @param ch the code unit to replace + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& operator= (char16_t ch); + + /** + * Assignment operator. Replace the characters in this UnicodeString + * with the code point ch. + * @param ch the code point to replace + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& operator= (UChar32 ch); + + /** + * Set the text in the UnicodeString object to the characters + * in srcText in the range + * [srcStart, srcText.length()). + * srcText is not modified. + * @param srcText the source for the new characters + * @param srcStart the offset into srcText where new characters + * will be obtained + * @return a reference to this + * @stable ICU 2.2 + */ + inline UnicodeString& setTo(const UnicodeString& srcText, + int32_t srcStart); + + /** + * Set the text in the UnicodeString object to the characters + * in srcText in the range + * [srcStart, srcStart + srcLength). + * srcText is not modified. + * @param srcText the source for the new characters + * @param srcStart the offset into srcText where new characters + * will be obtained + * @param srcLength the number of characters in srcText in the + * replace string. + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& setTo(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength); + + /** + * Set the text in the UnicodeString object to the characters in + * srcText. + * srcText is not modified. + * @param srcText the source for the new characters + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& setTo(const UnicodeString& srcText); + + /** + * Set the characters in the UnicodeString object to the characters + * in srcChars. srcChars is not modified. + * @param srcChars the source for the new characters + * @param srcLength the number of Unicode characters in srcChars. + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& setTo(const char16_t *srcChars, + int32_t srcLength); + + /** + * Set the characters in the UnicodeString object to the code unit + * srcChar. + * @param srcChar the code unit which becomes the UnicodeString's character + * content + * @return a reference to this + * @stable ICU 2.0 + */ + UnicodeString& setTo(char16_t srcChar); + + /** + * Set the characters in the UnicodeString object to the code point + * srcChar. + * @param srcChar the code point which becomes the UnicodeString's character + * content + * @return a reference to this + * @stable ICU 2.0 + */ + UnicodeString& setTo(UChar32 srcChar); + + /** + * Aliasing setTo() function, analogous to the readonly-aliasing char16_t* constructor. + * The text will be used for the UnicodeString object, but + * it will not be released when the UnicodeString is destroyed. + * This has copy-on-write semantics: + * When the string is modified, then the buffer is first copied into + * newly allocated memory. + * The aliased buffer is never modified. + * + * In an assignment to another UnicodeString, when using the copy constructor + * or the assignment operator, the text will be copied. + * When using fastCopyFrom(), the text will be aliased again, + * so that both strings then alias the same readonly-text. + * + * @param isTerminated specifies if text is NUL-terminated. + * This must be true if textLength==-1. + * @param text The characters to alias for the UnicodeString. + * @param textLength The number of Unicode characters in text to alias. + * If -1, then this constructor will determine the length + * by calling u_strlen(). + * @return a reference to this + * @stable ICU 2.0 + */ + UnicodeString &setTo(UBool isTerminated, + ConstChar16Ptr text, + int32_t textLength); + + /** + * Aliasing setTo() function, analogous to the writable-aliasing char16_t* constructor. + * The text will be used for the UnicodeString object, but + * it will not be released when the UnicodeString is destroyed. + * This has write-through semantics: + * For as long as the capacity of the buffer is sufficient, write operations + * will directly affect the buffer. When more capacity is necessary, then + * a new buffer will be allocated and the contents copied as with regularly + * constructed strings. + * In an assignment to another UnicodeString, the buffer will be copied. + * The extract(Char16Ptr dst) function detects whether the dst pointer is the same + * as the string buffer itself and will in this case not copy the contents. + * + * @param buffer The characters to alias for the UnicodeString. + * @param buffLength The number of Unicode characters in buffer to alias. + * @param buffCapacity The size of buffer in char16_ts. + * @return a reference to this + * @stable ICU 2.0 + */ + UnicodeString &setTo(char16_t *buffer, + int32_t buffLength, + int32_t buffCapacity); + + /** + * Make this UnicodeString object invalid. + * The string will test TRUE with isBogus(). + * + * A bogus string has no value. It is different from an empty string. + * It can be used to indicate that no string value is available. + * getBuffer() and getTerminatedBuffer() return NULL, and + * length() returns 0. + * + * This utility function is used throughout the UnicodeString + * implementation to indicate that a UnicodeString operation failed, + * and may be used in other functions, + * especially but not exclusively when such functions do not + * take a UErrorCode for simplicity. + * + * The following methods, and no others, will clear a string object's bogus flag: + * - remove() + * - remove(0, INT32_MAX) + * - truncate(0) + * - operator=() (assignment operator) + * - setTo(...) + * + * The simplest ways to turn a bogus string into an empty one + * is to use the remove() function. + * Examples for other functions that are equivalent to "set to empty string": + * \code + * if(s.isBogus()) { + * s.remove(); // set to an empty string (remove all), or + * s.remove(0, INT32_MAX); // set to an empty string (remove all), or + * s.truncate(0); // set to an empty string (complete truncation), or + * s=UnicodeString(); // assign an empty string, or + * s.setTo((UChar32)-1); // set to a pseudo code point that is out of range, or + * static const char16_t nul=0; + * s.setTo(&nul, 0); // set to an empty C Unicode string + * } + * \endcode + * + * @see isBogus() + * @stable ICU 2.0 + */ + void setToBogus(); + + /** + * Set the character at the specified offset to the specified character. + * @param offset A valid offset into the text of the character to set + * @param ch The new character + * @return A reference to this + * @stable ICU 2.0 + */ + UnicodeString& setCharAt(int32_t offset, + char16_t ch); + + + /* Append operations */ + + /** + * Append operator. Append the code unit ch to the UnicodeString + * object. + * @param ch the code unit to be appended + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& operator+= (char16_t ch); + + /** + * Append operator. Append the code point ch to the UnicodeString + * object. + * @param ch the code point to be appended + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& operator+= (UChar32 ch); + + /** + * Append operator. Append the characters in srcText to the + * UnicodeString object. srcText is not modified. + * @param srcText the source for the new characters + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& operator+= (const UnicodeString& srcText); + + /** + * Append the characters + * in srcText in the range + * [srcStart, srcStart + srcLength) to the + * UnicodeString object at offset start. srcText + * is not modified. + * @param srcText the source for the new characters + * @param srcStart the offset into srcText where new characters + * will be obtained + * @param srcLength the number of characters in srcText in + * the append string + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& append(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength); + + /** + * Append the characters in srcText to the UnicodeString object. + * srcText is not modified. + * @param srcText the source for the new characters + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& append(const UnicodeString& srcText); + + /** + * Append the characters in srcChars in the range + * [srcStart, srcStart + srcLength) to the UnicodeString + * object at offset + * start. srcChars is not modified. + * @param srcChars the source for the new characters + * @param srcStart the offset into srcChars where new characters + * will be obtained + * @param srcLength the number of characters in srcChars in + * the append string; can be -1 if srcChars is NUL-terminated + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& append(const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength); + + /** + * Append the characters in srcChars to the UnicodeString object + * at offset start. srcChars is not modified. + * @param srcChars the source for the new characters + * @param srcLength the number of Unicode characters in srcChars; + * can be -1 if srcChars is NUL-terminated + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& append(ConstChar16Ptr srcChars, + int32_t srcLength); + + /** + * Append the code unit srcChar to the UnicodeString object. + * @param srcChar the code unit to append + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& append(char16_t srcChar); + + /** + * Append the code point srcChar to the UnicodeString object. + * @param srcChar the code point to append + * @return a reference to this + * @stable ICU 2.0 + */ + UnicodeString& append(UChar32 srcChar); + + + /* Insert operations */ + + /** + * Insert the characters in srcText in the range + * [srcStart, srcStart + srcLength) into the UnicodeString + * object at offset start. srcText is not modified. + * @param start the offset where the insertion begins + * @param srcText the source for the new characters + * @param srcStart the offset into srcText where new characters + * will be obtained + * @param srcLength the number of characters in srcText in + * the insert string + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& insert(int32_t start, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength); + + /** + * Insert the characters in srcText into the UnicodeString object + * at offset start. srcText is not modified. + * @param start the offset where the insertion begins + * @param srcText the source for the new characters + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& insert(int32_t start, + const UnicodeString& srcText); + + /** + * Insert the characters in srcChars in the range + * [srcStart, srcStart + srcLength) into the UnicodeString + * object at offset start. srcChars is not modified. + * @param start the offset at which the insertion begins + * @param srcChars the source for the new characters + * @param srcStart the offset into srcChars where new characters + * will be obtained + * @param srcLength the number of characters in srcChars + * in the insert string + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& insert(int32_t start, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength); + + /** + * Insert the characters in srcChars into the UnicodeString object + * at offset start. srcChars is not modified. + * @param start the offset where the insertion begins + * @param srcChars the source for the new characters + * @param srcLength the number of Unicode characters in srcChars. + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& insert(int32_t start, + ConstChar16Ptr srcChars, + int32_t srcLength); + + /** + * Insert the code unit srcChar into the UnicodeString object at + * offset start. + * @param start the offset at which the insertion occurs + * @param srcChar the code unit to insert + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& insert(int32_t start, + char16_t srcChar); + + /** + * Insert the code point srcChar into the UnicodeString object at + * offset start. + * @param start the offset at which the insertion occurs + * @param srcChar the code point to insert + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& insert(int32_t start, + UChar32 srcChar); + + + /* Replace operations */ + + /** + * Replace the characters in the range + * [start, start + length) with the characters in + * srcText in the range + * [srcStart, srcStart + srcLength). + * srcText is not modified. + * @param start the offset at which the replace operation begins + * @param length the number of characters to replace. The character at + * start + length is not modified. + * @param srcText the source for the new characters + * @param srcStart the offset into srcText where new characters + * will be obtained + * @param srcLength the number of characters in srcText in + * the replace string + * @return a reference to this + * @stable ICU 2.0 + */ + UnicodeString& replace(int32_t start, + int32_t length, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength); + + /** + * Replace the characters in the range + * [start, start + length) + * with the characters in srcText. srcText is + * not modified. + * @param start the offset at which the replace operation begins + * @param length the number of characters to replace. The character at + * start + length is not modified. + * @param srcText the source for the new characters + * @return a reference to this + * @stable ICU 2.0 + */ + UnicodeString& replace(int32_t start, + int32_t length, + const UnicodeString& srcText); + + /** + * Replace the characters in the range + * [start, start + length) with the characters in + * srcChars in the range + * [srcStart, srcStart + srcLength). srcChars + * is not modified. + * @param start the offset at which the replace operation begins + * @param length the number of characters to replace. The character at + * start + length is not modified. + * @param srcChars the source for the new characters + * @param srcStart the offset into srcChars where new characters + * will be obtained + * @param srcLength the number of characters in srcChars + * in the replace string + * @return a reference to this + * @stable ICU 2.0 + */ + UnicodeString& replace(int32_t start, + int32_t length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength); + + /** + * Replace the characters in the range + * [start, start + length) with the characters in + * srcChars. srcChars is not modified. + * @param start the offset at which the replace operation begins + * @param length number of characters to replace. The character at + * start + length is not modified. + * @param srcChars the source for the new characters + * @param srcLength the number of Unicode characters in srcChars + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& replace(int32_t start, + int32_t length, + ConstChar16Ptr srcChars, + int32_t srcLength); + + /** + * Replace the characters in the range + * [start, start + length) with the code unit + * srcChar. + * @param start the offset at which the replace operation begins + * @param length the number of characters to replace. The character at + * start + length is not modified. + * @param srcChar the new code unit + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& replace(int32_t start, + int32_t length, + char16_t srcChar); + + /** + * Replace the characters in the range + * [start, start + length) with the code point + * srcChar. + * @param start the offset at which the replace operation begins + * @param length the number of characters to replace. The character at + * start + length is not modified. + * @param srcChar the new code point + * @return a reference to this + * @stable ICU 2.0 + */ + UnicodeString& replace(int32_t start, int32_t length, UChar32 srcChar); + + /** + * Replace the characters in the range [start, limit) + * with the characters in srcText. srcText is not modified. + * @param start the offset at which the replace operation begins + * @param limit the offset immediately following the replace range + * @param srcText the source for the new characters + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& replaceBetween(int32_t start, + int32_t limit, + const UnicodeString& srcText); + + /** + * Replace the characters in the range [start, limit) + * with the characters in srcText in the range + * [srcStart, srcLimit). srcText is not modified. + * @param start the offset at which the replace operation begins + * @param limit the offset immediately following the replace range + * @param srcText the source for the new characters + * @param srcStart the offset into srcChars where new characters + * will be obtained + * @param srcLimit the offset immediately following the range to copy + * in srcText + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& replaceBetween(int32_t start, + int32_t limit, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLimit); + + /** + * Replace a substring of this object with the given text. + * @param start the beginning index, inclusive; 0 <= start + * <= limit. + * @param limit the ending index, exclusive; start <= limit + * <= length(). + * @param text the text to replace characters start + * to limit - 1 + * @stable ICU 2.0 + */ + virtual void handleReplaceBetween(int32_t start, + int32_t limit, + const UnicodeString& text); + + /** + * Replaceable API + * @return TRUE if it has MetaData + * @stable ICU 2.4 + */ + virtual UBool hasMetaData() const; + + /** + * Copy a substring of this object, retaining attribute (out-of-band) + * information. This method is used to duplicate or reorder substrings. + * The destination index must not overlap the source range. + * + * @param start the beginning index, inclusive; 0 <= start <= + * limit. + * @param limit the ending index, exclusive; start <= limit <= + * length(). + * @param dest the destination index. The characters from + * start..limit-1 will be copied to dest. + * Implementations of this method may assume that dest <= start || + * dest >= limit. + * @stable ICU 2.0 + */ + virtual void copy(int32_t start, int32_t limit, int32_t dest); + + /* Search and replace operations */ + + /** + * Replace all occurrences of characters in oldText with the characters + * in newText + * @param oldText the text containing the search text + * @param newText the text containing the replacement text + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& findAndReplace(const UnicodeString& oldText, + const UnicodeString& newText); + + /** + * Replace all occurrences of characters in oldText with characters + * in newText + * in the range [start, start + length). + * @param start the start of the range in which replace will performed + * @param length the length of the range in which replace will be performed + * @param oldText the text containing the search text + * @param newText the text containing the replacement text + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& findAndReplace(int32_t start, + int32_t length, + const UnicodeString& oldText, + const UnicodeString& newText); + + /** + * Replace all occurrences of characters in oldText in the range + * [oldStart, oldStart + oldLength) with the characters + * in newText in the range + * [newStart, newStart + newLength) + * in the range [start, start + length). + * @param start the start of the range in which replace will performed + * @param length the length of the range in which replace will be performed + * @param oldText the text containing the search text + * @param oldStart the start of the search range in oldText + * @param oldLength the length of the search range in oldText + * @param newText the text containing the replacement text + * @param newStart the start of the replacement range in newText + * @param newLength the length of the replacement range in newText + * @return a reference to this + * @stable ICU 2.0 + */ + UnicodeString& findAndReplace(int32_t start, + int32_t length, + const UnicodeString& oldText, + int32_t oldStart, + int32_t oldLength, + const UnicodeString& newText, + int32_t newStart, + int32_t newLength); + + + /* Remove operations */ + + /** + * Remove all characters from the UnicodeString object. + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& remove(void); + + /** + * Remove the characters in the range + * [start, start + length) from the UnicodeString object. + * @param start the offset of the first character to remove + * @param length the number of characters to remove + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& remove(int32_t start, + int32_t length = (int32_t)INT32_MAX); + + /** + * Remove the characters in the range + * [start, limit) from the UnicodeString object. + * @param start the offset of the first character to remove + * @param limit the offset immediately following the range to remove + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& removeBetween(int32_t start, + int32_t limit = (int32_t)INT32_MAX); + + /** + * Retain only the characters in the range + * [start, limit) from the UnicodeString object. + * Removes characters before start and at and after limit. + * @param start the offset of the first character to retain + * @param limit the offset immediately following the range to retain + * @return a reference to this + * @stable ICU 4.4 + */ + inline UnicodeString &retainBetween(int32_t start, int32_t limit = INT32_MAX); + + /* Length operations */ + + /** + * Pad the start of this UnicodeString with the character padChar. + * If the length of this UnicodeString is less than targetLength, + * length() - targetLength copies of padChar will be added to the + * beginning of this UnicodeString. + * @param targetLength the desired length of the string + * @param padChar the character to use for padding. Defaults to + * space (U+0020) + * @return TRUE if the text was padded, FALSE otherwise. + * @stable ICU 2.0 + */ + UBool padLeading(int32_t targetLength, + char16_t padChar = 0x0020); + + /** + * Pad the end of this UnicodeString with the character padChar. + * If the length of this UnicodeString is less than targetLength, + * length() - targetLength copies of padChar will be added to the + * end of this UnicodeString. + * @param targetLength the desired length of the string + * @param padChar the character to use for padding. Defaults to + * space (U+0020) + * @return TRUE if the text was padded, FALSE otherwise. + * @stable ICU 2.0 + */ + UBool padTrailing(int32_t targetLength, + char16_t padChar = 0x0020); + + /** + * Truncate this UnicodeString to the targetLength. + * @param targetLength the desired length of this UnicodeString. + * @return TRUE if the text was truncated, FALSE otherwise + * @stable ICU 2.0 + */ + inline UBool truncate(int32_t targetLength); + + /** + * Trims leading and trailing whitespace from this UnicodeString. + * @return a reference to this + * @stable ICU 2.0 + */ + UnicodeString& trim(void); + + + /* Miscellaneous operations */ + + /** + * Reverse this UnicodeString in place. + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& reverse(void); + + /** + * Reverse the range [start, start + length) in + * this UnicodeString. + * @param start the start of the range to reverse + * @param length the number of characters to to reverse + * @return a reference to this + * @stable ICU 2.0 + */ + inline UnicodeString& reverse(int32_t start, + int32_t length); + + /** + * Convert the characters in this to UPPER CASE following the conventions of + * the default locale. + * @return A reference to this. + * @stable ICU 2.0 + */ + UnicodeString& toUpper(void); + + /** + * Convert the characters in this to UPPER CASE following the conventions of + * a specific locale. + * @param locale The locale containing the conventions to use. + * @return A reference to this. + * @stable ICU 2.0 + */ + UnicodeString& toUpper(const Locale& locale); + + /** + * Convert the characters in this to lower case following the conventions of + * the default locale. + * @return A reference to this. + * @stable ICU 2.0 + */ + UnicodeString& toLower(void); + + /** + * Convert the characters in this to lower case following the conventions of + * a specific locale. + * @param locale The locale containing the conventions to use. + * @return A reference to this. + * @stable ICU 2.0 + */ + UnicodeString& toLower(const Locale& locale); + +#if !UCONFIG_NO_BREAK_ITERATION + + /** + * Titlecase this string, convenience function using the default locale. + * + * Casing is locale-dependent and context-sensitive. + * Titlecasing uses a break iterator to find the first characters of words + * that are to be titlecased. It titlecases those characters and lowercases + * all others. + * + * The titlecase break iterator can be provided to customize for arbitrary + * styles, using rules and dictionaries beyond the standard iterators. + * It may be more efficient to always provide an iterator to avoid + * opening and closing one for each string. + * The standard titlecase iterator for the root locale implements the + * algorithm of Unicode TR 21. + * + * This function uses only the setText(), first() and next() methods of the + * provided break iterator. + * + * @param titleIter A break iterator to find the first characters of words + * that are to be titlecased. + * If none is provided (0), then a standard titlecase + * break iterator is opened. + * Otherwise the provided iterator is set to the string's text. + * @return A reference to this. + * @stable ICU 2.1 + */ + UnicodeString &toTitle(BreakIterator *titleIter); + + /** + * Titlecase this string. + * + * Casing is locale-dependent and context-sensitive. + * Titlecasing uses a break iterator to find the first characters of words + * that are to be titlecased. It titlecases those characters and lowercases + * all others. + * + * The titlecase break iterator can be provided to customize for arbitrary + * styles, using rules and dictionaries beyond the standard iterators. + * It may be more efficient to always provide an iterator to avoid + * opening and closing one for each string. + * The standard titlecase iterator for the root locale implements the + * algorithm of Unicode TR 21. + * + * This function uses only the setText(), first() and next() methods of the + * provided break iterator. + * + * @param titleIter A break iterator to find the first characters of words + * that are to be titlecased. + * If none is provided (0), then a standard titlecase + * break iterator is opened. + * Otherwise the provided iterator is set to the string's text. + * @param locale The locale to consider. + * @return A reference to this. + * @stable ICU 2.1 + */ + UnicodeString &toTitle(BreakIterator *titleIter, const Locale &locale); + + /** + * Titlecase this string, with options. + * + * Casing is locale-dependent and context-sensitive. + * Titlecasing uses a break iterator to find the first characters of words + * that are to be titlecased. It titlecases those characters and lowercases + * all others. (This can be modified with options.) + * + * The titlecase break iterator can be provided to customize for arbitrary + * styles, using rules and dictionaries beyond the standard iterators. + * It may be more efficient to always provide an iterator to avoid + * opening and closing one for each string. + * The standard titlecase iterator for the root locale implements the + * algorithm of Unicode TR 21. + * + * This function uses only the setText(), first() and next() methods of the + * provided break iterator. + * + * @param titleIter A break iterator to find the first characters of words + * that are to be titlecased. + * If none is provided (0), then a standard titlecase + * break iterator is opened. + * Otherwise the provided iterator is set to the string's text. + * @param locale The locale to consider. + * @param options Options bit set, usually 0. See U_TITLECASE_NO_LOWERCASE, + * U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED, + * U_TITLECASE_WHOLE_STRING, U_TITLECASE_SENTENCES. + * @param options Options bit set, see ucasemap_open(). + * @return A reference to this. + * @stable ICU 3.8 + */ + UnicodeString &toTitle(BreakIterator *titleIter, const Locale &locale, uint32_t options); + +#endif + + /** + * Case-folds the characters in this string. + * + * Case-folding is locale-independent and not context-sensitive, + * but there is an option for whether to include or exclude mappings for dotted I + * and dotless i that are marked with 'T' in CaseFolding.txt. + * + * The result may be longer or shorter than the original. + * + * @param options Either U_FOLD_CASE_DEFAULT or U_FOLD_CASE_EXCLUDE_SPECIAL_I + * @return A reference to this. + * @stable ICU 2.0 + */ + UnicodeString &foldCase(uint32_t options=0 /*U_FOLD_CASE_DEFAULT*/); + + //======================================== + // Access to the internal buffer + //======================================== + + /** + * Get a read/write pointer to the internal buffer. + * The buffer is guaranteed to be large enough for at least minCapacity char16_ts, + * writable, and is still owned by the UnicodeString object. + * Calls to getBuffer(minCapacity) must not be nested, and + * must be matched with calls to releaseBuffer(newLength). + * If the string buffer was read-only or shared, + * then it will be reallocated and copied. + * + * An attempted nested call will return 0, and will not further modify the + * state of the UnicodeString object. + * It also returns 0 if the string is bogus. + * + * The actual capacity of the string buffer may be larger than minCapacity. + * getCapacity() returns the actual capacity. + * For many operations, the full capacity should be used to avoid reallocations. + * + * While the buffer is "open" between getBuffer(minCapacity) + * and releaseBuffer(newLength), the following applies: + * - The string length is set to 0. + * - Any read API call on the UnicodeString object will behave like on a 0-length string. + * - Any write API call on the UnicodeString object is disallowed and will have no effect. + * - You can read from and write to the returned buffer. + * - The previous string contents will still be in the buffer; + * if you want to use it, then you need to call length() before getBuffer(minCapacity). + * If the length() was greater than minCapacity, then any contents after minCapacity + * may be lost. + * The buffer contents is not NUL-terminated by getBuffer(). + * If length()(s.length(). + * (See getTerminatedBuffer().) + * + * The buffer may reside in read-only memory. Its contents must not + * be modified. + * + * @return a read-only pointer to the internal string buffer, + * or nullptr if the string is empty or bogus + * + * @see getBuffer(int32_t minCapacity) + * @see getTerminatedBuffer() + * @stable ICU 2.0 + */ + inline const char16_t *getBuffer() const; + + /** + * Get a read-only pointer to the internal buffer, + * making sure that it is NUL-terminated. + * This can be called at any time on a valid UnicodeString. + * + * It returns 0 if the string is bogus, or + * during an "open" getBuffer(minCapacity), or if the buffer cannot + * be NUL-terminated (because memory allocation failed). + * + * It can be called as many times as desired. + * The pointer that it returns will remain valid until the UnicodeString object is modified, + * at which time the pointer is semantically invalidated and must not be used any more. + * + * The capacity of the buffer can be determined with getCapacity(). + * The part after length()+1 may or may not be initialized and valid, + * depending on the history of the UnicodeString object. + * + * The buffer contents is guaranteed to be NUL-terminated. + * getTerminatedBuffer() may reallocate the buffer if a terminating NUL + * is written. + * For this reason, this function is not const, unlike getBuffer(). + * Note that a UnicodeString may also contain NUL characters as part of its contents. + * + * The buffer may reside in read-only memory. Its contents must not + * be modified. + * + * @return a read-only pointer to the internal string buffer, + * or 0 if the string is empty or bogus + * + * @see getBuffer(int32_t minCapacity) + * @see getBuffer() + * @stable ICU 2.2 + */ + const char16_t *getTerminatedBuffer(); + + //======================================== + // Constructors + //======================================== + + /** Construct an empty UnicodeString. + * @stable ICU 2.0 + */ + inline UnicodeString(); + + /** + * Construct a UnicodeString with capacity to hold capacity char16_ts + * @param capacity the number of char16_ts this UnicodeString should hold + * before a resize is necessary; if count is greater than 0 and count + * code points c take up more space than capacity, then capacity is adjusted + * accordingly. + * @param c is used to initially fill the string + * @param count specifies how many code points c are to be written in the + * string + * @stable ICU 2.0 + */ + UnicodeString(int32_t capacity, UChar32 c, int32_t count); + + /** + * Single char16_t (code unit) constructor. + * + * It is recommended to mark this constructor "explicit" by + * -DUNISTR_FROM_CHAR_EXPLICIT=explicit + * on the compiler command line or similar. + * @param ch the character to place in the UnicodeString + * @stable ICU 2.0 + */ + UNISTR_FROM_CHAR_EXPLICIT UnicodeString(char16_t ch); + + /** + * Single UChar32 (code point) constructor. + * + * It is recommended to mark this constructor "explicit" by + * -DUNISTR_FROM_CHAR_EXPLICIT=explicit + * on the compiler command line or similar. + * @param ch the character to place in the UnicodeString + * @stable ICU 2.0 + */ + UNISTR_FROM_CHAR_EXPLICIT UnicodeString(UChar32 ch); + + /** + * char16_t* constructor. + * + * It is recommended to mark this constructor "explicit" by + * -DUNISTR_FROM_STRING_EXPLICIT=explicit + * on the compiler command line or similar. + * @param text The characters to place in the UnicodeString. text + * must be NULL (U+0000) terminated. + * @stable ICU 2.0 + */ + UNISTR_FROM_STRING_EXPLICIT UnicodeString(const char16_t *text); + + /* + * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor, + * it should always be available regardless of U_HIDE_DRAFT_API status + */ +#if !U_CHAR16_IS_TYPEDEF + /** + * uint16_t * constructor. + * Delegates to UnicodeString(const char16_t *). + * + * It is recommended to mark this constructor "explicit" by + * -DUNISTR_FROM_STRING_EXPLICIT=explicit + * on the compiler command line or similar. + * @param text NUL-terminated UTF-16 string + * @draft ICU 59 + */ + UNISTR_FROM_STRING_EXPLICIT UnicodeString(const uint16_t *text) : + UnicodeString(ConstChar16Ptr(text)) {} +#endif + + /* + * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor, + * it should always be available regardless of U_HIDE_DRAFT_API status + */ +#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN) + /** + * wchar_t * constructor. + * (Only defined if U_SIZEOF_WCHAR_T==2.) + * Delegates to UnicodeString(const char16_t *). + * + * It is recommended to mark this constructor "explicit" by + * -DUNISTR_FROM_STRING_EXPLICIT=explicit + * on the compiler command line or similar. + * @param text NUL-terminated UTF-16 string + * @draft ICU 59 + */ + UNISTR_FROM_STRING_EXPLICIT UnicodeString(const wchar_t *text) : + UnicodeString(ConstChar16Ptr(text)) {} +#endif + + /* + * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor, + * it should always be available regardless of U_HIDE_DRAFT_API status + */ + /** + * nullptr_t constructor. + * Effectively the same as the default constructor, makes an empty string object. + * + * It is recommended to mark this constructor "explicit" by + * -DUNISTR_FROM_STRING_EXPLICIT=explicit + * on the compiler command line or similar. + * @param text nullptr + * @draft ICU 59 + */ + UNISTR_FROM_STRING_EXPLICIT inline UnicodeString(const std::nullptr_t text); + + /** + * char16_t* constructor. + * @param text The characters to place in the UnicodeString. + * @param textLength The number of Unicode characters in text + * to copy. + * @stable ICU 2.0 + */ + UnicodeString(const char16_t *text, + int32_t textLength); + + /* + * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor, + * it should always be available regardless of U_HIDE_DRAFT_API status + */ +#if !U_CHAR16_IS_TYPEDEF + /** + * uint16_t * constructor. + * Delegates to UnicodeString(const char16_t *, int32_t). + * @param text UTF-16 string + * @param length string length + * @draft ICU 59 + */ + UnicodeString(const uint16_t *text, int32_t length) : + UnicodeString(ConstChar16Ptr(text), length) {} +#endif + + /* + * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor, + * it should always be available regardless of U_HIDE_DRAFT_API status + */ +#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN) + /** + * wchar_t * constructor. + * (Only defined if U_SIZEOF_WCHAR_T==2.) + * Delegates to UnicodeString(const char16_t *, int32_t). + * @param text NUL-terminated UTF-16 string + * @param length string length + * @draft ICU 59 + */ + UnicodeString(const wchar_t *text, int32_t length) : + UnicodeString(ConstChar16Ptr(text), length) {} +#endif + + /* + * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor, + * it should always be available regardless of U_HIDE_DRAFT_API status + */ + /** + * nullptr_t constructor. + * Effectively the same as the default constructor, makes an empty string object. + * @param text nullptr + * @param length ignored + * @draft ICU 59 + */ + inline UnicodeString(const std::nullptr_t text, int32_t length); + + /** + * Readonly-aliasing char16_t* constructor. + * The text will be used for the UnicodeString object, but + * it will not be released when the UnicodeString is destroyed. + * This has copy-on-write semantics: + * When the string is modified, then the buffer is first copied into + * newly allocated memory. + * The aliased buffer is never modified. + * + * In an assignment to another UnicodeString, when using the copy constructor + * or the assignment operator, the text will be copied. + * When using fastCopyFrom(), the text will be aliased again, + * so that both strings then alias the same readonly-text. + * + * @param isTerminated specifies if text is NUL-terminated. + * This must be true if textLength==-1. + * @param text The characters to alias for the UnicodeString. + * @param textLength The number of Unicode characters in text to alias. + * If -1, then this constructor will determine the length + * by calling u_strlen(). + * @stable ICU 2.0 + */ + UnicodeString(UBool isTerminated, + ConstChar16Ptr text, + int32_t textLength); + + /** + * Writable-aliasing char16_t* constructor. + * The text will be used for the UnicodeString object, but + * it will not be released when the UnicodeString is destroyed. + * This has write-through semantics: + * For as long as the capacity of the buffer is sufficient, write operations + * will directly affect the buffer. When more capacity is necessary, then + * a new buffer will be allocated and the contents copied as with regularly + * constructed strings. + * In an assignment to another UnicodeString, the buffer will be copied. + * The extract(Char16Ptr dst) function detects whether the dst pointer is the same + * as the string buffer itself and will in this case not copy the contents. + * + * @param buffer The characters to alias for the UnicodeString. + * @param buffLength The number of Unicode characters in buffer to alias. + * @param buffCapacity The size of buffer in char16_ts. + * @stable ICU 2.0 + */ + UnicodeString(char16_t *buffer, int32_t buffLength, int32_t buffCapacity); + + /* + * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor, + * it should always be available regardless of U_HIDE_DRAFT_API status + */ +#if !U_CHAR16_IS_TYPEDEF + /** + * Writable-aliasing uint16_t * constructor. + * Delegates to UnicodeString(const char16_t *, int32_t, int32_t). + * @param buffer writable buffer of/for UTF-16 text + * @param buffLength length of the current buffer contents + * @param buffCapacity buffer capacity + * @draft ICU 59 + */ + UnicodeString(uint16_t *buffer, int32_t buffLength, int32_t buffCapacity) : + UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {} +#endif + + /* + * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor, + * it should always be available regardless of U_HIDE_DRAFT_API status + */ +#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN) + /** + * Writable-aliasing wchar_t * constructor. + * (Only defined if U_SIZEOF_WCHAR_T==2.) + * Delegates to UnicodeString(const char16_t *, int32_t, int32_t). + * @param buffer writable buffer of/for UTF-16 text + * @param buffLength length of the current buffer contents + * @param buffCapacity buffer capacity + * @draft ICU 59 + */ + UnicodeString(wchar_t *buffer, int32_t buffLength, int32_t buffCapacity) : + UnicodeString(Char16Ptr(buffer), buffLength, buffCapacity) {} +#endif + + /* + * Do not use #ifndef U_HIDE_DRAFT_API for the following constructor, + * it should always be available regardless of U_HIDE_DRAFT_API status + */ + /** + * Writable-aliasing nullptr_t constructor. + * Effectively the same as the default constructor, makes an empty string object. + * @param buffer nullptr + * @param buffLength ignored + * @param buffCapacity ignored + * @draft ICU 59 + */ + inline UnicodeString(std::nullptr_t buffer, int32_t buffLength, int32_t buffCapacity); + +#if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION + + /** + * char* constructor. + * Uses the default converter (and thus depends on the ICU conversion code) + * unless U_CHARSET_IS_UTF8 is set to 1. + * + * For ASCII (really "invariant character") strings it is more efficient to use + * the constructor that takes a US_INV (for its enum EInvariant). + * For ASCII (invariant-character) string literals, see UNICODE_STRING and + * UNICODE_STRING_SIMPLE. + * + * It is recommended to mark this constructor "explicit" by + * -DUNISTR_FROM_STRING_EXPLICIT=explicit + * on the compiler command line or similar. + * @param codepageData an array of bytes, null-terminated, + * in the platform's default codepage. + * @stable ICU 2.0 + * @see UNICODE_STRING + * @see UNICODE_STRING_SIMPLE + */ + UNISTR_FROM_STRING_EXPLICIT UnicodeString(const char *codepageData); + + /** + * char* constructor. + * Uses the default converter (and thus depends on the ICU conversion code) + * unless U_CHARSET_IS_UTF8 is set to 1. + * @param codepageData an array of bytes in the platform's default codepage. + * @param dataLength The number of bytes in codepageData. + * @stable ICU 2.0 + */ + UnicodeString(const char *codepageData, int32_t dataLength); + +#endif + +#if !UCONFIG_NO_CONVERSION + + /** + * char* constructor. + * @param codepageData an array of bytes, null-terminated + * @param codepage the encoding of codepageData. The special + * value 0 for codepage indicates that the text is in the + * platform's default codepage. + * + * If codepage is an empty string (""), + * then a simple conversion is performed on the codepage-invariant + * subset ("invariant characters") of the platform encoding. See utypes.h. + * Recommendation: For invariant-character strings use the constructor + * UnicodeString(const char *src, int32_t length, enum EInvariant inv) + * because it avoids object code dependencies of UnicodeString on + * the conversion code. + * + * @stable ICU 2.0 + */ + UnicodeString(const char *codepageData, const char *codepage); + + /** + * char* constructor. + * @param codepageData an array of bytes. + * @param dataLength The number of bytes in codepageData. + * @param codepage the encoding of codepageData. The special + * value 0 for codepage indicates that the text is in the + * platform's default codepage. + * If codepage is an empty string (""), + * then a simple conversion is performed on the codepage-invariant + * subset ("invariant characters") of the platform encoding. See utypes.h. + * Recommendation: For invariant-character strings use the constructor + * UnicodeString(const char *src, int32_t length, enum EInvariant inv) + * because it avoids object code dependencies of UnicodeString on + * the conversion code. + * + * @stable ICU 2.0 + */ + UnicodeString(const char *codepageData, int32_t dataLength, const char *codepage); + + /** + * char * / UConverter constructor. + * This constructor uses an existing UConverter object to + * convert the codepage string to Unicode and construct a UnicodeString + * from that. + * + * The converter is reset at first. + * If the error code indicates a failure before this constructor is called, + * or if an error occurs during conversion or construction, + * then the string will be bogus. + * + * This function avoids the overhead of opening and closing a converter if + * multiple strings are constructed. + * + * @param src input codepage string + * @param srcLength length of the input string, can be -1 for NUL-terminated strings + * @param cnv converter object (ucnv_resetToUnicode() will be called), + * can be NULL for the default converter + * @param errorCode normal ICU error code + * @stable ICU 2.0 + */ + UnicodeString( + const char *src, int32_t srcLength, + UConverter *cnv, + UErrorCode &errorCode); + +#endif + + /** + * Constructs a Unicode string from an invariant-character char * string. + * About invariant characters see utypes.h. + * This constructor has no runtime dependency on conversion code and is + * therefore recommended over ones taking a charset name string + * (where the empty string "" indicates invariant-character conversion). + * + * Use the macro US_INV as the third, signature-distinguishing parameter. + * + * For example: + * \code + * void fn(const char *s) { + * UnicodeString ustr(s, -1, US_INV); + * // use ustr ... + * } + * \endcode + * + * @param src String using only invariant characters. + * @param length Length of src, or -1 if NUL-terminated. + * @param inv Signature-distinguishing paramater, use US_INV. + * + * @see US_INV + * @stable ICU 3.2 + */ + UnicodeString(const char *src, int32_t length, enum EInvariant inv); + + + /** + * Copy constructor. + * + * Starting with ICU 2.4, the assignment operator and the copy constructor + * allocate a new buffer and copy the buffer contents even for readonly aliases. + * By contrast, the fastCopyFrom() function implements the old, + * more efficient but less safe behavior + * of making this string also a readonly alias to the same buffer. + * + * If the source object has an "open" buffer from getBuffer(minCapacity), + * then the copy is an empty string. + * + * @param that The UnicodeString object to copy. + * @stable ICU 2.0 + * @see fastCopyFrom + */ + UnicodeString(const UnicodeString& that); + + /** + * Move constructor, might leave src in bogus state. + * This string will have the same contents and state that the source string had. + * @param src source string + * @stable ICU 56 + */ + UnicodeString(UnicodeString &&src) U_NOEXCEPT; + + /** + * 'Substring' constructor from tail of source string. + * @param src The UnicodeString object to copy. + * @param srcStart The offset into src at which to start copying. + * @stable ICU 2.2 + */ + UnicodeString(const UnicodeString& src, int32_t srcStart); + + /** + * 'Substring' constructor from subrange of source string. + * @param src The UnicodeString object to copy. + * @param srcStart The offset into src at which to start copying. + * @param srcLength The number of characters from src to copy. + * @stable ICU 2.2 + */ + UnicodeString(const UnicodeString& src, int32_t srcStart, int32_t srcLength); + + /** + * Clone this object, an instance of a subclass of Replaceable. + * Clones can be used concurrently in multiple threads. + * If a subclass does not implement clone(), or if an error occurs, + * then NULL is returned. + * The clone functions in all subclasses return a pointer to a Replaceable + * because some compilers do not support covariant (same-as-this) + * return types; cast to the appropriate subclass if necessary. + * The caller must delete the clone. + * + * @return a clone of this object + * + * @see Replaceable::clone + * @see getDynamicClassID + * @stable ICU 2.6 + */ + virtual Replaceable *clone() const; + + /** Destructor. + * @stable ICU 2.0 + */ + virtual ~UnicodeString(); + + /** + * Create a UnicodeString from a UTF-8 string. + * Illegal input is replaced with U+FFFD. Otherwise, errors result in a bogus string. + * Calls u_strFromUTF8WithSub(). + * + * @param utf8 UTF-8 input string. + * Note that a StringPiece can be implicitly constructed + * from a std::string or a NUL-terminated const char * string. + * @return A UnicodeString with equivalent UTF-16 contents. + * @see toUTF8 + * @see toUTF8String + * @stable ICU 4.2 + */ + static UnicodeString fromUTF8(StringPiece utf8); + + /** + * Create a UnicodeString from a UTF-32 string. + * Illegal input is replaced with U+FFFD. Otherwise, errors result in a bogus string. + * Calls u_strFromUTF32WithSub(). + * + * @param utf32 UTF-32 input string. Must not be NULL. + * @param length Length of the input string, or -1 if NUL-terminated. + * @return A UnicodeString with equivalent UTF-16 contents. + * @see toUTF32 + * @stable ICU 4.2 + */ + static UnicodeString fromUTF32(const UChar32 *utf32, int32_t length); + + /* Miscellaneous operations */ + + /** + * Unescape a string of characters and return a string containing + * the result. The following escape sequences are recognized: + * + * \\uhhhh 4 hex digits; h in [0-9A-Fa-f] + * \\Uhhhhhhhh 8 hex digits + * \\xhh 1-2 hex digits + * \\ooo 1-3 octal digits; o in [0-7] + * \\cX control-X; X is masked with 0x1F + * + * as well as the standard ANSI C escapes: + * + * \\a => U+0007, \\b => U+0008, \\t => U+0009, \\n => U+000A, + * \\v => U+000B, \\f => U+000C, \\r => U+000D, \\e => U+001B, + * \\" => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C + * + * Anything else following a backslash is generically escaped. For + * example, "[a\\-z]" returns "[a-z]". + * + * If an escape sequence is ill-formed, this method returns an empty + * string. An example of an ill-formed sequence is "\\u" followed by + * fewer than 4 hex digits. + * + * This function is similar to u_unescape() but not identical to it. + * The latter takes a source char*, so it does escape recognition + * and also invariant conversion. + * + * @return a string with backslash escapes interpreted, or an + * empty string on error. + * @see UnicodeString#unescapeAt() + * @see u_unescape() + * @see u_unescapeAt() + * @stable ICU 2.0 + */ + UnicodeString unescape() const; + + /** + * Unescape a single escape sequence and return the represented + * character. See unescape() for a listing of the recognized escape + * sequences. The character at offset-1 is assumed (without + * checking) to be a backslash. If the escape sequence is + * ill-formed, or the offset is out of range, U_SENTINEL=-1 is + * returned. + * + * @param offset an input output parameter. On input, it is the + * offset into this string where the escape sequence is located, + * after the initial backslash. On output, it is advanced after the + * last character parsed. On error, it is not advanced at all. + * @return the character represented by the escape sequence at + * offset, or U_SENTINEL=-1 on error. + * @see UnicodeString#unescape() + * @see u_unescape() + * @see u_unescapeAt() + * @stable ICU 2.0 + */ + UChar32 unescapeAt(int32_t &offset) const; + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.2 + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.2 + */ + virtual UClassID getDynamicClassID() const; + + //======================================== + // Implementation methods + //======================================== + +protected: + /** + * Implement Replaceable::getLength() (see jitterbug 1027). + * @stable ICU 2.4 + */ + virtual int32_t getLength() const; + + /** + * The change in Replaceable to use virtual getCharAt() allows + * UnicodeString::charAt() to be inline again (see jitterbug 709). + * @stable ICU 2.4 + */ + virtual char16_t getCharAt(int32_t offset) const; + + /** + * The change in Replaceable to use virtual getChar32At() allows + * UnicodeString::char32At() to be inline again (see jitterbug 709). + * @stable ICU 2.4 + */ + virtual UChar32 getChar32At(int32_t offset) const; + +private: + // For char* constructors. Could be made public. + UnicodeString &setToUTF8(StringPiece utf8); + // For extract(char*). + // We could make a toUTF8(target, capacity, errorCode) public but not + // this version: New API will be cleaner if we make callers create substrings + // rather than having start+length on every method, + // and it should take a UErrorCode&. + int32_t + toUTF8(int32_t start, int32_t len, + char *target, int32_t capacity) const; + + /** + * Internal string contents comparison, called by operator==. + * Requires: this & text not bogus and have same lengths. + */ + UBool doEquals(const UnicodeString &text, int32_t len) const; + + inline int8_t + doCompare(int32_t start, + int32_t length, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const; + + int8_t doCompare(int32_t start, + int32_t length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) const; + + inline int8_t + doCompareCodePointOrder(int32_t start, + int32_t length, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const; + + int8_t doCompareCodePointOrder(int32_t start, + int32_t length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) const; + + inline int8_t + doCaseCompare(int32_t start, + int32_t length, + const UnicodeString &srcText, + int32_t srcStart, + int32_t srcLength, + uint32_t options) const; + + int8_t + doCaseCompare(int32_t start, + int32_t length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength, + uint32_t options) const; + + int32_t doIndexOf(char16_t c, + int32_t start, + int32_t length) const; + + int32_t doIndexOf(UChar32 c, + int32_t start, + int32_t length) const; + + int32_t doLastIndexOf(char16_t c, + int32_t start, + int32_t length) const; + + int32_t doLastIndexOf(UChar32 c, + int32_t start, + int32_t length) const; + + void doExtract(int32_t start, + int32_t length, + char16_t *dst, + int32_t dstStart) const; + + inline void doExtract(int32_t start, + int32_t length, + UnicodeString& target) const; + + inline char16_t doCharAt(int32_t offset) const; + + UnicodeString& doReplace(int32_t start, + int32_t length, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength); + + UnicodeString& doReplace(int32_t start, + int32_t length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength); + + UnicodeString& doAppend(const UnicodeString& src, int32_t srcStart, int32_t srcLength); + UnicodeString& doAppend(const char16_t *srcChars, int32_t srcStart, int32_t srcLength); + + UnicodeString& doReverse(int32_t start, + int32_t length); + + // calculate hash code + int32_t doHashCode(void) const; + + // get pointer to start of array + // these do not check for kOpenGetBuffer, unlike the public getBuffer() function + inline char16_t* getArrayStart(void); + inline const char16_t* getArrayStart(void) const; + + inline UBool hasShortLength() const; + inline int32_t getShortLength() const; + + // A UnicodeString object (not necessarily its current buffer) + // is writable unless it isBogus() or it has an "open" getBuffer(minCapacity). + inline UBool isWritable() const; + + // Is the current buffer writable? + inline UBool isBufferWritable() const; + + // None of the following does releaseArray(). + inline void setZeroLength(); + inline void setShortLength(int32_t len); + inline void setLength(int32_t len); + inline void setToEmpty(); + inline void setArray(char16_t *array, int32_t len, int32_t capacity); // sets length but not flags + + // allocate the array; result may be the stack buffer + // sets refCount to 1 if appropriate + // sets fArray, fCapacity, and flags + // sets length to 0 + // returns boolean for success or failure + UBool allocate(int32_t capacity); + + // release the array if owned + void releaseArray(void); + + // turn a bogus string into an empty one + void unBogus(); + + // implements assigment operator, copy constructor, and fastCopyFrom() + UnicodeString ©From(const UnicodeString &src, UBool fastCopy=FALSE); + + // Copies just the fields without memory management. + void copyFieldsFrom(UnicodeString &src, UBool setSrcToBogus) U_NOEXCEPT; + + // Pin start and limit to acceptable values. + inline void pinIndex(int32_t& start) const; + inline void pinIndices(int32_t& start, + int32_t& length) const; + +#if !UCONFIG_NO_CONVERSION + + /* Internal extract() using UConverter. */ + int32_t doExtract(int32_t start, int32_t length, + char *dest, int32_t destCapacity, + UConverter *cnv, + UErrorCode &errorCode) const; + + /* + * Real constructor for converting from codepage data. + * It assumes that it is called with !fRefCounted. + * + * If codepage==0, then the default converter + * is used for the platform encoding. + * If codepage is an empty string (""), + * then a simple conversion is performed on the codepage-invariant + * subset ("invariant characters") of the platform encoding. See utypes.h. + */ + void doCodepageCreate(const char *codepageData, + int32_t dataLength, + const char *codepage); + + /* + * Worker function for creating a UnicodeString from + * a codepage string using a UConverter. + */ + void + doCodepageCreate(const char *codepageData, + int32_t dataLength, + UConverter *converter, + UErrorCode &status); + +#endif + + /* + * This function is called when write access to the array + * is necessary. + * + * We need to make a copy of the array if + * the buffer is read-only, or + * the buffer is refCounted (shared), and refCount>1, or + * the buffer is too small. + * + * Return FALSE if memory could not be allocated. + */ + UBool cloneArrayIfNeeded(int32_t newCapacity = -1, + int32_t growCapacity = -1, + UBool doCopyArray = TRUE, + int32_t **pBufferToDelete = 0, + UBool forceClone = FALSE); + + /** + * Common function for UnicodeString case mappings. + * The stringCaseMapper has the same type UStringCaseMapper + * as in ustr_imp.h for ustrcase_map(). + */ + UnicodeString & + caseMap(int32_t caseLocale, uint32_t options, +#if !UCONFIG_NO_BREAK_ITERATION + BreakIterator *iter, +#endif + UStringCaseMapper *stringCaseMapper); + + // ref counting + void addRef(void); + int32_t removeRef(void); + int32_t refCount(void) const; + + // constants + enum { + /** + * Size of stack buffer for short strings. + * Must be at least U16_MAX_LENGTH for the single-code point constructor to work. + * @see UNISTR_OBJECT_SIZE + */ + US_STACKBUF_SIZE=(int32_t)(UNISTR_OBJECT_SIZE-sizeof(void *)-2)/U_SIZEOF_UCHAR, + kInvalidUChar=0xffff, // U+FFFF returned by charAt(invalid index) + kInvalidHashCode=0, // invalid hash code + kEmptyHashCode=1, // hash code for empty string + + // bit flag values for fLengthAndFlags + kIsBogus=1, // this string is bogus, i.e., not valid or NULL + kUsingStackBuffer=2,// using fUnion.fStackFields instead of fUnion.fFields + kRefCounted=4, // there is a refCount field before the characters in fArray + kBufferIsReadonly=8,// do not write to this buffer + kOpenGetBuffer=16, // getBuffer(minCapacity) was called (is "open"), + // and releaseBuffer(newLength) must be called + kAllStorageFlags=0x1f, + + kLengthShift=5, // remaining 11 bits for non-negative short length, or negative if long + kLength1=1<127; else undefined + int32_t fCapacity; // capacity of fArray (in char16_ts) + // array pointer last to minimize padding for machines with P128 data model + // or pointer sizes that are not a power of 2 + char16_t *fArray; // the Unicode data + } fFields; + } fUnion; +}; + +/** + * Create a new UnicodeString with the concatenation of two others. + * + * @param s1 The first string to be copied to the new one. + * @param s2 The second string to be copied to the new one, after s1. + * @return UnicodeString(s1).append(s2) + * @stable ICU 2.8 + */ +U_COMMON_API UnicodeString U_EXPORT2 +operator+ (const UnicodeString &s1, const UnicodeString &s2); + +//======================================== +// Inline members +//======================================== + +//======================================== +// Privates +//======================================== + +inline void +UnicodeString::pinIndex(int32_t& start) const +{ + // pin index + if(start < 0) { + start = 0; + } else if(start > length()) { + start = length(); + } +} + +inline void +UnicodeString::pinIndices(int32_t& start, + int32_t& _length) const +{ + // pin indices + int32_t len = length(); + if(start < 0) { + start = 0; + } else if(start > len) { + start = len; + } + if(_length < 0) { + _length = 0; + } else if(_length > (len - start)) { + _length = (len - start); + } +} + +inline char16_t* +UnicodeString::getArrayStart() { + return (fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) ? + fUnion.fStackFields.fBuffer : fUnion.fFields.fArray; +} + +inline const char16_t* +UnicodeString::getArrayStart() const { + return (fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) ? + fUnion.fStackFields.fBuffer : fUnion.fFields.fArray; +} + +//======================================== +// Default constructor +//======================================== + +inline +UnicodeString::UnicodeString() { + fUnion.fStackFields.fLengthAndFlags=kShortString; +} + +inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/) { + fUnion.fStackFields.fLengthAndFlags=kShortString; +} + +inline UnicodeString::UnicodeString(const std::nullptr_t /*text*/, int32_t /*length*/) { + fUnion.fStackFields.fLengthAndFlags=kShortString; +} + +inline UnicodeString::UnicodeString(std::nullptr_t /*buffer*/, int32_t /*buffLength*/, int32_t /*buffCapacity*/) { + fUnion.fStackFields.fLengthAndFlags=kShortString; +} + +//======================================== +// Read-only implementation methods +//======================================== +inline UBool +UnicodeString::hasShortLength() const { + return fUnion.fFields.fLengthAndFlags>=0; +} + +inline int32_t +UnicodeString::getShortLength() const { + // fLengthAndFlags must be non-negative -> short length >= 0 + // and arithmetic or logical shift does not matter. + return fUnion.fFields.fLengthAndFlags>>kLengthShift; +} + +inline int32_t +UnicodeString::length() const { + return hasShortLength() ? getShortLength() : fUnion.fFields.fLength; +} + +inline int32_t +UnicodeString::getCapacity() const { + return (fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) ? + US_STACKBUF_SIZE : fUnion.fFields.fCapacity; +} + +inline int32_t +UnicodeString::hashCode() const +{ return doHashCode(); } + +inline UBool +UnicodeString::isBogus() const +{ return (UBool)(fUnion.fFields.fLengthAndFlags & kIsBogus); } + +inline UBool +UnicodeString::isWritable() const +{ return (UBool)!(fUnion.fFields.fLengthAndFlags&(kOpenGetBuffer|kIsBogus)); } + +inline UBool +UnicodeString::isBufferWritable() const +{ + return (UBool)( + !(fUnion.fFields.fLengthAndFlags&(kOpenGetBuffer|kIsBogus|kBufferIsReadonly)) && + (!(fUnion.fFields.fLengthAndFlags&kRefCounted) || refCount()==1)); +} + +inline const char16_t * +UnicodeString::getBuffer() const { + if(fUnion.fFields.fLengthAndFlags&(kIsBogus|kOpenGetBuffer)) { + return nullptr; + } else if(fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) { + return fUnion.fStackFields.fBuffer; + } else { + return fUnion.fFields.fArray; + } +} + +//======================================== +// Read-only alias methods +//======================================== +inline int8_t +UnicodeString::doCompare(int32_t start, + int32_t thisLength, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const +{ + if(srcText.isBogus()) { + return (int8_t)!isBogus(); // 0 if both are bogus, 1 otherwise + } else { + srcText.pinIndices(srcStart, srcLength); + return doCompare(start, thisLength, srcText.getArrayStart(), srcStart, srcLength); + } +} + +inline UBool +UnicodeString::operator== (const UnicodeString& text) const +{ + if(isBogus()) { + return text.isBogus(); + } else { + int32_t len = length(), textLength = text.length(); + return !text.isBogus() && len == textLength && doEquals(text, len); + } +} + +inline UBool +UnicodeString::operator!= (const UnicodeString& text) const +{ return (! operator==(text)); } + +inline UBool +UnicodeString::operator> (const UnicodeString& text) const +{ return doCompare(0, length(), text, 0, text.length()) == 1; } + +inline UBool +UnicodeString::operator< (const UnicodeString& text) const +{ return doCompare(0, length(), text, 0, text.length()) == -1; } + +inline UBool +UnicodeString::operator>= (const UnicodeString& text) const +{ return doCompare(0, length(), text, 0, text.length()) != -1; } + +inline UBool +UnicodeString::operator<= (const UnicodeString& text) const +{ return doCompare(0, length(), text, 0, text.length()) != 1; } + +inline int8_t +UnicodeString::compare(const UnicodeString& text) const +{ return doCompare(0, length(), text, 0, text.length()); } + +inline int8_t +UnicodeString::compare(int32_t start, + int32_t _length, + const UnicodeString& srcText) const +{ return doCompare(start, _length, srcText, 0, srcText.length()); } + +inline int8_t +UnicodeString::compare(ConstChar16Ptr srcChars, + int32_t srcLength) const +{ return doCompare(0, length(), srcChars, 0, srcLength); } + +inline int8_t +UnicodeString::compare(int32_t start, + int32_t _length, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const +{ return doCompare(start, _length, srcText, srcStart, srcLength); } + +inline int8_t +UnicodeString::compare(int32_t start, + int32_t _length, + const char16_t *srcChars) const +{ return doCompare(start, _length, srcChars, 0, _length); } + +inline int8_t +UnicodeString::compare(int32_t start, + int32_t _length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) const +{ return doCompare(start, _length, srcChars, srcStart, srcLength); } + +inline int8_t +UnicodeString::compareBetween(int32_t start, + int32_t limit, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLimit) const +{ return doCompare(start, limit - start, + srcText, srcStart, srcLimit - srcStart); } + +inline int8_t +UnicodeString::doCompareCodePointOrder(int32_t start, + int32_t thisLength, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const +{ + if(srcText.isBogus()) { + return (int8_t)!isBogus(); // 0 if both are bogus, 1 otherwise + } else { + srcText.pinIndices(srcStart, srcLength); + return doCompareCodePointOrder(start, thisLength, srcText.getArrayStart(), srcStart, srcLength); + } +} + +inline int8_t +UnicodeString::compareCodePointOrder(const UnicodeString& text) const +{ return doCompareCodePointOrder(0, length(), text, 0, text.length()); } + +inline int8_t +UnicodeString::compareCodePointOrder(int32_t start, + int32_t _length, + const UnicodeString& srcText) const +{ return doCompareCodePointOrder(start, _length, srcText, 0, srcText.length()); } + +inline int8_t +UnicodeString::compareCodePointOrder(ConstChar16Ptr srcChars, + int32_t srcLength) const +{ return doCompareCodePointOrder(0, length(), srcChars, 0, srcLength); } + +inline int8_t +UnicodeString::compareCodePointOrder(int32_t start, + int32_t _length, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const +{ return doCompareCodePointOrder(start, _length, srcText, srcStart, srcLength); } + +inline int8_t +UnicodeString::compareCodePointOrder(int32_t start, + int32_t _length, + const char16_t *srcChars) const +{ return doCompareCodePointOrder(start, _length, srcChars, 0, _length); } + +inline int8_t +UnicodeString::compareCodePointOrder(int32_t start, + int32_t _length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) const +{ return doCompareCodePointOrder(start, _length, srcChars, srcStart, srcLength); } + +inline int8_t +UnicodeString::compareCodePointOrderBetween(int32_t start, + int32_t limit, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLimit) const +{ return doCompareCodePointOrder(start, limit - start, + srcText, srcStart, srcLimit - srcStart); } + +inline int8_t +UnicodeString::doCaseCompare(int32_t start, + int32_t thisLength, + const UnicodeString &srcText, + int32_t srcStart, + int32_t srcLength, + uint32_t options) const +{ + if(srcText.isBogus()) { + return (int8_t)!isBogus(); // 0 if both are bogus, 1 otherwise + } else { + srcText.pinIndices(srcStart, srcLength); + return doCaseCompare(start, thisLength, srcText.getArrayStart(), srcStart, srcLength, options); + } +} + +inline int8_t +UnicodeString::caseCompare(const UnicodeString &text, uint32_t options) const { + return doCaseCompare(0, length(), text, 0, text.length(), options); +} + +inline int8_t +UnicodeString::caseCompare(int32_t start, + int32_t _length, + const UnicodeString &srcText, + uint32_t options) const { + return doCaseCompare(start, _length, srcText, 0, srcText.length(), options); +} + +inline int8_t +UnicodeString::caseCompare(ConstChar16Ptr srcChars, + int32_t srcLength, + uint32_t options) const { + return doCaseCompare(0, length(), srcChars, 0, srcLength, options); +} + +inline int8_t +UnicodeString::caseCompare(int32_t start, + int32_t _length, + const UnicodeString &srcText, + int32_t srcStart, + int32_t srcLength, + uint32_t options) const { + return doCaseCompare(start, _length, srcText, srcStart, srcLength, options); +} + +inline int8_t +UnicodeString::caseCompare(int32_t start, + int32_t _length, + const char16_t *srcChars, + uint32_t options) const { + return doCaseCompare(start, _length, srcChars, 0, _length, options); +} + +inline int8_t +UnicodeString::caseCompare(int32_t start, + int32_t _length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength, + uint32_t options) const { + return doCaseCompare(start, _length, srcChars, srcStart, srcLength, options); +} + +inline int8_t +UnicodeString::caseCompareBetween(int32_t start, + int32_t limit, + const UnicodeString &srcText, + int32_t srcStart, + int32_t srcLimit, + uint32_t options) const { + return doCaseCompare(start, limit - start, srcText, srcStart, srcLimit - srcStart, options); +} + +inline int32_t +UnicodeString::indexOf(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength, + int32_t start, + int32_t _length) const +{ + if(!srcText.isBogus()) { + srcText.pinIndices(srcStart, srcLength); + if(srcLength > 0) { + return indexOf(srcText.getArrayStart(), srcStart, srcLength, start, _length); + } + } + return -1; +} + +inline int32_t +UnicodeString::indexOf(const UnicodeString& text) const +{ return indexOf(text, 0, text.length(), 0, length()); } + +inline int32_t +UnicodeString::indexOf(const UnicodeString& text, + int32_t start) const { + pinIndex(start); + return indexOf(text, 0, text.length(), start, length() - start); +} + +inline int32_t +UnicodeString::indexOf(const UnicodeString& text, + int32_t start, + int32_t _length) const +{ return indexOf(text, 0, text.length(), start, _length); } + +inline int32_t +UnicodeString::indexOf(const char16_t *srcChars, + int32_t srcLength, + int32_t start) const { + pinIndex(start); + return indexOf(srcChars, 0, srcLength, start, length() - start); +} + +inline int32_t +UnicodeString::indexOf(ConstChar16Ptr srcChars, + int32_t srcLength, + int32_t start, + int32_t _length) const +{ return indexOf(srcChars, 0, srcLength, start, _length); } + +inline int32_t +UnicodeString::indexOf(char16_t c, + int32_t start, + int32_t _length) const +{ return doIndexOf(c, start, _length); } + +inline int32_t +UnicodeString::indexOf(UChar32 c, + int32_t start, + int32_t _length) const +{ return doIndexOf(c, start, _length); } + +inline int32_t +UnicodeString::indexOf(char16_t c) const +{ return doIndexOf(c, 0, length()); } + +inline int32_t +UnicodeString::indexOf(UChar32 c) const +{ return indexOf(c, 0, length()); } + +inline int32_t +UnicodeString::indexOf(char16_t c, + int32_t start) const { + pinIndex(start); + return doIndexOf(c, start, length() - start); +} + +inline int32_t +UnicodeString::indexOf(UChar32 c, + int32_t start) const { + pinIndex(start); + return indexOf(c, start, length() - start); +} + +inline int32_t +UnicodeString::lastIndexOf(ConstChar16Ptr srcChars, + int32_t srcLength, + int32_t start, + int32_t _length) const +{ return lastIndexOf(srcChars, 0, srcLength, start, _length); } + +inline int32_t +UnicodeString::lastIndexOf(const char16_t *srcChars, + int32_t srcLength, + int32_t start) const { + pinIndex(start); + return lastIndexOf(srcChars, 0, srcLength, start, length() - start); +} + +inline int32_t +UnicodeString::lastIndexOf(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength, + int32_t start, + int32_t _length) const +{ + if(!srcText.isBogus()) { + srcText.pinIndices(srcStart, srcLength); + if(srcLength > 0) { + return lastIndexOf(srcText.getArrayStart(), srcStart, srcLength, start, _length); + } + } + return -1; +} + +inline int32_t +UnicodeString::lastIndexOf(const UnicodeString& text, + int32_t start, + int32_t _length) const +{ return lastIndexOf(text, 0, text.length(), start, _length); } + +inline int32_t +UnicodeString::lastIndexOf(const UnicodeString& text, + int32_t start) const { + pinIndex(start); + return lastIndexOf(text, 0, text.length(), start, length() - start); +} + +inline int32_t +UnicodeString::lastIndexOf(const UnicodeString& text) const +{ return lastIndexOf(text, 0, text.length(), 0, length()); } + +inline int32_t +UnicodeString::lastIndexOf(char16_t c, + int32_t start, + int32_t _length) const +{ return doLastIndexOf(c, start, _length); } + +inline int32_t +UnicodeString::lastIndexOf(UChar32 c, + int32_t start, + int32_t _length) const { + return doLastIndexOf(c, start, _length); +} + +inline int32_t +UnicodeString::lastIndexOf(char16_t c) const +{ return doLastIndexOf(c, 0, length()); } + +inline int32_t +UnicodeString::lastIndexOf(UChar32 c) const { + return lastIndexOf(c, 0, length()); +} + +inline int32_t +UnicodeString::lastIndexOf(char16_t c, + int32_t start) const { + pinIndex(start); + return doLastIndexOf(c, start, length() - start); +} + +inline int32_t +UnicodeString::lastIndexOf(UChar32 c, + int32_t start) const { + pinIndex(start); + return lastIndexOf(c, start, length() - start); +} + +inline UBool +UnicodeString::startsWith(const UnicodeString& text) const +{ return compare(0, text.length(), text, 0, text.length()) == 0; } + +inline UBool +UnicodeString::startsWith(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const +{ return doCompare(0, srcLength, srcText, srcStart, srcLength) == 0; } + +inline UBool +UnicodeString::startsWith(ConstChar16Ptr srcChars, int32_t srcLength) const { + if(srcLength < 0) { + srcLength = u_strlen(toUCharPtr(srcChars)); + } + return doCompare(0, srcLength, srcChars, 0, srcLength) == 0; +} + +inline UBool +UnicodeString::startsWith(const char16_t *srcChars, int32_t srcStart, int32_t srcLength) const { + if(srcLength < 0) { + srcLength = u_strlen(toUCharPtr(srcChars)); + } + return doCompare(0, srcLength, srcChars, srcStart, srcLength) == 0; +} + +inline UBool +UnicodeString::endsWith(const UnicodeString& text) const +{ return doCompare(length() - text.length(), text.length(), + text, 0, text.length()) == 0; } + +inline UBool +UnicodeString::endsWith(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) const { + srcText.pinIndices(srcStart, srcLength); + return doCompare(length() - srcLength, srcLength, + srcText, srcStart, srcLength) == 0; +} + +inline UBool +UnicodeString::endsWith(ConstChar16Ptr srcChars, + int32_t srcLength) const { + if(srcLength < 0) { + srcLength = u_strlen(toUCharPtr(srcChars)); + } + return doCompare(length() - srcLength, srcLength, + srcChars, 0, srcLength) == 0; +} + +inline UBool +UnicodeString::endsWith(const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) const { + if(srcLength < 0) { + srcLength = u_strlen(toUCharPtr(srcChars + srcStart)); + } + return doCompare(length() - srcLength, srcLength, + srcChars, srcStart, srcLength) == 0; +} + +//======================================== +// replace +//======================================== +inline UnicodeString& +UnicodeString::replace(int32_t start, + int32_t _length, + const UnicodeString& srcText) +{ return doReplace(start, _length, srcText, 0, srcText.length()); } + +inline UnicodeString& +UnicodeString::replace(int32_t start, + int32_t _length, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) +{ return doReplace(start, _length, srcText, srcStart, srcLength); } + +inline UnicodeString& +UnicodeString::replace(int32_t start, + int32_t _length, + ConstChar16Ptr srcChars, + int32_t srcLength) +{ return doReplace(start, _length, srcChars, 0, srcLength); } + +inline UnicodeString& +UnicodeString::replace(int32_t start, + int32_t _length, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) +{ return doReplace(start, _length, srcChars, srcStart, srcLength); } + +inline UnicodeString& +UnicodeString::replace(int32_t start, + int32_t _length, + char16_t srcChar) +{ return doReplace(start, _length, &srcChar, 0, 1); } + +inline UnicodeString& +UnicodeString::replaceBetween(int32_t start, + int32_t limit, + const UnicodeString& srcText) +{ return doReplace(start, limit - start, srcText, 0, srcText.length()); } + +inline UnicodeString& +UnicodeString::replaceBetween(int32_t start, + int32_t limit, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLimit) +{ return doReplace(start, limit - start, srcText, srcStart, srcLimit - srcStart); } + +inline UnicodeString& +UnicodeString::findAndReplace(const UnicodeString& oldText, + const UnicodeString& newText) +{ return findAndReplace(0, length(), oldText, 0, oldText.length(), + newText, 0, newText.length()); } + +inline UnicodeString& +UnicodeString::findAndReplace(int32_t start, + int32_t _length, + const UnicodeString& oldText, + const UnicodeString& newText) +{ return findAndReplace(start, _length, oldText, 0, oldText.length(), + newText, 0, newText.length()); } + +// ============================ +// extract +// ============================ +inline void +UnicodeString::doExtract(int32_t start, + int32_t _length, + UnicodeString& target) const +{ target.replace(0, target.length(), *this, start, _length); } + +inline void +UnicodeString::extract(int32_t start, + int32_t _length, + Char16Ptr target, + int32_t targetStart) const +{ doExtract(start, _length, target, targetStart); } + +inline void +UnicodeString::extract(int32_t start, + int32_t _length, + UnicodeString& target) const +{ doExtract(start, _length, target); } + +#if !UCONFIG_NO_CONVERSION + +inline int32_t +UnicodeString::extract(int32_t start, + int32_t _length, + char *dst, + const char *codepage) const + +{ + // This dstSize value will be checked explicitly + return extract(start, _length, dst, dst!=0 ? 0xffffffff : 0, codepage); +} + +#endif + +inline void +UnicodeString::extractBetween(int32_t start, + int32_t limit, + char16_t *dst, + int32_t dstStart) const { + pinIndex(start); + pinIndex(limit); + doExtract(start, limit - start, dst, dstStart); +} + +inline UnicodeString +UnicodeString::tempSubStringBetween(int32_t start, int32_t limit) const { + return tempSubString(start, limit - start); +} + +inline char16_t +UnicodeString::doCharAt(int32_t offset) const +{ + if((uint32_t)offset < (uint32_t)length()) { + return getArrayStart()[offset]; + } else { + return kInvalidUChar; + } +} + +inline char16_t +UnicodeString::charAt(int32_t offset) const +{ return doCharAt(offset); } + +inline char16_t +UnicodeString::operator[] (int32_t offset) const +{ return doCharAt(offset); } + +inline UBool +UnicodeString::isEmpty() const { + // Arithmetic or logical right shift does not matter: only testing for 0. + return (fUnion.fFields.fLengthAndFlags>>kLengthShift) == 0; +} + +//======================================== +// Write implementation methods +//======================================== +inline void +UnicodeString::setZeroLength() { + fUnion.fFields.fLengthAndFlags &= kAllStorageFlags; +} + +inline void +UnicodeString::setShortLength(int32_t len) { + // requires 0 <= len <= kMaxShortLength + fUnion.fFields.fLengthAndFlags = + (int16_t)((fUnion.fFields.fLengthAndFlags & kAllStorageFlags) | (len << kLengthShift)); +} + +inline void +UnicodeString::setLength(int32_t len) { + if(len <= kMaxShortLength) { + setShortLength(len); + } else { + fUnion.fFields.fLengthAndFlags |= kLengthIsLarge; + fUnion.fFields.fLength = len; + } +} + +inline void +UnicodeString::setToEmpty() { + fUnion.fFields.fLengthAndFlags = kShortString; +} + +inline void +UnicodeString::setArray(char16_t *array, int32_t len, int32_t capacity) { + setLength(len); + fUnion.fFields.fArray = array; + fUnion.fFields.fCapacity = capacity; +} + +inline UnicodeString& +UnicodeString::operator= (char16_t ch) +{ return doReplace(0, length(), &ch, 0, 1); } + +inline UnicodeString& +UnicodeString::operator= (UChar32 ch) +{ return replace(0, length(), ch); } + +inline UnicodeString& +UnicodeString::setTo(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) +{ + unBogus(); + return doReplace(0, length(), srcText, srcStart, srcLength); +} + +inline UnicodeString& +UnicodeString::setTo(const UnicodeString& srcText, + int32_t srcStart) +{ + unBogus(); + srcText.pinIndex(srcStart); + return doReplace(0, length(), srcText, srcStart, srcText.length() - srcStart); +} + +inline UnicodeString& +UnicodeString::setTo(const UnicodeString& srcText) +{ + return copyFrom(srcText); +} + +inline UnicodeString& +UnicodeString::setTo(const char16_t *srcChars, + int32_t srcLength) +{ + unBogus(); + return doReplace(0, length(), srcChars, 0, srcLength); +} + +inline UnicodeString& +UnicodeString::setTo(char16_t srcChar) +{ + unBogus(); + return doReplace(0, length(), &srcChar, 0, 1); +} + +inline UnicodeString& +UnicodeString::setTo(UChar32 srcChar) +{ + unBogus(); + return replace(0, length(), srcChar); +} + +inline UnicodeString& +UnicodeString::append(const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) +{ return doAppend(srcText, srcStart, srcLength); } + +inline UnicodeString& +UnicodeString::append(const UnicodeString& srcText) +{ return doAppend(srcText, 0, srcText.length()); } + +inline UnicodeString& +UnicodeString::append(const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) +{ return doAppend(srcChars, srcStart, srcLength); } + +inline UnicodeString& +UnicodeString::append(ConstChar16Ptr srcChars, + int32_t srcLength) +{ return doAppend(srcChars, 0, srcLength); } + +inline UnicodeString& +UnicodeString::append(char16_t srcChar) +{ return doAppend(&srcChar, 0, 1); } + +inline UnicodeString& +UnicodeString::operator+= (char16_t ch) +{ return doAppend(&ch, 0, 1); } + +inline UnicodeString& +UnicodeString::operator+= (UChar32 ch) { + return append(ch); +} + +inline UnicodeString& +UnicodeString::operator+= (const UnicodeString& srcText) +{ return doAppend(srcText, 0, srcText.length()); } + +inline UnicodeString& +UnicodeString::insert(int32_t start, + const UnicodeString& srcText, + int32_t srcStart, + int32_t srcLength) +{ return doReplace(start, 0, srcText, srcStart, srcLength); } + +inline UnicodeString& +UnicodeString::insert(int32_t start, + const UnicodeString& srcText) +{ return doReplace(start, 0, srcText, 0, srcText.length()); } + +inline UnicodeString& +UnicodeString::insert(int32_t start, + const char16_t *srcChars, + int32_t srcStart, + int32_t srcLength) +{ return doReplace(start, 0, srcChars, srcStart, srcLength); } + +inline UnicodeString& +UnicodeString::insert(int32_t start, + ConstChar16Ptr srcChars, + int32_t srcLength) +{ return doReplace(start, 0, srcChars, 0, srcLength); } + +inline UnicodeString& +UnicodeString::insert(int32_t start, + char16_t srcChar) +{ return doReplace(start, 0, &srcChar, 0, 1); } + +inline UnicodeString& +UnicodeString::insert(int32_t start, + UChar32 srcChar) +{ return replace(start, 0, srcChar); } + + +inline UnicodeString& +UnicodeString::remove() +{ + // remove() of a bogus string makes the string empty and non-bogus + if(isBogus()) { + setToEmpty(); + } else { + setZeroLength(); + } + return *this; +} + +inline UnicodeString& +UnicodeString::remove(int32_t start, + int32_t _length) +{ + if(start <= 0 && _length == INT32_MAX) { + // remove(guaranteed everything) of a bogus string makes the string empty and non-bogus + return remove(); + } + return doReplace(start, _length, NULL, 0, 0); +} + +inline UnicodeString& +UnicodeString::removeBetween(int32_t start, + int32_t limit) +{ return doReplace(start, limit - start, NULL, 0, 0); } + +inline UnicodeString & +UnicodeString::retainBetween(int32_t start, int32_t limit) { + truncate(limit); + return doReplace(0, start, NULL, 0, 0); +} + +inline UBool +UnicodeString::truncate(int32_t targetLength) +{ + if(isBogus() && targetLength == 0) { + // truncate(0) of a bogus string makes the string empty and non-bogus + unBogus(); + return FALSE; + } else if((uint32_t)targetLength < (uint32_t)length()) { + setLength(targetLength); + return TRUE; + } else { + return FALSE; + } +} + +inline UnicodeString& +UnicodeString::reverse() +{ return doReverse(0, length()); } + +inline UnicodeString& +UnicodeString::reverse(int32_t start, + int32_t _length) +{ return doReverse(start, _length); } + +U_NAMESPACE_END + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/unorm.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/unorm.h new file mode 100644 index 0000000..3839de1 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/unorm.h @@ -0,0 +1,472 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (c) 1996-2016, International Business Machines Corporation +* and others. All Rights Reserved. +******************************************************************************* +* File unorm.h +* +* Created by: Vladimir Weinstein 12052000 +* +* Modification history : +* +* Date Name Description +* 02/01/01 synwee Added normalization quickcheck enum and method. +*/ +#ifndef UNORM_H +#define UNORM_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_NORMALIZATION + +#include "unicode/uiter.h" +#include "unicode/unorm2.h" + +/** + * \file + * \brief C API: Unicode Normalization + * + * Old Unicode normalization API. + * + * This API has been replaced by the unorm2.h API and is only available + * for backward compatibility. The functions here simply delegate to the + * unorm2.h functions, for example unorm2_getInstance() and unorm2_normalize(). + * There is one exception: The new API does not provide a replacement for unorm_compare(). + * Its declaration has been moved to unorm2.h. + * + * unorm_normalize transforms Unicode text into an equivalent composed or + * decomposed form, allowing for easier sorting and searching of text. + * unorm_normalize supports the standard normalization forms described in + * + * Unicode Standard Annex #15: Unicode Normalization Forms. + * + * Characters with accents or other adornments can be encoded in + * several different ways in Unicode. For example, take the character A-acute. + * In Unicode, this can be encoded as a single character (the + * "composed" form): + * + * \code + * 00C1 LATIN CAPITAL LETTER A WITH ACUTE + * \endcode + * + * or as two separate characters (the "decomposed" form): + * + * \code + * 0041 LATIN CAPITAL LETTER A + * 0301 COMBINING ACUTE ACCENT + * \endcode + * + * To a user of your program, however, both of these sequences should be + * treated as the same "user-level" character "A with acute accent". When you are searching or + * comparing text, you must ensure that these two sequences are treated + * equivalently. In addition, you must handle characters with more than one + * accent. Sometimes the order of a character's combining accents is + * significant, while in other cases accent sequences in different orders are + * really equivalent. + * + * Similarly, the string "ffi" can be encoded as three separate letters: + * + * \code + * 0066 LATIN SMALL LETTER F + * 0066 LATIN SMALL LETTER F + * 0069 LATIN SMALL LETTER I + * \endcode + * + * or as the single character + * + * \code + * FB03 LATIN SMALL LIGATURE FFI + * \endcode + * + * The ffi ligature is not a distinct semantic character, and strictly speaking + * it shouldn't be in Unicode at all, but it was included for compatibility + * with existing character sets that already provided it. The Unicode standard + * identifies such characters by giving them "compatibility" decompositions + * into the corresponding semantic characters. When sorting and searching, you + * will often want to use these mappings. + * + * unorm_normalize helps solve these problems by transforming text into the + * canonical composed and decomposed forms as shown in the first example above. + * In addition, you can have it perform compatibility decompositions so that + * you can treat compatibility characters the same as their equivalents. + * Finally, unorm_normalize rearranges accents into the proper canonical + * order, so that you do not have to worry about accent rearrangement on your + * own. + * + * Form FCD, "Fast C or D", is also designed for collation. + * It allows to work on strings that are not necessarily normalized + * with an algorithm (like in collation) that works under "canonical closure", i.e., it treats precomposed + * characters and their decomposed equivalents the same. + * + * It is not a normalization form because it does not provide for uniqueness of representation. Multiple strings + * may be canonically equivalent (their NFDs are identical) and may all conform to FCD without being identical + * themselves. + * + * The form is defined such that the "raw decomposition", the recursive canonical decomposition of each character, + * results in a string that is canonically ordered. This means that precomposed characters are allowed for as long + * as their decompositions do not need canonical reordering. + * + * Its advantage for a process like collation is that all NFD and most NFC texts - and many unnormalized texts - + * already conform to FCD and do not need to be normalized (NFD) for such a process. The FCD quick check will + * return UNORM_YES for most strings in practice. + * + * unorm_normalize(UNORM_FCD) may be implemented with UNORM_NFD. + * + * For more details on FCD see the collation design document: + * http://source.icu-project.org/repos/icu/icuhtml/trunk/design/collation/ICU_collation_design.htm + * + * ICU collation performs either NFD or FCD normalization automatically if normalization + * is turned on for the collator object. + * Beyond collation and string search, normalized strings may be useful for string equivalence comparisons, + * transliteration/transcription, unique representations, etc. + * + * The W3C generally recommends to exchange texts in NFC. + * Note also that most legacy character encodings use only precomposed forms and often do not + * encode any combining marks by themselves. For conversion to such character encodings the + * Unicode text needs to be normalized to NFC. + * For more usage examples, see the Unicode Standard Annex. + */ + +// Do not conditionalize the following enum with #ifndef U_HIDE_DEPRECATED_API, +// it is needed for layout of Normalizer object. +/** + * Constants for normalization modes. + * @deprecated ICU 56 Use unorm2.h instead. + */ +typedef enum { + /** No decomposition/composition. @deprecated ICU 56 Use unorm2.h instead. */ + UNORM_NONE = 1, + /** Canonical decomposition. @deprecated ICU 56 Use unorm2.h instead. */ + UNORM_NFD = 2, + /** Compatibility decomposition. @deprecated ICU 56 Use unorm2.h instead. */ + UNORM_NFKD = 3, + /** Canonical decomposition followed by canonical composition. @deprecated ICU 56 Use unorm2.h instead. */ + UNORM_NFC = 4, + /** Default normalization. @deprecated ICU 56 Use unorm2.h instead. */ + UNORM_DEFAULT = UNORM_NFC, + /** Compatibility decomposition followed by canonical composition. @deprecated ICU 56 Use unorm2.h instead. */ + UNORM_NFKC =5, + /** "Fast C or D" form. @deprecated ICU 56 Use unorm2.h instead. */ + UNORM_FCD = 6, + + /** One more than the highest normalization mode constant. @deprecated ICU 56 Use unorm2.h instead. */ + UNORM_MODE_COUNT +} UNormalizationMode; + +#ifndef U_HIDE_DEPRECATED_API + +/** + * Constants for options flags for normalization. + * Use 0 for default options, + * including normalization according to the Unicode version + * that is currently supported by ICU (see u_getUnicodeVersion). + * @deprecated ICU 56 Use unorm2.h instead. + */ +enum { + /** + * Options bit set value to select Unicode 3.2 normalization + * (except NormalizationCorrections). + * At most one Unicode version can be selected at a time. + * @deprecated ICU 56 Use unorm2.h instead. + */ + UNORM_UNICODE_3_2=0x20 +}; + +/** + * Lowest-order bit number of unorm_compare() options bits corresponding to + * normalization options bits. + * + * The options parameter for unorm_compare() uses most bits for + * itself and for various comparison and folding flags. + * The most significant bits, however, are shifted down and passed on + * to the normalization implementation. + * (That is, from unorm_compare(..., options, ...), + * options>>UNORM_COMPARE_NORM_OPTIONS_SHIFT will be passed on to the + * internal normalization functions.) + * + * @see unorm_compare + * @deprecated ICU 56 Use unorm2.h instead. + */ +#define UNORM_COMPARE_NORM_OPTIONS_SHIFT 20 + +/** + * Normalize a string. + * The string will be normalized according the specified normalization mode + * and options. + * The source and result buffers must not be the same, nor overlap. + * + * @param source The string to normalize. + * @param sourceLength The length of source, or -1 if NUL-terminated. + * @param mode The normalization mode; one of UNORM_NONE, + * UNORM_NFD, UNORM_NFC, UNORM_NFKC, UNORM_NFKD, UNORM_DEFAULT. + * @param options The normalization options, ORed together (0 for no options). + * @param result A pointer to a buffer to receive the result string. + * The result string is NUL-terminated if possible. + * @param resultLength The maximum size of result. + * @param status A pointer to a UErrorCode to receive any errors. + * @return The total buffer size needed; if greater than resultLength, + * the output was truncated, and the error code is set to U_BUFFER_OVERFLOW_ERROR. + * @deprecated ICU 56 Use unorm2.h instead. + */ +U_DEPRECATED int32_t U_EXPORT2 +unorm_normalize(const UChar *source, int32_t sourceLength, + UNormalizationMode mode, int32_t options, + UChar *result, int32_t resultLength, + UErrorCode *status); + +/** + * Performing quick check on a string, to quickly determine if the string is + * in a particular normalization format. + * Three types of result can be returned UNORM_YES, UNORM_NO or + * UNORM_MAYBE. Result UNORM_YES indicates that the argument + * string is in the desired normalized format, UNORM_NO determines that + * argument string is not in the desired normalized format. A + * UNORM_MAYBE result indicates that a more thorough check is required, + * the user may have to put the string in its normalized form and compare the + * results. + * + * @param source string for determining if it is in a normalized format + * @param sourcelength length of source to test, or -1 if NUL-terminated + * @param mode which normalization form to test for + * @param status a pointer to a UErrorCode to receive any errors + * @return UNORM_YES, UNORM_NO or UNORM_MAYBE + * + * @see unorm_isNormalized + * @deprecated ICU 56 Use unorm2.h instead. + */ +U_DEPRECATED UNormalizationCheckResult U_EXPORT2 +unorm_quickCheck(const UChar *source, int32_t sourcelength, + UNormalizationMode mode, + UErrorCode *status); + +/** + * Performing quick check on a string; same as unorm_quickCheck but + * takes an extra options parameter like most normalization functions. + * + * @param src String that is to be tested if it is in a normalization format. + * @param srcLength Length of source to test, or -1 if NUL-terminated. + * @param mode Which normalization form to test for. + * @param options The normalization options, ORed together (0 for no options). + * @param pErrorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return UNORM_YES, UNORM_NO or UNORM_MAYBE + * + * @see unorm_quickCheck + * @see unorm_isNormalized + * @deprecated ICU 56 Use unorm2.h instead. + */ +U_DEPRECATED UNormalizationCheckResult U_EXPORT2 +unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength, + UNormalizationMode mode, int32_t options, + UErrorCode *pErrorCode); + +/** + * Test if a string is in a given normalization form. + * This is semantically equivalent to source.equals(normalize(source, mode)) . + * + * Unlike unorm_quickCheck(), this function returns a definitive result, + * never a "maybe". + * For NFD, NFKD, and FCD, both functions work exactly the same. + * For NFC and NFKC where quickCheck may return "maybe", this function will + * perform further tests to arrive at a TRUE/FALSE result. + * + * @param src String that is to be tested if it is in a normalization format. + * @param srcLength Length of source to test, or -1 if NUL-terminated. + * @param mode Which normalization form to test for. + * @param pErrorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return Boolean value indicating whether the source string is in the + * "mode" normalization form. + * + * @see unorm_quickCheck + * @deprecated ICU 56 Use unorm2.h instead. + */ +U_DEPRECATED UBool U_EXPORT2 +unorm_isNormalized(const UChar *src, int32_t srcLength, + UNormalizationMode mode, + UErrorCode *pErrorCode); + +/** + * Test if a string is in a given normalization form; same as unorm_isNormalized but + * takes an extra options parameter like most normalization functions. + * + * @param src String that is to be tested if it is in a normalization format. + * @param srcLength Length of source to test, or -1 if NUL-terminated. + * @param mode Which normalization form to test for. + * @param options The normalization options, ORed together (0 for no options). + * @param pErrorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return Boolean value indicating whether the source string is in the + * "mode/options" normalization form. + * + * @see unorm_quickCheck + * @see unorm_isNormalized + * @deprecated ICU 56 Use unorm2.h instead. + */ +U_DEPRECATED UBool U_EXPORT2 +unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength, + UNormalizationMode mode, int32_t options, + UErrorCode *pErrorCode); + +/** + * Iterative normalization forward. + * This function (together with unorm_previous) is somewhat + * similar to the C++ Normalizer class (see its non-static functions). + * + * Iterative normalization is useful when only a small portion of a longer + * string/text needs to be processed. + * + * For example, the likelihood may be high that processing the first 10% of some + * text will be sufficient to find certain data. + * Another example: When one wants to concatenate two normalized strings and get a + * normalized result, it is much more efficient to normalize just a small part of + * the result around the concatenation place instead of re-normalizing everything. + * + * The input text is an instance of the C character iteration API UCharIterator. + * It may wrap around a simple string, a CharacterIterator, a Replaceable, or any + * other kind of text object. + * + * If a buffer overflow occurs, then the caller needs to reset the iterator to the + * old index and call the function again with a larger buffer - if the caller cares + * for the actual output. + * Regardless of the output buffer, the iterator will always be moved to the next + * normalization boundary. + * + * This function (like unorm_previous) serves two purposes: + * + * 1) To find the next boundary so that the normalization of the part of the text + * from the current position to that boundary does not affect and is not affected + * by the part of the text beyond that boundary. + * + * 2) To normalize the text up to the boundary. + * + * The second step is optional, per the doNormalize parameter. + * It is omitted for operations like string concatenation, where the two adjacent + * string ends need to be normalized together. + * In such a case, the output buffer will just contain a copy of the text up to the + * boundary. + * + * pNeededToNormalize is an output-only parameter. Its output value is only defined + * if normalization was requested (doNormalize) and successful (especially, no + * buffer overflow). + * It is useful for operations like a normalizing transliterator, where one would + * not want to replace a piece of text if it is not modified. + * + * If doNormalize==TRUE and pNeededToNormalize!=NULL then *pNeeded... is set TRUE + * if the normalization was necessary. + * + * If doNormalize==FALSE then *pNeededToNormalize will be set to FALSE. + * + * If the buffer overflows, then *pNeededToNormalize will be undefined; + * essentially, whenever U_FAILURE is true (like in buffer overflows), this result + * will be undefined. + * + * @param src The input text in the form of a C character iterator. + * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting. + * @param destCapacity The number of UChars that fit into dest. + * @param mode The normalization mode. + * @param options The normalization options, ORed together (0 for no options). + * @param doNormalize Indicates if the source text up to the next boundary + * is to be normalized (TRUE) or just copied (FALSE). + * @param pNeededToNormalize Output flag indicating if the normalization resulted in + * different text from the input. + * Not defined if an error occurs including buffer overflow. + * Always FALSE if !doNormalize. + * @param pErrorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return Length of output (number of UChars) when successful or buffer overflow. + * + * @see unorm_previous + * @see unorm_normalize + * + * @deprecated ICU 56 Use unorm2.h instead. + */ +U_DEPRECATED int32_t U_EXPORT2 +unorm_next(UCharIterator *src, + UChar *dest, int32_t destCapacity, + UNormalizationMode mode, int32_t options, + UBool doNormalize, UBool *pNeededToNormalize, + UErrorCode *pErrorCode); + +/** + * Iterative normalization backward. + * This function (together with unorm_next) is somewhat + * similar to the C++ Normalizer class (see its non-static functions). + * For all details see unorm_next. + * + * @param src The input text in the form of a C character iterator. + * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting. + * @param destCapacity The number of UChars that fit into dest. + * @param mode The normalization mode. + * @param options The normalization options, ORed together (0 for no options). + * @param doNormalize Indicates if the source text up to the next boundary + * is to be normalized (TRUE) or just copied (FALSE). + * @param pNeededToNormalize Output flag indicating if the normalization resulted in + * different text from the input. + * Not defined if an error occurs including buffer overflow. + * Always FALSE if !doNormalize. + * @param pErrorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return Length of output (number of UChars) when successful or buffer overflow. + * + * @see unorm_next + * @see unorm_normalize + * + * @deprecated ICU 56 Use unorm2.h instead. + */ +U_DEPRECATED int32_t U_EXPORT2 +unorm_previous(UCharIterator *src, + UChar *dest, int32_t destCapacity, + UNormalizationMode mode, int32_t options, + UBool doNormalize, UBool *pNeededToNormalize, + UErrorCode *pErrorCode); + +/** + * Concatenate normalized strings, making sure that the result is normalized as well. + * + * If both the left and the right strings are in + * the normalization form according to "mode/options", + * then the result will be + * + * \code + * dest=normalize(left+right, mode, options) + * \endcode + * + * With the input strings already being normalized, + * this function will use unorm_next() and unorm_previous() + * to find the adjacent end pieces of the input strings. + * Only the concatenation of these end pieces will be normalized and + * then concatenated with the remaining parts of the input strings. + * + * It is allowed to have dest==left to avoid copying the entire left string. + * + * @param left Left source string, may be same as dest. + * @param leftLength Length of left source string, or -1 if NUL-terminated. + * @param right Right source string. Must not be the same as dest, nor overlap. + * @param rightLength Length of right source string, or -1 if NUL-terminated. + * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting. + * @param destCapacity The number of UChars that fit into dest. + * @param mode The normalization mode. + * @param options The normalization options, ORed together (0 for no options). + * @param pErrorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return Length of output (number of UChars) when successful or buffer overflow. + * + * @see unorm_normalize + * @see unorm_next + * @see unorm_previous + * + * @deprecated ICU 56 Use unorm2.h instead. + */ +U_DEPRECATED int32_t U_EXPORT2 +unorm_concatenate(const UChar *left, int32_t leftLength, + const UChar *right, int32_t rightLength, + UChar *dest, int32_t destCapacity, + UNormalizationMode mode, int32_t options, + UErrorCode *pErrorCode); + +#endif /* U_HIDE_DEPRECATED_API */ +#endif /* #if !UCONFIG_NO_NORMALIZATION */ +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/unorm2.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/unorm2.h new file mode 100644 index 0000000..a9bd02f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/unorm2.h @@ -0,0 +1,603 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2009-2015, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: unorm2.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2009dec15 +* created by: Markus W. Scherer +*/ + +#ifndef __UNORM2_H__ +#define __UNORM2_H__ + +/** + * \file + * \brief C API: New API for Unicode Normalization. + * + * Unicode normalization functionality for standard Unicode normalization or + * for using custom mapping tables. + * All instances of UNormalizer2 are unmodifiable/immutable. + * Instances returned by unorm2_getInstance() are singletons that must not be deleted by the caller. + * For more details see the Normalizer2 C++ class. + */ + +#include "unicode/utypes.h" +#include "unicode/localpointer.h" +#include "unicode/stringoptions.h" +#include "unicode/uset.h" + +/** + * Constants for normalization modes. + * For details about standard Unicode normalization forms + * and about the algorithms which are also used with custom mapping tables + * see http://www.unicode.org/unicode/reports/tr15/ + * @stable ICU 4.4 + */ +typedef enum { + /** + * Decomposition followed by composition. + * Same as standard NFC when using an "nfc" instance. + * Same as standard NFKC when using an "nfkc" instance. + * For details about standard Unicode normalization forms + * see http://www.unicode.org/unicode/reports/tr15/ + * @stable ICU 4.4 + */ + UNORM2_COMPOSE, + /** + * Map, and reorder canonically. + * Same as standard NFD when using an "nfc" instance. + * Same as standard NFKD when using an "nfkc" instance. + * For details about standard Unicode normalization forms + * see http://www.unicode.org/unicode/reports/tr15/ + * @stable ICU 4.4 + */ + UNORM2_DECOMPOSE, + /** + * "Fast C or D" form. + * If a string is in this form, then further decomposition without reordering + * would yield the same form as DECOMPOSE. + * Text in "Fast C or D" form can be processed efficiently with data tables + * that are "canonically closed", that is, that provide equivalent data for + * equivalent text, without having to be fully normalized. + * Not a standard Unicode normalization form. + * Not a unique form: Different FCD strings can be canonically equivalent. + * For details see http://www.unicode.org/notes/tn5/#FCD + * @stable ICU 4.4 + */ + UNORM2_FCD, + /** + * Compose only contiguously. + * Also known as "FCC" or "Fast C Contiguous". + * The result will often but not always be in NFC. + * The result will conform to FCD which is useful for processing. + * Not a standard Unicode normalization form. + * For details see http://www.unicode.org/notes/tn5/#FCC + * @stable ICU 4.4 + */ + UNORM2_COMPOSE_CONTIGUOUS +} UNormalization2Mode; + +/** + * Result values for normalization quick check functions. + * For details see http://www.unicode.org/reports/tr15/#Detecting_Normalization_Forms + * @stable ICU 2.0 + */ +typedef enum UNormalizationCheckResult { + /** + * The input string is not in the normalization form. + * @stable ICU 2.0 + */ + UNORM_NO, + /** + * The input string is in the normalization form. + * @stable ICU 2.0 + */ + UNORM_YES, + /** + * The input string may or may not be in the normalization form. + * This value is only returned for composition forms like NFC and FCC, + * when a backward-combining character is found for which the surrounding text + * would have to be analyzed further. + * @stable ICU 2.0 + */ + UNORM_MAYBE +} UNormalizationCheckResult; + +/** + * Opaque C service object type for the new normalization API. + * @stable ICU 4.4 + */ +struct UNormalizer2; +typedef struct UNormalizer2 UNormalizer2; /**< C typedef for struct UNormalizer2. @stable ICU 4.4 */ + +#if !UCONFIG_NO_NORMALIZATION + +/** + * Returns a UNormalizer2 instance for Unicode NFC normalization. + * Same as unorm2_getInstance(NULL, "nfc", UNORM2_COMPOSE, pErrorCode). + * Returns an unmodifiable singleton instance. Do not delete it. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested Normalizer2, if successful + * @stable ICU 49 + */ +U_STABLE const UNormalizer2 * U_EXPORT2 +unorm2_getNFCInstance(UErrorCode *pErrorCode); + +/** + * Returns a UNormalizer2 instance for Unicode NFD normalization. + * Same as unorm2_getInstance(NULL, "nfc", UNORM2_DECOMPOSE, pErrorCode). + * Returns an unmodifiable singleton instance. Do not delete it. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested Normalizer2, if successful + * @stable ICU 49 + */ +U_STABLE const UNormalizer2 * U_EXPORT2 +unorm2_getNFDInstance(UErrorCode *pErrorCode); + +/** + * Returns a UNormalizer2 instance for Unicode NFKC normalization. + * Same as unorm2_getInstance(NULL, "nfkc", UNORM2_COMPOSE, pErrorCode). + * Returns an unmodifiable singleton instance. Do not delete it. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested Normalizer2, if successful + * @stable ICU 49 + */ +U_STABLE const UNormalizer2 * U_EXPORT2 +unorm2_getNFKCInstance(UErrorCode *pErrorCode); + +/** + * Returns a UNormalizer2 instance for Unicode NFKD normalization. + * Same as unorm2_getInstance(NULL, "nfkc", UNORM2_DECOMPOSE, pErrorCode). + * Returns an unmodifiable singleton instance. Do not delete it. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested Normalizer2, if successful + * @stable ICU 49 + */ +U_STABLE const UNormalizer2 * U_EXPORT2 +unorm2_getNFKDInstance(UErrorCode *pErrorCode); + +/** + * Returns a UNormalizer2 instance for Unicode NFKC_Casefold normalization. + * Same as unorm2_getInstance(NULL, "nfkc_cf", UNORM2_COMPOSE, pErrorCode). + * Returns an unmodifiable singleton instance. Do not delete it. + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested Normalizer2, if successful + * @stable ICU 49 + */ +U_STABLE const UNormalizer2 * U_EXPORT2 +unorm2_getNFKCCasefoldInstance(UErrorCode *pErrorCode); + +/** + * Returns a UNormalizer2 instance which uses the specified data file + * (packageName/name similar to ucnv_openPackage() and ures_open()/ResourceBundle) + * and which composes or decomposes text according to the specified mode. + * Returns an unmodifiable singleton instance. Do not delete it. + * + * Use packageName=NULL for data files that are part of ICU's own data. + * Use name="nfc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFC/NFD. + * Use name="nfkc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFKC/NFKD. + * Use name="nfkc_cf" and UNORM2_COMPOSE for Unicode standard NFKC_CF=NFKC_Casefold. + * + * @param packageName NULL for ICU built-in data, otherwise application data package name + * @param name "nfc" or "nfkc" or "nfkc_cf" or name of custom data file + * @param mode normalization mode (compose or decompose etc.) + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested UNormalizer2, if successful + * @stable ICU 4.4 + */ +U_STABLE const UNormalizer2 * U_EXPORT2 +unorm2_getInstance(const char *packageName, + const char *name, + UNormalization2Mode mode, + UErrorCode *pErrorCode); + +/** + * Constructs a filtered normalizer wrapping any UNormalizer2 instance + * and a filter set. + * Both are aliased and must not be modified or deleted while this object + * is used. + * The filter set should be frozen; otherwise the performance will suffer greatly. + * @param norm2 wrapped UNormalizer2 instance + * @param filterSet USet which determines the characters to be normalized + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the requested UNormalizer2, if successful + * @stable ICU 4.4 + */ +U_STABLE UNormalizer2 * U_EXPORT2 +unorm2_openFiltered(const UNormalizer2 *norm2, const USet *filterSet, UErrorCode *pErrorCode); + +/** + * Closes a UNormalizer2 instance from unorm2_openFiltered(). + * Do not close instances from unorm2_getInstance()! + * @param norm2 UNormalizer2 instance to be closed + * @stable ICU 4.4 + */ +U_STABLE void U_EXPORT2 +unorm2_close(UNormalizer2 *norm2); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUNormalizer2Pointer + * "Smart pointer" class, closes a UNormalizer2 via unorm2_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUNormalizer2Pointer, UNormalizer2, unorm2_close); + +U_NAMESPACE_END + +#endif + +/** + * Writes the normalized form of the source string to the destination string + * (replacing its contents) and returns the length of the destination string. + * The source and destination strings must be different buffers. + * @param norm2 UNormalizer2 instance + * @param src source string + * @param length length of the source string, or -1 if NUL-terminated + * @param dest destination string; its contents is replaced with normalized src + * @param capacity number of UChars that can be written to dest + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return dest + * @stable ICU 4.4 + */ +U_STABLE int32_t U_EXPORT2 +unorm2_normalize(const UNormalizer2 *norm2, + const UChar *src, int32_t length, + UChar *dest, int32_t capacity, + UErrorCode *pErrorCode); +/** + * Appends the normalized form of the second string to the first string + * (merging them at the boundary) and returns the length of the first string. + * The result is normalized if the first string was normalized. + * The first and second strings must be different buffers. + * @param norm2 UNormalizer2 instance + * @param first string, should be normalized + * @param firstLength length of the first string, or -1 if NUL-terminated + * @param firstCapacity number of UChars that can be written to first + * @param second string, will be normalized + * @param secondLength length of the source string, or -1 if NUL-terminated + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return first + * @stable ICU 4.4 + */ +U_STABLE int32_t U_EXPORT2 +unorm2_normalizeSecondAndAppend(const UNormalizer2 *norm2, + UChar *first, int32_t firstLength, int32_t firstCapacity, + const UChar *second, int32_t secondLength, + UErrorCode *pErrorCode); +/** + * Appends the second string to the first string + * (merging them at the boundary) and returns the length of the first string. + * The result is normalized if both the strings were normalized. + * The first and second strings must be different buffers. + * @param norm2 UNormalizer2 instance + * @param first string, should be normalized + * @param firstLength length of the first string, or -1 if NUL-terminated + * @param firstCapacity number of UChars that can be written to first + * @param second string, should be normalized + * @param secondLength length of the source string, or -1 if NUL-terminated + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return first + * @stable ICU 4.4 + */ +U_STABLE int32_t U_EXPORT2 +unorm2_append(const UNormalizer2 *norm2, + UChar *first, int32_t firstLength, int32_t firstCapacity, + const UChar *second, int32_t secondLength, + UErrorCode *pErrorCode); + +/** + * Gets the decomposition mapping of c. + * Roughly equivalent to normalizing the String form of c + * on a UNORM2_DECOMPOSE UNormalizer2 instance, but much faster, and except that this function + * returns a negative value and does not write a string + * if c does not have a decomposition mapping in this instance's data. + * This function is independent of the mode of the UNormalizer2. + * @param norm2 UNormalizer2 instance + * @param c code point + * @param decomposition String buffer which will be set to c's + * decomposition mapping, if there is one. + * @param capacity number of UChars that can be written to decomposition + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the non-negative length of c's decomposition, if there is one; otherwise a negative value + * @stable ICU 4.6 + */ +U_STABLE int32_t U_EXPORT2 +unorm2_getDecomposition(const UNormalizer2 *norm2, + UChar32 c, UChar *decomposition, int32_t capacity, + UErrorCode *pErrorCode); + +/** + * Gets the raw decomposition mapping of c. + * + * This is similar to the unorm2_getDecomposition() function but returns the + * raw decomposition mapping as specified in UnicodeData.txt or + * (for custom data) in the mapping files processed by the gennorm2 tool. + * By contrast, unorm2_getDecomposition() returns the processed, + * recursively-decomposed version of this mapping. + * + * When used on a standard NFKC Normalizer2 instance, + * unorm2_getRawDecomposition() returns the Unicode Decomposition_Mapping (dm) property. + * + * When used on a standard NFC Normalizer2 instance, + * it returns the Decomposition_Mapping only if the Decomposition_Type (dt) is Canonical (Can); + * in this case, the result contains either one or two code points (=1..4 UChars). + * + * This function is independent of the mode of the UNormalizer2. + * @param norm2 UNormalizer2 instance + * @param c code point + * @param decomposition String buffer which will be set to c's + * raw decomposition mapping, if there is one. + * @param capacity number of UChars that can be written to decomposition + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return the non-negative length of c's raw decomposition, if there is one; otherwise a negative value + * @stable ICU 49 + */ +U_STABLE int32_t U_EXPORT2 +unorm2_getRawDecomposition(const UNormalizer2 *norm2, + UChar32 c, UChar *decomposition, int32_t capacity, + UErrorCode *pErrorCode); + +/** + * Performs pairwise composition of a & b and returns the composite if there is one. + * + * Returns a composite code point c only if c has a two-way mapping to a+b. + * In standard Unicode normalization, this means that + * c has a canonical decomposition to a+b + * and c does not have the Full_Composition_Exclusion property. + * + * This function is independent of the mode of the UNormalizer2. + * @param norm2 UNormalizer2 instance + * @param a A (normalization starter) code point. + * @param b Another code point. + * @return The non-negative composite code point if there is one; otherwise a negative value. + * @stable ICU 49 + */ +U_STABLE UChar32 U_EXPORT2 +unorm2_composePair(const UNormalizer2 *norm2, UChar32 a, UChar32 b); + +/** + * Gets the combining class of c. + * The default implementation returns 0 + * but all standard implementations return the Unicode Canonical_Combining_Class value. + * @param norm2 UNormalizer2 instance + * @param c code point + * @return c's combining class + * @stable ICU 49 + */ +U_STABLE uint8_t U_EXPORT2 +unorm2_getCombiningClass(const UNormalizer2 *norm2, UChar32 c); + +/** + * Tests if the string is normalized. + * Internally, in cases where the quickCheck() method would return "maybe" + * (which is only possible for the two COMPOSE modes) this method + * resolves to "yes" or "no" to provide a definitive result, + * at the cost of doing more work in those cases. + * @param norm2 UNormalizer2 instance + * @param s input string + * @param length length of the string, or -1 if NUL-terminated + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return TRUE if s is normalized + * @stable ICU 4.4 + */ +U_STABLE UBool U_EXPORT2 +unorm2_isNormalized(const UNormalizer2 *norm2, + const UChar *s, int32_t length, + UErrorCode *pErrorCode); + +/** + * Tests if the string is normalized. + * For the two COMPOSE modes, the result could be "maybe" in cases that + * would take a little more work to resolve definitively. + * Use spanQuickCheckYes() and normalizeSecondAndAppend() for a faster + * combination of quick check + normalization, to avoid + * re-checking the "yes" prefix. + * @param norm2 UNormalizer2 instance + * @param s input string + * @param length length of the string, or -1 if NUL-terminated + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return UNormalizationCheckResult + * @stable ICU 4.4 + */ +U_STABLE UNormalizationCheckResult U_EXPORT2 +unorm2_quickCheck(const UNormalizer2 *norm2, + const UChar *s, int32_t length, + UErrorCode *pErrorCode); + +/** + * Returns the end of the normalized substring of the input string. + * In other words, with end=spanQuickCheckYes(s, ec); + * the substring UnicodeString(s, 0, end) + * will pass the quick check with a "yes" result. + * + * The returned end index is usually one or more characters before the + * "no" or "maybe" character: The end index is at a normalization boundary. + * (See the class documentation for more about normalization boundaries.) + * + * When the goal is a normalized string and most input strings are expected + * to be normalized already, then call this method, + * and if it returns a prefix shorter than the input string, + * copy that prefix and use normalizeSecondAndAppend() for the remainder. + * @param norm2 UNormalizer2 instance + * @param s input string + * @param length length of the string, or -1 if NUL-terminated + * @param pErrorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return "yes" span end index + * @stable ICU 4.4 + */ +U_STABLE int32_t U_EXPORT2 +unorm2_spanQuickCheckYes(const UNormalizer2 *norm2, + const UChar *s, int32_t length, + UErrorCode *pErrorCode); + +/** + * Tests if the character always has a normalization boundary before it, + * regardless of context. + * For details see the Normalizer2 base class documentation. + * @param norm2 UNormalizer2 instance + * @param c character to test + * @return TRUE if c has a normalization boundary before it + * @stable ICU 4.4 + */ +U_STABLE UBool U_EXPORT2 +unorm2_hasBoundaryBefore(const UNormalizer2 *norm2, UChar32 c); + +/** + * Tests if the character always has a normalization boundary after it, + * regardless of context. + * For details see the Normalizer2 base class documentation. + * @param norm2 UNormalizer2 instance + * @param c character to test + * @return TRUE if c has a normalization boundary after it + * @stable ICU 4.4 + */ +U_STABLE UBool U_EXPORT2 +unorm2_hasBoundaryAfter(const UNormalizer2 *norm2, UChar32 c); + +/** + * Tests if the character is normalization-inert. + * For details see the Normalizer2 base class documentation. + * @param norm2 UNormalizer2 instance + * @param c character to test + * @return TRUE if c is normalization-inert + * @stable ICU 4.4 + */ +U_STABLE UBool U_EXPORT2 +unorm2_isInert(const UNormalizer2 *norm2, UChar32 c); + +/** + * Compares two strings for canonical equivalence. + * Further options include case-insensitive comparison and + * code point order (as opposed to code unit order). + * + * Canonical equivalence between two strings is defined as their normalized + * forms (NFD or NFC) being identical. + * This function compares strings incrementally instead of normalizing + * (and optionally case-folding) both strings entirely, + * improving performance significantly. + * + * Bulk normalization is only necessary if the strings do not fulfill the FCD + * conditions. Only in this case, and only if the strings are relatively long, + * is memory allocated temporarily. + * For FCD strings and short non-FCD strings there is no memory allocation. + * + * Semantically, this is equivalent to + * strcmp[CodePointOrder](NFD(foldCase(NFD(s1))), NFD(foldCase(NFD(s2)))) + * where code point order and foldCase are all optional. + * + * UAX 21 2.5 Caseless Matching specifies that for a canonical caseless match + * the case folding must be performed first, then the normalization. + * + * @param s1 First source string. + * @param length1 Length of first source string, or -1 if NUL-terminated. + * + * @param s2 Second source string. + * @param length2 Length of second source string, or -1 if NUL-terminated. + * + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Case-sensitive comparison in code unit order, and the input strings + * are quick-checked for FCD. + * + * - UNORM_INPUT_IS_FCD + * Set if the caller knows that both s1 and s2 fulfill the FCD conditions. + * If not set, the function will quickCheck for FCD + * and normalize if necessary. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_COMPARE_IGNORE_CASE + * Set to compare strings case-insensitively using case folding, + * instead of case-sensitively. + * If set, then the following case folding options are used. + * + * - Options as used with case-insensitive comparisons, currently: + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * (see u_strCaseCompare for details) + * + * - regular normalization options shifted left by UNORM_COMPARE_NORM_OPTIONS_SHIFT + * + * @param pErrorCode ICU error code in/out parameter. + * Must fulfill U_SUCCESS before the function call. + * @return <0 or 0 or >0 as usual for string comparisons + * + * @see unorm_normalize + * @see UNORM_FCD + * @see u_strCompare + * @see u_strCaseCompare + * + * @stable ICU 2.2 + */ +U_STABLE int32_t U_EXPORT2 +unorm_compare(const UChar *s1, int32_t length1, + const UChar *s2, int32_t length2, + uint32_t options, + UErrorCode *pErrorCode); + +#endif /* !UCONFIG_NO_NORMALIZATION */ +#endif /* __UNORM2_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/unum.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/unum.h new file mode 100644 index 0000000..2ab09b5 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/unum.h @@ -0,0 +1,1439 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 1997-2015, International Business Machines Corporation and others. +* All Rights Reserved. +* Modification History: +* +* Date Name Description +* 06/24/99 helena Integrated Alan's NF enhancements and Java2 bug fixes +******************************************************************************* +*/ + +#ifndef _UNUM +#define _UNUM + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/localpointer.h" +#include "unicode/uloc.h" +#include "unicode/ucurr.h" +#include "unicode/umisc.h" +#include "unicode/parseerr.h" +#include "unicode/uformattable.h" +#include "unicode/udisplaycontext.h" +#include "unicode/ufieldpositer.h" + +/** + * \file + * \brief C API: NumberFormat + * + *

Number Format C API

+ * + * Number Format C API Provides functions for + * formatting and parsing a number. Also provides methods for + * determining which locales have number formats, and what their names + * are. + *

+ * UNumberFormat helps you to format and parse numbers for any locale. + * Your code can be completely independent of the locale conventions + * for decimal points, thousands-separators, or even the particular + * decimal digits used, or whether the number format is even decimal. + * There are different number format styles like decimal, currency, + * percent and spellout. + *

+ * To format a number for the current Locale, use one of the static + * factory methods: + *

+ * \code
+ *    UChar myString[20];
+ *    double myNumber = 7.0;
+ *    UErrorCode status = U_ZERO_ERROR;
+ *    UNumberFormat* nf = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status);
+ *    unum_formatDouble(nf, myNumber, myString, 20, NULL, &status);
+ *    printf(" Example 1: %s\n", austrdup(myString) ); //austrdup( a function used to convert UChar* to char*)
+ * \endcode
+ * 
+ * If you are formatting multiple numbers, it is more efficient to get + * the format and use it multiple times so that the system doesn't + * have to fetch the information about the local language and country + * conventions multiple times. + *
+ * \code
+ * uint32_t i, resultlength, reslenneeded;
+ * UErrorCode status = U_ZERO_ERROR;
+ * UFieldPosition pos;
+ * uint32_t a[] = { 123, 3333, -1234567 };
+ * const uint32_t a_len = sizeof(a) / sizeof(a[0]);
+ * UNumberFormat* nf;
+ * UChar* result = NULL;
+ *
+ * nf = unum_open(UNUM_DEFAULT, NULL, -1, NULL, NULL, &status);
+ * for (i = 0; i < a_len; i++) {
+ *    resultlength=0;
+ *    reslenneeded=unum_format(nf, a[i], NULL, resultlength, &pos, &status);
+ *    result = NULL;
+ *    if(status==U_BUFFER_OVERFLOW_ERROR){
+ *       status=U_ZERO_ERROR;
+ *       resultlength=reslenneeded+1;
+ *       result=(UChar*)malloc(sizeof(UChar) * resultlength);
+ *       unum_format(nf, a[i], result, resultlength, &pos, &status);
+ *    }
+ *    printf( " Example 2: %s\n", austrdup(result));
+ *    free(result);
+ * }
+ * \endcode
+ * 
+ * To format a number for a different Locale, specify it in the + * call to unum_open(). + *
+ * \code
+ *     UNumberFormat* nf = unum_open(UNUM_DEFAULT, NULL, -1, "fr_FR", NULL, &success)
+ * \endcode
+ * 
+ * You can use a NumberFormat API unum_parse() to parse. + *
+ * \code
+ *    UErrorCode status = U_ZERO_ERROR;
+ *    int32_t pos=0;
+ *    int32_t num;
+ *    num = unum_parse(nf, str, u_strlen(str), &pos, &status);
+ * \endcode
+ * 
+ * Use UNUM_DECIMAL to get the normal number format for that country. + * There are other static options available. Use UNUM_CURRENCY + * to get the currency number format for that country. Use UNUM_PERCENT + * to get a format for displaying percentages. With this format, a + * fraction from 0.53 is displayed as 53%. + *

+ * Use a pattern to create either a DecimalFormat or a RuleBasedNumberFormat + * formatter. The pattern must conform to the syntax defined for those + * formatters. + *

+ * You can also control the display of numbers with such function as + * unum_getAttributes() and unum_setAttributes(), which let you set the + * minimum fraction digits, grouping, etc. + * @see UNumberFormatAttributes for more details + *

+ * You can also use forms of the parse and format methods with + * ParsePosition and UFieldPosition to allow you to: + *

    + *
  • (a) progressively parse through pieces of a string. + *
  • (b) align the decimal point and other areas. + *
+ *

+ * It is also possible to change or set the symbols used for a particular + * locale like the currency symbol, the grouping separator , monetary separator + * etc by making use of functions unum_setSymbols() and unum_getSymbols(). + */ + +/** A number formatter. + * For usage in C programs. + * @stable ICU 2.0 + */ +typedef void* UNumberFormat; + +/** The possible number format styles. + * @stable ICU 2.0 + */ +typedef enum UNumberFormatStyle { + /** + * Decimal format defined by a pattern string. + * @stable ICU 3.0 + */ + UNUM_PATTERN_DECIMAL=0, + /** + * Decimal format ("normal" style). + * @stable ICU 2.0 + */ + UNUM_DECIMAL=1, + /** + * Currency format (generic). + * Defaults to UNUM_CURRENCY_STANDARD style + * (using currency symbol, e.g., "$1.00", with non-accounting + * style for negative values e.g. using minus sign). + * The specific style may be specified using the -cf- locale key. + * @stable ICU 2.0 + */ + UNUM_CURRENCY=2, + /** + * Percent format + * @stable ICU 2.0 + */ + UNUM_PERCENT=3, + /** + * Scientific format + * @stable ICU 2.1 + */ + UNUM_SCIENTIFIC=4, + /** + * Spellout rule-based format. The default ruleset can be specified/changed using + * unum_setTextAttribute with UNUM_DEFAULT_RULESET; the available public rulesets + * can be listed using unum_getTextAttribute with UNUM_PUBLIC_RULESETS. + * @stable ICU 2.0 + */ + UNUM_SPELLOUT=5, + /** + * Ordinal rule-based format . The default ruleset can be specified/changed using + * unum_setTextAttribute with UNUM_DEFAULT_RULESET; the available public rulesets + * can be listed using unum_getTextAttribute with UNUM_PUBLIC_RULESETS. + * @stable ICU 3.0 + */ + UNUM_ORDINAL=6, + /** + * Duration rule-based format + * @stable ICU 3.0 + */ + UNUM_DURATION=7, + /** + * Numbering system rule-based format + * @stable ICU 4.2 + */ + UNUM_NUMBERING_SYSTEM=8, + /** + * Rule-based format defined by a pattern string. + * @stable ICU 3.0 + */ + UNUM_PATTERN_RULEBASED=9, + /** + * Currency format with an ISO currency code, e.g., "USD1.00". + * @stable ICU 4.8 + */ + UNUM_CURRENCY_ISO=10, + /** + * Currency format with a pluralized currency name, + * e.g., "1.00 US dollar" and "3.00 US dollars". + * @stable ICU 4.8 + */ + UNUM_CURRENCY_PLURAL=11, + /** + * Currency format for accounting, e.g., "($3.00)" for + * negative currency amount instead of "-$3.00" ({@link #UNUM_CURRENCY}). + * Overrides any style specified using -cf- key in locale. + * @stable ICU 53 + */ + UNUM_CURRENCY_ACCOUNTING=12, + /** + * Currency format with a currency symbol given CASH usage, e.g., + * "NT$3" instead of "NT$3.23". + * @stable ICU 54 + */ + UNUM_CASH_CURRENCY=13, + /** + * Decimal format expressed using compact notation + * (short form, corresponds to UNumberCompactStyle=UNUM_SHORT) + * e.g. "23K", "45B" + * @stable ICU 56 + */ + UNUM_DECIMAL_COMPACT_SHORT=14, + /** + * Decimal format expressed using compact notation + * (long form, corresponds to UNumberCompactStyle=UNUM_LONG) + * e.g. "23 thousand", "45 billion" + * @stable ICU 56 + */ + UNUM_DECIMAL_COMPACT_LONG=15, + /** + * Currency format with a currency symbol, e.g., "$1.00", + * using non-accounting style for negative values (e.g. minus sign). + * Overrides any style specified using -cf- key in locale. + * @stable ICU 56 + */ + UNUM_CURRENCY_STANDARD=16, + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UNumberFormatStyle value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UNUM_FORMAT_STYLE_COUNT=17, +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Default format + * @stable ICU 2.0 + */ + UNUM_DEFAULT = UNUM_DECIMAL, + /** + * Alias for UNUM_PATTERN_DECIMAL + * @stable ICU 3.0 + */ + UNUM_IGNORE = UNUM_PATTERN_DECIMAL +} UNumberFormatStyle; + +/** The possible number format rounding modes. + * + *

+ * For more detail on rounding modes, see: + * http://userguide.icu-project.org/formatparse/numbers/rounding-modes + * + * @stable ICU 2.0 + */ +typedef enum UNumberFormatRoundingMode { + UNUM_ROUND_CEILING, + UNUM_ROUND_FLOOR, + UNUM_ROUND_DOWN, + UNUM_ROUND_UP, + /** + * Half-even rounding + * @stable, ICU 3.8 + */ + UNUM_ROUND_HALFEVEN, +#ifndef U_HIDE_DEPRECATED_API + /** + * Half-even rounding, misspelled name + * @deprecated, ICU 3.8 + */ + UNUM_FOUND_HALFEVEN = UNUM_ROUND_HALFEVEN, +#endif /* U_HIDE_DEPRECATED_API */ + UNUM_ROUND_HALFDOWN = UNUM_ROUND_HALFEVEN + 1, + UNUM_ROUND_HALFUP, + /** + * ROUND_UNNECESSARY reports an error if formatted result is not exact. + * @stable ICU 4.8 + */ + UNUM_ROUND_UNNECESSARY +} UNumberFormatRoundingMode; + +/** The possible number format pad positions. + * @stable ICU 2.0 + */ +typedef enum UNumberFormatPadPosition { + UNUM_PAD_BEFORE_PREFIX, + UNUM_PAD_AFTER_PREFIX, + UNUM_PAD_BEFORE_SUFFIX, + UNUM_PAD_AFTER_SUFFIX +} UNumberFormatPadPosition; + +/** + * Constants for specifying short or long format. + * @stable ICU 51 + */ +typedef enum UNumberCompactStyle { + /** @stable ICU 51 */ + UNUM_SHORT, + /** @stable ICU 51 */ + UNUM_LONG + /** @stable ICU 51 */ +} UNumberCompactStyle; + +/** + * Constants for specifying currency spacing + * @stable ICU 4.8 + */ +enum UCurrencySpacing { + /** @stable ICU 4.8 */ + UNUM_CURRENCY_MATCH, + /** @stable ICU 4.8 */ + UNUM_CURRENCY_SURROUNDING_MATCH, + /** @stable ICU 4.8 */ + UNUM_CURRENCY_INSERT, + + /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API, + * it is needed for layout of DecimalFormatSymbols object. */ + /** + * One more than the highest normal UCurrencySpacing value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UNUM_CURRENCY_SPACING_COUNT +}; +typedef enum UCurrencySpacing UCurrencySpacing; /**< @stable ICU 4.8 */ + + +/** + * FieldPosition and UFieldPosition selectors for format fields + * defined by NumberFormat and UNumberFormat. + * @stable ICU 49 + */ +typedef enum UNumberFormatFields { + /** @stable ICU 49 */ + UNUM_INTEGER_FIELD, + /** @stable ICU 49 */ + UNUM_FRACTION_FIELD, + /** @stable ICU 49 */ + UNUM_DECIMAL_SEPARATOR_FIELD, + /** @stable ICU 49 */ + UNUM_EXPONENT_SYMBOL_FIELD, + /** @stable ICU 49 */ + UNUM_EXPONENT_SIGN_FIELD, + /** @stable ICU 49 */ + UNUM_EXPONENT_FIELD, + /** @stable ICU 49 */ + UNUM_GROUPING_SEPARATOR_FIELD, + /** @stable ICU 49 */ + UNUM_CURRENCY_FIELD, + /** @stable ICU 49 */ + UNUM_PERCENT_FIELD, + /** @stable ICU 49 */ + UNUM_PERMILL_FIELD, + /** @stable ICU 49 */ + UNUM_SIGN_FIELD, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UNumberFormatFields value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UNUM_FIELD_COUNT +#endif /* U_HIDE_DEPRECATED_API */ +} UNumberFormatFields; + + +/** + * Create and return a new UNumberFormat for formatting and parsing + * numbers. A UNumberFormat may be used to format numbers by calling + * {@link #unum_format }, and to parse numbers by calling {@link #unum_parse }. + * The caller must call {@link #unum_close } when done to release resources + * used by this object. + * @param style The type of number format to open: one of + * UNUM_DECIMAL, UNUM_CURRENCY, UNUM_PERCENT, UNUM_SCIENTIFIC, + * UNUM_CURRENCY_ISO, UNUM_CURRENCY_PLURAL, UNUM_SPELLOUT, + * UNUM_ORDINAL, UNUM_DURATION, UNUM_NUMBERING_SYSTEM, + * UNUM_PATTERN_DECIMAL, UNUM_PATTERN_RULEBASED, or UNUM_DEFAULT. + * If UNUM_PATTERN_DECIMAL or UNUM_PATTERN_RULEBASED is passed then the + * number format is opened using the given pattern, which must conform + * to the syntax described in DecimalFormat or RuleBasedNumberFormat, + * respectively. + * @param pattern A pattern specifying the format to use. + * This parameter is ignored unless the style is + * UNUM_PATTERN_DECIMAL or UNUM_PATTERN_RULEBASED. + * @param patternLength The number of characters in the pattern, or -1 + * if null-terminated. This parameter is ignored unless the style is + * UNUM_PATTERN. + * @param locale A locale identifier to use to determine formatting + * and parsing conventions, or NULL to use the default locale. + * @param parseErr A pointer to a UParseError struct to receive the + * details of any parsing errors, or NULL if no parsing error details + * are desired. + * @param status A pointer to an input-output UErrorCode. + * @return A pointer to a newly created UNumberFormat, or NULL if an + * error occurred. + * @see unum_close + * @see DecimalFormat + * @stable ICU 2.0 + */ +U_STABLE UNumberFormat* U_EXPORT2 +unum_open( UNumberFormatStyle style, + const UChar* pattern, + int32_t patternLength, + const char* locale, + UParseError* parseErr, + UErrorCode* status); + + +/** +* Close a UNumberFormat. +* Once closed, a UNumberFormat may no longer be used. +* @param fmt The formatter to close. +* @stable ICU 2.0 +*/ +U_STABLE void U_EXPORT2 +unum_close(UNumberFormat* fmt); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUNumberFormatPointer + * "Smart pointer" class, closes a UNumberFormat via unum_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberFormatPointer, UNumberFormat, unum_close); + +U_NAMESPACE_END + +#endif + +/** + * Open a copy of a UNumberFormat. + * This function performs a deep copy. + * @param fmt The format to copy + * @param status A pointer to an UErrorCode to receive any errors. + * @return A pointer to a UNumberFormat identical to fmt. + * @stable ICU 2.0 + */ +U_STABLE UNumberFormat* U_EXPORT2 +unum_clone(const UNumberFormat *fmt, + UErrorCode *status); + +/** +* Format an integer using a UNumberFormat. +* The integer will be formatted according to the UNumberFormat's locale. +* @param fmt The formatter to use. +* @param number The number to format. +* @param result A pointer to a buffer to receive the NULL-terminated formatted number. If +* the formatted number fits into dest but cannot be NULL-terminated (length == resultLength) +* then the error code is set to U_STRING_NOT_TERMINATED_WARNING. If the formatted number +* doesn't fit into result then the error code is set to U_BUFFER_OVERFLOW_ERROR. +* @param resultLength The maximum size of result. +* @param pos A pointer to a UFieldPosition. On input, position->field +* is read. On output, position->beginIndex and position->endIndex indicate +* the beginning and ending indices of field number position->field, if such +* a field exists. This parameter may be NULL, in which case no field +* @param status A pointer to an UErrorCode to receive any errors +* @return The total buffer size needed; if greater than resultLength, the output was truncated. +* @see unum_formatInt64 +* @see unum_formatDouble +* @see unum_parse +* @see unum_parseInt64 +* @see unum_parseDouble +* @see UFieldPosition +* @stable ICU 2.0 +*/ +U_STABLE int32_t U_EXPORT2 +unum_format( const UNumberFormat* fmt, + int32_t number, + UChar* result, + int32_t resultLength, + UFieldPosition *pos, + UErrorCode* status); + +/** +* Format an int64 using a UNumberFormat. +* The int64 will be formatted according to the UNumberFormat's locale. +* @param fmt The formatter to use. +* @param number The number to format. +* @param result A pointer to a buffer to receive the NULL-terminated formatted number. If +* the formatted number fits into dest but cannot be NULL-terminated (length == resultLength) +* then the error code is set to U_STRING_NOT_TERMINATED_WARNING. If the formatted number +* doesn't fit into result then the error code is set to U_BUFFER_OVERFLOW_ERROR. +* @param resultLength The maximum size of result. +* @param pos A pointer to a UFieldPosition. On input, position->field +* is read. On output, position->beginIndex and position->endIndex indicate +* the beginning and ending indices of field number position->field, if such +* a field exists. This parameter may be NULL, in which case no field +* @param status A pointer to an UErrorCode to receive any errors +* @return The total buffer size needed; if greater than resultLength, the output was truncated. +* @see unum_format +* @see unum_formatDouble +* @see unum_parse +* @see unum_parseInt64 +* @see unum_parseDouble +* @see UFieldPosition +* @stable ICU 2.0 +*/ +U_STABLE int32_t U_EXPORT2 +unum_formatInt64(const UNumberFormat *fmt, + int64_t number, + UChar* result, + int32_t resultLength, + UFieldPosition *pos, + UErrorCode* status); + +/** +* Format a double using a UNumberFormat. +* The double will be formatted according to the UNumberFormat's locale. +* @param fmt The formatter to use. +* @param number The number to format. +* @param result A pointer to a buffer to receive the NULL-terminated formatted number. If +* the formatted number fits into dest but cannot be NULL-terminated (length == resultLength) +* then the error code is set to U_STRING_NOT_TERMINATED_WARNING. If the formatted number +* doesn't fit into result then the error code is set to U_BUFFER_OVERFLOW_ERROR. +* @param resultLength The maximum size of result. +* @param pos A pointer to a UFieldPosition. On input, position->field +* is read. On output, position->beginIndex and position->endIndex indicate +* the beginning and ending indices of field number position->field, if such +* a field exists. This parameter may be NULL, in which case no field +* @param status A pointer to an UErrorCode to receive any errors +* @return The total buffer size needed; if greater than resultLength, the output was truncated. +* @see unum_format +* @see unum_formatInt64 +* @see unum_parse +* @see unum_parseInt64 +* @see unum_parseDouble +* @see UFieldPosition +* @stable ICU 2.0 +*/ +U_STABLE int32_t U_EXPORT2 +unum_formatDouble( const UNumberFormat* fmt, + double number, + UChar* result, + int32_t resultLength, + UFieldPosition *pos, /* 0 if ignore */ + UErrorCode* status); + +#ifndef U_HIDE_DRAFT_API +/** +* Format a double using a UNumberFormat according to the UNumberFormat's locale, +* and initialize a UFieldPositionIterator that enumerates the subcomponents of +* the resulting string. +* +* @param format +* The formatter to use. +* @param number +* The number to format. +* @param result +* A pointer to a buffer to receive the NULL-terminated formatted +* number. If the formatted number fits into dest but cannot be +* NULL-terminated (length == resultLength) then the error code is set +* to U_STRING_NOT_TERMINATED_WARNING. If the formatted number doesn't +* fit into result then the error code is set to +* U_BUFFER_OVERFLOW_ERROR. +* @param resultLength +* The maximum size of result. +* @param fpositer +* A pointer to a UFieldPositionIterator created by {@link #ufieldpositer_open} +* (may be NULL if field position information is not needed, but in this +* case it's preferable to use {@link #unum_formatDouble}). Iteration +* information already present in the UFieldPositionIterator is deleted, +* and the iterator is reset to apply to the fields in the formatted +* string created by this function call. The field values and indexes +* returned by {@link #ufieldpositer_next} represent fields denoted by +* the UNumberFormatFields enum. Fields are not returned in a guaranteed +* order. Fields cannot overlap, but they may nest. For example, 1234 +* could format as "1,234" which might consist of a grouping separator +* field for ',' and an integer field encompassing the entire string. +* @param status +* A pointer to an UErrorCode to receive any errors +* @return +* The total buffer size needed; if greater than resultLength, the +* output was truncated. +* @see unum_formatDouble +* @see unum_parse +* @see unum_parseDouble +* @see UFieldPositionIterator +* @see UNumberFormatFields +* @draft ICU 59 +*/ +U_DRAFT int32_t U_EXPORT2 +unum_formatDoubleForFields(const UNumberFormat* format, + double number, + UChar* result, + int32_t resultLength, + UFieldPositionIterator* fpositer, + UErrorCode* status); + +#endif /* U_HIDE_DRAFT_API */ + +/** +* Format a decimal number using a UNumberFormat. +* The number will be formatted according to the UNumberFormat's locale. +* The syntax of the input number is a "numeric string" +* as defined in the Decimal Arithmetic Specification, available at +* http://speleotrove.com/decimal +* @param fmt The formatter to use. +* @param number The number to format. +* @param length The length of the input number, or -1 if the input is nul-terminated. +* @param result A pointer to a buffer to receive the NULL-terminated formatted number. If +* the formatted number fits into dest but cannot be NULL-terminated (length == resultLength) +* then the error code is set to U_STRING_NOT_TERMINATED_WARNING. If the formatted number +* doesn't fit into result then the error code is set to U_BUFFER_OVERFLOW_ERROR. +* @param resultLength The maximum size of result. +* @param pos A pointer to a UFieldPosition. On input, position->field +* is read. On output, position->beginIndex and position->endIndex indicate +* the beginning and ending indices of field number position->field, if such +* a field exists. This parameter may be NULL, in which case it is ignored. +* @param status A pointer to an UErrorCode to receive any errors +* @return The total buffer size needed; if greater than resultLength, the output was truncated. +* @see unum_format +* @see unum_formatInt64 +* @see unum_parse +* @see unum_parseInt64 +* @see unum_parseDouble +* @see UFieldPosition +* @stable ICU 4.4 +*/ +U_STABLE int32_t U_EXPORT2 +unum_formatDecimal( const UNumberFormat* fmt, + const char * number, + int32_t length, + UChar* result, + int32_t resultLength, + UFieldPosition *pos, /* 0 if ignore */ + UErrorCode* status); + +/** + * Format a double currency amount using a UNumberFormat. + * The double will be formatted according to the UNumberFormat's locale. + * @param fmt the formatter to use + * @param number the number to format + * @param currency the 3-letter null-terminated ISO 4217 currency code + * @param result A pointer to a buffer to receive the NULL-terminated formatted number. If + * the formatted number fits into dest but cannot be NULL-terminated (length == resultLength) + * then the error code is set to U_STRING_NOT_TERMINATED_WARNING. If the formatted number + * doesn't fit into result then the error code is set to U_BUFFER_OVERFLOW_ERROR. + * @param resultLength the maximum number of UChars to write to result + * @param pos a pointer to a UFieldPosition. On input, + * position->field is read. On output, position->beginIndex and + * position->endIndex indicate the beginning and ending indices of + * field number position->field, if such a field exists. This + * parameter may be NULL, in which case it is ignored. + * @param status a pointer to an input-output UErrorCode + * @return the total buffer size needed; if greater than resultLength, + * the output was truncated. + * @see unum_formatDouble + * @see unum_parseDoubleCurrency + * @see UFieldPosition + * @stable ICU 3.0 + */ +U_STABLE int32_t U_EXPORT2 +unum_formatDoubleCurrency(const UNumberFormat* fmt, + double number, + UChar* currency, + UChar* result, + int32_t resultLength, + UFieldPosition* pos, + UErrorCode* status); + +/** + * Format a UFormattable into a string. + * @param fmt the formatter to use + * @param number the number to format, as a UFormattable + * @param result A pointer to a buffer to receive the NULL-terminated formatted number. If + * the formatted number fits into dest but cannot be NULL-terminated (length == resultLength) + * then the error code is set to U_STRING_NOT_TERMINATED_WARNING. If the formatted number + * doesn't fit into result then the error code is set to U_BUFFER_OVERFLOW_ERROR. + * @param resultLength the maximum number of UChars to write to result + * @param pos a pointer to a UFieldPosition. On input, + * position->field is read. On output, position->beginIndex and + * position->endIndex indicate the beginning and ending indices of + * field number position->field, if such a field exists. This + * parameter may be NULL, in which case it is ignored. + * @param status a pointer to an input-output UErrorCode + * @return the total buffer size needed; if greater than resultLength, + * the output was truncated. Will return 0 on error. + * @see unum_parseToUFormattable + * @stable ICU 52 + */ +U_STABLE int32_t U_EXPORT2 +unum_formatUFormattable(const UNumberFormat* fmt, + const UFormattable *number, + UChar *result, + int32_t resultLength, + UFieldPosition *pos, + UErrorCode *status); + +/** +* Parse a string into an integer using a UNumberFormat. +* The string will be parsed according to the UNumberFormat's locale. +* Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT +* and UNUM_DECIMAL_COMPACT_LONG. +* @param fmt The formatter to use. +* @param text The text to parse. +* @param textLength The length of text, or -1 if null-terminated. +* @param parsePos If not NULL, on input a pointer to an integer specifying the offset at which +* to begin parsing. If not NULL, on output the offset at which parsing ended. +* @param status A pointer to an UErrorCode to receive any errors +* @return The value of the parsed integer +* @see unum_parseInt64 +* @see unum_parseDouble +* @see unum_format +* @see unum_formatInt64 +* @see unum_formatDouble +* @stable ICU 2.0 +*/ +U_STABLE int32_t U_EXPORT2 +unum_parse( const UNumberFormat* fmt, + const UChar* text, + int32_t textLength, + int32_t *parsePos /* 0 = start */, + UErrorCode *status); + +/** +* Parse a string into an int64 using a UNumberFormat. +* The string will be parsed according to the UNumberFormat's locale. +* Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT +* and UNUM_DECIMAL_COMPACT_LONG. +* @param fmt The formatter to use. +* @param text The text to parse. +* @param textLength The length of text, or -1 if null-terminated. +* @param parsePos If not NULL, on input a pointer to an integer specifying the offset at which +* to begin parsing. If not NULL, on output the offset at which parsing ended. +* @param status A pointer to an UErrorCode to receive any errors +* @return The value of the parsed integer +* @see unum_parse +* @see unum_parseDouble +* @see unum_format +* @see unum_formatInt64 +* @see unum_formatDouble +* @stable ICU 2.8 +*/ +U_STABLE int64_t U_EXPORT2 +unum_parseInt64(const UNumberFormat* fmt, + const UChar* text, + int32_t textLength, + int32_t *parsePos /* 0 = start */, + UErrorCode *status); + +/** +* Parse a string into a double using a UNumberFormat. +* The string will be parsed according to the UNumberFormat's locale. +* Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT +* and UNUM_DECIMAL_COMPACT_LONG. +* @param fmt The formatter to use. +* @param text The text to parse. +* @param textLength The length of text, or -1 if null-terminated. +* @param parsePos If not NULL, on input a pointer to an integer specifying the offset at which +* to begin parsing. If not NULL, on output the offset at which parsing ended. +* @param status A pointer to an UErrorCode to receive any errors +* @return The value of the parsed double +* @see unum_parse +* @see unum_parseInt64 +* @see unum_format +* @see unum_formatInt64 +* @see unum_formatDouble +* @stable ICU 2.0 +*/ +U_STABLE double U_EXPORT2 +unum_parseDouble( const UNumberFormat* fmt, + const UChar* text, + int32_t textLength, + int32_t *parsePos /* 0 = start */, + UErrorCode *status); + + +/** +* Parse a number from a string into an unformatted numeric string using a UNumberFormat. +* The input string will be parsed according to the UNumberFormat's locale. +* The syntax of the output is a "numeric string" +* as defined in the Decimal Arithmetic Specification, available at +* http://speleotrove.com/decimal +* Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT +* and UNUM_DECIMAL_COMPACT_LONG. +* @param fmt The formatter to use. +* @param text The text to parse. +* @param textLength The length of text, or -1 if null-terminated. +* @param parsePos If not NULL, on input a pointer to an integer specifying the offset at which +* to begin parsing. If not NULL, on output the offset at which parsing ended. +* @param outBuf A (char *) buffer to receive the parsed number as a string. The output string +* will be nul-terminated if there is sufficient space. +* @param outBufLength The size of the output buffer. May be zero, in which case +* the outBuf pointer may be NULL, and the function will return the +* size of the output string. +* @param status A pointer to an UErrorCode to receive any errors +* @return the length of the output string, not including any terminating nul. +* @see unum_parse +* @see unum_parseInt64 +* @see unum_format +* @see unum_formatInt64 +* @see unum_formatDouble +* @stable ICU 4.4 +*/ +U_STABLE int32_t U_EXPORT2 +unum_parseDecimal(const UNumberFormat* fmt, + const UChar* text, + int32_t textLength, + int32_t *parsePos /* 0 = start */, + char *outBuf, + int32_t outBufLength, + UErrorCode *status); + +/** + * Parse a string into a double and a currency using a UNumberFormat. + * The string will be parsed according to the UNumberFormat's locale. + * @param fmt the formatter to use + * @param text the text to parse + * @param textLength the length of text, or -1 if null-terminated + * @param parsePos a pointer to an offset index into text at which to + * begin parsing. On output, *parsePos will point after the last + * parsed character. This parameter may be NULL, in which case parsing + * begins at offset 0. + * @param currency a pointer to the buffer to receive the parsed null- + * terminated currency. This buffer must have a capacity of at least + * 4 UChars. + * @param status a pointer to an input-output UErrorCode + * @return the parsed double + * @see unum_parseDouble + * @see unum_formatDoubleCurrency + * @stable ICU 3.0 + */ +U_STABLE double U_EXPORT2 +unum_parseDoubleCurrency(const UNumberFormat* fmt, + const UChar* text, + int32_t textLength, + int32_t* parsePos, /* 0 = start */ + UChar* currency, + UErrorCode* status); + +/** + * Parse a UChar string into a UFormattable. + * Example code: + * \snippet test/cintltst/cnumtst.c unum_parseToUFormattable + * Note: parsing is not supported for styles UNUM_DECIMAL_COMPACT_SHORT + * and UNUM_DECIMAL_COMPACT_LONG. + * @param fmt the formatter to use + * @param result the UFormattable to hold the result. If NULL, a new UFormattable will be allocated (which the caller must close with ufmt_close). + * @param text the text to parse + * @param textLength the length of text, or -1 if null-terminated + * @param parsePos a pointer to an offset index into text at which to + * begin parsing. On output, *parsePos will point after the last + * parsed character. This parameter may be NULL in which case parsing + * begins at offset 0. + * @param status a pointer to an input-output UErrorCode + * @return the UFormattable. Will be ==result unless NULL was passed in for result, in which case it will be the newly opened UFormattable. + * @see ufmt_getType + * @see ufmt_close + * @stable ICU 52 + */ +U_STABLE UFormattable* U_EXPORT2 +unum_parseToUFormattable(const UNumberFormat* fmt, + UFormattable *result, + const UChar* text, + int32_t textLength, + int32_t* parsePos, /* 0 = start */ + UErrorCode* status); + +/** + * Set the pattern used by a UNumberFormat. This can only be used + * on a DecimalFormat, other formats return U_UNSUPPORTED_ERROR + * in the status. + * @param format The formatter to set. + * @param localized TRUE if the pattern is localized, FALSE otherwise. + * @param pattern The new pattern + * @param patternLength The length of pattern, or -1 if null-terminated. + * @param parseError A pointer to UParseError to receive information + * about errors occurred during parsing, or NULL if no parse error + * information is desired. + * @param status A pointer to an input-output UErrorCode. + * @see unum_toPattern + * @see DecimalFormat + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +unum_applyPattern( UNumberFormat *format, + UBool localized, + const UChar *pattern, + int32_t patternLength, + UParseError *parseError, + UErrorCode *status + ); + +/** +* Get a locale for which decimal formatting patterns are available. +* A UNumberFormat in a locale returned by this function will perform the correct +* formatting and parsing for the locale. The results of this call are not +* valid for rule-based number formats. +* @param localeIndex The index of the desired locale. +* @return A locale for which number formatting patterns are available, or 0 if none. +* @see unum_countAvailable +* @stable ICU 2.0 +*/ +U_STABLE const char* U_EXPORT2 +unum_getAvailable(int32_t localeIndex); + +/** +* Determine how many locales have decimal formatting patterns available. The +* results of this call are not valid for rule-based number formats. +* This function is useful for determining the loop ending condition for +* calls to {@link #unum_getAvailable }. +* @return The number of locales for which decimal formatting patterns are available. +* @see unum_getAvailable +* @stable ICU 2.0 +*/ +U_STABLE int32_t U_EXPORT2 +unum_countAvailable(void); + +#if UCONFIG_HAVE_PARSEALLINPUT +/* The UNumberFormatAttributeValue type cannot be #ifndef U_HIDE_INTERNAL_API, needed for .h variable declaration */ +/** + * @internal + */ +typedef enum UNumberFormatAttributeValue { +#ifndef U_HIDE_INTERNAL_API + /** @internal */ + UNUM_NO = 0, + /** @internal */ + UNUM_YES = 1, + /** @internal */ + UNUM_MAYBE = 2 +#else + /** @internal */ + UNUM_FORMAT_ATTRIBUTE_VALUE_HIDDEN +#endif /* U_HIDE_INTERNAL_API */ +} UNumberFormatAttributeValue; +#endif + +/** The possible UNumberFormat numeric attributes @stable ICU 2.0 */ +typedef enum UNumberFormatAttribute { + /** Parse integers only */ + UNUM_PARSE_INT_ONLY, + /** Use grouping separator */ + UNUM_GROUPING_USED, + /** Always show decimal point */ + UNUM_DECIMAL_ALWAYS_SHOWN, + /** Maximum integer digits */ + UNUM_MAX_INTEGER_DIGITS, + /** Minimum integer digits */ + UNUM_MIN_INTEGER_DIGITS, + /** Integer digits */ + UNUM_INTEGER_DIGITS, + /** Maximum fraction digits */ + UNUM_MAX_FRACTION_DIGITS, + /** Minimum fraction digits */ + UNUM_MIN_FRACTION_DIGITS, + /** Fraction digits */ + UNUM_FRACTION_DIGITS, + /** Multiplier */ + UNUM_MULTIPLIER, + /** Grouping size */ + UNUM_GROUPING_SIZE, + /** Rounding Mode */ + UNUM_ROUNDING_MODE, + /** Rounding increment */ + UNUM_ROUNDING_INCREMENT, + /** The width to which the output of format() is padded. */ + UNUM_FORMAT_WIDTH, + /** The position at which padding will take place. */ + UNUM_PADDING_POSITION, + /** Secondary grouping size */ + UNUM_SECONDARY_GROUPING_SIZE, + /** Use significant digits + * @stable ICU 3.0 */ + UNUM_SIGNIFICANT_DIGITS_USED, + /** Minimum significant digits + * @stable ICU 3.0 */ + UNUM_MIN_SIGNIFICANT_DIGITS, + /** Maximum significant digits + * @stable ICU 3.0 */ + UNUM_MAX_SIGNIFICANT_DIGITS, + /** Lenient parse mode used by rule-based formats. + * @stable ICU 3.0 + */ + UNUM_LENIENT_PARSE, +#if UCONFIG_HAVE_PARSEALLINPUT + /** Consume all input. (may use fastpath). Set to UNUM_YES (require fastpath), UNUM_NO (skip fastpath), or UNUM_MAYBE (heuristic). + * This is an internal ICU API. Do not use. + * @internal + */ + UNUM_PARSE_ALL_INPUT = 20, +#endif + /** + * Scale, which adjusts the position of the + * decimal point when formatting. Amounts will be multiplied by 10 ^ (scale) + * before they are formatted. The default value for the scale is 0 ( no adjustment ). + * + *

Example: setting the scale to 3, 123 formats as "123,000" + *

Example: setting the scale to -4, 123 formats as "0.0123" + * + * @stable ICU 51 */ + UNUM_SCALE = 21, +#ifndef U_HIDE_INTERNAL_API + /** + * Minimum grouping digits, technology preview. + * See DecimalFormat::getMinimumGroupingDigits(). + * + * @internal technology preview + */ + UNUM_MINIMUM_GROUPING_DIGITS = 22, + /* TODO: test C API when it becomes @draft */ +#endif /* U_HIDE_INTERNAL_API */ + + /** + * if this attribute is set to 0, it is set to UNUM_CURRENCY_STANDARD purpose, + * otherwise it is UNUM_CURRENCY_CASH purpose + * Default: 0 (UNUM_CURRENCY_STANDARD purpose) + * @stable ICU 54 + */ + UNUM_CURRENCY_USAGE = 23, + + /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file variable declararions */ + /** One below the first bitfield-boolean item. + * All items after this one are stored in boolean form. + * @internal */ + UNUM_MAX_NONBOOLEAN_ATTRIBUTE = 0x0FFF, + + /** If 1, specifies that if setting the "max integer digits" attribute would truncate a value, set an error status rather than silently truncating. + * For example, formatting the value 1234 with 4 max int digits would succeed, but formatting 12345 would fail. There is no effect on parsing. + * Default: 0 (not set) + * @stable ICU 50 + */ + UNUM_FORMAT_FAIL_IF_MORE_THAN_MAX_DIGITS = 0x1000, + /** + * if this attribute is set to 1, specifies that, if the pattern doesn't contain an exponent, the exponent will not be parsed. If the pattern does contain an exponent, this attribute has no effect. + * Has no effect on formatting. + * Default: 0 (unset) + * @stable ICU 50 + */ + UNUM_PARSE_NO_EXPONENT, + + /** + * if this attribute is set to 1, specifies that, if the pattern contains a + * decimal mark the input is required to have one. If this attribute is set to 0, + * specifies that input does not have to contain a decimal mark. + * Has no effect on formatting. + * Default: 0 (unset) + * @stable ICU 54 + */ + UNUM_PARSE_DECIMAL_MARK_REQUIRED = 0x1002, + + /* The following cannot be #ifndef U_HIDE_INTERNAL_API, needed in .h file variable declararions */ + /** Limit of boolean attributes. + * @internal */ + UNUM_LIMIT_BOOLEAN_ATTRIBUTE = 0x1003 +} UNumberFormatAttribute; + +/** +* Get a numeric attribute associated with a UNumberFormat. +* An example of a numeric attribute is the number of integer digits a formatter will produce. +* @param fmt The formatter to query. +* @param attr The attribute to query; one of UNUM_PARSE_INT_ONLY, UNUM_GROUPING_USED, +* UNUM_DECIMAL_ALWAYS_SHOWN, UNUM_MAX_INTEGER_DIGITS, UNUM_MIN_INTEGER_DIGITS, UNUM_INTEGER_DIGITS, +* UNUM_MAX_FRACTION_DIGITS, UNUM_MIN_FRACTION_DIGITS, UNUM_FRACTION_DIGITS, UNUM_MULTIPLIER, +* UNUM_GROUPING_SIZE, UNUM_ROUNDING_MODE, UNUM_FORMAT_WIDTH, UNUM_PADDING_POSITION, UNUM_SECONDARY_GROUPING_SIZE, +* UNUM_SCALE, UNUM_MINIMUM_GROUPING_DIGITS. +* @return The value of attr. +* @see unum_setAttribute +* @see unum_getDoubleAttribute +* @see unum_setDoubleAttribute +* @see unum_getTextAttribute +* @see unum_setTextAttribute +* @stable ICU 2.0 +*/ +U_STABLE int32_t U_EXPORT2 +unum_getAttribute(const UNumberFormat* fmt, + UNumberFormatAttribute attr); + +/** +* Set a numeric attribute associated with a UNumberFormat. +* An example of a numeric attribute is the number of integer digits a formatter will produce. If the +* formatter does not understand the attribute, the call is ignored. Rule-based formatters only understand +* the lenient-parse attribute. +* @param fmt The formatter to set. +* @param attr The attribute to set; one of UNUM_PARSE_INT_ONLY, UNUM_GROUPING_USED, +* UNUM_DECIMAL_ALWAYS_SHOWN, UNUM_MAX_INTEGER_DIGITS, UNUM_MIN_INTEGER_DIGITS, UNUM_INTEGER_DIGITS, +* UNUM_MAX_FRACTION_DIGITS, UNUM_MIN_FRACTION_DIGITS, UNUM_FRACTION_DIGITS, UNUM_MULTIPLIER, +* UNUM_GROUPING_SIZE, UNUM_ROUNDING_MODE, UNUM_FORMAT_WIDTH, UNUM_PADDING_POSITION, UNUM_SECONDARY_GROUPING_SIZE, +* UNUM_LENIENT_PARSE, UNUM_SCALE, UNUM_MINIMUM_GROUPING_DIGITS. +* @param newValue The new value of attr. +* @see unum_getAttribute +* @see unum_getDoubleAttribute +* @see unum_setDoubleAttribute +* @see unum_getTextAttribute +* @see unum_setTextAttribute +* @stable ICU 2.0 +*/ +U_STABLE void U_EXPORT2 +unum_setAttribute( UNumberFormat* fmt, + UNumberFormatAttribute attr, + int32_t newValue); + + +/** +* Get a numeric attribute associated with a UNumberFormat. +* An example of a numeric attribute is the number of integer digits a formatter will produce. +* If the formatter does not understand the attribute, -1 is returned. +* @param fmt The formatter to query. +* @param attr The attribute to query; e.g. UNUM_ROUNDING_INCREMENT. +* @return The value of attr. +* @see unum_getAttribute +* @see unum_setAttribute +* @see unum_setDoubleAttribute +* @see unum_getTextAttribute +* @see unum_setTextAttribute +* @stable ICU 2.0 +*/ +U_STABLE double U_EXPORT2 +unum_getDoubleAttribute(const UNumberFormat* fmt, + UNumberFormatAttribute attr); + +/** +* Set a numeric attribute associated with a UNumberFormat. +* An example of a numeric attribute is the number of integer digits a formatter will produce. +* If the formatter does not understand the attribute, this call is ignored. +* @param fmt The formatter to set. +* @param attr The attribute to set; e.g. UNUM_ROUNDING_INCREMENT. +* @param newValue The new value of attr. +* @see unum_getAttribute +* @see unum_setAttribute +* @see unum_getDoubleAttribute +* @see unum_getTextAttribute +* @see unum_setTextAttribute +* @stable ICU 2.0 +*/ +U_STABLE void U_EXPORT2 +unum_setDoubleAttribute( UNumberFormat* fmt, + UNumberFormatAttribute attr, + double newValue); + +/** The possible UNumberFormat text attributes @stable ICU 2.0*/ +typedef enum UNumberFormatTextAttribute { + /** Positive prefix */ + UNUM_POSITIVE_PREFIX, + /** Positive suffix */ + UNUM_POSITIVE_SUFFIX, + /** Negative prefix */ + UNUM_NEGATIVE_PREFIX, + /** Negative suffix */ + UNUM_NEGATIVE_SUFFIX, + /** The character used to pad to the format width. */ + UNUM_PADDING_CHARACTER, + /** The ISO currency code */ + UNUM_CURRENCY_CODE, + /** + * The default rule set, such as "%spellout-numbering-year:", "%spellout-cardinal:", + * "%spellout-ordinal-masculine-plural:", "%spellout-ordinal-feminine:", or + * "%spellout-ordinal-neuter:". The available public rulesets can be listed using + * unum_getTextAttribute with UNUM_PUBLIC_RULESETS. This is only available with + * rule-based formatters. + * @stable ICU 3.0 + */ + UNUM_DEFAULT_RULESET, + /** + * The public rule sets. This is only available with rule-based formatters. + * This is a read-only attribute. The public rulesets are returned as a + * single string, with each ruleset name delimited by ';' (semicolon). See the + * CLDR LDML spec for more information about RBNF rulesets: + * http://www.unicode.org/reports/tr35/tr35-numbers.html#Rule-Based_Number_Formatting + * @stable ICU 3.0 + */ + UNUM_PUBLIC_RULESETS +} UNumberFormatTextAttribute; + +/** +* Get a text attribute associated with a UNumberFormat. +* An example of a text attribute is the suffix for positive numbers. If the formatter +* does not understand the attribute, U_UNSUPPORTED_ERROR is returned as the status. +* Rule-based formatters only understand UNUM_DEFAULT_RULESET and UNUM_PUBLIC_RULESETS. +* @param fmt The formatter to query. +* @param tag The attribute to query; one of UNUM_POSITIVE_PREFIX, UNUM_POSITIVE_SUFFIX, +* UNUM_NEGATIVE_PREFIX, UNUM_NEGATIVE_SUFFIX, UNUM_PADDING_CHARACTER, UNUM_CURRENCY_CODE, +* UNUM_DEFAULT_RULESET, or UNUM_PUBLIC_RULESETS. +* @param result A pointer to a buffer to receive the attribute. +* @param resultLength The maximum size of result. +* @param status A pointer to an UErrorCode to receive any errors +* @return The total buffer size needed; if greater than resultLength, the output was truncated. +* @see unum_setTextAttribute +* @see unum_getAttribute +* @see unum_setAttribute +* @stable ICU 2.0 +*/ +U_STABLE int32_t U_EXPORT2 +unum_getTextAttribute( const UNumberFormat* fmt, + UNumberFormatTextAttribute tag, + UChar* result, + int32_t resultLength, + UErrorCode* status); + +/** +* Set a text attribute associated with a UNumberFormat. +* An example of a text attribute is the suffix for positive numbers. Rule-based formatters +* only understand UNUM_DEFAULT_RULESET. +* @param fmt The formatter to set. +* @param tag The attribute to set; one of UNUM_POSITIVE_PREFIX, UNUM_POSITIVE_SUFFIX, +* UNUM_NEGATIVE_PREFIX, UNUM_NEGATIVE_SUFFIX, UNUM_PADDING_CHARACTER, UNUM_CURRENCY_CODE, +* or UNUM_DEFAULT_RULESET. +* @param newValue The new value of attr. +* @param newValueLength The length of newValue, or -1 if null-terminated. +* @param status A pointer to an UErrorCode to receive any errors +* @see unum_getTextAttribute +* @see unum_getAttribute +* @see unum_setAttribute +* @stable ICU 2.0 +*/ +U_STABLE void U_EXPORT2 +unum_setTextAttribute( UNumberFormat* fmt, + UNumberFormatTextAttribute tag, + const UChar* newValue, + int32_t newValueLength, + UErrorCode *status); + +/** + * Extract the pattern from a UNumberFormat. The pattern will follow + * the DecimalFormat pattern syntax. + * @param fmt The formatter to query. + * @param isPatternLocalized TRUE if the pattern should be localized, + * FALSE otherwise. This is ignored if the formatter is a rule-based + * formatter. + * @param result A pointer to a buffer to receive the pattern. + * @param resultLength The maximum size of result. + * @param status A pointer to an input-output UErrorCode. + * @return The total buffer size needed; if greater than resultLength, + * the output was truncated. + * @see unum_applyPattern + * @see DecimalFormat + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +unum_toPattern( const UNumberFormat* fmt, + UBool isPatternLocalized, + UChar* result, + int32_t resultLength, + UErrorCode* status); + + +/** + * Constants for specifying a number format symbol. + * @stable ICU 2.0 + */ +typedef enum UNumberFormatSymbol { + /** The decimal separator */ + UNUM_DECIMAL_SEPARATOR_SYMBOL = 0, + /** The grouping separator */ + UNUM_GROUPING_SEPARATOR_SYMBOL = 1, + /** The pattern separator */ + UNUM_PATTERN_SEPARATOR_SYMBOL = 2, + /** The percent sign */ + UNUM_PERCENT_SYMBOL = 3, + /** Zero*/ + UNUM_ZERO_DIGIT_SYMBOL = 4, + /** Character representing a digit in the pattern */ + UNUM_DIGIT_SYMBOL = 5, + /** The minus sign */ + UNUM_MINUS_SIGN_SYMBOL = 6, + /** The plus sign */ + UNUM_PLUS_SIGN_SYMBOL = 7, + /** The currency symbol */ + UNUM_CURRENCY_SYMBOL = 8, + /** The international currency symbol */ + UNUM_INTL_CURRENCY_SYMBOL = 9, + /** The monetary separator */ + UNUM_MONETARY_SEPARATOR_SYMBOL = 10, + /** The exponential symbol */ + UNUM_EXPONENTIAL_SYMBOL = 11, + /** Per mill symbol */ + UNUM_PERMILL_SYMBOL = 12, + /** Escape padding character */ + UNUM_PAD_ESCAPE_SYMBOL = 13, + /** Infinity symbol */ + UNUM_INFINITY_SYMBOL = 14, + /** Nan symbol */ + UNUM_NAN_SYMBOL = 15, + /** Significant digit symbol + * @stable ICU 3.0 */ + UNUM_SIGNIFICANT_DIGIT_SYMBOL = 16, + /** The monetary grouping separator + * @stable ICU 3.6 + */ + UNUM_MONETARY_GROUPING_SEPARATOR_SYMBOL = 17, + /** One + * @stable ICU 4.6 + */ + UNUM_ONE_DIGIT_SYMBOL = 18, + /** Two + * @stable ICU 4.6 + */ + UNUM_TWO_DIGIT_SYMBOL = 19, + /** Three + * @stable ICU 4.6 + */ + UNUM_THREE_DIGIT_SYMBOL = 20, + /** Four + * @stable ICU 4.6 + */ + UNUM_FOUR_DIGIT_SYMBOL = 21, + /** Five + * @stable ICU 4.6 + */ + UNUM_FIVE_DIGIT_SYMBOL = 22, + /** Six + * @stable ICU 4.6 + */ + UNUM_SIX_DIGIT_SYMBOL = 23, + /** Seven + * @stable ICU 4.6 + */ + UNUM_SEVEN_DIGIT_SYMBOL = 24, + /** Eight + * @stable ICU 4.6 + */ + UNUM_EIGHT_DIGIT_SYMBOL = 25, + /** Nine + * @stable ICU 4.6 + */ + UNUM_NINE_DIGIT_SYMBOL = 26, + + /** Multiplication sign + * @stable ICU 54 + */ + UNUM_EXPONENT_MULTIPLICATION_SYMBOL = 27, + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UNumberFormatSymbol value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UNUM_FORMAT_SYMBOL_COUNT = 28 +#endif /* U_HIDE_DEPRECATED_API */ +} UNumberFormatSymbol; + +/** +* Get a symbol associated with a UNumberFormat. +* A UNumberFormat uses symbols to represent the special locale-dependent +* characters in a number, for example the percent sign. This API is not +* supported for rule-based formatters. +* @param fmt The formatter to query. +* @param symbol The UNumberFormatSymbol constant for the symbol to get +* @param buffer The string buffer that will receive the symbol string; +* if it is NULL, then only the length of the symbol is returned +* @param size The size of the string buffer +* @param status A pointer to an UErrorCode to receive any errors +* @return The length of the symbol; the buffer is not modified if +* length>=size +* @see unum_setSymbol +* @stable ICU 2.0 +*/ +U_STABLE int32_t U_EXPORT2 +unum_getSymbol(const UNumberFormat *fmt, + UNumberFormatSymbol symbol, + UChar *buffer, + int32_t size, + UErrorCode *status); + +/** +* Set a symbol associated with a UNumberFormat. +* A UNumberFormat uses symbols to represent the special locale-dependent +* characters in a number, for example the percent sign. This API is not +* supported for rule-based formatters. +* @param fmt The formatter to set. +* @param symbol The UNumberFormatSymbol constant for the symbol to set +* @param value The string to set the symbol to +* @param length The length of the string, or -1 for a zero-terminated string +* @param status A pointer to an UErrorCode to receive any errors. +* @see unum_getSymbol +* @stable ICU 2.0 +*/ +U_STABLE void U_EXPORT2 +unum_setSymbol(UNumberFormat *fmt, + UNumberFormatSymbol symbol, + const UChar *value, + int32_t length, + UErrorCode *status); + + +/** + * Get the locale for this number format object. + * You can choose between valid and actual locale. + * @param fmt The formatter to get the locale from + * @param type type of the locale we're looking for (valid or actual) + * @param status error code for the operation + * @return the locale name + * @stable ICU 2.8 + */ +U_STABLE const char* U_EXPORT2 +unum_getLocaleByType(const UNumberFormat *fmt, + ULocDataLocaleType type, + UErrorCode* status); + +/** + * Set a particular UDisplayContext value in the formatter, such as + * UDISPCTX_CAPITALIZATION_FOR_STANDALONE. + * @param fmt The formatter for which to set a UDisplayContext value. + * @param value The UDisplayContext value to set. + * @param status A pointer to an UErrorCode to receive any errors + * @stable ICU 53 + */ +U_STABLE void U_EXPORT2 +unum_setContext(UNumberFormat* fmt, UDisplayContext value, UErrorCode* status); + +/** + * Get the formatter's UDisplayContext value for the specified UDisplayContextType, + * such as UDISPCTX_TYPE_CAPITALIZATION. + * @param fmt The formatter to query. + * @param type The UDisplayContextType whose value to return + * @param status A pointer to an UErrorCode to receive any errors + * @return The UDisplayContextValue for the specified type. + * @stable ICU 53 + */ +U_STABLE UDisplayContext U_EXPORT2 +unum_getContext(const UNumberFormat *fmt, UDisplayContextType type, UErrorCode* status); + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/unumsys.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/unumsys.h new file mode 100644 index 0000000..795ec60 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/unumsys.h @@ -0,0 +1,172 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +***************************************************************************************** +* Copyright (C) 2013-2014, International Business Machines +* Corporation and others. All Rights Reserved. +***************************************************************************************** +*/ + +#ifndef UNUMSYS_H +#define UNUMSYS_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/uenum.h" +#include "unicode/localpointer.h" + +/** + * \file + * \brief C API: UNumberingSystem, information about numbering systems + * + * Defines numbering systems. A numbering system describes the scheme by which + * numbers are to be presented to the end user. In its simplest form, a numbering + * system describes the set of digit characters that are to be used to display + * numbers, such as Western digits, Thai digits, Arabic-Indic digits, etc., in a + * positional numbering system with a specified radix (typically 10). + * More complicated numbering systems are algorithmic in nature, and require use + * of an RBNF formatter (rule based number formatter), in order to calculate + * the characters to be displayed for a given number. Examples of algorithmic + * numbering systems include Roman numerals, Chinese numerals, and Hebrew numerals. + * Formatting rules for many commonly used numbering systems are included in + * the ICU package, based on the numbering system rules defined in CLDR. + * Alternate numbering systems can be specified to a locale by using the + * numbers locale keyword. + */ + +/** + * Opaque UNumberingSystem object for use in C programs. + * @stable ICU 52 + */ +struct UNumberingSystem; +typedef struct UNumberingSystem UNumberingSystem; /**< C typedef for struct UNumberingSystem. @stable ICU 52 */ + +/** + * Opens a UNumberingSystem object using the default numbering system for the specified + * locale. + * @param locale The locale for which the default numbering system should be opened. + * @param status A pointer to a UErrorCode to receive any errors. For example, this + * may be U_UNSUPPORTED_ERROR for a locale such as "en@numbers=xyz" that + * specifies a numbering system unknown to ICU. + * @return A UNumberingSystem for the specified locale, or NULL if an error + * occurred. + * @stable ICU 52 + */ +U_STABLE UNumberingSystem * U_EXPORT2 +unumsys_open(const char *locale, UErrorCode *status); + +/** + * Opens a UNumberingSystem object using the name of one of the predefined numbering + * systems specified by CLDR and known to ICU, such as "latn", "arabext", or "hanidec"; + * the full list is returned by unumsys_openAvailableNames. Note that some of the names + * listed at http://unicode.org/repos/cldr/tags/latest/common/bcp47/number.xml - e.g. + * default, native, traditional, finance - do not identify specific numbering systems, + * but rather key values that may only be used as part of a locale, which in turn + * defines how they are mapped to a specific numbering system such as "latn" or "hant". + * + * @param name The name of the numbering system for which a UNumberingSystem object + * should be opened. + * @param status A pointer to a UErrorCode to receive any errors. For example, this + * may be U_UNSUPPORTED_ERROR for a numbering system such as "xyz" that + * is unknown to ICU. + * @return A UNumberingSystem for the specified name, or NULL if an error + * occurred. + * @stable ICU 52 + */ +U_STABLE UNumberingSystem * U_EXPORT2 +unumsys_openByName(const char *name, UErrorCode *status); + +/** + * Close a UNumberingSystem object. Once closed it may no longer be used. + * @param unumsys The UNumberingSystem object to close. + * @stable ICU 52 + */ +U_STABLE void U_EXPORT2 +unumsys_close(UNumberingSystem *unumsys); + +#if U_SHOW_CPLUSPLUS_API +U_NAMESPACE_BEGIN + +/** + * \class LocalUNumberingSystemPointer + * "Smart pointer" class, closes a UNumberingSystem via unumsys_close(). + * For most methods see the LocalPointerBase base class. + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 52 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUNumberingSystemPointer, UNumberingSystem, unumsys_close); + +U_NAMESPACE_END +#endif + +/** + * Returns an enumeration over the names of all of the predefined numbering systems known + * to ICU. + * @param status A pointer to a UErrorCode to receive any errors. + * @return A pointer to a UEnumeration that must be closed with uenum_close(), + * or NULL if an error occurred. + * @stable ICU 52 + */ +U_STABLE UEnumeration * U_EXPORT2 +unumsys_openAvailableNames(UErrorCode *status); + +/** + * Returns the name of the specified UNumberingSystem object (if it is one of the + * predefined names known to ICU). + * @param unumsys The UNumberingSystem whose name is desired. + * @return A pointer to the name of the specified UNumberingSystem object, or + * NULL if the name is not one of the ICU predefined names. The pointer + * is only valid for the lifetime of the UNumberingSystem object. + * @stable ICU 52 + */ +U_STABLE const char * U_EXPORT2 +unumsys_getName(const UNumberingSystem *unumsys); + +/** + * Returns whether the given UNumberingSystem object is for an algorithmic (not purely + * positional) system. + * @param unumsys The UNumberingSystem whose algorithmic status is desired. + * @return TRUE if the specified UNumberingSystem object is for an algorithmic + * system. + * @stable ICU 52 + */ +U_STABLE UBool U_EXPORT2 +unumsys_isAlgorithmic(const UNumberingSystem *unumsys); + +/** + * Returns the radix of the specified UNumberingSystem object. Simple positional + * numbering systems typically have radix 10, but might have a radix of e.g. 16 for + * hexadecimal. The radix is less well-defined for non-positional algorithmic systems. + * @param unumsys The UNumberingSystem whose radix is desired. + * @return The radix of the specified UNumberingSystem object. + * @stable ICU 52 + */ +U_STABLE int32_t U_EXPORT2 +unumsys_getRadix(const UNumberingSystem *unumsys); + +/** + * Get the description string of the specified UNumberingSystem object. For simple + * positional systems this is the ordered string of digits (with length matching + * the radix), e.g. "\u3007\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D" + * for "hanidec"; it would be "0123456789ABCDEF" for hexadecimal. For + * algorithmic systems this is the name of the RBNF ruleset used for formatting, + * e.g. "zh/SpelloutRules/%spellout-cardinal" for "hans" or "%greek-upper" for + * "grek". + * @param unumsys The UNumberingSystem whose description string is desired. + * @param result A pointer to a buffer to receive the description string. + * @param resultLength The maximum size of result. + * @param status A pointer to a UErrorCode to receive any errors. + * @return The total buffer size needed; if greater than resultLength, the + * output was truncated. + * @stable ICU 52 + */ +U_STABLE int32_t U_EXPORT2 +unumsys_getDescription(const UNumberingSystem *unumsys, UChar *result, + int32_t resultLength, UErrorCode *status); + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/uobject.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/uobject.h new file mode 100644 index 0000000..9782f27 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/uobject.h @@ -0,0 +1,322 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2002-2012, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: uobject.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2002jun26 +* created by: Markus W. Scherer +*/ + +#ifndef __UOBJECT_H__ +#define __UOBJECT_H__ + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: Common ICU base class UObject. + */ + +/** + * @{ + * \def U_NO_THROW + * Define this to define the throw() specification so + * certain functions do not throw any exceptions + * + * UMemory operator new methods should have the throw() specification + * appended to them, so that the compiler adds the additional NULL check + * before calling constructors. Without, if operator new returns NULL the + * constructor is still called, and if the constructor references member + * data, (which it typically does), the result is a segmentation violation. + * + * @stable ICU 4.2 + */ +#ifndef U_NO_THROW +#define U_NO_THROW throw() +#endif + +/** @} */ + +/*===========================================================================*/ +/* UClassID-based RTTI */ +/*===========================================================================*/ + +/** + * UClassID is used to identify classes without using the compiler's RTTI. + * This was used before C++ compilers consistently supported RTTI. + * ICU 4.6 requires compiler RTTI to be turned on. + * + * Each class hierarchy which needs + * to implement polymorphic clone() or operator==() defines two methods, + * described in detail below. UClassID values can be compared using + * operator==(). Nothing else should be done with them. + * + * \par + * In class hierarchies that implement "poor man's RTTI", + * each concrete subclass implements getDynamicClassID() in the same way: + * + * \code + * class Derived { + * public: + * virtual UClassID getDynamicClassID() const + * { return Derived::getStaticClassID(); } + * } + * \endcode + * + * Each concrete class implements getStaticClassID() as well, which allows + * clients to test for a specific type. + * + * \code + * class Derived { + * public: + * static UClassID U_EXPORT2 getStaticClassID(); + * private: + * static char fgClassID; + * } + * + * // In Derived.cpp: + * UClassID Derived::getStaticClassID() + * { return (UClassID)&Derived::fgClassID; } + * char Derived::fgClassID = 0; // Value is irrelevant + * \endcode + * @stable ICU 2.0 + */ +typedef void* UClassID; + +U_NAMESPACE_BEGIN + +/** + * UMemory is the common ICU base class. + * All other ICU C++ classes are derived from UMemory (starting with ICU 2.4). + * + * This is primarily to make it possible and simple to override the + * C++ memory management by adding new/delete operators to this base class. + * + * To override ALL ICU memory management, including that from plain C code, + * replace the allocation functions declared in cmemory.h + * + * UMemory does not contain any virtual functions. + * Common "boilerplate" functions are defined in UObject. + * + * @stable ICU 2.4 + */ +class U_COMMON_API UMemory { +public: + +/* test versions for debugging shaper heap memory problems */ +#ifdef SHAPER_MEMORY_DEBUG + static void * NewArray(int size, int count); + static void * GrowArray(void * array, int newSize ); + static void FreeArray(void * array ); +#endif + +#if U_OVERRIDE_CXX_ALLOCATION + /** + * Override for ICU4C C++ memory management. + * simple, non-class types are allocated using the macros in common/cmemory.h + * (uprv_malloc(), uprv_free(), uprv_realloc()); + * they or something else could be used here to implement C++ new/delete + * for ICU4C C++ classes + * @stable ICU 2.4 + */ + static void * U_EXPORT2 operator new(size_t size) U_NO_THROW; + + /** + * Override for ICU4C C++ memory management. + * See new(). + * @stable ICU 2.4 + */ + static void * U_EXPORT2 operator new[](size_t size) U_NO_THROW; + + /** + * Override for ICU4C C++ memory management. + * simple, non-class types are allocated using the macros in common/cmemory.h + * (uprv_malloc(), uprv_free(), uprv_realloc()); + * they or something else could be used here to implement C++ new/delete + * for ICU4C C++ classes + * @stable ICU 2.4 + */ + static void U_EXPORT2 operator delete(void *p) U_NO_THROW; + + /** + * Override for ICU4C C++ memory management. + * See delete(). + * @stable ICU 2.4 + */ + static void U_EXPORT2 operator delete[](void *p) U_NO_THROW; + +#if U_HAVE_PLACEMENT_NEW + /** + * Override for ICU4C C++ memory management for STL. + * See new(). + * @stable ICU 2.6 + */ + static inline void * U_EXPORT2 operator new(size_t, void *ptr) U_NO_THROW { return ptr; } + + /** + * Override for ICU4C C++ memory management for STL. + * See delete(). + * @stable ICU 2.6 + */ + static inline void U_EXPORT2 operator delete(void *, void *) U_NO_THROW {} +#endif /* U_HAVE_PLACEMENT_NEW */ +#if U_HAVE_DEBUG_LOCATION_NEW + /** + * This method overrides the MFC debug version of the operator new + * + * @param size The requested memory size + * @param file The file where the allocation was requested + * @param line The line where the allocation was requested + */ + static void * U_EXPORT2 operator new(size_t size, const char* file, int line) U_NO_THROW; + /** + * This method provides a matching delete for the MFC debug new + * + * @param p The pointer to the allocated memory + * @param file The file where the allocation was requested + * @param line The line where the allocation was requested + */ + static void U_EXPORT2 operator delete(void* p, const char* file, int line) U_NO_THROW; +#endif /* U_HAVE_DEBUG_LOCATION_NEW */ +#endif /* U_OVERRIDE_CXX_ALLOCATION */ + + /* + * Assignment operator not declared. The compiler will provide one + * which does nothing since this class does not contain any data members. + * API/code coverage may show the assignment operator as present and + * untested - ignore. + * Subclasses need this assignment operator if they use compiler-provided + * assignment operators of their own. An alternative to not declaring one + * here would be to declare and empty-implement a protected or public one. + UMemory &UMemory::operator=(const UMemory &); + */ +}; + +/** + * UObject is the common ICU "boilerplate" class. + * UObject inherits UMemory (starting with ICU 2.4), + * and all other public ICU C++ classes + * are derived from UObject (starting with ICU 2.2). + * + * UObject contains common virtual functions, in particular a virtual destructor. + * + * The clone() function is not available in UObject because it is not + * implemented by all ICU classes. + * Many ICU services provide a clone() function for their class trees, + * defined on the service's C++ base class, and all subclasses within that + * service class tree return a pointer to the service base class + * (which itself is a subclass of UObject). + * This is because some compilers do not support covariant (same-as-this) + * return types; cast to the appropriate subclass if necessary. + * + * @stable ICU 2.2 + */ +class U_COMMON_API UObject : public UMemory { +public: + /** + * Destructor. + * + * @stable ICU 2.2 + */ + virtual ~UObject(); + + /** + * ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class. + * The base class implementation returns a dummy value. + * + * Use compiler RTTI rather than ICU's "poor man's RTTI". + * Since ICU 4.6, new ICU C++ class hierarchies do not implement "poor man's RTTI". + * + * @stable ICU 2.2 + */ + virtual UClassID getDynamicClassID() const; + +protected: + // the following functions are protected to prevent instantiation and + // direct use of UObject itself + + // default constructor + // inline UObject() {} + + // copy constructor + // inline UObject(const UObject &other) {} + +#if 0 + // TODO Sometime in the future. Implement operator==(). + // (This comment inserted in 2.2) + // some or all of the following "boilerplate" functions may be made public + // in a future ICU4C release when all subclasses implement them + + // assignment operator + // (not virtual, see "Taligent's Guide to Designing Programs" pp.73..74) + // commented out because the implementation is the same as a compiler's default + // UObject &operator=(const UObject &other) { return *this; } + + // comparison operators + virtual inline UBool operator==(const UObject &other) const { return this==&other; } + inline UBool operator!=(const UObject &other) const { return !operator==(other); } + + // clone() commented out from the base class: + // some compilers do not support co-variant return types + // (i.e., subclasses would have to return UObject * as well, instead of SubClass *) + // see also UObject class documentation. + // virtual UObject *clone() const; +#endif + + /* + * Assignment operator not declared. The compiler will provide one + * which does nothing since this class does not contain any data members. + * API/code coverage may show the assignment operator as present and + * untested - ignore. + * Subclasses need this assignment operator if they use compiler-provided + * assignment operators of their own. An alternative to not declaring one + * here would be to declare and empty-implement a protected or public one. + UObject &UObject::operator=(const UObject &); + */ +}; + +#ifndef U_HIDE_INTERNAL_API +/** + * This is a simple macro to add ICU RTTI to an ICU object implementation. + * This does not go into the header. This should only be used in *.cpp files. + * + * @param myClass The name of the class that needs RTTI defined. + * @internal + */ +#define UOBJECT_DEFINE_RTTI_IMPLEMENTATION(myClass) \ + UClassID U_EXPORT2 myClass::getStaticClassID() { \ + static char classID = 0; \ + return (UClassID)&classID; \ + } \ + UClassID myClass::getDynamicClassID() const \ + { return myClass::getStaticClassID(); } + + +/** + * This macro adds ICU RTTI to an ICU abstract class implementation. + * This macro should be invoked in *.cpp files. The corresponding + * header should declare getStaticClassID. + * + * @param myClass The name of the class that needs RTTI defined. + * @internal + */ +#define UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION(myClass) \ + UClassID U_EXPORT2 myClass::getStaticClassID() { \ + static char classID = 0; \ + return (UClassID)&classID; \ + } + +#endif /* U_HIDE_INTERNAL_API */ + +U_NAMESPACE_END + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/upluralrules.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/upluralrules.h new file mode 100644 index 0000000..99d93a4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/upluralrules.h @@ -0,0 +1,196 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +***************************************************************************************** +* Copyright (C) 2010-2013, International Business Machines +* Corporation and others. All Rights Reserved. +***************************************************************************************** +*/ + +#ifndef UPLURALRULES_H +#define UPLURALRULES_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/localpointer.h" +#include "unicode/uenum.h" +#ifndef U_HIDE_INTERNAL_API +#include "unicode/unum.h" +#endif /* U_HIDE_INTERNAL_API */ + +/** + * \file + * \brief C API: Plural rules, select plural keywords for numeric values. + * + * A UPluralRules object defines rules for mapping non-negative numeric + * values onto a small set of keywords. Rules are constructed from a text + * description, consisting of a series of keywords and conditions. + * The uplrules_select function examines each condition in order and + * returns the keyword for the first condition that matches the number. + * If none match, the default rule(other) is returned. + * + * For more information, see the LDML spec, C.11 Language Plural Rules: + * http://www.unicode.org/reports/tr35/#Language_Plural_Rules + * + * Keywords: ICU locale data has 6 predefined values - + * 'zero', 'one', 'two', 'few', 'many' and 'other'. Callers need to check + * the value of keyword returned by the uplrules_select function. + * + * These are based on CLDR Language Plural Rules. For these + * predefined rules, see the CLDR page at + * http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html + */ + +/** + * Type of plurals and PluralRules. + * @stable ICU 50 + */ +enum UPluralType { + /** + * Plural rules for cardinal numbers: 1 file vs. 2 files. + * @stable ICU 50 + */ + UPLURAL_TYPE_CARDINAL, + /** + * Plural rules for ordinal numbers: 1st file, 2nd file, 3rd file, 4th file, etc. + * @stable ICU 50 + */ + UPLURAL_TYPE_ORDINAL, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UPluralType value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UPLURAL_TYPE_COUNT +#endif /* U_HIDE_DEPRECATED_API */ +}; +/** + * @stable ICU 50 + */ +typedef enum UPluralType UPluralType; + +/** + * Opaque UPluralRules object for use in C programs. + * @stable ICU 4.8 + */ +struct UPluralRules; +typedef struct UPluralRules UPluralRules; /**< C typedef for struct UPluralRules. @stable ICU 4.8 */ + +/** + * Opens a new UPluralRules object using the predefined cardinal-number plural rules for a + * given locale. + * Same as uplrules_openForType(locale, UPLURAL_TYPE_CARDINAL, status). + * @param locale The locale for which the rules are desired. + * @param status A pointer to a UErrorCode to receive any errors. + * @return A UPluralRules for the specified locale, or NULL if an error occurred. + * @stable ICU 4.8 + */ +U_CAPI UPluralRules* U_EXPORT2 +uplrules_open(const char *locale, UErrorCode *status); + +/** + * Opens a new UPluralRules object using the predefined plural rules for a + * given locale and the plural type. + * @param locale The locale for which the rules are desired. + * @param type The plural type (e.g., cardinal or ordinal). + * @param status A pointer to a UErrorCode to receive any errors. + * @return A UPluralRules for the specified locale, or NULL if an error occurred. + * @stable ICU 50 + */ +U_CAPI UPluralRules* U_EXPORT2 +uplrules_openForType(const char *locale, UPluralType type, UErrorCode *status); + +/** + * Closes a UPluralRules object. Once closed it may no longer be used. + * @param uplrules The UPluralRules object to close. + * @stable ICU 4.8 + */ +U_CAPI void U_EXPORT2 +uplrules_close(UPluralRules *uplrules); + + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUPluralRulesPointer + * "Smart pointer" class, closes a UPluralRules via uplrules_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.8 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUPluralRulesPointer, UPluralRules, uplrules_close); + +U_NAMESPACE_END + +#endif + + +/** + * Given a number, returns the keyword of the first rule that + * applies to the number, according to the supplied UPluralRules object. + * @param uplrules The UPluralRules object specifying the rules. + * @param number The number for which the rule has to be determined. + * @param keyword The keyword of the rule that applies to number. + * @param capacity The capacity of keyword. + * @param status A pointer to a UErrorCode to receive any errors. + * @return The length of keyword. + * @stable ICU 4.8 + */ +U_CAPI int32_t U_EXPORT2 +uplrules_select(const UPluralRules *uplrules, + double number, + UChar *keyword, int32_t capacity, + UErrorCode *status); + +#ifndef U_HIDE_INTERNAL_API +/** + * Given a number, returns the keyword of the first rule that applies to the + * number, according to the UPluralRules object and given the number format + * specified by the UNumberFormat object. + * Note: This internal preview interface may be removed in the future if + * an architecturally cleaner solution reaches stable status. + * @param uplrules The UPluralRules object specifying the rules. + * @param number The number for which the rule has to be determined. + * @param fmt The UNumberFormat specifying how the number will be formatted + * (this can affect the plural form, e.g. "1 dollar" vs "1.0 dollars"). + * If this is NULL, the function behaves like uplrules_select. + * @param keyword The keyword of the rule that applies to number. + * @param capacity The capacity of the keyword buffer. + * @param status A pointer to a UErrorCode to receive any errors. + * @return The length of keyword. + * @internal ICU 59 technology preview, may be removed in the future + */ +U_INTERNAL int32_t U_EXPORT2 +uplrules_selectWithFormat(const UPluralRules *uplrules, + double number, + const UNumberFormat *fmt, + UChar *keyword, int32_t capacity, + UErrorCode *status); + +#endif /* U_HIDE_INTERNAL_API */ + +#ifndef U_HIDE_DRAFT_API +/** + * Creates a string enumeration of all plural rule keywords used in this + * UPluralRules object. The rule "other" is always present by default. + * @param uplrules The UPluralRules object specifying the rules for + * a given locale. + * @param status A pointer to a UErrorCode to receive any errors. + * @return a string enumeration over plural rule keywords, or NULL + * upon error. The caller is responsible for closing the result. + * @draft ICU 59 + */ +U_DRAFT UEnumeration* U_EXPORT2 +uplrules_getKeywords(const UPluralRules *uplrules, + UErrorCode *status); +#endif /* U_HIDE_DRAFT_API */ + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/uregex.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/uregex.h new file mode 100644 index 0000000..f3e8214 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/uregex.h @@ -0,0 +1,1614 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 2004-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* file name: uregex.h +* encoding: UTF-8 +* indentation:4 +* +* created on: 2004mar09 +* created by: Andy Heninger +* +* ICU Regular Expressions, API for C +*/ + +/** + * \file + * \brief C API: Regular Expressions + * + *

This is a C wrapper around the C++ RegexPattern and RegexMatcher classes.

+ */ + +#ifndef UREGEX_H +#define UREGEX_H + +#include "unicode/utext.h" +#include "unicode/utypes.h" + +#if !UCONFIG_NO_REGULAR_EXPRESSIONS + +#include "unicode/localpointer.h" +#include "unicode/parseerr.h" + +struct URegularExpression; +/** + * Structure representing a compiled regular expression, plus the results + * of a match operation. + * @stable ICU 3.0 + */ +typedef struct URegularExpression URegularExpression; + + +/** + * Constants for Regular Expression Match Modes. + * @stable ICU 2.4 + */ +typedef enum URegexpFlag{ + +#ifndef U_HIDE_DRAFT_API + /** Forces normalization of pattern and strings. + Not implemented yet, just a placeholder, hence draft. + @draft ICU 2.4 */ + UREGEX_CANON_EQ = 128, +#endif /* U_HIDE_DRAFT_API */ + /** Enable case insensitive matching. @stable ICU 2.4 */ + UREGEX_CASE_INSENSITIVE = 2, + + /** Allow white space and comments within patterns @stable ICU 2.4 */ + UREGEX_COMMENTS = 4, + + /** If set, '.' matches line terminators, otherwise '.' matching stops at line end. + * @stable ICU 2.4 */ + UREGEX_DOTALL = 32, + + /** If set, treat the entire pattern as a literal string. + * Metacharacters or escape sequences in the input sequence will be given + * no special meaning. + * + * The flag UREGEX_CASE_INSENSITIVE retains its impact + * on matching when used in conjunction with this flag. + * The other flags become superfluous. + * + * @stable ICU 4.0 + */ + UREGEX_LITERAL = 16, + + /** Control behavior of "$" and "^" + * If set, recognize line terminators within string, + * otherwise, match only at start and end of input string. + * @stable ICU 2.4 */ + UREGEX_MULTILINE = 8, + + /** Unix-only line endings. + * When this mode is enabled, only \\u000a is recognized as a line ending + * in the behavior of ., ^, and $. + * @stable ICU 4.0 + */ + UREGEX_UNIX_LINES = 1, + + /** Unicode word boundaries. + * If set, \b uses the Unicode TR 29 definition of word boundaries. + * Warning: Unicode word boundaries are quite different from + * traditional regular expression word boundaries. See + * http://unicode.org/reports/tr29/#Word_Boundaries + * @stable ICU 2.8 + */ + UREGEX_UWORD = 256, + + /** Error on Unrecognized backslash escapes. + * If set, fail with an error on patterns that contain + * backslash-escaped ASCII letters without a known special + * meaning. If this flag is not set, these + * escaped letters represent themselves. + * @stable ICU 4.0 + */ + UREGEX_ERROR_ON_UNKNOWN_ESCAPES = 512 + +} URegexpFlag; + +/** + * Open (compile) an ICU regular expression. Compiles the regular expression in + * string form into an internal representation using the specified match mode flags. + * The resulting regular expression handle can then be used to perform various + * matching operations. + * + * + * @param pattern The Regular Expression pattern to be compiled. + * @param patternLength The length of the pattern, or -1 if the pattern is + * NUL terminated. + * @param flags Flags that alter the default matching behavior for + * the regular expression, UREGEX_CASE_INSENSITIVE, for + * example. For default behavior, set this parameter to zero. + * See enum URegexpFlag. All desired flags + * are bitwise-ORed together. + * @param pe Receives the position (line and column numbers) of any syntax + * error within the source regular expression string. If this + * information is not wanted, pass NULL for this parameter. + * @param status Receives error detected by this function. + * @stable ICU 3.0 + * + */ +U_STABLE URegularExpression * U_EXPORT2 +uregex_open( const UChar *pattern, + int32_t patternLength, + uint32_t flags, + UParseError *pe, + UErrorCode *status); + +/** + * Open (compile) an ICU regular expression. Compiles the regular expression in + * string form into an internal representation using the specified match mode flags. + * The resulting regular expression handle can then be used to perform various + * matching operations. + *

+ * The contents of the pattern UText will be extracted and saved. Ownership of the + * UText struct itself remains with the caller. This is to match the behavior of + * uregex_open(). + * + * @param pattern The Regular Expression pattern to be compiled. + * @param flags Flags that alter the default matching behavior for + * the regular expression, UREGEX_CASE_INSENSITIVE, for + * example. For default behavior, set this parameter to zero. + * See enum URegexpFlag. All desired flags + * are bitwise-ORed together. + * @param pe Receives the position (line and column numbers) of any syntax + * error within the source regular expression string. If this + * information is not wanted, pass NULL for this parameter. + * @param status Receives error detected by this function. + * + * @stable ICU 4.6 + */ +U_STABLE URegularExpression * U_EXPORT2 +uregex_openUText(UText *pattern, + uint32_t flags, + UParseError *pe, + UErrorCode *status); + +/** + * Open (compile) an ICU regular expression. The resulting regular expression + * handle can then be used to perform various matching operations. + *

+ * This function is the same as uregex_open, except that the pattern + * is supplied as an 8 bit char * string in the default code page. + * + * @param pattern The Regular Expression pattern to be compiled, + * NUL terminated. + * @param flags Flags that alter the default matching behavior for + * the regular expression, UREGEX_CASE_INSENSITIVE, for + * example. For default behavior, set this parameter to zero. + * See enum URegexpFlag. All desired flags + * are bitwise-ORed together. + * @param pe Receives the position (line and column numbers) of any syntax + * error within the source regular expression string. If this + * information is not wanted, pass NULL for this parameter. + * @param status Receives errors detected by this function. + * @return The URegularExpression object representing the compiled + * pattern. + * + * @stable ICU 3.0 + */ +#if !UCONFIG_NO_CONVERSION +U_STABLE URegularExpression * U_EXPORT2 +uregex_openC( const char *pattern, + uint32_t flags, + UParseError *pe, + UErrorCode *status); +#endif + + + +/** + * Close the regular expression, recovering all resources (memory) it + * was holding. + * + * @param regexp The regular expression to be closed. + * @stable ICU 3.0 + */ +U_STABLE void U_EXPORT2 +uregex_close(URegularExpression *regexp); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalURegularExpressionPointer + * "Smart pointer" class, closes a URegularExpression via uregex_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalURegularExpressionPointer, URegularExpression, uregex_close); + +U_NAMESPACE_END + +#endif + +/** + * Make a copy of a compiled regular expression. Cloning a regular + * expression is faster than opening a second instance from the source + * form of the expression, and requires less memory. + *

+ * Note that the current input string and the position of any matched text + * within it are not cloned; only the pattern itself and the + * match mode flags are copied. + *

+ * Cloning can be particularly useful to threaded applications that perform + * multiple match operations in parallel. Each concurrent RE + * operation requires its own instance of a URegularExpression. + * + * @param regexp The compiled regular expression to be cloned. + * @param status Receives indication of any errors encountered + * @return the cloned copy of the compiled regular expression. + * @stable ICU 3.0 + */ +U_STABLE URegularExpression * U_EXPORT2 +uregex_clone(const URegularExpression *regexp, UErrorCode *status); + +/** + * Returns a pointer to the source form of the pattern for this regular expression. + * This function will work even if the pattern was originally specified as a UText. + * + * @param regexp The compiled regular expression. + * @param patLength This output parameter will be set to the length of the + * pattern string. A NULL pointer may be used here if the + * pattern length is not needed, as would be the case if + * the pattern is known in advance to be a NUL terminated + * string. + * @param status Receives errors detected by this function. + * @return a pointer to the pattern string. The storage for the string is + * owned by the regular expression object, and must not be + * altered or deleted by the application. The returned string + * will remain valid until the regular expression is closed. + * @stable ICU 3.0 + */ +U_STABLE const UChar * U_EXPORT2 +uregex_pattern(const URegularExpression *regexp, + int32_t *patLength, + UErrorCode *status); + +/** + * Returns the source text of the pattern for this regular expression. + * This function will work even if the pattern was originally specified as a UChar string. + * + * @param regexp The compiled regular expression. + * @param status Receives errors detected by this function. + * @return the pattern text. The storage for the text is owned by the regular expression + * object, and must not be altered or deleted. + * + * @stable ICU 4.6 + */ +U_STABLE UText * U_EXPORT2 +uregex_patternUText(const URegularExpression *regexp, + UErrorCode *status); + +/** + * Get the match mode flags that were specified when compiling this regular expression. + * @param status Receives errors detected by this function. + * @param regexp The compiled regular expression. + * @return The match mode flags + * @see URegexpFlag + * @stable ICU 3.0 + */ +U_STABLE int32_t U_EXPORT2 +uregex_flags(const URegularExpression *regexp, + UErrorCode *status); + + +/** + * Set the subject text string upon which the regular expression will look for matches. + * This function may be called any number of times, allowing the regular + * expression pattern to be applied to different strings. + *

+ * Regular expression matching operations work directly on the application's + * string data. No copy is made. The subject string data must not be + * altered after calling this function until after all regular expression + * operations involving this string data are completed. + *

+ * Zero length strings are permitted. In this case, no subsequent match + * operation will dereference the text string pointer. + * + * @param regexp The compiled regular expression. + * @param text The subject text string. + * @param textLength The length of the subject text, or -1 if the string + * is NUL terminated. + * @param status Receives errors detected by this function. + * @stable ICU 3.0 + */ +U_STABLE void U_EXPORT2 +uregex_setText(URegularExpression *regexp, + const UChar *text, + int32_t textLength, + UErrorCode *status); + + +/** + * Set the subject text string upon which the regular expression will look for matches. + * This function may be called any number of times, allowing the regular + * expression pattern to be applied to different strings. + *

+ * Regular expression matching operations work directly on the application's + * string data; only a shallow clone is made. The subject string data must not be + * altered after calling this function until after all regular expression + * operations involving this string data are completed. + * + * @param regexp The compiled regular expression. + * @param text The subject text string. + * @param status Receives errors detected by this function. + * + * @stable ICU 4.6 + */ +U_STABLE void U_EXPORT2 +uregex_setUText(URegularExpression *regexp, + UText *text, + UErrorCode *status); + +/** + * Get the subject text that is currently associated with this + * regular expression object. If the input was supplied using uregex_setText(), + * that pointer will be returned. Otherwise, the characters in the input will + * be extracted to a buffer and returned. In either case, ownership remains + * with the regular expression object. + * + * This function will work even if the input was originally specified as a UText. + * + * @param regexp The compiled regular expression. + * @param textLength The length of the string is returned in this output parameter. + * A NULL pointer may be used here if the + * text length is not needed, as would be the case if + * the text is known in advance to be a NUL terminated + * string. + * @param status Receives errors detected by this function. + * @return Pointer to the subject text string currently associated with + * this regular expression. + * @stable ICU 3.0 + */ +U_STABLE const UChar * U_EXPORT2 +uregex_getText(URegularExpression *regexp, + int32_t *textLength, + UErrorCode *status); + +/** + * Get the subject text that is currently associated with this + * regular expression object. + * + * This function will work even if the input was originally specified as a UChar string. + * + * @param regexp The compiled regular expression. + * @param dest A mutable UText in which to store the current input. + * If NULL, a new UText will be created as an immutable shallow clone + * of the actual input string. + * @param status Receives errors detected by this function. + * @return The subject text currently associated with this regular expression. + * If a pre-allocated UText was provided, it will always be used and returned. + * + * @stable ICU 4.6 + */ +U_STABLE UText * U_EXPORT2 +uregex_getUText(URegularExpression *regexp, + UText *dest, + UErrorCode *status); + +/** + * Set the subject text string upon which the regular expression is looking for matches + * without changing any other aspect of the matching state. + * The new and previous text strings must have the same content. + * + * This function is intended for use in environments where ICU is operating on + * strings that may move around in memory. It provides a mechanism for notifying + * ICU that the string has been relocated, and providing a new UText to access the + * string in its new position. + * + * Note that the regular expression implementation never copies the underlying text + * of a string being matched, but always operates directly on the original text + * provided by the user. Refreshing simply drops the references to the old text + * and replaces them with references to the new. + * + * Caution: this function is normally used only by very specialized + * system-level code. One example use case is with garbage collection + * that moves the text in memory. + * + * @param regexp The compiled regular expression. + * @param text The new (moved) text string. + * @param status Receives errors detected by this function. + * + * @stable ICU 4.8 + */ +U_STABLE void U_EXPORT2 +uregex_refreshUText(URegularExpression *regexp, + UText *text, + UErrorCode *status); + +/** + * Attempts to match the input string against the pattern. + * To succeed, the match must extend to the end of the string, + * or cover the complete match region. + * + * If startIndex >= zero the match operation starts at the specified + * index and must extend to the end of the input string. Any region + * that has been specified is reset. + * + * If startIndex == -1 the match must cover the input region, or the entire + * input string if no region has been set. This directly corresponds to + * Matcher.matches() in Java + * + * @param regexp The compiled regular expression. + * @param startIndex The input string (native) index at which to begin matching, or -1 + * to match the input Region. + * @param status Receives errors detected by this function. + * @return TRUE if there is a match + * @stable ICU 3.0 + */ +U_STABLE UBool U_EXPORT2 +uregex_matches(URegularExpression *regexp, + int32_t startIndex, + UErrorCode *status); + +/** + * 64bit version of uregex_matches. + * Attempts to match the input string against the pattern. + * To succeed, the match must extend to the end of the string, + * or cover the complete match region. + * + * If startIndex >= zero the match operation starts at the specified + * index and must extend to the end of the input string. Any region + * that has been specified is reset. + * + * If startIndex == -1 the match must cover the input region, or the entire + * input string if no region has been set. This directly corresponds to + * Matcher.matches() in Java + * + * @param regexp The compiled regular expression. + * @param startIndex The input string (native) index at which to begin matching, or -1 + * to match the input Region. + * @param status Receives errors detected by this function. + * @return TRUE if there is a match + * @stable ICU 4.6 + */ +U_STABLE UBool U_EXPORT2 +uregex_matches64(URegularExpression *regexp, + int64_t startIndex, + UErrorCode *status); + +/** + * Attempts to match the input string, starting from the specified index, against the pattern. + * The match may be of any length, and is not required to extend to the end + * of the input string. Contrast with uregex_matches(). + * + *

If startIndex is >= 0 any input region that was set for this + * URegularExpression is reset before the operation begins. + * + *

If the specified starting index == -1 the match begins at the start of the input + * region, or at the start of the full string if no region has been specified. + * This corresponds directly with Matcher.lookingAt() in Java. + * + *

If the match succeeds then more information can be obtained via the + * uregexp_start(), uregexp_end(), + * and uregex_group() functions.

+ * + * @param regexp The compiled regular expression. + * @param startIndex The input string (native) index at which to begin matching, or + * -1 to match the Input Region + * @param status A reference to a UErrorCode to receive any errors. + * @return TRUE if there is a match. + * @stable ICU 3.0 + */ +U_STABLE UBool U_EXPORT2 +uregex_lookingAt(URegularExpression *regexp, + int32_t startIndex, + UErrorCode *status); + +/** + * 64bit version of uregex_lookingAt. + * Attempts to match the input string, starting from the specified index, against the pattern. + * The match may be of any length, and is not required to extend to the end + * of the input string. Contrast with uregex_matches(). + * + *

If startIndex is >= 0 any input region that was set for this + * URegularExpression is reset before the operation begins. + * + *

If the specified starting index == -1 the match begins at the start of the input + * region, or at the start of the full string if no region has been specified. + * This corresponds directly with Matcher.lookingAt() in Java. + * + *

If the match succeeds then more information can be obtained via the + * uregexp_start(), uregexp_end(), + * and uregex_group() functions.

+ * + * @param regexp The compiled regular expression. + * @param startIndex The input string (native) index at which to begin matching, or + * -1 to match the Input Region + * @param status A reference to a UErrorCode to receive any errors. + * @return TRUE if there is a match. + * @stable ICU 4.6 + */ +U_STABLE UBool U_EXPORT2 +uregex_lookingAt64(URegularExpression *regexp, + int64_t startIndex, + UErrorCode *status); + +/** + * Find the first matching substring of the input string that matches the pattern. + * If startIndex is >= zero the search for a match begins at the specified index, + * and any match region is reset. This corresponds directly with + * Matcher.find(startIndex) in Java. + * + * If startIndex == -1 the search begins at the start of the input region, + * or at the start of the full string if no region has been specified. + * + * If a match is found, uregex_start(), uregex_end(), and + * uregex_group() will provide more information regarding the match. + * + * @param regexp The compiled regular expression. + * @param startIndex The position (native) in the input string to begin the search, or + * -1 to search within the Input Region. + * @param status A reference to a UErrorCode to receive any errors. + * @return TRUE if a match is found. + * @stable ICU 3.0 + */ +U_STABLE UBool U_EXPORT2 +uregex_find(URegularExpression *regexp, + int32_t startIndex, + UErrorCode *status); + +/** + * 64bit version of uregex_find. + * Find the first matching substring of the input string that matches the pattern. + * If startIndex is >= zero the search for a match begins at the specified index, + * and any match region is reset. This corresponds directly with + * Matcher.find(startIndex) in Java. + * + * If startIndex == -1 the search begins at the start of the input region, + * or at the start of the full string if no region has been specified. + * + * If a match is found, uregex_start(), uregex_end(), and + * uregex_group() will provide more information regarding the match. + * + * @param regexp The compiled regular expression. + * @param startIndex The position (native) in the input string to begin the search, or + * -1 to search within the Input Region. + * @param status A reference to a UErrorCode to receive any errors. + * @return TRUE if a match is found. + * @stable ICU 4.6 + */ +U_STABLE UBool U_EXPORT2 +uregex_find64(URegularExpression *regexp, + int64_t startIndex, + UErrorCode *status); + +/** + * Find the next pattern match in the input string. Begin searching + * the input at the location following the end of he previous match, + * or at the start of the string (or region) if there is no + * previous match. If a match is found, uregex_start(), uregex_end(), and + * uregex_group() will provide more information regarding the match. + * + * @param regexp The compiled regular expression. + * @param status A reference to a UErrorCode to receive any errors. + * @return TRUE if a match is found. + * @see uregex_reset + * @stable ICU 3.0 + */ +U_STABLE UBool U_EXPORT2 +uregex_findNext(URegularExpression *regexp, + UErrorCode *status); + +/** + * Get the number of capturing groups in this regular expression's pattern. + * @param regexp The compiled regular expression. + * @param status A reference to a UErrorCode to receive any errors. + * @return the number of capture groups + * @stable ICU 3.0 + */ +U_STABLE int32_t U_EXPORT2 +uregex_groupCount(URegularExpression *regexp, + UErrorCode *status); + +/** + * Get the group number corresponding to a named capture group. + * The returned number can be used with any function that access + * capture groups by number. + * + * The function returns an error status if the specified name does not + * appear in the pattern. + * + * @param regexp The compiled regular expression. + * @param groupName The capture group name. + * @param nameLength The length of the name, or -1 if the name is a + * nul-terminated string. + * @param status A pointer to a UErrorCode to receive any errors. + * + * @stable ICU 55 + */ +U_STABLE int32_t U_EXPORT2 +uregex_groupNumberFromName(URegularExpression *regexp, + const UChar *groupName, + int32_t nameLength, + UErrorCode *status); + + +/** + * Get the group number corresponding to a named capture group. + * The returned number can be used with any function that access + * capture groups by number. + * + * The function returns an error status if the specified name does not + * appear in the pattern. + * + * @param regexp The compiled regular expression. + * @param groupName The capture group name, + * platform invariant characters only. + * @param nameLength The length of the name, or -1 if the name is + * nul-terminated. + * @param status A pointer to a UErrorCode to receive any errors. + * + * @stable ICU 55 + */ +U_STABLE int32_t U_EXPORT2 +uregex_groupNumberFromCName(URegularExpression *regexp, + const char *groupName, + int32_t nameLength, + UErrorCode *status); + +/** Extract the string for the specified matching expression or subexpression. + * Group #0 is the complete string of matched text. + * Group #1 is the text matched by the first set of capturing parentheses. + * + * @param regexp The compiled regular expression. + * @param groupNum The capture group to extract. Group 0 is the complete + * match. The value of this parameter must be + * less than or equal to the number of capture groups in + * the pattern. + * @param dest Buffer to receive the matching string data + * @param destCapacity Capacity of the dest buffer. + * @param status A reference to a UErrorCode to receive any errors. + * @return Length of matching data, + * or -1 if no applicable match. + * @stable ICU 3.0 + */ +U_STABLE int32_t U_EXPORT2 +uregex_group(URegularExpression *regexp, + int32_t groupNum, + UChar *dest, + int32_t destCapacity, + UErrorCode *status); + +/** Returns a shallow immutable clone of the entire input string with the current index set + * to the beginning of the requested capture group. The capture group length is also + * returned via groupLength. + * Group #0 is the complete string of matched text. + * Group #1 is the text matched by the first set of capturing parentheses. + * + * @param regexp The compiled regular expression. + * @param groupNum The capture group to extract. Group 0 is the complete + * match. The value of this parameter must be + * less than or equal to the number of capture groups in + * the pattern. + * @param dest A mutable UText in which to store the current input. + * If NULL, a new UText will be created as an immutable shallow clone + * of the entire input string. + * @param groupLength The group length of the desired capture group. Output parameter. + * @param status A reference to a UErrorCode to receive any errors. + * @return The subject text currently associated with this regular expression. + * If a pre-allocated UText was provided, it will always be used and returned. + + * + * @stable ICU 4.6 + */ +U_STABLE UText * U_EXPORT2 +uregex_groupUText(URegularExpression *regexp, + int32_t groupNum, + UText *dest, + int64_t *groupLength, + UErrorCode *status); + +/** + * Returns the index in the input string of the start of the text matched by the + * specified capture group during the previous match operation. Return -1 if + * the capture group was not part of the last match. + * Group #0 refers to the complete range of matched text. + * Group #1 refers to the text matched by the first set of capturing parentheses. + * + * @param regexp The compiled regular expression. + * @param groupNum The capture group number + * @param status A reference to a UErrorCode to receive any errors. + * @return the starting (native) position in the input of the text matched + * by the specified group. + * @stable ICU 3.0 + */ +U_STABLE int32_t U_EXPORT2 +uregex_start(URegularExpression *regexp, + int32_t groupNum, + UErrorCode *status); + +/** + * 64bit version of uregex_start. + * Returns the index in the input string of the start of the text matched by the + * specified capture group during the previous match operation. Return -1 if + * the capture group was not part of the last match. + * Group #0 refers to the complete range of matched text. + * Group #1 refers to the text matched by the first set of capturing parentheses. + * + * @param regexp The compiled regular expression. + * @param groupNum The capture group number + * @param status A reference to a UErrorCode to receive any errors. + * @return the starting (native) position in the input of the text matched + * by the specified group. + * @stable ICU 4.6 + */ +U_STABLE int64_t U_EXPORT2 +uregex_start64(URegularExpression *regexp, + int32_t groupNum, + UErrorCode *status); + +/** + * Returns the index in the input string of the position following the end + * of the text matched by the specified capture group. + * Return -1 if the capture group was not part of the last match. + * Group #0 refers to the complete range of matched text. + * Group #1 refers to the text matched by the first set of capturing parentheses. + * + * @param regexp The compiled regular expression. + * @param groupNum The capture group number + * @param status A reference to a UErrorCode to receive any errors. + * @return the (native) index of the position following the last matched character. + * @stable ICU 3.0 + */ +U_STABLE int32_t U_EXPORT2 +uregex_end(URegularExpression *regexp, + int32_t groupNum, + UErrorCode *status); + +/** + * 64bit version of uregex_end. + * Returns the index in the input string of the position following the end + * of the text matched by the specified capture group. + * Return -1 if the capture group was not part of the last match. + * Group #0 refers to the complete range of matched text. + * Group #1 refers to the text matched by the first set of capturing parentheses. + * + * @param regexp The compiled regular expression. + * @param groupNum The capture group number + * @param status A reference to a UErrorCode to receive any errors. + * @return the (native) index of the position following the last matched character. + * @stable ICU 4.6 + */ +U_STABLE int64_t U_EXPORT2 +uregex_end64(URegularExpression *regexp, + int32_t groupNum, + UErrorCode *status); + +/** + * Reset any saved state from the previous match. Has the effect of + * causing uregex_findNext to begin at the specified index, and causing + * uregex_start(), uregex_end() and uregex_group() to return an error + * indicating that there is no match information available. Clears any + * match region that may have been set. + * + * @param regexp The compiled regular expression. + * @param index The position (native) in the text at which a + * uregex_findNext() should begin searching. + * @param status A reference to a UErrorCode to receive any errors. + * @stable ICU 3.0 + */ +U_STABLE void U_EXPORT2 +uregex_reset(URegularExpression *regexp, + int32_t index, + UErrorCode *status); + +/** + * 64bit version of uregex_reset. + * Reset any saved state from the previous match. Has the effect of + * causing uregex_findNext to begin at the specified index, and causing + * uregex_start(), uregex_end() and uregex_group() to return an error + * indicating that there is no match information available. Clears any + * match region that may have been set. + * + * @param regexp The compiled regular expression. + * @param index The position (native) in the text at which a + * uregex_findNext() should begin searching. + * @param status A reference to a UErrorCode to receive any errors. + * @stable ICU 4.6 + */ +U_STABLE void U_EXPORT2 +uregex_reset64(URegularExpression *regexp, + int64_t index, + UErrorCode *status); + +/** + * Sets the limits of the matching region for this URegularExpression. + * The region is the part of the input string that will be considered when matching. + * Invoking this method resets any saved state from the previous match, + * then sets the region to start at the index specified by the start parameter + * and end at the index specified by the end parameter. + * + * Depending on the transparency and anchoring being used (see useTransparentBounds + * and useAnchoringBounds), certain constructs such as anchors may behave differently + * at or around the boundaries of the region + * + * The function will fail if start is greater than limit, or if either index + * is less than zero or greater than the length of the string being matched. + * + * @param regexp The compiled regular expression. + * @param regionStart The (native) index to begin searches at. + * @param regionLimit The (native) index to end searches at (exclusive). + * @param status A pointer to a UErrorCode to receive any errors. + * @stable ICU 4.0 + */ +U_STABLE void U_EXPORT2 +uregex_setRegion(URegularExpression *regexp, + int32_t regionStart, + int32_t regionLimit, + UErrorCode *status); + +/** + * 64bit version of uregex_setRegion. + * Sets the limits of the matching region for this URegularExpression. + * The region is the part of the input string that will be considered when matching. + * Invoking this method resets any saved state from the previous match, + * then sets the region to start at the index specified by the start parameter + * and end at the index specified by the end parameter. + * + * Depending on the transparency and anchoring being used (see useTransparentBounds + * and useAnchoringBounds), certain constructs such as anchors may behave differently + * at or around the boundaries of the region + * + * The function will fail if start is greater than limit, or if either index + * is less than zero or greater than the length of the string being matched. + * + * @param regexp The compiled regular expression. + * @param regionStart The (native) index to begin searches at. + * @param regionLimit The (native) index to end searches at (exclusive). + * @param status A pointer to a UErrorCode to receive any errors. + * @stable ICU 4.6 + */ +U_STABLE void U_EXPORT2 +uregex_setRegion64(URegularExpression *regexp, + int64_t regionStart, + int64_t regionLimit, + UErrorCode *status); + +/** + * Set the matching region and the starting index for subsequent matches + * in a single operation. + * This is useful because the usual function for setting the starting + * index, urgex_reset(), also resets any region limits. + * + * @param regexp The compiled regular expression. + * @param regionStart The (native) index to begin searches at. + * @param regionLimit The (native) index to end searches at (exclusive). + * @param startIndex The index in the input text at which the next + * match operation should begin. + * @param status A pointer to a UErrorCode to receive any errors. + * @stable ICU 4.6 + */ +U_STABLE void U_EXPORT2 +uregex_setRegionAndStart(URegularExpression *regexp, + int64_t regionStart, + int64_t regionLimit, + int64_t startIndex, + UErrorCode *status); + +/** + * Reports the start index of the matching region. Any matches found are limited to + * to the region bounded by regionStart (inclusive) and regionEnd (exclusive). + * + * @param regexp The compiled regular expression. + * @param status A pointer to a UErrorCode to receive any errors. + * @return The starting (native) index of this matcher's region. + * @stable ICU 4.0 + */ +U_STABLE int32_t U_EXPORT2 +uregex_regionStart(const URegularExpression *regexp, + UErrorCode *status); + +/** + * 64bit version of uregex_regionStart. + * Reports the start index of the matching region. Any matches found are limited to + * to the region bounded by regionStart (inclusive) and regionEnd (exclusive). + * + * @param regexp The compiled regular expression. + * @param status A pointer to a UErrorCode to receive any errors. + * @return The starting (native) index of this matcher's region. + * @stable ICU 4.6 + */ +U_STABLE int64_t U_EXPORT2 +uregex_regionStart64(const URegularExpression *regexp, + UErrorCode *status); + +/** + * Reports the end index (exclusive) of the matching region for this URegularExpression. + * Any matches found are limited to to the region bounded by regionStart (inclusive) + * and regionEnd (exclusive). + * + * @param regexp The compiled regular expression. + * @param status A pointer to a UErrorCode to receive any errors. + * @return The ending point (native) of this matcher's region. + * @stable ICU 4.0 + */ +U_STABLE int32_t U_EXPORT2 +uregex_regionEnd(const URegularExpression *regexp, + UErrorCode *status); + +/** + * 64bit version of uregex_regionEnd. + * Reports the end index (exclusive) of the matching region for this URegularExpression. + * Any matches found are limited to to the region bounded by regionStart (inclusive) + * and regionEnd (exclusive). + * + * @param regexp The compiled regular expression. + * @param status A pointer to a UErrorCode to receive any errors. + * @return The ending point (native) of this matcher's region. + * @stable ICU 4.6 + */ +U_STABLE int64_t U_EXPORT2 +uregex_regionEnd64(const URegularExpression *regexp, + UErrorCode *status); + +/** + * Queries the transparency of region bounds for this URegularExpression. + * See useTransparentBounds for a description of transparent and opaque bounds. + * By default, matching boundaries are opaque. + * + * @param regexp The compiled regular expression. + * @param status A pointer to a UErrorCode to receive any errors. + * @return TRUE if this matcher is using opaque bounds, false if it is not. + * @stable ICU 4.0 + */ +U_STABLE UBool U_EXPORT2 +uregex_hasTransparentBounds(const URegularExpression *regexp, + UErrorCode *status); + + +/** + * Sets the transparency of region bounds for this URegularExpression. + * Invoking this function with an argument of TRUE will set matches to use transparent bounds. + * If the boolean argument is FALSE, then opaque bounds will be used. + * + * Using transparent bounds, the boundaries of the matching region are transparent + * to lookahead, lookbehind, and boundary matching constructs. Those constructs can + * see text beyond the boundaries of the region while checking for a match. + * + * With opaque bounds, no text outside of the matching region is visible to lookahead, + * lookbehind, and boundary matching constructs. + * + * By default, opaque bounds are used. + * + * @param regexp The compiled regular expression. + * @param b TRUE for transparent bounds; FALSE for opaque bounds + * @param status A pointer to a UErrorCode to receive any errors. + * @stable ICU 4.0 + **/ +U_STABLE void U_EXPORT2 +uregex_useTransparentBounds(URegularExpression *regexp, + UBool b, + UErrorCode *status); + + +/** + * Return true if this URegularExpression is using anchoring bounds. + * By default, anchoring region bounds are used. + * + * @param regexp The compiled regular expression. + * @param status A pointer to a UErrorCode to receive any errors. + * @return TRUE if this matcher is using anchoring bounds. + * @stable ICU 4.0 + */ +U_STABLE UBool U_EXPORT2 +uregex_hasAnchoringBounds(const URegularExpression *regexp, + UErrorCode *status); + + +/** + * Set whether this URegularExpression is using Anchoring Bounds for its region. + * With anchoring bounds, pattern anchors such as ^ and $ will match at the start + * and end of the region. Without Anchoring Bounds, anchors will only match at + * the positions they would in the complete text. + * + * Anchoring Bounds are the default for regions. + * + * @param regexp The compiled regular expression. + * @param b TRUE if to enable anchoring bounds; FALSE to disable them. + * @param status A pointer to a UErrorCode to receive any errors. + * @stable ICU 4.0 + */ +U_STABLE void U_EXPORT2 +uregex_useAnchoringBounds(URegularExpression *regexp, + UBool b, + UErrorCode *status); + +/** + * Return TRUE if the most recent matching operation touched the + * end of the text being processed. In this case, additional input text could + * change the results of that match. + * + * @param regexp The compiled regular expression. + * @param status A pointer to a UErrorCode to receive any errors. + * @return TRUE if the most recent match hit the end of input + * @stable ICU 4.0 + */ +U_STABLE UBool U_EXPORT2 +uregex_hitEnd(const URegularExpression *regexp, + UErrorCode *status); + +/** + * Return TRUE the most recent match succeeded and additional input could cause + * it to fail. If this function returns false and a match was found, then more input + * might change the match but the match won't be lost. If a match was not found, + * then requireEnd has no meaning. + * + * @param regexp The compiled regular expression. + * @param status A pointer to a UErrorCode to receive any errors. + * @return TRUE if more input could cause the most recent match to no longer match. + * @stable ICU 4.0 + */ +U_STABLE UBool U_EXPORT2 +uregex_requireEnd(const URegularExpression *regexp, + UErrorCode *status); + + + + + +/** + * Replaces every substring of the input that matches the pattern + * with the given replacement string. This is a convenience function that + * provides a complete find-and-replace-all operation. + * + * This method scans the input string looking for matches of the pattern. + * Input that is not part of any match is copied unchanged to the + * destination buffer. Matched regions are replaced in the output + * buffer by the replacement string. The replacement string may contain + * references to capture groups; these take the form of $1, $2, etc. + * + * @param regexp The compiled regular expression. + * @param replacementText A string containing the replacement text. + * @param replacementLength The length of the replacement string, or + * -1 if it is NUL terminated. + * @param destBuf A (UChar *) buffer that will receive the result. + * @param destCapacity The capacity of the destination buffer. + * @param status A reference to a UErrorCode to receive any errors. + * @return The length of the string resulting from the find + * and replace operation. In the event that the + * destination capacity is inadequate, the return value + * is still the full length of the untruncated string. + * @stable ICU 3.0 + */ +U_STABLE int32_t U_EXPORT2 +uregex_replaceAll(URegularExpression *regexp, + const UChar *replacementText, + int32_t replacementLength, + UChar *destBuf, + int32_t destCapacity, + UErrorCode *status); + +/** + * Replaces every substring of the input that matches the pattern + * with the given replacement string. This is a convenience function that + * provides a complete find-and-replace-all operation. + * + * This method scans the input string looking for matches of the pattern. + * Input that is not part of any match is copied unchanged to the + * destination buffer. Matched regions are replaced in the output + * buffer by the replacement string. The replacement string may contain + * references to capture groups; these take the form of $1, $2, etc. + * + * @param regexp The compiled regular expression. + * @param replacement A string containing the replacement text. + * @param dest A mutable UText that will receive the result. + * If NULL, a new UText will be created (which may not be mutable). + * @param status A reference to a UErrorCode to receive any errors. + * @return A UText containing the results of the find and replace. + * If a pre-allocated UText was provided, it will always be used and returned. + * + * @stable ICU 4.6 + */ +U_STABLE UText * U_EXPORT2 +uregex_replaceAllUText(URegularExpression *regexp, + UText *replacement, + UText *dest, + UErrorCode *status); + +/** + * Replaces the first substring of the input that matches the pattern + * with the given replacement string. This is a convenience function that + * provides a complete find-and-replace operation. + * + * This method scans the input string looking for a match of the pattern. + * All input that is not part of the match is copied unchanged to the + * destination buffer. The matched region is replaced in the output + * buffer by the replacement string. The replacement string may contain + * references to capture groups; these take the form of $1, $2, etc. + * + * @param regexp The compiled regular expression. + * @param replacementText A string containing the replacement text. + * @param replacementLength The length of the replacement string, or + * -1 if it is NUL terminated. + * @param destBuf A (UChar *) buffer that will receive the result. + * @param destCapacity The capacity of the destination buffer. + * @param status a reference to a UErrorCode to receive any errors. + * @return The length of the string resulting from the find + * and replace operation. In the event that the + * destination capacity is inadequate, the return value + * is still the full length of the untruncated string. + * @stable ICU 3.0 + */ +U_STABLE int32_t U_EXPORT2 +uregex_replaceFirst(URegularExpression *regexp, + const UChar *replacementText, + int32_t replacementLength, + UChar *destBuf, + int32_t destCapacity, + UErrorCode *status); + +/** + * Replaces the first substring of the input that matches the pattern + * with the given replacement string. This is a convenience function that + * provides a complete find-and-replace operation. + * + * This method scans the input string looking for a match of the pattern. + * All input that is not part of the match is copied unchanged to the + * destination buffer. The matched region is replaced in the output + * buffer by the replacement string. The replacement string may contain + * references to capture groups; these take the form of $1, $2, etc. + * + * @param regexp The compiled regular expression. + * @param replacement A string containing the replacement text. + * @param dest A mutable UText that will receive the result. + * If NULL, a new UText will be created (which may not be mutable). + * @param status A reference to a UErrorCode to receive any errors. + * @return A UText containing the results of the find and replace. + * If a pre-allocated UText was provided, it will always be used and returned. + * + * @stable ICU 4.6 + */ +U_STABLE UText * U_EXPORT2 +uregex_replaceFirstUText(URegularExpression *regexp, + UText *replacement, + UText *dest, + UErrorCode *status); + +/** + * Implements a replace operation intended to be used as part of an + * incremental find-and-replace. + * + *

The input string, starting from the end of the previous match and ending at + * the start of the current match, is appended to the destination string. Then the + * replacement string is appended to the output string, + * including handling any substitutions of captured text.

+ * + *

A note on preflight computation of buffersize and error handling: + * Calls to uregex_appendReplacement() and uregex_appendTail() are + * designed to be chained, one after another, with the destination + * buffer pointer and buffer capacity updated after each in preparation + * to for the next. If the destination buffer is exhausted partway through such a + * sequence, a U_BUFFER_OVERFLOW_ERROR status will be returned. Normal + * ICU conventions are for a function to perform no action if it is + * called with an error status, but for this one case, uregex_appendRepacement() + * will operate normally so that buffer size computations will complete + * correctly. + * + *

For simple, prepackaged, non-incremental find-and-replace + * operations, see replaceFirst() or replaceAll().

+ * + * @param regexp The regular expression object. + * @param replacementText The string that will replace the matched portion of the + * input string as it is copied to the destination buffer. + * The replacement text may contain references ($1, for + * example) to capture groups from the match. + * @param replacementLength The length of the replacement text string, + * or -1 if the string is NUL terminated. + * @param destBuf The buffer into which the results of the + * find-and-replace are placed. On return, this pointer + * will be updated to refer to the beginning of the + * unused portion of buffer, leaving it in position for + * a subsequent call to this function. + * @param destCapacity The size of the output buffer, On return, this + * parameter will be updated to reflect the space remaining + * unused in the output buffer. + * @param status A reference to a UErrorCode to receive any errors. + * @return The length of the result string. In the event that + * destCapacity is inadequate, the full length of the + * untruncated output string is returned. + * + * @stable ICU 3.0 + * + */ +U_STABLE int32_t U_EXPORT2 +uregex_appendReplacement(URegularExpression *regexp, + const UChar *replacementText, + int32_t replacementLength, + UChar **destBuf, + int32_t *destCapacity, + UErrorCode *status); + +/** + * Implements a replace operation intended to be used as part of an + * incremental find-and-replace. + * + *

The input string, starting from the end of the previous match and ending at + * the start of the current match, is appended to the destination string. Then the + * replacement string is appended to the output string, + * including handling any substitutions of captured text.

+ * + *

For simple, prepackaged, non-incremental find-and-replace + * operations, see replaceFirst() or replaceAll().

+ * + * @param regexp The regular expression object. + * @param replacementText The string that will replace the matched portion of the + * input string as it is copied to the destination buffer. + * The replacement text may contain references ($1, for + * example) to capture groups from the match. + * @param dest A mutable UText that will receive the result. Must not be NULL. + * @param status A reference to a UErrorCode to receive any errors. + * + * @stable ICU 4.6 + */ +U_STABLE void U_EXPORT2 +uregex_appendReplacementUText(URegularExpression *regexp, + UText *replacementText, + UText *dest, + UErrorCode *status); + +/** + * As the final step in a find-and-replace operation, append the remainder + * of the input string, starting at the position following the last match, + * to the destination string. uregex_appendTail() is intended + * to be invoked after one or more invocations of the + * uregex_appendReplacement() function. + * + * @param regexp The regular expression object. This is needed to + * obtain the input string and with the position + * of the last match within it. + * @param destBuf The buffer in which the results of the + * find-and-replace are placed. On return, the pointer + * will be updated to refer to the beginning of the + * unused portion of buffer. + * @param destCapacity The size of the output buffer, On return, this + * value will be updated to reflect the space remaining + * unused in the output buffer. + * @param status A reference to a UErrorCode to receive any errors. + * @return The length of the result string. In the event that + * destCapacity is inadequate, the full length of the + * untruncated output string is returned. + * + * @stable ICU 3.0 + */ +U_STABLE int32_t U_EXPORT2 +uregex_appendTail(URegularExpression *regexp, + UChar **destBuf, + int32_t *destCapacity, + UErrorCode *status); + +/** + * As the final step in a find-and-replace operation, append the remainder + * of the input string, starting at the position following the last match, + * to the destination string. uregex_appendTailUText() is intended + * to be invoked after one or more invocations of the + * uregex_appendReplacementUText() function. + * + * @param regexp The regular expression object. This is needed to + * obtain the input string and with the position + * of the last match within it. + * @param dest A mutable UText that will receive the result. Must not be NULL. + * + * @param status Error code + * + * @return The destination UText. + * + * @stable ICU 4.6 + */ +U_STABLE UText * U_EXPORT2 +uregex_appendTailUText(URegularExpression *regexp, + UText *dest, + UErrorCode *status); + + /** + * Split a string into fields. Somewhat like split() from Perl. + * The pattern matches identify delimiters that separate the input + * into fields. The input data between the matches becomes the + * fields themselves. + * + * Each of the fields is copied from the input string to the destination + * buffer, and NUL terminated. The position of each field within + * the destination buffer is returned in the destFields array. + * + * If the delimiter pattern includes capture groups, the captured text will + * also appear in the destination array of output strings, interspersed + * with the fields. This is similar to Perl, but differs from Java, + * which ignores the presence of capture groups in the pattern. + * + * Trailing empty fields will always be returned, assuming sufficient + * destination capacity. This differs from the default behavior for Java + * and Perl where trailing empty fields are not returned. + * + * The number of strings produced by the split operation is returned. + * This count includes the strings from capture groups in the delimiter pattern. + * This behavior differs from Java, which ignores capture groups. + * + * @param regexp The compiled regular expression. + * @param destBuf A (UChar *) buffer to receive the fields that + * are extracted from the input string. These + * field pointers will refer to positions within the + * destination buffer supplied by the caller. Any + * extra positions within the destFields array will be + * set to NULL. + * @param destCapacity The capacity of the destBuf. + * @param requiredCapacity The actual capacity required of the destBuf. + * If destCapacity is too small, requiredCapacity will return + * the total capacity required to hold all of the output, and + * a U_BUFFER_OVERFLOW_ERROR will be returned. + * @param destFields An array to be filled with the position of each + * of the extracted fields within destBuf. + * @param destFieldsCapacity The number of elements in the destFields array. + * If the number of fields found is less than destFieldsCapacity, + * the extra destFields elements are set to zero. + * If destFieldsCapacity is too small, the trailing part of the + * input, including any field delimiters, is treated as if it + * were the last field - it is copied to the destBuf, and + * its position is in the destBuf is stored in the last element + * of destFields. This behavior mimics that of Perl. It is not + * an error condition, and no error status is returned when all destField + * positions are used. + * @param status A reference to a UErrorCode to receive any errors. + * @return The number of fields into which the input string was split. + * @stable ICU 3.0 + */ +U_STABLE int32_t U_EXPORT2 +uregex_split( URegularExpression *regexp, + UChar *destBuf, + int32_t destCapacity, + int32_t *requiredCapacity, + UChar *destFields[], + int32_t destFieldsCapacity, + UErrorCode *status); + + /** + * Split a string into fields. Somewhat like split() from Perl. + * The pattern matches identify delimiters that separate the input + * into fields. The input data between the matches becomes the + * fields themselves. + *

+ * The behavior of this function is not very closely aligned with uregex_split(); + * instead, it is based on (and implemented directly on top of) the C++ split method. + * + * @param regexp The compiled regular expression. + * @param destFields An array of mutable UText structs to receive the results of the split. + * If a field is NULL, a new UText is allocated to contain the results for + * that field. This new UText is not guaranteed to be mutable. + * @param destFieldsCapacity The number of elements in the destination array. + * If the number of fields found is less than destCapacity, the + * extra strings in the destination array are not altered. + * If the number of destination strings is less than the number + * of fields, the trailing part of the input string, including any + * field delimiters, is placed in the last destination string. + * This behavior mimics that of Perl. It is not an error condition, and no + * error status is returned when all destField positions are used. + * @param status A reference to a UErrorCode to receive any errors. + * @return The number of fields into which the input string was split. + * + * @stable ICU 4.6 + */ +U_STABLE int32_t U_EXPORT2 +uregex_splitUText(URegularExpression *regexp, + UText *destFields[], + int32_t destFieldsCapacity, + UErrorCode *status); + +/** + * Set a processing time limit for match operations with this URegularExpression. + * + * Some patterns, when matching certain strings, can run in exponential time. + * For practical purposes, the match operation may appear to be in an + * infinite loop. + * When a limit is set a match operation will fail with an error if the + * limit is exceeded. + *

+ * The units of the limit are steps of the match engine. + * Correspondence with actual processor time will depend on the speed + * of the processor and the details of the specific pattern, but will + * typically be on the order of milliseconds. + *

+ * By default, the matching time is not limited. + *

+ * + * @param regexp The compiled regular expression. + * @param limit The limit value, or 0 for no limit. + * @param status A reference to a UErrorCode to receive any errors. + * @stable ICU 4.0 + */ +U_STABLE void U_EXPORT2 +uregex_setTimeLimit(URegularExpression *regexp, + int32_t limit, + UErrorCode *status); + +/** + * Get the time limit for for matches with this URegularExpression. + * A return value of zero indicates that there is no limit. + * + * @param regexp The compiled regular expression. + * @param status A reference to a UErrorCode to receive any errors. + * @return the maximum allowed time for a match, in units of processing steps. + * @stable ICU 4.0 + */ +U_STABLE int32_t U_EXPORT2 +uregex_getTimeLimit(const URegularExpression *regexp, + UErrorCode *status); + +/** + * Set the amount of heap storage available for use by the match backtracking stack. + *

+ * ICU uses a backtracking regular expression engine, with the backtrack stack + * maintained on the heap. This function sets the limit to the amount of memory + * that can be used for this purpose. A backtracking stack overflow will + * result in an error from the match operation that caused it. + *

+ * A limit is desirable because a malicious or poorly designed pattern can use + * excessive memory, potentially crashing the process. A limit is enabled + * by default. + *

+ * @param regexp The compiled regular expression. + * @param limit The maximum size, in bytes, of the matching backtrack stack. + * A value of zero means no limit. + * The limit must be greater than or equal to zero. + * @param status A reference to a UErrorCode to receive any errors. + * + * @stable ICU 4.0 + */ +U_STABLE void U_EXPORT2 +uregex_setStackLimit(URegularExpression *regexp, + int32_t limit, + UErrorCode *status); + +/** + * Get the size of the heap storage available for use by the back tracking stack. + * + * @return the maximum backtracking stack size, in bytes, or zero if the + * stack size is unlimited. + * @stable ICU 4.0 + */ +U_STABLE int32_t U_EXPORT2 +uregex_getStackLimit(const URegularExpression *regexp, + UErrorCode *status); + + +/** + * Function pointer for a regular expression matching callback function. + * When set, a callback function will be called periodically during matching + * operations. If the call back function returns FALSE, the matching + * operation will be terminated early. + * + * Note: the callback function must not call other functions on this + * URegularExpression. + * + * @param context context pointer. The callback function will be invoked + * with the context specified at the time that + * uregex_setMatchCallback() is called. + * @param steps the accumulated processing time, in match steps, + * for this matching operation. + * @return TRUE to continue the matching operation. + * FALSE to terminate the matching operation. + * @stable ICU 4.0 + */ +U_CDECL_BEGIN +typedef UBool U_CALLCONV URegexMatchCallback ( + const void *context, + int32_t steps); +U_CDECL_END + +/** + * Set a callback function for this URegularExpression. + * During matching operations the function will be called periodically, + * giving the application the opportunity to terminate a long-running + * match. + * + * @param regexp The compiled regular expression. + * @param callback A pointer to the user-supplied callback function. + * @param context User context pointer. The value supplied at the + * time the callback function is set will be saved + * and passed to the callback each time that it is called. + * @param status A reference to a UErrorCode to receive any errors. + * @stable ICU 4.0 + */ +U_STABLE void U_EXPORT2 +uregex_setMatchCallback(URegularExpression *regexp, + URegexMatchCallback *callback, + const void *context, + UErrorCode *status); + + +/** + * Get the callback function for this URegularExpression. + * + * @param regexp The compiled regular expression. + * @param callback Out parameter, receives a pointer to the user-supplied + * callback function. + * @param context Out parameter, receives the user context pointer that + * was set when uregex_setMatchCallback() was called. + * @param status A reference to a UErrorCode to receive any errors. + * @stable ICU 4.0 + */ +U_STABLE void U_EXPORT2 +uregex_getMatchCallback(const URegularExpression *regexp, + URegexMatchCallback **callback, + const void **context, + UErrorCode *status); + +/** + * Function pointer for a regular expression find callback function. + * + * When set, a callback function will be called during a find operation + * and for operations that depend on find, such as findNext, split and some replace + * operations like replaceFirst. + * The callback will usually be called after each attempt at a match, but this is not a + * guarantee that the callback will be invoked at each character. For finds where the + * match engine is invoked at each character, this may be close to true, but less likely + * for more optimized loops where the pattern is known to only start, and the match + * engine invoked, at certain characters. + * When invoked, this callback will specify the index at which a match operation is about + * to be attempted, giving the application the opportunity to terminate a long-running + * find operation. + * + * If the call back function returns FALSE, the find operation will be terminated early. + * + * Note: the callback function must not call other functions on this + * URegularExpression + * + * @param context context pointer. The callback function will be invoked + * with the context specified at the time that + * uregex_setFindProgressCallback() is called. + * @param matchIndex the next index at which a match attempt will be attempted for this + * find operation. If this callback interrupts the search, this is the + * index at which a find/findNext operation may be re-initiated. + * @return TRUE to continue the matching operation. + * FALSE to terminate the matching operation. + * @stable ICU 4.6 + */ +U_CDECL_BEGIN +typedef UBool U_CALLCONV URegexFindProgressCallback ( + const void *context, + int64_t matchIndex); +U_CDECL_END + + +/** + * Set the find progress callback function for this URegularExpression. + * + * @param regexp The compiled regular expression. + * @param callback A pointer to the user-supplied callback function. + * @param context User context pointer. The value supplied at the + * time the callback function is set will be saved + * and passed to the callback each time that it is called. + * @param status A reference to a UErrorCode to receive any errors. + * @stable ICU 4.6 + */ +U_STABLE void U_EXPORT2 +uregex_setFindProgressCallback(URegularExpression *regexp, + URegexFindProgressCallback *callback, + const void *context, + UErrorCode *status); + +/** + * Get the find progress callback function for this URegularExpression. + * + * @param regexp The compiled regular expression. + * @param callback Out parameter, receives a pointer to the user-supplied + * callback function. + * @param context Out parameter, receives the user context pointer that + * was set when uregex_setFindProgressCallback() was called. + * @param status A reference to a UErrorCode to receive any errors. + * @stable ICU 4.6 + */ +U_STABLE void U_EXPORT2 +uregex_getFindProgressCallback(const URegularExpression *regexp, + URegexFindProgressCallback **callback, + const void **context, + UErrorCode *status); + +#endif /* !UCONFIG_NO_REGULAR_EXPRESSIONS */ +#endif /* UREGEX_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/uregion.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/uregion.h new file mode 100644 index 0000000..a5de496 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/uregion.h @@ -0,0 +1,252 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +***************************************************************************************** +* Copyright (C) 2014, International Business Machines +* Corporation and others. All Rights Reserved. +***************************************************************************************** +*/ + +#ifndef UREGION_H +#define UREGION_H + +#include "unicode/utypes.h" +#include "unicode/uenum.h" + +/** + * \file + * \brief C API: URegion (territory containment and mapping) + * + * URegion objects represent data associated with a particular Unicode Region Code, also known as a + * Unicode Region Subtag, which is defined based upon the BCP 47 standard. These include: + * * Two-letter codes defined by ISO 3166-1, with special LDML treatment of certain private-use or + * reserved codes; + * * A subset of 3-digit numeric codes defined by UN M.49. + * URegion objects can also provide mappings to and from additional codes. There are different types + * of regions that are important to distinguish: + *

+ * Macroregion - A code for a "macro geographical (continental) region, geographical sub-region, or + * selected economic and other grouping" as defined in UN M.49. These are typically 3-digit codes, + * but contain some 2-letter codes for LDML extensions, such as "QO" for Outlying Oceania. + * Macroregions are represented in ICU by one of three region types: WORLD (code 001), + * CONTINENTS (regions contained directly by WORLD), and SUBCONTINENTS (regions contained directly + * by a continent ). + *

+ * TERRITORY - A Region that is not a Macroregion. These are typically codes for countries, but also + * include areas that are not separate countries, such as the code "AQ" for Antarctica or the code + * "HK" for Hong Kong (SAR China). Overseas dependencies of countries may or may not have separate + * codes. The codes are typically 2-letter codes aligned with ISO 3166, but BCP47 allows for the use + * of 3-digit codes in the future. + *

+ * UNKNOWN - The code ZZ is defined by Unicode LDML for use in indicating that region is unknown, + * or that the value supplied as a region was invalid. + *

+ * DEPRECATED - Region codes that have been defined in the past but are no longer in modern usage, + * usually due to a country splitting into multiple territories or changing its name. + *

+ * GROUPING - A widely understood grouping of territories that has a well defined membership such + * that a region code has been assigned for it. Some of these are UN M.49 codes that don't fall into + * the world/continent/sub-continent hierarchy, while others are just well-known groupings that have + * their own region code. Region "EU" (European Union) is one such region code that is a grouping. + * Groupings will never be returned by the uregion_getContainingRegion, since a different type of region + * (WORLD, CONTINENT, or SUBCONTINENT) will always be the containing region instead. + * + * URegion objects are const/immutable, owned and maintained by ICU itself, so there are not functions + * to open or close them. + */ + +/** + * URegionType is an enumeration defining the different types of regions. Current possible + * values are URGN_WORLD, URGN_CONTINENT, URGN_SUBCONTINENT, URGN_TERRITORY, URGN_GROUPING, + * URGN_DEPRECATED, and URGN_UNKNOWN. + * + * @stable ICU 51 + */ +typedef enum URegionType { + /** + * Type representing the unknown region. + * @stable ICU 51 + */ + URGN_UNKNOWN, + + /** + * Type representing a territory. + * @stable ICU 51 + */ + URGN_TERRITORY, + + /** + * Type representing the whole world. + * @stable ICU 51 + */ + URGN_WORLD, + + /** + * Type representing a continent. + * @stable ICU 51 + */ + URGN_CONTINENT, + + /** + * Type representing a sub-continent. + * @stable ICU 51 + */ + URGN_SUBCONTINENT, + + /** + * Type representing a grouping of territories that is not to be used in + * the normal WORLD/CONTINENT/SUBCONTINENT/TERRITORY containment tree. + * @stable ICU 51 + */ + URGN_GROUPING, + + /** + * Type representing a region whose code has been deprecated, usually + * due to a country splitting into multiple territories or changing its name. + * @stable ICU 51 + */ + URGN_DEPRECATED, + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal URegionType value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + URGN_LIMIT +#endif /* U_HIDE_DEPRECATED_API */ +} URegionType; + +#if !UCONFIG_NO_FORMATTING + +/** + * Opaque URegion object for use in C programs. + * @stable ICU 52 + */ +struct URegion; +typedef struct URegion URegion; /**< @stable ICU 52 */ + +/** + * Returns a pointer to a URegion for the specified region code: A 2-letter or 3-letter ISO 3166 + * code, UN M.49 numeric code (superset of ISO 3166 numeric codes), or other valid Unicode Region + * Code as defined by the LDML specification. The code will be canonicalized internally. If the + * region code is NULL or not recognized, the appropriate error code will be set + * (U_ILLEGAL_ARGUMENT_ERROR). + * @stable ICU 52 + */ +U_STABLE const URegion* U_EXPORT2 +uregion_getRegionFromCode(const char *regionCode, UErrorCode *status); + +/** + * Returns a pointer to a URegion for the specified numeric region code. If the numeric region + * code is not recognized, the appropriate error code will be set (U_ILLEGAL_ARGUMENT_ERROR). + * @stable ICU 52 + */ +U_STABLE const URegion* U_EXPORT2 +uregion_getRegionFromNumericCode (int32_t code, UErrorCode *status); + +/** + * Returns an enumeration over the canonical codes of all known regions that match the given type. + * The enumeration must be closed with with uenum_close(). + * @stable ICU 52 + */ +U_STABLE UEnumeration* U_EXPORT2 +uregion_getAvailable(URegionType type, UErrorCode *status); + +/** + * Returns true if the specified uregion is equal to the specified otherRegion. + * @stable ICU 52 + */ +U_STABLE UBool U_EXPORT2 +uregion_areEqual(const URegion* uregion, const URegion* otherRegion); + +/** + * Returns a pointer to the URegion that contains the specified uregion. Returns NULL if the + * specified uregion is code "001" (World) or "ZZ" (Unknown region). For example, calling + * this method with region "IT" (Italy) returns the URegion for "039" (Southern Europe). + * @stable ICU 52 + */ +U_STABLE const URegion* U_EXPORT2 +uregion_getContainingRegion(const URegion* uregion); + +/** + * Return a pointer to the URegion that geographically contains this uregion and matches the + * specified type, moving multiple steps up the containment chain if necessary. Returns NULL if no + * containing region can be found that matches the specified type. Will return NULL if URegionType + * is URGN_GROUPING, URGN_DEPRECATED, or URGN_UNKNOWN which are not appropriate for this API. + * For example, calling this method with uregion "IT" (Italy) for type URGN_CONTINENT returns the + * URegion "150" (Europe). + * @stable ICU 52 + */ +U_STABLE const URegion* U_EXPORT2 +uregion_getContainingRegionOfType(const URegion* uregion, URegionType type); + +/** + * Return an enumeration over the canonical codes of all the regions that are immediate children + * of the specified uregion in the region hierarchy. These returned regions could be either macro + * regions, territories, or a mixture of the two, depending on the containment data as defined in + * CLDR. This API returns NULL if this uregion doesn't have any sub-regions. For example, calling + * this function for uregion "150" (Europe) returns an enumeration containing the various + * sub-regions of Europe: "039" (Southern Europe), "151" (Eastern Europe), "154" (Northern Europe), + * and "155" (Western Europe). The enumeration must be closed with with uenum_close(). + * @stable ICU 52 + */ +U_STABLE UEnumeration* U_EXPORT2 +uregion_getContainedRegions(const URegion* uregion, UErrorCode *status); + +/** + * Returns an enumeration over the canonical codes of all the regions that are children of the + * specified uregion anywhere in the region hierarchy and match the given type. This API may return + * an empty enumeration if this uregion doesn't have any sub-regions that match the given type. + * For example, calling this method with region "150" (Europe) and type URGN_TERRITORY" returns an + * enumeration containing all the territories in Europe: "FR" (France), "IT" (Italy), "DE" (Germany), + * etc. The enumeration must be closed with with uenum_close(). + * @stable ICU 52 + */ +U_STABLE UEnumeration* U_EXPORT2 +uregion_getContainedRegionsOfType(const URegion* uregion, URegionType type, UErrorCode *status); + +/** + * Returns true if the specified uregion contains the specified otherRegion anywhere in the region + * hierarchy. + * @stable ICU 52 + */ +U_STABLE UBool U_EXPORT2 +uregion_contains(const URegion* uregion, const URegion* otherRegion); + +/** + * If the specified uregion is deprecated, returns an enumeration over the canonical codes of the + * regions that are the preferred replacement regions for the specified uregion. If the specified + * uregion is not deprecated, returns NULL. For example, calling this method with uregion + * "SU" (Soviet Union) returns a list of the regions containing "RU" (Russia), "AM" (Armenia), + * "AZ" (Azerbaijan), etc... The enumeration must be closed with with uenum_close(). + * @stable ICU 52 + */ +U_STABLE UEnumeration* U_EXPORT2 +uregion_getPreferredValues(const URegion* uregion, UErrorCode *status); + +/** + * Returns the specified uregion's canonical code. + * @stable ICU 52 + */ +U_STABLE const char* U_EXPORT2 +uregion_getRegionCode(const URegion* uregion); + +/** + * Returns the specified uregion's numeric code, or a negative value if there is no numeric code + * for the specified uregion. + * @stable ICU 52 + */ +U_STABLE int32_t U_EXPORT2 +uregion_getNumericCode(const URegion* uregion); + +/** + * Returns the URegionType of the specified uregion. + * @stable ICU 52 + */ +U_STABLE URegionType U_EXPORT2 +uregion_getType(const URegion* uregion); + + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ureldatefmt.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ureldatefmt.h new file mode 100644 index 0000000..0fde188 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ureldatefmt.h @@ -0,0 +1,365 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +***************************************************************************************** +* Copyright (C) 2016, International Business Machines +* Corporation and others. All Rights Reserved. +***************************************************************************************** +*/ + +#ifndef URELDATEFMT_H +#define URELDATEFMT_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION + +#include "unicode/unum.h" +#include "unicode/udisplaycontext.h" +#include "unicode/localpointer.h" + +/** + * \file + * \brief C API: URelativeDateTimeFormatter, relative date formatting of unit + numeric offset. + * + * Provides simple formatting of relative dates, in two ways + *

    + *
  • relative dates with a quantity e.g "in 5 days"
  • + *
  • relative dates without a quantity e.g "next Tuesday"
  • + *
+ *

+ * This does not provide compound formatting for multiple units, + * other than the ability to combine a time string with a relative date, + * as in "next Tuesday at 3:45 PM". It also does not provide support + * for determining which unit to use, such as deciding between "in 7 days" + * and "in 1 week". + * + * @stable ICU 57 + */ + +/** + * The formatting style + * @stable ICU 54 + */ +typedef enum UDateRelativeDateTimeFormatterStyle { + /** + * Everything spelled out. + * @stable ICU 54 + */ + UDAT_STYLE_LONG, + + /** + * Abbreviations used when possible. + * @stable ICU 54 + */ + UDAT_STYLE_SHORT, + + /** + * Use the shortest possible form. + * @stable ICU 54 + */ + UDAT_STYLE_NARROW, + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UDateRelativeDateTimeFormatterStyle value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UDAT_STYLE_COUNT +#endif /* U_HIDE_DEPRECATED_API */ +} UDateRelativeDateTimeFormatterStyle; + +/** + * Represents the unit for formatting a relative date. e.g "in 5 days" + * or "next year" + * @stable ICU 57 + */ +typedef enum URelativeDateTimeUnit { + /** + * Specifies that relative unit is year, e.g. "last year", + * "in 5 years". + * @stable ICU 57 + */ + UDAT_REL_UNIT_YEAR, + /** + * Specifies that relative unit is quarter, e.g. "last quarter", + * "in 5 quarters". + * @stable ICU 57 + */ + UDAT_REL_UNIT_QUARTER, + /** + * Specifies that relative unit is month, e.g. "last month", + * "in 5 months". + * @stable ICU 57 + */ + UDAT_REL_UNIT_MONTH, + /** + * Specifies that relative unit is week, e.g. "last week", + * "in 5 weeks". + * @stable ICU 57 + */ + UDAT_REL_UNIT_WEEK, + /** + * Specifies that relative unit is day, e.g. "yesterday", + * "in 5 days". + * @stable ICU 57 + */ + UDAT_REL_UNIT_DAY, + /** + * Specifies that relative unit is hour, e.g. "1 hour ago", + * "in 5 hours". + * @stable ICU 57 + */ + UDAT_REL_UNIT_HOUR, + /** + * Specifies that relative unit is minute, e.g. "1 minute ago", + * "in 5 minutes". + * @stable ICU 57 + */ + UDAT_REL_UNIT_MINUTE, + /** + * Specifies that relative unit is second, e.g. "1 second ago", + * "in 5 seconds". + * @stable ICU 57 + */ + UDAT_REL_UNIT_SECOND, + /** + * Specifies that relative unit is Sunday, e.g. "last Sunday", + * "this Sunday", "next Sunday", "in 5 Sundays". + * @stable ICU 57 + */ + UDAT_REL_UNIT_SUNDAY, + /** + * Specifies that relative unit is Monday, e.g. "last Monday", + * "this Monday", "next Monday", "in 5 Mondays". + * @stable ICU 57 + */ + UDAT_REL_UNIT_MONDAY, + /** + * Specifies that relative unit is Tuesday, e.g. "last Tuesday", + * "this Tuesday", "next Tuesday", "in 5 Tuesdays". + * @stable ICU 57 + */ + UDAT_REL_UNIT_TUESDAY, + /** + * Specifies that relative unit is Wednesday, e.g. "last Wednesday", + * "this Wednesday", "next Wednesday", "in 5 Wednesdays". + * @stable ICU 57 + */ + UDAT_REL_UNIT_WEDNESDAY, + /** + * Specifies that relative unit is Thursday, e.g. "last Thursday", + * "this Thursday", "next Thursday", "in 5 Thursdays". + * @stable ICU 57 + */ + UDAT_REL_UNIT_THURSDAY, + /** + * Specifies that relative unit is Friday, e.g. "last Friday", + * "this Friday", "next Friday", "in 5 Fridays". + * @stable ICU 57 + */ + UDAT_REL_UNIT_FRIDAY, + /** + * Specifies that relative unit is Saturday, e.g. "last Saturday", + * "this Saturday", "next Saturday", "in 5 Saturdays". + * @stable ICU 57 + */ + UDAT_REL_UNIT_SATURDAY, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal URelativeDateTimeUnit value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UDAT_REL_UNIT_COUNT +#endif /* U_HIDE_DEPRECATED_API */ +} URelativeDateTimeUnit; + +/** + * Opaque URelativeDateTimeFormatter object for use in C programs. + * @stable ICU 57 + */ +struct URelativeDateTimeFormatter; +typedef struct URelativeDateTimeFormatter URelativeDateTimeFormatter; /**< C typedef for struct URelativeDateTimeFormatter. @stable ICU 57 */ + + +/** + * Open a new URelativeDateTimeFormatter object for a given locale using the + * specified width and capitalizationContext, along with a number formatter + * (if desired) to override the default formatter that would be used for + * display of numeric field offsets. The default formatter typically rounds + * toward 0 and has a minimum of 0 fraction digits and a maximum of 3 + * fraction digits (i.e. it will show as many decimal places as necessary + * up to 3, without showing trailing 0s). + * + * @param locale + * The locale + * @param nfToAdopt + * A number formatter to set for this URelativeDateTimeFormatter + * object (instead of the default decimal formatter). Ownership of + * this UNumberFormat object will pass to the URelativeDateTimeFormatter + * object (the URelativeDateTimeFormatter adopts the UNumberFormat), + * which becomes responsible for closing it. If the caller wishes to + * retain ownership of the UNumberFormat object, the caller must clone + * it (with unum_clone) and pass the clone to ureldatefmt_open. May be + * NULL to use the default decimal formatter. + * @param width + * The width - wide, short, narrow, etc. + * @param capitalizationContext + * A value from UDisplayContext that pertains to capitalization, e.g. + * UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE. + * @param status + * A pointer to a UErrorCode to receive any errors. + * @return + * A pointer to a URelativeDateTimeFormatter object for the specified locale, + * or NULL if an error occurred. + * @stable ICU 57 + */ +U_STABLE URelativeDateTimeFormatter* U_EXPORT2 +ureldatefmt_open( const char* locale, + UNumberFormat* nfToAdopt, + UDateRelativeDateTimeFormatterStyle width, + UDisplayContext capitalizationContext, + UErrorCode* status ); + +/** + * Close a URelativeDateTimeFormatter object. Once closed it may no longer be used. + * @param reldatefmt + * The URelativeDateTimeFormatter object to close. + * @stable ICU 57 + */ +U_STABLE void U_EXPORT2 +ureldatefmt_close(URelativeDateTimeFormatter *reldatefmt); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalURelativeDateTimeFormatterPointer + * "Smart pointer" class, closes a URelativeDateTimeFormatter via ureldatefmt_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 57 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalURelativeDateTimeFormatterPointer, URelativeDateTimeFormatter, ureldatefmt_close); + +U_NAMESPACE_END + +#endif + +/** + * Format a combination of URelativeDateTimeUnit and numeric + * offset using a numeric style, e.g. "1 week ago", "in 1 week", + * "5 weeks ago", "in 5 weeks". + * + * @param reldatefmt + * The URelativeDateTimeFormatter object specifying the + * format conventions. + * @param offset + * The signed offset for the specified unit. This will + * be formatted according to this object's UNumberFormat + * object. + * @param unit + * The unit to use when formatting the relative + * date, e.g. UDAT_REL_UNIT_WEEK, UDAT_REL_UNIT_FRIDAY. + * @param result + * A pointer to a buffer to receive the formatted result. + * @param resultCapacity + * The maximum size of result. + * @param status + * A pointer to a UErrorCode to receive any errors. In + * case of error status, the contents of result are + * undefined. + * @return + * The length of the formatted result; may be greater + * than resultCapacity, in which case an error is returned. + * @stable ICU 57 + */ +U_STABLE int32_t U_EXPORT2 +ureldatefmt_formatNumeric( const URelativeDateTimeFormatter* reldatefmt, + double offset, + URelativeDateTimeUnit unit, + UChar* result, + int32_t resultCapacity, + UErrorCode* status); + +/** + * Format a combination of URelativeDateTimeUnit and numeric offset + * using a text style if possible, e.g. "last week", "this week", + * "next week", "yesterday", "tomorrow". Falls back to numeric + * style if no appropriate text term is available for the specified + * offset in the object's locale. + * + * @param reldatefmt + * The URelativeDateTimeFormatter object specifying the + * format conventions. + * @param offset + * The signed offset for the specified unit. + * @param unit + * The unit to use when formatting the relative + * date, e.g. UDAT_REL_UNIT_WEEK, UDAT_REL_UNIT_FRIDAY. + * @param result + * A pointer to a buffer to receive the formatted result. + * @param resultCapacity + * The maximum size of result. + * @param status + * A pointer to a UErrorCode to receive any errors. In + * case of error status, the contents of result are + * undefined. + * @return + * The length of the formatted result; may be greater + * than resultCapacity, in which case an error is returned. + * @stable ICU 57 + */ +U_STABLE int32_t U_EXPORT2 +ureldatefmt_format( const URelativeDateTimeFormatter* reldatefmt, + double offset, + URelativeDateTimeUnit unit, + UChar* result, + int32_t resultCapacity, + UErrorCode* status); + +/** + * Combines a relative date string and a time string in this object's + * locale. This is done with the same date-time separator used for the + * default calendar in this locale to produce a result such as + * "yesterday at 3:45 PM". + * + * @param reldatefmt + * The URelativeDateTimeFormatter object specifying the format conventions. + * @param relativeDateString + * The relative date string. + * @param relativeDateStringLen + * The length of relativeDateString; may be -1 if relativeDateString + * is zero-terminated. + * @param timeString + * The time string. + * @param timeStringLen + * The length of timeString; may be -1 if timeString is zero-terminated. + * @param result + * A pointer to a buffer to receive the formatted result. + * @param resultCapacity + * The maximum size of result. + * @param status + * A pointer to a UErrorCode to receive any errors. In case of error status, + * the contents of result are undefined. + * @return + * The length of the formatted result; may be greater than resultCapacity, + * in which case an error is returned. + * @stable ICU 57 + */ +U_STABLE int32_t U_EXPORT2 +ureldatefmt_combineDateAndTime( const URelativeDateTimeFormatter* reldatefmt, + const UChar * relativeDateString, + int32_t relativeDateStringLen, + const UChar * timeString, + int32_t timeStringLen, + UChar* result, + int32_t resultCapacity, + UErrorCode* status ); + +#endif /* !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/urename.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/urename.h new file mode 100644 index 0000000..982655c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/urename.h @@ -0,0 +1,1820 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2002-2016, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* +* file name: urename.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* Created by: Perl script tools/genren.pl written by Vladimir Weinstein +* +* Contains data for renaming ICU exports. +* Gets included by umachine.h +* +* THIS FILE IS MACHINE-GENERATED, DON'T PLAY WITH IT IF YOU DON'T KNOW WHAT +* YOU ARE DOING, OTHERWISE VERY BAD THINGS WILL HAPPEN! +*/ + +#ifndef URENAME_H +#define URENAME_H + +/* U_DISABLE_RENAMING can be defined in the following ways: + * - when running configure, e.g. + * runConfigureICU Linux --disable-renaming + * - by changing the default setting of U_DISABLE_RENAMING in uconfig.h + */ + +#include "unicode/uconfig.h" + +#if !U_DISABLE_RENAMING + +/* We need the U_ICU_ENTRY_POINT_RENAME definition. There's a default one in unicode/uvernum.h we can use, but we will give + the platform a chance to define it first. + Normally (if utypes.h or umachine.h was included first) this will not be necessary as it will already be defined. + */ + +#ifndef U_ICU_ENTRY_POINT_RENAME +#include "unicode/umachine.h" +#endif + +/* If we still don't have U_ICU_ENTRY_POINT_RENAME use the default. */ +#ifndef U_ICU_ENTRY_POINT_RENAME +#include "unicode/uvernum.h" +#endif + +/* Error out before the following defines cause very strange and unexpected code breakage */ +#ifndef U_ICU_ENTRY_POINT_RENAME +#error U_ICU_ENTRY_POINT_RENAME is not defined - cannot continue. Consider defining U_DISABLE_RENAMING if renaming should not be used. +#endif + + +/* C exports renaming data */ + +#define T_CString_int64ToString U_ICU_ENTRY_POINT_RENAME(T_CString_int64ToString) +#define T_CString_integerToString U_ICU_ENTRY_POINT_RENAME(T_CString_integerToString) +#define T_CString_stringToInteger U_ICU_ENTRY_POINT_RENAME(T_CString_stringToInteger) +#define T_CString_toLowerCase U_ICU_ENTRY_POINT_RENAME(T_CString_toLowerCase) +#define T_CString_toUpperCase U_ICU_ENTRY_POINT_RENAME(T_CString_toUpperCase) +#define UCNV_FROM_U_CALLBACK_ESCAPE U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_ESCAPE) +#define UCNV_FROM_U_CALLBACK_SKIP U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_SKIP) +#define UCNV_FROM_U_CALLBACK_STOP U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_STOP) +#define UCNV_FROM_U_CALLBACK_SUBSTITUTE U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_SUBSTITUTE) +#define UCNV_TO_U_CALLBACK_ESCAPE U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_ESCAPE) +#define UCNV_TO_U_CALLBACK_SKIP U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_SKIP) +#define UCNV_TO_U_CALLBACK_STOP U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_STOP) +#define UCNV_TO_U_CALLBACK_SUBSTITUTE U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_SUBSTITUTE) +#define UDataMemory_createNewInstance U_ICU_ENTRY_POINT_RENAME(UDataMemory_createNewInstance) +#define UDataMemory_init U_ICU_ENTRY_POINT_RENAME(UDataMemory_init) +#define UDataMemory_isLoaded U_ICU_ENTRY_POINT_RENAME(UDataMemory_isLoaded) +#define UDataMemory_normalizeDataPointer U_ICU_ENTRY_POINT_RENAME(UDataMemory_normalizeDataPointer) +#define UDataMemory_setData U_ICU_ENTRY_POINT_RENAME(UDataMemory_setData) +#define UDatamemory_assign U_ICU_ENTRY_POINT_RENAME(UDatamemory_assign) +#define _ASCIIData U_ICU_ENTRY_POINT_RENAME(_ASCIIData) +#define _Bocu1Data U_ICU_ENTRY_POINT_RENAME(_Bocu1Data) +#define _CESU8Data U_ICU_ENTRY_POINT_RENAME(_CESU8Data) +#define _CompoundTextData U_ICU_ENTRY_POINT_RENAME(_CompoundTextData) +#define _HZData U_ICU_ENTRY_POINT_RENAME(_HZData) +#define _IMAPData U_ICU_ENTRY_POINT_RENAME(_IMAPData) +#define _ISCIIData U_ICU_ENTRY_POINT_RENAME(_ISCIIData) +#define _ISO2022Data U_ICU_ENTRY_POINT_RENAME(_ISO2022Data) +#define _LMBCSData1 U_ICU_ENTRY_POINT_RENAME(_LMBCSData1) +#define _LMBCSData11 U_ICU_ENTRY_POINT_RENAME(_LMBCSData11) +#define _LMBCSData16 U_ICU_ENTRY_POINT_RENAME(_LMBCSData16) +#define _LMBCSData17 U_ICU_ENTRY_POINT_RENAME(_LMBCSData17) +#define _LMBCSData18 U_ICU_ENTRY_POINT_RENAME(_LMBCSData18) +#define _LMBCSData19 U_ICU_ENTRY_POINT_RENAME(_LMBCSData19) +#define _LMBCSData2 U_ICU_ENTRY_POINT_RENAME(_LMBCSData2) +#define _LMBCSData3 U_ICU_ENTRY_POINT_RENAME(_LMBCSData3) +#define _LMBCSData4 U_ICU_ENTRY_POINT_RENAME(_LMBCSData4) +#define _LMBCSData5 U_ICU_ENTRY_POINT_RENAME(_LMBCSData5) +#define _LMBCSData6 U_ICU_ENTRY_POINT_RENAME(_LMBCSData6) +#define _LMBCSData8 U_ICU_ENTRY_POINT_RENAME(_LMBCSData8) +#define _Latin1Data U_ICU_ENTRY_POINT_RENAME(_Latin1Data) +#define _MBCSData U_ICU_ENTRY_POINT_RENAME(_MBCSData) +#define _SCSUData U_ICU_ENTRY_POINT_RENAME(_SCSUData) +#define _UTF16BEData U_ICU_ENTRY_POINT_RENAME(_UTF16BEData) +#define _UTF16Data U_ICU_ENTRY_POINT_RENAME(_UTF16Data) +#define _UTF16LEData U_ICU_ENTRY_POINT_RENAME(_UTF16LEData) +#define _UTF16v2Data U_ICU_ENTRY_POINT_RENAME(_UTF16v2Data) +#define _UTF32BEData U_ICU_ENTRY_POINT_RENAME(_UTF32BEData) +#define _UTF32Data U_ICU_ENTRY_POINT_RENAME(_UTF32Data) +#define _UTF32LEData U_ICU_ENTRY_POINT_RENAME(_UTF32LEData) +#define _UTF7Data U_ICU_ENTRY_POINT_RENAME(_UTF7Data) +#define _UTF8Data U_ICU_ENTRY_POINT_RENAME(_UTF8Data) +#define allowedHourFormatsCleanup U_ICU_ENTRY_POINT_RENAME(allowedHourFormatsCleanup) +#define checkImpl U_ICU_ENTRY_POINT_RENAME(checkImpl) +#define cmemory_cleanup U_ICU_ENTRY_POINT_RENAME(cmemory_cleanup) +#define dayPeriodRulesCleanup U_ICU_ENTRY_POINT_RENAME(dayPeriodRulesCleanup) +#define deleteAllowedHourFormats U_ICU_ENTRY_POINT_RENAME(deleteAllowedHourFormats) +#define gTimeZoneFilesInitOnce U_ICU_ENTRY_POINT_RENAME(gTimeZoneFilesInitOnce) +#define izrule_clone U_ICU_ENTRY_POINT_RENAME(izrule_clone) +#define izrule_close U_ICU_ENTRY_POINT_RENAME(izrule_close) +#define izrule_equals U_ICU_ENTRY_POINT_RENAME(izrule_equals) +#define izrule_getDSTSavings U_ICU_ENTRY_POINT_RENAME(izrule_getDSTSavings) +#define izrule_getDynamicClassID U_ICU_ENTRY_POINT_RENAME(izrule_getDynamicClassID) +#define izrule_getFinalStart U_ICU_ENTRY_POINT_RENAME(izrule_getFinalStart) +#define izrule_getFirstStart U_ICU_ENTRY_POINT_RENAME(izrule_getFirstStart) +#define izrule_getName U_ICU_ENTRY_POINT_RENAME(izrule_getName) +#define izrule_getNextStart U_ICU_ENTRY_POINT_RENAME(izrule_getNextStart) +#define izrule_getPreviousStart U_ICU_ENTRY_POINT_RENAME(izrule_getPreviousStart) +#define izrule_getRawOffset U_ICU_ENTRY_POINT_RENAME(izrule_getRawOffset) +#define izrule_getStaticClassID U_ICU_ENTRY_POINT_RENAME(izrule_getStaticClassID) +#define izrule_isEquivalentTo U_ICU_ENTRY_POINT_RENAME(izrule_isEquivalentTo) +#define izrule_open U_ICU_ENTRY_POINT_RENAME(izrule_open) +#define locale_getKeywords U_ICU_ENTRY_POINT_RENAME(locale_getKeywords) +#define locale_getKeywordsStart U_ICU_ENTRY_POINT_RENAME(locale_getKeywordsStart) +#define locale_get_default U_ICU_ENTRY_POINT_RENAME(locale_get_default) +#define locale_set_default U_ICU_ENTRY_POINT_RENAME(locale_set_default) +#define pl_addFontRun U_ICU_ENTRY_POINT_RENAME(pl_addFontRun) +#define pl_addLocaleRun U_ICU_ENTRY_POINT_RENAME(pl_addLocaleRun) +#define pl_addValueRun U_ICU_ENTRY_POINT_RENAME(pl_addValueRun) +#define pl_close U_ICU_ENTRY_POINT_RENAME(pl_close) +#define pl_closeFontRuns U_ICU_ENTRY_POINT_RENAME(pl_closeFontRuns) +#define pl_closeLine U_ICU_ENTRY_POINT_RENAME(pl_closeLine) +#define pl_closeLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_closeLocaleRuns) +#define pl_closeValueRuns U_ICU_ENTRY_POINT_RENAME(pl_closeValueRuns) +#define pl_countLineRuns U_ICU_ENTRY_POINT_RENAME(pl_countLineRuns) +#define pl_create U_ICU_ENTRY_POINT_RENAME(pl_create) +#define pl_getAscent U_ICU_ENTRY_POINT_RENAME(pl_getAscent) +#define pl_getDescent U_ICU_ENTRY_POINT_RENAME(pl_getDescent) +#define pl_getFontRunCount U_ICU_ENTRY_POINT_RENAME(pl_getFontRunCount) +#define pl_getFontRunFont U_ICU_ENTRY_POINT_RENAME(pl_getFontRunFont) +#define pl_getFontRunLastLimit U_ICU_ENTRY_POINT_RENAME(pl_getFontRunLastLimit) +#define pl_getFontRunLimit U_ICU_ENTRY_POINT_RENAME(pl_getFontRunLimit) +#define pl_getLeading U_ICU_ENTRY_POINT_RENAME(pl_getLeading) +#define pl_getLineAscent U_ICU_ENTRY_POINT_RENAME(pl_getLineAscent) +#define pl_getLineDescent U_ICU_ENTRY_POINT_RENAME(pl_getLineDescent) +#define pl_getLineLeading U_ICU_ENTRY_POINT_RENAME(pl_getLineLeading) +#define pl_getLineVisualRun U_ICU_ENTRY_POINT_RENAME(pl_getLineVisualRun) +#define pl_getLineWidth U_ICU_ENTRY_POINT_RENAME(pl_getLineWidth) +#define pl_getLocaleRunCount U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunCount) +#define pl_getLocaleRunLastLimit U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunLastLimit) +#define pl_getLocaleRunLimit U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunLimit) +#define pl_getLocaleRunLocale U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunLocale) +#define pl_getParagraphLevel U_ICU_ENTRY_POINT_RENAME(pl_getParagraphLevel) +#define pl_getTextDirection U_ICU_ENTRY_POINT_RENAME(pl_getTextDirection) +#define pl_getValueRunCount U_ICU_ENTRY_POINT_RENAME(pl_getValueRunCount) +#define pl_getValueRunLastLimit U_ICU_ENTRY_POINT_RENAME(pl_getValueRunLastLimit) +#define pl_getValueRunLimit U_ICU_ENTRY_POINT_RENAME(pl_getValueRunLimit) +#define pl_getValueRunValue U_ICU_ENTRY_POINT_RENAME(pl_getValueRunValue) +#define pl_getVisualRunAscent U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunAscent) +#define pl_getVisualRunDescent U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunDescent) +#define pl_getVisualRunDirection U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunDirection) +#define pl_getVisualRunFont U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunFont) +#define pl_getVisualRunGlyphCount U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunGlyphCount) +#define pl_getVisualRunGlyphToCharMap U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunGlyphToCharMap) +#define pl_getVisualRunGlyphs U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunGlyphs) +#define pl_getVisualRunLeading U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunLeading) +#define pl_getVisualRunPositions U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunPositions) +#define pl_isComplex U_ICU_ENTRY_POINT_RENAME(pl_isComplex) +#define pl_nextLine U_ICU_ENTRY_POINT_RENAME(pl_nextLine) +#define pl_openEmptyFontRuns U_ICU_ENTRY_POINT_RENAME(pl_openEmptyFontRuns) +#define pl_openEmptyLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_openEmptyLocaleRuns) +#define pl_openEmptyValueRuns U_ICU_ENTRY_POINT_RENAME(pl_openEmptyValueRuns) +#define pl_openFontRuns U_ICU_ENTRY_POINT_RENAME(pl_openFontRuns) +#define pl_openLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_openLocaleRuns) +#define pl_openValueRuns U_ICU_ENTRY_POINT_RENAME(pl_openValueRuns) +#define pl_reflow U_ICU_ENTRY_POINT_RENAME(pl_reflow) +#define pl_resetFontRuns U_ICU_ENTRY_POINT_RENAME(pl_resetFontRuns) +#define pl_resetLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_resetLocaleRuns) +#define pl_resetValueRuns U_ICU_ENTRY_POINT_RENAME(pl_resetValueRuns) +#define res_countArrayItems U_ICU_ENTRY_POINT_RENAME(res_countArrayItems) +#define res_findResource U_ICU_ENTRY_POINT_RENAME(res_findResource) +#define res_getAlias U_ICU_ENTRY_POINT_RENAME(res_getAlias) +#define res_getArrayItem U_ICU_ENTRY_POINT_RENAME(res_getArrayItem) +#define res_getBinary U_ICU_ENTRY_POINT_RENAME(res_getBinary) +#define res_getIntVector U_ICU_ENTRY_POINT_RENAME(res_getIntVector) +#define res_getPublicType U_ICU_ENTRY_POINT_RENAME(res_getPublicType) +#define res_getResource U_ICU_ENTRY_POINT_RENAME(res_getResource) +#define res_getString U_ICU_ENTRY_POINT_RENAME(res_getString) +#define res_getTableItemByIndex U_ICU_ENTRY_POINT_RENAME(res_getTableItemByIndex) +#define res_getTableItemByKey U_ICU_ENTRY_POINT_RENAME(res_getTableItemByKey) +#define res_load U_ICU_ENTRY_POINT_RENAME(res_load) +#define res_read U_ICU_ENTRY_POINT_RENAME(res_read) +#define res_unload U_ICU_ENTRY_POINT_RENAME(res_unload) +#define u_UCharsToChars U_ICU_ENTRY_POINT_RENAME(u_UCharsToChars) +#define u_austrcpy U_ICU_ENTRY_POINT_RENAME(u_austrcpy) +#define u_austrncpy U_ICU_ENTRY_POINT_RENAME(u_austrncpy) +#define u_caseInsensitivePrefixMatch U_ICU_ENTRY_POINT_RENAME(u_caseInsensitivePrefixMatch) +#define u_catclose U_ICU_ENTRY_POINT_RENAME(u_catclose) +#define u_catgets U_ICU_ENTRY_POINT_RENAME(u_catgets) +#define u_catopen U_ICU_ENTRY_POINT_RENAME(u_catopen) +#define u_charAge U_ICU_ENTRY_POINT_RENAME(u_charAge) +#define u_charDigitValue U_ICU_ENTRY_POINT_RENAME(u_charDigitValue) +#define u_charDirection U_ICU_ENTRY_POINT_RENAME(u_charDirection) +#define u_charFromName U_ICU_ENTRY_POINT_RENAME(u_charFromName) +#define u_charMirror U_ICU_ENTRY_POINT_RENAME(u_charMirror) +#define u_charName U_ICU_ENTRY_POINT_RENAME(u_charName) +#define u_charType U_ICU_ENTRY_POINT_RENAME(u_charType) +#define u_charsToUChars U_ICU_ENTRY_POINT_RENAME(u_charsToUChars) +#define u_cleanup U_ICU_ENTRY_POINT_RENAME(u_cleanup) +#define u_countChar32 U_ICU_ENTRY_POINT_RENAME(u_countChar32) +#define u_digit U_ICU_ENTRY_POINT_RENAME(u_digit) +#define u_enumCharNames U_ICU_ENTRY_POINT_RENAME(u_enumCharNames) +#define u_enumCharTypes U_ICU_ENTRY_POINT_RENAME(u_enumCharTypes) +#define u_errorName U_ICU_ENTRY_POINT_RENAME(u_errorName) +#define u_fadopt U_ICU_ENTRY_POINT_RENAME(u_fadopt) +#define u_fclose U_ICU_ENTRY_POINT_RENAME(u_fclose) +#define u_feof U_ICU_ENTRY_POINT_RENAME(u_feof) +#define u_fflush U_ICU_ENTRY_POINT_RENAME(u_fflush) +#define u_fgetConverter U_ICU_ENTRY_POINT_RENAME(u_fgetConverter) +#define u_fgetNumberFormat U_ICU_ENTRY_POINT_RENAME(u_fgetNumberFormat) +#define u_fgetc U_ICU_ENTRY_POINT_RENAME(u_fgetc) +#define u_fgetcodepage U_ICU_ENTRY_POINT_RENAME(u_fgetcodepage) +#define u_fgetcx U_ICU_ENTRY_POINT_RENAME(u_fgetcx) +#define u_fgetfile U_ICU_ENTRY_POINT_RENAME(u_fgetfile) +#define u_fgetlocale U_ICU_ENTRY_POINT_RENAME(u_fgetlocale) +#define u_fgets U_ICU_ENTRY_POINT_RENAME(u_fgets) +#define u_file_read U_ICU_ENTRY_POINT_RENAME(u_file_read) +#define u_file_write U_ICU_ENTRY_POINT_RENAME(u_file_write) +#define u_file_write_flush U_ICU_ENTRY_POINT_RENAME(u_file_write_flush) +#define u_finit U_ICU_ENTRY_POINT_RENAME(u_finit) +#define u_flushDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_flushDefaultConverter) +#define u_foldCase U_ICU_ENTRY_POINT_RENAME(u_foldCase) +#define u_fopen U_ICU_ENTRY_POINT_RENAME(u_fopen) +#define u_fopen_u U_ICU_ENTRY_POINT_RENAME(u_fopen_u) +#define u_forDigit U_ICU_ENTRY_POINT_RENAME(u_forDigit) +#define u_formatMessage U_ICU_ENTRY_POINT_RENAME(u_formatMessage) +#define u_formatMessageWithError U_ICU_ENTRY_POINT_RENAME(u_formatMessageWithError) +#define u_fprintf U_ICU_ENTRY_POINT_RENAME(u_fprintf) +#define u_fprintf_u U_ICU_ENTRY_POINT_RENAME(u_fprintf_u) +#define u_fputc U_ICU_ENTRY_POINT_RENAME(u_fputc) +#define u_fputs U_ICU_ENTRY_POINT_RENAME(u_fputs) +#define u_frewind U_ICU_ENTRY_POINT_RENAME(u_frewind) +#define u_fscanf U_ICU_ENTRY_POINT_RENAME(u_fscanf) +#define u_fscanf_u U_ICU_ENTRY_POINT_RENAME(u_fscanf_u) +#define u_fsetcodepage U_ICU_ENTRY_POINT_RENAME(u_fsetcodepage) +#define u_fsetlocale U_ICU_ENTRY_POINT_RENAME(u_fsetlocale) +#define u_fsettransliterator U_ICU_ENTRY_POINT_RENAME(u_fsettransliterator) +#define u_fstropen U_ICU_ENTRY_POINT_RENAME(u_fstropen) +#define u_fungetc U_ICU_ENTRY_POINT_RENAME(u_fungetc) +#define u_getBidiPairedBracket U_ICU_ENTRY_POINT_RENAME(u_getBidiPairedBracket) +#define u_getCombiningClass U_ICU_ENTRY_POINT_RENAME(u_getCombiningClass) +#define u_getDataDirectory U_ICU_ENTRY_POINT_RENAME(u_getDataDirectory) +#define u_getDataVersion U_ICU_ENTRY_POINT_RENAME(u_getDataVersion) +#define u_getDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_getDefaultConverter) +#define u_getFC_NFKC_Closure U_ICU_ENTRY_POINT_RENAME(u_getFC_NFKC_Closure) +#define u_getISOComment U_ICU_ENTRY_POINT_RENAME(u_getISOComment) +#define u_getIntPropertyMaxValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMaxValue) +#define u_getIntPropertyMinValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMinValue) +#define u_getIntPropertyValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyValue) +#define u_getMainProperties U_ICU_ENTRY_POINT_RENAME(u_getMainProperties) +#define u_getNumericValue U_ICU_ENTRY_POINT_RENAME(u_getNumericValue) +#define u_getPropertyEnum U_ICU_ENTRY_POINT_RENAME(u_getPropertyEnum) +#define u_getPropertyName U_ICU_ENTRY_POINT_RENAME(u_getPropertyName) +#define u_getPropertyValueEnum U_ICU_ENTRY_POINT_RENAME(u_getPropertyValueEnum) +#define u_getPropertyValueName U_ICU_ENTRY_POINT_RENAME(u_getPropertyValueName) +#define u_getTimeZoneFilesDirectory U_ICU_ENTRY_POINT_RENAME(u_getTimeZoneFilesDirectory) +#define u_getUnicodeProperties U_ICU_ENTRY_POINT_RENAME(u_getUnicodeProperties) +#define u_getUnicodeVersion U_ICU_ENTRY_POINT_RENAME(u_getUnicodeVersion) +#define u_getVersion U_ICU_ENTRY_POINT_RENAME(u_getVersion) +#define u_get_stdout U_ICU_ENTRY_POINT_RENAME(u_get_stdout) +#define u_hasBinaryProperty U_ICU_ENTRY_POINT_RENAME(u_hasBinaryProperty) +#define u_init U_ICU_ENTRY_POINT_RENAME(u_init) +#define u_isIDIgnorable U_ICU_ENTRY_POINT_RENAME(u_isIDIgnorable) +#define u_isIDPart U_ICU_ENTRY_POINT_RENAME(u_isIDPart) +#define u_isIDStart U_ICU_ENTRY_POINT_RENAME(u_isIDStart) +#define u_isISOControl U_ICU_ENTRY_POINT_RENAME(u_isISOControl) +#define u_isJavaIDPart U_ICU_ENTRY_POINT_RENAME(u_isJavaIDPart) +#define u_isJavaIDStart U_ICU_ENTRY_POINT_RENAME(u_isJavaIDStart) +#define u_isJavaSpaceChar U_ICU_ENTRY_POINT_RENAME(u_isJavaSpaceChar) +#define u_isMirrored U_ICU_ENTRY_POINT_RENAME(u_isMirrored) +#define u_isUAlphabetic U_ICU_ENTRY_POINT_RENAME(u_isUAlphabetic) +#define u_isULowercase U_ICU_ENTRY_POINT_RENAME(u_isULowercase) +#define u_isUUppercase U_ICU_ENTRY_POINT_RENAME(u_isUUppercase) +#define u_isUWhiteSpace U_ICU_ENTRY_POINT_RENAME(u_isUWhiteSpace) +#define u_isWhitespace U_ICU_ENTRY_POINT_RENAME(u_isWhitespace) +#define u_isalnum U_ICU_ENTRY_POINT_RENAME(u_isalnum) +#define u_isalnumPOSIX U_ICU_ENTRY_POINT_RENAME(u_isalnumPOSIX) +#define u_isalpha U_ICU_ENTRY_POINT_RENAME(u_isalpha) +#define u_isbase U_ICU_ENTRY_POINT_RENAME(u_isbase) +#define u_isblank U_ICU_ENTRY_POINT_RENAME(u_isblank) +#define u_iscntrl U_ICU_ENTRY_POINT_RENAME(u_iscntrl) +#define u_isdefined U_ICU_ENTRY_POINT_RENAME(u_isdefined) +#define u_isdigit U_ICU_ENTRY_POINT_RENAME(u_isdigit) +#define u_isgraph U_ICU_ENTRY_POINT_RENAME(u_isgraph) +#define u_isgraphPOSIX U_ICU_ENTRY_POINT_RENAME(u_isgraphPOSIX) +#define u_islower U_ICU_ENTRY_POINT_RENAME(u_islower) +#define u_isprint U_ICU_ENTRY_POINT_RENAME(u_isprint) +#define u_isprintPOSIX U_ICU_ENTRY_POINT_RENAME(u_isprintPOSIX) +#define u_ispunct U_ICU_ENTRY_POINT_RENAME(u_ispunct) +#define u_isspace U_ICU_ENTRY_POINT_RENAME(u_isspace) +#define u_istitle U_ICU_ENTRY_POINT_RENAME(u_istitle) +#define u_isupper U_ICU_ENTRY_POINT_RENAME(u_isupper) +#define u_isxdigit U_ICU_ENTRY_POINT_RENAME(u_isxdigit) +#define u_locbund_close U_ICU_ENTRY_POINT_RENAME(u_locbund_close) +#define u_locbund_getNumberFormat U_ICU_ENTRY_POINT_RENAME(u_locbund_getNumberFormat) +#define u_locbund_init U_ICU_ENTRY_POINT_RENAME(u_locbund_init) +#define u_memcasecmp U_ICU_ENTRY_POINT_RENAME(u_memcasecmp) +#define u_memchr U_ICU_ENTRY_POINT_RENAME(u_memchr) +#define u_memchr32 U_ICU_ENTRY_POINT_RENAME(u_memchr32) +#define u_memcmp U_ICU_ENTRY_POINT_RENAME(u_memcmp) +#define u_memcmpCodePointOrder U_ICU_ENTRY_POINT_RENAME(u_memcmpCodePointOrder) +#define u_memcpy U_ICU_ENTRY_POINT_RENAME(u_memcpy) +#define u_memmove U_ICU_ENTRY_POINT_RENAME(u_memmove) +#define u_memrchr U_ICU_ENTRY_POINT_RENAME(u_memrchr) +#define u_memrchr32 U_ICU_ENTRY_POINT_RENAME(u_memrchr32) +#define u_memset U_ICU_ENTRY_POINT_RENAME(u_memset) +#define u_parseMessage U_ICU_ENTRY_POINT_RENAME(u_parseMessage) +#define u_parseMessageWithError U_ICU_ENTRY_POINT_RENAME(u_parseMessageWithError) +#define u_printf U_ICU_ENTRY_POINT_RENAME(u_printf) +#define u_printf_parse U_ICU_ENTRY_POINT_RENAME(u_printf_parse) +#define u_printf_u U_ICU_ENTRY_POINT_RENAME(u_printf_u) +#define u_releaseDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_releaseDefaultConverter) +#define u_scanf_parse U_ICU_ENTRY_POINT_RENAME(u_scanf_parse) +#define u_setAtomicIncDecFunctions U_ICU_ENTRY_POINT_RENAME(u_setAtomicIncDecFunctions) +#define u_setDataDirectory U_ICU_ENTRY_POINT_RENAME(u_setDataDirectory) +#define u_setMemoryFunctions U_ICU_ENTRY_POINT_RENAME(u_setMemoryFunctions) +#define u_setMutexFunctions U_ICU_ENTRY_POINT_RENAME(u_setMutexFunctions) +#define u_setTimeZoneFilesDirectory U_ICU_ENTRY_POINT_RENAME(u_setTimeZoneFilesDirectory) +#define u_shapeArabic U_ICU_ENTRY_POINT_RENAME(u_shapeArabic) +#define u_snprintf U_ICU_ENTRY_POINT_RENAME(u_snprintf) +#define u_snprintf_u U_ICU_ENTRY_POINT_RENAME(u_snprintf_u) +#define u_sprintf U_ICU_ENTRY_POINT_RENAME(u_sprintf) +#define u_sprintf_u U_ICU_ENTRY_POINT_RENAME(u_sprintf_u) +#define u_sscanf U_ICU_ENTRY_POINT_RENAME(u_sscanf) +#define u_sscanf_u U_ICU_ENTRY_POINT_RENAME(u_sscanf_u) +#define u_strCaseCompare U_ICU_ENTRY_POINT_RENAME(u_strCaseCompare) +#define u_strCompare U_ICU_ENTRY_POINT_RENAME(u_strCompare) +#define u_strCompareIter U_ICU_ENTRY_POINT_RENAME(u_strCompareIter) +#define u_strFindFirst U_ICU_ENTRY_POINT_RENAME(u_strFindFirst) +#define u_strFindLast U_ICU_ENTRY_POINT_RENAME(u_strFindLast) +#define u_strFoldCase U_ICU_ENTRY_POINT_RENAME(u_strFoldCase) +#define u_strFromJavaModifiedUTF8WithSub U_ICU_ENTRY_POINT_RENAME(u_strFromJavaModifiedUTF8WithSub) +#define u_strFromPunycode U_ICU_ENTRY_POINT_RENAME(u_strFromPunycode) +#define u_strFromUTF32 U_ICU_ENTRY_POINT_RENAME(u_strFromUTF32) +#define u_strFromUTF32WithSub U_ICU_ENTRY_POINT_RENAME(u_strFromUTF32WithSub) +#define u_strFromUTF8 U_ICU_ENTRY_POINT_RENAME(u_strFromUTF8) +#define u_strFromUTF8Lenient U_ICU_ENTRY_POINT_RENAME(u_strFromUTF8Lenient) +#define u_strFromUTF8WithSub U_ICU_ENTRY_POINT_RENAME(u_strFromUTF8WithSub) +#define u_strFromWCS U_ICU_ENTRY_POINT_RENAME(u_strFromWCS) +#define u_strHasMoreChar32Than U_ICU_ENTRY_POINT_RENAME(u_strHasMoreChar32Than) +#define u_strToJavaModifiedUTF8 U_ICU_ENTRY_POINT_RENAME(u_strToJavaModifiedUTF8) +#define u_strToLower U_ICU_ENTRY_POINT_RENAME(u_strToLower) +#define u_strToPunycode U_ICU_ENTRY_POINT_RENAME(u_strToPunycode) +#define u_strToTitle U_ICU_ENTRY_POINT_RENAME(u_strToTitle) +#define u_strToUTF32 U_ICU_ENTRY_POINT_RENAME(u_strToUTF32) +#define u_strToUTF32WithSub U_ICU_ENTRY_POINT_RENAME(u_strToUTF32WithSub) +#define u_strToUTF8 U_ICU_ENTRY_POINT_RENAME(u_strToUTF8) +#define u_strToUTF8WithSub U_ICU_ENTRY_POINT_RENAME(u_strToUTF8WithSub) +#define u_strToUpper U_ICU_ENTRY_POINT_RENAME(u_strToUpper) +#define u_strToWCS U_ICU_ENTRY_POINT_RENAME(u_strToWCS) +#define u_strcasecmp U_ICU_ENTRY_POINT_RENAME(u_strcasecmp) +#define u_strcat U_ICU_ENTRY_POINT_RENAME(u_strcat) +#define u_strchr U_ICU_ENTRY_POINT_RENAME(u_strchr) +#define u_strchr32 U_ICU_ENTRY_POINT_RENAME(u_strchr32) +#define u_strcmp U_ICU_ENTRY_POINT_RENAME(u_strcmp) +#define u_strcmpCodePointOrder U_ICU_ENTRY_POINT_RENAME(u_strcmpCodePointOrder) +#define u_strcmpFold U_ICU_ENTRY_POINT_RENAME(u_strcmpFold) +#define u_strcpy U_ICU_ENTRY_POINT_RENAME(u_strcpy) +#define u_strcspn U_ICU_ENTRY_POINT_RENAME(u_strcspn) +#define u_strlen U_ICU_ENTRY_POINT_RENAME(u_strlen) +#define u_strncasecmp U_ICU_ENTRY_POINT_RENAME(u_strncasecmp) +#define u_strncat U_ICU_ENTRY_POINT_RENAME(u_strncat) +#define u_strncmp U_ICU_ENTRY_POINT_RENAME(u_strncmp) +#define u_strncmpCodePointOrder U_ICU_ENTRY_POINT_RENAME(u_strncmpCodePointOrder) +#define u_strncpy U_ICU_ENTRY_POINT_RENAME(u_strncpy) +#define u_strpbrk U_ICU_ENTRY_POINT_RENAME(u_strpbrk) +#define u_strrchr U_ICU_ENTRY_POINT_RENAME(u_strrchr) +#define u_strrchr32 U_ICU_ENTRY_POINT_RENAME(u_strrchr32) +#define u_strrstr U_ICU_ENTRY_POINT_RENAME(u_strrstr) +#define u_strspn U_ICU_ENTRY_POINT_RENAME(u_strspn) +#define u_strstr U_ICU_ENTRY_POINT_RENAME(u_strstr) +#define u_strtok_r U_ICU_ENTRY_POINT_RENAME(u_strtok_r) +#define u_terminateChars U_ICU_ENTRY_POINT_RENAME(u_terminateChars) +#define u_terminateUChar32s U_ICU_ENTRY_POINT_RENAME(u_terminateUChar32s) +#define u_terminateUChars U_ICU_ENTRY_POINT_RENAME(u_terminateUChars) +#define u_terminateWChars U_ICU_ENTRY_POINT_RENAME(u_terminateWChars) +#define u_tolower U_ICU_ENTRY_POINT_RENAME(u_tolower) +#define u_totitle U_ICU_ENTRY_POINT_RENAME(u_totitle) +#define u_toupper U_ICU_ENTRY_POINT_RENAME(u_toupper) +#define u_uastrcpy U_ICU_ENTRY_POINT_RENAME(u_uastrcpy) +#define u_uastrncpy U_ICU_ENTRY_POINT_RENAME(u_uastrncpy) +#define u_unescape U_ICU_ENTRY_POINT_RENAME(u_unescape) +#define u_unescapeAt U_ICU_ENTRY_POINT_RENAME(u_unescapeAt) +#define u_versionFromString U_ICU_ENTRY_POINT_RENAME(u_versionFromString) +#define u_versionFromUString U_ICU_ENTRY_POINT_RENAME(u_versionFromUString) +#define u_versionToString U_ICU_ENTRY_POINT_RENAME(u_versionToString) +#define u_vformatMessage U_ICU_ENTRY_POINT_RENAME(u_vformatMessage) +#define u_vformatMessageWithError U_ICU_ENTRY_POINT_RENAME(u_vformatMessageWithError) +#define u_vfprintf U_ICU_ENTRY_POINT_RENAME(u_vfprintf) +#define u_vfprintf_u U_ICU_ENTRY_POINT_RENAME(u_vfprintf_u) +#define u_vfscanf U_ICU_ENTRY_POINT_RENAME(u_vfscanf) +#define u_vfscanf_u U_ICU_ENTRY_POINT_RENAME(u_vfscanf_u) +#define u_vparseMessage U_ICU_ENTRY_POINT_RENAME(u_vparseMessage) +#define u_vparseMessageWithError U_ICU_ENTRY_POINT_RENAME(u_vparseMessageWithError) +#define u_vsnprintf U_ICU_ENTRY_POINT_RENAME(u_vsnprintf) +#define u_vsnprintf_u U_ICU_ENTRY_POINT_RENAME(u_vsnprintf_u) +#define u_vsprintf U_ICU_ENTRY_POINT_RENAME(u_vsprintf) +#define u_vsprintf_u U_ICU_ENTRY_POINT_RENAME(u_vsprintf_u) +#define u_vsscanf U_ICU_ENTRY_POINT_RENAME(u_vsscanf) +#define u_vsscanf_u U_ICU_ENTRY_POINT_RENAME(u_vsscanf_u) +#define u_writeIdenticalLevelRun U_ICU_ENTRY_POINT_RENAME(u_writeIdenticalLevelRun) +#define ubidi_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(ubidi_addPropertyStarts) +#define ubidi_close U_ICU_ENTRY_POINT_RENAME(ubidi_close) +#define ubidi_countParagraphs U_ICU_ENTRY_POINT_RENAME(ubidi_countParagraphs) +#define ubidi_countRuns U_ICU_ENTRY_POINT_RENAME(ubidi_countRuns) +#define ubidi_getBaseDirection U_ICU_ENTRY_POINT_RENAME(ubidi_getBaseDirection) +#define ubidi_getClass U_ICU_ENTRY_POINT_RENAME(ubidi_getClass) +#define ubidi_getClassCallback U_ICU_ENTRY_POINT_RENAME(ubidi_getClassCallback) +#define ubidi_getCustomizedClass U_ICU_ENTRY_POINT_RENAME(ubidi_getCustomizedClass) +#define ubidi_getDirection U_ICU_ENTRY_POINT_RENAME(ubidi_getDirection) +#define ubidi_getJoiningGroup U_ICU_ENTRY_POINT_RENAME(ubidi_getJoiningGroup) +#define ubidi_getJoiningType U_ICU_ENTRY_POINT_RENAME(ubidi_getJoiningType) +#define ubidi_getLength U_ICU_ENTRY_POINT_RENAME(ubidi_getLength) +#define ubidi_getLevelAt U_ICU_ENTRY_POINT_RENAME(ubidi_getLevelAt) +#define ubidi_getLevels U_ICU_ENTRY_POINT_RENAME(ubidi_getLevels) +#define ubidi_getLogicalIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getLogicalIndex) +#define ubidi_getLogicalMap U_ICU_ENTRY_POINT_RENAME(ubidi_getLogicalMap) +#define ubidi_getLogicalRun U_ICU_ENTRY_POINT_RENAME(ubidi_getLogicalRun) +#define ubidi_getMaxValue U_ICU_ENTRY_POINT_RENAME(ubidi_getMaxValue) +#define ubidi_getMemory U_ICU_ENTRY_POINT_RENAME(ubidi_getMemory) +#define ubidi_getMirror U_ICU_ENTRY_POINT_RENAME(ubidi_getMirror) +#define ubidi_getPairedBracket U_ICU_ENTRY_POINT_RENAME(ubidi_getPairedBracket) +#define ubidi_getPairedBracketType U_ICU_ENTRY_POINT_RENAME(ubidi_getPairedBracketType) +#define ubidi_getParaLevel U_ICU_ENTRY_POINT_RENAME(ubidi_getParaLevel) +#define ubidi_getParaLevelAtIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getParaLevelAtIndex) +#define ubidi_getParagraph U_ICU_ENTRY_POINT_RENAME(ubidi_getParagraph) +#define ubidi_getParagraphByIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getParagraphByIndex) +#define ubidi_getProcessedLength U_ICU_ENTRY_POINT_RENAME(ubidi_getProcessedLength) +#define ubidi_getReorderingMode U_ICU_ENTRY_POINT_RENAME(ubidi_getReorderingMode) +#define ubidi_getReorderingOptions U_ICU_ENTRY_POINT_RENAME(ubidi_getReorderingOptions) +#define ubidi_getResultLength U_ICU_ENTRY_POINT_RENAME(ubidi_getResultLength) +#define ubidi_getRuns U_ICU_ENTRY_POINT_RENAME(ubidi_getRuns) +#define ubidi_getSingleton U_ICU_ENTRY_POINT_RENAME(ubidi_getSingleton) +#define ubidi_getText U_ICU_ENTRY_POINT_RENAME(ubidi_getText) +#define ubidi_getVisualIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getVisualIndex) +#define ubidi_getVisualMap U_ICU_ENTRY_POINT_RENAME(ubidi_getVisualMap) +#define ubidi_getVisualRun U_ICU_ENTRY_POINT_RENAME(ubidi_getVisualRun) +#define ubidi_invertMap U_ICU_ENTRY_POINT_RENAME(ubidi_invertMap) +#define ubidi_isBidiControl U_ICU_ENTRY_POINT_RENAME(ubidi_isBidiControl) +#define ubidi_isInverse U_ICU_ENTRY_POINT_RENAME(ubidi_isInverse) +#define ubidi_isJoinControl U_ICU_ENTRY_POINT_RENAME(ubidi_isJoinControl) +#define ubidi_isMirrored U_ICU_ENTRY_POINT_RENAME(ubidi_isMirrored) +#define ubidi_isOrderParagraphsLTR U_ICU_ENTRY_POINT_RENAME(ubidi_isOrderParagraphsLTR) +#define ubidi_open U_ICU_ENTRY_POINT_RENAME(ubidi_open) +#define ubidi_openSized U_ICU_ENTRY_POINT_RENAME(ubidi_openSized) +#define ubidi_orderParagraphsLTR U_ICU_ENTRY_POINT_RENAME(ubidi_orderParagraphsLTR) +#define ubidi_reorderLogical U_ICU_ENTRY_POINT_RENAME(ubidi_reorderLogical) +#define ubidi_reorderVisual U_ICU_ENTRY_POINT_RENAME(ubidi_reorderVisual) +#define ubidi_setClassCallback U_ICU_ENTRY_POINT_RENAME(ubidi_setClassCallback) +#define ubidi_setContext U_ICU_ENTRY_POINT_RENAME(ubidi_setContext) +#define ubidi_setInverse U_ICU_ENTRY_POINT_RENAME(ubidi_setInverse) +#define ubidi_setLine U_ICU_ENTRY_POINT_RENAME(ubidi_setLine) +#define ubidi_setPara U_ICU_ENTRY_POINT_RENAME(ubidi_setPara) +#define ubidi_setReorderingMode U_ICU_ENTRY_POINT_RENAME(ubidi_setReorderingMode) +#define ubidi_setReorderingOptions U_ICU_ENTRY_POINT_RENAME(ubidi_setReorderingOptions) +#define ubidi_writeReordered U_ICU_ENTRY_POINT_RENAME(ubidi_writeReordered) +#define ubidi_writeReverse U_ICU_ENTRY_POINT_RENAME(ubidi_writeReverse) +#define ubiditransform_close U_ICU_ENTRY_POINT_RENAME(ubiditransform_close) +#define ubiditransform_open U_ICU_ENTRY_POINT_RENAME(ubiditransform_open) +#define ubiditransform_transform U_ICU_ENTRY_POINT_RENAME(ubiditransform_transform) +#define ublock_getCode U_ICU_ENTRY_POINT_RENAME(ublock_getCode) +#define ubrk_close U_ICU_ENTRY_POINT_RENAME(ubrk_close) +#define ubrk_countAvailable U_ICU_ENTRY_POINT_RENAME(ubrk_countAvailable) +#define ubrk_current U_ICU_ENTRY_POINT_RENAME(ubrk_current) +#define ubrk_first U_ICU_ENTRY_POINT_RENAME(ubrk_first) +#define ubrk_following U_ICU_ENTRY_POINT_RENAME(ubrk_following) +#define ubrk_getAvailable U_ICU_ENTRY_POINT_RENAME(ubrk_getAvailable) +#define ubrk_getBinaryRules U_ICU_ENTRY_POINT_RENAME(ubrk_getBinaryRules) +#define ubrk_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ubrk_getLocaleByType) +#define ubrk_getRuleStatus U_ICU_ENTRY_POINT_RENAME(ubrk_getRuleStatus) +#define ubrk_getRuleStatusVec U_ICU_ENTRY_POINT_RENAME(ubrk_getRuleStatusVec) +#define ubrk_isBoundary U_ICU_ENTRY_POINT_RENAME(ubrk_isBoundary) +#define ubrk_last U_ICU_ENTRY_POINT_RENAME(ubrk_last) +#define ubrk_next U_ICU_ENTRY_POINT_RENAME(ubrk_next) +#define ubrk_open U_ICU_ENTRY_POINT_RENAME(ubrk_open) +#define ubrk_openBinaryRules U_ICU_ENTRY_POINT_RENAME(ubrk_openBinaryRules) +#define ubrk_openRules U_ICU_ENTRY_POINT_RENAME(ubrk_openRules) +#define ubrk_preceding U_ICU_ENTRY_POINT_RENAME(ubrk_preceding) +#define ubrk_previous U_ICU_ENTRY_POINT_RENAME(ubrk_previous) +#define ubrk_refreshUText U_ICU_ENTRY_POINT_RENAME(ubrk_refreshUText) +#define ubrk_safeClone U_ICU_ENTRY_POINT_RENAME(ubrk_safeClone) +#define ubrk_setText U_ICU_ENTRY_POINT_RENAME(ubrk_setText) +#define ubrk_setUText U_ICU_ENTRY_POINT_RENAME(ubrk_setUText) +#define ubrk_swap U_ICU_ENTRY_POINT_RENAME(ubrk_swap) +#define ucache_compareKeys U_ICU_ENTRY_POINT_RENAME(ucache_compareKeys) +#define ucache_deleteKey U_ICU_ENTRY_POINT_RENAME(ucache_deleteKey) +#define ucache_hashKeys U_ICU_ENTRY_POINT_RENAME(ucache_hashKeys) +#define ucal_add U_ICU_ENTRY_POINT_RENAME(ucal_add) +#define ucal_clear U_ICU_ENTRY_POINT_RENAME(ucal_clear) +#define ucal_clearField U_ICU_ENTRY_POINT_RENAME(ucal_clearField) +#define ucal_clone U_ICU_ENTRY_POINT_RENAME(ucal_clone) +#define ucal_close U_ICU_ENTRY_POINT_RENAME(ucal_close) +#define ucal_countAvailable U_ICU_ENTRY_POINT_RENAME(ucal_countAvailable) +#define ucal_equivalentTo U_ICU_ENTRY_POINT_RENAME(ucal_equivalentTo) +#define ucal_get U_ICU_ENTRY_POINT_RENAME(ucal_get) +#define ucal_getAttribute U_ICU_ENTRY_POINT_RENAME(ucal_getAttribute) +#define ucal_getAvailable U_ICU_ENTRY_POINT_RENAME(ucal_getAvailable) +#define ucal_getCanonicalTimeZoneID U_ICU_ENTRY_POINT_RENAME(ucal_getCanonicalTimeZoneID) +#define ucal_getDSTSavings U_ICU_ENTRY_POINT_RENAME(ucal_getDSTSavings) +#define ucal_getDayOfWeekType U_ICU_ENTRY_POINT_RENAME(ucal_getDayOfWeekType) +#define ucal_getDefaultTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_getDefaultTimeZone) +#define ucal_getFieldDifference U_ICU_ENTRY_POINT_RENAME(ucal_getFieldDifference) +#define ucal_getGregorianChange U_ICU_ENTRY_POINT_RENAME(ucal_getGregorianChange) +#define ucal_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucal_getKeywordValuesForLocale) +#define ucal_getLimit U_ICU_ENTRY_POINT_RENAME(ucal_getLimit) +#define ucal_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ucal_getLocaleByType) +#define ucal_getMillis U_ICU_ENTRY_POINT_RENAME(ucal_getMillis) +#define ucal_getNow U_ICU_ENTRY_POINT_RENAME(ucal_getNow) +#define ucal_getTZDataVersion U_ICU_ENTRY_POINT_RENAME(ucal_getTZDataVersion) +#define ucal_getTimeZoneDisplayName U_ICU_ENTRY_POINT_RENAME(ucal_getTimeZoneDisplayName) +#define ucal_getTimeZoneID U_ICU_ENTRY_POINT_RENAME(ucal_getTimeZoneID) +#define ucal_getTimeZoneIDForWindowsID U_ICU_ENTRY_POINT_RENAME(ucal_getTimeZoneIDForWindowsID) +#define ucal_getTimeZoneTransitionDate U_ICU_ENTRY_POINT_RENAME(ucal_getTimeZoneTransitionDate) +#define ucal_getType U_ICU_ENTRY_POINT_RENAME(ucal_getType) +#define ucal_getWeekendTransition U_ICU_ENTRY_POINT_RENAME(ucal_getWeekendTransition) +#define ucal_getWindowsTimeZoneID U_ICU_ENTRY_POINT_RENAME(ucal_getWindowsTimeZoneID) +#define ucal_inDaylightTime U_ICU_ENTRY_POINT_RENAME(ucal_inDaylightTime) +#define ucal_isSet U_ICU_ENTRY_POINT_RENAME(ucal_isSet) +#define ucal_isWeekend U_ICU_ENTRY_POINT_RENAME(ucal_isWeekend) +#define ucal_open U_ICU_ENTRY_POINT_RENAME(ucal_open) +#define ucal_openCountryTimeZones U_ICU_ENTRY_POINT_RENAME(ucal_openCountryTimeZones) +#define ucal_openTimeZoneIDEnumeration U_ICU_ENTRY_POINT_RENAME(ucal_openTimeZoneIDEnumeration) +#define ucal_openTimeZones U_ICU_ENTRY_POINT_RENAME(ucal_openTimeZones) +#define ucal_roll U_ICU_ENTRY_POINT_RENAME(ucal_roll) +#define ucal_set U_ICU_ENTRY_POINT_RENAME(ucal_set) +#define ucal_setAttribute U_ICU_ENTRY_POINT_RENAME(ucal_setAttribute) +#define ucal_setDate U_ICU_ENTRY_POINT_RENAME(ucal_setDate) +#define ucal_setDateTime U_ICU_ENTRY_POINT_RENAME(ucal_setDateTime) +#define ucal_setDefaultTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_setDefaultTimeZone) +#define ucal_setGregorianChange U_ICU_ENTRY_POINT_RENAME(ucal_setGregorianChange) +#define ucal_setMillis U_ICU_ENTRY_POINT_RENAME(ucal_setMillis) +#define ucal_setTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_setTimeZone) +#define ucase_addCaseClosure U_ICU_ENTRY_POINT_RENAME(ucase_addCaseClosure) +#define ucase_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(ucase_addPropertyStarts) +#define ucase_addStringCaseClosure U_ICU_ENTRY_POINT_RENAME(ucase_addStringCaseClosure) +#define ucase_fold U_ICU_ENTRY_POINT_RENAME(ucase_fold) +#define ucase_getCaseLocale U_ICU_ENTRY_POINT_RENAME(ucase_getCaseLocale) +#define ucase_getType U_ICU_ENTRY_POINT_RENAME(ucase_getType) +#define ucase_getTypeOrIgnorable U_ICU_ENTRY_POINT_RENAME(ucase_getTypeOrIgnorable) +#define ucase_hasBinaryProperty U_ICU_ENTRY_POINT_RENAME(ucase_hasBinaryProperty) +#define ucase_isCaseSensitive U_ICU_ENTRY_POINT_RENAME(ucase_isCaseSensitive) +#define ucase_isSoftDotted U_ICU_ENTRY_POINT_RENAME(ucase_isSoftDotted) +#define ucase_toFullFolding U_ICU_ENTRY_POINT_RENAME(ucase_toFullFolding) +#define ucase_toFullLower U_ICU_ENTRY_POINT_RENAME(ucase_toFullLower) +#define ucase_toFullTitle U_ICU_ENTRY_POINT_RENAME(ucase_toFullTitle) +#define ucase_toFullUpper U_ICU_ENTRY_POINT_RENAME(ucase_toFullUpper) +#define ucase_tolower U_ICU_ENTRY_POINT_RENAME(ucase_tolower) +#define ucase_totitle U_ICU_ENTRY_POINT_RENAME(ucase_totitle) +#define ucase_toupper U_ICU_ENTRY_POINT_RENAME(ucase_toupper) +#define ucasemap_close U_ICU_ENTRY_POINT_RENAME(ucasemap_close) +#define ucasemap_getBreakIterator U_ICU_ENTRY_POINT_RENAME(ucasemap_getBreakIterator) +#define ucasemap_getLocale U_ICU_ENTRY_POINT_RENAME(ucasemap_getLocale) +#define ucasemap_getOptions U_ICU_ENTRY_POINT_RENAME(ucasemap_getOptions) +#define ucasemap_internalUTF8ToTitle U_ICU_ENTRY_POINT_RENAME(ucasemap_internalUTF8ToTitle) +#define ucasemap_mapUTF8 U_ICU_ENTRY_POINT_RENAME(ucasemap_mapUTF8) +#define ucasemap_open U_ICU_ENTRY_POINT_RENAME(ucasemap_open) +#define ucasemap_setBreakIterator U_ICU_ENTRY_POINT_RENAME(ucasemap_setBreakIterator) +#define ucasemap_setLocale U_ICU_ENTRY_POINT_RENAME(ucasemap_setLocale) +#define ucasemap_setOptions U_ICU_ENTRY_POINT_RENAME(ucasemap_setOptions) +#define ucasemap_toTitle U_ICU_ENTRY_POINT_RENAME(ucasemap_toTitle) +#define ucasemap_utf8FoldCase U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8FoldCase) +#define ucasemap_utf8ToLower U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToLower) +#define ucasemap_utf8ToTitle U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToTitle) +#define ucasemap_utf8ToUpper U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToUpper) +#define uchar_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(uchar_addPropertyStarts) +#define uchar_swapNames U_ICU_ENTRY_POINT_RENAME(uchar_swapNames) +#define ucln_cleanupOne U_ICU_ENTRY_POINT_RENAME(ucln_cleanupOne) +#define ucln_common_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_common_registerCleanup) +#define ucln_i18n_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_i18n_registerCleanup) +#define ucln_io_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_io_registerCleanup) +#define ucln_lib_cleanup U_ICU_ENTRY_POINT_RENAME(ucln_lib_cleanup) +#define ucln_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_registerCleanup) +#define ucnv_MBCSFromUChar32 U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSFromUChar32) +#define ucnv_MBCSFromUnicodeWithOffsets U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSFromUnicodeWithOffsets) +#define ucnv_MBCSGetFilteredUnicodeSetForUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSGetFilteredUnicodeSetForUnicode) +#define ucnv_MBCSGetType U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSGetType) +#define ucnv_MBCSGetUnicodeSetForUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSGetUnicodeSetForUnicode) +#define ucnv_MBCSIsLeadByte U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSIsLeadByte) +#define ucnv_MBCSSimpleGetNextUChar U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSSimpleGetNextUChar) +#define ucnv_MBCSToUnicodeWithOffsets U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSToUnicodeWithOffsets) +#define ucnv_bld_countAvailableConverters U_ICU_ENTRY_POINT_RENAME(ucnv_bld_countAvailableConverters) +#define ucnv_bld_getAvailableConverter U_ICU_ENTRY_POINT_RENAME(ucnv_bld_getAvailableConverter) +#define ucnv_canCreateConverter U_ICU_ENTRY_POINT_RENAME(ucnv_canCreateConverter) +#define ucnv_cbFromUWriteBytes U_ICU_ENTRY_POINT_RENAME(ucnv_cbFromUWriteBytes) +#define ucnv_cbFromUWriteSub U_ICU_ENTRY_POINT_RENAME(ucnv_cbFromUWriteSub) +#define ucnv_cbFromUWriteUChars U_ICU_ENTRY_POINT_RENAME(ucnv_cbFromUWriteUChars) +#define ucnv_cbToUWriteSub U_ICU_ENTRY_POINT_RENAME(ucnv_cbToUWriteSub) +#define ucnv_cbToUWriteUChars U_ICU_ENTRY_POINT_RENAME(ucnv_cbToUWriteUChars) +#define ucnv_close U_ICU_ENTRY_POINT_RENAME(ucnv_close) +#define ucnv_compareNames U_ICU_ENTRY_POINT_RENAME(ucnv_compareNames) +#define ucnv_convert U_ICU_ENTRY_POINT_RENAME(ucnv_convert) +#define ucnv_convertEx U_ICU_ENTRY_POINT_RENAME(ucnv_convertEx) +#define ucnv_countAliases U_ICU_ENTRY_POINT_RENAME(ucnv_countAliases) +#define ucnv_countAvailable U_ICU_ENTRY_POINT_RENAME(ucnv_countAvailable) +#define ucnv_countStandards U_ICU_ENTRY_POINT_RENAME(ucnv_countStandards) +#define ucnv_createAlgorithmicConverter U_ICU_ENTRY_POINT_RENAME(ucnv_createAlgorithmicConverter) +#define ucnv_createConverter U_ICU_ENTRY_POINT_RENAME(ucnv_createConverter) +#define ucnv_createConverterFromPackage U_ICU_ENTRY_POINT_RENAME(ucnv_createConverterFromPackage) +#define ucnv_createConverterFromSharedData U_ICU_ENTRY_POINT_RENAME(ucnv_createConverterFromSharedData) +#define ucnv_detectUnicodeSignature U_ICU_ENTRY_POINT_RENAME(ucnv_detectUnicodeSignature) +#define ucnv_extContinueMatchFromU U_ICU_ENTRY_POINT_RENAME(ucnv_extContinueMatchFromU) +#define ucnv_extContinueMatchToU U_ICU_ENTRY_POINT_RENAME(ucnv_extContinueMatchToU) +#define ucnv_extGetUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_extGetUnicodeSet) +#define ucnv_extInitialMatchFromU U_ICU_ENTRY_POINT_RENAME(ucnv_extInitialMatchFromU) +#define ucnv_extInitialMatchToU U_ICU_ENTRY_POINT_RENAME(ucnv_extInitialMatchToU) +#define ucnv_extSimpleMatchFromU U_ICU_ENTRY_POINT_RENAME(ucnv_extSimpleMatchFromU) +#define ucnv_extSimpleMatchToU U_ICU_ENTRY_POINT_RENAME(ucnv_extSimpleMatchToU) +#define ucnv_fixFileSeparator U_ICU_ENTRY_POINT_RENAME(ucnv_fixFileSeparator) +#define ucnv_flushCache U_ICU_ENTRY_POINT_RENAME(ucnv_flushCache) +#define ucnv_fromAlgorithmic U_ICU_ENTRY_POINT_RENAME(ucnv_fromAlgorithmic) +#define ucnv_fromUChars U_ICU_ENTRY_POINT_RENAME(ucnv_fromUChars) +#define ucnv_fromUCountPending U_ICU_ENTRY_POINT_RENAME(ucnv_fromUCountPending) +#define ucnv_fromUWriteBytes U_ICU_ENTRY_POINT_RENAME(ucnv_fromUWriteBytes) +#define ucnv_fromUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_fromUnicode) +#define ucnv_fromUnicode_UTF8 U_ICU_ENTRY_POINT_RENAME(ucnv_fromUnicode_UTF8) +#define ucnv_fromUnicode_UTF8_OFFSETS_LOGIC U_ICU_ENTRY_POINT_RENAME(ucnv_fromUnicode_UTF8_OFFSETS_LOGIC) +#define ucnv_getAlias U_ICU_ENTRY_POINT_RENAME(ucnv_getAlias) +#define ucnv_getAliases U_ICU_ENTRY_POINT_RENAME(ucnv_getAliases) +#define ucnv_getAvailableName U_ICU_ENTRY_POINT_RENAME(ucnv_getAvailableName) +#define ucnv_getCCSID U_ICU_ENTRY_POINT_RENAME(ucnv_getCCSID) +#define ucnv_getCanonicalName U_ICU_ENTRY_POINT_RENAME(ucnv_getCanonicalName) +#define ucnv_getCompleteUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_getCompleteUnicodeSet) +#define ucnv_getDefaultName U_ICU_ENTRY_POINT_RENAME(ucnv_getDefaultName) +#define ucnv_getDisplayName U_ICU_ENTRY_POINT_RENAME(ucnv_getDisplayName) +#define ucnv_getFromUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_getFromUCallBack) +#define ucnv_getInvalidChars U_ICU_ENTRY_POINT_RENAME(ucnv_getInvalidChars) +#define ucnv_getInvalidUChars U_ICU_ENTRY_POINT_RENAME(ucnv_getInvalidUChars) +#define ucnv_getMaxCharSize U_ICU_ENTRY_POINT_RENAME(ucnv_getMaxCharSize) +#define ucnv_getMinCharSize U_ICU_ENTRY_POINT_RENAME(ucnv_getMinCharSize) +#define ucnv_getName U_ICU_ENTRY_POINT_RENAME(ucnv_getName) +#define ucnv_getNextUChar U_ICU_ENTRY_POINT_RENAME(ucnv_getNextUChar) +#define ucnv_getNonSurrogateUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_getNonSurrogateUnicodeSet) +#define ucnv_getPlatform U_ICU_ENTRY_POINT_RENAME(ucnv_getPlatform) +#define ucnv_getStandard U_ICU_ENTRY_POINT_RENAME(ucnv_getStandard) +#define ucnv_getStandardName U_ICU_ENTRY_POINT_RENAME(ucnv_getStandardName) +#define ucnv_getStarters U_ICU_ENTRY_POINT_RENAME(ucnv_getStarters) +#define ucnv_getSubstChars U_ICU_ENTRY_POINT_RENAME(ucnv_getSubstChars) +#define ucnv_getToUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_getToUCallBack) +#define ucnv_getType U_ICU_ENTRY_POINT_RENAME(ucnv_getType) +#define ucnv_getUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_getUnicodeSet) +#define ucnv_incrementRefCount U_ICU_ENTRY_POINT_RENAME(ucnv_incrementRefCount) +#define ucnv_io_countKnownConverters U_ICU_ENTRY_POINT_RENAME(ucnv_io_countKnownConverters) +#define ucnv_io_getConverterName U_ICU_ENTRY_POINT_RENAME(ucnv_io_getConverterName) +#define ucnv_io_stripASCIIForCompare U_ICU_ENTRY_POINT_RENAME(ucnv_io_stripASCIIForCompare) +#define ucnv_io_stripEBCDICForCompare U_ICU_ENTRY_POINT_RENAME(ucnv_io_stripEBCDICForCompare) +#define ucnv_isAmbiguous U_ICU_ENTRY_POINT_RENAME(ucnv_isAmbiguous) +#define ucnv_isFixedWidth U_ICU_ENTRY_POINT_RENAME(ucnv_isFixedWidth) +#define ucnv_load U_ICU_ENTRY_POINT_RENAME(ucnv_load) +#define ucnv_loadSharedData U_ICU_ENTRY_POINT_RENAME(ucnv_loadSharedData) +#define ucnv_open U_ICU_ENTRY_POINT_RENAME(ucnv_open) +#define ucnv_openAllNames U_ICU_ENTRY_POINT_RENAME(ucnv_openAllNames) +#define ucnv_openCCSID U_ICU_ENTRY_POINT_RENAME(ucnv_openCCSID) +#define ucnv_openPackage U_ICU_ENTRY_POINT_RENAME(ucnv_openPackage) +#define ucnv_openStandardNames U_ICU_ENTRY_POINT_RENAME(ucnv_openStandardNames) +#define ucnv_openU U_ICU_ENTRY_POINT_RENAME(ucnv_openU) +#define ucnv_reset U_ICU_ENTRY_POINT_RENAME(ucnv_reset) +#define ucnv_resetFromUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_resetFromUnicode) +#define ucnv_resetToUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_resetToUnicode) +#define ucnv_safeClone U_ICU_ENTRY_POINT_RENAME(ucnv_safeClone) +#define ucnv_setDefaultName U_ICU_ENTRY_POINT_RENAME(ucnv_setDefaultName) +#define ucnv_setFallback U_ICU_ENTRY_POINT_RENAME(ucnv_setFallback) +#define ucnv_setFromUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_setFromUCallBack) +#define ucnv_setSubstChars U_ICU_ENTRY_POINT_RENAME(ucnv_setSubstChars) +#define ucnv_setSubstString U_ICU_ENTRY_POINT_RENAME(ucnv_setSubstString) +#define ucnv_setToUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_setToUCallBack) +#define ucnv_swap U_ICU_ENTRY_POINT_RENAME(ucnv_swap) +#define ucnv_swapAliases U_ICU_ENTRY_POINT_RENAME(ucnv_swapAliases) +#define ucnv_toAlgorithmic U_ICU_ENTRY_POINT_RENAME(ucnv_toAlgorithmic) +#define ucnv_toUChars U_ICU_ENTRY_POINT_RENAME(ucnv_toUChars) +#define ucnv_toUCountPending U_ICU_ENTRY_POINT_RENAME(ucnv_toUCountPending) +#define ucnv_toUWriteCodePoint U_ICU_ENTRY_POINT_RENAME(ucnv_toUWriteCodePoint) +#define ucnv_toUWriteUChars U_ICU_ENTRY_POINT_RENAME(ucnv_toUWriteUChars) +#define ucnv_toUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_toUnicode) +#define ucnv_unload U_ICU_ENTRY_POINT_RENAME(ucnv_unload) +#define ucnv_unloadSharedDataIfReady U_ICU_ENTRY_POINT_RENAME(ucnv_unloadSharedDataIfReady) +#define ucnv_usesFallback U_ICU_ENTRY_POINT_RENAME(ucnv_usesFallback) +#define ucnvsel_close U_ICU_ENTRY_POINT_RENAME(ucnvsel_close) +#define ucnvsel_open U_ICU_ENTRY_POINT_RENAME(ucnvsel_open) +#define ucnvsel_openFromSerialized U_ICU_ENTRY_POINT_RENAME(ucnvsel_openFromSerialized) +#define ucnvsel_selectForString U_ICU_ENTRY_POINT_RENAME(ucnvsel_selectForString) +#define ucnvsel_selectForUTF8 U_ICU_ENTRY_POINT_RENAME(ucnvsel_selectForUTF8) +#define ucnvsel_serialize U_ICU_ENTRY_POINT_RENAME(ucnvsel_serialize) +#define ucol_cloneBinary U_ICU_ENTRY_POINT_RENAME(ucol_cloneBinary) +#define ucol_close U_ICU_ENTRY_POINT_RENAME(ucol_close) +#define ucol_closeElements U_ICU_ENTRY_POINT_RENAME(ucol_closeElements) +#define ucol_countAvailable U_ICU_ENTRY_POINT_RENAME(ucol_countAvailable) +#define ucol_equal U_ICU_ENTRY_POINT_RENAME(ucol_equal) +#define ucol_equals U_ICU_ENTRY_POINT_RENAME(ucol_equals) +#define ucol_getAttribute U_ICU_ENTRY_POINT_RENAME(ucol_getAttribute) +#define ucol_getAvailable U_ICU_ENTRY_POINT_RENAME(ucol_getAvailable) +#define ucol_getBound U_ICU_ENTRY_POINT_RENAME(ucol_getBound) +#define ucol_getContractions U_ICU_ENTRY_POINT_RENAME(ucol_getContractions) +#define ucol_getContractionsAndExpansions U_ICU_ENTRY_POINT_RENAME(ucol_getContractionsAndExpansions) +#define ucol_getDisplayName U_ICU_ENTRY_POINT_RENAME(ucol_getDisplayName) +#define ucol_getEquivalentReorderCodes U_ICU_ENTRY_POINT_RENAME(ucol_getEquivalentReorderCodes) +#define ucol_getFunctionalEquivalent U_ICU_ENTRY_POINT_RENAME(ucol_getFunctionalEquivalent) +#define ucol_getKeywordValues U_ICU_ENTRY_POINT_RENAME(ucol_getKeywordValues) +#define ucol_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucol_getKeywordValuesForLocale) +#define ucol_getKeywords U_ICU_ENTRY_POINT_RENAME(ucol_getKeywords) +#define ucol_getLocale U_ICU_ENTRY_POINT_RENAME(ucol_getLocale) +#define ucol_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ucol_getLocaleByType) +#define ucol_getMaxExpansion U_ICU_ENTRY_POINT_RENAME(ucol_getMaxExpansion) +#define ucol_getMaxVariable U_ICU_ENTRY_POINT_RENAME(ucol_getMaxVariable) +#define ucol_getOffset U_ICU_ENTRY_POINT_RENAME(ucol_getOffset) +#define ucol_getReorderCodes U_ICU_ENTRY_POINT_RENAME(ucol_getReorderCodes) +#define ucol_getRules U_ICU_ENTRY_POINT_RENAME(ucol_getRules) +#define ucol_getRulesEx U_ICU_ENTRY_POINT_RENAME(ucol_getRulesEx) +#define ucol_getShortDefinitionString U_ICU_ENTRY_POINT_RENAME(ucol_getShortDefinitionString) +#define ucol_getSortKey U_ICU_ENTRY_POINT_RENAME(ucol_getSortKey) +#define ucol_getStrength U_ICU_ENTRY_POINT_RENAME(ucol_getStrength) +#define ucol_getTailoredSet U_ICU_ENTRY_POINT_RENAME(ucol_getTailoredSet) +#define ucol_getUCAVersion U_ICU_ENTRY_POINT_RENAME(ucol_getUCAVersion) +#define ucol_getUnsafeSet U_ICU_ENTRY_POINT_RENAME(ucol_getUnsafeSet) +#define ucol_getVariableTop U_ICU_ENTRY_POINT_RENAME(ucol_getVariableTop) +#define ucol_getVersion U_ICU_ENTRY_POINT_RENAME(ucol_getVersion) +#define ucol_greater U_ICU_ENTRY_POINT_RENAME(ucol_greater) +#define ucol_greaterOrEqual U_ICU_ENTRY_POINT_RENAME(ucol_greaterOrEqual) +#define ucol_keyHashCode U_ICU_ENTRY_POINT_RENAME(ucol_keyHashCode) +#define ucol_looksLikeCollationBinary U_ICU_ENTRY_POINT_RENAME(ucol_looksLikeCollationBinary) +#define ucol_mergeSortkeys U_ICU_ENTRY_POINT_RENAME(ucol_mergeSortkeys) +#define ucol_next U_ICU_ENTRY_POINT_RENAME(ucol_next) +#define ucol_nextSortKeyPart U_ICU_ENTRY_POINT_RENAME(ucol_nextSortKeyPart) +#define ucol_normalizeShortDefinitionString U_ICU_ENTRY_POINT_RENAME(ucol_normalizeShortDefinitionString) +#define ucol_open U_ICU_ENTRY_POINT_RENAME(ucol_open) +#define ucol_openAvailableLocales U_ICU_ENTRY_POINT_RENAME(ucol_openAvailableLocales) +#define ucol_openBinary U_ICU_ENTRY_POINT_RENAME(ucol_openBinary) +#define ucol_openElements U_ICU_ENTRY_POINT_RENAME(ucol_openElements) +#define ucol_openFromShortString U_ICU_ENTRY_POINT_RENAME(ucol_openFromShortString) +#define ucol_openRules U_ICU_ENTRY_POINT_RENAME(ucol_openRules) +#define ucol_prepareShortStringOpen U_ICU_ENTRY_POINT_RENAME(ucol_prepareShortStringOpen) +#define ucol_previous U_ICU_ENTRY_POINT_RENAME(ucol_previous) +#define ucol_primaryOrder U_ICU_ENTRY_POINT_RENAME(ucol_primaryOrder) +#define ucol_reset U_ICU_ENTRY_POINT_RENAME(ucol_reset) +#define ucol_restoreVariableTop U_ICU_ENTRY_POINT_RENAME(ucol_restoreVariableTop) +#define ucol_safeClone U_ICU_ENTRY_POINT_RENAME(ucol_safeClone) +#define ucol_secondaryOrder U_ICU_ENTRY_POINT_RENAME(ucol_secondaryOrder) +#define ucol_setAttribute U_ICU_ENTRY_POINT_RENAME(ucol_setAttribute) +#define ucol_setMaxVariable U_ICU_ENTRY_POINT_RENAME(ucol_setMaxVariable) +#define ucol_setOffset U_ICU_ENTRY_POINT_RENAME(ucol_setOffset) +#define ucol_setReorderCodes U_ICU_ENTRY_POINT_RENAME(ucol_setReorderCodes) +#define ucol_setStrength U_ICU_ENTRY_POINT_RENAME(ucol_setStrength) +#define ucol_setText U_ICU_ENTRY_POINT_RENAME(ucol_setText) +#define ucol_setVariableTop U_ICU_ENTRY_POINT_RENAME(ucol_setVariableTop) +#define ucol_strcoll U_ICU_ENTRY_POINT_RENAME(ucol_strcoll) +#define ucol_strcollIter U_ICU_ENTRY_POINT_RENAME(ucol_strcollIter) +#define ucol_strcollUTF8 U_ICU_ENTRY_POINT_RENAME(ucol_strcollUTF8) +#define ucol_swap U_ICU_ENTRY_POINT_RENAME(ucol_swap) +#define ucol_swapInverseUCA U_ICU_ENTRY_POINT_RENAME(ucol_swapInverseUCA) +#define ucol_tertiaryOrder U_ICU_ENTRY_POINT_RENAME(ucol_tertiaryOrder) +#define ucsdet_close U_ICU_ENTRY_POINT_RENAME(ucsdet_close) +#define ucsdet_detect U_ICU_ENTRY_POINT_RENAME(ucsdet_detect) +#define ucsdet_detectAll U_ICU_ENTRY_POINT_RENAME(ucsdet_detectAll) +#define ucsdet_enableInputFilter U_ICU_ENTRY_POINT_RENAME(ucsdet_enableInputFilter) +#define ucsdet_getAllDetectableCharsets U_ICU_ENTRY_POINT_RENAME(ucsdet_getAllDetectableCharsets) +#define ucsdet_getConfidence U_ICU_ENTRY_POINT_RENAME(ucsdet_getConfidence) +#define ucsdet_getDetectableCharsets U_ICU_ENTRY_POINT_RENAME(ucsdet_getDetectableCharsets) +#define ucsdet_getLanguage U_ICU_ENTRY_POINT_RENAME(ucsdet_getLanguage) +#define ucsdet_getName U_ICU_ENTRY_POINT_RENAME(ucsdet_getName) +#define ucsdet_getUChars U_ICU_ENTRY_POINT_RENAME(ucsdet_getUChars) +#define ucsdet_isInputFilterEnabled U_ICU_ENTRY_POINT_RENAME(ucsdet_isInputFilterEnabled) +#define ucsdet_open U_ICU_ENTRY_POINT_RENAME(ucsdet_open) +#define ucsdet_setDeclaredEncoding U_ICU_ENTRY_POINT_RENAME(ucsdet_setDeclaredEncoding) +#define ucsdet_setDetectableCharset U_ICU_ENTRY_POINT_RENAME(ucsdet_setDetectableCharset) +#define ucsdet_setText U_ICU_ENTRY_POINT_RENAME(ucsdet_setText) +#define ucurr_countCurrencies U_ICU_ENTRY_POINT_RENAME(ucurr_countCurrencies) +#define ucurr_forLocale U_ICU_ENTRY_POINT_RENAME(ucurr_forLocale) +#define ucurr_forLocaleAndDate U_ICU_ENTRY_POINT_RENAME(ucurr_forLocaleAndDate) +#define ucurr_getDefaultFractionDigits U_ICU_ENTRY_POINT_RENAME(ucurr_getDefaultFractionDigits) +#define ucurr_getDefaultFractionDigitsForUsage U_ICU_ENTRY_POINT_RENAME(ucurr_getDefaultFractionDigitsForUsage) +#define ucurr_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucurr_getKeywordValuesForLocale) +#define ucurr_getName U_ICU_ENTRY_POINT_RENAME(ucurr_getName) +#define ucurr_getNumericCode U_ICU_ENTRY_POINT_RENAME(ucurr_getNumericCode) +#define ucurr_getPluralName U_ICU_ENTRY_POINT_RENAME(ucurr_getPluralName) +#define ucurr_getRoundingIncrement U_ICU_ENTRY_POINT_RENAME(ucurr_getRoundingIncrement) +#define ucurr_getRoundingIncrementForUsage U_ICU_ENTRY_POINT_RENAME(ucurr_getRoundingIncrementForUsage) +#define ucurr_isAvailable U_ICU_ENTRY_POINT_RENAME(ucurr_isAvailable) +#define ucurr_openISOCurrencies U_ICU_ENTRY_POINT_RENAME(ucurr_openISOCurrencies) +#define ucurr_register U_ICU_ENTRY_POINT_RENAME(ucurr_register) +#define ucurr_unregister U_ICU_ENTRY_POINT_RENAME(ucurr_unregister) +#define udat_adoptNumberFormat U_ICU_ENTRY_POINT_RENAME(udat_adoptNumberFormat) +#define udat_adoptNumberFormatForFields U_ICU_ENTRY_POINT_RENAME(udat_adoptNumberFormatForFields) +#define udat_applyPattern U_ICU_ENTRY_POINT_RENAME(udat_applyPattern) +#define udat_applyPatternRelative U_ICU_ENTRY_POINT_RENAME(udat_applyPatternRelative) +#define udat_clone U_ICU_ENTRY_POINT_RENAME(udat_clone) +#define udat_close U_ICU_ENTRY_POINT_RENAME(udat_close) +#define udat_countAvailable U_ICU_ENTRY_POINT_RENAME(udat_countAvailable) +#define udat_countSymbols U_ICU_ENTRY_POINT_RENAME(udat_countSymbols) +#define udat_format U_ICU_ENTRY_POINT_RENAME(udat_format) +#define udat_formatCalendar U_ICU_ENTRY_POINT_RENAME(udat_formatCalendar) +#define udat_formatCalendarForFields U_ICU_ENTRY_POINT_RENAME(udat_formatCalendarForFields) +#define udat_formatForFields U_ICU_ENTRY_POINT_RENAME(udat_formatForFields) +#define udat_get2DigitYearStart U_ICU_ENTRY_POINT_RENAME(udat_get2DigitYearStart) +#define udat_getAvailable U_ICU_ENTRY_POINT_RENAME(udat_getAvailable) +#define udat_getBooleanAttribute U_ICU_ENTRY_POINT_RENAME(udat_getBooleanAttribute) +#define udat_getCalendar U_ICU_ENTRY_POINT_RENAME(udat_getCalendar) +#define udat_getContext U_ICU_ENTRY_POINT_RENAME(udat_getContext) +#define udat_getLocaleByType U_ICU_ENTRY_POINT_RENAME(udat_getLocaleByType) +#define udat_getNumberFormat U_ICU_ENTRY_POINT_RENAME(udat_getNumberFormat) +#define udat_getNumberFormatForField U_ICU_ENTRY_POINT_RENAME(udat_getNumberFormatForField) +#define udat_getSymbols U_ICU_ENTRY_POINT_RENAME(udat_getSymbols) +#define udat_isLenient U_ICU_ENTRY_POINT_RENAME(udat_isLenient) +#define udat_open U_ICU_ENTRY_POINT_RENAME(udat_open) +#define udat_parse U_ICU_ENTRY_POINT_RENAME(udat_parse) +#define udat_parseCalendar U_ICU_ENTRY_POINT_RENAME(udat_parseCalendar) +#define udat_registerOpener U_ICU_ENTRY_POINT_RENAME(udat_registerOpener) +#define udat_set2DigitYearStart U_ICU_ENTRY_POINT_RENAME(udat_set2DigitYearStart) +#define udat_setBooleanAttribute U_ICU_ENTRY_POINT_RENAME(udat_setBooleanAttribute) +#define udat_setCalendar U_ICU_ENTRY_POINT_RENAME(udat_setCalendar) +#define udat_setContext U_ICU_ENTRY_POINT_RENAME(udat_setContext) +#define udat_setLenient U_ICU_ENTRY_POINT_RENAME(udat_setLenient) +#define udat_setNumberFormat U_ICU_ENTRY_POINT_RENAME(udat_setNumberFormat) +#define udat_setSymbols U_ICU_ENTRY_POINT_RENAME(udat_setSymbols) +#define udat_toCalendarDateField U_ICU_ENTRY_POINT_RENAME(udat_toCalendarDateField) +#define udat_toPattern U_ICU_ENTRY_POINT_RENAME(udat_toPattern) +#define udat_toPatternRelativeDate U_ICU_ENTRY_POINT_RENAME(udat_toPatternRelativeDate) +#define udat_toPatternRelativeTime U_ICU_ENTRY_POINT_RENAME(udat_toPatternRelativeTime) +#define udat_unregisterOpener U_ICU_ENTRY_POINT_RENAME(udat_unregisterOpener) +#define udata_checkCommonData U_ICU_ENTRY_POINT_RENAME(udata_checkCommonData) +#define udata_close U_ICU_ENTRY_POINT_RENAME(udata_close) +#define udata_closeSwapper U_ICU_ENTRY_POINT_RENAME(udata_closeSwapper) +#define udata_getHeaderSize U_ICU_ENTRY_POINT_RENAME(udata_getHeaderSize) +#define udata_getInfo U_ICU_ENTRY_POINT_RENAME(udata_getInfo) +#define udata_getInfoSize U_ICU_ENTRY_POINT_RENAME(udata_getInfoSize) +#define udata_getLength U_ICU_ENTRY_POINT_RENAME(udata_getLength) +#define udata_getMemory U_ICU_ENTRY_POINT_RENAME(udata_getMemory) +#define udata_getRawMemory U_ICU_ENTRY_POINT_RENAME(udata_getRawMemory) +#define udata_open U_ICU_ENTRY_POINT_RENAME(udata_open) +#define udata_openChoice U_ICU_ENTRY_POINT_RENAME(udata_openChoice) +#define udata_openSwapper U_ICU_ENTRY_POINT_RENAME(udata_openSwapper) +#define udata_openSwapperForInputData U_ICU_ENTRY_POINT_RENAME(udata_openSwapperForInputData) +#define udata_printError U_ICU_ENTRY_POINT_RENAME(udata_printError) +#define udata_readInt16 U_ICU_ENTRY_POINT_RENAME(udata_readInt16) +#define udata_readInt32 U_ICU_ENTRY_POINT_RENAME(udata_readInt32) +#define udata_setAppData U_ICU_ENTRY_POINT_RENAME(udata_setAppData) +#define udata_setCommonData U_ICU_ENTRY_POINT_RENAME(udata_setCommonData) +#define udata_setFileAccess U_ICU_ENTRY_POINT_RENAME(udata_setFileAccess) +#define udata_swapDataHeader U_ICU_ENTRY_POINT_RENAME(udata_swapDataHeader) +#define udata_swapInvStringBlock U_ICU_ENTRY_POINT_RENAME(udata_swapInvStringBlock) +#define udatpg_addPattern U_ICU_ENTRY_POINT_RENAME(udatpg_addPattern) +#define udatpg_clone U_ICU_ENTRY_POINT_RENAME(udatpg_clone) +#define udatpg_close U_ICU_ENTRY_POINT_RENAME(udatpg_close) +#define udatpg_getAppendItemFormat U_ICU_ENTRY_POINT_RENAME(udatpg_getAppendItemFormat) +#define udatpg_getAppendItemName U_ICU_ENTRY_POINT_RENAME(udatpg_getAppendItemName) +#define udatpg_getBaseSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getBaseSkeleton) +#define udatpg_getBestPattern U_ICU_ENTRY_POINT_RENAME(udatpg_getBestPattern) +#define udatpg_getBestPatternWithOptions U_ICU_ENTRY_POINT_RENAME(udatpg_getBestPatternWithOptions) +#define udatpg_getDateTimeFormat U_ICU_ENTRY_POINT_RENAME(udatpg_getDateTimeFormat) +#define udatpg_getDecimal U_ICU_ENTRY_POINT_RENAME(udatpg_getDecimal) +#define udatpg_getPatternForSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getPatternForSkeleton) +#define udatpg_getSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getSkeleton) +#define udatpg_open U_ICU_ENTRY_POINT_RENAME(udatpg_open) +#define udatpg_openBaseSkeletons U_ICU_ENTRY_POINT_RENAME(udatpg_openBaseSkeletons) +#define udatpg_openEmpty U_ICU_ENTRY_POINT_RENAME(udatpg_openEmpty) +#define udatpg_openSkeletons U_ICU_ENTRY_POINT_RENAME(udatpg_openSkeletons) +#define udatpg_replaceFieldTypes U_ICU_ENTRY_POINT_RENAME(udatpg_replaceFieldTypes) +#define udatpg_replaceFieldTypesWithOptions U_ICU_ENTRY_POINT_RENAME(udatpg_replaceFieldTypesWithOptions) +#define udatpg_setAppendItemFormat U_ICU_ENTRY_POINT_RENAME(udatpg_setAppendItemFormat) +#define udatpg_setAppendItemName U_ICU_ENTRY_POINT_RENAME(udatpg_setAppendItemName) +#define udatpg_setDateTimeFormat U_ICU_ENTRY_POINT_RENAME(udatpg_setDateTimeFormat) +#define udatpg_setDecimal U_ICU_ENTRY_POINT_RENAME(udatpg_setDecimal) +#define udict_swap U_ICU_ENTRY_POINT_RENAME(udict_swap) +#define udtitvfmt_close U_ICU_ENTRY_POINT_RENAME(udtitvfmt_close) +#define udtitvfmt_format U_ICU_ENTRY_POINT_RENAME(udtitvfmt_format) +#define udtitvfmt_open U_ICU_ENTRY_POINT_RENAME(udtitvfmt_open) +#define uenum_close U_ICU_ENTRY_POINT_RENAME(uenum_close) +#define uenum_count U_ICU_ENTRY_POINT_RENAME(uenum_count) +#define uenum_next U_ICU_ENTRY_POINT_RENAME(uenum_next) +#define uenum_nextDefault U_ICU_ENTRY_POINT_RENAME(uenum_nextDefault) +#define uenum_openCharStringsEnumeration U_ICU_ENTRY_POINT_RENAME(uenum_openCharStringsEnumeration) +#define uenum_openFromStringEnumeration U_ICU_ENTRY_POINT_RENAME(uenum_openFromStringEnumeration) +#define uenum_openUCharStringsEnumeration U_ICU_ENTRY_POINT_RENAME(uenum_openUCharStringsEnumeration) +#define uenum_reset U_ICU_ENTRY_POINT_RENAME(uenum_reset) +#define uenum_unext U_ICU_ENTRY_POINT_RENAME(uenum_unext) +#define uenum_unextDefault U_ICU_ENTRY_POINT_RENAME(uenum_unextDefault) +#define ufieldpositer_close U_ICU_ENTRY_POINT_RENAME(ufieldpositer_close) +#define ufieldpositer_next U_ICU_ENTRY_POINT_RENAME(ufieldpositer_next) +#define ufieldpositer_open U_ICU_ENTRY_POINT_RENAME(ufieldpositer_open) +#define ufile_close_translit U_ICU_ENTRY_POINT_RENAME(ufile_close_translit) +#define ufile_fill_uchar_buffer U_ICU_ENTRY_POINT_RENAME(ufile_fill_uchar_buffer) +#define ufile_flush_io U_ICU_ENTRY_POINT_RENAME(ufile_flush_io) +#define ufile_flush_translit U_ICU_ENTRY_POINT_RENAME(ufile_flush_translit) +#define ufile_getch U_ICU_ENTRY_POINT_RENAME(ufile_getch) +#define ufile_getch32 U_ICU_ENTRY_POINT_RENAME(ufile_getch32) +#define ufmt_64tou U_ICU_ENTRY_POINT_RENAME(ufmt_64tou) +#define ufmt_close U_ICU_ENTRY_POINT_RENAME(ufmt_close) +#define ufmt_defaultCPToUnicode U_ICU_ENTRY_POINT_RENAME(ufmt_defaultCPToUnicode) +#define ufmt_digitvalue U_ICU_ENTRY_POINT_RENAME(ufmt_digitvalue) +#define ufmt_getArrayItemByIndex U_ICU_ENTRY_POINT_RENAME(ufmt_getArrayItemByIndex) +#define ufmt_getArrayLength U_ICU_ENTRY_POINT_RENAME(ufmt_getArrayLength) +#define ufmt_getDate U_ICU_ENTRY_POINT_RENAME(ufmt_getDate) +#define ufmt_getDecNumChars U_ICU_ENTRY_POINT_RENAME(ufmt_getDecNumChars) +#define ufmt_getDouble U_ICU_ENTRY_POINT_RENAME(ufmt_getDouble) +#define ufmt_getInt64 U_ICU_ENTRY_POINT_RENAME(ufmt_getInt64) +#define ufmt_getLong U_ICU_ENTRY_POINT_RENAME(ufmt_getLong) +#define ufmt_getObject U_ICU_ENTRY_POINT_RENAME(ufmt_getObject) +#define ufmt_getType U_ICU_ENTRY_POINT_RENAME(ufmt_getType) +#define ufmt_getUChars U_ICU_ENTRY_POINT_RENAME(ufmt_getUChars) +#define ufmt_isNumeric U_ICU_ENTRY_POINT_RENAME(ufmt_isNumeric) +#define ufmt_isdigit U_ICU_ENTRY_POINT_RENAME(ufmt_isdigit) +#define ufmt_open U_ICU_ENTRY_POINT_RENAME(ufmt_open) +#define ufmt_ptou U_ICU_ENTRY_POINT_RENAME(ufmt_ptou) +#define ufmt_uto64 U_ICU_ENTRY_POINT_RENAME(ufmt_uto64) +#define ufmt_utop U_ICU_ENTRY_POINT_RENAME(ufmt_utop) +#define ugender_getInstance U_ICU_ENTRY_POINT_RENAME(ugender_getInstance) +#define ugender_getListGender U_ICU_ENTRY_POINT_RENAME(ugender_getListGender) +#define uhash_close U_ICU_ENTRY_POINT_RENAME(uhash_close) +#define uhash_compareCaselessUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_compareCaselessUnicodeString) +#define uhash_compareChars U_ICU_ENTRY_POINT_RENAME(uhash_compareChars) +#define uhash_compareIChars U_ICU_ENTRY_POINT_RENAME(uhash_compareIChars) +#define uhash_compareLong U_ICU_ENTRY_POINT_RENAME(uhash_compareLong) +#define uhash_compareScriptSet U_ICU_ENTRY_POINT_RENAME(uhash_compareScriptSet) +#define uhash_compareUChars U_ICU_ENTRY_POINT_RENAME(uhash_compareUChars) +#define uhash_compareUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_compareUnicodeString) +#define uhash_count U_ICU_ENTRY_POINT_RENAME(uhash_count) +#define uhash_deleteHashtable U_ICU_ENTRY_POINT_RENAME(uhash_deleteHashtable) +#define uhash_deleteScriptSet U_ICU_ENTRY_POINT_RENAME(uhash_deleteScriptSet) +#define uhash_equals U_ICU_ENTRY_POINT_RENAME(uhash_equals) +#define uhash_equalsScriptSet U_ICU_ENTRY_POINT_RENAME(uhash_equalsScriptSet) +#define uhash_find U_ICU_ENTRY_POINT_RENAME(uhash_find) +#define uhash_get U_ICU_ENTRY_POINT_RENAME(uhash_get) +#define uhash_geti U_ICU_ENTRY_POINT_RENAME(uhash_geti) +#define uhash_hashCaselessUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_hashCaselessUnicodeString) +#define uhash_hashChars U_ICU_ENTRY_POINT_RENAME(uhash_hashChars) +#define uhash_hashIChars U_ICU_ENTRY_POINT_RENAME(uhash_hashIChars) +#define uhash_hashLong U_ICU_ENTRY_POINT_RENAME(uhash_hashLong) +#define uhash_hashScriptSet U_ICU_ENTRY_POINT_RENAME(uhash_hashScriptSet) +#define uhash_hashUChars U_ICU_ENTRY_POINT_RENAME(uhash_hashUChars) +#define uhash_hashUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_hashUnicodeString) +#define uhash_iget U_ICU_ENTRY_POINT_RENAME(uhash_iget) +#define uhash_igeti U_ICU_ENTRY_POINT_RENAME(uhash_igeti) +#define uhash_init U_ICU_ENTRY_POINT_RENAME(uhash_init) +#define uhash_initSize U_ICU_ENTRY_POINT_RENAME(uhash_initSize) +#define uhash_iput U_ICU_ENTRY_POINT_RENAME(uhash_iput) +#define uhash_iputi U_ICU_ENTRY_POINT_RENAME(uhash_iputi) +#define uhash_iremove U_ICU_ENTRY_POINT_RENAME(uhash_iremove) +#define uhash_iremovei U_ICU_ENTRY_POINT_RENAME(uhash_iremovei) +#define uhash_nextElement U_ICU_ENTRY_POINT_RENAME(uhash_nextElement) +#define uhash_open U_ICU_ENTRY_POINT_RENAME(uhash_open) +#define uhash_openSize U_ICU_ENTRY_POINT_RENAME(uhash_openSize) +#define uhash_put U_ICU_ENTRY_POINT_RENAME(uhash_put) +#define uhash_puti U_ICU_ENTRY_POINT_RENAME(uhash_puti) +#define uhash_remove U_ICU_ENTRY_POINT_RENAME(uhash_remove) +#define uhash_removeAll U_ICU_ENTRY_POINT_RENAME(uhash_removeAll) +#define uhash_removeElement U_ICU_ENTRY_POINT_RENAME(uhash_removeElement) +#define uhash_removei U_ICU_ENTRY_POINT_RENAME(uhash_removei) +#define uhash_setKeyComparator U_ICU_ENTRY_POINT_RENAME(uhash_setKeyComparator) +#define uhash_setKeyDeleter U_ICU_ENTRY_POINT_RENAME(uhash_setKeyDeleter) +#define uhash_setKeyHasher U_ICU_ENTRY_POINT_RENAME(uhash_setKeyHasher) +#define uhash_setResizePolicy U_ICU_ENTRY_POINT_RENAME(uhash_setResizePolicy) +#define uhash_setValueComparator U_ICU_ENTRY_POINT_RENAME(uhash_setValueComparator) +#define uhash_setValueDeleter U_ICU_ENTRY_POINT_RENAME(uhash_setValueDeleter) +#define uidna_IDNToASCII U_ICU_ENTRY_POINT_RENAME(uidna_IDNToASCII) +#define uidna_IDNToUnicode U_ICU_ENTRY_POINT_RENAME(uidna_IDNToUnicode) +#define uidna_close U_ICU_ENTRY_POINT_RENAME(uidna_close) +#define uidna_compare U_ICU_ENTRY_POINT_RENAME(uidna_compare) +#define uidna_labelToASCII U_ICU_ENTRY_POINT_RENAME(uidna_labelToASCII) +#define uidna_labelToASCII_UTF8 U_ICU_ENTRY_POINT_RENAME(uidna_labelToASCII_UTF8) +#define uidna_labelToUnicode U_ICU_ENTRY_POINT_RENAME(uidna_labelToUnicode) +#define uidna_labelToUnicodeUTF8 U_ICU_ENTRY_POINT_RENAME(uidna_labelToUnicodeUTF8) +#define uidna_nameToASCII U_ICU_ENTRY_POINT_RENAME(uidna_nameToASCII) +#define uidna_nameToASCII_UTF8 U_ICU_ENTRY_POINT_RENAME(uidna_nameToASCII_UTF8) +#define uidna_nameToUnicode U_ICU_ENTRY_POINT_RENAME(uidna_nameToUnicode) +#define uidna_nameToUnicodeUTF8 U_ICU_ENTRY_POINT_RENAME(uidna_nameToUnicodeUTF8) +#define uidna_openUTS46 U_ICU_ENTRY_POINT_RENAME(uidna_openUTS46) +#define uidna_toASCII U_ICU_ENTRY_POINT_RENAME(uidna_toASCII) +#define uidna_toUnicode U_ICU_ENTRY_POINT_RENAME(uidna_toUnicode) +#define uiter_current32 U_ICU_ENTRY_POINT_RENAME(uiter_current32) +#define uiter_getState U_ICU_ENTRY_POINT_RENAME(uiter_getState) +#define uiter_next32 U_ICU_ENTRY_POINT_RENAME(uiter_next32) +#define uiter_previous32 U_ICU_ENTRY_POINT_RENAME(uiter_previous32) +#define uiter_setCharacterIterator U_ICU_ENTRY_POINT_RENAME(uiter_setCharacterIterator) +#define uiter_setReplaceable U_ICU_ENTRY_POINT_RENAME(uiter_setReplaceable) +#define uiter_setState U_ICU_ENTRY_POINT_RENAME(uiter_setState) +#define uiter_setString U_ICU_ENTRY_POINT_RENAME(uiter_setString) +#define uiter_setUTF16BE U_ICU_ENTRY_POINT_RENAME(uiter_setUTF16BE) +#define uiter_setUTF8 U_ICU_ENTRY_POINT_RENAME(uiter_setUTF8) +#define uldn_close U_ICU_ENTRY_POINT_RENAME(uldn_close) +#define uldn_getContext U_ICU_ENTRY_POINT_RENAME(uldn_getContext) +#define uldn_getDialectHandling U_ICU_ENTRY_POINT_RENAME(uldn_getDialectHandling) +#define uldn_getLocale U_ICU_ENTRY_POINT_RENAME(uldn_getLocale) +#define uldn_keyDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_keyDisplayName) +#define uldn_keyValueDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_keyValueDisplayName) +#define uldn_languageDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_languageDisplayName) +#define uldn_localeDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_localeDisplayName) +#define uldn_open U_ICU_ENTRY_POINT_RENAME(uldn_open) +#define uldn_openForContext U_ICU_ENTRY_POINT_RENAME(uldn_openForContext) +#define uldn_regionDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_regionDisplayName) +#define uldn_scriptCodeDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_scriptCodeDisplayName) +#define uldn_scriptDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_scriptDisplayName) +#define uldn_variantDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_variantDisplayName) +#define ulist_addItemBeginList U_ICU_ENTRY_POINT_RENAME(ulist_addItemBeginList) +#define ulist_addItemEndList U_ICU_ENTRY_POINT_RENAME(ulist_addItemEndList) +#define ulist_close_keyword_values_iterator U_ICU_ENTRY_POINT_RENAME(ulist_close_keyword_values_iterator) +#define ulist_containsString U_ICU_ENTRY_POINT_RENAME(ulist_containsString) +#define ulist_count_keyword_values U_ICU_ENTRY_POINT_RENAME(ulist_count_keyword_values) +#define ulist_createEmptyList U_ICU_ENTRY_POINT_RENAME(ulist_createEmptyList) +#define ulist_deleteList U_ICU_ENTRY_POINT_RENAME(ulist_deleteList) +#define ulist_getListFromEnum U_ICU_ENTRY_POINT_RENAME(ulist_getListFromEnum) +#define ulist_getListSize U_ICU_ENTRY_POINT_RENAME(ulist_getListSize) +#define ulist_getNext U_ICU_ENTRY_POINT_RENAME(ulist_getNext) +#define ulist_next_keyword_value U_ICU_ENTRY_POINT_RENAME(ulist_next_keyword_value) +#define ulist_removeString U_ICU_ENTRY_POINT_RENAME(ulist_removeString) +#define ulist_resetList U_ICU_ENTRY_POINT_RENAME(ulist_resetList) +#define ulist_reset_keyword_values_iterator U_ICU_ENTRY_POINT_RENAME(ulist_reset_keyword_values_iterator) +#define ulistfmt_close U_ICU_ENTRY_POINT_RENAME(ulistfmt_close) +#define ulistfmt_format U_ICU_ENTRY_POINT_RENAME(ulistfmt_format) +#define ulistfmt_open U_ICU_ENTRY_POINT_RENAME(ulistfmt_open) +#define uloc_acceptLanguage U_ICU_ENTRY_POINT_RENAME(uloc_acceptLanguage) +#define uloc_acceptLanguageFromHTTP U_ICU_ENTRY_POINT_RENAME(uloc_acceptLanguageFromHTTP) +#define uloc_addLikelySubtags U_ICU_ENTRY_POINT_RENAME(uloc_addLikelySubtags) +#define uloc_canonicalize U_ICU_ENTRY_POINT_RENAME(uloc_canonicalize) +#define uloc_countAvailable U_ICU_ENTRY_POINT_RENAME(uloc_countAvailable) +#define uloc_forLanguageTag U_ICU_ENTRY_POINT_RENAME(uloc_forLanguageTag) +#define uloc_getAvailable U_ICU_ENTRY_POINT_RENAME(uloc_getAvailable) +#define uloc_getBaseName U_ICU_ENTRY_POINT_RENAME(uloc_getBaseName) +#define uloc_getCharacterOrientation U_ICU_ENTRY_POINT_RENAME(uloc_getCharacterOrientation) +#define uloc_getCountry U_ICU_ENTRY_POINT_RENAME(uloc_getCountry) +#define uloc_getCurrentCountryID U_ICU_ENTRY_POINT_RENAME(uloc_getCurrentCountryID) +#define uloc_getCurrentLanguageID U_ICU_ENTRY_POINT_RENAME(uloc_getCurrentLanguageID) +#define uloc_getDefault U_ICU_ENTRY_POINT_RENAME(uloc_getDefault) +#define uloc_getDisplayCountry U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayCountry) +#define uloc_getDisplayKeyword U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayKeyword) +#define uloc_getDisplayKeywordValue U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayKeywordValue) +#define uloc_getDisplayLanguage U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayLanguage) +#define uloc_getDisplayName U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayName) +#define uloc_getDisplayScript U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayScript) +#define uloc_getDisplayScriptInContext U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayScriptInContext) +#define uloc_getDisplayVariant U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayVariant) +#define uloc_getISO3Country U_ICU_ENTRY_POINT_RENAME(uloc_getISO3Country) +#define uloc_getISO3Language U_ICU_ENTRY_POINT_RENAME(uloc_getISO3Language) +#define uloc_getISOCountries U_ICU_ENTRY_POINT_RENAME(uloc_getISOCountries) +#define uloc_getISOLanguages U_ICU_ENTRY_POINT_RENAME(uloc_getISOLanguages) +#define uloc_getKeywordValue U_ICU_ENTRY_POINT_RENAME(uloc_getKeywordValue) +#define uloc_getLCID U_ICU_ENTRY_POINT_RENAME(uloc_getLCID) +#define uloc_getLanguage U_ICU_ENTRY_POINT_RENAME(uloc_getLanguage) +#define uloc_getLineOrientation U_ICU_ENTRY_POINT_RENAME(uloc_getLineOrientation) +#define uloc_getLocaleForLCID U_ICU_ENTRY_POINT_RENAME(uloc_getLocaleForLCID) +#define uloc_getName U_ICU_ENTRY_POINT_RENAME(uloc_getName) +#define uloc_getParent U_ICU_ENTRY_POINT_RENAME(uloc_getParent) +#define uloc_getScript U_ICU_ENTRY_POINT_RENAME(uloc_getScript) +#define uloc_getTableStringWithFallback U_ICU_ENTRY_POINT_RENAME(uloc_getTableStringWithFallback) +#define uloc_getVariant U_ICU_ENTRY_POINT_RENAME(uloc_getVariant) +#define uloc_isRightToLeft U_ICU_ENTRY_POINT_RENAME(uloc_isRightToLeft) +#define uloc_minimizeSubtags U_ICU_ENTRY_POINT_RENAME(uloc_minimizeSubtags) +#define uloc_openKeywordList U_ICU_ENTRY_POINT_RENAME(uloc_openKeywordList) +#define uloc_openKeywords U_ICU_ENTRY_POINT_RENAME(uloc_openKeywords) +#define uloc_setDefault U_ICU_ENTRY_POINT_RENAME(uloc_setDefault) +#define uloc_setKeywordValue U_ICU_ENTRY_POINT_RENAME(uloc_setKeywordValue) +#define uloc_toLanguageTag U_ICU_ENTRY_POINT_RENAME(uloc_toLanguageTag) +#define uloc_toLegacyKey U_ICU_ENTRY_POINT_RENAME(uloc_toLegacyKey) +#define uloc_toLegacyType U_ICU_ENTRY_POINT_RENAME(uloc_toLegacyType) +#define uloc_toUnicodeLocaleKey U_ICU_ENTRY_POINT_RENAME(uloc_toUnicodeLocaleKey) +#define uloc_toUnicodeLocaleType U_ICU_ENTRY_POINT_RENAME(uloc_toUnicodeLocaleType) +#define ulocdata_close U_ICU_ENTRY_POINT_RENAME(ulocdata_close) +#define ulocdata_getCLDRVersion U_ICU_ENTRY_POINT_RENAME(ulocdata_getCLDRVersion) +#define ulocdata_getDelimiter U_ICU_ENTRY_POINT_RENAME(ulocdata_getDelimiter) +#define ulocdata_getExemplarSet U_ICU_ENTRY_POINT_RENAME(ulocdata_getExemplarSet) +#define ulocdata_getLocaleDisplayPattern U_ICU_ENTRY_POINT_RENAME(ulocdata_getLocaleDisplayPattern) +#define ulocdata_getLocaleSeparator U_ICU_ENTRY_POINT_RENAME(ulocdata_getLocaleSeparator) +#define ulocdata_getMeasurementSystem U_ICU_ENTRY_POINT_RENAME(ulocdata_getMeasurementSystem) +#define ulocdata_getNoSubstitute U_ICU_ENTRY_POINT_RENAME(ulocdata_getNoSubstitute) +#define ulocdata_getPaperSize U_ICU_ENTRY_POINT_RENAME(ulocdata_getPaperSize) +#define ulocdata_open U_ICU_ENTRY_POINT_RENAME(ulocdata_open) +#define ulocdata_setNoSubstitute U_ICU_ENTRY_POINT_RENAME(ulocdata_setNoSubstitute) +#define ulocimp_getCountry U_ICU_ENTRY_POINT_RENAME(ulocimp_getCountry) +#define ulocimp_getLanguage U_ICU_ENTRY_POINT_RENAME(ulocimp_getLanguage) +#define ulocimp_getRegionForSupplementalData U_ICU_ENTRY_POINT_RENAME(ulocimp_getRegionForSupplementalData) +#define ulocimp_getScript U_ICU_ENTRY_POINT_RENAME(ulocimp_getScript) +#define ulocimp_toBcpKey U_ICU_ENTRY_POINT_RENAME(ulocimp_toBcpKey) +#define ulocimp_toBcpType U_ICU_ENTRY_POINT_RENAME(ulocimp_toBcpType) +#define ulocimp_toLegacyKey U_ICU_ENTRY_POINT_RENAME(ulocimp_toLegacyKey) +#define ulocimp_toLegacyType U_ICU_ENTRY_POINT_RENAME(ulocimp_toLegacyType) +#define ultag_isUnicodeLocaleKey U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleKey) +#define ultag_isUnicodeLocaleType U_ICU_ENTRY_POINT_RENAME(ultag_isUnicodeLocaleType) +#define umsg_applyPattern U_ICU_ENTRY_POINT_RENAME(umsg_applyPattern) +#define umsg_autoQuoteApostrophe U_ICU_ENTRY_POINT_RENAME(umsg_autoQuoteApostrophe) +#define umsg_clone U_ICU_ENTRY_POINT_RENAME(umsg_clone) +#define umsg_close U_ICU_ENTRY_POINT_RENAME(umsg_close) +#define umsg_format U_ICU_ENTRY_POINT_RENAME(umsg_format) +#define umsg_getLocale U_ICU_ENTRY_POINT_RENAME(umsg_getLocale) +#define umsg_open U_ICU_ENTRY_POINT_RENAME(umsg_open) +#define umsg_parse U_ICU_ENTRY_POINT_RENAME(umsg_parse) +#define umsg_setLocale U_ICU_ENTRY_POINT_RENAME(umsg_setLocale) +#define umsg_toPattern U_ICU_ENTRY_POINT_RENAME(umsg_toPattern) +#define umsg_vformat U_ICU_ENTRY_POINT_RENAME(umsg_vformat) +#define umsg_vparse U_ICU_ENTRY_POINT_RENAME(umsg_vparse) +#define umtx_condBroadcast U_ICU_ENTRY_POINT_RENAME(umtx_condBroadcast) +#define umtx_condSignal U_ICU_ENTRY_POINT_RENAME(umtx_condSignal) +#define umtx_condWait U_ICU_ENTRY_POINT_RENAME(umtx_condWait) +#define umtx_lock U_ICU_ENTRY_POINT_RENAME(umtx_lock) +#define umtx_unlock U_ICU_ENTRY_POINT_RENAME(umtx_unlock) +#define uniset_getUnicode32Instance U_ICU_ENTRY_POINT_RENAME(uniset_getUnicode32Instance) +#define unorm2_append U_ICU_ENTRY_POINT_RENAME(unorm2_append) +#define unorm2_close U_ICU_ENTRY_POINT_RENAME(unorm2_close) +#define unorm2_composePair U_ICU_ENTRY_POINT_RENAME(unorm2_composePair) +#define unorm2_getCombiningClass U_ICU_ENTRY_POINT_RENAME(unorm2_getCombiningClass) +#define unorm2_getDecomposition U_ICU_ENTRY_POINT_RENAME(unorm2_getDecomposition) +#define unorm2_getInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getInstance) +#define unorm2_getNFCInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getNFCInstance) +#define unorm2_getNFDInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getNFDInstance) +#define unorm2_getNFKCCasefoldInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getNFKCCasefoldInstance) +#define unorm2_getNFKCInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getNFKCInstance) +#define unorm2_getNFKDInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getNFKDInstance) +#define unorm2_getRawDecomposition U_ICU_ENTRY_POINT_RENAME(unorm2_getRawDecomposition) +#define unorm2_hasBoundaryAfter U_ICU_ENTRY_POINT_RENAME(unorm2_hasBoundaryAfter) +#define unorm2_hasBoundaryBefore U_ICU_ENTRY_POINT_RENAME(unorm2_hasBoundaryBefore) +#define unorm2_isInert U_ICU_ENTRY_POINT_RENAME(unorm2_isInert) +#define unorm2_isNormalized U_ICU_ENTRY_POINT_RENAME(unorm2_isNormalized) +#define unorm2_normalize U_ICU_ENTRY_POINT_RENAME(unorm2_normalize) +#define unorm2_normalizeSecondAndAppend U_ICU_ENTRY_POINT_RENAME(unorm2_normalizeSecondAndAppend) +#define unorm2_openFiltered U_ICU_ENTRY_POINT_RENAME(unorm2_openFiltered) +#define unorm2_quickCheck U_ICU_ENTRY_POINT_RENAME(unorm2_quickCheck) +#define unorm2_spanQuickCheckYes U_ICU_ENTRY_POINT_RENAME(unorm2_spanQuickCheckYes) +#define unorm2_swap U_ICU_ENTRY_POINT_RENAME(unorm2_swap) +#define unorm_compare U_ICU_ENTRY_POINT_RENAME(unorm_compare) +#define unorm_concatenate U_ICU_ENTRY_POINT_RENAME(unorm_concatenate) +#define unorm_getFCD16 U_ICU_ENTRY_POINT_RENAME(unorm_getFCD16) +#define unorm_getQuickCheck U_ICU_ENTRY_POINT_RENAME(unorm_getQuickCheck) +#define unorm_isNormalized U_ICU_ENTRY_POINT_RENAME(unorm_isNormalized) +#define unorm_isNormalizedWithOptions U_ICU_ENTRY_POINT_RENAME(unorm_isNormalizedWithOptions) +#define unorm_next U_ICU_ENTRY_POINT_RENAME(unorm_next) +#define unorm_normalize U_ICU_ENTRY_POINT_RENAME(unorm_normalize) +#define unorm_previous U_ICU_ENTRY_POINT_RENAME(unorm_previous) +#define unorm_quickCheck U_ICU_ENTRY_POINT_RENAME(unorm_quickCheck) +#define unorm_quickCheckWithOptions U_ICU_ENTRY_POINT_RENAME(unorm_quickCheckWithOptions) +#define unum_applyPattern U_ICU_ENTRY_POINT_RENAME(unum_applyPattern) +#define unum_clone U_ICU_ENTRY_POINT_RENAME(unum_clone) +#define unum_close U_ICU_ENTRY_POINT_RENAME(unum_close) +#define unum_countAvailable U_ICU_ENTRY_POINT_RENAME(unum_countAvailable) +#define unum_format U_ICU_ENTRY_POINT_RENAME(unum_format) +#define unum_formatDecimal U_ICU_ENTRY_POINT_RENAME(unum_formatDecimal) +#define unum_formatDouble U_ICU_ENTRY_POINT_RENAME(unum_formatDouble) +#define unum_formatDoubleCurrency U_ICU_ENTRY_POINT_RENAME(unum_formatDoubleCurrency) +#define unum_formatDoubleForFields U_ICU_ENTRY_POINT_RENAME(unum_formatDoubleForFields) +#define unum_formatInt64 U_ICU_ENTRY_POINT_RENAME(unum_formatInt64) +#define unum_formatUFormattable U_ICU_ENTRY_POINT_RENAME(unum_formatUFormattable) +#define unum_getAttribute U_ICU_ENTRY_POINT_RENAME(unum_getAttribute) +#define unum_getAvailable U_ICU_ENTRY_POINT_RENAME(unum_getAvailable) +#define unum_getContext U_ICU_ENTRY_POINT_RENAME(unum_getContext) +#define unum_getDoubleAttribute U_ICU_ENTRY_POINT_RENAME(unum_getDoubleAttribute) +#define unum_getLocaleByType U_ICU_ENTRY_POINT_RENAME(unum_getLocaleByType) +#define unum_getSymbol U_ICU_ENTRY_POINT_RENAME(unum_getSymbol) +#define unum_getTextAttribute U_ICU_ENTRY_POINT_RENAME(unum_getTextAttribute) +#define unum_open U_ICU_ENTRY_POINT_RENAME(unum_open) +#define unum_parse U_ICU_ENTRY_POINT_RENAME(unum_parse) +#define unum_parseDecimal U_ICU_ENTRY_POINT_RENAME(unum_parseDecimal) +#define unum_parseDouble U_ICU_ENTRY_POINT_RENAME(unum_parseDouble) +#define unum_parseDoubleCurrency U_ICU_ENTRY_POINT_RENAME(unum_parseDoubleCurrency) +#define unum_parseInt64 U_ICU_ENTRY_POINT_RENAME(unum_parseInt64) +#define unum_parseToUFormattable U_ICU_ENTRY_POINT_RENAME(unum_parseToUFormattable) +#define unum_setAttribute U_ICU_ENTRY_POINT_RENAME(unum_setAttribute) +#define unum_setContext U_ICU_ENTRY_POINT_RENAME(unum_setContext) +#define unum_setDoubleAttribute U_ICU_ENTRY_POINT_RENAME(unum_setDoubleAttribute) +#define unum_setSymbol U_ICU_ENTRY_POINT_RENAME(unum_setSymbol) +#define unum_setTextAttribute U_ICU_ENTRY_POINT_RENAME(unum_setTextAttribute) +#define unum_toPattern U_ICU_ENTRY_POINT_RENAME(unum_toPattern) +#define unumsys_close U_ICU_ENTRY_POINT_RENAME(unumsys_close) +#define unumsys_getDescription U_ICU_ENTRY_POINT_RENAME(unumsys_getDescription) +#define unumsys_getName U_ICU_ENTRY_POINT_RENAME(unumsys_getName) +#define unumsys_getRadix U_ICU_ENTRY_POINT_RENAME(unumsys_getRadix) +#define unumsys_isAlgorithmic U_ICU_ENTRY_POINT_RENAME(unumsys_isAlgorithmic) +#define unumsys_open U_ICU_ENTRY_POINT_RENAME(unumsys_open) +#define unumsys_openAvailableNames U_ICU_ENTRY_POINT_RENAME(unumsys_openAvailableNames) +#define unumsys_openByName U_ICU_ENTRY_POINT_RENAME(unumsys_openByName) +#define uplrules_close U_ICU_ENTRY_POINT_RENAME(uplrules_close) +#define uplrules_getKeywords U_ICU_ENTRY_POINT_RENAME(uplrules_getKeywords) +#define uplrules_open U_ICU_ENTRY_POINT_RENAME(uplrules_open) +#define uplrules_openForType U_ICU_ENTRY_POINT_RENAME(uplrules_openForType) +#define uplrules_select U_ICU_ENTRY_POINT_RENAME(uplrules_select) +#define uplrules_selectWithFormat U_ICU_ENTRY_POINT_RENAME(uplrules_selectWithFormat) +#define uplug_closeLibrary U_ICU_ENTRY_POINT_RENAME(uplug_closeLibrary) +#define uplug_findLibrary U_ICU_ENTRY_POINT_RENAME(uplug_findLibrary) +#define uplug_getConfiguration U_ICU_ENTRY_POINT_RENAME(uplug_getConfiguration) +#define uplug_getContext U_ICU_ENTRY_POINT_RENAME(uplug_getContext) +#define uplug_getCurrentLevel U_ICU_ENTRY_POINT_RENAME(uplug_getCurrentLevel) +#define uplug_getLibrary U_ICU_ENTRY_POINT_RENAME(uplug_getLibrary) +#define uplug_getLibraryName U_ICU_ENTRY_POINT_RENAME(uplug_getLibraryName) +#define uplug_getPlugInternal U_ICU_ENTRY_POINT_RENAME(uplug_getPlugInternal) +#define uplug_getPlugLevel U_ICU_ENTRY_POINT_RENAME(uplug_getPlugLevel) +#define uplug_getPlugLoadStatus U_ICU_ENTRY_POINT_RENAME(uplug_getPlugLoadStatus) +#define uplug_getPlugName U_ICU_ENTRY_POINT_RENAME(uplug_getPlugName) +#define uplug_getPluginFile U_ICU_ENTRY_POINT_RENAME(uplug_getPluginFile) +#define uplug_getSymbolName U_ICU_ENTRY_POINT_RENAME(uplug_getSymbolName) +#define uplug_init U_ICU_ENTRY_POINT_RENAME(uplug_init) +#define uplug_loadPlugFromEntrypoint U_ICU_ENTRY_POINT_RENAME(uplug_loadPlugFromEntrypoint) +#define uplug_loadPlugFromLibrary U_ICU_ENTRY_POINT_RENAME(uplug_loadPlugFromLibrary) +#define uplug_nextPlug U_ICU_ENTRY_POINT_RENAME(uplug_nextPlug) +#define uplug_openLibrary U_ICU_ENTRY_POINT_RENAME(uplug_openLibrary) +#define uplug_removePlug U_ICU_ENTRY_POINT_RENAME(uplug_removePlug) +#define uplug_setContext U_ICU_ENTRY_POINT_RENAME(uplug_setContext) +#define uplug_setPlugLevel U_ICU_ENTRY_POINT_RENAME(uplug_setPlugLevel) +#define uplug_setPlugName U_ICU_ENTRY_POINT_RENAME(uplug_setPlugName) +#define uplug_setPlugNoUnload U_ICU_ENTRY_POINT_RENAME(uplug_setPlugNoUnload) +#define uprops_getSource U_ICU_ENTRY_POINT_RENAME(uprops_getSource) +#define upropsvec_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(upropsvec_addPropertyStarts) +#define uprv_aestrncpy U_ICU_ENTRY_POINT_RENAME(uprv_aestrncpy) +#define uprv_asciiFromEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_asciiFromEbcdic) +#define uprv_asciitolower U_ICU_ENTRY_POINT_RENAME(uprv_asciitolower) +#define uprv_calloc U_ICU_ENTRY_POINT_RENAME(uprv_calloc) +#define uprv_ceil U_ICU_ENTRY_POINT_RENAME(uprv_ceil) +#define uprv_compareASCIIPropertyNames U_ICU_ENTRY_POINT_RENAME(uprv_compareASCIIPropertyNames) +#define uprv_compareEBCDICPropertyNames U_ICU_ENTRY_POINT_RENAME(uprv_compareEBCDICPropertyNames) +#define uprv_compareInvAscii U_ICU_ENTRY_POINT_RENAME(uprv_compareInvAscii) +#define uprv_compareInvEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_compareInvEbcdic) +#define uprv_compareInvEbcdicAsAscii U_ICU_ENTRY_POINT_RENAME(uprv_compareInvEbcdicAsAscii) +#define uprv_convertToLCID U_ICU_ENTRY_POINT_RENAME(uprv_convertToLCID) +#define uprv_convertToLCIDPlatform U_ICU_ENTRY_POINT_RENAME(uprv_convertToLCIDPlatform) +#define uprv_convertToPosix U_ICU_ENTRY_POINT_RENAME(uprv_convertToPosix) +#define uprv_copyAscii U_ICU_ENTRY_POINT_RENAME(uprv_copyAscii) +#define uprv_copyEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_copyEbcdic) +#define uprv_decContextClearStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextClearStatus) +#define uprv_decContextDefault U_ICU_ENTRY_POINT_RENAME(uprv_decContextDefault) +#define uprv_decContextGetRounding U_ICU_ENTRY_POINT_RENAME(uprv_decContextGetRounding) +#define uprv_decContextGetStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextGetStatus) +#define uprv_decContextRestoreStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextRestoreStatus) +#define uprv_decContextSaveStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextSaveStatus) +#define uprv_decContextSetRounding U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetRounding) +#define uprv_decContextSetStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatus) +#define uprv_decContextSetStatusFromString U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatusFromString) +#define uprv_decContextSetStatusFromStringQuiet U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatusFromStringQuiet) +#define uprv_decContextSetStatusQuiet U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatusQuiet) +#define uprv_decContextStatusToString U_ICU_ENTRY_POINT_RENAME(uprv_decContextStatusToString) +#define uprv_decContextTestSavedStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextTestSavedStatus) +#define uprv_decContextTestStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextTestStatus) +#define uprv_decContextZeroStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextZeroStatus) +#define uprv_decNumberAbs U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAbs) +#define uprv_decNumberAdd U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAdd) +#define uprv_decNumberAnd U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAnd) +#define uprv_decNumberClass U_ICU_ENTRY_POINT_RENAME(uprv_decNumberClass) +#define uprv_decNumberClassToString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberClassToString) +#define uprv_decNumberCompare U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompare) +#define uprv_decNumberCompareSignal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompareSignal) +#define uprv_decNumberCompareTotal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompareTotal) +#define uprv_decNumberCompareTotalMag U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompareTotalMag) +#define uprv_decNumberCopy U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopy) +#define uprv_decNumberCopyAbs U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopyAbs) +#define uprv_decNumberCopyNegate U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopyNegate) +#define uprv_decNumberCopySign U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopySign) +#define uprv_decNumberDivide U_ICU_ENTRY_POINT_RENAME(uprv_decNumberDivide) +#define uprv_decNumberDivideInteger U_ICU_ENTRY_POINT_RENAME(uprv_decNumberDivideInteger) +#define uprv_decNumberExp U_ICU_ENTRY_POINT_RENAME(uprv_decNumberExp) +#define uprv_decNumberFMA U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFMA) +#define uprv_decNumberFromInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFromInt32) +#define uprv_decNumberFromString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFromString) +#define uprv_decNumberFromUInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFromUInt32) +#define uprv_decNumberGetBCD U_ICU_ENTRY_POINT_RENAME(uprv_decNumberGetBCD) +#define uprv_decNumberInvert U_ICU_ENTRY_POINT_RENAME(uprv_decNumberInvert) +#define uprv_decNumberIsNormal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberIsNormal) +#define uprv_decNumberIsSubnormal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberIsSubnormal) +#define uprv_decNumberLn U_ICU_ENTRY_POINT_RENAME(uprv_decNumberLn) +#define uprv_decNumberLog10 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberLog10) +#define uprv_decNumberLogB U_ICU_ENTRY_POINT_RENAME(uprv_decNumberLogB) +#define uprv_decNumberMax U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMax) +#define uprv_decNumberMaxMag U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMaxMag) +#define uprv_decNumberMin U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMin) +#define uprv_decNumberMinMag U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMinMag) +#define uprv_decNumberMinus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMinus) +#define uprv_decNumberMultiply U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMultiply) +#define uprv_decNumberNextMinus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNextMinus) +#define uprv_decNumberNextPlus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNextPlus) +#define uprv_decNumberNextToward U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNextToward) +#define uprv_decNumberNormalize U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNormalize) +#define uprv_decNumberOr U_ICU_ENTRY_POINT_RENAME(uprv_decNumberOr) +#define uprv_decNumberPlus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberPlus) +#define uprv_decNumberPower U_ICU_ENTRY_POINT_RENAME(uprv_decNumberPower) +#define uprv_decNumberQuantize U_ICU_ENTRY_POINT_RENAME(uprv_decNumberQuantize) +#define uprv_decNumberReduce U_ICU_ENTRY_POINT_RENAME(uprv_decNumberReduce) +#define uprv_decNumberRemainder U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRemainder) +#define uprv_decNumberRemainderNear U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRemainderNear) +#define uprv_decNumberRescale U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRescale) +#define uprv_decNumberRotate U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRotate) +#define uprv_decNumberSameQuantum U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSameQuantum) +#define uprv_decNumberScaleB U_ICU_ENTRY_POINT_RENAME(uprv_decNumberScaleB) +#define uprv_decNumberSetBCD U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSetBCD) +#define uprv_decNumberShift U_ICU_ENTRY_POINT_RENAME(uprv_decNumberShift) +#define uprv_decNumberSquareRoot U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSquareRoot) +#define uprv_decNumberSubtract U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSubtract) +#define uprv_decNumberToEngString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToEngString) +#define uprv_decNumberToInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToInt32) +#define uprv_decNumberToIntegralExact U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToIntegralExact) +#define uprv_decNumberToIntegralValue U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToIntegralValue) +#define uprv_decNumberToString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToString) +#define uprv_decNumberToUInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToUInt32) +#define uprv_decNumberTrim U_ICU_ENTRY_POINT_RENAME(uprv_decNumberTrim) +#define uprv_decNumberVersion U_ICU_ENTRY_POINT_RENAME(uprv_decNumberVersion) +#define uprv_decNumberXor U_ICU_ENTRY_POINT_RENAME(uprv_decNumberXor) +#define uprv_decNumberZero U_ICU_ENTRY_POINT_RENAME(uprv_decNumberZero) +#define uprv_deleteConditionalCE32 U_ICU_ENTRY_POINT_RENAME(uprv_deleteConditionalCE32) +#define uprv_deleteUObject U_ICU_ENTRY_POINT_RENAME(uprv_deleteUObject) +#define uprv_dl_close U_ICU_ENTRY_POINT_RENAME(uprv_dl_close) +#define uprv_dl_open U_ICU_ENTRY_POINT_RENAME(uprv_dl_open) +#define uprv_dlsym_func U_ICU_ENTRY_POINT_RENAME(uprv_dlsym_func) +#define uprv_eastrncpy U_ICU_ENTRY_POINT_RENAME(uprv_eastrncpy) +#define uprv_ebcdicFromAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicFromAscii) +#define uprv_ebcdicToLowercaseAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicToLowercaseAscii) +#define uprv_ebcdictolower U_ICU_ENTRY_POINT_RENAME(uprv_ebcdictolower) +#define uprv_fabs U_ICU_ENTRY_POINT_RENAME(uprv_fabs) +#define uprv_floor U_ICU_ENTRY_POINT_RENAME(uprv_floor) +#define uprv_fmax U_ICU_ENTRY_POINT_RENAME(uprv_fmax) +#define uprv_fmin U_ICU_ENTRY_POINT_RENAME(uprv_fmin) +#define uprv_fmod U_ICU_ENTRY_POINT_RENAME(uprv_fmod) +#define uprv_free U_ICU_ENTRY_POINT_RENAME(uprv_free) +#define uprv_getCharNameCharacters U_ICU_ENTRY_POINT_RENAME(uprv_getCharNameCharacters) +#define uprv_getDefaultCodepage U_ICU_ENTRY_POINT_RENAME(uprv_getDefaultCodepage) +#define uprv_getDefaultLocaleID U_ICU_ENTRY_POINT_RENAME(uprv_getDefaultLocaleID) +#define uprv_getInfinity U_ICU_ENTRY_POINT_RENAME(uprv_getInfinity) +#define uprv_getMaxCharNameLength U_ICU_ENTRY_POINT_RENAME(uprv_getMaxCharNameLength) +#define uprv_getMaxValues U_ICU_ENTRY_POINT_RENAME(uprv_getMaxValues) +#define uprv_getNaN U_ICU_ENTRY_POINT_RENAME(uprv_getNaN) +#define uprv_getRawUTCtime U_ICU_ENTRY_POINT_RENAME(uprv_getRawUTCtime) +#define uprv_getStaticCurrencyName U_ICU_ENTRY_POINT_RENAME(uprv_getStaticCurrencyName) +#define uprv_getUTCtime U_ICU_ENTRY_POINT_RENAME(uprv_getUTCtime) +#define uprv_haveProperties U_ICU_ENTRY_POINT_RENAME(uprv_haveProperties) +#define uprv_int32Comparator U_ICU_ENTRY_POINT_RENAME(uprv_int32Comparator) +#define uprv_isASCIILetter U_ICU_ENTRY_POINT_RENAME(uprv_isASCIILetter) +#define uprv_isInfinite U_ICU_ENTRY_POINT_RENAME(uprv_isInfinite) +#define uprv_isInvariantString U_ICU_ENTRY_POINT_RENAME(uprv_isInvariantString) +#define uprv_isInvariantUString U_ICU_ENTRY_POINT_RENAME(uprv_isInvariantUString) +#define uprv_isNaN U_ICU_ENTRY_POINT_RENAME(uprv_isNaN) +#define uprv_isNegativeInfinity U_ICU_ENTRY_POINT_RENAME(uprv_isNegativeInfinity) +#define uprv_isPositiveInfinity U_ICU_ENTRY_POINT_RENAME(uprv_isPositiveInfinity) +#define uprv_itou U_ICU_ENTRY_POINT_RENAME(uprv_itou) +#define uprv_log U_ICU_ENTRY_POINT_RENAME(uprv_log) +#define uprv_malloc U_ICU_ENTRY_POINT_RENAME(uprv_malloc) +#define uprv_mapFile U_ICU_ENTRY_POINT_RENAME(uprv_mapFile) +#define uprv_max U_ICU_ENTRY_POINT_RENAME(uprv_max) +#define uprv_maxMantissa U_ICU_ENTRY_POINT_RENAME(uprv_maxMantissa) +#define uprv_maximumPtr U_ICU_ENTRY_POINT_RENAME(uprv_maximumPtr) +#define uprv_min U_ICU_ENTRY_POINT_RENAME(uprv_min) +#define uprv_modf U_ICU_ENTRY_POINT_RENAME(uprv_modf) +#define uprv_parseCurrency U_ICU_ENTRY_POINT_RENAME(uprv_parseCurrency) +#define uprv_pathIsAbsolute U_ICU_ENTRY_POINT_RENAME(uprv_pathIsAbsolute) +#define uprv_pow U_ICU_ENTRY_POINT_RENAME(uprv_pow) +#define uprv_pow10 U_ICU_ENTRY_POINT_RENAME(uprv_pow10) +#define uprv_realloc U_ICU_ENTRY_POINT_RENAME(uprv_realloc) +#define uprv_round U_ICU_ENTRY_POINT_RENAME(uprv_round) +#define uprv_sortArray U_ICU_ENTRY_POINT_RENAME(uprv_sortArray) +#define uprv_stableBinarySearch U_ICU_ENTRY_POINT_RENAME(uprv_stableBinarySearch) +#define uprv_strCompare U_ICU_ENTRY_POINT_RENAME(uprv_strCompare) +#define uprv_strdup U_ICU_ENTRY_POINT_RENAME(uprv_strdup) +#define uprv_stricmp U_ICU_ENTRY_POINT_RENAME(uprv_stricmp) +#define uprv_strndup U_ICU_ENTRY_POINT_RENAME(uprv_strndup) +#define uprv_strnicmp U_ICU_ENTRY_POINT_RENAME(uprv_strnicmp) +#define uprv_syntaxError U_ICU_ENTRY_POINT_RENAME(uprv_syntaxError) +#define uprv_timezone U_ICU_ENTRY_POINT_RENAME(uprv_timezone) +#define uprv_toupper U_ICU_ENTRY_POINT_RENAME(uprv_toupper) +#define uprv_trunc U_ICU_ENTRY_POINT_RENAME(uprv_trunc) +#define uprv_tzname U_ICU_ENTRY_POINT_RENAME(uprv_tzname) +#define uprv_tzname_clear_cache U_ICU_ENTRY_POINT_RENAME(uprv_tzname_clear_cache) +#define uprv_tzset U_ICU_ENTRY_POINT_RENAME(uprv_tzset) +#define uprv_uint16Comparator U_ICU_ENTRY_POINT_RENAME(uprv_uint16Comparator) +#define uprv_uint32Comparator U_ICU_ENTRY_POINT_RENAME(uprv_uint32Comparator) +#define uprv_unmapFile U_ICU_ENTRY_POINT_RENAME(uprv_unmapFile) +#define upvec_cloneArray U_ICU_ENTRY_POINT_RENAME(upvec_cloneArray) +#define upvec_close U_ICU_ENTRY_POINT_RENAME(upvec_close) +#define upvec_compact U_ICU_ENTRY_POINT_RENAME(upvec_compact) +#define upvec_compactToUTrie2Handler U_ICU_ENTRY_POINT_RENAME(upvec_compactToUTrie2Handler) +#define upvec_compactToUTrie2WithRowIndexes U_ICU_ENTRY_POINT_RENAME(upvec_compactToUTrie2WithRowIndexes) +#define upvec_getArray U_ICU_ENTRY_POINT_RENAME(upvec_getArray) +#define upvec_getRow U_ICU_ENTRY_POINT_RENAME(upvec_getRow) +#define upvec_getValue U_ICU_ENTRY_POINT_RENAME(upvec_getValue) +#define upvec_open U_ICU_ENTRY_POINT_RENAME(upvec_open) +#define upvec_setValue U_ICU_ENTRY_POINT_RENAME(upvec_setValue) +#define uregex_appendReplacement U_ICU_ENTRY_POINT_RENAME(uregex_appendReplacement) +#define uregex_appendReplacementUText U_ICU_ENTRY_POINT_RENAME(uregex_appendReplacementUText) +#define uregex_appendTail U_ICU_ENTRY_POINT_RENAME(uregex_appendTail) +#define uregex_appendTailUText U_ICU_ENTRY_POINT_RENAME(uregex_appendTailUText) +#define uregex_clone U_ICU_ENTRY_POINT_RENAME(uregex_clone) +#define uregex_close U_ICU_ENTRY_POINT_RENAME(uregex_close) +#define uregex_end U_ICU_ENTRY_POINT_RENAME(uregex_end) +#define uregex_end64 U_ICU_ENTRY_POINT_RENAME(uregex_end64) +#define uregex_find U_ICU_ENTRY_POINT_RENAME(uregex_find) +#define uregex_find64 U_ICU_ENTRY_POINT_RENAME(uregex_find64) +#define uregex_findNext U_ICU_ENTRY_POINT_RENAME(uregex_findNext) +#define uregex_flags U_ICU_ENTRY_POINT_RENAME(uregex_flags) +#define uregex_getFindProgressCallback U_ICU_ENTRY_POINT_RENAME(uregex_getFindProgressCallback) +#define uregex_getMatchCallback U_ICU_ENTRY_POINT_RENAME(uregex_getMatchCallback) +#define uregex_getStackLimit U_ICU_ENTRY_POINT_RENAME(uregex_getStackLimit) +#define uregex_getText U_ICU_ENTRY_POINT_RENAME(uregex_getText) +#define uregex_getTimeLimit U_ICU_ENTRY_POINT_RENAME(uregex_getTimeLimit) +#define uregex_getUText U_ICU_ENTRY_POINT_RENAME(uregex_getUText) +#define uregex_group U_ICU_ENTRY_POINT_RENAME(uregex_group) +#define uregex_groupCount U_ICU_ENTRY_POINT_RENAME(uregex_groupCount) +#define uregex_groupNumberFromCName U_ICU_ENTRY_POINT_RENAME(uregex_groupNumberFromCName) +#define uregex_groupNumberFromName U_ICU_ENTRY_POINT_RENAME(uregex_groupNumberFromName) +#define uregex_groupUText U_ICU_ENTRY_POINT_RENAME(uregex_groupUText) +#define uregex_hasAnchoringBounds U_ICU_ENTRY_POINT_RENAME(uregex_hasAnchoringBounds) +#define uregex_hasTransparentBounds U_ICU_ENTRY_POINT_RENAME(uregex_hasTransparentBounds) +#define uregex_hitEnd U_ICU_ENTRY_POINT_RENAME(uregex_hitEnd) +#define uregex_lookingAt U_ICU_ENTRY_POINT_RENAME(uregex_lookingAt) +#define uregex_lookingAt64 U_ICU_ENTRY_POINT_RENAME(uregex_lookingAt64) +#define uregex_matches U_ICU_ENTRY_POINT_RENAME(uregex_matches) +#define uregex_matches64 U_ICU_ENTRY_POINT_RENAME(uregex_matches64) +#define uregex_open U_ICU_ENTRY_POINT_RENAME(uregex_open) +#define uregex_openC U_ICU_ENTRY_POINT_RENAME(uregex_openC) +#define uregex_openUText U_ICU_ENTRY_POINT_RENAME(uregex_openUText) +#define uregex_pattern U_ICU_ENTRY_POINT_RENAME(uregex_pattern) +#define uregex_patternUText U_ICU_ENTRY_POINT_RENAME(uregex_patternUText) +#define uregex_refreshUText U_ICU_ENTRY_POINT_RENAME(uregex_refreshUText) +#define uregex_regionEnd U_ICU_ENTRY_POINT_RENAME(uregex_regionEnd) +#define uregex_regionEnd64 U_ICU_ENTRY_POINT_RENAME(uregex_regionEnd64) +#define uregex_regionStart U_ICU_ENTRY_POINT_RENAME(uregex_regionStart) +#define uregex_regionStart64 U_ICU_ENTRY_POINT_RENAME(uregex_regionStart64) +#define uregex_replaceAll U_ICU_ENTRY_POINT_RENAME(uregex_replaceAll) +#define uregex_replaceAllUText U_ICU_ENTRY_POINT_RENAME(uregex_replaceAllUText) +#define uregex_replaceFirst U_ICU_ENTRY_POINT_RENAME(uregex_replaceFirst) +#define uregex_replaceFirstUText U_ICU_ENTRY_POINT_RENAME(uregex_replaceFirstUText) +#define uregex_requireEnd U_ICU_ENTRY_POINT_RENAME(uregex_requireEnd) +#define uregex_reset U_ICU_ENTRY_POINT_RENAME(uregex_reset) +#define uregex_reset64 U_ICU_ENTRY_POINT_RENAME(uregex_reset64) +#define uregex_setFindProgressCallback U_ICU_ENTRY_POINT_RENAME(uregex_setFindProgressCallback) +#define uregex_setMatchCallback U_ICU_ENTRY_POINT_RENAME(uregex_setMatchCallback) +#define uregex_setRegion U_ICU_ENTRY_POINT_RENAME(uregex_setRegion) +#define uregex_setRegion64 U_ICU_ENTRY_POINT_RENAME(uregex_setRegion64) +#define uregex_setRegionAndStart U_ICU_ENTRY_POINT_RENAME(uregex_setRegionAndStart) +#define uregex_setStackLimit U_ICU_ENTRY_POINT_RENAME(uregex_setStackLimit) +#define uregex_setText U_ICU_ENTRY_POINT_RENAME(uregex_setText) +#define uregex_setTimeLimit U_ICU_ENTRY_POINT_RENAME(uregex_setTimeLimit) +#define uregex_setUText U_ICU_ENTRY_POINT_RENAME(uregex_setUText) +#define uregex_split U_ICU_ENTRY_POINT_RENAME(uregex_split) +#define uregex_splitUText U_ICU_ENTRY_POINT_RENAME(uregex_splitUText) +#define uregex_start U_ICU_ENTRY_POINT_RENAME(uregex_start) +#define uregex_start64 U_ICU_ENTRY_POINT_RENAME(uregex_start64) +#define uregex_ucstr_unescape_charAt U_ICU_ENTRY_POINT_RENAME(uregex_ucstr_unescape_charAt) +#define uregex_useAnchoringBounds U_ICU_ENTRY_POINT_RENAME(uregex_useAnchoringBounds) +#define uregex_useTransparentBounds U_ICU_ENTRY_POINT_RENAME(uregex_useTransparentBounds) +#define uregex_utext_unescape_charAt U_ICU_ENTRY_POINT_RENAME(uregex_utext_unescape_charAt) +#define uregion_areEqual U_ICU_ENTRY_POINT_RENAME(uregion_areEqual) +#define uregion_contains U_ICU_ENTRY_POINT_RENAME(uregion_contains) +#define uregion_getAvailable U_ICU_ENTRY_POINT_RENAME(uregion_getAvailable) +#define uregion_getContainedRegions U_ICU_ENTRY_POINT_RENAME(uregion_getContainedRegions) +#define uregion_getContainedRegionsOfType U_ICU_ENTRY_POINT_RENAME(uregion_getContainedRegionsOfType) +#define uregion_getContainingRegion U_ICU_ENTRY_POINT_RENAME(uregion_getContainingRegion) +#define uregion_getContainingRegionOfType U_ICU_ENTRY_POINT_RENAME(uregion_getContainingRegionOfType) +#define uregion_getNumericCode U_ICU_ENTRY_POINT_RENAME(uregion_getNumericCode) +#define uregion_getPreferredValues U_ICU_ENTRY_POINT_RENAME(uregion_getPreferredValues) +#define uregion_getRegionCode U_ICU_ENTRY_POINT_RENAME(uregion_getRegionCode) +#define uregion_getRegionFromCode U_ICU_ENTRY_POINT_RENAME(uregion_getRegionFromCode) +#define uregion_getRegionFromNumericCode U_ICU_ENTRY_POINT_RENAME(uregion_getRegionFromNumericCode) +#define uregion_getType U_ICU_ENTRY_POINT_RENAME(uregion_getType) +#define ureldatefmt_close U_ICU_ENTRY_POINT_RENAME(ureldatefmt_close) +#define ureldatefmt_combineDateAndTime U_ICU_ENTRY_POINT_RENAME(ureldatefmt_combineDateAndTime) +#define ureldatefmt_format U_ICU_ENTRY_POINT_RENAME(ureldatefmt_format) +#define ureldatefmt_formatNumeric U_ICU_ENTRY_POINT_RENAME(ureldatefmt_formatNumeric) +#define ureldatefmt_open U_ICU_ENTRY_POINT_RENAME(ureldatefmt_open) +#define ures_close U_ICU_ENTRY_POINT_RENAME(ures_close) +#define ures_copyResb U_ICU_ENTRY_POINT_RENAME(ures_copyResb) +#define ures_countArrayItems U_ICU_ENTRY_POINT_RENAME(ures_countArrayItems) +#define ures_findResource U_ICU_ENTRY_POINT_RENAME(ures_findResource) +#define ures_findSubResource U_ICU_ENTRY_POINT_RENAME(ures_findSubResource) +#define ures_getAllItemsWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getAllItemsWithFallback) +#define ures_getBinary U_ICU_ENTRY_POINT_RENAME(ures_getBinary) +#define ures_getByIndex U_ICU_ENTRY_POINT_RENAME(ures_getByIndex) +#define ures_getByKey U_ICU_ENTRY_POINT_RENAME(ures_getByKey) +#define ures_getByKeyWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getByKeyWithFallback) +#define ures_getFunctionalEquivalent U_ICU_ENTRY_POINT_RENAME(ures_getFunctionalEquivalent) +#define ures_getInt U_ICU_ENTRY_POINT_RENAME(ures_getInt) +#define ures_getIntVector U_ICU_ENTRY_POINT_RENAME(ures_getIntVector) +#define ures_getKey U_ICU_ENTRY_POINT_RENAME(ures_getKey) +#define ures_getKeywordValues U_ICU_ENTRY_POINT_RENAME(ures_getKeywordValues) +#define ures_getLocale U_ICU_ENTRY_POINT_RENAME(ures_getLocale) +#define ures_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ures_getLocaleByType) +#define ures_getLocaleInternal U_ICU_ENTRY_POINT_RENAME(ures_getLocaleInternal) +#define ures_getName U_ICU_ENTRY_POINT_RENAME(ures_getName) +#define ures_getNextResource U_ICU_ENTRY_POINT_RENAME(ures_getNextResource) +#define ures_getNextString U_ICU_ENTRY_POINT_RENAME(ures_getNextString) +#define ures_getSize U_ICU_ENTRY_POINT_RENAME(ures_getSize) +#define ures_getString U_ICU_ENTRY_POINT_RENAME(ures_getString) +#define ures_getStringByIndex U_ICU_ENTRY_POINT_RENAME(ures_getStringByIndex) +#define ures_getStringByKey U_ICU_ENTRY_POINT_RENAME(ures_getStringByKey) +#define ures_getStringByKeyWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getStringByKeyWithFallback) +#define ures_getType U_ICU_ENTRY_POINT_RENAME(ures_getType) +#define ures_getUInt U_ICU_ENTRY_POINT_RENAME(ures_getUInt) +#define ures_getUTF8String U_ICU_ENTRY_POINT_RENAME(ures_getUTF8String) +#define ures_getUTF8StringByIndex U_ICU_ENTRY_POINT_RENAME(ures_getUTF8StringByIndex) +#define ures_getUTF8StringByKey U_ICU_ENTRY_POINT_RENAME(ures_getUTF8StringByKey) +#define ures_getVersion U_ICU_ENTRY_POINT_RENAME(ures_getVersion) +#define ures_getVersionByKey U_ICU_ENTRY_POINT_RENAME(ures_getVersionByKey) +#define ures_getVersionNumber U_ICU_ENTRY_POINT_RENAME(ures_getVersionNumber) +#define ures_getVersionNumberInternal U_ICU_ENTRY_POINT_RENAME(ures_getVersionNumberInternal) +#define ures_hasNext U_ICU_ENTRY_POINT_RENAME(ures_hasNext) +#define ures_initStackObject U_ICU_ENTRY_POINT_RENAME(ures_initStackObject) +#define ures_open U_ICU_ENTRY_POINT_RENAME(ures_open) +#define ures_openAvailableLocales U_ICU_ENTRY_POINT_RENAME(ures_openAvailableLocales) +#define ures_openDirect U_ICU_ENTRY_POINT_RENAME(ures_openDirect) +#define ures_openFillIn U_ICU_ENTRY_POINT_RENAME(ures_openFillIn) +#define ures_openNoDefault U_ICU_ENTRY_POINT_RENAME(ures_openNoDefault) +#define ures_openU U_ICU_ENTRY_POINT_RENAME(ures_openU) +#define ures_resetIterator U_ICU_ENTRY_POINT_RENAME(ures_resetIterator) +#define ures_swap U_ICU_ENTRY_POINT_RENAME(ures_swap) +#define uscript_breaksBetweenLetters U_ICU_ENTRY_POINT_RENAME(uscript_breaksBetweenLetters) +#define uscript_closeRun U_ICU_ENTRY_POINT_RENAME(uscript_closeRun) +#define uscript_getCode U_ICU_ENTRY_POINT_RENAME(uscript_getCode) +#define uscript_getName U_ICU_ENTRY_POINT_RENAME(uscript_getName) +#define uscript_getSampleString U_ICU_ENTRY_POINT_RENAME(uscript_getSampleString) +#define uscript_getSampleUnicodeString U_ICU_ENTRY_POINT_RENAME(uscript_getSampleUnicodeString) +#define uscript_getScript U_ICU_ENTRY_POINT_RENAME(uscript_getScript) +#define uscript_getScriptExtensions U_ICU_ENTRY_POINT_RENAME(uscript_getScriptExtensions) +#define uscript_getShortName U_ICU_ENTRY_POINT_RENAME(uscript_getShortName) +#define uscript_getUsage U_ICU_ENTRY_POINT_RENAME(uscript_getUsage) +#define uscript_hasScript U_ICU_ENTRY_POINT_RENAME(uscript_hasScript) +#define uscript_isCased U_ICU_ENTRY_POINT_RENAME(uscript_isCased) +#define uscript_isRightToLeft U_ICU_ENTRY_POINT_RENAME(uscript_isRightToLeft) +#define uscript_nextRun U_ICU_ENTRY_POINT_RENAME(uscript_nextRun) +#define uscript_openRun U_ICU_ENTRY_POINT_RENAME(uscript_openRun) +#define uscript_resetRun U_ICU_ENTRY_POINT_RENAME(uscript_resetRun) +#define uscript_setRunText U_ICU_ENTRY_POINT_RENAME(uscript_setRunText) +#define usearch_close U_ICU_ENTRY_POINT_RENAME(usearch_close) +#define usearch_first U_ICU_ENTRY_POINT_RENAME(usearch_first) +#define usearch_following U_ICU_ENTRY_POINT_RENAME(usearch_following) +#define usearch_getAttribute U_ICU_ENTRY_POINT_RENAME(usearch_getAttribute) +#define usearch_getBreakIterator U_ICU_ENTRY_POINT_RENAME(usearch_getBreakIterator) +#define usearch_getCollator U_ICU_ENTRY_POINT_RENAME(usearch_getCollator) +#define usearch_getMatchedLength U_ICU_ENTRY_POINT_RENAME(usearch_getMatchedLength) +#define usearch_getMatchedStart U_ICU_ENTRY_POINT_RENAME(usearch_getMatchedStart) +#define usearch_getMatchedText U_ICU_ENTRY_POINT_RENAME(usearch_getMatchedText) +#define usearch_getOffset U_ICU_ENTRY_POINT_RENAME(usearch_getOffset) +#define usearch_getPattern U_ICU_ENTRY_POINT_RENAME(usearch_getPattern) +#define usearch_getText U_ICU_ENTRY_POINT_RENAME(usearch_getText) +#define usearch_handleNextCanonical U_ICU_ENTRY_POINT_RENAME(usearch_handleNextCanonical) +#define usearch_handleNextExact U_ICU_ENTRY_POINT_RENAME(usearch_handleNextExact) +#define usearch_handlePreviousCanonical U_ICU_ENTRY_POINT_RENAME(usearch_handlePreviousCanonical) +#define usearch_handlePreviousExact U_ICU_ENTRY_POINT_RENAME(usearch_handlePreviousExact) +#define usearch_last U_ICU_ENTRY_POINT_RENAME(usearch_last) +#define usearch_next U_ICU_ENTRY_POINT_RENAME(usearch_next) +#define usearch_open U_ICU_ENTRY_POINT_RENAME(usearch_open) +#define usearch_openFromCollator U_ICU_ENTRY_POINT_RENAME(usearch_openFromCollator) +#define usearch_preceding U_ICU_ENTRY_POINT_RENAME(usearch_preceding) +#define usearch_previous U_ICU_ENTRY_POINT_RENAME(usearch_previous) +#define usearch_reset U_ICU_ENTRY_POINT_RENAME(usearch_reset) +#define usearch_search U_ICU_ENTRY_POINT_RENAME(usearch_search) +#define usearch_searchBackwards U_ICU_ENTRY_POINT_RENAME(usearch_searchBackwards) +#define usearch_setAttribute U_ICU_ENTRY_POINT_RENAME(usearch_setAttribute) +#define usearch_setBreakIterator U_ICU_ENTRY_POINT_RENAME(usearch_setBreakIterator) +#define usearch_setCollator U_ICU_ENTRY_POINT_RENAME(usearch_setCollator) +#define usearch_setOffset U_ICU_ENTRY_POINT_RENAME(usearch_setOffset) +#define usearch_setPattern U_ICU_ENTRY_POINT_RENAME(usearch_setPattern) +#define usearch_setText U_ICU_ENTRY_POINT_RENAME(usearch_setText) +#define uset_add U_ICU_ENTRY_POINT_RENAME(uset_add) +#define uset_addAll U_ICU_ENTRY_POINT_RENAME(uset_addAll) +#define uset_addAllCodePoints U_ICU_ENTRY_POINT_RENAME(uset_addAllCodePoints) +#define uset_addRange U_ICU_ENTRY_POINT_RENAME(uset_addRange) +#define uset_addString U_ICU_ENTRY_POINT_RENAME(uset_addString) +#define uset_applyIntPropertyValue U_ICU_ENTRY_POINT_RENAME(uset_applyIntPropertyValue) +#define uset_applyPattern U_ICU_ENTRY_POINT_RENAME(uset_applyPattern) +#define uset_applyPropertyAlias U_ICU_ENTRY_POINT_RENAME(uset_applyPropertyAlias) +#define uset_charAt U_ICU_ENTRY_POINT_RENAME(uset_charAt) +#define uset_clear U_ICU_ENTRY_POINT_RENAME(uset_clear) +#define uset_clone U_ICU_ENTRY_POINT_RENAME(uset_clone) +#define uset_cloneAsThawed U_ICU_ENTRY_POINT_RENAME(uset_cloneAsThawed) +#define uset_close U_ICU_ENTRY_POINT_RENAME(uset_close) +#define uset_closeOver U_ICU_ENTRY_POINT_RENAME(uset_closeOver) +#define uset_compact U_ICU_ENTRY_POINT_RENAME(uset_compact) +#define uset_complement U_ICU_ENTRY_POINT_RENAME(uset_complement) +#define uset_complementAll U_ICU_ENTRY_POINT_RENAME(uset_complementAll) +#define uset_contains U_ICU_ENTRY_POINT_RENAME(uset_contains) +#define uset_containsAll U_ICU_ENTRY_POINT_RENAME(uset_containsAll) +#define uset_containsAllCodePoints U_ICU_ENTRY_POINT_RENAME(uset_containsAllCodePoints) +#define uset_containsNone U_ICU_ENTRY_POINT_RENAME(uset_containsNone) +#define uset_containsRange U_ICU_ENTRY_POINT_RENAME(uset_containsRange) +#define uset_containsSome U_ICU_ENTRY_POINT_RENAME(uset_containsSome) +#define uset_containsString U_ICU_ENTRY_POINT_RENAME(uset_containsString) +#define uset_equals U_ICU_ENTRY_POINT_RENAME(uset_equals) +#define uset_freeze U_ICU_ENTRY_POINT_RENAME(uset_freeze) +#define uset_getItem U_ICU_ENTRY_POINT_RENAME(uset_getItem) +#define uset_getItemCount U_ICU_ENTRY_POINT_RENAME(uset_getItemCount) +#define uset_getSerializedRange U_ICU_ENTRY_POINT_RENAME(uset_getSerializedRange) +#define uset_getSerializedRangeCount U_ICU_ENTRY_POINT_RENAME(uset_getSerializedRangeCount) +#define uset_getSerializedSet U_ICU_ENTRY_POINT_RENAME(uset_getSerializedSet) +#define uset_indexOf U_ICU_ENTRY_POINT_RENAME(uset_indexOf) +#define uset_isEmpty U_ICU_ENTRY_POINT_RENAME(uset_isEmpty) +#define uset_isFrozen U_ICU_ENTRY_POINT_RENAME(uset_isFrozen) +#define uset_open U_ICU_ENTRY_POINT_RENAME(uset_open) +#define uset_openEmpty U_ICU_ENTRY_POINT_RENAME(uset_openEmpty) +#define uset_openPattern U_ICU_ENTRY_POINT_RENAME(uset_openPattern) +#define uset_openPatternOptions U_ICU_ENTRY_POINT_RENAME(uset_openPatternOptions) +#define uset_remove U_ICU_ENTRY_POINT_RENAME(uset_remove) +#define uset_removeAll U_ICU_ENTRY_POINT_RENAME(uset_removeAll) +#define uset_removeAllStrings U_ICU_ENTRY_POINT_RENAME(uset_removeAllStrings) +#define uset_removeRange U_ICU_ENTRY_POINT_RENAME(uset_removeRange) +#define uset_removeString U_ICU_ENTRY_POINT_RENAME(uset_removeString) +#define uset_resemblesPattern U_ICU_ENTRY_POINT_RENAME(uset_resemblesPattern) +#define uset_retain U_ICU_ENTRY_POINT_RENAME(uset_retain) +#define uset_retainAll U_ICU_ENTRY_POINT_RENAME(uset_retainAll) +#define uset_serialize U_ICU_ENTRY_POINT_RENAME(uset_serialize) +#define uset_serializedContains U_ICU_ENTRY_POINT_RENAME(uset_serializedContains) +#define uset_set U_ICU_ENTRY_POINT_RENAME(uset_set) +#define uset_setSerializedToOne U_ICU_ENTRY_POINT_RENAME(uset_setSerializedToOne) +#define uset_size U_ICU_ENTRY_POINT_RENAME(uset_size) +#define uset_span U_ICU_ENTRY_POINT_RENAME(uset_span) +#define uset_spanBack U_ICU_ENTRY_POINT_RENAME(uset_spanBack) +#define uset_spanBackUTF8 U_ICU_ENTRY_POINT_RENAME(uset_spanBackUTF8) +#define uset_spanUTF8 U_ICU_ENTRY_POINT_RENAME(uset_spanUTF8) +#define uset_toPattern U_ICU_ENTRY_POINT_RENAME(uset_toPattern) +#define uspoof_areConfusable U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusable) +#define uspoof_areConfusableUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusableUTF8) +#define uspoof_areConfusableUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusableUnicodeString) +#define uspoof_check U_ICU_ENTRY_POINT_RENAME(uspoof_check) +#define uspoof_check2 U_ICU_ENTRY_POINT_RENAME(uspoof_check2) +#define uspoof_check2UTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_check2UTF8) +#define uspoof_check2UnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_check2UnicodeString) +#define uspoof_checkUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_checkUTF8) +#define uspoof_checkUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_checkUnicodeString) +#define uspoof_clone U_ICU_ENTRY_POINT_RENAME(uspoof_clone) +#define uspoof_close U_ICU_ENTRY_POINT_RENAME(uspoof_close) +#define uspoof_closeCheckResult U_ICU_ENTRY_POINT_RENAME(uspoof_closeCheckResult) +#define uspoof_getAllowedChars U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedChars) +#define uspoof_getAllowedLocales U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedLocales) +#define uspoof_getAllowedUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedUnicodeSet) +#define uspoof_getCheckResultChecks U_ICU_ENTRY_POINT_RENAME(uspoof_getCheckResultChecks) +#define uspoof_getCheckResultNumerics U_ICU_ENTRY_POINT_RENAME(uspoof_getCheckResultNumerics) +#define uspoof_getCheckResultRestrictionLevel U_ICU_ENTRY_POINT_RENAME(uspoof_getCheckResultRestrictionLevel) +#define uspoof_getChecks U_ICU_ENTRY_POINT_RENAME(uspoof_getChecks) +#define uspoof_getInclusionSet U_ICU_ENTRY_POINT_RENAME(uspoof_getInclusionSet) +#define uspoof_getInclusionUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_getInclusionUnicodeSet) +#define uspoof_getRecommendedSet U_ICU_ENTRY_POINT_RENAME(uspoof_getRecommendedSet) +#define uspoof_getRecommendedUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_getRecommendedUnicodeSet) +#define uspoof_getRestrictionLevel U_ICU_ENTRY_POINT_RENAME(uspoof_getRestrictionLevel) +#define uspoof_getSkeleton U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeleton) +#define uspoof_getSkeletonUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeletonUTF8) +#define uspoof_getSkeletonUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeletonUnicodeString) +#define uspoof_internalInitStatics U_ICU_ENTRY_POINT_RENAME(uspoof_internalInitStatics) +#define uspoof_open U_ICU_ENTRY_POINT_RENAME(uspoof_open) +#define uspoof_openCheckResult U_ICU_ENTRY_POINT_RENAME(uspoof_openCheckResult) +#define uspoof_openFromSerialized U_ICU_ENTRY_POINT_RENAME(uspoof_openFromSerialized) +#define uspoof_openFromSource U_ICU_ENTRY_POINT_RENAME(uspoof_openFromSource) +#define uspoof_serialize U_ICU_ENTRY_POINT_RENAME(uspoof_serialize) +#define uspoof_setAllowedChars U_ICU_ENTRY_POINT_RENAME(uspoof_setAllowedChars) +#define uspoof_setAllowedLocales U_ICU_ENTRY_POINT_RENAME(uspoof_setAllowedLocales) +#define uspoof_setAllowedUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_setAllowedUnicodeSet) +#define uspoof_setChecks U_ICU_ENTRY_POINT_RENAME(uspoof_setChecks) +#define uspoof_setRestrictionLevel U_ICU_ENTRY_POINT_RENAME(uspoof_setRestrictionLevel) +#define uspoof_swap U_ICU_ENTRY_POINT_RENAME(uspoof_swap) +#define usprep_close U_ICU_ENTRY_POINT_RENAME(usprep_close) +#define usprep_open U_ICU_ENTRY_POINT_RENAME(usprep_open) +#define usprep_openByType U_ICU_ENTRY_POINT_RENAME(usprep_openByType) +#define usprep_prepare U_ICU_ENTRY_POINT_RENAME(usprep_prepare) +#define usprep_swap U_ICU_ENTRY_POINT_RENAME(usprep_swap) +#define ustr_hashCharsN U_ICU_ENTRY_POINT_RENAME(ustr_hashCharsN) +#define ustr_hashICharsN U_ICU_ENTRY_POINT_RENAME(ustr_hashICharsN) +#define ustr_hashUCharsN U_ICU_ENTRY_POINT_RENAME(ustr_hashUCharsN) +#define ustrcase_getCaseLocale U_ICU_ENTRY_POINT_RENAME(ustrcase_getCaseLocale) +#define ustrcase_getTitleBreakIterator U_ICU_ENTRY_POINT_RENAME(ustrcase_getTitleBreakIterator) +#define ustrcase_internalFold U_ICU_ENTRY_POINT_RENAME(ustrcase_internalFold) +#define ustrcase_internalToLower U_ICU_ENTRY_POINT_RENAME(ustrcase_internalToLower) +#define ustrcase_internalToTitle U_ICU_ENTRY_POINT_RENAME(ustrcase_internalToTitle) +#define ustrcase_internalToUpper U_ICU_ENTRY_POINT_RENAME(ustrcase_internalToUpper) +#define ustrcase_map U_ICU_ENTRY_POINT_RENAME(ustrcase_map) +#define ustrcase_mapWithOverlap U_ICU_ENTRY_POINT_RENAME(ustrcase_mapWithOverlap) +#define utext_char32At U_ICU_ENTRY_POINT_RENAME(utext_char32At) +#define utext_clone U_ICU_ENTRY_POINT_RENAME(utext_clone) +#define utext_close U_ICU_ENTRY_POINT_RENAME(utext_close) +#define utext_copy U_ICU_ENTRY_POINT_RENAME(utext_copy) +#define utext_current32 U_ICU_ENTRY_POINT_RENAME(utext_current32) +#define utext_equals U_ICU_ENTRY_POINT_RENAME(utext_equals) +#define utext_extract U_ICU_ENTRY_POINT_RENAME(utext_extract) +#define utext_freeze U_ICU_ENTRY_POINT_RENAME(utext_freeze) +#define utext_getNativeIndex U_ICU_ENTRY_POINT_RENAME(utext_getNativeIndex) +#define utext_getPreviousNativeIndex U_ICU_ENTRY_POINT_RENAME(utext_getPreviousNativeIndex) +#define utext_hasMetaData U_ICU_ENTRY_POINT_RENAME(utext_hasMetaData) +#define utext_isLengthExpensive U_ICU_ENTRY_POINT_RENAME(utext_isLengthExpensive) +#define utext_isWritable U_ICU_ENTRY_POINT_RENAME(utext_isWritable) +#define utext_moveIndex32 U_ICU_ENTRY_POINT_RENAME(utext_moveIndex32) +#define utext_nativeLength U_ICU_ENTRY_POINT_RENAME(utext_nativeLength) +#define utext_next32 U_ICU_ENTRY_POINT_RENAME(utext_next32) +#define utext_next32From U_ICU_ENTRY_POINT_RENAME(utext_next32From) +#define utext_openCharacterIterator U_ICU_ENTRY_POINT_RENAME(utext_openCharacterIterator) +#define utext_openConstUnicodeString U_ICU_ENTRY_POINT_RENAME(utext_openConstUnicodeString) +#define utext_openReplaceable U_ICU_ENTRY_POINT_RENAME(utext_openReplaceable) +#define utext_openUChars U_ICU_ENTRY_POINT_RENAME(utext_openUChars) +#define utext_openUTF8 U_ICU_ENTRY_POINT_RENAME(utext_openUTF8) +#define utext_openUnicodeString U_ICU_ENTRY_POINT_RENAME(utext_openUnicodeString) +#define utext_previous32 U_ICU_ENTRY_POINT_RENAME(utext_previous32) +#define utext_previous32From U_ICU_ENTRY_POINT_RENAME(utext_previous32From) +#define utext_replace U_ICU_ENTRY_POINT_RENAME(utext_replace) +#define utext_setNativeIndex U_ICU_ENTRY_POINT_RENAME(utext_setNativeIndex) +#define utext_setup U_ICU_ENTRY_POINT_RENAME(utext_setup) +#define utf8_appendCharSafeBody U_ICU_ENTRY_POINT_RENAME(utf8_appendCharSafeBody) +#define utf8_back1SafeBody U_ICU_ENTRY_POINT_RENAME(utf8_back1SafeBody) +#define utf8_countTrailBytes U_ICU_ENTRY_POINT_RENAME(utf8_countTrailBytes) +#define utf8_nextCharSafeBody U_ICU_ENTRY_POINT_RENAME(utf8_nextCharSafeBody) +#define utf8_prevCharSafeBody U_ICU_ENTRY_POINT_RENAME(utf8_prevCharSafeBody) +#define utmscale_fromInt64 U_ICU_ENTRY_POINT_RENAME(utmscale_fromInt64) +#define utmscale_getTimeScaleValue U_ICU_ENTRY_POINT_RENAME(utmscale_getTimeScaleValue) +#define utmscale_toInt64 U_ICU_ENTRY_POINT_RENAME(utmscale_toInt64) +#define utrace_cleanup U_ICU_ENTRY_POINT_RENAME(utrace_cleanup) +#define utrace_data U_ICU_ENTRY_POINT_RENAME(utrace_data) +#define utrace_entry U_ICU_ENTRY_POINT_RENAME(utrace_entry) +#define utrace_exit U_ICU_ENTRY_POINT_RENAME(utrace_exit) +#define utrace_format U_ICU_ENTRY_POINT_RENAME(utrace_format) +#define utrace_functionName U_ICU_ENTRY_POINT_RENAME(utrace_functionName) +#define utrace_getFunctions U_ICU_ENTRY_POINT_RENAME(utrace_getFunctions) +#define utrace_getLevel U_ICU_ENTRY_POINT_RENAME(utrace_getLevel) +#define utrace_setFunctions U_ICU_ENTRY_POINT_RENAME(utrace_setFunctions) +#define utrace_setLevel U_ICU_ENTRY_POINT_RENAME(utrace_setLevel) +#define utrace_vformat U_ICU_ENTRY_POINT_RENAME(utrace_vformat) +#define utrans_clone U_ICU_ENTRY_POINT_RENAME(utrans_clone) +#define utrans_close U_ICU_ENTRY_POINT_RENAME(utrans_close) +#define utrans_countAvailableIDs U_ICU_ENTRY_POINT_RENAME(utrans_countAvailableIDs) +#define utrans_getAvailableID U_ICU_ENTRY_POINT_RENAME(utrans_getAvailableID) +#define utrans_getID U_ICU_ENTRY_POINT_RENAME(utrans_getID) +#define utrans_getSourceSet U_ICU_ENTRY_POINT_RENAME(utrans_getSourceSet) +#define utrans_getUnicodeID U_ICU_ENTRY_POINT_RENAME(utrans_getUnicodeID) +#define utrans_open U_ICU_ENTRY_POINT_RENAME(utrans_open) +#define utrans_openIDs U_ICU_ENTRY_POINT_RENAME(utrans_openIDs) +#define utrans_openInverse U_ICU_ENTRY_POINT_RENAME(utrans_openInverse) +#define utrans_openU U_ICU_ENTRY_POINT_RENAME(utrans_openU) +#define utrans_register U_ICU_ENTRY_POINT_RENAME(utrans_register) +#define utrans_rep_caseContextIterator U_ICU_ENTRY_POINT_RENAME(utrans_rep_caseContextIterator) +#define utrans_setFilter U_ICU_ENTRY_POINT_RENAME(utrans_setFilter) +#define utrans_stripRules U_ICU_ENTRY_POINT_RENAME(utrans_stripRules) +#define utrans_toRules U_ICU_ENTRY_POINT_RENAME(utrans_toRules) +#define utrans_trans U_ICU_ENTRY_POINT_RENAME(utrans_trans) +#define utrans_transIncremental U_ICU_ENTRY_POINT_RENAME(utrans_transIncremental) +#define utrans_transIncrementalUChars U_ICU_ENTRY_POINT_RENAME(utrans_transIncrementalUChars) +#define utrans_transUChars U_ICU_ENTRY_POINT_RENAME(utrans_transUChars) +#define utrans_transliterator_cleanup U_ICU_ENTRY_POINT_RENAME(utrans_transliterator_cleanup) +#define utrans_unregister U_ICU_ENTRY_POINT_RENAME(utrans_unregister) +#define utrans_unregisterID U_ICU_ENTRY_POINT_RENAME(utrans_unregisterID) +#define utrie2_clone U_ICU_ENTRY_POINT_RENAME(utrie2_clone) +#define utrie2_cloneAsThawed U_ICU_ENTRY_POINT_RENAME(utrie2_cloneAsThawed) +#define utrie2_close U_ICU_ENTRY_POINT_RENAME(utrie2_close) +#define utrie2_enum U_ICU_ENTRY_POINT_RENAME(utrie2_enum) +#define utrie2_enumForLeadSurrogate U_ICU_ENTRY_POINT_RENAME(utrie2_enumForLeadSurrogate) +#define utrie2_freeze U_ICU_ENTRY_POINT_RENAME(utrie2_freeze) +#define utrie2_fromUTrie U_ICU_ENTRY_POINT_RENAME(utrie2_fromUTrie) +#define utrie2_get32 U_ICU_ENTRY_POINT_RENAME(utrie2_get32) +#define utrie2_get32FromLeadSurrogateCodeUnit U_ICU_ENTRY_POINT_RENAME(utrie2_get32FromLeadSurrogateCodeUnit) +#define utrie2_getVersion U_ICU_ENTRY_POINT_RENAME(utrie2_getVersion) +#define utrie2_internalU8NextIndex U_ICU_ENTRY_POINT_RENAME(utrie2_internalU8NextIndex) +#define utrie2_internalU8PrevIndex U_ICU_ENTRY_POINT_RENAME(utrie2_internalU8PrevIndex) +#define utrie2_isFrozen U_ICU_ENTRY_POINT_RENAME(utrie2_isFrozen) +#define utrie2_open U_ICU_ENTRY_POINT_RENAME(utrie2_open) +#define utrie2_openDummy U_ICU_ENTRY_POINT_RENAME(utrie2_openDummy) +#define utrie2_openFromSerialized U_ICU_ENTRY_POINT_RENAME(utrie2_openFromSerialized) +#define utrie2_serialize U_ICU_ENTRY_POINT_RENAME(utrie2_serialize) +#define utrie2_set32 U_ICU_ENTRY_POINT_RENAME(utrie2_set32) +#define utrie2_set32ForLeadSurrogateCodeUnit U_ICU_ENTRY_POINT_RENAME(utrie2_set32ForLeadSurrogateCodeUnit) +#define utrie2_setRange32 U_ICU_ENTRY_POINT_RENAME(utrie2_setRange32) +#define utrie2_swap U_ICU_ENTRY_POINT_RENAME(utrie2_swap) +#define utrie2_swapAnyVersion U_ICU_ENTRY_POINT_RENAME(utrie2_swapAnyVersion) +#define utrie_clone U_ICU_ENTRY_POINT_RENAME(utrie_clone) +#define utrie_close U_ICU_ENTRY_POINT_RENAME(utrie_close) +#define utrie_defaultGetFoldingOffset U_ICU_ENTRY_POINT_RENAME(utrie_defaultGetFoldingOffset) +#define utrie_enum U_ICU_ENTRY_POINT_RENAME(utrie_enum) +#define utrie_get32 U_ICU_ENTRY_POINT_RENAME(utrie_get32) +#define utrie_getData U_ICU_ENTRY_POINT_RENAME(utrie_getData) +#define utrie_open U_ICU_ENTRY_POINT_RENAME(utrie_open) +#define utrie_serialize U_ICU_ENTRY_POINT_RENAME(utrie_serialize) +#define utrie_set32 U_ICU_ENTRY_POINT_RENAME(utrie_set32) +#define utrie_setRange32 U_ICU_ENTRY_POINT_RENAME(utrie_setRange32) +#define utrie_swap U_ICU_ENTRY_POINT_RENAME(utrie_swap) +#define utrie_unserialize U_ICU_ENTRY_POINT_RENAME(utrie_unserialize) +#define utrie_unserializeDummy U_ICU_ENTRY_POINT_RENAME(utrie_unserializeDummy) +#define vzone_clone U_ICU_ENTRY_POINT_RENAME(vzone_clone) +#define vzone_close U_ICU_ENTRY_POINT_RENAME(vzone_close) +#define vzone_countTransitionRules U_ICU_ENTRY_POINT_RENAME(vzone_countTransitionRules) +#define vzone_equals U_ICU_ENTRY_POINT_RENAME(vzone_equals) +#define vzone_getDynamicClassID U_ICU_ENTRY_POINT_RENAME(vzone_getDynamicClassID) +#define vzone_getLastModified U_ICU_ENTRY_POINT_RENAME(vzone_getLastModified) +#define vzone_getNextTransition U_ICU_ENTRY_POINT_RENAME(vzone_getNextTransition) +#define vzone_getOffset U_ICU_ENTRY_POINT_RENAME(vzone_getOffset) +#define vzone_getOffset2 U_ICU_ENTRY_POINT_RENAME(vzone_getOffset2) +#define vzone_getOffset3 U_ICU_ENTRY_POINT_RENAME(vzone_getOffset3) +#define vzone_getPreviousTransition U_ICU_ENTRY_POINT_RENAME(vzone_getPreviousTransition) +#define vzone_getRawOffset U_ICU_ENTRY_POINT_RENAME(vzone_getRawOffset) +#define vzone_getStaticClassID U_ICU_ENTRY_POINT_RENAME(vzone_getStaticClassID) +#define vzone_getTZURL U_ICU_ENTRY_POINT_RENAME(vzone_getTZURL) +#define vzone_hasSameRules U_ICU_ENTRY_POINT_RENAME(vzone_hasSameRules) +#define vzone_inDaylightTime U_ICU_ENTRY_POINT_RENAME(vzone_inDaylightTime) +#define vzone_openData U_ICU_ENTRY_POINT_RENAME(vzone_openData) +#define vzone_openID U_ICU_ENTRY_POINT_RENAME(vzone_openID) +#define vzone_setLastModified U_ICU_ENTRY_POINT_RENAME(vzone_setLastModified) +#define vzone_setRawOffset U_ICU_ENTRY_POINT_RENAME(vzone_setRawOffset) +#define vzone_setTZURL U_ICU_ENTRY_POINT_RENAME(vzone_setTZURL) +#define vzone_useDaylightTime U_ICU_ENTRY_POINT_RENAME(vzone_useDaylightTime) +#define vzone_write U_ICU_ENTRY_POINT_RENAME(vzone_write) +#define vzone_writeFromStart U_ICU_ENTRY_POINT_RENAME(vzone_writeFromStart) +#define vzone_writeSimple U_ICU_ENTRY_POINT_RENAME(vzone_writeSimple) +#define zrule_close U_ICU_ENTRY_POINT_RENAME(zrule_close) +#define zrule_equals U_ICU_ENTRY_POINT_RENAME(zrule_equals) +#define zrule_getDSTSavings U_ICU_ENTRY_POINT_RENAME(zrule_getDSTSavings) +#define zrule_getName U_ICU_ENTRY_POINT_RENAME(zrule_getName) +#define zrule_getRawOffset U_ICU_ENTRY_POINT_RENAME(zrule_getRawOffset) +#define zrule_isEquivalentTo U_ICU_ENTRY_POINT_RENAME(zrule_isEquivalentTo) +#define ztrans_adoptFrom U_ICU_ENTRY_POINT_RENAME(ztrans_adoptFrom) +#define ztrans_adoptTo U_ICU_ENTRY_POINT_RENAME(ztrans_adoptTo) +#define ztrans_clone U_ICU_ENTRY_POINT_RENAME(ztrans_clone) +#define ztrans_close U_ICU_ENTRY_POINT_RENAME(ztrans_close) +#define ztrans_equals U_ICU_ENTRY_POINT_RENAME(ztrans_equals) +#define ztrans_getDynamicClassID U_ICU_ENTRY_POINT_RENAME(ztrans_getDynamicClassID) +#define ztrans_getFrom U_ICU_ENTRY_POINT_RENAME(ztrans_getFrom) +#define ztrans_getStaticClassID U_ICU_ENTRY_POINT_RENAME(ztrans_getStaticClassID) +#define ztrans_getTime U_ICU_ENTRY_POINT_RENAME(ztrans_getTime) +#define ztrans_getTo U_ICU_ENTRY_POINT_RENAME(ztrans_getTo) +#define ztrans_open U_ICU_ENTRY_POINT_RENAME(ztrans_open) +#define ztrans_openEmpty U_ICU_ENTRY_POINT_RENAME(ztrans_openEmpty) +#define ztrans_setFrom U_ICU_ENTRY_POINT_RENAME(ztrans_setFrom) +#define ztrans_setTime U_ICU_ENTRY_POINT_RENAME(ztrans_setTime) +#define ztrans_setTo U_ICU_ENTRY_POINT_RENAME(ztrans_setTo) + +#endif + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/urep.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/urep.h new file mode 100644 index 0000000..932202d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/urep.h @@ -0,0 +1,157 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* Copyright (C) 1997-2010, International Business Machines +* Corporation and others. All Rights Reserved. +****************************************************************************** +* Date Name Description +* 06/23/00 aliu Creation. +****************************************************************************** +*/ + +#ifndef __UREP_H +#define __UREP_H + +#include "unicode/utypes.h" + +U_CDECL_BEGIN + +/******************************************************************** + * General Notes + ******************************************************************** + * TODO + * Add usage scenario + * Add test code + * Talk about pinning + * Talk about "can truncate result if out of memory" + */ + +/******************************************************************** + * Data Structures + ********************************************************************/ +/** + * \file + * \brief C API: Callbacks for UReplaceable + */ +/** + * An opaque replaceable text object. This will be manipulated only + * through the caller-supplied UReplaceableFunctor struct. Related + * to the C++ class Replaceable. + * This is currently only used in the Transliterator C API, see utrans.h . + * @stable ICU 2.0 + */ +typedef void* UReplaceable; + +/** + * A set of function pointers that transliterators use to manipulate a + * UReplaceable. The caller should supply the required functions to + * manipulate their text appropriately. Related to the C++ class + * Replaceable. + * @stable ICU 2.0 + */ +typedef struct UReplaceableCallbacks { + + /** + * Function pointer that returns the number of UChar code units in + * this text. + * + * @param rep A pointer to "this" UReplaceable object. + * @return The length of the text. + * @stable ICU 2.0 + */ + int32_t (*length)(const UReplaceable* rep); + + /** + * Function pointer that returns a UChar code units at the given + * offset into this text; 0 <= offset < n, where n is the value + * returned by (*length)(rep). See unistr.h for a description of + * charAt() vs. char32At(). + * + * @param rep A pointer to "this" UReplaceable object. + * @param offset The index at which to fetch the UChar (code unit). + * @return The UChar (code unit) at offset, or U+FFFF if the offset is out of bounds. + * @stable ICU 2.0 + */ + UChar (*charAt)(const UReplaceable* rep, + int32_t offset); + + /** + * Function pointer that returns a UChar32 code point at the given + * offset into this text. See unistr.h for a description of + * charAt() vs. char32At(). + * + * @param rep A pointer to "this" UReplaceable object. + * @param offset The index at which to fetch the UChar32 (code point). + * @return The UChar32 (code point) at offset, or U+FFFF if the offset is out of bounds. + * @stable ICU 2.0 + */ + UChar32 (*char32At)(const UReplaceable* rep, + int32_t offset); + + /** + * Function pointer that replaces text between start and limit in + * this text with the given text. Attributes (out of band info) + * should be retained. + * + * @param rep A pointer to "this" UReplaceable object. + * @param start the starting index of the text to be replaced, + * inclusive. + * @param limit the ending index of the text to be replaced, + * exclusive. + * @param text the new text to replace the UChars from + * start..limit-1. + * @param textLength the number of UChars at text, or -1 if text + * is null-terminated. + * @stable ICU 2.0 + */ + void (*replace)(UReplaceable* rep, + int32_t start, + int32_t limit, + const UChar* text, + int32_t textLength); + + /** + * Function pointer that copies the characters in the range + * [start, limit) into the array dst. + * + * @param rep A pointer to "this" UReplaceable object. + * @param start offset of first character which will be copied + * into the array + * @param limit offset immediately following the last character to + * be copied + * @param dst array in which to copy characters. The length of + * dst must be at least (limit - start). + * @stable ICU 2.1 + */ + void (*extract)(UReplaceable* rep, + int32_t start, + int32_t limit, + UChar* dst); + + /** + * Function pointer that copies text between start and limit in + * this text to another index in the text. Attributes (out of + * band info) should be retained. After this call, there will be + * (at least) two copies of the characters originally located at + * start..limit-1. + * + * @param rep A pointer to "this" UReplaceable object. + * @param start the starting index of the text to be copied, + * inclusive. + * @param limit the ending index of the text to be copied, + * exclusive. + * @param dest the index at which the copy of the UChars should be + * inserted. + * @stable ICU 2.0 + */ + void (*copy)(UReplaceable* rep, + int32_t start, + int32_t limit, + int32_t dest); + +} UReplaceableCallbacks; + +U_CDECL_END + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ures.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ures.h new file mode 100644 index 0000000..918b9f2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ures.h @@ -0,0 +1,908 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1997-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* +* File URES.H (formerly CRESBUND.H) +* +* Modification History: +* +* Date Name Description +* 04/01/97 aliu Creation. +* 02/22/99 damiba overhaul. +* 04/04/99 helena Fixed internal header inclusion. +* 04/15/99 Madhu Updated Javadoc +* 06/14/99 stephen Removed functions taking a filename suffix. +* 07/20/99 stephen Language-independent ypedef to void* +* 11/09/99 weiv Added ures_getLocale() +* 06/24/02 weiv Added support for resource sharing +****************************************************************************** +*/ + +#ifndef URES_H +#define URES_H + +#include "unicode/utypes.h" +#include "unicode/uloc.h" +#include "unicode/localpointer.h" + +/** + * \file + * \brief C API: Resource Bundle + * + *

C API: Resource Bundle

+ * + * C API representing a collection of resource information pertaining to a given + * locale. A resource bundle provides a way of accessing locale- specific information in + * a data file. You create a resource bundle that manages the resources for a given + * locale and then ask it for individual resources. + *

+ * Resource bundles in ICU4C are currently defined using text files which conform to the following + * BNF definition. + * More on resource bundle concepts and syntax can be found in the + * Users Guide. + *

+ */ + +/** + * UResourceBundle is an opaque type for handles for resource bundles in C APIs. + * @stable ICU 2.0 + */ +struct UResourceBundle; + +/** + * @stable ICU 2.0 + */ +typedef struct UResourceBundle UResourceBundle; + +/** + * Numeric constants for types of resource items. + * @see ures_getType + * @stable ICU 2.0 + */ +typedef enum { + /** Resource type constant for "no resource". @stable ICU 2.6 */ + URES_NONE=-1, + + /** Resource type constant for 16-bit Unicode strings. @stable ICU 2.6 */ + URES_STRING=0, + + /** Resource type constant for binary data. @stable ICU 2.6 */ + URES_BINARY=1, + + /** Resource type constant for tables of key-value pairs. @stable ICU 2.6 */ + URES_TABLE=2, + + /** + * Resource type constant for aliases; + * internally stores a string which identifies the actual resource + * storing the data (can be in a different resource bundle). + * Resolved internally before delivering the actual resource through the API. + * @stable ICU 2.6 + */ + URES_ALIAS=3, + + /** + * Resource type constant for a single 28-bit integer, interpreted as + * signed or unsigned by the ures_getInt() or ures_getUInt() function. + * @see ures_getInt + * @see ures_getUInt + * @stable ICU 2.6 + */ + URES_INT=7, + + /** Resource type constant for arrays of resources. @stable ICU 2.6 */ + URES_ARRAY=8, + + /** + * Resource type constant for vectors of 32-bit integers. + * @see ures_getIntVector + * @stable ICU 2.6 + */ + URES_INT_VECTOR = 14, +#ifndef U_HIDE_DEPRECATED_API + /** @deprecated ICU 2.6 Use the URES_ constant instead. */ + RES_NONE=URES_NONE, + /** @deprecated ICU 2.6 Use the URES_ constant instead. */ + RES_STRING=URES_STRING, + /** @deprecated ICU 2.6 Use the URES_ constant instead. */ + RES_BINARY=URES_BINARY, + /** @deprecated ICU 2.6 Use the URES_ constant instead. */ + RES_TABLE=URES_TABLE, + /** @deprecated ICU 2.6 Use the URES_ constant instead. */ + RES_ALIAS=URES_ALIAS, + /** @deprecated ICU 2.6 Use the URES_ constant instead. */ + RES_INT=URES_INT, + /** @deprecated ICU 2.6 Use the URES_ constant instead. */ + RES_ARRAY=URES_ARRAY, + /** @deprecated ICU 2.6 Use the URES_ constant instead. */ + RES_INT_VECTOR=URES_INT_VECTOR, + /** @deprecated ICU 2.6 Not used. */ + RES_RESERVED=15, + + /** + * One more than the highest normal UResType value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + URES_LIMIT = 16 +#endif // U_HIDE_DEPRECATED_API +} UResType; + +/* + * Functions to create and destroy resource bundles. + */ + +/** + * Opens a UResourceBundle, from which users can extract strings by using + * their corresponding keys. + * Note that the caller is responsible of calling ures_close on each succesfully + * opened resource bundle. + * @param packageName The packageName and locale together point to an ICU udata object, + * as defined by udata_open( packageName, "res", locale, err) + * or equivalent. Typically, packageName will refer to a (.dat) file, or to + * a package registered with udata_setAppData(). Using a full file or directory + * pathname for packageName is deprecated. If NULL, ICU data will be used. + * @param locale specifies the locale for which we want to open the resource + * if NULL, the default locale will be used. If strlen(locale) == 0 + * root locale will be used. + * + * @param status fills in the outgoing error code. + * The UErrorCode err parameter is used to return status information to the user. To + * check whether the construction succeeded or not, you should check the value of + * U_SUCCESS(err). If you wish more detailed information, you can check for + * informational status results which still indicate success. U_USING_FALLBACK_WARNING + * indicates that a fall back locale was used. For example, 'de_CH' was requested, + * but nothing was found there, so 'de' was used. U_USING_DEFAULT_WARNING indicates that + * the default locale data or root locale data was used; neither the requested locale + * nor any of its fall back locales could be found. Please see the users guide for more + * information on this topic. + * @return a newly allocated resource bundle. + * @see ures_close + * @stable ICU 2.0 + */ +U_STABLE UResourceBundle* U_EXPORT2 +ures_open(const char* packageName, + const char* locale, + UErrorCode* status); + + +/** This function does not care what kind of localeID is passed in. It simply opens a bundle with + * that name. Fallback mechanism is disabled for the new bundle. If the requested bundle contains + * an %%ALIAS directive, the results are undefined. + * @param packageName The packageName and locale together point to an ICU udata object, + * as defined by udata_open( packageName, "res", locale, err) + * or equivalent. Typically, packageName will refer to a (.dat) file, or to + * a package registered with udata_setAppData(). Using a full file or directory + * pathname for packageName is deprecated. If NULL, ICU data will be used. + * @param locale specifies the locale for which we want to open the resource + * if NULL, the default locale will be used. If strlen(locale) == 0 + * root locale will be used. + * + * @param status fills in the outgoing error code. Either U_ZERO_ERROR or U_MISSING_RESOURCE_ERROR + * @return a newly allocated resource bundle or NULL if it doesn't exist. + * @see ures_close + * @stable ICU 2.0 + */ +U_STABLE UResourceBundle* U_EXPORT2 +ures_openDirect(const char* packageName, + const char* locale, + UErrorCode* status); + +/** + * Same as ures_open() but takes a const UChar *path. + * This path will be converted to char * using the default converter, + * then ures_open() is called. + * + * @param packageName The packageName and locale together point to an ICU udata object, + * as defined by udata_open( packageName, "res", locale, err) + * or equivalent. Typically, packageName will refer to a (.dat) file, or to + * a package registered with udata_setAppData(). Using a full file or directory + * pathname for packageName is deprecated. If NULL, ICU data will be used. + * @param locale specifies the locale for which we want to open the resource + * if NULL, the default locale will be used. If strlen(locale) == 0 + * root locale will be used. + * @param status fills in the outgoing error code. + * @return a newly allocated resource bundle. + * @see ures_open + * @stable ICU 2.0 + */ +U_STABLE UResourceBundle* U_EXPORT2 +ures_openU(const UChar* packageName, + const char* locale, + UErrorCode* status); + +#ifndef U_HIDE_DEPRECATED_API +/** + * Returns the number of strings/arrays in resource bundles. + * Better to use ures_getSize, as this function will be deprecated. + * + *@param resourceBundle resource bundle containing the desired strings + *@param resourceKey key tagging the resource + *@param err fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * could be a non-failing error + * e.g.: U_USING_FALLBACK_WARNING,U_USING_FALLBACK_WARNING + *@return: for Arrays: returns the number of resources in the array + * Tables: returns the number of resources in the table + * single string: returns 1 + *@see ures_getSize + * @deprecated ICU 2.8 User ures_getSize instead + */ +U_DEPRECATED int32_t U_EXPORT2 +ures_countArrayItems(const UResourceBundle* resourceBundle, + const char* resourceKey, + UErrorCode* err); +#endif /* U_HIDE_DEPRECATED_API */ + +/** + * Close a resource bundle, all pointers returned from the various ures_getXXX calls + * on this particular bundle should be considered invalid henceforth. + * + * @param resourceBundle a pointer to a resourceBundle struct. Can be NULL. + * @see ures_open + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ures_close(UResourceBundle* resourceBundle); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUResourceBundlePointer + * "Smart pointer" class, closes a UResourceBundle via ures_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUResourceBundlePointer, UResourceBundle, ures_close); + +U_NAMESPACE_END + +#endif + +#ifndef U_HIDE_DEPRECATED_API +/** + * Return the version number associated with this ResourceBundle as a string. Please + * use ures_getVersion as this function is going to be deprecated. + * + * @param resourceBundle The resource bundle for which the version is checked. + * @return A version number string as specified in the resource bundle or its parent. + * The caller does not own this string. + * @see ures_getVersion + * @deprecated ICU 2.8 Use ures_getVersion instead. + */ +U_DEPRECATED const char* U_EXPORT2 +ures_getVersionNumber(const UResourceBundle* resourceBundle); +#endif /* U_HIDE_DEPRECATED_API */ + +/** + * Return the version number associated with this ResourceBundle as an + * UVersionInfo array. + * + * @param resB The resource bundle for which the version is checked. + * @param versionInfo A UVersionInfo array that is filled with the version number + * as specified in the resource bundle or its parent. + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ures_getVersion(const UResourceBundle* resB, + UVersionInfo versionInfo); + +#ifndef U_HIDE_DEPRECATED_API +/** + * Return the name of the Locale associated with this ResourceBundle. This API allows + * you to query for the real locale of the resource. For example, if you requested + * "en_US_CALIFORNIA" and only "en_US" bundle exists, "en_US" will be returned. + * For subresources, the locale where this resource comes from will be returned. + * If fallback has occured, getLocale will reflect this. + * + * @param resourceBundle resource bundle in question + * @param status just for catching illegal arguments + * @return A Locale name + * @deprecated ICU 2.8 Use ures_getLocaleByType instead. + */ +U_DEPRECATED const char* U_EXPORT2 +ures_getLocale(const UResourceBundle* resourceBundle, + UErrorCode* status); +#endif /* U_HIDE_DEPRECATED_API */ + +/** + * Return the name of the Locale associated with this ResourceBundle. + * You can choose between requested, valid and real locale. + * + * @param resourceBundle resource bundle in question + * @param type You can choose between requested, valid and actual + * locale. For description see the definition of + * ULocDataLocaleType in uloc.h + * @param status just for catching illegal arguments + * @return A Locale name + * @stable ICU 2.8 + */ +U_STABLE const char* U_EXPORT2 +ures_getLocaleByType(const UResourceBundle* resourceBundle, + ULocDataLocaleType type, + UErrorCode* status); + + +#ifndef U_HIDE_INTERNAL_API +/** + * Same as ures_open() but uses the fill-in parameter instead of allocating + * a bundle, if r!=NULL. + * TODO need to revisit usefulness of this function + * and usage model for fillIn parameters without knowing sizeof(UResourceBundle) + * @param r The resourcebundle to open + * @param packageName The packageName and locale together point to an ICU udata object, + * as defined by udata_open( packageName, "res", locale, err) + * or equivalent. Typically, packageName will refer to a (.dat) file, or to + * a package registered with udata_setAppData(). Using a full file or directory + * pathname for packageName is deprecated. If NULL, ICU data will be used. + * @param localeID specifies the locale for which we want to open the resource + * @param status The error code + * @return a newly allocated resource bundle or NULL if it doesn't exist. + * @internal + */ +U_INTERNAL void U_EXPORT2 +ures_openFillIn(UResourceBundle *r, + const char* packageName, + const char* localeID, + UErrorCode* status); +#endif /* U_HIDE_INTERNAL_API */ + +/** + * Returns a string from a string resource type + * + * @param resourceBundle a string resource + * @param len fills in the length of resulting string + * @param status fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * Always check the value of status. Don't count on returning NULL. + * could be a non-failing error + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. + * @see ures_getBinary + * @see ures_getIntVector + * @see ures_getInt + * @see ures_getUInt + * @stable ICU 2.0 + */ +U_STABLE const UChar* U_EXPORT2 +ures_getString(const UResourceBundle* resourceBundle, + int32_t* len, + UErrorCode* status); + +/** + * Returns a UTF-8 string from a string resource. + * The UTF-8 string may be returnable directly as a pointer, or + * it may need to be copied, or transformed from UTF-16 using u_strToUTF8() + * or equivalent. + * + * If forceCopy==TRUE, then the string is always written to the dest buffer + * and dest is returned. + * + * If forceCopy==FALSE, then the string is returned as a pointer if possible, + * without needing a dest buffer (it can be NULL). If the string needs to be + * copied or transformed, then it may be placed into dest at an arbitrary offset. + * + * If the string is to be written to dest, then U_BUFFER_OVERFLOW_ERROR and + * U_STRING_NOT_TERMINATED_WARNING are set if appropriate, as usual. + * + * If the string is transformed from UTF-16, then a conversion error may occur + * if an unpaired surrogate is encountered. If the function is successful, then + * the output UTF-8 string is always well-formed. + * + * @param resB Resource bundle. + * @param dest Destination buffer. Can be NULL only if capacity=*length==0. + * @param length Input: Capacity of destination buffer. + * Output: Actual length of the UTF-8 string, not counting the + * terminating NUL, even in case of U_BUFFER_OVERFLOW_ERROR. + * Can be NULL, meaning capacity=0 and the string length is not + * returned to the caller. + * @param forceCopy If TRUE, then the output string will always be written to + * dest, with U_BUFFER_OVERFLOW_ERROR and + * U_STRING_NOT_TERMINATED_WARNING set if appropriate. + * If FALSE, then the dest buffer may or may not contain a + * copy of the string. dest may or may not be modified. + * If a copy needs to be written, then the UErrorCode parameter + * indicates overflow etc. as usual. + * @param status Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The pointer to the UTF-8 string. It may be dest, or at some offset + * from dest (only if !forceCopy), or in unrelated memory. + * Always NUL-terminated unless the string was written to dest and + * length==capacity (in which case U_STRING_NOT_TERMINATED_WARNING is set). + * + * @see ures_getString + * @see u_strToUTF8 + * @stable ICU 3.6 + */ +U_STABLE const char * U_EXPORT2 +ures_getUTF8String(const UResourceBundle *resB, + char *dest, int32_t *length, + UBool forceCopy, + UErrorCode *status); + +/** + * Returns a binary data from a binary resource. + * + * @param resourceBundle a string resource + * @param len fills in the length of resulting byte chunk + * @param status fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * Always check the value of status. Don't count on returning NULL. + * could be a non-failing error + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return a pointer to a chunk of unsigned bytes which live in a memory mapped/DLL file. + * @see ures_getString + * @see ures_getIntVector + * @see ures_getInt + * @see ures_getUInt + * @stable ICU 2.0 + */ +U_STABLE const uint8_t* U_EXPORT2 +ures_getBinary(const UResourceBundle* resourceBundle, + int32_t* len, + UErrorCode* status); + +/** + * Returns a 32 bit integer array from a resource. + * + * @param resourceBundle an int vector resource + * @param len fills in the length of resulting byte chunk + * @param status fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * Always check the value of status. Don't count on returning NULL. + * could be a non-failing error + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return a pointer to a chunk of integers which live in a memory mapped/DLL file. + * @see ures_getBinary + * @see ures_getString + * @see ures_getInt + * @see ures_getUInt + * @stable ICU 2.0 + */ +U_STABLE const int32_t* U_EXPORT2 +ures_getIntVector(const UResourceBundle* resourceBundle, + int32_t* len, + UErrorCode* status); + +/** + * Returns an unsigned integer from a resource. + * This integer is originally 28 bits. + * + * @param resourceBundle a string resource + * @param status fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * could be a non-failing error + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return an integer value + * @see ures_getInt + * @see ures_getIntVector + * @see ures_getBinary + * @see ures_getString + * @stable ICU 2.0 + */ +U_STABLE uint32_t U_EXPORT2 +ures_getUInt(const UResourceBundle* resourceBundle, + UErrorCode *status); + +/** + * Returns a signed integer from a resource. + * This integer is originally 28 bit and the sign gets propagated. + * + * @param resourceBundle a string resource + * @param status fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * could be a non-failing error + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return an integer value + * @see ures_getUInt + * @see ures_getIntVector + * @see ures_getBinary + * @see ures_getString + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ures_getInt(const UResourceBundle* resourceBundle, + UErrorCode *status); + +/** + * Returns the size of a resource. Size for scalar types is always 1, + * and for vector/table types is the number of child resources. + * @warning Integer array is treated as a scalar type. There are no + * APIs to access individual members of an integer array. It + * is always returned as a whole. + * @param resourceBundle a resource + * @return number of resources in a given resource. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +ures_getSize(const UResourceBundle *resourceBundle); + +/** + * Returns the type of a resource. Available types are defined in enum UResType + * + * @param resourceBundle a resource + * @return type of the given resource. + * @see UResType + * @stable ICU 2.0 + */ +U_STABLE UResType U_EXPORT2 +ures_getType(const UResourceBundle *resourceBundle); + +/** + * Returns the key associated with a given resource. Not all the resources have a key - only + * those that are members of a table. + * + * @param resourceBundle a resource + * @return a key associated to this resource, or NULL if it doesn't have a key + * @stable ICU 2.0 + */ +U_STABLE const char * U_EXPORT2 +ures_getKey(const UResourceBundle *resourceBundle); + +/* ITERATION API + This API provides means for iterating through a resource +*/ + +/** + * Resets the internal context of a resource so that iteration starts from the first element. + * + * @param resourceBundle a resource + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +ures_resetIterator(UResourceBundle *resourceBundle); + +/** + * Checks whether the given resource has another element to iterate over. + * + * @param resourceBundle a resource + * @return TRUE if there are more elements, FALSE if there is no more elements + * @stable ICU 2.0 + */ +U_STABLE UBool U_EXPORT2 +ures_hasNext(const UResourceBundle *resourceBundle); + +/** + * Returns the next resource in a given resource or NULL if there are no more resources + * to iterate over. Features a fill-in parameter. + * + * @param resourceBundle a resource + * @param fillIn if NULL a new UResourceBundle struct is allocated and must be closed by the caller. + * Alternatively, you can supply a struct to be filled by this function. + * @param status fills in the outgoing error code. You may still get a non NULL result even if an + * error occured. Check status instead. + * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it + * @stable ICU 2.0 + */ +U_STABLE UResourceBundle* U_EXPORT2 +ures_getNextResource(UResourceBundle *resourceBundle, + UResourceBundle *fillIn, + UErrorCode *status); + +/** + * Returns the next string in a given resource or NULL if there are no more resources + * to iterate over. + * + * @param resourceBundle a resource + * @param len fill in length of the string + * @param key fill in for key associated with this string. NULL if no key + * @param status fills in the outgoing error code. If an error occured, we may return NULL, but don't + * count on it. Check status instead! + * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. + * @stable ICU 2.0 + */ +U_STABLE const UChar* U_EXPORT2 +ures_getNextString(UResourceBundle *resourceBundle, + int32_t* len, + const char ** key, + UErrorCode *status); + +/** + * Returns the resource in a given resource at the specified index. Features a fill-in parameter. + * + * @param resourceBundle the resource bundle from which to get a sub-resource + * @param indexR an index to the wanted resource. + * @param fillIn if NULL a new UResourceBundle struct is allocated and must be closed by the caller. + * Alternatively, you can supply a struct to be filled by this function. + * @param status fills in the outgoing error code. Don't count on NULL being returned if an error has + * occured. Check status instead. + * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it + * @stable ICU 2.0 + */ +U_STABLE UResourceBundle* U_EXPORT2 +ures_getByIndex(const UResourceBundle *resourceBundle, + int32_t indexR, + UResourceBundle *fillIn, + UErrorCode *status); + +/** + * Returns the string in a given resource at the specified index. + * + * @param resourceBundle a resource + * @param indexS an index to the wanted string. + * @param len fill in length of the string + * @param status fills in the outgoing error code. If an error occured, we may return NULL, but don't + * count on it. Check status instead! + * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. + * @stable ICU 2.0 + */ +U_STABLE const UChar* U_EXPORT2 +ures_getStringByIndex(const UResourceBundle *resourceBundle, + int32_t indexS, + int32_t* len, + UErrorCode *status); + +/** + * Returns a UTF-8 string from a resource at the specified index. + * The UTF-8 string may be returnable directly as a pointer, or + * it may need to be copied, or transformed from UTF-16 using u_strToUTF8() + * or equivalent. + * + * If forceCopy==TRUE, then the string is always written to the dest buffer + * and dest is returned. + * + * If forceCopy==FALSE, then the string is returned as a pointer if possible, + * without needing a dest buffer (it can be NULL). If the string needs to be + * copied or transformed, then it may be placed into dest at an arbitrary offset. + * + * If the string is to be written to dest, then U_BUFFER_OVERFLOW_ERROR and + * U_STRING_NOT_TERMINATED_WARNING are set if appropriate, as usual. + * + * If the string is transformed from UTF-16, then a conversion error may occur + * if an unpaired surrogate is encountered. If the function is successful, then + * the output UTF-8 string is always well-formed. + * + * @param resB Resource bundle. + * @param stringIndex An index to the wanted string. + * @param dest Destination buffer. Can be NULL only if capacity=*length==0. + * @param pLength Input: Capacity of destination buffer. + * Output: Actual length of the UTF-8 string, not counting the + * terminating NUL, even in case of U_BUFFER_OVERFLOW_ERROR. + * Can be NULL, meaning capacity=0 and the string length is not + * returned to the caller. + * @param forceCopy If TRUE, then the output string will always be written to + * dest, with U_BUFFER_OVERFLOW_ERROR and + * U_STRING_NOT_TERMINATED_WARNING set if appropriate. + * If FALSE, then the dest buffer may or may not contain a + * copy of the string. dest may or may not be modified. + * If a copy needs to be written, then the UErrorCode parameter + * indicates overflow etc. as usual. + * @param status Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The pointer to the UTF-8 string. It may be dest, or at some offset + * from dest (only if !forceCopy), or in unrelated memory. + * Always NUL-terminated unless the string was written to dest and + * length==capacity (in which case U_STRING_NOT_TERMINATED_WARNING is set). + * + * @see ures_getStringByIndex + * @see u_strToUTF8 + * @stable ICU 3.6 + */ +U_STABLE const char * U_EXPORT2 +ures_getUTF8StringByIndex(const UResourceBundle *resB, + int32_t stringIndex, + char *dest, int32_t *pLength, + UBool forceCopy, + UErrorCode *status); + +/** + * Returns a resource in a given resource that has a given key. This procedure works only with table + * resources. Features a fill-in parameter. + * + * @param resourceBundle a resource + * @param key a key associated with the wanted resource + * @param fillIn if NULL a new UResourceBundle struct is allocated and must be closed by the caller. + * Alternatively, you can supply a struct to be filled by this function. + * @param status fills in the outgoing error code. + * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it + * @stable ICU 2.0 + */ +U_STABLE UResourceBundle* U_EXPORT2 +ures_getByKey(const UResourceBundle *resourceBundle, + const char* key, + UResourceBundle *fillIn, + UErrorCode *status); + +/** + * Returns a string in a given resource that has a given key. This procedure works only with table + * resources. + * + * @param resB a resource + * @param key a key associated with the wanted string + * @param len fill in length of the string + * @param status fills in the outgoing error code. If an error occured, we may return NULL, but don't + * count on it. Check status instead! + * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. + * @stable ICU 2.0 + */ +U_STABLE const UChar* U_EXPORT2 +ures_getStringByKey(const UResourceBundle *resB, + const char* key, + int32_t* len, + UErrorCode *status); + +/** + * Returns a UTF-8 string from a resource and a key. + * This function works only with table resources. + * + * The UTF-8 string may be returnable directly as a pointer, or + * it may need to be copied, or transformed from UTF-16 using u_strToUTF8() + * or equivalent. + * + * If forceCopy==TRUE, then the string is always written to the dest buffer + * and dest is returned. + * + * If forceCopy==FALSE, then the string is returned as a pointer if possible, + * without needing a dest buffer (it can be NULL). If the string needs to be + * copied or transformed, then it may be placed into dest at an arbitrary offset. + * + * If the string is to be written to dest, then U_BUFFER_OVERFLOW_ERROR and + * U_STRING_NOT_TERMINATED_WARNING are set if appropriate, as usual. + * + * If the string is transformed from UTF-16, then a conversion error may occur + * if an unpaired surrogate is encountered. If the function is successful, then + * the output UTF-8 string is always well-formed. + * + * @param resB Resource bundle. + * @param key A key associated with the wanted resource + * @param dest Destination buffer. Can be NULL only if capacity=*length==0. + * @param pLength Input: Capacity of destination buffer. + * Output: Actual length of the UTF-8 string, not counting the + * terminating NUL, even in case of U_BUFFER_OVERFLOW_ERROR. + * Can be NULL, meaning capacity=0 and the string length is not + * returned to the caller. + * @param forceCopy If TRUE, then the output string will always be written to + * dest, with U_BUFFER_OVERFLOW_ERROR and + * U_STRING_NOT_TERMINATED_WARNING set if appropriate. + * If FALSE, then the dest buffer may or may not contain a + * copy of the string. dest may or may not be modified. + * If a copy needs to be written, then the UErrorCode parameter + * indicates overflow etc. as usual. + * @param status Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The pointer to the UTF-8 string. It may be dest, or at some offset + * from dest (only if !forceCopy), or in unrelated memory. + * Always NUL-terminated unless the string was written to dest and + * length==capacity (in which case U_STRING_NOT_TERMINATED_WARNING is set). + * + * @see ures_getStringByKey + * @see u_strToUTF8 + * @stable ICU 3.6 + */ +U_STABLE const char * U_EXPORT2 +ures_getUTF8StringByKey(const UResourceBundle *resB, + const char *key, + char *dest, int32_t *pLength, + UBool forceCopy, + UErrorCode *status); + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/unistr.h" + +U_NAMESPACE_BEGIN +/** + * Returns the string value from a string resource bundle. + * + * @param resB a resource, should have type URES_STRING + * @param status: fills in the outgoing error code + * could be U_MISSING_RESOURCE_ERROR if the key is not found + * could be a non-failing error + * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING + * @return The string value, or a bogus string if there is a failure UErrorCode. + * @stable ICU 2.0 + */ +inline UnicodeString +ures_getUnicodeString(const UResourceBundle *resB, UErrorCode* status) { + UnicodeString result; + int32_t len = 0; + const UChar *r = ures_getString(resB, &len, status); + if(U_SUCCESS(*status)) { + result.setTo(TRUE, r, len); + } else { + result.setToBogus(); + } + return result; +} + +/** + * Returns the next string in a resource, or an empty string if there are no more resources + * to iterate over. + * Use ures_getNextString() instead to distinguish between + * the end of the iteration and a real empty string value. + * + * @param resB a resource + * @param key fill in for key associated with this string + * @param status fills in the outgoing error code + * @return The string value, or a bogus string if there is a failure UErrorCode. + * @stable ICU 2.0 + */ +inline UnicodeString +ures_getNextUnicodeString(UResourceBundle *resB, const char ** key, UErrorCode* status) { + UnicodeString result; + int32_t len = 0; + const UChar* r = ures_getNextString(resB, &len, key, status); + if(U_SUCCESS(*status)) { + result.setTo(TRUE, r, len); + } else { + result.setToBogus(); + } + return result; +} + +/** + * Returns the string in a given resource array or table at the specified index. + * + * @param resB a resource + * @param indexS an index to the wanted string. + * @param status fills in the outgoing error code + * @return The string value, or a bogus string if there is a failure UErrorCode. + * @stable ICU 2.0 + */ +inline UnicodeString +ures_getUnicodeStringByIndex(const UResourceBundle *resB, int32_t indexS, UErrorCode* status) { + UnicodeString result; + int32_t len = 0; + const UChar* r = ures_getStringByIndex(resB, indexS, &len, status); + if(U_SUCCESS(*status)) { + result.setTo(TRUE, r, len); + } else { + result.setToBogus(); + } + return result; +} + +/** + * Returns a string in a resource that has a given key. + * This procedure works only with table resources. + * + * @param resB a resource + * @param key a key associated with the wanted string + * @param status fills in the outgoing error code + * @return The string value, or a bogus string if there is a failure UErrorCode. + * @stable ICU 2.0 + */ +inline UnicodeString +ures_getUnicodeStringByKey(const UResourceBundle *resB, const char* key, UErrorCode* status) { + UnicodeString result; + int32_t len = 0; + const UChar* r = ures_getStringByKey(resB, key, &len, status); + if(U_SUCCESS(*status)) { + result.setTo(TRUE, r, len); + } else { + result.setToBogus(); + } + return result; +} + +U_NAMESPACE_END + +#endif + +/** + * Create a string enumerator, owned by the caller, of all locales located within + * the specified resource tree. + * @param packageName name of the tree, such as (NULL) or U_ICUDATA_ALIAS or or "ICUDATA-coll" + * This call is similar to uloc_getAvailable(). + * @param status error code + * @stable ICU 3.2 + */ +U_STABLE UEnumeration* U_EXPORT2 +ures_openAvailableLocales(const char *packageName, UErrorCode *status); + + +#endif /*_URES*/ +/*eof*/ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/uscript.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/uscript.h new file mode 100644 index 0000000..3ec235d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/uscript.h @@ -0,0 +1,675 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ********************************************************************** + * Copyright (C) 1997-2016, International Business Machines + * Corporation and others. All Rights Reserved. + ********************************************************************** + * + * File USCRIPT.H + * + * Modification History: + * + * Date Name Description + * 07/06/2001 Ram Creation. + ****************************************************************************** + */ + +#ifndef USCRIPT_H +#define USCRIPT_H +#include "unicode/utypes.h" + +/** + * \file + * \brief C API: Unicode Script Information + */ + +/** + * Constants for ISO 15924 script codes. + * + * The current set of script code constants supports at least all scripts + * that are encoded in the version of Unicode which ICU currently supports. + * The names of the constants are usually derived from the + * Unicode script property value aliases. + * See UAX #24 Unicode Script Property (http://www.unicode.org/reports/tr24/) + * and http://www.unicode.org/Public/UCD/latest/ucd/PropertyValueAliases.txt . + * + * In addition, constants for many ISO 15924 script codes + * are included, for use with language tags, CLDR data, and similar. + * Some of those codes are not used in the Unicode Character Database (UCD). + * For example, there are no characters that have a UCD script property value of + * Hans or Hant. All Han ideographs have the Hani script property value in Unicode. + * + * Private-use codes Qaaa..Qabx are not included, except as used in the UCD or in CLDR. + * + * Starting with ICU 55, script codes are only added when their scripts + * have been or will certainly be encoded in Unicode, + * and have been assigned Unicode script property value aliases, + * to ensure that their script names are stable and match the names of the constants. + * Script codes like Latf and Aran that are not subject to separate encoding + * may be added at any time. + * + * @stable ICU 2.2 + */ +typedef enum UScriptCode { + /* + * Note: UScriptCode constants and their ISO script code comments + * are parsed by preparseucd.py. + * It matches lines like + * USCRIPT_ = , / * * / + */ + + /** @stable ICU 2.2 */ + USCRIPT_INVALID_CODE = -1, + /** @stable ICU 2.2 */ + USCRIPT_COMMON = 0, /* Zyyy */ + /** @stable ICU 2.2 */ + USCRIPT_INHERITED = 1, /* Zinh */ /* "Code for inherited script", for non-spacing combining marks; also Qaai */ + /** @stable ICU 2.2 */ + USCRIPT_ARABIC = 2, /* Arab */ + /** @stable ICU 2.2 */ + USCRIPT_ARMENIAN = 3, /* Armn */ + /** @stable ICU 2.2 */ + USCRIPT_BENGALI = 4, /* Beng */ + /** @stable ICU 2.2 */ + USCRIPT_BOPOMOFO = 5, /* Bopo */ + /** @stable ICU 2.2 */ + USCRIPT_CHEROKEE = 6, /* Cher */ + /** @stable ICU 2.2 */ + USCRIPT_COPTIC = 7, /* Copt */ + /** @stable ICU 2.2 */ + USCRIPT_CYRILLIC = 8, /* Cyrl */ + /** @stable ICU 2.2 */ + USCRIPT_DESERET = 9, /* Dsrt */ + /** @stable ICU 2.2 */ + USCRIPT_DEVANAGARI = 10, /* Deva */ + /** @stable ICU 2.2 */ + USCRIPT_ETHIOPIC = 11, /* Ethi */ + /** @stable ICU 2.2 */ + USCRIPT_GEORGIAN = 12, /* Geor */ + /** @stable ICU 2.2 */ + USCRIPT_GOTHIC = 13, /* Goth */ + /** @stable ICU 2.2 */ + USCRIPT_GREEK = 14, /* Grek */ + /** @stable ICU 2.2 */ + USCRIPT_GUJARATI = 15, /* Gujr */ + /** @stable ICU 2.2 */ + USCRIPT_GURMUKHI = 16, /* Guru */ + /** @stable ICU 2.2 */ + USCRIPT_HAN = 17, /* Hani */ + /** @stable ICU 2.2 */ + USCRIPT_HANGUL = 18, /* Hang */ + /** @stable ICU 2.2 */ + USCRIPT_HEBREW = 19, /* Hebr */ + /** @stable ICU 2.2 */ + USCRIPT_HIRAGANA = 20, /* Hira */ + /** @stable ICU 2.2 */ + USCRIPT_KANNADA = 21, /* Knda */ + /** @stable ICU 2.2 */ + USCRIPT_KATAKANA = 22, /* Kana */ + /** @stable ICU 2.2 */ + USCRIPT_KHMER = 23, /* Khmr */ + /** @stable ICU 2.2 */ + USCRIPT_LAO = 24, /* Laoo */ + /** @stable ICU 2.2 */ + USCRIPT_LATIN = 25, /* Latn */ + /** @stable ICU 2.2 */ + USCRIPT_MALAYALAM = 26, /* Mlym */ + /** @stable ICU 2.2 */ + USCRIPT_MONGOLIAN = 27, /* Mong */ + /** @stable ICU 2.2 */ + USCRIPT_MYANMAR = 28, /* Mymr */ + /** @stable ICU 2.2 */ + USCRIPT_OGHAM = 29, /* Ogam */ + /** @stable ICU 2.2 */ + USCRIPT_OLD_ITALIC = 30, /* Ital */ + /** @stable ICU 2.2 */ + USCRIPT_ORIYA = 31, /* Orya */ + /** @stable ICU 2.2 */ + USCRIPT_RUNIC = 32, /* Runr */ + /** @stable ICU 2.2 */ + USCRIPT_SINHALA = 33, /* Sinh */ + /** @stable ICU 2.2 */ + USCRIPT_SYRIAC = 34, /* Syrc */ + /** @stable ICU 2.2 */ + USCRIPT_TAMIL = 35, /* Taml */ + /** @stable ICU 2.2 */ + USCRIPT_TELUGU = 36, /* Telu */ + /** @stable ICU 2.2 */ + USCRIPT_THAANA = 37, /* Thaa */ + /** @stable ICU 2.2 */ + USCRIPT_THAI = 38, /* Thai */ + /** @stable ICU 2.2 */ + USCRIPT_TIBETAN = 39, /* Tibt */ + /** Canadian_Aboriginal script. @stable ICU 2.6 */ + USCRIPT_CANADIAN_ABORIGINAL = 40, /* Cans */ + /** Canadian_Aboriginal script (alias). @stable ICU 2.2 */ + USCRIPT_UCAS = USCRIPT_CANADIAN_ABORIGINAL, + /** @stable ICU 2.2 */ + USCRIPT_YI = 41, /* Yiii */ + /* New scripts in Unicode 3.2 */ + /** @stable ICU 2.2 */ + USCRIPT_TAGALOG = 42, /* Tglg */ + /** @stable ICU 2.2 */ + USCRIPT_HANUNOO = 43, /* Hano */ + /** @stable ICU 2.2 */ + USCRIPT_BUHID = 44, /* Buhd */ + /** @stable ICU 2.2 */ + USCRIPT_TAGBANWA = 45, /* Tagb */ + + /* New scripts in Unicode 4 */ + /** @stable ICU 2.6 */ + USCRIPT_BRAILLE = 46, /* Brai */ + /** @stable ICU 2.6 */ + USCRIPT_CYPRIOT = 47, /* Cprt */ + /** @stable ICU 2.6 */ + USCRIPT_LIMBU = 48, /* Limb */ + /** @stable ICU 2.6 */ + USCRIPT_LINEAR_B = 49, /* Linb */ + /** @stable ICU 2.6 */ + USCRIPT_OSMANYA = 50, /* Osma */ + /** @stable ICU 2.6 */ + USCRIPT_SHAVIAN = 51, /* Shaw */ + /** @stable ICU 2.6 */ + USCRIPT_TAI_LE = 52, /* Tale */ + /** @stable ICU 2.6 */ + USCRIPT_UGARITIC = 53, /* Ugar */ + + /** New script code in Unicode 4.0.1 @stable ICU 3.0 */ + USCRIPT_KATAKANA_OR_HIRAGANA = 54,/*Hrkt */ + + /* New scripts in Unicode 4.1 */ + /** @stable ICU 3.4 */ + USCRIPT_BUGINESE = 55, /* Bugi */ + /** @stable ICU 3.4 */ + USCRIPT_GLAGOLITIC = 56, /* Glag */ + /** @stable ICU 3.4 */ + USCRIPT_KHAROSHTHI = 57, /* Khar */ + /** @stable ICU 3.4 */ + USCRIPT_SYLOTI_NAGRI = 58, /* Sylo */ + /** @stable ICU 3.4 */ + USCRIPT_NEW_TAI_LUE = 59, /* Talu */ + /** @stable ICU 3.4 */ + USCRIPT_TIFINAGH = 60, /* Tfng */ + /** @stable ICU 3.4 */ + USCRIPT_OLD_PERSIAN = 61, /* Xpeo */ + + /* New script codes from Unicode and ISO 15924 */ + /** @stable ICU 3.6 */ + USCRIPT_BALINESE = 62, /* Bali */ + /** @stable ICU 3.6 */ + USCRIPT_BATAK = 63, /* Batk */ + /** @stable ICU 3.6 */ + USCRIPT_BLISSYMBOLS = 64, /* Blis */ + /** @stable ICU 3.6 */ + USCRIPT_BRAHMI = 65, /* Brah */ + /** @stable ICU 3.6 */ + USCRIPT_CHAM = 66, /* Cham */ + /** @stable ICU 3.6 */ + USCRIPT_CIRTH = 67, /* Cirt */ + /** @stable ICU 3.6 */ + USCRIPT_OLD_CHURCH_SLAVONIC_CYRILLIC = 68, /* Cyrs */ + /** @stable ICU 3.6 */ + USCRIPT_DEMOTIC_EGYPTIAN = 69, /* Egyd */ + /** @stable ICU 3.6 */ + USCRIPT_HIERATIC_EGYPTIAN = 70, /* Egyh */ + /** @stable ICU 3.6 */ + USCRIPT_EGYPTIAN_HIEROGLYPHS = 71, /* Egyp */ + /** @stable ICU 3.6 */ + USCRIPT_KHUTSURI = 72, /* Geok */ + /** @stable ICU 3.6 */ + USCRIPT_SIMPLIFIED_HAN = 73, /* Hans */ + /** @stable ICU 3.6 */ + USCRIPT_TRADITIONAL_HAN = 74, /* Hant */ + /** @stable ICU 3.6 */ + USCRIPT_PAHAWH_HMONG = 75, /* Hmng */ + /** @stable ICU 3.6 */ + USCRIPT_OLD_HUNGARIAN = 76, /* Hung */ + /** @stable ICU 3.6 */ + USCRIPT_HARAPPAN_INDUS = 77, /* Inds */ + /** @stable ICU 3.6 */ + USCRIPT_JAVANESE = 78, /* Java */ + /** @stable ICU 3.6 */ + USCRIPT_KAYAH_LI = 79, /* Kali */ + /** @stable ICU 3.6 */ + USCRIPT_LATIN_FRAKTUR = 80, /* Latf */ + /** @stable ICU 3.6 */ + USCRIPT_LATIN_GAELIC = 81, /* Latg */ + /** @stable ICU 3.6 */ + USCRIPT_LEPCHA = 82, /* Lepc */ + /** @stable ICU 3.6 */ + USCRIPT_LINEAR_A = 83, /* Lina */ + /** @stable ICU 4.6 */ + USCRIPT_MANDAIC = 84, /* Mand */ + /** @stable ICU 3.6 */ + USCRIPT_MANDAEAN = USCRIPT_MANDAIC, + /** @stable ICU 3.6 */ + USCRIPT_MAYAN_HIEROGLYPHS = 85, /* Maya */ + /** @stable ICU 4.6 */ + USCRIPT_MEROITIC_HIEROGLYPHS = 86, /* Mero */ + /** @stable ICU 3.6 */ + USCRIPT_MEROITIC = USCRIPT_MEROITIC_HIEROGLYPHS, + /** @stable ICU 3.6 */ + USCRIPT_NKO = 87, /* Nkoo */ + /** @stable ICU 3.6 */ + USCRIPT_ORKHON = 88, /* Orkh */ + /** @stable ICU 3.6 */ + USCRIPT_OLD_PERMIC = 89, /* Perm */ + /** @stable ICU 3.6 */ + USCRIPT_PHAGS_PA = 90, /* Phag */ + /** @stable ICU 3.6 */ + USCRIPT_PHOENICIAN = 91, /* Phnx */ + /** @stable ICU 52 */ + USCRIPT_MIAO = 92, /* Plrd */ + /** @stable ICU 3.6 */ + USCRIPT_PHONETIC_POLLARD = USCRIPT_MIAO, + /** @stable ICU 3.6 */ + USCRIPT_RONGORONGO = 93, /* Roro */ + /** @stable ICU 3.6 */ + USCRIPT_SARATI = 94, /* Sara */ + /** @stable ICU 3.6 */ + USCRIPT_ESTRANGELO_SYRIAC = 95, /* Syre */ + /** @stable ICU 3.6 */ + USCRIPT_WESTERN_SYRIAC = 96, /* Syrj */ + /** @stable ICU 3.6 */ + USCRIPT_EASTERN_SYRIAC = 97, /* Syrn */ + /** @stable ICU 3.6 */ + USCRIPT_TENGWAR = 98, /* Teng */ + /** @stable ICU 3.6 */ + USCRIPT_VAI = 99, /* Vaii */ + /** @stable ICU 3.6 */ + USCRIPT_VISIBLE_SPEECH = 100,/* Visp */ + /** @stable ICU 3.6 */ + USCRIPT_CUNEIFORM = 101,/* Xsux */ + /** @stable ICU 3.6 */ + USCRIPT_UNWRITTEN_LANGUAGES = 102,/* Zxxx */ + /** @stable ICU 3.6 */ + USCRIPT_UNKNOWN = 103,/* Zzzz */ /* Unknown="Code for uncoded script", for unassigned code points */ + + /** @stable ICU 3.8 */ + USCRIPT_CARIAN = 104,/* Cari */ + /** @stable ICU 3.8 */ + USCRIPT_JAPANESE = 105,/* Jpan */ + /** @stable ICU 3.8 */ + USCRIPT_LANNA = 106,/* Lana */ + /** @stable ICU 3.8 */ + USCRIPT_LYCIAN = 107,/* Lyci */ + /** @stable ICU 3.8 */ + USCRIPT_LYDIAN = 108,/* Lydi */ + /** @stable ICU 3.8 */ + USCRIPT_OL_CHIKI = 109,/* Olck */ + /** @stable ICU 3.8 */ + USCRIPT_REJANG = 110,/* Rjng */ + /** @stable ICU 3.8 */ + USCRIPT_SAURASHTRA = 111,/* Saur */ + /** Sutton SignWriting @stable ICU 3.8 */ + USCRIPT_SIGN_WRITING = 112,/* Sgnw */ + /** @stable ICU 3.8 */ + USCRIPT_SUNDANESE = 113,/* Sund */ + /** @stable ICU 3.8 */ + USCRIPT_MOON = 114,/* Moon */ + /** @stable ICU 3.8 */ + USCRIPT_MEITEI_MAYEK = 115,/* Mtei */ + + /** @stable ICU 4.0 */ + USCRIPT_IMPERIAL_ARAMAIC = 116,/* Armi */ + /** @stable ICU 4.0 */ + USCRIPT_AVESTAN = 117,/* Avst */ + /** @stable ICU 4.0 */ + USCRIPT_CHAKMA = 118,/* Cakm */ + /** @stable ICU 4.0 */ + USCRIPT_KOREAN = 119,/* Kore */ + /** @stable ICU 4.0 */ + USCRIPT_KAITHI = 120,/* Kthi */ + /** @stable ICU 4.0 */ + USCRIPT_MANICHAEAN = 121,/* Mani */ + /** @stable ICU 4.0 */ + USCRIPT_INSCRIPTIONAL_PAHLAVI = 122,/* Phli */ + /** @stable ICU 4.0 */ + USCRIPT_PSALTER_PAHLAVI = 123,/* Phlp */ + /** @stable ICU 4.0 */ + USCRIPT_BOOK_PAHLAVI = 124,/* Phlv */ + /** @stable ICU 4.0 */ + USCRIPT_INSCRIPTIONAL_PARTHIAN = 125,/* Prti */ + /** @stable ICU 4.0 */ + USCRIPT_SAMARITAN = 126,/* Samr */ + /** @stable ICU 4.0 */ + USCRIPT_TAI_VIET = 127,/* Tavt */ + /** @stable ICU 4.0 */ + USCRIPT_MATHEMATICAL_NOTATION = 128,/* Zmth */ + /** @stable ICU 4.0 */ + USCRIPT_SYMBOLS = 129,/* Zsym */ + + /** @stable ICU 4.4 */ + USCRIPT_BAMUM = 130,/* Bamu */ + /** @stable ICU 4.4 */ + USCRIPT_LISU = 131,/* Lisu */ + /** @stable ICU 4.4 */ + USCRIPT_NAKHI_GEBA = 132,/* Nkgb */ + /** @stable ICU 4.4 */ + USCRIPT_OLD_SOUTH_ARABIAN = 133,/* Sarb */ + + /** @stable ICU 4.6 */ + USCRIPT_BASSA_VAH = 134,/* Bass */ + /** @stable ICU 54 */ + USCRIPT_DUPLOYAN = 135,/* Dupl */ +#ifndef U_HIDE_DEPRECATED_API + /** @deprecated ICU 54 Typo, use USCRIPT_DUPLOYAN */ + USCRIPT_DUPLOYAN_SHORTAND = USCRIPT_DUPLOYAN, +#endif /* U_HIDE_DEPRECATED_API */ + /** @stable ICU 4.6 */ + USCRIPT_ELBASAN = 136,/* Elba */ + /** @stable ICU 4.6 */ + USCRIPT_GRANTHA = 137,/* Gran */ + /** @stable ICU 4.6 */ + USCRIPT_KPELLE = 138,/* Kpel */ + /** @stable ICU 4.6 */ + USCRIPT_LOMA = 139,/* Loma */ + /** Mende Kikakui @stable ICU 4.6 */ + USCRIPT_MENDE = 140,/* Mend */ + /** @stable ICU 4.6 */ + USCRIPT_MEROITIC_CURSIVE = 141,/* Merc */ + /** @stable ICU 4.6 */ + USCRIPT_OLD_NORTH_ARABIAN = 142,/* Narb */ + /** @stable ICU 4.6 */ + USCRIPT_NABATAEAN = 143,/* Nbat */ + /** @stable ICU 4.6 */ + USCRIPT_PALMYRENE = 144,/* Palm */ + /** @stable ICU 54 */ + USCRIPT_KHUDAWADI = 145,/* Sind */ + /** @stable ICU 4.6 */ + USCRIPT_SINDHI = USCRIPT_KHUDAWADI, + /** @stable ICU 4.6 */ + USCRIPT_WARANG_CITI = 146,/* Wara */ + + /** @stable ICU 4.8 */ + USCRIPT_AFAKA = 147,/* Afak */ + /** @stable ICU 4.8 */ + USCRIPT_JURCHEN = 148,/* Jurc */ + /** @stable ICU 4.8 */ + USCRIPT_MRO = 149,/* Mroo */ + /** @stable ICU 4.8 */ + USCRIPT_NUSHU = 150,/* Nshu */ + /** @stable ICU 4.8 */ + USCRIPT_SHARADA = 151,/* Shrd */ + /** @stable ICU 4.8 */ + USCRIPT_SORA_SOMPENG = 152,/* Sora */ + /** @stable ICU 4.8 */ + USCRIPT_TAKRI = 153,/* Takr */ + /** @stable ICU 4.8 */ + USCRIPT_TANGUT = 154,/* Tang */ + /** @stable ICU 4.8 */ + USCRIPT_WOLEAI = 155,/* Wole */ + + /** @stable ICU 49 */ + USCRIPT_ANATOLIAN_HIEROGLYPHS = 156,/* Hluw */ + /** @stable ICU 49 */ + USCRIPT_KHOJKI = 157,/* Khoj */ + /** @stable ICU 49 */ + USCRIPT_TIRHUTA = 158,/* Tirh */ + + /** @stable ICU 52 */ + USCRIPT_CAUCASIAN_ALBANIAN = 159,/* Aghb */ + /** @stable ICU 52 */ + USCRIPT_MAHAJANI = 160,/* Mahj */ + + /** @stable ICU 54 */ + USCRIPT_AHOM = 161,/* Ahom */ + /** @stable ICU 54 */ + USCRIPT_HATRAN = 162,/* Hatr */ + /** @stable ICU 54 */ + USCRIPT_MODI = 163,/* Modi */ + /** @stable ICU 54 */ + USCRIPT_MULTANI = 164,/* Mult */ + /** @stable ICU 54 */ + USCRIPT_PAU_CIN_HAU = 165,/* Pauc */ + /** @stable ICU 54 */ + USCRIPT_SIDDHAM = 166,/* Sidd */ + + /** @stable ICU 58 */ + USCRIPT_ADLAM = 167,/* Adlm */ + /** @stable ICU 58 */ + USCRIPT_BHAIKSUKI = 168,/* Bhks */ + /** @stable ICU 58 */ + USCRIPT_MARCHEN = 169,/* Marc */ + /** @stable ICU 58 */ + USCRIPT_NEWA = 170,/* Newa */ + /** @stable ICU 58 */ + USCRIPT_OSAGE = 171,/* Osge */ + + /** @stable ICU 58 */ + USCRIPT_HAN_WITH_BOPOMOFO = 172,/* Hanb */ + /** @stable ICU 58 */ + USCRIPT_JAMO = 173,/* Jamo */ + /** @stable ICU 58 */ + USCRIPT_SYMBOLS_EMOJI = 174,/* Zsye */ + + /** @stable ICU 60 */ + USCRIPT_MASARAM_GONDI = 175,/* Gonm */ + /** @stable ICU 60 */ + USCRIPT_SOYOMBO = 176,/* Soyo */ + /** @stable ICU 60 */ + USCRIPT_ZANABAZAR_SQUARE = 177,/* Zanb */ + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UScriptCode value. + * The highest value is available via u_getIntPropertyMaxValue(UCHAR_SCRIPT). + * + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + USCRIPT_CODE_LIMIT = 178 +#endif // U_HIDE_DEPRECATED_API +} UScriptCode; + +/** + * Gets the script codes associated with the given locale or ISO 15924 abbreviation or name. + * Fills in USCRIPT_MALAYALAM given "Malayam" OR "Mlym". + * Fills in USCRIPT_LATIN given "en" OR "en_US" + * If the required capacity is greater than the capacity of the destination buffer, + * then the error code is set to U_BUFFER_OVERFLOW_ERROR and the required capacity is returned. + * + *

Note: To search by short or long script alias only, use + * u_getPropertyValueEnum(UCHAR_SCRIPT, alias) instead. That does + * a fast lookup with no access of the locale data. + * + * @param nameOrAbbrOrLocale name of the script, as given in + * PropertyValueAliases.txt, or ISO 15924 code or locale + * @param fillIn the UScriptCode buffer to fill in the script code + * @param capacity the capacity (size) fo UScriptCode buffer passed in. + * @param err the error status code. + * @return The number of script codes filled in the buffer passed in + * @stable ICU 2.4 + */ +U_STABLE int32_t U_EXPORT2 +uscript_getCode(const char* nameOrAbbrOrLocale,UScriptCode* fillIn,int32_t capacity,UErrorCode *err); + +/** + * Returns the long Unicode script name, if there is one. + * Otherwise returns the 4-letter ISO 15924 script code. + * Returns "Malayam" given USCRIPT_MALAYALAM. + * + * @param scriptCode UScriptCode enum + * @return long script name as given in PropertyValueAliases.txt, or the 4-letter code, + * or NULL if scriptCode is invalid + * @stable ICU 2.4 + */ +U_STABLE const char* U_EXPORT2 +uscript_getName(UScriptCode scriptCode); + +/** + * Returns the 4-letter ISO 15924 script code, + * which is the same as the short Unicode script name if Unicode has names for the script. + * Returns "Mlym" given USCRIPT_MALAYALAM. + * + * @param scriptCode UScriptCode enum + * @return short script name (4-letter code), or NULL if scriptCode is invalid + * @stable ICU 2.4 + */ +U_STABLE const char* U_EXPORT2 +uscript_getShortName(UScriptCode scriptCode); + +/** + * Gets the script code associated with the given codepoint. + * Returns USCRIPT_MALAYALAM given 0x0D02 + * @param codepoint UChar32 codepoint + * @param err the error status code. + * @return The UScriptCode, or 0 if codepoint is invalid + * @stable ICU 2.4 + */ +U_STABLE UScriptCode U_EXPORT2 +uscript_getScript(UChar32 codepoint, UErrorCode *err); + +/** + * Do the Script_Extensions of code point c contain script sc? + * If c does not have explicit Script_Extensions, then this tests whether + * c has the Script property value sc. + * + * Some characters are commonly used in multiple scripts. + * For more information, see UAX #24: http://www.unicode.org/reports/tr24/. + * @param c code point + * @param sc script code + * @return TRUE if sc is in Script_Extensions(c) + * @stable ICU 49 + */ +U_STABLE UBool U_EXPORT2 +uscript_hasScript(UChar32 c, UScriptCode sc); + +/** + * Writes code point c's Script_Extensions as a list of UScriptCode values + * to the output scripts array and returns the number of script codes. + * - If c does have Script_Extensions, then the Script property value + * (normally Common or Inherited) is not included. + * - If c does not have Script_Extensions, then the one Script code is written to the output array. + * - If c is not a valid code point, then the one USCRIPT_UNKNOWN code is written. + * In other words, if the return value is 1, + * then the output array contains exactly c's single Script code. + * If the return value is n>=2, then the output array contains c's n Script_Extensions script codes. + * + * Some characters are commonly used in multiple scripts. + * For more information, see UAX #24: http://www.unicode.org/reports/tr24/. + * + * If there are more than capacity script codes to be written, then + * U_BUFFER_OVERFLOW_ERROR is set and the number of Script_Extensions is returned. + * (Usual ICU buffer handling behavior.) + * + * @param c code point + * @param scripts output script code array + * @param capacity capacity of the scripts array + * @param errorCode Standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return number of script codes in c's Script_Extensions, or 1 for the single Script value, + * written to scripts unless U_BUFFER_OVERFLOW_ERROR indicates insufficient capacity + * @stable ICU 49 + */ +U_STABLE int32_t U_EXPORT2 +uscript_getScriptExtensions(UChar32 c, + UScriptCode *scripts, int32_t capacity, + UErrorCode *errorCode); + +/** + * Script usage constants. + * See UAX #31 Unicode Identifier and Pattern Syntax. + * http://www.unicode.org/reports/tr31/#Table_Candidate_Characters_for_Exclusion_from_Identifiers + * + * @stable ICU 51 + */ +typedef enum UScriptUsage { + /** Not encoded in Unicode. @stable ICU 51 */ + USCRIPT_USAGE_NOT_ENCODED, + /** Unknown script usage. @stable ICU 51 */ + USCRIPT_USAGE_UNKNOWN, + /** Candidate for Exclusion from Identifiers. @stable ICU 51 */ + USCRIPT_USAGE_EXCLUDED, + /** Limited Use script. @stable ICU 51 */ + USCRIPT_USAGE_LIMITED_USE, + /** Aspirational Use script. @stable ICU 51 */ + USCRIPT_USAGE_ASPIRATIONAL, + /** Recommended script. @stable ICU 51 */ + USCRIPT_USAGE_RECOMMENDED +} UScriptUsage; + +/** + * Writes the script sample character string. + * This string normally consists of one code point but might be longer. + * The string is empty if the script is not encoded. + * + * @param script script code + * @param dest output string array + * @param capacity number of UChars in the dest array + * @param pErrorCode standard ICU in/out error code, must pass U_SUCCESS() on input + * @return the string length, even if U_BUFFER_OVERFLOW_ERROR + * @stable ICU 51 + */ +U_STABLE int32_t U_EXPORT2 +uscript_getSampleString(UScriptCode script, UChar *dest, int32_t capacity, UErrorCode *pErrorCode); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN +class UnicodeString; +U_NAMESPACE_END + +/** + * Returns the script sample character string. + * This string normally consists of one code point but might be longer. + * The string is empty if the script is not encoded. + * + * @param script script code + * @return the sample character string + * @stable ICU 51 + */ +U_COMMON_API icu::UnicodeString U_EXPORT2 +uscript_getSampleUnicodeString(UScriptCode script); + +#endif + +/** + * Returns the script usage according to UAX #31 Unicode Identifier and Pattern Syntax. + * Returns USCRIPT_USAGE_NOT_ENCODED if the script is not encoded in Unicode. + * + * @param script script code + * @return script usage + * @see UScriptUsage + * @stable ICU 51 + */ +U_STABLE UScriptUsage U_EXPORT2 +uscript_getUsage(UScriptCode script); + +/** + * Returns TRUE if the script is written right-to-left. + * For example, Arab and Hebr. + * + * @param script script code + * @return TRUE if the script is right-to-left + * @stable ICU 51 + */ +U_STABLE UBool U_EXPORT2 +uscript_isRightToLeft(UScriptCode script); + +/** + * Returns TRUE if the script allows line breaks between letters (excluding hyphenation). + * Such a script typically requires dictionary-based line breaking. + * For example, Hani and Thai. + * + * @param script script code + * @return TRUE if the script allows line breaks between letters + * @stable ICU 51 + */ +U_STABLE UBool U_EXPORT2 +uscript_breaksBetweenLetters(UScriptCode script); + +/** + * Returns TRUE if in modern (or most recent) usage of the script case distinctions are customary. + * For example, Latn and Cyrl. + * + * @param script script code + * @return TRUE if the script is cased + * @stable ICU 51 + */ +U_STABLE UBool U_EXPORT2 +uscript_isCased(UScriptCode script); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/usearch.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/usearch.h new file mode 100644 index 0000000..ebfcdf7 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/usearch.h @@ -0,0 +1,891 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 2001-2011,2014 IBM and others. All rights reserved. +********************************************************************** +* Date Name Description +* 06/28/2001 synwee Creation. +********************************************************************** +*/ +#ifndef USEARCH_H +#define USEARCH_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION + +#include "unicode/localpointer.h" +#include "unicode/ucol.h" +#include "unicode/ucoleitr.h" +#include "unicode/ubrk.h" + +/** + * \file + * \brief C API: StringSearch + * + * C Apis for an engine that provides language-sensitive text searching based + * on the comparison rules defined in a UCollator data struct, + * see ucol.h. This ensures that language eccentricity can be + * handled, e.g. for the German collator, characters ß and SS will be matched + * if case is chosen to be ignored. + * See the + * "ICU Collation Design Document" for more information. + *

+ * The implementation may use a linear search or a modified form of the Boyer-Moore + * search; for more information on the latter see + * + * "Efficient Text Searching in Java", published in Java Report + * in February, 1999. + *

+ * There are 2 match options for selection:
+ * Let S' be the sub-string of a text string S between the offsets start and + * end . + *
+ * A pattern string P matches a text string S at the offsets + * if + *

 
+ * option 1. Some canonical equivalent of P matches some canonical equivalent 
+ *           of S'
+ * option 2. P matches S' and if P starts or ends with a combining mark, 
+ *           there exists no non-ignorable combining mark before or after S' 
+ *           in S respectively. 
+ * 
+ * Option 2. will be the default. + *

+ * This search has APIs similar to that of other text iteration mechanisms + * such as the break iterators in ubrk.h. Using these + * APIs, it is easy to scan through text looking for all occurances of + * a given pattern. This search iterator allows changing of direction by + * calling a reset followed by a next or previous. + * Though a direction change can occur without calling reset first, + * this operation comes with some speed penalty. + * Generally, match results in the forward direction will match the result + * matches in the backwards direction in the reverse order + *

+ * usearch.h provides APIs to specify the starting position + * within the text string to be searched, e.g. usearch_setOffset, + * usearch_preceding and usearch_following. Since the + * starting position will be set as it is specified, please take note that + * there are some dangerous positions which the search may render incorrect + * results: + *

    + *
  • The midst of a substring that requires normalization. + *
  • If the following match is to be found, the position should not be the + * second character which requires to be swapped with the preceding + * character. Vice versa, if the preceding match is to be found, + * position to search from should not be the first character which + * requires to be swapped with the next character. E.g certain Thai and + * Lao characters require swapping. + *
  • If a following pattern match is to be found, any position within a + * contracting sequence except the first will fail. Vice versa if a + * preceding pattern match is to be found, a invalid starting point + * would be any character within a contracting sequence except the last. + *
+ *

+ * A breakiterator can be used if only matches at logical breaks are desired. + * Using a breakiterator will only give you results that exactly matches the + * boundaries given by the breakiterator. For instance the pattern "e" will + * not be found in the string "\u00e9" if a character break iterator is used. + *

+ * Options are provided to handle overlapping matches. + * E.g. In English, overlapping matches produces the result 0 and 2 + * for the pattern "abab" in the text "ababab", where else mutually + * exclusive matches only produce the result of 0. + *

+ * Options are also provided to implement "asymmetric search" as described in + * + * UTS #10 Unicode Collation Algorithm, specifically the USearchAttribute + * USEARCH_ELEMENT_COMPARISON and its values. + *

+ * Though collator attributes will be taken into consideration while + * performing matches, there are no APIs here for setting and getting the + * attributes. These attributes can be set by getting the collator + * from usearch_getCollator and using the APIs in ucol.h. + * Lastly to update String Search to the new collator attributes, + * usearch_reset() has to be called. + *

+ * Restriction:
+ * Currently there are no composite characters that consists of a + * character with combining class > 0 before a character with combining + * class == 0. However, if such a character exists in the future, the + * search mechanism does not guarantee the results for option 1. + * + *

+ * Example of use:
+ *


+ * char *tgtstr = "The quick brown fox jumped over the lazy fox";
+ * char *patstr = "fox";
+ * UChar target[64];
+ * UChar pattern[16];
+ * UErrorCode status = U_ZERO_ERROR;
+ * u_uastrcpy(target, tgtstr);
+ * u_uastrcpy(pattern, patstr);
+ *
+ * UStringSearch *search = usearch_open(pattern, -1, target, -1, "en_US", 
+ *                                  NULL, &status);
+ * if (U_SUCCESS(status)) {
+ *     for (int pos = usearch_first(search, &status); 
+ *          pos != USEARCH_DONE; 
+ *          pos = usearch_next(search, &status))
+ *     {
+ *         printf("Found match at %d pos, length is %d\n", pos, 
+ *                                        usearch_getMatchLength(search));
+ *     }
+ * }
+ *
+ * usearch_close(search);
+ * 
+ * @stable ICU 2.4 + */ + +/** +* DONE is returned by previous() and next() after all valid matches have +* been returned, and by first() and last() if there are no matches at all. +* @stable ICU 2.4 +*/ +#define USEARCH_DONE -1 + +/** +* Data structure for searching +* @stable ICU 2.4 +*/ +struct UStringSearch; +/** +* Data structure for searching +* @stable ICU 2.4 +*/ +typedef struct UStringSearch UStringSearch; + +/** +* @stable ICU 2.4 +*/ +typedef enum { + /** + * Option for overlapping matches + * @stable ICU 2.4 + */ + USEARCH_OVERLAP = 0, +#ifndef U_HIDE_DEPRECATED_API + /** + * Option for canonical matches; option 1 in header documentation. + * The default value will be USEARCH_OFF. + * Note: Setting this option to USEARCH_ON currently has no effect on + * search behavior, and this option is deprecated. Instead, to control + * canonical match behavior, you must set UCOL_NORMALIZATION_MODE + * appropriately (to UCOL_OFF or UCOL_ON) in the UCollator used by + * the UStringSearch object. + * @see usearch_openFromCollator + * @see usearch_getCollator + * @see usearch_setCollator + * @see ucol_getAttribute + * @deprecated ICU 53 + */ + USEARCH_CANONICAL_MATCH = 1, +#endif /* U_HIDE_DEPRECATED_API */ + /** + * Option to control how collation elements are compared. + * The default value will be USEARCH_STANDARD_ELEMENT_COMPARISON. + * @stable ICU 4.4 + */ + USEARCH_ELEMENT_COMPARISON = 2, + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal USearchAttribute value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + USEARCH_ATTRIBUTE_COUNT = 3 +#endif /* U_HIDE_DEPRECATED_API */ +} USearchAttribute; + +/** +* @stable ICU 2.4 +*/ +typedef enum { + /** + * Default value for any USearchAttribute + * @stable ICU 2.4 + */ + USEARCH_DEFAULT = -1, + /** + * Value for USEARCH_OVERLAP and USEARCH_CANONICAL_MATCH + * @stable ICU 2.4 + */ + USEARCH_OFF, + /** + * Value for USEARCH_OVERLAP and USEARCH_CANONICAL_MATCH + * @stable ICU 2.4 + */ + USEARCH_ON, + /** + * Value (default) for USEARCH_ELEMENT_COMPARISON; + * standard collation element comparison at the specified collator + * strength. + * @stable ICU 4.4 + */ + USEARCH_STANDARD_ELEMENT_COMPARISON, + /** + * Value for USEARCH_ELEMENT_COMPARISON; + * collation element comparison is modified to effectively provide + * behavior between the specified strength and strength - 1. Collation + * elements in the pattern that have the base weight for the specified + * strength are treated as "wildcards" that match an element with any + * other weight at that collation level in the searched text. For + * example, with a secondary-strength English collator, a plain 'e' in + * the pattern will match a plain e or an e with any diacritic in the + * searched text, but an e with diacritic in the pattern will only + * match an e with the same diacritic in the searched text. + * + * This supports "asymmetric search" as described in + * + * UTS #10 Unicode Collation Algorithm. + * + * @stable ICU 4.4 + */ + USEARCH_PATTERN_BASE_WEIGHT_IS_WILDCARD, + /** + * Value for USEARCH_ELEMENT_COMPARISON. + * collation element comparison is modified to effectively provide + * behavior between the specified strength and strength - 1. Collation + * elements in either the pattern or the searched text that have the + * base weight for the specified strength are treated as "wildcards" + * that match an element with any other weight at that collation level. + * For example, with a secondary-strength English collator, a plain 'e' + * in the pattern will match a plain e or an e with any diacritic in the + * searched text, but an e with diacritic in the pattern will only + * match an e with the same diacritic or a plain e in the searched text. + * + * This option is similar to "asymmetric search" as described in + * + * UTS #10 Unicode Collation Algorithmusearch_close. +* @param pattern for matching +* @param patternlength length of the pattern, -1 for null-termination +* @param text text string +* @param textlength length of the text string, -1 for null-termination +* @param locale name of locale for the rules to be used +* @param breakiter A BreakIterator that will be used to restrict the points +* at which matches are detected. If a match is found, but +* the match's start or end index is not a boundary as +* determined by the BreakIterator, the match will +* be rejected and another will be searched for. +* If this parameter is NULL, no break detection is +* attempted. +* @param status for errors if it occurs. If pattern or text is NULL, or if +* patternlength or textlength is 0 then an +* U_ILLEGAL_ARGUMENT_ERROR is returned. +* @return search iterator data structure, or NULL if there is an error. +* @stable ICU 2.4 +*/ +U_STABLE UStringSearch * U_EXPORT2 usearch_open(const UChar *pattern, + int32_t patternlength, + const UChar *text, + int32_t textlength, + const char *locale, + UBreakIterator *breakiter, + UErrorCode *status); + +/** +* Creating a search iterator data struct using the argument collator language +* rule set. Note, user retains the ownership of this collator, thus the +* responsibility of deletion lies with the user. +* NOTE: string search cannot be instantiated from a collator that has +* collate digits as numbers (CODAN) turned on. +* @param pattern for matching +* @param patternlength length of the pattern, -1 for null-termination +* @param text text string +* @param textlength length of the text string, -1 for null-termination +* @param collator used for the language rules +* @param breakiter A BreakIterator that will be used to restrict the points +* at which matches are detected. If a match is found, but +* the match's start or end index is not a boundary as +* determined by the BreakIterator, the match will +* be rejected and another will be searched for. +* If this parameter is NULL, no break detection is +* attempted. +* @param status for errors if it occurs. If collator, pattern or text is NULL, +* or if patternlength or textlength is 0 then an +* U_ILLEGAL_ARGUMENT_ERROR is returned. +* @return search iterator data structure, or NULL if there is an error. +* @stable ICU 2.4 +*/ +U_STABLE UStringSearch * U_EXPORT2 usearch_openFromCollator( + const UChar *pattern, + int32_t patternlength, + const UChar *text, + int32_t textlength, + const UCollator *collator, + UBreakIterator *breakiter, + UErrorCode *status); + +/** +* Destroying and cleaning up the search iterator data struct. +* If a collator is created in usearch_open, it will be destroyed here. +* @param searchiter data struct to clean up +* @stable ICU 2.4 +*/ +U_STABLE void U_EXPORT2 usearch_close(UStringSearch *searchiter); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUStringSearchPointer + * "Smart pointer" class, closes a UStringSearch via usearch_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUStringSearchPointer, UStringSearch, usearch_close); + +U_NAMESPACE_END + +#endif + +/* get and set methods -------------------------------------------------- */ + +/** +* Sets the current position in the text string which the next search will +* start from. Clears previous states. +* This method takes the argument index and sets the position in the text +* string accordingly without checking if the index is pointing to a +* valid starting point to begin searching. +* Search positions that may render incorrect results are highlighted in the +* header comments +* @param strsrch search iterator data struct +* @param position position to start next search from. If position is less +* than or greater than the text range for searching, +* an U_INDEX_OUTOFBOUNDS_ERROR will be returned +* @param status error status if any. +* @stable ICU 2.4 +*/ +U_STABLE void U_EXPORT2 usearch_setOffset(UStringSearch *strsrch, + int32_t position, + UErrorCode *status); + +/** +* Return the current index in the string text being searched. +* If the iteration has gone past the end of the text (or past the beginning +* for a backwards search), USEARCH_DONE is returned. +* @param strsrch search iterator data struct +* @see #USEARCH_DONE +* @stable ICU 2.4 +*/ +U_STABLE int32_t U_EXPORT2 usearch_getOffset(const UStringSearch *strsrch); + +/** +* Sets the text searching attributes located in the enum USearchAttribute +* with values from the enum USearchAttributeValue. +* USEARCH_DEFAULT can be used for all attributes for resetting. +* @param strsrch search iterator data struct +* @param attribute text attribute to be set +* @param value text attribute value +* @param status for errors if it occurs +* @see #usearch_getAttribute +* @stable ICU 2.4 +*/ +U_STABLE void U_EXPORT2 usearch_setAttribute(UStringSearch *strsrch, + USearchAttribute attribute, + USearchAttributeValue value, + UErrorCode *status); + +/** +* Gets the text searching attributes. +* @param strsrch search iterator data struct +* @param attribute text attribute to be retrieve +* @return text attribute value +* @see #usearch_setAttribute +* @stable ICU 2.4 +*/ +U_STABLE USearchAttributeValue U_EXPORT2 usearch_getAttribute( + const UStringSearch *strsrch, + USearchAttribute attribute); + +/** +* Returns the index to the match in the text string that was searched. +* This call returns a valid result only after a successful call to +* usearch_first, usearch_next, usearch_previous, +* or usearch_last. +* Just after construction, or after a searching method returns +* USEARCH_DONE, this method will return USEARCH_DONE. +*

+* Use usearch_getMatchedLength to get the matched string length. +* @param strsrch search iterator data struct +* @return index to a substring within the text string that is being +* searched. +* @see #usearch_first +* @see #usearch_next +* @see #usearch_previous +* @see #usearch_last +* @see #USEARCH_DONE +* @stable ICU 2.4 +*/ +U_STABLE int32_t U_EXPORT2 usearch_getMatchedStart( + const UStringSearch *strsrch); + +/** +* Returns the length of text in the string which matches the search pattern. +* This call returns a valid result only after a successful call to +* usearch_first, usearch_next, usearch_previous, +* or usearch_last. +* Just after construction, or after a searching method returns +* USEARCH_DONE, this method will return 0. +* @param strsrch search iterator data struct +* @return The length of the match in the string text, or 0 if there is no +* match currently. +* @see #usearch_first +* @see #usearch_next +* @see #usearch_previous +* @see #usearch_last +* @see #USEARCH_DONE +* @stable ICU 2.4 +*/ +U_STABLE int32_t U_EXPORT2 usearch_getMatchedLength( + const UStringSearch *strsrch); + +/** +* Returns the text that was matched by the most recent call to +* usearch_first, usearch_next, usearch_previous, +* or usearch_last. +* If the iterator is not pointing at a valid match (e.g. just after +* construction or after USEARCH_DONE has been returned, returns +* an empty string. If result is not large enough to store the matched text, +* result will be filled with the partial text and an U_BUFFER_OVERFLOW_ERROR +* will be returned in status. result will be null-terminated whenever +* possible. If the buffer fits the matched text exactly, a null-termination +* is not possible, then a U_STRING_NOT_TERMINATED_ERROR set in status. +* Pre-flighting can be either done with length = 0 or the API +* usearch_getMatchLength. +* @param strsrch search iterator data struct +* @param result UChar buffer to store the matched string +* @param resultCapacity length of the result buffer +* @param status error returned if result is not large enough +* @return exact length of the matched text, not counting the null-termination +* @see #usearch_first +* @see #usearch_next +* @see #usearch_previous +* @see #usearch_last +* @see #USEARCH_DONE +* @stable ICU 2.4 +*/ +U_STABLE int32_t U_EXPORT2 usearch_getMatchedText(const UStringSearch *strsrch, + UChar *result, + int32_t resultCapacity, + UErrorCode *status); + +#if !UCONFIG_NO_BREAK_ITERATION + +/** +* Set the BreakIterator that will be used to restrict the points at which +* matches are detected. +* @param strsrch search iterator data struct +* @param breakiter A BreakIterator that will be used to restrict the points +* at which matches are detected. If a match is found, but +* the match's start or end index is not a boundary as +* determined by the BreakIterator, the match will +* be rejected and another will be searched for. +* If this parameter is NULL, no break detection is +* attempted. +* @param status for errors if it occurs +* @see #usearch_getBreakIterator +* @stable ICU 2.4 +*/ +U_STABLE void U_EXPORT2 usearch_setBreakIterator(UStringSearch *strsrch, + UBreakIterator *breakiter, + UErrorCode *status); + +/** +* Returns the BreakIterator that is used to restrict the points at which +* matches are detected. This will be the same object that was passed to the +* constructor or to usearch_setBreakIterator. Note that +* NULL +* is a legal value; it means that break detection should not be attempted. +* @param strsrch search iterator data struct +* @return break iterator used +* @see #usearch_setBreakIterator +* @stable ICU 2.4 +*/ +U_STABLE const UBreakIterator * U_EXPORT2 usearch_getBreakIterator( + const UStringSearch *strsrch); + +#endif + +/** +* Set the string text to be searched. Text iteration will hence begin at the +* start of the text string. This method is useful if you want to re-use an +* iterator to search for the same pattern within a different body of text. +* @param strsrch search iterator data struct +* @param text new string to look for match +* @param textlength length of the new string, -1 for null-termination +* @param status for errors if it occurs. If text is NULL, or textlength is 0 +* then an U_ILLEGAL_ARGUMENT_ERROR is returned with no change +* done to strsrch. +* @see #usearch_getText +* @stable ICU 2.4 +*/ +U_STABLE void U_EXPORT2 usearch_setText( UStringSearch *strsrch, + const UChar *text, + int32_t textlength, + UErrorCode *status); + +/** +* Return the string text to be searched. +* @param strsrch search iterator data struct +* @param length returned string text length +* @return string text +* @see #usearch_setText +* @stable ICU 2.4 +*/ +U_STABLE const UChar * U_EXPORT2 usearch_getText(const UStringSearch *strsrch, + int32_t *length); + +/** +* Gets the collator used for the language rules. +*

+* Deleting the returned UCollator before calling +* usearch_close would cause the string search to fail. +* usearch_close will delete the collator if this search owns it. +* @param strsrch search iterator data struct +* @return collator +* @stable ICU 2.4 +*/ +U_STABLE UCollator * U_EXPORT2 usearch_getCollator( + const UStringSearch *strsrch); + +/** +* Sets the collator used for the language rules. User retains the ownership +* of this collator, thus the responsibility of deletion lies with the user. +* This method causes internal data such as Boyer-Moore shift tables to +* be recalculated, but the iterator's position is unchanged. +* @param strsrch search iterator data struct +* @param collator to be used +* @param status for errors if it occurs +* @stable ICU 2.4 +*/ +U_STABLE void U_EXPORT2 usearch_setCollator( UStringSearch *strsrch, + const UCollator *collator, + UErrorCode *status); + +/** +* Sets the pattern used for matching. +* Internal data like the Boyer Moore table will be recalculated, but the +* iterator's position is unchanged. +* @param strsrch search iterator data struct +* @param pattern string +* @param patternlength pattern length, -1 for null-terminated string +* @param status for errors if it occurs. If text is NULL, or textlength is 0 +* then an U_ILLEGAL_ARGUMENT_ERROR is returned with no change +* done to strsrch. +* @stable ICU 2.4 +*/ +U_STABLE void U_EXPORT2 usearch_setPattern( UStringSearch *strsrch, + const UChar *pattern, + int32_t patternlength, + UErrorCode *status); + +/** +* Gets the search pattern +* @param strsrch search iterator data struct +* @param length return length of the pattern, -1 indicates that the pattern +* is null-terminated +* @return pattern string +* @stable ICU 2.4 +*/ +U_STABLE const UChar * U_EXPORT2 usearch_getPattern( + const UStringSearch *strsrch, + int32_t *length); + +/* methods ------------------------------------------------------------- */ + +/** +* Returns the first index at which the string text matches the search +* pattern. +* The iterator is adjusted so that its current index (as returned by +* usearch_getOffset) is the match position if one was found. +* If a match is not found, USEARCH_DONE will be returned and +* the iterator will be adjusted to the index USEARCH_DONE. +* @param strsrch search iterator data struct +* @param status for errors if it occurs +* @return The character index of the first match, or +* USEARCH_DONE if there are no matches. +* @see #usearch_getOffset +* @see #USEARCH_DONE +* @stable ICU 2.4 +*/ +U_STABLE int32_t U_EXPORT2 usearch_first(UStringSearch *strsrch, + UErrorCode *status); + +/** +* Returns the first index equal or greater than position at which +* the string text +* matches the search pattern. The iterator is adjusted so that its current +* index (as returned by usearch_getOffset) is the match position if +* one was found. +* If a match is not found, USEARCH_DONE will be returned and +* the iterator will be adjusted to the index USEARCH_DONE +*

+* Search positions that may render incorrect results are highlighted in the +* header comments. If position is less than or greater than the text range +* for searching, an U_INDEX_OUTOFBOUNDS_ERROR will be returned +* @param strsrch search iterator data struct +* @param position to start the search at +* @param status for errors if it occurs +* @return The character index of the first match following pos, +* or USEARCH_DONE if there are no matches. +* @see #usearch_getOffset +* @see #USEARCH_DONE +* @stable ICU 2.4 +*/ +U_STABLE int32_t U_EXPORT2 usearch_following(UStringSearch *strsrch, + int32_t position, + UErrorCode *status); + +/** +* Returns the last index in the target text at which it matches the search +* pattern. The iterator is adjusted so that its current +* index (as returned by usearch_getOffset) is the match position if +* one was found. +* If a match is not found, USEARCH_DONE will be returned and +* the iterator will be adjusted to the index USEARCH_DONE. +* @param strsrch search iterator data struct +* @param status for errors if it occurs +* @return The index of the first match, or USEARCH_DONE if there +* are no matches. +* @see #usearch_getOffset +* @see #USEARCH_DONE +* @stable ICU 2.4 +*/ +U_STABLE int32_t U_EXPORT2 usearch_last(UStringSearch *strsrch, + UErrorCode *status); + +/** +* Returns the first index less than position at which the string text +* matches the search pattern. The iterator is adjusted so that its current +* index (as returned by usearch_getOffset) is the match position if +* one was found. +* If a match is not found, USEARCH_DONE will be returned and +* the iterator will be adjusted to the index USEARCH_DONE +*

+* Search positions that may render incorrect results are highlighted in the +* header comments. If position is less than or greater than the text range +* for searching, an U_INDEX_OUTOFBOUNDS_ERROR will be returned. +*

+* When USEARCH_OVERLAP option is off, the last index of the +* result match is always less than position. +* When USERARCH_OVERLAP is on, the result match may span across +* position. +* @param strsrch search iterator data struct +* @param position index position the search is to begin at +* @param status for errors if it occurs +* @return The character index of the first match preceding pos, +* or USEARCH_DONE if there are no matches. +* @see #usearch_getOffset +* @see #USEARCH_DONE +* @stable ICU 2.4 +*/ +U_STABLE int32_t U_EXPORT2 usearch_preceding(UStringSearch *strsrch, + int32_t position, + UErrorCode *status); + +/** +* Returns the index of the next point at which the string text matches the +* search pattern, starting from the current position. +* The iterator is adjusted so that its current +* index (as returned by usearch_getOffset) is the match position if +* one was found. +* If a match is not found, USEARCH_DONE will be returned and +* the iterator will be adjusted to the index USEARCH_DONE +* @param strsrch search iterator data struct +* @param status for errors if it occurs +* @return The index of the next match after the current position, or +* USEARCH_DONE if there are no more matches. +* @see #usearch_first +* @see #usearch_getOffset +* @see #USEARCH_DONE +* @stable ICU 2.4 +*/ +U_STABLE int32_t U_EXPORT2 usearch_next(UStringSearch *strsrch, + UErrorCode *status); + +/** +* Returns the index of the previous point at which the string text matches +* the search pattern, starting at the current position. +* The iterator is adjusted so that its current +* index (as returned by usearch_getOffset) is the match position if +* one was found. +* If a match is not found, USEARCH_DONE will be returned and +* the iterator will be adjusted to the index USEARCH_DONE +* @param strsrch search iterator data struct +* @param status for errors if it occurs +* @return The index of the previous match before the current position, +* or USEARCH_DONE if there are no more matches. +* @see #usearch_last +* @see #usearch_getOffset +* @see #USEARCH_DONE +* @stable ICU 2.4 +*/ +U_STABLE int32_t U_EXPORT2 usearch_previous(UStringSearch *strsrch, + UErrorCode *status); + +/** +* Reset the iteration. +* Search will begin at the start of the text string if a forward iteration +* is initiated before a backwards iteration. Otherwise if a backwards +* iteration is initiated before a forwards iteration, the search will begin +* at the end of the text string. +* @param strsrch search iterator data struct +* @see #usearch_first +* @stable ICU 2.4 +*/ +U_STABLE void U_EXPORT2 usearch_reset(UStringSearch *strsrch); + +#ifndef U_HIDE_INTERNAL_API +/** + * Simple forward search for the pattern, starting at a specified index, + * and using using a default set search options. + * + * This is an experimental function, and is not an official part of the + * ICU API. + * + * The collator options, such as UCOL_STRENGTH and UCOL_NORMALIZTION, are honored. + * + * The UStringSearch options USEARCH_CANONICAL_MATCH, USEARCH_OVERLAP and + * any Break Iterator are ignored. + * + * Matches obey the following constraints: + * + * Characters at the start or end positions of a match that are ignorable + * for collation are not included as part of the match, unless they + * are part of a combining sequence, as described below. + * + * A match will not include a partial combining sequence. Combining + * character sequences are considered to be inseperable units, + * and either match the pattern completely, or are considered to not match + * at all. Thus, for example, an A followed a combining accent mark will + * not be found when searching for a plain (unaccented) A. (unless + * the collation strength has been set to ignore all accents). + * + * When beginning a search, the initial starting position, startIdx, + * is assumed to be an acceptable match boundary with respect to + * combining characters. A combining sequence that spans across the + * starting point will not supress a match beginning at startIdx. + * + * Characters that expand to multiple collation elements + * (German sharp-S becoming 'ss', or the composed forms of accented + * characters, for example) also must match completely. + * Searching for a single 's' in a string containing only a sharp-s will + * find no match. + * + * + * @param strsrch the UStringSearch struct, which references both + * the text to be searched and the pattern being sought. + * @param startIdx The index into the text to begin the search. + * @param matchStart An out parameter, the starting index of the matched text. + * This parameter may be NULL. + * A value of -1 will be returned if no match was found. + * @param matchLimit Out parameter, the index of the first position following the matched text. + * The matchLimit will be at a suitable position for beginning a subsequent search + * in the input text. + * This parameter may be NULL. + * A value of -1 will be returned if no match was found. + * + * @param status Report any errors. Note that no match found is not an error. + * @return TRUE if a match was found, FALSE otherwise. + * + * @internal + */ +U_INTERNAL UBool U_EXPORT2 usearch_search(UStringSearch *strsrch, + int32_t startIdx, + int32_t *matchStart, + int32_t *matchLimit, + UErrorCode *status); + +/** + * Simple backwards search for the pattern, starting at a specified index, + * and using using a default set search options. + * + * This is an experimental function, and is not an official part of the + * ICU API. + * + * The collator options, such as UCOL_STRENGTH and UCOL_NORMALIZTION, are honored. + * + * The UStringSearch options USEARCH_CANONICAL_MATCH, USEARCH_OVERLAP and + * any Break Iterator are ignored. + * + * Matches obey the following constraints: + * + * Characters at the start or end positions of a match that are ignorable + * for collation are not included as part of the match, unless they + * are part of a combining sequence, as described below. + * + * A match will not include a partial combining sequence. Combining + * character sequences are considered to be inseperable units, + * and either match the pattern completely, or are considered to not match + * at all. Thus, for example, an A followed a combining accent mark will + * not be found when searching for a plain (unaccented) A. (unless + * the collation strength has been set to ignore all accents). + * + * When beginning a search, the initial starting position, startIdx, + * is assumed to be an acceptable match boundary with respect to + * combining characters. A combining sequence that spans across the + * starting point will not supress a match beginning at startIdx. + * + * Characters that expand to multiple collation elements + * (German sharp-S becoming 'ss', or the composed forms of accented + * characters, for example) also must match completely. + * Searching for a single 's' in a string containing only a sharp-s will + * find no match. + * + * + * @param strsrch the UStringSearch struct, which references both + * the text to be searched and the pattern being sought. + * @param startIdx The index into the text to begin the search. + * @param matchStart An out parameter, the starting index of the matched text. + * This parameter may be NULL. + * A value of -1 will be returned if no match was found. + * @param matchLimit Out parameter, the index of the first position following the matched text. + * The matchLimit will be at a suitable position for beginning a subsequent search + * in the input text. + * This parameter may be NULL. + * A value of -1 will be returned if no match was found. + * + * @param status Report any errors. Note that no match found is not an error. + * @return TRUE if a match was found, FALSE otherwise. + * + * @internal + */ +U_INTERNAL UBool U_EXPORT2 usearch_searchBackwards(UStringSearch *strsrch, + int32_t startIdx, + int32_t *matchStart, + int32_t *matchLimit, + UErrorCode *status); +#endif /* U_HIDE_INTERNAL_API */ + +#endif /* #if !UCONFIG_NO_COLLATION && !UCONFIG_NO_BREAK_ITERATION */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/uset.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/uset.h new file mode 100644 index 0000000..59f4650 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/uset.h @@ -0,0 +1,1130 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2002-2014, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: uset.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2002mar07 +* created by: Markus W. Scherer +* +* C version of UnicodeSet. +*/ + + +/** + * \file + * \brief C API: Unicode Set + * + *

This is a C wrapper around the C++ UnicodeSet class.

+ */ + +#ifndef __USET_H__ +#define __USET_H__ + +#include "unicode/utypes.h" +#include "unicode/uchar.h" +#include "unicode/localpointer.h" + +#ifndef UCNV_H +struct USet; +/** + * A UnicodeSet. Use the uset_* API to manipulate. Create with + * uset_open*, and destroy with uset_close. + * @stable ICU 2.4 + */ +typedef struct USet USet; +#endif + +/** + * Bitmask values to be passed to uset_openPatternOptions() or + * uset_applyPattern() taking an option parameter. + * @stable ICU 2.4 + */ +enum { + /** + * Ignore white space within patterns unless quoted or escaped. + * @stable ICU 2.4 + */ + USET_IGNORE_SPACE = 1, + + /** + * Enable case insensitive matching. E.g., "[ab]" with this flag + * will match 'a', 'A', 'b', and 'B'. "[^ab]" with this flag will + * match all except 'a', 'A', 'b', and 'B'. This performs a full + * closure over case mappings, e.g. U+017F for s. + * + * The resulting set is a superset of the input for the code points but + * not for the strings. + * It performs a case mapping closure of the code points and adds + * full case folding strings for the code points, and reduces strings of + * the original set to their full case folding equivalents. + * + * This is designed for case-insensitive matches, for example + * in regular expressions. The full code point case closure allows checking of + * an input character directly against the closure set. + * Strings are matched by comparing the case-folded form from the closure + * set with an incremental case folding of the string in question. + * + * The closure set will also contain single code points if the original + * set contained case-equivalent strings (like U+00DF for "ss" or "Ss" etc.). + * This is not necessary (that is, redundant) for the above matching method + * but results in the same closure sets regardless of whether the original + * set contained the code point or a string. + * + * @stable ICU 2.4 + */ + USET_CASE_INSENSITIVE = 2, + + /** + * Enable case insensitive matching. E.g., "[ab]" with this flag + * will match 'a', 'A', 'b', and 'B'. "[^ab]" with this flag will + * match all except 'a', 'A', 'b', and 'B'. This adds the lower-, + * title-, and uppercase mappings as well as the case folding + * of each existing element in the set. + * @stable ICU 3.2 + */ + USET_ADD_CASE_MAPPINGS = 4 +}; + +/** + * Argument values for whether span() and similar functions continue while + * the current character is contained vs. not contained in the set. + * + * The functionality is straightforward for sets with only single code points, + * without strings (which is the common case): + * - USET_SPAN_CONTAINED and USET_SPAN_SIMPLE work the same. + * - USET_SPAN_CONTAINED and USET_SPAN_SIMPLE are inverses of USET_SPAN_NOT_CONTAINED. + * - span() and spanBack() partition any string the same way when + * alternating between span(USET_SPAN_NOT_CONTAINED) and + * span(either "contained" condition). + * - Using a complemented (inverted) set and the opposite span conditions + * yields the same results. + * + * When a set contains multi-code point strings, then these statements may not + * be true, depending on the strings in the set (for example, whether they + * overlap with each other) and the string that is processed. + * For a set with strings: + * - The complement of the set contains the opposite set of code points, + * but the same set of strings. + * Therefore, complementing both the set and the span conditions + * may yield different results. + * - When starting spans at different positions in a string + * (span(s, ...) vs. span(s+1, ...)) the ends of the spans may be different + * because a set string may start before the later position. + * - span(USET_SPAN_SIMPLE) may be shorter than + * span(USET_SPAN_CONTAINED) because it will not recursively try + * all possible paths. + * For example, with a set which contains the three strings "xy", "xya" and "ax", + * span("xyax", USET_SPAN_CONTAINED) will return 4 but + * span("xyax", USET_SPAN_SIMPLE) will return 3. + * span(USET_SPAN_SIMPLE) will never be longer than + * span(USET_SPAN_CONTAINED). + * - With either "contained" condition, span() and spanBack() may partition + * a string in different ways. + * For example, with a set which contains the two strings "ab" and "ba", + * and when processing the string "aba", + * span() will yield contained/not-contained boundaries of { 0, 2, 3 } + * while spanBack() will yield boundaries of { 0, 1, 3 }. + * + * Note: If it is important to get the same boundaries whether iterating forward + * or backward through a string, then either only span() should be used and + * the boundaries cached for backward operation, or an ICU BreakIterator + * could be used. + * + * Note: Unpaired surrogates are treated like surrogate code points. + * Similarly, set strings match only on code point boundaries, + * never in the middle of a surrogate pair. + * Illegal UTF-8 sequences are treated like U+FFFD. + * When processing UTF-8 strings, malformed set strings + * (strings with unpaired surrogates which cannot be converted to UTF-8) + * are ignored. + * + * @stable ICU 3.8 + */ +typedef enum USetSpanCondition { + /** + * Continues a span() while there is no set element at the current position. + * Increments by one code point at a time. + * Stops before the first set element (character or string). + * (For code points only, this is like while contains(current)==FALSE). + * + * When span() returns, the substring between where it started and the position + * it returned consists only of characters that are not in the set, + * and none of its strings overlap with the span. + * + * @stable ICU 3.8 + */ + USET_SPAN_NOT_CONTAINED = 0, + /** + * Spans the longest substring that is a concatenation of set elements (characters or strings). + * (For characters only, this is like while contains(current)==TRUE). + * + * When span() returns, the substring between where it started and the position + * it returned consists only of set elements (characters or strings) that are in the set. + * + * If a set contains strings, then the span will be the longest substring for which there + * exists at least one non-overlapping concatenation of set elements (characters or strings). + * This is equivalent to a POSIX regular expression for (OR of each set element)*. + * (Java/ICU/Perl regex stops at the first match of an OR.) + * + * @stable ICU 3.8 + */ + USET_SPAN_CONTAINED = 1, + /** + * Continues a span() while there is a set element at the current position. + * Increments by the longest matching element at each position. + * (For characters only, this is like while contains(current)==TRUE). + * + * When span() returns, the substring between where it started and the position + * it returned consists only of set elements (characters or strings) that are in the set. + * + * If a set only contains single characters, then this is the same + * as USET_SPAN_CONTAINED. + * + * If a set contains strings, then the span will be the longest substring + * with a match at each position with the longest single set element (character or string). + * + * Use this span condition together with other longest-match algorithms, + * such as ICU converters (ucnv_getUnicodeSet()). + * + * @stable ICU 3.8 + */ + USET_SPAN_SIMPLE = 2, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the last span condition. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + USET_SPAN_CONDITION_COUNT +#endif // U_HIDE_DEPRECATED_API +} USetSpanCondition; + +enum { + /** + * Capacity of USerializedSet::staticArray. + * Enough for any single-code point set. + * Also provides padding for nice sizeof(USerializedSet). + * @stable ICU 2.4 + */ + USET_SERIALIZED_STATIC_ARRAY_CAPACITY=8 +}; + +/** + * A serialized form of a Unicode set. Limited manipulations are + * possible directly on a serialized set. See below. + * @stable ICU 2.4 + */ +typedef struct USerializedSet { + /** + * The serialized Unicode Set. + * @stable ICU 2.4 + */ + const uint16_t *array; + /** + * The length of the array that contains BMP characters. + * @stable ICU 2.4 + */ + int32_t bmpLength; + /** + * The total length of the array. + * @stable ICU 2.4 + */ + int32_t length; + /** + * A small buffer for the array to reduce memory allocations. + * @stable ICU 2.4 + */ + uint16_t staticArray[USET_SERIALIZED_STATIC_ARRAY_CAPACITY]; +} USerializedSet; + +/********************************************************************* + * USet API + *********************************************************************/ + +/** + * Create an empty USet object. + * Equivalent to uset_open(1, 0). + * @return a newly created USet. The caller must call uset_close() on + * it when done. + * @stable ICU 4.2 + */ +U_STABLE USet* U_EXPORT2 +uset_openEmpty(void); + +/** + * Creates a USet object that contains the range of characters + * start..end, inclusive. If start > end + * then an empty set is created (same as using uset_openEmpty()). + * @param start first character of the range, inclusive + * @param end last character of the range, inclusive + * @return a newly created USet. The caller must call uset_close() on + * it when done. + * @stable ICU 2.4 + */ +U_STABLE USet* U_EXPORT2 +uset_open(UChar32 start, UChar32 end); + +/** + * Creates a set from the given pattern. See the UnicodeSet class + * description for the syntax of the pattern language. + * @param pattern a string specifying what characters are in the set + * @param patternLength the length of the pattern, or -1 if null + * terminated + * @param ec the error code + * @stable ICU 2.4 + */ +U_STABLE USet* U_EXPORT2 +uset_openPattern(const UChar* pattern, int32_t patternLength, + UErrorCode* ec); + +/** + * Creates a set from the given pattern. See the UnicodeSet class + * description for the syntax of the pattern language. + * @param pattern a string specifying what characters are in the set + * @param patternLength the length of the pattern, or -1 if null + * terminated + * @param options bitmask for options to apply to the pattern. + * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. + * @param ec the error code + * @stable ICU 2.4 + */ +U_STABLE USet* U_EXPORT2 +uset_openPatternOptions(const UChar* pattern, int32_t patternLength, + uint32_t options, + UErrorCode* ec); + +/** + * Disposes of the storage used by a USet object. This function should + * be called exactly once for objects returned by uset_open(). + * @param set the object to dispose of + * @stable ICU 2.4 + */ +U_STABLE void U_EXPORT2 +uset_close(USet* set); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUSetPointer + * "Smart pointer" class, closes a USet via uset_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUSetPointer, USet, uset_close); + +U_NAMESPACE_END + +#endif + +/** + * Returns a copy of this object. + * If this set is frozen, then the clone will be frozen as well. + * Use uset_cloneAsThawed() for a mutable clone of a frozen set. + * @param set the original set + * @return the newly allocated copy of the set + * @see uset_cloneAsThawed + * @stable ICU 3.8 + */ +U_STABLE USet * U_EXPORT2 +uset_clone(const USet *set); + +/** + * Determines whether the set has been frozen (made immutable) or not. + * See the ICU4J Freezable interface for details. + * @param set the set + * @return TRUE/FALSE for whether the set has been frozen + * @see uset_freeze + * @see uset_cloneAsThawed + * @stable ICU 3.8 + */ +U_STABLE UBool U_EXPORT2 +uset_isFrozen(const USet *set); + +/** + * Freeze the set (make it immutable). + * Once frozen, it cannot be unfrozen and is therefore thread-safe + * until it is deleted. + * See the ICU4J Freezable interface for details. + * Freezing the set may also make some operations faster, for example + * uset_contains() and uset_span(). + * A frozen set will not be modified. (It remains frozen.) + * @param set the set + * @return the same set, now frozen + * @see uset_isFrozen + * @see uset_cloneAsThawed + * @stable ICU 3.8 + */ +U_STABLE void U_EXPORT2 +uset_freeze(USet *set); + +/** + * Clone the set and make the clone mutable. + * See the ICU4J Freezable interface for details. + * @param set the set + * @return the mutable clone + * @see uset_freeze + * @see uset_isFrozen + * @see uset_clone + * @stable ICU 3.8 + */ +U_STABLE USet * U_EXPORT2 +uset_cloneAsThawed(const USet *set); + +/** + * Causes the USet object to represent the range start - end. + * If start > end then this USet is set to an empty range. + * A frozen set will not be modified. + * @param set the object to set to the given range + * @param start first character in the set, inclusive + * @param end last character in the set, inclusive + * @stable ICU 3.2 + */ +U_STABLE void U_EXPORT2 +uset_set(USet* set, + UChar32 start, UChar32 end); + +/** + * Modifies the set to represent the set specified by the given + * pattern. See the UnicodeSet class description for the syntax of + * the pattern language. See also the User Guide chapter about UnicodeSet. + * Empties the set passed before applying the pattern. + * A frozen set will not be modified. + * @param set The set to which the pattern is to be applied. + * @param pattern A pointer to UChar string specifying what characters are in the set. + * The character at pattern[0] must be a '['. + * @param patternLength The length of the UChar string. -1 if NUL terminated. + * @param options A bitmask for options to apply to the pattern. + * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. + * @param status Returns an error if the pattern cannot be parsed. + * @return Upon successful parse, the value is either + * the index of the character after the closing ']' + * of the parsed pattern. + * If the status code indicates failure, then the return value + * is the index of the error in the source. + * + * @stable ICU 2.8 + */ +U_STABLE int32_t U_EXPORT2 +uset_applyPattern(USet *set, + const UChar *pattern, int32_t patternLength, + uint32_t options, + UErrorCode *status); + +/** + * Modifies the set to contain those code points which have the given value + * for the given binary or enumerated property, as returned by + * u_getIntPropertyValue. Prior contents of this set are lost. + * A frozen set will not be modified. + * + * @param set the object to contain the code points defined by the property + * + * @param prop a property in the range UCHAR_BIN_START..UCHAR_BIN_LIMIT-1 + * or UCHAR_INT_START..UCHAR_INT_LIMIT-1 + * or UCHAR_MASK_START..UCHAR_MASK_LIMIT-1. + * + * @param value a value in the range u_getIntPropertyMinValue(prop).. + * u_getIntPropertyMaxValue(prop), with one exception. If prop is + * UCHAR_GENERAL_CATEGORY_MASK, then value should not be a UCharCategory, but + * rather a mask value produced by U_GET_GC_MASK(). This allows grouped + * categories such as [:L:] to be represented. + * + * @param ec error code input/output parameter + * + * @stable ICU 3.2 + */ +U_STABLE void U_EXPORT2 +uset_applyIntPropertyValue(USet* set, + UProperty prop, int32_t value, UErrorCode* ec); + +/** + * Modifies the set to contain those code points which have the + * given value for the given property. Prior contents of this + * set are lost. + * A frozen set will not be modified. + * + * @param set the object to contain the code points defined by the given + * property and value alias + * + * @param prop a string specifying a property alias, either short or long. + * The name is matched loosely. See PropertyAliases.txt for names and a + * description of loose matching. If the value string is empty, then this + * string is interpreted as either a General_Category value alias, a Script + * value alias, a binary property alias, or a special ID. Special IDs are + * matched loosely and correspond to the following sets: + * + * "ANY" = [\\u0000-\\U0010FFFF], + * "ASCII" = [\\u0000-\\u007F], + * "Assigned" = [:^Cn:]. + * + * @param propLength the length of the prop, or -1 if NULL + * + * @param value a string specifying a value alias, either short or long. + * The name is matched loosely. See PropertyValueAliases.txt for names + * and a description of loose matching. In addition to aliases listed, + * numeric values and canonical combining classes may be expressed + * numerically, e.g., ("nv", "0.5") or ("ccc", "220"). The value string + * may also be empty. + * + * @param valueLength the length of the value, or -1 if NULL + * + * @param ec error code input/output parameter + * + * @stable ICU 3.2 + */ +U_STABLE void U_EXPORT2 +uset_applyPropertyAlias(USet* set, + const UChar *prop, int32_t propLength, + const UChar *value, int32_t valueLength, + UErrorCode* ec); + +/** + * Return true if the given position, in the given pattern, appears + * to be the start of a UnicodeSet pattern. + * + * @param pattern a string specifying the pattern + * @param patternLength the length of the pattern, or -1 if NULL + * @param pos the given position + * @stable ICU 3.2 + */ +U_STABLE UBool U_EXPORT2 +uset_resemblesPattern(const UChar *pattern, int32_t patternLength, + int32_t pos); + +/** + * Returns a string representation of this set. If the result of + * calling this function is passed to a uset_openPattern(), it + * will produce another set that is equal to this one. + * @param set the set + * @param result the string to receive the rules, may be NULL + * @param resultCapacity the capacity of result, may be 0 if result is NULL + * @param escapeUnprintable if TRUE then convert unprintable + * character to their hex escape representations, \\uxxxx or + * \\Uxxxxxxxx. Unprintable characters are those other than + * U+000A, U+0020..U+007E. + * @param ec error code. + * @return length of string, possibly larger than resultCapacity + * @stable ICU 2.4 + */ +U_STABLE int32_t U_EXPORT2 +uset_toPattern(const USet* set, + UChar* result, int32_t resultCapacity, + UBool escapeUnprintable, + UErrorCode* ec); + +/** + * Adds the given character to the given USet. After this call, + * uset_contains(set, c) will return TRUE. + * A frozen set will not be modified. + * @param set the object to which to add the character + * @param c the character to add + * @stable ICU 2.4 + */ +U_STABLE void U_EXPORT2 +uset_add(USet* set, UChar32 c); + +/** + * Adds all of the elements in the specified set to this set if + * they're not already present. This operation effectively + * modifies this set so that its value is the union of the two + * sets. The behavior of this operation is unspecified if the specified + * collection is modified while the operation is in progress. + * A frozen set will not be modified. + * + * @param set the object to which to add the set + * @param additionalSet the source set whose elements are to be added to this set. + * @stable ICU 2.6 + */ +U_STABLE void U_EXPORT2 +uset_addAll(USet* set, const USet *additionalSet); + +/** + * Adds the given range of characters to the given USet. After this call, + * uset_contains(set, start, end) will return TRUE. + * A frozen set will not be modified. + * @param set the object to which to add the character + * @param start the first character of the range to add, inclusive + * @param end the last character of the range to add, inclusive + * @stable ICU 2.2 + */ +U_STABLE void U_EXPORT2 +uset_addRange(USet* set, UChar32 start, UChar32 end); + +/** + * Adds the given string to the given USet. After this call, + * uset_containsString(set, str, strLen) will return TRUE. + * A frozen set will not be modified. + * @param set the object to which to add the character + * @param str the string to add + * @param strLen the length of the string or -1 if null terminated. + * @stable ICU 2.4 + */ +U_STABLE void U_EXPORT2 +uset_addString(USet* set, const UChar* str, int32_t strLen); + +/** + * Adds each of the characters in this string to the set. Thus "ch" => {"c", "h"} + * If this set already any particular character, it has no effect on that character. + * A frozen set will not be modified. + * @param set the object to which to add the character + * @param str the source string + * @param strLen the length of the string or -1 if null terminated. + * @stable ICU 3.4 + */ +U_STABLE void U_EXPORT2 +uset_addAllCodePoints(USet* set, const UChar *str, int32_t strLen); + +/** + * Removes the given character from the given USet. After this call, + * uset_contains(set, c) will return FALSE. + * A frozen set will not be modified. + * @param set the object from which to remove the character + * @param c the character to remove + * @stable ICU 2.4 + */ +U_STABLE void U_EXPORT2 +uset_remove(USet* set, UChar32 c); + +/** + * Removes the given range of characters from the given USet. After this call, + * uset_contains(set, start, end) will return FALSE. + * A frozen set will not be modified. + * @param set the object to which to add the character + * @param start the first character of the range to remove, inclusive + * @param end the last character of the range to remove, inclusive + * @stable ICU 2.2 + */ +U_STABLE void U_EXPORT2 +uset_removeRange(USet* set, UChar32 start, UChar32 end); + +/** + * Removes the given string to the given USet. After this call, + * uset_containsString(set, str, strLen) will return FALSE. + * A frozen set will not be modified. + * @param set the object to which to add the character + * @param str the string to remove + * @param strLen the length of the string or -1 if null terminated. + * @stable ICU 2.4 + */ +U_STABLE void U_EXPORT2 +uset_removeString(USet* set, const UChar* str, int32_t strLen); + +/** + * Removes from this set all of its elements that are contained in the + * specified set. This operation effectively modifies this + * set so that its value is the asymmetric set difference of + * the two sets. + * A frozen set will not be modified. + * @param set the object from which the elements are to be removed + * @param removeSet the object that defines which elements will be + * removed from this set + * @stable ICU 3.2 + */ +U_STABLE void U_EXPORT2 +uset_removeAll(USet* set, const USet* removeSet); + +/** + * Retain only the elements in this set that are contained in the + * specified range. If start > end then an empty range is + * retained, leaving the set empty. This is equivalent to + * a boolean logic AND, or a set INTERSECTION. + * A frozen set will not be modified. + * + * @param set the object for which to retain only the specified range + * @param start first character, inclusive, of range to be retained + * to this set. + * @param end last character, inclusive, of range to be retained + * to this set. + * @stable ICU 3.2 + */ +U_STABLE void U_EXPORT2 +uset_retain(USet* set, UChar32 start, UChar32 end); + +/** + * Retains only the elements in this set that are contained in the + * specified set. In other words, removes from this set all of + * its elements that are not contained in the specified set. This + * operation effectively modifies this set so that its value is + * the intersection of the two sets. + * A frozen set will not be modified. + * + * @param set the object on which to perform the retain + * @param retain set that defines which elements this set will retain + * @stable ICU 3.2 + */ +U_STABLE void U_EXPORT2 +uset_retainAll(USet* set, const USet* retain); + +/** + * Reallocate this objects internal structures to take up the least + * possible space, without changing this object's value. + * A frozen set will not be modified. + * + * @param set the object on which to perfrom the compact + * @stable ICU 3.2 + */ +U_STABLE void U_EXPORT2 +uset_compact(USet* set); + +/** + * Inverts this set. This operation modifies this set so that + * its value is its complement. This operation does not affect + * the multicharacter strings, if any. + * A frozen set will not be modified. + * @param set the set + * @stable ICU 2.4 + */ +U_STABLE void U_EXPORT2 +uset_complement(USet* set); + +/** + * Complements in this set all elements contained in the specified + * set. Any character in the other set will be removed if it is + * in this set, or will be added if it is not in this set. + * A frozen set will not be modified. + * + * @param set the set with which to complement + * @param complement set that defines which elements will be xor'ed + * from this set. + * @stable ICU 3.2 + */ +U_STABLE void U_EXPORT2 +uset_complementAll(USet* set, const USet* complement); + +/** + * Removes all of the elements from this set. This set will be + * empty after this call returns. + * A frozen set will not be modified. + * @param set the set + * @stable ICU 2.4 + */ +U_STABLE void U_EXPORT2 +uset_clear(USet* set); + +/** + * Close this set over the given attribute. For the attribute + * USET_CASE, the result is to modify this set so that: + * + * 1. For each character or string 'a' in this set, all strings or + * characters 'b' such that foldCase(a) == foldCase(b) are added + * to this set. + * + * 2. For each string 'e' in the resulting set, if e != + * foldCase(e), 'e' will be removed. + * + * Example: [aq\\u00DF{Bc}{bC}{Fi}] => [aAqQ\\u00DF\\uFB01{ss}{bc}{fi}] + * + * (Here foldCase(x) refers to the operation u_strFoldCase, and a + * == b denotes that the contents are the same, not pointer + * comparison.) + * + * A frozen set will not be modified. + * + * @param set the set + * + * @param attributes bitmask for attributes to close over. + * Currently only the USET_CASE bit is supported. Any undefined bits + * are ignored. + * @stable ICU 4.2 + */ +U_STABLE void U_EXPORT2 +uset_closeOver(USet* set, int32_t attributes); + +/** + * Remove all strings from this set. + * + * @param set the set + * @stable ICU 4.2 + */ +U_STABLE void U_EXPORT2 +uset_removeAllStrings(USet* set); + +/** + * Returns TRUE if the given USet contains no characters and no + * strings. + * @param set the set + * @return true if set is empty + * @stable ICU 2.4 + */ +U_STABLE UBool U_EXPORT2 +uset_isEmpty(const USet* set); + +/** + * Returns TRUE if the given USet contains the given character. + * This function works faster with a frozen set. + * @param set the set + * @param c The codepoint to check for within the set + * @return true if set contains c + * @stable ICU 2.4 + */ +U_STABLE UBool U_EXPORT2 +uset_contains(const USet* set, UChar32 c); + +/** + * Returns TRUE if the given USet contains all characters c + * where start <= c && c <= end. + * @param set the set + * @param start the first character of the range to test, inclusive + * @param end the last character of the range to test, inclusive + * @return TRUE if set contains the range + * @stable ICU 2.2 + */ +U_STABLE UBool U_EXPORT2 +uset_containsRange(const USet* set, UChar32 start, UChar32 end); + +/** + * Returns TRUE if the given USet contains the given string. + * @param set the set + * @param str the string + * @param strLen the length of the string or -1 if null terminated. + * @return true if set contains str + * @stable ICU 2.4 + */ +U_STABLE UBool U_EXPORT2 +uset_containsString(const USet* set, const UChar* str, int32_t strLen); + +/** + * Returns the index of the given character within this set, where + * the set is ordered by ascending code point. If the character + * is not in this set, return -1. The inverse of this method is + * charAt(). + * @param set the set + * @param c the character to obtain the index for + * @return an index from 0..size()-1, or -1 + * @stable ICU 3.2 + */ +U_STABLE int32_t U_EXPORT2 +uset_indexOf(const USet* set, UChar32 c); + +/** + * Returns the character at the given index within this set, where + * the set is ordered by ascending code point. If the index is + * out of range, return (UChar32)-1. The inverse of this method is + * indexOf(). + * @param set the set + * @param charIndex an index from 0..size()-1 to obtain the char for + * @return the character at the given index, or (UChar32)-1. + * @stable ICU 3.2 + */ +U_STABLE UChar32 U_EXPORT2 +uset_charAt(const USet* set, int32_t charIndex); + +/** + * Returns the number of characters and strings contained in the given + * USet. + * @param set the set + * @return a non-negative integer counting the characters and strings + * contained in set + * @stable ICU 2.4 + */ +U_STABLE int32_t U_EXPORT2 +uset_size(const USet* set); + +/** + * Returns the number of items in this set. An item is either a range + * of characters or a single multicharacter string. + * @param set the set + * @return a non-negative integer counting the character ranges + * and/or strings contained in set + * @stable ICU 2.4 + */ +U_STABLE int32_t U_EXPORT2 +uset_getItemCount(const USet* set); + +/** + * Returns an item of this set. An item is either a range of + * characters or a single multicharacter string. + * @param set the set + * @param itemIndex a non-negative integer in the range 0.. + * uset_getItemCount(set)-1 + * @param start pointer to variable to receive first character + * in range, inclusive + * @param end pointer to variable to receive last character in range, + * inclusive + * @param str buffer to receive the string, may be NULL + * @param strCapacity capacity of str, or 0 if str is NULL + * @param ec error code + * @return the length of the string (>= 2), or 0 if the item is a + * range, in which case it is the range *start..*end, or -1 if + * itemIndex is out of range + * @stable ICU 2.4 + */ +U_STABLE int32_t U_EXPORT2 +uset_getItem(const USet* set, int32_t itemIndex, + UChar32* start, UChar32* end, + UChar* str, int32_t strCapacity, + UErrorCode* ec); + +/** + * Returns true if set1 contains all the characters and strings + * of set2. It answers the question, 'Is set1 a superset of set2?' + * @param set1 set to be checked for containment + * @param set2 set to be checked for containment + * @return true if the test condition is met + * @stable ICU 3.2 + */ +U_STABLE UBool U_EXPORT2 +uset_containsAll(const USet* set1, const USet* set2); + +/** + * Returns true if this set contains all the characters + * of the given string. This is does not check containment of grapheme + * clusters, like uset_containsString. + * @param set set of characters to be checked for containment + * @param str string containing codepoints to be checked for containment + * @param strLen the length of the string or -1 if null terminated. + * @return true if the test condition is met + * @stable ICU 3.4 + */ +U_STABLE UBool U_EXPORT2 +uset_containsAllCodePoints(const USet* set, const UChar *str, int32_t strLen); + +/** + * Returns true if set1 contains none of the characters and strings + * of set2. It answers the question, 'Is set1 a disjoint set of set2?' + * @param set1 set to be checked for containment + * @param set2 set to be checked for containment + * @return true if the test condition is met + * @stable ICU 3.2 + */ +U_STABLE UBool U_EXPORT2 +uset_containsNone(const USet* set1, const USet* set2); + +/** + * Returns true if set1 contains some of the characters and strings + * of set2. It answers the question, 'Does set1 and set2 have an intersection?' + * @param set1 set to be checked for containment + * @param set2 set to be checked for containment + * @return true if the test condition is met + * @stable ICU 3.2 + */ +U_STABLE UBool U_EXPORT2 +uset_containsSome(const USet* set1, const USet* set2); + +/** + * Returns the length of the initial substring of the input string which + * consists only of characters and strings that are contained in this set + * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), + * or only of characters and strings that are not contained + * in this set (USET_SPAN_NOT_CONTAINED). + * See USetSpanCondition for details. + * Similar to the strspn() C library function. + * Unpaired surrogates are treated according to contains() of their surrogate code points. + * This function works faster with a frozen set and with a non-negative string length argument. + * @param set the set + * @param s start of the string + * @param length of the string; can be -1 for NUL-terminated + * @param spanCondition specifies the containment condition + * @return the length of the initial substring according to the spanCondition; + * 0 if the start of the string does not fit the spanCondition + * @stable ICU 3.8 + * @see USetSpanCondition + */ +U_STABLE int32_t U_EXPORT2 +uset_span(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition); + +/** + * Returns the start of the trailing substring of the input string which + * consists only of characters and strings that are contained in this set + * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), + * or only of characters and strings that are not contained + * in this set (USET_SPAN_NOT_CONTAINED). + * See USetSpanCondition for details. + * Unpaired surrogates are treated according to contains() of their surrogate code points. + * This function works faster with a frozen set and with a non-negative string length argument. + * @param set the set + * @param s start of the string + * @param length of the string; can be -1 for NUL-terminated + * @param spanCondition specifies the containment condition + * @return the start of the trailing substring according to the spanCondition; + * the string length if the end of the string does not fit the spanCondition + * @stable ICU 3.8 + * @see USetSpanCondition + */ +U_STABLE int32_t U_EXPORT2 +uset_spanBack(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition); + +/** + * Returns the length of the initial substring of the input string which + * consists only of characters and strings that are contained in this set + * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), + * or only of characters and strings that are not contained + * in this set (USET_SPAN_NOT_CONTAINED). + * See USetSpanCondition for details. + * Similar to the strspn() C library function. + * Malformed byte sequences are treated according to contains(0xfffd). + * This function works faster with a frozen set and with a non-negative string length argument. + * @param set the set + * @param s start of the string (UTF-8) + * @param length of the string; can be -1 for NUL-terminated + * @param spanCondition specifies the containment condition + * @return the length of the initial substring according to the spanCondition; + * 0 if the start of the string does not fit the spanCondition + * @stable ICU 3.8 + * @see USetSpanCondition + */ +U_STABLE int32_t U_EXPORT2 +uset_spanUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition spanCondition); + +/** + * Returns the start of the trailing substring of the input string which + * consists only of characters and strings that are contained in this set + * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), + * or only of characters and strings that are not contained + * in this set (USET_SPAN_NOT_CONTAINED). + * See USetSpanCondition for details. + * Malformed byte sequences are treated according to contains(0xfffd). + * This function works faster with a frozen set and with a non-negative string length argument. + * @param set the set + * @param s start of the string (UTF-8) + * @param length of the string; can be -1 for NUL-terminated + * @param spanCondition specifies the containment condition + * @return the start of the trailing substring according to the spanCondition; + * the string length if the end of the string does not fit the spanCondition + * @stable ICU 3.8 + * @see USetSpanCondition + */ +U_STABLE int32_t U_EXPORT2 +uset_spanBackUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition spanCondition); + +/** + * Returns true if set1 contains all of the characters and strings + * of set2, and vis versa. It answers the question, 'Is set1 equal to set2?' + * @param set1 set to be checked for containment + * @param set2 set to be checked for containment + * @return true if the test condition is met + * @stable ICU 3.2 + */ +U_STABLE UBool U_EXPORT2 +uset_equals(const USet* set1, const USet* set2); + +/********************************************************************* + * Serialized set API + *********************************************************************/ + +/** + * Serializes this set into an array of 16-bit integers. Serialization + * (currently) only records the characters in the set; multicharacter + * strings are ignored. + * + * The array + * has following format (each line is one 16-bit integer): + * + * length = (n+2*m) | (m!=0?0x8000:0) + * bmpLength = n; present if m!=0 + * bmp[0] + * bmp[1] + * ... + * bmp[n-1] + * supp-high[0] + * supp-low[0] + * supp-high[1] + * supp-low[1] + * ... + * supp-high[m-1] + * supp-low[m-1] + * + * The array starts with a header. After the header are n bmp + * code points, then m supplementary code points. Either n or m + * or both may be zero. n+2*m is always <= 0x7FFF. + * + * If there are no supplementary characters (if m==0) then the + * header is one 16-bit integer, 'length', with value n. + * + * If there are supplementary characters (if m!=0) then the header + * is two 16-bit integers. The first, 'length', has value + * (n+2*m)|0x8000. The second, 'bmpLength', has value n. + * + * After the header the code points are stored in ascending order. + * Supplementary code points are stored as most significant 16 + * bits followed by least significant 16 bits. + * + * @param set the set + * @param dest pointer to buffer of destCapacity 16-bit integers. + * May be NULL only if destCapacity is zero. + * @param destCapacity size of dest, or zero. Must not be negative. + * @param pErrorCode pointer to the error code. Will be set to + * U_INDEX_OUTOFBOUNDS_ERROR if n+2*m > 0x7FFF. Will be set to + * U_BUFFER_OVERFLOW_ERROR if n+2*m+(m!=0?2:1) > destCapacity. + * @return the total length of the serialized format, including + * the header, that is, n+2*m+(m!=0?2:1), or 0 on error other + * than U_BUFFER_OVERFLOW_ERROR. + * @stable ICU 2.4 + */ +U_STABLE int32_t U_EXPORT2 +uset_serialize(const USet* set, uint16_t* dest, int32_t destCapacity, UErrorCode* pErrorCode); + +/** + * Given a serialized array, fill in the given serialized set object. + * @param fillSet pointer to result + * @param src pointer to start of array + * @param srcLength length of array + * @return true if the given array is valid, otherwise false + * @stable ICU 2.4 + */ +U_STABLE UBool U_EXPORT2 +uset_getSerializedSet(USerializedSet* fillSet, const uint16_t* src, int32_t srcLength); + +/** + * Set the USerializedSet to contain the given character (and nothing + * else). + * @param fillSet pointer to result + * @param c The codepoint to set + * @stable ICU 2.4 + */ +U_STABLE void U_EXPORT2 +uset_setSerializedToOne(USerializedSet* fillSet, UChar32 c); + +/** + * Returns TRUE if the given USerializedSet contains the given + * character. + * @param set the serialized set + * @param c The codepoint to check for within the set + * @return true if set contains c + * @stable ICU 2.4 + */ +U_STABLE UBool U_EXPORT2 +uset_serializedContains(const USerializedSet* set, UChar32 c); + +/** + * Returns the number of disjoint ranges of characters contained in + * the given serialized set. Ignores any strings contained in the + * set. + * @param set the serialized set + * @return a non-negative integer counting the character ranges + * contained in set + * @stable ICU 2.4 + */ +U_STABLE int32_t U_EXPORT2 +uset_getSerializedRangeCount(const USerializedSet* set); + +/** + * Returns a range of characters contained in the given serialized + * set. + * @param set the serialized set + * @param rangeIndex a non-negative integer in the range 0.. + * uset_getSerializedRangeCount(set)-1 + * @param pStart pointer to variable to receive first character + * in range, inclusive + * @param pEnd pointer to variable to receive last character in range, + * inclusive + * @return true if rangeIndex is valid, otherwise false + * @stable ICU 2.4 + */ +U_STABLE UBool U_EXPORT2 +uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex, + UChar32* pStart, UChar32* pEnd); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/usetiter.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/usetiter.h new file mode 100644 index 0000000..d0d9918 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/usetiter.h @@ -0,0 +1,320 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (c) 2002-2014, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +*/ +#ifndef USETITER_H +#define USETITER_H + +#include "unicode/utypes.h" +#include "unicode/uobject.h" +#include "unicode/unistr.h" + +/** + * \file + * \brief C++ API: UnicodeSetIterator iterates over the contents of a UnicodeSet. + */ + +U_NAMESPACE_BEGIN + +class UnicodeSet; +class UnicodeString; + +/** + * + * UnicodeSetIterator iterates over the contents of a UnicodeSet. It + * iterates over either code points or code point ranges. After all + * code points or ranges have been returned, it returns the + * multicharacter strings of the UnicodeSet, if any. + * + * This class is not intended to be subclassed. Consider any fields + * or methods declared as "protected" to be private. The use of + * protected in this class is an artifact of history. + * + *

To iterate over code points and strings, use a loop like this: + *

+ * UnicodeSetIterator it(set);
+ * while (it.next()) {
+ *     processItem(it.getString());
+ * }
+ * 
+ *

Each item in the set is accessed as a string. Set elements + * consisting of single code points are returned as strings containing + * just the one code point. + * + *

To iterate over code point ranges, instead of individual code points, + * use a loop like this: + *

+ * UnicodeSetIterator it(set);
+ * while (it.nextRange()) {
+ *   if (it.isString()) {
+ *     processString(it.getString());
+ *   } else {
+ *     processCodepointRange(it.getCodepoint(), it.getCodepointEnd());
+ *   }
+ * }
+ * 
+ * @author M. Davis + * @stable ICU 2.4 + */ +class U_COMMON_API UnicodeSetIterator : public UObject { + + protected: + + /** + * Value of codepoint if the iterator points to a string. + * If codepoint == IS_STRING, then examine + * string for the current iteration result. + * @stable ICU 2.4 + */ + enum { IS_STRING = -1 }; + + /** + * Current code point, or the special value IS_STRING, if + * the iterator points to a string. + * @stable ICU 2.4 + */ + UChar32 codepoint; + + /** + * When iterating over ranges using nextRange(), + * codepointEnd contains the inclusive end of the + * iteration range, if codepoint != IS_STRING. If + * iterating over code points using next(), or if + * codepoint == IS_STRING, then the value of + * codepointEnd is undefined. + * @stable ICU 2.4 + */ + UChar32 codepointEnd; + + /** + * If codepoint == IS_STRING, then string points + * to the current string. If codepoint != IS_STRING, the + * value of string is undefined. + * @stable ICU 2.4 + */ + const UnicodeString* string; + + public: + + /** + * Create an iterator over the given set. The iterator is valid + * only so long as set is valid. + * @param set set to iterate over + * @stable ICU 2.4 + */ + UnicodeSetIterator(const UnicodeSet& set); + + /** + * Create an iterator over nothing. next() and + * nextRange() return false. This is a convenience + * constructor allowing the target to be set later. + * @stable ICU 2.4 + */ + UnicodeSetIterator(); + + /** + * Destructor. + * @stable ICU 2.4 + */ + virtual ~UnicodeSetIterator(); + + /** + * Returns true if the current element is a string. If so, the + * caller can retrieve it with getString(). If this + * method returns false, the current element is a code point or + * code point range, depending on whether next() or + * nextRange() was called. + * Elements of types string and codepoint can both be retrieved + * with the function getString(). + * Elements of type codepoint can also be retrieved with + * getCodepoint(). + * For ranges, getCodepoint() returns the starting codepoint + * of the range, and getCodepointEnd() returns the end + * of the range. + * @stable ICU 2.4 + */ + inline UBool isString() const; + + /** + * Returns the current code point, if isString() returned + * false. Otherwise returns an undefined result. + * @stable ICU 2.4 + */ + inline UChar32 getCodepoint() const; + + /** + * Returns the end of the current code point range, if + * isString() returned false and nextRange() was + * called. Otherwise returns an undefined result. + * @stable ICU 2.4 + */ + inline UChar32 getCodepointEnd() const; + + /** + * Returns the current string, if isString() returned + * true. If the current iteration item is a code point, a UnicodeString + * containing that single code point is returned. + * + * Ownership of the returned string remains with the iterator. + * The string is guaranteed to remain valid only until the iterator is + * advanced to the next item, or until the iterator is deleted. + * + * @stable ICU 2.4 + */ + const UnicodeString& getString(); + + /** + * Advances the iteration position to the next element in the set, + * which can be either a single code point or a string. + * If there are no more elements in the set, return false. + * + *

+ * If isString() == TRUE, the value is a + * string, otherwise the value is a + * single code point. Elements of either type can be retrieved + * with the function getString(), while elements of + * consisting of a single code point can be retrieved with + * getCodepoint() + * + *

The order of iteration is all code points in sorted order, + * followed by all strings sorted order. Do not mix + * calls to next() and nextRange() without + * calling reset() between them. The results of doing so + * are undefined. + * + * @return true if there was another element in the set. + * @stable ICU 2.4 + */ + UBool next(); + + /** + * Returns the next element in the set, either a code point range + * or a string. If there are no more elements in the set, return + * false. If isString() == TRUE, the value is a + * string and can be accessed with getString(). Otherwise the value is a + * range of one or more code points from getCodepoint() to + * getCodepointeEnd() inclusive. + * + *

The order of iteration is all code points ranges in sorted + * order, followed by all strings sorted order. Ranges are + * disjoint and non-contiguous. The value returned from getString() + * is undefined unless isString() == TRUE. Do not mix calls to + * next() and nextRange() without calling + * reset() between them. The results of doing so are + * undefined. + * + * @return true if there was another element in the set. + * @stable ICU 2.4 + */ + UBool nextRange(); + + /** + * Sets this iterator to visit the elements of the given set and + * resets it to the start of that set. The iterator is valid only + * so long as set is valid. + * @param set the set to iterate over. + * @stable ICU 2.4 + */ + void reset(const UnicodeSet& set); + + /** + * Resets this iterator to the start of the set. + * @stable ICU 2.4 + */ + void reset(); + + /** + * ICU "poor man's RTTI", returns a UClassID for this class. + * + * @stable ICU 2.4 + */ + static UClassID U_EXPORT2 getStaticClassID(); + + /** + * ICU "poor man's RTTI", returns a UClassID for the actual class. + * + * @stable ICU 2.4 + */ + virtual UClassID getDynamicClassID() const; + + // ======================= PRIVATES =========================== + + protected: + + // endElement and nextElements are really UChar32's, but we keep + // them as signed int32_t's so we can do comparisons with + // endElement set to -1. Leave them as int32_t's. + /** The set + * @stable ICU 2.4 + */ + const UnicodeSet* set; + /** End range + * @stable ICU 2.4 + */ + int32_t endRange; + /** Range + * @stable ICU 2.4 + */ + int32_t range; + /** End element + * @stable ICU 2.4 + */ + int32_t endElement; + /** Next element + * @stable ICU 2.4 + */ + int32_t nextElement; + //UBool abbreviated; + /** Next string + * @stable ICU 2.4 + */ + int32_t nextString; + /** String count + * @stable ICU 2.4 + */ + int32_t stringCount; + + /** + * Points to the string to use when the caller asks for a + * string and the current iteration item is a code point, not a string. + * @internal + */ + UnicodeString *cpString; + + /** Copy constructor. Disallowed. + * @stable ICU 2.4 + */ + UnicodeSetIterator(const UnicodeSetIterator&); // disallow + + /** Assignment operator. Disallowed. + * @stable ICU 2.4 + */ + UnicodeSetIterator& operator=(const UnicodeSetIterator&); // disallow + + /** Load range + * @stable ICU 2.4 + */ + virtual void loadRange(int32_t range); + +}; + +inline UBool UnicodeSetIterator::isString() const { + return codepoint == (UChar32)IS_STRING; +} + +inline UChar32 UnicodeSetIterator::getCodepoint() const { + return codepoint; +} + +inline UChar32 UnicodeSetIterator::getCodepointEnd() const { + return codepointEnd; +} + + +U_NAMESPACE_END + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ushape.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ushape.h new file mode 100644 index 0000000..c64fe22 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ushape.h @@ -0,0 +1,476 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +****************************************************************************** +* +* Copyright (C) 2000-2012, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* file name: ushape.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2000jun29 +* created by: Markus W. Scherer +*/ + +#ifndef __USHAPE_H__ +#define __USHAPE_H__ + +#include "unicode/utypes.h" + +/** + * \file + * \brief C API: Arabic shaping + * + */ + +/** + * Shape Arabic text on a character basis. + * + *

This function performs basic operations for "shaping" Arabic text. It is most + * useful for use with legacy data formats and legacy display technology + * (simple terminals). All operations are performed on Unicode characters.

+ * + *

Text-based shaping means that some character code points in the text are + * replaced by others depending on the context. It transforms one kind of text + * into another. In comparison, modern displays for Arabic text select + * appropriate, context-dependent font glyphs for each text element, which means + * that they transform text into a glyph vector.

+ * + *

Text transformations are necessary when modern display technology is not + * available or when text needs to be transformed to or from legacy formats that + * use "shaped" characters. Since the Arabic script is cursive, connecting + * adjacent letters to each other, computers select images for each letter based + * on the surrounding letters. This usually results in four images per Arabic + * letter: initial, middle, final, and isolated forms. In Unicode, on the other + * hand, letters are normally stored abstract, and a display system is expected + * to select the necessary glyphs. (This makes searching and other text + * processing easier because the same letter has only one code.) It is possible + * to mimic this with text transformations because there are characters in + * Unicode that are rendered as letters with a specific shape + * (or cursive connectivity). They were included for interoperability with + * legacy systems and codepages, and for unsophisticated display systems.

+ * + *

A second kind of text transformations is supported for Arabic digits: + * For compatibility with legacy codepages that only include European digits, + * it is possible to replace one set of digits by another, changing the + * character code points. These operations can be performed for either + * Arabic-Indic Digits (U+0660...U+0669) or Eastern (Extended) Arabic-Indic + * digits (U+06f0...U+06f9).

+ * + *

Some replacements may result in more or fewer characters (code points). + * By default, this means that the destination buffer may receive text with a + * length different from the source length. Some legacy systems rely on the + * length of the text to be constant. They expect extra spaces to be added + * or consumed either next to the affected character or at the end of the + * text.

+ * + *

For details about the available operations, see the description of the + * U_SHAPE_... options.

+ * + * @param source The input text. + * + * @param sourceLength The number of UChars in source. + * + * @param dest The destination buffer that will receive the results of the + * requested operations. It may be NULL only if + * destSize is 0. The source and destination must not + * overlap. + * + * @param destSize The size (capacity) of the destination buffer in UChars. + * If destSize is 0, then no output is produced, + * but the necessary buffer size is returned ("preflighting"). + * + * @param options This is a 32-bit set of flags that specify the operations + * that are performed on the input text. If no error occurs, + * then the result will always be written to the destination + * buffer. + * + * @param pErrorCode must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * + * @return The number of UChars written to the destination buffer. + * If an error occured, then no output was written, or it may be + * incomplete. If U_BUFFER_OVERFLOW_ERROR is set, then + * the return value indicates the necessary destination buffer size. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_shapeArabic(const UChar *source, int32_t sourceLength, + UChar *dest, int32_t destSize, + uint32_t options, + UErrorCode *pErrorCode); + +/** + * Memory option: allow the result to have a different length than the source. + * Affects: LamAlef options + * @stable ICU 2.0 + */ +#define U_SHAPE_LENGTH_GROW_SHRINK 0 + +/** + * Memory option: allow the result to have a different length than the source. + * Affects: LamAlef options + * This option is an alias to U_SHAPE_LENGTH_GROW_SHRINK + * @stable ICU 4.2 + */ +#define U_SHAPE_LAMALEF_RESIZE 0 + +/** + * Memory option: the result must have the same length as the source. + * If more room is necessary, then try to consume spaces next to modified characters. + * @stable ICU 2.0 + */ +#define U_SHAPE_LENGTH_FIXED_SPACES_NEAR 1 + +/** + * Memory option: the result must have the same length as the source. + * If more room is necessary, then try to consume spaces next to modified characters. + * Affects: LamAlef options + * This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_NEAR + * @stable ICU 4.2 + */ +#define U_SHAPE_LAMALEF_NEAR 1 + +/** + * Memory option: the result must have the same length as the source. + * If more room is necessary, then try to consume spaces at the end of the text. + * @stable ICU 2.0 + */ +#define U_SHAPE_LENGTH_FIXED_SPACES_AT_END 2 + +/** + * Memory option: the result must have the same length as the source. + * If more room is necessary, then try to consume spaces at the end of the text. + * Affects: LamAlef options + * This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_AT_END + * @stable ICU 4.2 + */ +#define U_SHAPE_LAMALEF_END 2 + +/** + * Memory option: the result must have the same length as the source. + * If more room is necessary, then try to consume spaces at the beginning of the text. + * @stable ICU 2.0 + */ +#define U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING 3 + +/** + * Memory option: the result must have the same length as the source. + * If more room is necessary, then try to consume spaces at the beginning of the text. + * Affects: LamAlef options + * This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING + * @stable ICU 4.2 + */ +#define U_SHAPE_LAMALEF_BEGIN 3 + + +/** + * Memory option: the result must have the same length as the source. + * Shaping Mode: For each LAMALEF character found, expand LAMALEF using space at end. + * If there is no space at end, use spaces at beginning of the buffer. If there + * is no space at beginning of the buffer, use spaces at the near (i.e. the space + * after the LAMALEF character). + * If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h) + * will be set in pErrorCode + * + * Deshaping Mode: Perform the same function as the flag equals U_SHAPE_LAMALEF_END. + * Affects: LamAlef options + * @stable ICU 4.2 + */ +#define U_SHAPE_LAMALEF_AUTO 0x10000 + +/** Bit mask for memory options. @stable ICU 2.0 */ +#define U_SHAPE_LENGTH_MASK 0x10003 /* Changed old value 3 */ + + +/** + * Bit mask for LamAlef memory options. + * @stable ICU 4.2 + */ +#define U_SHAPE_LAMALEF_MASK 0x10003 /* updated */ + +/** Direction indicator: the source is in logical (keyboard) order. @stable ICU 2.0 */ +#define U_SHAPE_TEXT_DIRECTION_LOGICAL 0 + +/** + * Direction indicator: + * the source is in visual RTL order, + * the rightmost displayed character stored first. + * This option is an alias to U_SHAPE_TEXT_DIRECTION_LOGICAL + * @stable ICU 4.2 + */ +#define U_SHAPE_TEXT_DIRECTION_VISUAL_RTL 0 + +/** + * Direction indicator: + * the source is in visual LTR order, + * the leftmost displayed character stored first. + * @stable ICU 2.0 + */ +#define U_SHAPE_TEXT_DIRECTION_VISUAL_LTR 4 + +/** Bit mask for direction indicators. @stable ICU 2.0 */ +#define U_SHAPE_TEXT_DIRECTION_MASK 4 + + +/** Letter shaping option: do not perform letter shaping. @stable ICU 2.0 */ +#define U_SHAPE_LETTERS_NOOP 0 + +/** Letter shaping option: replace abstract letter characters by "shaped" ones. @stable ICU 2.0 */ +#define U_SHAPE_LETTERS_SHAPE 8 + +/** Letter shaping option: replace "shaped" letter characters by abstract ones. @stable ICU 2.0 */ +#define U_SHAPE_LETTERS_UNSHAPE 0x10 + +/** + * Letter shaping option: replace abstract letter characters by "shaped" ones. + * The only difference with U_SHAPE_LETTERS_SHAPE is that Tashkeel letters + * are always "shaped" into the isolated form instead of the medial form + * (selecting code points from the Arabic Presentation Forms-B block). + * @stable ICU 2.0 + */ +#define U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED 0x18 + + +/** Bit mask for letter shaping options. @stable ICU 2.0 */ +#define U_SHAPE_LETTERS_MASK 0x18 + + +/** Digit shaping option: do not perform digit shaping. @stable ICU 2.0 */ +#define U_SHAPE_DIGITS_NOOP 0 + +/** + * Digit shaping option: + * Replace European digits (U+0030...) by Arabic-Indic digits. + * @stable ICU 2.0 + */ +#define U_SHAPE_DIGITS_EN2AN 0x20 + +/** + * Digit shaping option: + * Replace Arabic-Indic digits by European digits (U+0030...). + * @stable ICU 2.0 + */ +#define U_SHAPE_DIGITS_AN2EN 0x40 + +/** + * Digit shaping option: + * Replace European digits (U+0030...) by Arabic-Indic digits if the most recent + * strongly directional character is an Arabic letter + * (u_charDirection() result U_RIGHT_TO_LEFT_ARABIC [AL]).
+ * The direction of "preceding" depends on the direction indicator option. + * For the first characters, the preceding strongly directional character + * (initial state) is assumed to be not an Arabic letter + * (it is U_LEFT_TO_RIGHT [L] or U_RIGHT_TO_LEFT [R]). + * @stable ICU 2.0 + */ +#define U_SHAPE_DIGITS_ALEN2AN_INIT_LR 0x60 + +/** + * Digit shaping option: + * Replace European digits (U+0030...) by Arabic-Indic digits if the most recent + * strongly directional character is an Arabic letter + * (u_charDirection() result U_RIGHT_TO_LEFT_ARABIC [AL]).
+ * The direction of "preceding" depends on the direction indicator option. + * For the first characters, the preceding strongly directional character + * (initial state) is assumed to be an Arabic letter. + * @stable ICU 2.0 + */ +#define U_SHAPE_DIGITS_ALEN2AN_INIT_AL 0x80 + +/** Not a valid option value. May be replaced by a new option. @stable ICU 2.0 */ +#define U_SHAPE_DIGITS_RESERVED 0xa0 + +/** Bit mask for digit shaping options. @stable ICU 2.0 */ +#define U_SHAPE_DIGITS_MASK 0xe0 + + +/** Digit type option: Use Arabic-Indic digits (U+0660...U+0669). @stable ICU 2.0 */ +#define U_SHAPE_DIGIT_TYPE_AN 0 + +/** Digit type option: Use Eastern (Extended) Arabic-Indic digits (U+06f0...U+06f9). @stable ICU 2.0 */ +#define U_SHAPE_DIGIT_TYPE_AN_EXTENDED 0x100 + +/** Not a valid option value. May be replaced by a new option. @stable ICU 2.0 */ +#define U_SHAPE_DIGIT_TYPE_RESERVED 0x200 + +/** Bit mask for digit type options. @stable ICU 2.0 */ +#define U_SHAPE_DIGIT_TYPE_MASK 0x300 /* I need to change this from 0x3f00 to 0x300 */ + +/** + * Tashkeel aggregation option: + * Replaces any combination of U+0651 with one of + * U+064C, U+064D, U+064E, U+064F, U+0650 with + * U+FC5E, U+FC5F, U+FC60, U+FC61, U+FC62 consecutively. + * @stable ICU 3.6 + */ +#define U_SHAPE_AGGREGATE_TASHKEEL 0x4000 +/** Tashkeel aggregation option: do not aggregate tashkeels. @stable ICU 3.6 */ +#define U_SHAPE_AGGREGATE_TASHKEEL_NOOP 0 +/** Bit mask for tashkeel aggregation. @stable ICU 3.6 */ +#define U_SHAPE_AGGREGATE_TASHKEEL_MASK 0x4000 + +/** + * Presentation form option: + * Don't replace Arabic Presentation Forms-A and Arabic Presentation Forms-B + * characters with 0+06xx characters, before shaping. + * @stable ICU 3.6 + */ +#define U_SHAPE_PRESERVE_PRESENTATION 0x8000 +/** Presentation form option: + * Replace Arabic Presentation Forms-A and Arabic Presentationo Forms-B with + * their unshaped correspondants in range 0+06xx, before shaping. + * @stable ICU 3.6 + */ +#define U_SHAPE_PRESERVE_PRESENTATION_NOOP 0 +/** Bit mask for preserve presentation form. @stable ICU 3.6 */ +#define U_SHAPE_PRESERVE_PRESENTATION_MASK 0x8000 + +/* Seen Tail option */ +/** + * Memory option: the result must have the same length as the source. + * Shaping mode: The SEEN family character will expand into two characters using space near + * the SEEN family character(i.e. the space after the character). + * If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h) + * will be set in pErrorCode + * + * De-shaping mode: Any Seen character followed by Tail character will be + * replaced by one cell Seen and a space will replace the Tail. + * Affects: Seen options + * @stable ICU 4.2 + */ +#define U_SHAPE_SEEN_TWOCELL_NEAR 0x200000 + +/** + * Bit mask for Seen memory options. + * @stable ICU 4.2 + */ +#define U_SHAPE_SEEN_MASK 0x700000 + +/* YehHamza option */ +/** + * Memory option: the result must have the same length as the source. + * Shaping mode: The YEHHAMZA character will expand into two characters using space near it + * (i.e. the space after the character + * If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h) + * will be set in pErrorCode + * + * De-shaping mode: Any Yeh (final or isolated) character followed by Hamza character will be + * replaced by one cell YehHamza and space will replace the Hamza. + * Affects: YehHamza options + * @stable ICU 4.2 + */ +#define U_SHAPE_YEHHAMZA_TWOCELL_NEAR 0x1000000 + + +/** + * Bit mask for YehHamza memory options. + * @stable ICU 4.2 + */ +#define U_SHAPE_YEHHAMZA_MASK 0x3800000 + +/* New Tashkeel options */ +/** + * Memory option: the result must have the same length as the source. + * Shaping mode: Tashkeel characters will be replaced by spaces. + * Spaces will be placed at beginning of the buffer + * + * De-shaping mode: N/A + * Affects: Tashkeel options + * @stable ICU 4.2 + */ +#define U_SHAPE_TASHKEEL_BEGIN 0x40000 + +/** + * Memory option: the result must have the same length as the source. + * Shaping mode: Tashkeel characters will be replaced by spaces. + * Spaces will be placed at end of the buffer + * + * De-shaping mode: N/A + * Affects: Tashkeel options + * @stable ICU 4.2 + */ +#define U_SHAPE_TASHKEEL_END 0x60000 + +/** + * Memory option: allow the result to have a different length than the source. + * Shaping mode: Tashkeel characters will be removed, buffer length will shrink. + * De-shaping mode: N/A + * + * Affect: Tashkeel options + * @stable ICU 4.2 + */ +#define U_SHAPE_TASHKEEL_RESIZE 0x80000 + +/** + * Memory option: the result must have the same length as the source. + * Shaping mode: Tashkeel characters will be replaced by Tatweel if it is connected to adjacent + * characters (i.e. shaped on Tatweel) or replaced by space if it is not connected. + * + * De-shaping mode: N/A + * Affects: YehHamza options + * @stable ICU 4.2 + */ +#define U_SHAPE_TASHKEEL_REPLACE_BY_TATWEEL 0xC0000 + +/** + * Bit mask for Tashkeel replacement with Space or Tatweel memory options. + * @stable ICU 4.2 + */ +#define U_SHAPE_TASHKEEL_MASK 0xE0000 + + +/* Space location Control options */ +/** + * This option affect the meaning of BEGIN and END options. if this option is not used the default + * for BEGIN and END will be as following: + * The Default (for both Visual LTR, Visual RTL and Logical Text) + * 1. BEGIN always refers to the start address of physical memory. + * 2. END always refers to the end address of physical memory. + * + * If this option is used it will swap the meaning of BEGIN and END only for Visual LTR text. + * + * The effect on BEGIN and END Memory Options will be as following: + * A. BEGIN For Visual LTR text: This will be the beginning (right side) of the visual text( + * corresponding to the physical memory address end for Visual LTR text, Same as END in + * default behavior) + * B. BEGIN For Logical text: Same as BEGIN in default behavior. + * C. END For Visual LTR text: This will be the end (left side) of the visual text (corresponding + * to the physical memory address beginning for Visual LTR text, Same as BEGIN in default behavior. + * D. END For Logical text: Same as END in default behavior). + * Affects: All LamAlef BEGIN, END and AUTO options. + * @stable ICU 4.2 + */ +#define U_SHAPE_SPACES_RELATIVE_TO_TEXT_BEGIN_END 0x4000000 + +/** + * Bit mask for swapping BEGIN and END for Visual LTR text + * @stable ICU 4.2 + */ +#define U_SHAPE_SPACES_RELATIVE_TO_TEXT_MASK 0x4000000 + +/** + * If this option is used, shaping will use the new Unicode code point for TAIL (i.e. 0xFE73). + * If this option is not specified (Default), old unofficial Unicode TAIL code point is used (i.e. 0x200B) + * De-shaping will not use this option as it will always search for both the new Unicode code point for the + * TAIL (i.e. 0xFE73) or the old unofficial Unicode TAIL code point (i.e. 0x200B) and de-shape the + * Seen-Family letter accordingly. + * + * Shaping Mode: Only shaping. + * De-shaping Mode: N/A. + * Affects: All Seen options + * @stable ICU 4.8 + */ +#define U_SHAPE_TAIL_NEW_UNICODE 0x8000000 + +/** + * Bit mask for new Unicode Tail option + * @stable ICU 4.8 + */ +#define U_SHAPE_TAIL_TYPE_MASK 0x8000000 + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/uspoof.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/uspoof.h new file mode 100644 index 0000000..9fcfcd3 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/uspoof.h @@ -0,0 +1,1576 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +*************************************************************************** +* Copyright (C) 2008-2016, International Business Machines Corporation +* and others. All Rights Reserved. +*************************************************************************** +* file name: uspoof.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2008Feb13 +* created by: Andy Heninger +* +* Unicode Spoof Detection +*/ + +#ifndef USPOOF_H +#define USPOOF_H + +#include "unicode/utypes.h" +#include "unicode/uset.h" +#include "unicode/parseerr.h" +#include "unicode/localpointer.h" + +#if !UCONFIG_NO_NORMALIZATION + + +#if U_SHOW_CPLUSPLUS_API +#include "unicode/unistr.h" +#include "unicode/uniset.h" +#endif + + +/** + * \file + * \brief Unicode Security and Spoofing Detection, C API. + * + *

+ * This class, based on Unicode Technical Report #36 and + * Unicode Technical Standard #39, has two main functions: + * + *

    + *
  1. Checking whether two strings are visually confusable with each other, such as "Harvest" and + * "Ηarvest", where the second string starts with the Greek capital letter Eta.
  2. + *
  3. Checking whether an individual string is likely to be an attempt at confusing the reader (spoof + * detection), such as "paypal" with some Latin characters substituted with Cyrillic look-alikes.
  4. + *
+ * + *

+ * Although originally designed as a method for flagging suspicious identifier strings such as URLs, + * USpoofChecker has a number of other practical use cases, such as preventing attempts to evade bad-word + * content filters. + * + *

+ * The functions of this class are exposed as C API, with a handful of syntactical conveniences for C++. + * + *

Confusables

+ * + *

+ * The following example shows how to use USpoofChecker to check for confusability between two strings: + * + * \code{.c} + * UErrorCode status = U_ZERO_ERROR; + * UChar* str1 = (UChar*) u"Harvest"; + * UChar* str2 = (UChar*) u"\u0397arvest"; // with U+0397 GREEK CAPITAL LETTER ETA + * + * USpoofChecker* sc = uspoof_open(&status); + * uspoof_setChecks(sc, USPOOF_CONFUSABLE, &status); + * + * int32_t bitmask = uspoof_areConfusable(sc, str1, -1, str2, -1, &status); + * UBool result = bitmask != 0; + * // areConfusable: 1 (status: U_ZERO_ERROR) + * printf("areConfusable: %d (status: %s)\n", result, u_errorName(status)); + * uspoof_close(sc); + * \endcode + * + *

+ * The call to {@link uspoof_open} creates a USpoofChecker object; the call to {@link uspoof_setChecks} + * enables confusable checking and disables all other checks; the call to {@link uspoof_areConfusable} performs the + * confusability test; and the following line extracts the result out of the return value. For best performance, + * the instance should be created once (e.g., upon application startup), and the efficient + * {@link uspoof_areConfusable} method can be used at runtime. + * + *

+ * The type {@link LocalUSpoofCheckerPointer} is exposed for C++ programmers. It will automatically call + * {@link uspoof_close} when the object goes out of scope: + * + * \code{.cpp} + * UErrorCode status = U_ZERO_ERROR; + * LocalUSpoofCheckerPointer sc(uspoof_open(&status)); + * uspoof_setChecks(sc.getAlias(), USPOOF_CONFUSABLE, &status); + * // ... + * \endcode + * + *

+ * UTS 39 defines two strings to be confusable if they map to the same skeleton string. A skeleton can + * be thought of as a "hash code". {@link uspoof_getSkeleton} computes the skeleton for a particular string, so + * the following snippet is equivalent to the example above: + * + * \code{.c} + * UErrorCode status = U_ZERO_ERROR; + * UChar* str1 = (UChar*) u"Harvest"; + * UChar* str2 = (UChar*) u"\u0397arvest"; // with U+0397 GREEK CAPITAL LETTER ETA + * + * USpoofChecker* sc = uspoof_open(&status); + * uspoof_setChecks(sc, USPOOF_CONFUSABLE, &status); + * + * // Get skeleton 1 + * int32_t skel1Len = uspoof_getSkeleton(sc, 0, str1, -1, NULL, 0, &status); + * UChar* skel1 = (UChar*) malloc(++skel1Len * sizeof(UChar)); + * status = U_ZERO_ERROR; + * uspoof_getSkeleton(sc, 0, str1, -1, skel1, skel1Len, &status); + * + * // Get skeleton 2 + * int32_t skel2Len = uspoof_getSkeleton(sc, 0, str2, -1, NULL, 0, &status); + * UChar* skel2 = (UChar*) malloc(++skel2Len * sizeof(UChar)); + * status = U_ZERO_ERROR; + * uspoof_getSkeleton(sc, 0, str2, -1, skel2, skel2Len, &status); + * + * // Are the skeletons the same? + * UBool result = u_strcmp(skel1, skel2) == 0; + * // areConfusable: 1 (status: U_ZERO_ERROR) + * printf("areConfusable: %d (status: %s)\n", result, u_errorName(status)); + * uspoof_close(sc); + * free(skel1); + * free(skel2); + * \endcode + * + *

+ * If you need to check if a string is confusable with any string in a dictionary of many strings, rather than calling + * {@link uspoof_areConfusable} many times in a loop, {@link uspoof_getSkeleton} can be used instead, as shown below: + * + * \code{.c} + * UErrorCode status = U_ZERO_ERROR; + * #define DICTIONARY_LENGTH 2 + * UChar* dictionary[DICTIONARY_LENGTH] = { (UChar*) u"lorem", (UChar*) u"ipsum" }; + * UChar* skeletons[DICTIONARY_LENGTH]; + * UChar* str = (UChar*) u"1orern"; + * + * // Setup: + * USpoofChecker* sc = uspoof_open(&status); + * uspoof_setChecks(sc, USPOOF_CONFUSABLE, &status); + * for (size_t i=0; i + * Note: Since the Unicode confusables mapping table is frequently updated, confusable skeletons are not + * guaranteed to be the same between ICU releases. We therefore recommend that you always compute confusable skeletons + * at runtime and do not rely on creating a permanent, or difficult to update, database of skeletons. + * + *

Spoof Detection

+ * + *

+ * The following snippet shows a minimal example of using USpoofChecker to perform spoof detection on a + * string: + * + * \code{.c} + * UErrorCode status = U_ZERO_ERROR; + * UChar* str = (UChar*) u"p\u0430ypal"; // with U+0430 CYRILLIC SMALL LETTER A + * + * // Get the default set of allowable characters: + * USet* allowed = uset_openEmpty(); + * uset_addAll(allowed, uspoof_getRecommendedSet(&status)); + * uset_addAll(allowed, uspoof_getInclusionSet(&status)); + * + * USpoofChecker* sc = uspoof_open(&status); + * uspoof_setAllowedChars(sc, allowed, &status); + * uspoof_setRestrictionLevel(sc, USPOOF_MODERATELY_RESTRICTIVE); + * + * int32_t bitmask = uspoof_check(sc, str, -1, NULL, &status); + * UBool result = bitmask != 0; + * // fails checks: 1 (status: U_ZERO_ERROR) + * printf("fails checks: %d (status: %s)\n", result, u_errorName(status)); + * uspoof_close(sc); + * uset_close(allowed); + * \endcode + * + *

+ * As in the case for confusability checking, it is good practice to create one USpoofChecker instance at + * startup, and call the cheaper {@link uspoof_check} online. We specify the set of + * allowed characters to be those with type RECOMMENDED or INCLUSION, according to the recommendation in UTS 39. + * + *

+ * In addition to {@link uspoof_check}, the function {@link uspoof_checkUTF8} is exposed for UTF8-encoded char* strings, + * and {@link uspoof_checkUnicodeString} is exposed for C++ programmers. + * + *

+ * If the {@link USPOOF_AUX_INFO} check is enabled, a limited amount of information on why a string failed the checks + * is available in the returned bitmask. For complete information, use the {@link uspoof_check2} class of functions + * with a {@link USpoofCheckResult} parameter: + * + * \code{.c} + * UErrorCode status = U_ZERO_ERROR; + * UChar* str = (UChar*) u"p\u0430ypal"; // with U+0430 CYRILLIC SMALL LETTER A + * + * // Get the default set of allowable characters: + * USet* allowed = uset_openEmpty(); + * uset_addAll(allowed, uspoof_getRecommendedSet(&status)); + * uset_addAll(allowed, uspoof_getInclusionSet(&status)); + * + * USpoofChecker* sc = uspoof_open(&status); + * uspoof_setAllowedChars(sc, allowed, &status); + * uspoof_setRestrictionLevel(sc, USPOOF_MODERATELY_RESTRICTIVE); + * + * USpoofCheckResult* checkResult = uspoof_openCheckResult(&status); + * int32_t bitmask = uspoof_check2(sc, str, -1, checkResult, &status); + * + * int32_t failures1 = bitmask; + * int32_t failures2 = uspoof_getCheckResultChecks(checkResult, &status); + * assert(failures1 == failures2); + * // checks that failed: 0x00000010 (status: U_ZERO_ERROR) + * printf("checks that failed: %#010x (status: %s)\n", failures1, u_errorName(status)); + * + * // Cleanup: + * uspoof_close(sc); + * uset_close(allowed); + * uspoof_closeCheckResult(checkResult); + * \endcode + * + * C++ users can take advantage of a few syntactical conveniences. The following snippet is functionally + * equivalent to the one above: + * + * \code{.cpp} + * UErrorCode status = U_ZERO_ERROR; + * UnicodeString str((UChar*) u"p\u0430ypal"); // with U+0430 CYRILLIC SMALL LETTER A + * + * // Get the default set of allowable characters: + * UnicodeSet allowed; + * allowed.addAll(*uspoof_getRecommendedUnicodeSet(&status)); + * allowed.addAll(*uspoof_getInclusionUnicodeSet(&status)); + * + * LocalUSpoofCheckerPointer sc(uspoof_open(&status)); + * uspoof_setAllowedChars(sc.getAlias(), allowed.toUSet(), &status); + * uspoof_setRestrictionLevel(sc.getAlias(), USPOOF_MODERATELY_RESTRICTIVE); + * + * LocalUSpoofCheckResultPointer checkResult(uspoof_openCheckResult(&status)); + * int32_t bitmask = uspoof_check2UnicodeString(sc.getAlias(), str, checkResult.getAlias(), &status); + * + * int32_t failures1 = bitmask; + * int32_t failures2 = uspoof_getCheckResultChecks(checkResult.getAlias(), &status); + * assert(failures1 == failures2); + * // checks that failed: 0x00000010 (status: U_ZERO_ERROR) + * printf("checks that failed: %#010x (status: %s)\n", failures1, u_errorName(status)); + * + * // Explicit cleanup not necessary. + * \endcode + * + *

+ * The return value is a bitmask of the checks that failed. In this case, there was one check that failed: + * {@link USPOOF_RESTRICTION_LEVEL}, corresponding to the fifth bit (16). The possible checks are: + * + *

    + *
  • RESTRICTION_LEVEL: flags strings that violate the + * Restriction Level test as specified in UTS + * 39; in most cases, this means flagging strings that contain characters from multiple different scripts.
  • + *
  • INVISIBLE: flags strings that contain invisible characters, such as zero-width spaces, or character + * sequences that are likely not to display, such as multiple occurrences of the same non-spacing mark.
  • + *
  • CHAR_LIMIT: flags strings that contain characters outside of a specified set of acceptable + * characters. See {@link uspoof_setAllowedChars} and {@link uspoof_setAllowedLocales}.
  • + *
  • MIXED_NUMBERS: flags strings that contain digits from multiple different numbering systems.
  • + *
+ * + *

+ * These checks can be enabled independently of each other. For example, if you were interested in checking for only the + * INVISIBLE and MIXED_NUMBERS conditions, you could do: + * + * \code{.c} + * UErrorCode status = U_ZERO_ERROR; + * UChar* str = (UChar*) u"8\u09EA"; // 8 mixed with U+09EA BENGALI DIGIT FOUR + * + * USpoofChecker* sc = uspoof_open(&status); + * uspoof_setChecks(sc, USPOOF_INVISIBLE | USPOOF_MIXED_NUMBERS, &status); + * + * int32_t bitmask = uspoof_check2(sc, str, -1, NULL, &status); + * UBool result = bitmask != 0; + * // fails checks: 1 (status: U_ZERO_ERROR) + * printf("fails checks: %d (status: %s)\n", result, u_errorName(status)); + * uspoof_close(sc); + * \endcode + * + *

+ * Here is an example in C++ showing how to compute the restriction level of a string: + * + * \code{.cpp} + * UErrorCode status = U_ZERO_ERROR; + * UnicodeString str((UChar*) u"p\u0430ypal"); // with U+0430 CYRILLIC SMALL LETTER A + * + * // Get the default set of allowable characters: + * UnicodeSet allowed; + * allowed.addAll(*uspoof_getRecommendedUnicodeSet(&status)); + * allowed.addAll(*uspoof_getInclusionUnicodeSet(&status)); + * + * LocalUSpoofCheckerPointer sc(uspoof_open(&status)); + * uspoof_setAllowedChars(sc.getAlias(), allowed.toUSet(), &status); + * uspoof_setRestrictionLevel(sc.getAlias(), USPOOF_MODERATELY_RESTRICTIVE); + * uspoof_setChecks(sc.getAlias(), USPOOF_RESTRICTION_LEVEL | USPOOF_AUX_INFO, &status); + * + * LocalUSpoofCheckResultPointer checkResult(uspoof_openCheckResult(&status)); + * int32_t bitmask = uspoof_check2UnicodeString(sc.getAlias(), str, checkResult.getAlias(), &status); + * + * URestrictionLevel restrictionLevel = uspoof_getCheckResultRestrictionLevel(checkResult.getAlias(), &status); + * // Since USPOOF_AUX_INFO was enabled, the restriction level is also available in the upper bits of the bitmask: + * assert((restrictionLevel & bitmask) == restrictionLevel); + * // Restriction level: 0x50000000 (status: U_ZERO_ERROR) + * printf("Restriction level: %#010x (status: %s)\n", restrictionLevel, u_errorName(status)); + * \endcode + * + *

+ * The code '0x50000000' corresponds to the restriction level USPOOF_MINIMALLY_RESTRICTIVE. Since + * USPOOF_MINIMALLY_RESTRICTIVE is weaker than USPOOF_MODERATELY_RESTRICTIVE, the string fails the check. + * + *

+ * Note: The Restriction Level is the most powerful of the checks. The full logic is documented in + * UTS 39, but the basic idea is that strings + * are restricted to contain characters from only a single script, except that most scripts are allowed to have + * Latin characters interspersed. Although the default restriction level is HIGHLY_RESTRICTIVE, it is + * recommended that users set their restriction level to MODERATELY_RESTRICTIVE, which allows Latin mixed + * with all other scripts except Cyrillic, Greek, and Cherokee, with which it is often confusable. For more details on + * the levels, see UTS 39 or {@link URestrictionLevel}. The Restriction Level test is aware of the set of + * allowed characters set in {@link uspoof_setAllowedChars}. Note that characters which have script code + * COMMON or INHERITED, such as numbers and punctuation, are ignored when computing whether a string has multiple + * scripts. + * + *

Additional Information

+ * + *

+ * A USpoofChecker instance may be used repeatedly to perform checks on any number of identifiers. + * + *

+ * Thread Safety: The test functions for checking a single identifier, or for testing whether + * two identifiers are possible confusable, are thread safe. They may called concurrently, from multiple threads, + * using the same USpoofChecker instance. + * + *

+ * More generally, the standard ICU thread safety rules apply: functions that take a const USpoofChecker parameter are + * thread safe. Those that take a non-const USpoofChecker are not thread safe.. + * + * @stable ICU 4.6 + */ + +struct USpoofChecker; +/** + * @stable ICU 4.2 + */ +typedef struct USpoofChecker USpoofChecker; /**< typedef for C of USpoofChecker */ + +struct USpoofCheckResult; +/** + * @see uspoof_openCheckResult + * @stable ICU 58 + */ +typedef struct USpoofCheckResult USpoofCheckResult; + +/** + * Enum for the kinds of checks that USpoofChecker can perform. + * These enum values are used both to select the set of checks that + * will be performed, and to report results from the check function. + * + * @stable ICU 4.2 + */ +typedef enum USpoofChecks { + /** + * When performing the two-string {@link uspoof_areConfusable} test, this flag in the return value indicates + * that the two strings are visually confusable and that they are from the same script, according to UTS 39 section + * 4. + * + * @see uspoof_areConfusable + * @stable ICU 4.2 + */ + USPOOF_SINGLE_SCRIPT_CONFUSABLE = 1, + + /** + * When performing the two-string {@link uspoof_areConfusable} test, this flag in the return value indicates + * that the two strings are visually confusable and that they are not from the same script, according to UTS + * 39 section 4. + * + * @see uspoof_areConfusable + * @stable ICU 4.2 + */ + USPOOF_MIXED_SCRIPT_CONFUSABLE = 2, + + /** + * When performing the two-string {@link uspoof_areConfusable} test, this flag in the return value indicates + * that the two strings are visually confusable and that they are not from the same script but both of them are + * single-script strings, according to UTS 39 section 4. + * + * @see uspoof_areConfusable + * @stable ICU 4.2 + */ + USPOOF_WHOLE_SCRIPT_CONFUSABLE = 4, + + /** + * Enable this flag in {@link uspoof_setChecks} to turn on all types of confusables. You may set + * the checks to some subset of SINGLE_SCRIPT_CONFUSABLE, MIXED_SCRIPT_CONFUSABLE, or WHOLE_SCRIPT_CONFUSABLE to + * make {@link uspoof_areConfusable} return only those types of confusables. + * + * @see uspoof_areConfusable + * @see uspoof_getSkeleton + * @stable ICU 58 + */ + USPOOF_CONFUSABLE = USPOOF_SINGLE_SCRIPT_CONFUSABLE | USPOOF_MIXED_SCRIPT_CONFUSABLE | USPOOF_WHOLE_SCRIPT_CONFUSABLE, + +#ifndef U_HIDE_DEPRECATED_API + /** + * This flag is deprecated and no longer affects the behavior of SpoofChecker. + * + * @deprecated ICU 58 Any case confusable mappings were removed from UTS 39; the corresponding ICU API was deprecated. + */ + USPOOF_ANY_CASE = 8, +#endif /* U_HIDE_DEPRECATED_API */ + + /** + * Check that an identifier is no looser than the specified RestrictionLevel. + * The default if {@link uspoof_setRestrictionLevel} is not called is HIGHLY_RESTRICTIVE. + * + * If USPOOF_AUX_INFO is enabled the actual restriction level of the + * identifier being tested will also be returned by uspoof_check(). + * + * @see URestrictionLevel + * @see uspoof_setRestrictionLevel + * @see USPOOF_AUX_INFO + * + * @stable ICU 51 + */ + USPOOF_RESTRICTION_LEVEL = 16, + +#ifndef U_HIDE_DEPRECATED_API + /** Check that an identifier contains only characters from a + * single script (plus chars from the common and inherited scripts.) + * Applies to checks of a single identifier check only. + * @deprecated ICU 51 Use RESTRICTION_LEVEL instead. + */ + USPOOF_SINGLE_SCRIPT = USPOOF_RESTRICTION_LEVEL, +#endif /* U_HIDE_DEPRECATED_API */ + + /** Check an identifier for the presence of invisible characters, + * such as zero-width spaces, or character sequences that are + * likely not to display, such as multiple occurrences of the same + * non-spacing mark. This check does not test the input string as a whole + * for conformance to any particular syntax for identifiers. + */ + USPOOF_INVISIBLE = 32, + + /** Check that an identifier contains only characters from a specified set + * of acceptable characters. See {@link uspoof_setAllowedChars} and + * {@link uspoof_setAllowedLocales}. Note that a string that fails this check + * will also fail the {@link USPOOF_RESTRICTION_LEVEL} check. + */ + USPOOF_CHAR_LIMIT = 64, + + /** + * Check that an identifier does not mix numbers from different numbering systems. + * For more information, see UTS 39 section 5.3. + * + * @stable ICU 51 + */ + USPOOF_MIXED_NUMBERS = 128, + + /** + * Enable all spoof checks. + * + * @stable ICU 4.6 + */ + USPOOF_ALL_CHECKS = 0xFFFF, + + /** + * Enable the return of auxillary (non-error) information in the + * upper bits of the check results value. + * + * If this "check" is not enabled, the results of {@link uspoof_check} will be + * zero when an identifier passes all of the enabled checks. + * + * If this "check" is enabled, (uspoof_check() & {@link USPOOF_ALL_CHECKS}) will + * be zero when an identifier passes all checks. + * + * @stable ICU 51 + */ + USPOOF_AUX_INFO = 0x40000000 + + } USpoofChecks; + + + /** + * Constants from UAX #39 for use in {@link uspoof_setRestrictionLevel}, and + * for returned identifier restriction levels in check results. + * + * @stable ICU 51 + * + * @see uspoof_setRestrictionLevel + * @see uspoof_check + */ + typedef enum URestrictionLevel { + /** + * All characters in the string are in the identifier profile and all characters in the string are in the + * ASCII range. + * + * @stable ICU 51 + */ + USPOOF_ASCII = 0x10000000, + /** + * The string classifies as ASCII-Only, or all characters in the string are in the identifier profile and + * the string is single-script, according to the definition in UTS 39 section 5.1. + * + * @stable ICU 53 + */ + USPOOF_SINGLE_SCRIPT_RESTRICTIVE = 0x20000000, + /** + * The string classifies as Single Script, or all characters in the string are in the identifier profile and + * the string is covered by any of the following sets of scripts, according to the definition in UTS 39 + * section 5.1: + *

    + *
  • Latin + Han + Bopomofo (or equivalently: Latn + Hanb)
  • + *
  • Latin + Han + Hiragana + Katakana (or equivalently: Latn + Jpan)
  • + *
  • Latin + Han + Hangul (or equivalently: Latn +Kore)
  • + *
+ * This is the default restriction in ICU. + * + * @stable ICU 51 + */ + USPOOF_HIGHLY_RESTRICTIVE = 0x30000000, + /** + * The string classifies as Highly Restrictive, or all characters in the string are in the identifier profile + * and the string is covered by Latin and any one other Recommended or Aspirational script, except Cyrillic, + * Greek, and Cherokee. + * + * @stable ICU 51 + */ + USPOOF_MODERATELY_RESTRICTIVE = 0x40000000, + /** + * All characters in the string are in the identifier profile. Allow arbitrary mixtures of scripts. + * + * @stable ICU 51 + */ + USPOOF_MINIMALLY_RESTRICTIVE = 0x50000000, + /** + * Any valid identifiers, including characters outside of the Identifier Profile. + * + * @stable ICU 51 + */ + USPOOF_UNRESTRICTIVE = 0x60000000, + /** + * Mask for selecting the Restriction Level bits from the return value of {@link uspoof_check}. + * + * @stable ICU 53 + */ + USPOOF_RESTRICTION_LEVEL_MASK = 0x7F000000, +#ifndef U_HIDE_INTERNAL_API + /** + * An undefined restriction level. + * @internal + */ + USPOOF_UNDEFINED_RESTRICTIVE = -1 +#endif /* U_HIDE_INTERNAL_API */ + } URestrictionLevel; + +/** + * Create a Unicode Spoof Checker, configured to perform all + * checks except for USPOOF_LOCALE_LIMIT and USPOOF_CHAR_LIMIT. + * Note that additional checks may be added in the future, + * resulting in the changes to the default checking behavior. + * + * @param status The error code, set if this function encounters a problem. + * @return the newly created Spoof Checker + * @stable ICU 4.2 + */ +U_STABLE USpoofChecker * U_EXPORT2 +uspoof_open(UErrorCode *status); + + +/** + * Open a Spoof checker from its serialized form, stored in 32-bit-aligned memory. + * Inverse of uspoof_serialize(). + * The memory containing the serialized data must remain valid and unchanged + * as long as the spoof checker, or any cloned copies of the spoof checker, + * are in use. Ownership of the memory remains with the caller. + * The spoof checker (and any clones) must be closed prior to deleting the + * serialized data. + * + * @param data a pointer to 32-bit-aligned memory containing the serialized form of spoof data + * @param length the number of bytes available at data; + * can be more than necessary + * @param pActualLength receives the actual number of bytes at data taken up by the data; + * can be NULL + * @param pErrorCode ICU error code + * @return the spoof checker. + * + * @see uspoof_open + * @see uspoof_serialize + * @stable ICU 4.2 + */ +U_STABLE USpoofChecker * U_EXPORT2 +uspoof_openFromSerialized(const void *data, int32_t length, int32_t *pActualLength, + UErrorCode *pErrorCode); + +/** + * Open a Spoof Checker from the source form of the spoof data. + * The input corresponds to the Unicode data file confusables.txt + * as described in Unicode UAX #39. The syntax of the source data + * is as described in UAX #39 for this file, and the content of + * this file is acceptable input. + * + * The character encoding of the (char *) input text is UTF-8. + * + * @param confusables a pointer to the confusable characters definitions, + * as found in file confusables.txt from unicode.org. + * @param confusablesLen The length of the confusables text, or -1 if the + * input string is zero terminated. + * @param confusablesWholeScript + * Deprecated in ICU 58. No longer used. + * @param confusablesWholeScriptLen + * Deprecated in ICU 58. No longer used. + * @param errType In the event of an error in the input, indicates + * which of the input files contains the error. + * The value is one of USPOOF_SINGLE_SCRIPT_CONFUSABLE or + * USPOOF_WHOLE_SCRIPT_CONFUSABLE, or + * zero if no errors are found. + * @param pe In the event of an error in the input, receives the position + * in the input text (line, offset) of the error. + * @param status an in/out ICU UErrorCode. Among the possible errors is + * U_PARSE_ERROR, which is used to report syntax errors + * in the input. + * @return A spoof checker that uses the rules from the input files. + * @stable ICU 4.2 + */ +U_STABLE USpoofChecker * U_EXPORT2 +uspoof_openFromSource(const char *confusables, int32_t confusablesLen, + const char *confusablesWholeScript, int32_t confusablesWholeScriptLen, + int32_t *errType, UParseError *pe, UErrorCode *status); + + +/** + * Close a Spoof Checker, freeing any memory that was being held by + * its implementation. + * @stable ICU 4.2 + */ +U_STABLE void U_EXPORT2 +uspoof_close(USpoofChecker *sc); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUSpoofCheckerPointer + * "Smart pointer" class, closes a USpoofChecker via uspoof_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUSpoofCheckerPointer, USpoofChecker, uspoof_close); + +U_NAMESPACE_END + +#endif + +/** + * Clone a Spoof Checker. The clone will be set to perform the same checks + * as the original source. + * + * @param sc The source USpoofChecker + * @param status The error code, set if this function encounters a problem. + * @return + * @stable ICU 4.2 + */ +U_STABLE USpoofChecker * U_EXPORT2 +uspoof_clone(const USpoofChecker *sc, UErrorCode *status); + + +/** + * Specify the bitmask of checks that will be performed by {@link uspoof_check}. Calling this method + * overwrites any checks that may have already been enabled. By default, all checks are enabled. + * + * To enable specific checks and disable all others, the "whitelisted" checks should be ORed together. For + * example, to fail strings containing characters outside of the set specified by {@link uspoof_setAllowedChars} and + * also strings that contain digits from mixed numbering systems: + * + *
+ * {@code
+ * uspoof_setChecks(USPOOF_CHAR_LIMIT | USPOOF_MIXED_NUMBERS);
+ * }
+ * 
+ * + * To disable specific checks and enable all others, the "blacklisted" checks should be ANDed away from + * ALL_CHECKS. For example, if you are not planning to use the {@link uspoof_areConfusable} functionality, + * it is good practice to disable the CONFUSABLE check: + * + *
+ * {@code
+ * uspoof_setChecks(USPOOF_ALL_CHECKS & ~USPOOF_CONFUSABLE);
+ * }
+ * 
+ * + * Note that methods such as {@link uspoof_setAllowedChars}, {@link uspoof_setAllowedLocales}, and + * {@link uspoof_setRestrictionLevel} will enable certain checks when called. Those methods will OR the check they + * enable onto the existing bitmask specified by this method. For more details, see the documentation of those + * methods. + * + * @param sc The USpoofChecker + * @param checks The set of checks that this spoof checker will perform. + * The value is a bit set, obtained by OR-ing together + * values from enum USpoofChecks. + * @param status The error code, set if this function encounters a problem. + * @stable ICU 4.2 + * + */ +U_STABLE void U_EXPORT2 +uspoof_setChecks(USpoofChecker *sc, int32_t checks, UErrorCode *status); + +/** + * Get the set of checks that this Spoof Checker has been configured to perform. + * + * @param sc The USpoofChecker + * @param status The error code, set if this function encounters a problem. + * @return The set of checks that this spoof checker will perform. + * The value is a bit set, obtained by OR-ing together + * values from enum USpoofChecks. + * @stable ICU 4.2 + * + */ +U_STABLE int32_t U_EXPORT2 +uspoof_getChecks(const USpoofChecker *sc, UErrorCode *status); + +/** + * Set the loosest restriction level allowed for strings. The default if this is not called is + * {@link USPOOF_HIGHLY_RESTRICTIVE}. Calling this method enables the {@link USPOOF_RESTRICTION_LEVEL} and + * {@link USPOOF_MIXED_NUMBERS} checks, corresponding to Sections 5.1 and 5.2 of UTS 39. To customize which checks are + * to be performed by {@link uspoof_check}, see {@link uspoof_setChecks}. + * + * @param sc The USpoofChecker + * @param restrictionLevel The loosest restriction level allowed. + * @see URestrictionLevel + * @stable ICU 51 + */ +U_STABLE void U_EXPORT2 +uspoof_setRestrictionLevel(USpoofChecker *sc, URestrictionLevel restrictionLevel); + + +/** + * Get the Restriction Level that will be tested if the checks include {@link USPOOF_RESTRICTION_LEVEL}. + * + * @return The restriction level + * @see URestrictionLevel + * @stable ICU 51 + */ +U_STABLE URestrictionLevel U_EXPORT2 +uspoof_getRestrictionLevel(const USpoofChecker *sc); + +/** + * Limit characters that are acceptable in identifiers being checked to those + * normally used with the languages associated with the specified locales. + * Any previously specified list of locales is replaced by the new settings. + * + * A set of languages is determined from the locale(s), and + * from those a set of acceptable Unicode scripts is determined. + * Characters from this set of scripts, along with characters from + * the "common" and "inherited" Unicode Script categories + * will be permitted. + * + * Supplying an empty string removes all restrictions; + * characters from any script will be allowed. + * + * The {@link USPOOF_CHAR_LIMIT} test is automatically enabled for this + * USpoofChecker when calling this function with a non-empty list + * of locales. + * + * The Unicode Set of characters that will be allowed is accessible + * via the uspoof_getAllowedChars() function. uspoof_setAllowedLocales() + * will replace any previously applied set of allowed characters. + * + * Adjustments, such as additions or deletions of certain classes of characters, + * can be made to the result of uspoof_setAllowedLocales() by + * fetching the resulting set with uspoof_getAllowedChars(), + * manipulating it with the Unicode Set API, then resetting the + * spoof detectors limits with uspoof_setAllowedChars(). + * + * @param sc The USpoofChecker + * @param localesList A list list of locales, from which the language + * and associated script are extracted. The locales + * are comma-separated if there is more than one. + * White space may not appear within an individual locale, + * but is ignored otherwise. + * The locales are syntactically like those from the + * HTTP Accept-Language header. + * If the localesList is empty, no restrictions will be placed on + * the allowed characters. + * + * @param status The error code, set if this function encounters a problem. + * @stable ICU 4.2 + */ +U_STABLE void U_EXPORT2 +uspoof_setAllowedLocales(USpoofChecker *sc, const char *localesList, UErrorCode *status); + +/** + * Get a list of locales for the scripts that are acceptable in strings + * to be checked. If no limitations on scripts have been specified, + * an empty string will be returned. + * + * uspoof_setAllowedChars() will reset the list of allowed to be empty. + * + * The format of the returned list is the same as that supplied to + * uspoof_setAllowedLocales(), but returned list may not be identical + * to the originally specified string; the string may be reformatted, + * and information other than languages from + * the originally specified locales may be omitted. + * + * @param sc The USpoofChecker + * @param status The error code, set if this function encounters a problem. + * @return A string containing a list of locales corresponding + * to the acceptable scripts, formatted like an + * HTTP Accept Language value. + * + * @stable ICU 4.2 + */ +U_STABLE const char * U_EXPORT2 +uspoof_getAllowedLocales(USpoofChecker *sc, UErrorCode *status); + + +/** + * Limit the acceptable characters to those specified by a Unicode Set. + * Any previously specified character limit is + * is replaced by the new settings. This includes limits on + * characters that were set with the uspoof_setAllowedLocales() function. + * + * The USPOOF_CHAR_LIMIT test is automatically enabled for this + * USpoofChecker by this function. + * + * @param sc The USpoofChecker + * @param chars A Unicode Set containing the list of + * characters that are permitted. Ownership of the set + * remains with the caller. The incoming set is cloned by + * this function, so there are no restrictions on modifying + * or deleting the USet after calling this function. + * @param status The error code, set if this function encounters a problem. + * @stable ICU 4.2 + */ +U_STABLE void U_EXPORT2 +uspoof_setAllowedChars(USpoofChecker *sc, const USet *chars, UErrorCode *status); + + +/** + * Get a USet for the characters permitted in an identifier. + * This corresponds to the limits imposed by the Set Allowed Characters + * functions. Limitations imposed by other checks will not be + * reflected in the set returned by this function. + * + * The returned set will be frozen, meaning that it cannot be modified + * by the caller. + * + * Ownership of the returned set remains with the Spoof Detector. The + * returned set will become invalid if the spoof detector is closed, + * or if a new set of allowed characters is specified. + * + * + * @param sc The USpoofChecker + * @param status The error code, set if this function encounters a problem. + * @return A USet containing the characters that are permitted by + * the USPOOF_CHAR_LIMIT test. + * @stable ICU 4.2 + */ +U_STABLE const USet * U_EXPORT2 +uspoof_getAllowedChars(const USpoofChecker *sc, UErrorCode *status); + + +#if U_SHOW_CPLUSPLUS_API +/** + * Limit the acceptable characters to those specified by a Unicode Set. + * Any previously specified character limit is + * is replaced by the new settings. This includes limits on + * characters that were set with the uspoof_setAllowedLocales() function. + * + * The USPOOF_CHAR_LIMIT test is automatically enabled for this + * USoofChecker by this function. + * + * @param sc The USpoofChecker + * @param chars A Unicode Set containing the list of + * characters that are permitted. Ownership of the set + * remains with the caller. The incoming set is cloned by + * this function, so there are no restrictions on modifying + * or deleting the UnicodeSet after calling this function. + * @param status The error code, set if this function encounters a problem. + * @stable ICU 4.2 + */ +U_STABLE void U_EXPORT2 +uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const icu::UnicodeSet *chars, UErrorCode *status); + + +/** + * Get a UnicodeSet for the characters permitted in an identifier. + * This corresponds to the limits imposed by the Set Allowed Characters / + * UnicodeSet functions. Limitations imposed by other checks will not be + * reflected in the set returned by this function. + * + * The returned set will be frozen, meaning that it cannot be modified + * by the caller. + * + * Ownership of the returned set remains with the Spoof Detector. The + * returned set will become invalid if the spoof detector is closed, + * or if a new set of allowed characters is specified. + * + * + * @param sc The USpoofChecker + * @param status The error code, set if this function encounters a problem. + * @return A UnicodeSet containing the characters that are permitted by + * the USPOOF_CHAR_LIMIT test. + * @stable ICU 4.2 + */ +U_STABLE const icu::UnicodeSet * U_EXPORT2 +uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status); +#endif + + +/** + * Check the specified string for possible security issues. + * The text to be checked will typically be an identifier of some sort. + * The set of checks to be performed is specified with uspoof_setChecks(). + * + * \note + * Consider using the newer API, {@link uspoof_check2}, instead. + * The newer API exposes additional information from the check procedure + * and is otherwise identical to this method. + * + * @param sc The USpoofChecker + * @param id The identifier to be checked for possible security issues, + * in UTF-16 format. + * @param length the length of the string to be checked, expressed in + * 16 bit UTF-16 code units, or -1 if the string is + * zero terminated. + * @param position Deprecated in ICU 51. Always returns zero. + * Originally, an out parameter for the index of the first + * string position that failed a check. + * This parameter may be NULL. + * @param status The error code, set if an error occurred while attempting to + * perform the check. + * Spoofing or security issues detected with the input string are + * not reported here, but through the function's return value. + * @return An integer value with bits set for any potential security + * or spoofing issues detected. The bits are defined by + * enum USpoofChecks. (returned_value & USPOOF_ALL_CHECKS) + * will be zero if the input string passes all of the + * enabled checks. + * @see uspoof_check2 + * @stable ICU 4.2 + */ +U_STABLE int32_t U_EXPORT2 +uspoof_check(const USpoofChecker *sc, + const UChar *id, int32_t length, + int32_t *position, + UErrorCode *status); + + +/** + * Check the specified string for possible security issues. + * The text to be checked will typically be an identifier of some sort. + * The set of checks to be performed is specified with uspoof_setChecks(). + * + * \note + * Consider using the newer API, {@link uspoof_check2UTF8}, instead. + * The newer API exposes additional information from the check procedure + * and is otherwise identical to this method. + * + * @param sc The USpoofChecker + * @param id A identifier to be checked for possible security issues, in UTF8 format. + * @param length the length of the string to be checked, or -1 if the string is + * zero terminated. + * @param position Deprecated in ICU 51. Always returns zero. + * Originally, an out parameter for the index of the first + * string position that failed a check. + * This parameter may be NULL. + * @param status The error code, set if an error occurred while attempting to + * perform the check. + * Spoofing or security issues detected with the input string are + * not reported here, but through the function's return value. + * If the input contains invalid UTF-8 sequences, + * a status of U_INVALID_CHAR_FOUND will be returned. + * @return An integer value with bits set for any potential security + * or spoofing issues detected. The bits are defined by + * enum USpoofChecks. (returned_value & USPOOF_ALL_CHECKS) + * will be zero if the input string passes all of the + * enabled checks. + * @see uspoof_check2UTF8 + * @stable ICU 4.2 + */ +U_STABLE int32_t U_EXPORT2 +uspoof_checkUTF8(const USpoofChecker *sc, + const char *id, int32_t length, + int32_t *position, + UErrorCode *status); + + +#if U_SHOW_CPLUSPLUS_API +/** + * Check the specified string for possible security issues. + * The text to be checked will typically be an identifier of some sort. + * The set of checks to be performed is specified with uspoof_setChecks(). + * + * \note + * Consider using the newer API, {@link uspoof_check2UnicodeString}, instead. + * The newer API exposes additional information from the check procedure + * and is otherwise identical to this method. + * + * @param sc The USpoofChecker + * @param id A identifier to be checked for possible security issues. + * @param position Deprecated in ICU 51. Always returns zero. + * Originally, an out parameter for the index of the first + * string position that failed a check. + * This parameter may be NULL. + * @param status The error code, set if an error occurred while attempting to + * perform the check. + * Spoofing or security issues detected with the input string are + * not reported here, but through the function's return value. + * @return An integer value with bits set for any potential security + * or spoofing issues detected. The bits are defined by + * enum USpoofChecks. (returned_value & USPOOF_ALL_CHECKS) + * will be zero if the input string passes all of the + * enabled checks. + * @see uspoof_check2UnicodeString + * @stable ICU 4.2 + */ +U_STABLE int32_t U_EXPORT2 +uspoof_checkUnicodeString(const USpoofChecker *sc, + const icu::UnicodeString &id, + int32_t *position, + UErrorCode *status); +#endif + + +/** + * Check the specified string for possible security issues. + * The text to be checked will typically be an identifier of some sort. + * The set of checks to be performed is specified with uspoof_setChecks(). + * + * @param sc The USpoofChecker + * @param id The identifier to be checked for possible security issues, + * in UTF-16 format. + * @param length the length of the string to be checked, or -1 if the string is + * zero terminated. + * @param checkResult An instance of USpoofCheckResult to be filled with + * details about the identifier. Can be NULL. + * @param status The error code, set if an error occurred while attempting to + * perform the check. + * Spoofing or security issues detected with the input string are + * not reported here, but through the function's return value. + * @return An integer value with bits set for any potential security + * or spoofing issues detected. The bits are defined by + * enum USpoofChecks. (returned_value & USPOOF_ALL_CHECKS) + * will be zero if the input string passes all of the + * enabled checks. Any information in this bitmask will be + * consistent with the information saved in the optional + * checkResult parameter. + * @see uspoof_openCheckResult + * @see uspoof_check2UTF8 + * @see uspoof_check2UnicodeString + * @stable ICU 58 + */ +U_STABLE int32_t U_EXPORT2 +uspoof_check2(const USpoofChecker *sc, + const UChar* id, int32_t length, + USpoofCheckResult* checkResult, + UErrorCode *status); + +/** + * Check the specified string for possible security issues. + * The text to be checked will typically be an identifier of some sort. + * The set of checks to be performed is specified with uspoof_setChecks(). + * + * This version of {@link uspoof_check} accepts a USpoofCheckResult, which + * returns additional information about the identifier. For more + * information, see {@link uspoof_openCheckResult}. + * + * @param sc The USpoofChecker + * @param id A identifier to be checked for possible security issues, in UTF8 format. + * @param length the length of the string to be checked, or -1 if the string is + * zero terminated. + * @param checkResult An instance of USpoofCheckResult to be filled with + * details about the identifier. Can be NULL. + * @param status The error code, set if an error occurred while attempting to + * perform the check. + * Spoofing or security issues detected with the input string are + * not reported here, but through the function's return value. + * @return An integer value with bits set for any potential security + * or spoofing issues detected. The bits are defined by + * enum USpoofChecks. (returned_value & USPOOF_ALL_CHECKS) + * will be zero if the input string passes all of the + * enabled checks. Any information in this bitmask will be + * consistent with the information saved in the optional + * checkResult parameter. + * @see uspoof_openCheckResult + * @see uspoof_check2 + * @see uspoof_check2UnicodeString + * @stable ICU 58 + */ +U_STABLE int32_t U_EXPORT2 +uspoof_check2UTF8(const USpoofChecker *sc, + const char *id, int32_t length, + USpoofCheckResult* checkResult, + UErrorCode *status); + +#if U_SHOW_CPLUSPLUS_API +/** + * Check the specified string for possible security issues. + * The text to be checked will typically be an identifier of some sort. + * The set of checks to be performed is specified with uspoof_setChecks(). + * + * @param sc The USpoofChecker + * @param id A identifier to be checked for possible security issues. + * @param checkResult An instance of USpoofCheckResult to be filled with + * details about the identifier. Can be NULL. + * @param status The error code, set if an error occurred while attempting to + * perform the check. + * Spoofing or security issues detected with the input string are + * not reported here, but through the function's return value. + * @return An integer value with bits set for any potential security + * or spoofing issues detected. The bits are defined by + * enum USpoofChecks. (returned_value & USPOOF_ALL_CHECKS) + * will be zero if the input string passes all of the + * enabled checks. Any information in this bitmask will be + * consistent with the information saved in the optional + * checkResult parameter. + * @see uspoof_openCheckResult + * @see uspoof_check2 + * @see uspoof_check2UTF8 + * @stable ICU 58 + */ +U_STABLE int32_t U_EXPORT2 +uspoof_check2UnicodeString(const USpoofChecker *sc, + const icu::UnicodeString &id, + USpoofCheckResult* checkResult, + UErrorCode *status); +#endif + +/** + * Create a USpoofCheckResult, used by the {@link uspoof_check2} class of functions to return + * information about the identifier. Information includes: + *
    + *
  • A bitmask of the checks that failed
  • + *
  • The identifier's restriction level (UTS 39 section 5.2)
  • + *
  • The set of numerics in the string (UTS 39 section 5.3)
  • + *
+ * The data held in a USpoofCheckResult is cleared whenever it is passed into a new call + * of {@link uspoof_check2}. + * + * @param status The error code, set if this function encounters a problem. + * @return the newly created USpoofCheckResult + * @see uspoof_check2 + * @see uspoof_check2UTF8 + * @see uspoof_check2UnicodeString + * @stable ICU 58 + */ +U_STABLE USpoofCheckResult* U_EXPORT2 +uspoof_openCheckResult(UErrorCode *status); + +/** + * Close a USpoofCheckResult, freeing any memory that was being held by + * its implementation. + * + * @param checkResult The instance of USpoofCheckResult to close + * @stable ICU 58 + */ +U_STABLE void U_EXPORT2 +uspoof_closeCheckResult(USpoofCheckResult *checkResult); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUSpoofCheckResultPointer + * "Smart pointer" class, closes a USpoofCheckResult via {@link uspoof_closeCheckResult}. + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 58 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUSpoofCheckResultPointer, USpoofCheckResult, uspoof_closeCheckResult); + +U_NAMESPACE_END + +#endif + +/** + * Indicates which of the spoof check(s) have failed. The value is a bitwise OR of the constants for the tests + * in question: USPOOF_RESTRICTION_LEVEL, USPOOF_CHAR_LIMIT, and so on. + * + * @param checkResult The instance of USpoofCheckResult created by {@link uspoof_openCheckResult} + * @param status The error code, set if an error occurred. + * @return An integer value with bits set for any potential security + * or spoofing issues detected. The bits are defined by + * enum USpoofChecks. (returned_value & USPOOF_ALL_CHECKS) + * will be zero if the input string passes all of the + * enabled checks. + * @see uspoof_setChecks + * @stable ICU 58 + */ +U_STABLE int32_t U_EXPORT2 +uspoof_getCheckResultChecks(const USpoofCheckResult *checkResult, UErrorCode *status); + +/** + * Gets the restriction level that the text meets, if the USPOOF_RESTRICTION_LEVEL check + * was enabled; otherwise, undefined. + * + * @param checkResult The instance of USpoofCheckResult created by {@link uspoof_openCheckResult} + * @param status The error code, set if an error occurred. + * @return The restriction level contained in the USpoofCheckResult + * @see uspoof_setRestrictionLevel + * @stable ICU 58 + */ +U_STABLE URestrictionLevel U_EXPORT2 +uspoof_getCheckResultRestrictionLevel(const USpoofCheckResult *checkResult, UErrorCode *status); + +/** + * Gets the set of numerics found in the string, if the USPOOF_MIXED_NUMBERS check was enabled; + * otherwise, undefined. The set will contain the zero digit from each decimal number system found + * in the input string. Ownership of the returned USet remains with the USpoofCheckResult. + * The USet will be free'd when {@link uspoof_closeCheckResult} is called. + * + * @param checkResult The instance of USpoofCheckResult created by {@link uspoof_openCheckResult} + * @return The set of numerics contained in the USpoofCheckResult + * @param status The error code, set if an error occurred. + * @stable ICU 58 + */ +U_STABLE const USet* U_EXPORT2 +uspoof_getCheckResultNumerics(const USpoofCheckResult *checkResult, UErrorCode *status); + + +/** + * Check the whether two specified strings are visually confusable. + * + * If the strings are confusable, the return value will be nonzero, as long as + * {@link USPOOF_CONFUSABLE} was enabled in uspoof_setChecks(). + * + * The bits in the return value correspond to flags for each of the classes of + * confusables applicable to the two input strings. According to UTS 39 + * section 4, the possible flags are: + * + *
    + *
  • {@link USPOOF_SINGLE_SCRIPT_CONFUSABLE}
  • + *
  • {@link USPOOF_MIXED_SCRIPT_CONFUSABLE}
  • + *
  • {@link USPOOF_WHOLE_SCRIPT_CONFUSABLE}
  • + *
+ * + * If one or more of the above flags were not listed in uspoof_setChecks(), this + * function will never report that class of confusable. The check + * {@link USPOOF_CONFUSABLE} enables all three flags. + * + * + * @param sc The USpoofChecker + * @param id1 The first of the two identifiers to be compared for + * confusability. The strings are in UTF-16 format. + * @param length1 the length of the first identifer, expressed in + * 16 bit UTF-16 code units, or -1 if the string is + * nul terminated. + * @param id2 The second of the two identifiers to be compared for + * confusability. The identifiers are in UTF-16 format. + * @param length2 The length of the second identifiers, expressed in + * 16 bit UTF-16 code units, or -1 if the string is + * nul terminated. + * @param status The error code, set if an error occurred while attempting to + * perform the check. + * Confusability of the identifiers is not reported here, + * but through this function's return value. + * @return An integer value with bit(s) set corresponding to + * the type of confusability found, as defined by + * enum USpoofChecks. Zero is returned if the identifiers + * are not confusable. + * + * @stable ICU 4.2 + */ +U_STABLE int32_t U_EXPORT2 +uspoof_areConfusable(const USpoofChecker *sc, + const UChar *id1, int32_t length1, + const UChar *id2, int32_t length2, + UErrorCode *status); + + + +/** + * A version of {@link uspoof_areConfusable} accepting strings in UTF-8 format. + * + * @param sc The USpoofChecker + * @param id1 The first of the two identifiers to be compared for + * confusability. The strings are in UTF-8 format. + * @param length1 the length of the first identifiers, in bytes, or -1 + * if the string is nul terminated. + * @param id2 The second of the two identifiers to be compared for + * confusability. The strings are in UTF-8 format. + * @param length2 The length of the second string in bytes, or -1 + * if the string is nul terminated. + * @param status The error code, set if an error occurred while attempting to + * perform the check. + * Confusability of the strings is not reported here, + * but through this function's return value. + * @return An integer value with bit(s) set corresponding to + * the type of confusability found, as defined by + * enum USpoofChecks. Zero is returned if the strings + * are not confusable. + * + * @stable ICU 4.2 + * + * @see uspoof_areConfusable + */ +U_STABLE int32_t U_EXPORT2 +uspoof_areConfusableUTF8(const USpoofChecker *sc, + const char *id1, int32_t length1, + const char *id2, int32_t length2, + UErrorCode *status); + + + + +#if U_SHOW_CPLUSPLUS_API +/** + * A version of {@link uspoof_areConfusable} accepting UnicodeStrings. + * + * @param sc The USpoofChecker + * @param s1 The first of the two identifiers to be compared for + * confusability. The strings are in UTF-8 format. + * @param s2 The second of the two identifiers to be compared for + * confusability. The strings are in UTF-8 format. + * @param status The error code, set if an error occurred while attempting to + * perform the check. + * Confusability of the identifiers is not reported here, + * but through this function's return value. + * @return An integer value with bit(s) set corresponding to + * the type of confusability found, as defined by + * enum USpoofChecks. Zero is returned if the identifiers + * are not confusable. + * + * @stable ICU 4.2 + * + * @see uspoof_areConfusable + */ +U_STABLE int32_t U_EXPORT2 +uspoof_areConfusableUnicodeString(const USpoofChecker *sc, + const icu::UnicodeString &s1, + const icu::UnicodeString &s2, + UErrorCode *status); +#endif + + +/** + * Get the "skeleton" for an identifier. + * Skeletons are a transformation of the input identifier; + * Two identifiers are confusable if their skeletons are identical. + * See Unicode UAX #39 for additional information. + * + * Using skeletons directly makes it possible to quickly check + * whether an identifier is confusable with any of some large + * set of existing identifiers, by creating an efficiently + * searchable collection of the skeletons. + * + * @param sc The USpoofChecker + * @param type Deprecated in ICU 58. You may pass any number. + * Originally, controlled which of the Unicode confusable data + * tables to use. + * @param id The input identifier whose skeleton will be computed. + * @param length The length of the input identifier, expressed in 16 bit + * UTF-16 code units, or -1 if the string is zero terminated. + * @param dest The output buffer, to receive the skeleton string. + * @param destCapacity The length of the output buffer, in 16 bit units. + * The destCapacity may be zero, in which case the function will + * return the actual length of the skeleton. + * @param status The error code, set if an error occurred while attempting to + * perform the check. + * @return The length of the skeleton string. The returned length + * is always that of the complete skeleton, even when the + * supplied buffer is too small (or of zero length) + * + * @stable ICU 4.2 + * @see uspoof_areConfusable + */ +U_STABLE int32_t U_EXPORT2 +uspoof_getSkeleton(const USpoofChecker *sc, + uint32_t type, + const UChar *id, int32_t length, + UChar *dest, int32_t destCapacity, + UErrorCode *status); + +/** + * Get the "skeleton" for an identifier. + * Skeletons are a transformation of the input identifier; + * Two identifiers are confusable if their skeletons are identical. + * See Unicode UAX #39 for additional information. + * + * Using skeletons directly makes it possible to quickly check + * whether an identifier is confusable with any of some large + * set of existing identifiers, by creating an efficiently + * searchable collection of the skeletons. + * + * @param sc The USpoofChecker + * @param type Deprecated in ICU 58. You may pass any number. + * Originally, controlled which of the Unicode confusable data + * tables to use. + * @param id The UTF-8 format identifier whose skeleton will be computed. + * @param length The length of the input string, in bytes, + * or -1 if the string is zero terminated. + * @param dest The output buffer, to receive the skeleton string. + * @param destCapacity The length of the output buffer, in bytes. + * The destCapacity may be zero, in which case the function will + * return the actual length of the skeleton. + * @param status The error code, set if an error occurred while attempting to + * perform the check. Possible Errors include U_INVALID_CHAR_FOUND + * for invalid UTF-8 sequences, and + * U_BUFFER_OVERFLOW_ERROR if the destination buffer is too small + * to hold the complete skeleton. + * @return The length of the skeleton string, in bytes. The returned length + * is always that of the complete skeleton, even when the + * supplied buffer is too small (or of zero length) + * + * @stable ICU 4.2 + */ +U_STABLE int32_t U_EXPORT2 +uspoof_getSkeletonUTF8(const USpoofChecker *sc, + uint32_t type, + const char *id, int32_t length, + char *dest, int32_t destCapacity, + UErrorCode *status); + +#if U_SHOW_CPLUSPLUS_API +/** + * Get the "skeleton" for an identifier. + * Skeletons are a transformation of the input identifier; + * Two identifiers are confusable if their skeletons are identical. + * See Unicode UAX #39 for additional information. + * + * Using skeletons directly makes it possible to quickly check + * whether an identifier is confusable with any of some large + * set of existing identifiers, by creating an efficiently + * searchable collection of the skeletons. + * + * @param sc The USpoofChecker. + * @param type Deprecated in ICU 58. You may pass any number. + * Originally, controlled which of the Unicode confusable data + * tables to use. + * @param id The input identifier whose skeleton will be computed. + * @param dest The output identifier, to receive the skeleton string. + * @param status The error code, set if an error occurred while attempting to + * perform the check. + * @return A reference to the destination (skeleton) string. + * + * @stable ICU 4.2 + */ +U_I18N_API icu::UnicodeString & U_EXPORT2 +uspoof_getSkeletonUnicodeString(const USpoofChecker *sc, + uint32_t type, + const icu::UnicodeString &id, + icu::UnicodeString &dest, + UErrorCode *status); +#endif /* U_SHOW_CPLUSPLUS_API */ + +/** + * Get the set of Candidate Characters for Inclusion in Identifiers, as defined + * in http://unicode.org/Public/security/latest/xidmodifications.txt + * and documented in http://www.unicode.org/reports/tr39/, Unicode Security Mechanisms. + * + * The returned set is frozen. Ownership of the set remains with the ICU library; it must not + * be deleted by the caller. + * + * @param status The error code, set if a problem occurs while creating the set. + * + * @stable ICU 51 + */ +U_STABLE const USet * U_EXPORT2 +uspoof_getInclusionSet(UErrorCode *status); + +/** + * Get the set of characters from Recommended Scripts for Inclusion in Identifiers, as defined + * in http://unicode.org/Public/security/latest/xidmodifications.txt + * and documented in http://www.unicode.org/reports/tr39/, Unicode Security Mechanisms. + * + * The returned set is frozen. Ownership of the set remains with the ICU library; it must not + * be deleted by the caller. + * + * @param status The error code, set if a problem occurs while creating the set. + * + * @stable ICU 51 + */ +U_STABLE const USet * U_EXPORT2 +uspoof_getRecommendedSet(UErrorCode *status); + +#if U_SHOW_CPLUSPLUS_API + +/** + * Get the set of Candidate Characters for Inclusion in Identifiers, as defined + * in http://unicode.org/Public/security/latest/xidmodifications.txt + * and documented in http://www.unicode.org/reports/tr39/, Unicode Security Mechanisms. + * + * The returned set is frozen. Ownership of the set remains with the ICU library; it must not + * be deleted by the caller. + * + * @param status The error code, set if a problem occurs while creating the set. + * + * @stable ICU 51 + */ +U_STABLE const icu::UnicodeSet * U_EXPORT2 +uspoof_getInclusionUnicodeSet(UErrorCode *status); + +/** + * Get the set of characters from Recommended Scripts for Inclusion in Identifiers, as defined + * in http://unicode.org/Public/security/latest/xidmodifications.txt + * and documented in http://www.unicode.org/reports/tr39/, Unicode Security Mechanisms. + * + * The returned set is frozen. Ownership of the set remains with the ICU library; it must not + * be deleted by the caller. + * + * @param status The error code, set if a problem occurs while creating the set. + * + * @stable ICU 51 + */ +U_STABLE const icu::UnicodeSet * U_EXPORT2 +uspoof_getRecommendedUnicodeSet(UErrorCode *status); + +#endif /* U_SHOW_CPLUSPLUS_API */ + +/** + * Serialize the data for a spoof detector into a chunk of memory. + * The flattened spoof detection tables can later be used to efficiently + * instantiate a new Spoof Detector. + * + * The serialized spoof checker includes only the data compiled from the + * Unicode data tables by uspoof_openFromSource(); it does not include + * include any other state or configuration that may have been set. + * + * @param sc the Spoof Detector whose data is to be serialized. + * @param data a pointer to 32-bit-aligned memory to be filled with the data, + * can be NULL if capacity==0 + * @param capacity the number of bytes available at data, + * or 0 for preflighting + * @param status an in/out ICU UErrorCode; possible errors include: + * - U_BUFFER_OVERFLOW_ERROR if the data storage block is too small for serialization + * - U_ILLEGAL_ARGUMENT_ERROR the data or capacity parameters are bad + * @return the number of bytes written or needed for the spoof data + * + * @see utrie2_openFromSerialized() + * @stable ICU 4.2 + */ +U_STABLE int32_t U_EXPORT2 +uspoof_serialize(USpoofChecker *sc, + void *data, int32_t capacity, + UErrorCode *status); + + +#endif + +#endif /* USPOOF_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/usprep.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/usprep.h new file mode 100644 index 0000000..da0848d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/usprep.h @@ -0,0 +1,271 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* + ******************************************************************************* + * + * Copyright (C) 2003-2014, International Business Machines + * Corporation and others. All Rights Reserved. + * + ******************************************************************************* + * file name: usprep.h + * encoding: UTF-8 + * tab size: 8 (not used) + * indentation:4 + * + * created on: 2003jul2 + * created by: Ram Viswanadha + */ + +#ifndef __USPREP_H__ +#define __USPREP_H__ + +/** + * \file + * \brief C API: Implements the StringPrep algorithm. + */ + +#include "unicode/utypes.h" +#include "unicode/localpointer.h" + +/** + * + * StringPrep API implements the StingPrep framework as described by RFC 3454. + * StringPrep prepares Unicode strings for use in network protocols. + * Profiles of StingPrep are set of rules and data according to with the + * Unicode Strings are prepared. Each profiles contains tables which describe + * how a code point should be treated. The tables are broadly classied into + *
    + *
  • Unassinged Table: Contains code points that are unassigned + * in the Unicode Version supported by StringPrep. Currently + * RFC 3454 supports Unicode 3.2.
  • + *
  • Prohibited Table: Contains code points that are prohibted from + * the output of the StringPrep processing function.
  • + *
  • Mapping Table: Contains code ponts that are deleted from the output or case mapped.
  • + *
+ * + * The procedure for preparing Unicode strings: + *
    + *
  1. Map: For each character in the input, check if it has a mapping + * and, if so, replace it with its mapping.
  2. + *
  3. Normalize: Possibly normalize the result of step 1 using Unicode + * normalization.
  4. + *
  5. Prohibit: Check for any characters that are not allowed in the + * output. If any are found, return an error.
  6. + *
  7. Check bidi: Possibly check for right-to-left characters, and if + * any are found, make sure that the whole string satisfies the + * requirements for bidirectional strings. If the string does not + * satisfy the requirements for bidirectional strings, return an + * error.
  8. + *
+ * @author Ram Viswanadha + */ +#if !UCONFIG_NO_IDNA + +#include "unicode/parseerr.h" + +/** + * The StringPrep profile + * @stable ICU 2.8 + */ +typedef struct UStringPrepProfile UStringPrepProfile; + + +/** + * Option to prohibit processing of unassigned code points in the input + * + * @see usprep_prepare + * @stable ICU 2.8 + */ +#define USPREP_DEFAULT 0x0000 + +/** + * Option to allow processing of unassigned code points in the input + * + * @see usprep_prepare + * @stable ICU 2.8 + */ +#define USPREP_ALLOW_UNASSIGNED 0x0001 + +/** + * enums for the standard stringprep profile types + * supported by usprep_openByType. + * @see usprep_openByType + * @stable ICU 4.2 + */ +typedef enum UStringPrepProfileType { + /** + * RFC3491 Nameprep + * @stable ICU 4.2 + */ + USPREP_RFC3491_NAMEPREP, + /** + * RFC3530 nfs4_cs_prep + * @stable ICU 4.2 + */ + USPREP_RFC3530_NFS4_CS_PREP, + /** + * RFC3530 nfs4_cs_prep with case insensitive option + * @stable ICU 4.2 + */ + USPREP_RFC3530_NFS4_CS_PREP_CI, + /** + * RFC3530 nfs4_cis_prep + * @stable ICU 4.2 + */ + USPREP_RFC3530_NFS4_CIS_PREP, + /** + * RFC3530 nfs4_mixed_prep for prefix + * @stable ICU 4.2 + */ + USPREP_RFC3530_NFS4_MIXED_PREP_PREFIX, + /** + * RFC3530 nfs4_mixed_prep for suffix + * @stable ICU 4.2 + */ + USPREP_RFC3530_NFS4_MIXED_PREP_SUFFIX, + /** + * RFC3722 iSCSI + * @stable ICU 4.2 + */ + USPREP_RFC3722_ISCSI, + /** + * RFC3920 XMPP Nodeprep + * @stable ICU 4.2 + */ + USPREP_RFC3920_NODEPREP, + /** + * RFC3920 XMPP Resourceprep + * @stable ICU 4.2 + */ + USPREP_RFC3920_RESOURCEPREP, + /** + * RFC4011 Policy MIB Stringprep + * @stable ICU 4.2 + */ + USPREP_RFC4011_MIB, + /** + * RFC4013 SASLprep + * @stable ICU 4.2 + */ + USPREP_RFC4013_SASLPREP, + /** + * RFC4505 trace + * @stable ICU 4.2 + */ + USPREP_RFC4505_TRACE, + /** + * RFC4518 LDAP + * @stable ICU 4.2 + */ + USPREP_RFC4518_LDAP, + /** + * RFC4518 LDAP for case ignore, numeric and stored prefix + * matching rules + * @stable ICU 4.2 + */ + USPREP_RFC4518_LDAP_CI +} UStringPrepProfileType; + +/** + * Creates a StringPrep profile from the data file. + * + * @param path string containing the full path pointing to the directory + * where the profile reside followed by the package name + * e.g. "/usr/resource/my_app/profiles/mydata" on a Unix system. + * if NULL, ICU default data files will be used. + * @param fileName name of the profile file to be opened + * @param status ICU error code in/out parameter. Must not be NULL. + * Must fulfill U_SUCCESS before the function call. + * @return Pointer to UStringPrepProfile that is opened. Should be closed by + * calling usprep_close() + * @see usprep_close() + * @stable ICU 2.8 + */ +U_STABLE UStringPrepProfile* U_EXPORT2 +usprep_open(const char* path, + const char* fileName, + UErrorCode* status); + +/** + * Creates a StringPrep profile for the specified profile type. + * + * @param type The profile type + * @param status ICU error code in/out parameter. Must not be NULL. + * Must fulfill U_SUCCESS before the function call. + * @return Pointer to UStringPrepProfile that is opened. Should be closed by + * calling usprep_close() + * @see usprep_close() + * @stable ICU 4.2 + */ +U_STABLE UStringPrepProfile* U_EXPORT2 +usprep_openByType(UStringPrepProfileType type, + UErrorCode* status); + +/** + * Closes the profile + * @param profile The profile to close + * @stable ICU 2.8 + */ +U_STABLE void U_EXPORT2 +usprep_close(UStringPrepProfile* profile); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUStringPrepProfilePointer + * "Smart pointer" class, closes a UStringPrepProfile via usprep_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUStringPrepProfilePointer, UStringPrepProfile, usprep_close); + +U_NAMESPACE_END + +#endif + +/** + * Prepare the input buffer for use in applications with the given profile. This operation maps, normalizes(NFKC), + * checks for prohited and BiDi characters in the order defined by RFC 3454 + * depending on the options specified in the profile. + * + * @param prep The profile to use + * @param src Pointer to UChar buffer containing the string to prepare + * @param srcLength Number of characters in the source string + * @param dest Pointer to the destination buffer to receive the output + * @param destCapacity The capacity of destination array + * @param options A bit set of options: + * + * - USPREP_DEFAULT Prohibit processing of unassigned code points in the input + * + * - USPREP_ALLOW_UNASSIGNED Treat the unassigned code points are in the input + * as normal Unicode code points. + * + * @param parseError Pointer to UParseError struct to receive information on position + * of error if an error is encountered. Can be NULL. + * @param status ICU in/out error code parameter. + * U_INVALID_CHAR_FOUND if src contains + * unmatched single surrogates. + * U_INDEX_OUTOFBOUNDS_ERROR if src contains + * too many code points. + * U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough + * @return The number of UChars in the destination buffer + * @stable ICU 2.8 + */ + +U_STABLE int32_t U_EXPORT2 +usprep_prepare( const UStringPrepProfile* prep, + const UChar* src, int32_t srcLength, + UChar* dest, int32_t destCapacity, + int32_t options, + UParseError* parseError, + UErrorCode* status ); + + +#endif /* #if !UCONFIG_NO_IDNA */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ustring.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ustring.h new file mode 100644 index 0000000..3daa28e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ustring.h @@ -0,0 +1,1692 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1998-2014, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* +* File ustring.h +* +* Modification History: +* +* Date Name Description +* 12/07/98 bertrand Creation. +****************************************************************************** +*/ + +#ifndef USTRING_H +#define USTRING_H + +#include "unicode/utypes.h" +#include "unicode/putil.h" +#include "unicode/uiter.h" + +/** + * \def UBRK_TYPEDEF_UBREAK_ITERATOR + * @internal + */ + +#ifndef UBRK_TYPEDEF_UBREAK_ITERATOR +# define UBRK_TYPEDEF_UBREAK_ITERATOR +/** Simple declaration for u_strToTitle() to avoid including unicode/ubrk.h. @stable ICU 2.1*/ + typedef struct UBreakIterator UBreakIterator; +#endif + +/** + * \file + * \brief C API: Unicode string handling functions + * + * These C API functions provide general Unicode string handling. + * + * Some functions are equivalent in name, signature, and behavior to the ANSI C + * functions. (For example, they do not check for bad arguments like NULL string pointers.) + * In some cases, only the thread-safe variant of such a function is implemented here + * (see u_strtok_r()). + * + * Other functions provide more Unicode-specific functionality like locale-specific + * upper/lower-casing and string comparison in code point order. + * + * ICU uses 16-bit Unicode (UTF-16) in the form of arrays of UChar code units. + * UTF-16 encodes each Unicode code point with either one or two UChar code units. + * (This is the default form of Unicode, and a forward-compatible extension of the original, + * fixed-width form that was known as UCS-2. UTF-16 superseded UCS-2 with Unicode 2.0 + * in 1996.) + * + * Some APIs accept a 32-bit UChar32 value for a single code point. + * + * ICU also handles 16-bit Unicode text with unpaired surrogates. + * Such text is not well-formed UTF-16. + * Code-point-related functions treat unpaired surrogates as surrogate code points, + * i.e., as separate units. + * + * Although UTF-16 is a variable-width encoding form (like some legacy multi-byte encodings), + * it is much more efficient even for random access because the code unit values + * for single-unit characters vs. lead units vs. trail units are completely disjoint. + * This means that it is easy to determine character (code point) boundaries from + * random offsets in the string. + * + * Unicode (UTF-16) string processing is optimized for the single-unit case. + * Although it is important to support supplementary characters + * (which use pairs of lead/trail code units called "surrogates"), + * their occurrence is rare. Almost all characters in modern use require only + * a single UChar code unit (i.e., their code point values are <=0xffff). + * + * For more details see the User Guide Strings chapter (http://icu-project.org/userguide/strings.html). + * For a discussion of the handling of unpaired surrogates see also + * Jitterbug 2145 and its icu mailing list proposal on 2002-sep-18. + */ + +/** + * \defgroup ustring_ustrlen String Length + * \ingroup ustring_strlen + */ +/*@{*/ +/** + * Determine the length of an array of UChar. + * + * @param s The array of UChars, NULL (U+0000) terminated. + * @return The number of UChars in chars, minus the terminator. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_strlen(const UChar *s); +/*@}*/ + +/** + * Count Unicode code points in the length UChar code units of the string. + * A code point may occupy either one or two UChar code units. + * Counting code points involves reading all code units. + * + * This functions is basically the inverse of the U16_FWD_N() macro (see utf.h). + * + * @param s The input string. + * @param length The number of UChar code units to be checked, or -1 to count all + * code points before the first NUL (U+0000). + * @return The number of code points in the specified code units. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_countChar32(const UChar *s, int32_t length); + +/** + * Check if the string contains more Unicode code points than a certain number. + * This is more efficient than counting all code points in the entire string + * and comparing that number with a threshold. + * This function may not need to scan the string at all if the length is known + * (not -1 for NUL-termination) and falls within a certain range, and + * never needs to count more than 'number+1' code points. + * Logically equivalent to (u_countChar32(s, length)>number). + * A Unicode code point may occupy either one or two UChar code units. + * + * @param s The input string. + * @param length The length of the string, or -1 if it is NUL-terminated. + * @param number The number of code points in the string is compared against + * the 'number' parameter. + * @return Boolean value for whether the string contains more Unicode code points + * than 'number'. Same as (u_countChar32(s, length)>number). + * @stable ICU 2.4 + */ +U_STABLE UBool U_EXPORT2 +u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number); + +/** + * Concatenate two ustrings. Appends a copy of src, + * including the null terminator, to dst. The initial copied + * character from src overwrites the null terminator in dst. + * + * @param dst The destination string. + * @param src The source string. + * @return A pointer to dst. + * @stable ICU 2.0 + */ +U_STABLE UChar* U_EXPORT2 +u_strcat(UChar *dst, + const UChar *src); + +/** + * Concatenate two ustrings. + * Appends at most n characters from src to dst. + * Adds a terminating NUL. + * If src is too long, then only n-1 characters will be copied + * before the terminating NUL. + * If n<=0 then dst is not modified. + * + * @param dst The destination string. + * @param src The source string (can be NULL/invalid if n<=0). + * @param n The maximum number of characters to append; no-op if <=0. + * @return A pointer to dst. + * @stable ICU 2.0 + */ +U_STABLE UChar* U_EXPORT2 +u_strncat(UChar *dst, + const UChar *src, + int32_t n); + +/** + * Find the first occurrence of a substring in a string. + * The substring is found at code point boundaries. + * That means that if the substring begins with + * a trail surrogate or ends with a lead surrogate, + * then it is found only if these surrogates stand alone in the text. + * Otherwise, the substring edge units would be matched against + * halves of surrogate pairs. + * + * @param s The string to search (NUL-terminated). + * @param substring The substring to find (NUL-terminated). + * @return A pointer to the first occurrence of substring in s, + * or s itself if the substring is empty, + * or NULL if substring is not in s. + * @stable ICU 2.0 + * + * @see u_strrstr + * @see u_strFindFirst + * @see u_strFindLast + */ +U_STABLE UChar * U_EXPORT2 +u_strstr(const UChar *s, const UChar *substring); + +/** + * Find the first occurrence of a substring in a string. + * The substring is found at code point boundaries. + * That means that if the substring begins with + * a trail surrogate or ends with a lead surrogate, + * then it is found only if these surrogates stand alone in the text. + * Otherwise, the substring edge units would be matched against + * halves of surrogate pairs. + * + * @param s The string to search. + * @param length The length of s (number of UChars), or -1 if it is NUL-terminated. + * @param substring The substring to find (NUL-terminated). + * @param subLength The length of substring (number of UChars), or -1 if it is NUL-terminated. + * @return A pointer to the first occurrence of substring in s, + * or s itself if the substring is empty, + * or NULL if substring is not in s. + * @stable ICU 2.4 + * + * @see u_strstr + * @see u_strFindLast + */ +U_STABLE UChar * U_EXPORT2 +u_strFindFirst(const UChar *s, int32_t length, const UChar *substring, int32_t subLength); + +/** + * Find the first occurrence of a BMP code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (NUL-terminated). + * @param c The BMP code point to find. + * @return A pointer to the first occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.0 + * + * @see u_strchr32 + * @see u_memchr + * @see u_strstr + * @see u_strFindFirst + */ +U_STABLE UChar * U_EXPORT2 +u_strchr(const UChar *s, UChar c); + +/** + * Find the first occurrence of a code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (NUL-terminated). + * @param c The code point to find. + * @return A pointer to the first occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.0 + * + * @see u_strchr + * @see u_memchr32 + * @see u_strstr + * @see u_strFindFirst + */ +U_STABLE UChar * U_EXPORT2 +u_strchr32(const UChar *s, UChar32 c); + +/** + * Find the last occurrence of a substring in a string. + * The substring is found at code point boundaries. + * That means that if the substring begins with + * a trail surrogate or ends with a lead surrogate, + * then it is found only if these surrogates stand alone in the text. + * Otherwise, the substring edge units would be matched against + * halves of surrogate pairs. + * + * @param s The string to search (NUL-terminated). + * @param substring The substring to find (NUL-terminated). + * @return A pointer to the last occurrence of substring in s, + * or s itself if the substring is empty, + * or NULL if substring is not in s. + * @stable ICU 2.4 + * + * @see u_strstr + * @see u_strFindFirst + * @see u_strFindLast + */ +U_STABLE UChar * U_EXPORT2 +u_strrstr(const UChar *s, const UChar *substring); + +/** + * Find the last occurrence of a substring in a string. + * The substring is found at code point boundaries. + * That means that if the substring begins with + * a trail surrogate or ends with a lead surrogate, + * then it is found only if these surrogates stand alone in the text. + * Otherwise, the substring edge units would be matched against + * halves of surrogate pairs. + * + * @param s The string to search. + * @param length The length of s (number of UChars), or -1 if it is NUL-terminated. + * @param substring The substring to find (NUL-terminated). + * @param subLength The length of substring (number of UChars), or -1 if it is NUL-terminated. + * @return A pointer to the last occurrence of substring in s, + * or s itself if the substring is empty, + * or NULL if substring is not in s. + * @stable ICU 2.4 + * + * @see u_strstr + * @see u_strFindLast + */ +U_STABLE UChar * U_EXPORT2 +u_strFindLast(const UChar *s, int32_t length, const UChar *substring, int32_t subLength); + +/** + * Find the last occurrence of a BMP code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (NUL-terminated). + * @param c The BMP code point to find. + * @return A pointer to the last occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.4 + * + * @see u_strrchr32 + * @see u_memrchr + * @see u_strrstr + * @see u_strFindLast + */ +U_STABLE UChar * U_EXPORT2 +u_strrchr(const UChar *s, UChar c); + +/** + * Find the last occurrence of a code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (NUL-terminated). + * @param c The code point to find. + * @return A pointer to the last occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.4 + * + * @see u_strrchr + * @see u_memchr32 + * @see u_strrstr + * @see u_strFindLast + */ +U_STABLE UChar * U_EXPORT2 +u_strrchr32(const UChar *s, UChar32 c); + +/** + * Locates the first occurrence in the string string of any of the characters + * in the string matchSet. + * Works just like C's strpbrk but with Unicode. + * + * @param string The string in which to search, NUL-terminated. + * @param matchSet A NUL-terminated string defining a set of code points + * for which to search in the text string. + * @return A pointer to the character in string that matches one of the + * characters in matchSet, or NULL if no such character is found. + * @stable ICU 2.0 + */ +U_STABLE UChar * U_EXPORT2 +u_strpbrk(const UChar *string, const UChar *matchSet); + +/** + * Returns the number of consecutive characters in string, + * beginning with the first, that do not occur somewhere in matchSet. + * Works just like C's strcspn but with Unicode. + * + * @param string The string in which to search, NUL-terminated. + * @param matchSet A NUL-terminated string defining a set of code points + * for which to search in the text string. + * @return The number of initial characters in string that do not + * occur in matchSet. + * @see u_strspn + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_strcspn(const UChar *string, const UChar *matchSet); + +/** + * Returns the number of consecutive characters in string, + * beginning with the first, that occur somewhere in matchSet. + * Works just like C's strspn but with Unicode. + * + * @param string The string in which to search, NUL-terminated. + * @param matchSet A NUL-terminated string defining a set of code points + * for which to search in the text string. + * @return The number of initial characters in string that do + * occur in matchSet. + * @see u_strcspn + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_strspn(const UChar *string, const UChar *matchSet); + +/** + * The string tokenizer API allows an application to break a string into + * tokens. Unlike strtok(), the saveState (the current pointer within the + * original string) is maintained in saveState. In the first call, the + * argument src is a pointer to the string. In subsequent calls to + * return successive tokens of that string, src must be specified as + * NULL. The value saveState is set by this function to maintain the + * function's position within the string, and on each subsequent call + * you must give this argument the same variable. This function does + * handle surrogate pairs. This function is similar to the strtok_r() + * the POSIX Threads Extension (1003.1c-1995) version. + * + * @param src String containing token(s). This string will be modified. + * After the first call to u_strtok_r(), this argument must + * be NULL to get to the next token. + * @param delim Set of delimiter characters (Unicode code points). + * @param saveState The current pointer within the original string, + * which is set by this function. The saveState + * parameter should the address of a local variable of type + * UChar *. (i.e. defined "Uhar *myLocalSaveState" and use + * &myLocalSaveState for this parameter). + * @return A pointer to the next token found in src, or NULL + * when there are no more tokens. + * @stable ICU 2.0 + */ +U_STABLE UChar * U_EXPORT2 +u_strtok_r(UChar *src, + const UChar *delim, + UChar **saveState); + +/** + * Compare two Unicode strings for bitwise equality (code unit order). + * + * @param s1 A string to compare. + * @param s2 A string to compare. + * @return 0 if s1 and s2 are bitwise equal; a negative + * value if s1 is bitwise less than s2,; a positive + * value if s1 is bitwise greater than s2. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_strcmp(const UChar *s1, + const UChar *s2); + +/** + * Compare two Unicode strings in code point order. + * See u_strCompare for details. + * + * @param s1 A string to compare. + * @param s2 A string to compare. + * @return a negative/zero/positive integer corresponding to whether + * the first string is less than/equal to/greater than the second one + * in code point order + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_strcmpCodePointOrder(const UChar *s1, const UChar *s2); + +/** + * Compare two Unicode strings (binary order). + * + * The comparison can be done in code unit order or in code point order. + * They differ only in UTF-16 when + * comparing supplementary code points (U+10000..U+10ffff) + * to BMP code points near the end of the BMP (i.e., U+e000..U+ffff). + * In code unit order, high BMP code points sort after supplementary code points + * because they are stored as pairs of surrogates which are at U+d800..U+dfff. + * + * This functions works with strings of different explicitly specified lengths + * unlike the ANSI C-like u_strcmp() and u_memcmp() etc. + * NUL-terminated strings are possible with length arguments of -1. + * + * @param s1 First source string. + * @param length1 Length of first source string, or -1 if NUL-terminated. + * + * @param s2 Second source string. + * @param length2 Length of second source string, or -1 if NUL-terminated. + * + * @param codePointOrder Choose between code unit order (FALSE) + * and code point order (TRUE). + * + * @return <0 or 0 or >0 as usual for string comparisons + * + * @stable ICU 2.2 + */ +U_STABLE int32_t U_EXPORT2 +u_strCompare(const UChar *s1, int32_t length1, + const UChar *s2, int32_t length2, + UBool codePointOrder); + +/** + * Compare two Unicode strings (binary order) + * as presented by UCharIterator objects. + * Works otherwise just like u_strCompare(). + * + * Both iterators are reset to their start positions. + * When the function returns, it is undefined where the iterators + * have stopped. + * + * @param iter1 First source string iterator. + * @param iter2 Second source string iterator. + * @param codePointOrder Choose between code unit order (FALSE) + * and code point order (TRUE). + * + * @return <0 or 0 or >0 as usual for string comparisons + * + * @see u_strCompare + * + * @stable ICU 2.6 + */ +U_STABLE int32_t U_EXPORT2 +u_strCompareIter(UCharIterator *iter1, UCharIterator *iter2, UBool codePointOrder); + +/** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to + * u_strCompare(u_strFoldCase(s1, options), + * u_strFoldCase(s2, options), + * (options&U_COMPARE_CODE_POINT_ORDER)!=0). + * + * The comparison can be done in UTF-16 code unit order or in code point order. + * They differ only when comparing supplementary code points (U+10000..U+10ffff) + * to BMP code points near the end of the BMP (i.e., U+e000..U+ffff). + * In code unit order, high BMP code points sort after supplementary code points + * because they are stored as pairs of surrogates which are at U+d800..U+dfff. + * + * This functions works with strings of different explicitly specified lengths + * unlike the ANSI C-like u_strcmp() and u_memcmp() etc. + * NUL-terminated strings are possible with length arguments of -1. + * + * @param s1 First source string. + * @param length1 Length of first source string, or -1 if NUL-terminated. + * + * @param s2 Second source string. + * @param length2 Length of second source string, or -1 if NUL-terminated. + * + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * + * @return <0 or 0 or >0 as usual for string comparisons + * + * @stable ICU 2.2 + */ +U_STABLE int32_t U_EXPORT2 +u_strCaseCompare(const UChar *s1, int32_t length1, + const UChar *s2, int32_t length2, + uint32_t options, + UErrorCode *pErrorCode); + +/** + * Compare two ustrings for bitwise equality. + * Compares at most n characters. + * + * @param ucs1 A string to compare (can be NULL/invalid if n<=0). + * @param ucs2 A string to compare (can be NULL/invalid if n<=0). + * @param n The maximum number of characters to compare; always returns 0 if n<=0. + * @return 0 if s1 and s2 are bitwise equal; a negative + * value if s1 is bitwise less than s2; a positive + * value if s1 is bitwise greater than s2. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_strncmp(const UChar *ucs1, + const UChar *ucs2, + int32_t n); + +/** + * Compare two Unicode strings in code point order. + * This is different in UTF-16 from u_strncmp() if supplementary characters are present. + * For details, see u_strCompare(). + * + * @param s1 A string to compare. + * @param s2 A string to compare. + * @param n The maximum number of characters to compare. + * @return a negative/zero/positive integer corresponding to whether + * the first string is less than/equal to/greater than the second one + * in code point order + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n); + +/** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to u_strcmp(u_strFoldCase(s1, options), u_strFoldCase(s2, options)). + * + * @param s1 A string to compare. + * @param s2 A string to compare. + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @return A negative, zero, or positive integer indicating the comparison result. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options); + +/** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to u_strcmp(u_strFoldCase(s1, at most n, options), + * u_strFoldCase(s2, at most n, options)). + * + * @param s1 A string to compare. + * @param s2 A string to compare. + * @param n The maximum number of characters each string to case-fold and then compare. + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @return A negative, zero, or positive integer indicating the comparison result. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options); + +/** + * Compare two strings case-insensitively using full case folding. + * This is equivalent to u_strcmp(u_strFoldCase(s1, n, options), + * u_strFoldCase(s2, n, options)). + * + * @param s1 A string to compare. + * @param s2 A string to compare. + * @param length The number of characters in each string to case-fold and then compare. + * @param options A bit set of options: + * - U_FOLD_CASE_DEFAULT or 0 is used for default options: + * Comparison in code unit order with default case folding. + * + * - U_COMPARE_CODE_POINT_ORDER + * Set to choose code point order instead of code unit order + * (see u_strCompare for details). + * + * - U_FOLD_CASE_EXCLUDE_SPECIAL_I + * + * @return A negative, zero, or positive integer indicating the comparison result. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options); + +/** + * Copy a ustring. Adds a null terminator. + * + * @param dst The destination string. + * @param src The source string. + * @return A pointer to dst. + * @stable ICU 2.0 + */ +U_STABLE UChar* U_EXPORT2 +u_strcpy(UChar *dst, + const UChar *src); + +/** + * Copy a ustring. + * Copies at most n characters. The result will be null terminated + * if the length of src is less than n. + * + * @param dst The destination string. + * @param src The source string (can be NULL/invalid if n<=0). + * @param n The maximum number of characters to copy; no-op if <=0. + * @return A pointer to dst. + * @stable ICU 2.0 + */ +U_STABLE UChar* U_EXPORT2 +u_strncpy(UChar *dst, + const UChar *src, + int32_t n); + +#if !UCONFIG_NO_CONVERSION + +/** + * Copy a byte string encoded in the default codepage to a ustring. + * Adds a null terminator. + * Performs a host byte to UChar conversion + * + * @param dst The destination string. + * @param src The source string. + * @return A pointer to dst. + * @stable ICU 2.0 + */ +U_STABLE UChar* U_EXPORT2 u_uastrcpy(UChar *dst, + const char *src ); + +/** + * Copy a byte string encoded in the default codepage to a ustring. + * Copies at most n characters. The result will be null terminated + * if the length of src is less than n. + * Performs a host byte to UChar conversion + * + * @param dst The destination string. + * @param src The source string. + * @param n The maximum number of characters to copy. + * @return A pointer to dst. + * @stable ICU 2.0 + */ +U_STABLE UChar* U_EXPORT2 u_uastrncpy(UChar *dst, + const char *src, + int32_t n); + +/** + * Copy ustring to a byte string encoded in the default codepage. + * Adds a null terminator. + * Performs a UChar to host byte conversion + * + * @param dst The destination string. + * @param src The source string. + * @return A pointer to dst. + * @stable ICU 2.0 + */ +U_STABLE char* U_EXPORT2 u_austrcpy(char *dst, + const UChar *src ); + +/** + * Copy ustring to a byte string encoded in the default codepage. + * Copies at most n characters. The result will be null terminated + * if the length of src is less than n. + * Performs a UChar to host byte conversion + * + * @param dst The destination string. + * @param src The source string. + * @param n The maximum number of characters to copy. + * @return A pointer to dst. + * @stable ICU 2.0 + */ +U_STABLE char* U_EXPORT2 u_austrncpy(char *dst, + const UChar *src, + int32_t n ); + +#endif + +/** + * Synonym for memcpy(), but with UChars only. + * @param dest The destination string + * @param src The source string (can be NULL/invalid if count<=0) + * @param count The number of characters to copy; no-op if <=0 + * @return A pointer to dest + * @stable ICU 2.0 + */ +U_STABLE UChar* U_EXPORT2 +u_memcpy(UChar *dest, const UChar *src, int32_t count); + +/** + * Synonym for memmove(), but with UChars only. + * @param dest The destination string + * @param src The source string (can be NULL/invalid if count<=0) + * @param count The number of characters to move; no-op if <=0 + * @return A pointer to dest + * @stable ICU 2.0 + */ +U_STABLE UChar* U_EXPORT2 +u_memmove(UChar *dest, const UChar *src, int32_t count); + +/** + * Initialize count characters of dest to c. + * + * @param dest The destination string. + * @param c The character to initialize the string. + * @param count The maximum number of characters to set. + * @return A pointer to dest. + * @stable ICU 2.0 + */ +U_STABLE UChar* U_EXPORT2 +u_memset(UChar *dest, UChar c, int32_t count); + +/** + * Compare the first count UChars of each buffer. + * + * @param buf1 The first string to compare. + * @param buf2 The second string to compare. + * @param count The maximum number of UChars to compare. + * @return When buf1 < buf2, a negative number is returned. + * When buf1 == buf2, 0 is returned. + * When buf1 > buf2, a positive number is returned. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count); + +/** + * Compare two Unicode strings in code point order. + * This is different in UTF-16 from u_memcmp() if supplementary characters are present. + * For details, see u_strCompare(). + * + * @param s1 A string to compare. + * @param s2 A string to compare. + * @param count The maximum number of characters to compare. + * @return a negative/zero/positive integer corresponding to whether + * the first string is less than/equal to/greater than the second one + * in code point order + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_memcmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t count); + +/** + * Find the first occurrence of a BMP code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (contains count UChars). + * @param c The BMP code point to find. + * @param count The length of the string. + * @return A pointer to the first occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.0 + * + * @see u_strchr + * @see u_memchr32 + * @see u_strFindFirst + */ +U_STABLE UChar* U_EXPORT2 +u_memchr(const UChar *s, UChar c, int32_t count); + +/** + * Find the first occurrence of a code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (contains count UChars). + * @param c The code point to find. + * @param count The length of the string. + * @return A pointer to the first occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.0 + * + * @see u_strchr32 + * @see u_memchr + * @see u_strFindFirst + */ +U_STABLE UChar* U_EXPORT2 +u_memchr32(const UChar *s, UChar32 c, int32_t count); + +/** + * Find the last occurrence of a BMP code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (contains count UChars). + * @param c The BMP code point to find. + * @param count The length of the string. + * @return A pointer to the last occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.4 + * + * @see u_strrchr + * @see u_memrchr32 + * @see u_strFindLast + */ +U_STABLE UChar* U_EXPORT2 +u_memrchr(const UChar *s, UChar c, int32_t count); + +/** + * Find the last occurrence of a code point in a string. + * A surrogate code point is found only if its match in the text is not + * part of a surrogate pair. + * A NUL character is found at the string terminator. + * + * @param s The string to search (contains count UChars). + * @param c The code point to find. + * @param count The length of the string. + * @return A pointer to the last occurrence of c in s + * or NULL if c is not in s. + * @stable ICU 2.4 + * + * @see u_strrchr32 + * @see u_memrchr + * @see u_strFindLast + */ +U_STABLE UChar* U_EXPORT2 +u_memrchr32(const UChar *s, UChar32 c, int32_t count); + +/** + * Unicode String literals in C. + * We need one macro to declare a variable for the string + * and to statically preinitialize it if possible, + * and a second macro to dynamically intialize such a string variable if necessary. + * + * The macros are defined for maximum performance. + * They work only for strings that contain "invariant characters", i.e., + * only latin letters, digits, and some punctuation. + * See utypes.h for details. + * + * A pair of macros for a single string must be used with the same + * parameters. + * The string parameter must be a C string literal. + * The length of the string, not including the terminating + * NUL, must be specified as a constant. + * The U_STRING_DECL macro should be invoked exactly once for one + * such string variable before it is used. + * + * Usage: + *
+ *    U_STRING_DECL(ustringVar1, "Quick-Fox 2", 11);
+ *    U_STRING_DECL(ustringVar2, "jumps 5%", 8);
+ *    static UBool didInit=FALSE;
+ * 
+ *    int32_t function() {
+ *        if(!didInit) {
+ *            U_STRING_INIT(ustringVar1, "Quick-Fox 2", 11);
+ *            U_STRING_INIT(ustringVar2, "jumps 5%", 8);
+ *            didInit=TRUE;
+ *        }
+ *        return u_strcmp(ustringVar1, ustringVar2);
+ *    }
+ * 
+ * + * Note that the macros will NOT consistently work if their argument is another #define. + * The following will not work on all platforms, don't use it. + * + *
+ *     #define GLUCK "Mr. Gluck"
+ *     U_STRING_DECL(var, GLUCK, 9)
+ *     U_STRING_INIT(var, GLUCK, 9)
+ * 
+ * + * Instead, use the string literal "Mr. Gluck" as the argument to both macro + * calls. + * + * + * @stable ICU 2.0 + */ +#if defined(U_DECLARE_UTF16) +# define U_STRING_DECL(var, cs, length) static const UChar *var=(const UChar *)U_DECLARE_UTF16(cs) + /**@stable ICU 2.0 */ +# define U_STRING_INIT(var, cs, length) +#elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16))) +# define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=L ## cs + /**@stable ICU 2.0 */ +# define U_STRING_INIT(var, cs, length) +#elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY +# define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=cs + /**@stable ICU 2.0 */ +# define U_STRING_INIT(var, cs, length) +#else +# define U_STRING_DECL(var, cs, length) static UChar var[(length)+1] + /**@stable ICU 2.0 */ +# define U_STRING_INIT(var, cs, length) u_charsToUChars(cs, var, length+1) +#endif + +/** + * Unescape a string of characters and write the resulting + * Unicode characters to the destination buffer. The following escape + * sequences are recognized: + * + * \\uhhhh 4 hex digits; h in [0-9A-Fa-f] + * \\Uhhhhhhhh 8 hex digits + * \\xhh 1-2 hex digits + * \\x{h...} 1-8 hex digits + * \\ooo 1-3 octal digits; o in [0-7] + * \\cX control-X; X is masked with 0x1F + * + * as well as the standard ANSI C escapes: + * + * \\a => U+0007, \\b => U+0008, \\t => U+0009, \\n => U+000A, + * \\v => U+000B, \\f => U+000C, \\r => U+000D, \\e => U+001B, + * \\" => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C + * + * Anything else following a backslash is generically escaped. For + * example, "[a\\-z]" returns "[a-z]". + * + * If an escape sequence is ill-formed, this method returns an empty + * string. An example of an ill-formed sequence is "\\u" followed by + * fewer than 4 hex digits. + * + * The above characters are recognized in the compiler's codepage, + * that is, they are coded as 'u', '\\', etc. Characters that are + * not parts of escape sequences are converted using u_charsToUChars(). + * + * This function is similar to UnicodeString::unescape() but not + * identical to it. The latter takes a source UnicodeString, so it + * does escape recognition but no conversion. + * + * @param src a zero-terminated string of invariant characters + * @param dest pointer to buffer to receive converted and unescaped + * text and, if there is room, a zero terminator. May be NULL for + * preflighting, in which case no UChars will be written, but the + * return value will still be valid. On error, an empty string is + * stored here (if possible). + * @param destCapacity the number of UChars that may be written at + * dest. Ignored if dest == NULL. + * @return the length of unescaped string. + * @see u_unescapeAt + * @see UnicodeString#unescape() + * @see UnicodeString#unescapeAt() + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_unescape(const char *src, + UChar *dest, int32_t destCapacity); + +U_CDECL_BEGIN +/** + * Callback function for u_unescapeAt() that returns a character of + * the source text given an offset and a context pointer. The context + * pointer will be whatever is passed into u_unescapeAt(). + * + * @param offset pointer to the offset that will be passed to u_unescapeAt(). + * @param context an opaque pointer passed directly into u_unescapeAt() + * @return the character represented by the escape sequence at + * offset + * @see u_unescapeAt + * @stable ICU 2.0 + */ +typedef UChar (U_CALLCONV *UNESCAPE_CHAR_AT)(int32_t offset, void *context); +U_CDECL_END + +/** + * Unescape a single sequence. The character at offset-1 is assumed + * (without checking) to be a backslash. This method takes a callback + * pointer to a function that returns the UChar at a given offset. By + * varying this callback, ICU functions are able to unescape char* + * strings, UnicodeString objects, and UFILE pointers. + * + * If offset is out of range, or if the escape sequence is ill-formed, + * (UChar32)0xFFFFFFFF is returned. See documentation of u_unescape() + * for a list of recognized sequences. + * + * @param charAt callback function that returns a UChar of the source + * text given an offset and a context pointer. + * @param offset pointer to the offset that will be passed to charAt. + * The offset value will be updated upon return to point after the + * last parsed character of the escape sequence. On error the offset + * is unchanged. + * @param length the number of characters in the source text. The + * last character of the source text is considered to be at offset + * length-1. + * @param context an opaque pointer passed directly into charAt. + * @return the character represented by the escape sequence at + * offset, or (UChar32)0xFFFFFFFF on error. + * @see u_unescape() + * @see UnicodeString#unescape() + * @see UnicodeString#unescapeAt() + * @stable ICU 2.0 + */ +U_STABLE UChar32 U_EXPORT2 +u_unescapeAt(UNESCAPE_CHAR_AT charAt, + int32_t *offset, + int32_t length, + void *context); + +/** + * Uppercase the characters in a string. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer are allowed to overlap. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param src The original string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param locale The locale to consider, or "" for the root locale or NULL for the default locale. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The length of the result string. It may be greater than destCapacity. In that case, + * only some of the result was written to the destination buffer. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_strToUpper(UChar *dest, int32_t destCapacity, + const UChar *src, int32_t srcLength, + const char *locale, + UErrorCode *pErrorCode); + +/** + * Lowercase the characters in a string. + * Casing is locale-dependent and context-sensitive. + * The result may be longer or shorter than the original. + * The source string and the destination buffer are allowed to overlap. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param src The original string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param locale The locale to consider, or "" for the root locale or NULL for the default locale. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The length of the result string. It may be greater than destCapacity. In that case, + * only some of the result was written to the destination buffer. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_strToLower(UChar *dest, int32_t destCapacity, + const UChar *src, int32_t srcLength, + const char *locale, + UErrorCode *pErrorCode); + +#if !UCONFIG_NO_BREAK_ITERATION + +/** + * Titlecase a string. + * Casing is locale-dependent and context-sensitive. + * Titlecasing uses a break iterator to find the first characters of words + * that are to be titlecased. It titlecases those characters and lowercases + * all others. + * + * The titlecase break iterator can be provided to customize for arbitrary + * styles, using rules and dictionaries beyond the standard iterators. + * It may be more efficient to always provide an iterator to avoid + * opening and closing one for each string. + * The standard titlecase iterator for the root locale implements the + * algorithm of Unicode TR 21. + * + * This function uses only the setText(), first() and next() methods of the + * provided break iterator. + * + * The result may be longer or shorter than the original. + * The source string and the destination buffer are allowed to overlap. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param src The original string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param titleIter A break iterator to find the first characters of words + * that are to be titlecased. + * If none is provided (NULL), then a standard titlecase + * break iterator is opened. + * @param locale The locale to consider, or "" for the root locale or NULL for the default locale. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The length of the result string. It may be greater than destCapacity. In that case, + * only some of the result was written to the destination buffer. + * @stable ICU 2.1 + */ +U_STABLE int32_t U_EXPORT2 +u_strToTitle(UChar *dest, int32_t destCapacity, + const UChar *src, int32_t srcLength, + UBreakIterator *titleIter, + const char *locale, + UErrorCode *pErrorCode); + +#endif + +/** + * Case-folds the characters in a string. + * + * Case-folding is locale-independent and not context-sensitive, + * but there is an option for whether to include or exclude mappings for dotted I + * and dotless i that are marked with 'T' in CaseFolding.txt. + * + * The result may be longer or shorter than the original. + * The source string and the destination buffer are allowed to overlap. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the result + * without writing any of the result string. + * @param src The original string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param options Either U_FOLD_CASE_DEFAULT or U_FOLD_CASE_EXCLUDE_SPECIAL_I + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The length of the result string. It may be greater than destCapacity. In that case, + * only some of the result was written to the destination buffer. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +u_strFoldCase(UChar *dest, int32_t destCapacity, + const UChar *src, int32_t srcLength, + uint32_t options, + UErrorCode *pErrorCode); + +#if defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION +/** + * Convert a UTF-16 string to a wchar_t string. + * If it is known at compile time that wchar_t strings are in UTF-16 or UTF-32, then + * this function simply calls the fast, dedicated function for that. + * Otherwise, two conversions UTF-16 -> default charset -> wchar_t* are performed. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of wchar_t's). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * @param src The original source string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The pointer to destination buffer. + * @stable ICU 2.0 + */ +U_STABLE wchar_t* U_EXPORT2 +u_strToWCS(wchar_t *dest, + int32_t destCapacity, + int32_t *pDestLength, + const UChar *src, + int32_t srcLength, + UErrorCode *pErrorCode); +/** + * Convert a wchar_t string to UTF-16. + * If it is known at compile time that wchar_t strings are in UTF-16 or UTF-32, then + * this function simply calls the fast, dedicated function for that. + * Otherwise, two conversions wchar_t* -> default charset -> UTF-16 are performed. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * @param src The original source string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The pointer to destination buffer. + * @stable ICU 2.0 + */ +U_STABLE UChar* U_EXPORT2 +u_strFromWCS(UChar *dest, + int32_t destCapacity, + int32_t *pDestLength, + const wchar_t *src, + int32_t srcLength, + UErrorCode *pErrorCode); +#endif /* defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION */ + +/** + * Convert a UTF-16 string to UTF-8. + * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of chars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * @param src The original source string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The pointer to destination buffer. + * @stable ICU 2.0 + * @see u_strToUTF8WithSub + * @see u_strFromUTF8 + */ +U_STABLE char* U_EXPORT2 +u_strToUTF8(char *dest, + int32_t destCapacity, + int32_t *pDestLength, + const UChar *src, + int32_t srcLength, + UErrorCode *pErrorCode); + +/** + * Convert a UTF-8 string to UTF-16. + * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * @param src The original source string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param pErrorCode Must be a valid pointer to an error code value, + * which must not indicate a failure before the function call. + * @return The pointer to destination buffer. + * @stable ICU 2.0 + * @see u_strFromUTF8WithSub + * @see u_strFromUTF8Lenient + */ +U_STABLE UChar* U_EXPORT2 +u_strFromUTF8(UChar *dest, + int32_t destCapacity, + int32_t *pDestLength, + const char *src, + int32_t srcLength, + UErrorCode *pErrorCode); + +/** + * Convert a UTF-16 string to UTF-8. + * + * Same as u_strToUTF8() except for the additional subchar which is output for + * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code. + * With subchar==U_SENTINEL, this function behaves exactly like u_strToUTF8(). + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of chars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * @param src The original source string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param subchar The substitution character to use in place of an illegal input sequence, + * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. + * A substitution character can be any valid Unicode code point (up to U+10FFFF) + * except for surrogate code points (U+D800..U+DFFF). + * The recommended value is U+FFFD "REPLACEMENT CHARACTER". + * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. + * Set to 0 if no substitutions occur or subchar<0. + * pNumSubstitutions can be NULL. + * @param pErrorCode Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The pointer to destination buffer. + * @see u_strToUTF8 + * @see u_strFromUTF8WithSub + * @stable ICU 3.6 + */ +U_STABLE char* U_EXPORT2 +u_strToUTF8WithSub(char *dest, + int32_t destCapacity, + int32_t *pDestLength, + const UChar *src, + int32_t srcLength, + UChar32 subchar, int32_t *pNumSubstitutions, + UErrorCode *pErrorCode); + +/** + * Convert a UTF-8 string to UTF-16. + * + * Same as u_strFromUTF8() except for the additional subchar which is output for + * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code. + * With subchar==U_SENTINEL, this function behaves exactly like u_strFromUTF8(). + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * @param src The original source string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param subchar The substitution character to use in place of an illegal input sequence, + * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. + * A substitution character can be any valid Unicode code point (up to U+10FFFF) + * except for surrogate code points (U+D800..U+DFFF). + * The recommended value is U+FFFD "REPLACEMENT CHARACTER". + * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. + * Set to 0 if no substitutions occur or subchar<0. + * pNumSubstitutions can be NULL. + * @param pErrorCode Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The pointer to destination buffer. + * @see u_strFromUTF8 + * @see u_strFromUTF8Lenient + * @see u_strToUTF8WithSub + * @stable ICU 3.6 + */ +U_STABLE UChar* U_EXPORT2 +u_strFromUTF8WithSub(UChar *dest, + int32_t destCapacity, + int32_t *pDestLength, + const char *src, + int32_t srcLength, + UChar32 subchar, int32_t *pNumSubstitutions, + UErrorCode *pErrorCode); + +/** + * Convert a UTF-8 string to UTF-16. + * + * Same as u_strFromUTF8() except that this function is designed to be very fast, + * which it achieves by being lenient about malformed UTF-8 sequences. + * This function is intended for use in environments where UTF-8 text is + * expected to be well-formed. + * + * Its semantics are: + * - Well-formed UTF-8 text is correctly converted to well-formed UTF-16 text. + * - The function will not read beyond the input string, nor write beyond + * the destCapacity. + * - Malformed UTF-8 results in "garbage" 16-bit Unicode strings which may not + * be well-formed UTF-16. + * The function will resynchronize to valid code point boundaries + * within a small number of code points after an illegal sequence. + * - Non-shortest forms are not detected and will result in "spoofing" output. + * + * For further performance improvement, if srcLength is given (>=0), + * then it must be destCapacity>=srcLength. + * + * There is no inverse u_strToUTF8Lenient() function because there is practically + * no performance gain from not checking that a UTF-16 string is well-formed. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * Unlike for other ICU functions, if srcLength>=0 then it + * must be destCapacity>=srcLength. + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * Unlike for other ICU functions, if srcLength>=0 but + * destCapacity=0. + * Set to 0 if no substitutions occur or subchar<0. + * pNumSubstitutions can be NULL. + * @param pErrorCode Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The pointer to destination buffer. + * @see u_strToUTF32 + * @see u_strFromUTF32WithSub + * @stable ICU 4.2 + */ +U_STABLE UChar32* U_EXPORT2 +u_strToUTF32WithSub(UChar32 *dest, + int32_t destCapacity, + int32_t *pDestLength, + const UChar *src, + int32_t srcLength, + UChar32 subchar, int32_t *pNumSubstitutions, + UErrorCode *pErrorCode); + +/** + * Convert a UTF-32 string to UTF-16. + * + * Same as u_strFromUTF32() except for the additional subchar which is output for + * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code. + * With subchar==U_SENTINEL, this function behaves exactly like u_strFromUTF32(). + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * @param src The original source string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param subchar The substitution character to use in place of an illegal input sequence, + * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. + * A substitution character can be any valid Unicode code point (up to U+10FFFF) + * except for surrogate code points (U+D800..U+DFFF). + * The recommended value is U+FFFD "REPLACEMENT CHARACTER". + * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. + * Set to 0 if no substitutions occur or subchar<0. + * pNumSubstitutions can be NULL. + * @param pErrorCode Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The pointer to destination buffer. + * @see u_strFromUTF32 + * @see u_strToUTF32WithSub + * @stable ICU 4.2 + */ +U_STABLE UChar* U_EXPORT2 +u_strFromUTF32WithSub(UChar *dest, + int32_t destCapacity, + int32_t *pDestLength, + const UChar32 *src, + int32_t srcLength, + UChar32 subchar, int32_t *pNumSubstitutions, + UErrorCode *pErrorCode); + +/** + * Convert a 16-bit Unicode string to Java Modified UTF-8. + * See http://java.sun.com/javase/6/docs/api/java/io/DataInput.html#modified-utf-8 + * + * This function behaves according to the documentation for Java DataOutput.writeUTF() + * except that it does not encode the output length in the destination buffer + * and does not have an output length restriction. + * See http://java.sun.com/javase/6/docs/api/java/io/DataOutput.html#writeUTF(java.lang.String) + * + * The input string need not be well-formed UTF-16. + * (Therefore there is no subchar parameter.) + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of chars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * @param src The original source string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param pErrorCode Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The pointer to destination buffer. + * @stable ICU 4.4 + * @see u_strToUTF8WithSub + * @see u_strFromJavaModifiedUTF8WithSub + */ +U_STABLE char* U_EXPORT2 +u_strToJavaModifiedUTF8( + char *dest, + int32_t destCapacity, + int32_t *pDestLength, + const UChar *src, + int32_t srcLength, + UErrorCode *pErrorCode); + +/** + * Convert a Java Modified UTF-8 string to a 16-bit Unicode string. + * If the input string is not well-formed and no substitution char is specified, + * then the U_INVALID_CHAR_FOUND error code is set. + * + * This function behaves according to the documentation for Java DataInput.readUTF() + * except that it takes a length parameter rather than + * interpreting the first two input bytes as the length. + * See http://java.sun.com/javase/6/docs/api/java/io/DataInput.html#readUTF() + * + * The output string may not be well-formed UTF-16. + * + * @param dest A buffer for the result string. The result will be zero-terminated if + * the buffer is large enough. + * @param destCapacity The size of the buffer (number of UChars). If it is 0, then + * dest may be NULL and the function will only return the length of the + * result without writing any of the result string (pre-flighting). + * @param pDestLength A pointer to receive the number of units written to the destination. If + * pDestLength!=NULL then *pDestLength is always set to the + * number of output units corresponding to the transformation of + * all the input units, even in case of a buffer overflow. + * @param src The original source string + * @param srcLength The length of the original string. If -1, then src must be zero-terminated. + * @param subchar The substitution character to use in place of an illegal input sequence, + * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. + * A substitution character can be any valid Unicode code point (up to U+10FFFF) + * except for surrogate code points (U+D800..U+DFFF). + * The recommended value is U+FFFD "REPLACEMENT CHARACTER". + * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. + * Set to 0 if no substitutions occur or subchar<0. + * pNumSubstitutions can be NULL. + * @param pErrorCode Pointer to a standard ICU error code. Its input value must + * pass the U_SUCCESS() test, or else the function returns + * immediately. Check for U_FAILURE() on output or use with + * function chaining. (See User Guide for details.) + * @return The pointer to destination buffer. + * @see u_strFromUTF8WithSub + * @see u_strFromUTF8Lenient + * @see u_strToJavaModifiedUTF8 + * @stable ICU 4.4 + */ +U_STABLE UChar* U_EXPORT2 +u_strFromJavaModifiedUTF8WithSub( + UChar *dest, + int32_t destCapacity, + int32_t *pDestLength, + const char *src, + int32_t srcLength, + UChar32 subchar, int32_t *pNumSubstitutions, + UErrorCode *pErrorCode); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/ustringtrie.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/ustringtrie.h new file mode 100644 index 0000000..fd85648 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/ustringtrie.h @@ -0,0 +1,97 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2010-2012, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* file name: udicttrie.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2010dec17 +* created by: Markus W. Scherer +*/ + +#ifndef __USTRINGTRIE_H__ +#define __USTRINGTRIE_H__ + +/** + * \file + * \brief C API: Helper definitions for dictionary trie APIs. + */ + +#include "unicode/utypes.h" + + +/** + * Return values for BytesTrie::next(), UCharsTrie::next() and similar methods. + * @see USTRINGTRIE_MATCHES + * @see USTRINGTRIE_HAS_VALUE + * @see USTRINGTRIE_HAS_NEXT + * @stable ICU 4.8 + */ +enum UStringTrieResult { + /** + * The input unit(s) did not continue a matching string. + * Once current()/next() return USTRINGTRIE_NO_MATCH, + * all further calls to current()/next() will also return USTRINGTRIE_NO_MATCH, + * until the trie is reset to its original state or to a saved state. + * @stable ICU 4.8 + */ + USTRINGTRIE_NO_MATCH, + /** + * The input unit(s) continued a matching string + * but there is no value for the string so far. + * (It is a prefix of a longer string.) + * @stable ICU 4.8 + */ + USTRINGTRIE_NO_VALUE, + /** + * The input unit(s) continued a matching string + * and there is a value for the string so far. + * This value will be returned by getValue(). + * No further input byte/unit can continue a matching string. + * @stable ICU 4.8 + */ + USTRINGTRIE_FINAL_VALUE, + /** + * The input unit(s) continued a matching string + * and there is a value for the string so far. + * This value will be returned by getValue(). + * Another input byte/unit can continue a matching string. + * @stable ICU 4.8 + */ + USTRINGTRIE_INTERMEDIATE_VALUE +}; + +/** + * Same as (result!=USTRINGTRIE_NO_MATCH). + * @param result A result from BytesTrie::first(), UCharsTrie::next() etc. + * @return true if the input bytes/units so far are part of a matching string/byte sequence. + * @stable ICU 4.8 + */ +#define USTRINGTRIE_MATCHES(result) ((result)!=USTRINGTRIE_NO_MATCH) + +/** + * Equivalent to (result==USTRINGTRIE_INTERMEDIATE_VALUE || result==USTRINGTRIE_FINAL_VALUE) but + * this macro evaluates result exactly once. + * @param result A result from BytesTrie::first(), UCharsTrie::next() etc. + * @return true if there is a value for the input bytes/units so far. + * @see BytesTrie::getValue + * @see UCharsTrie::getValue + * @stable ICU 4.8 + */ +#define USTRINGTRIE_HAS_VALUE(result) ((result)>=USTRINGTRIE_FINAL_VALUE) + +/** + * Equivalent to (result==USTRINGTRIE_NO_VALUE || result==USTRINGTRIE_INTERMEDIATE_VALUE) but + * this macro evaluates result exactly once. + * @param result A result from BytesTrie::first(), UCharsTrie::next() etc. + * @return true if another input byte/unit can continue a matching string. + * @stable ICU 4.8 + */ +#define USTRINGTRIE_HAS_NEXT(result) ((result)&1) + +#endif /* __USTRINGTRIE_H__ */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/utext.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/utext.h new file mode 100644 index 0000000..65688d7 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/utext.h @@ -0,0 +1,1602 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2004-2012, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: utext.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2004oct06 +* created by: Markus W. Scherer +*/ + +#ifndef __UTEXT_H__ +#define __UTEXT_H__ + +/** + * \file + * \brief C API: Abstract Unicode Text API + * + * The Text Access API provides a means to allow text that is stored in alternative + * formats to work with ICU services. ICU normally operates on text that is + * stored in UTF-16 format, in (UChar *) arrays for the C APIs or as type + * UnicodeString for C++ APIs. + * + * ICU Text Access allows other formats, such as UTF-8 or non-contiguous + * UTF-16 strings, to be placed in a UText wrapper and then passed to ICU services. + * + * There are three general classes of usage for UText: + * + * Application Level Use. This is the simplest usage - applications would + * use one of the utext_open() functions on their input text, and pass + * the resulting UText to the desired ICU service. + * + * Second is usage in ICU Services, such as break iteration, that will need to + * operate on input presented to them as a UText. These implementations + * will need to use the iteration and related UText functions to gain + * access to the actual text. + * + * The third class of UText users are "text providers." These are the + * UText implementations for the various text storage formats. An application + * or system with a unique text storage format can implement a set of + * UText provider functions for that format, which will then allow + * ICU services to operate on that format. + * + * + * Iterating over text + * + * Here is sample code for a forward iteration over the contents of a UText + * + * \code + * UChar32 c; + * UText *ut = whatever(); + * + * for (c=utext_next32From(ut, 0); c>=0; c=utext_next32(ut)) { + * // do whatever with the codepoint c here. + * } + * \endcode + * + * And here is similar code to iterate in the reverse direction, from the end + * of the text towards the beginning. + * + * \code + * UChar32 c; + * UText *ut = whatever(); + * int textLength = utext_nativeLength(ut); + * for (c=utext_previous32From(ut, textLength); c>=0; c=utext_previous32(ut)) { + * // do whatever with the codepoint c here. + * } + * \endcode + * + * Characters and Indexing + * + * Indexing into text by UText functions is nearly always in terms of the native + * indexing of the underlying text storage. The storage format could be UTF-8 + * or UTF-32, for example. When coding to the UText access API, no assumptions + * can be made regarding the size of characters, or how far an index + * may move when iterating between characters. + * + * All indices supplied to UText functions are pinned to the length of the + * text. An out-of-bounds index is not considered to be an error, but is + * adjusted to be in the range 0 <= index <= length of input text. + * + * + * When an index position is returned from a UText function, it will be + * a native index to the underlying text. In the case of multi-unit characters, + * it will always refer to the first position of the character, + * never to the interior. This is essentially the same thing as saying that + * a returned index will always point to a boundary between characters. + * + * When a native index is supplied to a UText function, all indices that + * refer to any part of a multi-unit character representation are considered + * to be equivalent. In the case of multi-unit characters, an incoming index + * will be logically normalized to refer to the start of the character. + * + * It is possible to test whether a native index is on a code point boundary + * by doing a utext_setNativeIndex() followed by a utext_getNativeIndex(). + * If the index is returned unchanged, it was on a code point boundary. If + * an adjusted index is returned, the original index referred to the + * interior of a character. + * + * Conventions for calling UText functions + * + * Most UText access functions have as their first parameter a (UText *) pointer, + * which specifies the UText to be used. Unless otherwise noted, the + * pointer must refer to a valid, open UText. Attempting to + * use a closed UText or passing a NULL pointer is a programming error and + * will produce undefined results or NULL pointer exceptions. + * + * The UText_Open family of functions can either open an existing (closed) + * UText, or heap allocate a new UText. Here is sample code for creating + * a stack-allocated UText. + * + * \code + * char *s = whatever(); // A utf-8 string + * U_ErrorCode status = U_ZERO_ERROR; + * UText ut = UTEXT_INITIALIZER; + * utext_openUTF8(ut, s, -1, &status); + * if (U_FAILURE(status)) { + * // error handling + * } else { + * // work with the UText + * } + * \endcode + * + * Any existing UText passed to an open function _must_ have been initialized, + * either by the UTEXT_INITIALIZER, or by having been originally heap-allocated + * by an open function. Passing NULL will cause the open function to + * heap-allocate and fully initialize a new UText. + * + */ + + + +#include "unicode/utypes.h" +#include "unicode/uchar.h" +#if U_SHOW_CPLUSPLUS_API +#include "unicode/localpointer.h" +#include "unicode/rep.h" +#include "unicode/unistr.h" +#include "unicode/chariter.h" +#endif + + +U_CDECL_BEGIN + +struct UText; +typedef struct UText UText; /**< C typedef for struct UText. @stable ICU 3.6 */ + + +/*************************************************************************************** + * + * C Functions for creating UText wrappers around various kinds of text strings. + * + ****************************************************************************************/ + + +/** + * Close function for UText instances. + * Cleans up, releases any resources being held by an open UText. + *

+ * If the UText was originally allocated by one of the utext_open functions, + * the storage associated with the utext will also be freed. + * If the UText storage originated with the application, as it would with + * a local or static instance, the storage will not be deleted. + * + * An open UText can be reset to refer to new string by using one of the utext_open() + * functions without first closing the UText. + * + * @param ut The UText to be closed. + * @return NULL if the UText struct was deleted by the close. If the UText struct + * was originally provided by the caller to the open function, it is + * returned by this function, and may be safely used again in + * a subsequent utext_open. + * + * @stable ICU 3.4 + */ +U_STABLE UText * U_EXPORT2 +utext_close(UText *ut); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUTextPointer + * "Smart pointer" class, closes a UText via utext_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUTextPointer, UText, utext_close); + +U_NAMESPACE_END + +#endif + +/** + * Open a read-only UText implementation for UTF-8 strings. + * + * \htmlonly + * Any invalid UTF-8 in the input will be handled in this way: + * a sequence of bytes that has the form of a truncated, but otherwise valid, + * UTF-8 sequence will be replaced by a single unicode replacement character, \uFFFD. + * Any other illegal bytes will each be replaced by a \uFFFD. + * \endhtmlonly + * + * @param ut Pointer to a UText struct. If NULL, a new UText will be created. + * If non-NULL, must refer to an initialized UText struct, which will then + * be reset to reference the specified UTF-8 string. + * @param s A UTF-8 string. Must not be NULL. + * @param length The length of the UTF-8 string in bytes, or -1 if the string is + * zero terminated. + * @param status Errors are returned here. + * @return A pointer to the UText. If a pre-allocated UText was provided, it + * will always be used and returned. + * @stable ICU 3.4 + */ +U_STABLE UText * U_EXPORT2 +utext_openUTF8(UText *ut, const char *s, int64_t length, UErrorCode *status); + + +/** + * Open a read-only UText for UChar * string. + * + * @param ut Pointer to a UText struct. If NULL, a new UText will be created. + * If non-NULL, must refer to an initialized UText struct, which will then + * be reset to reference the specified UChar string. + * @param s A UChar (UTF-16) string + * @param length The number of UChars in the input string, or -1 if the string is + * zero terminated. + * @param status Errors are returned here. + * @return A pointer to the UText. If a pre-allocated UText was provided, it + * will always be used and returned. + * @stable ICU 3.4 + */ +U_STABLE UText * U_EXPORT2 +utext_openUChars(UText *ut, const UChar *s, int64_t length, UErrorCode *status); + + +#if U_SHOW_CPLUSPLUS_API +/** + * Open a writable UText for a non-const UnicodeString. + * + * @param ut Pointer to a UText struct. If NULL, a new UText will be created. + * If non-NULL, must refer to an initialized UText struct, which will then + * be reset to reference the specified input string. + * @param s A UnicodeString. + * @param status Errors are returned here. + * @return Pointer to the UText. If a UText was supplied as input, this + * will always be used and returned. + * @stable ICU 3.4 + */ +U_STABLE UText * U_EXPORT2 +utext_openUnicodeString(UText *ut, icu::UnicodeString *s, UErrorCode *status); + + +/** + * Open a UText for a const UnicodeString. The resulting UText will not be writable. + * + * @param ut Pointer to a UText struct. If NULL, a new UText will be created. + * If non-NULL, must refer to an initialized UText struct, which will then + * be reset to reference the specified input string. + * @param s A const UnicodeString to be wrapped. + * @param status Errors are returned here. + * @return Pointer to the UText. If a UText was supplied as input, this + * will always be used and returned. + * @stable ICU 3.4 + */ +U_STABLE UText * U_EXPORT2 +utext_openConstUnicodeString(UText *ut, const icu::UnicodeString *s, UErrorCode *status); + + +/** + * Open a writable UText implementation for an ICU Replaceable object. + * @param ut Pointer to a UText struct. If NULL, a new UText will be created. + * If non-NULL, must refer to an already existing UText, which will then + * be reset to reference the specified replaceable text. + * @param rep A Replaceable text object. + * @param status Errors are returned here. + * @return Pointer to the UText. If a UText was supplied as input, this + * will always be used and returned. + * @see Replaceable + * @stable ICU 3.4 + */ +U_STABLE UText * U_EXPORT2 +utext_openReplaceable(UText *ut, icu::Replaceable *rep, UErrorCode *status); + +/** + * Open a UText implementation over an ICU CharacterIterator. + * @param ut Pointer to a UText struct. If NULL, a new UText will be created. + * If non-NULL, must refer to an already existing UText, which will then + * be reset to reference the specified replaceable text. + * @param ci A Character Iterator. + * @param status Errors are returned here. + * @return Pointer to the UText. If a UText was supplied as input, this + * will always be used and returned. + * @see Replaceable + * @stable ICU 3.4 + */ +U_STABLE UText * U_EXPORT2 +utext_openCharacterIterator(UText *ut, icu::CharacterIterator *ci, UErrorCode *status); + +#endif + + +/** + * Clone a UText. This is much like opening a UText where the source text is itself + * another UText. + * + * A deep clone will copy both the UText data structures and the underlying text. + * The original and cloned UText will operate completely independently; modifications + * made to the text in one will not affect the other. Text providers are not + * required to support deep clones. The user of clone() must check the status return + * and be prepared to handle failures. + * + * The standard UText implementations for UTF8, UChar *, UnicodeString and + * Replaceable all support deep cloning. + * + * The UText returned from a deep clone will be writable, assuming that the text + * provider is able to support writing, even if the source UText had been made + * non-writable by means of UText_freeze(). + * + * A shallow clone replicates only the UText data structures; it does not make + * a copy of the underlying text. Shallow clones can be used as an efficient way to + * have multiple iterators active in a single text string that is not being + * modified. + * + * A shallow clone operation will not fail, barring truly exceptional conditions such + * as memory allocation failures. + * + * Shallow UText clones should be avoided if the UText functions that modify the + * text are expected to be used, either on the original or the cloned UText. + * Any such modifications can cause unpredictable behavior. Read Only + * shallow clones provide some protection against errors of this type by + * disabling text modification via the cloned UText. + * + * A shallow clone made with the readOnly parameter == FALSE will preserve the + * utext_isWritable() state of the source object. Note, however, that + * write operations must be avoided while more than one UText exists that refer + * to the same underlying text. + * + * A UText and its clone may be safely concurrently accessed by separate threads. + * This is true for read access only with shallow clones, and for both read and + * write access with deep clones. + * It is the responsibility of the Text Provider to ensure that this thread safety + * constraint is met. + * + * @param dest A UText struct to be filled in with the result of the clone operation, + * or NULL if the clone function should heap-allocate a new UText struct. + * If non-NULL, must refer to an already existing UText, which will then + * be reset to become the clone. + * @param src The UText to be cloned. + * @param deep TRUE to request a deep clone, FALSE for a shallow clone. + * @param readOnly TRUE to request that the cloned UText have read only access to the + * underlying text. + + * @param status Errors are returned here. For deep clones, U_UNSUPPORTED_ERROR + * will be returned if the text provider is unable to clone the + * original text. + * @return The newly created clone, or NULL if the clone operation failed. + * @stable ICU 3.4 + */ +U_STABLE UText * U_EXPORT2 +utext_clone(UText *dest, const UText *src, UBool deep, UBool readOnly, UErrorCode *status); + + +/** + * Compare two UText objects for equality. + * UTexts are equal if they are iterating over the same text, and + * have the same iteration position within the text. + * If either or both of the parameters are NULL, the comparison is FALSE. + * + * @param a The first of the two UTexts to compare. + * @param b The other UText to be compared. + * @return TRUE if the two UTexts are equal. + * @stable ICU 3.6 + */ +U_STABLE UBool U_EXPORT2 +utext_equals(const UText *a, const UText *b); + + +/***************************************************************************** + * + * Functions to work with the text represeted by a UText wrapper + * + *****************************************************************************/ + +/** + * Get the length of the text. Depending on the characteristics + * of the underlying text representation, this may be expensive. + * @see utext_isLengthExpensive() + * + * + * @param ut the text to be accessed. + * @return the length of the text, expressed in native units. + * + * @stable ICU 3.4 + */ +U_STABLE int64_t U_EXPORT2 +utext_nativeLength(UText *ut); + +/** + * Return TRUE if calculating the length of the text could be expensive. + * Finding the length of NUL terminated strings is considered to be expensive. + * + * Note that the value of this function may change + * as the result of other operations on a UText. + * Once the length of a string has been discovered, it will no longer + * be expensive to report it. + * + * @param ut the text to be accessed. + * @return TRUE if determining the length of the text could be time consuming. + * @stable ICU 3.4 + */ +U_STABLE UBool U_EXPORT2 +utext_isLengthExpensive(const UText *ut); + +/** + * Returns the code point at the requested index, + * or U_SENTINEL (-1) if it is out of bounds. + * + * If the specified index points to the interior of a multi-unit + * character - one of the trail bytes of a UTF-8 sequence, for example - + * the complete code point will be returned. + * + * The iteration position will be set to the start of the returned code point. + * + * This function is roughly equivalent to the the sequence + * utext_setNativeIndex(index); + * utext_current32(); + * (There is a subtle difference if the index is out of bounds by being less than zero - + * utext_setNativeIndex(negative value) sets the index to zero, after which utext_current() + * will return the char at zero. utext_char32At(negative index), on the other hand, will + * return the U_SENTINEL value of -1.) + * + * @param ut the text to be accessed + * @param nativeIndex the native index of the character to be accessed. If the index points + * to other than the first unit of a multi-unit character, it will be adjusted + * to the start of the character. + * @return the code point at the specified index. + * @stable ICU 3.4 + */ +U_STABLE UChar32 U_EXPORT2 +utext_char32At(UText *ut, int64_t nativeIndex); + + +/** + * + * Get the code point at the current iteration position, + * or U_SENTINEL (-1) if the iteration has reached the end of + * the input text. + * + * @param ut the text to be accessed. + * @return the Unicode code point at the current iterator position. + * @stable ICU 3.4 + */ +U_STABLE UChar32 U_EXPORT2 +utext_current32(UText *ut); + + +/** + * Get the code point at the current iteration position of the UText, and + * advance the position to the first index following the character. + * + * If the position is at the end of the text (the index following + * the last character, which is also the length of the text), + * return U_SENTINEL (-1) and do not advance the index. + * + * This is a post-increment operation. + * + * An inline macro version of this function, UTEXT_NEXT32(), + * is available for performance critical use. + * + * @param ut the text to be accessed. + * @return the Unicode code point at the iteration position. + * @see UTEXT_NEXT32 + * @stable ICU 3.4 + */ +U_STABLE UChar32 U_EXPORT2 +utext_next32(UText *ut); + + +/** + * Move the iterator position to the character (code point) whose + * index precedes the current position, and return that character. + * This is a pre-decrement operation. + * + * If the initial position is at the start of the text (index of 0) + * return U_SENTINEL (-1), and leave the position unchanged. + * + * An inline macro version of this function, UTEXT_PREVIOUS32(), + * is available for performance critical use. + * + * @param ut the text to be accessed. + * @return the previous UChar32 code point, or U_SENTINEL (-1) + * if the iteration has reached the start of the text. + * @see UTEXT_PREVIOUS32 + * @stable ICU 3.4 + */ +U_STABLE UChar32 U_EXPORT2 +utext_previous32(UText *ut); + + +/** + * Set the iteration index and return the code point at that index. + * Leave the iteration index at the start of the following code point. + * + * This function is the most efficient and convenient way to + * begin a forward iteration. The results are identical to the those + * from the sequence + * \code + * utext_setIndex(); + * utext_next32(); + * \endcode + * + * @param ut the text to be accessed. + * @param nativeIndex Iteration index, in the native units of the text provider. + * @return Code point which starts at or before index, + * or U_SENTINEL (-1) if it is out of bounds. + * @stable ICU 3.4 + */ +U_STABLE UChar32 U_EXPORT2 +utext_next32From(UText *ut, int64_t nativeIndex); + + + +/** + * Set the iteration index, and return the code point preceding the + * one specified by the initial index. Leave the iteration position + * at the start of the returned code point. + * + * This function is the most efficient and convenient way to + * begin a backwards iteration. + * + * @param ut the text to be accessed. + * @param nativeIndex Iteration index in the native units of the text provider. + * @return Code point preceding the one at the initial index, + * or U_SENTINEL (-1) if it is out of bounds. + * + * @stable ICU 3.4 + */ +U_STABLE UChar32 U_EXPORT2 +utext_previous32From(UText *ut, int64_t nativeIndex); + +/** + * Get the current iterator position, which can range from 0 to + * the length of the text. + * The position is a native index into the input text, in whatever format it + * may have (possibly UTF-8 for example), and may not always be the same as + * the corresponding UChar (UTF-16) index. + * The returned position will always be aligned to a code point boundary. + * + * @param ut the text to be accessed. + * @return the current index position, in the native units of the text provider. + * @stable ICU 3.4 + */ +U_STABLE int64_t U_EXPORT2 +utext_getNativeIndex(const UText *ut); + +/** + * Set the current iteration position to the nearest code point + * boundary at or preceding the specified index. + * The index is in the native units of the original input text. + * If the index is out of range, it will be pinned to be within + * the range of the input text. + *

+ * It will usually be more efficient to begin an iteration + * using the functions utext_next32From() or utext_previous32From() + * rather than setIndex(). + *

+ * Moving the index position to an adjacent character is best done + * with utext_next32(), utext_previous32() or utext_moveIndex32(). + * Attempting to do direct arithmetic on the index position is + * complicated by the fact that the size (in native units) of a + * character depends on the underlying representation of the character + * (UTF-8, UTF-16, UTF-32, arbitrary codepage), and is not + * easily knowable. + * + * @param ut the text to be accessed. + * @param nativeIndex the native unit index of the new iteration position. + * @stable ICU 3.4 + */ +U_STABLE void U_EXPORT2 +utext_setNativeIndex(UText *ut, int64_t nativeIndex); + +/** + * Move the iterator postion by delta code points. The number of code points + * is a signed number; a negative delta will move the iterator backwards, + * towards the start of the text. + *

+ * The index is moved by delta code points + * forward or backward, but no further backward than to 0 and + * no further forward than to utext_nativeLength(). + * The resulting index value will be in between 0 and length, inclusive. + * + * @param ut the text to be accessed. + * @param delta the signed number of code points to move the iteration position. + * @return TRUE if the position could be moved the requested number of positions while + * staying within the range [0 - text length]. + * @stable ICU 3.4 + */ +U_STABLE UBool U_EXPORT2 +utext_moveIndex32(UText *ut, int32_t delta); + +/** + * Get the native index of the character preceeding the current position. + * If the iteration position is already at the start of the text, zero + * is returned. + * The value returned is the same as that obtained from the following sequence, + * but without the side effect of changing the iteration position. + * + * \code + * UText *ut = whatever; + * ... + * utext_previous(ut) + * utext_getNativeIndex(ut); + * \endcode + * + * This function is most useful during forwards iteration, where it will get the + * native index of the character most recently returned from utext_next(). + * + * @param ut the text to be accessed + * @return the native index of the character preceeding the current index position, + * or zero if the current position is at the start of the text. + * @stable ICU 3.6 + */ +U_STABLE int64_t U_EXPORT2 +utext_getPreviousNativeIndex(UText *ut); + + +/** + * + * Extract text from a UText into a UChar buffer. The range of text to be extracted + * is specified in the native indices of the UText provider. These may not necessarily + * be UTF-16 indices. + *

+ * The size (number of 16 bit UChars) of the data to be extracted is returned. The + * full number of UChars is returned, even when the extracted text is truncated + * because the specified buffer size is too small. + *

+ * The extracted string will (if you are a user) / must (if you are a text provider) + * be NUL-terminated if there is sufficient space in the destination buffer. This + * terminating NUL is not included in the returned length. + *

+ * The iteration index is left at the position following the last extracted character. + * + * @param ut the UText from which to extract data. + * @param nativeStart the native index of the first character to extract.\ + * If the specified index is out of range, + * it will be pinned to to be within 0 <= index <= textLength + * @param nativeLimit the native string index of the position following the last + * character to extract. If the specified index is out of range, + * it will be pinned to to be within 0 <= index <= textLength. + * nativeLimit must be >= nativeStart. + * @param dest the UChar (UTF-16) buffer into which the extracted text is placed + * @param destCapacity The size, in UChars, of the destination buffer. May be zero + * for precomputing the required size. + * @param status receives any error status. + * U_BUFFER_OVERFLOW_ERROR: the extracted text was truncated because the + * buffer was too small. Returns number of UChars for preflighting. + * @return Number of UChars in the data to be extracted. Does not include a trailing NUL. + * + * @stable ICU 3.4 + */ +U_STABLE int32_t U_EXPORT2 +utext_extract(UText *ut, + int64_t nativeStart, int64_t nativeLimit, + UChar *dest, int32_t destCapacity, + UErrorCode *status); + + + +/************************************************************************************ + * + * #define inline versions of selected performance-critical text access functions + * Caution: do not use auto increment++ or decrement-- expressions + * as parameters to these macros. + * + * For most use, where there is no extreme performance constraint, the + * normal, non-inline functions are a better choice. The resulting code + * will be smaller, and, if the need ever arises, easier to debug. + * + * These are implemented as #defines rather than real functions + * because there is no fully portable way to do inline functions in plain C. + * + ************************************************************************************/ + +#ifndef U_HIDE_INTERNAL_API +/** + * inline version of utext_current32(), for performance-critical situations. + * + * Get the code point at the current iteration position of the UText. + * Returns U_SENTINEL (-1) if the position is at the end of the + * text. + * + * @internal ICU 4.4 technology preview + */ +#define UTEXT_CURRENT32(ut) \ + ((ut)->chunkOffset < (ut)->chunkLength && ((ut)->chunkContents)[(ut)->chunkOffset]<0xd800 ? \ + ((ut)->chunkContents)[((ut)->chunkOffset)] : utext_current32(ut)) +#endif /* U_HIDE_INTERNAL_API */ + +/** + * inline version of utext_next32(), for performance-critical situations. + * + * Get the code point at the current iteration position of the UText, and + * advance the position to the first index following the character. + * This is a post-increment operation. + * Returns U_SENTINEL (-1) if the position is at the end of the + * text. + * + * @stable ICU 3.4 + */ +#define UTEXT_NEXT32(ut) \ + ((ut)->chunkOffset < (ut)->chunkLength && ((ut)->chunkContents)[(ut)->chunkOffset]<0xd800 ? \ + ((ut)->chunkContents)[((ut)->chunkOffset)++] : utext_next32(ut)) + +/** + * inline version of utext_previous32(), for performance-critical situations. + * + * Move the iterator position to the character (code point) whose + * index precedes the current position, and return that character. + * This is a pre-decrement operation. + * Returns U_SENTINEL (-1) if the position is at the start of the text. + * + * @stable ICU 3.4 + */ +#define UTEXT_PREVIOUS32(ut) \ + ((ut)->chunkOffset > 0 && \ + (ut)->chunkContents[(ut)->chunkOffset-1] < 0xd800 ? \ + (ut)->chunkContents[--((ut)->chunkOffset)] : utext_previous32(ut)) + +/** + * inline version of utext_getNativeIndex(), for performance-critical situations. + * + * Get the current iterator position, which can range from 0 to + * the length of the text. + * The position is a native index into the input text, in whatever format it + * may have (possibly UTF-8 for example), and may not always be the same as + * the corresponding UChar (UTF-16) index. + * The returned position will always be aligned to a code point boundary. + * + * @stable ICU 3.6 + */ +#define UTEXT_GETNATIVEINDEX(ut) \ + ((ut)->chunkOffset <= (ut)->nativeIndexingLimit? \ + (ut)->chunkNativeStart+(ut)->chunkOffset : \ + (ut)->pFuncs->mapOffsetToNative(ut)) + +/** + * inline version of utext_setNativeIndex(), for performance-critical situations. + * + * Set the current iteration position to the nearest code point + * boundary at or preceding the specified index. + * The index is in the native units of the original input text. + * If the index is out of range, it will be pinned to be within + * the range of the input text. + * + * @stable ICU 3.8 + */ +#define UTEXT_SETNATIVEINDEX(ut, ix) \ + { int64_t __offset = (ix) - (ut)->chunkNativeStart; \ + if (__offset>=0 && __offset<(int64_t)(ut)->nativeIndexingLimit && (ut)->chunkContents[__offset]<0xdc00) { \ + (ut)->chunkOffset=(int32_t)__offset; \ + } else { \ + utext_setNativeIndex((ut), (ix)); } } + + + +/************************************************************************************ + * + * Functions related to writing or modifying the text. + * These will work only with modifiable UTexts. Attempting to + * modify a read-only UText will return an error status. + * + ************************************************************************************/ + + +/** + * Return TRUE if the text can be written (modified) with utext_replace() or + * utext_copy(). For the text to be writable, the text provider must + * be of a type that supports writing and the UText must not be frozen. + * + * Attempting to modify text when utext_isWriteable() is FALSE will fail - + * the text will not be modified, and an error will be returned from the function + * that attempted the modification. + * + * @param ut the UText to be tested. + * @return TRUE if the text is modifiable. + * + * @see utext_freeze() + * @see utext_replace() + * @see utext_copy() + * @stable ICU 3.4 + * + */ +U_STABLE UBool U_EXPORT2 +utext_isWritable(const UText *ut); + + +/** + * Test whether there is meta data associated with the text. + * @see Replaceable::hasMetaData() + * + * @param ut The UText to be tested + * @return TRUE if the underlying text includes meta data. + * @stable ICU 3.4 + */ +U_STABLE UBool U_EXPORT2 +utext_hasMetaData(const UText *ut); + + +/** + * Replace a range of the original text with a replacement text. + * + * Leaves the current iteration position at the position following the + * newly inserted replacement text. + * + * This function is only available on UText types that support writing, + * that is, ones where utext_isWritable() returns TRUE. + * + * When using this function, there should be only a single UText opened onto the + * underlying native text string. Behavior after a replace operation + * on a UText is undefined for any other additional UTexts that refer to the + * modified string. + * + * @param ut the UText representing the text to be operated on. + * @param nativeStart the native index of the start of the region to be replaced + * @param nativeLimit the native index of the character following the region to be replaced. + * @param replacementText pointer to the replacement text + * @param replacementLength length of the replacement text, or -1 if the text is NUL terminated. + * @param status receives any error status. Possible errors include + * U_NO_WRITE_PERMISSION + * + * @return The signed number of (native) storage units by which + * the length of the text expanded or contracted. + * + * @stable ICU 3.4 + */ +U_STABLE int32_t U_EXPORT2 +utext_replace(UText *ut, + int64_t nativeStart, int64_t nativeLimit, + const UChar *replacementText, int32_t replacementLength, + UErrorCode *status); + + + +/** + * + * Copy or move a substring from one position to another within the text, + * while retaining any metadata associated with the text. + * This function is used to duplicate or reorder substrings. + * The destination index must not overlap the source range. + * + * The text to be copied or moved is inserted at destIndex; + * it does not replace or overwrite any existing text. + * + * The iteration position is left following the newly inserted text + * at the destination position. + * + * This function is only available on UText types that support writing, + * that is, ones where utext_isWritable() returns TRUE. + * + * When using this function, there should be only a single UText opened onto the + * underlying native text string. Behavior after a copy operation + * on a UText is undefined in any other additional UTexts that refer to the + * modified string. + * + * @param ut The UText representing the text to be operated on. + * @param nativeStart The native index of the start of the region to be copied or moved + * @param nativeLimit The native index of the character position following the region + * to be copied. + * @param destIndex The native destination index to which the source substring is + * copied or moved. + * @param move If TRUE, then the substring is moved, not copied/duplicated. + * @param status receives any error status. Possible errors include U_NO_WRITE_PERMISSION + * + * @stable ICU 3.4 + */ +U_STABLE void U_EXPORT2 +utext_copy(UText *ut, + int64_t nativeStart, int64_t nativeLimit, + int64_t destIndex, + UBool move, + UErrorCode *status); + + +/** + *

+ * Freeze a UText. This prevents any modification to the underlying text itself + * by means of functions operating on this UText. + *

+ *

+ * Once frozen, a UText can not be unfrozen. The intent is to ensure + * that a the text underlying a frozen UText wrapper cannot be modified via that UText. + *

+ *

+ * Caution: freezing a UText will disable changes made via the specific + * frozen UText wrapper only; it will not have any effect on the ability to + * directly modify the text by bypassing the UText. Any such backdoor modifications + * are always an error while UText access is occuring because the underlying + * text can get out of sync with UText's buffering. + *

+ * + * @param ut The UText to be frozen. + * @see utext_isWritable() + * @stable ICU 3.6 + */ +U_STABLE void U_EXPORT2 +utext_freeze(UText *ut); + + +/** + * UText provider properties (bit field indexes). + * + * @see UText + * @stable ICU 3.4 + */ +enum { + /** + * It is potentially time consuming for the provider to determine the length of the text. + * @stable ICU 3.4 + */ + UTEXT_PROVIDER_LENGTH_IS_EXPENSIVE = 1, + /** + * Text chunks remain valid and usable until the text object is modified or + * deleted, not just until the next time the access() function is called + * (which is the default). + * @stable ICU 3.4 + */ + UTEXT_PROVIDER_STABLE_CHUNKS = 2, + /** + * The provider supports modifying the text via the replace() and copy() + * functions. + * @see Replaceable + * @stable ICU 3.4 + */ + UTEXT_PROVIDER_WRITABLE = 3, + /** + * There is meta data associated with the text. + * @see Replaceable::hasMetaData() + * @stable ICU 3.4 + */ + UTEXT_PROVIDER_HAS_META_DATA = 4, + /** + * Text provider owns the text storage. + * Generally occurs as the result of a deep clone of the UText. + * When closing the UText, the associated text must + * also be closed/deleted/freed/ whatever is appropriate. + * @stable ICU 3.6 + */ + UTEXT_PROVIDER_OWNS_TEXT = 5 +}; + +/** + * Function type declaration for UText.clone(). + * + * clone a UText. Much like opening a UText where the source text is itself + * another UText. + * + * A deep clone will copy both the UText data structures and the underlying text. + * The original and cloned UText will operate completely independently; modifications + * made to the text in one will not effect the other. Text providers are not + * required to support deep clones. The user of clone() must check the status return + * and be prepared to handle failures. + * + * A shallow clone replicates only the UText data structures; it does not make + * a copy of the underlying text. Shallow clones can be used as an efficient way to + * have multiple iterators active in a single text string that is not being + * modified. + * + * A shallow clone operation must not fail except for truly exceptional conditions such + * as memory allocation failures. + * + * A UText and its clone may be safely concurrently accessed by separate threads. + * This is true for both shallow and deep clones. + * It is the responsibility of the Text Provider to ensure that this thread safety + * constraint is met. + + * + * @param dest A UText struct to be filled in with the result of the clone operation, + * or NULL if the clone function should heap-allocate a new UText struct. + * @param src The UText to be cloned. + * @param deep TRUE to request a deep clone, FALSE for a shallow clone. + * @param status Errors are returned here. For deep clones, U_UNSUPPORTED_ERROR + * should be returned if the text provider is unable to clone the + * original text. + * @return The newly created clone, or NULL if the clone operation failed. + * + * @stable ICU 3.4 + */ +typedef UText * U_CALLCONV +UTextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status); + + +/** + * Function type declaration for UText.nativeLength(). + * + * @param ut the UText to get the length of. + * @return the length, in the native units of the original text string. + * @see UText + * @stable ICU 3.4 + */ +typedef int64_t U_CALLCONV +UTextNativeLength(UText *ut); + +/** + * Function type declaration for UText.access(). Get the description of the text chunk + * containing the text at a requested native index. The UText's iteration + * position will be left at the requested index. If the index is out + * of bounds, the iteration position will be left at the start or end + * of the string, as appropriate. + * + * Chunks must begin and end on code point boundaries. A single code point + * comprised of multiple storage units must never span a chunk boundary. + * + * + * @param ut the UText being accessed. + * @param nativeIndex Requested index of the text to be accessed. + * @param forward If TRUE, then the returned chunk must contain text + * starting from the index, so that start<=index + * The size (number of 16 bit UChars) in the data to be extracted is returned. The + * full amount is returned, even when the specified buffer size is smaller. + *

+ * The extracted string will (if you are a user) / must (if you are a text provider) + * be NUL-terminated if there is sufficient space in the destination buffer. + * + * @param ut the UText from which to extract data. + * @param nativeStart the native index of the first characer to extract. + * @param nativeLimit the native string index of the position following the last + * character to extract. + * @param dest the UChar (UTF-16) buffer into which the extracted text is placed + * @param destCapacity The size, in UChars, of the destination buffer. May be zero + * for precomputing the required size. + * @param status receives any error status. + * If U_BUFFER_OVERFLOW_ERROR: Returns number of UChars for + * preflighting. + * @return Number of UChars in the data. Does not include a trailing NUL. + * + * @stable ICU 3.4 + */ +typedef int32_t U_CALLCONV +UTextExtract(UText *ut, + int64_t nativeStart, int64_t nativeLimit, + UChar *dest, int32_t destCapacity, + UErrorCode *status); + +/** + * Function type declaration for UText.replace(). + * + * Replace a range of the original text with a replacement text. + * + * Leaves the current iteration position at the position following the + * newly inserted replacement text. + * + * This function need only be implemented on UText types that support writing. + * + * When using this function, there should be only a single UText opened onto the + * underlying native text string. The function is responsible for updating the + * text chunk within the UText to reflect the updated iteration position, + * taking into account any changes to the underlying string's structure caused + * by the replace operation. + * + * @param ut the UText representing the text to be operated on. + * @param nativeStart the index of the start of the region to be replaced + * @param nativeLimit the index of the character following the region to be replaced. + * @param replacementText pointer to the replacement text + * @param replacmentLength length of the replacement text in UChars, or -1 if the text is NUL terminated. + * @param status receives any error status. Possible errors include + * U_NO_WRITE_PERMISSION + * + * @return The signed number of (native) storage units by which + * the length of the text expanded or contracted. + * + * @stable ICU 3.4 + */ +typedef int32_t U_CALLCONV +UTextReplace(UText *ut, + int64_t nativeStart, int64_t nativeLimit, + const UChar *replacementText, int32_t replacmentLength, + UErrorCode *status); + +/** + * Function type declaration for UText.copy(). + * + * Copy or move a substring from one position to another within the text, + * while retaining any metadata associated with the text. + * This function is used to duplicate or reorder substrings. + * The destination index must not overlap the source range. + * + * The text to be copied or moved is inserted at destIndex; + * it does not replace or overwrite any existing text. + * + * This function need only be implemented for UText types that support writing. + * + * When using this function, there should be only a single UText opened onto the + * underlying native text string. The function is responsible for updating the + * text chunk within the UText to reflect the updated iteration position, + * taking into account any changes to the underlying string's structure caused + * by the replace operation. + * + * @param ut The UText representing the text to be operated on. + * @param nativeStart The index of the start of the region to be copied or moved + * @param nativeLimit The index of the character following the region to be replaced. + * @param nativeDest The destination index to which the source substring is copied or moved. + * @param move If TRUE, then the substring is moved, not copied/duplicated. + * @param status receives any error status. Possible errors include U_NO_WRITE_PERMISSION + * + * @stable ICU 3.4 + */ +typedef void U_CALLCONV +UTextCopy(UText *ut, + int64_t nativeStart, int64_t nativeLimit, + int64_t nativeDest, + UBool move, + UErrorCode *status); + +/** + * Function type declaration for UText.mapOffsetToNative(). + * Map from the current UChar offset within the current text chunk to + * the corresponding native index in the original source text. + * + * This is required only for text providers that do not use native UTF-16 indexes. + * + * @param ut the UText. + * @return Absolute (native) index corresponding to chunkOffset in the current chunk. + * The returned native index should always be to a code point boundary. + * + * @stable ICU 3.4 + */ +typedef int64_t U_CALLCONV +UTextMapOffsetToNative(const UText *ut); + +/** + * Function type declaration for UText.mapIndexToUTF16(). + * Map from a native index to a UChar offset within a text chunk. + * Behavior is undefined if the native index does not fall within the + * current chunk. + * + * This function is required only for text providers that do not use native UTF-16 indexes. + * + * @param ut The UText containing the text chunk. + * @param nativeIndex Absolute (native) text index, chunk->start<=index<=chunk->limit. + * @return Chunk-relative UTF-16 offset corresponding to the specified native + * index. + * + * @stable ICU 3.4 + */ +typedef int32_t U_CALLCONV +UTextMapNativeIndexToUTF16(const UText *ut, int64_t nativeIndex); + + +/** + * Function type declaration for UText.utextClose(). + * + * A Text Provider close function is only required for provider types that make + * allocations in their open function (or other functions) that must be + * cleaned when the UText is closed. + * + * The allocation of the UText struct itself and any "extra" storage + * associated with the UText is handled by the common UText implementation + * and does not require provider specific cleanup in a close function. + * + * Most UText provider implementations do not need to implement this function. + * + * @param ut A UText object to be closed. + * + * @stable ICU 3.4 + */ +typedef void U_CALLCONV +UTextClose(UText *ut); + + +/** + * (public) Function dispatch table for UText. + * Conceptually very much like a C++ Virtual Function Table. + * This struct defines the organization of the table. + * Each text provider implementation must provide an + * actual table that is initialized with the appropriate functions + * for the type of text being handled. + * @stable ICU 3.6 + */ +struct UTextFuncs { + /** + * (public) Function table size, sizeof(UTextFuncs) + * Intended for use should the table grow to accomodate added + * functions in the future, to allow tests for older format + * function tables that do not contain the extensions. + * + * Fields are placed for optimal alignment on + * 32/64/128-bit-pointer machines, by normally grouping together + * 4 32-bit fields, + * 4 pointers, + * 2 64-bit fields + * in sequence. + * @stable ICU 3.6 + */ + int32_t tableSize; + + /** + * (private) Alignment padding. + * Do not use, reserved for use by the UText framework only. + * @internal + */ + int32_t reserved1, /** @internal */ reserved2, /** @internal */ reserved3; + + + /** + * (public) Function pointer for UTextClone + * + * @see UTextClone + * @stable ICU 3.6 + */ + UTextClone *clone; + + /** + * (public) function pointer for UTextLength + * May be expensive to compute! + * + * @see UTextLength + * @stable ICU 3.6 + */ + UTextNativeLength *nativeLength; + + /** + * (public) Function pointer for UTextAccess. + * + * @see UTextAccess + * @stable ICU 3.6 + */ + UTextAccess *access; + + /** + * (public) Function pointer for UTextExtract. + * + * @see UTextExtract + * @stable ICU 3.6 + */ + UTextExtract *extract; + + /** + * (public) Function pointer for UTextReplace. + * + * @see UTextReplace + * @stable ICU 3.6 + */ + UTextReplace *replace; + + /** + * (public) Function pointer for UTextCopy. + * + * @see UTextCopy + * @stable ICU 3.6 + */ + UTextCopy *copy; + + /** + * (public) Function pointer for UTextMapOffsetToNative. + * + * @see UTextMapOffsetToNative + * @stable ICU 3.6 + */ + UTextMapOffsetToNative *mapOffsetToNative; + + /** + * (public) Function pointer for UTextMapNativeIndexToUTF16. + * + * @see UTextMapNativeIndexToUTF16 + * @stable ICU 3.6 + */ + UTextMapNativeIndexToUTF16 *mapNativeIndexToUTF16; + + /** + * (public) Function pointer for UTextClose. + * + * @see UTextClose + * @stable ICU 3.6 + */ + UTextClose *close; + + /** + * (private) Spare function pointer + * @internal + */ + UTextClose *spare1; + + /** + * (private) Spare function pointer + * @internal + */ + UTextClose *spare2; + + /** + * (private) Spare function pointer + * @internal + */ + UTextClose *spare3; + +}; +/** + * Function dispatch table for UText + * @see UTextFuncs + */ +typedef struct UTextFuncs UTextFuncs; + + /** + * UText struct. Provides the interface between the generic UText access code + * and the UText provider code that works on specific kinds of + * text (UTF-8, noncontiguous UTF-16, whatever.) + * + * Applications that are using predefined types of text providers + * to pass text data to ICU services will have no need to view the + * internals of the UText structs that they open. + * + * @stable ICU 3.6 + */ +struct UText { + /** + * (private) Magic. Used to help detect when UText functions are handed + * invalid or unitialized UText structs. + * utext_openXYZ() functions take an initialized, + * but not necessarily open, UText struct as an + * optional fill-in parameter. This magic field + * is used to check for that initialization. + * Text provider close functions must NOT clear + * the magic field because that would prevent + * reuse of the UText struct. + * @internal + */ + uint32_t magic; + + + /** + * (private) Flags for managing the allocation and freeing of + * memory associated with this UText. + * @internal + */ + int32_t flags; + + + /** + * Text provider properties. This set of flags is maintainted by the + * text provider implementation. + * @stable ICU 3.4 + */ + int32_t providerProperties; + + /** + * (public) sizeOfStruct=sizeof(UText) + * Allows possible backward compatible extension. + * + * @stable ICU 3.4 + */ + int32_t sizeOfStruct; + + /* ------ 16 byte alignment boundary ----------- */ + + + /** + * (protected) Native index of the first character position following + * the current chunk. + * @stable ICU 3.6 + */ + int64_t chunkNativeLimit; + + /** + * (protected) Size in bytes of the extra space (pExtra). + * @stable ICU 3.4 + */ + int32_t extraSize; + + /** + * (protected) The highest chunk offset where native indexing and + * chunk (UTF-16) indexing correspond. For UTF-16 sources, value + * will be equal to chunkLength. + * + * @stable ICU 3.6 + */ + int32_t nativeIndexingLimit; + + /* ---- 16 byte alignment boundary------ */ + + /** + * (protected) Native index of the first character in the text chunk. + * @stable ICU 3.6 + */ + int64_t chunkNativeStart; + + /** + * (protected) Current iteration position within the text chunk (UTF-16 buffer). + * This is the index to the character that will be returned by utext_next32(). + * @stable ICU 3.6 + */ + int32_t chunkOffset; + + /** + * (protected) Length the text chunk (UTF-16 buffer), in UChars. + * @stable ICU 3.6 + */ + int32_t chunkLength; + + /* ---- 16 byte alignment boundary-- */ + + + /** + * (protected) pointer to a chunk of text in UTF-16 format. + * May refer either to original storage of the source of the text, or + * if conversion was required, to a buffer owned by the UText. + * @stable ICU 3.6 + */ + const UChar *chunkContents; + + /** + * (public) Pointer to Dispatch table for accessing functions for this UText. + * @stable ICU 3.6 + */ + const UTextFuncs *pFuncs; + + /** + * (protected) Pointer to additional space requested by the + * text provider during the utext_open operation. + * @stable ICU 3.4 + */ + void *pExtra; + + /** + * (protected) Pointer to string or text-containin object or similar. + * This is the source of the text that this UText is wrapping, in a format + * that is known to the text provider functions. + * @stable ICU 3.4 + */ + const void *context; + + /* --- 16 byte alignment boundary--- */ + + /** + * (protected) Pointer fields available for use by the text provider. + * Not used by UText common code. + * @stable ICU 3.6 + */ + const void *p; + /** + * (protected) Pointer fields available for use by the text provider. + * Not used by UText common code. + * @stable ICU 3.6 + */ + const void *q; + /** + * (protected) Pointer fields available for use by the text provider. + * Not used by UText common code. + * @stable ICU 3.6 + */ + const void *r; + + /** + * Private field reserved for future use by the UText framework + * itself. This is not to be touched by the text providers. + * @internal ICU 3.4 + */ + void *privP; + + + /* --- 16 byte alignment boundary--- */ + + + /** + * (protected) Integer field reserved for use by the text provider. + * Not used by the UText framework, or by the client (user) of the UText. + * @stable ICU 3.4 + */ + int64_t a; + + /** + * (protected) Integer field reserved for use by the text provider. + * Not used by the UText framework, or by the client (user) of the UText. + * @stable ICU 3.4 + */ + int32_t b; + + /** + * (protected) Integer field reserved for use by the text provider. + * Not used by the UText framework, or by the client (user) of the UText. + * @stable ICU 3.4 + */ + int32_t c; + + /* ---- 16 byte alignment boundary---- */ + + + /** + * Private field reserved for future use by the UText framework + * itself. This is not to be touched by the text providers. + * @internal ICU 3.4 + */ + int64_t privA; + /** + * Private field reserved for future use by the UText framework + * itself. This is not to be touched by the text providers. + * @internal ICU 3.4 + */ + int32_t privB; + /** + * Private field reserved for future use by the UText framework + * itself. This is not to be touched by the text providers. + * @internal ICU 3.4 + */ + int32_t privC; +}; + + +/** + * Common function for use by Text Provider implementations to allocate and/or initialize + * a new UText struct. To be called in the implementation of utext_open() functions. + * If the supplied UText parameter is null, a new UText struct will be allocated on the heap. + * If the supplied UText is already open, the provider's close function will be called + * so that the struct can be reused by the open that is in progress. + * + * @param ut pointer to a UText struct to be re-used, or null if a new UText + * should be allocated. + * @param extraSpace The amount of additional space to be allocated as part + * of this UText, for use by types of providers that require + * additional storage. + * @param status Errors are returned here. + * @return pointer to the UText, allocated if necessary, with extra space set up if requested. + * @stable ICU 3.4 + */ +U_STABLE UText * U_EXPORT2 +utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status); + +#ifndef U_HIDE_INTERNAL_API +/** + * @internal + * Value used to help identify correctly initialized UText structs. + * Note: must be publicly visible so that UTEXT_INITIALIZER can access it. + */ +enum { + UTEXT_MAGIC = 0x345ad82c +}; +#endif /* U_HIDE_INTERNAL_API */ + +/** + * initializer to be used with local (stack) instances of a UText + * struct. UText structs must be initialized before passing + * them to one of the utext_open functions. + * + * @stable ICU 3.6 + */ +#define UTEXT_INITIALIZER { \ + UTEXT_MAGIC, /* magic */ \ + 0, /* flags */ \ + 0, /* providerProps */ \ + sizeof(UText), /* sizeOfStruct */ \ + 0, /* chunkNativeLimit */ \ + 0, /* extraSize */ \ + 0, /* nativeIndexingLimit */ \ + 0, /* chunkNativeStart */ \ + 0, /* chunkOffset */ \ + 0, /* chunkLength */ \ + NULL, /* chunkContents */ \ + NULL, /* pFuncs */ \ + NULL, /* pExtra */ \ + NULL, /* context */ \ + NULL, NULL, NULL, /* p, q, r */ \ + NULL, /* privP */ \ + 0, 0, 0, /* a, b, c */ \ + 0, 0, 0 /* privA,B,C, */ \ + } + + +U_CDECL_END + + + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/utf.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/utf.h new file mode 100644 index 0000000..ef51299 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/utf.h @@ -0,0 +1,225 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 1999-2011, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: utf.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 1999sep09 +* created by: Markus W. Scherer +*/ + +/** + * \file + * \brief C API: Code point macros + * + * This file defines macros for checking whether a code point is + * a surrogate or a non-character etc. + * + * If U_NO_DEFAULT_INCLUDE_UTF_HEADERS is 0 then utf.h is included by utypes.h + * and itself includes utf8.h and utf16.h after some + * common definitions. + * If U_NO_DEFAULT_INCLUDE_UTF_HEADERS is 1 then each of these headers must be + * included explicitly if their definitions are used. + * + * utf8.h and utf16.h define macros for efficiently getting code points + * in and out of UTF-8/16 strings. + * utf16.h macros have "U16_" prefixes. + * utf8.h defines similar macros with "U8_" prefixes for UTF-8 string handling. + * + * ICU mostly processes 16-bit Unicode strings. + * Most of the time, such strings are well-formed UTF-16. + * Single, unpaired surrogates must be handled as well, and are treated in ICU + * like regular code points where possible. + * (Pairs of surrogate code points are indistinguishable from supplementary + * code points encoded as pairs of supplementary code units.) + * + * In fact, almost all Unicode code points in normal text (>99%) + * are on the BMP (<=U+ffff) and even <=U+d7ff. + * ICU functions handle supplementary code points (U+10000..U+10ffff) + * but are optimized for the much more frequently occurring BMP code points. + * + * umachine.h defines UChar to be an unsigned 16-bit integer. + * Since ICU 59, ICU uses char16_t in C++, UChar only in C, + * and defines UChar=char16_t by default. See the UChar API docs for details. + * + * UChar32 is defined to be a signed 32-bit integer (int32_t), large enough for a 21-bit + * Unicode code point (Unicode scalar value, 0..0x10ffff) and U_SENTINEL (-1). + * Before ICU 2.4, the definition of UChar32 was similarly platform-dependent as + * the definition of UChar. For details see the documentation for UChar32 itself. + * + * utf.h defines a small number of C macros for single Unicode code points. + * These are simple checks for surrogates and non-characters. + * For actual Unicode character properties see uchar.h. + * + * By default, string operations must be done with error checking in case + * a string is not well-formed UTF-16 or UTF-8. + * + * The U16_ macros detect if a surrogate code unit is unpaired + * (lead unit without trail unit or vice versa) and just return the unit itself + * as the code point. + * + * The U8_ macros detect illegal byte sequences and return a negative value. + * Starting with ICU 60, the observable length of a single illegal byte sequence + * skipped by one of these macros follows the Unicode 6+ recommendation + * which is consistent with the W3C Encoding Standard. + * + * There are ..._OR_FFFD versions of both U16_ and U8_ macros + * that return U+FFFD for illegal code unit sequences. + * + * The regular "safe" macros require that the initial, passed-in string index + * is within bounds. They only check the index when they read more than one + * code unit. This is usually done with code similar to the following loop: + *

while(i
+ *
+ * When it is safe to assume that text is well-formed UTF-16
+ * (does not contain single, unpaired surrogates), then one can use
+ * U16_..._UNSAFE macros.
+ * These do not check for proper code unit sequences or truncated text and may
+ * yield wrong results or even cause a crash if they are used with "malformed"
+ * text.
+ * In practice, U16_..._UNSAFE macros will produce slightly less code but
+ * should not be faster because the processing is only different when a
+ * surrogate code unit is detected, which will be rare.
+ *
+ * Similarly for UTF-8, there are "safe" macros without a suffix,
+ * and U8_..._UNSAFE versions.
+ * The performance differences are much larger here because UTF-8 provides so
+ * many opportunities for malformed sequences.
+ * The unsafe UTF-8 macros are entirely implemented inside the macro definitions
+ * and are fast, while the safe UTF-8 macros call functions for some complicated cases.
+ *
+ * Unlike with UTF-16, malformed sequences cannot be expressed with distinct
+ * code point values (0..U+10ffff). They are indicated with negative values instead.
+ *
+ * For more information see the ICU User Guide Strings chapter
+ * (http://userguide.icu-project.org/strings).
+ *
+ * Usage:
+ * ICU coding guidelines for if() statements should be followed when using these macros.
+ * Compound statements (curly braces {}) must be used  for if-else-while... 
+ * bodies and all macro statements should be terminated with semicolon.
+ *
+ * @stable ICU 2.4
+ */
+
+#ifndef __UTF_H__
+#define __UTF_H__
+
+#include "unicode/umachine.h"
+/* include the utfXX.h after the following definitions */
+
+/* single-code point definitions -------------------------------------------- */
+
+/**
+ * Is this code point a Unicode noncharacter?
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U_IS_UNICODE_NONCHAR(c) \
+    ((c)>=0xfdd0 && \
+     ((c)<=0xfdef || ((c)&0xfffe)==0xfffe) && (c)<=0x10ffff)
+
+/**
+ * Is c a Unicode code point value (0..U+10ffff)
+ * that can be assigned a character?
+ *
+ * Code points that are not characters include:
+ * - single surrogate code points (U+d800..U+dfff, 2048 code points)
+ * - the last two code points on each plane (U+__fffe and U+__ffff, 34 code points)
+ * - U+fdd0..U+fdef (new with Unicode 3.1, 32 code points)
+ * - the highest Unicode code point value is U+10ffff
+ *
+ * This means that all code points below U+d800 are character code points,
+ * and that boundary is tested first for performance.
+ *
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U_IS_UNICODE_CHAR(c) \
+    ((uint32_t)(c)<0xd800 || \
+        (0xdfff<(c) && (c)<=0x10ffff && !U_IS_UNICODE_NONCHAR(c)))
+
+/**
+ * Is this code point a BMP code point (U+0000..U+ffff)?
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 2.8
+ */
+#define U_IS_BMP(c) ((uint32_t)(c)<=0xffff)
+
+/**
+ * Is this code point a supplementary code point (U+10000..U+10ffff)?
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 2.8
+ */
+#define U_IS_SUPPLEMENTARY(c) ((uint32_t)((c)-0x10000)<=0xfffff)
+ 
+/**
+ * Is this code point a lead surrogate (U+d800..U+dbff)?
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U_IS_LEAD(c) (((c)&0xfffffc00)==0xd800)
+
+/**
+ * Is this code point a trail surrogate (U+dc00..U+dfff)?
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00)
+
+/**
+ * Is this code point a surrogate (U+d800..U+dfff)?
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800)
+
+/**
+ * Assuming c is a surrogate code point (U_IS_SURROGATE(c)),
+ * is it a lead surrogate?
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U_IS_SURROGATE_LEAD(c) (((c)&0x400)==0)
+
+/**
+ * Assuming c is a surrogate code point (U_IS_SURROGATE(c)),
+ * is it a trail surrogate?
+ * @param c 32-bit code point
+ * @return TRUE or FALSE
+ * @stable ICU 4.2
+ */
+#define U_IS_SURROGATE_TRAIL(c) (((c)&0x400)!=0)
+
+/* include the utfXX.h ------------------------------------------------------ */
+
+#if !U_NO_DEFAULT_INCLUDE_UTF_HEADERS
+
+#include "unicode/utf8.h"
+#include "unicode/utf16.h"
+
+/* utf_old.h contains deprecated, pre-ICU 2.4 definitions */
+#include "unicode/utf_old.h"
+
+#endif  /* !U_NO_DEFAULT_INCLUDE_UTF_HEADERS */
+
+#endif  /* __UTF_H__ */
diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/utf16.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/utf16.h
new file mode 100644
index 0000000..35fd098
--- /dev/null
+++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/utf16.h
@@ -0,0 +1,745 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*******************************************************************************
+*
+*   Copyright (C) 1999-2012, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*   file name:  utf16.h
+*   encoding:   UTF-8
+*   tab size:   8 (not used)
+*   indentation:4
+*
+*   created on: 1999sep09
+*   created by: Markus W. Scherer
+*/
+
+/**
+ * \file
+ * \brief C API: 16-bit Unicode handling macros
+ * 
+ * This file defines macros to deal with 16-bit Unicode (UTF-16) code units and strings.
+ *
+ * For more information see utf.h and the ICU User Guide Strings chapter
+ * (http://userguide.icu-project.org/strings).
+ *
+ * Usage:
+ * ICU coding guidelines for if() statements should be followed when using these macros.
+ * Compound statements (curly braces {}) must be used  for if-else-while... 
+ * bodies and all macro statements should be terminated with semicolon.
+ */
+
+#ifndef __UTF16_H__
+#define __UTF16_H__
+
+#include "unicode/umachine.h"
+#ifndef __UTF_H__
+#   include "unicode/utf.h"
+#endif
+
+/* single-code point definitions -------------------------------------------- */
+
+/**
+ * Does this code unit alone encode a code point (BMP, not a surrogate)?
+ * @param c 16-bit code unit
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U16_IS_SINGLE(c) !U_IS_SURROGATE(c)
+
+/**
+ * Is this code unit a lead surrogate (U+d800..U+dbff)?
+ * @param c 16-bit code unit
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U16_IS_LEAD(c) (((c)&0xfffffc00)==0xd800)
+
+/**
+ * Is this code unit a trail surrogate (U+dc00..U+dfff)?
+ * @param c 16-bit code unit
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U16_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00)
+
+/**
+ * Is this code unit a surrogate (U+d800..U+dfff)?
+ * @param c 16-bit code unit
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U16_IS_SURROGATE(c) U_IS_SURROGATE(c)
+
+/**
+ * Assuming c is a surrogate code point (U16_IS_SURROGATE(c)),
+ * is it a lead surrogate?
+ * @param c 16-bit code unit
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U16_IS_SURROGATE_LEAD(c) (((c)&0x400)==0)
+
+/**
+ * Assuming c is a surrogate code point (U16_IS_SURROGATE(c)),
+ * is it a trail surrogate?
+ * @param c 16-bit code unit
+ * @return TRUE or FALSE
+ * @stable ICU 4.2
+ */
+#define U16_IS_SURROGATE_TRAIL(c) (((c)&0x400)!=0)
+
+/**
+ * Helper constant for U16_GET_SUPPLEMENTARY.
+ * @internal
+ */
+#define U16_SURROGATE_OFFSET ((0xd800<<10UL)+0xdc00-0x10000)
+
+/**
+ * Get a supplementary code point value (U+10000..U+10ffff)
+ * from its lead and trail surrogates.
+ * The result is undefined if the input values are not
+ * lead and trail surrogates.
+ *
+ * @param lead lead surrogate (U+d800..U+dbff)
+ * @param trail trail surrogate (U+dc00..U+dfff)
+ * @return supplementary code point (U+10000..U+10ffff)
+ * @stable ICU 2.4
+ */
+#define U16_GET_SUPPLEMENTARY(lead, trail) \
+    (((UChar32)(lead)<<10UL)+(UChar32)(trail)-U16_SURROGATE_OFFSET)
+
+
+/**
+ * Get the lead surrogate (0xd800..0xdbff) for a
+ * supplementary code point (0x10000..0x10ffff).
+ * @param supplementary 32-bit code point (U+10000..U+10ffff)
+ * @return lead surrogate (U+d800..U+dbff) for supplementary
+ * @stable ICU 2.4
+ */
+#define U16_LEAD(supplementary) (UChar)(((supplementary)>>10)+0xd7c0)
+
+/**
+ * Get the trail surrogate (0xdc00..0xdfff) for a
+ * supplementary code point (0x10000..0x10ffff).
+ * @param supplementary 32-bit code point (U+10000..U+10ffff)
+ * @return trail surrogate (U+dc00..U+dfff) for supplementary
+ * @stable ICU 2.4
+ */
+#define U16_TRAIL(supplementary) (UChar)(((supplementary)&0x3ff)|0xdc00)
+
+/**
+ * How many 16-bit code units are used to encode this Unicode code point? (1 or 2)
+ * The result is not defined if c is not a Unicode code point (U+0000..U+10ffff).
+ * @param c 32-bit code point
+ * @return 1 or 2
+ * @stable ICU 2.4
+ */
+#define U16_LENGTH(c) ((uint32_t)(c)<=0xffff ? 1 : 2)
+
+/**
+ * The maximum number of 16-bit code units per Unicode code point (U+0000..U+10ffff).
+ * @return 2
+ * @stable ICU 2.4
+ */
+#define U16_MAX_LENGTH 2
+
+/**
+ * Get a code point from a string at a random-access offset,
+ * without changing the offset.
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * The offset may point to either the lead or trail surrogate unit
+ * for a supplementary code point, in which case the macro will read
+ * the adjacent matching surrogate as well.
+ * The result is undefined if the offset points to a single, unpaired surrogate.
+ * Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @param c output UChar32 variable
+ * @see U16_GET
+ * @stable ICU 2.4
+ */
+#define U16_GET_UNSAFE(s, i, c) { \
+    (c)=(s)[i]; \
+    if(U16_IS_SURROGATE(c)) { \
+        if(U16_IS_SURROGATE_LEAD(c)) { \
+            (c)=U16_GET_SUPPLEMENTARY((c), (s)[(i)+1]); \
+        } else { \
+            (c)=U16_GET_SUPPLEMENTARY((s)[(i)-1], (c)); \
+        } \
+    } \
+}
+
+/**
+ * Get a code point from a string at a random-access offset,
+ * without changing the offset.
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The offset may point to either the lead or trail surrogate unit
+ * for a supplementary code point, in which case the macro will read
+ * the adjacent matching surrogate as well.
+ *
+ * The length can be negative for a NUL-terminated string.
+ *
+ * If the offset points to a single, unpaired surrogate, then
+ * c is set to that unpaired surrogate.
+ * Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, must be start<=i(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
+                (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
+            } \
+        } \
+    } \
+}
+
+#ifndef U_HIDE_DRAFT_API
+
+/**
+ * Get a code point from a string at a random-access offset,
+ * without changing the offset.
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The offset may point to either the lead or trail surrogate unit
+ * for a supplementary code point, in which case the macro will read
+ * the adjacent matching surrogate as well.
+ *
+ * The length can be negative for a NUL-terminated string.
+ *
+ * If the offset points to a single, unpaired surrogate, then
+ * c is set to U+FFFD.
+ * Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT_OR_FFFD.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, must be start<=i(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
+                (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
+            } else { \
+                (c)=0xfffd; \
+            } \
+        } \
+    } \
+}
+
+#endif  // U_HIDE_DRAFT_API
+
+/* definitions with forward iteration --------------------------------------- */
+
+/**
+ * Get a code point from a string at a code point boundary offset,
+ * and advance the offset to the next code point boundary.
+ * (Post-incrementing forward iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * The offset may point to the lead surrogate unit
+ * for a supplementary code point, in which case the macro will read
+ * the following trail surrogate as well.
+ * If the offset points to a trail surrogate, then that itself
+ * will be returned as the code point.
+ * The result is undefined if the offset points to a single, unpaired lead surrogate.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @param c output UChar32 variable
+ * @see U16_NEXT
+ * @stable ICU 2.4
+ */
+#define U16_NEXT_UNSAFE(s, i, c) { \
+    (c)=(s)[(i)++]; \
+    if(U16_IS_LEAD(c)) { \
+        (c)=U16_GET_SUPPLEMENTARY((c), (s)[(i)++]); \
+    } \
+}
+
+/**
+ * Get a code point from a string at a code point boundary offset,
+ * and advance the offset to the next code point boundary.
+ * (Post-incrementing forward iteration.)
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The length can be negative for a NUL-terminated string.
+ *
+ * The offset may point to the lead surrogate unit
+ * for a supplementary code point, in which case the macro will read
+ * the following trail surrogate as well.
+ * If the offset points to a trail surrogate or
+ * to a single, unpaired lead surrogate, then c is set to that unpaired surrogate.
+ *
+ * @param s const UChar * string
+ * @param i string offset, must be i>10)+0xd7c0); \
+        (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \
+    } \
+}
+
+/**
+ * Append a code point to a string, overwriting 1 or 2 code units.
+ * The offset points to the current end of the string contents
+ * and is advanced (post-increment).
+ * "Safe" macro, checks for a valid code point.
+ * If a surrogate pair is written, checks for sufficient space in the string.
+ * If the code point is not valid or a trail surrogate does not fit,
+ * then isError is set to TRUE.
+ *
+ * @param s const UChar * string buffer
+ * @param i string offset, must be i>10)+0xd7c0); \
+        (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \
+    } else /* c>0x10ffff or not enough space */ { \
+        (isError)=TRUE; \
+    } \
+}
+
+/**
+ * Advance the string offset from one code point boundary to the next.
+ * (Post-incrementing iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @see U16_FWD_1
+ * @stable ICU 2.4
+ */
+#define U16_FWD_1_UNSAFE(s, i) { \
+    if(U16_IS_LEAD((s)[(i)++])) { \
+        ++(i); \
+    } \
+}
+
+/**
+ * Advance the string offset from one code point boundary to the next.
+ * (Post-incrementing iteration.)
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The length can be negative for a NUL-terminated string.
+ *
+ * @param s const UChar * string
+ * @param i string offset, must be i0) { \
+        U16_FWD_1_UNSAFE(s, i); \
+        --__N; \
+    } \
+}
+
+/**
+ * Advance the string offset from one code point boundary to the n-th next one,
+ * i.e., move forward by n code points.
+ * (Post-incrementing iteration.)
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The length can be negative for a NUL-terminated string.
+ *
+ * @param s const UChar * string
+ * @param i int32_t string offset, must be i0 && ((i)<(length) || ((length)<0 && (s)[i]!=0))) { \
+        U16_FWD_1(s, i, length); \
+        --__N; \
+    } \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary
+ * at the start of a code point.
+ * If the offset points to the trail surrogate of a surrogate pair,
+ * then the offset is decremented.
+ * Otherwise, it is not modified.
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @see U16_SET_CP_START
+ * @stable ICU 2.4
+ */
+#define U16_SET_CP_START_UNSAFE(s, i) { \
+    if(U16_IS_TRAIL((s)[i])) { \
+        --(i); \
+    } \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary
+ * at the start of a code point.
+ * If the offset points to the trail surrogate of a surrogate pair,
+ * then the offset is decremented.
+ * Otherwise, it is not modified.
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, must be start<=i
+ * @see U16_SET_CP_START_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U16_SET_CP_START(s, start, i) { \
+    if(U16_IS_TRAIL((s)[i]) && (i)>(start) && U16_IS_LEAD((s)[(i)-1])) { \
+        --(i); \
+    } \
+}
+
+/* definitions with backward iteration -------------------------------------- */
+
+/**
+ * Move the string offset from one code point boundary to the previous one
+ * and get the code point between them.
+ * (Pre-decrementing backward iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * The input offset may be the same as the string length.
+ * If the offset is behind a trail surrogate unit
+ * for a supplementary code point, then the macro will read
+ * the preceding lead surrogate as well.
+ * If the offset is behind a lead surrogate, then that itself
+ * will be returned as the code point.
+ * The result is undefined if the offset is behind a single, unpaired trail surrogate.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @param c output UChar32 variable
+ * @see U16_PREV
+ * @stable ICU 2.4
+ */
+#define U16_PREV_UNSAFE(s, i, c) { \
+    (c)=(s)[--(i)]; \
+    if(U16_IS_TRAIL(c)) { \
+        (c)=U16_GET_SUPPLEMENTARY((s)[--(i)], (c)); \
+    } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the previous one
+ * and get the code point between them.
+ * (Pre-decrementing backward iteration.)
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The input offset may be the same as the string length.
+ * If the offset is behind a trail surrogate unit
+ * for a supplementary code point, then the macro will read
+ * the preceding lead surrogate as well.
+ * If the offset is behind a lead surrogate or behind a single, unpaired
+ * trail surrogate, then c is set to that unpaired surrogate.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, must be start(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
+            --(i); \
+            (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
+        } \
+    } \
+}
+
+#ifndef U_HIDE_DRAFT_API
+
+/**
+ * Move the string offset from one code point boundary to the previous one
+ * and get the code point between them.
+ * (Pre-decrementing backward iteration.)
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The input offset may be the same as the string length.
+ * If the offset is behind a trail surrogate unit
+ * for a supplementary code point, then the macro will read
+ * the preceding lead surrogate as well.
+ * If the offset is behind a lead surrogate or behind a single, unpaired
+ * trail surrogate, then c is set to U+FFFD.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, must be start(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
+            --(i); \
+            (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
+        } else { \
+            (c)=0xfffd; \
+        } \
+    } \
+}
+
+#endif  // U_HIDE_DRAFT_API
+
+/**
+ * Move the string offset from one code point boundary to the previous one.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @see U16_BACK_1
+ * @stable ICU 2.4
+ */
+#define U16_BACK_1_UNSAFE(s, i) { \
+    if(U16_IS_TRAIL((s)[--(i)])) { \
+        --(i); \
+    } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the previous one.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * @param s const UChar * string
+ * @param start starting string offset (usually 0)
+ * @param i string offset, must be start(start) && U16_IS_LEAD((s)[(i)-1])) { \
+        --(i); \
+    } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the n-th one before it,
+ * i.e., move backward by n code points.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @param n number of code points to skip
+ * @see U16_BACK_N
+ * @stable ICU 2.4
+ */
+#define U16_BACK_N_UNSAFE(s, i, n) { \
+    int32_t __N=(n); \
+    while(__N>0) { \
+        U16_BACK_1_UNSAFE(s, i); \
+        --__N; \
+    } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the n-th one before it,
+ * i.e., move backward by n code points.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * @param s const UChar * string
+ * @param start start of string
+ * @param i string offset, must be start0 && (i)>(start)) { \
+        U16_BACK_1(s, start, i); \
+        --__N; \
+    } \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary after a code point.
+ * If the offset is behind the lead surrogate of a surrogate pair,
+ * then the offset is incremented.
+ * Otherwise, it is not modified.
+ * The input offset may be the same as the string length.
+ * "Unsafe" macro, assumes well-formed UTF-16.
+ *
+ * @param s const UChar * string
+ * @param i string offset
+ * @see U16_SET_CP_LIMIT
+ * @stable ICU 2.4
+ */
+#define U16_SET_CP_LIMIT_UNSAFE(s, i) { \
+    if(U16_IS_LEAD((s)[(i)-1])) { \
+        ++(i); \
+    } \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary after a code point.
+ * If the offset is behind the lead surrogate of a surrogate pair,
+ * then the offset is incremented.
+ * Otherwise, it is not modified.
+ * The input offset may be the same as the string length.
+ * "Safe" macro, handles unpaired surrogates and checks for string boundaries.
+ *
+ * The length can be negative for a NUL-terminated string.
+ *
+ * @param s const UChar * string
+ * @param start int32_t starting string offset (usually 0)
+ * @param i int32_t string offset, start<=i<=length
+ * @param length int32_t string length
+ * @see U16_SET_CP_LIMIT_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U16_SET_CP_LIMIT(s, start, i, length) { \
+    if((start)<(i) && ((i)<(length) || (length)<0) && U16_IS_LEAD((s)[(i)-1]) && U16_IS_TRAIL((s)[i])) { \
+        ++(i); \
+    } \
+}
+
+#endif
diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/utf32.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/utf32.h
new file mode 100644
index 0000000..8822c4d
--- /dev/null
+++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/utf32.h
@@ -0,0 +1,25 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*******************************************************************************
+*
+*   Copyright (C) 1999-2001, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*   file name:  utf32.h
+*   encoding:   UTF-8
+*   tab size:   8 (not used)
+*   indentation:4
+*
+*   created on: 1999sep20
+*   created by: Markus W. Scherer
+*/
+/**
+ * \file
+ * \brief C API: UTF-32 macros
+ *
+ * This file is obsolete and its contents moved to utf_old.h.
+ * See utf_old.h and Jitterbug 2150 and its discussion on the ICU mailing list
+ * in September 2002.
+ */
diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/utf8.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/utf8.h
new file mode 100644
index 0000000..df08d34
--- /dev/null
+++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/utf8.h
@@ -0,0 +1,836 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*******************************************************************************
+*
+*   Copyright (C) 1999-2015, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*   file name:  utf8.h
+*   encoding:   UTF-8
+*   tab size:   8 (not used)
+*   indentation:4
+*
+*   created on: 1999sep13
+*   created by: Markus W. Scherer
+*/
+
+/**
+ * \file
+ * \brief C API: 8-bit Unicode handling macros
+ * 
+ * This file defines macros to deal with 8-bit Unicode (UTF-8) code units (bytes) and strings.
+ *
+ * For more information see utf.h and the ICU User Guide Strings chapter
+ * (http://userguide.icu-project.org/strings).
+ *
+ * Usage:
+ * ICU coding guidelines for if() statements should be followed when using these macros.
+ * Compound statements (curly braces {}) must be used  for if-else-while... 
+ * bodies and all macro statements should be terminated with semicolon.
+ */
+
+#ifndef __UTF8_H__
+#define __UTF8_H__
+
+#include "unicode/umachine.h"
+#ifndef __UTF_H__
+#   include "unicode/utf.h"
+#endif
+
+/* internal definitions ----------------------------------------------------- */
+
+/**
+ * Counts the trail bytes for a UTF-8 lead byte.
+ * Returns 0 for 0..0xc1 as well as for 0xf5..0xff.
+ * leadByte might be evaluated multiple times.
+ *
+ * This is internal since it is not meant to be called directly by external clients;
+ * however it is called by public macros in this file and thus must remain stable.
+ *
+ * @param leadByte The first byte of a UTF-8 sequence. Must be 0..0xff.
+ * @internal
+ */
+#define U8_COUNT_TRAIL_BYTES(leadByte) \
+    (U8_IS_LEAD(leadByte) ? \
+        ((uint8_t)(leadByte)>=0xe0)+((uint8_t)(leadByte)>=0xf0)+1 : 0)
+
+/**
+ * Counts the trail bytes for a UTF-8 lead byte of a valid UTF-8 sequence.
+ * Returns 0 for 0..0xc1. Undefined for 0xf5..0xff.
+ * leadByte might be evaluated multiple times.
+ *
+ * This is internal since it is not meant to be called directly by external clients;
+ * however it is called by public macros in this file and thus must remain stable.
+ *
+ * @param leadByte The first byte of a UTF-8 sequence. Must be 0..0xff.
+ * @internal
+ */
+#define U8_COUNT_TRAIL_BYTES_UNSAFE(leadByte) \
+    (((uint8_t)(leadByte)>=0xc2)+((uint8_t)(leadByte)>=0xe0)+((uint8_t)(leadByte)>=0xf0))
+
+/**
+ * Mask a UTF-8 lead byte, leave only the lower bits that form part of the code point value.
+ *
+ * This is internal since it is not meant to be called directly by external clients;
+ * however it is called by public macros in this file and thus must remain stable.
+ * @internal
+ */
+#define U8_MASK_LEAD_BYTE(leadByte, countTrailBytes) ((leadByte)&=(1<<(6-(countTrailBytes)))-1)
+
+/**
+ * Internal bit vector for 3-byte UTF-8 validity check, for use in U8_IS_VALID_LEAD3_AND_T1.
+ * Each bit indicates whether one lead byte + first trail byte pair starts a valid sequence.
+ * Lead byte E0..EF bits 3..0 are used as byte index,
+ * first trail byte bits 7..5 are used as bit index into that byte.
+ * @see U8_IS_VALID_LEAD3_AND_T1
+ * @internal
+ */
+#define U8_LEAD3_T1_BITS "\x20\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x10\x30\x30"
+
+/**
+ * Internal 3-byte UTF-8 validity check.
+ * Non-zero if lead byte E0..EF and first trail byte 00..FF start a valid sequence.
+ * @internal
+ */
+#define U8_IS_VALID_LEAD3_AND_T1(lead, t1) (U8_LEAD3_T1_BITS[(lead)&0xf]&(1<<((uint8_t)(t1)>>5)))
+
+/**
+ * Internal bit vector for 4-byte UTF-8 validity check, for use in U8_IS_VALID_LEAD4_AND_T1.
+ * Each bit indicates whether one lead byte + first trail byte pair starts a valid sequence.
+ * First trail byte bits 7..4 are used as byte index,
+ * lead byte F0..F4 bits 2..0 are used as bit index into that byte.
+ * @see U8_IS_VALID_LEAD4_AND_T1
+ * @internal
+ */
+#define U8_LEAD4_T1_BITS "\x00\x00\x00\x00\x00\x00\x00\x00\x1E\x0F\x0F\x0F\x00\x00\x00\x00"
+
+/**
+ * Internal 4-byte UTF-8 validity check.
+ * Non-zero if lead byte F0..F4 and first trail byte 00..FF start a valid sequence.
+ * @internal
+ */
+#define U8_IS_VALID_LEAD4_AND_T1(lead, t1) (U8_LEAD4_T1_BITS[(uint8_t)(t1)>>4]&(1<<((lead)&7)))
+
+/**
+ * Function for handling "next code point" with error-checking.
+ *
+ * This is internal since it is not meant to be called directly by external clients;
+ * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this
+ * file and thus must remain stable, and should not be hidden when other internal
+ * functions are hidden (otherwise public macros would fail to compile).
+ * @internal
+ */
+U_STABLE UChar32 U_EXPORT2
+utf8_nextCharSafeBody(const uint8_t *s, int32_t *pi, int32_t length, UChar32 c, UBool strict);
+
+/**
+ * Function for handling "append code point" with error-checking.
+ *
+ * This is internal since it is not meant to be called directly by external clients;
+ * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this
+ * file and thus must remain stable, and should not be hidden when other internal
+ * functions are hidden (otherwise public macros would fail to compile).
+ * @internal
+ */
+U_STABLE int32_t U_EXPORT2
+utf8_appendCharSafeBody(uint8_t *s, int32_t i, int32_t length, UChar32 c, UBool *pIsError);
+
+/**
+ * Function for handling "previous code point" with error-checking.
+ *
+ * This is internal since it is not meant to be called directly by external clients;
+ * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this
+ * file and thus must remain stable, and should not be hidden when other internal
+ * functions are hidden (otherwise public macros would fail to compile).
+ * @internal
+ */
+U_STABLE UChar32 U_EXPORT2
+utf8_prevCharSafeBody(const uint8_t *s, int32_t start, int32_t *pi, UChar32 c, UBool strict);
+
+/**
+ * Function for handling "skip backward one code point" with error-checking.
+ *
+ * This is internal since it is not meant to be called directly by external clients;
+ * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this
+ * file and thus must remain stable, and should not be hidden when other internal
+ * functions are hidden (otherwise public macros would fail to compile).
+ * @internal
+ */
+U_STABLE int32_t U_EXPORT2
+utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
+
+/* single-code point definitions -------------------------------------------- */
+
+/**
+ * Does this code unit (byte) encode a code point by itself (US-ASCII 0..0x7f)?
+ * @param c 8-bit code unit (byte)
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U8_IS_SINGLE(c) (((c)&0x80)==0)
+
+/**
+ * Is this code unit (byte) a UTF-8 lead byte? (0xC2..0xF4)
+ * @param c 8-bit code unit (byte)
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U8_IS_LEAD(c) ((uint8_t)((c)-0xc2)<=0x32)
+// 0x32=0xf4-0xc2
+
+/**
+ * Is this code unit (byte) a UTF-8 trail byte? (0x80..0xBF)
+ * @param c 8-bit code unit (byte)
+ * @return TRUE or FALSE
+ * @stable ICU 2.4
+ */
+#define U8_IS_TRAIL(c) ((int8_t)(c)<-0x40)
+
+/**
+ * How many code units (bytes) are used for the UTF-8 encoding
+ * of this Unicode code point?
+ * @param c 32-bit code point
+ * @return 1..4, or 0 if c is a surrogate or not a Unicode code point
+ * @stable ICU 2.4
+ */
+#define U8_LENGTH(c) \
+    ((uint32_t)(c)<=0x7f ? 1 : \
+        ((uint32_t)(c)<=0x7ff ? 2 : \
+            ((uint32_t)(c)<=0xd7ff ? 3 : \
+                ((uint32_t)(c)<=0xdfff || (uint32_t)(c)>0x10ffff ? 0 : \
+                    ((uint32_t)(c)<=0xffff ? 3 : 4)\
+                ) \
+            ) \
+        ) \
+    )
+
+/**
+ * The maximum number of UTF-8 code units (bytes) per Unicode code point (U+0000..U+10ffff).
+ * @return 4
+ * @stable ICU 2.4
+ */
+#define U8_MAX_LENGTH 4
+
+/**
+ * Get a code point from a string at a random-access offset,
+ * without changing the offset.
+ * The offset may point to either the lead byte or one of the trail bytes
+ * for a code point, in which case the macro will read all of the bytes
+ * for the code point.
+ * The result is undefined if the offset points to an illegal UTF-8
+ * byte sequence.
+ * Iteration through a string is more efficient with U8_NEXT_UNSAFE or U8_NEXT.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @param c output UChar32 variable
+ * @see U8_GET
+ * @stable ICU 2.4
+ */
+#define U8_GET_UNSAFE(s, i, c) { \
+    int32_t _u8_get_unsafe_index=(int32_t)(i); \
+    U8_SET_CP_START_UNSAFE(s, _u8_get_unsafe_index); \
+    U8_NEXT_UNSAFE(s, _u8_get_unsafe_index, c); \
+}
+
+/**
+ * Get a code point from a string at a random-access offset,
+ * without changing the offset.
+ * The offset may point to either the lead byte or one of the trail bytes
+ * for a code point, in which case the macro will read all of the bytes
+ * for the code point.
+ *
+ * The length can be negative for a NUL-terminated string.
+ *
+ * If the offset points to an illegal UTF-8 byte sequence, then
+ * c is set to a negative value.
+ * Iteration through a string is more efficient with U8_NEXT_UNSAFE or U8_NEXT.
+ *
+ * @param s const uint8_t * string
+ * @param start int32_t starting string offset
+ * @param i int32_t string offset, must be start<=i=0xc2) && \
+                ((i)!=(length)) && \
+                (__t1=(s)[i]-0x80)<=0x3f) { \
+            (c)=(((c)&0x1f)<<6)|__t1; \
+            ++(i); \
+        } else { \
+            /* function call for "complicated" and error cases */ \
+            (c)=utf8_nextCharSafeBody((const uint8_t *)s, &(i), (length), c, -1); \
+        } \
+    } \
+}
+
+/**
+ * Get a code point from a string at a code point boundary offset,
+ * and advance the offset to the next code point boundary.
+ * (Post-incrementing forward iteration.)
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * The length can be negative for a NUL-terminated string.
+ *
+ * The offset may point to the lead byte of a multi-byte sequence,
+ * in which case the macro will read the whole sequence.
+ * If the offset points to a trail byte or an illegal UTF-8 sequence, then
+ * c is set to U+FFFD.
+ *
+ * This macro does not distinguish between a real U+FFFD in the text
+ * and U+FFFD returned for an ill-formed sequence.
+ * Use U8_NEXT() if that distinction is important.
+ *
+ * @param s const uint8_t * string
+ * @param i int32_t string offset, must be i=0xc2) && \
+                ((i)!=(length)) && \
+                (__t1=(s)[i]-0x80)<=0x3f) { \
+            (c)=(((c)&0x1f)<<6)|__t1; \
+            ++(i); \
+        } else { \
+            /* function call for "complicated" and error cases */ \
+            (c)=utf8_nextCharSafeBody((const uint8_t *)s, &(i), (length), c, -3); \
+        } \
+    } \
+}
+
+/**
+ * Append a code point to a string, overwriting 1 to 4 bytes.
+ * The offset points to the current end of the string contents
+ * and is advanced (post-increment).
+ * "Unsafe" macro, assumes a valid code point and sufficient space in the string.
+ * Otherwise, the result is undefined.
+ *
+ * @param s const uint8_t * string buffer
+ * @param i string offset
+ * @param c code point to append
+ * @see U8_APPEND
+ * @stable ICU 2.4
+ */
+#define U8_APPEND_UNSAFE(s, i, c) { \
+    if((uint32_t)(c)<=0x7f) { \
+        (s)[(i)++]=(uint8_t)(c); \
+    } else { \
+        if((uint32_t)(c)<=0x7ff) { \
+            (s)[(i)++]=(uint8_t)(((c)>>6)|0xc0); \
+        } else { \
+            if((uint32_t)(c)<=0xffff) { \
+                (s)[(i)++]=(uint8_t)(((c)>>12)|0xe0); \
+            } else { \
+                (s)[(i)++]=(uint8_t)(((c)>>18)|0xf0); \
+                (s)[(i)++]=(uint8_t)((((c)>>12)&0x3f)|0x80); \
+            } \
+            (s)[(i)++]=(uint8_t)((((c)>>6)&0x3f)|0x80); \
+        } \
+        (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \
+    } \
+}
+
+/**
+ * Append a code point to a string, overwriting 1 to 4 bytes.
+ * The offset points to the current end of the string contents
+ * and is advanced (post-increment).
+ * "Safe" macro, checks for a valid code point.
+ * If a non-ASCII code point is written, checks for sufficient space in the string.
+ * If the code point is not valid or trail bytes do not fit,
+ * then isError is set to TRUE.
+ *
+ * @param s const uint8_t * string buffer
+ * @param i int32_t string offset, must be i>6)|0xc0); \
+        (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \
+    } else if((uint32_t)(c)<=0xd7ff && (i)+2<(capacity)) { \
+        (s)[(i)++]=(uint8_t)(((c)>>12)|0xe0); \
+        (s)[(i)++]=(uint8_t)((((c)>>6)&0x3f)|0x80); \
+        (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \
+    } else { \
+        (i)=utf8_appendCharSafeBody(s, (i), (capacity), c, &(isError)); \
+    } \
+}
+
+/**
+ * Advance the string offset from one code point boundary to the next.
+ * (Post-incrementing iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @see U8_FWD_1
+ * @stable ICU 2.4
+ */
+#define U8_FWD_1_UNSAFE(s, i) { \
+    (i)+=1+U8_COUNT_TRAIL_BYTES_UNSAFE((s)[i]); \
+}
+
+/**
+ * Advance the string offset from one code point boundary to the next.
+ * (Post-incrementing iteration.)
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * The length can be negative for a NUL-terminated string.
+ *
+ * @param s const uint8_t * string
+ * @param i int32_t string offset, must be i=0xf0 */ { \
+            if(U8_IS_VALID_LEAD4_AND_T1(__b, __t1) && \
+                    ++(i)!=(length) && U8_IS_TRAIL((s)[i]) && \
+                    ++(i)!=(length) && U8_IS_TRAIL((s)[i])) { \
+                ++(i); \
+            } \
+        } \
+    } \
+}
+
+/**
+ * Advance the string offset from one code point boundary to the n-th next one,
+ * i.e., move forward by n code points.
+ * (Post-incrementing iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @param n number of code points to skip
+ * @see U8_FWD_N
+ * @stable ICU 2.4
+ */
+#define U8_FWD_N_UNSAFE(s, i, n) { \
+    int32_t __N=(n); \
+    while(__N>0) { \
+        U8_FWD_1_UNSAFE(s, i); \
+        --__N; \
+    } \
+}
+
+/**
+ * Advance the string offset from one code point boundary to the n-th next one,
+ * i.e., move forward by n code points.
+ * (Post-incrementing iteration.)
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * The length can be negative for a NUL-terminated string.
+ *
+ * @param s const uint8_t * string
+ * @param i int32_t string offset, must be i0 && ((i)<(length) || ((length)<0 && (s)[i]!=0))) { \
+        U8_FWD_1(s, i, length); \
+        --__N; \
+    } \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary
+ * at the start of a code point.
+ * If the offset points to a UTF-8 trail byte,
+ * then the offset is moved backward to the corresponding lead byte.
+ * Otherwise, it is not modified.
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @see U8_SET_CP_START
+ * @stable ICU 2.4
+ */
+#define U8_SET_CP_START_UNSAFE(s, i) { \
+    while(U8_IS_TRAIL((s)[i])) { --(i); } \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary
+ * at the start of a code point.
+ * If the offset points to a UTF-8 trail byte,
+ * then the offset is moved backward to the corresponding lead byte.
+ * Otherwise, it is not modified.
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * @param s const uint8_t * string
+ * @param start int32_t starting string offset (usually 0)
+ * @param i int32_t string offset, must be start<=i
+ * @see U8_SET_CP_START_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U8_SET_CP_START(s, start, i) { \
+    if(U8_IS_TRAIL((s)[(i)])) { \
+        (i)=utf8_back1SafeBody(s, start, (i)); \
+    } \
+}
+
+/* definitions with backward iteration -------------------------------------- */
+
+/**
+ * Move the string offset from one code point boundary to the previous one
+ * and get the code point between them.
+ * (Pre-decrementing backward iteration.)
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * The input offset may be the same as the string length.
+ * If the offset is behind a multi-byte sequence, then the macro will read
+ * the whole sequence.
+ * If the offset is behind a lead byte, then that itself
+ * will be returned as the code point.
+ * The result is undefined if the offset is behind an illegal UTF-8 sequence.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @param c output UChar32 variable
+ * @see U8_PREV
+ * @stable ICU 2.4
+ */
+#define U8_PREV_UNSAFE(s, i, c) { \
+    (c)=(uint8_t)(s)[--(i)]; \
+    if(U8_IS_TRAIL(c)) { \
+        uint8_t __b, __count=1, __shift=6; \
+\
+        /* c is a trail byte */ \
+        (c)&=0x3f; \
+        for(;;) { \
+            __b=(s)[--(i)]; \
+            if(__b>=0xc0) { \
+                U8_MASK_LEAD_BYTE(__b, __count); \
+                (c)|=(UChar32)__b<<__shift; \
+                break; \
+            } else { \
+                (c)|=(UChar32)(__b&0x3f)<<__shift; \
+                ++__count; \
+                __shift+=6; \
+            } \
+        } \
+    } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the previous one
+ * and get the code point between them.
+ * (Pre-decrementing backward iteration.)
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * The input offset may be the same as the string length.
+ * If the offset is behind a multi-byte sequence, then the macro will read
+ * the whole sequence.
+ * If the offset is behind a lead byte, then that itself
+ * will be returned as the code point.
+ * If the offset is behind an illegal UTF-8 sequence, then c is set to a negative value.
+ *
+ * @param s const uint8_t * string
+ * @param start int32_t starting string offset (usually 0)
+ * @param i int32_t string offset, must be start0) { \
+        U8_BACK_1_UNSAFE(s, i); \
+        --__N; \
+    } \
+}
+
+/**
+ * Move the string offset from one code point boundary to the n-th one before it,
+ * i.e., move backward by n code points.
+ * (Pre-decrementing backward iteration.)
+ * The input offset may be the same as the string length.
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * @param s const uint8_t * string
+ * @param start int32_t index of the start of the string
+ * @param i int32_t string offset, must be start0 && (i)>(start)) { \
+        U8_BACK_1(s, start, i); \
+        --__N; \
+    } \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary after a code point.
+ * If the offset is behind a partial multi-byte sequence,
+ * then the offset is incremented to behind the whole sequence.
+ * Otherwise, it is not modified.
+ * The input offset may be the same as the string length.
+ * "Unsafe" macro, assumes well-formed UTF-8.
+ *
+ * @param s const uint8_t * string
+ * @param i string offset
+ * @see U8_SET_CP_LIMIT
+ * @stable ICU 2.4
+ */
+#define U8_SET_CP_LIMIT_UNSAFE(s, i) { \
+    U8_BACK_1_UNSAFE(s, i); \
+    U8_FWD_1_UNSAFE(s, i); \
+}
+
+/**
+ * Adjust a random-access offset to a code point boundary after a code point.
+ * If the offset is behind a partial multi-byte sequence,
+ * then the offset is incremented to behind the whole sequence.
+ * Otherwise, it is not modified.
+ * The input offset may be the same as the string length.
+ * "Safe" macro, checks for illegal sequences and for string boundaries.
+ *
+ * The length can be negative for a NUL-terminated string.
+ *
+ * @param s const uint8_t * string
+ * @param start int32_t starting string offset (usually 0)
+ * @param i int32_t string offset, must be start<=i<=length
+ * @param length int32_t string length
+ * @see U8_SET_CP_LIMIT_UNSAFE
+ * @stable ICU 2.4
+ */
+#define U8_SET_CP_LIMIT(s, start, i, length) { \
+    if((start)<(i) && ((i)<(length) || (length)<0)) { \
+        U8_BACK_1(s, start, i); \
+        U8_FWD_1(s, i, length); \
+    } \
+}
+
+#endif
diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/utf_old.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/utf_old.h
new file mode 100644
index 0000000..55c17c0
--- /dev/null
+++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/utf_old.h
@@ -0,0 +1,1204 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+/*
+*******************************************************************************
+*
+*   Copyright (C) 2002-2012, International Business Machines
+*   Corporation and others.  All Rights Reserved.
+*
+*******************************************************************************
+*   file name:  utf_old.h
+*   encoding:   UTF-8
+*   tab size:   8 (not used)
+*   indentation:4
+*
+*   created on: 2002sep21
+*   created by: Markus W. Scherer
+*/
+
+/**
+ * \file
+ * \brief C API: Deprecated macros for Unicode string handling
+ */
+
+/**
+ *
+ * The macros in utf_old.h are all deprecated and their use discouraged.
+ * Some of the design principles behind the set of UTF macros
+ * have changed or proved impractical.
+ * Almost all of the old "UTF macros" are at least renamed.
+ * If you are looking for a new equivalent to an old macro, please see the
+ * comment at the old one.
+ *
+ * Brief summary of reasons for deprecation:
+ * - Switch on UTF_SIZE (selection of UTF-8/16/32 default string processing)
+ *   was impractical.
+ * - Switch on UTF_SAFE etc. (selection of unsafe/safe/strict default string processing)
+ *   was of little use and impractical.
+ * - Whole classes of macros became obsolete outside of the UTF_SIZE/UTF_SAFE
+ *   selection framework: UTF32_ macros (all trivial)
+ *   and UTF_ default and intermediate macros (all aliases).
+ * - The selection framework also caused many macro aliases.
+ * - Change in Unicode standard: "irregular" sequences (3.0) became illegal (3.2).
+ * - Change of language in Unicode standard:
+ *   Growing distinction between internal x-bit Unicode strings and external UTF-x
+ *   forms, with the former more lenient.
+ *   Suggests renaming of UTF16_ macros to U16_.
+ * - The prefix "UTF_" without a width number confused some users.
+ * - "Safe" append macros needed the addition of an error indicator output.
+ * - "Safe" UTF-8 macros used legitimate (if rarely used) code point values
+ *   to indicate error conditions.
+ * - The use of the "_CHAR" infix for code point operations confused some users.
+ *
+ * More details:
+ *
+ * Until ICU 2.2, utf.h theoretically allowed to choose among UTF-8/16/32
+ * for string processing, and among unsafe/safe/strict default macros for that.
+ *
+ * It proved nearly impossible to write non-trivial, high-performance code
+ * that is UTF-generic.
+ * Unsafe default macros would be dangerous for default string processing,
+ * and the main reason for the "strict" versions disappeared:
+ * Between Unicode 3.0 and 3.2 all "irregular" UTF-8 sequences became illegal.
+ * The only other conditions that "strict" checked for were non-characters,
+ * which are valid during processing. Only during text input/output should they
+ * be checked, and at that time other well-formedness checks may be
+ * necessary or useful as well.
+ * This can still be done by using U16_NEXT and U_IS_UNICODE_NONCHAR
+ * or U_IS_UNICODE_CHAR.
+ *
+ * The old UTF8_..._SAFE macros also used some normal Unicode code points
+ * to indicate malformed sequences.
+ * The new UTF8_ macros without suffix use negative values instead.
+ *
+ * The entire contents of utf32.h was moved here without replacement
+ * because all those macros were trivial and
+ * were meaningful only in the framework of choosing the UTF size.
+ *
+ * See Jitterbug 2150 and its discussion on the ICU mailing list
+ * in September 2002.
+ *
+ * 
+ * + * Obsolete part of pre-ICU 2.4 utf.h file documentation: + * + *

The original concept for these files was for ICU to allow + * in principle to set which UTF (UTF-8/16/32) is used internally + * by defining UTF_SIZE to either 8, 16, or 32. utf.h would then define the UChar type + * accordingly. UTF-16 was the default.

+ * + *

This concept has been abandoned. + * A lot of the ICU source code assumes UChar strings are in UTF-16. + * This is especially true for low-level code like + * conversion, normalization, and collation. + * The utf.h header enforces the default of UTF-16. + * The UTF-8 and UTF-32 macros remain for now for completeness and backward compatibility.

+ * + *

Accordingly, utf.h defines UChar to be an unsigned 16-bit integer. If this matches wchar_t, then + * UChar is defined to be exactly wchar_t, otherwise uint16_t.

+ * + *

UChar32 is defined to be a signed 32-bit integer (int32_t), large enough for a 21-bit + * Unicode code point (Unicode scalar value, 0..0x10ffff). + * Before ICU 2.4, the definition of UChar32 was similarly platform-dependent as + * the definition of UChar. For details see the documentation for UChar32 itself.

+ * + *

utf.h also defines a number of C macros for handling single Unicode code points and + * for using UTF Unicode strings. It includes utf8.h, utf16.h, and utf32.h for the actual + * implementations of those macros and then aliases one set of them (for UTF-16) for general use. + * The UTF-specific macros have the UTF size in the macro name prefixes (UTF16_...), while + * the general alias macros always begin with UTF_...

+ * + *

Many string operations can be done with or without error checking. + * Where such a distinction is useful, there are two versions of the macros, "unsafe" and "safe" + * ones with ..._UNSAFE and ..._SAFE suffixes. The unsafe macros are fast but may cause + * program failures if the strings are not well-formed. The safe macros have an additional, boolean + * parameter "strict". If strict is FALSE, then only illegal sequences are detected. + * Otherwise, irregular sequences and non-characters are detected as well (like single surrogates). + * Safe macros return special error code points for illegal/irregular sequences: + * Typically, U+ffff, or values that would result in a code unit sequence of the same length + * as the erroneous input sequence.
+ * Note that _UNSAFE macros have fewer parameters: They do not have the strictness parameter, and + * they do not have start/length parameters for boundary checking.

+ * + *

Here, the macros are aliased in two steps: + * In the first step, the UTF-specific macros with UTF16_ prefix and _UNSAFE and _SAFE suffixes are + * aliased according to the UTF_SIZE to macros with UTF_ prefix and the same suffixes and signatures. + * Then, in a second step, the default, general alias macros are set to use either the unsafe or + * the safe/not strict (default) or the safe/strict macro; + * these general macros do not have a strictness parameter.

+ * + *

It is possible to change the default choice for the general alias macros to be unsafe, safe/not strict or safe/strict. + * The default is safe/not strict. It is not recommended to select the unsafe macros as the basis for + * Unicode string handling in ICU! To select this, define UTF_SAFE, UTF_STRICT, or UTF_UNSAFE.

+ * + *

For general use, one should use the default, general macros with UTF_ prefix and no _SAFE/_UNSAFE suffix. + * Only in some cases it may be necessary to control the choice of macro directly and use a less generic alias. + * For example, if it can be assumed that a string is well-formed and the index will stay within the bounds, + * then the _UNSAFE version may be used. + * If a UTF-8 string is to be processed, then the macros with UTF8_ prefixes need to be used.

+ * + *
+ * + * @deprecated ICU 2.4. Use the macros in utf.h, utf16.h, utf8.h instead. + */ + +#ifndef __UTF_OLD_H__ +#define __UTF_OLD_H__ + +/** + * \def U_HIDE_OBSOLETE_UTF_OLD_H + * + * Hides the obsolete definitions in unicode/utf_old.h. + * Recommended to be set to 1 at compile time to make sure + * the long-deprecated macros are no longer used. + * + * For reasons for the deprecation see the utf_old.h file comments. + * + * @internal + */ +#ifndef U_HIDE_OBSOLETE_UTF_OLD_H +# define U_HIDE_OBSOLETE_UTF_OLD_H 0 +#endif + +#if !defined(U_HIDE_DEPRECATED_API) && !U_HIDE_OBSOLETE_UTF_OLD_H + +#include "unicode/utf.h" +#include "unicode/utf8.h" +#include "unicode/utf16.h" + +/* Formerly utf.h, part 1 --------------------------------------------------- */ + +#ifdef U_USE_UTF_DEPRECATES +/** + * Unicode string and array offset and index type. + * ICU always counts Unicode code units (UChars) for + * string offsets, indexes, and lengths, not Unicode code points. + * + * @obsolete ICU 2.6. Use int32_t directly instead since this API will be removed in that release. + */ +typedef int32_t UTextOffset; +#endif + +/** Number of bits in a Unicode string code unit - ICU uses 16-bit Unicode. @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF_SIZE 16 + +/** + * The default choice for general Unicode string macros is to use the ..._SAFE macro implementations + * with strict=FALSE. + * + * @deprecated ICU 2.4. Obsolete, see utf_old.h. + */ +#define UTF_SAFE +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#undef UTF_UNSAFE +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#undef UTF_STRICT + +/** + * UTF8_ERROR_VALUE_1 and UTF8_ERROR_VALUE_2 are special error values for UTF-8, + * which need 1 or 2 bytes in UTF-8: + * \code + * U+0015 = NAK = Negative Acknowledge, C0 control character + * U+009f = highest C1 control character + * \endcode + * + * These are used by UTF8_..._SAFE macros so that they can return an error value + * that needs the same number of code units (bytes) as were seen by + * a macro. They should be tested with UTF_IS_ERROR() or UTF_IS_VALID(). + * + * @deprecated ICU 2.4. Obsolete, see utf_old.h. + */ +#define UTF8_ERROR_VALUE_1 0x15 + +/** + * See documentation on UTF8_ERROR_VALUE_1 for details. + * + * @deprecated ICU 2.4. Obsolete, see utf_old.h. + */ +#define UTF8_ERROR_VALUE_2 0x9f + +/** + * Error value for all UTFs. This code point value will be set by macros with error + * checking if an error is detected. + * + * @deprecated ICU 2.4. Obsolete, see utf_old.h. + */ +#define UTF_ERROR_VALUE 0xffff + +/** + * Is a given 32-bit code an error value + * as returned by one of the macros for any UTF? + * + * @deprecated ICU 2.4. Obsolete, see utf_old.h. + */ +#define UTF_IS_ERROR(c) \ + (((c)&0xfffe)==0xfffe || (c)==UTF8_ERROR_VALUE_1 || (c)==UTF8_ERROR_VALUE_2) + +/** + * This is a combined macro: Is c a valid Unicode value _and_ not an error code? + * + * @deprecated ICU 2.4. Obsolete, see utf_old.h. + */ +#define UTF_IS_VALID(c) \ + (UTF_IS_UNICODE_CHAR(c) && \ + (c)!=UTF8_ERROR_VALUE_1 && (c)!=UTF8_ERROR_VALUE_2) + +/** + * Is this code unit or code point a surrogate (U+d800..U+dfff)? + * @deprecated ICU 2.4. Renamed to U_IS_SURROGATE and U16_IS_SURROGATE, see utf_old.h. + */ +#define UTF_IS_SURROGATE(uchar) (((uchar)&0xfffff800)==0xd800) + +/** + * Is a given 32-bit code point a Unicode noncharacter? + * + * @deprecated ICU 2.4. Renamed to U_IS_UNICODE_NONCHAR, see utf_old.h. + */ +#define UTF_IS_UNICODE_NONCHAR(c) \ + ((c)>=0xfdd0 && \ + ((uint32_t)(c)<=0xfdef || ((c)&0xfffe)==0xfffe) && \ + (uint32_t)(c)<=0x10ffff) + +/** + * Is a given 32-bit value a Unicode code point value (0..U+10ffff) + * that can be assigned a character? + * + * Code points that are not characters include: + * - single surrogate code points (U+d800..U+dfff, 2048 code points) + * - the last two code points on each plane (U+__fffe and U+__ffff, 34 code points) + * - U+fdd0..U+fdef (new with Unicode 3.1, 32 code points) + * - the highest Unicode code point value is U+10ffff + * + * This means that all code points below U+d800 are character code points, + * and that boundary is tested first for performance. + * + * @deprecated ICU 2.4. Renamed to U_IS_UNICODE_CHAR, see utf_old.h. + */ +#define UTF_IS_UNICODE_CHAR(c) \ + ((uint32_t)(c)<0xd800 || \ + ((uint32_t)(c)>0xdfff && \ + (uint32_t)(c)<=0x10ffff && \ + !UTF_IS_UNICODE_NONCHAR(c))) + +/* Formerly utf8.h ---------------------------------------------------------- */ + +/** +* \var utf8_countTrailBytes +* Internal array with numbers of trail bytes for any given byte used in +* lead byte position. +* +* This is internal since it is not meant to be called directly by external clients; +* however it is called by public macros in this file and thus must remain stable, +* and should not be hidden when other internal functions are hidden (otherwise +* public macros would fail to compile). +* @internal +*/ +#ifdef U_UTF8_IMPL +// No forward declaration if compiling utf_impl.cpp, which defines utf8_countTrailBytes. +#elif defined(U_STATIC_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) +U_CFUNC const uint8_t utf8_countTrailBytes[]; +#else +U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_IMPORT*/ +#endif + +/** + * Count the trail bytes for a UTF-8 lead byte. + * @deprecated ICU 2.4. Renamed to U8_COUNT_TRAIL_BYTES, see utf_old.h. + */ +#define UTF8_COUNT_TRAIL_BYTES(leadByte) (utf8_countTrailBytes[(uint8_t)leadByte]) + +/** + * Mask a UTF-8 lead byte, leave only the lower bits that form part of the code point value. + * @deprecated ICU 2.4. Renamed to U8_MASK_LEAD_BYTE, see utf_old.h. + */ +#define UTF8_MASK_LEAD_BYTE(leadByte, countTrailBytes) ((leadByte)&=(1<<(6-(countTrailBytes)))-1) + +/** Is this this code point a single code unit (byte)? @deprecated ICU 2.4. Renamed to U8_IS_SINGLE, see utf_old.h. */ +#define UTF8_IS_SINGLE(uchar) (((uchar)&0x80)==0) +/** Is this this code unit the lead code unit (byte) of a code point? @deprecated ICU 2.4. Renamed to U8_IS_LEAD, see utf_old.h. */ +#define UTF8_IS_LEAD(uchar) ((uint8_t)((uchar)-0xc0)<0x3e) +/** Is this this code unit a trailing code unit (byte) of a code point? @deprecated ICU 2.4. Renamed to U8_IS_TRAIL, see utf_old.h. */ +#define UTF8_IS_TRAIL(uchar) (((uchar)&0xc0)==0x80) + +/** Does this scalar Unicode value need multiple code units for storage? @deprecated ICU 2.4. Use U8_LENGTH or test ((uint32_t)(c)>0x7f) instead, see utf_old.h. */ +#define UTF8_NEED_MULTIPLE_UCHAR(c) ((uint32_t)(c)>0x7f) + +/** + * Given the lead character, how many bytes are taken by this code point. + * ICU does not deal with code points >0x10ffff + * unless necessary for advancing in the byte stream. + * + * These length macros take into account that for values >0x10ffff + * the UTF8_APPEND_CHAR_SAFE macros would write the error code point 0xffff + * with 3 bytes. + * Code point comparisons need to be in uint32_t because UChar32 + * may be a signed type, and negative values must be recognized. + * + * @deprecated ICU 2.4. Use U8_LENGTH instead, see utf.h. + */ +#if 1 +# define UTF8_CHAR_LENGTH(c) \ + ((uint32_t)(c)<=0x7f ? 1 : \ + ((uint32_t)(c)<=0x7ff ? 2 : \ + ((uint32_t)((c)-0x10000)>0xfffff ? 3 : 4) \ + ) \ + ) +#else +# define UTF8_CHAR_LENGTH(c) \ + ((uint32_t)(c)<=0x7f ? 1 : \ + ((uint32_t)(c)<=0x7ff ? 2 : \ + ((uint32_t)(c)<=0xffff ? 3 : \ + ((uint32_t)(c)<=0x10ffff ? 4 : \ + ((uint32_t)(c)<=0x3ffffff ? 5 : \ + ((uint32_t)(c)<=0x7fffffff ? 6 : 3) \ + ) \ + ) \ + ) \ + ) \ + ) +#endif + +/** The maximum number of bytes per code point. @deprecated ICU 2.4. Renamed to U8_MAX_LENGTH, see utf_old.h. */ +#define UTF8_MAX_CHAR_LENGTH 4 + +/** Average number of code units compared to UTF-16. @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF8_ARRAY_SIZE(size) ((5*(size))/2) + +/** @deprecated ICU 2.4. Renamed to U8_GET_UNSAFE, see utf_old.h. */ +#define UTF8_GET_CHAR_UNSAFE(s, i, c) { \ + int32_t _utf8_get_char_unsafe_index=(int32_t)(i); \ + UTF8_SET_CHAR_START_UNSAFE(s, _utf8_get_char_unsafe_index); \ + UTF8_NEXT_CHAR_UNSAFE(s, _utf8_get_char_unsafe_index, c); \ +} + +/** @deprecated ICU 2.4. Use U8_GET instead, see utf_old.h. */ +#define UTF8_GET_CHAR_SAFE(s, start, i, length, c, strict) { \ + int32_t _utf8_get_char_safe_index=(int32_t)(i); \ + UTF8_SET_CHAR_START_SAFE(s, start, _utf8_get_char_safe_index); \ + UTF8_NEXT_CHAR_SAFE(s, _utf8_get_char_safe_index, length, c, strict); \ +} + +/** @deprecated ICU 2.4. Renamed to U8_NEXT_UNSAFE, see utf_old.h. */ +#define UTF8_NEXT_CHAR_UNSAFE(s, i, c) { \ + (c)=(s)[(i)++]; \ + if((uint8_t)((c)-0xc0)<0x35) { \ + uint8_t __count=UTF8_COUNT_TRAIL_BYTES(c); \ + UTF8_MASK_LEAD_BYTE(c, __count); \ + switch(__count) { \ + /* each following branch falls through to the next one */ \ + case 3: \ + (c)=((c)<<6)|((s)[(i)++]&0x3f); \ + case 2: \ + (c)=((c)<<6)|((s)[(i)++]&0x3f); \ + case 1: \ + (c)=((c)<<6)|((s)[(i)++]&0x3f); \ + /* no other branches to optimize switch() */ \ + break; \ + } \ + } \ +} + +/** @deprecated ICU 2.4. Renamed to U8_APPEND_UNSAFE, see utf_old.h. */ +#define UTF8_APPEND_CHAR_UNSAFE(s, i, c) { \ + if((uint32_t)(c)<=0x7f) { \ + (s)[(i)++]=(uint8_t)(c); \ + } else { \ + if((uint32_t)(c)<=0x7ff) { \ + (s)[(i)++]=(uint8_t)(((c)>>6)|0xc0); \ + } else { \ + if((uint32_t)(c)<=0xffff) { \ + (s)[(i)++]=(uint8_t)(((c)>>12)|0xe0); \ + } else { \ + (s)[(i)++]=(uint8_t)(((c)>>18)|0xf0); \ + (s)[(i)++]=(uint8_t)((((c)>>12)&0x3f)|0x80); \ + } \ + (s)[(i)++]=(uint8_t)((((c)>>6)&0x3f)|0x80); \ + } \ + (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \ + } \ +} + +/** @deprecated ICU 2.4. Renamed to U8_FWD_1_UNSAFE, see utf_old.h. */ +#define UTF8_FWD_1_UNSAFE(s, i) { \ + (i)+=1+UTF8_COUNT_TRAIL_BYTES((s)[i]); \ +} + +/** @deprecated ICU 2.4. Renamed to U8_FWD_N_UNSAFE, see utf_old.h. */ +#define UTF8_FWD_N_UNSAFE(s, i, n) { \ + int32_t __N=(n); \ + while(__N>0) { \ + UTF8_FWD_1_UNSAFE(s, i); \ + --__N; \ + } \ +} + +/** @deprecated ICU 2.4. Renamed to U8_SET_CP_START_UNSAFE, see utf_old.h. */ +#define UTF8_SET_CHAR_START_UNSAFE(s, i) { \ + while(UTF8_IS_TRAIL((s)[i])) { --(i); } \ +} + +/** @deprecated ICU 2.4. Use U8_NEXT instead, see utf_old.h. */ +#define UTF8_NEXT_CHAR_SAFE(s, i, length, c, strict) { \ + (c)=(s)[(i)++]; \ + if((c)>=0x80) { \ + if(UTF8_IS_LEAD(c)) { \ + (c)=utf8_nextCharSafeBody(s, &(i), (int32_t)(length), c, strict); \ + } else { \ + (c)=UTF8_ERROR_VALUE_1; \ + } \ + } \ +} + +/** @deprecated ICU 2.4. Use U8_APPEND instead, see utf_old.h. */ +#define UTF8_APPEND_CHAR_SAFE(s, i, length, c) { \ + if((uint32_t)(c)<=0x7f) { \ + (s)[(i)++]=(uint8_t)(c); \ + } else { \ + (i)=utf8_appendCharSafeBody(s, (int32_t)(i), (int32_t)(length), c, NULL); \ + } \ +} + +/** @deprecated ICU 2.4. Renamed to U8_FWD_1, see utf_old.h. */ +#define UTF8_FWD_1_SAFE(s, i, length) U8_FWD_1(s, i, length) + +/** @deprecated ICU 2.4. Renamed to U8_FWD_N, see utf_old.h. */ +#define UTF8_FWD_N_SAFE(s, i, length, n) U8_FWD_N(s, i, length, n) + +/** @deprecated ICU 2.4. Renamed to U8_SET_CP_START, see utf_old.h. */ +#define UTF8_SET_CHAR_START_SAFE(s, start, i) U8_SET_CP_START(s, start, i) + +/** @deprecated ICU 2.4. Renamed to U8_PREV_UNSAFE, see utf_old.h. */ +#define UTF8_PREV_CHAR_UNSAFE(s, i, c) { \ + (c)=(s)[--(i)]; \ + if(UTF8_IS_TRAIL(c)) { \ + uint8_t __b, __count=1, __shift=6; \ +\ + /* c is a trail byte */ \ + (c)&=0x3f; \ + for(;;) { \ + __b=(s)[--(i)]; \ + if(__b>=0xc0) { \ + UTF8_MASK_LEAD_BYTE(__b, __count); \ + (c)|=(UChar32)__b<<__shift; \ + break; \ + } else { \ + (c)|=(UChar32)(__b&0x3f)<<__shift; \ + ++__count; \ + __shift+=6; \ + } \ + } \ + } \ +} + +/** @deprecated ICU 2.4. Renamed to U8_BACK_1_UNSAFE, see utf_old.h. */ +#define UTF8_BACK_1_UNSAFE(s, i) { \ + while(UTF8_IS_TRAIL((s)[--(i)])) {} \ +} + +/** @deprecated ICU 2.4. Renamed to U8_BACK_N_UNSAFE, see utf_old.h. */ +#define UTF8_BACK_N_UNSAFE(s, i, n) { \ + int32_t __N=(n); \ + while(__N>0) { \ + UTF8_BACK_1_UNSAFE(s, i); \ + --__N; \ + } \ +} + +/** @deprecated ICU 2.4. Renamed to U8_SET_CP_LIMIT_UNSAFE, see utf_old.h. */ +#define UTF8_SET_CHAR_LIMIT_UNSAFE(s, i) { \ + UTF8_BACK_1_UNSAFE(s, i); \ + UTF8_FWD_1_UNSAFE(s, i); \ +} + +/** @deprecated ICU 2.4. Use U8_PREV instead, see utf_old.h. */ +#define UTF8_PREV_CHAR_SAFE(s, start, i, c, strict) { \ + (c)=(s)[--(i)]; \ + if((c)>=0x80) { \ + if((c)<=0xbf) { \ + (c)=utf8_prevCharSafeBody(s, start, &(i), c, strict); \ + } else { \ + (c)=UTF8_ERROR_VALUE_1; \ + } \ + } \ +} + +/** @deprecated ICU 2.4. Renamed to U8_BACK_1, see utf_old.h. */ +#define UTF8_BACK_1_SAFE(s, start, i) U8_BACK_1(s, start, i) + +/** @deprecated ICU 2.4. Renamed to U8_BACK_N, see utf_old.h. */ +#define UTF8_BACK_N_SAFE(s, start, i, n) U8_BACK_N(s, start, i, n) + +/** @deprecated ICU 2.4. Renamed to U8_SET_CP_LIMIT, see utf_old.h. */ +#define UTF8_SET_CHAR_LIMIT_SAFE(s, start, i, length) U8_SET_CP_LIMIT(s, start, i, length) + +/* Formerly utf16.h --------------------------------------------------------- */ + +/** Is uchar a first/lead surrogate? @deprecated ICU 2.4. Renamed to U_IS_LEAD and U16_IS_LEAD, see utf_old.h. */ +#define UTF_IS_FIRST_SURROGATE(uchar) (((uchar)&0xfffffc00)==0xd800) + +/** Is uchar a second/trail surrogate? @deprecated ICU 2.4. Renamed to U_IS_TRAIL and U16_IS_TRAIL, see utf_old.h. */ +#define UTF_IS_SECOND_SURROGATE(uchar) (((uchar)&0xfffffc00)==0xdc00) + +/** Assuming c is a surrogate, is it a first/lead surrogate? @deprecated ICU 2.4. Renamed to U_IS_SURROGATE_LEAD and U16_IS_SURROGATE_LEAD, see utf_old.h. */ +#define UTF_IS_SURROGATE_FIRST(c) (((c)&0x400)==0) + +/** Helper constant for UTF16_GET_PAIR_VALUE. @deprecated ICU 2.4. Renamed to U16_SURROGATE_OFFSET, see utf_old.h. */ +#define UTF_SURROGATE_OFFSET ((0xd800<<10UL)+0xdc00-0x10000) + +/** Get the UTF-32 value from the surrogate code units. @deprecated ICU 2.4. Renamed to U16_GET_SUPPLEMENTARY, see utf_old.h. */ +#define UTF16_GET_PAIR_VALUE(first, second) \ + (((first)<<10UL)+(second)-UTF_SURROGATE_OFFSET) + +/** @deprecated ICU 2.4. Renamed to U16_LEAD, see utf_old.h. */ +#define UTF_FIRST_SURROGATE(supplementary) (UChar)(((supplementary)>>10)+0xd7c0) + +/** @deprecated ICU 2.4. Renamed to U16_TRAIL, see utf_old.h. */ +#define UTF_SECOND_SURROGATE(supplementary) (UChar)(((supplementary)&0x3ff)|0xdc00) + +/** @deprecated ICU 2.4. Renamed to U16_LEAD, see utf_old.h. */ +#define UTF16_LEAD(supplementary) UTF_FIRST_SURROGATE(supplementary) + +/** @deprecated ICU 2.4. Renamed to U16_TRAIL, see utf_old.h. */ +#define UTF16_TRAIL(supplementary) UTF_SECOND_SURROGATE(supplementary) + +/** @deprecated ICU 2.4. Renamed to U16_IS_SINGLE, see utf_old.h. */ +#define UTF16_IS_SINGLE(uchar) !UTF_IS_SURROGATE(uchar) + +/** @deprecated ICU 2.4. Renamed to U16_IS_LEAD, see utf_old.h. */ +#define UTF16_IS_LEAD(uchar) UTF_IS_FIRST_SURROGATE(uchar) + +/** @deprecated ICU 2.4. Renamed to U16_IS_TRAIL, see utf_old.h. */ +#define UTF16_IS_TRAIL(uchar) UTF_IS_SECOND_SURROGATE(uchar) + +/** Does this scalar Unicode value need multiple code units for storage? @deprecated ICU 2.4. Use U16_LENGTH or test ((uint32_t)(c)>0xffff) instead, see utf_old.h. */ +#define UTF16_NEED_MULTIPLE_UCHAR(c) ((uint32_t)(c)>0xffff) + +/** @deprecated ICU 2.4. Renamed to U16_LENGTH, see utf_old.h. */ +#define UTF16_CHAR_LENGTH(c) ((uint32_t)(c)<=0xffff ? 1 : 2) + +/** @deprecated ICU 2.4. Renamed to U16_MAX_LENGTH, see utf_old.h. */ +#define UTF16_MAX_CHAR_LENGTH 2 + +/** Average number of code units compared to UTF-16. @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF16_ARRAY_SIZE(size) (size) + +/** + * Get a single code point from an offset that points to any + * of the code units that belong to that code point. + * Assume 0<=i=(start) && UTF_IS_FIRST_SURROGATE(__c2=(s)[(i)-1])) { \ + (c)=UTF16_GET_PAIR_VALUE(__c2, (c)); \ + /* strict: ((c)&0xfffe)==0xfffe is caught by UTF_IS_ERROR() and UTF_IS_UNICODE_CHAR() */ \ + } else if(strict) {\ + /* unmatched second surrogate */ \ + (c)=UTF_ERROR_VALUE; \ + } \ + } \ + } else if((strict) && !UTF_IS_UNICODE_CHAR(c)) { \ + (c)=UTF_ERROR_VALUE; \ + } \ +} + +/** @deprecated ICU 2.4. Renamed to U16_NEXT_UNSAFE, see utf_old.h. */ +#define UTF16_NEXT_CHAR_UNSAFE(s, i, c) { \ + (c)=(s)[(i)++]; \ + if(UTF_IS_FIRST_SURROGATE(c)) { \ + (c)=UTF16_GET_PAIR_VALUE((c), (s)[(i)++]); \ + } \ +} + +/** @deprecated ICU 2.4. Renamed to U16_APPEND_UNSAFE, see utf_old.h. */ +#define UTF16_APPEND_CHAR_UNSAFE(s, i, c) { \ + if((uint32_t)(c)<=0xffff) { \ + (s)[(i)++]=(uint16_t)(c); \ + } else { \ + (s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \ + (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \ + } \ +} + +/** @deprecated ICU 2.4. Renamed to U16_FWD_1_UNSAFE, see utf_old.h. */ +#define UTF16_FWD_1_UNSAFE(s, i) { \ + if(UTF_IS_FIRST_SURROGATE((s)[(i)++])) { \ + ++(i); \ + } \ +} + +/** @deprecated ICU 2.4. Renamed to U16_FWD_N_UNSAFE, see utf_old.h. */ +#define UTF16_FWD_N_UNSAFE(s, i, n) { \ + int32_t __N=(n); \ + while(__N>0) { \ + UTF16_FWD_1_UNSAFE(s, i); \ + --__N; \ + } \ +} + +/** @deprecated ICU 2.4. Renamed to U16_SET_CP_START_UNSAFE, see utf_old.h. */ +#define UTF16_SET_CHAR_START_UNSAFE(s, i) { \ + if(UTF_IS_SECOND_SURROGATE((s)[i])) { \ + --(i); \ + } \ +} + +/** @deprecated ICU 2.4. Use U16_NEXT instead, see utf_old.h. */ +#define UTF16_NEXT_CHAR_SAFE(s, i, length, c, strict) { \ + (c)=(s)[(i)++]; \ + if(UTF_IS_FIRST_SURROGATE(c)) { \ + uint16_t __c2; \ + if((i)<(length) && UTF_IS_SECOND_SURROGATE(__c2=(s)[(i)])) { \ + ++(i); \ + (c)=UTF16_GET_PAIR_VALUE((c), __c2); \ + /* strict: ((c)&0xfffe)==0xfffe is caught by UTF_IS_ERROR() and UTF_IS_UNICODE_CHAR() */ \ + } else if(strict) {\ + /* unmatched first surrogate */ \ + (c)=UTF_ERROR_VALUE; \ + } \ + } else if((strict) && !UTF_IS_UNICODE_CHAR(c)) { \ + /* unmatched second surrogate or other non-character */ \ + (c)=UTF_ERROR_VALUE; \ + } \ +} + +/** @deprecated ICU 2.4. Use U16_APPEND instead, see utf_old.h. */ +#define UTF16_APPEND_CHAR_SAFE(s, i, length, c) { \ + if((uint32_t)(c)<=0xffff) { \ + (s)[(i)++]=(uint16_t)(c); \ + } else if((uint32_t)(c)<=0x10ffff) { \ + if((i)+1<(length)) { \ + (s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \ + (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \ + } else /* not enough space */ { \ + (s)[(i)++]=UTF_ERROR_VALUE; \ + } \ + } else /* c>0x10ffff, write error value */ { \ + (s)[(i)++]=UTF_ERROR_VALUE; \ + } \ +} + +/** @deprecated ICU 2.4. Renamed to U16_FWD_1, see utf_old.h. */ +#define UTF16_FWD_1_SAFE(s, i, length) U16_FWD_1(s, i, length) + +/** @deprecated ICU 2.4. Renamed to U16_FWD_N, see utf_old.h. */ +#define UTF16_FWD_N_SAFE(s, i, length, n) U16_FWD_N(s, i, length, n) + +/** @deprecated ICU 2.4. Renamed to U16_SET_CP_START, see utf_old.h. */ +#define UTF16_SET_CHAR_START_SAFE(s, start, i) U16_SET_CP_START(s, start, i) + +/** @deprecated ICU 2.4. Renamed to U16_PREV_UNSAFE, see utf_old.h. */ +#define UTF16_PREV_CHAR_UNSAFE(s, i, c) { \ + (c)=(s)[--(i)]; \ + if(UTF_IS_SECOND_SURROGATE(c)) { \ + (c)=UTF16_GET_PAIR_VALUE((s)[--(i)], (c)); \ + } \ +} + +/** @deprecated ICU 2.4. Renamed to U16_BACK_1_UNSAFE, see utf_old.h. */ +#define UTF16_BACK_1_UNSAFE(s, i) { \ + if(UTF_IS_SECOND_SURROGATE((s)[--(i)])) { \ + --(i); \ + } \ +} + +/** @deprecated ICU 2.4. Renamed to U16_BACK_N_UNSAFE, see utf_old.h. */ +#define UTF16_BACK_N_UNSAFE(s, i, n) { \ + int32_t __N=(n); \ + while(__N>0) { \ + UTF16_BACK_1_UNSAFE(s, i); \ + --__N; \ + } \ +} + +/** @deprecated ICU 2.4. Renamed to U16_SET_CP_LIMIT_UNSAFE, see utf_old.h. */ +#define UTF16_SET_CHAR_LIMIT_UNSAFE(s, i) { \ + if(UTF_IS_FIRST_SURROGATE((s)[(i)-1])) { \ + ++(i); \ + } \ +} + +/** @deprecated ICU 2.4. Use U16_PREV instead, see utf_old.h. */ +#define UTF16_PREV_CHAR_SAFE(s, start, i, c, strict) { \ + (c)=(s)[--(i)]; \ + if(UTF_IS_SECOND_SURROGATE(c)) { \ + uint16_t __c2; \ + if((i)>(start) && UTF_IS_FIRST_SURROGATE(__c2=(s)[(i)-1])) { \ + --(i); \ + (c)=UTF16_GET_PAIR_VALUE(__c2, (c)); \ + /* strict: ((c)&0xfffe)==0xfffe is caught by UTF_IS_ERROR() and UTF_IS_UNICODE_CHAR() */ \ + } else if(strict) {\ + /* unmatched second surrogate */ \ + (c)=UTF_ERROR_VALUE; \ + } \ + } else if((strict) && !UTF_IS_UNICODE_CHAR(c)) { \ + /* unmatched first surrogate or other non-character */ \ + (c)=UTF_ERROR_VALUE; \ + } \ +} + +/** @deprecated ICU 2.4. Renamed to U16_BACK_1, see utf_old.h. */ +#define UTF16_BACK_1_SAFE(s, start, i) U16_BACK_1(s, start, i) + +/** @deprecated ICU 2.4. Renamed to U16_BACK_N, see utf_old.h. */ +#define UTF16_BACK_N_SAFE(s, start, i, n) U16_BACK_N(s, start, i, n) + +/** @deprecated ICU 2.4. Renamed to U16_SET_CP_LIMIT, see utf_old.h. */ +#define UTF16_SET_CHAR_LIMIT_SAFE(s, start, i, length) U16_SET_CP_LIMIT(s, start, i, length) + +/* Formerly utf32.h --------------------------------------------------------- */ + +/* +* Old documentation: +* +* This file defines macros to deal with UTF-32 code units and code points. +* Signatures and semantics are the same as for the similarly named macros +* in utf16.h. +* utf32.h is included by utf.h after unicode/umachine.h

+* and some common definitions. +*

Usage: ICU coding guidelines for if() statements should be followed when using these macros. +* Compound statements (curly braces {}) must be used for if-else-while... +* bodies and all macro statements should be terminated with semicolon.

+*/ + +/* internal definitions ----------------------------------------------------- */ + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_IS_SAFE(c, strict) \ + (!(strict) ? \ + (uint32_t)(c)<=0x10ffff : \ + UTF_IS_UNICODE_CHAR(c)) + +/* + * For the semantics of all of these macros, see utf16.h. + * The UTF-32 versions are trivial because any code point is + * encoded using exactly one code unit. + */ + +/* single-code point definitions -------------------------------------------- */ + +/* classes of code unit values */ + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_IS_SINGLE(uchar) 1 +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_IS_LEAD(uchar) 0 +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_IS_TRAIL(uchar) 0 + +/* number of code units per code point */ + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_NEED_MULTIPLE_UCHAR(c) 0 +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_CHAR_LENGTH(c) 1 +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_MAX_CHAR_LENGTH 1 + +/* average number of code units compared to UTF-16 */ + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_ARRAY_SIZE(size) (size) + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_GET_CHAR_UNSAFE(s, i, c) { \ + (c)=(s)[i]; \ +} + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_GET_CHAR_SAFE(s, start, i, length, c, strict) { \ + (c)=(s)[i]; \ + if(!UTF32_IS_SAFE(c, strict)) { \ + (c)=UTF_ERROR_VALUE; \ + } \ +} + +/* definitions with forward iteration --------------------------------------- */ + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_NEXT_CHAR_UNSAFE(s, i, c) { \ + (c)=(s)[(i)++]; \ +} + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_APPEND_CHAR_UNSAFE(s, i, c) { \ + (s)[(i)++]=(c); \ +} + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_FWD_1_UNSAFE(s, i) { \ + ++(i); \ +} + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_FWD_N_UNSAFE(s, i, n) { \ + (i)+=(n); \ +} + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_SET_CHAR_START_UNSAFE(s, i) { \ +} + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_NEXT_CHAR_SAFE(s, i, length, c, strict) { \ + (c)=(s)[(i)++]; \ + if(!UTF32_IS_SAFE(c, strict)) { \ + (c)=UTF_ERROR_VALUE; \ + } \ +} + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_APPEND_CHAR_SAFE(s, i, length, c) { \ + if((uint32_t)(c)<=0x10ffff) { \ + (s)[(i)++]=(c); \ + } else /* c>0x10ffff, write 0xfffd */ { \ + (s)[(i)++]=0xfffd; \ + } \ +} + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_FWD_1_SAFE(s, i, length) { \ + ++(i); \ +} + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_FWD_N_SAFE(s, i, length, n) { \ + if(((i)+=(n))>(length)) { \ + (i)=(length); \ + } \ +} + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_SET_CHAR_START_SAFE(s, start, i) { \ +} + +/* definitions with backward iteration -------------------------------------- */ + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_PREV_CHAR_UNSAFE(s, i, c) { \ + (c)=(s)[--(i)]; \ +} + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_BACK_1_UNSAFE(s, i) { \ + --(i); \ +} + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_BACK_N_UNSAFE(s, i, n) { \ + (i)-=(n); \ +} + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_SET_CHAR_LIMIT_UNSAFE(s, i) { \ +} + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_PREV_CHAR_SAFE(s, start, i, c, strict) { \ + (c)=(s)[--(i)]; \ + if(!UTF32_IS_SAFE(c, strict)) { \ + (c)=UTF_ERROR_VALUE; \ + } \ +} + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_BACK_1_SAFE(s, start, i) { \ + --(i); \ +} + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_BACK_N_SAFE(s, start, i, n) { \ + (i)-=(n); \ + if((i)<(start)) { \ + (i)=(start); \ + } \ +} + +/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ +#define UTF32_SET_CHAR_LIMIT_SAFE(s, i, length) { \ +} + +/* Formerly utf.h, part 2 --------------------------------------------------- */ + +/** + * Estimate the number of code units for a string based on the number of UTF-16 code units. + * + * @deprecated ICU 2.4. Obsolete, see utf_old.h. + */ +#define UTF_ARRAY_SIZE(size) UTF16_ARRAY_SIZE(size) + +/** @deprecated ICU 2.4. Renamed to U16_GET_UNSAFE, see utf_old.h. */ +#define UTF_GET_CHAR_UNSAFE(s, i, c) UTF16_GET_CHAR_UNSAFE(s, i, c) + +/** @deprecated ICU 2.4. Use U16_GET instead, see utf_old.h. */ +#define UTF_GET_CHAR_SAFE(s, start, i, length, c, strict) UTF16_GET_CHAR_SAFE(s, start, i, length, c, strict) + + +/** @deprecated ICU 2.4. Renamed to U16_NEXT_UNSAFE, see utf_old.h. */ +#define UTF_NEXT_CHAR_UNSAFE(s, i, c) UTF16_NEXT_CHAR_UNSAFE(s, i, c) + +/** @deprecated ICU 2.4. Use U16_NEXT instead, see utf_old.h. */ +#define UTF_NEXT_CHAR_SAFE(s, i, length, c, strict) UTF16_NEXT_CHAR_SAFE(s, i, length, c, strict) + + +/** @deprecated ICU 2.4. Renamed to U16_APPEND_UNSAFE, see utf_old.h. */ +#define UTF_APPEND_CHAR_UNSAFE(s, i, c) UTF16_APPEND_CHAR_UNSAFE(s, i, c) + +/** @deprecated ICU 2.4. Use U16_APPEND instead, see utf_old.h. */ +#define UTF_APPEND_CHAR_SAFE(s, i, length, c) UTF16_APPEND_CHAR_SAFE(s, i, length, c) + + +/** @deprecated ICU 2.4. Renamed to U16_FWD_1_UNSAFE, see utf_old.h. */ +#define UTF_FWD_1_UNSAFE(s, i) UTF16_FWD_1_UNSAFE(s, i) + +/** @deprecated ICU 2.4. Renamed to U16_FWD_1, see utf_old.h. */ +#define UTF_FWD_1_SAFE(s, i, length) UTF16_FWD_1_SAFE(s, i, length) + + +/** @deprecated ICU 2.4. Renamed to U16_FWD_N_UNSAFE, see utf_old.h. */ +#define UTF_FWD_N_UNSAFE(s, i, n) UTF16_FWD_N_UNSAFE(s, i, n) + +/** @deprecated ICU 2.4. Renamed to U16_FWD_N, see utf_old.h. */ +#define UTF_FWD_N_SAFE(s, i, length, n) UTF16_FWD_N_SAFE(s, i, length, n) + + +/** @deprecated ICU 2.4. Renamed to U16_SET_CP_START_UNSAFE, see utf_old.h. */ +#define UTF_SET_CHAR_START_UNSAFE(s, i) UTF16_SET_CHAR_START_UNSAFE(s, i) + +/** @deprecated ICU 2.4. Renamed to U16_SET_CP_START, see utf_old.h. */ +#define UTF_SET_CHAR_START_SAFE(s, start, i) UTF16_SET_CHAR_START_SAFE(s, start, i) + + +/** @deprecated ICU 2.4. Renamed to U16_PREV_UNSAFE, see utf_old.h. */ +#define UTF_PREV_CHAR_UNSAFE(s, i, c) UTF16_PREV_CHAR_UNSAFE(s, i, c) + +/** @deprecated ICU 2.4. Use U16_PREV instead, see utf_old.h. */ +#define UTF_PREV_CHAR_SAFE(s, start, i, c, strict) UTF16_PREV_CHAR_SAFE(s, start, i, c, strict) + + +/** @deprecated ICU 2.4. Renamed to U16_BACK_1_UNSAFE, see utf_old.h. */ +#define UTF_BACK_1_UNSAFE(s, i) UTF16_BACK_1_UNSAFE(s, i) + +/** @deprecated ICU 2.4. Renamed to U16_BACK_1, see utf_old.h. */ +#define UTF_BACK_1_SAFE(s, start, i) UTF16_BACK_1_SAFE(s, start, i) + + +/** @deprecated ICU 2.4. Renamed to U16_BACK_N_UNSAFE, see utf_old.h. */ +#define UTF_BACK_N_UNSAFE(s, i, n) UTF16_BACK_N_UNSAFE(s, i, n) + +/** @deprecated ICU 2.4. Renamed to U16_BACK_N, see utf_old.h. */ +#define UTF_BACK_N_SAFE(s, start, i, n) UTF16_BACK_N_SAFE(s, start, i, n) + + +/** @deprecated ICU 2.4. Renamed to U16_SET_CP_LIMIT_UNSAFE, see utf_old.h. */ +#define UTF_SET_CHAR_LIMIT_UNSAFE(s, i) UTF16_SET_CHAR_LIMIT_UNSAFE(s, i) + +/** @deprecated ICU 2.4. Renamed to U16_SET_CP_LIMIT, see utf_old.h. */ +#define UTF_SET_CHAR_LIMIT_SAFE(s, start, i, length) UTF16_SET_CHAR_LIMIT_SAFE(s, start, i, length) + +/* Define default macros (UTF-16 "safe") ------------------------------------ */ + +/** + * Does this code unit alone encode a code point (BMP, not a surrogate)? + * Same as UTF16_IS_SINGLE. + * @deprecated ICU 2.4. Renamed to U_IS_SINGLE and U16_IS_SINGLE, see utf_old.h. + */ +#define UTF_IS_SINGLE(uchar) U16_IS_SINGLE(uchar) + +/** + * Is this code unit the first one of several (a lead surrogate)? + * Same as UTF16_IS_LEAD. + * @deprecated ICU 2.4. Renamed to U_IS_LEAD and U16_IS_LEAD, see utf_old.h. + */ +#define UTF_IS_LEAD(uchar) U16_IS_LEAD(uchar) + +/** + * Is this code unit one of several but not the first one (a trail surrogate)? + * Same as UTF16_IS_TRAIL. + * @deprecated ICU 2.4. Renamed to U_IS_TRAIL and U16_IS_TRAIL, see utf_old.h. + */ +#define UTF_IS_TRAIL(uchar) U16_IS_TRAIL(uchar) + +/** + * Does this code point require multiple code units (is it a supplementary code point)? + * Same as UTF16_NEED_MULTIPLE_UCHAR. + * @deprecated ICU 2.4. Use U16_LENGTH or test ((uint32_t)(c)>0xffff) instead. + */ +#define UTF_NEED_MULTIPLE_UCHAR(c) UTF16_NEED_MULTIPLE_UCHAR(c) + +/** + * How many code units are used to encode this code point (1 or 2)? + * Same as UTF16_CHAR_LENGTH. + * @deprecated ICU 2.4. Renamed to U16_LENGTH, see utf_old.h. + */ +#define UTF_CHAR_LENGTH(c) U16_LENGTH(c) + +/** + * How many code units are used at most for any Unicode code point (2)? + * Same as UTF16_MAX_CHAR_LENGTH. + * @deprecated ICU 2.4. Renamed to U16_MAX_LENGTH, see utf_old.h. + */ +#define UTF_MAX_CHAR_LENGTH U16_MAX_LENGTH + +/** + * Set c to the code point that contains the code unit i. + * i could point to the lead or the trail surrogate for the code point. + * i is not modified. + * Same as UTF16_GET_CHAR. + * \pre 0<=iaverageTime = (time1 + time2)/2, there will be overflow even with dates + * around the present. Moreover, even if these problems don't occur, there is the issue of + * conversion back and forth between different systems. + * + *

+ * Binary datetimes differ in a number of ways: the datatype, the unit, + * and the epoch (origin). We'll refer to these as time scales. For example: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Table 1: Binary Time Scales
SourceDatatypeUnitEpoch
UDTS_JAVA_TIMEint64_tmillisecondsJan 1, 1970
UDTS_UNIX_TIMEint32_t or int64_tsecondsJan 1, 1970
UDTS_ICU4C_TIMEdoublemillisecondsJan 1, 1970
UDTS_WINDOWS_FILE_TIMEint64_tticks (100 nanoseconds)Jan 1, 1601
UDTS_DOTNET_DATE_TIMEint64_tticks (100 nanoseconds)Jan 1, 0001
UDTS_MAC_OLD_TIMEint32_t or int64_tsecondsJan 1, 1904
UDTS_MAC_TIMEdoublesecondsJan 1, 2001
UDTS_EXCEL_TIME?daysDec 31, 1899
UDTS_DB2_TIME?daysDec 31, 1899
UDTS_UNIX_MICROSECONDS_TIMEint64_tmicrosecondsJan 1, 1970
+ * + *

+ * All of the epochs start at 00:00 am (the earliest possible time on the day in question), + * and are assumed to be UTC. + * + *

+ * The ranges for different datatypes are given in the following table (all values in years). + * The range of years includes the entire range expressible with positive and negative + * values of the datatype. The range of years for double is the range that would be allowed + * without losing precision to the corresponding unit. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Unitsint64_tdoubleint32_t
1 sec5.84542x1011285,420,920.94136.10
1 millisecond584,542,046.09285,420.920.14
1 microsecond584,542.05285.420.00
100 nanoseconds (tick)58,454.2028.540.00
1 nanosecond584.54204610.28540.00
+ * + *

+ * These functions implement a universal time scale which can be used as a 'pivot', + * and provide conversion functions to and from all other major time scales. + * This datetimes to be converted to the pivot time, safely manipulated, + * and converted back to any other datetime time scale. + * + *

+ * So what to use for this pivot? Java time has plenty of range, but cannot represent + * .NET System.DateTime values without severe loss of precision. ICU4C time addresses this by using a + * double that is otherwise equivalent to the Java time. However, there are disadvantages + * with doubles. They provide for much more graceful degradation in arithmetic operations. + * But they only have 53 bits of accuracy, which means that they will lose precision when + * converting back and forth to ticks. What would really be nice would be a + * long double (80 bits -- 64 bit mantissa), but that is not supported on most systems. + * + *

+ * The Unix extended time uses a structure with two components: time in seconds and a + * fractional field (microseconds). However, this is clumsy, slow, and + * prone to error (you always have to keep track of overflow and underflow in the + * fractional field). BigDecimal would allow for arbitrary precision and arbitrary range, + * but we do not want to use this as the normal type, because it is slow and does not + * have a fixed size. + * + *

+ * Because of these issues, we ended up concluding that the .NET framework's + * System.DateTime would be the best pivot. However, we use the full range + * allowed by the datatype, allowing for datetimes back to 29,000 BC and up to 29,000 AD. + * This time scale is very fine grained, does not lose precision, and covers a range that + * will meet almost all requirements. It will not handle the range that Java times do, + * but frankly, being able to handle dates before 29,000 BC or after 29,000 AD is of very limited interest. + * + */ + +/** + * UDateTimeScale values are used to specify the time scale used for + * conversion into or out if the universal time scale. + * + * @stable ICU 3.2 + */ +typedef enum UDateTimeScale { + /** + * Used in the JDK. Data is a Java long (int64_t). Value + * is milliseconds since January 1, 1970. + * + * @stable ICU 3.2 + */ + UDTS_JAVA_TIME = 0, + + /** + * Used on Unix systems. Data is int32_t or int64_t. Value + * is seconds since January 1, 1970. + * + * @stable ICU 3.2 + */ + UDTS_UNIX_TIME, + + /** + * Used in IUC4C. Data is a double. Value + * is milliseconds since January 1, 1970. + * + * @stable ICU 3.2 + */ + UDTS_ICU4C_TIME, + + /** + * Used in Windows for file times. Data is an int64_t. Value + * is ticks (1 tick == 100 nanoseconds) since January 1, 1601. + * + * @stable ICU 3.2 + */ + UDTS_WINDOWS_FILE_TIME, + + /** + * Used in the .NET framework's System.DateTime structure. Data is an int64_t. Value + * is ticks (1 tick == 100 nanoseconds) since January 1, 0001. + * + * @stable ICU 3.2 + */ + UDTS_DOTNET_DATE_TIME, + + /** + * Used in older Macintosh systems. Data is int32_t or int64_t. Value + * is seconds since January 1, 1904. + * + * @stable ICU 3.2 + */ + UDTS_MAC_OLD_TIME, + + /** + * Used in newer Macintosh systems. Data is a double. Value + * is seconds since January 1, 2001. + * + * @stable ICU 3.2 + */ + UDTS_MAC_TIME, + + /** + * Used in Excel. Data is an ?unknown?. Value + * is days since December 31, 1899. + * + * @stable ICU 3.2 + */ + UDTS_EXCEL_TIME, + + /** + * Used in DB2. Data is an ?unknown?. Value + * is days since December 31, 1899. + * + * @stable ICU 3.2 + */ + UDTS_DB2_TIME, + + /** + * Data is a long. Value is microseconds since January 1, 1970. + * Similar to Unix time (linear value from 1970) and struct timeval + * (microseconds resolution). + * + * @stable ICU 3.8 + */ + UDTS_UNIX_MICROSECONDS_TIME, + +#ifndef U_HIDE_DEPRECATED_API + /** + * The first unused time scale value. The limit of this enum + * @deprecated ICU 59 The numeric value may change over time, see ICU ticket #12420. + */ + UDTS_MAX_SCALE +#endif /* U_HIDE_DEPRECATED_API */ + +} UDateTimeScale; + +/** + * UTimeScaleValue values are used to specify the time scale values + * to utmscale_getTimeScaleValue. + * + * @see utmscale_getTimeScaleValue + * + * @stable ICU 3.2 + */ +typedef enum UTimeScaleValue { + /** + * The constant used to select the units vale + * for a time scale. + * + * @see utmscale_getTimeScaleValue + * + * @stable ICU 3.2 + */ + UTSV_UNITS_VALUE = 0, + + /** + * The constant used to select the epoch offset value + * for a time scale. + * + * @see utmscale_getTimeScaleValue + * + * @stable ICU 3.2 + */ + UTSV_EPOCH_OFFSET_VALUE=1, + + /** + * The constant used to select the minimum from value + * for a time scale. + * + * @see utmscale_getTimeScaleValue + * + * @stable ICU 3.2 + */ + UTSV_FROM_MIN_VALUE=2, + + /** + * The constant used to select the maximum from value + * for a time scale. + * + * @see utmscale_getTimeScaleValue + * + * @stable ICU 3.2 + */ + UTSV_FROM_MAX_VALUE=3, + + /** + * The constant used to select the minimum to value + * for a time scale. + * + * @see utmscale_getTimeScaleValue + * + * @stable ICU 3.2 + */ + UTSV_TO_MIN_VALUE=4, + + /** + * The constant used to select the maximum to value + * for a time scale. + * + * @see utmscale_getTimeScaleValue + * + * @stable ICU 3.2 + */ + UTSV_TO_MAX_VALUE=5, + +#ifndef U_HIDE_INTERNAL_API + /** + * The constant used to select the epoch plus one value + * for a time scale. + * + * NOTE: This is an internal value. DO NOT USE IT. May not + * actually be equal to the epoch offset value plus one. + * + * @see utmscale_getTimeScaleValue + * + * @internal ICU 3.2 + */ + UTSV_EPOCH_OFFSET_PLUS_1_VALUE=6, + + /** + * The constant used to select the epoch plus one value + * for a time scale. + * + * NOTE: This is an internal value. DO NOT USE IT. May not + * actually be equal to the epoch offset value plus one. + * + * @see utmscale_getTimeScaleValue + * + * @internal ICU 3.2 + */ + UTSV_EPOCH_OFFSET_MINUS_1_VALUE=7, + + /** + * The constant used to select the units round value + * for a time scale. + * + * NOTE: This is an internal value. DO NOT USE IT. + * + * @see utmscale_getTimeScaleValue + * + * @internal ICU 3.2 + */ + UTSV_UNITS_ROUND_VALUE=8, + + /** + * The constant used to select the minimum safe rounding value + * for a time scale. + * + * NOTE: This is an internal value. DO NOT USE IT. + * + * @see utmscale_getTimeScaleValue + * + * @internal ICU 3.2 + */ + UTSV_MIN_ROUND_VALUE=9, + + /** + * The constant used to select the maximum safe rounding value + * for a time scale. + * + * NOTE: This is an internal value. DO NOT USE IT. + * + * @see utmscale_getTimeScaleValue + * + * @internal ICU 3.2 + */ + UTSV_MAX_ROUND_VALUE=10, + +#endif /* U_HIDE_INTERNAL_API */ + +#ifndef U_HIDE_DEPRECATED_API + /** + * The number of time scale values, in other words limit of this enum. + * + * @see utmscale_getTimeScaleValue + * @deprecated ICU 59 The numeric value may change over time, see ICU ticket #12420. + */ + UTSV_MAX_SCALE_VALUE=11 +#endif /* U_HIDE_DEPRECATED_API */ + +} UTimeScaleValue; + +/** + * Get a value associated with a particular time scale. + * + * @param timeScale The time scale + * @param value A constant representing the value to get + * @param status The status code. Set to U_ILLEGAL_ARGUMENT_ERROR if arguments are invalid. + * @return - the value. + * + * @stable ICU 3.2 + */ +U_STABLE int64_t U_EXPORT2 + utmscale_getTimeScaleValue(UDateTimeScale timeScale, UTimeScaleValue value, UErrorCode *status); + +/* Conversion to 'universal time scale' */ + +/** + * Convert a int64_t datetime from the given time scale to the universal time scale. + * + * @param otherTime The int64_t datetime + * @param timeScale The time scale to convert from + * @param status The status code. Set to U_ILLEGAL_ARGUMENT_ERROR if the conversion is out of range. + * + * @return The datetime converted to the universal time scale + * + * @stable ICU 3.2 + */ +U_STABLE int64_t U_EXPORT2 + utmscale_fromInt64(int64_t otherTime, UDateTimeScale timeScale, UErrorCode *status); + +/* Conversion from 'universal time scale' */ + +/** + * Convert a datetime from the universal time scale to a int64_t in the given time scale. + * + * @param universalTime The datetime in the universal time scale + * @param timeScale The time scale to convert to + * @param status The status code. Set to U_ILLEGAL_ARGUMENT_ERROR if the conversion is out of range. + * + * @return The datetime converted to the given time scale + * + * @stable ICU 3.2 + */ +U_STABLE int64_t U_EXPORT2 + utmscale_toInt64(int64_t universalTime, UDateTimeScale timeScale, UErrorCode *status); + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif + diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/utrace.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/utrace.h new file mode 100644 index 0000000..6b4c4df --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/utrace.h @@ -0,0 +1,379 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 2003-2013, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: utrace.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 2003aug06 +* created by: Markus W. Scherer +* +* Definitions for ICU tracing/logging. +* +*/ + +#ifndef __UTRACE_H__ +#define __UTRACE_H__ + +#include +#include "unicode/utypes.h" + +/** + * \file + * \brief C API: Definitions for ICU tracing/logging. + * + * This provides API for debugging the internals of ICU without the use of + * a traditional debugger. + * + * By default, tracing is disabled in ICU. If you need to debug ICU with + * tracing, please compile ICU with the --enable-tracing configure option. + */ + +U_CDECL_BEGIN + +/** + * Trace severity levels. Higher levels increase the verbosity of the trace output. + * @see utrace_setLevel + * @stable ICU 2.8 + */ +typedef enum UTraceLevel { + /** Disable all tracing @stable ICU 2.8*/ + UTRACE_OFF=-1, + /** Trace error conditions only @stable ICU 2.8*/ + UTRACE_ERROR=0, + /** Trace errors and warnings @stable ICU 2.8*/ + UTRACE_WARNING=3, + /** Trace opens and closes of ICU services @stable ICU 2.8*/ + UTRACE_OPEN_CLOSE=5, + /** Trace an intermediate number of ICU operations @stable ICU 2.8*/ + UTRACE_INFO=7, + /** Trace the maximum number of ICU operations @stable ICU 2.8*/ + UTRACE_VERBOSE=9 +} UTraceLevel; + +/** + * These are the ICU functions that will be traced when tracing is enabled. + * @stable ICU 2.8 + */ +typedef enum UTraceFunctionNumber { + UTRACE_FUNCTION_START=0, + UTRACE_U_INIT=UTRACE_FUNCTION_START, + UTRACE_U_CLEANUP, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal collation trace location. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UTRACE_FUNCTION_LIMIT, +#endif // U_HIDE_DEPRECATED_API + + UTRACE_CONVERSION_START=0x1000, + UTRACE_UCNV_OPEN=UTRACE_CONVERSION_START, + UTRACE_UCNV_OPEN_PACKAGE, + UTRACE_UCNV_OPEN_ALGORITHMIC, + UTRACE_UCNV_CLONE, + UTRACE_UCNV_CLOSE, + UTRACE_UCNV_FLUSH_CACHE, + UTRACE_UCNV_LOAD, + UTRACE_UCNV_UNLOAD, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal collation trace location. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UTRACE_CONVERSION_LIMIT, +#endif // U_HIDE_DEPRECATED_API + + UTRACE_COLLATION_START=0x2000, + UTRACE_UCOL_OPEN=UTRACE_COLLATION_START, + UTRACE_UCOL_CLOSE, + UTRACE_UCOL_STRCOLL, + UTRACE_UCOL_GET_SORTKEY, + UTRACE_UCOL_GETLOCALE, + UTRACE_UCOL_NEXTSORTKEYPART, + UTRACE_UCOL_STRCOLLITER, + UTRACE_UCOL_OPEN_FROM_SHORT_STRING, + UTRACE_UCOL_STRCOLLUTF8, /**< @stable ICU 50 */ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal collation trace location. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + UTRACE_COLLATION_LIMIT +#endif // U_HIDE_DEPRECATED_API +} UTraceFunctionNumber; + +/** + * Setter for the trace level. + * @param traceLevel A UTraceLevel value. + * @stable ICU 2.8 + */ +U_STABLE void U_EXPORT2 +utrace_setLevel(int32_t traceLevel); + +/** + * Getter for the trace level. + * @return The UTraceLevel value being used by ICU. + * @stable ICU 2.8 + */ +U_STABLE int32_t U_EXPORT2 +utrace_getLevel(void); + +/* Trace function pointers types ----------------------------- */ + +/** + * Type signature for the trace function to be called when entering a function. + * @param context value supplied at the time the trace functions are set. + * @param fnNumber Enum value indicating the ICU function being entered. + * @stable ICU 2.8 + */ +typedef void U_CALLCONV +UTraceEntry(const void *context, int32_t fnNumber); + +/** + * Type signature for the trace function to be called when exiting from a function. + * @param context value supplied at the time the trace functions are set. + * @param fnNumber Enum value indicating the ICU function being exited. + * @param fmt A formatting string that describes the number and types + * of arguments included with the variable args. The fmt + * string has the same form as the utrace_vformat format + * string. + * @param args A variable arguments list. Contents are described by + * the fmt parameter. + * @see utrace_vformat + * @stable ICU 2.8 + */ +typedef void U_CALLCONV +UTraceExit(const void *context, int32_t fnNumber, + const char *fmt, va_list args); + +/** + * Type signature for the trace function to be called from within an ICU function + * to display data or messages. + * @param context value supplied at the time the trace functions are set. + * @param fnNumber Enum value indicating the ICU function being exited. + * @param level The current tracing level + * @param fmt A format string describing the tracing data that is supplied + * as variable args + * @param args The data being traced, passed as variable args. + * @stable ICU 2.8 + */ +typedef void U_CALLCONV +UTraceData(const void *context, int32_t fnNumber, int32_t level, + const char *fmt, va_list args); + +/** + * Set ICU Tracing functions. Installs application-provided tracing + * functions into ICU. After doing this, subsequent ICU operations + * will call back to the installed functions, providing a trace + * of the use of ICU. Passing a NULL pointer for a tracing function + * is allowed, and inhibits tracing action at points where that function + * would be called. + *

+ * Tracing and Threads: Tracing functions are global to a process, and + * will be called in response to ICU operations performed by any + * thread. If tracing of an individual thread is desired, the + * tracing functions must themselves filter by checking that the + * current thread is the desired thread. + * + * @param context an uninterpretted pointer. Whatever is passed in + * here will in turn be passed to each of the tracing + * functions UTraceEntry, UTraceExit and UTraceData. + * ICU does not use or alter this pointer. + * @param e Callback function to be called on entry to a + * a traced ICU function. + * @param x Callback function to be called on exit from a + * traced ICU function. + * @param d Callback function to be called from within a + * traced ICU function, for the purpose of providing + * data to the trace. + * + * @stable ICU 2.8 + */ +U_STABLE void U_EXPORT2 +utrace_setFunctions(const void *context, + UTraceEntry *e, UTraceExit *x, UTraceData *d); + +/** + * Get the currently installed ICU tracing functions. Note that a null function + * pointer will be returned if no trace function has been set. + * + * @param context The currently installed tracing context. + * @param e The currently installed UTraceEntry function. + * @param x The currently installed UTraceExit function. + * @param d The currently installed UTraceData function. + * @stable ICU 2.8 + */ +U_STABLE void U_EXPORT2 +utrace_getFunctions(const void **context, + UTraceEntry **e, UTraceExit **x, UTraceData **d); + + + +/* + * + * ICU trace format string syntax + * + * Format Strings are passed to UTraceData functions, and define the + * number and types of the trace data being passed on each call. + * + * The UTraceData function, which is supplied by the application, + * not by ICU, can either forward the trace data (passed via + * varargs) and the format string back to ICU for formatting into + * a displayable string, or it can interpret the format itself, + * and do as it wishes with the trace data. + * + * + * Goals for the format string + * - basic data output + * - easy to use for trace programmer + * - sufficient provision for data types for trace output readability + * - well-defined types and binary portable APIs + * + * Non-goals + * - printf compatibility + * - fancy formatting + * - argument reordering and other internationalization features + * + * ICU trace format strings contain plain text with argument inserts, + * much like standard printf format strings. + * Each insert begins with a '%', then optionally contains a 'v', + * then exactly one type character. + * Two '%' in a row represent a '%' instead of an insert. + * The trace format strings need not have \n at the end. + * + * + * Types + * ----- + * + * Type characters: + * - c A char character in the default codepage. + * - s A NUL-terminated char * string in the default codepage. + * - S A UChar * string. Requires two params, (ptr, length). Length=-1 for nul term. + * - b A byte (8-bit integer). + * - h A 16-bit integer. Also a 16 bit Unicode code unit. + * - d A 32-bit integer. Also a 20 bit Unicode code point value. + * - l A 64-bit integer. + * - p A data pointer. + * + * Vectors + * ------- + * + * If the 'v' is not specified, then one item of the specified type + * is passed in. + * If the 'v' (for "vector") is specified, then a vector of items of the + * specified type is passed in, via a pointer to the first item + * and an int32_t value for the length of the vector. + * Length==-1 means zero or NUL termination. Works for vectors of all types. + * + * Note: %vS is a vector of (UChar *) strings. The strings must + * be nul terminated as there is no way to provide a + * separate length parameter for each string. The length + * parameter (required for all vectors) is the number of + * strings, not the length of the strings. + * + * Examples + * -------- + * + * These examples show the parameters that will be passed to an application's + * UTraceData() function for various formats. + * + * - the precise formatting is up to the application! + * - the examples use type casts for arguments only to _show_ the types of + * arguments without needing variable declarations in the examples; + * the type casts will not be necessary in actual code + * + * UTraceDataFunc(context, fnNumber, level, + * "There is a character %c in the string %s.", // Format String + * (char)c, (const char *)s); // varargs parameters + * -> There is a character 0x42 'B' in the string "Bravo". + * + * UTraceDataFunc(context, fnNumber, level, + * "Vector of bytes %vb vector of chars %vc", + * (const uint8_t *)bytes, (int32_t)bytesLength, + * (const char *)chars, (int32_t)charsLength); + * -> Vector of bytes + * 42 63 64 3f [4] + * vector of chars + * "Bcd?"[4] + * + * UTraceDataFunc(context, fnNumber, level, + * "An int32_t %d and a whole bunch of them %vd", + * (int32_t)-5, (const int32_t *)ints, (int32_t)intsLength); + * -> An int32_t 0xfffffffb and a whole bunch of them + * fffffffb 00000005 0000010a [3] + * + */ + + + +/** + * Trace output Formatter. An application's UTraceData tracing functions may call + * back to this function to format the trace output in a + * human readable form. Note that a UTraceData function may choose + * to not format the data; it could, for example, save it in + * in the raw form it was received (more compact), leaving + * formatting for a later trace analyis tool. + * @param outBuf pointer to a buffer to receive the formatted output. Output + * will be nul terminated if there is space in the buffer - + * if the length of the requested output < the output buffer size. + * @param capacity Length of the output buffer. + * @param indent Number of spaces to indent the output. Intended to allow + * data displayed from nested functions to be indented for readability. + * @param fmt Format specification for the data to output + * @param args Data to be formatted. + * @return Length of formatted output, including the terminating NUL. + * If buffer capacity is insufficient, the required capacity is returned. + * @stable ICU 2.8 + */ +U_STABLE int32_t U_EXPORT2 +utrace_vformat(char *outBuf, int32_t capacity, + int32_t indent, const char *fmt, va_list args); + +/** + * Trace output Formatter. An application's UTraceData tracing functions may call + * this function to format any additional trace data, beyond that + * provided by default, in human readable form with the same + * formatting conventions used by utrace_vformat(). + * @param outBuf pointer to a buffer to receive the formatted output. Output + * will be nul terminated if there is space in the buffer - + * if the length of the requested output < the output buffer size. + * @param capacity Length of the output buffer. + * @param indent Number of spaces to indent the output. Intended to allow + * data displayed from nested functions to be indented for readability. + * @param fmt Format specification for the data to output + * @param ... Data to be formatted. + * @return Length of formatted output, including the terminating NUL. + * If buffer capacity is insufficient, the required capacity is returned. + * @stable ICU 2.8 + */ +U_STABLE int32_t U_EXPORT2 +utrace_format(char *outBuf, int32_t capacity, + int32_t indent, const char *fmt, ...); + + + +/* Trace function numbers --------------------------------------------------- */ + +/** + * Get the name of a function from its trace function number. + * + * @param fnNumber The trace number for an ICU function. + * @return The name string for the function. + * + * @see UTraceFunctionNumber + * @stable ICU 2.8 + */ +U_STABLE const char * U_EXPORT2 +utrace_functionName(int32_t fnNumber); + +U_CDECL_END + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/utrans.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/utrans.h new file mode 100644 index 0000000..d0f05cf --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/utrans.h @@ -0,0 +1,658 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 1997-2011,2014-2015 International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* Date Name Description +* 06/21/00 aliu Creation. +******************************************************************************* +*/ + +#ifndef UTRANS_H +#define UTRANS_H + +#include "unicode/utypes.h" + +#if !UCONFIG_NO_TRANSLITERATION + +#include "unicode/localpointer.h" +#include "unicode/urep.h" +#include "unicode/parseerr.h" +#include "unicode/uenum.h" +#include "unicode/uset.h" + +/******************************************************************** + * General Notes + ******************************************************************** + */ +/** + * \file + * \brief C API: Transliterator + * + *

Transliteration

+ * The data structures and functions described in this header provide + * transliteration services. Transliteration services are implemented + * as C++ classes. The comments and documentation in this header + * assume the reader is familiar with the C++ headers translit.h and + * associated documentation. + * + * A significant but incomplete subset of the C++ transliteration + * services are available to C code through this header. In order to + * access more complex transliteration services, refer to the C++ + * headers and documentation. + * + * There are two sets of functions for working with transliterator IDs: + * + * An old, deprecated set uses char * IDs, which works for true and pure + * identifiers that these APIs were designed for, + * for example "Cyrillic-Latin". + * It does not work when the ID contains filters ("[:Script=Cyrl:]") + * or even a complete set of rules because then the ID string contains more + * than just "invariant" characters (see utypes.h). + * + * A new set of functions replaces the old ones and uses UChar * IDs, + * paralleling the UnicodeString IDs in the C++ API. (New in ICU 2.8.) + */ + +/******************************************************************** + * Data Structures + ********************************************************************/ + +/** + * An opaque transliterator for use in C. Open with utrans_openxxx() + * and close with utrans_close() when done. Equivalent to the C++ class + * Transliterator and its subclasses. + * @see Transliterator + * @stable ICU 2.0 + */ +typedef void* UTransliterator; + +/** + * Direction constant indicating the direction in a transliterator, + * e.g., the forward or reverse rules of a RuleBasedTransliterator. + * Specified when a transliterator is opened. An "A-B" transliterator + * transliterates A to B when operating in the forward direction, and + * B to A when operating in the reverse direction. + * @stable ICU 2.0 + */ +typedef enum UTransDirection { + + /** + * UTRANS_FORWARD means from <source> to <target> for a + * transliterator with ID <source>-<target>. For a transliterator + * opened using a rule, it means forward direction rules, e.g., + * "A > B". + */ + UTRANS_FORWARD, + + /** + * UTRANS_REVERSE means from <target> to <source> for a + * transliterator with ID <source>-<target>. For a transliterator + * opened using a rule, it means reverse direction rules, e.g., + * "A < B". + */ + UTRANS_REVERSE + +} UTransDirection; + +/** + * Position structure for utrans_transIncremental() incremental + * transliteration. This structure defines two substrings of the text + * being transliterated. The first region, [contextStart, + * contextLimit), defines what characters the transliterator will read + * as context. The second region, [start, limit), defines what + * characters will actually be transliterated. The second region + * should be a subset of the first. + * + *

After a transliteration operation, some of the indices in this + * structure will be modified. See the field descriptions for + * details. + * + *

contextStart <= start <= limit <= contextLimit + * + *

Note: All index values in this structure must be at code point + * boundaries. That is, none of them may occur between two code units + * of a surrogate pair. If any index does split a surrogate pair, + * results are unspecified. + * + * @stable ICU 2.0 + */ +typedef struct UTransPosition { + + /** + * Beginning index, inclusive, of the context to be considered for + * a transliteration operation. The transliterator will ignore + * anything before this index. INPUT/OUTPUT parameter: This parameter + * is updated by a transliteration operation to reflect the maximum + * amount of antecontext needed by a transliterator. + * @stable ICU 2.4 + */ + int32_t contextStart; + + /** + * Ending index, exclusive, of the context to be considered for a + * transliteration operation. The transliterator will ignore + * anything at or after this index. INPUT/OUTPUT parameter: This + * parameter is updated to reflect changes in the length of the + * text, but points to the same logical position in the text. + * @stable ICU 2.4 + */ + int32_t contextLimit; + + /** + * Beginning index, inclusive, of the text to be transliteratd. + * INPUT/OUTPUT parameter: This parameter is advanced past + * characters that have already been transliterated by a + * transliteration operation. + * @stable ICU 2.4 + */ + int32_t start; + + /** + * Ending index, exclusive, of the text to be transliteratd. + * INPUT/OUTPUT parameter: This parameter is updated to reflect + * changes in the length of the text, but points to the same + * logical position in the text. + * @stable ICU 2.4 + */ + int32_t limit; + +} UTransPosition; + +/******************************************************************** + * General API + ********************************************************************/ + +/** + * Open a custom transliterator, given a custom rules string + * OR + * a system transliterator, given its ID. + * Any non-NULL result from this function should later be closed with + * utrans_close(). + * + * @param id a valid transliterator ID + * @param idLength the length of the ID string, or -1 if NUL-terminated + * @param dir the desired direction + * @param rules the transliterator rules. See the C++ header rbt.h for + * rules syntax. If NULL then a system transliterator matching + * the ID is returned. + * @param rulesLength the length of the rules, or -1 if the rules + * are NUL-terminated. + * @param parseError a pointer to a UParseError struct to receive the details + * of any parsing errors. This parameter may be NULL if no + * parsing error details are desired. + * @param pErrorCode a pointer to the UErrorCode + * @return a transliterator pointer that may be passed to other + * utrans_xxx() functions, or NULL if the open call fails. + * @stable ICU 2.8 + */ +U_STABLE UTransliterator* U_EXPORT2 +utrans_openU(const UChar *id, + int32_t idLength, + UTransDirection dir, + const UChar *rules, + int32_t rulesLength, + UParseError *parseError, + UErrorCode *pErrorCode); + +/** + * Open an inverse of an existing transliterator. For this to work, + * the inverse must be registered with the system. For example, if + * the Transliterator "A-B" is opened, and then its inverse is opened, + * the result is the Transliterator "B-A", if such a transliterator is + * registered with the system. Otherwise the result is NULL and a + * failing UErrorCode is set. Any non-NULL result from this function + * should later be closed with utrans_close(). + * + * @param trans the transliterator to open the inverse of. + * @param status a pointer to the UErrorCode + * @return a pointer to a newly-opened transliterator that is the + * inverse of trans, or NULL if the open call fails. + * @stable ICU 2.0 + */ +U_STABLE UTransliterator* U_EXPORT2 +utrans_openInverse(const UTransliterator* trans, + UErrorCode* status); + +/** + * Create a copy of a transliterator. Any non-NULL result from this + * function should later be closed with utrans_close(). + * + * @param trans the transliterator to be copied. + * @param status a pointer to the UErrorCode + * @return a transliterator pointer that may be passed to other + * utrans_xxx() functions, or NULL if the clone call fails. + * @stable ICU 2.0 + */ +U_STABLE UTransliterator* U_EXPORT2 +utrans_clone(const UTransliterator* trans, + UErrorCode* status); + +/** + * Close a transliterator. Any non-NULL pointer returned by + * utrans_openXxx() or utrans_clone() should eventually be closed. + * @param trans the transliterator to be closed. + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +utrans_close(UTransliterator* trans); + +#if U_SHOW_CPLUSPLUS_API + +U_NAMESPACE_BEGIN + +/** + * \class LocalUTransliteratorPointer + * "Smart pointer" class, closes a UTransliterator via utrans_close(). + * For most methods see the LocalPointerBase base class. + * + * @see LocalPointerBase + * @see LocalPointer + * @stable ICU 4.4 + */ +U_DEFINE_LOCAL_OPEN_POINTER(LocalUTransliteratorPointer, UTransliterator, utrans_close); + +U_NAMESPACE_END + +#endif + +/** + * Return the programmatic identifier for this transliterator. + * If this identifier is passed to utrans_openU(), it will open + * a transliterator equivalent to this one, if the ID has been + * registered. + * + * @param trans the transliterator to return the ID of. + * @param resultLength pointer to an output variable receiving the length + * of the ID string; can be NULL + * @return the NUL-terminated ID string. This pointer remains + * valid until utrans_close() is called on this transliterator. + * + * @stable ICU 2.8 + */ +U_STABLE const UChar * U_EXPORT2 +utrans_getUnicodeID(const UTransliterator *trans, + int32_t *resultLength); + +/** + * Register an open transliterator with the system. When + * utrans_open() is called with an ID string that is equal to that + * returned by utrans_getID(adoptedTrans,...), then + * utrans_clone(adoptedTrans,...) is returned. + * + *

NOTE: After this call the system owns the adoptedTrans and will + * close it. The user must not call utrans_close() on adoptedTrans. + * + * @param adoptedTrans a transliterator, typically the result of + * utrans_openRules(), to be registered with the system. + * @param status a pointer to the UErrorCode + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +utrans_register(UTransliterator* adoptedTrans, + UErrorCode* status); + +/** + * Unregister a transliterator from the system. After this call the + * system will no longer recognize the given ID when passed to + * utrans_open(). If the ID is invalid then nothing is done. + * + * @param id an ID to unregister + * @param idLength the length of id, or -1 if id is zero-terminated + * @stable ICU 2.8 + */ +U_STABLE void U_EXPORT2 +utrans_unregisterID(const UChar* id, int32_t idLength); + +/** + * Set the filter used by a transliterator. A filter can be used to + * make the transliterator pass certain characters through untouched. + * The filter is expressed using a UnicodeSet pattern. If the + * filterPattern is NULL or the empty string, then the transliterator + * will be reset to use no filter. + * + * @param trans the transliterator + * @param filterPattern a pattern string, in the form accepted by + * UnicodeSet, specifying which characters to apply the + * transliteration to. May be NULL or the empty string to indicate no + * filter. + * @param filterPatternLen the length of filterPattern, or -1 if + * filterPattern is zero-terminated + * @param status a pointer to the UErrorCode + * @see UnicodeSet + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +utrans_setFilter(UTransliterator* trans, + const UChar* filterPattern, + int32_t filterPatternLen, + UErrorCode* status); + +/** + * Return the number of system transliterators. + * It is recommended to use utrans_openIDs() instead. + * + * @return the number of system transliterators. + * @stable ICU 2.0 + */ +U_STABLE int32_t U_EXPORT2 +utrans_countAvailableIDs(void); + +/** + * Return a UEnumeration for the available transliterators. + * + * @param pErrorCode Pointer to the UErrorCode in/out parameter. + * @return UEnumeration for the available transliterators. + * Close with uenum_close(). + * + * @stable ICU 2.8 + */ +U_STABLE UEnumeration * U_EXPORT2 +utrans_openIDs(UErrorCode *pErrorCode); + +/******************************************************************** + * Transliteration API + ********************************************************************/ + +/** + * Transliterate a segment of a UReplaceable string. The string is + * passed in as a UReplaceable pointer rep and a UReplaceableCallbacks + * function pointer struct repFunc. Functions in the repFunc struct + * will be called in order to modify the rep string. + * + * @param trans the transliterator + * @param rep a pointer to the string. This will be passed to the + * repFunc functions. + * @param repFunc a set of function pointers that will be used to + * modify the string pointed to by rep. + * @param start the beginning index, inclusive; 0 <= start <= + * limit. + * @param limit pointer to the ending index, exclusive; start <= + * limit <= repFunc->length(rep). Upon return, *limit will + * contain the new limit index. The text previously occupying + * [start, limit) has been transliterated, possibly to a + * string of a different length, at [start, + * new-limit), where new-limit + * is the return value. + * @param status a pointer to the UErrorCode + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +utrans_trans(const UTransliterator* trans, + UReplaceable* rep, + UReplaceableCallbacks* repFunc, + int32_t start, + int32_t* limit, + UErrorCode* status); + +/** + * Transliterate the portion of the UReplaceable text buffer that can + * be transliterated unambiguosly. This method is typically called + * after new text has been inserted, e.g. as a result of a keyboard + * event. The transliterator will try to transliterate characters of + * rep between index.cursor and + * index.limit. Characters before + * index.cursor will not be changed. + * + *

Upon return, values in index will be updated. + * index.start will be advanced to the first + * character that future calls to this method will read. + * index.cursor and index.limit will + * be adjusted to delimit the range of text that future calls to + * this method may change. + * + *

Typical usage of this method begins with an initial call + * with index.start and index.limit + * set to indicate the portion of text to be + * transliterated, and index.cursor == index.start. + * Thereafter, index can be used without + * modification in future calls, provided that all changes to + * text are made via this method. + * + *

This method assumes that future calls may be made that will + * insert new text into the buffer. As a result, it only performs + * unambiguous transliterations. After the last call to this method, + * there may be untransliterated text that is waiting for more input + * to resolve an ambiguity. In order to perform these pending + * transliterations, clients should call utrans_trans() with a start + * of index.start and a limit of index.end after the last call to this + * method has been made. + * + * @param trans the transliterator + * @param rep a pointer to the string. This will be passed to the + * repFunc functions. + * @param repFunc a set of function pointers that will be used to + * modify the string pointed to by rep. + * @param pos a struct containing the start and limit indices of the + * text to be read and the text to be transliterated + * @param status a pointer to the UErrorCode + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +utrans_transIncremental(const UTransliterator* trans, + UReplaceable* rep, + UReplaceableCallbacks* repFunc, + UTransPosition* pos, + UErrorCode* status); + +/** + * Transliterate a segment of a UChar* string. The string is passed + * in in a UChar* buffer. The string is modified in place. If the + * result is longer than textCapacity, it is truncated. The actual + * length of the result is returned in *textLength, if textLength is + * non-NULL. *textLength may be greater than textCapacity, but only + * textCapacity UChars will be written to *text, including the zero + * terminator. + * + * @param trans the transliterator + * @param text a pointer to a buffer containing the text to be + * transliterated on input and the result text on output. + * @param textLength a pointer to the length of the string in text. + * If the length is -1 then the string is assumed to be + * zero-terminated. Upon return, the new length is stored in + * *textLength. If textLength is NULL then the string is assumed to + * be zero-terminated. + * @param textCapacity a pointer to the length of the text buffer. + * Upon return, + * @param start the beginning index, inclusive; 0 <= start <= + * limit. + * @param limit pointer to the ending index, exclusive; start <= + * limit <= repFunc->length(rep). Upon return, *limit will + * contain the new limit index. The text previously occupying + * [start, limit) has been transliterated, possibly to a + * string of a different length, at [start, + * new-limit), where new-limit + * is the return value. + * @param status a pointer to the UErrorCode + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +utrans_transUChars(const UTransliterator* trans, + UChar* text, + int32_t* textLength, + int32_t textCapacity, + int32_t start, + int32_t* limit, + UErrorCode* status); + +/** + * Transliterate the portion of the UChar* text buffer that can be + * transliterated unambiguosly. See utrans_transIncremental(). The + * string is passed in in a UChar* buffer. The string is modified in + * place. If the result is longer than textCapacity, it is truncated. + * The actual length of the result is returned in *textLength, if + * textLength is non-NULL. *textLength may be greater than + * textCapacity, but only textCapacity UChars will be written to + * *text, including the zero terminator. See utrans_transIncremental() + * for usage details. + * + * @param trans the transliterator + * @param text a pointer to a buffer containing the text to be + * transliterated on input and the result text on output. + * @param textLength a pointer to the length of the string in text. + * If the length is -1 then the string is assumed to be + * zero-terminated. Upon return, the new length is stored in + * *textLength. If textLength is NULL then the string is assumed to + * be zero-terminated. + * @param textCapacity the length of the text buffer + * @param pos a struct containing the start and limit indices of the + * text to be read and the text to be transliterated + * @param status a pointer to the UErrorCode + * @see utrans_transIncremental + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +utrans_transIncrementalUChars(const UTransliterator* trans, + UChar* text, + int32_t* textLength, + int32_t textCapacity, + UTransPosition* pos, + UErrorCode* status); + +/** + * Create a rule string that can be passed to utrans_openU to recreate this + * transliterator. + * + * @param trans The transliterator + * @param escapeUnprintable if TRUE then convert unprintable characters to their + * hex escape representations, \\uxxxx or \\Uxxxxxxxx. + * Unprintable characters are those other than + * U+000A, U+0020..U+007E. + * @param result A pointer to a buffer to receive the rules. + * @param resultLength The maximum size of result. + * @param status A pointer to the UErrorCode. In case of error status, the + * contents of result are undefined. + * @return int32_t The length of the rule string (may be greater than resultLength, + * in which case an error is returned). + * @stable ICU 53 + */ +U_STABLE int32_t U_EXPORT2 +utrans_toRules( const UTransliterator* trans, + UBool escapeUnprintable, + UChar* result, int32_t resultLength, + UErrorCode* status); + +/** + * Returns the set of all characters that may be modified in the input text by + * this UTransliterator, optionally ignoring the transliterator's current filter. + * @param trans The transliterator. + * @param ignoreFilter If FALSE, the returned set incorporates the + * UTransliterator's current filter; if the filter is changed, + * the return value of this function will change. If TRUE, the + * returned set ignores the effect of the UTransliterator's + * current filter. + * @param fillIn Pointer to a USet object to receive the modifiable characters + * set. Previous contents of fillIn are lost. If fillIn is + * NULL, then a new USet is created and returned. The caller + * owns the result and must dispose of it by calling uset_close. + * @param status A pointer to the UErrorCode. + * @return USet* Either fillIn, or if fillIn is NULL, a pointer to a + * newly-allocated USet that the user must close. In case of + * error, NULL is returned. + * @stable ICU 53 + */ +U_STABLE USet* U_EXPORT2 +utrans_getSourceSet(const UTransliterator* trans, + UBool ignoreFilter, + USet* fillIn, + UErrorCode* status); + +/* deprecated API ----------------------------------------------------------- */ + +#ifndef U_HIDE_DEPRECATED_API + +/* see utrans.h documentation for why these functions are deprecated */ + +/** + * Deprecated, use utrans_openU() instead. + * Open a custom transliterator, given a custom rules string + * OR + * a system transliterator, given its ID. + * Any non-NULL result from this function should later be closed with + * utrans_close(). + * + * @param id a valid ID, as returned by utrans_getAvailableID() + * @param dir the desired direction + * @param rules the transliterator rules. See the C++ header rbt.h + * for rules syntax. If NULL then a system transliterator matching + * the ID is returned. + * @param rulesLength the length of the rules, or -1 if the rules + * are zero-terminated. + * @param parseError a pointer to a UParseError struct to receive the + * details of any parsing errors. This parameter may be NULL if no + * parsing error details are desired. + * @param status a pointer to the UErrorCode + * @return a transliterator pointer that may be passed to other + * utrans_xxx() functions, or NULL if the open call fails. + * @deprecated ICU 2.8 Use utrans_openU() instead, see utrans.h + */ +U_DEPRECATED UTransliterator* U_EXPORT2 +utrans_open(const char* id, + UTransDirection dir, + const UChar* rules, /* may be Null */ + int32_t rulesLength, /* -1 if null-terminated */ + UParseError* parseError, /* may be Null */ + UErrorCode* status); + +/** + * Deprecated, use utrans_getUnicodeID() instead. + * Return the programmatic identifier for this transliterator. + * If this identifier is passed to utrans_open(), it will open + * a transliterator equivalent to this one, if the ID has been + * registered. + * @param trans the transliterator to return the ID of. + * @param buf the buffer in which to receive the ID. This may be + * NULL, in which case no characters are copied. + * @param bufCapacity the capacity of the buffer. Ignored if buf is + * NULL. + * @return the actual length of the ID, not including + * zero-termination. This may be greater than bufCapacity. + * @deprecated ICU 2.8 Use utrans_getUnicodeID() instead, see utrans.h + */ +U_DEPRECATED int32_t U_EXPORT2 +utrans_getID(const UTransliterator* trans, + char* buf, + int32_t bufCapacity); + +/** + * Deprecated, use utrans_unregisterID() instead. + * Unregister a transliterator from the system. After this call the + * system will no longer recognize the given ID when passed to + * utrans_open(). If the id is invalid then nothing is done. + * + * @param id a zero-terminated ID + * @deprecated ICU 2.8 Use utrans_unregisterID() instead, see utrans.h + */ +U_DEPRECATED void U_EXPORT2 +utrans_unregister(const char* id); + +/** + * Deprecated, use utrans_openIDs() instead. + * Return the ID of the index-th system transliterator. The result + * is placed in the given buffer. If the given buffer is too small, + * the initial substring is copied to buf. The result in buf is + * always zero-terminated. + * + * @param index the number of the transliterator to return. Must + * satisfy 0 <= index < utrans_countAvailableIDs(). If index is out + * of range then it is treated as if it were 0. + * @param buf the buffer in which to receive the ID. This may be + * NULL, in which case no characters are copied. + * @param bufCapacity the capacity of the buffer. Ignored if buf is + * NULL. + * @return the actual length of the index-th ID, not including + * zero-termination. This may be greater than bufCapacity. + * @deprecated ICU 2.8 Use utrans_openIDs() instead, see utrans.h + */ +U_DEPRECATED int32_t U_EXPORT2 +utrans_getAvailableID(int32_t index, + char* buf, + int32_t bufCapacity); + +#endif /* U_HIDE_DEPRECATED_API */ + +#endif /* #if !UCONFIG_NO_TRANSLITERATION */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/utypes.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/utypes.h new file mode 100644 index 0000000..d60450b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/utypes.h @@ -0,0 +1,701 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +********************************************************************** +* Copyright (C) 1996-2016, International Business Machines +* Corporation and others. All Rights Reserved. +********************************************************************** +* +* FILE NAME : UTYPES.H (formerly ptypes.h) +* +* Date Name Description +* 12/11/96 helena Creation. +* 02/27/97 aliu Added typedefs for UClassID, int8, int16, int32, +* uint8, uint16, and uint32. +* 04/01/97 aliu Added XP_CPLUSPLUS and modified to work under C as +* well as C++. +* Modified to use memcpy() for uprv_arrayCopy() fns. +* 04/14/97 aliu Added TPlatformUtilities. +* 05/07/97 aliu Added import/export specifiers (replacing the old +* broken EXT_CLASS). Added version number for our +* code. Cleaned up header. +* 6/20/97 helena Java class name change. +* 08/11/98 stephen UErrorCode changed from typedef to enum +* 08/12/98 erm Changed T_ANALYTIC_PACKAGE_VERSION to 3 +* 08/14/98 stephen Added uprv_arrayCopy() for int8_t, int16_t, int32_t +* 12/09/98 jfitz Added BUFFER_OVERFLOW_ERROR (bug 1100066) +* 04/20/99 stephen Cleaned up & reworked for autoconf. +* Renamed to utypes.h. +* 05/05/99 stephen Changed to use +* 12/07/99 helena Moved copyright notice string from ucnv_bld.h here. +******************************************************************************* +*/ + +#ifndef UTYPES_H +#define UTYPES_H + + +#include "unicode/umachine.h" +#include "unicode/uversion.h" +#include "unicode/uconfig.h" +#include + +#if !U_NO_DEFAULT_INCLUDE_UTF_HEADERS +# include "unicode/utf.h" +#endif + +/*! + * \file + * \brief Basic definitions for ICU, for both C and C++ APIs + * + * This file defines basic types, constants, and enumerations directly or + * indirectly by including other header files, especially utf.h for the + * basic character and string definitions and umachine.h for consistent + * integer and other types. + */ + + +/** + * \def U_SHOW_CPLUSPLUS_API + * @internal + */ +#ifdef __cplusplus +# ifndef U_SHOW_CPLUSPLUS_API +# define U_SHOW_CPLUSPLUS_API 1 +# endif +#else +# undef U_SHOW_CPLUSPLUS_API +# define U_SHOW_CPLUSPLUS_API 0 +#endif + +/** @{ API visibility control */ + +/** + * \def U_HIDE_DRAFT_API + * Define this to 1 to request that draft API be "hidden" + * @internal + */ +/** + * \def U_HIDE_INTERNAL_API + * Define this to 1 to request that internal API be "hidden" + * @internal + */ +#if !U_DEFAULT_SHOW_DRAFT && !defined(U_SHOW_DRAFT_API) +#define U_HIDE_DRAFT_API 1 +#endif +#if !U_DEFAULT_SHOW_DRAFT && !defined(U_SHOW_INTERNAL_API) +#define U_HIDE_INTERNAL_API 1 +#endif + +/** @} */ + +/*===========================================================================*/ +/* ICUDATA naming scheme */ +/*===========================================================================*/ + +/** + * \def U_ICUDATA_TYPE_LETTER + * + * This is a platform-dependent string containing one letter: + * - b for big-endian, ASCII-family platforms + * - l for little-endian, ASCII-family platforms + * - e for big-endian, EBCDIC-family platforms + * This letter is part of the common data file name. + * @stable ICU 2.0 + */ + +/** + * \def U_ICUDATA_TYPE_LITLETTER + * The non-string form of U_ICUDATA_TYPE_LETTER + * @stable ICU 2.0 + */ +#if U_CHARSET_FAMILY +# if U_IS_BIG_ENDIAN + /* EBCDIC - should always be BE */ +# define U_ICUDATA_TYPE_LETTER "e" +# define U_ICUDATA_TYPE_LITLETTER e +# else +# error "Don't know what to do with little endian EBCDIC!" +# define U_ICUDATA_TYPE_LETTER "x" +# define U_ICUDATA_TYPE_LITLETTER x +# endif +#else +# if U_IS_BIG_ENDIAN + /* Big-endian ASCII */ +# define U_ICUDATA_TYPE_LETTER "b" +# define U_ICUDATA_TYPE_LITLETTER b +# else + /* Little-endian ASCII */ +# define U_ICUDATA_TYPE_LETTER "l" +# define U_ICUDATA_TYPE_LITLETTER l +# endif +#endif + +/** + * A single string literal containing the icudata stub name. i.e. 'icudt18e' for + * ICU 1.8.x on EBCDIC, etc.. + * @stable ICU 2.0 + */ +#define U_ICUDATA_NAME "icudt" U_ICU_VERSION_SHORT U_ICUDATA_TYPE_LETTER +#ifndef U_HIDE_INTERNAL_API +#define U_USRDATA_NAME "usrdt" U_ICU_VERSION_SHORT U_ICUDATA_TYPE_LETTER /**< @internal */ +#define U_USE_USRDATA 0 /**< @internal */ +#endif /* U_HIDE_INTERNAL_API */ + +/** + * U_ICU_ENTRY_POINT is the name of the DLL entry point to the ICU data library. + * Defined as a literal, not a string. + * Tricky Preprocessor use - ## operator replaces macro paramters with the literal string + * from the corresponding macro invocation, _before_ other macro substitutions. + * Need a nested \#defines to get the actual version numbers rather than + * the literal text U_ICU_VERSION_MAJOR_NUM into the name. + * The net result will be something of the form + * \#define U_ICU_ENTRY_POINT icudt19_dat + * @stable ICU 2.4 + */ +#define U_ICUDATA_ENTRY_POINT U_DEF2_ICUDATA_ENTRY_POINT(U_ICU_VERSION_MAJOR_NUM,U_LIB_SUFFIX_C_NAME) + +#ifndef U_HIDE_INTERNAL_API +/** + * Do not use. Note that it's OK for the 2nd argument to be undefined (literal). + * @internal + */ +#define U_DEF2_ICUDATA_ENTRY_POINT(major,suff) U_DEF_ICUDATA_ENTRY_POINT(major,suff) + +/** + * Do not use. + * @internal + */ +#ifndef U_DEF_ICUDATA_ENTRY_POINT +/* affected by symbol renaming. See platform.h */ +#ifndef U_LIB_SUFFIX_C_NAME +#define U_DEF_ICUDATA_ENTRY_POINT(major, suff) icudt##major##_dat +#else +#define U_DEF_ICUDATA_ENTRY_POINT(major, suff) icudt##suff ## major##_dat +#endif +#endif +#endif /* U_HIDE_INTERNAL_API */ + +/** + * \def NULL + * Define NULL if necessary, to nullptr for C++ and to ((void *)0) for C. + * @stable ICU 2.0 + */ +#ifndef NULL +#ifdef __cplusplus +#define NULL nullptr +#else +#define NULL ((void *)0) +#endif +#endif + +/*===========================================================================*/ +/* Calendar/TimeZone data types */ +/*===========================================================================*/ + +/** + * Date and Time data type. + * This is a primitive data type that holds the date and time + * as the number of milliseconds since 1970-jan-01, 00:00 UTC. + * UTC leap seconds are ignored. + * @stable ICU 2.0 + */ +typedef double UDate; + +/** The number of milliseconds per second @stable ICU 2.0 */ +#define U_MILLIS_PER_SECOND (1000) +/** The number of milliseconds per minute @stable ICU 2.0 */ +#define U_MILLIS_PER_MINUTE (60000) +/** The number of milliseconds per hour @stable ICU 2.0 */ +#define U_MILLIS_PER_HOUR (3600000) +/** The number of milliseconds per day @stable ICU 2.0 */ +#define U_MILLIS_PER_DAY (86400000) + +/** + * Maximum UDate value + * @stable ICU 4.8 + */ +#define U_DATE_MAX DBL_MAX + +/** + * Minimum UDate value + * @stable ICU 4.8 + */ +#define U_DATE_MIN -U_DATE_MAX + +/*===========================================================================*/ +/* Shared library/DLL import-export API control */ +/*===========================================================================*/ + +/* + * Control of symbol import/export. + * ICU is separated into three libraries. + */ + +/** + * \def U_COMBINED_IMPLEMENTATION + * Set to export library symbols from inside the ICU library + * when all of ICU is in a single library. + * This can be set as a compiler option while building ICU, and it + * needs to be the first one tested to override U_COMMON_API, U_I18N_API, etc. + * @stable ICU 2.0 + */ + +/** + * \def U_DATA_API + * Set to export library symbols from inside the stubdata library, + * and to import them from outside. + * @stable ICU 3.0 + */ + +/** + * \def U_COMMON_API + * Set to export library symbols from inside the common library, + * and to import them from outside. + * @stable ICU 2.0 + */ + +/** + * \def U_I18N_API + * Set to export library symbols from inside the i18n library, + * and to import them from outside. + * @stable ICU 2.0 + */ + +/** + * \def U_LAYOUT_API + * Set to export library symbols from inside the layout engine library, + * and to import them from outside. + * @stable ICU 2.0 + */ + +/** + * \def U_LAYOUTEX_API + * Set to export library symbols from inside the layout extensions library, + * and to import them from outside. + * @stable ICU 2.6 + */ + +/** + * \def U_IO_API + * Set to export library symbols from inside the ustdio library, + * and to import them from outside. + * @stable ICU 2.0 + */ + +/** + * \def U_TOOLUTIL_API + * Set to export library symbols from inside the toolutil library, + * and to import them from outside. + * @stable ICU 3.4 + */ + +#if defined(U_COMBINED_IMPLEMENTATION) +#define U_DATA_API U_EXPORT +#define U_COMMON_API U_EXPORT +#define U_I18N_API U_EXPORT +#define U_LAYOUT_API U_EXPORT +#define U_LAYOUTEX_API U_EXPORT +#define U_IO_API U_EXPORT +#define U_TOOLUTIL_API U_EXPORT +#elif defined(U_STATIC_IMPLEMENTATION) +#define U_DATA_API +#define U_COMMON_API +#define U_I18N_API +#define U_LAYOUT_API +#define U_LAYOUTEX_API +#define U_IO_API +#define U_TOOLUTIL_API +#elif defined(U_COMMON_IMPLEMENTATION) +#define U_DATA_API U_IMPORT +#define U_COMMON_API U_EXPORT +#define U_I18N_API U_IMPORT +#define U_LAYOUT_API U_IMPORT +#define U_LAYOUTEX_API U_IMPORT +#define U_IO_API U_IMPORT +#define U_TOOLUTIL_API U_IMPORT +#elif defined(U_I18N_IMPLEMENTATION) +#define U_DATA_API U_IMPORT +#define U_COMMON_API U_IMPORT +#define U_I18N_API U_EXPORT +#define U_LAYOUT_API U_IMPORT +#define U_LAYOUTEX_API U_IMPORT +#define U_IO_API U_IMPORT +#define U_TOOLUTIL_API U_IMPORT +#elif defined(U_LAYOUT_IMPLEMENTATION) +#define U_DATA_API U_IMPORT +#define U_COMMON_API U_IMPORT +#define U_I18N_API U_IMPORT +#define U_LAYOUT_API U_EXPORT +#define U_LAYOUTEX_API U_IMPORT +#define U_IO_API U_IMPORT +#define U_TOOLUTIL_API U_IMPORT +#elif defined(U_LAYOUTEX_IMPLEMENTATION) +#define U_DATA_API U_IMPORT +#define U_COMMON_API U_IMPORT +#define U_I18N_API U_IMPORT +#define U_LAYOUT_API U_IMPORT +#define U_LAYOUTEX_API U_EXPORT +#define U_IO_API U_IMPORT +#define U_TOOLUTIL_API U_IMPORT +#elif defined(U_IO_IMPLEMENTATION) +#define U_DATA_API U_IMPORT +#define U_COMMON_API U_IMPORT +#define U_I18N_API U_IMPORT +#define U_LAYOUT_API U_IMPORT +#define U_LAYOUTEX_API U_IMPORT +#define U_IO_API U_EXPORT +#define U_TOOLUTIL_API U_IMPORT +#elif defined(U_TOOLUTIL_IMPLEMENTATION) +#define U_DATA_API U_IMPORT +#define U_COMMON_API U_IMPORT +#define U_I18N_API U_IMPORT +#define U_LAYOUT_API U_IMPORT +#define U_LAYOUTEX_API U_IMPORT +#define U_IO_API U_IMPORT +#define U_TOOLUTIL_API U_EXPORT +#else +#define U_DATA_API U_IMPORT +#define U_COMMON_API U_IMPORT +#define U_I18N_API U_IMPORT +#define U_LAYOUT_API U_IMPORT +#define U_LAYOUTEX_API U_IMPORT +#define U_IO_API U_IMPORT +#define U_TOOLUTIL_API U_IMPORT +#endif + +/** + * \def U_STANDARD_CPP_NAMESPACE + * Control of C++ Namespace + * @stable ICU 2.0 + */ +#ifdef __cplusplus +#define U_STANDARD_CPP_NAMESPACE :: +#else +#define U_STANDARD_CPP_NAMESPACE +#endif + +/*===========================================================================*/ +/* UErrorCode */ +/*===========================================================================*/ + +/** + * Error code to replace exception handling, so that the code is compatible with all C++ compilers, + * and to use the same mechanism for C and C++. + * + * \par + * ICU functions that take a reference (C++) or a pointer (C) to a UErrorCode + * first test if(U_FAILURE(errorCode)) { return immediately; } + * so that in a chain of such functions the first one that sets an error code + * causes the following ones to not perform any operations. + * + * \par + * Error codes should be tested using U_FAILURE() and U_SUCCESS(). + * @stable ICU 2.0 + */ +typedef enum UErrorCode { + /* The ordering of U_ERROR_INFO_START Vs U_USING_FALLBACK_WARNING looks weird + * and is that way because VC++ debugger displays first encountered constant, + * which is not the what the code is used for + */ + + U_USING_FALLBACK_WARNING = -128, /**< A resource bundle lookup returned a fallback result (not an error) */ + + U_ERROR_WARNING_START = -128, /**< Start of information results (semantically successful) */ + + U_USING_DEFAULT_WARNING = -127, /**< A resource bundle lookup returned a result from the root locale (not an error) */ + + U_SAFECLONE_ALLOCATED_WARNING = -126, /**< A SafeClone operation required allocating memory (informational only) */ + + U_STATE_OLD_WARNING = -125, /**< ICU has to use compatibility layer to construct the service. Expect performance/memory usage degradation. Consider upgrading */ + + U_STRING_NOT_TERMINATED_WARNING = -124,/**< An output string could not be NUL-terminated because output length==destCapacity. */ + + U_SORT_KEY_TOO_SHORT_WARNING = -123, /**< Number of levels requested in getBound is higher than the number of levels in the sort key */ + + U_AMBIGUOUS_ALIAS_WARNING = -122, /**< This converter alias can go to different converter implementations */ + + U_DIFFERENT_UCA_VERSION = -121, /**< ucol_open encountered a mismatch between UCA version and collator image version, so the collator was constructed from rules. No impact to further function */ + + U_PLUGIN_CHANGED_LEVEL_WARNING = -120, /**< A plugin caused a level change. May not be an error, but later plugins may not load. */ + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal UErrorCode warning value. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_ERROR_WARNING_LIMIT, +#endif // U_HIDE_DEPRECATED_API + + U_ZERO_ERROR = 0, /**< No error, no warning. */ + + U_ILLEGAL_ARGUMENT_ERROR = 1, /**< Start of codes indicating failure */ + U_MISSING_RESOURCE_ERROR = 2, /**< The requested resource cannot be found */ + U_INVALID_FORMAT_ERROR = 3, /**< Data format is not what is expected */ + U_FILE_ACCESS_ERROR = 4, /**< The requested file cannot be found */ + U_INTERNAL_PROGRAM_ERROR = 5, /**< Indicates a bug in the library code */ + U_MESSAGE_PARSE_ERROR = 6, /**< Unable to parse a message (message format) */ + U_MEMORY_ALLOCATION_ERROR = 7, /**< Memory allocation error */ + U_INDEX_OUTOFBOUNDS_ERROR = 8, /**< Trying to access the index that is out of bounds */ + U_PARSE_ERROR = 9, /**< Equivalent to Java ParseException */ + U_INVALID_CHAR_FOUND = 10, /**< Character conversion: Unmappable input sequence. In other APIs: Invalid character. */ + U_TRUNCATED_CHAR_FOUND = 11, /**< Character conversion: Incomplete input sequence. */ + U_ILLEGAL_CHAR_FOUND = 12, /**< Character conversion: Illegal input sequence/combination of input units. */ + U_INVALID_TABLE_FORMAT = 13, /**< Conversion table file found, but corrupted */ + U_INVALID_TABLE_FILE = 14, /**< Conversion table file not found */ + U_BUFFER_OVERFLOW_ERROR = 15, /**< A result would not fit in the supplied buffer */ + U_UNSUPPORTED_ERROR = 16, /**< Requested operation not supported in current context */ + U_RESOURCE_TYPE_MISMATCH = 17, /**< an operation is requested over a resource that does not support it */ + U_ILLEGAL_ESCAPE_SEQUENCE = 18, /**< ISO-2022 illlegal escape sequence */ + U_UNSUPPORTED_ESCAPE_SEQUENCE = 19, /**< ISO-2022 unsupported escape sequence */ + U_NO_SPACE_AVAILABLE = 20, /**< No space available for in-buffer expansion for Arabic shaping */ + U_CE_NOT_FOUND_ERROR = 21, /**< Currently used only while setting variable top, but can be used generally */ + U_PRIMARY_TOO_LONG_ERROR = 22, /**< User tried to set variable top to a primary that is longer than two bytes */ + U_STATE_TOO_OLD_ERROR = 23, /**< ICU cannot construct a service from this state, as it is no longer supported */ + U_TOO_MANY_ALIASES_ERROR = 24, /**< There are too many aliases in the path to the requested resource. + It is very possible that a circular alias definition has occured */ + U_ENUM_OUT_OF_SYNC_ERROR = 25, /**< UEnumeration out of sync with underlying collection */ + U_INVARIANT_CONVERSION_ERROR = 26, /**< Unable to convert a UChar* string to char* with the invariant converter. */ + U_INVALID_STATE_ERROR = 27, /**< Requested operation can not be completed with ICU in its current state */ + U_COLLATOR_VERSION_MISMATCH = 28, /**< Collator version is not compatible with the base version */ + U_USELESS_COLLATOR_ERROR = 29, /**< Collator is options only and no base is specified */ + U_NO_WRITE_PERMISSION = 30, /**< Attempt to modify read-only or constant data. */ + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest standard error code. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_STANDARD_ERROR_LIMIT, +#endif // U_HIDE_DEPRECATED_API + + /* + * Error codes in the range 0x10000 0x10100 are reserved for Transliterator. + */ + U_BAD_VARIABLE_DEFINITION=0x10000,/**< Missing '$' or duplicate variable name */ + U_PARSE_ERROR_START = 0x10000, /**< Start of Transliterator errors */ + U_MALFORMED_RULE, /**< Elements of a rule are misplaced */ + U_MALFORMED_SET, /**< A UnicodeSet pattern is invalid*/ + U_MALFORMED_SYMBOL_REFERENCE, /**< UNUSED as of ICU 2.4 */ + U_MALFORMED_UNICODE_ESCAPE, /**< A Unicode escape pattern is invalid*/ + U_MALFORMED_VARIABLE_DEFINITION, /**< A variable definition is invalid */ + U_MALFORMED_VARIABLE_REFERENCE, /**< A variable reference is invalid */ + U_MISMATCHED_SEGMENT_DELIMITERS, /**< UNUSED as of ICU 2.4 */ + U_MISPLACED_ANCHOR_START, /**< A start anchor appears at an illegal position */ + U_MISPLACED_CURSOR_OFFSET, /**< A cursor offset occurs at an illegal position */ + U_MISPLACED_QUANTIFIER, /**< A quantifier appears after a segment close delimiter */ + U_MISSING_OPERATOR, /**< A rule contains no operator */ + U_MISSING_SEGMENT_CLOSE, /**< UNUSED as of ICU 2.4 */ + U_MULTIPLE_ANTE_CONTEXTS, /**< More than one ante context */ + U_MULTIPLE_CURSORS, /**< More than one cursor */ + U_MULTIPLE_POST_CONTEXTS, /**< More than one post context */ + U_TRAILING_BACKSLASH, /**< A dangling backslash */ + U_UNDEFINED_SEGMENT_REFERENCE, /**< A segment reference does not correspond to a defined segment */ + U_UNDEFINED_VARIABLE, /**< A variable reference does not correspond to a defined variable */ + U_UNQUOTED_SPECIAL, /**< A special character was not quoted or escaped */ + U_UNTERMINATED_QUOTE, /**< A closing single quote is missing */ + U_RULE_MASK_ERROR, /**< A rule is hidden by an earlier more general rule */ + U_MISPLACED_COMPOUND_FILTER, /**< A compound filter is in an invalid location */ + U_MULTIPLE_COMPOUND_FILTERS, /**< More than one compound filter */ + U_INVALID_RBT_SYNTAX, /**< A "::id" rule was passed to the RuleBasedTransliterator parser */ + U_INVALID_PROPERTY_PATTERN, /**< UNUSED as of ICU 2.4 */ + U_MALFORMED_PRAGMA, /**< A 'use' pragma is invlalid */ + U_UNCLOSED_SEGMENT, /**< A closing ')' is missing */ + U_ILLEGAL_CHAR_IN_SEGMENT, /**< UNUSED as of ICU 2.4 */ + U_VARIABLE_RANGE_EXHAUSTED, /**< Too many stand-ins generated for the given variable range */ + U_VARIABLE_RANGE_OVERLAP, /**< The variable range overlaps characters used in rules */ + U_ILLEGAL_CHARACTER, /**< A special character is outside its allowed context */ + U_INTERNAL_TRANSLITERATOR_ERROR, /**< Internal transliterator system error */ + U_INVALID_ID, /**< A "::id" rule specifies an unknown transliterator */ + U_INVALID_FUNCTION, /**< A "&fn()" rule specifies an unknown transliterator */ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal Transliterator error code. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_PARSE_ERROR_LIMIT, +#endif // U_HIDE_DEPRECATED_API + + /* + * Error codes in the range 0x10100 0x10200 are reserved for the formatting API. + */ + U_UNEXPECTED_TOKEN=0x10100, /**< Syntax error in format pattern */ + U_FMT_PARSE_ERROR_START=0x10100, /**< Start of format library errors */ + U_MULTIPLE_DECIMAL_SEPARATORS, /**< More than one decimal separator in number pattern */ + U_MULTIPLE_DECIMAL_SEPERATORS = U_MULTIPLE_DECIMAL_SEPARATORS, /**< Typo: kept for backward compatibility. Use U_MULTIPLE_DECIMAL_SEPARATORS */ + U_MULTIPLE_EXPONENTIAL_SYMBOLS, /**< More than one exponent symbol in number pattern */ + U_MALFORMED_EXPONENTIAL_PATTERN, /**< Grouping symbol in exponent pattern */ + U_MULTIPLE_PERCENT_SYMBOLS, /**< More than one percent symbol in number pattern */ + U_MULTIPLE_PERMILL_SYMBOLS, /**< More than one permill symbol in number pattern */ + U_MULTIPLE_PAD_SPECIFIERS, /**< More than one pad symbol in number pattern */ + U_PATTERN_SYNTAX_ERROR, /**< Syntax error in format pattern */ + U_ILLEGAL_PAD_POSITION, /**< Pad symbol misplaced in number pattern */ + U_UNMATCHED_BRACES, /**< Braces do not match in message pattern */ + U_UNSUPPORTED_PROPERTY, /**< UNUSED as of ICU 2.4 */ + U_UNSUPPORTED_ATTRIBUTE, /**< UNUSED as of ICU 2.4 */ + U_ARGUMENT_TYPE_MISMATCH, /**< Argument name and argument index mismatch in MessageFormat functions */ + U_DUPLICATE_KEYWORD, /**< Duplicate keyword in PluralFormat */ + U_UNDEFINED_KEYWORD, /**< Undefined Plural keyword */ + U_DEFAULT_KEYWORD_MISSING, /**< Missing DEFAULT rule in plural rules */ + U_DECIMAL_NUMBER_SYNTAX_ERROR, /**< Decimal number syntax error */ + U_FORMAT_INEXACT_ERROR, /**< Cannot format a number exactly and rounding mode is ROUND_UNNECESSARY @stable ICU 4.8 */ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal formatting API error code. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_FMT_PARSE_ERROR_LIMIT, +#endif // U_HIDE_DEPRECATED_API + + /* + * Error codes in the range 0x10200 0x102ff are reserved for BreakIterator. + */ + U_BRK_INTERNAL_ERROR=0x10200, /**< An internal error (bug) was detected. */ + U_BRK_ERROR_START=0x10200, /**< Start of codes indicating Break Iterator failures */ + U_BRK_HEX_DIGITS_EXPECTED, /**< Hex digits expected as part of a escaped char in a rule. */ + U_BRK_SEMICOLON_EXPECTED, /**< Missing ';' at the end of a RBBI rule. */ + U_BRK_RULE_SYNTAX, /**< Syntax error in RBBI rule. */ + U_BRK_UNCLOSED_SET, /**< UnicodeSet witing an RBBI rule missing a closing ']'. */ + U_BRK_ASSIGN_ERROR, /**< Syntax error in RBBI rule assignment statement. */ + U_BRK_VARIABLE_REDFINITION, /**< RBBI rule $Variable redefined. */ + U_BRK_MISMATCHED_PAREN, /**< Mis-matched parentheses in an RBBI rule. */ + U_BRK_NEW_LINE_IN_QUOTED_STRING, /**< Missing closing quote in an RBBI rule. */ + U_BRK_UNDEFINED_VARIABLE, /**< Use of an undefined $Variable in an RBBI rule. */ + U_BRK_INIT_ERROR, /**< Initialization failure. Probable missing ICU Data. */ + U_BRK_RULE_EMPTY_SET, /**< Rule contains an empty Unicode Set. */ + U_BRK_UNRECOGNIZED_OPTION, /**< !!option in RBBI rules not recognized. */ + U_BRK_MALFORMED_RULE_TAG, /**< The {nnn} tag on a rule is mal formed */ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal BreakIterator error code. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_BRK_ERROR_LIMIT, +#endif // U_HIDE_DEPRECATED_API + + /* + * Error codes in the range 0x10300-0x103ff are reserved for regular expression related errors. + */ + U_REGEX_INTERNAL_ERROR=0x10300, /**< An internal error (bug) was detected. */ + U_REGEX_ERROR_START=0x10300, /**< Start of codes indicating Regexp failures */ + U_REGEX_RULE_SYNTAX, /**< Syntax error in regexp pattern. */ + U_REGEX_INVALID_STATE, /**< RegexMatcher in invalid state for requested operation */ + U_REGEX_BAD_ESCAPE_SEQUENCE, /**< Unrecognized backslash escape sequence in pattern */ + U_REGEX_PROPERTY_SYNTAX, /**< Incorrect Unicode property */ + U_REGEX_UNIMPLEMENTED, /**< Use of regexp feature that is not yet implemented. */ + U_REGEX_MISMATCHED_PAREN, /**< Incorrectly nested parentheses in regexp pattern. */ + U_REGEX_NUMBER_TOO_BIG, /**< Decimal number is too large. */ + U_REGEX_BAD_INTERVAL, /**< Error in {min,max} interval */ + U_REGEX_MAX_LT_MIN, /**< In {min,max}, max is less than min. */ + U_REGEX_INVALID_BACK_REF, /**< Back-reference to a non-existent capture group. */ + U_REGEX_INVALID_FLAG, /**< Invalid value for match mode flags. */ + U_REGEX_LOOK_BEHIND_LIMIT, /**< Look-Behind pattern matches must have a bounded maximum length. */ + U_REGEX_SET_CONTAINS_STRING, /**< Regexps cannot have UnicodeSets containing strings.*/ +#ifndef U_HIDE_DEPRECATED_API + U_REGEX_OCTAL_TOO_BIG, /**< Octal character constants must be <= 0377. @deprecated ICU 54. This error cannot occur. */ +#endif /* U_HIDE_DEPRECATED_API */ + U_REGEX_MISSING_CLOSE_BRACKET=U_REGEX_SET_CONTAINS_STRING+2, /**< Missing closing bracket on a bracket expression. */ + U_REGEX_INVALID_RANGE, /**< In a character range [x-y], x is greater than y. */ + U_REGEX_STACK_OVERFLOW, /**< Regular expression backtrack stack overflow. */ + U_REGEX_TIME_OUT, /**< Maximum allowed match time exceeded */ + U_REGEX_STOPPED_BY_CALLER, /**< Matching operation aborted by user callback fn. */ + U_REGEX_PATTERN_TOO_BIG, /**< Pattern exceeds limits on size or complexity. @stable ICU 55 */ + U_REGEX_INVALID_CAPTURE_GROUP_NAME, /**< Invalid capture group name. @stable ICU 55 */ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal regular expression error code. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_REGEX_ERROR_LIMIT=U_REGEX_STOPPED_BY_CALLER+3, +#endif // U_HIDE_DEPRECATED_API + + /* + * Error codes in the range 0x10400-0x104ff are reserved for IDNA related error codes. + */ + U_IDNA_PROHIBITED_ERROR=0x10400, + U_IDNA_ERROR_START=0x10400, + U_IDNA_UNASSIGNED_ERROR, + U_IDNA_CHECK_BIDI_ERROR, + U_IDNA_STD3_ASCII_RULES_ERROR, + U_IDNA_ACE_PREFIX_ERROR, + U_IDNA_VERIFICATION_ERROR, + U_IDNA_LABEL_TOO_LONG_ERROR, + U_IDNA_ZERO_LENGTH_LABEL_ERROR, + U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR, +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal IDNA error code. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_IDNA_ERROR_LIMIT, +#endif // U_HIDE_DEPRECATED_API + /* + * Aliases for StringPrep + */ + U_STRINGPREP_PROHIBITED_ERROR = U_IDNA_PROHIBITED_ERROR, + U_STRINGPREP_UNASSIGNED_ERROR = U_IDNA_UNASSIGNED_ERROR, + U_STRINGPREP_CHECK_BIDI_ERROR = U_IDNA_CHECK_BIDI_ERROR, + + /* + * Error codes in the range 0x10500-0x105ff are reserved for Plugin related error codes. + */ + U_PLUGIN_ERROR_START=0x10500, /**< Start of codes indicating plugin failures */ + U_PLUGIN_TOO_HIGH=0x10500, /**< The plugin's level is too high to be loaded right now. */ + U_PLUGIN_DIDNT_SET_LEVEL, /**< The plugin didn't call uplug_setPlugLevel in response to a QUERY */ +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal plug-in error code. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_PLUGIN_ERROR_LIMIT, +#endif // U_HIDE_DEPRECATED_API + +#ifndef U_HIDE_DEPRECATED_API + /** + * One more than the highest normal error code. + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. + */ + U_ERROR_LIMIT=U_PLUGIN_ERROR_LIMIT +#endif // U_HIDE_DEPRECATED_API +} UErrorCode; + +/* Use the following to determine if an UErrorCode represents */ +/* operational success or failure. */ + +#ifdef __cplusplus + /** + * Does the error code indicate success? + * @stable ICU 2.0 + */ + static + inline UBool U_SUCCESS(UErrorCode code) { return (UBool)(code<=U_ZERO_ERROR); } + /** + * Does the error code indicate a failure? + * @stable ICU 2.0 + */ + static + inline UBool U_FAILURE(UErrorCode code) { return (UBool)(code>U_ZERO_ERROR); } +#else + /** + * Does the error code indicate success? + * @stable ICU 2.0 + */ +# define U_SUCCESS(x) ((x)<=U_ZERO_ERROR) + /** + * Does the error code indicate a failure? + * @stable ICU 2.0 + */ +# define U_FAILURE(x) ((x)>U_ZERO_ERROR) +#endif + +/** + * Return a string for a UErrorCode value. + * The string will be the same as the name of the error code constant + * in the UErrorCode enum above. + * @stable ICU 2.0 + */ +U_STABLE const char * U_EXPORT2 +u_errorName(UErrorCode code); + + +#endif /* _UTYPES */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/uvernum.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/uvernum.h new file mode 100644 index 0000000..ce7dec1 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/uvernum.h @@ -0,0 +1,171 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2000-2016, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* +* file name: uvernum.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* Created by: Vladimir Weinstein +* Updated by: Steven R. Loomis +* +*/ + +/** + * \file + * \brief C API: definitions of ICU version numbers + * + * This file is included by uversion.h and other files. This file contains only + * macros and definitions. The actual version numbers are defined here. + */ + + /* + * IMPORTANT: When updating version, the following things need to be done: + * source/common/unicode/uvernum.h - this file: update major, minor, + * patchlevel, suffix, version, short version constants, namespace, + * renaming macro, and copyright + * + * The following files need to be updated as well, which can be done + * by running the UNIX makefile target 'update-windows-makefiles' in icu/source. + * + * + * source/common/common.vcxproj - update 'Output file name' on the link tab so + * that it contains the new major/minor combination + * source/i18n/i18n.vcxproj - same as for the common.vcxproj + * source/layoutex/layoutex.vcproj - same + * source/stubdata/stubdata.vcproj - same as for the common.vcxproj + * source/io/io.vcproj - same as for the common.vcxproj + * source/data/makedata.mak - change U_ICUDATA_NAME so that it contains + * the new major/minor combination and the Unicode version. + */ + +#ifndef UVERNUM_H +#define UVERNUM_H + +/** The standard copyright notice that gets compiled into each library. + * This value will change in the subsequent releases of ICU + * @stable ICU 2.4 + */ +#define U_COPYRIGHT_STRING \ + " Copyright (C) 2016 and later: Unicode, Inc. and others. License & terms of use: http://www.unicode.org/copyright.html " + +/** The current ICU major version as an integer. + * This value will change in the subsequent releases of ICU + * @stable ICU 2.4 + */ +#define U_ICU_VERSION_MAJOR_NUM 60 + +/** The current ICU minor version as an integer. + * This value will change in the subsequent releases of ICU + * @stable ICU 2.6 + */ +#define U_ICU_VERSION_MINOR_NUM 1 + +/** The current ICU patchlevel version as an integer. + * This value will change in the subsequent releases of ICU + * @stable ICU 2.4 + */ +#define U_ICU_VERSION_PATCHLEVEL_NUM 0 + +/** The current ICU build level version as an integer. + * This value is for use by ICU clients. It defaults to 0. + * @stable ICU 4.0 + */ +#ifndef U_ICU_VERSION_BUILDLEVEL_NUM +#define U_ICU_VERSION_BUILDLEVEL_NUM 0 +#endif + +/** Glued version suffix for renamers + * This value will change in the subsequent releases of ICU + * @stable ICU 2.6 + */ +#define U_ICU_VERSION_SUFFIX _60 + +/** + * \def U_DEF2_ICU_ENTRY_POINT_RENAME + * @internal + */ +/** + * \def U_DEF_ICU_ENTRY_POINT_RENAME + * @internal + */ +/** Glued version suffix function for renamers + * This value will change in the subsequent releases of ICU. + * If a custom suffix (such as matching library suffixes) is desired, this can be modified. + * Note that if present, platform.h may contain an earlier definition of this macro. + * \def U_ICU_ENTRY_POINT_RENAME + * @stable ICU 4.2 + */ + +#ifndef U_ICU_ENTRY_POINT_RENAME +#ifdef U_HAVE_LIB_SUFFIX +#define U_DEF_ICU_ENTRY_POINT_RENAME(x,y,z) x ## y ## z +#define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y,z) U_DEF_ICU_ENTRY_POINT_RENAME(x,y,z) +#define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_ICU_VERSION_SUFFIX,U_LIB_SUFFIX_C_NAME) +#else +#define U_DEF_ICU_ENTRY_POINT_RENAME(x,y) x ## y +#define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y) U_DEF_ICU_ENTRY_POINT_RENAME(x,y) +#define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_ICU_VERSION_SUFFIX) +#endif +#endif + +/** The current ICU library version as a dotted-decimal string. The patchlevel + * only appears in this string if it non-zero. + * This value will change in the subsequent releases of ICU + * @stable ICU 2.4 + */ +#define U_ICU_VERSION "60.1" + +/** The current ICU library major/minor version as a string without dots, for library name suffixes. + * This value will change in the subsequent releases of ICU + * @stable ICU 2.6 + */ +#define U_ICU_VERSION_SHORT "60" + +#ifndef U_HIDE_INTERNAL_API +/** Data version in ICU4C. + * @internal ICU 4.4 Internal Use Only + **/ +#define U_ICU_DATA_VERSION "60.1" +#endif /* U_HIDE_INTERNAL_API */ + +/*=========================================================================== + * ICU collation framework version information + * Version info that can be obtained from a collator is affected by these + * numbers in a secret and magic way. Please use collator version as whole + *=========================================================================== + */ + +/** + * Collation runtime version (sort key generator, strcoll). + * If the version is different, sort keys for the same string could be different. + * This value may change in subsequent releases of ICU. + * @stable ICU 2.4 + */ +#define UCOL_RUNTIME_VERSION 9 + +/** + * Collation builder code version. + * When this is different, the same tailoring might result + * in assigning different collation elements to code points. + * This value may change in subsequent releases of ICU. + * @stable ICU 2.4 + */ +#define UCOL_BUILDER_VERSION 9 + +#ifndef U_HIDE_DEPRECATED_API +/** + * Constant 1. + * This was intended to be the version of collation tailorings, + * but instead the tailoring data carries a version number. + * @deprecated ICU 54 + */ +#define UCOL_TAILORINGS_VERSION 1 +#endif /* U_HIDE_DEPRECATED_API */ + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/uversion.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/uversion.h new file mode 100644 index 0000000..e24068d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/uversion.h @@ -0,0 +1,195 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2000-2011, International Business Machines +* Corporation and others. All Rights Reserved. +******************************************************************************* +* +* file name: uversion.h +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* Created by: Vladimir Weinstein +* +* Gets included by utypes.h and Windows .rc files +*/ + +/** + * \file + * \brief C API: API for accessing ICU version numbers. + */ +/*===========================================================================*/ +/* Main ICU version information */ +/*===========================================================================*/ + +#ifndef UVERSION_H +#define UVERSION_H + +#include "unicode/umachine.h" + +/* Actual version info lives in uvernum.h */ +#include "unicode/uvernum.h" + +/** Maximum length of the copyright string. + * @stable ICU 2.4 + */ +#define U_COPYRIGHT_STRING_LENGTH 128 + +/** An ICU version consists of up to 4 numbers from 0..255. + * @stable ICU 2.4 + */ +#define U_MAX_VERSION_LENGTH 4 + +/** In a string, ICU version fields are delimited by dots. + * @stable ICU 2.4 + */ +#define U_VERSION_DELIMITER '.' + +/** The maximum length of an ICU version string. + * @stable ICU 2.4 + */ +#define U_MAX_VERSION_STRING_LENGTH 20 + +/** The binary form of a version on ICU APIs is an array of 4 uint8_t. + * To compare two versions, use memcmp(v1,v2,sizeof(UVersionInfo)). + * @stable ICU 2.4 + */ +typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH]; + +/*===========================================================================*/ +/* C++ namespace if supported. Versioned unless versioning is disabled. */ +/*===========================================================================*/ + +/** + * \def U_NAMESPACE_BEGIN + * This is used to begin a declaration of a public ICU C++ API. + * When not compiling for C++, it does nothing. + * When compiling for C++, it begins an extern "C++" linkage block (to protect + * against cases in which an external client includes ICU header files inside + * an extern "C" linkage block). + * + * It also begins a versioned-ICU-namespace block. + * @stable ICU 2.4 + */ + +/** + * \def U_NAMESPACE_END + * This is used to end a declaration of a public ICU C++ API. + * When not compiling for C++, it does nothing. + * When compiling for C++, it ends the extern "C++" block begun by + * U_NAMESPACE_BEGIN. + * + * It also ends the versioned-ICU-namespace block begun by U_NAMESPACE_BEGIN. + * @stable ICU 2.4 + */ + +/** + * \def U_NAMESPACE_USE + * This is used to specify that the rest of the code uses the + * public ICU C++ API namespace. + * This is invoked by default; we recommend that you turn it off: + * See the "Recommended Build Options" section of the ICU4C readme + * (http://source.icu-project.org/repos/icu/icu/trunk/readme.html#RecBuild) + * @stable ICU 2.4 + */ + +/** + * \def U_NAMESPACE_QUALIFIER + * This is used to qualify that a function or class is part of + * the public ICU C++ API namespace. + * + * This macro is unnecessary since ICU 49 requires namespace support. + * You can just use "icu::" instead. + * @stable ICU 2.4 + */ + +/* Define namespace symbols if the compiler supports it. */ +#ifdef __cplusplus +# if U_DISABLE_RENAMING +# define U_ICU_NAMESPACE icu + namespace U_ICU_NAMESPACE { } +# else +# define U_ICU_NAMESPACE U_ICU_ENTRY_POINT_RENAME(icu) + namespace U_ICU_NAMESPACE { } + namespace icu = U_ICU_NAMESPACE; +# endif + +# define U_NAMESPACE_BEGIN extern "C++" { namespace U_ICU_NAMESPACE { +# define U_NAMESPACE_END } } +# define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE; +# define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE:: + +# ifndef U_USING_ICU_NAMESPACE +# define U_USING_ICU_NAMESPACE 1 +# endif +# if U_USING_ICU_NAMESPACE + U_NAMESPACE_USE +# endif +#else +# define U_NAMESPACE_BEGIN +# define U_NAMESPACE_END +# define U_NAMESPACE_USE +# define U_NAMESPACE_QUALIFIER +#endif + +/*===========================================================================*/ +/* General version helper functions. Definitions in putil.c */ +/*===========================================================================*/ + +/** + * Parse a string with dotted-decimal version information and + * fill in a UVersionInfo structure with the result. + * Definition of this function lives in putil.c + * + * @param versionArray The destination structure for the version information. + * @param versionString A string with dotted-decimal version information, + * with up to four non-negative number fields with + * values of up to 255 each. + * @stable ICU 2.4 + */ +U_STABLE void U_EXPORT2 +u_versionFromString(UVersionInfo versionArray, const char *versionString); + +/** + * Parse a Unicode string with dotted-decimal version information and + * fill in a UVersionInfo structure with the result. + * Definition of this function lives in putil.c + * + * @param versionArray The destination structure for the version information. + * @param versionString A Unicode string with dotted-decimal version + * information, with up to four non-negative number + * fields with values of up to 255 each. + * @stable ICU 4.2 + */ +U_STABLE void U_EXPORT2 +u_versionFromUString(UVersionInfo versionArray, const UChar *versionString); + + +/** + * Write a string with dotted-decimal version information according + * to the input UVersionInfo. + * Definition of this function lives in putil.c + * + * @param versionArray The version information to be written as a string. + * @param versionString A string buffer that will be filled in with + * a string corresponding to the numeric version + * information in versionArray. + * The buffer size must be at least U_MAX_VERSION_STRING_LENGTH. + * @stable ICU 2.4 + */ +U_STABLE void U_EXPORT2 +u_versionToString(const UVersionInfo versionArray, char *versionString); + +/** + * Gets the ICU release version. The version array stores the version information + * for ICU. For example, release "1.3.31.2" is then represented as 0x01031F02. + * Definition of this function lives in putil.c + * + * @param versionArray the version # information, the result will be filled in + * @stable ICU 2.0 + */ +U_STABLE void U_EXPORT2 +u_getVersion(UVersionInfo versionArray); +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/include/unicode/vtzone.h b/dingux/opt/mipsel-linux-uclibc/include/unicode/vtzone.h new file mode 100644 index 0000000..18265d3 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/unicode/vtzone.h @@ -0,0 +1,457 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* Copyright (C) 2007-2013, International Business Machines Corporation and +* others. All Rights Reserved. +******************************************************************************* +*/ +#ifndef VTZONE_H +#define VTZONE_H + +#include "unicode/utypes.h" + +/** + * \file + * \brief C++ API: RFC2445 VTIMEZONE support + */ + +#if !UCONFIG_NO_FORMATTING + +#include "unicode/basictz.h" + +U_NAMESPACE_BEGIN + +class VTZWriter; +class VTZReader; +class UVector; + +/** + * VTimeZone is a class implementing RFC2445 VTIMEZONE. You can create a + * VTimeZone instance from a time zone ID supported by TimeZone. + * With the VTimeZone instance created from the ID, you can write out the rule + * in RFC2445 VTIMEZONE format. Also, you can create a VTimeZone instance + * from RFC2445 VTIMEZONE data stream, which allows you to calculate time + * zone offset by the rules defined by the data. Or, you can create a + * VTimeZone from any other ICU BasicTimeZone. + *

+ * Note: The consumer of this class reading or writing VTIMEZONE data is responsible to + * decode or encode Non-ASCII text. Methods reading/writing VTIMEZONE data in this class + * do nothing with MIME encoding. + * @stable ICU 3.8 + */ +class U_I18N_API VTimeZone : public BasicTimeZone { +public: + /** + * Copy constructor. + * @param source The VTimeZone object to be copied. + * @stable ICU 3.8 + */ + VTimeZone(const VTimeZone& source); + + /** + * Destructor. + * @stable ICU 3.8 + */ + virtual ~VTimeZone(); + + /** + * Assignment operator. + * @param right The object to be copied. + * @stable ICU 3.8 + */ + VTimeZone& operator=(const VTimeZone& right); + + /** + * Return true if the given TimeZone objects are + * semantically equal. Objects of different subclasses are considered unequal. + * @param that The object to be compared with. + * @return true if the given TimeZone objects are + *semantically equal. + * @stable ICU 3.8 + */ + virtual UBool operator==(const TimeZone& that) const; + + /** + * Return true if the given TimeZone objects are + * semantically unequal. Objects of different subclasses are considered unequal. + * @param that The object to be compared with. + * @return true if the given TimeZone objects are + * semantically unequal. + * @stable ICU 3.8 + */ + virtual UBool operator!=(const TimeZone& that) const; + + /** + * Create a VTimeZone instance by the time zone ID. + * @param ID The time zone ID, such as America/New_York + * @return A VTimeZone object initialized by the time zone ID, + * or NULL when the ID is unknown. + * @stable ICU 3.8 + */ + static VTimeZone* createVTimeZoneByID(const UnicodeString& ID); + + /** + * Create a VTimeZone instance using a basic time zone. + * @param basicTZ The basic time zone instance + * @param status Output param to filled in with a success or an error. + * @return A VTimeZone object initialized by the basic time zone. + * @stable ICU 4.6 + */ + static VTimeZone* createVTimeZoneFromBasicTimeZone(const BasicTimeZone& basicTZ, + UErrorCode &status); + + /** + * Create a VTimeZone instance by RFC2445 VTIMEZONE data + * + * @param vtzdata The string including VTIMEZONE data block + * @param status Output param to filled in with a success or an error. + * @return A VTimeZone initialized by the VTIMEZONE data or + * NULL if failed to load the rule from the VTIMEZONE data. + * @stable ICU 3.8 + */ + static VTimeZone* createVTimeZone(const UnicodeString& vtzdata, UErrorCode& status); + + /** + * Gets the RFC2445 TZURL property value. When a VTimeZone instance was + * created from VTIMEZONE data, the initial value is set by the TZURL property value + * in the data. Otherwise, the initial value is not set. + * @param url Receives the RFC2445 TZURL property value. + * @return TRUE if TZURL attribute is available and value is set. + * @stable ICU 3.8 + */ + UBool getTZURL(UnicodeString& url) const; + + /** + * Sets the RFC2445 TZURL property value. + * @param url The TZURL property value. + * @stable ICU 3.8 + */ + void setTZURL(const UnicodeString& url); + + /** + * Gets the RFC2445 LAST-MODIFIED property value. When a VTimeZone instance + * was created from VTIMEZONE data, the initial value is set by the LAST-MODIFIED property + * value in the data. Otherwise, the initial value is not set. + * @param lastModified Receives the last modified date. + * @return TRUE if lastModified attribute is available and value is set. + * @stable ICU 3.8 + */ + UBool getLastModified(UDate& lastModified) const; + + /** + * Sets the RFC2445 LAST-MODIFIED property value. + * @param lastModified The LAST-MODIFIED date. + * @stable ICU 3.8 + */ + void setLastModified(UDate lastModified); + + /** + * Writes RFC2445 VTIMEZONE data for this time zone + * @param result Output param to filled in with the VTIMEZONE data. + * @param status Output param to filled in with a success or an error. + * @stable ICU 3.8 + */ + void write(UnicodeString& result, UErrorCode& status) const; + + /** + * Writes RFC2445 VTIMEZONE data for this time zone applicalbe + * for dates after the specified start time. + * @param start The start date. + * @param result Output param to filled in with the VTIMEZONE data. + * @param status Output param to filled in with a success or an error. + * @stable ICU 3.8 + */ + void write(UDate start, UnicodeString& result, UErrorCode& status) const; + + /** + * Writes RFC2445 VTIMEZONE data applicalbe for the specified date. + * Some common iCalendar implementations can only handle a single time + * zone property or a pair of standard and daylight time properties using + * BYDAY rule with day of week (such as BYDAY=1SUN). This method produce + * the VTIMEZONE data which can be handled these implementations. The rules + * produced by this method can be used only for calculating time zone offset + * around the specified date. + * @param time The date used for rule extraction. + * @param result Output param to filled in with the VTIMEZONE data. + * @param status Output param to filled in with a success or an error. + * @stable ICU 3.8 + */ + void writeSimple(UDate time, UnicodeString& result, UErrorCode& status) const; + + /** + * Clones TimeZone objects polymorphically. Clients are responsible for deleting + * the TimeZone object cloned. + * @return A new copy of this TimeZone object. + * @stable ICU 3.8 + */ + virtual TimeZone* clone(void) const; + + /** + * Returns the TimeZone's adjusted GMT offset (i.e., the number of milliseconds to add + * to GMT to get local time in this time zone, taking daylight savings time into + * account) as of a particular reference date. The reference date is used to determine + * whether daylight savings time is in effect and needs to be figured into the offset + * that is returned (in other words, what is the adjusted GMT offset in this time zone + * at this particular date and time?). For the time zones produced by createTimeZone(), + * the reference data is specified according to the Gregorian calendar, and the date + * and time fields are local standard time. + * + *

Note: Don't call this method. Instead, call the getOffset(UDate...) overload, + * which returns both the raw and the DST offset for a given time. This method + * is retained only for backward compatibility. + * + * @param era The reference date's era + * @param year The reference date's year + * @param month The reference date's month (0-based; 0 is January) + * @param day The reference date's day-in-month (1-based) + * @param dayOfWeek The reference date's day-of-week (1-based; 1 is Sunday) + * @param millis The reference date's milliseconds in day, local standard time + * @param status Output param to filled in with a success or an error. + * @return The offset in milliseconds to add to GMT to get local time. + * @stable ICU 3.8 + */ + virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day, + uint8_t dayOfWeek, int32_t millis, UErrorCode& status) const; + + /** + * Gets the time zone offset, for current date, modified in case of + * daylight savings. This is the offset to add *to* UTC to get local time. + * + *

Note: Don't call this method. Instead, call the getOffset(UDate...) overload, + * which returns both the raw and the DST offset for a given time. This method + * is retained only for backward compatibility. + * + * @param era The reference date's era + * @param year The reference date's year + * @param month The reference date's month (0-based; 0 is January) + * @param day The reference date's day-in-month (1-based) + * @param dayOfWeek The reference date's day-of-week (1-based; 1 is Sunday) + * @param millis The reference date's milliseconds in day, local standard time + * @param monthLength The length of the given month in days. + * @param status Output param to filled in with a success or an error. + * @return The offset in milliseconds to add to GMT to get local time. + * @stable ICU 3.8 + */ + virtual int32_t getOffset(uint8_t era, int32_t year, int32_t month, int32_t day, + uint8_t dayOfWeek, int32_t millis, + int32_t monthLength, UErrorCode& status) const; + + /** + * Returns the time zone raw and GMT offset for the given moment + * in time. Upon return, local-millis = GMT-millis + rawOffset + + * dstOffset. All computations are performed in the proleptic + * Gregorian calendar. The default implementation in the TimeZone + * class delegates to the 8-argument getOffset(). + * + * @param date moment in time for which to return offsets, in + * units of milliseconds from January 1, 1970 0:00 GMT, either GMT + * time or local wall time, depending on `local'. + * @param local if true, `date' is local wall time; otherwise it + * is in GMT time. + * @param rawOffset output parameter to receive the raw offset, that + * is, the offset not including DST adjustments + * @param dstOffset output parameter to receive the DST offset, + * that is, the offset to be added to `rawOffset' to obtain the + * total offset between local and GMT time. If DST is not in + * effect, this value is zero; otherwise it is a positive value, + * typically one hour. + * @param ec input-output error code + * @stable ICU 3.8 + */ + virtual void getOffset(UDate date, UBool local, int32_t& rawOffset, + int32_t& dstOffset, UErrorCode& ec) const; + + /** + * Sets the TimeZone's raw GMT offset (i.e., the number of milliseconds to add + * to GMT to get local time, before taking daylight savings time into account). + * + * @param offsetMillis The new raw GMT offset for this time zone. + * @stable ICU 3.8 + */ + virtual void setRawOffset(int32_t offsetMillis); + + /** + * Returns the TimeZone's raw GMT offset (i.e., the number of milliseconds to add + * to GMT to get local time, before taking daylight savings time into account). + * + * @return The TimeZone's raw GMT offset. + * @stable ICU 3.8 + */ + virtual int32_t getRawOffset(void) const; + + /** + * Queries if this time zone uses daylight savings time. + * @return true if this time zone uses daylight savings time, + * false, otherwise. + * @stable ICU 3.8 + */ + virtual UBool useDaylightTime(void) const; + + /** + * Queries if the given date is in daylight savings time in + * this time zone. + * This method is wasteful since it creates a new GregorianCalendar and + * deletes it each time it is called. This is a deprecated method + * and provided only for Java compatibility. + * + * @param date the given UDate. + * @param status Output param filled in with success/error code. + * @return true if the given date is in daylight savings time, + * false, otherwise. + * @deprecated ICU 2.4. Use Calendar::inDaylightTime() instead. + */ + virtual UBool inDaylightTime(UDate date, UErrorCode& status) const; + + /** + * Returns true if this zone has the same rule and offset as another zone. + * That is, if this zone differs only in ID, if at all. + * @param other the TimeZone object to be compared with + * @return true if the given zone is the same as this one, + * with the possible exception of the ID + * @stable ICU 3.8 + */ + virtual UBool hasSameRules(const TimeZone& other) const; + + /** + * Gets the first time zone transition after the base time. + * @param base The base time. + * @param inclusive Whether the base time is inclusive or not. + * @param result Receives the first transition after the base time. + * @return TRUE if the transition is found. + * @stable ICU 3.8 + */ + virtual UBool getNextTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const; + + /** + * Gets the most recent time zone transition before the base time. + * @param base The base time. + * @param inclusive Whether the base time is inclusive or not. + * @param result Receives the most recent transition before the base time. + * @return TRUE if the transition is found. + * @stable ICU 3.8 + */ + virtual UBool getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransition& result) const; + + /** + * Returns the number of TimeZoneRules which represents time transitions, + * for this time zone, that is, all TimeZoneRules for this time zone except + * InitialTimeZoneRule. The return value range is 0 or any positive value. + * @param status Receives error status code. + * @return The number of TimeZoneRules representing time transitions. + * @stable ICU 3.8 + */ + virtual int32_t countTransitionRules(UErrorCode& status) const; + + /** + * Gets the InitialTimeZoneRule and the set of TimeZoneRule + * which represent time transitions for this time zone. On successful return, + * the argument initial points to non-NULL InitialTimeZoneRule and + * the array trsrules is filled with 0 or multiple TimeZoneRule + * instances up to the size specified by trscount. The results are referencing the + * rule instance held by this time zone instance. Therefore, after this time zone + * is destructed, they are no longer available. + * @param initial Receives the initial timezone rule + * @param trsrules Receives the timezone transition rules + * @param trscount On input, specify the size of the array 'transitions' receiving + * the timezone transition rules. On output, actual number of + * rules filled in the array will be set. + * @param status Receives error status code. + * @stable ICU 3.8 + */ + virtual void getTimeZoneRules(const InitialTimeZoneRule*& initial, + const TimeZoneRule* trsrules[], int32_t& trscount, UErrorCode& status) const; + +private: + enum { DEFAULT_VTIMEZONE_LINES = 100 }; + + /** + * Default constructor. + */ + VTimeZone(); + static VTimeZone* createVTimeZone(VTZReader* reader); + void write(VTZWriter& writer, UErrorCode& status) const; + void write(UDate start, VTZWriter& writer, UErrorCode& status) const; + void writeSimple(UDate time, VTZWriter& writer, UErrorCode& status) const; + void load(VTZReader& reader, UErrorCode& status); + void parse(UErrorCode& status); + + void writeZone(VTZWriter& w, BasicTimeZone& basictz, UVector* customProps, + UErrorCode& status) const; + + void writeHeaders(VTZWriter& w, UErrorCode& status) const; + void writeFooter(VTZWriter& writer, UErrorCode& status) const; + + void writeZonePropsByTime(VTZWriter& writer, UBool isDst, const UnicodeString& zonename, + int32_t fromOffset, int32_t toOffset, UDate time, UBool withRDATE, + UErrorCode& status) const; + void writeZonePropsByDOM(VTZWriter& writer, UBool isDst, const UnicodeString& zonename, + int32_t fromOffset, int32_t toOffset, + int32_t month, int32_t dayOfMonth, UDate startTime, UDate untilTime, + UErrorCode& status) const; + void writeZonePropsByDOW(VTZWriter& writer, UBool isDst, const UnicodeString& zonename, + int32_t fromOffset, int32_t toOffset, + int32_t month, int32_t weekInMonth, int32_t dayOfWeek, + UDate startTime, UDate untilTime, UErrorCode& status) const; + void writeZonePropsByDOW_GEQ_DOM(VTZWriter& writer, UBool isDst, const UnicodeString& zonename, + int32_t fromOffset, int32_t toOffset, + int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, + UDate startTime, UDate untilTime, UErrorCode& status) const; + void writeZonePropsByDOW_GEQ_DOM_sub(VTZWriter& writer, int32_t month, int32_t dayOfMonth, + int32_t dayOfWeek, int32_t numDays, + UDate untilTime, int32_t fromOffset, UErrorCode& status) const; + void writeZonePropsByDOW_LEQ_DOM(VTZWriter& writer, UBool isDst, const UnicodeString& zonename, + int32_t fromOffset, int32_t toOffset, + int32_t month, int32_t dayOfMonth, int32_t dayOfWeek, + UDate startTime, UDate untilTime, UErrorCode& status) const; + void writeFinalRule(VTZWriter& writer, UBool isDst, const AnnualTimeZoneRule* rule, + int32_t fromRawOffset, int32_t fromDSTSavings, + UDate startTime, UErrorCode& status) const; + + void beginZoneProps(VTZWriter& writer, UBool isDst, const UnicodeString& zonename, + int32_t fromOffset, int32_t toOffset, UDate startTime, UErrorCode& status) const; + void endZoneProps(VTZWriter& writer, UBool isDst, UErrorCode& status) const; + void beginRRULE(VTZWriter& writer, int32_t month, UErrorCode& status) const; + void appendUNTIL(VTZWriter& writer, const UnicodeString& until, UErrorCode& status) const; + + BasicTimeZone *tz; + UVector *vtzlines; + UnicodeString tzurl; + UDate lastmod; + UnicodeString olsonzid; + UnicodeString icutzver; + +public: + /** + * Return the class ID for this class. This is useful only for comparing to + * a return value from getDynamicClassID(). For example: + *

+     * .   Base* polymorphic_pointer = createPolymorphicObject();
+     * .   if (polymorphic_pointer->getDynamicClassID() ==
+     * .       erived::getStaticClassID()) ...
+     * 
+ * @return The class ID for all objects of this class. + * @stable ICU 3.8 + */ + static UClassID U_EXPORT2 getStaticClassID(void); + + /** + * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This + * method is to implement a simple version of RTTI, since not all C++ + * compilers support genuine RTTI. Polymorphic operator==() and clone() + * methods call this method. + * + * @return The class ID for this object. All objects of a + * given class have the same class ID. Objects of + * other classes have different class IDs. + * @stable ICU 3.8 + */ + virtual UClassID getDynamicClassID(void) const; +}; + +U_NAMESPACE_END + +#endif /* #if !UCONFIG_NO_FORMATTING */ + +#endif // VTZONE_H +//eof diff --git a/dingux/opt/mipsel-linux-uclibc/include/uuid/uuid.h b/dingux/opt/mipsel-linux-uclibc/include/uuid/uuid.h new file mode 100644 index 0000000..03c232c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/uuid/uuid.h @@ -0,0 +1,121 @@ +/* + * Public include file for the UUID library + * + * Copyright (C) 1996, 1997, 1998 Theodore Ts'o. + * + * %Begin-Header% + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, and the entire permission notice in its entirety, + * including the disclaimer of warranties. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF + * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * %End-Header% + */ + +#ifndef _UUID_UUID_H +#define _UUID_UUID_H + +#include +#ifndef _WIN32 +#include +#endif +#include + +typedef unsigned char uuid_t[16]; + +/* UUID Variant definitions */ +#define UUID_VARIANT_NCS 0 +#define UUID_VARIANT_DCE 1 +#define UUID_VARIANT_MICROSOFT 2 +#define UUID_VARIANT_OTHER 3 + +#define UUID_VARIANT_SHIFT 5 +#define UUID_VARIANT_MASK 0x7 + +/* UUID Type definitions */ +#define UUID_TYPE_DCE_TIME 1 +#define UUID_TYPE_DCE_SECURITY 2 +#define UUID_TYPE_DCE_MD5 3 +#define UUID_TYPE_DCE_RANDOM 4 +#define UUID_TYPE_DCE_SHA1 5 + +#define UUID_TYPE_SHIFT 4 +#define UUID_TYPE_MASK 0xf + +#define UUID_STR_LEN 37 + +/* Allow UUID constants to be defined */ +#ifdef __GNUC__ +#define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \ + static const uuid_t name __attribute__ ((unused)) = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15} +#else +#define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \ + static const uuid_t name = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15} +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* clear.c */ +extern void uuid_clear(uuid_t uu); + +/* compare.c */ +extern int uuid_compare(const uuid_t uu1, const uuid_t uu2); + +/* copy.c */ +extern void uuid_copy(uuid_t dst, const uuid_t src); + +/* gen_uuid.c */ +extern void uuid_generate(uuid_t out); +extern void uuid_generate_random(uuid_t out); +extern void uuid_generate_time(uuid_t out); +extern int uuid_generate_time_safe(uuid_t out); + +extern void uuid_generate_md5(uuid_t out, const uuid_t ns, const char *name, size_t len); +extern void uuid_generate_sha1(uuid_t out, const uuid_t ns, const char *name, size_t len); + +/* isnull.c */ +extern int uuid_is_null(const uuid_t uu); + +/* parse.c */ +extern int uuid_parse(const char *in, uuid_t uu); + +/* unparse.c */ +extern void uuid_unparse(const uuid_t uu, char *out); +extern void uuid_unparse_lower(const uuid_t uu, char *out); +extern void uuid_unparse_upper(const uuid_t uu, char *out); + +/* uuid_time.c */ +extern time_t uuid_time(const uuid_t uu, struct timeval *ret_tv); +extern int uuid_type(const uuid_t uu); +extern int uuid_variant(const uuid_t uu); + +/* predefined.c */ +extern const uuid_t *uuid_get_template(const char *alias); + +#ifdef __cplusplus +} +#endif + +#endif /* _UUID_UUID_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/zconf.h b/dingux/opt/mipsel-linux-uclibc/include/zconf.h new file mode 100644 index 0000000..77398c1 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/zconf.h @@ -0,0 +1,534 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id$ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + * Even better than compiling with -DZ_PREFIX would be to use configure to set + * this permanently in zconf.h using "./configure --zprefix". + */ +#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ +# define Z_PREFIX_SET + +/* all linked symbols and init macros */ +# define _dist_code z__dist_code +# define _length_code z__length_code +# define _tr_align z__tr_align +# define _tr_flush_bits z__tr_flush_bits +# define _tr_flush_block z__tr_flush_block +# define _tr_init z__tr_init +# define _tr_stored_block z__tr_stored_block +# define _tr_tally z__tr_tally +# define adler32 z_adler32 +# define adler32_combine z_adler32_combine +# define adler32_combine64 z_adler32_combine64 +# define adler32_z z_adler32_z +# ifndef Z_SOLO +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# endif +# define crc32 z_crc32 +# define crc32_combine z_crc32_combine +# define crc32_combine64 z_crc32_combine64 +# define crc32_z z_crc32_z +# define deflate z_deflate +# define deflateBound z_deflateBound +# define deflateCopy z_deflateCopy +# define deflateEnd z_deflateEnd +# define deflateGetDictionary z_deflateGetDictionary +# define deflateInit z_deflateInit +# define deflateInit2 z_deflateInit2 +# define deflateInit2_ z_deflateInit2_ +# define deflateInit_ z_deflateInit_ +# define deflateParams z_deflateParams +# define deflatePending z_deflatePending +# define deflatePrime z_deflatePrime +# define deflateReset z_deflateReset +# define deflateResetKeep z_deflateResetKeep +# define deflateSetDictionary z_deflateSetDictionary +# define deflateSetHeader z_deflateSetHeader +# define deflateTune z_deflateTune +# define deflate_copyright z_deflate_copyright +# define get_crc_table z_get_crc_table +# ifndef Z_SOLO +# define gz_error z_gz_error +# define gz_intmax z_gz_intmax +# define gz_strwinerror z_gz_strwinerror +# define gzbuffer z_gzbuffer +# define gzclearerr z_gzclearerr +# define gzclose z_gzclose +# define gzclose_r z_gzclose_r +# define gzclose_w z_gzclose_w +# define gzdirect z_gzdirect +# define gzdopen z_gzdopen +# define gzeof z_gzeof +# define gzerror z_gzerror +# define gzflush z_gzflush +# define gzfread z_gzfread +# define gzfwrite z_gzfwrite +# define gzgetc z_gzgetc +# define gzgetc_ z_gzgetc_ +# define gzgets z_gzgets +# define gzoffset z_gzoffset +# define gzoffset64 z_gzoffset64 +# define gzopen z_gzopen +# define gzopen64 z_gzopen64 +# ifdef _WIN32 +# define gzopen_w z_gzopen_w +# endif +# define gzprintf z_gzprintf +# define gzputc z_gzputc +# define gzputs z_gzputs +# define gzread z_gzread +# define gzrewind z_gzrewind +# define gzseek z_gzseek +# define gzseek64 z_gzseek64 +# define gzsetparams z_gzsetparams +# define gztell z_gztell +# define gztell64 z_gztell64 +# define gzungetc z_gzungetc +# define gzvprintf z_gzvprintf +# define gzwrite z_gzwrite +# endif +# define inflate z_inflate +# define inflateBack z_inflateBack +# define inflateBackEnd z_inflateBackEnd +# define inflateBackInit z_inflateBackInit +# define inflateBackInit_ z_inflateBackInit_ +# define inflateCodesUsed z_inflateCodesUsed +# define inflateCopy z_inflateCopy +# define inflateEnd z_inflateEnd +# define inflateGetDictionary z_inflateGetDictionary +# define inflateGetHeader z_inflateGetHeader +# define inflateInit z_inflateInit +# define inflateInit2 z_inflateInit2 +# define inflateInit2_ z_inflateInit2_ +# define inflateInit_ z_inflateInit_ +# define inflateMark z_inflateMark +# define inflatePrime z_inflatePrime +# define inflateReset z_inflateReset +# define inflateReset2 z_inflateReset2 +# define inflateResetKeep z_inflateResetKeep +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateUndermine z_inflateUndermine +# define inflateValidate z_inflateValidate +# define inflate_copyright z_inflate_copyright +# define inflate_fast z_inflate_fast +# define inflate_table z_inflate_table +# ifndef Z_SOLO +# define uncompress z_uncompress +# define uncompress2 z_uncompress2 +# endif +# define zError z_zError +# ifndef Z_SOLO +# define zcalloc z_zcalloc +# define zcfree z_zcfree +# endif +# define zlibCompileFlags z_zlibCompileFlags +# define zlibVersion z_zlibVersion + +/* all zlib typedefs in zlib.h and zconf.h */ +# define Byte z_Byte +# define Bytef z_Bytef +# define alloc_func z_alloc_func +# define charf z_charf +# define free_func z_free_func +# ifndef Z_SOLO +# define gzFile z_gzFile +# endif +# define gz_header z_gz_header +# define gz_headerp z_gz_headerp +# define in_func z_in_func +# define intf z_intf +# define out_func z_out_func +# define uInt z_uInt +# define uIntf z_uIntf +# define uLong z_uLong +# define uLongf z_uLongf +# define voidp z_voidp +# define voidpc z_voidpc +# define voidpf z_voidpf + +/* all zlib structs in zlib.h and zconf.h */ +# define gz_header_s z_gz_header_s +# define internal_state z_internal_state + +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +# ifndef WIN32 +# define WIN32 +# endif +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +#if defined(ZLIB_CONST) && !defined(z_const) +# define z_const const +#else +# define z_const +#endif + +#ifdef Z_SOLO + typedef unsigned long z_size_t; +#else +# define z_longlong long long +# if defined(NO_SIZE_T) + typedef unsigned NO_SIZE_T z_size_t; +# elif defined(STDC) +# include + typedef size_t z_size_t; +# else + typedef unsigned long z_size_t; +# endif +# undef z_longlong +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus about 7 kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +#ifndef Z_ARG /* function prototypes for stdarg */ +# if defined(STDC) || defined(Z_HAVE_STDARG_H) +# define Z_ARG(args) args +# else +# define Z_ARG(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) +# include +# if (UINT_MAX == 0xffffffffUL) +# define Z_U4 unsigned +# elif (ULONG_MAX == 0xffffffffUL) +# define Z_U4 unsigned long +# elif (USHRT_MAX == 0xffffffffUL) +# define Z_U4 unsigned short +# endif +#endif + +#ifdef Z_U4 + typedef Z_U4 z_crc_t; +#else + typedef unsigned long z_crc_t; +#endif + +#if 1 /* was set to #if 1 by ./configure */ +# define Z_HAVE_UNISTD_H +#endif + +#if 1 /* was set to #if 1 by ./configure */ +# define Z_HAVE_STDARG_H +#endif + +#ifdef STDC +# ifndef Z_SOLO +# include /* for off_t */ +# endif +#endif + +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifndef Z_SOLO +# include /* for va_list */ +# endif +#endif + +#ifdef _WIN32 +# ifndef Z_SOLO +# include /* for wchar_t */ +# endif +#endif + +/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and + * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even + * though the former does not conform to the LFS document), but considering + * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as + * equivalently requesting no 64-bit operations + */ +#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 +# undef _LARGEFILE64_SOURCE +#endif + +#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) +# define Z_HAVE_UNISTD_H +#endif +#ifndef Z_SOLO +# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) +# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ +# ifdef VMS +# include /* for off_t */ +# endif +# ifndef z_off_t +# define z_off_t off_t +# endif +# endif +#endif + +#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 +# define Z_LFS64 +#endif + +#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) +# define Z_LARGE64 +#endif + +#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) +# define Z_WANT64 +#endif + +#if !defined(SEEK_SET) && !defined(Z_SOLO) +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif + +#ifndef z_off_t +# define z_off_t long +#endif + +#if !defined(_WIN32) && defined(Z_LARGE64) +# define z_off64_t off64_t +#else +# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) +# define z_off64_t __int64 +# else +# define z_off64_t z_off_t +# endif +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) + #pragma map(deflateInit_,"DEIN") + #pragma map(deflateInit2_,"DEIN2") + #pragma map(deflateEnd,"DEEND") + #pragma map(deflateBound,"DEBND") + #pragma map(inflateInit_,"ININ") + #pragma map(inflateInit2_,"ININ2") + #pragma map(inflateEnd,"INEND") + #pragma map(inflateSync,"INSY") + #pragma map(inflateSetDictionary,"INSEDI") + #pragma map(compressBound,"CMBND") + #pragma map(inflate_table,"INTABL") + #pragma map(inflate_fast,"INFA") + #pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/include/zlib.h b/dingux/opt/mipsel-linux-uclibc/include/zlib.h new file mode 100644 index 0000000..f09cdaf --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/include/zlib.h @@ -0,0 +1,1912 @@ +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.11, January 15th, 2017 + + Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 + (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). +*/ + +#ifndef ZLIB_H +#define ZLIB_H + +#include "zconf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.2.11" +#define ZLIB_VERNUM 0x12b0 +#define ZLIB_VER_MAJOR 1 +#define ZLIB_VER_MINOR 2 +#define ZLIB_VER_REVISION 11 +#define ZLIB_VER_SUBREVISION 0 + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed data. + This version of the library supports only one compression method (deflation) + but other algorithms will be added later and will have the same stream + interface. + + Compression can be done in a single step if the buffers are large enough, + or can be done by repeated calls of the compression function. In the latter + case, the application must provide more input and/or consume the output + (providing more output space) before each call. + + The compressed data format used by default by the in-memory functions is + the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped + around a deflate stream, which is itself documented in RFC 1951. + + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio using the functions that start + with "gz". The gzip format is different from the zlib format. gzip is a + gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. + + This library can optionally read and write gzip and raw deflate streams in + memory as well. + + The zlib format was designed to be compact and fast for use in memory + and on communications channels. The gzip format was designed for single- + file compression on file systems, has a larger header than zlib to maintain + directory information, and uses a different, slower check method than zlib. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never crash + even in the case of corrupted input. +*/ + +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void (*free_func) OF((voidpf opaque, voidpf address)); + +struct internal_state; + +typedef struct z_stream_s { + z_const Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total number of input bytes read so far */ + + Bytef *next_out; /* next output byte will go here */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total number of bytes output so far */ + + z_const char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: binary or text + for deflate, or the decoding state for inflate */ + uLong adler; /* Adler-32 or CRC-32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + gzip header information passed to and from zlib routines. See RFC 1952 + for more details on the meanings of these fields. +*/ +typedef struct gz_header_s { + int text; /* true if compressed data believed to be text */ + uLong time; /* modification time */ + int xflags; /* extra flags (not used when writing a gzip file) */ + int os; /* operating system */ + Bytef *extra; /* pointer to extra field or Z_NULL if none */ + uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ + uInt extra_max; /* space at extra (only when reading header) */ + Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ + uInt name_max; /* space at name (only when reading header) */ + Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ + uInt comm_max; /* space at comment (only when reading header) */ + int hcrc; /* true if there was or will be a header crc */ + int done; /* true when done reading gzip header (not used + when writing a gzip file) */ +} gz_header; + +typedef gz_header FAR *gz_headerp; + +/* + The application must update next_in and avail_in when avail_in has dropped + to zero. It must update next_out and avail_out when avail_out has dropped + to zero. The application must initialize zalloc, zfree and opaque before + calling the init function. All other fields are set by the compression + library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + If zlib is used in a multi-threaded application, zalloc and zfree must be + thread safe. In that case, zlib is thread-safe. When zalloc and zfree are + Z_NULL on entry to the initialization function, they are set to internal + routines that use the standard library functions malloc() and free(). + + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this if + the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers + returned by zalloc for objects of exactly 65536 bytes *must* have their + offset normalized to zero. The default allocation function provided by this + library ensures this (see zutil.c). To reduce memory requirements and avoid + any allocation of 64K objects, at the expense of compression ratio, compile + the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or progress + reports. After compression, total_in holds the total size of the + uncompressed data and may be saved for use by the decompressor (particularly + if the decompressor wants to decompress everything in a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +#define Z_BLOCK 5 +#define Z_TREES 6 +/* Allowed flush values; see deflate() and inflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_RLE 3 +#define Z_FIXED 4 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_TEXT 1 +#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ +#define Z_UNKNOWN 2 +/* Possible values of the data_type field for deflate() */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + + /* basic functions */ + +ZEXTERN const char * ZEXPORT zlibVersion OF((void)); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is not + compatible with the zlib.h header file used by the application. This check + is automatically made by deflateInit and inflateInit. + */ + +/* +ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. If + zalloc and zfree are set to Z_NULL, deflateInit updates them to use default + allocation functions. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at all + (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION + requests a default compromise between speed and compression (currently + equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if level is not a valid compression level, or + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). msg is set to null + if there is no error message. deflateInit does not perform any compression: + this will be done by deflate(). +*/ + + +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); +/* + deflate compresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. deflate performs one or both of the + following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Generate more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary. Some output may be provided even if + flush is zero. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating avail_in or avail_out accordingly; avail_out should + never be zero before the call. The application can consume the compressed + output when it wants, for example when the output buffer is full (avail_out + == 0), or after each call of deflate(). If deflate returns Z_OK and with + zero avail_out, it must be called again after making room in the output + buffer because there might be more output pending. See deflatePending(), + which can be used if desired to determine whether or not there is more ouput + in that case. + + Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to + decide how much data to accumulate before producing output, in order to + maximize compression. + + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + flushed to the output buffer and the output is aligned on a byte boundary, so + that the decompressor can get all input data available so far. (In + particular avail_in is zero after the call if enough output space has been + provided before the call.) Flushing may degrade compression for some + compression algorithms and so it should be used only when necessary. This + completes the current deflate block and follows it with an empty stored block + that is three bits plus filler bits to the next byte, followed by four bytes + (00 00 ff ff). + + If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the + output buffer, but the output is not aligned to a byte boundary. All of the + input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. + This completes the current deflate block and follows it with an empty fixed + codes block that is 10 bits long. This assures that enough bytes are output + in order for the decompressor to finish the block before the empty fixed + codes block. + + If flush is set to Z_BLOCK, a deflate block is completed and emitted, as + for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to + seven bits of the current block are held to be written as the next byte after + the next deflate block is completed. In this case, the decompressor may not + be provided enough bits at this point in order to complete decompression of + the data provided so far to the compressor. It may need to wait for the next + block to be emitted. This is for advanced applications that need to control + the emission of deflate blocks. + + If flush is set to Z_FULL_FLUSH, all output is flushed as with + Z_SYNC_FLUSH, and the compression state is reset so that decompression can + restart from this point if previous compressed data has been damaged or if + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + compression. + + If deflate returns with avail_out == 0, this function must be called again + with the same value of the flush parameter and more output space (updated + avail_out), until the flush is complete (deflate returns with non-zero + avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that + avail_out is greater than six to avoid repeated flush markers due to + avail_out == 0 on return. + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there was + enough output space. If deflate returns with Z_OK or Z_BUF_ERROR, this + function must be called again with Z_FINISH and more output space (updated + avail_out) but no more input data, until it returns with Z_STREAM_END or an + error. After deflate has returned Z_STREAM_END, the only possible operations + on the stream are deflateReset or deflateEnd. + + Z_FINISH can be used in the first deflate call after deflateInit if all the + compression is to be done in a single step. In order to complete in one + call, avail_out must be at least the value returned by deflateBound (see + below). Then deflate is guaranteed to return Z_STREAM_END. If not enough + output space is provided, deflate will not return Z_STREAM_END, and it must + be called again as described above. + + deflate() sets strm->adler to the Adler-32 checksum of all input read + so far (that is, total_in bytes). If a gzip stream is being generated, then + strm->adler will be the CRC-32 checksum of the input read so far. (See + deflateInit2 below.) + + deflate() may update strm->data_type if it can make a good guess about + the input data type (Z_BINARY or Z_TEXT). If in doubt, the data is + considered binary. This field is only for information purposes and does not + affect the compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was Z_NULL or the state was inadvertently written over + by the application), or Z_BUF_ERROR if no progress is possible (for example + avail_in or avail_out was zero). Note that Z_BUF_ERROR is not fatal, and + deflate() can be called again with more input and more output space to + continue compressing. +*/ + + +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, msg + may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); + + Initializes the internal stream state for decompression. The fields + next_in, avail_in, zalloc, zfree and opaque must be initialized before by + the caller. In the current version of inflate, the provided input is not + read or consumed. The allocation of a sliding window will be deferred to + the first call of inflate (if the decompression does not complete on the + first call). If zalloc and zfree are set to Z_NULL, inflateInit updates + them to use default allocation functions. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit does not perform any decompression. + Actual decompression will be done by inflate(). So next_in, and avail_in, + next_out, and avail_out are unused and unchanged. The current + implementation of inflateInit() does not process any header information -- + that is deferred until inflate() is called. +*/ + + +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); +/* + inflate decompresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. inflate performs one or both of the + following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), then next_in and avail_in are updated + accordingly, and processing will resume at this point for the next call of + inflate(). + + - Generate more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there is + no more input data or no more space in the output buffer (see below about + the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating the next_* and avail_* values accordingly. If the + caller of inflate() does not provide both available input and available + output space, it is possible that there will be no progress made. The + application can consume the uncompressed output when it wants, for example + when the output buffer is full (avail_out == 0), or after each call of + inflate(). If inflate returns Z_OK and with zero avail_out, it must be + called again after making room in the output buffer because there might be + more output pending. + + The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, + Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much + output as possible to the output buffer. Z_BLOCK requests that inflate() + stop if and when it gets to the next deflate block boundary. When decoding + the zlib or gzip format, this will cause inflate() to return immediately + after the header and before the first block. When doing a raw inflate, + inflate() will go ahead and process the first block, and will return when it + gets to the end of that block, or when it runs out of data. + + The Z_BLOCK option assists in appending to or combining deflate streams. + To assist in this, on return inflate() always sets strm->data_type to the + number of unused bits in the last byte taken from strm->next_in, plus 64 if + inflate() is currently decoding the last block in the deflate stream, plus + 128 if inflate() returned immediately after decoding an end-of-block code or + decoding the complete header up to just before the first byte of the deflate + stream. The end-of-block will not be indicated until all of the uncompressed + data from that block has been written to strm->next_out. The number of + unused bits may in general be greater than seven, except when bit 7 of + data_type is set, in which case the number of unused bits will be less than + eight. data_type is set as noted here every time inflate() returns for all + flush options, and so can be used to determine the amount of currently + consumed input in bits. + + The Z_TREES option behaves as Z_BLOCK does, but it also returns when the + end of each deflate block header is reached, before any actual data in that + block is decoded. This allows the caller to determine the length of the + deflate block header for later use in random access within a deflate block. + 256 is added to the value of strm->data_type when inflate() returns + immediately after reaching the end of the deflate block header. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step (a + single call of inflate), the parameter flush should be set to Z_FINISH. In + this case all pending input is processed and all pending output is flushed; + avail_out must be large enough to hold all of the uncompressed data for the + operation to complete. (The size of the uncompressed data may have been + saved by the compressor for this purpose.) The use of Z_FINISH is not + required to perform an inflation in one step. However it may be used to + inform inflate that a faster approach can be used for the single inflate() + call. Z_FINISH also informs inflate to not maintain a sliding window if the + stream completes, which reduces inflate's memory footprint. If the stream + does not complete, either because not all of the stream is provided or not + enough output space is provided, then a sliding window will be allocated and + inflate() can be called again to continue the operation as if Z_NO_FLUSH had + been used. + + In this implementation, inflate() always flushes as much output as + possible to the output buffer, and always uses the faster approach on the + first call. So the effects of the flush parameter in this implementation are + on the return value of inflate() as noted below, when inflate() returns early + when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of + memory for a sliding window when Z_FINISH is used. + + If a preset dictionary is needed after this call (see inflateSetDictionary + below), inflate sets strm->adler to the Adler-32 checksum of the dictionary + chosen by the compressor and returns Z_NEED_DICT; otherwise it sets + strm->adler to the Adler-32 checksum of all output produced so far (that is, + total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described + below. At the end of the stream, inflate() checks that its computed Adler-32 + checksum is equal to that saved by the compressor and returns Z_STREAM_END + only if the checksum is correct. + + inflate() can decompress and check either zlib-wrapped or gzip-wrapped + deflate data. The header type is detected automatically, if requested when + initializing with inflateInit2(). Any information contained in the gzip + header is not retained unless inflateGetHeader() is used. When processing + gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output + produced so far. The CRC-32 is checked against the gzip trailer, as is the + uncompressed length, modulo 2^32. + + inflate() returns Z_OK if some progress has been made (more input processed + or more output produced), Z_STREAM_END if the end of the compressed data has + been reached and all uncompressed output has been produced, Z_NEED_DICT if a + preset dictionary is needed at this point, Z_DATA_ERROR if the input data was + corrupted (input stream not conforming to the zlib format or incorrect check + value, in which case strm->msg points to a string with a more specific + error), Z_STREAM_ERROR if the stream structure was inconsistent (for example + next_in or next_out was Z_NULL, or the state was inadvertently written over + by the application), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR + if no progress was possible or if there was not enough room in the output + buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and + inflate() can be called again with more input and more output space to + continue decompressing. If Z_DATA_ERROR is returned, the application may + then call inflateSync() to look for a good compression block if a partial + recovery of the data is to be attempted. +*/ + + +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + inflateEnd returns Z_OK if success, or Z_STREAM_ERROR if the stream state + was inconsistent. +*/ + + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy)); + + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by the + caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if + deflateInit is used instead. + + For the current implementation of deflate(), a windowBits value of 8 (a + window size of 256 bytes) is not supported. As a result, a request for 8 + will result in 9 (a 512-byte window). In that case, providing 8 to + inflateInit2() will result in an error when the zlib header with 9 is + checked against the initialization of inflate(). The remedy is to not use 8 + with deflateInit2() with this initialization, or at least in that case use 9 + with inflateInit2(). + + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits + determines the window size. deflate() will then generate raw deflate data + with no zlib header or trailer, and will not compute a check value. + + windowBits can also be greater than 15 for optional gzip encoding. Add + 16 to windowBits to write a simple gzip header and trailer around the + compressed data instead of a zlib wrapper. The gzip header will have no + file name, no extra data, no comment, no modification time (set to zero), no + header crc, and the operating system will be set to the appropriate value, + if the operating system was determined at compile time. If a gzip stream is + being written, strm->adler is a CRC-32 instead of an Adler-32. + + For raw deflate or gzip encoding, a request for a 256-byte window is + rejected as invalid, since only the zlib header provides a means of + transmitting the window size to the decompressor. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but is + slow and reduces compression ratio; memLevel=9 uses maximum memory for + optimal speed. The default value is 8. See zconf.h for total memory usage + as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match), or Z_RLE to limit match distances to one (run-length + encoding). Filtered data consists mostly of small values with a somewhat + random distribution. In this case, the compression algorithm is tuned to + compress them better. The effect of Z_FILTERED is to force more Huffman + coding and less string matching; it is somewhat intermediate between + Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as + fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The + strategy parameter only affects the compression ratio but not the + correctness of the compressed output even if it is not set appropriately. + Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler + decoder for special applications. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid + method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is + incompatible with the version assumed by the caller (ZLIB_VERSION). msg is + set to null if there is no error message. deflateInit2 does not perform any + compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the compression dictionary from the given byte sequence + without producing any compressed output. When using the zlib format, this + function must be called immediately after deflateInit, deflateInit2 or + deflateReset, and before any call of deflate. When doing raw deflate, this + function must be called either before any call of deflate, or immediately + after the completion of a deflate block, i.e. after all input has been + consumed and all output has been delivered when using any of the flush + options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The + compressor and decompressor must use exactly the same dictionary (see + inflateSetDictionary). + + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and can be + predicted with good accuracy; the data can then be compressed better than + with the default empty dictionary. + + Depending on the size of the compression data structures selected by + deflateInit or deflateInit2, a part of the dictionary may in effect be + discarded, for example if the dictionary is larger than the window size + provided in deflateInit or deflateInit2. Thus the strings most likely to be + useful should be put at the end of the dictionary, not at the front. In + addition, the current implementation of deflate will use at most the window + size minus 262 bytes of the provided dictionary. + + Upon return of this function, strm->adler is set to the Adler-32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The Adler-32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) If a raw deflate was requested, then the + Adler-32 value is not computed and strm->adler is not set. + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent (for example if deflate has already been called for this stream + or if not at a block boundary for raw deflate). deflateSetDictionary does + not perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm, + Bytef *dictionary, + uInt *dictLength)); +/* + Returns the sliding dictionary being maintained by deflate. dictLength is + set to the number of bytes in the dictionary, and that many bytes are copied + to dictionary. dictionary must have enough space, where 32768 bytes is + always enough. If deflateGetDictionary() is called with dictionary equal to + Z_NULL, then only the dictionary length is returned, and nothing is copied. + Similary, if dictLength is Z_NULL, then it is not set. + + deflateGetDictionary() may return a length less than the window size, even + when more than the window size in input has been provided. It may return up + to 258 bytes less in that case, due to how zlib's implementation of deflate + manages the sliding window and lookahead for matches, where matches can be + up to 258 bytes long. If the application needs the last window-size bytes of + input, then that would need to be saved by the application outside of zlib. + + deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the + stream state is inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and can + consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); +/* + This function is equivalent to deflateEnd followed by deflateInit, but + does not free and reallocate the internal compression state. The stream + will leave the compression level and any other attributes that may have been + set unchanged. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, + int level, + int strategy)); +/* + Dynamically update the compression level and compression strategy. The + interpretation of level and strategy is as in deflateInit2(). This can be + used to switch between compression and straight copy of the input data, or + to switch to a different kind of input data requiring a different strategy. + If the compression approach (which is a function of the level) or the + strategy is changed, and if any input has been consumed in a previous + deflate() call, then the input available so far is compressed with the old + level and strategy using deflate(strm, Z_BLOCK). There are three approaches + for the compression levels 0, 1..3, and 4..9 respectively. The new level + and strategy will take effect at the next call of deflate(). + + If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does + not have enough output space to complete, then the parameter change will not + take effect. In this case, deflateParams() can be called again with the + same parameters and more output space to try again. + + In order to assure a change in the parameters on the first try, the + deflate stream should be flushed using deflate() with Z_BLOCK or other flush + request until strm.avail_out is not zero, before calling deflateParams(). + Then no more input data should be provided before the deflateParams() call. + If this is done, the old level and strategy will be applied to the data + compressed before deflateParams(), and the new level and strategy will be + applied to the the data compressed after deflateParams(). + + deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream + state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if + there was not enough output space to complete the compression of the + available input data before a change in the strategy or approach. Note that + in the case of a Z_BUF_ERROR, the parameters are not changed. A return + value of Z_BUF_ERROR is not fatal, in which case deflateParams() can be + retried with more output space. +*/ + +ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, + int good_length, + int max_lazy, + int nice_length, + int max_chain)); +/* + Fine tune deflate's internal compression parameters. This should only be + used by someone who understands the algorithm used by zlib's deflate for + searching for the best matching string, and even then only by the most + fanatic optimizer trying to squeeze out the last compressed bit for their + specific input data. Read the deflate.c source code for the meaning of the + max_lazy, good_length, nice_length, and max_chain parameters. + + deflateTune() can be called after deflateInit() or deflateInit2(), and + returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. + */ + +ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, + uLong sourceLen)); +/* + deflateBound() returns an upper bound on the compressed size after + deflation of sourceLen bytes. It must be called after deflateInit() or + deflateInit2(), and after deflateSetHeader(), if used. This would be used + to allocate an output buffer for deflation in a single pass, and so would be + called before deflate(). If that first deflate() call is provided the + sourceLen input bytes, an output buffer allocated to the size returned by + deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed + to return Z_STREAM_END. Note that it is possible for the compressed size to + be larger than the value returned by deflateBound() if flush options other + than Z_FINISH or Z_NO_FLUSH are used. +*/ + +ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, + unsigned *pending, + int *bits)); +/* + deflatePending() returns the number of bytes and bits of output that have + been generated, but not yet provided in the available output. The bytes not + provided would be due to the available output space having being consumed. + The number of bits of output not provided are between 0 and 7, where they + await more bits to join them in order to fill out a full byte. If pending + or bits are Z_NULL, then those values are not set. + + deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. + */ + +ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + deflatePrime() inserts bits in the deflate output stream. The intent + is that this function is used to start off the deflate output with the bits + leftover from a previous deflate stream when appending to it. As such, this + function can only be used for raw deflate, and must be used before the first + deflate() call after a deflateInit2() or deflateReset(). bits must be less + than or equal to 16, and that many of the least significant bits of value + will be inserted in the output. + + deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough + room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the + source stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, + gz_headerp head)); +/* + deflateSetHeader() provides gzip header information for when a gzip + stream is requested by deflateInit2(). deflateSetHeader() may be called + after deflateInit2() or deflateReset() and before the first call of + deflate(). The text, time, os, extra field, name, and comment information + in the provided gz_header structure are written to the gzip header (xflag is + ignored -- the extra flags are set according to the compression level). The + caller must assure that, if not Z_NULL, name and comment are terminated with + a zero byte, and that if extra is not Z_NULL, that extra_len bytes are + available there. If hcrc is true, a gzip header crc is included. Note that + the current versions of the command-line version of gzip (up through version + 1.3.x) do not support header crc's, and will report that it is a "multi-part + gzip file" and give up. + + If deflateSetHeader is not used, the default gzip header has text false, + the time set to zero, and os set to 255, with no extra, name, or comment + fields. The gzip header is returned to the default state by deflateReset(). + + deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, + int windowBits)); + + This is another version of inflateInit with an extra parameter. The + fields next_in, avail_in, zalloc, zfree and opaque must be initialized + before by the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library. The default value is 15 if inflateInit is used + instead. windowBits must be greater than or equal to the windowBits value + provided to deflateInit2() while compressing, or it must be equal to 15 if + deflateInit2() was not used. If a compressed stream with a larger window + size is given as input, inflate() will return with the error code + Z_DATA_ERROR instead of trying to allocate a larger window. + + windowBits can also be zero to request that inflate use the window size in + the zlib header of the compressed stream. + + windowBits can also be -8..-15 for raw inflate. In this case, -windowBits + determines the window size. inflate() will then process raw deflate data, + not looking for a zlib or gzip header, not generating a check value, and not + looking for any check values for comparison at the end of the stream. This + is for use with other formats that use the deflate compressed data format + such as zip. Those formats provide their own check values. If a custom + format is developed using the raw deflate format for compressed data, it is + recommended that a check value such as an Adler-32 or a CRC-32 be applied to + the uncompressed data as is done in the zlib, gzip, and zip formats. For + most applications, the zlib format should be used as is. Note that comments + above on the use in deflateInit2() applies to the magnitude of windowBits. + + windowBits can also be greater than 15 for optional gzip decoding. Add + 32 to windowBits to enable zlib and gzip decoding with automatic header + detection, or add 16 to decode only the gzip format (the zlib format will + return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a + CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see + below), inflate() will not automatically decode concatenated gzip streams. + inflate() will return Z_STREAM_END at the end of the gzip stream. The state + would need to be reset to continue decoding a subsequent gzip stream. + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit2 does not perform any decompression + apart from possibly reading the zlib header if present: actual decompression + will be done by inflate(). (So next_in and avail_in may be modified, but + next_out and avail_out are unused and unchanged.) The current implementation + of inflateInit2() does not process any header information -- that is + deferred until inflate() is called. +*/ + +ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the decompression dictionary from the given uncompressed byte + sequence. This function must be called immediately after a call of inflate, + if that call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the Adler-32 value returned by that call of inflate. + The compressor and decompressor must use exactly the same dictionary (see + deflateSetDictionary). For raw inflate, this function can be called at any + time to set the dictionary. If the provided dictionary is smaller than the + window and there is already data in the window, then the provided dictionary + will amend what's there. The application must insure that the dictionary + that was used for compression is provided. + + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the + expected one (incorrect Adler-32 value). inflateSetDictionary does not + perform any decompression: this will be done by subsequent calls of + inflate(). +*/ + +ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, + Bytef *dictionary, + uInt *dictLength)); +/* + Returns the sliding dictionary being maintained by inflate. dictLength is + set to the number of bytes in the dictionary, and that many bytes are copied + to dictionary. dictionary must have enough space, where 32768 bytes is + always enough. If inflateGetDictionary() is called with dictionary equal to + Z_NULL, then only the dictionary length is returned, and nothing is copied. + Similary, if dictLength is Z_NULL, then it is not set. + + inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the + stream state is inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); +/* + Skips invalid compressed data until a possible full flush point (see above + for the description of deflate with Z_FULL_FLUSH) can be found, or until all + available input is skipped. No output is provided. + + inflateSync searches for a 00 00 FF FF pattern in the compressed data. + All full flush points have this pattern, but not all occurrences of this + pattern are full flush points. + + inflateSync returns Z_OK if a possible full flush point has been found, + Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point + has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. + In the success case, the application may save the current current value of + total_in which indicates where valid compressed data was found. In the + error case, the application may repeatedly call inflateSync, providing more + input each time, until success or end of the input data. +*/ + +ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when randomly accessing a large stream. The + first pass through the stream can periodically record the inflate state, + allowing restarting inflate at those points when randomly accessing the + stream. + + inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); +/* + This function is equivalent to inflateEnd followed by inflateInit, + but does not free and reallocate the internal decompression state. The + stream will keep attributes that may have been set by inflateInit2. + + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, + int windowBits)); +/* + This function is the same as inflateReset, but it also permits changing + the wrap and window size requests. The windowBits parameter is interpreted + the same as it is for inflateInit2. If the window size is changed, then the + memory allocated for the window is freed, and the window will be reallocated + by inflate() if needed. + + inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL), or if + the windowBits parameter is invalid. +*/ + +ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + This function inserts bits in the inflate input stream. The intent is + that this function is used to start inflating at a bit position in the + middle of a byte. The provided bits will be used before any bytes are used + from next_in. This function should only be used with raw inflate, and + should be used before the first inflate() call after inflateInit2() or + inflateReset(). bits must be less than or equal to 16, and that many of the + least significant bits of value will be inserted in the input. + + If bits is negative, then the input stream bit buffer is emptied. Then + inflatePrime() can be called again to put bits in the buffer. This is used + to clear out bits leftover after feeding inflate a block description prior + to feeding inflate codes. + + inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); +/* + This function returns two values, one in the lower 16 bits of the return + value, and the other in the remaining upper bits, obtained by shifting the + return value down 16 bits. If the upper value is -1 and the lower value is + zero, then inflate() is currently decoding information outside of a block. + If the upper value is -1 and the lower value is non-zero, then inflate is in + the middle of a stored block, with the lower value equaling the number of + bytes from the input remaining to copy. If the upper value is not -1, then + it is the number of bits back from the current bit position in the input of + the code (literal or length/distance pair) currently being processed. In + that case the lower value is the number of bytes already emitted for that + code. + + A code is being processed if inflate is waiting for more input to complete + decoding of the code, or if it has completed decoding but is waiting for + more output space to write the literal or match data. + + inflateMark() is used to mark locations in the input data for random + access, which may be at bit positions, and to note those cases where the + output of a code may span boundaries of random access blocks. The current + location in the input stream can be determined from avail_in and data_type + as noted in the description for the Z_BLOCK flush parameter for inflate. + + inflateMark returns the value noted above, or -65536 if the provided + source stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, + gz_headerp head)); +/* + inflateGetHeader() requests that gzip header information be stored in the + provided gz_header structure. inflateGetHeader() may be called after + inflateInit2() or inflateReset(), and before the first call of inflate(). + As inflate() processes the gzip stream, head->done is zero until the header + is completed, at which time head->done is set to one. If a zlib stream is + being decoded, then head->done is set to -1 to indicate that there will be + no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be + used to force inflate() to return immediately after header processing is + complete and before any actual data is decompressed. + + The text, time, xflags, and os fields are filled in with the gzip header + contents. hcrc is set to true if there is a header CRC. (The header CRC + was valid if done is set to one.) If extra is not Z_NULL, then extra_max + contains the maximum number of bytes to write to extra. Once done is true, + extra_len contains the actual extra field length, and extra contains the + extra field, or that field truncated if extra_max is less than extra_len. + If name is not Z_NULL, then up to name_max characters are written there, + terminated with a zero unless the length is greater than name_max. If + comment is not Z_NULL, then up to comm_max characters are written there, + terminated with a zero unless the length is greater than comm_max. When any + of extra, name, or comment are not Z_NULL and the respective field is not + present in the header, then that field is set to Z_NULL to signal its + absence. This allows the use of deflateSetHeader() with the returned + structure to duplicate the header. However if those fields are set to + allocated memory, then the application will need to save those pointers + elsewhere so that they can be eventually freed. + + If inflateGetHeader is not used, then the header information is simply + discarded. The header is always checked for validity, including the header + CRC if present. inflateReset() will reset the process to discard the header + information. The application would need to call inflateGetHeader() again to + retrieve the header from the next gzip stream. + + inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, + unsigned char FAR *window)); + + Initialize the internal stream state for decompression using inflateBack() + calls. The fields zalloc, zfree and opaque in strm must be initialized + before the call. If zalloc and zfree are Z_NULL, then the default library- + derived memory allocation routines are used. windowBits is the base two + logarithm of the window size, in the range 8..15. window is a caller + supplied buffer of that size. Except for special applications where it is + assured that deflate was used with small window sizes, windowBits must be 15 + and a 32K byte window must be supplied to be able to decompress general + deflate streams. + + See inflateBack() for the usage of these routines. + + inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of + the parameters are invalid, Z_MEM_ERROR if the internal state could not be + allocated, or Z_VERSION_ERROR if the version of the library does not match + the version of the header file. +*/ + +typedef unsigned (*in_func) OF((void FAR *, + z_const unsigned char FAR * FAR *)); +typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); + +ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, + in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc)); +/* + inflateBack() does a raw inflate with a single call using a call-back + interface for input and output. This is potentially more efficient than + inflate() for file i/o applications, in that it avoids copying between the + output and the sliding window by simply making the window itself the output + buffer. inflate() can be faster on modern CPUs when used with large + buffers. inflateBack() trusts the application to not change the output + buffer passed by the output function, at least until inflateBack() returns. + + inflateBackInit() must be called first to allocate the internal state + and to initialize the state with the user-provided window buffer. + inflateBack() may then be used multiple times to inflate a complete, raw + deflate stream with each call. inflateBackEnd() is then called to free the + allocated state. + + A raw deflate stream is one with no zlib or gzip header or trailer. + This routine would normally be used in a utility that reads zip or gzip + files and writes out uncompressed files. The utility would decode the + header and process the trailer on its own, hence this routine expects only + the raw deflate stream to decompress. This is different from the default + behavior of inflate(), which expects a zlib header and trailer around the + deflate stream. + + inflateBack() uses two subroutines supplied by the caller that are then + called by inflateBack() for input and output. inflateBack() calls those + routines until it reads a complete deflate stream and writes out all of the + uncompressed data, or until it encounters an error. The function's + parameters and return types are defined above in the in_func and out_func + typedefs. inflateBack() will call in(in_desc, &buf) which should return the + number of bytes of provided input, and a pointer to that input in buf. If + there is no input available, in() must return zero -- buf is ignored in that + case -- and inflateBack() will return a buffer error. inflateBack() will + call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. + out() should return zero on success, or non-zero on failure. If out() + returns non-zero, inflateBack() will return with an error. Neither in() nor + out() are permitted to change the contents of the window provided to + inflateBackInit(), which is also the buffer that out() uses to write from. + The length written by out() will be at most the window size. Any non-zero + amount of input may be provided by in(). + + For convenience, inflateBack() can be provided input on the first call by + setting strm->next_in and strm->avail_in. If that input is exhausted, then + in() will be called. Therefore strm->next_in must be initialized before + calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called + immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in + must also be initialized, and then if strm->avail_in is not zero, input will + initially be taken from strm->next_in[0 .. strm->avail_in - 1]. + + The in_desc and out_desc parameters of inflateBack() is passed as the + first parameter of in() and out() respectively when they are called. These + descriptors can be optionally used to pass any information that the caller- + supplied in() and out() functions need to do their job. + + On return, inflateBack() will set strm->next_in and strm->avail_in to + pass back any unused input that was provided by the last in() call. The + return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR + if in() or out() returned an error, Z_DATA_ERROR if there was a format error + in the deflate stream (in which case strm->msg is set to indicate the nature + of the error), or Z_STREAM_ERROR if the stream was not properly initialized. + In the case of Z_BUF_ERROR, an input or output error can be distinguished + using strm->next_in which will be Z_NULL only if in() returned an error. If + strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning + non-zero. (in() will always be called before out(), so strm->next_in is + assured to be defined if out() returns non-zero.) Note that inflateBack() + cannot return Z_OK. +*/ + +ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); +/* + All memory allocated by inflateBackInit() is freed. + + inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream + state was inconsistent. +*/ + +ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); +/* Return flags indicating compile-time options. + + Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: + 1.0: size of uInt + 3.2: size of uLong + 5.4: size of voidpf (pointer) + 7.6: size of z_off_t + + Compiler, assembler, and debug options: + 8: ZLIB_DEBUG + 9: ASMV or ASMINF -- use ASM code + 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention + 11: 0 (reserved) + + One-time table building (smaller code, but not thread-safe if true): + 12: BUILDFIXED -- build static block decoding tables when needed + 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed + 14,15: 0 (reserved) + + Library content (indicates missing functionality): + 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking + deflate code when not needed) + 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect + and decode gzip streams (to avoid linking crc code) + 18-19: 0 (reserved) + + Operation variations (changes in library functionality): + 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate + 21: FASTEST -- deflate algorithm with only one, lowest compression level + 22,23: 0 (reserved) + + The sprintf variant used by gzprintf (zero is best): + 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format + 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! + 26: 0 = returns value, 1 = void -- 1 means inferred string length returned + + Remainder: + 27-31: 0 (reserved) + */ + +#ifndef Z_SOLO + + /* utility functions */ + +/* + The following utility functions are implemented on top of the basic + stream-oriented functions. To simplify the interface, some default options + are assumed (compression level and memory usage, standard memory allocation + functions). The source code of these utility functions can be modified if + you need special options. +*/ + +ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Compresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total size + of the destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed data. compress() is equivalent to compress2() with a level + parameter of Z_DEFAULT_COMPRESSION. + + compress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer. +*/ + +ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level)); +/* + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed data. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ + +ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); +/* + compressBound() returns an upper bound on the compressed size after + compress() or compress2() on sourceLen bytes. It would be used before a + compress() or compress2() call to allocate the destination buffer. +*/ + +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total size + of the destination buffer, which must be large enough to hold the entire + uncompressed data. (The size of the uncompressed data must have been saved + previously by the compressor and transmitted to the decompressor by some + mechanism outside the scope of this compression library.) Upon exit, destLen + is the actual size of the uncompressed data. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In + the case where there is not enough room, uncompress() will fill the output + buffer with the uncompressed data up to that point. +*/ + +ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong *sourceLen)); +/* + Same as uncompress, except that sourceLen is a pointer, where the + length of the source is *sourceLen. On return, *sourceLen is the number of + source bytes consumed. +*/ + + /* gzip file access functions */ + +/* + This library supports reading and writing files in gzip (.gz) format with + an interface similar to that of stdio, using the functions that start with + "gz". The gzip format is different from the zlib format. gzip is a gzip + wrapper, documented in RFC 1952, wrapped around a deflate stream. +*/ + +typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ + +/* +ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); + + Opens a gzip (.gz) file for reading or writing. The mode parameter is as + in fopen ("rb" or "wb") but can also include a compression level ("wb9") or + a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only + compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' + for fixed code compression as in "wb9F". (See the description of + deflateInit2 for more information about the strategy parameter.) 'T' will + request transparent writing or appending with no compression and not using + the gzip format. + + "a" can be used instead of "w" to request that the gzip stream that will + be written be appended to the file. "+" will result in an error, since + reading and writing to the same gzip file is not supported. The addition of + "x" when writing will create the file exclusively, which fails if the file + already exists. On systems that support it, the addition of "e" when + reading or writing will set the flag to close the file on an execve() call. + + These functions, as well as gzip, will read and decode a sequence of gzip + streams in a file. The append function of gzopen() can be used to create + such a file. (Also see gzflush() for another way to do this.) When + appending, gzopen does not test whether the file begins with a gzip stream, + nor does it look for the end of the gzip streams to begin appending. gzopen + will simply append a gzip stream to the existing file. + + gzopen can be used to read a file which is not in gzip format; in this + case gzread will directly read from the file without decompression. When + reading, this will be detected automatically by looking for the magic two- + byte gzip header. + + gzopen returns NULL if the file could not be opened, if there was + insufficient memory to allocate the gzFile state, or if an invalid mode was + specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). + errno can be checked to determine if the reason gzopen failed was that the + file could not be opened. +*/ + +ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); +/* + gzdopen associates a gzFile with the file descriptor fd. File descriptors + are obtained from calls like open, dup, creat, pipe or fileno (if the file + has been previously opened with fopen). The mode parameter is as in gzopen. + + The next call of gzclose on the returned gzFile will also close the file + descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor + fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, + mode);. The duplicated descriptor should be saved to avoid a leak, since + gzdopen does not close fd if it fails. If you are using fileno() to get the + file descriptor from a FILE *, then you will have to use dup() to avoid + double-close()ing the file descriptor. Both gzclose() and fclose() will + close the associated file descriptor, so they need to have different file + descriptors. + + gzdopen returns NULL if there was insufficient memory to allocate the + gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not + provided, or '+' was provided), or if fd is -1. The file descriptor is not + used until the next gz* read, write, seek, or close operation, so gzdopen + will not detect if fd is invalid (unless fd is -1). +*/ + +ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); +/* + Set the internal buffer size used by this library's functions. The + default buffer size is 8192 bytes. This function must be called after + gzopen() or gzdopen(), and before any other calls that read or write the + file. The buffer memory allocation is always deferred to the first read or + write. Three times that size in buffer space is allocated. A larger buffer + size of, for example, 64K or 128K bytes will noticeably increase the speed + of decompression (reading). + + The new buffer size also affects the maximum length for gzprintf(). + + gzbuffer() returns 0 on success, or -1 on failure, such as being called + too late. +*/ + +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); +/* + Dynamically update the compression level or strategy. See the description + of deflateInit2 for the meaning of these parameters. Previously provided + data is flushed before the parameter change. + + gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not + opened for writing, Z_ERRNO if there is an error writing the flushed data, + or Z_MEM_ERROR if there is a memory allocation error. +*/ + +ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); +/* + Reads the given number of uncompressed bytes from the compressed file. If + the input file is not in gzip format, gzread copies the given number of + bytes into the buffer directly from the file. + + After reaching the end of a gzip stream in the input, gzread will continue + to read, looking for another gzip stream. Any number of gzip streams may be + concatenated in the input file, and will all be decompressed by gzread(). + If something other than a gzip stream is encountered after a gzip stream, + that remaining trailing garbage is ignored (and no error is returned). + + gzread can be used to read a gzip file that is being concurrently written. + Upon reaching the end of the input, gzread will return with the available + data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then + gzclearerr can be used to clear the end of file indicator in order to permit + gzread to be tried again. Z_OK indicates that a gzip stream was completed + on the last gzread. Z_BUF_ERROR indicates that the input file ended in the + middle of a gzip stream. Note that gzread does not return -1 in the event + of an incomplete gzip stream. This error is deferred until gzclose(), which + will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip + stream. Alternatively, gzerror can be used before gzclose to detect this + case. + + gzread returns the number of uncompressed bytes actually read, less than + len for end of file, or -1 for error. If len is too large to fit in an int, + then nothing is read, -1 is returned, and the error state is set to + Z_STREAM_ERROR. +*/ + +ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems, + gzFile file)); +/* + Read up to nitems items of size size from file to buf, otherwise operating + as gzread() does. This duplicates the interface of stdio's fread(), with + size_t request and return types. If the library defines size_t, then + z_size_t is identical to size_t. If not, then z_size_t is an unsigned + integer type that can contain a pointer. + + gzfread() returns the number of full items read of size size, or zero if + the end of the file was reached and a full item could not be read, or if + there was an error. gzerror() must be consulted if zero is returned in + order to determine if there was an error. If the multiplication of size and + nitems overflows, i.e. the product does not fit in a z_size_t, then nothing + is read, zero is returned, and the error state is set to Z_STREAM_ERROR. + + In the event that the end of file is reached and only a partial item is + available at the end, i.e. the remaining uncompressed data length is not a + multiple of size, then the final partial item is nevetheless read into buf + and the end-of-file flag is set. The length of the partial item read is not + provided, but could be inferred from the result of gztell(). This behavior + is the same as the behavior of fread() implementations in common libraries, + but it prevents the direct use of gzfread() to read a concurrently written + file, reseting and retrying on end-of-file, when size is not 1. +*/ + +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, + voidpc buf, unsigned len)); +/* + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of uncompressed bytes written or 0 in case of + error. +*/ + +ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size, + z_size_t nitems, gzFile file)); +/* + gzfwrite() writes nitems items of size size from buf to file, duplicating + the interface of stdio's fwrite(), with size_t request and return types. If + the library defines size_t, then z_size_t is identical to size_t. If not, + then z_size_t is an unsigned integer type that can contain a pointer. + + gzfwrite() returns the number of full items written of size size, or zero + if there was an error. If the multiplication of size and nitems overflows, + i.e. the product does not fit in a z_size_t, then nothing is written, zero + is returned, and the error state is set to Z_STREAM_ERROR. +*/ + +ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); +/* + Converts, formats, and writes the arguments to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written, or a negative zlib error code in case + of error. The number of uncompressed bytes written is limited to 8191, or + one less than the buffer size given to gzbuffer(). The caller should assure + that this limit is not exceeded. If it is exceeded, then gzprintf() will + return an error (0) with nothing written. In this case, there may also be a + buffer overflow with unpredictable consequences, which is possible only if + zlib was compiled with the insecure functions sprintf() or vsprintf() + because the secure snprintf() or vsnprintf() functions were not available. + This can be determined using zlibCompileFlags(). +*/ + +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); +/* + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. + + gzputs returns the number of characters written, or -1 in case of error. +*/ + +ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); +/* + Reads bytes from the compressed file until len-1 characters are read, or a + newline character is read and transferred to buf, or an end-of-file + condition is encountered. If any characters are read or if len == 1, the + string is terminated with a null character. If no characters are read due + to an end-of-file or len < 1, then the buffer is left untouched. + + gzgets returns buf which is a null-terminated string, or it returns NULL + for end-of-file or in case of error. If there was an error, the contents at + buf are indeterminate. +*/ + +ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); +/* + Writes c, converted to an unsigned char, into the compressed file. gzputc + returns the value that was written, or -1 in case of error. +*/ + +ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); +/* + Reads one byte from the compressed file. gzgetc returns this byte or -1 + in case of end of file or error. This is implemented as a macro for speed. + As such, it does not do all of the checking the other functions do. I.e. + it does not check to see if file is NULL, nor whether the structure file + points to has been clobbered or not. +*/ + +ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); +/* + Push one character back onto the stream to be read as the first character + on the next read. At least one character of push-back is allowed. + gzungetc() returns the character pushed, or -1 on failure. gzungetc() will + fail if c is -1, and may fail if a character has been pushed but not read + yet. If gzungetc is used immediately after gzopen or gzdopen, at least the + output buffer size of pushed characters is allowed. (See gzbuffer above.) + The pushed character will be discarded if the stream is repositioned with + gzseek() or gzrewind(). +*/ + +ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); +/* + Flushes all pending output into the compressed file. The parameter flush + is as in the deflate() function. The return value is the zlib error number + (see function gzerror below). gzflush is only permitted when writing. + + If the flush parameter is Z_FINISH, the remaining data is written and the + gzip stream is completed in the output. If gzwrite() is called again, a new + gzip stream will be started in the output. gzread() is able to read such + concatenated gzip streams. + + gzflush should be called only when strictly necessary because it will + degrade compression if called too often. +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, + z_off_t offset, int whence)); + + Sets the starting position for the next gzread or gzwrite on the given + compressed file. The offset represents a number of bytes in the + uncompressed data stream. The whence parameter is defined as in lseek(2); + the value SEEK_END is not supported. + + If the file is opened for reading, this function is emulated but can be + extremely slow. If the file is opened for writing, only forward seeks are + supported; gzseek then compresses a sequence of zeroes up to the new + starting position. + + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error, in + particular if the file is opened for writing and the new starting position + would be before the current position. +*/ + +ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); +/* + Rewinds the given file. This function is supported only for reading. + + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) +*/ + +/* +ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); + + Returns the starting position for the next gzread or gzwrite on the given + compressed file. This position represents a number of bytes in the + uncompressed data stream, and is zero when starting, even if appending or + reading a gzip stream from the middle of a file using gzdopen(). + + gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); + + Returns the current offset in the file being read or written. This offset + includes the count of bytes that precede the gzip stream, for example when + appending or when using gzdopen() for reading. When reading, the offset + does not include as yet unused buffered input. This information can be used + for a progress indicator. On error, gzoffset() returns -1. +*/ + +ZEXTERN int ZEXPORT gzeof OF((gzFile file)); +/* + Returns true (1) if the end-of-file indicator has been set while reading, + false (0) otherwise. Note that the end-of-file indicator is set only if the + read tried to go past the end of the input, but came up short. Therefore, + just like feof(), gzeof() may return false even if there is no more data to + read, in the event that the last read request was for the exact number of + bytes remaining in the input file. This will happen if the input file size + is an exact multiple of the buffer size. + + If gzeof() returns true, then the read functions will return no more data, + unless the end-of-file indicator is reset by gzclearerr() and the input file + has grown since the previous end of file was detected. +*/ + +ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); +/* + Returns true (1) if file is being copied directly while reading, or false + (0) if file is a gzip stream being decompressed. + + If the input file is empty, gzdirect() will return true, since the input + does not contain a gzip stream. + + If gzdirect() is used immediately after gzopen() or gzdopen() it will + cause buffers to be allocated to allow reading the file to determine if it + is a gzip file. Therefore if gzbuffer() is used, it should be called before + gzdirect(). + + When writing, gzdirect() returns true (1) if transparent writing was + requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: + gzdirect() is not needed when writing. Transparent writing must be + explicitly requested, so the application already knows the answer. When + linking statically, using gzdirect() will include all of the zlib code for + gzip file reading and decompression, which may not be desired.) +*/ + +ZEXTERN int ZEXPORT gzclose OF((gzFile file)); +/* + Flushes all pending output if necessary, closes the compressed file and + deallocates the (de)compression state. Note that once file is closed, you + cannot call gzerror with file, since its structures have been deallocated. + gzclose must not be called more than once on the same file, just as free + must not be called more than once on the same allocation. + + gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a + file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the + last read ended in the middle of a gzip stream, or Z_OK on success. +*/ + +ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); +ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); +/* + Same as gzclose(), but gzclose_r() is only for use when reading, and + gzclose_w() is only for use when writing or appending. The advantage to + using these instead of gzclose() is that they avoid linking in zlib + compression or decompression code that is not used when only reading or only + writing respectively. If gzclose() is used, then both compression and + decompression code will be included the application when linking to a static + zlib library. +*/ + +ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); +/* + Returns the error message for the last error which occurred on the given + compressed file. errnum is set to zlib error number. If an error occurred + in the file system and not in the compression library, errnum is set to + Z_ERRNO and the application may consult errno to get the exact error code. + + The application must not modify the returned string. Future calls to + this function may invalidate the previously returned string. If file is + closed, then the string previously returned by gzerror will no longer be + available. + + gzerror() should be used to distinguish errors from end-of-file for those + functions above that do not distinguish those cases in their return values. +*/ + +ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); +/* + Clears the error and end-of-file flags for file. This is analogous to the + clearerr() function in stdio. This is useful for continuing to read a gzip + file that is being written concurrently. +*/ + +#endif /* !Z_SOLO */ + + /* checksum functions */ + +/* + These functions are not related to compression but are exported + anyway because they might be useful in applications using the compression + library. +*/ + +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); +/* + Update a running Adler-32 checksum with the bytes buf[0..len-1] and + return the updated checksum. If buf is Z_NULL, this function returns the + required initial value for the checksum. + + An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed + much faster. + + Usage example: + + uLong adler = adler32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); +*/ + +ZEXTERN uLong ZEXPORT adler32_z OF((uLong adler, const Bytef *buf, + z_size_t len)); +/* + Same as adler32(), but with a size_t length. +*/ + +/* +ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, + z_off_t len2)); + + Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 + and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for + each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of + seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note + that the z_off_t type (like off_t) is a signed integer. If len2 is + negative, the result has no meaning or utility. +*/ + +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +/* + Update a running CRC-32 with the bytes buf[0..len-1] and return the + updated CRC-32. If buf is Z_NULL, this function returns the required + initial value for the crc. Pre- and post-conditioning (one's complement) is + performed within this function so it shouldn't be done by the application. + + Usage example: + + uLong crc = crc32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); +*/ + +ZEXTERN uLong ZEXPORT crc32_z OF((uLong adler, const Bytef *buf, + z_size_t len)); +/* + Same as crc32(), but with a size_t length. +*/ + +/* +ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); + + Combine two CRC-32 check values into one. For two sequences of bytes, + seq1 and seq2 with lengths len1 and len2, CRC-32 check values were + calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 + check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and + len2. +*/ + + + /* various hacks, don't look :) */ + +/* deflateInit and inflateInit are macros to allow checking the zlib version + * and the compiler's view of z_stream: + */ +ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size)); +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, + unsigned char FAR *window, + const char *version, + int stream_size)); +#ifdef Z_PREFIX_SET +# define z_deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) +# define z_inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) +# define z_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) +# define z_inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ + (int)sizeof(z_stream)) +# define z_inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, (int)sizeof(z_stream)) +#else +# define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) +# define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) +# define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) +# define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ + (int)sizeof(z_stream)) +# define inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, (int)sizeof(z_stream)) +#endif + +#ifndef Z_SOLO + +/* gzgetc() macro and its supporting function and exposed data structure. Note + * that the real internal state is much larger than the exposed structure. + * This abbreviated structure exposes just enough for the gzgetc() macro. The + * user should not mess with these exposed elements, since their names or + * behavior could change in the future, perhaps even capriciously. They can + * only be used by the gzgetc() macro. You have been warned. + */ +struct gzFile_s { + unsigned have; + unsigned char *next; + z_off64_t pos; +}; +ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ +#ifdef Z_PREFIX_SET +# undef z_gzgetc +# define z_gzgetc(g) \ + ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) +#else +# define gzgetc(g) \ + ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) +#endif + +/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or + * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if + * both are true, the application gets the *64 functions, and the regular + * functions are changed to 64 bits) -- in case these are set on systems + * without large file support, _LFS64_LARGEFILE must also be true + */ +#ifdef Z_LARGE64 + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); + ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); +#endif + +#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) +# ifdef Z_PREFIX_SET +# define z_gzopen z_gzopen64 +# define z_gzseek z_gzseek64 +# define z_gztell z_gztell64 +# define z_gzoffset z_gzoffset64 +# define z_adler32_combine z_adler32_combine64 +# define z_crc32_combine z_crc32_combine64 +# else +# define gzopen gzopen64 +# define gzseek gzseek64 +# define gztell gztell64 +# define gzoffset gzoffset64 +# define adler32_combine adler32_combine64 +# define crc32_combine crc32_combine64 +# endif +# ifndef Z_LARGE64 + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); + ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); +# endif +#else + ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); + ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); + ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); + ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); +#endif + +#else /* Z_SOLO */ + + ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); + +#endif /* !Z_SOLO */ + +/* undocumented functions */ +ZEXTERN const char * ZEXPORT zError OF((int)); +ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); +ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); +ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); +ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int)); +ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF ((z_streamp)); +ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); +ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); +#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(Z_SOLO) +ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, + const char *mode)); +#endif +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifndef Z_SOLO +ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, + const char *format, + va_list va)); +# endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* ZLIB_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include-fixed/limits.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include-fixed/limits.h new file mode 100644 index 0000000..743481d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include-fixed/limits.h @@ -0,0 +1,197 @@ +/* Copyright (C) 1992-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +/* This administrivia gets added to the beginning of limits.h + if the system has its own version of limits.h. */ + +/* We use _GCC_LIMITS_H_ because we want this not to match + any macros that the system's limits.h uses for its own purposes. */ +#ifndef _GCC_LIMITS_H_ /* Terminated in limity.h. */ +#define _GCC_LIMITS_H_ + +#ifndef _LIBC_LIMITS_H_ +/* Use "..." so that we find syslimits.h only in this same directory. */ +#include "syslimits.h" +#endif +/* Copyright (C) 1991-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +#ifndef _LIMITS_H___ +#define _LIMITS_H___ + +/* Number of bits in a `char'. */ +#undef CHAR_BIT +#define CHAR_BIT __CHAR_BIT__ + +/* Maximum length of a multibyte character. */ +#ifndef MB_LEN_MAX +#define MB_LEN_MAX 1 +#endif + +/* Minimum and maximum values a `signed char' can hold. */ +#undef SCHAR_MIN +#define SCHAR_MIN (-SCHAR_MAX - 1) +#undef SCHAR_MAX +#define SCHAR_MAX __SCHAR_MAX__ + +/* Maximum value an `unsigned char' can hold. (Minimum is 0). */ +#undef UCHAR_MAX +#if __SCHAR_MAX__ == __INT_MAX__ +# define UCHAR_MAX (SCHAR_MAX * 2U + 1U) +#else +# define UCHAR_MAX (SCHAR_MAX * 2 + 1) +#endif + +/* Minimum and maximum values a `char' can hold. */ +#ifdef __CHAR_UNSIGNED__ +# undef CHAR_MIN +# if __SCHAR_MAX__ == __INT_MAX__ +# define CHAR_MIN 0U +# else +# define CHAR_MIN 0 +# endif +# undef CHAR_MAX +# define CHAR_MAX UCHAR_MAX +#else +# undef CHAR_MIN +# define CHAR_MIN SCHAR_MIN +# undef CHAR_MAX +# define CHAR_MAX SCHAR_MAX +#endif + +/* Minimum and maximum values a `signed short int' can hold. */ +#undef SHRT_MIN +#define SHRT_MIN (-SHRT_MAX - 1) +#undef SHRT_MAX +#define SHRT_MAX __SHRT_MAX__ + +/* Maximum value an `unsigned short int' can hold. (Minimum is 0). */ +#undef USHRT_MAX +#if __SHRT_MAX__ == __INT_MAX__ +# define USHRT_MAX (SHRT_MAX * 2U + 1U) +#else +# define USHRT_MAX (SHRT_MAX * 2 + 1) +#endif + +/* Minimum and maximum values a `signed int' can hold. */ +#undef INT_MIN +#define INT_MIN (-INT_MAX - 1) +#undef INT_MAX +#define INT_MAX __INT_MAX__ + +/* Maximum value an `unsigned int' can hold. (Minimum is 0). */ +#undef UINT_MAX +#define UINT_MAX (INT_MAX * 2U + 1U) + +/* Minimum and maximum values a `signed long int' can hold. + (Same as `int'). */ +#undef LONG_MIN +#define LONG_MIN (-LONG_MAX - 1L) +#undef LONG_MAX +#define LONG_MAX __LONG_MAX__ + +/* Maximum value an `unsigned long int' can hold. (Minimum is 0). */ +#undef ULONG_MAX +#define ULONG_MAX (LONG_MAX * 2UL + 1UL) + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +/* Minimum and maximum values a `signed long long int' can hold. */ +# undef LLONG_MIN +# define LLONG_MIN (-LLONG_MAX - 1LL) +# undef LLONG_MAX +# define LLONG_MAX __LONG_LONG_MAX__ + +/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */ +# undef ULLONG_MAX +# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) +#endif + +#if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__) +/* Minimum and maximum values a `signed long long int' can hold. */ +# undef LONG_LONG_MIN +# define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL) +# undef LONG_LONG_MAX +# define LONG_LONG_MAX __LONG_LONG_MAX__ + +/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */ +# undef ULONG_LONG_MAX +# define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1ULL) +#endif + +#ifdef __STDC_WANT_IEC_60559_BFP_EXT__ +/* TS 18661-1 widths of integer types. */ +# undef CHAR_WIDTH +# define CHAR_WIDTH __SCHAR_WIDTH__ +# undef SCHAR_WIDTH +# define SCHAR_WIDTH __SCHAR_WIDTH__ +# undef UCHAR_WIDTH +# define UCHAR_WIDTH __SCHAR_WIDTH__ +# undef SHRT_WIDTH +# define SHRT_WIDTH __SHRT_WIDTH__ +# undef USHRT_WIDTH +# define USHRT_WIDTH __SHRT_WIDTH__ +# undef INT_WIDTH +# define INT_WIDTH __INT_WIDTH__ +# undef UINT_WIDTH +# define UINT_WIDTH __INT_WIDTH__ +# undef LONG_WIDTH +# define LONG_WIDTH __LONG_WIDTH__ +# undef ULONG_WIDTH +# define ULONG_WIDTH __LONG_WIDTH__ +# undef LLONG_WIDTH +# define LLONG_WIDTH __LONG_LONG_WIDTH__ +# undef ULLONG_WIDTH +# define ULLONG_WIDTH __LONG_LONG_WIDTH__ +#endif + +#endif /* _LIMITS_H___ */ +/* This administrivia gets added to the end of limits.h + if the system has its own version of limits.h. */ + +#else /* not _GCC_LIMITS_H_ */ + +#ifdef _GCC_NEXT_LIMITS_H +#include_next /* recurse down to the real one */ +#endif + +#endif /* not _GCC_LIMITS_H_ */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include-fixed/syslimits.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include-fixed/syslimits.h new file mode 100644 index 0000000..a362802 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include-fixed/syslimits.h @@ -0,0 +1,8 @@ +/* syslimits.h stands for the system's own limits.h file. + If we can use it ok unmodified, then we install this text. + If fixincludes fixes it, then the fixed version is installed + instead of this text. */ + +#define _GCC_NEXT_LIMITS_H /* tell gcc's limits.h to recurse */ +#include_next +#undef _GCC_NEXT_LIMITS_H diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/float.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/float.h new file mode 100644 index 0000000..658017f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/float.h @@ -0,0 +1,506 @@ +/* Copyright (C) 2002-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +/* + * ISO C Standard: 5.2.4.2.2 Characteristics of floating types + */ + +#ifndef _FLOAT_H___ +#define _FLOAT_H___ + +/* Radix of exponent representation, b. */ +#undef FLT_RADIX +#define FLT_RADIX __FLT_RADIX__ + +/* Number of base-FLT_RADIX digits in the significand, p. */ +#undef FLT_MANT_DIG +#undef DBL_MANT_DIG +#undef LDBL_MANT_DIG +#define FLT_MANT_DIG __FLT_MANT_DIG__ +#define DBL_MANT_DIG __DBL_MANT_DIG__ +#define LDBL_MANT_DIG __LDBL_MANT_DIG__ + +/* Number of decimal digits, q, such that any floating-point number with q + decimal digits can be rounded into a floating-point number with p radix b + digits and back again without change to the q decimal digits, + + p * log10(b) if b is a power of 10 + floor((p - 1) * log10(b)) otherwise +*/ +#undef FLT_DIG +#undef DBL_DIG +#undef LDBL_DIG +#define FLT_DIG __FLT_DIG__ +#define DBL_DIG __DBL_DIG__ +#define LDBL_DIG __LDBL_DIG__ + +/* Minimum int x such that FLT_RADIX**(x-1) is a normalized float, emin */ +#undef FLT_MIN_EXP +#undef DBL_MIN_EXP +#undef LDBL_MIN_EXP +#define FLT_MIN_EXP __FLT_MIN_EXP__ +#define DBL_MIN_EXP __DBL_MIN_EXP__ +#define LDBL_MIN_EXP __LDBL_MIN_EXP__ + +/* Minimum negative integer such that 10 raised to that power is in the + range of normalized floating-point numbers, + + ceil(log10(b) * (emin - 1)) +*/ +#undef FLT_MIN_10_EXP +#undef DBL_MIN_10_EXP +#undef LDBL_MIN_10_EXP +#define FLT_MIN_10_EXP __FLT_MIN_10_EXP__ +#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__ +#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__ + +/* Maximum int x such that FLT_RADIX**(x-1) is a representable float, emax. */ +#undef FLT_MAX_EXP +#undef DBL_MAX_EXP +#undef LDBL_MAX_EXP +#define FLT_MAX_EXP __FLT_MAX_EXP__ +#define DBL_MAX_EXP __DBL_MAX_EXP__ +#define LDBL_MAX_EXP __LDBL_MAX_EXP__ + +/* Maximum integer such that 10 raised to that power is in the range of + representable finite floating-point numbers, + + floor(log10((1 - b**-p) * b**emax)) +*/ +#undef FLT_MAX_10_EXP +#undef DBL_MAX_10_EXP +#undef LDBL_MAX_10_EXP +#define FLT_MAX_10_EXP __FLT_MAX_10_EXP__ +#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__ +#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__ + +/* Maximum representable finite floating-point number, + + (1 - b**-p) * b**emax +*/ +#undef FLT_MAX +#undef DBL_MAX +#undef LDBL_MAX +#define FLT_MAX __FLT_MAX__ +#define DBL_MAX __DBL_MAX__ +#define LDBL_MAX __LDBL_MAX__ + +/* The difference between 1 and the least value greater than 1 that is + representable in the given floating point type, b**1-p. */ +#undef FLT_EPSILON +#undef DBL_EPSILON +#undef LDBL_EPSILON +#define FLT_EPSILON __FLT_EPSILON__ +#define DBL_EPSILON __DBL_EPSILON__ +#define LDBL_EPSILON __LDBL_EPSILON__ + +/* Minimum normalized positive floating-point number, b**(emin - 1). */ +#undef FLT_MIN +#undef DBL_MIN +#undef LDBL_MIN +#define FLT_MIN __FLT_MIN__ +#define DBL_MIN __DBL_MIN__ +#define LDBL_MIN __LDBL_MIN__ + +/* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown. */ +/* ??? This is supposed to change with calls to fesetround in . */ +#undef FLT_ROUNDS +#define FLT_ROUNDS 1 + +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \ + || (defined (__cplusplus) && __cplusplus >= 201103L) +/* The floating-point expression evaluation method. The precise + definitions of these values are generalised to include support for + the interchange and extended types defined in ISO/IEC TS 18661-3. + Prior to this (for C99/C11) the definitions were: + + -1 indeterminate + 0 evaluate all operations and constants just to the range and + precision of the type + 1 evaluate operations and constants of type float and double + to the range and precision of the double type, evaluate + long double operations and constants to the range and + precision of the long double type + 2 evaluate all operations and constants to the range and + precision of the long double type + + The TS 18661-3 definitions are: + + -1 indeterminate + 0 evaluate all operations and constants, whose semantic type has + at most the range and precision of float, to the range and + precision of float; evaluate all other operations and constants + to the range and precision of the semantic type. + 1 evaluate all operations and constants, whose semantic type has + at most the range and precision of double, to the range and + precision of double; evaluate all other operations and constants + to the range and precision of the semantic type. + 2 evaluate all operations and constants, whose semantic type has + at most the range and precision of long double, to the range and + precision of long double; evaluate all other operations and + constants to the range and precision of the semantic type. + N where _FloatN is a supported interchange floating type + evaluate all operations and constants, whose semantic type has + at most the range and precision of the _FloatN type, to the + range and precision of the _FloatN type; evaluate all other + operations and constants to the range and precision of the + semantic type. + N + 1, where _FloatNx is a supported extended floating type + evaluate operations and constants, whose semantic type has at + most the range and precision of the _FloatNx type, to the range + and precision of the _FloatNx type; evaluate all other + operations and constants to the range and precision of the + semantic type. + + The compiler predefines two macros: + + __FLT_EVAL_METHOD__ + Which, depending on the value given for + -fpermitted-flt-eval-methods, may be limited to only those values + for FLT_EVAL_METHOD defined in C99/C11. + + __FLT_EVAL_METHOD_TS_18661_3__ + Which always permits the values for FLT_EVAL_METHOD defined in + ISO/IEC TS 18661-3. + + Here we want to use __FLT_EVAL_METHOD__, unless + __STDC_WANT_IEC_60559_TYPES_EXT__ is defined, in which case the user + is specifically asking for the ISO/IEC TS 18661-3 types, so we use + __FLT_EVAL_METHOD_TS_18661_3__. + + ??? This ought to change with the setting of the fp control word; + the value provided by the compiler assumes the widest setting. */ +#undef FLT_EVAL_METHOD +#ifdef __STDC_WANT_IEC_60559_TYPES_EXT__ +#define FLT_EVAL_METHOD __FLT_EVAL_METHOD_TS_18661_3__ +#else +#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ +#endif + +/* Number of decimal digits, n, such that any floating-point number in the + widest supported floating type with pmax radix b digits can be rounded + to a floating-point number with n decimal digits and back again without + change to the value, + + pmax * log10(b) if b is a power of 10 + ceil(1 + pmax * log10(b)) otherwise +*/ +#undef DECIMAL_DIG +#define DECIMAL_DIG __DECIMAL_DIG__ + +#endif /* C99 */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +/* Versions of DECIMAL_DIG for each floating-point type. */ +#undef FLT_DECIMAL_DIG +#undef DBL_DECIMAL_DIG +#undef LDBL_DECIMAL_DIG +#define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__ +#define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__ +#define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__ + +/* Whether types support subnormal numbers. */ +#undef FLT_HAS_SUBNORM +#undef DBL_HAS_SUBNORM +#undef LDBL_HAS_SUBNORM +#define FLT_HAS_SUBNORM __FLT_HAS_DENORM__ +#define DBL_HAS_SUBNORM __DBL_HAS_DENORM__ +#define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__ + +/* Minimum positive values, including subnormals. */ +#undef FLT_TRUE_MIN +#undef DBL_TRUE_MIN +#undef LDBL_TRUE_MIN +#define FLT_TRUE_MIN __FLT_DENORM_MIN__ +#define DBL_TRUE_MIN __DBL_DENORM_MIN__ +#define LDBL_TRUE_MIN __LDBL_DENORM_MIN__ + +#endif /* C11 */ + +#ifdef __STDC_WANT_IEC_60559_BFP_EXT__ +/* Number of decimal digits for which conversions between decimal + character strings and binary formats, in both directions, are + correctly rounded. */ +#define CR_DECIMAL_DIG __UINTMAX_MAX__ +#endif + +#ifdef __STDC_WANT_IEC_60559_TYPES_EXT__ +/* Constants for _FloatN and _FloatNx types from TS 18661-3. See + comments above for their semantics. */ + +#ifdef __FLT16_MANT_DIG__ +#undef FLT16_MANT_DIG +#define FLT16_MANT_DIG __FLT16_MANT_DIG__ +#undef FLT16_DIG +#define FLT16_DIG __FLT16_DIG__ +#undef FLT16_MIN_EXP +#define FLT16_MIN_EXP __FLT16_MIN_EXP__ +#undef FLT16_MIN_10_EXP +#define FLT16_MIN_10_EXP __FLT16_MIN_10_EXP__ +#undef FLT16_MAX_EXP +#define FLT16_MAX_EXP __FLT16_MAX_EXP__ +#undef FLT16_MAX_10_EXP +#define FLT16_MAX_10_EXP __FLT16_MAX_10_EXP__ +#undef FLT16_MAX +#define FLT16_MAX __FLT16_MAX__ +#undef FLT16_EPSILON +#define FLT16_EPSILON __FLT16_EPSILON__ +#undef FLT16_MIN +#define FLT16_MIN __FLT16_MIN__ +#undef FLT16_DECIMAL_DIG +#define FLT16_DECIMAL_DIG __FLT16_DECIMAL_DIG__ +#undef FLT16_TRUE_MIN +#define FLT16_TRUE_MIN __FLT16_DENORM_MIN__ +#endif /* __FLT16_MANT_DIG__. */ + +#ifdef __FLT32_MANT_DIG__ +#undef FLT32_MANT_DIG +#define FLT32_MANT_DIG __FLT32_MANT_DIG__ +#undef FLT32_DIG +#define FLT32_DIG __FLT32_DIG__ +#undef FLT32_MIN_EXP +#define FLT32_MIN_EXP __FLT32_MIN_EXP__ +#undef FLT32_MIN_10_EXP +#define FLT32_MIN_10_EXP __FLT32_MIN_10_EXP__ +#undef FLT32_MAX_EXP +#define FLT32_MAX_EXP __FLT32_MAX_EXP__ +#undef FLT32_MAX_10_EXP +#define FLT32_MAX_10_EXP __FLT32_MAX_10_EXP__ +#undef FLT32_MAX +#define FLT32_MAX __FLT32_MAX__ +#undef FLT32_EPSILON +#define FLT32_EPSILON __FLT32_EPSILON__ +#undef FLT32_MIN +#define FLT32_MIN __FLT32_MIN__ +#undef FLT32_DECIMAL_DIG +#define FLT32_DECIMAL_DIG __FLT32_DECIMAL_DIG__ +#undef FLT32_TRUE_MIN +#define FLT32_TRUE_MIN __FLT32_DENORM_MIN__ +#endif /* __FLT32_MANT_DIG__. */ + +#ifdef __FLT64_MANT_DIG__ +#undef FLT64_MANT_DIG +#define FLT64_MANT_DIG __FLT64_MANT_DIG__ +#undef FLT64_DIG +#define FLT64_DIG __FLT64_DIG__ +#undef FLT64_MIN_EXP +#define FLT64_MIN_EXP __FLT64_MIN_EXP__ +#undef FLT64_MIN_10_EXP +#define FLT64_MIN_10_EXP __FLT64_MIN_10_EXP__ +#undef FLT64_MAX_EXP +#define FLT64_MAX_EXP __FLT64_MAX_EXP__ +#undef FLT64_MAX_10_EXP +#define FLT64_MAX_10_EXP __FLT64_MAX_10_EXP__ +#undef FLT64_MAX +#define FLT64_MAX __FLT64_MAX__ +#undef FLT64_EPSILON +#define FLT64_EPSILON __FLT64_EPSILON__ +#undef FLT64_MIN +#define FLT64_MIN __FLT64_MIN__ +#undef FLT64_DECIMAL_DIG +#define FLT64_DECIMAL_DIG __FLT64_DECIMAL_DIG__ +#undef FLT64_TRUE_MIN +#define FLT64_TRUE_MIN __FLT64_DENORM_MIN__ +#endif /* __FLT64_MANT_DIG__. */ + +#ifdef __FLT128_MANT_DIG__ +#undef FLT128_MANT_DIG +#define FLT128_MANT_DIG __FLT128_MANT_DIG__ +#undef FLT128_DIG +#define FLT128_DIG __FLT128_DIG__ +#undef FLT128_MIN_EXP +#define FLT128_MIN_EXP __FLT128_MIN_EXP__ +#undef FLT128_MIN_10_EXP +#define FLT128_MIN_10_EXP __FLT128_MIN_10_EXP__ +#undef FLT128_MAX_EXP +#define FLT128_MAX_EXP __FLT128_MAX_EXP__ +#undef FLT128_MAX_10_EXP +#define FLT128_MAX_10_EXP __FLT128_MAX_10_EXP__ +#undef FLT128_MAX +#define FLT128_MAX __FLT128_MAX__ +#undef FLT128_EPSILON +#define FLT128_EPSILON __FLT128_EPSILON__ +#undef FLT128_MIN +#define FLT128_MIN __FLT128_MIN__ +#undef FLT128_DECIMAL_DIG +#define FLT128_DECIMAL_DIG __FLT128_DECIMAL_DIG__ +#undef FLT128_TRUE_MIN +#define FLT128_TRUE_MIN __FLT128_DENORM_MIN__ +#endif /* __FLT128_MANT_DIG__. */ + +#ifdef __FLT32X_MANT_DIG__ +#undef FLT32X_MANT_DIG +#define FLT32X_MANT_DIG __FLT32X_MANT_DIG__ +#undef FLT32X_DIG +#define FLT32X_DIG __FLT32X_DIG__ +#undef FLT32X_MIN_EXP +#define FLT32X_MIN_EXP __FLT32X_MIN_EXP__ +#undef FLT32X_MIN_10_EXP +#define FLT32X_MIN_10_EXP __FLT32X_MIN_10_EXP__ +#undef FLT32X_MAX_EXP +#define FLT32X_MAX_EXP __FLT32X_MAX_EXP__ +#undef FLT32X_MAX_10_EXP +#define FLT32X_MAX_10_EXP __FLT32X_MAX_10_EXP__ +#undef FLT32X_MAX +#define FLT32X_MAX __FLT32X_MAX__ +#undef FLT32X_EPSILON +#define FLT32X_EPSILON __FLT32X_EPSILON__ +#undef FLT32X_MIN +#define FLT32X_MIN __FLT32X_MIN__ +#undef FLT32X_DECIMAL_DIG +#define FLT32X_DECIMAL_DIG __FLT32X_DECIMAL_DIG__ +#undef FLT32X_TRUE_MIN +#define FLT32X_TRUE_MIN __FLT32X_DENORM_MIN__ +#endif /* __FLT32X_MANT_DIG__. */ + +#ifdef __FLT64X_MANT_DIG__ +#undef FLT64X_MANT_DIG +#define FLT64X_MANT_DIG __FLT64X_MANT_DIG__ +#undef FLT64X_DIG +#define FLT64X_DIG __FLT64X_DIG__ +#undef FLT64X_MIN_EXP +#define FLT64X_MIN_EXP __FLT64X_MIN_EXP__ +#undef FLT64X_MIN_10_EXP +#define FLT64X_MIN_10_EXP __FLT64X_MIN_10_EXP__ +#undef FLT64X_MAX_EXP +#define FLT64X_MAX_EXP __FLT64X_MAX_EXP__ +#undef FLT64X_MAX_10_EXP +#define FLT64X_MAX_10_EXP __FLT64X_MAX_10_EXP__ +#undef FLT64X_MAX +#define FLT64X_MAX __FLT64X_MAX__ +#undef FLT64X_EPSILON +#define FLT64X_EPSILON __FLT64X_EPSILON__ +#undef FLT64X_MIN +#define FLT64X_MIN __FLT64X_MIN__ +#undef FLT64X_DECIMAL_DIG +#define FLT64X_DECIMAL_DIG __FLT64X_DECIMAL_DIG__ +#undef FLT64X_TRUE_MIN +#define FLT64X_TRUE_MIN __FLT64X_DENORM_MIN__ +#endif /* __FLT64X_MANT_DIG__. */ + +#ifdef __FLT128X_MANT_DIG__ +#undef FLT128X_MANT_DIG +#define FLT128X_MANT_DIG __FLT128X_MANT_DIG__ +#undef FLT128X_DIG +#define FLT128X_DIG __FLT128X_DIG__ +#undef FLT128X_MIN_EXP +#define FLT128X_MIN_EXP __FLT128X_MIN_EXP__ +#undef FLT128X_MIN_10_EXP +#define FLT128X_MIN_10_EXP __FLT128X_MIN_10_EXP__ +#undef FLT128X_MAX_EXP +#define FLT128X_MAX_EXP __FLT128X_MAX_EXP__ +#undef FLT128X_MAX_10_EXP +#define FLT128X_MAX_10_EXP __FLT128X_MAX_10_EXP__ +#undef FLT128X_MAX +#define FLT128X_MAX __FLT128X_MAX__ +#undef FLT128X_EPSILON +#define FLT128X_EPSILON __FLT128X_EPSILON__ +#undef FLT128X_MIN +#define FLT128X_MIN __FLT128X_MIN__ +#undef FLT128X_DECIMAL_DIG +#define FLT128X_DECIMAL_DIG __FLT128X_DECIMAL_DIG__ +#undef FLT128X_TRUE_MIN +#define FLT128X_TRUE_MIN __FLT128X_DENORM_MIN__ +#endif /* __FLT128X_MANT_DIG__. */ + +#endif /* __STDC_WANT_IEC_60559_TYPES_EXT__. */ + +#ifdef __STDC_WANT_DEC_FP__ +/* Draft Technical Report 24732, extension for decimal floating-point + arithmetic: Characteristic of decimal floating types . */ + +/* Number of base-FLT_RADIX digits in the significand, p. */ +#undef DEC32_MANT_DIG +#undef DEC64_MANT_DIG +#undef DEC128_MANT_DIG +#define DEC32_MANT_DIG __DEC32_MANT_DIG__ +#define DEC64_MANT_DIG __DEC64_MANT_DIG__ +#define DEC128_MANT_DIG __DEC128_MANT_DIG__ + +/* Minimum exponent. */ +#undef DEC32_MIN_EXP +#undef DEC64_MIN_EXP +#undef DEC128_MIN_EXP +#define DEC32_MIN_EXP __DEC32_MIN_EXP__ +#define DEC64_MIN_EXP __DEC64_MIN_EXP__ +#define DEC128_MIN_EXP __DEC128_MIN_EXP__ + +/* Maximum exponent. */ +#undef DEC32_MAX_EXP +#undef DEC64_MAX_EXP +#undef DEC128_MAX_EXP +#define DEC32_MAX_EXP __DEC32_MAX_EXP__ +#define DEC64_MAX_EXP __DEC64_MAX_EXP__ +#define DEC128_MAX_EXP __DEC128_MAX_EXP__ + +/* Maximum representable finite decimal floating-point number + (there are 6, 15, and 33 9s after the decimal points respectively). */ +#undef DEC32_MAX +#undef DEC64_MAX +#undef DEC128_MAX +#define DEC32_MAX __DEC32_MAX__ +#define DEC64_MAX __DEC64_MAX__ +#define DEC128_MAX __DEC128_MAX__ + +/* The difference between 1 and the least value greater than 1 that is + representable in the given floating point type. */ +#undef DEC32_EPSILON +#undef DEC64_EPSILON +#undef DEC128_EPSILON +#define DEC32_EPSILON __DEC32_EPSILON__ +#define DEC64_EPSILON __DEC64_EPSILON__ +#define DEC128_EPSILON __DEC128_EPSILON__ + +/* Minimum normalized positive floating-point number. */ +#undef DEC32_MIN +#undef DEC64_MIN +#undef DEC128_MIN +#define DEC32_MIN __DEC32_MIN__ +#define DEC64_MIN __DEC64_MIN__ +#define DEC128_MIN __DEC128_MIN__ + +/* Minimum subnormal positive floating-point number. */ +#undef DEC32_SUBNORMAL_MIN +#undef DEC64_SUBNORMAL_MIN +#undef DEC128_SUBNORMAL_MIN +#define DEC32_SUBNORMAL_MIN __DEC32_SUBNORMAL_MIN__ +#define DEC64_SUBNORMAL_MIN __DEC64_SUBNORMAL_MIN__ +#define DEC128_SUBNORMAL_MIN __DEC128_SUBNORMAL_MIN__ + +/* The floating-point expression evaluation method. + -1 indeterminate + 0 evaluate all operations and constants just to the range and + precision of the type + 1 evaluate operations and constants of type _Decimal32 + and _Decimal64 to the range and precision of the _Decimal64 + type, evaluate _Decimal128 operations and constants to the + range and precision of the _Decimal128 type; + 2 evaluate all operations and constants to the range and + precision of the _Decimal128 type. */ + +#undef DEC_EVAL_METHOD +#define DEC_EVAL_METHOD __DEC_EVAL_METHOD__ + +#endif /* __STDC_WANT_DEC_FP__ */ + +#endif /* _FLOAT_H___ */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/gcov.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/gcov.h new file mode 100644 index 0000000..0333ecc --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/gcov.h @@ -0,0 +1,41 @@ +/* GCOV interface routines. + Copyright (C) 2017 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 3, or (at your option) any later + version. + + GCC is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + +#ifndef GCC_GCOV_H +#define GCC_GCOV_H + +/* Set all counters to zero. */ + +extern void __gcov_reset (void); + +/* Write profile information to a file. */ + +extern void __gcov_dump (void); + +/* Write profile information to a file and reset counters to zero. + The function does operations under a mutex. */ + +extern void __gcov_flush (void); + +#endif /* GCC_GCOV_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/iso646.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/iso646.h new file mode 100644 index 0000000..5a6b503 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/iso646.h @@ -0,0 +1,45 @@ +/* Copyright (C) 1997-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +/* + * ISO C Standard: 7.9 Alternative spellings + */ + +#ifndef _ISO646_H +#define _ISO646_H + +#ifndef __cplusplus +#define and && +#define and_eq &= +#define bitand & +#define bitor | +#define compl ~ +#define not ! +#define not_eq != +#define or || +#define or_eq |= +#define xor ^ +#define xor_eq ^= +#endif + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/loongson.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/loongson.h new file mode 100644 index 0000000..d11fb41 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/loongson.h @@ -0,0 +1,690 @@ +/* Intrinsics for ST Microelectronics Loongson-2E/2F SIMD operations. + + Copyright (C) 2008-2017 Free Software Foundation, Inc. + Contributed by CodeSourcery. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + +#ifndef _GCC_LOONGSON_H +#define _GCC_LOONGSON_H + +#if !defined(__mips_loongson_vector_rev) +# error "You must select -march=loongson2e or -march=loongson2f to use loongson.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* Vectors of unsigned bytes, halfwords and words. */ +typedef uint8_t uint8x8_t __attribute__((vector_size (8))); +typedef uint16_t uint16x4_t __attribute__((vector_size (8))); +typedef uint32_t uint32x2_t __attribute__((vector_size (8))); + +/* Vectors of signed bytes, halfwords and words. */ +typedef int8_t int8x8_t __attribute__((vector_size (8))); +typedef int16_t int16x4_t __attribute__((vector_size (8))); +typedef int32_t int32x2_t __attribute__((vector_size (8))); + +/* SIMD intrinsics. + Unless otherwise noted, calls to the functions below will expand into + precisely one machine instruction, modulo any moves required to + satisfy register allocation constraints. */ + +/* Pack with signed saturation. */ +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +packsswh (int32x2_t s, int32x2_t t) +{ + return __builtin_loongson_packsswh (s, t); +} + +__extension__ static __inline int8x8_t __attribute__ ((__always_inline__)) +packsshb (int16x4_t s, int16x4_t t) +{ + return __builtin_loongson_packsshb (s, t); +} + +/* Pack with unsigned saturation. */ +__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) +packushb (uint16x4_t s, uint16x4_t t) +{ + return __builtin_loongson_packushb (s, t); +} + +/* Vector addition, treating overflow by wraparound. */ +__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__)) +paddw_u (uint32x2_t s, uint32x2_t t) +{ + return __builtin_loongson_paddw_u (s, t); +} + +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +paddh_u (uint16x4_t s, uint16x4_t t) +{ + return __builtin_loongson_paddh_u (s, t); +} + +__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) +paddb_u (uint8x8_t s, uint8x8_t t) +{ + return __builtin_loongson_paddb_u (s, t); +} + +__extension__ static __inline int32x2_t __attribute__ ((__always_inline__)) +paddw_s (int32x2_t s, int32x2_t t) +{ + return __builtin_loongson_paddw_s (s, t); +} + +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +paddh_s (int16x4_t s, int16x4_t t) +{ + return __builtin_loongson_paddh_s (s, t); +} + +__extension__ static __inline int8x8_t __attribute__ ((__always_inline__)) +paddb_s (int8x8_t s, int8x8_t t) +{ + return __builtin_loongson_paddb_s (s, t); +} + +/* Addition of doubleword integers, treating overflow by wraparound. */ +__extension__ static __inline uint64_t __attribute__ ((__always_inline__)) +paddd_u (uint64_t s, uint64_t t) +{ + return __builtin_loongson_paddd_u (s, t); +} + +__extension__ static __inline int64_t __attribute__ ((__always_inline__)) +paddd_s (int64_t s, int64_t t) +{ + return __builtin_loongson_paddd_s (s, t); +} + +/* Vector addition, treating overflow by signed saturation. */ +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +paddsh (int16x4_t s, int16x4_t t) +{ + return __builtin_loongson_paddsh (s, t); +} + +__extension__ static __inline int8x8_t __attribute__ ((__always_inline__)) +paddsb (int8x8_t s, int8x8_t t) +{ + return __builtin_loongson_paddsb (s, t); +} + +/* Vector addition, treating overflow by unsigned saturation. */ +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +paddush (uint16x4_t s, uint16x4_t t) +{ + return __builtin_loongson_paddush (s, t); +} + +__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) +paddusb (uint8x8_t s, uint8x8_t t) +{ + return __builtin_loongson_paddusb (s, t); +} + +/* Logical AND NOT. */ +__extension__ static __inline uint64_t __attribute__ ((__always_inline__)) +pandn_ud (uint64_t s, uint64_t t) +{ + return __builtin_loongson_pandn_ud (s, t); +} + +__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__)) +pandn_uw (uint32x2_t s, uint32x2_t t) +{ + return __builtin_loongson_pandn_uw (s, t); +} + +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +pandn_uh (uint16x4_t s, uint16x4_t t) +{ + return __builtin_loongson_pandn_uh (s, t); +} + +__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) +pandn_ub (uint8x8_t s, uint8x8_t t) +{ + return __builtin_loongson_pandn_ub (s, t); +} + +__extension__ static __inline int64_t __attribute__ ((__always_inline__)) +pandn_sd (int64_t s, int64_t t) +{ + return __builtin_loongson_pandn_sd (s, t); +} + +__extension__ static __inline int32x2_t __attribute__ ((__always_inline__)) +pandn_sw (int32x2_t s, int32x2_t t) +{ + return __builtin_loongson_pandn_sw (s, t); +} + +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +pandn_sh (int16x4_t s, int16x4_t t) +{ + return __builtin_loongson_pandn_sh (s, t); +} + +__extension__ static __inline int8x8_t __attribute__ ((__always_inline__)) +pandn_sb (int8x8_t s, int8x8_t t) +{ + return __builtin_loongson_pandn_sb (s, t); +} + +/* Average. */ +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +pavgh (uint16x4_t s, uint16x4_t t) +{ + return __builtin_loongson_pavgh (s, t); +} + +__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) +pavgb (uint8x8_t s, uint8x8_t t) +{ + return __builtin_loongson_pavgb (s, t); +} + +/* Equality test. */ +__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__)) +pcmpeqw_u (uint32x2_t s, uint32x2_t t) +{ + return __builtin_loongson_pcmpeqw_u (s, t); +} + +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +pcmpeqh_u (uint16x4_t s, uint16x4_t t) +{ + return __builtin_loongson_pcmpeqh_u (s, t); +} + +__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) +pcmpeqb_u (uint8x8_t s, uint8x8_t t) +{ + return __builtin_loongson_pcmpeqb_u (s, t); +} + +__extension__ static __inline int32x2_t __attribute__ ((__always_inline__)) +pcmpeqw_s (int32x2_t s, int32x2_t t) +{ + return __builtin_loongson_pcmpeqw_s (s, t); +} + +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +pcmpeqh_s (int16x4_t s, int16x4_t t) +{ + return __builtin_loongson_pcmpeqh_s (s, t); +} + +__extension__ static __inline int8x8_t __attribute__ ((__always_inline__)) +pcmpeqb_s (int8x8_t s, int8x8_t t) +{ + return __builtin_loongson_pcmpeqb_s (s, t); +} + +/* Greater-than test. */ +__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__)) +pcmpgtw_u (uint32x2_t s, uint32x2_t t) +{ + return __builtin_loongson_pcmpgtw_u (s, t); +} + +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +pcmpgth_u (uint16x4_t s, uint16x4_t t) +{ + return __builtin_loongson_pcmpgth_u (s, t); +} + +__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) +pcmpgtb_u (uint8x8_t s, uint8x8_t t) +{ + return __builtin_loongson_pcmpgtb_u (s, t); +} + +__extension__ static __inline int32x2_t __attribute__ ((__always_inline__)) +pcmpgtw_s (int32x2_t s, int32x2_t t) +{ + return __builtin_loongson_pcmpgtw_s (s, t); +} + +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +pcmpgth_s (int16x4_t s, int16x4_t t) +{ + return __builtin_loongson_pcmpgth_s (s, t); +} + +__extension__ static __inline int8x8_t __attribute__ ((__always_inline__)) +pcmpgtb_s (int8x8_t s, int8x8_t t) +{ + return __builtin_loongson_pcmpgtb_s (s, t); +} + +/* Extract halfword. */ +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +pextrh_u (uint16x4_t s, int field /* 0--3 */) +{ + return __builtin_loongson_pextrh_u (s, field); +} + +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +pextrh_s (int16x4_t s, int field /* 0--3 */) +{ + return __builtin_loongson_pextrh_s (s, field); +} + +/* Insert halfword. */ +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +pinsrh_0_u (uint16x4_t s, uint16x4_t t) +{ + return __builtin_loongson_pinsrh_0_u (s, t); +} + +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +pinsrh_1_u (uint16x4_t s, uint16x4_t t) +{ + return __builtin_loongson_pinsrh_1_u (s, t); +} + +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +pinsrh_2_u (uint16x4_t s, uint16x4_t t) +{ + return __builtin_loongson_pinsrh_2_u (s, t); +} + +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +pinsrh_3_u (uint16x4_t s, uint16x4_t t) +{ + return __builtin_loongson_pinsrh_3_u (s, t); +} + +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +pinsrh_0_s (int16x4_t s, int16x4_t t) +{ + return __builtin_loongson_pinsrh_0_s (s, t); +} + +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +pinsrh_1_s (int16x4_t s, int16x4_t t) +{ + return __builtin_loongson_pinsrh_1_s (s, t); +} + +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +pinsrh_2_s (int16x4_t s, int16x4_t t) +{ + return __builtin_loongson_pinsrh_2_s (s, t); +} + +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +pinsrh_3_s (int16x4_t s, int16x4_t t) +{ + return __builtin_loongson_pinsrh_3_s (s, t); +} + +/* Multiply and add. */ +__extension__ static __inline int32x2_t __attribute__ ((__always_inline__)) +pmaddhw (int16x4_t s, int16x4_t t) +{ + return __builtin_loongson_pmaddhw (s, t); +} + +/* Maximum of signed halfwords. */ +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +pmaxsh (int16x4_t s, int16x4_t t) +{ + return __builtin_loongson_pmaxsh (s, t); +} + +/* Maximum of unsigned bytes. */ +__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) +pmaxub (uint8x8_t s, uint8x8_t t) +{ + return __builtin_loongson_pmaxub (s, t); +} + +/* Minimum of signed halfwords. */ +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +pminsh (int16x4_t s, int16x4_t t) +{ + return __builtin_loongson_pminsh (s, t); +} + +/* Minimum of unsigned bytes. */ +__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) +pminub (uint8x8_t s, uint8x8_t t) +{ + return __builtin_loongson_pminub (s, t); +} + +/* Move byte mask. */ +__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) +pmovmskb_u (uint8x8_t s) +{ + return __builtin_loongson_pmovmskb_u (s); +} + +__extension__ static __inline int8x8_t __attribute__ ((__always_inline__)) +pmovmskb_s (int8x8_t s) +{ + return __builtin_loongson_pmovmskb_s (s); +} + +/* Multiply unsigned integers and store high result. */ +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +pmulhuh (uint16x4_t s, uint16x4_t t) +{ + return __builtin_loongson_pmulhuh (s, t); +} + +/* Multiply signed integers and store high result. */ +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +pmulhh (int16x4_t s, int16x4_t t) +{ + return __builtin_loongson_pmulhh (s, t); +} + +/* Multiply signed integers and store low result. */ +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +pmullh (int16x4_t s, int16x4_t t) +{ + return __builtin_loongson_pmullh (s, t); +} + +/* Multiply unsigned word integers. */ +__extension__ static __inline int64_t __attribute__ ((__always_inline__)) +pmuluw (uint32x2_t s, uint32x2_t t) +{ + return __builtin_loongson_pmuluw (s, t); +} + +/* Absolute difference. */ +__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) +pasubub (uint8x8_t s, uint8x8_t t) +{ + return __builtin_loongson_pasubub (s, t); +} + +/* Sum of unsigned byte integers. */ +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +biadd (uint8x8_t s) +{ + return __builtin_loongson_biadd (s); +} + +/* Sum of absolute differences. + Note that this intrinsic expands into two machine instructions: + PASUBUB followed by BIADD. */ +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +psadbh (uint8x8_t s, uint8x8_t t) +{ + return __builtin_loongson_psadbh (s, t); +} + +/* Shuffle halfwords. */ +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +pshufh_u (uint16x4_t dest, uint16x4_t s, uint8_t order) +{ + return __builtin_loongson_pshufh_u (s, order); +} + +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +pshufh_s (int16x4_t dest, int16x4_t s, uint8_t order) +{ + return __builtin_loongson_pshufh_s (s, order); +} + +/* Shift left logical. */ +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +psllh_u (uint16x4_t s, uint8_t amount) +{ + return __builtin_loongson_psllh_u (s, amount); +} + +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +psllh_s (int16x4_t s, uint8_t amount) +{ + return __builtin_loongson_psllh_s (s, amount); +} + +__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__)) +psllw_u (uint32x2_t s, uint8_t amount) +{ + return __builtin_loongson_psllw_u (s, amount); +} + +__extension__ static __inline int32x2_t __attribute__ ((__always_inline__)) +psllw_s (int32x2_t s, uint8_t amount) +{ + return __builtin_loongson_psllw_s (s, amount); +} + +/* Shift right logical. */ +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +psrlh_u (uint16x4_t s, uint8_t amount) +{ + return __builtin_loongson_psrlh_u (s, amount); +} + +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +psrlh_s (int16x4_t s, uint8_t amount) +{ + return __builtin_loongson_psrlh_s (s, amount); +} + +__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__)) +psrlw_u (uint32x2_t s, uint8_t amount) +{ + return __builtin_loongson_psrlw_u (s, amount); +} + +__extension__ static __inline int32x2_t __attribute__ ((__always_inline__)) +psrlw_s (int32x2_t s, uint8_t amount) +{ + return __builtin_loongson_psrlw_s (s, amount); +} + +/* Shift right arithmetic. */ +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +psrah_u (uint16x4_t s, uint8_t amount) +{ + return __builtin_loongson_psrah_u (s, amount); +} + +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +psrah_s (int16x4_t s, uint8_t amount) +{ + return __builtin_loongson_psrah_s (s, amount); +} + +__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__)) +psraw_u (uint32x2_t s, uint8_t amount) +{ + return __builtin_loongson_psraw_u (s, amount); +} + +__extension__ static __inline int32x2_t __attribute__ ((__always_inline__)) +psraw_s (int32x2_t s, uint8_t amount) +{ + return __builtin_loongson_psraw_s (s, amount); +} + +/* Vector subtraction, treating overflow by wraparound. */ +__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__)) +psubw_u (uint32x2_t s, uint32x2_t t) +{ + return __builtin_loongson_psubw_u (s, t); +} + +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +psubh_u (uint16x4_t s, uint16x4_t t) +{ + return __builtin_loongson_psubh_u (s, t); +} + +__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) +psubb_u (uint8x8_t s, uint8x8_t t) +{ + return __builtin_loongson_psubb_u (s, t); +} + +__extension__ static __inline int32x2_t __attribute__ ((__always_inline__)) +psubw_s (int32x2_t s, int32x2_t t) +{ + return __builtin_loongson_psubw_s (s, t); +} + +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +psubh_s (int16x4_t s, int16x4_t t) +{ + return __builtin_loongson_psubh_s (s, t); +} + +__extension__ static __inline int8x8_t __attribute__ ((__always_inline__)) +psubb_s (int8x8_t s, int8x8_t t) +{ + return __builtin_loongson_psubb_s (s, t); +} + +/* Subtraction of doubleword integers, treating overflow by wraparound. */ +__extension__ static __inline uint64_t __attribute__ ((__always_inline__)) +psubd_u (uint64_t s, uint64_t t) +{ + return __builtin_loongson_psubd_u (s, t); +} + +__extension__ static __inline int64_t __attribute__ ((__always_inline__)) +psubd_s (int64_t s, int64_t t) +{ + return __builtin_loongson_psubd_s (s, t); +} + +/* Vector subtraction, treating overflow by signed saturation. */ +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +psubsh (int16x4_t s, int16x4_t t) +{ + return __builtin_loongson_psubsh (s, t); +} + +__extension__ static __inline int8x8_t __attribute__ ((__always_inline__)) +psubsb (int8x8_t s, int8x8_t t) +{ + return __builtin_loongson_psubsb (s, t); +} + +/* Vector subtraction, treating overflow by unsigned saturation. */ +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +psubush (uint16x4_t s, uint16x4_t t) +{ + return __builtin_loongson_psubush (s, t); +} + +__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) +psubusb (uint8x8_t s, uint8x8_t t) +{ + return __builtin_loongson_psubusb (s, t); +} + +/* Unpack high data. */ +__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__)) +punpckhwd_u (uint32x2_t s, uint32x2_t t) +{ + return __builtin_loongson_punpckhwd_u (s, t); +} + +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +punpckhhw_u (uint16x4_t s, uint16x4_t t) +{ + return __builtin_loongson_punpckhhw_u (s, t); +} + +__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) +punpckhbh_u (uint8x8_t s, uint8x8_t t) +{ + return __builtin_loongson_punpckhbh_u (s, t); +} + +__extension__ static __inline int32x2_t __attribute__ ((__always_inline__)) +punpckhwd_s (int32x2_t s, int32x2_t t) +{ + return __builtin_loongson_punpckhwd_s (s, t); +} + +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +punpckhhw_s (int16x4_t s, int16x4_t t) +{ + return __builtin_loongson_punpckhhw_s (s, t); +} + +__extension__ static __inline int8x8_t __attribute__ ((__always_inline__)) +punpckhbh_s (int8x8_t s, int8x8_t t) +{ + return __builtin_loongson_punpckhbh_s (s, t); +} + +/* Unpack low data. */ +__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__)) +punpcklwd_u (uint32x2_t s, uint32x2_t t) +{ + return __builtin_loongson_punpcklwd_u (s, t); +} + +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +punpcklhw_u (uint16x4_t s, uint16x4_t t) +{ + return __builtin_loongson_punpcklhw_u (s, t); +} + +__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) +punpcklbh_u (uint8x8_t s, uint8x8_t t) +{ + return __builtin_loongson_punpcklbh_u (s, t); +} + +__extension__ static __inline int32x2_t __attribute__ ((__always_inline__)) +punpcklwd_s (int32x2_t s, int32x2_t t) +{ + return __builtin_loongson_punpcklwd_s (s, t); +} + +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +punpcklhw_s (int16x4_t s, int16x4_t t) +{ + return __builtin_loongson_punpcklhw_s (s, t); +} + +__extension__ static __inline int8x8_t __attribute__ ((__always_inline__)) +punpcklbh_s (int8x8_t s, int8x8_t t) +{ + return __builtin_loongson_punpcklbh_s (s, t); +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/msa.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/msa.h new file mode 100644 index 0000000..ffd1262 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/msa.h @@ -0,0 +1,582 @@ +/* MIPS MSA intrinsics include file. + + Copyright (C) 2015-2017 Free Software Foundation, Inc. + Contributed by Imagination Technologies Ltd. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + +#ifndef _MSA_H +#define _MSA_H 1 + +#if defined(__mips_msa) +typedef signed char v16i8 __attribute__ ((vector_size(16), aligned(16))); +typedef signed char v16i8_b __attribute__ ((vector_size(16), aligned(1))); +typedef unsigned char v16u8 __attribute__ ((vector_size(16), aligned(16))); +typedef unsigned char v16u8_b __attribute__ ((vector_size(16), aligned(1))); +typedef short v8i16 __attribute__ ((vector_size(16), aligned(16))); +typedef short v8i16_h __attribute__ ((vector_size(16), aligned(2))); +typedef unsigned short v8u16 __attribute__ ((vector_size(16), aligned(16))); +typedef unsigned short v8u16_h __attribute__ ((vector_size(16), aligned(2))); +typedef int v4i32 __attribute__ ((vector_size(16), aligned(16))); +typedef int v4i32_w __attribute__ ((vector_size(16), aligned(4))); +typedef unsigned int v4u32 __attribute__ ((vector_size(16), aligned(16))); +typedef unsigned int v4u32_w __attribute__ ((vector_size(16), aligned(4))); +typedef long long v2i64 __attribute__ ((vector_size(16), aligned(16))); +typedef long long v2i64_d __attribute__ ((vector_size(16), aligned(8))); +typedef unsigned long long v2u64 __attribute__ ((vector_size(16), aligned(16))); +typedef unsigned long long v2u64_d __attribute__ ((vector_size(16), aligned(8))); +typedef float v4f32 __attribute__ ((vector_size(16), aligned(16))); +typedef float v4f32_w __attribute__ ((vector_size(16), aligned(4))); +typedef double v2f64 __attribute__ ((vector_size(16), aligned(16))); +typedef double v2f64_d __attribute__ ((vector_size(16), aligned(8))); + +#define __msa_sll_b __builtin_msa_sll_b +#define __msa_sll_h __builtin_msa_sll_h +#define __msa_sll_w __builtin_msa_sll_w +#define __msa_sll_d __builtin_msa_sll_d +#define __msa_slli_b __builtin_msa_slli_b +#define __msa_slli_h __builtin_msa_slli_h +#define __msa_slli_w __builtin_msa_slli_w +#define __msa_slli_d __builtin_msa_slli_d +#define __msa_sra_b __builtin_msa_sra_b +#define __msa_sra_h __builtin_msa_sra_h +#define __msa_sra_w __builtin_msa_sra_w +#define __msa_sra_d __builtin_msa_sra_d +#define __msa_srai_b __builtin_msa_srai_b +#define __msa_srai_h __builtin_msa_srai_h +#define __msa_srai_w __builtin_msa_srai_w +#define __msa_srai_d __builtin_msa_srai_d +#define __msa_srar_b __builtin_msa_srar_b +#define __msa_srar_h __builtin_msa_srar_h +#define __msa_srar_w __builtin_msa_srar_w +#define __msa_srar_d __builtin_msa_srar_d +#define __msa_srari_b __builtin_msa_srari_b +#define __msa_srari_h __builtin_msa_srari_h +#define __msa_srari_w __builtin_msa_srari_w +#define __msa_srari_d __builtin_msa_srari_d +#define __msa_srl_b __builtin_msa_srl_b +#define __msa_srl_h __builtin_msa_srl_h +#define __msa_srl_w __builtin_msa_srl_w +#define __msa_srl_d __builtin_msa_srl_d +#define __msa_srli_b __builtin_msa_srli_b +#define __msa_srli_h __builtin_msa_srli_h +#define __msa_srli_w __builtin_msa_srli_w +#define __msa_srli_d __builtin_msa_srli_d +#define __msa_srlr_b __builtin_msa_srlr_b +#define __msa_srlr_h __builtin_msa_srlr_h +#define __msa_srlr_w __builtin_msa_srlr_w +#define __msa_srlr_d __builtin_msa_srlr_d +#define __msa_srlri_b __builtin_msa_srlri_b +#define __msa_srlri_h __builtin_msa_srlri_h +#define __msa_srlri_w __builtin_msa_srlri_w +#define __msa_srlri_d __builtin_msa_srlri_d +#define __msa_bclr_b __builtin_msa_bclr_b +#define __msa_bclr_h __builtin_msa_bclr_h +#define __msa_bclr_w __builtin_msa_bclr_w +#define __msa_bclr_d __builtin_msa_bclr_d +#define __msa_bclri_b __builtin_msa_bclri_b +#define __msa_bclri_h __builtin_msa_bclri_h +#define __msa_bclri_w __builtin_msa_bclri_w +#define __msa_bclri_d __builtin_msa_bclri_d +#define __msa_bset_b __builtin_msa_bset_b +#define __msa_bset_h __builtin_msa_bset_h +#define __msa_bset_w __builtin_msa_bset_w +#define __msa_bset_d __builtin_msa_bset_d +#define __msa_bseti_b __builtin_msa_bseti_b +#define __msa_bseti_h __builtin_msa_bseti_h +#define __msa_bseti_w __builtin_msa_bseti_w +#define __msa_bseti_d __builtin_msa_bseti_d +#define __msa_bneg_b __builtin_msa_bneg_b +#define __msa_bneg_h __builtin_msa_bneg_h +#define __msa_bneg_w __builtin_msa_bneg_w +#define __msa_bneg_d __builtin_msa_bneg_d +#define __msa_bnegi_b __builtin_msa_bnegi_b +#define __msa_bnegi_h __builtin_msa_bnegi_h +#define __msa_bnegi_w __builtin_msa_bnegi_w +#define __msa_bnegi_d __builtin_msa_bnegi_d +#define __msa_binsl_b __builtin_msa_binsl_b +#define __msa_binsl_h __builtin_msa_binsl_h +#define __msa_binsl_w __builtin_msa_binsl_w +#define __msa_binsl_d __builtin_msa_binsl_d +#define __msa_binsli_b __builtin_msa_binsli_b +#define __msa_binsli_h __builtin_msa_binsli_h +#define __msa_binsli_w __builtin_msa_binsli_w +#define __msa_binsli_d __builtin_msa_binsli_d +#define __msa_binsr_b __builtin_msa_binsr_b +#define __msa_binsr_h __builtin_msa_binsr_h +#define __msa_binsr_w __builtin_msa_binsr_w +#define __msa_binsr_d __builtin_msa_binsr_d +#define __msa_binsri_b __builtin_msa_binsri_b +#define __msa_binsri_h __builtin_msa_binsri_h +#define __msa_binsri_w __builtin_msa_binsri_w +#define __msa_binsri_d __builtin_msa_binsri_d +#define __msa_addv_b __builtin_msa_addv_b +#define __msa_addv_h __builtin_msa_addv_h +#define __msa_addv_w __builtin_msa_addv_w +#define __msa_addv_d __builtin_msa_addv_d +#define __msa_addvi_b __builtin_msa_addvi_b +#define __msa_addvi_h __builtin_msa_addvi_h +#define __msa_addvi_w __builtin_msa_addvi_w +#define __msa_addvi_d __builtin_msa_addvi_d +#define __msa_subv_b __builtin_msa_subv_b +#define __msa_subv_h __builtin_msa_subv_h +#define __msa_subv_w __builtin_msa_subv_w +#define __msa_subv_d __builtin_msa_subv_d +#define __msa_subvi_b __builtin_msa_subvi_b +#define __msa_subvi_h __builtin_msa_subvi_h +#define __msa_subvi_w __builtin_msa_subvi_w +#define __msa_subvi_d __builtin_msa_subvi_d +#define __msa_max_s_b __builtin_msa_max_s_b +#define __msa_max_s_h __builtin_msa_max_s_h +#define __msa_max_s_w __builtin_msa_max_s_w +#define __msa_max_s_d __builtin_msa_max_s_d +#define __msa_maxi_s_b __builtin_msa_maxi_s_b +#define __msa_maxi_s_h __builtin_msa_maxi_s_h +#define __msa_maxi_s_w __builtin_msa_maxi_s_w +#define __msa_maxi_s_d __builtin_msa_maxi_s_d +#define __msa_max_u_b __builtin_msa_max_u_b +#define __msa_max_u_h __builtin_msa_max_u_h +#define __msa_max_u_w __builtin_msa_max_u_w +#define __msa_max_u_d __builtin_msa_max_u_d +#define __msa_maxi_u_b __builtin_msa_maxi_u_b +#define __msa_maxi_u_h __builtin_msa_maxi_u_h +#define __msa_maxi_u_w __builtin_msa_maxi_u_w +#define __msa_maxi_u_d __builtin_msa_maxi_u_d +#define __msa_min_s_b __builtin_msa_min_s_b +#define __msa_min_s_h __builtin_msa_min_s_h +#define __msa_min_s_w __builtin_msa_min_s_w +#define __msa_min_s_d __builtin_msa_min_s_d +#define __msa_mini_s_b __builtin_msa_mini_s_b +#define __msa_mini_s_h __builtin_msa_mini_s_h +#define __msa_mini_s_w __builtin_msa_mini_s_w +#define __msa_mini_s_d __builtin_msa_mini_s_d +#define __msa_min_u_b __builtin_msa_min_u_b +#define __msa_min_u_h __builtin_msa_min_u_h +#define __msa_min_u_w __builtin_msa_min_u_w +#define __msa_min_u_d __builtin_msa_min_u_d +#define __msa_mini_u_b __builtin_msa_mini_u_b +#define __msa_mini_u_h __builtin_msa_mini_u_h +#define __msa_mini_u_w __builtin_msa_mini_u_w +#define __msa_mini_u_d __builtin_msa_mini_u_d +#define __msa_max_a_b __builtin_msa_max_a_b +#define __msa_max_a_h __builtin_msa_max_a_h +#define __msa_max_a_w __builtin_msa_max_a_w +#define __msa_max_a_d __builtin_msa_max_a_d +#define __msa_min_a_b __builtin_msa_min_a_b +#define __msa_min_a_h __builtin_msa_min_a_h +#define __msa_min_a_w __builtin_msa_min_a_w +#define __msa_min_a_d __builtin_msa_min_a_d +#define __msa_ceq_b __builtin_msa_ceq_b +#define __msa_ceq_h __builtin_msa_ceq_h +#define __msa_ceq_w __builtin_msa_ceq_w +#define __msa_ceq_d __builtin_msa_ceq_d +#define __msa_ceqi_b __builtin_msa_ceqi_b +#define __msa_ceqi_h __builtin_msa_ceqi_h +#define __msa_ceqi_w __builtin_msa_ceqi_w +#define __msa_ceqi_d __builtin_msa_ceqi_d +#define __msa_clt_s_b __builtin_msa_clt_s_b +#define __msa_clt_s_h __builtin_msa_clt_s_h +#define __msa_clt_s_w __builtin_msa_clt_s_w +#define __msa_clt_s_d __builtin_msa_clt_s_d +#define __msa_clti_s_b __builtin_msa_clti_s_b +#define __msa_clti_s_h __builtin_msa_clti_s_h +#define __msa_clti_s_w __builtin_msa_clti_s_w +#define __msa_clti_s_d __builtin_msa_clti_s_d +#define __msa_clt_u_b __builtin_msa_clt_u_b +#define __msa_clt_u_h __builtin_msa_clt_u_h +#define __msa_clt_u_w __builtin_msa_clt_u_w +#define __msa_clt_u_d __builtin_msa_clt_u_d +#define __msa_clti_u_b __builtin_msa_clti_u_b +#define __msa_clti_u_h __builtin_msa_clti_u_h +#define __msa_clti_u_w __builtin_msa_clti_u_w +#define __msa_clti_u_d __builtin_msa_clti_u_d +#define __msa_cle_s_b __builtin_msa_cle_s_b +#define __msa_cle_s_h __builtin_msa_cle_s_h +#define __msa_cle_s_w __builtin_msa_cle_s_w +#define __msa_cle_s_d __builtin_msa_cle_s_d +#define __msa_clei_s_b __builtin_msa_clei_s_b +#define __msa_clei_s_h __builtin_msa_clei_s_h +#define __msa_clei_s_w __builtin_msa_clei_s_w +#define __msa_clei_s_d __builtin_msa_clei_s_d +#define __msa_cle_u_b __builtin_msa_cle_u_b +#define __msa_cle_u_h __builtin_msa_cle_u_h +#define __msa_cle_u_w __builtin_msa_cle_u_w +#define __msa_cle_u_d __builtin_msa_cle_u_d +#define __msa_clei_u_b __builtin_msa_clei_u_b +#define __msa_clei_u_h __builtin_msa_clei_u_h +#define __msa_clei_u_w __builtin_msa_clei_u_w +#define __msa_clei_u_d __builtin_msa_clei_u_d +#define __msa_ld_b __builtin_msa_ld_b +#define __msa_ld_h __builtin_msa_ld_h +#define __msa_ld_w __builtin_msa_ld_w +#define __msa_ld_d __builtin_msa_ld_d +#define __msa_st_b __builtin_msa_st_b +#define __msa_st_h __builtin_msa_st_h +#define __msa_st_w __builtin_msa_st_w +#define __msa_st_d __builtin_msa_st_d +#define __msa_sat_s_b __builtin_msa_sat_s_b +#define __msa_sat_s_h __builtin_msa_sat_s_h +#define __msa_sat_s_w __builtin_msa_sat_s_w +#define __msa_sat_s_d __builtin_msa_sat_s_d +#define __msa_sat_u_b __builtin_msa_sat_u_b +#define __msa_sat_u_h __builtin_msa_sat_u_h +#define __msa_sat_u_w __builtin_msa_sat_u_w +#define __msa_sat_u_d __builtin_msa_sat_u_d +#define __msa_add_a_b __builtin_msa_add_a_b +#define __msa_add_a_h __builtin_msa_add_a_h +#define __msa_add_a_w __builtin_msa_add_a_w +#define __msa_add_a_d __builtin_msa_add_a_d +#define __msa_adds_a_b __builtin_msa_adds_a_b +#define __msa_adds_a_h __builtin_msa_adds_a_h +#define __msa_adds_a_w __builtin_msa_adds_a_w +#define __msa_adds_a_d __builtin_msa_adds_a_d +#define __msa_adds_s_b __builtin_msa_adds_s_b +#define __msa_adds_s_h __builtin_msa_adds_s_h +#define __msa_adds_s_w __builtin_msa_adds_s_w +#define __msa_adds_s_d __builtin_msa_adds_s_d +#define __msa_adds_u_b __builtin_msa_adds_u_b +#define __msa_adds_u_h __builtin_msa_adds_u_h +#define __msa_adds_u_w __builtin_msa_adds_u_w +#define __msa_adds_u_d __builtin_msa_adds_u_d +#define __msa_ave_s_b __builtin_msa_ave_s_b +#define __msa_ave_s_h __builtin_msa_ave_s_h +#define __msa_ave_s_w __builtin_msa_ave_s_w +#define __msa_ave_s_d __builtin_msa_ave_s_d +#define __msa_ave_u_b __builtin_msa_ave_u_b +#define __msa_ave_u_h __builtin_msa_ave_u_h +#define __msa_ave_u_w __builtin_msa_ave_u_w +#define __msa_ave_u_d __builtin_msa_ave_u_d +#define __msa_aver_s_b __builtin_msa_aver_s_b +#define __msa_aver_s_h __builtin_msa_aver_s_h +#define __msa_aver_s_w __builtin_msa_aver_s_w +#define __msa_aver_s_d __builtin_msa_aver_s_d +#define __msa_aver_u_b __builtin_msa_aver_u_b +#define __msa_aver_u_h __builtin_msa_aver_u_h +#define __msa_aver_u_w __builtin_msa_aver_u_w +#define __msa_aver_u_d __builtin_msa_aver_u_d +#define __msa_subs_s_b __builtin_msa_subs_s_b +#define __msa_subs_s_h __builtin_msa_subs_s_h +#define __msa_subs_s_w __builtin_msa_subs_s_w +#define __msa_subs_s_d __builtin_msa_subs_s_d +#define __msa_subs_u_b __builtin_msa_subs_u_b +#define __msa_subs_u_h __builtin_msa_subs_u_h +#define __msa_subs_u_w __builtin_msa_subs_u_w +#define __msa_subs_u_d __builtin_msa_subs_u_d +#define __msa_subsuu_s_b __builtin_msa_subsuu_s_b +#define __msa_subsuu_s_h __builtin_msa_subsuu_s_h +#define __msa_subsuu_s_w __builtin_msa_subsuu_s_w +#define __msa_subsuu_s_d __builtin_msa_subsuu_s_d +#define __msa_subsus_u_b __builtin_msa_subsus_u_b +#define __msa_subsus_u_h __builtin_msa_subsus_u_h +#define __msa_subsus_u_w __builtin_msa_subsus_u_w +#define __msa_subsus_u_d __builtin_msa_subsus_u_d +#define __msa_asub_s_b __builtin_msa_asub_s_b +#define __msa_asub_s_h __builtin_msa_asub_s_h +#define __msa_asub_s_w __builtin_msa_asub_s_w +#define __msa_asub_s_d __builtin_msa_asub_s_d +#define __msa_asub_u_b __builtin_msa_asub_u_b +#define __msa_asub_u_h __builtin_msa_asub_u_h +#define __msa_asub_u_w __builtin_msa_asub_u_w +#define __msa_asub_u_d __builtin_msa_asub_u_d +#define __msa_mulv_b __builtin_msa_mulv_b +#define __msa_mulv_h __builtin_msa_mulv_h +#define __msa_mulv_w __builtin_msa_mulv_w +#define __msa_mulv_d __builtin_msa_mulv_d +#define __msa_maddv_b __builtin_msa_maddv_b +#define __msa_maddv_h __builtin_msa_maddv_h +#define __msa_maddv_w __builtin_msa_maddv_w +#define __msa_maddv_d __builtin_msa_maddv_d +#define __msa_msubv_b __builtin_msa_msubv_b +#define __msa_msubv_h __builtin_msa_msubv_h +#define __msa_msubv_w __builtin_msa_msubv_w +#define __msa_msubv_d __builtin_msa_msubv_d +#define __msa_div_s_b __builtin_msa_div_s_b +#define __msa_div_s_h __builtin_msa_div_s_h +#define __msa_div_s_w __builtin_msa_div_s_w +#define __msa_div_s_d __builtin_msa_div_s_d +#define __msa_div_u_b __builtin_msa_div_u_b +#define __msa_div_u_h __builtin_msa_div_u_h +#define __msa_div_u_w __builtin_msa_div_u_w +#define __msa_div_u_d __builtin_msa_div_u_d +#define __msa_hadd_s_h __builtin_msa_hadd_s_h +#define __msa_hadd_s_w __builtin_msa_hadd_s_w +#define __msa_hadd_s_d __builtin_msa_hadd_s_d +#define __msa_hadd_u_h __builtin_msa_hadd_u_h +#define __msa_hadd_u_w __builtin_msa_hadd_u_w +#define __msa_hadd_u_d __builtin_msa_hadd_u_d +#define __msa_hsub_s_h __builtin_msa_hsub_s_h +#define __msa_hsub_s_w __builtin_msa_hsub_s_w +#define __msa_hsub_s_d __builtin_msa_hsub_s_d +#define __msa_hsub_u_h __builtin_msa_hsub_u_h +#define __msa_hsub_u_w __builtin_msa_hsub_u_w +#define __msa_hsub_u_d __builtin_msa_hsub_u_d +#define __msa_mod_s_b __builtin_msa_mod_s_b +#define __msa_mod_s_h __builtin_msa_mod_s_h +#define __msa_mod_s_w __builtin_msa_mod_s_w +#define __msa_mod_s_d __builtin_msa_mod_s_d +#define __msa_mod_u_b __builtin_msa_mod_u_b +#define __msa_mod_u_h __builtin_msa_mod_u_h +#define __msa_mod_u_w __builtin_msa_mod_u_w +#define __msa_mod_u_d __builtin_msa_mod_u_d +#define __msa_dotp_s_h __builtin_msa_dotp_s_h +#define __msa_dotp_s_w __builtin_msa_dotp_s_w +#define __msa_dotp_s_d __builtin_msa_dotp_s_d +#define __msa_dotp_u_h __builtin_msa_dotp_u_h +#define __msa_dotp_u_w __builtin_msa_dotp_u_w +#define __msa_dotp_u_d __builtin_msa_dotp_u_d +#define __msa_dpadd_s_h __builtin_msa_dpadd_s_h +#define __msa_dpadd_s_w __builtin_msa_dpadd_s_w +#define __msa_dpadd_s_d __builtin_msa_dpadd_s_d +#define __msa_dpadd_u_h __builtin_msa_dpadd_u_h +#define __msa_dpadd_u_w __builtin_msa_dpadd_u_w +#define __msa_dpadd_u_d __builtin_msa_dpadd_u_d +#define __msa_dpsub_s_h __builtin_msa_dpsub_s_h +#define __msa_dpsub_s_w __builtin_msa_dpsub_s_w +#define __msa_dpsub_s_d __builtin_msa_dpsub_s_d +#define __msa_dpsub_u_h __builtin_msa_dpsub_u_h +#define __msa_dpsub_u_w __builtin_msa_dpsub_u_w +#define __msa_dpsub_u_d __builtin_msa_dpsub_u_d +#define __msa_sld_b __builtin_msa_sld_b +#define __msa_sld_h __builtin_msa_sld_h +#define __msa_sld_w __builtin_msa_sld_w +#define __msa_sld_d __builtin_msa_sld_d +#define __msa_sldi_b __builtin_msa_sldi_b +#define __msa_sldi_h __builtin_msa_sldi_h +#define __msa_sldi_w __builtin_msa_sldi_w +#define __msa_sldi_d __builtin_msa_sldi_d +#define __msa_splat_b __builtin_msa_splat_b +#define __msa_splat_h __builtin_msa_splat_h +#define __msa_splat_w __builtin_msa_splat_w +#define __msa_splat_d __builtin_msa_splat_d +#define __msa_splati_b __builtin_msa_splati_b +#define __msa_splati_h __builtin_msa_splati_h +#define __msa_splati_w __builtin_msa_splati_w +#define __msa_splati_d __builtin_msa_splati_d +#define __msa_pckev_b __builtin_msa_pckev_b +#define __msa_pckev_h __builtin_msa_pckev_h +#define __msa_pckev_w __builtin_msa_pckev_w +#define __msa_pckev_d __builtin_msa_pckev_d +#define __msa_pckod_b __builtin_msa_pckod_b +#define __msa_pckod_h __builtin_msa_pckod_h +#define __msa_pckod_w __builtin_msa_pckod_w +#define __msa_pckod_d __builtin_msa_pckod_d +#define __msa_ilvl_b __builtin_msa_ilvl_b +#define __msa_ilvl_h __builtin_msa_ilvl_h +#define __msa_ilvl_w __builtin_msa_ilvl_w +#define __msa_ilvl_d __builtin_msa_ilvl_d +#define __msa_ilvr_b __builtin_msa_ilvr_b +#define __msa_ilvr_h __builtin_msa_ilvr_h +#define __msa_ilvr_w __builtin_msa_ilvr_w +#define __msa_ilvr_d __builtin_msa_ilvr_d +#define __msa_ilvev_b __builtin_msa_ilvev_b +#define __msa_ilvev_h __builtin_msa_ilvev_h +#define __msa_ilvev_w __builtin_msa_ilvev_w +#define __msa_ilvev_d __builtin_msa_ilvev_d +#define __msa_ilvod_b __builtin_msa_ilvod_b +#define __msa_ilvod_h __builtin_msa_ilvod_h +#define __msa_ilvod_w __builtin_msa_ilvod_w +#define __msa_ilvod_d __builtin_msa_ilvod_d +#define __msa_vshf_b __builtin_msa_vshf_b +#define __msa_vshf_h __builtin_msa_vshf_h +#define __msa_vshf_w __builtin_msa_vshf_w +#define __msa_vshf_d __builtin_msa_vshf_d +#define __msa_and_v __builtin_msa_and_v +#define __msa_andi_b __builtin_msa_andi_b +#define __msa_or_v __builtin_msa_or_v +#define __msa_ori_b __builtin_msa_ori_b +#define __msa_nor_v __builtin_msa_nor_v +#define __msa_nori_b __builtin_msa_nori_b +#define __msa_xor_v __builtin_msa_xor_v +#define __msa_xori_b __builtin_msa_xori_b +#define __msa_bmnz_v __builtin_msa_bmnz_v +#define __msa_bmnzi_b __builtin_msa_bmnzi_b +#define __msa_bmz_v __builtin_msa_bmz_v +#define __msa_bmzi_b __builtin_msa_bmzi_b +#define __msa_bsel_v __builtin_msa_bsel_v +#define __msa_bseli_b __builtin_msa_bseli_b +#define __msa_shf_b __builtin_msa_shf_b +#define __msa_shf_h __builtin_msa_shf_h +#define __msa_shf_w __builtin_msa_shf_w +#define __msa_test_bnz_v __builtin_msa_bnz_v +#define __msa_test_bz_v __builtin_msa_bz_v +#define __msa_fill_b __builtin_msa_fill_b +#define __msa_fill_h __builtin_msa_fill_h +#define __msa_fill_w __builtin_msa_fill_w +#define __msa_fill_d __builtin_msa_fill_d +#define __msa_pcnt_b __builtin_msa_pcnt_b +#define __msa_pcnt_h __builtin_msa_pcnt_h +#define __msa_pcnt_w __builtin_msa_pcnt_w +#define __msa_pcnt_d __builtin_msa_pcnt_d +#define __msa_nloc_b __builtin_msa_nloc_b +#define __msa_nloc_h __builtin_msa_nloc_h +#define __msa_nloc_w __builtin_msa_nloc_w +#define __msa_nloc_d __builtin_msa_nloc_d +#define __msa_nlzc_b __builtin_msa_nlzc_b +#define __msa_nlzc_h __builtin_msa_nlzc_h +#define __msa_nlzc_w __builtin_msa_nlzc_w +#define __msa_nlzc_d __builtin_msa_nlzc_d +#define __msa_copy_s_b __builtin_msa_copy_s_b +#define __msa_copy_s_h __builtin_msa_copy_s_h +#define __msa_copy_s_w __builtin_msa_copy_s_w +#define __msa_copy_s_d __builtin_msa_copy_s_d +#define __msa_copy_u_b __builtin_msa_copy_u_b +#define __msa_copy_u_h __builtin_msa_copy_u_h +#define __msa_copy_u_w __builtin_msa_copy_u_w +#define __msa_copy_u_d __builtin_msa_copy_u_d +#define __msa_insert_b __builtin_msa_insert_b +#define __msa_insert_h __builtin_msa_insert_h +#define __msa_insert_w __builtin_msa_insert_w +#define __msa_insert_d __builtin_msa_insert_d +#define __msa_insve_b __builtin_msa_insve_b +#define __msa_insve_h __builtin_msa_insve_h +#define __msa_insve_w __builtin_msa_insve_w +#define __msa_insve_d __builtin_msa_insve_d +#define __msa_test_bnz_b __builtin_msa_bnz_b +#define __msa_test_bnz_h __builtin_msa_bnz_h +#define __msa_test_bnz_w __builtin_msa_bnz_w +#define __msa_test_bnz_d __builtin_msa_bnz_d +#define __msa_test_bz_b __builtin_msa_bz_b +#define __msa_test_bz_h __builtin_msa_bz_h +#define __msa_test_bz_w __builtin_msa_bz_w +#define __msa_test_bz_d __builtin_msa_bz_d +#define __msa_ldi_b __builtin_msa_ldi_b +#define __msa_ldi_h __builtin_msa_ldi_h +#define __msa_ldi_w __builtin_msa_ldi_w +#define __msa_ldi_d __builtin_msa_ldi_d +#define __msa_fcaf_w __builtin_msa_fcaf_w +#define __msa_fcaf_d __builtin_msa_fcaf_d +#define __msa_fcor_w __builtin_msa_fcor_w +#define __msa_fcor_d __builtin_msa_fcor_d +#define __msa_fcun_w __builtin_msa_fcun_w +#define __msa_fcun_d __builtin_msa_fcun_d +#define __msa_fcune_w __builtin_msa_fcune_w +#define __msa_fcune_d __builtin_msa_fcune_d +#define __msa_fcueq_w __builtin_msa_fcueq_w +#define __msa_fcueq_d __builtin_msa_fcueq_d +#define __msa_fceq_w __builtin_msa_fceq_w +#define __msa_fceq_d __builtin_msa_fceq_d +#define __msa_fcne_w __builtin_msa_fcne_w +#define __msa_fcne_d __builtin_msa_fcne_d +#define __msa_fclt_w __builtin_msa_fclt_w +#define __msa_fclt_d __builtin_msa_fclt_d +#define __msa_fcult_w __builtin_msa_fcult_w +#define __msa_fcult_d __builtin_msa_fcult_d +#define __msa_fcle_w __builtin_msa_fcle_w +#define __msa_fcle_d __builtin_msa_fcle_d +#define __msa_fcule_w __builtin_msa_fcule_w +#define __msa_fcule_d __builtin_msa_fcule_d +#define __msa_fsaf_w __builtin_msa_fsaf_w +#define __msa_fsaf_d __builtin_msa_fsaf_d +#define __msa_fsor_w __builtin_msa_fsor_w +#define __msa_fsor_d __builtin_msa_fsor_d +#define __msa_fsun_w __builtin_msa_fsun_w +#define __msa_fsun_d __builtin_msa_fsun_d +#define __msa_fsune_w __builtin_msa_fsune_w +#define __msa_fsune_d __builtin_msa_fsune_d +#define __msa_fsueq_w __builtin_msa_fsueq_w +#define __msa_fsueq_d __builtin_msa_fsueq_d +#define __msa_fseq_w __builtin_msa_fseq_w +#define __msa_fseq_d __builtin_msa_fseq_d +#define __msa_fsne_w __builtin_msa_fsne_w +#define __msa_fsne_d __builtin_msa_fsne_d +#define __msa_fslt_w __builtin_msa_fslt_w +#define __msa_fslt_d __builtin_msa_fslt_d +#define __msa_fsult_w __builtin_msa_fsult_w +#define __msa_fsult_d __builtin_msa_fsult_d +#define __msa_fsle_w __builtin_msa_fsle_w +#define __msa_fsle_d __builtin_msa_fsle_d +#define __msa_fsule_w __builtin_msa_fsule_w +#define __msa_fsule_d __builtin_msa_fsule_d +#define __msa_fadd_w __builtin_msa_fadd_w +#define __msa_fadd_d __builtin_msa_fadd_d +#define __msa_fsub_w __builtin_msa_fsub_w +#define __msa_fsub_d __builtin_msa_fsub_d +#define __msa_fmul_w __builtin_msa_fmul_w +#define __msa_fmul_d __builtin_msa_fmul_d +#define __msa_fdiv_w __builtin_msa_fdiv_w +#define __msa_fdiv_d __builtin_msa_fdiv_d +#define __msa_fmadd_w __builtin_msa_fmadd_w +#define __msa_fmadd_d __builtin_msa_fmadd_d +#define __msa_fmsub_w __builtin_msa_fmsub_w +#define __msa_fmsub_d __builtin_msa_fmsub_d +#define __msa_fexp2_w __builtin_msa_fexp2_w +#define __msa_fexp2_d __builtin_msa_fexp2_d +#define __msa_fexdo_h __builtin_msa_fexdo_h +#define __msa_fexdo_w __builtin_msa_fexdo_w +#define __msa_ftq_h __builtin_msa_ftq_h +#define __msa_ftq_w __builtin_msa_ftq_w +#define __msa_fmin_w __builtin_msa_fmin_w +#define __msa_fmin_d __builtin_msa_fmin_d +#define __msa_fmin_a_w __builtin_msa_fmin_a_w +#define __msa_fmin_a_d __builtin_msa_fmin_a_d +#define __msa_fmax_w __builtin_msa_fmax_w +#define __msa_fmax_d __builtin_msa_fmax_d +#define __msa_fmax_a_w __builtin_msa_fmax_a_w +#define __msa_fmax_a_d __builtin_msa_fmax_a_d +#define __msa_mul_q_h __builtin_msa_mul_q_h +#define __msa_mul_q_w __builtin_msa_mul_q_w +#define __msa_mulr_q_h __builtin_msa_mulr_q_h +#define __msa_mulr_q_w __builtin_msa_mulr_q_w +#define __msa_madd_q_h __builtin_msa_madd_q_h +#define __msa_madd_q_w __builtin_msa_madd_q_w +#define __msa_maddr_q_h __builtin_msa_maddr_q_h +#define __msa_maddr_q_w __builtin_msa_maddr_q_w +#define __msa_msub_q_h __builtin_msa_msub_q_h +#define __msa_msub_q_w __builtin_msa_msub_q_w +#define __msa_msubr_q_h __builtin_msa_msubr_q_h +#define __msa_msubr_q_w __builtin_msa_msubr_q_w +#define __msa_fclass_w __builtin_msa_fclass_w +#define __msa_fclass_d __builtin_msa_fclass_d +#define __msa_fsqrt_w __builtin_msa_fsqrt_w +#define __msa_fsqrt_d __builtin_msa_fsqrt_d +#define __msa_frcp_w __builtin_msa_frcp_w +#define __msa_frcp_d __builtin_msa_frcp_d +#define __msa_frint_w __builtin_msa_frint_w +#define __msa_frint_d __builtin_msa_frint_d +#define __msa_frsqrt_w __builtin_msa_frsqrt_w +#define __msa_frsqrt_d __builtin_msa_frsqrt_d +#define __msa_flog2_w __builtin_msa_flog2_w +#define __msa_flog2_d __builtin_msa_flog2_d +#define __msa_fexupl_w __builtin_msa_fexupl_w +#define __msa_fexupl_d __builtin_msa_fexupl_d +#define __msa_fexupr_w __builtin_msa_fexupr_w +#define __msa_fexupr_d __builtin_msa_fexupr_d +#define __msa_ffql_w __builtin_msa_ffql_w +#define __msa_ffql_d __builtin_msa_ffql_d +#define __msa_ffqr_w __builtin_msa_ffqr_w +#define __msa_ffqr_d __builtin_msa_ffqr_d +#define __msa_ftint_s_w __builtin_msa_ftint_s_w +#define __msa_ftint_s_d __builtin_msa_ftint_s_d +#define __msa_ftint_u_w __builtin_msa_ftint_u_w +#define __msa_ftint_u_d __builtin_msa_ftint_u_d +#define __msa_ftrunc_s_w __builtin_msa_ftrunc_s_w +#define __msa_ftrunc_s_d __builtin_msa_ftrunc_s_d +#define __msa_ftrunc_u_w __builtin_msa_ftrunc_u_w +#define __msa_ftrunc_u_d __builtin_msa_ftrunc_u_d +#define __msa_ffint_s_w __builtin_msa_ffint_s_w +#define __msa_ffint_s_d __builtin_msa_ffint_s_d +#define __msa_ffint_u_w __builtin_msa_ffint_u_w +#define __msa_ffint_u_d __builtin_msa_ffint_u_d +#define __msa_cfcmsa __builtin_msa_cfcmsa +#define __msa_move_v __builtin_msa_move_v +#endif /* defined(__mips_msa) */ +#endif /* _MSA_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdalign.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdalign.h new file mode 100644 index 0000000..243d40e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdalign.h @@ -0,0 +1,39 @@ +/* Copyright (C) 2011-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +/* ISO C1X: 7.15 Alignment . */ + +#ifndef _STDALIGN_H +#define _STDALIGN_H + +#ifndef __cplusplus + +#define alignas _Alignas +#define alignof _Alignof + +#define __alignas_is_defined 1 +#define __alignof_is_defined 1 + +#endif + +#endif /* stdalign.h */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdarg.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdarg.h new file mode 100644 index 0000000..aa248be --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdarg.h @@ -0,0 +1,127 @@ +/* Copyright (C) 1989-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +/* + * ISO C Standard: 7.15 Variable arguments + */ + +#ifndef _STDARG_H +#ifndef _ANSI_STDARG_H_ +#ifndef __need___va_list +#define _STDARG_H +#define _ANSI_STDARG_H_ +#endif /* not __need___va_list */ +#undef __need___va_list + +/* Define __gnuc_va_list. */ + +#ifndef __GNUC_VA_LIST +#define __GNUC_VA_LIST +typedef __builtin_va_list __gnuc_va_list; +#endif + +/* Define the standard macros for the user, + if this invocation was from the user program. */ +#ifdef _STDARG_H + +#define va_start(v,l) __builtin_va_start(v,l) +#define va_end(v) __builtin_va_end(v) +#define va_arg(v,l) __builtin_va_arg(v,l) +#if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L \ + || __cplusplus + 0 >= 201103L +#define va_copy(d,s) __builtin_va_copy(d,s) +#endif +#define __va_copy(d,s) __builtin_va_copy(d,s) + +/* Define va_list, if desired, from __gnuc_va_list. */ +/* We deliberately do not define va_list when called from + stdio.h, because ANSI C says that stdio.h is not supposed to define + va_list. stdio.h needs to have access to that data type, + but must not use that name. It should use the name __gnuc_va_list, + which is safe because it is reserved for the implementation. */ + +#ifdef _BSD_VA_LIST +#undef _BSD_VA_LIST +#endif + +#if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST)) +/* SVR4.2 uses _VA_LIST for an internal alias for va_list, + so we must avoid testing it and setting it here. + SVR4 uses _VA_LIST as a flag in stdarg.h, but we should + have no conflict with that. */ +#ifndef _VA_LIST_ +#define _VA_LIST_ +#ifdef __i860__ +#ifndef _VA_LIST +#define _VA_LIST va_list +#endif +#endif /* __i860__ */ +typedef __gnuc_va_list va_list; +#ifdef _SCO_DS +#define __VA_LIST +#endif +#endif /* _VA_LIST_ */ +#else /* not __svr4__ || _SCO_DS */ + +/* The macro _VA_LIST_ is the same thing used by this file in Ultrix. + But on BSD NET2 we must not test or define or undef it. + (Note that the comments in NET 2's ansi.h + are incorrect for _VA_LIST_--see stdio.h!) */ +#if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT) +/* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */ +#ifndef _VA_LIST_DEFINED +/* The macro _VA_LIST is used in SCO Unix 3.2. */ +#ifndef _VA_LIST +/* The macro _VA_LIST_T_H is used in the Bull dpx2 */ +#ifndef _VA_LIST_T_H +/* The macro __va_list__ is used by BeOS. */ +#ifndef __va_list__ +typedef __gnuc_va_list va_list; +#endif /* not __va_list__ */ +#endif /* not _VA_LIST_T_H */ +#endif /* not _VA_LIST */ +#endif /* not _VA_LIST_DEFINED */ +#if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__)) +#define _VA_LIST_ +#endif +#ifndef _VA_LIST +#define _VA_LIST +#endif +#ifndef _VA_LIST_DEFINED +#define _VA_LIST_DEFINED +#endif +#ifndef _VA_LIST_T_H +#define _VA_LIST_T_H +#endif +#ifndef __va_list__ +#define __va_list__ +#endif + +#endif /* not _VA_LIST_, except on certain systems */ + +#endif /* not __svr4__ */ + +#endif /* _STDARG_H */ + +#endif /* not _ANSI_STDARG_H_ */ +#endif /* not _STDARG_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdatomic.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdatomic.h new file mode 100644 index 0000000..fb29a14 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdatomic.h @@ -0,0 +1,243 @@ +/* Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +/* ISO C11 Standard: 7.17 Atomics . */ + +#ifndef _STDATOMIC_H +#define _STDATOMIC_H + +typedef enum + { + memory_order_relaxed = __ATOMIC_RELAXED, + memory_order_consume = __ATOMIC_CONSUME, + memory_order_acquire = __ATOMIC_ACQUIRE, + memory_order_release = __ATOMIC_RELEASE, + memory_order_acq_rel = __ATOMIC_ACQ_REL, + memory_order_seq_cst = __ATOMIC_SEQ_CST + } memory_order; + + +typedef _Atomic _Bool atomic_bool; +typedef _Atomic char atomic_char; +typedef _Atomic signed char atomic_schar; +typedef _Atomic unsigned char atomic_uchar; +typedef _Atomic short atomic_short; +typedef _Atomic unsigned short atomic_ushort; +typedef _Atomic int atomic_int; +typedef _Atomic unsigned int atomic_uint; +typedef _Atomic long atomic_long; +typedef _Atomic unsigned long atomic_ulong; +typedef _Atomic long long atomic_llong; +typedef _Atomic unsigned long long atomic_ullong; +typedef _Atomic __CHAR16_TYPE__ atomic_char16_t; +typedef _Atomic __CHAR32_TYPE__ atomic_char32_t; +typedef _Atomic __WCHAR_TYPE__ atomic_wchar_t; +typedef _Atomic __INT_LEAST8_TYPE__ atomic_int_least8_t; +typedef _Atomic __UINT_LEAST8_TYPE__ atomic_uint_least8_t; +typedef _Atomic __INT_LEAST16_TYPE__ atomic_int_least16_t; +typedef _Atomic __UINT_LEAST16_TYPE__ atomic_uint_least16_t; +typedef _Atomic __INT_LEAST32_TYPE__ atomic_int_least32_t; +typedef _Atomic __UINT_LEAST32_TYPE__ atomic_uint_least32_t; +typedef _Atomic __INT_LEAST64_TYPE__ atomic_int_least64_t; +typedef _Atomic __UINT_LEAST64_TYPE__ atomic_uint_least64_t; +typedef _Atomic __INT_FAST8_TYPE__ atomic_int_fast8_t; +typedef _Atomic __UINT_FAST8_TYPE__ atomic_uint_fast8_t; +typedef _Atomic __INT_FAST16_TYPE__ atomic_int_fast16_t; +typedef _Atomic __UINT_FAST16_TYPE__ atomic_uint_fast16_t; +typedef _Atomic __INT_FAST32_TYPE__ atomic_int_fast32_t; +typedef _Atomic __UINT_FAST32_TYPE__ atomic_uint_fast32_t; +typedef _Atomic __INT_FAST64_TYPE__ atomic_int_fast64_t; +typedef _Atomic __UINT_FAST64_TYPE__ atomic_uint_fast64_t; +typedef _Atomic __INTPTR_TYPE__ atomic_intptr_t; +typedef _Atomic __UINTPTR_TYPE__ atomic_uintptr_t; +typedef _Atomic __SIZE_TYPE__ atomic_size_t; +typedef _Atomic __PTRDIFF_TYPE__ atomic_ptrdiff_t; +typedef _Atomic __INTMAX_TYPE__ atomic_intmax_t; +typedef _Atomic __UINTMAX_TYPE__ atomic_uintmax_t; + + +#define ATOMIC_VAR_INIT(VALUE) (VALUE) + +/* Initialize an atomic object pointed to by PTR with VAL. */ +#define atomic_init(PTR, VAL) \ + atomic_store_explicit (PTR, VAL, __ATOMIC_RELAXED) + +#define kill_dependency(Y) \ + __extension__ \ + ({ \ + __auto_type __kill_dependency_tmp = (Y); \ + __kill_dependency_tmp; \ + }) + +extern void atomic_thread_fence (memory_order); +#define atomic_thread_fence(MO) __atomic_thread_fence (MO) +extern void atomic_signal_fence (memory_order); +#define atomic_signal_fence(MO) __atomic_signal_fence (MO) +#define atomic_is_lock_free(OBJ) __atomic_is_lock_free (sizeof (*(OBJ)), (OBJ)) + +#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE +#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE +#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE +#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE +#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE +#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE +#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE +#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE +#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE +#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE + + +/* Note that these macros require __typeof__ and __auto_type to remove + _Atomic qualifiers (and const qualifiers, if those are valid on + macro operands). + + Also note that the header file uses the generic form of __atomic + builtins, which requires the address to be taken of the value + parameter, and then we pass that value on. This allows the macros + to work for any type, and the compiler is smart enough to convert + these to lock-free _N variants if possible, and throw away the + temps. */ + +#define atomic_store_explicit(PTR, VAL, MO) \ + __extension__ \ + ({ \ + __auto_type __atomic_store_ptr = (PTR); \ + __typeof__ (*__atomic_store_ptr) __atomic_store_tmp = (VAL); \ + __atomic_store (__atomic_store_ptr, &__atomic_store_tmp, (MO)); \ + }) + +#define atomic_store(PTR, VAL) \ + atomic_store_explicit (PTR, VAL, __ATOMIC_SEQ_CST) + + +#define atomic_load_explicit(PTR, MO) \ + __extension__ \ + ({ \ + __auto_type __atomic_load_ptr = (PTR); \ + __typeof__ (*__atomic_load_ptr) __atomic_load_tmp; \ + __atomic_load (__atomic_load_ptr, &__atomic_load_tmp, (MO)); \ + __atomic_load_tmp; \ + }) + +#define atomic_load(PTR) atomic_load_explicit (PTR, __ATOMIC_SEQ_CST) + + +#define atomic_exchange_explicit(PTR, VAL, MO) \ + __extension__ \ + ({ \ + __auto_type __atomic_exchange_ptr = (PTR); \ + __typeof__ (*__atomic_exchange_ptr) __atomic_exchange_val = (VAL); \ + __typeof__ (*__atomic_exchange_ptr) __atomic_exchange_tmp; \ + __atomic_exchange (__atomic_exchange_ptr, &__atomic_exchange_val, \ + &__atomic_exchange_tmp, (MO)); \ + __atomic_exchange_tmp; \ + }) + +#define atomic_exchange(PTR, VAL) \ + atomic_exchange_explicit (PTR, VAL, __ATOMIC_SEQ_CST) + + +#define atomic_compare_exchange_strong_explicit(PTR, VAL, DES, SUC, FAIL) \ + __extension__ \ + ({ \ + __auto_type __atomic_compare_exchange_ptr = (PTR); \ + __typeof__ (*__atomic_compare_exchange_ptr) __atomic_compare_exchange_tmp \ + = (DES); \ + __atomic_compare_exchange (__atomic_compare_exchange_ptr, (VAL), \ + &__atomic_compare_exchange_tmp, 0, \ + (SUC), (FAIL)); \ + }) + +#define atomic_compare_exchange_strong(PTR, VAL, DES) \ + atomic_compare_exchange_strong_explicit (PTR, VAL, DES, __ATOMIC_SEQ_CST, \ + __ATOMIC_SEQ_CST) + +#define atomic_compare_exchange_weak_explicit(PTR, VAL, DES, SUC, FAIL) \ + __extension__ \ + ({ \ + __auto_type __atomic_compare_exchange_ptr = (PTR); \ + __typeof__ (*__atomic_compare_exchange_ptr) __atomic_compare_exchange_tmp \ + = (DES); \ + __atomic_compare_exchange (__atomic_compare_exchange_ptr, (VAL), \ + &__atomic_compare_exchange_tmp, 1, \ + (SUC), (FAIL)); \ + }) + +#define atomic_compare_exchange_weak(PTR, VAL, DES) \ + atomic_compare_exchange_weak_explicit (PTR, VAL, DES, __ATOMIC_SEQ_CST, \ + __ATOMIC_SEQ_CST) + + + +#define atomic_fetch_add(PTR, VAL) __atomic_fetch_add ((PTR), (VAL), \ + __ATOMIC_SEQ_CST) +#define atomic_fetch_add_explicit(PTR, VAL, MO) \ + __atomic_fetch_add ((PTR), (VAL), (MO)) + +#define atomic_fetch_sub(PTR, VAL) __atomic_fetch_sub ((PTR), (VAL), \ + __ATOMIC_SEQ_CST) +#define atomic_fetch_sub_explicit(PTR, VAL, MO) \ + __atomic_fetch_sub ((PTR), (VAL), (MO)) + +#define atomic_fetch_or(PTR, VAL) __atomic_fetch_or ((PTR), (VAL), \ + __ATOMIC_SEQ_CST) +#define atomic_fetch_or_explicit(PTR, VAL, MO) \ + __atomic_fetch_or ((PTR), (VAL), (MO)) + +#define atomic_fetch_xor(PTR, VAL) __atomic_fetch_xor ((PTR), (VAL), \ + __ATOMIC_SEQ_CST) +#define atomic_fetch_xor_explicit(PTR, VAL, MO) \ + __atomic_fetch_xor ((PTR), (VAL), (MO)) + +#define atomic_fetch_and(PTR, VAL) __atomic_fetch_and ((PTR), (VAL), \ + __ATOMIC_SEQ_CST) +#define atomic_fetch_and_explicit(PTR, VAL, MO) \ + __atomic_fetch_and ((PTR), (VAL), (MO)) + + +typedef _Atomic struct +{ +#if __GCC_ATOMIC_TEST_AND_SET_TRUEVAL == 1 + _Bool __val; +#else + unsigned char __val; +#endif +} atomic_flag; + +#define ATOMIC_FLAG_INIT { 0 } + + +extern _Bool atomic_flag_test_and_set (volatile atomic_flag *); +#define atomic_flag_test_and_set(PTR) \ + __atomic_test_and_set ((PTR), __ATOMIC_SEQ_CST) +extern _Bool atomic_flag_test_and_set_explicit (volatile atomic_flag *, + memory_order); +#define atomic_flag_test_and_set_explicit(PTR, MO) \ + __atomic_test_and_set ((PTR), (MO)) + +extern void atomic_flag_clear (volatile atomic_flag *); +#define atomic_flag_clear(PTR) __atomic_clear ((PTR), __ATOMIC_SEQ_CST) +extern void atomic_flag_clear_explicit (volatile atomic_flag *, memory_order); +#define atomic_flag_clear_explicit(PTR, MO) __atomic_clear ((PTR), (MO)) + +#endif /* _STDATOMIC_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdbool.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdbool.h new file mode 100644 index 0000000..a69fc3a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdbool.h @@ -0,0 +1,54 @@ +/* Copyright (C) 1998-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +/* + * ISO C Standard: 7.16 Boolean type and values + */ + +#ifndef _STDBOOL_H +#define _STDBOOL_H + +#ifndef __cplusplus + +#define bool _Bool +#define true 1 +#define false 0 + +#else /* __cplusplus */ + +/* Supporting _Bool in C++ is a GCC extension. */ +#define _Bool bool + +#if __cplusplus < 201103L +/* Defining these macros in C++98 is a GCC extension. */ +#define bool bool +#define false false +#define true true +#endif + +#endif /* __cplusplus */ + +/* Signal that all the definitions are present. */ +#define __bool_true_false_are_defined 1 + +#endif /* stdbool.h */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stddef.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stddef.h new file mode 100644 index 0000000..872f451 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stddef.h @@ -0,0 +1,451 @@ +/* Copyright (C) 1989-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +/* + * ISO C Standard: 7.17 Common definitions + */ +#if (!defined(_STDDEF_H) && !defined(_STDDEF_H_) && !defined(_ANSI_STDDEF_H) \ + && !defined(__STDDEF_H__)) \ + || defined(__need_wchar_t) || defined(__need_size_t) \ + || defined(__need_ptrdiff_t) || defined(__need_NULL) \ + || defined(__need_wint_t) + +/* Any one of these symbols __need_* means that GNU libc + wants us just to define one data type. So don't define + the symbols that indicate this file's entire job has been done. */ +#if (!defined(__need_wchar_t) && !defined(__need_size_t) \ + && !defined(__need_ptrdiff_t) && !defined(__need_NULL) \ + && !defined(__need_wint_t)) +#define _STDDEF_H +#define _STDDEF_H_ +/* snaroff@next.com says the NeXT needs this. */ +#define _ANSI_STDDEF_H +#endif + +#ifndef __sys_stdtypes_h +/* This avoids lossage on SunOS but only if stdtypes.h comes first. + There's no way to win with the other order! Sun lossage. */ + +/* On 4.3bsd-net2, make sure ansi.h is included, so we have + one less case to deal with in the following. */ +#if defined (__BSD_NET2__) || defined (____386BSD____) || (defined (__FreeBSD__) && (__FreeBSD__ < 5)) || defined(__NetBSD__) +#include +#endif +/* On FreeBSD 5, machine/ansi.h does not exist anymore... */ +#if defined (__FreeBSD__) && (__FreeBSD__ >= 5) +#include +#endif + +/* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are + defined if the corresponding type is *not* defined. + FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_. + NetBSD defines _I386_ANSI_H_ and _X86_64_ANSI_H_ instead of _ANSI_H_ */ +#if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) || defined(_X86_64_ANSI_H_) || defined(_I386_ANSI_H_) +#if !defined(_SIZE_T_) && !defined(_BSD_SIZE_T_) +#define _SIZE_T +#endif +#if !defined(_PTRDIFF_T_) && !defined(_BSD_PTRDIFF_T_) +#define _PTRDIFF_T +#endif +/* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_ + instead of _WCHAR_T_. */ +#if !defined(_WCHAR_T_) && !defined(_BSD_WCHAR_T_) +#ifndef _BSD_WCHAR_T_ +#define _WCHAR_T +#endif +#endif +/* Undef _FOO_T_ if we are supposed to define foo_t. */ +#if defined (__need_ptrdiff_t) || defined (_STDDEF_H_) +#undef _PTRDIFF_T_ +#undef _BSD_PTRDIFF_T_ +#endif +#if defined (__need_size_t) || defined (_STDDEF_H_) +#undef _SIZE_T_ +#undef _BSD_SIZE_T_ +#endif +#if defined (__need_wchar_t) || defined (_STDDEF_H_) +#undef _WCHAR_T_ +#undef _BSD_WCHAR_T_ +#endif +#endif /* defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) || defined(_X86_64_ANSI_H_) || defined(_I386_ANSI_H_) */ + +/* Sequent's header files use _PTRDIFF_T_ in some conflicting way. + Just ignore it. */ +#if defined (__sequent__) && defined (_PTRDIFF_T_) +#undef _PTRDIFF_T_ +#endif + +/* On VxWorks, may have defined macros like + _TYPE_size_t which will typedef size_t. fixincludes patched the + vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is + not defined, and so that defining this macro defines _GCC_SIZE_T. + If we find that the macros are still defined at this point, we must + invoke them so that the type is defined as expected. */ +#if defined (_TYPE_ptrdiff_t) && (defined (__need_ptrdiff_t) || defined (_STDDEF_H_)) +_TYPE_ptrdiff_t; +#undef _TYPE_ptrdiff_t +#endif +#if defined (_TYPE_size_t) && (defined (__need_size_t) || defined (_STDDEF_H_)) +_TYPE_size_t; +#undef _TYPE_size_t +#endif +#if defined (_TYPE_wchar_t) && (defined (__need_wchar_t) || defined (_STDDEF_H_)) +_TYPE_wchar_t; +#undef _TYPE_wchar_t +#endif + +/* In case nobody has defined these types, but we aren't running under + GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE_TYPE__, and + __WCHAR_TYPE__ have reasonable values. This can happen if the + parts of GCC is compiled by an older compiler, that actually + include gstddef.h, such as collect2. */ + +/* Signed type of difference of two pointers. */ + +/* Define this type if we are doing the whole job, + or if we want this type in particular. */ +#if defined (_STDDEF_H) || defined (__need_ptrdiff_t) +#ifndef _PTRDIFF_T /* in case has defined it. */ +#ifndef _T_PTRDIFF_ +#ifndef _T_PTRDIFF +#ifndef __PTRDIFF_T +#ifndef _PTRDIFF_T_ +#ifndef _BSD_PTRDIFF_T_ +#ifndef ___int_ptrdiff_t_h +#ifndef _GCC_PTRDIFF_T +#ifndef _PTRDIFF_T_DECLARED /* DragonFly */ +#define _PTRDIFF_T +#define _T_PTRDIFF_ +#define _T_PTRDIFF +#define __PTRDIFF_T +#define _PTRDIFF_T_ +#define _BSD_PTRDIFF_T_ +#define ___int_ptrdiff_t_h +#define _GCC_PTRDIFF_T +#define _PTRDIFF_T_DECLARED +#ifndef __PTRDIFF_TYPE__ +#define __PTRDIFF_TYPE__ long int +#endif +typedef __PTRDIFF_TYPE__ ptrdiff_t; +#endif /* _PTRDIFF_T_DECLARED */ +#endif /* _GCC_PTRDIFF_T */ +#endif /* ___int_ptrdiff_t_h */ +#endif /* _BSD_PTRDIFF_T_ */ +#endif /* _PTRDIFF_T_ */ +#endif /* __PTRDIFF_T */ +#endif /* _T_PTRDIFF */ +#endif /* _T_PTRDIFF_ */ +#endif /* _PTRDIFF_T */ + +/* If this symbol has done its job, get rid of it. */ +#undef __need_ptrdiff_t + +#endif /* _STDDEF_H or __need_ptrdiff_t. */ + +/* Unsigned type of `sizeof' something. */ + +/* Define this type if we are doing the whole job, + or if we want this type in particular. */ +#if defined (_STDDEF_H) || defined (__need_size_t) +#ifndef __size_t__ /* BeOS */ +#ifndef __SIZE_T__ /* Cray Unicos/Mk */ +#ifndef _SIZE_T /* in case has defined it. */ +#ifndef _SYS_SIZE_T_H +#ifndef _T_SIZE_ +#ifndef _T_SIZE +#ifndef __SIZE_T +#ifndef _SIZE_T_ +#ifndef _BSD_SIZE_T_ +#ifndef _SIZE_T_DEFINED_ +#ifndef _SIZE_T_DEFINED +#ifndef _BSD_SIZE_T_DEFINED_ /* Darwin */ +#ifndef _SIZE_T_DECLARED /* FreeBSD 5 */ +#ifndef ___int_size_t_h +#ifndef _GCC_SIZE_T +#ifndef _SIZET_ +#ifndef __size_t +#define __size_t__ /* BeOS */ +#define __SIZE_T__ /* Cray Unicos/Mk */ +#define _SIZE_T +#define _SYS_SIZE_T_H +#define _T_SIZE_ +#define _T_SIZE +#define __SIZE_T +#define _SIZE_T_ +#define _BSD_SIZE_T_ +#define _SIZE_T_DEFINED_ +#define _SIZE_T_DEFINED +#define _BSD_SIZE_T_DEFINED_ /* Darwin */ +#define _SIZE_T_DECLARED /* FreeBSD 5 */ +#define ___int_size_t_h +#define _GCC_SIZE_T +#define _SIZET_ +#if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \ + || defined(__DragonFly__) \ + || defined(__FreeBSD_kernel__) +/* __size_t is a typedef on FreeBSD 5, must not trash it. */ +#elif defined (__VMS__) +/* __size_t is also a typedef on VMS. */ +#else +#define __size_t +#endif +#ifndef __SIZE_TYPE__ +#define __SIZE_TYPE__ long unsigned int +#endif +#if !(defined (__GNUG__) && defined (size_t)) +typedef __SIZE_TYPE__ size_t; +#ifdef __BEOS__ +typedef long ssize_t; +#endif /* __BEOS__ */ +#endif /* !(defined (__GNUG__) && defined (size_t)) */ +#endif /* __size_t */ +#endif /* _SIZET_ */ +#endif /* _GCC_SIZE_T */ +#endif /* ___int_size_t_h */ +#endif /* _SIZE_T_DECLARED */ +#endif /* _BSD_SIZE_T_DEFINED_ */ +#endif /* _SIZE_T_DEFINED */ +#endif /* _SIZE_T_DEFINED_ */ +#endif /* _BSD_SIZE_T_ */ +#endif /* _SIZE_T_ */ +#endif /* __SIZE_T */ +#endif /* _T_SIZE */ +#endif /* _T_SIZE_ */ +#endif /* _SYS_SIZE_T_H */ +#endif /* _SIZE_T */ +#endif /* __SIZE_T__ */ +#endif /* __size_t__ */ +#undef __need_size_t +#endif /* _STDDEF_H or __need_size_t. */ + + +/* Wide character type. + Locale-writers should change this as necessary to + be big enough to hold unique values not between 0 and 127, + and not (wchar_t) -1, for each defined multibyte character. */ + +/* Define this type if we are doing the whole job, + or if we want this type in particular. */ +#if defined (_STDDEF_H) || defined (__need_wchar_t) +#ifndef __wchar_t__ /* BeOS */ +#ifndef __WCHAR_T__ /* Cray Unicos/Mk */ +#ifndef _WCHAR_T +#ifndef _T_WCHAR_ +#ifndef _T_WCHAR +#ifndef __WCHAR_T +#ifndef _WCHAR_T_ +#ifndef _BSD_WCHAR_T_ +#ifndef _BSD_WCHAR_T_DEFINED_ /* Darwin */ +#ifndef _BSD_RUNE_T_DEFINED_ /* Darwin */ +#ifndef _WCHAR_T_DECLARED /* FreeBSD 5 */ +#ifndef _WCHAR_T_DEFINED_ +#ifndef _WCHAR_T_DEFINED +#ifndef _WCHAR_T_H +#ifndef ___int_wchar_t_h +#ifndef __INT_WCHAR_T_H +#ifndef _GCC_WCHAR_T +#define __wchar_t__ /* BeOS */ +#define __WCHAR_T__ /* Cray Unicos/Mk */ +#define _WCHAR_T +#define _T_WCHAR_ +#define _T_WCHAR +#define __WCHAR_T +#define _WCHAR_T_ +#define _BSD_WCHAR_T_ +#define _WCHAR_T_DEFINED_ +#define _WCHAR_T_DEFINED +#define _WCHAR_T_H +#define ___int_wchar_t_h +#define __INT_WCHAR_T_H +#define _GCC_WCHAR_T +#define _WCHAR_T_DECLARED + +/* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_ + instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other + symbols in the _FOO_T_ family, stays defined even after its + corresponding type is defined). If we define wchar_t, then we + must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if + we undef _WCHAR_T_, then we must also define rune_t, since + headers like runetype.h assume that if machine/ansi.h is included, + and _BSD_WCHAR_T_ is not defined, then rune_t is available. + machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of + the same type." */ +#ifdef _BSD_WCHAR_T_ +#undef _BSD_WCHAR_T_ +#ifdef _BSD_RUNE_T_ +#if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE) +typedef _BSD_RUNE_T_ rune_t; +#define _BSD_WCHAR_T_DEFINED_ +#define _BSD_RUNE_T_DEFINED_ /* Darwin */ +#if defined (__FreeBSD__) && (__FreeBSD__ < 5) +/* Why is this file so hard to maintain properly? In contrast to + the comment above regarding BSD/386 1.1, on FreeBSD for as long + as the symbol has existed, _BSD_RUNE_T_ must not stay defined or + redundant typedefs will occur when stdlib.h is included after this file. */ +#undef _BSD_RUNE_T_ +#endif +#endif +#endif +#endif +/* FreeBSD 5 can't be handled well using "traditional" logic above + since it no longer defines _BSD_RUNE_T_ yet still desires to export + rune_t in some cases... */ +#if defined (__FreeBSD__) && (__FreeBSD__ >= 5) +#if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE) +#if __BSD_VISIBLE +#ifndef _RUNE_T_DECLARED +typedef __rune_t rune_t; +#define _RUNE_T_DECLARED +#endif +#endif +#endif +#endif + +#ifndef __WCHAR_TYPE__ +#define __WCHAR_TYPE__ int +#endif +#ifndef __cplusplus +typedef __WCHAR_TYPE__ wchar_t; +#endif +#endif +#endif +#endif +#endif +#endif +#endif +#endif /* _WCHAR_T_DECLARED */ +#endif /* _BSD_RUNE_T_DEFINED_ */ +#endif +#endif +#endif +#endif +#endif +#endif +#endif +#endif /* __WCHAR_T__ */ +#endif /* __wchar_t__ */ +#undef __need_wchar_t +#endif /* _STDDEF_H or __need_wchar_t. */ + +#if defined (__need_wint_t) +#ifndef _WINT_T +#define _WINT_T + +#ifndef __WINT_TYPE__ +#define __WINT_TYPE__ unsigned int +#endif +typedef __WINT_TYPE__ wint_t; +#endif +#undef __need_wint_t +#endif + +/* In 4.3bsd-net2, leave these undefined to indicate that size_t, etc. + are already defined. */ +/* BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here. */ +/* NetBSD 5 requires the I386_ANSI_H and X86_64_ANSI_H checks here. */ +#if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) || defined(_X86_64_ANSI_H_) || defined(_I386_ANSI_H_) +/* The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_ + are probably typos and should be removed before 2.8 is released. */ +#ifdef _GCC_PTRDIFF_T_ +#undef _PTRDIFF_T_ +#undef _BSD_PTRDIFF_T_ +#endif +#ifdef _GCC_SIZE_T_ +#undef _SIZE_T_ +#undef _BSD_SIZE_T_ +#endif +#ifdef _GCC_WCHAR_T_ +#undef _WCHAR_T_ +#undef _BSD_WCHAR_T_ +#endif +/* The following ones are the real ones. */ +#ifdef _GCC_PTRDIFF_T +#undef _PTRDIFF_T_ +#undef _BSD_PTRDIFF_T_ +#endif +#ifdef _GCC_SIZE_T +#undef _SIZE_T_ +#undef _BSD_SIZE_T_ +#endif +#ifdef _GCC_WCHAR_T +#undef _WCHAR_T_ +#undef _BSD_WCHAR_T_ +#endif +#endif /* _ANSI_H_ || _MACHINE_ANSI_H_ || _X86_64_ANSI_H_ || _I386_ANSI_H_ */ + +#endif /* __sys_stdtypes_h */ + +/* A null pointer constant. */ + +#if defined (_STDDEF_H) || defined (__need_NULL) +#undef NULL /* in case has defined it. */ +#ifdef __GNUG__ +#define NULL __null +#else /* G++ */ +#ifndef __cplusplus +#define NULL ((void *)0) +#else /* C++ */ +#define NULL 0 +#endif /* C++ */ +#endif /* G++ */ +#endif /* NULL not defined and or need NULL. */ +#undef __need_NULL + +#ifdef _STDDEF_H + +/* Offset of member MEMBER in a struct of type TYPE. */ +#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER) + +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) \ + || (defined(__cplusplus) && __cplusplus >= 201103L) +#ifndef _GCC_MAX_ALIGN_T +#define _GCC_MAX_ALIGN_T +/* Type whose alignment is supported in every context and is at least + as great as that of any standard type not using alignment + specifiers. */ +typedef struct { + long long __max_align_ll __attribute__((__aligned__(__alignof__(long long)))); + long double __max_align_ld __attribute__((__aligned__(__alignof__(long double)))); + /* _Float128 is defined as a basic type, so max_align_t must be + sufficiently aligned for it. This code must work in C++, so we + use __float128 here; that is only available on some + architectures, but only on i386 is extra alignment needed for + __float128. */ +#ifdef __i386__ + __float128 __max_align_f128 __attribute__((__aligned__(__alignof(__float128)))); +#endif +} max_align_t; +#endif +#endif /* C11 or C++11. */ + +#if defined(__cplusplus) && __cplusplus >= 201103L +#ifndef _GXX_NULLPTR_T +#define _GXX_NULLPTR_T + typedef decltype(nullptr) nullptr_t; +#endif +#endif /* C++11. */ + +#endif /* _STDDEF_H was defined this time */ + +#endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__ + || __need_XXX was not defined before */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdfix.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdfix.h new file mode 100644 index 0000000..9de1b72 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdfix.h @@ -0,0 +1,204 @@ +/* Copyright (C) 2007-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +/* ISO/IEC JTC1 SC22 WG14 N1169 + * Date: 2006-04-04 + * ISO/IEC TR 18037 + * Programming languages - C - Extensions to support embedded processors + */ + +#ifndef _STDFIX_H +#define _STDFIX_H + +/* 7.18a.1 Introduction. */ + +#undef fract +#undef accum +#undef sat +#define fract _Fract +#define accum _Accum +#define sat _Sat + +/* 7.18a.3 Precision macros. */ + +#undef SFRACT_FBIT +#undef SFRACT_MIN +#undef SFRACT_MAX +#undef SFRACT_EPSILON +#define SFRACT_FBIT __SFRACT_FBIT__ +#define SFRACT_MIN __SFRACT_MIN__ +#define SFRACT_MAX __SFRACT_MAX__ +#define SFRACT_EPSILON __SFRACT_EPSILON__ + +#undef USFRACT_FBIT +#undef USFRACT_MIN +#undef USFRACT_MAX +#undef USFRACT_EPSILON +#define USFRACT_FBIT __USFRACT_FBIT__ +#define USFRACT_MIN __USFRACT_MIN__ /* GCC extension. */ +#define USFRACT_MAX __USFRACT_MAX__ +#define USFRACT_EPSILON __USFRACT_EPSILON__ + +#undef FRACT_FBIT +#undef FRACT_MIN +#undef FRACT_MAX +#undef FRACT_EPSILON +#define FRACT_FBIT __FRACT_FBIT__ +#define FRACT_MIN __FRACT_MIN__ +#define FRACT_MAX __FRACT_MAX__ +#define FRACT_EPSILON __FRACT_EPSILON__ + +#undef UFRACT_FBIT +#undef UFRACT_MIN +#undef UFRACT_MAX +#undef UFRACT_EPSILON +#define UFRACT_FBIT __UFRACT_FBIT__ +#define UFRACT_MIN __UFRACT_MIN__ /* GCC extension. */ +#define UFRACT_MAX __UFRACT_MAX__ +#define UFRACT_EPSILON __UFRACT_EPSILON__ + +#undef LFRACT_FBIT +#undef LFRACT_MIN +#undef LFRACT_MAX +#undef LFRACT_EPSILON +#define LFRACT_FBIT __LFRACT_FBIT__ +#define LFRACT_MIN __LFRACT_MIN__ +#define LFRACT_MAX __LFRACT_MAX__ +#define LFRACT_EPSILON __LFRACT_EPSILON__ + +#undef ULFRACT_FBIT +#undef ULFRACT_MIN +#undef ULFRACT_MAX +#undef ULFRACT_EPSILON +#define ULFRACT_FBIT __ULFRACT_FBIT__ +#define ULFRACT_MIN __ULFRACT_MIN__ /* GCC extension. */ +#define ULFRACT_MAX __ULFRACT_MAX__ +#define ULFRACT_EPSILON __ULFRACT_EPSILON__ + +#undef LLFRACT_FBIT +#undef LLFRACT_MIN +#undef LLFRACT_MAX +#undef LLFRACT_EPSILON +#define LLFRACT_FBIT __LLFRACT_FBIT__ /* GCC extension. */ +#define LLFRACT_MIN __LLFRACT_MIN__ /* GCC extension. */ +#define LLFRACT_MAX __LLFRACT_MAX__ /* GCC extension. */ +#define LLFRACT_EPSILON __LLFRACT_EPSILON__ /* GCC extension. */ + +#undef ULLFRACT_FBIT +#undef ULLFRACT_MIN +#undef ULLFRACT_MAX +#undef ULLFRACT_EPSILON +#define ULLFRACT_FBIT __ULLFRACT_FBIT__ /* GCC extension. */ +#define ULLFRACT_MIN __ULLFRACT_MIN__ /* GCC extension. */ +#define ULLFRACT_MAX __ULLFRACT_MAX__ /* GCC extension. */ +#define ULLFRACT_EPSILON __ULLFRACT_EPSILON__ /* GCC extension. */ + +#undef SACCUM_FBIT +#undef SACCUM_IBIT +#undef SACCUM_MIN +#undef SACCUM_MAX +#undef SACCUM_EPSILON +#define SACCUM_FBIT __SACCUM_FBIT__ +#define SACCUM_IBIT __SACCUM_IBIT__ +#define SACCUM_MIN __SACCUM_MIN__ +#define SACCUM_MAX __SACCUM_MAX__ +#define SACCUM_EPSILON __SACCUM_EPSILON__ + +#undef USACCUM_FBIT +#undef USACCUM_IBIT +#undef USACCUM_MIN +#undef USACCUM_MAX +#undef USACCUM_EPSILON +#define USACCUM_FBIT __USACCUM_FBIT__ +#define USACCUM_IBIT __USACCUM_IBIT__ +#define USACCUM_MIN __USACCUM_MIN__ /* GCC extension. */ +#define USACCUM_MAX __USACCUM_MAX__ +#define USACCUM_EPSILON __USACCUM_EPSILON__ + +#undef ACCUM_FBIT +#undef ACCUM_IBIT +#undef ACCUM_MIN +#undef ACCUM_MAX +#undef ACCUM_EPSILON +#define ACCUM_FBIT __ACCUM_FBIT__ +#define ACCUM_IBIT __ACCUM_IBIT__ +#define ACCUM_MIN __ACCUM_MIN__ +#define ACCUM_MAX __ACCUM_MAX__ +#define ACCUM_EPSILON __ACCUM_EPSILON__ + +#undef UACCUM_FBIT +#undef UACCUM_IBIT +#undef UACCUM_MIN +#undef UACCUM_MAX +#undef UACCUM_EPSILON +#define UACCUM_FBIT __UACCUM_FBIT__ +#define UACCUM_IBIT __UACCUM_IBIT__ +#define UACCUM_MIN __UACCUM_MIN__ /* GCC extension. */ +#define UACCUM_MAX __UACCUM_MAX__ +#define UACCUM_EPSILON __UACCUM_EPSILON__ + +#undef LACCUM_FBIT +#undef LACCUM_IBIT +#undef LACCUM_MIN +#undef LACCUM_MAX +#undef LACCUM_EPSILON +#define LACCUM_FBIT __LACCUM_FBIT__ +#define LACCUM_IBIT __LACCUM_IBIT__ +#define LACCUM_MIN __LACCUM_MIN__ +#define LACCUM_MAX __LACCUM_MAX__ +#define LACCUM_EPSILON __LACCUM_EPSILON__ + +#undef ULACCUM_FBIT +#undef ULACCUM_IBIT +#undef ULACCUM_MIN +#undef ULACCUM_MAX +#undef ULACCUM_EPSILON +#define ULACCUM_FBIT __ULACCUM_FBIT__ +#define ULACCUM_IBIT __ULACCUM_IBIT__ +#define ULACCUM_MIN __ULACCUM_MIN__ /* GCC extension. */ +#define ULACCUM_MAX __ULACCUM_MAX__ +#define ULACCUM_EPSILON __ULACCUM_EPSILON__ + +#undef LLACCUM_FBIT +#undef LLACCUM_IBIT +#undef LLACCUM_MIN +#undef LLACCUM_MAX +#undef LLACCUM_EPSILON +#define LLACCUM_FBIT __LLACCUM_FBIT__ /* GCC extension. */ +#define LLACCUM_IBIT __LLACCUM_IBIT__ /* GCC extension. */ +#define LLACCUM_MIN __LLACCUM_MIN__ /* GCC extension. */ +#define LLACCUM_MAX __LLACCUM_MAX__ /* GCC extension. */ +#define LLACCUM_EPSILON __LLACCUM_EPSILON__ /* GCC extension. */ + +#undef ULLACCUM_FBIT +#undef ULLACCUM_IBIT +#undef ULLACCUM_MIN +#undef ULLACCUM_MAX +#undef ULLACCUM_EPSILON +#define ULLACCUM_FBIT __ULLACCUM_FBIT__ /* GCC extension. */ +#define ULLACCUM_IBIT __ULLACCUM_IBIT__ /* GCC extension. */ +#define ULLACCUM_MIN __ULLACCUM_MIN__ /* GCC extension. */ +#define ULLACCUM_MAX __ULLACCUM_MAX__ /* GCC extension. */ +#define ULLACCUM_EPSILON __ULLACCUM_EPSILON__ /* GCC extension. */ + +#endif /* _STDFIX_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdint-gcc.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdint-gcc.h new file mode 100644 index 0000000..0ee7e35 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdint-gcc.h @@ -0,0 +1,364 @@ +/* Copyright (C) 2008-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +/* + * ISO C Standard: 7.18 Integer types + */ + +#ifndef _GCC_STDINT_H +#define _GCC_STDINT_H + +/* 7.8.1.1 Exact-width integer types */ + +#ifdef __INT8_TYPE__ +typedef __INT8_TYPE__ int8_t; +#endif +#ifdef __INT16_TYPE__ +typedef __INT16_TYPE__ int16_t; +#endif +#ifdef __INT32_TYPE__ +typedef __INT32_TYPE__ int32_t; +#endif +#ifdef __INT64_TYPE__ +typedef __INT64_TYPE__ int64_t; +#endif +#ifdef __UINT8_TYPE__ +typedef __UINT8_TYPE__ uint8_t; +#endif +#ifdef __UINT16_TYPE__ +typedef __UINT16_TYPE__ uint16_t; +#endif +#ifdef __UINT32_TYPE__ +typedef __UINT32_TYPE__ uint32_t; +#endif +#ifdef __UINT64_TYPE__ +typedef __UINT64_TYPE__ uint64_t; +#endif + +/* 7.8.1.2 Minimum-width integer types */ + +typedef __INT_LEAST8_TYPE__ int_least8_t; +typedef __INT_LEAST16_TYPE__ int_least16_t; +typedef __INT_LEAST32_TYPE__ int_least32_t; +typedef __INT_LEAST64_TYPE__ int_least64_t; +typedef __UINT_LEAST8_TYPE__ uint_least8_t; +typedef __UINT_LEAST16_TYPE__ uint_least16_t; +typedef __UINT_LEAST32_TYPE__ uint_least32_t; +typedef __UINT_LEAST64_TYPE__ uint_least64_t; + +/* 7.8.1.3 Fastest minimum-width integer types */ + +typedef __INT_FAST8_TYPE__ int_fast8_t; +typedef __INT_FAST16_TYPE__ int_fast16_t; +typedef __INT_FAST32_TYPE__ int_fast32_t; +typedef __INT_FAST64_TYPE__ int_fast64_t; +typedef __UINT_FAST8_TYPE__ uint_fast8_t; +typedef __UINT_FAST16_TYPE__ uint_fast16_t; +typedef __UINT_FAST32_TYPE__ uint_fast32_t; +typedef __UINT_FAST64_TYPE__ uint_fast64_t; + +/* 7.8.1.4 Integer types capable of holding object pointers */ + +#ifdef __INTPTR_TYPE__ +typedef __INTPTR_TYPE__ intptr_t; +#endif +#ifdef __UINTPTR_TYPE__ +typedef __UINTPTR_TYPE__ uintptr_t; +#endif + +/* 7.8.1.5 Greatest-width integer types */ + +typedef __INTMAX_TYPE__ intmax_t; +typedef __UINTMAX_TYPE__ uintmax_t; + +#if (!defined __cplusplus || __cplusplus >= 201103L \ + || defined __STDC_LIMIT_MACROS) + +/* 7.18.2 Limits of specified-width integer types */ + +#ifdef __INT8_MAX__ +# undef INT8_MAX +# define INT8_MAX __INT8_MAX__ +# undef INT8_MIN +# define INT8_MIN (-INT8_MAX - 1) +#endif +#ifdef __UINT8_MAX__ +# undef UINT8_MAX +# define UINT8_MAX __UINT8_MAX__ +#endif +#ifdef __INT16_MAX__ +# undef INT16_MAX +# define INT16_MAX __INT16_MAX__ +# undef INT16_MIN +# define INT16_MIN (-INT16_MAX - 1) +#endif +#ifdef __UINT16_MAX__ +# undef UINT16_MAX +# define UINT16_MAX __UINT16_MAX__ +#endif +#ifdef __INT32_MAX__ +# undef INT32_MAX +# define INT32_MAX __INT32_MAX__ +# undef INT32_MIN +# define INT32_MIN (-INT32_MAX - 1) +#endif +#ifdef __UINT32_MAX__ +# undef UINT32_MAX +# define UINT32_MAX __UINT32_MAX__ +#endif +#ifdef __INT64_MAX__ +# undef INT64_MAX +# define INT64_MAX __INT64_MAX__ +# undef INT64_MIN +# define INT64_MIN (-INT64_MAX - 1) +#endif +#ifdef __UINT64_MAX__ +# undef UINT64_MAX +# define UINT64_MAX __UINT64_MAX__ +#endif + +#undef INT_LEAST8_MAX +#define INT_LEAST8_MAX __INT_LEAST8_MAX__ +#undef INT_LEAST8_MIN +#define INT_LEAST8_MIN (-INT_LEAST8_MAX - 1) +#undef UINT_LEAST8_MAX +#define UINT_LEAST8_MAX __UINT_LEAST8_MAX__ +#undef INT_LEAST16_MAX +#define INT_LEAST16_MAX __INT_LEAST16_MAX__ +#undef INT_LEAST16_MIN +#define INT_LEAST16_MIN (-INT_LEAST16_MAX - 1) +#undef UINT_LEAST16_MAX +#define UINT_LEAST16_MAX __UINT_LEAST16_MAX__ +#undef INT_LEAST32_MAX +#define INT_LEAST32_MAX __INT_LEAST32_MAX__ +#undef INT_LEAST32_MIN +#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1) +#undef UINT_LEAST32_MAX +#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__ +#undef INT_LEAST64_MAX +#define INT_LEAST64_MAX __INT_LEAST64_MAX__ +#undef INT_LEAST64_MIN +#define INT_LEAST64_MIN (-INT_LEAST64_MAX - 1) +#undef UINT_LEAST64_MAX +#define UINT_LEAST64_MAX __UINT_LEAST64_MAX__ + +#undef INT_FAST8_MAX +#define INT_FAST8_MAX __INT_FAST8_MAX__ +#undef INT_FAST8_MIN +#define INT_FAST8_MIN (-INT_FAST8_MAX - 1) +#undef UINT_FAST8_MAX +#define UINT_FAST8_MAX __UINT_FAST8_MAX__ +#undef INT_FAST16_MAX +#define INT_FAST16_MAX __INT_FAST16_MAX__ +#undef INT_FAST16_MIN +#define INT_FAST16_MIN (-INT_FAST16_MAX - 1) +#undef UINT_FAST16_MAX +#define UINT_FAST16_MAX __UINT_FAST16_MAX__ +#undef INT_FAST32_MAX +#define INT_FAST32_MAX __INT_FAST32_MAX__ +#undef INT_FAST32_MIN +#define INT_FAST32_MIN (-INT_FAST32_MAX - 1) +#undef UINT_FAST32_MAX +#define UINT_FAST32_MAX __UINT_FAST32_MAX__ +#undef INT_FAST64_MAX +#define INT_FAST64_MAX __INT_FAST64_MAX__ +#undef INT_FAST64_MIN +#define INT_FAST64_MIN (-INT_FAST64_MAX - 1) +#undef UINT_FAST64_MAX +#define UINT_FAST64_MAX __UINT_FAST64_MAX__ + +#ifdef __INTPTR_MAX__ +# undef INTPTR_MAX +# define INTPTR_MAX __INTPTR_MAX__ +# undef INTPTR_MIN +# define INTPTR_MIN (-INTPTR_MAX - 1) +#endif +#ifdef __UINTPTR_MAX__ +# undef UINTPTR_MAX +# define UINTPTR_MAX __UINTPTR_MAX__ +#endif + +#undef INTMAX_MAX +#define INTMAX_MAX __INTMAX_MAX__ +#undef INTMAX_MIN +#define INTMAX_MIN (-INTMAX_MAX - 1) +#undef UINTMAX_MAX +#define UINTMAX_MAX __UINTMAX_MAX__ + +/* 7.18.3 Limits of other integer types */ + +#undef PTRDIFF_MAX +#define PTRDIFF_MAX __PTRDIFF_MAX__ +#undef PTRDIFF_MIN +#define PTRDIFF_MIN (-PTRDIFF_MAX - 1) + +#undef SIG_ATOMIC_MAX +#define SIG_ATOMIC_MAX __SIG_ATOMIC_MAX__ +#undef SIG_ATOMIC_MIN +#define SIG_ATOMIC_MIN __SIG_ATOMIC_MIN__ + +#undef SIZE_MAX +#define SIZE_MAX __SIZE_MAX__ + +#undef WCHAR_MAX +#define WCHAR_MAX __WCHAR_MAX__ +#undef WCHAR_MIN +#define WCHAR_MIN __WCHAR_MIN__ + +#undef WINT_MAX +#define WINT_MAX __WINT_MAX__ +#undef WINT_MIN +#define WINT_MIN __WINT_MIN__ + +#endif /* (!defined __cplusplus || __cplusplus >= 201103L + || defined __STDC_LIMIT_MACROS) */ + +#if (!defined __cplusplus || __cplusplus >= 201103L \ + || defined __STDC_CONSTANT_MACROS) + +#undef INT8_C +#define INT8_C(c) __INT8_C(c) +#undef INT16_C +#define INT16_C(c) __INT16_C(c) +#undef INT32_C +#define INT32_C(c) __INT32_C(c) +#undef INT64_C +#define INT64_C(c) __INT64_C(c) +#undef UINT8_C +#define UINT8_C(c) __UINT8_C(c) +#undef UINT16_C +#define UINT16_C(c) __UINT16_C(c) +#undef UINT32_C +#define UINT32_C(c) __UINT32_C(c) +#undef UINT64_C +#define UINT64_C(c) __UINT64_C(c) +#undef INTMAX_C +#define INTMAX_C(c) __INTMAX_C(c) +#undef UINTMAX_C +#define UINTMAX_C(c) __UINTMAX_C(c) + +#endif /* (!defined __cplusplus || __cplusplus >= 201103L + || defined __STDC_CONSTANT_MACROS) */ + +#ifdef __STDC_WANT_IEC_60559_BFP_EXT__ +/* TS 18661-1 widths of integer types. */ + +#ifdef __INT8_TYPE__ +# undef INT8_WIDTH +# define INT8_WIDTH 8 +#endif +#ifdef __UINT8_TYPE__ +# undef UINT8_WIDTH +# define UINT8_WIDTH 8 +#endif +#ifdef __INT16_TYPE__ +# undef INT16_WIDTH +# define INT16_WIDTH 16 +#endif +#ifdef __UINT16_TYPE__ +# undef UINT16_WIDTH +# define UINT16_WIDTH 16 +#endif +#ifdef __INT32_TYPE__ +# undef INT32_WIDTH +# define INT32_WIDTH 32 +#endif +#ifdef __UINT32_TYPE__ +# undef UINT32_WIDTH +# define UINT32_WIDTH 32 +#endif +#ifdef __INT64_TYPE__ +# undef INT64_WIDTH +# define INT64_WIDTH 64 +#endif +#ifdef __UINT64_TYPE__ +# undef UINT64_WIDTH +# define UINT64_WIDTH 64 +#endif + +#undef INT_LEAST8_WIDTH +#define INT_LEAST8_WIDTH __INT_LEAST8_WIDTH__ +#undef UINT_LEAST8_WIDTH +#define UINT_LEAST8_WIDTH __INT_LEAST8_WIDTH__ +#undef INT_LEAST16_WIDTH +#define INT_LEAST16_WIDTH __INT_LEAST16_WIDTH__ +#undef UINT_LEAST16_WIDTH +#define UINT_LEAST16_WIDTH __INT_LEAST16_WIDTH__ +#undef INT_LEAST32_WIDTH +#define INT_LEAST32_WIDTH __INT_LEAST32_WIDTH__ +#undef UINT_LEAST32_WIDTH +#define UINT_LEAST32_WIDTH __INT_LEAST32_WIDTH__ +#undef INT_LEAST64_WIDTH +#define INT_LEAST64_WIDTH __INT_LEAST64_WIDTH__ +#undef UINT_LEAST64_WIDTH +#define UINT_LEAST64_WIDTH __INT_LEAST64_WIDTH__ + +#undef INT_FAST8_WIDTH +#define INT_FAST8_WIDTH __INT_FAST8_WIDTH__ +#undef UINT_FAST8_WIDTH +#define UINT_FAST8_WIDTH __INT_FAST8_WIDTH__ +#undef INT_FAST16_WIDTH +#define INT_FAST16_WIDTH __INT_FAST16_WIDTH__ +#undef UINT_FAST16_WIDTH +#define UINT_FAST16_WIDTH __INT_FAST16_WIDTH__ +#undef INT_FAST32_WIDTH +#define INT_FAST32_WIDTH __INT_FAST32_WIDTH__ +#undef UINT_FAST32_WIDTH +#define UINT_FAST32_WIDTH __INT_FAST32_WIDTH__ +#undef INT_FAST64_WIDTH +#define INT_FAST64_WIDTH __INT_FAST64_WIDTH__ +#undef UINT_FAST64_WIDTH +#define UINT_FAST64_WIDTH __INT_FAST64_WIDTH__ + +#ifdef __INTPTR_TYPE__ +# undef INTPTR_WIDTH +# define INTPTR_WIDTH __INTPTR_WIDTH__ +#endif +#ifdef __UINTPTR_TYPE__ +# undef UINTPTR_WIDTH +# define UINTPTR_WIDTH __INTPTR_WIDTH__ +#endif + +#undef INTMAX_WIDTH +#define INTMAX_WIDTH __INTMAX_WIDTH__ +#undef UINTMAX_WIDTH +#define UINTMAX_WIDTH __INTMAX_WIDTH__ + +#undef PTRDIFF_WIDTH +#define PTRDIFF_WIDTH __PTRDIFF_WIDTH__ + +#undef SIG_ATOMIC_WIDTH +#define SIG_ATOMIC_WIDTH __SIG_ATOMIC_WIDTH__ + +#undef SIZE_WIDTH +#define SIZE_WIDTH __SIZE_WIDTH__ + +#undef WCHAR_WIDTH +#define WCHAR_WIDTH __WCHAR_WIDTH__ + +#undef WINT_WIDTH +#define WINT_WIDTH __WINT_WIDTH__ + +#endif + +#endif /* _GCC_STDINT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdint.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdint.h new file mode 100644 index 0000000..83b6f70 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdint.h @@ -0,0 +1,14 @@ +#ifndef _GCC_WRAP_STDINT_H +#if __STDC_HOSTED__ +# if defined __cplusplus && __cplusplus >= 201103L +# undef __STDC_LIMIT_MACROS +# define __STDC_LIMIT_MACROS +# undef __STDC_CONSTANT_MACROS +# define __STDC_CONSTANT_MACROS +# endif +# include_next +#else +# include "stdint-gcc.h" +#endif +#define _GCC_WRAP_STDINT_H +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdnoreturn.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdnoreturn.h new file mode 100644 index 0000000..739c2e3 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/stdnoreturn.h @@ -0,0 +1,35 @@ +/* Copyright (C) 2011-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +/* ISO C1X: 7.23 _Noreturn . */ + +#ifndef _STDNORETURN_H +#define _STDNORETURN_H + +#ifndef __cplusplus + +#define noreturn _Noreturn + +#endif + +#endif /* stdnoreturn.h */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/unwind.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/unwind.h new file mode 100644 index 0000000..77dd5a9 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/unwind.h @@ -0,0 +1,291 @@ +/* Exception handling and frame unwind runtime interface routines. + Copyright (C) 2001-2017 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + +/* This is derived from the C++ ABI for IA-64. Where we diverge + for cross-architecture compatibility are noted with "@@@". */ + +#ifndef _UNWIND_H +#define _UNWIND_H + +#if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__) +/* Only for _GCC_specific_handler. */ +#include +#endif + +#ifndef HIDE_EXPORTS +#pragma GCC visibility push(default) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Level 1: Base ABI */ + +/* @@@ The IA-64 ABI uses uint64 throughout. Most places this is + inefficient for 32-bit and smaller machines. */ +typedef unsigned _Unwind_Word __attribute__((__mode__(__unwind_word__))); +typedef signed _Unwind_Sword __attribute__((__mode__(__unwind_word__))); +#if defined(__ia64__) && defined(__hpux__) +typedef unsigned _Unwind_Ptr __attribute__((__mode__(__word__))); +#else +typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__))); +#endif +typedef unsigned _Unwind_Internal_Ptr __attribute__((__mode__(__pointer__))); + +/* @@@ The IA-64 ABI uses a 64-bit word to identify the producer and + consumer of an exception. We'll go along with this for now even on + 32-bit machines. We'll need to provide some other option for + 16-bit machines and for machines with > 8 bits per byte. */ +typedef unsigned _Unwind_Exception_Class __attribute__((__mode__(__DI__))); + +/* The unwind interface uses reason codes in several contexts to + identify the reasons for failures or other actions. */ +typedef enum +{ + _URC_NO_REASON = 0, + _URC_FOREIGN_EXCEPTION_CAUGHT = 1, + _URC_FATAL_PHASE2_ERROR = 2, + _URC_FATAL_PHASE1_ERROR = 3, + _URC_NORMAL_STOP = 4, + _URC_END_OF_STACK = 5, + _URC_HANDLER_FOUND = 6, + _URC_INSTALL_CONTEXT = 7, + _URC_CONTINUE_UNWIND = 8 +} _Unwind_Reason_Code; + + +/* The unwind interface uses a pointer to an exception header object + as its representation of an exception being thrown. In general, the + full representation of an exception object is language- and + implementation-specific, but it will be prefixed by a header + understood by the unwind interface. */ + +struct _Unwind_Exception; + +typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code, + struct _Unwind_Exception *); + +struct _Unwind_Exception +{ + _Unwind_Exception_Class exception_class; + _Unwind_Exception_Cleanup_Fn exception_cleanup; + +#if !defined (__USING_SJLJ_EXCEPTIONS__) && defined (__SEH__) + _Unwind_Word private_[6]; +#else + _Unwind_Word private_1; + _Unwind_Word private_2; +#endif + + /* @@@ The IA-64 ABI says that this structure must be double-word aligned. + Taking that literally does not make much sense generically. Instead we + provide the maximum alignment required by any type for the machine. */ +} __attribute__((__aligned__)); + + +/* The ACTIONS argument to the personality routine is a bitwise OR of one + or more of the following constants. */ +typedef int _Unwind_Action; + +#define _UA_SEARCH_PHASE 1 +#define _UA_CLEANUP_PHASE 2 +#define _UA_HANDLER_FRAME 4 +#define _UA_FORCE_UNWIND 8 +#define _UA_END_OF_STACK 16 + +/* The target can override this macro to define any back-end-specific + attributes required for the lowest-level stack frame. */ +#ifndef LIBGCC2_UNWIND_ATTRIBUTE +#define LIBGCC2_UNWIND_ATTRIBUTE +#endif + +/* This is an opaque type used to refer to a system-specific data + structure used by the system unwinder. This context is created and + destroyed by the system, and passed to the personality routine + during unwinding. */ +struct _Unwind_Context; + +/* Raise an exception, passing along the given exception object. */ +extern _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE +_Unwind_RaiseException (struct _Unwind_Exception *); + +/* Raise an exception for forced unwinding. */ + +typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) + (int, _Unwind_Action, _Unwind_Exception_Class, + struct _Unwind_Exception *, struct _Unwind_Context *, void *); + +extern _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE +_Unwind_ForcedUnwind (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *); + +/* Helper to invoke the exception_cleanup routine. */ +extern void _Unwind_DeleteException (struct _Unwind_Exception *); + +/* Resume propagation of an existing exception. This is used after + e.g. executing cleanup code, and not to implement rethrowing. */ +extern void LIBGCC2_UNWIND_ATTRIBUTE +_Unwind_Resume (struct _Unwind_Exception *); + +/* @@@ Resume propagation of a FORCE_UNWIND exception, or to rethrow + a normal exception that was handled. */ +extern _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE +_Unwind_Resume_or_Rethrow (struct _Unwind_Exception *); + +/* @@@ Use unwind data to perform a stack backtrace. The trace callback + is called for every stack frame in the call chain, but no cleanup + actions are performed. */ +typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) + (struct _Unwind_Context *, void *); + +extern _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE +_Unwind_Backtrace (_Unwind_Trace_Fn, void *); + +/* These functions are used for communicating information about the unwind + context (i.e. the unwind descriptors and the user register state) between + the unwind library and the personality routine and landing pad. Only + selected registers may be manipulated. */ + +extern _Unwind_Word _Unwind_GetGR (struct _Unwind_Context *, int); +extern void _Unwind_SetGR (struct _Unwind_Context *, int, _Unwind_Word); + +extern _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *); +extern _Unwind_Ptr _Unwind_GetIPInfo (struct _Unwind_Context *, int *); +extern void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr); + +/* @@@ Retrieve the CFA of the given context. */ +extern _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *); + +extern void *_Unwind_GetLanguageSpecificData (struct _Unwind_Context *); + +extern _Unwind_Ptr _Unwind_GetRegionStart (struct _Unwind_Context *); + + +/* The personality routine is the function in the C++ (or other language) + runtime library which serves as an interface between the system unwind + library and language-specific exception handling semantics. It is + specific to the code fragment described by an unwind info block, and + it is always referenced via the pointer in the unwind info block, and + hence it has no ABI-specified name. + + Note that this implies that two different C++ implementations can + use different names, and have different contents in the language + specific data area. Moreover, that the language specific data + area contains no version info because name of the function invoked + provides more effective versioning by detecting at link time the + lack of code to handle the different data format. */ + +typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn) + (int, _Unwind_Action, _Unwind_Exception_Class, + struct _Unwind_Exception *, struct _Unwind_Context *); + +/* @@@ The following alternate entry points are for setjmp/longjmp + based unwinding. */ + +struct SjLj_Function_Context; +extern void _Unwind_SjLj_Register (struct SjLj_Function_Context *); +extern void _Unwind_SjLj_Unregister (struct SjLj_Function_Context *); + +extern _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE +_Unwind_SjLj_RaiseException (struct _Unwind_Exception *); +extern _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE +_Unwind_SjLj_ForcedUnwind (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *); +extern void LIBGCC2_UNWIND_ATTRIBUTE +_Unwind_SjLj_Resume (struct _Unwind_Exception *); +extern _Unwind_Reason_Code LIBGCC2_UNWIND_ATTRIBUTE +_Unwind_SjLj_Resume_or_Rethrow (struct _Unwind_Exception *); + +/* @@@ The following provide access to the base addresses for text + and data-relative addressing in the LDSA. In order to stay link + compatible with the standard ABI for IA-64, we inline these. */ + +#ifdef __ia64__ +static inline _Unwind_Ptr +_Unwind_GetDataRelBase (struct _Unwind_Context *_C) +{ + /* The GP is stored in R1. */ + return _Unwind_GetGR (_C, 1); +} + +static inline _Unwind_Ptr +_Unwind_GetTextRelBase (struct _Unwind_Context *_C __attribute__ ((__unused__))) +{ + __builtin_abort (); + return 0; +} + +/* @@@ Retrieve the Backing Store Pointer of the given context. */ +extern _Unwind_Word _Unwind_GetBSP (struct _Unwind_Context *); +#else +extern _Unwind_Ptr _Unwind_GetDataRelBase (struct _Unwind_Context *); +extern _Unwind_Ptr _Unwind_GetTextRelBase (struct _Unwind_Context *); +#endif + +/* @@@ Given an address, return the entry point of the function that + contains it. */ +extern void * _Unwind_FindEnclosingFunction (void *pc); + +#ifndef __SIZEOF_LONG__ + #error "__SIZEOF_LONG__ macro not defined" +#endif + +#ifndef __SIZEOF_POINTER__ + #error "__SIZEOF_POINTER__ macro not defined" +#endif + + +/* leb128 type numbers have a potentially unlimited size. + The target of the following definitions of _sleb128_t and _uleb128_t + is to have efficient data types large enough to hold the leb128 type + numbers used in the unwind code. + Mostly these types will simply be defined to long and unsigned long + except when a unsigned long data type on the target machine is not + capable of storing a pointer. */ + +#if __SIZEOF_LONG__ >= __SIZEOF_POINTER__ + typedef long _sleb128_t; + typedef unsigned long _uleb128_t; +#elif __SIZEOF_LONG_LONG__ >= __SIZEOF_POINTER__ + typedef long long _sleb128_t; + typedef unsigned long long _uleb128_t; +#else +# error "What type shall we use for _sleb128_t?" +#endif + +#if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__) +/* Handles the mapping from SEH to GCC interfaces. */ +EXCEPTION_DISPOSITION _GCC_specific_handler (PEXCEPTION_RECORD, void *, + PCONTEXT, PDISPATCHER_CONTEXT, + _Unwind_Personality_Fn); +#endif + +#ifdef __cplusplus +} +#endif + +#ifndef HIDE_EXPORTS +#pragma GCC visibility pop +#endif + +#endif /* unwind.h */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/varargs.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/varargs.h new file mode 100644 index 0000000..4b9803e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/include/varargs.h @@ -0,0 +1,7 @@ +#ifndef _VARARGS_H +#define _VARARGS_H + +#error "GCC no longer implements ." +#error "Revise your code to use ." + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/install-tools/gsyslimits.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/install-tools/gsyslimits.h new file mode 100644 index 0000000..a362802 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/install-tools/gsyslimits.h @@ -0,0 +1,8 @@ +/* syslimits.h stands for the system's own limits.h file. + If we can use it ok unmodified, then we install this text. + If fixincludes fixes it, then the fixed version is installed + instead of this text. */ + +#define _GCC_NEXT_LIMITS_H /* tell gcc's limits.h to recurse */ +#include_next +#undef _GCC_NEXT_LIMITS_H diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/install-tools/include/limits.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/install-tools/include/limits.h new file mode 100644 index 0000000..743481d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/install-tools/include/limits.h @@ -0,0 +1,197 @@ +/* Copyright (C) 1992-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +/* This administrivia gets added to the beginning of limits.h + if the system has its own version of limits.h. */ + +/* We use _GCC_LIMITS_H_ because we want this not to match + any macros that the system's limits.h uses for its own purposes. */ +#ifndef _GCC_LIMITS_H_ /* Terminated in limity.h. */ +#define _GCC_LIMITS_H_ + +#ifndef _LIBC_LIMITS_H_ +/* Use "..." so that we find syslimits.h only in this same directory. */ +#include "syslimits.h" +#endif +/* Copyright (C) 1991-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +#ifndef _LIMITS_H___ +#define _LIMITS_H___ + +/* Number of bits in a `char'. */ +#undef CHAR_BIT +#define CHAR_BIT __CHAR_BIT__ + +/* Maximum length of a multibyte character. */ +#ifndef MB_LEN_MAX +#define MB_LEN_MAX 1 +#endif + +/* Minimum and maximum values a `signed char' can hold. */ +#undef SCHAR_MIN +#define SCHAR_MIN (-SCHAR_MAX - 1) +#undef SCHAR_MAX +#define SCHAR_MAX __SCHAR_MAX__ + +/* Maximum value an `unsigned char' can hold. (Minimum is 0). */ +#undef UCHAR_MAX +#if __SCHAR_MAX__ == __INT_MAX__ +# define UCHAR_MAX (SCHAR_MAX * 2U + 1U) +#else +# define UCHAR_MAX (SCHAR_MAX * 2 + 1) +#endif + +/* Minimum and maximum values a `char' can hold. */ +#ifdef __CHAR_UNSIGNED__ +# undef CHAR_MIN +# if __SCHAR_MAX__ == __INT_MAX__ +# define CHAR_MIN 0U +# else +# define CHAR_MIN 0 +# endif +# undef CHAR_MAX +# define CHAR_MAX UCHAR_MAX +#else +# undef CHAR_MIN +# define CHAR_MIN SCHAR_MIN +# undef CHAR_MAX +# define CHAR_MAX SCHAR_MAX +#endif + +/* Minimum and maximum values a `signed short int' can hold. */ +#undef SHRT_MIN +#define SHRT_MIN (-SHRT_MAX - 1) +#undef SHRT_MAX +#define SHRT_MAX __SHRT_MAX__ + +/* Maximum value an `unsigned short int' can hold. (Minimum is 0). */ +#undef USHRT_MAX +#if __SHRT_MAX__ == __INT_MAX__ +# define USHRT_MAX (SHRT_MAX * 2U + 1U) +#else +# define USHRT_MAX (SHRT_MAX * 2 + 1) +#endif + +/* Minimum and maximum values a `signed int' can hold. */ +#undef INT_MIN +#define INT_MIN (-INT_MAX - 1) +#undef INT_MAX +#define INT_MAX __INT_MAX__ + +/* Maximum value an `unsigned int' can hold. (Minimum is 0). */ +#undef UINT_MAX +#define UINT_MAX (INT_MAX * 2U + 1U) + +/* Minimum and maximum values a `signed long int' can hold. + (Same as `int'). */ +#undef LONG_MIN +#define LONG_MIN (-LONG_MAX - 1L) +#undef LONG_MAX +#define LONG_MAX __LONG_MAX__ + +/* Maximum value an `unsigned long int' can hold. (Minimum is 0). */ +#undef ULONG_MAX +#define ULONG_MAX (LONG_MAX * 2UL + 1UL) + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +/* Minimum and maximum values a `signed long long int' can hold. */ +# undef LLONG_MIN +# define LLONG_MIN (-LLONG_MAX - 1LL) +# undef LLONG_MAX +# define LLONG_MAX __LONG_LONG_MAX__ + +/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */ +# undef ULLONG_MAX +# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) +#endif + +#if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__) +/* Minimum and maximum values a `signed long long int' can hold. */ +# undef LONG_LONG_MIN +# define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL) +# undef LONG_LONG_MAX +# define LONG_LONG_MAX __LONG_LONG_MAX__ + +/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */ +# undef ULONG_LONG_MAX +# define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1ULL) +#endif + +#ifdef __STDC_WANT_IEC_60559_BFP_EXT__ +/* TS 18661-1 widths of integer types. */ +# undef CHAR_WIDTH +# define CHAR_WIDTH __SCHAR_WIDTH__ +# undef SCHAR_WIDTH +# define SCHAR_WIDTH __SCHAR_WIDTH__ +# undef UCHAR_WIDTH +# define UCHAR_WIDTH __SCHAR_WIDTH__ +# undef SHRT_WIDTH +# define SHRT_WIDTH __SHRT_WIDTH__ +# undef USHRT_WIDTH +# define USHRT_WIDTH __SHRT_WIDTH__ +# undef INT_WIDTH +# define INT_WIDTH __INT_WIDTH__ +# undef UINT_WIDTH +# define UINT_WIDTH __INT_WIDTH__ +# undef LONG_WIDTH +# define LONG_WIDTH __LONG_WIDTH__ +# undef ULONG_WIDTH +# define ULONG_WIDTH __LONG_WIDTH__ +# undef LLONG_WIDTH +# define LLONG_WIDTH __LONG_LONG_WIDTH__ +# undef ULLONG_WIDTH +# define ULLONG_WIDTH __LONG_LONG_WIDTH__ +#endif + +#endif /* _LIMITS_H___ */ +/* This administrivia gets added to the end of limits.h + if the system has its own version of limits.h. */ + +#else /* not _GCC_LIMITS_H_ */ + +#ifdef _GCC_NEXT_LIMITS_H +#include_next /* recurse down to the real one */ +#endif + +#endif /* not _GCC_LIMITS_H_ */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/addresses.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/addresses.h new file mode 100644 index 0000000..d4749fc --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/addresses.h @@ -0,0 +1,89 @@ +/* Inline functions to test validity of reg classes for addressing modes. + Copyright (C) 2006-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* Wrapper function to unify target macros MODE_CODE_BASE_REG_CLASS, + MODE_BASE_REG_REG_CLASS, MODE_BASE_REG_CLASS and BASE_REG_CLASS. + Arguments as for the MODE_CODE_BASE_REG_CLASS macro. */ + +#ifndef GCC_ADDRESSES_H +#define GCC_ADDRESSES_H + +static inline enum reg_class +base_reg_class (machine_mode mode ATTRIBUTE_UNUSED, + addr_space_t as ATTRIBUTE_UNUSED, + enum rtx_code outer_code ATTRIBUTE_UNUSED, + enum rtx_code index_code ATTRIBUTE_UNUSED) +{ +#ifdef MODE_CODE_BASE_REG_CLASS + return MODE_CODE_BASE_REG_CLASS (mode, as, outer_code, index_code); +#else +#ifdef MODE_BASE_REG_REG_CLASS + if (index_code == REG) + return MODE_BASE_REG_REG_CLASS (mode); +#endif +#ifdef MODE_BASE_REG_CLASS + return MODE_BASE_REG_CLASS (mode); +#else + return BASE_REG_CLASS; +#endif +#endif +} + +/* Wrapper function to unify target macros REGNO_MODE_CODE_OK_FOR_BASE_P, + REGNO_MODE_OK_FOR_REG_BASE_P, REGNO_MODE_OK_FOR_BASE_P and + REGNO_OK_FOR_BASE_P. + Arguments as for the REGNO_MODE_CODE_OK_FOR_BASE_P macro. */ + +static inline bool +ok_for_base_p_1 (unsigned regno ATTRIBUTE_UNUSED, + machine_mode mode ATTRIBUTE_UNUSED, + addr_space_t as ATTRIBUTE_UNUSED, + enum rtx_code outer_code ATTRIBUTE_UNUSED, + enum rtx_code index_code ATTRIBUTE_UNUSED) +{ +#ifdef REGNO_MODE_CODE_OK_FOR_BASE_P + return REGNO_MODE_CODE_OK_FOR_BASE_P (regno, mode, as, + outer_code, index_code); +#else +#ifdef REGNO_MODE_OK_FOR_REG_BASE_P + if (index_code == REG) + return REGNO_MODE_OK_FOR_REG_BASE_P (regno, mode); +#endif +#ifdef REGNO_MODE_OK_FOR_BASE_P + return REGNO_MODE_OK_FOR_BASE_P (regno, mode); +#else + return REGNO_OK_FOR_BASE_P (regno); +#endif +#endif +} + +/* Wrapper around ok_for_base_p_1, for use after register allocation is + complete. Arguments as for the called function. */ + +static inline bool +regno_ok_for_base_p (unsigned regno, machine_mode mode, addr_space_t as, + enum rtx_code outer_code, enum rtx_code index_code) +{ + if (regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] >= 0) + regno = reg_renumber[regno]; + + return ok_for_base_p_1 (regno, mode, as, outer_code, index_code); +} + +#endif /* GCC_ADDRESSES_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/alias.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/alias.h new file mode 100644 index 0000000..ef5f232 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/alias.h @@ -0,0 +1,47 @@ +/* Exported functions from alias.c + Copyright (C) 2004-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_ALIAS_H +#define GCC_ALIAS_H + +extern alias_set_type new_alias_set (void); +extern alias_set_type get_alias_set (tree); +extern alias_set_type get_deref_alias_set (tree); +extern alias_set_type get_varargs_alias_set (void); +extern alias_set_type get_frame_alias_set (void); +extern tree component_uses_parent_alias_set_from (const_tree); +extern bool alias_set_subset_of (alias_set_type, alias_set_type); +extern void record_alias_subset (alias_set_type, alias_set_type); +extern void record_component_aliases (tree); +extern int alias_sets_conflict_p (alias_set_type, alias_set_type); +extern int alias_sets_must_conflict_p (alias_set_type, alias_set_type); +extern int objects_must_conflict_p (tree, tree); +extern int nonoverlapping_memrefs_p (const_rtx, const_rtx, bool); +extern void dump_alias_stats_in_alias_c (FILE *s); +tree reference_alias_ptr_type (tree); +bool alias_ptr_types_compatible_p (tree, tree); +int compare_base_decls (tree, tree); + +/* This alias set can be used to force a memory to conflict with all + other memories, creating a barrier across which no memory reference + can move. Note that there are other legacy ways to create such + memory barriers, including an address of SCRATCH. */ +#define ALIAS_SET_MEMORY_BARRIER ((alias_set_type) -1) + +#endif /* GCC_ALIAS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/alloc-pool.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/alloc-pool.h new file mode 100644 index 0000000..a5236db --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/alloc-pool.h @@ -0,0 +1,566 @@ +/* Functions to support a pool of allocatable objects + Copyright (C) 1997-2017 Free Software Foundation, Inc. + Contributed by Daniel Berlin + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ +#ifndef ALLOC_POOL_H +#define ALLOC_POOL_H + +#include "memory-block.h" +#include "options.h" // for flag_checking + +extern void dump_alloc_pool_statistics (void); + +/* Flag indicates whether memory statistics are gathered any longer. */ +extern bool after_memory_report; + +typedef unsigned long ALLOC_POOL_ID_TYPE; + +/* Last used ID. */ +extern ALLOC_POOL_ID_TYPE last_id; + +/* Pool allocator memory usage. */ +struct pool_usage: public mem_usage +{ + /* Default contructor. */ + pool_usage (): m_element_size (0), m_pool_name ("") {} + /* Constructor. */ + pool_usage (size_t allocated, size_t times, size_t peak, + size_t instances, size_t element_size, + const char *pool_name) + : mem_usage (allocated, times, peak, instances), + m_element_size (element_size), + m_pool_name (pool_name) {} + + /* Sum the usage with SECOND usage. */ + pool_usage + operator+ (const pool_usage &second) + { + return pool_usage (m_allocated + second.m_allocated, + m_times + second.m_times, + m_peak + second.m_peak, + m_instances + second.m_instances, + m_element_size, m_pool_name); + } + + /* Dump usage coupled to LOC location, where TOTAL is sum of all rows. */ + inline void + dump (mem_location *loc, mem_usage &total) const + { + char *location_string = loc->to_string (); + + fprintf (stderr, "%-32s%-48s %6li%10li:%5.1f%%%10li%10li:%5.1f%%%12li\n", + m_pool_name, location_string, (long)m_instances, + (long)m_allocated, get_percent (m_allocated, total.m_allocated), + (long)m_peak, (long)m_times, + get_percent (m_times, total.m_times), + (long)m_element_size); + + free (location_string); + } + + /* Dump header with NAME. */ + static inline void + dump_header (const char *name) + { + fprintf (stderr, "%-32s%-48s %6s%11s%16s%17s%12s\n", "Pool name", name, + "Pools", "Leak", "Peak", "Times", "Elt size"); + print_dash_line (); + } + + /* Dump footer. */ + inline void + dump_footer () + { + print_dash_line (); + fprintf (stderr, "%s%82li%10li\n", "Total", (long)m_instances, + (long)m_allocated); + print_dash_line (); + } + + /* Element size. */ + size_t m_element_size; + /* Pool name. */ + const char *m_pool_name; +}; + +extern mem_alloc_description pool_allocator_usage; + +#if 0 +/* If a pool with custom block size is needed, one might use the following + template. An instance of this template can be used as a parameter for + instantiating base_pool_allocator template: + + typedef custom_block_allocator <128*1024> huge_block_allocator; + ... + static base_pool_allocator + value_pool ("value", 16384); + + Right now it's not used anywhere in the code, and is given here as an + example). */ + +template +class custom_block_allocator +{ +public: + static const size_t block_size = BlockSize; + + static inline void * + allocate () ATTRIBUTE_MALLOC + { + return XNEWVEC (char, BlockSize); + } + + static inline void + release (void *block) + { + XDELETEVEC (block); + } +}; +#endif + +/* Generic pool allocator. */ + +template +class base_pool_allocator +{ +public: + /* Default constructor for pool allocator called NAME. */ + base_pool_allocator (const char *name, size_t size CXX_MEM_STAT_INFO); + ~base_pool_allocator (); + void release (); + void release_if_empty (); + void *allocate () ATTRIBUTE_MALLOC; + void remove (void *object); + size_t num_elts_current (); + +private: + struct allocation_pool_list + { + allocation_pool_list *next; + }; + + /* Initialize a pool allocator. */ + void initialize (); + + struct allocation_object + { +#if CHECKING_P + /* The ID of alloc pool which the object was allocated from. */ + ALLOC_POOL_ID_TYPE id; +#endif + + union + { + /* The data of the object. */ + char data[1]; + + /* Because we want any type of data to be well aligned after the ID, + the following elements are here. They are never accessed so + the allocated object may be even smaller than this structure. + We do not care about alignment for floating-point types. */ + char *align_p; + int64_t align_i; + } u; + +#if CHECKING_P + static inline allocation_object* + get_instance (void *data_ptr) + { + return (allocation_object *)(((char *)(data_ptr)) + - offsetof (allocation_object, + u.data)); + } +#endif + + static inline void* + get_data (void *instance_ptr) + { + return (void*)(((allocation_object *) instance_ptr)->u.data); + } + }; + + /* Align X to 8. */ + static inline size_t + align_eight (size_t x) + { + return (((x+7) >> 3) << 3); + } + + const char *m_name; + ALLOC_POOL_ID_TYPE m_id; + size_t m_elts_per_block; + + /* These are the elements that have been allocated at least once + and freed. */ + allocation_pool_list *m_returned_free_list; + + /* These are the elements that have not yet been allocated out of + the last block obtained from XNEWVEC. */ + char* m_virgin_free_list; + + /* The number of elements in the virgin_free_list that can be + allocated before needing another block. */ + size_t m_virgin_elts_remaining; + /* The number of elements that are allocated. */ + size_t m_elts_allocated; + /* The number of elements that are released. */ + size_t m_elts_free; + /* The number of allocated blocks. */ + size_t m_blocks_allocated; + /* List of blocks that are used to allocate new objects. */ + allocation_pool_list *m_block_list; + /* Size of a pool elements in bytes. */ + size_t m_elt_size; + /* Size in bytes that should be allocated for each element. */ + size_t m_size; + /* Flag if a pool allocator is initialized. */ + bool m_initialized; + /* Memory allocation location. */ + mem_location m_location; +}; + +template +inline +base_pool_allocator ::base_pool_allocator ( + const char *name, size_t size MEM_STAT_DECL): + m_name (name), m_id (0), m_elts_per_block (0), m_returned_free_list (NULL), + m_virgin_free_list (NULL), m_virgin_elts_remaining (0), m_elts_allocated (0), + m_elts_free (0), m_blocks_allocated (0), m_block_list (NULL), m_size (size), + m_initialized (false), m_location (ALLOC_POOL_ORIGIN, false PASS_MEM_STAT) {} + +/* Initialize a pool allocator. */ + +template +inline void +base_pool_allocator ::initialize () +{ + gcc_checking_assert (!m_initialized); + m_initialized = true; + + size_t size = m_size; + + gcc_checking_assert (m_name); + + /* Make size large enough to store the list header. */ + if (size < sizeof (allocation_pool_list*)) + size = sizeof (allocation_pool_list*); + + /* Now align the size to a multiple of 8. */ + size = align_eight (size); + + /* Add the aligned size of ID. */ + size += offsetof (allocation_object, u.data); + + m_elt_size = size; + + if (GATHER_STATISTICS) + { + pool_usage *u = pool_allocator_usage.register_descriptor + (this, new mem_location (m_location)); + + u->m_element_size = m_elt_size; + u->m_pool_name = m_name; + } + + /* List header size should be a multiple of 8. */ + size_t header_size = align_eight (sizeof (allocation_pool_list)); + + m_elts_per_block = (TBlockAllocator::block_size - header_size) / size; + gcc_checking_assert (m_elts_per_block != 0); + + /* Increase the last used ID and use it for this pool. + ID == 0 is used for free elements of pool so skip it. */ + last_id++; + if (last_id == 0) + last_id++; + + m_id = last_id; +} + +/* Free all memory allocated for the given memory pool. */ +template +inline void +base_pool_allocator ::release () +{ + if (!m_initialized) + return; + + allocation_pool_list *block, *next_block; + + /* Free each block allocated to the pool. */ + for (block = m_block_list; block != NULL; block = next_block) + { + next_block = block->next; + TBlockAllocator::release (block); + } + + if (GATHER_STATISTICS && !after_memory_report) + { + pool_allocator_usage.release_instance_overhead + (this, (m_elts_allocated - m_elts_free) * m_elt_size); + } + + m_returned_free_list = NULL; + m_virgin_free_list = NULL; + m_virgin_elts_remaining = 0; + m_elts_allocated = 0; + m_elts_free = 0; + m_blocks_allocated = 0; + m_block_list = NULL; +} + +template +inline void +base_pool_allocator ::release_if_empty () +{ + if (m_elts_free == m_elts_allocated) + release (); +} + +template +inline base_pool_allocator ::~base_pool_allocator () +{ + release (); +} + +/* Allocates one element from the pool specified. */ +template +inline void* +base_pool_allocator ::allocate () +{ + if (!m_initialized) + initialize (); + + allocation_pool_list *header; +#ifdef ENABLE_VALGRIND_ANNOTATIONS + int size; +#endif + + if (GATHER_STATISTICS) + { + pool_allocator_usage.register_instance_overhead (m_elt_size, this); + } + +#ifdef ENABLE_VALGRIND_ANNOTATIONS + size = m_elt_size - offsetof (allocation_object, u.data); +#endif + + /* If there are no more free elements, make some more!. */ + if (!m_returned_free_list) + { + char *block; + if (!m_virgin_elts_remaining) + { + allocation_pool_list *block_header; + + /* Make the block. */ + block = reinterpret_cast (TBlockAllocator::allocate ()); + block_header = new (block) allocation_pool_list; + block += align_eight (sizeof (allocation_pool_list)); + + /* Throw it on the block list. */ + block_header->next = m_block_list; + m_block_list = block_header; + + /* Make the block available for allocation. */ + m_virgin_free_list = block; + m_virgin_elts_remaining = m_elts_per_block; + + /* Also update the number of elements we have free/allocated, and + increment the allocated block count. */ + m_elts_allocated += m_elts_per_block; + m_elts_free += m_elts_per_block; + m_blocks_allocated += 1; + } + + /* We now know that we can take the first elt off the virgin list and + put it on the returned list. */ + block = m_virgin_free_list; + header = (allocation_pool_list*) allocation_object::get_data (block); + header->next = NULL; + + /* Mark the element to be free. */ +#if CHECKING_P + ((allocation_object*) block)->id = 0; +#endif + VALGRIND_DISCARD (VALGRIND_MAKE_MEM_NOACCESS (header,size)); + m_returned_free_list = header; + m_virgin_free_list += m_elt_size; + m_virgin_elts_remaining--; + + } + + /* Pull the first free element from the free list, and return it. */ + header = m_returned_free_list; + VALGRIND_DISCARD (VALGRIND_MAKE_MEM_DEFINED (header, sizeof (*header))); + m_returned_free_list = header->next; + m_elts_free--; + + /* Set the ID for element. */ +#if CHECKING_P + allocation_object::get_instance (header)->id = m_id; +#endif + VALGRIND_DISCARD (VALGRIND_MAKE_MEM_UNDEFINED (header, size)); + + return (void *)(header); +} + +/* Puts PTR back on POOL's free list. */ +template +inline void +base_pool_allocator ::remove (void *object) +{ + int size = m_elt_size - offsetof (allocation_object, u.data); + + if (flag_checking) + { + gcc_assert (m_initialized); + gcc_assert (object + /* Check if we free more than we allocated. */ + && m_elts_free < m_elts_allocated); +#if CHECKING_P + /* Check whether the PTR was allocated from POOL. */ + gcc_assert (m_id == allocation_object::get_instance (object)->id); +#endif + + memset (object, 0xaf, size); + } + +#if CHECKING_P + /* Mark the element to be free. */ + allocation_object::get_instance (object)->id = 0; +#endif + + allocation_pool_list *header = new (object) allocation_pool_list; + header->next = m_returned_free_list; + m_returned_free_list = header; + VALGRIND_DISCARD (VALGRIND_MAKE_MEM_NOACCESS (object, size)); + m_elts_free++; + + if (GATHER_STATISTICS) + { + pool_allocator_usage.release_instance_overhead (this, m_elt_size); + } +} + +/* Number of elements currently active (not returned to pool). Used for cheap + consistency checks. */ +template +inline size_t +base_pool_allocator ::num_elts_current () +{ + return m_elts_allocated - m_elts_free; +} + +/* Specialization of base_pool_allocator which should be used in most cases. + Another specialization may be needed, if object size is greater than + memory_block_pool::block_size (64 KB). */ +typedef base_pool_allocator pool_allocator; + +/* Type based memory pool allocator. */ +template +class object_allocator +{ +public: + /* Default constructor for pool allocator called NAME. */ + object_allocator (const char *name CXX_MEM_STAT_INFO): + m_allocator (name, sizeof (T) PASS_MEM_STAT) {} + + inline void + release () + { + m_allocator.release (); + } + + inline void release_if_empty () + { + m_allocator.release_if_empty (); + } + + + /* Allocate memory for instance of type T and call a default constructor. */ + + inline T * + allocate () ATTRIBUTE_MALLOC + { + return ::new (m_allocator.allocate ()) T; + } + + /* Allocate memory for instance of type T and return void * that + could be used in situations where a default constructor is not provided + by the class T. */ + + inline void * + allocate_raw () ATTRIBUTE_MALLOC + { + return m_allocator.allocate (); + } + + inline void + remove (T *object) + { + /* Call destructor. */ + object->~T (); + + m_allocator.remove (object); + } + + inline size_t + num_elts_current () + { + return m_allocator.num_elts_current (); + } + +private: + pool_allocator m_allocator; +}; + +/* Store information about each particular alloc_pool. Note that this + will underestimate the amount the amount of storage used by a small amount: + 1) The overhead in a pool is not accounted for. + 2) The unallocated elements in a block are not accounted for. Note + that this can at worst case be one element smaller that the block + size for that pool. */ +struct alloc_pool_descriptor +{ + /* Number of pools allocated. */ + unsigned long created; + /* Gross allocated storage. */ + unsigned long allocated; + /* Amount of currently active storage. */ + unsigned long current; + /* Peak amount of storage used. */ + unsigned long peak; + /* Size of element in the pool. */ + int elt_size; +}; + +/* Helper for classes that do not provide default ctor. */ + +template +inline void * +operator new (size_t, object_allocator &a) +{ + return a.allocate_raw (); +} + +/* Hashtable mapping alloc_pool names to descriptors. */ +extern hash_map *alloc_pool_hash; + + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ansidecl.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ansidecl.h new file mode 100644 index 0000000..25f33da --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ansidecl.h @@ -0,0 +1,355 @@ +/* ANSI and traditional C compatability macros + Copyright (C) 1991-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* ANSI and traditional C compatibility macros + + ANSI C is assumed if __STDC__ is #defined. + + Macro ANSI C definition Traditional C definition + ----- ---- - ---------- ----------- - ---------- + PTR `void *' `char *' + const not defined `' + volatile not defined `' + signed not defined `' + + For ease of writing code which uses GCC extensions but needs to be + portable to other compilers, we provide the GCC_VERSION macro that + simplifies testing __GNUC__ and __GNUC_MINOR__ together, and various + wrappers around __attribute__. Also, __extension__ will be #defined + to nothing if it doesn't work. See below. */ + +#ifndef _ANSIDECL_H +#define _ANSIDECL_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* Every source file includes this file, + so they will all get the switch for lint. */ +/* LINTLIBRARY */ + +/* Using MACRO(x,y) in cpp #if conditionals does not work with some + older preprocessors. Thus we can't define something like this: + +#define HAVE_GCC_VERSION(MAJOR, MINOR) \ + (__GNUC__ > (MAJOR) || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ >= (MINOR))) + +and then test "#if HAVE_GCC_VERSION(2,7)". + +So instead we use the macro below and test it against specific values. */ + +/* This macro simplifies testing whether we are using gcc, and if it + is of a particular minimum version. (Both major & minor numbers are + significant.) This macro will evaluate to 0 if we are not using + gcc at all. */ +#ifndef GCC_VERSION +#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) +#endif /* GCC_VERSION */ + +#if defined (__STDC__) || defined(__cplusplus) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32) +/* All known AIX compilers implement these things (but don't always + define __STDC__). The RISC/OS MIPS compiler defines these things + in SVR4 mode, but does not define __STDC__. */ +/* eraxxon@alumni.rice.edu: The Compaq C++ compiler, unlike many other + C++ compilers, does not define __STDC__, though it acts as if this + was so. (Verified versions: 5.7, 6.2, 6.3, 6.5) */ + +#define PTR void * + +#undef const +#undef volatile +#undef signed + +/* inline requires special treatment; it's in C99, and GCC >=2.7 supports + it too, but it's not in C89. */ +#undef inline +#if __STDC_VERSION__ >= 199901L || defined(__cplusplus) || (defined(__SUNPRO_C) && defined(__C99FEATURES__)) +/* it's a keyword */ +#else +# if GCC_VERSION >= 2007 +# define inline __inline__ /* __inline__ prevents -pedantic warnings */ +# else +# define inline /* nothing */ +# endif +#endif + +#else /* Not ANSI C. */ + +#define PTR char * + +/* some systems define these in header files for non-ansi mode */ +#undef const +#undef volatile +#undef signed +#undef inline +#define const +#define volatile +#define signed +#define inline + +#endif /* ANSI C. */ + +/* Define macros for some gcc attributes. This permits us to use the + macros freely, and know that they will come into play for the + version of gcc in which they are supported. */ + +#if (GCC_VERSION < 2007) +# define __attribute__(x) +#endif + +/* Attribute __malloc__ on functions was valid as of gcc 2.96. */ +#ifndef ATTRIBUTE_MALLOC +# if (GCC_VERSION >= 2096) +# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) +# else +# define ATTRIBUTE_MALLOC +# endif /* GNUC >= 2.96 */ +#endif /* ATTRIBUTE_MALLOC */ + +/* Attributes on labels were valid as of gcc 2.93 and g++ 4.5. For + g++ an attribute on a label must be followed by a semicolon. */ +#ifndef ATTRIBUTE_UNUSED_LABEL +# ifndef __cplusplus +# if GCC_VERSION >= 2093 +# define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED +# else +# define ATTRIBUTE_UNUSED_LABEL +# endif +# else +# if GCC_VERSION >= 4005 +# define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED ; +# else +# define ATTRIBUTE_UNUSED_LABEL +# endif +# endif +#endif + +/* Similarly to ARG_UNUSED below. Prior to GCC 3.4, the C++ frontend + couldn't parse attributes placed after the identifier name, and now + the entire compiler is built with C++. */ +#ifndef ATTRIBUTE_UNUSED +#if GCC_VERSION >= 3004 +# define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +#else +#define ATTRIBUTE_UNUSED +#endif +#endif /* ATTRIBUTE_UNUSED */ + +/* Before GCC 3.4, the C++ frontend couldn't parse attributes placed after the + identifier name. */ +#if ! defined(__cplusplus) || (GCC_VERSION >= 3004) +# define ARG_UNUSED(NAME) NAME ATTRIBUTE_UNUSED +#else /* !__cplusplus || GNUC >= 3.4 */ +# define ARG_UNUSED(NAME) NAME +#endif /* !__cplusplus || GNUC >= 3.4 */ + +#ifndef ATTRIBUTE_NORETURN +#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) +#endif /* ATTRIBUTE_NORETURN */ + +/* Attribute `nonnull' was valid as of gcc 3.3. */ +#ifndef ATTRIBUTE_NONNULL +# if (GCC_VERSION >= 3003) +# define ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m))) +# else +# define ATTRIBUTE_NONNULL(m) +# endif /* GNUC >= 3.3 */ +#endif /* ATTRIBUTE_NONNULL */ + +/* Attribute `returns_nonnull' was valid as of gcc 4.9. */ +#ifndef ATTRIBUTE_RETURNS_NONNULL +# if (GCC_VERSION >= 4009) +# define ATTRIBUTE_RETURNS_NONNULL __attribute__ ((__returns_nonnull__)) +# else +# define ATTRIBUTE_RETURNS_NONNULL +# endif /* GNUC >= 4.9 */ +#endif /* ATTRIBUTE_RETURNS_NONNULL */ + +/* Attribute `pure' was valid as of gcc 3.0. */ +#ifndef ATTRIBUTE_PURE +# if (GCC_VERSION >= 3000) +# define ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define ATTRIBUTE_PURE +# endif /* GNUC >= 3.0 */ +#endif /* ATTRIBUTE_PURE */ + +/* Use ATTRIBUTE_PRINTF when the format specifier must not be NULL. + This was the case for the `printf' format attribute by itself + before GCC 3.3, but as of 3.3 we need to add the `nonnull' + attribute to retain this behavior. */ +#ifndef ATTRIBUTE_PRINTF +#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) ATTRIBUTE_NONNULL(m) +#define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2) +#define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3) +#define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4) +#define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5) +#define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6) +#endif /* ATTRIBUTE_PRINTF */ + +/* Use ATTRIBUTE_FPTR_PRINTF when the format attribute is to be set on + a function pointer. Format attributes were allowed on function + pointers as of gcc 3.1. */ +#ifndef ATTRIBUTE_FPTR_PRINTF +# if (GCC_VERSION >= 3001) +# define ATTRIBUTE_FPTR_PRINTF(m, n) ATTRIBUTE_PRINTF(m, n) +# else +# define ATTRIBUTE_FPTR_PRINTF(m, n) +# endif /* GNUC >= 3.1 */ +# define ATTRIBUTE_FPTR_PRINTF_1 ATTRIBUTE_FPTR_PRINTF(1, 2) +# define ATTRIBUTE_FPTR_PRINTF_2 ATTRIBUTE_FPTR_PRINTF(2, 3) +# define ATTRIBUTE_FPTR_PRINTF_3 ATTRIBUTE_FPTR_PRINTF(3, 4) +# define ATTRIBUTE_FPTR_PRINTF_4 ATTRIBUTE_FPTR_PRINTF(4, 5) +# define ATTRIBUTE_FPTR_PRINTF_5 ATTRIBUTE_FPTR_PRINTF(5, 6) +#endif /* ATTRIBUTE_FPTR_PRINTF */ + +/* Use ATTRIBUTE_NULL_PRINTF when the format specifier may be NULL. A + NULL format specifier was allowed as of gcc 3.3. */ +#ifndef ATTRIBUTE_NULL_PRINTF +# if (GCC_VERSION >= 3003) +# define ATTRIBUTE_NULL_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) +# else +# define ATTRIBUTE_NULL_PRINTF(m, n) +# endif /* GNUC >= 3.3 */ +# define ATTRIBUTE_NULL_PRINTF_1 ATTRIBUTE_NULL_PRINTF(1, 2) +# define ATTRIBUTE_NULL_PRINTF_2 ATTRIBUTE_NULL_PRINTF(2, 3) +# define ATTRIBUTE_NULL_PRINTF_3 ATTRIBUTE_NULL_PRINTF(3, 4) +# define ATTRIBUTE_NULL_PRINTF_4 ATTRIBUTE_NULL_PRINTF(4, 5) +# define ATTRIBUTE_NULL_PRINTF_5 ATTRIBUTE_NULL_PRINTF(5, 6) +#endif /* ATTRIBUTE_NULL_PRINTF */ + +/* Attribute `sentinel' was valid as of gcc 3.5. */ +#ifndef ATTRIBUTE_SENTINEL +# if (GCC_VERSION >= 3005) +# define ATTRIBUTE_SENTINEL __attribute__ ((__sentinel__)) +# else +# define ATTRIBUTE_SENTINEL +# endif /* GNUC >= 3.5 */ +#endif /* ATTRIBUTE_SENTINEL */ + + +#ifndef ATTRIBUTE_ALIGNED_ALIGNOF +# if (GCC_VERSION >= 3000) +# define ATTRIBUTE_ALIGNED_ALIGNOF(m) __attribute__ ((__aligned__ (__alignof__ (m)))) +# else +# define ATTRIBUTE_ALIGNED_ALIGNOF(m) +# endif /* GNUC >= 3.0 */ +#endif /* ATTRIBUTE_ALIGNED_ALIGNOF */ + +/* Useful for structures whose layout must match some binary specification + regardless of the alignment and padding qualities of the compiler. */ +#ifndef ATTRIBUTE_PACKED +# define ATTRIBUTE_PACKED __attribute__ ((packed)) +#endif + +/* Attribute `hot' and `cold' was valid as of gcc 4.3. */ +#ifndef ATTRIBUTE_COLD +# if (GCC_VERSION >= 4003) +# define ATTRIBUTE_COLD __attribute__ ((__cold__)) +# else +# define ATTRIBUTE_COLD +# endif /* GNUC >= 4.3 */ +#endif /* ATTRIBUTE_COLD */ +#ifndef ATTRIBUTE_HOT +# if (GCC_VERSION >= 4003) +# define ATTRIBUTE_HOT __attribute__ ((__hot__)) +# else +# define ATTRIBUTE_HOT +# endif /* GNUC >= 4.3 */ +#endif /* ATTRIBUTE_HOT */ + +/* Attribute 'no_sanitize_undefined' was valid as of gcc 4.9. */ +#ifndef ATTRIBUTE_NO_SANITIZE_UNDEFINED +# if (GCC_VERSION >= 4009) +# define ATTRIBUTE_NO_SANITIZE_UNDEFINED __attribute__ ((no_sanitize_undefined)) +# else +# define ATTRIBUTE_NO_SANITIZE_UNDEFINED +# endif /* GNUC >= 4.9 */ +#endif /* ATTRIBUTE_NO_SANITIZE_UNDEFINED */ + +/* We use __extension__ in some places to suppress -pedantic warnings + about GCC extensions. This feature didn't work properly before + gcc 2.8. */ +#if GCC_VERSION < 2008 +#define __extension__ +#endif + +/* This is used to declare a const variable which should be visible + outside of the current compilation unit. Use it as + EXPORTED_CONST int i = 1; + This is because the semantics of const are different in C and C++. + "extern const" is permitted in C but it looks strange, and gcc + warns about it when -Wc++-compat is not used. */ +#ifdef __cplusplus +#define EXPORTED_CONST extern const +#else +#define EXPORTED_CONST const +#endif + +/* Be conservative and only use enum bitfields with C++ or GCC. + FIXME: provide a complete autoconf test for buggy enum bitfields. */ + +#ifdef __cplusplus +#define ENUM_BITFIELD(TYPE) enum TYPE +#elif (GCC_VERSION > 2000) +#define ENUM_BITFIELD(TYPE) __extension__ enum TYPE +#else +#define ENUM_BITFIELD(TYPE) unsigned int +#endif + +/* C++11 adds the ability to add "override" after an implementation of a + virtual function in a subclass, to: + (A) document that this is an override of a virtual function + (B) allow the compiler to issue a warning if it isn't (e.g. a mismatch + of the type signature). + + Similarly, it allows us to add a "final" to indicate that no subclass + may subsequently override the vfunc. + + Provide OVERRIDE and FINAL as macros, allowing us to get these benefits + when compiling with C++11 support, but without requiring C++11. + + For gcc, use "-std=c++11" to enable C++11 support; gcc 6 onwards enables + this by default (actually GNU++14). */ + +#if __cplusplus >= 201103 +/* C++11 claims to be available: use it. final/override were only + implemented in 4.7, though. */ +# if GCC_VERSION < 4007 +# define OVERRIDE +# define FINAL +# else +# define OVERRIDE override +# define FINAL final +# endif +#elif GCC_VERSION >= 4007 +/* G++ 4.7 supports __final in C++98. */ +# define OVERRIDE +# define FINAL __final +#else +/* No C++11 support; leave the macros empty: */ +# define OVERRIDE +# define FINAL +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* ansidecl.h */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/asan.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/asan.h new file mode 100644 index 0000000..5766397 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/asan.h @@ -0,0 +1,164 @@ +/* AddressSanitizer, a fast memory error detector. + Copyright (C) 2011-2017 Free Software Foundation, Inc. + Contributed by Kostya Serebryany + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef TREE_ASAN +#define TREE_ASAN + +extern void asan_function_start (void); +extern void asan_finish_file (void); +extern rtx_insn *asan_emit_stack_protection (rtx, rtx, unsigned int, + HOST_WIDE_INT *, tree *, int); +extern bool asan_protect_global (tree); +extern void initialize_sanitizer_builtins (void); +extern tree asan_dynamic_init_call (bool); +extern bool asan_expand_check_ifn (gimple_stmt_iterator *, bool); +extern bool asan_expand_mark_ifn (gimple_stmt_iterator *); +extern bool asan_expand_poison_ifn (gimple_stmt_iterator *, bool *, + hash_map &); + +extern gimple_stmt_iterator create_cond_insert_point + (gimple_stmt_iterator *, bool, bool, bool, basic_block *, basic_block *); + +/* Alias set for accessing the shadow memory. */ +extern alias_set_type asan_shadow_set; + +/* Hash set of labels that are either used in a goto, or their address + has been taken. */ +extern hash_set *asan_used_labels; + +/* Shadow memory is found at + (address >> ASAN_SHADOW_SHIFT) + asan_shadow_offset (). */ +#define ASAN_SHADOW_SHIFT 3 +#define ASAN_SHADOW_GRANULARITY (1UL << ASAN_SHADOW_SHIFT) + +/* Red zone size, stack and global variables are padded by ASAN_RED_ZONE_SIZE + up to 2 * ASAN_RED_ZONE_SIZE - 1 bytes. */ +#define ASAN_RED_ZONE_SIZE 32 + +/* Shadow memory values for stack protection. Left is below protected vars, + the first pointer in stack corresponding to that offset contains + ASAN_STACK_FRAME_MAGIC word, the second pointer to a string describing + the frame. Middle is for padding in between variables, right is + above the last protected variable and partial immediately after variables + up to ASAN_RED_ZONE_SIZE alignment. */ +#define ASAN_STACK_MAGIC_LEFT 0xf1 +#define ASAN_STACK_MAGIC_MIDDLE 0xf2 +#define ASAN_STACK_MAGIC_RIGHT 0xf3 +#define ASAN_STACK_MAGIC_USE_AFTER_RET 0xf5 +#define ASAN_STACK_MAGIC_USE_AFTER_SCOPE 0xf8 + +#define ASAN_STACK_FRAME_MAGIC 0x41b58ab3 +#define ASAN_STACK_RETIRED_MAGIC 0x45e0360e + +#define ASAN_USE_AFTER_SCOPE_ATTRIBUTE "use after scope memory" + +/* Various flags for Asan builtins. */ +enum asan_check_flags +{ + ASAN_CHECK_STORE = 1 << 0, + ASAN_CHECK_SCALAR_ACCESS = 1 << 1, + ASAN_CHECK_NON_ZERO_LEN = 1 << 2, + ASAN_CHECK_LAST = 1 << 3 +}; + +/* Flags for Asan check builtins. */ +#define IFN_ASAN_MARK_FLAGS DEF(POISON), DEF(UNPOISON) + +enum asan_mark_flags +{ +#define DEF(X) ASAN_MARK_##X + IFN_ASAN_MARK_FLAGS +#undef DEF +}; + +/* Return true if STMT is ASAN_MARK with FLAG as first argument. */ +extern bool asan_mark_p (gimple *stmt, enum asan_mark_flags flag); + +/* Return the size of padding needed to insert after a protected + decl of SIZE. */ + +static inline unsigned int +asan_red_zone_size (unsigned int size) +{ + unsigned int c = size & (ASAN_RED_ZONE_SIZE - 1); + return c ? 2 * ASAN_RED_ZONE_SIZE - c : ASAN_RED_ZONE_SIZE; +} + +extern bool set_asan_shadow_offset (const char *); + +extern void set_sanitized_sections (const char *); + +extern bool asan_sanitize_stack_p (void); + +/* Return TRUE if builtin with given FCODE will be intercepted by + libasan. */ + +static inline bool +asan_intercepted_p (enum built_in_function fcode) +{ + return fcode == BUILT_IN_INDEX + || fcode == BUILT_IN_MEMCHR + || fcode == BUILT_IN_MEMCMP + || fcode == BUILT_IN_MEMCPY + || fcode == BUILT_IN_MEMMOVE + || fcode == BUILT_IN_MEMSET + || fcode == BUILT_IN_STRCASECMP + || fcode == BUILT_IN_STRCAT + || fcode == BUILT_IN_STRCHR + || fcode == BUILT_IN_STRCMP + || fcode == BUILT_IN_STRCPY + || fcode == BUILT_IN_STRDUP + || fcode == BUILT_IN_STRLEN + || fcode == BUILT_IN_STRNCASECMP + || fcode == BUILT_IN_STRNCAT + || fcode == BUILT_IN_STRNCMP + || fcode == BUILT_IN_STRCSPN + || fcode == BUILT_IN_STRPBRK + || fcode == BUILT_IN_STRSPN + || fcode == BUILT_IN_STRSTR + || fcode == BUILT_IN_STRNCPY; +} + +/* Return TRUE if we should instrument for use-after-scope sanity checking. */ + +static inline bool +asan_sanitize_use_after_scope (void) +{ + return (flag_sanitize_address_use_after_scope && asan_sanitize_stack_p ()); +} + +static inline bool +asan_no_sanitize_address_p (void) +{ + return lookup_attribute ("no_sanitize_address", + DECL_ATTRIBUTES (current_function_decl)); +} + +/* Return true if DECL should be guarded on the stack. */ + +static inline bool +asan_protect_stack_decl (tree decl) +{ + return DECL_P (decl) + && (!DECL_ARTIFICIAL (decl) + || (asan_sanitize_use_after_scope () && TREE_ADDRESSABLE (decl))); +} + +#endif /* TREE_ASAN */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/attribs.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/attribs.h new file mode 100644 index 0000000..9d3741c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/attribs.h @@ -0,0 +1,44 @@ +/* Declarations and definitions dealing with attribute handling. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_ATTRIBS_H +#define GCC_ATTRIBS_H + +extern const struct attribute_spec *lookup_attribute_spec (const_tree); +extern void init_attributes (void); + +/* Process the attributes listed in ATTRIBUTES and install them in *NODE, + which is either a DECL (including a TYPE_DECL) or a TYPE. If a DECL, + it should be modified in place; if a TYPE, a copy should be created + unless ATTR_FLAG_TYPE_IN_PLACE is set in FLAGS. FLAGS gives further + information, in the form of a bitwise OR of flags in enum attribute_flags + from tree.h. Depending on these flags, some attributes may be + returned to be applied at a later stage (for example, to apply + a decl attribute to the declaration rather than to its type). */ +extern tree decl_attributes (tree *, tree, int); + +extern bool cxx11_attribute_p (const_tree); +extern tree get_attribute_name (const_tree); +extern void apply_tm_attr (tree, tree); +extern tree make_attribute (const char *, const char *, tree); + +extern struct scoped_attributes* register_scoped_attributes (const struct attribute_spec *, + const char *); + +#endif // GCC_ATTRIBS_H diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/auto-host.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/auto-host.h new file mode 100644 index 0000000..4d3ff5c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/auto-host.h @@ -0,0 +1,2419 @@ +/* auto-host.h. Generated from config.in by configure. */ +/* config.in. Generated from configure.ac by autoheader. */ + +/* Define if this compiler should be built as the offload target compiler. */ +#ifndef USED_FOR_TARGET +/* #undef ACCEL_COMPILER */ +#endif + + +/* Define if building universal (internal helper macro) */ +#ifndef USED_FOR_TARGET +/* #undef AC_APPLE_UNIVERSAL_BUILD */ +#endif + + +/* Define to the assembler option to enable compressed debug sections. */ +#ifndef USED_FOR_TARGET +#define AS_COMPRESS_DEBUG_OPTION "--compress-debug-sections" +#endif + + +/* Define to the assembler option to disable compressed debug sections. */ +#ifndef USED_FOR_TARGET +#define AS_NO_COMPRESS_DEBUG_OPTION "--nocompress-debug-sections" +#endif + + +/* Define as the number of bits in a byte, if `limits.h' doesn't. */ +#ifndef USED_FOR_TARGET +/* #undef CHAR_BIT */ +#endif + + +/* Define to 0/1 if you want more run-time sanity checks. This one gets a grab + bag of miscellaneous but relatively cheap checks. */ +#ifndef USED_FOR_TARGET +#define CHECKING_P 0 +#endif + + +/* Define 0/1 to force the choice for exception handling model. */ +#ifndef USED_FOR_TARGET +/* #undef CONFIG_SJLJ_EXCEPTIONS */ +#endif + + +/* Define to enable the use of a default assembler. */ +#ifndef USED_FOR_TARGET +/* #undef DEFAULT_ASSEMBLER */ +#endif + + +/* Define to enable the use of a default linker. */ +#ifndef USED_FOR_TARGET +/* #undef DEFAULT_LINKER */ +#endif + + +/* Define if you want to use __cxa_atexit, rather than atexit, to register C++ + destructors for local statics and global objects. This is essential for + fully standards-compliant handling of destructors, but requires + __cxa_atexit in libc. */ +#ifndef USED_FOR_TARGET +/* #undef DEFAULT_USE_CXA_ATEXIT */ +#endif + + +/* The default for -fdiagnostics-color option */ +#ifndef USED_FOR_TARGET +#define DIAGNOSTICS_COLOR_DEFAULT DIAGNOSTICS_COLOR_AUTO +#endif + + +/* Define if you want assertions enabled. This is a cheap check. */ +#ifndef USED_FOR_TARGET +#define ENABLE_ASSERT_CHECKING 1 +#endif + + +/* Define to 1 to specify that we are using the BID decimal floating point + format instead of DPD */ +#ifndef USED_FOR_TARGET +#define ENABLE_DECIMAL_BID_FORMAT 0 +#endif + + +/* Define to 1 to enable decimal float extension to C. */ +#ifndef USED_FOR_TARGET +#define ENABLE_DECIMAL_FLOAT 0 +#endif + + +/* Define if your target supports default PIE and it is enabled. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_DEFAULT_PIE */ +#endif + + +/* Define if your target supports default stack protector and it is enabled. + */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_DEFAULT_SSP */ +#endif + + +/* Define if you want more run-time sanity checks for dataflow. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_DF_CHECKING */ +#endif + + +/* Define to 0/1 if you want extra run-time checking that might affect code + generation. */ +#ifndef USED_FOR_TARGET +#define ENABLE_EXTRA_CHECKING 0 +#endif + + +/* Define to 1 to enable fixed-point arithmetic extension to C. */ +#ifndef USED_FOR_TARGET +#define ENABLE_FIXED_POINT 1 +#endif + + +/* Define if you want fold checked that it never destructs its argument. This + is quite expensive. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_FOLD_CHECKING */ +#endif + + +/* Define if you want the garbage collector to operate in maximally paranoid + mode, validating the entire heap and collecting garbage at every + opportunity. This is extremely expensive. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_GC_ALWAYS_COLLECT */ +#endif + + +/* Define if you want the garbage collector to do object poisoning and other + memory allocation checks. This is quite expensive. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_GC_CHECKING */ +#endif + + +/* Define if you want operations on GIMPLE (the basic data structure of the + high-level optimizers) to be checked for dynamic type safety at runtime. + This is moderately expensive. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_GIMPLE_CHECKING */ +#endif + + +/* Define this to enable support for generating HSAIL. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_HSA */ +#endif + + +/* Define if gcc should always pass --build-id to linker. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_LD_BUILDID */ +#endif + + +/* Define to 1 to enable libquadmath support */ +#ifndef USED_FOR_TARGET +#define ENABLE_LIBQUADMATH_SUPPORT 1 +#endif + + +/* Define to enable LTO support. */ +#ifndef USED_FOR_TARGET +#define ENABLE_LTO 1 +#endif + + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +#ifndef USED_FOR_TARGET +#define ENABLE_NLS 1 +#endif + + +/* Define this to enable support for offloading. */ +#ifndef USED_FOR_TARGET +#define ENABLE_OFFLOADING 0 +#endif + + +/* Define to enable plugin support. */ +#ifndef USED_FOR_TARGET +#define ENABLE_PLUGIN 1 +#endif + + +/* Define if you want all operations on RTL (the basic data structure of the + optimizer and back end) to be checked for dynamic type safety at runtime. + This is quite expensive. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_RTL_CHECKING */ +#endif + + +/* Define if you want RTL flag accesses to be checked against the RTL codes + that are supported for each access macro. This is relatively cheap. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_RTL_FLAG_CHECKING */ +#endif + + +/* Define if you want runtime assertions enabled. This is a cheap check. */ +#define ENABLE_RUNTIME_CHECKING 1 + +/* Define if you want all operations on trees (the basic data structure of the + front ends) to be checked for dynamic type safety at runtime. This is + moderately expensive. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_TREE_CHECKING */ +#endif + + +/* Define if you want all gimple types to be verified after gimplifiation. + This is cheap. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_TYPES_CHECKING */ +#endif + + +/* Define to get calls to the valgrind runtime enabled. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_VALGRIND_ANNOTATIONS */ +#endif + + +/* Define if you want to run subprograms and generated programs through + valgrind (a memory checker). This is extremely expensive. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_VALGRIND_CHECKING */ +#endif + + +/* Define 0/1 if vtable verification feature is enabled. */ +#ifndef USED_FOR_TARGET +#define ENABLE_VTABLE_VERIFY 0 +#endif + + +/* Define to 1 if installation paths should be looked up in the Windows + Registry. Ignored on non-Windows hosts. */ +#ifndef USED_FOR_TARGET +/* #undef ENABLE_WIN32_REGISTRY */ +#endif + + +/* Define to the name of a file containing a list of extra machine modes for + this architecture. */ +#ifndef USED_FOR_TARGET +#define EXTRA_MODES_FILE "config/mips/mips-modes.def" +#endif + + +/* Define to enable detailed memory allocation stats gathering. */ +#ifndef USED_FOR_TARGET +#define GATHER_STATISTICS 0 +#endif + + +/* Define to 1 if `TIOCGWINSZ' requires . */ +#ifndef USED_FOR_TARGET +#define GWINSZ_IN_SYS_IOCTL 1 +#endif + + +/* mcontext_t fields start with __ */ +#ifndef USED_FOR_TARGET +/* #undef HAS_MCONTEXT_T_UNDERSCORES */ +#endif + + +/* Define if your assembler supports architecture modifiers. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_ARCHITECTURE_MODIFIERS */ +#endif + + +/* Define if your avr assembler supports --mlink-relax option. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_AVR_MLINK_RELAX_OPTION */ +#endif + + +/* Define if your avr assembler supports -mrmw option. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_AVR_MRMW_OPTION */ +#endif + + +/* Define if your assembler supports cmpb. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_CMPB */ +#endif + + +/* Define to the level of your assembler's compressed debug section support. + */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_COMPRESS_DEBUG 2 +#endif + + +/* Define if your assembler supports the DCI/ICI instructions. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_DCI */ +#endif + + +/* Define if your assembler supports the --debug-prefix-map option. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_DEBUG_PREFIX_MAP 1 +#endif + + +/* Define if your assembler supports DFP instructions. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_DFP */ +#endif + + +/* Define if your assembler supports .module. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_DOT_MODULE 1 +#endif + + +/* Define if your assembler supports DSPR1 mult. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_DSPR1_MULT 1 +#endif + + +/* Define if your assembler supports .dtprelword. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_DTPRELWORD 1 +#endif + + +/* Define if your assembler supports dwarf2 .file/.loc directives, and + preserves file table indices exactly as given. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_DWARF2_DEBUG_LINE 1 +#endif + + +/* Define if your assembler supports the R_PPC64_ENTRY relocation. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_ENTRY_MARKERS */ +#endif + + +/* Define if your assembler supports explicit relocations. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_EXPLICIT_RELOCS */ +#endif + + +/* Define if your assembler supports FMAF, HPC, and VIS 3.0 instructions. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_FMAF_HPC_VIS3 */ +#endif + + +/* Define if your assembler supports fprnd. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_FPRND */ +#endif + + +/* Define if your assembler supports the --gdwarf2 option. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_GDWARF2_DEBUG_FLAG 1 +#endif + + +/* Define if your assembler supports .gnu_attribute. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_GNU_ATTRIBUTE 1 +#endif + + +/* Define true if the assembler supports '.long foo@GOTOFF'. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_GOTOFF_IN_DATA */ +#endif + + +/* Define if your assembler supports the --gstabs option. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_GSTABS_DEBUG_FLAG 1 +#endif + + +/* Define if your assembler supports the Sun syntax for cmov. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_IX86_CMOV_SUN_SYNTAX */ +#endif + + +/* Define if your assembler supports the subtraction of symbols in different + sections. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_IX86_DIFF_SECT_DELTA */ +#endif + + +/* Define if your assembler supports the ffreep mnemonic. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_IX86_FFREEP */ +#endif + + +/* Define if your assembler uses fildq and fistq mnemonics. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_IX86_FILDQ */ +#endif + + +/* Define if your assembler uses filds and fists mnemonics. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_IX86_FILDS */ +#endif + + +/* Define 0/1 if your assembler and linker support @GOT. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_IX86_GOT32X */ +#endif + + +/* Define if your assembler supports HLE prefixes. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_IX86_HLE */ +#endif + + +/* Define if your assembler supports interunit movq mnemonic. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_IX86_INTERUNIT_MOVQ */ +#endif + + +/* Define if your assembler supports the .quad directive. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_IX86_QUAD */ +#endif + + +/* Define if the assembler supports 'rep , lock '. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_IX86_REP_LOCK_PREFIX */ +#endif + + +/* Define if your assembler supports the sahf mnemonic in 64bit mode. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_IX86_SAHF */ +#endif + + +/* Define if your assembler supports the swap suffix. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_IX86_SWAP */ +#endif + + +/* Define if your assembler and linker support @tlsgdplt. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_IX86_TLSGDPLT */ +#endif + + +/* Define to 1 if your assembler and linker support @tlsldm. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_IX86_TLSLDM */ +#endif + + +/* Define to 1 if your assembler and linker support @tlsldmplt. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_IX86_TLSLDMPLT */ +#endif + + +/* Define 0/1 if your assembler and linker support calling ___tls_get_addr via + GOT. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_IX86_TLS_GET_ADDR_GOT */ +#endif + + +/* Define if your assembler supports the 'ud2' mnemonic. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_IX86_UD2 */ +#endif + + +/* Define if your assembler supports the lituse_jsrdirect relocation. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_JSRDIRECT_RELOCS */ +#endif + + +/* Define if your assembler supports .sleb128 and .uleb128. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_LEB128 1 +#endif + + +/* Define if your assembler supports LEON instructions. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_LEON */ +#endif + + +/* Define if the assembler won't complain about a line such as # 0 "" 2. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_LINE_ZERO 1 +#endif + + +/* Define if your assembler supports ltoffx and ldxmov relocations. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_LTOFFX_LDXMOV_RELOCS */ +#endif + + +/* Define if your assembler supports LWSYNC instructions. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_LWSYNC */ +#endif + + +/* Define if your assembler supports the -mabi option. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_MABI_OPTION */ +#endif + + +/* Define if your assembler supports .machine and .machinemode. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_MACHINE_MACHINEMODE */ +#endif + + +/* Define if your assembler supports mfcr field. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_MFCRF */ +#endif + + +/* Define if your assembler supports mffgpr and mftgpr. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_MFPGPR */ +#endif + + +/* Define if your Mac OS X assembler supports the -mmacos-version-min option. + */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_MMACOSX_VERSION_MIN_OPTION */ +#endif + + +/* Define if the assembler understands -mnan=. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_NAN 1 +#endif + + +/* Define if your assembler supports the -no-mul-bug-abort option. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_NO_MUL_BUG_ABORT_OPTION */ +#endif + + +/* Define if the assembler understands -mno-shared. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_NO_SHARED 1 +#endif + + +/* Define if your assembler supports offsetable %lo(). */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_OFFSETABLE_LO10 */ +#endif + + +/* Define if your assembler supports popcntb field. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_POPCNTB */ +#endif + + +/* Define if your assembler supports POPCNTD instructions. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_POPCNTD */ +#endif + + +/* Define if your assembler supports POWER8 instructions. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_POWER8 */ +#endif + + +/* Define if your assembler supports POWER9 instructions. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_POWER9 */ +#endif + + +/* Define if your assembler supports .ref */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_REF */ +#endif + + +/* Define if your assembler supports .register. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_REGISTER_PSEUDO_OP */ +#endif + + +/* Define if your assembler supports R_PPC_REL16 relocs. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_REL16 */ +#endif + + +/* Define if your assembler supports -relax option. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_RELAX_OPTION */ +#endif + + +/* Define if your assembler supports relocs needed by -fpic. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_SMALL_PIC_RELOCS */ +#endif + + +/* Define if your assembler supports SPARC4 instructions. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_SPARC4 */ +#endif + + +/* Define if your assembler supports SPARC5 and VIS 4.0 instructions. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_SPARC5_VIS4 */ +#endif + +/* Define if your assembler supports SPARC6 instructions. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_SPARC6 */ +#endif + +/* Define if your assembler and linker support GOTDATA_OP relocs. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_SPARC_GOTDATA_OP */ +#endif + + +/* Define if your assembler and linker support unaligned PC relative relocs. + */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_SPARC_UA_PCREL */ +#endif + + +/* Define if your assembler and linker support unaligned PC relative relocs + against hidden symbols. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_SPARC_UA_PCREL_HIDDEN */ +#endif + + +/* Define if your assembler supports .stabs. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_STABS_DIRECTIVE 1 +#endif + + +/* Define if your assembler and linker support thread-local storage. */ +#ifndef USED_FOR_TARGET +#define HAVE_AS_TLS 1 +#endif + + +/* Define if your assembler supports arg info for __tls_get_addr. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_TLS_MARKERS */ +#endif + + +/* Define if your assembler supports VSX instructions. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_VSX */ +#endif + + +/* Define if your assembler supports -xbrace_comment option. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_AS_XBRACE_COMMENT_OPTION */ +#endif + + +/* Define to 1 if you have the `atoq' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_ATOQ */ +#endif + + +/* Define to 1 if you have the `clearerr_unlocked' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_CLEARERR_UNLOCKED 1 +#endif + + +/* Define to 1 if you have the `clock' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_CLOCK 1 +#endif + + +/* Define if defines clock_t. */ +#ifndef USED_FOR_TARGET +#define HAVE_CLOCK_T 1 +#endif + + +/* Define 0/1 if your assembler and linker support COMDAT groups. */ +#ifndef USED_FOR_TARGET +#define HAVE_COMDAT_GROUP 1 +#endif + + +/* Define to 1 if we found a declaration for 'abort', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_ABORT 1 +#endif + + +/* Define to 1 if we found a declaration for 'asprintf', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_ASPRINTF 1 +#endif + + +/* Define to 1 if we found a declaration for 'atof', otherwise define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_ATOF 1 +#endif + + +/* Define to 1 if we found a declaration for 'atol', otherwise define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_ATOL 1 +#endif + + +/* Define to 1 if we found a declaration for 'atoll', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_ATOLL 1 +#endif + + +/* Define to 1 if you have the declaration of `basename(const char*)', and to + 0 if you don't. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_BASENAME 1 +#endif + + +/* Define to 1 if we found a declaration for 'calloc', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_CALLOC 1 +#endif + + +/* Define to 1 if we found a declaration for 'clearerr_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_CLEARERR_UNLOCKED 1 +#endif + + +/* Define to 1 if we found a declaration for 'clock', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_CLOCK 1 +#endif + + +/* Define to 1 if we found a declaration for 'errno', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_ERRNO 1 +#endif + + +/* Define to 1 if we found a declaration for 'feof_unlocked', otherwise define + to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FEOF_UNLOCKED 1 +#endif + + +/* Define to 1 if we found a declaration for 'ferror_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FERROR_UNLOCKED 1 +#endif + + +/* Define to 1 if we found a declaration for 'fflush_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FFLUSH_UNLOCKED 1 +#endif + + +/* Define to 1 if we found a declaration for 'ffs', otherwise define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FFS 1 +#endif + + +/* Define to 1 if we found a declaration for 'fgetc_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FGETC_UNLOCKED 1 +#endif + + +/* Define to 1 if we found a declaration for 'fgets_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FGETS_UNLOCKED 1 +#endif + + +/* Define to 1 if we found a declaration for 'fileno_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FILENO_UNLOCKED 1 +#endif + + +/* Define to 1 if we found a declaration for 'fprintf_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FPRINTF_UNLOCKED 0 +#endif + + +/* Define to 1 if we found a declaration for 'fputc_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FPUTC_UNLOCKED 1 +#endif + + +/* Define to 1 if we found a declaration for 'fputs_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FPUTS_UNLOCKED 1 +#endif + + +/* Define to 1 if we found a declaration for 'fread_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FREAD_UNLOCKED 1 +#endif + + +/* Define to 1 if we found a declaration for 'free', otherwise define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FREE 1 +#endif + + +/* Define to 1 if we found a declaration for 'fwrite_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_FWRITE_UNLOCKED 1 +#endif + + +/* Define to 1 if we found a declaration for 'getchar_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_GETCHAR_UNLOCKED 1 +#endif + + +/* Define to 1 if we found a declaration for 'getcwd', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_GETCWD 1 +#endif + + +/* Define to 1 if we found a declaration for 'getc_unlocked', otherwise define + to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_GETC_UNLOCKED 1 +#endif + + +/* Define to 1 if we found a declaration for 'getenv', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_GETENV 1 +#endif + + +/* Define to 1 if we found a declaration for 'getopt', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_GETOPT 1 +#endif + + +/* Define to 1 if we found a declaration for 'getpagesize', otherwise define + to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_GETPAGESIZE 1 +#endif + + +/* Define to 1 if we found a declaration for 'getrlimit', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_GETRLIMIT 1 +#endif + + +/* Define to 1 if we found a declaration for 'getrusage', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_GETRUSAGE 1 +#endif + + +/* Define to 1 if we found a declaration for 'getwd', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_GETWD 1 +#endif + + +/* Define to 1 if we found a declaration for 'ldgetname', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_LDGETNAME 0 +#endif + + +/* Define to 1 if we found a declaration for 'madvise', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_MADVISE 1 +#endif + + +/* Define to 1 if we found a declaration for 'malloc', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_MALLOC 1 +#endif + + +/* Define to 1 if we found a declaration for 'putchar_unlocked', otherwise + define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_PUTCHAR_UNLOCKED 1 +#endif + + +/* Define to 1 if we found a declaration for 'putc_unlocked', otherwise define + to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_PUTC_UNLOCKED 1 +#endif + + +/* Define to 1 if we found a declaration for 'realloc', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_REALLOC 1 +#endif + + +/* Define to 1 if we found a declaration for 'sbrk', otherwise define to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_SBRK 1 +#endif + + +/* Define to 1 if we found a declaration for 'setenv', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_SETENV 1 +#endif + + +/* Define to 1 if we found a declaration for 'setrlimit', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_SETRLIMIT 1 +#endif + + +/* Define to 1 if we found a declaration for 'sigaltstack', otherwise define + to 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_SIGALTSTACK 1 +#endif + + +/* Define to 1 if we found a declaration for 'snprintf', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_SNPRINTF 1 +#endif + + +/* Define to 1 if we found a declaration for 'stpcpy', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_STPCPY 1 +#endif + + +/* Define to 1 if we found a declaration for 'strnlen', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_STRNLEN 1 +#endif + + +/* Define to 1 if we found a declaration for 'strsignal', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_STRSIGNAL 1 +#endif + + +/* Define to 1 if you have the declaration of `strstr(const char*,const + char*)', and to 0 if you don't. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_STRSTR 1 +#endif + + +/* Define to 1 if we found a declaration for 'strtol', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_STRTOL 1 +#endif + + +/* Define to 1 if we found a declaration for 'strtoll', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_STRTOLL 1 +#endif + + +/* Define to 1 if we found a declaration for 'strtoul', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_STRTOUL 1 +#endif + + +/* Define to 1 if we found a declaration for 'strtoull', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_STRTOULL 1 +#endif + + +/* Define to 1 if we found a declaration for 'strverscmp', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_STRVERSCMP 1 +#endif + + +/* Define to 1 if we found a declaration for 'times', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_TIMES 1 +#endif + + +/* Define to 1 if we found a declaration for 'unsetenv', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_UNSETENV 1 +#endif + + +/* Define to 1 if we found a declaration for 'vasprintf', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_VASPRINTF 1 +#endif + + +/* Define to 1 if we found a declaration for 'vsnprintf', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#define HAVE_DECL_VSNPRINTF 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_DIRECT_H */ +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_DLFCN_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_EXT_HASH_MAP 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_FCNTL_H 1 +#endif + + +/* Define to 1 if you have the `feof_unlocked' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_FEOF_UNLOCKED 1 +#endif + + +/* Define to 1 if you have the `ferror_unlocked' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_FERROR_UNLOCKED 1 +#endif + + +/* Define to 1 if you have the `fflush_unlocked' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_FFLUSH_UNLOCKED 1 +#endif + + +/* Define to 1 if you have the `fgetc_unlocked' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_FGETC_UNLOCKED 1 +#endif + + +/* Define to 1 if you have the `fgets_unlocked' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_FGETS_UNLOCKED 1 +#endif + + +/* Define to 1 if you have the `fileno_unlocked' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_FILENO_UNLOCKED 1 +#endif + + +/* Define to 1 if you have the `fork' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_FORK 1 +#endif + + +/* Define to 1 if you have the `fprintf_unlocked' function. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_FPRINTF_UNLOCKED */ +#endif + + +/* Define to 1 if you have the `fputc_unlocked' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_FPUTC_UNLOCKED 1 +#endif + + +/* Define to 1 if you have the `fputs_unlocked' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_FPUTS_UNLOCKED 1 +#endif + + +/* Define to 1 if you have the `fread_unlocked' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_FREAD_UNLOCKED 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_FTW_H 1 +#endif + + +/* Define to 1 if you have the `fwrite_unlocked' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_FWRITE_UNLOCKED 1 +#endif + + +/* Define if your assembler supports specifying the alignment of objects + allocated using the GAS .comm command. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_GAS_ALIGNED_COMM */ +#endif + + +/* Define if your assembler supports .balign and .p2align. */ +#ifndef USED_FOR_TARGET +#define HAVE_GAS_BALIGN_AND_P2ALIGN 1 +#endif + + +/* Define 0/1 if your assembler supports CFI directives. */ +#define HAVE_GAS_CFI_DIRECTIVE 1 + +/* Define 0/1 if your assembler supports .cfi_personality. */ +#define HAVE_GAS_CFI_PERSONALITY_DIRECTIVE 1 + +/* Define 0/1 if your assembler supports .cfi_sections. */ +#define HAVE_GAS_CFI_SECTIONS_DIRECTIVE 1 + +/* Define if your assembler supports the .loc discriminator sub-directive. */ +#ifndef USED_FOR_TARGET +#define HAVE_GAS_DISCRIMINATOR 1 +#endif + + +/* Define if your assembler supports @gnu_unique_object. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_GAS_GNU_UNIQUE_OBJECT */ +#endif + + +/* Define if your assembler and linker support .hidden. */ +#define HAVE_GAS_HIDDEN 1 + +/* Define if your assembler supports .lcomm with an alignment field. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_GAS_LCOMM_WITH_ALIGNMENT */ +#endif + + +/* Define if your assembler supports .literal16. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_GAS_LITERAL16 */ +#endif + + +/* Define if your assembler supports specifying the maximum number of bytes to + skip when using the GAS .p2align command. */ +#ifndef USED_FOR_TARGET +#define HAVE_GAS_MAX_SKIP_P2ALIGN 1 +#endif + + +/* Define if your assembler supports the .set micromips directive */ +#ifndef USED_FOR_TARGET +#define HAVE_GAS_MICROMIPS 1 +#endif + + +/* Define if your assembler supports .nsubspa comdat option. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_GAS_NSUBSPA_COMDAT */ +#endif + + +/* Define if your assembler and linker support 32-bit section relative relocs + via '.secrel32 label'. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_GAS_PE_SECREL32_RELOC */ +#endif + + +/* Define if your assembler supports specifying the section flag e. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_GAS_SECTION_EXCLUDE */ +#endif + + +/* Define 0/1 if your assembler supports marking sections with SHF_MERGE flag. + */ +#ifndef USED_FOR_TARGET +#define HAVE_GAS_SHF_MERGE 1 +#endif + + +/* Define if your assembler supports .subsection and .subsection -1 starts + emitting at the beginning of your section. */ +#ifndef USED_FOR_TARGET +#define HAVE_GAS_SUBSECTION_ORDERING 1 +#endif + + +/* Define if your assembler supports .weak. */ +#ifndef USED_FOR_TARGET +#define HAVE_GAS_WEAK 1 +#endif + + +/* Define if your assembler supports .weakref. */ +#ifndef USED_FOR_TARGET +#define HAVE_GAS_WEAKREF 1 +#endif + + +/* Define to 1 if you have the `getchar_unlocked' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_GETCHAR_UNLOCKED 1 +#endif + + +/* Define to 1 if you have the `getc_unlocked' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_GETC_UNLOCKED 1 +#endif + + +/* Define to 1 if you have the `getrlimit' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_GETRLIMIT 1 +#endif + + +/* Define to 1 if you have the `getrusage' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_GETRUSAGE 1 +#endif + + +/* Define to 1 if you have the `gettimeofday' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_GETTIMEOFDAY 1 +#endif + + +/* Define to 1 if using GNU as. */ +#ifndef USED_FOR_TARGET +#define HAVE_GNU_AS 1 +#endif + + +/* Define if your system supports gnu indirect functions. */ +#ifndef USED_FOR_TARGET +#define HAVE_GNU_INDIRECT_FUNCTION 0 +#endif + + +/* Define to 1 if using GNU ld. */ +#ifndef USED_FOR_TARGET +#define HAVE_GNU_LD 1 +#endif + + +/* Define if the gold linker supports split stack and is available as a + non-default */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_GOLD_NON_DEFAULT_SPLIT_STACK */ +#endif + + +/* Define if you have the iconv() function. */ +#ifndef USED_FOR_TARGET +#define HAVE_ICONV 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_ICONV_H 1 +#endif + + +/* Define 0/1 if .init_array/.fini_array sections are available and working. + */ +#ifndef USED_FOR_TARGET +#define HAVE_INITFINI_ARRAY_SUPPORT 0 +#endif + + +/* Define to 1 if the system has the type `intmax_t'. */ +#ifndef USED_FOR_TARGET +#define HAVE_INTMAX_T 1 +#endif + + +/* Define to 1 if the system has the type `intptr_t'. */ +#ifndef USED_FOR_TARGET +#define HAVE_INTPTR_T 1 +#endif + + +/* Define if you have a working header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_INTTYPES_H 1 +#endif + + +/* Define to 1 if you have the `kill' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_KILL 1 +#endif + + +/* Define if you have and nl_langinfo(CODESET). */ +#ifndef USED_FOR_TARGET +#define HAVE_LANGINFO_CODESET 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_LANGINFO_H 1 +#endif + + +/* Define if your file defines LC_MESSAGES. */ +#ifndef USED_FOR_TARGET +#define HAVE_LC_MESSAGES 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_LDFCN_H */ +#endif + + +/* Define if your linker supports --as-needed/--no-as-needed or equivalent + options. */ +#ifndef USED_FOR_TARGET +#define HAVE_LD_AS_NEEDED 1 +#endif + + +/* Define if your linker supports -z bndplt */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_LD_BNDPLT_SUPPORT */ +#endif + + +/* Define if your linker supports --build-id. */ +#ifndef USED_FOR_TARGET +#define HAVE_LD_BUILDID 1 +#endif + + +/* Define if the linker supports clearing hardware capabilities via mapfile. + */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_LD_CLEARCAP */ +#endif + + +/* Define to the level of your linker's compressed debug section support. */ +#ifndef USED_FOR_TARGET +#define HAVE_LD_COMPRESS_DEBUG 3 +#endif + + +/* Define if your linker supports --demangle option. */ +#ifndef USED_FOR_TARGET +#define HAVE_LD_DEMANGLE 1 +#endif + + +/* Define 0/1 if your linker supports CIE v3 in .eh_frame. */ +#ifndef USED_FOR_TARGET +#define HAVE_LD_EH_FRAME_CIEV3 1 +#endif + + +/* Define if your linker supports .eh_frame_hdr. */ +#define HAVE_LD_EH_FRAME_HDR 1 + +/* Define if your linker supports garbage collection of sections in presence + of EH frames. */ +#ifndef USED_FOR_TARGET +#define HAVE_LD_EH_GC_SECTIONS 1 +#endif + + +/* Define if your linker has buggy garbage collection of sections support when + .text.startup.foo like sections are used. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_LD_EH_GC_SECTIONS_BUG */ +#endif + + +/* Define if your PowerPC64 linker supports a large TOC. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_LD_LARGE_TOC */ +#endif + + +/* Define if your PowerPC64 linker only needs function descriptor syms. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_LD_NO_DOT_SYMS */ +#endif + + +/* Define if your linker can relax absolute .eh_frame personality pointers + into PC-relative form. */ +#ifndef USED_FOR_TARGET +#define HAVE_LD_PERSONALITY_RELAXATION 1 +#endif + + +/* Define if your linker supports PIE option. */ +#ifndef USED_FOR_TARGET +#define HAVE_LD_PIE 1 +#endif + + +/* Define 0/1 if your linker supports -pie option with copy reloc. */ +#ifndef USED_FOR_TARGET +#define HAVE_LD_PIE_COPYRELOC 0 +#endif + + +/* Define if your PowerPC linker has .gnu.attributes long double support. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_LD_PPC_GNU_ATTR_LONG_DOUBLE */ +#endif + + +/* Define if your linker supports --push-state/--pop-state */ +#ifndef USED_FOR_TARGET +#define HAVE_LD_PUSHPOPSTATE_SUPPORT 1 +#endif + + +/* Define if your linker links a mix of read-only and read-write sections into + a read-write section. */ +#ifndef USED_FOR_TARGET +#define HAVE_LD_RO_RW_SECTION_MIXING 1 +#endif + + +/* Define if your linker supports the *_sol2 emulations. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_LD_SOL2_EMULATION */ +#endif + + +/* Define if your linker supports -Bstatic/-Bdynamic or equivalent options. */ +#ifndef USED_FOR_TARGET +#define HAVE_LD_STATIC_DYNAMIC 1 +#endif + + +/* Define if your linker supports --sysroot. */ +#ifndef USED_FOR_TARGET +#define HAVE_LD_SYSROOT 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_LIMITS_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_LOCALE_H 1 +#endif + + +/* Define to 1 if the system has the type `long long'. */ +#ifndef USED_FOR_TARGET +#define HAVE_LONG_LONG 1 +#endif + + +/* Define to 1 if the system has the type `long long int'. */ +#ifndef USED_FOR_TARGET +#define HAVE_LONG_LONG_INT 1 +#endif + + +/* Define to the level of your linker's plugin support. */ +#ifndef USED_FOR_TARGET +#define HAVE_LTO_PLUGIN 2 +#endif + + +/* Define to 1 if you have the `madvise' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_MADVISE 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_MALLOC_H 1 +#endif + + +/* Define to 1 if you have the `mbstowcs' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_MBSTOWCS 1 +#endif + + +/* Define if valgrind's memcheck.h header is installed. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_MEMCHECK_H */ +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_MEMORY_H 1 +#endif + + +/* Define to 1 if you have the `mmap' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_MMAP 1 +#endif + + +/* Define if mmap with MAP_ANON(YMOUS) works. */ +#ifndef USED_FOR_TARGET +#define HAVE_MMAP_ANON 1 +#endif + + +/* Define if mmap of /dev/zero works. */ +#ifndef USED_FOR_TARGET +#define HAVE_MMAP_DEV_ZERO 1 +#endif + + +/* Define if read-only mmap of a plain file works. */ +#ifndef USED_FOR_TARGET +#define HAVE_MMAP_FILE 1 +#endif + + +/* Define to 1 if you have the `nl_langinfo' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_NL_LANGINFO 1 +#endif + + +/* Define to 1 if you have the `popen' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_POPEN 1 +#endif + + +/* Define to 1 if you have the `putchar_unlocked' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_PUTCHAR_UNLOCKED 1 +#endif + + +/* Define to 1 if you have the `putc_unlocked' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_PUTC_UNLOCKED 1 +#endif + + +/* Define to 1 if you have the `setlocale' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_SETLOCALE 1 +#endif + + +/* Define to 1 if you have the `setrlimit' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_SETRLIMIT 1 +#endif + + +/* Define if the system-provided CRTs are present on Solaris. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_SOLARIS_CRTS */ +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_STDDEF_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_STDINT_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_STDLIB_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_STRINGS_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_STRING_H 1 +#endif + + +/* Define to 1 if you have the `strsignal' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_STRSIGNAL 1 +#endif + + +/* Define if defines struct tms. */ +#ifndef USED_FOR_TARGET +#define HAVE_STRUCT_TMS 1 +#endif + + +/* Define if defines std::swap. */ +#ifndef USED_FOR_TARGET +#define HAVE_SWAP_IN_UTILITY 1 +#endif + + +/* Define to 1 if you have the `sysconf' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_SYSCONF 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_SYS_FILE_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_SYS_MMAN_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_SYS_PARAM_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_SYS_RESOURCE_H 1 +#endif + + +/* Define if your target C library provides sys/sdt.h */ +/* #undef HAVE_SYS_SDT_H */ + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_SYS_STAT_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_SYS_TIMES_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_SYS_TIME_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_SYS_TYPES_H 1 +#endif + + +/* Define to 1 if you have that is POSIX.1 compatible. */ +#ifndef USED_FOR_TARGET +#define HAVE_SYS_WAIT_H 1 +#endif + + +/* Define to 1 if you have the `times' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_TIMES 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_TIME_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_TR1_UNORDERED_MAP 1 +#endif + + +/* Define to 1 if the system has the type `uintmax_t'. */ +#ifndef USED_FOR_TARGET +#define HAVE_UINTMAX_T 1 +#endif + + +/* Define to 1 if the system has the type `uintptr_t'. */ +#ifndef USED_FOR_TARGET +#define HAVE_UINTPTR_T 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_UNISTD_H 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_UNORDERED_MAP 1 +#endif + + +/* Define to 1 if the system has the type `unsigned long long int'. */ +#ifndef USED_FOR_TARGET +#define HAVE_UNSIGNED_LONG_LONG_INT 1 +#endif + + +/* Define if valgrind's valgrind/memcheck.h header is installed. */ +#ifndef USED_FOR_TARGET +#define HAVE_VALGRIND_MEMCHECK_H 1 +#endif + + +/* Define to 1 if you have the `vfork' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_VFORK 1 +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_VFORK_H */ +#endif + + +/* Define to 1 if you have the header file. */ +#ifndef USED_FOR_TARGET +#define HAVE_WCHAR_H 1 +#endif + + +/* Define to 1 if you have the `wcswidth' function. */ +#ifndef USED_FOR_TARGET +#define HAVE_WCSWIDTH 1 +#endif + + +/* Define to 1 if `fork' works. */ +#ifndef USED_FOR_TARGET +#define HAVE_WORKING_FORK 1 +#endif + + +/* Define this macro if mbstowcs does not crash when its first argument is + NULL. */ +#ifndef USED_FOR_TARGET +#define HAVE_WORKING_MBSTOWCS 1 +#endif + + +/* Define to 1 if `vfork' works. */ +#ifndef USED_FOR_TARGET +#define HAVE_WORKING_VFORK 1 +#endif + + +/* Define if your assembler supports AIX debug frame section label reference. + */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_XCOFF_DWARF_EXTRAS */ +#endif + + +/* Define if isl is in use. */ +#ifndef USED_FOR_TARGET +/* #undef HAVE_isl */ +#endif + + +/* Define if F_SETLKW supported by fcntl. */ +#ifndef USED_FOR_TARGET +#define HOST_HAS_F_SETLKW 1 +#endif + + +/* Define as const if the declaration of iconv() needs const. */ +#ifndef USED_FOR_TARGET +#define ICONV_CONST +#endif + + +/* Define if int64_t uses long as underlying type. */ +#ifndef USED_FOR_TARGET +#define INT64_T_IS_LONG 1 +#endif + + +/* Define to 1 if ld64 supports '-export_dynamic'. */ +#ifndef USED_FOR_TARGET +/* #undef LD64_HAS_EXPORT_DYNAMIC */ +#endif + + +/* Define to ld64 version. */ +#ifndef USED_FOR_TARGET +/* #undef LD64_VERSION */ +#endif + + +/* Define to the linker option to ignore unused dependencies. */ +#ifndef USED_FOR_TARGET +#define LD_AS_NEEDED_OPTION "--as-needed" +#endif + + +/* Define to the linker option to enable compressed debug sections. */ +#ifndef USED_FOR_TARGET +#define LD_COMPRESS_DEBUG_OPTION "--compress-debug-sections" +#endif + + +/* Define to the linker option to enable use of shared objects. */ +#ifndef USED_FOR_TARGET +#define LD_DYNAMIC_OPTION "-Bdynamic" +#endif + + +/* Define to the linker option to keep unused dependencies. */ +#ifndef USED_FOR_TARGET +#define LD_NO_AS_NEEDED_OPTION "--no-as-needed" +#endif + + +/* Define to the linker option to disable use of shared objects. */ +#ifndef USED_FOR_TARGET +#define LD_STATIC_OPTION "-Bstatic" +#endif + + +/* The linker hash style */ +#ifndef USED_FOR_TARGET +/* #undef LINKER_HASH_STYLE */ +#endif + + +/* Define to the name of the LTO plugin DSO that must be passed to the + linker's -plugin=LIB option. */ +#ifndef USED_FOR_TARGET +#define LTOPLUGINSONAME "liblto_plugin.so" +#endif + + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#ifndef USED_FOR_TARGET +#define LT_OBJDIR ".libs/" +#endif + + +/* Define if host mkdir takes a single argument. */ +#ifndef USED_FOR_TARGET +/* #undef MKDIR_TAKES_ONE_ARG */ +#endif + + +/* Define to offload targets, separated by commas. */ +#ifndef USED_FOR_TARGET +#define OFFLOAD_TARGETS "" +#endif + + +/* Define to the address where bug reports for this package should be sent. */ +#ifndef USED_FOR_TARGET +#define PACKAGE_BUGREPORT "" +#endif + + +/* Define to the full name of this package. */ +#ifndef USED_FOR_TARGET +#define PACKAGE_NAME "" +#endif + + +/* Define to the full name and version of this package. */ +#ifndef USED_FOR_TARGET +#define PACKAGE_STRING "" +#endif + + +/* Define to the one symbol short name of this package. */ +#ifndef USED_FOR_TARGET +#define PACKAGE_TARNAME "" +#endif + + +/* Define to the home page for this package. */ +#ifndef USED_FOR_TARGET +#define PACKAGE_URL "" +#endif + + +/* Define to the version of this package. */ +#ifndef USED_FOR_TARGET +#define PACKAGE_VERSION "" +#endif + + +/* Specify plugin linker */ +#ifndef USED_FOR_TARGET +#define PLUGIN_LD_SUFFIX "ld" +#endif + + +/* Define to .TOC. alignment forced by your linker. */ +#ifndef USED_FOR_TARGET +/* #undef POWERPC64_TOC_POINTER_ALIGNMENT */ +#endif + + +/* Define to PREFIX/include if cpp should also search that directory. */ +#ifndef USED_FOR_TARGET +/* #undef PREFIX_INCLUDE_DIR */ +#endif + + +/* The size of `int', as computed by sizeof. */ +#ifndef USED_FOR_TARGET +#define SIZEOF_INT 4 +#endif + + +/* The size of `long', as computed by sizeof. */ +#ifndef USED_FOR_TARGET +#define SIZEOF_LONG 8 +#endif + + +/* The size of `long long', as computed by sizeof. */ +#ifndef USED_FOR_TARGET +#define SIZEOF_LONG_LONG 8 +#endif + + +/* The size of `short', as computed by sizeof. */ +#ifndef USED_FOR_TARGET +#define SIZEOF_SHORT 2 +#endif + + +/* The size of `void *', as computed by sizeof. */ +#ifndef USED_FOR_TARGET +#define SIZEOF_VOID_P 8 +#endif + + +/* Define to 1 if you have the ANSI C header files. */ +#ifndef USED_FOR_TARGET +#define STDC_HEADERS 1 +#endif + + +/* Define if you can safely include both and . */ +#ifndef USED_FOR_TARGET +#define STRING_WITH_STRINGS 1 +#endif + + +/* Define if TFmode long double should be the default */ +#ifndef USED_FOR_TARGET +/* #undef TARGET_DEFAULT_LONG_DOUBLE_128 */ +#endif + + +/* Define if your target C library provides the `dl_iterate_phdr' function. */ +/* #undef TARGET_DL_ITERATE_PHDR */ + +/* GNU C Library major version number used on the target, or 0. */ +#ifndef USED_FOR_TARGET +#define TARGET_GLIBC_MAJOR 2 +#endif + + +/* GNU C Library minor version number used on the target, or 0. */ +#ifndef USED_FOR_TARGET +#define TARGET_GLIBC_MINOR 2 +#endif + + +/* Define if your target C Library provides the AT_HWCAP value in the TCB */ +#ifndef USED_FOR_TARGET +/* #undef TARGET_LIBC_PROVIDES_HWCAP_IN_TCB */ +#endif + + +/* Define if your target C library provides stack protector support */ +#ifndef USED_FOR_TARGET +/* #undef TARGET_LIBC_PROVIDES_SSP */ +#endif + + +/* Define to 1 if you can safely include both and . */ +#ifndef USED_FOR_TARGET +#define TIME_WITH_SYS_TIME 1 +#endif + + +/* Define to the flag used to mark TLS sections if the default (`T') doesn't + work. */ +#ifndef USED_FOR_TARGET +/* #undef TLS_SECTION_ASM_FLAG */ +#endif + + +/* Define if your assembler mis-optimizes .eh_frame data. */ +#ifndef USED_FOR_TARGET +/* #undef USE_AS_TRADITIONAL_FORMAT */ +#endif + + +/* Define if you want to generate code by default that assumes that the Cygwin + DLL exports wrappers to support libstdc++ function replacement. */ +#ifndef USED_FOR_TARGET +/* #undef USE_CYGWIN_LIBSTDCXX_WRAPPERS */ +#endif + + +/* Define to 1 if the 'long long' type is wider than 'long' but still + efficiently supported by the host hardware. */ +#ifndef USED_FOR_TARGET +/* #undef USE_LONG_LONG_FOR_WIDEST_FAST_INT */ +#endif + + +/* Define if we should use leading underscore on 64 bit mingw targets */ +#ifndef USED_FOR_TARGET +/* #undef USE_MINGW64_LEADING_UNDERSCORES */ +#endif + + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif + + +/* Define to be the last component of the Windows registry key under which to + look for installation paths. The full key used will be + HKEY_LOCAL_MACHINE/SOFTWARE/Free Software Foundation/{WIN32_REGISTRY_KEY}. + The default is the GCC version number. */ +#ifndef USED_FOR_TARGET +/* #undef WIN32_REGISTRY_KEY */ +#endif + + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +#ifndef USED_FOR_TARGET +/* #undef _FILE_OFFSET_BITS */ +#endif + + +/* Define for large files, on AIX-style hosts. */ +#ifndef USED_FOR_TARGET +/* #undef _LARGE_FILES */ +#endif + + +/* Define to 1 if on MINIX. */ +#ifndef USED_FOR_TARGET +/* #undef _MINIX */ +#endif + + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#ifndef USED_FOR_TARGET +/* #undef _POSIX_1_SOURCE */ +#endif + + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#ifndef USED_FOR_TARGET +/* #undef _POSIX_SOURCE */ +#endif + + +/* Define for Solaris 2.5.1 so the uint32_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#ifndef USED_FOR_TARGET +/* #undef _UINT32_T */ +#endif + + +/* Define for Solaris 2.5.1 so the uint64_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#ifndef USED_FOR_TARGET +/* #undef _UINT64_T */ +#endif + + +/* Define for Solaris 2.5.1 so the uint8_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#ifndef USED_FOR_TARGET +/* #undef _UINT8_T */ +#endif + + +/* Define to `char *' if does not define. */ +#ifndef USED_FOR_TARGET +/* #undef caddr_t */ +#endif + + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to the type of a signed integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +#ifndef USED_FOR_TARGET +/* #undef int16_t */ +#endif + + +/* Define to the type of a signed integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +#ifndef USED_FOR_TARGET +/* #undef int32_t */ +#endif + + +/* Define to the type of a signed integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +#ifndef USED_FOR_TARGET +/* #undef int64_t */ +#endif + + +/* Define to the type of a signed integer type of width exactly 8 bits if such + a type exists and the standard includes do not define it. */ +#ifndef USED_FOR_TARGET +/* #undef int8_t */ +#endif + + +/* Define to the widest signed integer type if and do + not define. */ +#ifndef USED_FOR_TARGET +/* #undef intmax_t */ +#endif + + +/* Define to the type of a signed integer type wide enough to hold a pointer, + if such a type exists, and if the system does not define it. */ +#ifndef USED_FOR_TARGET +/* #undef intptr_t */ +#endif + + +/* Define to `int' if does not define. */ +#ifndef USED_FOR_TARGET +/* #undef pid_t */ +#endif + + +/* Define to `long' if doesn't define. */ +#ifndef USED_FOR_TARGET +/* #undef rlim_t */ +#endif + + +/* Define to `int' if does not define. */ +#ifndef USED_FOR_TARGET +/* #undef ssize_t */ +#endif + + +/* Define to the type of an unsigned integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +#ifndef USED_FOR_TARGET +/* #undef uint16_t */ +#endif + + +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +#ifndef USED_FOR_TARGET +/* #undef uint32_t */ +#endif + + +/* Define to the type of an unsigned integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +#ifndef USED_FOR_TARGET +/* #undef uint64_t */ +#endif + + +/* Define to the type of an unsigned integer type of width exactly 8 bits if + such a type exists and the standard includes do not define it. */ +#ifndef USED_FOR_TARGET +/* #undef uint8_t */ +#endif + + +/* Define to the widest unsigned integer type if and + do not define. */ +#ifndef USED_FOR_TARGET +/* #undef uintmax_t */ +#endif + + +/* Define to the type of an unsigned integer type wide enough to hold a + pointer, if such a type exists, and if the system does not define it. */ +#ifndef USED_FOR_TARGET +/* #undef uintptr_t */ +#endif + + +/* Define as `fork' if `vfork' does not work. */ +#ifndef USED_FOR_TARGET +/* #undef vfork */ +#endif + diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/auto-profile.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/auto-profile.h new file mode 100644 index 0000000..ccaef33 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/auto-profile.h @@ -0,0 +1,31 @@ +/* auto-profile.h - Defines data exported from auto-profile.c + Copyright (C) 2014-2017 Free Software Foundation, Inc. + Contributed by Dehao Chen (dehao@google.com) + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef AUTO_PROFILE_H +#define AUTO_PROFILE_H + +/* Read, process, finalize AutoFDO data structures. */ +extern void read_autofdo_file (void); +extern void end_auto_profile (void); + +/* Returns TRUE if EDGE is hot enough to be inlined early. */ +extern bool afdo_callsite_hot_enough_for_early_inline (struct cgraph_edge *); + +#endif /* AUTO_PROFILE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/backend.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/backend.h new file mode 100644 index 0000000..ee560fc --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/backend.h @@ -0,0 +1,35 @@ +/* Common Backend requirements. + + Copyright (C) 2015-2017 Free Software Foundation, Inc. + Contributed by Andrew MacLeod + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_BACKEND_H +#define GCC_BACKEND_H + +/* This is an aggregation header file. This means it should contain only + other include files. */ + +#include "tm.h" +#include "function.h" +#include "bitmap.h" +#include "sbitmap.h" +#include "basic-block.h" +#include "cfg.h" + +#endif /*GCC_BACKEND_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/basic-block.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/basic-block.h new file mode 100644 index 0000000..decd6dd --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/basic-block.h @@ -0,0 +1,652 @@ +/* Define control flow data structures for the CFG. + Copyright (C) 1987-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_BASIC_BLOCK_H +#define GCC_BASIC_BLOCK_H + + +/* Use gcov_type to hold basic block counters. Should be at least + 64bit. Although a counter cannot be negative, we use a signed + type, because erroneous negative counts can be generated when the + flow graph is manipulated by various optimizations. A signed type + makes those easy to detect. */ + +/* Control flow edge information. */ +struct GTY((user)) edge_def { + /* The two blocks at the ends of the edge. */ + basic_block src; + basic_block dest; + + /* Instructions queued on the edge. */ + union edge_def_insns { + gimple_seq g; + rtx_insn *r; + } insns; + + /* Auxiliary info specific to a pass. */ + PTR aux; + + /* Location of any goto implicit in the edge. */ + location_t goto_locus; + + /* The index number corresponding to this edge in the edge vector + dest->preds. */ + unsigned int dest_idx; + + int flags; /* see cfg-flags.def */ + int probability; /* biased by REG_BR_PROB_BASE */ + gcov_type count; /* Expected number of executions calculated + in profile.c */ +}; + +/* Masks for edge.flags. */ +#define DEF_EDGE_FLAG(NAME,IDX) EDGE_##NAME = 1 << IDX , +enum cfg_edge_flags { +#include "cfg-flags.def" + LAST_CFG_EDGE_FLAG /* this is only used for EDGE_ALL_FLAGS */ +}; +#undef DEF_EDGE_FLAG + +/* Bit mask for all edge flags. */ +#define EDGE_ALL_FLAGS ((LAST_CFG_EDGE_FLAG - 1) * 2 - 1) + +/* The following four flags all indicate something special about an edge. + Test the edge flags on EDGE_COMPLEX to detect all forms of "strange" + control flow transfers. */ +#define EDGE_COMPLEX \ + (EDGE_ABNORMAL | EDGE_ABNORMAL_CALL | EDGE_EH | EDGE_PRESERVE) + +struct GTY(()) rtl_bb_info { + /* The first insn of the block is embedded into bb->il.x. */ + /* The last insn of the block. */ + rtx_insn *end_; + + /* In CFGlayout mode points to insn notes/jumptables to be placed just before + and after the block. */ + rtx_insn *header_; + rtx_insn *footer_; +}; + +struct GTY(()) gimple_bb_info { + /* Sequence of statements in this block. */ + gimple_seq seq; + + /* PHI nodes for this block. */ + gimple_seq phi_nodes; +}; + +/* A basic block is a sequence of instructions with only one entry and + only one exit. If any one of the instructions are executed, they + will all be executed, and in sequence from first to last. + + There may be COND_EXEC instructions in the basic block. The + COND_EXEC *instructions* will be executed -- but if the condition + is false the conditionally executed *expressions* will of course + not be executed. We don't consider the conditionally executed + expression (which might have side-effects) to be in a separate + basic block because the program counter will always be at the same + location after the COND_EXEC instruction, regardless of whether the + condition is true or not. + + Basic blocks need not start with a label nor end with a jump insn. + For example, a previous basic block may just "conditionally fall" + into the succeeding basic block, and the last basic block need not + end with a jump insn. Block 0 is a descendant of the entry block. + + A basic block beginning with two labels cannot have notes between + the labels. + + Data for jump tables are stored in jump_insns that occur in no + basic block even though these insns can follow or precede insns in + basic blocks. */ + +/* Basic block information indexed by block number. */ +struct GTY((chain_next ("%h.next_bb"), chain_prev ("%h.prev_bb"))) basic_block_def { + /* The edges into and out of the block. */ + vec *preds; + vec *succs; + + /* Auxiliary info specific to a pass. */ + PTR GTY ((skip (""))) aux; + + /* Innermost loop containing the block. */ + struct loop *loop_father; + + /* The dominance and postdominance information node. */ + struct et_node * GTY ((skip (""))) dom[2]; + + /* Previous and next blocks in the chain. */ + basic_block prev_bb; + basic_block next_bb; + + union basic_block_il_dependent { + struct gimple_bb_info GTY ((tag ("0"))) gimple; + struct { + rtx_insn *head_; + struct rtl_bb_info * rtl; + } GTY ((tag ("1"))) x; + } GTY ((desc ("((%1.flags & BB_RTL) != 0)"))) il; + + /* Various flags. See cfg-flags.def. */ + int flags; + + /* The index of this block. */ + int index; + + /* Expected number of executions: calculated in profile.c. */ + gcov_type count; + + /* Expected frequency. Normalized to be in range 0 to BB_FREQ_MAX. */ + int frequency; + + /* The discriminator for this block. The discriminator distinguishes + among several basic blocks that share a common locus, allowing for + more accurate sample-based profiling. */ + int discriminator; +}; + +/* This ensures that struct gimple_bb_info is smaller than + struct rtl_bb_info, so that inlining the former into basic_block_def + is the better choice. */ +typedef int __assert_gimple_bb_smaller_rtl_bb + [(int) sizeof (struct rtl_bb_info) + - (int) sizeof (struct gimple_bb_info)]; + + +#define BB_FREQ_MAX 10000 + +/* Masks for basic_block.flags. */ +#define DEF_BASIC_BLOCK_FLAG(NAME,IDX) BB_##NAME = 1 << IDX , +enum cfg_bb_flags +{ +#include "cfg-flags.def" + LAST_CFG_BB_FLAG /* this is only used for BB_ALL_FLAGS */ +}; +#undef DEF_BASIC_BLOCK_FLAG + +/* Bit mask for all basic block flags. */ +#define BB_ALL_FLAGS ((LAST_CFG_BB_FLAG - 1) * 2 - 1) + +/* Bit mask for all basic block flags that must be preserved. These are + the bit masks that are *not* cleared by clear_bb_flags. */ +#define BB_FLAGS_TO_PRESERVE \ + (BB_DISABLE_SCHEDULE | BB_RTL | BB_NON_LOCAL_GOTO_TARGET \ + | BB_HOT_PARTITION | BB_COLD_PARTITION) + +/* Dummy bitmask for convenience in the hot/cold partitioning code. */ +#define BB_UNPARTITIONED 0 + +/* Partitions, to be used when partitioning hot and cold basic blocks into + separate sections. */ +#define BB_PARTITION(bb) ((bb)->flags & (BB_HOT_PARTITION|BB_COLD_PARTITION)) +#define BB_SET_PARTITION(bb, part) do { \ + basic_block bb_ = (bb); \ + bb_->flags = ((bb_->flags & ~(BB_HOT_PARTITION|BB_COLD_PARTITION)) \ + | (part)); \ +} while (0) + +#define BB_COPY_PARTITION(dstbb, srcbb) \ + BB_SET_PARTITION (dstbb, BB_PARTITION (srcbb)) + +/* Defines for accessing the fields of the CFG structure for function FN. */ +#define ENTRY_BLOCK_PTR_FOR_FN(FN) ((FN)->cfg->x_entry_block_ptr) +#define EXIT_BLOCK_PTR_FOR_FN(FN) ((FN)->cfg->x_exit_block_ptr) +#define basic_block_info_for_fn(FN) ((FN)->cfg->x_basic_block_info) +#define n_basic_blocks_for_fn(FN) ((FN)->cfg->x_n_basic_blocks) +#define n_edges_for_fn(FN) ((FN)->cfg->x_n_edges) +#define last_basic_block_for_fn(FN) ((FN)->cfg->x_last_basic_block) +#define label_to_block_map_for_fn(FN) ((FN)->cfg->x_label_to_block_map) +#define profile_status_for_fn(FN) ((FN)->cfg->x_profile_status) + +#define BASIC_BLOCK_FOR_FN(FN,N) \ + ((*basic_block_info_for_fn (FN))[(N)]) +#define SET_BASIC_BLOCK_FOR_FN(FN,N,BB) \ + ((*basic_block_info_for_fn (FN))[(N)] = (BB)) + +/* For iterating over basic blocks. */ +#define FOR_BB_BETWEEN(BB, FROM, TO, DIR) \ + for (BB = FROM; BB != TO; BB = BB->DIR) + +#define FOR_EACH_BB_FN(BB, FN) \ + FOR_BB_BETWEEN (BB, (FN)->cfg->x_entry_block_ptr->next_bb, (FN)->cfg->x_exit_block_ptr, next_bb) + +#define FOR_EACH_BB_REVERSE_FN(BB, FN) \ + FOR_BB_BETWEEN (BB, (FN)->cfg->x_exit_block_ptr->prev_bb, (FN)->cfg->x_entry_block_ptr, prev_bb) + +/* For iterating over insns in basic block. */ +#define FOR_BB_INSNS(BB, INSN) \ + for ((INSN) = BB_HEAD (BB); \ + (INSN) && (INSN) != NEXT_INSN (BB_END (BB)); \ + (INSN) = NEXT_INSN (INSN)) + +/* For iterating over insns in basic block when we might remove the + current insn. */ +#define FOR_BB_INSNS_SAFE(BB, INSN, CURR) \ + for ((INSN) = BB_HEAD (BB), (CURR) = (INSN) ? NEXT_INSN ((INSN)): NULL; \ + (INSN) && (INSN) != NEXT_INSN (BB_END (BB)); \ + (INSN) = (CURR), (CURR) = (INSN) ? NEXT_INSN ((INSN)) : NULL) + +#define FOR_BB_INSNS_REVERSE(BB, INSN) \ + for ((INSN) = BB_END (BB); \ + (INSN) && (INSN) != PREV_INSN (BB_HEAD (BB)); \ + (INSN) = PREV_INSN (INSN)) + +#define FOR_BB_INSNS_REVERSE_SAFE(BB, INSN, CURR) \ + for ((INSN) = BB_END (BB),(CURR) = (INSN) ? PREV_INSN ((INSN)) : NULL; \ + (INSN) && (INSN) != PREV_INSN (BB_HEAD (BB)); \ + (INSN) = (CURR), (CURR) = (INSN) ? PREV_INSN ((INSN)) : NULL) + +/* Cycles through _all_ basic blocks, even the fake ones (entry and + exit block). */ + +#define FOR_ALL_BB_FN(BB, FN) \ + for (BB = ENTRY_BLOCK_PTR_FOR_FN (FN); BB; BB = BB->next_bb) + + +/* Stuff for recording basic block info. */ + +/* For now, these will be functions (so that they can include checked casts + to rtx_insn. Once the underlying fields are converted from rtx + to rtx_insn, these can be converted back to macros. */ + +#define BB_HEAD(B) (B)->il.x.head_ +#define BB_END(B) (B)->il.x.rtl->end_ +#define BB_HEADER(B) (B)->il.x.rtl->header_ +#define BB_FOOTER(B) (B)->il.x.rtl->footer_ + +/* Special block numbers [markers] for entry and exit. + Neither of them is supposed to hold actual statements. */ +#define ENTRY_BLOCK (0) +#define EXIT_BLOCK (1) + +/* The two blocks that are always in the cfg. */ +#define NUM_FIXED_BLOCKS (2) + +/* The base value for branch probability notes and edge probabilities. */ +#define REG_BR_PROB_BASE 10000 + +/* This is the value which indicates no edge is present. */ +#define EDGE_INDEX_NO_EDGE -1 + +/* EDGE_INDEX returns an integer index for an edge, or EDGE_INDEX_NO_EDGE + if there is no edge between the 2 basic blocks. */ +#define EDGE_INDEX(el, pred, succ) (find_edge_index ((el), (pred), (succ))) + +/* INDEX_EDGE_PRED_BB and INDEX_EDGE_SUCC_BB return a pointer to the basic + block which is either the pred or succ end of the indexed edge. */ +#define INDEX_EDGE_PRED_BB(el, index) ((el)->index_to_edge[(index)]->src) +#define INDEX_EDGE_SUCC_BB(el, index) ((el)->index_to_edge[(index)]->dest) + +/* INDEX_EDGE returns a pointer to the edge. */ +#define INDEX_EDGE(el, index) ((el)->index_to_edge[(index)]) + +/* Number of edges in the compressed edge list. */ +#define NUM_EDGES(el) ((el)->num_edges) + +/* BB is assumed to contain conditional jump. Return the fallthru edge. */ +#define FALLTHRU_EDGE(bb) (EDGE_SUCC ((bb), 0)->flags & EDGE_FALLTHRU \ + ? EDGE_SUCC ((bb), 0) : EDGE_SUCC ((bb), 1)) + +/* BB is assumed to contain conditional jump. Return the branch edge. */ +#define BRANCH_EDGE(bb) (EDGE_SUCC ((bb), 0)->flags & EDGE_FALLTHRU \ + ? EDGE_SUCC ((bb), 1) : EDGE_SUCC ((bb), 0)) + +#define RDIV(X,Y) (((X) + (Y) / 2) / (Y)) +/* Return expected execution frequency of the edge E. */ +#define EDGE_FREQUENCY(e) RDIV ((e)->src->frequency * (e)->probability, \ + REG_BR_PROB_BASE) + +/* Compute a scale factor (or probability) suitable for scaling of + gcov_type values via apply_probability() and apply_scale(). */ +#define GCOV_COMPUTE_SCALE(num,den) \ + ((den) ? RDIV ((num) * REG_BR_PROB_BASE, (den)) : REG_BR_PROB_BASE) + +/* Return nonzero if edge is critical. */ +#define EDGE_CRITICAL_P(e) (EDGE_COUNT ((e)->src->succs) >= 2 \ + && EDGE_COUNT ((e)->dest->preds) >= 2) + +#define EDGE_COUNT(ev) vec_safe_length (ev) +#define EDGE_I(ev,i) (*ev)[(i)] +#define EDGE_PRED(bb,i) (*(bb)->preds)[(i)] +#define EDGE_SUCC(bb,i) (*(bb)->succs)[(i)] + +/* Returns true if BB has precisely one successor. */ + +static inline bool +single_succ_p (const_basic_block bb) +{ + return EDGE_COUNT (bb->succs) == 1; +} + +/* Returns true if BB has precisely one predecessor. */ + +static inline bool +single_pred_p (const_basic_block bb) +{ + return EDGE_COUNT (bb->preds) == 1; +} + +/* Returns the single successor edge of basic block BB. Aborts if + BB does not have exactly one successor. */ + +static inline edge +single_succ_edge (const_basic_block bb) +{ + gcc_checking_assert (single_succ_p (bb)); + return EDGE_SUCC (bb, 0); +} + +/* Returns the single predecessor edge of basic block BB. Aborts + if BB does not have exactly one predecessor. */ + +static inline edge +single_pred_edge (const_basic_block bb) +{ + gcc_checking_assert (single_pred_p (bb)); + return EDGE_PRED (bb, 0); +} + +/* Returns the single successor block of basic block BB. Aborts + if BB does not have exactly one successor. */ + +static inline basic_block +single_succ (const_basic_block bb) +{ + return single_succ_edge (bb)->dest; +} + +/* Returns the single predecessor block of basic block BB. Aborts + if BB does not have exactly one predecessor.*/ + +static inline basic_block +single_pred (const_basic_block bb) +{ + return single_pred_edge (bb)->src; +} + +/* Iterator object for edges. */ + +struct edge_iterator { + unsigned index; + vec **container; +}; + +static inline vec * +ei_container (edge_iterator i) +{ + gcc_checking_assert (i.container); + return *i.container; +} + +#define ei_start(iter) ei_start_1 (&(iter)) +#define ei_last(iter) ei_last_1 (&(iter)) + +/* Return an iterator pointing to the start of an edge vector. */ +static inline edge_iterator +ei_start_1 (vec **ev) +{ + edge_iterator i; + + i.index = 0; + i.container = ev; + + return i; +} + +/* Return an iterator pointing to the last element of an edge + vector. */ +static inline edge_iterator +ei_last_1 (vec **ev) +{ + edge_iterator i; + + i.index = EDGE_COUNT (*ev) - 1; + i.container = ev; + + return i; +} + +/* Is the iterator `i' at the end of the sequence? */ +static inline bool +ei_end_p (edge_iterator i) +{ + return (i.index == EDGE_COUNT (ei_container (i))); +} + +/* Is the iterator `i' at one position before the end of the + sequence? */ +static inline bool +ei_one_before_end_p (edge_iterator i) +{ + return (i.index + 1 == EDGE_COUNT (ei_container (i))); +} + +/* Advance the iterator to the next element. */ +static inline void +ei_next (edge_iterator *i) +{ + gcc_checking_assert (i->index < EDGE_COUNT (ei_container (*i))); + i->index++; +} + +/* Move the iterator to the previous element. */ +static inline void +ei_prev (edge_iterator *i) +{ + gcc_checking_assert (i->index > 0); + i->index--; +} + +/* Return the edge pointed to by the iterator `i'. */ +static inline edge +ei_edge (edge_iterator i) +{ + return EDGE_I (ei_container (i), i.index); +} + +/* Return an edge pointed to by the iterator. Do it safely so that + NULL is returned when the iterator is pointing at the end of the + sequence. */ +static inline edge +ei_safe_edge (edge_iterator i) +{ + return !ei_end_p (i) ? ei_edge (i) : NULL; +} + +/* Return 1 if we should continue to iterate. Return 0 otherwise. + *Edge P is set to the next edge if we are to continue to iterate + and NULL otherwise. */ + +static inline bool +ei_cond (edge_iterator ei, edge *p) +{ + if (!ei_end_p (ei)) + { + *p = ei_edge (ei); + return 1; + } + else + { + *p = NULL; + return 0; + } +} + +/* This macro serves as a convenient way to iterate each edge in a + vector of predecessor or successor edges. It must not be used when + an element might be removed during the traversal, otherwise + elements will be missed. Instead, use a for-loop like that shown + in the following pseudo-code: + + FOR (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); ) + { + IF (e != taken_edge) + remove_edge (e); + ELSE + ei_next (&ei); + } +*/ + +#define FOR_EACH_EDGE(EDGE,ITER,EDGE_VEC) \ + for ((ITER) = ei_start ((EDGE_VEC)); \ + ei_cond ((ITER), &(EDGE)); \ + ei_next (&(ITER))) + +#define CLEANUP_EXPENSIVE 1 /* Do relatively expensive optimizations + except for edge forwarding */ +#define CLEANUP_CROSSJUMP 2 /* Do crossjumping. */ +#define CLEANUP_POST_REGSTACK 4 /* We run after reg-stack and need + to care REG_DEAD notes. */ +#define CLEANUP_THREADING 8 /* Do jump threading. */ +#define CLEANUP_NO_INSN_DEL 16 /* Do not try to delete trivially dead + insns. */ +#define CLEANUP_CFGLAYOUT 32 /* Do cleanup in cfglayout mode. */ +#define CLEANUP_CFG_CHANGED 64 /* The caller changed the CFG. */ + +/* Return true if BB is in a transaction. */ + +static inline bool +bb_in_transaction (basic_block bb) +{ + return bb->flags & BB_IN_TRANSACTION; +} + +/* Return true when one of the predecessor edges of BB is marked with EDGE_EH. */ +static inline bool +bb_has_eh_pred (basic_block bb) +{ + edge e; + edge_iterator ei; + + FOR_EACH_EDGE (e, ei, bb->preds) + { + if (e->flags & EDGE_EH) + return true; + } + return false; +} + +/* Return true when one of the predecessor edges of BB is marked with EDGE_ABNORMAL. */ +static inline bool +bb_has_abnormal_pred (basic_block bb) +{ + edge e; + edge_iterator ei; + + FOR_EACH_EDGE (e, ei, bb->preds) + { + if (e->flags & EDGE_ABNORMAL) + return true; + } + return false; +} + +/* Return the fallthru edge in EDGES if it exists, NULL otherwise. */ +static inline edge +find_fallthru_edge (vec *edges) +{ + edge e; + edge_iterator ei; + + FOR_EACH_EDGE (e, ei, edges) + if (e->flags & EDGE_FALLTHRU) + break; + + return e; +} + +/* Check tha probability is sane. */ + +static inline void +check_probability (int prob) +{ + gcc_checking_assert (prob >= 0 && prob <= REG_BR_PROB_BASE); +} + +/* Given PROB1 and PROB2, return PROB1*PROB2/REG_BR_PROB_BASE. + Used to combine BB probabilities. */ + +static inline int +combine_probabilities (int prob1, int prob2) +{ + check_probability (prob1); + check_probability (prob2); + return RDIV (prob1 * prob2, REG_BR_PROB_BASE); +} + +/* Apply scale factor SCALE on frequency or count FREQ. Use this + interface when potentially scaling up, so that SCALE is not + constrained to be < REG_BR_PROB_BASE. */ + +static inline gcov_type +apply_scale (gcov_type freq, gcov_type scale) +{ + return RDIV (freq * scale, REG_BR_PROB_BASE); +} + +/* Apply probability PROB on frequency or count FREQ. */ + +static inline gcov_type +apply_probability (gcov_type freq, int prob) +{ + check_probability (prob); + return apply_scale (freq, prob); +} + +/* Return inverse probability for PROB. */ + +static inline int +inverse_probability (int prob1) +{ + check_probability (prob1); + return REG_BR_PROB_BASE - prob1; +} + +/* Return true if BB has at least one abnormal outgoing edge. */ + +static inline bool +has_abnormal_or_eh_outgoing_edge_p (basic_block bb) +{ + edge e; + edge_iterator ei; + + FOR_EACH_EDGE (e, ei, bb->succs) + if (e->flags & (EDGE_ABNORMAL | EDGE_EH)) + return true; + + return false; +} + +/* Return true when one of the predecessor edges of BB is marked with + EDGE_ABNORMAL_CALL or EDGE_EH. */ + +static inline bool +has_abnormal_call_or_eh_pred_edge_p (basic_block bb) +{ + edge e; + edge_iterator ei; + + FOR_EACH_EDGE (e, ei, bb->preds) + if (e->flags & (EDGE_ABNORMAL_CALL | EDGE_EH)) + return true; + + return false; +} + +#endif /* GCC_BASIC_BLOCK_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/bb-reorder.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/bb-reorder.h new file mode 100644 index 0000000..392f34d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/bb-reorder.h @@ -0,0 +1,40 @@ +/* Basic block reordering routines for the GNU compiler. + Copyright (C) 2000-2017 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#ifndef GCC_BB_REORDER +#define GCC_BB_REORDER + +/* Target-specific globals. */ +struct target_bb_reorder { + /* Length of unconditional jump instruction. */ + int x_uncond_jump_length; +}; + +extern struct target_bb_reorder default_target_bb_reorder; +#if SWITCHABLE_TARGET +extern struct target_bb_reorder *this_target_bb_reorder; +#else +#define this_target_bb_reorder (&default_target_bb_reorder) +#endif + +extern int get_uncond_jump_length (void); + +extern void insert_section_boundary_note (void); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/bitmap.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/bitmap.h new file mode 100644 index 0000000..f158b44 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/bitmap.h @@ -0,0 +1,826 @@ +/* Functions to support general ended bitmaps. + Copyright (C) 1997-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_BITMAP_H +#define GCC_BITMAP_H + +/* Implementation of sparse integer sets as a linked list. + + This sparse set representation is suitable for sparse sets with an + unknown (a priori) universe. The set is represented as a double-linked + list of container nodes (struct bitmap_element). Each node consists + of an index for the first member that could be held in the container, + a small array of integers that represent the members in the container, + and pointers to the next and previous element in the linked list. The + elements in the list are sorted in ascending order, i.e. the head of + the list holds the element with the smallest member of the set. + + For a given member I in the set: + - the element for I will have index is I / (bits per element) + - the position for I within element is I % (bits per element) + + This representation is very space-efficient for large sparse sets, and + the size of the set can be changed dynamically without much overhead. + An important parameter is the number of bits per element. In this + implementation, there are 128 bits per element. This results in a + high storage overhead *per element*, but a small overall overhead if + the set is very sparse. + + The downside is that many operations are relatively slow because the + linked list has to be traversed to test membership (i.e. member_p/ + add_member/remove_member). To improve the performance of this set + representation, the last accessed element and its index are cached. + For membership tests on members close to recently accessed members, + the cached last element improves membership test to a constant-time + operation. + + The following operations can always be performed in O(1) time: + + * clear : bitmap_clear + * choose_one : (not implemented, but could be + implemented in constant time) + + The following operations can be performed in O(E) time worst-case (with + E the number of elements in the linked list), but in O(1) time with a + suitable access patterns: + + * member_p : bitmap_bit_p + * add_member : bitmap_set_bit + * remove_member : bitmap_clear_bit + + The following operations can be performed in O(E) time: + + * cardinality : bitmap_count_bits + * set_size : bitmap_last_set_bit (but this could + in constant time with a pointer to + the last element in the chain) + + Additionally, the linked-list sparse set representation supports + enumeration of the members in O(E) time: + + * forall : EXECUTE_IF_SET_IN_BITMAP + * set_copy : bitmap_copy + * set_intersection : bitmap_intersect_p / + bitmap_and / bitmap_and_into / + EXECUTE_IF_AND_IN_BITMAP + * set_union : bitmap_ior / bitmap_ior_into + * set_difference : bitmap_intersect_compl_p / + bitmap_and_comp / bitmap_and_comp_into / + EXECUTE_IF_AND_COMPL_IN_BITMAP + * set_disjuction : bitmap_xor_comp / bitmap_xor_comp_into + * set_compare : bitmap_equal_p + + Some operations on 3 sets that occur frequently in data flow problems + are also implemented: + + * A | (B & C) : bitmap_ior_and_into + * A | (B & ~C) : bitmap_ior_and_compl / + bitmap_ior_and_compl_into + + The storage requirements for linked-list sparse sets are O(E), with E->N + in the worst case (a sparse set with large distances between the values + of the set members). + + The linked-list set representation works well for problems involving very + sparse sets. The canonical example in GCC is, of course, the "set of + sets" for some CFG-based data flow problems (liveness analysis, dominance + frontiers, etc.). + + This representation also works well for data flow problems where the size + of the set may grow dynamically, but care must be taken that the member_p, + add_member, and remove_member operations occur with a suitable access + pattern. + + For random-access sets with a known, relatively small universe size, the + SparseSet or simple bitmap representations may be more efficient than a + linked-list set. For random-access sets of unknown universe, a hash table + or a balanced binary tree representation is likely to be a more suitable + choice. + + Traversing linked lists is usually cache-unfriendly, even with the last + accessed element cached. + + Cache performance can be improved by keeping the elements in the set + grouped together in memory, using a dedicated obstack for a set (or group + of related sets). Elements allocated on obstacks are released to a + free-list and taken off the free list. If multiple sets are allocated on + the same obstack, elements freed from one set may be re-used for one of + the other sets. This usually helps avoid cache misses. + + A single free-list is used for all sets allocated in GGC space. This is + bad for persistent sets, so persistent sets should be allocated on an + obstack whenever possible. */ + +#include "obstack.h" + +/* Bitmap memory usage. */ +struct bitmap_usage: public mem_usage +{ + /* Default contructor. */ + bitmap_usage (): m_nsearches (0), m_search_iter (0) {} + /* Constructor. */ + bitmap_usage (size_t allocated, size_t times, size_t peak, + uint64_t nsearches, uint64_t search_iter) + : mem_usage (allocated, times, peak), + m_nsearches (nsearches), m_search_iter (search_iter) {} + + /* Sum the usage with SECOND usage. */ + bitmap_usage + operator+ (const bitmap_usage &second) + { + return bitmap_usage (m_allocated + second.m_allocated, + m_times + second.m_times, + m_peak + second.m_peak, + m_nsearches + second.m_nsearches, + m_search_iter + second.m_search_iter); + } + + /* Dump usage coupled to LOC location, where TOTAL is sum of all rows. */ + inline void + dump (mem_location *loc, mem_usage &total) const + { + char *location_string = loc->to_string (); + + fprintf (stderr, "%-48s %10" PRIu64 ":%5.1f%%" + "%10" PRIu64 "%10" PRIu64 ":%5.1f%%" + "%12" PRIu64 "%12" PRIu64 "%10s\n", + location_string, (uint64_t)m_allocated, + get_percent (m_allocated, total.m_allocated), + (uint64_t)m_peak, (uint64_t)m_times, + get_percent (m_times, total.m_times), + m_nsearches, m_search_iter, + loc->m_ggc ? "ggc" : "heap"); + + free (location_string); + } + + /* Dump header with NAME. */ + static inline void + dump_header (const char *name) + { + fprintf (stderr, "%-48s %11s%16s%17s%12s%12s%10s\n", name, "Leak", "Peak", + "Times", "N searches", "Search iter", "Type"); + print_dash_line (); + } + + /* Number search operations. */ + uint64_t m_nsearches; + /* Number of search iterations. */ + uint64_t m_search_iter; +}; + +/* Bitmap memory description. */ +extern mem_alloc_description bitmap_mem_desc; + +/* Fundamental storage type for bitmap. */ + +typedef unsigned long BITMAP_WORD; +/* BITMAP_WORD_BITS needs to be unsigned, but cannot contain casts as + it is used in preprocessor directives -- hence the 1u. */ +#define BITMAP_WORD_BITS (CHAR_BIT * SIZEOF_LONG * 1u) + +/* Number of words to use for each element in the linked list. */ + +#ifndef BITMAP_ELEMENT_WORDS +#define BITMAP_ELEMENT_WORDS ((128 + BITMAP_WORD_BITS - 1) / BITMAP_WORD_BITS) +#endif + +/* Number of bits in each actual element of a bitmap. */ + +#define BITMAP_ELEMENT_ALL_BITS (BITMAP_ELEMENT_WORDS * BITMAP_WORD_BITS) + +/* Obstack for allocating bitmaps and elements from. */ +struct GTY (()) bitmap_obstack { + struct bitmap_element *elements; + struct bitmap_head *heads; + struct obstack GTY ((skip)) obstack; +}; + +/* Bitmap set element. We use a linked list to hold only the bits that + are set. This allows for use to grow the bitset dynamically without + having to realloc and copy a giant bit array. + + The free list is implemented as a list of lists. There is one + outer list connected together by prev fields. Each element of that + outer is an inner list (that may consist only of the outer list + element) that are connected by the next fields. The prev pointer + is undefined for interior elements. This allows + bitmap_elt_clear_from to be implemented in unit time rather than + linear in the number of elements to be freed. */ + +struct GTY((chain_next ("%h.next"), chain_prev ("%h.prev"))) bitmap_element { + struct bitmap_element *next; /* Next element. */ + struct bitmap_element *prev; /* Previous element. */ + unsigned int indx; /* regno/BITMAP_ELEMENT_ALL_BITS. */ + BITMAP_WORD bits[BITMAP_ELEMENT_WORDS]; /* Bits that are set. */ +}; + +/* Head of bitmap linked list. The 'current' member points to something + already pointed to by the chain started by first, so GTY((skip)) it. */ + +struct GTY(()) bitmap_head { + unsigned int indx; /* Index of last element looked at. */ + unsigned int descriptor_id; /* Unique identifier for the allocation + site of this bitmap, for detailed + statistics gathering. */ + bitmap_element *first; /* First element in linked list. */ + bitmap_element * GTY((skip(""))) current; /* Last element looked at. */ + bitmap_obstack *obstack; /* Obstack to allocate elements from. + If NULL, then use GGC allocation. */ +}; + +/* Global data */ +extern bitmap_element bitmap_zero_bits; /* Zero bitmap element */ +extern bitmap_obstack bitmap_default_obstack; /* Default bitmap obstack */ + +/* Clear a bitmap by freeing up the linked list. */ +extern void bitmap_clear (bitmap); + +/* Copy a bitmap to another bitmap. */ +extern void bitmap_copy (bitmap, const_bitmap); + +/* Move a bitmap to another bitmap. */ +extern void bitmap_move (bitmap, bitmap); + +/* True if two bitmaps are identical. */ +extern bool bitmap_equal_p (const_bitmap, const_bitmap); + +/* True if the bitmaps intersect (their AND is non-empty). */ +extern bool bitmap_intersect_p (const_bitmap, const_bitmap); + +/* True if the complement of the second intersects the first (their + AND_COMPL is non-empty). */ +extern bool bitmap_intersect_compl_p (const_bitmap, const_bitmap); + +/* True if MAP is an empty bitmap. */ +inline bool bitmap_empty_p (const_bitmap map) +{ + return !map->first; +} + +/* True if the bitmap has only a single bit set. */ +extern bool bitmap_single_bit_set_p (const_bitmap); + +/* Count the number of bits set in the bitmap. */ +extern unsigned long bitmap_count_bits (const_bitmap); + +/* Count the number of unique bits set across the two bitmaps. */ +extern unsigned long bitmap_count_unique_bits (const_bitmap, const_bitmap); + +/* Boolean operations on bitmaps. The _into variants are two operand + versions that modify the first source operand. The other variants + are three operand versions that to not destroy the source bitmaps. + The operations supported are &, & ~, |, ^. */ +extern void bitmap_and (bitmap, const_bitmap, const_bitmap); +extern bool bitmap_and_into (bitmap, const_bitmap); +extern bool bitmap_and_compl (bitmap, const_bitmap, const_bitmap); +extern bool bitmap_and_compl_into (bitmap, const_bitmap); +#define bitmap_compl_and(DST, A, B) bitmap_and_compl (DST, B, A) +extern void bitmap_compl_and_into (bitmap, const_bitmap); +extern void bitmap_clear_range (bitmap, unsigned int, unsigned int); +extern void bitmap_set_range (bitmap, unsigned int, unsigned int); +extern bool bitmap_ior (bitmap, const_bitmap, const_bitmap); +extern bool bitmap_ior_into (bitmap, const_bitmap); +extern void bitmap_xor (bitmap, const_bitmap, const_bitmap); +extern void bitmap_xor_into (bitmap, const_bitmap); + +/* DST = A | (B & C). Return true if DST changes. */ +extern bool bitmap_ior_and_into (bitmap DST, const_bitmap B, const_bitmap C); +/* DST = A | (B & ~C). Return true if DST changes. */ +extern bool bitmap_ior_and_compl (bitmap DST, const_bitmap A, + const_bitmap B, const_bitmap C); +/* A |= (B & ~C). Return true if A changes. */ +extern bool bitmap_ior_and_compl_into (bitmap A, + const_bitmap B, const_bitmap C); + +/* Clear a single bit in a bitmap. Return true if the bit changed. */ +extern bool bitmap_clear_bit (bitmap, int); + +/* Set a single bit in a bitmap. Return true if the bit changed. */ +extern bool bitmap_set_bit (bitmap, int); + +/* Return true if a register is set in a register set. */ +extern int bitmap_bit_p (bitmap, int); + +/* Debug functions to print a bitmap linked list. */ +extern void debug_bitmap (const_bitmap); +extern void debug_bitmap_file (FILE *, const_bitmap); + +/* Print a bitmap. */ +extern void bitmap_print (FILE *, const_bitmap, const char *, const char *); + +/* Initialize and release a bitmap obstack. */ +extern void bitmap_obstack_initialize (bitmap_obstack *); +extern void bitmap_obstack_release (bitmap_obstack *); +extern void bitmap_register (bitmap MEM_STAT_DECL); +extern void dump_bitmap_statistics (void); + +/* Initialize a bitmap header. OBSTACK indicates the bitmap obstack + to allocate from, NULL for GC'd bitmap. */ + +static inline void +bitmap_initialize_stat (bitmap head, bitmap_obstack *obstack MEM_STAT_DECL) +{ + head->first = head->current = NULL; + head->obstack = obstack; + if (GATHER_STATISTICS) + bitmap_register (head PASS_MEM_STAT); +} +#define bitmap_initialize(h,o) bitmap_initialize_stat (h,o MEM_STAT_INFO) + +/* Allocate and free bitmaps from obstack, malloc and gc'd memory. */ +extern bitmap bitmap_obstack_alloc_stat (bitmap_obstack *obstack MEM_STAT_DECL); +#define bitmap_obstack_alloc(t) bitmap_obstack_alloc_stat (t MEM_STAT_INFO) +extern bitmap bitmap_gc_alloc_stat (ALONE_MEM_STAT_DECL); +#define bitmap_gc_alloc() bitmap_gc_alloc_stat (ALONE_MEM_STAT_INFO) +extern void bitmap_obstack_free (bitmap); + +/* A few compatibility/functions macros for compatibility with sbitmaps */ +inline void dump_bitmap (FILE *file, const_bitmap map) +{ + bitmap_print (file, map, "", "\n"); +} +extern void debug (const bitmap_head &ref); +extern void debug (const bitmap_head *ptr); + +extern unsigned bitmap_first_set_bit (const_bitmap); +extern unsigned bitmap_last_set_bit (const_bitmap); + +/* Compute bitmap hash (for purposes of hashing etc.) */ +extern hashval_t bitmap_hash (const_bitmap); + +/* Allocate a bitmap from a bit obstack. */ +#define BITMAP_ALLOC(OBSTACK) bitmap_obstack_alloc (OBSTACK) + +/* Allocate a gc'd bitmap. */ +#define BITMAP_GGC_ALLOC() bitmap_gc_alloc () + +/* Do any cleanup needed on a bitmap when it is no longer used. */ +#define BITMAP_FREE(BITMAP) \ + ((void) (bitmap_obstack_free ((bitmap) BITMAP), (BITMAP) = (bitmap) NULL)) + +/* Iterator for bitmaps. */ + +struct bitmap_iterator +{ + /* Pointer to the current bitmap element. */ + bitmap_element *elt1; + + /* Pointer to 2nd bitmap element when two are involved. */ + bitmap_element *elt2; + + /* Word within the current element. */ + unsigned word_no; + + /* Contents of the actually processed word. When finding next bit + it is shifted right, so that the actual bit is always the least + significant bit of ACTUAL. */ + BITMAP_WORD bits; +}; + +/* Initialize a single bitmap iterator. START_BIT is the first bit to + iterate from. */ + +static inline void +bmp_iter_set_init (bitmap_iterator *bi, const_bitmap map, + unsigned start_bit, unsigned *bit_no) +{ + bi->elt1 = map->first; + bi->elt2 = NULL; + + /* Advance elt1 until it is not before the block containing start_bit. */ + while (1) + { + if (!bi->elt1) + { + bi->elt1 = &bitmap_zero_bits; + break; + } + + if (bi->elt1->indx >= start_bit / BITMAP_ELEMENT_ALL_BITS) + break; + bi->elt1 = bi->elt1->next; + } + + /* We might have gone past the start bit, so reinitialize it. */ + if (bi->elt1->indx != start_bit / BITMAP_ELEMENT_ALL_BITS) + start_bit = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS; + + /* Initialize for what is now start_bit. */ + bi->word_no = start_bit / BITMAP_WORD_BITS % BITMAP_ELEMENT_WORDS; + bi->bits = bi->elt1->bits[bi->word_no]; + bi->bits >>= start_bit % BITMAP_WORD_BITS; + + /* If this word is zero, we must make sure we're not pointing at the + first bit, otherwise our incrementing to the next word boundary + will fail. It won't matter if this increment moves us into the + next word. */ + start_bit += !bi->bits; + + *bit_no = start_bit; +} + +/* Initialize an iterator to iterate over the intersection of two + bitmaps. START_BIT is the bit to commence from. */ + +static inline void +bmp_iter_and_init (bitmap_iterator *bi, const_bitmap map1, const_bitmap map2, + unsigned start_bit, unsigned *bit_no) +{ + bi->elt1 = map1->first; + bi->elt2 = map2->first; + + /* Advance elt1 until it is not before the block containing + start_bit. */ + while (1) + { + if (!bi->elt1) + { + bi->elt2 = NULL; + break; + } + + if (bi->elt1->indx >= start_bit / BITMAP_ELEMENT_ALL_BITS) + break; + bi->elt1 = bi->elt1->next; + } + + /* Advance elt2 until it is not before elt1. */ + while (1) + { + if (!bi->elt2) + { + bi->elt1 = bi->elt2 = &bitmap_zero_bits; + break; + } + + if (bi->elt2->indx >= bi->elt1->indx) + break; + bi->elt2 = bi->elt2->next; + } + + /* If we're at the same index, then we have some intersecting bits. */ + if (bi->elt1->indx == bi->elt2->indx) + { + /* We might have advanced beyond the start_bit, so reinitialize + for that. */ + if (bi->elt1->indx != start_bit / BITMAP_ELEMENT_ALL_BITS) + start_bit = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS; + + bi->word_no = start_bit / BITMAP_WORD_BITS % BITMAP_ELEMENT_WORDS; + bi->bits = bi->elt1->bits[bi->word_no] & bi->elt2->bits[bi->word_no]; + bi->bits >>= start_bit % BITMAP_WORD_BITS; + } + else + { + /* Otherwise we must immediately advance elt1, so initialize for + that. */ + bi->word_no = BITMAP_ELEMENT_WORDS - 1; + bi->bits = 0; + } + + /* If this word is zero, we must make sure we're not pointing at the + first bit, otherwise our incrementing to the next word boundary + will fail. It won't matter if this increment moves us into the + next word. */ + start_bit += !bi->bits; + + *bit_no = start_bit; +} + +/* Initialize an iterator to iterate over the bits in MAP1 & ~MAP2. + */ + +static inline void +bmp_iter_and_compl_init (bitmap_iterator *bi, + const_bitmap map1, const_bitmap map2, + unsigned start_bit, unsigned *bit_no) +{ + bi->elt1 = map1->first; + bi->elt2 = map2->first; + + /* Advance elt1 until it is not before the block containing start_bit. */ + while (1) + { + if (!bi->elt1) + { + bi->elt1 = &bitmap_zero_bits; + break; + } + + if (bi->elt1->indx >= start_bit / BITMAP_ELEMENT_ALL_BITS) + break; + bi->elt1 = bi->elt1->next; + } + + /* Advance elt2 until it is not before elt1. */ + while (bi->elt2 && bi->elt2->indx < bi->elt1->indx) + bi->elt2 = bi->elt2->next; + + /* We might have advanced beyond the start_bit, so reinitialize for + that. */ + if (bi->elt1->indx != start_bit / BITMAP_ELEMENT_ALL_BITS) + start_bit = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS; + + bi->word_no = start_bit / BITMAP_WORD_BITS % BITMAP_ELEMENT_WORDS; + bi->bits = bi->elt1->bits[bi->word_no]; + if (bi->elt2 && bi->elt1->indx == bi->elt2->indx) + bi->bits &= ~bi->elt2->bits[bi->word_no]; + bi->bits >>= start_bit % BITMAP_WORD_BITS; + + /* If this word is zero, we must make sure we're not pointing at the + first bit, otherwise our incrementing to the next word boundary + will fail. It won't matter if this increment moves us into the + next word. */ + start_bit += !bi->bits; + + *bit_no = start_bit; +} + +/* Advance to the next bit in BI. We don't advance to the next + nonzero bit yet. */ + +static inline void +bmp_iter_next (bitmap_iterator *bi, unsigned *bit_no) +{ + bi->bits >>= 1; + *bit_no += 1; +} + +/* Advance to first set bit in BI. */ + +static inline void +bmp_iter_next_bit (bitmap_iterator * bi, unsigned *bit_no) +{ +#if (GCC_VERSION >= 3004) + { + unsigned int n = __builtin_ctzl (bi->bits); + gcc_assert (sizeof (unsigned long) == sizeof (BITMAP_WORD)); + bi->bits >>= n; + *bit_no += n; + } +#else + while (!(bi->bits & 1)) + { + bi->bits >>= 1; + *bit_no += 1; + } +#endif +} + +/* Advance to the next nonzero bit of a single bitmap, we will have + already advanced past the just iterated bit. Return true if there + is a bit to iterate. */ + +static inline bool +bmp_iter_set (bitmap_iterator *bi, unsigned *bit_no) +{ + /* If our current word is nonzero, it contains the bit we want. */ + if (bi->bits) + { + next_bit: + bmp_iter_next_bit (bi, bit_no); + return true; + } + + /* Round up to the word boundary. We might have just iterated past + the end of the last word, hence the -1. It is not possible for + bit_no to point at the beginning of the now last word. */ + *bit_no = ((*bit_no + BITMAP_WORD_BITS - 1) + / BITMAP_WORD_BITS * BITMAP_WORD_BITS); + bi->word_no++; + + while (1) + { + /* Find the next nonzero word in this elt. */ + while (bi->word_no != BITMAP_ELEMENT_WORDS) + { + bi->bits = bi->elt1->bits[bi->word_no]; + if (bi->bits) + goto next_bit; + *bit_no += BITMAP_WORD_BITS; + bi->word_no++; + } + + /* Make sure we didn't remove the element while iterating. */ + gcc_checking_assert (bi->elt1->indx != -1U); + + /* Advance to the next element. */ + bi->elt1 = bi->elt1->next; + if (!bi->elt1) + return false; + *bit_no = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS; + bi->word_no = 0; + } +} + +/* Advance to the next nonzero bit of an intersecting pair of + bitmaps. We will have already advanced past the just iterated bit. + Return true if there is a bit to iterate. */ + +static inline bool +bmp_iter_and (bitmap_iterator *bi, unsigned *bit_no) +{ + /* If our current word is nonzero, it contains the bit we want. */ + if (bi->bits) + { + next_bit: + bmp_iter_next_bit (bi, bit_no); + return true; + } + + /* Round up to the word boundary. We might have just iterated past + the end of the last word, hence the -1. It is not possible for + bit_no to point at the beginning of the now last word. */ + *bit_no = ((*bit_no + BITMAP_WORD_BITS - 1) + / BITMAP_WORD_BITS * BITMAP_WORD_BITS); + bi->word_no++; + + while (1) + { + /* Find the next nonzero word in this elt. */ + while (bi->word_no != BITMAP_ELEMENT_WORDS) + { + bi->bits = bi->elt1->bits[bi->word_no] & bi->elt2->bits[bi->word_no]; + if (bi->bits) + goto next_bit; + *bit_no += BITMAP_WORD_BITS; + bi->word_no++; + } + + /* Advance to the next identical element. */ + do + { + /* Make sure we didn't remove the element while iterating. */ + gcc_checking_assert (bi->elt1->indx != -1U); + + /* Advance elt1 while it is less than elt2. We always want + to advance one elt. */ + do + { + bi->elt1 = bi->elt1->next; + if (!bi->elt1) + return false; + } + while (bi->elt1->indx < bi->elt2->indx); + + /* Make sure we didn't remove the element while iterating. */ + gcc_checking_assert (bi->elt2->indx != -1U); + + /* Advance elt2 to be no less than elt1. This might not + advance. */ + while (bi->elt2->indx < bi->elt1->indx) + { + bi->elt2 = bi->elt2->next; + if (!bi->elt2) + return false; + } + } + while (bi->elt1->indx != bi->elt2->indx); + + *bit_no = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS; + bi->word_no = 0; + } +} + +/* Advance to the next nonzero bit in the intersection of + complemented bitmaps. We will have already advanced past the just + iterated bit. */ + +static inline bool +bmp_iter_and_compl (bitmap_iterator *bi, unsigned *bit_no) +{ + /* If our current word is nonzero, it contains the bit we want. */ + if (bi->bits) + { + next_bit: + bmp_iter_next_bit (bi, bit_no); + return true; + } + + /* Round up to the word boundary. We might have just iterated past + the end of the last word, hence the -1. It is not possible for + bit_no to point at the beginning of the now last word. */ + *bit_no = ((*bit_no + BITMAP_WORD_BITS - 1) + / BITMAP_WORD_BITS * BITMAP_WORD_BITS); + bi->word_no++; + + while (1) + { + /* Find the next nonzero word in this elt. */ + while (bi->word_no != BITMAP_ELEMENT_WORDS) + { + bi->bits = bi->elt1->bits[bi->word_no]; + if (bi->elt2 && bi->elt2->indx == bi->elt1->indx) + bi->bits &= ~bi->elt2->bits[bi->word_no]; + if (bi->bits) + goto next_bit; + *bit_no += BITMAP_WORD_BITS; + bi->word_no++; + } + + /* Make sure we didn't remove the element while iterating. */ + gcc_checking_assert (bi->elt1->indx != -1U); + + /* Advance to the next element of elt1. */ + bi->elt1 = bi->elt1->next; + if (!bi->elt1) + return false; + + /* Make sure we didn't remove the element while iterating. */ + gcc_checking_assert (! bi->elt2 || bi->elt2->indx != -1U); + + /* Advance elt2 until it is no less than elt1. */ + while (bi->elt2 && bi->elt2->indx < bi->elt1->indx) + bi->elt2 = bi->elt2->next; + + *bit_no = bi->elt1->indx * BITMAP_ELEMENT_ALL_BITS; + bi->word_no = 0; + } +} + +/* If you are modifying a bitmap you are currently iterating over you + have to ensure to + - never remove the current bit; + - if you set or clear a bit before the current bit this operation + will not affect the set of bits you are visiting during the iteration; + - if you set or clear a bit after the current bit it is unspecified + whether that affects the set of bits you are visiting during the + iteration. + If you want to remove the current bit you can delay this to the next + iteration (and after the iteration in case the last iteration is + affected). */ + +/* Loop over all bits set in BITMAP, starting with MIN and setting + BITNUM to the bit number. ITER is a bitmap iterator. BITNUM + should be treated as a read-only variable as it contains loop + state. */ + +#ifndef EXECUTE_IF_SET_IN_BITMAP +/* See sbitmap.h for the other definition of EXECUTE_IF_SET_IN_BITMAP. */ +#define EXECUTE_IF_SET_IN_BITMAP(BITMAP, MIN, BITNUM, ITER) \ + for (bmp_iter_set_init (&(ITER), (BITMAP), (MIN), &(BITNUM)); \ + bmp_iter_set (&(ITER), &(BITNUM)); \ + bmp_iter_next (&(ITER), &(BITNUM))) +#endif + +/* Loop over all the bits set in BITMAP1 & BITMAP2, starting with MIN + and setting BITNUM to the bit number. ITER is a bitmap iterator. + BITNUM should be treated as a read-only variable as it contains + loop state. */ + +#define EXECUTE_IF_AND_IN_BITMAP(BITMAP1, BITMAP2, MIN, BITNUM, ITER) \ + for (bmp_iter_and_init (&(ITER), (BITMAP1), (BITMAP2), (MIN), \ + &(BITNUM)); \ + bmp_iter_and (&(ITER), &(BITNUM)); \ + bmp_iter_next (&(ITER), &(BITNUM))) + +/* Loop over all the bits set in BITMAP1 & ~BITMAP2, starting with MIN + and setting BITNUM to the bit number. ITER is a bitmap iterator. + BITNUM should be treated as a read-only variable as it contains + loop state. */ + +#define EXECUTE_IF_AND_COMPL_IN_BITMAP(BITMAP1, BITMAP2, MIN, BITNUM, ITER) \ + for (bmp_iter_and_compl_init (&(ITER), (BITMAP1), (BITMAP2), (MIN), \ + &(BITNUM)); \ + bmp_iter_and_compl (&(ITER), &(BITNUM)); \ + bmp_iter_next (&(ITER), &(BITNUM))) + +/* A class that ties the lifetime of a bitmap to its scope. */ +class auto_bitmap +{ + public: + auto_bitmap () { bits = BITMAP_ALLOC (NULL); } + ~auto_bitmap () { BITMAP_FREE (bits); } + // Allow calling bitmap functions on our bitmap. + operator bitmap () { return bits; } + + private: + // Prevent making a copy that references our bitmap. + auto_bitmap (const auto_bitmap &); + auto_bitmap &operator = (const auto_bitmap &); +#if __cplusplus >= 201103L + auto_bitmap (auto_bitmap &&); + auto_bitmap &operator = (auto_bitmap &&); +#endif + + bitmap bits; +}; + +#endif /* GCC_BITMAP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/builtins.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/builtins.h new file mode 100644 index 0000000..f590f61 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/builtins.h @@ -0,0 +1,105 @@ +/* Expand builtin functions. + Copyright (C) 1988-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_BUILTINS_H +#define GCC_BUILTINS_H + +#include + +/* Target-dependent globals. */ +struct target_builtins { + /* For each register that may be used for calling a function, this + gives a mode used to copy the register's value. VOIDmode indicates + the register is not used for calling a function. If the machine + has register windows, this gives only the outbound registers. + INCOMING_REGNO gives the corresponding inbound register. */ + machine_mode x_apply_args_mode[FIRST_PSEUDO_REGISTER]; + + /* For each register that may be used for returning values, this gives + a mode used to copy the register's value. VOIDmode indicates the + register is not used for returning values. If the machine has + register windows, this gives only the outbound registers. + INCOMING_REGNO gives the corresponding inbound register. */ + machine_mode x_apply_result_mode[FIRST_PSEUDO_REGISTER]; +}; + +extern struct target_builtins default_target_builtins; +#if SWITCHABLE_TARGET +extern struct target_builtins *this_target_builtins; +#else +#define this_target_builtins (&default_target_builtins) +#endif + +/* Non-zero if __builtin_constant_p should be folded right away. */ +extern bool force_folding_builtin_constant_p; + +extern bool is_builtin_fn (tree); +extern bool called_as_built_in (tree); +extern bool get_object_alignment_1 (tree, unsigned int *, + unsigned HOST_WIDE_INT *); +extern unsigned int get_object_alignment (tree); +extern bool get_pointer_alignment_1 (tree, unsigned int *, + unsigned HOST_WIDE_INT *); +extern unsigned int get_pointer_alignment (tree); +extern tree c_strlen (tree, int); +extern void expand_builtin_setjmp_setup (rtx, rtx); +extern void expand_builtin_setjmp_receiver (rtx); +extern void expand_builtin_update_setjmp_buf (rtx); +extern tree mathfn_built_in (tree, enum built_in_function fn); +extern tree mathfn_built_in (tree, combined_fn); +extern rtx builtin_strncpy_read_str (void *, HOST_WIDE_INT, machine_mode); +extern rtx builtin_memset_read_str (void *, HOST_WIDE_INT, machine_mode); +extern rtx expand_builtin_saveregs (void); +extern tree std_build_builtin_va_list (void); +extern tree std_fn_abi_va_list (tree); +extern tree std_canonical_va_list_type (tree); +extern void std_expand_builtin_va_start (tree, rtx); +extern void expand_builtin_trap (void); +extern void expand_ifn_atomic_bit_test_and (gcall *); +extern void expand_ifn_atomic_compare_exchange (gcall *); +extern rtx expand_builtin (tree, rtx, rtx, machine_mode, int); +extern rtx expand_builtin_with_bounds (tree, rtx, rtx, machine_mode, int); +extern enum built_in_function builtin_mathfn_code (const_tree); +extern tree fold_builtin_expect (location_t, tree, tree, tree); +extern bool avoid_folding_inline_builtin (tree); +extern tree fold_call_expr (location_t, tree, bool); +extern tree fold_builtin_call_array (location_t, tree, tree, int, tree *); +extern tree fold_builtin_n (location_t, tree, tree *, int, bool); +extern bool validate_gimple_arglist (const gcall *, ...); +extern rtx default_expand_builtin (tree, rtx, rtx, machine_mode, int); +extern bool fold_builtin_next_arg (tree, bool); +extern tree do_mpc_arg2 (tree, tree, tree, int, int (*)(mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t)); +extern tree fold_call_stmt (gcall *, bool); +extern void set_builtin_user_assembler_name (tree decl, const char *asmspec); +extern bool is_simple_builtin (tree); +extern bool is_inexpensive_builtin (tree); + +extern bool readonly_data_expr (tree exp); +extern bool init_target_chars (void); +extern unsigned HOST_WIDE_INT target_newline; +extern unsigned HOST_WIDE_INT target_percent; +extern char target_percent_s[3]; +extern char target_percent_c[3]; +extern char target_percent_s_newline[4]; +extern bool target_char_cst_p (tree t, char *p); + +extern internal_fn associated_internal_fn (tree); +extern internal_fn replacement_internal_fn (gcall *); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/bversion.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/bversion.h new file mode 100644 index 0000000..be1cfa2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/bversion.h @@ -0,0 +1,4 @@ +#define BUILDING_GCC_MAJOR 7 +#define BUILDING_GCC_MINOR 3 +#define BUILDING_GCC_PATCHLEVEL 0 +#define BUILDING_GCC_VERSION (BUILDING_GCC_MAJOR * 1000 + BUILDING_GCC_MINOR) diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/c-family/c-common.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/c-family/c-common.h new file mode 100644 index 0000000..b933342 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/c-family/c-common.h @@ -0,0 +1,1566 @@ +/* Definitions for c-common.c. + Copyright (C) 1987-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_C_COMMON_H +#define GCC_C_COMMON_H + +#include "splay-tree.h" +#include "cpplib.h" +#include "alias.h" +#include "tree.h" +#include "fold-const.h" + +/* In order for the format checking to accept the C frontend + diagnostic framework extensions, you must include this file before + diagnostic-core.h, not after. The C front end formats are a subset of those + for C++, so they are the appropriate set to use in common code; + cp-tree.h overrides this for C++. */ +#if defined(GCC_DIAGNOSTIC_CORE_H) +#error \ +In order for the format checking to accept the C front end diagnostic \ +framework extensions, you must include this file before diagnostic-core.h \ +never after. +#endif +#ifndef GCC_DIAG_STYLE +#define GCC_DIAG_STYLE __gcc_cdiag__ +#endif +#include "diagnostic-core.h" + +/* Usage of TREE_LANG_FLAG_?: + 0: IDENTIFIER_MARKED (used by search routines). + C_MAYBE_CONST_EXPR_INT_OPERANDS (in C_MAYBE_CONST_EXPR, for C) + 1: C_DECLARED_LABEL_FLAG (in LABEL_DECL) + STATEMENT_LIST_STMT_EXPR (in STATEMENT_LIST) + C_MAYBE_CONST_EXPR_NON_CONST (in C_MAYBE_CONST_EXPR, for C) + 2: unused + 3: STATEMENT_LIST_HAS_LABEL (in STATEMENT_LIST) + 4: unused +*/ + +/* Reserved identifiers. This is the union of all the keywords for C, + C++, and Objective-C. All the type modifiers have to be in one + block at the beginning, because they are used as mask bits. There + are 28 type modifiers; if we add many more we will have to redesign + the mask mechanism. */ + +enum rid +{ + /* Modifiers: */ + /* C, in empirical order of frequency. */ + RID_STATIC = 0, + RID_UNSIGNED, RID_LONG, RID_CONST, RID_EXTERN, + RID_REGISTER, RID_TYPEDEF, RID_SHORT, RID_INLINE, + RID_VOLATILE, RID_SIGNED, RID_AUTO, RID_RESTRICT, + RID_NORETURN, RID_ATOMIC, + + /* C extensions */ + RID_COMPLEX, RID_THREAD, RID_SAT, + + /* C++ */ + RID_FRIEND, RID_VIRTUAL, RID_EXPLICIT, RID_EXPORT, RID_MUTABLE, + + /* ObjC ("PQ" reserved words - they do not appear after a '@' and + are keywords only in specific contexts) */ + RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF, RID_ONEWAY, + + /* ObjC ("PATTR" reserved words - they do not appear after a '@' + and are keywords only as property attributes) */ + RID_GETTER, RID_SETTER, + RID_READONLY, RID_READWRITE, + RID_ASSIGN, RID_RETAIN, RID_COPY, + RID_NONATOMIC, + + /* C (reserved and imaginary types not implemented, so any use is a + syntax error) */ + RID_IMAGINARY, + + /* C */ + RID_INT, RID_CHAR, RID_FLOAT, RID_DOUBLE, RID_VOID, + RID_ENUM, RID_STRUCT, RID_UNION, RID_IF, RID_ELSE, + RID_WHILE, RID_DO, RID_FOR, RID_SWITCH, RID_CASE, + RID_DEFAULT, RID_BREAK, RID_CONTINUE, RID_RETURN, RID_GOTO, + RID_SIZEOF, + + /* C extensions */ + RID_ASM, RID_TYPEOF, RID_ALIGNOF, RID_ATTRIBUTE, RID_VA_ARG, + RID_EXTENSION, RID_IMAGPART, RID_REALPART, RID_LABEL, RID_CHOOSE_EXPR, + RID_TYPES_COMPATIBLE_P, RID_BUILTIN_COMPLEX, RID_BUILTIN_SHUFFLE, + RID_DFLOAT32, RID_DFLOAT64, RID_DFLOAT128, + + /* TS 18661-3 keywords, in the same sequence as the TI_* values. */ + RID_FLOAT16, + RID_FLOATN_NX_FIRST = RID_FLOAT16, + RID_FLOAT32, + RID_FLOAT64, + RID_FLOAT128, + RID_FLOAT32X, + RID_FLOAT64X, + RID_FLOAT128X, +#define CASE_RID_FLOATN_NX \ + case RID_FLOAT16: case RID_FLOAT32: case RID_FLOAT64: case RID_FLOAT128: \ + case RID_FLOAT32X: case RID_FLOAT64X: case RID_FLOAT128X + + RID_FRACT, RID_ACCUM, RID_AUTO_TYPE, RID_BUILTIN_CALL_WITH_STATIC_CHAIN, + + /* "__GIMPLE", for the GIMPLE-parsing extension to the C frontend. */ + RID_GIMPLE, + + /* "__PHI", for parsing PHI function in GIMPLE FE. */ + RID_PHI, + + /* "__RTL", for the RTL-parsing extension to the C frontend. */ + RID_RTL, + + /* C11 */ + RID_ALIGNAS, RID_GENERIC, + + /* This means to warn that this is a C++ keyword, and then treat it + as a normal identifier. */ + RID_CXX_COMPAT_WARN, + + /* GNU transactional memory extension */ + RID_TRANSACTION_ATOMIC, RID_TRANSACTION_RELAXED, RID_TRANSACTION_CANCEL, + + /* Too many ways of getting the name of a function as a string */ + RID_FUNCTION_NAME, RID_PRETTY_FUNCTION_NAME, RID_C99_FUNCTION_NAME, + + /* C++ (some of these are keywords in Objective-C as well, but only + if they appear after a '@') */ + RID_BOOL, RID_WCHAR, RID_CLASS, + RID_PUBLIC, RID_PRIVATE, RID_PROTECTED, + RID_TEMPLATE, RID_NULL, RID_CATCH, + RID_DELETE, RID_FALSE, RID_NAMESPACE, + RID_NEW, RID_OFFSETOF, RID_OPERATOR, + RID_THIS, RID_THROW, RID_TRUE, + RID_TRY, RID_TYPENAME, RID_TYPEID, + RID_USING, RID_CHAR16, RID_CHAR32, + + /* casts */ + RID_CONSTCAST, RID_DYNCAST, RID_REINTCAST, RID_STATCAST, + + /* C++ extensions */ + RID_ADDRESSOF, RID_BASES, + RID_BUILTIN_LAUNDER, RID_DIRECT_BASES, + RID_HAS_NOTHROW_ASSIGN, RID_HAS_NOTHROW_CONSTRUCTOR, + RID_HAS_NOTHROW_COPY, RID_HAS_TRIVIAL_ASSIGN, + RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY, + RID_HAS_TRIVIAL_DESTRUCTOR, RID_HAS_UNIQUE_OBJ_REPRESENTATIONS, + RID_HAS_VIRTUAL_DESTRUCTOR, + RID_IS_ABSTRACT, RID_IS_AGGREGATE, + RID_IS_BASE_OF, RID_IS_CLASS, + RID_IS_EMPTY, RID_IS_ENUM, + RID_IS_FINAL, RID_IS_LITERAL_TYPE, + RID_IS_POD, RID_IS_POLYMORPHIC, + RID_IS_SAME_AS, + RID_IS_STD_LAYOUT, RID_IS_TRIVIAL, + RID_IS_TRIVIALLY_ASSIGNABLE, RID_IS_TRIVIALLY_CONSTRUCTIBLE, + RID_IS_TRIVIALLY_COPYABLE, + RID_IS_UNION, RID_UNDERLYING_TYPE, + + /* C++11 */ + RID_CONSTEXPR, RID_DECLTYPE, RID_NOEXCEPT, RID_NULLPTR, RID_STATIC_ASSERT, + + /* C++ concepts */ + RID_CONCEPT, RID_REQUIRES, + + /* C++ transactional memory. */ + RID_ATOMIC_NOEXCEPT, RID_ATOMIC_CANCEL, RID_SYNCHRONIZED, + + /* Cilk Plus keywords. */ + RID_CILK_SPAWN, RID_CILK_SYNC, RID_CILK_FOR, + + /* Objective-C ("AT" reserved words - they are only keywords when + they follow '@') */ + RID_AT_ENCODE, RID_AT_END, + RID_AT_CLASS, RID_AT_ALIAS, RID_AT_DEFS, + RID_AT_PRIVATE, RID_AT_PROTECTED, RID_AT_PUBLIC, RID_AT_PACKAGE, + RID_AT_PROTOCOL, RID_AT_SELECTOR, + RID_AT_THROW, RID_AT_TRY, RID_AT_CATCH, + RID_AT_FINALLY, RID_AT_SYNCHRONIZED, + RID_AT_OPTIONAL, RID_AT_REQUIRED, RID_AT_PROPERTY, + RID_AT_SYNTHESIZE, RID_AT_DYNAMIC, + RID_AT_INTERFACE, + RID_AT_IMPLEMENTATION, + + /* Named address support, mapping the keyword to a particular named address + number. Named address space 0 is reserved for the generic address. If + there are more than 254 named addresses, the addr_space_t type will need + to be grown from an unsigned char to unsigned short. */ + RID_ADDR_SPACE_0, /* generic address */ + RID_ADDR_SPACE_1, + RID_ADDR_SPACE_2, + RID_ADDR_SPACE_3, + RID_ADDR_SPACE_4, + RID_ADDR_SPACE_5, + RID_ADDR_SPACE_6, + RID_ADDR_SPACE_7, + RID_ADDR_SPACE_8, + RID_ADDR_SPACE_9, + RID_ADDR_SPACE_10, + RID_ADDR_SPACE_11, + RID_ADDR_SPACE_12, + RID_ADDR_SPACE_13, + RID_ADDR_SPACE_14, + RID_ADDR_SPACE_15, + + RID_FIRST_ADDR_SPACE = RID_ADDR_SPACE_0, + RID_LAST_ADDR_SPACE = RID_ADDR_SPACE_15, + + /* __intN keywords. The _N_M here doesn't correspond to the intN + in the keyword; use the bitsize in int_n_t_data_t[M] for that. + For example, if int_n_t_data_t[0].bitsize is 13, then RID_INT_N_0 + is for __int13. */ + + /* Note that the range to use is RID_FIRST_INT_N through + RID_FIRST_INT_N + NUM_INT_N_ENTS - 1 and c-parser.c has a list of + all RID_INT_N_* in a case statement. */ + + RID_INT_N_0, + RID_INT_N_1, + RID_INT_N_2, + RID_INT_N_3, + + RID_FIRST_INT_N = RID_INT_N_0, + RID_LAST_INT_N = RID_INT_N_3, + + RID_MAX, + + RID_FIRST_MODIFIER = RID_STATIC, + RID_LAST_MODIFIER = RID_ONEWAY, + + RID_FIRST_CXX11 = RID_CONSTEXPR, + RID_LAST_CXX11 = RID_STATIC_ASSERT, + RID_FIRST_AT = RID_AT_ENCODE, + RID_LAST_AT = RID_AT_IMPLEMENTATION, + RID_FIRST_PQ = RID_IN, + RID_LAST_PQ = RID_ONEWAY, + RID_FIRST_PATTR = RID_GETTER, + RID_LAST_PATTR = RID_NONATOMIC +}; + +#define OBJC_IS_AT_KEYWORD(rid) \ + ((unsigned int) (rid) >= (unsigned int) RID_FIRST_AT && \ + (unsigned int) (rid) <= (unsigned int) RID_LAST_AT) + +#define OBJC_IS_PQ_KEYWORD(rid) \ + ((unsigned int) (rid) >= (unsigned int) RID_FIRST_PQ && \ + (unsigned int) (rid) <= (unsigned int) RID_LAST_PQ) + +#define OBJC_IS_PATTR_KEYWORD(rid) \ + ((unsigned int) (rid) >= (unsigned int) RID_FIRST_PATTR && \ + (unsigned int) (rid) <= (unsigned int) RID_LAST_PATTR) + +/* OBJC_IS_CXX_KEYWORD recognizes the 'CXX_OBJC' keywords (such as + 'class') which are shared in a subtle way between Objective-C and + C++. When the lexer is lexing in Objective-C/Objective-C++, if it + finds '@' followed by one of these identifiers (eg, '@class'), it + recognizes the whole as an Objective-C keyword. If the identifier + is found elsewhere, it follows the rules of the C/C++ language. + */ +#define OBJC_IS_CXX_KEYWORD(rid) \ + (rid == RID_CLASS || rid == RID_SYNCHRONIZED \ + || rid == RID_PUBLIC || rid == RID_PROTECTED || rid == RID_PRIVATE \ + || rid == RID_TRY || rid == RID_THROW || rid == RID_CATCH) + +/* The elements of `ridpointers' are identifier nodes for the reserved + type names and storage classes. It is indexed by a RID_... value. */ +extern GTY ((length ("(int) RID_MAX"))) tree *ridpointers; + +/* Standard named or nameless data types of the C compiler. */ + +enum c_tree_index +{ + CTI_CHAR16_TYPE, + CTI_CHAR32_TYPE, + CTI_WCHAR_TYPE, + CTI_UNDERLYING_WCHAR_TYPE, + CTI_WINT_TYPE, + CTI_SIGNED_SIZE_TYPE, /* For format checking only. */ + CTI_UNSIGNED_PTRDIFF_TYPE, /* For format checking only. */ + CTI_INTMAX_TYPE, + CTI_UINTMAX_TYPE, + CTI_WIDEST_INT_LIT_TYPE, + CTI_WIDEST_UINT_LIT_TYPE, + + /* Types for , that may not be defined on all + targets. */ + CTI_SIG_ATOMIC_TYPE, + CTI_INT8_TYPE, + CTI_INT16_TYPE, + CTI_INT32_TYPE, + CTI_INT64_TYPE, + CTI_UINT8_TYPE, + CTI_UINT16_TYPE, + CTI_UINT32_TYPE, + CTI_UINT64_TYPE, + CTI_INT_LEAST8_TYPE, + CTI_INT_LEAST16_TYPE, + CTI_INT_LEAST32_TYPE, + CTI_INT_LEAST64_TYPE, + CTI_UINT_LEAST8_TYPE, + CTI_UINT_LEAST16_TYPE, + CTI_UINT_LEAST32_TYPE, + CTI_UINT_LEAST64_TYPE, + CTI_INT_FAST8_TYPE, + CTI_INT_FAST16_TYPE, + CTI_INT_FAST32_TYPE, + CTI_INT_FAST64_TYPE, + CTI_UINT_FAST8_TYPE, + CTI_UINT_FAST16_TYPE, + CTI_UINT_FAST32_TYPE, + CTI_UINT_FAST64_TYPE, + CTI_INTPTR_TYPE, + CTI_UINTPTR_TYPE, + + CTI_CHAR_ARRAY_TYPE, + CTI_CHAR16_ARRAY_TYPE, + CTI_CHAR32_ARRAY_TYPE, + CTI_WCHAR_ARRAY_TYPE, + CTI_STRING_TYPE, + CTI_CONST_STRING_TYPE, + + /* Type for boolean expressions (bool in C++, int in C). */ + CTI_TRUTHVALUE_TYPE, + CTI_TRUTHVALUE_TRUE, + CTI_TRUTHVALUE_FALSE, + + CTI_DEFAULT_FUNCTION_TYPE, + + /* These are not types, but we have to look them up all the time. */ + CTI_FUNCTION_NAME_DECL, + CTI_PRETTY_FUNCTION_NAME_DECL, + CTI_C99_FUNCTION_NAME_DECL, + CTI_SAVED_FUNCTION_NAME_DECLS, + + CTI_NULL, + + CTI_MAX +}; + +#define C_CPP_HASHNODE(id) \ + (&(((struct c_common_identifier *) (id))->node)) +#define C_RID_CODE(id) \ + ((enum rid) (((struct c_common_identifier *) (id))->node.rid_code)) +#define C_SET_RID_CODE(id, code) \ + (((struct c_common_identifier *) (id))->node.rid_code = (unsigned char) code) + +/* Identifier part common to the C front ends. Inherits from + tree_identifier, despite appearances. */ +struct GTY(()) c_common_identifier { + struct tree_common common; + struct cpp_hashnode node; +}; + +/* An entry in the reserved keyword table. */ + +struct c_common_resword +{ + const char *const word; + ENUM_BITFIELD(rid) const rid : 16; + const unsigned int disable : 16; +}; + +/* Mode used to build pointers (VOIDmode means ptr_mode). */ + +extern machine_mode c_default_pointer_mode; + +/* Extra cpp_ttype values for C++. */ + +/* A token type for template-ids. If a template-id is processed while + parsing tentatively, it is replaced with a CPP_TEMPLATE_ID token; + the value of the CPP_TEMPLATE_ID is whatever was returned by + cp_parser_template_id. */ +#define CPP_TEMPLATE_ID ((enum cpp_ttype) (CPP_KEYWORD + 1)) + +/* A token type for nested-name-specifiers. If a + nested-name-specifier is processed while parsing tentatively, it is + replaced with a CPP_NESTED_NAME_SPECIFIER token; the value of the + CPP_NESTED_NAME_SPECIFIER is whatever was returned by + cp_parser_nested_name_specifier_opt. */ +#define CPP_NESTED_NAME_SPECIFIER ((enum cpp_ttype) (CPP_TEMPLATE_ID + 1)) + +/* A token type for pre-parsed C++0x decltype. */ +#define CPP_DECLTYPE ((enum cpp_ttype) (CPP_NESTED_NAME_SPECIFIER + 1)) + +/* A token type for pre-parsed primary-expression (lambda- or statement-). */ +#define CPP_PREPARSED_EXPR ((enum cpp_ttype) (CPP_DECLTYPE + 1)) + +/* The number of token types, including C++-specific ones. */ +#define N_CP_TTYPES ((int) (CPP_PREPARSED_EXPR + 1)) + +/* Disable mask. Keywords are disabled if (reswords[i].disable & + mask) is _true_. Thus for keywords which are present in all + languages the disable field is zero. */ + +#define D_CONLY 0x001 /* C only (not in C++). */ +#define D_CXXONLY 0x002 /* C++ only (not in C). */ +#define D_C99 0x004 /* In C, C99 only. */ +#define D_CXX11 0x008 /* In C++, C++11 only. */ +#define D_EXT 0x010 /* GCC extension. */ +#define D_EXT89 0x020 /* GCC extension incorporated in C99. */ +#define D_ASM 0x040 /* Disabled by -fno-asm. */ +#define D_OBJC 0x080 /* In Objective C and neither C nor C++. */ +#define D_CXX_OBJC 0x100 /* In Objective C, and C++, but not C. */ +#define D_CXXWARN 0x200 /* In C warn with -Wcxx-compat. */ +#define D_CXX_CONCEPTS 0x400 /* In C++, only with concepts. */ +#define D_TRANSMEM 0X800 /* C++ transactional memory TS. */ + +#define D_CXX_CONCEPTS_FLAGS D_CXXONLY | D_CXX_CONCEPTS + +/* The reserved keyword table. */ +extern const struct c_common_resword c_common_reswords[]; + +/* The number of items in the reserved keyword table. */ +extern const unsigned int num_c_common_reswords; + +#define char16_type_node c_global_trees[CTI_CHAR16_TYPE] +#define char32_type_node c_global_trees[CTI_CHAR32_TYPE] +#define wchar_type_node c_global_trees[CTI_WCHAR_TYPE] +#define underlying_wchar_type_node c_global_trees[CTI_UNDERLYING_WCHAR_TYPE] +#define wint_type_node c_global_trees[CTI_WINT_TYPE] +#define signed_size_type_node c_global_trees[CTI_SIGNED_SIZE_TYPE] +#define unsigned_ptrdiff_type_node c_global_trees[CTI_UNSIGNED_PTRDIFF_TYPE] +#define intmax_type_node c_global_trees[CTI_INTMAX_TYPE] +#define uintmax_type_node c_global_trees[CTI_UINTMAX_TYPE] +#define widest_integer_literal_type_node c_global_trees[CTI_WIDEST_INT_LIT_TYPE] +#define widest_unsigned_literal_type_node c_global_trees[CTI_WIDEST_UINT_LIT_TYPE] + +#define sig_atomic_type_node c_global_trees[CTI_SIG_ATOMIC_TYPE] +#define int8_type_node c_global_trees[CTI_INT8_TYPE] +#define int16_type_node c_global_trees[CTI_INT16_TYPE] +#define int32_type_node c_global_trees[CTI_INT32_TYPE] +#define int64_type_node c_global_trees[CTI_INT64_TYPE] +#define uint8_type_node c_global_trees[CTI_UINT8_TYPE] +#define c_uint16_type_node c_global_trees[CTI_UINT16_TYPE] +#define c_uint32_type_node c_global_trees[CTI_UINT32_TYPE] +#define c_uint64_type_node c_global_trees[CTI_UINT64_TYPE] +#define int_least8_type_node c_global_trees[CTI_INT_LEAST8_TYPE] +#define int_least16_type_node c_global_trees[CTI_INT_LEAST16_TYPE] +#define int_least32_type_node c_global_trees[CTI_INT_LEAST32_TYPE] +#define int_least64_type_node c_global_trees[CTI_INT_LEAST64_TYPE] +#define uint_least8_type_node c_global_trees[CTI_UINT_LEAST8_TYPE] +#define uint_least16_type_node c_global_trees[CTI_UINT_LEAST16_TYPE] +#define uint_least32_type_node c_global_trees[CTI_UINT_LEAST32_TYPE] +#define uint_least64_type_node c_global_trees[CTI_UINT_LEAST64_TYPE] +#define int_fast8_type_node c_global_trees[CTI_INT_FAST8_TYPE] +#define int_fast16_type_node c_global_trees[CTI_INT_FAST16_TYPE] +#define int_fast32_type_node c_global_trees[CTI_INT_FAST32_TYPE] +#define int_fast64_type_node c_global_trees[CTI_INT_FAST64_TYPE] +#define uint_fast8_type_node c_global_trees[CTI_UINT_FAST8_TYPE] +#define uint_fast16_type_node c_global_trees[CTI_UINT_FAST16_TYPE] +#define uint_fast32_type_node c_global_trees[CTI_UINT_FAST32_TYPE] +#define uint_fast64_type_node c_global_trees[CTI_UINT_FAST64_TYPE] +#define intptr_type_node c_global_trees[CTI_INTPTR_TYPE] +#define uintptr_type_node c_global_trees[CTI_UINTPTR_TYPE] + +#define truthvalue_type_node c_global_trees[CTI_TRUTHVALUE_TYPE] +#define truthvalue_true_node c_global_trees[CTI_TRUTHVALUE_TRUE] +#define truthvalue_false_node c_global_trees[CTI_TRUTHVALUE_FALSE] + +#define char_array_type_node c_global_trees[CTI_CHAR_ARRAY_TYPE] +#define char16_array_type_node c_global_trees[CTI_CHAR16_ARRAY_TYPE] +#define char32_array_type_node c_global_trees[CTI_CHAR32_ARRAY_TYPE] +#define wchar_array_type_node c_global_trees[CTI_WCHAR_ARRAY_TYPE] +#define string_type_node c_global_trees[CTI_STRING_TYPE] +#define const_string_type_node c_global_trees[CTI_CONST_STRING_TYPE] + +#define default_function_type c_global_trees[CTI_DEFAULT_FUNCTION_TYPE] + +#define function_name_decl_node c_global_trees[CTI_FUNCTION_NAME_DECL] +#define pretty_function_name_decl_node c_global_trees[CTI_PRETTY_FUNCTION_NAME_DECL] +#define c99_function_name_decl_node c_global_trees[CTI_C99_FUNCTION_NAME_DECL] +#define saved_function_name_decls c_global_trees[CTI_SAVED_FUNCTION_NAME_DECLS] + +/* The node for C++ `__null'. */ +#define null_node c_global_trees[CTI_NULL] + +extern GTY(()) tree c_global_trees[CTI_MAX]; + +/* In a RECORD_TYPE, a sorted array of the fields of the type, not a + tree for size reasons. */ +struct GTY(()) sorted_fields_type { + int len; + tree GTY((length ("%h.len"))) elts[1]; +}; + +/* Mark which labels are explicitly declared. + These may be shadowed, and may be referenced from nested functions. */ +#define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label) + +enum c_language_kind +{ + clk_c = 0, /* C90, C94, C99 or C11 */ + clk_objc = 1, /* clk_c with ObjC features. */ + clk_cxx = 2, /* ANSI/ISO C++ */ + clk_objcxx = 3 /* clk_cxx with ObjC features. */ +}; + +/* To test for a specific language use c_language, defined by each + front end. For "ObjC features" or "not C++" use the macros. */ +extern c_language_kind c_language; + +#define c_dialect_cxx() ((c_language & clk_cxx) != 0) +#define c_dialect_objc() ((c_language & clk_objc) != 0) + +/* The various name of operator that appears in error messages. */ +enum ref_operator { + /* NULL */ + RO_NULL, + /* array indexing */ + RO_ARRAY_INDEXING, + /* unary * */ + RO_UNARY_STAR, + /* -> */ + RO_ARROW, + /* implicit conversion */ + RO_IMPLICIT_CONVERSION, + /* ->* */ + RO_ARROW_STAR +}; + +/* Information about a statement tree. */ + +struct GTY(()) stmt_tree_s { + /* A stack of statement lists being collected. */ + vec *x_cur_stmt_list; + + /* In C++, Nonzero if we should treat statements as full + expressions. In particular, this variable is non-zero if at the + end of a statement we should destroy any temporaries created + during that statement. Similarly, if, at the end of a block, we + should destroy any local variables in this block. Normally, this + variable is nonzero, since those are the normal semantics of + C++. + + This flag has no effect in C. */ + int stmts_are_full_exprs_p; +}; + +typedef struct stmt_tree_s *stmt_tree; + +/* Global state pertinent to the current function. Some C dialects + extend this structure with additional fields. */ + +struct GTY(()) c_language_function { + /* While we are parsing the function, this contains information + about the statement-tree that we are building. */ + struct stmt_tree_s x_stmt_tree; + + /* Vector of locally defined typedefs, for + -Wunused-local-typedefs. */ + vec *local_typedefs; +}; + +#define stmt_list_stack (current_stmt_tree ()->x_cur_stmt_list) + +/* When building a statement-tree, this is the current statement list + being collected. */ +#define cur_stmt_list (stmt_list_stack->last ()) + +#define building_stmt_list_p() (stmt_list_stack && !stmt_list_stack->is_empty()) + +/* Language-specific hooks. */ + +/* If non-NULL, this function is called after a precompile header file + is loaded. */ +extern void (*lang_post_pch_load) (void); + +extern void push_file_scope (void); +extern void pop_file_scope (void); +extern stmt_tree current_stmt_tree (void); +extern tree push_stmt_list (void); +extern tree pop_stmt_list (tree); +extern tree add_stmt (tree); +extern void push_cleanup (tree, tree, bool); +extern tree pushdecl_top_level (tree); +extern tree pushdecl (tree); +extern tree build_modify_expr (location_t, tree, tree, enum tree_code, + location_t, tree, tree); +extern tree build_array_notation_expr (location_t, tree, tree, enum tree_code, + location_t, tree, tree); +extern tree build_array_notation_ref (location_t, tree, tree, tree, tree, tree); +extern tree build_indirect_ref (location_t, tree, ref_operator); + +extern int field_decl_cmp (const void *, const void *); +extern void resort_sorted_fields (void *, void *, gt_pointer_operator, + void *); +extern bool has_c_linkage (const_tree decl); +extern bool c_decl_implicit (const_tree); + +/* Switches common to the C front ends. */ + +/* Nonzero means don't output line number information. */ + +extern char flag_no_line_commands; + +/* Nonzero causes -E output not to be done, but directives such as + #define that have side effects are still obeyed. */ + +extern char flag_no_output; + +/* Nonzero means dump macros in some fashion; contains the 'D', 'M', + 'N' or 'U' of the command line switch. */ + +extern char flag_dump_macros; + +/* Nonzero means pass #include lines through to the output. */ + +extern char flag_dump_includes; + +/* Nonzero means process PCH files while preprocessing. */ + +extern bool flag_pch_preprocess; + +/* The file name to which we should write a precompiled header, or + NULL if no header will be written in this compile. */ + +extern const char *pch_file; + +/* Nonzero if an ISO standard was selected. It rejects macros in the + user's namespace. */ + +extern int flag_iso; + +/* C/ObjC language option variables. */ + + +/* Nonzero means allow type mismatches in conditional expressions; + just make their values `void'. */ + +extern int flag_cond_mismatch; + +/* Nonzero means enable C89 Amendment 1 features. */ + +extern int flag_isoc94; + +/* Nonzero means use the ISO C99 (or C11) dialect of C. */ + +extern int flag_isoc99; + +/* Nonzero means use the ISO C11 dialect of C. */ + +extern int flag_isoc11; + +/* Nonzero means that we have builtin functions, and main is an int. */ + +extern int flag_hosted; + +/* ObjC language option variables. */ + + +/* Tells the compiler that this is a special run. Do not perform any + compiling, instead we are to test some platform dependent features + and output a C header file with appropriate definitions. */ + +extern int print_struct_values; + +/* Tells the compiler what is the constant string class for ObjC. */ + +extern const char *constant_string_class_name; + + +/* C++ language option variables. */ + +/* The reference version of the ABI for -Wabi. */ + +extern int warn_abi_version; + +/* Return TRUE if one of {flag_abi_version,flag_abi_compat_version} is + less than N and the other is at least N. */ +#define abi_compat_version_crosses(N) \ + (abi_version_at_least(N) \ + != (flag_abi_compat_version == 0 \ + || flag_abi_compat_version >= (N))) + +/* Return TRUE if one of {flag_abi_version,warn_abi_version} is + less than N and the other is at least N, for use by -Wabi. */ +#define abi_version_crosses(N) \ + (abi_version_at_least(N) \ + != (warn_abi_version == 0 \ + || warn_abi_version >= (N))) + +/* Nonzero means generate separate instantiation control files and + juggle them at link time. */ + +extern int flag_use_repository; + +/* The supported C++ dialects. */ + +enum cxx_dialect { + cxx_unset, + /* C++98 with TC1 */ + cxx98, + cxx03 = cxx98, + /* C++11 */ + cxx0x, + cxx11 = cxx0x, + /* C++14 */ + cxx14, + /* C++1z (C++17?) */ + cxx1z +}; + +/* The C++ dialect being used. C++98 is the default. */ +extern enum cxx_dialect cxx_dialect; + +/* Maximum template instantiation depth. This limit is rather + arbitrary, but it exists to limit the time it takes to notice + excessively recursive template instantiations. */ + +extern int max_tinst_depth; + +/* Nonzero means that we should not issue warnings about problems that + occur when the code is executed, because the code being processed + is not expected to be executed. This is set during parsing. This + is used for cases like sizeof() and "0 ? a : b". This is a count, + not a bool, because unexecuted expressions can nest. */ + +extern int c_inhibit_evaluation_warnings; + +/* Whether lexing has been completed, so subsequent preprocessor + errors should use the compiler's input_location. */ + +extern bool done_lexing; + +/* C types are partitioned into three subsets: object, function, and + incomplete types. */ +#define C_TYPE_OBJECT_P(type) \ + (TREE_CODE (type) != FUNCTION_TYPE && TYPE_SIZE (type)) + +#define C_TYPE_INCOMPLETE_P(type) \ + (TREE_CODE (type) != FUNCTION_TYPE && TYPE_SIZE (type) == 0) + +#define C_TYPE_FUNCTION_P(type) \ + (TREE_CODE (type) == FUNCTION_TYPE) + +/* For convenience we define a single macro to identify the class of + object or incomplete types. */ +#define C_TYPE_OBJECT_OR_INCOMPLETE_P(type) \ + (!C_TYPE_FUNCTION_P (type)) + +struct visibility_flags +{ + unsigned inpragma : 1; /* True when in #pragma GCC visibility. */ + unsigned inlines_hidden : 1; /* True when -finlineshidden in effect. */ +}; + +/* These enumerators are possible types of unsafe conversions. */ +enum conversion_safety { + /* The conversion is safe. */ + SAFE_CONVERSION = 0, + /* Another type of conversion with problems. */ + UNSAFE_OTHER, + /* Conversion between signed and unsigned integers + which are all warned about immediately, so this is unused. */ + UNSAFE_SIGN, + /* Conversions that reduce the precision of reals including conversions + from reals to integers. */ + UNSAFE_REAL, + /* Conversions from complex to reals or integers, that discard imaginary + component. */ + UNSAFE_IMAGINARY +}; + +/* Global visibility options. */ +extern struct visibility_flags visibility_options; + +/* Attribute table common to the C front ends. */ +extern const struct attribute_spec c_common_attribute_table[]; +extern const struct attribute_spec c_common_format_attribute_table[]; + +/* Pointer to function to lazily generate the VAR_DECL for __FUNCTION__ etc. + ID is the identifier to use, NAME is the string. + TYPE_DEP indicates whether it depends on type of the function or not + (i.e. __PRETTY_FUNCTION__). */ + +extern tree (*make_fname_decl) (location_t, tree, int); + +/* In c-decl.c and cp/tree.c. FIXME. */ +extern void c_register_addr_space (const char *str, addr_space_t as); + +/* In c-common.c. */ +extern bool in_late_binary_op; +extern const char *c_addr_space_name (addr_space_t as); +extern tree identifier_global_value (tree); +extern tree c_linkage_bindings (tree); +extern void record_builtin_type (enum rid, const char *, tree); +extern tree build_void_list_node (void); +extern void start_fname_decls (void); +extern void finish_fname_decls (void); +extern const char *fname_as_string (int); +extern tree fname_decl (location_t, unsigned, tree); + +extern int check_user_alignment (const_tree, bool); +extern bool check_function_arguments (location_t loc, const_tree, const_tree, + int, tree *); +extern void check_function_arguments_recurse (void (*) + (void *, tree, + unsigned HOST_WIDE_INT), + void *, tree, + unsigned HOST_WIDE_INT); +extern bool check_builtin_function_arguments (location_t, vec, + tree, int, tree *); +extern void check_function_format (tree, int, tree *); +extern bool attribute_fallthrough_p (tree); +extern tree handle_format_attribute (tree *, tree, tree, int, bool *); +extern tree handle_format_arg_attribute (tree *, tree, tree, int, bool *); +extern bool c_common_handle_option (size_t, const char *, int, int, location_t, + const struct cl_option_handlers *); +extern bool default_handle_c_option (size_t, const char *, int); +extern tree c_common_type_for_mode (machine_mode, int); +extern tree c_common_type_for_size (unsigned int, int); +extern tree c_common_fixed_point_type_for_size (unsigned int, unsigned int, + int, int); +extern tree c_common_unsigned_type (tree); +extern tree c_common_signed_type (tree); +extern tree c_common_signed_or_unsigned_type (int, tree); +extern void c_common_init_ts (void); +extern tree c_build_bitfield_integer_type (unsigned HOST_WIDE_INT, int); +extern enum conversion_safety unsafe_conversion_p (location_t, tree, tree, + bool); +extern bool decl_with_nonnull_addr_p (const_tree); +extern tree c_fully_fold (tree, bool, bool *); +extern tree c_wrap_maybe_const (tree, bool); +extern tree c_save_expr (tree); +extern tree c_common_truthvalue_conversion (location_t, tree); +extern void c_apply_type_quals_to_decl (int, tree); +extern tree c_sizeof_or_alignof_type (location_t, tree, bool, bool, int); +extern tree c_alignof_expr (location_t, tree); +/* Print an error message for invalid operands to arith operation CODE. + NOP_EXPR is used as a special case (see truthvalue_conversion). */ +extern void binary_op_error (rich_location *, enum tree_code, tree, tree); +extern tree fix_string_type (tree); +extern tree convert_and_check (location_t, tree, tree); +extern bool c_determine_visibility (tree); +extern bool vector_types_compatible_elements_p (tree, tree); +extern void mark_valid_location_for_stdc_pragma (bool); +extern bool valid_location_for_stdc_pragma_p (void); +extern void set_float_const_decimal64 (void); +extern void clear_float_const_decimal64 (void); +extern bool float_const_decimal64_p (void); + +extern bool keyword_begins_type_specifier (enum rid); +extern bool keyword_is_storage_class_specifier (enum rid); +extern bool keyword_is_type_qualifier (enum rid); +extern bool keyword_is_decl_specifier (enum rid); +extern unsigned max_align_t_align (void); +extern bool cxx_fundamental_alignment_p (unsigned); +extern bool pointer_to_zero_sized_aggr_p (tree); +extern bool bool_promoted_to_int_p (tree); +extern tree fold_for_warn (tree); +extern tree c_common_get_narrower (tree, int *); +extern bool get_nonnull_operand (tree, unsigned HOST_WIDE_INT *); + +#define c_sizeof(LOC, T) c_sizeof_or_alignof_type (LOC, T, true, false, 1) +#define c_alignof(LOC, T) c_sizeof_or_alignof_type (LOC, T, false, false, 1) + +/* Subroutine of build_binary_op, used for certain operations. */ +extern tree shorten_binary_op (tree result_type, tree op0, tree op1, bool bitwise); + +/* Subroutine of build_binary_op, used for comparison operations. + See if the operands have both been converted from subword integer types + and, if so, perhaps change them both back to their original type. */ +extern tree shorten_compare (location_t, tree *, tree *, tree *, + enum tree_code *); + +extern tree pointer_int_sum (location_t, enum tree_code, tree, tree, + bool = true); + +/* Add qualifiers to a type, in the fashion for C. */ +extern tree c_build_qualified_type (tree, int, tree = NULL_TREE, size_t = 0); + +/* Build tree nodes and builtin functions common to both C and C++ language + frontends. */ +extern void c_common_nodes_and_builtins (void); + +extern void disable_builtin_function (const char *); + +extern void set_compound_literal_name (tree decl); + +extern tree build_va_arg (location_t, tree, tree); + +extern const unsigned int c_family_lang_mask; +extern unsigned int c_common_option_lang_mask (void); +extern void c_common_diagnostics_set_defaults (diagnostic_context *); +extern bool c_common_complain_wrong_lang_p (const struct cl_option *); +extern void c_common_init_options_struct (struct gcc_options *); +extern void c_common_init_options (unsigned int, struct cl_decoded_option *); +extern bool c_common_post_options (const char **); +extern bool c_common_init (void); +extern void c_common_finish (void); +extern void c_common_parse_file (void); +extern FILE *get_dump_info (int, int *); +extern alias_set_type c_common_get_alias_set (tree); +extern void c_register_builtin_type (tree, const char*); +extern bool c_promoting_integer_type_p (const_tree); +extern int self_promoting_args_p (const_tree); +extern tree strip_pointer_operator (tree); +extern tree strip_pointer_or_array_types (tree); +extern HOST_WIDE_INT c_common_to_target_charset (HOST_WIDE_INT); + +/* This is the basic parsing function. */ +extern void c_parse_file (void); + +extern void c_parse_final_cleanups (void); + +/* These macros provide convenient access to the various _STMT nodes. */ + +/* Nonzero if a given STATEMENT_LIST represents the outermost binding + if a statement expression. */ +#define STATEMENT_LIST_STMT_EXPR(NODE) \ + TREE_LANG_FLAG_1 (STATEMENT_LIST_CHECK (NODE)) + +/* Nonzero if a label has been added to the statement list. */ +#define STATEMENT_LIST_HAS_LABEL(NODE) \ + TREE_LANG_FLAG_3 (STATEMENT_LIST_CHECK (NODE)) + +/* C_MAYBE_CONST_EXPR accessors. */ +#define C_MAYBE_CONST_EXPR_PRE(NODE) \ + TREE_OPERAND (C_MAYBE_CONST_EXPR_CHECK (NODE), 0) +#define C_MAYBE_CONST_EXPR_EXPR(NODE) \ + TREE_OPERAND (C_MAYBE_CONST_EXPR_CHECK (NODE), 1) +#define C_MAYBE_CONST_EXPR_INT_OPERANDS(NODE) \ + TREE_LANG_FLAG_0 (C_MAYBE_CONST_EXPR_CHECK (NODE)) +#define C_MAYBE_CONST_EXPR_NON_CONST(NODE) \ + TREE_LANG_FLAG_1 (C_MAYBE_CONST_EXPR_CHECK (NODE)) +#define EXPR_INT_CONST_OPERANDS(EXPR) \ + (INTEGRAL_TYPE_P (TREE_TYPE (EXPR)) \ + && (TREE_CODE (EXPR) == INTEGER_CST \ + || (TREE_CODE (EXPR) == C_MAYBE_CONST_EXPR \ + && C_MAYBE_CONST_EXPR_INT_OPERANDS (EXPR)))) + +/* In a FIELD_DECL, nonzero if the decl was originally a bitfield. */ +#define DECL_C_BIT_FIELD(NODE) \ + (DECL_LANG_FLAG_4 (FIELD_DECL_CHECK (NODE)) == 1) +#define SET_DECL_C_BIT_FIELD(NODE) \ + (DECL_LANG_FLAG_4 (FIELD_DECL_CHECK (NODE)) = 1) +#define CLEAR_DECL_C_BIT_FIELD(NODE) \ + (DECL_LANG_FLAG_4 (FIELD_DECL_CHECK (NODE)) = 0) + +extern tree do_case (location_t, tree, tree); +extern tree build_stmt (location_t, enum tree_code, ...); +extern tree build_real_imag_expr (location_t, enum tree_code, tree); + +/* These functions must be defined by each front-end which implements + a variant of the C language. They are used in c-common.c. */ + +extern tree build_unary_op (location_t, enum tree_code, tree, bool); +extern tree build_binary_op (location_t, enum tree_code, tree, tree, int); +extern tree perform_integral_promotions (tree); + +/* These functions must be defined by each front-end which implements + a variant of the C language. They are used by port files. */ + +extern tree default_conversion (tree); + +/* Given two integer or real types, return the type for their sum. + Given two compatible ANSI C types, returns the merged type. */ + +extern tree common_type (tree, tree); + +extern tree decl_constant_value (tree); + +/* Handle increment and decrement of boolean types. */ +extern tree boolean_increment (enum tree_code, tree); + +extern int case_compare (splay_tree_key, splay_tree_key); + +extern tree c_add_case_label (location_t, splay_tree, tree, tree, tree, tree, + bool *); + +extern tree build_function_call (location_t, tree, tree); + +extern tree build_function_call_vec (location_t, vec, tree, + vec *, vec *); + +extern tree resolve_overloaded_builtin (location_t, tree, vec *); + +extern tree finish_label_address_expr (tree, location_t); + +/* Same function prototype, but the C and C++ front ends have + different implementations. Used in c-common.c. */ +extern tree lookup_label (tree); +extern tree lookup_name (tree); +extern bool lvalue_p (const_tree); + +enum lookup_name_fuzzy_kind { + /* Names of types. */ + FUZZY_LOOKUP_TYPENAME, + + /* Names of function decls. */ + FUZZY_LOOKUP_FUNCTION_NAME, + + /* Any name. */ + FUZZY_LOOKUP_NAME +}; +extern const char *lookup_name_fuzzy (tree, enum lookup_name_fuzzy_kind); + +extern bool vector_targets_convertible_p (const_tree t1, const_tree t2); +extern bool vector_types_convertible_p (const_tree t1, const_tree t2, bool emit_lax_note); +extern tree c_build_vec_perm_expr (location_t, tree, tree, tree, bool = true); + +extern void init_c_lex (void); + +extern void c_cpp_builtins (cpp_reader *); +extern void c_cpp_builtins_optimize_pragma (cpp_reader *, tree, tree); +extern bool c_cpp_error (cpp_reader *, int, int, rich_location *, + const char *, va_list *) + ATTRIBUTE_GCC_DIAG(5,0); +extern int c_common_has_attribute (cpp_reader *); + +extern bool parse_optimize_options (tree, bool); + +/* Positive if an implicit `extern "C"' scope has just been entered; + negative if such a scope has just been exited. */ +extern GTY(()) int pending_lang_change; + +/* Information recorded about each file examined during compilation. */ + +struct c_fileinfo +{ + int time; /* Time spent in the file. */ + + /* Flags used only by C++. + INTERFACE_ONLY nonzero means that we are in an "interface" section + of the compiler. INTERFACE_UNKNOWN nonzero means we cannot trust + the value of INTERFACE_ONLY. If INTERFACE_UNKNOWN is zero and + INTERFACE_ONLY is zero, it means that we are responsible for + exporting definitions that others might need. */ + short interface_only; + short interface_unknown; +}; + +struct c_fileinfo *get_fileinfo (const char *); +extern void dump_time_statistics (void); + +extern bool c_dump_tree (void *, tree); + +extern void verify_sequence_points (tree); + +extern tree fold_offsetof_1 (tree, tree_code ctx = ERROR_MARK); +extern tree fold_offsetof (tree); + +extern int complete_array_type (tree *, tree, bool); + +extern tree builtin_type_for_size (int, bool); + +extern void c_common_mark_addressable_vec (tree); + +extern void set_underlying_type (tree); +extern void record_types_used_by_current_var_decl (tree); +extern vec *make_tree_vector (void); +extern void release_tree_vector (vec *); +extern vec *make_tree_vector_single (tree); +extern vec *make_tree_vector_from_list (tree); +extern vec *make_tree_vector_from_ctor (tree); +extern vec *make_tree_vector_copy (const vec *); + +/* Used for communication between c_common_type_for_mode and + c_register_builtin_type. */ +extern GTY(()) tree registered_builtin_types; + +/* Read SOURCE_DATE_EPOCH from environment to have a deterministic + timestamp to replace embedded current dates to get reproducible + results. Returns -1 if SOURCE_DATE_EPOCH is not defined. */ +extern time_t cb_get_source_date_epoch (cpp_reader *pfile); + +/* The value (as a unix timestamp) corresponds to date + "Dec 31 9999 23:59:59 UTC", which is the latest date that __DATE__ and + __TIME__ can store. */ +#define MAX_SOURCE_DATE_EPOCH HOST_WIDE_INT_C (253402300799) + +/* Callback for libcpp for offering spelling suggestions for misspelled + directives. */ +extern const char *cb_get_suggestion (cpp_reader *, const char *, + const char *const *); + +extern GTY(()) string_concat_db *g_string_concat_db; + +class substring_loc; +extern const char *c_get_substring_location (const substring_loc &substr_loc, + location_t *out_loc); + +/* In c-gimplify.c */ +extern void c_genericize (tree); +extern int c_gimplify_expr (tree *, gimple_seq *, gimple_seq *); +extern tree c_build_bind_expr (location_t, tree, tree); + +/* In c-lex.c. */ +extern enum cpp_ttype +conflict_marker_get_final_tok_kind (enum cpp_ttype tok1_kind); + +/* In c-pch.c */ +extern void pch_init (void); +extern void pch_cpp_save_state (void); +extern int c_common_valid_pch (cpp_reader *pfile, const char *name, int fd); +extern void c_common_read_pch (cpp_reader *pfile, const char *name, int fd, + const char *orig); +extern void c_common_write_pch (void); +extern void c_common_no_more_pch (void); +extern void c_common_pch_pragma (cpp_reader *pfile, const char *); + +/* In *-checksum.c */ +extern const unsigned char executable_checksum[16]; + +/* In c-cppbuiltin.c */ +extern void builtin_define_std (const char *macro); +extern void builtin_define_with_value (const char *, const char *, int); +extern void builtin_define_with_int_value (const char *, HOST_WIDE_INT); +extern void builtin_define_type_sizeof (const char *, tree); +extern void c_stddef_cpp_builtins (void); +extern void fe_file_change (const line_map_ordinary *); +extern void c_parse_error (const char *, enum cpp_ttype, tree, unsigned char); + +/* In c-ppoutput.c */ +extern void init_pp_output (FILE *); +extern void preprocess_file (cpp_reader *); +extern void pp_file_change (const line_map_ordinary *); +extern void pp_dir_change (cpp_reader *, const char *); +extern bool check_missing_format_attribute (tree, tree); + +/* In c-omp.c */ +struct omp_clause_mask +{ + inline omp_clause_mask (); + inline omp_clause_mask (uint64_t l); + inline omp_clause_mask (uint64_t l, uint64_t h); + inline omp_clause_mask &operator &= (omp_clause_mask); + inline omp_clause_mask &operator |= (omp_clause_mask); + inline omp_clause_mask operator ~ () const; + inline omp_clause_mask operator & (omp_clause_mask) const; + inline omp_clause_mask operator | (omp_clause_mask) const; + inline omp_clause_mask operator >> (int); + inline omp_clause_mask operator << (int); + inline bool operator == (omp_clause_mask) const; + inline bool operator != (omp_clause_mask) const; + uint64_t low, high; +}; + +inline +omp_clause_mask::omp_clause_mask () +{ +} + +inline +omp_clause_mask::omp_clause_mask (uint64_t l) +: low (l), high (0) +{ +} + +inline +omp_clause_mask::omp_clause_mask (uint64_t l, uint64_t h) +: low (l), high (h) +{ +} + +inline omp_clause_mask & +omp_clause_mask::operator &= (omp_clause_mask b) +{ + low &= b.low; + high &= b.high; + return *this; +} + +inline omp_clause_mask & +omp_clause_mask::operator |= (omp_clause_mask b) +{ + low |= b.low; + high |= b.high; + return *this; +} + +inline omp_clause_mask +omp_clause_mask::operator ~ () const +{ + omp_clause_mask ret (~low, ~high); + return ret; +} + +inline omp_clause_mask +omp_clause_mask::operator | (omp_clause_mask b) const +{ + omp_clause_mask ret (low | b.low, high | b.high); + return ret; +} + +inline omp_clause_mask +omp_clause_mask::operator & (omp_clause_mask b) const +{ + omp_clause_mask ret (low & b.low, high & b.high); + return ret; +} + +inline omp_clause_mask +omp_clause_mask::operator << (int amount) +{ + omp_clause_mask ret; + if (amount >= 64) + { + ret.low = 0; + ret.high = low << (amount - 64); + } + else if (amount == 0) + ret = *this; + else + { + ret.low = low << amount; + ret.high = (low >> (64 - amount)) | (high << amount); + } + return ret; +} + +inline omp_clause_mask +omp_clause_mask::operator >> (int amount) +{ + omp_clause_mask ret; + if (amount >= 64) + { + ret.low = high >> (amount - 64); + ret.high = 0; + } + else if (amount == 0) + ret = *this; + else + { + ret.low = (high << (64 - amount)) | (low >> amount); + ret.high = high >> amount; + } + return ret; +} + +inline bool +omp_clause_mask::operator == (omp_clause_mask b) const +{ + return low == b.low && high == b.high; +} + +inline bool +omp_clause_mask::operator != (omp_clause_mask b) const +{ + return low != b.low || high != b.high; +} + +#define OMP_CLAUSE_MASK_1 omp_clause_mask (1) + +enum c_omp_clause_split +{ + C_OMP_CLAUSE_SPLIT_TARGET = 0, + C_OMP_CLAUSE_SPLIT_TEAMS, + C_OMP_CLAUSE_SPLIT_DISTRIBUTE, + C_OMP_CLAUSE_SPLIT_PARALLEL, + C_OMP_CLAUSE_SPLIT_FOR, + C_OMP_CLAUSE_SPLIT_SIMD, + C_OMP_CLAUSE_SPLIT_COUNT, + C_OMP_CLAUSE_SPLIT_SECTIONS = C_OMP_CLAUSE_SPLIT_FOR, + C_OMP_CLAUSE_SPLIT_TASKLOOP = C_OMP_CLAUSE_SPLIT_FOR +}; + +enum c_omp_region_type +{ + C_ORT_OMP = 1 << 0, + C_ORT_CILK = 1 << 1, + C_ORT_ACC = 1 << 2, + C_ORT_DECLARE_SIMD = 1 << 3, + C_ORT_OMP_DECLARE_SIMD = C_ORT_OMP | C_ORT_DECLARE_SIMD +}; + +extern tree c_finish_omp_master (location_t, tree); +extern tree c_finish_omp_taskgroup (location_t, tree); +extern tree c_finish_omp_critical (location_t, tree, tree, tree); +extern tree c_finish_omp_ordered (location_t, tree, tree); +extern void c_finish_omp_barrier (location_t); +extern tree c_finish_omp_atomic (location_t, enum tree_code, enum tree_code, + tree, tree, tree, tree, tree, bool, bool, + bool = false); +extern void c_finish_omp_flush (location_t); +extern void c_finish_omp_taskwait (location_t); +extern void c_finish_omp_taskyield (location_t); +extern tree c_finish_omp_for (location_t, enum tree_code, tree, tree, tree, + tree, tree, tree, tree); +extern bool c_omp_check_loop_iv (tree, tree, walk_tree_lh); +extern bool c_omp_check_loop_iv_exprs (location_t, tree, tree, tree, tree, + walk_tree_lh); +extern tree c_finish_oacc_wait (location_t, tree, tree); +extern tree c_oacc_split_loop_clauses (tree, tree *, bool); +extern void c_omp_split_clauses (location_t, enum tree_code, omp_clause_mask, + tree, tree *); +extern tree c_omp_declare_simd_clauses_to_numbers (tree, tree); +extern void c_omp_declare_simd_clauses_to_decls (tree, tree); +extern enum omp_clause_default_kind c_omp_predetermined_sharing (tree); + +/* Return next tree in the chain for chain_next walking of tree nodes. */ +static inline tree +c_tree_chain_next (tree t) +{ + /* TREE_CHAIN of a type is TYPE_STUB_DECL, which is different + kind of object, never a long chain of nodes. Prefer + TYPE_NEXT_VARIANT for types. */ + if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_TYPE_COMMON)) + return TYPE_NEXT_VARIANT (t); + /* Otherwise, if there is TREE_CHAIN, return it. */ + if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_COMMON)) + return TREE_CHAIN (t); + return NULL; +} + +/* Mask used by tm_stmt_attr. */ +#define TM_STMT_ATTR_OUTER 2 +#define TM_STMT_ATTR_ATOMIC 4 +#define TM_STMT_ATTR_RELAXED 8 + +/* Mask used by tm_attr_to_mask and tm_mask_to_attr. Note that these + are ordered specifically such that more restrictive attributes are + at lower bit positions. This fact is known by the C++ tm attribute + inheritance code such that least bit extraction (mask & -mask) results + in the most restrictive attribute. */ +#define TM_ATTR_SAFE 1 +#define TM_ATTR_CALLABLE 2 +#define TM_ATTR_PURE 4 +#define TM_ATTR_IRREVOCABLE 8 +#define TM_ATTR_MAY_CANCEL_OUTER 16 + +/* A suffix-identifier value doublet that represents user-defined literals + for C++-0x. */ +enum overflow_type { + OT_UNDERFLOW = -1, + OT_NONE, + OT_OVERFLOW +}; + +struct GTY(()) tree_userdef_literal { + struct tree_base base; + tree suffix_id; + tree value; + tree num_string; + enum overflow_type overflow; +}; + +#define USERDEF_LITERAL_SUFFIX_ID(NODE) \ + (((struct tree_userdef_literal *)USERDEF_LITERAL_CHECK (NODE))->suffix_id) + +#define USERDEF_LITERAL_VALUE(NODE) \ + (((struct tree_userdef_literal *)USERDEF_LITERAL_CHECK (NODE))->value) + +#define USERDEF_LITERAL_OVERFLOW(NODE) \ + (((struct tree_userdef_literal *)USERDEF_LITERAL_CHECK (NODE))->overflow) + +#define USERDEF_LITERAL_NUM_STRING(NODE) \ + (((struct tree_userdef_literal *)USERDEF_LITERAL_CHECK (NODE))->num_string) + +#define USERDEF_LITERAL_TYPE(NODE) \ + (TREE_TYPE (USERDEF_LITERAL_VALUE (NODE))) + +extern tree build_userdef_literal (tree suffix_id, tree value, + enum overflow_type overflow, + tree num_string); + +extern bool convert_vector_to_array_for_subscript (location_t, tree *, tree); + +/* Possibe cases of scalar_to_vector conversion. */ +enum stv_conv { + stv_error, /* Error occurred. */ + stv_nothing, /* Nothing happened. */ + stv_firstarg, /* First argument must be expanded. */ + stv_secondarg /* Second argument must be expanded. */ +}; + +extern enum stv_conv scalar_to_vector (location_t loc, enum tree_code code, + tree op0, tree op1, bool); + +/* In c-cilkplus.c */ +extern tree c_validate_cilk_plus_loop (tree *, int *, void *); +extern bool c_check_cilk_loop (location_t, tree); + +/* These #defines allow users to access different operands of the + array notation tree. */ + +#define ARRAY_NOTATION_CHECK(NODE) TREE_CHECK (NODE, ARRAY_NOTATION_REF) +#define ARRAY_NOTATION_ARRAY(NODE) \ + TREE_OPERAND (ARRAY_NOTATION_CHECK (NODE), 0) +#define ARRAY_NOTATION_START(NODE) \ + TREE_OPERAND (ARRAY_NOTATION_CHECK (NODE), 1) +#define ARRAY_NOTATION_LENGTH(NODE) \ + TREE_OPERAND (ARRAY_NOTATION_CHECK (NODE), 2) +#define ARRAY_NOTATION_STRIDE(NODE) \ + TREE_OPERAND (ARRAY_NOTATION_CHECK (NODE), 3) + +/* This structure holds all the scalar values and its appropriate variable + replacment. It is mainly used by the function that pulls all the invariant + parts that should be executed only once, which comes with array notation + expressions. */ +struct inv_list +{ + vec *list_values; + vec *replacement; + vec *additional_tcodes; +}; + +/* This structure holds all the important components that can be extracted + from an ARRAY_NOTATION_REF expression. It is used to pass array notation + information between the functions that are responsible for expansion. */ +typedef struct cilkplus_an_parts +{ + tree value; + tree start; + tree length; + tree stride; + bool is_vector; +} an_parts; + +/* This structure holds the components necessary to create the loop around + the ARRAY_REF that is created using the ARRAY_NOTATION information. */ + +typedef struct cilkplus_an_loop_parts +{ + tree var; /* Loop induction variable. */ + tree incr; /* Loop increment/decrement expression. */ + tree cmp; /* Loop condition. */ + tree ind_init; /* Initialization of the loop induction variable. */ +} an_loop_parts; + +/* In array-notation-common.c. */ +extern HOST_WIDE_INT extract_sec_implicit_index_arg (location_t, tree); +extern bool is_sec_implicit_index_fn (tree); +extern void array_notation_init_builtins (void); +extern struct c_expr fix_array_notation_expr (location_t, enum tree_code, + struct c_expr); +extern bool contains_array_notation_expr (tree); +extern tree expand_array_notation_exprs (tree); +extern tree fix_conditional_array_notations (tree); +extern tree find_correct_array_notation_type (tree); +extern bool length_mismatch_in_expr_p (location_t, vec >); +extern enum built_in_function is_cilkplus_reduce_builtin (tree); +extern bool find_rank (location_t, tree, tree, bool, size_t *); +extern void extract_array_notation_exprs (tree, bool, vec **); +extern void replace_array_notations (tree *, bool, vec *, + vec *); +extern tree find_inv_trees (tree *, int *, void *); +extern tree replace_inv_trees (tree *, int *, void *); +extern tree find_correct_array_notation_type (tree op); +extern void cilkplus_extract_an_triplets (vec *, size_t, size_t, + vec > *); +extern vec *fix_sec_implicit_args + (location_t, vec *, vec, size_t, tree); +extern bool is_cilkplus_vector_p (tree); + +/* In cilk.c. */ +extern tree insert_cilk_frame (tree); +extern void cilk_init_builtins (void); +extern int gimplify_cilk_spawn (tree *); +extern void cilk_gimplify_call_params_in_spawned_fn (tree *, gimple_seq *); +extern void cilk_install_body_with_frame_cleanup (tree, tree, void *); +extern bool cilk_detect_spawn_and_unwrap (tree *); +extern bool cilk_set_spawn_marker (location_t, tree); +extern tree build_cilk_sync (void); +extern tree build_cilk_spawn (location_t, tree); +extern tree make_cilk_frame (tree); +extern tree create_cilk_function_exit (tree, bool, bool); +extern tree cilk_install_body_pedigree_operations (tree); +extern void cilk_outline (tree, tree *, void *); +extern bool contains_cilk_spawn_stmt (tree); +extern tree cilk_for_number_of_iterations (tree); +extern bool check_no_cilk (tree, const char *, const char *, + location_t loc = UNKNOWN_LOCATION); +extern bool reject_gcc_builtin (const_tree, location_t = UNKNOWN_LOCATION); +extern bool valid_array_size_p (location_t, tree, tree); + +extern bool cilk_ignorable_spawn_rhs_op (tree); +extern bool cilk_recognize_spawn (tree, tree *); + +/* In c-warn.c. */ +extern void constant_expression_warning (tree); +extern void constant_expression_error (tree); +extern void overflow_warning (location_t, tree); +extern void warn_logical_operator (location_t, enum tree_code, tree, + enum tree_code, tree, enum tree_code, tree); +extern void warn_tautological_cmp (location_t, enum tree_code, tree, tree); +extern void warn_logical_not_parentheses (location_t, enum tree_code, tree, + tree); +extern bool warn_if_unused_value (const_tree, location_t); +extern bool strict_aliasing_warning (tree, tree, tree); +extern void sizeof_pointer_memaccess_warning (location_t *, tree, + vec *, tree *, + bool (*) (tree, tree)); +extern void check_main_parameter_types (tree decl); +extern void warnings_for_convert_and_check (location_t, tree, tree, tree); +extern void c_do_switch_warnings (splay_tree, location_t, tree, tree, bool, + bool); +extern void warn_for_omitted_condop (location_t, tree); +extern void warn_for_restrict (unsigned, tree *, unsigned); + +/* Places where an lvalue, or modifiable lvalue, may be required. + Used to select diagnostic messages in lvalue_error and + readonly_error. */ +enum lvalue_use { + lv_assign, + lv_increment, + lv_decrement, + lv_addressof, + lv_asm +}; + +extern void lvalue_error (location_t, enum lvalue_use); +extern void invalid_indirection_error (location_t, tree, ref_operator); +extern void readonly_error (location_t, tree, enum lvalue_use); +extern void warn_array_subscript_with_type_char (location_t, tree); +extern void warn_about_parentheses (location_t, + enum tree_code, + enum tree_code, tree, + enum tree_code, tree); +extern void warn_for_unused_label (tree label); +extern void warn_for_div_by_zero (location_t, tree divisor); +extern void warn_for_memset (location_t, tree, tree, int); +extern void warn_for_sign_compare (location_t, + tree orig_op0, tree orig_op1, + tree op0, tree op1, + tree result_type, + enum tree_code resultcode); +extern void do_warn_double_promotion (tree, tree, tree, const char *, + location_t); +extern void do_warn_unused_parameter (tree); +extern void record_locally_defined_typedef (tree); +extern void maybe_record_typedef_use (tree); +extern void maybe_warn_unused_local_typedefs (void); +extern void maybe_warn_bool_compare (location_t, enum tree_code, tree, tree); +extern bool maybe_warn_shift_overflow (location_t, tree, tree); +extern void warn_duplicated_cond_add_or_warn (location_t, tree, vec **); +extern bool diagnose_mismatched_attributes (tree, tree); +extern tree do_warn_duplicated_branches_r (tree *, int *, void *); + +/* In c-attribs.c. */ +extern bool attribute_takes_identifier_p (const_tree); +extern tree handle_unused_attribute (tree *, tree, tree, int, bool *); +extern int parse_tm_stmt_attr (tree, int); +extern int tm_attr_to_mask (tree); +extern tree tm_mask_to_attr (int); +extern tree find_tm_attribute (tree); + +extern enum flt_eval_method +excess_precision_mode_join (enum flt_eval_method, enum flt_eval_method); + +extern int c_flt_eval_method (bool ts18661_p); + +#if CHECKING_P +namespace selftest { + extern void c_format_c_tests (void); + extern void run_c_tests (void); +} // namespace selftest +#endif /* #if CHECKING_P */ + +#endif /* ! GCC_C_COMMON_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/c-family/c-objc.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/c-family/c-objc.h new file mode 100644 index 0000000..dc5f08f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/c-family/c-objc.h @@ -0,0 +1,114 @@ +/* Definitions of Objective-C front-end entry points used for C and C++. + Copyright (C) 1987-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_C_COMMON_OBJC_H +#define GCC_C_COMMON_OBJC_H + +/* ObjC ivar visibility types. */ +enum GTY(()) objc_ivar_visibility_kind { + OBJC_IVAR_VIS_PROTECTED = 0, + OBJC_IVAR_VIS_PUBLIC = 1, + OBJC_IVAR_VIS_PRIVATE = 2, + OBJC_IVAR_VIS_PACKAGE = 3 +}; + +/* Objective-C / Objective-C++ entry points. */ + +/* The following ObjC/ObjC++ functions are called by the C and/or C++ + front-ends; they all must have corresponding stubs in stub-objc.c. */ +extern void objc_write_global_declarations (void); +extern tree objc_is_class_name (tree); +extern tree objc_is_object_ptr (tree); +extern void objc_check_decl (tree); +extern void objc_check_global_decl (tree); +extern tree objc_common_type (tree, tree); +extern bool objc_compare_types (tree, tree, int, tree); +extern bool objc_have_common_type (tree, tree, int, tree); +extern bool objc_diagnose_private_ivar (tree); +extern void objc_volatilize_decl (tree); +extern tree objc_rewrite_function_call (tree, tree); +extern tree objc_message_selector (void); +extern tree objc_lookup_ivar (tree, tree); +extern void objc_clear_super_receiver (void); +extern int objc_is_public (tree, tree); +extern tree objc_is_id (tree); +extern void objc_declare_alias (tree, tree); +extern void objc_declare_class (tree); +extern void objc_declare_protocol (tree, tree); +extern tree objc_build_message_expr (tree, tree); +extern tree objc_finish_message_expr (tree, tree, tree, tree*); +extern tree objc_build_selector_expr (location_t, tree); +extern tree objc_build_protocol_expr (tree); +extern tree objc_build_encode_expr (tree); +extern tree objc_build_string_object (tree); +extern tree objc_get_protocol_qualified_type (tree, tree); +extern tree objc_get_class_reference (tree); +extern tree objc_get_class_ivars (tree); +extern bool objc_detect_field_duplicates (bool); +extern void objc_start_class_interface (tree, tree, tree, tree); +extern void objc_start_category_interface (tree, tree, tree, tree); +extern void objc_start_protocol (tree, tree, tree); +extern void objc_continue_interface (void); +extern void objc_finish_interface (void); +extern void objc_start_class_implementation (tree, tree); +extern void objc_start_category_implementation (tree, tree); +extern void objc_continue_implementation (void); +extern void objc_finish_implementation (void); +extern void objc_set_visibility (objc_ivar_visibility_kind); +extern tree objc_build_method_signature (bool, tree, tree, tree, bool); +extern void objc_add_method_declaration (bool, tree, tree); +extern bool objc_start_method_definition (bool, tree, tree, tree); +extern void objc_finish_method_definition (tree); +extern void objc_add_instance_variable (tree); +extern tree objc_build_keyword_decl (tree, tree, tree, tree); +extern tree objc_build_throw_stmt (location_t, tree); +extern void objc_begin_try_stmt (location_t, tree); +extern tree objc_finish_try_stmt (void); +extern void objc_begin_catch_clause (tree); +extern void objc_finish_catch_clause (void); +extern void objc_build_finally_clause (location_t, tree); +extern tree objc_build_synchronized (location_t, tree, tree); +extern int objc_static_init_needed_p (void); +extern tree objc_generate_static_init_call (tree); +extern tree objc_generate_write_barrier (tree, enum tree_code, tree); +extern void objc_set_method_opt (bool); +extern void objc_finish_foreach_loop (location_t, tree, tree, tree, tree, tree); +extern bool objc_method_decl (enum tree_code); +extern void objc_add_property_declaration (location_t, tree, bool, bool, bool, + bool, bool, bool, tree, tree); +extern tree objc_maybe_build_component_ref (tree, tree); +extern tree objc_build_class_component_ref (tree, tree); +extern tree objc_maybe_build_modify_expr (tree, tree); +extern tree objc_build_incr_expr_for_property_ref (location_t, enum tree_code, + tree, tree); +extern void objc_add_synthesize_declaration (location_t, tree); +extern void objc_add_dynamic_declaration (location_t, tree); +extern const char * objc_maybe_printable_name (tree, int); +extern bool objc_is_property_ref (tree); +extern bool objc_string_ref_type_p (tree); +extern void objc_check_format_arg (tree, tree); +extern void objc_finish_function (void); +extern void objc_maybe_warn_exceptions (location_t); + +/* The following are provided by the C and C++ front-ends, and called by + ObjC/ObjC++. */ +extern void *objc_get_current_scope (void); +extern void objc_mark_locals_volatile (void *); + +#endif /* ! GCC_C_COMMON_OBJC_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/c-family/c-pragma.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/c-family/c-pragma.h new file mode 100644 index 0000000..a79036e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/c-family/c-pragma.h @@ -0,0 +1,259 @@ +/* Pragma related interfaces. + Copyright (C) 1995-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_C_PRAGMA_H +#define GCC_C_PRAGMA_H + +#include "cpplib.h" /* For enum cpp_ttype. */ + +/* Pragma identifiers built in to the front end parsers. Identifiers + for ancillary handlers will follow these. */ +enum pragma_kind { + PRAGMA_NONE = 0, + + PRAGMA_OACC_ATOMIC, + PRAGMA_OACC_CACHE, + PRAGMA_OACC_DATA, + PRAGMA_OACC_DECLARE, + PRAGMA_OACC_ENTER_DATA, + PRAGMA_OACC_EXIT_DATA, + PRAGMA_OACC_HOST_DATA, + PRAGMA_OACC_KERNELS, + PRAGMA_OACC_LOOP, + PRAGMA_OACC_PARALLEL, + PRAGMA_OACC_ROUTINE, + PRAGMA_OACC_UPDATE, + PRAGMA_OACC_WAIT, + + PRAGMA_OMP_ATOMIC, + PRAGMA_OMP_BARRIER, + PRAGMA_OMP_CANCEL, + PRAGMA_OMP_CANCELLATION_POINT, + PRAGMA_OMP_CRITICAL, + PRAGMA_OMP_DECLARE, + PRAGMA_OMP_DISTRIBUTE, + PRAGMA_OMP_END_DECLARE_TARGET, + PRAGMA_OMP_FLUSH, + PRAGMA_OMP_FOR, + PRAGMA_OMP_MASTER, + PRAGMA_OMP_ORDERED, + PRAGMA_OMP_PARALLEL, + PRAGMA_OMP_SECTION, + PRAGMA_OMP_SECTIONS, + PRAGMA_OMP_SIMD, + PRAGMA_OMP_SINGLE, + PRAGMA_OMP_TARGET, + PRAGMA_OMP_TASK, + PRAGMA_OMP_TASKGROUP, + PRAGMA_OMP_TASKLOOP, + PRAGMA_OMP_TASKWAIT, + PRAGMA_OMP_TASKYIELD, + PRAGMA_OMP_THREADPRIVATE, + PRAGMA_OMP_TEAMS, + + /* Top level clause to handle all Cilk Plus pragma simd clauses. */ + PRAGMA_CILK_SIMD, + + /* This pragma handles setting of grainsize for a _Cilk_for. */ + PRAGMA_CILK_GRAINSIZE, + + PRAGMA_GCC_PCH_PREPROCESS, + PRAGMA_IVDEP, + + PRAGMA_FIRST_EXTERNAL +}; + + +/* All clauses defined by OpenACC 2.0, and OpenMP 2.5, 3.0, 3.1, 4.0 and 4.5. + Used internally by both C and C++ parsers. */ +enum pragma_omp_clause { + PRAGMA_OMP_CLAUSE_NONE = 0, + + PRAGMA_OMP_CLAUSE_ALIGNED, + PRAGMA_OMP_CLAUSE_COLLAPSE, + PRAGMA_OMP_CLAUSE_COPYIN, + PRAGMA_OMP_CLAUSE_COPYPRIVATE, + PRAGMA_OMP_CLAUSE_DEFAULT, + PRAGMA_OMP_CLAUSE_DEFAULTMAP, + PRAGMA_OMP_CLAUSE_DEPEND, + PRAGMA_OMP_CLAUSE_DEVICE, + PRAGMA_OMP_CLAUSE_DIST_SCHEDULE, + PRAGMA_OMP_CLAUSE_FINAL, + PRAGMA_OMP_CLAUSE_FIRSTPRIVATE, + PRAGMA_OMP_CLAUSE_FOR, + PRAGMA_OMP_CLAUSE_FROM, + PRAGMA_OMP_CLAUSE_GRAINSIZE, + PRAGMA_OMP_CLAUSE_HINT, + PRAGMA_OMP_CLAUSE_IF, + PRAGMA_OMP_CLAUSE_INBRANCH, + PRAGMA_OMP_CLAUSE_IS_DEVICE_PTR, + PRAGMA_OMP_CLAUSE_LASTPRIVATE, + PRAGMA_OMP_CLAUSE_LINEAR, + PRAGMA_OMP_CLAUSE_LINK, + PRAGMA_OMP_CLAUSE_MAP, + PRAGMA_OMP_CLAUSE_MERGEABLE, + PRAGMA_OMP_CLAUSE_NOGROUP, + PRAGMA_OMP_CLAUSE_NOTINBRANCH, + PRAGMA_OMP_CLAUSE_NOWAIT, + PRAGMA_OMP_CLAUSE_NUM_TASKS, + PRAGMA_OMP_CLAUSE_NUM_TEAMS, + PRAGMA_OMP_CLAUSE_NUM_THREADS, + PRAGMA_OMP_CLAUSE_ORDERED, + PRAGMA_OMP_CLAUSE_PARALLEL, + PRAGMA_OMP_CLAUSE_PRIORITY, + PRAGMA_OMP_CLAUSE_PRIVATE, + PRAGMA_OMP_CLAUSE_PROC_BIND, + PRAGMA_OMP_CLAUSE_REDUCTION, + PRAGMA_OMP_CLAUSE_SAFELEN, + PRAGMA_OMP_CLAUSE_SCHEDULE, + PRAGMA_OMP_CLAUSE_SECTIONS, + PRAGMA_OMP_CLAUSE_SHARED, + PRAGMA_OMP_CLAUSE_SIMD, + PRAGMA_OMP_CLAUSE_SIMDLEN, + PRAGMA_OMP_CLAUSE_TASKGROUP, + PRAGMA_OMP_CLAUSE_THREAD_LIMIT, + PRAGMA_OMP_CLAUSE_THREADS, + PRAGMA_OMP_CLAUSE_TO, + PRAGMA_OMP_CLAUSE_UNIFORM, + PRAGMA_OMP_CLAUSE_UNTIED, + PRAGMA_OMP_CLAUSE_USE_DEVICE_PTR, + + /* Clauses for Cilk Plus SIMD-enabled function. */ + PRAGMA_CILK_CLAUSE_NOMASK, + PRAGMA_CILK_CLAUSE_MASK, + PRAGMA_CILK_CLAUSE_VECTORLENGTH, + PRAGMA_CILK_CLAUSE_NONE = PRAGMA_OMP_CLAUSE_NONE, + PRAGMA_CILK_CLAUSE_LINEAR = PRAGMA_OMP_CLAUSE_LINEAR, + PRAGMA_CILK_CLAUSE_PRIVATE = PRAGMA_OMP_CLAUSE_PRIVATE, + PRAGMA_CILK_CLAUSE_FIRSTPRIVATE = PRAGMA_OMP_CLAUSE_FIRSTPRIVATE, + PRAGMA_CILK_CLAUSE_LASTPRIVATE = PRAGMA_OMP_CLAUSE_LASTPRIVATE, + PRAGMA_CILK_CLAUSE_REDUCTION = PRAGMA_OMP_CLAUSE_REDUCTION, + PRAGMA_CILK_CLAUSE_UNIFORM = PRAGMA_OMP_CLAUSE_UNIFORM, + + /* Clauses for OpenACC. */ + PRAGMA_OACC_CLAUSE_ASYNC = PRAGMA_CILK_CLAUSE_VECTORLENGTH + 1, + PRAGMA_OACC_CLAUSE_AUTO, + PRAGMA_OACC_CLAUSE_COPY, + PRAGMA_OACC_CLAUSE_COPYOUT, + PRAGMA_OACC_CLAUSE_CREATE, + PRAGMA_OACC_CLAUSE_DELETE, + PRAGMA_OACC_CLAUSE_DEVICEPTR, + PRAGMA_OACC_CLAUSE_DEVICE_RESIDENT, + PRAGMA_OACC_CLAUSE_GANG, + PRAGMA_OACC_CLAUSE_HOST, + PRAGMA_OACC_CLAUSE_INDEPENDENT, + PRAGMA_OACC_CLAUSE_NUM_GANGS, + PRAGMA_OACC_CLAUSE_NUM_WORKERS, + PRAGMA_OACC_CLAUSE_PRESENT, + PRAGMA_OACC_CLAUSE_PRESENT_OR_COPY, + PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYIN, + PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYOUT, + PRAGMA_OACC_CLAUSE_PRESENT_OR_CREATE, + PRAGMA_OACC_CLAUSE_SELF, + PRAGMA_OACC_CLAUSE_SEQ, + PRAGMA_OACC_CLAUSE_TILE, + PRAGMA_OACC_CLAUSE_USE_DEVICE, + PRAGMA_OACC_CLAUSE_VECTOR, + PRAGMA_OACC_CLAUSE_VECTOR_LENGTH, + PRAGMA_OACC_CLAUSE_WAIT, + PRAGMA_OACC_CLAUSE_WORKER, + PRAGMA_OACC_CLAUSE_COLLAPSE = PRAGMA_OMP_CLAUSE_COLLAPSE, + PRAGMA_OACC_CLAUSE_COPYIN = PRAGMA_OMP_CLAUSE_COPYIN, + PRAGMA_OACC_CLAUSE_DEVICE = PRAGMA_OMP_CLAUSE_DEVICE, + PRAGMA_OACC_CLAUSE_DEFAULT = PRAGMA_OMP_CLAUSE_DEFAULT, + PRAGMA_OACC_CLAUSE_FIRSTPRIVATE = PRAGMA_OMP_CLAUSE_FIRSTPRIVATE, + PRAGMA_OACC_CLAUSE_IF = PRAGMA_OMP_CLAUSE_IF, + PRAGMA_OACC_CLAUSE_PRIVATE = PRAGMA_OMP_CLAUSE_PRIVATE, + PRAGMA_OACC_CLAUSE_REDUCTION = PRAGMA_OMP_CLAUSE_REDUCTION, + PRAGMA_OACC_CLAUSE_LINK = PRAGMA_OMP_CLAUSE_LINK +}; + +extern struct cpp_reader* parse_in; + +/* It's safe to always leave visibility pragma enabled as if + visibility is not supported on the host OS platform the + statements are ignored. */ +extern void push_visibility (const char *, int); +extern bool pop_visibility (int); + +extern void init_pragma (void); + +/* Front-end wrappers for pragma registration. */ +typedef void (*pragma_handler_1arg)(struct cpp_reader *); +/* A second pragma handler, which adds a void * argument allowing to pass extra + data to the handler. */ +typedef void (*pragma_handler_2arg)(struct cpp_reader *, void *); + +/* This union allows to abstract the different handlers. */ +union gen_pragma_handler { + pragma_handler_1arg handler_1arg; + pragma_handler_2arg handler_2arg; +}; +/* Internally used to keep the data of the handler. */ +struct internal_pragma_handler { + union gen_pragma_handler handler; + /* Permits to know if handler is a pragma_handler_1arg (extra_data is false) + or a pragma_handler_2arg (extra_data is true). */ + bool extra_data; + /* A data field which can be used when extra_data is true. */ + void * data; +}; + +extern void c_register_pragma (const char *space, const char *name, + pragma_handler_1arg handler); +extern void c_register_pragma_with_data (const char *space, const char *name, + pragma_handler_2arg handler, + void *data); + +extern void c_register_pragma_with_expansion (const char *space, + const char *name, + pragma_handler_1arg handler); +extern void c_register_pragma_with_expansion_and_data (const char *space, + const char *name, + pragma_handler_2arg handler, + void *data); +extern void c_invoke_pragma_handler (unsigned int); + +extern void maybe_apply_pragma_weak (tree); +extern void maybe_apply_pending_pragma_weaks (void); +extern tree maybe_apply_renaming_pragma (tree, tree); +extern void maybe_apply_pragma_scalar_storage_order (tree); +extern void add_to_renaming_pragma_list (tree, tree); + +extern enum cpp_ttype pragma_lex (tree *, location_t *loc = NULL); + +/* Flags for use with c_lex_with_flags. The values here were picked + so that 0 means to translate and join strings. */ +#define C_LEX_STRING_NO_TRANSLATE 1 /* Do not lex strings into + execution character set. */ +#define C_LEX_STRING_NO_JOIN 2 /* Do not concatenate strings + nor translate them into execution + character set. */ + +/* This is not actually available to pragma parsers. It's merely a + convenient location to declare this function for c-lex, after + having enum cpp_ttype declared. */ +extern enum cpp_ttype c_lex_with_flags (tree *, location_t *, unsigned char *, + int); + +extern void c_pp_lookup_pragma (unsigned int, const char **, const char **); + +extern GTY(()) tree pragma_extern_prefix; + +#endif /* GCC_C_PRAGMA_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/c-family/c-pretty-print.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/c-family/c-pretty-print.h new file mode 100644 index 0000000..86a4ae3 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/c-family/c-pretty-print.h @@ -0,0 +1,139 @@ +/* Various declarations for the C and C++ pretty-printers. + Copyright (C) 2002-2017 Free Software Foundation, Inc. + Contributed by Gabriel Dos Reis + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_C_PRETTY_PRINTER +#define GCC_C_PRETTY_PRINTER + +#include "tree.h" +#include "c-family/c-common.h" +#include "pretty-print.h" + + +enum pp_c_pretty_print_flags + { + pp_c_flag_abstract = 1 << 1, + pp_c_flag_gnu_v3 = 1 << 2, + pp_c_flag_last_bit = 3 + }; + + +/* The data type used to bundle information necessary for pretty-printing + a C or C++ entity. */ +struct c_pretty_printer; + +/* The type of a C pretty-printer 'member' function. */ +typedef void (*c_pretty_print_fn) (c_pretty_printer *, tree); + +/* The datatype that contains information necessary for pretty-printing + a tree that represents a C construct. Any pretty-printer for a + language using C syntax can derive from this datatype and reuse + facilities provided here. A derived pretty-printer can override + any function listed in the vtable below. See cp/cxx-pretty-print.h + and cp/cxx-pretty-print.c for an example of derivation. */ +struct c_pretty_printer : pretty_printer +{ + c_pretty_printer (); + + // Format string, possibly translated. + void translate_string (const char *); + + virtual void constant (tree); + virtual void id_expression (tree); + virtual void primary_expression (tree); + virtual void postfix_expression (tree); + virtual void unary_expression (tree); + virtual void multiplicative_expression (tree); + virtual void conditional_expression (tree); + virtual void assignment_expression (tree); + virtual void expression (tree); + + virtual void type_id (tree); + virtual void statement (tree); + + virtual void declaration (tree); + virtual void declaration_specifiers (tree); + virtual void simple_type_specifier (tree); + virtual void function_specifier (tree); + virtual void storage_class_specifier (tree); + virtual void declarator (tree); + virtual void direct_declarator (tree); + virtual void abstract_declarator (tree); + virtual void direct_abstract_declarator (tree); + + virtual void initializer (tree); + /* Points to the first element of an array of offset-list. + Not used yet. */ + int *offset_list; + + pp_flags flags; + + /* These must be overridden by each of the C and C++ front-end to + reflect their understanding of syntactic productions when they differ. */ + c_pretty_print_fn type_specifier_seq; + c_pretty_print_fn ptr_operator; + c_pretty_print_fn parameter_list; +}; + +#define pp_c_tree_identifier(PPI, ID) \ + pp_c_identifier (PPI, IDENTIFIER_POINTER (ID)) + +#define pp_type_specifier_seq(PP, D) (PP)->type_specifier_seq (PP, D) +#define pp_ptr_operator(PP, D) (PP)->ptr_operator (PP, D) +#define pp_parameter_list(PP, T) (PP)->parameter_list (PP, T) + +void pp_c_whitespace (c_pretty_printer *); +void pp_c_left_paren (c_pretty_printer *); +void pp_c_right_paren (c_pretty_printer *); +void pp_c_left_brace (c_pretty_printer *); +void pp_c_right_brace (c_pretty_printer *); +void pp_c_left_bracket (c_pretty_printer *); +void pp_c_right_bracket (c_pretty_printer *); +void pp_c_dot (c_pretty_printer *); +void pp_c_ampersand (c_pretty_printer *); +void pp_c_star (c_pretty_printer *); +void pp_c_arrow (c_pretty_printer *); +void pp_c_semicolon (c_pretty_printer *); +void pp_c_complement (c_pretty_printer *); +void pp_c_exclamation (c_pretty_printer *); +void pp_c_space_for_pointer_operator (c_pretty_printer *, tree); + +/* Declarations. */ +void pp_c_tree_decl_identifier (c_pretty_printer *, tree); +void pp_c_function_definition (c_pretty_printer *, tree); +void pp_c_attributes (c_pretty_printer *, tree); +void pp_c_attributes_display (c_pretty_printer *, tree); +void pp_c_cv_qualifiers (c_pretty_printer *pp, int qualifiers, bool func_type); +void pp_c_type_qualifier_list (c_pretty_printer *, tree); +void pp_c_parameter_type_list (c_pretty_printer *, tree); +void pp_c_specifier_qualifier_list (c_pretty_printer *, tree); +/* Expressions. */ +void pp_c_logical_or_expression (c_pretty_printer *, tree); +void pp_c_expression_list (c_pretty_printer *, tree); +void pp_c_constructor_elts (c_pretty_printer *, vec *); +void pp_c_call_argument_list (c_pretty_printer *, tree); +void pp_c_cast_expression (c_pretty_printer *, tree); +void pp_c_init_declarator (c_pretty_printer *, tree); +void pp_c_ws_string (c_pretty_printer *, const char *); +void pp_c_identifier (c_pretty_printer *, const char *); +void pp_c_string_literal (c_pretty_printer *, tree); + +void print_c_tree (FILE *file, tree t); + +#endif /* GCC_C_PRETTY_PRINTER */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/c-tree.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/c-tree.h new file mode 100644 index 0000000..5fa32a4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/c-tree.h @@ -0,0 +1,761 @@ +/* Definitions for C parsing and type checking. + Copyright (C) 1987-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_C_TREE_H +#define GCC_C_TREE_H + +#include "c-family/c-common.h" +#include "diagnostic.h" + +/* struct lang_identifier is private to c-decl.c, but langhooks.c needs to + know how big it is. This is sanity-checked in c-decl.c. */ +#define C_SIZEOF_STRUCT_LANG_IDENTIFIER \ + (sizeof (struct c_common_identifier) + 3 * sizeof (void *)) + +/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */ +#define C_TYPE_FIELDS_READONLY(TYPE) TREE_LANG_FLAG_1 (TYPE) + +/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is volatile. */ +#define C_TYPE_FIELDS_VOLATILE(TYPE) TREE_LANG_FLAG_2 (TYPE) + +/* In a RECORD_TYPE or UNION_TYPE or ENUMERAL_TYPE + nonzero if the definition of the type has already started. */ +#define C_TYPE_BEING_DEFINED(TYPE) TYPE_LANG_FLAG_0 (TYPE) + +/* In an incomplete RECORD_TYPE or UNION_TYPE, a list of variable + declarations whose type would be completed by completing that type. */ +#define C_TYPE_INCOMPLETE_VARS(TYPE) TYPE_VFIELD (TYPE) + +/* In an IDENTIFIER_NODE, nonzero if this identifier is actually a + keyword. C_RID_CODE (node) is then the RID_* value of the keyword. */ +#define C_IS_RESERVED_WORD(ID) TREE_LANG_FLAG_0 (ID) + +/* Record whether a type or decl was written with nonconstant size. + Note that TYPE_SIZE may have simplified to a constant. */ +#define C_TYPE_VARIABLE_SIZE(TYPE) TYPE_LANG_FLAG_1 (TYPE) +#define C_DECL_VARIABLE_SIZE(TYPE) DECL_LANG_FLAG_0 (TYPE) + +/* Record whether a type is defined inside a struct or union type. + This is used for -Wc++-compat. */ +#define C_TYPE_DEFINED_IN_STRUCT(TYPE) TYPE_LANG_FLAG_2 (TYPE) + +/* Record whether an "incomplete type" error was given for the type. */ +#define C_TYPE_ERROR_REPORTED(TYPE) TYPE_LANG_FLAG_3 (TYPE) + +/* Record whether a typedef for type `int' was actually `signed int'. */ +#define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP) + +/* For a FUNCTION_DECL, nonzero if it was defined without an explicit + return type. */ +#define C_FUNCTION_IMPLICIT_INT(EXP) DECL_LANG_FLAG_1 (EXP) + +/* For a FUNCTION_DECL, nonzero if it was an implicit declaration. */ +#define C_DECL_IMPLICIT(EXP) DECL_LANG_FLAG_2 (EXP) + +/* For a PARM_DECL, nonzero if it was declared as an array. */ +#define C_ARRAY_PARAMETER(NODE) DECL_LANG_FLAG_0 (NODE) + +/* For FUNCTION_DECLs, evaluates true if the decl is built-in but has + been declared. */ +#define C_DECL_DECLARED_BUILTIN(EXP) \ + DECL_LANG_FLAG_3 (FUNCTION_DECL_CHECK (EXP)) + +/* For FUNCTION_DECLs, evaluates true if the decl is built-in, has a + built-in prototype and does not have a non-built-in prototype. */ +#define C_DECL_BUILTIN_PROTOTYPE(EXP) \ + DECL_LANG_FLAG_6 (FUNCTION_DECL_CHECK (EXP)) + +/* Record whether a decl was declared register. This is strictly a + front-end flag, whereas DECL_REGISTER is used for code generation; + they may differ for structures with volatile fields. */ +#define C_DECL_REGISTER(EXP) DECL_LANG_FLAG_4 (EXP) + +/* Record whether a decl was used in an expression anywhere except an + unevaluated operand of sizeof / typeof / alignof. This is only + used for functions declared static but not defined, though outside + sizeof and typeof it is set for other function decls as well. */ +#define C_DECL_USED(EXP) DECL_LANG_FLAG_5 (FUNCTION_DECL_CHECK (EXP)) + +/* Record whether a variable has been declared threadprivate by + #pragma omp threadprivate. */ +#define C_DECL_THREADPRIVATE_P(DECL) DECL_LANG_FLAG_3 (VAR_DECL_CHECK (DECL)) + +/* Nonzero for a decl which either doesn't exist or isn't a prototype. + N.B. Could be simplified if all built-in decls had complete prototypes + (but this is presently difficult because some of them need FILE*). */ +#define C_DECL_ISNT_PROTOTYPE(EXP) \ + (EXP == 0 \ + || (!prototype_p (TREE_TYPE (EXP)) \ + && !DECL_BUILT_IN (EXP))) + +/* For FUNCTION_TYPE, a hidden list of types of arguments. The same as + TYPE_ARG_TYPES for functions with prototypes, but created for functions + without prototypes. */ +#define TYPE_ACTUAL_ARG_TYPES(NODE) TYPE_LANG_SLOT_1 (NODE) + +/* For a CONSTRUCTOR, whether some initializer contains a + subexpression meaning it is not a constant expression. */ +#define CONSTRUCTOR_NON_CONST(EXPR) TREE_LANG_FLAG_1 (CONSTRUCTOR_CHECK (EXPR)) + +/* Record parser information about an expression that is irrelevant + for code generation alongside a tree representing its value. */ +struct c_expr +{ + /* The value of the expression. */ + tree value; + /* Record the original unary/binary operator of an expression, which may + have been changed by fold, STRING_CST for unparenthesized string + constants, C_MAYBE_CONST_EXPR for __builtin_constant_p calls + (even if parenthesized), for subexpressions, and for non-constant + initializers, or ERROR_MARK for other expressions (including + parenthesized expressions). */ + enum tree_code original_code; + /* If not NULL, the original type of an expression. This will + differ from the type of the value field for an enum constant. + The type of an enum constant is a plain integer type, but this + field will be the enum type. */ + tree original_type; + + /* The source range of this expression. This is redundant + for node values that have locations, but not all node kinds + have locations (e.g. constants, and references to params, locals, + etc), so we stash a copy here. */ + source_range src_range; + + /* Access to the first and last locations within the source spelling + of this expression. */ + location_t get_start () const { return src_range.m_start; } + location_t get_finish () const { return src_range.m_finish; } + + /* Set the value to error_mark_node whilst ensuring that src_range + is initialized. */ + void set_error () + { + value = error_mark_node; + src_range.m_start = UNKNOWN_LOCATION; + src_range.m_finish = UNKNOWN_LOCATION; + } +}; + +/* Type alias for struct c_expr. This allows to use the structure + inside the VEC types. */ +typedef struct c_expr c_expr_t; + +/* A kind of type specifier. Note that this information is currently + only used to distinguish tag definitions, tag references and typeof + uses. */ +enum c_typespec_kind { + /* No typespec. This appears only in struct c_declspec. */ + ctsk_none, + /* A reserved keyword type specifier. */ + ctsk_resword, + /* A reference to a tag, previously declared, such as "struct foo". + This includes where the previous declaration was as a different + kind of tag, in which case this is only valid if shadowing that + tag in an inner scope. */ + ctsk_tagref, + /* A reference to a tag, not previously declared in a visible + scope. */ + ctsk_tagfirstref, + /* A definition of a tag such as "struct foo { int a; }". */ + ctsk_tagdef, + /* A typedef name. */ + ctsk_typedef, + /* An ObjC-specific kind of type specifier. */ + ctsk_objc, + /* A typeof specifier, or _Atomic ( type-name ). */ + ctsk_typeof +}; + +/* A type specifier: this structure is created in the parser and + passed to declspecs_add_type only. */ +struct c_typespec { + /* What kind of type specifier this is. */ + enum c_typespec_kind kind; + /* Whether the expression has operands suitable for use in constant + expressions. */ + bool expr_const_operands; + /* The specifier itself. */ + tree spec; + /* An expression to be evaluated before the type specifier, in the + case of typeof specifiers, or NULL otherwise or if no such + expression is required for a particular typeof specifier. In + particular, when typeof is applied to an expression of variably + modified type, that expression must be evaluated in order to + determine array sizes that form part of the type, but the + expression itself (as opposed to the array sizes) forms no part + of the type and so needs to be recorded separately. */ + tree expr; +}; + +/* A storage class specifier. */ +enum c_storage_class { + csc_none, + csc_auto, + csc_extern, + csc_register, + csc_static, + csc_typedef +}; + +/* A type specifier keyword "void", "_Bool", "char", "int", "float", + "double", "_Decimal32", "_Decimal64", "_Decimal128", "_Fract", "_Accum", + or none of these. */ +enum c_typespec_keyword { + cts_none, + cts_void, + cts_bool, + cts_char, + cts_int, + cts_float, + cts_int_n, + cts_double, + cts_dfloat32, + cts_dfloat64, + cts_dfloat128, + cts_floatn_nx, + cts_fract, + cts_accum, + cts_auto_type +}; + +/* This enum lists all the possible declarator specifiers, storage + class or attribute that a user can write. There is at least one + enumerator per possible declarator specifier in the struct + c_declspecs below. + + It is used to index the array of declspec locations in struct + c_declspecs. */ +enum c_declspec_word { + cdw_typespec /* A catch-all for a typespec. */, + cdw_storage_class /* A catch-all for a storage class */, + cdw_attributes, + cdw_typedef, + cdw_explicit_signed, + cdw_deprecated, + cdw_default_int, + cdw_long, + cdw_long_long, + cdw_short, + cdw_signed, + cdw_unsigned, + cdw_complex, + cdw_inline, + cdw_noreturn, + cdw_thread, + cdw_const, + cdw_volatile, + cdw_restrict, + cdw_atomic, + cdw_saturating, + cdw_alignas, + cdw_address_space, + cdw_gimple, + cdw_rtl, + cdw_number_of_elements /* This one must always be the last + enumerator. */ +}; + +/* A sequence of declaration specifiers in C. When a new declaration + specifier is added, please update the enum c_declspec_word above + accordingly. */ +struct c_declspecs { + source_location locations[cdw_number_of_elements]; + /* The type specified, if a single type specifier such as a struct, + union or enum specifier, typedef name or typeof specifies the + whole type, or NULL_TREE if none or a keyword such as "void" or + "char" is used. Does not include qualifiers. */ + tree type; + /* Any expression to be evaluated before the type, from a typeof + specifier. */ + tree expr; + /* The attributes from a typedef decl. */ + tree decl_attr; + /* When parsing, the attributes. Outside the parser, this will be + NULL; attributes (possibly from multiple lists) will be passed + separately. */ + tree attrs; + /* The pass to start compiling a __GIMPLE or __RTL function with. */ + char *gimple_or_rtl_pass; + /* The base-2 log of the greatest alignment required by an _Alignas + specifier, in bytes, or -1 if no such specifiers with nonzero + alignment. */ + int align_log; + /* For the __intN declspec, this stores the index into the int_n_* arrays. */ + int int_n_idx; + /* For the _FloatN and _FloatNx declspec, this stores the index into + the floatn_nx_types array. */ + int floatn_nx_idx; + /* The storage class specifier, or csc_none if none. */ + enum c_storage_class storage_class; + /* Any type specifier keyword used such as "int", not reflecting + modifiers such as "short", or cts_none if none. */ + ENUM_BITFIELD (c_typespec_keyword) typespec_word : 8; + /* The kind of type specifier if one has been seen, ctsk_none + otherwise. */ + ENUM_BITFIELD (c_typespec_kind) typespec_kind : 3; + /* Whether any expressions in typeof specifiers may appear in + constant expressions. */ + BOOL_BITFIELD expr_const_operands : 1; + /* Whether any declaration specifiers have been seen at all. */ + BOOL_BITFIELD declspecs_seen_p : 1; + /* Whether something other than a storage class specifier or + attribute has been seen. This is used to warn for the + obsolescent usage of storage class specifiers other than at the + start of the list. (Doing this properly would require function + specifiers to be handled separately from storage class + specifiers.) */ + BOOL_BITFIELD non_sc_seen_p : 1; + /* Whether the type is specified by a typedef or typeof name. */ + BOOL_BITFIELD typedef_p : 1; + /* Whether the type is explicitly "signed" or specified by a typedef + whose type is explicitly "signed". */ + BOOL_BITFIELD explicit_signed_p : 1; + /* Whether the specifiers include a deprecated typedef. */ + BOOL_BITFIELD deprecated_p : 1; + /* Whether the type defaulted to "int" because there were no type + specifiers. */ + BOOL_BITFIELD default_int_p : 1; + /* Whether "long" was specified. */ + BOOL_BITFIELD long_p : 1; + /* Whether "long" was specified more than once. */ + BOOL_BITFIELD long_long_p : 1; + /* Whether "short" was specified. */ + BOOL_BITFIELD short_p : 1; + /* Whether "signed" was specified. */ + BOOL_BITFIELD signed_p : 1; + /* Whether "unsigned" was specified. */ + BOOL_BITFIELD unsigned_p : 1; + /* Whether "complex" was specified. */ + BOOL_BITFIELD complex_p : 1; + /* Whether "inline" was specified. */ + BOOL_BITFIELD inline_p : 1; + /* Whether "_Noreturn" was speciied. */ + BOOL_BITFIELD noreturn_p : 1; + /* Whether "__thread" or "_Thread_local" was specified. */ + BOOL_BITFIELD thread_p : 1; + /* Whether "__thread" rather than "_Thread_local" was specified. */ + BOOL_BITFIELD thread_gnu_p : 1; + /* Whether "const" was specified. */ + BOOL_BITFIELD const_p : 1; + /* Whether "volatile" was specified. */ + BOOL_BITFIELD volatile_p : 1; + /* Whether "restrict" was specified. */ + BOOL_BITFIELD restrict_p : 1; + /* Whether "_Atomic" was specified. */ + BOOL_BITFIELD atomic_p : 1; + /* Whether "_Sat" was specified. */ + BOOL_BITFIELD saturating_p : 1; + /* Whether any alignment specifier (even with zero alignment) was + specified. */ + BOOL_BITFIELD alignas_p : 1; + /* Whether any __GIMPLE specifier was specified. */ + BOOL_BITFIELD gimple_p : 1; + /* Whether any __RTL specifier was specified. */ + BOOL_BITFIELD rtl_p : 1; + /* The address space that the declaration belongs to. */ + addr_space_t address_space; +}; + +/* The various kinds of declarators in C. */ +enum c_declarator_kind { + /* An identifier. */ + cdk_id, + /* A function. */ + cdk_function, + /* An array. */ + cdk_array, + /* A pointer. */ + cdk_pointer, + /* Parenthesized declarator with nested attributes. */ + cdk_attrs +}; + +struct c_arg_tag { + /* The argument name. */ + tree id; + /* The type of the argument. */ + tree type; +}; + + +/* Information about the parameters in a function declarator. */ +struct c_arg_info { + /* A list of parameter decls. */ + tree parms; + /* A list of structure, union and enum tags defined. */ + vec *tags; + /* A list of argument types to go in the FUNCTION_TYPE. */ + tree types; + /* A list of non-parameter decls (notably enumeration constants) + defined with the parameters. */ + tree others; + /* A compound expression of VLA sizes from the parameters, or NULL. + In a function definition, these are used to ensure that + side-effects in sizes of arrays converted to pointers (such as a + parameter int i[n++]) take place; otherwise, they are + ignored. */ + tree pending_sizes; + /* True when these arguments had [*]. */ + BOOL_BITFIELD had_vla_unspec : 1; +}; + +/* A declarator. */ +struct c_declarator { + /* The kind of declarator. */ + enum c_declarator_kind kind; + location_t id_loc; /* Currently only set for cdk_id, cdk_array. */ + /* Except for cdk_id, the contained declarator. For cdk_id, NULL. */ + struct c_declarator *declarator; + union { + /* For identifiers, an IDENTIFIER_NODE or NULL_TREE if an abstract + declarator. */ + tree id; + /* For functions. */ + struct c_arg_info *arg_info; + /* For arrays. */ + struct { + /* The array dimension, or NULL for [] and [*]. */ + tree dimen; + /* The qualifiers inside []. */ + int quals; + /* The attributes (currently ignored) inside []. */ + tree attrs; + /* Whether [static] was used. */ + BOOL_BITFIELD static_p : 1; + /* Whether [*] was used. */ + BOOL_BITFIELD vla_unspec_p : 1; + } array; + /* For pointers, the qualifiers on the pointer type. */ + int pointer_quals; + /* For attributes. */ + tree attrs; + } u; +}; + +/* A type name. */ +struct c_type_name { + /* The declaration specifiers. */ + struct c_declspecs *specs; + /* The declarator. */ + struct c_declarator *declarator; +}; + +/* A parameter. */ +struct c_parm { + /* The declaration specifiers, minus any prefix attributes. */ + struct c_declspecs *specs; + /* The attributes. */ + tree attrs; + /* The declarator. */ + struct c_declarator *declarator; +}; + +/* Used when parsing an enum. Initialized by start_enum. */ +struct c_enum_contents +{ + /* While defining an enum type, this is 1 plus the last enumerator + constant value. */ + tree enum_next_value; + + /* Nonzero means that there was overflow computing enum_next_value. */ + int enum_overflow; +}; + +/* A type of reference to a static identifier in an inline + function. */ +enum c_inline_static_type { + /* Identifier with internal linkage used in function that may be an + inline definition (i.e., file-scope static). */ + csi_internal, + /* Modifiable object with static storage duration defined in + function that may be an inline definition (i.e., local + static). */ + csi_modifiable +}; + + +/* in c-parser.c */ +extern void c_parse_init (void); +extern bool c_keyword_starts_typename (enum rid keyword); + +/* in c-aux-info.c */ +extern void gen_aux_info_record (tree, int, int, int); + +/* in c-decl.c */ +struct c_spot_bindings; +struct c_struct_parse_info; +extern struct obstack parser_obstack; +extern tree c_break_label; +extern tree c_cont_label; + +extern bool global_bindings_p (void); +extern void push_scope (void); +extern tree pop_scope (void); +extern void c_bindings_start_stmt_expr (struct c_spot_bindings *); +extern void c_bindings_end_stmt_expr (struct c_spot_bindings *); + +extern void record_inline_static (location_t, tree, tree, + enum c_inline_static_type); +extern void c_init_decl_processing (void); +extern void c_print_identifier (FILE *, tree, int); +extern int quals_from_declspecs (const struct c_declspecs *); +extern struct c_declarator *build_array_declarator (location_t, tree, + struct c_declspecs *, + bool, bool); +extern tree build_enumerator (location_t, location_t, struct c_enum_contents *, + tree, tree); +extern tree check_for_loop_decls (location_t, bool); +extern void mark_forward_parm_decls (void); +extern void declare_parm_level (void); +extern void undeclared_variable (location_t, tree); +extern tree lookup_label_for_goto (location_t, tree); +extern tree declare_label (tree); +extern tree define_label (location_t, tree); +extern struct c_spot_bindings *c_get_switch_bindings (void); +extern void c_release_switch_bindings (struct c_spot_bindings *); +extern bool c_check_switch_jump_warnings (struct c_spot_bindings *, + location_t, location_t); +extern void finish_decl (tree, location_t, tree, tree, tree); +extern tree finish_enum (tree, tree, tree); +extern void finish_function (void); +extern tree finish_struct (location_t, tree, tree, tree, + struct c_struct_parse_info *); +extern struct c_arg_info *build_arg_info (void); +extern struct c_arg_info *get_parm_info (bool, tree); +extern tree grokfield (location_t, struct c_declarator *, + struct c_declspecs *, tree, tree *); +extern tree groktypename (struct c_type_name *, tree *, bool *); +extern tree grokparm (const struct c_parm *, tree *); +extern tree implicitly_declare (location_t, tree); +extern void keep_next_level (void); +extern void pending_xref_error (void); +extern void c_push_function_context (void); +extern void c_pop_function_context (void); +extern void push_parm_decl (const struct c_parm *, tree *); +extern struct c_declarator *set_array_declarator_inner (struct c_declarator *, + struct c_declarator *); +extern tree c_builtin_function (tree); +extern tree c_builtin_function_ext_scope (tree); +extern void shadow_tag (const struct c_declspecs *); +extern void shadow_tag_warned (const struct c_declspecs *, int); +extern tree start_enum (location_t, struct c_enum_contents *, tree); +extern int start_function (struct c_declspecs *, struct c_declarator *, tree); +extern tree start_decl (struct c_declarator *, struct c_declspecs *, bool, + tree); +extern tree start_struct (location_t, enum tree_code, tree, + struct c_struct_parse_info **); +extern void store_parm_decls (void); +extern void store_parm_decls_from (struct c_arg_info *); +extern void temp_store_parm_decls (tree, tree); +extern void temp_pop_parm_decls (void); +extern tree xref_tag (enum tree_code, tree); +extern struct c_typespec parser_xref_tag (location_t, enum tree_code, tree); +extern struct c_parm *build_c_parm (struct c_declspecs *, tree, + struct c_declarator *); +extern struct c_declarator *build_attrs_declarator (tree, + struct c_declarator *); +extern struct c_declarator *build_function_declarator (struct c_arg_info *, + struct c_declarator *); +extern struct c_declarator *build_id_declarator (tree); +extern struct c_declarator *make_pointer_declarator (struct c_declspecs *, + struct c_declarator *); +extern struct c_declspecs *build_null_declspecs (void); +extern struct c_declspecs *declspecs_add_qual (source_location, + struct c_declspecs *, tree); +extern struct c_declspecs *declspecs_add_type (location_t, + struct c_declspecs *, + struct c_typespec); +extern struct c_declspecs *declspecs_add_scspec (source_location, + struct c_declspecs *, tree); +extern struct c_declspecs *declspecs_add_attrs (source_location, + struct c_declspecs *, tree); +extern struct c_declspecs *declspecs_add_addrspace (source_location, + struct c_declspecs *, + addr_space_t); +extern struct c_declspecs *declspecs_add_alignas (source_location, + struct c_declspecs *, tree); +extern struct c_declspecs *finish_declspecs (struct c_declspecs *); + +/* in c-objc-common.c */ +extern bool c_objc_common_init (void); +extern bool c_missing_noreturn_ok_p (tree); +extern bool c_warn_unused_global_decl (const_tree); +extern void c_initialize_diagnostics (diagnostic_context *); +extern bool c_vla_unspec_p (tree x, tree fn); + +/* in c-typeck.c */ +extern int in_alignof; +extern int in_sizeof; +extern int in_typeof; + +extern tree c_last_sizeof_arg; + +extern struct c_switch *c_switch_stack; + +extern tree c_objc_common_truthvalue_conversion (location_t, tree); +extern tree require_complete_type (location_t, tree); +extern int same_translation_unit_p (const_tree, const_tree); +extern int comptypes (tree, tree); +extern int comptypes_check_different_types (tree, tree, bool *); +extern bool c_vla_type_p (const_tree); +extern bool c_mark_addressable (tree, bool = false); +extern void c_incomplete_type_error (location_t, const_tree, const_tree); +extern tree c_type_promotes_to (tree); +extern struct c_expr default_function_array_conversion (location_t, + struct c_expr); +extern struct c_expr default_function_array_read_conversion (location_t, + struct c_expr); +extern struct c_expr convert_lvalue_to_rvalue (location_t, struct c_expr, + bool, bool); +extern void mark_exp_read (tree); +extern tree composite_type (tree, tree); +extern tree build_component_ref (location_t, tree, tree, location_t); +extern tree build_array_ref (location_t, tree, tree); +extern tree build_external_ref (location_t, tree, int, tree *); +extern void pop_maybe_used (bool); +extern struct c_expr c_expr_sizeof_expr (location_t, struct c_expr); +extern struct c_expr c_expr_sizeof_type (location_t, struct c_type_name *); +extern struct c_expr parser_build_unary_op (location_t, enum tree_code, + struct c_expr); +extern struct c_expr parser_build_binary_op (location_t, + enum tree_code, struct c_expr, + struct c_expr); +extern tree build_conditional_expr (location_t, tree, bool, tree, tree, + tree, tree); +extern tree build_compound_expr (location_t, tree, tree); +extern tree c_cast_expr (location_t, struct c_type_name *, tree); +extern tree build_c_cast (location_t, tree, tree); +extern void store_init_value (location_t, tree, tree, tree); +extern void maybe_warn_string_init (location_t, tree, struct c_expr); +extern void start_init (tree, tree, int, rich_location *); +extern void finish_init (void); +extern void really_start_incremental_init (tree); +extern void finish_implicit_inits (location_t, struct obstack *); +extern void push_init_level (location_t, int, struct obstack *); +extern struct c_expr pop_init_level (location_t, int, struct obstack *, + location_t); +extern void set_init_index (location_t, tree, tree, struct obstack *); +extern void set_init_label (location_t, tree, location_t, struct obstack *); +extern void process_init_element (location_t, struct c_expr, bool, + struct obstack *); +extern tree build_compound_literal (location_t, tree, tree, bool); +extern void check_compound_literal_type (location_t, struct c_type_name *); +extern tree c_start_case (location_t, location_t, tree, bool); +extern void c_finish_case (tree, tree); +extern tree build_asm_expr (location_t, tree, tree, tree, tree, tree, bool); +extern tree build_asm_stmt (tree, tree); +extern int c_types_compatible_p (tree, tree); +extern tree c_begin_compound_stmt (bool); +extern tree c_end_compound_stmt (location_t, tree, bool); +extern void c_finish_if_stmt (location_t, tree, tree, tree); +extern void c_finish_loop (location_t, tree, tree, tree, tree, tree, bool); +extern tree c_begin_stmt_expr (void); +extern tree c_finish_stmt_expr (location_t, tree); +extern tree c_process_expr_stmt (location_t, tree); +extern tree c_finish_expr_stmt (location_t, tree); +extern tree c_finish_return (location_t, tree, tree); +extern tree c_finish_bc_stmt (location_t, tree *, bool); +extern tree c_finish_goto_label (location_t, tree); +extern tree c_finish_goto_ptr (location_t, tree); +extern tree c_expr_to_decl (tree, bool *, bool *); +extern tree c_finish_omp_construct (location_t, enum tree_code, tree, tree); +extern tree c_finish_oacc_data (location_t, tree, tree); +extern tree c_finish_oacc_host_data (location_t, tree, tree); +extern tree c_begin_omp_parallel (void); +extern tree c_finish_omp_parallel (location_t, tree, tree); +extern tree c_begin_omp_task (void); +extern tree c_finish_omp_task (location_t, tree, tree); +extern void c_finish_omp_cancel (location_t, tree); +extern void c_finish_omp_cancellation_point (location_t, tree); +extern tree c_finish_omp_clauses (tree, enum c_omp_region_type); +extern tree c_build_va_arg (location_t, tree, location_t, tree); +extern tree c_finish_transaction (location_t, tree, int); +extern bool c_tree_equal (tree, tree); +extern tree c_build_function_call_vec (location_t, vec, tree, + vec *, vec *); +extern tree c_omp_clause_copy_ctor (tree, tree, tree); + +/* Set to 0 at beginning of a function definition, set to 1 if + a return statement that specifies a return value is seen. */ + +extern int current_function_returns_value; + +/* Set to 0 at beginning of a function definition, set to 1 if + a return statement with no argument is seen. */ + +extern int current_function_returns_null; + +/* Set to 0 at beginning of a function definition, set to 1 if + a call to a noreturn function is seen. */ + +extern int current_function_returns_abnormally; + +/* In c-decl.c */ + +/* Tell the binding oracle what kind of binding we are looking for. */ + +enum c_oracle_request +{ + C_ORACLE_SYMBOL, + C_ORACLE_TAG, + C_ORACLE_LABEL +}; + +/* If this is non-NULL, then it is a "binding oracle" which can lazily + create bindings when needed by the C compiler. The oracle is told + the name and type of the binding to create. It can call pushdecl + or the like to ensure the binding is visible; or do nothing, + leaving the binding untouched. c-decl.c takes note of when the + oracle has been called and will not call it again if it fails to + create a given binding. */ + +typedef void c_binding_oracle_function (enum c_oracle_request, tree identifier); + +extern c_binding_oracle_function *c_binding_oracle; + +extern void c_finish_incomplete_decl (tree); +extern tree c_omp_reduction_id (enum tree_code, tree); +extern tree c_omp_reduction_decl (tree); +extern tree c_omp_reduction_lookup (tree, tree); +extern tree c_check_omp_declare_reduction_r (tree *, int *, void *); +extern void c_pushtag (location_t, tree, tree); +extern void c_bind (location_t, tree, bool); +extern bool tag_exists_p (enum tree_code, tree); + +/* In c-errors.c */ +extern bool pedwarn_c90 (location_t, int opt, const char *, ...) + ATTRIBUTE_GCC_DIAG(3,4); +extern bool pedwarn_c99 (location_t, int opt, const char *, ...) + ATTRIBUTE_GCC_DIAG(3,4); + +extern void +set_c_expr_source_range (c_expr *expr, + location_t start, location_t finish); + +extern void +set_c_expr_source_range (c_expr *expr, + source_range src_range); + +/* In c-fold.c */ +extern tree decl_constant_value_for_optimization (tree); + +extern vec incomplete_record_decls; + +#endif /* ! GCC_C_TREE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/calls.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/calls.h new file mode 100644 index 0000000..df5817f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/calls.h @@ -0,0 +1,43 @@ +/* Declarations and data types for RTL call insn generation. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_CALLS_H +#define GCC_CALLS_H + +extern int flags_from_decl_or_type (const_tree); +extern int call_expr_flags (const_tree); +extern int setjmp_call_p (const_tree); +extern bool gimple_maybe_alloca_call_p (const gimple *); +extern bool gimple_alloca_call_p (const gimple *); +extern bool alloca_call_p (const_tree); +extern bool must_pass_in_stack_var_size (machine_mode, const_tree); +extern bool must_pass_in_stack_var_size_or_pad (machine_mode, const_tree); +extern rtx prepare_call_address (tree, rtx, rtx, rtx *, int, int); +extern bool shift_return_value (machine_mode, bool, rtx); +extern rtx expand_call (tree, rtx, int); +extern void fixup_tail_calls (void); + +extern bool pass_by_reference (CUMULATIVE_ARGS *, machine_mode, + tree, bool); +extern bool reference_callee_copied (CUMULATIVE_ARGS *, machine_mode, + tree, bool); +extern void maybe_warn_alloc_args_overflow (tree, tree, tree[2], int[2]); +extern bool get_size_range (tree, tree[2]); + +#endif // GCC_CALLS_H diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ccmp.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ccmp.h new file mode 100644 index 0000000..bc1aafb --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ccmp.h @@ -0,0 +1,25 @@ +/* Conditional comapre related functions. + Copyright (C) 2014-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_CCMP_H +#define GCC_CCMP_H + +extern rtx expand_ccmp_expr (gimple *); + +#endif /* GCC_CCMP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfg.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfg.h new file mode 100644 index 0000000..b44f1e1 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfg.h @@ -0,0 +1,121 @@ +/* Control flow graph manipulation code header file. + Copyright (C) 2014-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_CFG_H +#define GCC_CFG_H + +#include "dominance.h" + +/* What sort of profiling information we have. */ +enum profile_status_d +{ + PROFILE_ABSENT, + PROFILE_GUESSED, + PROFILE_READ, + PROFILE_LAST /* Last value, used by profile streaming. */ +}; + +/* A structure to group all the per-function control flow graph data. + The x_* prefixing is necessary because otherwise references to the + fields of this struct are interpreted as the defines for backward + source compatibility following the definition of this struct. */ +struct GTY(()) control_flow_graph { + /* Block pointers for the exit and entry of a function. + These are always the head and tail of the basic block list. */ + basic_block x_entry_block_ptr; + basic_block x_exit_block_ptr; + + /* Index by basic block number, get basic block struct info. */ + vec *x_basic_block_info; + + /* Number of basic blocks in this flow graph. */ + int x_n_basic_blocks; + + /* Number of edges in this flow graph. */ + int x_n_edges; + + /* The first free basic block number. */ + int x_last_basic_block; + + /* UIDs for LABEL_DECLs. */ + int last_label_uid; + + /* Mapping of labels to their associated blocks. At present + only used for the gimple CFG. */ + vec *x_label_to_block_map; + + enum profile_status_d x_profile_status; + + /* Whether the dominators and the postdominators are available. */ + enum dom_state x_dom_computed[2]; + + /* Number of basic blocks in the dominance tree. */ + unsigned x_n_bbs_in_dom_tree[2]; + + /* Maximal number of entities in the single jumptable. Used to estimate + final flowgraph size. */ + int max_jumptable_ents; +}; + + +extern void init_flow (function *); +extern void clear_edges (function *); +extern basic_block alloc_block (void); +extern void link_block (basic_block, basic_block); +extern void unlink_block (basic_block); +extern void compact_blocks (void); +extern void expunge_block (basic_block); +extern edge unchecked_make_edge (basic_block, basic_block, int); +extern edge cached_make_edge (sbitmap, basic_block, basic_block, int); +extern edge make_edge (basic_block, basic_block, int); +extern edge make_single_succ_edge (basic_block, basic_block, int); +extern void remove_edge_raw (edge); +extern void redirect_edge_succ (edge, basic_block); +extern void redirect_edge_pred (edge, basic_block); +extern void clear_bb_flags (void); +extern void dump_edge_info (FILE *, edge, int, int); +extern void debug (edge_def &ref); +extern void debug (edge_def *ptr); +extern void alloc_aux_for_blocks (int); +extern void clear_aux_for_blocks (void); +extern void free_aux_for_blocks (void); +extern void alloc_aux_for_edge (edge, int); +extern void alloc_aux_for_edges (int); +extern void clear_aux_for_edges (void); +extern void free_aux_for_edges (void); +extern void debug_bb (basic_block); +extern basic_block debug_bb_n (int); +extern void dump_bb_info (FILE *, basic_block, int, int, bool, bool); +extern void brief_dump_cfg (FILE *, int); +extern void update_bb_profile_for_threading (basic_block, int, gcov_type, edge); +extern void scale_bbs_frequencies_int (basic_block *, int, int, int); +extern void scale_bbs_frequencies_gcov_type (basic_block *, int, gcov_type, + gcov_type); +extern void initialize_original_copy_tables (void); +extern void reset_original_copy_tables (void); +extern void free_original_copy_tables (void); +extern bool original_copy_tables_initialized_p (void); +extern void set_bb_original (basic_block, basic_block); +extern basic_block get_bb_original (basic_block); +extern void set_bb_copy (basic_block, basic_block); +extern basic_block get_bb_copy (basic_block); +void set_loop_copy (struct loop *, struct loop *); +struct loop *get_loop_copy (struct loop *); + +#endif /* GCC_CFG_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfganal.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfganal.h new file mode 100644 index 0000000..7df484b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfganal.h @@ -0,0 +1,81 @@ +/* Control flow graph analysis header file. + Copyright (C) 2014-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + + +#ifndef GCC_CFGANAL_H +#define GCC_CFGANAL_H + +/* This structure maintains an edge list vector. */ +/* FIXME: Make this a vec. */ +struct edge_list +{ + int num_edges; + edge *index_to_edge; +}; + + +/* Class to compute and manage control dependences on an edge-list. */ +class control_dependences +{ +public: + control_dependences (); + ~control_dependences (); + bitmap get_edges_dependent_on (int); + basic_block get_edge_src (int); + basic_block get_edge_dest (int); + +private: + void set_control_dependence_map_bit (basic_block, int); + void clear_control_dependence_bitmap (basic_block); + void find_control_dependence (int); + vec control_dependence_map; + vec > m_el; +}; + +extern bool mark_dfs_back_edges (void); +extern void find_unreachable_blocks (void); +extern void verify_no_unreachable_blocks (void); +struct edge_list * create_edge_list (void); +void free_edge_list (struct edge_list *); +void print_edge_list (FILE *, struct edge_list *); +void verify_edge_list (FILE *, struct edge_list *); +edge find_edge (basic_block, basic_block); +int find_edge_index (struct edge_list *, basic_block, basic_block); +extern void remove_fake_edges (void); +extern void remove_fake_exit_edges (void); +extern void add_noreturn_fake_exit_edges (void); +extern void connect_infinite_loops_to_exit (void); +extern int post_order_compute (int *, bool, bool); +extern basic_block dfs_find_deadend (basic_block); +extern int inverted_post_order_compute (int *, sbitmap *start_points = 0); +extern int pre_and_rev_post_order_compute_fn (struct function *, + int *, int *, bool); +extern int pre_and_rev_post_order_compute (int *, int *, bool); +extern int dfs_enumerate_from (basic_block, int, + bool (*)(const_basic_block, const void *), + basic_block *, int, const void *); +extern void compute_dominance_frontiers (struct bitmap_head *); +extern bitmap compute_idf (bitmap, struct bitmap_head *); +extern void bitmap_intersection_of_succs (sbitmap, sbitmap *, basic_block); +extern void bitmap_intersection_of_preds (sbitmap, sbitmap *, basic_block); +extern void bitmap_union_of_succs (sbitmap, sbitmap *, basic_block); +extern void bitmap_union_of_preds (sbitmap, sbitmap *, basic_block); +extern basic_block * single_pred_before_succ_order (void); + +#endif /* GCC_CFGANAL_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgbuild.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgbuild.h new file mode 100644 index 0000000..afda5ac --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgbuild.h @@ -0,0 +1,28 @@ +/* Control flow graph building header file. + Copyright (C) 2014-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_CFGBUILD_H +#define GCC_CFGBUILD_H + +extern bool inside_basic_block_p (const rtx_insn *); +extern bool control_flow_insn_p (const rtx_insn *); +extern void rtl_make_eh_edge (sbitmap, basic_block, rtx); +extern void find_many_sub_basic_blocks (sbitmap); + +#endif /* GCC_CFGBUILD_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgcleanup.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgcleanup.h new file mode 100644 index 0000000..0cba367 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgcleanup.h @@ -0,0 +1,34 @@ +/* Control flow optimization header file. + Copyright (C) 2014-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + + +#ifndef GCC_CFGCLEANUP_H +#define GCC_CFGCLEANUP_H + +enum replace_direction { dir_none, dir_forward, dir_backward, dir_both }; + +extern int flow_find_cross_jump (basic_block, basic_block, rtx_insn **, + rtx_insn **, enum replace_direction*); +extern int flow_find_head_matching_sequence (basic_block, basic_block, + rtx_insn **, rtx_insn **, int); +extern bool delete_unreachable_blocks (void); +extern void delete_dead_jumptables (void); +extern bool cleanup_cfg (int); + +#endif /* GCC_CFGCLEANUP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgexpand.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgexpand.h new file mode 100644 index 0000000..0596735 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgexpand.h @@ -0,0 +1,28 @@ +/* Header file for lowering trees to RTL. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_CFGEXPAND_H +#define GCC_CFGEXPAND_H + +extern tree gimple_assign_rhs_to_tree (gimple *); +extern HOST_WIDE_INT estimated_stack_frame_size (struct cgraph_node *); +extern void set_parm_rtl (tree, rtx); + + +#endif /* GCC_CFGEXPAND_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfghooks.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfghooks.h new file mode 100644 index 0000000..4c1abe7 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfghooks.h @@ -0,0 +1,272 @@ +/* Hooks for cfg representation specific functions. + Copyright (C) 2003-2017 Free Software Foundation, Inc. + Contributed by Sebastian Pop + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_CFGHOOKS_H +#define GCC_CFGHOOKS_H + +#include "predict.h" + +/* Structure to gather statistic about profile consistency, per pass. + An array of this structure, indexed by pass static number, is allocated + in passes.c. The structure is defined here so that different CFG modes + can do their book-keeping via CFG hooks. + + For every field[2], field[0] is the count before the pass runs, and + field[1] is the post-pass count. This allows us to monitor the effect + of each individual pass on the profile consistency. + + This structure is not supposed to be used by anything other than passes.c + and one CFG hook per CFG mode. */ +struct profile_record +{ + /* The number of basic blocks where sum(freq) of the block's predecessors + doesn't match reasonably well with the incoming frequency. */ + int num_mismatched_freq_in[2]; + /* Likewise for a basic block's successors. */ + int num_mismatched_freq_out[2]; + /* The number of basic blocks where sum(count) of the block's predecessors + doesn't match reasonably well with the incoming frequency. */ + int num_mismatched_count_in[2]; + /* Likewise for a basic block's successors. */ + int num_mismatched_count_out[2]; + /* A weighted cost of the run-time of the function body. */ + gcov_type time[2]; + /* A weighted cost of the size of the function body. */ + int size[2]; + /* True iff this pass actually was run. */ + bool run; +}; + + +struct cfg_hooks +{ + /* Name of the corresponding ir. */ + const char *name; + + /* Debugging. */ + int (*verify_flow_info) (void); + void (*dump_bb) (FILE *, basic_block, int, int); + void (*dump_bb_for_graph) (pretty_printer *, basic_block); + + /* Basic CFG manipulation. */ + + /* Return new basic block. */ + basic_block (*create_basic_block) (void *head, void *end, basic_block after); + + /* Redirect edge E to the given basic block B and update underlying program + representation. Returns edge representing redirected branch (that may not + be equivalent to E in the case of duplicate edges being removed) or NULL + if edge is not easily redirectable for whatever reason. */ + edge (*redirect_edge_and_branch) (edge e, basic_block b); + + /* Same as the above but allows redirecting of fallthru edges. In that case + newly created forwarder basic block is returned. The edge must + not be abnormal. */ + basic_block (*redirect_edge_and_branch_force) (edge, basic_block); + + /* Returns true if it is possible to remove the edge by redirecting it + to the destination of the other edge going from its source. */ + bool (*can_remove_branch_p) (const_edge); + + /* Remove statements corresponding to a given basic block. */ + void (*delete_basic_block) (basic_block); + + /* Creates a new basic block just after basic block B by splitting + everything after specified instruction I. */ + basic_block (*split_block) (basic_block b, void * i); + + /* Move block B immediately after block A. */ + bool (*move_block_after) (basic_block b, basic_block a); + + /* Return true when blocks A and B can be merged into single basic block. */ + bool (*can_merge_blocks_p) (basic_block a, basic_block b); + + /* Merge blocks A and B. */ + void (*merge_blocks) (basic_block a, basic_block b); + + /* Predict edge E using PREDICTOR to given PROBABILITY. */ + void (*predict_edge) (edge e, enum br_predictor predictor, int probability); + + /* Return true if the one of outgoing edges is already predicted by + PREDICTOR. */ + bool (*predicted_by_p) (const_basic_block bb, enum br_predictor predictor); + + /* Return true when block A can be duplicated. */ + bool (*can_duplicate_block_p) (const_basic_block a); + + /* Duplicate block A. */ + basic_block (*duplicate_block) (basic_block a); + + /* Higher level functions representable by primitive operations above if + we didn't have some oddities in RTL and Tree representations. */ + basic_block (*split_edge) (edge); + void (*make_forwarder_block) (edge); + + /* Try to make the edge fallthru. */ + void (*tidy_fallthru_edge) (edge); + + /* Make the edge non-fallthru. */ + basic_block (*force_nonfallthru) (edge); + + /* Say whether a block ends with a call, possibly followed by some + other code that must stay with the call. */ + bool (*block_ends_with_call_p) (basic_block); + + /* Say whether a block ends with a conditional branch. Switches + and unconditional branches do not qualify. */ + bool (*block_ends_with_condjump_p) (const_basic_block); + + /* Add fake edges to the function exit for any non constant and non noreturn + calls, volatile inline assembly in the bitmap of blocks specified by + BLOCKS or to the whole CFG if BLOCKS is zero. Return the number of blocks + that were split. + + The goal is to expose cases in which entering a basic block does not imply + that all subsequent instructions must be executed. */ + int (*flow_call_edges_add) (sbitmap); + + /* This function is called immediately after edge E is added to the + edge vector E->dest->preds. */ + void (*execute_on_growing_pred) (edge); + + /* This function is called immediately before edge E is removed from + the edge vector E->dest->preds. */ + void (*execute_on_shrinking_pred) (edge); + + /* A hook for duplicating loop in CFG, currently this is used + in loop versioning. */ + bool (*cfg_hook_duplicate_loop_to_header_edge) (struct loop *, edge, + unsigned, sbitmap, + edge, vec *, + int); + + /* Add condition to new basic block and update CFG used in loop + versioning. */ + void (*lv_add_condition_to_bb) (basic_block, basic_block, basic_block, + void *); + /* Update the PHI nodes in case of loop versioning. */ + void (*lv_adjust_loop_header_phi) (basic_block, basic_block, + basic_block, edge); + + /* Given a condition BB extract the true/false taken/not taken edges + (depending if we are on tree's or RTL). */ + void (*extract_cond_bb_edges) (basic_block, edge *, edge *); + + + /* Add PHI arguments queued in PENDINT_STMT list on edge E to edge + E->dest (only in tree-ssa loop versioning. */ + void (*flush_pending_stmts) (edge); + + /* True if a block contains no executable instructions. */ + bool (*empty_block_p) (basic_block); + + /* Split a basic block if it ends with a conditional branch and if + the other part of the block is not empty. */ + basic_block (*split_block_before_cond_jump) (basic_block); + + /* Do book-keeping of a basic block for the profile consistency checker. */ + void (*account_profile_record) (basic_block, int, struct profile_record *); +}; + +extern void verify_flow_info (void); + +/* Check control flow invariants, if internal consistency checks are + enabled. */ + +static inline void +checking_verify_flow_info (void) +{ + /* TODO: Add a separate option for -fchecking=cfg. */ + if (flag_checking) + verify_flow_info (); +} + +extern void dump_bb (FILE *, basic_block, int, int); +extern void dump_bb_for_graph (pretty_printer *, basic_block); +extern void dump_flow_info (FILE *, int); + +extern edge redirect_edge_and_branch (edge, basic_block); +extern basic_block redirect_edge_and_branch_force (edge, basic_block); +extern edge redirect_edge_succ_nodup (edge, basic_block); +extern bool can_remove_branch_p (const_edge); +extern void remove_branch (edge); +extern void remove_edge (edge); +extern edge split_block (basic_block, rtx); +extern edge split_block (basic_block, gimple *); +extern edge split_block_after_labels (basic_block); +extern bool move_block_after (basic_block, basic_block); +extern void delete_basic_block (basic_block); +extern basic_block split_edge (edge); +extern basic_block create_basic_block (rtx, rtx, basic_block); +extern basic_block create_basic_block (gimple_seq, basic_block); +extern basic_block create_empty_bb (basic_block); +extern bool can_merge_blocks_p (basic_block, basic_block); +extern void merge_blocks (basic_block, basic_block); +extern edge make_forwarder_block (basic_block, bool (*)(edge), + void (*) (basic_block)); +extern basic_block force_nonfallthru (edge); +extern void tidy_fallthru_edge (edge); +extern void tidy_fallthru_edges (void); +extern void predict_edge (edge e, enum br_predictor predictor, int probability); +extern bool predicted_by_p (const_basic_block bb, enum br_predictor predictor); +extern bool can_duplicate_block_p (const_basic_block); +extern basic_block duplicate_block (basic_block, edge, basic_block); +extern bool block_ends_with_call_p (basic_block bb); +extern bool empty_block_p (basic_block); +extern basic_block split_block_before_cond_jump (basic_block); +extern bool block_ends_with_condjump_p (const_basic_block bb); +extern int flow_call_edges_add (sbitmap); +extern void execute_on_growing_pred (edge); +extern void execute_on_shrinking_pred (edge); +extern bool cfg_hook_duplicate_loop_to_header_edge (struct loop *loop, edge, + unsigned int ndupl, + sbitmap wont_exit, + edge orig, + vec *to_remove, + int flags); + +extern void lv_flush_pending_stmts (edge); +extern void extract_cond_bb_edges (basic_block, edge *, edge*); +extern void lv_adjust_loop_header_phi (basic_block, basic_block, basic_block, + edge); +extern void lv_add_condition_to_bb (basic_block, basic_block, basic_block, + void *); + +extern bool can_copy_bbs_p (basic_block *, unsigned); +extern void copy_bbs (basic_block *, unsigned, basic_block *, + edge *, unsigned, edge *, struct loop *, + basic_block, bool); + +void account_profile_record (struct profile_record *, int); + +/* Hooks containers. */ +extern struct cfg_hooks gimple_cfg_hooks; +extern struct cfg_hooks rtl_cfg_hooks; +extern struct cfg_hooks cfg_layout_rtl_cfg_hooks; + +/* Declarations. */ +extern enum ir_type current_ir_type (void); +extern void rtl_register_cfg_hooks (void); +extern void cfg_layout_rtl_register_cfg_hooks (void); +extern void gimple_register_cfg_hooks (void); +extern struct cfg_hooks get_cfg_hooks (void); +extern void set_cfg_hooks (struct cfg_hooks); + +#endif /* GCC_CFGHOOKS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgloop.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgloop.h new file mode 100644 index 0000000..a8bec1d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgloop.h @@ -0,0 +1,854 @@ +/* Natural loop functions + Copyright (C) 1987-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_CFGLOOP_H +#define GCC_CFGLOOP_H + +#include "cfgloopmanip.h" + +/* Structure to hold decision about unrolling/peeling. */ +enum lpt_dec +{ + LPT_NONE, + LPT_UNROLL_CONSTANT, + LPT_UNROLL_RUNTIME, + LPT_UNROLL_STUPID +}; + +struct GTY (()) lpt_decision { + enum lpt_dec decision; + unsigned times; +}; + +/* The type of extend applied to an IV. */ +enum iv_extend_code +{ + IV_SIGN_EXTEND, + IV_ZERO_EXTEND, + IV_UNKNOWN_EXTEND +}; + +/* The structure describing a bound on number of iterations of a loop. */ + +struct GTY ((chain_next ("%h.next"))) nb_iter_bound { + /* The statement STMT is executed at most ... */ + gimple *stmt; + + /* ... BOUND + 1 times (BOUND must be an unsigned constant). + The + 1 is added for the following reasons: + + a) 0 would otherwise be unused, while we would need to care more about + overflows (as MAX + 1 is sometimes produced as the estimate on number + of executions of STMT). + b) it is consistent with the result of number_of_iterations_exit. */ + widest_int bound; + + /* True if the statement will cause the loop to be leaved the (at most) + BOUND + 1-st time it is executed, that is, all the statements after it + are executed at most BOUND times. */ + bool is_exit; + + /* The next bound in the list. */ + struct nb_iter_bound *next; +}; + +/* Description of the loop exit. */ + +struct GTY ((for_user)) loop_exit { + /* The exit edge. */ + edge e; + + /* Previous and next exit in the list of the exits of the loop. */ + struct loop_exit *prev; + struct loop_exit *next; + + /* Next element in the list of loops from that E exits. */ + struct loop_exit *next_e; +}; + +struct loop_exit_hasher : ggc_ptr_hash +{ + typedef edge compare_type; + + static hashval_t hash (loop_exit *); + static bool equal (loop_exit *, edge); + static void remove (loop_exit *); +}; + +typedef struct loop *loop_p; + +/* An integer estimation of the number of iterations. Estimate_state + describes what is the state of the estimation. */ +enum loop_estimation +{ + /* Estimate was not computed yet. */ + EST_NOT_COMPUTED, + /* Estimate is ready. */ + EST_AVAILABLE, + EST_LAST +}; + +/* The structure describing non-overflow control induction variable for + loop's exit edge. */ +struct GTY ((chain_next ("%h.next"))) control_iv { + tree base; + tree step; + struct control_iv *next; +}; + +/* Structure to hold information for each natural loop. */ +struct GTY ((chain_next ("%h.next"))) loop { + /* Index into loops array. */ + int num; + + /* Number of loop insns. */ + unsigned ninsns; + + /* Basic block of loop header. */ + basic_block header; + + /* Basic block of loop latch. */ + basic_block latch; + + /* For loop unrolling/peeling decision. */ + struct lpt_decision lpt_decision; + + /* Average number of executed insns per iteration. */ + unsigned av_ninsns; + + /* Number of blocks contained within the loop. */ + unsigned num_nodes; + + /* Superloops of the loop, starting with the outermost loop. */ + vec *superloops; + + /* The first inner (child) loop or NULL if innermost loop. */ + struct loop *inner; + + /* Link to the next (sibling) loop. */ + struct loop *next; + + /* Auxiliary info specific to a pass. */ + PTR GTY ((skip (""))) aux; + + /* The number of times the latch of the loop is executed. This can be an + INTEGER_CST, or a symbolic expression representing the number of + iterations like "N - 1", or a COND_EXPR containing the runtime + conditions under which the number of iterations is non zero. + + Don't access this field directly: number_of_latch_executions + computes and caches the computed information in this field. */ + tree nb_iterations; + + /* An integer guaranteed to be greater or equal to nb_iterations. Only + valid if any_upper_bound is true. */ + widest_int nb_iterations_upper_bound; + + widest_int nb_iterations_likely_upper_bound; + + /* An integer giving an estimate on nb_iterations. Unlike + nb_iterations_upper_bound, there is no guarantee that it is at least + nb_iterations. */ + widest_int nb_iterations_estimate; + + /* If > 0, an integer, where the user asserted that for any + I in [ 0, nb_iterations ) and for any J in + [ I, min ( I + safelen, nb_iterations ) ), the Ith and Jth iterations + of the loop can be safely evaluated concurrently. */ + int safelen; + + /* Constraints are generally set by consumers and affect certain + semantics of niter analyzer APIs. Currently the APIs affected are + number_of_iterations_exit* functions and their callers. One typical + use case of constraints is to vectorize possibly infinite loop: + + 1) Compute niter->assumptions by calling niter analyzer API and + record it as possible condition for loop versioning. + 2) Clear buffered result of niter/scev analyzer. + 3) Set constraint LOOP_C_FINITE assuming the loop is finite. + 4) Analyze data references. Since data reference analysis depends + on niter/scev analyzer, the point is that niter/scev analysis + is done under circumstance of LOOP_C_FINITE constraint. + 5) Version the loop with niter->assumptions computed in step 1). + 6) Vectorize the versioned loop in which niter->assumptions is + checked to be true. + 7) Update constraints in versioned loops so that niter analyzer + in following passes can use it. + + Note consumers are usually the loop optimizers and it is consumers' + responsibility to set/clear constraints correctly. Failing to do + that might result in hard to track down bugs in niter/scev consumers. */ + unsigned constraints; + + /* An integer estimation of the number of iterations. Estimate_state + describes what is the state of the estimation. */ + ENUM_BITFIELD(loop_estimation) estimate_state : 8; + + unsigned any_upper_bound : 1; + unsigned any_estimate : 1; + unsigned any_likely_upper_bound : 1; + + /* True if the loop can be parallel. */ + unsigned can_be_parallel : 1; + + /* True if -Waggressive-loop-optimizations warned about this loop + already. */ + unsigned warned_aggressive_loop_optimizations : 1; + + /* True if this loop should never be vectorized. */ + unsigned dont_vectorize : 1; + + /* True if we should try harder to vectorize this loop. */ + unsigned force_vectorize : 1; + + /* True if the loop is part of an oacc kernels region. */ + unsigned in_oacc_kernels_region : 1; + + /* For SIMD loops, this is a unique identifier of the loop, referenced + by IFN_GOMP_SIMD_VF, IFN_GOMP_SIMD_LANE and IFN_GOMP_SIMD_LAST_LANE + builtins. */ + tree simduid; + + /* Upper bound on number of iterations of a loop. */ + struct nb_iter_bound *bounds; + + /* Non-overflow control ivs of a loop. */ + struct control_iv *control_ivs; + + /* Head of the cyclic list of the exits of the loop. */ + struct loop_exit *exits; + + /* Number of iteration analysis data for RTL. */ + struct niter_desc *simple_loop_desc; + + /* For sanity checking during loop fixup we record here the former + loop header for loops marked for removal. Note that this prevents + the basic-block from being collected but its index can still be + reused. */ + basic_block former_header; +}; + +/* Set if the loop is known to be infinite. */ +#define LOOP_C_INFINITE (1 << 0) +/* Set if the loop is known to be finite without any assumptions. */ +#define LOOP_C_FINITE (1 << 1) + +/* Set C to the LOOP constraint. */ +static inline void +loop_constraint_set (struct loop *loop, unsigned c) +{ + loop->constraints |= c; +} + +/* Clear C from the LOOP constraint. */ +static inline void +loop_constraint_clear (struct loop *loop, unsigned c) +{ + loop->constraints &= ~c; +} + +/* Check if C is set in the LOOP constraint. */ +static inline bool +loop_constraint_set_p (struct loop *loop, unsigned c) +{ + return (loop->constraints & c) == c; +} + +/* Flags for state of loop structure. */ +enum +{ + LOOPS_HAVE_PREHEADERS = 1, + LOOPS_HAVE_SIMPLE_LATCHES = 2, + LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS = 4, + LOOPS_HAVE_RECORDED_EXITS = 8, + LOOPS_MAY_HAVE_MULTIPLE_LATCHES = 16, + LOOP_CLOSED_SSA = 32, + LOOPS_NEED_FIXUP = 64, + LOOPS_HAVE_FALLTHRU_PREHEADERS = 128 +}; + +#define LOOPS_NORMAL (LOOPS_HAVE_PREHEADERS | LOOPS_HAVE_SIMPLE_LATCHES \ + | LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS) +#define AVOID_CFG_MODIFICATIONS (LOOPS_MAY_HAVE_MULTIPLE_LATCHES) + +/* Structure to hold CFG information about natural loops within a function. */ +struct GTY (()) loops { + /* State of loops. */ + int state; + + /* Array of the loops. */ + vec *larray; + + /* Maps edges to the list of their descriptions as loop exits. Edges + whose sources or destinations have loop_father == NULL (which may + happen during the cfg manipulations) should not appear in EXITS. */ + hash_table *GTY(()) exits; + + /* Pointer to root of loop hierarchy tree. */ + struct loop *tree_root; +}; + +/* Loop recognition. */ +bool bb_loop_header_p (basic_block); +void init_loops_structure (struct function *, struct loops *, unsigned); +extern struct loops *flow_loops_find (struct loops *); +extern void disambiguate_loops_with_multiple_latches (void); +extern void flow_loops_free (struct loops *); +extern void flow_loops_dump (FILE *, + void (*)(const struct loop *, FILE *, int), int); +extern void flow_loop_dump (const struct loop *, FILE *, + void (*)(const struct loop *, FILE *, int), int); +struct loop *alloc_loop (void); +extern void flow_loop_free (struct loop *); +int flow_loop_nodes_find (basic_block, struct loop *); +unsigned fix_loop_structure (bitmap changed_bbs); +bool mark_irreducible_loops (void); +void release_recorded_exits (function *); +void record_loop_exits (void); +void rescan_loop_exit (edge, bool, bool); + +/* Loop data structure manipulation/querying. */ +extern void flow_loop_tree_node_add (struct loop *, struct loop *); +extern void flow_loop_tree_node_remove (struct loop *); +extern bool flow_loop_nested_p (const struct loop *, const struct loop *); +extern bool flow_bb_inside_loop_p (const struct loop *, const_basic_block); +extern struct loop * find_common_loop (struct loop *, struct loop *); +struct loop *superloop_at_depth (struct loop *, unsigned); +struct eni_weights; +extern int num_loop_insns (const struct loop *); +extern int average_num_loop_insns (const struct loop *); +extern unsigned get_loop_level (const struct loop *); +extern bool loop_exit_edge_p (const struct loop *, const_edge); +extern bool loop_exits_to_bb_p (struct loop *, basic_block); +extern bool loop_exits_from_bb_p (struct loop *, basic_block); +extern void mark_loop_exit_edges (void); +extern location_t get_loop_location (struct loop *loop); + +/* Loops & cfg manipulation. */ +extern basic_block *get_loop_body (const struct loop *); +extern unsigned get_loop_body_with_size (const struct loop *, basic_block *, + unsigned); +extern basic_block *get_loop_body_in_dom_order (const struct loop *); +extern basic_block *get_loop_body_in_bfs_order (const struct loop *); +extern basic_block *get_loop_body_in_custom_order (const struct loop *, + int (*) (const void *, const void *)); + +extern vec get_loop_exit_edges (const struct loop *); +extern edge single_exit (const struct loop *); +extern edge single_likely_exit (struct loop *loop); +extern unsigned num_loop_branches (const struct loop *); + +extern edge loop_preheader_edge (const struct loop *); +extern edge loop_latch_edge (const struct loop *); + +extern void add_bb_to_loop (basic_block, struct loop *); +extern void remove_bb_from_loops (basic_block); + +extern void cancel_loop_tree (struct loop *); +extern void delete_loop (struct loop *); + + +extern void verify_loop_structure (void); + +/* Loop analysis. */ +extern bool just_once_each_iteration_p (const struct loop *, const_basic_block); +gcov_type expected_loop_iterations_unbounded (const struct loop *, + bool *read_profile_p = NULL); +extern unsigned expected_loop_iterations (struct loop *); +extern rtx doloop_condition_get (rtx_insn *); + +void mark_loop_for_removal (loop_p); + +/* Induction variable analysis. */ + +/* The description of induction variable. The things are a bit complicated + due to need to handle subregs and extends. The value of the object described + by it can be obtained as follows (all computations are done in extend_mode): + + Value in i-th iteration is + delta + mult * extend_{extend_mode} (subreg_{mode} (base + i * step)). + + If first_special is true, the value in the first iteration is + delta + mult * base + + If extend = UNKNOWN, first_special must be false, delta 0, mult 1 and value is + subreg_{mode} (base + i * step) + + The get_iv_value function can be used to obtain these expressions. + + ??? Add a third mode field that would specify the mode in that inner + computation is done, which would enable it to be different from the + outer one? */ + +struct rtx_iv +{ + /* Its base and step (mode of base and step is supposed to be extend_mode, + see the description above). */ + rtx base, step; + + /* The type of extend applied to it (IV_SIGN_EXTEND, IV_ZERO_EXTEND, + or IV_UNKNOWN_EXTEND). */ + enum iv_extend_code extend; + + /* Operations applied in the extended mode. */ + rtx delta, mult; + + /* The mode it is extended to. */ + machine_mode extend_mode; + + /* The mode the variable iterates in. */ + machine_mode mode; + + /* Whether the first iteration needs to be handled specially. */ + unsigned first_special : 1; +}; + +/* The description of an exit from the loop and of the number of iterations + till we take the exit. */ + +struct GTY(()) niter_desc +{ + /* The edge out of the loop. */ + edge out_edge; + + /* The other edge leading from the condition. */ + edge in_edge; + + /* True if we are able to say anything about number of iterations of the + loop. */ + bool simple_p; + + /* True if the loop iterates the constant number of times. */ + bool const_iter; + + /* Number of iterations if constant. */ + uint64_t niter; + + /* Assumptions under that the rest of the information is valid. */ + rtx assumptions; + + /* Assumptions under that the loop ends before reaching the latch, + even if value of niter_expr says otherwise. */ + rtx noloop_assumptions; + + /* Condition under that the loop is infinite. */ + rtx infinite; + + /* Whether the comparison is signed. */ + bool signed_p; + + /* The mode in that niter_expr should be computed. */ + machine_mode mode; + + /* The number of iterations of the loop. */ + rtx niter_expr; +}; + +extern void iv_analysis_loop_init (struct loop *); +extern bool iv_analyze (rtx_insn *, rtx, struct rtx_iv *); +extern bool iv_analyze_result (rtx_insn *, rtx, struct rtx_iv *); +extern bool iv_analyze_expr (rtx_insn *, rtx, machine_mode, + struct rtx_iv *); +extern rtx get_iv_value (struct rtx_iv *, rtx); +extern bool biv_p (rtx_insn *, rtx); +extern void find_simple_exit (struct loop *, struct niter_desc *); +extern void iv_analysis_done (void); + +extern struct niter_desc *get_simple_loop_desc (struct loop *loop); +extern void free_simple_loop_desc (struct loop *loop); + +static inline struct niter_desc * +simple_loop_desc (struct loop *loop) +{ + return loop->simple_loop_desc; +} + +/* Accessors for the loop structures. */ + +/* Returns the loop with index NUM from FNs loop tree. */ + +static inline struct loop * +get_loop (struct function *fn, unsigned num) +{ + return (*loops_for_fn (fn)->larray)[num]; +} + +/* Returns the number of superloops of LOOP. */ + +static inline unsigned +loop_depth (const struct loop *loop) +{ + return vec_safe_length (loop->superloops); +} + +/* Returns the immediate superloop of LOOP, or NULL if LOOP is the outermost + loop. */ + +static inline struct loop * +loop_outer (const struct loop *loop) +{ + unsigned n = vec_safe_length (loop->superloops); + + if (n == 0) + return NULL; + + return (*loop->superloops)[n - 1]; +} + +/* Returns true if LOOP has at least one exit edge. */ + +static inline bool +loop_has_exit_edges (const struct loop *loop) +{ + return loop->exits->next->e != NULL; +} + +/* Returns the list of loops in FN. */ + +inline vec * +get_loops (struct function *fn) +{ + struct loops *loops = loops_for_fn (fn); + if (!loops) + return NULL; + + return loops->larray; +} + +/* Returns the number of loops in FN (including the removed + ones and the fake loop that forms the root of the loop tree). */ + +static inline unsigned +number_of_loops (struct function *fn) +{ + struct loops *loops = loops_for_fn (fn); + if (!loops) + return 0; + + return vec_safe_length (loops->larray); +} + +/* Returns true if state of the loops satisfies all properties + described by FLAGS. */ + +static inline bool +loops_state_satisfies_p (function *fn, unsigned flags) +{ + return (loops_for_fn (fn)->state & flags) == flags; +} + +static inline bool +loops_state_satisfies_p (unsigned flags) +{ + return loops_state_satisfies_p (cfun, flags); +} + +/* Sets FLAGS to the loops state. */ + +static inline void +loops_state_set (function *fn, unsigned flags) +{ + loops_for_fn (fn)->state |= flags; +} + +static inline void +loops_state_set (unsigned flags) +{ + loops_state_set (cfun, flags); +} + +/* Clears FLAGS from the loops state. */ + +static inline void +loops_state_clear (function *fn, unsigned flags) +{ + loops_for_fn (fn)->state &= ~flags; +} + +static inline void +loops_state_clear (unsigned flags) +{ + if (!current_loops) + return; + loops_state_clear (cfun, flags); +} + +/* Check loop structure invariants, if internal consistency checks are + enabled. */ + +static inline void +checking_verify_loop_structure (void) +{ + /* VERIFY_LOOP_STRUCTURE essentially asserts that no loops need fixups. + + The loop optimizers should never make changes to the CFG which + require loop fixups. But the low level CFG manipulation code may + set the flag conservatively. + + Go ahead and clear the flag here. That avoids the assert inside + VERIFY_LOOP_STRUCTURE, and if there is an inconsistency in the loop + structures VERIFY_LOOP_STRUCTURE will detect it. + + This also avoid the compile time cost of excessive fixups. */ + loops_state_clear (LOOPS_NEED_FIXUP); + if (flag_checking) + verify_loop_structure (); +} + +/* Loop iterators. */ + +/* Flags for loop iteration. */ + +enum li_flags +{ + LI_INCLUDE_ROOT = 1, /* Include the fake root of the loop tree. */ + LI_FROM_INNERMOST = 2, /* Iterate over the loops in the reverse order, + starting from innermost ones. */ + LI_ONLY_INNERMOST = 4 /* Iterate only over innermost loops. */ +}; + +/* The iterator for loops. */ + +struct loop_iterator +{ + loop_iterator (function *fn, loop_p *loop, unsigned flags); + ~loop_iterator (); + + inline loop_p next (); + + /* The function we are visiting. */ + function *fn; + + /* The list of loops to visit. */ + vec to_visit; + + /* The index of the actual loop. */ + unsigned idx; +}; + +inline loop_p +loop_iterator::next () +{ + int anum; + + while (this->to_visit.iterate (this->idx, &anum)) + { + this->idx++; + loop_p loop = get_loop (fn, anum); + if (loop) + return loop; + } + + return NULL; +} + +inline +loop_iterator::loop_iterator (function *fn, loop_p *loop, unsigned flags) +{ + struct loop *aloop; + unsigned i; + int mn; + + this->idx = 0; + this->fn = fn; + if (!loops_for_fn (fn)) + { + this->to_visit.create (0); + *loop = NULL; + return; + } + + this->to_visit.create (number_of_loops (fn)); + mn = (flags & LI_INCLUDE_ROOT) ? 0 : 1; + + if (flags & LI_ONLY_INNERMOST) + { + for (i = 0; vec_safe_iterate (loops_for_fn (fn)->larray, i, &aloop); i++) + if (aloop != NULL + && aloop->inner == NULL + && aloop->num >= mn) + this->to_visit.quick_push (aloop->num); + } + else if (flags & LI_FROM_INNERMOST) + { + /* Push the loops to LI->TO_VISIT in postorder. */ + for (aloop = loops_for_fn (fn)->tree_root; + aloop->inner != NULL; + aloop = aloop->inner) + continue; + + while (1) + { + if (aloop->num >= mn) + this->to_visit.quick_push (aloop->num); + + if (aloop->next) + { + for (aloop = aloop->next; + aloop->inner != NULL; + aloop = aloop->inner) + continue; + } + else if (!loop_outer (aloop)) + break; + else + aloop = loop_outer (aloop); + } + } + else + { + /* Push the loops to LI->TO_VISIT in preorder. */ + aloop = loops_for_fn (fn)->tree_root; + while (1) + { + if (aloop->num >= mn) + this->to_visit.quick_push (aloop->num); + + if (aloop->inner != NULL) + aloop = aloop->inner; + else + { + while (aloop != NULL && aloop->next == NULL) + aloop = loop_outer (aloop); + if (aloop == NULL) + break; + aloop = aloop->next; + } + } + } + + *loop = this->next (); +} + +inline +loop_iterator::~loop_iterator () +{ + this->to_visit.release (); +} + +#define FOR_EACH_LOOP(LOOP, FLAGS) \ + for (loop_iterator li(cfun, &(LOOP), FLAGS); \ + (LOOP); \ + (LOOP) = li.next ()) + +#define FOR_EACH_LOOP_FN(FN, LOOP, FLAGS) \ + for (loop_iterator li(fn, &(LOOP), FLAGS); \ + (LOOP); \ + (LOOP) = li.next ()) + +/* The properties of the target. */ +struct target_cfgloop { + /* Number of available registers. */ + unsigned x_target_avail_regs; + + /* Number of available registers that are call-clobbered. */ + unsigned x_target_clobbered_regs; + + /* Number of registers reserved for temporary expressions. */ + unsigned x_target_res_regs; + + /* The cost for register when there still is some reserve, but we are + approaching the number of available registers. */ + unsigned x_target_reg_cost[2]; + + /* The cost for register when we need to spill. */ + unsigned x_target_spill_cost[2]; +}; + +extern struct target_cfgloop default_target_cfgloop; +#if SWITCHABLE_TARGET +extern struct target_cfgloop *this_target_cfgloop; +#else +#define this_target_cfgloop (&default_target_cfgloop) +#endif + +#define target_avail_regs \ + (this_target_cfgloop->x_target_avail_regs) +#define target_clobbered_regs \ + (this_target_cfgloop->x_target_clobbered_regs) +#define target_res_regs \ + (this_target_cfgloop->x_target_res_regs) +#define target_reg_cost \ + (this_target_cfgloop->x_target_reg_cost) +#define target_spill_cost \ + (this_target_cfgloop->x_target_spill_cost) + +/* Register pressure estimation for induction variable optimizations & loop + invariant motion. */ +extern unsigned estimate_reg_pressure_cost (unsigned, unsigned, bool, bool); +extern void init_set_costs (void); + +/* Loop optimizer initialization. */ +extern void loop_optimizer_init (unsigned); +extern void loop_optimizer_finalize (function *); +inline void +loop_optimizer_finalize () +{ + loop_optimizer_finalize (cfun); +} + +/* Optimization passes. */ +enum +{ + UAP_UNROLL = 1, /* Enables unrolling of loops if it seems profitable. */ + UAP_UNROLL_ALL = 2 /* Enables unrolling of all loops. */ +}; + +extern void doloop_optimize_loops (void); +extern void move_loop_invariants (void); +extern vec get_loop_hot_path (const struct loop *loop); + +/* Returns the outermost loop of the loop nest that contains LOOP.*/ +static inline struct loop * +loop_outermost (struct loop *loop) +{ + unsigned n = vec_safe_length (loop->superloops); + + if (n <= 1) + return loop; + + return (*loop->superloops)[1]; +} + +extern void record_niter_bound (struct loop *, const widest_int &, bool, bool); +extern HOST_WIDE_INT get_estimated_loop_iterations_int (struct loop *); +extern HOST_WIDE_INT get_max_loop_iterations_int (const struct loop *); +extern HOST_WIDE_INT get_likely_max_loop_iterations_int (struct loop *); +extern bool get_estimated_loop_iterations (struct loop *loop, widest_int *nit); +extern bool get_max_loop_iterations (const struct loop *loop, widest_int *nit); +extern bool get_likely_max_loop_iterations (struct loop *loop, widest_int *nit); +extern int bb_loop_depth (const_basic_block); + +/* Converts VAL to widest_int. */ + +static inline widest_int +gcov_type_to_wide_int (gcov_type val) +{ + HOST_WIDE_INT a[2]; + + a[0] = (unsigned HOST_WIDE_INT) val; + /* If HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_WIDEST_INT, avoid shifting by + the size of type. */ + val >>= HOST_BITS_PER_WIDE_INT - 1; + val >>= 1; + a[1] = (unsigned HOST_WIDE_INT) val; + + return widest_int::from_array (a, 2); +} +#endif /* GCC_CFGLOOP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgloopmanip.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgloopmanip.h new file mode 100644 index 0000000..7ad3bf5 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgloopmanip.h @@ -0,0 +1,64 @@ +/* Loop manipulation header. + Copyright (C) 2014-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_CFGLOOPMANIP_H +#define GCC_CFGLOOPMANIP_H + +enum +{ + CP_SIMPLE_PREHEADERS = 1, + CP_FALLTHRU_PREHEADERS = 2 +}; + +#define DLTHE_FLAG_UPDATE_FREQ 1 /* Update frequencies in + duplicate_loop_to_header_edge. */ +#define DLTHE_RECORD_COPY_NUMBER 2 /* Record copy number in the aux + field of newly create BB. */ +#define DLTHE_FLAG_COMPLETTE_PEEL 4 /* Update frequencies expecting + a complete peeling. */ +extern edge mfb_kj_edge; + +extern bool remove_path (edge, bool * = NULL, bitmap = NULL); +extern void place_new_loop (struct function *, struct loop *); +extern void add_loop (struct loop *, struct loop *); +extern void scale_loop_frequencies (struct loop *, int, int); +extern void scale_loop_profile (struct loop *, int, gcov_type); +extern edge create_empty_if_region_on_edge (edge, tree); +extern struct loop *create_empty_loop_on_edge (edge, tree, tree, tree, tree, + tree *, tree *, struct loop *); +extern struct loop *loopify (edge, edge, + basic_block, edge, edge, bool, + unsigned, unsigned); +extern void unloop (struct loop *, bool *, bitmap); +extern void copy_loop_info (struct loop *loop, struct loop *target); +extern struct loop * duplicate_loop (struct loop *, struct loop *); +extern void duplicate_subloops (struct loop *, struct loop *); +extern bool can_duplicate_loop_p (const struct loop *loop); +extern bool duplicate_loop_to_header_edge (struct loop *, edge, + unsigned, sbitmap, edge, + vec *, int); +extern bool mfb_keep_just (edge); +basic_block create_preheader (struct loop *, int); +extern void create_preheaders (int); +extern void force_single_succ_latches (void); +struct loop * loop_version (struct loop *, void *, + basic_block *, unsigned, unsigned, + unsigned, unsigned, bool); + +#endif /* GCC_CFGLOOPMANIP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgrtl.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgrtl.h new file mode 100644 index 0000000..befd1aa --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cfgrtl.h @@ -0,0 +1,58 @@ +/* Define control flow data structures for the CFG. + Copyright (C) 2014-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_CFGRTL_H +#define GCC_CFGRTL_H + +extern void delete_insn (rtx_insn *); +extern bool delete_insn_and_edges (rtx_insn *); +extern void delete_insn_chain (rtx, rtx_insn *, bool); +extern basic_block create_basic_block_structure (rtx_insn *, rtx_insn *, + rtx_note *, basic_block); +extern void compute_bb_for_insn (void); +extern unsigned int free_bb_for_insn (void); +extern rtx_insn *entry_of_function (void); +extern void update_bb_for_insn (basic_block); +extern bool contains_no_active_insn_p (const_basic_block); +extern bool forwarder_block_p (const_basic_block); +extern bool can_fallthru (basic_block, basic_block); +extern rtx_note *bb_note (basic_block); +extern rtx_code_label *block_label (basic_block); +extern edge try_redirect_by_replacing_jump (edge, basic_block, bool); +extern void emit_barrier_after_bb (basic_block bb); +extern basic_block force_nonfallthru_and_redirect (edge, basic_block, rtx); +extern void insert_insn_on_edge (rtx, edge); +extern void commit_one_edge_insertion (edge e); +extern void commit_edge_insertions (void); +extern void print_rtl_with_bb (FILE *, const rtx_insn *, int); +extern void update_br_prob_note (basic_block); +extern rtx_insn *get_last_bb_insn (basic_block); +extern void fixup_partitions (void); +extern bool purge_dead_edges (basic_block); +extern bool purge_all_dead_edges (void); +extern bool fixup_abnormal_edges (void); +extern rtx_insn *unlink_insn_chain (rtx_insn *, rtx_insn *); +extern void relink_block_chain (bool); +extern rtx_insn *duplicate_insn_chain (rtx_insn *, rtx_insn *); +extern void cfg_layout_initialize (unsigned int); +extern void cfg_layout_finalize (void); +extern void break_superblocks (void); +extern void init_rtl_bb_info (basic_block); + +#endif /* GCC_CFGRTL_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cgraph.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cgraph.h new file mode 100644 index 0000000..be4eaee --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cgraph.h @@ -0,0 +1,3294 @@ +/* Callgraph handling code. + Copyright (C) 2003-2017 Free Software Foundation, Inc. + Contributed by Jan Hubicka + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_CGRAPH_H +#define GCC_CGRAPH_H + +#include "ipa-ref.h" +#include "plugin-api.h" + +class ipa_opt_pass_d; +typedef ipa_opt_pass_d *ipa_opt_pass; + +/* Symbol table consists of functions and variables. + TODO: add labels and CONST_DECLs. */ +enum symtab_type +{ + SYMTAB_SYMBOL, + SYMTAB_FUNCTION, + SYMTAB_VARIABLE +}; + +/* Section names are stored as reference counted strings in GGC safe hashtable + (to make them survive through PCH). */ + +struct GTY((for_user)) section_hash_entry +{ + int ref_count; + char *name; /* As long as this datastructure stays in GGC, we can not put + string at the tail of structure of GGC dies in horrible + way */ +}; + +struct section_name_hasher : ggc_ptr_hash +{ + typedef const char *compare_type; + + static hashval_t hash (section_hash_entry *); + static bool equal (section_hash_entry *, const char *); +}; + +enum availability +{ + /* Not yet set by cgraph_function_body_availability. */ + AVAIL_UNSET, + /* Function body/variable initializer is unknown. */ + AVAIL_NOT_AVAILABLE, + /* Function body/variable initializer is known but might be replaced + by a different one from other compilation unit and thus needs to + be dealt with a care. Like AVAIL_NOT_AVAILABLE it can have + arbitrary side effects on escaping variables and functions, while + like AVAILABLE it might access static variables. */ + AVAIL_INTERPOSABLE, + /* Function body/variable initializer is known and will be used in final + program. */ + AVAIL_AVAILABLE, + /* Function body/variable initializer is known and all it's uses are + explicitly visible within current unit (ie it's address is never taken and + it is not exported to other units). Currently used only for functions. */ + AVAIL_LOCAL +}; + +/* Classification of symbols WRT partitioning. */ +enum symbol_partitioning_class +{ + /* External declarations are ignored by partitioning algorithms and they are + added into the boundary later via compute_ltrans_boundary. */ + SYMBOL_EXTERNAL, + /* Partitioned symbols are pur into one of partitions. */ + SYMBOL_PARTITION, + /* Duplicated symbols (such as comdat or constant pool references) are + copied into every node needing them via add_symbol_to_partition. */ + SYMBOL_DUPLICATE +}; + +/* Base of all entries in the symbol table. + The symtab_node is inherited by cgraph and varpol nodes. */ +class GTY((desc ("%h.type"), tag ("SYMTAB_SYMBOL"), + chain_next ("%h.next"), chain_prev ("%h.previous"))) + symtab_node +{ +public: + /* Return name. */ + const char *name () const; + + /* Return asm name. */ + const char * asm_name () const; + + /* Add node into symbol table. This function is not used directly, but via + cgraph/varpool node creation routines. */ + void register_symbol (void); + + /* Remove symbol from symbol table. */ + void remove (void); + + /* Dump symtab node to F. */ + void dump (FILE *f); + + /* Dump symtab node to stderr. */ + void DEBUG_FUNCTION debug (void); + + /* Verify consistency of node. */ + void DEBUG_FUNCTION verify (void); + + /* Return ipa reference from this symtab_node to + REFERED_NODE or REFERED_VARPOOL_NODE. USE_TYPE specify type + of the use and STMT the statement (if it exists). */ + ipa_ref *create_reference (symtab_node *referred_node, + enum ipa_ref_use use_type); + + /* Return ipa reference from this symtab_node to + REFERED_NODE or REFERED_VARPOOL_NODE. USE_TYPE specify type + of the use and STMT the statement (if it exists). */ + ipa_ref *create_reference (symtab_node *referred_node, + enum ipa_ref_use use_type, gimple *stmt); + + /* If VAL is a reference to a function or a variable, add a reference from + this symtab_node to the corresponding symbol table node. Return the new + reference or NULL if none was created. */ + ipa_ref *maybe_create_reference (tree val, gimple *stmt); + + /* Clone all references from symtab NODE to this symtab_node. */ + void clone_references (symtab_node *node); + + /* Remove all stmt references in non-speculative references. + Those are not maintained during inlining & clonning. + The exception are speculative references that are updated along + with callgraph edges associated with them. */ + void clone_referring (symtab_node *node); + + /* Clone reference REF to this symtab_node and set its stmt to STMT. */ + ipa_ref *clone_reference (ipa_ref *ref, gimple *stmt); + + /* Find the structure describing a reference to REFERRED_NODE + and associated with statement STMT. */ + ipa_ref *find_reference (symtab_node *referred_node, gimple *stmt, + unsigned int lto_stmt_uid); + + /* Remove all references that are associated with statement STMT. */ + void remove_stmt_references (gimple *stmt); + + /* Remove all stmt references in non-speculative references. + Those are not maintained during inlining & clonning. + The exception are speculative references that are updated along + with callgraph edges associated with them. */ + void clear_stmts_in_references (void); + + /* Remove all references in ref list. */ + void remove_all_references (void); + + /* Remove all referring items in ref list. */ + void remove_all_referring (void); + + /* Dump references in ref list to FILE. */ + void dump_references (FILE *file); + + /* Dump referring in list to FILE. */ + void dump_referring (FILE *); + + /* Get number of references for this node. */ + inline unsigned num_references (void) + { + return ref_list.references ? ref_list.references->length () : 0; + } + + /* Iterates I-th reference in the list, REF is also set. */ + ipa_ref *iterate_reference (unsigned i, ipa_ref *&ref); + + /* Iterates I-th referring item in the list, REF is also set. */ + ipa_ref *iterate_referring (unsigned i, ipa_ref *&ref); + + /* Iterates I-th referring alias item in the list, REF is also set. */ + ipa_ref *iterate_direct_aliases (unsigned i, ipa_ref *&ref); + + /* Return true if symtab node and TARGET represents + semantically equivalent symbols. */ + bool semantically_equivalent_p (symtab_node *target); + + /* Classify symbol symtab node for partitioning. */ + enum symbol_partitioning_class get_partitioning_class (void); + + /* Return comdat group. */ + tree get_comdat_group () + { + return x_comdat_group; + } + + /* Return comdat group as identifier_node. */ + tree get_comdat_group_id () + { + if (x_comdat_group && TREE_CODE (x_comdat_group) != IDENTIFIER_NODE) + x_comdat_group = DECL_ASSEMBLER_NAME (x_comdat_group); + return x_comdat_group; + } + + /* Set comdat group. */ + void set_comdat_group (tree group) + { + gcc_checking_assert (!group || TREE_CODE (group) == IDENTIFIER_NODE + || DECL_P (group)); + x_comdat_group = group; + } + + /* Return section as string. */ + const char * get_section () + { + if (!x_section) + return NULL; + return x_section->name; + } + + /* Remove node from same comdat group. */ + void remove_from_same_comdat_group (void); + + /* Add this symtab_node to the same comdat group that OLD is in. */ + void add_to_same_comdat_group (symtab_node *old_node); + + /* Dissolve the same_comdat_group list in which NODE resides. */ + void dissolve_same_comdat_group_list (void); + + /* Return true when symtab_node is known to be used from other (non-LTO) + object file. Known only when doing LTO via linker plugin. */ + bool used_from_object_file_p (void); + + /* Walk the alias chain to return the symbol NODE is alias of. + If NODE is not an alias, return NODE. + When AVAILABILITY is non-NULL, get minimal availability in the chain. + When REF is non-NULL, assume that reference happens in symbol REF + when determining the availability. */ + symtab_node *ultimate_alias_target (enum availability *avail = NULL, + struct symtab_node *ref = NULL); + + /* Return next reachable static symbol with initializer after NODE. */ + inline symtab_node *next_defined_symbol (void); + + /* Add reference recording that symtab node is alias of TARGET. + If TRANSPARENT is true make the alias to be transparent alias. + The function can fail in the case of aliasing cycles; in this case + it returns false. */ + bool resolve_alias (symtab_node *target, bool transparent = false); + + /* C++ FE sometimes change linkage flags after producing same + body aliases. */ + void fixup_same_cpp_alias_visibility (symtab_node *target); + + /* Call callback on symtab node and aliases associated to this node. + When INCLUDE_OVERWRITABLE is false, overwritable aliases and thunks are + skipped. */ + bool call_for_symbol_and_aliases (bool (*callback) (symtab_node *, void *), + void *data, + bool include_overwrite); + + /* If node can not be interposable by static or dynamic linker to point to + different definition, return this symbol. Otherwise look for alias with + such property and if none exists, introduce new one. */ + symtab_node *noninterposable_alias (void); + + /* Return node that alias is aliasing. */ + inline symtab_node *get_alias_target (void); + + /* Set section for symbol and its aliases. */ + void set_section (const char *section); + + /* Set section, do not recurse into aliases. + When one wants to change section of symbol and its aliases, + use set_section. */ + void set_section_for_node (const char *section); + + /* Set initialization priority to PRIORITY. */ + void set_init_priority (priority_type priority); + + /* Return the initialization priority. */ + priority_type get_init_priority (); + + /* Return availability of NODE when referenced from REF. */ + enum availability get_availability (symtab_node *ref = NULL); + + /* Return true if NODE binds to current definition in final executable + when referenced from REF. If REF is NULL return conservative value + for any reference. */ + bool binds_to_current_def_p (symtab_node *ref = NULL); + + /* Make DECL local. */ + void make_decl_local (void); + + /* Copy visibility from N. */ + void copy_visibility_from (symtab_node *n); + + /* Return desired alignment of the definition. This is NOT alignment useful + to access THIS, because THIS may be interposable and DECL_ALIGN should + be used instead. It however must be guaranteed when output definition + of THIS. */ + unsigned int definition_alignment (); + + /* Return true if alignment can be increased. */ + bool can_increase_alignment_p (); + + /* Increase alignment of symbol to ALIGN. */ + void increase_alignment (unsigned int align); + + /* Return true if list contains an alias. */ + bool has_aliases_p (void); + + /* Return true when the symbol is real symbol, i.e. it is not inline clone + or abstract function kept for debug info purposes only. */ + bool real_symbol_p (void); + + /* Determine if symbol declaration is needed. That is, visible to something + either outside this translation unit, something magic in the system + configury. This function is used just during symbol creation. */ + bool needed_p (void); + + /* Return true if this symbol is a function from the C frontend specified + directly in RTL form (with "__RTL"). */ + bool native_rtl_p () const; + + /* Return true when there are references to the node. */ + bool referred_to_p (bool include_self = true); + + /* Return true if symbol can be discarded by linker from the binary. + Assume that symbol is used (so there is no need to take into account + garbage collecting linkers) + + This can happen for comdats, commons and weaks when they are previaled + by other definition at static linking time. */ + inline bool + can_be_discarded_p (void) + { + return (DECL_EXTERNAL (decl) + || ((get_comdat_group () + || DECL_COMMON (decl) + || (DECL_SECTION_NAME (decl) && DECL_WEAK (decl))) + && ((resolution != LDPR_PREVAILING_DEF + && resolution != LDPR_PREVAILING_DEF_IRONLY_EXP) + || flag_incremental_link) + && resolution != LDPR_PREVAILING_DEF_IRONLY)); + } + + /* Return true if NODE is local to a particular COMDAT group, and must not + be named from outside the COMDAT. This is used for C++ decloned + constructors. */ + inline bool comdat_local_p (void) + { + return (same_comdat_group && !TREE_PUBLIC (decl)); + } + + /* Return true if ONE and TWO are part of the same COMDAT group. */ + inline bool in_same_comdat_group_p (symtab_node *target); + + /* Return true if symbol is known to be nonzero. */ + bool nonzero_address (); + + /* Return 0 if symbol is known to have different address than S2, + Return 1 if symbol is known to have same address as S2, + return 2 otherwise. + + If MEMORY_ACCESSED is true, assume that both memory pointer to THIS + and S2 is going to be accessed. This eliminates the situations when + either THIS or S2 is NULL and is seful for comparing bases when deciding + about memory aliasing. */ + int equal_address_to (symtab_node *s2, bool memory_accessed = false); + + /* Return true if symbol's address may possibly be compared to other + symbol's address. */ + bool address_matters_p (); + + /* Return true if NODE's address can be compared. This use properties + of NODE only and does not look if the address is actually taken in + interesting way. For that use ADDRESS_MATTERS_P instead. */ + bool address_can_be_compared_p (void); + + /* Return symbol table node associated with DECL, if any, + and NULL otherwise. */ + static inline symtab_node *get (const_tree decl) + { + /* Check that we are called for sane type of object - functions + and static or external variables. */ + gcc_checking_assert (TREE_CODE (decl) == FUNCTION_DECL + || (TREE_CODE (decl) == VAR_DECL + && (TREE_STATIC (decl) || DECL_EXTERNAL (decl) + || in_lto_p))); + /* Check that the mapping is sane - perhaps this check can go away, + but at the moment frontends tends to corrupt the mapping by calling + memcpy/memset on the tree nodes. */ + gcc_checking_assert (!decl->decl_with_vis.symtab_node + || decl->decl_with_vis.symtab_node->decl == decl); + return decl->decl_with_vis.symtab_node; + } + + /* Try to find a symtab node for declaration DECL and if it does not + exist or if it corresponds to an inline clone, create a new one. */ + static inline symtab_node * get_create (tree node); + + /* Return the cgraph node that has ASMNAME for its DECL_ASSEMBLER_NAME. + Return NULL if there's no such node. */ + static symtab_node *get_for_asmname (const_tree asmname); + + /* Dump symbol table to F. */ + static void dump_table (FILE *); + + /* Dump symbol table to stderr. */ + static void DEBUG_FUNCTION debug_symtab (void); + + /* Verify symbol table for internal consistency. */ + static DEBUG_FUNCTION void verify_symtab_nodes (void); + + /* Perform internal consistency checks, if they are enabled. */ + static inline void checking_verify_symtab_nodes (void); + + /* Type of the symbol. */ + ENUM_BITFIELD (symtab_type) type : 8; + + /* The symbols resolution. */ + ENUM_BITFIELD (ld_plugin_symbol_resolution) resolution : 8; + + /*** Flags representing the symbol type. ***/ + + /* True when symbol corresponds to a definition in current unit. + set via finalize_function or finalize_decl */ + unsigned definition : 1; + /* True when symbol is an alias. + Set by ssemble_alias. */ + unsigned alias : 1; + /* When true the alias is translated into its target symbol either by GCC + or assembler (it also may just be a duplicate declaration of the same + linker name). + + Currently transparent aliases come in three different flavors + - aliases having the same assembler name as their target (aka duplicated + declarations). In this case the assembler names compare via + assembler_names_equal_p and weakref is false + - aliases that are renamed at a time being output to final file + by varasm.c. For those DECL_ASSEMBLER_NAME have + IDENTIFIER_TRANSPARENT_ALIAS set and thus also their assembler + name must be unique. + Weakrefs belong to this cateogry when we target assembler without + .weakref directive. + - weakrefs that are renamed by assembler via .weakref directive. + In this case the alias may or may not be definition (depending if + target declaration was seen by the compiler), weakref is set. + Unless we are before renaming statics, assembler names are different. + + Given that we now support duplicate declarations, the second option is + redundant and will be removed. */ + unsigned transparent_alias : 1; + /* True when alias is a weakref. */ + unsigned weakref : 1; + /* C++ frontend produce same body aliases and extra name aliases for + virtual functions and vtables that are obviously equivalent. + Those aliases are bit special, especially because C++ frontend + visibility code is so ugly it can not get them right at first time + and their visibility needs to be copied from their "masters" at + the end of parsing. */ + unsigned cpp_implicit_alias : 1; + /* Set once the definition was analyzed. The list of references and + other properties are built during analysis. */ + unsigned analyzed : 1; + /* Set for write-only variables. */ + unsigned writeonly : 1; + /* Visibility of symbol was used for further optimization; do not + permit further changes. */ + unsigned refuse_visibility_changes : 1; + + /*** Visibility and linkage flags. ***/ + + /* Set when function is visible by other units. */ + unsigned externally_visible : 1; + /* Don't reorder to other symbols having this set. */ + unsigned no_reorder : 1; + /* The symbol will be assumed to be used in an invisible way (like + by an toplevel asm statement). */ + unsigned force_output : 1; + /* Like FORCE_OUTPUT, but in the case it is ABI requiring the symbol to be + exported. Unlike FORCE_OUTPUT this flag gets cleared to symbols promoted + to static and it does not inhibit optimization. */ + unsigned forced_by_abi : 1; + /* True when the name is known to be unique and thus it does not need mangling. */ + unsigned unique_name : 1; + /* Specify whether the section was set by user or by + compiler via -ffunction-sections. */ + unsigned implicit_section : 1; + /* True when body and other characteristics have been removed by + symtab_remove_unreachable_nodes. */ + unsigned body_removed : 1; + + /*** WHOPR Partitioning flags. + These flags are used at ltrans stage when only part of the callgraph is + available. ***/ + + /* Set when variable is used from other LTRANS partition. */ + unsigned used_from_other_partition : 1; + /* Set when function is available in the other LTRANS partition. + During WPA output it is used to mark nodes that are present in + multiple partitions. */ + unsigned in_other_partition : 1; + + + + /*** other flags. ***/ + + /* Set when symbol has address taken. */ + unsigned address_taken : 1; + /* Set when init priority is set. */ + unsigned in_init_priority_hash : 1; + + /* Set when symbol needs to be streamed into LTO bytecode for LTO, or in case + of offloading, for separate compilation for a different target. */ + unsigned need_lto_streaming : 1; + + /* Set when symbol can be streamed into bytecode for offloading. */ + unsigned offloadable : 1; + + + /* Ordering of all symtab entries. */ + int order; + + /* Declaration representing the symbol. */ + tree decl; + + /* Linked list of symbol table entries starting with symtab_nodes. */ + symtab_node *next; + symtab_node *previous; + + /* Linked list of symbols with the same asm name. There may be multiple + entries for single symbol name during LTO, because symbols are renamed + only after partitioning. + + Because inline clones are kept in the assembler name has, they also produce + duplicate entries. + + There are also several long standing bugs where frontends and builtin + code produce duplicated decls. */ + symtab_node *next_sharing_asm_name; + symtab_node *previous_sharing_asm_name; + + /* Circular list of nodes in the same comdat group if non-NULL. */ + symtab_node *same_comdat_group; + + /* Vectors of referring and referenced entities. */ + ipa_ref_list ref_list; + + /* Alias target. May be either DECL pointer or ASSEMBLER_NAME pointer + depending to what was known to frontend on the creation time. + Once alias is resolved, this pointer become NULL. */ + tree alias_target; + + /* File stream where this node is being written to. */ + struct lto_file_decl_data * lto_file_data; + + PTR GTY ((skip)) aux; + + /* Comdat group the symbol is in. Can be private if GGC allowed that. */ + tree x_comdat_group; + + /* Section name. Again can be private, if allowed. */ + section_hash_entry *x_section; + +protected: + /* Dump base fields of symtab nodes to F. Not to be used directly. */ + void dump_base (FILE *); + + /* Verify common part of symtab node. */ + bool DEBUG_FUNCTION verify_base (void); + + /* Remove node from symbol table. This function is not used directly, but via + cgraph/varpool node removal routines. */ + void unregister (void); + + /* Return the initialization and finalization priority information for + DECL. If there is no previous priority information, a freshly + allocated structure is returned. */ + struct symbol_priority_map *priority_info (void); + + /* Worker for call_for_symbol_and_aliases_1. */ + bool call_for_symbol_and_aliases_1 (bool (*callback) (symtab_node *, void *), + void *data, + bool include_overwrite); +private: + /* Worker for set_section. */ + static bool set_section (symtab_node *n, void *s); + + /* Worker for symtab_resolve_alias. */ + static bool set_implicit_section (symtab_node *n, void *); + + /* Worker searching noninterposable alias. */ + static bool noninterposable_alias (symtab_node *node, void *data); + + /* Worker for ultimate_alias_target. */ + symtab_node *ultimate_alias_target_1 (enum availability *avail = NULL, + symtab_node *ref = NULL); +}; + +inline void +symtab_node::checking_verify_symtab_nodes (void) +{ + if (flag_checking) + symtab_node::verify_symtab_nodes (); +} + +/* Walk all aliases for NODE. */ +#define FOR_EACH_ALIAS(node, alias) \ + for (unsigned x_i = 0; node->iterate_direct_aliases (x_i, alias); x_i++) + +/* This is the information that is put into the cgraph local structure + to recover a function. */ +struct lto_file_decl_data; + +extern const char * const cgraph_availability_names[]; +extern const char * const ld_plugin_symbol_resolution_names[]; +extern const char * const tls_model_names[]; + +/* Information about thunk, used only for same body aliases. */ + +struct GTY(()) cgraph_thunk_info { + /* Information about the thunk. */ + HOST_WIDE_INT fixed_offset; + HOST_WIDE_INT virtual_value; + tree alias; + bool this_adjusting; + bool virtual_offset_p; + bool add_pointer_bounds_args; + /* Set to true when alias node is thunk. */ + bool thunk_p; +}; + +/* Information about the function collected locally. + Available after function is analyzed. */ + +struct GTY(()) cgraph_local_info { + /* Set when function is visible in current compilation unit only and + its address is never taken. */ + unsigned local : 1; + + /* False when there is something makes versioning impossible. */ + unsigned versionable : 1; + + /* False when function calling convention and signature can not be changed. + This is the case when __builtin_apply_args is used. */ + unsigned can_change_signature : 1; + + /* True when the function has been originally extern inline, but it is + redefined now. */ + unsigned redefined_extern_inline : 1; + + /* True if the function may enter serial irrevocable mode. */ + unsigned tm_may_enter_irr : 1; +}; + +/* Information about the function that needs to be computed globally + once compilation is finished. Available only with -funit-at-a-time. */ + +struct GTY(()) cgraph_global_info { + /* For inline clones this points to the function they will be + inlined into. */ + cgraph_node *inlined_to; +}; + +/* Represent which DECL tree (or reference to such tree) + will be replaced by another tree while versioning. */ +struct GTY(()) ipa_replace_map +{ + /* The tree that will be replaced. */ + tree old_tree; + /* The new (replacing) tree. */ + tree new_tree; + /* Parameter number to replace, when old_tree is NULL. */ + int parm_num; + /* True when a substitution should be done, false otherwise. */ + bool replace_p; + /* True when we replace a reference to old_tree. */ + bool ref_p; +}; + +struct GTY(()) cgraph_clone_info +{ + vec *tree_map; + bitmap args_to_skip; + bitmap combined_args_to_skip; +}; + +enum cgraph_simd_clone_arg_type +{ + SIMD_CLONE_ARG_TYPE_VECTOR, + SIMD_CLONE_ARG_TYPE_UNIFORM, + /* These are only for integer/pointer arguments passed by value. */ + SIMD_CLONE_ARG_TYPE_LINEAR_CONSTANT_STEP, + SIMD_CLONE_ARG_TYPE_LINEAR_VARIABLE_STEP, + /* These 6 are only for reference type arguments or arguments passed + by reference. */ + SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP, + SIMD_CLONE_ARG_TYPE_LINEAR_REF_VARIABLE_STEP, + SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP, + SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_VARIABLE_STEP, + SIMD_CLONE_ARG_TYPE_LINEAR_VAL_CONSTANT_STEP, + SIMD_CLONE_ARG_TYPE_LINEAR_VAL_VARIABLE_STEP, + SIMD_CLONE_ARG_TYPE_MASK +}; + +/* Function arguments in the original function of a SIMD clone. + Supplementary data for `struct simd_clone'. */ + +struct GTY(()) cgraph_simd_clone_arg { + /* Original function argument as it originally existed in + DECL_ARGUMENTS. */ + tree orig_arg; + + /* orig_arg's function (or for extern functions type from + TYPE_ARG_TYPES). */ + tree orig_type; + + /* If argument is a vector, this holds the vector version of + orig_arg that after adjusting the argument types will live in + DECL_ARGUMENTS. Otherwise, this is NULL. + + This basically holds: + vector(simdlen) __typeof__(orig_arg) new_arg. */ + tree vector_arg; + + /* vector_arg's type (or for extern functions new vector type. */ + tree vector_type; + + /* If argument is a vector, this holds the array where the simd + argument is held while executing the simd clone function. This + is a local variable in the cloned function. Its content is + copied from vector_arg upon entry to the clone. + + This basically holds: + __typeof__(orig_arg) simd_array[simdlen]. */ + tree simd_array; + + /* A SIMD clone's argument can be either linear (constant or + variable), uniform, or vector. */ + enum cgraph_simd_clone_arg_type arg_type; + + /* For arg_type SIMD_CLONE_ARG_TYPE_LINEAR_*CONSTANT_STEP this is + the constant linear step, if arg_type is + SIMD_CLONE_ARG_TYPE_LINEAR_*VARIABLE_STEP, this is index of + the uniform argument holding the step, otherwise 0. */ + HOST_WIDE_INT linear_step; + + /* Variable alignment if available, otherwise 0. */ + unsigned int alignment; +}; + +/* Specific data for a SIMD function clone. */ + +struct GTY(()) cgraph_simd_clone { + /* Number of words in the SIMD lane associated with this clone. */ + unsigned int simdlen; + + /* Number of annotated function arguments in `args'. This is + usually the number of named arguments in FNDECL. */ + unsigned int nargs; + + /* Max hardware vector size in bits for integral vectors. */ + unsigned int vecsize_int; + + /* Max hardware vector size in bits for floating point vectors. */ + unsigned int vecsize_float; + + /* Machine mode of the mask argument(s), if they are to be passed + as bitmasks in integer argument(s). VOIDmode if masks are passed + as vectors of characteristic type. */ + machine_mode mask_mode; + + /* The mangling character for a given vector size. This is used + to determine the ISA mangling bit as specified in the Intel + Vector ABI. */ + unsigned char vecsize_mangle; + + /* True if this is the masked, in-branch version of the clone, + otherwise false. */ + unsigned int inbranch : 1; + + /* True if this is a Cilk Plus variant. */ + unsigned int cilk_elemental : 1; + + /* Doubly linked list of SIMD clones. */ + cgraph_node *prev_clone, *next_clone; + + /* Original cgraph node the SIMD clones were created for. */ + cgraph_node *origin; + + /* Annotated function arguments for the original function. */ + cgraph_simd_clone_arg GTY((length ("%h.nargs"))) args[1]; +}; + +/* Function Multiversioning info. */ +struct GTY((for_user)) cgraph_function_version_info { + /* The cgraph_node for which the function version info is stored. */ + cgraph_node *this_node; + /* Chains all the semantically identical function versions. The + first function in this chain is the version_info node of the + default function. */ + cgraph_function_version_info *prev; + /* If this version node corresponds to a dispatcher for function + versions, this points to the version info node of the default + function, the first node in the chain. */ + cgraph_function_version_info *next; + /* If this node corresponds to a function version, this points + to the dispatcher function decl, which is the function that must + be called to execute the right function version at run-time. + + If this cgraph node is a dispatcher (if dispatcher_function is + true, in the cgraph_node struct) for function versions, this + points to resolver function, which holds the function body of the + dispatcher. The dispatcher decl is an alias to the resolver + function decl. */ + tree dispatcher_resolver; +}; + +#define DEFCIFCODE(code, type, string) CIF_ ## code, +/* Reasons for inlining failures. */ + +enum cgraph_inline_failed_t { +#include "cif-code.def" + CIF_N_REASONS +}; + +enum cgraph_inline_failed_type_t +{ + CIF_FINAL_NORMAL = 0, + CIF_FINAL_ERROR +}; + +struct cgraph_edge; + +struct cgraph_edge_hasher : ggc_ptr_hash +{ + typedef gimple *compare_type; + + static hashval_t hash (cgraph_edge *); + static hashval_t hash (gimple *); + static bool equal (cgraph_edge *, gimple *); +}; + +/* The cgraph data structure. + Each function decl has assigned cgraph_node listing callees and callers. */ + +struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node { +public: + /* Remove the node from cgraph and all inline clones inlined into it. + Skip however removal of FORBIDDEN_NODE and return true if it needs to be + removed. This allows to call the function from outer loop walking clone + tree. */ + bool remove_symbol_and_inline_clones (cgraph_node *forbidden_node = NULL); + + /* Record all references from cgraph_node that are taken + in statement STMT. */ + void record_stmt_references (gimple *stmt); + + /* Like cgraph_set_call_stmt but walk the clone tree and update all + clones sharing the same function body. + When WHOLE_SPECULATIVE_EDGES is true, all three components of + speculative edge gets updated. Otherwise we update only direct + call. */ + void set_call_stmt_including_clones (gimple *old_stmt, gcall *new_stmt, + bool update_speculative = true); + + /* Walk the alias chain to return the function cgraph_node is alias of. + Walk through thunk, too. + When AVAILABILITY is non-NULL, get minimal availability in the chain. + When REF is non-NULL, assume that reference happens in symbol REF + when determining the availability. */ + cgraph_node *function_symbol (enum availability *avail = NULL, + struct symtab_node *ref = NULL); + + /* Walk the alias chain to return the function cgraph_node is alias of. + Walk through non virtual thunks, too. Thus we return either a function + or a virtual thunk node. + When AVAILABILITY is non-NULL, get minimal availability in the chain. + When REF is non-NULL, assume that reference happens in symbol REF + when determining the availability. */ + cgraph_node *function_or_virtual_thunk_symbol + (enum availability *avail = NULL, + struct symtab_node *ref = NULL); + + /* Create node representing clone of N executed COUNT times. Decrease + the execution counts from original node too. + The new clone will have decl set to DECL that may or may not be the same + as decl of N. + + When UPDATE_ORIGINAL is true, the counts are subtracted from the original + function's profile to reflect the fact that part of execution is handled + by node. + When CALL_DUPLICATOIN_HOOK is true, the ipa passes are acknowledged about + the new clone. Otherwise the caller is responsible for doing so later. + + If the new node is being inlined into another one, NEW_INLINED_TO should be + the outline function the new one is (even indirectly) inlined to. + All hooks will see this in node's global.inlined_to, when invoked. + Can be NULL if the node is not inlined. SUFFIX is string that is appended + to the original name. */ + cgraph_node *create_clone (tree decl, gcov_type count, int freq, + bool update_original, + vec redirect_callers, + bool call_duplication_hook, + cgraph_node *new_inlined_to, + bitmap args_to_skip, const char *suffix = NULL); + + /* Create callgraph node clone with new declaration. The actual body will + be copied later at compilation stage. */ + cgraph_node *create_virtual_clone (vec redirect_callers, + vec *tree_map, + bitmap args_to_skip, const char * suffix); + + /* cgraph node being removed from symbol table; see if its entry can be + replaced by other inline clone. */ + cgraph_node *find_replacement (void); + + /* Create a new cgraph node which is the new version of + callgraph node. REDIRECT_CALLERS holds the callers + edges which should be redirected to point to + NEW_VERSION. ALL the callees edges of the node + are cloned to the new version node. Return the new + version node. + + If non-NULL BLOCK_TO_COPY determine what basic blocks + was copied to prevent duplications of calls that are dead + in the clone. + + SUFFIX is string that is appended to the original name. */ + + cgraph_node *create_version_clone (tree new_decl, + vec redirect_callers, + bitmap bbs_to_copy, + const char *suffix = NULL); + + /* Perform function versioning. + Function versioning includes copying of the tree and + a callgraph update (creating a new cgraph node and updating + its callees and callers). + + REDIRECT_CALLERS varray includes the edges to be redirected + to the new version. + + TREE_MAP is a mapping of tree nodes we want to replace with + new ones (according to results of prior analysis). + + If non-NULL ARGS_TO_SKIP determine function parameters to remove + from new version. + If SKIP_RETURN is true, the new version will return void. + If non-NULL BLOCK_TO_COPY determine what basic blocks to copy. + If non_NULL NEW_ENTRY determine new entry BB of the clone. + + Return the new version's cgraph node. */ + cgraph_node *create_version_clone_with_body + (vec redirect_callers, + vec *tree_map, bitmap args_to_skip, + bool skip_return, bitmap bbs_to_copy, basic_block new_entry_block, + const char *clone_name); + + /* Insert a new cgraph_function_version_info node into cgraph_fnver_htab + corresponding to cgraph_node. */ + cgraph_function_version_info *insert_new_function_version (void); + + /* Get the cgraph_function_version_info node corresponding to node. */ + cgraph_function_version_info *function_version (void); + + /* Discover all functions and variables that are trivially needed, analyze + them as well as all functions and variables referred by them */ + void analyze (void); + + /* Add thunk alias into callgraph. The alias declaration is ALIAS and it + aliases DECL with an adjustments made into the first parameter. + See comments in thunk_adjust for detail on the parameters. */ + cgraph_node * create_thunk (tree alias, tree, bool this_adjusting, + HOST_WIDE_INT fixed_offset, + HOST_WIDE_INT virtual_value, + tree virtual_offset, + tree real_alias); + + + /* Return node that alias is aliasing. */ + inline cgraph_node *get_alias_target (void); + + /* Given function symbol, walk the alias chain to return the function node + is alias of. Do not walk through thunks. + When AVAILABILITY is non-NULL, get minimal availability in the chain. + When REF is non-NULL, assume that reference happens in symbol REF + when determining the availability. */ + + cgraph_node *ultimate_alias_target (availability *availability = NULL, + symtab_node *ref = NULL); + + /* Expand thunk NODE to gimple if possible. + When FORCE_GIMPLE_THUNK is true, gimple thunk is created and + no assembler is produced. + When OUTPUT_ASM_THUNK is true, also produce assembler for + thunks that are not lowered. */ + bool expand_thunk (bool output_asm_thunks, bool force_gimple_thunk); + + /* Call expand_thunk on all callers that are thunks and analyze those + nodes that were expanded. */ + void expand_all_artificial_thunks (); + + /* Assemble thunks and aliases associated to node. */ + void assemble_thunks_and_aliases (void); + + /* Expand function specified by node. */ + void expand (void); + + /* As an GCC extension we allow redefinition of the function. The + semantics when both copies of bodies differ is not well defined. + We replace the old body with new body so in unit at a time mode + we always use new body, while in normal mode we may end up with + old body inlined into some functions and new body expanded and + inlined in others. */ + void reset (void); + + /* Creates a wrapper from cgraph_node to TARGET node. Thunk is used for this + kind of wrapper method. */ + void create_wrapper (cgraph_node *target); + + /* Verify cgraph nodes of the cgraph node. */ + void DEBUG_FUNCTION verify_node (void); + + /* Remove function from symbol table. */ + void remove (void); + + /* Dump call graph node to file F. */ + void dump (FILE *f); + + /* Dump call graph node to stderr. */ + void DEBUG_FUNCTION debug (void); + + /* When doing LTO, read cgraph_node's body from disk if it is not already + present. */ + bool get_untransformed_body (void); + + /* Prepare function body. When doing LTO, read cgraph_node's body from disk + if it is not already present. When some IPA transformations are scheduled, + apply them. */ + bool get_body (void); + + /* Release memory used to represent body of function. + Use this only for functions that are released before being translated to + target code (i.e. RTL). Functions that are compiled to RTL and beyond + are free'd in final.c via free_after_compilation(). */ + void release_body (bool keep_arguments = false); + + /* Return the DECL_STRUCT_FUNCTION of the function. */ + struct function *get_fun (void); + + /* cgraph_node is no longer nested function; update cgraph accordingly. */ + void unnest (void); + + /* Bring cgraph node local. */ + void make_local (void); + + /* Likewise indicate that a node is having address taken. */ + void mark_address_taken (void); + + /* Set fialization priority to PRIORITY. */ + void set_fini_priority (priority_type priority); + + /* Return the finalization priority. */ + priority_type get_fini_priority (void); + + /* Create edge from a given function to CALLEE in the cgraph. */ + cgraph_edge *create_edge (cgraph_node *callee, + gcall *call_stmt, gcov_type count, + int freq); + + /* Create an indirect edge with a yet-undetermined callee where the call + statement destination is a formal parameter of the caller with index + PARAM_INDEX. */ + cgraph_edge *create_indirect_edge (gcall *call_stmt, int ecf_flags, + gcov_type count, int freq, + bool compute_indirect_info = true); + + /* Like cgraph_create_edge walk the clone tree and update all clones sharing + same function body. If clones already have edge for OLD_STMT; only + update the edge same way as cgraph_set_call_stmt_including_clones does. */ + void create_edge_including_clones (cgraph_node *callee, + gimple *old_stmt, gcall *stmt, + gcov_type count, + int freq, + cgraph_inline_failed_t reason); + + /* Return the callgraph edge representing the GIMPLE_CALL statement + CALL_STMT. */ + cgraph_edge *get_edge (gimple *call_stmt); + + /* Collect all callers of cgraph_node and its aliases that are known to lead + to NODE (i.e. are not overwritable) and that are not thunks. */ + vec collect_callers (void); + + /* Remove all callers from the node. */ + void remove_callers (void); + + /* Remove all callees from the node. */ + void remove_callees (void); + + /* Return function availability. See cgraph.h for description of individual + return values. */ + enum availability get_availability (symtab_node *ref = NULL); + + /* Set TREE_NOTHROW on cgraph_node's decl and on aliases of the node + if any to NOTHROW. */ + bool set_nothrow_flag (bool nothrow); + + /* If SET_CONST is true, mark function, aliases and thunks to be ECF_CONST. + If SET_CONST if false, clear the flag. + + When setting the flag be careful about possible interposition and + do not set the flag for functions that can be interposet and set pure + flag for functions that can bind to other definition. + + Return true if any change was done. */ + + bool set_const_flag (bool set_const, bool looping); + + /* Set DECL_PURE_P on cgraph_node's decl and on aliases of the node + if any to PURE. + + When setting the flag, be careful about possible interposition. + Return true if any change was done. */ + + bool set_pure_flag (bool pure, bool looping); + + /* Call callback on function and aliases associated to the function. + When INCLUDE_OVERWRITABLE is false, overwritable aliases and thunks are + skipped. */ + + bool call_for_symbol_and_aliases (bool (*callback) (cgraph_node *, + void *), + void *data, bool include_overwritable); + + /* Call callback on cgraph_node, thunks and aliases associated to NODE. + When INCLUDE_OVERWRITABLE is false, overwritable aliases and thunks are + skipped. When EXCLUDE_VIRTUAL_THUNKS is true, virtual thunks are + skipped. */ + bool call_for_symbol_thunks_and_aliases (bool (*callback) (cgraph_node *node, + void *data), + void *data, + bool include_overwritable, + bool exclude_virtual_thunks = false); + + /* Likewise indicate that a node is needed, i.e. reachable via some + external means. */ + inline void mark_force_output (void); + + /* Return true when function can be marked local. */ + bool local_p (void); + + /* Return true if cgraph_node can be made local for API change. + Extern inline functions and C++ COMDAT functions can be made local + at the expense of possible code size growth if function is used in multiple + compilation units. */ + bool can_be_local_p (void); + + /* Return true when cgraph_node can not return or throw and thus + it is safe to ignore its side effects for IPA analysis. */ + bool cannot_return_p (void); + + /* Return true when function cgraph_node and all its aliases are only called + directly. + i.e. it is not externally visible, address was not taken and + it is not used in any other non-standard way. */ + bool only_called_directly_p (void); + + /* Return true when function is only called directly or it has alias. + i.e. it is not externally visible, address was not taken and + it is not used in any other non-standard way. */ + inline bool only_called_directly_or_aliased_p (void); + + /* Return true when function cgraph_node can be expected to be removed + from program when direct calls in this compilation unit are removed. + + As a special case COMDAT functions are + cgraph_can_remove_if_no_direct_calls_p while the are not + cgraph_only_called_directly_p (it is possible they are called from other + unit) + + This function behaves as cgraph_only_called_directly_p because eliminating + all uses of COMDAT function does not make it necessarily disappear from + the program unless we are compiling whole program or we do LTO. In this + case we know we win since dynamic linking will not really discard the + linkonce section. + + If WILL_INLINE is true, assume that function will be inlined into all the + direct calls. */ + bool will_be_removed_from_program_if_no_direct_calls_p + (bool will_inline = false); + + /* Return true when function can be removed from callgraph + if all direct calls and references are eliminated. The function does + not take into account comdat groups. */ + bool can_remove_if_no_direct_calls_and_refs_p (void); + + /* Return true when function cgraph_node and its aliases can be removed from + callgraph if all direct calls are eliminated. + If WILL_INLINE is true, assume that function will be inlined into all the + direct calls. */ + bool can_remove_if_no_direct_calls_p (bool will_inline = false); + + /* Return true when callgraph node is a function with Gimple body defined + in current unit. Functions can also be define externally or they + can be thunks with no Gimple representation. + + Note that at WPA stage, the function body may not be present in memory. */ + inline bool has_gimple_body_p (void); + + /* Return true if function should be optimized for size. */ + bool optimize_for_size_p (void); + + /* Dump the callgraph to file F. */ + static void dump_cgraph (FILE *f); + + /* Dump the call graph to stderr. */ + static inline + void debug_cgraph (void) + { + dump_cgraph (stderr); + } + + /* Record that DECL1 and DECL2 are semantically identical function + versions. */ + static void record_function_versions (tree decl1, tree decl2); + + /* Remove the cgraph_function_version_info and cgraph_node for DECL. This + DECL is a duplicate declaration. */ + static void delete_function_version (tree decl); + + /* Add the function FNDECL to the call graph. + Unlike finalize_function, this function is intended to be used + by middle end and allows insertion of new function at arbitrary point + of compilation. The function can be either in high, low or SSA form + GIMPLE. + + The function is assumed to be reachable and have address taken (so no + API breaking optimizations are performed on it). + + Main work done by this function is to enqueue the function for later + processing to avoid need the passes to be re-entrant. */ + static void add_new_function (tree fndecl, bool lowered); + + /* Return callgraph node for given symbol and check it is a function. */ + static inline cgraph_node *get (const_tree decl) + { + gcc_checking_assert (TREE_CODE (decl) == FUNCTION_DECL); + return dyn_cast (symtab_node::get (decl)); + } + + /* DECL has been parsed. Take it, queue it, compile it at the whim of the + logic in effect. If NO_COLLECT is true, then our caller cannot stand to + have the garbage collector run at the moment. We would need to either + create a new GC context, or just not compile right now. */ + static void finalize_function (tree, bool); + + /* Return cgraph node assigned to DECL. Create new one when needed. */ + static cgraph_node * create (tree decl); + + /* Try to find a call graph node for declaration DECL and if it does not + exist or if it corresponds to an inline clone, create a new one. */ + static cgraph_node * get_create (tree); + + /* Return local info for the compiled function. */ + static cgraph_local_info *local_info (tree decl); + + /* Return local info for the compiled function. */ + static struct cgraph_rtl_info *rtl_info (tree); + + /* Return the cgraph node that has ASMNAME for its DECL_ASSEMBLER_NAME. + Return NULL if there's no such node. */ + static cgraph_node *get_for_asmname (tree asmname); + + /* Attempt to mark ALIAS as an alias to DECL. Return alias node if + successful and NULL otherwise. + Same body aliases are output whenever the body of DECL is output, + and cgraph_node::get (ALIAS) transparently + returns cgraph_node::get (DECL). */ + static cgraph_node * create_same_body_alias (tree alias, tree decl); + + /* Verify whole cgraph structure. */ + static void DEBUG_FUNCTION verify_cgraph_nodes (void); + + /* Verify cgraph, if consistency checking is enabled. */ + static inline void checking_verify_cgraph_nodes (void); + + /* Worker to bring NODE local. */ + static bool make_local (cgraph_node *node, void *); + + /* Mark ALIAS as an alias to DECL. DECL_NODE is cgraph node representing + the function body is associated + with (not necessarily cgraph_node (DECL). */ + static cgraph_node *create_alias (tree alias, tree target); + + /* Return true if NODE has thunk. */ + static bool has_thunk_p (cgraph_node *node, void *); + + cgraph_edge *callees; + cgraph_edge *callers; + /* List of edges representing indirect calls with a yet undetermined + callee. */ + cgraph_edge *indirect_calls; + /* For nested functions points to function the node is nested in. */ + cgraph_node *origin; + /* Points to first nested function, if any. */ + cgraph_node *nested; + /* Pointer to the next function with same origin, if any. */ + cgraph_node *next_nested; + /* Pointer to the next clone. */ + cgraph_node *next_sibling_clone; + cgraph_node *prev_sibling_clone; + cgraph_node *clones; + cgraph_node *clone_of; + /* If instrumentation_clone is 1 then instrumented_version points + to the original function used to make instrumented version. + Otherwise points to instrumented version of the function. */ + cgraph_node *instrumented_version; + /* If instrumentation_clone is 1 then orig_decl is the original + function declaration. */ + tree orig_decl; + /* For functions with many calls sites it holds map from call expression + to the edge to speed up cgraph_edge function. */ + hash_table *GTY(()) call_site_hash; + /* Declaration node used to be clone of. */ + tree former_clone_of; + + /* If this is a SIMD clone, this points to the SIMD specific + information for it. */ + cgraph_simd_clone *simdclone; + /* If this function has SIMD clones, this points to the first clone. */ + cgraph_node *simd_clones; + + /* Interprocedural passes scheduled to have their transform functions + applied next time we execute local pass on them. We maintain it + per-function in order to allow IPA passes to introduce new functions. */ + vec GTY((skip)) ipa_transforms_to_apply; + + cgraph_local_info local; + cgraph_global_info global; + struct cgraph_rtl_info *rtl; + cgraph_clone_info clone; + cgraph_thunk_info thunk; + + /* Expected number of executions: calculated in profile.c. */ + gcov_type count; + /* How to scale counts at materialization time; used to merge + LTO units with different number of profile runs. */ + int count_materialization_scale; + /* Unique id of the node. */ + int uid; + /* Summary unique id of the node. */ + int summary_uid; + /* ID assigned by the profiling. */ + unsigned int profile_id; + /* Time profiler: first run of function. */ + int tp_first_run; + + /* Set when decl is an abstract function pointed to by the + ABSTRACT_DECL_ORIGIN of a reachable function. */ + unsigned used_as_abstract_origin : 1; + /* Set once the function is lowered (i.e. its CFG is built). */ + unsigned lowered : 1; + /* Set once the function has been instantiated and its callee + lists created. */ + unsigned process : 1; + /* How commonly executed the node is. Initialized during branch + probabilities pass. */ + ENUM_BITFIELD (node_frequency) frequency : 2; + /* True when function can only be called at startup (from static ctor). */ + unsigned only_called_at_startup : 1; + /* True when function can only be called at startup (from static dtor). */ + unsigned only_called_at_exit : 1; + /* True when function is the transactional clone of a function which + is called only from inside transactions. */ + /* ?? We should be able to remove this. We have enough bits in + cgraph to calculate it. */ + unsigned tm_clone : 1; + /* True if this decl is a dispatcher for function versions. */ + unsigned dispatcher_function : 1; + /* True if this decl calls a COMDAT-local function. This is set up in + compute_inline_parameters and inline_call. */ + unsigned calls_comdat_local : 1; + /* True if node has been created by merge operation in IPA-ICF. */ + unsigned icf_merged: 1; + /* True when function is clone created for Pointer Bounds Checker + instrumentation. */ + unsigned instrumentation_clone : 1; + /* True if call to node can't result in a call to free, munmap or + other operation that could make previously non-trapping memory + accesses trapping. */ + unsigned nonfreeing_fn : 1; + /* True if there was multiple COMDAT bodies merged by lto-symtab. */ + unsigned merged_comdat : 1; + /* True if function was created to be executed in parallel. */ + unsigned parallelized_function : 1; + /* True if function is part split out by ipa-split. */ + unsigned split_part : 1; + /* True if the function appears as possible target of indirect call. */ + unsigned indirect_call_target : 1; + +private: + /* Worker for call_for_symbol_and_aliases. */ + bool call_for_symbol_and_aliases_1 (bool (*callback) (cgraph_node *, + void *), + void *data, bool include_overwritable); +}; + +/* A cgraph node set is a collection of cgraph nodes. A cgraph node + can appear in multiple sets. */ +struct cgraph_node_set_def +{ + hash_map *map; + vec nodes; +}; + +typedef cgraph_node_set_def *cgraph_node_set; +typedef struct varpool_node_set_def *varpool_node_set; + +class varpool_node; + +/* A varpool node set is a collection of varpool nodes. A varpool node + can appear in multiple sets. */ +struct varpool_node_set_def +{ + hash_map * map; + vec nodes; +}; + +/* Iterator structure for cgraph node sets. */ +struct cgraph_node_set_iterator +{ + cgraph_node_set set; + unsigned index; +}; + +/* Iterator structure for varpool node sets. */ +struct varpool_node_set_iterator +{ + varpool_node_set set; + unsigned index; +}; + +/* Context of polymorphic call. It represent information about the type of + instance that may reach the call. This is used by ipa-devirt walkers of the + type inheritance graph. */ + +class GTY(()) ipa_polymorphic_call_context { +public: + /* The called object appears in an object of type OUTER_TYPE + at offset OFFSET. When information is not 100% reliable, we + use SPECULATIVE_OUTER_TYPE and SPECULATIVE_OFFSET. */ + HOST_WIDE_INT offset; + HOST_WIDE_INT speculative_offset; + tree outer_type; + tree speculative_outer_type; + /* True if outer object may be in construction or destruction. */ + unsigned maybe_in_construction : 1; + /* True if outer object may be of derived type. */ + unsigned maybe_derived_type : 1; + /* True if speculative outer object may be of derived type. We always + speculate that construction does not happen. */ + unsigned speculative_maybe_derived_type : 1; + /* True if the context is invalid and all calls should be redirected + to BUILTIN_UNREACHABLE. */ + unsigned invalid : 1; + /* True if the outer type is dynamic. */ + unsigned dynamic : 1; + + /* Build empty "I know nothing" context. */ + ipa_polymorphic_call_context (); + /* Build polymorphic call context for indirect call E. */ + ipa_polymorphic_call_context (cgraph_edge *e); + /* Build polymorphic call context for IP invariant CST. + If specified, OTR_TYPE specify the type of polymorphic call + that takes CST+OFFSET as a prameter. */ + ipa_polymorphic_call_context (tree cst, tree otr_type = NULL, + HOST_WIDE_INT offset = 0); + /* Build context for pointer REF contained in FNDECL at statement STMT. + if INSTANCE is non-NULL, return pointer to the object described by + the context. */ + ipa_polymorphic_call_context (tree fndecl, tree ref, gimple *stmt, + tree *instance = NULL); + + /* Look for vtable stores or constructor calls to work out dynamic type + of memory location. */ + bool get_dynamic_type (tree, tree, tree, gimple *); + + /* Make context non-speculative. */ + void clear_speculation (); + + /* Produce context specifying all derrived types of OTR_TYPE. If OTR_TYPE is + NULL, the context is set to dummy "I know nothing" setting. */ + void clear_outer_type (tree otr_type = NULL); + + /* Walk container types and modify context to point to actual class + containing OTR_TYPE (if non-NULL) as base class. + Return true if resulting context is valid. + + When CONSIDER_PLACEMENT_NEW is false, reject contexts that may be made + valid only via allocation of new polymorphic type inside by means + of placement new. + + When CONSIDER_BASES is false, only look for actual fields, not base types + of TYPE. */ + bool restrict_to_inner_class (tree otr_type, + bool consider_placement_new = true, + bool consider_bases = true); + + /* Adjust all offsets in contexts by given number of bits. */ + void offset_by (HOST_WIDE_INT); + /* Use when we can not track dynamic type change. This speculatively assume + type change is not happening. */ + void possible_dynamic_type_change (bool, tree otr_type = NULL); + /* Assume that both THIS and a given context is valid and strenghten THIS + if possible. Return true if any strenghtening was made. + If actual type the context is being used in is known, OTR_TYPE should be + set accordingly. This improves quality of combined result. */ + bool combine_with (ipa_polymorphic_call_context, tree otr_type = NULL); + bool meet_with (ipa_polymorphic_call_context, tree otr_type = NULL); + + /* Return TRUE if context is fully useless. */ + bool useless_p () const; + /* Return TRUE if this context conveys the same information as X. */ + bool equal_to (const ipa_polymorphic_call_context &x) const; + + /* Dump human readable context to F. If NEWLINE is true, it will be + terminated by a newline. */ + void dump (FILE *f, bool newline = true) const; + void DEBUG_FUNCTION debug () const; + + /* LTO streaming. */ + void stream_out (struct output_block *) const; + void stream_in (struct lto_input_block *, struct data_in *data_in); + +private: + bool combine_speculation_with (tree, HOST_WIDE_INT, bool, tree); + bool meet_speculation_with (tree, HOST_WIDE_INT, bool, tree); + void set_by_decl (tree, HOST_WIDE_INT); + bool set_by_invariant (tree, tree, HOST_WIDE_INT); + bool speculation_consistent_p (tree, HOST_WIDE_INT, bool, tree) const; + void make_speculative (tree otr_type = NULL); +}; + +/* Structure containing additional information about an indirect call. */ + +struct GTY(()) cgraph_indirect_call_info +{ + /* When agg_content is set, an offset where the call pointer is located + within the aggregate. */ + HOST_WIDE_INT offset; + /* Context of the polymorphic call; use only when POLYMORPHIC flag is set. */ + ipa_polymorphic_call_context context; + /* OBJ_TYPE_REF_TOKEN of a polymorphic call (if polymorphic is set). */ + HOST_WIDE_INT otr_token; + /* Type of the object from OBJ_TYPE_REF_OBJECT. */ + tree otr_type; + /* Index of the parameter that is called. */ + int param_index; + /* ECF flags determined from the caller. */ + int ecf_flags; + /* Profile_id of common target obtrained from profile. */ + int common_target_id; + /* Probability that call will land in function with COMMON_TARGET_ID. */ + int common_target_probability; + + /* Set when the call is a virtual call with the parameter being the + associated object pointer rather than a simple direct call. */ + unsigned polymorphic : 1; + /* Set when the call is a call of a pointer loaded from contents of an + aggregate at offset. */ + unsigned agg_contents : 1; + /* Set when this is a call through a member pointer. */ + unsigned member_ptr : 1; + /* When the agg_contents bit is set, this one determines whether the + destination is loaded from a parameter passed by reference. */ + unsigned by_ref : 1; + /* When the agg_contents bit is set, this one determines whether we can + deduce from the function body that the loaded value from the reference is + never modified between the invocation of the function and the load + point. */ + unsigned guaranteed_unmodified : 1; + /* For polymorphic calls this specify whether the virtual table pointer + may have changed in between function entry and the call. */ + unsigned vptr_changed : 1; +}; + +struct GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller"), + for_user)) cgraph_edge { + friend class cgraph_node; + + /* Remove the edge in the cgraph. */ + void remove (void); + + /* Change field call_stmt of edge to NEW_STMT. + If UPDATE_SPECULATIVE and E is any component of speculative + edge, then update all components. */ + void set_call_stmt (gcall *new_stmt, bool update_speculative = true); + + /* Redirect callee of the edge to N. The function does not update underlying + call expression. */ + void redirect_callee (cgraph_node *n); + + /* If the edge does not lead to a thunk, simply redirect it to N. Otherwise + create one or more equivalent thunks for N and redirect E to the first in + the chain. Note that it is then necessary to call + n->expand_all_artificial_thunks once all callers are redirected. */ + void redirect_callee_duplicating_thunks (cgraph_node *n); + + /* Make an indirect edge with an unknown callee an ordinary edge leading to + CALLEE. DELTA is an integer constant that is to be added to the this + pointer (first parameter) to compensate for skipping + a thunk adjustment. */ + cgraph_edge *make_direct (cgraph_node *callee); + + /* Turn edge into speculative call calling N2. Update + the profile so the direct call is taken COUNT times + with FREQUENCY. */ + cgraph_edge *make_speculative (cgraph_node *n2, gcov_type direct_count, + int direct_frequency); + + /* Given speculative call edge, return all three components. */ + void speculative_call_info (cgraph_edge *&direct, cgraph_edge *&indirect, + ipa_ref *&reference); + + /* Speculative call edge turned out to be direct call to CALLE_DECL. + Remove the speculative call sequence and return edge representing the call. + It is up to caller to redirect the call as appropriate. */ + cgraph_edge *resolve_speculation (tree callee_decl = NULL); + + /* If necessary, change the function declaration in the call statement + associated with the edge so that it corresponds to the edge callee. */ + gimple *redirect_call_stmt_to_callee (void); + + /* Create clone of edge in the node N represented + by CALL_EXPR the callgraph. */ + cgraph_edge * clone (cgraph_node *n, gcall *call_stmt, unsigned stmt_uid, + gcov_type count_scale, int freq_scale, bool update_original); + + /* Verify edge count and frequency. */ + bool verify_count_and_frequency (); + + /* Return true when call of edge can not lead to return from caller + and thus it is safe to ignore its side effects for IPA analysis + when computing side effects of the caller. */ + bool cannot_lead_to_return_p (void); + + /* Return true when the edge represents a direct recursion. */ + bool recursive_p (void); + + /* Return true if the call can be hot. */ + bool maybe_hot_p (void); + + /* Rebuild cgraph edges for current function node. This needs to be run after + passes that don't update the cgraph. */ + static unsigned int rebuild_edges (void); + + /* Rebuild cgraph references for current function node. This needs to be run + after passes that don't update the cgraph. */ + static void rebuild_references (void); + + /* Expected number of executions: calculated in profile.c. */ + gcov_type count; + cgraph_node *caller; + cgraph_node *callee; + cgraph_edge *prev_caller; + cgraph_edge *next_caller; + cgraph_edge *prev_callee; + cgraph_edge *next_callee; + gcall *call_stmt; + /* Additional information about an indirect call. Not cleared when an edge + becomes direct. */ + cgraph_indirect_call_info *indirect_info; + PTR GTY ((skip (""))) aux; + /* When equal to CIF_OK, inline this call. Otherwise, points to the + explanation why function was not inlined. */ + enum cgraph_inline_failed_t inline_failed; + /* The stmt_uid of call_stmt. This is used by LTO to recover the call_stmt + when the function is serialized in. */ + unsigned int lto_stmt_uid; + /* Expected frequency of executions within the function. + When set to CGRAPH_FREQ_BASE, the edge is expected to be called once + per function call. The range is 0 to CGRAPH_FREQ_MAX. */ + int frequency; + /* Unique id of the edge. */ + int uid; + /* Whether this edge was made direct by indirect inlining. */ + unsigned int indirect_inlining_edge : 1; + /* Whether this edge describes an indirect call with an undetermined + callee. */ + unsigned int indirect_unknown_callee : 1; + /* Whether this edge is still a dangling */ + /* True if the corresponding CALL stmt cannot be inlined. */ + unsigned int call_stmt_cannot_inline_p : 1; + /* Can this call throw externally? */ + unsigned int can_throw_external : 1; + /* Edges with SPECULATIVE flag represents indirect calls that was + speculatively turned into direct (i.e. by profile feedback). + The final code sequence will have form: + + if (call_target == expected_fn) + expected_fn (); + else + call_target (); + + Every speculative call is represented by three components attached + to a same call statement: + 1) a direct call (to expected_fn) + 2) an indirect call (to call_target) + 3) a IPA_REF_ADDR refrence to expected_fn. + + Optimizers may later redirect direct call to clone, so 1) and 3) + do not need to necesarily agree with destination. */ + unsigned int speculative : 1; + /* Set to true when caller is a constructor or destructor of polymorphic + type. */ + unsigned in_polymorphic_cdtor : 1; + + /* Return true if call must bind to current definition. */ + bool binds_to_current_def_p (); + +private: + /* Remove the edge from the list of the callers of the callee. */ + void remove_caller (void); + + /* Remove the edge from the list of the callees of the caller. */ + void remove_callee (void); + + /* Set callee N of call graph edge and add it to the corresponding set of + callers. */ + void set_callee (cgraph_node *n); + + /* Output flags of edge to a file F. */ + void dump_edge_flags (FILE *f); + + /* Verify that call graph edge corresponds to DECL from the associated + statement. Return true if the verification should fail. */ + bool verify_corresponds_to_fndecl (tree decl); +}; + +#define CGRAPH_FREQ_BASE 1000 +#define CGRAPH_FREQ_MAX 100000 + +/* The varpool data structure. + Each static variable decl has assigned varpool_node. */ + +class GTY((tag ("SYMTAB_VARIABLE"))) varpool_node : public symtab_node { +public: + /* Dump given varpool node to F. */ + void dump (FILE *f); + + /* Dump given varpool node to stderr. */ + void DEBUG_FUNCTION debug (void); + + /* Remove variable from symbol table. */ + void remove (void); + + /* Remove node initializer when it is no longer needed. */ + void remove_initializer (void); + + void analyze (void); + + /* Return variable availability. */ + availability get_availability (symtab_node *ref = NULL); + + /* When doing LTO, read variable's constructor from disk if + it is not already present. */ + tree get_constructor (void); + + /* Return true if variable has constructor that can be used for folding. */ + bool ctor_useable_for_folding_p (void); + + /* For given variable pool node, walk the alias chain to return the function + the variable is alias of. Do not walk through thunks. + When AVAILABILITY is non-NULL, get minimal availability in the chain. + When REF is non-NULL, assume that reference happens in symbol REF + when determining the availability. */ + inline varpool_node *ultimate_alias_target + (availability *availability = NULL, symtab_node *ref = NULL); + + /* Return node that alias is aliasing. */ + inline varpool_node *get_alias_target (void); + + /* Output one variable, if necessary. Return whether we output it. */ + bool assemble_decl (void); + + /* For variables in named sections make sure get_variable_section + is called before we switch to those sections. Then section + conflicts between read-only and read-only requiring relocations + sections can be resolved. */ + void finalize_named_section_flags (void); + + /* Call calback on varpool symbol and aliases associated to varpool symbol. + When INCLUDE_OVERWRITABLE is false, overwritable aliases and thunks are + skipped. */ + bool call_for_symbol_and_aliases (bool (*callback) (varpool_node *, void *), + void *data, + bool include_overwritable); + + /* Return true when variable should be considered externally visible. */ + bool externally_visible_p (void); + + /* Return true when all references to variable must be visible + in ipa_ref_list. + i.e. if the variable is not externally visible or not used in some magic + way (asm statement or such). + The magic uses are all summarized in force_output flag. */ + inline bool all_refs_explicit_p (); + + /* Return true when variable can be removed from variable pool + if all direct calls are eliminated. */ + inline bool can_remove_if_no_refs_p (void); + + /* Add the variable DECL to the varpool. + Unlike finalize_decl function is intended to be used + by middle end and allows insertion of new variable at arbitrary point + of compilation. */ + static void add (tree decl); + + /* Return varpool node for given symbol and check it is a function. */ + static inline varpool_node *get (const_tree decl); + + /* Mark DECL as finalized. By finalizing the declaration, frontend instruct + the middle end to output the variable to asm file, if needed or externally + visible. */ + static void finalize_decl (tree decl); + + /* Attempt to mark ALIAS as an alias to DECL. Return TRUE if successful. + Extra name aliases are output whenever DECL is output. */ + static varpool_node * create_extra_name_alias (tree alias, tree decl); + + /* Attempt to mark ALIAS as an alias to DECL. Return TRUE if successful. + Extra name aliases are output whenever DECL is output. */ + static varpool_node * create_alias (tree, tree); + + /* Dump the variable pool to F. */ + static void dump_varpool (FILE *f); + + /* Dump the variable pool to stderr. */ + static void DEBUG_FUNCTION debug_varpool (void); + + /* Allocate new callgraph node and insert it into basic data structures. */ + static varpool_node *create_empty (void); + + /* Return varpool node assigned to DECL. Create new one when needed. */ + static varpool_node *get_create (tree decl); + + /* Given an assembler name, lookup node. */ + static varpool_node *get_for_asmname (tree asmname); + + /* Set when variable is scheduled to be assembled. */ + unsigned output : 1; + + /* Set when variable has statically initialized pointer + or is a static bounds variable and needs initalization. */ + unsigned need_bounds_init : 1; + + /* Set if the variable is dynamically initialized, except for + function local statics. */ + unsigned dynamically_initialized : 1; + + ENUM_BITFIELD(tls_model) tls_model : 3; + + /* Set if the variable is known to be used by single function only. + This is computed by ipa_signle_use pass and used by late optimizations + in places where optimization would be valid for local static variable + if we did not do any inter-procedural code movement. */ + unsigned used_by_single_function : 1; + +private: + /* Assemble thunks and aliases associated to varpool node. */ + void assemble_aliases (void); + + /* Worker for call_for_node_and_aliases. */ + bool call_for_symbol_and_aliases_1 (bool (*callback) (varpool_node *, void *), + void *data, + bool include_overwritable); +}; + +/* Every top level asm statement is put into a asm_node. */ + +struct GTY(()) asm_node { + + + /* Next asm node. */ + asm_node *next; + /* String for this asm node. */ + tree asm_str; + /* Ordering of all cgraph nodes. */ + int order; +}; + +/* Report whether or not THIS symtab node is a function, aka cgraph_node. */ + +template <> +template <> +inline bool +is_a_helper ::test (symtab_node *p) +{ + return p && p->type == SYMTAB_FUNCTION; +} + +/* Report whether or not THIS symtab node is a vriable, aka varpool_node. */ + +template <> +template <> +inline bool +is_a_helper ::test (symtab_node *p) +{ + return p && p->type == SYMTAB_VARIABLE; +} + +/* Macros to access the next item in the list of free cgraph nodes and + edges. */ +#define NEXT_FREE_NODE(NODE) dyn_cast ((NODE)->next) +#define SET_NEXT_FREE_NODE(NODE,NODE2) ((NODE))->next = NODE2 +#define NEXT_FREE_EDGE(EDGE) (EDGE)->prev_caller + +typedef void (*cgraph_edge_hook)(cgraph_edge *, void *); +typedef void (*cgraph_node_hook)(cgraph_node *, void *); +typedef void (*varpool_node_hook)(varpool_node *, void *); +typedef void (*cgraph_2edge_hook)(cgraph_edge *, cgraph_edge *, void *); +typedef void (*cgraph_2node_hook)(cgraph_node *, cgraph_node *, void *); + +struct cgraph_edge_hook_list; +struct cgraph_node_hook_list; +struct varpool_node_hook_list; +struct cgraph_2edge_hook_list; +struct cgraph_2node_hook_list; + +/* Map from a symbol to initialization/finalization priorities. */ +struct GTY(()) symbol_priority_map { + priority_type init; + priority_type fini; +}; + +enum symtab_state +{ + /* Frontend is parsing and finalizing functions. */ + PARSING, + /* Callgraph is being constructed. It is safe to add new functions. */ + CONSTRUCTION, + /* Callgraph is being streamed-in at LTO time. */ + LTO_STREAMING, + /* Callgraph is built and early IPA passes are being run. */ + IPA, + /* Callgraph is built and all functions are transformed to SSA form. */ + IPA_SSA, + /* All inline decisions are done; it is now possible to remove extern inline + functions and virtual call targets. */ + IPA_SSA_AFTER_INLINING, + /* Functions are now ordered and being passed to RTL expanders. */ + EXPANSION, + /* All cgraph expansion is done. */ + FINISHED +}; + +struct asmname_hasher : ggc_ptr_hash +{ + typedef const_tree compare_type; + + static hashval_t hash (symtab_node *n); + static bool equal (symtab_node *n, const_tree t); +}; + +class GTY((tag ("SYMTAB"))) symbol_table +{ +public: + friend class symtab_node; + friend class cgraph_node; + friend class cgraph_edge; + + symbol_table (): cgraph_max_summary_uid (1) + { + } + + /* Initialize callgraph dump file. */ + void initialize (void); + + /* Register a top-level asm statement ASM_STR. */ + inline asm_node *finalize_toplevel_asm (tree asm_str); + + /* Analyze the whole compilation unit once it is parsed completely. */ + void finalize_compilation_unit (void); + + /* C++ frontend produce same body aliases all over the place, even before PCH + gets streamed out. It relies on us linking the aliases with their function + in order to do the fixups, but ipa-ref is not PCH safe. Consequentely we + first produce aliases without links, but once C++ FE is sure he won't sream + PCH we build the links via this function. */ + void process_same_body_aliases (void); + + /* Perform simple optimizations based on callgraph. */ + void compile (void); + + /* Process CGRAPH_NEW_FUNCTIONS and perform actions necessary to add these + functions into callgraph in a way so they look like ordinary reachable + functions inserted into callgraph already at construction time. */ + void process_new_functions (void); + + /* Once all functions from compilation unit are in memory, produce all clones + and update all calls. We might also do this on demand if we don't want to + bring all functions to memory prior compilation, but current WHOPR + implementation does that and it is bit easier to keep everything right + in this order. */ + void materialize_all_clones (void); + + /* Register a symbol NODE. */ + inline void register_symbol (symtab_node *node); + + inline void + clear_asm_symbols (void) + { + asmnodes = NULL; + asm_last_node = NULL; + } + + /* Perform reachability analysis and reclaim all unreachable nodes. */ + bool remove_unreachable_nodes (FILE *file); + + /* Optimization of function bodies might've rendered some variables as + unnecessary so we want to avoid these from being compiled. Re-do + reachability starting from variables that are either externally visible + or was referred from the asm output routines. */ + void remove_unreferenced_decls (void); + + /* Unregister a symbol NODE. */ + inline void unregister (symtab_node *node); + + /* Allocate new callgraph node and insert it into basic data structures. */ + cgraph_node *create_empty (void); + + /* Release a callgraph NODE with UID and put in to the list + of free nodes. */ + void release_symbol (cgraph_node *node, int uid); + + /* Output all variables enqueued to be assembled. */ + bool output_variables (void); + + /* Weakrefs may be associated to external decls and thus not output + at expansion time. Emit all necessary aliases. */ + void output_weakrefs (void); + + /* Return first static symbol with definition. */ + inline symtab_node *first_symbol (void); + + /* Return first assembler symbol. */ + inline asm_node * + first_asm_symbol (void) + { + return asmnodes; + } + + /* Return first static symbol with definition. */ + inline symtab_node *first_defined_symbol (void); + + /* Return first variable. */ + inline varpool_node *first_variable (void); + + /* Return next variable after NODE. */ + inline varpool_node *next_variable (varpool_node *node); + + /* Return first static variable with initializer. */ + inline varpool_node *first_static_initializer (void); + + /* Return next static variable with initializer after NODE. */ + inline varpool_node *next_static_initializer (varpool_node *node); + + /* Return first static variable with definition. */ + inline varpool_node *first_defined_variable (void); + + /* Return next static variable with definition after NODE. */ + inline varpool_node *next_defined_variable (varpool_node *node); + + /* Return first function with body defined. */ + inline cgraph_node *first_defined_function (void); + + /* Return next function with body defined after NODE. */ + inline cgraph_node *next_defined_function (cgraph_node *node); + + /* Return first function. */ + inline cgraph_node *first_function (void); + + /* Return next function. */ + inline cgraph_node *next_function (cgraph_node *node); + + /* Return first function with body defined. */ + cgraph_node *first_function_with_gimple_body (void); + + /* Return next reachable static variable with initializer after NODE. */ + inline cgraph_node *next_function_with_gimple_body (cgraph_node *node); + + /* Register HOOK to be called with DATA on each removed edge. */ + cgraph_edge_hook_list *add_edge_removal_hook (cgraph_edge_hook hook, + void *data); + + /* Remove ENTRY from the list of hooks called on removing edges. */ + void remove_edge_removal_hook (cgraph_edge_hook_list *entry); + + /* Register HOOK to be called with DATA on each removed node. */ + cgraph_node_hook_list *add_cgraph_removal_hook (cgraph_node_hook hook, + void *data); + + /* Remove ENTRY from the list of hooks called on removing nodes. */ + void remove_cgraph_removal_hook (cgraph_node_hook_list *entry); + + /* Register HOOK to be called with DATA on each removed node. */ + varpool_node_hook_list *add_varpool_removal_hook (varpool_node_hook hook, + void *data); + + /* Remove ENTRY from the list of hooks called on removing nodes. */ + void remove_varpool_removal_hook (varpool_node_hook_list *entry); + + /* Register HOOK to be called with DATA on each inserted node. */ + cgraph_node_hook_list *add_cgraph_insertion_hook (cgraph_node_hook hook, + void *data); + + /* Remove ENTRY from the list of hooks called on inserted nodes. */ + void remove_cgraph_insertion_hook (cgraph_node_hook_list *entry); + + /* Register HOOK to be called with DATA on each inserted node. */ + varpool_node_hook_list *add_varpool_insertion_hook (varpool_node_hook hook, + void *data); + + /* Remove ENTRY from the list of hooks called on inserted nodes. */ + void remove_varpool_insertion_hook (varpool_node_hook_list *entry); + + /* Register HOOK to be called with DATA on each duplicated edge. */ + cgraph_2edge_hook_list *add_edge_duplication_hook (cgraph_2edge_hook hook, + void *data); + /* Remove ENTRY from the list of hooks called on duplicating edges. */ + void remove_edge_duplication_hook (cgraph_2edge_hook_list *entry); + + /* Register HOOK to be called with DATA on each duplicated node. */ + cgraph_2node_hook_list *add_cgraph_duplication_hook (cgraph_2node_hook hook, + void *data); + + /* Remove ENTRY from the list of hooks called on duplicating nodes. */ + void remove_cgraph_duplication_hook (cgraph_2node_hook_list *entry); + + /* Call all edge removal hooks. */ + void call_edge_removal_hooks (cgraph_edge *e); + + /* Call all node insertion hooks. */ + void call_cgraph_insertion_hooks (cgraph_node *node); + + /* Call all node removal hooks. */ + void call_cgraph_removal_hooks (cgraph_node *node); + + /* Call all node duplication hooks. */ + void call_cgraph_duplication_hooks (cgraph_node *node, cgraph_node *node2); + + /* Call all edge duplication hooks. */ + void call_edge_duplication_hooks (cgraph_edge *cs1, cgraph_edge *cs2); + + /* Call all node removal hooks. */ + void call_varpool_removal_hooks (varpool_node *node); + + /* Call all node insertion hooks. */ + void call_varpool_insertion_hooks (varpool_node *node); + + /* Arrange node to be first in its entry of assembler_name_hash. */ + void symtab_prevail_in_asm_name_hash (symtab_node *node); + + /* Initalize asm name hash unless. */ + void symtab_initialize_asm_name_hash (void); + + /* Set the DECL_ASSEMBLER_NAME and update symtab hashtables. */ + void change_decl_assembler_name (tree decl, tree name); + + /* Return true if assembler names NAME1 and NAME2 leads to the same symbol + name. */ + static bool assembler_names_equal_p (const char *name1, const char *name2); + + int cgraph_count; + int cgraph_max_uid; + int cgraph_max_summary_uid; + + int edges_count; + int edges_max_uid; + + symtab_node* GTY(()) nodes; + asm_node* GTY(()) asmnodes; + asm_node* GTY(()) asm_last_node; + cgraph_node* GTY(()) free_nodes; + + /* Head of a linked list of unused (freed) call graph edges. + Do not GTY((delete)) this list so UIDs gets reliably recycled. */ + cgraph_edge * GTY(()) free_edges; + + /* The order index of the next symtab node to be created. This is + used so that we can sort the cgraph nodes in order by when we saw + them, to support -fno-toplevel-reorder. */ + int order; + + /* Set when whole unit has been analyzed so we can access global info. */ + bool global_info_ready; + /* What state callgraph is in right now. */ + enum symtab_state state; + /* Set when the cgraph is fully build and the basic flags are computed. */ + bool function_flags_ready; + + bool cpp_implicit_aliases_done; + + /* Hash table used to hold sectoons. */ + hash_table *GTY(()) section_hash; + + /* Hash table used to convert assembler names into nodes. */ + hash_table *assembler_name_hash; + + /* Hash table used to hold init priorities. */ + hash_map *init_priority_hash; + + FILE* GTY ((skip)) dump_file; + + /* Return symbol used to separate symbol name from suffix. */ + static char symbol_suffix_separator (); + + FILE* GTY ((skip)) ipa_clones_dump_file; + + hash_set GTY ((skip)) cloned_nodes; + +private: + /* Allocate new callgraph node. */ + inline cgraph_node * allocate_cgraph_symbol (void); + + /* Allocate a cgraph_edge structure and fill it with data according to the + parameters of which only CALLEE can be NULL (when creating an indirect call + edge). */ + cgraph_edge *create_edge (cgraph_node *caller, cgraph_node *callee, + gcall *call_stmt, gcov_type count, int freq, + bool indir_unknown_callee); + + /* Put the edge onto the free list. */ + void free_edge (cgraph_edge *e); + + /* Insert NODE to assembler name hash. */ + void insert_to_assembler_name_hash (symtab_node *node, bool with_clones); + + /* Remove NODE from assembler name hash. */ + void unlink_from_assembler_name_hash (symtab_node *node, bool with_clones); + + /* Hash asmnames ignoring the user specified marks. */ + static hashval_t decl_assembler_name_hash (const_tree asmname); + + /* Compare ASMNAME with the DECL_ASSEMBLER_NAME of DECL. */ + static bool decl_assembler_name_equal (tree decl, const_tree asmname); + + friend struct asmname_hasher; + + /* List of hooks triggered when an edge is removed. */ + cgraph_edge_hook_list * GTY((skip)) m_first_edge_removal_hook; + /* List of hooks triggem_red when a cgraph node is removed. */ + cgraph_node_hook_list * GTY((skip)) m_first_cgraph_removal_hook; + /* List of hooks triggered when an edge is duplicated. */ + cgraph_2edge_hook_list * GTY((skip)) m_first_edge_duplicated_hook; + /* List of hooks triggered when a node is duplicated. */ + cgraph_2node_hook_list * GTY((skip)) m_first_cgraph_duplicated_hook; + /* List of hooks triggered when an function is inserted. */ + cgraph_node_hook_list * GTY((skip)) m_first_cgraph_insertion_hook; + /* List of hooks triggered when an variable is inserted. */ + varpool_node_hook_list * GTY((skip)) m_first_varpool_insertion_hook; + /* List of hooks triggered when a node is removed. */ + varpool_node_hook_list * GTY((skip)) m_first_varpool_removal_hook; +}; + +extern GTY(()) symbol_table *symtab; + +extern vec cgraph_new_nodes; + +inline hashval_t +asmname_hasher::hash (symtab_node *n) +{ + return symbol_table::decl_assembler_name_hash + (DECL_ASSEMBLER_NAME (n->decl)); +} + +inline bool +asmname_hasher::equal (symtab_node *n, const_tree t) +{ + return symbol_table::decl_assembler_name_equal (n->decl, t); +} + +/* In cgraph.c */ +void cgraph_c_finalize (void); +void release_function_body (tree); +cgraph_indirect_call_info *cgraph_allocate_init_indirect_info (void); + +void cgraph_update_edges_for_call_stmt (gimple *, tree, gimple *); +bool cgraph_function_possibly_inlined_p (tree); + +const char* cgraph_inline_failed_string (cgraph_inline_failed_t); +cgraph_inline_failed_type_t cgraph_inline_failed_type (cgraph_inline_failed_t); + +extern bool gimple_check_call_matching_types (gimple *, tree, bool); + +/* In cgraphunit.c */ +void cgraphunit_c_finalize (void); + +/* Initialize datastructures so DECL is a function in lowered gimple form. + IN_SSA is true if the gimple is in SSA. */ +basic_block init_lowered_empty_function (tree, bool, gcov_type); + +tree thunk_adjust (gimple_stmt_iterator *, tree, bool, HOST_WIDE_INT, tree); +/* In cgraphclones.c */ + +tree clone_function_name_1 (const char *, const char *); +tree clone_function_name (tree decl, const char *); + +void tree_function_versioning (tree, tree, vec *, + bool, bitmap, bool, bitmap, basic_block); + +void dump_callgraph_transformation (const cgraph_node *original, + const cgraph_node *clone, + const char *suffix); +tree cgraph_build_function_type_skip_args (tree orig_type, bitmap args_to_skip, + bool skip_return); + +/* In cgraphbuild.c */ +int compute_call_stmt_bb_frequency (tree, basic_block bb); +void record_references_in_initializer (tree, bool); + +/* In ipa.c */ +void cgraph_build_static_cdtor (char which, tree body, int priority); +bool ipa_discover_readonly_nonaddressable_vars (void); + +/* In varpool.c */ +tree ctor_for_folding (tree); + +/* In tree-chkp.c */ +extern bool chkp_function_instrumented_p (tree fndecl); + +/* Return true when the symbol is real symbol, i.e. it is not inline clone + or abstract function kept for debug info purposes only. */ +inline bool +symtab_node::real_symbol_p (void) +{ + cgraph_node *cnode; + + if (DECL_ABSTRACT_P (decl)) + return false; + if (transparent_alias && definition) + return false; + if (!is_a (this)) + return true; + cnode = dyn_cast (this); + if (cnode->global.inlined_to) + return false; + return true; +} + +/* Return true if DECL should have entry in symbol table if used. + Those are functions and static & external veriables*/ + +static inline bool +decl_in_symtab_p (const_tree decl) +{ + return (TREE_CODE (decl) == FUNCTION_DECL + || (TREE_CODE (decl) == VAR_DECL + && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))); +} + +inline bool +symtab_node::in_same_comdat_group_p (symtab_node *target) +{ + symtab_node *source = this; + + if (cgraph_node *cn = dyn_cast (target)) + { + if (cn->global.inlined_to) + source = cn->global.inlined_to; + } + if (cgraph_node *cn = dyn_cast (target)) + { + if (cn->global.inlined_to) + target = cn->global.inlined_to; + } + + return source->get_comdat_group () == target->get_comdat_group (); +} + +/* Return node that alias is aliasing. */ + +inline symtab_node * +symtab_node::get_alias_target (void) +{ + ipa_ref *ref = NULL; + iterate_reference (0, ref); + if (ref->use == IPA_REF_CHKP) + iterate_reference (1, ref); + gcc_checking_assert (ref->use == IPA_REF_ALIAS); + return ref->referred; +} + +/* Return next reachable static symbol with initializer after the node. */ + +inline symtab_node * +symtab_node::next_defined_symbol (void) +{ + symtab_node *node1 = next; + + for (; node1; node1 = node1->next) + if (node1->definition) + return node1; + + return NULL; +} + +/* Iterates I-th reference in the list, REF is also set. */ + +inline ipa_ref * +symtab_node::iterate_reference (unsigned i, ipa_ref *&ref) +{ + vec_safe_iterate (ref_list.references, i, &ref); + + return ref; +} + +/* Iterates I-th referring item in the list, REF is also set. */ + +inline ipa_ref * +symtab_node::iterate_referring (unsigned i, ipa_ref *&ref) +{ + ref_list.referring.iterate (i, &ref); + + return ref; +} + +/* Iterates I-th referring alias item in the list, REF is also set. */ + +inline ipa_ref * +symtab_node::iterate_direct_aliases (unsigned i, ipa_ref *&ref) +{ + ref_list.referring.iterate (i, &ref); + + if (ref && ref->use != IPA_REF_ALIAS) + return NULL; + + return ref; +} + +/* Return true if list contains an alias. */ + +inline bool +symtab_node::has_aliases_p (void) +{ + ipa_ref *ref = NULL; + + return (iterate_direct_aliases (0, ref) != NULL); +} + +/* Return true when RESOLUTION indicate that linker will use + the symbol from non-LTO object files. */ + +inline bool +resolution_used_from_other_file_p (enum ld_plugin_symbol_resolution resolution) +{ + return (resolution == LDPR_PREVAILING_DEF + || resolution == LDPR_PREEMPTED_REG + || resolution == LDPR_RESOLVED_EXEC + || resolution == LDPR_RESOLVED_DYN); +} + +/* Return true when symtab_node is known to be used from other (non-LTO) + object file. Known only when doing LTO via linker plugin. */ + +inline bool +symtab_node::used_from_object_file_p (void) +{ + if (!TREE_PUBLIC (decl) || DECL_EXTERNAL (decl)) + return false; + if (resolution_used_from_other_file_p (resolution)) + return true; + return false; +} + +/* Return varpool node for given symbol and check it is a function. */ + +inline varpool_node * +varpool_node::get (const_tree decl) +{ + gcc_checking_assert (TREE_CODE (decl) == VAR_DECL); + return dyn_cast (symtab_node::get (decl)); +} + +/* Register a symbol NODE. */ + +inline void +symbol_table::register_symbol (symtab_node *node) +{ + node->next = nodes; + node->previous = NULL; + + if (nodes) + nodes->previous = node; + nodes = node; + + node->order = order++; +} + +/* Register a top-level asm statement ASM_STR. */ + +asm_node * +symbol_table::finalize_toplevel_asm (tree asm_str) +{ + asm_node *node; + + node = ggc_cleared_alloc (); + node->asm_str = asm_str; + node->order = order++; + node->next = NULL; + + if (asmnodes == NULL) + asmnodes = node; + else + asm_last_node->next = node; + + asm_last_node = node; + return node; +} + +/* Unregister a symbol NODE. */ +inline void +symbol_table::unregister (symtab_node *node) +{ + if (node->previous) + node->previous->next = node->next; + else + nodes = node->next; + + if (node->next) + node->next->previous = node->previous; + + node->next = NULL; + node->previous = NULL; +} + +/* Release a callgraph NODE with UID and put in to the list of free nodes. */ + +inline void +symbol_table::release_symbol (cgraph_node *node, int uid) +{ + cgraph_count--; + + /* Clear out the node to NULL all pointers and add the node to the free + list. */ + memset (node, 0, sizeof (*node)); + node->type = SYMTAB_FUNCTION; + node->uid = uid; + SET_NEXT_FREE_NODE (node, free_nodes); + free_nodes = node; +} + +/* Allocate new callgraph node. */ + +inline cgraph_node * +symbol_table::allocate_cgraph_symbol (void) +{ + cgraph_node *node; + + if (free_nodes) + { + node = free_nodes; + free_nodes = NEXT_FREE_NODE (node); + } + else + { + node = ggc_cleared_alloc (); + node->uid = cgraph_max_uid++; + } + + node->summary_uid = cgraph_max_summary_uid++; + return node; +} + + +/* Return first static symbol with definition. */ +inline symtab_node * +symbol_table::first_symbol (void) +{ + return nodes; +} + +/* Walk all symbols. */ +#define FOR_EACH_SYMBOL(node) \ + for ((node) = symtab->first_symbol (); (node); (node) = (node)->next) + +/* Return first static symbol with definition. */ +inline symtab_node * +symbol_table::first_defined_symbol (void) +{ + symtab_node *node; + + for (node = nodes; node; node = node->next) + if (node->definition) + return node; + + return NULL; +} + +/* Walk all symbols with definitions in current unit. */ +#define FOR_EACH_DEFINED_SYMBOL(node) \ + for ((node) = symtab->first_defined_symbol (); (node); \ + (node) = node->next_defined_symbol ()) + +/* Return first variable. */ +inline varpool_node * +symbol_table::first_variable (void) +{ + symtab_node *node; + for (node = nodes; node; node = node->next) + if (varpool_node *vnode = dyn_cast (node)) + return vnode; + return NULL; +} + +/* Return next variable after NODE. */ +inline varpool_node * +symbol_table::next_variable (varpool_node *node) +{ + symtab_node *node1 = node->next; + for (; node1; node1 = node1->next) + if (varpool_node *vnode1 = dyn_cast (node1)) + return vnode1; + return NULL; +} +/* Walk all variables. */ +#define FOR_EACH_VARIABLE(node) \ + for ((node) = symtab->first_variable (); \ + (node); \ + (node) = symtab->next_variable ((node))) + +/* Return first static variable with initializer. */ +inline varpool_node * +symbol_table::first_static_initializer (void) +{ + symtab_node *node; + for (node = nodes; node; node = node->next) + { + varpool_node *vnode = dyn_cast (node); + if (vnode && DECL_INITIAL (node->decl)) + return vnode; + } + return NULL; +} + +/* Return next static variable with initializer after NODE. */ +inline varpool_node * +symbol_table::next_static_initializer (varpool_node *node) +{ + symtab_node *node1 = node->next; + for (; node1; node1 = node1->next) + { + varpool_node *vnode1 = dyn_cast (node1); + if (vnode1 && DECL_INITIAL (node1->decl)) + return vnode1; + } + return NULL; +} + +/* Walk all static variables with initializer set. */ +#define FOR_EACH_STATIC_INITIALIZER(node) \ + for ((node) = symtab->first_static_initializer (); (node); \ + (node) = symtab->next_static_initializer (node)) + +/* Return first static variable with definition. */ +inline varpool_node * +symbol_table::first_defined_variable (void) +{ + symtab_node *node; + for (node = nodes; node; node = node->next) + { + varpool_node *vnode = dyn_cast (node); + if (vnode && vnode->definition) + return vnode; + } + return NULL; +} + +/* Return next static variable with definition after NODE. */ +inline varpool_node * +symbol_table::next_defined_variable (varpool_node *node) +{ + symtab_node *node1 = node->next; + for (; node1; node1 = node1->next) + { + varpool_node *vnode1 = dyn_cast (node1); + if (vnode1 && vnode1->definition) + return vnode1; + } + return NULL; +} +/* Walk all variables with definitions in current unit. */ +#define FOR_EACH_DEFINED_VARIABLE(node) \ + for ((node) = symtab->first_defined_variable (); (node); \ + (node) = symtab->next_defined_variable (node)) + +/* Return first function with body defined. */ +inline cgraph_node * +symbol_table::first_defined_function (void) +{ + symtab_node *node; + for (node = nodes; node; node = node->next) + { + cgraph_node *cn = dyn_cast (node); + if (cn && cn->definition) + return cn; + } + return NULL; +} + +/* Return next function with body defined after NODE. */ +inline cgraph_node * +symbol_table::next_defined_function (cgraph_node *node) +{ + symtab_node *node1 = node->next; + for (; node1; node1 = node1->next) + { + cgraph_node *cn1 = dyn_cast (node1); + if (cn1 && cn1->definition) + return cn1; + } + return NULL; +} + +/* Walk all functions with body defined. */ +#define FOR_EACH_DEFINED_FUNCTION(node) \ + for ((node) = symtab->first_defined_function (); (node); \ + (node) = symtab->next_defined_function ((node))) + +/* Return first function. */ +inline cgraph_node * +symbol_table::first_function (void) +{ + symtab_node *node; + for (node = nodes; node; node = node->next) + if (cgraph_node *cn = dyn_cast (node)) + return cn; + return NULL; +} + +/* Return next function. */ +inline cgraph_node * +symbol_table::next_function (cgraph_node *node) +{ + symtab_node *node1 = node->next; + for (; node1; node1 = node1->next) + if (cgraph_node *cn1 = dyn_cast (node1)) + return cn1; + return NULL; +} + +/* Return first function with body defined. */ +inline cgraph_node * +symbol_table::first_function_with_gimple_body (void) +{ + symtab_node *node; + for (node = nodes; node; node = node->next) + { + cgraph_node *cn = dyn_cast (node); + if (cn && cn->has_gimple_body_p ()) + return cn; + } + return NULL; +} + +/* Return next reachable static variable with initializer after NODE. */ +inline cgraph_node * +symbol_table::next_function_with_gimple_body (cgraph_node *node) +{ + symtab_node *node1 = node->next; + for (; node1; node1 = node1->next) + { + cgraph_node *cn1 = dyn_cast (node1); + if (cn1 && cn1->has_gimple_body_p ()) + return cn1; + } + return NULL; +} + +/* Walk all functions. */ +#define FOR_EACH_FUNCTION(node) \ + for ((node) = symtab->first_function (); (node); \ + (node) = symtab->next_function ((node))) + +/* Return true when callgraph node is a function with Gimple body defined + in current unit. Functions can also be define externally or they + can be thunks with no Gimple representation. + + Note that at WPA stage, the function body may not be present in memory. */ + +inline bool +cgraph_node::has_gimple_body_p (void) +{ + return definition && !thunk.thunk_p && !alias; +} + +/* Walk all functions with body defined. */ +#define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node) \ + for ((node) = symtab->first_function_with_gimple_body (); (node); \ + (node) = symtab->next_function_with_gimple_body (node)) + +/* Uniquize all constants that appear in memory. + Each constant in memory thus far output is recorded + in `const_desc_table'. */ + +struct GTY((for_user)) constant_descriptor_tree { + /* A MEM for the constant. */ + rtx rtl; + + /* The value of the constant. */ + tree value; + + /* Hash of value. Computing the hash from value each time + hashfn is called can't work properly, as that means recursive + use of the hash table during hash table expansion. */ + hashval_t hash; +}; + +/* Return true when function is only called directly or it has alias. + i.e. it is not externally visible, address was not taken and + it is not used in any other non-standard way. */ + +inline bool +cgraph_node::only_called_directly_or_aliased_p (void) +{ + gcc_assert (!global.inlined_to); + return (!force_output && !address_taken + && !used_from_other_partition + && !DECL_VIRTUAL_P (decl) + && !DECL_STATIC_CONSTRUCTOR (decl) + && !DECL_STATIC_DESTRUCTOR (decl) + && !used_from_object_file_p () + && !externally_visible); +} + +/* Return true when function can be removed from callgraph + if all direct calls are eliminated. */ + +inline bool +cgraph_node::can_remove_if_no_direct_calls_and_refs_p (void) +{ + gcc_checking_assert (!global.inlined_to); + /* Instrumentation clones should not be removed before + instrumentation happens. New callers may appear after + instrumentation. */ + if (instrumentation_clone + && !chkp_function_instrumented_p (decl)) + return false; + /* Extern inlines can always go, we will use the external definition. */ + if (DECL_EXTERNAL (decl)) + return true; + /* When function is needed, we can not remove it. */ + if (force_output || used_from_other_partition) + return false; + if (DECL_STATIC_CONSTRUCTOR (decl) + || DECL_STATIC_DESTRUCTOR (decl)) + return false; + /* Only COMDAT functions can be removed if externally visible. */ + if (externally_visible + && (!DECL_COMDAT (decl) + || forced_by_abi + || used_from_object_file_p ())) + return false; + return true; +} + +/* Verify cgraph, if consistency checking is enabled. */ + +inline void +cgraph_node::checking_verify_cgraph_nodes (void) +{ + if (flag_checking) + cgraph_node::verify_cgraph_nodes (); +} + +/* Return true when variable can be removed from variable pool + if all direct calls are eliminated. */ + +inline bool +varpool_node::can_remove_if_no_refs_p (void) +{ + if (DECL_EXTERNAL (decl)) + return true; + return (!force_output && !used_from_other_partition + && ((DECL_COMDAT (decl) + && !forced_by_abi + && !used_from_object_file_p ()) + || !externally_visible + || DECL_HAS_VALUE_EXPR_P (decl))); +} + +/* Return true when all references to variable must be visible in ipa_ref_list. + i.e. if the variable is not externally visible or not used in some magic + way (asm statement or such). + The magic uses are all summarized in force_output flag. */ + +inline bool +varpool_node::all_refs_explicit_p () +{ + return (definition + && !externally_visible + && !used_from_other_partition + && !force_output); +} + +struct tree_descriptor_hasher : ggc_ptr_hash +{ + static hashval_t hash (constant_descriptor_tree *); + static bool equal (constant_descriptor_tree *, constant_descriptor_tree *); +}; + +/* Constant pool accessor function. */ +hash_table *constant_pool_htab (void); + +/* Return node that alias is aliasing. */ + +inline cgraph_node * +cgraph_node::get_alias_target (void) +{ + return dyn_cast (symtab_node::get_alias_target ()); +} + +/* Return node that alias is aliasing. */ + +inline varpool_node * +varpool_node::get_alias_target (void) +{ + return dyn_cast (symtab_node::get_alias_target ()); +} + +/* Walk the alias chain to return the symbol NODE is alias of. + If NODE is not an alias, return NODE. + When AVAILABILITY is non-NULL, get minimal availability in the chain. + When REF is non-NULL, assume that reference happens in symbol REF + when determining the availability. */ + +inline symtab_node * +symtab_node::ultimate_alias_target (enum availability *availability, + symtab_node *ref) +{ + if (!alias) + { + if (availability) + *availability = get_availability (ref); + return this; + } + + return ultimate_alias_target_1 (availability, ref); +} + +/* Given function symbol, walk the alias chain to return the function node + is alias of. Do not walk through thunks. + When AVAILABILITY is non-NULL, get minimal availability in the chain. + When REF is non-NULL, assume that reference happens in symbol REF + when determining the availability. */ + +inline cgraph_node * +cgraph_node::ultimate_alias_target (enum availability *availability, + symtab_node *ref) +{ + cgraph_node *n = dyn_cast + (symtab_node::ultimate_alias_target (availability, ref)); + if (!n && availability) + *availability = AVAIL_NOT_AVAILABLE; + return n; +} + +/* For given variable pool node, walk the alias chain to return the function + the variable is alias of. Do not walk through thunks. + When AVAILABILITY is non-NULL, get minimal availability in the chain. + When REF is non-NULL, assume that reference happens in symbol REF + when determining the availability. */ + +inline varpool_node * +varpool_node::ultimate_alias_target (availability *availability, + symtab_node *ref) +{ + varpool_node *n = dyn_cast + (symtab_node::ultimate_alias_target (availability, ref)); + + if (!n && availability) + *availability = AVAIL_NOT_AVAILABLE; + return n; +} + +/* Set callee N of call graph edge and add it to the corresponding set of + callers. */ + +inline void +cgraph_edge::set_callee (cgraph_node *n) +{ + prev_caller = NULL; + if (n->callers) + n->callers->prev_caller = this; + next_caller = n->callers; + n->callers = this; + callee = n; +} + +/* Redirect callee of the edge to N. The function does not update underlying + call expression. */ + +inline void +cgraph_edge::redirect_callee (cgraph_node *n) +{ + /* Remove from callers list of the current callee. */ + remove_callee (); + + /* Insert to callers list of the new callee. */ + set_callee (n); +} + +/* Return true when the edge represents a direct recursion. */ + +inline bool +cgraph_edge::recursive_p (void) +{ + cgraph_node *c = callee->ultimate_alias_target (); + if (caller->global.inlined_to) + return caller->global.inlined_to->decl == c->decl; + else + return caller->decl == c->decl; +} + +/* Remove the edge from the list of the callers of the callee. */ + +inline void +cgraph_edge::remove_callee (void) +{ + gcc_assert (!indirect_unknown_callee); + if (prev_caller) + prev_caller->next_caller = next_caller; + if (next_caller) + next_caller->prev_caller = prev_caller; + if (!prev_caller) + callee->callers = next_caller; +} + +/* Return true if call must bind to current definition. */ + +inline bool +cgraph_edge::binds_to_current_def_p () +{ + if (callee) + return callee->binds_to_current_def_p (caller); + else + return false; +} + +/* Return true if the TM_CLONE bit is set for a given FNDECL. */ +static inline bool +decl_is_tm_clone (const_tree fndecl) +{ + cgraph_node *n = cgraph_node::get (fndecl); + if (n) + return n->tm_clone; + return false; +} + +/* Likewise indicate that a node is needed, i.e. reachable via some + external means. */ + +inline void +cgraph_node::mark_force_output (void) +{ + force_output = 1; + gcc_checking_assert (!global.inlined_to); +} + +/* Return true if function should be optimized for size. */ + +inline bool +cgraph_node::optimize_for_size_p (void) +{ + if (opt_for_fn (decl, optimize_size)) + return true; + if (frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED) + return true; + else + return false; +} + +/* Return symtab_node for NODE or create one if it is not present + in symtab. */ + +inline symtab_node * +symtab_node::get_create (tree node) +{ + if (TREE_CODE (node) == VAR_DECL) + return varpool_node::get_create (node); + else + return cgraph_node::get_create (node); +} + +/* Return availability of NODE when referenced from REF. */ + +inline enum availability +symtab_node::get_availability (symtab_node *ref) +{ + if (is_a (this)) + return dyn_cast (this)->get_availability (ref); + else + return dyn_cast (this)->get_availability (ref); +} + +/* Call calback on symtab node and aliases associated to this node. + When INCLUDE_OVERWRITABLE is false, overwritable symbols are skipped. */ + +inline bool +symtab_node::call_for_symbol_and_aliases (bool (*callback) (symtab_node *, + void *), + void *data, + bool include_overwritable) +{ + if (include_overwritable + || get_availability () > AVAIL_INTERPOSABLE) + { + if (callback (this, data)) + return true; + } + if (has_aliases_p ()) + return call_for_symbol_and_aliases_1 (callback, data, include_overwritable); + return false; +} + +/* Call callback on function and aliases associated to the function. + When INCLUDE_OVERWRITABLE is false, overwritable symbols are + skipped. */ + +inline bool +cgraph_node::call_for_symbol_and_aliases (bool (*callback) (cgraph_node *, + void *), + void *data, + bool include_overwritable) +{ + if (include_overwritable + || get_availability () > AVAIL_INTERPOSABLE) + { + if (callback (this, data)) + return true; + } + if (has_aliases_p ()) + return call_for_symbol_and_aliases_1 (callback, data, include_overwritable); + return false; +} + +/* Call calback on varpool symbol and aliases associated to varpool symbol. + When INCLUDE_OVERWRITABLE is false, overwritable symbols are + skipped. */ + +inline bool +varpool_node::call_for_symbol_and_aliases (bool (*callback) (varpool_node *, + void *), + void *data, + bool include_overwritable) +{ + if (include_overwritable + || get_availability () > AVAIL_INTERPOSABLE) + { + if (callback (this, data)) + return true; + } + if (has_aliases_p ()) + return call_for_symbol_and_aliases_1 (callback, data, include_overwritable); + return false; +} + +/* Return true if refernece may be used in address compare. */ + +inline bool +ipa_ref::address_matters_p () +{ + if (use != IPA_REF_ADDR) + return false; + /* Addresses taken from virtual tables are never compared. */ + if (is_a (referring) + && DECL_VIRTUAL_P (referring->decl)) + return false; + return referred->address_can_be_compared_p (); +} + +/* Build polymorphic call context for indirect call E. */ + +inline +ipa_polymorphic_call_context::ipa_polymorphic_call_context (cgraph_edge *e) +{ + gcc_checking_assert (e->indirect_info->polymorphic); + *this = e->indirect_info->context; +} + +/* Build empty "I know nothing" context. */ + +inline +ipa_polymorphic_call_context::ipa_polymorphic_call_context () +{ + clear_speculation (); + clear_outer_type (); + invalid = false; +} + +/* Make context non-speculative. */ + +inline void +ipa_polymorphic_call_context::clear_speculation () +{ + speculative_outer_type = NULL; + speculative_offset = 0; + speculative_maybe_derived_type = false; +} + +/* Produce context specifying all derrived types of OTR_TYPE. If OTR_TYPE is + NULL, the context is set to dummy "I know nothing" setting. */ + +inline void +ipa_polymorphic_call_context::clear_outer_type (tree otr_type) +{ + outer_type = otr_type ? TYPE_MAIN_VARIANT (otr_type) : NULL; + offset = 0; + maybe_derived_type = true; + maybe_in_construction = true; + dynamic = true; +} + +/* Adjust all offsets in contexts by OFF bits. */ + +inline void +ipa_polymorphic_call_context::offset_by (HOST_WIDE_INT off) +{ + if (outer_type) + offset += off; + if (speculative_outer_type) + speculative_offset += off; +} + +/* Return TRUE if context is fully useless. */ + +inline bool +ipa_polymorphic_call_context::useless_p () const +{ + return (!outer_type && !speculative_outer_type); +} + +/* Return true if NODE is local. Instrumentation clones are counted as local + only when original function is local. */ + +static inline bool +cgraph_local_p (cgraph_node *node) +{ + if (!node->instrumentation_clone || !node->instrumented_version) + return node->local.local; + + return node->local.local && node->instrumented_version->local.local; +} + +/* When using fprintf (or similar), problems can arise with + transient generated strings. Many string-generation APIs + only support one result being alive at once (e.g. by + returning a pointer to a statically-allocated buffer). + + If there is more than one generated string within one + fprintf call: the first string gets evicted or overwritten + by the second, before fprintf is fully evaluated. + See e.g. PR/53136. + + This function provides a workaround for this, by providing + a simple way to create copies of these transient strings, + without the need to have explicit cleanup: + + fprintf (dumpfile, "string 1: %s string 2:%s\n", + xstrdup_for_dump (EXPR_1), + xstrdup_for_dump (EXPR_2)); + + This is actually a simple wrapper around ggc_strdup, but + the name documents the intent. We require that no GC can occur + within the fprintf call. */ + +static inline const char * +xstrdup_for_dump (const char *transient_str) +{ + return ggc_strdup (transient_str); +} + +#endif /* GCC_CGRAPH_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cilk.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cilk.h new file mode 100644 index 0000000..27c2e0a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cilk.h @@ -0,0 +1,109 @@ +/* This file is part of the Intel(R) Cilk(TM) Plus support + This file contains Cilk Support files. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + Contributed by Balaji V. Iyer , + Intel Corporation + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#ifndef GCC_CILK_H +#define GCC_CILK_H + +/* Frame status bits known to compiler. */ +#define CILK_FRAME_UNSYNCHED 0x02 +#define CILK_FRAME_DETACHED 0x04 +#define CILK_FRAME_EXCEPTING 0x10 +#define CILK_FRAME_VERSION (1 << 24) + +enum cilk_tree_index { +/* All the built-in functions for Cilk keywords. */ + CILK_TI_F_WORKER = 0, /* __cilkrts_get_worker (). */ + CILK_TI_F_SYNC, /* __cilkrts_sync (). */ + CILK_TI_F_DETACH, /* __cilkrts_detach (...). */ + CILK_TI_F_ENTER, /* __cilkrts_enter_frame (...). */ + CILK_TI_F_ENTER_FAST, /* __cilkrts_enter_frame_fast (.). */ + CILK_TI_F_LEAVE, /* __cilkrts_leave_frame (...). */ + CILK_TI_F_POP, /* __cilkrts_pop_frame (...). */ + CILK_TI_F_RETHROW, /* __cilkrts_rethrow (...). */ + CILK_TI_F_SAVE_FP, /* __cilkrts_save_fp_ctrl_state (...). */ + CILK_TI_F_LOOP_32, /* __cilkrts_cilk_for_32 (...). */ + CILK_TI_F_LOOP_64, /* __cilkrts_cilk_for_64 (...). */ + + /* __cilkrts_stack_frame struct fields. */ + CILK_TI_FRAME_FLAGS, /* stack_frame->flags. */ + CILK_TI_FRAME_PARENT, /* stack_frame->parent. */ + CILK_TI_FRAME_WORKER, /* stack_frame->worker. */ + CILK_TI_FRAME_EXCEPTION, /* stack_frame->except_data. */ + CILK_TI_FRAME_CONTEXT, /* stack_frame->context[4]. */ + CILK_TI_FRAME_PEDIGREE, /* stack_frame->pedigree. */ + + /* __cilkrts_worker struct fields. */ + CILK_TI_WORKER_CUR, /* worker->current_stack_frame. */ + CILK_TI_WORKER_TAIL, /* worker->tail. */ + CILK_TI_WORKER_PEDIGREE, /* worker->pedigree. */ + + /* __cilkrts_pedigree struct fields. */ + CILK_TI_PEDIGREE_RANK, /* pedigree->rank. */ + CILK_TI_PEDIGREE_PARENT, /* pedigree->parent. */ + + /* Types. */ + CILK_TI_FRAME_TYPE, /* struct __cilkrts_stack_frame. */ + CILK_TI_FRAME_PTR, /* __cilkrts_stack_frame *. */ + CILK_TI_WORKER_TYPE, /* struct __cilkrts_worker. */ + CILK_TI_PEDIGREE_TYPE, /* struct __cilkrts_pedigree. */ + CILK_TI_MAX +}; + +extern GTY (()) tree cilk_trees[CILK_TI_MAX]; + +#define cilk_worker_fndecl cilk_trees[CILK_TI_F_WORKER] +#define cilk_sync_fndecl cilk_trees[CILK_TI_F_SYNC] +#define cilk_synched_fndecl cilk_trees[CILK_TI_F_SYNCED] +#define cilk_detach_fndecl cilk_trees[CILK_TI_F_DETACH] +#define cilk_enter_fndecl cilk_trees[CILK_TI_F_ENTER] +#define cilk_enter_fast_fndecl cilk_trees[CILK_TI_F_ENTER_FAST] +#define cilk_leave_fndecl cilk_trees[CILK_TI_F_LEAVE] +#define cilk_rethrow_fndecl cilk_trees[CILK_TI_F_RETHROW] +#define cilk_pop_fndecl cilk_trees[CILK_TI_F_POP] +#define cilk_save_fp_fndecl cilk_trees[CILK_TI_F_SAVE_FP] +#define cilk_for_32_fndecl cilk_trees[CILK_TI_F_LOOP_32] +#define cilk_for_64_fndecl cilk_trees[CILK_TI_F_LOOP_64] + +#define cilk_worker_type_fndecl cilk_trees[CILK_TI_WORKER_TYPE] +#define cilk_frame_type_decl cilk_trees[CILK_TI_FRAME_TYPE] +#define cilk_frame_ptr_type_decl cilk_trees[CILK_TI_FRAME_PTR] +#define cilk_pedigree_type_decl cilk_trees[CILK_TI_PEDIGREE_TYPE] + +extern void expand_builtin_cilk_detach (tree); +extern void expand_builtin_cilk_pop_frame (tree); +extern tree cilk_arrow (tree, int, bool); +extern tree cilk_dot (tree, int, bool); +extern void cilk_init_builtins (void); +extern void gimplify_cilk_sync (tree *, gimple_seq *); +extern tree cilk_call_setjmp (tree); + +/* Returns true if Cilk Plus is enabled and if F->cilk_frame_decl is not + NULL_TREE. */ + +inline bool +fn_contains_cilk_spawn_p (function *f) +{ + return (flag_cilkplus + && (f->calls_cilk_spawn || f->cilk_frame_decl != NULL_TREE)); +} + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/collect-utils.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/collect-utils.h new file mode 100644 index 0000000..1bb934f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/collect-utils.h @@ -0,0 +1,49 @@ +/* Utility functions used by tools like collect2 and lto-wrapper. + Copyright (C) 2009-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_COLLECT_UTILS_H +#define GCC_COLLECT_UTILS_H + +/* Provided in collect-utils.c. */ +extern void notice (const char *, ...) + __attribute__ ((format (printf, 1, 2))); +extern void fatal_signal (int); + +extern struct pex_obj *collect_execute (const char *, char **, + const char *, const char *, + int, bool); +extern int collect_wait (const char *, struct pex_obj *); +extern void do_wait (const char *, struct pex_obj *); +extern void fork_execute (const char *, char **, bool); +extern void utils_cleanup (bool); + + +extern bool debug; +extern bool verbose; +extern bool save_temps; + +/* Provided by the tool itself. */ + +/* The name of the tool, printed in error messages. */ +extern const char tool_name[]; +/* Called by utils_cleanup. */ +extern void tool_cleanup (bool); +extern void maybe_unlink (const char *); + +#endif /* GCC_COLLECT_UTILS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/collect2-aix.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/collect2-aix.h new file mode 100644 index 0000000..a8c5d65 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/collect2-aix.h @@ -0,0 +1,306 @@ +/* AIX cross support for collect2. + Copyright (C) 2009-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_COLLECT2_AIX_H +#define GCC_COLLECT2_AIX_H +/* collect2-aix.c requires mmap support. It should otherwise be + fairly portable. */ +#if defined(CROSS_DIRECTORY_STRUCTURE) \ + && defined(TARGET_AIX_VERSION) \ + && HAVE_MMAP + +#define CROSS_AIX_SUPPORT 1 + +/* ------------------------------------------------------------------------- + Definitions adapted from bfd. (Fairly heavily adapted in some cases.) + ------------------------------------------------------------------------- */ + +/* Compatibility types for bfd. */ +typedef unsigned HOST_WIDE_INT bfd_vma; + +/* The size of an archive's fl_magic field. */ +#define FL_MAGIC_SIZE 8 + +/* The expected contents of fl_magic for big archives. */ +#define FL_MAGIC_BIG_AR "\012" + +/* The size of each offset string in the header of a big archive. */ +#define AR_BIG_OFFSET_SIZE 20 + +/* The format of the file header in a "big" XCOFF archive. */ +struct external_big_ar_filehdr +{ + /* Magic string. */ + char fl_magic[FL_MAGIC_SIZE]; + + /* Offset of the member table (decimal ASCII string). */ + char fl_memoff[AR_BIG_OFFSET_SIZE]; + + /* Offset of the global symbol table for 32-bit objects (decimal ASCII + string). */ + char fl_symoff[AR_BIG_OFFSET_SIZE]; + + /* Offset of the global symbol table for 64-bit objects (decimal ASCII + string). */ + char fl_symoff64[AR_BIG_OFFSET_SIZE]; + + /* Offset of the first member in the archive (decimal ASCII string). */ + char fl_firstmemoff[AR_BIG_OFFSET_SIZE]; + + /* Offset of the last member in the archive (decimal ASCII string). */ + char fl_lastmemoff[AR_BIG_OFFSET_SIZE]; + + /* Offset of the first member on the free list (decimal ASCII + string). */ + char fl_freeoff[AR_BIG_OFFSET_SIZE]; +}; + +/* Each archive name is followed by this many bytes of magic string. */ +#define SXCOFFARFMAG 2 + +/* The format of a member header in a "big" XCOFF archive. */ +struct external_big_ar_member +{ + /* File size not including the header (decimal ASCII string). */ + char ar_size[AR_BIG_OFFSET_SIZE]; + + /* File offset of next archive member (decimal ASCII string). */ + char ar_nextoff[AR_BIG_OFFSET_SIZE]; + + /* File offset of previous archive member (decimal ASCII string). */ + char ar_prevoff[AR_BIG_OFFSET_SIZE]; + + /* File mtime (decimal ASCII string). */ + char ar_date[12]; + + /* File UID (decimal ASCII string). */ + char ar_uid[12]; + + /* File GID (decimal ASCII string). */ + char ar_gid[12]; + + /* File mode (octal ASCII string). */ + char ar_mode[12]; + + /* Length of file name (decimal ASCII string). */ + char ar_namlen[4]; + + /* This structure is followed by the file name. The length of the + name is given in the namlen field. If the length of the name is + odd, the name is followed by a null byte. The name and optional + null byte are followed by XCOFFARFMAG, which is not included in + namlen. The contents of the archive member follow; the number of + bytes is given in the size field. */ +}; + +/* The known values of f_magic in an XCOFF file header. */ +#define U802WRMAGIC 0730 /* Writeable text segments. */ +#define U802ROMAGIC 0735 /* Readonly sharable text segments. */ +#define U802TOCMAGIC 0737 /* Readonly text segments and TOC. */ +#define U803XTOCMAGIC 0757 /* Aix 4.3 64-bit XCOFF. */ +#define U64_TOCMAGIC 0767 /* AIX 5+ 64-bit XCOFF. */ + +/* The number of bytes in an XCOFF file's f_magic field. */ +#define F_MAGIC_SIZE 2 + +/* The format of a 32-bit XCOFF file header. */ +struct external_filehdr_32 +{ + /* The magic number. */ + char f_magic[F_MAGIC_SIZE]; + + /* The number of sections. */ + char f_nscns[2]; + + /* Time & date stamp. */ + char f_timdat[4]; + + /* The offset of the symbol table from the start of the file. */ + char f_symptr[4]; + + /* The number of entries in the symbol table. */ + char f_nsyms[4]; + + /* The size of the auxiliary header. */ + char f_opthdr[2]; + + /* Flags. */ + char f_flags[2]; +}; + +/* The format of a 64-bit XCOFF file header. */ +struct external_filehdr_64 +{ + /* The magic number. */ + char f_magic[F_MAGIC_SIZE]; + + /* The number of sections. */ + char f_nscns[2]; + + /* Time & date stamp. */ + char f_timdat[4]; + + /* The offset of the symbol table from the start of the file. */ + char f_symptr[8]; + + /* The size of the auxiliary header. */ + char f_opthdr[2]; + + /* Flags. */ + char f_flags[2]; + + /* The number of entries in the symbol table. */ + char f_nsyms[4]; +}; + +/* An internal representation of the XCOFF file header. */ +struct internal_filehdr +{ + unsigned short f_magic; + unsigned short f_nscns; + long f_timdat; + bfd_vma f_symptr; + long f_nsyms; + unsigned short f_opthdr; + unsigned short f_flags; +}; + +/* Symbol classes have their names in the debug section if this flag + is set. */ +#define DBXMASK 0x80 + +/* The format of an XCOFF symbol-table entry. */ +struct external_syment +{ + union { + struct { + union { + /* The name of the symbol. There is an implicit null character + after the end of the array. */ + char n_name[8]; + struct { + /* If n_zeroes is zero, n_offset is the offset the name from + the start of the string table. */ + char n_zeroes[4]; + char n_offset[4]; + } u; + } u; + + /* The symbol's value. */ + char n_value[4]; + } xcoff32; + struct { + /* The symbol's value. */ + char n_value[8]; + + /* The offset of the symbol from the start of the string table. */ + char n_offset[4]; + } xcoff64; + } u; + + /* The number of the section to which this symbol belongs. */ + char n_scnum[2]; + + /* The type of symbol. (It can be interpreted as an n_lang + and an n_cpu byte, but we don't care about that here.) */ + char n_type[2]; + + /* The class of symbol (a C_* value). */ + char n_sclass[1]; + + /* The number of auxiliary symbols attached to this entry. */ + char n_numaux[1]; +}; + +/* Definitions required by collect2. */ +#define C_EXT 2 + +#define F_SHROBJ 0x2000 +#define F_LOADONLY 0x4000 + +#define N_UNDEF ((short) 0) +#define N_TMASK 060 +#define N_BTSHFT 4 + +#define DT_NON 0 +#define DT_FCN 2 + +/* ------------------------------------------------------------------------- + Local code. + ------------------------------------------------------------------------- */ + +/* An internal representation of an XCOFF symbol-table entry, + which is associated with the API-defined SYMENT type. */ +struct internal_syment +{ + char n_name[9]; + unsigned int n_zeroes; + bfd_vma n_offset; + bfd_vma n_value; + short n_scnum; + unsigned short n_flags; + unsigned short n_type; + unsigned char n_sclass; + unsigned char n_numaux; +}; +typedef struct internal_syment SYMENT; + +/* The internal representation of the API-defined LDFILE type. */ +struct internal_ldfile +{ + /* The file handle for the associated file, or -1 if it hasn't been + opened yet. */ + int fd; + + /* The start of the current XCOFF object, if one has been mapped + into memory. Null otherwise. */ + char *object; + + /* The offset of OBJECT from the start of the containing page. */ + size_t page_offset; + + /* The size of the file pointed to by OBJECT. Valid iff OFFSET + is nonnull. */ + size_t object_size; + + /* The offset of the next member in an archive after OBJECT, + or -1 if this isn't an archive. Valid iff OFFSET is nonnull. */ + off_t next_member; + + /* The parsed version of the XCOFF file header. */ + struct internal_filehdr filehdr; +}; +typedef struct internal_ldfile LDFILE; + +/* The API allows the file header to be directly accessed via this macro. */ +#define HEADER(FILE) ((FILE)->filehdr) + +/* API-defined return codes. SUCCESS must be > 0 and FAILURE must be <= 0. */ +#define SUCCESS 1 +#define FAILURE 0 + +/* API-defined functions. */ +extern LDFILE *ldopen (char *, LDFILE *); +extern char *ldgetname (LDFILE *, SYMENT *); +extern int ldtbread (LDFILE *, long, SYMENT *); +extern int ldclose (LDFILE *); + +#endif + +#endif /* GCC_COLLECT2_AIX_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/collect2.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/collect2.h new file mode 100644 index 0000000..2fbb8b2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/collect2.h @@ -0,0 +1,45 @@ +/* Header file for collect/tlink routines. + Copyright (C) 1998-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_COLLECT2_H +#define GCC_COLLECT2_H + +extern void do_tlink (char **, char **); + +extern struct pex_obj *collect_execute (const char *, char **, const char *, + const char *, int flags); + +extern int collect_wait (const char *, struct pex_obj *); + +extern void dump_ld_file (const char *, FILE *); + +extern int file_exists (const char *); + +extern const char *ldout; +extern const char *lderrout; +extern const char *c_file_name; +extern struct obstack temporary_obstack; +extern char *temporary_firstobj; +extern bool may_unlink_output_file; + +extern void notice_translated (const char *, ...) ATTRIBUTE_PRINTF_1; +extern void notice (const char *, ...) ATTRIBUTE_PRINTF_1; + +extern bool at_file_supplied; +#endif /* ! GCC_COLLECT2_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/conditions.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/conditions.h new file mode 100644 index 0000000..dc62c0e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/conditions.h @@ -0,0 +1,118 @@ +/* Definitions for condition code handling in final.c and output routines. + Copyright (C) 1987-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_CONDITIONS_H +#define GCC_CONDITIONS_H + +/* The variable cc_status says how to interpret the condition code. + It is set by output routines for an instruction that sets the cc's + and examined by output routines for jump instructions. + + cc_status contains two components named `value1' and `value2' + that record two equivalent expressions for the values that the + condition codes were set from. (Either or both may be null if + there is no useful expression to record.) These fields are + used for eliminating redundant test and compare instructions + in the cases where the condition codes were already set by the + previous instruction. + + cc_status.flags contains flags which say that the condition codes + were set in a nonstandard manner. The output of jump instructions + uses these flags to compensate and produce the standard result + with the nonstandard condition codes. Standard flags are defined here. + The tm.h file can also define other machine-dependent flags. + + cc_status also contains a machine-dependent component `mdep' + whose type, `CC_STATUS_MDEP', may be defined as a macro in the + tm.h file. */ + +#ifndef CC_STATUS_MDEP +#define CC_STATUS_MDEP int +#endif + +#ifndef CC_STATUS_MDEP_INIT +#define CC_STATUS_MDEP_INIT 0 +#endif + +struct CC_STATUS {int flags; rtx value1, value2; CC_STATUS_MDEP mdep;}; + +/* While outputting an insn as assembler code, + this is the status BEFORE that insn. */ +extern CC_STATUS cc_prev_status; + +/* While outputting an insn as assembler code, + this is being altered to the status AFTER that insn. */ +extern CC_STATUS cc_status; + +/* These are the machine-independent flags: */ + +/* Set if the sign of the cc value is inverted: + output a following jump-if-less as a jump-if-greater, etc. */ +#define CC_REVERSED 1 + +/* This bit means that the current setting of the N bit is bogus + and conditional jumps should use the Z bit in its place. + This state obtains when an extraction of a signed single-bit field + or an arithmetic shift right of a byte by 7 bits + is turned into a btst, because btst does not set the N bit. */ +#define CC_NOT_POSITIVE 2 + +/* This bit means that the current setting of the N bit is bogus + and conditional jumps should pretend that the N bit is clear. + Used after extraction of an unsigned bit + or logical shift right of a byte by 7 bits is turned into a btst. + The btst does not alter the N bit, but the result of that shift + or extract is never negative. */ +#define CC_NOT_NEGATIVE 4 + +/* This bit means that the current setting of the overflow flag + is bogus and conditional jumps should pretend there is no overflow. */ +/* ??? Note that for most targets this macro is misnamed as it applies + to the carry flag, not the overflow flag. */ +#define CC_NO_OVERFLOW 010 + +/* This bit means that what ought to be in the Z bit + should be tested as the complement of the N bit. */ +#define CC_Z_IN_NOT_N 020 + +/* This bit means that what ought to be in the Z bit + should be tested as the N bit. */ +#define CC_Z_IN_N 040 + +/* Nonzero if we must invert the sense of the following branch, i.e. + change EQ to NE. This is not safe for IEEE floating point operations! + It is intended for use only when a combination of arithmetic + or logical insns can leave the condition codes set in a fortuitous + (though inverted) state. */ +#define CC_INVERTED 0100 + +/* Nonzero if we must convert signed condition operators to unsigned. + This is only used by machine description files. */ +#define CC_NOT_SIGNED 0200 + +/* This is how to initialize the variable cc_status. + final does this at appropriate moments. */ + +/* FIXME: We want to get rid of these ifndefs. */ +#ifndef CC_STATUS_INIT +#define CC_STATUS_INIT \ + (cc_status.flags = 0, cc_status.value1 = 0, cc_status.value2 = 0, \ + CC_STATUS_MDEP_INIT) +#endif +#endif /* GCC_CONDITIONS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config.h new file mode 100644 index 0000000..aa6dd6b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config.h @@ -0,0 +1,10 @@ +#ifndef GCC_CONFIG_H +#define GCC_CONFIG_H +#ifdef GENERATOR_FILE +#error config.h is for the host, not build, machine. +#endif +#include "auto-host.h" +#ifdef IN_GCC +# include "ansidecl.h" +#endif +#endif /* GCC_CONFIG_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/dbxelf.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/dbxelf.h new file mode 100644 index 0000000..b66f4d0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/dbxelf.h @@ -0,0 +1,68 @@ +/* Definitions needed when using stabs embedded in ELF sections. + Copyright (C) 1999-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +/* This file may be included by any ELF target which wishes to + support -gstabs generating stabs in sections, as produced by gas + and understood by gdb. */ + +#ifndef GCC_DBX_ELF_H +#define GCC_DBX_ELF_H + +/* Output DBX (stabs) debugging information if doing -gstabs. */ + +#define DBX_DEBUGGING_INFO 1 + +/* Make LBRAC and RBRAC addresses relative to the start of the + function. The native Solaris stabs debugging format works this + way, gdb expects it, and it reduces the number of relocation + entries... */ + +#define DBX_BLOCKS_FUNCTION_RELATIVE 1 + +/* ... but, to make this work, functions must appear prior to line info. */ + +#define DBX_FUNCTION_FIRST + +/* When generating stabs debugging, use N_BINCL entries. */ + +#define DBX_USE_BINCL + +/* There is no limit to the length of stabs strings. */ + +#ifndef DBX_CONTIN_LENGTH +#define DBX_CONTIN_LENGTH 0 +#endif + +/* Like block addresses, stabs line numbers are relative to the + current function. */ + +#define DBX_LINES_FUNCTION_RELATIVE 1 + +/* Generate a blank trailing N_SO to mark the end of the .o file, since + we can't depend upon the linker to mark .o file boundaries with + embedded stabs. */ + +#define DBX_OUTPUT_NULL_N_SO_AT_MAIN_SOURCE_FILE_END + +#endif /* ! GCC_DBX_ELF_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/elfos.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/elfos.h new file mode 100644 index 0000000..47a0711 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/elfos.h @@ -0,0 +1,465 @@ +/* elfos.h -- operating system specific defines to be used when + targeting GCC for some generic ELF system + Copyright (C) 1991-2017 Free Software Foundation, Inc. + Based on svr4.h contributed by Ron Guilmette (rfg@netcom.com). + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +#define TARGET_OBJFMT_CPP_BUILTINS() \ + do \ + { \ + builtin_define ("__ELF__"); \ + } \ + while (0) + +/* Define a symbol indicating that we are using elfos.h. + Some CPU specific configuration files use this. */ +#define USING_ELFOS_H + +/* The prefix to add to user-visible assembler symbols. + + For ELF systems the convention is *not* to prepend a leading + underscore onto user-level symbol names. */ + +#undef USER_LABEL_PREFIX +#define USER_LABEL_PREFIX "" + +/* The biggest alignment supported by ELF in bits. 32-bit ELF + supports section alignment up to (0x80000000 * 8), while + 64-bit ELF supports (0x8000000000000000 * 8). If this macro + is not defined, the default is the largest alignment supported + by 32-bit ELF and representable on a 32-bit host. Use this + macro to limit the alignment which can be specified using + the `__attribute__ ((aligned (N)))' construct. */ +#ifndef MAX_OFILE_ALIGNMENT +#define MAX_OFILE_ALIGNMENT (((unsigned int) 1 << 28) * 8) +#endif + +/* Use periods rather than dollar signs in special g++ assembler names. */ + +#define NO_DOLLAR_IN_LABEL + +/* Writing `int' for a bit-field forces int alignment for the structure. */ + +#ifndef PCC_BITFIELD_TYPE_MATTERS +#define PCC_BITFIELD_TYPE_MATTERS 1 +#endif + +/* All ELF targets can support DWARF-2. */ + +#define DWARF2_DEBUGGING_INFO 1 + +/* The GNU tools operate better with dwarf2, and it is required by some + psABI's. Since we don't have any native tools to be compatible with, + default to dwarf2. */ + +#ifndef PREFERRED_DEBUGGING_TYPE +#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG +#endif + +/* All SVR4 targets use the ELF object file format. */ +#define OBJECT_FORMAT_ELF + + +/* Output #ident as a .ident. */ + +#undef TARGET_ASM_OUTPUT_IDENT +#define TARGET_ASM_OUTPUT_IDENT default_asm_output_ident_directive + +#undef SET_ASM_OP +#define SET_ASM_OP "\t.set\t" + +/* Most svr4 assemblers want a .file directive at the beginning of + their input file. */ +#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true + +/* This is how to allocate empty space in some section. The .zero + pseudo-op is used for this on most svr4 assemblers. */ + +#define SKIP_ASM_OP "\t.zero\t" + +#undef ASM_OUTPUT_SKIP +#define ASM_OUTPUT_SKIP(FILE, SIZE) \ + fprintf ((FILE), "%s" HOST_WIDE_INT_PRINT_UNSIGNED "\n",\ + SKIP_ASM_OP, (SIZE)) + +/* This is how to store into the string LABEL + the symbol_ref name of an internal numbered label where + PREFIX is the class of label and NUM is the number within the class. + This is suitable for output with `assemble_name'. + + For most svr4 systems, the convention is that any symbol which begins + with a period is not put into the linker symbol table by the assembler. */ + +#undef ASM_GENERATE_INTERNAL_LABEL +#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \ + do \ + { \ + char *__p; \ + (LABEL)[0] = '*'; \ + (LABEL)[1] = '.'; \ + __p = stpcpy (&(LABEL)[2], PREFIX); \ + sprint_ul (__p, (unsigned long) (NUM)); \ + } \ + while (0) + +/* Output the label which precedes a jumptable. Note that for all svr4 + systems where we actually generate jumptables (which is to say every + svr4 target except i386, where we use casesi instead) we put the jump- + tables into the .rodata section and since other stuff could have been + put into the .rodata section prior to any given jumptable, we have to + make sure that the location counter for the .rodata section gets pro- + perly re-aligned prior to the actual beginning of the jump table. */ + +#undef ALIGN_ASM_OP +#define ALIGN_ASM_OP "\t.align\t" + +#ifndef ASM_OUTPUT_BEFORE_CASE_LABEL +#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE) \ + ASM_OUTPUT_ALIGN ((FILE), 2); +#endif + +#undef ASM_OUTPUT_CASE_LABEL +#define ASM_OUTPUT_CASE_LABEL(FILE, PREFIX, NUM, JUMPTABLE) \ + do \ + { \ + ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE) \ + (*targetm.asm_out.internal_label) (FILE, PREFIX, NUM); \ + } \ + while (0) + +/* The standard SVR4 assembler seems to require that certain builtin + library routines (e.g. .udiv) be explicitly declared as .globl + in each assembly file where they are referenced. */ + +#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ + (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0)) + +/* This says how to output assembler code to declare an + uninitialized external linkage data object. Under SVR4, + the linker seems to want the alignment of data objects + to depend on their types. We do exactly that here. */ + +#define COMMON_ASM_OP "\t.comm\t" + +#undef ASM_OUTPUT_ALIGNED_COMMON +#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ + do \ + { \ + fprintf ((FILE), "%s", COMMON_ASM_OP); \ + assemble_name ((FILE), (NAME)); \ + fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED ",%u\n", \ + (SIZE), (ALIGN) / BITS_PER_UNIT); \ + } \ + while (0) + +/* This says how to output assembler code to declare an + uninitialized internal linkage data object. Under SVR4, + the linker seems to want the alignment of data objects + to depend on their types. We do exactly that here. */ + +#define LOCAL_ASM_OP "\t.local\t" + +#undef ASM_OUTPUT_ALIGNED_LOCAL +#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ + do \ + { \ + fprintf ((FILE), "%s", LOCAL_ASM_OP); \ + assemble_name ((FILE), (NAME)); \ + fprintf ((FILE), "\n"); \ + ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \ + } \ + while (0) + +/* This is the pseudo-op used to generate a contiguous sequence of byte + values from a double-quoted string WITHOUT HAVING A TERMINATING NUL + AUTOMATICALLY APPENDED. This is the same for most svr4 assemblers. */ + +#undef ASCII_DATA_ASM_OP +#define ASCII_DATA_ASM_OP "\t.ascii\t" + +/* Support a read-only data section. */ +#define READONLY_DATA_SECTION_ASM_OP "\t.section\t.rodata" + +/* On svr4, we *do* have support for the .init and .fini sections, and we + can put stuff in there to be executed before and after `main'. We let + crtstuff.c and other files know this by defining the following symbols. + The definitions say how to change sections to the .init and .fini + sections. This is the same for all known svr4 assemblers. */ + +#define INIT_SECTION_ASM_OP "\t.section\t.init" +#define FINI_SECTION_ASM_OP "\t.section\t.fini" + +/* Output assembly directive to move to the beginning of current section. */ +#ifdef HAVE_GAS_SUBSECTION_ORDERING +# define ASM_SECTION_START_OP "\t.subsection\t-1" +# define ASM_OUTPUT_SECTION_START(FILE) \ + fprintf ((FILE), "%s\n", ASM_SECTION_START_OP) +#endif + +#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1) + +/* Switch into a generic section. */ +#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section + +#undef TARGET_ASM_SELECT_RTX_SECTION +#define TARGET_ASM_SELECT_RTX_SECTION default_elf_select_rtx_section +#undef TARGET_ASM_SELECT_SECTION +#define TARGET_ASM_SELECT_SECTION default_elf_select_section +#undef TARGET_HAVE_SWITCHABLE_BSS_SECTIONS +#define TARGET_HAVE_SWITCHABLE_BSS_SECTIONS true + +/* Define the strings used for the special svr4 .type and .size directives. + These strings generally do not vary from one system running svr4 to + another, but if a given system (e.g. m88k running svr) needs to use + different pseudo-op names for these, they may be overridden in the + file which includes this one. */ + +#define TYPE_ASM_OP "\t.type\t" +#define SIZE_ASM_OP "\t.size\t" + +/* This is how we tell the assembler that a symbol is weak. */ + +#define ASM_WEAKEN_LABEL(FILE, NAME) \ + do \ + { \ + fputs ("\t.weak\t", (FILE)); \ + assemble_name ((FILE), (NAME)); \ + fputc ('\n', (FILE)); \ + } \ + while (0) + +/* The following macro defines the format used to output the second + operand of the .type assembler directive. Different svr4 assemblers + expect various different forms for this operand. The one given here + is just a default. You may need to override it in your machine- + specific tm.h file (depending upon the particulars of your assembler). */ + +#define TYPE_OPERAND_FMT "@%s" + +/* Write the extra assembler code needed to declare a function's result. + Most svr4 assemblers don't require any special declaration of the + result value, but there are exceptions. */ + +#ifndef ASM_DECLARE_RESULT +#define ASM_DECLARE_RESULT(FILE, RESULT) +#endif + +/* These macros generate the special .type and .size directives which + are used to set the corresponding fields of the linker symbol table + entries in an ELF object file under SVR4. These macros also output + the starting labels for the relevant functions/objects. */ + +/* Write the extra assembler code needed to declare a function properly. + Some svr4 assemblers need to also have something extra said about the + function's return value. We allow for that here. */ + +#ifndef ASM_DECLARE_FUNCTION_NAME +#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ + do \ + { \ + ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \ + ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ + ASM_OUTPUT_FUNCTION_LABEL (FILE, NAME, DECL); \ + } \ + while (0) +#endif + +/* Write the extra assembler code needed to declare the name of a + cold function partition properly. Some svr4 assemblers need to also + have something extra said about the function's return value. We + allow for that here. */ + +#ifndef ASM_DECLARE_COLD_FUNCTION_NAME +#define ASM_DECLARE_COLD_FUNCTION_NAME(FILE, NAME, DECL) \ + do \ + { \ + ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \ + ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ + ASM_OUTPUT_FUNCTION_LABEL (FILE, NAME, DECL); \ + } \ + while (0) +#endif + +/* Write the extra assembler code needed to declare an object properly. */ + +#ifdef HAVE_GAS_GNU_UNIQUE_OBJECT +#define USE_GNU_UNIQUE_OBJECT flag_gnu_unique +#else +#define USE_GNU_UNIQUE_OBJECT 0 +#endif + +#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ + do \ + { \ + HOST_WIDE_INT size; \ + \ + /* For template static data member instantiations or \ + inline fn local statics and their guard variables, use \ + gnu_unique_object so that they will be combined even under \ + RTLD_LOCAL. Don't use gnu_unique_object for typeinfo, \ + vtables and other read-only artificial decls. */ \ + if (USE_GNU_UNIQUE_OBJECT && DECL_ONE_ONLY (DECL) \ + && (!DECL_ARTIFICIAL (DECL) || !TREE_READONLY (DECL))) \ + ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "gnu_unique_object"); \ + else \ + ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \ + \ + size_directive_output = 0; \ + if (!flag_inhibit_size_directive \ + && (DECL) && DECL_SIZE (DECL)) \ + { \ + size_directive_output = 1; \ + size = tree_to_uhwi (DECL_SIZE_UNIT (DECL)); \ + ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \ + } \ + \ + ASM_OUTPUT_LABEL (FILE, NAME); \ + } \ + while (0) + +/* Output the size directive for a decl in rest_of_decl_compilation + in the case where we did not do so before the initializer. + Once we find the error_mark_node, we know that the value of + size_directive_output was set + by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ + +#undef ASM_FINISH_DECLARE_OBJECT +#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END)\ + do \ + { \ + const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ + HOST_WIDE_INT size; \ + \ + if (!flag_inhibit_size_directive \ + && DECL_SIZE (DECL) \ + && ! AT_END && TOP_LEVEL \ + && DECL_INITIAL (DECL) == error_mark_node \ + && !size_directive_output) \ + { \ + size_directive_output = 1; \ + size = tree_to_uhwi (DECL_SIZE_UNIT (DECL)); \ + ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \ + } \ + } \ + while (0) + +/* This is how to declare the size of a function. */ +#ifndef ASM_DECLARE_FUNCTION_SIZE +#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ + do \ + { \ + if (!flag_inhibit_size_directive) \ + ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \ + } \ + while (0) +#endif + +/* This is how to declare the size of a cold function partition. */ +#ifndef ASM_DECLARE_COLD_FUNCTION_SIZE +#define ASM_DECLARE_COLD_FUNCTION_SIZE(FILE, FNAME, DECL) \ + do \ + { \ + if (!flag_inhibit_size_directive) \ + ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \ + } \ + while (0) +#endif + +/* A table of bytes codes used by the ASM_OUTPUT_ASCII and + ASM_OUTPUT_LIMITED_STRING macros. Each byte in the table + corresponds to a particular byte value [0..255]. For any + given byte value, if the value in the corresponding table + position is zero, the given character can be output directly. + If the table value is 1, the byte must be output as a \ooo + octal escape. If the tables value is anything else, then the + byte value should be output as a \ followed by the value + in the table. Note that we can use standard UN*X escape + sequences for many control characters, but we don't use + \a to represent BEL because some svr4 assemblers (e.g. on + the i386) don't know about that. Also, we don't use \v + since some versions of gas, such as 2.2 did not accept it. */ + +#define ELF_ASCII_ESCAPES \ +"\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ +\0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ +\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\ +\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\ +\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ +\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ +\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ +\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1" + +/* Some svr4 assemblers have a limit on the number of characters which + can appear in the operand of a .string directive. If your assembler + has such a limitation, you should define STRING_LIMIT to reflect that + limit. Note that at least some svr4 assemblers have a limit on the + actual number of bytes in the double-quoted string, and that they + count each character in an escape sequence as one byte. Thus, an + escape sequence like \377 would count as four bytes. + + If your target assembler doesn't support the .string directive, you + should define this to zero. +*/ + +#define ELF_STRING_LIMIT ((unsigned) 256) + +#define STRING_ASM_OP "\t.string\t" + +/* The routine used to output NUL terminated strings. We use a special + version of this for most svr4 targets because doing so makes the + generated assembly code more compact (and thus faster to assemble) + as well as more readable, especially for targets like the i386 + (where the only alternative is to output character sequences as + comma separated lists of numbers). */ + +#define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \ + default_elf_asm_output_limited_string ((FILE), (STR)) + +/* The routine used to output sequences of byte values. We use a special + version of this for most svr4 targets because doing so makes the + generated assembly code more compact (and thus faster to assemble) + as well as more readable. Note that if we find subparts of the + character sequence which end with NUL (and which are shorter than + STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */ + +#undef ASM_OUTPUT_ASCII +#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ + default_elf_asm_output_ascii ((FILE), (STR), (LENGTH)); + +/* Allow the use of the -frecord-gcc-switches switch via the + elf_record_gcc_switches function defined in varasm.c. */ +#undef TARGET_ASM_RECORD_GCC_SWITCHES +#define TARGET_ASM_RECORD_GCC_SWITCHES elf_record_gcc_switches + +/* A C statement (sans semicolon) to output to the stdio stream STREAM + any text necessary for declaring the name of an external symbol + named NAME which is referenced in this compilation but not defined. + It is needed to properly support non-default visibility. */ + +#ifndef ASM_OUTPUT_EXTERNAL +#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \ + default_elf_asm_output_external (FILE, DECL, NAME) +#endif + +#undef TARGET_LIBC_HAS_FUNCTION +#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/glibc-stdint.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/glibc-stdint.h new file mode 100644 index 0000000..bf4de54 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/glibc-stdint.h @@ -0,0 +1,61 @@ +/* Definitions for types on systems using GNU libc or uClibc. + Copyright (C) 2008-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +/* Systems using musl libc should use this header and make sure + OPTION_MUSL is defined correctly before using the TYPE macros. */ +#ifndef OPTION_MUSL +#define OPTION_MUSL 0 +#endif + +#define SIG_ATOMIC_TYPE "int" + +#define INT8_TYPE "signed char" +#define INT16_TYPE "short int" +#define INT32_TYPE "int" +#define INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") +#define UINT8_TYPE "unsigned char" +#define UINT16_TYPE "short unsigned int" +#define UINT32_TYPE "unsigned int" +#define UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") + +#define INT_LEAST8_TYPE "signed char" +#define INT_LEAST16_TYPE "short int" +#define INT_LEAST32_TYPE "int" +#define INT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") +#define UINT_LEAST8_TYPE "unsigned char" +#define UINT_LEAST16_TYPE "short unsigned int" +#define UINT_LEAST32_TYPE "unsigned int" +#define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") + +#define INT_FAST8_TYPE "signed char" +#define INT_FAST16_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long int" : "int") +#define INT_FAST32_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long int" : "int") +#define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") +#define UINT_FAST8_TYPE "unsigned char" +#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long unsigned int" : "unsigned int") +#define UINT_FAST32_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long unsigned int" : "unsigned int") +#define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") + +#define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int") +#define UINTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int") diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/gnu-user.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/gnu-user.h new file mode 100644 index 0000000..de605b0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/gnu-user.h @@ -0,0 +1,171 @@ +/* Definitions for systems using, at least optionally, a GNU + (glibc-based) userspace or other userspace with libc derived from + glibc (e.g. uClibc) or for which similar specs are appropriate. + Copyright (C) 1995-2017 Free Software Foundation, Inc. + Contributed by Eric Youngdale. + Modified for stabs-in-ELF by H.J. Lu (hjl@lucon.org). + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +/* Don't assume anything about the header files. */ +#define NO_IMPLICIT_EXTERN_C + +#undef ASM_APP_ON +#define ASM_APP_ON "#APP\n" + +#undef ASM_APP_OFF +#define ASM_APP_OFF "#NO_APP\n" + +#if ENABLE_OFFLOADING == 1 +#define CRTOFFLOADBEGIN "%{fopenacc|fopenmp:crtoffloadbegin%O%s}" +#define CRTOFFLOADEND "%{fopenacc|fopenmp:crtoffloadend%O%s}" +#else +#define CRTOFFLOADBEGIN "" +#define CRTOFFLOADEND "" +#endif + +/* Provide a STARTFILE_SPEC appropriate for GNU userspace. Here we add + the GNU userspace magical crtbegin.o file (see crtstuff.c) which + provides part of the support for getting C++ file-scope static + object constructed before entering `main'. */ + +#if defined HAVE_LD_PIE +#define GNU_USER_TARGET_STARTFILE_SPEC \ + "%{shared:; \ + pg|p|profile:gcrt1.o%s; \ + static:crt1.o%s; \ + " PIE_SPEC ":Scrt1.o%s; \ + :crt1.o%s} \ + crti.o%s \ + %{static:crtbeginT.o%s; \ + shared|" PIE_SPEC ":crtbeginS.o%s; \ + :crtbegin.o%s} \ + %{fvtable-verify=none:%s; \ + fvtable-verify=preinit:vtv_start_preinit.o%s; \ + fvtable-verify=std:vtv_start.o%s} \ + " CRTOFFLOADBEGIN +#else +#define GNU_USER_TARGET_STARTFILE_SPEC \ + "%{shared:; \ + pg|p|profile:gcrt1.o%s; \ + :crt1.o%s} \ + crti.o%s \ + %{static:crtbeginT.o%s; \ + shared|pie:crtbeginS.o%s; \ + :crtbegin.o%s} \ + %{fvtable-verify=none:%s; \ + fvtable-verify=preinit:vtv_start_preinit.o%s; \ + fvtable-verify=std:vtv_start.o%s} \ + " CRTOFFLOADBEGIN +#endif +#undef STARTFILE_SPEC +#define STARTFILE_SPEC GNU_USER_TARGET_STARTFILE_SPEC + +/* Provide a ENDFILE_SPEC appropriate for GNU userspace. Here we tack on + the GNU userspace magical crtend.o file (see crtstuff.c) which + provides part of the support for getting C++ file-scope static + object constructed before entering `main', followed by a normal + GNU userspace "finalizer" file, `crtn.o'. */ + +#if defined HAVE_LD_PIE +#define GNU_USER_TARGET_ENDFILE_SPEC \ + "%{fvtable-verify=none:%s; \ + fvtable-verify=preinit:vtv_end_preinit.o%s; \ + fvtable-verify=std:vtv_end.o%s} \ + %{static:crtend.o%s; \ + shared|" PIE_SPEC ":crtendS.o%s; \ + :crtend.o%s} \ + crtn.o%s \ + " CRTOFFLOADEND +#else +#define GNU_USER_TARGET_ENDFILE_SPEC \ + "%{fvtable-verify=none:%s; \ + fvtable-verify=preinit:vtv_end_preinit.o%s; \ + fvtable-verify=std:vtv_end.o%s} \ + %{static:crtend.o%s; \ + shared|pie:crtendS.o%s; \ + :crtend.o%s} \ + crtn.o%s \ + " CRTOFFLOADEND +#endif +#undef ENDFILE_SPEC +#define ENDFILE_SPEC GNU_USER_TARGET_ENDFILE_SPEC + +/* This is for -profile to use -lc_p instead of -lc. */ +#define GNU_USER_TARGET_CC1_SPEC "%{profile:-p}" +#ifndef CC1_SPEC +#define CC1_SPEC GNU_USER_TARGET_CC1_SPEC +#endif + +/* The GNU C++ standard library requires that these macros be defined. */ +#undef CPLUSPLUS_CPP_SPEC +#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)" + +#define GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC \ + "%{shared:-lc} \ + %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}" + +#define GNU_USER_TARGET_LIB_SPEC \ + "%{pthread:-lpthread} " \ + GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC + +#undef LIB_SPEC +#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC + +#if defined(HAVE_LD_EH_FRAME_HDR) +#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " +#endif + +#undef LINK_GCC_C_SEQUENCE_SPEC +#define LINK_GCC_C_SEQUENCE_SPEC \ + "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" + +/* Use --as-needed -lgcc_s for eh support. */ +#ifdef HAVE_LD_AS_NEEDED +#define USE_LD_AS_NEEDED 1 +#endif + +#define TARGET_POSIX_IO + +#undef TARGET_LIBC_HAS_FUNCTION +#define TARGET_LIBC_HAS_FUNCTION gnu_libc_has_function + +/* Link -lasan early on the command line. For -static-libasan, don't link + it for -shared link, the executable should be compiled with -static-libasan + in that case, and for executable link with --{,no-}whole-archive around + it to force everything into the executable. And similarly for -ltsan + and -llsan. */ +#if defined(HAVE_LD_STATIC_DYNAMIC) +#undef LIBASAN_EARLY_SPEC +#define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \ + "%{static-libasan:%{!shared:" \ + LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \ + LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}" +#undef LIBTSAN_EARLY_SPEC +#define LIBTSAN_EARLY_SPEC "%{static-libtsan:%{!shared:" \ + LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \ + LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}" +#undef LIBLSAN_EARLY_SPEC +#define LIBLSAN_EARLY_SPEC "%{static-liblsan:%{!shared:" \ + LD_STATIC_OPTION " --whole-archive -llsan --no-whole-archive " \ + LD_DYNAMIC_OPTION "}}%{!static-liblsan:-llsan}" +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/initfini-array.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/initfini-array.h new file mode 100644 index 0000000..b5ba472 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/initfini-array.h @@ -0,0 +1,45 @@ +/* Definitions for ELF systems with .init_array/.fini_array section + support. + Copyright (C) 2011-2017 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + +#if HAVE_INITFINI_ARRAY_SUPPORT + +#define USE_INITFINI_ARRAY + +#undef INIT_SECTION_ASM_OP +#undef FINI_SECTION_ASM_OP + +#undef INIT_ARRAY_SECTION_ASM_OP +#define INIT_ARRAY_SECTION_ASM_OP + +#undef FINI_ARRAY_SECTION_ASM_OP +#define FINI_ARRAY_SECTION_ASM_OP + +/* Use .init_array/.fini_array section for constructors and destructors. */ +#undef TARGET_ASM_CONSTRUCTOR +#define TARGET_ASM_CONSTRUCTOR default_elf_init_array_asm_out_constructor +#undef TARGET_ASM_DESTRUCTOR +#define TARGET_ASM_DESTRUCTOR default_elf_fini_array_asm_out_destructor + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/linux-android.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/linux-android.h new file mode 100644 index 0000000..19c55c3 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/linux-android.h @@ -0,0 +1,59 @@ +/* Configuration file for Linux Android targets. + Copyright (C) 2008-2017 Free Software Foundation, Inc. + Contributed by Doug Kwan (dougkwan@google.com) + Rewritten by CodeSourcery, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#define ANDROID_TARGET_OS_CPP_BUILTINS() \ + do { \ + if (TARGET_ANDROID) \ + builtin_define ("__ANDROID__"); \ + } while (0) + +#if ANDROID_DEFAULT +# define NOANDROID "mno-android" +#else +# define NOANDROID "!mandroid" +#endif + +#define LINUX_OR_ANDROID_CC(LINUX_SPEC, ANDROID_SPEC) \ + "%{" NOANDROID "|tno-android-cc:" LINUX_SPEC ";:" ANDROID_SPEC "}" + +#define LINUX_OR_ANDROID_LD(LINUX_SPEC, ANDROID_SPEC) \ + "%{" NOANDROID "|tno-android-ld:" LINUX_SPEC ";:" ANDROID_SPEC "}" + +#define ANDROID_LINK_SPEC \ + "%{shared: -Bsymbolic}" + +#define ANDROID_CC1_SPEC \ + "%{!mglibc:%{!muclibc:%{!mbionic: -mbionic}}} " \ + "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -fPIC}}}}" + +#define ANDROID_CC1PLUS_SPEC \ + "%{!fexceptions:%{!fno-exceptions: -fno-exceptions}} " \ + "%{!frtti:%{!fno-rtti: -fno-rtti}}" + +#define ANDROID_LIB_SPEC \ + "%{!static: -ldl}" + +#define ANDROID_STARTFILE_SPEC \ + "%{shared: crtbegin_so%O%s;:" \ + " %{static: crtbegin_static%O%s;: crtbegin_dynamic%O%s}}" + +#define ANDROID_ENDFILE_SPEC \ + "%{shared: crtend_so%O%s;: crtend_android%O%s}" diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/linux-protos.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/linux-protos.h new file mode 100644 index 0000000..0a5d1d2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/linux-protos.h @@ -0,0 +1,22 @@ +/* Prototypes. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +extern bool linux_has_ifunc_p (void); + +extern bool linux_libc_has_function (enum function_class fn_class); diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/linux.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/linux.h new file mode 100644 index 0000000..b3a9e85 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/linux.h @@ -0,0 +1,210 @@ +/* Definitions for systems using the Linux kernel, with or without + MMU, using ELF at the compiler level but possibly FLT for final + linked executables and shared libraries in some no-MMU cases, and + possibly with a choice of libc implementations. + Copyright (C) 1995-2017 Free Software Foundation, Inc. + Contributed by Eric Youngdale. + Modified for stabs-in-ELF by H.J. Lu (hjl@lucon.org). + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +/* C libraries supported on Linux. */ +#ifdef SINGLE_LIBC +#define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) +#define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) +#define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) +#undef OPTION_MUSL +#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) +#else +#define OPTION_GLIBC (linux_libc == LIBC_GLIBC) +#define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) +#define OPTION_BIONIC (linux_libc == LIBC_BIONIC) +#undef OPTION_MUSL +#define OPTION_MUSL (linux_libc == LIBC_MUSL) +#endif + +#define GNU_USER_TARGET_OS_CPP_BUILTINS() \ + do { \ + if (OPTION_GLIBC) \ + builtin_define ("__gnu_linux__"); \ + builtin_define_std ("linux"); \ + builtin_define_std ("unix"); \ + builtin_assert ("system=linux"); \ + builtin_assert ("system=unix"); \ + builtin_assert ("system=posix"); \ + } while (0) + +/* Determine which dynamic linker to use depending on whether GLIBC or + uClibc or Bionic or musl is the default C library and whether + -muclibc or -mglibc or -mbionic or -mmusl has been passed to change + the default. */ + +#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \ + "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}" + +#if DEFAULT_LIBC == LIBC_GLIBC +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ + CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M) +#elif DEFAULT_LIBC == LIBC_UCLIBC +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ + CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M) +#elif DEFAULT_LIBC == LIBC_BIONIC +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ + CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M) +#elif DEFAULT_LIBC == LIBC_MUSL +#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ + CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B) +#else +#error "Unsupported DEFAULT_LIBC" +#endif /* DEFAULT_LIBC */ + +/* For most targets the following definitions suffice; + GLIBC_DYNAMIC_LINKER must be defined for each target using them, or + GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets + supporting both 32-bit and 64-bit compilation. */ +#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" +#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0" +#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0" +#define UCLIBC_DYNAMIC_LINKERX32 "/lib/ldx32-uClibc.so.0" +#define BIONIC_DYNAMIC_LINKER "/system/bin/linker" +#define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker" +#define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64" +#define BIONIC_DYNAMIC_LINKERX32 "/system/bin/linkerx32" +/* Should be redefined for each target that supports musl. */ +#define MUSL_DYNAMIC_LINKER "/dev/null" +#define MUSL_DYNAMIC_LINKER32 "/dev/null" +#define MUSL_DYNAMIC_LINKER64 "/dev/null" +#define MUSL_DYNAMIC_LINKERX32 "/dev/null" + +#define GNU_USER_DYNAMIC_LINKER \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \ + BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER) +#define GNU_USER_DYNAMIC_LINKER32 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \ + BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32) +#define GNU_USER_DYNAMIC_LINKER64 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \ + BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64) +#define GNU_USER_DYNAMIC_LINKERX32 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \ + BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32) + +/* Whether we have Bionic libc runtime */ +#undef TARGET_HAS_BIONIC +#define TARGET_HAS_BIONIC (OPTION_BIONIC) + +/* musl avoids problematic includes by rearranging the include directories. + * Unfortunately, this is mostly duplicated from cppdefault.c */ +#if DEFAULT_LIBC == LIBC_MUSL +#define INCLUDE_DEFAULTS_MUSL_GPP \ + { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \ + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \ + { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \ + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \ + { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \ + GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, + +#ifdef LOCAL_INCLUDE_DIR +#define INCLUDE_DEFAULTS_MUSL_LOCAL \ + { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \ + { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 }, +#else +#define INCLUDE_DEFAULTS_MUSL_LOCAL +#endif + +#ifdef PREFIX_INCLUDE_DIR +#define INCLUDE_DEFAULTS_MUSL_PREFIX \ + { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0}, +#else +#define INCLUDE_DEFAULTS_MUSL_PREFIX +#endif + +#ifdef CROSS_INCLUDE_DIR +#define INCLUDE_DEFAULTS_MUSL_CROSS \ + { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0}, +#else +#define INCLUDE_DEFAULTS_MUSL_CROSS +#endif + +#ifdef TOOL_INCLUDE_DIR +#define INCLUDE_DEFAULTS_MUSL_TOOL \ + { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0}, +#else +#define INCLUDE_DEFAULTS_MUSL_TOOL +#endif + +#ifdef NATIVE_SYSTEM_HEADER_DIR +#define INCLUDE_DEFAULTS_MUSL_NATIVE \ + { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ + { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 }, +#else +#define INCLUDE_DEFAULTS_MUSL_NATIVE +#endif + +#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT) +# undef INCLUDE_DEFAULTS_MUSL_LOCAL +# define INCLUDE_DEFAULTS_MUSL_LOCAL +# undef INCLUDE_DEFAULTS_MUSL_NATIVE +# define INCLUDE_DEFAULTS_MUSL_NATIVE +#else +# undef INCLUDE_DEFAULTS_MUSL_CROSS +# define INCLUDE_DEFAULTS_MUSL_CROSS +#endif + +#undef INCLUDE_DEFAULTS +#define INCLUDE_DEFAULTS \ + { \ + INCLUDE_DEFAULTS_MUSL_GPP \ + INCLUDE_DEFAULTS_MUSL_LOCAL \ + INCLUDE_DEFAULTS_MUSL_PREFIX \ + INCLUDE_DEFAULTS_MUSL_CROSS \ + INCLUDE_DEFAULTS_MUSL_TOOL \ + INCLUDE_DEFAULTS_MUSL_NATIVE \ + { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ + { 0, 0, 0, 0, 0, 0 } \ + } +#endif + +#if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */ +/* This is a *uclinux* target. We don't define below macros to normal linux + versions, because doing so would require *uclinux* targets to include + linux.c, linux-protos.h, linux.opt, etc. We could, alternatively, add + these files to *uclinux* targets, but that would only pollute option list + (add -mglibc, etc.) without adding any useful support. */ + +/* Define TARGET_LIBC_HAS_FUNCTION for *uclinux* targets to + no_c99_libc_has_function, because uclibc does not, normally, have + c99 runtime. If, in special cases, uclibc does have c99 runtime, + this should be defined to a new hook. Also please note that for targets + like *-linux-uclibc that similar check will also need to be added to + linux_libc_has_function. */ +# undef TARGET_LIBC_HAS_FUNCTION +# define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function + +#else /* !uClinux, i.e., normal Linux */ + +/* Determine what functions are present at the runtime; + this includes full c99 runtime and sincos. */ +# undef TARGET_LIBC_HAS_FUNCTION +# define TARGET_LIBC_HAS_FUNCTION linux_libc_has_function + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/mips/gnu-user.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/mips/gnu-user.h new file mode 100644 index 0000000..af45d18 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/mips/gnu-user.h @@ -0,0 +1,149 @@ +/* Definitions for MIPS systems using GNU userspace. + Copyright (C) 1998-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#undef WCHAR_TYPE +#define WCHAR_TYPE "int" + +#undef WCHAR_TYPE_SIZE +#define WCHAR_TYPE_SIZE 32 + +#undef ASM_DECLARE_OBJECT_NAME +#define ASM_DECLARE_OBJECT_NAME mips_declare_object_name + +/* If we don't set MASK_ABICALLS, we can't default to PIC. */ +#undef TARGET_DEFAULT +#define TARGET_DEFAULT MASK_ABICALLS + +#define TARGET_OS_CPP_BUILTINS() \ + do { \ + GNU_USER_TARGET_OS_CPP_BUILTINS(); \ + /* The GNU C++ standard library requires this. */ \ + if (c_dialect_cxx ()) \ + builtin_define ("_GNU_SOURCE"); \ + } while (0) + +#undef SUBTARGET_CPP_SPEC +#define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" + +/* A standard GNU/Linux mapping. On most targets, it is included in + CC1_SPEC itself by config/linux.h, but mips.h overrides CC1_SPEC + and provides this hook instead. */ +#undef SUBTARGET_CC1_SPEC +#define SUBTARGET_CC1_SPEC GNU_USER_TARGET_CC1_SPEC + +/* -G is incompatible with -KPIC which is the default, so only allow objects + in the small data section if the user explicitly asks for it. */ +#undef MIPS_DEFAULT_GVALUE +#define MIPS_DEFAULT_GVALUE 0 + +#undef GNU_USER_TARGET_LINK_SPEC +#define GNU_USER_TARGET_LINK_SPEC "\ + %{G*} %{EB} %{EL} %{mips*} %{shared} \ + %{!shared: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ + %{mabi=n32: -dynamic-linker " GNU_USER_DYNAMIC_LINKERN32 "} \ + %{mabi=64: -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "} \ + %{mabi=32: -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}} \ + %{static}} \ + %{mabi=n32:-m" GNU_USER_LINK_EMULATIONN32 "} \ + %{mabi=64:-m" GNU_USER_LINK_EMULATION64 "} \ + %{mabi=32:-m" GNU_USER_LINK_EMULATION32 "}" + +#undef LINK_SPEC +#define LINK_SPEC GNU_USER_TARGET_LINK_SPEC + +#undef SUBTARGET_ASM_SPEC +#define SUBTARGET_ASM_SPEC \ + "%{!mno-abicalls:%{mplt:-call_nonpic;:-KPIC}}" + +/* The MIPS assembler has different syntax for .set. We set it to + .dummy to trap any errors. */ +#undef SET_ASM_OP +#define SET_ASM_OP "\t.dummy\t" + +#undef ASM_OUTPUT_DEF +#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \ + do { \ + fputc ( '\t', FILE); \ + assemble_name (FILE, LABEL1); \ + fputs ( " = ", FILE); \ + assemble_name (FILE, LABEL2); \ + fputc ( '\n', FILE); \ + } while (0) + +/* The glibc _mcount stub will save $v0 for us. Don't mess with saving + it, since ASM_OUTPUT_REG_PUSH/ASM_OUTPUT_REG_POP do not work in the + presence of $gp-relative calls. */ +#undef ASM_OUTPUT_REG_PUSH +#undef ASM_OUTPUT_REG_POP + +#undef LIB_SPEC +#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC + +#ifdef HAVE_AS_NO_SHARED +/* Default to -mno-shared for non-PIC. */ +# define NO_SHARED_SPECS \ + " %{mshared|mno-shared:;:%{" NO_FPIE_AND_FPIC_SPEC ":-mno-shared}}" +#else +# define NO_SHARED_SPECS "" +#endif + +/* -march=native handling only makes sense with compiler running on + a MIPS chip. */ +#if defined(__mips__) +extern const char *host_detect_local_cpu (int argc, const char **argv); +# define EXTRA_SPEC_FUNCTIONS \ + { "local_cpu_detect", host_detect_local_cpu }, + +# define MARCH_MTUNE_NATIVE_SPECS \ + " %{march=native:%. */ + +#undef TARGET_OS_CPP_BUILTINS +#define TARGET_OS_CPP_BUILTINS() \ + do { \ + GNU_USER_TARGET_OS_CPP_BUILTINS(); \ + /* The GNU C++ standard library requires this. */ \ + if (c_dialect_cxx ()) \ + builtin_define ("_GNU_SOURCE"); \ + ANDROID_TARGET_OS_CPP_BUILTINS(); \ + } while (0) + +#undef LINK_SPEC +#define LINK_SPEC \ + LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LINK_SPEC, \ + GNU_USER_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC) + +#undef SUBTARGET_CC1_SPEC +#define SUBTARGET_CC1_SPEC \ + LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC, \ + GNU_USER_TARGET_CC1_SPEC " " ANDROID_CC1_SPEC) + +#undef CC1PLUS_SPEC +#define CC1PLUS_SPEC \ + LINUX_OR_ANDROID_CC ("", ANDROID_CC1PLUS_SPEC) + +#undef LIB_SPEC +#define LIB_SPEC \ + LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LIB_SPEC, \ + GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC " " ANDROID_LIB_SPEC) + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC \ + LINUX_OR_ANDROID_LD (GNU_USER_TARGET_STARTFILE_SPEC, ANDROID_STARTFILE_SPEC) + +#undef ENDFILE_SPEC +#define ENDFILE_SPEC \ + LINUX_OR_ANDROID_LD (GNU_USER_TARGET_MATHFILE_SPEC " " \ + GNU_USER_TARGET_ENDFILE_SPEC, \ + GNU_USER_TARGET_MATHFILE_SPEC " " \ + ANDROID_ENDFILE_SPEC) + +/* Define this to be nonzero if static stack checking is supported. */ +#define STACK_CHECK_STATIC_BUILTIN 1 + +/* The default value isn't sufficient in 64-bit mode. */ +#define STACK_CHECK_PROTECT (TARGET_64BIT ? 16 * 1024 : 12 * 1024) diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/mips/linux.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/mips/linux.h new file mode 100644 index 0000000..44132b8 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/mips/linux.h @@ -0,0 +1,52 @@ +/* Definitions for MIPS running Linux-based GNU systems with ELF format. + Copyright (C) 1998-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#define GNU_USER_LINK_EMULATION32 "elf32%{EB:b}%{EL:l}tsmip" +#define GNU_USER_LINK_EMULATION64 "elf64%{EB:b}%{EL:l}tsmip" +#define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32" + +#define GLIBC_DYNAMIC_LINKER32 \ + "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}" +#define GLIBC_DYNAMIC_LINKER64 \ + "%{mnan=2008:/lib64/ld-linux-mipsn8.so.1;:/lib64/ld.so.1}" +#define GLIBC_DYNAMIC_LINKERN32 \ + "%{mnan=2008:/lib32/ld-linux-mipsn8.so.1;:/lib32/ld.so.1}" + +#undef UCLIBC_DYNAMIC_LINKER32 +#define UCLIBC_DYNAMIC_LINKER32 \ + "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}" +#undef UCLIBC_DYNAMIC_LINKER64 +#define UCLIBC_DYNAMIC_LINKER64 \ + "%{mnan=2008:/lib/ld64-uClibc-mipsn8.so.0;:/lib/ld64-uClibc.so.0}" +#define UCLIBC_DYNAMIC_LINKERN32 \ + "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}" + +#undef MUSL_DYNAMIC_LINKER32 +#define MUSL_DYNAMIC_LINKER32 \ + "/lib/ld-musl-mips%{mips32r6|mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1" +#undef MUSL_DYNAMIC_LINKER64 +#define MUSL_DYNAMIC_LINKER64 \ + "/lib/ld-musl-mips64%{mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1" +#define MUSL_DYNAMIC_LINKERN32 \ + "/lib/ld-musl-mipsn32%{mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1" + +#define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32" +#define GNU_USER_DYNAMIC_LINKERN32 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \ + BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32) diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/mips/mips-opts.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/mips/mips-opts.h new file mode 100644 index 0000000..fe57cf2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/mips/mips-opts.h @@ -0,0 +1,56 @@ +/* Definitions for option handling for MIPS. + Copyright (C) 1989-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef MIPS_OPTS_H +#define MIPS_OPTS_H + +/* Enumerates the setting of the -mcode-readable option. */ +enum mips_code_readable_setting { + CODE_READABLE_NO, + CODE_READABLE_PCREL, + CODE_READABLE_YES +}; + +/* Enumerates the setting of the -mabs and -mnan options. */ +enum mips_ieee_754_setting { + MIPS_IEEE_754_DEFAULT, + MIPS_IEEE_754_LEGACY, + MIPS_IEEE_754_2008 +}; + +/* Enumerates the setting of the -mr10k-cache-barrier option. */ +enum mips_r10k_cache_barrier_setting { + R10K_CACHE_BARRIER_NONE, + R10K_CACHE_BARRIER_STORE, + R10K_CACHE_BARRIER_LOAD_STORE +}; + +/* No enumeration is defined to index the -march= values (entries in + mips_cpu_info_table), with the type int being used instead, but we + need to distinguish the special "from-abi" and "native" values. */ +#define MIPS_ARCH_OPTION_FROM_ABI -1 +#define MIPS_ARCH_OPTION_NATIVE -2 + +/* Enumerates the setting of the -mcompact-branches= option. */ +enum mips_cb_setting { + MIPS_CB_NEVER, + MIPS_CB_OPTIMAL, + MIPS_CB_ALWAYS +}; +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/mips/mips-protos.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/mips/mips-protos.h new file mode 100644 index 0000000..95819ae --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/mips/mips-protos.h @@ -0,0 +1,396 @@ +/* Prototypes of target machine for GNU compiler. MIPS version. + Copyright (C) 1989-2017 Free Software Foundation, Inc. + Contributed by A. Lichnewsky (lich@inria.inria.fr). + Changed by Michael Meissner (meissner@osf.org). + 64-bit r4000 support by Ian Lance Taylor (ian@cygnus.com) and + Brendan Eich (brendan@microunity.com). + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_MIPS_PROTOS_H +#define GCC_MIPS_PROTOS_H + +/* Describes how a symbol is used. + + SYMBOL_CONTEXT_CALL + The symbol is used as the target of a call instruction. + + SYMBOL_CONTEXT_LEA + The symbol is used in a load-address operation. + + SYMBOL_CONTEXT_MEM + The symbol is used as the address in a MEM. */ +enum mips_symbol_context { + SYMBOL_CONTEXT_CALL, + SYMBOL_CONTEXT_LEA, + SYMBOL_CONTEXT_MEM +}; + +/* Classifies a SYMBOL_REF, LABEL_REF or UNSPEC address. + + SYMBOL_ABSOLUTE + The symbol's value will be calculated using absolute relocations, + such as %hi and %lo. + + SYMBOL_GP_RELATIVE + The symbol's value will be calculated by adding a 16-bit offset + from $gp. + + SYMBOL_PC_RELATIVE + The symbol's value will be calculated using a MIPS16 PC-relative + calculation. + + SYMBOL_GOT_PAGE_OFST + The symbol's value will be calculated by loading an address + from the GOT and then applying a 16-bit offset. + + SYMBOL_GOT_DISP + The symbol's value will be loaded directly from the GOT. + + SYMBOL_GOTOFF_PAGE + An UNSPEC wrapper around a SYMBOL_GOT_PAGE_OFST. It represents the + offset from _gp of the GOT entry. + + SYMBOL_GOTOFF_DISP + An UNSPEC wrapper around a SYMBOL_GOT_DISP. It represents the + offset from _gp of the symbol's GOT entry. + + SYMBOL_GOTOFF_CALL + Like SYMBOL_GOTOFF_DISP, but used when calling a global function. + The GOT entry is allowed to point to a stub rather than to the + function itself. + + SYMBOL_GOTOFF_LOADGP + An UNSPEC wrapper around a function's address. It represents the + offset of _gp from the start of the function. + + SYMBOL_TLS + A thread-local symbol. + + SYMBOL_TLSGD + SYMBOL_TLSLDM + SYMBOL_DTPREL + SYMBOL_GOTTPREL + SYMBOL_TPREL + UNSPEC wrappers around SYMBOL_TLS, corresponding to the + thread-local storage relocation operators. + + SYMBOL_64_HIGH + For a 64-bit symbolic address X, this is the value of + (%highest(X) << 16) + %higher(X). + + SYMBOL_64_MID + For a 64-bit symbolic address X, this is the value of + (%higher(X) << 16) + %hi(X). + + SYMBOL_64_LOW + For a 64-bit symbolic address X, this is the value of + (%hi(X) << 16) + %lo(X). + + SYMBOL_HALF + An UNSPEC wrapper around any kind of address. It represents the + low 16 bits of that address. */ +enum mips_symbol_type { + SYMBOL_ABSOLUTE, + SYMBOL_GP_RELATIVE, + SYMBOL_PC_RELATIVE, + SYMBOL_GOT_PAGE_OFST, + SYMBOL_GOT_DISP, + SYMBOL_GOTOFF_PAGE, + SYMBOL_GOTOFF_DISP, + SYMBOL_GOTOFF_CALL, + SYMBOL_GOTOFF_LOADGP, + SYMBOL_TLS, + SYMBOL_TLSGD, + SYMBOL_TLSLDM, + SYMBOL_DTPREL, + SYMBOL_GOTTPREL, + SYMBOL_TPREL, + SYMBOL_64_HIGH, + SYMBOL_64_MID, + SYMBOL_64_LOW, + SYMBOL_HALF +}; +#define NUM_SYMBOL_TYPES (SYMBOL_HALF + 1) + +/* Identifiers a style of $gp initialization sequence. + + LOADGP_NONE + No initialization sequence is needed. + + LOADGP_OLDABI + The o32 and o64 PIC sequence (the kind traditionally generated + by .cpload). + + LOADGP_NEWABI + The n32 and n64 PIC sequence (the kind traditionally generated + by .cpsetup). + + LOADGP_ABSOLUTE + The GNU absolute sequence, as generated by loadgp_absolute. + + LOADGP_RTP + The VxWorks RTP PIC sequence, as generated by loadgp_rtp. */ +enum mips_loadgp_style { + LOADGP_NONE, + LOADGP_OLDABI, + LOADGP_NEWABI, + LOADGP_ABSOLUTE, + LOADGP_RTP +}; + +struct mips16e_save_restore_info; + +/* Classifies a type of call. + + MIPS_CALL_NORMAL + A normal call or call_value pattern. + + MIPS_CALL_SIBCALL + A sibcall or sibcall_value pattern. + + MIPS_CALL_EPILOGUE + A call inserted in the epilogue. */ +enum mips_call_type { + MIPS_CALL_NORMAL, + MIPS_CALL_SIBCALL, + MIPS_CALL_EPILOGUE +}; + +/* Controls the conditions under which certain instructions are split. + + SPLIT_IF_NECESSARY + Only perform splits that are necessary for correctness + (because no unsplit version exists). + + SPLIT_FOR_SPEED + Perform splits that are necessary for correctness or + beneficial for code speed. + + SPLIT_FOR_SIZE + Perform splits that are necessary for correctness or + beneficial for code size. */ +enum mips_split_type { + SPLIT_IF_NECESSARY, + SPLIT_FOR_SPEED, + SPLIT_FOR_SIZE +}; + +extern bool mips_symbolic_constant_p (rtx, enum mips_symbol_context, + enum mips_symbol_type *); +extern int mips_regno_mode_ok_for_base_p (int, machine_mode, bool); +extern bool mips_stack_address_p (rtx, machine_mode); +extern int mips_address_insns (rtx, machine_mode, bool); +extern int mips_const_insns (rtx); +extern int mips_split_const_insns (rtx); +extern int mips_split_128bit_const_insns (rtx); +extern int mips_load_store_insns (rtx, rtx_insn *); +extern int mips_idiv_insns (machine_mode); +extern rtx_insn *mips_emit_move (rtx, rtx); +#ifdef RTX_CODE +extern void mips_emit_binary (enum rtx_code, rtx, rtx, rtx); +#endif +extern rtx mips_pic_base_register (rtx); +extern rtx mips_got_load (rtx, rtx, enum mips_symbol_type); +extern bool mips_split_symbol (rtx, rtx, machine_mode, rtx *); +extern rtx mips_unspec_address (rtx, enum mips_symbol_type); +extern rtx mips_strip_unspec_address (rtx); +extern void mips_move_integer (rtx, rtx, unsigned HOST_WIDE_INT); +extern bool mips_legitimize_move (machine_mode, rtx, rtx); + +extern rtx mips_subword (rtx, bool); +extern bool mips_split_move_p (rtx, rtx, enum mips_split_type); +extern void mips_split_move (rtx, rtx, enum mips_split_type); +extern bool mips_split_move_insn_p (rtx, rtx, rtx); +extern void mips_split_move_insn (rtx, rtx, rtx); +extern void mips_split_128bit_move (rtx, rtx); +extern bool mips_split_128bit_move_p (rtx, rtx); +extern void mips_split_msa_copy_d (rtx, rtx, rtx, rtx (*)(rtx, rtx, rtx)); +extern void mips_split_msa_insert_d (rtx, rtx, rtx, rtx); +extern void mips_split_msa_fill_d (rtx, rtx); +extern const char *mips_output_move (rtx, rtx); +extern bool mips_cfun_has_cprestore_slot_p (void); +extern bool mips_cprestore_address_p (rtx, bool); +extern void mips_save_gp_to_cprestore_slot (rtx, rtx, rtx, rtx); +extern void mips_restore_gp_from_cprestore_slot (rtx); +#ifdef RTX_CODE +extern void mips_expand_scc (rtx *); +extern void mips_expand_conditional_branch (rtx *); +extern void mips_expand_vcondv2sf (rtx, rtx, rtx, enum rtx_code, rtx, rtx); +extern void mips_expand_conditional_move (rtx *); +extern void mips_expand_conditional_trap (rtx); +#endif +extern bool mips_use_pic_fn_addr_reg_p (const_rtx); +extern rtx_insn *mips_expand_call (enum mips_call_type, rtx, rtx, rtx, rtx, + bool); +extern void mips_split_call (rtx, rtx); +extern bool mips_get_pic_call_symbol (rtx *, int); +extern void mips_set_return_address (rtx, rtx); +extern bool mips_move_by_pieces_p (unsigned HOST_WIDE_INT, unsigned int); +extern bool mips_store_by_pieces_p (unsigned HOST_WIDE_INT, unsigned int); +extern bool mips_expand_block_move (rtx, rtx, rtx); +extern void mips_expand_synci_loop (rtx, rtx); + +extern void mips_init_cumulative_args (CUMULATIVE_ARGS *, tree); +extern bool mips_pad_arg_upward (machine_mode, const_tree); +extern bool mips_pad_reg_upward (machine_mode, tree); + +extern bool mips_expand_ext_as_unaligned_load (rtx, rtx, HOST_WIDE_INT, + HOST_WIDE_INT, bool); +extern bool mips_expand_ins_as_unaligned_store (rtx, rtx, HOST_WIDE_INT, + HOST_WIDE_INT); +extern bool mips_mem_fits_mode_p (machine_mode mode, rtx x); +extern HOST_WIDE_INT mips_debugger_offset (rtx, HOST_WIDE_INT); + +extern void mips_push_asm_switch (struct mips_asm_switch *); +extern void mips_pop_asm_switch (struct mips_asm_switch *); +extern void mips_output_external (FILE *, tree, const char *); +extern void mips_output_ascii (FILE *, const char *, size_t); +extern const char *mips_output_tls_reloc_directive (rtx *); +extern void mips_output_aligned_decl_common (FILE *, tree, const char *, + unsigned HOST_WIDE_INT, + unsigned int); +extern void mips_declare_common_object (FILE *, const char *, + const char *, unsigned HOST_WIDE_INT, + unsigned int, bool); +extern void mips_declare_object (FILE *, const char *, const char *, + const char *, ...) ATTRIBUTE_PRINTF_4; +extern void mips_declare_object_name (FILE *, const char *, tree); +extern void mips_finish_declare_object (FILE *, tree, int, int); +extern void mips_set_text_contents_type (FILE *, const char *, + unsigned long, bool); + +extern bool mips_small_data_pattern_p (rtx); +extern rtx mips_rewrite_small_data (rtx); +extern HOST_WIDE_INT mips_initial_elimination_offset (int, int); +extern rtx mips_return_addr (int, rtx); +extern bool mips_must_initialize_gp_p (void); +extern enum mips_loadgp_style mips_current_loadgp_style (void); +extern void mips_emit_save_slot_move (rtx, rtx, rtx); +extern void mips_expand_prologue (void); +extern void mips_expand_before_return (void); +extern void mips_expand_epilogue (bool); +extern bool mips_can_use_return_insn (void); + +extern bool mips_const_vector_same_val_p (rtx, machine_mode); +extern bool mips_const_vector_same_bytes_p (rtx, machine_mode); +extern bool mips_const_vector_same_int_p (rtx, machine_mode, HOST_WIDE_INT, + HOST_WIDE_INT); +extern bool mips_const_vector_shuffle_set_p (rtx, machine_mode); +extern bool mips_const_vector_bitimm_set_p (rtx, machine_mode); +extern bool mips_const_vector_bitimm_clr_p (rtx, machine_mode); +extern rtx mips_msa_vec_parallel_const_half (machine_mode, bool); +extern rtx mips_gen_const_int_vector (machine_mode, HOST_WIDE_INT); +extern bool mips_secondary_memory_needed (enum reg_class, enum reg_class, + machine_mode); +extern bool mips_cannot_change_mode_class (machine_mode, + machine_mode, enum reg_class); +extern bool mips_dangerous_for_la25_p (rtx); +extern bool mips_modes_tieable_p (machine_mode, machine_mode); +extern enum reg_class mips_secondary_reload_class (enum reg_class, + machine_mode, + rtx, bool); +extern int mips_class_max_nregs (enum reg_class, machine_mode); + +extern machine_mode mips_hard_regno_caller_save_mode (unsigned int, + unsigned int, + machine_mode); +extern int mips_adjust_insn_length (rtx_insn *, int); +extern void mips_output_load_label (rtx); +extern const char *mips_output_conditional_branch (rtx_insn *, rtx *, + const char *, const char *); +extern const char *mips_output_order_conditional_branch (rtx_insn *, rtx *, + bool); +extern const char *mips_output_equal_conditional_branch (rtx_insn *, rtx *, + bool); +extern const char *mips_output_jump (rtx *, int, int, bool); +extern const char *mips_output_sync (void); +extern const char *mips_output_sync_loop (rtx_insn *, rtx *); +extern unsigned int mips_sync_loop_insns (rtx_insn *, rtx *); +extern const char *mips_output_division (const char *, rtx *); +extern const char *mips_msa_output_division (const char *, rtx *); +extern const char *mips_output_probe_stack_range (rtx, rtx); +extern bool mips_hard_regno_rename_ok (unsigned int, unsigned int); +extern unsigned int mips_hard_regno_nregs (int, machine_mode); +extern bool mips_linked_madd_p (rtx_insn *, rtx_insn *); +extern bool mips_store_data_bypass_p (rtx_insn *, rtx_insn *); +extern int mips_dspalu_bypass_p (rtx, rtx); +extern rtx mips_prefetch_cookie (rtx, rtx); + +extern const char *current_section_name (void); +extern unsigned int current_section_flags (void); +extern bool mips_use_ins_ext_p (rtx, HOST_WIDE_INT, HOST_WIDE_INT); + +extern const char *mips16e_output_save_restore (rtx, HOST_WIDE_INT); +extern bool mips16e_save_restore_pattern_p (rtx, HOST_WIDE_INT, + struct mips16e_save_restore_info *); + +extern bool mask_low_and_shift_p (machine_mode, rtx, rtx, int); +extern int mask_low_and_shift_len (machine_mode, rtx, rtx); +extern bool and_operands_ok (machine_mode, rtx, rtx); +extern bool mips_fmadd_bypass (rtx_insn *, rtx_insn *); + +union mips_gen_fn_ptrs +{ + rtx (*fn_6) (rtx, rtx, rtx, rtx, rtx, rtx); + rtx (*fn_5) (rtx, rtx, rtx, rtx, rtx); + rtx (*fn_4) (rtx, rtx, rtx, rtx); +}; + +extern void mips_expand_atomic_qihi (union mips_gen_fn_ptrs, + rtx, rtx, rtx, rtx); + +extern void mips_expand_vector_init (rtx, rtx); +extern bool mips_expand_vec_perm_const (rtx op[4]); +extern void mips_expand_vec_unpack (rtx op[2], bool, bool); +extern void mips_expand_vec_reduc (rtx, rtx, rtx (*)(rtx, rtx, rtx)); +extern void mips_expand_vec_minmax (rtx, rtx, rtx, + rtx (*) (rtx, rtx, rtx), bool); + +extern int mips_ldst_scaled_shift (machine_mode); +extern bool mips_signed_immediate_p (unsigned HOST_WIDE_INT, int, int); +extern bool mips_unsigned_immediate_p (unsigned HOST_WIDE_INT, int, int); +extern const char *umips_output_save_restore (bool, rtx); +extern bool umips_save_restore_pattern_p (bool, rtx); +extern bool umips_load_store_pair_p (bool, rtx *); +extern void umips_output_load_store_pair (bool, rtx *); +extern bool umips_movep_target_p (rtx, rtx); +extern bool umips_12bit_offset_address_p (rtx, machine_mode); +extern bool mips_9bit_offset_address_p (rtx, machine_mode); +extern bool lwsp_swsp_address_p (rtx, machine_mode); +extern bool m16_based_address_p (rtx, machine_mode, + int (*)(rtx_def*, machine_mode)); +extern rtx mips_expand_thread_pointer (rtx); +extern void mips16_expand_get_fcsr (rtx); +extern void mips16_expand_set_fcsr (rtx); + +extern bool mips_eh_uses (unsigned int); +extern bool mips_epilogue_uses (unsigned int); +extern void mips_final_prescan_insn (rtx_insn *, rtx *, int); +extern int mips_trampoline_code_size (void); +extern void mips_function_profiler (FILE *); +extern bool mips_load_store_bonding_p (rtx *, machine_mode, bool); + +typedef rtx (*mulsidi3_gen_fn) (rtx, rtx, rtx); +#ifdef RTX_CODE +extern mulsidi3_gen_fn mips_mulsidi3_gen_fn (enum rtx_code); +#endif + +extern void mips_register_frame_header_opt (void); +extern void mips_expand_vec_cond_expr (machine_mode, machine_mode, rtx *); + +#endif /* ! GCC_MIPS_PROTOS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/mips/mips.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/mips/mips.h new file mode 100644 index 0000000..23e1672 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/mips/mips.h @@ -0,0 +1,3469 @@ +/* Definitions of target machine for GNU compiler. MIPS version. + Copyright (C) 1989-2017 Free Software Foundation, Inc. + Contributed by A. Lichnewsky (lich@inria.inria.fr). + Changed by Michael Meissner (meissner@osf.org). + 64-bit r4000 support by Ian Lance Taylor (ian@cygnus.com) and + Brendan Eich (brendan@microunity.com). + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + + +#include "config/vxworks-dummy.h" + +#ifdef GENERATOR_FILE +/* This is used in some insn conditions, so needs to be declared, but + does not need to be defined. */ +extern int target_flags_explicit; +#endif + +/* MIPS external variables defined in mips.c. */ + +/* Which ABI to use. ABI_32 (original 32, or o32), ABI_N32 (n32), + ABI_64 (n64) are all defined by SGI. ABI_O64 is o32 extended + to work on a 64-bit machine. */ + +#define ABI_32 0 +#define ABI_N32 1 +#define ABI_64 2 +#define ABI_EABI 3 +#define ABI_O64 4 + +/* Masks that affect tuning. + + PTF_AVOID_BRANCHLIKELY_SPEED + Set if it is usually not profitable to use branch-likely instructions + for this target when optimizing code for speed, typically because + the branches are always predicted taken and so incur a large overhead + when not taken. + + PTF_AVOID_BRANCHLIKELY_SIZE + As above but when optimizing for size. + + PTF_AVOID_BRANCHLIKELY_ALWAYS + As above but regardless of whether we optimize for speed or size. + + PTF_AVOID_IMADD + Set if it is usually not profitable to use the integer MADD or MSUB + instructions because of the overhead of getting the result out of + the HI/LO registers. */ + +#define PTF_AVOID_BRANCHLIKELY_SPEED 0x1 +#define PTF_AVOID_BRANCHLIKELY_SIZE 0x2 +#define PTF_AVOID_BRANCHLIKELY_ALWAYS (PTF_AVOID_BRANCHLIKELY_SPEED | \ + PTF_AVOID_BRANCHLIKELY_SIZE) +#define PTF_AVOID_IMADD 0x4 + +/* Information about one recognized processor. Defined here for the + benefit of TARGET_CPU_CPP_BUILTINS. */ +struct mips_cpu_info { + /* The 'canonical' name of the processor as far as GCC is concerned. + It's typically a manufacturer's prefix followed by a numerical + designation. It should be lowercase. */ + const char *name; + + /* The internal processor number that most closely matches this + entry. Several processors can have the same value, if there's no + difference between them from GCC's point of view. */ + enum processor cpu; + + /* The ISA level that the processor implements. */ + int isa; + + /* A mask of PTF_* values. */ + unsigned int tune_flags; +}; + +#include "config/mips/mips-opts.h" + +/* Macros to silence warnings about numbers being signed in traditional + C and unsigned in ISO C when compiled on 32-bit hosts. */ + +#define BITMASK_HIGH (((unsigned long)1) << 31) /* 0x80000000 */ +#define BITMASK_UPPER16 ((unsigned long)0xffff << 16) /* 0xffff0000 */ +#define BITMASK_LOWER16 ((unsigned long)0xffff) /* 0x0000ffff */ + + +/* Run-time compilation parameters selecting different hardware subsets. */ + +/* True if we are generating position-independent VxWorks RTP code. */ +#define TARGET_RTP_PIC (TARGET_VXWORKS_RTP && flag_pic) + +/* Compact branches must not be used if the user either selects the + 'never' policy or the 'optimal' policy on a core that lacks + compact branch instructions. */ +#define TARGET_CB_NEVER (mips_cb == MIPS_CB_NEVER \ + || (mips_cb == MIPS_CB_OPTIMAL \ + && !ISA_HAS_COMPACT_BRANCHES)) + +/* Compact branches may be used if the user either selects the + 'always' policy or the 'optimal' policy on a core that supports + compact branch instructions. */ +#define TARGET_CB_MAYBE (TARGET_CB_ALWAYS \ + || (mips_cb == MIPS_CB_OPTIMAL \ + && ISA_HAS_COMPACT_BRANCHES)) + +/* Compact branches must always be generated if the user selects + the 'always' policy or the 'optimal' policy om a core that + lacks delay slot branch instructions. */ +#define TARGET_CB_ALWAYS (mips_cb == MIPS_CB_ALWAYS \ + || (mips_cb == MIPS_CB_OPTIMAL \ + && !ISA_HAS_DELAY_SLOTS)) + +/* Special handling for JRC that exists in microMIPSR3 as well as R6 + ISAs with full compact branch support. */ +#define ISA_HAS_JRC ((ISA_HAS_COMPACT_BRANCHES \ + || TARGET_MICROMIPS) \ + && mips_cb != MIPS_CB_NEVER) + +/* True if the output file is marked as ".abicalls; .option pic0" + (-call_nonpic). */ +#define TARGET_ABICALLS_PIC0 \ + (TARGET_ABSOLUTE_ABICALLS && TARGET_PLT) + +/* True if the output file is marked as ".abicalls; .option pic2" (-KPIC). */ +#define TARGET_ABICALLS_PIC2 \ + (TARGET_ABICALLS && !TARGET_ABICALLS_PIC0) + +/* True if the call patterns should be split into a jalr followed by + an instruction to restore $gp. It is only safe to split the load + from the call when every use of $gp is explicit. + + See mips_must_initialize_gp_p for details about how we manage the + global pointer. */ + +#define TARGET_SPLIT_CALLS \ + (TARGET_EXPLICIT_RELOCS && TARGET_CALL_CLOBBERED_GP && epilogue_completed) + +/* True if we're generating a form of -mabicalls in which we can use + operators like %hi and %lo to refer to locally-binding symbols. + We can only do this for -mno-shared, and only then if we can use + relocation operations instead of assembly macros. It isn't really + worth using absolute sequences for 64-bit symbols because GOT + accesses are so much shorter. */ + +#define TARGET_ABSOLUTE_ABICALLS \ + (TARGET_ABICALLS \ + && !TARGET_SHARED \ + && TARGET_EXPLICIT_RELOCS \ + && !ABI_HAS_64BIT_SYMBOLS) + +/* True if we can optimize sibling calls. For simplicity, we only + handle cases in which call_insn_operand will reject invalid + sibcall addresses. There are two cases in which this isn't true: + + - TARGET_MIPS16. call_insn_operand accepts constant addresses + but there is no direct jump instruction. It isn't worth + using sibling calls in this case anyway; they would usually + be longer than normal calls. + + - TARGET_USE_GOT && !TARGET_EXPLICIT_RELOCS. call_insn_operand + accepts global constants, but all sibcalls must be indirect. */ +#define TARGET_SIBCALLS \ + (!TARGET_MIPS16 && (!TARGET_USE_GOT || TARGET_EXPLICIT_RELOCS)) + +/* True if we need to use a global offset table to access some symbols. */ +#define TARGET_USE_GOT (TARGET_ABICALLS || TARGET_RTP_PIC) + +/* True if TARGET_USE_GOT and if $gp is a call-clobbered register. */ +#define TARGET_CALL_CLOBBERED_GP (TARGET_ABICALLS && TARGET_OLDABI) + +/* True if TARGET_USE_GOT and if $gp is a call-saved register. */ +#define TARGET_CALL_SAVED_GP (TARGET_USE_GOT && !TARGET_CALL_CLOBBERED_GP) + +/* True if we should use .cprestore to store to the cprestore slot. + + We continue to use .cprestore for explicit-reloc code so that JALs + inside inline asms will work correctly. */ +#define TARGET_CPRESTORE_DIRECTIVE \ + (TARGET_ABICALLS_PIC2 && !TARGET_MIPS16) + +/* True if we can use the J and JAL instructions. */ +#define TARGET_ABSOLUTE_JUMPS \ + (!flag_pic || TARGET_ABSOLUTE_ABICALLS) + +/* True if indirect calls must use register class PIC_FN_ADDR_REG. + This is true for both the PIC and non-PIC VxWorks RTP modes. */ +#define TARGET_USE_PIC_FN_ADDR_REG (TARGET_ABICALLS || TARGET_VXWORKS_RTP) + +/* True if .gpword or .gpdword should be used for switch tables. */ +#define TARGET_GPWORD \ + (TARGET_ABICALLS && !TARGET_ABSOLUTE_ABICALLS) + +/* True if the output must have a writable .eh_frame. + See ASM_PREFERRED_EH_DATA_FORMAT for details. */ +#ifdef HAVE_LD_PERSONALITY_RELAXATION +#define TARGET_WRITABLE_EH_FRAME 0 +#else +#define TARGET_WRITABLE_EH_FRAME (flag_pic && TARGET_SHARED) +#endif + +/* Test the assembler to set ISA_HAS_DSP_MULT to DSP Rev 1 or 2. */ +#ifdef HAVE_AS_DSPR1_MULT +#define ISA_HAS_DSP_MULT ISA_HAS_DSP +#else +#define ISA_HAS_DSP_MULT ISA_HAS_DSPR2 +#endif + +/* ISA has LSA available. */ +#define ISA_HAS_LSA (mips_isa_rev >= 6 || ISA_HAS_MSA) + +/* ISA has DLSA available. */ +#define ISA_HAS_DLSA (TARGET_64BIT \ + && (mips_isa_rev >= 6 \ + || ISA_HAS_MSA)) + +/* The ISA compression flags that are currently in effect. */ +#define TARGET_COMPRESSION (target_flags & (MASK_MIPS16 | MASK_MICROMIPS)) + +/* Generate mips16 code */ +#define TARGET_MIPS16 ((target_flags & MASK_MIPS16) != 0) +/* Generate mips16e code. Default 16bit ASE for mips32* and mips64* */ +#define GENERATE_MIPS16E (TARGET_MIPS16 && mips_isa >= 32) +/* Generate mips16e register save/restore sequences. */ +#define GENERATE_MIPS16E_SAVE_RESTORE (GENERATE_MIPS16E && mips_abi == ABI_32) + +/* True if we're generating a form of MIPS16 code in which general + text loads are allowed. */ +#define TARGET_MIPS16_TEXT_LOADS \ + (TARGET_MIPS16 && mips_code_readable == CODE_READABLE_YES) + +/* True if we're generating a form of MIPS16 code in which PC-relative + loads are allowed. */ +#define TARGET_MIPS16_PCREL_LOADS \ + (TARGET_MIPS16 && mips_code_readable >= CODE_READABLE_PCREL) + +/* Generic ISA defines. */ +#define ISA_MIPS1 (mips_isa == 1) +#define ISA_MIPS2 (mips_isa == 2) +#define ISA_MIPS3 (mips_isa == 3) +#define ISA_MIPS4 (mips_isa == 4) +#define ISA_MIPS32 (mips_isa == 32) +#define ISA_MIPS32R2 (mips_isa == 33) +#define ISA_MIPS32R3 (mips_isa == 34) +#define ISA_MIPS32R5 (mips_isa == 36) +#define ISA_MIPS32R6 (mips_isa == 37) +#define ISA_MIPS64 (mips_isa == 64) +#define ISA_MIPS64R2 (mips_isa == 65) +#define ISA_MIPS64R3 (mips_isa == 66) +#define ISA_MIPS64R5 (mips_isa == 68) +#define ISA_MIPS64R6 (mips_isa == 69) + +/* Architecture target defines. */ +#define TARGET_LOONGSON_2E (mips_arch == PROCESSOR_LOONGSON_2E) +#define TARGET_LOONGSON_2F (mips_arch == PROCESSOR_LOONGSON_2F) +#define TARGET_LOONGSON_2EF (TARGET_LOONGSON_2E || TARGET_LOONGSON_2F) +#define TARGET_LOONGSON_3A (mips_arch == PROCESSOR_LOONGSON_3A) +#define TARGET_MIPS3900 (mips_arch == PROCESSOR_R3900) +#define TARGET_MIPS4000 (mips_arch == PROCESSOR_R4000) +#define TARGET_MIPS4120 (mips_arch == PROCESSOR_R4120) +#define TARGET_MIPS4130 (mips_arch == PROCESSOR_R4130) +#define TARGET_MIPS5400 (mips_arch == PROCESSOR_R5400) +#define TARGET_MIPS5500 (mips_arch == PROCESSOR_R5500) +#define TARGET_MIPS5900 (mips_arch == PROCESSOR_R5900) +#define TARGET_MIPS7000 (mips_arch == PROCESSOR_R7000) +#define TARGET_MIPS8000 (mips_arch == PROCESSOR_R8000) +#define TARGET_MIPS9000 (mips_arch == PROCESSOR_R9000) +#define TARGET_OCTEON (mips_arch == PROCESSOR_OCTEON \ + || mips_arch == PROCESSOR_OCTEON2 \ + || mips_arch == PROCESSOR_OCTEON3) +#define TARGET_OCTEON2 (mips_arch == PROCESSOR_OCTEON2 \ + || mips_arch == PROCESSOR_OCTEON3) +#define TARGET_SB1 (mips_arch == PROCESSOR_SB1 \ + || mips_arch == PROCESSOR_SB1A) +#define TARGET_SR71K (mips_arch == PROCESSOR_SR71000) +#define TARGET_XLP (mips_arch == PROCESSOR_XLP) + +/* Scheduling target defines. */ +#define TUNE_20KC (mips_tune == PROCESSOR_20KC) +#define TUNE_24K (mips_tune == PROCESSOR_24KC \ + || mips_tune == PROCESSOR_24KF2_1 \ + || mips_tune == PROCESSOR_24KF1_1) +#define TUNE_74K (mips_tune == PROCESSOR_74KC \ + || mips_tune == PROCESSOR_74KF2_1 \ + || mips_tune == PROCESSOR_74KF1_1 \ + || mips_tune == PROCESSOR_74KF3_2) +#define TUNE_LOONGSON_2EF (mips_tune == PROCESSOR_LOONGSON_2E \ + || mips_tune == PROCESSOR_LOONGSON_2F) +#define TUNE_LOONGSON_3A (mips_tune == PROCESSOR_LOONGSON_3A) +#define TUNE_MIPS3000 (mips_tune == PROCESSOR_R3000) +#define TUNE_MIPS3900 (mips_tune == PROCESSOR_R3900) +#define TUNE_MIPS4000 (mips_tune == PROCESSOR_R4000) +#define TUNE_MIPS4120 (mips_tune == PROCESSOR_R4120) +#define TUNE_MIPS4130 (mips_tune == PROCESSOR_R4130) +#define TUNE_MIPS5000 (mips_tune == PROCESSOR_R5000) +#define TUNE_MIPS5400 (mips_tune == PROCESSOR_R5400) +#define TUNE_MIPS5500 (mips_tune == PROCESSOR_R5500) +#define TUNE_MIPS6000 (mips_tune == PROCESSOR_R6000) +#define TUNE_MIPS7000 (mips_tune == PROCESSOR_R7000) +#define TUNE_MIPS9000 (mips_tune == PROCESSOR_R9000) +#define TUNE_OCTEON (mips_tune == PROCESSOR_OCTEON \ + || mips_tune == PROCESSOR_OCTEON2 \ + || mips_tune == PROCESSOR_OCTEON3) +#define TUNE_SB1 (mips_tune == PROCESSOR_SB1 \ + || mips_tune == PROCESSOR_SB1A) +#define TUNE_P5600 (mips_tune == PROCESSOR_P5600) +#define TUNE_I6400 (mips_tune == PROCESSOR_I6400) + +/* Whether vector modes and intrinsics for ST Microelectronics + Loongson-2E/2F processors should be enabled. In o32 pairs of + floating-point registers provide 64-bit values. */ +#define TARGET_LOONGSON_VECTORS (TARGET_HARD_FLOAT_ABI \ + && (TARGET_LOONGSON_2EF \ + || TARGET_LOONGSON_3A)) + +/* True if the pre-reload scheduler should try to create chains of + multiply-add or multiply-subtract instructions. For example, + suppose we have: + + t1 = a * b + t2 = t1 + c * d + t3 = e * f + t4 = t3 - g * h + + t1 will have a higher priority than t2 and t3 will have a higher + priority than t4. However, before reload, there is no dependence + between t1 and t3, and they can often have similar priorities. + The scheduler will then tend to prefer: + + t1 = a * b + t3 = e * f + t2 = t1 + c * d + t4 = t3 - g * h + + which stops us from making full use of macc/madd-style instructions. + This sort of situation occurs frequently in Fourier transforms and + in unrolled loops. + + To counter this, the TUNE_MACC_CHAINS code will reorder the ready + queue so that chained multiply-add and multiply-subtract instructions + appear ahead of any other instruction that is likely to clobber lo. + In the example above, if t2 and t3 become ready at the same time, + the code ensures that t2 is scheduled first. + + Multiply-accumulate instructions are a bigger win for some targets + than others, so this macro is defined on an opt-in basis. */ +#define TUNE_MACC_CHAINS (TUNE_MIPS5500 \ + || TUNE_MIPS4120 \ + || TUNE_MIPS4130 \ + || TUNE_24K \ + || TUNE_P5600) + +#define TARGET_OLDABI (mips_abi == ABI_32 || mips_abi == ABI_O64) +#define TARGET_NEWABI (mips_abi == ABI_N32 || mips_abi == ABI_64) + +/* TARGET_HARD_FLOAT and TARGET_SOFT_FLOAT reflect whether the FPU is + directly accessible, while the command-line options select + TARGET_HARD_FLOAT_ABI and TARGET_SOFT_FLOAT_ABI to reflect the ABI + in use. */ +#define TARGET_HARD_FLOAT (TARGET_HARD_FLOAT_ABI && !TARGET_MIPS16) +#define TARGET_SOFT_FLOAT (TARGET_SOFT_FLOAT_ABI || TARGET_MIPS16) + +/* TARGET_FLOAT64 represents -mfp64 and TARGET_FLOATXX represents + -mfpxx, derive TARGET_FLOAT32 to represent -mfp32. */ +#define TARGET_FLOAT32 (!TARGET_FLOAT64 && !TARGET_FLOATXX) + +/* TARGET_O32_FP64A_ABI represents all the conditions that form the + o32 FP64A ABI extension (-mabi=32 -mfp64 -mno-odd-spreg). */ +#define TARGET_O32_FP64A_ABI (mips_abi == ABI_32 && TARGET_FLOAT64 \ + && !TARGET_ODD_SPREG) + +/* False if SC acts as a memory barrier with respect to itself, + otherwise a SYNC will be emitted after SC for atomic operations + that require ordering between the SC and following loads and + stores. It does not tell anything about ordering of loads and + stores prior to and following the SC, only about the SC itself and + those loads and stores follow it. */ +#define TARGET_SYNC_AFTER_SC (!TARGET_OCTEON && !TARGET_XLP) + +/* Define preprocessor macros for the -march and -mtune options. + PREFIX is either _MIPS_ARCH or _MIPS_TUNE, INFO is the selected + processor. If INFO's canonical name is "foo", define PREFIX to + be "foo", and define an additional macro PREFIX_FOO. */ +#define MIPS_CPP_SET_PROCESSOR(PREFIX, INFO) \ + do \ + { \ + char *macro, *p; \ + \ + macro = concat ((PREFIX), "_", (INFO)->name, NULL); \ + for (p = macro; *p != 0; p++) \ + if (*p == '+') \ + *p = 'P'; \ + else \ + *p = TOUPPER (*p); \ + \ + builtin_define (macro); \ + builtin_define_with_value ((PREFIX), (INFO)->name, 1); \ + free (macro); \ + } \ + while (0) + +/* Target CPU builtins. */ +#define TARGET_CPU_CPP_BUILTINS() \ + do \ + { \ + builtin_assert ("machine=mips"); \ + builtin_assert ("cpu=mips"); \ + builtin_define ("__mips__"); \ + builtin_define ("_mips"); \ + \ + /* We do this here because __mips is defined below and so we \ + can't use builtin_define_std. We don't ever want to define \ + "mips" for VxWorks because some of the VxWorks headers \ + construct include filenames from a root directory macro, \ + an architecture macro and a filename, where the architecture \ + macro expands to 'mips'. If we define 'mips' to 1, the \ + architecture macro expands to 1 as well. */ \ + if (!flag_iso && !TARGET_VXWORKS) \ + builtin_define ("mips"); \ + \ + if (TARGET_64BIT) \ + builtin_define ("__mips64"); \ + \ + /* Treat _R3000 and _R4000 like register-size \ + defines, which is how they've historically \ + been used. */ \ + if (TARGET_64BIT) \ + { \ + builtin_define_std ("R4000"); \ + builtin_define ("_R4000"); \ + } \ + else \ + { \ + builtin_define_std ("R3000"); \ + builtin_define ("_R3000"); \ + } \ + \ + if (TARGET_FLOAT64) \ + builtin_define ("__mips_fpr=64"); \ + else if (TARGET_FLOATXX) \ + builtin_define ("__mips_fpr=0"); \ + else \ + builtin_define ("__mips_fpr=32"); \ + \ + if (mips_base_compression_flags & MASK_MIPS16) \ + builtin_define ("__mips16"); \ + \ + if (TARGET_MIPS3D) \ + builtin_define ("__mips3d"); \ + \ + if (TARGET_SMARTMIPS) \ + builtin_define ("__mips_smartmips"); \ + \ + if (mips_base_compression_flags & MASK_MICROMIPS) \ + builtin_define ("__mips_micromips"); \ + \ + if (TARGET_MCU) \ + builtin_define ("__mips_mcu"); \ + \ + if (TARGET_EVA) \ + builtin_define ("__mips_eva"); \ + \ + if (TARGET_DSP) \ + { \ + builtin_define ("__mips_dsp"); \ + if (TARGET_DSPR2) \ + { \ + builtin_define ("__mips_dspr2"); \ + builtin_define ("__mips_dsp_rev=2"); \ + } \ + else \ + builtin_define ("__mips_dsp_rev=1"); \ + } \ + \ + if (ISA_HAS_MSA) \ + { \ + builtin_define ("__mips_msa"); \ + builtin_define ("__mips_msa_width=128"); \ + } \ + \ + MIPS_CPP_SET_PROCESSOR ("_MIPS_ARCH", mips_arch_info); \ + MIPS_CPP_SET_PROCESSOR ("_MIPS_TUNE", mips_tune_info); \ + \ + if (ISA_MIPS1) \ + { \ + builtin_define ("__mips=1"); \ + builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS1"); \ + } \ + else if (ISA_MIPS2) \ + { \ + builtin_define ("__mips=2"); \ + builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS2"); \ + } \ + else if (ISA_MIPS3) \ + { \ + builtin_define ("__mips=3"); \ + builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS3"); \ + } \ + else if (ISA_MIPS4) \ + { \ + builtin_define ("__mips=4"); \ + builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS4"); \ + } \ + else if (mips_isa >= 32 && mips_isa < 64) \ + { \ + builtin_define ("__mips=32"); \ + builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS32"); \ + } \ + else if (mips_isa >= 64) \ + { \ + builtin_define ("__mips=64"); \ + builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS64"); \ + } \ + if (mips_isa_rev > 0) \ + builtin_define_with_int_value ("__mips_isa_rev", \ + mips_isa_rev); \ + \ + switch (mips_abi) \ + { \ + case ABI_32: \ + builtin_define ("_ABIO32=1"); \ + builtin_define ("_MIPS_SIM=_ABIO32"); \ + break; \ + \ + case ABI_N32: \ + builtin_define ("_ABIN32=2"); \ + builtin_define ("_MIPS_SIM=_ABIN32"); \ + break; \ + \ + case ABI_64: \ + builtin_define ("_ABI64=3"); \ + builtin_define ("_MIPS_SIM=_ABI64"); \ + break; \ + \ + case ABI_O64: \ + builtin_define ("_ABIO64=4"); \ + builtin_define ("_MIPS_SIM=_ABIO64"); \ + break; \ + } \ + \ + builtin_define_with_int_value ("_MIPS_SZINT", INT_TYPE_SIZE); \ + builtin_define_with_int_value ("_MIPS_SZLONG", LONG_TYPE_SIZE); \ + builtin_define_with_int_value ("_MIPS_SZPTR", POINTER_SIZE); \ + builtin_define_with_int_value ("_MIPS_FPSET", \ + 32 / MAX_FPRS_PER_FMT); \ + builtin_define_with_int_value ("_MIPS_SPFPSET", \ + TARGET_ODD_SPREG ? 32 : 16); \ + \ + /* These defines reflect the ABI in use, not whether the \ + FPU is directly accessible. */ \ + if (TARGET_NO_FLOAT) \ + builtin_define ("__mips_no_float"); \ + else if (TARGET_HARD_FLOAT_ABI) \ + builtin_define ("__mips_hard_float"); \ + else \ + builtin_define ("__mips_soft_float"); \ + \ + if (TARGET_SINGLE_FLOAT) \ + builtin_define ("__mips_single_float"); \ + \ + if (TARGET_PAIRED_SINGLE_FLOAT) \ + builtin_define ("__mips_paired_single_float"); \ + \ + if (mips_abs == MIPS_IEEE_754_2008) \ + builtin_define ("__mips_abs2008"); \ + \ + if (mips_nan == MIPS_IEEE_754_2008) \ + builtin_define ("__mips_nan2008"); \ + \ + if (TARGET_BIG_ENDIAN) \ + { \ + builtin_define_std ("MIPSEB"); \ + builtin_define ("_MIPSEB"); \ + } \ + else \ + { \ + builtin_define_std ("MIPSEL"); \ + builtin_define ("_MIPSEL"); \ + } \ + \ + /* Whether calls should go through $25. The separate __PIC__ \ + macro indicates whether abicalls code might use a GOT. */ \ + if (TARGET_ABICALLS) \ + builtin_define ("__mips_abicalls"); \ + \ + /* Whether Loongson vector modes are enabled. */ \ + if (TARGET_LOONGSON_VECTORS) \ + builtin_define ("__mips_loongson_vector_rev"); \ + \ + /* Historical Octeon macro. */ \ + if (TARGET_OCTEON) \ + builtin_define ("__OCTEON__"); \ + \ + if (TARGET_SYNCI) \ + builtin_define ("__mips_synci"); \ + \ + /* Macros dependent on the C dialect. */ \ + if (preprocessing_asm_p ()) \ + { \ + builtin_define_std ("LANGUAGE_ASSEMBLY"); \ + builtin_define ("_LANGUAGE_ASSEMBLY"); \ + } \ + else if (c_dialect_cxx ()) \ + { \ + builtin_define ("_LANGUAGE_C_PLUS_PLUS"); \ + builtin_define ("__LANGUAGE_C_PLUS_PLUS"); \ + builtin_define ("__LANGUAGE_C_PLUS_PLUS__"); \ + } \ + else \ + { \ + builtin_define_std ("LANGUAGE_C"); \ + builtin_define ("_LANGUAGE_C"); \ + } \ + if (c_dialect_objc ()) \ + { \ + builtin_define ("_LANGUAGE_OBJECTIVE_C"); \ + builtin_define ("__LANGUAGE_OBJECTIVE_C"); \ + /* Bizarre, but retained for backwards compatibility. */ \ + builtin_define_std ("LANGUAGE_C"); \ + builtin_define ("_LANGUAGE_C"); \ + } \ + \ + if (mips_abi == ABI_EABI) \ + builtin_define ("__mips_eabi"); \ + \ + if (TARGET_CACHE_BUILTIN) \ + builtin_define ("__GCC_HAVE_BUILTIN_MIPS_CACHE"); \ + if (!ISA_HAS_LXC1_SXC1) \ + builtin_define ("__mips_no_lxc1_sxc1"); \ + if (!ISA_HAS_UNFUSED_MADD4 && !ISA_HAS_FUSED_MADD4) \ + builtin_define ("__mips_no_madd4"); \ + } \ + while (0) + +/* Default target_flags if no switches are specified */ + +#ifndef TARGET_DEFAULT +#define TARGET_DEFAULT 0 +#endif + +#ifndef TARGET_CPU_DEFAULT +#define TARGET_CPU_DEFAULT 0 +#endif + +#ifndef TARGET_ENDIAN_DEFAULT +#define TARGET_ENDIAN_DEFAULT MASK_BIG_ENDIAN +#endif + +#ifdef IN_LIBGCC2 +#undef TARGET_64BIT +/* Make this compile time constant for libgcc2 */ +#ifdef __mips64 +#define TARGET_64BIT 1 +#else +#define TARGET_64BIT 0 +#endif +#endif /* IN_LIBGCC2 */ + +/* Force the call stack unwinders in unwind.inc not to be MIPS16 code + when compiled with hardware floating point. This is because MIPS16 + code cannot save and restore the floating-point registers, which is + important if in a mixed MIPS16/non-MIPS16 environment. */ + +#ifdef IN_LIBGCC2 +#if __mips_hard_float +#define LIBGCC2_UNWIND_ATTRIBUTE __attribute__((__nomips16__)) +#endif +#endif /* IN_LIBGCC2 */ + +#define TARGET_LIBGCC_SDATA_SECTION ".sdata" + +#ifndef MULTILIB_ENDIAN_DEFAULT +#if TARGET_ENDIAN_DEFAULT == 0 +#define MULTILIB_ENDIAN_DEFAULT "EL" +#else +#define MULTILIB_ENDIAN_DEFAULT "EB" +#endif +#endif + +#ifndef MULTILIB_ISA_DEFAULT +#if MIPS_ISA_DEFAULT == 1 +#define MULTILIB_ISA_DEFAULT "mips1" +#elif MIPS_ISA_DEFAULT == 2 +#define MULTILIB_ISA_DEFAULT "mips2" +#elif MIPS_ISA_DEFAULT == 3 +#define MULTILIB_ISA_DEFAULT "mips3" +#elif MIPS_ISA_DEFAULT == 4 +#define MULTILIB_ISA_DEFAULT "mips4" +#elif MIPS_ISA_DEFAULT == 32 +#define MULTILIB_ISA_DEFAULT "mips32" +#elif MIPS_ISA_DEFAULT == 33 +#define MULTILIB_ISA_DEFAULT "mips32r2" +#elif MIPS_ISA_DEFAULT == 37 +#define MULTILIB_ISA_DEFAULT "mips32r6" +#elif MIPS_ISA_DEFAULT == 64 +#define MULTILIB_ISA_DEFAULT "mips64" +#elif MIPS_ISA_DEFAULT == 65 +#define MULTILIB_ISA_DEFAULT "mips64r2" +#elif MIPS_ISA_DEFAULT == 69 +#define MULTILIB_ISA_DEFAULT "mips64r6" +#else +#define MULTILIB_ISA_DEFAULT "mips1" +#endif +#endif + +#ifndef MIPS_ABI_DEFAULT +#define MIPS_ABI_DEFAULT ABI_32 +#endif + +/* Use the most portable ABI flag for the ASM specs. */ + +#if MIPS_ABI_DEFAULT == ABI_32 +#define MULTILIB_ABI_DEFAULT "mabi=32" +#elif MIPS_ABI_DEFAULT == ABI_O64 +#define MULTILIB_ABI_DEFAULT "mabi=o64" +#elif MIPS_ABI_DEFAULT == ABI_N32 +#define MULTILIB_ABI_DEFAULT "mabi=n32" +#elif MIPS_ABI_DEFAULT == ABI_64 +#define MULTILIB_ABI_DEFAULT "mabi=64" +#elif MIPS_ABI_DEFAULT == ABI_EABI +#define MULTILIB_ABI_DEFAULT "mabi=eabi" +#endif + +#ifndef MULTILIB_DEFAULTS +#define MULTILIB_DEFAULTS \ + { MULTILIB_ENDIAN_DEFAULT, MULTILIB_ISA_DEFAULT, MULTILIB_ABI_DEFAULT } +#endif + +/* We must pass -EL to the linker by default for little endian embedded + targets using linker scripts with a OUTPUT_FORMAT line. Otherwise, the + linker will default to using big-endian output files. The OUTPUT_FORMAT + line must be in the linker script, otherwise -EB/-EL will not work. */ + +#ifndef ENDIAN_SPEC +#if TARGET_ENDIAN_DEFAULT == 0 +#define ENDIAN_SPEC "%{!EB:%{!meb:-EL}} %{EB|meb:-EB}" +#else +#define ENDIAN_SPEC "%{!EL:%{!mel:-EB}} %{EL|mel:-EL}" +#endif +#endif + +/* A spec condition that matches all non-mips16 -mips arguments. */ + +#define MIPS_ISA_LEVEL_OPTION_SPEC \ + "mips1|mips2|mips3|mips4|mips32*|mips64*" + +/* A spec condition that matches all non-mips16 architecture arguments. */ + +#define MIPS_ARCH_OPTION_SPEC \ + MIPS_ISA_LEVEL_OPTION_SPEC "|march=*" + +/* A spec that infers a -mips argument from an -march argument. */ + +#define MIPS_ISA_LEVEL_SPEC \ + "%{" MIPS_ISA_LEVEL_OPTION_SPEC ":;: \ + %{march=mips1|march=r2000|march=r3000|march=r3900:-mips1} \ + %{march=mips2|march=r6000:-mips2} \ + %{march=mips3|march=r4*|march=vr4*|march=orion|march=loongson2*:-mips3} \ + %{march=mips4|march=r8000|march=vr5*|march=rm7000|march=rm9000 \ + |march=r10000|march=r12000|march=r14000|march=r16000:-mips4} \ + %{march=mips32|march=4kc|march=4km|march=4kp|march=4ksc:-mips32} \ + %{march=mips32r2|march=m4k|march=4ke*|march=4ksd|march=24k* \ + |march=34k*|march=74k*|march=m14k*|march=1004k* \ + |march=interaptiv: -mips32r2} \ + %{march=mips32r3: -mips32r3} \ + %{march=mips32r5|march=p5600|march=m5100|march=m5101: -mips32r5} \ + %{march=mips32r6: -mips32r6} \ + %{march=mips64|march=5k*|march=20k*|march=sb1*|march=sr71000 \ + |march=xlr: -mips64} \ + %{march=mips64r2|march=loongson3a|march=octeon|march=xlp: -mips64r2} \ + %{march=mips64r3: -mips64r3} \ + %{march=mips64r5: -mips64r5} \ + %{march=mips64r6|march=i6400: -mips64r6}}" + +/* A spec that injects the default multilib ISA if no architecture is + specified. */ + +#define MIPS_DEFAULT_ISA_LEVEL_SPEC \ + "%{" MIPS_ISA_LEVEL_OPTION_SPEC ":;: \ + %{!march=*: -" MULTILIB_ISA_DEFAULT "}}" + +/* A spec that infers a -mhard-float or -msoft-float setting from an + -march argument. Note that soft-float and hard-float code are not + link-compatible. */ + +#define MIPS_ARCH_FLOAT_SPEC \ + "%{mhard-float|msoft-float|mno-float|march=mips*:; \ + march=vr41*|march=m4k|march=4k*|march=24kc|march=24kec \ + |march=34kc|march=34kn|march=74kc|march=1004kc|march=5kc \ + |march=m14k*|march=m5101|march=octeon|march=xlr: -msoft-float; \ + march=*: -mhard-float}" + +/* A spec condition that matches 32-bit options. It only works if + MIPS_ISA_LEVEL_SPEC has been applied. */ + +#define MIPS_32BIT_OPTION_SPEC \ + "mips1|mips2|mips32*|mgp32" + +/* A spec condition that matches architectures should be targeted with + o32 FPXX for compatibility reasons. */ +#define MIPS_FPXX_OPTION_SPEC \ + "mips2|mips3|mips4|mips5|mips32|mips32r2|mips32r3|mips32r5| \ + mips64|mips64r2|mips64r3|mips64r5" + +/* Infer a -msynci setting from a -mips argument, on the assumption that + -msynci is desired where possible. */ +#define MIPS_ISA_SYNCI_SPEC \ + "%{msynci|mno-synci:;:%{mips32r2|mips32r3|mips32r5|mips32r6|mips64r2 \ + |mips64r3|mips64r5|mips64r6:-msynci;:-mno-synci}}" + +/* Infer a -mnan=2008 setting from a -mips argument. */ +#define MIPS_ISA_NAN2008_SPEC \ + "%{mnan*:;mips32r6|mips64r6:-mnan=2008;march=m51*: \ + %{!msoft-float:-mnan=2008}}" + +#if (MIPS_ABI_DEFAULT == ABI_O64 \ + || MIPS_ABI_DEFAULT == ABI_N32 \ + || MIPS_ABI_DEFAULT == ABI_64) +#define OPT_ARCH64 "mabi=32|mgp32:;" +#define OPT_ARCH32 "mabi=32|mgp32" +#else +#define OPT_ARCH64 "mabi=o64|mabi=n32|mabi=64|mgp64" +#define OPT_ARCH32 "mabi=o64|mabi=n32|mabi=64|mgp64:;" +#endif + +/* Support for a compile-time default CPU, et cetera. The rules are: + --with-arch is ignored if -march is specified or a -mips is specified + (other than -mips16); likewise --with-arch-32 and --with-arch-64. + --with-tune is ignored if -mtune is specified; likewise + --with-tune-32 and --with-tune-64. + --with-abi is ignored if -mabi is specified. + --with-float is ignored if -mhard-float or -msoft-float are + specified. + --with-fpu is ignored if -msoft-float, -msingle-float or -mdouble-float are + specified. + --with-nan is ignored if -mnan is specified. + --with-fp-32 is ignored if -msoft-float, -msingle-float, -mmsa or -mfp are + specified. + --with-odd-spreg-32 is ignored if -msoft-float, -msingle-float, -modd-spreg + or -mno-odd-spreg are specified. + --with-divide is ignored if -mdivide-traps or -mdivide-breaks are + specified. */ +#define OPTION_DEFAULT_SPECS \ + {"arch", "%{" MIPS_ARCH_OPTION_SPEC ":;: -march=%(VALUE)}" }, \ + {"arch_32", "%{" OPT_ARCH32 ":%{" MIPS_ARCH_OPTION_SPEC ":;: -march=%(VALUE)}}" }, \ + {"arch_64", "%{" OPT_ARCH64 ":%{" MIPS_ARCH_OPTION_SPEC ":;: -march=%(VALUE)}}" }, \ + {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \ + {"tune_32", "%{" OPT_ARCH32 ":%{!mtune=*:-mtune=%(VALUE)}}" }, \ + {"tune_64", "%{" OPT_ARCH64 ":%{!mtune=*:-mtune=%(VALUE)}}" }, \ + {"abi", "%{!mabi=*:-mabi=%(VALUE)}" }, \ + {"float", "%{!msoft-float:%{!mhard-float:-m%(VALUE)-float}}" }, \ + {"fpu", "%{!msoft-float:%{!msingle-float:%{!mdouble-float:-m%(VALUE)-float}}}" }, \ + {"nan", "%{!mnan=*:-mnan=%(VALUE)}" }, \ + {"fp_32", "%{" OPT_ARCH32 \ + ":%{!msoft-float:%{!msingle-float:%{!mfp*:%{!mmsa:-mfp%(VALUE)}}}}}" }, \ + {"odd_spreg_32", "%{" OPT_ARCH32 ":%{!msoft-float:%{!msingle-float:" \ + "%{!modd-spreg:%{!mno-odd-spreg:-m%(VALUE)}}}}}" }, \ + {"divide", "%{!mdivide-traps:%{!mdivide-breaks:-mdivide-%(VALUE)}}" }, \ + {"llsc", "%{!mllsc:%{!mno-llsc:-m%(VALUE)}}" }, \ + {"mips-plt", "%{!mplt:%{!mno-plt:-m%(VALUE)}}" }, \ + {"synci", "%{!msynci:%{!mno-synci:-m%(VALUE)}}" }, \ + {"lxc1-sxc1", "%{!mlxc1-sxc1:%{!mno-lxc1-sxc1:-m%(VALUE)}}" }, \ + {"madd4", "%{!mmadd4:%{!mno-madd4:-m%(VALUE)}}" } \ + +/* A spec that infers the: + -mnan=2008 setting from a -mips argument, + -mdsp setting from a -march argument. */ +#define BASE_DRIVER_SELF_SPECS \ + MIPS_ISA_NAN2008_SPEC, \ + "%{!mno-dsp: \ + %{march=24ke*|march=34kc*|march=34kf*|march=34kx*|march=1004k* \ + |march=interaptiv: -mdsp} \ + %{march=74k*|march=m14ke*: %{!mno-dspr2: -mdspr2 -mdsp}}}" + +#define DRIVER_SELF_SPECS \ + MIPS_ISA_LEVEL_SPEC, \ + BASE_DRIVER_SELF_SPECS + +#define GENERATE_DIVIDE_TRAPS (TARGET_DIVIDE_TRAPS \ + && ISA_HAS_COND_TRAP) + +#define GENERATE_BRANCHLIKELY (TARGET_BRANCHLIKELY && !TARGET_MIPS16) + +/* True if the ABI can only work with 64-bit integer registers. We + generally allow ad-hoc variations for TARGET_SINGLE_FLOAT, but + otherwise floating-point registers must also be 64-bit. */ +#define ABI_NEEDS_64BIT_REGS (TARGET_NEWABI || mips_abi == ABI_O64) + +/* Likewise for 32-bit regs. */ +#define ABI_NEEDS_32BIT_REGS (mips_abi == ABI_32) + +/* True if the file format uses 64-bit symbols. At present, this is + only true for n64, which uses 64-bit ELF. */ +#define FILE_HAS_64BIT_SYMBOLS (mips_abi == ABI_64) + +/* True if symbols are 64 bits wide. This is usually determined by + the ABI's file format, but it can be overridden by -msym32. Note that + overriding the size with -msym32 changes the ABI of relocatable objects, + although it doesn't change the ABI of a fully-linked object. */ +#define ABI_HAS_64BIT_SYMBOLS (FILE_HAS_64BIT_SYMBOLS \ + && Pmode == DImode \ + && !TARGET_SYM32) + +/* ISA has instructions for managing 64-bit fp and gp regs (e.g. mips3). */ +#define ISA_HAS_64BIT_REGS (ISA_MIPS3 \ + || ISA_MIPS4 \ + || ISA_MIPS64 \ + || ISA_MIPS64R2 \ + || ISA_MIPS64R3 \ + || ISA_MIPS64R5 \ + || ISA_MIPS64R6) + +#define ISA_HAS_JR (mips_isa_rev <= 5) + +#define ISA_HAS_DELAY_SLOTS 1 + +#define ISA_HAS_COMPACT_BRANCHES (mips_isa_rev >= 6) + +/* ISA has branch likely instructions (e.g. mips2). */ +/* Disable branchlikely for tx39 until compare rewrite. They haven't + been generated up to this point. */ +#define ISA_HAS_BRANCHLIKELY (!ISA_MIPS1 && mips_isa_rev <= 5) + +/* ISA has 32 single-precision registers. */ +#define ISA_HAS_ODD_SPREG ((mips_isa_rev >= 1 \ + && !TARGET_LOONGSON_3A) \ + || TARGET_FLOAT64 \ + || TARGET_MIPS5900) + +/* ISA has a three-operand multiplication instruction (usually spelt "mul"). */ +#define ISA_HAS_MUL3 ((TARGET_MIPS3900 \ + || TARGET_MIPS5400 \ + || TARGET_MIPS5500 \ + || TARGET_MIPS5900 \ + || TARGET_MIPS7000 \ + || TARGET_MIPS9000 \ + || TARGET_MAD \ + || (mips_isa_rev >= 1 \ + && mips_isa_rev <= 5)) \ + && !TARGET_MIPS16) + +/* ISA has a three-operand multiplication instruction. */ +#define ISA_HAS_DMUL3 (TARGET_64BIT \ + && TARGET_OCTEON \ + && !TARGET_MIPS16) + +/* ISA has HI and LO registers. */ +#define ISA_HAS_HILO (mips_isa_rev <= 5) + +/* ISA supports instructions DMULT and DMULTU. */ +#define ISA_HAS_DMULT (TARGET_64BIT \ + && !TARGET_MIPS5900 \ + && mips_isa_rev <= 5) + +/* ISA supports instructions MULT and MULTU. */ +#define ISA_HAS_MULT (mips_isa_rev <= 5) + +/* ISA supports instructions MUL, MULU, MUH, MUHU. */ +#define ISA_HAS_R6MUL (mips_isa_rev >= 6) + +/* ISA supports instructions DMUL, DMULU, DMUH, DMUHU. */ +#define ISA_HAS_R6DMUL (TARGET_64BIT && mips_isa_rev >= 6) + +/* For Loongson, it is preferable to use the Loongson-specific division and + modulo instructions instead of the regular (D)DIV(U) instruction, + because the former are faster and can also have the effect of reducing + code size. */ +#define ISA_AVOID_DIV_HILO ((TARGET_LOONGSON_2EF \ + || TARGET_LOONGSON_3A) \ + && !TARGET_MIPS16) + +/* ISA supports instructions DDIV and DDIVU. */ +#define ISA_HAS_DDIV (TARGET_64BIT \ + && !TARGET_MIPS5900 \ + && !ISA_AVOID_DIV_HILO \ + && mips_isa_rev <= 5) + +/* ISA supports instructions DIV and DIVU. + This is always true, but the macro is needed for ISA_HAS_DIV + in mips.md. */ +#define ISA_HAS_DIV (!ISA_AVOID_DIV_HILO \ + && mips_isa_rev <= 5) + +/* ISA supports instructions DIV, DIVU, MOD and MODU. */ +#define ISA_HAS_R6DIV (mips_isa_rev >= 6) + +/* ISA supports instructions DDIV, DDIVU, DMOD and DMODU. */ +#define ISA_HAS_R6DDIV (TARGET_64BIT && mips_isa_rev >= 6) + +/* ISA has the floating-point conditional move instructions introduced + in mips4. */ +#define ISA_HAS_FP_CONDMOVE ((ISA_MIPS4 \ + || (mips_isa_rev >= 1 \ + && mips_isa_rev <= 5)) \ + && !TARGET_MIPS5500 \ + && !TARGET_MIPS16) + +/* ISA has the integer conditional move instructions introduced in mips4 and + ST Loongson 2E/2F. */ +#define ISA_HAS_CONDMOVE (ISA_HAS_FP_CONDMOVE \ + || TARGET_MIPS5900 \ + || TARGET_LOONGSON_2EF) + +/* ISA has LDC1 and SDC1. */ +#define ISA_HAS_LDC1_SDC1 (!ISA_MIPS1 \ + && !TARGET_MIPS5900 \ + && !TARGET_MIPS16) + +/* ISA has the mips4 FP condition code instructions: FP-compare to CC, + branch on CC, and move (both FP and non-FP) on CC. */ +#define ISA_HAS_8CC (ISA_MIPS4 \ + || (mips_isa_rev >= 1 \ + && mips_isa_rev <= 5)) + +/* ISA has the FP condition code instructions that store the flag in an + FP register. */ +#define ISA_HAS_CCF (mips_isa_rev >= 6) + +#define ISA_HAS_SEL (mips_isa_rev >= 6) + +/* This is a catch all for other mips4 instructions: indexed load, the + FP madd and msub instructions, and the FP recip and recip sqrt + instructions. Note that this macro should only be used by other + ISA_HAS_* macros. */ +#define ISA_HAS_FP4 ((ISA_MIPS4 \ + || ISA_MIPS64 \ + || (mips_isa_rev >= 2 \ + && mips_isa_rev <= 5)) \ + && !TARGET_MIPS16) + +/* ISA has floating-point indexed load and store instructions + (LWXC1, LDXC1, SWXC1 and SDXC1). */ +#define ISA_HAS_LXC1_SXC1 (ISA_HAS_FP4 \ + && mips_lxc1_sxc1) + +/* ISA has paired-single instructions. */ +#define ISA_HAS_PAIRED_SINGLE ((ISA_MIPS64 \ + || (mips_isa_rev >= 2 \ + && mips_isa_rev <= 5)) \ + && !TARGET_OCTEON) + +/* ISA has conditional trap instructions. */ +#define ISA_HAS_COND_TRAP (!ISA_MIPS1 \ + && !TARGET_MIPS16) + +/* ISA has conditional trap with immediate instructions. */ +#define ISA_HAS_COND_TRAPI (!ISA_MIPS1 \ + && mips_isa_rev <= 5 \ + && !TARGET_MIPS16) + +/* ISA has integer multiply-accumulate instructions, madd and msub. */ +#define ISA_HAS_MADD_MSUB (mips_isa_rev >= 1 \ + && mips_isa_rev <= 5) + +/* Integer multiply-accumulate instructions should be generated. */ +#define GENERATE_MADD_MSUB (TARGET_IMADD && !TARGET_MIPS16) + +/* ISA has 4 operand fused madd instructions of the form + 'd = [+-] (a * b [+-] c)'. */ +#define ISA_HAS_FUSED_MADD4 (mips_madd4 \ + && (TARGET_MIPS8000 \ + || TARGET_LOONGSON_3A)) + +/* ISA has 4 operand unfused madd instructions of the form + 'd = [+-] (a * b [+-] c)'. */ +#define ISA_HAS_UNFUSED_MADD4 (mips_madd4 \ + && ISA_HAS_FP4 \ + && !TARGET_MIPS8000 \ + && !TARGET_LOONGSON_3A) + +/* ISA has 3 operand r6 fused madd instructions of the form + 'c = c [+-] (a * b)'. */ +#define ISA_HAS_FUSED_MADDF (mips_isa_rev >= 6) + +/* ISA has 3 operand loongson fused madd instructions of the form + 'c = [+-] (a * b [+-] c)'. */ +#define ISA_HAS_FUSED_MADD3 TARGET_LOONGSON_2EF + +/* ISA has floating-point RECIP.fmt and RSQRT.fmt instructions. The + MIPS64 rev. 1 ISA says that RECIP.D and RSQRT.D are unpredictable when + doubles are stored in pairs of FPRs, so for safety's sake, we apply + this restriction to the MIPS IV ISA too. */ +#define ISA_HAS_FP_RECIP_RSQRT(MODE) \ + (((ISA_HAS_FP4 \ + && ((MODE) == SFmode \ + || ((TARGET_FLOAT64 \ + || mips_isa_rev >= 2) \ + && (MODE) == DFmode))) \ + || (((MODE) == SFmode \ + || (MODE) == DFmode) \ + && (mips_isa_rev >= 6)) \ + || (TARGET_SB1 \ + && (MODE) == V2SFmode)) \ + && !TARGET_MIPS16) + +#define ISA_HAS_LWL_LWR (mips_isa_rev <= 5 && !TARGET_MIPS16) + +#define ISA_HAS_IEEE_754_LEGACY (mips_isa_rev <= 5) + +#define ISA_HAS_IEEE_754_2008 (mips_isa_rev >= 2) + +/* ISA has count leading zeroes/ones instruction (not implemented). */ +#define ISA_HAS_CLZ_CLO (mips_isa_rev >= 1 && !TARGET_MIPS16) + +/* ISA has three operand multiply instructions that put + the high part in an accumulator: mulhi or mulhiu. */ +#define ISA_HAS_MULHI ((TARGET_MIPS5400 \ + || TARGET_MIPS5500 \ + || TARGET_SR71K) \ + && !TARGET_MIPS16) + +/* ISA has three operand multiply instructions that negate the + result and put the result in an accumulator. */ +#define ISA_HAS_MULS ((TARGET_MIPS5400 \ + || TARGET_MIPS5500 \ + || TARGET_SR71K) \ + && !TARGET_MIPS16) + +/* ISA has three operand multiply instructions that subtract the + result from a 4th operand and put the result in an accumulator. */ +#define ISA_HAS_MSAC ((TARGET_MIPS5400 \ + || TARGET_MIPS5500 \ + || TARGET_SR71K) \ + && !TARGET_MIPS16) + +/* ISA has three operand multiply instructions that add the result + to a 4th operand and put the result in an accumulator. */ +#define ISA_HAS_MACC ((TARGET_MIPS4120 \ + || TARGET_MIPS4130 \ + || TARGET_MIPS5400 \ + || TARGET_MIPS5500 \ + || TARGET_SR71K) \ + && !TARGET_MIPS16) + +/* ISA has NEC VR-style MACC, MACCHI, DMACC and DMACCHI instructions. */ +#define ISA_HAS_MACCHI ((TARGET_MIPS4120 \ + || TARGET_MIPS4130) \ + && !TARGET_MIPS16) + +/* ISA has the "ror" (rotate right) instructions. */ +#define ISA_HAS_ROR ((mips_isa_rev >= 2 \ + || TARGET_MIPS5400 \ + || TARGET_MIPS5500 \ + || TARGET_SR71K \ + || TARGET_SMARTMIPS) \ + && !TARGET_MIPS16) + +/* ISA has the WSBH (word swap bytes within halfwords) instruction. + 64-bit targets also provide DSBH and DSHD. */ +#define ISA_HAS_WSBH (mips_isa_rev >= 2 && !TARGET_MIPS16) + +/* ISA has data prefetch instructions. This controls use of 'pref'. */ +#define ISA_HAS_PREFETCH ((ISA_MIPS4 \ + || TARGET_LOONGSON_2EF \ + || TARGET_MIPS5900 \ + || mips_isa_rev >= 1) \ + && !TARGET_MIPS16) + +/* ISA has data prefetch, LL and SC with limited 9-bit displacement. */ +#define ISA_HAS_9BIT_DISPLACEMENT (mips_isa_rev >= 6) + +/* ISA has data indexed prefetch instructions. This controls use of + 'prefx', along with TARGET_HARD_FLOAT and TARGET_DOUBLE_FLOAT. + (prefx is a cop1x instruction, so can only be used if FP is + enabled.) */ +#define ISA_HAS_PREFETCHX ISA_HAS_FP4 + +/* True if trunc.w.s and trunc.w.d are real (not synthetic) + instructions. Both require TARGET_HARD_FLOAT, and trunc.w.d + also requires TARGET_DOUBLE_FLOAT. */ +#define ISA_HAS_TRUNC_W (!ISA_MIPS1) + +/* ISA includes the MIPS32r2 seb and seh instructions. */ +#define ISA_HAS_SEB_SEH (mips_isa_rev >= 2 && !TARGET_MIPS16) + +/* ISA includes the MIPS32/64 rev 2 ext and ins instructions. */ +#define ISA_HAS_EXT_INS (mips_isa_rev >= 2 && !TARGET_MIPS16) + +/* ISA has instructions for accessing top part of 64-bit fp regs. */ +#define ISA_HAS_MXHC1 (!TARGET_FLOAT32 \ + && mips_isa_rev >= 2) + +/* ISA has lwxs instruction (load w/scaled index address. */ +#define ISA_HAS_LWXS ((TARGET_SMARTMIPS || TARGET_MICROMIPS) \ + && !TARGET_MIPS16) + +/* ISA has lbx, lbux, lhx, lhx, lhux, lwx, lwux, or ldx instruction. */ +#define ISA_HAS_LBX (TARGET_OCTEON2) +#define ISA_HAS_LBUX (ISA_HAS_DSP || TARGET_OCTEON2) +#define ISA_HAS_LHX (ISA_HAS_DSP || TARGET_OCTEON2) +#define ISA_HAS_LHUX (TARGET_OCTEON2) +#define ISA_HAS_LWX (ISA_HAS_DSP || TARGET_OCTEON2) +#define ISA_HAS_LWUX (TARGET_OCTEON2 && TARGET_64BIT) +#define ISA_HAS_LDX ((ISA_HAS_DSP || TARGET_OCTEON2) \ + && TARGET_64BIT) + +/* The DSP ASE is available. */ +#define ISA_HAS_DSP (TARGET_DSP && !TARGET_MIPS16) + +/* Revision 2 of the DSP ASE is available. */ +#define ISA_HAS_DSPR2 (TARGET_DSPR2 && !TARGET_MIPS16) + +/* The MSA ASE is available. */ +#define ISA_HAS_MSA (TARGET_MSA && !TARGET_MIPS16) + +/* True if the result of a load is not available to the next instruction. + A nop will then be needed between instructions like "lw $4,..." + and "addiu $4,$4,1". */ +#define ISA_HAS_LOAD_DELAY (ISA_MIPS1 \ + && !TARGET_MIPS3900 \ + && !TARGET_MIPS5900 \ + && !TARGET_MIPS16 \ + && !TARGET_MICROMIPS) + +/* Likewise mtc1 and mfc1. */ +#define ISA_HAS_XFER_DELAY (mips_isa <= 3 \ + && !TARGET_MIPS5900 \ + && !TARGET_LOONGSON_2EF) + +/* Likewise floating-point comparisons. */ +#define ISA_HAS_FCMP_DELAY (mips_isa <= 3 \ + && !TARGET_MIPS5900 \ + && !TARGET_LOONGSON_2EF) + +/* True if mflo and mfhi can be immediately followed by instructions + which write to the HI and LO registers. + + According to MIPS specifications, MIPS ISAs I, II, and III need + (at least) two instructions between the reads of HI/LO and + instructions which write them, and later ISAs do not. Contradicting + the MIPS specifications, some MIPS IV processor user manuals (e.g. + the UM for the NEC Vr5000) document needing the instructions between + HI/LO reads and writes, as well. Therefore, we declare only MIPS32, + MIPS64 and later ISAs to have the interlocks, plus any specific + earlier-ISA CPUs for which CPU documentation declares that the + instructions are really interlocked. */ +#define ISA_HAS_HILO_INTERLOCKS (mips_isa_rev >= 1 \ + || TARGET_MIPS5500 \ + || TARGET_MIPS5900 \ + || TARGET_LOONGSON_2EF) + +/* ISA includes synci, jr.hb and jalr.hb. */ +#define ISA_HAS_SYNCI (mips_isa_rev >= 2 && !TARGET_MIPS16) + +/* ISA includes sync. */ +#define ISA_HAS_SYNC ((mips_isa >= 2 || TARGET_MIPS3900) && !TARGET_MIPS16) +#define GENERATE_SYNC \ + (target_flags_explicit & MASK_LLSC \ + ? TARGET_LLSC && !TARGET_MIPS16 \ + : ISA_HAS_SYNC) + +/* ISA includes ll and sc. Note that this implies ISA_HAS_SYNC + because the expanders use both ISA_HAS_SYNC and ISA_HAS_LL_SC + instructions. */ +#define ISA_HAS_LL_SC (mips_isa >= 2 && !TARGET_MIPS5900 && !TARGET_MIPS16) +#define GENERATE_LL_SC \ + (target_flags_explicit & MASK_LLSC \ + ? TARGET_LLSC && !TARGET_MIPS16 \ + : ISA_HAS_LL_SC) + +#define ISA_HAS_SWAP (TARGET_XLP) +#define ISA_HAS_LDADD (TARGET_XLP) + +/* ISA includes the baddu instruction. */ +#define ISA_HAS_BADDU (TARGET_OCTEON && !TARGET_MIPS16) + +/* ISA includes the bbit* instructions. */ +#define ISA_HAS_BBIT (TARGET_OCTEON && !TARGET_MIPS16) + +/* ISA includes the cins instruction. */ +#define ISA_HAS_CINS (TARGET_OCTEON && !TARGET_MIPS16) + +/* ISA includes the exts instruction. */ +#define ISA_HAS_EXTS (TARGET_OCTEON && !TARGET_MIPS16) + +/* ISA includes the seq and sne instructions. */ +#define ISA_HAS_SEQ_SNE (TARGET_OCTEON && !TARGET_MIPS16) + +/* ISA includes the pop instruction. */ +#define ISA_HAS_POP (TARGET_OCTEON && !TARGET_MIPS16) + +/* The CACHE instruction is available in non-MIPS16 code. */ +#define TARGET_CACHE_BUILTIN (mips_isa >= 3) + +/* The CACHE instruction is available. */ +#define ISA_HAS_CACHE (TARGET_CACHE_BUILTIN && !TARGET_MIPS16) + +/* Tell collect what flags to pass to nm. */ +#ifndef NM_FLAGS +#define NM_FLAGS "-Bn" +#endif + + +/* SUBTARGET_ASM_DEBUGGING_SPEC handles passing debugging options to + the assembler. It may be overridden by subtargets. + + Beginning with gas 2.13, -mdebug must be passed to correctly handle + COFF debugging info. */ + +#ifndef SUBTARGET_ASM_DEBUGGING_SPEC +#define SUBTARGET_ASM_DEBUGGING_SPEC "\ +%{g} %{g0} %{g1} %{g2} %{g3} \ +%{ggdb:-g} %{ggdb0:-g0} %{ggdb1:-g1} %{ggdb2:-g2} %{ggdb3:-g3} \ +%{gstabs:-g} %{gstabs0:-g0} %{gstabs1:-g1} %{gstabs2:-g2} %{gstabs3:-g3} \ +%{gstabs+:-g} %{gstabs+0:-g0} %{gstabs+1:-g1} %{gstabs+2:-g2} %{gstabs+3:-g3} \ +%{gcoff:-g} %{gcoff0:-g0} %{gcoff1:-g1} %{gcoff2:-g2} %{gcoff3:-g3} \ +%{gcoff*:-mdebug} %{!gcoff*:-no-mdebug}" +#endif + +/* FP_ASM_SPEC represents the floating-point options that must be passed + to the assembler when FPXX support exists. Prior to that point the + assembler could accept the options but were not required for + correctness. We only add the options when absolutely necessary + because passing -msoft-float to the assembler will cause it to reject + all hard-float instructions which may require some user code to be + updated. */ + +#ifdef HAVE_AS_DOT_MODULE +#define FP_ASM_SPEC "\ +%{mhard-float} %{msoft-float} \ +%{msingle-float} %{mdouble-float}" +#else +#define FP_ASM_SPEC +#endif + +/* SUBTARGET_ASM_SPEC is always passed to the assembler. It may be + overridden by subtargets. */ + +#ifndef SUBTARGET_ASM_SPEC +#define SUBTARGET_ASM_SPEC "" +#endif + +#undef ASM_SPEC +#define ASM_SPEC "\ +%{G*} %(endian_spec) %{mips1} %{mips2} %{mips3} %{mips4} \ +%{mips32*} %{mips64*} \ +%{mips16} %{mno-mips16:-no-mips16} \ +%{mmicromips} %{mno-micromips} \ +%{mips3d} %{mno-mips3d:-no-mips3d} \ +%{mdmx} %{mno-mdmx:-no-mdmx} \ +%{mdsp} %{mno-dsp} \ +%{mdspr2} %{mno-dspr2} \ +%{mmcu} %{mno-mcu} \ +%{meva} %{mno-eva} \ +%{mvirt} %{mno-virt} \ +%{mxpa} %{mno-xpa} \ +%{mmsa} %{mno-msa} \ +%{msmartmips} %{mno-smartmips} \ +%{mmt} %{mno-mt} \ +%{mfix-rm7000} %{mno-fix-rm7000} \ +%{mfix-vr4120} %{mfix-vr4130} \ +%{mfix-24k} \ +%{noasmopt:-O0; O0|fno-delayed-branch:-O1; O*:-O2; :-O1} \ +%(subtarget_asm_debugging_spec) \ +%{mabi=*} %{!mabi=*: %(asm_abi_default_spec)} \ +%{mgp32} %{mgp64} %{march=*} %{mxgot:-xgot} \ +%{mfp32} %{mfpxx} %{mfp64} %{mnan=*} \ +%{modd-spreg} %{mno-odd-spreg} \ +%{mshared} %{mno-shared} \ +%{msym32} %{mno-sym32} \ +%{mtune=*}" \ +FP_ASM_SPEC "\ +%(subtarget_asm_spec)" + +/* Extra switches sometimes passed to the linker. */ + +#ifndef LINK_SPEC +#define LINK_SPEC "\ +%(endian_spec) \ +%{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32*} %{mips64*} \ +%{shared}" +#endif /* LINK_SPEC defined */ + + +/* Specs for the compiler proper */ + +/* SUBTARGET_CC1_SPEC is passed to the compiler proper. It may be + overridden by subtargets. */ +#ifndef SUBTARGET_CC1_SPEC +#define SUBTARGET_CC1_SPEC "" +#endif + +/* CC1_SPEC is the set of arguments to pass to the compiler proper. */ + +#undef CC1_SPEC +#define CC1_SPEC "\ +%{G*} %{EB:-meb} %{EL:-mel} %{EB:%{EL:%emay not use both -EB and -EL}} \ +%(subtarget_cc1_spec)" + +/* Preprocessor specs. */ + +/* SUBTARGET_CPP_SPEC is passed to the preprocessor. It may be + overridden by subtargets. */ +#ifndef SUBTARGET_CPP_SPEC +#define SUBTARGET_CPP_SPEC "" +#endif + +#define CPP_SPEC "%(subtarget_cpp_spec)" + +/* This macro defines names of additional specifications to put in the specs + that can be used in various specifications like CC1_SPEC. Its definition + is an initializer with a subgrouping for each command option. + + Each subgrouping contains a string constant, that defines the + specification name, and a string constant that used by the GCC driver + program. + + Do not define this macro if it does not need to do anything. */ + +#define EXTRA_SPECS \ + { "subtarget_cc1_spec", SUBTARGET_CC1_SPEC }, \ + { "subtarget_cpp_spec", SUBTARGET_CPP_SPEC }, \ + { "subtarget_asm_debugging_spec", SUBTARGET_ASM_DEBUGGING_SPEC }, \ + { "subtarget_asm_spec", SUBTARGET_ASM_SPEC }, \ + { "asm_abi_default_spec", "-" MULTILIB_ABI_DEFAULT }, \ + { "endian_spec", ENDIAN_SPEC }, \ + SUBTARGET_EXTRA_SPECS + +#ifndef SUBTARGET_EXTRA_SPECS +#define SUBTARGET_EXTRA_SPECS +#endif + +#define DBX_DEBUGGING_INFO 1 /* generate stabs (OSF/rose) */ +#define DWARF2_DEBUGGING_INFO 1 /* dwarf2 debugging info */ + +#ifndef PREFERRED_DEBUGGING_TYPE +#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG +#endif + +/* The size of DWARF addresses should be the same as the size of symbols + in the target file format. They shouldn't depend on things like -msym32, + because many DWARF consumers do not allow the mixture of address sizes + that one would then get from linking -msym32 code with -msym64 code. + + Note that the default POINTER_SIZE test is not appropriate for MIPS. + EABI64 has 64-bit pointers but uses 32-bit ELF. */ +#define DWARF2_ADDR_SIZE (FILE_HAS_64BIT_SYMBOLS ? 8 : 4) + +/* By default, turn on GDB extensions. */ +#define DEFAULT_GDB_EXTENSIONS 1 + +/* Registers may have a prefix which can be ignored when matching + user asm and register definitions. */ +#ifndef REGISTER_PREFIX +#define REGISTER_PREFIX "$" +#endif + +/* Local compiler-generated symbols must have a prefix that the assembler + understands. By default, this is $, although some targets (e.g., + NetBSD-ELF) need to override this. */ + +#ifndef LOCAL_LABEL_PREFIX +#define LOCAL_LABEL_PREFIX "$" +#endif + +/* By default on the mips, external symbols do not have an underscore + prepended, but some targets (e.g., NetBSD) require this. */ + +#ifndef USER_LABEL_PREFIX +#define USER_LABEL_PREFIX "" +#endif + +/* On Sun 4, this limit is 2048. We use 1500 to be safe, + since the length can run past this up to a continuation point. */ +#undef DBX_CONTIN_LENGTH +#define DBX_CONTIN_LENGTH 1500 + +/* How to renumber registers for dbx and gdb. */ +#define DBX_REGISTER_NUMBER(REGNO) mips_dbx_regno[REGNO] + +/* The mapping from gcc register number to DWARF 2 CFA column number. */ +#define DWARF_FRAME_REGNUM(REGNO) mips_dwarf_regno[REGNO] + +/* The DWARF 2 CFA column which tracks the return address. */ +#define DWARF_FRAME_RETURN_COLUMN RETURN_ADDR_REGNUM + +/* Before the prologue, RA lives in r31. */ +#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, RETURN_ADDR_REGNUM) + +/* Describe how we implement __builtin_eh_return. */ +#define EH_RETURN_DATA_REGNO(N) \ + ((N) < (TARGET_MIPS16 ? 2 : 4) ? (N) + GP_ARG_FIRST : INVALID_REGNUM) + +#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, GP_REG_FIRST + 3) + +#define EH_USES(N) mips_eh_uses (N) + +/* Offsets recorded in opcodes are a multiple of this alignment factor. + The default for this in 64-bit mode is 8, which causes problems with + SFmode register saves. */ +#define DWARF_CIE_DATA_ALIGNMENT -4 + +/* Correct the offset of automatic variables and arguments. Note that + the MIPS debug format wants all automatic variables and arguments + to be in terms of the virtual frame pointer (stack pointer before + any adjustment in the function), while the MIPS 3.0 linker wants + the frame pointer to be the stack pointer after the initial + adjustment. */ + +#define DEBUGGER_AUTO_OFFSET(X) \ + mips_debugger_offset (X, (HOST_WIDE_INT) 0) +#define DEBUGGER_ARG_OFFSET(OFFSET, X) \ + mips_debugger_offset (X, (HOST_WIDE_INT) OFFSET) + +/* Target machine storage layout */ + +#define BITS_BIG_ENDIAN 0 +#define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN != 0) +#define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN != 0) + +#define MAX_BITS_PER_WORD 64 + +/* Width of a word, in units (bytes). */ +#define UNITS_PER_WORD (TARGET_64BIT ? 8 : 4) +#ifndef IN_LIBGCC2 +#define MIN_UNITS_PER_WORD 4 +#endif + +/* Width of a MSA vector register in bytes. */ +#define UNITS_PER_MSA_REG 16 +/* Width of a MSA vector register in bits. */ +#define BITS_PER_MSA_REG (UNITS_PER_MSA_REG * BITS_PER_UNIT) + +/* For MIPS, width of a floating point register. */ +#define UNITS_PER_FPREG (TARGET_FLOAT64 ? 8 : 4) + +/* The number of consecutive floating-point registers needed to store the + largest format supported by the FPU. */ +#define MAX_FPRS_PER_FMT (TARGET_FLOAT64 || TARGET_SINGLE_FLOAT ? 1 : 2) + +/* The number of consecutive floating-point registers needed to store the + smallest format supported by the FPU. */ +#define MIN_FPRS_PER_FMT \ + (TARGET_ODD_SPREG ? 1 : MAX_FPRS_PER_FMT) + +/* The largest size of value that can be held in floating-point + registers and moved with a single instruction. */ +#define UNITS_PER_HWFPVALUE \ + (TARGET_SOFT_FLOAT_ABI ? 0 : MAX_FPRS_PER_FMT * UNITS_PER_FPREG) + +/* The largest size of value that can be held in floating-point + registers. */ +#define UNITS_PER_FPVALUE \ + (TARGET_SOFT_FLOAT_ABI ? 0 \ + : TARGET_SINGLE_FLOAT ? UNITS_PER_FPREG \ + : LONG_DOUBLE_TYPE_SIZE / BITS_PER_UNIT) + +/* The number of bytes in a double. */ +#define UNITS_PER_DOUBLE (TYPE_PRECISION (double_type_node) / BITS_PER_UNIT) + +/* Set the sizes of the core types. */ +#define SHORT_TYPE_SIZE 16 +#define INT_TYPE_SIZE 32 +#define LONG_TYPE_SIZE (TARGET_LONG64 ? 64 : 32) +#define LONG_LONG_TYPE_SIZE 64 + +#define FLOAT_TYPE_SIZE 32 +#define DOUBLE_TYPE_SIZE 64 +#define LONG_DOUBLE_TYPE_SIZE (TARGET_NEWABI ? 128 : 64) + +/* Define the sizes of fixed-point types. */ +#define SHORT_FRACT_TYPE_SIZE 8 +#define FRACT_TYPE_SIZE 16 +#define LONG_FRACT_TYPE_SIZE 32 +#define LONG_LONG_FRACT_TYPE_SIZE 64 + +#define SHORT_ACCUM_TYPE_SIZE 16 +#define ACCUM_TYPE_SIZE 32 +#define LONG_ACCUM_TYPE_SIZE 64 +/* FIXME. LONG_LONG_ACCUM_TYPE_SIZE should be 128 bits, but GCC + doesn't support 128-bit integers for MIPS32 currently. */ +#define LONG_LONG_ACCUM_TYPE_SIZE (TARGET_64BIT ? 128 : 64) + +/* long double is not a fixed mode, but the idea is that, if we + support long double, we also want a 128-bit integer type. */ +#define MAX_FIXED_MODE_SIZE LONG_DOUBLE_TYPE_SIZE + +/* Width in bits of a pointer. */ +#ifndef POINTER_SIZE +#define POINTER_SIZE ((TARGET_LONG64 && TARGET_64BIT) ? 64 : 32) +#endif + +/* Allocation boundary (in *bits*) for storing arguments in argument list. */ +#define PARM_BOUNDARY BITS_PER_WORD + +/* Allocation boundary (in *bits*) for the code of a function. */ +#define FUNCTION_BOUNDARY 32 + +/* Alignment of field after `int : 0' in a structure. */ +#define EMPTY_FIELD_BOUNDARY 32 + +/* Every structure's size must be a multiple of this. */ +/* 8 is observed right on a DECstation and on riscos 4.02. */ +#define STRUCTURE_SIZE_BOUNDARY 8 + +/* There is no point aligning anything to a rounder boundary than + LONG_DOUBLE_TYPE_SIZE, unless under MSA the bigggest alignment is + BITS_PER_MSA_REG. */ +#define BIGGEST_ALIGNMENT \ + (ISA_HAS_MSA ? BITS_PER_MSA_REG : LONG_DOUBLE_TYPE_SIZE) + +/* All accesses must be aligned. */ +#define STRICT_ALIGNMENT 1 + +/* Define this if you wish to imitate the way many other C compilers + handle alignment of bitfields and the structures that contain + them. + + The behavior is that the type written for a bit-field (`int', + `short', or other integer type) imposes an alignment for the + entire structure, as if the structure really did contain an + ordinary field of that type. In addition, the bit-field is placed + within the structure so that it would fit within such a field, + not crossing a boundary for it. + + Thus, on most machines, a bit-field whose type is written as `int' + would not cross a four-byte boundary, and would force four-byte + alignment for the whole structure. (The alignment used may not + be four bytes; it is controlled by the other alignment + parameters.) + + If the macro is defined, its definition should be a C expression; + a nonzero value for the expression enables this behavior. */ + +#define PCC_BITFIELD_TYPE_MATTERS 1 + +/* If defined, a C expression to compute the alignment given to a + constant that is being placed in memory. CONSTANT is the constant + and ALIGN is the alignment that the object would ordinarily have. + The value of this macro is used instead of that alignment to align + the object. + + If this macro is not defined, then ALIGN is used. + + The typical use of this macro is to increase alignment for string + constants to be word aligned so that `strcpy' calls that copy + constants can be done inline. */ + +#define CONSTANT_ALIGNMENT(EXP, ALIGN) \ + ((TREE_CODE (EXP) == STRING_CST || TREE_CODE (EXP) == CONSTRUCTOR) \ + && (ALIGN) < BITS_PER_WORD ? BITS_PER_WORD : (ALIGN)) + +/* If defined, a C expression to compute the alignment for a static + variable. TYPE is the data type, and ALIGN is the alignment that + the object would ordinarily have. The value of this macro is used + instead of that alignment to align the object. + + If this macro is not defined, then ALIGN is used. + + One use of this macro is to increase alignment of medium-size + data to make it all fit in fewer cache lines. Another is to + cause character arrays to be word-aligned so that `strcpy' calls + that copy constants to character arrays can be done inline. */ + +#undef DATA_ALIGNMENT +#define DATA_ALIGNMENT(TYPE, ALIGN) \ + ((((ALIGN) < BITS_PER_WORD) \ + && (TREE_CODE (TYPE) == ARRAY_TYPE \ + || TREE_CODE (TYPE) == UNION_TYPE \ + || TREE_CODE (TYPE) == RECORD_TYPE)) ? BITS_PER_WORD : (ALIGN)) + +/* We need this for the same reason as DATA_ALIGNMENT, namely to cause + character arrays to be word-aligned so that `strcpy' calls that copy + constants to character arrays can be done inline, and 'strcmp' can be + optimised to use word loads. */ +#define LOCAL_ALIGNMENT(TYPE, ALIGN) \ + DATA_ALIGNMENT (TYPE, ALIGN) + +#define PAD_VARARGS_DOWN \ + (FUNCTION_ARG_PADDING (TYPE_MODE (type), type) == downward) + +/* Define if operations between registers always perform the operation + on the full register even if a narrower mode is specified. */ +#define WORD_REGISTER_OPERATIONS 1 + +/* When in 64-bit mode, move insns will sign extend SImode and CCmode + moves. All other references are zero extended. */ +#define LOAD_EXTEND_OP(MODE) \ + (TARGET_64BIT && ((MODE) == SImode || (MODE) == CCmode) \ + ? SIGN_EXTEND : ZERO_EXTEND) + +/* Define this macro if it is advisable to hold scalars in registers + in a wider mode than that declared by the program. In such cases, + the value is constrained to be within the bounds of the declared + type, but kept valid in the wider mode. The signedness of the + extension may differ from that of the type. */ + +#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \ + if (GET_MODE_CLASS (MODE) == MODE_INT \ + && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \ + { \ + if ((MODE) == SImode) \ + (UNSIGNEDP) = 0; \ + (MODE) = Pmode; \ + } + +/* Pmode is always the same as ptr_mode, but not always the same as word_mode. + Extensions of pointers to word_mode must be signed. */ +#define POINTERS_EXTEND_UNSIGNED false + +/* Define if loading short immediate values into registers sign extends. */ +#define SHORT_IMMEDIATES_SIGN_EXTEND 1 + +/* The [d]clz instructions have the natural values at 0. */ + +#define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \ + ((VALUE) = GET_MODE_UNIT_BITSIZE (MODE), 2) + +/* Standard register usage. */ + +/* Number of hardware registers. We have: + + - 32 integer registers + - 32 floating point registers + - 8 condition code registers + - 2 accumulator registers (hi and lo) + - 32 registers each for coprocessors 0, 2 and 3 + - 4 fake registers: + - ARG_POINTER_REGNUM + - FRAME_POINTER_REGNUM + - GOT_VERSION_REGNUM (see the comment above load_call for details) + - CPRESTORE_SLOT_REGNUM + - 2 dummy entries that were used at various times in the past. + - 6 DSP accumulator registers (3 hi-lo pairs) for MIPS DSP ASE + - 6 DSP control registers */ + +#define FIRST_PSEUDO_REGISTER 188 + +/* By default, fix the kernel registers ($26 and $27), the global + pointer ($28) and the stack pointer ($29). This can change + depending on the command-line options. + + Regarding coprocessor registers: without evidence to the contrary, + it's best to assume that each coprocessor register has a unique + use. This can be overridden, in, e.g., mips_option_override or + TARGET_CONDITIONAL_REGISTER_USAGE should the assumption be + inappropriate for a particular target. */ + +#define FIXED_REGISTERS \ +{ \ + 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, \ + /* COP0 registers */ \ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ + /* COP2 registers */ \ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ + /* COP3 registers */ \ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ + /* 6 DSP accumulator registers & 6 control registers */ \ + 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1 \ +} + + +/* Set up this array for o32 by default. + + Note that we don't mark $31 as a call-clobbered register. The idea is + that it's really the call instructions themselves which clobber $31. + We don't care what the called function does with it afterwards. + + This approach makes it easier to implement sibcalls. Unlike normal + calls, sibcalls don't clobber $31, so the register reaches the + called function in tact. EPILOGUE_USES says that $31 is useful + to the called function. */ + +#define CALL_USED_REGISTERS \ +{ \ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ + 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, \ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ + 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ + /* COP0 registers */ \ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ + /* COP2 registers */ \ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ + /* COP3 registers */ \ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ + /* 6 DSP accumulator registers & 6 control registers */ \ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 \ +} + + +/* Define this since $28, though fixed, is call-saved in many ABIs. */ + +#define CALL_REALLY_USED_REGISTERS \ +{ /* General registers. */ \ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ + 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, \ + /* Floating-point registers. */ \ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ + 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + /* Others. */ \ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, \ + /* COP0 registers */ \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + /* COP2 registers */ \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + /* COP3 registers */ \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + /* 6 DSP accumulator registers & 6 control registers */ \ + 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 \ +} + +/* Internal macros to classify a register number as to whether it's a + general purpose register, a floating point register, a + multiply/divide register, or a status register. */ + +#define GP_REG_FIRST 0 +#define GP_REG_LAST 31 +#define GP_REG_NUM (GP_REG_LAST - GP_REG_FIRST + 1) +#define GP_DBX_FIRST 0 +#define K0_REG_NUM (GP_REG_FIRST + 26) +#define K1_REG_NUM (GP_REG_FIRST + 27) +#define KERNEL_REG_P(REGNO) (IN_RANGE (REGNO, K0_REG_NUM, K1_REG_NUM)) + +#define FP_REG_FIRST 32 +#define FP_REG_LAST 63 +#define FP_REG_NUM (FP_REG_LAST - FP_REG_FIRST + 1) +#define FP_DBX_FIRST ((write_symbols == DBX_DEBUG) ? 38 : 32) + +#define MD_REG_FIRST 64 +#define MD_REG_LAST 65 +#define MD_REG_NUM (MD_REG_LAST - MD_REG_FIRST + 1) +#define MD_DBX_FIRST (FP_DBX_FIRST + FP_REG_NUM) + +#define MSA_REG_FIRST FP_REG_FIRST +#define MSA_REG_LAST FP_REG_LAST +#define MSA_REG_NUM FP_REG_NUM + +/* The DWARF 2 CFA column which tracks the return address from a + signal handler context. This means that to maintain backwards + compatibility, no hard register can be assigned this column if it + would need to be handled by the DWARF unwinder. */ +#define DWARF_ALT_FRAME_RETURN_COLUMN 66 + +#define ST_REG_FIRST 67 +#define ST_REG_LAST 74 +#define ST_REG_NUM (ST_REG_LAST - ST_REG_FIRST + 1) + + +/* FIXME: renumber. */ +#define COP0_REG_FIRST 80 +#define COP0_REG_LAST 111 +#define COP0_REG_NUM (COP0_REG_LAST - COP0_REG_FIRST + 1) + +#define COP0_STATUS_REG_NUM (COP0_REG_FIRST + 12) +#define COP0_CAUSE_REG_NUM (COP0_REG_FIRST + 13) +#define COP0_EPC_REG_NUM (COP0_REG_FIRST + 14) + +#define COP2_REG_FIRST 112 +#define COP2_REG_LAST 143 +#define COP2_REG_NUM (COP2_REG_LAST - COP2_REG_FIRST + 1) + +#define COP3_REG_FIRST 144 +#define COP3_REG_LAST 175 +#define COP3_REG_NUM (COP3_REG_LAST - COP3_REG_FIRST + 1) + +/* These definitions assume that COP0, 2 and 3 are numbered consecutively. */ +#define ALL_COP_REG_FIRST COP0_REG_FIRST +#define ALL_COP_REG_LAST COP3_REG_LAST +#define ALL_COP_REG_NUM (ALL_COP_REG_LAST - ALL_COP_REG_FIRST + 1) + +#define DSP_ACC_REG_FIRST 176 +#define DSP_ACC_REG_LAST 181 +#define DSP_ACC_REG_NUM (DSP_ACC_REG_LAST - DSP_ACC_REG_FIRST + 1) + +#define AT_REGNUM (GP_REG_FIRST + 1) +#define HI_REGNUM (TARGET_BIG_ENDIAN ? MD_REG_FIRST : MD_REG_FIRST + 1) +#define LO_REGNUM (TARGET_BIG_ENDIAN ? MD_REG_FIRST + 1 : MD_REG_FIRST) + +/* A few bitfield locations for the coprocessor registers. */ +/* Request Interrupt Priority Level is from bit 10 to bit 15 of + the cause register for the EIC interrupt mode. */ +#define CAUSE_IPL 10 +/* COP1 Enable is at bit 29 of the status register. */ +#define SR_COP1 29 +/* Interrupt Priority Level is from bit 10 to bit 15 of the status register. */ +#define SR_IPL 10 +/* Interrupt masks start with IM0 at bit 8 to IM7 at bit 15 of the status + register. */ +#define SR_IM0 8 +/* Exception Level is at bit 1 of the status register. */ +#define SR_EXL 1 +/* Interrupt Enable is at bit 0 of the status register. */ +#define SR_IE 0 + +/* FPSW_REGNUM is the single condition code used if !ISA_HAS_8CC. + If ISA_HAS_8CC, it should not be used, and an arbitrary ST_REG + should be used instead. */ +#define FPSW_REGNUM ST_REG_FIRST + +#define GP_REG_P(REGNO) \ + ((unsigned int) ((int) (REGNO) - GP_REG_FIRST) < GP_REG_NUM) +#define M16_REG_P(REGNO) \ + (((REGNO) >= 2 && (REGNO) <= 7) || (REGNO) == 16 || (REGNO) == 17) +#define M16STORE_REG_P(REGNO) \ + (((REGNO) >= 2 && (REGNO) <= 7) || (REGNO) == 0 || (REGNO) == 17) +#define FP_REG_P(REGNO) \ + ((unsigned int) ((int) (REGNO) - FP_REG_FIRST) < FP_REG_NUM) +#define MD_REG_P(REGNO) \ + ((unsigned int) ((int) (REGNO) - MD_REG_FIRST) < MD_REG_NUM) +#define ST_REG_P(REGNO) \ + ((unsigned int) ((int) (REGNO) - ST_REG_FIRST) < ST_REG_NUM) +#define COP0_REG_P(REGNO) \ + ((unsigned int) ((int) (REGNO) - COP0_REG_FIRST) < COP0_REG_NUM) +#define COP2_REG_P(REGNO) \ + ((unsigned int) ((int) (REGNO) - COP2_REG_FIRST) < COP2_REG_NUM) +#define COP3_REG_P(REGNO) \ + ((unsigned int) ((int) (REGNO) - COP3_REG_FIRST) < COP3_REG_NUM) +#define ALL_COP_REG_P(REGNO) \ + ((unsigned int) ((int) (REGNO) - COP0_REG_FIRST) < ALL_COP_REG_NUM) +/* Test if REGNO is one of the 6 new DSP accumulators. */ +#define DSP_ACC_REG_P(REGNO) \ + ((unsigned int) ((int) (REGNO) - DSP_ACC_REG_FIRST) < DSP_ACC_REG_NUM) +/* Test if REGNO is hi, lo, or one of the 6 new DSP accumulators. */ +#define ACC_REG_P(REGNO) \ + (MD_REG_P (REGNO) || DSP_ACC_REG_P (REGNO)) +#define MSA_REG_P(REGNO) \ + ((unsigned int) ((int) (REGNO) - MSA_REG_FIRST) < MSA_REG_NUM) + +#define FP_REG_RTX_P(X) (REG_P (X) && FP_REG_P (REGNO (X))) +#define MSA_REG_RTX_P(X) (REG_P (X) && MSA_REG_P (REGNO (X))) + +/* True if X is (const (unspec [(const_int 0)] UNSPEC_GP)). This is used + to initialize the mips16 gp pseudo register. */ +#define CONST_GP_P(X) \ + (GET_CODE (X) == CONST \ + && GET_CODE (XEXP (X, 0)) == UNSPEC \ + && XINT (XEXP (X, 0), 1) == UNSPEC_GP) + +/* Return coprocessor number from register number. */ + +#define COPNUM_AS_CHAR_FROM_REGNUM(REGNO) \ + (COP0_REG_P (REGNO) ? '0' : COP2_REG_P (REGNO) ? '2' \ + : COP3_REG_P (REGNO) ? '3' : '?') + + +#define HARD_REGNO_NREGS(REGNO, MODE) mips_hard_regno_nregs (REGNO, MODE) + +#define HARD_REGNO_MODE_OK(REGNO, MODE) \ + mips_hard_regno_mode_ok[ (int)(MODE) ][ (REGNO) ] + +#define HARD_REGNO_RENAME_OK(OLD_REG, NEW_REG) \ + mips_hard_regno_rename_ok (OLD_REG, NEW_REG) + +/* Select a register mode required for caller save of hard regno REGNO. */ +#define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \ + mips_hard_regno_caller_save_mode (REGNO, NREGS, MODE) + +/* Odd-numbered single-precision registers are not considered callee-saved + for o32 FPXX as they will be clobbered when run on an FR=1 FPU. + MSA vector registers with MODE > 64 bits are part clobbered too. */ +#define HARD_REGNO_CALL_PART_CLOBBERED(REGNO, MODE) \ + ((TARGET_FLOATXX && hard_regno_nregs[REGNO][MODE] == 1 \ + && FP_REG_P (REGNO) && ((REGNO) & 1)) \ + || (ISA_HAS_MSA && FP_REG_P (REGNO) && GET_MODE_SIZE (MODE) > 8)) + +#define MODES_TIEABLE_P mips_modes_tieable_p + +/* Register to use for pushing function arguments. */ +#define STACK_POINTER_REGNUM (GP_REG_FIRST + 29) + +/* These two registers don't really exist: they get eliminated to either + the stack or hard frame pointer. */ +#define ARG_POINTER_REGNUM 77 +#define FRAME_POINTER_REGNUM 78 + +/* $30 is not available on the mips16, so we use $17 as the frame + pointer. */ +#define HARD_FRAME_POINTER_REGNUM \ + (TARGET_MIPS16 ? GP_REG_FIRST + 17 : GP_REG_FIRST + 30) + +#define HARD_FRAME_POINTER_IS_FRAME_POINTER 0 +#define HARD_FRAME_POINTER_IS_ARG_POINTER 0 + +/* Register in which static-chain is passed to a function. */ +#define STATIC_CHAIN_REGNUM (GP_REG_FIRST + 15) + +/* Registers used as temporaries in prologue/epilogue code: + + - If a MIPS16 PIC function needs access to _gp, it first loads + the value into MIPS16_PIC_TEMP and then copies it to $gp. + + - The prologue can use MIPS_PROLOGUE_TEMP as a general temporary + register. The register must not conflict with MIPS16_PIC_TEMP. + + - If we aren't generating MIPS16 code, the prologue can also use + MIPS_PROLOGUE_TEMP2 as a general temporary register. + + - The epilogue can use MIPS_EPILOGUE_TEMP as a general temporary + register. + + If we're generating MIPS16 code, these registers must come from the + core set of 8. The prologue registers mustn't conflict with any + incoming arguments, the static chain pointer, or the frame pointer. + The epilogue temporary mustn't conflict with the return registers, + the PIC call register ($25), the frame pointer, the EH stack adjustment, + or the EH data registers. + + If we're generating interrupt handlers, we use K0 as a temporary register + in prologue/epilogue code. */ + +#define MIPS16_PIC_TEMP_REGNUM (GP_REG_FIRST + 2) +#define MIPS_PROLOGUE_TEMP_REGNUM \ + (cfun->machine->interrupt_handler_p ? K0_REG_NUM : GP_REG_FIRST + 3) +#define MIPS_PROLOGUE_TEMP2_REGNUM \ + (TARGET_MIPS16 \ + ? (gcc_unreachable (), INVALID_REGNUM) \ + : cfun->machine->interrupt_handler_p ? K1_REG_NUM : GP_REG_FIRST + 12) +#define MIPS_EPILOGUE_TEMP_REGNUM \ + (cfun->machine->interrupt_handler_p \ + ? K0_REG_NUM \ + : GP_REG_FIRST + (TARGET_MIPS16 ? 6 : 8)) + +#define MIPS16_PIC_TEMP gen_rtx_REG (Pmode, MIPS16_PIC_TEMP_REGNUM) +#define MIPS_PROLOGUE_TEMP(MODE) gen_rtx_REG (MODE, MIPS_PROLOGUE_TEMP_REGNUM) +#define MIPS_PROLOGUE_TEMP2(MODE) \ + gen_rtx_REG (MODE, MIPS_PROLOGUE_TEMP2_REGNUM) +#define MIPS_EPILOGUE_TEMP(MODE) gen_rtx_REG (MODE, MIPS_EPILOGUE_TEMP_REGNUM) + +/* Define this macro if it is as good or better to call a constant + function address than to call an address kept in a register. */ +#define NO_FUNCTION_CSE 1 + +/* The ABI-defined global pointer. Sometimes we use a different + register in leaf functions: see PIC_OFFSET_TABLE_REGNUM. */ +#define GLOBAL_POINTER_REGNUM (GP_REG_FIRST + 28) + +/* We normally use $28 as the global pointer. However, when generating + n32/64 PIC, it is better for leaf functions to use a call-clobbered + register instead. They can then avoid saving and restoring $28 + and perhaps avoid using a frame at all. + + When a leaf function uses something other than $28, mips_expand_prologue + will modify pic_offset_table_rtx in place. Take the register number + from there after reload. */ +#define PIC_OFFSET_TABLE_REGNUM \ + (reload_completed ? REGNO (pic_offset_table_rtx) : GLOBAL_POINTER_REGNUM) + +/* Define the classes of registers for register constraints in the + machine description. Also define ranges of constants. + + One of the classes must always be named ALL_REGS and include all hard regs. + If there is more than one class, another class must be named NO_REGS + and contain no registers. + + The name GENERAL_REGS must be the name of a class (or an alias for + another name such as ALL_REGS). This is the class of registers + that is allowed by "g" or "r" in a register constraint. + Also, registers outside this class are allocated only when + instructions express preferences for them. + + The classes must be numbered in nondecreasing order; that is, + a larger-numbered class must never be contained completely + in a smaller-numbered class. + + For any two classes, it is very desirable that there be another + class that represents their union. */ + +enum reg_class +{ + NO_REGS, /* no registers in set */ + M16_STORE_REGS, /* microMIPS store registers */ + M16_REGS, /* mips16 directly accessible registers */ + M16_SP_REGS, /* mips16 + $sp */ + T_REG, /* mips16 T register ($24) */ + M16_T_REGS, /* mips16 registers plus T register */ + PIC_FN_ADDR_REG, /* SVR4 PIC function address register */ + V1_REG, /* Register $v1 ($3) used for TLS access. */ + SPILL_REGS, /* All but $sp and call preserved regs are in here */ + LEA_REGS, /* Every GPR except $25 */ + GR_REGS, /* integer registers */ + FP_REGS, /* floating point registers */ + MD0_REG, /* first multiply/divide register */ + MD1_REG, /* second multiply/divide register */ + MD_REGS, /* multiply/divide registers (hi/lo) */ + COP0_REGS, /* generic coprocessor classes */ + COP2_REGS, + COP3_REGS, + ST_REGS, /* status registers (fp status) */ + DSP_ACC_REGS, /* DSP accumulator registers */ + ACC_REGS, /* Hi/Lo and DSP accumulator registers */ + FRAME_REGS, /* $arg and $frame */ + GR_AND_MD0_REGS, /* union classes */ + GR_AND_MD1_REGS, + GR_AND_MD_REGS, + GR_AND_ACC_REGS, + ALL_REGS, /* all registers */ + LIM_REG_CLASSES /* max value + 1 */ +}; + +#define N_REG_CLASSES (int) LIM_REG_CLASSES + +#define GENERAL_REGS GR_REGS + +/* An initializer containing the names of the register classes as C + string constants. These names are used in writing some of the + debugging dumps. */ + +#define REG_CLASS_NAMES \ +{ \ + "NO_REGS", \ + "M16_STORE_REGS", \ + "M16_REGS", \ + "M16_SP_REGS", \ + "T_REG", \ + "M16_T_REGS", \ + "PIC_FN_ADDR_REG", \ + "V1_REG", \ + "SPILL_REGS", \ + "LEA_REGS", \ + "GR_REGS", \ + "FP_REGS", \ + "MD0_REG", \ + "MD1_REG", \ + "MD_REGS", \ + /* coprocessor registers */ \ + "COP0_REGS", \ + "COP2_REGS", \ + "COP3_REGS", \ + "ST_REGS", \ + "DSP_ACC_REGS", \ + "ACC_REGS", \ + "FRAME_REGS", \ + "GR_AND_MD0_REGS", \ + "GR_AND_MD1_REGS", \ + "GR_AND_MD_REGS", \ + "GR_AND_ACC_REGS", \ + "ALL_REGS" \ +} + +/* An initializer containing the contents of the register classes, + as integers which are bit masks. The Nth integer specifies the + contents of class N. The way the integer MASK is interpreted is + that register R is in the class if `MASK & (1 << R)' is 1. + + When the machine has more than 32 registers, an integer does not + suffice. Then the integers are replaced by sub-initializers, + braced groupings containing several integers. Each + sub-initializer must be suitable as an initializer for the type + `HARD_REG_SET' which is defined in `hard-reg-set.h'. */ + +#define REG_CLASS_CONTENTS \ +{ \ + { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* NO_REGS */ \ + { 0x000200fc, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* M16_STORE_REGS */ \ + { 0x000300fc, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* M16_REGS */ \ + { 0x200300fc, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* M16_SP_REGS */ \ + { 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* T_REG */ \ + { 0x010300fc, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* M16_T_REGS */ \ + { 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* PIC_FN_ADDR_REG */ \ + { 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* V1_REG */ \ + { 0x0303fffc, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* SPILL_REGS */ \ + { 0xfdffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* LEA_REGS */ \ + { 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* GR_REGS */ \ + { 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }, /* FP_REGS */ \ + { 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000 }, /* MD0_REG */ \ + { 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000 }, /* MD1_REG */ \ + { 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000 }, /* MD_REGS */ \ + { 0x00000000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00000000, 0x00000000 }, /* COP0_REGS */ \ + { 0x00000000, 0x00000000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00000000 }, /* COP2_REGS */ \ + { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffff0000, 0x0000ffff }, /* COP3_REGS */ \ + { 0x00000000, 0x00000000, 0x000007f8, 0x00000000, 0x00000000, 0x00000000 }, /* ST_REGS */ \ + { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x003f0000 }, /* DSP_ACC_REGS */ \ + { 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x003f0000 }, /* ACC_REGS */ \ + { 0x00000000, 0x00000000, 0x00006000, 0x00000000, 0x00000000, 0x00000000 }, /* FRAME_REGS */ \ + { 0xffffffff, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000 }, /* GR_AND_MD0_REGS */ \ + { 0xffffffff, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000 }, /* GR_AND_MD1_REGS */ \ + { 0xffffffff, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000 }, /* GR_AND_MD_REGS */ \ + { 0xffffffff, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x003f0000 }, /* GR_AND_ACC_REGS */ \ + { 0xffffffff, 0xffffffff, 0xffff67ff, 0xffffffff, 0xffffffff, 0x0fffffff } /* ALL_REGS */ \ +} + + +/* A C expression whose value is a register class containing hard + register REGNO. In general there is more that one such class; + choose a class which is "minimal", meaning that no smaller class + also contains the register. */ + +#define REGNO_REG_CLASS(REGNO) mips_regno_to_class[ (REGNO) ] + +/* A macro whose definition is the name of the class to which a + valid base register must belong. A base register is one used in + an address which is the register value plus a displacement. */ + +#define BASE_REG_CLASS (TARGET_MIPS16 ? M16_SP_REGS : GR_REGS) + +/* A macro whose definition is the name of the class to which a + valid index register must belong. An index register is one used + in an address where its value is either multiplied by a scale + factor or added to another register (as well as added to a + displacement). */ + +#define INDEX_REG_CLASS NO_REGS + +/* We generally want to put call-clobbered registers ahead of + call-saved ones. (IRA expects this.) */ + +#define REG_ALLOC_ORDER \ +{ /* Accumulator registers. When GPRs and accumulators have equal \ + cost, we generally prefer to use accumulators. For example, \ + a division of multiplication result is better allocated to LO, \ + so that we put the MFLO at the point of use instead of at the \ + point of definition. It's also needed if we're to take advantage \ + of the extra accumulators available with -mdspr2. In some cases, \ + it can also help to reduce register pressure. */ \ + 64, 65,176,177,178,179,180,181, \ + /* Call-clobbered GPRs. */ \ + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, \ + 24, 25, 31, \ + /* The global pointer. This is call-clobbered for o32 and o64 \ + abicalls, call-saved for n32 and n64 abicalls, and a program \ + invariant otherwise. Putting it between the call-clobbered \ + and call-saved registers should cope with all eventualities. */ \ + 28, \ + /* Call-saved GPRs. */ \ + 16, 17, 18, 19, 20, 21, 22, 23, 30, \ + /* GPRs that can never be exposed to the register allocator. */ \ + 0, 26, 27, 29, \ + /* Call-clobbered FPRs. */ \ + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, \ + 48, 49, 50, 51, \ + /* FPRs that are usually call-saved. The odd ones are actually \ + call-clobbered for n32, but listing them ahead of the even \ + registers might encourage the register allocator to fragment \ + the available FPR pairs. We need paired FPRs to store long \ + doubles, so it isn't clear that using a different order \ + for n32 would be a win. */ \ + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, \ + /* None of the remaining classes have defined call-saved \ + registers. */ \ + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, \ + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, \ + 96, 97, 98, 99, 100,101,102,103,104,105,106,107,108,109,110,111, \ + 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127, \ + 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, \ + 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, \ + 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, \ + 182,183,184,185,186,187 \ +} + +/* True if VALUE is an unsigned 6-bit number. */ + +#define UIMM6_OPERAND(VALUE) \ + (((VALUE) & ~(unsigned HOST_WIDE_INT) 0x3f) == 0) + +/* True if VALUE is a signed 10-bit number. */ + +#define IMM10_OPERAND(VALUE) \ + ((unsigned HOST_WIDE_INT) (VALUE) + 0x200 < 0x400) + +/* True if VALUE is a signed 16-bit number. */ + +#define SMALL_OPERAND(VALUE) \ + ((unsigned HOST_WIDE_INT) (VALUE) + 0x8000 < 0x10000) + +/* True if VALUE is an unsigned 16-bit number. */ + +#define SMALL_OPERAND_UNSIGNED(VALUE) \ + (((VALUE) & ~(unsigned HOST_WIDE_INT) 0xffff) == 0) + +/* True if VALUE can be loaded into a register using LUI. */ + +#define LUI_OPERAND(VALUE) \ + (((VALUE) | 0x7fff0000) == 0x7fff0000 \ + || ((VALUE) | 0x7fff0000) + 0x10000 == 0) + +/* Return a value X with the low 16 bits clear, and such that + VALUE - X is a signed 16-bit value. */ + +#define CONST_HIGH_PART(VALUE) \ + (((VALUE) + 0x8000) & ~(unsigned HOST_WIDE_INT) 0xffff) + +#define CONST_LOW_PART(VALUE) \ + ((VALUE) - CONST_HIGH_PART (VALUE)) + +#define SMALL_INT(X) SMALL_OPERAND (INTVAL (X)) +#define SMALL_INT_UNSIGNED(X) SMALL_OPERAND_UNSIGNED (INTVAL (X)) +#define LUI_INT(X) LUI_OPERAND (INTVAL (X)) +#define UMIPS_12BIT_OFFSET_P(OFFSET) (IN_RANGE (OFFSET, -2048, 2047)) +#define MIPS_9BIT_OFFSET_P(OFFSET) (IN_RANGE (OFFSET, -256, 255)) + +/* The HI and LO registers can only be reloaded via the general + registers. Condition code registers can only be loaded to the + general registers, and from the floating point registers. */ + +#define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X) \ + mips_secondary_reload_class (CLASS, MODE, X, true) +#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, X) \ + mips_secondary_reload_class (CLASS, MODE, X, false) + +/* When targeting the o32 FPXX ABI, all moves with a length of doubleword + or greater must be performed by FR-mode-aware instructions. + This can be achieved using MFHC1/MTHC1 when these instructions are + available but otherwise moves must go via memory. + For the o32 FP64A ABI, all odd-numbered moves with a length of + doubleword or greater are required to use memory. Using MTC1/MFC1 + to access the lower-half of these registers would require a forbidden + single-precision access. We require all double-word moves to use + memory because adding even and odd floating-point registers classes + would have a significant impact on the backend. */ +#define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \ + mips_secondary_memory_needed ((CLASS1), (CLASS2), (MODE)) + +/* Return the maximum number of consecutive registers + needed to represent mode MODE in a register of class CLASS. */ + +#define CLASS_MAX_NREGS(CLASS, MODE) mips_class_max_nregs (CLASS, MODE) + +#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \ + mips_cannot_change_mode_class (FROM, TO, CLASS) + +/* Stack layout; function entry, exit and calling. */ + +#define STACK_GROWS_DOWNWARD 1 + +#define FRAME_GROWS_DOWNWARD flag_stack_protect + +/* Size of the area allocated in the frame to save the GP. */ + +#define MIPS_GP_SAVE_AREA_SIZE \ + (TARGET_CALL_CLOBBERED_GP ? MIPS_STACK_ALIGN (UNITS_PER_WORD) : 0) + +/* The offset of the first local variable from the frame pointer. See + mips_compute_frame_info for details about the frame layout. */ + +#define STARTING_FRAME_OFFSET \ + (FRAME_GROWS_DOWNWARD \ + ? 0 \ + : crtl->outgoing_args_size + MIPS_GP_SAVE_AREA_SIZE) + +#define RETURN_ADDR_RTX mips_return_addr + +/* Mask off the MIPS16 ISA bit in unwind addresses. + + The reason for this is a little subtle. When unwinding a call, + we are given the call's return address, which on most targets + is the address of the following instruction. However, what we + actually want to find is the EH region for the call itself. + The target-independent unwind code therefore searches for "RA - 1". + + In the MIPS16 case, RA is always an odd-valued (ISA-encoded) address. + RA - 1 is therefore the real (even-valued) start of the return + instruction. EH region labels are usually odd-valued MIPS16 symbols + too, so a search for an even address within a MIPS16 region would + usually work. + + However, there is an exception. If the end of an EH region is also + the end of a function, the end label is allowed to be even. This is + necessary because a following non-MIPS16 function may also need EH + information for its first instruction. + + Thus a MIPS16 region may be terminated by an ISA-encoded or a + non-ISA-encoded address. This probably isn't ideal, but it is + the traditional (legacy) behavior. It is therefore only safe + to search MIPS EH regions for an _odd-valued_ address. + + Masking off the ISA bit means that the target-independent code + will search for "(RA & -2) - 1", which is guaranteed to be odd. */ +#define MASK_RETURN_ADDR GEN_INT (-2) + + +/* Similarly, don't use the least-significant bit to tell pointers to + code from vtable index. */ + +#define TARGET_PTRMEMFUNC_VBIT_LOCATION ptrmemfunc_vbit_in_delta + +/* The eliminations to $17 are only used for mips16 code. See the + definition of HARD_FRAME_POINTER_REGNUM. */ + +#define ELIMINABLE_REGS \ +{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ + { ARG_POINTER_REGNUM, GP_REG_FIRST + 30}, \ + { ARG_POINTER_REGNUM, GP_REG_FIRST + 17}, \ + { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ + { FRAME_POINTER_REGNUM, GP_REG_FIRST + 30}, \ + { FRAME_POINTER_REGNUM, GP_REG_FIRST + 17}} + +#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ + (OFFSET) = mips_initial_elimination_offset ((FROM), (TO)) + +/* Allocate stack space for arguments at the beginning of each function. */ +#define ACCUMULATE_OUTGOING_ARGS 1 + +/* The argument pointer always points to the first argument. */ +#define FIRST_PARM_OFFSET(FNDECL) 0 + +/* o32 and o64 reserve stack space for all argument registers. */ +#define REG_PARM_STACK_SPACE(FNDECL) \ + (TARGET_OLDABI \ + ? (MAX_ARGS_IN_REGISTERS * UNITS_PER_WORD) \ + : 0) + +/* Define this if it is the responsibility of the caller to + allocate the area reserved for arguments passed in registers. + If `ACCUMULATE_OUTGOING_ARGS' is also defined, the only effect + of this macro is to determine whether the space is included in + `crtl->outgoing_args_size'. */ +#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 1 + +#define STACK_BOUNDARY (TARGET_NEWABI ? 128 : 64) + +/* Symbolic macros for the registers used to return integer and floating + point values. */ + +#define GP_RETURN (GP_REG_FIRST + 2) +#define FP_RETURN ((TARGET_SOFT_FLOAT) ? GP_RETURN : (FP_REG_FIRST + 0)) + +#define MAX_ARGS_IN_REGISTERS (TARGET_OLDABI ? 4 : 8) + +/* Symbolic macros for the first/last argument registers. */ + +#define GP_ARG_FIRST (GP_REG_FIRST + 4) +#define GP_ARG_LAST (GP_ARG_FIRST + MAX_ARGS_IN_REGISTERS - 1) +#define FP_ARG_FIRST (FP_REG_FIRST + 12) +#define FP_ARG_LAST (FP_ARG_FIRST + MAX_ARGS_IN_REGISTERS - 1) + +/* True if MODE is vector and supported in a MSA vector register. */ +#define MSA_SUPPORTED_MODE_P(MODE) \ + (ISA_HAS_MSA \ + && GET_MODE_SIZE (MODE) == UNITS_PER_MSA_REG \ + && (GET_MODE_CLASS (MODE) == MODE_VECTOR_INT \ + || GET_MODE_CLASS (MODE) == MODE_VECTOR_FLOAT)) + +/* Temporary register that is used when restoring $gp after a call. $4 and $5 + are used for returning complex double values in soft-float code, so $6 is the + first suitable candidate for TARGET_MIPS16. For !TARGET_MIPS16 we can use + $gp itself as the temporary. */ +#define POST_CALL_TMP_REG \ + (TARGET_MIPS16 ? GP_ARG_FIRST + 2 : PIC_OFFSET_TABLE_REGNUM) + +/* 1 if N is a possible register number for function argument passing. + We have no FP argument registers when soft-float. Special handling + is required for O32 where only even numbered registers are used for + O32-FPXX and O32-FP64. */ + +#define FUNCTION_ARG_REGNO_P(N) \ + ((IN_RANGE((N), GP_ARG_FIRST, GP_ARG_LAST) \ + || (IN_RANGE((N), FP_ARG_FIRST, FP_ARG_LAST) \ + && (mips_abi != ABI_32 \ + || TARGET_FLOAT32 \ + || ((N) % 2 == 0)))) \ + && !fixed_regs[N]) + +/* This structure has to cope with two different argument allocation + schemes. Most MIPS ABIs view the arguments as a structure, of which + the first N words go in registers and the rest go on the stack. If I + < N, the Ith word might go in Ith integer argument register or in a + floating-point register. For these ABIs, we only need to remember + the offset of the current argument into the structure. + + The EABI instead allocates the integer and floating-point arguments + separately. The first N words of FP arguments go in FP registers, + the rest go on the stack. Likewise, the first N words of the other + arguments go in integer registers, and the rest go on the stack. We + need to maintain three counts: the number of integer registers used, + the number of floating-point registers used, and the number of words + passed on the stack. + + We could keep separate information for the two ABIs (a word count for + the standard ABIs, and three separate counts for the EABI). But it + seems simpler to view the standard ABIs as forms of EABI that do not + allocate floating-point registers. + + So for the standard ABIs, the first N words are allocated to integer + registers, and mips_function_arg decides on an argument-by-argument + basis whether that argument should really go in an integer register, + or in a floating-point one. */ + +typedef struct mips_args { + /* Always true for varargs functions. Otherwise true if at least + one argument has been passed in an integer register. */ + int gp_reg_found; + + /* The number of arguments seen so far. */ + unsigned int arg_number; + + /* The number of integer registers used so far. For all ABIs except + EABI, this is the number of words that have been added to the + argument structure, limited to MAX_ARGS_IN_REGISTERS. */ + unsigned int num_gprs; + + /* For EABI, the number of floating-point registers used so far. */ + unsigned int num_fprs; + + /* The number of words passed on the stack. */ + unsigned int stack_words; + + /* On the mips16, we need to keep track of which floating point + arguments were passed in general registers, but would have been + passed in the FP regs if this were a 32-bit function, so that we + can move them to the FP regs if we wind up calling a 32-bit + function. We record this information in fp_code, encoded in base + four. A zero digit means no floating point argument, a one digit + means an SFmode argument, and a two digit means a DFmode argument, + and a three digit is not used. The low order digit is the first + argument. Thus 6 == 1 * 4 + 2 means a DFmode argument followed by + an SFmode argument. ??? A more sophisticated approach will be + needed if MIPS_ABI != ABI_32. */ + int fp_code; + + /* True if the function has a prototype. */ + int prototype; +} CUMULATIVE_ARGS; + +/* Initialize a variable CUM of type CUMULATIVE_ARGS + for a call to a function whose data type is FNTYPE. + For a library call, FNTYPE is 0. */ + +#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \ + mips_init_cumulative_args (&CUM, FNTYPE) + +#define FUNCTION_ARG_PADDING(MODE, TYPE) \ + (mips_pad_arg_upward (MODE, TYPE) ? upward : downward) + +#define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \ + (mips_pad_reg_upward (MODE, TYPE) ? upward : downward) + +/* True if using EABI and varargs can be passed in floating-point + registers. Under these conditions, we need a more complex form + of va_list, which tracks GPR, FPR and stack arguments separately. */ +#define EABI_FLOAT_VARARGS_P \ + (mips_abi == ABI_EABI && UNITS_PER_FPVALUE >= UNITS_PER_DOUBLE) + + +#define EPILOGUE_USES(REGNO) mips_epilogue_uses (REGNO) + +/* Treat LOC as a byte offset from the stack pointer and round it up + to the next fully-aligned offset. */ +#define MIPS_STACK_ALIGN(LOC) \ + (TARGET_NEWABI ? ROUND_UP ((LOC), 16) : ROUND_UP ((LOC), 8)) + + +/* Output assembler code to FILE to increment profiler label # LABELNO + for profiling a function entry. */ + +#define FUNCTION_PROFILER(FILE, LABELNO) mips_function_profiler ((FILE)) + +/* The profiler preserves all interesting registers, including $31. */ +#define MIPS_SAVE_REG_FOR_PROFILING_P(REGNO) false + +/* No mips port has ever used the profiler counter word, so don't emit it + or the label for it. */ + +#define NO_PROFILE_COUNTERS 1 + +/* Define this macro if the code for function profiling should come + before the function prologue. Normally, the profiling code comes + after. */ + +/* #define PROFILE_BEFORE_PROLOGUE */ + +/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, + the stack pointer does not matter. The value is tested only in + functions that have frame pointers. + No definition is equivalent to always zero. */ + +#define EXIT_IGNORE_STACK 1 + + +/* Trampolines are a block of code followed by two pointers. */ + +#define TRAMPOLINE_SIZE \ + (mips_trampoline_code_size () + GET_MODE_SIZE (ptr_mode) * 2) + +/* Forcing a 64-bit alignment for 32-bit targets allows us to load two + pointers from a single LUI base. */ + +#define TRAMPOLINE_ALIGNMENT 64 + +/* mips_trampoline_init calls this library function to flush + program and data caches. */ + +#ifndef CACHE_FLUSH_FUNC +#define CACHE_FLUSH_FUNC "_flush_cache" +#endif + +#define MIPS_ICACHE_SYNC(ADDR, SIZE) \ + /* Flush both caches. We need to flush the data cache in case \ + the system has a write-back cache. */ \ + emit_library_call (gen_rtx_SYMBOL_REF (Pmode, mips_cache_flush_func), \ + LCT_NORMAL, VOIDmode, 3, ADDR, Pmode, SIZE, Pmode, \ + GEN_INT (3), TYPE_MODE (integer_type_node)) + + +/* Addressing modes, and classification of registers for them. */ + +#define REGNO_OK_FOR_INDEX_P(REGNO) 0 +#define REGNO_MODE_OK_FOR_BASE_P(REGNO, MODE) \ + mips_regno_mode_ok_for_base_p (REGNO, MODE, 1) + +/* Maximum number of registers that can appear in a valid memory address. */ + +#define MAX_REGS_PER_ADDRESS 1 + +/* Check for constness inline but use mips_legitimate_address_p + to check whether a constant really is an address. */ + +#define CONSTANT_ADDRESS_P(X) \ + (CONSTANT_P (X) && memory_address_p (SImode, X)) + +/* This handles the magic '..CURRENT_FUNCTION' symbol, which means + 'the start of the function that this code is output in'. */ + +#define ASM_OUTPUT_LABELREF(FILE,NAME) \ + if (strcmp (NAME, "..CURRENT_FUNCTION") == 0) \ + asm_fprintf ((FILE), "%U%s", \ + XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0)); \ + else \ + asm_fprintf ((FILE), "%U%s", (NAME)) + +/* Flag to mark a function decl symbol that requires a long call. */ +#define SYMBOL_FLAG_LONG_CALL (SYMBOL_FLAG_MACH_DEP << 0) +#define SYMBOL_REF_LONG_CALL_P(X) \ + ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_LONG_CALL) != 0) + +/* This flag marks functions that cannot be lazily bound. */ +#define SYMBOL_FLAG_BIND_NOW (SYMBOL_FLAG_MACH_DEP << 1) +#define SYMBOL_REF_BIND_NOW_P(RTX) \ + ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_BIND_NOW) != 0) + +/* True if we're generating a form of MIPS16 code in which jump tables + are stored in the text section and encoded as 16-bit PC-relative + offsets. This is only possible when general text loads are allowed, + since the table access itself will be an "lh" instruction. If the + PC-relative offsets grow too large, 32-bit offsets are used instead. */ +#define TARGET_MIPS16_SHORT_JUMP_TABLES TARGET_MIPS16_TEXT_LOADS + +#define JUMP_TABLES_IN_TEXT_SECTION TARGET_MIPS16_SHORT_JUMP_TABLES + +#define CASE_VECTOR_MODE (TARGET_MIPS16_SHORT_JUMP_TABLES ? SImode : ptr_mode) + +/* Only use short offsets if their range will not overflow. */ +#define CASE_VECTOR_SHORTEN_MODE(MIN, MAX, BODY) \ + (!TARGET_MIPS16_SHORT_JUMP_TABLES ? ptr_mode \ + : ((MIN) >= -32768 && (MAX) < 32768) ? HImode \ + : SImode) + +#define CASE_VECTOR_PC_RELATIVE TARGET_MIPS16_SHORT_JUMP_TABLES + +/* Define this as 1 if `char' should by default be signed; else as 0. */ +#ifndef DEFAULT_SIGNED_CHAR +#define DEFAULT_SIGNED_CHAR 1 +#endif + +/* Although LDC1 and SDC1 provide 64-bit moves on 32-bit targets, + we generally don't want to use them for copying arbitrary data. + A single N-word move is usually the same cost as N single-word moves. */ +#define MOVE_MAX UNITS_PER_WORD +/* We don't modify it for MSA as it is only used by the classic reload. */ +#define MAX_MOVE_MAX 8 + +/* Define this macro as a C expression which is nonzero if + accessing less than a word of memory (i.e. a `char' or a + `short') is no faster than accessing a word of memory, i.e., if + such access require more than one instruction or if there is no + difference in cost between byte and (aligned) word loads. + + On RISC machines, it tends to generate better code to define + this as 1, since it avoids making a QI or HI mode register. + + But, generating word accesses for -mips16 is generally bad as shifts + (often extended) would be needed for byte accesses. */ +#define SLOW_BYTE_ACCESS (!TARGET_MIPS16) + +/* Standard MIPS integer shifts truncate the shift amount to the + width of the shifted operand. However, Loongson vector shifts + do not truncate the shift amount at all. */ +#define SHIFT_COUNT_TRUNCATED (!TARGET_LOONGSON_VECTORS) + +/* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits + is done just by pretending it is already truncated. */ +#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) \ + (TARGET_64BIT ? ((INPREC) <= 32 || (OUTPREC) > 32) : 1) + + +/* Specify the machine mode that pointers have. + After generation of rtl, the compiler makes no further distinction + between pointers and any other objects of this machine mode. */ + +#ifndef Pmode +#define Pmode (TARGET_64BIT && TARGET_LONG64 ? DImode : SImode) +#endif + +/* Give call MEMs SImode since it is the "most permissive" mode + for both 32-bit and 64-bit targets. */ + +#define FUNCTION_MODE SImode + + +/* We allocate $fcc registers by hand and can't cope with moves of + CCmode registers to and from pseudos (or memory). */ +#define AVOID_CCMODE_COPIES + +/* A C expression for the cost of a branch instruction. A value of + 1 is the default; other values are interpreted relative to that. */ + +#define BRANCH_COST(speed_p, predictable_p) mips_branch_cost +#define LOGICAL_OP_NON_SHORT_CIRCUIT 0 + +/* The MIPS port has several functions that return an instruction count. + Multiplying the count by this value gives the number of bytes that + the instructions occupy. */ +#define BASE_INSN_LENGTH (TARGET_MIPS16 ? 2 : 4) + +/* The length of a NOP in bytes. */ +#define NOP_INSN_LENGTH (TARGET_COMPRESSION ? 2 : 4) + +/* If defined, modifies the length assigned to instruction INSN as a + function of the context in which it is used. LENGTH is an lvalue + that contains the initially computed length of the insn and should + be updated with the correct length of the insn. */ +#define ADJUST_INSN_LENGTH(INSN, LENGTH) \ + ((LENGTH) = mips_adjust_insn_length ((INSN), (LENGTH))) + +/* Return the asm template for a non-MIPS16 conditional branch instruction. + OPCODE is the opcode's mnemonic and OPERANDS is the asm template for + its operands. */ +#define MIPS_BRANCH(OPCODE, OPERANDS) \ + "%*" OPCODE "%?\t" OPERANDS "%/" + +#define MIPS_BRANCH_C(OPCODE, OPERANDS) \ + "%*" OPCODE "%:\t" OPERANDS + +/* Return an asm string that forces INSN to be treated as an absolute + J or JAL instruction instead of an assembler macro. */ +#define MIPS_ABSOLUTE_JUMP(INSN) \ + (TARGET_ABICALLS_PIC2 \ + ? ".option\tpic0\n\t" INSN "\n\t.option\tpic2" \ + : INSN) + + +/* Control the assembler format that we output. */ + +/* Output to assembler file text saying following lines + may contain character constants, extra white space, comments, etc. */ + +#ifndef ASM_APP_ON +#define ASM_APP_ON " #APP\n" +#endif + +/* Output to assembler file text saying following lines + no longer contain unusual constructs. */ + +#ifndef ASM_APP_OFF +#define ASM_APP_OFF " #NO_APP\n" +#endif + +#define REGISTER_NAMES \ +{ "$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", \ + "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", \ + "$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23", \ + "$24", "$25", "$26", "$27", "$28", "$sp", "$fp", "$31", \ + "$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7", \ + "$f8", "$f9", "$f10", "$f11", "$f12", "$f13", "$f14", "$f15", \ + "$f16", "$f17", "$f18", "$f19", "$f20", "$f21", "$f22", "$f23", \ + "$f24", "$f25", "$f26", "$f27", "$f28", "$f29", "$f30", "$f31", \ + "hi", "lo", "", "$fcc0","$fcc1","$fcc2","$fcc3","$fcc4", \ + "$fcc5","$fcc6","$fcc7","", "$cprestore", "$arg", "$frame", "$fakec", \ + "$c0r0", "$c0r1", "$c0r2", "$c0r3", "$c0r4", "$c0r5", "$c0r6", "$c0r7", \ + "$c0r8", "$c0r9", "$c0r10","$c0r11","$c0r12","$c0r13","$c0r14","$c0r15", \ + "$c0r16","$c0r17","$c0r18","$c0r19","$c0r20","$c0r21","$c0r22","$c0r23", \ + "$c0r24","$c0r25","$c0r26","$c0r27","$c0r28","$c0r29","$c0r30","$c0r31", \ + "$c2r0", "$c2r1", "$c2r2", "$c2r3", "$c2r4", "$c2r5", "$c2r6", "$c2r7", \ + "$c2r8", "$c2r9", "$c2r10","$c2r11","$c2r12","$c2r13","$c2r14","$c2r15", \ + "$c2r16","$c2r17","$c2r18","$c2r19","$c2r20","$c2r21","$c2r22","$c2r23", \ + "$c2r24","$c2r25","$c2r26","$c2r27","$c2r28","$c2r29","$c2r30","$c2r31", \ + "$c3r0", "$c3r1", "$c3r2", "$c3r3", "$c3r4", "$c3r5", "$c3r6", "$c3r7", \ + "$c3r8", "$c3r9", "$c3r10","$c3r11","$c3r12","$c3r13","$c3r14","$c3r15", \ + "$c3r16","$c3r17","$c3r18","$c3r19","$c3r20","$c3r21","$c3r22","$c3r23", \ + "$c3r24","$c3r25","$c3r26","$c3r27","$c3r28","$c3r29","$c3r30","$c3r31", \ + "$ac1hi","$ac1lo","$ac2hi","$ac2lo","$ac3hi","$ac3lo","$dsp_po","$dsp_sc", \ + "$dsp_ca","$dsp_ou","$dsp_cc","$dsp_ef" } + +/* List the "software" names for each register. Also list the numerical + names for $fp and $sp. */ + +#define ADDITIONAL_REGISTER_NAMES \ +{ \ + { "$29", 29 + GP_REG_FIRST }, \ + { "$30", 30 + GP_REG_FIRST }, \ + { "at", 1 + GP_REG_FIRST }, \ + { "v0", 2 + GP_REG_FIRST }, \ + { "v1", 3 + GP_REG_FIRST }, \ + { "a0", 4 + GP_REG_FIRST }, \ + { "a1", 5 + GP_REG_FIRST }, \ + { "a2", 6 + GP_REG_FIRST }, \ + { "a3", 7 + GP_REG_FIRST }, \ + { "t0", 8 + GP_REG_FIRST }, \ + { "t1", 9 + GP_REG_FIRST }, \ + { "t2", 10 + GP_REG_FIRST }, \ + { "t3", 11 + GP_REG_FIRST }, \ + { "t4", 12 + GP_REG_FIRST }, \ + { "t5", 13 + GP_REG_FIRST }, \ + { "t6", 14 + GP_REG_FIRST }, \ + { "t7", 15 + GP_REG_FIRST }, \ + { "s0", 16 + GP_REG_FIRST }, \ + { "s1", 17 + GP_REG_FIRST }, \ + { "s2", 18 + GP_REG_FIRST }, \ + { "s3", 19 + GP_REG_FIRST }, \ + { "s4", 20 + GP_REG_FIRST }, \ + { "s5", 21 + GP_REG_FIRST }, \ + { "s6", 22 + GP_REG_FIRST }, \ + { "s7", 23 + GP_REG_FIRST }, \ + { "t8", 24 + GP_REG_FIRST }, \ + { "t9", 25 + GP_REG_FIRST }, \ + { "k0", 26 + GP_REG_FIRST }, \ + { "k1", 27 + GP_REG_FIRST }, \ + { "gp", 28 + GP_REG_FIRST }, \ + { "sp", 29 + GP_REG_FIRST }, \ + { "fp", 30 + GP_REG_FIRST }, \ + { "ra", 31 + GP_REG_FIRST }, \ + { "$w0", 0 + FP_REG_FIRST }, \ + { "$w1", 1 + FP_REG_FIRST }, \ + { "$w2", 2 + FP_REG_FIRST }, \ + { "$w3", 3 + FP_REG_FIRST }, \ + { "$w4", 4 + FP_REG_FIRST }, \ + { "$w5", 5 + FP_REG_FIRST }, \ + { "$w6", 6 + FP_REG_FIRST }, \ + { "$w7", 7 + FP_REG_FIRST }, \ + { "$w8", 8 + FP_REG_FIRST }, \ + { "$w9", 9 + FP_REG_FIRST }, \ + { "$w10", 10 + FP_REG_FIRST }, \ + { "$w11", 11 + FP_REG_FIRST }, \ + { "$w12", 12 + FP_REG_FIRST }, \ + { "$w13", 13 + FP_REG_FIRST }, \ + { "$w14", 14 + FP_REG_FIRST }, \ + { "$w15", 15 + FP_REG_FIRST }, \ + { "$w16", 16 + FP_REG_FIRST }, \ + { "$w17", 17 + FP_REG_FIRST }, \ + { "$w18", 18 + FP_REG_FIRST }, \ + { "$w19", 19 + FP_REG_FIRST }, \ + { "$w20", 20 + FP_REG_FIRST }, \ + { "$w21", 21 + FP_REG_FIRST }, \ + { "$w22", 22 + FP_REG_FIRST }, \ + { "$w23", 23 + FP_REG_FIRST }, \ + { "$w24", 24 + FP_REG_FIRST }, \ + { "$w25", 25 + FP_REG_FIRST }, \ + { "$w26", 26 + FP_REG_FIRST }, \ + { "$w27", 27 + FP_REG_FIRST }, \ + { "$w28", 28 + FP_REG_FIRST }, \ + { "$w29", 29 + FP_REG_FIRST }, \ + { "$w30", 30 + FP_REG_FIRST }, \ + { "$w31", 31 + FP_REG_FIRST } \ +} + +#define DBR_OUTPUT_SEQEND(STREAM) \ +do \ + { \ + /* Undo the effect of '%*'. */ \ + mips_pop_asm_switch (&mips_nomacro); \ + mips_pop_asm_switch (&mips_noreorder); \ + /* Emit a blank line after the delay slot for emphasis. */ \ + fputs ("\n", STREAM); \ + } \ +while (0) + +/* The MIPS implementation uses some labels for its own purpose. The + following lists what labels are created, and are all formed by the + pattern $L[a-z].*. The machine independent portion of GCC creates + labels matching: $L[A-Z][0-9]+ and $L[0-9]+. + + LM[0-9]+ Silicon Graphics/ECOFF stabs label before each stmt. + $Lb[0-9]+ Begin blocks for MIPS debug support + $Lc[0-9]+ Label for use in s operation. + $Le[0-9]+ End blocks for MIPS debug support */ + +#undef ASM_DECLARE_OBJECT_NAME +#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \ + mips_declare_object (STREAM, NAME, "", ":\n") + +/* Globalizing directive for a label. */ +#define GLOBAL_ASM_OP "\t.globl\t" + +/* This says how to define a global common symbol. */ + +#define ASM_OUTPUT_ALIGNED_DECL_COMMON mips_output_aligned_decl_common + +/* This says how to define a local common symbol (i.e., not visible to + linker). */ + +#ifndef ASM_OUTPUT_ALIGNED_LOCAL +#define ASM_OUTPUT_ALIGNED_LOCAL(STREAM, NAME, SIZE, ALIGN) \ + mips_declare_common_object (STREAM, NAME, "\n\t.lcomm\t", SIZE, ALIGN, false) +#endif + +/* This says how to output an external. It would be possible not to + output anything and let undefined symbol become external. However + the assembler uses length information on externals to allocate in + data/sdata bss/sbss, thereby saving exec time. */ + +#undef ASM_OUTPUT_EXTERNAL +#define ASM_OUTPUT_EXTERNAL(STREAM,DECL,NAME) \ + mips_output_external(STREAM,DECL,NAME) + +/* This is how to declare a function name. The actual work of + emitting the label is moved to function_prologue, so that we can + get the line number correctly emitted before the .ent directive, + and after any .file directives. Define as empty so that the function + is not declared before the .ent directive elsewhere. */ + +#undef ASM_DECLARE_FUNCTION_NAME +#define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL) + +/* This is how to store into the string LABEL + the symbol_ref name of an internal numbered label where + PREFIX is the class of label and NUM is the number within the class. + This is suitable for output with `assemble_name'. */ + +#undef ASM_GENERATE_INTERNAL_LABEL +#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ + sprintf ((LABEL), "*%s%s%ld", (LOCAL_LABEL_PREFIX), (PREFIX), (long)(NUM)) + +/* Print debug labels as "foo = ." rather than "foo:" because they should + represent a byte pointer rather than an ISA-encoded address. This is + particularly important for code like: + + $LFBxxx = . + .cfi_startproc + ... + .section .gcc_except_table,... + ... + .uleb128 foo-$LFBxxx + + The .uleb128 requies $LFBxxx to match the FDE start address, which is + likewise a byte pointer rather than an ISA-encoded address. + + At the time of writing, this hook is not used for the function end + label: + + $LFExxx: + .end foo + + But this doesn't matter, because GAS doesn't treat a pre-.end label + as a MIPS16 one anyway. */ + +#define ASM_OUTPUT_DEBUG_LABEL(FILE, PREFIX, NUM) \ + fprintf (FILE, "%s%s%d = .\n", LOCAL_LABEL_PREFIX, PREFIX, NUM) + +/* This is how to output an element of a case-vector that is absolute. */ + +#define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \ + fprintf (STREAM, "\t%s\t%sL%d\n", \ + ptr_mode == DImode ? ".dword" : ".word", \ + LOCAL_LABEL_PREFIX, \ + VALUE) + +/* This is how to output an element of a case-vector. We can make the + entries PC-relative in MIPS16 code and GP-relative when .gp(d)word + is supported. */ + +#define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \ +do { \ + if (TARGET_MIPS16_SHORT_JUMP_TABLES) \ + { \ + if (GET_MODE (BODY) == HImode) \ + fprintf (STREAM, "\t.half\t%sL%d-%sL%d\n", \ + LOCAL_LABEL_PREFIX, VALUE, LOCAL_LABEL_PREFIX, REL); \ + else \ + fprintf (STREAM, "\t.word\t%sL%d-%sL%d\n", \ + LOCAL_LABEL_PREFIX, VALUE, LOCAL_LABEL_PREFIX, REL); \ + } \ + else if (TARGET_GPWORD) \ + fprintf (STREAM, "\t%s\t%sL%d\n", \ + ptr_mode == DImode ? ".gpdword" : ".gpword", \ + LOCAL_LABEL_PREFIX, VALUE); \ + else if (TARGET_RTP_PIC) \ + { \ + /* Make the entry relative to the start of the function. */ \ + rtx fnsym = XEXP (DECL_RTL (current_function_decl), 0); \ + fprintf (STREAM, "\t%s\t%sL%d-", \ + Pmode == DImode ? ".dword" : ".word", \ + LOCAL_LABEL_PREFIX, VALUE); \ + assemble_name (STREAM, XSTR (fnsym, 0)); \ + fprintf (STREAM, "\n"); \ + } \ + else \ + fprintf (STREAM, "\t%s\t%sL%d\n", \ + ptr_mode == DImode ? ".dword" : ".word", \ + LOCAL_LABEL_PREFIX, VALUE); \ +} while (0) + +/* Mark inline jump tables as data for the purpose of disassembly. For + simplicity embed the jump table's label number in the local symbol + produced so that multiple jump tables within a single function end + up marked with unique symbols. Retain the alignment setting from + `elfos.h' as we are replacing the definition from there. */ + +#undef ASM_OUTPUT_BEFORE_CASE_LABEL +#define ASM_OUTPUT_BEFORE_CASE_LABEL(STREAM, PREFIX, NUM, TABLE) \ + do \ + { \ + ASM_OUTPUT_ALIGN ((STREAM), 2); \ + if (JUMP_TABLES_IN_TEXT_SECTION) \ + mips_set_text_contents_type (STREAM, "__jump_", NUM, FALSE); \ + } \ + while (0); + +/* Reset text marking to code after an inline jump table. Like with + the beginning of a jump table use the label number to keep symbols + unique. */ + +#define ASM_OUTPUT_CASE_END(STREAM, NUM, TABLE) \ + do \ + if (JUMP_TABLES_IN_TEXT_SECTION) \ + mips_set_text_contents_type (STREAM, "__jend_", NUM, TRUE); \ + while (0); + +/* This is how to output an assembler line + that says to advance the location counter + to a multiple of 2**LOG bytes. */ + +#define ASM_OUTPUT_ALIGN(STREAM,LOG) \ + fprintf (STREAM, "\t.align\t%d\n", (LOG)) + +/* This is how to output an assembler line to advance the location + counter by SIZE bytes. */ + +#undef ASM_OUTPUT_SKIP +#define ASM_OUTPUT_SKIP(STREAM,SIZE) \ + fprintf (STREAM, "\t.space\t" HOST_WIDE_INT_PRINT_UNSIGNED"\n", (SIZE)) + +/* This is how to output a string. */ +#undef ASM_OUTPUT_ASCII +#define ASM_OUTPUT_ASCII mips_output_ascii + + +/* Default to -G 8 */ +#ifndef MIPS_DEFAULT_GVALUE +#define MIPS_DEFAULT_GVALUE 8 +#endif + +/* Define the strings to put out for each section in the object file. */ +#define TEXT_SECTION_ASM_OP "\t.text" /* instructions */ +#define DATA_SECTION_ASM_OP "\t.data" /* large data */ + +#undef READONLY_DATA_SECTION_ASM_OP +#define READONLY_DATA_SECTION_ASM_OP "\t.rdata" /* read-only data */ + +#define ASM_OUTPUT_REG_PUSH(STREAM,REGNO) \ +do \ + { \ + fprintf (STREAM, "\t%s\t%s,%s,-8\n\t%s\t%s,0(%s)\n", \ + TARGET_64BIT ? "daddiu" : "addiu", \ + reg_names[STACK_POINTER_REGNUM], \ + reg_names[STACK_POINTER_REGNUM], \ + TARGET_64BIT ? "sd" : "sw", \ + reg_names[REGNO], \ + reg_names[STACK_POINTER_REGNUM]); \ + } \ +while (0) + +#define ASM_OUTPUT_REG_POP(STREAM,REGNO) \ +do \ + { \ + mips_push_asm_switch (&mips_noreorder); \ + fprintf (STREAM, "\t%s\t%s,0(%s)\n\t%s\t%s,%s,8\n", \ + TARGET_64BIT ? "ld" : "lw", \ + reg_names[REGNO], \ + reg_names[STACK_POINTER_REGNUM], \ + TARGET_64BIT ? "daddu" : "addu", \ + reg_names[STACK_POINTER_REGNUM], \ + reg_names[STACK_POINTER_REGNUM]); \ + mips_pop_asm_switch (&mips_noreorder); \ + } \ +while (0) + +/* How to start an assembler comment. + The leading space is important (the mips native assembler requires it). */ +#ifndef ASM_COMMENT_START +#define ASM_COMMENT_START " #" +#endif + +#undef SIZE_TYPE +#define SIZE_TYPE (POINTER_SIZE == 64 ? "long unsigned int" : "unsigned int") + +#undef PTRDIFF_TYPE +#define PTRDIFF_TYPE (POINTER_SIZE == 64 ? "long int" : "int") + +/* The minimum alignment of any expanded block move. */ +#define MIPS_MIN_MOVE_MEM_ALIGN 16 + +/* The maximum number of bytes that can be copied by one iteration of + a movmemsi loop; see mips_block_move_loop. */ +#define MIPS_MAX_MOVE_BYTES_PER_LOOP_ITER \ + (UNITS_PER_WORD * 4) + +/* The maximum number of bytes that can be copied by a straight-line + implementation of movmemsi; see mips_block_move_straight. We want + to make sure that any loop-based implementation will iterate at + least twice. */ +#define MIPS_MAX_MOVE_BYTES_STRAIGHT \ + (MIPS_MAX_MOVE_BYTES_PER_LOOP_ITER * 2) + +/* The base cost of a memcpy call, for MOVE_RATIO and friends. These + values were determined experimentally by benchmarking with CSiBE. + In theory, the call overhead is higher for TARGET_ABICALLS (especially + for o32 where we have to restore $gp afterwards as well as make an + indirect call), but in practice, bumping this up higher for + TARGET_ABICALLS doesn't make much difference to code size. */ + +#define MIPS_CALL_RATIO 8 + +/* Any loop-based implementation of movmemsi will have at least + MIPS_MAX_MOVE_BYTES_STRAIGHT / UNITS_PER_WORD memory-to-memory + moves, so allow individual copies of fewer elements. + + When movmemsi is not available, use a value approximating + the length of a memcpy call sequence, so that move_by_pieces + will generate inline code if it is shorter than a function call. + Since move_by_pieces_ninsns counts memory-to-memory moves, but + we'll have to generate a load/store pair for each, halve the + value of MIPS_CALL_RATIO to take that into account. */ + +#define MOVE_RATIO(speed) \ + (HAVE_movmemsi \ + ? MIPS_MAX_MOVE_BYTES_STRAIGHT / MOVE_MAX \ + : MIPS_CALL_RATIO / 2) + +/* For CLEAR_RATIO, when optimizing for size, give a better estimate + of the length of a memset call, but use the default otherwise. */ + +#define CLEAR_RATIO(speed)\ + ((speed) ? 15 : MIPS_CALL_RATIO) + +/* This is similar to CLEAR_RATIO, but for a non-zero constant, so when + optimizing for size adjust the ratio to account for the overhead of + loading the constant and replicating it across the word. */ + +#define SET_RATIO(speed) \ + ((speed) ? 15 : MIPS_CALL_RATIO - 2) + +/* Since the bits of the _init and _fini function is spread across + many object files, each potentially with its own GP, we must assume + we need to load our GP. We don't preserve $gp or $ra, since each + init/fini chunk is supposed to initialize $gp, and crti/crtn + already take care of preserving $ra and, when appropriate, $gp. */ +#if (defined _ABIO32 && _MIPS_SIM == _ABIO32) +#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ + asm (SECTION_OP "\n\ + .set push\n\ + .set nomips16\n\ + .set noreorder\n\ + bal 1f\n\ + nop\n\ +1: .cpload $31\n\ + .set reorder\n\ + la $25, " USER_LABEL_PREFIX #FUNC "\n\ + jalr $25\n\ + .set pop\n\ + " TEXT_SECTION_ASM_OP); +#elif (defined _ABIN32 && _MIPS_SIM == _ABIN32) +#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ + asm (SECTION_OP "\n\ + .set push\n\ + .set nomips16\n\ + .set noreorder\n\ + bal 1f\n\ + nop\n\ +1: .set reorder\n\ + .cpsetup $31, $2, 1b\n\ + la $25, " USER_LABEL_PREFIX #FUNC "\n\ + jalr $25\n\ + .set pop\n\ + " TEXT_SECTION_ASM_OP); +#elif (defined _ABI64 && _MIPS_SIM == _ABI64) +#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ + asm (SECTION_OP "\n\ + .set push\n\ + .set nomips16\n\ + .set noreorder\n\ + bal 1f\n\ + nop\n\ +1: .set reorder\n\ + .cpsetup $31, $2, 1b\n\ + dla $25, " USER_LABEL_PREFIX #FUNC "\n\ + jalr $25\n\ + .set pop\n\ + " TEXT_SECTION_ASM_OP); +#endif + +#ifndef HAVE_AS_TLS +#define HAVE_AS_TLS 0 +#endif + +#ifndef HAVE_AS_NAN +#define HAVE_AS_NAN 0 +#endif + +#ifndef USED_FOR_TARGET +/* Information about ".set noFOO; ...; .set FOO" blocks. */ +struct mips_asm_switch { + /* The FOO in the description above. */ + const char *name; + + /* The current block nesting level, or 0 if we aren't in a block. */ + int nesting_level; +}; + +extern const enum reg_class mips_regno_to_class[]; +extern bool mips_hard_regno_mode_ok[][FIRST_PSEUDO_REGISTER]; +extern const char *current_function_file; /* filename current function is in */ +extern int num_source_filenames; /* current .file # */ +extern struct mips_asm_switch mips_noreorder; +extern struct mips_asm_switch mips_nomacro; +extern struct mips_asm_switch mips_noat; +extern int mips_dbx_regno[]; +extern int mips_dwarf_regno[]; +extern bool mips_split_p[]; +extern bool mips_split_hi_p[]; +extern bool mips_use_pcrel_pool_p[]; +extern const char *mips_lo_relocs[]; +extern const char *mips_hi_relocs[]; +extern enum processor mips_arch; /* which cpu to codegen for */ +extern enum processor mips_tune; /* which cpu to schedule for */ +extern int mips_isa; /* architectural level */ +extern int mips_isa_rev; +extern const struct mips_cpu_info *mips_arch_info; +extern const struct mips_cpu_info *mips_tune_info; +extern unsigned int mips_base_compression_flags; +extern GTY(()) struct target_globals *mips16_globals; +extern GTY(()) struct target_globals *micromips_globals; + +/* Information about a function's frame layout. */ +struct GTY(()) mips_frame_info { + /* The size of the frame in bytes. */ + HOST_WIDE_INT total_size; + + /* The number of bytes allocated to variables. */ + HOST_WIDE_INT var_size; + + /* The number of bytes allocated to outgoing function arguments. */ + HOST_WIDE_INT args_size; + + /* The number of bytes allocated to the .cprestore slot, or 0 if there + is no such slot. */ + HOST_WIDE_INT cprestore_size; + + /* Bit X is set if the function saves or restores GPR X. */ + unsigned int mask; + + /* Likewise FPR X. */ + unsigned int fmask; + + /* Likewise doubleword accumulator X ($acX). */ + unsigned int acc_mask; + + /* The number of GPRs, FPRs, doubleword accumulators and COP0 + registers saved. */ + unsigned int num_gp; + unsigned int num_fp; + unsigned int num_acc; + unsigned int num_cop0_regs; + + /* The offset of the topmost GPR, FPR, accumulator and COP0-register + save slots from the top of the frame, or zero if no such slots are + needed. */ + HOST_WIDE_INT gp_save_offset; + HOST_WIDE_INT fp_save_offset; + HOST_WIDE_INT acc_save_offset; + HOST_WIDE_INT cop0_save_offset; + + /* Likewise, but giving offsets from the bottom of the frame. */ + HOST_WIDE_INT gp_sp_offset; + HOST_WIDE_INT fp_sp_offset; + HOST_WIDE_INT acc_sp_offset; + HOST_WIDE_INT cop0_sp_offset; + + /* Similar, but the value passed to _mcount. */ + HOST_WIDE_INT ra_fp_offset; + + /* The offset of arg_pointer_rtx from the bottom of the frame. */ + HOST_WIDE_INT arg_pointer_offset; + + /* The offset of hard_frame_pointer_rtx from the bottom of the frame. */ + HOST_WIDE_INT hard_frame_pointer_offset; +}; + +/* Enumeration for masked vectored (VI) and non-masked (EIC) interrupts. */ +enum mips_int_mask +{ + INT_MASK_EIC = -1, + INT_MASK_SW0 = 0, + INT_MASK_SW1 = 1, + INT_MASK_HW0 = 2, + INT_MASK_HW1 = 3, + INT_MASK_HW2 = 4, + INT_MASK_HW3 = 5, + INT_MASK_HW4 = 6, + INT_MASK_HW5 = 7 +}; + +/* Enumeration to mark the existence of the shadow register set. + SHADOW_SET_INTSTACK indicates a shadow register set with a valid stack + pointer. */ +enum mips_shadow_set +{ + SHADOW_SET_NO, + SHADOW_SET_YES, + SHADOW_SET_INTSTACK +}; + +struct GTY(()) machine_function { + /* The next floating-point condition-code register to allocate + for ISA_HAS_8CC targets, relative to ST_REG_FIRST. */ + unsigned int next_fcc; + + /* The register returned by mips16_gp_pseudo_reg; see there for details. */ + rtx mips16_gp_pseudo_rtx; + + /* The number of extra stack bytes taken up by register varargs. + This area is allocated by the callee at the very top of the frame. */ + int varargs_size; + + /* The current frame information, calculated by mips_compute_frame_info. */ + struct mips_frame_info frame; + + /* The register to use as the function's global pointer, or INVALID_REGNUM + if the function doesn't need one. */ + unsigned int global_pointer; + + /* How many instructions it takes to load a label into $AT, or 0 if + this property hasn't yet been calculated. */ + unsigned int load_label_num_insns; + + /* True if mips_adjust_insn_length should ignore an instruction's + hazard attribute. */ + bool ignore_hazard_length_p; + + /* True if the whole function is suitable for .set noreorder and + .set nomacro. */ + bool all_noreorder_p; + + /* True if the function has "inflexible" and "flexible" references + to the global pointer. See mips_cfun_has_inflexible_gp_ref_p + and mips_cfun_has_flexible_gp_ref_p for details. */ + bool has_inflexible_gp_insn_p; + bool has_flexible_gp_insn_p; + + /* True if the function's prologue must load the global pointer + value into pic_offset_table_rtx and store the same value in + the function's cprestore slot (if any). Even if this value + is currently false, we may decide to set it to true later; + see mips_must_initialize_gp_p () for details. */ + bool must_initialize_gp_p; + + /* True if the current function must restore $gp after any potential + clobber. This value is only meaningful during the first post-epilogue + split_insns pass; see mips_must_initialize_gp_p () for details. */ + bool must_restore_gp_when_clobbered_p; + + /* True if this is an interrupt handler. */ + bool interrupt_handler_p; + + /* Records the way in which interrupts should be masked. Only used if + interrupts are not kept masked. */ + enum mips_int_mask int_mask; + + /* Records if this is an interrupt handler that uses shadow registers. */ + enum mips_shadow_set use_shadow_register_set; + + /* True if this is an interrupt handler that should keep interrupts + masked. */ + bool keep_interrupts_masked_p; + + /* True if this is an interrupt handler that should use DERET + instead of ERET. */ + bool use_debug_exception_return_p; + + /* True if at least one of the formal parameters to a function must be + written to the frame header (probably so its address can be taken). */ + bool does_not_use_frame_header; + + /* True if none of the functions that are called by this function need + stack space allocated for their arguments. */ + bool optimize_call_stack; + + /* True if one of the functions calling this function may not allocate + a frame header. */ + bool callers_may_not_allocate_frame; + + /* True if GCC stored callee saved registers in the frame header. */ + bool use_frame_header_for_callee_saved_regs; +}; +#endif + +/* Enable querying of DFA units. */ +#define CPU_UNITS_QUERY 1 + +#define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \ + mips_final_prescan_insn (INSN, OPVEC, NOPERANDS) + +/* As on most targets, we want the .eh_frame section to be read-only where + possible. And as on most targets, this means two things: + + (a) Non-locally-binding pointers must have an indirect encoding, + so that the addresses in the .eh_frame section itself become + locally-binding. + + (b) A shared library's .eh_frame section must encode locally-binding + pointers in a relative (relocation-free) form. + + However, MIPS has traditionally not allowed directives like: + + .long x-. + + in cases where "x" is in a different section, or is not defined in the + same assembly file. We are therefore unable to emit the PC-relative + form required by (b) at assembly time. + + Fortunately, the linker is able to convert absolute addresses into + PC-relative addresses on our behalf. Unfortunately, only certain + versions of the linker know how to do this for indirect pointers, + and for personality data. We must fall back on using writable + .eh_frame sections for shared libraries if the linker does not + support this feature. */ +#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \ + (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_absptr) + +/* For switching between MIPS16 and non-MIPS16 modes. */ +#define SWITCHABLE_TARGET 1 + +/* Several named MIPS patterns depend on Pmode. These patterns have the + form _si for Pmode == SImode and _di for Pmode == DImode. + Add the appropriate suffix to generator function NAME and invoke it + with arguments ARGS. */ +#define PMODE_INSN(NAME, ARGS) \ + (Pmode == SImode ? NAME ## _si ARGS : NAME ## _di ARGS) + +/* If we are *not* using multilibs and the default ABI is not ABI_32 we + need to change these from /lib and /usr/lib. */ +#if MIPS_ABI_DEFAULT == ABI_N32 +#define STANDARD_STARTFILE_PREFIX_1 "/lib32/" +#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib32/" +#elif MIPS_ABI_DEFAULT == ABI_64 +#define STANDARD_STARTFILE_PREFIX_1 "/lib64/" +#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib64/" +#endif + +/* Load store bonding is not supported by micromips and fix_24k. The + performance can be degraded for those targets. Hence, do not bond for + micromips or fix_24k. */ +#define ENABLE_LD_ST_PAIRS \ + (TARGET_LOAD_STORE_PAIRS && (TUNE_P5600 || TUNE_I6400) \ + && !TARGET_MICROMIPS && !TARGET_FIX_24K) diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/vxworks-dummy.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/vxworks-dummy.h new file mode 100644 index 0000000..13b4785 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/config/vxworks-dummy.h @@ -0,0 +1,40 @@ +/* Dummy definitions of VxWorks-related macros + Copyright (C) 2007-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +/* True if we're targeting VxWorks. */ +#ifndef TARGET_VXWORKS +#define TARGET_VXWORKS 0 +#endif + +/* True if generating code for a VxWorks RTP. */ +#ifndef TARGET_VXWORKS_RTP +#define TARGET_VXWORKS_RTP false +#endif + +/* The symbol that points to an RTP's table of GOTs. */ +#define VXWORKS_GOTT_BASE (gcc_unreachable (), "") + +/* The symbol that holds the index of the current module's GOT in + VXWORKS_GOTT_BASE. */ +#define VXWORKS_GOTT_INDEX (gcc_unreachable (), "") diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/configargs.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/configargs.h new file mode 100644 index 0000000..fbdffbf --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/configargs.h @@ -0,0 +1,7 @@ +/* Generated automatically. */ +static const char configuration_arguments[] = "./configure --prefix=/opt/mipsel-linux-uclibc --sysconfdir=/opt/mipsel-linux-uclibc/etc --enable-static --target=mipsel-buildroot-linux-uclibc --with-sysroot=/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/sysroot --disable-__cxa_atexit --with-gnu-ld --disable-libssp --disable-multilib --with-gmp=/opt/mipsel-linux-uclibc --with-mpc=/opt/mipsel-linux-uclibc --with-mpfr=/opt/mipsel-linux-uclibc --with-pkgversion='Buildroot 2018.02.11' --with-bugurl=http://bugs.buildroot.net/ --disable-libquadmath --disable-libsanitizer --enable-tls --disable-libmudflap --enable-threads --without-isl --without-cloog --disable-decimal-float --with-arch=mips32 --with-abi=32 --with-nan=legacy --with-fp-32=32 --enable-languages=c,c++ --with-build-time-tools=/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/bin --enable-shared --disable-libgomp"; +static const char thread_model[] = "posix"; + +static const struct { + const char *name, *value; +} configure_default_options[] = { { "abi", "32" }, { "arch", "mips32" }, { "nan", "legacy" }, { "fp_32", "32" }, { "llsc", "llsc" } }; diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/context.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/context.h new file mode 100644 index 0000000..e9113a4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/context.h @@ -0,0 +1,63 @@ +/* context.h - Holder for global state + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_CONTEXT_H +#define GCC_CONTEXT_H + +namespace gcc { + +class pass_manager; +class dump_manager; + +/* GCC's internal state can be divided into zero or more + "parallel universe" of state; an instance of this class is one such + context of state. */ +class context +{ +public: + context (); + ~context (); + + /* The flag shows if there are symbols to be streamed for offloading. */ + bool have_offload; + + /* Pass-management. */ + + pass_manager *get_passes () { gcc_assert (m_passes); return m_passes; } + + /* Handling dump files. */ + + dump_manager *get_dumps () {gcc_assert (m_dumps); return m_dumps; } + +private: + /* Pass-management. */ + pass_manager *m_passes; + + /* Dump files. */ + dump_manager *m_dumps; + +}; // class context + +} // namespace gcc + +/* The global singleton context aka "g". + (the name is chosen to be easy to type in a debugger). */ +extern gcc::context *g; + +#endif /* ! GCC_CONTEXT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/convert.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/convert.h new file mode 100644 index 0000000..76ab2c7 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/convert.h @@ -0,0 +1,43 @@ +/* Definition of functions in convert.c. + Copyright (C) 1993-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_CONVERT_H +#define GCC_CONVERT_H + +extern tree convert_to_integer (tree, tree); +extern tree convert_to_integer_maybe_fold (tree, tree, bool); +extern tree convert_to_pointer (tree, tree); +extern tree convert_to_pointer_maybe_fold (tree, tree, bool); +extern tree convert_to_real (tree, tree); +extern tree convert_to_real_maybe_fold (tree, tree, bool); +extern tree convert_to_fixed (tree, tree); +extern tree convert_to_complex (tree, tree); +extern tree convert_to_complex_maybe_fold (tree, tree, bool); +extern tree convert_to_vector (tree, tree); + +extern inline tree convert_to_integer_nofold (tree t, tree x) +{ return convert_to_integer_maybe_fold (t, x, false); } +extern inline tree convert_to_pointer_nofold (tree t, tree x) +{ return convert_to_pointer_maybe_fold (t, x, false); } +extern inline tree convert_to_real_nofold (tree t, tree x) +{ return convert_to_real_maybe_fold (t, x, false); } +extern inline tree convert_to_complex_nofold (tree t, tree x) +{ return convert_to_complex_maybe_fold (t, x, false); } + +#endif /* GCC_CONVERT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/coretypes.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/coretypes.h new file mode 100644 index 0000000..8eb33cc --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/coretypes.h @@ -0,0 +1,376 @@ +/* GCC core type declarations. + Copyright (C) 2002-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +/* Provide forward declarations of core types which are referred to by + most of the compiler. This allows header files to use these types + (e.g. in function prototypes) without concern for whether the full + definitions are visible. Some other declarations that need to be + universally visible are here, too. + + In the context of tconfig.h, most of these have special definitions + which prevent them from being used except in further type + declarations. This is a kludge; the right thing is to avoid + including the "tm.h" header set in the context of tconfig.h, but + we're not there yet. */ + +#ifndef GCC_CORETYPES_H +#define GCC_CORETYPES_H + +#ifndef GTY +#define GTY(x) /* nothing - marker for gengtype */ +#endif + +#ifndef USED_FOR_TARGET + +typedef int64_t gcov_type; +typedef uint64_t gcov_type_unsigned; + +struct bitmap_head; +typedef struct bitmap_head *bitmap; +typedef const struct bitmap_head *const_bitmap; +struct simple_bitmap_def; +typedef struct simple_bitmap_def *sbitmap; +typedef const struct simple_bitmap_def *const_sbitmap; +struct rtx_def; +typedef struct rtx_def *rtx; +typedef const struct rtx_def *const_rtx; + +/* Subclasses of rtx_def, using indentation to show the class + hierarchy, along with the relevant invariant. + Where possible, keep this list in the same order as in rtl.def. */ +class rtx_def; + class rtx_expr_list; /* GET_CODE (X) == EXPR_LIST */ + class rtx_insn_list; /* GET_CODE (X) == INSN_LIST */ + class rtx_sequence; /* GET_CODE (X) == SEQUENCE */ + class rtx_insn; + class rtx_debug_insn; /* DEBUG_INSN_P (X) */ + class rtx_nonjump_insn; /* NONJUMP_INSN_P (X) */ + class rtx_jump_insn; /* JUMP_P (X) */ + class rtx_call_insn; /* CALL_P (X) */ + class rtx_jump_table_data; /* JUMP_TABLE_DATA_P (X) */ + class rtx_barrier; /* BARRIER_P (X) */ + class rtx_code_label; /* LABEL_P (X) */ + class rtx_note; /* NOTE_P (X) */ + +struct rtvec_def; +typedef struct rtvec_def *rtvec; +typedef const struct rtvec_def *const_rtvec; +struct hwivec_def; +typedef struct hwivec_def *hwivec; +typedef const struct hwivec_def *const_hwivec; +union tree_node; +typedef union tree_node *tree; +typedef const union tree_node *const_tree; +struct gimple; +typedef gimple *gimple_seq; +struct gimple_stmt_iterator; + +/* Forward decls for leaf gimple subclasses (for individual gimple codes). + Keep this in the same order as the corresponding codes in gimple.def. */ + +struct gcond; +struct gdebug; +struct ggoto; +struct glabel; +struct gswitch; +struct gassign; +struct gasm; +struct gcall; +struct gtransaction; +struct greturn; +struct gbind; +struct gcatch; +struct geh_filter; +struct geh_mnt; +struct geh_else; +struct gresx; +struct geh_dispatch; +struct gphi; +struct gtry; +struct gomp_atomic_load; +struct gomp_atomic_store; +struct gomp_continue; +struct gomp_critical; +struct gomp_ordered; +struct gomp_for; +struct gomp_parallel; +struct gomp_task; +struct gomp_sections; +struct gomp_single; +struct gomp_target; +struct gomp_teams; + +union section; +typedef union section section; +struct gcc_options; +struct cl_target_option; +struct cl_optimization; +struct cl_option; +struct cl_decoded_option; +struct cl_option_handlers; +struct diagnostic_context; +struct pretty_printer; + +/* Address space number for named address space support. */ +typedef unsigned char addr_space_t; + +/* The value of addr_space_t that represents the generic address space. */ +#define ADDR_SPACE_GENERIC 0 +#define ADDR_SPACE_GENERIC_P(AS) ((AS) == ADDR_SPACE_GENERIC) + +/* The major intermediate representations of GCC. */ +enum ir_type { + IR_GIMPLE, + IR_RTL_CFGRTL, + IR_RTL_CFGLAYOUT +}; + +/* Provide forward struct declaration so that we don't have to include + all of cpplib.h whenever a random prototype includes a pointer. + Note that the cpp_reader and cpp_token typedefs remain part of + cpplib.h. */ + +struct cpp_reader; +struct cpp_token; + +/* The thread-local storage model associated with a given VAR_DECL + or SYMBOL_REF. This isn't used much, but both trees and RTL refer + to it, so it's here. */ +enum tls_model { + TLS_MODEL_NONE, + TLS_MODEL_EMULATED, + TLS_MODEL_REAL, + TLS_MODEL_GLOBAL_DYNAMIC = TLS_MODEL_REAL, + TLS_MODEL_LOCAL_DYNAMIC, + TLS_MODEL_INITIAL_EXEC, + TLS_MODEL_LOCAL_EXEC +}; + +/* Types of ABI for an offload compiler. */ +enum offload_abi { + OFFLOAD_ABI_UNSET, + OFFLOAD_ABI_LP64, + OFFLOAD_ABI_ILP32 +}; + +/* Types of profile update methods. */ +enum profile_update { + PROFILE_UPDATE_SINGLE, + PROFILE_UPDATE_ATOMIC, + PROFILE_UPDATE_PREFER_ATOMIC +}; + +/* Types of unwind/exception handling info that can be generated. */ + +enum unwind_info_type +{ + UI_NONE, + UI_SJLJ, + UI_DWARF2, + UI_TARGET, + UI_SEH +}; + +/* Callgraph node profile representation. */ +enum node_frequency { + /* This function most likely won't be executed at all. + (set only when profile feedback is available or via function attribute). */ + NODE_FREQUENCY_UNLIKELY_EXECUTED, + /* For functions that are known to be executed once (i.e. constructors, destructors + and main function. */ + NODE_FREQUENCY_EXECUTED_ONCE, + /* The default value. */ + NODE_FREQUENCY_NORMAL, + /* Optimize this function hard + (set only when profile feedback is available or via function attribute). */ + NODE_FREQUENCY_HOT +}; + +/* Ways of optimizing code. */ +enum optimization_type { + /* Prioritize speed over size. */ + OPTIMIZE_FOR_SPEED, + + /* Only do things that are good for both size and speed. */ + OPTIMIZE_FOR_BOTH, + + /* Prioritize size over speed. */ + OPTIMIZE_FOR_SIZE +}; + +/* Possible initialization status of a variable. When requested + by the user, this information is tracked and recorded in the DWARF + debug information, along with the variable's location. */ +enum var_init_status +{ + VAR_INIT_STATUS_UNKNOWN, + VAR_INIT_STATUS_UNINITIALIZED, + VAR_INIT_STATUS_INITIALIZED +}; + +/* Names for the different levels of -Wstrict-overflow=N. The numeric + values here correspond to N. */ +enum warn_strict_overflow_code +{ + /* Overflow warning that should be issued with -Wall: a questionable + construct that is easy to avoid even when using macros. Example: + folding (x + CONSTANT > x) to 1. */ + WARN_STRICT_OVERFLOW_ALL = 1, + /* Overflow warning about folding a comparison to a constant because + of undefined signed overflow, other than cases covered by + WARN_STRICT_OVERFLOW_ALL. Example: folding (abs (x) >= 0) to 1 + (this is false when x == INT_MIN). */ + WARN_STRICT_OVERFLOW_CONDITIONAL = 2, + /* Overflow warning about changes to comparisons other than folding + them to a constant. Example: folding (x + 1 > 1) to (x > 0). */ + WARN_STRICT_OVERFLOW_COMPARISON = 3, + /* Overflow warnings not covered by the above cases. Example: + folding ((x * 10) / 5) to (x * 2). */ + WARN_STRICT_OVERFLOW_MISC = 4, + /* Overflow warnings about reducing magnitude of constants in + comparison. Example: folding (x + 2 > y) to (x + 1 >= y). */ + WARN_STRICT_OVERFLOW_MAGNITUDE = 5 +}; + +/* The type of an alias set. Code currently assumes that variables of + this type can take the values 0 (the alias set which aliases + everything) and -1 (sometimes indicating that the alias set is + unknown, sometimes indicating a memory barrier) and -2 (indicating + that the alias set should be set to a unique value but has not been + set yet). */ +typedef int alias_set_type; + +struct edge_def; +typedef struct edge_def *edge; +typedef const struct edge_def *const_edge; +struct basic_block_def; +typedef struct basic_block_def *basic_block; +typedef const struct basic_block_def *const_basic_block; + +#if !defined (GENERATOR_FILE) +# define OBSTACK_CHUNK_SIZE memory_block_pool::block_size +# define obstack_chunk_alloc mempool_obstack_chunk_alloc +# define obstack_chunk_free mempool_obstack_chunk_free +#else +# define OBSTACK_CHUNK_SIZE 0 +# define obstack_chunk_alloc xmalloc +# define obstack_chunk_free free +#endif + +#define gcc_obstack_init(OBSTACK) \ + obstack_specify_allocation ((OBSTACK), OBSTACK_CHUNK_SIZE, 0, \ + obstack_chunk_alloc, \ + obstack_chunk_free) + +/* enum reg_class is target specific, so it should not appear in + target-independent code or interfaces, like the target hook declarations + in target.h. */ +typedef int reg_class_t; + +class rtl_opt_pass; + +namespace gcc { + class context; +} + +typedef std::pair tree_pair; + +#else + +struct _dont_use_rtx_here_; +struct _dont_use_rtvec_here_; +struct _dont_use_rtx_insn_here_; +union _dont_use_tree_here_; +#define rtx struct _dont_use_rtx_here_ * +#define const_rtx struct _dont_use_rtx_here_ * +#define rtvec struct _dont_use_rtvec_here * +#define const_rtvec struct _dont_use_rtvec_here * +#define rtx_insn struct _dont_use_rtx_insn_here_ +#define tree union _dont_use_tree_here_ * +#define const_tree union _dont_use_tree_here_ * + +#endif + +/* Classes of functions that compiler needs to check + whether they are present at the runtime or not. */ +enum function_class { + function_c94, + function_c99_misc, + function_c99_math_complex, + function_sincos, + function_c11_misc +}; + +/* Enumerate visibility settings. This is deliberately ordered from most + to least visibility. */ +enum symbol_visibility +{ + VISIBILITY_DEFAULT, + VISIBILITY_PROTECTED, + VISIBILITY_HIDDEN, + VISIBILITY_INTERNAL +}; + +/* enums used by the targetm.excess_precision hook. */ + +enum flt_eval_method +{ + FLT_EVAL_METHOD_UNPREDICTABLE = -1, + FLT_EVAL_METHOD_PROMOTE_TO_FLOAT = 0, + FLT_EVAL_METHOD_PROMOTE_TO_DOUBLE = 1, + FLT_EVAL_METHOD_PROMOTE_TO_LONG_DOUBLE = 2, + FLT_EVAL_METHOD_PROMOTE_TO_FLOAT16 = 16 +}; + +enum excess_precision_type +{ + EXCESS_PRECISION_TYPE_IMPLICIT, + EXCESS_PRECISION_TYPE_STANDARD, + EXCESS_PRECISION_TYPE_FAST +}; + +/* Support for user-provided GGC and PCH markers. The first parameter + is a pointer to a pointer, the second a cookie. */ +typedef void (*gt_pointer_operator) (void *, void *); + +#if !defined (HAVE_UCHAR) +typedef unsigned char uchar; +#endif + +/* Most host source files will require the following headers. */ +#if !defined (GENERATOR_FILE) && !defined (USED_FOR_TARGET) +#include "machmode.h" +#include "signop.h" +#include "wide-int.h" +#include "double-int.h" +#include "real.h" +#include "fixed-value.h" +#include "hash-table.h" +#include "hash-set.h" +#include "input.h" +#include "is-a.h" +#include "memory-block.h" +#endif /* GENERATOR_FILE && !USED_FOR_TARGET */ + +#endif /* coretypes.h */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/coverage.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/coverage.h new file mode 100644 index 0000000..90454c0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/coverage.h @@ -0,0 +1,62 @@ +/* coverage.h - Defines data exported from coverage.c + Copyright (C) 1998-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_COVERAGE_H +#define GCC_COVERAGE_H + +#include "gcov-io.h" + +extern void coverage_init (const char *); +extern void coverage_finish (void); +extern void coverage_remove_note_file (void); + +/* Start outputting coverage information for the current + function. */ +extern int coverage_begin_function (unsigned, unsigned); + +/* Complete the coverage information for the current function. */ +extern void coverage_end_function (unsigned, unsigned); + +/* Compute the control flow checksum for the function FN given as argument. */ +extern unsigned coverage_compute_cfg_checksum (struct function *fn); + +/* Compute the profile id of function N. */ +extern unsigned coverage_compute_profile_id (struct cgraph_node *n); + +/* Compute the line number checksum for the current function. */ +extern unsigned coverage_compute_lineno_checksum (void); + +/* Allocate some counters. Repeatable per function. */ +extern int coverage_counter_alloc (unsigned /*counter*/, unsigned/*num*/); +/* Use a counter from the most recent allocation. */ +extern tree tree_coverage_counter_ref (unsigned /*counter*/, unsigned/*num*/); +/* Use a counter address from the most recent allocation. */ +extern tree tree_coverage_counter_addr (unsigned /*counter*/, unsigned/*num*/); + +/* Get all the counters for the current function. */ +extern gcov_type *get_coverage_counts (unsigned /*counter*/, + unsigned /*expected*/, + unsigned /*cfg_checksum*/, + unsigned /*lineno_checksum*/, + const struct gcov_ctr_summary **); + +extern tree get_gcov_type (void); +extern bool coverage_node_map_initialized_p (void); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cp/cp-tree.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cp/cp-tree.h new file mode 100644 index 0000000..fadf6ec --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cp/cp-tree.h @@ -0,0 +1,7101 @@ +/* Definitions for C++ parsing and type checking. + Copyright (C) 1987-2017 Free Software Foundation, Inc. + Contributed by Michael Tiemann (tiemann@cygnus.com) + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_CP_TREE_H +#define GCC_CP_TREE_H + +#include "tm.h" +#include "hard-reg-set.h" +#include "function.h" + +/* In order for the format checking to accept the C++ front end + diagnostic framework extensions, you must include this file before + diagnostic-core.h, not after. We override the definition of GCC_DIAG_STYLE + in c-common.h. */ +#undef GCC_DIAG_STYLE +#define GCC_DIAG_STYLE __gcc_cxxdiag__ +#if defined(GCC_DIAGNOSTIC_CORE_H) || defined (GCC_C_COMMON_H) +#error \ +In order for the format checking to accept the C++ front end diagnostic \ +framework extensions, you must include this file before diagnostic-core.h and \ +c-common.h, not after. +#endif +#include "c-family/c-common.h" +#include "diagnostic.h" + +/* A tree node, together with a location, so that we can track locations + (and ranges) during parsing. + + The location is redundant for node kinds that have locations, + but not all node kinds do (e.g. constants, and references to + params, locals, etc), so we stash a copy here. */ + +class cp_expr +{ +public: + cp_expr () : + m_value (NULL), m_loc (UNKNOWN_LOCATION) {} + + cp_expr (tree value) : + m_value (value), m_loc (EXPR_LOCATION (m_value)) {} + + cp_expr (tree value, location_t loc): + m_value (value), m_loc (loc) {} + + cp_expr (const cp_expr &other) : + m_value (other.m_value), m_loc (other.m_loc) {} + + /* Implicit conversions to tree. */ + operator tree () const { return m_value; } + tree & operator* () { return m_value; } + tree & operator-> () { return m_value; } + + tree get_value () const { return m_value; } + location_t get_location () const { return m_loc; } + location_t get_start () const + { + source_range src_range = get_range_from_loc (line_table, m_loc); + return src_range.m_start; + } + location_t get_finish () const + { + source_range src_range = get_range_from_loc (line_table, m_loc); + return src_range.m_finish; + } + + void set_location (location_t loc) + { + protected_set_expr_location (m_value, loc); + m_loc = loc; + } + + void set_range (location_t start, location_t finish) + { + set_location (make_location (m_loc, start, finish)); + } + + private: + tree m_value; + location_t m_loc; +}; + +inline bool +operator == (const cp_expr &lhs, tree rhs) +{ + return lhs.get_value () == rhs; +} + +#include "name-lookup.h" + +/* Usage of TREE_LANG_FLAG_?: + 0: IDENTIFIER_MARKED (IDENTIFIER_NODEs) + NEW_EXPR_USE_GLOBAL (in NEW_EXPR). + COND_EXPR_IS_VEC_DELETE (in COND_EXPR). + DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR). + COMPOUND_EXPR_OVERLOADED (in COMPOUND_EXPR). + CLEANUP_P (in TRY_BLOCK) + AGGR_INIT_VIA_CTOR_P (in AGGR_INIT_EXPR) + PTRMEM_OK_P (in ADDR_EXPR, OFFSET_REF, SCOPE_REF) + PAREN_STRING_LITERAL (in STRING_CST) + CP_DECL_THREAD_LOCAL_P (in VAR_DECL) + KOENIG_LOOKUP_P (in CALL_EXPR) + STATEMENT_LIST_NO_SCOPE (in STATEMENT_LIST). + EXPR_STMT_STMT_EXPR_RESULT (in EXPR_STMT) + STMT_EXPR_NO_SCOPE (in STMT_EXPR) + BIND_EXPR_TRY_BLOCK (in BIND_EXPR) + TYPENAME_IS_ENUM_P (in TYPENAME_TYPE) + OMP_FOR_GIMPLIFYING_P (in OMP_FOR, OMP_SIMD, OMP_DISTRIBUTE, + and OMP_TASKLOOP) + BASELINK_QUALIFIED_P (in BASELINK) + TARGET_EXPR_IMPLICIT_P (in TARGET_EXPR) + TEMPLATE_PARM_PARAMETER_PACK (in TEMPLATE_PARM_INDEX) + TREE_INDIRECT_USING (in a TREE_LIST of using-directives) + ATTR_IS_DEPENDENT (in the TREE_LIST for an attribute) + ABI_TAG_IMPLICIT (in the TREE_LIST for the argument of abi_tag) + CONSTRUCTOR_IS_DIRECT_INIT (in CONSTRUCTOR) + LAMBDA_EXPR_CAPTURES_THIS_P (in LAMBDA_EXPR) + DECLTYPE_FOR_LAMBDA_CAPTURE (in DECLTYPE_TYPE) + VEC_INIT_EXPR_IS_CONSTEXPR (in VEC_INIT_EXPR) + DECL_OVERRIDE_P (in FUNCTION_DECL) + IMPLICIT_CONV_EXPR_DIRECT_INIT (in IMPLICIT_CONV_EXPR) + TRANSACTION_EXPR_IS_STMT (in TRANSACTION_EXPR) + CONVERT_EXPR_VBASE_PATH (in CONVERT_EXPR) + OVL_ARG_DEPENDENT (in OVERLOAD) + PACK_EXPANSION_LOCAL_P (in *_PACK_EXPANSION) + TINFO_HAS_ACCESS_ERRORS (in TEMPLATE_INFO) + SIZEOF_EXPR_TYPE_P (in SIZEOF_EXPR) + COMPOUND_REQ_NOEXCEPT_P (in COMPOUND_REQ) + WILDCARD_PACK_P (in WILDCARD_DECL) + BLOCK_OUTER_CURLY_BRACE_P (in BLOCK) + FOLD_EXPR_MODOP_P (*_FOLD_EXPR) + IF_STMT_CONSTEXPR_P (IF_STMT) + TEMPLATE_TYPE_PARM_FOR_CLASS (TEMPLATE_TYPE_PARM) + 1: IDENTIFIER_VIRTUAL_P (in IDENTIFIER_NODE) + TI_PENDING_TEMPLATE_FLAG. + TEMPLATE_PARMS_FOR_INLINE. + DELETE_EXPR_USE_VEC (in DELETE_EXPR). + (TREE_CALLS_NEW) (in _EXPR or _REF) (commented-out). + ICS_ELLIPSIS_FLAG (in _CONV) + DECL_INITIALIZED_P (in VAR_DECL) + TYPENAME_IS_CLASS_P (in TYPENAME_TYPE) + STMT_IS_FULL_EXPR_P (in _STMT) + TARGET_EXPR_LIST_INIT_P (in TARGET_EXPR) + LAMBDA_EXPR_MUTABLE_P (in LAMBDA_EXPR) + DECL_FINAL_P (in FUNCTION_DECL) + QUALIFIED_NAME_IS_TEMPLATE (in SCOPE_REF) + DECLTYPE_FOR_INIT_CAPTURE (in DECLTYPE_TYPE) + CONSTRUCTOR_NO_IMPLICIT_ZERO (in CONSTRUCTOR) + TINFO_USED_TEMPLATE_ID (in TEMPLATE_INFO) + PACK_EXPANSION_SIZEOF_P (in *_PACK_EXPANSION) + 2: IDENTIFIER_OPNAME_P (in IDENTIFIER_NODE) + ICS_THIS_FLAG (in _CONV) + DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (in VAR_DECL) + STATEMENT_LIST_TRY_BLOCK (in STATEMENT_LIST) + TYPENAME_IS_RESOLVING_P (in TYPE_NAME_TYPE) + TARGET_EXPR_DIRECT_INIT_P (in TARGET_EXPR) + FNDECL_USED_AUTO (in FUNCTION_DECL) + DECLTYPE_FOR_LAMBDA_PROXY (in DECLTYPE_TYPE) + REF_PARENTHESIZED_P (in COMPONENT_REF, INDIRECT_REF, SCOPE_REF) + AGGR_INIT_ZERO_FIRST (in AGGR_INIT_EXPR) + CONSTRUCTOR_MUTABLE_POISON (in CONSTRUCTOR) + 3: (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out). + ICS_BAD_FLAG (in _CONV) + FN_TRY_BLOCK_P (in TRY_BLOCK) + IDENTIFIER_CTOR_OR_DTOR_P (in IDENTIFIER_NODE) + BIND_EXPR_BODY_BLOCK (in BIND_EXPR) + DECL_NON_TRIVIALLY_INITIALIZED_P (in VAR_DECL) + CALL_EXPR_ORDERED_ARGS (in CALL_EXPR, AGGR_INIT_EXPR) + DECLTYPE_FOR_REF_CAPTURE (in DECLTYPE_TYPE) + 4: TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR, + CALL_EXPR, or FIELD_DECL). + IDENTIFIER_TYPENAME_P (in IDENTIFIER_NODE) + DECL_TINFO_P (in VAR_DECL) + FUNCTION_REF_QUALIFIED (in FUNCTION_TYPE, METHOD_TYPE) + 5: C_IS_RESERVED_WORD (in IDENTIFIER_NODE) + DECL_VTABLE_OR_VTT_P (in VAR_DECL) + FUNCTION_RVALUE_QUALIFIED (in FUNCTION_TYPE, METHOD_TYPE) + CALL_EXPR_REVERSE_ARGS (in CALL_EXPR, AGGR_INIT_EXPR) + 6: IDENTIFIER_REPO_CHOSEN (in IDENTIFIER_NODE) + DECL_CONSTRUCTION_VTABLE_P (in VAR_DECL) + TYPE_MARKED_P (in _TYPE) + RANGE_FOR_IVDEP (in RANGE_FOR_STMT) + CALL_EXPR_OPERATOR_SYNTAX (in CALL_EXPR, AGGR_INIT_EXPR) + + Usage of TYPE_LANG_FLAG_?: + 0: TYPE_DEPENDENT_P + 1: TYPE_HAS_USER_CONSTRUCTOR. + 2: TYPE_HAS_LATE_RETURN_TYPE (in FUNCTION_TYPE, METHOD_TYPE) + TYPE_PTRMEMFUNC_FLAG (in RECORD_TYPE) + 4: TYPE_HAS_NONTRIVIAL_DESTRUCTOR + 5: CLASS_TYPE_P (in RECORD_TYPE and UNION_TYPE) + ENUM_FIXED_UNDERLYING_TYPE_P (in ENUMERAL_TYPE) + AUTO_IS_DECLTYPE (in TEMPLATE_TYPE_PARM) + REFERENCE_VLA_OK (in REFERENCE_TYPE) + 6: TYPE_DEPENDENT_P_VALID + + Usage of DECL_LANG_FLAG_?: + 0: DECL_ERROR_REPORTED (in VAR_DECL). + DECL_TEMPLATE_PARM_P (in PARM_DECL, CONST_DECL, TYPE_DECL, or TEMPLATE_DECL) + DECL_LOCAL_FUNCTION_P (in FUNCTION_DECL) + DECL_MUTABLE_P (in FIELD_DECL) + DECL_DEPENDENT_P (in USING_DECL) + LABEL_DECL_BREAK (in LABEL_DECL) + 1: C_TYPEDEF_EXPLICITLY_SIGNED (in TYPE_DECL). + DECL_TEMPLATE_INSTANTIATED (in a VAR_DECL or a FUNCTION_DECL) + DECL_MEMBER_TEMPLATE_P (in TEMPLATE_DECL) + USING_DECL_TYPENAME_P (in USING_DECL) + DECL_VLA_CAPTURE_P (in FIELD_DECL) + DECL_ARRAY_PARAMETER_P (in PARM_DECL) + LABEL_DECL_CONTINUE (in LABEL_DECL) + 2: DECL_THIS_EXTERN (in VAR_DECL or FUNCTION_DECL). + DECL_IMPLICIT_TYPEDEF_P (in a TYPE_DECL) + DECL_CONSTRAINT_VAR_P (in a PARM_DECL) + TEMPLATE_DECL_COMPLEX_ALIAS_P (in TEMPLATE_DECL) + DECL_INSTANTIATING_NSDMI_P (in a FIELD_DECL) + 3: DECL_IN_AGGR_P. + 4: DECL_C_BIT_FIELD (in a FIELD_DECL) + DECL_ANON_UNION_VAR_P (in a VAR_DECL) + DECL_SELF_REFERENCE_P (in a TYPE_DECL) + DECL_INVALID_OVERRIDER_P (in a FUNCTION_DECL) + 5: DECL_INTERFACE_KNOWN. + 6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL). + DECL_FIELD_IS_BASE (in FIELD_DECL) + TYPE_DECL_ALIAS_P (in TYPE_DECL) + 7: DECL_DEAD_FOR_LOCAL (in VAR_DECL). + DECL_THUNK_P (in a member FUNCTION_DECL) + DECL_NORMAL_CAPTURE_P (in FIELD_DECL) + 8: DECL_DECLARED_CONSTEXPR_P (in VAR_DECL, FUNCTION_DECL) + + Usage of language-independent fields in a language-dependent manner: + + TYPE_ALIAS_SET + This field is used by TYPENAME_TYPEs, TEMPLATE_TYPE_PARMs, and so + forth as a substitute for the mark bits provided in `lang_type'. + At present, only the six low-order bits are used. + + TYPE_LANG_SLOT_1 + For an ENUMERAL_TYPE, this is ENUM_TEMPLATE_INFO. + For a FUNCTION_TYPE or METHOD_TYPE, this is TYPE_RAISES_EXCEPTIONS + + BINFO_VIRTUALS + For a binfo, this is a TREE_LIST. There is an entry for each + virtual function declared either in BINFO or its direct and + indirect primary bases. + + The BV_DELTA of each node gives the amount by which to adjust the + `this' pointer when calling the function. If the method is an + overridden version of a base class method, then it is assumed + that, prior to adjustment, the this pointer points to an object + of the base class. + + The BV_VCALL_INDEX of each node, if non-NULL, gives the vtable + index of the vcall offset for this entry. + + The BV_FN is the declaration for the virtual function itself. + + If BV_LOST_PRIMARY is set, it means that this entry is for a lost + primary virtual base and can be left null in the vtable. + + BINFO_VTABLE + This is an expression with POINTER_TYPE that gives the value + to which the vptr should be initialized. Use get_vtbl_decl_for_binfo + to extract the VAR_DECL for the complete vtable. + + DECL_VINDEX + This field is NULL for a non-virtual function. For a virtual + function, it is eventually set to an INTEGER_CST indicating the + index in the vtable at which this function can be found. When + a virtual function is declared, but before it is known what + function is overridden, this field is the error_mark_node. + + Temporarily, it may be set to a TREE_LIST whose TREE_VALUE is + the virtual function this one overrides, and whose TREE_CHAIN is + the old DECL_VINDEX. */ + +/* Language-specific tree checkers. */ + +#define VAR_OR_FUNCTION_DECL_CHECK(NODE) \ + TREE_CHECK2(NODE,VAR_DECL,FUNCTION_DECL) + +#define TYPE_FUNCTION_OR_TEMPLATE_DECL_CHECK(NODE) \ + TREE_CHECK3(NODE,TYPE_DECL,TEMPLATE_DECL,FUNCTION_DECL) + +#define TYPE_FUNCTION_OR_TEMPLATE_DECL_P(NODE) \ + (TREE_CODE (NODE) == TYPE_DECL || TREE_CODE (NODE) == TEMPLATE_DECL \ + || TREE_CODE (NODE) == FUNCTION_DECL) + +#define VAR_FUNCTION_OR_PARM_DECL_CHECK(NODE) \ + TREE_CHECK3(NODE,VAR_DECL,FUNCTION_DECL,PARM_DECL) + +#define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE) \ + TREE_CHECK4(NODE,VAR_DECL,FUNCTION_DECL,TYPE_DECL,TEMPLATE_DECL) + +#define VAR_TEMPL_TYPE_FIELD_OR_FUNCTION_DECL_CHECK(NODE) \ + TREE_CHECK5(NODE,VAR_DECL,FIELD_DECL,FUNCTION_DECL,TYPE_DECL,TEMPLATE_DECL) + +#define BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK(NODE) \ + TREE_CHECK(NODE,BOUND_TEMPLATE_TEMPLATE_PARM) + +#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007) +#define THUNK_FUNCTION_CHECK(NODE) __extension__ \ +({ __typeof (NODE) const __t = (NODE); \ + if (TREE_CODE (__t) != FUNCTION_DECL || !__t->decl_common.lang_specific \ + || !__t->decl_common.lang_specific->u.fn.thunk_p) \ + tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \ + __t; }) +#else +#define THUNK_FUNCTION_CHECK(NODE) (NODE) +#endif + +/* Language-dependent contents of an identifier. */ + +struct GTY(()) lang_identifier { + struct c_common_identifier c_common; + cxx_binding *namespace_bindings; + cxx_binding *bindings; + tree class_template_info; + tree label_value; +}; + +/* Return a typed pointer version of T if it designates a + C++ front-end identifier. */ +inline lang_identifier* +identifier_p (tree t) +{ + if (TREE_CODE (t) == IDENTIFIER_NODE) + return (lang_identifier*) t; + return NULL; +} + +/* In an IDENTIFIER_NODE, nonzero if this identifier is actually a + keyword. C_RID_CODE (node) is then the RID_* value of the keyword. */ + +#define C_IS_RESERVED_WORD(ID) TREE_LANG_FLAG_5 (ID) + +#define LANG_IDENTIFIER_CAST(NODE) \ + ((struct lang_identifier*)IDENTIFIER_NODE_CHECK (NODE)) + +struct GTY(()) template_parm_index { + struct tree_common common; + int index; + int level; + int orig_level; + tree decl; +}; + +struct GTY(()) ptrmem_cst { + struct tree_common common; + tree member; +}; +typedef struct ptrmem_cst * ptrmem_cst_t; + +#define IDENTIFIER_GLOBAL_VALUE(NODE) \ + namespace_binding ((NODE), global_namespace) +#define SET_IDENTIFIER_GLOBAL_VALUE(NODE, VAL) \ + set_namespace_binding ((NODE), global_namespace, (VAL)) +#define IDENTIFIER_NAMESPACE_VALUE(NODE) \ + namespace_binding ((NODE), current_namespace) +#define SET_IDENTIFIER_NAMESPACE_VALUE(NODE, VAL) \ + set_namespace_binding ((NODE), current_namespace, (VAL)) + +#define CLEANUP_P(NODE) TREE_LANG_FLAG_0 (TRY_BLOCK_CHECK (NODE)) + +#define BIND_EXPR_TRY_BLOCK(NODE) \ + TREE_LANG_FLAG_0 (BIND_EXPR_CHECK (NODE)) + +/* Used to mark the block around the member initializers and cleanups. */ +#define BIND_EXPR_BODY_BLOCK(NODE) \ + TREE_LANG_FLAG_3 (BIND_EXPR_CHECK (NODE)) +#define FUNCTION_NEEDS_BODY_BLOCK(NODE) \ + (DECL_CONSTRUCTOR_P (NODE) || DECL_DESTRUCTOR_P (NODE) \ + || LAMBDA_FUNCTION_P (NODE)) + +#define STATEMENT_LIST_NO_SCOPE(NODE) \ + TREE_LANG_FLAG_0 (STATEMENT_LIST_CHECK (NODE)) +#define STATEMENT_LIST_TRY_BLOCK(NODE) \ + TREE_LANG_FLAG_2 (STATEMENT_LIST_CHECK (NODE)) + +/* Mark the outer curly brace BLOCK. */ +#define BLOCK_OUTER_CURLY_BRACE_P(NODE) TREE_LANG_FLAG_0 (BLOCK_CHECK (NODE)) + +/* Nonzero if this statement should be considered a full-expression, + i.e., if temporaries created during this statement should have + their destructors run at the end of this statement. */ +#define STMT_IS_FULL_EXPR_P(NODE) TREE_LANG_FLAG_1 ((NODE)) + +/* Marks the result of a statement expression. */ +#define EXPR_STMT_STMT_EXPR_RESULT(NODE) \ + TREE_LANG_FLAG_0 (EXPR_STMT_CHECK (NODE)) + +/* Nonzero if this statement-expression does not have an associated scope. */ +#define STMT_EXPR_NO_SCOPE(NODE) \ + TREE_LANG_FLAG_0 (STMT_EXPR_CHECK (NODE)) + +#define COND_EXPR_IS_VEC_DELETE(NODE) \ + TREE_LANG_FLAG_0 (COND_EXPR_CHECK (NODE)) + +/* Returns nonzero iff TYPE1 and TYPE2 are the same type, in the usual + sense of `same'. */ +#define same_type_p(TYPE1, TYPE2) \ + comptypes ((TYPE1), (TYPE2), COMPARE_STRICT) + +/* Returns nonzero iff NODE is a declaration for the global function + `main'. */ +#define DECL_MAIN_P(NODE) \ + (DECL_EXTERN_C_FUNCTION_P (NODE) \ + && DECL_NAME (NODE) != NULL_TREE \ + && MAIN_NAME_P (DECL_NAME (NODE)) \ + && flag_hosted) + +/* The overloaded FUNCTION_DECL. */ +#define OVL_FUNCTION(NODE) \ + (((struct tree_overload*)OVERLOAD_CHECK (NODE))->function) +#define OVL_CHAIN(NODE) TREE_CHAIN (NODE) +/* Polymorphic access to FUNCTION and CHAIN. */ +#define OVL_CURRENT(NODE) \ + ((TREE_CODE (NODE) == OVERLOAD) ? OVL_FUNCTION (NODE) : (NODE)) +#define OVL_NEXT(NODE) \ + ((TREE_CODE (NODE) == OVERLOAD) ? TREE_CHAIN (NODE) : NULL_TREE) +/* If set, this was imported in a using declaration. + This is not to confuse with being used somewhere, which + is not important for this node. */ +#define OVL_USED(NODE) TREE_USED (OVERLOAD_CHECK (NODE)) +/* If set, this OVERLOAD was created for argument-dependent lookup + and can be freed afterward. */ +#define OVL_ARG_DEPENDENT(NODE) TREE_LANG_FLAG_0 (OVERLOAD_CHECK (NODE)) + +struct GTY(()) tree_overload { + struct tree_common common; + tree function; +}; + +struct GTY(()) tree_template_decl { + struct tree_decl_common common; + tree arguments; + tree result; +}; + +/* Returns true iff NODE is a BASELINK. */ +#define BASELINK_P(NODE) \ + (TREE_CODE (NODE) == BASELINK) +/* The BINFO indicating the base in which lookup found the + BASELINK_FUNCTIONS. */ +#define BASELINK_BINFO(NODE) \ + (((struct tree_baselink*) BASELINK_CHECK (NODE))->binfo) +/* The functions referred to by the BASELINK; either a FUNCTION_DECL, + a TEMPLATE_DECL, an OVERLOAD, or a TEMPLATE_ID_EXPR. */ +#define BASELINK_FUNCTIONS(NODE) \ + (((struct tree_baselink*) BASELINK_CHECK (NODE))->functions) +/* The BINFO in which the search for the functions indicated by this baselink + began. This base is used to determine the accessibility of functions + selected by overload resolution. */ +#define BASELINK_ACCESS_BINFO(NODE) \ + (((struct tree_baselink*) BASELINK_CHECK (NODE))->access_binfo) +/* For a type-conversion operator, the BASELINK_OPTYPE indicates the type + to which the conversion should occur. This value is important if + the BASELINK_FUNCTIONS include a template conversion operator -- + the BASELINK_OPTYPE can be used to determine what type the user + requested. */ +#define BASELINK_OPTYPE(NODE) \ + (TREE_CHAIN (BASELINK_CHECK (NODE))) +/* Nonzero if this baselink was from a qualified lookup. */ +#define BASELINK_QUALIFIED_P(NODE) \ + TREE_LANG_FLAG_0 (BASELINK_CHECK (NODE)) + +struct GTY(()) tree_baselink { + struct tree_common common; + tree binfo; + tree functions; + tree access_binfo; +}; + +/* The different kinds of ids that we encounter. */ + +enum cp_id_kind +{ + /* Not an id at all. */ + CP_ID_KIND_NONE, + /* An unqualified-id that is not a template-id. */ + CP_ID_KIND_UNQUALIFIED, + /* An unqualified-id that is a dependent name. */ + CP_ID_KIND_UNQUALIFIED_DEPENDENT, + /* An unqualified template-id. */ + CP_ID_KIND_TEMPLATE_ID, + /* A qualified-id. */ + CP_ID_KIND_QUALIFIED +}; + + +/* The various kinds of C++0x warnings we encounter. */ + +enum cpp0x_warn_str +{ + /* extended initializer lists */ + CPP0X_INITIALIZER_LISTS, + /* explicit conversion operators */ + CPP0X_EXPLICIT_CONVERSION, + /* variadic templates */ + CPP0X_VARIADIC_TEMPLATES, + /* lambda expressions */ + CPP0X_LAMBDA_EXPR, + /* C++0x auto */ + CPP0X_AUTO, + /* scoped enums */ + CPP0X_SCOPED_ENUMS, + /* defaulted and deleted functions */ + CPP0X_DEFAULTED_DELETED, + /* inline namespaces */ + CPP0X_INLINE_NAMESPACES, + /* override controls, override/final */ + CPP0X_OVERRIDE_CONTROLS, + /* non-static data member initializers */ + CPP0X_NSDMI, + /* user defined literals */ + CPP0X_USER_DEFINED_LITERALS, + /* delegating constructors */ + CPP0X_DELEGATING_CTORS, + /* inheriting constructors */ + CPP0X_INHERITING_CTORS, + /* C++11 attributes */ + CPP0X_ATTRIBUTES, + /* ref-qualified member functions */ + CPP0X_REF_QUALIFIER +}; + +/* The various kinds of operation used by composite_pointer_type. */ + +enum composite_pointer_operation +{ + /* comparison */ + CPO_COMPARISON, + /* conversion */ + CPO_CONVERSION, + /* conditional expression */ + CPO_CONDITIONAL_EXPR +}; + +/* Possible cases of expression list used by build_x_compound_expr_from_list. */ +enum expr_list_kind { + ELK_INIT, /* initializer */ + ELK_MEM_INIT, /* member initializer */ + ELK_FUNC_CAST /* functional cast */ +}; + +/* Possible cases of implicit bad rhs conversions. */ +enum impl_conv_rhs { + ICR_DEFAULT_ARGUMENT, /* default argument */ + ICR_CONVERTING, /* converting */ + ICR_INIT, /* initialization */ + ICR_ARGPASS, /* argument passing */ + ICR_RETURN, /* return */ + ICR_ASSIGN /* assignment */ +}; + +/* Possible cases of implicit or explicit bad conversions to void. */ +enum impl_conv_void { + ICV_CAST, /* (explicit) conversion to void */ + ICV_SECOND_OF_COND, /* second operand of conditional expression */ + ICV_THIRD_OF_COND, /* third operand of conditional expression */ + ICV_RIGHT_OF_COMMA, /* right operand of comma operator */ + ICV_LEFT_OF_COMMA, /* left operand of comma operator */ + ICV_STATEMENT, /* statement */ + ICV_THIRD_IN_FOR /* for increment expression */ +}; + +/* Possible invalid uses of an abstract class that might not have a + specific associated declaration. */ +enum GTY(()) abstract_class_use { + ACU_UNKNOWN, /* unknown or decl provided */ + ACU_CAST, /* cast to abstract class */ + ACU_NEW, /* new-expression of abstract class */ + ACU_THROW, /* throw-expression of abstract class */ + ACU_CATCH, /* catch-parameter of abstract class */ + ACU_ARRAY, /* array of abstract class */ + ACU_RETURN, /* return type of abstract class */ + ACU_PARM /* parameter type of abstract class */ +}; + +/* Macros for access to language-specific slots in an identifier. */ + +#define IDENTIFIER_NAMESPACE_BINDINGS(NODE) \ + (LANG_IDENTIFIER_CAST (NODE)->namespace_bindings) +#define IDENTIFIER_TEMPLATE(NODE) \ + (LANG_IDENTIFIER_CAST (NODE)->class_template_info) + +/* The IDENTIFIER_BINDING is the innermost cxx_binding for the + identifier. It's PREVIOUS is the next outermost binding. Each + VALUE field is a DECL for the associated declaration. Thus, + name lookup consists simply of pulling off the node at the front + of the list (modulo oddities for looking up the names of types, + and such.) You can use SCOPE field to determine the scope + that bound the name. */ +#define IDENTIFIER_BINDING(NODE) \ + (LANG_IDENTIFIER_CAST (NODE)->bindings) + +/* TREE_TYPE only indicates on local and class scope the current + type. For namespace scope, the presence of a type in any namespace + is indicated with global_type_node, and the real type behind must + be found through lookup. */ +#define IDENTIFIER_TYPE_VALUE(NODE) identifier_type_value (NODE) +#define REAL_IDENTIFIER_TYPE_VALUE(NODE) TREE_TYPE (NODE) +#define SET_IDENTIFIER_TYPE_VALUE(NODE,TYPE) (TREE_TYPE (NODE) = (TYPE)) +#define IDENTIFIER_HAS_TYPE_VALUE(NODE) (IDENTIFIER_TYPE_VALUE (NODE) ? 1 : 0) + +#define IDENTIFIER_LABEL_VALUE(NODE) \ + (LANG_IDENTIFIER_CAST (NODE)->label_value) +#define SET_IDENTIFIER_LABEL_VALUE(NODE, VALUE) \ + IDENTIFIER_LABEL_VALUE (NODE) = (VALUE) + +/* Nonzero if this identifier is used as a virtual function name somewhere + (optimizes searches). */ +#define IDENTIFIER_VIRTUAL_P(NODE) TREE_LANG_FLAG_1 (NODE) + +/* Nonzero if this identifier is the prefix for a mangled C++ operator + name. */ +#define IDENTIFIER_OPNAME_P(NODE) TREE_LANG_FLAG_2 (NODE) + +/* Nonzero if this identifier is the name of a type-conversion + operator. */ +#define IDENTIFIER_TYPENAME_P(NODE) \ + TREE_LANG_FLAG_4 (NODE) + +/* Nonzero if this identifier is the name of a constructor or + destructor. */ +#define IDENTIFIER_CTOR_OR_DTOR_P(NODE) \ + TREE_LANG_FLAG_3 (NODE) + +/* True iff NAME is the DECL_ASSEMBLER_NAME for an entity with vague + linkage which the prelinker has assigned to this translation + unit. */ +#define IDENTIFIER_REPO_CHOSEN(NAME) \ + (TREE_LANG_FLAG_6 (NAME)) + +/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */ +#define C_TYPE_FIELDS_READONLY(TYPE) \ + (LANG_TYPE_CLASS_CHECK (TYPE)->fields_readonly) + +/* The tokens stored in the default argument. */ + +#define DEFARG_TOKENS(NODE) \ + (((struct tree_default_arg *)DEFAULT_ARG_CHECK (NODE))->tokens) +#define DEFARG_INSTANTIATIONS(NODE) \ + (((struct tree_default_arg *)DEFAULT_ARG_CHECK (NODE))->instantiations) + +struct GTY (()) tree_default_arg { + struct tree_common common; + struct cp_token_cache *tokens; + vec *instantiations; +}; + + +#define DEFERRED_NOEXCEPT_PATTERN(NODE) \ + (((struct tree_deferred_noexcept *)DEFERRED_NOEXCEPT_CHECK (NODE))->pattern) +#define DEFERRED_NOEXCEPT_ARGS(NODE) \ + (((struct tree_deferred_noexcept *)DEFERRED_NOEXCEPT_CHECK (NODE))->args) +#define DEFERRED_NOEXCEPT_SPEC_P(NODE) \ + ((NODE) && (TREE_PURPOSE (NODE)) \ + && (TREE_CODE (TREE_PURPOSE (NODE)) == DEFERRED_NOEXCEPT)) +#define UNEVALUATED_NOEXCEPT_SPEC_P(NODE) \ + (DEFERRED_NOEXCEPT_SPEC_P (NODE) \ + && DEFERRED_NOEXCEPT_PATTERN (TREE_PURPOSE (NODE)) == NULL_TREE) + +struct GTY (()) tree_deferred_noexcept { + struct tree_base base; + tree pattern; + tree args; +}; + + +/* The condition associated with the static assertion. This must be + an integral constant expression. */ +#define STATIC_ASSERT_CONDITION(NODE) \ + (((struct tree_static_assert *)STATIC_ASSERT_CHECK (NODE))->condition) + +/* The message associated with the static assertion. This must be a + string constant, which will be emitted as an error message when the + static assert condition is false. */ +#define STATIC_ASSERT_MESSAGE(NODE) \ + (((struct tree_static_assert *)STATIC_ASSERT_CHECK (NODE))->message) + +/* Source location information for a static assertion. */ +#define STATIC_ASSERT_SOURCE_LOCATION(NODE) \ + (((struct tree_static_assert *)STATIC_ASSERT_CHECK (NODE))->location) + +struct GTY (()) tree_static_assert { + struct tree_common common; + tree condition; + tree message; + location_t location; +}; + +struct GTY (()) tree_argument_pack_select { + struct tree_common common; + tree argument_pack; + int index; +}; + +/* The different kinds of traits that we encounter. */ + +enum cp_trait_kind +{ + CPTK_BASES, + CPTK_DIRECT_BASES, + CPTK_HAS_NOTHROW_ASSIGN, + CPTK_HAS_NOTHROW_CONSTRUCTOR, + CPTK_HAS_NOTHROW_COPY, + CPTK_HAS_TRIVIAL_ASSIGN, + CPTK_HAS_TRIVIAL_CONSTRUCTOR, + CPTK_HAS_TRIVIAL_COPY, + CPTK_HAS_TRIVIAL_DESTRUCTOR, + CPTK_HAS_UNIQUE_OBJ_REPRESENTATIONS, + CPTK_HAS_VIRTUAL_DESTRUCTOR, + CPTK_IS_ABSTRACT, + CPTK_IS_AGGREGATE, + CPTK_IS_BASE_OF, + CPTK_IS_CLASS, + CPTK_IS_EMPTY, + CPTK_IS_ENUM, + CPTK_IS_FINAL, + CPTK_IS_LITERAL_TYPE, + CPTK_IS_POD, + CPTK_IS_POLYMORPHIC, + CPTK_IS_SAME_AS, + CPTK_IS_STD_LAYOUT, + CPTK_IS_TRIVIAL, + CPTK_IS_TRIVIALLY_ASSIGNABLE, + CPTK_IS_TRIVIALLY_CONSTRUCTIBLE, + CPTK_IS_TRIVIALLY_COPYABLE, + CPTK_IS_UNION, + CPTK_UNDERLYING_TYPE +}; + +/* The types that we are processing. */ +#define TRAIT_EXPR_TYPE1(NODE) \ + (((struct tree_trait_expr *)TRAIT_EXPR_CHECK (NODE))->type1) + +#define TRAIT_EXPR_TYPE2(NODE) \ + (((struct tree_trait_expr *)TRAIT_EXPR_CHECK (NODE))->type2) + +/* The specific trait that we are processing. */ +#define TRAIT_EXPR_KIND(NODE) \ + (((struct tree_trait_expr *)TRAIT_EXPR_CHECK (NODE))->kind) + +struct GTY (()) tree_trait_expr { + struct tree_common common; + tree type1; + tree type2; + enum cp_trait_kind kind; +}; + +/* Based off of TYPE_UNNAMED_P. */ +#define LAMBDA_TYPE_P(NODE) \ + (CLASS_TYPE_P (NODE) && CLASSTYPE_LAMBDA_EXPR (NODE)) + +/* Test if FUNCTION_DECL is a lambda function. */ +#define LAMBDA_FUNCTION_P(FNDECL) \ + (DECL_OVERLOADED_OPERATOR_P (FNDECL) == CALL_EXPR \ + && LAMBDA_TYPE_P (CP_DECL_CONTEXT (FNDECL))) + +enum cp_lambda_default_capture_mode_type { + CPLD_NONE, + CPLD_COPY, + CPLD_REFERENCE +}; + +/* The method of default capture, if any. */ +#define LAMBDA_EXPR_DEFAULT_CAPTURE_MODE(NODE) \ + (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->default_capture_mode) + +/* The capture-list, including `this'. Each capture is stored as a FIELD_DECL + * so that the name, type, and field are all together, whether or not it has + * been added to the lambda's class type. + TREE_LIST: + TREE_PURPOSE: The FIELD_DECL for this capture. + TREE_VALUE: The initializer. This is part of a GNU extension. */ +#define LAMBDA_EXPR_CAPTURE_LIST(NODE) \ + (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->capture_list) + +/* During parsing of the lambda-introducer, the node in the capture-list + that holds the 'this' capture. During parsing of the body, the + capture proxy for that node. */ +#define LAMBDA_EXPR_THIS_CAPTURE(NODE) \ + (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->this_capture) + +/* Predicate tracking whether `this' is in the effective capture set. */ +#define LAMBDA_EXPR_CAPTURES_THIS_P(NODE) \ + LAMBDA_EXPR_THIS_CAPTURE(NODE) + +/* Predicate tracking whether the lambda was declared 'mutable'. */ +#define LAMBDA_EXPR_MUTABLE_P(NODE) \ + TREE_LANG_FLAG_1 (LAMBDA_EXPR_CHECK (NODE)) + +/* The return type in the expression. + * NULL_TREE indicates that none was specified. */ +#define LAMBDA_EXPR_RETURN_TYPE(NODE) \ + (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->return_type) + +/* The source location of the lambda. */ +#define LAMBDA_EXPR_LOCATION(NODE) \ + (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->locus) + +/* The mangling scope for the lambda: FUNCTION_DECL, PARM_DECL, VAR_DECL, + FIELD_DECL or NULL_TREE. If this is NULL_TREE, we have no linkage. */ +#define LAMBDA_EXPR_EXTRA_SCOPE(NODE) \ + (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->extra_scope) + +/* If EXTRA_SCOPE, this is the number of the lambda within that scope. */ +#define LAMBDA_EXPR_DISCRIMINATOR(NODE) \ + (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->discriminator) + +/* During parsing of the lambda, a vector of capture proxies which need + to be pushed once we're done processing a nested lambda. */ +#define LAMBDA_EXPR_PENDING_PROXIES(NODE) \ + (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->pending_proxies) + +/* The closure type of the lambda. Note that the TREE_TYPE of a + LAMBDA_EXPR is always NULL_TREE, because we need to instantiate the + LAMBDA_EXPR in order to instantiate the type. */ +#define LAMBDA_EXPR_CLOSURE(NODE) \ + (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->closure) + +struct GTY (()) tree_lambda_expr +{ + struct tree_typed typed; + tree capture_list; + tree this_capture; + tree return_type; + tree extra_scope; + tree closure; + vec *pending_proxies; + location_t locus; + enum cp_lambda_default_capture_mode_type default_capture_mode; + int discriminator; +}; + +/* A (typedef,context,usage location) triplet. + It represents a typedef used through a + context at a given source location. + e.g. + struct foo { + typedef int myint; + }; + + struct bar { + foo::myint v; // #1<-- this location. + }; + + In bar, the triplet will be (myint, foo, #1). + */ +struct GTY(()) qualified_typedef_usage_s { + tree typedef_decl; + tree context; + location_t locus; +}; +typedef struct qualified_typedef_usage_s qualified_typedef_usage_t; + +/* Non-zero if this template specialization has access violations that + should be rechecked when the function is instantiated outside argument + deduction. */ +#define TINFO_HAS_ACCESS_ERRORS(NODE) \ + (TREE_LANG_FLAG_0 (TEMPLATE_INFO_CHECK (NODE))) +#define FNDECL_HAS_ACCESS_ERRORS(NODE) \ + (TINFO_HAS_ACCESS_ERRORS (DECL_TEMPLATE_INFO (NODE))) + +/* Non-zero if this variable template specialization was specified using a + template-id, so it's a partial or full specialization and not a definition + of the member template of a particular class specialization. */ +#define TINFO_USED_TEMPLATE_ID(NODE) \ + (TREE_LANG_FLAG_1 (TEMPLATE_INFO_CHECK (NODE))) + +struct GTY(()) tree_template_info { + struct tree_common common; + vec *typedefs_needing_access_checking; +}; + +// Constraint information for a C++ declaration. Constraint information is +// comprised of: +// +// - a constraint expression introduced by the template header +// - a constraint expression introduced by a function declarator +// - the associated constraints, which are the conjunction of those, +// and used for declaration matching +// +// The template and declarator requirements are kept to support pretty +// printing constrained declarations. +struct GTY(()) tree_constraint_info { + struct tree_base base; + tree template_reqs; + tree declarator_reqs; + tree associated_constr; +}; + +// Require that pointer P is non-null before returning. +template +inline T* +check_nonnull (T* p) +{ + gcc_assert (p); + return p; +} + +// Returns true iff T is non-null and represents constraint info. +inline tree_constraint_info * +check_constraint_info (tree t) +{ + if (t && TREE_CODE (t) == CONSTRAINT_INFO) + return (tree_constraint_info *)t; + return NULL; +} + +// Access the expression describing the template constraints. This may be +// null if no constraints were introduced in the template parameter list, +// a requirements clause after the template parameter list, or constraints +// through a constrained-type-specifier. +#define CI_TEMPLATE_REQS(NODE) \ + check_constraint_info (check_nonnull(NODE))->template_reqs + +// Access the expression describing the trailing constraints. This is non-null +// for any implicit instantiation of a constrained declaration. For a +// templated declaration it is non-null only when a trailing requires-clause +// was specified. +#define CI_DECLARATOR_REQS(NODE) \ + check_constraint_info (check_nonnull(NODE))->declarator_reqs + +// The computed associated constraint expression for a declaration. +#define CI_ASSOCIATED_CONSTRAINTS(NODE) \ + check_constraint_info (check_nonnull(NODE))->associated_constr + +// Access the logical constraints on the template parameters introduced +// at a given template parameter list level indicated by NODE. +#define TEMPLATE_PARMS_CONSTRAINTS(NODE) \ + TREE_TYPE (TREE_LIST_CHECK (NODE)) + +// Access the logical constraints on the template parameter declaration +// indicated by NODE. +#define TEMPLATE_PARM_CONSTRAINTS(NODE) \ + TREE_TYPE (TREE_LIST_CHECK (NODE)) + +/* Non-zero if the noexcept is present in a compound requirement. */ +#define COMPOUND_REQ_NOEXCEPT_P(NODE) \ + TREE_LANG_FLAG_0 (TREE_CHECK (NODE, COMPOUND_REQ)) + +/* The constraints on an 'auto' placeholder type, used in an argument deduction + constraint. */ +#define PLACEHOLDER_TYPE_CONSTRAINTS(NODE) \ + DECL_SIZE_UNIT (TYPE_NAME (NODE)) + +/* The expression evaluated by the predicate constraint. */ +#define PRED_CONSTR_EXPR(NODE) \ + TREE_OPERAND (TREE_CHECK (NODE, PRED_CONSTR), 0) + +/* The concept of a concept check. */ +#define CHECK_CONSTR_CONCEPT(NODE) \ + TREE_OPERAND (TREE_CHECK (NODE, CHECK_CONSTR), 0) + +/* The template arguments of a concept check. */ +#define CHECK_CONSTR_ARGS(NODE) \ + TREE_OPERAND (TREE_CHECK (NODE, CHECK_CONSTR), 1) + +/* The expression validated by the predicate constraint. */ +#define EXPR_CONSTR_EXPR(NODE) \ + TREE_OPERAND (TREE_CHECK (NODE, EXPR_CONSTR), 0) + +/* The type validated by the predicate constraint. */ +#define TYPE_CONSTR_TYPE(NODE) \ + TREE_OPERAND (TREE_CHECK (NODE, TYPE_CONSTR), 0) + +/* In an implicit conversion constraint, the source expression. */ +#define ICONV_CONSTR_EXPR(NODE) \ + TREE_OPERAND (TREE_CHECK (NODE, ICONV_CONSTR), 0) + +/* In an implicit conversion constraint, the target type. */ +#define ICONV_CONSTR_TYPE(NODE) \ + TREE_OPERAND (TREE_CHECK (NODE, ICONV_CONSTR), 1) + +/* In an argument deduction constraint, the source expression. */ +#define DEDUCT_CONSTR_EXPR(NODE) \ + TREE_OPERAND (TREE_CHECK (NODE, DEDUCT_CONSTR), 0) + +/* In an argument deduction constraint, the target type pattern. */ +#define DEDUCT_CONSTR_PATTERN(NODE) \ + TREE_OPERAND (TREE_CHECK (NODE, DEDUCT_CONSTR), 1) + +/* In an argument deduction constraint, the list of placeholder nodes. */ +#define DEDUCT_CONSTR_PLACEHOLDER(NODE) \ + TREE_OPERAND (TREE_CHECK (NODE, DEDUCT_CONSTR), 2) + +/* The expression of an exception constraint. */ +#define EXCEPT_CONSTR_EXPR(NODE) \ + TREE_OPERAND (TREE_CHECK (NODE, EXCEPT_CONSTR), 0) + +/* In a parameterized constraint, the local parameters. */ +#define PARM_CONSTR_PARMS(NODE) \ + TREE_OPERAND (TREE_CHECK (NODE, PARM_CONSTR), 0) + +/* In a parameterized constraint, the operand. */ +#define PARM_CONSTR_OPERAND(NODE) \ + TREE_OPERAND (TREE_CHECK (NODE, PARM_CONSTR), 1) + +/* Whether a PARM_DECL represents a local parameter in a + requires-expression. */ +#define CONSTRAINT_VAR_P(NODE) \ + DECL_LANG_FLAG_2 (TREE_CHECK (NODE, PARM_DECL)) + +/* The concept constraining this constrained template-parameter. */ +#define CONSTRAINED_PARM_CONCEPT(NODE) \ + DECL_SIZE_UNIT (TYPE_DECL_CHECK (NODE)) +/* Any extra template arguments specified for a constrained + template-parameter. */ +#define CONSTRAINED_PARM_EXTRA_ARGS(NODE) \ + DECL_SIZE (TYPE_DECL_CHECK (NODE)) +/* The first template parameter of CONSTRAINED_PARM_CONCEPT to be used as a + prototype for the constrained parameter in finish_shorthand_constraint, + attached for convenience. */ +#define CONSTRAINED_PARM_PROTOTYPE(NODE) \ + DECL_INITIAL (TYPE_DECL_CHECK (NODE)) + +enum cp_tree_node_structure_enum { + TS_CP_GENERIC, + TS_CP_IDENTIFIER, + TS_CP_TPI, + TS_CP_PTRMEM, + TS_CP_BINDING, + TS_CP_OVERLOAD, + TS_CP_BASELINK, + TS_CP_TEMPLATE_DECL, + TS_CP_WRAPPER, + TS_CP_DEFAULT_ARG, + TS_CP_DEFERRED_NOEXCEPT, + TS_CP_STATIC_ASSERT, + TS_CP_ARGUMENT_PACK_SELECT, + TS_CP_TRAIT_EXPR, + TS_CP_LAMBDA_EXPR, + TS_CP_TEMPLATE_INFO, + TS_CP_CONSTRAINT_INFO, + TS_CP_USERDEF_LITERAL, + LAST_TS_CP_ENUM +}; + +/* The resulting tree type. */ +union GTY((desc ("cp_tree_node_structure (&%h)"), + chain_next ("(union lang_tree_node *) c_tree_chain_next (&%h.generic)"))) lang_tree_node { + union tree_node GTY ((tag ("TS_CP_GENERIC"), + desc ("tree_node_structure (&%h)"))) generic; + struct template_parm_index GTY ((tag ("TS_CP_TPI"))) tpi; + struct ptrmem_cst GTY ((tag ("TS_CP_PTRMEM"))) ptrmem; + struct tree_overload GTY ((tag ("TS_CP_OVERLOAD"))) overload; + struct tree_baselink GTY ((tag ("TS_CP_BASELINK"))) baselink; + struct tree_template_decl GTY ((tag ("TS_CP_TEMPLATE_DECL"))) template_decl; + struct tree_default_arg GTY ((tag ("TS_CP_DEFAULT_ARG"))) default_arg; + struct tree_deferred_noexcept GTY ((tag ("TS_CP_DEFERRED_NOEXCEPT"))) deferred_noexcept; + struct lang_identifier GTY ((tag ("TS_CP_IDENTIFIER"))) identifier; + struct tree_static_assert GTY ((tag ("TS_CP_STATIC_ASSERT"))) + static_assertion; + struct tree_argument_pack_select GTY ((tag ("TS_CP_ARGUMENT_PACK_SELECT"))) + argument_pack_select; + struct tree_trait_expr GTY ((tag ("TS_CP_TRAIT_EXPR"))) + trait_expression; + struct tree_lambda_expr GTY ((tag ("TS_CP_LAMBDA_EXPR"))) + lambda_expression; + struct tree_template_info GTY ((tag ("TS_CP_TEMPLATE_INFO"))) + template_info; + struct tree_constraint_info GTY ((tag ("TS_CP_CONSTRAINT_INFO"))) + constraint_info; + struct tree_userdef_literal GTY ((tag ("TS_CP_USERDEF_LITERAL"))) + userdef_literal; +}; + + +enum cp_tree_index +{ + CPTI_WCHAR_DECL, + CPTI_VTABLE_ENTRY_TYPE, + CPTI_DELTA_TYPE, + CPTI_VTABLE_INDEX_TYPE, + CPTI_CLEANUP_TYPE, + CPTI_VTT_PARM_TYPE, + + CPTI_CLASS_TYPE, + CPTI_UNKNOWN_TYPE, + CPTI_INIT_LIST_TYPE, + CPTI_VTBL_TYPE, + CPTI_VTBL_PTR_TYPE, + CPTI_STD, + CPTI_ABI, + CPTI_CONST_TYPE_INFO_TYPE, + CPTI_TYPE_INFO_PTR_TYPE, + CPTI_ABORT_FNDECL, + CPTI_AGGR_TAG, + + CPTI_CTOR_IDENTIFIER, + CPTI_COMPLETE_CTOR_IDENTIFIER, + CPTI_BASE_CTOR_IDENTIFIER, + CPTI_DTOR_IDENTIFIER, + CPTI_COMPLETE_DTOR_IDENTIFIER, + CPTI_BASE_DTOR_IDENTIFIER, + CPTI_DELETING_DTOR_IDENTIFIER, + CPTI_DELTA_IDENTIFIER, + CPTI_IN_CHARGE_IDENTIFIER, + CPTI_VTT_PARM_IDENTIFIER, + CPTI_NELTS_IDENTIFIER, + CPTI_THIS_IDENTIFIER, + CPTI_PFN_IDENTIFIER, + CPTI_VPTR_IDENTIFIER, + CPTI_STD_IDENTIFIER, + CPTI_AUTO_IDENTIFIER, + CPTI_DECLTYPE_AUTO_IDENTIFIER, + + CPTI_LANG_NAME_C, + CPTI_LANG_NAME_CPLUSPLUS, + + CPTI_EMPTY_EXCEPT_SPEC, + CPTI_NOEXCEPT_TRUE_SPEC, + CPTI_NOEXCEPT_FALSE_SPEC, + CPTI_TERMINATE, + CPTI_CALL_UNEXPECTED, + CPTI_ATEXIT_FN_PTR_TYPE, + CPTI_ATEXIT, + CPTI_DSO_HANDLE, + CPTI_DCAST, + + CPTI_KEYED_CLASSES, + + CPTI_NULLPTR, + CPTI_NULLPTR_TYPE, + + CPTI_ALIGN_TYPE, + + CPTI_ANY_TARG, + + CPTI_MAX +}; + +extern GTY(()) tree cp_global_trees[CPTI_MAX]; + +#define wchar_decl_node cp_global_trees[CPTI_WCHAR_DECL] +#define vtable_entry_type cp_global_trees[CPTI_VTABLE_ENTRY_TYPE] +/* The type used to represent an offset by which to adjust the `this' + pointer in pointer-to-member types. */ +#define delta_type_node cp_global_trees[CPTI_DELTA_TYPE] +/* The type used to represent an index into the vtable. */ +#define vtable_index_type cp_global_trees[CPTI_VTABLE_INDEX_TYPE] + +#define class_type_node cp_global_trees[CPTI_CLASS_TYPE] +#define unknown_type_node cp_global_trees[CPTI_UNKNOWN_TYPE] +#define init_list_type_node cp_global_trees[CPTI_INIT_LIST_TYPE] +#define vtbl_type_node cp_global_trees[CPTI_VTBL_TYPE] +#define vtbl_ptr_type_node cp_global_trees[CPTI_VTBL_PTR_TYPE] +#define std_node cp_global_trees[CPTI_STD] +#define abi_node cp_global_trees[CPTI_ABI] +#define const_type_info_type_node cp_global_trees[CPTI_CONST_TYPE_INFO_TYPE] +#define type_info_ptr_type cp_global_trees[CPTI_TYPE_INFO_PTR_TYPE] +#define abort_fndecl cp_global_trees[CPTI_ABORT_FNDECL] +#define current_aggr cp_global_trees[CPTI_AGGR_TAG] +#define nullptr_node cp_global_trees[CPTI_NULLPTR] +#define nullptr_type_node cp_global_trees[CPTI_NULLPTR_TYPE] +/* std::align_val_t */ +#define align_type_node cp_global_trees[CPTI_ALIGN_TYPE] + +/* We cache these tree nodes so as to call get_identifier less + frequently. */ + +/* The name of a constructor that takes an in-charge parameter to + decide whether or not to construct virtual base classes. */ +#define ctor_identifier cp_global_trees[CPTI_CTOR_IDENTIFIER] +/* The name of a constructor that constructs virtual base classes. */ +#define complete_ctor_identifier cp_global_trees[CPTI_COMPLETE_CTOR_IDENTIFIER] +/* The name of a constructor that does not construct virtual base classes. */ +#define base_ctor_identifier cp_global_trees[CPTI_BASE_CTOR_IDENTIFIER] +/* The name of a destructor that takes an in-charge parameter to + decide whether or not to destroy virtual base classes and whether + or not to delete the object. */ +#define dtor_identifier cp_global_trees[CPTI_DTOR_IDENTIFIER] +/* The name of a destructor that destroys virtual base classes. */ +#define complete_dtor_identifier cp_global_trees[CPTI_COMPLETE_DTOR_IDENTIFIER] +/* The name of a destructor that does not destroy virtual base + classes. */ +#define base_dtor_identifier cp_global_trees[CPTI_BASE_DTOR_IDENTIFIER] +/* The name of a destructor that destroys virtual base classes, and + then deletes the entire object. */ +#define deleting_dtor_identifier cp_global_trees[CPTI_DELETING_DTOR_IDENTIFIER] +#define delta_identifier cp_global_trees[CPTI_DELTA_IDENTIFIER] +#define in_charge_identifier cp_global_trees[CPTI_IN_CHARGE_IDENTIFIER] +/* The name of the parameter that contains a pointer to the VTT to use + for this subobject constructor or destructor. */ +#define vtt_parm_identifier cp_global_trees[CPTI_VTT_PARM_IDENTIFIER] +#define nelts_identifier cp_global_trees[CPTI_NELTS_IDENTIFIER] +#define this_identifier cp_global_trees[CPTI_THIS_IDENTIFIER] +#define pfn_identifier cp_global_trees[CPTI_PFN_IDENTIFIER] +#define vptr_identifier cp_global_trees[CPTI_VPTR_IDENTIFIER] +/* The name of the std namespace. */ +#define std_identifier cp_global_trees[CPTI_STD_IDENTIFIER] +/* auto and declspec(auto) identifiers. */ +#define auto_identifier cp_global_trees[CPTI_AUTO_IDENTIFIER] +#define decltype_auto_identifier cp_global_trees[CPTI_DECLTYPE_AUTO_IDENTIFIER] +/* The name of a C++17 deduction guide. */ +#define lang_name_c cp_global_trees[CPTI_LANG_NAME_C] +#define lang_name_cplusplus cp_global_trees[CPTI_LANG_NAME_CPLUSPLUS] + +/* Exception specifiers used for throw(), noexcept(true) and + noexcept(false). We rely on these being uncloned. */ +#define empty_except_spec cp_global_trees[CPTI_EMPTY_EXCEPT_SPEC] +#define noexcept_true_spec cp_global_trees[CPTI_NOEXCEPT_TRUE_SPEC] +#define noexcept_false_spec cp_global_trees[CPTI_NOEXCEPT_FALSE_SPEC] + +/* The declaration for `std::terminate'. */ +#define terminate_node cp_global_trees[CPTI_TERMINATE] + +/* The declaration for "__cxa_call_unexpected". */ +#define call_unexpected_node cp_global_trees[CPTI_CALL_UNEXPECTED] + +/* The type of the function-pointer argument to "__cxa_atexit" (or + "std::atexit", if "__cxa_atexit" is not being used). */ +#define atexit_fn_ptr_type_node cp_global_trees[CPTI_ATEXIT_FN_PTR_TYPE] + +/* A pointer to `std::atexit'. */ +#define atexit_node cp_global_trees[CPTI_ATEXIT] + +/* A pointer to `__dso_handle'. */ +#define dso_handle_node cp_global_trees[CPTI_DSO_HANDLE] + +/* The declaration of the dynamic_cast runtime. */ +#define dynamic_cast_node cp_global_trees[CPTI_DCAST] + +/* The type of a destructor. */ +#define cleanup_type cp_global_trees[CPTI_CLEANUP_TYPE] + +/* The type of the vtt parameter passed to subobject constructors and + destructors. */ +#define vtt_parm_type cp_global_trees[CPTI_VTT_PARM_TYPE] + +/* A TREE_LIST of the dynamic classes whose vtables may have to be + emitted in this translation unit. */ + +#define keyed_classes cp_global_trees[CPTI_KEYED_CLASSES] + +/* A node which matches any template argument. */ +#define any_targ_node cp_global_trees[CPTI_ANY_TARG] + +/* Node to indicate default access. This must be distinct from the + access nodes in tree.h. */ + +#define access_default_node null_node + +/* Global state. */ + +struct GTY(()) saved_scope { + vec *old_bindings; + tree old_namespace; + vec *decl_ns_list; + tree class_name; + tree class_type; + tree access_specifier; + tree function_decl; + vec *lang_base; + tree lang_name; + tree template_parms; + cp_binding_level *x_previous_class_level; + tree x_saved_tree; + + /* Only used for uses of this in trailing return type. */ + tree x_current_class_ptr; + tree x_current_class_ref; + + int x_processing_template_decl; + int x_processing_specialization; + BOOL_BITFIELD x_processing_explicit_instantiation : 1; + BOOL_BITFIELD need_pop_function_context : 1; + +/* Nonzero if we are parsing the discarded statement of a constexpr + if-statement. */ + BOOL_BITFIELD discarded_stmt : 1; + + int unevaluated_operand; + int inhibit_evaluation_warnings; + int noexcept_operand; + /* If non-zero, implicit "omp declare target" attribute is added into the + attribute lists. */ + int omp_declare_target_attribute; + + struct stmt_tree_s x_stmt_tree; + + cp_binding_level *class_bindings; + cp_binding_level *bindings; + + hash_map *GTY((skip)) x_local_specializations; + + struct saved_scope *prev; +}; + +extern GTY(()) struct saved_scope *scope_chain; + +/* The current open namespace. */ + +#define current_namespace scope_chain->old_namespace + +/* The stack for namespaces of current declarations. */ + +#define decl_namespace_list scope_chain->decl_ns_list + +/* IDENTIFIER_NODE: name of current class */ + +#define current_class_name scope_chain->class_name + +/* _TYPE: the type of the current class */ + +#define current_class_type scope_chain->class_type + +/* When parsing a class definition, the access specifier most recently + given by the user, or, if no access specifier was given, the + default value appropriate for the kind of class (i.e., struct, + class, or union). */ + +#define current_access_specifier scope_chain->access_specifier + +/* Pointer to the top of the language name stack. */ + +#define current_lang_base scope_chain->lang_base +#define current_lang_name scope_chain->lang_name + +/* When parsing a template declaration, a TREE_LIST represents the + active template parameters. Each node in the list represents one + level of template parameters. The innermost level is first in the + list. The depth of each level is stored as an INTEGER_CST in the + TREE_PURPOSE of each node. The parameters for that level are + stored in the TREE_VALUE. */ + +#define current_template_parms scope_chain->template_parms + +#define processing_template_decl scope_chain->x_processing_template_decl +#define processing_specialization scope_chain->x_processing_specialization +#define processing_explicit_instantiation scope_chain->x_processing_explicit_instantiation + +#define in_discarded_stmt scope_chain->discarded_stmt + +/* RAII sentinel to handle clearing processing_template_decl and restoring + it when done. */ + +struct processing_template_decl_sentinel +{ + int saved; + processing_template_decl_sentinel (bool reset = true) + : saved (processing_template_decl) + { + if (reset) + processing_template_decl = 0; + } + ~processing_template_decl_sentinel() + { + processing_template_decl = saved; + } +}; + +/* RAII sentinel to disable certain warnings during template substitution + and elsewhere. */ + +struct warning_sentinel +{ + int &flag; + int val; + warning_sentinel(int& flag, bool suppress=true) + : flag(flag), val(flag) { if (suppress) flag = 0; } + ~warning_sentinel() { flag = val; } +}; + +/* The cached class binding level, from the most recently exited + class, or NULL if none. */ + +#define previous_class_level scope_chain->x_previous_class_level + +/* A map from local variable declarations in the body of the template + presently being instantiated to the corresponding instantiated + local variables. */ + +#define local_specializations scope_chain->x_local_specializations + +/* Nonzero if we are parsing the operand of a noexcept operator. */ + +#define cp_noexcept_operand scope_chain->noexcept_operand + +/* A list of private types mentioned, for deferred access checking. */ + +struct GTY((for_user)) cxx_int_tree_map { + unsigned int uid; + tree to; +}; + +struct cxx_int_tree_map_hasher : ggc_ptr_hash +{ + static hashval_t hash (cxx_int_tree_map *); + static bool equal (cxx_int_tree_map *, cxx_int_tree_map *); +}; + +struct named_label_entry; + +struct named_label_hasher : ggc_ptr_hash +{ + static hashval_t hash (named_label_entry *); + static bool equal (named_label_entry *, named_label_entry *); +}; + +/* Global state pertinent to the current function. */ + +struct GTY(()) language_function { + struct c_language_function base; + + tree x_cdtor_label; + tree x_current_class_ptr; + tree x_current_class_ref; + tree x_eh_spec_block; + tree x_in_charge_parm; + tree x_vtt_parm; + tree x_return_value; + tree x_auto_return_pattern; + + BOOL_BITFIELD returns_value : 1; + BOOL_BITFIELD returns_null : 1; + BOOL_BITFIELD returns_abnormally : 1; + BOOL_BITFIELD infinite_loop: 1; + BOOL_BITFIELD x_in_function_try_handler : 1; + BOOL_BITFIELD x_in_base_initializer : 1; + + /* True if this function can throw an exception. */ + BOOL_BITFIELD can_throw : 1; + + BOOL_BITFIELD invalid_constexpr : 1; + + hash_table *x_named_labels; + cp_binding_level *bindings; + vec *x_local_names; + /* Tracking possibly infinite loops. This is a vec only because + vec doesn't work with gtype. */ + vec *infinite_loops; + hash_table *extern_decl_map; +}; + +/* The current C++-specific per-function global variables. */ + +#define cp_function_chain (cfun->language) + +/* In a constructor destructor, the point at which all derived class + destroying/construction has been done. I.e., just before a + constructor returns, or before any base class destroying will be done + in a destructor. */ + +#define cdtor_label cp_function_chain->x_cdtor_label + +/* When we're processing a member function, current_class_ptr is the + PARM_DECL for the `this' pointer. The current_class_ref is an + expression for `*this'. */ + +#define current_class_ptr \ + (*(cfun && cp_function_chain \ + ? &cp_function_chain->x_current_class_ptr \ + : &scope_chain->x_current_class_ptr)) +#define current_class_ref \ + (*(cfun && cp_function_chain \ + ? &cp_function_chain->x_current_class_ref \ + : &scope_chain->x_current_class_ref)) + +/* The EH_SPEC_BLOCK for the exception-specifiers for the current + function, if any. */ + +#define current_eh_spec_block cp_function_chain->x_eh_spec_block + +/* The `__in_chrg' parameter for the current function. Only used for + constructors and destructors. */ + +#define current_in_charge_parm cp_function_chain->x_in_charge_parm + +/* The `__vtt_parm' parameter for the current function. Only used for + constructors and destructors. */ + +#define current_vtt_parm cp_function_chain->x_vtt_parm + +/* Set to 0 at beginning of a function definition, set to 1 if + a return statement that specifies a return value is seen. */ + +#define current_function_returns_value cp_function_chain->returns_value + +/* Set to 0 at beginning of a function definition, set to 1 if + a return statement with no argument is seen. */ + +#define current_function_returns_null cp_function_chain->returns_null + +/* Set to 0 at beginning of a function definition, set to 1 if + a call to a noreturn function is seen. */ + +#define current_function_returns_abnormally \ + cp_function_chain->returns_abnormally + +/* Set to 0 at beginning of a function definition, set to 1 if we see an + obvious infinite loop. This can have false positives and false + negatives, so it should only be used as a heuristic. */ + +#define current_function_infinite_loop cp_function_chain->infinite_loop + +/* Nonzero if we are processing a base initializer. Zero elsewhere. */ +#define in_base_initializer cp_function_chain->x_in_base_initializer + +#define in_function_try_handler cp_function_chain->x_in_function_try_handler + +/* Expression always returned from function, or error_mark_node + otherwise, for use by the automatic named return value optimization. */ + +#define current_function_return_value \ + (cp_function_chain->x_return_value) + +/* A type involving 'auto' to be used for return type deduction. */ + +#define current_function_auto_return_pattern \ + (cp_function_chain->x_auto_return_pattern) + +/* True if NAME is the IDENTIFIER_NODE for an overloaded "operator + new" or "operator delete". */ +#define NEW_DELETE_OPNAME_P(NAME) \ + ((NAME) == cp_operator_id (NEW_EXPR) \ + || (NAME) == cp_operator_id (VEC_NEW_EXPR) \ + || (NAME) == cp_operator_id (DELETE_EXPR) \ + || (NAME) == cp_operator_id (VEC_DELETE_EXPR)) + +#define cp_operator_id(CODE) \ + (operator_name_info[(int) (CODE)].identifier) +#define cp_assignment_operator_id(CODE) \ + (assignment_operator_name_info[(int) (CODE)].identifier) +/* In parser.c. */ +extern tree cp_literal_operator_id (const char *); + +/* TRUE if a tree code represents a statement. */ +extern bool statement_code_p[MAX_TREE_CODES]; + +#define STATEMENT_CODE_P(CODE) statement_code_p[(int) (CODE)] + +enum languages { lang_c, lang_cplusplus }; + +/* Macros to make error reporting functions' lives easier. */ +#define TYPE_LINKAGE_IDENTIFIER(NODE) \ + (TYPE_IDENTIFIER (TYPE_MAIN_VARIANT (NODE))) +#define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (TYPE_IDENTIFIER (NODE))) +#define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (TYPE_IDENTIFIER (NODE))) + +/* Nonzero if NODE has no name for linkage purposes. */ +#define TYPE_UNNAMED_P(NODE) \ + (OVERLOAD_TYPE_P (NODE) && anon_aggrname_p (TYPE_LINKAGE_IDENTIFIER (NODE))) + +/* The _DECL for this _TYPE. */ +#define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE))) + +/* Nonzero if T is a type that could resolve to any kind of concrete type + at instantiation time. */ +#define WILDCARD_TYPE_P(T) \ + (TREE_CODE (T) == TEMPLATE_TYPE_PARM \ + || TREE_CODE (T) == TYPENAME_TYPE \ + || TREE_CODE (T) == TYPEOF_TYPE \ + || TREE_CODE (T) == BOUND_TEMPLATE_TEMPLATE_PARM \ + || TREE_CODE (T) == DECLTYPE_TYPE) + +/* Nonzero if T is a class (or struct or union) type. Also nonzero + for template type parameters, typename types, and instantiated + template template parameters. Keep these checks in ascending code + order. */ +#define MAYBE_CLASS_TYPE_P(T) (WILDCARD_TYPE_P (T) || CLASS_TYPE_P (T)) + +/* Set CLASS_TYPE_P for T to VAL. T must be a class, struct, or + union type. */ +#define SET_CLASS_TYPE_P(T, VAL) \ + (TYPE_LANG_FLAG_5 (T) = (VAL)) + +/* Nonzero if T is a class type. Zero for template type parameters, + typename types, and so forth. */ +#define CLASS_TYPE_P(T) \ + (RECORD_OR_UNION_CODE_P (TREE_CODE (T)) && TYPE_LANG_FLAG_5 (T)) + +/* Nonzero if T is a class type but not an union. */ +#define NON_UNION_CLASS_TYPE_P(T) \ + (CLASS_TYPE_P (T) && TREE_CODE (T) != UNION_TYPE) + +/* Keep these checks in ascending code order. */ +#define RECORD_OR_UNION_CODE_P(T) \ + ((T) == RECORD_TYPE || (T) == UNION_TYPE) +#define OVERLOAD_TYPE_P(T) \ + (CLASS_TYPE_P (T) || TREE_CODE (T) == ENUMERAL_TYPE) + +/* True if this type is dependent. This predicate is only valid if + TYPE_DEPENDENT_P_VALID is true. */ +#define TYPE_DEPENDENT_P(NODE) TYPE_LANG_FLAG_0 (NODE) + +/* True if dependent_type_p has been called for this type, with the + result that TYPE_DEPENDENT_P is valid. */ +#define TYPE_DEPENDENT_P_VALID(NODE) TYPE_LANG_FLAG_6(NODE) + +/* Nonzero if this type is const-qualified. */ +#define CP_TYPE_CONST_P(NODE) \ + ((cp_type_quals (NODE) & TYPE_QUAL_CONST) != 0) + +/* Nonzero if this type is volatile-qualified. */ +#define CP_TYPE_VOLATILE_P(NODE) \ + ((cp_type_quals (NODE) & TYPE_QUAL_VOLATILE) != 0) + +/* Nonzero if this type is restrict-qualified. */ +#define CP_TYPE_RESTRICT_P(NODE) \ + ((cp_type_quals (NODE) & TYPE_QUAL_RESTRICT) != 0) + +/* Nonzero if this type is const-qualified, but not + volatile-qualified. Other qualifiers are ignored. This macro is + used to test whether or not it is OK to bind an rvalue to a + reference. */ +#define CP_TYPE_CONST_NON_VOLATILE_P(NODE) \ + ((cp_type_quals (NODE) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)) \ + == TYPE_QUAL_CONST) + +#define FUNCTION_ARG_CHAIN(NODE) \ + TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (NODE))) + +/* Given a FUNCTION_DECL, returns the first TREE_LIST out of TYPE_ARG_TYPES + which refers to a user-written parameter. */ +#define FUNCTION_FIRST_USER_PARMTYPE(NODE) \ + skip_artificial_parms_for ((NODE), TYPE_ARG_TYPES (TREE_TYPE (NODE))) + +/* Similarly, but for DECL_ARGUMENTS. */ +#define FUNCTION_FIRST_USER_PARM(NODE) \ + skip_artificial_parms_for ((NODE), DECL_ARGUMENTS (NODE)) + +/* Nonzero iff TYPE is derived from PARENT. Ignores accessibility and + ambiguity issues. */ +#define DERIVED_FROM_P(PARENT, TYPE) \ + (lookup_base ((TYPE), (PARENT), ba_any, NULL, tf_none) != NULL_TREE) + +/* Gives the visibility specification for a class type. */ +#define CLASSTYPE_VISIBILITY(TYPE) \ + DECL_VISIBILITY (TYPE_MAIN_DECL (TYPE)) +#define CLASSTYPE_VISIBILITY_SPECIFIED(TYPE) \ + DECL_VISIBILITY_SPECIFIED (TYPE_MAIN_DECL (TYPE)) + +struct GTY (()) tree_pair_s { + tree purpose; + tree value; +}; +typedef tree_pair_s *tree_pair_p; + +/* This is a few header flags for 'struct lang_type'. Actually, + all but the first are used only for lang_type_class; they + are put in this structure to save space. */ +struct GTY(()) lang_type_header { + BOOL_BITFIELD is_lang_type_class : 1; + + BOOL_BITFIELD has_type_conversion : 1; + BOOL_BITFIELD has_copy_ctor : 1; + BOOL_BITFIELD has_default_ctor : 1; + BOOL_BITFIELD const_needs_init : 1; + BOOL_BITFIELD ref_needs_init : 1; + BOOL_BITFIELD has_const_copy_assign : 1; + + BOOL_BITFIELD spare : 1; +}; + +/* This structure provides additional information above and beyond + what is provide in the ordinary tree_type. In the past, we used it + for the types of class types, template parameters types, typename + types, and so forth. However, there can be many (tens to hundreds + of thousands) of template parameter types in a compilation, and + there's no need for this additional information in that case. + Therefore, we now use this data structure only for class types. + + In the past, it was thought that there would be relatively few + class types. However, in the presence of heavy use of templates, + many (i.e., thousands) of classes can easily be generated. + Therefore, we should endeavor to keep the size of this structure to + a minimum. */ +struct GTY(()) lang_type_class { + struct lang_type_header h; + + unsigned char align; + + unsigned has_mutable : 1; + unsigned com_interface : 1; + unsigned non_pod_class : 1; + unsigned nearly_empty_p : 1; + unsigned user_align : 1; + unsigned has_copy_assign : 1; + unsigned has_new : 1; + unsigned has_array_new : 1; + + unsigned gets_delete : 2; + unsigned interface_only : 1; + unsigned interface_unknown : 1; + unsigned contains_empty_class_p : 1; + unsigned anon_aggr : 1; + unsigned non_zero_init : 1; + unsigned empty_p : 1; + + unsigned vec_new_uses_cookie : 1; + unsigned declared_class : 1; + unsigned diamond_shaped : 1; + unsigned repeated_base : 1; + unsigned being_defined : 1; + unsigned debug_requested : 1; + unsigned fields_readonly : 1; + unsigned ptrmemfunc_flag : 1; + + unsigned use_template : 2; + unsigned was_anonymous : 1; + unsigned lazy_default_ctor : 1; + unsigned lazy_copy_ctor : 1; + unsigned lazy_copy_assign : 1; + unsigned lazy_destructor : 1; + unsigned has_const_copy_ctor : 1; + + unsigned has_complex_copy_ctor : 1; + unsigned has_complex_copy_assign : 1; + unsigned non_aggregate : 1; + unsigned has_complex_dflt : 1; + unsigned has_list_ctor : 1; + unsigned non_std_layout : 1; + unsigned is_literal : 1; + unsigned lazy_move_ctor : 1; + + unsigned lazy_move_assign : 1; + unsigned has_complex_move_ctor : 1; + unsigned has_complex_move_assign : 1; + unsigned has_constexpr_ctor : 1; + unsigned unique_obj_representations : 1; + unsigned unique_obj_representations_set : 1; + + /* When adding a flag here, consider whether or not it ought to + apply to a template instance if it applies to the template. If + so, make sure to copy it in instantiate_class_template! */ + + /* There are some bits left to fill out a 32-bit word. Keep track + of this by updating the size of this bitfield whenever you add or + remove a flag. */ + unsigned dummy : 2; + + tree primary_base; + vec *vcall_indices; + tree vtables; + tree typeinfo_var; + vec *vbases; + binding_table nested_udts; + tree as_base; + vec *pure_virtuals; + tree friend_classes; + vec * GTY((reorder ("resort_type_method_vec"))) methods; + tree key_method; + tree decl_list; + tree template_info; + tree befriending_classes; + /* In a RECORD_TYPE, information specific to Objective-C++, such + as a list of adopted protocols or a pointer to a corresponding + @interface. See objc/objc-act.h for details. */ + tree objc_info; + /* sorted_fields is sorted based on a pointer, so we need to be able + to resort it if pointers get rearranged. */ + struct sorted_fields_type * GTY ((reorder ("resort_sorted_fields"))) + sorted_fields; + /* FIXME reuse another field? */ + tree lambda_expr; +}; + +struct GTY(()) lang_type_ptrmem { + struct lang_type_header h; + tree record; +}; + +struct GTY(()) lang_type { + union lang_type_u + { + struct lang_type_header GTY((skip (""))) h; + struct lang_type_class GTY((tag ("1"))) c; + struct lang_type_ptrmem GTY((tag ("0"))) ptrmem; + } GTY((desc ("%h.h.is_lang_type_class"))) u; +}; + +#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007) + +#define LANG_TYPE_CLASS_CHECK(NODE) __extension__ \ +({ struct lang_type *lt = TYPE_LANG_SPECIFIC (NODE); \ + if (! lt->u.h.is_lang_type_class) \ + lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \ + <->u.c; }) + +#define LANG_TYPE_PTRMEM_CHECK(NODE) __extension__ \ +({ struct lang_type *lt = TYPE_LANG_SPECIFIC (NODE); \ + if (lt->u.h.is_lang_type_class) \ + lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \ + <->u.ptrmem; }) + +#else + +#define LANG_TYPE_CLASS_CHECK(NODE) (&TYPE_LANG_SPECIFIC (NODE)->u.c) +#define LANG_TYPE_PTRMEM_CHECK(NODE) (&TYPE_LANG_SPECIFIC (NODE)->u.ptrmem) + +#endif /* ENABLE_TREE_CHECKING */ + +/* Nonzero for _CLASSTYPE means that operator delete is defined. */ +#define TYPE_GETS_DELETE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->gets_delete) +#define TYPE_GETS_REG_DELETE(NODE) (TYPE_GETS_DELETE (NODE) & 1) + +/* Nonzero if `new NODE[x]' should cause the allocation of extra + storage to indicate how many array elements are in use. */ +#define TYPE_VEC_NEW_USES_COOKIE(NODE) \ + (CLASS_TYPE_P (NODE) \ + && LANG_TYPE_CLASS_CHECK (NODE)->vec_new_uses_cookie) + +/* Nonzero means that this _CLASSTYPE node defines ways of converting + itself to other types. */ +#define TYPE_HAS_CONVERSION(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->h.has_type_conversion) + +/* Nonzero means that NODE (a class type) has a default constructor -- + but that it has not yet been declared. */ +#define CLASSTYPE_LAZY_DEFAULT_CTOR(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->lazy_default_ctor) + +/* Nonzero means that NODE (a class type) has a copy constructor -- + but that it has not yet been declared. */ +#define CLASSTYPE_LAZY_COPY_CTOR(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->lazy_copy_ctor) + +/* Nonzero means that NODE (a class type) has a move constructor -- + but that it has not yet been declared. */ +#define CLASSTYPE_LAZY_MOVE_CTOR(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->lazy_move_ctor) + +/* Nonzero means that NODE (a class type) has an assignment operator + -- but that it has not yet been declared. */ +#define CLASSTYPE_LAZY_COPY_ASSIGN(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->lazy_copy_assign) + +/* Nonzero means that NODE (a class type) has an assignment operator + -- but that it has not yet been declared. */ +#define CLASSTYPE_LAZY_MOVE_ASSIGN(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->lazy_move_assign) + +/* Nonzero means that NODE (a class type) has a destructor -- but that + it has not yet been declared. */ +#define CLASSTYPE_LAZY_DESTRUCTOR(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->lazy_destructor) + +/* Nonzero means that NODE (a class type) is final */ +#define CLASSTYPE_FINAL(NODE) \ + TYPE_FINAL_P (NODE) + + +/* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */ +#define TYPE_HAS_COPY_ASSIGN(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_copy_assign) + +/* True iff the class type NODE has an "operator =" whose parameter + has a parameter of type "const X&". */ +#define TYPE_HAS_CONST_COPY_ASSIGN(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->h.has_const_copy_assign) + +/* Nonzero means that this _CLASSTYPE node has an X(X&) constructor. */ +#define TYPE_HAS_COPY_CTOR(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->h.has_copy_ctor) +#define TYPE_HAS_CONST_COPY_CTOR(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->has_const_copy_ctor) + +/* Nonzero if this class has an X(initializer_list) constructor. */ +#define TYPE_HAS_LIST_CTOR(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->has_list_ctor) + +/* Nonzero if this class has a constexpr constructor other than a copy/move + constructor. Note that a class can have constexpr constructors for + static initialization even if it isn't a literal class. */ +#define TYPE_HAS_CONSTEXPR_CTOR(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->has_constexpr_ctor) + +/* Nonzero if this class defines an overloaded operator new. (An + operator new [] doesn't count.) */ +#define TYPE_HAS_NEW_OPERATOR(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->has_new) + +/* Nonzero if this class defines an overloaded operator new[]. */ +#define TYPE_HAS_ARRAY_NEW_OPERATOR(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->has_array_new) + +/* Nonzero means that this type is being defined. I.e., the left brace + starting the definition of this type has been seen. */ +#define TYPE_BEING_DEFINED(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->being_defined) + +/* Nonzero means that this type is either complete or being defined, so we + can do lookup in it. */ +#define COMPLETE_OR_OPEN_TYPE_P(NODE) \ + (COMPLETE_TYPE_P (NODE) || (CLASS_TYPE_P (NODE) && TYPE_BEING_DEFINED (NODE))) + +/* Mark bits for repeated base checks. */ +#define TYPE_MARKED_P(NODE) TREE_LANG_FLAG_6 (TYPE_CHECK (NODE)) + +/* Nonzero if the class NODE has multiple paths to the same (virtual) + base object. */ +#define CLASSTYPE_DIAMOND_SHAPED_P(NODE) \ + (LANG_TYPE_CLASS_CHECK(NODE)->diamond_shaped) + +/* Nonzero if the class NODE has multiple instances of the same base + type. */ +#define CLASSTYPE_REPEATED_BASE_P(NODE) \ + (LANG_TYPE_CLASS_CHECK(NODE)->repeated_base) + +/* The member function with which the vtable will be emitted: + the first noninline non-pure-virtual member function. NULL_TREE + if there is no key function or if this is a class template */ +#define CLASSTYPE_KEY_METHOD(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->key_method) + +/* Vector member functions defined in this class. Each element is + either a FUNCTION_DECL, a TEMPLATE_DECL, or an OVERLOAD. All + functions with the same name end up in the same slot. The first + two elements are for constructors, and destructors, respectively. + All template conversion operators to innermost template dependent + types are overloaded on the next slot, if they exist. Note, the + names for these functions will not all be the same. The + non-template conversion operators & templated conversions to + non-innermost template types are next, followed by ordinary member + functions. There may be empty entries at the end of the vector. + The conversion operators are unsorted. The ordinary member + functions are sorted, once the class is complete. */ +#define CLASSTYPE_METHOD_VEC(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->methods) + +/* For class templates, this is a TREE_LIST of all member data, + functions, types, and friends in the order of declaration. + The TREE_PURPOSE of each TREE_LIST is NULL_TREE for a friend, + and the RECORD_TYPE for the class template otherwise. */ +#define CLASSTYPE_DECL_LIST(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->decl_list) + +/* The slot in the CLASSTYPE_METHOD_VEC where constructors go. */ +#define CLASSTYPE_CONSTRUCTOR_SLOT 0 + +/* The slot in the CLASSTYPE_METHOD_VEC where destructors go. */ +#define CLASSTYPE_DESTRUCTOR_SLOT 1 + +/* The first slot in the CLASSTYPE_METHOD_VEC where conversion + operators can appear. */ +#define CLASSTYPE_FIRST_CONVERSION_SLOT 2 + +/* A FUNCTION_DECL or OVERLOAD for the constructors for NODE. These + are the constructors that take an in-charge parameter. */ +#define CLASSTYPE_CONSTRUCTORS(NODE) \ + ((*CLASSTYPE_METHOD_VEC (NODE))[CLASSTYPE_CONSTRUCTOR_SLOT]) + +/* A FUNCTION_DECL for the destructor for NODE. These are the + destructors that take an in-charge parameter. If + CLASSTYPE_LAZY_DESTRUCTOR is true, then this entry will be NULL + until the destructor is created with lazily_declare_fn. */ +#define CLASSTYPE_DESTRUCTORS(NODE) \ + (CLASSTYPE_METHOD_VEC (NODE) \ + ? (*CLASSTYPE_METHOD_VEC (NODE))[CLASSTYPE_DESTRUCTOR_SLOT] \ + : NULL_TREE) + +/* A dictionary of the nested user-defined-types (class-types, or enums) + found within this class. This table includes nested member class + templates. */ +#define CLASSTYPE_NESTED_UTDS(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->nested_udts) + +/* Nonzero if NODE has a primary base class, i.e., a base class with + which it shares the virtual function table pointer. */ +#define CLASSTYPE_HAS_PRIMARY_BASE_P(NODE) \ + (CLASSTYPE_PRIMARY_BINFO (NODE) != NULL_TREE) + +/* If non-NULL, this is the binfo for the primary base class, i.e., + the base class which contains the virtual function table pointer + for this class. */ +#define CLASSTYPE_PRIMARY_BINFO(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->primary_base) + +/* A vector of BINFOs for the direct and indirect virtual base classes + that this type uses in a post-order depth-first left-to-right + order. (In other words, these bases appear in the order that they + should be initialized.) */ +#define CLASSTYPE_VBASECLASSES(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->vbases) + +/* The type corresponding to NODE when NODE is used as a base class, + i.e., NODE without virtual base classes or tail padding. */ + +#define CLASSTYPE_AS_BASE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->as_base) + +/* True iff NODE is the CLASSTYPE_AS_BASE version of some type. */ + +#define IS_FAKE_BASE_TYPE(NODE) \ + (TREE_CODE (NODE) == RECORD_TYPE \ + && TYPE_CONTEXT (NODE) && CLASS_TYPE_P (TYPE_CONTEXT (NODE)) \ + && CLASSTYPE_AS_BASE (TYPE_CONTEXT (NODE)) == (NODE)) + +/* These are the size and alignment of the type without its virtual + base classes, for when we use this type as a base itself. */ +#define CLASSTYPE_SIZE(NODE) TYPE_SIZE (CLASSTYPE_AS_BASE (NODE)) +#define CLASSTYPE_SIZE_UNIT(NODE) TYPE_SIZE_UNIT (CLASSTYPE_AS_BASE (NODE)) +#define CLASSTYPE_ALIGN(NODE) TYPE_ALIGN (CLASSTYPE_AS_BASE (NODE)) +#define CLASSTYPE_USER_ALIGN(NODE) TYPE_USER_ALIGN (CLASSTYPE_AS_BASE (NODE)) + +/* The alignment of NODE, without its virtual bases, in bytes. */ +#define CLASSTYPE_ALIGN_UNIT(NODE) \ + (CLASSTYPE_ALIGN (NODE) / BITS_PER_UNIT) + +/* A vec of virtual functions which cannot be inherited by + derived classes. When deriving from this type, the derived + class must provide its own definition for each of these functions. */ +#define CLASSTYPE_PURE_VIRTUALS(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->pure_virtuals) + +/* Nonzero means that this type is an abstract class type. */ +#define ABSTRACT_CLASS_TYPE_P(NODE) \ + (CLASS_TYPE_P (NODE) && CLASSTYPE_PURE_VIRTUALS(NODE)) + +/* Nonzero means that this type has an X() constructor. */ +#define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->h.has_default_ctor) + +/* Nonzero means that this type contains a mutable member. */ +#define CLASSTYPE_HAS_MUTABLE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_mutable) +#define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE)) + +/* Nonzero means that this class type is not POD for the purpose of layout + (as defined in the ABI). This is different from the language's POD. */ +#define CLASSTYPE_NON_LAYOUT_POD_P(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->non_pod_class) + +/* Nonzero means that this class type is a non-standard-layout class. */ +#define CLASSTYPE_NON_STD_LAYOUT(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->non_std_layout) + +/* Nonzero means that this class type does have unique object + representations. */ +#define CLASSTYPE_UNIQUE_OBJ_REPRESENTATIONS(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->unique_obj_representations) + +/* Nonzero means that this class type has + CLASSTYPE_UNIQUE_OBJ_REPRESENTATIONS computed. */ +#define CLASSTYPE_UNIQUE_OBJ_REPRESENTATIONS_SET(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->unique_obj_representations_set) + +/* Nonzero means that this class contains pod types whose default + initialization is not a zero initialization (namely, pointers to + data members). */ +#define CLASSTYPE_NON_ZERO_INIT_P(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->non_zero_init) + +/* Nonzero if this class is "empty" in the sense of the C++ ABI. */ +#define CLASSTYPE_EMPTY_P(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->empty_p) + +/* Nonzero if this class is "nearly empty", i.e., contains only a + virtual function table pointer. */ +#define CLASSTYPE_NEARLY_EMPTY_P(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->nearly_empty_p) + +/* Nonzero if this class contains an empty subobject. */ +#define CLASSTYPE_CONTAINS_EMPTY_CLASS_P(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->contains_empty_class_p) + +/* A list of class types of which this type is a friend. The + TREE_VALUE is normally a TYPE, but will be a TEMPLATE_DECL in the + case of a template friend. */ +#define CLASSTYPE_FRIEND_CLASSES(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->friend_classes) + +/* A list of the classes which grant friendship to this class. */ +#define CLASSTYPE_BEFRIENDING_CLASSES(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->befriending_classes) + +/* The associated LAMBDA_EXPR that made this class. */ +#define CLASSTYPE_LAMBDA_EXPR(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->lambda_expr) +/* The extra mangling scope for this closure type. */ +#define LAMBDA_TYPE_EXTRA_SCOPE(NODE) \ + (LAMBDA_EXPR_EXTRA_SCOPE (CLASSTYPE_LAMBDA_EXPR (NODE))) + +/* Say whether this node was declared as a "class" or a "struct". */ +#define CLASSTYPE_DECLARED_CLASS(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->declared_class) + +/* Nonzero if this class has const members + which have no specified initialization. */ +#define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) \ + (TYPE_LANG_SPECIFIC (NODE) \ + ? LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init : 0) +#define SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE, VALUE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init = (VALUE)) + +/* Nonzero if this class has ref members + which have no specified initialization. */ +#define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) \ + (TYPE_LANG_SPECIFIC (NODE) \ + ? LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init : 0) +#define SET_CLASSTYPE_REF_FIELDS_NEED_INIT(NODE, VALUE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init = (VALUE)) + +/* Nonzero if this class is included from a header file which employs + `#pragma interface', and it is not included in its implementation file. */ +#define CLASSTYPE_INTERFACE_ONLY(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->interface_only) + +/* True if we have already determined whether or not vtables, VTTs, + typeinfo, and other similar per-class data should be emitted in + this translation unit. This flag does not indicate whether or not + these items should be emitted; it only indicates that we know one + way or the other. */ +#define CLASSTYPE_INTERFACE_KNOWN(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown == 0) +/* The opposite of CLASSTYPE_INTERFACE_KNOWN. */ +#define CLASSTYPE_INTERFACE_UNKNOWN(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown) + +#define SET_CLASSTYPE_INTERFACE_UNKNOWN_X(NODE,X) \ + (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = !!(X)) +#define SET_CLASSTYPE_INTERFACE_UNKNOWN(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = 1) +#define SET_CLASSTYPE_INTERFACE_KNOWN(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = 0) + +/* Nonzero if a _DECL node requires us to output debug info for this class. */ +#define CLASSTYPE_DEBUG_REQUESTED(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->debug_requested) + +/* Additional macros for inheritance information. */ + +/* Nonzero means that this class is on a path leading to a new vtable. */ +#define BINFO_VTABLE_PATH_MARKED(NODE) BINFO_FLAG_1 (NODE) + +/* Nonzero means B (a BINFO) has its own vtable. Any copies will not + have this flag set. */ +#define BINFO_NEW_VTABLE_MARKED(B) (BINFO_FLAG_2 (B)) + +/* Compare a BINFO_TYPE with another type for equality. For a binfo, + this is functionally equivalent to using same_type_p, but + measurably faster. At least one of the arguments must be a + BINFO_TYPE. The other can be a BINFO_TYPE or a regular type. If + BINFO_TYPE(T) ever stops being the main variant of the class the + binfo is for, this macro must change. */ +#define SAME_BINFO_TYPE_P(A, B) ((A) == (B)) + +/* Any subobject that needs a new vtable must have a vptr and must not + be a non-virtual primary base (since it would then use the vtable from a + derived class and never become non-primary.) */ +#define SET_BINFO_NEW_VTABLE_MARKED(B) \ + (BINFO_NEW_VTABLE_MARKED (B) = 1, \ + gcc_assert (!BINFO_PRIMARY_P (B) || BINFO_VIRTUAL_P (B)), \ + gcc_assert (TYPE_VFIELD (BINFO_TYPE (B)))) + +/* Nonzero if this binfo is for a dependent base - one that should not + be searched. */ +#define BINFO_DEPENDENT_BASE_P(NODE) BINFO_FLAG_3 (NODE) + +/* Nonzero if this binfo has lost its primary base binfo (because that + is a nearly-empty virtual base that has been taken by some other + base in the complete hierarchy. */ +#define BINFO_LOST_PRIMARY_P(NODE) BINFO_FLAG_4 (NODE) + +/* Nonzero if this BINFO is a primary base class. */ +#define BINFO_PRIMARY_P(NODE) BINFO_FLAG_5(NODE) + +/* Used by various search routines. */ +#define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE) + +/* A vec of the vcall indices associated with the class + NODE. The PURPOSE of each element is a FUNCTION_DECL for a virtual + function. The VALUE is the index into the virtual table where the + vcall offset for that function is stored, when NODE is a virtual + base. */ +#define CLASSTYPE_VCALL_INDICES(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->vcall_indices) + +/* The various vtables for the class NODE. The primary vtable will be + first, followed by the construction vtables and VTT, if any. */ +#define CLASSTYPE_VTABLES(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->vtables) + +/* The std::type_info variable representing this class, or NULL if no + such variable has been created. This field is only set for the + TYPE_MAIN_VARIANT of the class. */ +#define CLASSTYPE_TYPEINFO_VAR(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->typeinfo_var) + +/* Accessor macros for the BINFO_VIRTUALS list. */ + +/* The number of bytes by which to adjust the `this' pointer when + calling this virtual function. Subtract this value from the this + pointer. Always non-NULL, might be constant zero though. */ +#define BV_DELTA(NODE) (TREE_PURPOSE (NODE)) + +/* If non-NULL, the vtable index at which to find the vcall offset + when calling this virtual function. Add the value at that vtable + index to the this pointer. */ +#define BV_VCALL_INDEX(NODE) (TREE_TYPE (NODE)) + +/* The function to call. */ +#define BV_FN(NODE) (TREE_VALUE (NODE)) + +/* Whether or not this entry is for a lost primary virtual base. */ +#define BV_LOST_PRIMARY(NODE) (TREE_LANG_FLAG_0 (NODE)) + +/* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that + this type can raise. Each TREE_VALUE is a _TYPE. The TREE_VALUE + will be NULL_TREE to indicate a throw specification of `()', or + no exceptions allowed. For a noexcept specification, TREE_VALUE + is NULL_TREE and TREE_PURPOSE is the constant-expression. For + a deferred noexcept-specification, TREE_PURPOSE is a DEFERRED_NOEXCEPT + (for templates) or an OVERLOAD list of functions (for implicitly + declared functions). */ +#define TYPE_RAISES_EXCEPTIONS(NODE) \ + TYPE_LANG_SLOT_1 (FUNC_OR_METHOD_CHECK (NODE)) + +/* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()' + or noexcept(true). */ +#define TYPE_NOTHROW_P(NODE) nothrow_spec_p (TYPE_RAISES_EXCEPTIONS (NODE)) + +/* For FUNCTION_TYPE or METHOD_TYPE, true if NODE is noexcept. This is the + case for things declared noexcept(true) and, with -fnothrow-opt, for + throw() functions. */ +#define TYPE_NOEXCEPT_P(NODE) type_noexcept_p (NODE) + +/* The binding level associated with the namespace. */ +#define NAMESPACE_LEVEL(NODE) \ + (LANG_DECL_NS_CHECK (NODE)->level) + +/* Flags shared by all forms of DECL_LANG_SPECIFIC. + + Some of the flags live here only to make lang_decl_min/fn smaller. Do + not make this struct larger than 32 bits; instead, make sel smaller. */ + +struct GTY(()) lang_decl_base { + unsigned selector : 16; /* Larger than necessary for faster access. */ + ENUM_BITFIELD(languages) language : 1; + unsigned use_template : 2; + unsigned not_really_extern : 1; /* var or fn */ + unsigned initialized_in_class : 1; /* var or fn */ + unsigned repo_available_p : 1; /* var or fn */ + unsigned threadprivate_or_deleted_p : 1; /* var or fn */ + unsigned anticipated_p : 1; /* fn, type or template */ + /* anticipated_p reused as DECL_OMP_PRIVATIZED_MEMBER in var */ + unsigned friend_or_tls : 1; /* var, fn, type or template */ + unsigned template_conv_p : 1; /* var or template */ + unsigned odr_used : 1; /* var or fn */ + unsigned u2sel : 1; + unsigned concept_p : 1; /* applies to vars and functions */ + unsigned var_declared_inline_p : 1; /* var */ + unsigned decomposition_p : 1; /* var */ + /* 1 spare bit */ +}; + +/* True for DECL codes which have template info and access. */ +#define LANG_DECL_HAS_MIN(NODE) \ + (VAR_OR_FUNCTION_DECL_P (NODE) \ + || TREE_CODE (NODE) == FIELD_DECL \ + || TREE_CODE (NODE) == CONST_DECL \ + || TREE_CODE (NODE) == TYPE_DECL \ + || TREE_CODE (NODE) == TEMPLATE_DECL \ + || TREE_CODE (NODE) == USING_DECL) + +/* DECL_LANG_SPECIFIC for the above codes. */ + +struct GTY(()) lang_decl_min { + struct lang_decl_base base; + + /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is + THUNK_ALIAS. + In a FUNCTION_DECL for which DECL_THUNK_P does not hold, + VAR_DECL, TYPE_DECL, or TEMPLATE_DECL, this is + DECL_TEMPLATE_INFO. */ + tree template_info; + + union lang_decl_u2 { + /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is + THUNK_VIRTUAL_OFFSET. + Otherwise this is DECL_ACCESS. */ + tree GTY ((tag ("0"))) access; + + /* For VAR_DECL in function, this is DECL_DISCRIMINATOR. */ + int GTY ((tag ("1"))) discriminator; + } GTY ((desc ("%0.u.base.u2sel"))) u2; +}; + +/* Additional DECL_LANG_SPECIFIC information for functions. */ + +struct GTY(()) lang_decl_fn { + struct lang_decl_min min; + + /* In an overloaded operator, this is the value of + DECL_OVERLOADED_OPERATOR_P. */ + ENUM_BITFIELD (tree_code) operator_code : 16; + + unsigned global_ctor_p : 1; + unsigned global_dtor_p : 1; + unsigned assignment_operator_p : 1; + unsigned static_function : 1; + unsigned pure_virtual : 1; + unsigned defaulted_p : 1; + + unsigned has_in_charge_parm_p : 1; + unsigned has_vtt_parm_p : 1; + unsigned pending_inline_p : 1; + unsigned nonconverting : 1; + unsigned thunk_p : 1; + unsigned this_thunk_p : 1; + unsigned hidden_friend_p : 1; + unsigned omp_declare_reduction_p : 1; + /* 2 spare bits on 32-bit hosts, 34 on 64-bit hosts. */ + + /* For a non-thunk function decl, this is a tree list of + friendly classes. For a thunk function decl, it is the + thunked to function decl. */ + tree befriending_classes; + + /* For a non-virtual FUNCTION_DECL, this is + DECL_FRIEND_CONTEXT. For a virtual FUNCTION_DECL for which + DECL_THIS_THUNK_P does not hold, this is DECL_THUNKS. Both + this pointer and result pointer adjusting thunks are + chained here. This pointer thunks to return pointer thunks + will be chained on the return pointer thunk. */ + tree context; + + union lang_decl_u5 + { + /* In a non-thunk FUNCTION_DECL or TEMPLATE_DECL, this is + DECL_CLONED_FUNCTION. */ + tree GTY ((tag ("0"))) cloned_function; + + /* In a FUNCTION_DECL for which THUNK_P holds this is the + THUNK_FIXED_OFFSET. */ + HOST_WIDE_INT GTY ((tag ("1"))) fixed_offset; + } GTY ((desc ("%1.thunk_p"))) u5; + + union lang_decl_u3 + { + struct cp_token_cache * GTY ((tag ("1"))) pending_inline_info; + struct language_function * GTY ((tag ("0"))) + saved_language_function; + } GTY ((desc ("%1.pending_inline_p"))) u; + +}; + +/* DECL_LANG_SPECIFIC for namespaces. */ + +struct GTY(()) lang_decl_ns { + struct lang_decl_base base; + cp_binding_level *level; + tree ns_using; + tree ns_users; +}; + +/* DECL_LANG_SPECIFIC for parameters. */ + +struct GTY(()) lang_decl_parm { + struct lang_decl_base base; + int level; + int index; +}; + +/* DECL_LANG_SPECIFIC for all types. It would be nice to just make this a + union rather than a struct containing a union as its only field, but + tree.h declares it as a struct. */ + +struct GTY(()) lang_decl { + union GTY((desc ("%h.base.selector"))) lang_decl_u { + struct lang_decl_base GTY ((default)) base; + struct lang_decl_min GTY((tag ("0"))) min; + struct lang_decl_fn GTY ((tag ("1"))) fn; + struct lang_decl_ns GTY((tag ("2"))) ns; + struct lang_decl_parm GTY((tag ("3"))) parm; + } u; +}; + +/* Looks through a template (if present) to find what it declares. */ +#define STRIP_TEMPLATE(NODE) \ + (TREE_CODE (NODE) == TEMPLATE_DECL ? DECL_TEMPLATE_RESULT (NODE) : NODE) + +#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007) + +#define LANG_DECL_MIN_CHECK(NODE) __extension__ \ +({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE); \ + if (!LANG_DECL_HAS_MIN (NODE)) \ + lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \ + <->u.min; }) + +/* We want to be able to check DECL_CONSTRUCTOR_P and such on a function + template, not just on a FUNCTION_DECL. So when looking for things in + lang_decl_fn, look down through a TEMPLATE_DECL into its result. */ +#define LANG_DECL_FN_CHECK(NODE) __extension__ \ +({ struct lang_decl *lt = DECL_LANG_SPECIFIC (STRIP_TEMPLATE (NODE)); \ + if (!DECL_DECLARES_FUNCTION_P (NODE) || lt->u.base.selector != 1) \ + lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \ + <->u.fn; }) + +#define LANG_DECL_NS_CHECK(NODE) __extension__ \ +({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE); \ + if (TREE_CODE (NODE) != NAMESPACE_DECL || lt->u.base.selector != 2) \ + lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \ + <->u.ns; }) + +#define LANG_DECL_PARM_CHECK(NODE) __extension__ \ +({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE); \ + if (TREE_CODE (NODE) != PARM_DECL) \ + lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \ + <->u.parm; }) + +#define LANG_DECL_U2_CHECK(NODE, TF) __extension__ \ +({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE); \ + if (!LANG_DECL_HAS_MIN (NODE) || lt->u.base.u2sel != TF) \ + lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \ + <->u.min.u2; }) + +#else + +#define LANG_DECL_MIN_CHECK(NODE) \ + (&DECL_LANG_SPECIFIC (NODE)->u.min) + +#define LANG_DECL_FN_CHECK(NODE) \ + (&DECL_LANG_SPECIFIC (STRIP_TEMPLATE (NODE))->u.fn) + +#define LANG_DECL_NS_CHECK(NODE) \ + (&DECL_LANG_SPECIFIC (NODE)->u.ns) + +#define LANG_DECL_PARM_CHECK(NODE) \ + (&DECL_LANG_SPECIFIC (NODE)->u.parm) + +#define LANG_DECL_U2_CHECK(NODE, TF) \ + (&DECL_LANG_SPECIFIC (NODE)->u.min.u2) + +#endif /* ENABLE_TREE_CHECKING */ + +/* For a FUNCTION_DECL or a VAR_DECL, the language linkage for the + declaration. Some entities (like a member function in a local + class, or a local variable) do not have linkage at all, and this + macro should not be used in those cases. + + Implementation note: A FUNCTION_DECL without DECL_LANG_SPECIFIC was + created by language-independent code, and has C linkage. Most + VAR_DECLs have C++ linkage, and do not have DECL_LANG_SPECIFIC, but + we do create DECL_LANG_SPECIFIC for variables with non-C++ linkage. */ +#define DECL_LANGUAGE(NODE) \ + (DECL_LANG_SPECIFIC (NODE) \ + ? DECL_LANG_SPECIFIC (NODE)->u.base.language \ + : (TREE_CODE (NODE) == FUNCTION_DECL \ + ? lang_c : lang_cplusplus)) + +/* Set the language linkage for NODE to LANGUAGE. */ +#define SET_DECL_LANGUAGE(NODE, LANGUAGE) \ + (DECL_LANG_SPECIFIC (NODE)->u.base.language = (LANGUAGE)) + +/* For FUNCTION_DECLs and TEMPLATE_DECLs: nonzero means that this function + is a constructor. */ +#define DECL_CONSTRUCTOR_P(NODE) \ + DECL_CXX_CONSTRUCTOR_P (STRIP_TEMPLATE (NODE)) + +/* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a complete + object. */ +#define DECL_COMPLETE_CONSTRUCTOR_P(NODE) \ + (DECL_CONSTRUCTOR_P (NODE) \ + && DECL_NAME (NODE) == complete_ctor_identifier) + +/* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a base + object. */ +#define DECL_BASE_CONSTRUCTOR_P(NODE) \ + (DECL_CONSTRUCTOR_P (NODE) \ + && DECL_NAME (NODE) == base_ctor_identifier) + +/* Nonzero if NODE (a FUNCTION_DECL) is a constructor, but not either the + specialized in-charge constructor or the specialized not-in-charge + constructor. */ +#define DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P(NODE) \ + (DECL_DECLARES_FUNCTION_P (NODE) && DECL_CONSTRUCTOR_P (NODE) \ + && !DECL_CLONED_FUNCTION_P (NODE)) + +/* Nonzero if NODE (a FUNCTION_DECL) is a copy constructor. */ +#define DECL_COPY_CONSTRUCTOR_P(NODE) \ + (DECL_CONSTRUCTOR_P (NODE) && copy_fn_p (NODE) > 0) + +/* Nonzero if NODE (a FUNCTION_DECL) is a move constructor. */ +#define DECL_MOVE_CONSTRUCTOR_P(NODE) \ + (DECL_CONSTRUCTOR_P (NODE) && move_fn_p (NODE)) + +/* Nonzero if NODE (a FUNCTION_DECL or TEMPLATE_DECL) + is a destructor. */ +#define DECL_DESTRUCTOR_P(NODE) \ + DECL_CXX_DESTRUCTOR_P (STRIP_TEMPLATE (NODE)) + +/* Nonzero if NODE (a FUNCTION_DECL) is a destructor, but not the + specialized in-charge constructor, in-charge deleting constructor, + or the base destructor. */ +#define DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P(NODE) \ + (DECL_DECLARES_FUNCTION_P (NODE) && DECL_DESTRUCTOR_P (NODE) \ + && !DECL_CLONED_FUNCTION_P (NODE)) + +/* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete + object. */ +#define DECL_COMPLETE_DESTRUCTOR_P(NODE) \ + (DECL_DESTRUCTOR_P (NODE) \ + && DECL_NAME (NODE) == complete_dtor_identifier) + +/* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a base + object. */ +#define DECL_BASE_DESTRUCTOR_P(NODE) \ + (DECL_DESTRUCTOR_P (NODE) \ + && DECL_NAME (NODE) == base_dtor_identifier) + +/* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete + object that deletes the object after it has been destroyed. */ +#define DECL_DELETING_DESTRUCTOR_P(NODE) \ + (DECL_DESTRUCTOR_P (NODE) \ + && DECL_NAME (NODE) == deleting_dtor_identifier) + +/* Nonzero if NODE (a FUNCTION_DECL) is a cloned constructor or + destructor. */ +#define DECL_CLONED_FUNCTION_P(NODE) (!!decl_cloned_function_p (NODE, true)) + +/* If DECL_CLONED_FUNCTION_P holds, this is the function that was + cloned. */ +#define DECL_CLONED_FUNCTION(NODE) (*decl_cloned_function_p (NODE, false)) + +/* Perform an action for each clone of FN, if FN is a function with + clones. This macro should be used like: + + FOR_EACH_CLONE (clone, fn) + { ... } + + */ +#define FOR_EACH_CLONE(CLONE, FN) \ + if (!(TREE_CODE (FN) == FUNCTION_DECL \ + && (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (FN) \ + || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (FN))))\ + ; \ + else \ + for (CLONE = DECL_CHAIN (FN); \ + CLONE && DECL_CLONED_FUNCTION_P (CLONE); \ + CLONE = DECL_CHAIN (CLONE)) + +/* Nonzero if NODE has DECL_DISCRIMINATOR and not DECL_ACCESS. */ +#define DECL_DISCRIMINATOR_P(NODE) \ + (VAR_P (NODE) && DECL_FUNCTION_SCOPE_P (NODE)) + +/* Discriminator for name mangling. */ +#define DECL_DISCRIMINATOR(NODE) (LANG_DECL_U2_CHECK (NODE, 1)->discriminator) + +/* True iff DECL_DISCRIMINATOR is set for a DECL_DISCRIMINATOR_P decl. */ +#define DECL_DISCRIMINATOR_SET_P(NODE) \ + (DECL_LANG_SPECIFIC (NODE) && DECL_LANG_SPECIFIC (NODE)->u.base.u2sel == 1) + +/* The index of a user-declared parameter in its function, starting at 1. + All artificial parameters will have index 0. */ +#define DECL_PARM_INDEX(NODE) \ + (LANG_DECL_PARM_CHECK (NODE)->index) + +/* The level of a user-declared parameter in its function, starting at 1. + A parameter of the function will have level 1; a parameter of the first + nested function declarator (i.e. t in void f (void (*p)(T t))) will have + level 2. */ +#define DECL_PARM_LEVEL(NODE) \ + (LANG_DECL_PARM_CHECK (NODE)->level) + +/* Nonzero if the VTT parm has been added to NODE. */ +#define DECL_HAS_VTT_PARM_P(NODE) \ + (LANG_DECL_FN_CHECK (NODE)->has_vtt_parm_p) + +/* Nonzero if NODE is a FUNCTION_DECL for which a VTT parameter is + required. */ +#define DECL_NEEDS_VTT_PARM_P(NODE) \ + (CLASSTYPE_VBASECLASSES (DECL_CONTEXT (NODE)) \ + && (DECL_BASE_CONSTRUCTOR_P (NODE) \ + || DECL_BASE_DESTRUCTOR_P (NODE))) + +/* Nonzero if NODE is a user-defined conversion operator. */ +#define DECL_CONV_FN_P(NODE) \ + (DECL_NAME (NODE) && IDENTIFIER_TYPENAME_P (DECL_NAME (NODE))) + +/* If FN is a conversion operator, the type to which it converts. + Otherwise, NULL_TREE. */ +#define DECL_CONV_FN_TYPE(FN) \ + (DECL_CONV_FN_P (FN) ? TREE_TYPE (DECL_NAME (FN)) : NULL_TREE) + +/* Nonzero if NODE, which is a TEMPLATE_DECL, is a template + conversion operator to a type dependent on the innermost template + args. */ +#define DECL_TEMPLATE_CONV_FN_P(NODE) \ + (DECL_LANG_SPECIFIC (TEMPLATE_DECL_CHECK (NODE))->u.base.template_conv_p) + +/* Nonzero if NODE, a static data member, was declared in its class as an + array of unknown bound. */ +#define VAR_HAD_UNKNOWN_BOUND(NODE) \ + (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE)) \ + ? DECL_LANG_SPECIFIC (NODE)->u.base.template_conv_p \ + : false) +#define SET_VAR_HAD_UNKNOWN_BOUND(NODE) \ + (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE))->u.base.template_conv_p = true) + +/* Set the overloaded operator code for NODE to CODE. */ +#define SET_OVERLOADED_OPERATOR_CODE(NODE, CODE) \ + (LANG_DECL_FN_CHECK (NODE)->operator_code = (CODE)) + +/* If NODE is an overloaded operator, then this returns the TREE_CODE + associated with the overloaded operator. + DECL_ASSIGNMENT_OPERATOR_P must also be checked to determine + whether or not NODE is an assignment operator. If NODE is not an + overloaded operator, ERROR_MARK is returned. Since the numerical + value of ERROR_MARK is zero, this macro can be used as a predicate + to test whether or not NODE is an overloaded operator. */ +#define DECL_OVERLOADED_OPERATOR_P(NODE) \ + (IDENTIFIER_OPNAME_P (DECL_NAME (NODE)) \ + ? LANG_DECL_FN_CHECK (NODE)->operator_code : ERROR_MARK) + +/* Nonzero if NODE is an assignment operator (including += and such). */ +#define DECL_ASSIGNMENT_OPERATOR_P(NODE) \ + (LANG_DECL_FN_CHECK (NODE)->assignment_operator_p) + +/* For FUNCTION_DECLs: nonzero means that this function is a + constructor or a destructor with an extra in-charge parameter to + control whether or not virtual bases are constructed. */ +#define DECL_HAS_IN_CHARGE_PARM_P(NODE) \ + (LANG_DECL_FN_CHECK (NODE)->has_in_charge_parm_p) + +/* Nonzero if DECL is a declaration of __builtin_constant_p. */ +#define DECL_IS_BUILTIN_CONSTANT_P(NODE) \ + (TREE_CODE (NODE) == FUNCTION_DECL \ + && DECL_BUILT_IN_CLASS (NODE) == BUILT_IN_NORMAL \ + && DECL_FUNCTION_CODE (NODE) == BUILT_IN_CONSTANT_P) + +/* Nonzero for _DECL means that this decl appears in (or will appear + in) as a member in a RECORD_TYPE or UNION_TYPE node. It is also for + detecting circularity in case members are multiply defined. In the + case of a VAR_DECL, it is also used to determine how program storage + should be allocated. */ +#define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3 (NODE)) + +/* Nonzero for a VAR_DECL means that the variable's initialization (if + any) has been processed. (In general, DECL_INITIALIZED_P is + !DECL_EXTERNAL, but static data members may be initialized even if + not defined.) */ +#define DECL_INITIALIZED_P(NODE) \ + (TREE_LANG_FLAG_1 (VAR_DECL_CHECK (NODE))) + +/* Nonzero for a VAR_DECL iff an explicit initializer was provided + or a non-trivial constructor is called. */ +#define DECL_NONTRIVIALLY_INITIALIZED_P(NODE) \ + (TREE_LANG_FLAG_3 (VAR_DECL_CHECK (NODE))) + +/* Nonzero for a VAR_DECL that was initialized with a + constant-expression. */ +#define DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P(NODE) \ + (TREE_LANG_FLAG_2 (VAR_DECL_CHECK (NODE))) + +/* Nonzero if the DECL was initialized in the class definition itself, + rather than outside the class. This is used for both static member + VAR_DECLS, and FUNCTION_DECLS that are defined in the class. */ +#define DECL_INITIALIZED_IN_CLASS_P(DECL) \ + (DECL_LANG_SPECIFIC (VAR_OR_FUNCTION_DECL_CHECK (DECL)) \ + ->u.base.initialized_in_class) + +/* Nonzero if the DECL is used in the sense of 3.2 [basic.def.odr]. + Only available for decls with DECL_LANG_SPECIFIC. */ +#define DECL_ODR_USED(DECL) \ + (DECL_LANG_SPECIFIC (VAR_OR_FUNCTION_DECL_CHECK (DECL)) \ + ->u.base.odr_used) + +/* Nonzero for DECL means that this decl is just a friend declaration, + and should not be added to the list of members for this class. */ +#define DECL_FRIEND_P(NODE) \ + (DECL_LANG_SPECIFIC (TYPE_FUNCTION_OR_TEMPLATE_DECL_CHECK (NODE)) \ + ->u.base.friend_or_tls) + +/* Nonzero if the thread-local variable was declared with __thread as + opposed to thread_local. */ +#define DECL_GNU_TLS_P(NODE) \ + (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE)) \ + && DECL_LANG_SPECIFIC (NODE)->u.base.friend_or_tls) +#define SET_DECL_GNU_TLS_P(NODE) \ + (retrofit_lang_decl (VAR_DECL_CHECK (NODE)), \ + DECL_LANG_SPECIFIC (NODE)->u.base.friend_or_tls = true) + +/* A TREE_LIST of the types which have befriended this FUNCTION_DECL. */ +#define DECL_BEFRIENDING_CLASSES(NODE) \ + (LANG_DECL_FN_CHECK (NODE)->befriending_classes) + +/* Nonzero for FUNCTION_DECL means that this decl is a static + member function. */ +#define DECL_STATIC_FUNCTION_P(NODE) \ + (LANG_DECL_FN_CHECK (NODE)->static_function) + +/* Nonzero for FUNCTION_DECL means that this decl is a non-static + member function. */ +#define DECL_NONSTATIC_MEMBER_FUNCTION_P(NODE) \ + (TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE) + +/* Nonzero for FUNCTION_DECL means that this decl is a member function + (static or non-static). */ +#define DECL_FUNCTION_MEMBER_P(NODE) \ + (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) || DECL_STATIC_FUNCTION_P (NODE)) + +/* Nonzero for FUNCTION_DECL means that this member function + has `this' as const X *const. */ +#define DECL_CONST_MEMFUNC_P(NODE) \ + (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \ + && CP_TYPE_CONST_P (TREE_TYPE (TREE_VALUE \ + (TYPE_ARG_TYPES (TREE_TYPE (NODE)))))) + +/* Nonzero for FUNCTION_DECL means that this member function + has `this' as volatile X *const. */ +#define DECL_VOLATILE_MEMFUNC_P(NODE) \ + (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \ + && CP_TYPE_VOLATILE_P (TREE_TYPE (TREE_VALUE \ + (TYPE_ARG_TYPES (TREE_TYPE (NODE)))))) + +/* Nonzero for a DECL means that this member is a non-static member. */ +#define DECL_NONSTATIC_MEMBER_P(NODE) \ + (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \ + || TREE_CODE (NODE) == FIELD_DECL) + +/* Nonzero for _DECL means that this member object type + is mutable. */ +#define DECL_MUTABLE_P(NODE) (DECL_LANG_FLAG_0 (NODE)) + +/* Nonzero for _DECL means that this constructor or conversion function is + non-converting. */ +#define DECL_NONCONVERTING_P(NODE) \ + (LANG_DECL_FN_CHECK (NODE)->nonconverting) + +/* Nonzero for FUNCTION_DECL means that this member function is a pure + virtual function. */ +#define DECL_PURE_VIRTUAL_P(NODE) \ + (LANG_DECL_FN_CHECK (NODE)->pure_virtual) + +/* True (in a FUNCTION_DECL) if NODE is a virtual function that is an + invalid overrider for a function from a base class. Once we have + complained about an invalid overrider we avoid complaining about it + again. */ +#define DECL_INVALID_OVERRIDER_P(NODE) \ + (DECL_LANG_FLAG_4 (NODE)) + +/* True (in a FUNCTION_DECL) if NODE is a function declared with + an override virt-specifier */ +#define DECL_OVERRIDE_P(NODE) (TREE_LANG_FLAG_0 (NODE)) + +/* The thunks associated with NODE, a FUNCTION_DECL. */ +#define DECL_THUNKS(NODE) \ + (DECL_VIRTUAL_P (NODE) ? LANG_DECL_FN_CHECK (NODE)->context : NULL_TREE) + +/* Set DECL_THUNKS. */ +#define SET_DECL_THUNKS(NODE,THUNKS) \ + (LANG_DECL_FN_CHECK (NODE)->context = (THUNKS)) + +/* If NODE, a FUNCTION_DECL, is a C++11 inheriting constructor, then this + is the constructor it inherits from. */ +#define DECL_INHERITED_CTOR(NODE) \ + (DECL_DECLARES_FUNCTION_P (NODE) && DECL_CONSTRUCTOR_P (NODE) \ + ? LANG_DECL_FN_CHECK (NODE)->context : NULL_TREE) + +/* And this is the base that constructor comes from. */ +#define DECL_INHERITED_CTOR_BASE(NODE) \ + (DECL_INHERITED_CTOR (NODE) \ + ? DECL_CONTEXT (flag_new_inheriting_ctors \ + ? strip_inheriting_ctors (NODE) \ + : DECL_INHERITED_CTOR (NODE)) \ + : NULL_TREE) + +/* Set the inherited base. */ +#define SET_DECL_INHERITED_CTOR(NODE,INH) \ + (LANG_DECL_FN_CHECK (NODE)->context = (INH)) + +/* Nonzero if NODE is a thunk, rather than an ordinary function. */ +#define DECL_THUNK_P(NODE) \ + (TREE_CODE (NODE) == FUNCTION_DECL \ + && DECL_LANG_SPECIFIC (NODE) \ + && LANG_DECL_FN_CHECK (NODE)->thunk_p) + +/* Set DECL_THUNK_P for node. */ +#define SET_DECL_THUNK_P(NODE, THIS_ADJUSTING) \ + (LANG_DECL_FN_CHECK (NODE)->thunk_p = 1, \ + LANG_DECL_FN_CHECK (NODE)->this_thunk_p = (THIS_ADJUSTING)) + +/* Nonzero if NODE is a this pointer adjusting thunk. */ +#define DECL_THIS_THUNK_P(NODE) \ + (DECL_THUNK_P (NODE) && LANG_DECL_FN_CHECK (NODE)->this_thunk_p) + +/* Nonzero if NODE is a result pointer adjusting thunk. */ +#define DECL_RESULT_THUNK_P(NODE) \ + (DECL_THUNK_P (NODE) && !LANG_DECL_FN_CHECK (NODE)->this_thunk_p) + +/* Nonzero if NODE is a FUNCTION_DECL, but not a thunk. */ +#define DECL_NON_THUNK_FUNCTION_P(NODE) \ + (TREE_CODE (NODE) == FUNCTION_DECL && !DECL_THUNK_P (NODE)) + +/* Nonzero if NODE is `extern "C"'. */ +#define DECL_EXTERN_C_P(NODE) \ + (DECL_LANGUAGE (NODE) == lang_c) + +/* Nonzero if NODE is an `extern "C"' function. */ +#define DECL_EXTERN_C_FUNCTION_P(NODE) \ + (DECL_NON_THUNK_FUNCTION_P (NODE) && DECL_EXTERN_C_P (NODE)) + +/* True iff DECL is an entity with vague linkage whose definition is + available in this translation unit. */ +#define DECL_REPO_AVAILABLE_P(NODE) \ + (DECL_LANG_SPECIFIC (NODE)->u.base.repo_available_p) + +/* True if DECL is declared 'constexpr'. */ +#define DECL_DECLARED_CONSTEXPR_P(DECL) \ + DECL_LANG_FLAG_8 (VAR_OR_FUNCTION_DECL_CHECK (STRIP_TEMPLATE (DECL))) + +// True if NODE was declared as 'concept'. The flag implies that the +// declaration is constexpr, that the declaration cannot be specialized or +// refined, and that the result type must be convertible to bool. +#define DECL_DECLARED_CONCEPT_P(NODE) \ + (DECL_LANG_SPECIFIC (NODE)->u.base.concept_p) + +/* Nonzero if this DECL is the __PRETTY_FUNCTION__ variable in a + template function. */ +#define DECL_PRETTY_FUNCTION_P(NODE) \ + (DECL_NAME (NODE) \ + && !strcmp (IDENTIFIER_POINTER (DECL_NAME (NODE)), "__PRETTY_FUNCTION__")) + +/* Nonzero if the variable was declared to be thread-local. + We need a special C++ version of this test because the middle-end + DECL_THREAD_LOCAL_P uses the symtab, so we can't use it for + templates. */ +#define CP_DECL_THREAD_LOCAL_P(NODE) \ + (TREE_LANG_FLAG_0 (VAR_DECL_CHECK (NODE))) + +/* The _TYPE context in which this _DECL appears. This field holds the + class where a virtual function instance is actually defined. */ +#define DECL_CLASS_CONTEXT(NODE) \ + (DECL_CLASS_SCOPE_P (NODE) ? DECL_CONTEXT (NODE) : NULL_TREE) + +/* For a non-member friend function, the class (if any) in which this + friend was defined. For example, given: + + struct S { friend void f (); }; + + the DECL_FRIEND_CONTEXT for `f' will be `S'. */ +#define DECL_FRIEND_CONTEXT(NODE) \ + ((DECL_DECLARES_FUNCTION_P (NODE) \ + && DECL_FRIEND_P (NODE) && !DECL_FUNCTION_MEMBER_P (NODE)) \ + ? LANG_DECL_FN_CHECK (NODE)->context \ + : NULL_TREE) + +/* Set the DECL_FRIEND_CONTEXT for NODE to CONTEXT. */ +#define SET_DECL_FRIEND_CONTEXT(NODE, CONTEXT) \ + (LANG_DECL_FN_CHECK (NODE)->context = (CONTEXT)) + +#define CP_DECL_CONTEXT(NODE) \ + (!DECL_FILE_SCOPE_P (NODE) ? DECL_CONTEXT (NODE) : global_namespace) +#define CP_TYPE_CONTEXT(NODE) \ + (!TYPE_FILE_SCOPE_P (NODE) ? TYPE_CONTEXT (NODE) : global_namespace) +#define FROB_CONTEXT(NODE) \ + ((NODE) == global_namespace ? DECL_CONTEXT (NODE) : (NODE)) + +/* 1 iff NODE has namespace scope, including the global namespace. */ +#define DECL_NAMESPACE_SCOPE_P(NODE) \ + (!DECL_TEMPLATE_PARM_P (NODE) \ + && TREE_CODE (CP_DECL_CONTEXT (NODE)) == NAMESPACE_DECL) + +#define TYPE_NAMESPACE_SCOPE_P(NODE) \ + (TREE_CODE (CP_TYPE_CONTEXT (NODE)) == NAMESPACE_DECL) + +#define NAMESPACE_SCOPE_P(NODE) \ + ((DECL_P (NODE) && DECL_NAMESPACE_SCOPE_P (NODE)) \ + || (TYPE_P (NODE) && TYPE_NAMESPACE_SCOPE_P (NODE))) + +/* 1 iff NODE is a class member. */ +#define DECL_CLASS_SCOPE_P(NODE) \ + (DECL_CONTEXT (NODE) && TYPE_P (DECL_CONTEXT (NODE))) + +#define TYPE_CLASS_SCOPE_P(NODE) \ + (TYPE_CONTEXT (NODE) && TYPE_P (TYPE_CONTEXT (NODE))) + +/* 1 iff NODE is function-local. */ +#define DECL_FUNCTION_SCOPE_P(NODE) \ + (DECL_CONTEXT (NODE) \ + && TREE_CODE (DECL_CONTEXT (NODE)) == FUNCTION_DECL) + +#define TYPE_FUNCTION_SCOPE_P(NODE) \ + (TYPE_CONTEXT (NODE) && TREE_CODE (TYPE_CONTEXT (NODE)) == FUNCTION_DECL) + +/* 1 iff VAR_DECL node NODE is a type-info decl. This flag is set for + both the primary typeinfo object and the associated NTBS name. */ +#define DECL_TINFO_P(NODE) TREE_LANG_FLAG_4 (VAR_DECL_CHECK (NODE)) + +/* 1 iff VAR_DECL node NODE is virtual table or VTT. */ +#define DECL_VTABLE_OR_VTT_P(NODE) TREE_LANG_FLAG_5 (VAR_DECL_CHECK (NODE)) + +/* 1 iff FUNCTION_TYPE or METHOD_TYPE has a ref-qualifier (either & or &&). */ +#define FUNCTION_REF_QUALIFIED(NODE) \ + TREE_LANG_FLAG_4 (FUNC_OR_METHOD_CHECK (NODE)) + +/* 1 iff FUNCTION_TYPE or METHOD_TYPE has &&-ref-qualifier. */ +#define FUNCTION_RVALUE_QUALIFIED(NODE) \ + TREE_LANG_FLAG_5 (FUNC_OR_METHOD_CHECK (NODE)) + +/* Returns 1 iff VAR_DECL is a construction virtual table. + DECL_VTABLE_OR_VTT_P will be true in this case and must be checked + before using this macro. */ +#define DECL_CONSTRUCTION_VTABLE_P(NODE) \ + TREE_LANG_FLAG_6 (VAR_DECL_CHECK (NODE)) + +/* 1 iff NODE is function-local, but for types. */ +#define LOCAL_CLASS_P(NODE) \ + (decl_function_context (TYPE_MAIN_DECL (NODE)) != NULL_TREE) + +/* For a NAMESPACE_DECL: the list of using namespace directives + The PURPOSE is the used namespace, the value is the namespace + that is the common ancestor. */ +#define DECL_NAMESPACE_USING(NODE) (LANG_DECL_NS_CHECK (NODE)->ns_using) + +/* In a NAMESPACE_DECL, the DECL_INITIAL is used to record all users + of a namespace, to record the transitive closure of using namespace. */ +#define DECL_NAMESPACE_USERS(NODE) (LANG_DECL_NS_CHECK (NODE)->ns_users) + +/* In a NAMESPACE_DECL, the list of namespaces which have associated + themselves with this one. */ +#define DECL_NAMESPACE_ASSOCIATIONS(NODE) \ + DECL_INITIAL (NAMESPACE_DECL_CHECK (NODE)) + +/* In a NAMESPACE_DECL, points to the original namespace if this is + a namespace alias. */ +#define DECL_NAMESPACE_ALIAS(NODE) \ + DECL_ABSTRACT_ORIGIN (NAMESPACE_DECL_CHECK (NODE)) +#define ORIGINAL_NAMESPACE(NODE) \ + (DECL_NAMESPACE_ALIAS (NODE) ? DECL_NAMESPACE_ALIAS (NODE) : (NODE)) + +/* Nonzero if NODE is the std namespace. */ +#define DECL_NAMESPACE_STD_P(NODE) \ + (TREE_CODE (NODE) == NAMESPACE_DECL \ + && CP_DECL_CONTEXT (NODE) == global_namespace \ + && DECL_NAME (NODE) == std_identifier) + +/* In a TREE_LIST concatenating using directives, indicate indirect + directives */ +#define TREE_INDIRECT_USING(NODE) TREE_LANG_FLAG_0 (TREE_LIST_CHECK (NODE)) + +/* In a TREE_LIST in an attribute list, indicates that the attribute + must be applied at instantiation time. */ +#define ATTR_IS_DEPENDENT(NODE) TREE_LANG_FLAG_0 (TREE_LIST_CHECK (NODE)) + +/* In a TREE_LIST in the argument of attribute abi_tag, indicates that the tag + was inherited from a template parameter, not explicitly indicated. */ +#define ABI_TAG_IMPLICIT(NODE) TREE_LANG_FLAG_0 (TREE_LIST_CHECK (NODE)) + +extern tree decl_shadowed_for_var_lookup (tree); +extern void decl_shadowed_for_var_insert (tree, tree); + +/* Non zero if this is a using decl for a dependent scope. */ +#define DECL_DEPENDENT_P(NODE) DECL_LANG_FLAG_0 (USING_DECL_CHECK (NODE)) + +/* The scope named in a using decl. */ +#define USING_DECL_SCOPE(NODE) TREE_TYPE (USING_DECL_CHECK (NODE)) + +/* The decls named by a using decl. */ +#define USING_DECL_DECLS(NODE) DECL_INITIAL (USING_DECL_CHECK (NODE)) + +/* Non zero if the using decl refers to a dependent type. */ +#define USING_DECL_TYPENAME_P(NODE) DECL_LANG_FLAG_1 (USING_DECL_CHECK (NODE)) + +/* In a VAR_DECL, true if we have a shadowed local variable + in the shadowed var table for this VAR_DECL. */ +#define DECL_HAS_SHADOWED_FOR_VAR_P(NODE) \ + (VAR_DECL_CHECK (NODE)->decl_with_vis.shadowed_for_var_p) + +/* In a VAR_DECL for a variable declared in a for statement, + this is the shadowed (local) variable. */ +#define DECL_SHADOWED_FOR_VAR(NODE) \ + (DECL_HAS_SHADOWED_FOR_VAR_P(NODE) ? decl_shadowed_for_var_lookup (NODE) : NULL) + +#define SET_DECL_SHADOWED_FOR_VAR(NODE, VAL) \ + (decl_shadowed_for_var_insert (NODE, VAL)) + +/* In a FUNCTION_DECL, this is nonzero if this function was defined in + the class definition. We have saved away the text of the function, + but have not yet processed it. */ +#define DECL_PENDING_INLINE_P(NODE) \ + (LANG_DECL_FN_CHECK (NODE)->pending_inline_p) + +/* If DECL_PENDING_INLINE_P holds, this is the saved text of the + function. */ +#define DECL_PENDING_INLINE_INFO(NODE) \ + (LANG_DECL_FN_CHECK (NODE)->u.pending_inline_info) + +/* Nonzero for TYPE_DECL means that it was written 'using name = type'. */ +#define TYPE_DECL_ALIAS_P(NODE) \ + DECL_LANG_FLAG_6 (TYPE_DECL_CHECK (NODE)) + +/* Nonzero for TEMPLATE_DECL means that it is a 'complex' alias template. */ +#define TEMPLATE_DECL_COMPLEX_ALIAS_P(NODE) \ + DECL_LANG_FLAG_2 (TEMPLATE_DECL_CHECK (NODE)) + +/* Nonzero for a type which is an alias for another type; i.e, a type + which declaration was written 'using name-of-type = + another-type'. */ +#define TYPE_ALIAS_P(NODE) \ + (TYPE_P (NODE) \ + && TYPE_NAME (NODE) \ + && TREE_CODE (TYPE_NAME (NODE)) == TYPE_DECL \ + && TYPE_DECL_ALIAS_P (TYPE_NAME (NODE))) + +/* For a class type: if this structure has many fields, we'll sort them + and put them into a TREE_VEC. */ +#define CLASSTYPE_SORTED_FIELDS(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->sorted_fields) + +/* If non-NULL for a VAR_DECL, FUNCTION_DECL, TYPE_DECL or + TEMPLATE_DECL, the entity is either a template specialization (if + DECL_USE_TEMPLATE is nonzero) or the abstract instance of the + template itself. + + In either case, DECL_TEMPLATE_INFO is a TREE_LIST, whose + TREE_PURPOSE is the TEMPLATE_DECL of which this entity is a + specialization or abstract instance. The TREE_VALUE is the + template arguments used to specialize the template. + + Consider: + + template struct S { friend void f(T) {} }; + + In this case, S::f is, from the point of view of the compiler, + an instantiation of a template -- but, from the point of view of + the language, each instantiation of S results in a wholly unrelated + global function f. In this case, DECL_TEMPLATE_INFO for S::f + will be non-NULL, but DECL_USE_TEMPLATE will be zero. */ +#define DECL_TEMPLATE_INFO(NODE) \ + (DECL_LANG_SPECIFIC (VAR_TEMPL_TYPE_FIELD_OR_FUNCTION_DECL_CHECK (NODE)) \ + ->u.min.template_info) + +/* For a VAR_DECL, indicates that the variable is actually a + non-static data member of anonymous union that has been promoted to + variable status. */ +#define DECL_ANON_UNION_VAR_P(NODE) \ + (DECL_LANG_FLAG_4 (VAR_DECL_CHECK (NODE))) + +/* Template information for a RECORD_TYPE or UNION_TYPE. */ +#define CLASSTYPE_TEMPLATE_INFO(NODE) \ + (LANG_TYPE_CLASS_CHECK (RECORD_OR_UNION_CHECK (NODE))->template_info) + +/* Template information for an ENUMERAL_TYPE. Although an enumeration may + not be a primary template, it may be declared within the scope of a + primary template and the enumeration constants may depend on + non-type template parameters. */ +#define ENUM_TEMPLATE_INFO(NODE) \ + (TYPE_LANG_SLOT_1 (ENUMERAL_TYPE_CHECK (NODE))) + +/* Template information for a template template parameter. */ +#define TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO(NODE) \ + (LANG_TYPE_CLASS_CHECK (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK (NODE)) \ + ->template_info) + +/* Template information for an ENUMERAL_, RECORD_, UNION_TYPE, or + BOUND_TEMPLATE_TEMPLATE_PARM type. This ignores any alias + templateness of NODE. */ +#define TYPE_TEMPLATE_INFO(NODE) \ + (TREE_CODE (NODE) == ENUMERAL_TYPE \ + ? ENUM_TEMPLATE_INFO (NODE) \ + : (TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM \ + ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE) \ + : (CLASS_TYPE_P (NODE) \ + ? CLASSTYPE_TEMPLATE_INFO (NODE) \ + : NULL_TREE))) + +/* Template information (if any) for an alias type. */ +#define TYPE_ALIAS_TEMPLATE_INFO(NODE) \ + (DECL_LANG_SPECIFIC (TYPE_NAME (NODE)) \ + ? DECL_TEMPLATE_INFO (TYPE_NAME (NODE)) \ + : NULL_TREE) + +/* If NODE is a type alias, this accessor returns the template info + for the alias template (if any). Otherwise behave as + TYPE_TEMPLATE_INFO. */ +#define TYPE_TEMPLATE_INFO_MAYBE_ALIAS(NODE) \ + (TYPE_ALIAS_P (NODE) \ + ? TYPE_ALIAS_TEMPLATE_INFO (NODE) \ + : TYPE_TEMPLATE_INFO (NODE)) + +/* Set the template information for an ENUMERAL_, RECORD_, or + UNION_TYPE to VAL. */ +#define SET_TYPE_TEMPLATE_INFO(NODE, VAL) \ + (TREE_CODE (NODE) == ENUMERAL_TYPE \ + ? (ENUM_TEMPLATE_INFO (NODE) = (VAL)) \ + : ((CLASS_TYPE_P (NODE) && !TYPE_ALIAS_P (NODE)) \ + ? (CLASSTYPE_TEMPLATE_INFO (NODE) = (VAL)) \ + : (DECL_TEMPLATE_INFO (TYPE_NAME (NODE)) = (VAL)))) + +#define TI_TEMPLATE(NODE) TREE_TYPE (TEMPLATE_INFO_CHECK (NODE)) +#define TI_ARGS(NODE) TREE_CHAIN (TEMPLATE_INFO_CHECK (NODE)) +#define TI_PENDING_TEMPLATE_FLAG(NODE) TREE_LANG_FLAG_1 (NODE) +/* For a given TREE_VEC containing a template argument list, + this property contains the number of arguments that are not + defaulted. */ +#define NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) TREE_CHAIN (TREE_VEC_CHECK (NODE)) +/* Below are the setter and getter of the NON_DEFAULT_TEMPLATE_ARGS_COUNT + property. */ +#define SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE, INT_VALUE) \ + NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) = build_int_cst (NULL_TREE, INT_VALUE) +#if CHECKING_P +#define GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) \ + int_cst_value (NON_DEFAULT_TEMPLATE_ARGS_COUNT (NODE)) +#else +#define GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) \ + NON_DEFAULT_TEMPLATE_ARGS_COUNT (NODE) \ + ? int_cst_value (NON_DEFAULT_TEMPLATE_ARGS_COUNT (NODE)) \ + : TREE_VEC_LENGTH (INNERMOST_TEMPLATE_ARGS (NODE)) +#endif +/* The list of typedefs - used in the template - that need + access checking at template instantiation time. + + FIXME this should be associated with the TEMPLATE_DECL, not the + TEMPLATE_INFO. */ +#define TI_TYPEDEFS_NEEDING_ACCESS_CHECKING(NODE) \ + ((struct tree_template_info*)TEMPLATE_INFO_CHECK \ + (NODE))->typedefs_needing_access_checking + +/* We use TREE_VECs to hold template arguments. If there is only one + level of template arguments, then the TREE_VEC contains the + arguments directly. If there is more than one level of template + arguments, then each entry in the TREE_VEC is itself a TREE_VEC, + containing the template arguments for a single level. The first + entry in the outer TREE_VEC is the outermost level of template + parameters; the last is the innermost. + + It is incorrect to ever form a template argument vector containing + only one level of arguments, but which is a TREE_VEC containing as + its only entry the TREE_VEC for that level. + + For each TREE_VEC containing the template arguments for a single + level, it's possible to get or set the number of non defaulted + template arguments by using the accessor macros + GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT or + SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT. */ + +/* Nonzero if the template arguments is actually a vector of vectors, + rather than just a vector. */ +#define TMPL_ARGS_HAVE_MULTIPLE_LEVELS(NODE) \ + (NODE && TREE_VEC_LENGTH (NODE) && TREE_VEC_ELT (NODE, 0) \ + && TREE_CODE (TREE_VEC_ELT (NODE, 0)) == TREE_VEC) + +/* The depth of a template argument vector. When called directly by + the parser, we use a TREE_LIST rather than a TREE_VEC to represent + template arguments. In fact, we may even see NULL_TREE if there + are no template arguments. In both of those cases, there is only + one level of template arguments. */ +#define TMPL_ARGS_DEPTH(NODE) \ + (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (NODE) ? TREE_VEC_LENGTH (NODE) : 1) + +/* The LEVELth level of the template ARGS. The outermost level of + args is level 1, not level 0. */ +#define TMPL_ARGS_LEVEL(ARGS, LEVEL) \ + (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (ARGS) \ + ? TREE_VEC_ELT (ARGS, (LEVEL) - 1) : (ARGS)) + +/* Set the LEVELth level of the template ARGS to VAL. This macro does + not work with single-level argument vectors. */ +#define SET_TMPL_ARGS_LEVEL(ARGS, LEVEL, VAL) \ + (TREE_VEC_ELT (ARGS, (LEVEL) - 1) = (VAL)) + +/* Accesses the IDXth parameter in the LEVELth level of the ARGS. */ +#define TMPL_ARG(ARGS, LEVEL, IDX) \ + (TREE_VEC_ELT (TMPL_ARGS_LEVEL (ARGS, LEVEL), IDX)) + +/* Given a single level of template arguments in NODE, return the + number of arguments. */ +#define NUM_TMPL_ARGS(NODE) \ + (TREE_VEC_LENGTH (NODE)) + +/* Returns the innermost level of template arguments in ARGS. */ +#define INNERMOST_TEMPLATE_ARGS(NODE) \ + (get_innermost_template_args ((NODE), 1)) + +/* The number of levels of template parameters given by NODE. */ +#define TMPL_PARMS_DEPTH(NODE) \ + ((HOST_WIDE_INT) TREE_INT_CST_LOW (TREE_PURPOSE (NODE))) + +/* The TEMPLATE_DECL instantiated or specialized by NODE. This + TEMPLATE_DECL will be the immediate parent, not the most general + template. For example, in: + + template struct S { template void f(U); } + + the FUNCTION_DECL for S::f will have, as its + DECL_TI_TEMPLATE, `template S::f'. + + As a special case, for a member friend template of a template + class, this value will not be a TEMPLATE_DECL, but rather an + IDENTIFIER_NODE or OVERLOAD indicating the name of the template and + any explicit template arguments provided. For example, in: + + template struct S { friend void f(int, double); } + + the DECL_TI_TEMPLATE will be an IDENTIFIER_NODE for `f' and the + DECL_TI_ARGS will be {int}. + + For a FIELD_DECL with a non-static data member initializer, this value + is the FIELD_DECL it was instantiated from. */ +#define DECL_TI_TEMPLATE(NODE) TI_TEMPLATE (DECL_TEMPLATE_INFO (NODE)) + +/* The template arguments used to obtain this decl from the most + general form of DECL_TI_TEMPLATE. For the example given for + DECL_TI_TEMPLATE, the DECL_TI_ARGS will be {int, double}. These + are always the full set of arguments required to instantiate this + declaration from the most general template specialized here. */ +#define DECL_TI_ARGS(NODE) TI_ARGS (DECL_TEMPLATE_INFO (NODE)) + +/* The TEMPLATE_DECL associated with NODE, a class type. Even if NODE + will be generated from a partial specialization, the TEMPLATE_DECL + referred to here will be the original template. For example, + given: + + template struct S {}; + template struct S {}; + + the CLASSTPYE_TI_TEMPLATE for S will be S, not the S. */ +#define CLASSTYPE_TI_TEMPLATE(NODE) TI_TEMPLATE (CLASSTYPE_TEMPLATE_INFO (NODE)) +#define CLASSTYPE_TI_ARGS(NODE) TI_ARGS (CLASSTYPE_TEMPLATE_INFO (NODE)) + +/* For a template instantiation TYPE, returns the TYPE corresponding + to the primary template. Otherwise returns TYPE itself. */ +#define CLASSTYPE_PRIMARY_TEMPLATE_TYPE(TYPE) \ + ((CLASSTYPE_USE_TEMPLATE ((TYPE)) \ + && !CLASSTYPE_TEMPLATE_SPECIALIZATION ((TYPE))) \ + ? TREE_TYPE (DECL_TEMPLATE_RESULT (DECL_PRIMARY_TEMPLATE \ + (CLASSTYPE_TI_TEMPLATE ((TYPE))))) \ + : (TYPE)) + +/* Like CLASS_TI_TEMPLATE, but also works for ENUMERAL_TYPEs. */ +#define TYPE_TI_TEMPLATE(NODE) \ + (TI_TEMPLATE (TYPE_TEMPLATE_INFO (NODE))) + +/* Like DECL_TI_ARGS, but for an ENUMERAL_, RECORD_, or UNION_TYPE. */ +#define TYPE_TI_ARGS(NODE) \ + (TI_ARGS (TYPE_TEMPLATE_INFO (NODE))) + +#define INNERMOST_TEMPLATE_PARMS(NODE) TREE_VALUE (NODE) + +/* Nonzero if NODE (a TEMPLATE_DECL) is a member template, in the + sense of [temp.mem]. */ +#define DECL_MEMBER_TEMPLATE_P(NODE) \ + (DECL_LANG_FLAG_1 (TEMPLATE_DECL_CHECK (NODE))) + +/* Nonzero if the NODE corresponds to the template parameters for a + member template, whose inline definition is being processed after + the class definition is complete. */ +#define TEMPLATE_PARMS_FOR_INLINE(NODE) TREE_LANG_FLAG_1 (NODE) + +/* Determine if a declaration (PARM_DECL or FIELD_DECL) is a pack. */ +#define DECL_PACK_P(NODE) \ + (DECL_P (NODE) && PACK_EXPANSION_P (TREE_TYPE (NODE))) + +/* Determines if NODE is an expansion of one or more parameter packs, + e.g., a TYPE_PACK_EXPANSION or EXPR_PACK_EXPANSION. */ +#define PACK_EXPANSION_P(NODE) \ + (TREE_CODE (NODE) == TYPE_PACK_EXPANSION \ + || TREE_CODE (NODE) == EXPR_PACK_EXPANSION) + +/* Extracts the type or expression pattern from a TYPE_PACK_EXPANSION or + EXPR_PACK_EXPANSION. */ +#define PACK_EXPANSION_PATTERN(NODE) \ + (TREE_CODE (NODE) == TYPE_PACK_EXPANSION? TREE_TYPE (NODE) \ + : TREE_OPERAND (NODE, 0)) + +/* Sets the type or expression pattern for a TYPE_PACK_EXPANSION or + EXPR_PACK_EXPANSION. */ +#define SET_PACK_EXPANSION_PATTERN(NODE,VALUE) \ + if (TREE_CODE (NODE) == TYPE_PACK_EXPANSION) \ + TREE_TYPE (NODE) = VALUE; \ + else \ + TREE_OPERAND (NODE, 0) = VALUE + +/* The list of parameter packs used in the PACK_EXPANSION_* node. The + TREE_VALUE of each TREE_LIST contains the parameter packs. */ +#define PACK_EXPANSION_PARAMETER_PACKS(NODE) \ + *(TREE_CODE (NODE) == EXPR_PACK_EXPANSION \ + ? &TREE_OPERAND (NODE, 1) \ + : &TYPE_MINVAL (TYPE_PACK_EXPANSION_CHECK (NODE))) + +/* Any additional template args to be applied when substituting into + the pattern, set by tsubst_pack_expansion for partial instantiations. */ +#define PACK_EXPANSION_EXTRA_ARGS(NODE) \ + *(TREE_CODE (NODE) == TYPE_PACK_EXPANSION \ + ? &TYPE_MAXVAL (NODE) \ + : &TREE_OPERAND ((NODE), 2)) + +/* True iff this pack expansion is within a function context. */ +#define PACK_EXPANSION_LOCAL_P(NODE) TREE_LANG_FLAG_0 (NODE) + +/* True iff this pack expansion is for sizeof.... */ +#define PACK_EXPANSION_SIZEOF_P(NODE) TREE_LANG_FLAG_1 (NODE) + +/* True iff the wildcard can match a template parameter pack. */ +#define WILDCARD_PACK_P(NODE) TREE_LANG_FLAG_0 (NODE) + +/* Determine if this is an argument pack. */ +#define ARGUMENT_PACK_P(NODE) \ + (TREE_CODE (NODE) == TYPE_ARGUMENT_PACK \ + || TREE_CODE (NODE) == NONTYPE_ARGUMENT_PACK) + +/* The arguments stored in an argument pack. Arguments are stored in a + TREE_VEC, which may have length zero. */ +#define ARGUMENT_PACK_ARGS(NODE) \ + (TREE_CODE (NODE) == TYPE_ARGUMENT_PACK? TREE_TYPE (NODE) \ + : TREE_OPERAND (NODE, 0)) + +/* Set the arguments stored in an argument pack. VALUE must be a + TREE_VEC. */ +#define SET_ARGUMENT_PACK_ARGS(NODE,VALUE) \ + if (TREE_CODE (NODE) == TYPE_ARGUMENT_PACK) \ + TREE_TYPE (NODE) = VALUE; \ + else \ + TREE_OPERAND (NODE, 0) = VALUE + +/* Whether the argument pack is "incomplete", meaning that more + arguments can still be deduced. Incomplete argument packs are only + used when the user has provided an explicit template argument list + for a variadic function template. Some of the explicit template + arguments will be placed into the beginning of the argument pack, + but additional arguments might still be deduced. */ +#define ARGUMENT_PACK_INCOMPLETE_P(NODE) \ + TREE_ADDRESSABLE (ARGUMENT_PACK_ARGS (NODE)) + +/* When ARGUMENT_PACK_INCOMPLETE_P, stores the explicit template + arguments used to fill this pack. */ +#define ARGUMENT_PACK_EXPLICIT_ARGS(NODE) \ + TREE_TYPE (ARGUMENT_PACK_ARGS (NODE)) + +/* In an ARGUMENT_PACK_SELECT, the argument pack from which an + argument will be selected. */ +#define ARGUMENT_PACK_SELECT_FROM_PACK(NODE) \ + (((struct tree_argument_pack_select *)ARGUMENT_PACK_SELECT_CHECK (NODE))->argument_pack) + +/* In an ARGUMENT_PACK_SELECT, the index of the argument we want to + select. */ +#define ARGUMENT_PACK_SELECT_INDEX(NODE) \ + (((struct tree_argument_pack_select *)ARGUMENT_PACK_SELECT_CHECK (NODE))->index) + +/* In an ARGUMENT_PACK_SELECT, the actual underlying argument that the + ARGUMENT_PACK_SELECT represents. */ +#define ARGUMENT_PACK_SELECT_ARG(NODE) \ + TREE_VEC_ELT (ARGUMENT_PACK_ARGS (ARGUMENT_PACK_SELECT_FROM_PACK (NODE)), \ + ARGUMENT_PACK_SELECT_INDEX (NODE)) + +#define FOLD_EXPR_CHECK(NODE) \ + TREE_CHECK4 (NODE, UNARY_LEFT_FOLD_EXPR, UNARY_RIGHT_FOLD_EXPR, \ + BINARY_LEFT_FOLD_EXPR, BINARY_RIGHT_FOLD_EXPR) + +#define BINARY_FOLD_EXPR_CHECK(NODE) \ + TREE_CHECK2 (NODE, BINARY_LEFT_FOLD_EXPR, BINARY_RIGHT_FOLD_EXPR) + +/* True if NODE is UNARY_FOLD_EXPR or a BINARY_FOLD_EXPR */ +#define FOLD_EXPR_P(NODE) \ + (TREE_CODE (NODE) == UNARY_LEFT_FOLD_EXPR \ + || TREE_CODE (NODE) == UNARY_RIGHT_FOLD_EXPR \ + || TREE_CODE (NODE) == BINARY_LEFT_FOLD_EXPR \ + || TREE_CODE (NODE) == BINARY_RIGHT_FOLD_EXPR) + +/* True when NODE is a fold over a compound assignment operator. */ +#define FOLD_EXPR_MODIFY_P(NODE) \ + TREE_LANG_FLAG_0 (FOLD_EXPR_CHECK (NODE)) + +/* An INTEGER_CST containing the tree code of the folded operator. */ +#define FOLD_EXPR_OP(NODE) \ + TREE_OPERAND (FOLD_EXPR_CHECK (NODE), 0) + +/* The expression containing an unexpanded parameter pack. */ +#define FOLD_EXPR_PACK(NODE) \ + TREE_OPERAND (FOLD_EXPR_CHECK (NODE), 1) + +/* In a binary fold expression, the argument with no unexpanded + parameter packs. */ +#define FOLD_EXPR_INIT(NODE) \ + TREE_OPERAND (BINARY_FOLD_EXPR_CHECK (NODE), 2) + +/* In a FUNCTION_DECL, the saved language-specific per-function data. */ +#define DECL_SAVED_FUNCTION_DATA(NODE) \ + (LANG_DECL_FN_CHECK (FUNCTION_DECL_CHECK (NODE)) \ + ->u.saved_language_function) + +/* True if NODE is an implicit INDIRECT_EXPR from convert_from_reference. */ +#define REFERENCE_REF_P(NODE) \ + (INDIRECT_REF_P (NODE) \ + && TREE_TYPE (TREE_OPERAND (NODE, 0)) \ + && (TREE_CODE (TREE_TYPE (TREE_OPERAND ((NODE), 0))) \ + == REFERENCE_TYPE)) + +/* True if NODE is a REFERENCE_TYPE which is OK to instantiate to be a + reference to VLA type, because it's used for VLA capture. */ +#define REFERENCE_VLA_OK(NODE) \ + (TYPE_LANG_FLAG_5 (REFERENCE_TYPE_CHECK (NODE))) + +#define NEW_EXPR_USE_GLOBAL(NODE) \ + TREE_LANG_FLAG_0 (NEW_EXPR_CHECK (NODE)) +#define DELETE_EXPR_USE_GLOBAL(NODE) \ + TREE_LANG_FLAG_0 (DELETE_EXPR_CHECK (NODE)) +#define DELETE_EXPR_USE_VEC(NODE) \ + TREE_LANG_FLAG_1 (DELETE_EXPR_CHECK (NODE)) + +#define CALL_OR_AGGR_INIT_CHECK(NODE) \ + TREE_CHECK2 ((NODE), CALL_EXPR, AGGR_INIT_EXPR) + +/* Indicates that this is a non-dependent COMPOUND_EXPR which will + resolve to a function call. */ +#define COMPOUND_EXPR_OVERLOADED(NODE) \ + TREE_LANG_FLAG_0 (COMPOUND_EXPR_CHECK (NODE)) + +/* In a CALL_EXPR appearing in a template, true if Koenig lookup + should be performed at instantiation time. */ +#define KOENIG_LOOKUP_P(NODE) TREE_LANG_FLAG_0 (CALL_EXPR_CHECK (NODE)) + +/* True if the arguments to NODE should be evaluated in left-to-right + order regardless of PUSH_ARGS_REVERSED. */ +#define CALL_EXPR_ORDERED_ARGS(NODE) \ + TREE_LANG_FLAG_3 (CALL_OR_AGGR_INIT_CHECK (NODE)) + +/* True if the arguments to NODE should be evaluated in right-to-left + order regardless of PUSH_ARGS_REVERSED. */ +#define CALL_EXPR_REVERSE_ARGS(NODE) \ + TREE_LANG_FLAG_5 (CALL_OR_AGGR_INIT_CHECK (NODE)) + +/* True if CALL_EXPR was written as an operator expression, not a function + call. */ +#define CALL_EXPR_OPERATOR_SYNTAX(NODE) \ + TREE_LANG_FLAG_6 (CALL_OR_AGGR_INIT_CHECK (NODE)) + +/* Indicates whether a string literal has been parenthesized. Such + usages are disallowed in certain circumstances. */ + +#define PAREN_STRING_LITERAL_P(NODE) \ + TREE_LANG_FLAG_0 (STRING_CST_CHECK (NODE)) + +/* Indicates whether a COMPONENT_REF or a SCOPE_REF has been parenthesized, or + an INDIRECT_REF comes from parenthesizing a _DECL. Currently only set some + of the time in C++14 mode. */ + +#define REF_PARENTHESIZED_P(NODE) \ + TREE_LANG_FLAG_2 (TREE_CHECK3 ((NODE), COMPONENT_REF, INDIRECT_REF, SCOPE_REF)) + +/* Nonzero if this AGGR_INIT_EXPR provides for initialization via a + constructor call, rather than an ordinary function call. */ +#define AGGR_INIT_VIA_CTOR_P(NODE) \ + TREE_LANG_FLAG_0 (AGGR_INIT_EXPR_CHECK (NODE)) + +/* Nonzero if expanding this AGGR_INIT_EXPR should first zero-initialize + the object. */ +#define AGGR_INIT_ZERO_FIRST(NODE) \ + TREE_LANG_FLAG_2 (AGGR_INIT_EXPR_CHECK (NODE)) + +/* Nonzero means that the call is the jump from a thunk to the + thunked-to function. */ +#define AGGR_INIT_FROM_THUNK_P(NODE) \ + (AGGR_INIT_EXPR_CHECK (NODE)->base.protected_flag) + +/* AGGR_INIT_EXPR accessors. These are equivalent to the CALL_EXPR + accessors, except for AGGR_INIT_EXPR_SLOT (which takes the place of + CALL_EXPR_STATIC_CHAIN). */ + +#define AGGR_INIT_EXPR_FN(NODE) TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), 1) +#define AGGR_INIT_EXPR_SLOT(NODE) \ + TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), 2) +#define AGGR_INIT_EXPR_ARG(NODE, I) \ + TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), (I) + 3) +#define aggr_init_expr_nargs(NODE) (VL_EXP_OPERAND_LENGTH(NODE) - 3) + +/* AGGR_INIT_EXPR_ARGP returns a pointer to the argument vector for NODE. + We can't use &AGGR_INIT_EXPR_ARG (NODE, 0) because that will complain if + the argument count is zero when checking is enabled. Instead, do + the pointer arithmetic to advance past the 3 fixed operands in a + AGGR_INIT_EXPR. That produces a valid pointer to just past the end of + the operand array, even if it's not valid to dereference it. */ +#define AGGR_INIT_EXPR_ARGP(NODE) \ + (&(TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), 0)) + 3) + +/* Abstract iterators for AGGR_INIT_EXPRs. */ + +/* Structure containing iterator state. */ +struct aggr_init_expr_arg_iterator { + tree t; /* the aggr_init_expr */ + int n; /* argument count */ + int i; /* next argument index */ +}; + +/* Initialize the abstract argument list iterator object ITER with the + arguments from AGGR_INIT_EXPR node EXP. */ +inline void +init_aggr_init_expr_arg_iterator (tree exp, + aggr_init_expr_arg_iterator *iter) +{ + iter->t = exp; + iter->n = aggr_init_expr_nargs (exp); + iter->i = 0; +} + +/* Return the next argument from abstract argument list iterator object ITER, + and advance its state. Return NULL_TREE if there are no more arguments. */ +inline tree +next_aggr_init_expr_arg (aggr_init_expr_arg_iterator *iter) +{ + tree result; + if (iter->i >= iter->n) + return NULL_TREE; + result = AGGR_INIT_EXPR_ARG (iter->t, iter->i); + iter->i++; + return result; +} + +/* Initialize the abstract argument list iterator object ITER, then advance + past and return the first argument. Useful in for expressions, e.g. + for (arg = first_aggr_init_expr_arg (exp, &iter); arg; + arg = next_aggr_init_expr_arg (&iter)) */ +inline tree +first_aggr_init_expr_arg (tree exp, aggr_init_expr_arg_iterator *iter) +{ + init_aggr_init_expr_arg_iterator (exp, iter); + return next_aggr_init_expr_arg (iter); +} + +/* Test whether there are more arguments in abstract argument list iterator + ITER, without changing its state. */ +inline bool +more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter) +{ + return (iter->i < iter->n); +} + +/* Iterate through each argument ARG of AGGR_INIT_EXPR CALL, using variable + ITER (of type aggr_init_expr_arg_iterator) to hold the iteration state. */ +#define FOR_EACH_AGGR_INIT_EXPR_ARG(arg, iter, call) \ + for ((arg) = first_aggr_init_expr_arg ((call), &(iter)); (arg); \ + (arg) = next_aggr_init_expr_arg (&(iter))) + +/* VEC_INIT_EXPR accessors. */ +#define VEC_INIT_EXPR_SLOT(NODE) TREE_OPERAND (VEC_INIT_EXPR_CHECK (NODE), 0) +#define VEC_INIT_EXPR_INIT(NODE) TREE_OPERAND (VEC_INIT_EXPR_CHECK (NODE), 1) + +/* Indicates that a VEC_INIT_EXPR is a potential constant expression. + Only set when the current function is constexpr. */ +#define VEC_INIT_EXPR_IS_CONSTEXPR(NODE) \ + TREE_LANG_FLAG_0 (VEC_INIT_EXPR_CHECK (NODE)) + +/* Indicates that a VEC_INIT_EXPR is expressing value-initialization. */ +#define VEC_INIT_EXPR_VALUE_INIT(NODE) \ + TREE_LANG_FLAG_1 (VEC_INIT_EXPR_CHECK (NODE)) + +/* The condition under which this MUST_NOT_THROW_EXPR actually blocks + exceptions. NULL_TREE means 'true'. */ +#define MUST_NOT_THROW_COND(NODE) \ + TREE_OPERAND (MUST_NOT_THROW_EXPR_CHECK (NODE), 1) + +/* The TYPE_MAIN_DECL for a class template type is a TYPE_DECL, not a + TEMPLATE_DECL. This macro determines whether or not a given class + type is really a template type, as opposed to an instantiation or + specialization of one. */ +#define CLASSTYPE_IS_TEMPLATE(NODE) \ + (CLASSTYPE_TEMPLATE_INFO (NODE) \ + && !CLASSTYPE_USE_TEMPLATE (NODE) \ + && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE))) + +/* The name used by the user to name the typename type. Typically, + this is an IDENTIFIER_NODE, and the same as the DECL_NAME on the + corresponding TYPE_DECL. However, this may also be a + TEMPLATE_ID_EXPR if we had something like `typename X::Y'. */ +#define TYPENAME_TYPE_FULLNAME(NODE) \ + (TYPE_VALUES_RAW (TYPENAME_TYPE_CHECK (NODE))) + +/* True if a TYPENAME_TYPE was declared as an "enum". */ +#define TYPENAME_IS_ENUM_P(NODE) \ + (TREE_LANG_FLAG_0 (TYPENAME_TYPE_CHECK (NODE))) + +/* True if a TYPENAME_TYPE was declared as a "class", "struct", or + "union". */ +#define TYPENAME_IS_CLASS_P(NODE) \ + (TREE_LANG_FLAG_1 (TYPENAME_TYPE_CHECK (NODE))) + +/* True if a TYPENAME_TYPE is in the process of being resolved. */ +#define TYPENAME_IS_RESOLVING_P(NODE) \ + (TREE_LANG_FLAG_2 (TYPENAME_TYPE_CHECK (NODE))) + +/* [class.virtual] + + A class that declares or inherits a virtual function is called a + polymorphic class. */ +#define TYPE_POLYMORPHIC_P(NODE) (TREE_LANG_FLAG_2 (NODE)) + +/* Nonzero if this class has a virtual function table pointer. */ +#define TYPE_CONTAINS_VPTR_P(NODE) \ + (TYPE_POLYMORPHIC_P (NODE) || CLASSTYPE_VBASECLASSES (NODE)) + +/* This flag is true of a local VAR_DECL if it was declared in a for + statement, but we are no longer in the scope of the for. */ +#define DECL_DEAD_FOR_LOCAL(NODE) DECL_LANG_FLAG_7 (VAR_DECL_CHECK (NODE)) + +/* This flag is set on a VAR_DECL that is a DECL_DEAD_FOR_LOCAL + if we already emitted a warning about using it. */ +#define DECL_ERROR_REPORTED(NODE) DECL_LANG_FLAG_0 (VAR_DECL_CHECK (NODE)) + +/* Nonzero if NODE is a FUNCTION_DECL (for a function with global + scope) declared in a local scope. */ +#define DECL_LOCAL_FUNCTION_P(NODE) \ + DECL_LANG_FLAG_0 (FUNCTION_DECL_CHECK (NODE)) + +/* Nonzero if NODE is the target for genericization of 'break' stmts. */ +#define LABEL_DECL_BREAK(NODE) \ + DECL_LANG_FLAG_0 (LABEL_DECL_CHECK (NODE)) + +/* Nonzero if NODE is the target for genericization of 'continue' stmts. */ +#define LABEL_DECL_CONTINUE(NODE) \ + DECL_LANG_FLAG_1 (LABEL_DECL_CHECK (NODE)) + +/* True if NODE was declared with auto in its return type, but it has + started compilation and so the return type might have been changed by + return type deduction; its declared return type should be found in + DECL_STRUCT_FUNCTION(NODE)->language->x_auto_return_pattern. */ +#define FNDECL_USED_AUTO(NODE) \ + TREE_LANG_FLAG_2 (FUNCTION_DECL_CHECK (NODE)) + +/* Nonzero if NODE is a DECL which we know about but which has not + been explicitly declared, such as a built-in function or a friend + declared inside a class. In the latter case DECL_HIDDEN_FRIEND_P + will be set. */ +#define DECL_ANTICIPATED(NODE) \ + (DECL_LANG_SPECIFIC (TYPE_FUNCTION_OR_TEMPLATE_DECL_CHECK (NODE)) \ + ->u.base.anticipated_p) + +/* True for artificial decls added for OpenMP privatized non-static + data members. */ +#define DECL_OMP_PRIVATIZED_MEMBER(NODE) \ + (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE))->u.base.anticipated_p) + +/* Nonzero if NODE is a FUNCTION_DECL which was declared as a friend + within a class but has not been declared in the surrounding scope. + The function is invisible except via argument dependent lookup. */ +#define DECL_HIDDEN_FRIEND_P(NODE) \ + (LANG_DECL_FN_CHECK (DECL_COMMON_CHECK (NODE))->hidden_friend_p) + +/* Nonzero if NODE is an artificial FUNCTION_DECL for + #pragma omp declare reduction. */ +#define DECL_OMP_DECLARE_REDUCTION_P(NODE) \ + (LANG_DECL_FN_CHECK (DECL_COMMON_CHECK (NODE))->omp_declare_reduction_p) + +/* Nonzero if DECL has been declared threadprivate by + #pragma omp threadprivate. */ +#define CP_DECL_THREADPRIVATE_P(DECL) \ + (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (DECL))->u.base.threadprivate_or_deleted_p) + +/* Nonzero if NODE is a VAR_DECL which has been declared inline. */ +#define DECL_VAR_DECLARED_INLINE_P(NODE) \ + (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE)) \ + ? DECL_LANG_SPECIFIC (NODE)->u.base.var_declared_inline_p \ + : false) +#define SET_DECL_VAR_DECLARED_INLINE_P(NODE) \ + (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE))->u.base.var_declared_inline_p \ + = true) + +/* Nonzero if NODE is an artificial VAR_DECL for a C++17 decomposition + declaration. */ +#define DECL_DECOMPOSITION_P(NODE) \ + (VAR_P (NODE) && DECL_LANG_SPECIFIC (NODE) \ + ? DECL_LANG_SPECIFIC (NODE)->u.base.decomposition_p \ + : false) +#define SET_DECL_DECOMPOSITION_P(NODE) \ + (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE))->u.base.decomposition_p \ + = true) + +/* Nonzero if NODE is an inline VAR_DECL. In C++17, static data members + declared with constexpr specifier are implicitly inline variables. */ +#define DECL_INLINE_VAR_P(NODE) \ + (DECL_VAR_DECLARED_INLINE_P (NODE) \ + || (cxx_dialect >= cxx1z \ + && DECL_DECLARED_CONSTEXPR_P (NODE) \ + && DECL_CLASS_SCOPE_P (NODE))) + +/* Nonzero if DECL was declared with '= delete'. */ +#define DECL_DELETED_FN(DECL) \ + (LANG_DECL_FN_CHECK (DECL)->min.base.threadprivate_or_deleted_p) + +/* Nonzero if DECL was declared with '= default' (maybe implicitly). */ +#define DECL_DEFAULTED_FN(DECL) \ + (LANG_DECL_FN_CHECK (DECL)->defaulted_p) + +/* Nonzero if DECL is explicitly defaulted in the class body. */ +#define DECL_DEFAULTED_IN_CLASS_P(DECL) \ + (DECL_DEFAULTED_FN (DECL) && DECL_INITIALIZED_IN_CLASS_P (DECL)) +/* Nonzero if DECL was defaulted outside the class body. */ +#define DECL_DEFAULTED_OUTSIDE_CLASS_P(DECL) \ + (DECL_DEFAULTED_FN (DECL) \ + && !(DECL_ARTIFICIAL (DECL) || DECL_INITIALIZED_IN_CLASS_P (DECL))) + +/* Record whether a typedef for type `int' was actually `signed int'. */ +#define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP) + +/* Returns nonzero if DECL has external linkage, as specified by the + language standard. (This predicate may hold even when the + corresponding entity is not actually given external linkage in the + object file; see decl_linkage for details.) */ +#define DECL_EXTERNAL_LINKAGE_P(DECL) \ + (decl_linkage (DECL) == lk_external) + +/* Keep these codes in ascending code order. */ + +#define INTEGRAL_CODE_P(CODE) \ + ((CODE) == ENUMERAL_TYPE \ + || (CODE) == BOOLEAN_TYPE \ + || (CODE) == INTEGER_TYPE) + +/* [basic.fundamental] + + Types bool, char, wchar_t, and the signed and unsigned integer types + are collectively called integral types. + + Note that INTEGRAL_TYPE_P, as defined in tree.h, allows enumeration + types as well, which is incorrect in C++. Keep these checks in + ascending code order. */ +#define CP_INTEGRAL_TYPE_P(TYPE) \ + (TREE_CODE (TYPE) == BOOLEAN_TYPE \ + || TREE_CODE (TYPE) == INTEGER_TYPE) + +/* Returns true if TYPE is an integral or enumeration name. Keep + these checks in ascending code order. */ +#define INTEGRAL_OR_ENUMERATION_TYPE_P(TYPE) \ + (TREE_CODE (TYPE) == ENUMERAL_TYPE || CP_INTEGRAL_TYPE_P (TYPE)) + +/* Returns true if TYPE is an integral or unscoped enumeration type. */ +#define INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P(TYPE) \ + (UNSCOPED_ENUM_P (TYPE) || CP_INTEGRAL_TYPE_P (TYPE)) + +/* True if the class type TYPE is a literal type. */ +#define CLASSTYPE_LITERAL_P(TYPE) \ + (LANG_TYPE_CLASS_CHECK (TYPE)->is_literal) + +/* [basic.fundamental] + + Integral and floating types are collectively called arithmetic + types. + + As a GNU extension, we also accept complex types. + + Keep these checks in ascending code order. */ +#define ARITHMETIC_TYPE_P(TYPE) \ + (CP_INTEGRAL_TYPE_P (TYPE) \ + || TREE_CODE (TYPE) == REAL_TYPE \ + || TREE_CODE (TYPE) == COMPLEX_TYPE) + +/* True iff TYPE is cv decltype(nullptr). */ +#define NULLPTR_TYPE_P(TYPE) (TREE_CODE (TYPE) == NULLPTR_TYPE) + +/* [basic.types] + + Arithmetic types, enumeration types, pointer types, + pointer-to-member types, and std::nullptr_t are collectively called + scalar types. + + Keep these checks in ascending code order. */ +#define SCALAR_TYPE_P(TYPE) \ + (TYPE_PTRDATAMEM_P (TYPE) \ + || TREE_CODE (TYPE) == ENUMERAL_TYPE \ + || ARITHMETIC_TYPE_P (TYPE) \ + || TYPE_PTR_P (TYPE) \ + || TYPE_PTRMEMFUNC_P (TYPE) \ + || NULLPTR_TYPE_P (TYPE)) + +/* Determines whether this type is a C++0x scoped enumeration + type. Scoped enumerations types are introduced via "enum class" or + "enum struct", e.g., + + enum class Color { + Red, Green, Blue + }; + + Scoped enumeration types are different from normal (unscoped) + enumeration types in several ways: + + - The enumerators of a scoped enumeration type are only available + within the scope of the enumeration type and not in the + enclosing scope. For example, the Red color can be referred to + with "Color::Red" but not "Red". + + - Scoped enumerators and enumerations do not implicitly convert + to integers or 'bool'. + + - The underlying type of the enum is well-defined. */ +#define SCOPED_ENUM_P(TYPE) \ + (TREE_CODE (TYPE) == ENUMERAL_TYPE && ENUM_IS_SCOPED (TYPE)) + +/* Determine whether this is an unscoped enumeration type. */ +#define UNSCOPED_ENUM_P(TYPE) \ + (TREE_CODE (TYPE) == ENUMERAL_TYPE && !ENUM_IS_SCOPED (TYPE)) + +/* Set the flag indicating whether an ENUMERAL_TYPE is a C++0x scoped + enumeration type (1) or a normal (unscoped) enumeration type + (0). */ +#define SET_SCOPED_ENUM_P(TYPE, VAL) \ + (ENUM_IS_SCOPED (TYPE) = (VAL)) + +#define SET_OPAQUE_ENUM_P(TYPE, VAL) \ + (ENUM_IS_OPAQUE (TYPE) = (VAL)) + +#define OPAQUE_ENUM_P(TYPE) \ + (TREE_CODE (TYPE) == ENUMERAL_TYPE && ENUM_IS_OPAQUE (TYPE)) + +/* Determines whether an ENUMERAL_TYPE has an explicit + underlying type. */ +#define ENUM_FIXED_UNDERLYING_TYPE_P(NODE) (TYPE_LANG_FLAG_5 (NODE)) + +/* Returns the underlying type of the given enumeration type. The + underlying type is determined in different ways, depending on the + properties of the enum: + + - In C++0x, the underlying type can be explicitly specified, e.g., + + enum E1 : char { ... } // underlying type is char + + - In a C++0x scoped enumeration, the underlying type is int + unless otherwises specified: + + enum class E2 { ... } // underlying type is int + + - Otherwise, the underlying type is determined based on the + values of the enumerators. In this case, the + ENUM_UNDERLYING_TYPE will not be set until after the definition + of the enumeration is completed by finish_enum. */ +#define ENUM_UNDERLYING_TYPE(TYPE) \ + TREE_TYPE (ENUMERAL_TYPE_CHECK (TYPE)) + +/* [dcl.init.aggr] + + An aggregate is an array or a class with no user-provided + constructors, no brace-or-equal-initializers for non-static data + members, no private or protected non-static data members, no + base classes, and no virtual functions. + + As an extension, we also treat vectors as aggregates. Keep these + checks in ascending code order. */ +#define CP_AGGREGATE_TYPE_P(TYPE) \ + (TREE_CODE (TYPE) == VECTOR_TYPE \ + ||TREE_CODE (TYPE) == ARRAY_TYPE \ + || (CLASS_TYPE_P (TYPE) && !CLASSTYPE_NON_AGGREGATE (TYPE))) + +/* Nonzero for a class type means that the class type has a + user-declared constructor. */ +#define TYPE_HAS_USER_CONSTRUCTOR(NODE) (TYPE_LANG_FLAG_1 (NODE)) + +/* Nonzero means that the FUNCTION_TYPE or METHOD_TYPE has a + late-specified return type. */ +#define TYPE_HAS_LATE_RETURN_TYPE(NODE) \ + (TYPE_LANG_FLAG_2 (FUNC_OR_METHOD_CHECK (NODE))) + +/* When appearing in an INDIRECT_REF, it means that the tree structure + underneath is actually a call to a constructor. This is needed + when the constructor must initialize local storage (which can + be automatically destroyed), rather than allowing it to allocate + space from the heap. + + When appearing in a SAVE_EXPR, it means that underneath + is a call to a constructor. + + When appearing in a CONSTRUCTOR, the expression is a + compound literal. + + When appearing in a FIELD_DECL, it means that this field + has been duly initialized in its constructor. */ +#define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_4 (NODE)) + +/* True if NODE is a brace-enclosed initializer. */ +#define BRACE_ENCLOSED_INITIALIZER_P(NODE) \ + (TREE_CODE (NODE) == CONSTRUCTOR && TREE_TYPE (NODE) == init_list_type_node) + +/* True if NODE is a compound-literal, i.e., a brace-enclosed + initializer cast to a particular type. */ +#define COMPOUND_LITERAL_P(NODE) \ + (TREE_CODE (NODE) == CONSTRUCTOR && TREE_HAS_CONSTRUCTOR (NODE)) + +#define EMPTY_CONSTRUCTOR_P(NODE) (TREE_CODE (NODE) == CONSTRUCTOR \ + && vec_safe_is_empty(CONSTRUCTOR_ELTS(NODE))\ + && !TREE_HAS_CONSTRUCTOR (NODE)) + +/* True if NODE is a init-list used as a direct-initializer, i.e. + B b{1,2}, not B b({1,2}) or B b = {1,2}. */ +#define CONSTRUCTOR_IS_DIRECT_INIT(NODE) (TREE_LANG_FLAG_0 (CONSTRUCTOR_CHECK (NODE))) + +/* True if an uninitialized element in NODE should not be treated as + implicitly value-initialized. Only used in constexpr evaluation. */ +#define CONSTRUCTOR_NO_IMPLICIT_ZERO(NODE) \ + (TREE_LANG_FLAG_1 (CONSTRUCTOR_CHECK (NODE))) + +/* True if this CONSTRUCTOR should not be used as a variable initializer + because it was loaded from a constexpr variable with mutable fields. */ +#define CONSTRUCTOR_MUTABLE_POISON(NODE) \ + (TREE_LANG_FLAG_2 (CONSTRUCTOR_CHECK (NODE))) + +#define DIRECT_LIST_INIT_P(NODE) \ + (BRACE_ENCLOSED_INITIALIZER_P (NODE) && CONSTRUCTOR_IS_DIRECT_INIT (NODE)) + +/* True if NODE represents a conversion for direct-initialization in a + template. Set by perform_implicit_conversion_flags. */ +#define IMPLICIT_CONV_EXPR_DIRECT_INIT(NODE) \ + (TREE_LANG_FLAG_0 (IMPLICIT_CONV_EXPR_CHECK (NODE))) + +/* Nonzero means that an object of this type can not be initialized using + an initializer list. */ +#define CLASSTYPE_NON_AGGREGATE(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->non_aggregate) +#define TYPE_NON_AGGREGATE_CLASS(NODE) \ + (CLASS_TYPE_P (NODE) && CLASSTYPE_NON_AGGREGATE (NODE)) + +/* Nonzero if there is a non-trivial X::op=(cv X&) for this class. */ +#define TYPE_HAS_COMPLEX_COPY_ASSIGN(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_copy_assign) + +/* Nonzero if there is a non-trivial X::X(cv X&) for this class. */ +#define TYPE_HAS_COMPLEX_COPY_CTOR(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_copy_ctor) + +/* Nonzero if there is a non-trivial X::op=(X&&) for this class. */ +#define TYPE_HAS_COMPLEX_MOVE_ASSIGN(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_move_assign) + +/* Nonzero if there is a non-trivial X::X(X&&) for this class. */ +#define TYPE_HAS_COMPLEX_MOVE_CTOR(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_move_ctor) + +/* Nonzero if there is no trivial default constructor for this class. */ +#define TYPE_HAS_COMPLEX_DFLT(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_dflt) + +/* Nonzero if TYPE has a trivial destructor. From [class.dtor]: + + A destructor is trivial if it is an implicitly declared + destructor and if: + + - all of the direct base classes of its class have trivial + destructors, + + - for all of the non-static data members of its class that are + of class type (or array thereof), each such class has a + trivial destructor. */ +#define TYPE_HAS_TRIVIAL_DESTRUCTOR(NODE) \ + (!TYPE_HAS_NONTRIVIAL_DESTRUCTOR (NODE)) + +/* Nonzero for _TYPE node means that this type does not have a trivial + destructor. Therefore, destroying an object of this type will + involve a call to a destructor. This can apply to objects of + ARRAY_TYPE is the type of the elements needs a destructor. */ +#define TYPE_HAS_NONTRIVIAL_DESTRUCTOR(NODE) \ + (TYPE_LANG_FLAG_4 (NODE)) + +/* Nonzero for class type means that the default constructor is trivial. */ +#define TYPE_HAS_TRIVIAL_DFLT(NODE) \ + (TYPE_HAS_DEFAULT_CONSTRUCTOR (NODE) && ! TYPE_HAS_COMPLEX_DFLT (NODE)) + +/* Nonzero for class type means that copy initialization of this type can use + a bitwise copy. */ +#define TYPE_HAS_TRIVIAL_COPY_CTOR(NODE) \ + (TYPE_HAS_COPY_CTOR (NODE) && ! TYPE_HAS_COMPLEX_COPY_CTOR (NODE)) + +/* Nonzero for class type means that assignment of this type can use + a bitwise copy. */ +#define TYPE_HAS_TRIVIAL_COPY_ASSIGN(NODE) \ + (TYPE_HAS_COPY_ASSIGN (NODE) && ! TYPE_HAS_COMPLEX_COPY_ASSIGN (NODE)) + +/* Returns true if NODE is a pointer-to-data-member. */ +#define TYPE_PTRDATAMEM_P(NODE) \ + (TREE_CODE (NODE) == OFFSET_TYPE) +/* Returns true if NODE is a pointer. */ +#define TYPE_PTR_P(NODE) \ + (TREE_CODE (NODE) == POINTER_TYPE) + +/* Returns true if NODE is an object type: + + [basic.types] + + An object type is a (possibly cv-qualified) type that is not a + function type, not a reference type, and not a void type. + + Keep these checks in ascending order, for speed. */ +#define TYPE_OBJ_P(NODE) \ + (TREE_CODE (NODE) != REFERENCE_TYPE \ + && !VOID_TYPE_P (NODE) \ + && TREE_CODE (NODE) != FUNCTION_TYPE \ + && TREE_CODE (NODE) != METHOD_TYPE) + +/* Returns true if NODE is a pointer to an object. Keep these checks + in ascending tree code order. */ +#define TYPE_PTROB_P(NODE) \ + (TYPE_PTR_P (NODE) && TYPE_OBJ_P (TREE_TYPE (NODE))) + +/* Returns true if NODE is a reference to an object. Keep these checks + in ascending tree code order. */ +#define TYPE_REF_OBJ_P(NODE) \ + (TREE_CODE (NODE) == REFERENCE_TYPE && TYPE_OBJ_P (TREE_TYPE (NODE))) + +/* Returns true if NODE is a pointer to an object, or a pointer to + void. Keep these checks in ascending tree code order. */ +#define TYPE_PTROBV_P(NODE) \ + (TYPE_PTR_P (NODE) \ + && !(TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE \ + || TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE)) + +/* Returns true if NODE is a pointer to function type. */ +#define TYPE_PTRFN_P(NODE) \ + (TYPE_PTR_P (NODE) \ + && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE) + +/* Returns true if NODE is a reference to function type. */ +#define TYPE_REFFN_P(NODE) \ + (TREE_CODE (NODE) == REFERENCE_TYPE \ + && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE) + +/* Returns true if NODE is a pointer to member function type. */ +#define TYPE_PTRMEMFUNC_P(NODE) \ + (TREE_CODE (NODE) == RECORD_TYPE \ + && TYPE_PTRMEMFUNC_FLAG (NODE)) + +#define TYPE_PTRMEMFUNC_FLAG(NODE) \ + (TYPE_LANG_FLAG_2 (RECORD_TYPE_CHECK (NODE))) + +/* Returns true if NODE is a pointer-to-member. */ +#define TYPE_PTRMEM_P(NODE) \ + (TYPE_PTRDATAMEM_P (NODE) || TYPE_PTRMEMFUNC_P (NODE)) + +/* Returns true if NODE is a pointer or a pointer-to-member. */ +#define TYPE_PTR_OR_PTRMEM_P(NODE) \ + (TYPE_PTR_P (NODE) || TYPE_PTRMEM_P (NODE)) + +/* Indicates when overload resolution may resolve to a pointer to + member function. [expr.unary.op]/3 */ +#define PTRMEM_OK_P(NODE) \ + TREE_LANG_FLAG_0 (TREE_CHECK3 ((NODE), ADDR_EXPR, OFFSET_REF, SCOPE_REF)) + +/* Get the POINTER_TYPE to the METHOD_TYPE associated with this + pointer to member function. TYPE_PTRMEMFUNC_P _must_ be true, + before using this macro. */ +#define TYPE_PTRMEMFUNC_FN_TYPE(NODE) \ + (cp_build_qualified_type (TREE_TYPE (TYPE_FIELDS (NODE)),\ + cp_type_quals (NODE))) + +/* As above, but can be used in places that want an lvalue at the expense + of not necessarily having the correct cv-qualifiers. */ +#define TYPE_PTRMEMFUNC_FN_TYPE_RAW(NODE) \ + (TREE_TYPE (TYPE_FIELDS (NODE))) + +/* Returns `A' for a type like `int (A::*)(double)' */ +#define TYPE_PTRMEMFUNC_OBJECT_TYPE(NODE) \ + TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE))) + +/* These are use to manipulate the canonical RECORD_TYPE from the + hashed POINTER_TYPE, and can only be used on the POINTER_TYPE. */ +#define TYPE_GET_PTRMEMFUNC_TYPE(NODE) \ + (TYPE_LANG_SPECIFIC (NODE) ? LANG_TYPE_PTRMEM_CHECK (NODE)->record : NULL) +#define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) \ + do { \ + if (TYPE_LANG_SPECIFIC (NODE) == NULL) \ + { \ + TYPE_LANG_SPECIFIC (NODE) \ + = (struct lang_type *) ggc_internal_cleared_alloc \ + (sizeof (struct lang_type_ptrmem)); \ + TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.h.is_lang_type_class = 0; \ + } \ + TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.record = (VALUE); \ + } while (0) + +/* For a pointer-to-member type of the form `T X::*', this is `X'. + For a type like `void (X::*)() const', this type is `X', not `const + X'. To get at the `const X' you have to look at the + TYPE_PTRMEM_POINTED_TO_TYPE; there, the first parameter will have + type `const X*'. */ +#define TYPE_PTRMEM_CLASS_TYPE(NODE) \ + (TYPE_PTRDATAMEM_P (NODE) \ + ? TYPE_OFFSET_BASETYPE (NODE) \ + : TYPE_PTRMEMFUNC_OBJECT_TYPE (NODE)) + +/* For a pointer-to-member type of the form `T X::*', this is `T'. */ +#define TYPE_PTRMEM_POINTED_TO_TYPE(NODE) \ + (TYPE_PTRDATAMEM_P (NODE) \ + ? TREE_TYPE (NODE) \ + : TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE))) + +/* For a pointer-to-member constant `X::Y' this is the RECORD_TYPE for + `X'. */ +#define PTRMEM_CST_CLASS(NODE) \ + TYPE_PTRMEM_CLASS_TYPE (TREE_TYPE (PTRMEM_CST_CHECK (NODE))) + +/* For a pointer-to-member constant `X::Y' this is the _DECL for + `Y'. */ +#define PTRMEM_CST_MEMBER(NODE) (((ptrmem_cst_t)PTRMEM_CST_CHECK (NODE))->member) + +/* The expression in question for a TYPEOF_TYPE. */ +#define TYPEOF_TYPE_EXPR(NODE) (TYPE_VALUES_RAW (TYPEOF_TYPE_CHECK (NODE))) + +/* The type in question for an UNDERLYING_TYPE. */ +#define UNDERLYING_TYPE_TYPE(NODE) \ + (TYPE_VALUES_RAW (UNDERLYING_TYPE_CHECK (NODE))) + +/* The type in question for BASES. */ +#define BASES_TYPE(NODE) \ + (TYPE_VALUES_RAW (BASES_CHECK (NODE))) + +#define BASES_DIRECT(NODE) \ + TREE_LANG_FLAG_0 (BASES_CHECK (NODE)) + +/* The expression in question for a DECLTYPE_TYPE. */ +#define DECLTYPE_TYPE_EXPR(NODE) (TYPE_VALUES_RAW (DECLTYPE_TYPE_CHECK (NODE))) + +/* Whether the DECLTYPE_TYPE_EXPR of NODE was originally parsed as an + id-expression or a member-access expression. When false, it was + parsed as a full expression. */ +#define DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P(NODE) \ + (DECLTYPE_TYPE_CHECK (NODE))->type_common.string_flag + +/* These flags indicate that we want different semantics from normal + decltype: lambda capture just drops references, init capture + uses auto semantics, lambda proxies look through implicit dereference. */ +#define DECLTYPE_FOR_LAMBDA_CAPTURE(NODE) \ + TREE_LANG_FLAG_0 (DECLTYPE_TYPE_CHECK (NODE)) +#define DECLTYPE_FOR_INIT_CAPTURE(NODE) \ + TREE_LANG_FLAG_1 (DECLTYPE_TYPE_CHECK (NODE)) +#define DECLTYPE_FOR_LAMBDA_PROXY(NODE) \ + TREE_LANG_FLAG_2 (DECLTYPE_TYPE_CHECK (NODE)) +#define DECLTYPE_FOR_REF_CAPTURE(NODE) \ + TREE_LANG_FLAG_3 (DECLTYPE_TYPE_CHECK (NODE)) + +/* Nonzero for VAR_DECL and FUNCTION_DECL node means that `extern' was + specified in its declaration. This can also be set for an + erroneously declared PARM_DECL. */ +#define DECL_THIS_EXTERN(NODE) \ + DECL_LANG_FLAG_2 (VAR_FUNCTION_OR_PARM_DECL_CHECK (NODE)) + +/* Nonzero for VAR_DECL and FUNCTION_DECL node means that `static' was + specified in its declaration. This can also be set for an + erroneously declared PARM_DECL. */ +#define DECL_THIS_STATIC(NODE) \ + DECL_LANG_FLAG_6 (VAR_FUNCTION_OR_PARM_DECL_CHECK (NODE)) + +/* Nonzero for FIELD_DECL node means that this field is a lambda capture + field for an array of runtime bound. */ +#define DECL_VLA_CAPTURE_P(NODE) \ + DECL_LANG_FLAG_1 (FIELD_DECL_CHECK (NODE)) + +/* Nonzero for PARM_DECL node means that this is an array function + parameter, i.e, a[] rather than *a. */ +#define DECL_ARRAY_PARAMETER_P(NODE) \ + DECL_LANG_FLAG_1 (PARM_DECL_CHECK (NODE)) + +/* Nonzero for a FIELD_DECL who's NSMDI is currently being + instantiated. */ +#define DECL_INSTANTIATING_NSDMI_P(NODE) \ + DECL_LANG_FLAG_2 (FIELD_DECL_CHECK (NODE)) + +/* Nonzero for FIELD_DECL node means that this field is a base class + of the parent object, as opposed to a member field. */ +#define DECL_FIELD_IS_BASE(NODE) \ + DECL_LANG_FLAG_6 (FIELD_DECL_CHECK (NODE)) + +/* Nonzero for FIELD_DECL node means that this field is a simple (no + explicit initializer) lambda capture field, making it invisible to + name lookup in unevaluated contexts. */ +#define DECL_NORMAL_CAPTURE_P(NODE) \ + DECL_LANG_FLAG_7 (FIELD_DECL_CHECK (NODE)) + +/* Nonzero if TYPE is an anonymous union or struct type. We have to use a + flag for this because "A union for which objects or pointers are + declared is not an anonymous union" [class.union]. */ +#define ANON_AGGR_TYPE_P(NODE) \ + (CLASS_TYPE_P (NODE) && LANG_TYPE_CLASS_CHECK (NODE)->anon_aggr) +#define SET_ANON_AGGR_TYPE_P(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->anon_aggr = 1) + +/* Nonzero if TYPE is an anonymous union type. */ +#define ANON_UNION_TYPE_P(NODE) \ + (TREE_CODE (NODE) == UNION_TYPE && ANON_AGGR_TYPE_P (NODE)) + +/* Define fields and accessors for nodes representing declared names. */ + +/* Nonzero if TYPE is an unnamed class with a typedef for linkage purposes. */ +#define TYPE_WAS_UNNAMED(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->was_anonymous) + +/* C++: all of these are overloaded! These apply only to TYPE_DECLs. */ + +/* The format of each node in the DECL_FRIENDLIST is as follows: + + The TREE_PURPOSE will be the name of a function, i.e., an + IDENTIFIER_NODE. The TREE_VALUE will be itself a TREE_LIST, whose + TREE_VALUEs are friends with the given name. */ +#define DECL_FRIENDLIST(NODE) (DECL_INITIAL (NODE)) +#define FRIEND_NAME(LIST) (TREE_PURPOSE (LIST)) +#define FRIEND_DECLS(LIST) (TREE_VALUE (LIST)) + +/* The DECL_ACCESS, if non-NULL, is a TREE_LIST. The TREE_PURPOSE of + each node is a type; the TREE_VALUE is the access granted for this + DECL in that type. The DECL_ACCESS is set by access declarations. + For example, if a member that would normally be public in a + derived class is made protected, then the derived class and the + protected_access_node will appear in the DECL_ACCESS for the node. */ +#define DECL_ACCESS(NODE) (LANG_DECL_U2_CHECK (NODE, 0)->access) + +/* Nonzero if the FUNCTION_DECL is a global constructor. */ +#define DECL_GLOBAL_CTOR_P(NODE) \ + (LANG_DECL_FN_CHECK (NODE)->global_ctor_p) + +/* Nonzero if the FUNCTION_DECL is a global destructor. */ +#define DECL_GLOBAL_DTOR_P(NODE) \ + (LANG_DECL_FN_CHECK (NODE)->global_dtor_p) + +/* Accessor macros for C++ template decl nodes. */ + +/* The DECL_TEMPLATE_PARMS are a list. The TREE_PURPOSE of each node + is a INT_CST whose TREE_INT_CST_LOW indicates the level of the + template parameters, with 1 being the outermost set of template + parameters. The TREE_VALUE is a vector, whose elements are the + template parameters at each level. Each element in the vector is a + TREE_LIST, whose TREE_VALUE is a PARM_DECL (if the parameter is a + non-type parameter), or a TYPE_DECL (if the parameter is a type + parameter). The TREE_PURPOSE is the default value, if any. The + TEMPLATE_PARM_INDEX for the parameter is available as the + DECL_INITIAL (for a PARM_DECL) or as the TREE_TYPE (for a + TYPE_DECL). + + FIXME: CONST_CAST_TREE is a hack that hopefully will go away after + tree is converted to C++ class hiearchy. */ +#define DECL_TEMPLATE_PARMS(NODE) \ + ((struct tree_template_decl *)CONST_CAST_TREE (TEMPLATE_DECL_CHECK (NODE)))->arguments +#define DECL_INNERMOST_TEMPLATE_PARMS(NODE) \ + INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (NODE)) +#define DECL_NTPARMS(NODE) \ + TREE_VEC_LENGTH (DECL_INNERMOST_TEMPLATE_PARMS (NODE)) +/* For function, method, class-data templates. + + FIXME: CONST_CAST_TREE is a hack that hopefully will go away after + tree is converted to C++ class hiearchy. */ +#define DECL_TEMPLATE_RESULT(NODE) \ + ((struct tree_template_decl *)CONST_CAST_TREE(TEMPLATE_DECL_CHECK (NODE)))->result +/* For a function template at namespace scope, DECL_TEMPLATE_INSTANTIATIONS + lists all instantiations and specializations of the function so that + tsubst_friend_function can reassign them to another template if we find + that the namespace-scope template is really a partial instantiation of a + friend template. + + For a class template the DECL_TEMPLATE_INSTANTIATIONS lists holds + all instantiations and specializations of the class type, including + partial instantiations and partial specializations, so that if we + explicitly specialize a partial instantiation we can walk the list + in maybe_process_partial_specialization and reassign them or complain + as appropriate. + + In both cases, the TREE_PURPOSE of each node contains the arguments + used; the TREE_VALUE contains the generated variable. The template + arguments are always complete. For example, given: + + template struct S1 { + template struct S2 {}; + template struct S2 {}; + }; + + the record for the partial specialization will contain, as its + argument list, { {T}, {U*} }, and will be on the + DECL_TEMPLATE_INSTANTIATIONS list for `template template + struct S1::S2'. + + This list is not used for other templates. */ +#define DECL_TEMPLATE_INSTANTIATIONS(NODE) \ + DECL_SIZE_UNIT (TEMPLATE_DECL_CHECK (NODE)) + +/* For a class template, this list contains the partial + specializations of this template. (Full specializations are not + recorded on this list.) The TREE_PURPOSE holds the arguments used + in the partial specialization (e.g., for `template struct + S' this will be `T*, int'.) The arguments will also include + any outer template arguments. The TREE_VALUE holds the TEMPLATE_DECL + for the partial specialization. The TREE_TYPE is the _TYPE node for + the partial specialization. + + This list is not used for other templates. */ +#define DECL_TEMPLATE_SPECIALIZATIONS(NODE) \ + DECL_SIZE (TEMPLATE_DECL_CHECK (NODE)) + +/* Nonzero for a DECL which is actually a template parameter. Keep + these checks in ascending tree code order. */ +#define DECL_TEMPLATE_PARM_P(NODE) \ + (DECL_LANG_FLAG_0 (NODE) \ + && (TREE_CODE (NODE) == CONST_DECL \ + || TREE_CODE (NODE) == PARM_DECL \ + || TREE_CODE (NODE) == TYPE_DECL \ + || TREE_CODE (NODE) == TEMPLATE_DECL)) + +/* Mark NODE as a template parameter. */ +#define SET_DECL_TEMPLATE_PARM_P(NODE) \ + (DECL_LANG_FLAG_0 (NODE) = 1) + +/* Nonzero if NODE is a template template parameter. */ +#define DECL_TEMPLATE_TEMPLATE_PARM_P(NODE) \ + (TREE_CODE (NODE) == TEMPLATE_DECL && DECL_TEMPLATE_PARM_P (NODE)) + +/* Nonzero for a DECL that represents a function template. */ +#define DECL_FUNCTION_TEMPLATE_P(NODE) \ + (TREE_CODE (NODE) == TEMPLATE_DECL \ + && DECL_TEMPLATE_RESULT (NODE) != NULL_TREE \ + && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == FUNCTION_DECL) + +/* Nonzero for a DECL that represents a class template or alias + template. */ +#define DECL_TYPE_TEMPLATE_P(NODE) \ + (TREE_CODE (NODE) == TEMPLATE_DECL \ + && DECL_TEMPLATE_RESULT (NODE) != NULL_TREE \ + && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == TYPE_DECL) + +/* Nonzero for a DECL that represents a class template. */ +#define DECL_CLASS_TEMPLATE_P(NODE) \ + (DECL_TYPE_TEMPLATE_P (NODE) \ + && DECL_IMPLICIT_TYPEDEF_P (DECL_TEMPLATE_RESULT (NODE))) + +/* Nonzero for a TEMPLATE_DECL that represents an alias template. */ +#define DECL_ALIAS_TEMPLATE_P(NODE) \ + (DECL_TYPE_TEMPLATE_P (NODE) \ + && !DECL_ARTIFICIAL (DECL_TEMPLATE_RESULT (NODE))) + +/* Nonzero for a NODE which declares a type. */ +#define DECL_DECLARES_TYPE_P(NODE) \ + (TREE_CODE (NODE) == TYPE_DECL || DECL_TYPE_TEMPLATE_P (NODE)) + +/* Nonzero if NODE declares a function. */ +#define DECL_DECLARES_FUNCTION_P(NODE) \ + (TREE_CODE (NODE) == FUNCTION_DECL || DECL_FUNCTION_TEMPLATE_P (NODE)) + +/* Nonzero if NODE is the typedef implicitly generated for a type when + the type is declared. In C++, `struct S {};' is roughly + equivalent to `struct S {}; typedef struct S S;' in C. + DECL_IMPLICIT_TYPEDEF_P will hold for the typedef indicated in this + example. In C++, there is a second implicit typedef for each + class, called the injected-class-name, in the scope of `S' itself, so that + you can say `S::S'. DECL_SELF_REFERENCE_P will hold for that typedef. */ +#define DECL_IMPLICIT_TYPEDEF_P(NODE) \ + (TREE_CODE (NODE) == TYPE_DECL && DECL_LANG_FLAG_2 (NODE)) +#define SET_DECL_IMPLICIT_TYPEDEF_P(NODE) \ + (DECL_LANG_FLAG_2 (NODE) = 1) +#define DECL_SELF_REFERENCE_P(NODE) \ + (TREE_CODE (NODE) == TYPE_DECL && DECL_LANG_FLAG_4 (NODE)) +#define SET_DECL_SELF_REFERENCE_P(NODE) \ + (DECL_LANG_FLAG_4 (NODE) = 1) + +/* A `primary' template is one that has its own template header and is not + a partial specialization. A member function of a class template is a + template, but not primary. A member template is primary. Friend + templates are primary, too. */ + +/* Returns the primary template corresponding to these parameters. */ +#define DECL_PRIMARY_TEMPLATE(NODE) \ + (TREE_TYPE (DECL_INNERMOST_TEMPLATE_PARMS (NODE))) + +/* Returns nonzero if NODE is a primary template. */ +#define PRIMARY_TEMPLATE_P(NODE) (DECL_PRIMARY_TEMPLATE (NODE) == (NODE)) + +/* Nonzero iff NODE is a specialization of a template. The value + indicates the type of specializations: + + 1=implicit instantiation + + 2=partial or explicit specialization, e.g.: + + template <> int min (int, int), + + 3=explicit instantiation, e.g.: + + template int min (int, int); + + Note that NODE will be marked as a specialization even if the + template it is instantiating is not a primary template. For + example, given: + + template struct O { + void f(); + struct I {}; + }; + + both O::f and O::I will be marked as instantiations. + + If DECL_USE_TEMPLATE is nonzero, then DECL_TEMPLATE_INFO will also + be non-NULL. */ +#define DECL_USE_TEMPLATE(NODE) (DECL_LANG_SPECIFIC (NODE)->u.base.use_template) + +/* Like DECL_USE_TEMPLATE, but for class types. */ +#define CLASSTYPE_USE_TEMPLATE(NODE) \ + (LANG_TYPE_CLASS_CHECK (NODE)->use_template) + +/* True if NODE is a specialization of a primary template. */ +#define CLASSTYPE_SPECIALIZATION_OF_PRIMARY_TEMPLATE_P(NODE) \ + (CLASS_TYPE_P (NODE) \ + && CLASSTYPE_USE_TEMPLATE (NODE) \ + && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE))) + +#define DECL_TEMPLATE_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) & 1) +#define CLASSTYPE_TEMPLATE_INSTANTIATION(NODE) \ + (CLASSTYPE_USE_TEMPLATE (NODE) & 1) + +#define DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) == 2) +#define SET_DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) = 2) + +/* Returns true for an explicit or partial specialization of a class + template. */ +#define CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \ + (CLASSTYPE_USE_TEMPLATE (NODE) == 2) +#define SET_CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \ + (CLASSTYPE_USE_TEMPLATE (NODE) = 2) + +#define DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 1) +#define SET_DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 1) +#define CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \ + (CLASSTYPE_USE_TEMPLATE (NODE) == 1) +#define SET_CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \ + (CLASSTYPE_USE_TEMPLATE (NODE) = 1) + +#define DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 3) +#define SET_DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 3) +#define CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \ + (CLASSTYPE_USE_TEMPLATE (NODE) == 3) +#define SET_CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \ + (CLASSTYPE_USE_TEMPLATE (NODE) = 3) + +/* Nonzero if DECL is a friend function which is an instantiation + from the point of view of the compiler, but not from the point of + view of the language. For example given: + template struct S { friend void f(T) {}; }; + the declaration of `void f(int)' generated when S is + instantiated will not be a DECL_TEMPLATE_INSTANTIATION, but will be + a DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION. */ +#define DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION(DECL) \ + (DECL_LANG_SPECIFIC (DECL) && DECL_TEMPLATE_INFO (DECL) \ + && !DECL_USE_TEMPLATE (DECL)) + +/* Nonzero if DECL is a function generated from a function 'temploid', + i.e. template, member of class template, or dependent friend. */ +#define DECL_TEMPLOID_INSTANTIATION(DECL) \ + (DECL_TEMPLATE_INSTANTIATION (DECL) \ + || DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (DECL)) + +/* Nonzero if DECL is either defined implicitly by the compiler or + generated from a temploid. */ +#define DECL_GENERATED_P(DECL) \ + (DECL_TEMPLOID_INSTANTIATION (DECL) || DECL_DEFAULTED_FN (DECL)) + +/* Nonzero iff we are currently processing a declaration for an + entity with its own template parameter list, and which is not a + full specialization. */ +#define PROCESSING_REAL_TEMPLATE_DECL_P() \ + (processing_template_decl > template_class_depth (current_scope ())) + +/* Nonzero if this VAR_DECL or FUNCTION_DECL has already been + instantiated, i.e. its definition has been generated from the + pattern given in the template. */ +#define DECL_TEMPLATE_INSTANTIATED(NODE) \ + DECL_LANG_FLAG_1 (VAR_OR_FUNCTION_DECL_CHECK (NODE)) + +/* We know what we're doing with this decl now. */ +#define DECL_INTERFACE_KNOWN(NODE) DECL_LANG_FLAG_5 (NODE) + +/* DECL_EXTERNAL must be set on a decl until the decl is actually emitted, + so that assemble_external will work properly. So we have this flag to + tell us whether the decl is really not external. + + This flag does not indicate whether or not the decl is defined in the + current translation unit; it indicates whether or not we should emit the + decl at the end of compilation if it is defined and needed. */ +#define DECL_NOT_REALLY_EXTERN(NODE) \ + (DECL_LANG_SPECIFIC (NODE)->u.base.not_really_extern) + +#define DECL_REALLY_EXTERN(NODE) \ + (DECL_EXTERNAL (NODE) \ + && (!DECL_LANG_SPECIFIC (NODE) || !DECL_NOT_REALLY_EXTERN (NODE))) + +/* A thunk is a stub function. + + A thunk is an alternate entry point for an ordinary FUNCTION_DECL. + The address of the ordinary FUNCTION_DECL is given by the + DECL_INITIAL, which is always an ADDR_EXPR whose operand is a + FUNCTION_DECL. The job of the thunk is to either adjust the this + pointer before transferring control to the FUNCTION_DECL, or call + FUNCTION_DECL and then adjust the result value. Note, the result + pointer adjusting thunk must perform a call to the thunked + function, (or be implemented via passing some invisible parameter + to the thunked function, which is modified to perform the + adjustment just before returning). + + A thunk may perform either, or both, of the following operations: + + o Adjust the this or result pointer by a constant offset. + o Adjust the this or result pointer by looking up a vcall or vbase offset + in the vtable. + + A this pointer adjusting thunk converts from a base to a derived + class, and hence adds the offsets. A result pointer adjusting thunk + converts from a derived class to a base, and hence subtracts the + offsets. If both operations are performed, then the constant + adjustment is performed first for this pointer adjustment and last + for the result pointer adjustment. + + The constant adjustment is given by THUNK_FIXED_OFFSET. If the + vcall or vbase offset is required, THUNK_VIRTUAL_OFFSET is + used. For this pointer adjusting thunks, it is the vcall offset + into the vtable. For result pointer adjusting thunks it is the + binfo of the virtual base to convert to. Use that binfo's vbase + offset. + + It is possible to have equivalent covariant thunks. These are + distinct virtual covariant thunks whose vbase offsets happen to + have the same value. THUNK_ALIAS is used to pick one as the + canonical thunk, which will get all the this pointer adjusting + thunks attached to it. */ + +/* An integer indicating how many bytes should be subtracted from the + this or result pointer when this function is called. */ +#define THUNK_FIXED_OFFSET(DECL) \ + (DECL_LANG_SPECIFIC (THUNK_FUNCTION_CHECK (DECL))->u.fn.u5.fixed_offset) + +/* A tree indicating how to perform the virtual adjustment. For a this + adjusting thunk it is the number of bytes to be added to the vtable + to find the vcall offset. For a result adjusting thunk, it is the + binfo of the relevant virtual base. If NULL, then there is no + virtual adjust. (The vptr is always located at offset zero from + the this or result pointer.) (If the covariant type is within the + class hierarchy being laid out, the vbase index is not yet known + at the point we need to create the thunks, hence the need to use + binfos.) */ + +#define THUNK_VIRTUAL_OFFSET(DECL) \ + (LANG_DECL_U2_CHECK (FUNCTION_DECL_CHECK (DECL), 0)->access) + +/* A thunk which is equivalent to another thunk. */ +#define THUNK_ALIAS(DECL) \ + (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (DECL))->u.min.template_info) + +/* For thunk NODE, this is the FUNCTION_DECL thunked to. It is + possible for the target to be a thunk too. */ +#define THUNK_TARGET(NODE) \ + (LANG_DECL_FN_CHECK (NODE)->befriending_classes) + +/* True for a SCOPE_REF iff the "template" keyword was used to + indicate that the qualified name denotes a template. */ +#define QUALIFIED_NAME_IS_TEMPLATE(NODE) \ + (TREE_LANG_FLAG_1 (SCOPE_REF_CHECK (NODE))) + +/* True for an OMP_ATOMIC that has dependent parameters. These are stored + as an expr in operand 1, and integer_zero_node in operand 0. */ +#define OMP_ATOMIC_DEPENDENT_P(NODE) \ + (TREE_CODE (TREE_OPERAND (OMP_ATOMIC_CHECK (NODE), 0)) == INTEGER_CST) + +/* Used while gimplifying continue statements bound to OMP_FOR nodes. */ +#define OMP_FOR_GIMPLIFYING_P(NODE) \ + (TREE_LANG_FLAG_0 (OMP_LOOP_CHECK (NODE))) + +/* A language-specific token attached to the OpenMP data clauses to + hold code (or code fragments) related to ctors, dtors, and op=. + See semantics.c for details. */ +#define CP_OMP_CLAUSE_INFO(NODE) \ + TREE_TYPE (OMP_CLAUSE_RANGE_CHECK (NODE, OMP_CLAUSE_PRIVATE, \ + OMP_CLAUSE_LINEAR)) + +/* Nonzero if this transaction expression's body contains statements. */ +#define TRANSACTION_EXPR_IS_STMT(NODE) \ + TREE_LANG_FLAG_0 (TRANSACTION_EXPR_CHECK (NODE)) + +/* These macros provide convenient access to the various _STMT nodes + created when parsing template declarations. */ +#define TRY_STMTS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 0) +#define TRY_HANDLERS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 1) + +#define EH_SPEC_STMTS(NODE) TREE_OPERAND (EH_SPEC_BLOCK_CHECK (NODE), 0) +#define EH_SPEC_RAISES(NODE) TREE_OPERAND (EH_SPEC_BLOCK_CHECK (NODE), 1) + +#define USING_STMT_NAMESPACE(NODE) TREE_OPERAND (USING_STMT_CHECK (NODE), 0) + +/* Nonzero if this try block is a function try block. */ +#define FN_TRY_BLOCK_P(NODE) TREE_LANG_FLAG_3 (TRY_BLOCK_CHECK (NODE)) +#define HANDLER_PARMS(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 0) +#define HANDLER_BODY(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 1) +#define HANDLER_TYPE(NODE) TREE_TYPE (HANDLER_CHECK (NODE)) + +/* CLEANUP_STMT accessors. The statement(s) covered, the cleanup to run + and the VAR_DECL for which this cleanup exists. */ +#define CLEANUP_BODY(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 0) +#define CLEANUP_EXPR(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 1) +#define CLEANUP_DECL(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 2) + +/* IF_STMT accessors. These give access to the condition of the if + statement, the then block of the if statement, and the else block + of the if statement if it exists. */ +#define IF_COND(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 0) +#define THEN_CLAUSE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 1) +#define ELSE_CLAUSE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 2) +#define IF_SCOPE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 3) +#define IF_STMT_CONSTEXPR_P(NODE) TREE_LANG_FLAG_0 (IF_STMT_CHECK (NODE)) + +/* WHILE_STMT accessors. These give access to the condition of the + while statement and the body of the while statement, respectively. */ +#define WHILE_COND(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 0) +#define WHILE_BODY(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 1) + +/* DO_STMT accessors. These give access to the condition of the do + statement and the body of the do statement, respectively. */ +#define DO_COND(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 0) +#define DO_BODY(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 1) + +/* FOR_STMT accessors. These give access to the init statement, + condition, update expression, and body of the for statement, + respectively. */ +#define FOR_INIT_STMT(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 0) +#define FOR_COND(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 1) +#define FOR_EXPR(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 2) +#define FOR_BODY(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 3) +#define FOR_SCOPE(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 4) + +/* RANGE_FOR_STMT accessors. These give access to the declarator, + expression, body, and scope of the statement, respectively. */ +#define RANGE_FOR_DECL(NODE) TREE_OPERAND (RANGE_FOR_STMT_CHECK (NODE), 0) +#define RANGE_FOR_EXPR(NODE) TREE_OPERAND (RANGE_FOR_STMT_CHECK (NODE), 1) +#define RANGE_FOR_BODY(NODE) TREE_OPERAND (RANGE_FOR_STMT_CHECK (NODE), 2) +#define RANGE_FOR_SCOPE(NODE) TREE_OPERAND (RANGE_FOR_STMT_CHECK (NODE), 3) +#define RANGE_FOR_IVDEP(NODE) TREE_LANG_FLAG_6 (RANGE_FOR_STMT_CHECK (NODE)) + +#define SWITCH_STMT_COND(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 0) +#define SWITCH_STMT_BODY(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 1) +#define SWITCH_STMT_TYPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2) +#define SWITCH_STMT_SCOPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 3) + +/* STMT_EXPR accessor. */ +#define STMT_EXPR_STMT(NODE) TREE_OPERAND (STMT_EXPR_CHECK (NODE), 0) + +/* EXPR_STMT accessor. This gives the expression associated with an + expression statement. */ +#define EXPR_STMT_EXPR(NODE) TREE_OPERAND (EXPR_STMT_CHECK (NODE), 0) + +/* True if this TARGET_EXPR was created by build_cplus_new, and so we can + discard it if it isn't useful. */ +#define TARGET_EXPR_IMPLICIT_P(NODE) \ + TREE_LANG_FLAG_0 (TARGET_EXPR_CHECK (NODE)) + +/* True if this TARGET_EXPR is the result of list-initialization of a + temporary. */ +#define TARGET_EXPR_LIST_INIT_P(NODE) \ + TREE_LANG_FLAG_1 (TARGET_EXPR_CHECK (NODE)) + +/* True if this TARGET_EXPR expresses direct-initialization of an object + to be named later. */ +#define TARGET_EXPR_DIRECT_INIT_P(NODE) \ + TREE_LANG_FLAG_2 (TARGET_EXPR_CHECK (NODE)) + +/* True if NODE is a TARGET_EXPR that just expresses a copy of its INITIAL; if + the initializer has void type, it's doing something more complicated. */ +#define SIMPLE_TARGET_EXPR_P(NODE) \ + (TREE_CODE (NODE) == TARGET_EXPR \ + && !VOID_TYPE_P (TREE_TYPE (TARGET_EXPR_INITIAL (NODE)))) + +/* True if EXPR expresses direct-initialization of a TYPE. */ +#define DIRECT_INIT_EXPR_P(TYPE,EXPR) \ + (TREE_CODE (EXPR) == TARGET_EXPR && TREE_LANG_FLAG_2 (EXPR) \ + && same_type_ignoring_top_level_qualifiers_p (TYPE, TREE_TYPE (EXPR))) + +/* True if this CONVERT_EXPR is for a conversion to virtual base in + an NSDMI, and should be re-evaluated when used in a constructor. */ +#define CONVERT_EXPR_VBASE_PATH(NODE) \ + TREE_LANG_FLAG_0 (CONVERT_EXPR_CHECK (NODE)) + +/* True if SIZEOF_EXPR argument is type. */ +#define SIZEOF_EXPR_TYPE_P(NODE) \ + TREE_LANG_FLAG_0 (SIZEOF_EXPR_CHECK (NODE)) + +/* An enumeration of the kind of tags that C++ accepts. */ +enum tag_types { + none_type = 0, /* Not a tag type. */ + record_type, /* "struct" types. */ + class_type, /* "class" types. */ + union_type, /* "union" types. */ + enum_type, /* "enum" types. */ + typename_type, /* "typename" types. */ + scope_type /* namespace or tagged type name followed by :: */ +}; + +/* The various kinds of lvalues we distinguish. */ +enum cp_lvalue_kind_flags { + clk_none = 0, /* Things that are not an lvalue. */ + clk_ordinary = 1, /* An ordinary lvalue. */ + clk_rvalueref = 2,/* An xvalue (rvalue formed using an rvalue reference) */ + clk_class = 4, /* A prvalue of class or array type. */ + clk_bitfield = 8, /* An lvalue for a bit-field. */ + clk_packed = 16 /* An lvalue for a packed field. */ +}; + +/* This type is used for parameters and variables which hold + combinations of the flags in enum cp_lvalue_kind_flags. */ +typedef int cp_lvalue_kind; + +/* Various kinds of template specialization, instantiation, etc. */ +enum tmpl_spec_kind { + tsk_none, /* Not a template at all. */ + tsk_invalid_member_spec, /* An explicit member template + specialization, but the enclosing + classes have not all been explicitly + specialized. */ + tsk_invalid_expl_inst, /* An explicit instantiation containing + template parameter lists. */ + tsk_excessive_parms, /* A template declaration with too many + template parameter lists. */ + tsk_insufficient_parms, /* A template declaration with too few + parameter lists. */ + tsk_template, /* A template declaration. */ + tsk_expl_spec, /* An explicit specialization. */ + tsk_expl_inst /* An explicit instantiation. */ +}; + +/* The various kinds of access. BINFO_ACCESS depends on these being + two bit quantities. The numerical values are important; they are + used to initialize RTTI data structures, so changing them changes + the ABI. */ +enum access_kind { + ak_none = 0, /* Inaccessible. */ + ak_public = 1, /* Accessible, as a `public' thing. */ + ak_protected = 2, /* Accessible, as a `protected' thing. */ + ak_private = 3 /* Accessible, as a `private' thing. */ +}; + +/* The various kinds of special functions. If you add to this list, + you should update special_function_p as well. */ +enum special_function_kind { + sfk_none = 0, /* Not a special function. This enumeral + must have value zero; see + special_function_p. */ + sfk_constructor, /* A constructor. */ + sfk_copy_constructor, /* A copy constructor. */ + sfk_move_constructor, /* A move constructor. */ + sfk_copy_assignment, /* A copy assignment operator. */ + sfk_move_assignment, /* A move assignment operator. */ + sfk_destructor, /* A destructor. */ + sfk_complete_destructor, /* A destructor for complete objects. */ + sfk_base_destructor, /* A destructor for base subobjects. */ + sfk_deleting_destructor, /* A destructor for complete objects that + deletes the object after it has been + destroyed. */ + sfk_conversion, /* A conversion operator. */ + sfk_deduction_guide, /* A class template deduction guide. */ + sfk_inheriting_constructor /* An inheriting constructor */ +}; + +/* The various kinds of linkage. From [basic.link], + + A name is said to have linkage when it might denote the same + object, reference, function, type, template, namespace or value + as a name introduced in another scope: + + -- When a name has external linkage, the entity it denotes can + be referred to from scopes of other translation units or from + other scopes of the same translation unit. + + -- When a name has internal linkage, the entity it denotes can + be referred to by names from other scopes in the same + translation unit. + + -- When a name has no linkage, the entity it denotes cannot be + referred to by names from other scopes. */ + +enum linkage_kind { + lk_none, /* No linkage. */ + lk_internal, /* Internal linkage. */ + lk_external /* External linkage. */ +}; + +enum duration_kind { + dk_static, + dk_thread, + dk_auto, + dk_dynamic +}; + +/* Bitmask flags to control type substitution. */ +enum tsubst_flags { + tf_none = 0, /* nothing special */ + tf_error = 1 << 0, /* give error messages */ + tf_warning = 1 << 1, /* give warnings too */ + tf_ignore_bad_quals = 1 << 2, /* ignore bad cvr qualifiers */ + tf_keep_type_decl = 1 << 3, /* retain typedef type decls + (make_typename_type use) */ + tf_ptrmem_ok = 1 << 4, /* pointers to member ok (internal + instantiate_type use) */ + tf_user = 1 << 5, /* found template must be a user template + (lookup_template_class use) */ + tf_conv = 1 << 6, /* We are determining what kind of + conversion might be permissible, + not actually performing the + conversion. */ + tf_decltype = 1 << 7, /* We are the operand of decltype. + Used to implement the special rules + for calls in decltype (5.2.2/11). */ + tf_partial = 1 << 8, /* Doing initial explicit argument + substitution in fn_type_unification. */ + tf_fndecl_type = 1 << 9, /* Substituting the type of a function + declaration. */ + tf_no_cleanup = 1 << 10, /* Do not build a cleanup + (build_target_expr and friends) */ + /* Convenient substitution flags combinations. */ + tf_warning_or_error = tf_warning | tf_error +}; + +/* This type is used for parameters and variables which hold + combinations of the flags in enum tsubst_flags. */ +typedef int tsubst_flags_t; + +/* The kind of checking we can do looking in a class hierarchy. */ +enum base_access_flags { + ba_any = 0, /* Do not check access, allow an ambiguous base, + prefer a non-virtual base */ + ba_unique = 1 << 0, /* Must be a unique base. */ + ba_check_bit = 1 << 1, /* Check access. */ + ba_check = ba_unique | ba_check_bit, + ba_ignore_scope = 1 << 2 /* Ignore access allowed by local scope. */ +}; + +/* This type is used for parameters and variables which hold + combinations of the flags in enum base_access_flags. */ +typedef int base_access; + +/* The various kinds of access check during parsing. */ +enum deferring_kind { + dk_no_deferred = 0, /* Check access immediately */ + dk_deferred = 1, /* Deferred check */ + dk_no_check = 2 /* No access check */ +}; + +/* The kind of base we can find, looking in a class hierarchy. + Values <0 indicate we failed. */ +enum base_kind { + bk_inaccessible = -3, /* The base is inaccessible */ + bk_ambig = -2, /* The base is ambiguous */ + bk_not_base = -1, /* It is not a base */ + bk_same_type = 0, /* It is the same type */ + bk_proper_base = 1, /* It is a proper base */ + bk_via_virtual = 2 /* It is a proper base, but via a virtual + path. This might not be the canonical + binfo. */ +}; + +/* Node for "pointer to (virtual) function". + This may be distinct from ptr_type_node so gdb can distinguish them. */ +#define vfunc_ptr_type_node vtable_entry_type + + +/* For building calls to `delete'. */ +extern GTY(()) tree integer_two_node; + +/* The number of function bodies which we are currently processing. + (Zero if we are at namespace scope, one inside the body of a + function, two inside the body of a function in a local class, etc.) */ +extern int function_depth; + +/* Nonzero if we are inside eq_specializations, which affects comparison of + PARM_DECLs in cp_tree_equal. */ +extern int comparing_specializations; + +/* In parser.c. */ + +/* Nonzero if we are parsing an unevaluated operand: an operand to + sizeof, typeof, or alignof. This is a count since operands to + sizeof can be nested. */ + +extern int cp_unevaluated_operand; + +/* RAII class used to inhibit the evaluation of operands during parsing + and template instantiation. Evaluation warnings are also inhibited. */ + +struct cp_unevaluated +{ + cp_unevaluated (); + ~cp_unevaluated (); +}; + +/* in pt.c */ + +/* These values are used for the `STRICT' parameter to type_unification and + fn_type_unification. Their meanings are described with the + documentation for fn_type_unification. */ + +enum unification_kind_t { + DEDUCE_CALL, + DEDUCE_CONV, + DEDUCE_EXACT +}; + +// An RAII class used to create a new pointer map for local +// specializations. When the stack goes out of scope, the +// previous pointer map is restored. +struct local_specialization_stack +{ + local_specialization_stack (); + ~local_specialization_stack (); + + hash_map *saved; +}; + +/* in class.c */ + +extern int current_class_depth; + +/* An array of all local classes present in this translation unit, in + declaration order. */ +extern GTY(()) vec *local_classes; + +/* Here's where we control how name mangling takes place. */ + +/* Cannot use '$' up front, because this confuses gdb + (names beginning with '$' are gdb-local identifiers). + + Note that all forms in which the '$' is significant are long enough + for direct indexing (meaning that if we know there is a '$' + at a particular location, we can index into the string at + any other location that provides distinguishing characters). */ + +/* Define NO_DOT_IN_LABEL in your favorite tm file if your assembler + doesn't allow '.' in symbol names. */ +#ifndef NO_DOT_IN_LABEL + +#define JOINER '.' + +#define AUTO_TEMP_NAME "_.tmp_" +#define VFIELD_BASE ".vf" +#define VFIELD_NAME "_vptr." +#define VFIELD_NAME_FORMAT "_vptr.%s" + +#else /* NO_DOT_IN_LABEL */ + +#ifndef NO_DOLLAR_IN_LABEL + +#define JOINER '$' + +#define AUTO_TEMP_NAME "_$tmp_" +#define VFIELD_BASE "$vf" +#define VFIELD_NAME "_vptr$" +#define VFIELD_NAME_FORMAT "_vptr$%s" + +#else /* NO_DOLLAR_IN_LABEL */ + +#define AUTO_TEMP_NAME "__tmp_" +#define TEMP_NAME_P(ID_NODE) \ + (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, \ + sizeof (AUTO_TEMP_NAME) - 1)) +#define VTABLE_NAME "__vt_" +#define VTABLE_NAME_P(ID_NODE) \ + (!strncmp (IDENTIFIER_POINTER (ID_NODE), VTABLE_NAME, \ + sizeof (VTABLE_NAME) - 1)) +#define VFIELD_BASE "__vfb" +#define VFIELD_NAME "__vptr_" +#define VFIELD_NAME_P(ID_NODE) \ + (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, \ + sizeof (VFIELD_NAME) - 1)) +#define VFIELD_NAME_FORMAT "__vptr_%s" + +#endif /* NO_DOLLAR_IN_LABEL */ +#endif /* NO_DOT_IN_LABEL */ + +#define THIS_NAME "this" + +#define IN_CHARGE_NAME "__in_chrg" + +#define VTBL_PTR_TYPE "__vtbl_ptr_type" +#define VTABLE_DELTA_NAME "__delta" +#define VTABLE_PFN_NAME "__pfn" + +#define LAMBDANAME_PREFIX "__lambda" +#define LAMBDANAME_FORMAT LAMBDANAME_PREFIX "%d" + +#define UDLIT_OP_ANSI_PREFIX "operator\"\"" +#define UDLIT_OP_ANSI_FORMAT UDLIT_OP_ANSI_PREFIX "%s" +#define UDLIT_OP_MANGLED_PREFIX "li" +#define UDLIT_OP_MANGLED_FORMAT UDLIT_OP_MANGLED_PREFIX "%s" +#define UDLIT_OPER_P(ID_NODE) \ + (!strncmp (IDENTIFIER_POINTER (ID_NODE), \ + UDLIT_OP_ANSI_PREFIX, \ + sizeof (UDLIT_OP_ANSI_PREFIX) - 1)) +#define UDLIT_OP_SUFFIX(ID_NODE) \ + (IDENTIFIER_POINTER (ID_NODE) + sizeof (UDLIT_OP_ANSI_PREFIX) - 1) + +#if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) + +#define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \ + && IDENTIFIER_POINTER (ID_NODE)[2] == 't' \ + && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER) + +#define TEMP_NAME_P(ID_NODE) \ + (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1)) +#define VFIELD_NAME_P(ID_NODE) \ + (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1)) + +#endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */ + + +/* Nonzero if we're done parsing and into end-of-file activities. + Two if we're done with front-end processing. */ + +extern int at_eof; + +/* True if note_mangling_alias should enqueue mangling aliases for + later generation, rather than emitting them right away. */ + +extern bool defer_mangling_aliases; + +/* True if noexcept is part of the type (i.e. in C++17). */ + +extern bool flag_noexcept_type; + +/* A list of namespace-scope objects which have constructors or + destructors which reside in the global scope. The decl is stored + in the TREE_VALUE slot and the initializer is stored in the + TREE_PURPOSE slot. */ +extern GTY(()) tree static_aggregates; +/* Likewise, for thread local storage. */ +extern GTY(()) tree tls_aggregates; + +enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, TYPENAME_FLAG }; + +/* These are uses as bits in flags passed to various functions to + control their behavior. Despite the LOOKUP_ prefix, many of these + do not control name lookup. ??? Functions using these flags should + probably be modified to accept explicit boolean flags for the + behaviors relevant to them. */ +/* Check for access violations. */ +#define LOOKUP_PROTECT (1 << 0) +#define LOOKUP_NORMAL (LOOKUP_PROTECT) +/* Even if the function found by lookup is a virtual function, it + should be called directly. */ +#define LOOKUP_NONVIRTUAL (1 << 1) +/* Non-converting (i.e., "explicit") constructors are not tried. This flag + indicates that we are not performing direct-initialization. */ +#define LOOKUP_ONLYCONVERTING (1 << 2) +#define LOOKUP_IMPLICIT (LOOKUP_NORMAL | LOOKUP_ONLYCONVERTING) +/* If a temporary is created, it should be created so that it lives + as long as the current variable bindings; otherwise it only lives + until the end of the complete-expression. It also forces + direct-initialization in cases where other parts of the compiler + have already generated a temporary, such as reference + initialization and the catch parameter. */ +#define DIRECT_BIND (1 << 3) +/* We're performing a user-defined conversion, so more user-defined + conversions are not permitted (only built-in conversions). */ +#define LOOKUP_NO_CONVERSION (1 << 4) +/* The user has explicitly called a destructor. (Therefore, we do + not need to check that the object is non-NULL before calling the + destructor.) */ +#define LOOKUP_DESTRUCTOR (1 << 5) +/* Do not permit references to bind to temporaries. */ +#define LOOKUP_NO_TEMP_BIND (1 << 6) +/* Do not accept objects, and possibly namespaces. */ +#define LOOKUP_PREFER_TYPES (1 << 7) +/* Do not accept objects, and possibly types. */ +#define LOOKUP_PREFER_NAMESPACES (1 << 8) +/* Accept types or namespaces. */ +#define LOOKUP_PREFER_BOTH (LOOKUP_PREFER_TYPES | LOOKUP_PREFER_NAMESPACES) +/* Return friend declarations and un-declared builtin functions. + (Normally, these entities are registered in the symbol table, but + not found by lookup.) */ +#define LOOKUP_HIDDEN (LOOKUP_PREFER_NAMESPACES << 1) +/* Prefer that the lvalue be treated as an rvalue. */ +#define LOOKUP_PREFER_RVALUE (LOOKUP_HIDDEN << 1) +/* We're inside an init-list, so narrowing conversions are ill-formed. */ +#define LOOKUP_NO_NARROWING (LOOKUP_PREFER_RVALUE << 1) +/* We're looking up a constructor for list-initialization. */ +#define LOOKUP_LIST_INIT_CTOR (LOOKUP_NO_NARROWING << 1) +/* This is the first parameter of a copy constructor. */ +#define LOOKUP_COPY_PARM (LOOKUP_LIST_INIT_CTOR << 1) +/* We only want to consider list constructors. */ +#define LOOKUP_LIST_ONLY (LOOKUP_COPY_PARM << 1) +/* Return after determining which function to call and checking access. + Used by sythesized_method_walk to determine which functions will + be called to initialize subobjects, in order to determine exception + specification and possible implicit delete. + This is kind of a hack, but exiting early avoids problems with trying + to perform argument conversions when the class isn't complete yet. */ +#define LOOKUP_SPECULATIVE (LOOKUP_LIST_ONLY << 1) +/* Used by calls from defaulted functions to limit the overload set to avoid + cycles trying to declare them (core issue 1092). */ +#define LOOKUP_DEFAULTED (LOOKUP_SPECULATIVE << 1) +/* Used in calls to store_init_value to suppress its usual call to + digest_init. */ +#define LOOKUP_ALREADY_DIGESTED (LOOKUP_DEFAULTED << 1) +/* An instantiation with explicit template arguments. */ +#define LOOKUP_EXPLICIT_TMPL_ARGS (LOOKUP_ALREADY_DIGESTED << 1) +/* Like LOOKUP_NO_TEMP_BIND, but also prevent binding to xvalues. */ +#define LOOKUP_NO_RVAL_BIND (LOOKUP_EXPLICIT_TMPL_ARGS << 1) +/* Used by case_conversion to disregard non-integral conversions. */ +#define LOOKUP_NO_NON_INTEGRAL (LOOKUP_NO_RVAL_BIND << 1) +/* Used for delegating constructors in order to diagnose self-delegation. */ +#define LOOKUP_DELEGATING_CONS (LOOKUP_NO_NON_INTEGRAL << 1) + +#define LOOKUP_NAMESPACES_ONLY(F) \ + (((F) & LOOKUP_PREFER_NAMESPACES) && !((F) & LOOKUP_PREFER_TYPES)) +#define LOOKUP_TYPES_ONLY(F) \ + (!((F) & LOOKUP_PREFER_NAMESPACES) && ((F) & LOOKUP_PREFER_TYPES)) +#define LOOKUP_QUALIFIERS_ONLY(F) ((F) & LOOKUP_PREFER_BOTH) + + +/* These flags are used by the conversion code. + CONV_IMPLICIT : Perform implicit conversions (standard and user-defined). + CONV_STATIC : Perform the explicit conversions for static_cast. + CONV_CONST : Perform the explicit conversions for const_cast. + CONV_REINTERPRET: Perform the explicit conversions for reinterpret_cast. + CONV_PRIVATE : Perform upcasts to private bases. + CONV_FORCE_TEMP : Require a new temporary when converting to the same + aggregate type. */ + +#define CONV_IMPLICIT 1 +#define CONV_STATIC 2 +#define CONV_CONST 4 +#define CONV_REINTERPRET 8 +#define CONV_PRIVATE 16 +/* #define CONV_NONCONVERTING 32 */ +#define CONV_FORCE_TEMP 64 +#define CONV_FOLD 128 +#define CONV_OLD_CONVERT (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \ + | CONV_REINTERPRET) +#define CONV_C_CAST (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \ + | CONV_REINTERPRET | CONV_PRIVATE | CONV_FORCE_TEMP) +#define CONV_BACKEND_CONVERT (CONV_OLD_CONVERT | CONV_FOLD) + +/* Used by build_expr_type_conversion to indicate which types are + acceptable as arguments to the expression under consideration. */ + +#define WANT_INT 1 /* integer types, including bool */ +#define WANT_FLOAT 2 /* floating point types */ +#define WANT_ENUM 4 /* enumerated types */ +#define WANT_POINTER 8 /* pointer types */ +#define WANT_NULL 16 /* null pointer constant */ +#define WANT_VECTOR_OR_COMPLEX 32 /* vector or complex types */ +#define WANT_ARITH (WANT_INT | WANT_FLOAT | WANT_VECTOR_OR_COMPLEX) + +/* Used with comptypes, and related functions, to guide type + comparison. */ + +#define COMPARE_STRICT 0 /* Just check if the types are the + same. */ +#define COMPARE_BASE 1 /* Check to see if the second type is + derived from the first. */ +#define COMPARE_DERIVED 2 /* Like COMPARE_BASE, but in + reverse. */ +#define COMPARE_REDECLARATION 4 /* The comparison is being done when + another declaration of an existing + entity is seen. */ +#define COMPARE_STRUCTURAL 8 /* The comparison is intended to be + structural. The actual comparison + will be identical to + COMPARE_STRICT. */ + +/* Used with push_overloaded_decl. */ +#define PUSH_GLOBAL 0 /* Push the DECL into namespace scope, + regardless of the current scope. */ +#define PUSH_LOCAL 1 /* Push the DECL into the current + scope. */ +#define PUSH_USING 2 /* We are pushing this DECL as the + result of a using declaration. */ + +/* Used with start function. */ +#define SF_DEFAULT 0 /* No flags. */ +#define SF_PRE_PARSED 1 /* The function declaration has + already been parsed. */ +#define SF_INCLASS_INLINE 2 /* The function is an inline, defined + in the class body. */ + +/* Used with start_decl's initialized parameter. */ +#define SD_UNINITIALIZED 0 +#define SD_INITIALIZED 1 +#define SD_DEFAULTED 2 +#define SD_DELETED 3 + +/* Returns nonzero iff TYPE1 and TYPE2 are the same type, or if TYPE2 + is derived from TYPE1, or if TYPE2 is a pointer (reference) to a + class derived from the type pointed to (referred to) by TYPE1. */ +#define same_or_base_type_p(TYPE1, TYPE2) \ + comptypes ((TYPE1), (TYPE2), COMPARE_BASE) + +/* These macros are used to access a TEMPLATE_PARM_INDEX. */ +#define TEMPLATE_PARM_INDEX_CAST(NODE) \ + ((template_parm_index*)TEMPLATE_PARM_INDEX_CHECK (NODE)) +#define TEMPLATE_PARM_IDX(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->index) +#define TEMPLATE_PARM_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->level) +#define TEMPLATE_PARM_DESCENDANTS(NODE) (TREE_CHAIN (NODE)) +#define TEMPLATE_PARM_ORIG_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->orig_level) +#define TEMPLATE_PARM_DECL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->decl) +#define TEMPLATE_PARM_PARAMETER_PACK(NODE) \ + (TREE_LANG_FLAG_0 (TEMPLATE_PARM_INDEX_CHECK (NODE))) + +/* These macros are for accessing the fields of TEMPLATE_TYPE_PARM, + TEMPLATE_TEMPLATE_PARM and BOUND_TEMPLATE_TEMPLATE_PARM nodes. */ +#define TEMPLATE_TYPE_PARM_INDEX(NODE) \ + (TYPE_VALUES_RAW (TREE_CHECK3 ((NODE), TEMPLATE_TYPE_PARM, \ + TEMPLATE_TEMPLATE_PARM, \ + BOUND_TEMPLATE_TEMPLATE_PARM))) +#define TEMPLATE_TYPE_IDX(NODE) \ + (TEMPLATE_PARM_IDX (TEMPLATE_TYPE_PARM_INDEX (NODE))) +#define TEMPLATE_TYPE_LEVEL(NODE) \ + (TEMPLATE_PARM_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE))) +#define TEMPLATE_TYPE_ORIG_LEVEL(NODE) \ + (TEMPLATE_PARM_ORIG_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE))) +#define TEMPLATE_TYPE_DECL(NODE) \ + (TEMPLATE_PARM_DECL (TEMPLATE_TYPE_PARM_INDEX (NODE))) +#define TEMPLATE_TYPE_PARAMETER_PACK(NODE) \ + (TEMPLATE_PARM_PARAMETER_PACK (TEMPLATE_TYPE_PARM_INDEX (NODE))) + +/* For a C++17 class deduction placeholder, the template it represents. */ +#define CLASS_PLACEHOLDER_TEMPLATE(NODE) \ + (DECL_INITIAL (TYPE_NAME (TEMPLATE_TYPE_PARM_CHECK (NODE)))) + +/* Contexts in which auto deduction occurs. These flags are + used to control diagnostics in do_auto_deduction. */ + +enum auto_deduction_context +{ + adc_unspecified, /* Not given */ + adc_variable_type, /* Variable initializer deduction */ + adc_return_type, /* Return type deduction */ + adc_unify, /* Template argument deduction */ + adc_requirement, /* Argument deduction constraint */ + adc_decomp_type /* Decomposition declaration initializer deduction */ +}; + +/* True if this type-parameter belongs to a class template, used by C++17 + class template argument deduction. */ +#define TEMPLATE_TYPE_PARM_FOR_CLASS(NODE) \ + (TREE_LANG_FLAG_0 (TEMPLATE_TYPE_PARM_CHECK (NODE))) + +/* True iff this TEMPLATE_TYPE_PARM represents decltype(auto). */ +#define AUTO_IS_DECLTYPE(NODE) \ + (TYPE_LANG_FLAG_5 (TEMPLATE_TYPE_PARM_CHECK (NODE))) + +/* These constants can used as bit flags in the process of tree formatting. + + TFF_PLAIN_IDENTIFIER: unqualified part of a name. + TFF_SCOPE: include the class and namespace scope of the name. + TFF_CHASE_TYPEDEF: print the original type-id instead of the typedef-name. + TFF_DECL_SPECIFIERS: print decl-specifiers. + TFF_CLASS_KEY_OR_ENUM: precede a class-type name (resp. enum name) with + a class-key (resp. `enum'). + TFF_RETURN_TYPE: include function return type. + TFF_FUNCTION_DEFAULT_ARGUMENTS: include function default parameter values. + TFF_EXCEPTION_SPECIFICATION: show function exception specification. + TFF_TEMPLATE_HEADER: show the template<...> header in a + template-declaration. + TFF_TEMPLATE_NAME: show only template-name. + TFF_EXPR_IN_PARENS: parenthesize expressions. + TFF_NO_FUNCTION_ARGUMENTS: don't show function arguments. + TFF_UNQUALIFIED_NAME: do not print the qualifying scope of the + top-level entity. + TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS: do not omit template arguments + identical to their defaults. + TFF_NO_TEMPLATE_BINDINGS: do not print information about the template + arguments for a function template specialization. + TFF_POINTER: we are printing a pointer type. */ + +#define TFF_PLAIN_IDENTIFIER (0) +#define TFF_SCOPE (1) +#define TFF_CHASE_TYPEDEF (1 << 1) +#define TFF_DECL_SPECIFIERS (1 << 2) +#define TFF_CLASS_KEY_OR_ENUM (1 << 3) +#define TFF_RETURN_TYPE (1 << 4) +#define TFF_FUNCTION_DEFAULT_ARGUMENTS (1 << 5) +#define TFF_EXCEPTION_SPECIFICATION (1 << 6) +#define TFF_TEMPLATE_HEADER (1 << 7) +#define TFF_TEMPLATE_NAME (1 << 8) +#define TFF_EXPR_IN_PARENS (1 << 9) +#define TFF_NO_FUNCTION_ARGUMENTS (1 << 10) +#define TFF_UNQUALIFIED_NAME (1 << 11) +#define TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS (1 << 12) +#define TFF_NO_TEMPLATE_BINDINGS (1 << 13) +#define TFF_POINTER (1 << 14) + +/* Returns the TEMPLATE_DECL associated to a TEMPLATE_TEMPLATE_PARM + node. */ +#define TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL(NODE) \ + ((TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM) \ + ? TYPE_TI_TEMPLATE (NODE) \ + : TYPE_NAME (NODE)) + +/* in lex.c */ + +extern void init_reswords (void); + +typedef struct GTY(()) operator_name_info_t { + /* The IDENTIFIER_NODE for the operator. */ + tree identifier; + /* The name of the operator. */ + const char *name; + /* The mangled name of the operator. */ + const char *mangled_name; + /* The arity of the operator. */ + int arity; +} operator_name_info_t; + +/* A mapping from tree codes to operator name information. */ +extern GTY(()) operator_name_info_t operator_name_info + [(int) MAX_TREE_CODES]; +/* Similar, but for assignment operators. */ +extern GTY(()) operator_name_info_t assignment_operator_name_info + [(int) MAX_TREE_CODES]; + +/* A type-qualifier, or bitmask therefore, using the TYPE_QUAL + constants. */ + +typedef int cp_cv_quals; + +/* Non-static member functions have an optional virt-specifier-seq. + There is a VIRT_SPEC value for each virt-specifier. + They can be combined by bitwise-or to form the complete set of + virt-specifiers for a member function. */ +enum virt_specifier + { + VIRT_SPEC_UNSPECIFIED = 0x0, + VIRT_SPEC_FINAL = 0x1, + VIRT_SPEC_OVERRIDE = 0x2 + }; + +/* A type-qualifier, or bitmask therefore, using the VIRT_SPEC + constants. */ + +typedef int cp_virt_specifiers; + +/* Wherever there is a function-cv-qual, there could also be a ref-qualifier: + + [dcl.fct] + The return type, the parameter-type-list, the ref-qualifier, and + the cv-qualifier-seq, but not the default arguments or the exception + specification, are part of the function type. + + REF_QUAL_NONE Ordinary member function with no ref-qualifier + REF_QUAL_LVALUE Member function with the &-ref-qualifier + REF_QUAL_RVALUE Member function with the &&-ref-qualifier */ + +enum cp_ref_qualifier { + REF_QUAL_NONE = 0, + REF_QUAL_LVALUE = 1, + REF_QUAL_RVALUE = 2 +}; + +/* A storage class. */ + +enum cp_storage_class { + /* sc_none must be zero so that zeroing a cp_decl_specifier_seq + sets the storage_class field to sc_none. */ + sc_none = 0, + sc_auto, + sc_register, + sc_static, + sc_extern, + sc_mutable +}; + +/* An individual decl-specifier. This is used to index the array of + locations for the declspecs in struct cp_decl_specifier_seq + below. */ + +enum cp_decl_spec { + ds_first, + ds_signed = ds_first, + ds_unsigned, + ds_short, + ds_long, + ds_const, + ds_volatile, + ds_restrict, + ds_inline, + ds_virtual, + ds_explicit, + ds_friend, + ds_typedef, + ds_alias, + ds_constexpr, + ds_complex, + ds_thread, + ds_type_spec, + ds_redefined_builtin_type_spec, + ds_attribute, + ds_std_attribute, + ds_storage_class, + ds_long_long, + ds_concept, + ds_last /* This enumerator must always be the last one. */ +}; + +/* A decl-specifier-seq. */ + +struct cp_decl_specifier_seq { + /* An array of locations for the declaration sepecifiers, indexed by + enum cp_decl_spec_word. */ + source_location locations[ds_last]; + /* The primary type, if any, given by the decl-specifier-seq. + Modifiers, like "short", "const", and "unsigned" are not + reflected here. This field will be a TYPE, unless a typedef-name + was used, in which case it will be a TYPE_DECL. */ + tree type; + /* The attributes, if any, provided with the specifier sequence. */ + tree attributes; + /* The c++11 attributes that follows the type specifier. */ + tree std_attributes; + /* If non-NULL, a built-in type that the user attempted to redefine + to some other type. */ + tree redefined_builtin_type; + /* The storage class specified -- or sc_none if no storage class was + explicitly specified. */ + cp_storage_class storage_class; + /* For the __intN declspec, this stores the index into the int_n_* arrays. */ + int int_n_idx; + /* True iff TYPE_SPEC defines a class or enum. */ + BOOL_BITFIELD type_definition_p : 1; + /* True iff multiple types were (erroneously) specified for this + decl-specifier-seq. */ + BOOL_BITFIELD multiple_types_p : 1; + /* True iff multiple storage classes were (erroneously) specified + for this decl-specifier-seq or a combination of a storage class + with a typedef specifier. */ + BOOL_BITFIELD conflicting_specifiers_p : 1; + /* True iff at least one decl-specifier was found. */ + BOOL_BITFIELD any_specifiers_p : 1; + /* True iff at least one type-specifier was found. */ + BOOL_BITFIELD any_type_specifiers_p : 1; + /* True iff "int" was explicitly provided. */ + BOOL_BITFIELD explicit_int_p : 1; + /* True iff "__intN" was explicitly provided. */ + BOOL_BITFIELD explicit_intN_p : 1; + /* True iff "char" was explicitly provided. */ + BOOL_BITFIELD explicit_char_p : 1; + /* True iff ds_thread is set for __thread, not thread_local. */ + BOOL_BITFIELD gnu_thread_keyword_p : 1; + /* True iff the type is a decltype. */ + BOOL_BITFIELD decltype_p : 1; +}; + +/* The various kinds of declarators. */ + +enum cp_declarator_kind { + cdk_id, + cdk_function, + cdk_array, + cdk_pointer, + cdk_reference, + cdk_ptrmem, + cdk_decomp, + cdk_error +}; + +/* A declarator. */ + +typedef struct cp_declarator cp_declarator; + +typedef struct cp_parameter_declarator cp_parameter_declarator; + +/* A parameter, before it has been semantically analyzed. */ +struct cp_parameter_declarator { + /* The next parameter, or NULL_TREE if none. */ + cp_parameter_declarator *next; + /* The decl-specifiers-seq for the parameter. */ + cp_decl_specifier_seq decl_specifiers; + /* The declarator for the parameter. */ + cp_declarator *declarator; + /* The default-argument expression, or NULL_TREE, if none. */ + tree default_argument; + /* True iff this is a template parameter pack. */ + bool template_parameter_pack_p; +}; + +/* A declarator. */ +struct cp_declarator { + /* The kind of declarator. */ + ENUM_BITFIELD (cp_declarator_kind) kind : 4; + /* Whether we parsed an ellipsis (`...') just before the declarator, + to indicate this is a parameter pack. */ + BOOL_BITFIELD parameter_pack_p : 1; + location_t id_loc; /* Currently only set for cdk_id, cdk_decomp and + cdk_function. */ + /* GNU Attributes that apply to this declarator. If the declarator + is a pointer or a reference, these attribute apply to the type + pointed to. */ + tree attributes; + /* Standard C++11 attributes that apply to this declarator. If the + declarator is a pointer or a reference, these attributes apply + to the pointer, rather than to the type pointed to. */ + tree std_attributes; + /* For all but cdk_id, cdk_decomp and cdk_error, the contained declarator. + For cdk_id, cdk_decomp and cdk_error, guaranteed to be NULL. */ + cp_declarator *declarator; + union { + /* For identifiers. */ + struct { + /* If non-NULL, the qualifying scope (a NAMESPACE_DECL or + *_TYPE) for this identifier. */ + tree qualifying_scope; + /* The unqualified name of the entity -- an IDENTIFIER_NODE, + BIT_NOT_EXPR, or TEMPLATE_ID_EXPR. */ + tree unqualified_name; + /* If this is the name of a function, what kind of special + function (if any). */ + special_function_kind sfk; + } id; + /* For functions. */ + struct { + /* The parameters to the function as a TREE_LIST of decl/default. */ + tree parameters; + /* The cv-qualifiers for the function. */ + cp_cv_quals qualifiers; + /* The virt-specifiers for the function. */ + cp_virt_specifiers virt_specifiers; + /* The ref-qualifier for the function. */ + cp_ref_qualifier ref_qualifier; + /* The transaction-safety qualifier for the function. */ + tree tx_qualifier; + /* The exception-specification for the function. */ + tree exception_specification; + /* The late-specified return type, if any. */ + tree late_return_type; + /* The trailing requires-clause, if any. */ + tree requires_clause; + } function; + /* For arrays. */ + struct { + /* The bounds to the array. */ + tree bounds; + } array; + /* For cdk_pointer and cdk_ptrmem. */ + struct { + /* The cv-qualifiers for the pointer. */ + cp_cv_quals qualifiers; + /* For cdk_ptrmem, the class type containing the member. */ + tree class_type; + } pointer; + /* For cdk_reference */ + struct { + /* The cv-qualifiers for the reference. These qualifiers are + only used to diagnose ill-formed code. */ + cp_cv_quals qualifiers; + /* Whether this is an rvalue reference */ + bool rvalue_ref; + } reference; + } u; +}; + +/* A level of template instantiation. */ +struct GTY((chain_next ("%h.next"))) tinst_level { + /* The immediately deeper level in the chain. */ + struct tinst_level *next; + + /* The original node. Can be either a DECL (for a function or static + data member) or a TYPE (for a class), depending on what we were + asked to instantiate. */ + tree decl; + + /* The location where the template is instantiated. */ + location_t locus; + + /* errorcount+sorrycount when we pushed this level. */ + int errors; + + /* True if the location is in a system header. */ + bool in_system_header_p; +}; + +bool decl_spec_seq_has_spec_p (const cp_decl_specifier_seq *, cp_decl_spec); + +/* Return the type of the `this' parameter of FNTYPE. */ + +inline tree +type_of_this_parm (const_tree fntype) +{ + function_args_iterator iter; + gcc_assert (TREE_CODE (fntype) == METHOD_TYPE); + function_args_iter_init (&iter, fntype); + return function_args_iter_cond (&iter); +} + +/* Return the class of the `this' parameter of FNTYPE. */ + +inline tree +class_of_this_parm (const_tree fntype) +{ + return TREE_TYPE (type_of_this_parm (fntype)); +} + +/* True iff T is a variable template declaration. */ +inline bool +variable_template_p (tree t) +{ + if (TREE_CODE (t) != TEMPLATE_DECL) + return false; + if (!PRIMARY_TEMPLATE_P (t)) + return false; + if (tree r = DECL_TEMPLATE_RESULT (t)) + return VAR_P (r); + return false; +} + +/* True iff T is a variable concept definition. That is, T is + a variable template declared with the concept specifier. */ +inline bool +variable_concept_p (tree t) +{ + if (TREE_CODE (t) != TEMPLATE_DECL) + return false; + if (tree r = DECL_TEMPLATE_RESULT (t)) + return VAR_P (r) && DECL_DECLARED_CONCEPT_P (r); + return false; +} + +/* True iff T is a concept definition. That is, T is a variable or function + template declared with the concept specifier. */ +inline bool +concept_template_p (tree t) +{ + if (TREE_CODE (t) != TEMPLATE_DECL) + return false; + if (tree r = DECL_TEMPLATE_RESULT (t)) + return VAR_OR_FUNCTION_DECL_P (r) && DECL_DECLARED_CONCEPT_P (r); + return false; +} + +/* A parameter list indicating for a function with no parameters, + e.g "int f(void)". */ +extern cp_parameter_declarator *no_parameters; + +/* in call.c */ +extern bool check_dtor_name (tree, tree); +int magic_varargs_p (tree); + +extern tree build_conditional_expr (location_t, tree, tree, tree, + tsubst_flags_t); +extern tree build_addr_func (tree, tsubst_flags_t); +extern void set_flags_from_callee (tree); +extern tree build_call_a (tree, int, tree*); +extern tree build_call_n (tree, int, ...); +extern bool null_ptr_cst_p (tree); +extern bool null_member_pointer_value_p (tree); +extern bool sufficient_parms_p (const_tree); +extern tree type_decays_to (tree); +extern tree extract_call_expr (tree); +extern tree build_user_type_conversion (tree, tree, int, + tsubst_flags_t); +extern tree build_new_function_call (tree, vec **, bool, + tsubst_flags_t); +extern tree build_operator_new_call (tree, vec **, tree *, + tree *, tree, tree, tree *, + tsubst_flags_t); +extern tree build_new_method_call (tree, tree, vec **, + tree, int, tree *, + tsubst_flags_t); +extern tree build_special_member_call (tree, tree, vec **, + tree, int, tsubst_flags_t); +extern tree build_new_op (location_t, enum tree_code, + int, tree, tree, tree, tree *, + tsubst_flags_t); +extern tree build_op_call (tree, vec **, + tsubst_flags_t); +extern bool aligned_allocation_fn_p (tree); +extern bool usual_deallocation_fn_p (tree); +extern tree build_op_delete_call (enum tree_code, tree, tree, + bool, tree, tree, + tsubst_flags_t); +extern bool can_convert (tree, tree, tsubst_flags_t); +extern bool can_convert_standard (tree, tree, tsubst_flags_t); +extern bool can_convert_arg (tree, tree, tree, int, + tsubst_flags_t); +extern bool can_convert_arg_bad (tree, tree, tree, int, + tsubst_flags_t); +extern bool enforce_access (tree, tree, tree, + tsubst_flags_t); +extern void push_defarg_context (tree); +extern void pop_defarg_context (void); +extern tree convert_default_arg (tree, tree, tree, int, + tsubst_flags_t); +extern tree convert_arg_to_ellipsis (tree, tsubst_flags_t); +extern tree build_x_va_arg (source_location, tree, tree); +extern tree cxx_type_promotes_to (tree); +extern tree type_passed_as (tree); +extern tree convert_for_arg_passing (tree, tree, tsubst_flags_t); +extern bool is_properly_derived_from (tree, tree); +extern tree initialize_reference (tree, tree, int, + tsubst_flags_t); +extern tree extend_ref_init_temps (tree, tree, vec**); +extern tree make_temporary_var_for_ref_to_temp (tree, tree); +extern bool type_has_extended_temps (tree); +extern tree strip_top_quals (tree); +extern bool reference_related_p (tree, tree); +extern int remaining_arguments (tree); +extern tree perform_implicit_conversion (tree, tree, tsubst_flags_t); +extern tree perform_implicit_conversion_flags (tree, tree, tsubst_flags_t, int); +extern tree build_integral_nontype_arg_conv (tree, tree, tsubst_flags_t); +extern tree perform_direct_initialization_if_possible (tree, tree, bool, + tsubst_flags_t); +extern tree in_charge_arg_for_name (tree); +extern tree build_cxx_call (tree, int, tree *, + tsubst_flags_t); +extern bool is_std_init_list (tree); +extern bool is_list_ctor (tree); +extern void validate_conversion_obstack (void); +extern void mark_versions_used (tree); +extern tree get_function_version_dispatcher (tree); + +/* in class.c */ +extern tree build_vfield_ref (tree, tree); +extern tree build_if_in_charge (tree true_stmt, tree false_stmt = void_node); +extern tree build_base_path (enum tree_code, tree, + tree, int, tsubst_flags_t); +extern tree convert_to_base (tree, tree, bool, bool, + tsubst_flags_t); +extern tree convert_to_base_statically (tree, tree); +extern tree build_vtbl_ref (tree, tree); +extern tree build_vfn_ref (tree, tree); +extern tree get_vtable_decl (tree, int); +extern void resort_type_method_vec (void *, void *, + gt_pointer_operator, void *); +extern bool add_method (tree, tree, tree); +extern tree declared_access (tree); +extern tree currently_open_class (tree); +extern tree currently_open_derived_class (tree); +extern tree outermost_open_class (void); +extern tree current_nonlambda_class_type (void); +extern tree finish_struct (tree, tree); +extern void finish_struct_1 (tree); +extern int resolves_to_fixed_type_p (tree, int *); +extern void init_class_processing (void); +extern int is_empty_class (tree); +extern bool is_really_empty_class (tree); +extern void pushclass (tree); +extern void popclass (void); +extern void push_nested_class (tree); +extern void pop_nested_class (void); +extern int current_lang_depth (void); +extern void push_lang_context (tree); +extern void pop_lang_context (void); +extern tree instantiate_type (tree, tree, tsubst_flags_t); +extern void print_class_statistics (void); +extern void build_self_reference (void); +extern int same_signature_p (const_tree, const_tree); +extern void maybe_add_class_template_decl_list (tree, tree, int); +extern void unreverse_member_declarations (tree); +extern void invalidate_class_lookup_cache (void); +extern void maybe_note_name_used_in_class (tree, tree); +extern void note_name_declared_in_class (tree, tree); +extern tree get_vtbl_decl_for_binfo (tree); +extern bool vptr_via_virtual_p (tree); +extern void debug_class (tree); +extern void debug_thunks (tree); +extern void set_linkage_according_to_type (tree, tree); +extern void determine_key_method (tree); +extern void check_for_override (tree, tree); +extern void push_class_stack (void); +extern void pop_class_stack (void); +extern bool default_ctor_p (tree); +extern bool type_has_user_nondefault_constructor (tree); +extern tree in_class_defaulted_default_constructor (tree); +extern bool user_provided_p (tree); +extern bool type_has_user_provided_constructor (tree); +extern bool type_has_non_user_provided_default_constructor (tree); +extern bool vbase_has_user_provided_move_assign (tree); +extern tree default_init_uninitialized_part (tree); +extern bool trivial_default_constructor_is_constexpr (tree); +extern bool type_has_constexpr_default_constructor (tree); +extern bool type_has_virtual_destructor (tree); +extern bool type_has_move_constructor (tree); +extern bool type_has_move_assign (tree); +extern bool type_has_user_declared_move_constructor (tree); +extern bool type_has_user_declared_move_assign(tree); +extern bool type_build_ctor_call (tree); +extern bool type_build_dtor_call (tree); +extern void explain_non_literal_class (tree); +extern void inherit_targ_abi_tags (tree); +extern void defaulted_late_check (tree); +extern bool defaultable_fn_check (tree); +extern void check_abi_tags (tree); +extern tree missing_abi_tags (tree); +extern void fixup_type_variants (tree); +extern void fixup_attribute_variants (tree); +extern tree* decl_cloned_function_p (const_tree, bool); +extern void clone_function_decl (tree, int); +extern void adjust_clone_args (tree); +extern void deduce_noexcept_on_destructor (tree); +extern void insert_late_enum_def_into_classtype_sorted_fields (tree, tree); +extern bool uniquely_derived_from_p (tree, tree); +extern bool publicly_uniquely_derived_p (tree, tree); +extern tree common_enclosing_class (tree, tree); + +/* in cvt.c */ +extern tree convert_to_reference (tree, tree, int, int, tree, + tsubst_flags_t); +extern tree convert_from_reference (tree); +extern tree force_rvalue (tree, tsubst_flags_t); +extern tree ocp_convert (tree, tree, int, int, + tsubst_flags_t); +extern tree cp_convert (tree, tree, tsubst_flags_t); +extern tree cp_convert_and_check (tree, tree, tsubst_flags_t); +extern tree cp_fold_convert (tree, tree); +extern tree cp_get_callee (tree); +extern tree cp_get_callee_fndecl (tree); +extern tree cp_get_fndecl_from_callee (tree); +extern tree convert_to_void (tree, impl_conv_void, + tsubst_flags_t); +extern tree convert_force (tree, tree, int, + tsubst_flags_t); +extern tree build_expr_type_conversion (int, tree, bool); +extern tree type_promotes_to (tree); +extern tree perform_qualification_conversions (tree, tree); +extern bool tx_safe_fn_type_p (tree); +extern tree tx_unsafe_fn_variant (tree); +extern bool fnptr_conv_p (tree, tree); +extern tree strip_fnptr_conv (tree); + +/* in name-lookup.c */ +extern tree pushdecl (tree); +extern tree pushdecl_maybe_friend (tree, bool); +extern void maybe_push_cleanup_level (tree); +extern tree pushtag (tree, tree, tag_scope); +extern tree make_anon_name (void); +extern tree pushdecl_top_level_maybe_friend (tree, bool); +extern tree pushdecl_top_level_and_finish (tree, tree); +extern tree check_for_out_of_scope_variable (tree); +extern void dump (cp_binding_level &ref); +extern void dump (cp_binding_level *ptr); +extern void print_other_binding_stack (cp_binding_level *); +extern tree maybe_push_decl (tree); +extern tree current_decl_namespace (void); + +/* decl.c */ +extern tree poplevel (int, int, int); +extern void cxx_init_decl_processing (void); +enum cp_tree_node_structure_enum cp_tree_node_structure + (union lang_tree_node *); +extern void finish_scope (void); +extern void push_switch (tree); +extern void pop_switch (void); +extern tree make_lambda_name (void); +extern int decls_match (tree, tree); +extern tree duplicate_decls (tree, tree, bool); +extern tree declare_local_label (tree); +extern tree define_label (location_t, tree); +extern void check_goto (tree); +extern bool check_omp_return (void); +extern tree make_typename_type (tree, tree, enum tag_types, tsubst_flags_t); +extern tree make_unbound_class_template (tree, tree, tree, tsubst_flags_t); +extern tree build_library_fn_ptr (const char *, tree, int); +extern tree build_cp_library_fn_ptr (const char *, tree, int); +extern tree push_library_fn (tree, tree, tree, int); +extern tree push_void_library_fn (tree, tree, int); +extern tree push_throw_library_fn (tree, tree); +extern void warn_misplaced_attr_for_class_type (source_location location, + tree class_type); +extern tree check_tag_decl (cp_decl_specifier_seq *, bool); +extern tree shadow_tag (cp_decl_specifier_seq *); +extern tree groktypename (cp_decl_specifier_seq *, const cp_declarator *, bool); +extern tree start_decl (const cp_declarator *, cp_decl_specifier_seq *, int, tree, tree, tree *); +extern void start_decl_1 (tree, bool); +extern bool check_array_initializer (tree, tree, tree); +extern void cp_finish_decl (tree, tree, bool, tree, int); +extern tree lookup_decomp_type (tree); +extern void cp_maybe_mangle_decomp (tree, tree, unsigned int); +extern void cp_finish_decomp (tree, tree, unsigned int); +extern int cp_complete_array_type (tree *, tree, bool); +extern int cp_complete_array_type_or_error (tree *, tree, bool, tsubst_flags_t); +extern tree build_ptrmemfunc_type (tree); +extern tree build_ptrmem_type (tree, tree); +/* the grokdeclarator prototype is in decl.h */ +extern tree build_this_parm (tree, cp_cv_quals); +extern tree grokparms (tree, tree *); +extern int copy_fn_p (const_tree); +extern bool move_fn_p (const_tree); +extern bool move_signature_fn_p (const_tree); +extern tree get_scope_of_declarator (const cp_declarator *); +extern void grok_special_member_properties (tree); +extern int grok_ctor_properties (const_tree, const_tree); +extern bool grok_op_properties (tree, bool); +extern tree xref_tag (enum tag_types, tree, tag_scope, bool); +extern tree xref_tag_from_type (tree, tree, tag_scope); +extern void xref_basetypes (tree, tree); +extern tree start_enum (tree, tree, tree, tree, bool, bool *); +extern void finish_enum_value_list (tree); +extern void finish_enum (tree); +extern void build_enumerator (tree, tree, tree, tree, location_t); +extern tree lookup_enumerator (tree, tree); +extern bool start_preparsed_function (tree, tree, int); +extern bool start_function (cp_decl_specifier_seq *, + const cp_declarator *, tree); +extern tree begin_function_body (void); +extern void finish_function_body (tree); +extern tree outer_curly_brace_block (tree); +extern tree finish_function (int); +extern tree grokmethod (cp_decl_specifier_seq *, const cp_declarator *, tree); +extern void maybe_register_incomplete_var (tree); +extern void maybe_commonize_var (tree); +extern void complete_vars (tree); +extern tree static_fn_type (tree); +extern void revert_static_member_fn (tree); +extern void fixup_anonymous_aggr (tree); +extern tree compute_array_index_type (tree, tree, tsubst_flags_t); +extern tree check_default_argument (tree, tree, tsubst_flags_t); +typedef int (*walk_namespaces_fn) (tree, void *); +extern int walk_namespaces (walk_namespaces_fn, + void *); +extern int wrapup_globals_for_namespace (tree, void *); +extern int diagnose_inline_vars_for_namespace (tree, void *); +extern tree create_implicit_typedef (tree, tree); +extern int local_variable_p (const_tree); +extern tree register_dtor_fn (tree); +extern tmpl_spec_kind current_tmpl_spec_kind (int); +extern tree cp_fname_init (const char *, tree *); +extern tree cxx_builtin_function (tree decl); +extern tree cxx_builtin_function_ext_scope (tree decl); +extern tree check_elaborated_type_specifier (enum tag_types, tree, bool); +extern void warn_extern_redeclared_static (tree, tree); +extern tree cxx_comdat_group (tree); +extern bool cp_missing_noreturn_ok_p (tree); +extern bool is_direct_enum_init (tree, tree); +extern void initialize_artificial_var (tree, vec *); +extern tree check_var_type (tree, tree); +extern tree reshape_init (tree, tree, tsubst_flags_t); +extern tree next_initializable_field (tree); +extern tree fndecl_declared_return_type (tree); +extern bool undeduced_auto_decl (tree); +extern bool require_deduced_type (tree, tsubst_flags_t = tf_warning_or_error); + +extern tree finish_case_label (location_t, tree, tree); +extern tree cxx_maybe_build_cleanup (tree, tsubst_flags_t); + +/* in decl2.c */ +extern void note_mangling_alias (tree, tree); +extern void generate_mangling_aliases (void); +extern tree build_memfn_type (tree, tree, cp_cv_quals, cp_ref_qualifier); +extern tree build_pointer_ptrmemfn_type (tree); +extern tree change_return_type (tree, tree); +extern void maybe_retrofit_in_chrg (tree); +extern void maybe_make_one_only (tree); +extern bool vague_linkage_p (tree); +extern void grokclassfn (tree, tree, + enum overload_flags); +extern tree grok_array_decl (location_t, tree, tree, bool); +extern tree delete_sanity (tree, tree, bool, int, tsubst_flags_t); +extern tree check_classfn (tree, tree, tree); +extern void check_member_template (tree); +extern tree grokfield (const cp_declarator *, cp_decl_specifier_seq *, + tree, bool, tree, tree); +extern tree grokbitfield (const cp_declarator *, cp_decl_specifier_seq *, + tree, tree); +extern bool any_dependent_type_attributes_p (tree); +extern tree cp_reconstruct_complex_type (tree, tree); +extern bool attributes_naming_typedef_ok (tree); +extern void cplus_decl_attributes (tree *, tree, int); +extern void finish_anon_union (tree); +extern void cxx_post_compilation_parsing_cleanups (void); +extern tree coerce_new_type (tree); +extern tree coerce_delete_type (tree); +extern void comdat_linkage (tree); +extern void determine_visibility (tree); +extern void constrain_class_visibility (tree); +extern void reset_type_linkage (tree); +extern void tentative_decl_linkage (tree); +extern void import_export_decl (tree); +extern tree build_cleanup (tree); +extern tree build_offset_ref_call_from_tree (tree, vec **, + tsubst_flags_t); +extern bool decl_defined_p (tree); +extern bool decl_constant_var_p (tree); +extern bool decl_maybe_constant_var_p (tree); +extern void no_linkage_error (tree); +extern void check_default_args (tree); +extern bool mark_used (tree); +extern bool mark_used (tree, tsubst_flags_t); +extern void finish_static_data_member_decl (tree, tree, bool, tree, int); +extern tree cp_build_parm_decl (tree, tree); +extern tree get_guard (tree); +extern tree get_guard_cond (tree, bool); +extern tree set_guard (tree); +extern tree get_tls_wrapper_fn (tree); +extern void mark_needed (tree); +extern bool decl_needed_p (tree); +extern void note_vague_linkage_fn (tree); +extern void note_variable_template_instantiation (tree); +extern tree build_artificial_parm (tree, tree); +extern bool possibly_inlined_p (tree); +extern int parm_index (tree); +extern tree vtv_start_verification_constructor_init_function (void); +extern tree vtv_finish_verification_constructor_init_function (tree); +extern bool cp_omp_mappable_type (tree); + +/* in error.c */ +extern const char *type_as_string (tree, int); +extern const char *type_as_string_translate (tree, int); +extern const char *decl_as_string (tree, int); +extern const char *decl_as_string_translate (tree, int); +extern const char *decl_as_dwarf_string (tree, int); +extern const char *expr_as_string (tree, int); +extern const char *lang_decl_name (tree, int, bool); +extern const char *lang_decl_dwarf_name (tree, int, bool); +extern const char *language_to_string (enum languages); +extern const char *class_key_or_enum_as_string (tree); +extern void maybe_warn_variadic_templates (void); +extern void maybe_warn_cpp0x (cpp0x_warn_str str); +extern bool pedwarn_cxx98 (location_t, int, const char *, ...) ATTRIBUTE_GCC_DIAG(3,4); +extern location_t location_of (tree); +extern void qualified_name_lookup_error (tree, tree, tree, + location_t); + +/* in except.c */ +extern void init_exception_processing (void); +extern tree expand_start_catch_block (tree); +extern void expand_end_catch_block (void); +extern tree build_exc_ptr (void); +extern tree build_throw (tree); +extern int nothrow_libfn_p (const_tree); +extern void check_handlers (tree); +extern tree finish_noexcept_expr (tree, tsubst_flags_t); +extern bool expr_noexcept_p (tree, tsubst_flags_t); +extern void perform_deferred_noexcept_checks (void); +extern bool nothrow_spec_p (const_tree); +extern bool type_noexcept_p (const_tree); +extern bool type_throw_all_p (const_tree); +extern tree build_noexcept_spec (tree, int); +extern void choose_personality_routine (enum languages); +extern tree build_must_not_throw_expr (tree,tree); +extern tree eh_type_info (tree); +extern tree begin_eh_spec_block (void); +extern void finish_eh_spec_block (tree, tree); +extern tree build_eh_type_type (tree); +extern tree cp_protect_cleanup_actions (void); +extern tree create_try_catch_expr (tree, tree); + +/* in expr.c */ +extern tree cplus_expand_constant (tree); +extern tree mark_rvalue_use (tree, + location_t = UNKNOWN_LOCATION, + bool = true); +extern tree mark_lvalue_use (tree); +extern tree mark_type_use (tree); +extern void mark_exp_read (tree); + +/* friend.c */ +extern int is_friend (tree, tree); +extern void make_friend_class (tree, tree, bool); +extern void add_friend (tree, tree, bool); +extern tree do_friend (tree, tree, tree, tree, enum overload_flags, bool); + +extern void set_global_friend (tree); +extern bool is_global_friend (tree); + +/* in init.c */ +extern tree expand_member_init (tree); +extern void emit_mem_initializers (tree); +extern tree build_aggr_init (tree, tree, int, + tsubst_flags_t); +extern int is_class_type (tree, int); +extern tree get_type_value (tree); +extern tree build_zero_init (tree, tree, bool); +extern tree build_value_init (tree, tsubst_flags_t); +extern tree build_value_init_noctor (tree, tsubst_flags_t); +extern tree get_nsdmi (tree, bool); +extern tree build_offset_ref (tree, tree, bool, + tsubst_flags_t); +extern tree throw_bad_array_new_length (void); +extern bool type_has_new_extended_alignment (tree); +extern unsigned malloc_alignment (void); +extern tree build_new (vec **, tree, tree, + vec **, int, + tsubst_flags_t); +extern tree get_temp_regvar (tree, tree); +extern tree build_vec_init (tree, tree, tree, bool, int, + tsubst_flags_t); +extern tree build_delete (tree, tree, + special_function_kind, + int, int, tsubst_flags_t); +extern void push_base_cleanups (void); +extern tree build_vec_delete (tree, tree, + special_function_kind, int, + tsubst_flags_t); +extern tree create_temporary_var (tree); +extern void initialize_vtbl_ptrs (tree); +extern tree scalar_constant_value (tree); +extern tree decl_really_constant_value (tree); +extern int diagnose_uninitialized_cst_or_ref_member (tree, bool, bool); +extern tree build_vtbl_address (tree); +extern bool maybe_reject_flexarray_init (tree, tree); + +/* in lex.c */ +extern void cxx_dup_lang_specific_decl (tree); +extern void yyungetc (int, int); + +extern tree unqualified_name_lookup_error (tree, + location_t = UNKNOWN_LOCATION); +extern tree unqualified_fn_lookup_error (cp_expr); +extern tree build_lang_decl (enum tree_code, tree, tree); +extern tree build_lang_decl_loc (location_t, enum tree_code, tree, tree); +extern void retrofit_lang_decl (tree); +extern tree copy_decl (tree); +extern tree copy_type (tree); +extern tree cxx_make_type (enum tree_code); +extern tree make_class_type (enum tree_code); +extern bool cxx_init (void); +extern void cxx_finish (void); +extern bool in_main_input_context (void); + +/* in method.c */ +extern void init_method (void); +extern tree make_thunk (tree, bool, tree, tree); +extern void finish_thunk (tree); +extern void use_thunk (tree, bool); +extern bool trivial_fn_p (tree); +extern tree forward_parm (tree); +extern bool is_trivially_xible (enum tree_code, tree, tree); +extern tree get_defaulted_eh_spec (tree); +extern tree unevaluated_noexcept_spec (void); +extern void after_nsdmi_defaulted_late_checks (tree); +extern bool maybe_explain_implicit_delete (tree); +extern void explain_implicit_non_constexpr (tree); +extern void deduce_inheriting_ctor (tree); +extern void synthesize_method (tree); +extern tree lazily_declare_fn (special_function_kind, + tree); +extern tree skip_artificial_parms_for (const_tree, tree); +extern int num_artificial_parms_for (const_tree); +extern tree make_alias_for (tree, tree); +extern tree get_copy_ctor (tree, tsubst_flags_t); +extern tree get_copy_assign (tree); +extern tree get_default_ctor (tree); +extern tree get_dtor (tree, tsubst_flags_t); +extern tree strip_inheriting_ctors (tree); +extern tree inherited_ctor_binfo (tree); +extern bool ctor_omit_inherited_parms (tree); +extern tree locate_ctor (tree); +extern tree implicitly_declare_fn (special_function_kind, tree, + bool, tree, tree); + +/* In optimize.c */ +extern bool maybe_clone_body (tree); + +/* In parser.c */ +extern tree cp_convert_range_for (tree, tree, tree, tree, unsigned int, bool); +extern bool parsing_nsdmi (void); +extern bool parsing_default_capturing_generic_lambda (void); +extern void inject_this_parameter (tree, cp_cv_quals); + +/* in pt.c */ +extern bool check_template_shadow (tree); +extern tree get_innermost_template_args (tree, int); +extern void maybe_begin_member_template_processing (tree); +extern void maybe_end_member_template_processing (void); +extern tree finish_member_template_decl (tree); +extern void begin_template_parm_list (void); +extern bool begin_specialization (void); +extern void reset_specialization (void); +extern void end_specialization (void); +extern void begin_explicit_instantiation (void); +extern void end_explicit_instantiation (void); +extern void check_unqualified_spec_or_inst (tree, location_t); +extern tree check_explicit_specialization (tree, tree, int, int); +extern int num_template_headers_for_class (tree); +extern void check_template_variable (tree); +extern tree make_auto (void); +extern tree make_decltype_auto (void); +extern tree make_template_placeholder (tree); +extern bool template_placeholder_p (tree); +extern tree do_auto_deduction (tree, tree, tree); +extern tree do_auto_deduction (tree, tree, tree, + tsubst_flags_t, + auto_deduction_context, + tree = NULL_TREE, + int = LOOKUP_NORMAL); +extern tree type_uses_auto (tree); +extern tree type_uses_auto_or_concept (tree); +extern void append_type_to_template_for_access_check (tree, tree, tree, + location_t); +extern tree convert_generic_types_to_packs (tree, int, int); +extern tree splice_late_return_type (tree, tree); +extern bool is_auto (const_tree); +extern bool is_auto_or_concept (const_tree); +extern tree process_template_parm (tree, location_t, tree, + bool, bool); +extern tree end_template_parm_list (tree); +extern void end_template_parm_list (void); +extern void end_template_decl (void); +extern tree maybe_update_decl_type (tree, tree); +extern bool check_default_tmpl_args (tree, tree, bool, bool, int); +extern tree push_template_decl (tree); +extern tree push_template_decl_real (tree, bool); +extern tree add_inherited_template_parms (tree, tree); +extern bool redeclare_class_template (tree, tree, tree); +extern tree lookup_template_class (tree, tree, tree, tree, + int, tsubst_flags_t); +extern tree lookup_template_function (tree, tree); +extern tree lookup_template_variable (tree, tree); +extern int uses_template_parms (tree); +extern bool uses_template_parms_level (tree, int); +extern bool in_template_function (void); +extern tree instantiate_class_template (tree); +extern tree instantiate_template (tree, tree, tsubst_flags_t); +extern tree fn_type_unification (tree, tree, tree, + const tree *, unsigned int, + tree, unification_kind_t, int, + bool, bool); +extern void mark_decl_instantiated (tree, int); +extern int more_specialized_fn (tree, tree, int); +extern void do_decl_instantiation (tree, tree); +extern void do_type_instantiation (tree, tree, tsubst_flags_t); +extern bool always_instantiate_p (tree); +extern void maybe_instantiate_noexcept (tree); +extern tree instantiate_decl (tree, bool, bool); +extern int comp_template_parms (const_tree, const_tree); +extern bool uses_parameter_packs (tree); +extern bool template_parameter_pack_p (const_tree); +extern bool function_parameter_pack_p (const_tree); +extern bool function_parameter_expanded_from_pack_p (tree, tree); +extern tree make_pack_expansion (tree); +extern bool check_for_bare_parameter_packs (tree); +extern tree build_template_info (tree, tree); +extern tree get_template_info (const_tree); +extern vec *get_types_needing_access_check (tree); +extern int template_class_depth (tree); +extern int is_specialization_of (tree, tree); +extern bool is_specialization_of_friend (tree, tree); +extern tree get_pattern_parm (tree, tree); +extern int comp_template_args (tree, tree, tree * = NULL, + tree * = NULL, bool = false); +extern int template_args_equal (tree, tree, bool = false); +extern tree maybe_process_partial_specialization (tree); +extern tree most_specialized_instantiation (tree); +extern void print_candidates (tree); +extern void instantiate_pending_templates (int); +extern tree tsubst_default_argument (tree, tree, tree, + tsubst_flags_t); +extern tree tsubst (tree, tree, tsubst_flags_t, tree); +extern tree tsubst_copy_and_build (tree, tree, tsubst_flags_t, + tree, bool, bool); +extern tree tsubst_expr (tree, tree, tsubst_flags_t, + tree, bool); +extern tree tsubst_pack_expansion (tree, tree, tsubst_flags_t, tree); +extern tree most_general_template (tree); +extern tree get_mostly_instantiated_function_type (tree); +extern bool problematic_instantiation_changed (void); +extern void record_last_problematic_instantiation (void); +extern struct tinst_level *current_instantiation(void); +extern bool instantiating_current_function_p (void); +extern tree maybe_get_template_decl_from_type_decl (tree); +extern int processing_template_parmlist; +extern bool dependent_type_p (tree); +extern bool dependent_scope_p (tree); +extern bool any_dependent_template_arguments_p (const_tree); +extern bool dependent_template_p (tree); +extern bool dependent_template_id_p (tree, tree); +extern bool type_dependent_expression_p (tree); +extern bool type_dependent_object_expression_p (tree); +extern bool any_type_dependent_arguments_p (const vec *); +extern bool any_type_dependent_elements_p (const_tree); +extern bool type_dependent_expression_p_push (tree); +extern bool value_dependent_expression_p (tree); +extern bool instantiation_dependent_expression_p (tree); +extern bool instantiation_dependent_uneval_expression_p (tree); +extern bool any_value_dependent_elements_p (const_tree); +extern bool dependent_omp_for_p (tree, tree, tree, tree); +extern tree resolve_typename_type (tree, bool); +extern tree template_for_substitution (tree); +extern tree build_non_dependent_expr (tree); +extern void make_args_non_dependent (vec *); +extern bool reregister_specialization (tree, tree, tree); +extern tree instantiate_non_dependent_expr (tree); +extern tree instantiate_non_dependent_expr_sfinae (tree, tsubst_flags_t); +extern tree instantiate_non_dependent_expr_internal (tree, tsubst_flags_t); +extern tree instantiate_non_dependent_or_null (tree); +extern bool variable_template_specialization_p (tree); +extern bool alias_type_or_template_p (tree); +extern bool alias_template_specialization_p (const_tree); +extern bool dependent_alias_template_spec_p (const_tree); +extern bool explicit_class_specialization_p (tree); +extern bool push_tinst_level (tree); +extern bool push_tinst_level_loc (tree, location_t); +extern void pop_tinst_level (void); +extern struct tinst_level *outermost_tinst_level(void); +extern void init_template_processing (void); +extern void print_template_statistics (void); +bool template_template_parameter_p (const_tree); +bool template_type_parameter_p (const_tree); +extern bool primary_template_instantiation_p (const_tree); +extern tree get_primary_template_innermost_parameters (const_tree); +extern tree get_template_parms_at_level (tree, int); +extern tree get_template_innermost_arguments (const_tree); +extern tree get_template_argument_pack_elems (const_tree); +extern tree get_function_template_decl (const_tree); +extern tree resolve_nondeduced_context (tree, tsubst_flags_t); +extern hashval_t iterative_hash_template_arg (tree arg, hashval_t val); +extern tree coerce_template_parms (tree, tree, tree); +extern tree coerce_template_parms (tree, tree, tree, tsubst_flags_t); +extern void register_local_specialization (tree, tree); +extern tree retrieve_local_specialization (tree); +extern tree extract_fnparm_pack (tree, tree *); +extern tree template_parm_to_arg (tree); +extern tree dguide_name (tree); +extern bool dguide_name_p (tree); +extern bool deduction_guide_p (const_tree); +extern bool copy_guide_p (const_tree); +extern bool template_guide_p (const_tree); + +/* in repo.c */ +extern void init_repo (void); +extern int repo_emit_p (tree); +extern bool repo_export_class_p (const_tree); +extern void finish_repo (void); + +/* in rtti.c */ +/* A vector of all tinfo decls that haven't been emitted yet. */ +extern GTY(()) vec *unemitted_tinfo_decls; + +extern void init_rtti_processing (void); +extern tree build_typeid (tree, tsubst_flags_t); +extern tree get_tinfo_decl (tree); +extern tree get_typeid (tree, tsubst_flags_t); +extern tree build_headof (tree); +extern tree build_dynamic_cast (tree, tree, tsubst_flags_t); +extern void emit_support_tinfos (void); +extern bool emit_tinfo_decl (tree); + +/* in search.c */ +extern bool accessible_base_p (tree, tree, bool); +extern tree lookup_base (tree, tree, base_access, + base_kind *, tsubst_flags_t); +extern tree dcast_base_hint (tree, tree); +extern int accessible_p (tree, tree, bool); +extern int accessible_in_template_p (tree, tree); +extern tree lookup_field_1 (tree, tree, bool); +extern tree lookup_field (tree, tree, int, bool); +extern int lookup_fnfields_1 (tree, tree); +extern tree lookup_fnfields_slot (tree, tree); +extern tree lookup_fnfields_slot_nolazy (tree, tree); +extern int class_method_index_for_fn (tree, tree); +extern tree lookup_fnfields (tree, tree, int); +extern tree lookup_member (tree, tree, int, bool, + tsubst_flags_t); +extern tree lookup_member_fuzzy (tree, tree, bool); +extern int look_for_overrides (tree, tree); +extern void get_pure_virtuals (tree); +extern void maybe_suppress_debug_info (tree); +extern void note_debug_info_needed (tree); +extern void print_search_statistics (void); +extern void reinit_search_statistics (void); +extern tree current_scope (void); +extern int at_function_scope_p (void); +extern bool at_class_scope_p (void); +extern bool at_namespace_scope_p (void); +extern tree context_for_name_lookup (tree); +extern tree lookup_conversions (tree); +extern tree binfo_from_vbase (tree); +extern tree binfo_for_vbase (tree, tree); +extern tree look_for_overrides_here (tree, tree); +#define dfs_skip_bases ((tree)1) +extern tree dfs_walk_all (tree, tree (*) (tree, void *), + tree (*) (tree, void *), void *); +extern tree dfs_walk_once (tree, tree (*) (tree, void *), + tree (*) (tree, void *), void *); +extern tree binfo_via_virtual (tree, tree); +extern bool binfo_direct_p (tree); +extern tree build_baselink (tree, tree, tree, tree); +extern tree adjust_result_of_qualified_name_lookup + (tree, tree, tree); +extern tree copied_binfo (tree, tree); +extern tree original_binfo (tree, tree); +extern int shared_member_p (tree); +extern bool any_dependent_bases_p (tree = current_nonlambda_class_type ()); + +/* The representation of a deferred access check. */ + +struct GTY(()) deferred_access_check { + /* The base class in which the declaration is referenced. */ + tree binfo; + /* The declaration whose access must be checked. */ + tree decl; + /* The declaration that should be used in the error message. */ + tree diag_decl; + /* The location of this access. */ + location_t loc; +}; + +/* in semantics.c */ +extern void push_deferring_access_checks (deferring_kind); +extern void resume_deferring_access_checks (void); +extern void stop_deferring_access_checks (void); +extern void pop_deferring_access_checks (void); +extern vec *get_deferred_access_checks (void); +extern void reopen_deferring_access_checks (vec *); +extern void pop_to_parent_deferring_access_checks (void); +extern bool perform_access_checks (vec *, + tsubst_flags_t); +extern bool perform_deferred_access_checks (tsubst_flags_t); +extern bool perform_or_defer_access_check (tree, tree, tree, + tsubst_flags_t); + +/* RAII sentinel to ensures that deferred access checks are popped before + a function returns. */ + +struct deferring_access_check_sentinel +{ + deferring_access_check_sentinel () + { + push_deferring_access_checks (dk_deferred); + } + ~deferring_access_check_sentinel () + { + pop_deferring_access_checks (); + } +}; + +extern int stmts_are_full_exprs_p (void); +extern void init_cp_semantics (void); +extern tree do_poplevel (tree); +extern void break_maybe_infinite_loop (void); +extern void add_decl_expr (tree); +extern tree maybe_cleanup_point_expr_void (tree); +extern tree finish_expr_stmt (tree); +extern tree begin_if_stmt (void); +extern tree finish_if_stmt_cond (tree, tree); +extern tree finish_then_clause (tree); +extern void begin_else_clause (tree); +extern void finish_else_clause (tree); +extern void finish_if_stmt (tree); +extern tree begin_while_stmt (void); +extern void finish_while_stmt_cond (tree, tree, bool); +extern void finish_while_stmt (tree); +extern tree begin_do_stmt (void); +extern void finish_do_body (tree); +extern void finish_do_stmt (tree, tree, bool); +extern tree finish_return_stmt (tree); +extern tree begin_for_scope (tree *); +extern tree begin_for_stmt (tree, tree); +extern void finish_init_stmt (tree); +extern void finish_for_cond (tree, tree, bool); +extern void finish_for_expr (tree, tree); +extern void finish_for_stmt (tree); +extern tree begin_range_for_stmt (tree, tree); +extern void finish_range_for_decl (tree, tree, tree); +extern void finish_range_for_stmt (tree); +extern tree finish_break_stmt (void); +extern tree finish_continue_stmt (void); +extern tree begin_switch_stmt (void); +extern void finish_switch_cond (tree, tree); +extern void finish_switch_stmt (tree); +extern tree finish_goto_stmt (tree); +extern tree begin_try_block (void); +extern void finish_try_block (tree); +extern void finish_handler_sequence (tree); +extern tree begin_function_try_block (tree *); +extern void finish_function_try_block (tree); +extern void finish_function_handler_sequence (tree, tree); +extern void finish_cleanup_try_block (tree); +extern tree begin_handler (void); +extern void finish_handler_parms (tree, tree); +extern void finish_handler (tree); +extern void finish_cleanup (tree, tree); +extern bool is_this_parameter (tree); + +enum { + BCS_NORMAL = 0, + BCS_NO_SCOPE = 1, + BCS_TRY_BLOCK = 2, + BCS_FN_BODY = 4, + BCS_TRANSACTION = 8 +}; +extern tree begin_compound_stmt (unsigned int); + +extern void finish_compound_stmt (tree); +extern tree finish_asm_stmt (int, tree, tree, tree, tree, + tree); +extern tree finish_label_stmt (tree); +extern void finish_label_decl (tree); +extern cp_expr finish_parenthesized_expr (cp_expr); +extern tree force_paren_expr (tree); +extern tree maybe_undo_parenthesized_ref (tree); +extern tree finish_non_static_data_member (tree, tree, tree); +extern tree begin_stmt_expr (void); +extern tree finish_stmt_expr_expr (tree, tree); +extern tree finish_stmt_expr (tree, bool); +extern tree stmt_expr_value_expr (tree); +bool empty_expr_stmt_p (tree); +extern cp_expr perform_koenig_lookup (cp_expr, vec *, + tsubst_flags_t); +extern tree finish_call_expr (tree, vec **, bool, + bool, tsubst_flags_t); +extern tree lookup_and_finish_template_variable (tree, tree, tsubst_flags_t = tf_warning_or_error); +extern tree finish_template_variable (tree, tsubst_flags_t = tf_warning_or_error); +extern cp_expr finish_increment_expr (cp_expr, enum tree_code); +extern tree finish_this_expr (void); +extern tree finish_pseudo_destructor_expr (tree, tree, tree, location_t); +extern cp_expr finish_unary_op_expr (location_t, enum tree_code, cp_expr, + tsubst_flags_t); +extern tree finish_compound_literal (tree, tree, tsubst_flags_t); +extern tree finish_fname (tree); +extern void finish_translation_unit (void); +extern tree finish_template_type_parm (tree, tree); +extern tree finish_template_template_parm (tree, tree); +extern tree begin_class_definition (tree); +extern void finish_template_decl (tree); +extern tree finish_template_type (tree, tree, int); +extern tree finish_base_specifier (tree, tree, bool); +extern void finish_member_declaration (tree); +extern bool outer_automatic_var_p (tree); +extern tree process_outer_var_ref (tree, tsubst_flags_t); +extern cp_expr finish_id_expression (tree, tree, tree, + cp_id_kind *, + bool, bool, bool *, + bool, bool, bool, bool, + const char **, + location_t); +extern tree finish_typeof (tree); +extern tree finish_underlying_type (tree); +extern tree calculate_bases (tree); +extern tree finish_bases (tree, bool); +extern tree calculate_direct_bases (tree); +extern tree finish_offsetof (tree, tree, location_t); +extern void finish_decl_cleanup (tree, tree); +extern void finish_eh_cleanup (tree); +extern void emit_associated_thunks (tree); +extern void finish_mem_initializers (tree); +extern tree check_template_template_default_arg (tree); +extern bool expand_or_defer_fn_1 (tree); +extern void expand_or_defer_fn (tree); +extern void add_typedef_to_current_template_for_access_check (tree, tree, + location_t); +extern void check_accessibility_of_qualified_id (tree, tree, tree); +extern tree finish_qualified_id_expr (tree, tree, bool, bool, + bool, bool, tsubst_flags_t); +extern void simplify_aggr_init_expr (tree *); +extern void finalize_nrv (tree *, tree, tree); +extern tree omp_reduction_id (enum tree_code, tree, tree); +extern tree cp_remove_omp_priv_cleanup_stmt (tree *, int *, void *); +extern void cp_check_omp_declare_reduction (tree); +extern void finish_omp_declare_simd_methods (tree); +extern tree finish_omp_clauses (tree, enum c_omp_region_type); +extern tree push_omp_privatization_clauses (bool); +extern void pop_omp_privatization_clauses (tree); +extern void save_omp_privatization_clauses (vec &); +extern void restore_omp_privatization_clauses (vec &); +extern void finish_omp_threadprivate (tree); +extern tree begin_omp_structured_block (void); +extern tree finish_omp_structured_block (tree); +extern tree finish_oacc_data (tree, tree); +extern tree finish_oacc_host_data (tree, tree); +extern tree finish_omp_construct (enum tree_code, tree, tree); +extern tree begin_omp_parallel (void); +extern tree finish_omp_parallel (tree, tree); +extern tree begin_omp_task (void); +extern tree finish_omp_task (tree, tree); +extern tree finish_omp_for (location_t, enum tree_code, + tree, tree, tree, tree, tree, + tree, tree, vec *, tree); +extern void finish_omp_atomic (enum tree_code, enum tree_code, + tree, tree, tree, tree, tree, + bool); +extern void finish_omp_barrier (void); +extern void finish_omp_flush (void); +extern void finish_omp_taskwait (void); +extern void finish_omp_taskyield (void); +extern void finish_omp_cancel (tree); +extern void finish_omp_cancellation_point (tree); +extern tree omp_privatize_field (tree, bool); +extern tree begin_transaction_stmt (location_t, tree *, int); +extern void finish_transaction_stmt (tree, tree, int, tree); +extern tree build_transaction_expr (location_t, tree, int, tree); +extern bool cxx_omp_create_clause_info (tree, tree, bool, bool, + bool, bool); +extern tree baselink_for_fns (tree); +extern void finish_static_assert (tree, tree, location_t, + bool); +extern tree finish_decltype_type (tree, bool, tsubst_flags_t); +extern tree finish_trait_expr (enum cp_trait_kind, tree, tree); +extern tree build_lambda_expr (void); +extern tree build_lambda_object (tree); +extern tree begin_lambda_type (tree); +extern tree lambda_capture_field_type (tree, bool, bool); +extern tree lambda_return_type (tree); +extern tree lambda_proxy_type (tree); +extern tree lambda_function (tree); +extern void apply_deduced_return_type (tree, tree); +extern tree add_capture (tree, tree, tree, bool, bool); +extern tree add_default_capture (tree, tree, tree); +extern tree build_capture_proxy (tree); +extern void insert_capture_proxy (tree); +extern void insert_pending_capture_proxies (void); +extern bool is_capture_proxy (tree); +extern bool is_normal_capture_proxy (tree); +extern void register_capture_members (tree); +extern tree lambda_expr_this_capture (tree, bool); +extern void maybe_generic_this_capture (tree, tree); +extern tree maybe_resolve_dummy (tree, bool); +extern tree current_nonlambda_function (void); +extern tree nonlambda_method_basetype (void); +extern tree current_nonlambda_scope (void); +extern bool generic_lambda_fn_p (tree); +extern void maybe_add_lambda_conv_op (tree); +extern bool is_lambda_ignored_entity (tree); +extern bool lambda_static_thunk_p (tree); +extern tree finish_builtin_launder (location_t, tree, + tsubst_flags_t); + +/* in tree.c */ +extern int cp_tree_operand_length (const_tree); +extern int cp_tree_code_length (enum tree_code); +void cp_free_lang_data (tree t); +extern tree force_target_expr (tree, tree, tsubst_flags_t); +extern tree build_target_expr_with_type (tree, tree, tsubst_flags_t); +extern void lang_check_failed (const char *, int, + const char *) ATTRIBUTE_NORETURN; +extern tree stabilize_expr (tree, tree *); +extern void stabilize_call (tree, tree *); +extern bool stabilize_init (tree, tree *); +extern tree add_stmt_to_compound (tree, tree); +extern void init_tree (void); +extern bool pod_type_p (const_tree); +extern bool layout_pod_type_p (const_tree); +extern bool std_layout_type_p (const_tree); +extern bool trivial_type_p (const_tree); +extern bool trivially_copyable_p (const_tree); +extern bool type_has_unique_obj_representations (const_tree); +extern bool scalarish_type_p (const_tree); +extern bool type_has_nontrivial_default_init (const_tree); +extern bool type_has_nontrivial_copy_init (const_tree); +extern bool class_tmpl_impl_spec_p (const_tree); +extern int zero_init_p (const_tree); +extern bool check_abi_tag_redeclaration (const_tree, const_tree, const_tree); +extern bool check_abi_tag_args (tree, tree); +extern tree strip_typedefs (tree, bool * = NULL); +extern tree strip_typedefs_expr (tree, bool * = NULL); +extern tree copy_binfo (tree, tree, tree, + tree *, int); +extern int member_p (const_tree); +extern cp_lvalue_kind real_lvalue_p (const_tree); +extern cp_lvalue_kind lvalue_kind (const_tree); +extern bool glvalue_p (const_tree); +extern bool obvalue_p (const_tree); +extern bool xvalue_p (const_tree); +extern bool bitfield_p (const_tree); +extern tree cp_stabilize_reference (tree); +extern bool builtin_valid_in_constant_expr_p (const_tree); +extern tree build_min (enum tree_code, tree, ...); +extern tree build_min_nt_loc (location_t, enum tree_code, + ...); +extern tree build_min_non_dep (enum tree_code, tree, ...); +extern tree build_min_non_dep_op_overload (enum tree_code, tree, tree, ...); +extern tree build_min_non_dep_call_vec (tree, tree, vec *); +extern vec* vec_copy_and_insert (vec*, tree, unsigned); +extern tree build_cplus_new (tree, tree, tsubst_flags_t); +extern tree build_aggr_init_expr (tree, tree); +extern tree get_target_expr (tree); +extern tree get_target_expr_sfinae (tree, tsubst_flags_t); +extern tree build_cplus_array_type (tree, tree); +extern tree build_array_of_n_type (tree, int); +extern bool array_of_runtime_bound_p (tree); +extern tree build_array_copy (tree); +extern tree build_vec_init_expr (tree, tree, tsubst_flags_t); +extern void diagnose_non_constexpr_vec_init (tree); +extern tree hash_tree_cons (tree, tree, tree); +extern tree hash_tree_chain (tree, tree); +extern tree build_qualified_name (tree, tree, tree, bool); +extern tree build_ref_qualified_type (tree, cp_ref_qualifier); +extern int is_overloaded_fn (tree); +extern tree dependent_name (tree); +extern tree get_fns (tree); +extern tree get_first_fn (tree); +extern tree ovl_cons (tree, tree); +extern tree build_overload (tree, tree); +extern tree ovl_scope (tree); +extern const char *cxx_printable_name (tree, int); +extern const char *cxx_printable_name_translate (tree, int); +extern tree canonical_eh_spec (tree); +extern tree build_exception_variant (tree, tree); +extern tree bind_template_template_parm (tree, tree); +extern tree array_type_nelts_total (tree); +extern tree array_type_nelts_top (tree); +extern tree break_out_target_exprs (tree); +extern tree build_ctor_subob_ref (tree, tree, tree); +extern tree replace_placeholders (tree, tree, bool * = NULL); +extern tree get_type_decl (tree); +extern tree decl_namespace_context (tree); +extern bool decl_anon_ns_mem_p (const_tree); +extern tree lvalue_type (tree); +extern tree error_type (tree); +extern int varargs_function_p (const_tree); +extern bool really_overloaded_fn (tree); +extern bool cp_tree_equal (tree, tree); +extern tree no_linkage_check (tree, bool); +extern void debug_binfo (tree); +extern tree build_dummy_object (tree); +extern tree maybe_dummy_object (tree, tree *); +extern int is_dummy_object (const_tree); +extern const struct attribute_spec cxx_attribute_table[]; +extern tree make_ptrmem_cst (tree, tree); +extern tree cp_build_type_attribute_variant (tree, tree); +extern tree cp_build_reference_type (tree, bool); +extern tree move (tree); +extern tree cp_build_qualified_type_real (tree, int, tsubst_flags_t); +#define cp_build_qualified_type(TYPE, QUALS) \ + cp_build_qualified_type_real ((TYPE), (QUALS), tf_warning_or_error) +extern bool cv_qualified_p (const_tree); +extern tree cv_unqualified (tree); +extern special_function_kind special_function_p (const_tree); +extern int count_trees (tree); +extern int char_type_p (tree); +extern void verify_stmt_tree (tree); +extern linkage_kind decl_linkage (tree); +extern duration_kind decl_storage_duration (tree); +extern tree cp_walk_subtrees (tree*, int*, walk_tree_fn, + void*, hash_set *); +#define cp_walk_tree(tp,func,data,pset) \ + walk_tree_1 (tp, func, data, pset, cp_walk_subtrees) +#define cp_walk_tree_without_duplicates(tp,func,data) \ + walk_tree_without_duplicates_1 (tp, func, data, cp_walk_subtrees) +extern tree rvalue (tree); +extern tree convert_bitfield_to_declared_type (tree); +extern tree cp_save_expr (tree); +extern bool cast_valid_in_integral_constant_expression_p (tree); +extern bool cxx_type_hash_eq (const_tree, const_tree); +extern tree cxx_copy_lang_qualifiers (const_tree, const_tree); + +extern void cxx_print_statistics (void); +extern bool maybe_warn_zero_as_null_pointer_constant (tree, location_t); + +/* in ptree.c */ +extern void cxx_print_xnode (FILE *, tree, int); +extern void cxx_print_decl (FILE *, tree, int); +extern void cxx_print_type (FILE *, tree, int); +extern void cxx_print_identifier (FILE *, tree, int); +extern void cxx_print_error_function (diagnostic_context *, + const char *, + struct diagnostic_info *); + +/* in typeck.c */ +extern bool cxx_mark_addressable (tree, bool = false); +extern int string_conv_p (const_tree, const_tree, int); +extern tree cp_truthvalue_conversion (tree); +extern tree condition_conversion (tree); +extern tree require_complete_type (tree); +extern tree require_complete_type_sfinae (tree, tsubst_flags_t); +extern tree complete_type (tree); +extern tree complete_type_or_else (tree, tree); +extern tree complete_type_or_maybe_complain (tree, tree, tsubst_flags_t); +extern int type_unknown_p (const_tree); +enum { ce_derived, ce_type, ce_normal, ce_exact }; +extern bool comp_except_specs (const_tree, const_tree, int); +extern bool comptypes (tree, tree, int); +extern bool same_type_ignoring_top_level_qualifiers_p (tree, tree); +extern bool compparms (const_tree, const_tree); +extern int comp_cv_qualification (const_tree, const_tree); +extern int comp_cv_qualification (int, int); +extern int comp_cv_qual_signature (tree, tree); +extern tree cxx_sizeof_or_alignof_expr (tree, enum tree_code, bool); +extern tree cxx_sizeof_or_alignof_type (tree, enum tree_code, bool); +extern tree cxx_alignas_expr (tree); +extern tree cxx_sizeof_nowarn (tree); +extern tree is_bitfield_expr_with_lowered_type (const_tree); +extern tree unlowered_expr_type (const_tree); +extern tree decay_conversion (tree, + tsubst_flags_t, + bool = true); +extern tree build_class_member_access_expr (cp_expr, tree, tree, bool, + tsubst_flags_t); +extern tree finish_class_member_access_expr (cp_expr, tree, bool, + tsubst_flags_t); +extern tree build_x_indirect_ref (location_t, tree, + ref_operator, tsubst_flags_t); +extern tree cp_build_indirect_ref (tree, ref_operator, + tsubst_flags_t); +extern tree build_array_ref (location_t, tree, tree); +extern tree cp_build_array_ref (location_t, tree, tree, + tsubst_flags_t); +extern tree get_member_function_from_ptrfunc (tree *, tree, tsubst_flags_t); +extern tree cp_build_function_call_nary (tree, tsubst_flags_t, ...) + ATTRIBUTE_SENTINEL; +extern tree cp_build_function_call_vec (tree, vec **, + tsubst_flags_t); +extern tree build_x_binary_op (location_t, + enum tree_code, tree, + enum tree_code, tree, + enum tree_code, tree *, + tsubst_flags_t); +extern tree build_x_array_ref (location_t, tree, tree, + tsubst_flags_t); +extern tree build_x_unary_op (location_t, + enum tree_code, cp_expr, + tsubst_flags_t); +extern tree cp_build_addressof (location_t, tree, + tsubst_flags_t); +extern tree cp_build_addr_expr (tree, tsubst_flags_t); +extern tree cp_build_unary_op (enum tree_code, tree, bool, + tsubst_flags_t); +extern tree unary_complex_lvalue (enum tree_code, tree); +extern tree build_x_conditional_expr (location_t, tree, tree, tree, + tsubst_flags_t); +extern tree build_x_compound_expr_from_list (tree, expr_list_kind, + tsubst_flags_t); +extern tree build_x_compound_expr_from_vec (vec *, + const char *, tsubst_flags_t); +extern tree build_x_compound_expr (location_t, tree, tree, + tsubst_flags_t); +extern tree build_compound_expr (location_t, tree, tree); +extern tree cp_build_compound_expr (tree, tree, tsubst_flags_t); +extern tree build_static_cast (tree, tree, tsubst_flags_t); +extern tree build_reinterpret_cast (tree, tree, tsubst_flags_t); +extern tree build_const_cast (tree, tree, tsubst_flags_t); +extern tree build_c_cast (location_t, tree, tree); +extern cp_expr build_c_cast (location_t loc, tree type, + cp_expr expr); +extern tree cp_build_c_cast (tree, tree, tsubst_flags_t); +extern cp_expr build_x_modify_expr (location_t, tree, + enum tree_code, tree, + tsubst_flags_t); +extern tree cp_build_modify_expr (location_t, tree, + enum tree_code, tree, + tsubst_flags_t); +extern tree convert_for_initialization (tree, tree, tree, int, + impl_conv_rhs, tree, int, + tsubst_flags_t); +extern int comp_ptr_ttypes (tree, tree); +extern bool comp_ptr_ttypes_const (tree, tree); +extern bool error_type_p (const_tree); +extern bool ptr_reasonably_similar (const_tree, const_tree); +extern tree build_ptrmemfunc (tree, tree, int, bool, + tsubst_flags_t); +extern int cp_type_quals (const_tree); +extern int type_memfn_quals (const_tree); +extern cp_ref_qualifier type_memfn_rqual (const_tree); +extern tree apply_memfn_quals (tree, cp_cv_quals, cp_ref_qualifier); +extern bool cp_has_mutable_p (const_tree); +extern bool at_least_as_qualified_p (const_tree, const_tree); +extern void cp_apply_type_quals_to_decl (int, tree); +extern tree build_ptrmemfunc1 (tree, tree, tree); +extern void expand_ptrmemfunc_cst (tree, tree *, tree *); +extern tree type_after_usual_arithmetic_conversions (tree, tree); +extern tree common_pointer_type (tree, tree); +extern tree composite_pointer_type (tree, tree, tree, tree, + composite_pointer_operation, + tsubst_flags_t); +extern tree merge_types (tree, tree); +extern tree strip_array_domain (tree); +extern tree check_return_expr (tree, bool *); +extern tree cp_build_binary_op (location_t, + enum tree_code, tree, tree, + tsubst_flags_t); +extern tree build_x_vec_perm_expr (location_t, + tree, tree, tree, + tsubst_flags_t); +#define cxx_sizeof(T) cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, true) +extern tree build_simple_component_ref (tree, tree); +extern tree build_ptrmemfunc_access_expr (tree, tree); +extern tree build_address (tree); +extern tree build_nop (tree, tree); +extern tree non_reference (tree); +extern tree lookup_anon_field (tree, tree); +extern bool invalid_nonstatic_memfn_p (location_t, tree, + tsubst_flags_t); +extern tree convert_member_func_to_ptr (tree, tree, tsubst_flags_t); +extern tree convert_ptrmem (tree, tree, bool, bool, + tsubst_flags_t); +extern int lvalue_or_else (tree, enum lvalue_use, + tsubst_flags_t); +extern void check_template_keyword (tree); +extern bool check_raw_literal_operator (const_tree decl); +extern bool check_literal_operator_args (const_tree, bool *, bool *); +extern void maybe_warn_about_useless_cast (tree, tree, tsubst_flags_t); +extern tree cp_perform_integral_promotions (tree, tsubst_flags_t); + +extern tree finish_left_unary_fold_expr (tree, int); +extern tree finish_right_unary_fold_expr (tree, int); +extern tree finish_binary_fold_expr (tree, tree, int); + +/* in typeck2.c */ +extern void require_complete_eh_spec_types (tree, tree); +extern void cxx_incomplete_type_diagnostic (location_t, const_tree, + const_tree, diagnostic_t); +inline void +cxx_incomplete_type_diagnostic (const_tree value, const_tree type, + diagnostic_t diag_kind) +{ + cxx_incomplete_type_diagnostic (EXPR_LOC_OR_LOC (value, input_location), + value, type, diag_kind); +} + +extern void cxx_incomplete_type_error (location_t, const_tree, + const_tree); +inline void +cxx_incomplete_type_error (const_tree value, const_tree type) +{ + cxx_incomplete_type_diagnostic (value, type, DK_ERROR); +} + +extern void cxx_incomplete_type_inform (const_tree); +extern tree error_not_base_type (tree, tree); +extern tree binfo_or_else (tree, tree); +extern void cxx_readonly_error (tree, enum lvalue_use); +extern void complete_type_check_abstract (tree); +extern int abstract_virtuals_error (tree, tree); +extern int abstract_virtuals_error (abstract_class_use, tree); +extern int abstract_virtuals_error_sfinae (tree, tree, tsubst_flags_t); +extern int abstract_virtuals_error_sfinae (abstract_class_use, tree, tsubst_flags_t); + +extern tree store_init_value (tree, tree, vec**, int); +extern tree split_nonconstant_init (tree, tree); +extern bool check_narrowing (tree, tree, tsubst_flags_t); +extern tree digest_init (tree, tree, tsubst_flags_t); +extern tree digest_init_flags (tree, tree, int, tsubst_flags_t); +extern tree digest_nsdmi_init (tree, tree); +extern tree build_scoped_ref (tree, tree, tree *); +extern tree build_x_arrow (location_t, tree, + tsubst_flags_t); +extern tree build_m_component_ref (tree, tree, tsubst_flags_t); +extern tree build_functional_cast (tree, tree, tsubst_flags_t); +extern tree add_exception_specifier (tree, tree, int); +extern tree merge_exception_specifiers (tree, tree); + +/* in mangle.c */ +extern bool maybe_remove_implicit_alias (tree); +extern void init_mangle (void); +extern void mangle_decl (tree); +extern const char *mangle_type_string (tree); +extern tree mangle_typeinfo_for_type (tree); +extern tree mangle_typeinfo_string_for_type (tree); +extern tree mangle_vtbl_for_type (tree); +extern tree mangle_vtt_for_type (tree); +extern tree mangle_ctor_vtbl_for_type (tree, tree); +extern tree mangle_thunk (tree, int, tree, tree, tree); +extern tree mangle_conv_op_name_for_type (tree); +extern tree mangle_guard_variable (tree); +extern tree mangle_tls_init_fn (tree); +extern tree mangle_tls_wrapper_fn (tree); +extern bool decl_tls_wrapper_p (tree); +extern tree mangle_ref_init_variable (tree); +extern char * get_mangled_vtable_map_var_name (tree); +extern bool mangle_return_type_p (tree); +extern tree mangle_decomp (tree, vec &); + +/* in dump.c */ +extern bool cp_dump_tree (void *, tree); + +/* In cp/cp-objcp-common.c. */ + +extern alias_set_type cxx_get_alias_set (tree); +extern bool cxx_warn_unused_global_decl (const_tree); +extern size_t cp_tree_size (enum tree_code); +extern bool cp_var_mod_type_p (tree, tree); +extern void cxx_initialize_diagnostics (diagnostic_context *); +extern int cxx_types_compatible_p (tree, tree); +extern void init_shadowed_var_for_decl (void); +extern bool cxx_block_may_fallthru (const_tree); + +/* in cp-gimplify.c */ +extern int cp_gimplify_expr (tree *, gimple_seq *, + gimple_seq *); +extern void cp_genericize (tree); +extern bool cxx_omp_const_qual_no_mutable (tree); +extern enum omp_clause_default_kind cxx_omp_predetermined_sharing (tree); +extern tree cxx_omp_clause_default_ctor (tree, tree, tree); +extern tree cxx_omp_clause_copy_ctor (tree, tree, tree); +extern tree cxx_omp_clause_assign_op (tree, tree, tree); +extern tree cxx_omp_clause_dtor (tree, tree); +extern void cxx_omp_finish_clause (tree, gimple_seq *); +extern bool cxx_omp_privatize_by_reference (const_tree); +extern bool cxx_omp_disregard_value_expr (tree, bool); +extern void cp_fold_function (tree); +extern tree cp_fully_fold (tree); +extern void clear_fold_cache (void); + +/* in name-lookup.c */ +extern void suggest_alternatives_for (location_t, tree, bool); +extern bool suggest_alternative_in_explicit_scope (location_t, tree, tree); +extern tree strip_using_decl (tree); + +/* Tell the binding oracle what kind of binding we are looking for. */ + +enum cp_oracle_request +{ + CP_ORACLE_IDENTIFIER +}; + +/* If this is non-NULL, then it is a "binding oracle" which can lazily + create bindings when needed by the C compiler. The oracle is told + the name and type of the binding to create. It can call pushdecl + or the like to ensure the binding is visible; or do nothing, + leaving the binding untouched. c-decl.c takes note of when the + oracle has been called and will not call it again if it fails to + create a given binding. */ + +typedef void cp_binding_oracle_function (enum cp_oracle_request, tree identifier); + +extern cp_binding_oracle_function *cp_binding_oracle; + +/* in constraint.cc */ +extern void init_constraint_processing (); +extern bool constraint_p (tree); +extern tree conjoin_constraints (tree, tree); +extern tree conjoin_constraints (tree); +extern tree get_constraints (tree); +extern void set_constraints (tree, tree); +extern void remove_constraints (tree); +extern tree current_template_constraints (void); +extern tree associate_classtype_constraints (tree); +extern tree build_constraints (tree, tree); +extern tree get_shorthand_constraints (tree); +extern tree build_concept_check (tree, tree, tree = NULL_TREE); +extern tree build_constrained_parameter (tree, tree, tree = NULL_TREE); +extern tree make_constrained_auto (tree, tree); +extern void placeholder_extract_concept_and_args (tree, tree&, tree&); +extern bool equivalent_placeholder_constraints (tree, tree); +extern hashval_t hash_placeholder_constraint (tree); +extern bool deduce_constrained_parameter (tree, tree&, tree&); +extern tree resolve_constraint_check (tree); +extern tree check_function_concept (tree); +extern tree finish_template_introduction (tree, tree); +extern bool valid_requirements_p (tree); +extern tree finish_concept_name (tree); +extern tree finish_shorthand_constraint (tree, tree); +extern tree finish_requires_expr (tree, tree); +extern tree finish_simple_requirement (tree); +extern tree finish_type_requirement (tree); +extern tree finish_compound_requirement (tree, tree, bool); +extern tree finish_nested_requirement (tree); +extern void check_constrained_friend (tree, tree); +extern tree tsubst_requires_expr (tree, tree, tsubst_flags_t, tree); +extern tree tsubst_constraint (tree, tree, tsubst_flags_t, tree); +extern tree tsubst_constraint_info (tree, tree, tsubst_flags_t, tree); +extern bool function_concept_check_p (tree); +extern tree normalize_expression (tree); +extern tree expand_concept (tree, tree); +extern bool expanding_concept (); +extern tree evaluate_constraints (tree, tree); +extern tree evaluate_function_concept (tree, tree); +extern tree evaluate_variable_concept (tree, tree); +extern tree evaluate_constraint_expression (tree, tree); +extern bool constraints_satisfied_p (tree); +extern bool constraints_satisfied_p (tree, tree); +extern tree lookup_constraint_satisfaction (tree, tree); +extern tree memoize_constraint_satisfaction (tree, tree, tree); +extern tree lookup_concept_satisfaction (tree, tree); +extern tree memoize_concept_satisfaction (tree, tree, tree); +extern tree get_concept_expansion (tree, tree); +extern tree save_concept_expansion (tree, tree, tree); +extern bool* lookup_subsumption_result (tree, tree); +extern bool save_subsumption_result (tree, tree, bool); + +extern bool equivalent_constraints (tree, tree); +extern bool equivalently_constrained (tree, tree); +extern bool subsumes_constraints (tree, tree); +extern bool strictly_subsumes (tree, tree); +extern int more_constrained (tree, tree); + +extern void diagnose_constraints (location_t, tree, tree); + +/* in logic.cc */ +extern tree decompose_conclusions (tree); +extern bool subsumes (tree, tree); + +/* In class.c */ +extern void cp_finish_injected_record_type (tree); + +/* in vtable-class-hierarchy.c */ +extern void vtv_compute_class_hierarchy_transitive_closure (void); +extern void vtv_generate_init_routine (void); +extern void vtv_save_class_info (tree); +extern void vtv_recover_class_info (void); +extern void vtv_build_vtable_verify_fndecl (void); + +/* In cp/cp-array-notations.c */ +extern tree expand_array_notation_exprs (tree); +bool cilkplus_an_triplet_types_ok_p (location_t, tree, tree, tree, + tree); + +/* In constexpr.c */ +extern void fini_constexpr (void); +extern bool literal_type_p (tree); +extern tree register_constexpr_fundef (tree, tree); +extern bool is_valid_constexpr_fn (tree, bool); +extern bool check_constexpr_ctor_body (tree, tree, bool); +extern tree ensure_literal_type_for_constexpr_object (tree); +extern bool potential_constant_expression (tree); +extern bool potential_nondependent_constant_expression (tree); +extern bool potential_nondependent_static_init_expression (tree); +extern bool potential_static_init_expression (tree); +extern bool potential_rvalue_constant_expression (tree); +extern bool require_potential_constant_expression (tree); +extern bool require_potential_rvalue_constant_expression (tree); +extern tree cxx_constant_value (tree, tree = NULL_TREE); +extern tree maybe_constant_value (tree, tree = NULL_TREE); +extern tree maybe_constant_init (tree, tree = NULL_TREE); +extern tree fold_non_dependent_expr (tree); +extern tree fold_simple (tree); +extern bool is_sub_constant_expr (tree); +extern bool reduced_constant_expression_p (tree); +extern bool is_instantiation_of_constexpr (tree); +extern bool var_in_constexpr_fn (tree); +extern bool var_in_maybe_constexpr_fn (tree); +extern void explain_invalid_constexpr_fn (tree); +extern vec cx_error_context (void); +extern tree fold_sizeof_expr (tree); +extern void clear_cv_and_fold_caches (void); + +/* In c-family/cilk.c */ +extern bool cilk_valid_spawn (tree); + +/* In cp-ubsan.c */ +extern void cp_ubsan_maybe_instrument_member_call (tree); +extern void cp_ubsan_instrument_member_accesses (tree *); +extern tree cp_ubsan_maybe_instrument_downcast (location_t, tree, tree, tree); +extern tree cp_ubsan_maybe_instrument_cast_to_vbase (location_t, tree, tree); +extern void cp_ubsan_maybe_initialize_vtbl_ptrs (tree); + +/* -- end of C++ */ + +#endif /* ! GCC_CP_TREE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cp/cxx-pretty-print.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cp/cxx-pretty-print.h new file mode 100644 index 0000000..72e6559 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cp/cxx-pretty-print.h @@ -0,0 +1,113 @@ +/* Interface for the GNU C++ pretty-printer. + Copyright (C) 2003-2017 Free Software Foundation, Inc. + Contributed by Gabriel Dos Reis + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_CXX_PRETTY_PRINT_H +#define GCC_CXX_PRETTY_PRINT_H + +#include "c-family/c-pretty-print.h" + +enum cxx_pretty_printer_flags +{ + /* Ask for a qualified-id. */ + pp_cxx_flag_default_argument = 1 << pp_c_flag_last_bit +}; + +struct cxx_pretty_printer : c_pretty_printer +{ + cxx_pretty_printer (); + + void constant (tree); + void id_expression (tree); + void primary_expression (tree); + void postfix_expression (tree); + void unary_expression (tree); + void multiplicative_expression (tree); + void conditional_expression (tree); + void assignment_expression (tree); + void expression (tree); + void type_id (tree); + void statement (tree); + void declaration (tree); + void declaration_specifiers (tree); + void simple_type_specifier (tree); + void function_specifier (tree); + void declarator (tree); + void direct_declarator (tree); + void abstract_declarator (tree); + void direct_abstract_declarator (tree); + + /* This is the enclosing scope of the entity being pretty-printed. */ + tree enclosing_scope; +}; + +#define pp_cxx_cv_qualifier_seq(PP, T) \ + pp_c_type_qualifier_list (PP, T) +#define pp_cxx_cv_qualifiers(PP, CV, FT) \ + pp_c_cv_qualifiers (PP, CV, FT) + +#define pp_cxx_whitespace(PP) pp_c_whitespace (PP) +#define pp_cxx_left_paren(PP) pp_c_left_paren (PP) +#define pp_cxx_right_paren(PP) pp_c_right_paren (PP) +#define pp_cxx_left_brace(PP) pp_c_left_brace (PP) +#define pp_cxx_right_brace(PP) pp_c_right_brace (PP) +#define pp_cxx_left_bracket(PP) pp_c_left_bracket (PP) +#define pp_cxx_right_bracket(PP) pp_c_right_bracket (PP) +#define pp_cxx_dot(PP) pp_c_dot (PP) +#define pp_cxx_ampersand(PP) pp_c_ampersand (PP) +#define pp_cxx_star(PP) pp_c_star (PP) +#define pp_cxx_arrow(PP) pp_c_arrow (PP) +#define pp_cxx_semicolon(PP) pp_c_semicolon (PP) +#define pp_cxx_complement(PP) pp_c_complement (PP) + +#define pp_cxx_ws_string(PP, I) pp_c_ws_string (PP, I) +#define pp_cxx_identifier(PP, I) pp_c_identifier (PP, I) +#define pp_cxx_tree_identifier(PP, T) \ + pp_c_tree_identifier (PP, T) + +void pp_cxx_begin_template_argument_list (cxx_pretty_printer *); +void pp_cxx_end_template_argument_list (cxx_pretty_printer *); +void pp_cxx_colon_colon (cxx_pretty_printer *); +void pp_cxx_separate_with (cxx_pretty_printer *, int); + +void pp_cxx_canonical_template_parameter (cxx_pretty_printer *, tree); +void pp_cxx_trait_expression (cxx_pretty_printer *, tree); +void pp_cxx_va_arg_expression (cxx_pretty_printer *, tree); +void pp_cxx_offsetof_expression (cxx_pretty_printer *, tree); +void pp_cxx_addressof_expression (cxx_pretty_printer *, tree); +void pp_cxx_userdef_literal (cxx_pretty_printer *, tree); +void pp_cxx_requires_clause (cxx_pretty_printer *, tree); +void pp_cxx_requires_expr (cxx_pretty_printer *, tree); +void pp_cxx_simple_requirement (cxx_pretty_printer *, tree); +void pp_cxx_type_requirement (cxx_pretty_printer *, tree); +void pp_cxx_compound_requirement (cxx_pretty_printer *, tree); +void pp_cxx_nested_requirement (cxx_pretty_printer *, tree); +void pp_cxx_predicate_constraint (cxx_pretty_printer *, tree); +void pp_cxx_expression_constraint (cxx_pretty_printer *, tree); +void pp_cxx_type_constraint (cxx_pretty_printer *, tree); +void pp_cxx_implicit_conversion_constraint (cxx_pretty_printer *, tree); +void pp_cxx_argument_deduction_constraint (cxx_pretty_printer *, tree); +void pp_cxx_exception_constraint (cxx_pretty_printer *, tree); +void pp_cxx_parameterized_constraint (cxx_pretty_printer *, tree); +void pp_cxx_conjunction (cxx_pretty_printer *, tree); +void pp_cxx_disjunction (cxx_pretty_printer *, tree); +void pp_cxx_constraint (cxx_pretty_printer *, tree); +void pp_cxx_constrained_type_spec (cxx_pretty_printer *, tree); + +#endif /* GCC_CXX_PRETTY_PRINT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cp/name-lookup.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cp/name-lookup.h new file mode 100644 index 0000000..8d8d723 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cp/name-lookup.h @@ -0,0 +1,379 @@ +/* Declarations for C++ name lookup routines. + Copyright (C) 2003-2017 Free Software Foundation, Inc. + Contributed by Gabriel Dos Reis + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_CP_NAME_LOOKUP_H +#define GCC_CP_NAME_LOOKUP_H + +#include "c-family/c-common.h" + +/* The type of dictionary used to map names to types declared at + a given scope. */ +typedef struct binding_table_s *binding_table; +typedef struct binding_entry_s *binding_entry; + +/* The type of a routine repeatedly called by binding_table_foreach. */ +typedef void (*bt_foreach_proc) (binding_entry, void *); + +struct GTY(()) binding_entry_s { + binding_entry chain; + tree name; + tree type; +}; + +/* These macros indicate the initial chains count for binding_table. */ +#define SCOPE_DEFAULT_HT_SIZE (1 << 3) +#define CLASS_SCOPE_HT_SIZE (1 << 3) +#define NAMESPACE_ORDINARY_HT_SIZE (1 << 5) +#define NAMESPACE_STD_HT_SIZE (1 << 8) +#define GLOBAL_SCOPE_HT_SIZE (1 << 8) + +extern void binding_table_foreach (binding_table, bt_foreach_proc, void *); +extern binding_entry binding_table_find (binding_table, tree); + +/* Datatype that represents binding established by a declaration between + a name and a C++ entity. */ +typedef struct cxx_binding cxx_binding; + +/* The datatype used to implement C++ scope. */ +typedef struct cp_binding_level cp_binding_level; + +/* Nonzero if this binding is for a local scope, as opposed to a class + or namespace scope. */ +#define LOCAL_BINDING_P(NODE) ((NODE)->is_local) + +/* True if NODE->value is from a base class of the class which is + currently being defined. */ +#define INHERITED_VALUE_BINDING_P(NODE) ((NODE)->value_is_inherited) + +struct GTY(()) cxx_binding { + /* Link to chain together various bindings for this name. */ + cxx_binding *previous; + /* The non-type entity this name is bound to. */ + tree value; + /* The type entity this name is bound to. */ + tree type; + /* The scope at which this binding was made. */ + cp_binding_level *scope; + unsigned value_is_inherited : 1; + unsigned is_local : 1; +}; + +/* Datatype used to temporarily save C++ bindings (for implicit + instantiations purposes and like). Implemented in decl.c. */ +struct GTY(()) cxx_saved_binding { + /* The name of the current binding. */ + tree identifier; + /* The binding we're saving. */ + cxx_binding *binding; + tree real_type_value; +}; + + +extern tree identifier_type_value (tree); +extern void set_identifier_type_value (tree, tree); +extern void push_binding (tree, tree, cp_binding_level*); +extern void pop_binding (tree, tree); +extern void pop_bindings_and_leave_scope (void); +extern tree constructor_name (tree); +extern bool constructor_name_p (tree, tree); + +/* The kinds of scopes we recognize. */ +enum scope_kind { + sk_block = 0, /* An ordinary block scope. This enumerator must + have the value zero because "cp_binding_level" + is initialized by using "memset" to set the + contents to zero, and the default scope kind + is "sk_block". */ + sk_cleanup, /* A scope for (pseudo-)scope for cleanup. It is + pseudo in that it is transparent to name lookup + activities. */ + sk_try, /* A try-block. */ + sk_catch, /* A catch-block. */ + sk_for, /* The scope of the variable declared in a + init-statement. */ + sk_cond, /* The scope of the variable declared in the condition + of an if or switch statement. */ + sk_function_parms, /* The scope containing function parameters. */ + sk_class, /* The scope containing the members of a class. */ + sk_scoped_enum, /* The scope containing the enumertors of a C++0x + scoped enumeration. */ + sk_namespace, /* The scope containing the members of a + namespace, including the global scope. */ + sk_template_parms, /* A scope for template parameters. */ + sk_template_spec, /* Like sk_template_parms, but for an explicit + specialization. Since, by definition, an + explicit specialization is introduced by + "template <>", this scope is always empty. */ + sk_transaction, /* A synchronized or atomic statement. */ + sk_omp /* An OpenMP structured block. */ +}; + +/* The scope where the class/struct/union/enum tag applies. */ +enum tag_scope { + ts_current = 0, /* Current scope only. This is for the + class-key identifier; + case mentioned in [basic.lookup.elab]/2, + or the class/enum definition + class-key identifier { ... }; */ + ts_global = 1, /* All scopes. This is the 3.4.1 + [basic.lookup.unqual] lookup mentioned + in [basic.lookup.elab]/2. */ + ts_within_enclosing_non_class = 2, /* Search within enclosing non-class + only, for friend class lookup + according to [namespace.memdef]/3 + and [class.friend]/9. */ + ts_lambda = 3 /* Declaring a lambda closure. */ +}; + +struct GTY(()) cp_class_binding { + cxx_binding *base; + /* The bound name. */ + tree identifier; +}; + + +struct GTY(()) cp_label_binding { + /* The bound LABEL_DECL. */ + tree label; + /* The previous IDENTIFIER_LABEL_VALUE. */ + tree prev_value; +}; + + +/* For each binding contour we allocate a binding_level structure + which records the names defined in that contour. + Contours include: + 0) the global one + 1) one for each function definition, + where internal declarations of the parameters appear. + 2) one for each compound statement, + to record its declarations. + + The current meaning of a name can be found by searching the levels + from the current one out to the global one. + + Off to the side, may be the class_binding_level. This exists only + to catch class-local declarations. It is otherwise nonexistent. + + Also there may be binding levels that catch cleanups that must be + run when exceptions occur. Thus, to see whether a name is bound in + the current scope, it is not enough to look in the + CURRENT_BINDING_LEVEL. You should use lookup_name_current_level + instead. */ + +/* Note that the information in the `names' component of the global contour + is duplicated in the IDENTIFIER_GLOBAL_VALUEs of all identifiers. */ + +struct GTY(()) cp_binding_level { + /* A chain of _DECL nodes for all variables, constants, functions, + and typedef types. These are in the reverse of the order + supplied. There may be OVERLOADs on this list, too, but they + are wrapped in TREE_LISTs; the TREE_VALUE is the OVERLOAD. */ + tree names; + + /* A chain of NAMESPACE_DECL nodes. */ + tree namespaces; + + /* An array of static functions and variables (for namespaces only) */ + vec *static_decls; + + /* A list of USING_DECL nodes. */ + tree usings; + + /* A list of used namespaces. PURPOSE is the namespace, + VALUE the common ancestor with this binding_level's namespace. */ + tree using_directives; + + /* For the binding level corresponding to a class, the entities + declared in the class or its base classes. */ + vec *class_shadowed; + + /* Similar to class_shadowed, but for IDENTIFIER_TYPE_VALUE, and + is used for all binding levels. The TREE_PURPOSE is the name of + the entity, the TREE_TYPE is the associated type. In addition + the TREE_VALUE is the IDENTIFIER_TYPE_VALUE before we entered + the class. */ + tree type_shadowed; + + /* Similar to class_shadowed, but for IDENTIFIER_LABEL_VALUE, and + used for all binding levels. */ + vec *shadowed_labels; + + /* For each level (except not the global one), + a chain of BLOCK nodes for all the levels + that were entered and exited one level down. */ + tree blocks; + + /* The entity (namespace, class, function) the scope of which this + binding contour corresponds to. Otherwise NULL. */ + tree this_entity; + + /* The binding level which this one is contained in (inherits from). */ + cp_binding_level *level_chain; + + /* List of VAR_DECLS saved from a previous for statement. + These would be dead in ISO-conforming code, but might + be referenced in ARM-era code. */ + vec *dead_vars_from_for; + + /* STATEMENT_LIST for statements in this binding contour. + Only used at present for SK_CLEANUP temporary bindings. */ + tree statement_list; + + /* Binding depth at which this level began. */ + int binding_depth; + + /* The kind of scope that this object represents. However, a + SK_TEMPLATE_SPEC scope is represented with KIND set to + SK_TEMPLATE_PARMS and EXPLICIT_SPEC_P set to true. */ + ENUM_BITFIELD (scope_kind) kind : 4; + + /* True if this scope is an SK_TEMPLATE_SPEC scope. This field is + only valid if KIND == SK_TEMPLATE_PARMS. */ + BOOL_BITFIELD explicit_spec_p : 1; + + /* true means make a BLOCK for this level regardless of all else. */ + unsigned keep : 1; + + /* Nonzero if this level can safely have additional + cleanup-needing variables added to it. */ + unsigned more_cleanups_ok : 1; + unsigned have_cleanups : 1; + + /* Transient state set if this scope is of sk_class kind + and is in the process of defining 'this_entity'. Reset + on leaving the class definition to allow for the scope + to be subsequently re-used as a non-defining scope for + 'this_entity'. */ + unsigned defining_class_p : 1; + + /* 23 bits left to fill a 32-bit word. */ +}; + +/* The binding level currently in effect. */ + +#define current_binding_level \ + (*(cfun && cp_function_chain && cp_function_chain->bindings \ + ? &cp_function_chain->bindings \ + : &scope_chain->bindings)) + +/* The binding level of the current class, if any. */ + +#define class_binding_level scope_chain->class_bindings + +/* The tree node representing the global scope. */ +extern GTY(()) tree global_namespace; +extern GTY(()) tree global_scope_name; + +/* Indicates that there is a type value in some namespace, although + that is not necessarily in scope at the moment. */ + +extern GTY(()) tree global_type_node; + +/* True if SCOPE designates the global scope binding contour. */ +#define global_scope_p(SCOPE) \ + ((SCOPE) == NAMESPACE_LEVEL (global_namespace)) + +extern cp_binding_level *leave_scope (void); +extern bool kept_level_p (void); +extern bool global_bindings_p (void); +extern bool toplevel_bindings_p (void); +extern bool namespace_bindings_p (void); +extern bool local_bindings_p (void); +extern bool template_parm_scope_p (void); +extern scope_kind innermost_scope_kind (void); +extern cp_binding_level *begin_scope (scope_kind, tree); +extern void print_binding_stack (void); +extern void push_to_top_level (void); +extern void pop_from_top_level (void); +extern void pop_everything (void); +extern void keep_next_level (bool); +extern bool is_ancestor (tree, tree); +extern tree push_scope (tree); +extern void pop_scope (tree); +extern tree push_inner_scope (tree); +extern void pop_inner_scope (tree, tree); +extern void push_binding_level (cp_binding_level *); + +extern bool push_namespace (tree); +extern void pop_namespace (void); +extern void push_nested_namespace (tree); +extern void pop_nested_namespace (tree); +extern bool handle_namespace_attrs (tree, tree); +extern void pushlevel_class (void); +extern void poplevel_class (void); +extern tree pushdecl_with_scope (tree, cp_binding_level *, bool); +extern tree lookup_name_prefer_type (tree, int); +extern tree lookup_name_real (tree, int, int, bool, int, int); +extern tree lookup_type_scope (tree, tag_scope); +extern tree namespace_binding (tree, tree); +extern void set_namespace_binding (tree, tree, tree); +extern bool hidden_name_p (tree); +extern tree remove_hidden_names (tree); +extern tree lookup_qualified_name (tree, tree, int, bool, /*hidden*/bool = false); +extern tree lookup_name_nonclass (tree); +extern tree lookup_name_innermost_nonclass_level (tree); +extern bool is_local_extern (tree); +extern tree lookup_function_nonclass (tree, vec *, bool); +extern void push_local_binding (tree, tree, int); +extern bool pushdecl_class_level (tree); +extern tree pushdecl_namespace_level (tree, bool); +extern bool push_class_level_binding (tree, tree); +extern tree getdecls (void); +extern int function_parm_depth (void); +extern tree cp_namespace_decls (tree); +extern void set_decl_namespace (tree, tree, bool); +extern void push_decl_namespace (tree); +extern void pop_decl_namespace (void); +extern void do_namespace_alias (tree, tree); +extern void do_toplevel_using_decl (tree, tree, tree); +extern void do_local_using_decl (tree, tree, tree); +extern tree do_class_using_decl (tree, tree); +extern void do_using_directive (tree); +extern cp_expr lookup_arg_dependent (tree, tree, vec *); +extern bool is_associated_namespace (tree, tree); +extern void parse_using_directive (tree, tree); +extern tree innermost_non_namespace_value (tree); +extern cxx_binding *outer_binding (tree, cxx_binding *, bool); +extern void cp_emit_debug_info_for_using (tree, tree); + +/* Set *DECL to the (non-hidden) declaration for ID at global scope, + if present and return true; otherwise return false. */ + +inline bool +get_global_value_if_present (tree id, tree *decl) +{ + tree global_value = namespace_binding (id, global_namespace); + if (global_value) + *decl = global_value; + return global_value != NULL; +} + +/* True is the binding of IDENTIFIER at global scope names a type. */ + +inline bool +is_typename_at_global_scope (tree id) +{ + tree global_value = namespace_binding (id, global_namespace); + + return global_value && TREE_CODE (global_value) == TYPE_DECL; +} + +#endif /* GCC_CP_NAME_LOOKUP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cp/type-utils.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cp/type-utils.h new file mode 100644 index 0000000..7d6b916 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cp/type-utils.h @@ -0,0 +1,55 @@ +/* Utilities for querying and manipulating type trees. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_CP_TYPE_UTILS_H +#define GCC_CP_TYPE_UTILS_H + +/* Returns the first tree within T that is directly matched by PRED. T may be a + type or PARM_DECL and is incrementally decomposed toward its type-specifier + until a match is found. NULL_TREE is returned if PRED does not match any + part of T. + + This is primarily intended for detecting whether T uses `auto' or a concept + identifier. Since either of these can only appear as a type-specifier for + the declaration in question, only top-level qualifications are traversed; + find_type_usage does not look through the whole type. */ + +inline tree +find_type_usage (tree t, bool (*pred) (const_tree)) +{ + enum tree_code code; + if (pred (t)) + return t; + + code = TREE_CODE (t); + + if (code == POINTER_TYPE || code == REFERENCE_TYPE + || code == PARM_DECL || code == OFFSET_TYPE + || code == FUNCTION_TYPE || code == METHOD_TYPE + || code == ARRAY_TYPE) + return find_type_usage (TREE_TYPE (t), pred); + + if (TYPE_PTRMEMFUNC_P (t)) + return find_type_usage + (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (t)), pred); + + return NULL_TREE; +} + +#endif // GCC_CP_TYPE_UTILS_H diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cppbuiltin.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cppbuiltin.h new file mode 100644 index 0000000..235b83a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cppbuiltin.h @@ -0,0 +1,33 @@ +/* Define builtin-in macros for all front ends that perform preprocessing + Copyright (C) 2010-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_CPPBUILTIN_H +#define GCC_CPPBUILTIN_H + +/* Parse a BASEVER version string of the format "major.minor.patchlevel" + or "major.minor" to extract its components. */ +extern void parse_basever (int *, int *, int *); + +/* Define macros builtins common to all language performing CPP + preprocessing. */ +extern void define_language_independent_builtin_macros (cpp_reader *); + + +#endif /* ! GCC_CPPBUILTIN_H */ + diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cppdefault.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cppdefault.h new file mode 100644 index 0000000..17bbb0e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cppdefault.h @@ -0,0 +1,71 @@ +/* CPP Library. + Copyright (C) 1986-2017 Free Software Foundation, Inc. + Contributed by Per Bothner, 1994-95. + Based on CCCP program by Paul Rubin, June 1986 + Adapted to ANSI C, Richard Stallman, Jan 1987 + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING3. If not see + . */ + +#ifndef GCC_CPPDEFAULT_H +#define GCC_CPPDEFAULT_H + +/* This is the default list of directories to search for include files. + It may be overridden by the various -I and -ixxx options. + + #include "file" looks in the same directory as the current file, + then this list. + #include just looks in this list. + + All these directories are treated as `system' include directories + (they are not subject to pedantic warnings in some cases). */ + +struct default_include +{ + const char *const fname; /* The name of the directory. */ + const char *const component; /* The component containing the directory + (see update_path in prefix.c) */ + const char cplusplus; /* Only look here if we're compiling C++. */ + const char cxx_aware; /* Includes in this directory don't need to + be wrapped in extern "C" when compiling + C++. */ + const char add_sysroot; /* FNAME should be prefixed by + cpp_SYSROOT. */ + const char multilib; /* FNAME should have appended + - the multilib path specified with -imultilib + when set to 1, + - the multiarch path specified with + -imultiarch, when set to 2. */ +}; + +extern const struct default_include cpp_include_defaults[]; +extern const char cpp_GCC_INCLUDE_DIR[]; +extern const size_t cpp_GCC_INCLUDE_DIR_len; + +/* The configure-time prefix, i.e., the value supplied as the argument + to --prefix=. */ +extern const char cpp_PREFIX[]; +/* The length of the configure-time prefix. */ +extern const size_t cpp_PREFIX_len; +/* The configure-time execution prefix. This is typically the lib/gcc + subdirectory of cpp_PREFIX. */ +extern const char cpp_EXEC_PREFIX[]; +/* The run-time execution prefix. This is typically the lib/gcc + subdirectory of the actual installation. */ +extern const char *gcc_exec_prefix; + +/* Return true if the toolchain is relocated. */ +bool cpp_relocated (void); + +#endif /* ! GCC_CPPDEFAULT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cpplib.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cpplib.h new file mode 100644 index 0000000..b843992 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cpplib.h @@ -0,0 +1,1199 @@ +/* Definitions for CPP library. + Copyright (C) 1995-2017 Free Software Foundation, Inc. + Written by Per Bothner, 1994-95. + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; see the file COPYING3. If not see +. + + In other words, you are welcome to use, share and improve this program. + You are forbidden to forbid anyone else to use, share and improve + what you give them. Help stamp out software-hoarding! */ +#ifndef LIBCPP_CPPLIB_H +#define LIBCPP_CPPLIB_H + +#include +#include "symtab.h" +#include "line-map.h" + +typedef struct cpp_reader cpp_reader; +typedef struct cpp_buffer cpp_buffer; +typedef struct cpp_options cpp_options; +typedef struct cpp_token cpp_token; +typedef struct cpp_string cpp_string; +typedef struct cpp_hashnode cpp_hashnode; +typedef struct cpp_macro cpp_macro; +typedef struct cpp_callbacks cpp_callbacks; +typedef struct cpp_dir cpp_dir; + +struct answer; +struct _cpp_file; + +/* The first three groups, apart from '=', can appear in preprocessor + expressions (+= and -= are used to indicate unary + and - resp.). + This allows a lookup table to be implemented in _cpp_parse_expr. + + The first group, to CPP_LAST_EQ, can be immediately followed by an + '='. The lexer needs operators ending in '=', like ">>=", to be in + the same order as their counterparts without the '=', like ">>". + + See the cpp_operator table optab in expr.c if you change the order or + add or remove anything in the first group. */ + +#define TTYPE_TABLE \ + OP(EQ, "=") \ + OP(NOT, "!") \ + OP(GREATER, ">") /* compare */ \ + OP(LESS, "<") \ + OP(PLUS, "+") /* math */ \ + OP(MINUS, "-") \ + OP(MULT, "*") \ + OP(DIV, "/") \ + OP(MOD, "%") \ + OP(AND, "&") /* bit ops */ \ + OP(OR, "|") \ + OP(XOR, "^") \ + OP(RSHIFT, ">>") \ + OP(LSHIFT, "<<") \ + \ + OP(COMPL, "~") \ + OP(AND_AND, "&&") /* logical */ \ + OP(OR_OR, "||") \ + OP(QUERY, "?") \ + OP(COLON, ":") \ + OP(COMMA, ",") /* grouping */ \ + OP(OPEN_PAREN, "(") \ + OP(CLOSE_PAREN, ")") \ + TK(EOF, NONE) \ + OP(EQ_EQ, "==") /* compare */ \ + OP(NOT_EQ, "!=") \ + OP(GREATER_EQ, ">=") \ + OP(LESS_EQ, "<=") \ + \ + /* These two are unary + / - in preprocessor expressions. */ \ + OP(PLUS_EQ, "+=") /* math */ \ + OP(MINUS_EQ, "-=") \ + \ + OP(MULT_EQ, "*=") \ + OP(DIV_EQ, "/=") \ + OP(MOD_EQ, "%=") \ + OP(AND_EQ, "&=") /* bit ops */ \ + OP(OR_EQ, "|=") \ + OP(XOR_EQ, "^=") \ + OP(RSHIFT_EQ, ">>=") \ + OP(LSHIFT_EQ, "<<=") \ + /* Digraphs together, beginning with CPP_FIRST_DIGRAPH. */ \ + OP(HASH, "#") /* digraphs */ \ + OP(PASTE, "##") \ + OP(OPEN_SQUARE, "[") \ + OP(CLOSE_SQUARE, "]") \ + OP(OPEN_BRACE, "{") \ + OP(CLOSE_BRACE, "}") \ + /* The remainder of the punctuation. Order is not significant. */ \ + OP(SEMICOLON, ";") /* structure */ \ + OP(ELLIPSIS, "...") \ + OP(PLUS_PLUS, "++") /* increment */ \ + OP(MINUS_MINUS, "--") \ + OP(DEREF, "->") /* accessors */ \ + OP(DOT, ".") \ + OP(SCOPE, "::") \ + OP(DEREF_STAR, "->*") \ + OP(DOT_STAR, ".*") \ + OP(ATSIGN, "@") /* used in Objective-C */ \ + \ + TK(NAME, IDENT) /* word */ \ + TK(AT_NAME, IDENT) /* @word - Objective-C */ \ + TK(NUMBER, LITERAL) /* 34_be+ta */ \ + \ + TK(CHAR, LITERAL) /* 'char' */ \ + TK(WCHAR, LITERAL) /* L'char' */ \ + TK(CHAR16, LITERAL) /* u'char' */ \ + TK(CHAR32, LITERAL) /* U'char' */ \ + TK(UTF8CHAR, LITERAL) /* u8'char' */ \ + TK(OTHER, LITERAL) /* stray punctuation */ \ + \ + TK(STRING, LITERAL) /* "string" */ \ + TK(WSTRING, LITERAL) /* L"string" */ \ + TK(STRING16, LITERAL) /* u"string" */ \ + TK(STRING32, LITERAL) /* U"string" */ \ + TK(UTF8STRING, LITERAL) /* u8"string" */ \ + TK(OBJC_STRING, LITERAL) /* @"string" - Objective-C */ \ + TK(HEADER_NAME, LITERAL) /* in #include */ \ + \ + TK(CHAR_USERDEF, LITERAL) /* 'char'_suffix - C++-0x */ \ + TK(WCHAR_USERDEF, LITERAL) /* L'char'_suffix - C++-0x */ \ + TK(CHAR16_USERDEF, LITERAL) /* u'char'_suffix - C++-0x */ \ + TK(CHAR32_USERDEF, LITERAL) /* U'char'_suffix - C++-0x */ \ + TK(UTF8CHAR_USERDEF, LITERAL) /* u8'char'_suffix - C++-0x */ \ + TK(STRING_USERDEF, LITERAL) /* "string"_suffix - C++-0x */ \ + TK(WSTRING_USERDEF, LITERAL) /* L"string"_suffix - C++-0x */ \ + TK(STRING16_USERDEF, LITERAL) /* u"string"_suffix - C++-0x */ \ + TK(STRING32_USERDEF, LITERAL) /* U"string"_suffix - C++-0x */ \ + TK(UTF8STRING_USERDEF,LITERAL) /* u8"string"_suffix - C++-0x */ \ + \ + TK(COMMENT, LITERAL) /* Only if output comments. */ \ + /* SPELL_LITERAL happens to DTRT. */ \ + TK(MACRO_ARG, NONE) /* Macro argument. */ \ + TK(PRAGMA, NONE) /* Only for deferred pragmas. */ \ + TK(PRAGMA_EOL, NONE) /* End-of-line for deferred pragmas. */ \ + TK(PADDING, NONE) /* Whitespace for -E. */ + +#define OP(e, s) CPP_ ## e, +#define TK(e, s) CPP_ ## e, +enum cpp_ttype +{ + TTYPE_TABLE + N_TTYPES, + + /* A token type for keywords, as opposed to ordinary identifiers. */ + CPP_KEYWORD, + + /* Positions in the table. */ + CPP_LAST_EQ = CPP_LSHIFT, + CPP_FIRST_DIGRAPH = CPP_HASH, + CPP_LAST_PUNCTUATOR= CPP_ATSIGN, + CPP_LAST_CPP_OP = CPP_LESS_EQ +}; +#undef OP +#undef TK + +/* C language kind, used when calling cpp_create_reader. */ +enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_GNUC11, + CLK_STDC89, CLK_STDC94, CLK_STDC99, CLK_STDC11, + CLK_GNUCXX, CLK_CXX98, CLK_GNUCXX11, CLK_CXX11, + CLK_GNUCXX14, CLK_CXX14, CLK_GNUCXX1Z, CLK_CXX1Z, CLK_ASM}; + +/* Payload of a NUMBER, STRING, CHAR or COMMENT token. */ +struct GTY(()) cpp_string { + unsigned int len; + const unsigned char *text; +}; + +/* Flags for the cpp_token structure. */ +#define PREV_WHITE (1 << 0) /* If whitespace before this token. */ +#define DIGRAPH (1 << 1) /* If it was a digraph. */ +#define STRINGIFY_ARG (1 << 2) /* If macro argument to be stringified. */ +#define PASTE_LEFT (1 << 3) /* If on LHS of a ## operator. */ +#define NAMED_OP (1 << 4) /* C++ named operators. */ +#define PREV_FALLTHROUGH (1 << 5) /* On a token preceeded by FALLTHROUGH + comment. */ +#define BOL (1 << 6) /* Token at beginning of line. */ +#define PURE_ZERO (1 << 7) /* Single 0 digit, used by the C++ frontend, + set in c-lex.c. */ +#define SP_DIGRAPH (1 << 8) /* # or ## token was a digraph. */ +#define SP_PREV_WHITE (1 << 9) /* If whitespace before a ## + operator, or before this token + after a # operator. */ +#define NO_EXPAND (1 << 10) /* Do not macro-expand this token. */ + +/* Specify which field, if any, of the cpp_token union is used. */ + +enum cpp_token_fld_kind { + CPP_TOKEN_FLD_NODE, + CPP_TOKEN_FLD_SOURCE, + CPP_TOKEN_FLD_STR, + CPP_TOKEN_FLD_ARG_NO, + CPP_TOKEN_FLD_TOKEN_NO, + CPP_TOKEN_FLD_PRAGMA, + CPP_TOKEN_FLD_NONE +}; + +/* A macro argument in the cpp_token union. */ +struct GTY(()) cpp_macro_arg { + /* Argument number. */ + unsigned int arg_no; + /* The original spelling of the macro argument token. */ + cpp_hashnode * + GTY ((nested_ptr (union tree_node, + "%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL", + "%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL"))) + spelling; +}; + +/* An identifier in the cpp_token union. */ +struct GTY(()) cpp_identifier { + /* The canonical (UTF-8) spelling of the identifier. */ + cpp_hashnode * + GTY ((nested_ptr (union tree_node, + "%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL", + "%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL"))) + node; + /* The original spelling of the identifier. */ + cpp_hashnode * + GTY ((nested_ptr (union tree_node, + "%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL", + "%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL"))) + spelling; +}; + +/* A preprocessing token. This has been carefully packed and should + occupy 16 bytes on 32-bit hosts and 24 bytes on 64-bit hosts. */ +struct GTY(()) cpp_token { + source_location src_loc; /* Location of first char of token, + together with range of full token. */ + ENUM_BITFIELD(cpp_ttype) type : CHAR_BIT; /* token type */ + unsigned short flags; /* flags - see above */ + + union cpp_token_u + { + /* An identifier. */ + struct cpp_identifier GTY ((tag ("CPP_TOKEN_FLD_NODE"))) node; + + /* Inherit padding from this token. */ + cpp_token * GTY ((tag ("CPP_TOKEN_FLD_SOURCE"))) source; + + /* A string, or number. */ + struct cpp_string GTY ((tag ("CPP_TOKEN_FLD_STR"))) str; + + /* Argument no. (and original spelling) for a CPP_MACRO_ARG. */ + struct cpp_macro_arg GTY ((tag ("CPP_TOKEN_FLD_ARG_NO"))) macro_arg; + + /* Original token no. for a CPP_PASTE (from a sequence of + consecutive paste tokens in a macro expansion). */ + unsigned int GTY ((tag ("CPP_TOKEN_FLD_TOKEN_NO"))) token_no; + + /* Caller-supplied identifier for a CPP_PRAGMA. */ + unsigned int GTY ((tag ("CPP_TOKEN_FLD_PRAGMA"))) pragma; + } GTY ((desc ("cpp_token_val_index (&%1)"))) val; +}; + +/* Say which field is in use. */ +extern enum cpp_token_fld_kind cpp_token_val_index (const cpp_token *tok); + +/* A type wide enough to hold any multibyte source character. + cpplib's character constant interpreter requires an unsigned type. + Also, a typedef for the signed equivalent. + The width of this type is capped at 32 bits; there do exist targets + where wchar_t is 64 bits, but only in a non-default mode, and there + would be no meaningful interpretation for a wchar_t value greater + than 2^32 anyway -- the widest wide-character encoding around is + ISO 10646, which stops at 2^31. */ +#if CHAR_BIT * SIZEOF_INT >= 32 +# define CPPCHAR_SIGNED_T int +#elif CHAR_BIT * SIZEOF_LONG >= 32 +# define CPPCHAR_SIGNED_T long +#else +# error "Cannot find a least-32-bit signed integer type" +#endif +typedef unsigned CPPCHAR_SIGNED_T cppchar_t; +typedef CPPCHAR_SIGNED_T cppchar_signed_t; + +/* Style of header dependencies to generate. */ +enum cpp_deps_style { DEPS_NONE = 0, DEPS_USER, DEPS_SYSTEM }; + +/* The possible normalization levels, from most restrictive to least. */ +enum cpp_normalize_level { + /* In NFKC. */ + normalized_KC = 0, + /* In NFC. */ + normalized_C, + /* In NFC, except for subsequences where being in NFC would make + the identifier invalid. */ + normalized_identifier_C, + /* Not normalized at all. */ + normalized_none +}; + +/* This structure is nested inside struct cpp_reader, and + carries all the options visible to the command line. */ +struct cpp_options +{ + /* Characters between tab stops. */ + unsigned int tabstop; + + /* The language we're preprocessing. */ + enum c_lang lang; + + /* Nonzero means use extra default include directories for C++. */ + unsigned char cplusplus; + + /* Nonzero means handle cplusplus style comments. */ + unsigned char cplusplus_comments; + + /* Nonzero means define __OBJC__, treat @ as a special token, use + the OBJC[PLUS]_INCLUDE_PATH environment variable, and allow + "#import". */ + unsigned char objc; + + /* Nonzero means don't copy comments into the output file. */ + unsigned char discard_comments; + + /* Nonzero means don't copy comments into the output file during + macro expansion. */ + unsigned char discard_comments_in_macro_exp; + + /* Nonzero means process the ISO trigraph sequences. */ + unsigned char trigraphs; + + /* Nonzero means process the ISO digraph sequences. */ + unsigned char digraphs; + + /* Nonzero means to allow hexadecimal floats and LL suffixes. */ + unsigned char extended_numbers; + + /* Nonzero means process u/U prefix literals (UTF-16/32). */ + unsigned char uliterals; + + /* Nonzero means process u8 prefixed character literals (UTF-8). */ + unsigned char utf8_char_literals; + + /* Nonzero means process r/R raw strings. If this is set, uliterals + must be set as well. */ + unsigned char rliterals; + + /* Nonzero means print names of header files (-H). */ + unsigned char print_include_names; + + /* Nonzero means complain about deprecated features. */ + unsigned char cpp_warn_deprecated; + + /* Nonzero means warn if slash-star appears in a comment. */ + unsigned char warn_comments; + + /* Nonzero means to warn about __DATA__, __TIME__ and __TIMESTAMP__ usage. */ + unsigned char warn_date_time; + + /* Nonzero means warn if a user-supplied include directory does not + exist. */ + unsigned char warn_missing_include_dirs; + + /* Nonzero means warn if there are any trigraphs. */ + unsigned char warn_trigraphs; + + /* Nonzero means warn about multicharacter charconsts. */ + unsigned char warn_multichar; + + /* Nonzero means warn about various incompatibilities with + traditional C. */ + unsigned char cpp_warn_traditional; + + /* Nonzero means warn about long long numeric constants. */ + unsigned char cpp_warn_long_long; + + /* Nonzero means warn about text after an #endif (or #else). */ + unsigned char warn_endif_labels; + + /* Nonzero means warn about implicit sign changes owing to integer + promotions. */ + unsigned char warn_num_sign_change; + + /* Zero means don't warn about __VA_ARGS__ usage in c89 pedantic mode. + Presumably the usage is protected by the appropriate #ifdef. */ + unsigned char warn_variadic_macros; + + /* Nonzero means warn about builtin macros that are redefined or + explicitly undefined. */ + unsigned char warn_builtin_macro_redefined; + + /* Different -Wimplicit-fallthrough= levels. */ + unsigned char cpp_warn_implicit_fallthrough; + + /* Nonzero means we should look for header.gcc files that remap file + names. */ + unsigned char remap; + + /* Zero means dollar signs are punctuation. */ + unsigned char dollars_in_ident; + + /* Nonzero means UCNs are accepted in identifiers. */ + unsigned char extended_identifiers; + + /* True if we should warn about dollars in identifiers or numbers + for this translation unit. */ + unsigned char warn_dollars; + + /* Nonzero means warn if undefined identifiers are evaluated in an #if. */ + unsigned char warn_undef; + + /* Nonzero means warn if "defined" is encountered in a place other than + an #if. */ + unsigned char warn_expansion_to_defined; + + /* Nonzero means warn of unused macros from the main file. */ + unsigned char warn_unused_macros; + + /* Nonzero for the 1999 C Standard, including corrigenda and amendments. */ + unsigned char c99; + + /* Nonzero if we are conforming to a specific C or C++ standard. */ + unsigned char std; + + /* Nonzero means give all the error messages the ANSI standard requires. */ + unsigned char cpp_pedantic; + + /* Nonzero means we're looking at already preprocessed code, so don't + bother trying to do macro expansion and whatnot. */ + unsigned char preprocessed; + + /* Nonzero means we are going to emit debugging logs during + preprocessing. */ + unsigned char debug; + + /* Nonzero means we are tracking locations of tokens involved in + macro expansion. 1 Means we track the location in degraded mode + where we do not track locations of tokens resulting from the + expansion of arguments of function-like macro. 2 Means we do + track all macro expansions. This last option is the one that + consumes the highest amount of memory. */ + unsigned char track_macro_expansion; + + /* Nonzero means handle C++ alternate operator names. */ + unsigned char operator_names; + + /* Nonzero means warn about use of C++ alternate operator names. */ + unsigned char warn_cxx_operator_names; + + /* True for traditional preprocessing. */ + unsigned char traditional; + + /* Nonzero for C++ 2011 Standard user-defined literals. */ + unsigned char user_literals; + + /* Nonzero means warn when a string or character literal is followed by a + ud-suffix which does not beging with an underscore. */ + unsigned char warn_literal_suffix; + + /* Nonzero means interpret imaginary, fixed-point, or other gnu extension + literal number suffixes as user-defined literal number suffixes. */ + unsigned char ext_numeric_literals; + + /* Nonzero means extended identifiers allow the characters specified + in C11 and C++11. */ + unsigned char c11_identifiers; + + /* Nonzero for C++ 2014 Standard binary constants. */ + unsigned char binary_constants; + + /* Nonzero for C++ 2014 Standard digit separators. */ + unsigned char digit_separators; + + /* Holds the name of the target (execution) character set. */ + const char *narrow_charset; + + /* Holds the name of the target wide character set. */ + const char *wide_charset; + + /* Holds the name of the input character set. */ + const char *input_charset; + + /* The minimum permitted level of normalization before a warning + is generated. See enum cpp_normalize_level. */ + int warn_normalize; + + /* True to warn about precompiled header files we couldn't use. */ + bool warn_invalid_pch; + + /* True if dependencies should be restored from a precompiled header. */ + bool restore_pch_deps; + + /* True if warn about differences between C90 and C99. */ + signed char cpp_warn_c90_c99_compat; + + /* True if warn about differences between C++98 and C++11. */ + bool cpp_warn_cxx11_compat; + + /* Dependency generation. */ + struct + { + /* Style of header dependencies to generate. */ + enum cpp_deps_style style; + + /* Assume missing files are generated files. */ + bool missing_files; + + /* Generate phony targets for each dependency apart from the first + one. */ + bool phony_targets; + + /* If true, no dependency is generated on the main file. */ + bool ignore_main_file; + + /* If true, intend to use the preprocessor output (e.g., for compilation) + in addition to the dependency info. */ + bool need_preprocessor_output; + } deps; + + /* Target-specific features set by the front end or client. */ + + /* Precision for target CPP arithmetic, target characters, target + ints and target wide characters, respectively. */ + size_t precision, char_precision, int_precision, wchar_precision; + + /* True means chars (wide chars) are unsigned. */ + bool unsigned_char, unsigned_wchar; + + /* True if the most significant byte in a word has the lowest + address in memory. */ + bool bytes_big_endian; + + /* Nonzero means __STDC__ should have the value 0 in system headers. */ + unsigned char stdc_0_in_system_headers; + + /* True disables tokenization outside of preprocessing directives. */ + bool directives_only; + + /* True enables canonicalization of system header file paths. */ + bool canonical_system_headers; +}; + +/* Callback for header lookup for HEADER, which is the name of a + source file. It is used as a method of last resort to find headers + that are not otherwise found during the normal include processing. + The return value is the malloced name of a header to try and open, + if any, or NULL otherwise. This callback is called only if the + header is otherwise unfound. */ +typedef const char *(*missing_header_cb)(cpp_reader *, const char *header, cpp_dir **); + +/* Call backs to cpplib client. */ +struct cpp_callbacks +{ + /* Called when a new line of preprocessed output is started. */ + void (*line_change) (cpp_reader *, const cpp_token *, int); + + /* Called when switching to/from a new file. + The line_map is for the new file. It is NULL if there is no new file. + (In C this happens when done with + and also + when done with a main file.) This can be used for resource cleanup. */ + void (*file_change) (cpp_reader *, const line_map_ordinary *); + + void (*dir_change) (cpp_reader *, const char *); + void (*include) (cpp_reader *, source_location, const unsigned char *, + const char *, int, const cpp_token **); + void (*define) (cpp_reader *, source_location, cpp_hashnode *); + void (*undef) (cpp_reader *, source_location, cpp_hashnode *); + void (*ident) (cpp_reader *, source_location, const cpp_string *); + void (*def_pragma) (cpp_reader *, source_location); + int (*valid_pch) (cpp_reader *, const char *, int); + void (*read_pch) (cpp_reader *, const char *, int, const char *); + missing_header_cb missing_header; + + /* Context-sensitive macro support. Returns macro (if any) that should + be expanded. */ + cpp_hashnode * (*macro_to_expand) (cpp_reader *, const cpp_token *); + + /* Called to emit a diagnostic. This callback receives the + translated message. */ + bool (*error) (cpp_reader *, int, int, rich_location *, + const char *, va_list *) + ATTRIBUTE_FPTR_PRINTF(5,0); + + /* Callbacks for when a macro is expanded, or tested (whether + defined or not at the time) in #ifdef, #ifndef or "defined". */ + void (*used_define) (cpp_reader *, source_location, cpp_hashnode *); + void (*used_undef) (cpp_reader *, source_location, cpp_hashnode *); + /* Called before #define and #undef or other macro definition + changes are processed. */ + void (*before_define) (cpp_reader *); + /* Called whenever a macro is expanded or tested. + Second argument is the location of the start of the current expansion. */ + void (*used) (cpp_reader *, source_location, cpp_hashnode *); + + /* Callback to identify whether an attribute exists. */ + int (*has_attribute) (cpp_reader *); + + /* Callback that can change a user builtin into normal macro. */ + bool (*user_builtin_macro) (cpp_reader *, cpp_hashnode *); + + /* Callback to parse SOURCE_DATE_EPOCH from environment. */ + time_t (*get_source_date_epoch) (cpp_reader *); + + /* Callback for providing suggestions for misspelled directives. */ + const char *(*get_suggestion) (cpp_reader *, const char *, const char *const *); +}; + +#ifdef VMS +#define INO_T_CPP ino_t ino[3] +#else +#define INO_T_CPP ino_t ino +#endif + +/* Chain of directories to look for include files in. */ +struct cpp_dir +{ + /* NULL-terminated singly-linked list. */ + struct cpp_dir *next; + + /* NAME of the directory, NUL-terminated. */ + char *name; + unsigned int len; + + /* One if a system header, two if a system header that has extern + "C" guards for C++. */ + unsigned char sysp; + + /* Is this a user-supplied directory? */ + bool user_supplied_p; + + /* The canonicalized NAME as determined by lrealpath. This field + is only used by hosts that lack reliable inode numbers. */ + char *canonical_name; + + /* Mapping of file names for this directory for MS-DOS and related + platforms. A NULL-terminated array of (from, to) pairs. */ + const char **name_map; + + /* Routine to construct pathname, given the search path name and the + HEADER we are trying to find, return a constructed pathname to + try and open. If this is NULL, the constructed pathname is as + constructed by append_file_to_dir. */ + char *(*construct) (const char *header, cpp_dir *dir); + + /* The C front end uses these to recognize duplicated + directories in the search path. */ + INO_T_CPP; + dev_t dev; +}; + +/* The structure of a node in the hash table. The hash table has + entries for all identifiers: either macros defined by #define + commands (type NT_MACRO), assertions created with #assert + (NT_ASSERTION), or neither of the above (NT_VOID). Builtin macros + like __LINE__ are flagged NODE_BUILTIN. Poisoned identifiers are + flagged NODE_POISONED. NODE_OPERATOR (C++ only) indicates an + identifier that behaves like an operator such as "xor". + NODE_DIAGNOSTIC is for speed in lex_token: it indicates a + diagnostic may be required for this node. Currently this only + applies to __VA_ARGS__, poisoned identifiers, and -Wc++-compat + warnings about NODE_OPERATOR. */ + +/* Hash node flags. */ +#define NODE_OPERATOR (1 << 0) /* C++ named operator. */ +#define NODE_POISONED (1 << 1) /* Poisoned identifier. */ +#define NODE_BUILTIN (1 << 2) /* Builtin macro. */ +#define NODE_DIAGNOSTIC (1 << 3) /* Possible diagnostic when lexed. */ +#define NODE_WARN (1 << 4) /* Warn if redefined or undefined. */ +#define NODE_DISABLED (1 << 5) /* A disabled macro. */ +#define NODE_MACRO_ARG (1 << 6) /* Used during #define processing. */ +#define NODE_USED (1 << 7) /* Dumped with -dU. */ +#define NODE_CONDITIONAL (1 << 8) /* Conditional macro */ +#define NODE_WARN_OPERATOR (1 << 9) /* Warn about C++ named operator. */ + +/* Different flavors of hash node. */ +enum node_type +{ + NT_VOID = 0, /* No definition yet. */ + NT_MACRO, /* A macro of some form. */ + NT_ASSERTION /* Predicate for #assert. */ +}; + +/* Different flavors of builtin macro. _Pragma is an operator, but we + handle it with the builtin code for efficiency reasons. */ +enum cpp_builtin_type +{ + BT_SPECLINE = 0, /* `__LINE__' */ + BT_DATE, /* `__DATE__' */ + BT_FILE, /* `__FILE__' */ + BT_BASE_FILE, /* `__BASE_FILE__' */ + BT_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */ + BT_TIME, /* `__TIME__' */ + BT_STDC, /* `__STDC__' */ + BT_PRAGMA, /* `_Pragma' operator */ + BT_TIMESTAMP, /* `__TIMESTAMP__' */ + BT_COUNTER, /* `__COUNTER__' */ + BT_HAS_ATTRIBUTE, /* `__has_attribute__(x)' */ + BT_FIRST_USER, /* User defined builtin macros. */ + BT_LAST_USER = BT_FIRST_USER + 31 +}; + +#define CPP_HASHNODE(HNODE) ((cpp_hashnode *) (HNODE)) +#define HT_NODE(NODE) ((ht_identifier *) (NODE)) +#define NODE_LEN(NODE) HT_LEN (&(NODE)->ident) +#define NODE_NAME(NODE) HT_STR (&(NODE)->ident) + +/* Specify which field, if any, of the union is used. */ + +enum { + NTV_MACRO, + NTV_ANSWER, + NTV_BUILTIN, + NTV_ARGUMENT, + NTV_NONE +}; + +#define CPP_HASHNODE_VALUE_IDX(HNODE) \ + ((HNODE.flags & NODE_MACRO_ARG) ? NTV_ARGUMENT \ + : HNODE.type == NT_MACRO ? ((HNODE.flags & NODE_BUILTIN) \ + ? NTV_BUILTIN : NTV_MACRO) \ + : HNODE.type == NT_ASSERTION ? NTV_ANSWER \ + : NTV_NONE) + +/* The common part of an identifier node shared amongst all 3 C front + ends. Also used to store CPP identifiers, which are a superset of + identifiers in the grammatical sense. */ + +union GTY(()) _cpp_hashnode_value { + /* If a macro. */ + cpp_macro * GTY((tag ("NTV_MACRO"))) macro; + /* Answers to an assertion. */ + struct answer * GTY ((tag ("NTV_ANSWER"))) answers; + /* Code for a builtin macro. */ + enum cpp_builtin_type GTY ((tag ("NTV_BUILTIN"))) builtin; + /* Macro argument index. */ + unsigned short GTY ((tag ("NTV_ARGUMENT"))) arg_index; +}; + +struct GTY(()) cpp_hashnode { + struct ht_identifier ident; + unsigned int is_directive : 1; + unsigned int directive_index : 7; /* If is_directive, + then index into directive table. + Otherwise, a NODE_OPERATOR. */ + unsigned char rid_code; /* Rid code - for front ends. */ + ENUM_BITFIELD(node_type) type : 6; /* CPP node type. */ + unsigned int flags : 10; /* CPP flags. */ + + union _cpp_hashnode_value GTY ((desc ("CPP_HASHNODE_VALUE_IDX (%1)"))) value; +}; + +/* A class for iterating through the source locations within a + string token (before escapes are interpreted, and before + concatenation). */ + +class cpp_string_location_reader { + public: + cpp_string_location_reader (source_location src_loc, + line_maps *line_table); + + source_range get_next (); + + private: + source_location m_loc; + int m_offset_per_column; + line_maps *m_line_table; +}; + +/* A class for storing the source ranges of all of the characters within + a string literal, after escapes are interpreted, and after + concatenation. + + This is not GTY-marked, as instances are intended to be temporary. */ + +class cpp_substring_ranges +{ + public: + cpp_substring_ranges (); + ~cpp_substring_ranges (); + + int get_num_ranges () const { return m_num_ranges; } + source_range get_range (int idx) const + { + linemap_assert (idx < m_num_ranges); + return m_ranges[idx]; + } + + void add_range (source_range range); + void add_n_ranges (int num, cpp_string_location_reader &loc_reader); + + private: + source_range *m_ranges; + int m_num_ranges; + int m_alloc_ranges; +}; + +/* Call this first to get a handle to pass to other functions. + + If you want cpplib to manage its own hashtable, pass in a NULL + pointer. Otherwise you should pass in an initialized hash table + that cpplib will share; this technique is used by the C front + ends. */ +extern cpp_reader *cpp_create_reader (enum c_lang, struct ht *, + struct line_maps *); + +/* Reset the cpp_reader's line_map. This is only used after reading a + PCH file. */ +extern void cpp_set_line_map (cpp_reader *, struct line_maps *); + +/* Call this to change the selected language standard (e.g. because of + command line options). */ +extern void cpp_set_lang (cpp_reader *, enum c_lang); + +/* Set the include paths. */ +extern void cpp_set_include_chains (cpp_reader *, cpp_dir *, cpp_dir *, int); + +/* Call these to get pointers to the options, callback, and deps + structures for a given reader. These pointers are good until you + call cpp_finish on that reader. You can either edit the callbacks + through the pointer returned from cpp_get_callbacks, or set them + with cpp_set_callbacks. */ +extern cpp_options *cpp_get_options (cpp_reader *); +extern cpp_callbacks *cpp_get_callbacks (cpp_reader *); +extern void cpp_set_callbacks (cpp_reader *, cpp_callbacks *); +extern struct deps *cpp_get_deps (cpp_reader *); + +/* This function reads the file, but does not start preprocessing. It + returns the name of the original file; this is the same as the + input file, except for preprocessed input. This will generate at + least one file change callback, and possibly a line change callback + too. If there was an error opening the file, it returns NULL. */ +extern const char *cpp_read_main_file (cpp_reader *, const char *); + +/* Set up built-ins with special behavior. Use cpp_init_builtins() + instead unless your know what you are doing. */ +extern void cpp_init_special_builtins (cpp_reader *); + +/* Set up built-ins like __FILE__. */ +extern void cpp_init_builtins (cpp_reader *, int); + +/* This is called after options have been parsed, and partially + processed. */ +extern void cpp_post_options (cpp_reader *); + +/* Set up translation to the target character set. */ +extern void cpp_init_iconv (cpp_reader *); + +/* Call this to finish preprocessing. If you requested dependency + generation, pass an open stream to write the information to, + otherwise NULL. It is your responsibility to close the stream. */ +extern void cpp_finish (cpp_reader *, FILE *deps_stream); + +/* Call this to release the handle at the end of preprocessing. Any + use of the handle after this function returns is invalid. */ +extern void cpp_destroy (cpp_reader *); + +extern unsigned int cpp_token_len (const cpp_token *); +extern unsigned char *cpp_token_as_text (cpp_reader *, const cpp_token *); +extern unsigned char *cpp_spell_token (cpp_reader *, const cpp_token *, + unsigned char *, bool); +extern void cpp_register_pragma (cpp_reader *, const char *, const char *, + void (*) (cpp_reader *), bool); +extern void cpp_register_deferred_pragma (cpp_reader *, const char *, + const char *, unsigned, bool, bool); +extern int cpp_avoid_paste (cpp_reader *, const cpp_token *, + const cpp_token *); +extern const cpp_token *cpp_get_token (cpp_reader *); +extern const cpp_token *cpp_get_token_with_location (cpp_reader *, + source_location *); +extern bool cpp_fun_like_macro_p (cpp_hashnode *); +extern const unsigned char *cpp_macro_definition (cpp_reader *, + cpp_hashnode *); +extern void _cpp_backup_tokens (cpp_reader *, unsigned int); +extern const cpp_token *cpp_peek_token (cpp_reader *, int); + +/* Evaluate a CPP_*CHAR* token. */ +extern cppchar_t cpp_interpret_charconst (cpp_reader *, const cpp_token *, + unsigned int *, int *); +/* Evaluate a vector of CPP_*STRING* tokens. */ +extern bool cpp_interpret_string (cpp_reader *, + const cpp_string *, size_t, + cpp_string *, enum cpp_ttype); +extern const char *cpp_interpret_string_ranges (cpp_reader *pfile, + const cpp_string *from, + cpp_string_location_reader *, + size_t count, + cpp_substring_ranges *out, + enum cpp_ttype type); +extern bool cpp_interpret_string_notranslate (cpp_reader *, + const cpp_string *, size_t, + cpp_string *, enum cpp_ttype); + +/* Convert a host character constant to the execution character set. */ +extern cppchar_t cpp_host_to_exec_charset (cpp_reader *, cppchar_t); + +/* Used to register macros and assertions, perhaps from the command line. + The text is the same as the command line argument. */ +extern void cpp_define (cpp_reader *, const char *); +extern void cpp_define_formatted (cpp_reader *pfile, + const char *fmt, ...) ATTRIBUTE_PRINTF_2; +extern void cpp_assert (cpp_reader *, const char *); +extern void cpp_undef (cpp_reader *, const char *); +extern void cpp_unassert (cpp_reader *, const char *); + +/* Undefine all macros and assertions. */ +extern void cpp_undef_all (cpp_reader *); + +extern cpp_buffer *cpp_push_buffer (cpp_reader *, const unsigned char *, + size_t, int); +extern int cpp_defined (cpp_reader *, const unsigned char *, int); + +/* A preprocessing number. Code assumes that any unused high bits of + the double integer are set to zero. */ + +/* This type has to be equal to unsigned HOST_WIDE_INT, see + gcc/c-family/c-lex.c. */ +typedef uint64_t cpp_num_part; +typedef struct cpp_num cpp_num; +struct cpp_num +{ + cpp_num_part high; + cpp_num_part low; + bool unsignedp; /* True if value should be treated as unsigned. */ + bool overflow; /* True if the most recent calculation overflowed. */ +}; + +/* cpplib provides two interfaces for interpretation of preprocessing + numbers. + + cpp_classify_number categorizes numeric constants according to + their field (integer, floating point, or invalid), radix (decimal, + octal, hexadecimal), and type suffixes. */ + +#define CPP_N_CATEGORY 0x000F +#define CPP_N_INVALID 0x0000 +#define CPP_N_INTEGER 0x0001 +#define CPP_N_FLOATING 0x0002 + +#define CPP_N_WIDTH 0x00F0 +#define CPP_N_SMALL 0x0010 /* int, float, short _Fract/Accum */ +#define CPP_N_MEDIUM 0x0020 /* long, double, long _Fract/_Accum. */ +#define CPP_N_LARGE 0x0040 /* long long, long double, + long long _Fract/Accum. */ + +#define CPP_N_WIDTH_MD 0xF0000 /* machine defined. */ +#define CPP_N_MD_W 0x10000 +#define CPP_N_MD_Q 0x20000 + +#define CPP_N_RADIX 0x0F00 +#define CPP_N_DECIMAL 0x0100 +#define CPP_N_HEX 0x0200 +#define CPP_N_OCTAL 0x0400 +#define CPP_N_BINARY 0x0800 + +#define CPP_N_UNSIGNED 0x1000 /* Properties. */ +#define CPP_N_IMAGINARY 0x2000 +#define CPP_N_DFLOAT 0x4000 +#define CPP_N_DEFAULT 0x8000 + +#define CPP_N_FRACT 0x100000 /* Fract types. */ +#define CPP_N_ACCUM 0x200000 /* Accum types. */ +#define CPP_N_FLOATN 0x400000 /* _FloatN types. */ +#define CPP_N_FLOATNX 0x800000 /* _FloatNx types. */ + +#define CPP_N_USERDEF 0x1000000 /* C++0x user-defined literal. */ + +#define CPP_N_WIDTH_FLOATN_NX 0xF0000000 /* _FloatN / _FloatNx value + of N, divided by 16. */ +#define CPP_FLOATN_SHIFT 24 +#define CPP_FLOATN_MAX 0xF0 + +/* Classify a CPP_NUMBER token. The return value is a combination of + the flags from the above sets. */ +extern unsigned cpp_classify_number (cpp_reader *, const cpp_token *, + const char **, source_location); + +/* Return the classification flags for a float suffix. */ +extern unsigned int cpp_interpret_float_suffix (cpp_reader *, const char *, + size_t); + +/* Return the classification flags for an int suffix. */ +extern unsigned int cpp_interpret_int_suffix (cpp_reader *, const char *, + size_t); + +/* Evaluate a token classified as category CPP_N_INTEGER. */ +extern cpp_num cpp_interpret_integer (cpp_reader *, const cpp_token *, + unsigned int); + +/* Sign extend a number, with PRECISION significant bits and all + others assumed clear, to fill out a cpp_num structure. */ +cpp_num cpp_num_sign_extend (cpp_num, size_t); + +/* Diagnostic levels. To get a diagnostic without associating a + position in the translation unit with it, use cpp_error_with_line + with a line number of zero. */ + +enum { + /* Warning, an error with -Werror. */ + CPP_DL_WARNING = 0, + /* Same as CPP_DL_WARNING, except it is not suppressed in system headers. */ + CPP_DL_WARNING_SYSHDR, + /* Warning, an error with -pedantic-errors or -Werror. */ + CPP_DL_PEDWARN, + /* An error. */ + CPP_DL_ERROR, + /* An internal consistency check failed. Prints "internal error: ", + otherwise the same as CPP_DL_ERROR. */ + CPP_DL_ICE, + /* An informative note following a warning. */ + CPP_DL_NOTE, + /* A fatal error. */ + CPP_DL_FATAL +}; + +/* Warning reason codes. Use a reason code of zero for unclassified warnings + and errors that are not warnings. */ +enum { + CPP_W_NONE = 0, + CPP_W_DEPRECATED, + CPP_W_COMMENTS, + CPP_W_MISSING_INCLUDE_DIRS, + CPP_W_TRIGRAPHS, + CPP_W_MULTICHAR, + CPP_W_TRADITIONAL, + CPP_W_LONG_LONG, + CPP_W_ENDIF_LABELS, + CPP_W_NUM_SIGN_CHANGE, + CPP_W_VARIADIC_MACROS, + CPP_W_BUILTIN_MACRO_REDEFINED, + CPP_W_DOLLARS, + CPP_W_UNDEF, + CPP_W_UNUSED_MACROS, + CPP_W_CXX_OPERATOR_NAMES, + CPP_W_NORMALIZE, + CPP_W_INVALID_PCH, + CPP_W_WARNING_DIRECTIVE, + CPP_W_LITERAL_SUFFIX, + CPP_W_DATE_TIME, + CPP_W_PEDANTIC, + CPP_W_C90_C99_COMPAT, + CPP_W_CXX11_COMPAT, + CPP_W_EXPANSION_TO_DEFINED +}; + +/* Output a diagnostic of some kind. */ +extern bool cpp_error (cpp_reader *, int, const char *msgid, ...) + ATTRIBUTE_PRINTF_3; +extern bool cpp_warning (cpp_reader *, int, const char *msgid, ...) + ATTRIBUTE_PRINTF_3; +extern bool cpp_pedwarning (cpp_reader *, int, const char *msgid, ...) + ATTRIBUTE_PRINTF_3; +extern bool cpp_warning_syshdr (cpp_reader *, int, const char *msgid, ...) + ATTRIBUTE_PRINTF_3; + +/* Output a diagnostic with "MSGID: " preceding the + error string of errno. No location is printed. */ +extern bool cpp_errno (cpp_reader *, int, const char *msgid); +/* Similarly, but with "FILENAME: " instead of "MSGID: ", where + the filename is not localized. */ +extern bool cpp_errno_filename (cpp_reader *, int, const char *filename, + source_location loc); + +/* Same as cpp_error, except additionally specifies a position as a + (translation unit) physical line and physical column. If the line is + zero, then no location is printed. */ +extern bool cpp_error_with_line (cpp_reader *, int, source_location, + unsigned, const char *msgid, ...) + ATTRIBUTE_PRINTF_5; +extern bool cpp_warning_with_line (cpp_reader *, int, source_location, + unsigned, const char *msgid, ...) + ATTRIBUTE_PRINTF_5; +extern bool cpp_pedwarning_with_line (cpp_reader *, int, source_location, + unsigned, const char *msgid, ...) + ATTRIBUTE_PRINTF_5; +extern bool cpp_warning_with_line_syshdr (cpp_reader *, int, source_location, + unsigned, const char *msgid, ...) + ATTRIBUTE_PRINTF_5; + +extern bool cpp_error_at (cpp_reader * pfile, int level, + source_location src_loc, const char *msgid, ...) + ATTRIBUTE_PRINTF_4; + +extern bool cpp_error_at_richloc (cpp_reader * pfile, int level, + rich_location *richloc, const char *msgid, + ...) + ATTRIBUTE_PRINTF_4; + +/* In lex.c */ +extern int cpp_ideq (const cpp_token *, const char *); +extern void cpp_output_line (cpp_reader *, FILE *); +extern unsigned char *cpp_output_line_to_string (cpp_reader *, + const unsigned char *); +extern void cpp_output_token (const cpp_token *, FILE *); +extern const char *cpp_type2name (enum cpp_ttype, unsigned char flags); +/* Returns the value of an escape sequence, truncated to the correct + target precision. PSTR points to the input pointer, which is just + after the backslash. LIMIT is how much text we have. WIDE is true + if the escape sequence is part of a wide character constant or + string literal. Handles all relevant diagnostics. */ +extern cppchar_t cpp_parse_escape (cpp_reader *, const unsigned char ** pstr, + const unsigned char *limit, int wide); + +/* Structure used to hold a comment block at a given location in the + source code. */ + +typedef struct +{ + /* Text of the comment including the terminators. */ + char *comment; + + /* source location for the given comment. */ + source_location sloc; +} cpp_comment; + +/* Structure holding all comments for a given cpp_reader. */ + +typedef struct +{ + /* table of comment entries. */ + cpp_comment *entries; + + /* number of actual entries entered in the table. */ + int count; + + /* number of entries allocated currently. */ + int allocated; +} cpp_comment_table; + +/* Returns the table of comments encountered by the preprocessor. This + table is only populated when pfile->state.save_comments is true. */ +extern cpp_comment_table *cpp_get_comments (cpp_reader *); + +/* In hash.c */ + +/* Lookup an identifier in the hashtable. Puts the identifier in the + table if it is not already there. */ +extern cpp_hashnode *cpp_lookup (cpp_reader *, const unsigned char *, + unsigned int); + +typedef int (*cpp_cb) (cpp_reader *, cpp_hashnode *, void *); +extern void cpp_forall_identifiers (cpp_reader *, cpp_cb, void *); + +/* In macro.c */ +extern void cpp_scan_nooutput (cpp_reader *); +extern int cpp_sys_macro_p (cpp_reader *); +extern unsigned char *cpp_quote_string (unsigned char *, const unsigned char *, + unsigned int); + +/* In files.c */ +extern bool cpp_included (cpp_reader *, const char *); +extern bool cpp_included_before (cpp_reader *, const char *, source_location); +extern void cpp_make_system_header (cpp_reader *, int, int); +extern bool cpp_push_include (cpp_reader *, const char *); +extern bool cpp_push_default_include (cpp_reader *, const char *); +extern void cpp_change_file (cpp_reader *, enum lc_reason, const char *); +extern const char *cpp_get_path (struct _cpp_file *); +extern cpp_dir *cpp_get_dir (struct _cpp_file *); +extern cpp_buffer *cpp_get_buffer (cpp_reader *); +extern struct _cpp_file *cpp_get_file (cpp_buffer *); +extern cpp_buffer *cpp_get_prev (cpp_buffer *); +extern void cpp_clear_file_cache (cpp_reader *); + +/* In pch.c */ +struct save_macro_data; +extern int cpp_save_state (cpp_reader *, FILE *); +extern int cpp_write_pch_deps (cpp_reader *, FILE *); +extern int cpp_write_pch_state (cpp_reader *, FILE *); +extern int cpp_valid_state (cpp_reader *, const char *, int); +extern void cpp_prepare_state (cpp_reader *, struct save_macro_data **); +extern int cpp_read_state (cpp_reader *, const char *, FILE *, + struct save_macro_data *); + +/* In lex.c */ +extern void cpp_force_token_locations (cpp_reader *, source_location *); +extern void cpp_stop_forcing_token_locations (cpp_reader *); + +/* In expr.c */ +extern enum cpp_ttype cpp_userdef_string_remove_type + (enum cpp_ttype type); +extern enum cpp_ttype cpp_userdef_string_add_type + (enum cpp_ttype type); +extern enum cpp_ttype cpp_userdef_char_remove_type + (enum cpp_ttype type); +extern enum cpp_ttype cpp_userdef_char_add_type + (enum cpp_ttype type); +extern bool cpp_userdef_string_p + (enum cpp_ttype type); +extern bool cpp_userdef_char_p + (enum cpp_ttype type); +extern const char * cpp_get_userdef_suffix + (const cpp_token *); + +#endif /* ! LIBCPP_CPPLIB_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cselib.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cselib.h new file mode 100644 index 0000000..dd94919 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/cselib.h @@ -0,0 +1,140 @@ +/* Common subexpression elimination for GNU compiler. + Copyright (C) 1987-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_CSELIB_H +#define GCC_CSELIB_H + +/* Describe a value. */ +struct cselib_val +{ + /* The hash value. */ + unsigned int hash; + + /* A unique id assigned to values. */ + int uid; + + /* A VALUE rtx that points back to this structure. */ + rtx val_rtx; + + /* All rtl expressions that hold this value at the current time during a + scan. */ + struct elt_loc_list *locs; + + /* If this value is used as an address, points to a list of values that + use it as an address in a MEM. */ + struct elt_list *addr_list; + + struct cselib_val *next_containing_mem; +}; + +/* A list of rtl expressions that hold the same value. */ +struct elt_loc_list { + /* Next element in the list. */ + struct elt_loc_list *next; + /* An rtl expression that holds the value. */ + rtx loc; + /* The insn that made the equivalence. */ + rtx_insn *setting_insn; +}; + +/* Describe a single set that is part of an insn. */ +struct cselib_set +{ + rtx src; + rtx dest; + cselib_val *src_elt; + cselib_val *dest_addr_elt; +}; + +enum cselib_record_what +{ + CSELIB_RECORD_MEMORY = 1, + CSELIB_PRESERVE_CONSTANTS = 2 +}; + +extern void (*cselib_discard_hook) (cselib_val *); +extern void (*cselib_record_sets_hook) (rtx_insn *insn, struct cselib_set *sets, + int n_sets); + +extern cselib_val *cselib_lookup (rtx, machine_mode, + int, machine_mode); +extern cselib_val *cselib_lookup_from_insn (rtx, machine_mode, + int, machine_mode, rtx_insn *); +extern void cselib_init (int); +extern void cselib_clear_table (void); +extern void cselib_finish (void); +extern void cselib_process_insn (rtx_insn *); +extern bool fp_setter_insn (rtx_insn *); +extern machine_mode cselib_reg_set_mode (const_rtx); +extern int rtx_equal_for_cselib_1 (rtx, rtx, machine_mode, int); +extern int references_value_p (const_rtx, int); +extern rtx cselib_expand_value_rtx (rtx, bitmap, int); +typedef rtx (*cselib_expand_callback)(rtx, bitmap, int, void *); +extern rtx cselib_expand_value_rtx_cb (rtx, bitmap, int, + cselib_expand_callback, void *); +extern bool cselib_dummy_expand_value_rtx_cb (rtx, bitmap, int, + cselib_expand_callback, void *); +extern rtx cselib_subst_to_values (rtx, machine_mode); +extern rtx cselib_subst_to_values_from_insn (rtx, machine_mode, rtx_insn *); +extern void cselib_invalidate_rtx (rtx); + +extern void cselib_reset_table (unsigned int); +extern unsigned int cselib_get_next_uid (void); +extern void cselib_preserve_value (cselib_val *); +extern bool cselib_preserved_value_p (cselib_val *); +extern void cselib_preserve_only_values (void); +extern void cselib_preserve_cfa_base_value (cselib_val *, unsigned int); +extern void cselib_add_permanent_equiv (cselib_val *, rtx, rtx_insn *); +extern bool cselib_have_permanent_equivalences (void); +extern void cselib_set_value_sp_based (cselib_val *); +extern bool cselib_sp_based_value_p (cselib_val *); + +extern void dump_cselib_table (FILE *); + +/* Return the canonical value for VAL, following the equivalence chain + towards the earliest (== lowest uid) equivalent value. */ + +static inline cselib_val * +canonical_cselib_val (cselib_val *val) +{ + cselib_val *canon; + + if (!val->locs || val->locs->next + || !val->locs->loc || GET_CODE (val->locs->loc) != VALUE + || val->uid < CSELIB_VAL_PTR (val->locs->loc)->uid) + return val; + + canon = CSELIB_VAL_PTR (val->locs->loc); + gcc_checking_assert (canonical_cselib_val (canon) == canon); + return canon; +} + +/* Return nonzero if we can prove that X and Y contain the same value, taking + our gathered information into account. */ + +static inline int +rtx_equal_for_cselib_p (rtx x, rtx y) +{ + if (x == y) + return 1; + + return rtx_equal_for_cselib_1 (x, y, VOIDmode, 0); +} + +#endif /* GCC_CSELIB_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/data-streamer.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/data-streamer.h new file mode 100644 index 0000000..9d7efbb --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/data-streamer.h @@ -0,0 +1,323 @@ +/* Generic streaming support for various data types. + + Copyright (C) 2011-2017 Free Software Foundation, Inc. + Contributed by Diego Novillo + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_DATA_STREAMER_H +#define GCC_DATA_STREAMER_H + +#include "lto-streamer.h" + +/* Data structures used to pack values and bitflags into a vector of + words. Used to stream values of a fixed number of bits in a space + efficient way. */ +static unsigned const BITS_PER_BITPACK_WORD = HOST_BITS_PER_WIDE_INT; + +typedef unsigned HOST_WIDE_INT bitpack_word_t; + +struct bitpack_d +{ + /* The position of the first unused or unconsumed bit in the word. */ + unsigned pos; + + /* The current word we are (un)packing. */ + bitpack_word_t word; + + /* The lto_output_stream or the lto_input_block we are streaming to/from. */ + void *stream; +}; + +/* In data-streamer.c */ +void bp_pack_var_len_unsigned (struct bitpack_d *, unsigned HOST_WIDE_INT); +void bp_pack_var_len_int (struct bitpack_d *, HOST_WIDE_INT); +unsigned HOST_WIDE_INT bp_unpack_var_len_unsigned (struct bitpack_d *); +HOST_WIDE_INT bp_unpack_var_len_int (struct bitpack_d *); + +/* In data-streamer-out.c */ +void streamer_write_zero (struct output_block *); +void streamer_write_uhwi (struct output_block *, unsigned HOST_WIDE_INT); +void streamer_write_hwi (struct output_block *, HOST_WIDE_INT); +void streamer_write_gcov_count (struct output_block *, gcov_type); +void streamer_write_string (struct output_block *, struct lto_output_stream *, + const char *, bool); +void streamer_write_string_with_length (struct output_block *, + struct lto_output_stream *, + const char *, unsigned int, bool); +void bp_pack_string_with_length (struct output_block *, struct bitpack_d *, + const char *, unsigned int, bool); +void bp_pack_string (struct output_block *, struct bitpack_d *, + const char *, bool); +void streamer_write_uhwi_stream (struct lto_output_stream *, + unsigned HOST_WIDE_INT); +void streamer_write_hwi_stream (struct lto_output_stream *, HOST_WIDE_INT); +void streamer_write_gcov_count_stream (struct lto_output_stream *, gcov_type); +void streamer_write_data_stream (struct lto_output_stream *, const void *, + size_t); +void streamer_write_wide_int (struct output_block *, const wide_int &); +void streamer_write_widest_int (struct output_block *, const widest_int &); + +/* In data-streamer-in.c */ +const char *streamer_read_string (struct data_in *, struct lto_input_block *); +const char *streamer_read_indexed_string (struct data_in *, + struct lto_input_block *, + unsigned int *); +const char *bp_unpack_indexed_string (struct data_in *, struct bitpack_d *, + unsigned int *); +const char *bp_unpack_string (struct data_in *, struct bitpack_d *); +unsigned HOST_WIDE_INT streamer_read_uhwi (struct lto_input_block *); +HOST_WIDE_INT streamer_read_hwi (struct lto_input_block *); +gcov_type streamer_read_gcov_count (struct lto_input_block *); +wide_int streamer_read_wide_int (struct lto_input_block *); +widest_int streamer_read_widest_int (struct lto_input_block *); + +/* Returns a new bit-packing context for bit-packing into S. */ +static inline struct bitpack_d +bitpack_create (struct lto_output_stream *s) +{ + struct bitpack_d bp; + bp.pos = 0; + bp.word = 0; + bp.stream = (void *)s; + return bp; +} + +/* Pack the NBITS bit sized value VAL into the bit-packing context BP. */ +static inline void +bp_pack_value (struct bitpack_d *bp, bitpack_word_t val, unsigned nbits) +{ + bitpack_word_t word = bp->word; + int pos = bp->pos; + + /* Verify that VAL fits in the NBITS. */ + gcc_checking_assert (nbits == BITS_PER_BITPACK_WORD + || !(val & ~(((bitpack_word_t)1< BITS_PER_BITPACK_WORD) + { + streamer_write_uhwi_stream ((struct lto_output_stream *) bp->stream, + word); + word = val; + pos = nbits; + } + else + { + word |= val << pos; + pos += nbits; + } + bp->word = word; + bp->pos = pos; +} + +/* Finishes bit-packing of BP. */ +static inline void +streamer_write_bitpack (struct bitpack_d *bp) +{ + streamer_write_uhwi_stream ((struct lto_output_stream *) bp->stream, + bp->word); + bp->word = 0; + bp->pos = 0; +} + +/* Returns a new bit-packing context for bit-unpacking from IB. */ +static inline struct bitpack_d +streamer_read_bitpack (struct lto_input_block *ib) +{ + struct bitpack_d bp; + bp.word = streamer_read_uhwi (ib); + bp.pos = 0; + bp.stream = (void *)ib; + return bp; +} + +/* Unpacks NBITS bits from the bit-packing context BP and returns them. */ +static inline bitpack_word_t +bp_unpack_value (struct bitpack_d *bp, unsigned nbits) +{ + bitpack_word_t mask, val; + int pos = bp->pos; + + mask = (nbits == BITS_PER_BITPACK_WORD + ? (bitpack_word_t) -1 + : ((bitpack_word_t) 1 << nbits) - 1); + + /* If there are not continuous nbits in the current bitpack word + switch to the next one. */ + if (pos + nbits > BITS_PER_BITPACK_WORD) + { + bp->word = val + = streamer_read_uhwi ((struct lto_input_block *)bp->stream); + bp->pos = nbits; + return val & mask; + } + val = bp->word; + val >>= pos; + bp->pos = pos + nbits; + + return val & mask; +} + + +/* Write a character to the output block. */ + +static inline void +streamer_write_char_stream (struct lto_output_stream *obs, char c) +{ + /* No space left. */ + if (obs->left_in_block == 0) + lto_append_block (obs); + + /* Write the actual character. */ + char *current_pointer = obs->current_pointer; + *(current_pointer++) = c; + obs->current_pointer = current_pointer; + obs->total_size++; + obs->left_in_block--; +} + + +/* Read byte from the input block. */ + +static inline unsigned char +streamer_read_uchar (struct lto_input_block *ib) +{ + if (ib->p >= ib->len) + lto_section_overrun (ib); + return (ib->data[ib->p++]); +} + +/* Output VAL into OBS and verify it is in range MIN...MAX that is supposed + to be compile time constant. + Be host independent, limit range to 31bits. */ + +static inline void +streamer_write_hwi_in_range (struct lto_output_stream *obs, + HOST_WIDE_INT min, + HOST_WIDE_INT max, + HOST_WIDE_INT val) +{ + HOST_WIDE_INT range = max - min; + + gcc_checking_assert (val >= min && val <= max && range > 0 + && range < 0x7fffffff); + + val -= min; + streamer_write_uhwi_stream (obs, (unsigned HOST_WIDE_INT) val); +} + +/* Input VAL into OBS and verify it is in range MIN...MAX that is supposed + to be compile time constant. PURPOSE is used for error reporting. */ + +static inline HOST_WIDE_INT +streamer_read_hwi_in_range (struct lto_input_block *ib, + const char *purpose, + HOST_WIDE_INT min, + HOST_WIDE_INT max) +{ + HOST_WIDE_INT range = max - min; + unsigned HOST_WIDE_INT uval = streamer_read_uhwi (ib); + + gcc_checking_assert (range > 0 && range < 0x7fffffff); + + HOST_WIDE_INT val = (HOST_WIDE_INT) (uval + (unsigned HOST_WIDE_INT) min); + if (val < min || val > max) + lto_value_range_error (purpose, val, min, max); + return val; +} + +/* Output VAL into BP and verify it is in range MIN...MAX that is supposed + to be compile time constant. + Be host independent, limit range to 31bits. */ + +static inline void +bp_pack_int_in_range (struct bitpack_d *bp, + HOST_WIDE_INT min, + HOST_WIDE_INT max, + HOST_WIDE_INT val) +{ + HOST_WIDE_INT range = max - min; + int nbits = floor_log2 (range) + 1; + + gcc_checking_assert (val >= min && val <= max && range > 0 + && range < 0x7fffffff); + + val -= min; + bp_pack_value (bp, val, nbits); +} + +/* Input VAL into BP and verify it is in range MIN...MAX that is supposed + to be compile time constant. PURPOSE is used for error reporting. */ + +static inline HOST_WIDE_INT +bp_unpack_int_in_range (struct bitpack_d *bp, + const char *purpose, + HOST_WIDE_INT min, + HOST_WIDE_INT max) +{ + HOST_WIDE_INT range = max - min; + int nbits = floor_log2 (range) + 1; + HOST_WIDE_INT val = bp_unpack_value (bp, nbits); + + gcc_checking_assert (range > 0 && range < 0x7fffffff); + + if (val < min || val > max) + lto_value_range_error (purpose, val, min, max); + return val; +} + +/* Output VAL of type "enum enum_name" into OBS. + Assume range 0...ENUM_LAST - 1. */ +#define streamer_write_enum(obs,enum_name,enum_last,val) \ + streamer_write_hwi_in_range ((obs), 0, (int)(enum_last) - 1, (int)(val)) + +/* Input enum of type "enum enum_name" from IB. + Assume range 0...ENUM_LAST - 1. */ +#define streamer_read_enum(ib,enum_name,enum_last) \ + (enum enum_name)streamer_read_hwi_in_range ((ib), #enum_name, 0, \ + (int)(enum_last) - 1) + +/* Output VAL of type "enum enum_name" into BP. + Assume range 0...ENUM_LAST - 1. */ +#define bp_pack_enum(bp,enum_name,enum_last,val) \ + bp_pack_int_in_range ((bp), 0, (int)(enum_last) - 1, (int)(val)) + +/* Input enum of type "enum enum_name" from BP. + Assume range 0...ENUM_LAST - 1. */ +#define bp_unpack_enum(bp,enum_name,enum_last) \ + (enum enum_name)bp_unpack_int_in_range ((bp), #enum_name, 0, \ + (int)(enum_last) - 1) + +/* Output the start of a record with TAG to output block OB. */ + +static inline void +streamer_write_record_start (struct output_block *ob, enum LTO_tags tag) +{ + streamer_write_enum (ob->main_stream, LTO_tags, LTO_NUM_TAGS, tag); +} + +/* Return the next tag in the input block IB. */ + +static inline enum LTO_tags +streamer_read_record_start (struct lto_input_block *ib) +{ + return streamer_read_enum (ib, LTO_tags, LTO_NUM_TAGS); +} + +#endif /* GCC_DATA_STREAMER_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dbgcnt.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dbgcnt.h new file mode 100644 index 0000000..d80c872 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dbgcnt.h @@ -0,0 +1,39 @@ +/* Debug counter for debugging support + Copyright (C) 2006-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. + +See dbgcnt.def for usage information. */ + +#ifndef GCC_DBGCNT_H +#define GCC_DBGCNT_H + +#define DEBUG_COUNTER(a) a, + +enum debug_counter { +#include "dbgcnt.def" + debug_counter_number_of_counters +}; + +#undef DEBUG_COUNTER + +extern bool dbg_cnt_is_enabled (enum debug_counter index); +extern bool dbg_cnt (enum debug_counter index); +extern void dbg_cnt_process_opt (const char *arg); +extern void dbg_cnt_list_all_counters (void); + +#endif /* GCC_DBGCNT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dbxout.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dbxout.h new file mode 100644 index 0000000..ee6a08d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dbxout.h @@ -0,0 +1,61 @@ +/* dbxout.h - Various declarations for functions found in dbxout.c + Copyright (C) 1998-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_DBXOUT_H +#define GCC_DBXOUT_H + +extern int dbxout_symbol (tree, int); +extern void dbxout_parms (tree); +extern void dbxout_reg_parms (tree); +extern int dbxout_syms (tree); + +extern void default_stabs_asm_out_destructor (rtx, int); +extern void default_stabs_asm_out_constructor (rtx, int); + +/* dbxout helper functions */ +#if defined DBX_DEBUGGING_INFO || defined XCOFF_DEBUGGING_INFO + +extern void dbxout_int (int); +extern void dbxout_stabd (int, int); +extern void dbxout_begin_stabn (int); +extern void dbxout_begin_stabn_sline (int); +extern void dbxout_begin_empty_stabs (int); +extern void dbxout_begin_simple_stabs (const char *, int); +extern void dbxout_begin_simple_stabs_desc (const char *, int, int); + +extern void dbxout_stab_value_zero (void); +extern void dbxout_stab_value_label (const char *); +extern void dbxout_stab_value_label_diff (const char *, const char *); +extern void dbxout_stab_value_internal_label (const char *, int *); +extern void dbxout_stab_value_internal_label_diff (const char *, int *, + const char *); +#endif + +/* Language description for N_SO stabs. */ +#define N_SO_AS 1 +#define N_SO_C 2 +#define N_SO_ANSI_C 3 +#define N_SO_CC 4 /* c++*/ +#define N_SO_FORTRAN 5 +#define N_SO_PASCAL 6 +#define N_SO_FORTRAN90 7 +#define N_SO_OBJC 50 +#define N_SO_OBJCPLUS 51 + +#endif /* GCC_DBXOUT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dce.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dce.h new file mode 100644 index 0000000..78981ce --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dce.h @@ -0,0 +1,27 @@ +/* RTL dead code elimination. + Copyright (C) 2005-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_DCE_H +#define GCC_DCE_H + +extern void run_word_dce (void); +extern void run_fast_dce (void); +extern void run_fast_df_dce (void); + +#endif /* GCC_DCE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ddg.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ddg.h new file mode 100644 index 0000000..ccf00b5 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ddg.h @@ -0,0 +1,185 @@ +/* DDG - Data Dependence Graph - interface. + Copyright (C) 2004-2017 Free Software Foundation, Inc. + Contributed by Ayal Zaks and Mustafa Hagog + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_DDG_H +#define GCC_DDG_H + +/* For sbitmap. */ + +typedef struct ddg_node *ddg_node_ptr; +typedef struct ddg_edge *ddg_edge_ptr; +typedef struct ddg *ddg_ptr; +typedef struct ddg_scc *ddg_scc_ptr; +typedef struct ddg_all_sccs *ddg_all_sccs_ptr; + +enum dep_type {TRUE_DEP, OUTPUT_DEP, ANTI_DEP}; +enum dep_data_type {REG_OR_MEM_DEP, REG_DEP, MEM_DEP, REG_AND_MEM_DEP}; + +/* The following two macros enables direct access to the successors and + predecessors bitmaps held in each ddg_node. Do not make changes to + these bitmaps, unless you want to change the DDG. */ +#define NODE_SUCCESSORS(x) ((x)->successors) +#define NODE_PREDECESSORS(x) ((x)->predecessors) + +/* A structure that represents a node in the DDG. */ +struct ddg_node +{ + /* Each node has a unique CUID index. These indices increase monotonically + (according to the order of the corresponding INSN in the BB), starting + from 0 with no gaps. */ + int cuid; + + /* The insn represented by the node. */ + rtx_insn *insn; + + /* A note preceding INSN (or INSN itself), such that all insns linked + from FIRST_NOTE until INSN (inclusive of both) are moved together + when reordering the insns. This takes care of notes that should + continue to precede INSN. */ + rtx_insn *first_note; + + /* Incoming and outgoing dependency edges. */ + ddg_edge_ptr in; + ddg_edge_ptr out; + + /* Each bit corresponds to a ddg_node according to its cuid, and is + set iff the node is a successor/predecessor of "this" node. */ + sbitmap successors; + sbitmap predecessors; + + /* For general use by algorithms manipulating the ddg. */ + union { + int count; + void *info; + } aux; +}; + +/* A structure that represents an edge in the DDG. */ +struct ddg_edge +{ + /* The source and destination nodes of the dependency edge. */ + ddg_node_ptr src; + ddg_node_ptr dest; + + /* TRUE, OUTPUT or ANTI dependency. */ + dep_type type; + + /* REG or MEM dependency. */ + dep_data_type data_type; + + /* Latency of the dependency. */ + int latency; + + /* The distance: number of loop iterations the dependency crosses. */ + int distance; + + /* The following two fields are used to form a linked list of the in/out + going edges to/from each node. */ + ddg_edge_ptr next_in; + ddg_edge_ptr next_out; + + /* For general use by algorithms manipulating the ddg. */ + union { + int count; + void *info; + } aux; +}; + +/* This structure holds the Data Dependence Graph for a basic block. */ +struct ddg +{ + /* The basic block for which this DDG is built. */ + basic_block bb; + + /* Number of instructions in the basic block. */ + int num_nodes; + + /* Number of load/store instructions in the BB - statistics. */ + int num_loads; + int num_stores; + + /* Number of debug instructions in the BB. */ + int num_debug; + + /* This array holds the nodes in the graph; it is indexed by the node + cuid, which follows the order of the instructions in the BB. */ + ddg_node_ptr nodes; + + /* The branch closing the loop. */ + ddg_node_ptr closing_branch; + + /* Build dependence edges for closing_branch, when set. In certain cases, + the closing branch can be dealt with separately from the insns of the + loop, and then no such deps are needed. */ + int closing_branch_deps; + + /* Array and number of backarcs (edges with distance > 0) in the DDG. */ + int num_backarcs; + ddg_edge_ptr *backarcs; +}; + + +/* Holds information on an SCC (Strongly Connected Component) of the DDG. */ +struct ddg_scc +{ + /* A bitmap that represents the nodes of the DDG that are in the SCC. */ + sbitmap nodes; + + /* Array and number of backarcs (edges with distance > 0) in the SCC. */ + ddg_edge_ptr *backarcs; + int num_backarcs; + + /* The maximum of (total_latency/total_distance) over all cycles in SCC. */ + int recurrence_length; +}; + +/* This structure holds the SCCs of the DDG. */ +struct ddg_all_sccs +{ + /* Array that holds the SCCs in the DDG, and their number. */ + ddg_scc_ptr *sccs; + int num_sccs; + + ddg_ptr ddg; +}; + + +ddg_ptr create_ddg (basic_block, int closing_branch_deps); +void free_ddg (ddg_ptr); + +void print_ddg (FILE *, ddg_ptr); +void vcg_print_ddg (FILE *, ddg_ptr); +void print_ddg_edge (FILE *, ddg_edge_ptr); +void print_sccs (FILE *, ddg_all_sccs_ptr, ddg_ptr); + +ddg_node_ptr get_node_of_insn (ddg_ptr, rtx_insn *); + +void find_successors (sbitmap result, ddg_ptr, sbitmap); +void find_predecessors (sbitmap result, ddg_ptr, sbitmap); + +ddg_all_sccs_ptr create_ddg_all_sccs (ddg_ptr); +void free_ddg_all_sccs (ddg_all_sccs_ptr); + +int find_nodes_on_paths (sbitmap result, ddg_ptr, sbitmap from, sbitmap to); +int longest_simple_path (ddg_ptr, int from, int to, sbitmap via); + +bool autoinc_var_is_used_p (rtx_insn *, rtx_insn *); + +#endif /* GCC_DDG_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/debug.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/debug.h new file mode 100644 index 0000000..3953658 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/debug.h @@ -0,0 +1,245 @@ +/* Debug hooks for GCC. + Copyright (C) 2001-2017 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING3. If not see + . */ + +#ifndef GCC_DEBUG_H +#define GCC_DEBUG_H + +/* This structure contains hooks for the debug information output + functions, accessed through the global instance debug_hooks set in + toplev.c according to command line options. */ +struct gcc_debug_hooks +{ + /* Initialize debug output. MAIN_FILENAME is the name of the main + input file. */ + void (* init) (const char *main_filename); + + /* Output debug symbols. */ + void (* finish) (const char *main_filename); + + /* Run cleanups necessary after early debug generation. */ + void (* early_finish) (const char *main_filename); + + /* Called from cgraph_optimize before starting to assemble + functions/variables/toplevel asms. */ + void (* assembly_start) (void); + + /* Macro defined on line LINE with name and expansion TEXT. */ + void (* define) (unsigned int line, const char *text); + + /* MACRO undefined on line LINE. */ + void (* undef) (unsigned int line, const char *macro); + + /* Record the beginning of a new source file FILE from LINE number + in the previous one. */ + void (* start_source_file) (unsigned int line, const char *file); + + /* Record the resumption of a source file. LINE is the line number + in the source file we are returning to. */ + void (* end_source_file) (unsigned int line); + + /* Record the beginning of block N, counting from 1 and not + including the function-scope block, at LINE. */ + void (* begin_block) (unsigned int line, unsigned int n); + + /* Record the end of a block. Arguments as for begin_block. */ + void (* end_block) (unsigned int line, unsigned int n); + + /* Returns nonzero if it is appropriate not to emit any debugging + information for BLOCK, because it doesn't contain any + instructions. This may not be the case for blocks containing + nested functions, since we may actually call such a function even + though the BLOCK information is messed up. Defaults to true. */ + bool (* ignore_block) (const_tree); + + /* Record a source file location at (FILE, LINE, COLUMN, DISCRIMINATOR). */ + void (* source_line) (unsigned int line, unsigned int column, + const char *file, int discriminator, bool is_stmt); + + /* Called at start of prologue code. LINE is the first line in the + function. */ + void (* begin_prologue) (unsigned int line, unsigned int column, + const char *file); + + /* Called at end of prologue code. LINE is the first line in the + function. */ + void (* end_prologue) (unsigned int line, const char *file); + + /* Called at beginning of epilogue code. */ + void (* begin_epilogue) (unsigned int line, const char *file); + + /* Record end of epilogue code. */ + void (* end_epilogue) (unsigned int line, const char *file); + + /* Called at start of function DECL, before it is declared. */ + void (* begin_function) (tree decl); + + /* Record end of function. LINE is highest line number in function. */ + void (* end_function) (unsigned int line); + + /* Register UNIT as the main translation unit. Called from front-ends when + they create their main translation unit. */ + void (* register_main_translation_unit) (tree); + + /* Debug information for a function DECL. This might include the + function name (a symbol), its parameters, and the block that + makes up the function's body, and the local variables of the + function. + + This is only called for FUNCTION_DECLs. It is part of the late + debug pass and is called from rest_of_handle_final. + + Location information is available at this point. + + See the documentation for early_global_decl and late_global_decl + for other entry points into the debugging back-ends for DECLs. */ + void (* function_decl) (tree decl); + + /* Debug information for a global DECL. Called from the parser + after the parsing process has finished. + + This gets called for both variables and functions. + + Location information is not available at this point, but it is a + good probe point to get access to symbols before they get + optimized away. + + This hook may be called on VAR_DECLs or FUNCTION_DECLs. It is up + to the hook to use what it needs. */ + void (* early_global_decl) (tree decl); + + /* Augment debug information generated by early_global_decl with + more complete debug info (if applicable). Called from toplev.c + after the compilation proper has finished and cgraph information + is available. + + This gets called for both variables and functions. + + Location information is usually available at this point, unless + the hook is being called for a decl that has been optimized away. + + This hook may be called on VAR_DECLs or FUNCTION_DECLs. It is up + to the hook to use what it needs. */ + void (* late_global_decl) (tree decl); + + /* Debug information for a type DECL. Called from toplev.c after + compilation proper, also from various language front ends to + record built-in types. The second argument is properly a + boolean, which indicates whether or not the type is a "local" + type as determined by the language. (It's not a boolean for + legacy reasons.) */ + void (* type_decl) (tree decl, int local); + + /* Debug information for imported modules and declarations. */ + void (* imported_module_or_decl) (tree decl, tree name, + tree context, bool child); + + /* DECL is an inline function, whose body is present, but which is + not being output at this point. */ + void (* deferred_inline_function) (tree decl); + + /* DECL is an inline function which is about to be emitted out of + line. The hook is useful to, e.g., emit abstract debug info for + the inline before it gets mangled by optimization. */ + void (* outlining_inline_function) (tree decl); + + /* Called from final_scan_insn for any CODE_LABEL insn whose + LABEL_NAME is non-null. */ + void (* label) (rtx_code_label *); + + /* Called after the start and before the end of writing a PCH file. + The parameter is 0 if after the start, 1 if before the end. */ + void (* handle_pch) (unsigned int); + + /* Called from final_scan_insn for any NOTE_INSN_VAR_LOCATION note. */ + void (* var_location) (rtx_insn *); + + /* Called from finalize_size_functions for size functions so that their body + can be encoded in the debug info to describe the layout of variable-length + structures. */ + void (* size_function) (tree decl); + + /* Called from final_scan_insn if there is a switch between hot and cold + text sections. */ + void (* switch_text_section) (void); + + /* Called from grokdeclarator. Replaces the anonymous name with the + type name. */ + void (* set_name) (tree, tree); + + /* This is 1 if the debug writer wants to see start and end commands for the + main source files, and 0 otherwise. */ + int start_end_main_source_file; + + /* The type of symtab field used by these debug hooks. This is one + of the TYPE_SYMTAB_IS_xxx values defined in tree.h. */ + int tree_type_symtab_field; +}; + +extern const struct gcc_debug_hooks *debug_hooks; + +/* The do-nothing hooks. */ +extern void debug_nothing_void (void); +extern void debug_nothing_charstar (const char *); +extern void debug_nothing_int_int_charstar (unsigned int, unsigned int, + const char *); +extern void debug_nothing_int_charstar (unsigned int, const char *); +extern void debug_nothing_int_int_charstar_int_bool (unsigned int, + unsigned int, + const char *, + int, bool); +extern void debug_nothing_int (unsigned int); +extern void debug_nothing_int_int (unsigned int, unsigned int); +extern void debug_nothing_tree (tree); +extern void debug_nothing_tree_tree (tree, tree); +extern void debug_nothing_tree_int (tree, int); +extern void debug_nothing_tree_tree_tree_bool (tree, tree, tree, bool); +extern bool debug_true_const_tree (const_tree); +extern void debug_nothing_rtx_insn (rtx_insn *); +extern void debug_nothing_rtx_code_label (rtx_code_label *); + +/* Hooks for various debug formats. */ +extern const struct gcc_debug_hooks do_nothing_debug_hooks; +extern const struct gcc_debug_hooks dbx_debug_hooks; +extern const struct gcc_debug_hooks sdb_debug_hooks; +extern const struct gcc_debug_hooks xcoff_debug_hooks; +extern const struct gcc_debug_hooks dwarf2_debug_hooks; +extern const struct gcc_debug_hooks dwarf2_lineno_debug_hooks; +extern const struct gcc_debug_hooks vmsdbg_debug_hooks; + +/* Dwarf2 frame information. */ + +extern void dwarf2out_begin_prologue (unsigned int, unsigned int, + const char *); +extern void dwarf2out_vms_end_prologue (unsigned int, const char *); +extern void dwarf2out_vms_begin_epilogue (unsigned int, const char *); +extern void dwarf2out_end_epilogue (unsigned int, const char *); +extern void dwarf2out_frame_finish (void); +/* Decide whether we want to emit frame unwind information for the current + translation unit. */ +extern bool dwarf2out_do_frame (void); +extern bool dwarf2out_do_cfi_asm (void); +extern void dwarf2out_switch_text_section (void); + +const char *remap_debug_filename (const char *); +void add_debug_prefix_map (const char *); + +/* For -fdump-go-spec. */ + +extern const struct gcc_debug_hooks * +dump_go_spec_init (const char *, const struct gcc_debug_hooks *); + +#endif /* !GCC_DEBUG_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/defaults.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/defaults.h new file mode 100644 index 0000000..7ad92d9 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/defaults.h @@ -0,0 +1,1478 @@ +/* Definitions of various defaults for tm.h macros. + Copyright (C) 1992-2017 Free Software Foundation, Inc. + Contributed by Ron Guilmette (rfg@monkeys.com) + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +#ifndef GCC_DEFAULTS_H +#define GCC_DEFAULTS_H + +/* How to start an assembler comment. */ +#ifndef ASM_COMMENT_START +#define ASM_COMMENT_START ";#" +#endif + +/* Store in OUTPUT a string (made with alloca) containing an + assembler-name for a local static variable or function named NAME. + LABELNO is an integer which is different for each call. */ + +#ifndef ASM_PN_FORMAT +# ifndef NO_DOT_IN_LABEL +# define ASM_PN_FORMAT "%s.%lu" +# else +# ifndef NO_DOLLAR_IN_LABEL +# define ASM_PN_FORMAT "%s$%lu" +# else +# define ASM_PN_FORMAT "__%s_%lu" +# endif +# endif +#endif /* ! ASM_PN_FORMAT */ + +#ifndef ASM_FORMAT_PRIVATE_NAME +# define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ + do { const char *const name_ = (NAME); \ + char *const output_ = (OUTPUT) = \ + (char *) alloca (strlen (name_) + 32); \ + sprintf (output_, ASM_PN_FORMAT, name_, (unsigned long)(LABELNO)); \ + } while (0) +#endif + +/* Choose a reasonable default for ASM_OUTPUT_ASCII. */ + +#ifndef ASM_OUTPUT_ASCII +#define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \ + do { \ + FILE *_hide_asm_out_file = (MYFILE); \ + const unsigned char *_hide_p = (const unsigned char *) (MYSTRING); \ + int _hide_thissize = (MYLENGTH); \ + { \ + FILE *asm_out_file = _hide_asm_out_file; \ + const unsigned char *p = _hide_p; \ + int thissize = _hide_thissize; \ + int i; \ + fprintf (asm_out_file, "\t.ascii \""); \ + \ + for (i = 0; i < thissize; i++) \ + { \ + int c = p[i]; \ + if (c == '\"' || c == '\\') \ + putc ('\\', asm_out_file); \ + if (ISPRINT (c)) \ + putc (c, asm_out_file); \ + else \ + { \ + fprintf (asm_out_file, "\\%o", c); \ + /* After an octal-escape, if a digit follows, \ + terminate one string constant and start another. \ + The VAX assembler fails to stop reading the escape \ + after three digits, so this is the only way we \ + can get it to parse the data properly. */ \ + if (i < thissize - 1 && ISDIGIT (p[i + 1])) \ + fprintf (asm_out_file, "\"\n\t.ascii \""); \ + } \ + } \ + fprintf (asm_out_file, "\"\n"); \ + } \ + } \ + while (0) +#endif + +/* This is how we tell the assembler to equate two values. */ +#ifdef SET_ASM_OP +#ifndef ASM_OUTPUT_DEF +#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \ + do { fprintf ((FILE), "%s", SET_ASM_OP); \ + assemble_name (FILE, LABEL1); \ + fprintf (FILE, ","); \ + assemble_name (FILE, LABEL2); \ + fprintf (FILE, "\n"); \ + } while (0) +#endif +#endif + +#ifndef IFUNC_ASM_TYPE +#define IFUNC_ASM_TYPE "gnu_indirect_function" +#endif + +#ifndef TLS_COMMON_ASM_OP +#define TLS_COMMON_ASM_OP ".tls_common" +#endif + +#if defined (HAVE_AS_TLS) && !defined (ASM_OUTPUT_TLS_COMMON) +#define ASM_OUTPUT_TLS_COMMON(FILE, DECL, NAME, SIZE) \ + do \ + { \ + fprintf ((FILE), "\t%s\t", TLS_COMMON_ASM_OP); \ + assemble_name ((FILE), (NAME)); \ + fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \ + (SIZE), DECL_ALIGN (DECL) / BITS_PER_UNIT); \ + } \ + while (0) +#endif + +/* Decide whether to defer emitting the assembler output for an equate + of two values. The default is to not defer output. */ +#ifndef TARGET_DEFERRED_OUTPUT_DEFS +#define TARGET_DEFERRED_OUTPUT_DEFS(DECL,TARGET) false +#endif + +/* This is how to output the definition of a user-level label named + NAME, such as the label on variable NAME. */ + +#ifndef ASM_OUTPUT_LABEL +#define ASM_OUTPUT_LABEL(FILE,NAME) \ + do { \ + assemble_name ((FILE), (NAME)); \ + fputs (":\n", (FILE)); \ + } while (0) +#endif + +/* This is how to output the definition of a user-level label named + NAME, such as the label on a function. */ + +#ifndef ASM_OUTPUT_FUNCTION_LABEL +#define ASM_OUTPUT_FUNCTION_LABEL(FILE, NAME, DECL) \ + ASM_OUTPUT_LABEL ((FILE), (NAME)) +#endif + +/* Output the definition of a compiler-generated label named NAME. */ +#ifndef ASM_OUTPUT_INTERNAL_LABEL +#define ASM_OUTPUT_INTERNAL_LABEL(FILE,NAME) \ + do { \ + assemble_name_raw ((FILE), (NAME)); \ + fputs (":\n", (FILE)); \ + } while (0) +#endif + +/* This is how to output a reference to a user-level label named NAME. */ + +#ifndef ASM_OUTPUT_LABELREF +#define ASM_OUTPUT_LABELREF(FILE,NAME) \ + do { \ + fputs (user_label_prefix, (FILE)); \ + fputs ((NAME), (FILE)); \ + } while (0); +#endif + +/* Allow target to print debug info labels specially. This is useful for + VLIW targets, since debug info labels should go into the middle of + instruction bundles instead of breaking them. */ + +#ifndef ASM_OUTPUT_DEBUG_LABEL +#define ASM_OUTPUT_DEBUG_LABEL(FILE, PREFIX, NUM) \ + (*targetm.asm_out.internal_label) (FILE, PREFIX, NUM) +#endif + +/* This is how we tell the assembler that a symbol is weak. */ +#ifndef ASM_OUTPUT_WEAK_ALIAS +#if defined (ASM_WEAKEN_LABEL) && defined (ASM_OUTPUT_DEF) +#define ASM_OUTPUT_WEAK_ALIAS(STREAM, NAME, VALUE) \ + do \ + { \ + ASM_WEAKEN_LABEL (STREAM, NAME); \ + if (VALUE) \ + ASM_OUTPUT_DEF (STREAM, NAME, VALUE); \ + } \ + while (0) +#endif +#endif + +/* This is how we tell the assembler that a symbol is a weak alias to + another symbol that doesn't require the other symbol to be defined. + Uses of the former will turn into weak uses of the latter, i.e., + uses that, in case the latter is undefined, will not cause errors, + and will add it to the symbol table as weak undefined. However, if + the latter is referenced directly, a strong reference prevails. */ +#ifndef ASM_OUTPUT_WEAKREF +#if defined HAVE_GAS_WEAKREF +#define ASM_OUTPUT_WEAKREF(FILE, DECL, NAME, VALUE) \ + do \ + { \ + fprintf ((FILE), "\t.weakref\t"); \ + assemble_name ((FILE), (NAME)); \ + fprintf ((FILE), ","); \ + assemble_name ((FILE), (VALUE)); \ + fprintf ((FILE), "\n"); \ + } \ + while (0) +#endif +#endif + +/* How to emit a .type directive. */ +#ifndef ASM_OUTPUT_TYPE_DIRECTIVE +#if defined TYPE_ASM_OP && defined TYPE_OPERAND_FMT +#define ASM_OUTPUT_TYPE_DIRECTIVE(STREAM, NAME, TYPE) \ + do \ + { \ + fputs (TYPE_ASM_OP, STREAM); \ + assemble_name (STREAM, NAME); \ + fputs (", ", STREAM); \ + fprintf (STREAM, TYPE_OPERAND_FMT, TYPE); \ + putc ('\n', STREAM); \ + } \ + while (0) +#endif +#endif + +/* How to emit a .size directive. */ +#ifndef ASM_OUTPUT_SIZE_DIRECTIVE +#ifdef SIZE_ASM_OP +#define ASM_OUTPUT_SIZE_DIRECTIVE(STREAM, NAME, SIZE) \ + do \ + { \ + HOST_WIDE_INT size_ = (SIZE); \ + fputs (SIZE_ASM_OP, STREAM); \ + assemble_name (STREAM, NAME); \ + fprintf (STREAM, ", " HOST_WIDE_INT_PRINT_DEC "\n", size_); \ + } \ + while (0) + +#define ASM_OUTPUT_MEASURED_SIZE(STREAM, NAME) \ + do \ + { \ + fputs (SIZE_ASM_OP, STREAM); \ + assemble_name (STREAM, NAME); \ + fputs (", .-", STREAM); \ + assemble_name (STREAM, NAME); \ + putc ('\n', STREAM); \ + } \ + while (0) + +#endif +#endif + +/* This determines whether or not we support weak symbols. SUPPORTS_WEAK + must be a preprocessor constant. */ +#ifndef SUPPORTS_WEAK +#if defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL) +#define SUPPORTS_WEAK 1 +#else +#define SUPPORTS_WEAK 0 +#endif +#endif + +/* This determines whether or not we support weak symbols during target + code generation. TARGET_SUPPORTS_WEAK can be any valid C expression. */ +#ifndef TARGET_SUPPORTS_WEAK +#define TARGET_SUPPORTS_WEAK (SUPPORTS_WEAK) +#endif + +/* This determines whether or not we support the discriminator + attribute in the .loc directive. */ +#ifndef SUPPORTS_DISCRIMINATOR +#ifdef HAVE_GAS_DISCRIMINATOR +#define SUPPORTS_DISCRIMINATOR 1 +#else +#define SUPPORTS_DISCRIMINATOR 0 +#endif +#endif + +/* This determines whether or not we support link-once semantics. */ +#ifndef SUPPORTS_ONE_ONLY +#ifdef MAKE_DECL_ONE_ONLY +#define SUPPORTS_ONE_ONLY 1 +#else +#define SUPPORTS_ONE_ONLY 0 +#endif +#endif + +/* This determines whether weak symbols must be left out of a static + archive's table of contents. Defining this macro to be nonzero has + the consequence that certain symbols will not be made weak that + otherwise would be. The C++ ABI requires this macro to be zero; + see the documentation. */ +#ifndef TARGET_WEAK_NOT_IN_ARCHIVE_TOC +#define TARGET_WEAK_NOT_IN_ARCHIVE_TOC 0 +#endif + +/* This determines whether or not we need linkonce unwind information. */ +#ifndef TARGET_USES_WEAK_UNWIND_INFO +#define TARGET_USES_WEAK_UNWIND_INFO 0 +#endif + +/* By default, there is no prefix on user-defined symbols. */ +#ifndef USER_LABEL_PREFIX +#define USER_LABEL_PREFIX "" +#endif + +/* If the target supports weak symbols, define TARGET_ATTRIBUTE_WEAK to + provide a weak attribute. Else define it to nothing. + + This would normally belong in ansidecl.h, but SUPPORTS_WEAK is + not available at that time. + + Note, this is only for use by target files which we know are to be + compiled by GCC. */ +#ifndef TARGET_ATTRIBUTE_WEAK +# if SUPPORTS_WEAK +# define TARGET_ATTRIBUTE_WEAK __attribute__ ((weak)) +# else +# define TARGET_ATTRIBUTE_WEAK +# endif +#endif + +/* By default we can assume that all global symbols are in one namespace, + across all shared libraries. */ +#ifndef MULTIPLE_SYMBOL_SPACES +# define MULTIPLE_SYMBOL_SPACES 0 +#endif + +/* If the target supports init_priority C++ attribute, give + SUPPORTS_INIT_PRIORITY a nonzero value. */ +#ifndef SUPPORTS_INIT_PRIORITY +#define SUPPORTS_INIT_PRIORITY 1 +#endif /* SUPPORTS_INIT_PRIORITY */ + +/* If we have a definition of INCOMING_RETURN_ADDR_RTX, assume that + the rest of the DWARF 2 frame unwind support is also provided. */ +#if !defined (DWARF2_UNWIND_INFO) && defined (INCOMING_RETURN_ADDR_RTX) +#define DWARF2_UNWIND_INFO 1 +#endif + +/* If we have named sections, and we're using crtstuff to run ctors, + use them for registering eh frame information. */ +#if defined (TARGET_ASM_NAMED_SECTION) && DWARF2_UNWIND_INFO \ + && !defined (EH_FRAME_THROUGH_COLLECT2) +#ifndef EH_FRAME_SECTION_NAME +#define EH_FRAME_SECTION_NAME ".eh_frame" +#endif +#endif + +/* On many systems, different EH table encodings are used under + difference circumstances. Some will require runtime relocations; + some will not. For those that do not require runtime relocations, + we would like to make the table read-only. However, since the + read-only tables may need to be combined with read-write tables + that do require runtime relocation, it is not safe to make the + tables read-only unless the linker will merge read-only and + read-write sections into a single read-write section. If your + linker does not have this ability, but your system is such that no + encoding used with non-PIC code will ever require a runtime + relocation, then you can define EH_TABLES_CAN_BE_READ_ONLY to 1 in + your target configuration file. */ +#ifndef EH_TABLES_CAN_BE_READ_ONLY +#ifdef HAVE_LD_RO_RW_SECTION_MIXING +#define EH_TABLES_CAN_BE_READ_ONLY 1 +#else +#define EH_TABLES_CAN_BE_READ_ONLY 0 +#endif +#endif + +/* Provide defaults for stuff that may not be defined when using + sjlj exceptions. */ +#ifndef EH_RETURN_DATA_REGNO +#define EH_RETURN_DATA_REGNO(N) INVALID_REGNUM +#endif + +/* Offset between the eh handler address and entry in eh tables. */ +#ifndef RETURN_ADDR_OFFSET +#define RETURN_ADDR_OFFSET 0 +#endif + +#ifndef MASK_RETURN_ADDR +#define MASK_RETURN_ADDR NULL_RTX +#endif + +/* Number of hardware registers that go into the DWARF-2 unwind info. + If not defined, equals FIRST_PSEUDO_REGISTER */ + +#ifndef DWARF_FRAME_REGISTERS +#define DWARF_FRAME_REGISTERS FIRST_PSEUDO_REGISTER +#endif + +/* Offsets recorded in opcodes are a multiple of this alignment factor. */ +#ifndef DWARF_CIE_DATA_ALIGNMENT +#ifdef STACK_GROWS_DOWNWARD +#define DWARF_CIE_DATA_ALIGNMENT (-((int) UNITS_PER_WORD)) +#else +#define DWARF_CIE_DATA_ALIGNMENT ((int) UNITS_PER_WORD) +#endif +#endif + +/* The DWARF 2 CFA column which tracks the return address. Normally this + is the column for PC, or the first column after all of the hard + registers. */ +#ifndef DWARF_FRAME_RETURN_COLUMN +#ifdef PC_REGNUM +#define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (PC_REGNUM) +#else +#define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGISTERS +#endif +#endif + +/* How to renumber registers for dbx and gdb. If not defined, assume + no renumbering is necessary. */ + +#ifndef DBX_REGISTER_NUMBER +#define DBX_REGISTER_NUMBER(REGNO) (REGNO) +#endif + +/* The mapping from gcc register number to DWARF 2 CFA column number. + By default, we just provide columns for all registers. */ +#ifndef DWARF_FRAME_REGNUM +#define DWARF_FRAME_REGNUM(REG) DBX_REGISTER_NUMBER (REG) +#endif + +/* The mapping from dwarf CFA reg number to internal dwarf reg numbers. */ +#ifndef DWARF_REG_TO_UNWIND_COLUMN +#define DWARF_REG_TO_UNWIND_COLUMN(REGNO) (REGNO) +#endif + +/* Map register numbers held in the call frame info that gcc has + collected using DWARF_FRAME_REGNUM to those that should be output in + .debug_frame and .eh_frame. */ +#ifndef DWARF2_FRAME_REG_OUT +#define DWARF2_FRAME_REG_OUT(REGNO, FOR_EH) (REGNO) +#endif + +/* The size of addresses as they appear in the Dwarf 2 data. + Some architectures use word addresses to refer to code locations, + but Dwarf 2 info always uses byte addresses. On such machines, + Dwarf 2 addresses need to be larger than the architecture's + pointers. */ +#ifndef DWARF2_ADDR_SIZE +#define DWARF2_ADDR_SIZE ((POINTER_SIZE + BITS_PER_UNIT - 1) / BITS_PER_UNIT) +#endif + +/* The size in bytes of a DWARF field indicating an offset or length + relative to a debug info section, specified to be 4 bytes in the + DWARF-2 specification. The SGI/MIPS ABI defines it to be the same + as PTR_SIZE. */ +#ifndef DWARF_OFFSET_SIZE +#define DWARF_OFFSET_SIZE 4 +#endif + +/* The size in bytes of a DWARF 4 type signature. */ +#ifndef DWARF_TYPE_SIGNATURE_SIZE +#define DWARF_TYPE_SIGNATURE_SIZE 8 +#endif + +/* Default sizes for base C types. If the sizes are different for + your target, you should override these values by defining the + appropriate symbols in your tm.h file. */ + +#ifndef BITS_PER_WORD +#define BITS_PER_WORD (BITS_PER_UNIT * UNITS_PER_WORD) +#endif + +#ifndef CHAR_TYPE_SIZE +#define CHAR_TYPE_SIZE BITS_PER_UNIT +#endif + +#ifndef BOOL_TYPE_SIZE +/* `bool' has size and alignment `1', on almost all platforms. */ +#define BOOL_TYPE_SIZE CHAR_TYPE_SIZE +#endif + +#ifndef SHORT_TYPE_SIZE +#define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2)) +#endif + +#ifndef INT_TYPE_SIZE +#define INT_TYPE_SIZE BITS_PER_WORD +#endif + +#ifndef LONG_TYPE_SIZE +#define LONG_TYPE_SIZE BITS_PER_WORD +#endif + +#ifndef LONG_LONG_TYPE_SIZE +#define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2) +#endif + +#ifndef WCHAR_TYPE_SIZE +#define WCHAR_TYPE_SIZE INT_TYPE_SIZE +#endif + +#ifndef FLOAT_TYPE_SIZE +#define FLOAT_TYPE_SIZE BITS_PER_WORD +#endif + +#ifndef DOUBLE_TYPE_SIZE +#define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2) +#endif + +#ifndef LONG_DOUBLE_TYPE_SIZE +#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2) +#endif + +#ifndef DECIMAL32_TYPE_SIZE +#define DECIMAL32_TYPE_SIZE 32 +#endif + +#ifndef DECIMAL64_TYPE_SIZE +#define DECIMAL64_TYPE_SIZE 64 +#endif + +#ifndef DECIMAL128_TYPE_SIZE +#define DECIMAL128_TYPE_SIZE 128 +#endif + +#ifndef SHORT_FRACT_TYPE_SIZE +#define SHORT_FRACT_TYPE_SIZE BITS_PER_UNIT +#endif + +#ifndef FRACT_TYPE_SIZE +#define FRACT_TYPE_SIZE (BITS_PER_UNIT * 2) +#endif + +#ifndef LONG_FRACT_TYPE_SIZE +#define LONG_FRACT_TYPE_SIZE (BITS_PER_UNIT * 4) +#endif + +#ifndef LONG_LONG_FRACT_TYPE_SIZE +#define LONG_LONG_FRACT_TYPE_SIZE (BITS_PER_UNIT * 8) +#endif + +#ifndef SHORT_ACCUM_TYPE_SIZE +#define SHORT_ACCUM_TYPE_SIZE (SHORT_FRACT_TYPE_SIZE * 2) +#endif + +#ifndef ACCUM_TYPE_SIZE +#define ACCUM_TYPE_SIZE (FRACT_TYPE_SIZE * 2) +#endif + +#ifndef LONG_ACCUM_TYPE_SIZE +#define LONG_ACCUM_TYPE_SIZE (LONG_FRACT_TYPE_SIZE * 2) +#endif + +#ifndef LONG_LONG_ACCUM_TYPE_SIZE +#define LONG_LONG_ACCUM_TYPE_SIZE (LONG_LONG_FRACT_TYPE_SIZE * 2) +#endif + +/* We let tm.h override the types used here, to handle trivial differences + such as the choice of unsigned int or long unsigned int for size_t. + When machines start needing nontrivial differences in the size type, + it would be best to do something here to figure out automatically + from other information what type to use. */ + +#ifndef SIZE_TYPE +#define SIZE_TYPE "long unsigned int" +#endif + +#ifndef SIZETYPE +#define SIZETYPE SIZE_TYPE +#endif + +#ifndef PID_TYPE +#define PID_TYPE "int" +#endif + +/* If GCC knows the exact uint_least16_t and uint_least32_t types from + , use them for char16_t and char32_t. Otherwise, use + these guesses; getting the wrong type of a given width will not + affect C++ name mangling because in C++ these are distinct types + not typedefs. */ + +#ifdef UINT_LEAST16_TYPE +#define CHAR16_TYPE UINT_LEAST16_TYPE +#else +#define CHAR16_TYPE "short unsigned int" +#endif + +#ifdef UINT_LEAST32_TYPE +#define CHAR32_TYPE UINT_LEAST32_TYPE +#else +#define CHAR32_TYPE "unsigned int" +#endif + +#ifndef WCHAR_TYPE +#define WCHAR_TYPE "int" +#endif + +/* WCHAR_TYPE gets overridden by -fshort-wchar. */ +#define MODIFIED_WCHAR_TYPE \ + (flag_short_wchar ? "short unsigned int" : WCHAR_TYPE) + +#ifndef PTRDIFF_TYPE +#define PTRDIFF_TYPE "long int" +#endif + +#ifndef WINT_TYPE +#define WINT_TYPE "unsigned int" +#endif + +#ifndef INTMAX_TYPE +#define INTMAX_TYPE ((INT_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \ + ? "int" \ + : ((LONG_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \ + ? "long int" \ + : "long long int")) +#endif + +#ifndef UINTMAX_TYPE +#define UINTMAX_TYPE ((INT_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \ + ? "unsigned int" \ + : ((LONG_TYPE_SIZE == LONG_LONG_TYPE_SIZE) \ + ? "long unsigned int" \ + : "long long unsigned int")) +#endif + + +/* There are no default definitions of these types. */ + +#ifndef SIG_ATOMIC_TYPE +#define SIG_ATOMIC_TYPE ((const char *) NULL) +#endif + +#ifndef INT8_TYPE +#define INT8_TYPE ((const char *) NULL) +#endif + +#ifndef INT16_TYPE +#define INT16_TYPE ((const char *) NULL) +#endif + +#ifndef INT32_TYPE +#define INT32_TYPE ((const char *) NULL) +#endif + +#ifndef INT64_TYPE +#define INT64_TYPE ((const char *) NULL) +#endif + +#ifndef UINT8_TYPE +#define UINT8_TYPE ((const char *) NULL) +#endif + +#ifndef UINT16_TYPE +#define UINT16_TYPE ((const char *) NULL) +#endif + +#ifndef UINT32_TYPE +#define UINT32_TYPE ((const char *) NULL) +#endif + +#ifndef UINT64_TYPE +#define UINT64_TYPE ((const char *) NULL) +#endif + +#ifndef INT_LEAST8_TYPE +#define INT_LEAST8_TYPE ((const char *) NULL) +#endif + +#ifndef INT_LEAST16_TYPE +#define INT_LEAST16_TYPE ((const char *) NULL) +#endif + +#ifndef INT_LEAST32_TYPE +#define INT_LEAST32_TYPE ((const char *) NULL) +#endif + +#ifndef INT_LEAST64_TYPE +#define INT_LEAST64_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_LEAST8_TYPE +#define UINT_LEAST8_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_LEAST16_TYPE +#define UINT_LEAST16_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_LEAST32_TYPE +#define UINT_LEAST32_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_LEAST64_TYPE +#define UINT_LEAST64_TYPE ((const char *) NULL) +#endif + +#ifndef INT_FAST8_TYPE +#define INT_FAST8_TYPE ((const char *) NULL) +#endif + +#ifndef INT_FAST16_TYPE +#define INT_FAST16_TYPE ((const char *) NULL) +#endif + +#ifndef INT_FAST32_TYPE +#define INT_FAST32_TYPE ((const char *) NULL) +#endif + +#ifndef INT_FAST64_TYPE +#define INT_FAST64_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_FAST8_TYPE +#define UINT_FAST8_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_FAST16_TYPE +#define UINT_FAST16_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_FAST32_TYPE +#define UINT_FAST32_TYPE ((const char *) NULL) +#endif + +#ifndef UINT_FAST64_TYPE +#define UINT_FAST64_TYPE ((const char *) NULL) +#endif + +#ifndef INTPTR_TYPE +#define INTPTR_TYPE ((const char *) NULL) +#endif + +#ifndef UINTPTR_TYPE +#define UINTPTR_TYPE ((const char *) NULL) +#endif + +/* Width in bits of a pointer. Mind the value of the macro `Pmode'. */ +#ifndef POINTER_SIZE +#define POINTER_SIZE BITS_PER_WORD +#endif +#ifndef POINTER_SIZE_UNITS +#define POINTER_SIZE_UNITS ((POINTER_SIZE + BITS_PER_UNIT - 1) / BITS_PER_UNIT) +#endif + + +#ifndef PIC_OFFSET_TABLE_REGNUM +#define PIC_OFFSET_TABLE_REGNUM INVALID_REGNUM +#endif + +#ifndef PIC_OFFSET_TABLE_REG_CALL_CLOBBERED +#define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED 0 +#endif + +#ifndef TARGET_DLLIMPORT_DECL_ATTRIBUTES +#define TARGET_DLLIMPORT_DECL_ATTRIBUTES 0 +#endif + +#ifndef TARGET_DECLSPEC +#if TARGET_DLLIMPORT_DECL_ATTRIBUTES +/* If the target supports the "dllimport" attribute, users are + probably used to the "__declspec" syntax. */ +#define TARGET_DECLSPEC 1 +#else +#define TARGET_DECLSPEC 0 +#endif +#endif + +/* By default, the preprocessor should be invoked the same way in C++ + as in C. */ +#ifndef CPLUSPLUS_CPP_SPEC +#ifdef CPP_SPEC +#define CPLUSPLUS_CPP_SPEC CPP_SPEC +#endif +#endif + +#ifndef ACCUMULATE_OUTGOING_ARGS +#define ACCUMULATE_OUTGOING_ARGS 0 +#endif + +/* By default, use the GNU runtime for Objective C. */ +#ifndef NEXT_OBJC_RUNTIME +#define NEXT_OBJC_RUNTIME 0 +#endif + +/* Supply a default definition for PUSH_ARGS. */ +#ifndef PUSH_ARGS +#ifdef PUSH_ROUNDING +#define PUSH_ARGS !ACCUMULATE_OUTGOING_ARGS +#else +#define PUSH_ARGS 0 +#endif +#endif + +/* Decide whether a function's arguments should be processed + from first to last or from last to first. + + They should if the stack and args grow in opposite directions, but + only if we have push insns. */ + +#ifdef PUSH_ROUNDING + +#ifndef PUSH_ARGS_REVERSED +#if defined (STACK_GROWS_DOWNWARD) != defined (ARGS_GROW_DOWNWARD) +#define PUSH_ARGS_REVERSED PUSH_ARGS +#endif +#endif + +#endif + +#ifndef PUSH_ARGS_REVERSED +#define PUSH_ARGS_REVERSED 0 +#endif + +/* Default value for the alignment (in bits) a C conformant malloc has to + provide. This default is intended to be safe and always correct. */ +#ifndef MALLOC_ABI_ALIGNMENT +#define MALLOC_ABI_ALIGNMENT BITS_PER_WORD +#endif + +/* If PREFERRED_STACK_BOUNDARY is not defined, set it to STACK_BOUNDARY. + STACK_BOUNDARY is required. */ +#ifndef PREFERRED_STACK_BOUNDARY +#define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY +#endif + +/* Set INCOMING_STACK_BOUNDARY to PREFERRED_STACK_BOUNDARY if it is not + defined. */ +#ifndef INCOMING_STACK_BOUNDARY +#define INCOMING_STACK_BOUNDARY PREFERRED_STACK_BOUNDARY +#endif + +#ifndef TARGET_DEFAULT_PACK_STRUCT +#define TARGET_DEFAULT_PACK_STRUCT 0 +#endif + +/* By default, the vtable entries are void pointers, the so the alignment + is the same as pointer alignment. The value of this macro specifies + the alignment of the vtable entry in bits. It should be defined only + when special alignment is necessary. */ +#ifndef TARGET_VTABLE_ENTRY_ALIGN +#define TARGET_VTABLE_ENTRY_ALIGN POINTER_SIZE +#endif + +/* There are a few non-descriptor entries in the vtable at offsets below + zero. If these entries must be padded (say, to preserve the alignment + specified by TARGET_VTABLE_ENTRY_ALIGN), set this to the number of + words in each data entry. */ +#ifndef TARGET_VTABLE_DATA_ENTRY_DISTANCE +#define TARGET_VTABLE_DATA_ENTRY_DISTANCE 1 +#endif + +/* Decide whether it is safe to use a local alias for a virtual function + when constructing thunks. */ +#ifndef TARGET_USE_LOCAL_THUNK_ALIAS_P +#ifdef ASM_OUTPUT_DEF +#define TARGET_USE_LOCAL_THUNK_ALIAS_P(DECL) 1 +#else +#define TARGET_USE_LOCAL_THUNK_ALIAS_P(DECL) 0 +#endif +#endif + +/* Select a format to encode pointers in exception handling data. We + prefer those that result in fewer dynamic relocations. Assume no + special support here and encode direct references. */ +#ifndef ASM_PREFERRED_EH_DATA_FORMAT +#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) DW_EH_PE_absptr +#endif + +/* By default, the C++ compiler will use the lowest bit of the pointer + to function to indicate a pointer-to-member-function points to a + virtual member function. However, if FUNCTION_BOUNDARY indicates + function addresses aren't always even, the lowest bit of the delta + field will be used. */ +#ifndef TARGET_PTRMEMFUNC_VBIT_LOCATION +#define TARGET_PTRMEMFUNC_VBIT_LOCATION \ + (FUNCTION_BOUNDARY >= 2 * BITS_PER_UNIT \ + ? ptrmemfunc_vbit_in_pfn : ptrmemfunc_vbit_in_delta) +#endif + +#ifndef DEFAULT_GDB_EXTENSIONS +#define DEFAULT_GDB_EXTENSIONS 1 +#endif + +#ifndef SDB_DEBUGGING_INFO +#define SDB_DEBUGGING_INFO 0 +#endif + +/* If more than one debugging type is supported, you must define + PREFERRED_DEBUGGING_TYPE to choose the default. */ + +#if 1 < (defined (DBX_DEBUGGING_INFO) + (SDB_DEBUGGING_INFO) \ + + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO) \ + + defined (VMS_DEBUGGING_INFO)) +#ifndef PREFERRED_DEBUGGING_TYPE +#error You must define PREFERRED_DEBUGGING_TYPE +#endif /* no PREFERRED_DEBUGGING_TYPE */ + +/* If only one debugging format is supported, define PREFERRED_DEBUGGING_TYPE + here so other code needn't care. */ +#elif defined DBX_DEBUGGING_INFO +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG + +#elif SDB_DEBUGGING_INFO +#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG + +#elif defined DWARF2_DEBUGGING_INFO || defined DWARF2_LINENO_DEBUGGING_INFO +#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG + +#elif defined VMS_DEBUGGING_INFO +#define PREFERRED_DEBUGGING_TYPE VMS_AND_DWARF2_DEBUG + +#elif defined XCOFF_DEBUGGING_INFO +#define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG + +#else +/* No debugging format is supported by this target. */ +#define PREFERRED_DEBUGGING_TYPE NO_DEBUG +#endif + +#ifndef FLOAT_LIB_COMPARE_RETURNS_BOOL +#define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) false +#endif + +/* True if the targets integer-comparison functions return { 0, 1, 2 + } to indicate { <, ==, > }. False if { -1, 0, 1 } is used + instead. The libgcc routines are biased. */ +#ifndef TARGET_LIB_INT_CMP_BIASED +#define TARGET_LIB_INT_CMP_BIASED (true) +#endif + +/* If FLOAT_WORDS_BIG_ENDIAN is not defined in the header files, + then the word-endianness is the same as for integers. */ +#ifndef FLOAT_WORDS_BIG_ENDIAN +#define FLOAT_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN +#endif + +#ifndef REG_WORDS_BIG_ENDIAN +#define REG_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN +#endif + + +#ifndef TARGET_DEC_EVAL_METHOD +#define TARGET_DEC_EVAL_METHOD 2 +#endif + +#ifndef HAS_LONG_COND_BRANCH +#define HAS_LONG_COND_BRANCH 0 +#endif + +#ifndef HAS_LONG_UNCOND_BRANCH +#define HAS_LONG_UNCOND_BRANCH 0 +#endif + +/* Determine whether __cxa_atexit, rather than atexit, is used to + register C++ destructors for local statics and global objects. */ +#ifndef DEFAULT_USE_CXA_ATEXIT +#define DEFAULT_USE_CXA_ATEXIT 0 +#endif + +#if GCC_VERSION >= 3000 && defined IN_GCC +/* These old constraint macros shouldn't appear anywhere in a + configuration using MD constraint definitions. */ +#endif + +/* Determin whether the target runtime library is Bionic */ +#ifndef TARGET_HAS_BIONIC +#define TARGET_HAS_BIONIC 0 +#endif + +/* Indicate that CLZ and CTZ are undefined at zero. */ +#ifndef CLZ_DEFINED_VALUE_AT_ZERO +#define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) 0 +#endif +#ifndef CTZ_DEFINED_VALUE_AT_ZERO +#define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) 0 +#endif + +/* Provide a default value for STORE_FLAG_VALUE. */ +#ifndef STORE_FLAG_VALUE +#define STORE_FLAG_VALUE 1 +#endif + +/* This macro is used to determine what the largest unit size that + move_by_pieces can use is. */ + +/* MOVE_MAX_PIECES is the number of bytes at a time which we can + move efficiently, as opposed to MOVE_MAX which is the maximum + number of bytes we can move with a single instruction. */ + +#ifndef MOVE_MAX_PIECES +#define MOVE_MAX_PIECES MOVE_MAX +#endif + +/* STORE_MAX_PIECES is the number of bytes at a time that we can + store efficiently. Due to internal GCC limitations, this is + MOVE_MAX_PIECES limited by the number of bytes GCC can represent + for an immediate constant. */ + +#ifndef STORE_MAX_PIECES +#define STORE_MAX_PIECES MIN (MOVE_MAX_PIECES, 2 * sizeof (HOST_WIDE_INT)) +#endif + +/* Likewise for block comparisons. */ +#ifndef COMPARE_MAX_PIECES +#define COMPARE_MAX_PIECES MOVE_MAX_PIECES +#endif + +#ifndef MAX_MOVE_MAX +#define MAX_MOVE_MAX MOVE_MAX +#endif + +#ifndef MIN_UNITS_PER_WORD +#define MIN_UNITS_PER_WORD UNITS_PER_WORD +#endif + +#ifndef MAX_BITS_PER_WORD +#define MAX_BITS_PER_WORD BITS_PER_WORD +#endif + +#ifndef STACK_POINTER_OFFSET +#define STACK_POINTER_OFFSET 0 +#endif + +#ifndef LOCAL_REGNO +#define LOCAL_REGNO(REGNO) 0 +#endif + +#ifndef HONOR_REG_ALLOC_ORDER +#define HONOR_REG_ALLOC_ORDER 0 +#endif + +/* EXIT_IGNORE_STACK should be nonzero if, when returning from a function, + the stack pointer does not matter. The value is tested only in + functions that have frame pointers. */ +#ifndef EXIT_IGNORE_STACK +#define EXIT_IGNORE_STACK 0 +#endif + +/* Assume that case vectors are not pc-relative. */ +#ifndef CASE_VECTOR_PC_RELATIVE +#define CASE_VECTOR_PC_RELATIVE 0 +#endif + +/* Force minimum alignment to be able to use the least significant bits + for distinguishing descriptor addresses from code addresses. */ +#define FUNCTION_ALIGNMENT(ALIGN) \ + (lang_hooks.custom_function_descriptors \ + && targetm.calls.custom_function_descriptors > 0 \ + ? MAX ((ALIGN), \ + 2 * targetm.calls.custom_function_descriptors * BITS_PER_UNIT)\ + : (ALIGN)) + +/* Assume that trampolines need function alignment. */ +#ifndef TRAMPOLINE_ALIGNMENT +#define TRAMPOLINE_ALIGNMENT FUNCTION_ALIGNMENT (FUNCTION_BOUNDARY) +#endif + +/* Register mappings for target machines without register windows. */ +#ifndef INCOMING_REGNO +#define INCOMING_REGNO(N) (N) +#endif + +#ifndef OUTGOING_REGNO +#define OUTGOING_REGNO(N) (N) +#endif + +#ifndef SHIFT_COUNT_TRUNCATED +#define SHIFT_COUNT_TRUNCATED 0 +#endif + +#ifndef LEGITIMATE_PIC_OPERAND_P +#define LEGITIMATE_PIC_OPERAND_P(X) 1 +#endif + +#ifndef TARGET_MEM_CONSTRAINT +#define TARGET_MEM_CONSTRAINT 'm' +#endif + +#ifndef REVERSIBLE_CC_MODE +#define REVERSIBLE_CC_MODE(MODE) 0 +#endif + +/* Biggest alignment supported by the object file format of this machine. */ +#ifndef MAX_OFILE_ALIGNMENT +#define MAX_OFILE_ALIGNMENT BIGGEST_ALIGNMENT +#endif + +#ifndef FRAME_GROWS_DOWNWARD +#define FRAME_GROWS_DOWNWARD 0 +#endif + +#ifndef RETURN_ADDR_IN_PREVIOUS_FRAME +#define RETURN_ADDR_IN_PREVIOUS_FRAME 0 +#endif + +/* On most machines, the CFA coincides with the first incoming parm. */ +#ifndef ARG_POINTER_CFA_OFFSET +#define ARG_POINTER_CFA_OFFSET(FNDECL) \ + (FIRST_PARM_OFFSET (FNDECL) + crtl->args.pretend_args_size) +#endif + +/* On most machines, we use the CFA as DW_AT_frame_base. */ +#ifndef CFA_FRAME_BASE_OFFSET +#define CFA_FRAME_BASE_OFFSET(FNDECL) 0 +#endif + +/* The offset from the incoming value of %sp to the top of the stack frame + for the current function. */ +#ifndef INCOMING_FRAME_SP_OFFSET +#define INCOMING_FRAME_SP_OFFSET 0 +#endif + +#ifndef HARD_REGNO_NREGS_HAS_PADDING +#define HARD_REGNO_NREGS_HAS_PADDING(REGNO, MODE) 0 +#define HARD_REGNO_NREGS_WITH_PADDING(REGNO, MODE) -1 +#endif + +#ifndef OUTGOING_REG_PARM_STACK_SPACE +#define OUTGOING_REG_PARM_STACK_SPACE(FNTYPE) 0 +#endif + +/* MAX_STACK_ALIGNMENT is the maximum stack alignment guaranteed by + the backend. MAX_SUPPORTED_STACK_ALIGNMENT is the maximum best + effort stack alignment supported by the backend. If the backend + supports stack alignment, MAX_SUPPORTED_STACK_ALIGNMENT and + MAX_STACK_ALIGNMENT are the same. Otherwise, the incoming stack + boundary will limit the maximum guaranteed stack alignment. */ +#ifdef MAX_STACK_ALIGNMENT +#define MAX_SUPPORTED_STACK_ALIGNMENT MAX_STACK_ALIGNMENT +#else +#define MAX_STACK_ALIGNMENT STACK_BOUNDARY +#define MAX_SUPPORTED_STACK_ALIGNMENT PREFERRED_STACK_BOUNDARY +#endif + +#define SUPPORTS_STACK_ALIGNMENT (MAX_STACK_ALIGNMENT > STACK_BOUNDARY) + +#ifndef LOCAL_ALIGNMENT +#define LOCAL_ALIGNMENT(TYPE, ALIGNMENT) ALIGNMENT +#endif + +#ifndef STACK_SLOT_ALIGNMENT +#define STACK_SLOT_ALIGNMENT(TYPE,MODE,ALIGN) \ + ((TYPE) ? LOCAL_ALIGNMENT ((TYPE), (ALIGN)) : (ALIGN)) +#endif + +#ifndef LOCAL_DECL_ALIGNMENT +#define LOCAL_DECL_ALIGNMENT(DECL) \ + LOCAL_ALIGNMENT (TREE_TYPE (DECL), DECL_ALIGN (DECL)) +#endif + +#ifndef MINIMUM_ALIGNMENT +#define MINIMUM_ALIGNMENT(EXP,MODE,ALIGN) (ALIGN) +#endif + +/* Alignment value for attribute ((aligned)). */ +#ifndef ATTRIBUTE_ALIGNED_VALUE +#define ATTRIBUTE_ALIGNED_VALUE BIGGEST_ALIGNMENT +#endif + +#ifndef SLOW_UNALIGNED_ACCESS +#define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) STRICT_ALIGNMENT +#endif + +/* For most ports anything that evaluates to a constant symbolic + or integer value is acceptable as a constant address. */ +#ifndef CONSTANT_ADDRESS_P +#define CONSTANT_ADDRESS_P(X) (CONSTANT_P (X) && GET_CODE (X) != CONST_DOUBLE) +#endif + +#ifndef MAX_FIXED_MODE_SIZE +#define MAX_FIXED_MODE_SIZE GET_MODE_BITSIZE (DImode) +#endif + +/* Nonzero if structures and unions should be returned in memory. + + This should only be defined if compatibility with another compiler or + with an ABI is needed, because it results in slower code. */ + +#ifndef DEFAULT_PCC_STRUCT_RETURN +#define DEFAULT_PCC_STRUCT_RETURN 1 +#endif + +#ifndef PCC_BITFIELD_TYPE_MATTERS +#define PCC_BITFIELD_TYPE_MATTERS false +#endif + +#ifndef INSN_SETS_ARE_DELAYED +#define INSN_SETS_ARE_DELAYED(INSN) false +#endif + +#ifndef INSN_REFERENCES_ARE_DELAYED +#define INSN_REFERENCES_ARE_DELAYED(INSN) false +#endif + +#ifndef NO_FUNCTION_CSE +#define NO_FUNCTION_CSE false +#endif + +#ifndef HARD_REGNO_RENAME_OK +#define HARD_REGNO_RENAME_OK(FROM, TO) true +#endif + +#ifndef EPILOGUE_USES +#define EPILOGUE_USES(REG) false +#endif + +#ifndef ARGS_GROW_DOWNWARD +#define ARGS_GROW_DOWNWARD 0 +#endif + +#ifndef STACK_GROWS_DOWNWARD +#define STACK_GROWS_DOWNWARD 0 +#endif + +#ifndef STACK_PUSH_CODE +#if STACK_GROWS_DOWNWARD +#define STACK_PUSH_CODE PRE_DEC +#else +#define STACK_PUSH_CODE PRE_INC +#endif +#endif + +/* Default value for flag_pie when flag_pie is initialized to -1: + --enable-default-pie: Default flag_pie to -fPIE. + --disable-default-pie: Default flag_pie to 0. + */ +#ifdef ENABLE_DEFAULT_PIE +# ifndef DEFAULT_FLAG_PIE +# define DEFAULT_FLAG_PIE 2 +# endif +#else +# define DEFAULT_FLAG_PIE 0 +#endif + +#ifndef SWITCHABLE_TARGET +#define SWITCHABLE_TARGET 0 +#endif + +/* If the target supports integers that are wider than two + HOST_WIDE_INTs on the host compiler, then the target should define + TARGET_SUPPORTS_WIDE_INT and make the appropriate fixups. + Otherwise the compiler really is not robust. */ +#ifndef TARGET_SUPPORTS_WIDE_INT +#define TARGET_SUPPORTS_WIDE_INT 0 +#endif + +#ifndef SHORT_IMMEDIATES_SIGN_EXTEND +#define SHORT_IMMEDIATES_SIGN_EXTEND 0 +#endif + +#ifndef WORD_REGISTER_OPERATIONS +#define WORD_REGISTER_OPERATIONS 0 +#endif + +#ifndef LOAD_EXTEND_OP +#define LOAD_EXTEND_OP(M) UNKNOWN +#endif + +#ifndef CONSTANT_ALIGNMENT +#define CONSTANT_ALIGNMENT(EXP, ALIGN) ALIGN +#endif + +#ifndef INITIAL_FRAME_ADDRESS_RTX +#define INITIAL_FRAME_ADDRESS_RTX NULL +#endif + +#ifndef SETUP_FRAME_ADDRESSES +#define SETUP_FRAME_ADDRESSES() do { } while (0) +#endif + +#ifndef DYNAMIC_CHAIN_ADDRESS +#define DYNAMIC_CHAIN_ADDRESS(x) (x) +#endif + +#ifndef FRAME_ADDR_RTX +#define FRAME_ADDR_RTX(x) (x) +#endif + +#ifndef REVERSE_CONDITION +#define REVERSE_CONDITION(code, mode) reverse_condition (code) +#endif + +#ifndef TARGET_PECOFF +#define TARGET_PECOFF 0 +#endif + +#ifndef EH_RETURN_HANDLER_RTX +#define EH_RETURN_HANDLER_RTX NULL +#endif + +#ifdef GCC_INSN_FLAGS_H +/* Dependent default target macro definitions + + This section of defaults.h defines target macros that depend on generated + headers. This is a bit awkward: We want to put all default definitions + for target macros in defaults.h, but some of the defaults depend on the + HAVE_* flags defines of insn-flags.h. But insn-flags.h is not always + included by files that do include defaults.h. + + Fortunately, the default macro definitions that depend on the HAVE_* + macros are also the ones that will only be used inside GCC itself, i.e. + not in the gen* programs or in target objects like libgcc. + + Obviously, it would be best to keep this section of defaults.h as small + as possible, by converting the macros defined below to target hooks or + functions. +*/ + +/* The default branch cost is 1. */ +#ifndef BRANCH_COST +#define BRANCH_COST(speed_p, predictable_p) 1 +#endif + +/* If a memory-to-memory move would take MOVE_RATIO or more simple + move-instruction sequences, we will do a movmem or libcall instead. */ + +#ifndef MOVE_RATIO +#if defined (HAVE_movmemqi) || defined (HAVE_movmemhi) || defined (HAVE_movmemsi) || defined (HAVE_movmemdi) || defined (HAVE_movmemti) +#define MOVE_RATIO(speed) 2 +#else +/* If we are optimizing for space (-Os), cut down the default move ratio. */ +#define MOVE_RATIO(speed) ((speed) ? 15 : 3) +#endif +#endif + +/* If a clear memory operation would take CLEAR_RATIO or more simple + move-instruction sequences, we will do a setmem or libcall instead. */ + +#ifndef CLEAR_RATIO +#if defined (HAVE_setmemqi) || defined (HAVE_setmemhi) || defined (HAVE_setmemsi) || defined (HAVE_setmemdi) || defined (HAVE_setmemti) +#define CLEAR_RATIO(speed) 2 +#else +/* If we are optimizing for space, cut down the default clear ratio. */ +#define CLEAR_RATIO(speed) ((speed) ? 15 :3) +#endif +#endif + +/* If a memory set (to value other than zero) operation would take + SET_RATIO or more simple move-instruction sequences, we will do a movmem + or libcall instead. */ +#ifndef SET_RATIO +#define SET_RATIO(speed) MOVE_RATIO (speed) +#endif + +/* Supply a default definition for FUNCTION_ARG_PADDING: + usually pad upward, but pad short args downward on + big-endian machines. */ + +#define DEFAULT_FUNCTION_ARG_PADDING(MODE, TYPE) \ + (! BYTES_BIG_ENDIAN \ + ? upward \ + : (((MODE) == BLKmode \ + ? ((TYPE) && TREE_CODE (TYPE_SIZE (TYPE)) == INTEGER_CST \ + && int_size_in_bytes (TYPE) < (PARM_BOUNDARY / BITS_PER_UNIT)) \ + : GET_MODE_BITSIZE (MODE) < PARM_BOUNDARY) \ + ? downward : upward)) + +#ifndef FUNCTION_ARG_PADDING +#define FUNCTION_ARG_PADDING(MODE, TYPE) \ + DEFAULT_FUNCTION_ARG_PADDING ((MODE), (TYPE)) +#endif + +/* Supply a default definition of STACK_SAVEAREA_MODE for emit_stack_save. + Normally move_insn, so Pmode stack pointer. */ + +#ifndef STACK_SAVEAREA_MODE +#define STACK_SAVEAREA_MODE(LEVEL) Pmode +#endif + +/* Supply a default definition of STACK_SIZE_MODE for + allocate_dynamic_stack_space. Normally PLUS/MINUS, so word_mode. */ + +#ifndef STACK_SIZE_MODE +#define STACK_SIZE_MODE word_mode +#endif + +/* Default value for flag_stack_protect when flag_stack_protect is initialized to -1: + --enable-default-ssp: Default flag_stack_protect to -fstack-protector-strong. + --disable-default-ssp: Default flag_stack_protect to 0. + */ +#ifdef ENABLE_DEFAULT_SSP +# ifndef DEFAULT_FLAG_SSP +# define DEFAULT_FLAG_SSP 3 +# endif +#else +# define DEFAULT_FLAG_SSP 0 +#endif + +/* Provide default values for the macros controlling stack checking. */ + +/* The default is neither full builtin stack checking... */ +#ifndef STACK_CHECK_BUILTIN +#define STACK_CHECK_BUILTIN 0 +#endif + +/* ...nor static builtin stack checking. */ +#ifndef STACK_CHECK_STATIC_BUILTIN +#define STACK_CHECK_STATIC_BUILTIN 0 +#endif + +/* The default interval is one page (4096 bytes). */ +#ifndef STACK_CHECK_PROBE_INTERVAL_EXP +#define STACK_CHECK_PROBE_INTERVAL_EXP 12 +#endif + +/* The default is not to move the stack pointer. */ +#ifndef STACK_CHECK_MOVING_SP +#define STACK_CHECK_MOVING_SP 0 +#endif + +/* This is a kludge to try to capture the discrepancy between the old + mechanism (generic stack checking) and the new mechanism (static + builtin stack checking). STACK_CHECK_PROTECT needs to be bumped + for the latter because part of the protection area is effectively + included in STACK_CHECK_MAX_FRAME_SIZE for the former. */ +#ifdef STACK_CHECK_PROTECT +#define STACK_OLD_CHECK_PROTECT STACK_CHECK_PROTECT +#else +#define STACK_OLD_CHECK_PROTECT \ + (!global_options.x_flag_exceptions \ + ? 75 * UNITS_PER_WORD \ + : targetm_common.except_unwind_info (&global_options) == UI_SJLJ \ + ? 4 * 1024 \ + : 8 * 1024) +#endif + +/* Minimum amount of stack required to recover from an anticipated stack + overflow detection. The default value conveys an estimate of the amount + of stack required to propagate an exception. */ +#ifndef STACK_CHECK_PROTECT +#define STACK_CHECK_PROTECT \ + (!global_options.x_flag_exceptions \ + ? 4 * 1024 \ + : targetm_common.except_unwind_info (&global_options) == UI_SJLJ \ + ? 8 * 1024 \ + : 12 * 1024) +#endif + +/* Make the maximum frame size be the largest we can and still only need + one probe per function. */ +#ifndef STACK_CHECK_MAX_FRAME_SIZE +#define STACK_CHECK_MAX_FRAME_SIZE \ + ((1 << STACK_CHECK_PROBE_INTERVAL_EXP) - UNITS_PER_WORD) +#endif + +/* This is arbitrary, but should be large enough everywhere. */ +#ifndef STACK_CHECK_FIXED_FRAME_SIZE +#define STACK_CHECK_FIXED_FRAME_SIZE (4 * UNITS_PER_WORD) +#endif + +/* Provide a reasonable default for the maximum size of an object to + allocate in the fixed frame. We may need to be able to make this + controllable by the user at some point. */ +#ifndef STACK_CHECK_MAX_VAR_SIZE +#define STACK_CHECK_MAX_VAR_SIZE (STACK_CHECK_MAX_FRAME_SIZE / 100) +#endif + +/* By default, the C++ compiler will use function addresses in the + vtable entries. Setting this nonzero tells the compiler to use + function descriptors instead. The value of this macro says how + many words wide the descriptor is (normally 2). It is assumed + that the address of a function descriptor may be treated as a + pointer to a function. */ +#ifndef TARGET_VTABLE_USES_DESCRIPTORS +#define TARGET_VTABLE_USES_DESCRIPTORS 0 +#endif + +#endif /* GCC_INSN_FLAGS_H */ + +#ifndef DWARF_GNAT_ENCODINGS_DEFAULT +#define DWARF_GNAT_ENCODINGS_DEFAULT DWARF_GNAT_ENCODINGS_GDB +#endif + +#endif /* ! GCC_DEFAULTS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/df.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/df.h new file mode 100644 index 0000000..681ff32 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/df.h @@ -0,0 +1,1246 @@ +/* Form lists of pseudo register references for autoinc optimization + for GNU compiler. This is part of flow optimization. + Copyright (C) 1999-2017 Free Software Foundation, Inc. + Originally contributed by Michael P. Hayes + (m.hayes@elec.canterbury.ac.nz, mhayes@redhat.com) + Major rewrite contributed by Danny Berlin (dberlin@dberlin.org) + and Kenneth Zadeck (zadeck@naturalbridge.com). + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_DF_H +#define GCC_DF_H + +#include "regset.h" +#include "alloc-pool.h" +#include "timevar.h" + +struct dataflow; +struct df_d; +struct df_problem; +struct df_link; +struct df_insn_info; +union df_ref_d; + +/* Data flow problems. All problems must have a unique id here. */ + +/* Scanning is not really a dataflow problem, but it is useful to have + the basic block functions in the vector so that things get done in + a uniform manner. The last four problems can be added or deleted + at any time are always defined (though LIVE is always there at -O2 + or higher); the others are always there. */ +enum df_problem_id + { + DF_SCAN, + DF_LR, /* Live Registers backward. */ + DF_LIVE, /* Live Registers & Uninitialized Registers */ + DF_RD, /* Reaching Defs. */ + DF_CHAIN, /* Def-Use and/or Use-Def Chains. */ + DF_WORD_LR, /* Subreg tracking lr. */ + DF_NOTE, /* REG_DEAD and REG_UNUSED notes. */ + DF_MD, /* Multiple Definitions. */ + DF_MIR, /* Must-initialized Registers. */ + + DF_LAST_PROBLEM_PLUS1 + }; + +/* Dataflow direction. */ +enum df_flow_dir + { + DF_NONE, + DF_FORWARD, + DF_BACKWARD + }; + +/* Descriminator for the various df_ref types. */ +enum df_ref_class {DF_REF_BASE, DF_REF_ARTIFICIAL, DF_REF_REGULAR}; + +/* The first of these us a set of a registers. The remaining three + are all uses of a register (the mem_load and mem_store relate to + how the register as an addressing operand). */ +enum df_ref_type {DF_REF_REG_DEF, DF_REF_REG_USE, + DF_REF_REG_MEM_LOAD, DF_REF_REG_MEM_STORE}; + +enum df_ref_flags + { + /* This flag is set if this ref occurs inside of a conditional + execution instruction. */ + DF_REF_CONDITIONAL = 1 << 0, + + /* If this flag is set for an artificial use or def, that ref + logically happens at the top of the block. If it is not set + for an artificial use or def, that ref logically happens at the + bottom of the block. This is never set for regular refs. */ + DF_REF_AT_TOP = 1 << 1, + + /* This flag is set if the use is inside a REG_EQUAL or REG_EQUIV + note. */ + DF_REF_IN_NOTE = 1 << 2, + + /* This bit is true if this ref can make regs_ever_live true for + this regno. */ + DF_HARD_REG_LIVE = 1 << 3, + + + /* This flag is set if this ref is a partial use or def of the + associated register. */ + DF_REF_PARTIAL = 1 << 4, + + /* Read-modify-write refs generate both a use and a def and + these are marked with this flag to show that they are not + independent. */ + DF_REF_READ_WRITE = 1 << 5, + + /* This flag is set if this ref, generally a def, may clobber the + referenced register. This is generally only set for hard + registers that cross a call site. With better information + about calls, some of these could be changed in the future to + DF_REF_MUST_CLOBBER. */ + DF_REF_MAY_CLOBBER = 1 << 6, + + /* This flag is set if this ref, generally a def, is a real + clobber. This is not currently set for registers live across a + call because that clobbering may or may not happen. + + Most of the uses of this are with sets that have a + GET_CODE(..)==CLOBBER. Note that this is set even if the + clobber is to a subreg. So in order to tell if the clobber + wipes out the entire register, it is necessary to also check + the DF_REF_PARTIAL flag. */ + DF_REF_MUST_CLOBBER = 1 << 7, + + + /* If the ref has one of the following two flags set, then the + struct df_ref can be cast to struct df_ref_extract to access + the width and offset fields. */ + + /* This flag is set if the ref contains a SIGN_EXTRACT. */ + DF_REF_SIGN_EXTRACT = 1 << 8, + + /* This flag is set if the ref contains a ZERO_EXTRACT. */ + DF_REF_ZERO_EXTRACT = 1 << 9, + + /* This flag is set if the ref contains a STRICT_LOW_PART. */ + DF_REF_STRICT_LOW_PART = 1 << 10, + + /* This flag is set if the ref contains a SUBREG. */ + DF_REF_SUBREG = 1 << 11, + + + /* This bit is true if this ref is part of a multiword hardreg. */ + DF_REF_MW_HARDREG = 1 << 12, + + /* This flag is set if this ref is a usage of the stack pointer by + a function call. */ + DF_REF_CALL_STACK_USAGE = 1 << 13, + + /* This flag is used for verification of existing refs. */ + DF_REF_REG_MARKER = 1 << 14, + + /* This flag is set if this ref is inside a pre/post modify. */ + DF_REF_PRE_POST_MODIFY = 1 << 15 + + }; + +/* The possible ordering of refs within the df_ref_info. */ +enum df_ref_order + { + /* There is not table. */ + DF_REF_ORDER_NO_TABLE, + + /* There is a table of refs but it is not (or no longer) organized + by one of the following methods. */ + DF_REF_ORDER_UNORDERED, + DF_REF_ORDER_UNORDERED_WITH_NOTES, + + /* Organize the table by reg order, all of the refs with regno 0 + followed by all of the refs with regno 1 ... . Within all of + the regs for a particular regno, the refs are unordered. */ + DF_REF_ORDER_BY_REG, + + /* For uses, the refs within eq notes may be added for + DF_REF_ORDER_BY_REG. */ + DF_REF_ORDER_BY_REG_WITH_NOTES, + + /* Organize the refs in insn order. The insns are ordered within a + block, and the blocks are ordered by FOR_ALL_BB_FN. */ + DF_REF_ORDER_BY_INSN, + + /* For uses, the refs within eq notes may be added for + DF_REF_ORDER_BY_INSN. */ + DF_REF_ORDER_BY_INSN_WITH_NOTES + }; + +/* Function prototypes added to df_problem instance. */ + +/* Allocate the problem specific data. */ +typedef void (*df_alloc_function) (bitmap); + +/* This function is called if the problem has global data that needs + to be cleared when ever the set of blocks changes. The bitmap + contains the set of blocks that may require special attention. + This call is only made if some of the blocks are going to change. + If everything is to be deleted, the wholesale deletion mechanisms + apply. */ +typedef void (*df_reset_function) (bitmap); + +/* Free the basic block info. Called from the block reordering code + to get rid of the blocks that have been squished down. */ +typedef void (*df_free_bb_function) (basic_block, void *); + +/* Local compute function. */ +typedef void (*df_local_compute_function) (bitmap); + +/* Init the solution specific data. */ +typedef void (*df_init_function) (bitmap); + +/* Iterative dataflow function. */ +typedef void (*df_dataflow_function) (struct dataflow *, bitmap, int *, int); + +/* Confluence operator for blocks with 0 out (or in) edges. */ +typedef void (*df_confluence_function_0) (basic_block); + +/* Confluence operator for blocks with 1 or more out (or in) edges. + Return true if BB input data has changed. */ +typedef bool (*df_confluence_function_n) (edge); + +/* Transfer function for blocks. + Return true if BB output data has changed. */ +typedef bool (*df_transfer_function) (int); + +/* Function to massage the information after the problem solving. */ +typedef void (*df_finalizer_function) (bitmap); + +/* Function to free all of the problem specific datastructures. */ +typedef void (*df_free_function) (void); + +/* Function to remove this problem from the stack of dataflow problems + without effecting the other problems in the stack except for those + that depend on this problem. */ +typedef void (*df_remove_problem_function) (void); + +/* Function to dump basic block independent results to FILE. */ +typedef void (*df_dump_problem_function) (FILE *); + +/* Function to dump top or bottom of basic block results to FILE. */ +typedef void (*df_dump_bb_problem_function) (basic_block, FILE *); + +/* Function to dump before or after an insn to FILE. */ +typedef void (*df_dump_insn_problem_function) (const rtx_insn *, FILE *); + +/* Function to dump top or bottom of basic block results to FILE. */ +typedef void (*df_verify_solution_start) (void); + +/* Function to dump top or bottom of basic block results to FILE. */ +typedef void (*df_verify_solution_end) (void); + +/* The static description of a dataflow problem to solve. See above + typedefs for doc for the function fields. */ + +struct df_problem { + /* The unique id of the problem. This is used it index into + df->defined_problems to make accessing the problem data easy. */ + enum df_problem_id id; + enum df_flow_dir dir; /* Dataflow direction. */ + df_alloc_function alloc_fun; + df_reset_function reset_fun; + df_free_bb_function free_bb_fun; + df_local_compute_function local_compute_fun; + df_init_function init_fun; + df_dataflow_function dataflow_fun; + df_confluence_function_0 con_fun_0; + df_confluence_function_n con_fun_n; + df_transfer_function trans_fun; + df_finalizer_function finalize_fun; + df_free_function free_fun; + df_remove_problem_function remove_problem_fun; + df_dump_problem_function dump_start_fun; + df_dump_bb_problem_function dump_top_fun; + df_dump_bb_problem_function dump_bottom_fun; + df_dump_insn_problem_function dump_insn_top_fun; + df_dump_insn_problem_function dump_insn_bottom_fun; + df_verify_solution_start verify_start_fun; + df_verify_solution_end verify_end_fun; + const struct df_problem *dependent_problem; + unsigned int block_info_elt_size; + + /* The timevar id associated with this pass. */ + timevar_id_t tv_id; + + /* True if the df_set_blocks should null out the basic block info if + this block drops out of df->blocks_to_analyze. */ + bool free_blocks_on_set_blocks; +}; + + +/* The specific instance of the problem to solve. */ +struct dataflow +{ + const struct df_problem *problem; /* The problem to be solved. */ + + /* Array indexed by bb->index, that contains basic block problem and + solution specific information. */ + void *block_info; + unsigned int block_info_size; + + /* The pool to allocate the block_info from. */ + object_allocator *block_pool; + + /* The lr and live problems have their transfer functions recomputed + only if necessary. This is possible for them because, the + problems are kept active for the entire backend and their + transfer functions are indexed by the REGNO. These are not + defined for any other problem. */ + bitmap out_of_date_transfer_functions; + + /* Other problem specific data that is not on a per basic block + basis. The structure is generally defined privately for the + problem. The exception being the scanning problem where it is + fully public. */ + void *problem_data; + + /* Local flags for some of the problems. */ + unsigned int local_flags; + + /* True if this problem of this instance has been initialized. This + is used by the dumpers to keep garbage out of the dumps if, for + debugging a dump is produced before the first call to + df_analyze after a new problem is added. */ + bool computed; + + /* True if the something has changed which invalidates the dataflow + solutions. Note that this bit is always true for all problems except + lr and live. */ + bool solutions_dirty; + + /* If true, this pass is deleted by df_finish_pass. This is never + true for DF_SCAN and DF_LR. It is true for DF_LIVE if optimize > + 1. It is always true for the other problems. */ + bool optional_p; +}; + + +/* The set of multiword hardregs used as operands to this + instruction. These are factored into individual uses and defs but + the aggregate is still needed to service the REG_DEAD and + REG_UNUSED notes. */ +struct df_mw_hardreg +{ + df_mw_hardreg *next; /* Next entry for this instruction. */ + rtx mw_reg; /* The multiword hardreg. */ + /* These two bitfields are intentionally oversized, in the hope that + accesses to 16-bit fields will usually be quicker. */ + ENUM_BITFIELD(df_ref_type) type : 16; + /* Used to see if the ref is read or write. */ + int flags : 16; /* Various df_ref_flags. */ + unsigned int start_regno; /* First word of the multi word subreg. */ + unsigned int end_regno; /* Last word of the multi word subreg. */ + unsigned int mw_order; /* Same as df_ref.ref_order. */ +}; + + +/* Define a register reference structure. One of these is allocated + for every register reference (use or def). Note some register + references (e.g., post_inc, subreg) generate both a def and a use. */ +struct df_base_ref +{ + /* These three bitfields are intentionally oversized, in the hope that + accesses to 8 and 16-bit fields will usually be quicker. */ + ENUM_BITFIELD(df_ref_class) cl : 8; + + ENUM_BITFIELD(df_ref_type) type : 8; + /* Type of ref. */ + int flags : 16; /* Various df_ref_flags. */ + unsigned int regno; /* The register number referenced. */ + rtx reg; /* The register referenced. */ + union df_ref_d *next_loc; /* Next ref for same insn or bb. */ + struct df_link *chain; /* Head of def-use, use-def. */ + /* Pointer to the insn info of the containing instruction. FIXME! + Currently this is NULL for artificial refs but this will be used + when FUDs are added. */ + struct df_insn_info *insn_info; + /* For each regno, there are three chains of refs, one for the uses, + the eq_uses and the defs. These chains go through the refs + themselves rather than using an external structure. */ + union df_ref_d *next_reg; /* Next ref with same regno and type. */ + union df_ref_d *prev_reg; /* Prev ref with same regno and type. */ + /* Location in the ref table. This is only valid after a call to + df_maybe_reorganize_[use,def]_refs which is an expensive operation. */ + int id; + /* The index at which the operand was scanned in the insn. This is + used to totally order the refs in an insn. */ + unsigned int ref_order; +}; + + +/* The three types of df_refs. Note that the df_ref_extract is an + extension of the df_regular_ref, not the df_base_ref. */ +struct df_artificial_ref +{ + struct df_base_ref base; + + /* Artificial refs do not have an insn, so to get the basic block, + it must be explicitly here. */ + basic_block bb; +}; + + +struct df_regular_ref +{ + struct df_base_ref base; + /* The loc is the address in the insn of the reg. This is not + defined for special registers, such as clobbers and stack + pointers that are also associated with call insns and so those + just use the base. */ + rtx *loc; +}; + +/* Union of the different kinds of defs/uses placeholders. */ +union df_ref_d +{ + struct df_base_ref base; + struct df_regular_ref regular_ref; + struct df_artificial_ref artificial_ref; +}; +typedef union df_ref_d *df_ref; + + +/* One of these structures is allocated for every insn. */ +struct df_insn_info +{ + rtx_insn *insn; /* The insn this info comes from. */ + df_ref defs; /* Head of insn-def chain. */ + df_ref uses; /* Head of insn-use chain. */ + /* Head of insn-use chain for uses in REG_EQUAL/EQUIV notes. */ + df_ref eq_uses; + struct df_mw_hardreg *mw_hardregs; + /* The logical uid of the insn in the basic block. This is valid + after any call to df_analyze but may rot after insns are added, + deleted or moved. */ + int luid; +}; + +/* These links are used for ref-ref chains. Currently only DEF-USE and + USE-DEF chains can be built by DF. */ +struct df_link +{ + df_ref ref; + struct df_link *next; +}; + + +enum df_chain_flags +{ + /* Flags that control the building of chains. */ + DF_DU_CHAIN = 1, /* Build DU chains. */ + DF_UD_CHAIN = 2 /* Build UD chains. */ +}; + +enum df_scan_flags +{ + /* Flags for the SCAN problem. */ + DF_SCAN_EMPTY_ENTRY_EXIT = 1 /* Don't define any registers in the entry + block; don't use any in the exit block. */ +}; + +enum df_changeable_flags +{ + /* Scanning flags. */ + /* Flag to control the running of dce as a side effect of building LR. */ + DF_LR_RUN_DCE = 1 << 0, /* Run DCE. */ + DF_NO_HARD_REGS = 1 << 1, /* Skip hard registers in RD and CHAIN Building. */ + + DF_EQ_NOTES = 1 << 2, /* Build chains with uses present in EQUIV/EQUAL notes. */ + DF_NO_REGS_EVER_LIVE = 1 << 3, /* Do not compute the regs_ever_live. */ + + /* Cause df_insn_rescan df_notes_rescan and df_insn_delete, to + return immediately. This is used by passes that know how to update + the scanning them selves. */ + DF_NO_INSN_RESCAN = 1 << 4, + + /* Cause df_insn_rescan df_notes_rescan and df_insn_delete, to + return after marking the insn for later processing. This allows all + rescans to be batched. */ + DF_DEFER_INSN_RESCAN = 1 << 5, + + /* Compute the reaching defs problem as "live and reaching defs" (LR&RD). + A DEF is reaching and live at insn I if DEF reaches I and REGNO(DEF) + is in LR_IN of the basic block containing I. */ + DF_RD_PRUNE_DEAD_DEFS = 1 << 6, + + DF_VERIFY_SCHEDULED = 1 << 7 +}; + +/* Two of these structures are inline in df, one for the uses and one + for the defs. This structure is only contains the refs within the + boundary of the df_set_blocks if that has been defined. */ +struct df_ref_info +{ + df_ref *refs; /* Ref table, indexed by id. */ + unsigned int *begin; /* First ref_index for this pseudo. */ + unsigned int *count; /* Count of refs for this pseudo. */ + unsigned int refs_size; /* Size of currently allocated refs table. */ + + /* Table_size is the number of elements in the refs table. This + will also be the width of the bitvectors in the rd and ru + problems. Total_size is the number of refs. These will be the + same if the focus has not been reduced by df_set_blocks. If the + focus has been reduced, table_size will be smaller since it only + contains the refs in the set blocks. */ + unsigned int table_size; + unsigned int total_size; + + enum df_ref_order ref_order; +}; + +/* Three of these structures are allocated for every pseudo reg. One + for the uses, one for the eq_uses and one for the defs. */ +struct df_reg_info +{ + /* Head of chain for refs of that type and regno. */ + df_ref reg_chain; + /* Number of refs in the chain. */ + unsigned int n_refs; +}; + + +/*---------------------------------------------------------------------------- + Problem data for the scanning dataflow problem. Unlike the other + dataflow problems, the problem data for scanning is fully exposed and + used by owners of the problem. +----------------------------------------------------------------------------*/ + +struct df_d +{ + + /* The set of problems to be solved is stored in two arrays. In + PROBLEMS_IN_ORDER, the problems are stored in the order that they + are solved. This is an internally dense array that may have + nulls at the end of it. In PROBLEMS_BY_INDEX, the problem is + stored by the value in df_problem.id. These are used to access + the problem local data without having to search the first + array. */ + + struct dataflow *problems_in_order[DF_LAST_PROBLEM_PLUS1]; + struct dataflow *problems_by_index[DF_LAST_PROBLEM_PLUS1]; + + /* If not NULL, this subset of blocks of the program to be + considered for analysis. At certain times, this will contain all + the blocks in the function so it cannot be used as an indicator + of if we are analyzing a subset. See analyze_subset. */ + bitmap blocks_to_analyze; + + /* The following information is really the problem data for the + scanning instance but it is used too often by the other problems + to keep getting it from there. */ + struct df_ref_info def_info; /* Def info. */ + struct df_ref_info use_info; /* Use info. */ + + /* The following three arrays are allocated in parallel. They contain + the sets of refs of each type for each reg. */ + struct df_reg_info **def_regs; /* Def reg info. */ + struct df_reg_info **use_regs; /* Eq_use reg info. */ + struct df_reg_info **eq_use_regs; /* Eq_use info. */ + unsigned int regs_size; /* Size of currently allocated regs table. */ + unsigned int regs_inited; /* Number of regs with reg_infos allocated. */ + + + struct df_insn_info **insns; /* Insn table, indexed by insn UID. */ + unsigned int insns_size; /* Size of insn table. */ + + int num_problems_defined; + + bitmap_head hardware_regs_used; /* The set of hardware registers used. */ + /* The set of hard regs that are in the artificial uses at the end + of a regular basic block. */ + bitmap_head regular_block_artificial_uses; + /* The set of hard regs that are in the artificial uses at the end + of a basic block that has an EH pred. */ + bitmap_head eh_block_artificial_uses; + /* The set of hardware registers live on entry to the function. */ + bitmap entry_block_defs; + bitmap exit_block_uses; /* The set of hardware registers used in exit block. */ + + /* Insns to delete, rescan or reprocess the notes at next + df_rescan_all or df_process_deferred_rescans. */ + bitmap_head insns_to_delete; + bitmap_head insns_to_rescan; + bitmap_head insns_to_notes_rescan; + int *postorder; /* The current set of basic blocks + in reverse postorder. */ + int *postorder_inverted; /* The current set of basic blocks + in reverse postorder of inverted CFG. */ + int n_blocks; /* The number of blocks in reverse postorder. */ + int n_blocks_inverted; /* The number of blocks + in reverse postorder of inverted CFG. */ + + /* An array [FIRST_PSEUDO_REGISTER], indexed by regno, of the number + of refs that qualify as being real hard regs uses. Artificial + uses and defs as well as refs in eq notes are ignored. If the + ref is a def, it cannot be a MAY_CLOBBER def. If the ref is a + use, it cannot be the emim_reg_set or be the frame or arg pointer + register. Uses in debug insns are ignored. + + IT IS NOT ACCEPTABLE TO MANUALLY CHANGE THIS ARRAY. This array + always reflects the actual number of refs in the insn stream that + satisfy the above criteria. */ + unsigned int *hard_regs_live_count; + + /* This counter provides a way to totally order refs without using + addresses. It is incremented whenever a ref is created. */ + unsigned int ref_order; + + /* Problem specific control information. This is a combination of + enum df_changeable_flags values. */ + int changeable_flags : 8; + + /* If this is true, then only a subset of the blocks of the program + is considered to compute the solutions of dataflow problems. */ + bool analyze_subset; + + /* True if someone added or deleted something from regs_ever_live so + that the entry and exit blocks need be reprocessed. */ + bool redo_entry_and_exit; +}; + +#define DF_SCAN_BB_INFO(BB) (df_scan_get_bb_info ((BB)->index)) +#define DF_RD_BB_INFO(BB) (df_rd_get_bb_info ((BB)->index)) +#define DF_LR_BB_INFO(BB) (df_lr_get_bb_info ((BB)->index)) +#define DF_LIVE_BB_INFO(BB) (df_live_get_bb_info ((BB)->index)) +#define DF_WORD_LR_BB_INFO(BB) (df_word_lr_get_bb_info ((BB)->index)) +#define DF_MD_BB_INFO(BB) (df_md_get_bb_info ((BB)->index)) +#define DF_MIR_BB_INFO(BB) (df_mir_get_bb_info ((BB)->index)) + +/* Most transformations that wish to use live register analysis will + use these macros. This info is the and of the lr and live sets. */ +#define DF_LIVE_IN(BB) (&DF_LIVE_BB_INFO (BB)->in) +#define DF_LIVE_OUT(BB) (&DF_LIVE_BB_INFO (BB)->out) + +#define DF_MIR_IN(BB) (&DF_MIR_BB_INFO (BB)->in) +#define DF_MIR_OUT(BB) (&DF_MIR_BB_INFO (BB)->out) + +/* These macros are used by passes that are not tolerant of + uninitialized variables. This intolerance should eventually + be fixed. */ +#define DF_LR_IN(BB) (&DF_LR_BB_INFO (BB)->in) +#define DF_LR_OUT(BB) (&DF_LR_BB_INFO (BB)->out) + +/* These macros are used by passes that are not tolerant of + uninitialized variables. This intolerance should eventually + be fixed. */ +#define DF_WORD_LR_IN(BB) (&DF_WORD_LR_BB_INFO (BB)->in) +#define DF_WORD_LR_OUT(BB) (&DF_WORD_LR_BB_INFO (BB)->out) + +/* Macros to access the elements within the ref structure. */ + + +#define DF_REF_REAL_REG(REF) (GET_CODE ((REF)->base.reg) == SUBREG \ + ? SUBREG_REG ((REF)->base.reg) : ((REF)->base.reg)) +#define DF_REF_REGNO(REF) ((REF)->base.regno) +#define DF_REF_REAL_LOC(REF) (GET_CODE (*((REF)->regular_ref.loc)) == SUBREG \ + ? &SUBREG_REG (*((REF)->regular_ref.loc)) : ((REF)->regular_ref.loc)) +#define DF_REF_REG(REF) ((REF)->base.reg) +#define DF_REF_LOC(REF) (DF_REF_CLASS (REF) == DF_REF_REGULAR ? \ + (REF)->regular_ref.loc : NULL) +#define DF_REF_BB(REF) (DF_REF_IS_ARTIFICIAL (REF) \ + ? (REF)->artificial_ref.bb \ + : BLOCK_FOR_INSN (DF_REF_INSN (REF))) +#define DF_REF_BBNO(REF) (DF_REF_BB (REF)->index) +#define DF_REF_INSN_INFO(REF) ((REF)->base.insn_info) +#define DF_REF_INSN(REF) ((REF)->base.insn_info->insn) +#define DF_REF_INSN_UID(REF) (INSN_UID (DF_REF_INSN(REF))) +#define DF_REF_CLASS(REF) ((REF)->base.cl) +#define DF_REF_TYPE(REF) ((REF)->base.type) +#define DF_REF_CHAIN(REF) ((REF)->base.chain) +#define DF_REF_ID(REF) ((REF)->base.id) +#define DF_REF_FLAGS(REF) ((REF)->base.flags) +#define DF_REF_FLAGS_IS_SET(REF, v) ((DF_REF_FLAGS (REF) & (v)) != 0) +#define DF_REF_FLAGS_SET(REF, v) (DF_REF_FLAGS (REF) |= (v)) +#define DF_REF_FLAGS_CLEAR(REF, v) (DF_REF_FLAGS (REF) &= ~(v)) +#define DF_REF_ORDER(REF) ((REF)->base.ref_order) +/* If DF_REF_IS_ARTIFICIAL () is true, this is not a real + definition/use, but an artificial one created to model always live + registers, eh uses, etc. */ +#define DF_REF_IS_ARTIFICIAL(REF) (DF_REF_CLASS (REF) == DF_REF_ARTIFICIAL) +#define DF_REF_REG_MARK(REF) (DF_REF_FLAGS_SET ((REF),DF_REF_REG_MARKER)) +#define DF_REF_REG_UNMARK(REF) (DF_REF_FLAGS_CLEAR ((REF),DF_REF_REG_MARKER)) +#define DF_REF_IS_REG_MARKED(REF) (DF_REF_FLAGS_IS_SET ((REF),DF_REF_REG_MARKER)) +#define DF_REF_NEXT_LOC(REF) ((REF)->base.next_loc) +#define DF_REF_NEXT_REG(REF) ((REF)->base.next_reg) +#define DF_REF_PREV_REG(REF) ((REF)->base.prev_reg) +/* The following two macros may only be applied if one of + DF_REF_SIGN_EXTRACT | DF_REF_ZERO_EXTRACT is true. */ +#define DF_REF_EXTRACT_WIDTH(REF) ((REF)->extract_ref.width) +#define DF_REF_EXTRACT_OFFSET(REF) ((REF)->extract_ref.offset) +#define DF_REF_EXTRACT_MODE(REF) ((REF)->extract_ref.mode) + +/* Macros to determine the reference type. */ +#define DF_REF_REG_DEF_P(REF) (DF_REF_TYPE (REF) == DF_REF_REG_DEF) +#define DF_REF_REG_USE_P(REF) (!DF_REF_REG_DEF_P (REF)) +#define DF_REF_REG_MEM_STORE_P(REF) (DF_REF_TYPE (REF) == DF_REF_REG_MEM_STORE) +#define DF_REF_REG_MEM_LOAD_P(REF) (DF_REF_TYPE (REF) == DF_REF_REG_MEM_LOAD) +#define DF_REF_REG_MEM_P(REF) (DF_REF_REG_MEM_STORE_P (REF) \ + || DF_REF_REG_MEM_LOAD_P (REF)) + +#define DF_MWS_REG_DEF_P(MREF) (DF_MWS_TYPE (MREF) == DF_REF_REG_DEF) +#define DF_MWS_REG_USE_P(MREF) (!DF_MWS_REG_DEF_P (MREF)) +#define DF_MWS_NEXT(MREF) ((MREF)->next) +#define DF_MWS_TYPE(MREF) ((MREF)->type) + +/* Macros to get the refs out of def_info or use_info refs table. If + the focus of the dataflow has been set to some subset of blocks + with df_set_blocks, these macros will only find the uses and defs + in that subset of blocks. + + These macros should be used with care. The def macros are only + usable after a call to df_maybe_reorganize_def_refs and the use + macros are only usable after a call to + df_maybe_reorganize_use_refs. HOWEVER, BUILDING AND USING THESE + ARRAYS ARE A CACHE LOCALITY KILLER. */ + +#define DF_DEFS_TABLE_SIZE() (df->def_info.table_size) +#define DF_DEFS_GET(ID) (df->def_info.refs[(ID)]) +#define DF_DEFS_SET(ID,VAL) (df->def_info.refs[(ID)]=(VAL)) +#define DF_DEFS_COUNT(ID) (df->def_info.count[(ID)]) +#define DF_DEFS_BEGIN(ID) (df->def_info.begin[(ID)]) +#define DF_USES_TABLE_SIZE() (df->use_info.table_size) +#define DF_USES_GET(ID) (df->use_info.refs[(ID)]) +#define DF_USES_SET(ID,VAL) (df->use_info.refs[(ID)]=(VAL)) +#define DF_USES_COUNT(ID) (df->use_info.count[(ID)]) +#define DF_USES_BEGIN(ID) (df->use_info.begin[(ID)]) + +/* Macros to access the register information from scan dataflow record. */ + +#define DF_REG_SIZE(DF) (df->regs_inited) +#define DF_REG_DEF_GET(REG) (df->def_regs[(REG)]) +#define DF_REG_DEF_CHAIN(REG) (df->def_regs[(REG)]->reg_chain) +#define DF_REG_DEF_COUNT(REG) (df->def_regs[(REG)]->n_refs) +#define DF_REG_USE_GET(REG) (df->use_regs[(REG)]) +#define DF_REG_USE_CHAIN(REG) (df->use_regs[(REG)]->reg_chain) +#define DF_REG_USE_COUNT(REG) (df->use_regs[(REG)]->n_refs) +#define DF_REG_EQ_USE_GET(REG) (df->eq_use_regs[(REG)]) +#define DF_REG_EQ_USE_CHAIN(REG) (df->eq_use_regs[(REG)]->reg_chain) +#define DF_REG_EQ_USE_COUNT(REG) (df->eq_use_regs[(REG)]->n_refs) + +/* Macros to access the elements within the reg_info structure table. */ + +#define DF_REGNO_FIRST_DEF(REGNUM) \ +(DF_REG_DEF_GET(REGNUM) ? DF_REG_DEF_GET (REGNUM) : 0) +#define DF_REGNO_LAST_USE(REGNUM) \ +(DF_REG_USE_GET(REGNUM) ? DF_REG_USE_GET (REGNUM) : 0) + +/* Macros to access the elements within the insn_info structure table. */ + +#define DF_INSN_SIZE() ((df)->insns_size) +#define DF_INSN_INFO_GET(INSN) (df->insns[(INSN_UID (INSN))]) +#define DF_INSN_INFO_SET(INSN,VAL) (df->insns[(INSN_UID (INSN))]=(VAL)) +#define DF_INSN_INFO_LUID(II) ((II)->luid) +#define DF_INSN_INFO_DEFS(II) ((II)->defs) +#define DF_INSN_INFO_USES(II) ((II)->uses) +#define DF_INSN_INFO_EQ_USES(II) ((II)->eq_uses) +#define DF_INSN_INFO_MWS(II) ((II)->mw_hardregs) + +#define DF_INSN_LUID(INSN) (DF_INSN_INFO_LUID (DF_INSN_INFO_GET (INSN))) +#define DF_INSN_DEFS(INSN) (DF_INSN_INFO_DEFS (DF_INSN_INFO_GET (INSN))) +#define DF_INSN_USES(INSN) (DF_INSN_INFO_USES (DF_INSN_INFO_GET (INSN))) +#define DF_INSN_EQ_USES(INSN) (DF_INSN_INFO_EQ_USES (DF_INSN_INFO_GET (INSN))) + +#define DF_INSN_UID_GET(UID) (df->insns[(UID)]) +#define DF_INSN_UID_SET(UID,VAL) (df->insns[(UID)]=(VAL)) +#define DF_INSN_UID_SAFE_GET(UID) (((unsigned)(UID) < DF_INSN_SIZE ()) \ + ? DF_INSN_UID_GET (UID) \ + : NULL) +#define DF_INSN_UID_LUID(INSN) (DF_INSN_UID_GET (INSN)->luid) +#define DF_INSN_UID_DEFS(INSN) (DF_INSN_UID_GET (INSN)->defs) +#define DF_INSN_UID_USES(INSN) (DF_INSN_UID_GET (INSN)->uses) +#define DF_INSN_UID_EQ_USES(INSN) (DF_INSN_UID_GET (INSN)->eq_uses) +#define DF_INSN_UID_MWS(INSN) (DF_INSN_UID_GET (INSN)->mw_hardregs) + +#define FOR_EACH_INSN_INFO_DEF(ITER, INSN) \ + for (ITER = DF_INSN_INFO_DEFS (INSN); ITER; ITER = DF_REF_NEXT_LOC (ITER)) + +#define FOR_EACH_INSN_INFO_USE(ITER, INSN) \ + for (ITER = DF_INSN_INFO_USES (INSN); ITER; ITER = DF_REF_NEXT_LOC (ITER)) + +#define FOR_EACH_INSN_INFO_EQ_USE(ITER, INSN) \ + for (ITER = DF_INSN_INFO_EQ_USES (INSN); ITER; ITER = DF_REF_NEXT_LOC (ITER)) + +#define FOR_EACH_INSN_INFO_MW(ITER, INSN) \ + for (ITER = DF_INSN_INFO_MWS (INSN); ITER; ITER = DF_MWS_NEXT (ITER)) + +#define FOR_EACH_INSN_DEF(ITER, INSN) \ + FOR_EACH_INSN_INFO_DEF(ITER, DF_INSN_INFO_GET (INSN)) + +#define FOR_EACH_INSN_USE(ITER, INSN) \ + FOR_EACH_INSN_INFO_USE(ITER, DF_INSN_INFO_GET (INSN)) + +#define FOR_EACH_INSN_EQ_USE(ITER, INSN) \ + FOR_EACH_INSN_INFO_EQ_USE(ITER, DF_INSN_INFO_GET (INSN)) + +#define FOR_EACH_ARTIFICIAL_USE(ITER, BB_INDEX) \ + for (ITER = df_get_artificial_uses (BB_INDEX); ITER; \ + ITER = DF_REF_NEXT_LOC (ITER)) + +#define FOR_EACH_ARTIFICIAL_DEF(ITER, BB_INDEX) \ + for (ITER = df_get_artificial_defs (BB_INDEX); ITER; \ + ITER = DF_REF_NEXT_LOC (ITER)) + +/* An obstack for bitmap not related to specific dataflow problems. + This obstack should e.g. be used for bitmaps with a short life time + such as temporary bitmaps. This obstack is declared in df-core.c. */ + +extern bitmap_obstack df_bitmap_obstack; + + +/* One of these structures is allocated for every basic block. */ +struct df_scan_bb_info +{ + /* The entry block has many artificial defs and these are at the + bottom of the block. + + Blocks that are targets of exception edges may have some + artificial defs. These are logically located at the top of the + block. + + Blocks that are the targets of non-local goto's have the hard + frame pointer defined at the top of the block. */ + df_ref artificial_defs; + + /* Blocks that are targets of exception edges may have some + artificial uses. These are logically at the top of the block. + + Most blocks have artificial uses at the bottom of the block. */ + df_ref artificial_uses; +}; + + +/* Reaching definitions. All bitmaps are indexed by the id field of + the ref except sparse_kill which is indexed by regno. For the + LR&RD problem, the kill set is not complete: It does not contain + DEFs killed because the set register has died in the LR set. */ +struct df_rd_bb_info +{ + /* Local sets to describe the basic blocks. */ + bitmap_head kill; + bitmap_head sparse_kill; + bitmap_head gen; /* The set of defs generated in this block. */ + + /* The results of the dataflow problem. */ + bitmap_head in; /* At the top of the block. */ + bitmap_head out; /* At the bottom of the block. */ +}; + + +/* Multiple reaching definitions. All bitmaps are referenced by the + register number. */ + +struct df_md_bb_info +{ + /* Local sets to describe the basic blocks. */ + bitmap_head gen; /* Partial/conditional definitions live at BB out. */ + bitmap_head kill; /* Other definitions that are live at BB out. */ + bitmap_head init; /* Definitions coming from dominance frontier edges. */ + + /* The results of the dataflow problem. */ + bitmap_head in; /* Just before the block itself. */ + bitmap_head out; /* At the bottom of the block. */ +}; + + +/* Live registers, a backwards dataflow problem. All bitmaps are + referenced by the register number. */ + +struct df_lr_bb_info +{ + /* Local sets to describe the basic blocks. */ + bitmap_head def; /* The set of registers set in this block + - except artificial defs at the top. */ + bitmap_head use; /* The set of registers used in this block. */ + + /* The results of the dataflow problem. */ + bitmap_head in; /* Just before the block itself. */ + bitmap_head out; /* At the bottom of the block. */ +}; + + +/* Uninitialized registers. All bitmaps are referenced by the + register number. Anded results of the forwards and backward live + info. Note that the forwards live information is not available + separately. */ +struct df_live_bb_info +{ + /* Local sets to describe the basic blocks. */ + bitmap_head kill; /* The set of registers unset in this block. Calls, + for instance, unset registers. */ + bitmap_head gen; /* The set of registers set in this block. */ + + /* The results of the dataflow problem. */ + bitmap_head in; /* At the top of the block. */ + bitmap_head out; /* At the bottom of the block. */ +}; + + +/* Live registers, a backwards dataflow problem. These bitmaps are + indexed by 2 * regno for each pseudo and have two entries for each + pseudo. Only pseudos that have a size of 2 * UNITS_PER_WORD are + meaningfully tracked. */ + +struct df_word_lr_bb_info +{ + /* Local sets to describe the basic blocks. */ + bitmap_head def; /* The set of registers set in this block + - except artificial defs at the top. */ + bitmap_head use; /* The set of registers used in this block. */ + + /* The results of the dataflow problem. */ + bitmap_head in; /* Just before the block itself. */ + bitmap_head out; /* At the bottom of the block. */ +}; + +/* Must-initialized registers. All bitmaps are referenced by the + register number. */ +struct df_mir_bb_info +{ + /* Local sets to describe the basic blocks. */ + bitmap_head kill; /* The set of registers unset in this block. Calls, + for instance, unset registers. */ + bitmap_head gen; /* The set of registers set in this block, excluding the + ones killed later on in this block. */ + + /* The results of the dataflow problem. */ + bitmap_head in; /* At the top of the block. */ + bitmap_head out; /* At the bottom of the block. */ +}; + + +/* This is used for debugging and for the dumpers to find the latest + instance so that the df info can be added to the dumps. This + should not be used by regular code. */ +extern struct df_d *df; +#define df_scan (df->problems_by_index[DF_SCAN]) +#define df_rd (df->problems_by_index[DF_RD]) +#define df_lr (df->problems_by_index[DF_LR]) +#define df_live (df->problems_by_index[DF_LIVE]) +#define df_chain (df->problems_by_index[DF_CHAIN]) +#define df_word_lr (df->problems_by_index[DF_WORD_LR]) +#define df_note (df->problems_by_index[DF_NOTE]) +#define df_md (df->problems_by_index[DF_MD]) +#define df_mir (df->problems_by_index[DF_MIR]) + +/* This symbol turns on checking that each modification of the cfg has + been identified to the appropriate df routines. It is not part of + verification per se because the check that the final solution has + not changed covers this. However, if the solution is not being + properly recomputed because the cfg is being modified, adding in + calls to df_check_cfg_clean can be used to find the source of that + kind of problem. */ +#if 0 +#define DF_DEBUG_CFG +#endif + + +/* Functions defined in df-core.c. */ + +extern void df_add_problem (const struct df_problem *); +extern int df_set_flags (int); +extern int df_clear_flags (int); +extern void df_set_blocks (bitmap); +extern void df_remove_problem (struct dataflow *); +extern void df_finish_pass (bool); +extern void df_analyze_problem (struct dataflow *, bitmap, int *, int); +extern void df_analyze (); +extern void df_analyze_loop (struct loop *); +extern int df_get_n_blocks (enum df_flow_dir); +extern int *df_get_postorder (enum df_flow_dir); +extern void df_simple_dataflow (enum df_flow_dir, df_init_function, + df_confluence_function_0, df_confluence_function_n, + df_transfer_function, bitmap, int *, int); +extern void df_mark_solutions_dirty (void); +extern bool df_get_bb_dirty (basic_block); +extern void df_set_bb_dirty (basic_block); +extern void df_compact_blocks (void); +extern void df_bb_replace (int, basic_block); +extern void df_bb_delete (int); +extern void df_verify (void); +#ifdef DF_DEBUG_CFG +extern void df_check_cfg_clean (void); +#endif +extern df_ref df_bb_regno_first_def_find (basic_block, unsigned int); +extern df_ref df_bb_regno_last_def_find (basic_block, unsigned int); +extern df_ref df_find_def (rtx_insn *, rtx); +extern bool df_reg_defined (rtx_insn *, rtx); +extern df_ref df_find_use (rtx_insn *, rtx); +extern bool df_reg_used (rtx_insn *, rtx); +extern void df_worklist_dataflow (struct dataflow *,bitmap, int *, int); +extern void df_print_regset (FILE *file, bitmap r); +extern void df_print_word_regset (FILE *file, bitmap r); +extern void df_dump (FILE *); +extern void df_dump_region (FILE *); +extern void df_dump_start (FILE *); +extern void df_dump_top (basic_block, FILE *); +extern void df_dump_bottom (basic_block, FILE *); +extern void df_dump_insn_top (const rtx_insn *, FILE *); +extern void df_dump_insn_bottom (const rtx_insn *, FILE *); +extern void df_refs_chain_dump (df_ref, bool, FILE *); +extern void df_regs_chain_dump (df_ref, FILE *); +extern void df_insn_debug (rtx_insn *, bool, FILE *); +extern void df_insn_debug_regno (rtx_insn *, FILE *); +extern void df_regno_debug (unsigned int, FILE *); +extern void df_ref_debug (df_ref, FILE *); +extern void debug_df_insn (rtx_insn *); +extern void debug_df_regno (unsigned int); +extern void debug_df_reg (rtx); +extern void debug_df_defno (unsigned int); +extern void debug_df_useno (unsigned int); +extern void debug_df_ref (df_ref); +extern void debug_df_chain (struct df_link *); + +/* Functions defined in df-problems.c. */ + +extern struct df_link *df_chain_create (df_ref, df_ref); +extern void df_chain_unlink (df_ref); +extern void df_chain_copy (df_ref, struct df_link *); +extern void df_grow_bb_info (struct dataflow *); +extern void df_chain_dump (struct df_link *, FILE *); +extern void df_print_bb_index (basic_block bb, FILE *file); +extern void df_rd_add_problem (void); +extern void df_rd_simulate_artificial_defs_at_top (basic_block, bitmap); +extern void df_rd_simulate_one_insn (basic_block, rtx_insn *, bitmap); +extern void df_lr_add_problem (void); +extern void df_lr_verify_transfer_functions (void); +extern void df_live_verify_transfer_functions (void); +extern void df_live_add_problem (void); +extern void df_live_set_all_dirty (void); +extern void df_chain_add_problem (unsigned int); +extern void df_word_lr_add_problem (void); +extern bool df_word_lr_mark_ref (df_ref, bool, bitmap); +extern bool df_word_lr_simulate_defs (rtx_insn *, bitmap); +extern void df_word_lr_simulate_uses (rtx_insn *, bitmap); +extern void df_word_lr_simulate_artificial_refs_at_top (basic_block, bitmap); +extern void df_word_lr_simulate_artificial_refs_at_end (basic_block, bitmap); +extern void df_note_add_problem (void); +extern void df_md_add_problem (void); +extern void df_md_simulate_artificial_defs_at_top (basic_block, bitmap); +extern void df_md_simulate_one_insn (basic_block, rtx_insn *, bitmap); +extern void df_mir_add_problem (void); +extern void df_mir_simulate_one_insn (basic_block, rtx_insn *, bitmap, bitmap); +extern void df_simulate_find_noclobber_defs (rtx_insn *, bitmap); +extern void df_simulate_find_defs (rtx_insn *, bitmap); +extern void df_simulate_defs (rtx_insn *, bitmap); +extern void df_simulate_uses (rtx_insn *, bitmap); +extern void df_simulate_initialize_backwards (basic_block, bitmap); +extern void df_simulate_one_insn_backwards (basic_block, rtx_insn *, bitmap); +extern void df_simulate_finalize_backwards (basic_block, bitmap); +extern void df_simulate_initialize_forwards (basic_block, bitmap); +extern void df_simulate_one_insn_forwards (basic_block, rtx_insn *, bitmap); +extern void simulate_backwards_to_point (basic_block, regset, rtx); +extern bool can_move_insns_across (rtx_insn *, rtx_insn *, + rtx_insn *, rtx_insn *, + basic_block, regset, + regset, rtx_insn **); +/* Functions defined in df-scan.c. */ + +extern void df_scan_alloc (bitmap); +extern void df_scan_add_problem (void); +extern void df_grow_reg_info (void); +extern void df_grow_insn_info (void); +extern void df_scan_blocks (void); +extern void df_uses_create (rtx *, rtx_insn *, int); +extern struct df_insn_info * df_insn_create_insn_record (rtx_insn *); +extern void df_insn_delete (rtx_insn *); +extern void df_bb_refs_record (int, bool); +extern bool df_insn_rescan (rtx_insn *); +extern bool df_insn_rescan_debug_internal (rtx_insn *); +extern void df_insn_rescan_all (void); +extern void df_process_deferred_rescans (void); +extern void df_recompute_luids (basic_block); +extern void df_insn_change_bb (rtx_insn *, basic_block); +extern void df_maybe_reorganize_use_refs (enum df_ref_order); +extern void df_maybe_reorganize_def_refs (enum df_ref_order); +extern void df_ref_change_reg_with_loc (rtx, unsigned int); +extern void df_notes_rescan (rtx_insn *); +extern void df_hard_reg_init (void); +extern void df_update_entry_block_defs (void); +extern void df_update_exit_block_uses (void); +extern void df_update_entry_exit_and_calls (void); +extern bool df_hard_reg_used_p (unsigned int); +extern unsigned int df_hard_reg_used_count (unsigned int); +extern bool df_regs_ever_live_p (unsigned int); +extern void df_set_regs_ever_live (unsigned int, bool); +extern void df_compute_regs_ever_live (bool); +extern bool df_read_modify_subreg_p (rtx); +extern void df_scan_verify (void); + + +/*---------------------------------------------------------------------------- + Public functions access functions for the dataflow problems. +----------------------------------------------------------------------------*/ + +static inline struct df_scan_bb_info * +df_scan_get_bb_info (unsigned int index) +{ + if (index < df_scan->block_info_size) + return &((struct df_scan_bb_info *) df_scan->block_info)[index]; + else + return NULL; +} + +static inline struct df_rd_bb_info * +df_rd_get_bb_info (unsigned int index) +{ + if (index < df_rd->block_info_size) + return &((struct df_rd_bb_info *) df_rd->block_info)[index]; + else + return NULL; +} + +static inline struct df_lr_bb_info * +df_lr_get_bb_info (unsigned int index) +{ + if (index < df_lr->block_info_size) + return &((struct df_lr_bb_info *) df_lr->block_info)[index]; + else + return NULL; +} + +static inline struct df_md_bb_info * +df_md_get_bb_info (unsigned int index) +{ + if (index < df_md->block_info_size) + return &((struct df_md_bb_info *) df_md->block_info)[index]; + else + return NULL; +} + +static inline struct df_live_bb_info * +df_live_get_bb_info (unsigned int index) +{ + if (index < df_live->block_info_size) + return &((struct df_live_bb_info *) df_live->block_info)[index]; + else + return NULL; +} + +static inline struct df_word_lr_bb_info * +df_word_lr_get_bb_info (unsigned int index) +{ + if (index < df_word_lr->block_info_size) + return &((struct df_word_lr_bb_info *) df_word_lr->block_info)[index]; + else + return NULL; +} + +static inline struct df_mir_bb_info * +df_mir_get_bb_info (unsigned int index) +{ + if (index < df_mir->block_info_size) + return &((struct df_mir_bb_info *) df_mir->block_info)[index]; + else + return NULL; +} + +/* Get the live at out set for BB no matter what problem happens to be + defined. This function is used by the register allocators who + choose different dataflow problems depending on the optimization + level. */ + +static inline bitmap +df_get_live_out (basic_block bb) +{ + gcc_checking_assert (df_lr); + + if (df_live) + return DF_LIVE_OUT (bb); + else + return DF_LR_OUT (bb); +} + +/* Get the live at in set for BB no matter what problem happens to be + defined. This function is used by the register allocators who + choose different dataflow problems depending on the optimization + level. */ + +static inline bitmap +df_get_live_in (basic_block bb) +{ + gcc_checking_assert (df_lr); + + if (df_live) + return DF_LIVE_IN (bb); + else + return DF_LR_IN (bb); +} + +/* Get basic block info. */ +/* Get the artificial defs for a basic block. */ + +static inline df_ref +df_get_artificial_defs (unsigned int bb_index) +{ + return df_scan_get_bb_info (bb_index)->artificial_defs; +} + + +/* Get the artificial uses for a basic block. */ + +static inline df_ref +df_get_artificial_uses (unsigned int bb_index) +{ + return df_scan_get_bb_info (bb_index)->artificial_uses; +} + +/* If INSN defines exactly one register, return the associated reference, + otherwise return null. */ + +static inline df_ref +df_single_def (const df_insn_info *info) +{ + df_ref defs = DF_INSN_INFO_DEFS (info); + return defs && !DF_REF_NEXT_LOC (defs) ? defs : NULL; +} + +/* If INSN uses exactly one register, return the associated reference, + otherwise return null. */ + +static inline df_ref +df_single_use (const df_insn_info *info) +{ + df_ref uses = DF_INSN_INFO_USES (info); + return uses && !DF_REF_NEXT_LOC (uses) ? uses : NULL; +} + +/* web */ + +class web_entry_base +{ + private: + /* Reference to the parent in the union/find tree. */ + web_entry_base *pred_pvt; + + public: + /* Accessors. */ + web_entry_base *pred () { return pred_pvt; } + void set_pred (web_entry_base *p) { pred_pvt = p; } + + /* Find representative in union-find tree. */ + web_entry_base *unionfind_root (); + + /* Union with another set, returning TRUE if they are already unioned. */ + friend bool unionfind_union (web_entry_base *first, web_entry_base *second); +}; + +#endif /* GCC_DF_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dfp.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dfp.h new file mode 100644 index 0000000..58292c9 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dfp.h @@ -0,0 +1,50 @@ +/* Decimal floating point support functions for GNU compiler. + Copyright (C) 2005-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_DFP_H +#define GCC_DFP_H + +/* Encode REAL_VALUE_TYPEs into 32/64/128-bit IEEE 754 encoded values. */ +void encode_decimal32 (const struct real_format *fmt, long *, const REAL_VALUE_TYPE *); +void encode_decimal64 (const struct real_format *fmt, long *, const REAL_VALUE_TYPE *); +void decode_decimal128 (const struct real_format *, REAL_VALUE_TYPE *, const long *); + +/* Decode 32/64/128-bit IEEE 754 encoded values into REAL_VALUE_TYPEs. */ +void decode_decimal32 (const struct real_format *, REAL_VALUE_TYPE *, const long *); +void decode_decimal64 (const struct real_format *, REAL_VALUE_TYPE *, const long *); +void encode_decimal128 (const struct real_format *fmt, long *, const REAL_VALUE_TYPE *); + +/* Arithmetic and conversion functions. */ +int decimal_do_compare (const REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *, int); +void decimal_real_from_string (REAL_VALUE_TYPE *, const char *); +void decimal_round_for_format (const struct real_format *, REAL_VALUE_TYPE *); +void decimal_real_convert (REAL_VALUE_TYPE *, const real_format *, + const REAL_VALUE_TYPE *); +void decimal_real_to_decimal (char *, const REAL_VALUE_TYPE *, size_t, size_t, int); +void decimal_do_fix_trunc (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *); +void decimal_real_maxval (REAL_VALUE_TYPE *, int, machine_mode); +wide_int decimal_real_to_integer (const REAL_VALUE_TYPE *, bool *, int); +HOST_WIDE_INT decimal_real_to_integer (const REAL_VALUE_TYPE *); + +#ifdef TREE_CODE +bool decimal_real_arithmetic (REAL_VALUE_TYPE *, enum tree_code, const REAL_VALUE_TYPE *, + const REAL_VALUE_TYPE *); +#endif + +#endif /* GCC_DFP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/diagnostic-color.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/diagnostic-color.h new file mode 100644 index 0000000..7a4f348 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/diagnostic-color.h @@ -0,0 +1,65 @@ +/* Copyright (C) 2013-2017 Free Software Foundation, Inc. + Contributed by Manuel Lopez-Ibanez + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* Based on code from: */ +/* grep.c - main driver file for grep. + Copyright (C) 1992-2017 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. + + Written July 1992 by Mike Haertel. */ + +#ifndef GCC_DIAGNOSTIC_COLOR_H +#define GCC_DIAGNOSTIC_COLOR_H + +/* Whether to add color to diagnostics: + o DIAGNOSTICS_COLOR_NO: never + o DIAGNOSTICS_COLOR_YES: always + o DIAGNOSTICS_COLOR_AUTO: depending on the output stream. */ +typedef enum +{ + DIAGNOSTICS_COLOR_NO = 0, + DIAGNOSTICS_COLOR_YES = 1, + DIAGNOSTICS_COLOR_AUTO = 2 +} diagnostic_color_rule_t; + +const char *colorize_start (bool, const char *, size_t); +const char *colorize_stop (bool); +bool colorize_init (diagnostic_color_rule_t); + +inline const char * +colorize_start (bool show_color, const char *name) +{ + return colorize_start (show_color, name, strlen (name)); +} + +#endif /* ! GCC_DIAGNOSTIC_COLOR_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/diagnostic-core.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/diagnostic-core.h new file mode 100644 index 0000000..e9f7b67 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/diagnostic-core.h @@ -0,0 +1,105 @@ +/* Declarations of core diagnostic functionality for code that does + not need to deal with diagnostic contexts or diagnostic info + structures. + Copyright (C) 1998-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_DIAGNOSTIC_CORE_H +#define GCC_DIAGNOSTIC_CORE_H + +#include "bversion.h" + +/* Constants used to discriminate diagnostics. */ +typedef enum +{ +#define DEFINE_DIAGNOSTIC_KIND(K, msgid, C) K, +#include "diagnostic.def" +#undef DEFINE_DIAGNOSTIC_KIND + DK_LAST_DIAGNOSTIC_KIND, + /* This is used for tagging pragma pops in the diagnostic + classification history chain. */ + DK_POP +} diagnostic_t; + +extern const char *progname; + +extern const char *trim_filename (const char *); + +/* If we haven't already defined a front-end-specific diagnostics + style, use the generic one. */ +#ifndef GCC_DIAG_STYLE +#define GCC_DIAG_STYLE __gcc_tdiag__ +#endif +/* None of these functions are suitable for ATTRIBUTE_PRINTF, because + each language front end can extend them with its own set of format + specifiers. We must use custom format checks. */ +#if (CHECKING_P && GCC_VERSION >= 4001) || GCC_VERSION == BUILDING_GCC_VERSION +#define ATTRIBUTE_GCC_DIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m) +#else +#define ATTRIBUTE_GCC_DIAG(m, n) ATTRIBUTE_NONNULL(m) +#endif +extern void internal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2) + ATTRIBUTE_NORETURN; +extern void internal_error_no_backtrace (const char *, ...) + ATTRIBUTE_GCC_DIAG(1,2) ATTRIBUTE_NORETURN; +/* Pass one of the OPT_W* from options.h as the first parameter. */ +extern bool warning (int, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); +extern bool warning_n (location_t, int, int, const char *, const char *, ...) + ATTRIBUTE_GCC_DIAG(4,6) ATTRIBUTE_GCC_DIAG(5,6); +extern bool warning_at (location_t, int, const char *, ...) + ATTRIBUTE_GCC_DIAG(3,4); +extern bool warning_at_rich_loc (rich_location *, int, const char *, ...) + ATTRIBUTE_GCC_DIAG(3,4); +extern bool warning_at_rich_loc_n (rich_location *, int, int, const char *, + const char *, ...) + ATTRIBUTE_GCC_DIAG(4, 6) ATTRIBUTE_GCC_DIAG(5, 6); +extern void error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); +extern void error_n (location_t, int, const char *, const char *, ...) + ATTRIBUTE_GCC_DIAG(3,5) ATTRIBUTE_GCC_DIAG(4,5); +extern void error_at (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); +extern void error_at_rich_loc (rich_location *, const char *, ...) + ATTRIBUTE_GCC_DIAG(2,3); +extern void fatal_error (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3) + ATTRIBUTE_NORETURN; +/* Pass one of the OPT_W* from options.h as the second parameter. */ +extern bool pedwarn (location_t, int, const char *, ...) + ATTRIBUTE_GCC_DIAG(3,4); +extern bool pedwarn_at_rich_loc (rich_location *, int, const char *, ...) + ATTRIBUTE_GCC_DIAG(3,4); +extern bool permerror (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); +extern bool permerror_at_rich_loc (rich_location *, const char *, + ...) ATTRIBUTE_GCC_DIAG(2,3); +extern void sorry (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); +extern void inform (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); +extern void inform_at_rich_loc (rich_location *, const char *, + ...) ATTRIBUTE_GCC_DIAG(2,3); +extern void inform_n (location_t, int, const char *, const char *, ...) + ATTRIBUTE_GCC_DIAG(3,5) ATTRIBUTE_GCC_DIAG(4,5); +extern void verbatim (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); +extern bool emit_diagnostic (diagnostic_t, location_t, int, + const char *, ...) ATTRIBUTE_GCC_DIAG(4,5); +extern bool seen_error (void); + +#ifdef BUFSIZ + /* N.B. Unlike all the others, fnotice is just gettext+fprintf, and + therefore it can have ATTRIBUTE_PRINTF. */ +extern void fnotice (FILE *, const char *, ...) + ATTRIBUTE_PRINTF_2; +#endif + +#endif /* ! GCC_DIAGNOSTIC_CORE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/diagnostic.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/diagnostic.h new file mode 100644 index 0000000..91a9642 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/diagnostic.h @@ -0,0 +1,381 @@ +/* Various declarations for language-independent diagnostics subroutines. + Copyright (C) 2000-2017 Free Software Foundation, Inc. + Contributed by Gabriel Dos Reis + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_DIAGNOSTIC_H +#define GCC_DIAGNOSTIC_H + +#include "pretty-print.h" +#include "diagnostic-core.h" + +/* A diagnostic is described by the MESSAGE to send, the FILE and LINE of + its context and its KIND (ice, error, warning, note, ...) See complete + list in diagnostic.def. */ +struct diagnostic_info +{ + /* Text to be formatted. */ + text_info message; + + /* The location at which the diagnostic is to be reported. */ + rich_location *richloc; + + /* Auxiliary data for client. */ + void *x_data; + /* The kind of diagnostic it is about. */ + diagnostic_t kind; + /* Which OPT_* directly controls this diagnostic. */ + int option_index; +}; + +/* Each time a diagnostic's classification is changed with a pragma, + we record the change and the location of the change in an array of + these structs. */ +struct diagnostic_classification_change_t +{ + location_t location; + int option; + diagnostic_t kind; +}; + +/* Forward declarations. */ +typedef void (*diagnostic_starter_fn) (diagnostic_context *, + diagnostic_info *); + +typedef void (*diagnostic_start_span_fn) (diagnostic_context *, + expanded_location); + +typedef diagnostic_starter_fn diagnostic_finalizer_fn; + +class edit_context; + +/* This data structure bundles altogether any information relevant to + the context of a diagnostic message. */ +struct diagnostic_context +{ + /* Where most of the diagnostic formatting work is done. */ + pretty_printer *printer; + + /* The number of times we have issued diagnostics. */ + int diagnostic_count[DK_LAST_DIAGNOSTIC_KIND]; + + /* True if it has been requested that warnings be treated as errors. */ + bool warning_as_error_requested; + + /* The number of option indexes that can be passed to warning() et + al. */ + int n_opts; + + /* For each option index that can be passed to warning() et al + (OPT_* from options.h when using this code with the core GCC + options), this array may contain a new kind that the diagnostic + should be changed to before reporting, or DK_UNSPECIFIED to leave + it as the reported kind, or DK_IGNORED to not report it at + all. */ + diagnostic_t *classify_diagnostic; + + /* History of all changes to the classifications above. This list + is stored in location-order, so we can search it, either + binary-wise or end-to-front, to find the most recent + classification for a given diagnostic, given the location of the + diagnostic. */ + diagnostic_classification_change_t *classification_history; + + /* The size of the above array. */ + int n_classification_history; + + /* For pragma push/pop. */ + int *push_list; + int n_push; + + /* True if we should print the source line with a caret indicating + the location. */ + bool show_caret; + + /* Maximum width of the source line printed. */ + int caret_max_width; + + /* Character used for caret diagnostics. */ + char caret_chars[rich_location::STATICALLY_ALLOCATED_RANGES]; + + /* True if we should print the command line option which controls + each diagnostic, if known. */ + bool show_option_requested; + + /* True if we should raise a SIGABRT on errors. */ + bool abort_on_error; + + /* True if we should show the column number on diagnostics. */ + bool show_column; + + /* True if pedwarns are errors. */ + bool pedantic_errors; + + /* True if permerrors are warnings. */ + bool permissive; + + /* The index of the option to associate with turning permerrors into + warnings. */ + int opt_permissive; + + /* True if errors are fatal. */ + bool fatal_errors; + + /* True if all warnings should be disabled. */ + bool dc_inhibit_warnings; + + /* True if warnings should be given in system headers. */ + bool dc_warn_system_headers; + + /* Maximum number of errors to report. */ + int max_errors; + + /* This function is called before any message is printed out. It is + responsible for preparing message prefix and such. For example, it + might say: + In file included from "/usr/local/include/curses.h:5: + from "/home/gdr/src/nifty_printer.h:56: + ... + */ + diagnostic_starter_fn begin_diagnostic; + + /* This function is called by diagnostic_show_locus in between + disjoint spans of source code, so that the context can print + something to indicate that a new span of source code has begun. */ + diagnostic_start_span_fn start_span; + + /* This function is called after the diagnostic message is printed. */ + diagnostic_finalizer_fn end_diagnostic; + + /* Client hook to report an internal error. */ + void (*internal_error) (diagnostic_context *, const char *, va_list *); + + /* Client hook to say whether the option controlling a diagnostic is + enabled. Returns nonzero if enabled, zero if disabled. */ + int (*option_enabled) (int, void *); + + /* Client information to pass as second argument to + option_enabled. */ + void *option_state; + + /* Client hook to return the name of an option that controls a + diagnostic. Returns malloced memory. The first diagnostic_t + argument is the kind of diagnostic before any reclassification + (of warnings as errors, etc.); the second is the kind after any + reclassification. May return NULL if no name is to be printed. + May be passed 0 as well as the index of a particular option. */ + char *(*option_name) (diagnostic_context *, int, diagnostic_t, diagnostic_t); + + /* Auxiliary data for client. */ + void *x_data; + + /* Used to detect that the last caret was printed at the same location. */ + location_t last_location; + + /* Used to detect when the input file stack has changed since last + described. */ + const struct line_map *last_module; + + int lock; + + bool inhibit_notes_p; + + /* When printing source code, should the characters at carets and ranges + be colorized? (assuming colorization is on at all). + This should be true for frontends that generate range information + (so that the ranges of code are colorized), + and false for frontends that merely specify points within the + source code (to avoid e.g. colorizing just the first character in + a token, which would look strange). */ + bool colorize_source_p; + + /* Usable by plugins; if true, print a debugging ruler above the + source output. */ + bool show_ruler_p; + + /* If true, print fixits in machine-parseable form after the + rest of the diagnostic. */ + bool parseable_fixits_p; + + /* If non-NULL, an edit_context to which fix-it hints should be + applied, for generating patches. */ + edit_context *edit_context_ptr; +}; + +static inline void +diagnostic_inhibit_notes (diagnostic_context * context) +{ + context->inhibit_notes_p = true; +} + + +/* Client supplied function to announce a diagnostic. */ +#define diagnostic_starter(DC) (DC)->begin_diagnostic + +/* Client supplied function called after a diagnostic message is + displayed. */ +#define diagnostic_finalizer(DC) (DC)->end_diagnostic + +/* Extension hooks for client. */ +#define diagnostic_context_auxiliary_data(DC) (DC)->x_data +#define diagnostic_info_auxiliary_data(DI) (DI)->x_data + +/* Same as pp_format_decoder. Works on 'diagnostic_context *'. */ +#define diagnostic_format_decoder(DC) ((DC)->printer->format_decoder) + +/* Same as output_prefixing_rule. Works on 'diagnostic_context *'. */ +#define diagnostic_prefixing_rule(DC) ((DC)->printer->wrapping.rule) + +/* True if the last module or file in which a diagnostic was reported is + different from the current one. */ +#define diagnostic_last_module_changed(DC, MAP) \ + ((DC)->last_module != MAP) + +/* Remember the current module or file as being the last one in which we + report a diagnostic. */ +#define diagnostic_set_last_module(DC, MAP) \ + (DC)->last_module = MAP + +/* Raise SIGABRT on any diagnostic of severity DK_ERROR or higher. */ +#define diagnostic_abort_on_error(DC) \ + (DC)->abort_on_error = true + +/* This diagnostic_context is used by front-ends that directly output + diagnostic messages without going through `error', `warning', + and similar functions. */ +extern diagnostic_context *global_dc; + +/* The total count of a KIND of diagnostics emitted so far. */ +#define diagnostic_kind_count(DC, DK) (DC)->diagnostic_count[(int) (DK)] + +/* The number of errors that have been issued so far. Ideally, these + would take a diagnostic_context as an argument. */ +#define errorcount diagnostic_kind_count (global_dc, DK_ERROR) +/* Similarly, but for warnings. */ +#define warningcount diagnostic_kind_count (global_dc, DK_WARNING) +/* Similarly, but for warnings promoted to errors. */ +#define werrorcount diagnostic_kind_count (global_dc, DK_WERROR) +/* Similarly, but for sorrys. */ +#define sorrycount diagnostic_kind_count (global_dc, DK_SORRY) + +/* Returns nonzero if warnings should be emitted. */ +#define diagnostic_report_warnings_p(DC, LOC) \ + (!(DC)->dc_inhibit_warnings \ + && !(in_system_header_at (LOC) && !(DC)->dc_warn_system_headers)) + +#define report_diagnostic(D) diagnostic_report_diagnostic (global_dc, D) + +/* Override the option index to be used for reporting a + diagnostic. */ +#define diagnostic_override_option_index(DI, OPTIDX) \ + ((DI)->option_index = (OPTIDX)) + +/* Diagnostic related functions. */ +extern void diagnostic_initialize (diagnostic_context *, int); +extern void diagnostic_color_init (diagnostic_context *, int value = -1); +extern void diagnostic_finish (diagnostic_context *); +extern void diagnostic_report_current_module (diagnostic_context *, location_t); +extern void diagnostic_show_locus (diagnostic_context *, + rich_location *richloc, + diagnostic_t diagnostic_kind); + +/* Force diagnostics controlled by OPTIDX to be kind KIND. */ +extern diagnostic_t diagnostic_classify_diagnostic (diagnostic_context *, + int /* optidx */, + diagnostic_t /* kind */, + location_t); +extern void diagnostic_push_diagnostics (diagnostic_context *, location_t); +extern void diagnostic_pop_diagnostics (diagnostic_context *, location_t); +extern bool diagnostic_report_diagnostic (diagnostic_context *, + diagnostic_info *); +#ifdef ATTRIBUTE_GCC_DIAG +extern void diagnostic_set_info (diagnostic_info *, const char *, va_list *, + rich_location *, diagnostic_t) ATTRIBUTE_GCC_DIAG(2,0); +extern void diagnostic_set_info_translated (diagnostic_info *, const char *, + va_list *, rich_location *, + diagnostic_t) + ATTRIBUTE_GCC_DIAG(2,0); +extern void diagnostic_append_note (diagnostic_context *, location_t, + const char *, ...) ATTRIBUTE_GCC_DIAG(3,4); +#endif +extern char *diagnostic_build_prefix (diagnostic_context *, const diagnostic_info *); +void default_diagnostic_starter (diagnostic_context *, diagnostic_info *); +void default_diagnostic_start_span_fn (diagnostic_context *, + expanded_location); +void default_diagnostic_finalizer (diagnostic_context *, diagnostic_info *); +void diagnostic_set_caret_max_width (diagnostic_context *context, int value); +void diagnostic_action_after_output (diagnostic_context *, diagnostic_t); +void diagnostic_check_max_errors (diagnostic_context *, bool flush = false); + +void diagnostic_file_cache_fini (void); + +int get_terminal_width (void); + +/* Return the location associated to this diagnostic. Parameter WHICH + specifies which location. By default, expand the first one. */ + +static inline location_t +diagnostic_location (const diagnostic_info * diagnostic, int which = 0) +{ + return diagnostic->message.get_location (which); +} + +/* Return the number of locations to be printed in DIAGNOSTIC. */ + +static inline unsigned int +diagnostic_num_locations (const diagnostic_info * diagnostic) +{ + return diagnostic->message.m_richloc->get_num_locations (); +} + +/* Expand the location of this diagnostic. Use this function for + consistency. Parameter WHICH specifies which location. By default, + expand the first one. */ + +static inline expanded_location +diagnostic_expand_location (const diagnostic_info * diagnostic, int which = 0) +{ + return diagnostic->richloc->get_expanded_location (which); +} + +/* This is somehow the right-side margin of a caret line, that is, we + print at least these many characters after the position pointed at + by the caret. */ +#define CARET_LINE_MARGIN 10 + +/* Return true if the two locations can be represented within the same + caret line. This is used to build a prefix and also to determine + whether to print one or two caret lines. */ + +static inline bool +diagnostic_same_line (const diagnostic_context *context, + expanded_location s1, expanded_location s2) +{ + return s2.column && s1.line == s2.line + && context->caret_max_width - CARET_LINE_MARGIN > abs (s1.column - s2.column); +} + +extern const char *diagnostic_get_color_for_kind (diagnostic_t kind); + +/* Pure text formatting support functions. */ +extern char *file_name_as_prefix (diagnostic_context *, const char *); + +extern char *build_message_string (const char *, ...) ATTRIBUTE_PRINTF_1; + + +#endif /* ! GCC_DIAGNOSTIC_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dojump.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dojump.h new file mode 100644 index 0000000..00d66a7 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dojump.h @@ -0,0 +1,81 @@ +/* Export function prototypes from dojump.c. + Copyright (C) 2015-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_DOJUMP_H +#define GCC_DOJUMP_H + +/* At the start of a function, record that we have no previously-pushed + arguments waiting to be popped. */ +extern void init_pending_stack_adjust (void); + +/* Discard any pending stack adjustment. */ +extern void discard_pending_stack_adjust (void); + +/* When exiting from function, if safe, clear out any pending stack adjust + so the adjustment won't get done. */ +extern void clear_pending_stack_adjust (void); + +/* Pop any previously-pushed arguments that have not been popped yet. */ +extern void do_pending_stack_adjust (void); + +/* Struct for saving/restoring of pending_stack_adjust/stack_pointer_delta + values. */ + +struct saved_pending_stack_adjust +{ + /* Saved value of pending_stack_adjust. */ + int x_pending_stack_adjust; + + /* Saved value of stack_pointer_delta. */ + int x_stack_pointer_delta; +}; + +/* Remember pending_stack_adjust/stack_pointer_delta. + To be used around code that may call do_pending_stack_adjust (), + but the generated code could be discarded e.g. using delete_insns_since. */ + +extern void save_pending_stack_adjust (saved_pending_stack_adjust *); + +/* Restore the saved pending_stack_adjust/stack_pointer_delta. */ + +extern void restore_pending_stack_adjust (saved_pending_stack_adjust *); + +/* Generate code to evaluate EXP and jump to LABEL if the value is zero. */ +extern void jumpifnot (tree exp, rtx_code_label *label, int prob); +extern void jumpifnot_1 (enum tree_code, tree, tree, rtx_code_label *, int); + +/* Generate code to evaluate EXP and jump to LABEL if the value is nonzero. */ +extern void jumpif (tree exp, rtx_code_label *label, int prob); +extern void jumpif_1 (enum tree_code, tree, tree, rtx_code_label *, int); + +/* Generate code to evaluate EXP and jump to IF_FALSE_LABEL if + the result is zero, or IF_TRUE_LABEL if the result is one. */ +extern void do_jump (tree exp, rtx_code_label *if_false_label, + rtx_code_label *if_true_label, int prob); +extern void do_jump_1 (enum tree_code, tree, tree, rtx_code_label *, + rtx_code_label *, int); + +extern void do_compare_rtx_and_jump (rtx, rtx, enum rtx_code, int, + machine_mode, rtx, rtx_code_label *, + rtx_code_label *, int); + +extern bool split_comparison (enum rtx_code, machine_mode, + enum rtx_code *, enum rtx_code *); + +#endif /* GCC_DOJUMP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dominance.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dominance.h new file mode 100644 index 0000000..1de43ee --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dominance.h @@ -0,0 +1,94 @@ +/* Calculate (post)dominators header file. + Copyright (C) 2014-2017 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#ifndef GCC_DOMINANCE_H +#define GCC_DOMINANCE_H + +enum cdi_direction +{ + CDI_DOMINATORS = 1, + CDI_POST_DOMINATORS = 2 +}; + +/* State of dominance information. */ + +enum dom_state +{ + DOM_NONE, /* Not computed at all. */ + DOM_NO_FAST_QUERY, /* The data is OK, but the fast query data are not usable. */ + DOM_OK /* Everything is ok. */ +}; + +extern void calculate_dominance_info (enum cdi_direction); +extern void calculate_dominance_info_for_region (enum cdi_direction, + vec); +extern void free_dominance_info (function *, enum cdi_direction); +extern void free_dominance_info (enum cdi_direction); +extern void free_dominance_info_for_region (function *, + enum cdi_direction, + vec); +extern basic_block get_immediate_dominator (enum cdi_direction, basic_block); +extern void set_immediate_dominator (enum cdi_direction, basic_block, + basic_block); +extern vec get_dominated_by (enum cdi_direction, basic_block); +extern vec get_dominated_by_region (enum cdi_direction, + basic_block *, + unsigned); +extern vec get_dominated_to_depth (enum cdi_direction, + basic_block, int); +extern vec get_all_dominated_blocks (enum cdi_direction, + basic_block); +extern void redirect_immediate_dominators (enum cdi_direction, basic_block, + basic_block); +extern basic_block nearest_common_dominator (enum cdi_direction, + basic_block, basic_block); +extern basic_block nearest_common_dominator_for_set (enum cdi_direction, + bitmap); +extern bool dominated_by_p (enum cdi_direction, const_basic_block, + const_basic_block); +unsigned bb_dom_dfs_in (enum cdi_direction, basic_block); +unsigned bb_dom_dfs_out (enum cdi_direction, basic_block); +extern void verify_dominators (enum cdi_direction); + +/* Verify invariants of computed dominance information, if internal consistency + checks are enabled. */ + +static inline void +checking_verify_dominators (cdi_direction dir) +{ + if (flag_checking) + verify_dominators (dir); +} + +basic_block recompute_dominator (enum cdi_direction, basic_block); +extern void iterate_fix_dominators (enum cdi_direction, + vec , bool); +extern void add_to_dominance_info (enum cdi_direction, basic_block); +extern void delete_from_dominance_info (enum cdi_direction, basic_block); +extern basic_block first_dom_son (enum cdi_direction, basic_block); +extern basic_block next_dom_son (enum cdi_direction, basic_block); +extern enum dom_state dom_info_state (function *, enum cdi_direction); +extern enum dom_state dom_info_state (enum cdi_direction); +extern void set_dom_info_availability (enum cdi_direction, enum dom_state); +extern bool dom_info_available_p (function *, enum cdi_direction); +extern bool dom_info_available_p (enum cdi_direction); + + + +#endif /* GCC_DOMINANCE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/domwalk.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/domwalk.h new file mode 100644 index 0000000..bbb9afc --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/domwalk.h @@ -0,0 +1,77 @@ +/* Generic dominator tree walker + Copyright (C) 2003-2017 Free Software Foundation, Inc. + Contributed by Diego Novillo + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_DOM_WALK_H +#define GCC_DOM_WALK_H + +/** + * This is the main class for the dominator walker. It is expected that + * consumers will have a custom class inheriting from it, which will over ride + * at least one of before_dom_children and after_dom_children to implement the + * custom behavior. + */ +class dom_walker +{ +public: + /* Use SKIP_UNREACHBLE_BLOCKS = true when your client can discover + that some edges are not executable. + + If a client can discover that a COND, SWITCH or GOTO has a static + target in the before_dom_children callback, the taken edge should + be returned. The generic walker will clear EDGE_EXECUTABLE on all + edges it can determine are not executable. */ + dom_walker (cdi_direction direction, bool skip_unreachable_blocks = false); + + /* Walk the dominator tree. */ + void walk (basic_block); + + /* Function to call before the recursive walk of the dominator children. + + Return value is the always taken edge if the block has multiple outgoing + edges, NULL otherwise. When skipping unreachable blocks, the walker + uses the taken edge information to clear EDGE_EXECUTABLE on the other + edges, exposing unreachable blocks. A NULL return value means all + outgoing edges should still be considered executable. */ + virtual edge before_dom_children (basic_block) { return NULL; } + + /* Function to call after the recursive walk of the dominator children. */ + virtual void after_dom_children (basic_block) {} + +private: + /* This is the direction of the dominator tree we want to walk. i.e., + if it is set to CDI_DOMINATORS, then we walk the dominator tree, + if it is set to CDI_POST_DOMINATORS, then we walk the post + dominator tree. */ + const ENUM_BITFIELD (cdi_direction) m_dom_direction : 2; + bool m_skip_unreachable_blocks; + basic_block m_unreachable_dom; + + /* Query whether or not the given block is reachable or not. */ + bool bb_reachable (struct function *, basic_block); + + /* Given an unreachable block, propagate that property to outgoing + and possibly incoming edges for the block. Typically called after + determining a block is unreachable in the before_dom_children + callback. */ + void propagate_unreachable_to_edges (basic_block, FILE *, int); + +}; + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/double-int.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/double-int.h new file mode 100644 index 0000000..2c70bb5 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/double-int.h @@ -0,0 +1,470 @@ +/* Operations with long integers. + Copyright (C) 2006-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3, or (at your option) any +later version. + +GCC is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef DOUBLE_INT_H +#define DOUBLE_INT_H + +/* A large integer is currently represented as a pair of HOST_WIDE_INTs. + It therefore represents a number with precision of + 2 * HOST_BITS_PER_WIDE_INT bits (it is however possible that the + internal representation will change, if numbers with greater precision + are needed, so the users should not rely on it). The representation does + not contain any information about signedness of the represented value, so + it can be used to represent both signed and unsigned numbers. For + operations where the results depend on signedness (division, comparisons), + it must be specified separately. For each such operation, there are three + versions of the function -- double_int_op, that takes an extra UNS argument + giving the signedness of the values, and double_int_sop and double_int_uop + that stand for its specializations for signed and unsigned values. + + You may also represent with numbers in smaller precision using double_int. + You however need to use double_int_ext (that fills in the bits of the + number over the prescribed precision with zeros or with the sign bit) before + operations that do not perform arithmetics modulo 2^precision (comparisons, + division), and possibly before storing the results, if you want to keep + them in some canonical form). In general, the signedness of double_int_ext + should match the signedness of the operation. + + ??? The components of double_int differ in signedness mostly for + historical reasons (they replace an older structure used to represent + numbers with precision higher than HOST_WIDE_INT). It might be less + confusing to have them both signed or both unsigned. */ + +struct double_int +{ + /* Normally, we would define constructors to create instances. + Two things prevent us from doing so. + First, defining a constructor makes the class non-POD in C++03, + and we certainly want double_int to be a POD. + Second, the GCC conding conventions prefer explicit conversion, + and explicit conversion operators are not available until C++11. */ + + static double_int from_uhwi (unsigned HOST_WIDE_INT cst); + static double_int from_shwi (HOST_WIDE_INT cst); + static double_int from_pair (HOST_WIDE_INT high, unsigned HOST_WIDE_INT low); + + /* Construct from a fuffer of length LEN. BUFFER will be read according + to byte endianness and word endianness. */ + static double_int from_buffer (const unsigned char *buffer, int len); + + /* No copy assignment operator or destructor to keep the type a POD. */ + + /* There are some special value-creation static member functions. */ + + static double_int mask (unsigned prec); + static double_int max_value (unsigned int prec, bool uns); + static double_int min_value (unsigned int prec, bool uns); + + /* The following functions are mutating operations. */ + + double_int &operator ++ (); // prefix + double_int &operator -- (); // prefix + double_int &operator *= (double_int); + double_int &operator += (double_int); + double_int &operator -= (double_int); + double_int &operator &= (double_int); + double_int &operator ^= (double_int); + double_int &operator |= (double_int); + + /* The following functions are non-mutating operations. */ + + /* Conversion functions. */ + + HOST_WIDE_INT to_shwi () const; + unsigned HOST_WIDE_INT to_uhwi () const; + + /* Conversion query functions. */ + + bool fits_uhwi () const; + bool fits_shwi () const; + bool fits_hwi (bool uns) const; + + /* Attribute query functions. */ + + int trailing_zeros () const; + int popcount () const; + + /* Arithmetic query operations. */ + + bool multiple_of (double_int, bool, double_int *) const; + + /* Arithmetic operation functions. */ + + /* The following operations perform arithmetics modulo 2^precision, so you + do not need to call .ext between them, even if you are representing + numbers with precision less than HOST_BITS_PER_DOUBLE_INT bits. */ + + double_int set_bit (unsigned) const; + double_int mul_with_sign (double_int, bool unsigned_p, bool *overflow) const; + double_int wide_mul_with_sign (double_int, bool unsigned_p, + double_int *higher, bool *overflow) const; + double_int add_with_sign (double_int, bool unsigned_p, bool *overflow) const; + double_int sub_with_overflow (double_int, bool *overflow) const; + double_int neg_with_overflow (bool *overflow) const; + + double_int operator * (double_int) const; + double_int operator + (double_int) const; + double_int operator - (double_int) const; + double_int operator - () const; + double_int operator ~ () const; + double_int operator & (double_int) const; + double_int operator | (double_int) const; + double_int operator ^ (double_int) const; + double_int and_not (double_int) const; + + double_int lshift (HOST_WIDE_INT count) const; + double_int lshift (HOST_WIDE_INT count, unsigned int prec, bool arith) const; + double_int rshift (HOST_WIDE_INT count) const; + double_int rshift (HOST_WIDE_INT count, unsigned int prec, bool arith) const; + double_int alshift (HOST_WIDE_INT count, unsigned int prec) const; + double_int arshift (HOST_WIDE_INT count, unsigned int prec) const; + double_int llshift (HOST_WIDE_INT count, unsigned int prec) const; + double_int lrshift (HOST_WIDE_INT count, unsigned int prec) const; + double_int lrotate (HOST_WIDE_INT count, unsigned int prec) const; + double_int rrotate (HOST_WIDE_INT count, unsigned int prec) const; + + /* You must ensure that double_int::ext is called on the operands + of the following operations, if the precision of the numbers + is less than HOST_BITS_PER_DOUBLE_INT bits. */ + + double_int div (double_int, bool, unsigned) const; + double_int sdiv (double_int, unsigned) const; + double_int udiv (double_int, unsigned) const; + double_int mod (double_int, bool, unsigned) const; + double_int smod (double_int, unsigned) const; + double_int umod (double_int, unsigned) const; + double_int divmod_with_overflow (double_int, bool, unsigned, + double_int *, bool *) const; + double_int divmod (double_int, bool, unsigned, double_int *) const; + double_int sdivmod (double_int, unsigned, double_int *) const; + double_int udivmod (double_int, unsigned, double_int *) const; + + /* Precision control functions. */ + + double_int ext (unsigned prec, bool uns) const; + double_int zext (unsigned prec) const; + double_int sext (unsigned prec) const; + + /* Comparative functions. */ + + bool is_zero () const; + bool is_one () const; + bool is_minus_one () const; + bool is_negative () const; + + int cmp (double_int b, bool uns) const; + int ucmp (double_int b) const; + int scmp (double_int b) const; + + bool ult (double_int b) const; + bool ule (double_int b) const; + bool ugt (double_int b) const; + bool slt (double_int b) const; + bool sle (double_int b) const; + bool sgt (double_int b) const; + + double_int max (double_int b, bool uns); + double_int smax (double_int b); + double_int umax (double_int b); + + double_int min (double_int b, bool uns); + double_int smin (double_int b); + double_int umin (double_int b); + + bool operator == (double_int cst2) const; + bool operator != (double_int cst2) const; + + /* Please migrate away from using these member variables publicly. */ + + unsigned HOST_WIDE_INT low; + HOST_WIDE_INT high; + +}; + +#define HOST_BITS_PER_DOUBLE_INT (2 * HOST_BITS_PER_WIDE_INT) + +/* Constructors and conversions. */ + +/* Constructs double_int from integer CST. The bits over the precision of + HOST_WIDE_INT are filled with the sign bit. */ + +inline double_int +double_int::from_shwi (HOST_WIDE_INT cst) +{ + double_int r; + r.low = (unsigned HOST_WIDE_INT) cst; + r.high = cst < 0 ? -1 : 0; + return r; +} + +/* Some useful constants. */ +/* FIXME(crowl): Maybe remove after converting callers? + The problem is that a named constant would not be as optimizable, + while the functional syntax is more verbose. */ + +#define double_int_minus_one (double_int::from_shwi (-1)) +#define double_int_zero (double_int::from_shwi (0)) +#define double_int_one (double_int::from_shwi (1)) +#define double_int_two (double_int::from_shwi (2)) +#define double_int_ten (double_int::from_shwi (10)) + +/* Constructs double_int from unsigned integer CST. The bits over the + precision of HOST_WIDE_INT are filled with zeros. */ + +inline double_int +double_int::from_uhwi (unsigned HOST_WIDE_INT cst) +{ + double_int r; + r.low = cst; + r.high = 0; + return r; +} + +inline double_int +double_int::from_pair (HOST_WIDE_INT high, unsigned HOST_WIDE_INT low) +{ + double_int r; + r.low = low; + r.high = high; + return r; +} + +inline double_int & +double_int::operator ++ () +{ + *this += double_int_one; + return *this; +} + +inline double_int & +double_int::operator -- () +{ + *this -= double_int_one; + return *this; +} + +inline double_int & +double_int::operator &= (double_int b) +{ + *this = *this & b; + return *this; +} + +inline double_int & +double_int::operator ^= (double_int b) +{ + *this = *this ^ b; + return *this; +} + +inline double_int & +double_int::operator |= (double_int b) +{ + *this = *this | b; + return *this; +} + +/* Returns value of CST as a signed number. CST must satisfy + double_int::fits_signed. */ + +inline HOST_WIDE_INT +double_int::to_shwi () const +{ + return (HOST_WIDE_INT) low; +} + +/* Returns value of CST as an unsigned number. CST must satisfy + double_int::fits_unsigned. */ + +inline unsigned HOST_WIDE_INT +double_int::to_uhwi () const +{ + return low; +} + +/* Returns true if CST fits in unsigned HOST_WIDE_INT. */ + +inline bool +double_int::fits_uhwi () const +{ + return high == 0; +} + +/* Logical operations. */ + +/* Returns ~A. */ + +inline double_int +double_int::operator ~ () const +{ + double_int result; + result.low = ~low; + result.high = ~high; + return result; +} + +/* Returns A | B. */ + +inline double_int +double_int::operator | (double_int b) const +{ + double_int result; + result.low = low | b.low; + result.high = high | b.high; + return result; +} + +/* Returns A & B. */ + +inline double_int +double_int::operator & (double_int b) const +{ + double_int result; + result.low = low & b.low; + result.high = high & b.high; + return result; +} + +/* Returns A & ~B. */ + +inline double_int +double_int::and_not (double_int b) const +{ + double_int result; + result.low = low & ~b.low; + result.high = high & ~b.high; + return result; +} + +/* Returns A ^ B. */ + +inline double_int +double_int::operator ^ (double_int b) const +{ + double_int result; + result.low = low ^ b.low; + result.high = high ^ b.high; + return result; +} + +void dump_double_int (FILE *, double_int, bool); + +#define ALL_ONES HOST_WIDE_INT_M1U + +/* The operands of the following comparison functions must be processed + with double_int_ext, if their precision is less than + HOST_BITS_PER_DOUBLE_INT bits. */ + +/* Returns true if CST is zero. */ + +inline bool +double_int::is_zero () const +{ + return low == 0 && high == 0; +} + +/* Returns true if CST is one. */ + +inline bool +double_int::is_one () const +{ + return low == 1 && high == 0; +} + +/* Returns true if CST is minus one. */ + +inline bool +double_int::is_minus_one () const +{ + return low == ALL_ONES && high == -1; +} + +/* Returns true if CST is negative. */ + +inline bool +double_int::is_negative () const +{ + return high < 0; +} + +/* Returns true if CST1 == CST2. */ + +inline bool +double_int::operator == (double_int cst2) const +{ + return low == cst2.low && high == cst2.high; +} + +/* Returns true if CST1 != CST2. */ + +inline bool +double_int::operator != (double_int cst2) const +{ + return low != cst2.low || high != cst2.high; +} + +/* Return number of set bits of CST. */ + +inline int +double_int::popcount () const +{ + return popcount_hwi (high) + popcount_hwi (low); +} + + +#ifndef GENERATOR_FILE +/* Conversion to and from GMP integer representations. */ + +void mpz_set_double_int (mpz_t, double_int, bool); +double_int mpz_get_double_int (const_tree, mpz_t, bool); +#endif + +namespace wi +{ + template <> + struct int_traits + { + static const enum precision_type precision_type = CONST_PRECISION; + static const bool host_dependent_precision = true; + static const unsigned int precision = HOST_BITS_PER_DOUBLE_INT; + static unsigned int get_precision (const double_int &); + static wi::storage_ref decompose (HOST_WIDE_INT *, unsigned int, + const double_int &); + }; +} + +inline unsigned int +wi::int_traits ::get_precision (const double_int &) +{ + return precision; +} + +inline wi::storage_ref +wi::int_traits ::decompose (HOST_WIDE_INT *scratch, unsigned int p, + const double_int &x) +{ + gcc_checking_assert (precision == p); + scratch[0] = x.low; + if ((x.high == 0 && scratch[0] >= 0) || (x.high == -1 && scratch[0] < 0)) + return wi::storage_ref (scratch, 1, precision); + scratch[1] = x.high; + return wi::storage_ref (scratch, 2, precision); +} + +#endif /* DOUBLE_INT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dumpfile.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dumpfile.h new file mode 100644 index 0000000..fef58f5 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dumpfile.h @@ -0,0 +1,262 @@ +/* Definitions for the shared dumpfile. + Copyright (C) 2004-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + + +#ifndef GCC_DUMPFILE_H +#define GCC_DUMPFILE_H 1 + + +/* Different tree dump places. When you add new tree dump places, + extend the DUMP_FILES array in dumpfile.c. */ +enum tree_dump_index +{ + TDI_none, /* No dump */ + TDI_cgraph, /* dump function call graph. */ + TDI_inheritance, /* dump type inheritance graph. */ + TDI_clones, /* dump IPA cloning decisions. */ + TDI_tu, /* dump the whole translation unit. */ + TDI_class, /* dump class hierarchy. */ + TDI_original, /* dump each function before optimizing it */ + TDI_generic, /* dump each function after genericizing it */ + TDI_nested, /* dump each function after unnesting it */ + TDI_tree_all, /* enable all the GENERIC/GIMPLE dumps. */ + TDI_rtl_all, /* enable all the RTL dumps. */ + TDI_ipa_all, /* enable all the IPA dumps. */ + + TDI_end +}; + +/* Bit masks to control dumping. Not all values are applicable to all + dumps. Add new ones at the end. When you define new values, extend + the DUMP_OPTIONS array in dumpfile.c. The TDF_* flags coexist with + MSG_* flags (for -fopt-info) and the bit values must be chosen to + allow that. */ +#define TDF_ADDRESS (1 << 0) /* dump node addresses */ +#define TDF_SLIM (1 << 1) /* don't go wild following links */ +#define TDF_RAW (1 << 2) /* don't unparse the function */ +#define TDF_DETAILS (1 << 3) /* show more detailed info about + each pass */ +#define TDF_STATS (1 << 4) /* dump various statistics about + each pass */ +#define TDF_BLOCKS (1 << 5) /* display basic block boundaries */ +#define TDF_VOPS (1 << 6) /* display virtual operands */ +#define TDF_LINENO (1 << 7) /* display statement line numbers */ +#define TDF_UID (1 << 8) /* display decl UIDs */ + +#define TDF_TREE (1 << 9) /* is a tree dump */ +#define TDF_RTL (1 << 10) /* is a RTL dump */ +#define TDF_IPA (1 << 11) /* is an IPA dump */ +#define TDF_STMTADDR (1 << 12) /* Address of stmt. */ + +#define TDF_GRAPH (1 << 13) /* a graph dump is being emitted */ +#define TDF_MEMSYMS (1 << 14) /* display memory symbols in expr. + Implies TDF_VOPS. */ + +#define TDF_DIAGNOSTIC (1 << 15) /* A dump to be put in a diagnostic + message. */ +#define TDF_VERBOSE (1 << 16) /* A dump that uses the full tree + dumper to print stmts. */ +#define TDF_RHS_ONLY (1 << 17) /* a flag to only print the RHS of + a gimple stmt. */ +#define TDF_ASMNAME (1 << 18) /* display asm names of decls */ +#define TDF_EH (1 << 19) /* display EH region number + holding this gimple statement. */ +#define TDF_NOUID (1 << 20) /* omit UIDs from dumps. */ +#define TDF_ALIAS (1 << 21) /* display alias information */ +#define TDF_ENUMERATE_LOCALS (1 << 22) /* Enumerate locals by uid. */ +#define TDF_CSELIB (1 << 23) /* Dump cselib details. */ +#define TDF_SCEV (1 << 24) /* Dump SCEV details. */ +#define TDF_COMMENT (1 << 25) /* Dump lines with prefix ";;" */ +#define TDF_GIMPLE (1 << 26) /* Dump in GIMPLE FE syntax */ +#define MSG_OPTIMIZED_LOCATIONS (1 << 27) /* -fopt-info optimized sources */ +#define MSG_MISSED_OPTIMIZATION (1 << 28) /* missed opportunities */ +#define MSG_NOTE (1 << 29) /* general optimization info */ +#define MSG_ALL (MSG_OPTIMIZED_LOCATIONS | MSG_MISSED_OPTIMIZATION \ + | MSG_NOTE) + + +/* Flags to control high-level -fopt-info dumps. Usually these flags + define a group of passes. An optimization pass can be part of + multiple groups. */ +#define OPTGROUP_NONE (0) +#define OPTGROUP_IPA (1 << 1) /* IPA optimization passes */ +#define OPTGROUP_LOOP (1 << 2) /* Loop optimization passes */ +#define OPTGROUP_INLINE (1 << 3) /* Inlining passes */ +#define OPTGROUP_OMP (1 << 4) /* OMP (Offloading and Multi + Processing) transformations */ +#define OPTGROUP_VEC (1 << 5) /* Vectorization passes */ +#define OPTGROUP_OTHER (1 << 6) /* All other passes */ +#define OPTGROUP_ALL (OPTGROUP_IPA | OPTGROUP_LOOP | OPTGROUP_INLINE \ + | OPTGROUP_OMP | OPTGROUP_VEC | OPTGROUP_OTHER) + +/* Define a tree dump switch. */ +struct dump_file_info +{ + const char *suffix; /* suffix to give output file. */ + const char *swtch; /* command line dump switch */ + const char *glob; /* command line glob */ + const char *pfilename; /* filename for the pass-specific stream */ + const char *alt_filename; /* filename for the -fopt-info stream */ + FILE *pstream; /* pass-specific dump stream */ + FILE *alt_stream; /* -fopt-info stream */ + int pflags; /* dump flags */ + int optgroup_flags; /* optgroup flags for -fopt-info */ + int alt_flags; /* flags for opt-info */ + int pstate; /* state of pass-specific stream */ + int alt_state; /* state of the -fopt-info stream */ + int num; /* dump file number */ + bool owns_strings; /* fields "suffix", "swtch", "glob" can be + const strings, or can be dynamically + allocated, needing free. */ + bool graph_dump_initialized; /* When a given dump file is being initialized, + this flag is set to true if the corresponding + TDF_graph dump file has also been + initialized. */ +}; + +/* In dumpfile.c */ +extern FILE *dump_begin (int, int *); +extern void dump_end (int, FILE *); +extern int opt_info_switch_p (const char *); +extern const char *dump_flag_name (int); +extern void dump_printf (int, const char *, ...) ATTRIBUTE_PRINTF_2; +extern void dump_printf_loc (int, source_location, + const char *, ...) ATTRIBUTE_PRINTF_3; +extern void dump_basic_block (int, basic_block, int); +extern void dump_generic_expr_loc (int, source_location, int, tree); +extern void dump_generic_expr (int, int, tree); +extern void dump_gimple_stmt_loc (int, source_location, int, gimple *, int); +extern void dump_gimple_stmt (int, int, gimple *, int); +extern void print_combine_total_stats (void); +extern bool enable_rtl_dump_file (void); + +/* In tree-dump.c */ +extern void dump_node (const_tree, int, FILE *); + +/* In combine.c */ +extern void dump_combine_total_stats (FILE *); +/* In cfghooks.c */ +extern void dump_bb (FILE *, basic_block, int, int); + +/* Global variables used to communicate with passes. */ +extern FILE *dump_file; +extern FILE *alt_dump_file; +extern int dump_flags; +extern const char *dump_file_name; + +/* Return true if any of the dumps is enabled, false otherwise. */ +static inline bool +dump_enabled_p (void) +{ + return (dump_file || alt_dump_file); +} + +namespace gcc { + +class dump_manager +{ +public: + + dump_manager (); + ~dump_manager (); + + /* Register a dumpfile. + + TAKE_OWNERSHIP determines whether callee takes ownership of strings + SUFFIX, SWTCH, and GLOB. */ + unsigned int + dump_register (const char *suffix, const char *swtch, const char *glob, + int flags, int optgroup_flags, + bool take_ownership); + + /* Return the dump_file_info for the given phase. */ + struct dump_file_info * + get_dump_file_info (int phase) const; + + struct dump_file_info * + get_dump_file_info_by_switch (const char *swtch) const; + + /* Return the name of the dump file for the given phase. + If the dump is not enabled, returns NULL. */ + char * + get_dump_file_name (int phase) const; + + char * + get_dump_file_name (struct dump_file_info *dfi) const; + + int + dump_switch_p (const char *arg); + + /* Start a dump for PHASE. Store user-supplied dump flags in + *FLAG_PTR. Return the number of streams opened. Set globals + DUMP_FILE, and ALT_DUMP_FILE to point to the opened streams, and + set dump_flags appropriately for both pass dump stream and + -fopt-info stream. */ + int + dump_start (int phase, int *flag_ptr); + + /* Finish a tree dump for PHASE and close associated dump streams. Also + reset the globals DUMP_FILE, ALT_DUMP_FILE, and DUMP_FLAGS. */ + void + dump_finish (int phase); + + FILE * + dump_begin (int phase, int *flag_ptr); + + /* Returns nonzero if tree dump PHASE has been initialized. */ + int + dump_initialized_p (int phase) const; + + /* Returns the switch name of PHASE. */ + const char * + dump_flag_name (int phase) const; + +private: + + int + dump_phase_enabled_p (int phase) const; + + int + dump_switch_p_1 (const char *arg, struct dump_file_info *dfi, bool doglob); + + int + dump_enable_all (int flags, const char *filename); + + int + opt_info_enable_passes (int optgroup_flags, int flags, const char *filename); + +private: + + /* Dynamically registered dump files and switches. */ + int m_next_dump; + struct dump_file_info *m_extra_dump_files; + size_t m_extra_dump_files_in_use; + size_t m_extra_dump_files_alloced; + + /* Grant access to dump_enable_all. */ + friend bool ::enable_rtl_dump_file (void); + + /* Grant access to opt_info_enable_passes. */ + friend int ::opt_info_switch_p (const char *arg); + +}; // class dump_manager + +} // namespace gcc + +#endif /* GCC_DUMPFILE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dwarf2asm.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dwarf2asm.h new file mode 100644 index 0000000..7fc87a0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dwarf2asm.h @@ -0,0 +1,96 @@ +/* Dwarf2 assembler output helper routines. + Copyright (C) 2001-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_DWARF2ASM_H +#define GCC_DWARF2ASM_H + +extern void dw2_assemble_integer (int, rtx); + +extern void dw2_asm_output_data_raw (int, unsigned HOST_WIDE_INT); + +extern void dw2_asm_output_data (int, unsigned HOST_WIDE_INT, + const char *, ...) + ATTRIBUTE_NULL_PRINTF_3; + +extern void dw2_asm_output_delta (int, const char *, const char *, + const char *, ...) + ATTRIBUTE_NULL_PRINTF_4; + +extern void dw2_asm_output_vms_delta (int, const char *, const char *, + const char *, ...) + ATTRIBUTE_NULL_PRINTF_4; + +extern void dw2_asm_output_offset (int, const char *, section *, + const char *, ...) + ATTRIBUTE_NULL_PRINTF_4; + +extern void dw2_asm_output_offset (int, const char *, HOST_WIDE_INT, + section *, const char *, ...) + ATTRIBUTE_NULL_PRINTF_5; + +extern void dw2_asm_output_addr (int, const char *, const char *, ...) + ATTRIBUTE_NULL_PRINTF_3; + +extern void dw2_asm_output_addr_rtx (int, rtx, const char *, ...) + ATTRIBUTE_NULL_PRINTF_3; + +extern void dw2_asm_output_encoded_addr_rtx (int, rtx, bool, + const char *, ...) + ATTRIBUTE_NULL_PRINTF_4; + +extern void dw2_asm_output_nstring (const char *, size_t, + const char *, ...) + ATTRIBUTE_NULL_PRINTF_3; + +extern void dw2_asm_output_data_uleb128_raw (unsigned HOST_WIDE_INT); + +extern void dw2_asm_output_data_uleb128 (unsigned HOST_WIDE_INT, + const char *, ...) + ATTRIBUTE_NULL_PRINTF_2; + +extern void dw2_asm_output_data_sleb128_raw (HOST_WIDE_INT); + +extern void dw2_asm_output_data_sleb128 (HOST_WIDE_INT, + const char *, ...) + ATTRIBUTE_NULL_PRINTF_2; + +extern void dw2_asm_output_delta_uleb128 (const char *, const char *, + const char *, ...) + ATTRIBUTE_NULL_PRINTF_3; + +extern int size_of_uleb128 (unsigned HOST_WIDE_INT); +extern int size_of_sleb128 (HOST_WIDE_INT); +extern int size_of_encoded_value (int); +extern const char *eh_data_format_name (int); + +extern rtx dw2_force_const_mem (rtx, bool); +extern void dw2_output_indirect_constants (void); + +/* These are currently unused. */ + +#if 0 +extern void dw2_asm_output_pcrel (int, const char *, const char *, ...) + ATTRIBUTE_NULL_PRINTF_3; + +extern void dw2_asm_output_delta_sleb128 (const char *, const char *, + const char *, ...) + ATTRIBUTE_NULL_PRINTF_3; +#endif + +#endif /* GCC_DWARF2ASM_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dwarf2out.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dwarf2out.h new file mode 100644 index 0000000..9402473 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/dwarf2out.h @@ -0,0 +1,380 @@ +/* dwarf2out.h - Various declarations for functions found in dwarf2out.c + Copyright (C) 1998-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_DWARF2OUT_H +#define GCC_DWARF2OUT_H 1 + +#include "dwarf2.h" /* ??? Remove this once only used by dwarf2foo.c. */ + +typedef struct die_struct *dw_die_ref; +typedef const struct die_struct *const_dw_die_ref; + +typedef struct dw_val_node *dw_val_ref; +typedef struct dw_cfi_node *dw_cfi_ref; +typedef struct dw_loc_descr_node *dw_loc_descr_ref; +typedef struct dw_loc_list_struct *dw_loc_list_ref; +typedef struct dw_discr_list_node *dw_discr_list_ref; +typedef wide_int *wide_int_ptr; + + +/* Call frames are described using a sequence of Call Frame + Information instructions. The register number, offset + and address fields are provided as possible operands; + their use is selected by the opcode field. */ + +enum dw_cfi_oprnd_type { + dw_cfi_oprnd_unused, + dw_cfi_oprnd_reg_num, + dw_cfi_oprnd_offset, + dw_cfi_oprnd_addr, + dw_cfi_oprnd_loc +}; + +typedef union GTY(()) { + unsigned int GTY ((tag ("dw_cfi_oprnd_reg_num"))) dw_cfi_reg_num; + HOST_WIDE_INT GTY ((tag ("dw_cfi_oprnd_offset"))) dw_cfi_offset; + const char * GTY ((tag ("dw_cfi_oprnd_addr"))) dw_cfi_addr; + struct dw_loc_descr_node * GTY ((tag ("dw_cfi_oprnd_loc"))) dw_cfi_loc; +} dw_cfi_oprnd; + +struct GTY(()) dw_cfi_node { + enum dwarf_call_frame_info dw_cfi_opc; + dw_cfi_oprnd GTY ((desc ("dw_cfi_oprnd1_desc (%1.dw_cfi_opc)"))) + dw_cfi_oprnd1; + dw_cfi_oprnd GTY ((desc ("dw_cfi_oprnd2_desc (%1.dw_cfi_opc)"))) + dw_cfi_oprnd2; +}; + + +typedef vec *cfi_vec; + +typedef struct dw_fde_node *dw_fde_ref; + +/* All call frame descriptions (FDE's) in the GCC generated DWARF + refer to a single Common Information Entry (CIE), defined at + the beginning of the .debug_frame section. This use of a single + CIE obviates the need to keep track of multiple CIE's + in the DWARF generation routines below. */ + +struct GTY(()) dw_fde_node { + tree decl; + const char *dw_fde_begin; + const char *dw_fde_current_label; + const char *dw_fde_end; + const char *dw_fde_vms_end_prologue; + const char *dw_fde_vms_begin_epilogue; + const char *dw_fde_second_begin; + const char *dw_fde_second_end; + cfi_vec dw_fde_cfi; + int dw_fde_switch_cfi_index; /* Last CFI before switching sections. */ + HOST_WIDE_INT stack_realignment; + + unsigned funcdef_number; + unsigned fde_index; + + /* Dynamic realign argument pointer register. */ + unsigned int drap_reg; + /* Virtual dynamic realign argument pointer register. */ + unsigned int vdrap_reg; + /* These 3 flags are copied from rtl_data in function.h. */ + unsigned all_throwers_are_sibcalls : 1; + unsigned uses_eh_lsda : 1; + unsigned nothrow : 1; + /* Whether we did stack realign in this call frame. */ + unsigned stack_realign : 1; + /* Whether dynamic realign argument pointer register has been saved. */ + unsigned drap_reg_saved: 1; + /* True iff dw_fde_begin label is in text_section or cold_text_section. */ + unsigned in_std_section : 1; + /* True iff dw_fde_second_begin label is in text_section or + cold_text_section. */ + unsigned second_in_std_section : 1; +}; + + +/* This is how we define the location of the CFA. We use to handle it + as REG + OFFSET all the time, but now it can be more complex. + It can now be either REG + CFA_OFFSET or *(REG + BASE_OFFSET) + CFA_OFFSET. + Instead of passing around REG and OFFSET, we pass a copy + of this structure. */ +struct GTY(()) dw_cfa_location { + HOST_WIDE_INT offset; + HOST_WIDE_INT base_offset; + /* REG is in DWARF_FRAME_REGNUM space, *not* normal REGNO space. */ + unsigned int reg; + BOOL_BITFIELD indirect : 1; /* 1 if CFA is accessed via a dereference. */ + BOOL_BITFIELD in_use : 1; /* 1 if a saved cfa is stored here. */ +}; + + +/* Each DIE may have a series of attribute/value pairs. Values + can take on several forms. The forms that are used in this + implementation are listed below. */ + +enum dw_val_class +{ + dw_val_class_none, + dw_val_class_addr, + dw_val_class_offset, + dw_val_class_loc, + dw_val_class_loc_list, + dw_val_class_range_list, + dw_val_class_const, + dw_val_class_unsigned_const, + dw_val_class_const_double, + dw_val_class_wide_int, + dw_val_class_vec, + dw_val_class_flag, + dw_val_class_die_ref, + dw_val_class_fde_ref, + dw_val_class_lbl_id, + dw_val_class_lineptr, + dw_val_class_str, + dw_val_class_macptr, + dw_val_class_loclistsptr, + dw_val_class_file, + dw_val_class_data8, + dw_val_class_decl_ref, + dw_val_class_vms_delta, + dw_val_class_high_pc, + dw_val_class_discr_value, + dw_val_class_discr_list, + dw_val_class_const_implicit, + dw_val_class_unsigned_const_implicit, + dw_val_class_file_implicit +}; + +/* Describe a floating point constant value, or a vector constant value. */ + +struct GTY(()) dw_vec_const { + void * GTY((atomic)) array; + unsigned length; + unsigned elt_size; +}; + +/* Describe a single value that a discriminant can match. + + Discriminants (in the "record variant part" meaning) are scalars. + dw_discr_list_ref and dw_discr_value are a mean to describe a set of + discriminant values that are matched by a particular variant. + + Discriminants can be signed or unsigned scalars, and can be discriminants + values. Both have to be consistent, though. */ + +struct GTY(()) dw_discr_value { + int pos; /* Whether the discriminant value is positive (unsigned). */ + union + { + HOST_WIDE_INT GTY ((tag ("0"))) sval; + unsigned HOST_WIDE_INT GTY ((tag ("1"))) uval; + } + GTY ((desc ("%1.pos"))) v; +}; + +struct addr_table_entry; + +/* The dw_val_node describes an attribute's value, as it is + represented internally. */ + +struct GTY(()) dw_val_node { + enum dw_val_class val_class; + struct addr_table_entry * GTY(()) val_entry; + union dw_val_struct_union + { + rtx GTY ((tag ("dw_val_class_addr"))) val_addr; + unsigned HOST_WIDE_INT GTY ((tag ("dw_val_class_offset"))) val_offset; + dw_loc_list_ref GTY ((tag ("dw_val_class_loc_list"))) val_loc_list; + dw_loc_descr_ref GTY ((tag ("dw_val_class_loc"))) val_loc; + HOST_WIDE_INT GTY ((default)) val_int; + unsigned HOST_WIDE_INT + GTY ((tag ("dw_val_class_unsigned_const"))) val_unsigned; + double_int GTY ((tag ("dw_val_class_const_double"))) val_double; + wide_int_ptr GTY ((tag ("dw_val_class_wide_int"))) val_wide; + dw_vec_const GTY ((tag ("dw_val_class_vec"))) val_vec; + struct dw_val_die_union + { + dw_die_ref die; + int external; + } GTY ((tag ("dw_val_class_die_ref"))) val_die_ref; + unsigned GTY ((tag ("dw_val_class_fde_ref"))) val_fde_index; + struct indirect_string_node * GTY ((tag ("dw_val_class_str"))) val_str; + char * GTY ((tag ("dw_val_class_lbl_id"))) val_lbl_id; + unsigned char GTY ((tag ("dw_val_class_flag"))) val_flag; + struct dwarf_file_data * GTY ((tag ("dw_val_class_file"))) val_file; + struct dwarf_file_data * + GTY ((tag ("dw_val_class_file_implicit"))) val_file_implicit; + unsigned char GTY ((tag ("dw_val_class_data8"))) val_data8[8]; + tree GTY ((tag ("dw_val_class_decl_ref"))) val_decl_ref; + struct dw_val_vms_delta_union + { + char * lbl1; + char * lbl2; + } GTY ((tag ("dw_val_class_vms_delta"))) val_vms_delta; + dw_discr_value GTY ((tag ("dw_val_class_discr_value"))) val_discr_value; + dw_discr_list_ref GTY ((tag ("dw_val_class_discr_list"))) val_discr_list; + } + GTY ((desc ("%1.val_class"))) v; +}; + +/* Locations in memory are described using a sequence of stack machine + operations. */ + +struct GTY((chain_next ("%h.dw_loc_next"))) dw_loc_descr_node { + dw_loc_descr_ref dw_loc_next; + ENUM_BITFIELD (dwarf_location_atom) dw_loc_opc : 8; + /* Used to distinguish DW_OP_addr with a direct symbol relocation + from DW_OP_addr with a dtp-relative symbol relocation. */ + unsigned int dtprel : 1; + /* For DW_OP_pick, DW_OP_dup and DW_OP_over operations: true iff. + it targets a DWARF prodecure argument. In this case, it needs to be + relocated according to the current frame offset. */ + unsigned int frame_offset_rel : 1; + int dw_loc_addr; + dw_val_node dw_loc_oprnd1; + dw_val_node dw_loc_oprnd2; +}; + +/* A variant (inside a record variant part) is selected when the corresponding + discriminant matches its set of values (see the comment for dw_discr_value). + The following datastructure holds such matching information. */ + +struct GTY(()) dw_discr_list_node { + dw_discr_list_ref dw_discr_next; + + dw_discr_value dw_discr_lower_bound; + dw_discr_value dw_discr_upper_bound; + /* This node represents only the value in dw_discr_lower_bound when it's + zero. It represents the range between the two fields (bounds included) + otherwise. */ + int dw_discr_range; +}; + +/* Interface from dwarf2out.c to dwarf2cfi.c. */ +extern struct dw_loc_descr_node *build_cfa_loc + (dw_cfa_location *, HOST_WIDE_INT); +extern struct dw_loc_descr_node *build_cfa_aligned_loc + (dw_cfa_location *, HOST_WIDE_INT offset, HOST_WIDE_INT alignment); +extern struct dw_loc_descr_node *mem_loc_descriptor + (rtx, machine_mode mode, machine_mode mem_mode, + enum var_init_status); +extern bool loc_descr_equal_p (dw_loc_descr_ref, dw_loc_descr_ref); +extern dw_fde_ref dwarf2out_alloc_current_fde (void); + +extern unsigned long size_of_locs (dw_loc_descr_ref); +extern void output_loc_sequence (dw_loc_descr_ref, int); +extern void output_loc_sequence_raw (dw_loc_descr_ref); + +/* Interface from dwarf2cfi.c to dwarf2out.c. */ +extern void lookup_cfa_1 (dw_cfi_ref cfi, dw_cfa_location *loc, + dw_cfa_location *remember); +extern bool cfa_equal_p (const dw_cfa_location *, const dw_cfa_location *); + +extern void output_cfi (dw_cfi_ref, dw_fde_ref, int); + +extern GTY(()) cfi_vec cie_cfi_vec; + +/* Interface from dwarf2*.c to the rest of the compiler. */ +extern enum dw_cfi_oprnd_type dw_cfi_oprnd1_desc + (enum dwarf_call_frame_info cfi); +extern enum dw_cfi_oprnd_type dw_cfi_oprnd2_desc + (enum dwarf_call_frame_info cfi); + +extern void output_cfi_directive (FILE *f, struct dw_cfi_node *cfi); + +extern void dwarf2out_emit_cfi (dw_cfi_ref cfi); + +extern void debug_dwarf (void); +struct die_struct; +extern void debug_dwarf_die (struct die_struct *); +extern void debug_dwarf_loc_descr (dw_loc_descr_ref); +extern void debug (die_struct &ref); +extern void debug (die_struct *ptr); +extern void dwarf2out_set_demangle_name_func (const char *(*) (const char *)); +#ifdef VMS_DEBUGGING_INFO +extern void dwarf2out_vms_debug_main_pointer (void); +#endif + +enum array_descr_ordering +{ + array_descr_ordering_default, + array_descr_ordering_row_major, + array_descr_ordering_column_major +}; + +#define DWARF2OUT_ARRAY_DESCR_INFO_MAX_DIMEN 16 + +struct array_descr_info +{ + int ndimensions; + enum array_descr_ordering ordering; + tree element_type; + tree base_decl; + tree data_location; + tree allocated; + tree associated; + tree stride; + tree rank; + bool stride_in_bits; + struct array_descr_dimen + { + /* GCC uses sizetype for array indices, so lower_bound and upper_bound + will likely be "sizetype" values. However, bounds may have another + type in the original source code. */ + tree bounds_type; + tree lower_bound; + tree upper_bound; + + /* Only Fortran uses more than one dimension for array types. For other + languages, the stride can be rather specified for the whole array. */ + tree stride; + } dimen[DWARF2OUT_ARRAY_DESCR_INFO_MAX_DIMEN]; +}; + +enum fixed_point_scale_factor +{ + fixed_point_scale_factor_binary, + fixed_point_scale_factor_decimal, + fixed_point_scale_factor_arbitrary +}; + +struct fixed_point_type_info +{ + /* A scale factor is the value one has to multiply with physical data in + order to get the fixed point logical data. The DWARF standard enables one + to encode it in three ways. */ + enum fixed_point_scale_factor scale_factor_kind; + union + { + /* For binary scale factor, the scale factor is: 2 ** binary. */ + int binary; + /* For decimal scale factor, the scale factor is: 10 ** binary. */ + int decimal; + /* For arbitrary scale factor, the scale factor is: + numerator / denominator. */ + struct + { + unsigned HOST_WIDE_INT numerator; + HOST_WIDE_INT denominator; + } arbitrary; + } scale_factor; +}; + +void dwarf2out_c_finalize (void); + +#endif /* GCC_DWARF2OUT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/edit-context.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/edit-context.h new file mode 100644 index 0000000..0d79f07 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/edit-context.h @@ -0,0 +1,68 @@ +/* Determining the results of applying fix-it hints. + Copyright (C) 2016-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_EDIT_CONTEXT_H +#define GCC_EDIT_CONTEXT_H + +#include "typed-splay-tree.h" + +class edit_context; +class edited_file; + +/* A set of changes to the source code. + + The changes are "atomic" - if any changes can't be applied, + none of them can be (tracked by the m_valid flag). + Similarly, attempts to add the changes from a rich_location flagged + as containing invalid changes mean that the whole of the edit_context + is flagged as invalid. + + A complication here is that fix-its are expressed relative to coordinates + in the files when they were parsed, before any changes have been made, and + so if there's more that one fix-it to be applied, we have to adjust + later fix-its to allow for the changes made by earlier ones. This + is done by the various "get_effective_column" methods. */ + +class edit_context +{ + public: + edit_context (); + + bool valid_p () const { return m_valid; } + + void add_fixits (rich_location *richloc); + + char *get_content (const char *filename); + + int get_effective_column (const char *filename, int line, int column); + + char *generate_diff (bool show_filenames); + void print_diff (pretty_printer *pp, bool show_filenames); + + private: + bool apply_insert (const fixit_insert *insert); + bool apply_replace (const fixit_replace *replace); + edited_file *get_file (const char *filename); + edited_file &get_or_insert_file (const char *filename); + + bool m_valid; + typed_splay_tree m_files; +}; + +#endif /* GCC_EDIT_CONTEXT_H. */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/emit-rtl.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/emit-rtl.h new file mode 100644 index 0000000..da60a2d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/emit-rtl.h @@ -0,0 +1,515 @@ +/* Exported functions from emit-rtl.c + Copyright (C) 2004-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_EMIT_RTL_H +#define GCC_EMIT_RTL_H + +struct temp_slot; +typedef struct temp_slot *temp_slot_p; + +/* Information mainlined about RTL representation of incoming arguments. */ +struct GTY(()) incoming_args { + /* Number of bytes of args popped by function being compiled on its return. + Zero if no bytes are to be popped. + May affect compilation of return insn or of function epilogue. */ + int pops_args; + + /* If function's args have a fixed size, this is that size, in bytes. + Otherwise, it is -1. + May affect compilation of return insn or of function epilogue. */ + int size; + + /* # bytes the prologue should push and pretend that the caller pushed them. + The prologue must do this, but only if parms can be passed in + registers. */ + int pretend_args_size; + + /* This is the offset from the arg pointer to the place where the first + anonymous arg can be found, if there is one. */ + rtx arg_offset_rtx; + + /* Quantities of various kinds of registers + used for the current function's args. */ + CUMULATIVE_ARGS info; + + /* The arg pointer hard register, or the pseudo into which it was copied. */ + rtx internal_arg_pointer; +}; + + +/* Datastructures maintained for currently processed function in RTL form. */ +struct GTY(()) rtl_data { + void init_stack_alignment (); + + struct expr_status expr; + struct emit_status emit; + struct varasm_status varasm; + struct incoming_args args; + struct function_subsections subsections; + struct rtl_eh eh; + + /* For function.c */ + + /* # of bytes of outgoing arguments. If ACCUMULATE_OUTGOING_ARGS is + defined, the needed space is pushed by the prologue. */ + int outgoing_args_size; + + /* If nonzero, an RTL expression for the location at which the current + function returns its result. If the current function returns its + result in a register, current_function_return_rtx will always be + the hard register containing the result. */ + rtx return_rtx; + /* If nonxero, an RTL expression for the lcoation at which the current + function returns bounds for its result. */ + rtx return_bnd; + + /* Vector of initial-value pairs. Each pair consists of a pseudo + register of approprite mode that stores the initial value a hard + register REGNO, and that hard register itself. */ + /* ??? This could be a VEC but there is currently no way to define an + opaque VEC type. */ + struct initial_value_struct *hard_reg_initial_vals; + + /* A variable living at the top of the frame that holds a known value. + Used for detecting stack clobbers. */ + tree stack_protect_guard; + + /* List (chain of INSN_LIST) of labels heading the current handlers for + nonlocal gotos. */ + rtx_insn_list *x_nonlocal_goto_handler_labels; + + /* Label that will go on function epilogue. + Jumping to this label serves as a "return" instruction + on machines which require execution of the epilogue on all returns. */ + rtx_code_label *x_return_label; + + /* Label that will go on the end of function epilogue. + Jumping to this label serves as a "naked return" instruction + on machines which require execution of the epilogue on all returns. */ + rtx_code_label *x_naked_return_label; + + /* List (chain of EXPR_LISTs) of all stack slots in this function. + Made for the sake of unshare_all_rtl. */ + vec *x_stack_slot_list; + + /* List of empty areas in the stack frame. */ + struct frame_space *frame_space_list; + + /* Place after which to insert the tail_recursion_label if we need one. */ + rtx_note *x_stack_check_probe_note; + + /* Location at which to save the argument pointer if it will need to be + referenced. There are two cases where this is done: if nonlocal gotos + exist, or if vars stored at an offset from the argument pointer will be + needed by inner routines. */ + rtx x_arg_pointer_save_area; + + /* Dynamic Realign Argument Pointer used for realigning stack. */ + rtx drap_reg; + + /* Offset to end of allocated area of stack frame. + If stack grows down, this is the address of the last stack slot allocated. + If stack grows up, this is the address for the next slot. */ + HOST_WIDE_INT x_frame_offset; + + /* Insn after which register parms and SAVE_EXPRs are born, if nonopt. */ + rtx_insn *x_parm_birth_insn; + + /* List of all used temporaries allocated, by level. */ + vec *x_used_temp_slots; + + /* List of available temp slots. */ + struct temp_slot *x_avail_temp_slots; + + /* Current nesting level for temporaries. */ + int x_temp_slot_level; + + /* The largest alignment needed on the stack, including requirement + for outgoing stack alignment. */ + unsigned int stack_alignment_needed; + + /* Preferred alignment of the end of stack frame, which is preferred + to call other functions. */ + unsigned int preferred_stack_boundary; + + /* The minimum alignment of parameter stack. */ + unsigned int parm_stack_boundary; + + /* The largest alignment of slot allocated on the stack. */ + unsigned int max_used_stack_slot_alignment; + + /* The stack alignment estimated before reload, with consideration of + following factors: + 1. Alignment of local stack variables (max_used_stack_slot_alignment) + 2. Alignment requirement to call other functions + (preferred_stack_boundary) + 3. Alignment of non-local stack variables but might be spilled in + local stack. */ + unsigned int stack_alignment_estimated; + + /* For reorg. */ + + /* Nonzero if function being compiled called builtin_return_addr or + builtin_frame_address with nonzero count. */ + bool accesses_prior_frames; + + /* Nonzero if the function calls __builtin_eh_return. */ + bool calls_eh_return; + + /* Nonzero if function saves all registers, e.g. if it has a nonlocal + label that can reach the exit block via non-exceptional paths. */ + bool saves_all_registers; + + /* Nonzero if function being compiled has nonlocal gotos to parent + function. */ + bool has_nonlocal_goto; + + /* Nonzero if function being compiled has an asm statement. */ + bool has_asm_statement; + + /* This bit is used by the exception handling logic. It is set if all + calls (if any) are sibling calls. Such functions do not have to + have EH tables generated, as they cannot throw. A call to such a + function, however, should be treated as throwing if any of its callees + can throw. */ + bool all_throwers_are_sibcalls; + + /* Nonzero if stack limit checking should be enabled in the current + function. */ + bool limit_stack; + + /* Nonzero if profiling code should be generated. */ + bool profile; + + /* Nonzero if the current function uses the constant pool. */ + bool uses_const_pool; + + /* Nonzero if the current function uses pic_offset_table_rtx. */ + bool uses_pic_offset_table; + + /* Nonzero if the current function needs an lsda for exception handling. */ + bool uses_eh_lsda; + + /* Set when the tail call has been produced. */ + bool tail_call_emit; + + /* Nonzero if code to initialize arg_pointer_save_area has been emitted. */ + bool arg_pointer_save_area_init; + + /* Nonzero if current function must be given a frame pointer. + Set in reload1.c or lra-eliminations.c if anything is allocated + on the stack there. */ + bool frame_pointer_needed; + + /* When set, expand should optimize for speed. */ + bool maybe_hot_insn_p; + + /* Nonzero if function stack realignment is needed. This flag may be + set twice: before and after reload. It is set before reload wrt + stack alignment estimation before reload. It will be changed after + reload if by then criteria of stack realignment is different. + The value set after reload is the accurate one and is finalized. */ + bool stack_realign_needed; + + /* Nonzero if function stack realignment is tried. This flag is set + only once before reload. It affects register elimination. This + is used to generate DWARF debug info for stack variables. */ + bool stack_realign_tried; + + /* Nonzero if function being compiled needs dynamic realigned + argument pointer (drap) if stack needs realigning. */ + bool need_drap; + + /* Nonzero if function stack realignment estimation is done, namely + stack_realign_needed flag has been set before reload wrt estimated + stack alignment info. */ + bool stack_realign_processed; + + /* Nonzero if function stack realignment has been finalized, namely + stack_realign_needed flag has been set and finalized after reload. */ + bool stack_realign_finalized; + + /* True if dbr_schedule has already been called for this function. */ + bool dbr_scheduled_p; + + /* True if current function can not throw. Unlike + TREE_NOTHROW (current_function_decl) it is set even for overwritable + function where currently compiled version of it is nothrow. */ + bool nothrow; + + /* True if we performed shrink-wrapping for the current function. */ + bool shrink_wrapped; + + /* True if we performed shrink-wrapping for separate components for + the current function. */ + bool shrink_wrapped_separate; + + /* Nonzero if function being compiled doesn't modify the stack pointer + (ignoring the prologue and epilogue). This is only valid after + pass_stack_ptr_mod has run. */ + bool sp_is_unchanging; + + /* Nonzero if function being compiled doesn't contain any calls + (ignoring the prologue and epilogue). This is set prior to + local register allocation and is valid for the remaining + compiler passes. */ + bool is_leaf; + + /* Nonzero if the function being compiled is a leaf function which only + uses leaf registers. This is valid after reload (specifically after + sched2) and is useful only if the port defines LEAF_REGISTERS. */ + bool uses_only_leaf_regs; + + /* Nonzero if the function being compiled has undergone hot/cold partitioning + (under flag_reorder_blocks_and_partition) and has at least one cold + block. */ + bool has_bb_partition; + + /* Nonzero if the function being compiled has completed the bb reordering + pass. */ + bool bb_reorder_complete; + + /* Like regs_ever_live, but 1 if a reg is set or clobbered from an + asm. Unlike regs_ever_live, elements of this array corresponding + to eliminable regs (like the frame pointer) are set if an asm + sets them. */ + HARD_REG_SET asm_clobbers; + + /* The highest address seen during shorten_branches. */ + int max_insn_address; +}; + +#define return_label (crtl->x_return_label) +#define naked_return_label (crtl->x_naked_return_label) +#define stack_slot_list (crtl->x_stack_slot_list) +#define parm_birth_insn (crtl->x_parm_birth_insn) +#define frame_offset (crtl->x_frame_offset) +#define stack_check_probe_note (crtl->x_stack_check_probe_note) +#define arg_pointer_save_area (crtl->x_arg_pointer_save_area) +#define used_temp_slots (crtl->x_used_temp_slots) +#define avail_temp_slots (crtl->x_avail_temp_slots) +#define temp_slot_level (crtl->x_temp_slot_level) +#define nonlocal_goto_handler_labels (crtl->x_nonlocal_goto_handler_labels) +#define frame_pointer_needed (crtl->frame_pointer_needed) +#define stack_realign_fp (crtl->stack_realign_needed && !crtl->need_drap) +#define stack_realign_drap (crtl->stack_realign_needed && crtl->need_drap) + +extern GTY(()) struct rtl_data x_rtl; + +/* Accessor to RTL datastructures. We keep them statically allocated now since + we never keep multiple functions. For threaded compiler we might however + want to do differently. */ +#define crtl (&x_rtl) + +/* Return whether two MEM_ATTRs are equal. */ +bool mem_attrs_eq_p (const struct mem_attrs *, const struct mem_attrs *); + +/* Set the alias set of MEM to SET. */ +extern void set_mem_alias_set (rtx, alias_set_type); + +/* Set the alignment of MEM to ALIGN bits. */ +extern void set_mem_align (rtx, unsigned int); + +/* Set the address space of MEM to ADDRSPACE. */ +extern void set_mem_addr_space (rtx, addr_space_t); + +/* Set the expr for MEM to EXPR. */ +extern void set_mem_expr (rtx, tree); + +/* Set the offset for MEM to OFFSET. */ +extern void set_mem_offset (rtx, HOST_WIDE_INT); + +/* Clear the offset recorded for MEM. */ +extern void clear_mem_offset (rtx); + +/* Set the size for MEM to SIZE. */ +extern void set_mem_size (rtx, HOST_WIDE_INT); + +/* Clear the size recorded for MEM. */ +extern void clear_mem_size (rtx); + +/* Set the attributes for MEM appropriate for a spill slot. */ +extern void set_mem_attrs_for_spill (rtx); +extern tree get_spill_slot_decl (bool); + +/* Return a memory reference like MEMREF, but with its address changed to + ADDR. The caller is asserting that the actual piece of memory pointed + to is the same, just the form of the address is being changed, such as + by putting something into a register. */ +extern rtx replace_equiv_address (rtx, rtx, bool = false); + +/* Likewise, but the reference is not required to be valid. */ +extern rtx replace_equiv_address_nv (rtx, rtx, bool = false); + +extern rtx gen_blockage (void); +extern rtvec gen_rtvec (int, ...); +extern rtx copy_insn_1 (rtx); +extern rtx copy_insn (rtx); +extern rtx_insn *copy_delay_slot_insn (rtx_insn *); +extern rtx gen_int_mode (HOST_WIDE_INT, machine_mode); +extern rtx_insn *emit_copy_of_insn_after (rtx_insn *, rtx_insn *); +extern void set_reg_attrs_from_value (rtx, rtx); +extern void set_reg_attrs_for_parm (rtx, rtx); +extern void set_reg_attrs_for_decl_rtl (tree t, rtx x); +extern void adjust_reg_mode (rtx, machine_mode); +extern int mem_expr_equal_p (const_tree, const_tree); + +extern bool need_atomic_barrier_p (enum memmodel, bool); + +/* Return the current sequence. */ + +static inline struct sequence_stack * +get_current_sequence (void) +{ + return &crtl->emit.seq; +} + +/* Return the outermost sequence. */ + +static inline struct sequence_stack * +get_topmost_sequence (void) +{ + struct sequence_stack *seq, *top; + + seq = get_current_sequence (); + do + { + top = seq; + seq = seq->next; + } while (seq); + return top; +} + +/* Return the first insn of the current sequence or current function. */ + +static inline rtx_insn * +get_insns (void) +{ + return get_current_sequence ()->first; +} + +/* Specify a new insn as the first in the chain. */ + +static inline void +set_first_insn (rtx_insn *insn) +{ + gcc_checking_assert (!insn || !PREV_INSN (insn)); + get_current_sequence ()->first = insn; +} + +/* Return the last insn emitted in current sequence or current function. */ + +static inline rtx_insn * +get_last_insn (void) +{ + return get_current_sequence ()->last; +} + +/* Specify a new insn as the last in the chain. */ + +static inline void +set_last_insn (rtx_insn *insn) +{ + gcc_checking_assert (!insn || !NEXT_INSN (insn)); + get_current_sequence ()->last = insn; +} + +/* Return a number larger than any instruction's uid in this function. */ + +static inline int +get_max_uid (void) +{ + return crtl->emit.x_cur_insn_uid; +} + +extern void set_decl_incoming_rtl (tree, rtx, bool); + +/* Return a memory reference like MEMREF, but with its mode changed + to MODE and its address changed to ADDR. + (VOIDmode means don't change the mode. + NULL for ADDR means don't change the address.) */ +extern rtx change_address (rtx, machine_mode, rtx); + +/* Return a memory reference like MEMREF, but with its mode changed + to MODE and its address offset by OFFSET bytes. */ +#define adjust_address(MEMREF, MODE, OFFSET) \ + adjust_address_1 (MEMREF, MODE, OFFSET, 1, 1, 0, 0) + +/* Likewise, but the reference is not required to be valid. */ +#define adjust_address_nv(MEMREF, MODE, OFFSET) \ + adjust_address_1 (MEMREF, MODE, OFFSET, 0, 1, 0, 0) + +/* Return a memory reference like MEMREF, but with its mode changed + to MODE and its address offset by OFFSET bytes. Assume that it's + for a bitfield and conservatively drop the underlying object if we + cannot be sure to stay within its bounds. */ +#define adjust_bitfield_address(MEMREF, MODE, OFFSET) \ + adjust_address_1 (MEMREF, MODE, OFFSET, 1, 1, 1, 0) + +/* As for adjust_bitfield_address, but specify that the width of + BLKmode accesses is SIZE bytes. */ +#define adjust_bitfield_address_size(MEMREF, MODE, OFFSET, SIZE) \ + adjust_address_1 (MEMREF, MODE, OFFSET, 1, 1, 1, SIZE) + +/* Likewise, but the reference is not required to be valid. */ +#define adjust_bitfield_address_nv(MEMREF, MODE, OFFSET) \ + adjust_address_1 (MEMREF, MODE, OFFSET, 0, 1, 1, 0) + +/* Return a memory reference like MEMREF, but with its mode changed + to MODE and its address changed to ADDR, which is assumed to be + increased by OFFSET bytes from MEMREF. */ +#define adjust_automodify_address(MEMREF, MODE, ADDR, OFFSET) \ + adjust_automodify_address_1 (MEMREF, MODE, ADDR, OFFSET, 1) + +/* Likewise, but the reference is not required to be valid. */ +#define adjust_automodify_address_nv(MEMREF, MODE, ADDR, OFFSET) \ + adjust_automodify_address_1 (MEMREF, MODE, ADDR, OFFSET, 0) + +extern rtx adjust_address_1 (rtx, machine_mode, HOST_WIDE_INT, int, int, + int, HOST_WIDE_INT); +extern rtx adjust_automodify_address_1 (rtx, machine_mode, rtx, + HOST_WIDE_INT, int); + +/* Return a memory reference like MEMREF, but whose address is changed by + adding OFFSET, an RTX, to it. POW2 is the highest power of two factor + known to be in OFFSET (possibly 1). */ +extern rtx offset_address (rtx, rtx, unsigned HOST_WIDE_INT); + +/* Given REF, a MEM, and T, either the type of X or the expression + corresponding to REF, set the memory attributes. OBJECTP is nonzero + if we are making a new object of this type. */ +extern void set_mem_attributes (rtx, tree, int); + +/* Similar, except that BITPOS has not yet been applied to REF, so if + we alter MEM_OFFSET according to T then we should subtract BITPOS + expecting that it'll be added back in later. */ +extern void set_mem_attributes_minus_bitpos (rtx, tree, int, HOST_WIDE_INT); + +/* Return OFFSET if XEXP (MEM, 0) - OFFSET is known to be ALIGN + bits aligned for 0 <= OFFSET < ALIGN / BITS_PER_UNIT, or + -1 if not known. */ +extern int get_mem_align_offset (rtx, unsigned int); + +/* Return a memory reference like MEMREF, but with its mode widened to + MODE and adjusted by OFFSET. */ +extern rtx widen_memory_access (rtx, machine_mode, HOST_WIDE_INT); + +extern void maybe_set_max_label_num (rtx_code_label *x); + +#endif /* GCC_EMIT_RTL_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/errors.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/errors.h new file mode 100644 index 0000000..7b58146 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/errors.h @@ -0,0 +1,40 @@ +/* Basic error reporting routines. + Copyright (C) 1999-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* warning, error, and fatal. These definitions are suitable for use + in the generator programs; eventually we would like to use them in + cc1 too, but that's a longer term project. + + N.B. We cannot presently use ATTRIBUTE_PRINTF with these functions, + because they can be extended with additional format specifiers which + GCC does not know about. */ + +#ifndef GCC_ERRORS_H +#define GCC_ERRORS_H + +extern void warning (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_COLD; +extern void error (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_COLD; +extern void fatal (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF_1 ATTRIBUTE_COLD; +extern void internal_error (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF_1 ATTRIBUTE_COLD; +extern const char *trim_filename (const char *); + +extern int have_error; +extern const char *progname; + +#endif /* ! GCC_ERRORS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/et-forest.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/et-forest.h new file mode 100644 index 0000000..0179530 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/et-forest.h @@ -0,0 +1,85 @@ +/* Et-forest data structure implementation. + Copyright (C) 2002-2017 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING3. If not see + . */ + +/* This package implements ET forest data structure. Each tree in + the structure maintains a tree structure and offers logarithmic time + for tree operations (insertion and removal of nodes and edges) and + poly-logarithmic time for nearest common ancestor. + + ET tree stores its structure as a sequence of symbols obtained + by dfs(root) + + dfs (node) + { + s = node; + for each child c of node do + s = concat (s, c, node); + return s; + } + + For example for tree + + 1 + / | \ + 2 3 4 + / | + 4 5 + + the sequence is 1 2 4 2 5 3 1 3 1 4 1. + + The sequence is stored in a slightly modified splay tree. + In order to support various types of node values, a hashtable + is used to convert node values to the internal representation. */ + +#ifndef _ET_TREE_H +#define _ET_TREE_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* The node representing the node in an et tree. */ +struct et_node +{ + void *data; /* The data represented by the node. */ + + int dfs_num_in, dfs_num_out; /* Number of the node in the dfs ordering. */ + + struct et_node *father; /* Father of the node. */ + struct et_node *son; /* The first of the sons of the node. */ + struct et_node *left; + struct et_node *right; /* The brothers of the node. */ + + struct et_occ *rightmost_occ; /* The rightmost occurrence. */ + struct et_occ *parent_occ; /* The occurrence of the parent node. */ +}; + +struct et_node *et_new_tree (void *data); +void et_free_tree (struct et_node *); +void et_free_tree_force (struct et_node *); +void et_free_pools (void); +void et_set_father (struct et_node *, struct et_node *); +void et_split (struct et_node *); +struct et_node *et_nca (struct et_node *, struct et_node *); +bool et_below (struct et_node *, struct et_node *); +struct et_node *et_root (struct et_node *); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _ET_TREE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/except.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/except.h new file mode 100644 index 0000000..87eab55 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/except.h @@ -0,0 +1,335 @@ +/* Exception Handling interface routines. + Copyright (C) 1996-2017 Free Software Foundation, Inc. + Contributed by Mike Stump . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* No include guards here, but define an include file marker anyway, so + that the compiler can keep track of where this file is included. This + is e.g. used to avoid including this file in front-end specific files. */ +#ifndef GCC_EXCEPT_H +#define GCC_EXCEPT_H + + +struct function; +struct eh_region_d; + +/* The type of an exception region. */ +enum eh_region_type +{ + /* CLEANUP regions implement e.g. destructors run when exiting a block. + They can be generated from both GIMPLE_TRY_FINALLY and GIMPLE_TRY_CATCH + nodes. It is expected by the runtime that cleanup regions will *not* + resume normal program flow, but will continue propagation of the + exception. */ + ERT_CLEANUP, + + /* TRY regions implement catching an exception. The list of types associated + with the attached catch handlers is examined in order by the runtime and + control is transferred to the appropriate handler. Note that a NULL type + list is a catch-all handler, and that it will catch *all* exceptions + including those originating from a different language. */ + ERT_TRY, + + /* ALLOWED_EXCEPTIONS regions implement exception filtering, e.g. the + throw(type-list) specification that can be added to C++ functions. + The runtime examines the thrown exception vs the type list, and if + the exception does not match, transfers control to the handler. The + normal handler for C++ calls __cxa_call_unexpected. */ + ERT_ALLOWED_EXCEPTIONS, + + /* MUST_NOT_THROW regions prevent all exceptions from propagating. This + region type is used in C++ to surround destructors being run inside a + CLEANUP region. This differs from an ALLOWED_EXCEPTIONS region with + an empty type list in that the runtime is prepared to terminate the + program directly. We only generate code for MUST_NOT_THROW regions + along control paths that are already handling an exception within the + current function. */ + ERT_MUST_NOT_THROW +}; + + +/* A landing pad for a given exception region. Any transfer of control + from the EH runtime to the function happens at a landing pad. */ + +struct GTY(()) eh_landing_pad_d +{ + /* The linked list of all landing pads associated with the region. */ + struct eh_landing_pad_d *next_lp; + + /* The region with which this landing pad is associated. */ + struct eh_region_d *region; + + /* At the gimple level, the location to which control will be transferred + for this landing pad. There can be both EH and normal edges into the + block containing the post-landing-pad label. */ + tree post_landing_pad; + + /* At the rtl level, the location to which the runtime will transfer + control. This differs from the post-landing-pad in that the target's + EXCEPTION_RECEIVER pattern will be expanded here, as well as other + bookkeeping specific to exceptions. There must not be normal edges + into the block containing the landing-pad label. */ + rtx_code_label *landing_pad; + + /* The index of this landing pad within fun->eh->lp_array. */ + int index; +}; + +/* A catch handler associated with an ERT_TRY region. */ + +struct GTY(()) eh_catch_d +{ + /* The double-linked list of all catch handlers for the region. */ + struct eh_catch_d *next_catch; + struct eh_catch_d *prev_catch; + + /* A TREE_LIST of runtime type objects that this catch handler + will catch, or NULL if all exceptions are caught. */ + tree type_list; + + /* A TREE_LIST of INTEGER_CSTs that correspond to the type_list entries, + having been mapped by assign_filter_values. These integers are to be + compared against the __builtin_eh_filter value. */ + tree filter_list; + + /* The code that should be executed if this catch handler matches the + thrown exception. This label is only maintained until + pass_lower_eh_dispatch, at which point it is cleared. */ + tree label; +}; + +/* Describes one exception region. */ + +struct GTY(()) eh_region_d +{ + /* The immediately surrounding region. */ + struct eh_region_d *outer; + + /* The list of immediately contained regions. */ + struct eh_region_d *inner; + struct eh_region_d *next_peer; + + /* The index of this region within fun->eh->region_array. */ + int index; + + /* Each region does exactly one thing. */ + enum eh_region_type type; + + /* Holds the action to perform based on the preceding type. */ + union eh_region_u { + struct eh_region_u_try { + /* The double-linked list of all catch handlers for this region. */ + struct eh_catch_d *first_catch; + struct eh_catch_d *last_catch; + } GTY ((tag ("ERT_TRY"))) eh_try; + + struct eh_region_u_allowed { + /* A TREE_LIST of runtime type objects allowed to pass. */ + tree type_list; + /* The code that should be executed if the thrown exception does + not match the type list. This label is only maintained until + pass_lower_eh_dispatch, at which point it is cleared. */ + tree label; + /* The integer that will be passed by the runtime to signal that + we should execute the code at LABEL. This integer is assigned + by assign_filter_values and is to be compared against the + __builtin_eh_filter value. */ + int filter; + } GTY ((tag ("ERT_ALLOWED_EXCEPTIONS"))) allowed; + + struct eh_region_u_must_not_throw { + /* A function decl to be invoked if this region is actually reachable + from within the function, rather than implementable from the runtime. + The normal way for this to happen is for there to be a CLEANUP region + contained within this MUST_NOT_THROW region. Note that if the + runtime handles the MUST_NOT_THROW region, we have no control over + what termination function is called; it will be decided by the + personality function in effect for this CIE. */ + tree failure_decl; + /* The location assigned to the call of FAILURE_DECL, if expanded. */ + location_t failure_loc; + } GTY ((tag ("ERT_MUST_NOT_THROW"))) must_not_throw; + } GTY ((desc ("%0.type"))) u; + + /* The list of landing pads associated with this region. */ + struct eh_landing_pad_d *landing_pads; + + /* EXC_PTR and FILTER values copied from the runtime for this region. + Each region gets its own psuedos so that if there are nested exceptions + we do not overwrite the values of the first exception. */ + rtx exc_ptr_reg, filter_reg; + + /* True if this region should use __cxa_end_cleanup instead + of _Unwind_Resume. */ + bool use_cxa_end_cleanup; +}; + +typedef struct eh_landing_pad_d *eh_landing_pad; +typedef struct eh_catch_d *eh_catch; +typedef struct eh_region_d *eh_region; + + + + +/* The exception status for each function. */ + +struct GTY(()) eh_status +{ + /* The tree of all regions for this function. */ + eh_region region_tree; + + /* The same information as an indexable array. */ + vec *region_array; + + /* The landing pads as an indexable array. */ + vec *lp_array; + + /* At the gimple level, a mapping from gimple statement to landing pad + or must-not-throw region. See record_stmt_eh_region. */ + hash_map *GTY(()) throw_stmt_table; + + /* All of the runtime type data used by the function. These objects + are emitted to the lang-specific-data-area for the function. */ + vec *ttype_data; + + /* The table of all action chains. These encode the eh_region tree in + a compact form for use by the runtime, and is also emitted to the + lang-specific-data-area. Note that the ARM EABI uses a different + format for the encoding than all other ports. */ + union eh_status_u { + vec *GTY((tag ("1"))) arm_eabi; + vec *GTY((tag ("0"))) other; + } GTY ((desc ("targetm.arm_eabi_unwinder"))) ehspec_data; +}; + + +/* Invokes CALLBACK for every exception handler label. Only used by old + loop hackery; should not be used by new code. */ +extern void for_each_eh_label (void (*) (rtx)); + +extern void init_eh_for_function (void); + +extern void remove_eh_landing_pad (eh_landing_pad); +extern void remove_eh_handler (eh_region); +extern void remove_unreachable_eh_regions (sbitmap); + +extern bool current_function_has_exception_handlers (void); +extern void output_function_exception_table (const char *); + +extern rtx expand_builtin_eh_pointer (tree); +extern rtx expand_builtin_eh_filter (tree); +extern rtx expand_builtin_eh_copy_values (tree); +extern void expand_builtin_unwind_init (void); +extern rtx expand_builtin_eh_return_data_regno (tree); +extern rtx expand_builtin_extract_return_addr (tree); +extern void expand_builtin_init_dwarf_reg_sizes (tree); +extern rtx expand_builtin_frob_return_addr (tree); +extern rtx expand_builtin_dwarf_sp_column (void); +extern void expand_builtin_eh_return (tree, tree); +extern void expand_eh_return (void); +extern rtx expand_builtin_extend_pointer (tree); +extern void expand_dw2_landing_pad_for_region (eh_region); + +typedef tree (*duplicate_eh_regions_map) (tree, void *); +extern hash_map *duplicate_eh_regions + (struct function *, eh_region, int, duplicate_eh_regions_map, void *); + +extern void sjlj_emit_function_exit_after (rtx_insn *); +extern void update_sjlj_context (void); + +extern eh_region gen_eh_region_cleanup (eh_region); +extern eh_region gen_eh_region_try (eh_region); +extern eh_region gen_eh_region_allowed (eh_region, tree); +extern eh_region gen_eh_region_must_not_throw (eh_region); + +extern eh_catch gen_eh_region_catch (eh_region, tree); +extern eh_landing_pad gen_eh_landing_pad (eh_region); + +extern eh_region get_eh_region_from_number_fn (struct function *, int); +extern eh_region get_eh_region_from_number (int); +extern eh_landing_pad get_eh_landing_pad_from_number_fn (struct function*,int); +extern eh_landing_pad get_eh_landing_pad_from_number (int); +extern eh_region get_eh_region_from_lp_number_fn (struct function *, int); +extern eh_region get_eh_region_from_lp_number (int); + +extern eh_region eh_region_outermost (struct function *, eh_region, eh_region); + +extern void make_reg_eh_region_note (rtx_insn *insn, int ecf_flags, int lp_nr); +extern void make_reg_eh_region_note_nothrow_nononlocal (rtx_insn *); + +extern void verify_eh_tree (struct function *); +extern void dump_eh_tree (FILE *, struct function *); +void debug_eh_tree (struct function *); +extern void add_type_for_runtime (tree); +extern tree lookup_type_for_runtime (tree); +extern void assign_filter_values (void); + +extern eh_region get_eh_region_from_rtx (const_rtx); +extern eh_landing_pad get_eh_landing_pad_from_rtx (const_rtx); + +extern void finish_eh_generation (void); + +struct GTY(()) throw_stmt_node { + gimple *stmt; + int lp_nr; +}; + +extern hash_map *get_eh_throw_stmt_table (struct function *); +extern void set_eh_throw_stmt_table (function *, hash_map *); + +enum eh_personality_kind { + eh_personality_none, + eh_personality_any, + eh_personality_lang +}; + +extern enum eh_personality_kind +function_needs_eh_personality (struct function *); + +/* Pre-order iteration within the eh_region tree. */ + +static inline eh_region +ehr_next (eh_region r, eh_region start) +{ + if (r->inner) + r = r->inner; + else if (r->next_peer && r != start) + r = r->next_peer; + else + { + do + { + r = r->outer; + if (r == start) + return NULL; + } + while (r->next_peer == NULL); + r = r->next_peer; + } + return r; +} + +#define FOR_ALL_EH_REGION_AT(R, START) \ + for ((R) = (START); (R) != NULL; (R) = ehr_next (R, START)) + +#define FOR_ALL_EH_REGION_FN(R, FN) \ + for ((R) = (FN)->eh->region_tree; (R) != NULL; (R) = ehr_next (R, NULL)) + +#define FOR_ALL_EH_REGION(R) FOR_ALL_EH_REGION_FN (R, cfun) + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/explow.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/explow.h new file mode 100644 index 0000000..217a322 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/explow.h @@ -0,0 +1,127 @@ +/* Export function prototypes from explow.c. + Copyright (C) 2015-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_EXPLOW_H +#define GCC_EXPLOW_H + +/* Return a memory reference like MEMREF, but which is known to have a + valid address. */ +extern rtx validize_mem (rtx); + +extern rtx use_anchored_address (rtx); + +/* Copy given rtx to a new temp reg and return that. */ +extern rtx copy_to_reg (rtx); + +/* Like copy_to_reg but always make the reg Pmode. */ +extern rtx copy_addr_to_reg (rtx); + +/* Like copy_to_reg but always make the reg the specified mode MODE. */ +extern rtx copy_to_mode_reg (machine_mode, rtx); + +/* Copy given rtx to given temp reg and return that. */ +extern rtx copy_to_suggested_reg (rtx, rtx, machine_mode); + +/* Copy a value to a register if it isn't already a register. + Args are mode (in case value is a constant) and the value. */ +extern rtx force_reg (machine_mode, rtx); + +/* Return given rtx, copied into a new temp reg if it was in memory. */ +extern rtx force_not_mem (rtx); + +/* Return mode and signedness to use when an argument or result in the + given mode is promoted. */ +extern machine_mode promote_function_mode (const_tree, machine_mode, int *, + const_tree, int); + +/* Return mode and signedness to use when an object in the given mode + is promoted. */ +extern machine_mode promote_mode (const_tree, machine_mode, int *); + +/* Return mode and signedness to use when object is promoted. */ +machine_mode promote_decl_mode (const_tree, int *); + +/* Return mode and signedness to use when object is promoted. */ +machine_mode promote_ssa_mode (const_tree, int *); + +/* Remove some bytes from the stack. An rtx says how many. */ +extern void adjust_stack (rtx); + +/* Add some bytes to the stack. An rtx says how many. */ +extern void anti_adjust_stack (rtx); + +/* Add some bytes to the stack while probing it. An rtx says how many. */ +extern void anti_adjust_stack_and_probe (rtx, bool); + +/* This enum is used for the following two functions. */ +enum save_level {SAVE_BLOCK, SAVE_FUNCTION, SAVE_NONLOCAL}; + +/* Save the stack pointer at the specified level. */ +extern void emit_stack_save (enum save_level, rtx *); + +/* Restore the stack pointer from a save area of the specified level. */ +extern void emit_stack_restore (enum save_level, rtx); + +/* Invoke emit_stack_save for the nonlocal_goto_save_area. */ +extern void update_nonlocal_goto_save_area (void); + +/* Record a new stack level. */ +extern void record_new_stack_level (void); + +/* Allocate some space on the stack dynamically and return its address. */ +extern rtx allocate_dynamic_stack_space (rtx, unsigned, unsigned, bool); + +/* Calculate the necessary size of a constant dynamic stack allocation from the + size of the variable area. */ +extern void get_dynamic_stack_size (rtx *, unsigned, unsigned, HOST_WIDE_INT *); + +/* Returns the address of the dynamic stack space without allocating it. */ +extern rtx get_dynamic_stack_base (HOST_WIDE_INT offset, + unsigned required_align); + +/* Emit one stack probe at ADDRESS, an address within the stack. */ +extern void emit_stack_probe (rtx); + +/* Probe a range of stack addresses from FIRST to FIRST+SIZE, inclusive. + FIRST is a constant and size is a Pmode RTX. These are offsets from + the current stack pointer. STACK_GROWS_DOWNWARD says whether to add + or subtract them from the stack pointer. */ +extern void probe_stack_range (HOST_WIDE_INT, rtx); + +/* Return an rtx that refers to the value returned by a library call + in its original home. This becomes invalid if any more code is emitted. */ +extern rtx hard_libcall_value (machine_mode, rtx); + +/* Return an rtx that refers to the value returned by a function + in its original home. This becomes invalid if any more code is emitted. */ +extern rtx hard_function_value (const_tree, const_tree, const_tree, int); + +/* Convert arg to a valid memory address for specified machine mode that points + to a specific named address space, by emitting insns to perform arithmetic + if necessary. */ +extern rtx memory_address_addr_space (machine_mode, rtx, addr_space_t); + +extern rtx eliminate_constant_term (rtx, rtx *); + +/* Like memory_address_addr_space, except assume the memory address points to + the generic named address space. */ +#define memory_address(MODE,RTX) \ + memory_address_addr_space ((MODE), (RTX), ADDR_SPACE_GENERIC) + +#endif /* GCC_EXPLOW_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/expmed.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/expmed.h new file mode 100644 index 0000000..db1ce00 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/expmed.h @@ -0,0 +1,733 @@ +/* Target-dependent costs for expmed.c. + Copyright (C) 1987-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef EXPMED_H +#define EXPMED_H 1 + +#include "insn-codes.h" + +enum alg_code { + alg_unknown, + alg_zero, + alg_m, alg_shift, + alg_add_t_m2, + alg_sub_t_m2, + alg_add_factor, + alg_sub_factor, + alg_add_t2_m, + alg_sub_t2_m, + alg_impossible +}; + +/* Indicates the type of fixup needed after a constant multiplication. + BASIC_VARIANT means no fixup is needed, NEGATE_VARIANT means that + the result should be negated, and ADD_VARIANT means that the + multiplicand should be added to the result. */ +enum mult_variant {basic_variant, negate_variant, add_variant}; + +bool choose_mult_variant (machine_mode, HOST_WIDE_INT, + struct algorithm *, enum mult_variant *, int); + +/* This structure holds the "cost" of a multiply sequence. The + "cost" field holds the total rtx_cost of every operator in the + synthetic multiplication sequence, hence cost(a op b) is defined + as rtx_cost(op) + cost(a) + cost(b), where cost(leaf) is zero. + The "latency" field holds the minimum possible latency of the + synthetic multiply, on a hypothetical infinitely parallel CPU. + This is the critical path, or the maximum height, of the expression + tree which is the sum of rtx_costs on the most expensive path from + any leaf to the root. Hence latency(a op b) is defined as zero for + leaves and rtx_cost(op) + max(latency(a), latency(b)) otherwise. */ + +struct mult_cost { + short cost; /* Total rtx_cost of the multiplication sequence. */ + short latency; /* The latency of the multiplication sequence. */ +}; + +/* This macro is used to compare a pointer to a mult_cost against an + single integer "rtx_cost" value. This is equivalent to the macro + CHEAPER_MULT_COST(X,Z) where Z = {Y,Y}. */ +#define MULT_COST_LESS(X,Y) ((X)->cost < (Y) \ + || ((X)->cost == (Y) && (X)->latency < (Y))) + +/* This macro is used to compare two pointers to mult_costs against + each other. The macro returns true if X is cheaper than Y. + Currently, the cheaper of two mult_costs is the one with the + lower "cost". If "cost"s are tied, the lower latency is cheaper. */ +#define CHEAPER_MULT_COST(X,Y) ((X)->cost < (Y)->cost \ + || ((X)->cost == (Y)->cost \ + && (X)->latency < (Y)->latency)) + +/* This structure records a sequence of operations. + `ops' is the number of operations recorded. + `cost' is their total cost. + The operations are stored in `op' and the corresponding + logarithms of the integer coefficients in `log'. + + These are the operations: + alg_zero total := 0; + alg_m total := multiplicand; + alg_shift total := total * coeff + alg_add_t_m2 total := total + multiplicand * coeff; + alg_sub_t_m2 total := total - multiplicand * coeff; + alg_add_factor total := total * coeff + total; + alg_sub_factor total := total * coeff - total; + alg_add_t2_m total := total * coeff + multiplicand; + alg_sub_t2_m total := total * coeff - multiplicand; + + The first operand must be either alg_zero or alg_m. */ + +struct algorithm +{ + struct mult_cost cost; + short ops; + /* The size of the OP and LOG fields are not directly related to the + word size, but the worst-case algorithms will be if we have few + consecutive ones or zeros, i.e., a multiplicand like 10101010101... + In that case we will generate shift-by-2, add, shift-by-2, add,..., + in total wordsize operations. */ + enum alg_code op[MAX_BITS_PER_WORD]; + char log[MAX_BITS_PER_WORD]; +}; + +/* The entry for our multiplication cache/hash table. */ +struct alg_hash_entry { + /* The number we are multiplying by. */ + unsigned HOST_WIDE_INT t; + + /* The mode in which we are multiplying something by T. */ + machine_mode mode; + + /* The best multiplication algorithm for t. */ + enum alg_code alg; + + /* The cost of multiplication if ALG_CODE is not alg_impossible. + Otherwise, the cost within which multiplication by T is + impossible. */ + struct mult_cost cost; + + /* Optimized for speed? */ + bool speed; +}; + +/* The number of cache/hash entries. */ +#if HOST_BITS_PER_WIDE_INT == 64 +#define NUM_ALG_HASH_ENTRIES 1031 +#else +#define NUM_ALG_HASH_ENTRIES 307 +#endif + +#define NUM_MODE_INT \ + (MAX_MODE_INT - MIN_MODE_INT + 1) +#define NUM_MODE_PARTIAL_INT \ + (MIN_MODE_PARTIAL_INT == VOIDmode ? 0 \ + : MAX_MODE_PARTIAL_INT - MIN_MODE_PARTIAL_INT + 1) +#define NUM_MODE_VECTOR_INT \ + (MIN_MODE_VECTOR_INT == VOIDmode ? 0 \ + : MAX_MODE_VECTOR_INT - MIN_MODE_VECTOR_INT + 1) + +#define NUM_MODE_IP_INT (NUM_MODE_INT + NUM_MODE_PARTIAL_INT) +#define NUM_MODE_IPV_INT (NUM_MODE_IP_INT + NUM_MODE_VECTOR_INT) + +struct expmed_op_cheap { + bool cheap[2][NUM_MODE_IPV_INT]; +}; + +struct expmed_op_costs { + int cost[2][NUM_MODE_IPV_INT]; +}; + +/* Target-dependent globals. */ +struct target_expmed { + /* Each entry of ALG_HASH caches alg_code for some integer. This is + actually a hash table. If we have a collision, that the older + entry is kicked out. */ + struct alg_hash_entry x_alg_hash[NUM_ALG_HASH_ENTRIES]; + + /* True if x_alg_hash might already have been used. */ + bool x_alg_hash_used_p; + + /* Nonzero means divides or modulus operations are relatively cheap for + powers of two, so don't use branches; emit the operation instead. + Usually, this will mean that the MD file will emit non-branch + sequences. */ + struct expmed_op_cheap x_sdiv_pow2_cheap; + struct expmed_op_cheap x_smod_pow2_cheap; + + /* Cost of various pieces of RTL. Note that some of these are indexed by + shift count and some by mode. */ + int x_zero_cost[2]; + struct expmed_op_costs x_add_cost; + struct expmed_op_costs x_neg_cost; + struct expmed_op_costs x_shift_cost[MAX_BITS_PER_WORD]; + struct expmed_op_costs x_shiftadd_cost[MAX_BITS_PER_WORD]; + struct expmed_op_costs x_shiftsub0_cost[MAX_BITS_PER_WORD]; + struct expmed_op_costs x_shiftsub1_cost[MAX_BITS_PER_WORD]; + struct expmed_op_costs x_mul_cost; + struct expmed_op_costs x_sdiv_cost; + struct expmed_op_costs x_udiv_cost; + int x_mul_widen_cost[2][NUM_MODE_INT]; + int x_mul_highpart_cost[2][NUM_MODE_INT]; + + /* Conversion costs are only defined between two scalar integer modes + of different sizes. The first machine mode is the destination mode, + and the second is the source mode. */ + int x_convert_cost[2][NUM_MODE_IP_INT][NUM_MODE_IP_INT]; +}; + +extern struct target_expmed default_target_expmed; +#if SWITCHABLE_TARGET +extern struct target_expmed *this_target_expmed; +#else +#define this_target_expmed (&default_target_expmed) +#endif + +/* Return a pointer to the alg_hash_entry at IDX. */ + +static inline struct alg_hash_entry * +alg_hash_entry_ptr (int idx) +{ + return &this_target_expmed->x_alg_hash[idx]; +} + +/* Return true if the x_alg_hash field might have been used. */ + +static inline bool +alg_hash_used_p (void) +{ + return this_target_expmed->x_alg_hash_used_p; +} + +/* Set whether the x_alg_hash field might have been used. */ + +static inline void +set_alg_hash_used_p (bool usedp) +{ + this_target_expmed->x_alg_hash_used_p = usedp; +} + +/* Compute an index into the cost arrays by mode class. */ + +static inline int +expmed_mode_index (machine_mode mode) +{ + switch (GET_MODE_CLASS (mode)) + { + case MODE_INT: + return mode - MIN_MODE_INT; + case MODE_PARTIAL_INT: + /* If there are no partial integer modes, help the compiler + to figure out this will never happen. See PR59934. */ + if (MIN_MODE_PARTIAL_INT != VOIDmode) + return mode - MIN_MODE_PARTIAL_INT + NUM_MODE_INT; + break; + case MODE_VECTOR_INT: + /* If there are no vector integer modes, help the compiler + to figure out this will never happen. See PR59934. */ + if (MIN_MODE_VECTOR_INT != VOIDmode) + return mode - MIN_MODE_VECTOR_INT + NUM_MODE_IP_INT; + break; + default: + break; + } + gcc_unreachable (); +} + +/* Return a pointer to a boolean contained in EOC indicating whether + a particular operation performed in MODE is cheap when optimizing + for SPEED. */ + +static inline bool * +expmed_op_cheap_ptr (struct expmed_op_cheap *eoc, bool speed, + machine_mode mode) +{ + int idx = expmed_mode_index (mode); + return &eoc->cheap[speed][idx]; +} + +/* Return a pointer to a cost contained in COSTS when a particular + operation is performed in MODE when optimizing for SPEED. */ + +static inline int * +expmed_op_cost_ptr (struct expmed_op_costs *costs, bool speed, + machine_mode mode) +{ + int idx = expmed_mode_index (mode); + return &costs->cost[speed][idx]; +} + +/* Subroutine of {set_,}sdiv_pow2_cheap. Not to be used otherwise. */ + +static inline bool * +sdiv_pow2_cheap_ptr (bool speed, machine_mode mode) +{ + return expmed_op_cheap_ptr (&this_target_expmed->x_sdiv_pow2_cheap, + speed, mode); +} + +/* Set whether a signed division by a power of 2 is cheap in MODE + when optimizing for SPEED. */ + +static inline void +set_sdiv_pow2_cheap (bool speed, machine_mode mode, bool cheap_p) +{ + *sdiv_pow2_cheap_ptr (speed, mode) = cheap_p; +} + +/* Return whether a signed division by a power of 2 is cheap in MODE + when optimizing for SPEED. */ + +static inline bool +sdiv_pow2_cheap (bool speed, machine_mode mode) +{ + return *sdiv_pow2_cheap_ptr (speed, mode); +} + +/* Subroutine of {set_,}smod_pow2_cheap. Not to be used otherwise. */ + +static inline bool * +smod_pow2_cheap_ptr (bool speed, machine_mode mode) +{ + return expmed_op_cheap_ptr (&this_target_expmed->x_smod_pow2_cheap, + speed, mode); +} + +/* Set whether a signed modulo by a power of 2 is CHEAP in MODE when + optimizing for SPEED. */ + +static inline void +set_smod_pow2_cheap (bool speed, machine_mode mode, bool cheap) +{ + *smod_pow2_cheap_ptr (speed, mode) = cheap; +} + +/* Return whether a signed modulo by a power of 2 is cheap in MODE + when optimizing for SPEED. */ + +static inline bool +smod_pow2_cheap (bool speed, machine_mode mode) +{ + return *smod_pow2_cheap_ptr (speed, mode); +} + +/* Subroutine of {set_,}zero_cost. Not to be used otherwise. */ + +static inline int * +zero_cost_ptr (bool speed) +{ + return &this_target_expmed->x_zero_cost[speed]; +} + +/* Set the COST of loading zero when optimizing for SPEED. */ + +static inline void +set_zero_cost (bool speed, int cost) +{ + *zero_cost_ptr (speed) = cost; +} + +/* Return the COST of loading zero when optimizing for SPEED. */ + +static inline int +zero_cost (bool speed) +{ + return *zero_cost_ptr (speed); +} + +/* Subroutine of {set_,}add_cost. Not to be used otherwise. */ + +static inline int * +add_cost_ptr (bool speed, machine_mode mode) +{ + return expmed_op_cost_ptr (&this_target_expmed->x_add_cost, speed, mode); +} + +/* Set the COST of computing an add in MODE when optimizing for SPEED. */ + +static inline void +set_add_cost (bool speed, machine_mode mode, int cost) +{ + *add_cost_ptr (speed, mode) = cost; +} + +/* Return the cost of computing an add in MODE when optimizing for SPEED. */ + +static inline int +add_cost (bool speed, machine_mode mode) +{ + return *add_cost_ptr (speed, mode); +} + +/* Subroutine of {set_,}neg_cost. Not to be used otherwise. */ + +static inline int * +neg_cost_ptr (bool speed, machine_mode mode) +{ + return expmed_op_cost_ptr (&this_target_expmed->x_neg_cost, speed, mode); +} + +/* Set the COST of computing a negation in MODE when optimizing for SPEED. */ + +static inline void +set_neg_cost (bool speed, machine_mode mode, int cost) +{ + *neg_cost_ptr (speed, mode) = cost; +} + +/* Return the cost of computing a negation in MODE when optimizing for + SPEED. */ + +static inline int +neg_cost (bool speed, machine_mode mode) +{ + return *neg_cost_ptr (speed, mode); +} + +/* Subroutine of {set_,}shift_cost. Not to be used otherwise. */ + +static inline int * +shift_cost_ptr (bool speed, machine_mode mode, int bits) +{ + return expmed_op_cost_ptr (&this_target_expmed->x_shift_cost[bits], + speed, mode); +} + +/* Set the COST of doing a shift in MODE by BITS when optimizing for SPEED. */ + +static inline void +set_shift_cost (bool speed, machine_mode mode, int bits, int cost) +{ + *shift_cost_ptr (speed, mode, bits) = cost; +} + +/* Return the cost of doing a shift in MODE by BITS when optimizing for + SPEED. */ + +static inline int +shift_cost (bool speed, machine_mode mode, int bits) +{ + return *shift_cost_ptr (speed, mode, bits); +} + +/* Subroutine of {set_,}shiftadd_cost. Not to be used otherwise. */ + +static inline int * +shiftadd_cost_ptr (bool speed, machine_mode mode, int bits) +{ + return expmed_op_cost_ptr (&this_target_expmed->x_shiftadd_cost[bits], + speed, mode); +} + +/* Set the COST of doing a shift in MODE by BITS followed by an add when + optimizing for SPEED. */ + +static inline void +set_shiftadd_cost (bool speed, machine_mode mode, int bits, int cost) +{ + *shiftadd_cost_ptr (speed, mode, bits) = cost; +} + +/* Return the cost of doing a shift in MODE by BITS followed by an add + when optimizing for SPEED. */ + +static inline int +shiftadd_cost (bool speed, machine_mode mode, int bits) +{ + return *shiftadd_cost_ptr (speed, mode, bits); +} + +/* Subroutine of {set_,}shiftsub0_cost. Not to be used otherwise. */ + +static inline int * +shiftsub0_cost_ptr (bool speed, machine_mode mode, int bits) +{ + return expmed_op_cost_ptr (&this_target_expmed->x_shiftsub0_cost[bits], + speed, mode); +} + +/* Set the COST of doing a shift in MODE by BITS and then subtracting a + value when optimizing for SPEED. */ + +static inline void +set_shiftsub0_cost (bool speed, machine_mode mode, int bits, int cost) +{ + *shiftsub0_cost_ptr (speed, mode, bits) = cost; +} + +/* Return the cost of doing a shift in MODE by BITS and then subtracting + a value when optimizing for SPEED. */ + +static inline int +shiftsub0_cost (bool speed, machine_mode mode, int bits) +{ + return *shiftsub0_cost_ptr (speed, mode, bits); +} + +/* Subroutine of {set_,}shiftsub1_cost. Not to be used otherwise. */ + +static inline int * +shiftsub1_cost_ptr (bool speed, machine_mode mode, int bits) +{ + return expmed_op_cost_ptr (&this_target_expmed->x_shiftsub1_cost[bits], + speed, mode); +} + +/* Set the COST of subtracting a shift in MODE by BITS from a value when + optimizing for SPEED. */ + +static inline void +set_shiftsub1_cost (bool speed, machine_mode mode, int bits, int cost) +{ + *shiftsub1_cost_ptr (speed, mode, bits) = cost; +} + +/* Return the cost of subtracting a shift in MODE by BITS from a value + when optimizing for SPEED. */ + +static inline int +shiftsub1_cost (bool speed, machine_mode mode, int bits) +{ + return *shiftsub1_cost_ptr (speed, mode, bits); +} + +/* Subroutine of {set_,}mul_cost. Not to be used otherwise. */ + +static inline int * +mul_cost_ptr (bool speed, machine_mode mode) +{ + return expmed_op_cost_ptr (&this_target_expmed->x_mul_cost, speed, mode); +} + +/* Set the COST of doing a multiplication in MODE when optimizing for + SPEED. */ + +static inline void +set_mul_cost (bool speed, machine_mode mode, int cost) +{ + *mul_cost_ptr (speed, mode) = cost; +} + +/* Return the cost of doing a multiplication in MODE when optimizing + for SPEED. */ + +static inline int +mul_cost (bool speed, machine_mode mode) +{ + return *mul_cost_ptr (speed, mode); +} + +/* Subroutine of {set_,}sdiv_cost. Not to be used otherwise. */ + +static inline int * +sdiv_cost_ptr (bool speed, machine_mode mode) +{ + return expmed_op_cost_ptr (&this_target_expmed->x_sdiv_cost, speed, mode); +} + +/* Set the COST of doing a signed division in MODE when optimizing + for SPEED. */ + +static inline void +set_sdiv_cost (bool speed, machine_mode mode, int cost) +{ + *sdiv_cost_ptr (speed, mode) = cost; +} + +/* Return the cost of doing a signed division in MODE when optimizing + for SPEED. */ + +static inline int +sdiv_cost (bool speed, machine_mode mode) +{ + return *sdiv_cost_ptr (speed, mode); +} + +/* Subroutine of {set_,}udiv_cost. Not to be used otherwise. */ + +static inline int * +udiv_cost_ptr (bool speed, machine_mode mode) +{ + return expmed_op_cost_ptr (&this_target_expmed->x_udiv_cost, speed, mode); +} + +/* Set the COST of doing an unsigned division in MODE when optimizing + for SPEED. */ + +static inline void +set_udiv_cost (bool speed, machine_mode mode, int cost) +{ + *udiv_cost_ptr (speed, mode) = cost; +} + +/* Return the cost of doing an unsigned division in MODE when + optimizing for SPEED. */ + +static inline int +udiv_cost (bool speed, machine_mode mode) +{ + return *udiv_cost_ptr (speed, mode); +} + +/* Subroutine of {set_,}mul_widen_cost. Not to be used otherwise. */ + +static inline int * +mul_widen_cost_ptr (bool speed, machine_mode mode) +{ + gcc_assert (GET_MODE_CLASS (mode) == MODE_INT); + + return &this_target_expmed->x_mul_widen_cost[speed][mode - MIN_MODE_INT]; +} + +/* Set the COST for computing a widening multiplication in MODE when + optimizing for SPEED. */ + +static inline void +set_mul_widen_cost (bool speed, machine_mode mode, int cost) +{ + *mul_widen_cost_ptr (speed, mode) = cost; +} + +/* Return the cost for computing a widening multiplication in MODE when + optimizing for SPEED. */ + +static inline int +mul_widen_cost (bool speed, machine_mode mode) +{ + return *mul_widen_cost_ptr (speed, mode); +} + +/* Subroutine of {set_,}mul_highpart_cost. Not to be used otherwise. */ + +static inline int * +mul_highpart_cost_ptr (bool speed, machine_mode mode) +{ + gcc_assert (GET_MODE_CLASS (mode) == MODE_INT); + int m = mode - MIN_MODE_INT; + gcc_assert (m < NUM_MODE_INT); + + return &this_target_expmed->x_mul_highpart_cost[speed][m]; +} + +/* Set the COST for computing the high part of a multiplication in MODE + when optimizing for SPEED. */ + +static inline void +set_mul_highpart_cost (bool speed, machine_mode mode, int cost) +{ + *mul_highpart_cost_ptr (speed, mode) = cost; +} + +/* Return the cost for computing the high part of a multiplication in MODE + when optimizing for SPEED. */ + +static inline int +mul_highpart_cost (bool speed, machine_mode mode) +{ + return *mul_highpart_cost_ptr (speed, mode); +} + +/* Subroutine of {set_,}convert_cost. Not to be used otherwise. */ + +static inline int * +convert_cost_ptr (machine_mode to_mode, machine_mode from_mode, + bool speed) +{ + int to_idx = expmed_mode_index (to_mode); + int from_idx = expmed_mode_index (from_mode); + + gcc_assert (IN_RANGE (to_idx, 0, NUM_MODE_IP_INT - 1)); + gcc_assert (IN_RANGE (from_idx, 0, NUM_MODE_IP_INT - 1)); + + return &this_target_expmed->x_convert_cost[speed][to_idx][from_idx]; +} + +/* Set the COST for converting from FROM_MODE to TO_MODE when optimizing + for SPEED. */ + +static inline void +set_convert_cost (machine_mode to_mode, machine_mode from_mode, + bool speed, int cost) +{ + *convert_cost_ptr (to_mode, from_mode, speed) = cost; +} + +/* Return the cost for converting from FROM_MODE to TO_MODE when optimizing + for SPEED. */ + +static inline int +convert_cost (machine_mode to_mode, machine_mode from_mode, + bool speed) +{ + return *convert_cost_ptr (to_mode, from_mode, speed); +} + +extern int mult_by_coeff_cost (HOST_WIDE_INT, machine_mode, bool); +extern rtx emit_cstore (rtx target, enum insn_code icode, enum rtx_code code, + enum machine_mode mode, enum machine_mode compare_mode, + int unsignedp, rtx x, rtx y, int normalizep, + enum machine_mode target_mode); + +/* Arguments MODE, RTX: return an rtx for the negation of that value. + May emit insns. */ +extern rtx negate_rtx (machine_mode, rtx); + +/* Arguments MODE, RTX: return an rtx for the flipping of that value. + May emit insns. */ +extern rtx flip_storage_order (enum machine_mode, rtx); + +/* Expand a logical AND operation. */ +extern rtx expand_and (machine_mode, rtx, rtx, rtx); + +/* Emit a store-flag operation. */ +extern rtx emit_store_flag (rtx, enum rtx_code, rtx, rtx, machine_mode, + int, int); + +/* Like emit_store_flag, but always succeeds. */ +extern rtx emit_store_flag_force (rtx, enum rtx_code, rtx, rtx, + machine_mode, int, int); + +/* Choose a minimal N + 1 bit approximation to 1/D that can be used to + replace division by D, and put the least significant N bits of the result + in *MULTIPLIER_PTR and return the most significant bit. */ +extern unsigned HOST_WIDE_INT choose_multiplier (unsigned HOST_WIDE_INT, int, + int, unsigned HOST_WIDE_INT *, + int *, int *); + +#ifdef TREE_CODE +extern rtx expand_variable_shift (enum tree_code, machine_mode, + rtx, tree, rtx, int); +extern rtx expand_shift (enum tree_code, machine_mode, rtx, int, rtx, + int); +extern rtx expand_divmod (int, enum tree_code, machine_mode, rtx, rtx, + rtx, int); +#endif + +extern void store_bit_field (rtx, unsigned HOST_WIDE_INT, + unsigned HOST_WIDE_INT, + unsigned HOST_WIDE_INT, + unsigned HOST_WIDE_INT, + machine_mode, rtx, bool); +extern rtx extract_bit_field (rtx, unsigned HOST_WIDE_INT, + unsigned HOST_WIDE_INT, int, rtx, + machine_mode, machine_mode, bool); +extern rtx extract_low_bits (machine_mode, machine_mode, rtx); +extern rtx expand_mult (machine_mode, rtx, rtx, rtx, int); +extern rtx expand_mult_highpart_adjust (machine_mode, rtx, rtx, rtx, rtx, int); + +#endif // EXPMED_H diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/expr.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/expr.h new file mode 100644 index 0000000..84002ab --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/expr.h @@ -0,0 +1,316 @@ +/* Definitions for code generation pass of GNU compiler. + Copyright (C) 1987-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_EXPR_H +#define GCC_EXPR_H + +/* This is the 4th arg to `expand_expr'. + EXPAND_STACK_PARM means we are possibly expanding a call param onto + the stack. + EXPAND_SUM means it is ok to return a PLUS rtx or MULT rtx. + EXPAND_INITIALIZER is similar but also record any labels on forced_labels. + EXPAND_CONST_ADDRESS means it is ok to return a MEM whose address + is a constant that is not a legitimate address. + EXPAND_WRITE means we are only going to write to the resulting rtx. + EXPAND_MEMORY means we are interested in a memory result, even if + the memory is constant and we could have propagated a constant value, + or the memory is unaligned on a STRICT_ALIGNMENT target. */ +enum expand_modifier {EXPAND_NORMAL = 0, EXPAND_STACK_PARM, EXPAND_SUM, + EXPAND_CONST_ADDRESS, EXPAND_INITIALIZER, EXPAND_WRITE, + EXPAND_MEMORY}; + +/* Prevent the compiler from deferring stack pops. See + inhibit_defer_pop for more information. */ +#define NO_DEFER_POP (inhibit_defer_pop += 1) + +/* Allow the compiler to defer stack pops. See inhibit_defer_pop for + more information. */ +#define OK_DEFER_POP (inhibit_defer_pop -= 1) + +/* This structure is used to pass around information about exploded + unary, binary and trinary expressions between expand_expr_real_1 and + friends. */ +typedef struct separate_ops +{ + enum tree_code code; + location_t location; + tree type; + tree op0, op1, op2; +} *sepops; + +/* This is run during target initialization to set up which modes can be + used directly in memory and to initialize the block move optab. */ +extern void init_expr_target (void); + +/* This is run at the start of compiling a function. */ +extern void init_expr (void); + +/* Emit some rtl insns to move data between rtx's, converting machine modes. + Both modes must be floating or both fixed. */ +extern void convert_move (rtx, rtx, int); + +/* Convert an rtx to specified machine mode and return the result. */ +extern rtx convert_to_mode (machine_mode, rtx, int); + +/* Convert an rtx to MODE from OLDMODE and return the result. */ +extern rtx convert_modes (machine_mode, machine_mode, rtx, int); + +/* Expand a call to memcpy or memmove or memcmp, and return the result. */ +extern rtx emit_block_op_via_libcall (enum built_in_function, rtx, rtx, rtx, + bool); + +static inline rtx +emit_block_copy_via_libcall (rtx dst, rtx src, rtx size, bool tailcall = false) +{ + return emit_block_op_via_libcall (BUILT_IN_MEMCPY, dst, src, size, tailcall); +} + +static inline rtx +emit_block_move_via_libcall (rtx dst, rtx src, rtx size, bool tailcall = false) +{ + return emit_block_op_via_libcall (BUILT_IN_MEMMOVE, dst, src, size, tailcall); +} + +static inline rtx +emit_block_comp_via_libcall (rtx dst, rtx src, rtx size, bool tailcall = false) +{ + return emit_block_op_via_libcall (BUILT_IN_MEMCMP, dst, src, size, tailcall); +} + +/* Emit code to move a block Y to a block X. */ +enum block_op_methods +{ + BLOCK_OP_NORMAL, + BLOCK_OP_NO_LIBCALL, + BLOCK_OP_CALL_PARM, + /* Like BLOCK_OP_NORMAL, but the libcall can be tail call optimized. */ + BLOCK_OP_TAILCALL +}; + +typedef rtx (*by_pieces_constfn) (void *, HOST_WIDE_INT, machine_mode); + +extern rtx emit_block_move (rtx, rtx, rtx, enum block_op_methods); +extern rtx emit_block_move_hints (rtx, rtx, rtx, enum block_op_methods, + unsigned int, HOST_WIDE_INT, + unsigned HOST_WIDE_INT, + unsigned HOST_WIDE_INT, + unsigned HOST_WIDE_INT); +extern rtx emit_block_cmp_hints (rtx, rtx, rtx, tree, rtx, bool, + by_pieces_constfn, void *); +extern bool emit_storent_insn (rtx to, rtx from); + +/* Copy all or part of a value X into registers starting at REGNO. + The number of registers to be filled is NREGS. */ +extern void move_block_to_reg (int, rtx, int, machine_mode); + +/* Copy all or part of a BLKmode value X out of registers starting at REGNO. + The number of registers to be filled is NREGS. */ +extern void move_block_from_reg (int, rtx, int); + +/* Generate a non-consecutive group of registers represented by a PARALLEL. */ +extern rtx gen_group_rtx (rtx); + +/* Load a BLKmode value into non-consecutive registers represented by a + PARALLEL. */ +extern void emit_group_load (rtx, rtx, tree, int); + +/* Similarly, but load into new temporaries. */ +extern rtx emit_group_load_into_temps (rtx, rtx, tree, int); + +/* Move a non-consecutive group of registers represented by a PARALLEL into + a non-consecutive group of registers represented by a PARALLEL. */ +extern void emit_group_move (rtx, rtx); + +/* Move a group of registers represented by a PARALLEL into pseudos. */ +extern rtx emit_group_move_into_temps (rtx); + +/* Store a BLKmode value from non-consecutive registers represented by a + PARALLEL. */ +extern void emit_group_store (rtx, rtx, tree, int); + +extern rtx maybe_emit_group_store (rtx, tree); + +/* Mark REG as holding a parameter for the next CALL_INSN. + Mode is TYPE_MODE of the non-promoted parameter, or VOIDmode. */ +extern void use_reg_mode (rtx *, rtx, machine_mode); +extern void clobber_reg_mode (rtx *, rtx, machine_mode); + +extern rtx copy_blkmode_to_reg (machine_mode, tree); + +/* Mark REG as holding a parameter for the next CALL_INSN. */ +static inline void +use_reg (rtx *fusage, rtx reg) +{ + use_reg_mode (fusage, reg, VOIDmode); +} + +/* Mark REG as clobbered by the call with FUSAGE as CALL_INSN_FUNCTION_USAGE. */ +static inline void +clobber_reg (rtx *fusage, rtx reg) +{ + clobber_reg_mode (fusage, reg, VOIDmode); +} + +/* Mark NREGS consecutive regs, starting at REGNO, as holding parameters + for the next CALL_INSN. */ +extern void use_regs (rtx *, int, int); + +/* Mark a PARALLEL as holding a parameter for the next CALL_INSN. */ +extern void use_group_regs (rtx *, rtx); + +#ifdef GCC_INSN_CODES_H +extern rtx expand_cmpstrn_or_cmpmem (insn_code, rtx, rtx, rtx, tree, rtx, + HOST_WIDE_INT); +#endif + +/* Write zeros through the storage of OBJECT. + If OBJECT has BLKmode, SIZE is its length in bytes. */ +extern rtx clear_storage (rtx, rtx, enum block_op_methods); +extern rtx clear_storage_hints (rtx, rtx, enum block_op_methods, + unsigned int, HOST_WIDE_INT, + unsigned HOST_WIDE_INT, + unsigned HOST_WIDE_INT, + unsigned HOST_WIDE_INT); +/* The same, but always output an library call. */ +extern rtx set_storage_via_libcall (rtx, rtx, rtx, bool = false); + +/* Expand a setmem pattern; return true if successful. */ +extern bool set_storage_via_setmem (rtx, rtx, rtx, unsigned int, + unsigned int, HOST_WIDE_INT, + unsigned HOST_WIDE_INT, + unsigned HOST_WIDE_INT, + unsigned HOST_WIDE_INT); + +/* Return nonzero if it is desirable to store LEN bytes generated by + CONSTFUN with several move instructions by store_by_pieces + function. CONSTFUNDATA is a pointer which will be passed as argument + in every CONSTFUN call. + ALIGN is maximum alignment we can assume. + MEMSETP is true if this is a real memset/bzero, not a copy + of a const string. */ +extern int can_store_by_pieces (unsigned HOST_WIDE_INT, + by_pieces_constfn, + void *, unsigned int, bool); + +/* Generate several move instructions to store LEN bytes generated by + CONSTFUN to block TO. (A MEM rtx with BLKmode). CONSTFUNDATA is a + pointer which will be passed as argument in every CONSTFUN call. + ALIGN is maximum alignment we can assume. + MEMSETP is true if this is a real memset/bzero, not a copy. + Returns TO + LEN. */ +extern rtx store_by_pieces (rtx, unsigned HOST_WIDE_INT, by_pieces_constfn, + void *, unsigned int, bool, int); + +/* Emit insns to set X from Y. */ +extern rtx_insn *emit_move_insn (rtx, rtx); +extern rtx_insn *gen_move_insn (rtx, rtx); + +/* Emit insns to set X from Y, with no frills. */ +extern rtx_insn *emit_move_insn_1 (rtx, rtx); + +extern rtx_insn *emit_move_complex_push (machine_mode, rtx, rtx); +extern rtx_insn *emit_move_complex_parts (rtx, rtx); +extern rtx read_complex_part (rtx, bool); +extern void write_complex_part (rtx, rtx, bool); +extern rtx read_complex_part (rtx, bool); +extern rtx emit_move_resolve_push (machine_mode, rtx); + +/* Push a block of length SIZE (perhaps variable) + and return an rtx to address the beginning of the block. */ +extern rtx push_block (rtx, int, int); + +/* Generate code to push something onto the stack, given its mode and type. */ +extern bool emit_push_insn (rtx, machine_mode, tree, rtx, unsigned int, + int, rtx, int, rtx, rtx, int, rtx, bool); + +/* Extract the accessible bit-range from a COMPONENT_REF. */ +extern void get_bit_range (unsigned HOST_WIDE_INT *, unsigned HOST_WIDE_INT *, + tree, HOST_WIDE_INT *, tree *); + +/* Expand an assignment that stores the value of FROM into TO. */ +extern void expand_assignment (tree, tree, bool); + +/* Generate code for computing expression EXP, + and storing the value into TARGET. + If SUGGEST_REG is nonzero, copy the value through a register + and return that register, if that is possible. */ +extern rtx store_expr_with_bounds (tree, rtx, int, bool, bool, tree); +extern rtx store_expr (tree, rtx, int, bool, bool); + +/* Given an rtx that may include add and multiply operations, + generate them as insns and return a pseudo-reg containing the value. + Useful after calling expand_expr with 1 as sum_ok. */ +extern rtx force_operand (rtx, rtx); + +/* Work horses for expand_expr. */ +extern rtx expand_expr_real (tree, rtx, machine_mode, + enum expand_modifier, rtx *, bool); +extern rtx expand_expr_real_1 (tree, rtx, machine_mode, + enum expand_modifier, rtx *, bool); +extern rtx expand_expr_real_2 (sepops, rtx, machine_mode, + enum expand_modifier); + +/* Generate code for computing expression EXP. + An rtx for the computed value is returned. The value is never null. + In the case of a void EXP, const0_rtx is returned. */ +static inline rtx +expand_expr (tree exp, rtx target, machine_mode mode, + enum expand_modifier modifier) +{ + return expand_expr_real (exp, target, mode, modifier, NULL, false); +} + +static inline rtx +expand_normal (tree exp) +{ + return expand_expr_real (exp, NULL_RTX, VOIDmode, EXPAND_NORMAL, NULL, false); +} + + +/* Return the tree node and offset if a given argument corresponds to + a string constant. */ +extern tree string_constant (tree, tree *); + +/* Two different ways of generating switch statements. */ +extern int try_casesi (tree, tree, tree, tree, rtx, rtx, rtx, int); +extern int try_tablejump (tree, tree, tree, tree, rtx, rtx, int); + +extern int safe_from_p (const_rtx, tree, int); + +/* Get the personality libfunc for a function decl. */ +rtx get_personality_function (tree); + +/* Determine whether the LEN bytes can be moved by using several move + instructions. Return nonzero if a call to move_by_pieces should + succeed. */ +extern bool can_move_by_pieces (unsigned HOST_WIDE_INT, unsigned int); + +extern unsigned HOST_WIDE_INT highest_pow2_factor (const_tree); + +extern bool categorize_ctor_elements (const_tree, HOST_WIDE_INT *, + HOST_WIDE_INT *, bool *); + +extern void expand_operands (tree, tree, rtx, rtx*, rtx*, + enum expand_modifier); + +/* rtl.h and tree.h were included. */ +/* Return an rtx for the size in bytes of the value of an expr. */ +extern rtx expr_size (tree); + +#endif /* GCC_EXPR_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/fibonacci_heap.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/fibonacci_heap.h new file mode 100644 index 0000000..554a142 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/fibonacci_heap.h @@ -0,0 +1,651 @@ +/* Fibonacci heap for GNU compiler. + Copyright (C) 1998-2017 Free Software Foundation, Inc. + Contributed by Daniel Berlin (dan@cgsoftware.com). + Re-implemented in C++ by Martin Liska + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* Fibonacci heaps are somewhat complex, but, there's an article in + DDJ that explains them pretty well: + + http://www.ddj.com/articles/1997/9701/9701o/9701o.htm?topic=algoritms + + Introduction to algorithms by Corman and Rivest also goes over them. + + The original paper that introduced them is "Fibonacci heaps and their + uses in improved network optimization algorithms" by Tarjan and + Fredman (JACM 34(3), July 1987). + + Amortized and real worst case time for operations: + + ExtractMin: O(lg n) amortized. O(n) worst case. + DecreaseKey: O(1) amortized. O(lg n) worst case. + Insert: O(1) amortized. + Union: O(1) amortized. */ + +#ifndef GCC_FIBONACCI_HEAP_H +#define GCC_FIBONACCI_HEAP_H + +/* Forward definition. */ + +template +class fibonacci_heap; + +/* Fibonacci heap node class. */ + +template +class fibonacci_node +{ + typedef fibonacci_node fibonacci_node_t; + friend class fibonacci_heap; + +public: + /* Default constructor. */ + fibonacci_node (): m_parent (NULL), m_child (NULL), m_left (this), + m_right (this), m_degree (0), m_mark (0) + { + } + + /* Constructor for a node with given KEY. */ + fibonacci_node (K key, V *data = NULL): m_parent (NULL), m_child (NULL), + m_left (this), m_right (this), m_key (key), m_data (data), + m_degree (0), m_mark (0) + { + } + + /* Compare fibonacci node with OTHER node. */ + int compare (fibonacci_node_t *other) + { + if (m_key < other->m_key) + return -1; + if (m_key > other->m_key) + return 1; + return 0; + } + + /* Compare the node with a given KEY. */ + int compare_data (K key) + { + return fibonacci_node_t (key).compare (this); + } + + /* Remove fibonacci heap node. */ + fibonacci_node_t *remove (); + + /* Link the node with PARENT. */ + void link (fibonacci_node_t *parent); + + /* Return key associated with the node. */ + K get_key () + { + return m_key; + } + + /* Return data associated with the node. */ + V *get_data () + { + return m_data; + } + +private: + /* Put node B after this node. */ + void insert_after (fibonacci_node_t *b); + + /* Insert fibonacci node B after this node. */ + void insert_before (fibonacci_node_t *b) + { + m_left->insert_after (b); + } + + /* Parent node. */ + fibonacci_node *m_parent; + /* Child node. */ + fibonacci_node *m_child; + /* Left sibling. */ + fibonacci_node *m_left; + /* Right node. */ + fibonacci_node *m_right; + /* Key associated with node. */ + K m_key; + /* Data associated with node. */ + V *m_data; + +#if defined (__GNUC__) && (!defined (SIZEOF_INT) || SIZEOF_INT < 4) + /* Degree of the node. */ + __extension__ unsigned long int m_degree : 31; + /* Mark of the node. */ + __extension__ unsigned long int m_mark : 1; +#else + /* Degree of the node. */ + unsigned int m_degree : 31; + /* Mark of the node. */ + unsigned int m_mark : 1; +#endif +}; + +/* Fibonacci heap class. */ +template +class fibonacci_heap +{ + typedef fibonacci_node fibonacci_node_t; + friend class fibonacci_node; + +public: + /* Default constructor. */ + fibonacci_heap (K global_min_key): m_nodes (0), m_min (NULL), m_root (NULL), + m_global_min_key (global_min_key) + { + } + + /* Destructor. */ + ~fibonacci_heap () + { + while (m_min != NULL) + delete (extract_minimum_node ()); + } + + /* Insert new node given by KEY and DATA associated with the key. */ + fibonacci_node_t *insert (K key, V *data); + + /* Return true if no entry is present. */ + bool empty () + { + return m_nodes == 0; + } + + /* Return the number of nodes. */ + size_t nodes () + { + return m_nodes; + } + + /* Return minimal key presented in the heap. */ + K min_key () + { + if (m_min == NULL) + gcc_unreachable (); + + return m_min->m_key; + } + + /* For given NODE, set new KEY value. */ + K replace_key (fibonacci_node_t *node, K key) + { + K okey = node->m_key; + + replace_key_data (node, key, node->m_data); + return okey; + } + + /* For given NODE, decrease value to new KEY. */ + K decrease_key (fibonacci_node_t *node, K key) + { + gcc_assert (key <= node->m_key); + return replace_key (node, key); + } + + /* For given NODE, set new KEY and DATA value. */ + V *replace_key_data (fibonacci_node_t *node, K key, V *data); + + /* Extract minimum node in the heap. If RELEASE is specified, + memory is released. */ + V *extract_min (bool release = true); + + /* Return value associated with minimum node in the heap. */ + V *min () + { + if (m_min == NULL) + return NULL; + + return m_min->m_data; + } + + /* Replace data associated with NODE and replace it with DATA. */ + V *replace_data (fibonacci_node_t *node, V *data) + { + return replace_key_data (node, node->m_key, data); + } + + /* Delete NODE in the heap. */ + V *delete_node (fibonacci_node_t *node, bool release = true); + + /* Union the heap with HEAPB. */ + fibonacci_heap *union_with (fibonacci_heap *heapb); + +private: + /* Insert new NODE given by KEY and DATA associated with the key. */ + fibonacci_node_t *insert (fibonacci_node_t *node, K key, V *data); + + /* Insert new NODE that has already filled key and value. */ + fibonacci_node_t *insert_node (fibonacci_node_t *node); + + /* Insert it into the root list. */ + void insert_root (fibonacci_node_t *node); + + /* Remove NODE from PARENT's child list. */ + void cut (fibonacci_node_t *node, fibonacci_node_t *parent); + + /* Process cut of node Y and do it recursivelly. */ + void cascading_cut (fibonacci_node_t *y); + + /* Extract minimum node from the heap. */ + fibonacci_node_t * extract_minimum_node (); + + /* Remove root NODE from the heap. */ + void remove_root (fibonacci_node_t *node); + + /* Consolidate heap. */ + void consolidate (); + + /* Number of nodes. */ + size_t m_nodes; + /* Minimum node of the heap. */ + fibonacci_node_t *m_min; + /* Root node of the heap. */ + fibonacci_node_t *m_root; + /* Global minimum given in the heap construction. */ + K m_global_min_key; +}; + +/* Remove fibonacci heap node. */ + +template +fibonacci_node * +fibonacci_node::remove () +{ + fibonacci_node *ret; + + if (this == m_left) + ret = NULL; + else + ret = m_left; + + if (m_parent != NULL && m_parent->m_child == this) + m_parent->m_child = ret; + + m_right->m_left = m_left; + m_left->m_right = m_right; + + m_parent = NULL; + m_left = this; + m_right = this; + + return ret; +} + +/* Link the node with PARENT. */ + +template +void +fibonacci_node::link (fibonacci_node *parent) +{ + if (parent->m_child == NULL) + parent->m_child = this; + else + parent->m_child->insert_before (this); + m_parent = parent; + parent->m_degree++; + m_mark = 0; +} + +/* Put node B after this node. */ + +template +void +fibonacci_node::insert_after (fibonacci_node *b) +{ + fibonacci_node *a = this; + + if (a == a->m_right) + { + a->m_right = b; + a->m_left = b; + b->m_right = a; + b->m_left = a; + } + else + { + b->m_right = a->m_right; + a->m_right->m_left = b; + a->m_right = b; + b->m_left = a; + } +} + +/* Insert new node given by KEY and DATA associated with the key. */ + +template +fibonacci_node* +fibonacci_heap::insert (K key, V *data) +{ + /* Create the new node. */ + fibonacci_node *node = new fibonacci_node_t (key, data); + + return insert_node (node); +} + +/* Insert new NODE given by DATA associated with the key. */ + +template +fibonacci_node* +fibonacci_heap::insert (fibonacci_node_t *node, K key, V *data) +{ + /* Set the node's data. */ + node->m_data = data; + node->m_key = key; + + return insert_node (node); +} + +/* Insert new NODE that has already filled key and value. */ + +template +fibonacci_node* +fibonacci_heap::insert_node (fibonacci_node_t *node) +{ + /* Insert it into the root list. */ + insert_root (node); + + /* If their was no minimum, or this key is less than the min, + it's the new min. */ + if (m_min == NULL || node->m_key < m_min->m_key) + m_min = node; + + m_nodes++; + + return node; +} + +/* For given NODE, set new KEY and DATA value. */ + +template +V* +fibonacci_heap::replace_key_data (fibonacci_node *node, K key, + V *data) +{ + K okey; + fibonacci_node *y; + V *odata = node->m_data; + + /* If we wanted to, we do a real increase by redeleting and + inserting. */ + if (node->compare_data (key) > 0) + { + delete_node (node, false); + + node = new (node) fibonacci_node_t (); + insert (node, key, data); + + return odata; + } + + okey = node->m_key; + node->m_data = data; + node->m_key = key; + y = node->m_parent; + + /* Short-circuit if the key is the same, as we then don't have to + do anything. Except if we're trying to force the new node to + be the new minimum for delete. */ + if (okey == key && okey != m_global_min_key) + return odata; + + /* These two compares are specifically <= 0 to make sure that in the case + of equality, a node we replaced the data on, becomes the new min. This + is needed so that delete's call to extractmin gets the right node. */ + if (y != NULL && node->compare (y) <= 0) + { + cut (node, y); + cascading_cut (y); + } + + if (node->compare (m_min) <= 0) + m_min = node; + + return odata; +} + +/* Extract minimum node in the heap. Delete fibonacci node if RELEASE + is true. */ + +template +V* +fibonacci_heap::extract_min (bool release) +{ + fibonacci_node *z; + V *ret = NULL; + + /* If we don't have a min set, it means we have no nodes. */ + if (m_min != NULL) + { + /* Otherwise, extract the min node, free the node, and return the + node's data. */ + z = extract_minimum_node (); + ret = z->m_data; + + if (release) + delete (z); + } + + return ret; +} + +/* Delete NODE in the heap, if RELEASE is specified memory is released. */ + +template +V* +fibonacci_heap::delete_node (fibonacci_node *node, bool release) +{ + V *ret = node->m_data; + + /* To perform delete, we just make it the min key, and extract. */ + replace_key (node, m_global_min_key); + if (node != m_min) + { + fprintf (stderr, "Can't force minimum on fibheap.\n"); + abort (); + } + extract_min (release); + + return ret; +} + +/* Union the heap with HEAPB. One of the heaps is going to be deleted. */ + +template +fibonacci_heap* +fibonacci_heap::union_with (fibonacci_heap *heapb) +{ + fibonacci_heap *heapa = this; + + fibonacci_node *a_root, *b_root; + + /* If one of the heaps is empty, the union is just the other heap. */ + if ((a_root = heapa->m_root) == NULL) + { + delete (heapa); + return heapb; + } + if ((b_root = heapb->m_root) == NULL) + { + delete (heapb); + return heapa; + } + + /* Merge them to the next nodes on the opposite chain. */ + a_root->m_left->m_right = b_root; + b_root->m_left->m_right = a_root; + std::swap (a_root->m_left, b_root->m_left); + heapa->m_nodes += heapb->m_nodes; + + /* And set the new minimum, if it's changed. */ + if (heapb->m_min->compare (heapa->m_min) < 0) + heapa->m_min = heapb->m_min; + + /* Set m_min to NULL to not to delete live fibonacci nodes. */ + heapb->m_min = NULL; + delete (heapb); + + return heapa; +} + +/* Insert it into the root list. */ + +template +void +fibonacci_heap::insert_root (fibonacci_node_t *node) +{ + /* If the heap is currently empty, the new node becomes the singleton + circular root list. */ + if (m_root == NULL) + { + m_root = node; + node->m_left = node; + node->m_right = node; + return; + } + + /* Otherwise, insert it in the circular root list between the root + and it's right node. */ + m_root->insert_after (node); +} + +/* Remove NODE from PARENT's child list. */ + +template +void +fibonacci_heap::cut (fibonacci_node *node, + fibonacci_node *parent) +{ + node->remove (); + parent->m_degree--; + insert_root (node); + node->m_parent = NULL; + node->m_mark = 0; +} + +/* Process cut of node Y and do it recursivelly. */ + +template +void +fibonacci_heap::cascading_cut (fibonacci_node *y) +{ + fibonacci_node *z; + + while ((z = y->m_parent) != NULL) + { + if (y->m_mark == 0) + { + y->m_mark = 1; + return; + } + else + { + cut (y, z); + y = z; + } + } +} + +/* Extract minimum node from the heap. */ + +template +fibonacci_node* +fibonacci_heap::extract_minimum_node () +{ + fibonacci_node *ret = m_min; + fibonacci_node *x, *y, *orig; + + /* Attach the child list of the minimum node to the root list of the heap. + If there is no child list, we don't do squat. */ + for (x = ret->m_child, orig = NULL; x != orig && x != NULL; x = y) + { + if (orig == NULL) + orig = x; + y = x->m_right; + x->m_parent = NULL; + insert_root (x); + } + + /* Remove the old root. */ + remove_root (ret); + m_nodes--; + + /* If we are left with no nodes, then the min is NULL. */ + if (m_nodes == 0) + m_min = NULL; + else + { + /* Otherwise, consolidate to find new minimum, as well as do the reorg + work that needs to be done. */ + m_min = ret->m_right; + consolidate (); + } + + return ret; +} + +/* Remove root NODE from the heap. */ + +template +void +fibonacci_heap::remove_root (fibonacci_node *node) +{ + if (node->m_left == node) + m_root = NULL; + else + m_root = node->remove (); +} + +/* Consolidate heap. */ + +template +void fibonacci_heap::consolidate () +{ + int D = 1 + 8 * sizeof (long); + auto_vec *> a (D); + a.safe_grow_cleared (D); + fibonacci_node *w, *x, *y; + int i, d; + + while ((w = m_root) != NULL) + { + x = w; + remove_root (w); + d = x->m_degree; + while (a[d] != NULL) + { + y = a[d]; + if (x->compare (y) > 0) + std::swap (x, y); + y->link (x); + a[d] = NULL; + d++; + } + a[d] = x; + } + m_min = NULL; + for (i = 0; i < D; i++) + if (a[i] != NULL) + { + insert_root (a[i]); + if (m_min == NULL || a[i]->compare (m_min) < 0) + m_min = a[i]; + } +} + +#endif // GCC_FIBONACCI_HEAP_H diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/file-find.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/file-find.h new file mode 100644 index 0000000..407feba --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/file-find.h @@ -0,0 +1,47 @@ +/* Prototypes and data structures used for implementing functions for + finding files relative to GCC binaries. + Copyright (C) 1992-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_FILE_FIND_H +#define GCC_FILE_FIND_H + +/* Structure to hold all the directories in which to search for files to + execute. */ + +struct prefix_list +{ + const char *prefix; /* String to prepend to the path. */ + struct prefix_list *next; /* Next in linked list. */ +}; + +struct path_prefix +{ + struct prefix_list *plist; /* List of prefixes to try */ + int max_len; /* Max length of a prefix in PLIST */ + const char *name; /* Name of this list (used in config stuff) */ +}; + +extern void find_file_set_debug (bool); +extern char *find_a_file (struct path_prefix *, const char *, int); +extern void add_prefix (struct path_prefix *, const char *); +extern void add_prefix_begin (struct path_prefix *, const char *); +extern void prefix_from_env (const char *, struct path_prefix *); +extern void prefix_from_string (const char *, struct path_prefix *); + +#endif /* GCC_FILE_FIND_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/filenames.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/filenames.h new file mode 100644 index 0000000..5a2a055 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/filenames.h @@ -0,0 +1,99 @@ +/* Macros for taking apart, interpreting and processing file names. + + These are here because some non-Posix (a.k.a. DOSish) systems have + drive letter brain-damage at the beginning of an absolute file name, + use forward- and back-slash in path names interchangeably, and + some of them have case-insensitive file names. + + Copyright (C) 2000-2017 Free Software Foundation, Inc. + +This file is part of BFD, the Binary File Descriptor library. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef FILENAMES_H +#define FILENAMES_H + +#include "hashtab.h" /* for hashval_t */ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__) +# ifndef HAVE_DOS_BASED_FILE_SYSTEM +# define HAVE_DOS_BASED_FILE_SYSTEM 1 +# endif +# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM +# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1 +# endif +# define HAS_DRIVE_SPEC(f) HAS_DOS_DRIVE_SPEC (f) +# define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c) +# define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f) +#else /* not DOSish */ +# if defined(__APPLE__) +# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM +# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1 +# endif +# endif /* __APPLE__ */ +# define HAS_DRIVE_SPEC(f) (0) +# define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c) +# define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f) +#endif + +#define IS_DIR_SEPARATOR_1(dos_based, c) \ + (((c) == '/') \ + || (((c) == '\\') && (dos_based))) + +#define HAS_DRIVE_SPEC_1(dos_based, f) \ + ((f)[0] && ((f)[1] == ':') && (dos_based)) + +/* Remove the drive spec from F, assuming HAS_DRIVE_SPEC (f). + The result is a pointer to the remainder of F. */ +#define STRIP_DRIVE_SPEC(f) ((f) + 2) + +#define IS_DOS_DIR_SEPARATOR(c) IS_DIR_SEPARATOR_1 (1, c) +#define IS_DOS_ABSOLUTE_PATH(f) IS_ABSOLUTE_PATH_1 (1, f) +#define HAS_DOS_DRIVE_SPEC(f) HAS_DRIVE_SPEC_1 (1, f) + +#define IS_UNIX_DIR_SEPARATOR(c) IS_DIR_SEPARATOR_1 (0, c) +#define IS_UNIX_ABSOLUTE_PATH(f) IS_ABSOLUTE_PATH_1 (0, f) + +/* Note that when DOS_BASED is true, IS_ABSOLUTE_PATH accepts d:foo as + well, although it is only semi-absolute. This is because the users + of IS_ABSOLUTE_PATH want to know whether to prepend the current + working directory to a file name, which should not be done with a + name like d:foo. */ +#define IS_ABSOLUTE_PATH_1(dos_based, f) \ + (IS_DIR_SEPARATOR_1 (dos_based, (f)[0]) \ + || HAS_DRIVE_SPEC_1 (dos_based, f)) + +extern int filename_cmp (const char *s1, const char *s2); +#define FILENAME_CMP(s1, s2) filename_cmp(s1, s2) + +extern int filename_ncmp (const char *s1, const char *s2, + size_t n); + +extern hashval_t filename_hash (const void *s); + +extern int filename_eq (const void *s1, const void *s2); + +extern int canonical_filename_eq (const char *a, const char *b); + +#ifdef __cplusplus +} +#endif + +#endif /* FILENAMES_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/fixed-value.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/fixed-value.h new file mode 100644 index 0000000..608c872 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/fixed-value.h @@ -0,0 +1,112 @@ +/* Fixed-point arithmetic support. + Copyright (C) 2006-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_FIXED_VALUE_H +#define GCC_FIXED_VALUE_H + +struct GTY(()) fixed_value +{ + double_int data; /* Store data up to 2 wide integers. */ + machine_mode mode; /* Use machine mode to know IBIT and FBIT. */ +}; + +#define FIXED_VALUE_TYPE struct fixed_value + +#define MAX_FCONST0 18 /* For storing 18 fixed-point zeros per + fract, ufract, accum, and uaccum modes . */ +#define MAX_FCONST1 8 /* For storing 8 fixed-point ones per accum + and uaccum modes. */ +/* Constant fixed-point values 0 and 1. */ +extern FIXED_VALUE_TYPE fconst0[MAX_FCONST0]; +extern FIXED_VALUE_TYPE fconst1[MAX_FCONST1]; + +/* Macros to access fconst0 and fconst1 via machine modes. */ +#define FCONST0(mode) fconst0[mode - QQmode] +#define FCONST1(mode) fconst1[mode - HAmode] + +/* Return a CONST_FIXED with value R and mode M. */ +#define CONST_FIXED_FROM_FIXED_VALUE(r, m) \ + const_fixed_from_fixed_value (r, m) +extern rtx const_fixed_from_fixed_value (FIXED_VALUE_TYPE, machine_mode); + +/* Construct a FIXED_VALUE from a bit payload and machine mode MODE. + The bits in PAYLOAD are sign-extended/zero-extended according to MODE. */ +extern FIXED_VALUE_TYPE fixed_from_double_int (double_int, + machine_mode); + +/* Return a CONST_FIXED from a bit payload and machine mode MODE. + The bits in PAYLOAD are sign-extended/zero-extended according to MODE. */ +static inline rtx +const_fixed_from_double_int (double_int payload, + machine_mode mode) +{ + return + const_fixed_from_fixed_value (fixed_from_double_int (payload, mode), + mode); +} + +/* Initialize from a decimal or hexadecimal string. */ +extern void fixed_from_string (FIXED_VALUE_TYPE *, const char *, + machine_mode); + +/* In tree.c: wrap up a FIXED_VALUE_TYPE in a tree node. */ +extern tree build_fixed (tree, FIXED_VALUE_TYPE); + +/* Extend or truncate to a new mode. */ +extern bool fixed_convert (FIXED_VALUE_TYPE *, machine_mode, + const FIXED_VALUE_TYPE *, bool); + +/* Convert to a fixed-point mode from an integer. */ +extern bool fixed_convert_from_int (FIXED_VALUE_TYPE *, machine_mode, + double_int, bool, bool); + +/* Convert to a fixed-point mode from a real. */ +extern bool fixed_convert_from_real (FIXED_VALUE_TYPE *, machine_mode, + const REAL_VALUE_TYPE *, bool); + +/* Convert to a real mode from a fixed-point. */ +extern void real_convert_from_fixed (REAL_VALUE_TYPE *, machine_mode, + const FIXED_VALUE_TYPE *); + +/* Compare two fixed-point objects for bitwise identity. */ +extern bool fixed_identical (const FIXED_VALUE_TYPE *, const FIXED_VALUE_TYPE *); + +/* Calculate a hash value. */ +extern unsigned int fixed_hash (const FIXED_VALUE_TYPE *); + +#define FIXED_VALUES_IDENTICAL(x, y) fixed_identical (&(x), &(y)) + +/* Determine whether a fixed-point value X is negative. */ +#define FIXED_VALUE_NEGATIVE(x) fixed_isneg (&(x)) + +/* Render F as a decimal floating point constant. */ +extern void fixed_to_decimal (char *str, const FIXED_VALUE_TYPE *, size_t); + +/* Binary or unary arithmetic on tree_code. */ +extern bool fixed_arithmetic (FIXED_VALUE_TYPE *, int, const FIXED_VALUE_TYPE *, + const FIXED_VALUE_TYPE *, bool); + +/* Compare fixed-point values by tree_code. */ +extern bool fixed_compare (int, const FIXED_VALUE_TYPE *, + const FIXED_VALUE_TYPE *); + +/* Determine whether a fixed-point value X is negative. */ +extern bool fixed_isneg (const FIXED_VALUE_TYPE *); + +#endif /* GCC_FIXED_VALUE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/flag-types.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/flag-types.h new file mode 100644 index 0000000..27a38ef --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/flag-types.h @@ -0,0 +1,311 @@ +/* Compilation switch flag type definitions for GCC. + Copyright (C) 1987-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_FLAG_TYPES_H +#define GCC_FLAG_TYPES_H + +enum debug_info_type +{ + NO_DEBUG, /* Write no debug info. */ + DBX_DEBUG, /* Write BSD .stabs for DBX (using dbxout.c). */ + SDB_DEBUG, /* Write COFF for (old) SDB (using sdbout.c). */ + DWARF2_DEBUG, /* Write Dwarf v2 debug info (using dwarf2out.c). */ + XCOFF_DEBUG, /* Write IBM/Xcoff debug info (using dbxout.c). */ + VMS_DEBUG, /* Write VMS debug info (using vmsdbgout.c). */ + VMS_AND_DWARF2_DEBUG /* Write VMS debug info (using vmsdbgout.c). + and DWARF v2 debug info (using dwarf2out.c). */ +}; + +enum debug_info_levels +{ + DINFO_LEVEL_NONE, /* Write no debugging info. */ + DINFO_LEVEL_TERSE, /* Write minimal info to support tracebacks only. */ + DINFO_LEVEL_NORMAL, /* Write info for all declarations (and line table). */ + DINFO_LEVEL_VERBOSE /* Write normal info plus #define/#undef info. */ +}; + +/* A major contribution to object and executable size is debug + information size. A major contribution to debug information + size is struct descriptions replicated in several object files. + The following function determines whether or not debug information + should be generated for a given struct. The indirect parameter + indicates that the struct is being handled indirectly, via + a pointer. See opts.c for the implementation. */ + +enum debug_info_usage +{ + DINFO_USAGE_DFN, /* A struct definition. */ + DINFO_USAGE_DIR_USE, /* A direct use, such as the type of a variable. */ + DINFO_USAGE_IND_USE, /* An indirect use, such as through a pointer. */ + DINFO_USAGE_NUM_ENUMS /* The number of enumerators. */ +}; + +/* A major contribution to object and executable size is debug + information size. A major contribution to debug information size + is struct descriptions replicated in several object files. The + following flags attempt to reduce this information. The basic + idea is to not emit struct debugging information in the current + compilation unit when that information will be generated by + another compilation unit. + + Debug information for a struct defined in the current source + file should be generated in the object file. Likewise the + debug information for a struct defined in a header should be + generated in the object file of the corresponding source file. + Both of these case are handled when the base name of the file of + the struct definition matches the base name of the source file + of the current compilation unit. This matching emits minimal + struct debugging information. + + The base file name matching rule above will fail to emit debug + information for structs defined in system headers. So a second + category of files includes system headers in addition to files + with matching bases. + + The remaining types of files are library headers and application + headers. We cannot currently distinguish these two types. */ + +enum debug_struct_file +{ + DINFO_STRUCT_FILE_NONE, /* Debug no structs. */ + DINFO_STRUCT_FILE_BASE, /* Debug structs defined in files with the + same base name as the compilation unit. */ + DINFO_STRUCT_FILE_SYS, /* Also debug structs defined in system + header files. */ + DINFO_STRUCT_FILE_ANY /* Debug structs defined in all files. */ +}; + +/* Balance between GNAT encodings and standard DWARF to emit. */ + +enum dwarf_gnat_encodings +{ + DWARF_GNAT_ENCODINGS_ALL = 0, /* Emit all GNAT encodings, then emit as + much standard DWARF as possible so it + does not conflict with GNAT + encodings. */ + DWARF_GNAT_ENCODINGS_GDB = 1, /* Emit as much standard DWARF as possible + as long as GDB handles them. Emit GNAT + encodings for the rest. */ + DWARF_GNAT_ENCODINGS_MINIMAL = 2 /* Emit all the standard DWARF we can. + Emit GNAT encodings for the rest. */ +}; + +/* Enumerate Objective-c instance variable visibility settings. */ + +enum ivar_visibility +{ + IVAR_VISIBILITY_PRIVATE, + IVAR_VISIBILITY_PROTECTED, + IVAR_VISIBILITY_PUBLIC, + IVAR_VISIBILITY_PACKAGE +}; + +/* The stack reuse level. */ +enum stack_reuse_level +{ + SR_NONE, + SR_NAMED_VARS, + SR_ALL +}; + +/* The algorithm used for basic block reordering. */ +enum reorder_blocks_algorithm +{ + REORDER_BLOCKS_ALGORITHM_SIMPLE, + REORDER_BLOCKS_ALGORITHM_STC +}; + +/* The algorithm used for the integrated register allocator (IRA). */ +enum ira_algorithm +{ + IRA_ALGORITHM_CB, + IRA_ALGORITHM_PRIORITY +}; + +/* The regions used for the integrated register allocator (IRA). */ +enum ira_region +{ + IRA_REGION_ONE, + IRA_REGION_ALL, + IRA_REGION_MIXED, + /* This value means that there were no options -fira-region on the + command line and that we should choose a value depending on the + used -O option. */ + IRA_REGION_AUTODETECT +}; + +/* The options for excess precision. */ +enum excess_precision +{ + EXCESS_PRECISION_DEFAULT, + EXCESS_PRECISION_FAST, + EXCESS_PRECISION_STANDARD +}; + +/* The options for which values of FLT_EVAL_METHOD are permissible. */ +enum permitted_flt_eval_methods +{ + PERMITTED_FLT_EVAL_METHODS_DEFAULT, + PERMITTED_FLT_EVAL_METHODS_TS_18661, + PERMITTED_FLT_EVAL_METHODS_C11 +}; + +/* Type of stack check. */ +enum stack_check_type +{ + /* Do not check the stack. */ + NO_STACK_CHECK = 0, + + /* Check the stack generically, i.e. assume no specific support + from the target configuration files. */ + GENERIC_STACK_CHECK, + + /* Check the stack and rely on the target configuration files to + check the static frame of functions, i.e. use the generic + mechanism only for dynamic stack allocations. */ + STATIC_BUILTIN_STACK_CHECK, + + /* Check the stack and entirely rely on the target configuration + files, i.e. do not use the generic mechanism at all. */ + FULL_BUILTIN_STACK_CHECK +}; + +/* Floating-point contraction mode. */ +enum fp_contract_mode { + FP_CONTRACT_OFF = 0, + FP_CONTRACT_ON = 1, + FP_CONTRACT_FAST = 2 +}; + +/* Scalar storage order kind. */ +enum scalar_storage_order_kind { + SSO_NATIVE = 0, + SSO_BIG_ENDIAN, + SSO_LITTLE_ENDIAN +}; + +/* Vectorizer cost-model. */ +enum vect_cost_model { + VECT_COST_MODEL_UNLIMITED = 0, + VECT_COST_MODEL_CHEAP = 1, + VECT_COST_MODEL_DYNAMIC = 2, + VECT_COST_MODEL_DEFAULT = 3 +}; + +/* Different instrumentation modes. */ +enum sanitize_code { + /* AddressSanitizer. */ + SANITIZE_ADDRESS = 1UL << 0, + SANITIZE_USER_ADDRESS = 1UL << 1, + SANITIZE_KERNEL_ADDRESS = 1UL << 2, + /* ThreadSanitizer. */ + SANITIZE_THREAD = 1UL << 3, + /* LeakSanitizer. */ + SANITIZE_LEAK = 1UL << 4, + /* UndefinedBehaviorSanitizer. */ + SANITIZE_SHIFT_BASE = 1UL << 5, + SANITIZE_SHIFT_EXPONENT = 1UL << 6, + SANITIZE_DIVIDE = 1UL << 7, + SANITIZE_UNREACHABLE = 1UL << 8, + SANITIZE_VLA = 1UL << 9, + SANITIZE_NULL = 1UL << 10, + SANITIZE_RETURN = 1UL << 11, + SANITIZE_SI_OVERFLOW = 1UL << 12, + SANITIZE_BOOL = 1UL << 13, + SANITIZE_ENUM = 1UL << 14, + SANITIZE_FLOAT_DIVIDE = 1UL << 15, + SANITIZE_FLOAT_CAST = 1UL << 16, + SANITIZE_BOUNDS = 1UL << 17, + SANITIZE_ALIGNMENT = 1UL << 18, + SANITIZE_NONNULL_ATTRIBUTE = 1UL << 19, + SANITIZE_RETURNS_NONNULL_ATTRIBUTE = 1UL << 20, + SANITIZE_OBJECT_SIZE = 1UL << 21, + SANITIZE_VPTR = 1UL << 22, + SANITIZE_BOUNDS_STRICT = 1UL << 23, + SANITIZE_SHIFT = SANITIZE_SHIFT_BASE | SANITIZE_SHIFT_EXPONENT, + SANITIZE_UNDEFINED = SANITIZE_SHIFT | SANITIZE_DIVIDE | SANITIZE_UNREACHABLE + | SANITIZE_VLA | SANITIZE_NULL | SANITIZE_RETURN + | SANITIZE_SI_OVERFLOW | SANITIZE_BOOL | SANITIZE_ENUM + | SANITIZE_BOUNDS | SANITIZE_ALIGNMENT + | SANITIZE_NONNULL_ATTRIBUTE + | SANITIZE_RETURNS_NONNULL_ATTRIBUTE + | SANITIZE_OBJECT_SIZE | SANITIZE_VPTR, + SANITIZE_NONDEFAULT = SANITIZE_FLOAT_DIVIDE | SANITIZE_FLOAT_CAST + | SANITIZE_BOUNDS_STRICT +}; + +/* flag_vtable_verify initialization levels. */ +enum vtv_priority { + VTV_NO_PRIORITY = 0, /* i.E. Do NOT do vtable verification. */ + VTV_STANDARD_PRIORITY = 1, + VTV_PREINIT_PRIORITY = 2 +}; + +/* flag_lto_partition initialization values. */ +enum lto_partition_model { + LTO_PARTITION_NONE = 0, + LTO_PARTITION_ONE = 1, + LTO_PARTITION_BALANCED = 2, + LTO_PARTITION_1TO1 = 3, + LTO_PARTITION_MAX = 4 +}; + +/* flag_lto_linker_output initialization values. */ +enum lto_linker_output { + LTO_LINKER_OUTPUT_UNKNOWN, + LTO_LINKER_OUTPUT_REL, + LTO_LINKER_OUTPUT_DYN, + LTO_LINKER_OUTPUT_PIE, + LTO_LINKER_OUTPUT_EXEC +}; + +/* gfortran -finit-real= values. */ + +enum gfc_init_local_real +{ + GFC_INIT_REAL_OFF = 0, + GFC_INIT_REAL_ZERO, + GFC_INIT_REAL_NAN, + GFC_INIT_REAL_SNAN, + GFC_INIT_REAL_INF, + GFC_INIT_REAL_NEG_INF +}; + +/* gfortran -fcoarray= values. */ + +enum gfc_fcoarray +{ + GFC_FCOARRAY_NONE = 0, + GFC_FCOARRAY_SINGLE, + GFC_FCOARRAY_LIB +}; + + +/* gfortran -fconvert= values; used for unformatted I/O. + Keep in sync with GFC_CONVERT_* in gcc/fortran/libgfortran.h. */ +enum gfc_convert +{ + GFC_FLAG_CONVERT_NATIVE = 0, + GFC_FLAG_CONVERT_SWAP, + GFC_FLAG_CONVERT_BIG, + GFC_FLAG_CONVERT_LITTLE +}; + + +#endif /* ! GCC_FLAG_TYPES_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/flags.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/flags.h new file mode 100644 index 0000000..59f45d2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/flags.h @@ -0,0 +1,98 @@ +/* Compilation switch flag definitions for GCC. + Copyright (C) 1987-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_FLAGS_H +#define GCC_FLAGS_H + +#if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) && !defined(IN_RTS) + +/* Names of debug_info_type, for error messages. */ +extern const char *const debug_type_names[]; + +extern void strip_off_ending (char *, int); +extern int base_of_path (const char *path, const char **base_out); + +/* Return true iff flags are set as if -ffast-math. */ +extern bool fast_math_flags_set_p (const struct gcc_options *); +extern bool fast_math_flags_struct_set_p (struct cl_optimization *); + + +/* Now the symbols that are set with `-f' switches. */ + +/* True if printing into -fdump-final-insns= dump. */ + +extern bool final_insns_dump_p; + + +/* Other basic status info about current function. */ + +/* Target-dependent global state. */ +struct target_flag_state { + /* Values of the -falign-* flags: how much to align labels in code. + 0 means `use default', 1 means `don't align'. + For each variable, there is an _log variant which is the power + of two not less than the variable, for .align output. */ + int x_align_loops_log; + int x_align_loops_max_skip; + int x_align_jumps_log; + int x_align_jumps_max_skip; + int x_align_labels_log; + int x_align_labels_max_skip; + int x_align_functions_log; + + /* The excess precision currently in effect. */ + enum excess_precision x_flag_excess_precision; +}; + +extern struct target_flag_state default_target_flag_state; +#if SWITCHABLE_TARGET +extern struct target_flag_state *this_target_flag_state; +#else +#define this_target_flag_state (&default_target_flag_state) +#endif + +#define align_loops_log \ + (this_target_flag_state->x_align_loops_log) +#define align_loops_max_skip \ + (this_target_flag_state->x_align_loops_max_skip) +#define align_jumps_log \ + (this_target_flag_state->x_align_jumps_log) +#define align_jumps_max_skip \ + (this_target_flag_state->x_align_jumps_max_skip) +#define align_labels_log \ + (this_target_flag_state->x_align_labels_log) +#define align_labels_max_skip \ + (this_target_flag_state->x_align_labels_max_skip) +#define align_functions_log \ + (this_target_flag_state->x_align_functions_log) +#define flag_excess_precision \ + (this_target_flag_state->x_flag_excess_precision) + +/* Returns TRUE if generated code should match ABI version N or + greater is in use. */ + +#define abi_version_at_least(N) \ + (flag_abi_version == 0 || flag_abi_version >= (N)) + +/* Whether to emit an overflow warning whose code is C. */ +#define issue_strict_overflow_warning(c) (warn_strict_overflow >= (int) (c)) + +#endif + +#endif /* ! GCC_FLAGS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/fold-const-call.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/fold-const-call.h new file mode 100644 index 0000000..7ca8a3c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/fold-const-call.h @@ -0,0 +1,29 @@ +/* Fold calls to built-in and internal functions with constant arguments. + Copyright (C) 2015-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_FOLD_CONST_CALL_H +#define GCC_FOLD_CONST_CALL_H + +tree fold_const_call (combined_fn, tree, tree); +tree fold_const_call (combined_fn, tree, tree, tree); +tree fold_const_call (combined_fn, tree, tree, tree, tree); +tree fold_fma (location_t, tree, tree, tree, tree); +tree build_cmp_result (tree type, int res); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/fold-const.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/fold-const.h new file mode 100644 index 0000000..4ba0e45 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/fold-const.h @@ -0,0 +1,207 @@ +/* Fold a constant sub-tree into a single node for C-compiler + Copyright (C) 1987-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_FOLD_CONST_H +#define GCC_FOLD_CONST_H + +/* Non-zero if we are folding constants inside an initializer; zero + otherwise. */ +extern int folding_initializer; + +/* Convert between trees and native memory representation. */ +extern int native_encode_expr (const_tree, unsigned char *, int, int off = -1); +extern tree native_interpret_expr (tree, const unsigned char *, int); +extern bool can_native_encode_type_p (tree); +extern bool can_native_encode_string_p (const_tree); + +/* Fold constants as much as possible in an expression. + Returns the simplified expression. + Acts only on the top level of the expression; + if the argument itself cannot be simplified, its + subexpressions are not changed. */ + +extern tree fold (tree); +#define fold_unary(CODE,T1,T2)\ + fold_unary_loc (UNKNOWN_LOCATION, CODE, T1, T2) +extern tree fold_unary_loc (location_t, enum tree_code, tree, tree); +#define fold_unary_ignore_overflow(CODE,T1,T2)\ + fold_unary_ignore_overflow_loc (UNKNOWN_LOCATION, CODE, T1, T2) +extern tree fold_unary_ignore_overflow_loc (location_t, enum tree_code, tree, tree); +#define fold_binary(CODE,T1,T2,T3)\ + fold_binary_loc (UNKNOWN_LOCATION, CODE, T1, T2, T3) +extern tree fold_binary_loc (location_t, enum tree_code, tree, tree, tree); +#define fold_ternary(CODE,T1,T2,T3,T4)\ + fold_ternary_loc (UNKNOWN_LOCATION, CODE, T1, T2, T3, T4) +extern tree fold_ternary_loc (location_t, enum tree_code, tree, tree, tree, tree); +#define fold_build1(c,t1,t2)\ + fold_build1_stat_loc (UNKNOWN_LOCATION, c, t1, t2 MEM_STAT_INFO) +#define fold_build1_loc(l,c,t1,t2)\ + fold_build1_stat_loc (l, c, t1, t2 MEM_STAT_INFO) +extern tree fold_build1_stat_loc (location_t, enum tree_code, tree, + tree MEM_STAT_DECL); +#define fold_build2(c,t1,t2,t3)\ + fold_build2_stat_loc (UNKNOWN_LOCATION, c, t1, t2, t3 MEM_STAT_INFO) +#define fold_build2_loc(l,c,t1,t2,t3)\ + fold_build2_stat_loc (l, c, t1, t2, t3 MEM_STAT_INFO) +extern tree fold_build2_stat_loc (location_t, enum tree_code, tree, tree, + tree MEM_STAT_DECL); +#define fold_build3(c,t1,t2,t3,t4)\ + fold_build3_stat_loc (UNKNOWN_LOCATION, c, t1, t2, t3, t4 MEM_STAT_INFO) +#define fold_build3_loc(l,c,t1,t2,t3,t4)\ + fold_build3_stat_loc (l, c, t1, t2, t3, t4 MEM_STAT_INFO) +extern tree fold_build3_stat_loc (location_t, enum tree_code, tree, tree, tree, + tree MEM_STAT_DECL); +extern tree fold_build1_initializer_loc (location_t, enum tree_code, tree, tree); +extern tree fold_build2_initializer_loc (location_t, enum tree_code, tree, tree, tree); +#define fold_build_call_array(T1,T2,N,T4)\ + fold_build_call_array_loc (UNKNOWN_LOCATION, T1, T2, N, T4) +extern tree fold_build_call_array_loc (location_t, tree, tree, int, tree *); +#define fold_build_call_array_initializer(T1,T2,N,T4)\ + fold_build_call_array_initializer_loc (UNKNOWN_LOCATION, T1, T2, N, T4) +extern tree fold_build_call_array_initializer_loc (location_t, tree, tree, int, tree *); +extern tree get_array_ctor_element_at_index (tree, offset_int); +extern bool fold_convertible_p (const_tree, const_tree); +#define fold_convert(T1,T2)\ + fold_convert_loc (UNKNOWN_LOCATION, T1, T2) +extern tree fold_convert_loc (location_t, tree, tree); +extern tree fold_single_bit_test (location_t, enum tree_code, tree, tree, tree); +extern tree fold_ignored_result (tree); +extern tree fold_abs_const (tree, tree); +extern tree fold_indirect_ref_1 (location_t, tree, tree); +extern void fold_defer_overflow_warnings (void); +extern void fold_undefer_overflow_warnings (bool, const gimple *, int); +extern void fold_undefer_and_ignore_overflow_warnings (void); +extern bool fold_deferring_overflow_warnings_p (void); +extern void fold_overflow_warning (const char*, enum warn_strict_overflow_code); +extern int operand_equal_p (const_tree, const_tree, unsigned int); +extern int multiple_of_p (tree, const_tree, const_tree); +#define omit_one_operand(T1,T2,T3)\ + omit_one_operand_loc (UNKNOWN_LOCATION, T1, T2, T3) +extern tree omit_one_operand_loc (location_t, tree, tree, tree); +#define omit_two_operands(T1,T2,T3,T4)\ + omit_two_operands_loc (UNKNOWN_LOCATION, T1, T2, T3, T4) +extern tree omit_two_operands_loc (location_t, tree, tree, tree, tree); +#define invert_truthvalue(T)\ + invert_truthvalue_loc (UNKNOWN_LOCATION, T) +extern tree invert_truthvalue_loc (location_t, tree); +extern tree fold_unary_to_constant (enum tree_code, tree, tree); +extern tree fold_binary_to_constant (enum tree_code, tree, tree, tree); +extern tree fold_read_from_constant_string (tree); +extern tree int_const_binop (enum tree_code, const_tree, const_tree); +#define build_fold_addr_expr(T)\ + build_fold_addr_expr_loc (UNKNOWN_LOCATION, (T)) +extern tree build_fold_addr_expr_loc (location_t, tree); +#define build_fold_addr_expr_with_type(T,TYPE)\ + build_fold_addr_expr_with_type_loc (UNKNOWN_LOCATION, (T), TYPE) +extern tree build_fold_addr_expr_with_type_loc (location_t, tree, tree); +extern tree fold_build_cleanup_point_expr (tree type, tree expr); +#define build_fold_indirect_ref(T)\ + build_fold_indirect_ref_loc (UNKNOWN_LOCATION, T) +extern tree build_fold_indirect_ref_loc (location_t, tree); +#define fold_indirect_ref(T)\ + fold_indirect_ref_loc (UNKNOWN_LOCATION, T) +extern tree fold_indirect_ref_loc (location_t, tree); +extern tree build_simple_mem_ref_loc (location_t, tree); +#define build_simple_mem_ref(T)\ + build_simple_mem_ref_loc (UNKNOWN_LOCATION, T) +extern offset_int mem_ref_offset (const_tree); +extern tree build_invariant_address (tree, tree, HOST_WIDE_INT); +extern tree constant_boolean_node (bool, tree); +extern tree div_if_zero_remainder (const_tree, const_tree); + +extern bool tree_swap_operands_p (const_tree, const_tree); +extern enum tree_code swap_tree_comparison (enum tree_code); + +extern bool ptr_difference_const (tree, tree, HOST_WIDE_INT *); +extern enum tree_code invert_tree_comparison (enum tree_code, bool); + +extern bool tree_unary_nonzero_warnv_p (enum tree_code, tree, tree, bool *); +extern bool tree_binary_nonzero_warnv_p (enum tree_code, tree, tree, tree op1, + bool *); +extern bool tree_single_nonzero_warnv_p (tree, bool *); +extern bool tree_unary_nonnegative_warnv_p (enum tree_code, tree, tree, + bool *, int); +extern bool tree_binary_nonnegative_warnv_p (enum tree_code, tree, tree, tree, + bool *, int); +extern bool tree_single_nonnegative_warnv_p (tree, bool *, int); +extern bool tree_call_nonnegative_warnv_p (tree, combined_fn, tree, tree, + bool *, int); + +extern bool integer_valued_real_unary_p (tree_code, tree, int); +extern bool integer_valued_real_binary_p (tree_code, tree, tree, int); +extern bool integer_valued_real_call_p (combined_fn, tree, tree, int); +extern bool integer_valued_real_single_p (tree, int); +extern bool integer_valued_real_p (tree, int = 0); + +extern bool fold_real_zero_addition_p (const_tree, const_tree, int); +extern tree combine_comparisons (location_t, enum tree_code, enum tree_code, + enum tree_code, tree, tree, tree); +extern void debug_fold_checksum (const_tree); +extern bool may_negate_without_overflow_p (const_tree); +#define round_up(T,N) round_up_loc (UNKNOWN_LOCATION, T, N) +extern tree round_up_loc (location_t, tree, unsigned int); +#define round_down(T,N) round_down_loc (UNKNOWN_LOCATION, T, N) +extern tree round_down_loc (location_t, tree, int); +extern tree size_int_kind (HOST_WIDE_INT, enum size_type_kind); +#define size_binop(CODE,T1,T2)\ + size_binop_loc (UNKNOWN_LOCATION, CODE, T1, T2) +extern tree size_binop_loc (location_t, enum tree_code, tree, tree); +#define size_diffop(T1,T2)\ + size_diffop_loc (UNKNOWN_LOCATION, T1, T2) +extern tree size_diffop_loc (location_t, tree, tree); + +/* Return an expr equal to X but certainly not valid as an lvalue. */ +#define non_lvalue(T) non_lvalue_loc (UNKNOWN_LOCATION, T) +extern tree non_lvalue_loc (location_t, tree); + +extern bool tree_expr_nonzero_p (tree); +extern bool tree_expr_nonnegative_p (tree); +extern bool tree_expr_nonnegative_warnv_p (tree, bool *, int = 0); +extern tree make_range (tree, int *, tree *, tree *, bool *); +extern tree make_range_step (location_t, enum tree_code, tree, tree, tree, + tree *, tree *, int *, bool *); +extern tree build_range_check (location_t, tree, tree, int, tree, tree); +extern bool merge_ranges (int *, tree *, tree *, int, tree, tree, int, + tree, tree); +extern tree sign_bit_p (tree, const_tree); +extern tree exact_inverse (tree, tree); +extern bool expr_not_equal_to (tree t, const wide_int &); +extern tree const_unop (enum tree_code, tree, tree); +extern tree const_binop (enum tree_code, tree, tree, tree); +extern bool negate_mathfn_p (combined_fn); +extern const char *c_getstr (tree, unsigned HOST_WIDE_INT *strlen = NULL); + +/* Return OFF converted to a pointer offset type suitable as offset for + POINTER_PLUS_EXPR. Use location LOC for this conversion. */ +extern tree convert_to_ptrofftype_loc (location_t loc, tree off); + +#define convert_to_ptrofftype(t) convert_to_ptrofftype_loc (UNKNOWN_LOCATION, t) + +/* Build and fold a POINTER_PLUS_EXPR at LOC offsetting PTR by OFF. */ +extern tree fold_build_pointer_plus_loc (location_t loc, tree ptr, tree off); + +#define fold_build_pointer_plus(p,o) \ + fold_build_pointer_plus_loc (UNKNOWN_LOCATION, p, o) + +/* Build and fold a POINTER_PLUS_EXPR at LOC offsetting PTR by OFF. */ +extern tree fold_build_pointer_plus_hwi_loc (location_t loc, tree ptr, HOST_WIDE_INT off); + +#define fold_build_pointer_plus_hwi(p,o) \ + fold_build_pointer_plus_hwi_loc (UNKNOWN_LOCATION, p, o) +#endif // GCC_FOLD_CONST_H diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/function.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/function.h new file mode 100644 index 0000000..0f34bcd --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/function.h @@ -0,0 +1,659 @@ +/* Structure for saving state for a nested function. + Copyright (C) 1989-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_FUNCTION_H +#define GCC_FUNCTION_H + + +/* Stack of pending (incomplete) sequences saved by `start_sequence'. + Each element describes one pending sequence. + The main insn-chain is saved in the last element of the chain, + unless the chain is empty. */ + +struct GTY(()) sequence_stack { + /* First and last insns in the chain of the saved sequence. */ + rtx_insn *first; + rtx_insn *last; + struct sequence_stack *next; +}; + +struct GTY(()) emit_status { + void ensure_regno_capacity (); + + /* This is reset to LAST_VIRTUAL_REGISTER + 1 at the start of each function. + After rtl generation, it is 1 plus the largest register number used. */ + int x_reg_rtx_no; + + /* Lowest label number in current function. */ + int x_first_label_num; + + /* seq.first and seq.last are the ends of the doubly-linked chain of + rtl for the current function. Both are reset to null at the + start of rtl generation for the function. + + start_sequence saves both of these on seq.next and then starts + a new, nested sequence of insns. + + seq.next is a stack of pending (incomplete) sequences saved by + start_sequence. Each element describes one pending sequence. + The main insn-chain is the last element of the chain. */ + struct sequence_stack seq; + + /* INSN_UID for next insn emitted. + Reset to 1 for each function compiled. */ + int x_cur_insn_uid; + + /* INSN_UID for next debug insn emitted. Only used if + --param min-nondebug-insn-uid= is given with nonzero value. */ + int x_cur_debug_insn_uid; + + /* The length of the regno_pointer_align, regno_decl, and x_regno_reg_rtx + vectors. Since these vectors are needed during the expansion phase when + the total number of registers in the function is not yet known, the + vectors are copied and made bigger when necessary. */ + int regno_pointer_align_length; + + /* Indexed by pseudo register number, if nonzero gives the known alignment + for that pseudo (if REG_POINTER is set in x_regno_reg_rtx). + Allocated in parallel with x_regno_reg_rtx. */ + unsigned char * GTY((skip)) regno_pointer_align; +}; + + +/* Indexed by register number, gives an rtx for that register (and only + that register). For pseudo registers, it is the unique rtx for + that pseudo. For hard registers, it is an rtx of the mode specified + by reg_raw_mode. + + FIXME: We could put it into emit_status struct, but gengtype is not + able to deal with length attribute nested in top level structures. */ + +extern GTY ((length ("crtl->emit.x_reg_rtx_no"))) rtx * regno_reg_rtx; + +/* For backward compatibility... eventually these should all go away. */ +#define reg_rtx_no (crtl->emit.x_reg_rtx_no) + +#define REGNO_POINTER_ALIGN(REGNO) (crtl->emit.regno_pointer_align[REGNO]) + +struct GTY(()) expr_status { + /* Number of units that we should eventually pop off the stack. + These are the arguments to function calls that have already returned. */ + int x_pending_stack_adjust; + + /* Under some ABIs, it is the caller's responsibility to pop arguments + pushed for function calls. A naive implementation would simply pop + the arguments immediately after each call. However, if several + function calls are made in a row, it is typically cheaper to pop + all the arguments after all of the calls are complete since a + single pop instruction can be used. Therefore, GCC attempts to + defer popping the arguments until absolutely necessary. (For + example, at the end of a conditional, the arguments must be popped, + since code outside the conditional won't know whether or not the + arguments need to be popped.) + + When INHIBIT_DEFER_POP is nonzero, however, the compiler does not + attempt to defer pops. Instead, the stack is popped immediately + after each call. Rather then setting this variable directly, use + NO_DEFER_POP and OK_DEFER_POP. */ + int x_inhibit_defer_pop; + + /* If PREFERRED_STACK_BOUNDARY and PUSH_ROUNDING are defined, the stack + boundary can be momentarily unaligned while pushing the arguments. + Record the delta since last aligned boundary here in order to get + stack alignment in the nested function calls working right. */ + int x_stack_pointer_delta; + + /* Nonzero means __builtin_saveregs has already been done in this function. + The value is the pseudoreg containing the value __builtin_saveregs + returned. */ + rtx x_saveregs_value; + + /* Similarly for __builtin_apply_args. */ + rtx x_apply_args_value; + + /* List of labels that must never be deleted. */ + vec *x_forced_labels; +}; + +typedef struct call_site_record_d *call_site_record; + +/* RTL representation of exception handling. */ +struct GTY(()) rtl_eh { + rtx ehr_stackadj; + rtx ehr_handler; + rtx_code_label *ehr_label; + + rtx sjlj_fc; + rtx_insn *sjlj_exit_after; + + vec *action_record_data; + + vec *call_site_record_v[2]; +}; + +#define pending_stack_adjust (crtl->expr.x_pending_stack_adjust) +#define inhibit_defer_pop (crtl->expr.x_inhibit_defer_pop) +#define saveregs_value (crtl->expr.x_saveregs_value) +#define apply_args_value (crtl->expr.x_apply_args_value) +#define forced_labels (crtl->expr.x_forced_labels) +#define stack_pointer_delta (crtl->expr.x_stack_pointer_delta) + +struct gimple_df; +struct call_site_record_d; +struct dw_fde_node; + +struct GTY(()) varasm_status { + /* If we're using a per-function constant pool, this is it. */ + struct rtx_constant_pool *pool; + + /* Number of tree-constants deferred during the expansion of this + function. */ + unsigned int deferred_constants; +}; + + +/* Data for function partitioning. */ +struct GTY(()) function_subsections { + /* Assembly labels for the hot and cold text sections, to + be used by debugger functions for determining the size of text + sections. */ + + const char *hot_section_label; + const char *cold_section_label; + const char *hot_section_end_label; + const char *cold_section_end_label; +}; + +/* Describe an empty area of space in the stack frame. These can be chained + into a list; this is used to keep track of space wasted for alignment + reasons. */ +struct GTY(()) frame_space +{ + struct frame_space *next; + + HOST_WIDE_INT start; + HOST_WIDE_INT length; +}; + +struct GTY(()) stack_usage +{ + /* # of bytes of static stack space allocated by the function. */ + HOST_WIDE_INT static_stack_size; + + /* # of bytes of dynamic stack space allocated by the function. This is + meaningful only if has_unbounded_dynamic_stack_size is zero. */ + HOST_WIDE_INT dynamic_stack_size; + + /* # of bytes of space pushed onto the stack after the prologue. If + !ACCUMULATE_OUTGOING_ARGS, it contains the outgoing arguments. */ + int pushed_stack_size; + + /* Nonzero if the amount of stack space allocated dynamically cannot + be bounded at compile-time. */ + unsigned int has_unbounded_dynamic_stack_size : 1; +}; + +#define current_function_static_stack_size (cfun->su->static_stack_size) +#define current_function_dynamic_stack_size (cfun->su->dynamic_stack_size) +#define current_function_pushed_stack_size (cfun->su->pushed_stack_size) +#define current_function_has_unbounded_dynamic_stack_size \ + (cfun->su->has_unbounded_dynamic_stack_size) +#define current_function_allocates_dynamic_stack_space \ + (current_function_dynamic_stack_size != 0 \ + || current_function_has_unbounded_dynamic_stack_size) + +/* This structure can save all the important global and static variables + describing the status of the current function. */ + +struct GTY(()) function { + struct eh_status *eh; + + /* The control flow graph for this function. */ + struct control_flow_graph *cfg; + + /* GIMPLE body for this function. */ + gimple_seq gimple_body; + + /* SSA and dataflow information. */ + struct gimple_df *gimple_df; + + /* The loops in this function. */ + struct loops *x_current_loops; + + /* Filled by the GIMPLE and RTL FEs, pass to start compilation with. */ + char *pass_startwith; + + /* The stack usage of this function. */ + struct stack_usage *su; + + /* Value histograms attached to particular statements. */ + htab_t GTY((skip)) value_histograms; + + /* For function.c. */ + + /* Points to the FUNCTION_DECL of this function. */ + tree decl; + + /* A PARM_DECL that should contain the static chain for this function. + It will be initialized at the beginning of the function. */ + tree static_chain_decl; + + /* An expression that contains the non-local goto save area. The first + word is the saved frame pointer and the second is the saved stack + pointer. */ + tree nonlocal_goto_save_area; + + /* Vector of function local variables, functions, types and constants. */ + vec *local_decls; + + /* In a Cilk function, the VAR_DECL for the frame descriptor. */ + tree cilk_frame_decl; + + /* For md files. */ + + /* tm.h can use this to store whatever it likes. */ + struct machine_function * GTY ((maybe_undef)) machine; + + /* Language-specific code can use this to store whatever it likes. */ + struct language_function * language; + + /* Used types hash table. */ + hash_set *GTY (()) used_types_hash; + + /* Dwarf2 Frame Description Entry, containing the Call Frame Instructions + used for unwinding. Only set when either dwarf2 unwinding or dwarf2 + debugging is enabled. */ + struct dw_fde_node *fde; + + /* Last statement uid. */ + int last_stmt_uid; + + /* Function sequence number for profiling, debugging, etc. */ + int funcdef_no; + + /* Line number of the start of the function for debugging purposes. */ + location_t function_start_locus; + + /* Line number of the end of the function. */ + location_t function_end_locus; + + /* Properties used by the pass manager. */ + unsigned int curr_properties; + unsigned int last_verified; + + /* Non-null if the function does something that would prevent it from + being copied; this applies to both versioning and inlining. Set to + a string describing the reason for failure. */ + const char * GTY((skip)) cannot_be_copied_reason; + + /* Last assigned dependence info clique. */ + unsigned short last_clique; + + /* Collected bit flags. */ + + /* Number of units of general registers that need saving in stdarg + function. What unit is depends on the backend, either it is number + of bytes, or it can be number of registers. */ + unsigned int va_list_gpr_size : 8; + + /* Number of units of floating point registers that need saving in stdarg + function. */ + unsigned int va_list_fpr_size : 8; + + /* Nonzero if function being compiled can call setjmp. */ + unsigned int calls_setjmp : 1; + + /* Nonzero if function being compiled can call alloca, + either as a subroutine or builtin. */ + unsigned int calls_alloca : 1; + + /* This will indicate whether a function is a cilk function */ + unsigned int is_cilk_function : 1; + + /* Nonzero if this is a Cilk function that spawns. */ + unsigned int calls_cilk_spawn : 1; + + /* Nonzero if function being compiled receives nonlocal gotos + from nested functions. */ + unsigned int has_nonlocal_label : 1; + + /* Nonzero if function being compiled has a forced label + placed into static storage. */ + unsigned int has_forced_label_in_static : 1; + + /* Nonzero if we've set cannot_be_copied_reason. I.e. if + (cannot_be_copied_set && !cannot_be_copied_reason), the function + can in fact be copied. */ + unsigned int cannot_be_copied_set : 1; + + /* Nonzero if current function uses stdarg.h or equivalent. */ + unsigned int stdarg : 1; + + unsigned int after_inlining : 1; + unsigned int always_inline_functions_inlined : 1; + + /* Nonzero if function being compiled can throw synchronous non-call + exceptions. */ + unsigned int can_throw_non_call_exceptions : 1; + + /* Nonzero if instructions that may throw exceptions but don't otherwise + contribute to the execution of the program can be deleted. */ + unsigned int can_delete_dead_exceptions : 1; + + /* Fields below this point are not set for abstract functions; see + allocate_struct_function. */ + + /* Nonzero if function being compiled needs to be given an address + where the value should be stored. */ + unsigned int returns_struct : 1; + + /* Nonzero if function being compiled needs to + return the address of where it has put a structure value. */ + unsigned int returns_pcc_struct : 1; + + /* Nonzero if this function has local DECL_HARD_REGISTER variables. + In this case code motion has to be done more carefully. */ + unsigned int has_local_explicit_reg_vars : 1; + + /* Nonzero if the current function is a thunk, i.e., a lightweight + function implemented by the output_mi_thunk hook) that just + adjusts one of its arguments and forwards to another + function. */ + unsigned int is_thunk : 1; + + /* Nonzero if the current function contains any loops with + loop->force_vectorize set. */ + unsigned int has_force_vectorize_loops : 1; + + /* Nonzero if the current function contains any loops with + nonzero value in loop->simduid. */ + unsigned int has_simduid_loops : 1; + + /* Set when the tail call has been identified. */ + unsigned int tail_call_marked : 1; +}; + +/* Add the decl D to the local_decls list of FUN. */ + +void add_local_decl (struct function *fun, tree d); + +#define FOR_EACH_LOCAL_DECL(FUN, I, D) \ + FOR_EACH_VEC_SAFE_ELT_REVERSE ((FUN)->local_decls, I, D) + +/* If va_list_[gf]pr_size is set to this, it means we don't know how + many units need to be saved. */ +#define VA_LIST_MAX_GPR_SIZE 255 +#define VA_LIST_MAX_FPR_SIZE 255 + +/* The function currently being compiled. */ +extern GTY(()) struct function *cfun; + +/* In order to ensure that cfun is not set directly, we redefine it so + that it is not an lvalue. Rather than assign to cfun, use + push_cfun or set_cfun. */ +#define cfun (cfun + 0) + +/* Nonzero if we've already converted virtual regs to hard regs. */ +extern int virtuals_instantiated; + +/* Nonzero if at least one trampoline has been created. */ +extern int trampolines_created; + +struct GTY((for_user)) types_used_by_vars_entry { + tree type; + tree var_decl; +}; + +struct used_type_hasher : ggc_ptr_hash +{ + static hashval_t hash (types_used_by_vars_entry *); + static bool equal (types_used_by_vars_entry *, types_used_by_vars_entry *); +}; + +/* Hash table making the relationship between a global variable + and the types it references in its initializer. The key of the + entry is a referenced type, and the value is the DECL of the global + variable. types_use_by_vars_do_hash and types_used_by_vars_eq below are + the hash and equality functions to use for this hash table. */ +extern GTY(()) hash_table *types_used_by_vars_hash; + +void types_used_by_var_decl_insert (tree type, tree var_decl); + +/* During parsing of a global variable, this vector contains the types + referenced by the global variable. */ +extern GTY(()) vec *types_used_by_cur_var_decl; + + +/* Return the loop tree of FN. */ + +inline struct loops * +loops_for_fn (struct function *fn) +{ + return fn->x_current_loops; +} + +/* Set the loop tree of FN to LOOPS. */ + +inline void +set_loops_for_fn (struct function *fn, struct loops *loops) +{ + gcc_checking_assert (fn->x_current_loops == NULL || loops == NULL); + fn->x_current_loops = loops; +} + +/* For backward compatibility... eventually these should all go away. */ +#define current_function_funcdef_no (cfun->funcdef_no) + +#define current_loops (cfun->x_current_loops) +#define dom_computed (cfun->cfg->x_dom_computed) +#define n_bbs_in_dom_tree (cfun->cfg->x_n_bbs_in_dom_tree) +#define VALUE_HISTOGRAMS(fun) (fun)->value_histograms + +/* A pointer to a function to create target specific, per-function + data structures. */ +extern struct machine_function * (*init_machine_status) (void); + +enum direction {none, upward, downward}; + +/* Structure to record the size of a sequence of arguments + as the sum of a tree-expression and a constant. This structure is + also used to store offsets from the stack, which might be negative, + so the variable part must be ssizetype, not sizetype. */ + +struct args_size +{ + HOST_WIDE_INT constant; + tree var; +}; + +/* Package up various arg related fields of struct args for + locate_and_pad_parm. */ +struct locate_and_pad_arg_data +{ + /* Size of this argument on the stack, rounded up for any padding it + gets. If REG_PARM_STACK_SPACE is defined, then register parms are + counted here, otherwise they aren't. */ + struct args_size size; + /* Offset of this argument from beginning of stack-args. */ + struct args_size offset; + /* Offset to the start of the stack slot. Different from OFFSET + if this arg pads downward. */ + struct args_size slot_offset; + /* The amount that the stack pointer needs to be adjusted to + force alignment for the next argument. */ + struct args_size alignment_pad; + /* Which way we should pad this arg. */ + enum direction where_pad; + /* slot_offset is at least this aligned. */ + unsigned int boundary; +}; + +/* Add the value of the tree INC to the `struct args_size' TO. */ + +#define ADD_PARM_SIZE(TO, INC) \ +do { \ + tree inc = (INC); \ + if (tree_fits_shwi_p (inc)) \ + (TO).constant += tree_to_shwi (inc); \ + else if ((TO).var == 0) \ + (TO).var = fold_convert (ssizetype, inc); \ + else \ + (TO).var = size_binop (PLUS_EXPR, (TO).var, \ + fold_convert (ssizetype, inc)); \ +} while (0) + +#define SUB_PARM_SIZE(TO, DEC) \ +do { \ + tree dec = (DEC); \ + if (tree_fits_shwi_p (dec)) \ + (TO).constant -= tree_to_shwi (dec); \ + else if ((TO).var == 0) \ + (TO).var = size_binop (MINUS_EXPR, ssize_int (0), \ + fold_convert (ssizetype, dec)); \ + else \ + (TO).var = size_binop (MINUS_EXPR, (TO).var, \ + fold_convert (ssizetype, dec)); \ +} while (0) + +/* Convert the implicit sum in a `struct args_size' into a tree + of type ssizetype. */ +#define ARGS_SIZE_TREE(SIZE) \ +((SIZE).var == 0 ? ssize_int ((SIZE).constant) \ + : size_binop (PLUS_EXPR, fold_convert (ssizetype, (SIZE).var), \ + ssize_int ((SIZE).constant))) + +/* Convert the implicit sum in a `struct args_size' into an rtx. */ +#define ARGS_SIZE_RTX(SIZE) \ +((SIZE).var == 0 ? GEN_INT ((SIZE).constant) \ + : expand_normal (ARGS_SIZE_TREE (SIZE))) + +#define ASLK_REDUCE_ALIGN 1 +#define ASLK_RECORD_PAD 2 + +/* If pointers to member functions use the least significant bit to + indicate whether a function is virtual, ensure a pointer + to this function will have that bit clear. */ +#define MINIMUM_METHOD_BOUNDARY \ + ((TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn) \ + ? MAX (FUNCTION_BOUNDARY, 2 * BITS_PER_UNIT) : FUNCTION_BOUNDARY) + + + +extern void push_function_context (void); +extern void pop_function_context (void); + +/* Save and restore status information for a nested function. */ +extern void free_after_parsing (struct function *); +extern void free_after_compilation (struct function *); + +/* Return size needed for stack frame based on slots so far allocated. + This size counts from zero. It is not rounded to STACK_BOUNDARY; + the caller may have to do that. */ +extern HOST_WIDE_INT get_frame_size (void); + +/* Issue an error message and return TRUE if frame OFFSET overflows in + the signed target pointer arithmetics for function FUNC. Otherwise + return FALSE. */ +extern bool frame_offset_overflow (HOST_WIDE_INT, tree); + +extern unsigned int spill_slot_alignment (machine_mode); + +extern rtx assign_stack_local_1 (machine_mode, HOST_WIDE_INT, int, int); +extern rtx assign_stack_local (machine_mode, HOST_WIDE_INT, int); +extern rtx assign_stack_temp_for_type (machine_mode, HOST_WIDE_INT, tree); +extern rtx assign_stack_temp (machine_mode, HOST_WIDE_INT); +extern rtx assign_temp (tree, int, int); +extern void update_temp_slot_address (rtx, rtx); +extern void preserve_temp_slots (rtx); +extern void free_temp_slots (void); +extern void push_temp_slots (void); +extern void pop_temp_slots (void); +extern void init_temp_slots (void); +extern rtx get_hard_reg_initial_reg (rtx); +extern rtx get_hard_reg_initial_val (machine_mode, unsigned int); +extern rtx has_hard_reg_initial_val (machine_mode, unsigned int); + +/* Called from gimple_expand_cfg. */ +extern unsigned int emit_initial_value_sets (void); + +extern bool initial_value_entry (int i, rtx *, rtx *); +extern void instantiate_decl_rtl (rtx x); +extern int aggregate_value_p (const_tree, const_tree); +extern bool use_register_for_decl (const_tree); +extern gimple_seq gimplify_parameters (void); +extern void locate_and_pad_parm (machine_mode, tree, int, int, int, + tree, struct args_size *, + struct locate_and_pad_arg_data *); +extern void generate_setjmp_warnings (void); + +/* Identify BLOCKs referenced by more than one NOTE_INSN_BLOCK_{BEG,END}, + and create duplicate blocks. */ +extern void reorder_blocks (void); +extern void clear_block_marks (tree); +extern tree blocks_nreverse (tree); +extern tree block_chainon (tree, tree); + +/* Set BLOCK_NUMBER for all the blocks in FN. */ +extern void number_blocks (tree); + +/* cfun shouldn't be set directly; use one of these functions instead. */ +extern void set_cfun (struct function *new_cfun, bool force = false); +extern void push_cfun (struct function *new_cfun); +extern void pop_cfun (void); + +extern int get_next_funcdef_no (void); +extern int get_last_funcdef_no (void); +extern void allocate_struct_function (tree, bool); +extern void push_struct_function (tree fndecl); +extern void push_dummy_function (bool); +extern void pop_dummy_function (void); +extern void init_dummy_function_start (void); +extern void init_function_start (tree); +extern void stack_protect_epilogue (void); +extern void expand_function_start (tree); +extern void expand_dummy_function_end (void); + +extern void thread_prologue_and_epilogue_insns (void); +extern void diddle_return_value (void (*)(rtx, void*), void*); +extern void clobber_return_register (void); +extern void expand_function_end (void); +extern rtx get_arg_pointer_save_area (void); +extern void maybe_copy_prologue_epilogue_insn (rtx, rtx); +extern int prologue_contains (const rtx_insn *); +extern int epilogue_contains (const rtx_insn *); +extern int prologue_epilogue_contains (const rtx_insn *); +extern void record_prologue_seq (rtx_insn *); +extern void record_epilogue_seq (rtx_insn *); +extern void emit_return_into_block (bool simple_p, basic_block bb); +extern void set_return_jump_label (rtx_insn *); +extern bool active_insn_between (rtx_insn *head, rtx_insn *tail); +extern vec convert_jumps_to_returns (basic_block last_bb, bool simple_p, + vec unconverted); +extern basic_block emit_return_for_exit (edge exit_fallthru_edge, + bool simple_p); +extern void reposition_prologue_and_epilogue_notes (void); + +/* Returns the name of the current function. */ +extern const char *fndecl_name (tree); +extern const char *function_name (struct function *); +extern const char *current_function_name (void); + +extern void used_types_insert (tree); + +#endif /* GCC_FUNCTION_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcc-plugin.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcc-plugin.h new file mode 100644 index 0000000..d2267a4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcc-plugin.h @@ -0,0 +1,47 @@ +/* Public header file for plugins to include. + Copyright (C) 2009-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_PLUGIN_H +#define GCC_PLUGIN_H + +#ifndef IN_GCC +#define IN_GCC +#endif + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "backend.h" +#include "cfghooks.h" +#include "hard-reg-set.h" +#include "cfgrtl.h" +#include "cfganal.h" +#include "lcm.h" +#include "cfgbuild.h" +#include "cfgcleanup.h" +#include "plugin-api.h" +#include "ipa-ref.h" +#include "alias.h" +#include "flags.h" +#include "tree-core.h" +#include "fold-const.h" +#include "tree-check.h" +#include "plugin.h" + +#endif /* GCC_PLUGIN_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcc-rich-location.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcc-rich-location.h new file mode 100644 index 0000000..49708ca --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcc-rich-location.h @@ -0,0 +1,45 @@ +/* Declarations relating to class gcc_rich_location + Copyright (C) 2014-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_RICH_LOCATION_H +#define GCC_RICH_LOCATION_H + +/* A gcc_rich_location is libcpp's rich_location with additional + helper methods for working with gcc's types. */ +class gcc_rich_location : public rich_location +{ + public: + /* Constructors. */ + + /* Constructing from a location. */ + gcc_rich_location (source_location loc) : + rich_location (line_table, loc) {} + + /* Methods for adding ranges via gcc entities. */ + void + add_expr (tree expr); + + void + maybe_add_expr (tree t); + + void add_fixit_misspelled_id (location_t misspelled_token_loc, + tree hint_id); +}; + +#endif /* GCC_RICH_LOCATION_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcc-symtab.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcc-symtab.h new file mode 100644 index 0000000..9cb1489 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcc-symtab.h @@ -0,0 +1,28 @@ +/* Declarations for symtab.c. + FIXME - This file should be named symtab.h, but that name conflicts + with libcpp's symtab.h. + + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_SYMTAB_H +#define GCC_SYMTAB_H + +extern void change_decl_assembler_name (tree, tree); + +#endif // GCC_SYMTAB_H diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcc.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcc.h new file mode 100644 index 0000000..12f178c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcc.h @@ -0,0 +1,102 @@ +/* Header file for modules that link with gcc.c + Copyright (C) 1999-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GCC_H +#define GCC_GCC_H + +#include "version.h" +#include "diagnostic-core.h" + +/* The top-level "main" within the driver would be ~1000 lines long. + This class breaks it up into smaller functions and contains some + state shared by them. */ + +class driver +{ + public: + driver (bool can_finalize, bool debug); + ~driver (); + int main (int argc, char **argv); + void finalize (); + + private: + void set_progname (const char *argv0) const; + void expand_at_files (int *argc, char ***argv) const; + void decode_argv (int argc, const char **argv); + void global_initializations (); + void build_multilib_strings () const; + void set_up_specs () const; + void putenv_COLLECT_GCC (const char *argv0) const; + void maybe_putenv_COLLECT_LTO_WRAPPER () const; + void maybe_putenv_OFFLOAD_TARGETS () const; + void build_option_suggestions (void); + const char *suggest_option (const char *bad_opt); + void handle_unrecognized_options (); + int maybe_print_and_exit () const; + bool prepare_infiles (); + void do_spec_on_infiles () const; + void maybe_run_linker (const char *argv0) const; + void final_actions () const; + int get_exit_code () const; + + private: + char *explicit_link_files; + struct cl_decoded_option *decoded_options; + unsigned int decoded_options_count; + auto_vec *m_option_suggestions; +}; + +/* The mapping of a spec function name to the C function that + implements it. */ +struct spec_function +{ + const char *name; + const char *(*func) (int, const char **); +}; + +/* These are exported by gcc.c. */ +extern int do_spec (const char *); +extern void record_temp_file (const char *, int, int); +extern void pfatal_with_name (const char *) ATTRIBUTE_NORETURN; +extern void set_input (const char *); + +/* Spec files linked with gcc.c must provide definitions for these. */ + +/* Called before processing to change/add/remove arguments. */ +extern void lang_specific_driver (struct cl_decoded_option **, + unsigned int *, int *); + +/* Called before linking. Returns 0 on success and -1 on failure. */ +extern int lang_specific_pre_link (void); + +extern int n_infiles; + +/* Number of extra output files that lang_specific_pre_link may generate. */ +extern int lang_specific_extra_outfiles; + +/* A vector of corresponding output files is made up later. */ + +extern const char **outfiles; + +extern void +driver_get_configure_time_options (void (*cb)(const char *option, + void *user_data), + void *user_data); + +#endif /* ! GCC_GCC_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcov-io.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcov-io.h new file mode 100644 index 0000000..1fb58dd --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcov-io.h @@ -0,0 +1,424 @@ +/* File format for coverage information + Copyright (C) 1996-2017 Free Software Foundation, Inc. + Contributed by Bob Manson . + Completely remangled by Nathan Sidwell . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + + +/* Coverage information is held in two files. A notes file, which is + generated by the compiler, and a data file, which is generated by + the program under test. Both files use a similar structure. We do + not attempt to make these files backwards compatible with previous + versions, as you only need coverage information when developing a + program. We do hold version information, so that mismatches can be + detected, and we use a format that allows tools to skip information + they do not understand or are not interested in. + + Numbers are recorded in the 32 bit unsigned binary form of the + endianness of the machine generating the file. 64 bit numbers are + stored as two 32 bit numbers, the low part first. Strings are + padded with 1 to 4 NUL bytes, to bring the length up to a multiple + of 4. The number of 4 bytes is stored, followed by the padded + string. Zero length and NULL strings are simply stored as a length + of zero (they have no trailing NUL or padding). + + int32: byte3 byte2 byte1 byte0 | byte0 byte1 byte2 byte3 + int64: int32:low int32:high + string: int32:0 | int32:length char* char:0 padding + padding: | char:0 | char:0 char:0 | char:0 char:0 char:0 + item: int32 | int64 | string + + The basic format of the files is + + file : int32:magic int32:version int32:stamp record* + + The magic ident is different for the notes and the data files. The + magic ident is used to determine the endianness of the file, when + reading. The version is the same for both files and is derived + from gcc's version number. The stamp value is used to synchronize + note and data files and to synchronize merging within a data + file. It need not be an absolute time stamp, merely a ticker that + increments fast enough and cycles slow enough to distinguish + different compile/run/compile cycles. + + Although the ident and version are formally 32 bit numbers, they + are derived from 4 character ASCII strings. The version number + consists of a two character major version number + (first digit starts from 'A' letter to not to clash with the older + numbering scheme), the single character minor version number, + and a single character indicating the status of the release. + That will be 'e' experimental, 'p' prerelease and 'r' for release. + Because, by good fortune, these are in alphabetical order, string + collating can be used to compare version strings. Be aware that + the 'e' designation will (naturally) be unstable and might be + incompatible with itself. For gcc 17.0 experimental, it would be + 'B70e' (0x42373065). As we currently do not release more than 5 minor + releases, the single character should be always fine. Major number + is currently changed roughly every year, which gives us space + for next 250 years (maximum allowed number would be 259.9). + + A record has a tag, length and variable amount of data. + + record: header data + header: int32:tag int32:length + data: item* + + Records are not nested, but there is a record hierarchy. Tag + numbers reflect this hierarchy. Tags are unique across note and + data files. Some record types have a varying amount of data. The + LENGTH is the number of 4bytes that follow and is usually used to + determine how much data. The tag value is split into 4 8-bit + fields, one for each of four possible levels. The most significant + is allocated first. Unused levels are zero. Active levels are + odd-valued, so that the LSB of the level is one. A sub-level + incorporates the values of its superlevels. This formatting allows + you to determine the tag hierarchy, without understanding the tags + themselves, and is similar to the standard section numbering used + in technical documents. Level values [1..3f] are used for common + tags, values [41..9f] for the notes file and [a1..ff] for the data + file. + + The notes file contains the following records + note: unit function-graph* + unit: header int32:checksum string:source + function-graph: announce_function basic_blocks {arcs | lines}* + announce_function: header int32:ident + int32:lineno_checksum int32:cfg_checksum + string:name string:source int32:lineno + basic_block: header int32:flags* + arcs: header int32:block_no arc* + arc: int32:dest_block int32:flags + lines: header int32:block_no line* + int32:0 string:NULL + line: int32:line_no | int32:0 string:filename + + The BASIC_BLOCK record holds per-bb flags. The number of blocks + can be inferred from its data length. There is one ARCS record per + basic block. The number of arcs from a bb is implicit from the + data length. It enumerates the destination bb and per-arc flags. + There is one LINES record per basic block, it enumerates the source + lines which belong to that basic block. Source file names are + introduced by a line number of 0, following lines are from the new + source file. The initial source file for the function is NULL, but + the current source file should be remembered from one LINES record + to the next. The end of a block is indicated by an empty filename + - this does not reset the current source file. Note there is no + ordering of the ARCS and LINES records: they may be in any order, + interleaved in any manner. The current filename follows the order + the LINES records are stored in the file, *not* the ordering of the + blocks they are for. + + The data file contains the following records. + data: {unit summary:object summary:program* function-data*}* + unit: header int32:checksum + function-data: announce_function present counts + announce_function: header int32:ident + int32:lineno_checksum int32:cfg_checksum + present: header int32:present + counts: header int64:count* + summary: int32:checksum {count-summary}GCOV_COUNTERS_SUMMABLE + count-summary: int32:num int32:runs int64:sum + int64:max int64:sum_max histogram + histogram: {int32:bitvector}8 histogram-buckets* + histogram-buckets: int32:num int64:min int64:sum + + The ANNOUNCE_FUNCTION record is the same as that in the note file, + but without the source location. The COUNTS gives the + counter values for instrumented features. The about the whole + program. The checksum is used for whole program summaries, and + disambiguates different programs which include the same + instrumented object file. There may be several program summaries, + each with a unique checksum. The object summary's checksum is + zero. Note that the data file might contain information from + several runs concatenated, or the data might be merged. + + This file is included by both the compiler, gcov tools and the + runtime support library libgcov. IN_LIBGCOV and IN_GCOV are used to + distinguish which case is which. If IN_LIBGCOV is nonzero, + libgcov is being built. If IN_GCOV is nonzero, the gcov tools are + being built. Otherwise the compiler is being built. IN_GCOV may be + positive or negative. If positive, we are compiling a tool that + requires additional functions (see the code for knowledge of what + those functions are). */ + +#ifndef GCC_GCOV_IO_H +#define GCC_GCOV_IO_H + +#ifndef IN_LIBGCOV +/* About the host */ + +typedef unsigned gcov_unsigned_t; +typedef unsigned gcov_position_t; +/* gcov_type is typedef'd elsewhere for the compiler */ +#if IN_GCOV +#define GCOV_LINKAGE static +typedef int64_t gcov_type; +typedef uint64_t gcov_type_unsigned; +#if IN_GCOV > 0 +#include +#endif +#endif + +#if defined (HOST_HAS_F_SETLKW) +#define GCOV_LOCKED 1 +#else +#define GCOV_LOCKED 0 +#endif + +#define ATTRIBUTE_HIDDEN + +#endif /* !IN_LIBGOCV */ + +#ifndef GCOV_LINKAGE +#define GCOV_LINKAGE extern +#endif + +#if IN_LIBGCOV +#define gcov_nonruntime_assert(EXPR) ((void)(0 && (EXPR))) +#else +#define gcov_nonruntime_assert(EXPR) gcc_assert (EXPR) +#define gcov_error(...) fatal_error (input_location, __VA_ARGS__) +#endif + +/* File suffixes. */ +#define GCOV_DATA_SUFFIX ".gcda" +#define GCOV_NOTE_SUFFIX ".gcno" + +/* File magic. Must not be palindromes. */ +#define GCOV_DATA_MAGIC ((gcov_unsigned_t)0x67636461) /* "gcda" */ +#define GCOV_NOTE_MAGIC ((gcov_unsigned_t)0x67636e6f) /* "gcno" */ + +/* gcov-iov.h is automatically generated by the makefile from + version.c, it looks like + #define GCOV_VERSION ((gcov_unsigned_t)0x89abcdef) +*/ +#include "gcov-iov.h" + +/* Convert a magic or version number to a 4 character string. */ +#define GCOV_UNSIGNED2STRING(ARRAY,VALUE) \ + ((ARRAY)[0] = (char)((VALUE) >> 24), \ + (ARRAY)[1] = (char)((VALUE) >> 16), \ + (ARRAY)[2] = (char)((VALUE) >> 8), \ + (ARRAY)[3] = (char)((VALUE) >> 0)) + +/* The record tags. Values [1..3f] are for tags which may be in either + file. Values [41..9f] for those in the note file and [a1..ff] for + the data file. The tag value zero is used as an explicit end of + file marker -- it is not required to be present. */ + +#define GCOV_TAG_FUNCTION ((gcov_unsigned_t)0x01000000) +#define GCOV_TAG_FUNCTION_LENGTH (3) +#define GCOV_TAG_BLOCKS ((gcov_unsigned_t)0x01410000) +#define GCOV_TAG_BLOCKS_LENGTH(NUM) (NUM) +#define GCOV_TAG_BLOCKS_NUM(LENGTH) (LENGTH) +#define GCOV_TAG_ARCS ((gcov_unsigned_t)0x01430000) +#define GCOV_TAG_ARCS_LENGTH(NUM) (1 + (NUM) * 2) +#define GCOV_TAG_ARCS_NUM(LENGTH) (((LENGTH) - 1) / 2) +#define GCOV_TAG_LINES ((gcov_unsigned_t)0x01450000) +#define GCOV_TAG_COUNTER_BASE ((gcov_unsigned_t)0x01a10000) +#define GCOV_TAG_COUNTER_LENGTH(NUM) ((NUM) * 2) +#define GCOV_TAG_COUNTER_NUM(LENGTH) ((LENGTH) / 2) +#define GCOV_TAG_OBJECT_SUMMARY ((gcov_unsigned_t)0xa1000000) /* Obsolete */ +#define GCOV_TAG_PROGRAM_SUMMARY ((gcov_unsigned_t)0xa3000000) +#define GCOV_TAG_SUMMARY_LENGTH(NUM) \ + (1 + GCOV_COUNTERS_SUMMABLE * (10 + 3 * 2) + (NUM) * 5) +#define GCOV_TAG_AFDO_FILE_NAMES ((gcov_unsigned_t)0xaa000000) +#define GCOV_TAG_AFDO_FUNCTION ((gcov_unsigned_t)0xac000000) +#define GCOV_TAG_AFDO_WORKING_SET ((gcov_unsigned_t)0xaf000000) + + +/* Counters that are collected. */ + +#define DEF_GCOV_COUNTER(COUNTER, NAME, MERGE_FN) COUNTER, +enum { +#include "gcov-counter.def" +GCOV_COUNTERS +}; +#undef DEF_GCOV_COUNTER + +/* Counters which can be summaried. */ +#define GCOV_COUNTERS_SUMMABLE (GCOV_COUNTER_ARCS + 1) + +/* The first of counters used for value profiling. They must form a + consecutive interval and their order must match the order of + HIST_TYPEs in value-prof.h. */ +#define GCOV_FIRST_VALUE_COUNTER GCOV_COUNTERS_SUMMABLE + +/* The last of counters used for value profiling. */ +#define GCOV_LAST_VALUE_COUNTER (GCOV_COUNTERS - 1) + +/* Number of counters used for value profiling. */ +#define GCOV_N_VALUE_COUNTERS \ + (GCOV_LAST_VALUE_COUNTER - GCOV_FIRST_VALUE_COUNTER + 1) + +/* The number of hottest callees to be tracked. */ +#define GCOV_ICALL_TOPN_VAL 2 + +/* The number of counter entries per icall callsite. */ +#define GCOV_ICALL_TOPN_NCOUNTS (1 + GCOV_ICALL_TOPN_VAL * 4) + +/* Convert a counter index to a tag. */ +#define GCOV_TAG_FOR_COUNTER(COUNT) \ + (GCOV_TAG_COUNTER_BASE + ((gcov_unsigned_t)(COUNT) << 17)) +/* Convert a tag to a counter. */ +#define GCOV_COUNTER_FOR_TAG(TAG) \ + ((unsigned)(((TAG) - GCOV_TAG_COUNTER_BASE) >> 17)) +/* Check whether a tag is a counter tag. */ +#define GCOV_TAG_IS_COUNTER(TAG) \ + (!((TAG) & 0xFFFF) && GCOV_COUNTER_FOR_TAG (TAG) < GCOV_COUNTERS) + +/* The tag level mask has 1's in the position of the inner levels, & + the lsb of the current level, and zero on the current and outer + levels. */ +#define GCOV_TAG_MASK(TAG) (((TAG) - 1) ^ (TAG)) + +/* Return nonzero if SUB is an immediate subtag of TAG. */ +#define GCOV_TAG_IS_SUBTAG(TAG,SUB) \ + (GCOV_TAG_MASK (TAG) >> 8 == GCOV_TAG_MASK (SUB) \ + && !(((SUB) ^ (TAG)) & ~GCOV_TAG_MASK (TAG))) + +/* Return nonzero if SUB is at a sublevel to TAG. */ +#define GCOV_TAG_IS_SUBLEVEL(TAG,SUB) \ + (GCOV_TAG_MASK (TAG) > GCOV_TAG_MASK (SUB)) + +/* Basic block flags. */ +#define GCOV_BLOCK_UNEXPECTED (1 << 1) + +/* Arc flags. */ +#define GCOV_ARC_ON_TREE (1 << 0) +#define GCOV_ARC_FAKE (1 << 1) +#define GCOV_ARC_FALLTHROUGH (1 << 2) + +/* Structured records. */ + +/* Structure used for each bucket of the log2 histogram of counter values. */ +typedef struct +{ + /* Number of counters whose profile count falls within the bucket. */ + gcov_unsigned_t num_counters; + /* Smallest profile count included in this bucket. */ + gcov_type min_value; + /* Cumulative value of the profile counts in this bucket. */ + gcov_type cum_value; +} gcov_bucket_type; + +/* For a log2 scale histogram with each range split into 4 + linear sub-ranges, there will be at most 64 (max gcov_type bit size) - 1 log2 + ranges since the lowest 2 log2 values share the lowest 4 linear + sub-range (values 0 - 3). This is 252 total entries (63*4). */ + +#define GCOV_HISTOGRAM_SIZE 252 + +/* How many unsigned ints are required to hold a bit vector of non-zero + histogram entries when the histogram is written to the gcov file. + This is essentially a ceiling divide by 32 bits. */ +#define GCOV_HISTOGRAM_BITVECTOR_SIZE (GCOV_HISTOGRAM_SIZE + 31) / 32 + +/* Cumulative counter data. */ +struct gcov_ctr_summary +{ + gcov_unsigned_t num; /* number of counters. */ + gcov_unsigned_t runs; /* number of program runs */ + gcov_type sum_all; /* sum of all counters accumulated. */ + gcov_type run_max; /* maximum value on a single run. */ + gcov_type sum_max; /* sum of individual run max values. */ + gcov_bucket_type histogram[GCOV_HISTOGRAM_SIZE]; /* histogram of + counter values. */ +}; + +/* Object & program summary record. */ +struct gcov_summary +{ + gcov_unsigned_t checksum; /* checksum of program */ + struct gcov_ctr_summary ctrs[GCOV_COUNTERS_SUMMABLE]; +}; + +#if !defined(inhibit_libc) + +/* Functions for reading and writing gcov files. In libgcov you can + open the file for reading then writing. Elsewhere you can open the + file either for reading or for writing. When reading a file you may + use the gcov_read_* functions, gcov_sync, gcov_position, & + gcov_error. When writing a file you may use the gcov_write + functions, gcov_seek & gcov_error. When a file is to be rewritten + you use the functions for reading, then gcov_rewrite then the + functions for writing. Your file may become corrupted if you break + these invariants. */ + +#if !IN_LIBGCOV +GCOV_LINKAGE int gcov_open (const char */*name*/, int /*direction*/); +GCOV_LINKAGE int gcov_magic (gcov_unsigned_t, gcov_unsigned_t); +#endif + +/* Available everywhere. */ +GCOV_LINKAGE int gcov_close (void) ATTRIBUTE_HIDDEN; +GCOV_LINKAGE gcov_unsigned_t gcov_read_unsigned (void) ATTRIBUTE_HIDDEN; +GCOV_LINKAGE gcov_type gcov_read_counter (void) ATTRIBUTE_HIDDEN; +GCOV_LINKAGE void gcov_read_summary (struct gcov_summary *) ATTRIBUTE_HIDDEN; +GCOV_LINKAGE const char *gcov_read_string (void); +GCOV_LINKAGE void gcov_sync (gcov_position_t /*base*/, + gcov_unsigned_t /*length */); + +#if !IN_GCOV +/* Available outside gcov */ +GCOV_LINKAGE void gcov_write_unsigned (gcov_unsigned_t) ATTRIBUTE_HIDDEN; +#endif + +#if !IN_GCOV && !IN_LIBGCOV +/* Available only in compiler */ +GCOV_LINKAGE unsigned gcov_histo_index (gcov_type value); +GCOV_LINKAGE void gcov_write_string (const char *); +GCOV_LINKAGE gcov_position_t gcov_write_tag (gcov_unsigned_t); +GCOV_LINKAGE void gcov_write_length (gcov_position_t /*position*/); +#endif + +#if IN_GCOV <= 0 && !IN_LIBGCOV +/* Available in gcov-dump and the compiler. */ + +/* Number of data points in the working set summary array. Using 128 + provides information for at least every 1% increment of the total + profile size. The last entry is hardwired to 99.9% of the total. */ +#define NUM_GCOV_WORKING_SETS 128 + +/* Working set size statistics for a given percentage of the entire + profile (sum_all from the counter summary). */ +typedef struct gcov_working_set_info +{ + /* Number of hot counters included in this working set. */ + unsigned num_counters; + /* Smallest counter included in this working set. */ + gcov_type min_counter; +} gcov_working_set_t; + +GCOV_LINKAGE void compute_working_sets (const struct gcov_ctr_summary *summary, + gcov_working_set_t *gcov_working_sets); +#endif + +#if IN_GCOV > 0 +/* Available in gcov */ +GCOV_LINKAGE time_t gcov_time (void); +#endif + +#endif /* !inhibit_libc */ + +#endif /* GCC_GCOV_IO_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcse-common.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcse-common.h new file mode 100644 index 0000000..83e966f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcse-common.h @@ -0,0 +1,47 @@ +/* Structures and prototypes common across the normal GCSE + implementation and the post-reload implementation. + Copyright (C) 1997-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GCSE_COMMON_H +#define GCC_GCSE_COMMON_H + +typedef vec vec_rtx_heap; +struct modify_pair +{ + rtx dest; /* A MEM. */ + rtx dest_addr; /* The canonical address of `dest'. */ +}; + +typedef vec vec_modify_pair_heap; + +struct gcse_note_stores_info +{ + rtx_insn *insn; + vec *canon_mem_list; +}; + +extern void compute_transp (const_rtx, int, sbitmap *, bitmap, + bitmap, vec *); +extern void record_last_mem_set_info_common (rtx_insn *, + vec *, + vec *, + bitmap, bitmap); + + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcse.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcse.h new file mode 100644 index 0000000..8e09526 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gcse.h @@ -0,0 +1,45 @@ +/* Global common subexpression elimination/Partial redundancy elimination + and global constant/copy propagation for GNU compiler. + Copyright (C) 1997-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GCSE_H +#define GCC_GCSE_H + +/* Target-dependent globals. */ +struct target_gcse { + /* Nonzero for each mode that supports (set (reg) (reg)). + This is trivially true for integer and floating point values. + It may or may not be true for condition codes. */ + char x_can_copy[(int) NUM_MACHINE_MODES]; + + /* True if the previous field has been initialized. */ + bool x_can_copy_init_p; +}; + +extern struct target_gcse default_target_gcse; +#if SWITCHABLE_TARGET +extern struct target_gcse *this_target_gcse; +#else +#define this_target_gcse (&default_target_gcse) +#endif + +void gcse_c_finalize (void); +extern bool gcse_or_cprop_is_too_expensive (const char *); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/generic-match.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/generic-match.h new file mode 100644 index 0000000..54ac5a4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/generic-match.h @@ -0,0 +1,33 @@ +/* Generic simplify definitions. + + Copyright (C) 2011-2017 Free Software Foundation, Inc. + Contributed by Richard Guenther + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GENERIC_MATCH_H +#define GCC_GENERIC_MATCH_H + +/* Note the following functions are supposed to be only used from + fold_unary_loc, fold_binary_loc and fold_ternary_loc respectively. + They are not considered a public API. */ + +tree generic_simplify (location_t, enum tree_code, tree, tree); +tree generic_simplify (location_t, enum tree_code, tree, tree, tree); +tree generic_simplify (location_t, enum tree_code, tree, tree, tree, tree); + +#endif /* GCC_GENERIC_MATCH_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gengtype.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gengtype.h new file mode 100644 index 0000000..61a799f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gengtype.h @@ -0,0 +1,510 @@ +/* Process source files and output type information. + Copyright (C) 2002-2017 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 3, or (at your option) any later + version. + + GCC is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#ifndef GCC_GENGTYPE_H +#define GCC_GENGTYPE_H + +#define obstack_chunk_alloc xmalloc +#define obstack_chunk_free free +#define OBSTACK_CHUNK_SIZE 0 + +/* Sets of accepted source languages like C, C++, Ada... are + represented by a bitmap. */ +typedef unsigned lang_bitmap; + +/* Variable length structure representing an input file. A hash table + ensure uniqueness for a given input file name. The only function + allocating input_file-s is input_file_by_name. */ +struct input_file_st +{ + struct outf* inpoutf; /* Cached corresponding output file, computed + in get_output_file_with_visibility. */ + lang_bitmap inpbitmap; /* The set of languages using this file. */ + bool inpisplugin; /* Flag set for plugin input files. */ + char inpname[1]; /* A variable-length array, ended by a null + char. */ +}; +typedef struct input_file_st input_file; + +/* A file position, mostly for error messages. + The FILE element may be compared using pointer equality. */ +struct fileloc +{ + const input_file *file; + int line; +}; + + +/* Table of all input files and its size. */ +extern const input_file** gt_files; +extern size_t num_gt_files; + +/* A number of places use the name of this "gengtype.c" file for a + location for things that we can't rely on the source to define. We + also need to refer to the "system.h" file specifically. These two + pointers are initialized early in main. */ +extern input_file* this_file; +extern input_file* system_h_file; + +/* Retrieve or create the input_file for a given name, which is a file + path. This is the only function allocating input_file-s and it is + hash-consing them. */ +input_file* input_file_by_name (const char* name); + +/* For F an input_file, return the relative path to F from $(srcdir) + if the latter is a prefix in F, NULL otherwise. */ +const char *get_file_srcdir_relative_path (const input_file *inpf); + +/* Get the name of an input file. */ +static inline const char* +get_input_file_name (const input_file *inpf) +{ + if (inpf) + return inpf->inpname; + return NULL; +} + +/* Return a bitmap which has bit `1 << BASE_FILE_' set iff + INPUT_FILE is used by . + + This function should be written to assume that a file _is_ used + if the situation is unclear. If it wrongly assumes a file _is_ used, + a linker error will result. If it wrongly assumes a file _is not_ used, + some GC roots may be missed, which is a much harder-to-debug problem. + */ + +static inline lang_bitmap +get_lang_bitmap (const input_file* inpf) +{ + if (inpf == NULL) + return 0; + return inpf->inpbitmap; +} + +/* Set the bitmap returned by get_lang_bitmap. The only legitimate + callers of this function are read_input_list & read_state_*. */ +static inline void +set_lang_bitmap (input_file* inpf, lang_bitmap n) +{ + gcc_assert (inpf); + inpf->inpbitmap = n; +} + +/* Vector of per-language directories. */ +extern const char **lang_dir_names; +extern size_t num_lang_dirs; + +/* Data types handed around within, but opaque to, the lexer and parser. */ +typedef struct pair *pair_p; +typedef struct type *type_p; +typedef const struct type *const_type_p; +typedef struct options *options_p; + +/* Variables used to communicate between the lexer and the parser. */ +extern int lexer_toplevel_done; +extern struct fileloc lexer_line; + +/* Various things, organized as linked lists, needed both in + gengtype.c & in gengtype-state.c files. */ +extern pair_p typedefs; +extern type_p structures; +extern pair_p variables; + +/* An enum for distinguishing GGC vs PCH. */ + +enum write_types_kinds +{ + WTK_GGC, + WTK_PCH, + + NUM_WTK +}; + +/* Discrimating kind of types we can understand. */ + +enum typekind { + TYPE_NONE=0, /* Never used, so zeroed memory is invalid. */ + TYPE_UNDEFINED, /* We have not yet seen a definition for this type. + If a type is still undefined when generating code, + an error will be generated. */ + TYPE_SCALAR, /* Scalar types like char. */ + TYPE_STRING, /* The string type. */ + TYPE_STRUCT, /* Type for GTY-ed structs. */ + TYPE_UNION, /* Type for GTY-ed discriminated unions. */ + TYPE_POINTER, /* Pointer type to GTY-ed type. */ + TYPE_ARRAY, /* Array of GTY-ed types. */ + TYPE_LANG_STRUCT, /* GCC front-end language specific structs. + Various languages may have homonymous but + different structs. */ + TYPE_USER_STRUCT /* User defined type. Walkers and markers for + this type are assumed to be provided by the + user. */ +}; + +/* Discriminating kind for options. */ +enum option_kind { + OPTION_NONE=0, /* Never used, so zeroed memory is invalid. */ + OPTION_STRING, /* A string-valued option. Most options are + strings. */ + OPTION_TYPE, /* A type-valued option. */ + OPTION_NESTED /* Option data for 'nested_ptr'. */ +}; + + +/* A way to pass data through to the output end. */ +struct options { + struct options *next; /* next option of the same pair. */ + const char *name; /* GTY option name. */ + enum option_kind kind; /* discriminating option kind. */ + union { + const char* string; /* When OPTION_STRING. */ + type_p type; /* When OPTION_TYPE. */ + struct nested_ptr_data* nested; /* when OPTION_NESTED. */ + } info; +}; + + +/* Option data for the 'nested_ptr' option. */ +struct nested_ptr_data { + type_p type; + const char *convert_to; + const char *convert_from; +}; + +/* Some functions to create various options structures with name NAME + and info INFO. NEXT is the next option in the chain. */ + +/* Create a string option. */ +options_p create_string_option (options_p next, const char* name, + const char* info); + +/* Create a type option. */ +options_p create_type_option (options_p next, const char* name, + type_p info); + +/* Create a nested option. */ +options_p create_nested_option (options_p next, const char* name, + struct nested_ptr_data* info); + +/* Create a nested pointer option. */ +options_p create_nested_ptr_option (options_p, type_p t, + const char *from, const char *to); + +/* A name and a type. */ +struct pair { + pair_p next; /* The next pair in the linked list. */ + const char *name; /* The defined name. */ + type_p type; /* Its GTY-ed type. */ + struct fileloc line; /* The file location. */ + options_p opt; /* GTY options, as a linked list. */ +}; + +/* Usage information for GTY-ed types. Gengtype has to care only of + used GTY-ed types. Types are initially unused, and their usage is + computed by set_gc_used_type and set_gc_used functions. */ + +enum gc_used_enum { + + /* We need that zeroed types are initially unused. */ + GC_UNUSED=0, + + /* The GTY-ed type is used, e.g by a GTY-ed variable or a field + inside a GTY-ed used type. */ + GC_USED, + + /* For GTY-ed structures whose definitions we haven't seen so far + when we encounter a pointer to it that is annotated with + ``maybe_undef''. If after reading in everything we don't have + source file information for it, we assume that it never has been + defined. */ + GC_MAYBE_POINTED_TO, + + /* For known GTY-ed structures which are pointed to by GTY-ed + variables or fields. */ + GC_POINTED_TO +}; + +/* Our type structure describes all types handled by gengtype. */ +struct type { + /* Discriminating kind, cannot be TYPE_NONE. */ + enum typekind kind; + + /* For top-level structs or unions, the 'next' field links the + global list 'structures'; for lang_structs, their homonymous structs are + linked using this 'next' field. The homonymous list starts at the + s.lang_struct field of the lang_struct. See the new_structure function + for details. This is tricky! */ + type_p next; + + /* State number used when writing & reading the persistent state. A + type with a positive number has already been written. For ease + of debugging, newly allocated types have a unique negative + number. */ + int state_number; + + /* Each GTY-ed type which is pointed to by some GTY-ed type knows + the GTY pointer type pointing to it. See create_pointer + function. */ + type_p pointer_to; + + /* Type usage information, computed by set_gc_used_type and + set_gc_used functions. */ + enum gc_used_enum gc_used; + + /* The following union is discriminated by the 'kind' field above. */ + union { + /* TYPE__NONE is impossible. */ + + /* when TYPE_POINTER: */ + type_p p; + + /* when TYPE_STRUCT or TYPE_UNION or TYPE_LANG_STRUCT, we have an + aggregate type containing fields: */ + struct { + const char *tag; /* the aggregate tag, if any. */ + struct fileloc line; /* the source location. */ + pair_p fields; /* the linked list of fields. */ + options_p opt; /* the GTY options if any. */ + lang_bitmap bitmap; /* the set of front-end languages + using that GTY-ed aggregate. */ + /* For TYPE_LANG_STRUCT, the lang_struct field gives the first + element of a linked list of homonymous struct or union types. + Within this list, each homonymous type has as its lang_struct + field the original TYPE_LANG_STRUCT type. This is a dirty + trick, see the new_structure function for details. */ + type_p lang_struct; + + type_p base_class; /* the parent class, if any. */ + + /* The following two fields are not serialized in state files, and + are instead reconstructed on load. */ + + /* The head of a singly-linked list of immediate descendents in + the inheritance hierarchy. */ + type_p first_subclass; + /* The next in that list. */ + type_p next_sibling_class; + + /* Have we already written ggc/pch user func for ptr to this? + (in write_user_func_for_structure_ptr). */ + bool wrote_user_func_for_ptr[NUM_WTK]; + } s; + + /* when TYPE_SCALAR: */ + bool scalar_is_char; + + /* when TYPE_ARRAY: */ + struct { + type_p p; /* The array component type. */ + const char *len; /* The string if any giving its length. */ + } a; + + } u; +}; + +/* The one and only TYPE_STRING. */ +extern struct type string_type; + +/* The two and only TYPE_SCALARs. Their u.scalar_is_char flags are + set early in main. */ +extern struct type scalar_nonchar; +extern struct type scalar_char; + +/* Test if a type is a union, either a plain one or a language + specific one. */ +#define UNION_P(x) \ + ((x)->kind == TYPE_UNION \ + || ((x)->kind == TYPE_LANG_STRUCT \ + && (x)->u.s.lang_struct->kind == TYPE_UNION)) + +/* Test if a type is a union or a structure, perhaps a language + specific one. */ +static inline bool +union_or_struct_p (enum typekind kind) +{ + return (kind == TYPE_UNION + || kind == TYPE_STRUCT + || kind == TYPE_LANG_STRUCT + || kind == TYPE_USER_STRUCT); +} + +static inline bool +union_or_struct_p (const_type_p x) +{ + return union_or_struct_p (x->kind); +} + +/* Give the file location of a type, if any. */ +static inline struct fileloc* +type_fileloc (type_p t) +{ + if (!t) + return NULL; + if (union_or_struct_p (t)) + return &t->u.s.line; + return NULL; +} + +/* Structure representing an output file. */ +struct outf +{ + struct outf *next; + const char *name; + size_t buflength; + size_t bufused; + char *buf; +}; +typedef struct outf *outf_p; + +/* The list of output files. */ +extern outf_p output_files; + +/* The output header file that is included into pretty much every + source file. */ +extern outf_p header_file; + +/* Print, like fprintf, to O. No-op if O is NULL. */ +void +oprintf (outf_p o, const char *S, ...) + ATTRIBUTE_PRINTF_2; + +/* An output file, suitable for definitions, that can see declarations + made in INPF and is linked into every language that uses INPF. May + return NULL in plugin mode. The INPF argument is almost const, but + since the result is cached in its inpoutf field it cannot be + declared const. */ +outf_p get_output_file_with_visibility (input_file* inpf); + +/* The name of an output file, suitable for definitions, that can see + declarations made in INPF and is linked into every language that + uses INPF. May return NULL. */ +const char *get_output_file_name (input_file *inpf); + + +/* Source directory. */ +extern const char *srcdir; /* (-S) program argument. */ + +/* Length of srcdir name. */ +extern size_t srcdir_len; + +/* Variable used for reading and writing the state. */ +extern const char *read_state_filename; /* (-r) program argument. */ +extern const char *write_state_filename; /* (-w) program argument. */ + +/* Functions reading and writing the entire gengtype state, called from + main, and implemented in file gengtype-state.c. */ +void read_state (const char* path); +/* Write the state, and update the state_number field in types. */ +void write_state (const char* path); + + +/* Print an error message. */ +extern void error_at_line +(const struct fileloc *pos, const char *msg, ...) ATTRIBUTE_PRINTF_2; + +/* Constructor routines for types. */ +extern void do_typedef (const char *s, type_p t, struct fileloc *pos); +extern void do_scalar_typedef (const char *s, struct fileloc *pos); +extern type_p resolve_typedef (const char *s, struct fileloc *pos); +extern void add_subclass (type_p base, type_p subclass); +extern type_p new_structure (const char *name, enum typekind kind, + struct fileloc *pos, pair_p fields, + options_p o, type_p base); +type_p create_user_defined_type (const char *, struct fileloc *); +extern type_p find_structure (const char *s, enum typekind kind); +extern type_p create_scalar_type (const char *name); +extern type_p create_pointer (type_p t); +extern type_p create_array (type_p t, const char *len); +extern pair_p create_field_at (pair_p next, type_p type, + const char *name, options_p opt, + struct fileloc *pos); +extern pair_p nreverse_pairs (pair_p list); +extern type_p adjust_field_type (type_p, options_p); +extern void note_variable (const char *s, type_p t, options_p o, + struct fileloc *pos); + +/* Lexer and parser routines. */ +extern int yylex (const char **yylval); +extern void yybegin (const char *fname); +extern void yyend (void); +extern void parse_file (const char *name); +extern bool hit_error; + +/* Token codes. */ +enum gty_token +{ + EOF_TOKEN = 0, + + /* Per standard convention, codes in the range (0, UCHAR_MAX] + represent single characters with those character codes. */ + CHAR_TOKEN_OFFSET = UCHAR_MAX + 1, + GTY_TOKEN = CHAR_TOKEN_OFFSET, + TYPEDEF, + EXTERN, + STATIC, + UNION, + STRUCT, + ENUM, + ELLIPSIS, + PTR_ALIAS, + NESTED_PTR, + USER_GTY, + NUM, + SCALAR, + ID, + STRING, + CHAR, + ARRAY, + IGNORABLE_CXX_KEYWORD, + + /* print_token assumes that any token >= FIRST_TOKEN_WITH_VALUE may have + a meaningful value to be printed. */ + FIRST_TOKEN_WITH_VALUE = USER_GTY +}; + + +/* Level for verbose messages, e.g. output file generation... */ +extern int verbosity_level; /* (-v) program argument. */ + +/* For debugging purposes we provide two flags. */ + +/* Dump everything to understand gengtype's state. Might be useful to + gengtype users. */ +extern int do_dump; /* (-d) program argument. */ + +/* Trace the execution by many DBGPRINTF (with the position inside + gengtype source code). Only useful to debug gengtype itself. */ +extern int do_debug; /* (-D) program argument. */ + +#define DBGPRINTF(Fmt,...) do {if (do_debug) \ + fprintf (stderr, "%s:%d: " Fmt "\n", \ + lbasename (__FILE__),__LINE__, ##__VA_ARGS__);} while (0) +void dbgprint_count_type_at (const char *, int, const char *, type_p); +#define DBGPRINT_COUNT_TYPE(Msg,Ty) do {if (do_debug) \ + dbgprint_count_type_at (__FILE__, __LINE__, Msg, Ty);}while (0) + +#define FOR_ALL_INHERITED_FIELDS(TYPE, FIELD_VAR) \ + for (type_p sub = (TYPE); sub; sub = sub->u.s.base_class) \ + for (FIELD_VAR = sub->u.s.fields; FIELD_VAR; FIELD_VAR = FIELD_VAR->next) + +extern bool +opts_have (options_p opts, const char *str); + + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/genrtl.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/genrtl.h new file mode 100644 index 0000000..e20e339 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/genrtl.h @@ -0,0 +1,1212 @@ +/* Generated automatically by gengenrtl from rtl.def. */ + +#ifndef GCC_GENRTL_H +#define GCC_GENRTL_H + +#include "statistics.h" + +static inline rtx +gen_rtx_fmt_0_stat (RTX_CODE code, machine_mode mode MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + X0EXP (rt, 0) = NULL_RTX; + + return rt; +} + +#define gen_rtx_fmt_0(c, m)\ + gen_rtx_fmt_0_stat (c, m MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_ee_stat (RTX_CODE code, machine_mode mode, + rtx arg0, + rtx arg1 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XEXP (rt, 0) = arg0; + XEXP (rt, 1) = arg1; + + return rt; +} + +#define gen_rtx_fmt_ee(c, m, p0, p1)\ + gen_rtx_fmt_ee_stat (c, m, p0, p1 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_ue_stat (RTX_CODE code, machine_mode mode, + rtx arg0, + rtx arg1 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XEXP (rt, 0) = arg0; + XEXP (rt, 1) = arg1; + + return rt; +} + +#define gen_rtx_fmt_ue(c, m, p0, p1)\ + gen_rtx_fmt_ue_stat (c, m, p0, p1 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_ie_stat (RTX_CODE code, machine_mode mode, + int arg0, + rtx arg1 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XINT (rt, 0) = arg0; + XEXP (rt, 1) = arg1; + + return rt; +} + +#define gen_rtx_fmt_ie(c, m, p0, p1)\ + gen_rtx_fmt_ie_stat (c, m, p0, p1 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_E_stat (RTX_CODE code, machine_mode mode, + rtvec arg0 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XVEC (rt, 0) = arg0; + + return rt; +} + +#define gen_rtx_fmt_E(c, m, p0)\ + gen_rtx_fmt_E_stat (c, m, p0 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_i_stat (RTX_CODE code, machine_mode mode, + int arg0 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XINT (rt, 0) = arg0; + + return rt; +} + +#define gen_rtx_fmt_i(c, m, p0)\ + gen_rtx_fmt_i_stat (c, m, p0 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_uuBeiie_stat (RTX_CODE code, machine_mode mode, + rtx arg0, + rtx arg1, + basic_block arg2, + rtx arg3, + int arg4, + int arg5, + rtx arg6 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XEXP (rt, 0) = arg0; + XEXP (rt, 1) = arg1; + XBBDEF (rt, 2) = arg2; + XEXP (rt, 3) = arg3; + XINT (rt, 4) = arg4; + XINT (rt, 5) = arg5; + XEXP (rt, 6) = arg6; + + return rt; +} + +#define gen_rtx_fmt_uuBeiie(c, m, p0, p1, p2, p3, p4, p5, p6)\ + gen_rtx_fmt_uuBeiie_stat (c, m, p0, p1, p2, p3, p4, p5, p6 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_uuBeiie0_stat (RTX_CODE code, machine_mode mode, + rtx arg0, + rtx arg1, + basic_block arg2, + rtx arg3, + int arg4, + int arg5, + rtx arg6 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XEXP (rt, 0) = arg0; + XEXP (rt, 1) = arg1; + XBBDEF (rt, 2) = arg2; + XEXP (rt, 3) = arg3; + XINT (rt, 4) = arg4; + XINT (rt, 5) = arg5; + XEXP (rt, 6) = arg6; + X0EXP (rt, 7) = NULL_RTX; + + return rt; +} + +#define gen_rtx_fmt_uuBeiie0(c, m, p0, p1, p2, p3, p4, p5, p6)\ + gen_rtx_fmt_uuBeiie0_stat (c, m, p0, p1, p2, p3, p4, p5, p6 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_uuBeiiee_stat (RTX_CODE code, machine_mode mode, + rtx arg0, + rtx arg1, + basic_block arg2, + rtx arg3, + int arg4, + int arg5, + rtx arg6, + rtx arg7 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XEXP (rt, 0) = arg0; + XEXP (rt, 1) = arg1; + XBBDEF (rt, 2) = arg2; + XEXP (rt, 3) = arg3; + XINT (rt, 4) = arg4; + XINT (rt, 5) = arg5; + XEXP (rt, 6) = arg6; + XEXP (rt, 7) = arg7; + + return rt; +} + +#define gen_rtx_fmt_uuBeiiee(c, m, p0, p1, p2, p3, p4, p5, p6, p7)\ + gen_rtx_fmt_uuBeiiee_stat (c, m, p0, p1, p2, p3, p4, p5, p6, p7 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_uuBe0000_stat (RTX_CODE code, machine_mode mode, + rtx arg0, + rtx arg1, + basic_block arg2, + rtx arg3 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XEXP (rt, 0) = arg0; + XEXP (rt, 1) = arg1; + XBBDEF (rt, 2) = arg2; + XEXP (rt, 3) = arg3; + X0EXP (rt, 4) = NULL_RTX; + X0EXP (rt, 5) = NULL_RTX; + X0EXP (rt, 6) = NULL_RTX; + X0EXP (rt, 7) = NULL_RTX; + + return rt; +} + +#define gen_rtx_fmt_uuBe0000(c, m, p0, p1, p2, p3)\ + gen_rtx_fmt_uuBe0000_stat (c, m, p0, p1, p2, p3 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_uu00000_stat (RTX_CODE code, machine_mode mode, + rtx arg0, + rtx arg1 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XEXP (rt, 0) = arg0; + XEXP (rt, 1) = arg1; + X0EXP (rt, 2) = NULL_RTX; + X0EXP (rt, 3) = NULL_RTX; + X0EXP (rt, 4) = NULL_RTX; + X0EXP (rt, 5) = NULL_RTX; + X0EXP (rt, 6) = NULL_RTX; + + return rt; +} + +#define gen_rtx_fmt_uu00000(c, m, p0, p1)\ + gen_rtx_fmt_uu00000_stat (c, m, p0, p1 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_uuB00is_stat (RTX_CODE code, machine_mode mode, + rtx arg0, + rtx arg1, + basic_block arg2, + int arg3, + const char *arg4 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XEXP (rt, 0) = arg0; + XEXP (rt, 1) = arg1; + XBBDEF (rt, 2) = arg2; + X0EXP (rt, 3) = NULL_RTX; + X0EXP (rt, 4) = NULL_RTX; + XINT (rt, 5) = arg3; + XSTR (rt, 6) = arg4; + + return rt; +} + +#define gen_rtx_fmt_uuB00is(c, m, p0, p1, p2, p3, p4)\ + gen_rtx_fmt_uuB00is_stat (c, m, p0, p1, p2, p3, p4 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_si_stat (RTX_CODE code, machine_mode mode, + const char *arg0, + int arg1 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XSTR (rt, 0) = arg0; + XINT (rt, 1) = arg1; + + return rt; +} + +#define gen_rtx_fmt_si(c, m, p0, p1)\ + gen_rtx_fmt_si_stat (c, m, p0, p1 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_ssiEEEi_stat (RTX_CODE code, machine_mode mode, + const char *arg0, + const char *arg1, + int arg2, + rtvec arg3, + rtvec arg4, + rtvec arg5, + int arg6 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XSTR (rt, 0) = arg0; + XSTR (rt, 1) = arg1; + XINT (rt, 2) = arg2; + XVEC (rt, 3) = arg3; + XVEC (rt, 4) = arg4; + XVEC (rt, 5) = arg5; + XINT (rt, 6) = arg6; + + return rt; +} + +#define gen_rtx_fmt_ssiEEEi(c, m, p0, p1, p2, p3, p4, p5, p6)\ + gen_rtx_fmt_ssiEEEi_stat (c, m, p0, p1, p2, p3, p4, p5, p6 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_Ei_stat (RTX_CODE code, machine_mode mode, + rtvec arg0, + int arg1 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XVEC (rt, 0) = arg0; + XINT (rt, 1) = arg1; + + return rt; +} + +#define gen_rtx_fmt_Ei(c, m, p0, p1)\ + gen_rtx_fmt_Ei_stat (c, m, p0, p1 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_eEee0_stat (RTX_CODE code, machine_mode mode, + rtx arg0, + rtvec arg1, + rtx arg2, + rtx arg3 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XEXP (rt, 0) = arg0; + XVEC (rt, 1) = arg1; + XEXP (rt, 2) = arg2; + XEXP (rt, 3) = arg3; + X0EXP (rt, 4) = NULL_RTX; + + return rt; +} + +#define gen_rtx_fmt_eEee0(c, m, p0, p1, p2, p3)\ + gen_rtx_fmt_eEee0_stat (c, m, p0, p1, p2, p3 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_eee_stat (RTX_CODE code, machine_mode mode, + rtx arg0, + rtx arg1, + rtx arg2 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XEXP (rt, 0) = arg0; + XEXP (rt, 1) = arg1; + XEXP (rt, 2) = arg2; + + return rt; +} + +#define gen_rtx_fmt_eee(c, m, p0, p1, p2)\ + gen_rtx_fmt_eee_stat (c, m, p0, p1, p2 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_e_stat (RTX_CODE code, machine_mode mode, + rtx arg0 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XEXP (rt, 0) = arg0; + + return rt; +} + +#define gen_rtx_fmt_e(c, m, p0)\ + gen_rtx_fmt_e_stat (c, m, p0 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt__stat (RTX_CODE code, machine_mode mode MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + + return rt; +} + +#define gen_rtx_fmt_(c, m)\ + gen_rtx_fmt__stat (c, m MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_w_stat (RTX_CODE code, machine_mode mode, + HOST_WIDE_INT arg0 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XWINT (rt, 0) = arg0; + + return rt; +} + +#define gen_rtx_fmt_w(c, m, p0)\ + gen_rtx_fmt_w_stat (c, m, p0 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_www_stat (RTX_CODE code, machine_mode mode, + HOST_WIDE_INT arg0, + HOST_WIDE_INT arg1, + HOST_WIDE_INT arg2 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XWINT (rt, 0) = arg0; + XWINT (rt, 1) = arg1; + XWINT (rt, 2) = arg2; + + return rt; +} + +#define gen_rtx_fmt_www(c, m, p0, p1, p2)\ + gen_rtx_fmt_www_stat (c, m, p0, p1, p2 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_s_stat (RTX_CODE code, machine_mode mode, + const char *arg0 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XSTR (rt, 0) = arg0; + + return rt; +} + +#define gen_rtx_fmt_s(c, m, p0)\ + gen_rtx_fmt_s_stat (c, m, p0 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_ei_stat (RTX_CODE code, machine_mode mode, + rtx arg0, + int arg1 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XEXP (rt, 0) = arg0; + XINT (rt, 1) = arg1; + + return rt; +} + +#define gen_rtx_fmt_ei(c, m, p0, p1)\ + gen_rtx_fmt_ei_stat (c, m, p0, p1 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_e0_stat (RTX_CODE code, machine_mode mode, + rtx arg0 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XEXP (rt, 0) = arg0; + X0EXP (rt, 1) = NULL_RTX; + + return rt; +} + +#define gen_rtx_fmt_e0(c, m, p0)\ + gen_rtx_fmt_e0_stat (c, m, p0 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_u_stat (RTX_CODE code, machine_mode mode, + rtx arg0 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XEXP (rt, 0) = arg0; + + return rt; +} + +#define gen_rtx_fmt_u(c, m, p0)\ + gen_rtx_fmt_u_stat (c, m, p0 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_s0_stat (RTX_CODE code, machine_mode mode, + const char *arg0 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XSTR (rt, 0) = arg0; + X0EXP (rt, 1) = NULL_RTX; + + return rt; +} + +#define gen_rtx_fmt_s0(c, m, p0)\ + gen_rtx_fmt_s0_stat (c, m, p0 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_te_stat (RTX_CODE code, machine_mode mode, + tree arg0, + rtx arg1 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XTREE (rt, 0) = arg0; + XEXP (rt, 1) = arg1; + + return rt; +} + +#define gen_rtx_fmt_te(c, m, p0, p1)\ + gen_rtx_fmt_te_stat (c, m, p0, p1 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_t_stat (RTX_CODE code, machine_mode mode, + tree arg0 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XTREE (rt, 0) = arg0; + + return rt; +} + +#define gen_rtx_fmt_t(c, m, p0)\ + gen_rtx_fmt_t_stat (c, m, p0 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_iss_stat (RTX_CODE code, machine_mode mode, + int arg0, + const char *arg1, + const char *arg2 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XINT (rt, 0) = arg0; + XSTR (rt, 1) = arg1; + XSTR (rt, 2) = arg2; + + return rt; +} + +#define gen_rtx_fmt_iss(c, m, p0, p1, p2)\ + gen_rtx_fmt_iss_stat (c, m, p0, p1, p2 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_is_stat (RTX_CODE code, machine_mode mode, + int arg0, + const char *arg1 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XINT (rt, 0) = arg0; + XSTR (rt, 1) = arg1; + + return rt; +} + +#define gen_rtx_fmt_is(c, m, p0, p1)\ + gen_rtx_fmt_is_stat (c, m, p0, p1 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_isE_stat (RTX_CODE code, machine_mode mode, + int arg0, + const char *arg1, + rtvec arg2 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XINT (rt, 0) = arg0; + XSTR (rt, 1) = arg1; + XVEC (rt, 2) = arg2; + + return rt; +} + +#define gen_rtx_fmt_isE(c, m, p0, p1, p2)\ + gen_rtx_fmt_isE_stat (c, m, p0, p1, p2 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_iE_stat (RTX_CODE code, machine_mode mode, + int arg0, + rtvec arg1 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XINT (rt, 0) = arg0; + XVEC (rt, 1) = arg1; + + return rt; +} + +#define gen_rtx_fmt_iE(c, m, p0, p1)\ + gen_rtx_fmt_iE_stat (c, m, p0, p1 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_ss_stat (RTX_CODE code, machine_mode mode, + const char *arg0, + const char *arg1 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XSTR (rt, 0) = arg0; + XSTR (rt, 1) = arg1; + + return rt; +} + +#define gen_rtx_fmt_ss(c, m, p0, p1)\ + gen_rtx_fmt_ss_stat (c, m, p0, p1 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_eE_stat (RTX_CODE code, machine_mode mode, + rtx arg0, + rtvec arg1 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XEXP (rt, 0) = arg0; + XVEC (rt, 1) = arg1; + + return rt; +} + +#define gen_rtx_fmt_eE(c, m, p0, p1)\ + gen_rtx_fmt_eE_stat (c, m, p0, p1 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_ses_stat (RTX_CODE code, machine_mode mode, + const char *arg0, + rtx arg1, + const char *arg2 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XSTR (rt, 0) = arg0; + XEXP (rt, 1) = arg1; + XSTR (rt, 2) = arg2; + + return rt; +} + +#define gen_rtx_fmt_ses(c, m, p0, p1, p2)\ + gen_rtx_fmt_ses_stat (c, m, p0, p1, p2 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_sss_stat (RTX_CODE code, machine_mode mode, + const char *arg0, + const char *arg1, + const char *arg2 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XSTR (rt, 0) = arg0; + XSTR (rt, 1) = arg1; + XSTR (rt, 2) = arg2; + + return rt; +} + +#define gen_rtx_fmt_sss(c, m, p0, p1, p2)\ + gen_rtx_fmt_sss_stat (c, m, p0, p1, p2 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_sse_stat (RTX_CODE code, machine_mode mode, + const char *arg0, + const char *arg1, + rtx arg2 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XSTR (rt, 0) = arg0; + XSTR (rt, 1) = arg1; + XEXP (rt, 2) = arg2; + + return rt; +} + +#define gen_rtx_fmt_sse(c, m, p0, p1, p2)\ + gen_rtx_fmt_sse_stat (c, m, p0, p1, p2 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_sies_stat (RTX_CODE code, machine_mode mode, + const char *arg0, + int arg1, + rtx arg2, + const char *arg3 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XSTR (rt, 0) = arg0; + XINT (rt, 1) = arg1; + XEXP (rt, 2) = arg2; + XSTR (rt, 3) = arg3; + + return rt; +} + +#define gen_rtx_fmt_sies(c, m, p0, p1, p2, p3)\ + gen_rtx_fmt_sies_stat (c, m, p0, p1, p2, p3 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_sE_stat (RTX_CODE code, machine_mode mode, + const char *arg0, + rtvec arg1 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XSTR (rt, 0) = arg0; + XVEC (rt, 1) = arg1; + + return rt; +} + +#define gen_rtx_fmt_sE(c, m, p0, p1)\ + gen_rtx_fmt_sE_stat (c, m, p0, p1 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_ii_stat (RTX_CODE code, machine_mode mode, + int arg0, + int arg1 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XINT (rt, 0) = arg0; + XINT (rt, 1) = arg1; + + return rt; +} + +#define gen_rtx_fmt_ii(c, m, p0, p1)\ + gen_rtx_fmt_ii_stat (c, m, p0, p1 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_Ee_stat (RTX_CODE code, machine_mode mode, + rtvec arg0, + rtx arg1 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XVEC (rt, 0) = arg0; + XEXP (rt, 1) = arg1; + + return rt; +} + +#define gen_rtx_fmt_Ee(c, m, p0, p1)\ + gen_rtx_fmt_Ee_stat (c, m, p0, p1 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_sEsE_stat (RTX_CODE code, machine_mode mode, + const char *arg0, + rtvec arg1, + const char *arg2, + rtvec arg3 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XSTR (rt, 0) = arg0; + XVEC (rt, 1) = arg1; + XSTR (rt, 2) = arg2; + XVEC (rt, 3) = arg3; + + return rt; +} + +#define gen_rtx_fmt_sEsE(c, m, p0, p1, p2, p3)\ + gen_rtx_fmt_sEsE_stat (c, m, p0, p1, p2, p3 MEM_STAT_INFO) + +static inline rtx +gen_rtx_fmt_ssss_stat (RTX_CODE code, machine_mode mode, + const char *arg0, + const char *arg1, + const char *arg2, + const char *arg3 MEM_STAT_DECL) +{ + rtx rt; + rt = rtx_alloc_stat (code PASS_MEM_STAT); + + PUT_MODE_RAW (rt, mode); + XSTR (rt, 0) = arg0; + XSTR (rt, 1) = arg1; + XSTR (rt, 2) = arg2; + XSTR (rt, 3) = arg3; + + return rt; +} + +#define gen_rtx_fmt_ssss(c, m, p0, p1, p2, p3)\ + gen_rtx_fmt_ssss_stat (c, m, p0, p1, p2, p3 MEM_STAT_INFO) + + +#define gen_rtx_VALUE(MODE) \ + gen_rtx_fmt_0 (VALUE, (MODE)) +#define gen_rtx_DEBUG_EXPR(MODE) \ + gen_rtx_fmt_0 (DEBUG_EXPR, (MODE)) +#define gen_rtx_raw_EXPR_LIST(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (EXPR_LIST, (MODE), (ARG0), (ARG1)) +#define gen_rtx_raw_INSN_LIST(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ue (INSN_LIST, (MODE), (ARG0), (ARG1)) +#define gen_rtx_INT_LIST(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ie (INT_LIST, (MODE), (ARG0), (ARG1)) +#define gen_rtx_SEQUENCE(MODE, ARG0) \ + gen_rtx_fmt_E (SEQUENCE, (MODE), (ARG0)) +#define gen_rtx_ADDRESS(MODE, ARG0) \ + gen_rtx_fmt_i (ADDRESS, (MODE), (ARG0)) +#define gen_rtx_DEBUG_INSN(MODE, ARG0, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \ + gen_rtx_fmt_uuBeiie (DEBUG_INSN, (MODE), (ARG0), (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6)) +#define gen_rtx_raw_INSN(MODE, ARG0, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \ + gen_rtx_fmt_uuBeiie (INSN, (MODE), (ARG0), (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6)) +#define gen_rtx_JUMP_INSN(MODE, ARG0, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \ + gen_rtx_fmt_uuBeiie0 (JUMP_INSN, (MODE), (ARG0), (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6)) +#define gen_rtx_CALL_INSN(MODE, ARG0, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \ + gen_rtx_fmt_uuBeiiee (CALL_INSN, (MODE), (ARG0), (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7)) +#define gen_rtx_JUMP_TABLE_DATA(MODE, ARG0, ARG1, ARG2, ARG3) \ + gen_rtx_fmt_uuBe0000 (JUMP_TABLE_DATA, (MODE), (ARG0), (ARG1), (ARG2), (ARG3)) +#define gen_rtx_BARRIER(MODE, ARG0, ARG1) \ + gen_rtx_fmt_uu00000 (BARRIER, (MODE), (ARG0), (ARG1)) +#define gen_rtx_CODE_LABEL(MODE, ARG0, ARG1, ARG2, ARG3, ARG4) \ + gen_rtx_fmt_uuB00is (CODE_LABEL, (MODE), (ARG0), (ARG1), (ARG2), (ARG3), (ARG4)) +#define gen_rtx_COND_EXEC(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (COND_EXEC, (MODE), (ARG0), (ARG1)) +#define gen_rtx_PARALLEL(MODE, ARG0) \ + gen_rtx_fmt_E (PARALLEL, (MODE), (ARG0)) +#define gen_rtx_ASM_INPUT(MODE, ARG0, ARG1) \ + gen_rtx_fmt_si (ASM_INPUT, (MODE), (ARG0), (ARG1)) +#define gen_rtx_ASM_OPERANDS(MODE, ARG0, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \ + gen_rtx_fmt_ssiEEEi (ASM_OPERANDS, (MODE), (ARG0), (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6)) +#define gen_rtx_UNSPEC(MODE, ARG0, ARG1) \ + gen_rtx_fmt_Ei (UNSPEC, (MODE), (ARG0), (ARG1)) +#define gen_rtx_UNSPEC_VOLATILE(MODE, ARG0, ARG1) \ + gen_rtx_fmt_Ei (UNSPEC_VOLATILE, (MODE), (ARG0), (ARG1)) +#define gen_rtx_ADDR_VEC(MODE, ARG0) \ + gen_rtx_fmt_E (ADDR_VEC, (MODE), (ARG0)) +#define gen_rtx_ADDR_DIFF_VEC(MODE, ARG0, ARG1, ARG2, ARG3) \ + gen_rtx_fmt_eEee0 (ADDR_DIFF_VEC, (MODE), (ARG0), (ARG1), (ARG2), (ARG3)) +#define gen_rtx_PREFETCH(MODE, ARG0, ARG1, ARG2) \ + gen_rtx_fmt_eee (PREFETCH, (MODE), (ARG0), (ARG1), (ARG2)) +#define gen_rtx_SET(ARG0, ARG1) \ + gen_rtx_fmt_ee (SET, VOIDmode, (ARG0), (ARG1)) +#define gen_rtx_USE(MODE, ARG0) \ + gen_rtx_fmt_e (USE, (MODE), (ARG0)) +#define gen_rtx_CLOBBER(MODE, ARG0) \ + gen_rtx_fmt_e (CLOBBER, (MODE), (ARG0)) +#define gen_rtx_CALL(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (CALL, (MODE), (ARG0), (ARG1)) +#define gen_rtx_raw_RETURN(MODE) \ + gen_rtx_fmt_ (RETURN, (MODE)) +#define gen_rtx_raw_SIMPLE_RETURN(MODE) \ + gen_rtx_fmt_ (SIMPLE_RETURN, (MODE)) +#define gen_rtx_EH_RETURN(MODE) \ + gen_rtx_fmt_ (EH_RETURN, (MODE)) +#define gen_rtx_TRAP_IF(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (TRAP_IF, (MODE), (ARG0), (ARG1)) +#define gen_rtx_raw_CONST_INT(MODE, ARG0) \ + gen_rtx_fmt_w (CONST_INT, (MODE), (ARG0)) +#define gen_rtx_raw_CONST_VECTOR(MODE, ARG0) \ + gen_rtx_fmt_E (CONST_VECTOR, (MODE), (ARG0)) +#define gen_rtx_CONST_STRING(MODE, ARG0) \ + gen_rtx_fmt_s (CONST_STRING, (MODE), (ARG0)) +#define gen_rtx_CONST(MODE, ARG0) \ + gen_rtx_fmt_e (CONST, (MODE), (ARG0)) +#define gen_rtx_raw_PC(MODE) \ + gen_rtx_fmt_ (PC, (MODE)) +#define gen_rtx_SCRATCH(MODE) \ + gen_rtx_fmt_ (SCRATCH, (MODE)) +#define gen_rtx_raw_SUBREG(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ei (SUBREG, (MODE), (ARG0), (ARG1)) +#define gen_rtx_STRICT_LOW_PART(MODE, ARG0) \ + gen_rtx_fmt_e (STRICT_LOW_PART, (MODE), (ARG0)) +#define gen_rtx_CONCAT(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (CONCAT, (MODE), (ARG0), (ARG1)) +#define gen_rtx_CONCATN(MODE, ARG0) \ + gen_rtx_fmt_E (CONCATN, (MODE), (ARG0)) +#define gen_rtx_raw_MEM(MODE, ARG0) \ + gen_rtx_fmt_e0 (MEM, (MODE), (ARG0)) +#define gen_rtx_LABEL_REF(MODE, ARG0) \ + gen_rtx_fmt_u (LABEL_REF, (MODE), (ARG0)) +#define gen_rtx_SYMBOL_REF(MODE, ARG0) \ + gen_rtx_fmt_s0 (SYMBOL_REF, (MODE), (ARG0)) +#define gen_rtx_raw_CC0(MODE) \ + gen_rtx_fmt_ (CC0, (MODE)) +#define gen_rtx_IF_THEN_ELSE(MODE, ARG0, ARG1, ARG2) \ + gen_rtx_fmt_eee (IF_THEN_ELSE, (MODE), (ARG0), (ARG1), (ARG2)) +#define gen_rtx_COMPARE(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (COMPARE, (MODE), (ARG0), (ARG1)) +#define gen_rtx_PLUS(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (PLUS, (MODE), (ARG0), (ARG1)) +#define gen_rtx_MINUS(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (MINUS, (MODE), (ARG0), (ARG1)) +#define gen_rtx_NEG(MODE, ARG0) \ + gen_rtx_fmt_e (NEG, (MODE), (ARG0)) +#define gen_rtx_MULT(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (MULT, (MODE), (ARG0), (ARG1)) +#define gen_rtx_SS_MULT(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (SS_MULT, (MODE), (ARG0), (ARG1)) +#define gen_rtx_US_MULT(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (US_MULT, (MODE), (ARG0), (ARG1)) +#define gen_rtx_DIV(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (DIV, (MODE), (ARG0), (ARG1)) +#define gen_rtx_SS_DIV(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (SS_DIV, (MODE), (ARG0), (ARG1)) +#define gen_rtx_US_DIV(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (US_DIV, (MODE), (ARG0), (ARG1)) +#define gen_rtx_MOD(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (MOD, (MODE), (ARG0), (ARG1)) +#define gen_rtx_UDIV(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (UDIV, (MODE), (ARG0), (ARG1)) +#define gen_rtx_UMOD(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (UMOD, (MODE), (ARG0), (ARG1)) +#define gen_rtx_AND(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (AND, (MODE), (ARG0), (ARG1)) +#define gen_rtx_IOR(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (IOR, (MODE), (ARG0), (ARG1)) +#define gen_rtx_XOR(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (XOR, (MODE), (ARG0), (ARG1)) +#define gen_rtx_NOT(MODE, ARG0) \ + gen_rtx_fmt_e (NOT, (MODE), (ARG0)) +#define gen_rtx_ASHIFT(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (ASHIFT, (MODE), (ARG0), (ARG1)) +#define gen_rtx_ROTATE(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (ROTATE, (MODE), (ARG0), (ARG1)) +#define gen_rtx_ASHIFTRT(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (ASHIFTRT, (MODE), (ARG0), (ARG1)) +#define gen_rtx_LSHIFTRT(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (LSHIFTRT, (MODE), (ARG0), (ARG1)) +#define gen_rtx_ROTATERT(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (ROTATERT, (MODE), (ARG0), (ARG1)) +#define gen_rtx_SMIN(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (SMIN, (MODE), (ARG0), (ARG1)) +#define gen_rtx_SMAX(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (SMAX, (MODE), (ARG0), (ARG1)) +#define gen_rtx_UMIN(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (UMIN, (MODE), (ARG0), (ARG1)) +#define gen_rtx_UMAX(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (UMAX, (MODE), (ARG0), (ARG1)) +#define gen_rtx_PRE_DEC(MODE, ARG0) \ + gen_rtx_fmt_e (PRE_DEC, (MODE), (ARG0)) +#define gen_rtx_PRE_INC(MODE, ARG0) \ + gen_rtx_fmt_e (PRE_INC, (MODE), (ARG0)) +#define gen_rtx_POST_DEC(MODE, ARG0) \ + gen_rtx_fmt_e (POST_DEC, (MODE), (ARG0)) +#define gen_rtx_POST_INC(MODE, ARG0) \ + gen_rtx_fmt_e (POST_INC, (MODE), (ARG0)) +#define gen_rtx_PRE_MODIFY(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (PRE_MODIFY, (MODE), (ARG0), (ARG1)) +#define gen_rtx_POST_MODIFY(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (POST_MODIFY, (MODE), (ARG0), (ARG1)) +#define gen_rtx_NE(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (NE, (MODE), (ARG0), (ARG1)) +#define gen_rtx_EQ(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (EQ, (MODE), (ARG0), (ARG1)) +#define gen_rtx_GE(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (GE, (MODE), (ARG0), (ARG1)) +#define gen_rtx_GT(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (GT, (MODE), (ARG0), (ARG1)) +#define gen_rtx_LE(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (LE, (MODE), (ARG0), (ARG1)) +#define gen_rtx_LT(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (LT, (MODE), (ARG0), (ARG1)) +#define gen_rtx_GEU(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (GEU, (MODE), (ARG0), (ARG1)) +#define gen_rtx_GTU(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (GTU, (MODE), (ARG0), (ARG1)) +#define gen_rtx_LEU(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (LEU, (MODE), (ARG0), (ARG1)) +#define gen_rtx_LTU(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (LTU, (MODE), (ARG0), (ARG1)) +#define gen_rtx_UNORDERED(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (UNORDERED, (MODE), (ARG0), (ARG1)) +#define gen_rtx_ORDERED(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (ORDERED, (MODE), (ARG0), (ARG1)) +#define gen_rtx_UNEQ(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (UNEQ, (MODE), (ARG0), (ARG1)) +#define gen_rtx_UNGE(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (UNGE, (MODE), (ARG0), (ARG1)) +#define gen_rtx_UNGT(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (UNGT, (MODE), (ARG0), (ARG1)) +#define gen_rtx_UNLE(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (UNLE, (MODE), (ARG0), (ARG1)) +#define gen_rtx_UNLT(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (UNLT, (MODE), (ARG0), (ARG1)) +#define gen_rtx_LTGT(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (LTGT, (MODE), (ARG0), (ARG1)) +#define gen_rtx_SIGN_EXTEND(MODE, ARG0) \ + gen_rtx_fmt_e (SIGN_EXTEND, (MODE), (ARG0)) +#define gen_rtx_ZERO_EXTEND(MODE, ARG0) \ + gen_rtx_fmt_e (ZERO_EXTEND, (MODE), (ARG0)) +#define gen_rtx_TRUNCATE(MODE, ARG0) \ + gen_rtx_fmt_e (TRUNCATE, (MODE), (ARG0)) +#define gen_rtx_FLOAT_EXTEND(MODE, ARG0) \ + gen_rtx_fmt_e (FLOAT_EXTEND, (MODE), (ARG0)) +#define gen_rtx_FLOAT_TRUNCATE(MODE, ARG0) \ + gen_rtx_fmt_e (FLOAT_TRUNCATE, (MODE), (ARG0)) +#define gen_rtx_FLOAT(MODE, ARG0) \ + gen_rtx_fmt_e (FLOAT, (MODE), (ARG0)) +#define gen_rtx_FIX(MODE, ARG0) \ + gen_rtx_fmt_e (FIX, (MODE), (ARG0)) +#define gen_rtx_UNSIGNED_FLOAT(MODE, ARG0) \ + gen_rtx_fmt_e (UNSIGNED_FLOAT, (MODE), (ARG0)) +#define gen_rtx_UNSIGNED_FIX(MODE, ARG0) \ + gen_rtx_fmt_e (UNSIGNED_FIX, (MODE), (ARG0)) +#define gen_rtx_FRACT_CONVERT(MODE, ARG0) \ + gen_rtx_fmt_e (FRACT_CONVERT, (MODE), (ARG0)) +#define gen_rtx_UNSIGNED_FRACT_CONVERT(MODE, ARG0) \ + gen_rtx_fmt_e (UNSIGNED_FRACT_CONVERT, (MODE), (ARG0)) +#define gen_rtx_SAT_FRACT(MODE, ARG0) \ + gen_rtx_fmt_e (SAT_FRACT, (MODE), (ARG0)) +#define gen_rtx_UNSIGNED_SAT_FRACT(MODE, ARG0) \ + gen_rtx_fmt_e (UNSIGNED_SAT_FRACT, (MODE), (ARG0)) +#define gen_rtx_ABS(MODE, ARG0) \ + gen_rtx_fmt_e (ABS, (MODE), (ARG0)) +#define gen_rtx_SQRT(MODE, ARG0) \ + gen_rtx_fmt_e (SQRT, (MODE), (ARG0)) +#define gen_rtx_BSWAP(MODE, ARG0) \ + gen_rtx_fmt_e (BSWAP, (MODE), (ARG0)) +#define gen_rtx_FFS(MODE, ARG0) \ + gen_rtx_fmt_e (FFS, (MODE), (ARG0)) +#define gen_rtx_CLRSB(MODE, ARG0) \ + gen_rtx_fmt_e (CLRSB, (MODE), (ARG0)) +#define gen_rtx_CLZ(MODE, ARG0) \ + gen_rtx_fmt_e (CLZ, (MODE), (ARG0)) +#define gen_rtx_CTZ(MODE, ARG0) \ + gen_rtx_fmt_e (CTZ, (MODE), (ARG0)) +#define gen_rtx_POPCOUNT(MODE, ARG0) \ + gen_rtx_fmt_e (POPCOUNT, (MODE), (ARG0)) +#define gen_rtx_PARITY(MODE, ARG0) \ + gen_rtx_fmt_e (PARITY, (MODE), (ARG0)) +#define gen_rtx_SIGN_EXTRACT(MODE, ARG0, ARG1, ARG2) \ + gen_rtx_fmt_eee (SIGN_EXTRACT, (MODE), (ARG0), (ARG1), (ARG2)) +#define gen_rtx_ZERO_EXTRACT(MODE, ARG0, ARG1, ARG2) \ + gen_rtx_fmt_eee (ZERO_EXTRACT, (MODE), (ARG0), (ARG1), (ARG2)) +#define gen_rtx_HIGH(MODE, ARG0) \ + gen_rtx_fmt_e (HIGH, (MODE), (ARG0)) +#define gen_rtx_LO_SUM(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (LO_SUM, (MODE), (ARG0), (ARG1)) +#define gen_rtx_VEC_MERGE(MODE, ARG0, ARG1, ARG2) \ + gen_rtx_fmt_eee (VEC_MERGE, (MODE), (ARG0), (ARG1), (ARG2)) +#define gen_rtx_VEC_SELECT(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (VEC_SELECT, (MODE), (ARG0), (ARG1)) +#define gen_rtx_VEC_CONCAT(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (VEC_CONCAT, (MODE), (ARG0), (ARG1)) +#define gen_rtx_VEC_DUPLICATE(MODE, ARG0) \ + gen_rtx_fmt_e (VEC_DUPLICATE, (MODE), (ARG0)) +#define gen_rtx_SS_PLUS(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (SS_PLUS, (MODE), (ARG0), (ARG1)) +#define gen_rtx_US_PLUS(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (US_PLUS, (MODE), (ARG0), (ARG1)) +#define gen_rtx_SS_MINUS(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (SS_MINUS, (MODE), (ARG0), (ARG1)) +#define gen_rtx_SS_NEG(MODE, ARG0) \ + gen_rtx_fmt_e (SS_NEG, (MODE), (ARG0)) +#define gen_rtx_US_NEG(MODE, ARG0) \ + gen_rtx_fmt_e (US_NEG, (MODE), (ARG0)) +#define gen_rtx_SS_ABS(MODE, ARG0) \ + gen_rtx_fmt_e (SS_ABS, (MODE), (ARG0)) +#define gen_rtx_SS_ASHIFT(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (SS_ASHIFT, (MODE), (ARG0), (ARG1)) +#define gen_rtx_US_ASHIFT(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (US_ASHIFT, (MODE), (ARG0), (ARG1)) +#define gen_rtx_US_MINUS(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ee (US_MINUS, (MODE), (ARG0), (ARG1)) +#define gen_rtx_SS_TRUNCATE(MODE, ARG0) \ + gen_rtx_fmt_e (SS_TRUNCATE, (MODE), (ARG0)) +#define gen_rtx_US_TRUNCATE(MODE, ARG0) \ + gen_rtx_fmt_e (US_TRUNCATE, (MODE), (ARG0)) +#define gen_rtx_FMA(MODE, ARG0, ARG1, ARG2) \ + gen_rtx_fmt_eee (FMA, (MODE), (ARG0), (ARG1), (ARG2)) +#define gen_rtx_DEBUG_IMPLICIT_PTR(MODE, ARG0) \ + gen_rtx_fmt_t (DEBUG_IMPLICIT_PTR, (MODE), (ARG0)) +#define gen_rtx_ENTRY_VALUE(MODE) \ + gen_rtx_fmt_0 (ENTRY_VALUE, (MODE)) +#define gen_rtx_DEBUG_PARAMETER_REF(MODE, ARG0) \ + gen_rtx_fmt_t (DEBUG_PARAMETER_REF, (MODE), (ARG0)) +#define gen_rtx_MATCH_OPERAND(MODE, ARG0, ARG1, ARG2) \ + gen_rtx_fmt_iss (MATCH_OPERAND, (MODE), (ARG0), (ARG1), (ARG2)) +#define gen_rtx_MATCH_SCRATCH(MODE, ARG0, ARG1) \ + gen_rtx_fmt_is (MATCH_SCRATCH, (MODE), (ARG0), (ARG1)) +#define gen_rtx_MATCH_OPERATOR(MODE, ARG0, ARG1, ARG2) \ + gen_rtx_fmt_isE (MATCH_OPERATOR, (MODE), (ARG0), (ARG1), (ARG2)) +#define gen_rtx_MATCH_PARALLEL(MODE, ARG0, ARG1, ARG2) \ + gen_rtx_fmt_isE (MATCH_PARALLEL, (MODE), (ARG0), (ARG1), (ARG2)) +#define gen_rtx_MATCH_DUP(MODE, ARG0) \ + gen_rtx_fmt_i (MATCH_DUP, (MODE), (ARG0)) +#define gen_rtx_MATCH_OP_DUP(MODE, ARG0, ARG1) \ + gen_rtx_fmt_iE (MATCH_OP_DUP, (MODE), (ARG0), (ARG1)) +#define gen_rtx_MATCH_PAR_DUP(MODE, ARG0, ARG1) \ + gen_rtx_fmt_iE (MATCH_PAR_DUP, (MODE), (ARG0), (ARG1)) +#define gen_rtx_MATCH_CODE(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ss (MATCH_CODE, (MODE), (ARG0), (ARG1)) +#define gen_rtx_MATCH_TEST(MODE, ARG0) \ + gen_rtx_fmt_s (MATCH_TEST, (MODE), (ARG0)) +#define gen_rtx_DEFINE_DELAY(MODE, ARG0, ARG1) \ + gen_rtx_fmt_eE (DEFINE_DELAY, (MODE), (ARG0), (ARG1)) +#define gen_rtx_DEFINE_PREDICATE(MODE, ARG0, ARG1, ARG2) \ + gen_rtx_fmt_ses (DEFINE_PREDICATE, (MODE), (ARG0), (ARG1), (ARG2)) +#define gen_rtx_DEFINE_SPECIAL_PREDICATE(MODE, ARG0, ARG1, ARG2) \ + gen_rtx_fmt_ses (DEFINE_SPECIAL_PREDICATE, (MODE), (ARG0), (ARG1), (ARG2)) +#define gen_rtx_DEFINE_REGISTER_CONSTRAINT(MODE, ARG0, ARG1, ARG2) \ + gen_rtx_fmt_sss (DEFINE_REGISTER_CONSTRAINT, (MODE), (ARG0), (ARG1), (ARG2)) +#define gen_rtx_DEFINE_CONSTRAINT(MODE, ARG0, ARG1, ARG2) \ + gen_rtx_fmt_sse (DEFINE_CONSTRAINT, (MODE), (ARG0), (ARG1), (ARG2)) +#define gen_rtx_DEFINE_MEMORY_CONSTRAINT(MODE, ARG0, ARG1, ARG2) \ + gen_rtx_fmt_sse (DEFINE_MEMORY_CONSTRAINT, (MODE), (ARG0), (ARG1), (ARG2)) +#define gen_rtx_DEFINE_SPECIAL_MEMORY_CONSTRAINT(MODE, ARG0, ARG1, ARG2) \ + gen_rtx_fmt_sse (DEFINE_SPECIAL_MEMORY_CONSTRAINT, (MODE), (ARG0), (ARG1), (ARG2)) +#define gen_rtx_DEFINE_ADDRESS_CONSTRAINT(MODE, ARG0, ARG1, ARG2) \ + gen_rtx_fmt_sse (DEFINE_ADDRESS_CONSTRAINT, (MODE), (ARG0), (ARG1), (ARG2)) +#define gen_rtx_EXCLUSION_SET(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ss (EXCLUSION_SET, (MODE), (ARG0), (ARG1)) +#define gen_rtx_PRESENCE_SET(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ss (PRESENCE_SET, (MODE), (ARG0), (ARG1)) +#define gen_rtx_FINAL_PRESENCE_SET(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ss (FINAL_PRESENCE_SET, (MODE), (ARG0), (ARG1)) +#define gen_rtx_ABSENCE_SET(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ss (ABSENCE_SET, (MODE), (ARG0), (ARG1)) +#define gen_rtx_FINAL_ABSENCE_SET(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ss (FINAL_ABSENCE_SET, (MODE), (ARG0), (ARG1)) +#define gen_rtx_DEFINE_AUTOMATON(MODE, ARG0) \ + gen_rtx_fmt_s (DEFINE_AUTOMATON, (MODE), (ARG0)) +#define gen_rtx_AUTOMATA_OPTION(MODE, ARG0) \ + gen_rtx_fmt_s (AUTOMATA_OPTION, (MODE), (ARG0)) +#define gen_rtx_DEFINE_RESERVATION(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ss (DEFINE_RESERVATION, (MODE), (ARG0), (ARG1)) +#define gen_rtx_DEFINE_INSN_RESERVATION(MODE, ARG0, ARG1, ARG2, ARG3) \ + gen_rtx_fmt_sies (DEFINE_INSN_RESERVATION, (MODE), (ARG0), (ARG1), (ARG2), (ARG3)) +#define gen_rtx_DEFINE_ATTR(MODE, ARG0, ARG1, ARG2) \ + gen_rtx_fmt_sse (DEFINE_ATTR, (MODE), (ARG0), (ARG1), (ARG2)) +#define gen_rtx_DEFINE_ENUM_ATTR(MODE, ARG0, ARG1, ARG2) \ + gen_rtx_fmt_sse (DEFINE_ENUM_ATTR, (MODE), (ARG0), (ARG1), (ARG2)) +#define gen_rtx_ATTR(MODE, ARG0) \ + gen_rtx_fmt_s (ATTR, (MODE), (ARG0)) +#define gen_rtx_SET_ATTR(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ss (SET_ATTR, (MODE), (ARG0), (ARG1)) +#define gen_rtx_SET_ATTR_ALTERNATIVE(MODE, ARG0, ARG1) \ + gen_rtx_fmt_sE (SET_ATTR_ALTERNATIVE, (MODE), (ARG0), (ARG1)) +#define gen_rtx_EQ_ATTR(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ss (EQ_ATTR, (MODE), (ARG0), (ARG1)) +#define gen_rtx_EQ_ATTR_ALT(MODE, ARG0, ARG1) \ + gen_rtx_fmt_ii (EQ_ATTR_ALT, (MODE), (ARG0), (ARG1)) +#define gen_rtx_ATTR_FLAG(MODE, ARG0) \ + gen_rtx_fmt_s (ATTR_FLAG, (MODE), (ARG0)) +#define gen_rtx_COND(MODE, ARG0, ARG1) \ + gen_rtx_fmt_Ee (COND, (MODE), (ARG0), (ARG1)) +#define gen_rtx_DEFINE_SUBST(MODE, ARG0, ARG1, ARG2, ARG3) \ + gen_rtx_fmt_sEsE (DEFINE_SUBST, (MODE), (ARG0), (ARG1), (ARG2), (ARG3)) +#define gen_rtx_DEFINE_SUBST_ATTR(MODE, ARG0, ARG1, ARG2, ARG3) \ + gen_rtx_fmt_ssss (DEFINE_SUBST_ATTR, (MODE), (ARG0), (ARG1), (ARG2), (ARG3)) + +#endif /* GCC_GENRTL_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gensupport.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gensupport.h new file mode 100644 index 0000000..5db6b0f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gensupport.h @@ -0,0 +1,227 @@ +/* Declarations for rtx-reader support for gen* routines. + Copyright (C) 2000-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GENSUPPORT_H +#define GCC_GENSUPPORT_H + +#include "read-md.h" + +struct obstack; +extern struct obstack *rtl_obstack; + +/* Information about an .md define_* rtx. */ +struct md_rtx_info { + /* The rtx itself. */ + rtx def; + + /* The location of the first line of the rtx. */ + file_location loc; + + /* The unique number attached to the rtx. Currently all define_insns, + define_expands, define_splits, define_peepholes and define_peephole2s + share the same insn_code index space. */ + int index; +}; + +#define OPTAB_CL(name, pat, c, b, l) name, +#define OPTAB_CX(name, pat) +#define OPTAB_CD(name, pat) name, +#define OPTAB_NL(name, pat, c, b, s, l) name, +#define OPTAB_NC(name, pat, c) name, +#define OPTAB_NX(name, pat) +#define OPTAB_VL(name, pat, c, b, s, l) name, +#define OPTAB_VC(name, pat, c) name, +#define OPTAB_VX(name, pat) +#define OPTAB_DC(name, pat, c) name, +#define OPTAB_D(name, pat) name, + +/* Enumerates all optabs. */ +typedef enum optab_tag { + unknown_optab, +#include "optabs.def" + NUM_OPTABS +} optab; + +#undef OPTAB_CL +#undef OPTAB_CX +#undef OPTAB_CD +#undef OPTAB_NL +#undef OPTAB_NC +#undef OPTAB_NX +#undef OPTAB_VL +#undef OPTAB_VC +#undef OPTAB_VX +#undef OPTAB_DC +#undef OPTAB_D + +/* Describes one entry in optabs.def. */ +struct optab_def +{ + /* The name of the optab (e.g. "add_optab"). */ + const char *name; + + /* The pattern that matching define_expands and define_insns have. + See the comment at the head of optabs.def for details. */ + const char *pattern; + + /* The initializers (in the form of C code) for the libcall_basename, + libcall_suffix and libcall_gen fields of (convert_)optab_libcall_d. */ + const char *base; + const char *suffix; + const char *libcall; + + /* The optab's enum value. */ + unsigned int op; + + /* The value returned by optab_to_code (OP). */ + enum rtx_code fcode; + + /* CODE if code_to_optab (CODE) should return OP, otherwise UNKNOWN. */ + enum rtx_code rcode; + + /* 1: conversion optabs with libcall data, + 2: conversion optabs without libcall data, + 3: non-conversion optabs with libcall data ("normal" and "overflow" + optabs in the optabs.def comment) + 4: non-conversion optabs without libcall data ("direct" optabs). */ + unsigned int kind; +}; + +extern optab_def optabs[]; +extern unsigned int num_optabs; + +/* Information about an instruction name that matches an optab pattern. */ +struct optab_pattern +{ + /* The name of the instruction. */ + const char *name; + + /* The matching optab. */ + unsigned int op; + + /* The optab modes. M2 is only significant for conversion optabs; + it is zero otherwise. */ + unsigned int m1, m2; + + /* An index that provides a lexicographical sort of (OP, M2, M1). + Used by genopinit.c. */ + unsigned int sort_num; +}; + +extern rtx add_implicit_parallel (rtvec); +extern rtx_reader *init_rtx_reader_args_cb (int, const char **, + bool (*)(const char *)); +extern rtx_reader *init_rtx_reader_args (int, const char **); +extern bool read_md_rtx (md_rtx_info *); +extern unsigned int get_num_insn_codes (); + +/* Set this to 0 to disable automatic elision of insn patterns which + can never be used in this configuration. See genconditions.c. + Must be set before calling init_md_reader. */ +extern int insn_elision; + +/* Return the C test that says whether a definition rtx can be used, + or "" if it can be used unconditionally. */ +extern const char *get_c_test (rtx); + +/* If the C test passed as the argument can be evaluated at compile + time, return its truth value; else return -1. The test must have + appeared somewhere in the machine description when genconditions + was run. */ +extern int maybe_eval_c_test (const char *); + +/* Add an entry to the table of conditions. Used by genconditions and + by read-rtl.c. */ +extern void add_c_test (const char *, int); + +/* This structure is used internally by gensupport.c and genconditions.c. */ +struct c_test +{ + const char *expr; + int value; +}; + +#ifdef __HASHTAB_H__ +extern hashval_t hash_c_test (const void *); +extern int cmp_c_test (const void *, const void *); +extern void traverse_c_tests (htab_trav, void *); +#endif + +/* Predicate handling: helper functions and data structures. */ + +struct pred_data +{ + struct pred_data *next; /* for iterating over the set of all preds */ + const char *name; /* predicate name */ + bool special; /* special handling of modes? */ + + /* data used primarily by genpreds.c */ + const char *c_block; /* C test block */ + rtx exp; /* RTL test expression */ + + /* data used primarily by genrecog.c */ + enum rtx_code singleton; /* if pred takes only one code, that code */ + int num_codes; /* number of codes accepted */ + bool allows_non_lvalue; /* if pred allows non-lvalue expressions */ + bool allows_non_const; /* if pred allows non-const expressions */ + bool codes[NUM_RTX_CODE]; /* set of codes accepted */ +}; + +extern struct pred_data *first_predicate; +extern struct pred_data *lookup_predicate (const char *); +extern void add_predicate_code (struct pred_data *, enum rtx_code); +extern void add_predicate (struct pred_data *); + +#define FOR_ALL_PREDICATES(p) for (p = first_predicate; p; p = p->next) + +struct pattern_stats +{ + /* The largest match_operand, match_operator or match_parallel + number found. */ + int max_opno; + + /* The largest match_dup, match_op_dup or match_par_dup number found. */ + int max_dup_opno; + + /* The smallest and largest match_scratch number found. */ + int min_scratch_opno; + int max_scratch_opno; + + /* The number of times match_dup, match_op_dup or match_par_dup appears + in the pattern. */ + int num_dups; + + /* The number of rtx arguments to the generator function. */ + int num_generator_args; + + /* The number of rtx operands in an insn. */ + int num_insn_operands; + + /* The number of operand variables that are needed. */ + int num_operand_vars; +}; + +extern void get_pattern_stats (struct pattern_stats *ranges, rtvec vec); +extern void compute_test_codes (rtx, file_location, char *); +extern file_location get_file_location (rtx); +extern const char *get_emit_function (rtx); +extern bool needs_barrier_p (rtx); +extern bool find_optab (optab_pattern *, const char *); + +#endif /* GCC_GENSUPPORT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ggc-internal.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ggc-internal.h new file mode 100644 index 0000000..e3f3d3f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ggc-internal.h @@ -0,0 +1,118 @@ +/* Garbage collection for the GNU compiler. Internal definitions + for ggc-*.c and stringpool.c. + + Copyright (C) 2009-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GGC_INTERNAL_H +#define GCC_GGC_INTERNAL_H + + +/* Call ggc_set_mark on all the roots. */ +extern void ggc_mark_roots (void); + +/* Stringpool. */ + +/* Mark the entries in the string pool. */ +extern void ggc_mark_stringpool (void); + +/* Purge the entries in the string pool. */ +extern void ggc_purge_stringpool (void); + +/* Save and restore the string pool entries for PCH. */ + +extern void gt_pch_save_stringpool (void); +extern void gt_pch_fixup_stringpool (void); +extern void gt_pch_restore_stringpool (void); + +/* PCH and GGC handling for strings, mostly trivial. */ +extern void gt_pch_p_S (void *, void *, gt_pointer_operator, void *); + +/* PCH. */ + +struct ggc_pch_data; + +/* Return a new ggc_pch_data structure. */ +extern struct ggc_pch_data *init_ggc_pch (void); + +/* The second parameter and third parameters give the address and size + of an object. Update the ggc_pch_data structure with as much of + that information as is necessary. The bool argument should be true + if the object is a string. */ +extern void ggc_pch_count_object (struct ggc_pch_data *, void *, size_t, bool); + +/* Return the total size of the data to be written to hold all + the objects previously passed to ggc_pch_count_object. */ +extern size_t ggc_pch_total_size (struct ggc_pch_data *); + +/* The objects, when read, will most likely be at the address + in the second parameter. */ +extern void ggc_pch_this_base (struct ggc_pch_data *, void *); + +/* Assuming that the objects really do end up at the address + passed to ggc_pch_this_base, return the address of this object. + The bool argument should be true if the object is a string. */ +extern char *ggc_pch_alloc_object (struct ggc_pch_data *, void *, size_t, bool); + +/* Write out any initial information required. */ +extern void ggc_pch_prepare_write (struct ggc_pch_data *, FILE *); + +/* Write out this object, including any padding. The last argument should be + true if the object is a string. */ +extern void ggc_pch_write_object (struct ggc_pch_data *, FILE *, void *, + void *, size_t, bool); + +/* All objects have been written, write out any final information + required. */ +extern void ggc_pch_finish (struct ggc_pch_data *, FILE *); + +/* A PCH file has just been read in at the address specified second + parameter. Set up the GC implementation for the new objects. */ +extern void ggc_pch_read (FILE *, void *); + + +/* Allocation and collection. */ + +/* When set, ggc_collect will do collection. */ +extern bool ggc_force_collect; + +extern void ggc_record_overhead (size_t, size_t, void * FINAL_MEM_STAT_DECL); + +extern void ggc_free_overhead (void *); + +extern void ggc_prune_overhead_list (void); + +/* Return the number of bytes allocated at the indicated address. */ +extern size_t ggc_get_size (const void *); + + +/* Statistics. */ + +/* This structure contains the statistics common to all collectors. + Particular collectors can extend this structure. */ +struct ggc_statistics +{ + /* At present, we don't really gather any interesting statistics. */ + int unused; +}; + +/* Used by the various collectors to gather and print statistics that + do not depend on the collector in use. */ +extern void ggc_print_common_statistics (FILE *, ggc_statistics *); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ggc.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ggc.h new file mode 100644 index 0000000..d100a53 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ggc.h @@ -0,0 +1,327 @@ +/* Garbage collection for the GNU compiler. + + Copyright (C) 1998-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GGC_H +#define GCC_GGC_H + +/* Symbols are marked with `ggc' for `gcc gc' so as not to interfere with + an external gc library that might be linked in. */ + +/* Constants for general use. */ +extern const char empty_string[]; /* empty string */ + +/* Internal functions and data structures used by the GTY + machinery, including the generated gt*.[hc] files. */ + +#include "gtype-desc.h" + +/* One of these applies its third parameter (with cookie in the fourth + parameter) to each pointer in the object pointed to by the first + parameter, using the second parameter. */ +typedef void (*gt_note_pointers) (void *, void *, gt_pointer_operator, + void *); + +/* One of these is called before objects are re-ordered in memory. + The first parameter is the original object, the second is the + subobject that has had its pointers reordered, the third parameter + can compute the new values of a pointer when given the cookie in + the fourth parameter. */ +typedef void (*gt_handle_reorder) (void *, void *, gt_pointer_operator, + void *); + +/* Used by the gt_pch_n_* routines. Register an object in the hash table. */ +extern int gt_pch_note_object (void *, void *, gt_note_pointers); + +/* Used by the gt_pch_n_* routines. Register that an object has a reorder + function. */ +extern void gt_pch_note_reorder (void *, void *, gt_handle_reorder); + +/* generated function to clear caches in gc memory. */ +extern void gt_clear_caches (); + +/* Mark the object in the first parameter and anything it points to. */ +typedef void (*gt_pointer_walker) (void *); + +/* Structures for the easy way to mark roots. + In an array, terminated by having base == NULL. */ +struct ggc_root_tab { + void *base; + size_t nelt; + size_t stride; + gt_pointer_walker cb; + gt_pointer_walker pchw; +}; +#define LAST_GGC_ROOT_TAB { NULL, 0, 0, NULL, NULL } +/* Pointers to arrays of ggc_root_tab, terminated by NULL. */ +extern const struct ggc_root_tab * const gt_ggc_rtab[]; +extern const struct ggc_root_tab * const gt_ggc_deletable_rtab[]; +extern const struct ggc_root_tab * const gt_pch_scalar_rtab[]; + +/* If EXPR is not NULL and previously unmarked, mark it and evaluate + to true. Otherwise evaluate to false. */ +#define ggc_test_and_set_mark(EXPR) \ + ((EXPR) != NULL && ((void *) (EXPR)) != (void *) 1 && ! ggc_set_mark (EXPR)) + +#define ggc_mark(EXPR) \ + do { \ + const void *const a__ = (EXPR); \ + if (a__ != NULL && a__ != (void *) 1) \ + ggc_set_mark (a__); \ + } while (0) + +/* Actually set the mark on a particular region of memory, but don't + follow pointers. This function is called by ggc_mark_*. It + returns zero if the object was not previously marked; nonzero if + the object was already marked, or if, for any other reason, + pointers in this data structure should not be traversed. */ +extern int ggc_set_mark (const void *); + +/* Return 1 if P has been marked, zero otherwise. + P must have been allocated by the GC allocator; it mustn't point to + static objects, stack variables, or memory allocated with malloc. */ +extern int ggc_marked_p (const void *); + +/* PCH and GGC handling for strings, mostly trivial. */ +extern void gt_pch_n_S (const void *); +extern void gt_ggc_m_S (const void *); + +/* End of GTY machinery API. */ + +/* Initialize the string pool. */ +extern void init_stringpool (void); + +/* Initialize the garbage collector. */ +extern void init_ggc (void); + +/* When true, identifier nodes are considered as GC roots. When + false, identifier nodes are treated like any other GC-allocated + object, and the identifier hash table is treated as a weak + hash. */ +extern bool ggc_protect_identifiers; + +/* Write out all GCed objects to F. */ +extern void gt_pch_save (FILE *f); + + +/* Allocation. */ + +/* The internal primitive. */ +extern void *ggc_internal_alloc (size_t, void (*)(void *), size_t, + size_t CXX_MEM_STAT_INFO) + ATTRIBUTE_MALLOC; + + static inline + void * + ggc_internal_alloc (size_t s CXX_MEM_STAT_INFO) +{ + return ggc_internal_alloc (s, NULL, 0, 1 PASS_MEM_STAT); +} + +extern size_t ggc_round_alloc_size (size_t requested_size); + +/* Allocates cleared memory. */ +extern void *ggc_internal_cleared_alloc (size_t, void (*)(void *), + size_t, size_t + CXX_MEM_STAT_INFO) ATTRIBUTE_MALLOC; + +static inline +void * +ggc_internal_cleared_alloc (size_t s CXX_MEM_STAT_INFO) +{ + return ggc_internal_cleared_alloc (s, NULL, 0, 1 PASS_MEM_STAT); +} + +/* Resize a block. */ +extern void *ggc_realloc (void *, size_t CXX_MEM_STAT_INFO); + +/* Free a block. To be used when known for certain it's not reachable. */ +extern void ggc_free (void *); + +extern void dump_ggc_loc_statistics (bool); + +/* Reallocator. */ +#define GGC_RESIZEVEC(T, P, N) \ + ((T *) ggc_realloc ((P), (N) * sizeof (T) MEM_STAT_INFO)) + +template +void +finalize (void *p) +{ + static_cast (p)->~T (); +} + +template +static inline bool +need_finalization_p () +{ +#if GCC_VERSION >= 4003 + return !__has_trivial_destructor (T); +#else + return true; +#endif +} + +template +static inline T * +ggc_alloc (ALONE_CXX_MEM_STAT_INFO) +{ + if (need_finalization_p ()) + return static_cast (ggc_internal_alloc (sizeof (T), finalize, 0, 1 + PASS_MEM_STAT)); + else + return static_cast (ggc_internal_alloc (sizeof (T), NULL, 0, 1 + PASS_MEM_STAT)); +} + +template +static inline T * +ggc_cleared_alloc (ALONE_CXX_MEM_STAT_INFO) +{ + if (need_finalization_p ()) + return static_cast (ggc_internal_cleared_alloc (sizeof (T), + finalize, 0, 1 + PASS_MEM_STAT)); + else + return static_cast (ggc_internal_cleared_alloc (sizeof (T), NULL, 0, 1 + PASS_MEM_STAT)); +} + +template +static inline T * +ggc_vec_alloc (size_t c CXX_MEM_STAT_INFO) +{ + if (need_finalization_p ()) + return static_cast (ggc_internal_alloc (c * sizeof (T), finalize, + sizeof (T), c PASS_MEM_STAT)); + else + return static_cast (ggc_internal_alloc (c * sizeof (T), NULL, 0, 0 + PASS_MEM_STAT)); +} + +template +static inline T * +ggc_cleared_vec_alloc (size_t c CXX_MEM_STAT_INFO) +{ + if (need_finalization_p ()) + return static_cast (ggc_internal_cleared_alloc (c * sizeof (T), + finalize, + sizeof (T), c + PASS_MEM_STAT)); + else + return static_cast (ggc_internal_cleared_alloc (c * sizeof (T), NULL, + 0, 0 PASS_MEM_STAT)); +} + +static inline void * +ggc_alloc_atomic (size_t s CXX_MEM_STAT_INFO) +{ + return ggc_internal_alloc (s PASS_MEM_STAT); +} + +/* Allocate a gc-able string, and fill it with LENGTH bytes from CONTENTS. + If LENGTH is -1, then CONTENTS is assumed to be a + null-terminated string and the memory sized accordingly. */ +extern const char *ggc_alloc_string (const char *contents, int length + CXX_MEM_STAT_INFO); + +/* Make a copy of S, in GC-able memory. */ +#define ggc_strdup(S) ggc_alloc_string ((S), -1 MEM_STAT_INFO) + +/* Invoke the collector. Garbage collection occurs only when this + function is called, not during allocations. */ +extern void ggc_collect (void); + +/* Assume that all GGC memory is reachable and grow the limits for next collection. */ +extern void ggc_grow (void); + +/* Register an additional root table. This can be useful for some + plugins. Does nothing if the passed pointer is NULL. */ +extern void ggc_register_root_tab (const struct ggc_root_tab *); + +/* Read objects previously saved with gt_pch_save from F. */ +extern void gt_pch_restore (FILE *f); + +/* Statistics. */ + +/* Print allocation statistics. */ +extern void ggc_print_statistics (void); + +extern void stringpool_statistics (void); + +/* Heuristics. */ +extern void init_ggc_heuristics (void); + +#define ggc_alloc_rtvec_sized(NELT) \ + (rtvec_def *) ggc_internal_alloc (sizeof (struct rtvec_def) \ + + ((NELT) - 1) * sizeof (rtx)) \ + +/* Memory statistics passing versions of some allocators. Too few of them to + make gengtype produce them, so just define the needed ones here. */ +static inline struct rtx_def * +ggc_alloc_rtx_def_stat (size_t s CXX_MEM_STAT_INFO) +{ + return (struct rtx_def *) ggc_internal_alloc (s PASS_MEM_STAT); +} + +static inline union tree_node * +ggc_alloc_tree_node_stat (size_t s CXX_MEM_STAT_INFO) +{ + return (union tree_node *) ggc_internal_alloc (s PASS_MEM_STAT); +} + +static inline union tree_node * +ggc_alloc_cleared_tree_node_stat (size_t s CXX_MEM_STAT_INFO) +{ + return (union tree_node *) ggc_internal_cleared_alloc (s PASS_MEM_STAT); +} + +static inline gimple * +ggc_alloc_cleared_gimple_statement_stat (size_t s CXX_MEM_STAT_INFO) +{ + return (gimple *) ggc_internal_cleared_alloc (s PASS_MEM_STAT); +} + +static inline void +gt_ggc_mx (const char *s) +{ + ggc_test_and_set_mark (const_cast (s)); +} + +static inline void +gt_pch_nx (const char *) +{ +} + +static inline void +gt_ggc_mx (int) +{ +} + +static inline void +gt_pch_nx (int) +{ +} + +static inline void +gt_pch_nx (unsigned int) +{ +} + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-builder.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-builder.h new file mode 100644 index 0000000..6f69d97 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-builder.h @@ -0,0 +1,34 @@ +/* Header file for high level statement building routines. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + + +#ifndef GCC_GIMPLE_BUILDER_H +#define GCC_GIMPLE_BUILDER_H + +gassign *build_assign (enum tree_code, tree, int, tree lhs = NULL_TREE); +gassign *build_assign (enum tree_code, gimple *, int, tree lhs = NULL_TREE); +gassign *build_assign (enum tree_code, tree, tree, tree lhs = NULL_TREE); +gassign *build_assign (enum tree_code, gimple *, tree, tree lhs = NULL_TREE); +gassign *build_assign (enum tree_code, tree, gimple *, tree lhs = NULL_TREE); +gassign *build_assign (enum tree_code, gimple *, gimple *, + tree lhs = NULL_TREE); +gassign *build_type_cast (tree, tree, tree lhs = NULL_TREE); +gassign *build_type_cast (tree, gimple *, tree lhs = NULL_TREE); + +#endif /* GCC_GIMPLE_BUILDER_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-expr.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-expr.h new file mode 100644 index 0000000..6e96916 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-expr.h @@ -0,0 +1,176 @@ +/* Header file for gimple decl, type and expressions. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GIMPLE_EXPR_H +#define GCC_GIMPLE_EXPR_H + +extern bool useless_type_conversion_p (tree, tree); + + +extern void gimple_set_body (tree, gimple_seq); +extern gimple_seq gimple_body (tree); +extern bool gimple_has_body_p (tree); +extern const char *gimple_decl_printable_name (tree, int); +extern tree copy_var_decl (tree, tree, tree); +extern tree create_tmp_var_name (const char *); +extern tree create_tmp_var_raw (tree, const char * = NULL); +extern tree create_tmp_var (tree, const char * = NULL); +extern tree create_tmp_reg (tree, const char * = NULL); +extern tree create_tmp_reg_fn (struct function *, tree, const char *); + + +extern void extract_ops_from_tree (tree, enum tree_code *, tree *, tree *, + tree *); +extern void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, + tree *); +extern bool is_gimple_lvalue (tree); +extern bool is_gimple_condexpr (tree); +extern bool is_gimple_address (const_tree); +extern bool is_gimple_invariant_address (const_tree); +extern bool is_gimple_ip_invariant_address (const_tree); +extern bool is_gimple_min_invariant (const_tree); +extern bool is_gimple_ip_invariant (const_tree); +extern bool is_gimple_reg (tree); +extern bool is_gimple_val (tree); +extern bool is_gimple_asm_val (tree); +extern bool is_gimple_min_lval (tree); +extern bool is_gimple_call_addr (tree); +extern bool is_gimple_mem_ref_addr (tree); +extern void flush_mark_addressable_queue (void); +extern void mark_addressable (tree); +extern bool is_gimple_reg_rhs (tree); + +/* Return true if a conversion from either type of TYPE1 and TYPE2 + to the other is not required. Otherwise return false. */ + +static inline bool +types_compatible_p (tree type1, tree type2) +{ + return (type1 == type2 + || (useless_type_conversion_p (type1, type2) + && useless_type_conversion_p (type2, type1))); +} + +/* Return true if TYPE is a suitable type for a scalar register variable. */ + +static inline bool +is_gimple_reg_type (tree type) +{ + return !AGGREGATE_TYPE_P (type); +} + +/* Return true if T is a variable. */ + +static inline bool +is_gimple_variable (tree t) +{ + return (TREE_CODE (t) == VAR_DECL + || TREE_CODE (t) == PARM_DECL + || TREE_CODE (t) == RESULT_DECL + || TREE_CODE (t) == SSA_NAME); +} + +/* Return true if T is a GIMPLE identifier (something with an address). */ + +static inline bool +is_gimple_id (tree t) +{ + return (is_gimple_variable (t) + || TREE_CODE (t) == FUNCTION_DECL + || TREE_CODE (t) == LABEL_DECL + || TREE_CODE (t) == CONST_DECL + /* Allow string constants, since they are addressable. */ + || TREE_CODE (t) == STRING_CST); +} + +/* Return true if OP, an SSA name or a DECL is a virtual operand. */ + +static inline bool +virtual_operand_p (tree op) +{ + if (TREE_CODE (op) == SSA_NAME) + return SSA_NAME_IS_VIRTUAL_OPERAND (op); + + if (TREE_CODE (op) == VAR_DECL) + return VAR_DECL_IS_VIRTUAL_OPERAND (op); + + return false; +} + +/* Return true if T is something whose address can be taken. */ + +static inline bool +is_gimple_addressable (tree t) +{ + return (is_gimple_id (t) || handled_component_p (t) + || TREE_CODE (t) == MEM_REF); +} + +/* Return true if T is a valid gimple constant. */ + +static inline bool +is_gimple_constant (const_tree t) +{ + switch (TREE_CODE (t)) + { + case INTEGER_CST: + case REAL_CST: + case FIXED_CST: + case COMPLEX_CST: + case VECTOR_CST: + case STRING_CST: + return true; + + default: + return false; + } +} + +/* A wrapper around extract_ops_from_tree with 3 ops, for callers which + expect to see only a maximum of two operands. */ + +static inline void +extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0, + tree *op1) +{ + tree op2; + extract_ops_from_tree (expr, code, op0, op1, &op2); + gcc_assert (op2 == NULL_TREE); +} + +/* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL + associated with the callee if known. Otherwise return NULL_TREE. */ + +static inline tree +gimple_call_addr_fndecl (const_tree fn) +{ + if (fn && TREE_CODE (fn) == ADDR_EXPR) + { + tree fndecl = TREE_OPERAND (fn, 0); + if (TREE_CODE (fndecl) == MEM_REF + && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR + && integer_zerop (TREE_OPERAND (fndecl, 1))) + fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0); + if (TREE_CODE (fndecl) == FUNCTION_DECL) + return fndecl; + } + return NULL_TREE; +} + +#endif /* GCC_GIMPLE_EXPR_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-fold.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-fold.h new file mode 100644 index 0000000..e4931a1 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-fold.h @@ -0,0 +1,143 @@ +/* Gimple folding definitions. + + Copyright (C) 2011-2017 Free Software Foundation, Inc. + Contributed by Richard Guenther + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GIMPLE_FOLD_H +#define GCC_GIMPLE_FOLD_H + +extern tree canonicalize_constructor_val (tree, tree); +extern tree get_symbol_constant_value (tree); +extern bool get_range_strlen (tree, tree[2]); +extern tree get_maxval_strlen (tree, int); +extern void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree); +extern bool fold_stmt (gimple_stmt_iterator *); +extern bool fold_stmt (gimple_stmt_iterator *, tree (*) (tree)); +extern bool fold_stmt_inplace (gimple_stmt_iterator *); +extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree, + enum tree_code, tree, tree); +extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree, + enum tree_code, tree, tree); +extern bool optimize_atomic_compare_exchange_p (gimple *); +extern void fold_builtin_atomic_compare_exchange (gimple_stmt_iterator *); +extern bool arith_overflowed_p (enum tree_code, const_tree, const_tree, + const_tree); +extern tree no_follow_ssa_edges (tree); +extern tree follow_single_use_edges (tree); +extern tree gimple_fold_stmt_to_constant_1 (gimple *, tree (*) (tree), + tree (*) (tree) = no_follow_ssa_edges); +extern tree gimple_fold_stmt_to_constant (gimple *, tree (*) (tree)); +extern tree fold_ctor_reference (tree, tree, unsigned HOST_WIDE_INT, + unsigned HOST_WIDE_INT, tree); +extern tree fold_const_aggregate_ref_1 (tree, tree (*) (tree)); +extern tree fold_const_aggregate_ref (tree); +extern tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree, + bool *can_refer = NULL); +extern tree gimple_get_virt_method_for_vtable (HOST_WIDE_INT, tree, + unsigned HOST_WIDE_INT, + bool *can_refer = NULL); +extern tree gimple_fold_indirect_ref (tree); +extern bool arith_code_with_undefined_signed_overflow (tree_code); +extern gimple_seq rewrite_to_defined_overflow (gimple *); + +/* gimple_build, functionally matching fold_buildN, outputs stmts + int the provided sequence, matching and simplifying them on-the-fly. + Supposed to replace force_gimple_operand (fold_buildN (...), ...). */ +extern tree gimple_build (gimple_seq *, location_t, + enum tree_code, tree, tree); +inline tree +gimple_build (gimple_seq *seq, + enum tree_code code, tree type, tree op0) +{ + return gimple_build (seq, UNKNOWN_LOCATION, code, type, op0); +} +extern tree gimple_build (gimple_seq *, location_t, + enum tree_code, tree, tree, tree); +inline tree +gimple_build (gimple_seq *seq, + enum tree_code code, tree type, tree op0, tree op1) +{ + return gimple_build (seq, UNKNOWN_LOCATION, code, type, op0, op1); +} +extern tree gimple_build (gimple_seq *, location_t, + enum tree_code, tree, tree, tree, tree); +inline tree +gimple_build (gimple_seq *seq, + enum tree_code code, tree type, tree op0, tree op1, tree op2) +{ + return gimple_build (seq, UNKNOWN_LOCATION, code, type, op0, op1, op2); +} +extern tree gimple_build (gimple_seq *, location_t, + enum built_in_function, tree, tree); +inline tree +gimple_build (gimple_seq *seq, + enum built_in_function fn, tree type, tree arg0) +{ + return gimple_build (seq, UNKNOWN_LOCATION, fn, type, arg0); +} +extern tree gimple_build (gimple_seq *, location_t, + enum built_in_function, tree, tree, tree); +inline tree +gimple_build (gimple_seq *seq, + enum built_in_function fn, tree type, tree arg0, tree arg1) +{ + return gimple_build (seq, UNKNOWN_LOCATION, fn, type, arg0, arg1); +} +extern tree gimple_build (gimple_seq *, location_t, + enum built_in_function, tree, tree, tree, tree); +inline tree +gimple_build (gimple_seq *seq, + enum built_in_function fn, tree type, + tree arg0, tree arg1, tree arg2) +{ + return gimple_build (seq, UNKNOWN_LOCATION, fn, type, arg0, arg1, arg2); +} + +extern tree gimple_convert (gimple_seq *, location_t, tree, tree); +inline tree +gimple_convert (gimple_seq *seq, tree type, tree op) +{ + return gimple_convert (seq, UNKNOWN_LOCATION, type, op); +} + +extern tree gimple_convert_to_ptrofftype (gimple_seq *, location_t, tree); +inline tree +gimple_convert_to_ptrofftype (gimple_seq *seq, tree op) +{ + return gimple_convert_to_ptrofftype (seq, UNKNOWN_LOCATION, op); +} + +extern bool gimple_stmt_nonnegative_warnv_p (gimple *, bool *, int = 0); +extern bool gimple_stmt_integer_valued_real_p (gimple *, int = 0); + +/* In gimple-match.c. */ +extern tree gimple_simplify (enum tree_code, tree, tree, + gimple_seq *, tree (*)(tree)); +extern tree gimple_simplify (enum tree_code, tree, tree, tree, + gimple_seq *, tree (*)(tree)); +extern tree gimple_simplify (enum tree_code, tree, tree, tree, tree, + gimple_seq *, tree (*)(tree)); +extern tree gimple_simplify (enum built_in_function, tree, tree, + gimple_seq *, tree (*)(tree)); +extern tree gimple_simplify (enum built_in_function, tree, tree, tree, + gimple_seq *, tree (*)(tree)); +extern tree gimple_simplify (enum built_in_function, tree, tree, tree, tree, + gimple_seq *, tree (*)(tree)); + +#endif /* GCC_GIMPLE_FOLD_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-iterator.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-iterator.h new file mode 100644 index 0000000..70f18be --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-iterator.h @@ -0,0 +1,391 @@ +/* Header file for gimple iterators. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GIMPLE_ITERATOR_H +#define GCC_GIMPLE_ITERATOR_H + +/* Iterator object for GIMPLE statement sequences. */ + +struct gimple_stmt_iterator +{ + /* Sequence node holding the current statement. */ + gimple_seq_node ptr; + + /* Sequence and basic block holding the statement. These fields + are necessary to handle edge cases such as when statement is + added to an empty basic block or when the last statement of a + block/sequence is removed. */ + gimple_seq *seq; + basic_block bb; +}; + +/* Iterator over GIMPLE_PHI statements. */ +struct gphi_iterator : public gimple_stmt_iterator +{ + gphi *phi () const + { + return as_a (ptr); + } +}; + +enum gsi_iterator_update +{ + GSI_NEW_STMT, /* Only valid when single statement is added, move + iterator to it. */ + GSI_SAME_STMT, /* Leave the iterator at the same statement. */ + GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable + for linking other statements in the same + direction. */ +}; + +extern void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, + gimple_seq, + enum gsi_iterator_update); +extern void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq, + enum gsi_iterator_update); +extern void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, + gimple_seq, + enum gsi_iterator_update); +extern void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq, + enum gsi_iterator_update); +extern gimple_seq gsi_split_seq_after (gimple_stmt_iterator); +extern void gsi_set_stmt (gimple_stmt_iterator *, gimple *); +extern void gsi_split_seq_before (gimple_stmt_iterator *, gimple_seq *); +extern bool gsi_replace (gimple_stmt_iterator *, gimple *, bool); +extern void gsi_replace_with_seq (gimple_stmt_iterator *, gimple_seq, bool); +extern void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple *, + enum gsi_iterator_update); +extern void gsi_insert_before (gimple_stmt_iterator *, gimple *, + enum gsi_iterator_update); +extern void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple *, + enum gsi_iterator_update); +extern void gsi_insert_after (gimple_stmt_iterator *, gimple *, + enum gsi_iterator_update); +extern bool gsi_remove (gimple_stmt_iterator *, bool); +extern gimple_stmt_iterator gsi_for_stmt (gimple *); +extern gphi_iterator gsi_for_phi (gphi *); +extern void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *); +extern void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *); +extern void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block); +extern void gsi_insert_on_edge (edge, gimple *); +extern void gsi_insert_seq_on_edge (edge, gimple_seq); +extern basic_block gsi_insert_on_edge_immediate (edge, gimple *); +extern basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq); +extern void gsi_commit_edge_inserts (void); +extern void gsi_commit_one_edge_insert (edge, basic_block *); +extern gphi_iterator gsi_start_phis (basic_block); +extern void update_modified_stmts (gimple_seq); + +/* Return a new iterator pointing to GIMPLE_SEQ's first statement. */ + +static inline gimple_stmt_iterator +gsi_start_1 (gimple_seq *seq) +{ + gimple_stmt_iterator i; + + i.ptr = gimple_seq_first (*seq); + i.seq = seq; + i.bb = i.ptr ? gimple_bb (i.ptr) : NULL; + + return i; +} + +#define gsi_start(x) gsi_start_1 (&(x)) + +static inline gimple_stmt_iterator +gsi_none (void) +{ + gimple_stmt_iterator i; + i.ptr = NULL; + i.seq = NULL; + i.bb = NULL; + return i; +} + +/* Return a new iterator pointing to the first statement in basic block BB. */ + +static inline gimple_stmt_iterator +gsi_start_bb (basic_block bb) +{ + gimple_stmt_iterator i; + gimple_seq *seq; + + seq = bb_seq_addr (bb); + i.ptr = gimple_seq_first (*seq); + i.seq = seq; + i.bb = bb; + + return i; +} + +gimple_stmt_iterator gsi_start_edge (edge e); + +/* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */ + +static inline gimple_stmt_iterator +gsi_last_1 (gimple_seq *seq) +{ + gimple_stmt_iterator i; + + i.ptr = gimple_seq_last (*seq); + i.seq = seq; + i.bb = i.ptr ? gimple_bb (i.ptr) : NULL; + + return i; +} + +#define gsi_last(x) gsi_last_1 (&(x)) + +/* Return a new iterator pointing to the last statement in basic block BB. */ + +static inline gimple_stmt_iterator +gsi_last_bb (basic_block bb) +{ + gimple_stmt_iterator i; + gimple_seq *seq; + + seq = bb_seq_addr (bb); + i.ptr = gimple_seq_last (*seq); + i.seq = seq; + i.bb = bb; + + return i; +} + +/* Return true if I is at the end of its sequence. */ + +static inline bool +gsi_end_p (gimple_stmt_iterator i) +{ + return i.ptr == NULL; +} + +/* Return true if I is one statement before the end of its sequence. */ + +static inline bool +gsi_one_before_end_p (gimple_stmt_iterator i) +{ + return i.ptr != NULL && i.ptr->next == NULL; +} + +/* Advance the iterator to the next gimple statement. */ + +static inline void +gsi_next (gimple_stmt_iterator *i) +{ + i->ptr = i->ptr->next; +} + +/* Advance the iterator to the previous gimple statement. */ + +static inline void +gsi_prev (gimple_stmt_iterator *i) +{ + gimple *prev = i->ptr->prev; + if (prev->next) + i->ptr = prev; + else + i->ptr = NULL; +} + +/* Return the current stmt. */ + +static inline gimple * +gsi_stmt (gimple_stmt_iterator i) +{ + return i.ptr; +} + +/* Return a new iterator pointing to the first non-debug statement + in basic block BB. */ + +static inline gimple_stmt_iterator +gsi_start_bb_nondebug (basic_block bb) +{ + gimple_stmt_iterator gsi = gsi_start_bb (bb); + while (!gsi_end_p (gsi) && is_gimple_debug (gsi_stmt (gsi))) + gsi_next (&gsi); + + return gsi; +} + +/* Return a block statement iterator that points to the first non-label + statement in block BB. */ + +static inline gimple_stmt_iterator +gsi_after_labels (basic_block bb) +{ + gimple_stmt_iterator gsi = gsi_start_bb (bb); + + while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL) + gsi_next (&gsi); + + return gsi; +} + +/* Advance the iterator to the next non-debug gimple statement. */ + +static inline void +gsi_next_nondebug (gimple_stmt_iterator *i) +{ + do + { + gsi_next (i); + } + while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i))); +} + +/* Advance the iterator to the previous non-debug gimple statement. */ + +static inline void +gsi_prev_nondebug (gimple_stmt_iterator *i) +{ + do + { + gsi_prev (i); + } + while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i))); +} + +/* Return a new iterator pointing to the first non-debug statement in + basic block BB. */ + +static inline gimple_stmt_iterator +gsi_start_nondebug_bb (basic_block bb) +{ + gimple_stmt_iterator i = gsi_start_bb (bb); + + if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i))) + gsi_next_nondebug (&i); + + return i; +} + +/* Return a new iterator pointing to the first non-debug non-label statement in + basic block BB. */ + +static inline gimple_stmt_iterator +gsi_start_nondebug_after_labels_bb (basic_block bb) +{ + gimple_stmt_iterator i = gsi_after_labels (bb); + + if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i))) + gsi_next_nondebug (&i); + + return i; +} + +/* Return a new iterator pointing to the last non-debug statement in + basic block BB. */ + +static inline gimple_stmt_iterator +gsi_last_nondebug_bb (basic_block bb) +{ + gimple_stmt_iterator i = gsi_last_bb (bb); + + if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i))) + gsi_prev_nondebug (&i); + + return i; +} + +/* Return true if I is followed only by debug statements in its + sequence. */ + +static inline bool +gsi_one_nondebug_before_end_p (gimple_stmt_iterator i) +{ + if (gsi_one_before_end_p (i)) + return true; + if (gsi_end_p (i)) + return false; + gsi_next_nondebug (&i); + return gsi_end_p (i); +} + +/* Iterates I statement iterator to the next non-virtual statement. */ + +static inline void +gsi_next_nonvirtual_phi (gphi_iterator *i) +{ + gphi *phi; + + if (gsi_end_p (*i)) + return; + + phi = i->phi (); + gcc_assert (phi != NULL); + + while (virtual_operand_p (gimple_phi_result (phi))) + { + gsi_next (i); + + if (gsi_end_p (*i)) + return; + + phi = i->phi (); + } +} + +/* Return the basic block associated with this iterator. */ + +static inline basic_block +gsi_bb (gimple_stmt_iterator i) +{ + return i.bb; +} + +/* Return the sequence associated with this iterator. */ + +static inline gimple_seq +gsi_seq (gimple_stmt_iterator i) +{ + return *i.seq; +} + +/* Determine whether SEQ is a nondebug singleton. */ + +static inline bool +gimple_seq_nondebug_singleton_p (gimple_seq seq) +{ + gimple_stmt_iterator gsi; + + /* Find a nondebug gimple. */ + gsi.ptr = gimple_seq_first (seq); + gsi.seq = &seq; + gsi.bb = NULL; + while (!gsi_end_p (gsi) + && is_gimple_debug (gsi_stmt (gsi))) + gsi_next (&gsi); + + /* No nondebug gimple found, not a singleton. */ + if (gsi_end_p (gsi)) + return false; + + /* Find a next nondebug gimple. */ + gsi_next (&gsi); + while (!gsi_end_p (gsi) + && is_gimple_debug (gsi_stmt (gsi))) + gsi_next (&gsi); + + /* Only a singleton if there's no next nondebug gimple. */ + return gsi_end_p (gsi); +} + +#endif /* GCC_GIMPLE_ITERATOR_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-low.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-low.h new file mode 100644 index 0000000..1d5e4cf --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-low.h @@ -0,0 +1,28 @@ +/* Header file for gimple lowering pass. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GIMPLE_LOW_H +#define GCC_GIMPLE_LOW_H + +extern bool gimple_stmt_may_fallthru (gimple *); +extern bool gimple_seq_may_fallthru (gimple_seq); +extern void record_vars_into (tree, tree); +extern void record_vars (tree); + +#endif /* GCC_GIMPLE_LOW_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-match.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-match.h new file mode 100644 index 0000000..23298c4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-match.h @@ -0,0 +1,70 @@ +/* Gimple simplify definitions. + + Copyright (C) 2011-2017 Free Software Foundation, Inc. + Contributed by Richard Guenther + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GIMPLE_MATCH_H +#define GCC_GIMPLE_MATCH_H + + +/* Helper to transparently allow tree codes and builtin function codes + exist in one storage entity. */ +class code_helper +{ +public: + code_helper () {} + code_helper (tree_code code) : rep ((int) code) {} + code_helper (combined_fn fn) : rep (-(int) fn) {} + operator tree_code () const { return (tree_code) rep; } + operator combined_fn () const { return (combined_fn) -rep; } + bool is_tree_code () const { return rep > 0; } + bool is_fn_code () const { return rep < 0; } + int get_rep () const { return rep; } +private: + int rep; +}; + +/* Return whether OPS[0] with CODE is a non-expression result and + a gimple value. */ + +inline bool +gimple_simplified_result_is_gimple_val (code_helper code, tree *ops) +{ + return (code.is_tree_code () + && (TREE_CODE_LENGTH ((tree_code) code) == 0 + || ((tree_code) code) == ADDR_EXPR) + && is_gimple_val (ops[0])); +} + +extern tree (*mprts_hook) (code_helper, tree, tree *); + +bool gimple_simplify (gimple *, code_helper *, tree *, gimple_seq *, + tree (*)(tree), tree (*)(tree)); +bool gimple_resimplify1 (gimple_seq *, code_helper *, tree, tree *, + tree (*)(tree)); +bool gimple_resimplify2 (gimple_seq *, code_helper *, tree, tree *, + tree (*)(tree)); +bool gimple_resimplify3 (gimple_seq *, code_helper *, tree, tree *, + tree (*)(tree)); +tree maybe_push_res_to_seq (code_helper, tree, tree *, + gimple_seq *, tree res = NULL_TREE); +void maybe_build_generic_op (enum tree_code, tree, tree *); + + +#endif /* GCC_GIMPLE_MATCH_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-predict.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-predict.h new file mode 100644 index 0000000..ba58e12 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-predict.h @@ -0,0 +1,83 @@ +/* Gimple prediction routines. + + Copyright (C) 2007-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GIMPLE_PREDICT_H +#define GCC_GIMPLE_PREDICT_H + +#include "predict.h" + +/* Return the predictor of GIMPLE_PREDICT statement GS. */ + +static inline enum br_predictor +gimple_predict_predictor (gimple *gs) +{ + GIMPLE_CHECK (gs, GIMPLE_PREDICT); + return (enum br_predictor) (gs->subcode & ~GF_PREDICT_TAKEN); +} + + +/* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */ + +static inline void +gimple_predict_set_predictor (gimple *gs, enum br_predictor predictor) +{ + GIMPLE_CHECK (gs, GIMPLE_PREDICT); + gs->subcode = (gs->subcode & GF_PREDICT_TAKEN) + | (unsigned) predictor; +} + + +/* Return the outcome of GIMPLE_PREDICT statement GS. */ + +static inline enum prediction +gimple_predict_outcome (gimple *gs) +{ + GIMPLE_CHECK (gs, GIMPLE_PREDICT); + return (gs->subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN; +} + + +/* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */ + +static inline void +gimple_predict_set_outcome (gimple *gs, enum prediction outcome) +{ + GIMPLE_CHECK (gs, GIMPLE_PREDICT); + if (outcome == TAKEN) + gs->subcode |= GF_PREDICT_TAKEN; + else + gs->subcode &= ~GF_PREDICT_TAKEN; +} + +/* Build a GIMPLE_PREDICT statement. PREDICT is one of the predictors from + predict.def, OUTCOME is NOT_TAKEN or TAKEN. */ + +inline gimple * +gimple_build_predict (enum br_predictor predictor, enum prediction outcome) +{ + gimple *p = gimple_alloc (GIMPLE_PREDICT, 0); + /* Ensure all the predictors fit into the lower bits of the subcode. */ + gcc_assert ((int) END_PREDICTORS <= GF_PREDICT_TAKEN); + gimple_predict_set_predictor (p, predictor); + gimple_predict_set_outcome (p, outcome); + return p; +} + +#endif /* GCC_GIMPLE_PREDICT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-pretty-print.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-pretty-print.h new file mode 100644 index 0000000..acc635d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-pretty-print.h @@ -0,0 +1,39 @@ +/* Various declarations for pretty formatting of GIMPLE statements and + expressions. + Copyright (C) 2000-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GIMPLE_PRETTY_PRINT_H +#define GCC_GIMPLE_PRETTY_PRINT_H + +#include "tree-pretty-print.h" + +/* In gimple-pretty-print.c */ +extern void debug_gimple_stmt (gimple *); +extern void debug_gimple_seq (gimple_seq); +extern void print_gimple_seq (FILE *, gimple_seq, int, int); +extern void print_gimple_stmt (FILE *, gimple *, int, int); +extern void debug (gimple &ref); +extern void debug (gimple *ptr); +extern void print_gimple_expr (FILE *, gimple *, int, int); +extern void pp_gimple_stmt_1 (pretty_printer *, gimple *, int, int); +extern void gimple_dump_bb (FILE *, basic_block, int, int); +extern void gimple_dump_bb_for_graph (pretty_printer *, basic_block); +extern void dump_ssaname_info_to_file (FILE *, tree, int); + +#endif /* ! GCC_GIMPLE_PRETTY_PRINT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-ssa.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-ssa.h new file mode 100644 index 0000000..89b3c18 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-ssa.h @@ -0,0 +1,201 @@ +/* Header file for routines that straddle the border between GIMPLE and + SSA in gimple. + Copyright (C) 2009-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GIMPLE_SSA_H +#define GCC_GIMPLE_SSA_H + +#include "tree-ssa-operands.h" + +/* This structure is used to map a gimple statement to a label, + or list of labels to represent transaction restart. */ + +struct GTY((for_user)) tm_restart_node { + gimple *stmt; + tree label_or_list; +}; + +/* Hasher for tm_restart_node. */ + +struct tm_restart_hasher : ggc_ptr_hash +{ + static hashval_t hash (tm_restart_node *n) { return htab_hash_pointer (n); } + + static bool + equal (tm_restart_node *a, tm_restart_node *b) + { + return a == b; + } +}; + +extern void gt_ggc_mx (gimple *&); +extern void gt_pch_nx (gimple *&); + +struct ssa_name_hasher : ggc_ptr_hash +{ + /* Hash a tree in a uid_decl_map. */ + + static hashval_t + hash (tree item) + { + return item->ssa_name.var->decl_minimal.uid; + } + + /* Return true if the DECL_UID in both trees are equal. */ + + static bool + equal (tree a, tree b) +{ + return (a->ssa_name.var->decl_minimal.uid == b->ssa_name.var->decl_minimal.uid); +} +}; + +/* Gimple dataflow datastructure. All publicly available fields shall have + gimple_ accessor defined, all publicly modifiable fields should have + gimple_set accessor. */ +struct GTY(()) gimple_df { + /* Array of all SSA_NAMEs used in the function. */ + vec *ssa_names; + + /* Artificial variable used for the virtual operand FUD chain. */ + tree vop; + + /* The PTA solution for the ESCAPED artificial variable. */ + struct pt_solution escaped; + + /* A map of decls to artificial ssa-names that point to the partition + of the decl. */ + hash_map * GTY((skip(""))) decls_to_pointers; + + /* Free list of SSA_NAMEs. */ + vec *free_ssanames; + + /* Queue of SSA_NAMEs to be freed at the next opportunity. */ + vec *free_ssanames_queue; + + /* Hashtable holding definition for symbol. If this field is not NULL, it + means that the first reference to this variable in the function is a + USE or a VUSE. In those cases, the SSA renamer creates an SSA name + for this variable with an empty defining statement. */ + hash_table *default_defs; + + /* True if there are any symbols that need to be renamed. */ + unsigned int ssa_renaming_needed : 1; + + /* True if all virtual operands need to be renamed. */ + unsigned int rename_vops : 1; + + /* True if the code is in ssa form. */ + unsigned int in_ssa_p : 1; + + /* True if IPA points-to information was computed for this function. */ + unsigned int ipa_pta : 1; + + struct ssa_operands ssa_operands; + + /* Map gimple stmt to tree label (or list of labels) for transaction + restart and abort. */ + hash_table *tm_restart; +}; + + +/* Return true when gimple SSA form was built. + gimple_in_ssa_p is queried by gimplifier in various early stages before SSA + infrastructure is initialized. Check for presence of the datastructures + at first place. */ +static inline bool +gimple_in_ssa_p (const struct function *fun) +{ + return fun && fun->gimple_df && fun->gimple_df->in_ssa_p; +} + +/* Artificial variable used for the virtual operand FUD chain. */ +static inline tree +gimple_vop (const struct function *fun) +{ + gcc_checking_assert (fun && fun->gimple_df); + return fun->gimple_df->vop; +} + +/* Return the set of VUSE operand for statement G. */ + +static inline use_operand_p +gimple_vuse_op (const gimple *g) +{ + struct use_optype_d *ops; + const gimple_statement_with_memory_ops *mem_ops_stmt = + dyn_cast (g); + if (!mem_ops_stmt) + return NULL_USE_OPERAND_P; + ops = mem_ops_stmt->use_ops; + if (ops + && USE_OP_PTR (ops)->use == &mem_ops_stmt->vuse) + return USE_OP_PTR (ops); + return NULL_USE_OPERAND_P; +} + +/* Return the set of VDEF operand for statement G. */ + +static inline def_operand_p +gimple_vdef_op (gimple *g) +{ + gimple_statement_with_memory_ops *mem_ops_stmt = + dyn_cast (g); + if (!mem_ops_stmt) + return NULL_DEF_OPERAND_P; + if (mem_ops_stmt->vdef) + return &mem_ops_stmt->vdef; + return NULL_DEF_OPERAND_P; +} + +/* Mark statement S as modified, and update it. */ + +static inline void +update_stmt (gimple *s) +{ + if (gimple_has_ops (s)) + { + gimple_set_modified (s, true); + update_stmt_operands (cfun, s); + } +} + +/* Update statement S if it has been optimized. */ + +static inline void +update_stmt_if_modified (gimple *s) +{ + if (gimple_modified_p (s)) + update_stmt_operands (cfun, s); +} + +/* Mark statement S as modified, and update it. */ + +static inline void +update_stmt_fn (struct function *fn, gimple *s) +{ + if (gimple_has_ops (s)) + { + gimple_set_modified (s, true); + update_stmt_operands (fn, s); + } +} + + +#endif /* GCC_GIMPLE_SSA_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-streamer.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-streamer.h new file mode 100644 index 0000000..d8a6a43 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-streamer.h @@ -0,0 +1,34 @@ +/* Data structures and functions for streaming GIMPLE. + + Copyright (C) 2011-2017 Free Software Foundation, Inc. + Contributed by Diego Novillo + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GIMPLE_STREAMER_H +#define GCC_GIMPLE_STREAMER_H + +#include "tree-streamer.h" + +/* In gimple-streamer-in.c */ +void input_bb (struct lto_input_block *, enum LTO_tags, struct data_in *, + struct function *, int); + +/* In gimple-streamer-out.c */ +void output_bb (struct output_block *, basic_block, struct function *); + +#endif /* GCC_GIMPLE_STREAMER_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-walk.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-walk.h new file mode 100644 index 0000000..d844933 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple-walk.h @@ -0,0 +1,101 @@ +/* Header file for gimple statement walk support. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GIMPLE_WALK_H +#define GCC_GIMPLE_WALK_H + +/* Convenience routines to walk all statements of a gimple function. + Note that this is useful exclusively before the code is converted + into SSA form. Once the program is in SSA form, the standard + operand interface should be used to analyze/modify statements. */ +struct walk_stmt_info +{ + /* Points to the current statement being walked. */ + gimple_stmt_iterator gsi; + gimple *stmt; + + /* Additional data that the callback functions may want to carry + through the recursion. */ + void *info; + + /* Pointer map used to mark visited tree nodes when calling + walk_tree on each operand. If set to NULL, duplicate tree nodes + will be visited more than once. */ + hash_set *pset; + + /* Operand returned by the callbacks. This is set when calling + walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback + returns non-NULL, this field will contain the tree returned by + the last callback. */ + tree callback_result; + + /* Indicates whether the operand being examined may be replaced + with something that matches is_gimple_val (if true) or something + slightly more complicated (if false). "Something" technically + means the common subset of is_gimple_lvalue and is_gimple_rhs, + but we never try to form anything more complicated than that, so + we don't bother checking. + + Also note that CALLBACK should update this flag while walking the + sub-expressions of a statement. For instance, when walking the + statement 'foo (&var)', the flag VAL_ONLY will initially be set + to true, however, when walking &var, the operand of that + ADDR_EXPR does not need to be a GIMPLE value. */ + BOOL_BITFIELD val_only : 1; + + /* True if we are currently walking the LHS of an assignment. */ + BOOL_BITFIELD is_lhs : 1; + + /* Optional. Set to true by the callback functions if they made any + changes. */ + BOOL_BITFIELD changed : 1; + + /* True if we're interested in location information. */ + BOOL_BITFIELD want_locations : 1; + + /* True if we've removed the statement that was processed. */ + BOOL_BITFIELD removed_stmt : 1; +}; + +/* Callback for walk_gimple_stmt. Called for every statement found + during traversal. The first argument points to the statement to + walk. The second argument is a flag that the callback sets to + 'true' if it the callback handled all the operands and + sub-statements of the statement (the default value of this flag is + 'false'). The third argument is an anonymous pointer to data + to be used by the callback. */ +typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *, + struct walk_stmt_info *); + +extern gimple *walk_gimple_seq_mod (gimple_seq *, walk_stmt_fn, walk_tree_fn, + struct walk_stmt_info *); +extern gimple *walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn, + struct walk_stmt_info *); +extern tree walk_gimple_op (gimple *, walk_tree_fn, struct walk_stmt_info *); +extern tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, + walk_tree_fn, struct walk_stmt_info *); +typedef bool (*walk_stmt_load_store_addr_fn) (gimple *, tree, tree, void *); +extern bool walk_stmt_load_store_addr_ops (gimple *, void *, + walk_stmt_load_store_addr_fn, + walk_stmt_load_store_addr_fn, + walk_stmt_load_store_addr_fn); +extern bool walk_stmt_load_store_ops (gimple *, void *, + walk_stmt_load_store_addr_fn, + walk_stmt_load_store_addr_fn); +#endif /* GCC_GIMPLE_WALK_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple.h new file mode 100644 index 0000000..460011c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimple.h @@ -0,0 +1,6363 @@ +/* Gimple IR definitions. + + Copyright (C) 2007-2017 Free Software Foundation, Inc. + Contributed by Aldy Hernandez + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GIMPLE_H +#define GCC_GIMPLE_H + +#include "tree-ssa-alias.h" +#include "gimple-expr.h" + +typedef gimple *gimple_seq_node; + +enum gimple_code { +#define DEFGSCODE(SYM, STRING, STRUCT) SYM, +#include "gimple.def" +#undef DEFGSCODE + LAST_AND_UNUSED_GIMPLE_CODE +}; + +extern const char *const gimple_code_name[]; +extern const unsigned char gimple_rhs_class_table[]; + +/* Strip the outermost pointer, from tr1/type_traits. */ +template struct remove_pointer { typedef T type; }; +template struct remove_pointer { typedef T type; }; + +/* Error out if a gimple tuple is addressed incorrectly. */ +#if defined ENABLE_GIMPLE_CHECKING +#define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR) +extern void gimple_check_failed (const gimple *, const char *, int, \ + const char *, enum gimple_code, \ + enum tree_code) ATTRIBUTE_NORETURN; + +#define GIMPLE_CHECK(GS, CODE) \ + do { \ + const gimple *__gs = (GS); \ + if (gimple_code (__gs) != (CODE)) \ + gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \ + (CODE), ERROR_MARK); \ + } while (0) +template +static inline T +GIMPLE_CHECK2(const gimple *gs, +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + const char *file = __builtin_FILE (), + int line = __builtin_LINE (), + const char *fun = __builtin_FUNCTION ()) +#else + const char *file = __FILE__, + int line = __LINE__, + const char *fun = NULL) +#endif +{ + T ret = dyn_cast (gs); + if (!ret) + gimple_check_failed (gs, file, line, fun, + remove_pointer::type::code_, ERROR_MARK); + return ret; +} +template +static inline T +GIMPLE_CHECK2(gimple *gs, +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + const char *file = __builtin_FILE (), + int line = __builtin_LINE (), + const char *fun = __builtin_FUNCTION ()) +#else + const char *file = __FILE__, + int line = __LINE__, + const char *fun = NULL) +#endif +{ + T ret = dyn_cast (gs); + if (!ret) + gimple_check_failed (gs, file, line, fun, + remove_pointer::type::code_, ERROR_MARK); + return ret; +} +#else /* not ENABLE_GIMPLE_CHECKING */ +#define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR))) +#define GIMPLE_CHECK(GS, CODE) (void)0 +template +static inline T +GIMPLE_CHECK2(gimple *gs) +{ + return as_a (gs); +} +template +static inline T +GIMPLE_CHECK2(const gimple *gs) +{ + return as_a (gs); +} +#endif + +/* Class of GIMPLE expressions suitable for the RHS of assignments. See + get_gimple_rhs_class. */ +enum gimple_rhs_class +{ + GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */ + GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */ + GIMPLE_BINARY_RHS, /* The expression is a binary operation. */ + GIMPLE_UNARY_RHS, /* The expression is a unary operation. */ + GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA + name, a _DECL, a _REF, etc. */ +}; + +/* Specific flags for individual GIMPLE statements. These flags are + always stored in gimple.subcode and they may only be + defined for statement codes that do not use subcodes. + + Values for the masks can overlap as long as the overlapping values + are never used in the same statement class. + + The maximum mask value that can be defined is 1 << 15 (i.e., each + statement code can hold up to 16 bitflags). + + Keep this list sorted. */ +enum gf_mask { + GF_ASM_INPUT = 1 << 0, + GF_ASM_VOLATILE = 1 << 1, + GF_CALL_FROM_THUNK = 1 << 0, + GF_CALL_RETURN_SLOT_OPT = 1 << 1, + GF_CALL_TAILCALL = 1 << 2, + GF_CALL_VA_ARG_PACK = 1 << 3, + GF_CALL_NOTHROW = 1 << 4, + GF_CALL_ALLOCA_FOR_VAR = 1 << 5, + GF_CALL_INTERNAL = 1 << 6, + GF_CALL_CTRL_ALTERING = 1 << 7, + GF_CALL_WITH_BOUNDS = 1 << 8, + GF_CALL_MUST_TAIL_CALL = 1 << 9, + GF_CALL_BY_DESCRIPTOR = 1 << 10, + GF_OMP_PARALLEL_COMBINED = 1 << 0, + GF_OMP_PARALLEL_GRID_PHONY = 1 << 1, + GF_OMP_TASK_TASKLOOP = 1 << 0, + GF_OMP_FOR_KIND_MASK = (1 << 4) - 1, + GF_OMP_FOR_KIND_FOR = 0, + GF_OMP_FOR_KIND_DISTRIBUTE = 1, + GF_OMP_FOR_KIND_TASKLOOP = 2, + GF_OMP_FOR_KIND_CILKFOR = 3, + GF_OMP_FOR_KIND_OACC_LOOP = 4, + GF_OMP_FOR_KIND_GRID_LOOP = 5, + /* Flag for SIMD variants of OMP_FOR kinds. */ + GF_OMP_FOR_SIMD = 1 << 3, + GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0, + GF_OMP_FOR_KIND_CILKSIMD = GF_OMP_FOR_SIMD | 1, + GF_OMP_FOR_COMBINED = 1 << 4, + GF_OMP_FOR_COMBINED_INTO = 1 << 5, + /* The following flag must not be used on GF_OMP_FOR_KIND_GRID_LOOP loop + statements. */ + GF_OMP_FOR_GRID_PHONY = 1 << 6, + /* The following two flags should only be set on GF_OMP_FOR_KIND_GRID_LOOP + loop statements. */ + GF_OMP_FOR_GRID_INTRA_GROUP = 1 << 6, + GF_OMP_FOR_GRID_GROUP_ITER = 1 << 7, + GF_OMP_TARGET_KIND_MASK = (1 << 4) - 1, + GF_OMP_TARGET_KIND_REGION = 0, + GF_OMP_TARGET_KIND_DATA = 1, + GF_OMP_TARGET_KIND_UPDATE = 2, + GF_OMP_TARGET_KIND_ENTER_DATA = 3, + GF_OMP_TARGET_KIND_EXIT_DATA = 4, + GF_OMP_TARGET_KIND_OACC_PARALLEL = 5, + GF_OMP_TARGET_KIND_OACC_KERNELS = 6, + GF_OMP_TARGET_KIND_OACC_DATA = 7, + GF_OMP_TARGET_KIND_OACC_UPDATE = 8, + GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 9, + GF_OMP_TARGET_KIND_OACC_DECLARE = 10, + GF_OMP_TARGET_KIND_OACC_HOST_DATA = 11, + GF_OMP_TEAMS_GRID_PHONY = 1 << 0, + + /* True on an GIMPLE_OMP_RETURN statement if the return does not require + a thread synchronization via some sort of barrier. The exact barrier + that would otherwise be emitted is dependent on the OMP statement with + which this return is associated. */ + GF_OMP_RETURN_NOWAIT = 1 << 0, + + GF_OMP_SECTION_LAST = 1 << 0, + GF_OMP_ATOMIC_NEED_VALUE = 1 << 0, + GF_OMP_ATOMIC_SEQ_CST = 1 << 1, + GF_PREDICT_TAKEN = 1 << 15 +}; + +/* Currently, there are only two types of gimple debug stmt. Others are + envisioned, for example, to enable the generation of is_stmt notes + in line number information, to mark sequence points, etc. This + subcode is to be used to tell them apart. */ +enum gimple_debug_subcode { + GIMPLE_DEBUG_BIND = 0, + GIMPLE_DEBUG_SOURCE_BIND = 1 +}; + +/* Masks for selecting a pass local flag (PLF) to work on. These + masks are used by gimple_set_plf and gimple_plf. */ +enum plf_mask { + GF_PLF_1 = 1 << 0, + GF_PLF_2 = 1 << 1 +}; + +/* Data structure definitions for GIMPLE tuples. NOTE: word markers + are for 64 bit hosts. */ + +struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"), + chain_next ("%h.next"), variable_size)) + gimple +{ + /* [ WORD 1 ] + Main identifying code for a tuple. */ + ENUM_BITFIELD(gimple_code) code : 8; + + /* Nonzero if a warning should not be emitted on this tuple. */ + unsigned int no_warning : 1; + + /* Nonzero if this tuple has been visited. Passes are responsible + for clearing this bit before using it. */ + unsigned int visited : 1; + + /* Nonzero if this tuple represents a non-temporal move. */ + unsigned int nontemporal_move : 1; + + /* Pass local flags. These flags are free for any pass to use as + they see fit. Passes should not assume that these flags contain + any useful value when the pass starts. Any initial state that + the pass requires should be set on entry to the pass. See + gimple_set_plf and gimple_plf for usage. */ + unsigned int plf : 2; + + /* Nonzero if this statement has been modified and needs to have its + operands rescanned. */ + unsigned modified : 1; + + /* Nonzero if this statement contains volatile operands. */ + unsigned has_volatile_ops : 1; + + /* Padding to get subcode to 16 bit alignment. */ + unsigned pad : 1; + + /* The SUBCODE field can be used for tuple-specific flags for tuples + that do not require subcodes. Note that SUBCODE should be at + least as wide as tree codes, as several tuples store tree codes + in there. */ + unsigned int subcode : 16; + + /* UID of this statement. This is used by passes that want to + assign IDs to statements. It must be assigned and used by each + pass. By default it should be assumed to contain garbage. */ + unsigned uid; + + /* [ WORD 2 ] + Locus information for debug info. */ + location_t location; + + /* Number of operands in this tuple. */ + unsigned num_ops; + + /* [ WORD 3 ] + Basic block holding this statement. */ + basic_block bb; + + /* [ WORD 4-5 ] + Linked lists of gimple statements. The next pointers form + a NULL terminated list, the prev pointers are a cyclic list. + A gimple statement is hence also a double-ended list of + statements, with the pointer itself being the first element, + and the prev pointer being the last. */ + gimple *next; + gimple *GTY((skip)) prev; +}; + + +/* Base structure for tuples with operands. */ + +/* This gimple subclass has no tag value. */ +struct GTY(()) + gimple_statement_with_ops_base : public gimple +{ + /* [ WORD 1-6 ] : base class */ + + /* [ WORD 7 ] + SSA operand vectors. NOTE: It should be possible to + amalgamate these vectors with the operand vector OP. However, + the SSA operand vectors are organized differently and contain + more information (like immediate use chaining). */ + struct use_optype_d GTY((skip (""))) *use_ops; +}; + + +/* Statements that take register operands. */ + +struct GTY((tag("GSS_WITH_OPS"))) + gimple_statement_with_ops : public gimple_statement_with_ops_base +{ + /* [ WORD 1-7 ] : base class */ + + /* [ WORD 8 ] + Operand vector. NOTE! This must always be the last field + of this structure. In particular, this means that this + structure cannot be embedded inside another one. */ + tree GTY((length ("%h.num_ops"))) op[1]; +}; + + +/* Base for statements that take both memory and register operands. */ + +struct GTY((tag("GSS_WITH_MEM_OPS_BASE"))) + gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base +{ + /* [ WORD 1-7 ] : base class */ + + /* [ WORD 8-9 ] + Virtual operands for this statement. The GC will pick them + up via the ssa_names array. */ + tree GTY((skip (""))) vdef; + tree GTY((skip (""))) vuse; +}; + + +/* Statements that take both memory and register operands. */ + +struct GTY((tag("GSS_WITH_MEM_OPS"))) + gimple_statement_with_memory_ops : + public gimple_statement_with_memory_ops_base +{ + /* [ WORD 1-9 ] : base class */ + + /* [ WORD 10 ] + Operand vector. NOTE! This must always be the last field + of this structure. In particular, this means that this + structure cannot be embedded inside another one. */ + tree GTY((length ("%h.num_ops"))) op[1]; +}; + + +/* Call statements that take both memory and register operands. */ + +struct GTY((tag("GSS_CALL"))) + gcall : public gimple_statement_with_memory_ops_base +{ + /* [ WORD 1-9 ] : base class */ + + /* [ WORD 10-13 ] */ + struct pt_solution call_used; + struct pt_solution call_clobbered; + + /* [ WORD 14 ] */ + union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) { + tree GTY ((tag ("0"))) fntype; + enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn; + } u; + + /* [ WORD 15 ] + Operand vector. NOTE! This must always be the last field + of this structure. In particular, this means that this + structure cannot be embedded inside another one. */ + tree GTY((length ("%h.num_ops"))) op[1]; + + static const enum gimple_code code_ = GIMPLE_CALL; +}; + + +/* OMP statements. */ + +struct GTY((tag("GSS_OMP"))) + gimple_statement_omp : public gimple +{ + /* [ WORD 1-6 ] : base class */ + + /* [ WORD 7 ] */ + gimple_seq body; +}; + + +/* GIMPLE_BIND */ + +struct GTY((tag("GSS_BIND"))) + gbind : public gimple +{ + /* [ WORD 1-6 ] : base class */ + + /* [ WORD 7 ] + Variables declared in this scope. */ + tree vars; + + /* [ WORD 8 ] + This is different than the BLOCK field in gimple, + which is analogous to TREE_BLOCK (i.e., the lexical block holding + this statement). This field is the equivalent of BIND_EXPR_BLOCK + in tree land (i.e., the lexical scope defined by this bind). See + gimple-low.c. */ + tree block; + + /* [ WORD 9 ] */ + gimple_seq body; +}; + + +/* GIMPLE_CATCH */ + +struct GTY((tag("GSS_CATCH"))) + gcatch : public gimple +{ + /* [ WORD 1-6 ] : base class */ + + /* [ WORD 7 ] */ + tree types; + + /* [ WORD 8 ] */ + gimple_seq handler; +}; + + +/* GIMPLE_EH_FILTER */ + +struct GTY((tag("GSS_EH_FILTER"))) + geh_filter : public gimple +{ + /* [ WORD 1-6 ] : base class */ + + /* [ WORD 7 ] + Filter types. */ + tree types; + + /* [ WORD 8 ] + Failure actions. */ + gimple_seq failure; +}; + +/* GIMPLE_EH_ELSE */ + +struct GTY((tag("GSS_EH_ELSE"))) + geh_else : public gimple +{ + /* [ WORD 1-6 ] : base class */ + + /* [ WORD 7,8 ] */ + gimple_seq n_body, e_body; +}; + +/* GIMPLE_EH_MUST_NOT_THROW */ + +struct GTY((tag("GSS_EH_MNT"))) + geh_mnt : public gimple +{ + /* [ WORD 1-6 ] : base class */ + + /* [ WORD 7 ] Abort function decl. */ + tree fndecl; +}; + +/* GIMPLE_PHI */ + +struct GTY((tag("GSS_PHI"))) + gphi : public gimple +{ + /* [ WORD 1-6 ] : base class */ + + /* [ WORD 7 ] */ + unsigned capacity; + unsigned nargs; + + /* [ WORD 8 ] */ + tree result; + + /* [ WORD 9 ] */ + struct phi_arg_d GTY ((length ("%h.nargs"))) args[1]; +}; + + +/* GIMPLE_RESX, GIMPLE_EH_DISPATCH */ + +struct GTY((tag("GSS_EH_CTRL"))) + gimple_statement_eh_ctrl : public gimple +{ + /* [ WORD 1-6 ] : base class */ + + /* [ WORD 7 ] + Exception region number. */ + int region; +}; + +struct GTY((tag("GSS_EH_CTRL"))) + gresx : public gimple_statement_eh_ctrl +{ + /* No extra fields; adds invariant: + stmt->code == GIMPLE_RESX. */ +}; + +struct GTY((tag("GSS_EH_CTRL"))) + geh_dispatch : public gimple_statement_eh_ctrl +{ + /* No extra fields; adds invariant: + stmt->code == GIMPLE_EH_DISPATH. */ +}; + + +/* GIMPLE_TRY */ + +struct GTY((tag("GSS_TRY"))) + gtry : public gimple +{ + /* [ WORD 1-6 ] : base class */ + + /* [ WORD 7 ] + Expression to evaluate. */ + gimple_seq eval; + + /* [ WORD 8 ] + Cleanup expression. */ + gimple_seq cleanup; +}; + +/* Kind of GIMPLE_TRY statements. */ +enum gimple_try_flags +{ + /* A try/catch. */ + GIMPLE_TRY_CATCH = 1 << 0, + + /* A try/finally. */ + GIMPLE_TRY_FINALLY = 1 << 1, + GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY, + + /* Analogous to TRY_CATCH_IS_CLEANUP. */ + GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2 +}; + +/* GIMPLE_WITH_CLEANUP_EXPR */ + +struct GTY((tag("GSS_WCE"))) + gimple_statement_wce : public gimple +{ + /* [ WORD 1-6 ] : base class */ + + /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be + executed if an exception is thrown, not on normal exit of its + scope. This flag is analogous to the CLEANUP_EH_ONLY flag + in TARGET_EXPRs. */ + + /* [ WORD 7 ] + Cleanup expression. */ + gimple_seq cleanup; +}; + + +/* GIMPLE_ASM */ + +struct GTY((tag("GSS_ASM"))) + gasm : public gimple_statement_with_memory_ops_base +{ + /* [ WORD 1-9 ] : base class */ + + /* [ WORD 10 ] + __asm__ statement. */ + const char *string; + + /* [ WORD 11 ] + Number of inputs, outputs, clobbers, labels. */ + unsigned char ni; + unsigned char no; + unsigned char nc; + unsigned char nl; + + /* [ WORD 12 ] + Operand vector. NOTE! This must always be the last field + of this structure. In particular, this means that this + structure cannot be embedded inside another one. */ + tree GTY((length ("%h.num_ops"))) op[1]; +}; + +/* GIMPLE_OMP_CRITICAL */ + +struct GTY((tag("GSS_OMP_CRITICAL"))) + gomp_critical : public gimple_statement_omp +{ + /* [ WORD 1-7 ] : base class */ + + /* [ WORD 8 ] */ + tree clauses; + + /* [ WORD 9 ] + Critical section name. */ + tree name; +}; + + +struct GTY(()) gimple_omp_for_iter { + /* Condition code. */ + enum tree_code cond; + + /* Index variable. */ + tree index; + + /* Initial value. */ + tree initial; + + /* Final value. */ + tree final; + + /* Increment. */ + tree incr; +}; + +/* GIMPLE_OMP_FOR */ + +struct GTY((tag("GSS_OMP_FOR"))) + gomp_for : public gimple_statement_omp +{ + /* [ WORD 1-7 ] : base class */ + + /* [ WORD 8 ] */ + tree clauses; + + /* [ WORD 9 ] + Number of elements in iter array. */ + size_t collapse; + + /* [ WORD 10 ] */ + struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter; + + /* [ WORD 11 ] + Pre-body evaluated before the loop body begins. */ + gimple_seq pre_body; +}; + + +/* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK */ + +struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT"))) + gimple_statement_omp_parallel_layout : public gimple_statement_omp +{ + /* [ WORD 1-7 ] : base class */ + + /* [ WORD 8 ] + Clauses. */ + tree clauses; + + /* [ WORD 9 ] + Child function holding the body of the parallel region. */ + tree child_fn; + + /* [ WORD 10 ] + Shared data argument. */ + tree data_arg; +}; + +/* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */ +struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT"))) + gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout +{ + /* No extra fields; adds invariant: + stmt->code == GIMPLE_OMP_PARALLEL + || stmt->code == GIMPLE_OMP_TASK. */ +}; + +/* GIMPLE_OMP_PARALLEL */ +struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT"))) + gomp_parallel : public gimple_statement_omp_taskreg +{ + /* No extra fields; adds invariant: + stmt->code == GIMPLE_OMP_PARALLEL. */ +}; + +/* GIMPLE_OMP_TARGET */ +struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT"))) + gomp_target : public gimple_statement_omp_parallel_layout +{ + /* No extra fields; adds invariant: + stmt->code == GIMPLE_OMP_TARGET. */ +}; + +/* GIMPLE_OMP_TASK */ + +struct GTY((tag("GSS_OMP_TASK"))) + gomp_task : public gimple_statement_omp_taskreg +{ + /* [ WORD 1-10 ] : base class */ + + /* [ WORD 11 ] + Child function holding firstprivate initialization if needed. */ + tree copy_fn; + + /* [ WORD 12-13 ] + Size and alignment in bytes of the argument data block. */ + tree arg_size; + tree arg_align; +}; + + +/* GIMPLE_OMP_SECTION */ +/* Uses struct gimple_statement_omp. */ + + +/* GIMPLE_OMP_SECTIONS */ + +struct GTY((tag("GSS_OMP_SECTIONS"))) + gomp_sections : public gimple_statement_omp +{ + /* [ WORD 1-7 ] : base class */ + + /* [ WORD 8 ] */ + tree clauses; + + /* [ WORD 9 ] + The control variable used for deciding which of the sections to + execute. */ + tree control; +}; + +/* GIMPLE_OMP_CONTINUE. + + Note: This does not inherit from gimple_statement_omp, because we + do not need the body field. */ + +struct GTY((tag("GSS_OMP_CONTINUE"))) + gomp_continue : public gimple +{ + /* [ WORD 1-6 ] : base class */ + + /* [ WORD 7 ] */ + tree control_def; + + /* [ WORD 8 ] */ + tree control_use; +}; + +/* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS, GIMPLE_OMP_ORDERED */ + +struct GTY((tag("GSS_OMP_SINGLE_LAYOUT"))) + gimple_statement_omp_single_layout : public gimple_statement_omp +{ + /* [ WORD 1-7 ] : base class */ + + /* [ WORD 8 ] */ + tree clauses; +}; + +struct GTY((tag("GSS_OMP_SINGLE_LAYOUT"))) + gomp_single : public gimple_statement_omp_single_layout +{ + /* No extra fields; adds invariant: + stmt->code == GIMPLE_OMP_SINGLE. */ +}; + +struct GTY((tag("GSS_OMP_SINGLE_LAYOUT"))) + gomp_teams : public gimple_statement_omp_single_layout +{ + /* No extra fields; adds invariant: + stmt->code == GIMPLE_OMP_TEAMS. */ +}; + +struct GTY((tag("GSS_OMP_SINGLE_LAYOUT"))) + gomp_ordered : public gimple_statement_omp_single_layout +{ + /* No extra fields; adds invariant: + stmt->code == GIMPLE_OMP_ORDERED. */ +}; + + +/* GIMPLE_OMP_ATOMIC_LOAD. + Note: This is based on gimple, not g_s_omp, because g_s_omp + contains a sequence, which we don't need here. */ + +struct GTY((tag("GSS_OMP_ATOMIC_LOAD"))) + gomp_atomic_load : public gimple +{ + /* [ WORD 1-6 ] : base class */ + + /* [ WORD 7-8 ] */ + tree rhs, lhs; +}; + +/* GIMPLE_OMP_ATOMIC_STORE. + See note on GIMPLE_OMP_ATOMIC_LOAD. */ + +struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT"))) + gimple_statement_omp_atomic_store_layout : public gimple +{ + /* [ WORD 1-6 ] : base class */ + + /* [ WORD 7 ] */ + tree val; +}; + +struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT"))) + gomp_atomic_store : + public gimple_statement_omp_atomic_store_layout +{ + /* No extra fields; adds invariant: + stmt->code == GIMPLE_OMP_ATOMIC_STORE. */ +}; + +struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT"))) + gimple_statement_omp_return : + public gimple_statement_omp_atomic_store_layout +{ + /* No extra fields; adds invariant: + stmt->code == GIMPLE_OMP_RETURN. */ +}; + +/* GIMPLE_TRANSACTION. */ + +/* Bits to be stored in the GIMPLE_TRANSACTION subcode. */ + +/* The __transaction_atomic was declared [[outer]] or it is + __transaction_relaxed. */ +#define GTMA_IS_OUTER (1u << 0) +#define GTMA_IS_RELAXED (1u << 1) +#define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED) + +/* The transaction is seen to not have an abort. */ +#define GTMA_HAVE_ABORT (1u << 2) +/* The transaction is seen to have loads or stores. */ +#define GTMA_HAVE_LOAD (1u << 3) +#define GTMA_HAVE_STORE (1u << 4) +/* The transaction MAY enter serial irrevocable mode in its dynamic scope. */ +#define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5) +/* The transaction WILL enter serial irrevocable mode. + An irrevocable block post-dominates the entire transaction, such + that all invocations of the transaction will go serial-irrevocable. + In such case, we don't bother instrumenting the transaction, and + tell the runtime that it should begin the transaction in + serial-irrevocable mode. */ +#define GTMA_DOES_GO_IRREVOCABLE (1u << 6) +/* The transaction contains no instrumentation code whatsover, most + likely because it is guaranteed to go irrevocable upon entry. */ +#define GTMA_HAS_NO_INSTRUMENTATION (1u << 7) + +struct GTY((tag("GSS_TRANSACTION"))) + gtransaction : public gimple_statement_with_memory_ops_base +{ + /* [ WORD 1-9 ] : base class */ + + /* [ WORD 10 ] */ + gimple_seq body; + + /* [ WORD 11-13 ] */ + tree label_norm; + tree label_uninst; + tree label_over; +}; + +#define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM, +enum gimple_statement_structure_enum { +#include "gsstruct.def" + LAST_GSS_ENUM +}; +#undef DEFGSSTRUCT + +/* A statement with the invariant that + stmt->code == GIMPLE_COND + i.e. a conditional jump statement. */ + +struct GTY((tag("GSS_WITH_OPS"))) + gcond : public gimple_statement_with_ops +{ + /* no additional fields; this uses the layout for GSS_WITH_OPS. */ + static const enum gimple_code code_ = GIMPLE_COND; +}; + +/* A statement with the invariant that + stmt->code == GIMPLE_DEBUG + i.e. a debug statement. */ + +struct GTY((tag("GSS_WITH_OPS"))) + gdebug : public gimple_statement_with_ops +{ + /* no additional fields; this uses the layout for GSS_WITH_OPS. */ +}; + +/* A statement with the invariant that + stmt->code == GIMPLE_GOTO + i.e. a goto statement. */ + +struct GTY((tag("GSS_WITH_OPS"))) + ggoto : public gimple_statement_with_ops +{ + /* no additional fields; this uses the layout for GSS_WITH_OPS. */ +}; + +/* A statement with the invariant that + stmt->code == GIMPLE_LABEL + i.e. a label statement. */ + +struct GTY((tag("GSS_WITH_OPS"))) + glabel : public gimple_statement_with_ops +{ + /* no additional fields; this uses the layout for GSS_WITH_OPS. */ +}; + +/* A statement with the invariant that + stmt->code == GIMPLE_SWITCH + i.e. a switch statement. */ + +struct GTY((tag("GSS_WITH_OPS"))) + gswitch : public gimple_statement_with_ops +{ + /* no additional fields; this uses the layout for GSS_WITH_OPS. */ +}; + +/* A statement with the invariant that + stmt->code == GIMPLE_ASSIGN + i.e. an assignment statement. */ + +struct GTY((tag("GSS_WITH_MEM_OPS"))) + gassign : public gimple_statement_with_memory_ops +{ + static const enum gimple_code code_ = GIMPLE_ASSIGN; + /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */ +}; + +/* A statement with the invariant that + stmt->code == GIMPLE_RETURN + i.e. a return statement. */ + +struct GTY((tag("GSS_WITH_MEM_OPS"))) + greturn : public gimple_statement_with_memory_ops +{ + /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */ +}; + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_ASM; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_ASSIGN; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_ASSIGN; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_BIND; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_CALL; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_CATCH; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_COND; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_COND; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_DEBUG; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_GOTO; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_LABEL; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_RESX; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_EH_DISPATCH; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_EH_ELSE; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_EH_FILTER; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_EH_MUST_NOT_THROW; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_OMP_ATOMIC_LOAD; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_OMP_ATOMIC_STORE; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_OMP_RETURN; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_OMP_CONTINUE; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_OMP_CRITICAL; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_OMP_ORDERED; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_OMP_FOR; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_OMP_PARALLEL; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_OMP_TARGET; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_OMP_SECTIONS; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_OMP_SINGLE; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_OMP_TEAMS; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_OMP_TASK; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_PHI; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_RETURN; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_SWITCH; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_TRANSACTION; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_TRY; +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gs->code == GIMPLE_WITH_CLEANUP_EXPR; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_ASM; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_BIND; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_CALL; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_CATCH; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_RESX; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_EH_DISPATCH; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_EH_FILTER; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_OMP_ATOMIC_LOAD; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_OMP_ATOMIC_STORE; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_OMP_RETURN; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_OMP_CONTINUE; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_OMP_CRITICAL; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_OMP_ORDERED; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_OMP_FOR; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_OMP_PARALLEL; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_OMP_TARGET; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_OMP_SECTIONS; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_OMP_SINGLE; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_OMP_TEAMS; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_OMP_TASK; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_PHI; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gs->code == GIMPLE_TRANSACTION; +} + +/* Offset in bytes to the location of the operand vector. + Zero if there is no operand vector for this tuple structure. */ +extern size_t const gimple_ops_offset_[]; + +/* Map GIMPLE codes to GSS codes. */ +extern enum gimple_statement_structure_enum const gss_for_code_[]; + +/* This variable holds the currently expanded gimple statement for purposes + of comminucating the profile info to the builtin expanders. */ +extern gimple *currently_expanding_gimple_stmt; + +#define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO) +gimple *gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL); +greturn *gimple_build_return (tree); +void gimple_call_reset_alias_info (gcall *); +gcall *gimple_build_call_vec (tree, vec ); +gcall *gimple_build_call (tree, unsigned, ...); +gcall *gimple_build_call_valist (tree, unsigned, va_list); +gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...); +gcall *gimple_build_call_internal_vec (enum internal_fn, vec ); +gcall *gimple_build_call_from_tree (tree); +gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO); +gassign *gimple_build_assign (tree, enum tree_code, + tree, tree, tree CXX_MEM_STAT_INFO); +gassign *gimple_build_assign (tree, enum tree_code, + tree, tree CXX_MEM_STAT_INFO); +gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO); +gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree); +gcond *gimple_build_cond_from_tree (tree, tree, tree); +void gimple_cond_set_condition_from_tree (gcond *, tree); +glabel *gimple_build_label (tree label); +ggoto *gimple_build_goto (tree dest); +gimple *gimple_build_nop (void); +gbind *gimple_build_bind (tree, gimple_seq, tree); +gasm *gimple_build_asm_vec (const char *, vec *, + vec *, vec *, + vec *); +gcatch *gimple_build_catch (tree, gimple_seq); +geh_filter *gimple_build_eh_filter (tree, gimple_seq); +geh_mnt *gimple_build_eh_must_not_throw (tree); +geh_else *gimple_build_eh_else (gimple_seq, gimple_seq); +gtry *gimple_build_try (gimple_seq, gimple_seq, + enum gimple_try_flags); +gimple *gimple_build_wce (gimple_seq); +gresx *gimple_build_resx (int); +gswitch *gimple_build_switch_nlabels (unsigned, tree, tree); +gswitch *gimple_build_switch (tree, tree, vec ); +geh_dispatch *gimple_build_eh_dispatch (int); +gdebug *gimple_build_debug_bind_stat (tree, tree, gimple * MEM_STAT_DECL); +#define gimple_build_debug_bind(var,val,stmt) \ + gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO) +gdebug *gimple_build_debug_source_bind_stat (tree, tree, gimple * MEM_STAT_DECL); +#define gimple_build_debug_source_bind(var,val,stmt) \ + gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO) +gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree); +gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq); +gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree); +gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, + tree, tree); +gimple *gimple_build_omp_section (gimple_seq); +gimple *gimple_build_omp_master (gimple_seq); +gimple *gimple_build_omp_grid_body (gimple_seq); +gimple *gimple_build_omp_taskgroup (gimple_seq); +gomp_continue *gimple_build_omp_continue (tree, tree); +gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree); +gimple *gimple_build_omp_return (bool); +gomp_sections *gimple_build_omp_sections (gimple_seq, tree); +gimple *gimple_build_omp_sections_switch (void); +gomp_single *gimple_build_omp_single (gimple_seq, tree); +gomp_target *gimple_build_omp_target (gimple_seq, int, tree); +gomp_teams *gimple_build_omp_teams (gimple_seq, tree); +gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree); +gomp_atomic_store *gimple_build_omp_atomic_store (tree); +gtransaction *gimple_build_transaction (gimple_seq); +extern void gimple_seq_add_stmt (gimple_seq *, gimple *); +extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *); +void gimple_seq_add_seq (gimple_seq *, gimple_seq); +void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq); +extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator, + location_t); +extern void annotate_all_with_location (gimple_seq, location_t); +bool empty_body_p (gimple_seq); +gimple_seq gimple_seq_copy (gimple_seq); +bool gimple_call_same_target_p (const gimple *, const gimple *); +int gimple_call_flags (const gimple *); +int gimple_call_arg_flags (const gcall *, unsigned); +int gimple_call_return_flags (const gcall *); +bool gimple_assign_copy_p (gimple *); +bool gimple_assign_ssa_name_copy_p (gimple *); +bool gimple_assign_unary_nop_p (gimple *); +void gimple_set_bb (gimple *, basic_block); +void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree); +void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code, + tree, tree, tree); +tree gimple_get_lhs (const gimple *); +void gimple_set_lhs (gimple *, tree); +gimple *gimple_copy (gimple *); +bool gimple_has_side_effects (const gimple *); +bool gimple_could_trap_p_1 (gimple *, bool, bool); +bool gimple_could_trap_p (gimple *); +bool gimple_assign_rhs_could_trap_p (gimple *); +extern void dump_gimple_statistics (void); +unsigned get_gimple_rhs_num_ops (enum tree_code); +extern tree canonicalize_cond_expr_cond (tree); +gcall *gimple_call_copy_skip_args (gcall *, bitmap); +extern bool gimple_compare_field_offset (tree, tree); +extern tree gimple_unsigned_type (tree); +extern tree gimple_signed_type (tree); +extern alias_set_type gimple_get_alias_set (tree); +extern bool gimple_ior_addresses_taken (bitmap, gimple *); +extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree); +extern combined_fn gimple_call_combined_fn (const gimple *); +extern bool gimple_call_builtin_p (const gimple *); +extern bool gimple_call_builtin_p (const gimple *, enum built_in_class); +extern bool gimple_call_builtin_p (const gimple *, enum built_in_function); +extern bool gimple_asm_clobbers_memory_p (const gasm *); +extern void dump_decl_set (FILE *, bitmap); +extern bool nonfreeing_call_p (gimple *); +extern bool nonbarrier_call_p (gimple *); +extern bool infer_nonnull_range (gimple *, tree); +extern bool infer_nonnull_range_by_dereference (gimple *, tree); +extern bool infer_nonnull_range_by_attribute (gimple *, tree); +extern void sort_case_labels (vec); +extern void preprocess_case_label_vec_for_gimple (vec, tree, tree *); +extern void gimple_seq_set_location (gimple_seq, location_t); +extern void gimple_seq_discard (gimple_seq); +extern void maybe_remove_unused_call_args (struct function *, gimple *); +extern bool gimple_inexpensive_call_p (gcall *); +extern bool stmt_can_terminate_bb_p (gimple *); + +/* Formal (expression) temporary table handling: multiple occurrences of + the same scalar expression are evaluated into the same temporary. */ + +typedef struct gimple_temp_hash_elt +{ + tree val; /* Key */ + tree temp; /* Value */ +} elt_t; + +/* Get the number of the next statement uid to be allocated. */ +static inline unsigned int +gimple_stmt_max_uid (struct function *fn) +{ + return fn->last_stmt_uid; +} + +/* Set the number of the next statement uid to be allocated. */ +static inline void +set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid) +{ + fn->last_stmt_uid = maxid; +} + +/* Set the number of the next statement uid to be allocated. */ +static inline unsigned int +inc_gimple_stmt_max_uid (struct function *fn) +{ + return fn->last_stmt_uid++; +} + +/* Return the first node in GIMPLE sequence S. */ + +static inline gimple_seq_node +gimple_seq_first (gimple_seq s) +{ + return s; +} + + +/* Return the first statement in GIMPLE sequence S. */ + +static inline gimple * +gimple_seq_first_stmt (gimple_seq s) +{ + gimple_seq_node n = gimple_seq_first (s); + return n; +} + +/* Return the first statement in GIMPLE sequence S as a gbind *, + verifying that it has code GIMPLE_BIND in a checked build. */ + +static inline gbind * +gimple_seq_first_stmt_as_a_bind (gimple_seq s) +{ + gimple_seq_node n = gimple_seq_first (s); + return as_a (n); +} + + +/* Return the last node in GIMPLE sequence S. */ + +static inline gimple_seq_node +gimple_seq_last (gimple_seq s) +{ + return s ? s->prev : NULL; +} + + +/* Return the last statement in GIMPLE sequence S. */ + +static inline gimple * +gimple_seq_last_stmt (gimple_seq s) +{ + gimple_seq_node n = gimple_seq_last (s); + return n; +} + + +/* Set the last node in GIMPLE sequence *PS to LAST. */ + +static inline void +gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last) +{ + (*ps)->prev = last; +} + + +/* Set the first node in GIMPLE sequence *PS to FIRST. */ + +static inline void +gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first) +{ + *ps = first; +} + + +/* Return true if GIMPLE sequence S is empty. */ + +static inline bool +gimple_seq_empty_p (gimple_seq s) +{ + return s == NULL; +} + +/* Allocate a new sequence and initialize its first element with STMT. */ + +static inline gimple_seq +gimple_seq_alloc_with_stmt (gimple *stmt) +{ + gimple_seq seq = NULL; + gimple_seq_add_stmt (&seq, stmt); + return seq; +} + + +/* Returns the sequence of statements in BB. */ + +static inline gimple_seq +bb_seq (const_basic_block bb) +{ + return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL; +} + +static inline gimple_seq * +bb_seq_addr (basic_block bb) +{ + return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL; +} + +/* Sets the sequence of statements in BB to SEQ. */ + +static inline void +set_bb_seq (basic_block bb, gimple_seq seq) +{ + gcc_checking_assert (!(bb->flags & BB_RTL)); + bb->il.gimple.seq = seq; +} + + +/* Return the code for GIMPLE statement G. */ + +static inline enum gimple_code +gimple_code (const gimple *g) +{ + return g->code; +} + + +/* Return the GSS code used by a GIMPLE code. */ + +static inline enum gimple_statement_structure_enum +gss_for_code (enum gimple_code code) +{ + gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE); + return gss_for_code_[code]; +} + + +/* Return which GSS code is used by GS. */ + +static inline enum gimple_statement_structure_enum +gimple_statement_structure (gimple *gs) +{ + return gss_for_code (gimple_code (gs)); +} + + +/* Return true if statement G has sub-statements. This is only true for + High GIMPLE statements. */ + +static inline bool +gimple_has_substatements (gimple *g) +{ + switch (gimple_code (g)) + { + case GIMPLE_BIND: + case GIMPLE_CATCH: + case GIMPLE_EH_FILTER: + case GIMPLE_EH_ELSE: + case GIMPLE_TRY: + case GIMPLE_OMP_FOR: + case GIMPLE_OMP_MASTER: + case GIMPLE_OMP_TASKGROUP: + case GIMPLE_OMP_ORDERED: + case GIMPLE_OMP_SECTION: + case GIMPLE_OMP_PARALLEL: + case GIMPLE_OMP_TASK: + case GIMPLE_OMP_SECTIONS: + case GIMPLE_OMP_SINGLE: + case GIMPLE_OMP_TARGET: + case GIMPLE_OMP_TEAMS: + case GIMPLE_OMP_CRITICAL: + case GIMPLE_WITH_CLEANUP_EXPR: + case GIMPLE_TRANSACTION: + case GIMPLE_OMP_GRID_BODY: + return true; + + default: + return false; + } +} + + +/* Return the basic block holding statement G. */ + +static inline basic_block +gimple_bb (const gimple *g) +{ + return g->bb; +} + + +/* Return the lexical scope block holding statement G. */ + +static inline tree +gimple_block (const gimple *g) +{ + return LOCATION_BLOCK (g->location); +} + + +/* Set BLOCK to be the lexical scope block holding statement G. */ + +static inline void +gimple_set_block (gimple *g, tree block) +{ + g->location = set_block (g->location, block); +} + + +/* Return location information for statement G. */ + +static inline location_t +gimple_location (const gimple *g) +{ + return g->location; +} + +/* Return location information for statement G if g is not NULL. + Otherwise, UNKNOWN_LOCATION is returned. */ + +static inline location_t +gimple_location_safe (const gimple *g) +{ + return g ? gimple_location (g) : UNKNOWN_LOCATION; +} + +/* Set location information for statement G. */ + +static inline void +gimple_set_location (gimple *g, location_t location) +{ + g->location = location; +} + + +/* Return true if G contains location information. */ + +static inline bool +gimple_has_location (const gimple *g) +{ + return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION; +} + + +/* Return the file name of the location of STMT. */ + +static inline const char * +gimple_filename (const gimple *stmt) +{ + return LOCATION_FILE (gimple_location (stmt)); +} + + +/* Return the line number of the location of STMT. */ + +static inline int +gimple_lineno (const gimple *stmt) +{ + return LOCATION_LINE (gimple_location (stmt)); +} + + +/* Determine whether SEQ is a singleton. */ + +static inline bool +gimple_seq_singleton_p (gimple_seq seq) +{ + return ((gimple_seq_first (seq) != NULL) + && (gimple_seq_first (seq) == gimple_seq_last (seq))); +} + +/* Return true if no warnings should be emitted for statement STMT. */ + +static inline bool +gimple_no_warning_p (const gimple *stmt) +{ + return stmt->no_warning; +} + +/* Set the no_warning flag of STMT to NO_WARNING. */ + +static inline void +gimple_set_no_warning (gimple *stmt, bool no_warning) +{ + stmt->no_warning = (unsigned) no_warning; +} + +/* Set the visited status on statement STMT to VISITED_P. + + Please note that this 'visited' property of the gimple statement is + supposed to be undefined at pass boundaries. This means that a + given pass should not assume it contains any useful value when the + pass starts and thus can set it to any value it sees fit. + + You can learn more about the visited property of the gimple + statement by reading the comments of the 'visited' data member of + struct gimple. + */ + +static inline void +gimple_set_visited (gimple *stmt, bool visited_p) +{ + stmt->visited = (unsigned) visited_p; +} + + +/* Return the visited status for statement STMT. + + Please note that this 'visited' property of the gimple statement is + supposed to be undefined at pass boundaries. This means that a + given pass should not assume it contains any useful value when the + pass starts and thus can set it to any value it sees fit. + + You can learn more about the visited property of the gimple + statement by reading the comments of the 'visited' data member of + struct gimple. */ + +static inline bool +gimple_visited_p (gimple *stmt) +{ + return stmt->visited; +} + + +/* Set pass local flag PLF on statement STMT to VAL_P. + + Please note that this PLF property of the gimple statement is + supposed to be undefined at pass boundaries. This means that a + given pass should not assume it contains any useful value when the + pass starts and thus can set it to any value it sees fit. + + You can learn more about the PLF property by reading the comment of + the 'plf' data member of struct gimple_statement_structure. */ + +static inline void +gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p) +{ + if (val_p) + stmt->plf |= (unsigned int) plf; + else + stmt->plf &= ~((unsigned int) plf); +} + + +/* Return the value of pass local flag PLF on statement STMT. + + Please note that this 'plf' property of the gimple statement is + supposed to be undefined at pass boundaries. This means that a + given pass should not assume it contains any useful value when the + pass starts and thus can set it to any value it sees fit. + + You can learn more about the plf property by reading the comment of + the 'plf' data member of struct gimple_statement_structure. */ + +static inline unsigned int +gimple_plf (gimple *stmt, enum plf_mask plf) +{ + return stmt->plf & ((unsigned int) plf); +} + + +/* Set the UID of statement. + + Please note that this UID property is supposed to be undefined at + pass boundaries. This means that a given pass should not assume it + contains any useful value when the pass starts and thus can set it + to any value it sees fit. */ + +static inline void +gimple_set_uid (gimple *g, unsigned uid) +{ + g->uid = uid; +} + + +/* Return the UID of statement. + + Please note that this UID property is supposed to be undefined at + pass boundaries. This means that a given pass should not assume it + contains any useful value when the pass starts and thus can set it + to any value it sees fit. */ + +static inline unsigned +gimple_uid (const gimple *g) +{ + return g->uid; +} + + +/* Make statement G a singleton sequence. */ + +static inline void +gimple_init_singleton (gimple *g) +{ + g->next = NULL; + g->prev = g; +} + + +/* Return true if GIMPLE statement G has register or memory operands. */ + +static inline bool +gimple_has_ops (const gimple *g) +{ + return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gimple_has_ops (gs); +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gimple_has_ops (gs); +} + +/* Return true if GIMPLE statement G has memory operands. */ + +static inline bool +gimple_has_mem_ops (const gimple *g) +{ + return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN; +} + +template <> +template <> +inline bool +is_a_helper ::test (const gimple *gs) +{ + return gimple_has_mem_ops (gs); +} + +template <> +template <> +inline bool +is_a_helper ::test (gimple *gs) +{ + return gimple_has_mem_ops (gs); +} + +/* Return the set of USE operands for statement G. */ + +static inline struct use_optype_d * +gimple_use_ops (const gimple *g) +{ + const gimple_statement_with_ops *ops_stmt = + dyn_cast (g); + if (!ops_stmt) + return NULL; + return ops_stmt->use_ops; +} + + +/* Set USE to be the set of USE operands for statement G. */ + +static inline void +gimple_set_use_ops (gimple *g, struct use_optype_d *use) +{ + gimple_statement_with_ops *ops_stmt = + as_a (g); + ops_stmt->use_ops = use; +} + + +/* Return the single VUSE operand of the statement G. */ + +static inline tree +gimple_vuse (const gimple *g) +{ + const gimple_statement_with_memory_ops *mem_ops_stmt = + dyn_cast (g); + if (!mem_ops_stmt) + return NULL_TREE; + return mem_ops_stmt->vuse; +} + +/* Return the single VDEF operand of the statement G. */ + +static inline tree +gimple_vdef (const gimple *g) +{ + const gimple_statement_with_memory_ops *mem_ops_stmt = + dyn_cast (g); + if (!mem_ops_stmt) + return NULL_TREE; + return mem_ops_stmt->vdef; +} + +/* Return the single VUSE operand of the statement G. */ + +static inline tree * +gimple_vuse_ptr (gimple *g) +{ + gimple_statement_with_memory_ops *mem_ops_stmt = + dyn_cast (g); + if (!mem_ops_stmt) + return NULL; + return &mem_ops_stmt->vuse; +} + +/* Return the single VDEF operand of the statement G. */ + +static inline tree * +gimple_vdef_ptr (gimple *g) +{ + gimple_statement_with_memory_ops *mem_ops_stmt = + dyn_cast (g); + if (!mem_ops_stmt) + return NULL; + return &mem_ops_stmt->vdef; +} + +/* Set the single VUSE operand of the statement G. */ + +static inline void +gimple_set_vuse (gimple *g, tree vuse) +{ + gimple_statement_with_memory_ops *mem_ops_stmt = + as_a (g); + mem_ops_stmt->vuse = vuse; +} + +/* Set the single VDEF operand of the statement G. */ + +static inline void +gimple_set_vdef (gimple *g, tree vdef) +{ + gimple_statement_with_memory_ops *mem_ops_stmt = + as_a (g); + mem_ops_stmt->vdef = vdef; +} + + +/* Return true if statement G has operands and the modified field has + been set. */ + +static inline bool +gimple_modified_p (const gimple *g) +{ + return (gimple_has_ops (g)) ? (bool) g->modified : false; +} + + +/* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has + a MODIFIED field. */ + +static inline void +gimple_set_modified (gimple *s, bool modifiedp) +{ + if (gimple_has_ops (s)) + s->modified = (unsigned) modifiedp; +} + + +/* Return the tree code for the expression computed by STMT. This is + only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For + GIMPLE_CALL, return CALL_EXPR as the expression code for + consistency. This is useful when the caller needs to deal with the + three kinds of computation that GIMPLE supports. */ + +static inline enum tree_code +gimple_expr_code (const gimple *stmt) +{ + enum gimple_code code = gimple_code (stmt); + if (code == GIMPLE_ASSIGN || code == GIMPLE_COND) + return (enum tree_code) stmt->subcode; + else + { + gcc_gimple_checking_assert (code == GIMPLE_CALL); + return CALL_EXPR; + } +} + + +/* Return true if statement STMT contains volatile operands. */ + +static inline bool +gimple_has_volatile_ops (const gimple *stmt) +{ + if (gimple_has_mem_ops (stmt)) + return stmt->has_volatile_ops; + else + return false; +} + + +/* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */ + +static inline void +gimple_set_has_volatile_ops (gimple *stmt, bool volatilep) +{ + if (gimple_has_mem_ops (stmt)) + stmt->has_volatile_ops = (unsigned) volatilep; +} + +/* Return true if STMT is in a transaction. */ + +static inline bool +gimple_in_transaction (const gimple *stmt) +{ + return bb_in_transaction (gimple_bb (stmt)); +} + +/* Return true if statement STMT may access memory. */ + +static inline bool +gimple_references_memory_p (gimple *stmt) +{ + return gimple_has_mem_ops (stmt) && gimple_vuse (stmt); +} + + +/* Return the subcode for OMP statement S. */ + +static inline unsigned +gimple_omp_subcode (const gimple *s) +{ + gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD + && gimple_code (s) <= GIMPLE_OMP_TEAMS); + return s->subcode; +} + +/* Set the subcode for OMP statement S to SUBCODE. */ + +static inline void +gimple_omp_set_subcode (gimple *s, unsigned int subcode) +{ + /* We only have 16 bits for the subcode. Assert that we are not + overflowing it. */ + gcc_gimple_checking_assert (subcode < (1 << 16)); + s->subcode = subcode; +} + +/* Set the nowait flag on OMP_RETURN statement S. */ + +static inline void +gimple_omp_return_set_nowait (gimple *s) +{ + GIMPLE_CHECK (s, GIMPLE_OMP_RETURN); + s->subcode |= GF_OMP_RETURN_NOWAIT; +} + + +/* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT + flag set. */ + +static inline bool +gimple_omp_return_nowait_p (const gimple *g) +{ + GIMPLE_CHECK (g, GIMPLE_OMP_RETURN); + return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0; +} + + +/* Set the LHS of OMP return. */ + +static inline void +gimple_omp_return_set_lhs (gimple *g, tree lhs) +{ + gimple_statement_omp_return *omp_return_stmt = + as_a (g); + omp_return_stmt->val = lhs; +} + + +/* Get the LHS of OMP return. */ + +static inline tree +gimple_omp_return_lhs (const gimple *g) +{ + const gimple_statement_omp_return *omp_return_stmt = + as_a (g); + return omp_return_stmt->val; +} + + +/* Return a pointer to the LHS of OMP return. */ + +static inline tree * +gimple_omp_return_lhs_ptr (gimple *g) +{ + gimple_statement_omp_return *omp_return_stmt = + as_a (g); + return &omp_return_stmt->val; +} + + +/* Return true if OMP section statement G has the GF_OMP_SECTION_LAST + flag set. */ + +static inline bool +gimple_omp_section_last_p (const gimple *g) +{ + GIMPLE_CHECK (g, GIMPLE_OMP_SECTION); + return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0; +} + + +/* Set the GF_OMP_SECTION_LAST flag on G. */ + +static inline void +gimple_omp_section_set_last (gimple *g) +{ + GIMPLE_CHECK (g, GIMPLE_OMP_SECTION); + g->subcode |= GF_OMP_SECTION_LAST; +} + + +/* Return true if OMP parallel statement G has the + GF_OMP_PARALLEL_COMBINED flag set. */ + +static inline bool +gimple_omp_parallel_combined_p (const gimple *g) +{ + GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL); + return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0; +} + + +/* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean + value of COMBINED_P. */ + +static inline void +gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p) +{ + GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL); + if (combined_p) + g->subcode |= GF_OMP_PARALLEL_COMBINED; + else + g->subcode &= ~GF_OMP_PARALLEL_COMBINED; +} + + +/* Return true if OMP atomic load/store statement G has the + GF_OMP_ATOMIC_NEED_VALUE flag set. */ + +static inline bool +gimple_omp_atomic_need_value_p (const gimple *g) +{ + if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD) + GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); + return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0; +} + + +/* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */ + +static inline void +gimple_omp_atomic_set_need_value (gimple *g) +{ + if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD) + GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); + g->subcode |= GF_OMP_ATOMIC_NEED_VALUE; +} + + +/* Return true if OMP atomic load/store statement G has the + GF_OMP_ATOMIC_SEQ_CST flag set. */ + +static inline bool +gimple_omp_atomic_seq_cst_p (const gimple *g) +{ + if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD) + GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); + return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0; +} + + +/* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */ + +static inline void +gimple_omp_atomic_set_seq_cst (gimple *g) +{ + if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD) + GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); + g->subcode |= GF_OMP_ATOMIC_SEQ_CST; +} + + +/* Return the number of operands for statement GS. */ + +static inline unsigned +gimple_num_ops (const gimple *gs) +{ + return gs->num_ops; +} + + +/* Set the number of operands for statement GS. */ + +static inline void +gimple_set_num_ops (gimple *gs, unsigned num_ops) +{ + gs->num_ops = num_ops; +} + + +/* Return the array of operands for statement GS. */ + +static inline tree * +gimple_ops (gimple *gs) +{ + size_t off; + + /* All the tuples have their operand vector at the very bottom + of the structure. Note that those structures that do not + have an operand vector have a zero offset. */ + off = gimple_ops_offset_[gimple_statement_structure (gs)]; + gcc_gimple_checking_assert (off != 0); + + return (tree *) ((char *) gs + off); +} + + +/* Return operand I for statement GS. */ + +static inline tree +gimple_op (const gimple *gs, unsigned i) +{ + if (gimple_has_ops (gs)) + { + gcc_gimple_checking_assert (i < gimple_num_ops (gs)); + return gimple_ops (CONST_CAST_GIMPLE (gs))[i]; + } + else + return NULL_TREE; +} + +/* Return a pointer to operand I for statement GS. */ + +static inline tree * +gimple_op_ptr (gimple *gs, unsigned i) +{ + if (gimple_has_ops (gs)) + { + gcc_gimple_checking_assert (i < gimple_num_ops (gs)); + return gimple_ops (gs) + i; + } + else + return NULL; +} + +/* Set operand I of statement GS to OP. */ + +static inline void +gimple_set_op (gimple *gs, unsigned i, tree op) +{ + gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs)); + + /* Note. It may be tempting to assert that OP matches + is_gimple_operand, but that would be wrong. Different tuples + accept slightly different sets of tree operands. Each caller + should perform its own validation. */ + gimple_ops (gs)[i] = op; +} + +/* Return true if GS is a GIMPLE_ASSIGN. */ + +static inline bool +is_gimple_assign (const gimple *gs) +{ + return gimple_code (gs) == GIMPLE_ASSIGN; +} + +/* Determine if expression CODE is one of the valid expressions that can + be used on the RHS of GIMPLE assignments. */ + +static inline enum gimple_rhs_class +get_gimple_rhs_class (enum tree_code code) +{ + return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code]; +} + +/* Return the LHS of assignment statement GS. */ + +static inline tree +gimple_assign_lhs (const gassign *gs) +{ + return gs->op[0]; +} + +static inline tree +gimple_assign_lhs (const gimple *gs) +{ + const gassign *ass = GIMPLE_CHECK2 (gs); + return gimple_assign_lhs (ass); +} + + +/* Return a pointer to the LHS of assignment statement GS. */ + +static inline tree * +gimple_assign_lhs_ptr (gassign *gs) +{ + return &gs->op[0]; +} + +static inline tree * +gimple_assign_lhs_ptr (gimple *gs) +{ + gassign *ass = GIMPLE_CHECK2 (gs); + return gimple_assign_lhs_ptr (ass); +} + + +/* Set LHS to be the LHS operand of assignment statement GS. */ + +static inline void +gimple_assign_set_lhs (gassign *gs, tree lhs) +{ + gs->op[0] = lhs; + + if (lhs && TREE_CODE (lhs) == SSA_NAME) + SSA_NAME_DEF_STMT (lhs) = gs; +} + +static inline void +gimple_assign_set_lhs (gimple *gs, tree lhs) +{ + gassign *ass = GIMPLE_CHECK2 (gs); + gimple_assign_set_lhs (ass, lhs); +} + + +/* Return the first operand on the RHS of assignment statement GS. */ + +static inline tree +gimple_assign_rhs1 (const gassign *gs) +{ + return gs->op[1]; +} + +static inline tree +gimple_assign_rhs1 (const gimple *gs) +{ + const gassign *ass = GIMPLE_CHECK2 (gs); + return gimple_assign_rhs1 (ass); +} + + +/* Return a pointer to the first operand on the RHS of assignment + statement GS. */ + +static inline tree * +gimple_assign_rhs1_ptr (gassign *gs) +{ + return &gs->op[1]; +} + +static inline tree * +gimple_assign_rhs1_ptr (gimple *gs) +{ + gassign *ass = GIMPLE_CHECK2 (gs); + return gimple_assign_rhs1_ptr (ass); +} + +/* Set RHS to be the first operand on the RHS of assignment statement GS. */ + +static inline void +gimple_assign_set_rhs1 (gassign *gs, tree rhs) +{ + gs->op[1] = rhs; +} + +static inline void +gimple_assign_set_rhs1 (gimple *gs, tree rhs) +{ + gassign *ass = GIMPLE_CHECK2 (gs); + gimple_assign_set_rhs1 (ass, rhs); +} + + +/* Return the second operand on the RHS of assignment statement GS. + If GS does not have two operands, NULL is returned instead. */ + +static inline tree +gimple_assign_rhs2 (const gassign *gs) +{ + if (gimple_num_ops (gs) >= 3) + return gs->op[2]; + else + return NULL_TREE; +} + +static inline tree +gimple_assign_rhs2 (const gimple *gs) +{ + const gassign *ass = GIMPLE_CHECK2 (gs); + return gimple_assign_rhs2 (ass); +} + + +/* Return a pointer to the second operand on the RHS of assignment + statement GS. */ + +static inline tree * +gimple_assign_rhs2_ptr (gassign *gs) +{ + gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3); + return &gs->op[2]; +} + +static inline tree * +gimple_assign_rhs2_ptr (gimple *gs) +{ + gassign *ass = GIMPLE_CHECK2 (gs); + return gimple_assign_rhs2_ptr (ass); +} + + +/* Set RHS to be the second operand on the RHS of assignment statement GS. */ + +static inline void +gimple_assign_set_rhs2 (gassign *gs, tree rhs) +{ + gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3); + gs->op[2] = rhs; +} + +static inline void +gimple_assign_set_rhs2 (gimple *gs, tree rhs) +{ + gassign *ass = GIMPLE_CHECK2 (gs); + return gimple_assign_set_rhs2 (ass, rhs); +} + +/* Return the third operand on the RHS of assignment statement GS. + If GS does not have two operands, NULL is returned instead. */ + +static inline tree +gimple_assign_rhs3 (const gassign *gs) +{ + if (gimple_num_ops (gs) >= 4) + return gs->op[3]; + else + return NULL_TREE; +} + +static inline tree +gimple_assign_rhs3 (const gimple *gs) +{ + const gassign *ass = GIMPLE_CHECK2 (gs); + return gimple_assign_rhs3 (ass); +} + +/* Return a pointer to the third operand on the RHS of assignment + statement GS. */ + +static inline tree * +gimple_assign_rhs3_ptr (gimple *gs) +{ + gassign *ass = GIMPLE_CHECK2 (gs); + gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4); + return &ass->op[3]; +} + + +/* Set RHS to be the third operand on the RHS of assignment statement GS. */ + +static inline void +gimple_assign_set_rhs3 (gassign *gs, tree rhs) +{ + gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4); + gs->op[3] = rhs; +} + +static inline void +gimple_assign_set_rhs3 (gimple *gs, tree rhs) +{ + gassign *ass = GIMPLE_CHECK2 (gs); + gimple_assign_set_rhs3 (ass, rhs); +} + + +/* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers + which expect to see only two operands. */ + +static inline void +gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code, + tree op1, tree op2) +{ + gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL); +} + +/* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers + which expect to see only one operands. */ + +static inline void +gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code, + tree op1) +{ + gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL); +} + +/* Returns true if GS is a nontemporal move. */ + +static inline bool +gimple_assign_nontemporal_move_p (const gassign *gs) +{ + return gs->nontemporal_move; +} + +/* Sets nontemporal move flag of GS to NONTEMPORAL. */ + +static inline void +gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal) +{ + GIMPLE_CHECK (gs, GIMPLE_ASSIGN); + gs->nontemporal_move = nontemporal; +} + + +/* Return the code of the expression computed on the rhs of assignment + statement GS. In case that the RHS is a single object, returns the + tree code of the object. */ + +static inline enum tree_code +gimple_assign_rhs_code (const gassign *gs) +{ + enum tree_code code = (enum tree_code) gs->subcode; + /* While we initially set subcode to the TREE_CODE of the rhs for + GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay + in sync when we rewrite stmts into SSA form or do SSA propagations. */ + if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS) + code = TREE_CODE (gs->op[1]); + + return code; +} + +static inline enum tree_code +gimple_assign_rhs_code (const gimple *gs) +{ + const gassign *ass = GIMPLE_CHECK2 (gs); + return gimple_assign_rhs_code (ass); +} + + +/* Set CODE to be the code for the expression computed on the RHS of + assignment S. */ + +static inline void +gimple_assign_set_rhs_code (gimple *s, enum tree_code code) +{ + GIMPLE_CHECK (s, GIMPLE_ASSIGN); + s->subcode = code; +} + + +/* Return the gimple rhs class of the code of the expression computed on + the rhs of assignment statement GS. + This will never return GIMPLE_INVALID_RHS. */ + +static inline enum gimple_rhs_class +gimple_assign_rhs_class (const gimple *gs) +{ + return get_gimple_rhs_class (gimple_assign_rhs_code (gs)); +} + +/* Return true if GS is an assignment with a singleton RHS, i.e., + there is no operator associated with the assignment itself. + Unlike gimple_assign_copy_p, this predicate returns true for + any RHS operand, including those that perform an operation + and do not have the semantics of a copy, such as COND_EXPR. */ + +static inline bool +gimple_assign_single_p (const gimple *gs) +{ + return (is_gimple_assign (gs) + && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS); +} + +/* Return true if GS performs a store to its lhs. */ + +static inline bool +gimple_store_p (const gimple *gs) +{ + tree lhs = gimple_get_lhs (gs); + return lhs && !is_gimple_reg (lhs); +} + +/* Return true if GS is an assignment that loads from its rhs1. */ + +static inline bool +gimple_assign_load_p (const gimple *gs) +{ + tree rhs; + if (!gimple_assign_single_p (gs)) + return false; + rhs = gimple_assign_rhs1 (gs); + if (TREE_CODE (rhs) == WITH_SIZE_EXPR) + return true; + rhs = get_base_address (rhs); + return (DECL_P (rhs) + || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF); +} + + +/* Return true if S is a type-cast assignment. */ + +static inline bool +gimple_assign_cast_p (const gimple *s) +{ + if (is_gimple_assign (s)) + { + enum tree_code sc = gimple_assign_rhs_code (s); + return CONVERT_EXPR_CODE_P (sc) + || sc == VIEW_CONVERT_EXPR + || sc == FIX_TRUNC_EXPR; + } + + return false; +} + +/* Return true if S is a clobber statement. */ + +static inline bool +gimple_clobber_p (const gimple *s) +{ + return gimple_assign_single_p (s) + && TREE_CLOBBER_P (gimple_assign_rhs1 (s)); +} + +/* Return true if GS is a GIMPLE_CALL. */ + +static inline bool +is_gimple_call (const gimple *gs) +{ + return gimple_code (gs) == GIMPLE_CALL; +} + +/* Return the LHS of call statement GS. */ + +static inline tree +gimple_call_lhs (const gcall *gs) +{ + return gs->op[0]; +} + +static inline tree +gimple_call_lhs (const gimple *gs) +{ + const gcall *gc = GIMPLE_CHECK2 (gs); + return gimple_call_lhs (gc); +} + + +/* Return a pointer to the LHS of call statement GS. */ + +static inline tree * +gimple_call_lhs_ptr (gcall *gs) +{ + return &gs->op[0]; +} + +static inline tree * +gimple_call_lhs_ptr (gimple *gs) +{ + gcall *gc = GIMPLE_CHECK2 (gs); + return gimple_call_lhs_ptr (gc); +} + + +/* Set LHS to be the LHS operand of call statement GS. */ + +static inline void +gimple_call_set_lhs (gcall *gs, tree lhs) +{ + gs->op[0] = lhs; + if (lhs && TREE_CODE (lhs) == SSA_NAME) + SSA_NAME_DEF_STMT (lhs) = gs; +} + +static inline void +gimple_call_set_lhs (gimple *gs, tree lhs) +{ + gcall *gc = GIMPLE_CHECK2 (gs); + gimple_call_set_lhs (gc, lhs); +} + + +/* Return true if call GS calls an internal-only function, as enumerated + by internal_fn. */ + +static inline bool +gimple_call_internal_p (const gcall *gs) +{ + return (gs->subcode & GF_CALL_INTERNAL) != 0; +} + +static inline bool +gimple_call_internal_p (const gimple *gs) +{ + const gcall *gc = GIMPLE_CHECK2 (gs); + return gimple_call_internal_p (gc); +} + + +/* Return true if call GS is marked as instrumented by + Pointer Bounds Checker. */ + +static inline bool +gimple_call_with_bounds_p (const gcall *gs) +{ + return (gs->subcode & GF_CALL_WITH_BOUNDS) != 0; +} + +static inline bool +gimple_call_with_bounds_p (const gimple *gs) +{ + const gcall *gc = GIMPLE_CHECK2 (gs); + return gimple_call_with_bounds_p (gc); +} + + +/* If INSTRUMENTED_P is true, marm statement GS as instrumented by + Pointer Bounds Checker. */ + +static inline void +gimple_call_set_with_bounds (gcall *gs, bool with_bounds) +{ + if (with_bounds) + gs->subcode |= GF_CALL_WITH_BOUNDS; + else + gs->subcode &= ~GF_CALL_WITH_BOUNDS; +} + +static inline void +gimple_call_set_with_bounds (gimple *gs, bool with_bounds) +{ + gcall *gc = GIMPLE_CHECK2 (gs); + gimple_call_set_with_bounds (gc, with_bounds); +} + + +/* Return the target of internal call GS. */ + +static inline enum internal_fn +gimple_call_internal_fn (const gcall *gs) +{ + gcc_gimple_checking_assert (gimple_call_internal_p (gs)); + return gs->u.internal_fn; +} + +static inline enum internal_fn +gimple_call_internal_fn (const gimple *gs) +{ + const gcall *gc = GIMPLE_CHECK2 (gs); + return gimple_call_internal_fn (gc); +} + +/* Return true, if this internal gimple call is unique. */ + +static inline bool +gimple_call_internal_unique_p (const gcall *gs) +{ + return gimple_call_internal_fn (gs) == IFN_UNIQUE; +} + +static inline bool +gimple_call_internal_unique_p (const gimple *gs) +{ + const gcall *gc = GIMPLE_CHECK2 (gs); + return gimple_call_internal_unique_p (gc); +} + +/* Return true if GS is an internal function FN. */ + +static inline bool +gimple_call_internal_p (const gimple *gs, internal_fn fn) +{ + return (is_gimple_call (gs) + && gimple_call_internal_p (gs) + && gimple_call_internal_fn (gs) == fn); +} + +/* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt + that could alter control flow. */ + +static inline void +gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p) +{ + if (ctrl_altering_p) + s->subcode |= GF_CALL_CTRL_ALTERING; + else + s->subcode &= ~GF_CALL_CTRL_ALTERING; +} + +static inline void +gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p) +{ + gcall *gc = GIMPLE_CHECK2 (s); + gimple_call_set_ctrl_altering (gc, ctrl_altering_p); +} + +/* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING + flag is set. Such call could not be a stmt in the middle of a bb. */ + +static inline bool +gimple_call_ctrl_altering_p (const gcall *gs) +{ + return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0; +} + +static inline bool +gimple_call_ctrl_altering_p (const gimple *gs) +{ + const gcall *gc = GIMPLE_CHECK2 (gs); + return gimple_call_ctrl_altering_p (gc); +} + + +/* Return the function type of the function called by GS. */ + +static inline tree +gimple_call_fntype (const gcall *gs) +{ + if (gimple_call_internal_p (gs)) + return NULL_TREE; + return gs->u.fntype; +} + +static inline tree +gimple_call_fntype (const gimple *gs) +{ + const gcall *call_stmt = GIMPLE_CHECK2 (gs); + return gimple_call_fntype (call_stmt); +} + +/* Set the type of the function called by CALL_STMT to FNTYPE. */ + +static inline void +gimple_call_set_fntype (gcall *call_stmt, tree fntype) +{ + gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt)); + call_stmt->u.fntype = fntype; +} + + +/* Return the tree node representing the function called by call + statement GS. */ + +static inline tree +gimple_call_fn (const gcall *gs) +{ + return gs->op[1]; +} + +static inline tree +gimple_call_fn (const gimple *gs) +{ + const gcall *gc = GIMPLE_CHECK2 (gs); + return gimple_call_fn (gc); +} + +/* Return a pointer to the tree node representing the function called by call + statement GS. */ + +static inline tree * +gimple_call_fn_ptr (gcall *gs) +{ + return &gs->op[1]; +} + +static inline tree * +gimple_call_fn_ptr (gimple *gs) +{ + gcall *gc = GIMPLE_CHECK2 (gs); + return gimple_call_fn_ptr (gc); +} + + +/* Set FN to be the function called by call statement GS. */ + +static inline void +gimple_call_set_fn (gcall *gs, tree fn) +{ + gcc_gimple_checking_assert (!gimple_call_internal_p (gs)); + gs->op[1] = fn; +} + + +/* Set FNDECL to be the function called by call statement GS. */ + +static inline void +gimple_call_set_fndecl (gcall *gs, tree decl) +{ + gcc_gimple_checking_assert (!gimple_call_internal_p (gs)); + gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR, + build_pointer_type (TREE_TYPE (decl)), decl); +} + +static inline void +gimple_call_set_fndecl (gimple *gs, tree decl) +{ + gcall *gc = GIMPLE_CHECK2 (gs); + gimple_call_set_fndecl (gc, decl); +} + + +/* Set internal function FN to be the function called by call statement CALL_STMT. */ + +static inline void +gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn) +{ + gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt)); + call_stmt->u.internal_fn = fn; +} + + +/* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it. + Otherwise return NULL. This function is analogous to + get_callee_fndecl in tree land. */ + +static inline tree +gimple_call_fndecl (const gcall *gs) +{ + return gimple_call_addr_fndecl (gimple_call_fn (gs)); +} + +static inline tree +gimple_call_fndecl (const gimple *gs) +{ + const gcall *gc = GIMPLE_CHECK2 (gs); + return gimple_call_fndecl (gc); +} + + +/* Return the type returned by call statement GS. */ + +static inline tree +gimple_call_return_type (const gcall *gs) +{ + tree type = gimple_call_fntype (gs); + + if (type == NULL_TREE) + return TREE_TYPE (gimple_call_lhs (gs)); + + /* The type returned by a function is the type of its + function type. */ + return TREE_TYPE (type); +} + + +/* Return the static chain for call statement GS. */ + +static inline tree +gimple_call_chain (const gcall *gs) +{ + return gs->op[2]; +} + +static inline tree +gimple_call_chain (const gimple *gs) +{ + const gcall *gc = GIMPLE_CHECK2 (gs); + return gimple_call_chain (gc); +} + + +/* Return a pointer to the static chain for call statement CALL_STMT. */ + +static inline tree * +gimple_call_chain_ptr (gcall *call_stmt) +{ + return &call_stmt->op[2]; +} + +/* Set CHAIN to be the static chain for call statement CALL_STMT. */ + +static inline void +gimple_call_set_chain (gcall *call_stmt, tree chain) +{ + call_stmt->op[2] = chain; +} + + +/* Return the number of arguments used by call statement GS. */ + +static inline unsigned +gimple_call_num_args (const gcall *gs) +{ + return gimple_num_ops (gs) - 3; +} + +static inline unsigned +gimple_call_num_args (const gimple *gs) +{ + const gcall *gc = GIMPLE_CHECK2 (gs); + return gimple_call_num_args (gc); +} + + +/* Return the argument at position INDEX for call statement GS. */ + +static inline tree +gimple_call_arg (const gcall *gs, unsigned index) +{ + gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3); + return gs->op[index + 3]; +} + +static inline tree +gimple_call_arg (const gimple *gs, unsigned index) +{ + const gcall *gc = GIMPLE_CHECK2 (gs); + return gimple_call_arg (gc, index); +} + + +/* Return a pointer to the argument at position INDEX for call + statement GS. */ + +static inline tree * +gimple_call_arg_ptr (gcall *gs, unsigned index) +{ + gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3); + return &gs->op[index + 3]; +} + +static inline tree * +gimple_call_arg_ptr (gimple *gs, unsigned index) +{ + gcall *gc = GIMPLE_CHECK2 (gs); + return gimple_call_arg_ptr (gc, index); +} + + +/* Set ARG to be the argument at position INDEX for call statement GS. */ + +static inline void +gimple_call_set_arg (gcall *gs, unsigned index, tree arg) +{ + gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3); + gs->op[index + 3] = arg; +} + +static inline void +gimple_call_set_arg (gimple *gs, unsigned index, tree arg) +{ + gcall *gc = GIMPLE_CHECK2 (gs); + gimple_call_set_arg (gc, index, arg); +} + + +/* If TAIL_P is true, mark call statement S as being a tail call + (i.e., a call just before the exit of a function). These calls are + candidate for tail call optimization. */ + +static inline void +gimple_call_set_tail (gcall *s, bool tail_p) +{ + if (tail_p) + s->subcode |= GF_CALL_TAILCALL; + else + s->subcode &= ~GF_CALL_TAILCALL; +} + + +/* Return true if GIMPLE_CALL S is marked as a tail call. */ + +static inline bool +gimple_call_tail_p (gcall *s) +{ + return (s->subcode & GF_CALL_TAILCALL) != 0; +} + +/* Mark (or clear) call statement S as requiring tail call optimization. */ + +static inline void +gimple_call_set_must_tail (gcall *s, bool must_tail_p) +{ + if (must_tail_p) + s->subcode |= GF_CALL_MUST_TAIL_CALL; + else + s->subcode &= ~GF_CALL_MUST_TAIL_CALL; +} + +/* Return true if call statement has been marked as requiring + tail call optimization. */ + +static inline bool +gimple_call_must_tail_p (const gcall *s) +{ + return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0; +} + +/* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return + slot optimization. This transformation uses the target of the call + expansion as the return slot for calls that return in memory. */ + +static inline void +gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p) +{ + if (return_slot_opt_p) + s->subcode |= GF_CALL_RETURN_SLOT_OPT; + else + s->subcode &= ~GF_CALL_RETURN_SLOT_OPT; +} + + +/* Return true if S is marked for return slot optimization. */ + +static inline bool +gimple_call_return_slot_opt_p (gcall *s) +{ + return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0; +} + + +/* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a + thunk to the thunked-to function. */ + +static inline void +gimple_call_set_from_thunk (gcall *s, bool from_thunk_p) +{ + if (from_thunk_p) + s->subcode |= GF_CALL_FROM_THUNK; + else + s->subcode &= ~GF_CALL_FROM_THUNK; +} + + +/* Return true if GIMPLE_CALL S is a jump from a thunk. */ + +static inline bool +gimple_call_from_thunk_p (gcall *s) +{ + return (s->subcode & GF_CALL_FROM_THUNK) != 0; +} + + +/* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the + argument pack in its argument list. */ + +static inline void +gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p) +{ + if (pass_arg_pack_p) + s->subcode |= GF_CALL_VA_ARG_PACK; + else + s->subcode &= ~GF_CALL_VA_ARG_PACK; +} + + +/* Return true if GIMPLE_CALL S is a stdarg call that needs the + argument pack in its argument list. */ + +static inline bool +gimple_call_va_arg_pack_p (gcall *s) +{ + return (s->subcode & GF_CALL_VA_ARG_PACK) != 0; +} + + +/* Return true if S is a noreturn call. */ + +static inline bool +gimple_call_noreturn_p (const gcall *s) +{ + return (gimple_call_flags (s) & ECF_NORETURN) != 0; +} + +static inline bool +gimple_call_noreturn_p (const gimple *s) +{ + const gcall *gc = GIMPLE_CHECK2 (s); + return gimple_call_noreturn_p (gc); +} + + +/* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw + even if the called function can throw in other cases. */ + +static inline void +gimple_call_set_nothrow (gcall *s, bool nothrow_p) +{ + if (nothrow_p) + s->subcode |= GF_CALL_NOTHROW; + else + s->subcode &= ~GF_CALL_NOTHROW; +} + +/* Return true if S is a nothrow call. */ + +static inline bool +gimple_call_nothrow_p (gcall *s) +{ + return (gimple_call_flags (s) & ECF_NOTHROW) != 0; +} + +/* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that + is known to be emitted for VLA objects. Those are wrapped by + stack_save/stack_restore calls and hence can't lead to unbounded + stack growth even when they occur in loops. */ + +static inline void +gimple_call_set_alloca_for_var (gcall *s, bool for_var) +{ + if (for_var) + s->subcode |= GF_CALL_ALLOCA_FOR_VAR; + else + s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR; +} + +/* Return true of S is a call to builtin_alloca emitted for VLA objects. */ + +static inline bool +gimple_call_alloca_for_var_p (gcall *s) +{ + return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0; +} + +/* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which + pointers to nested function are descriptors instead of trampolines. */ + +static inline void +gimple_call_set_by_descriptor (gcall *s, bool by_descriptor_p) +{ + if (by_descriptor_p) + s->subcode |= GF_CALL_BY_DESCRIPTOR; + else + s->subcode &= ~GF_CALL_BY_DESCRIPTOR; +} + +/* Return true if S is a by-descriptor call. */ + +static inline bool +gimple_call_by_descriptor_p (gcall *s) +{ + return (s->subcode & GF_CALL_BY_DESCRIPTOR) != 0; +} + +/* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */ + +static inline void +gimple_call_copy_flags (gcall *dest_call, gcall *orig_call) +{ + dest_call->subcode = orig_call->subcode; +} + + +/* Return a pointer to the points-to solution for the set of call-used + variables of the call CALL_STMT. */ + +static inline struct pt_solution * +gimple_call_use_set (gcall *call_stmt) +{ + return &call_stmt->call_used; +} + + +/* Return a pointer to the points-to solution for the set of call-used + variables of the call CALL_STMT. */ + +static inline struct pt_solution * +gimple_call_clobber_set (gcall *call_stmt) +{ + return &call_stmt->call_clobbered; +} + + +/* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a + non-NULL lhs. */ + +static inline bool +gimple_has_lhs (gimple *stmt) +{ + if (is_gimple_assign (stmt)) + return true; + if (gcall *call = dyn_cast (stmt)) + return gimple_call_lhs (call) != NULL_TREE; + return false; +} + + +/* Return the code of the predicate computed by conditional statement GS. */ + +static inline enum tree_code +gimple_cond_code (const gcond *gs) +{ + return (enum tree_code) gs->subcode; +} + +static inline enum tree_code +gimple_cond_code (const gimple *gs) +{ + const gcond *gc = GIMPLE_CHECK2 (gs); + return gimple_cond_code (gc); +} + + +/* Set CODE to be the predicate code for the conditional statement GS. */ + +static inline void +gimple_cond_set_code (gcond *gs, enum tree_code code) +{ + gs->subcode = code; +} + + +/* Return the LHS of the predicate computed by conditional statement GS. */ + +static inline tree +gimple_cond_lhs (const gcond *gs) +{ + return gs->op[0]; +} + +static inline tree +gimple_cond_lhs (const gimple *gs) +{ + const gcond *gc = GIMPLE_CHECK2 (gs); + return gimple_cond_lhs (gc); +} + +/* Return the pointer to the LHS of the predicate computed by conditional + statement GS. */ + +static inline tree * +gimple_cond_lhs_ptr (gcond *gs) +{ + return &gs->op[0]; +} + +/* Set LHS to be the LHS operand of the predicate computed by + conditional statement GS. */ + +static inline void +gimple_cond_set_lhs (gcond *gs, tree lhs) +{ + gs->op[0] = lhs; +} + + +/* Return the RHS operand of the predicate computed by conditional GS. */ + +static inline tree +gimple_cond_rhs (const gcond *gs) +{ + return gs->op[1]; +} + +static inline tree +gimple_cond_rhs (const gimple *gs) +{ + const gcond *gc = GIMPLE_CHECK2 (gs); + return gimple_cond_rhs (gc); +} + +/* Return the pointer to the RHS operand of the predicate computed by + conditional GS. */ + +static inline tree * +gimple_cond_rhs_ptr (gcond *gs) +{ + return &gs->op[1]; +} + + +/* Set RHS to be the RHS operand of the predicate computed by + conditional statement GS. */ + +static inline void +gimple_cond_set_rhs (gcond *gs, tree rhs) +{ + gs->op[1] = rhs; +} + + +/* Return the label used by conditional statement GS when its + predicate evaluates to true. */ + +static inline tree +gimple_cond_true_label (const gcond *gs) +{ + return gs->op[2]; +} + + +/* Set LABEL to be the label used by conditional statement GS when its + predicate evaluates to true. */ + +static inline void +gimple_cond_set_true_label (gcond *gs, tree label) +{ + gs->op[2] = label; +} + + +/* Set LABEL to be the label used by conditional statement GS when its + predicate evaluates to false. */ + +static inline void +gimple_cond_set_false_label (gcond *gs, tree label) +{ + gs->op[3] = label; +} + + +/* Return the label used by conditional statement GS when its + predicate evaluates to false. */ + +static inline tree +gimple_cond_false_label (const gcond *gs) +{ + return gs->op[3]; +} + + +/* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */ + +static inline void +gimple_cond_make_false (gcond *gs) +{ + gimple_cond_set_lhs (gs, boolean_false_node); + gimple_cond_set_rhs (gs, boolean_false_node); + gs->subcode = NE_EXPR; +} + + +/* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */ + +static inline void +gimple_cond_make_true (gcond *gs) +{ + gimple_cond_set_lhs (gs, boolean_true_node); + gimple_cond_set_rhs (gs, boolean_false_node); + gs->subcode = NE_EXPR; +} + +/* Check if conditional statemente GS is of the form 'if (1 == 1)', + 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */ + +static inline bool +gimple_cond_true_p (const gcond *gs) +{ + tree lhs = gimple_cond_lhs (gs); + tree rhs = gimple_cond_rhs (gs); + enum tree_code code = gimple_cond_code (gs); + + if (lhs != boolean_true_node && lhs != boolean_false_node) + return false; + + if (rhs != boolean_true_node && rhs != boolean_false_node) + return false; + + if (code == NE_EXPR && lhs != rhs) + return true; + + if (code == EQ_EXPR && lhs == rhs) + return true; + + return false; +} + +/* Check if conditional statement GS is of the form 'if (1 != 1)', + 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */ + +static inline bool +gimple_cond_false_p (const gcond *gs) +{ + tree lhs = gimple_cond_lhs (gs); + tree rhs = gimple_cond_rhs (gs); + enum tree_code code = gimple_cond_code (gs); + + if (lhs != boolean_true_node && lhs != boolean_false_node) + return false; + + if (rhs != boolean_true_node && rhs != boolean_false_node) + return false; + + if (code == NE_EXPR && lhs == rhs) + return true; + + if (code == EQ_EXPR && lhs != rhs) + return true; + + return false; +} + +/* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */ + +static inline void +gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs, + tree rhs) +{ + gimple_cond_set_code (stmt, code); + gimple_cond_set_lhs (stmt, lhs); + gimple_cond_set_rhs (stmt, rhs); +} + +/* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */ + +static inline tree +gimple_label_label (const glabel *gs) +{ + return gs->op[0]; +} + + +/* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement + GS. */ + +static inline void +gimple_label_set_label (glabel *gs, tree label) +{ + gs->op[0] = label; +} + + +/* Return the destination of the unconditional jump GS. */ + +static inline tree +gimple_goto_dest (const gimple *gs) +{ + GIMPLE_CHECK (gs, GIMPLE_GOTO); + return gimple_op (gs, 0); +} + + +/* Set DEST to be the destination of the unconditonal jump GS. */ + +static inline void +gimple_goto_set_dest (ggoto *gs, tree dest) +{ + gs->op[0] = dest; +} + + +/* Return the variables declared in the GIMPLE_BIND statement GS. */ + +static inline tree +gimple_bind_vars (const gbind *bind_stmt) +{ + return bind_stmt->vars; +} + + +/* Set VARS to be the set of variables declared in the GIMPLE_BIND + statement GS. */ + +static inline void +gimple_bind_set_vars (gbind *bind_stmt, tree vars) +{ + bind_stmt->vars = vars; +} + + +/* Append VARS to the set of variables declared in the GIMPLE_BIND + statement GS. */ + +static inline void +gimple_bind_append_vars (gbind *bind_stmt, tree vars) +{ + bind_stmt->vars = chainon (bind_stmt->vars, vars); +} + + +static inline gimple_seq * +gimple_bind_body_ptr (gbind *bind_stmt) +{ + return &bind_stmt->body; +} + +/* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */ + +static inline gimple_seq +gimple_bind_body (gbind *gs) +{ + return *gimple_bind_body_ptr (gs); +} + + +/* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND + statement GS. */ + +static inline void +gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq) +{ + bind_stmt->body = seq; +} + + +/* Append a statement to the end of a GIMPLE_BIND's body. */ + +static inline void +gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt) +{ + gimple_seq_add_stmt (&bind_stmt->body, stmt); +} + + +/* Append a sequence of statements to the end of a GIMPLE_BIND's body. */ + +static inline void +gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq) +{ + gimple_seq_add_seq (&bind_stmt->body, seq); +} + + +/* Return the TREE_BLOCK node associated with GIMPLE_BIND statement + GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */ + +static inline tree +gimple_bind_block (const gbind *bind_stmt) +{ + return bind_stmt->block; +} + + +/* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND + statement GS. */ + +static inline void +gimple_bind_set_block (gbind *bind_stmt, tree block) +{ + gcc_gimple_checking_assert (block == NULL_TREE + || TREE_CODE (block) == BLOCK); + bind_stmt->block = block; +} + + +/* Return the number of input operands for GIMPLE_ASM ASM_STMT. */ + +static inline unsigned +gimple_asm_ninputs (const gasm *asm_stmt) +{ + return asm_stmt->ni; +} + + +/* Return the number of output operands for GIMPLE_ASM ASM_STMT. */ + +static inline unsigned +gimple_asm_noutputs (const gasm *asm_stmt) +{ + return asm_stmt->no; +} + + +/* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */ + +static inline unsigned +gimple_asm_nclobbers (const gasm *asm_stmt) +{ + return asm_stmt->nc; +} + +/* Return the number of label operands for GIMPLE_ASM ASM_STMT. */ + +static inline unsigned +gimple_asm_nlabels (const gasm *asm_stmt) +{ + return asm_stmt->nl; +} + +/* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */ + +static inline tree +gimple_asm_input_op (const gasm *asm_stmt, unsigned index) +{ + gcc_gimple_checking_assert (index < asm_stmt->ni); + return asm_stmt->op[index + asm_stmt->no]; +} + +/* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */ + +static inline void +gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op) +{ + gcc_gimple_checking_assert (index < asm_stmt->ni + && TREE_CODE (in_op) == TREE_LIST); + asm_stmt->op[index + asm_stmt->no] = in_op; +} + + +/* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */ + +static inline tree +gimple_asm_output_op (const gasm *asm_stmt, unsigned index) +{ + gcc_gimple_checking_assert (index < asm_stmt->no); + return asm_stmt->op[index]; +} + +/* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */ + +static inline void +gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op) +{ + gcc_gimple_checking_assert (index < asm_stmt->no + && TREE_CODE (out_op) == TREE_LIST); + asm_stmt->op[index] = out_op; +} + + +/* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */ + +static inline tree +gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index) +{ + gcc_gimple_checking_assert (index < asm_stmt->nc); + return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no]; +} + + +/* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */ + +static inline void +gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op) +{ + gcc_gimple_checking_assert (index < asm_stmt->nc + && TREE_CODE (clobber_op) == TREE_LIST); + asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op; +} + +/* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */ + +static inline tree +gimple_asm_label_op (const gasm *asm_stmt, unsigned index) +{ + gcc_gimple_checking_assert (index < asm_stmt->nl); + return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc]; +} + +/* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */ + +static inline void +gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op) +{ + gcc_gimple_checking_assert (index < asm_stmt->nl + && TREE_CODE (label_op) == TREE_LIST); + asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op; +} + +/* Return the string representing the assembly instruction in + GIMPLE_ASM ASM_STMT. */ + +static inline const char * +gimple_asm_string (const gasm *asm_stmt) +{ + return asm_stmt->string; +} + + +/* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */ + +static inline bool +gimple_asm_volatile_p (const gasm *asm_stmt) +{ + return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0; +} + + +/* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */ + +static inline void +gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p) +{ + if (volatile_p) + asm_stmt->subcode |= GF_ASM_VOLATILE; + else + asm_stmt->subcode &= ~GF_ASM_VOLATILE; +} + + +/* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */ + +static inline void +gimple_asm_set_input (gasm *asm_stmt, bool input_p) +{ + if (input_p) + asm_stmt->subcode |= GF_ASM_INPUT; + else + asm_stmt->subcode &= ~GF_ASM_INPUT; +} + + +/* Return true if asm ASM_STMT is an ASM_INPUT. */ + +static inline bool +gimple_asm_input_p (const gasm *asm_stmt) +{ + return (asm_stmt->subcode & GF_ASM_INPUT) != 0; +} + + +/* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */ + +static inline tree +gimple_catch_types (const gcatch *catch_stmt) +{ + return catch_stmt->types; +} + + +/* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */ + +static inline tree * +gimple_catch_types_ptr (gcatch *catch_stmt) +{ + return &catch_stmt->types; +} + + +/* Return a pointer to the GIMPLE sequence representing the body of + the handler of GIMPLE_CATCH statement CATCH_STMT. */ + +static inline gimple_seq * +gimple_catch_handler_ptr (gcatch *catch_stmt) +{ + return &catch_stmt->handler; +} + + +/* Return the GIMPLE sequence representing the body of the handler of + GIMPLE_CATCH statement CATCH_STMT. */ + +static inline gimple_seq +gimple_catch_handler (gcatch *catch_stmt) +{ + return *gimple_catch_handler_ptr (catch_stmt); +} + + +/* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */ + +static inline void +gimple_catch_set_types (gcatch *catch_stmt, tree t) +{ + catch_stmt->types = t; +} + + +/* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */ + +static inline void +gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler) +{ + catch_stmt->handler = handler; +} + + +/* Return the types handled by GIMPLE_EH_FILTER statement GS. */ + +static inline tree +gimple_eh_filter_types (const gimple *gs) +{ + const geh_filter *eh_filter_stmt = as_a (gs); + return eh_filter_stmt->types; +} + + +/* Return a pointer to the types handled by GIMPLE_EH_FILTER statement + GS. */ + +static inline tree * +gimple_eh_filter_types_ptr (gimple *gs) +{ + geh_filter *eh_filter_stmt = as_a (gs); + return &eh_filter_stmt->types; +} + + +/* Return a pointer to the sequence of statement to execute when + GIMPLE_EH_FILTER statement fails. */ + +static inline gimple_seq * +gimple_eh_filter_failure_ptr (gimple *gs) +{ + geh_filter *eh_filter_stmt = as_a (gs); + return &eh_filter_stmt->failure; +} + + +/* Return the sequence of statement to execute when GIMPLE_EH_FILTER + statement fails. */ + +static inline gimple_seq +gimple_eh_filter_failure (gimple *gs) +{ + return *gimple_eh_filter_failure_ptr (gs); +} + + +/* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER + EH_FILTER_STMT. */ + +static inline void +gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types) +{ + eh_filter_stmt->types = types; +} + + +/* Set FAILURE to be the sequence of statements to execute on failure + for GIMPLE_EH_FILTER EH_FILTER_STMT. */ + +static inline void +gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt, + gimple_seq failure) +{ + eh_filter_stmt->failure = failure; +} + +/* Get the function decl to be called by the MUST_NOT_THROW region. */ + +static inline tree +gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt) +{ + return eh_mnt_stmt->fndecl; +} + +/* Set the function decl to be called by GS to DECL. */ + +static inline void +gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt, + tree decl) +{ + eh_mnt_stmt->fndecl = decl; +} + +/* GIMPLE_EH_ELSE accessors. */ + +static inline gimple_seq * +gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt) +{ + return &eh_else_stmt->n_body; +} + +static inline gimple_seq +gimple_eh_else_n_body (geh_else *eh_else_stmt) +{ + return *gimple_eh_else_n_body_ptr (eh_else_stmt); +} + +static inline gimple_seq * +gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt) +{ + return &eh_else_stmt->e_body; +} + +static inline gimple_seq +gimple_eh_else_e_body (geh_else *eh_else_stmt) +{ + return *gimple_eh_else_e_body_ptr (eh_else_stmt); +} + +static inline void +gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq) +{ + eh_else_stmt->n_body = seq; +} + +static inline void +gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq) +{ + eh_else_stmt->e_body = seq; +} + +/* GIMPLE_TRY accessors. */ + +/* Return the kind of try block represented by GIMPLE_TRY GS. This is + either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */ + +static inline enum gimple_try_flags +gimple_try_kind (const gimple *gs) +{ + GIMPLE_CHECK (gs, GIMPLE_TRY); + return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND); +} + + +/* Set the kind of try block represented by GIMPLE_TRY GS. */ + +static inline void +gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind) +{ + gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH + || kind == GIMPLE_TRY_FINALLY); + if (gimple_try_kind (gs) != kind) + gs->subcode = (unsigned int) kind; +} + + +/* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */ + +static inline bool +gimple_try_catch_is_cleanup (const gimple *gs) +{ + gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH); + return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0; +} + + +/* Return a pointer to the sequence of statements used as the + body for GIMPLE_TRY GS. */ + +static inline gimple_seq * +gimple_try_eval_ptr (gimple *gs) +{ + gtry *try_stmt = as_a (gs); + return &try_stmt->eval; +} + + +/* Return the sequence of statements used as the body for GIMPLE_TRY GS. */ + +static inline gimple_seq +gimple_try_eval (gimple *gs) +{ + return *gimple_try_eval_ptr (gs); +} + + +/* Return a pointer to the sequence of statements used as the cleanup body for + GIMPLE_TRY GS. */ + +static inline gimple_seq * +gimple_try_cleanup_ptr (gimple *gs) +{ + gtry *try_stmt = as_a (gs); + return &try_stmt->cleanup; +} + + +/* Return the sequence of statements used as the cleanup body for + GIMPLE_TRY GS. */ + +static inline gimple_seq +gimple_try_cleanup (gimple *gs) +{ + return *gimple_try_cleanup_ptr (gs); +} + + +/* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */ + +static inline void +gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup) +{ + gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH); + if (catch_is_cleanup) + g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP; + else + g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP; +} + + +/* Set EVAL to be the sequence of statements to use as the body for + GIMPLE_TRY TRY_STMT. */ + +static inline void +gimple_try_set_eval (gtry *try_stmt, gimple_seq eval) +{ + try_stmt->eval = eval; +} + + +/* Set CLEANUP to be the sequence of statements to use as the cleanup + body for GIMPLE_TRY TRY_STMT. */ + +static inline void +gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup) +{ + try_stmt->cleanup = cleanup; +} + + +/* Return a pointer to the cleanup sequence for cleanup statement GS. */ + +static inline gimple_seq * +gimple_wce_cleanup_ptr (gimple *gs) +{ + gimple_statement_wce *wce_stmt = as_a (gs); + return &wce_stmt->cleanup; +} + + +/* Return the cleanup sequence for cleanup statement GS. */ + +static inline gimple_seq +gimple_wce_cleanup (gimple *gs) +{ + return *gimple_wce_cleanup_ptr (gs); +} + + +/* Set CLEANUP to be the cleanup sequence for GS. */ + +static inline void +gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup) +{ + gimple_statement_wce *wce_stmt = as_a (gs); + wce_stmt->cleanup = cleanup; +} + + +/* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */ + +static inline bool +gimple_wce_cleanup_eh_only (const gimple *gs) +{ + GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR); + return gs->subcode != 0; +} + + +/* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */ + +static inline void +gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p) +{ + GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR); + gs->subcode = (unsigned int) eh_only_p; +} + + +/* Return the maximum number of arguments supported by GIMPLE_PHI GS. */ + +static inline unsigned +gimple_phi_capacity (const gimple *gs) +{ + const gphi *phi_stmt = as_a (gs); + return phi_stmt->capacity; +} + + +/* Return the number of arguments in GIMPLE_PHI GS. This must always + be exactly the number of incoming edges for the basic block holding + GS. */ + +static inline unsigned +gimple_phi_num_args (const gimple *gs) +{ + const gphi *phi_stmt = as_a (gs); + return phi_stmt->nargs; +} + + +/* Return the SSA name created by GIMPLE_PHI GS. */ + +static inline tree +gimple_phi_result (const gimple *gs) +{ + const gphi *phi_stmt = as_a (gs); + return phi_stmt->result; +} + +/* Return a pointer to the SSA name created by GIMPLE_PHI GS. */ + +static inline tree * +gimple_phi_result_ptr (gimple *gs) +{ + gphi *phi_stmt = as_a (gs); + return &phi_stmt->result; +} + +/* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */ + +static inline void +gimple_phi_set_result (gphi *phi, tree result) +{ + phi->result = result; + if (result && TREE_CODE (result) == SSA_NAME) + SSA_NAME_DEF_STMT (result) = phi; +} + + +/* Return the PHI argument corresponding to incoming edge INDEX for + GIMPLE_PHI GS. */ + +static inline struct phi_arg_d * +gimple_phi_arg (gimple *gs, unsigned index) +{ + gphi *phi_stmt = as_a (gs); + gcc_gimple_checking_assert (index <= phi_stmt->capacity); + return &(phi_stmt->args[index]); +} + +/* Set PHIARG to be the argument corresponding to incoming edge INDEX + for GIMPLE_PHI PHI. */ + +static inline void +gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg) +{ + gcc_gimple_checking_assert (index <= phi->nargs); + phi->args[index] = *phiarg; +} + +/* Return the PHI nodes for basic block BB, or NULL if there are no + PHI nodes. */ + +static inline gimple_seq +phi_nodes (const_basic_block bb) +{ + gcc_checking_assert (!(bb->flags & BB_RTL)); + return bb->il.gimple.phi_nodes; +} + +/* Return a pointer to the PHI nodes for basic block BB. */ + +static inline gimple_seq * +phi_nodes_ptr (basic_block bb) +{ + gcc_checking_assert (!(bb->flags & BB_RTL)); + return &bb->il.gimple.phi_nodes; +} + +/* Return the tree operand for argument I of PHI node GS. */ + +static inline tree +gimple_phi_arg_def (gimple *gs, size_t index) +{ + return gimple_phi_arg (gs, index)->def; +} + + +/* Return a pointer to the tree operand for argument I of phi node PHI. */ + +static inline tree * +gimple_phi_arg_def_ptr (gphi *phi, size_t index) +{ + return &gimple_phi_arg (phi, index)->def; +} + +/* Return the edge associated with argument I of phi node PHI. */ + +static inline edge +gimple_phi_arg_edge (gphi *phi, size_t i) +{ + return EDGE_PRED (gimple_bb (phi), i); +} + +/* Return the source location of gimple argument I of phi node PHI. */ + +static inline source_location +gimple_phi_arg_location (gphi *phi, size_t i) +{ + return gimple_phi_arg (phi, i)->locus; +} + +/* Return the source location of the argument on edge E of phi node PHI. */ + +static inline source_location +gimple_phi_arg_location_from_edge (gphi *phi, edge e) +{ + return gimple_phi_arg (phi, e->dest_idx)->locus; +} + +/* Set the source location of gimple argument I of phi node PHI to LOC. */ + +static inline void +gimple_phi_arg_set_location (gphi *phi, size_t i, source_location loc) +{ + gimple_phi_arg (phi, i)->locus = loc; +} + +/* Return TRUE if argument I of phi node PHI has a location record. */ + +static inline bool +gimple_phi_arg_has_location (gphi *phi, size_t i) +{ + return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION; +} + + +/* Return the region number for GIMPLE_RESX RESX_STMT. */ + +static inline int +gimple_resx_region (const gresx *resx_stmt) +{ + return resx_stmt->region; +} + +/* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */ + +static inline void +gimple_resx_set_region (gresx *resx_stmt, int region) +{ + resx_stmt->region = region; +} + +/* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */ + +static inline int +gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt) +{ + return eh_dispatch_stmt->region; +} + +/* Set REGION to be the region number for GIMPLE_EH_DISPATCH + EH_DISPATCH_STMT. */ + +static inline void +gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region) +{ + eh_dispatch_stmt->region = region; +} + +/* Return the number of labels associated with the switch statement GS. */ + +static inline unsigned +gimple_switch_num_labels (const gswitch *gs) +{ + unsigned num_ops; + GIMPLE_CHECK (gs, GIMPLE_SWITCH); + num_ops = gimple_num_ops (gs); + gcc_gimple_checking_assert (num_ops > 1); + return num_ops - 1; +} + + +/* Set NLABELS to be the number of labels for the switch statement GS. */ + +static inline void +gimple_switch_set_num_labels (gswitch *g, unsigned nlabels) +{ + GIMPLE_CHECK (g, GIMPLE_SWITCH); + gimple_set_num_ops (g, nlabels + 1); +} + + +/* Return the index variable used by the switch statement GS. */ + +static inline tree +gimple_switch_index (const gswitch *gs) +{ + return gs->op[0]; +} + + +/* Return a pointer to the index variable for the switch statement GS. */ + +static inline tree * +gimple_switch_index_ptr (gswitch *gs) +{ + return &gs->op[0]; +} + + +/* Set INDEX to be the index variable for switch statement GS. */ + +static inline void +gimple_switch_set_index (gswitch *gs, tree index) +{ + gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index)); + gs->op[0] = index; +} + + +/* Return the label numbered INDEX. The default label is 0, followed by any + labels in a switch statement. */ + +static inline tree +gimple_switch_label (const gswitch *gs, unsigned index) +{ + gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1); + return gs->op[index + 1]; +} + +/* Set the label number INDEX to LABEL. 0 is always the default label. */ + +static inline void +gimple_switch_set_label (gswitch *gs, unsigned index, tree label) +{ + gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1 + && (label == NULL_TREE + || TREE_CODE (label) == CASE_LABEL_EXPR)); + gs->op[index + 1] = label; +} + +/* Return the default label for a switch statement. */ + +static inline tree +gimple_switch_default_label (const gswitch *gs) +{ + tree label = gimple_switch_label (gs, 0); + gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label)); + return label; +} + +/* Set the default label for a switch statement. */ + +static inline void +gimple_switch_set_default_label (gswitch *gs, tree label) +{ + gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label)); + gimple_switch_set_label (gs, 0, label); +} + +/* Return true if GS is a GIMPLE_DEBUG statement. */ + +static inline bool +is_gimple_debug (const gimple *gs) +{ + return gimple_code (gs) == GIMPLE_DEBUG; +} + +/* Return true if S is a GIMPLE_DEBUG BIND statement. */ + +static inline bool +gimple_debug_bind_p (const gimple *s) +{ + if (is_gimple_debug (s)) + return s->subcode == GIMPLE_DEBUG_BIND; + + return false; +} + +/* Return the variable bound in a GIMPLE_DEBUG bind statement. */ + +static inline tree +gimple_debug_bind_get_var (gimple *dbg) +{ + GIMPLE_CHECK (dbg, GIMPLE_DEBUG); + gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); + return gimple_op (dbg, 0); +} + +/* Return the value bound to the variable in a GIMPLE_DEBUG bind + statement. */ + +static inline tree +gimple_debug_bind_get_value (gimple *dbg) +{ + GIMPLE_CHECK (dbg, GIMPLE_DEBUG); + gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); + return gimple_op (dbg, 1); +} + +/* Return a pointer to the value bound to the variable in a + GIMPLE_DEBUG bind statement. */ + +static inline tree * +gimple_debug_bind_get_value_ptr (gimple *dbg) +{ + GIMPLE_CHECK (dbg, GIMPLE_DEBUG); + gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); + return gimple_op_ptr (dbg, 1); +} + +/* Set the variable bound in a GIMPLE_DEBUG bind statement. */ + +static inline void +gimple_debug_bind_set_var (gimple *dbg, tree var) +{ + GIMPLE_CHECK (dbg, GIMPLE_DEBUG); + gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); + gimple_set_op (dbg, 0, var); +} + +/* Set the value bound to the variable in a GIMPLE_DEBUG bind + statement. */ + +static inline void +gimple_debug_bind_set_value (gimple *dbg, tree value) +{ + GIMPLE_CHECK (dbg, GIMPLE_DEBUG); + gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); + gimple_set_op (dbg, 1, value); +} + +/* The second operand of a GIMPLE_DEBUG_BIND, when the value was + optimized away. */ +#define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */ + +/* Remove the value bound to the variable in a GIMPLE_DEBUG bind + statement. */ + +static inline void +gimple_debug_bind_reset_value (gimple *dbg) +{ + GIMPLE_CHECK (dbg, GIMPLE_DEBUG); + gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); + gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE); +} + +/* Return true if the GIMPLE_DEBUG bind statement is bound to a + value. */ + +static inline bool +gimple_debug_bind_has_value_p (gimple *dbg) +{ + GIMPLE_CHECK (dbg, GIMPLE_DEBUG); + gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); + return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE; +} + +#undef GIMPLE_DEBUG_BIND_NOVALUE + +/* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */ + +static inline bool +gimple_debug_source_bind_p (const gimple *s) +{ + if (is_gimple_debug (s)) + return s->subcode == GIMPLE_DEBUG_SOURCE_BIND; + + return false; +} + +/* Return the variable bound in a GIMPLE_DEBUG source bind statement. */ + +static inline tree +gimple_debug_source_bind_get_var (gimple *dbg) +{ + GIMPLE_CHECK (dbg, GIMPLE_DEBUG); + gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); + return gimple_op (dbg, 0); +} + +/* Return the value bound to the variable in a GIMPLE_DEBUG source bind + statement. */ + +static inline tree +gimple_debug_source_bind_get_value (gimple *dbg) +{ + GIMPLE_CHECK (dbg, GIMPLE_DEBUG); + gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); + return gimple_op (dbg, 1); +} + +/* Return a pointer to the value bound to the variable in a + GIMPLE_DEBUG source bind statement. */ + +static inline tree * +gimple_debug_source_bind_get_value_ptr (gimple *dbg) +{ + GIMPLE_CHECK (dbg, GIMPLE_DEBUG); + gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); + return gimple_op_ptr (dbg, 1); +} + +/* Set the variable bound in a GIMPLE_DEBUG source bind statement. */ + +static inline void +gimple_debug_source_bind_set_var (gimple *dbg, tree var) +{ + GIMPLE_CHECK (dbg, GIMPLE_DEBUG); + gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); + gimple_set_op (dbg, 0, var); +} + +/* Set the value bound to the variable in a GIMPLE_DEBUG source bind + statement. */ + +static inline void +gimple_debug_source_bind_set_value (gimple *dbg, tree value) +{ + GIMPLE_CHECK (dbg, GIMPLE_DEBUG); + gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); + gimple_set_op (dbg, 1, value); +} + +/* Return the line number for EXPR, or return -1 if we have no line + number information for it. */ +static inline int +get_lineno (const gimple *stmt) +{ + location_t loc; + + if (!stmt) + return -1; + + loc = gimple_location (stmt); + if (loc == UNKNOWN_LOCATION) + return -1; + + return LOCATION_LINE (loc); +} + +/* Return a pointer to the body for the OMP statement GS. */ + +static inline gimple_seq * +gimple_omp_body_ptr (gimple *gs) +{ + return &static_cast (gs)->body; +} + +/* Return the body for the OMP statement GS. */ + +static inline gimple_seq +gimple_omp_body (gimple *gs) +{ + return *gimple_omp_body_ptr (gs); +} + +/* Set BODY to be the body for the OMP statement GS. */ + +static inline void +gimple_omp_set_body (gimple *gs, gimple_seq body) +{ + static_cast (gs)->body = body; +} + + +/* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */ + +static inline tree +gimple_omp_critical_name (const gomp_critical *crit_stmt) +{ + return crit_stmt->name; +} + + +/* Return a pointer to the name associated with OMP critical statement + CRIT_STMT. */ + +static inline tree * +gimple_omp_critical_name_ptr (gomp_critical *crit_stmt) +{ + return &crit_stmt->name; +} + + +/* Set NAME to be the name associated with OMP critical statement + CRIT_STMT. */ + +static inline void +gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name) +{ + crit_stmt->name = name; +} + + +/* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */ + +static inline tree +gimple_omp_critical_clauses (const gomp_critical *crit_stmt) +{ + return crit_stmt->clauses; +} + + +/* Return a pointer to the clauses associated with OMP critical statement + CRIT_STMT. */ + +static inline tree * +gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt) +{ + return &crit_stmt->clauses; +} + + +/* Set CLAUSES to be the clauses associated with OMP critical statement + CRIT_STMT. */ + +static inline void +gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses) +{ + crit_stmt->clauses = clauses; +} + + +/* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */ + +static inline tree +gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt) +{ + return ord_stmt->clauses; +} + + +/* Return a pointer to the clauses associated with OMP ordered statement + ORD_STMT. */ + +static inline tree * +gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt) +{ + return &ord_stmt->clauses; +} + + +/* Set CLAUSES to be the clauses associated with OMP ordered statement + ORD_STMT. */ + +static inline void +gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses) +{ + ord_stmt->clauses = clauses; +} + + +/* Return the kind of the OMP_FOR statemement G. */ + +static inline int +gimple_omp_for_kind (const gimple *g) +{ + GIMPLE_CHECK (g, GIMPLE_OMP_FOR); + return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK); +} + + +/* Set the kind of the OMP_FOR statement G. */ + +static inline void +gimple_omp_for_set_kind (gomp_for *g, int kind) +{ + g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK) + | (kind & GF_OMP_FOR_KIND_MASK); +} + + +/* Return true if OMP_FOR statement G has the + GF_OMP_FOR_COMBINED flag set. */ + +static inline bool +gimple_omp_for_combined_p (const gimple *g) +{ + GIMPLE_CHECK (g, GIMPLE_OMP_FOR); + return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0; +} + + +/* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on + the boolean value of COMBINED_P. */ + +static inline void +gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p) +{ + if (combined_p) + g->subcode |= GF_OMP_FOR_COMBINED; + else + g->subcode &= ~GF_OMP_FOR_COMBINED; +} + + +/* Return true if the OMP_FOR statement G has the + GF_OMP_FOR_COMBINED_INTO flag set. */ + +static inline bool +gimple_omp_for_combined_into_p (const gimple *g) +{ + GIMPLE_CHECK (g, GIMPLE_OMP_FOR); + return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0; +} + + +/* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending + on the boolean value of COMBINED_P. */ + +static inline void +gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p) +{ + if (combined_p) + g->subcode |= GF_OMP_FOR_COMBINED_INTO; + else + g->subcode &= ~GF_OMP_FOR_COMBINED_INTO; +} + + +/* Return the clauses associated with the OMP_FOR statement GS. */ + +static inline tree +gimple_omp_for_clauses (const gimple *gs) +{ + const gomp_for *omp_for_stmt = as_a (gs); + return omp_for_stmt->clauses; +} + + +/* Return a pointer to the clauses associated with the OMP_FOR statement + GS. */ + +static inline tree * +gimple_omp_for_clauses_ptr (gimple *gs) +{ + gomp_for *omp_for_stmt = as_a (gs); + return &omp_for_stmt->clauses; +} + + +/* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement + GS. */ + +static inline void +gimple_omp_for_set_clauses (gimple *gs, tree clauses) +{ + gomp_for *omp_for_stmt = as_a (gs); + omp_for_stmt->clauses = clauses; +} + + +/* Get the collapse count of the OMP_FOR statement GS. */ + +static inline size_t +gimple_omp_for_collapse (gimple *gs) +{ + gomp_for *omp_for_stmt = as_a (gs); + return omp_for_stmt->collapse; +} + + +/* Return the condition code associated with the OMP_FOR statement GS. */ + +static inline enum tree_code +gimple_omp_for_cond (const gimple *gs, size_t i) +{ + const gomp_for *omp_for_stmt = as_a (gs); + gcc_gimple_checking_assert (i < omp_for_stmt->collapse); + return omp_for_stmt->iter[i].cond; +} + + +/* Set COND to be the condition code for the OMP_FOR statement GS. */ + +static inline void +gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond) +{ + gomp_for *omp_for_stmt = as_a (gs); + gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison + && i < omp_for_stmt->collapse); + omp_for_stmt->iter[i].cond = cond; +} + + +/* Return the index variable for the OMP_FOR statement GS. */ + +static inline tree +gimple_omp_for_index (const gimple *gs, size_t i) +{ + const gomp_for *omp_for_stmt = as_a (gs); + gcc_gimple_checking_assert (i < omp_for_stmt->collapse); + return omp_for_stmt->iter[i].index; +} + + +/* Return a pointer to the index variable for the OMP_FOR statement GS. */ + +static inline tree * +gimple_omp_for_index_ptr (gimple *gs, size_t i) +{ + gomp_for *omp_for_stmt = as_a (gs); + gcc_gimple_checking_assert (i < omp_for_stmt->collapse); + return &omp_for_stmt->iter[i].index; +} + + +/* Set INDEX to be the index variable for the OMP_FOR statement GS. */ + +static inline void +gimple_omp_for_set_index (gimple *gs, size_t i, tree index) +{ + gomp_for *omp_for_stmt = as_a (gs); + gcc_gimple_checking_assert (i < omp_for_stmt->collapse); + omp_for_stmt->iter[i].index = index; +} + + +/* Return the initial value for the OMP_FOR statement GS. */ + +static inline tree +gimple_omp_for_initial (const gimple *gs, size_t i) +{ + const gomp_for *omp_for_stmt = as_a (gs); + gcc_gimple_checking_assert (i < omp_for_stmt->collapse); + return omp_for_stmt->iter[i].initial; +} + + +/* Return a pointer to the initial value for the OMP_FOR statement GS. */ + +static inline tree * +gimple_omp_for_initial_ptr (gimple *gs, size_t i) +{ + gomp_for *omp_for_stmt = as_a (gs); + gcc_gimple_checking_assert (i < omp_for_stmt->collapse); + return &omp_for_stmt->iter[i].initial; +} + + +/* Set INITIAL to be the initial value for the OMP_FOR statement GS. */ + +static inline void +gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial) +{ + gomp_for *omp_for_stmt = as_a (gs); + gcc_gimple_checking_assert (i < omp_for_stmt->collapse); + omp_for_stmt->iter[i].initial = initial; +} + + +/* Return the final value for the OMP_FOR statement GS. */ + +static inline tree +gimple_omp_for_final (const gimple *gs, size_t i) +{ + const gomp_for *omp_for_stmt = as_a (gs); + gcc_gimple_checking_assert (i < omp_for_stmt->collapse); + return omp_for_stmt->iter[i].final; +} + + +/* Return a pointer to the final value for the OMP_FOR statement GS. */ + +static inline tree * +gimple_omp_for_final_ptr (gimple *gs, size_t i) +{ + gomp_for *omp_for_stmt = as_a (gs); + gcc_gimple_checking_assert (i < omp_for_stmt->collapse); + return &omp_for_stmt->iter[i].final; +} + + +/* Set FINAL to be the final value for the OMP_FOR statement GS. */ + +static inline void +gimple_omp_for_set_final (gimple *gs, size_t i, tree final) +{ + gomp_for *omp_for_stmt = as_a (gs); + gcc_gimple_checking_assert (i < omp_for_stmt->collapse); + omp_for_stmt->iter[i].final = final; +} + + +/* Return the increment value for the OMP_FOR statement GS. */ + +static inline tree +gimple_omp_for_incr (const gimple *gs, size_t i) +{ + const gomp_for *omp_for_stmt = as_a (gs); + gcc_gimple_checking_assert (i < omp_for_stmt->collapse); + return omp_for_stmt->iter[i].incr; +} + + +/* Return a pointer to the increment value for the OMP_FOR statement GS. */ + +static inline tree * +gimple_omp_for_incr_ptr (gimple *gs, size_t i) +{ + gomp_for *omp_for_stmt = as_a (gs); + gcc_gimple_checking_assert (i < omp_for_stmt->collapse); + return &omp_for_stmt->iter[i].incr; +} + + +/* Set INCR to be the increment value for the OMP_FOR statement GS. */ + +static inline void +gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr) +{ + gomp_for *omp_for_stmt = as_a (gs); + gcc_gimple_checking_assert (i < omp_for_stmt->collapse); + omp_for_stmt->iter[i].incr = incr; +} + + +/* Return a pointer to the sequence of statements to execute before the OMP_FOR + statement GS starts. */ + +static inline gimple_seq * +gimple_omp_for_pre_body_ptr (gimple *gs) +{ + gomp_for *omp_for_stmt = as_a (gs); + return &omp_for_stmt->pre_body; +} + + +/* Return the sequence of statements to execute before the OMP_FOR + statement GS starts. */ + +static inline gimple_seq +gimple_omp_for_pre_body (gimple *gs) +{ + return *gimple_omp_for_pre_body_ptr (gs); +} + + +/* Set PRE_BODY to be the sequence of statements to execute before the + OMP_FOR statement GS starts. */ + +static inline void +gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body) +{ + gomp_for *omp_for_stmt = as_a (gs); + omp_for_stmt->pre_body = pre_body; +} + +/* Return the kernel_phony of OMP_FOR statement. */ + +static inline bool +gimple_omp_for_grid_phony (const gomp_for *omp_for) +{ + gcc_checking_assert (gimple_omp_for_kind (omp_for) + != GF_OMP_FOR_KIND_GRID_LOOP); + return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_PHONY) != 0; +} + +/* Set kernel_phony flag of OMP_FOR to VALUE. */ + +static inline void +gimple_omp_for_set_grid_phony (gomp_for *omp_for, bool value) +{ + gcc_checking_assert (gimple_omp_for_kind (omp_for) + != GF_OMP_FOR_KIND_GRID_LOOP); + if (value) + omp_for->subcode |= GF_OMP_FOR_GRID_PHONY; + else + omp_for->subcode &= ~GF_OMP_FOR_GRID_PHONY; +} + +/* Return the kernel_intra_group of a GRID_LOOP OMP_FOR statement. */ + +static inline bool +gimple_omp_for_grid_intra_group (const gomp_for *omp_for) +{ + gcc_checking_assert (gimple_omp_for_kind (omp_for) + == GF_OMP_FOR_KIND_GRID_LOOP); + return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_INTRA_GROUP) != 0; +} + +/* Set kernel_intra_group flag of OMP_FOR to VALUE. */ + +static inline void +gimple_omp_for_set_grid_intra_group (gomp_for *omp_for, bool value) +{ + gcc_checking_assert (gimple_omp_for_kind (omp_for) + == GF_OMP_FOR_KIND_GRID_LOOP); + if (value) + omp_for->subcode |= GF_OMP_FOR_GRID_INTRA_GROUP; + else + omp_for->subcode &= ~GF_OMP_FOR_GRID_INTRA_GROUP; +} + +/* Return true if iterations of a grid OMP_FOR statement correspond to HSA + groups. */ + +static inline bool +gimple_omp_for_grid_group_iter (const gomp_for *omp_for) +{ + gcc_checking_assert (gimple_omp_for_kind (omp_for) + == GF_OMP_FOR_KIND_GRID_LOOP); + return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_GROUP_ITER) != 0; +} + +/* Set group_iter flag of OMP_FOR to VALUE. */ + +static inline void +gimple_omp_for_set_grid_group_iter (gomp_for *omp_for, bool value) +{ + gcc_checking_assert (gimple_omp_for_kind (omp_for) + == GF_OMP_FOR_KIND_GRID_LOOP); + if (value) + omp_for->subcode |= GF_OMP_FOR_GRID_GROUP_ITER; + else + omp_for->subcode &= ~GF_OMP_FOR_GRID_GROUP_ITER; +} + +/* Return the clauses associated with OMP_PARALLEL GS. */ + +static inline tree +gimple_omp_parallel_clauses (const gimple *gs) +{ + const gomp_parallel *omp_parallel_stmt = as_a (gs); + return omp_parallel_stmt->clauses; +} + + +/* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */ + +static inline tree * +gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt) +{ + return &omp_parallel_stmt->clauses; +} + + +/* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */ + +static inline void +gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt, + tree clauses) +{ + omp_parallel_stmt->clauses = clauses; +} + + +/* Return the child function used to hold the body of OMP_PARALLEL_STMT. */ + +static inline tree +gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt) +{ + return omp_parallel_stmt->child_fn; +} + +/* Return a pointer to the child function used to hold the body of + OMP_PARALLEL_STMT. */ + +static inline tree * +gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt) +{ + return &omp_parallel_stmt->child_fn; +} + + +/* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */ + +static inline void +gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt, + tree child_fn) +{ + omp_parallel_stmt->child_fn = child_fn; +} + + +/* Return the artificial argument used to send variables and values + from the parent to the children threads in OMP_PARALLEL_STMT. */ + +static inline tree +gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt) +{ + return omp_parallel_stmt->data_arg; +} + + +/* Return a pointer to the data argument for OMP_PARALLEL_STMT. */ + +static inline tree * +gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt) +{ + return &omp_parallel_stmt->data_arg; +} + + +/* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */ + +static inline void +gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt, + tree data_arg) +{ + omp_parallel_stmt->data_arg = data_arg; +} + +/* Return the kernel_phony flag of OMP_PARALLEL_STMT. */ + +static inline bool +gimple_omp_parallel_grid_phony (const gomp_parallel *stmt) +{ + return (gimple_omp_subcode (stmt) & GF_OMP_PARALLEL_GRID_PHONY) != 0; +} + +/* Set kernel_phony flag of OMP_PARALLEL_STMT to VALUE. */ + +static inline void +gimple_omp_parallel_set_grid_phony (gomp_parallel *stmt, bool value) +{ + if (value) + stmt->subcode |= GF_OMP_PARALLEL_GRID_PHONY; + else + stmt->subcode &= ~GF_OMP_PARALLEL_GRID_PHONY; +} + +/* Return the clauses associated with OMP_TASK GS. */ + +static inline tree +gimple_omp_task_clauses (const gimple *gs) +{ + const gomp_task *omp_task_stmt = as_a (gs); + return omp_task_stmt->clauses; +} + + +/* Return a pointer to the clauses associated with OMP_TASK GS. */ + +static inline tree * +gimple_omp_task_clauses_ptr (gimple *gs) +{ + gomp_task *omp_task_stmt = as_a (gs); + return &omp_task_stmt->clauses; +} + + +/* Set CLAUSES to be the list of clauses associated with OMP_TASK + GS. */ + +static inline void +gimple_omp_task_set_clauses (gimple *gs, tree clauses) +{ + gomp_task *omp_task_stmt = as_a (gs); + omp_task_stmt->clauses = clauses; +} + + +/* Return true if OMP task statement G has the + GF_OMP_TASK_TASKLOOP flag set. */ + +static inline bool +gimple_omp_task_taskloop_p (const gimple *g) +{ + GIMPLE_CHECK (g, GIMPLE_OMP_TASK); + return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0; +} + + +/* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean + value of TASKLOOP_P. */ + +static inline void +gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p) +{ + GIMPLE_CHECK (g, GIMPLE_OMP_TASK); + if (taskloop_p) + g->subcode |= GF_OMP_TASK_TASKLOOP; + else + g->subcode &= ~GF_OMP_TASK_TASKLOOP; +} + + +/* Return the child function used to hold the body of OMP_TASK GS. */ + +static inline tree +gimple_omp_task_child_fn (const gimple *gs) +{ + const gomp_task *omp_task_stmt = as_a (gs); + return omp_task_stmt->child_fn; +} + +/* Return a pointer to the child function used to hold the body of + OMP_TASK GS. */ + +static inline tree * +gimple_omp_task_child_fn_ptr (gimple *gs) +{ + gomp_task *omp_task_stmt = as_a (gs); + return &omp_task_stmt->child_fn; +} + + +/* Set CHILD_FN to be the child function for OMP_TASK GS. */ + +static inline void +gimple_omp_task_set_child_fn (gimple *gs, tree child_fn) +{ + gomp_task *omp_task_stmt = as_a (gs); + omp_task_stmt->child_fn = child_fn; +} + + +/* Return the artificial argument used to send variables and values + from the parent to the children threads in OMP_TASK GS. */ + +static inline tree +gimple_omp_task_data_arg (const gimple *gs) +{ + const gomp_task *omp_task_stmt = as_a (gs); + return omp_task_stmt->data_arg; +} + + +/* Return a pointer to the data argument for OMP_TASK GS. */ + +static inline tree * +gimple_omp_task_data_arg_ptr (gimple *gs) +{ + gomp_task *omp_task_stmt = as_a (gs); + return &omp_task_stmt->data_arg; +} + + +/* Set DATA_ARG to be the data argument for OMP_TASK GS. */ + +static inline void +gimple_omp_task_set_data_arg (gimple *gs, tree data_arg) +{ + gomp_task *omp_task_stmt = as_a (gs); + omp_task_stmt->data_arg = data_arg; +} + + +/* Return the clauses associated with OMP_TASK GS. */ + +static inline tree +gimple_omp_taskreg_clauses (const gimple *gs) +{ + const gimple_statement_omp_taskreg *omp_taskreg_stmt + = as_a (gs); + return omp_taskreg_stmt->clauses; +} + + +/* Return a pointer to the clauses associated with OMP_TASK GS. */ + +static inline tree * +gimple_omp_taskreg_clauses_ptr (gimple *gs) +{ + gimple_statement_omp_taskreg *omp_taskreg_stmt + = as_a (gs); + return &omp_taskreg_stmt->clauses; +} + + +/* Set CLAUSES to be the list of clauses associated with OMP_TASK + GS. */ + +static inline void +gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses) +{ + gimple_statement_omp_taskreg *omp_taskreg_stmt + = as_a (gs); + omp_taskreg_stmt->clauses = clauses; +} + + +/* Return the child function used to hold the body of OMP_TASK GS. */ + +static inline tree +gimple_omp_taskreg_child_fn (const gimple *gs) +{ + const gimple_statement_omp_taskreg *omp_taskreg_stmt + = as_a (gs); + return omp_taskreg_stmt->child_fn; +} + +/* Return a pointer to the child function used to hold the body of + OMP_TASK GS. */ + +static inline tree * +gimple_omp_taskreg_child_fn_ptr (gimple *gs) +{ + gimple_statement_omp_taskreg *omp_taskreg_stmt + = as_a (gs); + return &omp_taskreg_stmt->child_fn; +} + + +/* Set CHILD_FN to be the child function for OMP_TASK GS. */ + +static inline void +gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn) +{ + gimple_statement_omp_taskreg *omp_taskreg_stmt + = as_a (gs); + omp_taskreg_stmt->child_fn = child_fn; +} + + +/* Return the artificial argument used to send variables and values + from the parent to the children threads in OMP_TASK GS. */ + +static inline tree +gimple_omp_taskreg_data_arg (const gimple *gs) +{ + const gimple_statement_omp_taskreg *omp_taskreg_stmt + = as_a (gs); + return omp_taskreg_stmt->data_arg; +} + + +/* Return a pointer to the data argument for OMP_TASK GS. */ + +static inline tree * +gimple_omp_taskreg_data_arg_ptr (gimple *gs) +{ + gimple_statement_omp_taskreg *omp_taskreg_stmt + = as_a (gs); + return &omp_taskreg_stmt->data_arg; +} + + +/* Set DATA_ARG to be the data argument for OMP_TASK GS. */ + +static inline void +gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg) +{ + gimple_statement_omp_taskreg *omp_taskreg_stmt + = as_a (gs); + omp_taskreg_stmt->data_arg = data_arg; +} + + +/* Return the copy function used to hold the body of OMP_TASK GS. */ + +static inline tree +gimple_omp_task_copy_fn (const gimple *gs) +{ + const gomp_task *omp_task_stmt = as_a (gs); + return omp_task_stmt->copy_fn; +} + +/* Return a pointer to the copy function used to hold the body of + OMP_TASK GS. */ + +static inline tree * +gimple_omp_task_copy_fn_ptr (gimple *gs) +{ + gomp_task *omp_task_stmt = as_a (gs); + return &omp_task_stmt->copy_fn; +} + + +/* Set CHILD_FN to be the copy function for OMP_TASK GS. */ + +static inline void +gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn) +{ + gomp_task *omp_task_stmt = as_a (gs); + omp_task_stmt->copy_fn = copy_fn; +} + + +/* Return size of the data block in bytes in OMP_TASK GS. */ + +static inline tree +gimple_omp_task_arg_size (const gimple *gs) +{ + const gomp_task *omp_task_stmt = as_a (gs); + return omp_task_stmt->arg_size; +} + + +/* Return a pointer to the data block size for OMP_TASK GS. */ + +static inline tree * +gimple_omp_task_arg_size_ptr (gimple *gs) +{ + gomp_task *omp_task_stmt = as_a (gs); + return &omp_task_stmt->arg_size; +} + + +/* Set ARG_SIZE to be the data block size for OMP_TASK GS. */ + +static inline void +gimple_omp_task_set_arg_size (gimple *gs, tree arg_size) +{ + gomp_task *omp_task_stmt = as_a (gs); + omp_task_stmt->arg_size = arg_size; +} + + +/* Return align of the data block in bytes in OMP_TASK GS. */ + +static inline tree +gimple_omp_task_arg_align (const gimple *gs) +{ + const gomp_task *omp_task_stmt = as_a (gs); + return omp_task_stmt->arg_align; +} + + +/* Return a pointer to the data block align for OMP_TASK GS. */ + +static inline tree * +gimple_omp_task_arg_align_ptr (gimple *gs) +{ + gomp_task *omp_task_stmt = as_a (gs); + return &omp_task_stmt->arg_align; +} + + +/* Set ARG_SIZE to be the data block align for OMP_TASK GS. */ + +static inline void +gimple_omp_task_set_arg_align (gimple *gs, tree arg_align) +{ + gomp_task *omp_task_stmt = as_a (gs); + omp_task_stmt->arg_align = arg_align; +} + + +/* Return the clauses associated with OMP_SINGLE GS. */ + +static inline tree +gimple_omp_single_clauses (const gimple *gs) +{ + const gomp_single *omp_single_stmt = as_a (gs); + return omp_single_stmt->clauses; +} + + +/* Return a pointer to the clauses associated with OMP_SINGLE GS. */ + +static inline tree * +gimple_omp_single_clauses_ptr (gimple *gs) +{ + gomp_single *omp_single_stmt = as_a (gs); + return &omp_single_stmt->clauses; +} + + +/* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */ + +static inline void +gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses) +{ + omp_single_stmt->clauses = clauses; +} + + +/* Return the clauses associated with OMP_TARGET GS. */ + +static inline tree +gimple_omp_target_clauses (const gimple *gs) +{ + const gomp_target *omp_target_stmt = as_a (gs); + return omp_target_stmt->clauses; +} + + +/* Return a pointer to the clauses associated with OMP_TARGET GS. */ + +static inline tree * +gimple_omp_target_clauses_ptr (gimple *gs) +{ + gomp_target *omp_target_stmt = as_a (gs); + return &omp_target_stmt->clauses; +} + + +/* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */ + +static inline void +gimple_omp_target_set_clauses (gomp_target *omp_target_stmt, + tree clauses) +{ + omp_target_stmt->clauses = clauses; +} + + +/* Return the kind of the OMP_TARGET G. */ + +static inline int +gimple_omp_target_kind (const gimple *g) +{ + GIMPLE_CHECK (g, GIMPLE_OMP_TARGET); + return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK); +} + + +/* Set the kind of the OMP_TARGET G. */ + +static inline void +gimple_omp_target_set_kind (gomp_target *g, int kind) +{ + g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK) + | (kind & GF_OMP_TARGET_KIND_MASK); +} + + +/* Return the child function used to hold the body of OMP_TARGET_STMT. */ + +static inline tree +gimple_omp_target_child_fn (const gomp_target *omp_target_stmt) +{ + return omp_target_stmt->child_fn; +} + +/* Return a pointer to the child function used to hold the body of + OMP_TARGET_STMT. */ + +static inline tree * +gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt) +{ + return &omp_target_stmt->child_fn; +} + + +/* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */ + +static inline void +gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt, + tree child_fn) +{ + omp_target_stmt->child_fn = child_fn; +} + + +/* Return the artificial argument used to send variables and values + from the parent to the children threads in OMP_TARGET_STMT. */ + +static inline tree +gimple_omp_target_data_arg (const gomp_target *omp_target_stmt) +{ + return omp_target_stmt->data_arg; +} + + +/* Return a pointer to the data argument for OMP_TARGET GS. */ + +static inline tree * +gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt) +{ + return &omp_target_stmt->data_arg; +} + + +/* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */ + +static inline void +gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt, + tree data_arg) +{ + omp_target_stmt->data_arg = data_arg; +} + + +/* Return the clauses associated with OMP_TEAMS GS. */ + +static inline tree +gimple_omp_teams_clauses (const gimple *gs) +{ + const gomp_teams *omp_teams_stmt = as_a (gs); + return omp_teams_stmt->clauses; +} + + +/* Return a pointer to the clauses associated with OMP_TEAMS GS. */ + +static inline tree * +gimple_omp_teams_clauses_ptr (gimple *gs) +{ + gomp_teams *omp_teams_stmt = as_a (gs); + return &omp_teams_stmt->clauses; +} + + +/* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */ + +static inline void +gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses) +{ + omp_teams_stmt->clauses = clauses; +} + +/* Return the kernel_phony flag of an OMP_TEAMS_STMT. */ + +static inline bool +gimple_omp_teams_grid_phony (const gomp_teams *omp_teams_stmt) +{ + return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_GRID_PHONY) != 0; +} + +/* Set kernel_phony flag of an OMP_TEAMS_STMT to VALUE. */ + +static inline void +gimple_omp_teams_set_grid_phony (gomp_teams *omp_teams_stmt, bool value) +{ + if (value) + omp_teams_stmt->subcode |= GF_OMP_TEAMS_GRID_PHONY; + else + omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_GRID_PHONY; +} + +/* Return the clauses associated with OMP_SECTIONS GS. */ + +static inline tree +gimple_omp_sections_clauses (const gimple *gs) +{ + const gomp_sections *omp_sections_stmt = as_a (gs); + return omp_sections_stmt->clauses; +} + + +/* Return a pointer to the clauses associated with OMP_SECTIONS GS. */ + +static inline tree * +gimple_omp_sections_clauses_ptr (gimple *gs) +{ + gomp_sections *omp_sections_stmt = as_a (gs); + return &omp_sections_stmt->clauses; +} + + +/* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS + GS. */ + +static inline void +gimple_omp_sections_set_clauses (gimple *gs, tree clauses) +{ + gomp_sections *omp_sections_stmt = as_a (gs); + omp_sections_stmt->clauses = clauses; +} + + +/* Return the control variable associated with the GIMPLE_OMP_SECTIONS + in GS. */ + +static inline tree +gimple_omp_sections_control (const gimple *gs) +{ + const gomp_sections *omp_sections_stmt = as_a (gs); + return omp_sections_stmt->control; +} + + +/* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS + GS. */ + +static inline tree * +gimple_omp_sections_control_ptr (gimple *gs) +{ + gomp_sections *omp_sections_stmt = as_a (gs); + return &omp_sections_stmt->control; +} + + +/* Set CONTROL to be the set of clauses associated with the + GIMPLE_OMP_SECTIONS in GS. */ + +static inline void +gimple_omp_sections_set_control (gimple *gs, tree control) +{ + gomp_sections *omp_sections_stmt = as_a (gs); + omp_sections_stmt->control = control; +} + + +/* Set the value being stored in an atomic store. */ + +static inline void +gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val) +{ + store_stmt->val = val; +} + + +/* Return the value being stored in an atomic store. */ + +static inline tree +gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt) +{ + return store_stmt->val; +} + + +/* Return a pointer to the value being stored in an atomic store. */ + +static inline tree * +gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt) +{ + return &store_stmt->val; +} + + +/* Set the LHS of an atomic load. */ + +static inline void +gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs) +{ + load_stmt->lhs = lhs; +} + + +/* Get the LHS of an atomic load. */ + +static inline tree +gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt) +{ + return load_stmt->lhs; +} + + +/* Return a pointer to the LHS of an atomic load. */ + +static inline tree * +gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt) +{ + return &load_stmt->lhs; +} + + +/* Set the RHS of an atomic load. */ + +static inline void +gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs) +{ + load_stmt->rhs = rhs; +} + + +/* Get the RHS of an atomic load. */ + +static inline tree +gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt) +{ + return load_stmt->rhs; +} + + +/* Return a pointer to the RHS of an atomic load. */ + +static inline tree * +gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt) +{ + return &load_stmt->rhs; +} + + +/* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */ + +static inline tree +gimple_omp_continue_control_def (const gomp_continue *cont_stmt) +{ + return cont_stmt->control_def; +} + +/* The same as above, but return the address. */ + +static inline tree * +gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt) +{ + return &cont_stmt->control_def; +} + +/* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */ + +static inline void +gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def) +{ + cont_stmt->control_def = def; +} + + +/* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */ + +static inline tree +gimple_omp_continue_control_use (const gomp_continue *cont_stmt) +{ + return cont_stmt->control_use; +} + + +/* The same as above, but return the address. */ + +static inline tree * +gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt) +{ + return &cont_stmt->control_use; +} + + +/* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */ + +static inline void +gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use) +{ + cont_stmt->control_use = use; +} + +/* Return a pointer to the body for the GIMPLE_TRANSACTION statement + TRANSACTION_STMT. */ + +static inline gimple_seq * +gimple_transaction_body_ptr (gtransaction *transaction_stmt) +{ + return &transaction_stmt->body; +} + +/* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */ + +static inline gimple_seq +gimple_transaction_body (gtransaction *transaction_stmt) +{ + return transaction_stmt->body; +} + +/* Return the label associated with a GIMPLE_TRANSACTION. */ + +static inline tree +gimple_transaction_label_norm (const gtransaction *transaction_stmt) +{ + return transaction_stmt->label_norm; +} + +static inline tree * +gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt) +{ + return &transaction_stmt->label_norm; +} + +static inline tree +gimple_transaction_label_uninst (const gtransaction *transaction_stmt) +{ + return transaction_stmt->label_uninst; +} + +static inline tree * +gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt) +{ + return &transaction_stmt->label_uninst; +} + +static inline tree +gimple_transaction_label_over (const gtransaction *transaction_stmt) +{ + return transaction_stmt->label_over; +} + +static inline tree * +gimple_transaction_label_over_ptr (gtransaction *transaction_stmt) +{ + return &transaction_stmt->label_over; +} + +/* Return the subcode associated with a GIMPLE_TRANSACTION. */ + +static inline unsigned int +gimple_transaction_subcode (const gtransaction *transaction_stmt) +{ + return transaction_stmt->subcode; +} + +/* Set BODY to be the body for the GIMPLE_TRANSACTION statement + TRANSACTION_STMT. */ + +static inline void +gimple_transaction_set_body (gtransaction *transaction_stmt, + gimple_seq body) +{ + transaction_stmt->body = body; +} + +/* Set the label associated with a GIMPLE_TRANSACTION. */ + +static inline void +gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label) +{ + transaction_stmt->label_norm = label; +} + +static inline void +gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label) +{ + transaction_stmt->label_uninst = label; +} + +static inline void +gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label) +{ + transaction_stmt->label_over = label; +} + +/* Set the subcode associated with a GIMPLE_TRANSACTION. */ + +static inline void +gimple_transaction_set_subcode (gtransaction *transaction_stmt, + unsigned int subcode) +{ + transaction_stmt->subcode = subcode; +} + +/* Return a pointer to the return value for GIMPLE_RETURN GS. */ + +static inline tree * +gimple_return_retval_ptr (greturn *gs) +{ + return &gs->op[0]; +} + +/* Return the return value for GIMPLE_RETURN GS. */ + +static inline tree +gimple_return_retval (const greturn *gs) +{ + return gs->op[0]; +} + + +/* Set RETVAL to be the return value for GIMPLE_RETURN GS. */ + +static inline void +gimple_return_set_retval (greturn *gs, tree retval) +{ + gs->op[0] = retval; +} + + +/* Return the return bounds for GIMPLE_RETURN GS. */ + +static inline tree +gimple_return_retbnd (const gimple *gs) +{ + GIMPLE_CHECK (gs, GIMPLE_RETURN); + return gimple_op (gs, 1); +} + + +/* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */ + +static inline void +gimple_return_set_retbnd (gimple *gs, tree retval) +{ + GIMPLE_CHECK (gs, GIMPLE_RETURN); + gimple_set_op (gs, 1, retval); +} + + +/* Returns true when the gimple statement STMT is any of the OMP types. */ + +#define CASE_GIMPLE_OMP \ + case GIMPLE_OMP_PARALLEL: \ + case GIMPLE_OMP_TASK: \ + case GIMPLE_OMP_FOR: \ + case GIMPLE_OMP_SECTIONS: \ + case GIMPLE_OMP_SECTIONS_SWITCH: \ + case GIMPLE_OMP_SINGLE: \ + case GIMPLE_OMP_TARGET: \ + case GIMPLE_OMP_TEAMS: \ + case GIMPLE_OMP_SECTION: \ + case GIMPLE_OMP_MASTER: \ + case GIMPLE_OMP_TASKGROUP: \ + case GIMPLE_OMP_ORDERED: \ + case GIMPLE_OMP_CRITICAL: \ + case GIMPLE_OMP_RETURN: \ + case GIMPLE_OMP_ATOMIC_LOAD: \ + case GIMPLE_OMP_ATOMIC_STORE: \ + case GIMPLE_OMP_CONTINUE: \ + case GIMPLE_OMP_GRID_BODY + +static inline bool +is_gimple_omp (const gimple *stmt) +{ + switch (gimple_code (stmt)) + { + CASE_GIMPLE_OMP: + return true; + default: + return false; + } +} + +/* Return true if the OMP gimple statement STMT is any of the OpenACC types + specifically. */ + +static inline bool +is_gimple_omp_oacc (const gimple *stmt) +{ + gcc_assert (is_gimple_omp (stmt)); + switch (gimple_code (stmt)) + { + case GIMPLE_OMP_FOR: + switch (gimple_omp_for_kind (stmt)) + { + case GF_OMP_FOR_KIND_OACC_LOOP: + return true; + default: + return false; + } + case GIMPLE_OMP_TARGET: + switch (gimple_omp_target_kind (stmt)) + { + case GF_OMP_TARGET_KIND_OACC_PARALLEL: + case GF_OMP_TARGET_KIND_OACC_KERNELS: + case GF_OMP_TARGET_KIND_OACC_DATA: + case GF_OMP_TARGET_KIND_OACC_UPDATE: + case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA: + case GF_OMP_TARGET_KIND_OACC_DECLARE: + case GF_OMP_TARGET_KIND_OACC_HOST_DATA: + return true; + default: + return false; + } + default: + return false; + } +} + + +/* Return true if the OMP gimple statement STMT is offloaded. */ + +static inline bool +is_gimple_omp_offloaded (const gimple *stmt) +{ + gcc_assert (is_gimple_omp (stmt)); + switch (gimple_code (stmt)) + { + case GIMPLE_OMP_TARGET: + switch (gimple_omp_target_kind (stmt)) + { + case GF_OMP_TARGET_KIND_REGION: + case GF_OMP_TARGET_KIND_OACC_PARALLEL: + case GF_OMP_TARGET_KIND_OACC_KERNELS: + return true; + default: + return false; + } + default: + return false; + } +} + + +/* Returns TRUE if statement G is a GIMPLE_NOP. */ + +static inline bool +gimple_nop_p (const gimple *g) +{ + return gimple_code (g) == GIMPLE_NOP; +} + + +/* Return true if GS is a GIMPLE_RESX. */ + +static inline bool +is_gimple_resx (const gimple *gs) +{ + return gimple_code (gs) == GIMPLE_RESX; +} + +/* Return the type of the main expression computed by STMT. Return + void_type_node if the statement computes nothing. */ + +static inline tree +gimple_expr_type (const gimple *stmt) +{ + enum gimple_code code = gimple_code (stmt); + /* In general we want to pass out a type that can be substituted + for both the RHS and the LHS types if there is a possibly + useless conversion involved. That means returning the + original RHS type as far as we can reconstruct it. */ + if (code == GIMPLE_CALL) + { + const gcall *call_stmt = as_a (stmt); + if (gimple_call_internal_p (call_stmt) + && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE) + return TREE_TYPE (gimple_call_arg (call_stmt, 3)); + else + return gimple_call_return_type (call_stmt); + } + else if (code == GIMPLE_ASSIGN) + { + if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR) + return TREE_TYPE (gimple_assign_rhs1 (stmt)); + else + /* As fallback use the type of the LHS. */ + return TREE_TYPE (gimple_get_lhs (stmt)); + } + else if (code == GIMPLE_COND) + return boolean_type_node; + else + return void_type_node; +} + +/* Enum and arrays used for allocation stats. Keep in sync with + gimple.c:gimple_alloc_kind_names. */ +enum gimple_alloc_kind +{ + gimple_alloc_kind_assign, /* Assignments. */ + gimple_alloc_kind_phi, /* PHI nodes. */ + gimple_alloc_kind_cond, /* Conditionals. */ + gimple_alloc_kind_rest, /* Everything else. */ + gimple_alloc_kind_all +}; + +extern int gimple_alloc_counts[]; +extern int gimple_alloc_sizes[]; + +/* Return the allocation kind for a given stmt CODE. */ +static inline enum gimple_alloc_kind +gimple_alloc_kind (enum gimple_code code) +{ + switch (code) + { + case GIMPLE_ASSIGN: + return gimple_alloc_kind_assign; + case GIMPLE_PHI: + return gimple_alloc_kind_phi; + case GIMPLE_COND: + return gimple_alloc_kind_cond; + default: + return gimple_alloc_kind_rest; + } +} + +/* Return true if a location should not be emitted for this statement + by annotate_all_with_location. */ + +static inline bool +gimple_do_not_emit_location_p (gimple *g) +{ + return gimple_plf (g, GF_PLF_1); +} + +/* Mark statement G so a location will not be emitted by + annotate_one_with_location. */ + +static inline void +gimple_set_do_not_emit_location (gimple *g) +{ + /* The PLF flags are initialized to 0 when a new tuple is created, + so no need to initialize it anywhere. */ + gimple_set_plf (g, GF_PLF_1, true); +} + + +/* Macros for showing usage statistics. */ +#define SCALE(x) ((unsigned long) ((x) < 1024*10 \ + ? (x) \ + : ((x) < 1024*1024*10 \ + ? (x) / 1024 \ + : (x) / (1024*1024)))) + +#define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M')) + +#endif /* GCC_GIMPLE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimplify-me.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimplify-me.h new file mode 100644 index 0000000..7f5f487 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimplify-me.h @@ -0,0 +1,37 @@ +/* Header file for middle end gimplification. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GIMPLIFY_ME_H +#define GCC_GIMPLIFY_ME_H + +/* Validation of GIMPLE expressions. Note that these predicates only check + * the basic form of the expression, they don't recurse to make sure that + * underlying nodes are also of the right form. */ +typedef bool (*gimple_predicate)(tree); + +extern tree force_gimple_operand_1 (tree, gimple_seq *, gimple_predicate, tree); +extern tree force_gimple_operand (tree, gimple_seq *, bool, tree); +extern tree force_gimple_operand_gsi_1 (gimple_stmt_iterator *, tree, + gimple_predicate, tree, + bool, enum gsi_iterator_update); +extern tree force_gimple_operand_gsi (gimple_stmt_iterator *, tree, bool, tree, + bool, enum gsi_iterator_update); +extern void gimple_regimplify_operands (gimple *, gimple_stmt_iterator *); + +#endif /* GCC_GIMPLIFY_ME_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimplify.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimplify.h new file mode 100644 index 0000000..394d385 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gimplify.h @@ -0,0 +1,107 @@ +/* Header file for gimplification. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GIMPLIFY_H +#define GCC_GIMPLIFY_H + +/* Validation of GIMPLE expressions. Note that these predicates only check + the basic form of the expression, they don't recurse to make sure that + underlying nodes are also of the right form. */ +typedef bool (*gimple_predicate)(tree); + +/* FIXME we should deduce this from the predicate. */ +enum fallback { + fb_none = 0, /* Do not generate a temporary. */ + + fb_rvalue = 1, /* Generate an rvalue to hold the result of a + gimplified expression. */ + + fb_lvalue = 2, /* Generate an lvalue to hold the result of a + gimplified expression. */ + + fb_mayfail = 4, /* Gimplification may fail. Error issued + afterwards. */ + fb_either= fb_rvalue | fb_lvalue +}; + +typedef int fallback_t; + +enum gimplify_status { + GS_ERROR = -2, /* Something Bad Seen. */ + GS_UNHANDLED = -1, /* A langhook result for "I dunno". */ + GS_OK = 0, /* We did something, maybe more to do. */ + GS_ALL_DONE = 1 /* The expression is fully gimplified. */ +}; + +extern void free_gimplify_stack (void); +extern void push_gimplify_context (bool in_ssa = false, + bool rhs_cond_ok = false); +extern void pop_gimplify_context (gimple *); +extern gbind *gimple_current_bind_expr (void); +extern vec gimple_bind_expr_stack (void); +extern void gimplify_and_add (tree, gimple_seq *); +extern tree get_formal_tmp_var (tree, gimple_seq *); +extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *, + bool = true); +extern void declare_vars (tree, gimple *, bool); +extern void gimple_add_tmp_var (tree); +extern void gimple_add_tmp_var_fn (struct function *, tree); +extern tree unshare_expr (tree); +extern tree unshare_expr_without_location (tree); +extern tree voidify_wrapper_expr (tree, tree); +extern tree build_and_jump (tree *); +extern enum gimplify_status gimplify_self_mod_expr (tree *, gimple_seq *, + gimple_seq *, bool, tree); +extern tree gimple_boolify (tree); +extern gimple_predicate rhs_predicate_for (tree); +extern bool gimplify_stmt (tree *, gimple_seq *); +extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree); +extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *, + bool (*) (tree), fallback_t); + +extern void gimplify_type_sizes (tree, gimple_seq *); +extern void gimplify_one_sizepos (tree *, gimple_seq *); +extern gbind *gimplify_body (tree, bool); +extern enum gimplify_status gimplify_arg (tree *, gimple_seq *, location_t, + bool = true); +extern void gimplify_function_tree (tree); +extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *, + gimple_seq *); +gimple *gimplify_assign (tree, tree, gimple_seq *); + +/* Return true if gimplify_one_sizepos doesn't need to gimplify + expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize + fields). */ + +static inline bool +is_gimple_sizepos (tree expr) +{ + /* gimplify_one_sizepos doesn't need to do anything if the value isn't there, + is constant, or contains A PLACEHOLDER_EXPR. We also don't want to do + anything if it's already a VAR_DECL. If it's a VAR_DECL from another + function, the gimplifier will want to replace it with a new variable, + but that will cause problems if this type is from outside the function. + It's OK to have that here. */ + return (expr == NULL_TREE + || TREE_CODE (expr) == INTEGER_CST + || TREE_CODE (expr) == VAR_DECL + || CONTAINS_PLACEHOLDER_P (expr)); +} + +#endif /* GCC_GIMPLIFY_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/glimits.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/glimits.h new file mode 100644 index 0000000..3bc3626 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/glimits.h @@ -0,0 +1,152 @@ +/* Copyright (C) 1991-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +#ifndef _LIMITS_H___ +#define _LIMITS_H___ + +/* Number of bits in a `char'. */ +#undef CHAR_BIT +#define CHAR_BIT __CHAR_BIT__ + +/* Maximum length of a multibyte character. */ +#ifndef MB_LEN_MAX +#define MB_LEN_MAX 1 +#endif + +/* Minimum and maximum values a `signed char' can hold. */ +#undef SCHAR_MIN +#define SCHAR_MIN (-SCHAR_MAX - 1) +#undef SCHAR_MAX +#define SCHAR_MAX __SCHAR_MAX__ + +/* Maximum value an `unsigned char' can hold. (Minimum is 0). */ +#undef UCHAR_MAX +#if __SCHAR_MAX__ == __INT_MAX__ +# define UCHAR_MAX (SCHAR_MAX * 2U + 1U) +#else +# define UCHAR_MAX (SCHAR_MAX * 2 + 1) +#endif + +/* Minimum and maximum values a `char' can hold. */ +#ifdef __CHAR_UNSIGNED__ +# undef CHAR_MIN +# if __SCHAR_MAX__ == __INT_MAX__ +# define CHAR_MIN 0U +# else +# define CHAR_MIN 0 +# endif +# undef CHAR_MAX +# define CHAR_MAX UCHAR_MAX +#else +# undef CHAR_MIN +# define CHAR_MIN SCHAR_MIN +# undef CHAR_MAX +# define CHAR_MAX SCHAR_MAX +#endif + +/* Minimum and maximum values a `signed short int' can hold. */ +#undef SHRT_MIN +#define SHRT_MIN (-SHRT_MAX - 1) +#undef SHRT_MAX +#define SHRT_MAX __SHRT_MAX__ + +/* Maximum value an `unsigned short int' can hold. (Minimum is 0). */ +#undef USHRT_MAX +#if __SHRT_MAX__ == __INT_MAX__ +# define USHRT_MAX (SHRT_MAX * 2U + 1U) +#else +# define USHRT_MAX (SHRT_MAX * 2 + 1) +#endif + +/* Minimum and maximum values a `signed int' can hold. */ +#undef INT_MIN +#define INT_MIN (-INT_MAX - 1) +#undef INT_MAX +#define INT_MAX __INT_MAX__ + +/* Maximum value an `unsigned int' can hold. (Minimum is 0). */ +#undef UINT_MAX +#define UINT_MAX (INT_MAX * 2U + 1U) + +/* Minimum and maximum values a `signed long int' can hold. + (Same as `int'). */ +#undef LONG_MIN +#define LONG_MIN (-LONG_MAX - 1L) +#undef LONG_MAX +#define LONG_MAX __LONG_MAX__ + +/* Maximum value an `unsigned long int' can hold. (Minimum is 0). */ +#undef ULONG_MAX +#define ULONG_MAX (LONG_MAX * 2UL + 1UL) + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +/* Minimum and maximum values a `signed long long int' can hold. */ +# undef LLONG_MIN +# define LLONG_MIN (-LLONG_MAX - 1LL) +# undef LLONG_MAX +# define LLONG_MAX __LONG_LONG_MAX__ + +/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */ +# undef ULLONG_MAX +# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) +#endif + +#if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__) +/* Minimum and maximum values a `signed long long int' can hold. */ +# undef LONG_LONG_MIN +# define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL) +# undef LONG_LONG_MAX +# define LONG_LONG_MAX __LONG_LONG_MAX__ + +/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */ +# undef ULONG_LONG_MAX +# define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1ULL) +#endif + +#ifdef __STDC_WANT_IEC_60559_BFP_EXT__ +/* TS 18661-1 widths of integer types. */ +# undef CHAR_WIDTH +# define CHAR_WIDTH __SCHAR_WIDTH__ +# undef SCHAR_WIDTH +# define SCHAR_WIDTH __SCHAR_WIDTH__ +# undef UCHAR_WIDTH +# define UCHAR_WIDTH __SCHAR_WIDTH__ +# undef SHRT_WIDTH +# define SHRT_WIDTH __SHRT_WIDTH__ +# undef USHRT_WIDTH +# define USHRT_WIDTH __SHRT_WIDTH__ +# undef INT_WIDTH +# define INT_WIDTH __INT_WIDTH__ +# undef UINT_WIDTH +# define UINT_WIDTH __INT_WIDTH__ +# undef LONG_WIDTH +# define LONG_WIDTH __LONG_WIDTH__ +# undef ULONG_WIDTH +# define ULONG_WIDTH __LONG_WIDTH__ +# undef LLONG_WIDTH +# define LLONG_WIDTH __LONG_LONG_WIDTH__ +# undef ULLONG_WIDTH +# define ULLONG_WIDTH __LONG_LONG_WIDTH__ +#endif + +#endif /* _LIMITS_H___ */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/graph.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/graph.h new file mode 100644 index 0000000..4db253f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/graph.h @@ -0,0 +1,27 @@ +/* Header file for graph routines. + Copyright (C) 1999-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GRAPH_H +#define GCC_GRAPH_H + +extern void print_graph_cfg (const char *, struct function *); +extern void clean_graph_dump_file (const char *); +extern void finish_graph_dump_file (const char *); + +#endif /* ! GCC_GRAPH_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/graphds.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/graphds.h new file mode 100644 index 0000000..500ea70 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/graphds.h @@ -0,0 +1,66 @@ +/* Graph representation. + Copyright (C) 2007-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GRAPHDS_H +#define GCC_GRAPHDS_H + +/* Structure representing edge of a graph. */ + +struct graph_edge +{ + int src, dest; /* Source and destination. */ + struct graph_edge *pred_next, *succ_next; + /* Next edge in predecessor and successor lists. */ + void *data; /* Data attached to the edge. */ +}; + +/* Structure representing vertex of a graph. */ + +struct vertex +{ + struct graph_edge *pred, *succ; + /* Lists of predecessors and successors. */ + int component; /* Number of dfs restarts before reaching the + vertex. */ + int post; /* Postorder number. */ + void *data; /* Data attached to the vertex. */ +}; + +/* Structure representing a graph. */ + +struct graph +{ + int n_vertices; /* Number of vertices. */ + struct vertex *vertices; /* The vertices. */ + struct obstack ob; /* Obstack for vertex and edge allocation. */ +}; + +struct graph *new_graph (int); +void dump_graph (FILE *, struct graph *); +struct graph_edge *add_edge (struct graph *, int, int); +void identify_vertices (struct graph *, int, int); +int graphds_dfs (struct graph *, int *, int, + vec *, bool, bitmap); +int graphds_scc (struct graph *, bitmap); +void graphds_domtree (struct graph *, int, int *, int *, int *); +typedef void (*graphds_edge_callback) (struct graph *, struct graph_edge *); +void for_each_edge (struct graph *, graphds_edge_callback); +void free_graph (struct graph *g); + +#endif /* GCC_GRAPHDS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/graphite.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/graphite.h new file mode 100644 index 0000000..d22c4f2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/graphite.h @@ -0,0 +1,462 @@ +/* Graphite polyhedral representation. + Copyright (C) 2009-2017 Free Software Foundation, Inc. + Contributed by Sebastian Pop and + Tobias Grosser . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GRAPHITE_POLY_H +#define GCC_GRAPHITE_POLY_H + +#include "sese.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +typedef struct poly_dr *poly_dr_p; + +typedef struct poly_bb *poly_bb_p; + +typedef struct scop *scop_p; + +typedef unsigned graphite_dim_t; + +static inline graphite_dim_t scop_nb_params (scop_p); + +/* A data reference can write or read some memory or we + just know it may write some memory. */ +enum poly_dr_type +{ + PDR_READ, + /* PDR_MAY_READs are represented using PDR_READS. This does not + limit the expressiveness. */ + PDR_WRITE, + PDR_MAY_WRITE +}; + +struct poly_dr +{ + /* An identifier for this PDR. */ + int id; + + /* The number of data refs identical to this one in the PBB. */ + int nb_refs; + + /* A pointer to the gimple stmt containing this reference. */ + gimple *stmt; + + /* A pointer to the PBB that contains this data reference. */ + poly_bb_p pbb; + + enum poly_dr_type type; + + /* The access polyhedron contains the polyhedral space this data + reference will access. + + The polyhedron contains these dimensions: + + - The alias set (a): + Every memory access is classified in at least one alias set. + + - The subscripts (s_0, ..., s_n): + The memory is accessed using zero or more subscript dimensions. + + - The iteration domain (variables and parameters) + + Do not hardcode the dimensions. Use the following accessor functions: + - pdr_alias_set_dim + - pdr_subscript_dim + - pdr_iterator_dim + - pdr_parameter_dim + + Example: + + | int A[1335][123]; + | int *p = malloc (); + | + | k = ... + | for i + | { + | if (unknown_function ()) + | p = A; + | ... = p[?][?]; + | for j + | A[i][j+k] = m; + | } + + The data access A[i][j+k] in alias set "5" is described like this: + + | i j k a s0 s1 1 + | 0 0 0 1 0 0 -5 = 0 + |-1 0 0 0 1 0 0 = 0 + | 0 -1 -1 0 0 1 0 = 0 + | 0 0 0 0 1 0 0 >= 0 # The last four lines describe the + | 0 0 0 0 0 1 0 >= 0 # array size. + | 0 0 0 0 -1 0 1335 >= 0 + | 0 0 0 0 0 -1 123 >= 0 + + The pointer "*p" in alias set "5" and "7" is described as a union of + polyhedron: + + + | i k a s0 1 + | 0 0 1 0 -5 = 0 + | 0 0 0 1 0 >= 0 + + "or" + + | i k a s0 1 + | 0 0 1 0 -7 = 0 + | 0 0 0 1 0 >= 0 + + "*p" accesses all of the object allocated with 'malloc'. + + The scalar data access "m" is represented as an array with zero subscript + dimensions. + + | i j k a 1 + | 0 0 0 -1 15 = 0 + + The difference between the graphite internal format for access data and + the OpenSop format is in the order of columns. + Instead of having: + + | i j k a s0 s1 1 + | 0 0 0 1 0 0 -5 = 0 + |-1 0 0 0 1 0 0 = 0 + | 0 -1 -1 0 0 1 0 = 0 + | 0 0 0 0 1 0 0 >= 0 # The last four lines describe the + | 0 0 0 0 0 1 0 >= 0 # array size. + | 0 0 0 0 -1 0 1335 >= 0 + | 0 0 0 0 0 -1 123 >= 0 + + In OpenScop we have: + + | a s0 s1 i j k 1 + | 1 0 0 0 0 0 -5 = 0 + | 0 1 0 -1 0 0 0 = 0 + | 0 0 1 0 -1 -1 0 = 0 + | 0 1 0 0 0 0 0 >= 0 # The last four lines describe the + | 0 0 1 0 0 0 0 >= 0 # array size. + | 0 -1 0 0 0 0 1335 >= 0 + | 0 0 -1 0 0 0 123 >= 0 + + The OpenScop access function is printed as follows: + + | 1 # The number of disjunct components in a union of access functions. + | R C O I L P # Described bellow. + | a s0 s1 i j k 1 + | 1 0 0 0 0 0 -5 = 0 + | 0 1 0 -1 0 0 0 = 0 + | 0 0 1 0 -1 -1 0 = 0 + | 0 1 0 0 0 0 0 >= 0 # The last four lines describe the + | 0 0 1 0 0 0 0 >= 0 # array size. + | 0 -1 0 0 0 0 1335 >= 0 + | 0 0 -1 0 0 0 123 >= 0 + + Where: + - R: Number of rows. + - C: Number of columns. + - O: Number of output dimensions = alias set + number of subscripts. + - I: Number of input dimensions (iterators). + - L: Number of local (existentially quantified) dimensions. + - P: Number of parameters. + + In the example, the vector "R C O I L P" is "7 7 3 2 0 1". */ + isl_map *accesses; + isl_set *subscript_sizes; +}; + +#define PDR_ID(PDR) (PDR->id) +#define PDR_NB_REFS(PDR) (PDR->nb_refs) +#define PDR_PBB(PDR) (PDR->pbb) +#define PDR_TYPE(PDR) (PDR->type) +#define PDR_ACCESSES(PDR) (NULL) + +void new_poly_dr (poly_bb_p, gimple *, enum poly_dr_type, + isl_map *, isl_set *); +void debug_pdr (poly_dr_p); +void print_pdr (FILE *, poly_dr_p); + +static inline bool +pdr_read_p (poly_dr_p pdr) +{ + return PDR_TYPE (pdr) == PDR_READ; +} + +/* Returns true when PDR is a "write". */ + +static inline bool +pdr_write_p (poly_dr_p pdr) +{ + return PDR_TYPE (pdr) == PDR_WRITE; +} + +/* Returns true when PDR is a "may write". */ + +static inline bool +pdr_may_write_p (poly_dr_p pdr) +{ + return PDR_TYPE (pdr) == PDR_MAY_WRITE; +} + +/* POLY_BB represents a blackbox in the polyhedral model. */ + +struct poly_bb +{ + /* Pointer to a basic block or a statement in the compiler. */ + gimple_poly_bb_p black_box; + + /* Pointer to the SCOP containing this PBB. */ + scop_p scop; + + /* The iteration domain of this bb. The layout of this polyhedron + is I|G with I the iteration domain, G the context parameters. + + Example: + + for (i = a - 7*b + 8; i <= 3*a + 13*b + 20; i++) + for (j = 2; j <= 2*i + 5; j++) + for (k = 0; k <= 5; k++) + S (i,j,k) + + Loop iterators: i, j, k + Parameters: a, b + + | i >= a - 7b + 8 + | i <= 3a + 13b + 20 + | j >= 2 + | j <= 2i + 5 + | k >= 0 + | k <= 5 + + The number of variables in the DOMAIN may change and is not + related to the number of loops in the original code. */ + isl_set *domain; + isl_set *iterators; + + /* The data references we access. */ + vec drs; + + /* The last basic block generated for this pbb. */ + basic_block new_bb; +}; + +#define PBB_BLACK_BOX(PBB) ((gimple_poly_bb_p) PBB->black_box) +#define PBB_SCOP(PBB) (PBB->scop) +#define PBB_DRS(PBB) (PBB->drs) + +extern poly_bb_p new_poly_bb (scop_p, gimple_poly_bb_p); +extern void print_pbb_domain (FILE *, poly_bb_p); +extern void print_pbb (FILE *, poly_bb_p); +extern void print_scop_context (FILE *, scop_p); +extern void print_scop (FILE *, scop_p); +extern void debug_pbb_domain (poly_bb_p); +extern void debug_pbb (poly_bb_p); +extern void print_pdrs (FILE *, poly_bb_p); +extern void debug_pdrs (poly_bb_p); +extern void debug_scop_context (scop_p); +extern void debug_scop (scop_p); +extern void print_scop_params (FILE *, scop_p); +extern void debug_scop_params (scop_p); +extern void print_iteration_domain (FILE *, poly_bb_p); +extern void print_iteration_domains (FILE *, scop_p); +extern void debug_iteration_domain (poly_bb_p); +extern void debug_iteration_domains (scop_p); +extern void print_isl_set (FILE *, isl_set *); +extern void print_isl_map (FILE *, isl_map *); +extern void print_isl_union_map (FILE *, isl_union_map *); +extern void print_isl_aff (FILE *, isl_aff *); +extern void print_isl_constraint (FILE *, isl_constraint *); +extern void print_isl_schedule (FILE *, isl_schedule *); +extern void debug_isl_schedule (isl_schedule *); +extern void print_isl_ast (FILE *, isl_ast_node *); +extern void debug_isl_ast (isl_ast_node *); +extern void debug_isl_set (isl_set *); +extern void debug_isl_map (isl_map *); +extern void debug_isl_union_map (isl_union_map *); +extern void debug_isl_aff (isl_aff *); +extern void debug_isl_constraint (isl_constraint *); +extern void debug_gmp_value (mpz_t); +extern void debug_scop_pbb (scop_p scop, int i); +extern void print_schedule_ast (FILE *, __isl_keep isl_schedule *, scop_p); +extern void debug_schedule_ast (__isl_keep isl_schedule *, scop_p); + +/* The basic block of the PBB. */ + +static inline basic_block +pbb_bb (poly_bb_p pbb) +{ + return GBB_BB (PBB_BLACK_BOX (pbb)); +} + +static inline int +pbb_index (poly_bb_p pbb) +{ + return pbb_bb (pbb)->index; +} + +/* The loop of the PBB. */ + +static inline loop_p +pbb_loop (poly_bb_p pbb) +{ + return gbb_loop (PBB_BLACK_BOX (pbb)); +} + +/* The scop that contains the PDR. */ + +static inline scop_p +pdr_scop (poly_dr_p pdr) +{ + return PBB_SCOP (PDR_PBB (pdr)); +} + +/* Set black box of PBB to BLACKBOX. */ + +static inline void +pbb_set_black_box (poly_bb_p pbb, gimple_poly_bb_p black_box) +{ + pbb->black_box = black_box; +} + +/* A helper structure to keep track of data references, polyhedral BBs, and + alias sets. */ + +struct dr_info +{ + enum { + invalid_alias_set = -1 + }; + /* The data reference. */ + data_reference_p dr; + + /* The polyhedral BB containing this DR. */ + poly_bb_p pbb; + + /* ALIAS_SET is the SCC number assigned by a graph_dfs of the alias graph. + -1 is an invalid alias set. */ + int alias_set; + + /* Construct a DR_INFO from a data reference DR, an ALIAS_SET, and a PBB. */ + dr_info (data_reference_p dr, poly_bb_p pbb, + int alias_set = invalid_alias_set) + : dr (dr), pbb (pbb), alias_set (alias_set) {} +}; + +/* A SCOP is a Static Control Part of the program, simple enough to be + represented in polyhedral form. */ +struct scop +{ + /* A SCOP is defined as a SESE region. */ + sese_info_p scop_info; + + /* Number of parameters in SCoP. */ + graphite_dim_t nb_params; + + /* All the basic blocks in this scop that contain memory references + and that will be represented as statements in the polyhedral + representation. */ + vec pbbs; + + /* All the data references in this scop. */ + vec drs; + + /* The context describes known restrictions concerning the parameters + and relations in between the parameters. + + void f (int8_t a, uint_16_t b) { + c = 2 a + b; + ... + } + + Here we can add these restrictions to the context: + + -128 >= a >= 127 + 0 >= b >= 65,535 + c = 2a + b */ + isl_set *param_context; + + /* The context used internally by isl. */ + isl_ctx *isl_context; + + /* SCoP original schedule. */ + isl_schedule *original_schedule; + + /* SCoP transformed schedule. */ + isl_schedule *transformed_schedule; + + /* The data dependence relation among the data references in this scop. */ + isl_union_map *dependence; +}; + +extern scop_p new_scop (edge, edge); +extern void free_scop (scop_p); +extern gimple_poly_bb_p new_gimple_poly_bb (basic_block, vec, + vec, vec); +extern bool apply_poly_transforms (scop_p); + +/* Set the region of SCOP to REGION. */ + +static inline void +scop_set_region (scop_p scop, sese_info_p region) +{ + scop->scop_info = region; +} + +/* Returns the number of parameters for SCOP. */ + +static inline graphite_dim_t +scop_nb_params (scop_p scop) +{ + return scop->nb_params; +} + +/* Set the number of params of SCOP to NB_PARAMS. */ + +static inline void +scop_set_nb_params (scop_p scop, graphite_dim_t nb_params) +{ + scop->nb_params = nb_params; +} + +extern void scop_get_dependences (scop_p scop); + +bool +carries_deps (__isl_keep isl_union_map *schedule, + __isl_keep isl_union_map *deps, + int depth); + +extern bool build_poly_scop (scop_p); +extern bool graphite_regenerate_ast_isl (scop_p); +extern void build_scops (vec *); +extern void dot_all_sese (FILE *, vec &); +extern void dot_sese (sese_l &); +extern void dot_cfg (); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gstab.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gstab.h new file mode 100644 index 0000000..1e863ba --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gstab.h @@ -0,0 +1,35 @@ +/* Copyright (C) 1997-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_GSTAB_H +#define GCC_GSTAB_H + +#define __define_stab(NAME, CODE, STRING) NAME=CODE, + +enum +{ +#include "stab.def" +LAST_UNUSED_STAB_CODE +}; + +/* stabs debug codes really are integers with expressive names. */ +typedef int stab_code_type; + +#undef __define_stab + +#endif /* ! GCC_GSTAB_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gsyms.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gsyms.h new file mode 100644 index 0000000..749ff8a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gsyms.h @@ -0,0 +1,97 @@ +/* Copyright (C) 1992-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* For cross compilation, use the portable definitions from the COFF + documentation. */ +#ifndef GCC_GSYMS_H +#define GCC_GSYMS_H + +#define __GNU_SYMS__ + +enum sdb_storage_class +{ + C_EFCN = -1, + C_NULL = 0, + C_AUTO = 1, + C_EXT = 2, + C_STAT = 3, + C_REG = 4, + C_EXTDEF = 5, + C_LABEL = 6, + C_ULABEL = 7, + C_MOS = 8, + C_ARG = 9, + C_STRTAG = 10, + C_MOU = 11, + C_UNTAG = 12, + C_TPDEF = 13, + C_USTATIC = 14, + C_ENTAG = 15, + C_MOE = 16, + C_REGPARM = 17, + C_FIELD = 18, + + C_BLOCK = 100, + C_FCN = 101, + C_EOS = 102, + C_FILE = 103, + C_LINE = 104, + C_ALIAS = 105, + C_HIDDEN = 106 +}; + +enum sdb_type +{ + T_NULL = 0, + T_ARG = 1, + T_VOID = 1, + T_CHAR = 2, + T_SHORT = 3, + T_INT = 4, + T_LONG = 5, + T_FLOAT = 6, + T_DOUBLE = 7, + T_STRUCT = 8, + T_UNION = 9, + T_ENUM = 10, + T_MOE = 11, + T_UCHAR = 12, + T_USHORT = 13, + T_UINT = 14, + T_ULONG = 15 +}; + +enum sdb_type_class +{ + DT_NON = 0, + DT_PTR = 1, + DT_FCN = 2, + DT_ARY = 3 +}; + +enum sdb_masks +{ + N_BTMASK = 017, + N_TMASK = 060, + N_TMASK1 = 0300, + N_TMASK2 = 0360, + N_BTSHFT = 4, + N_TSHIFT = 2 +}; + +#endif /* GCC_GSYMS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gsyslimits.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gsyslimits.h new file mode 100644 index 0000000..a362802 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gsyslimits.h @@ -0,0 +1,8 @@ +/* syslimits.h stands for the system's own limits.h file. + If we can use it ok unmodified, then we install this text. + If fixincludes fixes it, then the fixed version is installed + instead of this text. */ + +#define _GCC_NEXT_LIMITS_H /* tell gcc's limits.h to recurse */ +#include_next +#undef _GCC_NEXT_LIMITS_H diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gtype-desc.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gtype-desc.h new file mode 100644 index 0000000..c661608 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/gtype-desc.h @@ -0,0 +1,3249 @@ +/* Type information for GCC. + Copyright (C) 2004-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* This file is machine generated. Do not edit. */ + +/* GC marker procedures. */ +/* Macros and declarations. */ +#define gt_ggc_m_9tree_node(X) do { \ + if (X != NULL) gt_ggc_mx_tree_node (X);\ + } while (0) +#define gt_ggc_mx_tree_node gt_ggc_mx_lang_tree_node +#define gt_ggc_m_9line_maps(X) do { \ + if (X != NULL) gt_ggc_mx_line_maps (X);\ + } while (0) +extern void gt_ggc_mx_line_maps (void *); +#define gt_ggc_m_9cpp_token(X) do { \ + if (X != NULL) gt_ggc_mx_cpp_token (X);\ + } while (0) +extern void gt_ggc_mx_cpp_token (void *); +#define gt_ggc_m_9cpp_macro(X) do { \ + if (X != NULL) gt_ggc_mx_cpp_macro (X);\ + } while (0) +extern void gt_ggc_mx_cpp_macro (void *); +#define gt_ggc_m_6answer(X) do { \ + if (X != NULL) gt_ggc_mx_answer (X);\ + } while (0) +extern void gt_ggc_mx_answer (void *); +#define gt_ggc_m_13string_concat(X) do { \ + if (X != NULL) gt_ggc_mx_string_concat (X);\ + } while (0) +extern void gt_ggc_mx_string_concat (void *); +#define gt_ggc_m_16string_concat_db(X) do { \ + if (X != NULL) gt_ggc_mx_string_concat_db (X);\ + } while (0) +extern void gt_ggc_mx_string_concat_db (void *); +#define gt_ggc_m_38hash_map_location_hash_string_concat__(X) do { \ + if (X != NULL) gt_ggc_mx_hash_map_location_hash_string_concat__ (X);\ + } while (0) +extern void gt_ggc_mx_hash_map_location_hash_string_concat__ (void *); +#define gt_ggc_m_11bitmap_head(X) do { \ + if (X != NULL) gt_ggc_mx_bitmap_head (X);\ + } while (0) +extern void gt_ggc_mx_bitmap_head (void *); +#define gt_ggc_m_7rtx_def(X) do { \ + if (X != NULL) gt_ggc_mx_rtx_def (X);\ + } while (0) +extern void gt_ggc_mx_rtx_def (void *); +#define gt_ggc_m_9rtvec_def(X) do { \ + if (X != NULL) gt_ggc_mx_rtvec_def (X);\ + } while (0) +extern void gt_ggc_mx_rtvec_def (void *); +#define gt_ggc_m_6gimple(X) do { \ + if (X != NULL) gt_ggc_mx_gimple (X);\ + } while (0) +extern void gt_ggc_mx_gimple (void *); +#define gt_ggc_m_7section(X) do { \ + if (X != NULL) gt_ggc_mx_section (X);\ + } while (0) +extern void gt_ggc_mx_section (void *); +#define gt_ggc_m_16cl_target_option(X) do { \ + if (X != NULL) gt_ggc_mx_cl_target_option (X);\ + } while (0) +extern void gt_ggc_mx_cl_target_option (void *); +#define gt_ggc_m_15cl_optimization(X) do { \ + if (X != NULL) gt_ggc_mx_cl_optimization (X);\ + } while (0) +extern void gt_ggc_mx_cl_optimization (void *); +#define gt_ggc_m_8edge_def(X) do { \ + if (X != NULL) gt_ggc_mx_edge_def (X);\ + } while (0) +extern void gt_ggc_mx_edge_def (void *); +#define gt_ggc_m_15basic_block_def(X) do { \ + if (X != NULL) gt_ggc_mx_basic_block_def (X);\ + } while (0) +extern void gt_ggc_mx_basic_block_def (void *); +#define gt_ggc_m_14target_globals(X) do { \ + if (X != NULL) gt_ggc_mx_target_globals (X);\ + } while (0) +extern void gt_ggc_mx_target_globals (void *); +#define gt_ggc_m_16machine_function(X) do { \ + if (X != NULL) gt_ggc_mx_machine_function (X);\ + } while (0) +extern void gt_ggc_mx_machine_function (void *); +#define gt_ggc_m_14bitmap_element(X) do { \ + if (X != NULL) gt_ggc_mx_bitmap_element (X);\ + } while (0) +extern void gt_ggc_mx_bitmap_element (void *); +#define gt_ggc_m_14bitmap_obstack(X) do { \ + if (X != NULL) gt_ggc_mx_bitmap_obstack (X);\ + } while (0) +extern void gt_ggc_mx_bitmap_obstack (void *); +#define gt_ggc_m_34generic_wide_int_wide_int_storage_(X) do { \ + if (X != NULL) gt_ggc_mx_generic_wide_int_wide_int_storage_ (X);\ + } while (0) +extern void gt_ggc_mx_generic_wide_int_wide_int_storage_ (void *); +#define gt_ggc_m_13coverage_data(X) do { \ + if (X != NULL) gt_ggc_mx_coverage_data (X);\ + } while (0) +extern void gt_ggc_mx_coverage_data (void *); +#define gt_ggc_m_9mem_attrs(X) do { \ + if (X != NULL) gt_ggc_mx_mem_attrs (X);\ + } while (0) +extern void gt_ggc_mx_mem_attrs (void *); +#define gt_ggc_m_9reg_attrs(X) do { \ + if (X != NULL) gt_ggc_mx_reg_attrs (X);\ + } while (0) +extern void gt_ggc_mx_reg_attrs (void *); +#define gt_ggc_m_12object_block(X) do { \ + if (X != NULL) gt_ggc_mx_object_block (X);\ + } while (0) +extern void gt_ggc_mx_object_block (void *); +#define gt_ggc_m_14vec_rtx_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_rtx_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_rtx_va_gc_ (void *); +#define gt_ggc_m_10real_value(X) do { \ + if (X != NULL) gt_ggc_mx_real_value (X);\ + } while (0) +extern void gt_ggc_mx_real_value (void *); +#define gt_ggc_m_11fixed_value(X) do { \ + if (X != NULL) gt_ggc_mx_fixed_value (X);\ + } while (0) +extern void gt_ggc_mx_fixed_value (void *); +#define gt_ggc_m_23constant_descriptor_rtx(X) do { \ + if (X != NULL) gt_ggc_mx_constant_descriptor_rtx (X);\ + } while (0) +extern void gt_ggc_mx_constant_descriptor_rtx (void *); +#define gt_ggc_m_8function(X) do { \ + if (X != NULL) gt_ggc_mx_function (X);\ + } while (0) +extern void gt_ggc_mx_function (void *); +#define gt_ggc_m_10target_rtl(X) do { \ + if (X != NULL) gt_ggc_mx_target_rtl (X);\ + } while (0) +extern void gt_ggc_mx_target_rtl (void *); +#define gt_ggc_m_15cgraph_rtl_info(X) do { \ + if (X != NULL) gt_ggc_mx_cgraph_rtl_info (X);\ + } while (0) +extern void gt_ggc_mx_cgraph_rtl_info (void *); +#define gt_ggc_m_12ptr_info_def(X) do { \ + if (X != NULL) gt_ggc_mx_ptr_info_def (X);\ + } while (0) +extern void gt_ggc_mx_ptr_info_def (void *); +#define gt_ggc_m_14range_info_def(X) do { \ + if (X != NULL) gt_ggc_mx_range_info_def (X);\ + } while (0) +extern void gt_ggc_mx_range_info_def (void *); +#define gt_ggc_m_10die_struct(X) do { \ + if (X != NULL) gt_ggc_mx_die_struct (X);\ + } while (0) +extern void gt_ggc_mx_die_struct (void *); +#define gt_ggc_m_26vec_constructor_elt_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_constructor_elt_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_constructor_elt_va_gc_ (void *); +#define gt_ggc_m_15vec_tree_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_tree_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_tree_va_gc_ (void *); +#define gt_ggc_m_9lang_type(X) do { \ + if (X != NULL) gt_ggc_mx_lang_type (X);\ + } while (0) +extern void gt_ggc_mx_lang_type (void *); +#define gt_ggc_m_9lang_decl(X) do { \ + if (X != NULL) gt_ggc_mx_lang_decl (X);\ + } while (0) +extern void gt_ggc_mx_lang_decl (void *); +#define gt_ggc_m_11symtab_node(X) do { \ + if (X != NULL) gt_ggc_mx_symtab_node (X);\ + } while (0) +extern void gt_ggc_mx_symtab_node (void *); +#define gt_ggc_m_24tree_statement_list_node(X) do { \ + if (X != NULL) gt_ggc_mx_tree_statement_list_node (X);\ + } while (0) +extern void gt_ggc_mx_tree_statement_list_node (void *); +#define gt_ggc_m_14lang_tree_node(X) do { \ + if (X != NULL) gt_ggc_mx_lang_tree_node (X);\ + } while (0) +extern void gt_ggc_mx_lang_tree_node (void *); +#define gt_ggc_m_8tree_map(X) do { \ + if (X != NULL) gt_ggc_mx_tree_map (X);\ + } while (0) +extern void gt_ggc_mx_tree_map (void *); +#define gt_ggc_m_13tree_decl_map(X) do { \ + if (X != NULL) gt_ggc_mx_tree_decl_map (X);\ + } while (0) +extern void gt_ggc_mx_tree_decl_map (void *); +#define gt_ggc_m_12tree_int_map(X) do { \ + if (X != NULL) gt_ggc_mx_tree_int_map (X);\ + } while (0) +extern void gt_ggc_mx_tree_int_map (void *); +#define gt_ggc_m_12tree_vec_map(X) do { \ + if (X != NULL) gt_ggc_mx_tree_vec_map (X);\ + } while (0) +extern void gt_ggc_mx_tree_vec_map (void *); +#define gt_ggc_m_21vec_alias_pair_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_alias_pair_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_alias_pair_va_gc_ (void *); +#define gt_ggc_m_13libfunc_entry(X) do { \ + if (X != NULL) gt_ggc_mx_libfunc_entry (X);\ + } while (0) +extern void gt_ggc_mx_libfunc_entry (void *); +#define gt_ggc_m_26hash_table_libfunc_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_libfunc_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_libfunc_hasher_ (void *); +#define gt_ggc_m_15target_libfuncs(X) do { \ + if (X != NULL) gt_ggc_mx_target_libfuncs (X);\ + } while (0) +extern void gt_ggc_mx_target_libfuncs (void *); +#define gt_ggc_m_14sequence_stack(X) do { \ + if (X != NULL) gt_ggc_mx_sequence_stack (X);\ + } while (0) +extern void gt_ggc_mx_sequence_stack (void *); +#define gt_ggc_m_20vec_rtx_insn__va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_rtx_insn__va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_rtx_insn__va_gc_ (void *); +#define gt_ggc_m_18call_site_record_d(X) do { \ + if (X != NULL) gt_ggc_mx_call_site_record_d (X);\ + } while (0) +extern void gt_ggc_mx_call_site_record_d (void *); +#define gt_ggc_m_16vec_uchar_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_uchar_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_uchar_va_gc_ (void *); +#define gt_ggc_m_27vec_call_site_record_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_call_site_record_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_call_site_record_va_gc_ (void *); +#define gt_ggc_m_9gimple_df(X) do { \ + if (X != NULL) gt_ggc_mx_gimple_df (X);\ + } while (0) +extern void gt_ggc_mx_gimple_df (void *); +#define gt_ggc_m_11dw_fde_node(X) do { \ + if (X != NULL) gt_ggc_mx_dw_fde_node (X);\ + } while (0) +extern void gt_ggc_mx_dw_fde_node (void *); +#define gt_ggc_m_17rtx_constant_pool(X) do { \ + if (X != NULL) gt_ggc_mx_rtx_constant_pool (X);\ + } while (0) +extern void gt_ggc_mx_rtx_constant_pool (void *); +#define gt_ggc_m_11frame_space(X) do { \ + if (X != NULL) gt_ggc_mx_frame_space (X);\ + } while (0) +extern void gt_ggc_mx_frame_space (void *); +#define gt_ggc_m_11stack_usage(X) do { \ + if (X != NULL) gt_ggc_mx_stack_usage (X);\ + } while (0) +extern void gt_ggc_mx_stack_usage (void *); +#define gt_ggc_m_9eh_status(X) do { \ + if (X != NULL) gt_ggc_mx_eh_status (X);\ + } while (0) +extern void gt_ggc_mx_eh_status (void *); +#define gt_ggc_m_18control_flow_graph(X) do { \ + if (X != NULL) gt_ggc_mx_control_flow_graph (X);\ + } while (0) +extern void gt_ggc_mx_control_flow_graph (void *); +#define gt_ggc_m_5loops(X) do { \ + if (X != NULL) gt_ggc_mx_loops (X);\ + } while (0) +extern void gt_ggc_mx_loops (void *); +#define gt_ggc_m_17language_function(X) do { \ + if (X != NULL) gt_ggc_mx_language_function (X);\ + } while (0) +extern void gt_ggc_mx_language_function (void *); +#define gt_ggc_m_14hash_set_tree_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_set_tree_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_set_tree_ (void *); +#define gt_ggc_m_24types_used_by_vars_entry(X) do { \ + if (X != NULL) gt_ggc_mx_types_used_by_vars_entry (X);\ + } while (0) +extern void gt_ggc_mx_types_used_by_vars_entry (void *); +#define gt_ggc_m_28hash_table_used_type_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_used_type_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_used_type_hasher_ (void *); +#define gt_ggc_m_13nb_iter_bound(X) do { \ + if (X != NULL) gt_ggc_mx_nb_iter_bound (X);\ + } while (0) +extern void gt_ggc_mx_nb_iter_bound (void *); +#define gt_ggc_m_9loop_exit(X) do { \ + if (X != NULL) gt_ggc_mx_loop_exit (X);\ + } while (0) +extern void gt_ggc_mx_loop_exit (void *); +#define gt_ggc_m_4loop(X) do { \ + if (X != NULL) gt_ggc_mx_loop (X);\ + } while (0) +extern void gt_ggc_mx_loop (void *); +#define gt_ggc_m_10control_iv(X) do { \ + if (X != NULL) gt_ggc_mx_control_iv (X);\ + } while (0) +extern void gt_ggc_mx_control_iv (void *); +#define gt_ggc_m_17vec_loop_p_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_loop_p_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_loop_p_va_gc_ (void *); +#define gt_ggc_m_10niter_desc(X) do { \ + if (X != NULL) gt_ggc_mx_niter_desc (X);\ + } while (0) +extern void gt_ggc_mx_niter_desc (void *); +#define gt_ggc_m_28hash_table_loop_exit_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_loop_exit_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_loop_exit_hasher_ (void *); +#define gt_ggc_m_22vec_basic_block_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_basic_block_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_basic_block_va_gc_ (void *); +#define gt_ggc_m_11rtl_bb_info(X) do { \ + if (X != NULL) gt_ggc_mx_rtl_bb_info (X);\ + } while (0) +extern void gt_ggc_mx_rtl_bb_info (void *); +#define gt_ggc_m_15vec_edge_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_edge_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_edge_va_gc_ (void *); +#define gt_ggc_m_20vec_ipa_ref_t_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_ipa_ref_t_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_ipa_ref_t_va_gc_ (void *); +#define gt_ggc_m_18section_hash_entry(X) do { \ + if (X != NULL) gt_ggc_mx_section_hash_entry (X);\ + } while (0) +extern void gt_ggc_mx_section_hash_entry (void *); +#define gt_ggc_m_18lto_file_decl_data(X) do { \ + if (X != NULL) gt_ggc_mx_lto_file_decl_data (X);\ + } while (0) +extern void gt_ggc_mx_lto_file_decl_data (void *); +#define gt_ggc_m_15ipa_replace_map(X) do { \ + if (X != NULL) gt_ggc_mx_ipa_replace_map (X);\ + } while (0) +extern void gt_ggc_mx_ipa_replace_map (void *); +#define gt_ggc_m_27vec_ipa_replace_map__va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_ipa_replace_map__va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_ipa_replace_map__va_gc_ (void *); +#define gt_ggc_m_17cgraph_simd_clone(X) do { \ + if (X != NULL) gt_ggc_mx_cgraph_simd_clone (X);\ + } while (0) +extern void gt_ggc_mx_cgraph_simd_clone (void *); +#define gt_ggc_m_28cgraph_function_version_info(X) do { \ + if (X != NULL) gt_ggc_mx_cgraph_function_version_info (X);\ + } while (0) +extern void gt_ggc_mx_cgraph_function_version_info (void *); +#define gt_ggc_m_11cgraph_edge(X) do { \ + if (X != NULL) gt_ggc_mx_cgraph_edge (X);\ + } while (0) +extern void gt_ggc_mx_cgraph_edge (void *); +#define gt_ggc_m_30hash_table_cgraph_edge_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_cgraph_edge_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_cgraph_edge_hasher_ (void *); +#define gt_ggc_m_25cgraph_indirect_call_info(X) do { \ + if (X != NULL) gt_ggc_mx_cgraph_indirect_call_info (X);\ + } while (0) +extern void gt_ggc_mx_cgraph_indirect_call_info (void *); +#define gt_ggc_m_8asm_node(X) do { \ + if (X != NULL) gt_ggc_mx_asm_node (X);\ + } while (0) +extern void gt_ggc_mx_asm_node (void *); +#define gt_ggc_m_12symbol_table(X) do { \ + if (X != NULL) gt_ggc_mx_symbol_table (X);\ + } while (0) +extern void gt_ggc_mx_symbol_table (void *); +#define gt_ggc_m_31hash_table_section_name_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_section_name_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_section_name_hasher_ (void *); +#define gt_ggc_m_26hash_table_asmname_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_asmname_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_asmname_hasher_ (void *); +#define gt_ggc_m_42hash_map_symtab_node__symbol_priority_map_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_map_symtab_node__symbol_priority_map_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_map_symtab_node__symbol_priority_map_ (void *); +#define gt_ggc_m_24constant_descriptor_tree(X) do { \ + if (X != NULL) gt_ggc_mx_constant_descriptor_tree (X);\ + } while (0) +extern void gt_ggc_mx_constant_descriptor_tree (void *); +#define gt_ggc_m_28hash_map_alias_set_hash_int_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_map_alias_set_hash_int_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_map_alias_set_hash_int_ (void *); +#define gt_ggc_m_15alias_set_entry(X) do { \ + if (X != NULL) gt_ggc_mx_alias_set_entry (X);\ + } while (0) +extern void gt_ggc_mx_alias_set_entry (void *); +#define gt_ggc_m_27vec_alias_set_entry__va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_alias_set_entry__va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_alias_set_entry__va_gc_ (void *); +#define gt_ggc_m_35hash_table_function_version_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_function_version_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_function_version_hasher_ (void *); +#define gt_ggc_m_17lto_in_decl_state(X) do { \ + if (X != NULL) gt_ggc_mx_lto_in_decl_state (X);\ + } while (0) +extern void gt_ggc_mx_lto_in_decl_state (void *); +#define gt_ggc_m_35hash_table_ipa_bit_ggc_hash_traits_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_ipa_bit_ggc_hash_traits_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_ipa_bit_ggc_hash_traits_ (void *); +#define gt_ggc_m_34hash_table_ipa_vr_ggc_hash_traits_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_ipa_vr_ggc_hash_traits_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_ipa_vr_ggc_hash_traits_ (void *); +#define gt_ggc_m_15ipa_node_params(X) do { \ + if (X != NULL) gt_ggc_mx_ipa_node_params (X);\ + } while (0) +extern void gt_ggc_mx_ipa_node_params (void *); +#define gt_ggc_m_25ipa_agg_replacement_value(X) do { \ + if (X != NULL) gt_ggc_mx_ipa_agg_replacement_value (X);\ + } while (0) +extern void gt_ggc_mx_ipa_agg_replacement_value (void *); +#define gt_ggc_m_14inline_summary(X) do { \ + if (X != NULL) gt_ggc_mx_inline_summary (X);\ + } while (0) +extern void gt_ggc_mx_inline_summary (void *); +#define gt_ggc_m_10odr_type_d(X) do { \ + if (X != NULL) gt_ggc_mx_odr_type_d (X);\ + } while (0) +extern void gt_ggc_mx_odr_type_d (void *); +#define gt_ggc_m_8typeinfo(X) do { \ + if (X != NULL) gt_ggc_mx_typeinfo (X);\ + } while (0) +extern void gt_ggc_mx_typeinfo (void *); +#define gt_ggc_m_11dw_cfi_node(X) do { \ + if (X != NULL) gt_ggc_mx_dw_cfi_node (X);\ + } while (0) +extern void gt_ggc_mx_dw_cfi_node (void *); +#define gt_ggc_m_17dw_loc_descr_node(X) do { \ + if (X != NULL) gt_ggc_mx_dw_loc_descr_node (X);\ + } while (0) +extern void gt_ggc_mx_dw_loc_descr_node (void *); +#define gt_ggc_m_18dw_loc_list_struct(X) do { \ + if (X != NULL) gt_ggc_mx_dw_loc_list_struct (X);\ + } while (0) +extern void gt_ggc_mx_dw_loc_list_struct (void *); +#define gt_ggc_m_18dw_discr_list_node(X) do { \ + if (X != NULL) gt_ggc_mx_dw_discr_list_node (X);\ + } while (0) +extern void gt_ggc_mx_dw_discr_list_node (void *); +#define gt_ggc_m_21vec_dw_cfi_ref_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_dw_cfi_ref_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_dw_cfi_ref_va_gc_ (void *); +#define gt_ggc_m_16addr_table_entry(X) do { \ + if (X != NULL) gt_ggc_mx_addr_table_entry (X);\ + } while (0) +extern void gt_ggc_mx_addr_table_entry (void *); +#define gt_ggc_m_20indirect_string_node(X) do { \ + if (X != NULL) gt_ggc_mx_indirect_string_node (X);\ + } while (0) +extern void gt_ggc_mx_indirect_string_node (void *); +#define gt_ggc_m_15dwarf_file_data(X) do { \ + if (X != NULL) gt_ggc_mx_dwarf_file_data (X);\ + } while (0) +extern void gt_ggc_mx_dwarf_file_data (void *); +#define gt_ggc_m_20hash_map_char__tree_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_map_char__tree_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_map_char__tree_ (void *); +#define gt_ggc_m_10dw_cfi_row(X) do { \ + if (X != NULL) gt_ggc_mx_dw_cfi_row (X);\ + } while (0) +extern void gt_ggc_mx_dw_cfi_row (void *); +#define gt_ggc_m_17reg_saved_in_data(X) do { \ + if (X != NULL) gt_ggc_mx_reg_saved_in_data (X);\ + } while (0) +extern void gt_ggc_mx_reg_saved_in_data (void *); +#define gt_ggc_m_21vec_dw_fde_ref_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_dw_fde_ref_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_dw_fde_ref_va_gc_ (void *); +#define gt_ggc_m_34hash_table_indirect_string_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_indirect_string_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_indirect_string_hasher_ (void *); +#define gt_ggc_m_16comdat_type_node(X) do { \ + if (X != NULL) gt_ggc_mx_comdat_type_node (X);\ + } while (0) +extern void gt_ggc_mx_comdat_type_node (void *); +#define gt_ggc_m_29vec_dw_line_info_entry_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_dw_line_info_entry_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_dw_line_info_entry_va_gc_ (void *); +#define gt_ggc_m_18dw_line_info_table(X) do { \ + if (X != NULL) gt_ggc_mx_dw_line_info_table (X);\ + } while (0) +extern void gt_ggc_mx_dw_line_info_table (void *); +#define gt_ggc_m_23vec_dw_attr_node_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_dw_attr_node_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_dw_attr_node_va_gc_ (void *); +#define gt_ggc_m_16limbo_die_struct(X) do { \ + if (X != NULL) gt_ggc_mx_limbo_die_struct (X);\ + } while (0) +extern void gt_ggc_mx_limbo_die_struct (void *); +#define gt_ggc_m_29hash_table_dwarf_file_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_dwarf_file_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_dwarf_file_hasher_ (void *); +#define gt_ggc_m_27hash_table_decl_die_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_decl_die_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_decl_die_hasher_ (void *); +#define gt_ggc_m_21vec_dw_die_ref_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_dw_die_ref_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_dw_die_ref_va_gc_ (void *); +#define gt_ggc_m_21variable_value_struct(X) do { \ + if (X != NULL) gt_ggc_mx_variable_value_struct (X);\ + } while (0) +extern void gt_ggc_mx_variable_value_struct (void *); +#define gt_ggc_m_33hash_table_variable_value_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_variable_value_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_variable_value_hasher_ (void *); +#define gt_ggc_m_28hash_table_block_die_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_block_die_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_block_die_hasher_ (void *); +#define gt_ggc_m_12var_loc_node(X) do { \ + if (X != NULL) gt_ggc_mx_var_loc_node (X);\ + } while (0) +extern void gt_ggc_mx_var_loc_node (void *); +#define gt_ggc_m_16var_loc_list_def(X) do { \ + if (X != NULL) gt_ggc_mx_var_loc_list_def (X);\ + } while (0) +extern void gt_ggc_mx_var_loc_list_def (void *); +#define gt_ggc_m_17call_arg_loc_node(X) do { \ + if (X != NULL) gt_ggc_mx_call_arg_loc_node (X);\ + } while (0) +extern void gt_ggc_mx_call_arg_loc_node (void *); +#define gt_ggc_m_27hash_table_decl_loc_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_decl_loc_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_decl_loc_hasher_ (void *); +#define gt_ggc_m_22cached_dw_loc_list_def(X) do { \ + if (X != NULL) gt_ggc_mx_cached_dw_loc_list_def (X);\ + } while (0) +extern void gt_ggc_mx_cached_dw_loc_list_def (void *); +#define gt_ggc_m_30hash_table_dw_loc_list_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_dw_loc_list_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_dw_loc_list_hasher_ (void *); +#define gt_ggc_m_30vec_dw_line_info_table__va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_dw_line_info_table__va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_dw_line_info_table__va_gc_ (void *); +#define gt_ggc_m_24vec_pubname_entry_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_pubname_entry_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_pubname_entry_va_gc_ (void *); +#define gt_ggc_m_24vec_macinfo_entry_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_macinfo_entry_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_macinfo_entry_va_gc_ (void *); +#define gt_ggc_m_20vec_dw_ranges_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_dw_ranges_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_dw_ranges_va_gc_ (void *); +#define gt_ggc_m_29vec_dw_ranges_by_label_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_dw_ranges_by_label_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_dw_ranges_by_label_va_gc_ (void *); +#define gt_ggc_m_24vec_die_arg_entry_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_die_arg_entry_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_die_arg_entry_va_gc_ (void *); +#define gt_ggc_m_23hash_table_addr_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_addr_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_addr_hasher_ (void *); +#define gt_ggc_m_9temp_slot(X) do { \ + if (X != NULL) gt_ggc_mx_temp_slot (X);\ + } while (0) +extern void gt_ggc_mx_temp_slot (void *); +#define gt_ggc_m_20initial_value_struct(X) do { \ + if (X != NULL) gt_ggc_mx_initial_value_struct (X);\ + } while (0) +extern void gt_ggc_mx_initial_value_struct (void *); +#define gt_ggc_m_22vec_temp_slot_p_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_temp_slot_p_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_temp_slot_p_va_gc_ (void *); +#define gt_ggc_m_28hash_table_const_int_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_const_int_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_const_int_hasher_ (void *); +#define gt_ggc_m_33hash_table_const_wide_int_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_const_wide_int_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_const_wide_int_hasher_ (void *); +#define gt_ggc_m_27hash_table_reg_attr_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_reg_attr_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_reg_attr_hasher_ (void *); +#define gt_ggc_m_31hash_table_const_double_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_const_double_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_const_double_hasher_ (void *); +#define gt_ggc_m_30hash_table_const_fixed_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_const_fixed_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_const_fixed_hasher_ (void *); +#define gt_ggc_m_11eh_region_d(X) do { \ + if (X != NULL) gt_ggc_mx_eh_region_d (X);\ + } while (0) +extern void gt_ggc_mx_eh_region_d (void *); +#define gt_ggc_m_16eh_landing_pad_d(X) do { \ + if (X != NULL) gt_ggc_mx_eh_landing_pad_d (X);\ + } while (0) +extern void gt_ggc_mx_eh_landing_pad_d (void *); +#define gt_ggc_m_10eh_catch_d(X) do { \ + if (X != NULL) gt_ggc_mx_eh_catch_d (X);\ + } while (0) +extern void gt_ggc_mx_eh_catch_d (void *); +#define gt_ggc_m_20vec_eh_region_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_eh_region_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_eh_region_va_gc_ (void *); +#define gt_ggc_m_25vec_eh_landing_pad_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_eh_landing_pad_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_eh_landing_pad_va_gc_ (void *); +#define gt_ggc_m_21hash_map_gimple__int_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_map_gimple__int_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_map_gimple__int_ (void *); +#define gt_ggc_m_29hash_table_insn_cache_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_insn_cache_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_insn_cache_hasher_ (void *); +#define gt_ggc_m_23temp_slot_address_entry(X) do { \ + if (X != NULL) gt_ggc_mx_temp_slot_address_entry (X);\ + } while (0) +extern void gt_ggc_mx_temp_slot_address_entry (void *); +#define gt_ggc_m_31hash_table_temp_address_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_temp_address_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_temp_address_hasher_ (void *); +#define gt_ggc_m_24hash_map_tree_hash_tree_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_map_tree_hash_tree_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_map_tree_hash_tree_ (void *); +#define gt_ggc_m_11test_struct(X) do { \ + if (X != NULL) gt_ggc_mx_test_struct (X);\ + } while (0) +extern void gt_ggc_mx_test_struct (void *); +#define gt_ggc_m_14test_of_length(X) do { \ + if (X != NULL) gt_ggc_mx_test_of_length (X);\ + } while (0) +extern void gt_ggc_mx_test_of_length (void *); +#define gt_ggc_m_10test_other(X) do { \ + if (X != NULL) gt_ggc_mx_test_other (X);\ + } while (0) +extern void gt_ggc_mx_test_other (void *); +#define gt_ggc_m_13test_of_union(X) do { \ + if (X != NULL) gt_ggc_mx_test_of_union (X);\ + } while (0) +extern void gt_ggc_mx_test_of_union (void *); +#define gt_ggc_m_12example_base(X) do { \ + if (X != NULL) gt_ggc_mx_example_base (X);\ + } while (0) +extern void gt_ggc_mx_example_base (void *); +#define gt_ggc_m_9test_node(X) do { \ + if (X != NULL) gt_ggc_mx_test_node (X);\ + } while (0) +extern void gt_ggc_mx_test_node (void *); +#define gt_ggc_m_11user_struct(X) do { \ + if (X != NULL) gt_ggc_mx_user_struct (X);\ + } while (0) +extern void gt_ggc_mx_user_struct (void *); +#define gt_ggc_m_31hash_table_libfunc_decl_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_libfunc_decl_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_libfunc_decl_hasher_ (void *); +#define gt_ggc_m_16string_pool_data(X) do { \ + if (X != NULL) gt_ggc_mx_string_pool_data (X);\ + } while (0) +extern void gt_ggc_mx_string_pool_data (void *); +#define gt_ggc_m_9type_hash(X) do { \ + if (X != NULL) gt_ggc_mx_type_hash (X);\ + } while (0) +extern void gt_ggc_mx_type_hash (void *); +#define gt_ggc_m_29hash_table_type_cache_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_type_cache_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_type_cache_hasher_ (void *); +#define gt_ggc_m_26hash_table_int_cst_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_int_cst_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_int_cst_hasher_ (void *); +#define gt_ggc_m_28hash_table_cl_option_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_cl_option_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_cl_option_hasher_ (void *); +#define gt_ggc_m_38hash_table_tree_decl_map_cache_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_tree_decl_map_cache_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_tree_decl_map_cache_hasher_ (void *); +#define gt_ggc_m_37hash_table_tree_vec_map_cache_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_tree_vec_map_cache_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_tree_vec_map_cache_hasher_ (void *); +#define gt_ggc_m_26hash_table_section_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_section_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_section_hasher_ (void *); +#define gt_ggc_m_31hash_table_object_block_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_object_block_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_object_block_hasher_ (void *); +#define gt_ggc_m_34hash_table_tree_descriptor_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_tree_descriptor_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_tree_descriptor_hasher_ (void *); +#define gt_ggc_m_33hash_table_const_rtx_desc_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_const_rtx_desc_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_const_rtx_desc_hasher_ (void *); +#define gt_ggc_m_27hash_table_tm_clone_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_tm_clone_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_tm_clone_hasher_ (void *); +#define gt_ggc_m_15tm_restart_node(X) do { \ + if (X != NULL) gt_ggc_mx_tm_restart_node (X);\ + } while (0) +extern void gt_ggc_mx_tm_restart_node (void *); +#define gt_ggc_m_19hash_map_tree_tree_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_map_tree_tree_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_map_tree_tree_ (void *); +#define gt_ggc_m_27hash_table_ssa_name_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_ssa_name_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_ssa_name_hasher_ (void *); +#define gt_ggc_m_29hash_table_tm_restart_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_tm_restart_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_tm_restart_hasher_ (void *); +#define gt_ggc_m_28vec_mem_addr_template_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_mem_addr_template_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_mem_addr_template_va_gc_ (void *); +#define gt_ggc_m_13scev_info_str(X) do { \ + if (X != NULL) gt_ggc_mx_scev_info_str (X);\ + } while (0) +extern void gt_ggc_mx_scev_info_str (void *); +#define gt_ggc_m_28hash_table_scev_info_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_scev_info_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_scev_info_hasher_ (void *); +#define gt_ggc_m_20ssa_operand_memory_d(X) do { \ + if (X != NULL) gt_ggc_mx_ssa_operand_memory_d (X);\ + } while (0) +extern void gt_ggc_mx_ssa_operand_memory_d (void *); +#define gt_ggc_m_28grid_launch_attributes_trees(X) do { \ + if (X != NULL) gt_ggc_mx_grid_launch_attributes_trees (X);\ + } while (0) +extern void gt_ggc_mx_grid_launch_attributes_trees (void *); +#define gt_ggc_m_33hash_map_nofree_string_hash_bool_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_map_nofree_string_hash_bool_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_map_nofree_string_hash_bool_ (void *); +#define gt_ggc_m_32hash_map_nofree_string_hash_rtx_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_map_nofree_string_hash_rtx_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_map_nofree_string_hash_rtx_ (void *); +#define gt_ggc_m_18vec_gimple__va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_gimple__va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_gimple__va_gc_ (void *); +#define gt_ggc_m_11value_range(X) do { \ + if (X != NULL) gt_ggc_mx_value_range (X);\ + } while (0) +extern void gt_ggc_mx_value_range (void *); +#define gt_ggc_m_26vec_ipa_agg_jf_item_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_ipa_agg_jf_item_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_ipa_agg_jf_item_va_gc_ (void *); +#define gt_ggc_m_8ipa_bits(X) do { \ + if (X != NULL) gt_ggc_mx_ipa_bits (X);\ + } while (0) +extern void gt_ggc_mx_ipa_bits (void *); +#define gt_ggc_m_31vec_ipa_param_descriptor_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_ipa_param_descriptor_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_ipa_param_descriptor_va_gc_ (void *); +#define gt_ggc_m_20vec_ipa_bits__va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_ipa_bits__va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_ipa_bits__va_gc_ (void *); +#define gt_ggc_m_17vec_ipa_vr_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_ipa_vr_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_ipa_vr_va_gc_ (void *); +#define gt_ggc_m_24vec_ipa_jump_func_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_ipa_jump_func_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_ipa_jump_func_va_gc_ (void *); +#define gt_ggc_m_39vec_ipa_polymorphic_call_context_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_ipa_polymorphic_call_context_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_ipa_polymorphic_call_context_va_gc_ (void *); +#define gt_ggc_m_17ipa_node_params_t(X) do { \ + if (X != NULL) gt_ggc_mx_ipa_node_params_t (X);\ + } while (0) +extern void gt_ggc_mx_ipa_node_params_t (void *); +#define gt_ggc_m_38vec_ipcp_transformation_summary_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_ipcp_transformation_summary_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_ipcp_transformation_summary_va_gc_ (void *); +#define gt_ggc_m_24vec_ipa_edge_args_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_ipa_edge_args_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_ipa_edge_args_va_gc_ (void *); +#define gt_ggc_m_29hash_table_tm_wrapper_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_tm_wrapper_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_tm_wrapper_hasher_ (void *); +#define gt_ggc_m_29hash_table_decl_state_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_decl_state_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_decl_state_hasher_ (void *); +#define gt_ggc_m_20vec_condition_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_condition_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_condition_va_gc_ (void *); +#define gt_ggc_m_26vec_size_time_entry_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_size_time_entry_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_size_time_entry_va_gc_ (void *); +#define gt_ggc_m_33function_summary_inline_summary__(X) do { \ + if (X != NULL) gt_ggc_mx_function_summary_inline_summary__ (X);\ + } while (0) +extern void gt_ggc_mx_function_summary_inline_summary__ (void *); +#define gt_ggc_m_13tree_type_map(X) do { \ + if (X != NULL) gt_ggc_mx_tree_type_map (X);\ + } while (0) +extern void gt_ggc_mx_tree_type_map (void *); +#define gt_ggc_m_38hash_table_tree_type_map_cache_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_tree_type_map_cache_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_tree_type_map_cache_hasher_ (void *); +#define gt_ggc_m_19vec_odr_type_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_odr_type_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_odr_type_va_gc_ (void *); +#define gt_ggc_m_38vec_hsa_decl_kernel_map_element_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_hsa_decl_kernel_map_element_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_hsa_decl_kernel_map_element_va_gc_ (void *); +#define gt_ggc_m_35hash_table_value_annotation_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_value_annotation_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_value_annotation_hasher_ (void *); +#define gt_ggc_m_27vec_Entity_Id_va_gc_atomic_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_Entity_Id_va_gc_atomic_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_Entity_Id_va_gc_atomic_ (void *); +#define gt_ggc_m_19tree_entity_vec_map(X) do { \ + if (X != NULL) gt_ggc_mx_tree_entity_vec_map (X);\ + } while (0) +extern void gt_ggc_mx_tree_entity_vec_map (void *); +#define gt_ggc_m_29hash_table_dummy_type_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_dummy_type_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_dummy_type_hasher_ (void *); +#define gt_ggc_m_11parm_attr_d(X) do { \ + if (X != NULL) gt_ggc_mx_parm_attr_d (X);\ + } while (0) +extern void gt_ggc_mx_parm_attr_d (void *); +#define gt_ggc_m_20vec_parm_attr_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_parm_attr_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_parm_attr_va_gc_ (void *); +#define gt_ggc_m_10stmt_group(X) do { \ + if (X != NULL) gt_ggc_mx_stmt_group (X);\ + } while (0) +extern void gt_ggc_mx_stmt_group (void *); +#define gt_ggc_m_9elab_info(X) do { \ + if (X != NULL) gt_ggc_mx_elab_info (X);\ + } while (0) +extern void gt_ggc_mx_elab_info (void *); +#define gt_ggc_m_18range_check_info_d(X) do { \ + if (X != NULL) gt_ggc_mx_range_check_info_d (X);\ + } while (0) +extern void gt_ggc_mx_range_check_info_d (void *); +#define gt_ggc_m_27vec_range_check_info_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_range_check_info_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_range_check_info_va_gc_ (void *); +#define gt_ggc_m_11loop_info_d(X) do { \ + if (X != NULL) gt_ggc_mx_loop_info_d (X);\ + } while (0) +extern void gt_ggc_mx_loop_info_d (void *); +#define gt_ggc_m_20vec_loop_info_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_loop_info_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_loop_info_va_gc_ (void *); +#define gt_ggc_m_18gnat_binding_level(X) do { \ + if (X != NULL) gt_ggc_mx_gnat_binding_level (X);\ + } while (0) +extern void gt_ggc_mx_gnat_binding_level (void *); +#define gt_ggc_m_13pad_type_hash(X) do { \ + if (X != NULL) gt_ggc_mx_pad_type_hash (X);\ + } while (0) +extern void gt_ggc_mx_pad_type_hash (void *); +#define gt_ggc_m_27hash_table_pad_type_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_pad_type_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_pad_type_hasher_ (void *); +#define gt_ggc_m_12c_label_vars(X) do { \ + if (X != NULL) gt_ggc_mx_c_label_vars (X);\ + } while (0) +extern void gt_ggc_mx_c_label_vars (void *); +#define gt_ggc_m_9c_binding(X) do { \ + if (X != NULL) gt_ggc_mx_c_binding (X);\ + } while (0) +extern void gt_ggc_mx_c_binding (void *); +#define gt_ggc_m_7c_scope(X) do { \ + if (X != NULL) gt_ggc_mx_c_scope (X);\ + } while (0) +extern void gt_ggc_mx_c_scope (void *); +#define gt_ggc_m_15c_goto_bindings(X) do { \ + if (X != NULL) gt_ggc_mx_c_goto_bindings (X);\ + } while (0) +extern void gt_ggc_mx_c_goto_bindings (void *); +#define gt_ggc_m_28vec_c_goto_bindings_p_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_c_goto_bindings_p_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_c_goto_bindings_p_va_gc_ (void *); +#define gt_ggc_m_15c_inline_static(X) do { \ + if (X != NULL) gt_ggc_mx_c_inline_static (X);\ + } while (0) +extern void gt_ggc_mx_c_inline_static (void *); +#define gt_ggc_m_18sorted_fields_type(X) do { \ + if (X != NULL) gt_ggc_mx_sorted_fields_type (X);\ + } while (0) +extern void gt_ggc_mx_sorted_fields_type (void *); +#define gt_ggc_m_25hash_table_c_type_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_c_type_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_c_type_hasher_ (void *); +#define gt_ggc_m_23vec_const_char_p_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_const_char_p_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_const_char_p_va_gc_ (void *); +#define gt_ggc_m_22vec_tree_gc_vec_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_tree_gc_vec_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_tree_gc_vec_va_gc_ (void *); +#define gt_ggc_m_11align_stack(X) do { \ + if (X != NULL) gt_ggc_mx_align_stack (X);\ + } while (0) +extern void gt_ggc_mx_align_stack (void *); +#define gt_ggc_m_23vec_pending_weak_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_pending_weak_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_pending_weak_va_gc_ (void *); +#define gt_ggc_m_31vec_pending_redefinition_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_pending_redefinition_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_pending_redefinition_va_gc_ (void *); +#define gt_ggc_m_9opt_stack(X) do { \ + if (X != NULL) gt_ggc_mx_opt_stack (X);\ + } while (0) +extern void gt_ggc_mx_opt_stack (void *); +#define gt_ggc_m_8c_parser(X) do { \ + if (X != NULL) gt_ggc_mx_c_parser (X);\ + } while (0) +extern void gt_ggc_mx_c_parser (void *); +#define gt_ggc_m_18vec_c_token_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_c_token_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_c_token_va_gc_ (void *); +#define gt_ggc_m_18vec_tinfo_s_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_tinfo_s_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_tinfo_s_va_gc_ (void *); +#define gt_ggc_m_11tinst_level(X) do { \ + if (X != NULL) gt_ggc_mx_tinst_level (X);\ + } while (0) +extern void gt_ggc_mx_tinst_level (void *); +#define gt_ggc_m_28hash_table_conv_type_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_conv_type_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_conv_type_hasher_ (void *); +#define gt_ggc_m_15binding_table_s(X) do { \ + if (X != NULL) gt_ggc_mx_binding_table_s (X);\ + } while (0) +extern void gt_ggc_mx_binding_table_s (void *); +#define gt_ggc_m_15binding_entry_s(X) do { \ + if (X != NULL) gt_ggc_mx_binding_entry_s (X);\ + } while (0) +extern void gt_ggc_mx_binding_entry_s (void *); +#define gt_ggc_m_11cxx_binding(X) do { \ + if (X != NULL) gt_ggc_mx_cxx_binding (X);\ + } while (0) +extern void gt_ggc_mx_cxx_binding (void *); +#define gt_ggc_m_16cp_binding_level(X) do { \ + if (X != NULL) gt_ggc_mx_cp_binding_level (X);\ + } while (0) +extern void gt_ggc_mx_cp_binding_level (void *); +#define gt_ggc_m_27vec_cp_class_binding_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_cp_class_binding_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_cp_class_binding_va_gc_ (void *); +#define gt_ggc_m_27vec_cp_label_binding_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_cp_label_binding_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_cp_label_binding_va_gc_ (void *); +#define gt_ggc_m_16cxx_int_tree_map(X) do { \ + if (X != NULL) gt_ggc_mx_cxx_int_tree_map (X);\ + } while (0) +extern void gt_ggc_mx_cxx_int_tree_map (void *); +#define gt_ggc_m_11saved_scope(X) do { \ + if (X != NULL) gt_ggc_mx_saved_scope (X);\ + } while (0) +extern void gt_ggc_mx_saved_scope (void *); +#define gt_ggc_m_14cp_token_cache(X) do { \ + if (X != NULL) gt_ggc_mx_cp_token_cache (X);\ + } while (0) +extern void gt_ggc_mx_cp_token_cache (void *); +#define gt_ggc_m_36vec_qualified_typedef_usage_t_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_qualified_typedef_usage_t_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_qualified_typedef_usage_t_va_gc_ (void *); +#define gt_ggc_m_28vec_cxx_saved_binding_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_cxx_saved_binding_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_cxx_saved_binding_va_gc_ (void *); +#define gt_ggc_m_17named_label_entry(X) do { \ + if (X != NULL) gt_ggc_mx_named_label_entry (X);\ + } while (0) +extern void gt_ggc_mx_named_label_entry (void *); +#define gt_ggc_m_30hash_table_named_label_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_named_label_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_named_label_hasher_ (void *); +#define gt_ggc_m_35hash_table_cxx_int_tree_map_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_cxx_int_tree_map_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_cxx_int_tree_map_hasher_ (void *); +#define gt_ggc_m_22vec_tree_pair_s_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_tree_pair_s_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_tree_pair_s_va_gc_ (void *); +#define gt_ggc_m_21named_label_use_entry(X) do { \ + if (X != NULL) gt_ggc_mx_named_label_use_entry (X);\ + } while (0) +extern void gt_ggc_mx_named_label_use_entry (void *); +#define gt_ggc_m_25vec_incomplete_var_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_incomplete_var_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_incomplete_var_va_gc_ (void *); +#define gt_ggc_m_27hash_table_typename_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_typename_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_typename_hasher_ (void *); +#define gt_ggc_m_16pending_template(X) do { \ + if (X != NULL) gt_ggc_mx_pending_template (X);\ + } while (0) +extern void gt_ggc_mx_pending_template (void *); +#define gt_ggc_m_10spec_entry(X) do { \ + if (X != NULL) gt_ggc_mx_spec_entry (X);\ + } while (0) +extern void gt_ggc_mx_spec_entry (void *); +#define gt_ggc_m_23hash_table_spec_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_spec_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_spec_hasher_ (void *); +#define gt_ggc_m_12constr_entry(X) do { \ + if (X != NULL) gt_ggc_mx_constr_entry (X);\ + } while (0) +extern void gt_ggc_mx_constr_entry (void *); +#define gt_ggc_m_25hash_table_constr_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_constr_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_constr_hasher_ (void *); +#define gt_ggc_m_20constraint_sat_entry(X) do { \ + if (X != NULL) gt_ggc_mx_constraint_sat_entry (X);\ + } while (0) +extern void gt_ggc_mx_constraint_sat_entry (void *); +#define gt_ggc_m_18concept_spec_entry(X) do { \ + if (X != NULL) gt_ggc_mx_concept_spec_entry (X);\ + } while (0) +extern void gt_ggc_mx_concept_spec_entry (void *); +#define gt_ggc_m_33hash_table_constraint_sat_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_constraint_sat_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_constraint_sat_hasher_ (void *); +#define gt_ggc_m_31hash_table_concept_spec_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_concept_spec_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_concept_spec_hasher_ (void *); +#define gt_ggc_m_17subsumption_entry(X) do { \ + if (X != NULL) gt_ggc_mx_subsumption_entry (X);\ + } while (0) +extern void gt_ggc_mx_subsumption_entry (void *); +#define gt_ggc_m_30hash_table_subsumption_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_subsumption_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_subsumption_hasher_ (void *); +#define gt_ggc_m_32vec_deferred_access_check_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_deferred_access_check_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_deferred_access_check_va_gc_ (void *); +#define gt_ggc_m_26vec_deferred_access_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_deferred_access_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_deferred_access_va_gc_ (void *); +#define gt_ggc_m_30hash_table_cplus_array_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_cplus_array_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_cplus_array_hasher_ (void *); +#define gt_ggc_m_23hash_table_list_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_list_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_list_hasher_ (void *); +#define gt_ggc_m_10tree_check(X) do { \ + if (X != NULL) gt_ggc_mx_tree_check (X);\ + } while (0) +extern void gt_ggc_mx_tree_check (void *); +#define gt_ggc_m_19vec_cp_token_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_cp_token_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_cp_token_va_gc_ (void *); +#define gt_ggc_m_8cp_lexer(X) do { \ + if (X != NULL) gt_ggc_mx_cp_lexer (X);\ + } while (0) +extern void gt_ggc_mx_cp_lexer (void *); +#define gt_ggc_m_31vec_cp_default_arg_entry_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_cp_default_arg_entry_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_cp_default_arg_entry_va_gc_ (void *); +#define gt_ggc_m_17cp_parser_context(X) do { \ + if (X != NULL) gt_ggc_mx_cp_parser_context (X);\ + } while (0) +extern void gt_ggc_mx_cp_parser_context (void *); +#define gt_ggc_m_38vec_cp_unparsed_functions_entry_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_cp_unparsed_functions_entry_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_cp_unparsed_functions_entry_va_gc_ (void *); +#define gt_ggc_m_9cp_parser(X) do { \ + if (X != NULL) gt_ggc_mx_cp_parser (X);\ + } while (0) +extern void gt_ggc_mx_cp_parser (void *); +#define gt_ggc_m_19vec_tree_int_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_tree_int_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_tree_int_va_gc_ (void *); +#define gt_ggc_m_21pending_abstract_type(X) do { \ + if (X != NULL) gt_ggc_mx_pending_abstract_type (X);\ + } while (0) +extern void gt_ggc_mx_pending_abstract_type (void *); +#define gt_ggc_m_32hash_table_abstract_type_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_abstract_type_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_abstract_type_hasher_ (void *); +#define gt_ggc_m_29hash_table_debug_type_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_debug_type_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_debug_type_hasher_ (void *); +#define gt_ggc_m_27vec_pending_noexcept_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_pending_noexcept_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_pending_noexcept_va_gc_ (void *); +#define gt_ggc_m_16constexpr_fundef(X) do { \ + if (X != NULL) gt_ggc_mx_constexpr_fundef (X);\ + } while (0) +extern void gt_ggc_mx_constexpr_fundef (void *); +#define gt_ggc_m_35hash_table_constexpr_fundef_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_constexpr_fundef_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_constexpr_fundef_hasher_ (void *); +#define gt_ggc_m_14constexpr_call(X) do { \ + if (X != NULL) gt_ggc_mx_constexpr_call (X);\ + } while (0) +extern void gt_ggc_mx_constexpr_call (void *); +#define gt_ggc_m_33hash_table_constexpr_call_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_constexpr_call_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_constexpr_call_hasher_ (void *); +#define gt_ggc_m_13binding_level(X) do { \ + if (X != NULL) gt_ggc_mx_binding_level (X);\ + } while (0) +extern void gt_ggc_mx_binding_level (void *); +#define gt_ggc_m_25hash_table_module_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_module_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_module_hasher_ (void *); +#define gt_ggc_m_17module_htab_entry(X) do { \ + if (X != NULL) gt_ggc_mx_module_htab_entry (X);\ + } while (0) +extern void gt_ggc_mx_module_htab_entry (void *); +#define gt_ggc_m_30hash_table_module_decl_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_module_decl_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_module_decl_hasher_ (void *); +#define gt_ggc_m_16objc_map_private(X) do { \ + if (X != NULL) gt_ggc_mx_objc_map_private (X);\ + } while (0) +extern void gt_ggc_mx_objc_map_private (void *); +#define gt_ggc_m_12hashed_entry(X) do { \ + if (X != NULL) gt_ggc_mx_hashed_entry (X);\ + } while (0) +extern void gt_ggc_mx_hashed_entry (void *); +#define gt_ggc_m_16hashed_attribute(X) do { \ + if (X != NULL) gt_ggc_mx_hashed_attribute (X);\ + } while (0) +extern void gt_ggc_mx_hashed_attribute (void *); +#define gt_ggc_m_9imp_entry(X) do { \ + if (X != NULL) gt_ggc_mx_imp_entry (X);\ + } while (0) +extern void gt_ggc_mx_imp_entry (void *); +#define gt_ggc_m_17string_descriptor(X) do { \ + if (X != NULL) gt_ggc_mx_string_descriptor (X);\ + } while (0) +extern void gt_ggc_mx_string_descriptor (void *); +#define gt_ggc_m_30hash_table_objc_string_hasher_(X) do { \ + if (X != NULL) gt_ggc_mx_hash_table_objc_string_hasher_ (X);\ + } while (0) +extern void gt_ggc_mx_hash_table_objc_string_hasher_ (void *); +#define gt_ggc_m_27vec_ident_data_tuple_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_ident_data_tuple_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_ident_data_tuple_va_gc_ (void *); +#define gt_ggc_m_23vec_msgref_entry_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_msgref_entry_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_msgref_entry_va_gc_ (void *); +#define gt_ggc_m_26vec_prot_list_entry_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_prot_list_entry_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_prot_list_entry_va_gc_ (void *); +#define gt_ggc_m_24vec_ivarref_entry_va_gc_(X) do { \ + if (X != NULL) gt_ggc_mx_vec_ivarref_entry_va_gc_ (X);\ + } while (0) +extern void gt_ggc_mx_vec_ivarref_entry_va_gc_ (void *); + +/* functions code */ + +/* PCH type-walking procedures. */ +/* Macros and declarations. */ +#define gt_pch_n_9tree_node(X) do { \ + if (X != NULL) gt_pch_nx_tree_node (X);\ + } while (0) +#define gt_pch_nx_tree_node gt_pch_nx_lang_tree_node +#define gt_pch_n_9line_maps(X) do { \ + if (X != NULL) gt_pch_nx_line_maps (X);\ + } while (0) +extern void gt_pch_nx_line_maps (void *); +#define gt_pch_n_9cpp_token(X) do { \ + if (X != NULL) gt_pch_nx_cpp_token (X);\ + } while (0) +extern void gt_pch_nx_cpp_token (void *); +#define gt_pch_n_9cpp_macro(X) do { \ + if (X != NULL) gt_pch_nx_cpp_macro (X);\ + } while (0) +extern void gt_pch_nx_cpp_macro (void *); +#define gt_pch_n_6answer(X) do { \ + if (X != NULL) gt_pch_nx_answer (X);\ + } while (0) +extern void gt_pch_nx_answer (void *); +#define gt_pch_n_13string_concat(X) do { \ + if (X != NULL) gt_pch_nx_string_concat (X);\ + } while (0) +extern void gt_pch_nx_string_concat (void *); +#define gt_pch_n_16string_concat_db(X) do { \ + if (X != NULL) gt_pch_nx_string_concat_db (X);\ + } while (0) +extern void gt_pch_nx_string_concat_db (void *); +#define gt_pch_n_38hash_map_location_hash_string_concat__(X) do { \ + if (X != NULL) gt_pch_nx_hash_map_location_hash_string_concat__ (X);\ + } while (0) +extern void gt_pch_nx_hash_map_location_hash_string_concat__ (void *); +#define gt_pch_n_11bitmap_head(X) do { \ + if (X != NULL) gt_pch_nx_bitmap_head (X);\ + } while (0) +extern void gt_pch_nx_bitmap_head (void *); +#define gt_pch_n_7rtx_def(X) do { \ + if (X != NULL) gt_pch_nx_rtx_def (X);\ + } while (0) +extern void gt_pch_nx_rtx_def (void *); +#define gt_pch_n_9rtvec_def(X) do { \ + if (X != NULL) gt_pch_nx_rtvec_def (X);\ + } while (0) +extern void gt_pch_nx_rtvec_def (void *); +#define gt_pch_n_6gimple(X) do { \ + if (X != NULL) gt_pch_nx_gimple (X);\ + } while (0) +extern void gt_pch_nx_gimple (void *); +#define gt_pch_n_7section(X) do { \ + if (X != NULL) gt_pch_nx_section (X);\ + } while (0) +extern void gt_pch_nx_section (void *); +#define gt_pch_n_16cl_target_option(X) do { \ + if (X != NULL) gt_pch_nx_cl_target_option (X);\ + } while (0) +extern void gt_pch_nx_cl_target_option (void *); +#define gt_pch_n_15cl_optimization(X) do { \ + if (X != NULL) gt_pch_nx_cl_optimization (X);\ + } while (0) +extern void gt_pch_nx_cl_optimization (void *); +#define gt_pch_n_8edge_def(X) do { \ + if (X != NULL) gt_pch_nx_edge_def (X);\ + } while (0) +extern void gt_pch_nx_edge_def (void *); +#define gt_pch_n_15basic_block_def(X) do { \ + if (X != NULL) gt_pch_nx_basic_block_def (X);\ + } while (0) +extern void gt_pch_nx_basic_block_def (void *); +#define gt_pch_n_14target_globals(X) do { \ + if (X != NULL) gt_pch_nx_target_globals (X);\ + } while (0) +extern void gt_pch_nx_target_globals (void *); +#define gt_pch_n_16machine_function(X) do { \ + if (X != NULL) gt_pch_nx_machine_function (X);\ + } while (0) +extern void gt_pch_nx_machine_function (void *); +#define gt_pch_n_14bitmap_element(X) do { \ + if (X != NULL) gt_pch_nx_bitmap_element (X);\ + } while (0) +extern void gt_pch_nx_bitmap_element (void *); +#define gt_pch_n_14bitmap_obstack(X) do { \ + if (X != NULL) gt_pch_nx_bitmap_obstack (X);\ + } while (0) +extern void gt_pch_nx_bitmap_obstack (void *); +#define gt_pch_n_34generic_wide_int_wide_int_storage_(X) do { \ + if (X != NULL) gt_pch_nx_generic_wide_int_wide_int_storage_ (X);\ + } while (0) +extern void gt_pch_nx_generic_wide_int_wide_int_storage_ (void *); +#define gt_pch_n_13coverage_data(X) do { \ + if (X != NULL) gt_pch_nx_coverage_data (X);\ + } while (0) +extern void gt_pch_nx_coverage_data (void *); +#define gt_pch_n_9mem_attrs(X) do { \ + if (X != NULL) gt_pch_nx_mem_attrs (X);\ + } while (0) +extern void gt_pch_nx_mem_attrs (void *); +#define gt_pch_n_9reg_attrs(X) do { \ + if (X != NULL) gt_pch_nx_reg_attrs (X);\ + } while (0) +extern void gt_pch_nx_reg_attrs (void *); +#define gt_pch_n_12object_block(X) do { \ + if (X != NULL) gt_pch_nx_object_block (X);\ + } while (0) +extern void gt_pch_nx_object_block (void *); +#define gt_pch_n_14vec_rtx_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_rtx_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_rtx_va_gc_ (void *); +#define gt_pch_n_10real_value(X) do { \ + if (X != NULL) gt_pch_nx_real_value (X);\ + } while (0) +extern void gt_pch_nx_real_value (void *); +#define gt_pch_n_11fixed_value(X) do { \ + if (X != NULL) gt_pch_nx_fixed_value (X);\ + } while (0) +extern void gt_pch_nx_fixed_value (void *); +#define gt_pch_n_23constant_descriptor_rtx(X) do { \ + if (X != NULL) gt_pch_nx_constant_descriptor_rtx (X);\ + } while (0) +extern void gt_pch_nx_constant_descriptor_rtx (void *); +#define gt_pch_n_8function(X) do { \ + if (X != NULL) gt_pch_nx_function (X);\ + } while (0) +extern void gt_pch_nx_function (void *); +#define gt_pch_n_10target_rtl(X) do { \ + if (X != NULL) gt_pch_nx_target_rtl (X);\ + } while (0) +extern void gt_pch_nx_target_rtl (void *); +#define gt_pch_n_15cgraph_rtl_info(X) do { \ + if (X != NULL) gt_pch_nx_cgraph_rtl_info (X);\ + } while (0) +extern void gt_pch_nx_cgraph_rtl_info (void *); +#define gt_pch_n_12ptr_info_def(X) do { \ + if (X != NULL) gt_pch_nx_ptr_info_def (X);\ + } while (0) +extern void gt_pch_nx_ptr_info_def (void *); +#define gt_pch_n_14range_info_def(X) do { \ + if (X != NULL) gt_pch_nx_range_info_def (X);\ + } while (0) +extern void gt_pch_nx_range_info_def (void *); +#define gt_pch_n_10die_struct(X) do { \ + if (X != NULL) gt_pch_nx_die_struct (X);\ + } while (0) +extern void gt_pch_nx_die_struct (void *); +#define gt_pch_n_26vec_constructor_elt_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_constructor_elt_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_constructor_elt_va_gc_ (void *); +#define gt_pch_n_15vec_tree_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_tree_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_tree_va_gc_ (void *); +#define gt_pch_n_9lang_type(X) do { \ + if (X != NULL) gt_pch_nx_lang_type (X);\ + } while (0) +extern void gt_pch_nx_lang_type (void *); +#define gt_pch_n_9lang_decl(X) do { \ + if (X != NULL) gt_pch_nx_lang_decl (X);\ + } while (0) +extern void gt_pch_nx_lang_decl (void *); +#define gt_pch_n_11symtab_node(X) do { \ + if (X != NULL) gt_pch_nx_symtab_node (X);\ + } while (0) +extern void gt_pch_nx_symtab_node (void *); +#define gt_pch_n_24tree_statement_list_node(X) do { \ + if (X != NULL) gt_pch_nx_tree_statement_list_node (X);\ + } while (0) +extern void gt_pch_nx_tree_statement_list_node (void *); +#define gt_pch_n_14lang_tree_node(X) do { \ + if (X != NULL) gt_pch_nx_lang_tree_node (X);\ + } while (0) +extern void gt_pch_nx_lang_tree_node (void *); +#define gt_pch_n_8tree_map(X) do { \ + if (X != NULL) gt_pch_nx_tree_map (X);\ + } while (0) +extern void gt_pch_nx_tree_map (void *); +#define gt_pch_n_13tree_decl_map(X) do { \ + if (X != NULL) gt_pch_nx_tree_decl_map (X);\ + } while (0) +extern void gt_pch_nx_tree_decl_map (void *); +#define gt_pch_n_12tree_int_map(X) do { \ + if (X != NULL) gt_pch_nx_tree_int_map (X);\ + } while (0) +extern void gt_pch_nx_tree_int_map (void *); +#define gt_pch_n_12tree_vec_map(X) do { \ + if (X != NULL) gt_pch_nx_tree_vec_map (X);\ + } while (0) +extern void gt_pch_nx_tree_vec_map (void *); +#define gt_pch_n_21vec_alias_pair_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_alias_pair_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_alias_pair_va_gc_ (void *); +#define gt_pch_n_13libfunc_entry(X) do { \ + if (X != NULL) gt_pch_nx_libfunc_entry (X);\ + } while (0) +extern void gt_pch_nx_libfunc_entry (void *); +#define gt_pch_n_26hash_table_libfunc_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_libfunc_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_libfunc_hasher_ (void *); +#define gt_pch_n_15target_libfuncs(X) do { \ + if (X != NULL) gt_pch_nx_target_libfuncs (X);\ + } while (0) +extern void gt_pch_nx_target_libfuncs (void *); +#define gt_pch_n_14sequence_stack(X) do { \ + if (X != NULL) gt_pch_nx_sequence_stack (X);\ + } while (0) +extern void gt_pch_nx_sequence_stack (void *); +#define gt_pch_n_20vec_rtx_insn__va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_rtx_insn__va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_rtx_insn__va_gc_ (void *); +#define gt_pch_n_18call_site_record_d(X) do { \ + if (X != NULL) gt_pch_nx_call_site_record_d (X);\ + } while (0) +extern void gt_pch_nx_call_site_record_d (void *); +#define gt_pch_n_16vec_uchar_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_uchar_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_uchar_va_gc_ (void *); +#define gt_pch_n_27vec_call_site_record_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_call_site_record_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_call_site_record_va_gc_ (void *); +#define gt_pch_n_9gimple_df(X) do { \ + if (X != NULL) gt_pch_nx_gimple_df (X);\ + } while (0) +extern void gt_pch_nx_gimple_df (void *); +#define gt_pch_n_11dw_fde_node(X) do { \ + if (X != NULL) gt_pch_nx_dw_fde_node (X);\ + } while (0) +extern void gt_pch_nx_dw_fde_node (void *); +#define gt_pch_n_17rtx_constant_pool(X) do { \ + if (X != NULL) gt_pch_nx_rtx_constant_pool (X);\ + } while (0) +extern void gt_pch_nx_rtx_constant_pool (void *); +#define gt_pch_n_11frame_space(X) do { \ + if (X != NULL) gt_pch_nx_frame_space (X);\ + } while (0) +extern void gt_pch_nx_frame_space (void *); +#define gt_pch_n_11stack_usage(X) do { \ + if (X != NULL) gt_pch_nx_stack_usage (X);\ + } while (0) +extern void gt_pch_nx_stack_usage (void *); +#define gt_pch_n_9eh_status(X) do { \ + if (X != NULL) gt_pch_nx_eh_status (X);\ + } while (0) +extern void gt_pch_nx_eh_status (void *); +#define gt_pch_n_18control_flow_graph(X) do { \ + if (X != NULL) gt_pch_nx_control_flow_graph (X);\ + } while (0) +extern void gt_pch_nx_control_flow_graph (void *); +#define gt_pch_n_5loops(X) do { \ + if (X != NULL) gt_pch_nx_loops (X);\ + } while (0) +extern void gt_pch_nx_loops (void *); +#define gt_pch_n_17language_function(X) do { \ + if (X != NULL) gt_pch_nx_language_function (X);\ + } while (0) +extern void gt_pch_nx_language_function (void *); +#define gt_pch_n_14hash_set_tree_(X) do { \ + if (X != NULL) gt_pch_nx_hash_set_tree_ (X);\ + } while (0) +extern void gt_pch_nx_hash_set_tree_ (void *); +#define gt_pch_n_24types_used_by_vars_entry(X) do { \ + if (X != NULL) gt_pch_nx_types_used_by_vars_entry (X);\ + } while (0) +extern void gt_pch_nx_types_used_by_vars_entry (void *); +#define gt_pch_n_28hash_table_used_type_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_used_type_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_used_type_hasher_ (void *); +#define gt_pch_n_13nb_iter_bound(X) do { \ + if (X != NULL) gt_pch_nx_nb_iter_bound (X);\ + } while (0) +extern void gt_pch_nx_nb_iter_bound (void *); +#define gt_pch_n_9loop_exit(X) do { \ + if (X != NULL) gt_pch_nx_loop_exit (X);\ + } while (0) +extern void gt_pch_nx_loop_exit (void *); +#define gt_pch_n_4loop(X) do { \ + if (X != NULL) gt_pch_nx_loop (X);\ + } while (0) +extern void gt_pch_nx_loop (void *); +#define gt_pch_n_10control_iv(X) do { \ + if (X != NULL) gt_pch_nx_control_iv (X);\ + } while (0) +extern void gt_pch_nx_control_iv (void *); +#define gt_pch_n_17vec_loop_p_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_loop_p_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_loop_p_va_gc_ (void *); +#define gt_pch_n_10niter_desc(X) do { \ + if (X != NULL) gt_pch_nx_niter_desc (X);\ + } while (0) +extern void gt_pch_nx_niter_desc (void *); +#define gt_pch_n_28hash_table_loop_exit_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_loop_exit_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_loop_exit_hasher_ (void *); +#define gt_pch_n_22vec_basic_block_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_basic_block_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_basic_block_va_gc_ (void *); +#define gt_pch_n_11rtl_bb_info(X) do { \ + if (X != NULL) gt_pch_nx_rtl_bb_info (X);\ + } while (0) +extern void gt_pch_nx_rtl_bb_info (void *); +#define gt_pch_n_15vec_edge_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_edge_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_edge_va_gc_ (void *); +#define gt_pch_n_20vec_ipa_ref_t_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_ipa_ref_t_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_ipa_ref_t_va_gc_ (void *); +#define gt_pch_n_18section_hash_entry(X) do { \ + if (X != NULL) gt_pch_nx_section_hash_entry (X);\ + } while (0) +extern void gt_pch_nx_section_hash_entry (void *); +#define gt_pch_n_18lto_file_decl_data(X) do { \ + if (X != NULL) gt_pch_nx_lto_file_decl_data (X);\ + } while (0) +extern void gt_pch_nx_lto_file_decl_data (void *); +#define gt_pch_n_15ipa_replace_map(X) do { \ + if (X != NULL) gt_pch_nx_ipa_replace_map (X);\ + } while (0) +extern void gt_pch_nx_ipa_replace_map (void *); +#define gt_pch_n_27vec_ipa_replace_map__va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_ipa_replace_map__va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_ipa_replace_map__va_gc_ (void *); +#define gt_pch_n_17cgraph_simd_clone(X) do { \ + if (X != NULL) gt_pch_nx_cgraph_simd_clone (X);\ + } while (0) +extern void gt_pch_nx_cgraph_simd_clone (void *); +#define gt_pch_n_28cgraph_function_version_info(X) do { \ + if (X != NULL) gt_pch_nx_cgraph_function_version_info (X);\ + } while (0) +extern void gt_pch_nx_cgraph_function_version_info (void *); +#define gt_pch_n_11cgraph_edge(X) do { \ + if (X != NULL) gt_pch_nx_cgraph_edge (X);\ + } while (0) +extern void gt_pch_nx_cgraph_edge (void *); +#define gt_pch_n_30hash_table_cgraph_edge_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_cgraph_edge_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_cgraph_edge_hasher_ (void *); +#define gt_pch_n_25cgraph_indirect_call_info(X) do { \ + if (X != NULL) gt_pch_nx_cgraph_indirect_call_info (X);\ + } while (0) +extern void gt_pch_nx_cgraph_indirect_call_info (void *); +#define gt_pch_n_8asm_node(X) do { \ + if (X != NULL) gt_pch_nx_asm_node (X);\ + } while (0) +extern void gt_pch_nx_asm_node (void *); +#define gt_pch_n_12symbol_table(X) do { \ + if (X != NULL) gt_pch_nx_symbol_table (X);\ + } while (0) +extern void gt_pch_nx_symbol_table (void *); +#define gt_pch_n_31hash_table_section_name_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_section_name_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_section_name_hasher_ (void *); +#define gt_pch_n_26hash_table_asmname_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_asmname_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_asmname_hasher_ (void *); +#define gt_pch_n_42hash_map_symtab_node__symbol_priority_map_(X) do { \ + if (X != NULL) gt_pch_nx_hash_map_symtab_node__symbol_priority_map_ (X);\ + } while (0) +extern void gt_pch_nx_hash_map_symtab_node__symbol_priority_map_ (void *); +#define gt_pch_n_24constant_descriptor_tree(X) do { \ + if (X != NULL) gt_pch_nx_constant_descriptor_tree (X);\ + } while (0) +extern void gt_pch_nx_constant_descriptor_tree (void *); +#define gt_pch_n_28hash_map_alias_set_hash_int_(X) do { \ + if (X != NULL) gt_pch_nx_hash_map_alias_set_hash_int_ (X);\ + } while (0) +extern void gt_pch_nx_hash_map_alias_set_hash_int_ (void *); +#define gt_pch_n_15alias_set_entry(X) do { \ + if (X != NULL) gt_pch_nx_alias_set_entry (X);\ + } while (0) +extern void gt_pch_nx_alias_set_entry (void *); +#define gt_pch_n_27vec_alias_set_entry__va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_alias_set_entry__va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_alias_set_entry__va_gc_ (void *); +#define gt_pch_n_35hash_table_function_version_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_function_version_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_function_version_hasher_ (void *); +#define gt_pch_n_17lto_in_decl_state(X) do { \ + if (X != NULL) gt_pch_nx_lto_in_decl_state (X);\ + } while (0) +extern void gt_pch_nx_lto_in_decl_state (void *); +#define gt_pch_n_35hash_table_ipa_bit_ggc_hash_traits_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_ipa_bit_ggc_hash_traits_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_ipa_bit_ggc_hash_traits_ (void *); +#define gt_pch_n_34hash_table_ipa_vr_ggc_hash_traits_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_ipa_vr_ggc_hash_traits_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_ipa_vr_ggc_hash_traits_ (void *); +#define gt_pch_n_15ipa_node_params(X) do { \ + if (X != NULL) gt_pch_nx_ipa_node_params (X);\ + } while (0) +extern void gt_pch_nx_ipa_node_params (void *); +#define gt_pch_n_25ipa_agg_replacement_value(X) do { \ + if (X != NULL) gt_pch_nx_ipa_agg_replacement_value (X);\ + } while (0) +extern void gt_pch_nx_ipa_agg_replacement_value (void *); +#define gt_pch_n_14inline_summary(X) do { \ + if (X != NULL) gt_pch_nx_inline_summary (X);\ + } while (0) +extern void gt_pch_nx_inline_summary (void *); +#define gt_pch_n_10odr_type_d(X) do { \ + if (X != NULL) gt_pch_nx_odr_type_d (X);\ + } while (0) +extern void gt_pch_nx_odr_type_d (void *); +#define gt_pch_n_8typeinfo(X) do { \ + if (X != NULL) gt_pch_nx_typeinfo (X);\ + } while (0) +extern void gt_pch_nx_typeinfo (void *); +#define gt_pch_n_11dw_cfi_node(X) do { \ + if (X != NULL) gt_pch_nx_dw_cfi_node (X);\ + } while (0) +extern void gt_pch_nx_dw_cfi_node (void *); +#define gt_pch_n_17dw_loc_descr_node(X) do { \ + if (X != NULL) gt_pch_nx_dw_loc_descr_node (X);\ + } while (0) +extern void gt_pch_nx_dw_loc_descr_node (void *); +#define gt_pch_n_18dw_loc_list_struct(X) do { \ + if (X != NULL) gt_pch_nx_dw_loc_list_struct (X);\ + } while (0) +extern void gt_pch_nx_dw_loc_list_struct (void *); +#define gt_pch_n_18dw_discr_list_node(X) do { \ + if (X != NULL) gt_pch_nx_dw_discr_list_node (X);\ + } while (0) +extern void gt_pch_nx_dw_discr_list_node (void *); +#define gt_pch_n_21vec_dw_cfi_ref_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_dw_cfi_ref_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_dw_cfi_ref_va_gc_ (void *); +#define gt_pch_n_16addr_table_entry(X) do { \ + if (X != NULL) gt_pch_nx_addr_table_entry (X);\ + } while (0) +extern void gt_pch_nx_addr_table_entry (void *); +#define gt_pch_n_20indirect_string_node(X) do { \ + if (X != NULL) gt_pch_nx_indirect_string_node (X);\ + } while (0) +extern void gt_pch_nx_indirect_string_node (void *); +#define gt_pch_n_15dwarf_file_data(X) do { \ + if (X != NULL) gt_pch_nx_dwarf_file_data (X);\ + } while (0) +extern void gt_pch_nx_dwarf_file_data (void *); +#define gt_pch_n_20hash_map_char__tree_(X) do { \ + if (X != NULL) gt_pch_nx_hash_map_char__tree_ (X);\ + } while (0) +extern void gt_pch_nx_hash_map_char__tree_ (void *); +#define gt_pch_n_10dw_cfi_row(X) do { \ + if (X != NULL) gt_pch_nx_dw_cfi_row (X);\ + } while (0) +extern void gt_pch_nx_dw_cfi_row (void *); +#define gt_pch_n_17reg_saved_in_data(X) do { \ + if (X != NULL) gt_pch_nx_reg_saved_in_data (X);\ + } while (0) +extern void gt_pch_nx_reg_saved_in_data (void *); +#define gt_pch_n_21vec_dw_fde_ref_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_dw_fde_ref_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_dw_fde_ref_va_gc_ (void *); +#define gt_pch_n_34hash_table_indirect_string_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_indirect_string_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_indirect_string_hasher_ (void *); +#define gt_pch_n_16comdat_type_node(X) do { \ + if (X != NULL) gt_pch_nx_comdat_type_node (X);\ + } while (0) +extern void gt_pch_nx_comdat_type_node (void *); +#define gt_pch_n_29vec_dw_line_info_entry_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_dw_line_info_entry_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_dw_line_info_entry_va_gc_ (void *); +#define gt_pch_n_18dw_line_info_table(X) do { \ + if (X != NULL) gt_pch_nx_dw_line_info_table (X);\ + } while (0) +extern void gt_pch_nx_dw_line_info_table (void *); +#define gt_pch_n_23vec_dw_attr_node_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_dw_attr_node_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_dw_attr_node_va_gc_ (void *); +#define gt_pch_n_16limbo_die_struct(X) do { \ + if (X != NULL) gt_pch_nx_limbo_die_struct (X);\ + } while (0) +extern void gt_pch_nx_limbo_die_struct (void *); +#define gt_pch_n_29hash_table_dwarf_file_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_dwarf_file_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_dwarf_file_hasher_ (void *); +#define gt_pch_n_27hash_table_decl_die_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_decl_die_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_decl_die_hasher_ (void *); +#define gt_pch_n_21vec_dw_die_ref_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_dw_die_ref_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_dw_die_ref_va_gc_ (void *); +#define gt_pch_n_21variable_value_struct(X) do { \ + if (X != NULL) gt_pch_nx_variable_value_struct (X);\ + } while (0) +extern void gt_pch_nx_variable_value_struct (void *); +#define gt_pch_n_33hash_table_variable_value_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_variable_value_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_variable_value_hasher_ (void *); +#define gt_pch_n_28hash_table_block_die_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_block_die_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_block_die_hasher_ (void *); +#define gt_pch_n_12var_loc_node(X) do { \ + if (X != NULL) gt_pch_nx_var_loc_node (X);\ + } while (0) +extern void gt_pch_nx_var_loc_node (void *); +#define gt_pch_n_16var_loc_list_def(X) do { \ + if (X != NULL) gt_pch_nx_var_loc_list_def (X);\ + } while (0) +extern void gt_pch_nx_var_loc_list_def (void *); +#define gt_pch_n_17call_arg_loc_node(X) do { \ + if (X != NULL) gt_pch_nx_call_arg_loc_node (X);\ + } while (0) +extern void gt_pch_nx_call_arg_loc_node (void *); +#define gt_pch_n_27hash_table_decl_loc_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_decl_loc_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_decl_loc_hasher_ (void *); +#define gt_pch_n_22cached_dw_loc_list_def(X) do { \ + if (X != NULL) gt_pch_nx_cached_dw_loc_list_def (X);\ + } while (0) +extern void gt_pch_nx_cached_dw_loc_list_def (void *); +#define gt_pch_n_30hash_table_dw_loc_list_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_dw_loc_list_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_dw_loc_list_hasher_ (void *); +#define gt_pch_n_30vec_dw_line_info_table__va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_dw_line_info_table__va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_dw_line_info_table__va_gc_ (void *); +#define gt_pch_n_24vec_pubname_entry_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_pubname_entry_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_pubname_entry_va_gc_ (void *); +#define gt_pch_n_24vec_macinfo_entry_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_macinfo_entry_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_macinfo_entry_va_gc_ (void *); +#define gt_pch_n_20vec_dw_ranges_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_dw_ranges_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_dw_ranges_va_gc_ (void *); +#define gt_pch_n_29vec_dw_ranges_by_label_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_dw_ranges_by_label_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_dw_ranges_by_label_va_gc_ (void *); +#define gt_pch_n_24vec_die_arg_entry_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_die_arg_entry_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_die_arg_entry_va_gc_ (void *); +#define gt_pch_n_23hash_table_addr_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_addr_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_addr_hasher_ (void *); +#define gt_pch_n_9temp_slot(X) do { \ + if (X != NULL) gt_pch_nx_temp_slot (X);\ + } while (0) +extern void gt_pch_nx_temp_slot (void *); +#define gt_pch_n_20initial_value_struct(X) do { \ + if (X != NULL) gt_pch_nx_initial_value_struct (X);\ + } while (0) +extern void gt_pch_nx_initial_value_struct (void *); +#define gt_pch_n_22vec_temp_slot_p_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_temp_slot_p_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_temp_slot_p_va_gc_ (void *); +#define gt_pch_n_28hash_table_const_int_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_const_int_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_const_int_hasher_ (void *); +#define gt_pch_n_33hash_table_const_wide_int_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_const_wide_int_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_const_wide_int_hasher_ (void *); +#define gt_pch_n_27hash_table_reg_attr_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_reg_attr_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_reg_attr_hasher_ (void *); +#define gt_pch_n_31hash_table_const_double_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_const_double_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_const_double_hasher_ (void *); +#define gt_pch_n_30hash_table_const_fixed_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_const_fixed_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_const_fixed_hasher_ (void *); +#define gt_pch_n_11eh_region_d(X) do { \ + if (X != NULL) gt_pch_nx_eh_region_d (X);\ + } while (0) +extern void gt_pch_nx_eh_region_d (void *); +#define gt_pch_n_16eh_landing_pad_d(X) do { \ + if (X != NULL) gt_pch_nx_eh_landing_pad_d (X);\ + } while (0) +extern void gt_pch_nx_eh_landing_pad_d (void *); +#define gt_pch_n_10eh_catch_d(X) do { \ + if (X != NULL) gt_pch_nx_eh_catch_d (X);\ + } while (0) +extern void gt_pch_nx_eh_catch_d (void *); +#define gt_pch_n_20vec_eh_region_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_eh_region_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_eh_region_va_gc_ (void *); +#define gt_pch_n_25vec_eh_landing_pad_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_eh_landing_pad_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_eh_landing_pad_va_gc_ (void *); +#define gt_pch_n_21hash_map_gimple__int_(X) do { \ + if (X != NULL) gt_pch_nx_hash_map_gimple__int_ (X);\ + } while (0) +extern void gt_pch_nx_hash_map_gimple__int_ (void *); +#define gt_pch_n_29hash_table_insn_cache_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_insn_cache_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_insn_cache_hasher_ (void *); +#define gt_pch_n_23temp_slot_address_entry(X) do { \ + if (X != NULL) gt_pch_nx_temp_slot_address_entry (X);\ + } while (0) +extern void gt_pch_nx_temp_slot_address_entry (void *); +#define gt_pch_n_31hash_table_temp_address_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_temp_address_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_temp_address_hasher_ (void *); +#define gt_pch_n_24hash_map_tree_hash_tree_(X) do { \ + if (X != NULL) gt_pch_nx_hash_map_tree_hash_tree_ (X);\ + } while (0) +extern void gt_pch_nx_hash_map_tree_hash_tree_ (void *); +#define gt_pch_n_11test_struct(X) do { \ + if (X != NULL) gt_pch_nx_test_struct (X);\ + } while (0) +extern void gt_pch_nx_test_struct (void *); +#define gt_pch_n_14test_of_length(X) do { \ + if (X != NULL) gt_pch_nx_test_of_length (X);\ + } while (0) +extern void gt_pch_nx_test_of_length (void *); +#define gt_pch_n_10test_other(X) do { \ + if (X != NULL) gt_pch_nx_test_other (X);\ + } while (0) +extern void gt_pch_nx_test_other (void *); +#define gt_pch_n_13test_of_union(X) do { \ + if (X != NULL) gt_pch_nx_test_of_union (X);\ + } while (0) +extern void gt_pch_nx_test_of_union (void *); +#define gt_pch_n_12example_base(X) do { \ + if (X != NULL) gt_pch_nx_example_base (X);\ + } while (0) +extern void gt_pch_nx_example_base (void *); +#define gt_pch_n_9test_node(X) do { \ + if (X != NULL) gt_pch_nx_test_node (X);\ + } while (0) +extern void gt_pch_nx_test_node (void *); +#define gt_pch_n_11user_struct(X) do { \ + if (X != NULL) gt_pch_nx_user_struct (X);\ + } while (0) +extern void gt_pch_nx_user_struct (void *); +#define gt_pch_n_31hash_table_libfunc_decl_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_libfunc_decl_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_libfunc_decl_hasher_ (void *); +#define gt_pch_n_16string_pool_data(X) do { \ + if (X != NULL) gt_pch_nx_string_pool_data (X);\ + } while (0) +extern void gt_pch_nx_string_pool_data (void *); +#define gt_pch_n_9type_hash(X) do { \ + if (X != NULL) gt_pch_nx_type_hash (X);\ + } while (0) +extern void gt_pch_nx_type_hash (void *); +#define gt_pch_n_29hash_table_type_cache_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_type_cache_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_type_cache_hasher_ (void *); +#define gt_pch_n_26hash_table_int_cst_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_int_cst_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_int_cst_hasher_ (void *); +#define gt_pch_n_28hash_table_cl_option_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_cl_option_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_cl_option_hasher_ (void *); +#define gt_pch_n_38hash_table_tree_decl_map_cache_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_tree_decl_map_cache_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_tree_decl_map_cache_hasher_ (void *); +#define gt_pch_n_37hash_table_tree_vec_map_cache_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_tree_vec_map_cache_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_tree_vec_map_cache_hasher_ (void *); +#define gt_pch_n_26hash_table_section_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_section_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_section_hasher_ (void *); +#define gt_pch_n_31hash_table_object_block_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_object_block_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_object_block_hasher_ (void *); +#define gt_pch_n_34hash_table_tree_descriptor_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_tree_descriptor_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_tree_descriptor_hasher_ (void *); +#define gt_pch_n_33hash_table_const_rtx_desc_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_const_rtx_desc_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_const_rtx_desc_hasher_ (void *); +#define gt_pch_n_27hash_table_tm_clone_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_tm_clone_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_tm_clone_hasher_ (void *); +#define gt_pch_n_15tm_restart_node(X) do { \ + if (X != NULL) gt_pch_nx_tm_restart_node (X);\ + } while (0) +extern void gt_pch_nx_tm_restart_node (void *); +#define gt_pch_n_19hash_map_tree_tree_(X) do { \ + if (X != NULL) gt_pch_nx_hash_map_tree_tree_ (X);\ + } while (0) +extern void gt_pch_nx_hash_map_tree_tree_ (void *); +#define gt_pch_n_27hash_table_ssa_name_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_ssa_name_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_ssa_name_hasher_ (void *); +#define gt_pch_n_29hash_table_tm_restart_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_tm_restart_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_tm_restart_hasher_ (void *); +#define gt_pch_n_28vec_mem_addr_template_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_mem_addr_template_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_mem_addr_template_va_gc_ (void *); +#define gt_pch_n_13scev_info_str(X) do { \ + if (X != NULL) gt_pch_nx_scev_info_str (X);\ + } while (0) +extern void gt_pch_nx_scev_info_str (void *); +#define gt_pch_n_28hash_table_scev_info_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_scev_info_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_scev_info_hasher_ (void *); +#define gt_pch_n_20ssa_operand_memory_d(X) do { \ + if (X != NULL) gt_pch_nx_ssa_operand_memory_d (X);\ + } while (0) +extern void gt_pch_nx_ssa_operand_memory_d (void *); +#define gt_pch_n_28grid_launch_attributes_trees(X) do { \ + if (X != NULL) gt_pch_nx_grid_launch_attributes_trees (X);\ + } while (0) +extern void gt_pch_nx_grid_launch_attributes_trees (void *); +#define gt_pch_n_33hash_map_nofree_string_hash_bool_(X) do { \ + if (X != NULL) gt_pch_nx_hash_map_nofree_string_hash_bool_ (X);\ + } while (0) +extern void gt_pch_nx_hash_map_nofree_string_hash_bool_ (void *); +#define gt_pch_n_32hash_map_nofree_string_hash_rtx_(X) do { \ + if (X != NULL) gt_pch_nx_hash_map_nofree_string_hash_rtx_ (X);\ + } while (0) +extern void gt_pch_nx_hash_map_nofree_string_hash_rtx_ (void *); +#define gt_pch_n_18vec_gimple__va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_gimple__va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_gimple__va_gc_ (void *); +#define gt_pch_n_11value_range(X) do { \ + if (X != NULL) gt_pch_nx_value_range (X);\ + } while (0) +extern void gt_pch_nx_value_range (void *); +#define gt_pch_n_26vec_ipa_agg_jf_item_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_ipa_agg_jf_item_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_ipa_agg_jf_item_va_gc_ (void *); +#define gt_pch_n_8ipa_bits(X) do { \ + if (X != NULL) gt_pch_nx_ipa_bits (X);\ + } while (0) +extern void gt_pch_nx_ipa_bits (void *); +#define gt_pch_n_31vec_ipa_param_descriptor_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_ipa_param_descriptor_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_ipa_param_descriptor_va_gc_ (void *); +#define gt_pch_n_20vec_ipa_bits__va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_ipa_bits__va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_ipa_bits__va_gc_ (void *); +#define gt_pch_n_17vec_ipa_vr_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_ipa_vr_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_ipa_vr_va_gc_ (void *); +#define gt_pch_n_24vec_ipa_jump_func_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_ipa_jump_func_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_ipa_jump_func_va_gc_ (void *); +#define gt_pch_n_39vec_ipa_polymorphic_call_context_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_ipa_polymorphic_call_context_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_ipa_polymorphic_call_context_va_gc_ (void *); +#define gt_pch_n_17ipa_node_params_t(X) do { \ + if (X != NULL) gt_pch_nx_ipa_node_params_t (X);\ + } while (0) +extern void gt_pch_nx_ipa_node_params_t (void *); +#define gt_pch_n_38vec_ipcp_transformation_summary_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_ipcp_transformation_summary_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_ipcp_transformation_summary_va_gc_ (void *); +#define gt_pch_n_24vec_ipa_edge_args_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_ipa_edge_args_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_ipa_edge_args_va_gc_ (void *); +#define gt_pch_n_29hash_table_tm_wrapper_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_tm_wrapper_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_tm_wrapper_hasher_ (void *); +#define gt_pch_n_29hash_table_decl_state_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_decl_state_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_decl_state_hasher_ (void *); +#define gt_pch_n_20vec_condition_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_condition_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_condition_va_gc_ (void *); +#define gt_pch_n_26vec_size_time_entry_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_size_time_entry_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_size_time_entry_va_gc_ (void *); +#define gt_pch_n_33function_summary_inline_summary__(X) do { \ + if (X != NULL) gt_pch_nx_function_summary_inline_summary__ (X);\ + } while (0) +extern void gt_pch_nx_function_summary_inline_summary__ (void *); +#define gt_pch_n_13tree_type_map(X) do { \ + if (X != NULL) gt_pch_nx_tree_type_map (X);\ + } while (0) +extern void gt_pch_nx_tree_type_map (void *); +#define gt_pch_n_38hash_table_tree_type_map_cache_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_tree_type_map_cache_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_tree_type_map_cache_hasher_ (void *); +#define gt_pch_n_19vec_odr_type_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_odr_type_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_odr_type_va_gc_ (void *); +#define gt_pch_n_38vec_hsa_decl_kernel_map_element_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_hsa_decl_kernel_map_element_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_hsa_decl_kernel_map_element_va_gc_ (void *); +#define gt_pch_n_35hash_table_value_annotation_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_value_annotation_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_value_annotation_hasher_ (void *); +#define gt_pch_n_27vec_Entity_Id_va_gc_atomic_(X) do { \ + if (X != NULL) gt_pch_nx_vec_Entity_Id_va_gc_atomic_ (X);\ + } while (0) +extern void gt_pch_nx_vec_Entity_Id_va_gc_atomic_ (void *); +#define gt_pch_n_19tree_entity_vec_map(X) do { \ + if (X != NULL) gt_pch_nx_tree_entity_vec_map (X);\ + } while (0) +extern void gt_pch_nx_tree_entity_vec_map (void *); +#define gt_pch_n_29hash_table_dummy_type_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_dummy_type_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_dummy_type_hasher_ (void *); +#define gt_pch_n_11parm_attr_d(X) do { \ + if (X != NULL) gt_pch_nx_parm_attr_d (X);\ + } while (0) +extern void gt_pch_nx_parm_attr_d (void *); +#define gt_pch_n_20vec_parm_attr_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_parm_attr_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_parm_attr_va_gc_ (void *); +#define gt_pch_n_10stmt_group(X) do { \ + if (X != NULL) gt_pch_nx_stmt_group (X);\ + } while (0) +extern void gt_pch_nx_stmt_group (void *); +#define gt_pch_n_9elab_info(X) do { \ + if (X != NULL) gt_pch_nx_elab_info (X);\ + } while (0) +extern void gt_pch_nx_elab_info (void *); +#define gt_pch_n_18range_check_info_d(X) do { \ + if (X != NULL) gt_pch_nx_range_check_info_d (X);\ + } while (0) +extern void gt_pch_nx_range_check_info_d (void *); +#define gt_pch_n_27vec_range_check_info_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_range_check_info_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_range_check_info_va_gc_ (void *); +#define gt_pch_n_11loop_info_d(X) do { \ + if (X != NULL) gt_pch_nx_loop_info_d (X);\ + } while (0) +extern void gt_pch_nx_loop_info_d (void *); +#define gt_pch_n_20vec_loop_info_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_loop_info_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_loop_info_va_gc_ (void *); +#define gt_pch_n_18gnat_binding_level(X) do { \ + if (X != NULL) gt_pch_nx_gnat_binding_level (X);\ + } while (0) +extern void gt_pch_nx_gnat_binding_level (void *); +#define gt_pch_n_13pad_type_hash(X) do { \ + if (X != NULL) gt_pch_nx_pad_type_hash (X);\ + } while (0) +extern void gt_pch_nx_pad_type_hash (void *); +#define gt_pch_n_27hash_table_pad_type_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_pad_type_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_pad_type_hasher_ (void *); +#define gt_pch_n_12c_label_vars(X) do { \ + if (X != NULL) gt_pch_nx_c_label_vars (X);\ + } while (0) +extern void gt_pch_nx_c_label_vars (void *); +#define gt_pch_n_9c_binding(X) do { \ + if (X != NULL) gt_pch_nx_c_binding (X);\ + } while (0) +extern void gt_pch_nx_c_binding (void *); +#define gt_pch_n_7c_scope(X) do { \ + if (X != NULL) gt_pch_nx_c_scope (X);\ + } while (0) +extern void gt_pch_nx_c_scope (void *); +#define gt_pch_n_15c_goto_bindings(X) do { \ + if (X != NULL) gt_pch_nx_c_goto_bindings (X);\ + } while (0) +extern void gt_pch_nx_c_goto_bindings (void *); +#define gt_pch_n_28vec_c_goto_bindings_p_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_c_goto_bindings_p_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_c_goto_bindings_p_va_gc_ (void *); +#define gt_pch_n_15c_inline_static(X) do { \ + if (X != NULL) gt_pch_nx_c_inline_static (X);\ + } while (0) +extern void gt_pch_nx_c_inline_static (void *); +#define gt_pch_n_18sorted_fields_type(X) do { \ + if (X != NULL) gt_pch_nx_sorted_fields_type (X);\ + } while (0) +extern void gt_pch_nx_sorted_fields_type (void *); +#define gt_pch_n_25hash_table_c_type_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_c_type_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_c_type_hasher_ (void *); +#define gt_pch_n_23vec_const_char_p_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_const_char_p_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_const_char_p_va_gc_ (void *); +#define gt_pch_n_22vec_tree_gc_vec_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_tree_gc_vec_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_tree_gc_vec_va_gc_ (void *); +#define gt_pch_n_11align_stack(X) do { \ + if (X != NULL) gt_pch_nx_align_stack (X);\ + } while (0) +extern void gt_pch_nx_align_stack (void *); +#define gt_pch_n_23vec_pending_weak_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_pending_weak_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_pending_weak_va_gc_ (void *); +#define gt_pch_n_31vec_pending_redefinition_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_pending_redefinition_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_pending_redefinition_va_gc_ (void *); +#define gt_pch_n_9opt_stack(X) do { \ + if (X != NULL) gt_pch_nx_opt_stack (X);\ + } while (0) +extern void gt_pch_nx_opt_stack (void *); +#define gt_pch_n_8c_parser(X) do { \ + if (X != NULL) gt_pch_nx_c_parser (X);\ + } while (0) +extern void gt_pch_nx_c_parser (void *); +#define gt_pch_n_18vec_c_token_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_c_token_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_c_token_va_gc_ (void *); +#define gt_pch_n_18vec_tinfo_s_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_tinfo_s_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_tinfo_s_va_gc_ (void *); +#define gt_pch_n_11tinst_level(X) do { \ + if (X != NULL) gt_pch_nx_tinst_level (X);\ + } while (0) +extern void gt_pch_nx_tinst_level (void *); +#define gt_pch_n_28hash_table_conv_type_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_conv_type_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_conv_type_hasher_ (void *); +#define gt_pch_n_15binding_table_s(X) do { \ + if (X != NULL) gt_pch_nx_binding_table_s (X);\ + } while (0) +extern void gt_pch_nx_binding_table_s (void *); +#define gt_pch_n_15binding_entry_s(X) do { \ + if (X != NULL) gt_pch_nx_binding_entry_s (X);\ + } while (0) +extern void gt_pch_nx_binding_entry_s (void *); +#define gt_pch_n_11cxx_binding(X) do { \ + if (X != NULL) gt_pch_nx_cxx_binding (X);\ + } while (0) +extern void gt_pch_nx_cxx_binding (void *); +#define gt_pch_n_16cp_binding_level(X) do { \ + if (X != NULL) gt_pch_nx_cp_binding_level (X);\ + } while (0) +extern void gt_pch_nx_cp_binding_level (void *); +#define gt_pch_n_27vec_cp_class_binding_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_cp_class_binding_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_cp_class_binding_va_gc_ (void *); +#define gt_pch_n_27vec_cp_label_binding_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_cp_label_binding_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_cp_label_binding_va_gc_ (void *); +#define gt_pch_n_16cxx_int_tree_map(X) do { \ + if (X != NULL) gt_pch_nx_cxx_int_tree_map (X);\ + } while (0) +extern void gt_pch_nx_cxx_int_tree_map (void *); +#define gt_pch_n_11saved_scope(X) do { \ + if (X != NULL) gt_pch_nx_saved_scope (X);\ + } while (0) +extern void gt_pch_nx_saved_scope (void *); +#define gt_pch_n_14cp_token_cache(X) do { \ + if (X != NULL) gt_pch_nx_cp_token_cache (X);\ + } while (0) +extern void gt_pch_nx_cp_token_cache (void *); +#define gt_pch_n_36vec_qualified_typedef_usage_t_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_qualified_typedef_usage_t_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_qualified_typedef_usage_t_va_gc_ (void *); +#define gt_pch_n_28vec_cxx_saved_binding_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_cxx_saved_binding_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_cxx_saved_binding_va_gc_ (void *); +#define gt_pch_n_17named_label_entry(X) do { \ + if (X != NULL) gt_pch_nx_named_label_entry (X);\ + } while (0) +extern void gt_pch_nx_named_label_entry (void *); +#define gt_pch_n_30hash_table_named_label_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_named_label_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_named_label_hasher_ (void *); +#define gt_pch_n_35hash_table_cxx_int_tree_map_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_cxx_int_tree_map_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_cxx_int_tree_map_hasher_ (void *); +#define gt_pch_n_22vec_tree_pair_s_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_tree_pair_s_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_tree_pair_s_va_gc_ (void *); +#define gt_pch_n_21named_label_use_entry(X) do { \ + if (X != NULL) gt_pch_nx_named_label_use_entry (X);\ + } while (0) +extern void gt_pch_nx_named_label_use_entry (void *); +#define gt_pch_n_25vec_incomplete_var_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_incomplete_var_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_incomplete_var_va_gc_ (void *); +#define gt_pch_n_27hash_table_typename_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_typename_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_typename_hasher_ (void *); +#define gt_pch_n_16pending_template(X) do { \ + if (X != NULL) gt_pch_nx_pending_template (X);\ + } while (0) +extern void gt_pch_nx_pending_template (void *); +#define gt_pch_n_10spec_entry(X) do { \ + if (X != NULL) gt_pch_nx_spec_entry (X);\ + } while (0) +extern void gt_pch_nx_spec_entry (void *); +#define gt_pch_n_23hash_table_spec_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_spec_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_spec_hasher_ (void *); +#define gt_pch_n_12constr_entry(X) do { \ + if (X != NULL) gt_pch_nx_constr_entry (X);\ + } while (0) +extern void gt_pch_nx_constr_entry (void *); +#define gt_pch_n_25hash_table_constr_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_constr_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_constr_hasher_ (void *); +#define gt_pch_n_20constraint_sat_entry(X) do { \ + if (X != NULL) gt_pch_nx_constraint_sat_entry (X);\ + } while (0) +extern void gt_pch_nx_constraint_sat_entry (void *); +#define gt_pch_n_18concept_spec_entry(X) do { \ + if (X != NULL) gt_pch_nx_concept_spec_entry (X);\ + } while (0) +extern void gt_pch_nx_concept_spec_entry (void *); +#define gt_pch_n_33hash_table_constraint_sat_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_constraint_sat_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_constraint_sat_hasher_ (void *); +#define gt_pch_n_31hash_table_concept_spec_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_concept_spec_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_concept_spec_hasher_ (void *); +#define gt_pch_n_17subsumption_entry(X) do { \ + if (X != NULL) gt_pch_nx_subsumption_entry (X);\ + } while (0) +extern void gt_pch_nx_subsumption_entry (void *); +#define gt_pch_n_30hash_table_subsumption_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_subsumption_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_subsumption_hasher_ (void *); +#define gt_pch_n_32vec_deferred_access_check_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_deferred_access_check_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_deferred_access_check_va_gc_ (void *); +#define gt_pch_n_26vec_deferred_access_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_deferred_access_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_deferred_access_va_gc_ (void *); +#define gt_pch_n_30hash_table_cplus_array_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_cplus_array_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_cplus_array_hasher_ (void *); +#define gt_pch_n_23hash_table_list_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_list_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_list_hasher_ (void *); +#define gt_pch_n_10tree_check(X) do { \ + if (X != NULL) gt_pch_nx_tree_check (X);\ + } while (0) +extern void gt_pch_nx_tree_check (void *); +#define gt_pch_n_19vec_cp_token_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_cp_token_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_cp_token_va_gc_ (void *); +#define gt_pch_n_8cp_lexer(X) do { \ + if (X != NULL) gt_pch_nx_cp_lexer (X);\ + } while (0) +extern void gt_pch_nx_cp_lexer (void *); +#define gt_pch_n_31vec_cp_default_arg_entry_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_cp_default_arg_entry_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_cp_default_arg_entry_va_gc_ (void *); +#define gt_pch_n_17cp_parser_context(X) do { \ + if (X != NULL) gt_pch_nx_cp_parser_context (X);\ + } while (0) +extern void gt_pch_nx_cp_parser_context (void *); +#define gt_pch_n_38vec_cp_unparsed_functions_entry_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_cp_unparsed_functions_entry_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_cp_unparsed_functions_entry_va_gc_ (void *); +#define gt_pch_n_9cp_parser(X) do { \ + if (X != NULL) gt_pch_nx_cp_parser (X);\ + } while (0) +extern void gt_pch_nx_cp_parser (void *); +#define gt_pch_n_19vec_tree_int_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_tree_int_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_tree_int_va_gc_ (void *); +#define gt_pch_n_21pending_abstract_type(X) do { \ + if (X != NULL) gt_pch_nx_pending_abstract_type (X);\ + } while (0) +extern void gt_pch_nx_pending_abstract_type (void *); +#define gt_pch_n_32hash_table_abstract_type_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_abstract_type_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_abstract_type_hasher_ (void *); +#define gt_pch_n_29hash_table_debug_type_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_debug_type_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_debug_type_hasher_ (void *); +#define gt_pch_n_27vec_pending_noexcept_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_pending_noexcept_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_pending_noexcept_va_gc_ (void *); +#define gt_pch_n_16constexpr_fundef(X) do { \ + if (X != NULL) gt_pch_nx_constexpr_fundef (X);\ + } while (0) +extern void gt_pch_nx_constexpr_fundef (void *); +#define gt_pch_n_35hash_table_constexpr_fundef_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_constexpr_fundef_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_constexpr_fundef_hasher_ (void *); +#define gt_pch_n_14constexpr_call(X) do { \ + if (X != NULL) gt_pch_nx_constexpr_call (X);\ + } while (0) +extern void gt_pch_nx_constexpr_call (void *); +#define gt_pch_n_33hash_table_constexpr_call_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_constexpr_call_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_constexpr_call_hasher_ (void *); +#define gt_pch_n_13binding_level(X) do { \ + if (X != NULL) gt_pch_nx_binding_level (X);\ + } while (0) +extern void gt_pch_nx_binding_level (void *); +#define gt_pch_n_25hash_table_module_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_module_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_module_hasher_ (void *); +#define gt_pch_n_17module_htab_entry(X) do { \ + if (X != NULL) gt_pch_nx_module_htab_entry (X);\ + } while (0) +extern void gt_pch_nx_module_htab_entry (void *); +#define gt_pch_n_30hash_table_module_decl_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_module_decl_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_module_decl_hasher_ (void *); +#define gt_pch_n_16objc_map_private(X) do { \ + if (X != NULL) gt_pch_nx_objc_map_private (X);\ + } while (0) +extern void gt_pch_nx_objc_map_private (void *); +#define gt_pch_n_12hashed_entry(X) do { \ + if (X != NULL) gt_pch_nx_hashed_entry (X);\ + } while (0) +extern void gt_pch_nx_hashed_entry (void *); +#define gt_pch_n_16hashed_attribute(X) do { \ + if (X != NULL) gt_pch_nx_hashed_attribute (X);\ + } while (0) +extern void gt_pch_nx_hashed_attribute (void *); +#define gt_pch_n_9imp_entry(X) do { \ + if (X != NULL) gt_pch_nx_imp_entry (X);\ + } while (0) +extern void gt_pch_nx_imp_entry (void *); +#define gt_pch_n_17string_descriptor(X) do { \ + if (X != NULL) gt_pch_nx_string_descriptor (X);\ + } while (0) +extern void gt_pch_nx_string_descriptor (void *); +#define gt_pch_n_30hash_table_objc_string_hasher_(X) do { \ + if (X != NULL) gt_pch_nx_hash_table_objc_string_hasher_ (X);\ + } while (0) +extern void gt_pch_nx_hash_table_objc_string_hasher_ (void *); +#define gt_pch_n_27vec_ident_data_tuple_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_ident_data_tuple_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_ident_data_tuple_va_gc_ (void *); +#define gt_pch_n_23vec_msgref_entry_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_msgref_entry_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_msgref_entry_va_gc_ (void *); +#define gt_pch_n_26vec_prot_list_entry_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_prot_list_entry_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_prot_list_entry_va_gc_ (void *); +#define gt_pch_n_24vec_ivarref_entry_va_gc_(X) do { \ + if (X != NULL) gt_pch_nx_vec_ivarref_entry_va_gc_ (X);\ + } while (0) +extern void gt_pch_nx_vec_ivarref_entry_va_gc_ (void *); + +/* functions code */ + +/* Local pointer-walking routines. */ +#define gt_pch_p_9tree_node gt_pch_p_14lang_tree_node +extern void gt_pch_p_9line_maps + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9cpp_token + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9cpp_macro + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6answer + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_13string_concat + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16string_concat_db + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_38hash_map_location_hash_string_concat__ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11bitmap_head + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_7rtx_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_7rtx_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_7rtx_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_7rtx_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_7rtx_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_7rtx_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_7rtx_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_7rtx_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_7rtx_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_7rtx_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_7rtx_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_7rtx_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_7rtx_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9rtvec_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_7section + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16cl_target_option + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15cl_optimization + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_8edge_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15basic_block_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_14target_globals + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16machine_function + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_14bitmap_element + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_14bitmap_obstack + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_34generic_wide_int_wide_int_storage_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_13coverage_data + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9mem_attrs + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9reg_attrs + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_12object_block + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_14vec_rtx_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_10real_value + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11fixed_value + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_23constant_descriptor_rtx + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_8function + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_10target_rtl + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15cgraph_rtl_info + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_12ptr_info_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_14range_info_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_10die_struct + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_26vec_constructor_elt_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15vec_tree_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9lang_type + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9lang_decl + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11symtab_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_24tree_statement_list_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_14lang_tree_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_8tree_map + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_13tree_decl_map + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_12tree_int_map + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_12tree_vec_map + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_21vec_alias_pair_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_13libfunc_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_26hash_table_libfunc_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15target_libfuncs + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_14sequence_stack + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_20vec_rtx_insn__va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18call_site_record_d + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16vec_uchar_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_27vec_call_site_record_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9gimple_df + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11dw_fde_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17rtx_constant_pool + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11frame_space + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11stack_usage + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9eh_status + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18control_flow_graph + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_5loops + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17language_function + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_14hash_set_tree_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_24types_used_by_vars_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_28hash_table_used_type_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_13nb_iter_bound + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9loop_exit + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_4loop + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_10control_iv + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17vec_loop_p_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_10niter_desc + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_28hash_table_loop_exit_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_22vec_basic_block_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11rtl_bb_info + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15vec_edge_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11symtab_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11symtab_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_20vec_ipa_ref_t_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18section_hash_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18lto_file_decl_data + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15ipa_replace_map + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_27vec_ipa_replace_map__va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17cgraph_simd_clone + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_28cgraph_function_version_info + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11cgraph_edge + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_30hash_table_cgraph_edge_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_25cgraph_indirect_call_info + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_8asm_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_12symbol_table + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_31hash_table_section_name_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_26hash_table_asmname_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_42hash_map_symtab_node__symbol_priority_map_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_24constant_descriptor_tree + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_28hash_map_alias_set_hash_int_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15alias_set_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_27vec_alias_set_entry__va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_35hash_table_function_version_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17lto_in_decl_state + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_35hash_table_ipa_bit_ggc_hash_traits_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_34hash_table_ipa_vr_ggc_hash_traits_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15ipa_node_params + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_25ipa_agg_replacement_value + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_14inline_summary + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_10odr_type_d + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_8typeinfo + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11dw_cfi_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17dw_loc_descr_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18dw_loc_list_struct + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18dw_discr_list_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_21vec_dw_cfi_ref_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16addr_table_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_20indirect_string_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15dwarf_file_data + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_20hash_map_char__tree_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_10dw_cfi_row + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17reg_saved_in_data + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_21vec_dw_fde_ref_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_34hash_table_indirect_string_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16comdat_type_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_29vec_dw_line_info_entry_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18dw_line_info_table + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_23vec_dw_attr_node_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16limbo_die_struct + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_29hash_table_dwarf_file_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_27hash_table_decl_die_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_21vec_dw_die_ref_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_21variable_value_struct + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_33hash_table_variable_value_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_28hash_table_block_die_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_12var_loc_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16var_loc_list_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17call_arg_loc_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_27hash_table_decl_loc_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_22cached_dw_loc_list_def + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_30hash_table_dw_loc_list_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_30vec_dw_line_info_table__va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_24vec_pubname_entry_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_24vec_macinfo_entry_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_20vec_dw_ranges_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_29vec_dw_ranges_by_label_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_24vec_die_arg_entry_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_23hash_table_addr_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9temp_slot + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_20initial_value_struct + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_22vec_temp_slot_p_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_28hash_table_const_int_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_33hash_table_const_wide_int_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_27hash_table_reg_attr_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_31hash_table_const_double_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_30hash_table_const_fixed_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11eh_region_d + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16eh_landing_pad_d + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_10eh_catch_d + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_20vec_eh_region_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_25vec_eh_landing_pad_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_21hash_map_gimple__int_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_29hash_table_insn_cache_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_23temp_slot_address_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_31hash_table_temp_address_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_24hash_map_tree_hash_tree_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11test_struct + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_14test_of_length + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_10test_other + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_13test_of_union + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_12example_base + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_12example_base + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_12example_base + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9test_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11user_struct + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_31hash_table_libfunc_decl_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16string_pool_data + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9type_hash + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_29hash_table_type_cache_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_26hash_table_int_cst_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_28hash_table_cl_option_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_38hash_table_tree_decl_map_cache_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_37hash_table_tree_vec_map_cache_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_26hash_table_section_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_31hash_table_object_block_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_34hash_table_tree_descriptor_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_33hash_table_const_rtx_desc_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_27hash_table_tm_clone_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_6gimple + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15tm_restart_node + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_19hash_map_tree_tree_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_27hash_table_ssa_name_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_29hash_table_tm_restart_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_28vec_mem_addr_template_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_13scev_info_str + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_28hash_table_scev_info_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_20ssa_operand_memory_d + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_28grid_launch_attributes_trees + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_33hash_map_nofree_string_hash_bool_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_32hash_map_nofree_string_hash_rtx_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18vec_gimple__va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11value_range + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_26vec_ipa_agg_jf_item_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_8ipa_bits + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_31vec_ipa_param_descriptor_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_20vec_ipa_bits__va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17vec_ipa_vr_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_24vec_ipa_jump_func_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_39vec_ipa_polymorphic_call_context_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17ipa_node_params_t + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_38vec_ipcp_transformation_summary_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_24vec_ipa_edge_args_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_29hash_table_tm_wrapper_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_29hash_table_decl_state_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_20vec_condition_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_26vec_size_time_entry_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_33function_summary_inline_summary__ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_13tree_type_map + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_38hash_table_tree_type_map_cache_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_19vec_odr_type_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_38vec_hsa_decl_kernel_map_element_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_35hash_table_value_annotation_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_27vec_Entity_Id_va_gc_atomic_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_19tree_entity_vec_map + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_29hash_table_dummy_type_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11parm_attr_d + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_20vec_parm_attr_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_10stmt_group + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9elab_info + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18range_check_info_d + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_27vec_range_check_info_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11loop_info_d + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_20vec_loop_info_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18gnat_binding_level + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_13pad_type_hash + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_27hash_table_pad_type_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_12c_label_vars + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9c_binding + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_7c_scope + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15c_goto_bindings + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_28vec_c_goto_bindings_p_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15c_inline_static + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18sorted_fields_type + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_25hash_table_c_type_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_23vec_const_char_p_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_22vec_tree_gc_vec_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11align_stack + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_23vec_pending_weak_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_31vec_pending_redefinition_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9opt_stack + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_8c_parser + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18vec_c_token_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18vec_tinfo_s_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11tinst_level + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_28hash_table_conv_type_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15binding_table_s + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_15binding_entry_s + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11cxx_binding + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16cp_binding_level + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_27vec_cp_class_binding_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_27vec_cp_label_binding_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16cxx_int_tree_map + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_11saved_scope + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_14cp_token_cache + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_36vec_qualified_typedef_usage_t_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_28vec_cxx_saved_binding_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17named_label_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_30hash_table_named_label_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_35hash_table_cxx_int_tree_map_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_22vec_tree_pair_s_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_21named_label_use_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_25vec_incomplete_var_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_27hash_table_typename_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16pending_template + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_10spec_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_23hash_table_spec_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_12constr_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_25hash_table_constr_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_20constraint_sat_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_18concept_spec_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_33hash_table_constraint_sat_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_31hash_table_concept_spec_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17subsumption_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_30hash_table_subsumption_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_32vec_deferred_access_check_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_26vec_deferred_access_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_30hash_table_cplus_array_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_23hash_table_list_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_10tree_check + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_19vec_cp_token_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_8cp_lexer + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_31vec_cp_default_arg_entry_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17cp_parser_context + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_38vec_cp_unparsed_functions_entry_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9cp_parser + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_19vec_tree_int_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_21pending_abstract_type + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_32hash_table_abstract_type_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_29hash_table_debug_type_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_27vec_pending_noexcept_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16constexpr_fundef + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_35hash_table_constexpr_fundef_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_14constexpr_call + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_33hash_table_constexpr_call_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_13binding_level + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_25hash_table_module_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17module_htab_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_30hash_table_module_decl_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16objc_map_private + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_12hashed_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_16hashed_attribute + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_9imp_entry + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_17string_descriptor + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_30hash_table_objc_string_hasher_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_27vec_ident_data_tuple_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_23vec_msgref_entry_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_26vec_prot_list_entry_va_gc_ + (void *, void *, gt_pointer_operator, void *); +extern void gt_pch_p_24vec_ivarref_entry_va_gc_ + (void *, void *, gt_pointer_operator, void *); diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hard-reg-set.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hard-reg-set.h new file mode 100644 index 0000000..d5fc417 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hard-reg-set.h @@ -0,0 +1,773 @@ +/* Sets (bit vectors) of hard registers, and operations on them. + Copyright (C) 1987-2017 Free Software Foundation, Inc. + +This file is part of GCC + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_HARD_REG_SET_H +#define GCC_HARD_REG_SET_H + +/* Define the type of a set of hard registers. */ + +/* HARD_REG_ELT_TYPE is a typedef of the unsigned integral type which + will be used for hard reg sets, either alone or in an array. + + If HARD_REG_SET is a macro, its definition is HARD_REG_ELT_TYPE, + and it has enough bits to represent all the target machine's hard + registers. Otherwise, it is a typedef for a suitably sized array + of HARD_REG_ELT_TYPEs. HARD_REG_SET_LONGS is defined as how many. + + Note that lots of code assumes that the first part of a regset is + the same format as a HARD_REG_SET. To help make sure this is true, + we only try the widest fast integer mode (HOST_WIDEST_FAST_INT) + instead of all the smaller types. This approach loses only if + there are very few registers and then only in the few cases where + we have an array of HARD_REG_SETs, so it needn't be as complex as + it used to be. */ + +typedef unsigned HOST_WIDEST_FAST_INT HARD_REG_ELT_TYPE; + +#if FIRST_PSEUDO_REGISTER <= HOST_BITS_PER_WIDEST_FAST_INT + +#define HARD_REG_SET HARD_REG_ELT_TYPE + +#else + +#define HARD_REG_SET_LONGS \ + ((FIRST_PSEUDO_REGISTER + HOST_BITS_PER_WIDEST_FAST_INT - 1) \ + / HOST_BITS_PER_WIDEST_FAST_INT) +typedef HARD_REG_ELT_TYPE HARD_REG_SET[HARD_REG_SET_LONGS]; + +#endif + +/* HARD_REG_SET wrapped into a structure, to make it possible to + use HARD_REG_SET even in APIs that should not include + hard-reg-set.h. */ +struct hard_reg_set_container +{ + HARD_REG_SET set; +}; + +/* HARD_CONST is used to cast a constant to the appropriate type + for use with a HARD_REG_SET. */ + +#define HARD_CONST(X) ((HARD_REG_ELT_TYPE) (X)) + +/* Define macros SET_HARD_REG_BIT, CLEAR_HARD_REG_BIT and TEST_HARD_REG_BIT + to set, clear or test one bit in a hard reg set of type HARD_REG_SET. + All three take two arguments: the set and the register number. + + In the case where sets are arrays of longs, the first argument + is actually a pointer to a long. + + Define two macros for initializing a set: + CLEAR_HARD_REG_SET and SET_HARD_REG_SET. + These take just one argument. + + Also define macros for copying hard reg sets: + COPY_HARD_REG_SET and COMPL_HARD_REG_SET. + These take two arguments TO and FROM; they read from FROM + and store into TO. COMPL_HARD_REG_SET complements each bit. + + Also define macros for combining hard reg sets: + IOR_HARD_REG_SET and AND_HARD_REG_SET. + These take two arguments TO and FROM; they read from FROM + and combine bitwise into TO. Define also two variants + IOR_COMPL_HARD_REG_SET and AND_COMPL_HARD_REG_SET + which use the complement of the set FROM. + + Also define: + + hard_reg_set_subset_p (X, Y), which returns true if X is a subset of Y. + hard_reg_set_equal_p (X, Y), which returns true if X and Y are equal. + hard_reg_set_intersect_p (X, Y), which returns true if X and Y intersect. + hard_reg_set_empty_p (X), which returns true if X is empty. */ + +#define UHOST_BITS_PER_WIDE_INT ((unsigned) HOST_BITS_PER_WIDEST_FAST_INT) + +#ifdef HARD_REG_SET + +#define SET_HARD_REG_BIT(SET, BIT) \ + ((SET) |= HARD_CONST (1) << (BIT)) +#define CLEAR_HARD_REG_BIT(SET, BIT) \ + ((SET) &= ~(HARD_CONST (1) << (BIT))) +#define TEST_HARD_REG_BIT(SET, BIT) \ + (!!((SET) & (HARD_CONST (1) << (BIT)))) + +#define CLEAR_HARD_REG_SET(TO) ((TO) = HARD_CONST (0)) +#define SET_HARD_REG_SET(TO) ((TO) = ~ HARD_CONST (0)) + +#define COPY_HARD_REG_SET(TO, FROM) ((TO) = (FROM)) +#define COMPL_HARD_REG_SET(TO, FROM) ((TO) = ~(FROM)) + +#define IOR_HARD_REG_SET(TO, FROM) ((TO) |= (FROM)) +#define IOR_COMPL_HARD_REG_SET(TO, FROM) ((TO) |= ~ (FROM)) +#define AND_HARD_REG_SET(TO, FROM) ((TO) &= (FROM)) +#define AND_COMPL_HARD_REG_SET(TO, FROM) ((TO) &= ~ (FROM)) + +static inline bool +hard_reg_set_subset_p (const HARD_REG_SET x, const HARD_REG_SET y) +{ + return (x & ~y) == HARD_CONST (0); +} + +static inline bool +hard_reg_set_equal_p (const HARD_REG_SET x, const HARD_REG_SET y) +{ + return x == y; +} + +static inline bool +hard_reg_set_intersect_p (const HARD_REG_SET x, const HARD_REG_SET y) +{ + return (x & y) != HARD_CONST (0); +} + +static inline bool +hard_reg_set_empty_p (const HARD_REG_SET x) +{ + return x == HARD_CONST (0); +} + +#else + +#define SET_HARD_REG_BIT(SET, BIT) \ + ((SET)[(BIT) / UHOST_BITS_PER_WIDE_INT] \ + |= HARD_CONST (1) << ((BIT) % UHOST_BITS_PER_WIDE_INT)) + +#define CLEAR_HARD_REG_BIT(SET, BIT) \ + ((SET)[(BIT) / UHOST_BITS_PER_WIDE_INT] \ + &= ~(HARD_CONST (1) << ((BIT) % UHOST_BITS_PER_WIDE_INT))) + +#define TEST_HARD_REG_BIT(SET, BIT) \ + (!!((SET)[(BIT) / UHOST_BITS_PER_WIDE_INT] \ + & (HARD_CONST (1) << ((BIT) % UHOST_BITS_PER_WIDE_INT)))) + +#if FIRST_PSEUDO_REGISTER <= 2*HOST_BITS_PER_WIDEST_FAST_INT +#define CLEAR_HARD_REG_SET(TO) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + scan_tp_[0] = 0; \ + scan_tp_[1] = 0; } while (0) + +#define SET_HARD_REG_SET(TO) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + scan_tp_[0] = -1; \ + scan_tp_[1] = -1; } while (0) + +#define COPY_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + scan_tp_[0] = scan_fp_[0]; \ + scan_tp_[1] = scan_fp_[1]; } while (0) + +#define COMPL_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + scan_tp_[0] = ~ scan_fp_[0]; \ + scan_tp_[1] = ~ scan_fp_[1]; } while (0) + +#define AND_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + scan_tp_[0] &= scan_fp_[0]; \ + scan_tp_[1] &= scan_fp_[1]; } while (0) + +#define AND_COMPL_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + scan_tp_[0] &= ~ scan_fp_[0]; \ + scan_tp_[1] &= ~ scan_fp_[1]; } while (0) + +#define IOR_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + scan_tp_[0] |= scan_fp_[0]; \ + scan_tp_[1] |= scan_fp_[1]; } while (0) + +#define IOR_COMPL_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + scan_tp_[0] |= ~ scan_fp_[0]; \ + scan_tp_[1] |= ~ scan_fp_[1]; } while (0) + +static inline bool +hard_reg_set_subset_p (const HARD_REG_SET x, const HARD_REG_SET y) +{ + return (x[0] & ~y[0]) == 0 && (x[1] & ~y[1]) == 0; +} + +static inline bool +hard_reg_set_equal_p (const HARD_REG_SET x, const HARD_REG_SET y) +{ + return x[0] == y[0] && x[1] == y[1]; +} + +static inline bool +hard_reg_set_intersect_p (const HARD_REG_SET x, const HARD_REG_SET y) +{ + return (x[0] & y[0]) != 0 || (x[1] & y[1]) != 0; +} + +static inline bool +hard_reg_set_empty_p (const HARD_REG_SET x) +{ + return x[0] == 0 && x[1] == 0; +} + +#else +#if FIRST_PSEUDO_REGISTER <= 3*HOST_BITS_PER_WIDEST_FAST_INT +#define CLEAR_HARD_REG_SET(TO) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + scan_tp_[0] = 0; \ + scan_tp_[1] = 0; \ + scan_tp_[2] = 0; } while (0) + +#define SET_HARD_REG_SET(TO) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + scan_tp_[0] = -1; \ + scan_tp_[1] = -1; \ + scan_tp_[2] = -1; } while (0) + +#define COPY_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + scan_tp_[0] = scan_fp_[0]; \ + scan_tp_[1] = scan_fp_[1]; \ + scan_tp_[2] = scan_fp_[2]; } while (0) + +#define COMPL_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + scan_tp_[0] = ~ scan_fp_[0]; \ + scan_tp_[1] = ~ scan_fp_[1]; \ + scan_tp_[2] = ~ scan_fp_[2]; } while (0) + +#define AND_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + scan_tp_[0] &= scan_fp_[0]; \ + scan_tp_[1] &= scan_fp_[1]; \ + scan_tp_[2] &= scan_fp_[2]; } while (0) + +#define AND_COMPL_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + scan_tp_[0] &= ~ scan_fp_[0]; \ + scan_tp_[1] &= ~ scan_fp_[1]; \ + scan_tp_[2] &= ~ scan_fp_[2]; } while (0) + +#define IOR_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + scan_tp_[0] |= scan_fp_[0]; \ + scan_tp_[1] |= scan_fp_[1]; \ + scan_tp_[2] |= scan_fp_[2]; } while (0) + +#define IOR_COMPL_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + scan_tp_[0] |= ~ scan_fp_[0]; \ + scan_tp_[1] |= ~ scan_fp_[1]; \ + scan_tp_[2] |= ~ scan_fp_[2]; } while (0) + +static inline bool +hard_reg_set_subset_p (const HARD_REG_SET x, const HARD_REG_SET y) +{ + return ((x[0] & ~y[0]) == 0 + && (x[1] & ~y[1]) == 0 + && (x[2] & ~y[2]) == 0); +} + +static inline bool +hard_reg_set_equal_p (const HARD_REG_SET x, const HARD_REG_SET y) +{ + return x[0] == y[0] && x[1] == y[1] && x[2] == y[2]; +} + +static inline bool +hard_reg_set_intersect_p (const HARD_REG_SET x, const HARD_REG_SET y) +{ + return ((x[0] & y[0]) != 0 + || (x[1] & y[1]) != 0 + || (x[2] & y[2]) != 0); +} + +static inline bool +hard_reg_set_empty_p (const HARD_REG_SET x) +{ + return x[0] == 0 && x[1] == 0 && x[2] == 0; +} + +#else +#if FIRST_PSEUDO_REGISTER <= 4*HOST_BITS_PER_WIDEST_FAST_INT +#define CLEAR_HARD_REG_SET(TO) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + scan_tp_[0] = 0; \ + scan_tp_[1] = 0; \ + scan_tp_[2] = 0; \ + scan_tp_[3] = 0; } while (0) + +#define SET_HARD_REG_SET(TO) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + scan_tp_[0] = -1; \ + scan_tp_[1] = -1; \ + scan_tp_[2] = -1; \ + scan_tp_[3] = -1; } while (0) + +#define COPY_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + scan_tp_[0] = scan_fp_[0]; \ + scan_tp_[1] = scan_fp_[1]; \ + scan_tp_[2] = scan_fp_[2]; \ + scan_tp_[3] = scan_fp_[3]; } while (0) + +#define COMPL_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + scan_tp_[0] = ~ scan_fp_[0]; \ + scan_tp_[1] = ~ scan_fp_[1]; \ + scan_tp_[2] = ~ scan_fp_[2]; \ + scan_tp_[3] = ~ scan_fp_[3]; } while (0) + +#define AND_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + scan_tp_[0] &= scan_fp_[0]; \ + scan_tp_[1] &= scan_fp_[1]; \ + scan_tp_[2] &= scan_fp_[2]; \ + scan_tp_[3] &= scan_fp_[3]; } while (0) + +#define AND_COMPL_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + scan_tp_[0] &= ~ scan_fp_[0]; \ + scan_tp_[1] &= ~ scan_fp_[1]; \ + scan_tp_[2] &= ~ scan_fp_[2]; \ + scan_tp_[3] &= ~ scan_fp_[3]; } while (0) + +#define IOR_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + scan_tp_[0] |= scan_fp_[0]; \ + scan_tp_[1] |= scan_fp_[1]; \ + scan_tp_[2] |= scan_fp_[2]; \ + scan_tp_[3] |= scan_fp_[3]; } while (0) + +#define IOR_COMPL_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + scan_tp_[0] |= ~ scan_fp_[0]; \ + scan_tp_[1] |= ~ scan_fp_[1]; \ + scan_tp_[2] |= ~ scan_fp_[2]; \ + scan_tp_[3] |= ~ scan_fp_[3]; } while (0) + +static inline bool +hard_reg_set_subset_p (const HARD_REG_SET x, const HARD_REG_SET y) +{ + return ((x[0] & ~y[0]) == 0 + && (x[1] & ~y[1]) == 0 + && (x[2] & ~y[2]) == 0 + && (x[3] & ~y[3]) == 0); +} + +static inline bool +hard_reg_set_equal_p (const HARD_REG_SET x, const HARD_REG_SET y) +{ + return x[0] == y[0] && x[1] == y[1] && x[2] == y[2] && x[3] == y[3]; +} + +static inline bool +hard_reg_set_intersect_p (const HARD_REG_SET x, const HARD_REG_SET y) +{ + return ((x[0] & y[0]) != 0 + || (x[1] & y[1]) != 0 + || (x[2] & y[2]) != 0 + || (x[3] & y[3]) != 0); +} + +static inline bool +hard_reg_set_empty_p (const HARD_REG_SET x) +{ + return x[0] == 0 && x[1] == 0 && x[2] == 0 && x[3] == 0; +} + +#else /* FIRST_PSEUDO_REGISTER > 4*HOST_BITS_PER_WIDEST_FAST_INT */ + +#define CLEAR_HARD_REG_SET(TO) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + int i; \ + for (i = 0; i < HARD_REG_SET_LONGS; i++) \ + *scan_tp_++ = 0; } while (0) + +#define SET_HARD_REG_SET(TO) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + int i; \ + for (i = 0; i < HARD_REG_SET_LONGS; i++) \ + *scan_tp_++ = -1; } while (0) + +#define COPY_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + int i; \ + for (i = 0; i < HARD_REG_SET_LONGS; i++) \ + *scan_tp_++ = *scan_fp_++; } while (0) + +#define COMPL_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + int i; \ + for (i = 0; i < HARD_REG_SET_LONGS; i++) \ + *scan_tp_++ = ~ *scan_fp_++; } while (0) + +#define AND_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + int i; \ + for (i = 0; i < HARD_REG_SET_LONGS; i++) \ + *scan_tp_++ &= *scan_fp_++; } while (0) + +#define AND_COMPL_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + int i; \ + for (i = 0; i < HARD_REG_SET_LONGS; i++) \ + *scan_tp_++ &= ~ *scan_fp_++; } while (0) + +#define IOR_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + int i; \ + for (i = 0; i < HARD_REG_SET_LONGS; i++) \ + *scan_tp_++ |= *scan_fp_++; } while (0) + +#define IOR_COMPL_HARD_REG_SET(TO, FROM) \ +do { HARD_REG_ELT_TYPE *scan_tp_ = (TO); \ + const HARD_REG_ELT_TYPE *scan_fp_ = (FROM); \ + int i; \ + for (i = 0; i < HARD_REG_SET_LONGS; i++) \ + *scan_tp_++ |= ~ *scan_fp_++; } while (0) + +static inline bool +hard_reg_set_subset_p (const HARD_REG_SET x, const HARD_REG_SET y) +{ + int i; + + for (i = 0; i < HARD_REG_SET_LONGS; i++) + if ((x[i] & ~y[i]) != 0) + return false; + return true; +} + +static inline bool +hard_reg_set_equal_p (const HARD_REG_SET x, const HARD_REG_SET y) +{ + int i; + + for (i = 0; i < HARD_REG_SET_LONGS; i++) + if (x[i] != y[i]) + return false; + return true; +} + +static inline bool +hard_reg_set_intersect_p (const HARD_REG_SET x, const HARD_REG_SET y) +{ + int i; + + for (i = 0; i < HARD_REG_SET_LONGS; i++) + if ((x[i] & y[i]) != 0) + return true; + return false; +} + +static inline bool +hard_reg_set_empty_p (const HARD_REG_SET x) +{ + int i; + + for (i = 0; i < HARD_REG_SET_LONGS; i++) + if (x[i] != 0) + return false; + return true; +} + +#endif +#endif +#endif +#endif + +/* Iterator for hard register sets. */ + +struct hard_reg_set_iterator +{ + /* Pointer to the current element. */ + HARD_REG_ELT_TYPE *pelt; + + /* The length of the set. */ + unsigned short length; + + /* Word within the current element. */ + unsigned short word_no; + + /* Contents of the actually processed word. When finding next bit + it is shifted right, so that the actual bit is always the least + significant bit of ACTUAL. */ + HARD_REG_ELT_TYPE bits; +}; + +#define HARD_REG_ELT_BITS UHOST_BITS_PER_WIDE_INT + +/* The implementation of the iterator functions is fully analogous to + the bitmap iterators. */ +static inline void +hard_reg_set_iter_init (hard_reg_set_iterator *iter, HARD_REG_SET set, + unsigned min, unsigned *regno) +{ +#ifdef HARD_REG_SET_LONGS + iter->pelt = set; + iter->length = HARD_REG_SET_LONGS; +#else + iter->pelt = &set; + iter->length = 1; +#endif + iter->word_no = min / HARD_REG_ELT_BITS; + if (iter->word_no < iter->length) + { + iter->bits = iter->pelt[iter->word_no]; + iter->bits >>= min % HARD_REG_ELT_BITS; + + /* This is required for correct search of the next bit. */ + min += !iter->bits; + } + *regno = min; +} + +static inline bool +hard_reg_set_iter_set (hard_reg_set_iterator *iter, unsigned *regno) +{ + while (1) + { + /* Return false when we're advanced past the end of the set. */ + if (iter->word_no >= iter->length) + return false; + + if (iter->bits) + { + /* Find the correct bit and return it. */ + while (!(iter->bits & 1)) + { + iter->bits >>= 1; + *regno += 1; + } + return (*regno < FIRST_PSEUDO_REGISTER); + } + + /* Round to the beginning of the next word. */ + *regno = (*regno + HARD_REG_ELT_BITS - 1); + *regno -= *regno % HARD_REG_ELT_BITS; + + /* Find the next non-zero word. */ + while (++iter->word_no < iter->length) + { + iter->bits = iter->pelt[iter->word_no]; + if (iter->bits) + break; + *regno += HARD_REG_ELT_BITS; + } + } +} + +static inline void +hard_reg_set_iter_next (hard_reg_set_iterator *iter, unsigned *regno) +{ + iter->bits >>= 1; + *regno += 1; +} + +#define EXECUTE_IF_SET_IN_HARD_REG_SET(SET, MIN, REGNUM, ITER) \ + for (hard_reg_set_iter_init (&(ITER), (SET), (MIN), &(REGNUM)); \ + hard_reg_set_iter_set (&(ITER), &(REGNUM)); \ + hard_reg_set_iter_next (&(ITER), &(REGNUM))) + + +/* Define some standard sets of registers. */ + +/* Indexed by hard register number, contains 1 for registers + that are being used for global register decls. + These must be exempt from ordinary flow analysis + and are also considered fixed. */ + +extern char global_regs[FIRST_PSEUDO_REGISTER]; + +struct simplifiable_subreg; +struct subreg_shape; + +struct simplifiable_subregs_hasher : nofree_ptr_hash +{ + typedef const subreg_shape *compare_type; + + static inline hashval_t hash (const simplifiable_subreg *); + static inline bool equal (const simplifiable_subreg *, const subreg_shape *); +}; + +struct target_hard_regs { + void finalize (); + + /* The set of registers that actually exist on the current target. */ + HARD_REG_SET x_accessible_reg_set; + + /* The set of registers that should be considered to be register + operands. It is a subset of x_accessible_reg_set. */ + HARD_REG_SET x_operand_reg_set; + + /* Indexed by hard register number, contains 1 for registers + that are fixed use (stack pointer, pc, frame pointer, etc.;. + These are the registers that cannot be used to allocate + a pseudo reg whose life does not cross calls. */ + char x_fixed_regs[FIRST_PSEUDO_REGISTER]; + + /* The same info as a HARD_REG_SET. */ + HARD_REG_SET x_fixed_reg_set; + + /* Indexed by hard register number, contains 1 for registers + that are fixed use or are clobbered by function calls. + These are the registers that cannot be used to allocate + a pseudo reg whose life crosses calls. */ + char x_call_used_regs[FIRST_PSEUDO_REGISTER]; + + char x_call_really_used_regs[FIRST_PSEUDO_REGISTER]; + + /* The same info as a HARD_REG_SET. */ + HARD_REG_SET x_call_used_reg_set; + + /* Contains registers that are fixed use -- i.e. in fixed_reg_set -- or + a function value return register or TARGET_STRUCT_VALUE_RTX or + STATIC_CHAIN_REGNUM. These are the registers that cannot hold quantities + across calls even if we are willing to save and restore them. */ + HARD_REG_SET x_call_fixed_reg_set; + + /* Contains registers that are fixed use -- i.e. in fixed_reg_set -- but + only if they are not merely part of that set because they are global + regs. Global regs that are not otherwise fixed can still take part + in register allocation. */ + HARD_REG_SET x_fixed_nonglobal_reg_set; + + /* Contains 1 for registers that are set or clobbered by calls. */ + /* ??? Ideally, this would be just call_used_regs plus global_regs, but + for someone's bright idea to have call_used_regs strictly include + fixed_regs. Which leaves us guessing as to the set of fixed_regs + that are actually preserved. We know for sure that those associated + with the local stack frame are safe, but scant others. */ + HARD_REG_SET x_regs_invalidated_by_call; + + /* Call used hard registers which can not be saved because there is no + insn for this. */ + HARD_REG_SET x_no_caller_save_reg_set; + + /* Table of register numbers in the order in which to try to use them. */ + int x_reg_alloc_order[FIRST_PSEUDO_REGISTER]; + + /* The inverse of reg_alloc_order. */ + int x_inv_reg_alloc_order[FIRST_PSEUDO_REGISTER]; + + /* For each reg class, a HARD_REG_SET saying which registers are in it. */ + HARD_REG_SET x_reg_class_contents[N_REG_CLASSES]; + + /* For each reg class, a boolean saying whether the class contains only + fixed registers. */ + bool x_class_only_fixed_regs[N_REG_CLASSES]; + + /* For each reg class, number of regs it contains. */ + unsigned int x_reg_class_size[N_REG_CLASSES]; + + /* For each reg class, table listing all the classes contained in it. */ + enum reg_class x_reg_class_subclasses[N_REG_CLASSES][N_REG_CLASSES]; + + /* For each pair of reg classes, + a largest reg class contained in their union. */ + enum reg_class x_reg_class_subunion[N_REG_CLASSES][N_REG_CLASSES]; + + /* For each pair of reg classes, + the smallest reg class that contains their union. */ + enum reg_class x_reg_class_superunion[N_REG_CLASSES][N_REG_CLASSES]; + + /* Vector indexed by hardware reg giving its name. */ + const char *x_reg_names[FIRST_PSEUDO_REGISTER]; + + /* Records which registers can form a particular subreg, with the subreg + being identified by its outer mode, inner mode and offset. */ + hash_table *x_simplifiable_subregs; +}; + +extern struct target_hard_regs default_target_hard_regs; +#if SWITCHABLE_TARGET +extern struct target_hard_regs *this_target_hard_regs; +#else +#define this_target_hard_regs (&default_target_hard_regs) +#endif + +#define accessible_reg_set \ + (this_target_hard_regs->x_accessible_reg_set) +#define operand_reg_set \ + (this_target_hard_regs->x_operand_reg_set) +#define fixed_regs \ + (this_target_hard_regs->x_fixed_regs) +#define fixed_reg_set \ + (this_target_hard_regs->x_fixed_reg_set) +#define fixed_nonglobal_reg_set \ + (this_target_hard_regs->x_fixed_nonglobal_reg_set) +#define call_used_regs \ + (this_target_hard_regs->x_call_used_regs) +#define call_really_used_regs \ + (this_target_hard_regs->x_call_really_used_regs) +#define call_used_reg_set \ + (this_target_hard_regs->x_call_used_reg_set) +#define call_fixed_reg_set \ + (this_target_hard_regs->x_call_fixed_reg_set) +#define regs_invalidated_by_call \ + (this_target_hard_regs->x_regs_invalidated_by_call) +#define no_caller_save_reg_set \ + (this_target_hard_regs->x_no_caller_save_reg_set) +#define reg_alloc_order \ + (this_target_hard_regs->x_reg_alloc_order) +#define inv_reg_alloc_order \ + (this_target_hard_regs->x_inv_reg_alloc_order) +#define reg_class_contents \ + (this_target_hard_regs->x_reg_class_contents) +#define class_only_fixed_regs \ + (this_target_hard_regs->x_class_only_fixed_regs) +#define reg_class_size \ + (this_target_hard_regs->x_reg_class_size) +#define reg_class_subclasses \ + (this_target_hard_regs->x_reg_class_subclasses) +#define reg_class_subunion \ + (this_target_hard_regs->x_reg_class_subunion) +#define reg_class_superunion \ + (this_target_hard_regs->x_reg_class_superunion) +#define reg_names \ + (this_target_hard_regs->x_reg_names) + +/* Vector indexed by reg class giving its name. */ + +extern const char * reg_class_names[]; + +/* Given a hard REGN a FROM mode and a TO mode, return nonzero if + REGN cannot change modes between the specified modes. */ +#define REG_CANNOT_CHANGE_MODE_P(REGN, FROM, TO) \ + CANNOT_CHANGE_MODE_CLASS (FROM, TO, REGNO_REG_CLASS (REGN)) + +#endif /* ! GCC_HARD_REG_SET_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hash-map-traits.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hash-map-traits.h new file mode 100644 index 0000000..2b5fddf --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hash-map-traits.h @@ -0,0 +1,181 @@ +/* A hash map traits. + Copyright (C) 2015-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef HASH_MAP_TRAITS_H +#define HASH_MAP_TRAITS_H + +/* Bacause mem-stats.h uses default hashmap traits, we have to + put the class to this separate header file. */ + +#include "hash-traits.h" + +/* Implement hash_map traits for a key with hash traits H. Empty and + deleted map entries are represented as empty and deleted keys. */ + +template +struct simple_hashmap_traits +{ + typedef typename H::value_type key_type; + static inline hashval_t hash (const key_type &); + static inline bool equal_keys (const key_type &, const key_type &); + template static inline void remove (T &); + template static inline bool is_empty (const T &); + template static inline bool is_deleted (const T &); + template static inline void mark_empty (T &); + template static inline void mark_deleted (T &); +}; + +template +inline hashval_t +simple_hashmap_traits ::hash (const key_type &h) +{ + return H::hash (h); +} + +template +inline bool +simple_hashmap_traits ::equal_keys (const key_type &k1, + const key_type &k2) +{ + return H::equal (k1, k2); +} + +template +template +inline void +simple_hashmap_traits ::remove (T &entry) +{ + H::remove (entry.m_key); + entry.m_value.~Value (); +} + +template +template +inline bool +simple_hashmap_traits ::is_empty (const T &entry) +{ + return H::is_empty (entry.m_key); +} + +template +template +inline bool +simple_hashmap_traits ::is_deleted (const T &entry) +{ + return H::is_deleted (entry.m_key); +} + +template +template +inline void +simple_hashmap_traits ::mark_empty (T &entry) +{ + H::mark_empty (entry.m_key); +} + +template +template +inline void +simple_hashmap_traits ::mark_deleted (T &entry) +{ + H::mark_deleted (entry.m_key); +} + +/* Implement traits for a hash_map with values of type Value for cases + in which the key cannot represent empty and deleted slots. Instead + record empty and deleted entries in Value. Derived classes must + implement the hash and equal_keys functions. */ + +template +struct unbounded_hashmap_traits +{ + template static inline void remove (T &); + template static inline bool is_empty (const T &); + template static inline bool is_deleted (const T &); + template static inline void mark_empty (T &); + template static inline void mark_deleted (T &); +}; + +template +template +inline void +unbounded_hashmap_traits ::remove (T &entry) +{ + default_hash_traits ::remove (entry.m_value); +} + +template +template +inline bool +unbounded_hashmap_traits ::is_empty (const T &entry) +{ + return default_hash_traits ::is_empty (entry.m_value); +} + +template +template +inline bool +unbounded_hashmap_traits ::is_deleted (const T &entry) +{ + return default_hash_traits ::is_deleted (entry.m_value); +} + +template +template +inline void +unbounded_hashmap_traits ::mark_empty (T &entry) +{ + default_hash_traits ::mark_empty (entry.m_value); +} + +template +template +inline void +unbounded_hashmap_traits ::mark_deleted (T &entry) +{ + default_hash_traits ::mark_deleted (entry.m_value); +} + +/* Implement traits for a hash_map from integer type Key to Value in + cases where Key has no spare values for recording empty and deleted + slots. */ + +template +struct unbounded_int_hashmap_traits : unbounded_hashmap_traits +{ + typedef Key key_type; + static inline hashval_t hash (Key); + static inline bool equal_keys (Key, Key); +}; + +template +inline hashval_t +unbounded_int_hashmap_traits ::hash (Key k) +{ + return k; +} + +template +inline bool +unbounded_int_hashmap_traits ::equal_keys (Key k1, Key k2) +{ + return k1 == k2; +} + +#endif // HASH_MAP_TRAITS_H diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hash-map.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hash-map.h new file mode 100644 index 0000000..73f1c54 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hash-map.h @@ -0,0 +1,268 @@ +/* A type-safe hash map. + Copyright (C) 2014-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + + +#ifndef hash_map_h +#define hash_map_h + +template +class GTY((user)) hash_map +{ + typedef typename Traits::key_type Key; + struct hash_entry + { + Key m_key; + Value m_value; + + typedef hash_entry value_type; + typedef Key compare_type; + + static hashval_t hash (const hash_entry &e) + { + return Traits::hash (e.m_key); + } + + static bool equal (const hash_entry &a, const Key &b) + { + return Traits::equal_keys (a.m_key, b); + } + + static void remove (hash_entry &e) { Traits::remove (e); } + + static void mark_deleted (hash_entry &e) { Traits::mark_deleted (e); } + + static bool is_deleted (const hash_entry &e) + { + return Traits::is_deleted (e); + } + + static void mark_empty (hash_entry &e) { Traits::mark_empty (e); } + static bool is_empty (const hash_entry &e) { return Traits::is_empty (e); } + + static void ggc_mx (hash_entry &e) + { + gt_ggc_mx (e.m_key); + gt_ggc_mx (e.m_value); + } + + static void pch_nx (hash_entry &e) + { + gt_pch_nx (e.m_key); + gt_pch_nx (e.m_value); + } + + static void pch_nx (hash_entry &e, gt_pointer_operator op, void *c) + { + pch_nx_helper (e.m_key, op, c); + pch_nx_helper (e.m_value, op, c); + } + + private: + template + static void + pch_nx_helper (T &x, gt_pointer_operator op, void *cookie) + { + gt_pch_nx (&x, op, cookie); + } + + static void + pch_nx_helper (int, gt_pointer_operator, void *) + { + } + + static void + pch_nx_helper (unsigned int, gt_pointer_operator, void *) + { + } + + static void + pch_nx_helper (bool, gt_pointer_operator, void *) + { + } + + template + static void + pch_nx_helper (T *&x, gt_pointer_operator op, void *cookie) + { + op (&x, cookie); + } + }; + +public: + explicit hash_map (size_t n = 13, bool ggc = false, + bool gather_mem_stats = GATHER_STATISTICS + CXX_MEM_STAT_INFO) + : m_table (n, ggc, gather_mem_stats, HASH_MAP_ORIGIN PASS_MEM_STAT) {} + + explicit hash_map (const hash_map &h, bool ggc = false, + bool gather_mem_stats = GATHER_STATISTICS + CXX_MEM_STAT_INFO) + : m_table (h.m_table, ggc, gather_mem_stats, + HASH_MAP_ORIGIN PASS_MEM_STAT) {} + + /* Create a hash_map in ggc memory. */ + static hash_map *create_ggc (size_t size, + bool gather_mem_stats = GATHER_STATISTICS + CXX_MEM_STAT_INFO) + { + hash_map *map = ggc_alloc (); + new (map) hash_map (size, true, gather_mem_stats PASS_MEM_STAT); + return map; + } + + /* If key k isn't already in the map add key k with value v to the map, and + return false. Otherwise set the value of the entry for key k to be v and + return true. */ + + bool put (const Key &k, const Value &v) + { + hash_entry *e = m_table.find_slot_with_hash (k, Traits::hash (k), + INSERT); + bool existed = !hash_entry::is_empty (*e); + if (!existed) + e->m_key = k; + + e->m_value = v; + return existed; + } + + /* if the passed in key is in the map return its value otherwise NULL. */ + + Value *get (const Key &k) + { + hash_entry &e = m_table.find_with_hash (k, Traits::hash (k)); + return Traits::is_empty (e) ? NULL : &e.m_value; + } + + /* Return a reference to the value for the passed in key, creating the entry + if it doesn't already exist. If existed is not NULL then it is set to false + if the key was not previously in the map, and true otherwise. */ + + Value &get_or_insert (const Key &k, bool *existed = NULL) + { + hash_entry *e = m_table.find_slot_with_hash (k, Traits::hash (k), + INSERT); + bool ins = Traits::is_empty (*e); + if (ins) + e->m_key = k; + + if (existed != NULL) + *existed = !ins; + + return e->m_value; + } + + void remove (const Key &k) + { + m_table.remove_elt_with_hash (k, Traits::hash (k)); + } + + /* Call the call back on each pair of key and value with the passed in + arg. */ + + template + void traverse (Arg a) const + { + for (typename hash_table::iterator iter = m_table.begin (); + iter != m_table.end (); ++iter) + f ((*iter).m_key, (*iter).m_value, a); + } + + template + void traverse (Arg a) const + { + for (typename hash_table::iterator iter = m_table.begin (); + iter != m_table.end (); ++iter) + if (!f ((*iter).m_key, &(*iter).m_value, a)) + break; + } + + size_t elements () const { return m_table.elements (); } + + void empty () { m_table.empty(); } + + class iterator + { + public: + explicit iterator (const typename hash_table::iterator &iter) : + m_iter (iter) {} + + iterator &operator++ () + { + ++m_iter; + return *this; + } + + std::pair operator* () + { + hash_entry &e = *m_iter; + return std::pair (e.m_key, e.m_value); + } + + bool + operator != (const iterator &other) const + { + return m_iter != other.m_iter; + } + + private: + typename hash_table::iterator m_iter; + }; + + /* Standard iterator retrieval methods. */ + + iterator begin () const { return iterator (m_table.begin ()); } + iterator end () const { return iterator (m_table.end ()); } + +private: + + template friend void gt_ggc_mx (hash_map *); + template friend void gt_pch_nx (hash_map *); + template friend void gt_pch_nx (hash_map *, gt_pointer_operator, void *); + + hash_table m_table; +}; + +/* ggc marking routines. */ + +template +static inline void +gt_ggc_mx (hash_map *h) +{ + gt_ggc_mx (&h->m_table); +} + +template +static inline void +gt_pch_nx (hash_map *h) +{ + gt_pch_nx (&h->m_table); +} + +template +static inline void +gt_pch_nx (hash_map *h, gt_pointer_operator op, void *cookie) +{ + op (&h->m_table.m_entries, cookie); +} + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hash-set.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hash-set.h new file mode 100644 index 0000000..d2247d3 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hash-set.h @@ -0,0 +1,149 @@ +/* A type-safe hash set. + Copyright (C) 2014-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + + +#ifndef hash_set_h +#define hash_set_h + +template > +class hash_set +{ +public: + typedef typename Traits::value_type Key; + explicit hash_set (size_t n = 13, bool ggc = false CXX_MEM_STAT_INFO) + : m_table (n, ggc, GATHER_STATISTICS, HASH_SET_ORIGIN PASS_MEM_STAT) {} + + /* Create a hash_set in gc memory with space for at least n elements. */ + + static hash_set * + create_ggc (size_t n) + { + hash_set *set = ggc_alloc (); + new (set) hash_set (n, true); + return set; + } + + /* If key k isn't already in the map add it to the map, and + return false. Otherwise return true. */ + + bool add (const Key &k) + { + Key *e = m_table.find_slot_with_hash (k, Traits::hash (k), INSERT); + bool existed = !Traits::is_empty (*e); + if (!existed) + *e = k; + + return existed; + } + + /* if the passed in key is in the map return its value otherwise NULL. */ + + bool contains (const Key &k) + { + Key &e = m_table.find_with_hash (k, Traits::hash (k)); + return !Traits::is_empty (e); + } + + void remove (const Key &k) + { + m_table.remove_elt_with_hash (k, Traits::hash (k)); + } + + /* Call the call back on each pair of key and value with the passed in + arg. */ + + template + void traverse (Arg a) const + { + for (typename hash_table::iterator iter = m_table.begin (); + iter != m_table.end (); ++iter) + f (*iter, a); + } + + /* Return the number of elements in the set. */ + + size_t elements () const { return m_table.elements (); } + + class iterator + { + public: + explicit iterator (const typename hash_table::iterator &iter) : + m_iter (iter) {} + + iterator &operator++ () + { + ++m_iter; + return *this; + } + + Key + operator* () + { + return *m_iter; + } + + bool + operator != (const iterator &other) const + { + return m_iter != other.m_iter; + } + + private: + typename hash_table::iterator m_iter; + }; + + /* Standard iterator retrieval methods. */ + + iterator begin () const { return iterator (m_table.begin ()); } + iterator end () const { return iterator (m_table.end ()); } + + +private: + + template friend void gt_ggc_mx (hash_set *); + template friend void gt_pch_nx (hash_set *); + template friend void gt_pch_nx (hash_set *, gt_pointer_operator, void *); + + hash_table m_table; +}; + +/* ggc marking routines. */ + +template +static inline void +gt_ggc_mx (hash_set *h) +{ + gt_ggc_mx (&h->m_table); +} + +template +static inline void +gt_pch_nx (hash_set *h) +{ + gt_pch_nx (&h->m_table); +} + +template +static inline void +gt_pch_nx (hash_set *h, gt_pointer_operator op, void *cookie) +{ + op (&h->m_table.m_entries, cookie); +} + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hash-table.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hash-table.h new file mode 100644 index 0000000..0f7e21a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hash-table.h @@ -0,0 +1,1110 @@ +/* A type-safe hash table template. + Copyright (C) 2012-2017 Free Software Foundation, Inc. + Contributed by Lawrence Crowl + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + + +/* This file implements a typed hash table. + The implementation borrows from libiberty's htab_t in hashtab.h. + + + INTRODUCTION TO TYPES + + Users of the hash table generally need to be aware of three types. + + 1. The type being placed into the hash table. This type is called + the value type. + + 2. The type used to describe how to handle the value type within + the hash table. This descriptor type provides the hash table with + several things. + + - A typedef named 'value_type' to the value type (from above). + + - A static member function named 'hash' that takes a value_type + (or 'const value_type &') and returns a hashval_t value. + + - A typedef named 'compare_type' that is used to test when a value + is found. This type is the comparison type. Usually, it will be the + same as value_type. If it is not the same type, you must generally + explicitly compute hash values and pass them to the hash table. + + - A static member function named 'equal' that takes a value_type + and a compare_type, and returns a bool. Both arguments can be + const references. + + - A static function named 'remove' that takes an value_type pointer + and frees the memory allocated by it. This function is used when + individual elements of the table need to be disposed of (e.g., + when deleting a hash table, removing elements from the table, etc). + + - An optional static function named 'keep_cache_entry'. This + function is provided only for garbage-collected elements that + are not marked by the normal gc mark pass. It describes what + what should happen to the element at the end of the gc mark phase. + The return value should be: + - 0 if the element should be deleted + - 1 if the element should be kept and needs to be marked + - -1 if the element should be kept and is already marked. + Returning -1 rather than 1 is purely an optimization. + + 3. The type of the hash table itself. (More later.) + + In very special circumstances, users may need to know about a fourth type. + + 4. The template type used to describe how hash table memory + is allocated. This type is called the allocator type. It is + parameterized on the value type. It provides two functions: + + - A static member function named 'data_alloc'. This function + allocates the data elements in the table. + + - A static member function named 'data_free'. This function + deallocates the data elements in the table. + + Hash table are instantiated with two type arguments. + + * The descriptor type, (2) above. + + * The allocator type, (4) above. In general, you will not need to + provide your own allocator type. By default, hash tables will use + the class template xcallocator, which uses malloc/free for allocation. + + + DEFINING A DESCRIPTOR TYPE + + The first task in using the hash table is to describe the element type. + We compose this into a few steps. + + 1. Decide on a removal policy for values stored in the table. + hash-traits.h provides class templates for the four most common + policies: + + * typed_free_remove implements the static 'remove' member function + by calling free(). + + * typed_noop_remove implements the static 'remove' member function + by doing nothing. + + * ggc_remove implements the static 'remove' member by doing nothing, + but instead provides routines for gc marking and for PCH streaming. + Use this for garbage-collected data that needs to be preserved across + collections. + + * ggc_cache_remove is like ggc_remove, except that it does not + mark the entries during the normal gc mark phase. Instead it + uses 'keep_cache_entry' (described above) to keep elements that + were not collected and delete those that were. Use this for + garbage-collected caches that should not in themselves stop + the data from being collected. + + You can use these policies by simply deriving the descriptor type + from one of those class template, with the appropriate argument. + + Otherwise, you need to write the static 'remove' member function + in the descriptor class. + + 2. Choose a hash function. Write the static 'hash' member function. + + 3. Decide whether the lookup function should take as input an object + of type value_type or something more restricted. Define compare_type + accordingly. + + 4. Choose an equality testing function 'equal' that compares a value_type + and a compare_type. + + If your elements are pointers, it is usually easiest to start with one + of the generic pointer descriptors described below and override the bits + you need to change. + + AN EXAMPLE DESCRIPTOR TYPE + + Suppose you want to put some_type into the hash table. You could define + the descriptor type as follows. + + struct some_type_hasher : nofree_ptr_hash + // Deriving from nofree_ptr_hash means that we get a 'remove' that does + // nothing. This choice is good for raw values. + { + static inline hashval_t hash (const value_type *); + static inline bool equal (const value_type *, const compare_type *); + }; + + inline hashval_t + some_type_hasher::hash (const value_type *e) + { ... compute and return a hash value for E ... } + + inline bool + some_type_hasher::equal (const value_type *p1, const compare_type *p2) + { ... compare P1 vs P2. Return true if they are the 'same' ... } + + + AN EXAMPLE HASH_TABLE DECLARATION + + To instantiate a hash table for some_type: + + hash_table some_type_hash_table; + + There is no need to mention some_type directly, as the hash table will + obtain it using some_type_hasher::value_type. + + You can then use any of the functions in hash_table's public interface. + See hash_table for details. The interface is very similar to libiberty's + htab_t. + + + EASY DESCRIPTORS FOR POINTERS + + There are four descriptors for pointer elements, one for each of + the removal policies above: + + * nofree_ptr_hash (based on typed_noop_remove) + * free_ptr_hash (based on typed_free_remove) + * ggc_ptr_hash (based on ggc_remove) + * ggc_cache_ptr_hash (based on ggc_cache_remove) + + These descriptors hash and compare elements by their pointer value, + rather than what they point to. So, to instantiate a hash table over + pointers to whatever_type, without freeing the whatever_types, use: + + hash_table > whatever_type_hash_table; + + + HASH TABLE ITERATORS + + The hash table provides standard C++ iterators. For example, consider a + hash table of some_info. We wish to consume each element of the table: + + extern void consume (some_info *); + + We define a convenience typedef and the hash table: + + typedef hash_table info_table_type; + info_table_type info_table; + + Then we write the loop in typical C++ style: + + for (info_table_type::iterator iter = info_table.begin (); + iter != info_table.end (); + ++iter) + if ((*iter).status == INFO_READY) + consume (&*iter); + + Or with common sub-expression elimination: + + for (info_table_type::iterator iter = info_table.begin (); + iter != info_table.end (); + ++iter) + { + some_info &elem = *iter; + if (elem.status == INFO_READY) + consume (&elem); + } + + One can also use a more typical GCC style: + + typedef some_info *some_info_p; + some_info *elem_ptr; + info_table_type::iterator iter; + FOR_EACH_HASH_TABLE_ELEMENT (info_table, elem_ptr, some_info_p, iter) + if (elem_ptr->status == INFO_READY) + consume (elem_ptr); + +*/ + + +#ifndef TYPED_HASHTAB_H +#define TYPED_HASHTAB_H + +#include "statistics.h" +#include "ggc.h" +#include "vec.h" +#include "hashtab.h" +#include "inchash.h" +#include "mem-stats-traits.h" +#include "hash-traits.h" +#include "hash-map-traits.h" + +template class hash_map; +template class hash_set; + +/* The ordinary memory allocator. */ +/* FIXME (crowl): This allocator may be extracted for wider sharing later. */ + +template +struct xcallocator +{ + static Type *data_alloc (size_t count); + static void data_free (Type *memory); +}; + + +/* Allocate memory for COUNT data blocks. */ + +template +inline Type * +xcallocator ::data_alloc (size_t count) +{ + return static_cast (xcalloc (count, sizeof (Type))); +} + + +/* Free memory for data blocks. */ + +template +inline void +xcallocator ::data_free (Type *memory) +{ + return ::free (memory); +} + + +/* Table of primes and their inversion information. */ + +struct prime_ent +{ + hashval_t prime; + hashval_t inv; + hashval_t inv_m2; /* inverse of prime-2 */ + hashval_t shift; +}; + +extern struct prime_ent const prime_tab[]; + + +/* Functions for computing hash table indexes. */ + +extern unsigned int hash_table_higher_prime_index (unsigned long n) + ATTRIBUTE_PURE; + +/* Return X % Y using multiplicative inverse values INV and SHIFT. + + The multiplicative inverses computed above are for 32-bit types, + and requires that we be able to compute a highpart multiply. + + FIX: I am not at all convinced that + 3 loads, 2 multiplications, 3 shifts, and 3 additions + will be faster than + 1 load and 1 modulus + on modern systems running a compiler. */ + +inline hashval_t +mul_mod (hashval_t x, hashval_t y, hashval_t inv, int shift) +{ + hashval_t t1, t2, t3, t4, q, r; + + t1 = ((uint64_t)x * inv) >> 32; + t2 = x - t1; + t3 = t2 >> 1; + t4 = t1 + t3; + q = t4 >> shift; + r = x - (q * y); + + return r; +} + +/* Compute the primary table index for HASH given current prime index. */ + +inline hashval_t +hash_table_mod1 (hashval_t hash, unsigned int index) +{ + const struct prime_ent *p = &prime_tab[index]; + gcc_checking_assert (sizeof (hashval_t) * CHAR_BIT <= 32); + return mul_mod (hash, p->prime, p->inv, p->shift); +} + +/* Compute the secondary table index for HASH given current prime index. */ + +inline hashval_t +hash_table_mod2 (hashval_t hash, unsigned int index) +{ + const struct prime_ent *p = &prime_tab[index]; + gcc_checking_assert (sizeof (hashval_t) * CHAR_BIT <= 32); + return 1 + mul_mod (hash, p->prime - 2, p->inv_m2, p->shift); +} + +class mem_usage; + +/* User-facing hash table type. + + The table stores elements of type Descriptor::value_type and uses + the static descriptor functions described at the top of the file + to hash, compare and remove elements. + + Specify the template Allocator to allocate and free memory. + The default is xcallocator. + + Storage is an implementation detail and should not be used outside the + hash table code. + +*/ +template class Allocator = xcallocator> +class hash_table +{ + typedef typename Descriptor::value_type value_type; + typedef typename Descriptor::compare_type compare_type; + +public: + explicit hash_table (size_t, bool ggc = false, + bool gather_mem_stats = GATHER_STATISTICS, + mem_alloc_origin origin = HASH_TABLE_ORIGIN + CXX_MEM_STAT_INFO); + explicit hash_table (const hash_table &, bool ggc = false, + bool gather_mem_stats = GATHER_STATISTICS, + mem_alloc_origin origin = HASH_TABLE_ORIGIN + CXX_MEM_STAT_INFO); + ~hash_table (); + + /* Create a hash_table in gc memory. */ + static hash_table * + create_ggc (size_t n CXX_MEM_STAT_INFO) + { + hash_table *table = ggc_alloc (); + new (table) hash_table (n, true, GATHER_STATISTICS, + HASH_TABLE_ORIGIN PASS_MEM_STAT); + return table; + } + + /* Current size (in entries) of the hash table. */ + size_t size () const { return m_size; } + + /* Return the current number of elements in this hash table. */ + size_t elements () const { return m_n_elements - m_n_deleted; } + + /* Return the current number of elements in this hash table. */ + size_t elements_with_deleted () const { return m_n_elements; } + + /* This function clears all entries in this hash table. */ + void empty () { if (elements ()) empty_slow (); } + + /* This function clears a specified SLOT in a hash table. It is + useful when you've already done the lookup and don't want to do it + again. */ + void clear_slot (value_type *); + + /* This function searches for a hash table entry equal to the given + COMPARABLE element starting with the given HASH value. It cannot + be used to insert or delete an element. */ + value_type &find_with_hash (const compare_type &, hashval_t); + + /* Like find_slot_with_hash, but compute the hash value from the element. */ + value_type &find (const value_type &value) + { + return find_with_hash (value, Descriptor::hash (value)); + } + + value_type *find_slot (const value_type &value, insert_option insert) + { + return find_slot_with_hash (value, Descriptor::hash (value), insert); + } + + /* This function searches for a hash table slot containing an entry + equal to the given COMPARABLE element and starting with the given + HASH. To delete an entry, call this with insert=NO_INSERT, then + call clear_slot on the slot returned (possibly after doing some + checks). To insert an entry, call this with insert=INSERT, then + write the value you want into the returned slot. When inserting an + entry, NULL may be returned if memory allocation fails. */ + value_type *find_slot_with_hash (const compare_type &comparable, + hashval_t hash, enum insert_option insert); + + /* This function deletes an element with the given COMPARABLE value + from hash table starting with the given HASH. If there is no + matching element in the hash table, this function does nothing. */ + void remove_elt_with_hash (const compare_type &, hashval_t); + + /* Like remove_elt_with_hash, but compute the hash value from the + element. */ + void remove_elt (const value_type &value) + { + remove_elt_with_hash (value, Descriptor::hash (value)); + } + + /* This function scans over the entire hash table calling CALLBACK for + each live entry. If CALLBACK returns false, the iteration stops. + ARGUMENT is passed as CALLBACK's second argument. */ + template + void traverse_noresize (Argument argument); + + /* Like traverse_noresize, but does resize the table when it is too empty + to improve effectivity of subsequent calls. */ + template + void traverse (Argument argument); + + class iterator + { + public: + iterator () : m_slot (NULL), m_limit (NULL) {} + + iterator (value_type *slot, value_type *limit) : + m_slot (slot), m_limit (limit) {} + + inline value_type &operator * () { return *m_slot; } + void slide (); + inline iterator &operator ++ (); + bool operator != (const iterator &other) const + { + return m_slot != other.m_slot || m_limit != other.m_limit; + } + + private: + value_type *m_slot; + value_type *m_limit; + }; + + iterator begin () const + { + iterator iter (m_entries, m_entries + m_size); + iter.slide (); + return iter; + } + + iterator end () const { return iterator (); } + + double collisions () const + { + return m_searches ? static_cast (m_collisions) / m_searches : 0; + } + +private: + template friend void gt_ggc_mx (hash_table *); + template friend void gt_pch_nx (hash_table *); + template friend void + hashtab_entry_note_pointers (void *, void *, gt_pointer_operator, void *); + template friend void + gt_pch_nx (hash_map *, gt_pointer_operator, void *); + template friend void gt_pch_nx (hash_set *, + gt_pointer_operator, + void *); + template friend void gt_pch_nx (hash_table *, + gt_pointer_operator, void *); + + template friend void gt_cleare_cache (hash_table *); + + void empty_slow (); + + value_type *alloc_entries (size_t n CXX_MEM_STAT_INFO) const; + value_type *find_empty_slot_for_expand (hashval_t); + bool too_empty_p (unsigned int); + void expand (); + static bool is_deleted (value_type &v) + { + return Descriptor::is_deleted (v); + } + + static bool is_empty (value_type &v) + { + return Descriptor::is_empty (v); + } + + static void mark_deleted (value_type &v) + { + Descriptor::mark_deleted (v); + } + + static void mark_empty (value_type &v) + { + Descriptor::mark_empty (v); + } + + /* Table itself. */ + typename Descriptor::value_type *m_entries; + + size_t m_size; + + /* Current number of elements including also deleted elements. */ + size_t m_n_elements; + + /* Current number of deleted elements in the table. */ + size_t m_n_deleted; + + /* The following member is used for debugging. Its value is number + of all calls of `htab_find_slot' for the hash table. */ + unsigned int m_searches; + + /* The following member is used for debugging. Its value is number + of collisions fixed for time of work with the hash table. */ + unsigned int m_collisions; + + /* Current size (in entries) of the hash table, as an index into the + table of primes. */ + unsigned int m_size_prime_index; + + /* if m_entries is stored in ggc memory. */ + bool m_ggc; + + /* If we should gather memory statistics for the table. */ + bool m_gather_mem_stats; +}; + +/* As mem-stats.h heavily utilizes hash maps (hash tables), we have to include + mem-stats.h after hash_table declaration. */ + +#include "mem-stats.h" +#include "hash-map.h" + +extern mem_alloc_description hash_table_usage; + +/* Support function for statistics. */ +extern void dump_hash_table_loc_statistics (void); + +template class Allocator> +hash_table::hash_table (size_t size, bool ggc, bool + gather_mem_stats, + mem_alloc_origin origin + MEM_STAT_DECL) : + m_n_elements (0), m_n_deleted (0), m_searches (0), m_collisions (0), + m_ggc (ggc), m_gather_mem_stats (gather_mem_stats) +{ + unsigned int size_prime_index; + + size_prime_index = hash_table_higher_prime_index (size); + size = prime_tab[size_prime_index].prime; + + if (m_gather_mem_stats) + hash_table_usage.register_descriptor (this, origin, ggc + FINAL_PASS_MEM_STAT); + + m_entries = alloc_entries (size PASS_MEM_STAT); + m_size = size; + m_size_prime_index = size_prime_index; +} + +template class Allocator> +hash_table::hash_table (const hash_table &h, bool ggc, + bool gather_mem_stats, + mem_alloc_origin origin + MEM_STAT_DECL) : + m_n_elements (h.m_n_elements), m_n_deleted (h.m_n_deleted), + m_searches (0), m_collisions (0), m_ggc (ggc), + m_gather_mem_stats (gather_mem_stats) +{ + size_t size = h.m_size; + + if (m_gather_mem_stats) + hash_table_usage.register_descriptor (this, origin, ggc + FINAL_PASS_MEM_STAT); + + value_type *nentries = alloc_entries (size PASS_MEM_STAT); + for (size_t i = 0; i < size; ++i) + { + value_type &entry = h.m_entries[i]; + if (is_deleted (entry)) + mark_deleted (nentries[i]); + else if (!is_empty (entry)) + nentries[i] = entry; + } + m_entries = nentries; + m_size = size; + m_size_prime_index = h.m_size_prime_index; +} + +template class Allocator> +hash_table::~hash_table () +{ + for (size_t i = m_size - 1; i < m_size; i--) + if (!is_empty (m_entries[i]) && !is_deleted (m_entries[i])) + Descriptor::remove (m_entries[i]); + + if (!m_ggc) + Allocator ::data_free (m_entries); + else + ggc_free (m_entries); + + if (m_gather_mem_stats) + hash_table_usage.release_instance_overhead (this, + sizeof (value_type) * m_size, + true); +} + +/* This function returns an array of empty hash table elements. */ + +template class Allocator> +inline typename hash_table::value_type * +hash_table::alloc_entries (size_t n MEM_STAT_DECL) const +{ + value_type *nentries; + + if (m_gather_mem_stats) + hash_table_usage.register_instance_overhead (sizeof (value_type) * n, this); + + if (!m_ggc) + nentries = Allocator ::data_alloc (n); + else + nentries = ::ggc_cleared_vec_alloc (n PASS_MEM_STAT); + + gcc_assert (nentries != NULL); + for (size_t i = 0; i < n; i++) + mark_empty (nentries[i]); + + return nentries; +} + +/* Similar to find_slot, but without several unwanted side effects: + - Does not call equal when it finds an existing entry. + - Does not change the count of elements/searches/collisions in the + hash table. + This function also assumes there are no deleted entries in the table. + HASH is the hash value for the element to be inserted. */ + +template class Allocator> +typename hash_table::value_type * +hash_table::find_empty_slot_for_expand (hashval_t hash) +{ + hashval_t index = hash_table_mod1 (hash, m_size_prime_index); + size_t size = m_size; + value_type *slot = m_entries + index; + hashval_t hash2; + + if (is_empty (*slot)) + return slot; + gcc_checking_assert (!is_deleted (*slot)); + + hash2 = hash_table_mod2 (hash, m_size_prime_index); + for (;;) + { + index += hash2; + if (index >= size) + index -= size; + + slot = m_entries + index; + if (is_empty (*slot)) + return slot; + gcc_checking_assert (!is_deleted (*slot)); + } +} + +/* Return true if the current table is excessively big for ELTS elements. */ + +template class Allocator> +inline bool +hash_table::too_empty_p (unsigned int elts) +{ + return elts * 8 < m_size && m_size > 32; +} + +/* The following function changes size of memory allocated for the + entries and repeatedly inserts the table elements. The occupancy + of the table after the call will be about 50%. Naturally the hash + table must already exist. Remember also that the place of the + table entries is changed. If memory allocation fails, this function + will abort. */ + +template class Allocator> +void +hash_table::expand () +{ + value_type *oentries = m_entries; + unsigned int oindex = m_size_prime_index; + size_t osize = size (); + value_type *olimit = oentries + osize; + size_t elts = elements (); + + /* Resize only when table after removal of unused elements is either + too full or too empty. */ + unsigned int nindex; + size_t nsize; + if (elts * 2 > osize || too_empty_p (elts)) + { + nindex = hash_table_higher_prime_index (elts * 2); + nsize = prime_tab[nindex].prime; + } + else + { + nindex = oindex; + nsize = osize; + } + + value_type *nentries = alloc_entries (nsize); + + if (m_gather_mem_stats) + hash_table_usage.release_instance_overhead (this, sizeof (value_type) + * osize); + + m_entries = nentries; + m_size = nsize; + m_size_prime_index = nindex; + m_n_elements -= m_n_deleted; + m_n_deleted = 0; + + value_type *p = oentries; + do + { + value_type &x = *p; + + if (!is_empty (x) && !is_deleted (x)) + { + value_type *q = find_empty_slot_for_expand (Descriptor::hash (x)); + + *q = x; + } + + p++; + } + while (p < olimit); + + if (!m_ggc) + Allocator ::data_free (oentries); + else + ggc_free (oentries); +} + +/* Implements empty() in cases where it isn't a no-op. */ + +template class Allocator> +void +hash_table::empty_slow () +{ + size_t size = m_size; + size_t nsize = size; + value_type *entries = m_entries; + int i; + + for (i = size - 1; i >= 0; i--) + if (!is_empty (entries[i]) && !is_deleted (entries[i])) + Descriptor::remove (entries[i]); + + /* Instead of clearing megabyte, downsize the table. */ + if (size > 1024*1024 / sizeof (value_type)) + nsize = 1024 / sizeof (value_type); + else if (too_empty_p (m_n_elements)) + nsize = m_n_elements * 2; + + if (nsize != size) + { + int nindex = hash_table_higher_prime_index (nsize); + int nsize = prime_tab[nindex].prime; + + if (!m_ggc) + Allocator ::data_free (m_entries); + else + ggc_free (m_entries); + + m_entries = alloc_entries (nsize); + m_size = nsize; + m_size_prime_index = nindex; + } + else + memset (entries, 0, size * sizeof (value_type)); + m_n_deleted = 0; + m_n_elements = 0; +} + +/* This function clears a specified SLOT in a hash table. It is + useful when you've already done the lookup and don't want to do it + again. */ + +template class Allocator> +void +hash_table::clear_slot (value_type *slot) +{ + gcc_checking_assert (!(slot < m_entries || slot >= m_entries + size () + || is_empty (*slot) || is_deleted (*slot))); + + Descriptor::remove (*slot); + + mark_deleted (*slot); + m_n_deleted++; +} + +/* This function searches for a hash table entry equal to the given + COMPARABLE element starting with the given HASH value. It cannot + be used to insert or delete an element. */ + +template class Allocator> +typename hash_table::value_type & +hash_table +::find_with_hash (const compare_type &comparable, hashval_t hash) +{ + m_searches++; + size_t size = m_size; + hashval_t index = hash_table_mod1 (hash, m_size_prime_index); + + value_type *entry = &m_entries[index]; + if (is_empty (*entry) + || (!is_deleted (*entry) && Descriptor::equal (*entry, comparable))) + return *entry; + + hashval_t hash2 = hash_table_mod2 (hash, m_size_prime_index); + for (;;) + { + m_collisions++; + index += hash2; + if (index >= size) + index -= size; + + entry = &m_entries[index]; + if (is_empty (*entry) + || (!is_deleted (*entry) && Descriptor::equal (*entry, comparable))) + return *entry; + } +} + +/* This function searches for a hash table slot containing an entry + equal to the given COMPARABLE element and starting with the given + HASH. To delete an entry, call this with insert=NO_INSERT, then + call clear_slot on the slot returned (possibly after doing some + checks). To insert an entry, call this with insert=INSERT, then + write the value you want into the returned slot. When inserting an + entry, NULL may be returned if memory allocation fails. */ + +template class Allocator> +typename hash_table::value_type * +hash_table +::find_slot_with_hash (const compare_type &comparable, hashval_t hash, + enum insert_option insert) +{ + if (insert == INSERT && m_size * 3 <= m_n_elements * 4) + expand (); + + m_searches++; + + value_type *first_deleted_slot = NULL; + hashval_t index = hash_table_mod1 (hash, m_size_prime_index); + hashval_t hash2 = hash_table_mod2 (hash, m_size_prime_index); + value_type *entry = &m_entries[index]; + size_t size = m_size; + if (is_empty (*entry)) + goto empty_entry; + else if (is_deleted (*entry)) + first_deleted_slot = &m_entries[index]; + else if (Descriptor::equal (*entry, comparable)) + return &m_entries[index]; + + for (;;) + { + m_collisions++; + index += hash2; + if (index >= size) + index -= size; + + entry = &m_entries[index]; + if (is_empty (*entry)) + goto empty_entry; + else if (is_deleted (*entry)) + { + if (!first_deleted_slot) + first_deleted_slot = &m_entries[index]; + } + else if (Descriptor::equal (*entry, comparable)) + return &m_entries[index]; + } + + empty_entry: + if (insert == NO_INSERT) + return NULL; + + if (first_deleted_slot) + { + m_n_deleted--; + mark_empty (*first_deleted_slot); + return first_deleted_slot; + } + + m_n_elements++; + return &m_entries[index]; +} + +/* This function deletes an element with the given COMPARABLE value + from hash table starting with the given HASH. If there is no + matching element in the hash table, this function does nothing. */ + +template class Allocator> +void +hash_table +::remove_elt_with_hash (const compare_type &comparable, hashval_t hash) +{ + value_type *slot = find_slot_with_hash (comparable, hash, NO_INSERT); + if (is_empty (*slot)) + return; + + Descriptor::remove (*slot); + + mark_deleted (*slot); + m_n_deleted++; +} + +/* This function scans over the entire hash table calling CALLBACK for + each live entry. If CALLBACK returns false, the iteration stops. + ARGUMENT is passed as CALLBACK's second argument. */ + +template class Allocator> +template::value_type *slot, + Argument argument)> +void +hash_table::traverse_noresize (Argument argument) +{ + value_type *slot = m_entries; + value_type *limit = slot + size (); + + do + { + value_type &x = *slot; + + if (!is_empty (x) && !is_deleted (x)) + if (! Callback (slot, argument)) + break; + } + while (++slot < limit); +} + +/* Like traverse_noresize, but does resize the table when it is too empty + to improve effectivity of subsequent calls. */ + +template class Allocator> +template ::value_type *slot, + Argument argument)> +void +hash_table::traverse (Argument argument) +{ + if (too_empty_p (elements ())) + expand (); + + traverse_noresize (argument); +} + +/* Slide down the iterator slots until an active entry is found. */ + +template class Allocator> +void +hash_table::iterator::slide () +{ + for ( ; m_slot < m_limit; ++m_slot ) + { + value_type &x = *m_slot; + if (!is_empty (x) && !is_deleted (x)) + return; + } + m_slot = NULL; + m_limit = NULL; +} + +/* Bump the iterator. */ + +template class Allocator> +inline typename hash_table::iterator & +hash_table::iterator::operator ++ () +{ + ++m_slot; + slide (); + return *this; +} + + +/* Iterate through the elements of hash_table HTAB, + using hash_table <....>::iterator ITER, + storing each element in RESULT, which is of type TYPE. */ + +#define FOR_EACH_HASH_TABLE_ELEMENT(HTAB, RESULT, TYPE, ITER) \ + for ((ITER) = (HTAB).begin (); \ + (ITER) != (HTAB).end () ? (RESULT = *(ITER) , true) : false; \ + ++(ITER)) + +/* ggc walking routines. */ + +template +static inline void +gt_ggc_mx (hash_table *h) +{ + typedef hash_table table; + + if (!ggc_test_and_set_mark (h->m_entries)) + return; + + for (size_t i = 0; i < h->m_size; i++) + { + if (table::is_empty (h->m_entries[i]) + || table::is_deleted (h->m_entries[i])) + continue; + + E::ggc_mx (h->m_entries[i]); + } +} + +template +static inline void +hashtab_entry_note_pointers (void *obj, void *h, gt_pointer_operator op, + void *cookie) +{ + hash_table *map = static_cast *> (h); + gcc_checking_assert (map->m_entries == obj); + for (size_t i = 0; i < map->m_size; i++) + { + typedef hash_table table; + if (table::is_empty (map->m_entries[i]) + || table::is_deleted (map->m_entries[i])) + continue; + + D::pch_nx (map->m_entries[i], op, cookie); + } +} + +template +static void +gt_pch_nx (hash_table *h) +{ + bool success + = gt_pch_note_object (h->m_entries, h, hashtab_entry_note_pointers); + gcc_checking_assert (success); + for (size_t i = 0; i < h->m_size; i++) + { + if (hash_table::is_empty (h->m_entries[i]) + || hash_table::is_deleted (h->m_entries[i])) + continue; + + D::pch_nx (h->m_entries[i]); + } +} + +template +static inline void +gt_pch_nx (hash_table *h, gt_pointer_operator op, void *cookie) +{ + op (&h->m_entries, cookie); +} + +template +inline void +gt_cleare_cache (hash_table *h) +{ + extern void gt_ggc_mx (typename H::value_type &t); + typedef hash_table table; + if (!h) + return; + + for (typename table::iterator iter = h->begin (); iter != h->end (); ++iter) + if (!table::is_empty (*iter) && !table::is_deleted (*iter)) + { + int res = H::keep_cache_entry (*iter); + if (res == 0) + h->clear_slot (&*iter); + else if (res != -1) + gt_ggc_mx (*iter); + } +} + +#endif /* TYPED_HASHTAB_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hash-traits.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hash-traits.h new file mode 100644 index 0000000..f1bfd9f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hash-traits.h @@ -0,0 +1,309 @@ +/* Traits for hashable types. + Copyright (C) 2014-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef hash_traits_h +#define hash_traits_h + +/* Helpful type for removing with free. */ + +template +struct typed_free_remove +{ + static inline void remove (Type *p); +}; + + +/* Remove with free. */ + +template +inline void +typed_free_remove ::remove (Type *p) +{ + free (p); +} + +/* Helpful type for removing with delete. */ + +template +struct typed_delete_remove +{ + static inline void remove (Type *p); +}; + + +/* Remove with delete. */ + +template +inline void +typed_delete_remove ::remove (Type *p) +{ + delete p; +} + +/* Helpful type for a no-op remove. */ + +template +struct typed_noop_remove +{ + static inline void remove (Type &); +}; + + +/* Remove doing nothing. */ + +template +inline void +typed_noop_remove ::remove (Type &) +{ +} + + +/* Hasher for integer type Type in which Empty is a spare value that can be + used to mark empty slots. If Deleted != Empty then Deleted is another + spare value that can be used for deleted slots; if Deleted == Empty then + hash table entries cannot be deleted. */ + +template +struct int_hash : typed_noop_remove +{ + typedef Type value_type; + typedef Type compare_type; + + static inline hashval_t hash (value_type); + static inline bool equal (value_type existing, value_type candidate); + static inline void mark_deleted (Type &); + static inline void mark_empty (Type &); + static inline bool is_deleted (Type); + static inline bool is_empty (Type); +}; + +template +inline hashval_t +int_hash ::hash (value_type x) +{ + return x; +} + +template +inline bool +int_hash ::equal (value_type x, value_type y) +{ + return x == y; +} + +template +inline void +int_hash ::mark_deleted (Type &x) +{ + gcc_assert (Empty != Deleted); + x = Deleted; +} + +template +inline void +int_hash ::mark_empty (Type &x) +{ + x = Empty; +} + +template +inline bool +int_hash ::is_deleted (Type x) +{ + return Empty != Deleted && x == Deleted; +} + +template +inline bool +int_hash ::is_empty (Type x) +{ + return x == Empty; +} + +/* Pointer hasher based on pointer equality. Other types of pointer hash + can inherit this and override the hash and equal functions with some + other form of equality (such as string equality). */ + +template +struct pointer_hash +{ + typedef Type *value_type; + typedef Type *compare_type; + + static inline hashval_t hash (const value_type &); + static inline bool equal (const value_type &existing, + const compare_type &candidate); + static inline void mark_deleted (Type *&); + static inline void mark_empty (Type *&); + static inline bool is_deleted (Type *); + static inline bool is_empty (Type *); +}; + +template +inline hashval_t +pointer_hash ::hash (const value_type &candidate) +{ + /* This is a really poor hash function, but it is what the current code uses, + so I am reusing it to avoid an additional axis in testing. */ + return (hashval_t) ((intptr_t)candidate >> 3); +} + +template +inline bool +pointer_hash ::equal (const value_type &existing, + const compare_type &candidate) +{ + return existing == candidate; +} + +template +inline void +pointer_hash ::mark_deleted (Type *&e) +{ + e = reinterpret_cast (1); +} + +template +inline void +pointer_hash ::mark_empty (Type *&e) +{ + e = NULL; +} + +template +inline bool +pointer_hash ::is_deleted (Type *e) +{ + return e == reinterpret_cast (1); +} + +template +inline bool +pointer_hash ::is_empty (Type *e) +{ + return e == NULL; +} + +/* Hasher for "const char *" strings, using string rather than pointer + equality. */ + +struct string_hash : pointer_hash +{ + static inline hashval_t hash (const char *); + static inline bool equal (const char *, const char *); +}; + +inline hashval_t +string_hash::hash (const char *id) +{ + return htab_hash_string (id); +} + +inline bool +string_hash::equal (const char *id1, const char *id2) +{ + return strcmp (id1, id2) == 0; +} + +/* Remover and marker for entries in gc memory. */ + +template +struct ggc_remove +{ + static void remove (T &) {} + + static void + ggc_mx (T &p) + { + extern void gt_ggc_mx (T &); + gt_ggc_mx (p); + } + + static void + pch_nx (T &p) + { + extern void gt_pch_nx (T &); + gt_pch_nx (p); + } + + static void + pch_nx (T &p, gt_pointer_operator op, void *cookie) + { + op (&p, cookie); + } +}; + +/* Remover and marker for "cache" entries in gc memory. These entries can + be deleted if there are no non-cache references to the data. */ + +template +struct ggc_cache_remove : ggc_remove +{ + /* Entries are weakly held because this is for caches. */ + static void ggc_mx (T &) {} + + static int + keep_cache_entry (T &e) + { + return ggc_marked_p (e) ? -1 : 0; + } +}; + +/* Traits for pointer elements that should not be freed when an element + is deleted. */ + +template +struct nofree_ptr_hash : pointer_hash , typed_noop_remove {}; + +/* Traits for pointer elements that should be freed via free() when an + element is deleted. */ + +template +struct free_ptr_hash : pointer_hash , typed_free_remove {}; + +/* Traits for pointer elements that should be freed via delete operand when an + element is deleted. */ + +template +struct delete_ptr_hash : pointer_hash , typed_delete_remove {}; + +/* Traits for elements that point to gc memory. The pointed-to data + must be kept across collections. */ + +template +struct ggc_ptr_hash : pointer_hash , ggc_remove {}; + +/* Traits for elements that point to gc memory. The elements don't + in themselves keep the pointed-to data alive and they can be deleted + if the pointed-to data is going to be collected. */ + +template +struct ggc_cache_ptr_hash : pointer_hash , ggc_cache_remove {}; + +/* Traits for string elements that should not be freed when an element + is deleted. */ + +struct nofree_string_hash : string_hash, typed_noop_remove {}; + +template struct default_hash_traits : T {}; + +template +struct default_hash_traits : ggc_ptr_hash {}; + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hashtab.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hashtab.h new file mode 100644 index 0000000..b5682f8 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hashtab.h @@ -0,0 +1,204 @@ +/* An expandable hash tables datatype. + Copyright (C) 1999-2017 Free Software Foundation, Inc. + Contributed by Vladimir Makarov (vmakarov@cygnus.com). + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* This package implements basic hash table functionality. It is possible + to search for an entry, create an entry and destroy an entry. + + Elements in the table are generic pointers. + + The size of the table is not fixed; if the occupancy of the table + grows too high the hash table will be expanded. + + The abstract data implementation is based on generalized Algorithm D + from Knuth's book "The art of computer programming". Hash table is + expanded by creation of new hash table and transferring elements from + the old table to the new table. */ + +#ifndef __HASHTAB_H__ +#define __HASHTAB_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "ansidecl.h" + +/* The type for a hash code. */ +typedef unsigned int hashval_t; + +/* Callback function pointer types. */ + +/* Calculate hash of a table entry. */ +typedef hashval_t (*htab_hash) (const void *); + +/* Compare a table entry with a possible entry. The entry already in + the table always comes first, so the second element can be of a + different type (but in this case htab_find and htab_find_slot + cannot be used; instead the variants that accept a hash value + must be used). */ +typedef int (*htab_eq) (const void *, const void *); + +/* Cleanup function called whenever a live element is removed from + the hash table. */ +typedef void (*htab_del) (void *); + +/* Function called by htab_traverse for each live element. The first + arg is the slot of the element (which can be passed to htab_clear_slot + if desired), the second arg is the auxiliary pointer handed to + htab_traverse. Return 1 to continue scan, 0 to stop. */ +typedef int (*htab_trav) (void **, void *); + +/* Memory-allocation function, with the same functionality as calloc(). + Iff it returns NULL, the hash table implementation will pass an error + code back to the user, so if your code doesn't handle errors, + best if you use xcalloc instead. */ +typedef void *(*htab_alloc) (size_t, size_t); + +/* We also need a free() routine. */ +typedef void (*htab_free) (void *); + +/* Memory allocation and deallocation; variants which take an extra + argument. */ +typedef void *(*htab_alloc_with_arg) (void *, size_t, size_t); +typedef void (*htab_free_with_arg) (void *, void *); + +/* This macro defines reserved value for empty table entry. */ + +#define HTAB_EMPTY_ENTRY ((PTR) 0) + +/* This macro defines reserved value for table entry which contained + a deleted element. */ + +#define HTAB_DELETED_ENTRY ((PTR) 1) + +/* Hash tables are of the following type. The structure + (implementation) of this type is not needed for using the hash + tables. All work with hash table should be executed only through + functions mentioned below. The size of this structure is subject to + change. */ + +struct htab { + /* Pointer to hash function. */ + htab_hash hash_f; + + /* Pointer to comparison function. */ + htab_eq eq_f; + + /* Pointer to cleanup function. */ + htab_del del_f; + + /* Table itself. */ + void **entries; + + /* Current size (in entries) of the hash table. */ + size_t size; + + /* Current number of elements including also deleted elements. */ + size_t n_elements; + + /* Current number of deleted elements in the table. */ + size_t n_deleted; + + /* The following member is used for debugging. Its value is number + of all calls of `htab_find_slot' for the hash table. */ + unsigned int searches; + + /* The following member is used for debugging. Its value is number + of collisions fixed for time of work with the hash table. */ + unsigned int collisions; + + /* Pointers to allocate/free functions. */ + htab_alloc alloc_f; + htab_free free_f; + + /* Alternate allocate/free functions, which take an extra argument. */ + void *alloc_arg; + htab_alloc_with_arg alloc_with_arg_f; + htab_free_with_arg free_with_arg_f; + + /* Current size (in entries) of the hash table, as an index into the + table of primes. */ + unsigned int size_prime_index; +}; + +typedef struct htab *htab_t; + +/* An enum saying whether we insert into the hash table or not. */ +enum insert_option {NO_INSERT, INSERT}; + +/* The prototypes of the package functions. */ + +extern htab_t htab_create_alloc (size_t, htab_hash, + htab_eq, htab_del, + htab_alloc, htab_free); + +extern htab_t htab_create_alloc_ex (size_t, htab_hash, + htab_eq, htab_del, + void *, htab_alloc_with_arg, + htab_free_with_arg); + +extern htab_t htab_create_typed_alloc (size_t, htab_hash, htab_eq, htab_del, + htab_alloc, htab_alloc, htab_free); + +/* Backward-compatibility functions. */ +extern htab_t htab_create (size_t, htab_hash, htab_eq, htab_del); +extern htab_t htab_try_create (size_t, htab_hash, htab_eq, htab_del); + +extern void htab_set_functions_ex (htab_t, htab_hash, + htab_eq, htab_del, + void *, htab_alloc_with_arg, + htab_free_with_arg); + +extern void htab_delete (htab_t); +extern void htab_empty (htab_t); + +extern void * htab_find (htab_t, const void *); +extern void ** htab_find_slot (htab_t, const void *, enum insert_option); +extern void * htab_find_with_hash (htab_t, const void *, hashval_t); +extern void ** htab_find_slot_with_hash (htab_t, const void *, + hashval_t, enum insert_option); +extern void htab_clear_slot (htab_t, void **); +extern void htab_remove_elt (htab_t, void *); +extern void htab_remove_elt_with_hash (htab_t, void *, hashval_t); + +extern void htab_traverse (htab_t, htab_trav, void *); +extern void htab_traverse_noresize (htab_t, htab_trav, void *); + +extern size_t htab_size (htab_t); +extern size_t htab_elements (htab_t); +extern double htab_collisions (htab_t); + +/* A hash function for pointers. */ +extern htab_hash htab_hash_pointer; + +/* An equality function for pointers. */ +extern htab_eq htab_eq_pointer; + +/* A hash function for null-terminated strings. */ +extern hashval_t htab_hash_string (const void *); + +/* An iterative hash function for arbitrary data. */ +extern hashval_t iterative_hash (const void *, size_t, hashval_t); +/* Shorthand for hashing something with an intrinsic size. */ +#define iterative_hash_object(OB,INIT) iterative_hash (&OB, sizeof (OB), INIT) + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __HASHTAB_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/highlev-plugin-common.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/highlev-plugin-common.h new file mode 100644 index 0000000..23bd732 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/highlev-plugin-common.h @@ -0,0 +1,33 @@ +/* Interface for high-level plugins in GCC - Parts common between GCC, + ICI and high-level plugins. + + Copyright (C) 2009-2017 Free Software Foundation, Inc. + + Contributed by INRIA. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef HIGHLEV_PLUGIN_COMMON_H +#define HIGHLEV_PLUGIN_COMMON_H + +/* Return codes for invoke_plugin_callbacks / call_plugin_event . */ +#define PLUGEVT_SUCCESS 0 +#define PLUGEVT_NO_EVENTS 1 +#define PLUGEVT_NO_SUCH_EVENT 2 +#define PLUGEVT_NO_CALLBACK 3 + +#endif /* HIGHLEV_PLUGIN_COMMON_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hooks.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hooks.h new file mode 100644 index 0000000..95f7810 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hooks.h @@ -0,0 +1,116 @@ +/* General-purpose hooks. + Copyright (C) 2002-2017 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING3. If not see + . + + In other words, you are welcome to use, share and improve this program. + You are forbidden to forbid anyone else to use, share and improve + what you give them. Help stamp out software-hoarding! */ + +#ifndef GCC_HOOKS_H +#define GCC_HOOKS_H + + +extern bool hook_bool_void_false (void); +extern bool hook_bool_void_true (void); +extern bool hook_bool_bool_false (bool); +extern bool hook_bool_bool_gcc_optionsp_false (bool, struct gcc_options *); +extern bool hook_bool_const_int_const_int_true (const int, const int); +extern bool hook_bool_mode_false (machine_mode); +extern bool hook_bool_mode_true (machine_mode); +extern bool hook_bool_mode_const_rtx_false (machine_mode, const_rtx); +extern bool hook_bool_mode_const_rtx_true (machine_mode, const_rtx); +extern bool hook_bool_mode_rtx_false (machine_mode, rtx); +extern bool hook_bool_mode_rtx_true (machine_mode, rtx); +extern bool hook_bool_const_rtx_insn_const_rtx_insn_true (const rtx_insn *, + const rtx_insn *); +extern bool hook_bool_mode_uhwi_false (machine_mode, + unsigned HOST_WIDE_INT); +extern bool hook_bool_tree_false (tree); +extern bool hook_bool_const_tree_false (const_tree); +extern bool hook_bool_tree_true (tree); +extern bool hook_bool_const_tree_true (const_tree); +extern bool hook_bool_gsiptr_false (gimple_stmt_iterator *); +extern bool hook_bool_const_tree_hwi_hwi_const_tree_false (const_tree, + HOST_WIDE_INT, + HOST_WIDE_INT, + const_tree); +extern bool hook_bool_const_tree_hwi_hwi_const_tree_true (const_tree, + HOST_WIDE_INT, + HOST_WIDE_INT, + const_tree); +extern bool hook_bool_rtx_insn_true (rtx_insn *); +extern bool hook_bool_rtx_false (rtx); +extern bool hook_bool_rtx_insn_int_false (rtx_insn *, int); +extern bool hook_bool_uintp_uintp_false (unsigned int *, unsigned int *); +extern bool hook_bool_reg_class_t_false (reg_class_t regclass); +extern bool hook_bool_rtx_mode_int_int_intp_bool_false (rtx, machine_mode, + int, int, int *, bool); +extern bool hook_bool_tree_tree_false (tree, tree); +extern bool hook_bool_tree_tree_true (tree, tree); +extern bool hook_bool_tree_bool_false (tree, bool); +extern bool hook_bool_wint_wint_uint_bool_true (const widest_int &, + const widest_int &, + unsigned int, bool); + +extern void hook_void_void (void); +extern void hook_void_constcharptr (const char *); +extern void hook_void_rtx_insn_int (rtx_insn *, int); +extern void hook_void_FILEptr_constcharptr (FILE *, const char *); +extern void hook_void_FILEptr_constcharptr_const_tree (FILE *, const char *, + const_tree); +extern bool hook_bool_FILEptr_rtx_false (FILE *, rtx); +extern void hook_void_rtx_tree (rtx, tree); +extern void hook_void_tree (tree); +extern void hook_void_tree_treeptr (tree, tree *); +extern void hook_void_int_int (int, int); +extern void hook_void_gcc_optionsp (struct gcc_options *); +extern bool hook_bool_uint_uintp_false (unsigned int, unsigned int *); + +extern int hook_int_uint_mode_1 (unsigned int, machine_mode); +extern int hook_int_const_tree_0 (const_tree); +extern int hook_int_const_tree_const_tree_1 (const_tree, const_tree); +extern int hook_int_rtx_0 (rtx); +extern int hook_int_rtx_1 (rtx); +extern int hook_int_rtx_insn_unreachable (rtx_insn *); +extern int hook_int_rtx_bool_0 (rtx, bool); +extern int hook_int_rtx_mode_as_bool_0 (rtx, machine_mode, addr_space_t, + bool); + +extern tree hook_tree_const_tree_null (const_tree); +extern tree hook_tree_void_null (void); + +extern tree hook_tree_tree_tree_null (tree, tree); +extern tree hook_tree_tree_tree_tree_null (tree, tree, tree); +extern tree hook_tree_tree_int_treep_bool_null (tree, int, tree *, bool); + +extern unsigned hook_uint_void_0 (void); +extern unsigned int hook_uint_mode_0 (machine_mode); + +extern bool default_can_output_mi_thunk_no_vcall (const_tree, HOST_WIDE_INT, + HOST_WIDE_INT, const_tree); + +extern rtx hook_rtx_rtx_identity (rtx); +extern rtx hook_rtx_rtx_null (rtx); +extern rtx hook_rtx_tree_int_null (tree, int); + +extern char *hook_charptr_void_null (void); +extern const char *hook_constcharptr_void_null (void); +extern const char *hook_constcharptr_const_tree_null (const_tree); +extern const char *hook_constcharptr_const_rtx_insn_null (const rtx_insn *); +extern const char *hook_constcharptr_const_tree_const_tree_null (const_tree, const_tree); +extern const char *hook_constcharptr_int_const_tree_null (int, const_tree); +extern const char *hook_constcharptr_int_const_tree_const_tree_null (int, const_tree, const_tree); +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hosthooks-def.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hosthooks-def.h new file mode 100644 index 0000000..ca6cdfa --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hosthooks-def.h @@ -0,0 +1,51 @@ +/* Default macros to initialize the lang_hooks data structure. + Copyright (C) 2003-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_HOST_HOOKS_DEF_H +#define GCC_HOST_HOOKS_DEF_H + +#include "hooks.h" + +#define HOST_HOOKS_EXTRA_SIGNALS hook_void_void +#if HAVE_MMAP_FILE +#define HOST_HOOKS_GT_PCH_GET_ADDRESS mmap_gt_pch_get_address +#define HOST_HOOKS_GT_PCH_USE_ADDRESS mmap_gt_pch_use_address +#else +#define HOST_HOOKS_GT_PCH_GET_ADDRESS default_gt_pch_get_address +#define HOST_HOOKS_GT_PCH_USE_ADDRESS default_gt_pch_use_address +#endif + +#define HOST_HOOKS_GT_PCH_ALLOC_GRANULARITY \ + default_gt_pch_alloc_granularity + +extern void* default_gt_pch_get_address (size_t, int); +extern int default_gt_pch_use_address (void *, size_t, int, size_t); +extern size_t default_gt_pch_alloc_granularity (void); +extern void* mmap_gt_pch_get_address (size_t, int); +extern int mmap_gt_pch_use_address (void *, size_t, int, size_t); + +/* The structure is defined in hosthooks.h. */ +#define HOST_HOOKS_INITIALIZER { \ + HOST_HOOKS_EXTRA_SIGNALS, \ + HOST_HOOKS_GT_PCH_GET_ADDRESS, \ + HOST_HOOKS_GT_PCH_USE_ADDRESS, \ + HOST_HOOKS_GT_PCH_ALLOC_GRANULARITY \ +} + +#endif /* GCC_HOST_HOOKS_DEF_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hosthooks.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hosthooks.h new file mode 100644 index 0000000..7ae440c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hosthooks.h @@ -0,0 +1,48 @@ +/* The host_hooks data structure. + Copyright (C) 2003-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_HOST_HOOKS_H +#define GCC_HOST_HOOKS_H + +struct host_hooks +{ + void (*extra_signals) (void); + + /* Identify an address that's likely to be free in a subsequent invocation + of the compiler. The area should be able to hold SIZE bytes. FD is an + open file descriptor if the host would like to probe with mmap. */ + void * (*gt_pch_get_address) (size_t size, int fd); + + /* ADDR is an address returned by gt_pch_get_address. Attempt to allocate + SIZE bytes at the same address and load it with the data from FD at + OFFSET. Return -1 if we couldn't allocate memory at ADDR, return 0 + if the memory is allocated but the data not loaded, return 1 if done. */ + int (*gt_pch_use_address) (void *addr, size_t size, int fd, size_t offset); + + /* Return the alignment required for allocating virtual memory. Usually + this is the same as pagesize. */ + size_t (*gt_pch_alloc_granularity) (void); + + /* Whenever you add entries here, make sure you adjust hosthooks-def.h. */ +}; + +/* Each host provides its own. */ +extern const struct host_hooks host_hooks; + +#endif /* GCC_LANG_HOOKS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hsa-brig-format.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hsa-brig-format.h new file mode 100644 index 0000000..34d74df --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hsa-brig-format.h @@ -0,0 +1,1234 @@ +/* HSA BRIG (binary representation of HSAIL) 1.0.1 representation description. + Copyright (C) 2016-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. + +The contents of the file was created by extracting data structures, enum, +typedef and other definitions from HSA Programmer's Reference Manual Version +1.0.1 (http://www.hsafoundation.com/standards/). + +HTML version is provided on the following link: +http://www.hsafoundation.com/html/Content/PRM/Topics/PRM_title_page.htm */ + +#ifndef HSA_BRIG_FORMAT_H +#define HSA_BRIG_FORMAT_H + +struct BrigModuleHeader; +typedef uint16_t BrigKind16_t; +typedef uint32_t BrigVersion32_t; + +typedef BrigModuleHeader *BrigModule_t; +typedef uint32_t BrigDataOffset32_t; +typedef uint32_t BrigCodeOffset32_t; +typedef uint32_t BrigOperandOffset32_t; +typedef BrigDataOffset32_t BrigDataOffsetString32_t; +typedef BrigDataOffset32_t BrigDataOffsetCodeList32_t; +typedef BrigDataOffset32_t BrigDataOffsetOperandList32_t; +typedef uint8_t BrigAlignment8_t; + +enum BrigAlignment +{ + BRIG_ALIGNMENT_NONE = 0, + BRIG_ALIGNMENT_1 = 1, + BRIG_ALIGNMENT_2 = 2, + BRIG_ALIGNMENT_4 = 3, + BRIG_ALIGNMENT_8 = 4, + BRIG_ALIGNMENT_16 = 5, + BRIG_ALIGNMENT_32 = 6, + BRIG_ALIGNMENT_64 = 7, + BRIG_ALIGNMENT_128 = 8, + BRIG_ALIGNMENT_256 = 9 +}; + +typedef uint8_t BrigAllocation8_t; + +enum BrigAllocation +{ + BRIG_ALLOCATION_NONE = 0, + BRIG_ALLOCATION_PROGRAM = 1, + BRIG_ALLOCATION_AGENT = 2, + BRIG_ALLOCATION_AUTOMATIC = 3 +}; + +typedef uint8_t BrigAluModifier8_t; + +enum BrigAluModifierMask +{ + BRIG_ALU_FTZ = 1 +}; + +typedef uint8_t BrigAtomicOperation8_t; + +enum BrigAtomicOperation +{ + BRIG_ATOMIC_ADD = 0, + BRIG_ATOMIC_AND = 1, + BRIG_ATOMIC_CAS = 2, + BRIG_ATOMIC_EXCH = 3, + BRIG_ATOMIC_LD = 4, + BRIG_ATOMIC_MAX = 5, + BRIG_ATOMIC_MIN = 6, + BRIG_ATOMIC_OR = 7, + BRIG_ATOMIC_ST = 8, + BRIG_ATOMIC_SUB = 9, + BRIG_ATOMIC_WRAPDEC = 10, + BRIG_ATOMIC_WRAPINC = 11, + BRIG_ATOMIC_XOR = 12, + BRIG_ATOMIC_WAIT_EQ = 13, + BRIG_ATOMIC_WAIT_NE = 14, + BRIG_ATOMIC_WAIT_LT = 15, + BRIG_ATOMIC_WAIT_GTE = 16, + BRIG_ATOMIC_WAITTIMEOUT_EQ = 17, + BRIG_ATOMIC_WAITTIMEOUT_NE = 18, + BRIG_ATOMIC_WAITTIMEOUT_LT = 19, + BRIG_ATOMIC_WAITTIMEOUT_GTE = 20 +}; + +struct BrigBase +{ + uint16_t byteCount; + BrigKind16_t kind; +}; + +typedef uint8_t BrigCompareOperation8_t; + +enum BrigCompareOperation +{ + BRIG_COMPARE_EQ = 0, + BRIG_COMPARE_NE = 1, + BRIG_COMPARE_LT = 2, + BRIG_COMPARE_LE = 3, + BRIG_COMPARE_GT = 4, + BRIG_COMPARE_GE = 5, + BRIG_COMPARE_EQU = 6, + BRIG_COMPARE_NEU = 7, + BRIG_COMPARE_LTU = 8, + BRIG_COMPARE_LEU = 9, + BRIG_COMPARE_GTU = 10, + BRIG_COMPARE_GEU = 11, + BRIG_COMPARE_NUM = 12, + BRIG_COMPARE_NAN = 13, + BRIG_COMPARE_SEQ = 14, + BRIG_COMPARE_SNE = 15, + BRIG_COMPARE_SLT = 16, + BRIG_COMPARE_SLE = 17, + BRIG_COMPARE_SGT = 18, + BRIG_COMPARE_SGE = 19, + BRIG_COMPARE_SGEU = 20, + BRIG_COMPARE_SEQU = 21, + BRIG_COMPARE_SNEU = 22, + BRIG_COMPARE_SLTU = 23, + BRIG_COMPARE_SLEU = 24, + BRIG_COMPARE_SNUM = 25, + BRIG_COMPARE_SNAN = 26, + BRIG_COMPARE_SGTU = 27 +}; + +typedef uint16_t BrigControlDirective16_t; + +enum BrigControlDirective +{ + BRIG_CONTROL_NONE = 0, + BRIG_CONTROL_ENABLEBREAKEXCEPTIONS = 1, + BRIG_CONTROL_ENABLEDETECTEXCEPTIONS = 2, + BRIG_CONTROL_MAXDYNAMICGROUPSIZE = 3, + BRIG_CONTROL_MAXFLATGRIDSIZE = 4, + BRIG_CONTROL_MAXFLATWORKGROUPSIZE = 5, + BRIG_CONTROL_REQUIREDDIM = 6, + BRIG_CONTROL_REQUIREDGRIDSIZE = 7, + BRIG_CONTROL_REQUIREDWORKGROUPSIZE = 8, + BRIG_CONTROL_REQUIRENOPARTIALWORKGROUPS = 9 +}; + +typedef uint32_t BrigExceptions32_t; + +enum BrigExceptionsMask +{ + BRIG_EXCEPTIONS_INVALID_OPERATION = 1 << 0, + BRIG_EXCEPTIONS_DIVIDE_BY_ZERO = 1 << 1, + BRIG_EXCEPTIONS_OVERFLOW = 1 << 2, + BRIG_EXCEPTIONS_UNDERFLOW = 1 << 3, + BRIG_EXCEPTIONS_INEXACT = 1 << 4, + BRIG_EXCEPTIONS_FIRST_USER_DEFINED = 1 << 16 +}; + +typedef uint8_t BrigExecutableModifier8_t; + +enum BrigExecutableModifierMask +{ + BRIG_EXECUTABLE_DEFINITION = 1 +}; + +typedef uint8_t BrigImageChannelOrder8_t; + +enum BrigImageChannelOrder +{ + BRIG_CHANNEL_ORDER_A = 0, + BRIG_CHANNEL_ORDER_R = 1, + BRIG_CHANNEL_ORDER_RX = 2, + BRIG_CHANNEL_ORDER_RG = 3, + BRIG_CHANNEL_ORDER_RGX = 4, + BRIG_CHANNEL_ORDER_RA = 5, + BRIG_CHANNEL_ORDER_RGB = 6, + BRIG_CHANNEL_ORDER_RGBX = 7, + BRIG_CHANNEL_ORDER_RGBA = 8, + BRIG_CHANNEL_ORDER_BGRA = 9, + BRIG_CHANNEL_ORDER_ARGB = 10, + BRIG_CHANNEL_ORDER_ABGR = 11, + BRIG_CHANNEL_ORDER_SRGB = 12, + BRIG_CHANNEL_ORDER_SRGBX = 13, + BRIG_CHANNEL_ORDER_SRGBA = 14, + BRIG_CHANNEL_ORDER_SBGRA = 15, + BRIG_CHANNEL_ORDER_INTENSITY = 16, + BRIG_CHANNEL_ORDER_LUMINANCE = 17, + BRIG_CHANNEL_ORDER_DEPTH = 18, + BRIG_CHANNEL_ORDER_DEPTH_STENCIL = 19, + BRIG_CHANNEL_ORDER_FIRST_USER_DEFINED = 128 +}; + +typedef uint8_t BrigImageChannelType8_t; + +enum BrigImageChannelType +{ + BRIG_CHANNEL_TYPE_SNORM_INT8 = 0, + BRIG_CHANNEL_TYPE_SNORM_INT16 = 1, + BRIG_CHANNEL_TYPE_UNORM_INT8 = 2, + BRIG_CHANNEL_TYPE_UNORM_INT16 = 3, + BRIG_CHANNEL_TYPE_UNORM_INT24 = 4, + BRIG_CHANNEL_TYPE_UNORM_SHORT_555 = 5, + BRIG_CHANNEL_TYPE_UNORM_SHORT_565 = 6, + BRIG_CHANNEL_TYPE_UNORM_INT_101010 = 7, + BRIG_CHANNEL_TYPE_SIGNED_INT8 = 8, + BRIG_CHANNEL_TYPE_SIGNED_INT16 = 9, + BRIG_CHANNEL_TYPE_SIGNED_INT32 = 10, + BRIG_CHANNEL_TYPE_UNSIGNED_INT8 = 11, + BRIG_CHANNEL_TYPE_UNSIGNED_INT16 = 12, + BRIG_CHANNEL_TYPE_UNSIGNED_INT32 = 13, + BRIG_CHANNEL_TYPE_HALF_FLOAT = 14, + BRIG_CHANNEL_TYPE_FLOAT = 15, + BRIG_CHANNEL_TYPE_FIRST_USER_DEFINED = 128 +}; + +typedef uint8_t BrigImageGeometry8_t; + +enum BrigImageGeometry +{ + BRIG_GEOMETRY_1D = 0, + BRIG_GEOMETRY_2D = 1, + BRIG_GEOMETRY_3D = 2, + BRIG_GEOMETRY_1DA = 3, + BRIG_GEOMETRY_2DA = 4, + BRIG_GEOMETRY_1DB = 5, + BRIG_GEOMETRY_2DDEPTH = 6, + BRIG_GEOMETRY_2DADEPTH = 7, + BRIG_GEOMETRY_FIRST_USER_DEFINED = 128 +}; + +typedef uint8_t BrigImageQuery8_t; + +enum BrigImageQuery +{ + BRIG_IMAGE_QUERY_WIDTH = 0, + BRIG_IMAGE_QUERY_HEIGHT = 1, + BRIG_IMAGE_QUERY_DEPTH = 2, + BRIG_IMAGE_QUERY_ARRAY = 3, + BRIG_IMAGE_QUERY_CHANNELORDER = 4, + BRIG_IMAGE_QUERY_CHANNELTYPE = 5 +}; + +enum BrigKind +{ + BRIG_KIND_NONE = 0x0000, + BRIG_KIND_DIRECTIVE_BEGIN = 0x1000, + BRIG_KIND_DIRECTIVE_ARG_BLOCK_END = 0x1000, + BRIG_KIND_DIRECTIVE_ARG_BLOCK_START = 0x1001, + BRIG_KIND_DIRECTIVE_COMMENT = 0x1002, + BRIG_KIND_DIRECTIVE_CONTROL = 0x1003, + BRIG_KIND_DIRECTIVE_EXTENSION = 0x1004, + BRIG_KIND_DIRECTIVE_FBARRIER = 0x1005, + BRIG_KIND_DIRECTIVE_FUNCTION = 0x1006, + BRIG_KIND_DIRECTIVE_INDIRECT_FUNCTION = 0x1007, + BRIG_KIND_DIRECTIVE_KERNEL = 0x1008, + BRIG_KIND_DIRECTIVE_LABEL = 0x1009, + BRIG_KIND_DIRECTIVE_LOC = 0x100a, + BRIG_KIND_DIRECTIVE_MODULE = 0x100b, + BRIG_KIND_DIRECTIVE_PRAGMA = 0x100c, + BRIG_KIND_DIRECTIVE_SIGNATURE = 0x100d, + BRIG_KIND_DIRECTIVE_VARIABLE = 0x100e, + BRIG_KIND_DIRECTIVE_END = 0x100f, + BRIG_KIND_INST_BEGIN = 0x2000, + BRIG_KIND_INST_ADDR = 0x2000, + BRIG_KIND_INST_ATOMIC = 0x2001, + BRIG_KIND_INST_BASIC = 0x2002, + BRIG_KIND_INST_BR = 0x2003, + BRIG_KIND_INST_CMP = 0x2004, + BRIG_KIND_INST_CVT = 0x2005, + BRIG_KIND_INST_IMAGE = 0x2006, + BRIG_KIND_INST_LANE = 0x2007, + BRIG_KIND_INST_MEM = 0x2008, + BRIG_KIND_INST_MEM_FENCE = 0x2009, + BRIG_KIND_INST_MOD = 0x200a, + BRIG_KIND_INST_QUERY_IMAGE = 0x200b, + BRIG_KIND_INST_QUERY_SAMPLER = 0x200c, + BRIG_KIND_INST_QUEUE = 0x200d, + BRIG_KIND_INST_SEG = 0x200e, + BRIG_KIND_INST_SEG_CVT = 0x200f, + BRIG_KIND_INST_SIGNAL = 0x2010, + BRIG_KIND_INST_SOURCE_TYPE = 0x2011, + BRIG_KIND_INST_END = 0x2012, + BRIG_KIND_OPERAND_BEGIN = 0x3000, + BRIG_KIND_OPERAND_ADDRESS = 0x3000, + BRIG_KIND_OPERAND_ALIGN = 0x3001, + BRIG_KIND_OPERAND_CODE_LIST = 0x3002, + BRIG_KIND_OPERAND_CODE_REF = 0x3003, + BRIG_KIND_OPERAND_CONSTANT_BYTES = 0x3004, + BRIG_KIND_OPERAND_RESERVED = 0x3005, + BRIG_KIND_OPERAND_CONSTANT_IMAGE = 0x3006, + BRIG_KIND_OPERAND_CONSTANT_OPERAND_LIST = 0x3007, + BRIG_KIND_OPERAND_CONSTANT_SAMPLER = 0x3008, + BRIG_KIND_OPERAND_OPERAND_LIST = 0x3009, + BRIG_KIND_OPERAND_REGISTER = 0x300a, + BRIG_KIND_OPERAND_STRING = 0x300b, + BRIG_KIND_OPERAND_WAVESIZE = 0x300c, + BRIG_KIND_OPERAND_END = 0x300d +}; + +typedef uint8_t BrigLinkage8_t; + +enum BrigLinkage +{ + BRIG_LINKAGE_NONE = 0, + BRIG_LINKAGE_PROGRAM = 1, + BRIG_LINKAGE_MODULE = 2, + BRIG_LINKAGE_FUNCTION = 3, + BRIG_LINKAGE_ARG = 4 +}; + +typedef uint8_t BrigMachineModel8_t; + +enum BrigMachineModel +{ + BRIG_MACHINE_SMALL = 0, + BRIG_MACHINE_LARGE = 1 +}; + +typedef uint8_t BrigMemoryModifier8_t; + +enum BrigMemoryModifierMask +{ + BRIG_MEMORY_CONST = 1 +}; + +typedef uint8_t BrigMemoryOrder8_t; + +enum BrigMemoryOrder +{ + BRIG_MEMORY_ORDER_NONE = 0, + BRIG_MEMORY_ORDER_RELAXED = 1, + BRIG_MEMORY_ORDER_SC_ACQUIRE = 2, + BRIG_MEMORY_ORDER_SC_RELEASE = 3, + BRIG_MEMORY_ORDER_SC_ACQUIRE_RELEASE = 4 +}; + +typedef uint8_t BrigMemoryScope8_t; + +enum BrigMemoryScope +{ + BRIG_MEMORY_SCOPE_NONE = 0, + BRIG_MEMORY_SCOPE_WORKITEM = 1, + BRIG_MEMORY_SCOPE_WAVEFRONT = 2, + BRIG_MEMORY_SCOPE_WORKGROUP = 3, + BRIG_MEMORY_SCOPE_AGENT = 4, + BRIG_MEMORY_SCOPE_SYSTEM = 5 +}; + +struct BrigModuleHeader +{ + char identification[8]; + BrigVersion32_t brigMajor; + BrigVersion32_t brigMinor; + uint64_t byteCount; + uint8_t hash[64]; + uint32_t reserved; + uint32_t sectionCount; + uint64_t sectionIndex; +}; + +typedef uint16_t BrigOpcode16_t; + +enum BrigOpcode +{ + BRIG_OPCODE_NOP = 0, + BRIG_OPCODE_ABS = 1, + BRIG_OPCODE_ADD = 2, + BRIG_OPCODE_BORROW = 3, + BRIG_OPCODE_CARRY = 4, + BRIG_OPCODE_CEIL = 5, + BRIG_OPCODE_COPYSIGN = 6, + BRIG_OPCODE_DIV = 7, + BRIG_OPCODE_FLOOR = 8, + BRIG_OPCODE_FMA = 9, + BRIG_OPCODE_FRACT = 10, + BRIG_OPCODE_MAD = 11, + BRIG_OPCODE_MAX = 12, + BRIG_OPCODE_MIN = 13, + BRIG_OPCODE_MUL = 14, + BRIG_OPCODE_MULHI = 15, + BRIG_OPCODE_NEG = 16, + BRIG_OPCODE_REM = 17, + BRIG_OPCODE_RINT = 18, + BRIG_OPCODE_SQRT = 19, + BRIG_OPCODE_SUB = 20, + BRIG_OPCODE_TRUNC = 21, + BRIG_OPCODE_MAD24 = 22, + BRIG_OPCODE_MAD24HI = 23, + BRIG_OPCODE_MUL24 = 24, + BRIG_OPCODE_MUL24HI = 25, + BRIG_OPCODE_SHL = 26, + BRIG_OPCODE_SHR = 27, + BRIG_OPCODE_AND = 28, + BRIG_OPCODE_NOT = 29, + BRIG_OPCODE_OR = 30, + BRIG_OPCODE_POPCOUNT = 31, + BRIG_OPCODE_XOR = 32, + BRIG_OPCODE_BITEXTRACT = 33, + BRIG_OPCODE_BITINSERT = 34, + BRIG_OPCODE_BITMASK = 35, + BRIG_OPCODE_BITREV = 36, + BRIG_OPCODE_BITSELECT = 37, + BRIG_OPCODE_FIRSTBIT = 38, + BRIG_OPCODE_LASTBIT = 39, + BRIG_OPCODE_COMBINE = 40, + BRIG_OPCODE_EXPAND = 41, + BRIG_OPCODE_LDA = 42, + BRIG_OPCODE_MOV = 43, + BRIG_OPCODE_SHUFFLE = 44, + BRIG_OPCODE_UNPACKHI = 45, + BRIG_OPCODE_UNPACKLO = 46, + BRIG_OPCODE_PACK = 47, + BRIG_OPCODE_UNPACK = 48, + BRIG_OPCODE_CMOV = 49, + BRIG_OPCODE_CLASS = 50, + BRIG_OPCODE_NCOS = 51, + BRIG_OPCODE_NEXP2 = 52, + BRIG_OPCODE_NFMA = 53, + BRIG_OPCODE_NLOG2 = 54, + BRIG_OPCODE_NRCP = 55, + BRIG_OPCODE_NRSQRT = 56, + BRIG_OPCODE_NSIN = 57, + BRIG_OPCODE_NSQRT = 58, + BRIG_OPCODE_BITALIGN = 59, + BRIG_OPCODE_BYTEALIGN = 60, + BRIG_OPCODE_PACKCVT = 61, + BRIG_OPCODE_UNPACKCVT = 62, + BRIG_OPCODE_LERP = 63, + BRIG_OPCODE_SAD = 64, + BRIG_OPCODE_SADHI = 65, + BRIG_OPCODE_SEGMENTP = 66, + BRIG_OPCODE_FTOS = 67, + BRIG_OPCODE_STOF = 68, + BRIG_OPCODE_CMP = 69, + BRIG_OPCODE_CVT = 70, + BRIG_OPCODE_LD = 71, + BRIG_OPCODE_ST = 72, + BRIG_OPCODE_ATOMIC = 73, + BRIG_OPCODE_ATOMICNORET = 74, + BRIG_OPCODE_SIGNAL = 75, + BRIG_OPCODE_SIGNALNORET = 76, + BRIG_OPCODE_MEMFENCE = 77, + BRIG_OPCODE_RDIMAGE = 78, + BRIG_OPCODE_LDIMAGE = 79, + BRIG_OPCODE_STIMAGE = 80, + BRIG_OPCODE_IMAGEFENCE = 81, + BRIG_OPCODE_QUERYIMAGE = 82, + BRIG_OPCODE_QUERYSAMPLER = 83, + BRIG_OPCODE_CBR = 84, + BRIG_OPCODE_BR = 85, + BRIG_OPCODE_SBR = 86, + BRIG_OPCODE_BARRIER = 87, + BRIG_OPCODE_WAVEBARRIER = 88, + BRIG_OPCODE_ARRIVEFBAR = 89, + BRIG_OPCODE_INITFBAR = 90, + BRIG_OPCODE_JOINFBAR = 91, + BRIG_OPCODE_LEAVEFBAR = 92, + BRIG_OPCODE_RELEASEFBAR = 93, + BRIG_OPCODE_WAITFBAR = 94, + BRIG_OPCODE_LDF = 95, + BRIG_OPCODE_ACTIVELANECOUNT = 96, + BRIG_OPCODE_ACTIVELANEID = 97, + BRIG_OPCODE_ACTIVELANEMASK = 98, + BRIG_OPCODE_ACTIVELANEPERMUTE = 99, + BRIG_OPCODE_CALL = 100, + BRIG_OPCODE_SCALL = 101, + BRIG_OPCODE_ICALL = 102, + BRIG_OPCODE_RET = 103, + BRIG_OPCODE_ALLOCA = 104, + BRIG_OPCODE_CURRENTWORKGROUPSIZE = 105, + BRIG_OPCODE_CURRENTWORKITEMFLATID = 106, + BRIG_OPCODE_DIM = 107, + BRIG_OPCODE_GRIDGROUPS = 108, + BRIG_OPCODE_GRIDSIZE = 109, + BRIG_OPCODE_PACKETCOMPLETIONSIG = 110, + BRIG_OPCODE_PACKETID = 111, + BRIG_OPCODE_WORKGROUPID = 112, + BRIG_OPCODE_WORKGROUPSIZE = 113, + BRIG_OPCODE_WORKITEMABSID = 114, + BRIG_OPCODE_WORKITEMFLATABSID = 115, + BRIG_OPCODE_WORKITEMFLATID = 116, + BRIG_OPCODE_WORKITEMID = 117, + BRIG_OPCODE_CLEARDETECTEXCEPT = 118, + BRIG_OPCODE_GETDETECTEXCEPT = 119, + BRIG_OPCODE_SETDETECTEXCEPT = 120, + BRIG_OPCODE_ADDQUEUEWRITEINDEX = 121, + BRIG_OPCODE_CASQUEUEWRITEINDEX = 122, + BRIG_OPCODE_LDQUEUEREADINDEX = 123, + BRIG_OPCODE_LDQUEUEWRITEINDEX = 124, + BRIG_OPCODE_STQUEUEREADINDEX = 125, + BRIG_OPCODE_STQUEUEWRITEINDEX = 126, + BRIG_OPCODE_CLOCK = 127, + BRIG_OPCODE_CUID = 128, + BRIG_OPCODE_DEBUGTRAP = 129, + BRIG_OPCODE_GROUPBASEPTR = 130, + BRIG_OPCODE_KERNARGBASEPTR = 131, + BRIG_OPCODE_LANEID = 132, + BRIG_OPCODE_MAXCUID = 133, + BRIG_OPCODE_MAXWAVEID = 134, + BRIG_OPCODE_NULLPTR = 135, + BRIG_OPCODE_WAVEID = 136, + BRIG_OPCODE_FIRST_USER_DEFINED = 32768 +}; + +typedef uint8_t BrigPack8_t; + +enum BrigPack +{ + BRIG_PACK_NONE = 0, + BRIG_PACK_PP = 1, + BRIG_PACK_PS = 2, + BRIG_PACK_SP = 3, + BRIG_PACK_SS = 4, + BRIG_PACK_S = 5, + BRIG_PACK_P = 6, + BRIG_PACK_PPSAT = 7, + BRIG_PACK_PSSAT = 8, + BRIG_PACK_SPSAT = 9, + BRIG_PACK_SSSAT = 10, + BRIG_PACK_SSAT = 11, + BRIG_PACK_PSAT = 12 +}; + +typedef uint8_t BrigProfile8_t; + +enum BrigProfile +{ + BRIG_PROFILE_BASE = 0, + BRIG_PROFILE_FULL = 1 +}; + +typedef uint16_t BrigRegisterKind16_t; + +enum BrigRegisterKind +{ + BRIG_REGISTER_KIND_CONTROL = 0, + BRIG_REGISTER_KIND_SINGLE = 1, + BRIG_REGISTER_KIND_DOUBLE = 2, + BRIG_REGISTER_KIND_QUAD = 3 +}; + +typedef uint8_t BrigRound8_t; + +enum BrigRound +{ + BRIG_ROUND_NONE = 0, + BRIG_ROUND_FLOAT_DEFAULT = 1, + BRIG_ROUND_FLOAT_NEAR_EVEN = 2, + BRIG_ROUND_FLOAT_ZERO = 3, + BRIG_ROUND_FLOAT_PLUS_INFINITY = 4, + BRIG_ROUND_FLOAT_MINUS_INFINITY = 5, + BRIG_ROUND_INTEGER_NEAR_EVEN = 6, + BRIG_ROUND_INTEGER_ZERO = 7, + BRIG_ROUND_INTEGER_PLUS_INFINITY = 8, + BRIG_ROUND_INTEGER_MINUS_INFINITY = 9, + BRIG_ROUND_INTEGER_NEAR_EVEN_SAT = 10, + BRIG_ROUND_INTEGER_ZERO_SAT = 11, + BRIG_ROUND_INTEGER_PLUS_INFINITY_SAT = 12, + BRIG_ROUND_INTEGER_MINUS_INFINITY_SAT = 13, + BRIG_ROUND_INTEGER_SIGNALING_NEAR_EVEN = 14, + BRIG_ROUND_INTEGER_SIGNALING_ZERO = 15, + BRIG_ROUND_INTEGER_SIGNALING_PLUS_INFINITY = 16, + BRIG_ROUND_INTEGER_SIGNALING_MINUS_INFINITY = 17, + BRIG_ROUND_INTEGER_SIGNALING_NEAR_EVEN_SAT = 18, + BRIG_ROUND_INTEGER_SIGNALING_ZERO_SAT = 19, + BRIG_ROUND_INTEGER_SIGNALING_PLUS_INFINITY_SAT = 20, + BRIG_ROUND_INTEGER_SIGNALING_MINUS_INFINITY_SAT = 21 +}; + +typedef uint8_t BrigSamplerAddressing8_t; + +enum BrigSamplerAddressing +{ + BRIG_ADDRESSING_UNDEFINED = 0, + BRIG_ADDRESSING_CLAMP_TO_EDGE = 1, + BRIG_ADDRESSING_CLAMP_TO_BORDER = 2, + BRIG_ADDRESSING_REPEAT = 3, + BRIG_ADDRESSING_MIRRORED_REPEAT = 4, + BRIG_ADDRESSING_FIRST_USER_DEFINED = 128 +}; + +typedef uint8_t BrigSamplerCoordNormalization8_t; + +enum BrigSamplerCoordNormalization +{ + BRIG_COORD_UNNORMALIZED = 0, + BRIG_COORD_NORMALIZED = 1 +}; + +typedef uint8_t BrigSamplerFilter8_t; + +enum BrigSamplerFilter +{ + BRIG_FILTER_NEAREST = 0, + BRIG_FILTER_LINEAR = 1, + BRIG_FILTER_FIRST_USER_DEFINED = 128 +}; + +typedef uint8_t BrigSamplerQuery8_t; + +enum BrigSamplerQuery +{ + BRIG_SAMPLER_QUERY_ADDRESSING = 0, + BRIG_SAMPLER_QUERY_COORD = 1, + BRIG_SAMPLER_QUERY_FILTER = 2 +}; + +typedef uint32_t BrigSectionIndex32_t; + +enum BrigSectionIndex +{ + BRIG_SECTION_INDEX_DATA = 0, + BRIG_SECTION_INDEX_CODE = 1, + BRIG_SECTION_INDEX_OPERAND = 2, + BRIG_SECTION_INDEX_BEGIN_IMPLEMENTATION_DEFINED = 3 +}; + +struct BrigSectionHeader +{ + uint64_t byteCount; + uint32_t headerByteCount; + uint32_t nameLength; + uint8_t name[1]; +}; + +typedef uint8_t BrigSegCvtModifier8_t; + +enum BrigSegCvtModifierMask +{ + BRIG_SEG_CVT_NONULL = 1 +}; + +typedef uint8_t BrigSegment8_t; + +enum BrigSegment +{ + BRIG_SEGMENT_NONE = 0, + BRIG_SEGMENT_FLAT = 1, + BRIG_SEGMENT_GLOBAL = 2, + BRIG_SEGMENT_READONLY = 3, + BRIG_SEGMENT_KERNARG = 4, + BRIG_SEGMENT_GROUP = 5, + BRIG_SEGMENT_PRIVATE = 6, + BRIG_SEGMENT_SPILL = 7, + BRIG_SEGMENT_ARG = 8, + BRIG_SEGMENT_FIRST_USER_DEFINED = 128 +}; + +enum +{ + BRIG_TYPE_BASE_SIZE = 5, + BRIG_TYPE_PACK_SIZE = 2, + BRIG_TYPE_ARRAY_SIZE = 1, + + BRIG_TYPE_BASE_SHIFT = 0, + BRIG_TYPE_PACK_SHIFT = BRIG_TYPE_BASE_SHIFT + BRIG_TYPE_BASE_SIZE, + BRIG_TYPE_ARRAY_SHIFT = BRIG_TYPE_PACK_SHIFT + BRIG_TYPE_PACK_SIZE, + + BRIG_TYPE_BASE_MASK = ((1 << BRIG_TYPE_BASE_SIZE) - 1) + << BRIG_TYPE_BASE_SHIFT, + BRIG_TYPE_PACK_MASK = ((1 << BRIG_TYPE_PACK_SIZE) - 1) + << BRIG_TYPE_PACK_SHIFT, + BRIG_TYPE_ARRAY_MASK = ((1 << BRIG_TYPE_ARRAY_SIZE) - 1) + << BRIG_TYPE_ARRAY_SHIFT, + + BRIG_TYPE_PACK_NONE = 0 << BRIG_TYPE_PACK_SHIFT, + BRIG_TYPE_PACK_32 = 1 << BRIG_TYPE_PACK_SHIFT, + BRIG_TYPE_PACK_64 = 2 << BRIG_TYPE_PACK_SHIFT, + BRIG_TYPE_PACK_128 = 3 << BRIG_TYPE_PACK_SHIFT, + + BRIG_TYPE_ARRAY = 1 << BRIG_TYPE_ARRAY_SHIFT +}; + +typedef uint16_t BrigType16_t; + +enum BrigType +{ + BRIG_TYPE_NONE = 0, + + BRIG_TYPE_U8 = 1, + BRIG_TYPE_U16 = 2, + BRIG_TYPE_U32 = 3, + BRIG_TYPE_U64 = 4, + + BRIG_TYPE_S8 = 5, + BRIG_TYPE_S16 = 6, + BRIG_TYPE_S32 = 7, + BRIG_TYPE_S64 = 8, + + BRIG_TYPE_F16 = 9, + BRIG_TYPE_F32 = 10, + BRIG_TYPE_F64 = 11, + + BRIG_TYPE_B1 = 12, + BRIG_TYPE_B8 = 13, + BRIG_TYPE_B16 = 14, + BRIG_TYPE_B32 = 15, + BRIG_TYPE_B64 = 16, + BRIG_TYPE_B128 = 17, + + BRIG_TYPE_SAMP = 18, + BRIG_TYPE_ROIMG = 19, + BRIG_TYPE_WOIMG = 20, + BRIG_TYPE_RWIMG = 21, + + BRIG_TYPE_SIG32 = 22, + BRIG_TYPE_SIG64 = 23, + + BRIG_TYPE_U8X4 = BRIG_TYPE_U8 | BRIG_TYPE_PACK_32, + BRIG_TYPE_U8X8 = BRIG_TYPE_U8 | BRIG_TYPE_PACK_64, + BRIG_TYPE_U8X16 = BRIG_TYPE_U8 | BRIG_TYPE_PACK_128, + + BRIG_TYPE_U16X2 = BRIG_TYPE_U16 | BRIG_TYPE_PACK_32, + BRIG_TYPE_U16X4 = BRIG_TYPE_U16 | BRIG_TYPE_PACK_64, + BRIG_TYPE_U16X8 = BRIG_TYPE_U16 | BRIG_TYPE_PACK_128, + + BRIG_TYPE_U32X2 = BRIG_TYPE_U32 | BRIG_TYPE_PACK_64, + BRIG_TYPE_U32X4 = BRIG_TYPE_U32 | BRIG_TYPE_PACK_128, + + BRIG_TYPE_U64X2 = BRIG_TYPE_U64 | BRIG_TYPE_PACK_128, + + BRIG_TYPE_S8X4 = BRIG_TYPE_S8 | BRIG_TYPE_PACK_32, + BRIG_TYPE_S8X8 = BRIG_TYPE_S8 | BRIG_TYPE_PACK_64, + BRIG_TYPE_S8X16 = BRIG_TYPE_S8 | BRIG_TYPE_PACK_128, + + BRIG_TYPE_S16X2 = BRIG_TYPE_S16 | BRIG_TYPE_PACK_32, + BRIG_TYPE_S16X4 = BRIG_TYPE_S16 | BRIG_TYPE_PACK_64, + BRIG_TYPE_S16X8 = BRIG_TYPE_S16 | BRIG_TYPE_PACK_128, + + BRIG_TYPE_S32X2 = BRIG_TYPE_S32 | BRIG_TYPE_PACK_64, + BRIG_TYPE_S32X4 = BRIG_TYPE_S32 | BRIG_TYPE_PACK_128, + + BRIG_TYPE_S64X2 = BRIG_TYPE_S64 | BRIG_TYPE_PACK_128, + + BRIG_TYPE_F16X2 = BRIG_TYPE_F16 | BRIG_TYPE_PACK_32, + BRIG_TYPE_F16X4 = BRIG_TYPE_F16 | BRIG_TYPE_PACK_64, + BRIG_TYPE_F16X8 = BRIG_TYPE_F16 | BRIG_TYPE_PACK_128, + + BRIG_TYPE_F32X2 = BRIG_TYPE_F32 | BRIG_TYPE_PACK_64, + BRIG_TYPE_F32X4 = BRIG_TYPE_F32 | BRIG_TYPE_PACK_128, + + BRIG_TYPE_F64X2 = BRIG_TYPE_F64 | BRIG_TYPE_PACK_128, + + BRIG_TYPE_U8_ARRAY = BRIG_TYPE_U8 | BRIG_TYPE_ARRAY, + BRIG_TYPE_U16_ARRAY = BRIG_TYPE_U16 | BRIG_TYPE_ARRAY, + BRIG_TYPE_U32_ARRAY = BRIG_TYPE_U32 | BRIG_TYPE_ARRAY, + BRIG_TYPE_U64_ARRAY = BRIG_TYPE_U64 | BRIG_TYPE_ARRAY, + + BRIG_TYPE_S8_ARRAY = BRIG_TYPE_S8 | BRIG_TYPE_ARRAY, + BRIG_TYPE_S16_ARRAY = BRIG_TYPE_S16 | BRIG_TYPE_ARRAY, + BRIG_TYPE_S32_ARRAY = BRIG_TYPE_S32 | BRIG_TYPE_ARRAY, + BRIG_TYPE_S64_ARRAY = BRIG_TYPE_S64 | BRIG_TYPE_ARRAY, + + BRIG_TYPE_F16_ARRAY = BRIG_TYPE_F16 | BRIG_TYPE_ARRAY, + BRIG_TYPE_F32_ARRAY = BRIG_TYPE_F32 | BRIG_TYPE_ARRAY, + BRIG_TYPE_F64_ARRAY = BRIG_TYPE_F64 | BRIG_TYPE_ARRAY, + + BRIG_TYPE_B8_ARRAY = BRIG_TYPE_B8 | BRIG_TYPE_ARRAY, + BRIG_TYPE_B16_ARRAY = BRIG_TYPE_B16 | BRIG_TYPE_ARRAY, + BRIG_TYPE_B32_ARRAY = BRIG_TYPE_B32 | BRIG_TYPE_ARRAY, + BRIG_TYPE_B64_ARRAY = BRIG_TYPE_B64 | BRIG_TYPE_ARRAY, + BRIG_TYPE_B128_ARRAY = BRIG_TYPE_B128 | BRIG_TYPE_ARRAY, + + BRIG_TYPE_SAMP_ARRAY = BRIG_TYPE_SAMP | BRIG_TYPE_ARRAY, + BRIG_TYPE_ROIMG_ARRAY = BRIG_TYPE_ROIMG | BRIG_TYPE_ARRAY, + BRIG_TYPE_WOIMG_ARRAY = BRIG_TYPE_WOIMG | BRIG_TYPE_ARRAY, + BRIG_TYPE_RWIMG_ARRAY = BRIG_TYPE_RWIMG | BRIG_TYPE_ARRAY, + + BRIG_TYPE_SIG32_ARRAY = BRIG_TYPE_SIG32 | BRIG_TYPE_ARRAY, + BRIG_TYPE_SIG64_ARRAY = BRIG_TYPE_SIG64 | BRIG_TYPE_ARRAY, + + BRIG_TYPE_U8X4_ARRAY = BRIG_TYPE_U8X4 | BRIG_TYPE_ARRAY, + BRIG_TYPE_U8X8_ARRAY = BRIG_TYPE_U8X8 | BRIG_TYPE_ARRAY, + BRIG_TYPE_U8X16_ARRAY = BRIG_TYPE_U8X16 | BRIG_TYPE_ARRAY, + + BRIG_TYPE_U16X2_ARRAY = BRIG_TYPE_U16X2 | BRIG_TYPE_ARRAY, + BRIG_TYPE_U16X4_ARRAY = BRIG_TYPE_U16X4 | BRIG_TYPE_ARRAY, + BRIG_TYPE_U16X8_ARRAY = BRIG_TYPE_U16X8 | BRIG_TYPE_ARRAY, + + BRIG_TYPE_U32X2_ARRAY = BRIG_TYPE_U32X2 | BRIG_TYPE_ARRAY, + BRIG_TYPE_U32X4_ARRAY = BRIG_TYPE_U32X4 | BRIG_TYPE_ARRAY, + + BRIG_TYPE_U64X2_ARRAY = BRIG_TYPE_U64X2 | BRIG_TYPE_ARRAY, + + BRIG_TYPE_S8X4_ARRAY = BRIG_TYPE_S8X4 | BRIG_TYPE_ARRAY, + BRIG_TYPE_S8X8_ARRAY = BRIG_TYPE_S8X8 | BRIG_TYPE_ARRAY, + BRIG_TYPE_S8X16_ARRAY = BRIG_TYPE_S8X16 | BRIG_TYPE_ARRAY, + + BRIG_TYPE_S16X2_ARRAY = BRIG_TYPE_S16X2 | BRIG_TYPE_ARRAY, + BRIG_TYPE_S16X4_ARRAY = BRIG_TYPE_S16X4 | BRIG_TYPE_ARRAY, + BRIG_TYPE_S16X8_ARRAY = BRIG_TYPE_S16X8 | BRIG_TYPE_ARRAY, + + BRIG_TYPE_S32X2_ARRAY = BRIG_TYPE_S32X2 | BRIG_TYPE_ARRAY, + BRIG_TYPE_S32X4_ARRAY = BRIG_TYPE_S32X4 | BRIG_TYPE_ARRAY, + + BRIG_TYPE_S64X2_ARRAY = BRIG_TYPE_S64X2 | BRIG_TYPE_ARRAY, + + BRIG_TYPE_F16X2_ARRAY = BRIG_TYPE_F16X2 | BRIG_TYPE_ARRAY, + BRIG_TYPE_F16X4_ARRAY = BRIG_TYPE_F16X4 | BRIG_TYPE_ARRAY, + BRIG_TYPE_F16X8_ARRAY = BRIG_TYPE_F16X8 | BRIG_TYPE_ARRAY, + + BRIG_TYPE_F32X2_ARRAY = BRIG_TYPE_F32X2 | BRIG_TYPE_ARRAY, + BRIG_TYPE_F32X4_ARRAY = BRIG_TYPE_F32X4 | BRIG_TYPE_ARRAY, + + BRIG_TYPE_F64X2_ARRAY = BRIG_TYPE_F64X2 | BRIG_TYPE_ARRAY +}; + +struct BrigUInt64 +{ + uint32_t lo; + uint32_t hi; +}; + +typedef uint8_t BrigVariableModifier8_t; + +enum BrigVariableModifierMask +{ + BRIG_VARIABLE_DEFINITION = 1, + BRIG_VARIABLE_CONST = 2 +}; + +enum BrigVersion +{ + BRIG_VERSION_HSAIL_MAJOR = 1, + BRIG_VERSION_HSAIL_MINOR = 0, + BRIG_VERSION_BRIG_MAJOR = 1, + BRIG_VERSION_BRIG_MINOR = 0 +}; + +typedef uint8_t BrigWidth8_t; + +enum BrigWidth +{ + BRIG_WIDTH_NONE = 0, + BRIG_WIDTH_1 = 1, + BRIG_WIDTH_2 = 2, + BRIG_WIDTH_4 = 3, + BRIG_WIDTH_8 = 4, + BRIG_WIDTH_16 = 5, + BRIG_WIDTH_32 = 6, + BRIG_WIDTH_64 = 7, + BRIG_WIDTH_128 = 8, + BRIG_WIDTH_256 = 9, + BRIG_WIDTH_512 = 10, + BRIG_WIDTH_1024 = 11, + BRIG_WIDTH_2048 = 12, + BRIG_WIDTH_4096 = 13, + BRIG_WIDTH_8192 = 14, + BRIG_WIDTH_16384 = 15, + BRIG_WIDTH_32768 = 16, + BRIG_WIDTH_65536 = 17, + BRIG_WIDTH_131072 = 18, + BRIG_WIDTH_262144 = 19, + BRIG_WIDTH_524288 = 20, + BRIG_WIDTH_1048576 = 21, + BRIG_WIDTH_2097152 = 22, + BRIG_WIDTH_4194304 = 23, + BRIG_WIDTH_8388608 = 24, + BRIG_WIDTH_16777216 = 25, + BRIG_WIDTH_33554432 = 26, + BRIG_WIDTH_67108864 = 27, + BRIG_WIDTH_134217728 = 28, + BRIG_WIDTH_268435456 = 29, + BRIG_WIDTH_536870912 = 30, + BRIG_WIDTH_1073741824 = 31, + BRIG_WIDTH_2147483648 = 32, + BRIG_WIDTH_WAVESIZE = 33, + BRIG_WIDTH_ALL = 34 +}; + +struct BrigData +{ + uint32_t byteCount; + uint8_t bytes[1]; +}; + +struct BrigDirectiveArgBlock +{ + BrigBase base; +}; + +struct BrigDirectiveComment +{ + BrigBase base; + BrigDataOffsetString32_t name; +}; + +struct BrigDirectiveControl +{ + BrigBase base; + BrigControlDirective16_t control; + uint16_t reserved; + BrigDataOffsetOperandList32_t operands; +}; + +struct BrigDirectiveExecutable +{ + BrigBase base; + BrigDataOffsetString32_t name; + uint16_t outArgCount; + uint16_t inArgCount; + BrigCodeOffset32_t firstInArg; + BrigCodeOffset32_t firstCodeBlockEntry; + BrigCodeOffset32_t nextModuleEntry; + BrigExecutableModifier8_t modifier; + BrigLinkage8_t linkage; + uint16_t reserved; +}; + +struct BrigDirectiveExtension +{ + BrigBase base; + BrigDataOffsetString32_t name; +}; + +struct BrigDirectiveFbarrier +{ + BrigBase base; + BrigDataOffsetString32_t name; + BrigVariableModifier8_t modifier; + BrigLinkage8_t linkage; + uint16_t reserved; +}; + +struct BrigDirectiveLabel +{ + BrigBase base; + BrigDataOffsetString32_t name; +}; + +struct BrigDirectiveLoc +{ + BrigBase base; + BrigDataOffsetString32_t filename; + uint32_t line; + uint32_t column; +}; + +struct BrigDirectiveModule +{ + BrigBase base; + BrigDataOffsetString32_t name; + BrigVersion32_t hsailMajor; + BrigVersion32_t hsailMinor; + BrigProfile8_t profile; + BrigMachineModel8_t machineModel; + BrigRound8_t defaultFloatRound; + uint8_t reserved; +}; + +struct BrigDirectiveNone +{ + BrigBase base; +}; + +struct BrigDirectivePragma +{ + BrigBase base; + BrigDataOffsetOperandList32_t operands; +}; + +struct BrigDirectiveVariable +{ + BrigBase base; + BrigDataOffsetString32_t name; + BrigOperandOffset32_t init; + BrigType16_t type; + BrigSegment8_t segment; + BrigAlignment8_t align; + BrigUInt64 dim; + BrigVariableModifier8_t modifier; + BrigLinkage8_t linkage; + BrigAllocation8_t allocation; + uint8_t reserved; +}; + +struct BrigInstBase +{ + BrigBase base; + BrigOpcode16_t opcode; + BrigType16_t type; + BrigDataOffsetOperandList32_t operands; +}; + +struct BrigInstAddr +{ + BrigInstBase base; + BrigSegment8_t segment; + uint8_t reserved[3]; +}; + +struct BrigInstAtomic +{ + BrigInstBase base; + BrigSegment8_t segment; + BrigMemoryOrder8_t memoryOrder; + BrigMemoryScope8_t memoryScope; + BrigAtomicOperation8_t atomicOperation; + uint8_t equivClass; + uint8_t reserved[3]; +}; + +struct BrigInstBasic +{ + BrigInstBase base; +}; + +struct BrigInstBr +{ + BrigInstBase base; + BrigWidth8_t width; + uint8_t reserved[3]; +}; + +struct BrigInstCmp +{ + BrigInstBase base; + BrigType16_t sourceType; + BrigAluModifier8_t modifier; + BrigCompareOperation8_t compare; + BrigPack8_t pack; + uint8_t reserved[3]; +}; + +struct BrigInstCvt +{ + BrigInstBase base; + BrigType16_t sourceType; + BrigAluModifier8_t modifier; + BrigRound8_t round; +}; + +struct BrigInstImage +{ + BrigInstBase base; + BrigType16_t imageType; + BrigType16_t coordType; + BrigImageGeometry8_t geometry; + uint8_t equivClass; + uint16_t reserved; +}; + +struct BrigInstLane +{ + BrigInstBase base; + BrigType16_t sourceType; + BrigWidth8_t width; + uint8_t reserved; +}; + +struct BrigInstMem +{ + BrigInstBase base; + BrigSegment8_t segment; + BrigAlignment8_t align; + uint8_t equivClass; + BrigWidth8_t width; + BrigMemoryModifier8_t modifier; + uint8_t reserved[3]; +}; + +struct BrigInstMemFence +{ + BrigInstBase base; + BrigMemoryOrder8_t memoryOrder; + BrigMemoryScope8_t globalSegmentMemoryScope; + BrigMemoryScope8_t groupSegmentMemoryScope; + BrigMemoryScope8_t imageSegmentMemoryScope; +}; + +struct BrigInstMod +{ + BrigInstBase base; + BrigAluModifier8_t modifier; + BrigRound8_t round; + BrigPack8_t pack; + uint8_t reserved; +}; + +struct BrigInstQueryImage +{ + BrigInstBase base; + BrigType16_t imageType; + BrigImageGeometry8_t geometry; + BrigImageQuery8_t query; +}; + +struct BrigInstQuerySampler +{ + BrigInstBase base; + BrigSamplerQuery8_t query; + uint8_t reserved[3]; +}; + +struct BrigInstQueue +{ + BrigInstBase base; + BrigSegment8_t segment; + BrigMemoryOrder8_t memoryOrder; + uint16_t reserved; +}; + +struct BrigInstSeg +{ + BrigInstBase base; + BrigSegment8_t segment; + uint8_t reserved[3]; +}; + +struct BrigInstSegCvt +{ + BrigInstBase base; + BrigType16_t sourceType; + BrigSegment8_t segment; + BrigSegCvtModifier8_t modifier; +}; + +struct BrigInstSignal +{ + BrigInstBase base; + BrigType16_t signalType; + BrigMemoryOrder8_t memoryOrder; + BrigAtomicOperation8_t signalOperation; +}; + +struct BrigInstSourceType +{ + BrigInstBase base; + BrigType16_t sourceType; + uint16_t reserved; +}; + +struct BrigOperandAddress +{ + BrigBase base; + BrigCodeOffset32_t symbol; + BrigOperandOffset32_t reg; + BrigUInt64 offset; +}; + +struct BrigOperandAlign +{ + BrigBase base; + BrigAlignment8_t align; + uint8_t reserved[3]; +}; + +struct BrigOperandCodeList +{ + BrigBase base; + BrigDataOffsetCodeList32_t elements; +}; + +struct BrigOperandCodeRef +{ + BrigBase base; + BrigCodeOffset32_t ref; +}; + +struct BrigOperandConstantBytes +{ + BrigBase base; + BrigType16_t type; + uint16_t reserved; + BrigDataOffsetString32_t bytes; +}; + +struct BrigOperandConstantImage +{ + BrigBase base; + BrigType16_t type; + BrigImageGeometry8_t geometry; + BrigImageChannelOrder8_t channelOrder; + BrigImageChannelType8_t channelType; + uint8_t reserved[3]; + BrigUInt64 width; + BrigUInt64 height; + BrigUInt64 depth; + BrigUInt64 array; +}; + +struct BrigOperandConstantOperandList +{ + BrigBase base; + BrigType16_t type; + uint16_t reserved; + BrigDataOffsetOperandList32_t elements; +}; + +struct BrigOperandConstantSampler +{ + BrigBase base; + BrigType16_t type; + BrigSamplerCoordNormalization8_t coord; + BrigSamplerFilter8_t filter; + BrigSamplerAddressing8_t addressing; + uint8_t reserved[3]; +}; + +struct BrigOperandOperandList +{ + BrigBase base; + BrigDataOffsetOperandList32_t elements; +}; + +struct BrigOperandRegister +{ + BrigBase base; + BrigRegisterKind16_t regKind; + uint16_t regNum; +}; + +struct BrigOperandString +{ + BrigBase base; + BrigDataOffsetString32_t string; +}; + +struct BrigOperandWavesize +{ + BrigBase base; +}; + +#endif /* HSA_BRIG_FORMAT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hsa-common.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hsa-common.h new file mode 100644 index 0000000..a24bf6e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hsa-common.h @@ -0,0 +1,1412 @@ +/* HSAIL and BRIG related macros and definitions. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef HSA_H +#define HSA_H + +#include "hsa-brig-format.h" +#include "is-a.h" +#include "predict.h" +#include "tree.h" +#include "vec.h" +#include "hash-table.h" +#include "basic-block.h" + + +/* Return true if the compiler should produce HSAIL. */ + +static inline bool +hsa_gen_requested_p (void) +{ +#ifndef ENABLE_HSA + return false; +#endif + return !flag_disable_hsa; +} + +/* Standard warning message if we failed to generate HSAIL for a function. */ + +#define HSA_SORRY_MSG "could not emit HSAIL for the function" + +class hsa_op_immed; +class hsa_op_cst_list; +class hsa_insn_basic; +class hsa_op_address; +class hsa_op_reg; +class hsa_bb; + +/* Class representing an input argument, output argument (result) or a + variable, that will eventually end up being a symbol directive. */ + +struct hsa_symbol +{ + /* Constructor. */ + hsa_symbol (BrigType16_t type, BrigSegment8_t segment, + BrigLinkage8_t linkage, bool global_scope_p = false, + BrigAllocation allocation = BRIG_ALLOCATION_AUTOMATIC, + BrigAlignment8_t align = BRIG_ALIGNMENT_8); + + /* Return total size of the symbol. */ + unsigned HOST_WIDE_INT total_byte_size (); + + /* Fill in those values into the symbol according to DECL, which are + determined independently from whether it is parameter, result, + or a variable, local or global. */ + void fillup_for_decl (tree decl); + + /* Pointer to the original tree, which is PARM_DECL for input parameters and + RESULT_DECL for the output parameters. Also can be CONST_DECL for Fortran + constants which need to be put into readonly segment. */ + tree m_decl; + + /* Name of the symbol, that will be written into output and dumps. Can be + NULL, see name_number below. */ + const char *m_name; + + /* If name is NULL, artificial name will be formed from the segment name and + this number. */ + int m_name_number; + + /* Once written, this is the offset of the associated symbol directive. Zero + means the symbol has not been written yet. */ + unsigned m_directive_offset; + + /* HSA type of the parameter. */ + BrigType16_t m_type; + + /* The HSA segment this will eventually end up in. */ + BrigSegment8_t m_segment; + + /* The HSA kind of linkage. */ + BrigLinkage8_t m_linkage; + + /* Array dimension, if non-zero. */ + unsigned HOST_WIDE_INT m_dim; + + /* Constant value, used for string constants. */ + hsa_op_immed *m_cst_value; + + /* Is in global scope. */ + bool m_global_scope_p; + + /* True if an error has been seen for the symbol. */ + bool m_seen_error; + + /* Symbol allocation. */ + BrigAllocation m_allocation; + + /* Flag used for global variables if a variable is already emitted or not. */ + bool m_emitted_to_brig; + + /* Alignment of the symbol. */ + BrigAlignment8_t m_align; + +private: + /* Default constructor. */ + hsa_symbol (); +}; + +/* Abstract class for HSA instruction operands. */ + +class hsa_op_base +{ +public: + /* Next operand scheduled to be written when writing BRIG operand + section. */ + hsa_op_base *m_next; + + /* Offset to which the associated operand structure will be written. Zero if + yet not scheduled for writing. */ + unsigned m_brig_op_offset; + + /* The type of a particular operand. */ + BrigKind16_t m_kind; + +protected: + hsa_op_base (BrigKind16_t k); +private: + /* Make the default constructor inaccessible. */ + hsa_op_base () {} +}; + +/* Common abstract ancestor for operands which have a type. */ + +class hsa_op_with_type : public hsa_op_base +{ +public: + /* The type. */ + BrigType16_t m_type; + + /* Convert an operand to a destination type DTYPE and attach insns + to HBB if needed. */ + hsa_op_with_type *get_in_type (BrigType16_t dtype, hsa_bb *hbb); + +protected: + hsa_op_with_type (BrigKind16_t k, BrigType16_t t); +private: + /* Make the default constructor inaccessible. */ + hsa_op_with_type () : hsa_op_base (BRIG_KIND_NONE) {} +}; + +/* An immediate HSA operand. */ + +class hsa_op_immed : public hsa_op_with_type +{ +public: + hsa_op_immed (tree tree_val, bool min32int = true); + hsa_op_immed (HOST_WIDE_INT int_value, BrigType16_t type); + void *operator new (size_t); + ~hsa_op_immed (); + void set_type (BrigKind16_t t); + + /* Function returns pointer to a buffer that contains binary representation + of the immeadiate value. The buffer has length of BRIG_SIZE and + a caller is responsible for deallocation of the buffer. */ + char *emit_to_buffer (unsigned *brig_size); + + /* Value as represented by middle end. */ + tree m_tree_value; + + /* Integer value representation. */ + HOST_WIDE_INT m_int_value; + +private: + /* Make the default constructor inaccessible. */ + hsa_op_immed (); + /* All objects are deallocated by destroying their pool, so make delete + inaccessible too. */ + void operator delete (void *) {} +}; + +/* Report whether or not P is a an immediate operand. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_op_base *p) +{ + return p->m_kind == BRIG_KIND_OPERAND_CONSTANT_BYTES; +} + +/* Likewise, but for a more specified base. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_op_with_type *p) +{ + return p->m_kind == BRIG_KIND_OPERAND_CONSTANT_BYTES; +} + + +/* HSA register operand. */ + +class hsa_op_reg : public hsa_op_with_type +{ + friend class hsa_insn_basic; + friend class hsa_insn_phi; +public: + hsa_op_reg (BrigType16_t t); + void *operator new (size_t); + + /* Verify register operand. */ + void verify_ssa (); + + /* If NON-NULL, gimple SSA that we come from. NULL if none. */ + tree m_gimple_ssa; + + /* Defining instruction while still in the SSA. */ + hsa_insn_basic *m_def_insn; + + /* If the register allocator decides to spill the register, this is the + appropriate spill symbol. */ + hsa_symbol *m_spill_sym; + + /* Number of this register structure in the order in which they were + allocated. */ + int m_order; + int m_lr_begin, m_lr_end; + + /* Zero if the register is not yet allocated. After, allocation, this must + be 'c', 's', 'd' or 'q'. */ + char m_reg_class; + /* If allocated, the number of the HW register (within its HSA register + class). */ + char m_hard_num; + +private: + /* Make the default constructor inaccessible. */ + hsa_op_reg () : hsa_op_with_type (BRIG_KIND_NONE, BRIG_TYPE_NONE) {} + /* All objects are deallocated by destroying their pool, so make delete + inaccessible too. */ + void operator delete (void *) {} + /* Set definition where the register is defined. */ + void set_definition (hsa_insn_basic *insn); + /* Uses of the value while still in SSA. */ + auto_vec m_uses; +}; + +/* Report whether or not P is a register operand. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_op_base *p) +{ + return p->m_kind == BRIG_KIND_OPERAND_REGISTER; +} + +/* Report whether or not P is a register operand. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_op_with_type *p) +{ + return p->m_kind == BRIG_KIND_OPERAND_REGISTER; +} + +/* An address HSA operand. */ + +class hsa_op_address : public hsa_op_base +{ +public: + /* set up a new address operand consisting of base symbol SYM, register R and + immediate OFFSET. If the machine model is not large and offset is 64 bit, + the upper, 32 bits have to be zero. */ + hsa_op_address (hsa_symbol *sym, hsa_op_reg *reg, + HOST_WIDE_INT offset = 0); + + void *operator new (size_t); + + /* Set up a new address operand consisting of base symbol SYM and + immediate OFFSET. If the machine model is not large and offset is 64 bit, + the upper, 32 bits have to be zero. */ + hsa_op_address (hsa_symbol *sym, HOST_WIDE_INT offset = 0); + + /* Set up a new address operand consisting of register R and + immediate OFFSET. If the machine model is not large and offset is 64 bit, + the upper, 32 bits have to be zero. */ + hsa_op_address (hsa_op_reg *reg, HOST_WIDE_INT offset = 0); + + /* Symbol base of the address. Can be NULL if there is none. */ + hsa_symbol *m_symbol; + + /* Register offset. Can be NULL if there is none. */ + hsa_op_reg *m_reg; + + /* Immediate byte offset. */ + HOST_WIDE_INT m_imm_offset; + +private: + /* Make the default constructor inaccessible. */ + hsa_op_address () : hsa_op_base (BRIG_KIND_NONE) {} + /* All objects are deallocated by destroying their pool, so make delete + inaccessible too. */ + void operator delete (void *) {} +}; + +/* Report whether or not P is an address operand. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_op_base *p) +{ + return p->m_kind == BRIG_KIND_OPERAND_ADDRESS; +} + +/* A reference to code HSA operand. It can be either reference + to a start of a BB or a start of a function. */ + +class hsa_op_code_ref : public hsa_op_base +{ +public: + hsa_op_code_ref (); + + /* Offset in the code section that this refers to. */ + unsigned m_directive_offset; +}; + +/* Report whether or not P is a code reference operand. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_op_base *p) +{ + return p->m_kind == BRIG_KIND_OPERAND_CODE_REF; +} + +/* Code list HSA operand. */ + +class hsa_op_code_list: public hsa_op_base +{ +public: + hsa_op_code_list (unsigned elements); + void *operator new (size_t); + + /* Offset to variable-sized array in hsa_data section, where + are offsets to entries in the hsa_code section. */ + auto_vec m_offsets; +private: + /* Make the default constructor inaccessible. */ + hsa_op_code_list () : hsa_op_base (BRIG_KIND_NONE) {} + /* All objects are deallocated by destroying their pool, so make delete + inaccessible too. */ + void operator delete (void *) {} +}; + +/* Report whether or not P is a code list operand. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_op_base *p) +{ + return p->m_kind == BRIG_KIND_OPERAND_CODE_LIST; +} + +/* Operand list HSA operand. */ + +class hsa_op_operand_list: public hsa_op_base +{ +public: + hsa_op_operand_list (unsigned elements); + ~hsa_op_operand_list (); + void *operator new (size_t); + + /* Offset to variable-sized array in hsa_data section, where + are offsets to entries in the hsa_code section. */ + auto_vec m_offsets; +private: + /* Make the default constructor inaccessible. */ + hsa_op_operand_list () : hsa_op_base (BRIG_KIND_NONE) {} + /* All objects are deallocated by destroying their pool, so make delete + inaccessible too. */ + void operator delete (void *) {} +}; + +/* Report whether or not P is a code list operand. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_op_base *p) +{ + return p->m_kind == BRIG_KIND_OPERAND_OPERAND_LIST; +} + +/* Opcodes of instructions that are not part of HSA but that we use to + represent it nevertheless. */ + +#define HSA_OPCODE_PHI (-1) +#define HSA_OPCODE_ARG_BLOCK (-2) + +/* The number of operand pointers we can directly in an instruction. */ +#define HSA_BRIG_INT_STORAGE_OPERANDS 5 + +/* Class representing an HSA instruction. Unlike typical ancestors for + specialized classes, this one is also directly used for all instructions + that are then represented as BrigInstBasic. */ + +class hsa_insn_basic +{ +public: + hsa_insn_basic (unsigned nops, int opc); + hsa_insn_basic (unsigned nops, int opc, BrigType16_t t, + hsa_op_base *arg0 = NULL, + hsa_op_base *arg1 = NULL, + hsa_op_base *arg2 = NULL, + hsa_op_base *arg3 = NULL); + + void *operator new (size_t); + void set_op (int index, hsa_op_base *op); + hsa_op_base *get_op (int index); + hsa_op_base **get_op_addr (int index); + unsigned int operand_count (); + void verify (); + unsigned input_count (); + unsigned num_used_ops (); + void set_output_in_type (hsa_op_reg *dest, unsigned op_index, hsa_bb *hbb); + bool op_output_p (unsigned opnum); + + /* The previous and next instruction in the basic block. */ + hsa_insn_basic *m_prev, *m_next; + + /* Basic block this instruction belongs to. */ + basic_block m_bb; + + /* Operand code distinguishing different types of instructions. Eventually + these should only be BRIG_INST_* values from the BrigOpcode16_t range but + initially we use negative values for PHI nodes and such. */ + int m_opcode; + + /* Linearized number assigned to the instruction by HSA RA. */ + int m_number; + + /* Type of the destination of the operations. */ + BrigType16_t m_type; + + /* BRIG offset of the instruction in code section. */ + unsigned int m_brig_offset; + +private: + /* Make the default constructor inaccessible. */ + hsa_insn_basic () {} + /* All objects are deallocated by destroying their pool, so make delete + inaccessible too. */ + void operator delete (void *) {} + /* The individual operands. All instructions but PHI nodes have five or + fewer instructions and so will fit the internal storage. */ + /* TODO: Vast majority of instructions have three or fewer operands, so we + may actually try reducing it. */ + auto_vec m_operands; +}; + +/* Class representing a PHI node of the SSA form of HSA virtual + registers. */ + +class hsa_insn_phi : public hsa_insn_basic +{ +public: + hsa_insn_phi (unsigned nops, hsa_op_reg *dst); + + /* Destination. */ + hsa_op_reg *m_dest; + +private: + /* Make the default constructor inaccessible. */ + hsa_insn_phi () : hsa_insn_basic (1, HSA_OPCODE_PHI) {} +}; + +/* Report whether or not P is a PHI node. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_insn_basic *p) +{ + return p->m_opcode == HSA_OPCODE_PHI; +} + +/* HSA instruction for */ +class hsa_insn_br : public hsa_insn_basic +{ +public: + hsa_insn_br (unsigned nops, int opc, BrigType16_t t, BrigWidth8_t width, + hsa_op_base *arg0 = NULL, hsa_op_base *arg1 = NULL, + hsa_op_base *arg2 = NULL, hsa_op_base *arg3 = NULL); + + /* Number of work-items affected in the same way by the instruction. */ + BrigWidth8_t m_width; + +private: + /* Make the default constructor inaccessible. */ + hsa_insn_br () : hsa_insn_basic (0, BRIG_OPCODE_BR) {} +}; + +/* Return true if P is a branching/synchronization instruction. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_insn_basic *p) +{ + return p->m_opcode == BRIG_OPCODE_BARRIER + || p->m_opcode == BRIG_OPCODE_BR; +} + +/* HSA instruction for conditional branches. Structurally the same as + hsa_insn_br but we represent it specially because of inherent control + flow it represents. */ + +class hsa_insn_cbr : public hsa_insn_br +{ +public: + hsa_insn_cbr (hsa_op_reg *ctrl); + +private: + /* Make the default constructor inaccessible. */ + hsa_insn_cbr () : hsa_insn_br (0, BRIG_OPCODE_CBR, BRIG_TYPE_B1, + BRIG_WIDTH_1) {} +}; + +/* Report whether P is a contitional branching instruction. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_insn_basic *p) +{ + return p->m_opcode == BRIG_OPCODE_CBR; +} + +/* HSA instruction for switch branches. */ + +class hsa_insn_sbr : public hsa_insn_basic +{ +public: + hsa_insn_sbr (hsa_op_reg *index, unsigned jump_count); + + /* Default destructor. */ + ~hsa_insn_sbr (); + + void replace_all_labels (basic_block old_bb, basic_block new_bb); + + /* Width as described in HSA documentation. */ + BrigWidth8_t m_width; + + /* Jump table. */ + vec m_jump_table; + + /* Code list for label references. */ + hsa_op_code_list *m_label_code_list; + +private: + /* Make the default constructor inaccessible. */ + hsa_insn_sbr () : hsa_insn_basic (1, BRIG_OPCODE_SBR) {} +}; + +/* Report whether P is a switch branching instruction. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_insn_basic *p) +{ + return p->m_opcode == BRIG_OPCODE_SBR; +} + +/* HSA instruction for comparisons. */ + +class hsa_insn_cmp : public hsa_insn_basic +{ +public: + hsa_insn_cmp (BrigCompareOperation8_t cmp, BrigType16_t t, + hsa_op_base *arg0 = NULL, hsa_op_base *arg1 = NULL, + hsa_op_base *arg2 = NULL); + + /* Source type should be derived from operand types. */ + + /* The comparison operation. */ + BrigCompareOperation8_t m_compare; + + /* TODO: Modifiers and packing control are missing but so are everywhere + else. */ +private: + /* Make the default constructor inaccessible. */ + hsa_insn_cmp () : hsa_insn_basic (1, BRIG_OPCODE_CMP) {} +}; + +/* Report whether or not P is a comparison instruction. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_insn_basic *p) +{ + return p->m_opcode == BRIG_OPCODE_CMP; +} + +/* HSA instruction for memory operations. */ + +class hsa_insn_mem : public hsa_insn_basic +{ +public: + hsa_insn_mem (int opc, BrigType16_t t, hsa_op_base *arg0, hsa_op_base *arg1); + + /* Set alignment to VALUE. */ + + void set_align (BrigAlignment8_t value); + + /* The segment is of the memory access is either the segment of the symbol in + the address operand or flat address is there is no symbol there. */ + + /* Required alignment of the memory operation. */ + BrigAlignment8_t m_align; + + /* HSA equiv class, basically an alias set number. */ + uint8_t m_equiv_class; + + /* TODO: Add width modifier, perhaps also other things. */ +protected: + hsa_insn_mem (unsigned nops, int opc, BrigType16_t t, + hsa_op_base *arg0 = NULL, hsa_op_base *arg1 = NULL, + hsa_op_base *arg2 = NULL, hsa_op_base *arg3 = NULL); + +private: + /* Make the default constructor inaccessible. */ + hsa_insn_mem () : hsa_insn_basic (1, BRIG_OPCODE_LD) {} +}; + +/* Report whether or not P is a memory instruction. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_insn_basic *p) +{ + return (p->m_opcode == BRIG_OPCODE_LD + || p->m_opcode == BRIG_OPCODE_ST); +} + +/* HSA instruction for atomic operations. */ + +class hsa_insn_atomic : public hsa_insn_mem +{ +public: + hsa_insn_atomic (int nops, int opc, enum BrigAtomicOperation aop, + BrigType16_t t, BrigMemoryOrder memorder, + hsa_op_base *arg0 = NULL, hsa_op_base *arg1 = NULL, + hsa_op_base *arg2 = NULL, hsa_op_base *arg3 = NULL); + + /* The operation itself. */ + enum BrigAtomicOperation m_atomicop; + + /* Things like acquire/release/aligned. */ + enum BrigMemoryOrder m_memoryorder; + + /* Scope of the atomic operation. */ + enum BrigMemoryScope m_memoryscope; + +private: + /* Make the default constructor inaccessible. */ + hsa_insn_atomic () : hsa_insn_mem (1, BRIG_KIND_NONE, BRIG_TYPE_NONE) {} +}; + +/* Report whether or not P is an atomic instruction. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_insn_basic *p) +{ + return (p->m_opcode == BRIG_OPCODE_ATOMIC + || p->m_opcode == BRIG_OPCODE_ATOMICNORET); +} + +/* HSA instruction for signal operations. */ + +class hsa_insn_signal : public hsa_insn_basic +{ +public: + hsa_insn_signal (int nops, int opc, enum BrigAtomicOperation sop, + BrigType16_t t, BrigMemoryOrder memorder, + hsa_op_base *arg0 = NULL, hsa_op_base *arg1 = NULL, + hsa_op_base *arg2 = NULL, hsa_op_base *arg3 = NULL); + + /* Things like acquire/release/aligned. */ + enum BrigMemoryOrder m_memory_order; + + /* The operation itself. */ + enum BrigAtomicOperation m_signalop; +}; + +/* Report whether or not P is a signal instruction. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_insn_basic *p) +{ + return (p->m_opcode == BRIG_OPCODE_SIGNAL + || p->m_opcode == BRIG_OPCODE_SIGNALNORET); +} + +/* HSA instruction to convert between flat addressing and segments. */ + +class hsa_insn_seg : public hsa_insn_basic +{ +public: + hsa_insn_seg (int opc, BrigType16_t destt, BrigType16_t srct, + BrigSegment8_t seg, hsa_op_base *arg0, hsa_op_base *arg1); + + /* Source type. Depends on the source addressing/segment. */ + BrigType16_t m_src_type; + /* The segment we are converting from or to. */ + BrigSegment8_t m_segment; +private: + /* Make the default constructor inaccessible. */ + hsa_insn_seg () : hsa_insn_basic (1, BRIG_OPCODE_STOF) {} +}; + +/* Report whether or not P is a segment conversion instruction. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_insn_basic *p) +{ + return (p->m_opcode == BRIG_OPCODE_STOF + || p->m_opcode == BRIG_OPCODE_FTOS); +} + +/* Class for internal functions for purpose of HSA emission. */ + +class hsa_internal_fn +{ +public: + hsa_internal_fn (enum internal_fn fn, unsigned type_bit_size): + m_fn (fn), m_type_bit_size (type_bit_size), m_offset (0) {} + + hsa_internal_fn (const hsa_internal_fn *f): + m_fn (f->m_fn), m_type_bit_size (f->m_type_bit_size), + m_offset (f->m_offset) {} + + /* Return arity of the internal function. */ + unsigned get_arity (); + + /* Return BRIG type of N-th argument, if -1 is passed, return value type + is received. */ + BrigType16_t get_argument_type (int n); + + /* Return function name. The memory must be released by a caller. */ + char *name (); + + /* Internal function. */ + enum internal_fn m_fn; + + /* Bit width of return type. */ + unsigned m_type_bit_size; + + /* BRIG offset of declaration of the function. */ + BrigCodeOffset32_t m_offset; +}; + +/* HSA instruction for function call. */ + +class hsa_insn_call : public hsa_insn_basic +{ +public: + hsa_insn_call (tree callee); + hsa_insn_call (hsa_internal_fn *fn); + + /* Default destructor. */ + ~hsa_insn_call (); + + /* Called function. */ + tree m_called_function; + + /* Called internal function. */ + hsa_internal_fn *m_called_internal_fn; + + /* Input formal arguments. */ + auto_vec m_input_args; + + /* Input arguments store instructions. */ + auto_vec m_input_arg_insns; + + /* Output argument, can be NULL for void functions. */ + hsa_symbol *m_output_arg; + + /* Called function code reference. */ + hsa_op_code_ref m_func; + + /* Code list for arguments of the function. */ + hsa_op_code_list *m_args_code_list; + + /* Code list for result of the function. */ + hsa_op_code_list *m_result_code_list; +private: + /* Make the default constructor inaccessible. */ + hsa_insn_call () : hsa_insn_basic (0, BRIG_OPCODE_CALL) {} +}; + +/* Report whether or not P is a call instruction. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_insn_basic *p) +{ + return (p->m_opcode == BRIG_OPCODE_CALL); +} + +/* HSA call instruction block encapsulates definition of arguments, + result type, corresponding loads and a possible store. + Moreover, it contains a single call instruction. + Emission of the instruction will produce multiple + HSAIL instructions. */ + +class hsa_insn_arg_block : public hsa_insn_basic +{ +public: + hsa_insn_arg_block (BrigKind brig_kind, hsa_insn_call * call); + + /* Kind of argument block. */ + BrigKind m_kind; + + /* Call instruction. */ + hsa_insn_call *m_call_insn; +}; + +/* Report whether or not P is a call block instruction. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_insn_basic *p) +{ + return (p->m_opcode == HSA_OPCODE_ARG_BLOCK); +} + +/* HSA comment instruction. */ + +class hsa_insn_comment: public hsa_insn_basic +{ +public: + /* Constructor of class representing the comment in HSAIL. */ + hsa_insn_comment (const char *s); + + /* Default destructor. */ + ~hsa_insn_comment (); + + char *m_comment; +}; + +/* Report whether or not P is a call block instruction. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_insn_basic *p) +{ + return (p->m_opcode == BRIG_KIND_DIRECTIVE_COMMENT); +} + +/* HSA queue instruction. */ + +class hsa_insn_queue: public hsa_insn_basic +{ +public: + hsa_insn_queue (int nops, int opcode, BrigSegment segment, + BrigMemoryOrder memory_order, + hsa_op_base *arg0 = NULL, hsa_op_base *arg1 = NULL, + hsa_op_base *arg2 = NULL, hsa_op_base *arg3 = NULL); + + /* Destructor. */ + ~hsa_insn_queue (); + + /* Segment used to refer to the queue. Must be global or flat. */ + BrigSegment m_segment; + /* Memory order used to specify synchronization. */ + BrigMemoryOrder m_memory_order; +}; + +/* Report whether or not P is a queue instruction. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_insn_basic *p) +{ + return (p->m_opcode == BRIG_OPCODE_ADDQUEUEWRITEINDEX + || p->m_opcode == BRIG_OPCODE_CASQUEUEWRITEINDEX + || p->m_opcode == BRIG_OPCODE_LDQUEUEREADINDEX + || p->m_opcode == BRIG_OPCODE_LDQUEUEWRITEINDEX + || p->m_opcode == BRIG_OPCODE_STQUEUEREADINDEX + || p->m_opcode == BRIG_OPCODE_STQUEUEWRITEINDEX); +} + +/* HSA source type instruction. */ + +class hsa_insn_srctype: public hsa_insn_basic +{ +public: + hsa_insn_srctype (int nops, BrigOpcode opcode, BrigType16_t destt, + BrigType16_t srct, hsa_op_base *arg0, hsa_op_base *arg1, + hsa_op_base *arg2); + + /* Source type. */ + BrigType16_t m_source_type; + + /* Destructor. */ + ~hsa_insn_srctype (); +}; + +/* Report whether or not P is a source type instruction. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_insn_basic *p) +{ + return (p->m_opcode == BRIG_OPCODE_POPCOUNT + || p->m_opcode == BRIG_OPCODE_FIRSTBIT + || p->m_opcode == BRIG_OPCODE_LASTBIT); +} + +/* HSA packed instruction. */ + +class hsa_insn_packed : public hsa_insn_srctype +{ +public: + hsa_insn_packed (int nops, BrigOpcode opcode, BrigType16_t destt, + BrigType16_t srct, hsa_op_base *arg0, hsa_op_base *arg1, + hsa_op_base *arg2); + + /* Operand list for an operand of the instruction. */ + hsa_op_operand_list *m_operand_list; + + /* Destructor. */ + ~hsa_insn_packed (); +}; + +/* Report whether or not P is a combine instruction. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_insn_basic *p) +{ + return (p->m_opcode == BRIG_OPCODE_COMBINE + || p->m_opcode == BRIG_OPCODE_EXPAND); +} + +/* HSA convert instruction. */ + +class hsa_insn_cvt: public hsa_insn_basic +{ +public: + hsa_insn_cvt (hsa_op_with_type *dest, hsa_op_with_type *src); +}; + +/* Report whether or not P is a convert instruction. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_insn_basic *p) +{ + return (p->m_opcode == BRIG_OPCODE_CVT); +} + +/* HSA alloca instruction. */ + +class hsa_insn_alloca: public hsa_insn_basic +{ +public: + hsa_insn_alloca (hsa_op_with_type *dest, hsa_op_with_type *size, + unsigned alignment = 0); + + /* Required alignment of the allocation. */ + BrigAlignment8_t m_align; +}; + +/* Report whether or not P is an alloca instruction. */ + +template <> +template <> +inline bool +is_a_helper ::test (hsa_insn_basic *p) +{ + return (p->m_opcode == BRIG_OPCODE_ALLOCA); +} + +/* Basic block of HSA instructions. */ + +class hsa_bb +{ +public: + hsa_bb (basic_block cfg_bb); + hsa_bb (basic_block cfg_bb, int idx); + ~hsa_bb (); + + /* Append an instruction INSN into the basic block. */ + void append_insn (hsa_insn_basic *insn); + + /* Add a PHI instruction. */ + void append_phi (hsa_insn_phi *phi); + + /* The real CFG BB that this HBB belongs to. */ + basic_block m_bb; + + /* The operand that refers to the label to this BB. */ + hsa_op_code_ref m_label_ref; + + /* The first and last instruction. */ + hsa_insn_basic *m_first_insn, *m_last_insn; + /* The first and last phi node. */ + hsa_insn_phi *m_first_phi, *m_last_phi; + + /* Just a number to construct names from. */ + int m_index; + + bitmap m_liveout, m_livein; +private: + /* Make the default constructor inaccessible. */ + hsa_bb (); + /* All objects are deallocated by destroying their pool, so make delete + inaccessible too. */ + void operator delete (void *) {} +}; + +/* Return the corresponding HSA basic block structure for the given control + flow basic_block BB. */ + +static inline hsa_bb * +hsa_bb_for_bb (basic_block bb) +{ + return (struct hsa_bb *) bb->aux; +} + +/* Class for hashing local hsa_symbols. */ + +struct hsa_noop_symbol_hasher : nofree_ptr_hash +{ + static inline hashval_t hash (const value_type); + static inline bool equal (const value_type, const compare_type); +}; + +/* Hash hsa_symbol. */ + +inline hashval_t +hsa_noop_symbol_hasher::hash (const value_type item) +{ + return DECL_UID (item->m_decl); +} + +/* Return true if the DECL_UIDs of decls both symbols refer to are equal. */ + +inline bool +hsa_noop_symbol_hasher::equal (const value_type a, const compare_type b) +{ + return (DECL_UID (a->m_decl) == DECL_UID (b->m_decl)); +} + +/* Structure that encapsulates intermediate representation of a HSA + function. */ + +class hsa_function_representation +{ +public: + hsa_function_representation (tree fdecl, bool kernel_p, + unsigned ssa_names_count, + bool modified_cfg = false); + hsa_function_representation (hsa_internal_fn *fn); + ~hsa_function_representation (); + + /* Builds a shadow register that is utilized to a kernel dispatch. */ + hsa_op_reg *get_shadow_reg (); + + /* Return true if we are in a function that has kernel dispatch + shadow register. */ + bool has_shadow_reg_p (); + + /* The entry/exit blocks don't contain incoming code, + but the HSA generator might use them to put code into, + so we need hsa_bb instances of them. */ + void init_extra_bbs (); + + /* Update CFG dominators if m_modified_cfg flag is set. */ + void update_dominance (); + + /* Return linkage of the representation. */ + BrigLinkage8_t get_linkage (); + + /* Create a private symbol of requested TYPE. */ + hsa_symbol *create_hsa_temporary (BrigType16_t type); + + /* Lookup or create a HSA pseudo register for a given gimple SSA name. */ + hsa_op_reg *reg_for_gimple_ssa (tree ssa); + + /* Name of the function. */ + char *m_name; + + /* Number of allocated register structures. */ + int m_reg_count; + + /* Input arguments. */ + vec m_input_args; + + /* Output argument or NULL if there is none. */ + hsa_symbol *m_output_arg; + + /* Hash table of local variable symbols. */ + hash_table *m_local_symbols; + + /* Hash map for string constants. */ + hash_map m_string_constants_map; + + /* Vector of pointers to spill symbols. */ + vec m_spill_symbols; + + /* Vector of pointers to global variables and transformed string constants + that are used by the function. */ + vec m_global_symbols; + + /* Private function artificial variables. */ + vec m_private_variables; + + /* Vector of called function declarations. */ + vec m_called_functions; + + /* Vector of used internal functions. */ + vec m_called_internal_fns; + + /* Number of HBB BBs. */ + int m_hbb_count; + + /* Whether or not we could check and enforce SSA properties. */ + bool m_in_ssa; + + /* True if the function is kernel function. */ + bool m_kern_p; + + /* True if the function representation is a declaration. */ + bool m_declaration_p; + + /* Function declaration tree. */ + tree m_decl; + + /* Internal function info is used for declarations of internal functions. */ + hsa_internal_fn *m_internal_fn; + + /* Runtime shadow register. */ + hsa_op_reg *m_shadow_reg; + + /* Number of kernel dispatched which take place in the function. */ + unsigned m_kernel_dispatch_count; + + /* If the function representation contains a kernel dispatch, + OMP data size is necessary memory that is used for copying before + a kernel dispatch. */ + unsigned m_maximum_omp_data_size; + + /* Return true if there's an HSA-specific warning already seen. */ + bool m_seen_error; + + /* Counter for temporary symbols created in the function representation. */ + unsigned m_temp_symbol_count; + + /* SSA names mapping. */ + vec m_ssa_map; + + /* Flag whether a function needs update of dominators before RA. */ + bool m_modified_cfg; +}; + +enum hsa_function_kind +{ + HSA_NONE, + HSA_KERNEL, + HSA_FUNCTION +}; + +struct hsa_function_summary +{ + /* Default constructor. */ + hsa_function_summary (); + + /* Kind of GPU/host function. */ + hsa_function_kind m_kind; + + /* Pointer to a cgraph node which is a HSA implementation of the function. + In case of the function is a HSA function, the bound function points + to the host function. */ + cgraph_node *m_bound_function; + + /* Identifies if the function is an HSA function or a host function. */ + bool m_gpu_implementation_p; + + /* True if the function is a gridified kernel. */ + bool m_gridified_kernel_p; +}; + +inline +hsa_function_summary::hsa_function_summary (): m_kind (HSA_NONE), + m_bound_function (NULL), m_gpu_implementation_p (false) +{ +} + +/* Function summary for HSA functions. */ +class hsa_summary_t: public function_summary +{ +public: + hsa_summary_t (symbol_table *table): + function_summary (table) { } + + /* Couple GPU and HOST as gpu-specific and host-specific implementation of + the same function. KIND determines whether GPU is a host-invokable kernel + or gpu-callable function and GRIDIFIED_KERNEL_P is set if the function was + gridified in OMP. */ + + void link_functions (cgraph_node *gpu, cgraph_node *host, + hsa_function_kind kind, bool gridified_kernel_p); + +private: + void process_gpu_implementation_attributes (tree gdecl); +}; + +/* OMP simple builtin describes behavior that should be done for + the routine. */ +class omp_simple_builtin +{ +public: + omp_simple_builtin (const char *name, const char *warning_message, + bool sorry, hsa_op_immed *return_value = NULL): + m_name (name), m_warning_message (warning_message), m_sorry (sorry), + m_return_value (return_value) + {} + + /* Generate HSAIL instructions for the builtin or produce warning message. */ + void generate (gimple *stmt, hsa_bb *hbb); + + /* Name of function. */ + const char *m_name; + + /* Warning message. */ + const char *m_warning_message; + + /* Flag if we should sorry after the warning message is printed. */ + bool m_sorry; + + /* Return value of the function. */ + hsa_op_immed *m_return_value; + + /* Emission function. */ + void (*m_emit_func) (gimple *stmt, hsa_bb *); +}; + +/* Class for hashing hsa_internal_fn. */ + +struct hsa_internal_fn_hasher: free_ptr_hash +{ + static inline hashval_t hash (const value_type); + static inline bool equal (const value_type, const compare_type); +}; + +/* Hash hsa_symbol. */ + +inline hashval_t +hsa_internal_fn_hasher::hash (const value_type item) +{ + return item->m_fn; +} + +/* Return true if the DECL_UIDs of decls both symbols refer to are equal. */ + +inline bool +hsa_internal_fn_hasher::equal (const value_type a, const compare_type b) +{ + return a->m_fn == b->m_fn && a->m_type_bit_size == b->m_type_bit_size; +} + +/* in hsa-common.c */ +extern struct hsa_function_representation *hsa_cfun; +extern hash_map *> *hsa_decl_kernel_dependencies; +extern hsa_summary_t *hsa_summaries; +extern hsa_symbol *hsa_num_threads; +extern unsigned hsa_kernel_calls_counter; +extern hash_set *hsa_failed_functions; +extern hash_table *hsa_global_variable_symbols; + +bool hsa_callable_function_p (tree fndecl); +void hsa_init_compilation_unit_data (void); +void hsa_deinit_compilation_unit_data (void); +bool hsa_machine_large_p (void); +bool hsa_full_profile_p (void); +bool hsa_opcode_floating_bit_insn_p (BrigOpcode16_t); +unsigned hsa_type_bit_size (BrigType16_t t); +BrigType16_t hsa_bittype_for_bitsize (unsigned bitsize); +BrigType16_t hsa_uint_for_bitsize (unsigned bitsize); +BrigType16_t hsa_float_for_bitsize (unsigned bitsize); +BrigType16_t hsa_bittype_for_type (BrigType16_t t); +BrigType16_t hsa_unsigned_type_for_type (BrigType16_t t); +bool hsa_type_packed_p (BrigType16_t type); +bool hsa_type_float_p (BrigType16_t type); +bool hsa_type_integer_p (BrigType16_t type); +bool hsa_btype_p (BrigType16_t type); +BrigAlignment8_t hsa_alignment_encoding (unsigned n); +BrigAlignment8_t hsa_natural_alignment (BrigType16_t type); +BrigAlignment8_t hsa_object_alignment (tree t); +unsigned hsa_byte_alignment (BrigAlignment8_t alignment); +void hsa_destroy_operand (hsa_op_base *op); +void hsa_destroy_insn (hsa_insn_basic *insn); +void hsa_add_kern_decl_mapping (tree decl, char *name, unsigned, bool); +unsigned hsa_get_number_decl_kernel_mappings (void); +tree hsa_get_decl_kernel_mapping_decl (unsigned i); +char *hsa_get_decl_kernel_mapping_name (unsigned i); +unsigned hsa_get_decl_kernel_mapping_omp_size (unsigned i); +bool hsa_get_decl_kernel_mapping_gridified (unsigned i); +void hsa_free_decl_kernel_mapping (void); +tree *hsa_get_ctor_statements (void); +tree *hsa_get_dtor_statements (void); +tree *hsa_get_kernel_dispatch_type (void); +void hsa_add_kernel_dependency (tree caller, const char *called_function); +void hsa_sanitize_name (char *p); +char *hsa_brig_function_name (const char *p); +const char *hsa_get_declaration_name (tree decl); +void hsa_register_kernel (cgraph_node *host); +void hsa_register_kernel (cgraph_node *gpu, cgraph_node *host); +bool hsa_seen_error (void); +void hsa_fail_cfun (void); + +/* In hsa-gen.c. */ +void hsa_build_append_simple_mov (hsa_op_reg *, hsa_op_base *, hsa_bb *); +hsa_symbol *hsa_get_spill_symbol (BrigType16_t); +hsa_symbol *hsa_get_string_cst_symbol (BrigType16_t); +hsa_op_reg *hsa_spill_in (hsa_insn_basic *, hsa_op_reg *, hsa_op_reg **); +hsa_op_reg *hsa_spill_out (hsa_insn_basic *, hsa_op_reg *, hsa_op_reg **); +hsa_bb *hsa_init_new_bb (basic_block); +hsa_function_representation *hsa_generate_function_declaration (tree decl); +hsa_function_representation *hsa_generate_internal_fn_decl (hsa_internal_fn *); +tree hsa_get_host_function (tree decl); + +/* In hsa-regalloc.c. */ +void hsa_regalloc (void); + +/* In hsa-brig.c. */ +extern hash_table *hsa_emitted_internal_decls; +void hsa_brig_emit_function (void); +void hsa_output_brig (void); +unsigned hsa_get_imm_brig_type_len (BrigType16_t type); +void hsa_brig_emit_omp_symbols (void); + +/* In hsa-dump.c. */ +const char *hsa_seg_name (BrigSegment8_t); +void dump_hsa_insn (FILE *f, hsa_insn_basic *insn); +void dump_hsa_bb (FILE *, hsa_bb *); +void dump_hsa_cfun (FILE *); +DEBUG_FUNCTION void debug_hsa_operand (hsa_op_base *opc); +DEBUG_FUNCTION void debug_hsa_insn (hsa_insn_basic *insn); + +union hsa_bytes +{ + uint8_t b8; + uint16_t b16; + uint32_t b32; + uint64_t b64; +}; + +/* Return true if a function DECL is an HSA implementation. */ + +static inline bool +hsa_gpu_implementation_p (tree decl) +{ + if (hsa_summaries == NULL) + return false; + + hsa_function_summary *s = hsa_summaries->get (cgraph_node::get_create (decl)); + + return s->m_gpu_implementation_p; +} + +#endif /* HSA_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hw-doloop.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hw-doloop.h new file mode 100644 index 0000000..38e8588 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hw-doloop.h @@ -0,0 +1,160 @@ +/* Code to analyze doloop loops in order for targets to perform late + optimizations converting doloops to other forms of hardware loops. + Copyright (C) 2011-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_HW_DOLOOP_H +#define GCC_HW_DOLOOP_H + +/* We need to keep a vector of loops */ +typedef struct hwloop_info_d *hwloop_info; + +/* Information about a loop we have found (or are in the process of + finding). */ +struct GTY (()) hwloop_info_d +{ + /* loop number, for dumps */ + int loop_no; + + /* Next loop in the graph. */ + hwloop_info next; + + /* Vector of blocks only within the loop, including those within + inner loops. */ + vec blocks; + + /* Same information in a bitmap. */ + bitmap block_bitmap; + + /* Vector of inner loops within this loop. Includes loops of every + nesting level. */ + vec loops; + + /* All edges that jump into the loop. */ + vec *incoming; + + /* The ports currently using this infrastructure can typically + handle two cases: all incoming edges have the same destination + block, or all incoming edges have the same source block. These + two members are set to the common source or destination we found, + or NULL if different blocks were found. If both are NULL the + loop can't be optimized. */ + basic_block incoming_src; + basic_block incoming_dest; + + /* First block in the loop. This is the one branched to by the loop_end + insn. */ + basic_block head; + + /* Last block in the loop (the one with the loop_end insn). */ + basic_block tail; + + /* The successor block of the loop. This is the one the loop_end insn + falls into. */ + basic_block successor; + + /* The last instruction in the tail. */ + rtx_insn *last_insn; + + /* The loop_end insn. */ + rtx_insn *loop_end; + + /* The iteration register. */ + rtx iter_reg; + + /* The new label placed at the beginning of the loop. */ + rtx_insn *start_label; + + /* The new label placed at the end of the loop. */ + rtx end_label; + + /* The length of the loop. */ + int length; + + /* The nesting depth of the loop. Innermost loops are given a depth + of 1. Only successfully optimized doloops are counted; if an inner + loop was marked as bad, it does not increase the depth of its parent + loop. + This value is valid when the target's optimize function is called. */ + int depth; + + /* True if we can't optimize this loop. */ + bool bad; + + /* True if we have visited this loop during the optimization phase. */ + bool visited; + + /* The following values are collected before calling the target's optimize + function and are not valid earlier. */ + + /* Record information about control flow: whether the loop has calls + or asm statements, whether it has edges that jump out of the loop, + or edges that jump within the loop. */ + bool has_call; + bool has_asm; + bool jumps_within; + bool jumps_outof; + + /* True if there is an instruction other than the doloop_end which uses the + iteration register. */ + bool iter_reg_used; + /* True if the iteration register lives past the doloop instruction. */ + bool iter_reg_used_outside; + + /* Hard registers set at any point in the loop, except for the loop counter + register's set in the doloop_end instruction. */ + HARD_REG_SET regs_set_in_loop; +}; + +/* A set of hooks to be defined by a target that wants to use the reorg_loops + functionality. + + reorg_loops is intended to handle cases where special hardware loop + setup instructions are required before the loop, for example to set + up loop counter registers that are not exposed to the register + allocator, or to inform the hardware about loop bounds. + + reorg_loops performs analysis to discover loop_end patterns created + by the earlier loop-doloop pass, and sets up a hwloop_info + structure for each such insn it finds. It then tries to discover + the basic blocks containing the loop by tracking the lifetime of + the iteration register. + + If a valid loop can't be found, the FAIL function is called; + otherwise the OPT function is called for each loop, visiting + innermost loops first and ascending. */ +struct hw_doloop_hooks +{ + /* Examine INSN. If it is a suitable doloop_end pattern, return the + iteration register, which should be a single hard register. + Otherwise, return NULL_RTX. */ + rtx (*end_pattern_reg) (rtx_insn *insn); + /* Optimize LOOP. The target should perform any additional analysis + (e.g. checking that the loop isn't too long), and then perform + its transformations. Return true if successful, false if the + loop should be marked bad. If it returns false, the FAIL + function is called. */ + bool (*opt) (hwloop_info loop); + /* Handle a loop that was marked bad for any reason. This could be + used to split the doloop_end pattern. */ + void (*fail) (hwloop_info loop); +}; + +extern void reorg_loops (bool, struct hw_doloop_hooks *); + +#endif /* GCC_HW_DOLOOP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hwint.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hwint.h new file mode 100644 index 0000000..e5fa33f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/hwint.h @@ -0,0 +1,336 @@ +/* HOST_WIDE_INT definitions for the GNU compiler. + Copyright (C) 1998-2017 Free Software Foundation, Inc. + + This file is part of GCC. + + Provide definitions for macros which depend on HOST_BITS_PER_INT + and HOST_BITS_PER_LONG. */ + +#ifndef GCC_HWINT_H +#define GCC_HWINT_H + +/* This describes the machine the compiler is hosted on. */ +#define HOST_BITS_PER_CHAR CHAR_BIT +#define HOST_BITS_PER_SHORT (CHAR_BIT * SIZEOF_SHORT) +#define HOST_BITS_PER_INT (CHAR_BIT * SIZEOF_INT) +#define HOST_BITS_PER_LONG (CHAR_BIT * SIZEOF_LONG) +#define HOST_BITS_PER_PTR (CHAR_BIT * SIZEOF_VOID_P) + +/* The string that should be inserted into a printf style format to + indicate a "long" operand. */ +#ifndef HOST_LONG_FORMAT +#define HOST_LONG_FORMAT "l" +#endif + +/* The string that should be inserted into a printf style format to + indicate a "long long" operand. */ +#ifndef HOST_LONG_LONG_FORMAT +#define HOST_LONG_LONG_FORMAT "ll" +#endif + +/* If HAVE_LONG_LONG and SIZEOF_LONG_LONG aren't defined, but + GCC_VERSION >= 3000, assume this is the second or later stage of a + bootstrap, we do have long long, and it's 64 bits. (This is + required by C99; we do have some ports that violate that assumption + but they're all cross-compile-only.) Just in case, force a + constraint violation if that assumption is incorrect. */ +#if !defined HAVE_LONG_LONG +# if GCC_VERSION >= 3000 +# define HAVE_LONG_LONG 1 +# define SIZEOF_LONG_LONG 8 +extern char sizeof_long_long_must_be_8[sizeof (long long) == 8 ? 1 : -1]; +# endif +#endif + +#ifdef HAVE_LONG_LONG +# define HOST_BITS_PER_LONGLONG (CHAR_BIT * SIZEOF_LONG_LONG) +#endif + +/* Set HOST_WIDE_INT, this should be always 64 bits. + The underlying type is matched to that of int64_t and assumed + to be either long or long long. */ + +#define HOST_BITS_PER_WIDE_INT 64 +#if INT64_T_IS_LONG +# define HOST_WIDE_INT long +# define HOST_WIDE_INT_C(X) X ## L +#else +# if HOST_BITS_PER_LONGLONG == 64 +# define HOST_WIDE_INT long long +# define HOST_WIDE_INT_C(X) X ## LL +# else + #error "Unable to find a suitable type for HOST_WIDE_INT" +# endif +#endif + +#define HOST_WIDE_INT_UC(X) HOST_WIDE_INT_C (X ## U) +#define HOST_WIDE_INT_0 HOST_WIDE_INT_C (0) +#define HOST_WIDE_INT_0U HOST_WIDE_INT_UC (0) +#define HOST_WIDE_INT_1 HOST_WIDE_INT_C (1) +#define HOST_WIDE_INT_1U HOST_WIDE_INT_UC (1) +#define HOST_WIDE_INT_M1 HOST_WIDE_INT_C (-1) +#define HOST_WIDE_INT_M1U HOST_WIDE_INT_UC (-1) + +/* This is a magic identifier which allows GCC to figure out the type + of HOST_WIDE_INT for %wd specifier checks. You must issue this + typedef before using the __asm_fprintf__ format attribute. */ +typedef HOST_WIDE_INT __gcc_host_wide_int__; + +/* Provide C99 style format definitions for 64bits. */ +#ifndef HAVE_INTTYPES_H +#if INT64_T_IS_LONG +# define GCC_PRI64 HOST_LONG_FORMAT +#else +# define GCC_PRI64 HOST_LONG_LONG_FORMAT +#endif +#undef PRId64 +#define PRId64 GCC_PRI64 "d" +#undef PRIi64 +#define PRIi64 GCC_PRI64 "i" +#undef PRIo64 +#define PRIo64 GCC_PRI64 "o" +#undef PRIu64 +#define PRIu64 GCC_PRI64 "u" +#undef PRIx64 +#define PRIx64 GCC_PRI64 "x" +#undef PRIX64 +#define PRIX64 GCC_PRI64 "X" +#endif + +/* Various printf format strings for HOST_WIDE_INT. */ + +#if INT64_T_IS_LONG +# define HOST_WIDE_INT_PRINT HOST_LONG_FORMAT +# define HOST_WIDE_INT_PRINT_C "L" +#else +# define HOST_WIDE_INT_PRINT HOST_LONG_LONG_FORMAT +# define HOST_WIDE_INT_PRINT_C "LL" +#endif + +#define HOST_WIDE_INT_PRINT_DEC "%" PRId64 +#define HOST_WIDE_INT_PRINT_DEC_C "%" PRId64 HOST_WIDE_INT_PRINT_C +#define HOST_WIDE_INT_PRINT_UNSIGNED "%" PRIu64 +#define HOST_WIDE_INT_PRINT_HEX "%#" PRIx64 +#define HOST_WIDE_INT_PRINT_HEX_PURE "%" PRIx64 +#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%" PRIx64 "%016" PRIx64 +#define HOST_WIDE_INT_PRINT_PADDED_HEX "%016" PRIx64 + +/* Define HOST_WIDEST_FAST_INT to the widest integer type supported + efficiently in hardware. (That is, the widest integer type that fits + in a hardware register.) Normally this is "long" but on some hosts it + should be "long long" or "__int64". This is no convenient way to + autodetect this, so such systems must set a flag in config.host; see there + for details. */ + +#ifdef USE_LONG_LONG_FOR_WIDEST_FAST_INT +# ifdef HAVE_LONG_LONG +# define HOST_WIDEST_FAST_INT long long +# define HOST_BITS_PER_WIDEST_FAST_INT HOST_BITS_PER_LONGLONG +# else +# error "Your host said it wanted to use long long but that does not exist" +# endif +#else +# define HOST_WIDEST_FAST_INT long +# define HOST_BITS_PER_WIDEST_FAST_INT HOST_BITS_PER_LONG +#endif + +/* Inline functions operating on HOST_WIDE_INT. */ + +/* Return X with all but the lowest bit masked off. */ + +static inline unsigned HOST_WIDE_INT +least_bit_hwi (unsigned HOST_WIDE_INT x) +{ + return (x & -x); +} + +/* True if X is zero or a power of two. */ + +static inline bool +pow2_or_zerop (unsigned HOST_WIDE_INT x) +{ + return least_bit_hwi (x) == x; +} + +/* True if X is a power of two. */ + +static inline bool +pow2p_hwi (unsigned HOST_WIDE_INT x) +{ + return x && pow2_or_zerop (x); +} + +#if GCC_VERSION < 3004 + +extern int clz_hwi (unsigned HOST_WIDE_INT x); +extern int ctz_hwi (unsigned HOST_WIDE_INT x); +extern int ffs_hwi (unsigned HOST_WIDE_INT x); + +/* Return the number of set bits in X. */ +extern int popcount_hwi (unsigned HOST_WIDE_INT x); + +/* Return log2, or -1 if not exact. */ +extern int exact_log2 (unsigned HOST_WIDE_INT); + +/* Return floor of log2, with -1 for zero. */ +extern int floor_log2 (unsigned HOST_WIDE_INT); + +/* Return the smallest n such that 2**n >= X. */ +extern int ceil_log2 (unsigned HOST_WIDE_INT); + +#else /* GCC_VERSION >= 3004 */ + +/* For convenience, define 0 -> word_size. */ +static inline int +clz_hwi (unsigned HOST_WIDE_INT x) +{ + if (x == 0) + return HOST_BITS_PER_WIDE_INT; +# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG + return __builtin_clzl (x); +# elif HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONGLONG + return __builtin_clzll (x); +# else + return __builtin_clz (x); +# endif +} + +static inline int +ctz_hwi (unsigned HOST_WIDE_INT x) +{ + if (x == 0) + return HOST_BITS_PER_WIDE_INT; +# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG + return __builtin_ctzl (x); +# elif HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONGLONG + return __builtin_ctzll (x); +# else + return __builtin_ctz (x); +# endif +} + +static inline int +ffs_hwi (unsigned HOST_WIDE_INT x) +{ +# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG + return __builtin_ffsl (x); +# elif HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONGLONG + return __builtin_ffsll (x); +# else + return __builtin_ffs (x); +# endif +} + +static inline int +popcount_hwi (unsigned HOST_WIDE_INT x) +{ +# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG + return __builtin_popcountl (x); +# elif HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONGLONG + return __builtin_popcountll (x); +# else + return __builtin_popcount (x); +# endif +} + +static inline int +floor_log2 (unsigned HOST_WIDE_INT x) +{ + return HOST_BITS_PER_WIDE_INT - 1 - clz_hwi (x); +} + +static inline int +ceil_log2 (unsigned HOST_WIDE_INT x) +{ + return floor_log2 (x - 1) + 1; +} + +static inline int +exact_log2 (unsigned HOST_WIDE_INT x) +{ + return pow2p_hwi (x) ? ctz_hwi (x) : -1; +} + +#endif /* GCC_VERSION >= 3004 */ + +#define HOST_WIDE_INT_MIN (HOST_WIDE_INT) \ + (HOST_WIDE_INT_1U << (HOST_BITS_PER_WIDE_INT - 1)) +#define HOST_WIDE_INT_MAX (~(HOST_WIDE_INT_MIN)) + +extern HOST_WIDE_INT abs_hwi (HOST_WIDE_INT); +extern unsigned HOST_WIDE_INT absu_hwi (HOST_WIDE_INT); +extern HOST_WIDE_INT gcd (HOST_WIDE_INT, HOST_WIDE_INT); +extern HOST_WIDE_INT pos_mul_hwi (HOST_WIDE_INT, HOST_WIDE_INT); +extern HOST_WIDE_INT mul_hwi (HOST_WIDE_INT, HOST_WIDE_INT); +extern HOST_WIDE_INT least_common_multiple (HOST_WIDE_INT, HOST_WIDE_INT); + +/* Like ctz_hwi, except 0 when x == 0. */ + +static inline int +ctz_or_zero (unsigned HOST_WIDE_INT x) +{ + return ffs_hwi (x) - 1; +} + +/* Sign extend SRC starting from PREC. */ + +static inline HOST_WIDE_INT +sext_hwi (HOST_WIDE_INT src, unsigned int prec) +{ + if (prec == HOST_BITS_PER_WIDE_INT) + return src; + else +#if defined (__GNUC__) + { + /* Take the faster path if the implementation-defined bits it's relying + on are implemented the way we expect them to be. Namely, conversion + from unsigned to signed preserves bit pattern, and right shift of + a signed value propagates the sign bit. + We have to convert from signed to unsigned and back, because when left + shifting signed values, any overflow is undefined behavior. */ + gcc_checking_assert (prec < HOST_BITS_PER_WIDE_INT); + int shift = HOST_BITS_PER_WIDE_INT - prec; + return ((HOST_WIDE_INT) ((unsigned HOST_WIDE_INT) src << shift)) >> shift; + } +#else + { + /* Fall back to the slower, well defined path otherwise. */ + gcc_checking_assert (prec < HOST_BITS_PER_WIDE_INT); + HOST_WIDE_INT sign_mask = HOST_WIDE_INT_1 << (prec - 1); + HOST_WIDE_INT value_mask = (HOST_WIDE_INT_1U << prec) - HOST_WIDE_INT_1U; + return (((src & value_mask) ^ sign_mask) - sign_mask); + } +#endif +} + +/* Zero extend SRC starting from PREC. */ +static inline unsigned HOST_WIDE_INT +zext_hwi (unsigned HOST_WIDE_INT src, unsigned int prec) +{ + if (prec == HOST_BITS_PER_WIDE_INT) + return src; + else + { + gcc_checking_assert (prec < HOST_BITS_PER_WIDE_INT); + return src & ((HOST_WIDE_INT_1U << prec) - 1); + } +} + +/* Compute the absolute value of X. */ + +inline HOST_WIDE_INT +abs_hwi (HOST_WIDE_INT x) +{ + gcc_checking_assert (x != HOST_WIDE_INT_MIN); + return x >= 0 ? x : -x; +} + +/* Compute the absolute value of X as an unsigned type. */ + +inline unsigned HOST_WIDE_INT +absu_hwi (HOST_WIDE_INT x) +{ + return x >= 0 ? (unsigned HOST_WIDE_INT)x : -(unsigned HOST_WIDE_INT)x; +} + +#endif /* ! GCC_HWINT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ifcvt.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ifcvt.h new file mode 100644 index 0000000..1935de5 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ifcvt.h @@ -0,0 +1,113 @@ +/* If-conversion header file. + Copyright (C) 2014-2017 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#ifndef GCC_IFCVT_H +#define GCC_IFCVT_H + +/* Structure to group all of the information to process IF-THEN and + IF-THEN-ELSE blocks for the conditional execution support. */ + +struct ce_if_block +{ + basic_block test_bb; /* First test block. */ + basic_block then_bb; /* THEN block. */ + basic_block else_bb; /* ELSE block or NULL. */ + basic_block join_bb; /* Join THEN/ELSE blocks. */ + basic_block last_test_bb; /* Last bb to hold && or || tests. */ + int num_multiple_test_blocks; /* # of && and || basic blocks. */ + int num_and_and_blocks; /* # of && blocks. */ + int num_or_or_blocks; /* # of || blocks. */ + int num_multiple_test_insns; /* # of insns in && and || blocks. */ + int and_and_p; /* Complex test is &&. */ + int num_then_insns; /* # of insns in THEN block. */ + int num_else_insns; /* # of insns in ELSE block. */ + int pass; /* Pass number. */ +}; + +/* Used by noce_process_if_block to communicate with its subroutines. + + The subroutines know that A and B may be evaluated freely. They + know that X is a register. They should insert new instructions + before cond_earliest. */ + +struct noce_if_info +{ + /* The basic blocks that make up the IF-THEN-{ELSE-,}JOIN block. */ + basic_block test_bb, then_bb, else_bb, join_bb; + + /* The jump that ends TEST_BB. */ + rtx_insn *jump; + + /* The jump condition. */ + rtx cond; + + /* Reversed jump condition. */ + rtx rev_cond; + + /* New insns should be inserted before this one. */ + rtx_insn *cond_earliest; + + /* Insns in the THEN and ELSE block. There is always just this + one insns in those blocks. The insns are single_set insns. + If there was no ELSE block, INSN_B is the last insn before + COND_EARLIEST, or NULL_RTX. In the former case, the insn + operands are still valid, as if INSN_B was moved down below + the jump. */ + rtx_insn *insn_a, *insn_b; + + /* The SET_SRC of INSN_A and INSN_B. */ + rtx a, b; + + /* The SET_DEST of INSN_A. */ + rtx x; + + /* The original set destination that the THEN and ELSE basic blocks finally + write their result to. */ + rtx orig_x; + /* True if this if block is not canonical. In the canonical form of + if blocks, the THEN_BB is the block reached via the fallthru edge + from TEST_BB. For the noce transformations, we allow the symmetric + form as well. */ + bool then_else_reversed; + + /* True if the contents of then_bb and else_bb are a + simple single set instruction. */ + bool then_simple; + bool else_simple; + + /* True if we're optimisizing the control block for speed, false if + we're optimizing for size. */ + bool speed_p; + + /* An estimate of the original costs. When optimizing for size, this is the + combined cost of COND, JUMP and the costs for THEN_BB and ELSE_BB. + When optimizing for speed, we use the costs of COND plus the minimum of + the costs for THEN_BB and ELSE_BB, as computed in the next field. */ + unsigned int original_cost; + + /* Maximum permissible cost for the unconditional sequence we should + generate to replace this branch. */ + unsigned int max_seq_cost; + + /* The name of the noce transform that succeeded in if-converting + this structure. Used for debugging. */ + const char *transform_name; +}; + +#endif /* GCC_IFCVT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/inchash.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/inchash.h new file mode 100644 index 0000000..6af1dad --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/inchash.h @@ -0,0 +1,186 @@ +/* An incremental hash abstract data type. + Copyright (C) 2014-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef INCHASH_H +#define INCHASH_H 1 + + +/* This file implements an incremential hash function ADT, to be used + by code that incrementially hashes a lot of unrelated data + (not in a single memory block) into a single value. The goal + is to make it easy to plug in efficient hash algorithms. + Currently it just implements the plain old jhash based + incremental hash from gcc's tree.c. */ + +hashval_t iterative_hash_host_wide_int (HOST_WIDE_INT, hashval_t); +hashval_t iterative_hash_hashval_t (hashval_t, hashval_t); + +namespace inchash +{ + +class hash +{ + public: + + /* Start incremential hashing, optionally with SEED. */ + hash (hashval_t seed = 0) + { + val = seed; + bits = 0; + } + + /* End incremential hashing and provide the final value. */ + hashval_t end () + { + return val; + } + + /* Add unsigned value V. */ + void add_int (unsigned v) + { + val = iterative_hash_hashval_t (v, val); + } + + /* Add HOST_WIDE_INT value V. */ + void add_wide_int (HOST_WIDE_INT v) + { + val = iterative_hash_host_wide_int (v, val); + } + + /* Hash in pointer PTR. */ + void add_ptr (const void *ptr) + { + add (&ptr, sizeof (ptr)); + } + + /* Add a memory block DATA with size LEN. */ + void add (const void *data, size_t len) + { + val = iterative_hash (data, len, val); + } + + /* Merge hash value OTHER. */ + void merge_hash (hashval_t other) + { + val = iterative_hash_hashval_t (other, val); + } + + /* Hash in state from other inchash OTHER. */ + void merge (hash &other) + { + merge_hash (other.val); + } + + template void add_object(T &obj) + { + add (&obj, sizeof(T)); + } + + /* Support for accumulating boolean flags */ + + void add_flag (bool flag) + { + bits = (bits << 1) | flag; + } + + void commit_flag () + { + add_int (bits); + bits = 0; + } + + /* Support for commutative hashing. Add A and B in a defined order + based on their value. This is useful for hashing commutative + expressions, so that A+B and B+A get the same hash. */ + + void add_commutative (hash &a, hash &b) + { + if (a.end() > b.end()) + { + merge (b); + merge (a); + } + else + { + merge (a); + merge (b); + } + } + + private: + hashval_t val; + unsigned bits; +}; + +} + +/* Borrowed from hashtab.c iterative_hash implementation. */ +#define mix(a,b,c) \ +{ \ + a -= b; a -= c; a ^= (c>>13); \ + b -= c; b -= a; b ^= (a<< 8); \ + c -= a; c -= b; c ^= ((b&0xffffffff)>>13); \ + a -= b; a -= c; a ^= ((c&0xffffffff)>>12); \ + b -= c; b -= a; b = (b ^ (a<<16)) & 0xffffffff; \ + c -= a; c -= b; c = (c ^ (b>> 5)) & 0xffffffff; \ + a -= b; a -= c; a = (a ^ (c>> 3)) & 0xffffffff; \ + b -= c; b -= a; b = (b ^ (a<<10)) & 0xffffffff; \ + c -= a; c -= b; c = (c ^ (b>>15)) & 0xffffffff; \ +} + + +/* Produce good hash value combining VAL and VAL2. */ +inline +hashval_t +iterative_hash_hashval_t (hashval_t val, hashval_t val2) +{ + /* the golden ratio; an arbitrary value. */ + hashval_t a = 0x9e3779b9; + + mix (a, val, val2); + return val2; +} + +/* Produce good hash value combining VAL and VAL2. */ + +inline +hashval_t +iterative_hash_host_wide_int (HOST_WIDE_INT val, hashval_t val2) +{ + if (sizeof (HOST_WIDE_INT) == sizeof (hashval_t)) + return iterative_hash_hashval_t (val, val2); + else + { + hashval_t a = (hashval_t) val; + /* Avoid warnings about shifting of more than the width of the type on + hosts that won't execute this path. */ + int zero = 0; + hashval_t b = (hashval_t) (val >> (sizeof (hashval_t) * 8 + zero)); + mix (a, b, val2); + if (sizeof (HOST_WIDE_INT) > 2 * sizeof (hashval_t)) + { + hashval_t a = (hashval_t) (val >> (sizeof (hashval_t) * 16 + zero)); + hashval_t b = (hashval_t) (val >> (sizeof (hashval_t) * 24 + zero)); + mix (a, b, val2); + } + return val2; + } +} + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/incpath.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/incpath.h new file mode 100644 index 0000000..39a29cd --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/incpath.h @@ -0,0 +1,39 @@ +/* Set up combined include path for the preprocessor. + Copyright (C) 2003-2017 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING3. If not see + . */ + +#ifndef GCC_INCPATH_H +#define GCC_INCPATH_H + +extern void split_quote_chain (void); +extern void add_path (char *, int, int, bool); +extern void register_include_chains (cpp_reader *, const char *, + const char *, const char *, + int, int, int); +extern void add_cpp_dir_path (struct cpp_dir *, int); +extern struct cpp_dir *get_added_cpp_dirs (int); + +struct target_c_incpath_s { + /* Do extra includes processing. STDINC is false iff -nostdinc was given. */ + void (*extra_pre_includes) (const char *, const char *, int); + void (*extra_includes) (const char *, const char *, int); +}; + +extern struct target_c_incpath_s target_c_incpath; + +enum { QUOTE = 0, BRACKET, SYSTEM, AFTER }; + +#endif /* GCC_INCPATH_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/input.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/input.h new file mode 100644 index 0000000..7251eef --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/input.h @@ -0,0 +1,156 @@ +/* Declarations for variables relating to reading the source file. + Used by parsers, lexical analyzers, and error message routines. + Copyright (C) 1993-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_INPUT_H +#define GCC_INPUT_H + +#include "line-map.h" + +extern GTY(()) struct line_maps *line_table; +extern GTY(()) struct line_maps *saved_line_table; + +/* A value which will never be used to represent a real location. */ +#define UNKNOWN_LOCATION ((source_location) 0) + +/* The location for declarations in "" */ +#define BUILTINS_LOCATION ((source_location) 1) + +/* line-map.c reserves RESERVED_LOCATION_COUNT to the user. Ensure + both UNKNOWN_LOCATION and BUILTINS_LOCATION fit into that. */ +extern char builtins_location_check[(BUILTINS_LOCATION + < RESERVED_LOCATION_COUNT) ? 1 : -1]; + +extern bool is_location_from_builtin_token (source_location); +extern expanded_location expand_location (source_location); +extern const char *location_get_source_line (const char *file_path, int line, + int *line_size); +extern bool location_missing_trailing_newline (const char *file_path); +extern expanded_location expand_location_to_spelling_point (source_location); +extern source_location expansion_point_location_if_in_system_header (source_location); +extern source_location expansion_point_location (source_location); + +/* Historically GCC used location_t, while cpp used source_location. + This could be removed but it hardly seems worth the effort. */ +typedef source_location location_t; + +extern location_t input_location; + +#define LOCATION_FILE(LOC) ((expand_location (LOC)).file) +#define LOCATION_LINE(LOC) ((expand_location (LOC)).line) +#define LOCATION_COLUMN(LOC)((expand_location (LOC)).column) +#define LOCATION_LOCUS(LOC) \ + ((IS_ADHOC_LOC (LOC)) ? get_location_from_adhoc_loc (line_table, LOC) \ + : (LOC)) +#define LOCATION_BLOCK(LOC) \ + ((tree) ((IS_ADHOC_LOC (LOC)) ? get_data_from_adhoc_loc (line_table, (LOC)) \ + : NULL)) +#define RESERVED_LOCATION_P(LOC) \ + (LOCATION_LOCUS (LOC) < RESERVED_LOCATION_COUNT) + +/* Return a positive value if LOCATION is the locus of a token that is + located in a system header, O otherwise. It returns 1 if LOCATION + is the locus of a token that is located in a system header, and 2 + if LOCATION is the locus of a token located in a C system header + that therefore needs to be extern "C" protected in C++. + + Note that this function returns 1 if LOCATION belongs to a token + that is part of a macro replacement-list defined in a system + header, but expanded in a non-system file. */ +#define in_system_header_at(LOC) \ + (linemap_location_in_system_header_p (line_table, LOC)) +/* Return a positive value if LOCATION is the locus of a token that + comes from a macro expansion, O otherwise. */ +#define from_macro_expansion_at(LOC) \ + ((linemap_location_from_macro_expansion_p (line_table, LOC))) +/* Return a positive value if LOCATION is the locus of a token that comes from + a macro definition, O otherwise. This differs from from_macro_expansion_at + in its treatment of macro arguments, for which this returns false. */ +#define from_macro_definition_at(LOC) \ + ((linemap_location_from_macro_definition_p (line_table, LOC))) + +static inline location_t +get_pure_location (location_t loc) +{ + return get_pure_location (line_table, loc); +} + +/* Get the start of any range encoded within location LOC. */ + +static inline location_t +get_start (location_t loc) +{ + return get_range_from_loc (line_table, loc).m_start; +} + +/* Get the endpoint of any range encoded within location LOC. */ + +static inline location_t +get_finish (location_t loc) +{ + return get_range_from_loc (line_table, loc).m_finish; +} + +extern location_t make_location (location_t caret, + location_t start, location_t finish); + +void dump_line_table_statistics (void); + +void dump_location_info (FILE *stream); + +void diagnostics_file_cache_fini (void); + +void diagnostics_file_cache_forcibly_evict_file (const char *file_path); + +struct GTY(()) string_concat +{ + string_concat (int num, location_t *locs); + + int m_num; + location_t * GTY ((atomic)) m_locs; +}; + +struct location_hash : int_hash { }; + +class GTY(()) string_concat_db +{ + public: + string_concat_db (); + void record_string_concatenation (int num, location_t *locs); + + bool get_string_concatenation (location_t loc, + int *out_num, + location_t **out_locs); + + private: + static location_t get_key_loc (location_t loc); + + /* For the fields to be private, we must grant access to the + generated code in gtype-desc.c. */ + + friend void ::gt_ggc_mx_string_concat_db (void *x_p); + friend void ::gt_pch_nx_string_concat_db (void *x_p); + friend void ::gt_pch_p_16string_concat_db (void *this_obj, void *x_p, + gt_pointer_operator op, + void *cookie); + + hash_map *m_table; +}; + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/insn-addr.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/insn-addr.h new file mode 100644 index 0000000..c43f737 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/insn-addr.h @@ -0,0 +1,63 @@ +/* Macros to support INSN_ADDRESSES + Copyright (C) 2000-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_INSN_ADDR_H +#define GCC_INSN_ADDR_H + +extern vec insn_addresses_; +extern int insn_current_address; + +#define INSN_ADDRESSES(id) (insn_addresses_[id]) +#define INSN_ADDRESSES_ALLOC(size) \ + do \ + { \ + insn_addresses_.create (size); \ + insn_addresses_.safe_grow_cleared (size); \ + memset (insn_addresses_.address (), \ + 0, sizeof (int) * size); \ + } \ + while (0) +#define INSN_ADDRESSES_FREE() (insn_addresses_.release ()) +#define INSN_ADDRESSES_SET_P() (insn_addresses_.exists ()) +#define INSN_ADDRESSES_SIZE() (insn_addresses_.length ()) + +static inline void +insn_addresses_new (rtx_insn *insn, int insn_addr) +{ + unsigned insn_uid = INSN_UID ((insn)); + + if (INSN_ADDRESSES_SET_P ()) + { + size_t size = INSN_ADDRESSES_SIZE (); + if (size <= insn_uid) + { + int *p; + insn_addresses_.safe_grow (insn_uid + 1); + p = insn_addresses_.address (); + memset (&p[size], + 0, sizeof (int) * (insn_uid + 1 - size)); + } + INSN_ADDRESSES (insn_uid) = insn_addr; + } +} + +#define INSN_ADDRESSES_NEW(insn, addr) \ + (insn_addresses_new (insn, addr)) + +#endif /* ! GCC_INSN_ADDR_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/insn-codes.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/insn-codes.h new file mode 100644 index 0000000..0c59aa4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/insn-codes.h @@ -0,0 +1,1664 @@ +/* Generated automatically by the program `gencodes' + from the machine description file `md'. */ + +#ifndef GCC_INSN_CODES_H +#define GCC_INSN_CODES_H + +enum insn_code { + CODE_FOR_nothing = 0, + CODE_FOR_ls2_alu1_turn_enabled_insn = 1, + CODE_FOR_ls2_alu2_turn_enabled_insn = 2, + CODE_FOR_ls2_falu1_turn_enabled_insn = 3, + CODE_FOR_ls2_falu2_turn_enabled_insn = 4, + CODE_FOR_trap = 5, + CODE_FOR_addsf3 = 10, + CODE_FOR_adddf3 = 11, + CODE_FOR_addv2sf3 = 12, + CODE_FOR_subsf3 = 23, + CODE_FOR_subdf3 = 24, + CODE_FOR_subv2sf3 = 25, + CODE_FOR_subsi3 = 26, + CODE_FOR_subdi3 = 27, + CODE_FOR_mulv2sf3 = 33, + CODE_FOR_mulsi3_mul3_nohilo = 34, + CODE_FOR_muldi3_mul3_nohilo = 35, + CODE_FOR_mulsi3_mul3 = 36, + CODE_FOR_muldi3_mul3 = 37, + CODE_FOR_mulsi3_internal = 38, + CODE_FOR_muldi3_internal = 39, + CODE_FOR_mulsi3_r4000 = 40, + CODE_FOR_muldi3_r4000 = 41, + CODE_FOR_mulsidi3_32bit = 51, + CODE_FOR_umulsidi3_32bit = 52, + CODE_FOR_mulsidi3_32bit_r4000 = 53, + CODE_FOR_umulsidi3_32bit_r4000 = 54, + CODE_FOR_mulsidi3_64bit = 55, + CODE_FOR_umulsidi3_64bit = 56, + CODE_FOR_mulsidi3_64bit_hilo = 57, + CODE_FOR_umulsidi3_64bit_hilo = 58, + CODE_FOR_mulsidi3_64bit_dmul = 59, + CODE_FOR_mulsidi3_64bit_r6dmul = 60, + CODE_FOR_msubsidi4 = 63, + CODE_FOR_umsubsidi4 = 64, + CODE_FOR_smulsi3_highpart_r6 = 65, + CODE_FOR_umulsi3_highpart_r6 = 66, + CODE_FOR_smulsi3_highpart_internal = 67, + CODE_FOR_umulsi3_highpart_internal = 68, + CODE_FOR_smulsi3_highpart_mulhi_internal = 69, + CODE_FOR_umulsi3_highpart_mulhi_internal = 70, + CODE_FOR_smuldi3_highpart_r6 = 73, + CODE_FOR_umuldi3_highpart_r6 = 74, + CODE_FOR_smuldi3_highpart_internal = 75, + CODE_FOR_umuldi3_highpart_internal = 76, + CODE_FOR_mulditi3_internal = 77, + CODE_FOR_umulditi3_internal = 78, + CODE_FOR_mulditi3_r4000 = 79, + CODE_FOR_umulditi3_r4000 = 80, + CODE_FOR_madsi = 81, + CODE_FOR_maddsidi4 = 82, + CODE_FOR_umaddsidi4 = 83, + CODE_FOR_divmodsi4_mips16 = 137, + CODE_FOR_divmoddi4_mips16 = 138, + CODE_FOR_udivmodsi4_mips16 = 141, + CODE_FOR_udivmoddi4_mips16 = 142, + CODE_FOR_divmodsi4_hilo_di = 143, + CODE_FOR_udivmodsi4_hilo_di = 144, + CODE_FOR_divmoddi4_hilo_di = CODE_FOR_nothing, + CODE_FOR_udivmoddi4_hilo_di = CODE_FOR_nothing, + CODE_FOR_divmodsi4_hilo_ti = 145, + CODE_FOR_udivmodsi4_hilo_ti = 146, + CODE_FOR_divmoddi4_hilo_ti = 147, + CODE_FOR_udivmoddi4_hilo_ti = 148, + CODE_FOR_divsi3 = 149, + CODE_FOR_udivsi3 = 150, + CODE_FOR_divdi3 = 151, + CODE_FOR_udivdi3 = 152, + CODE_FOR_modsi3 = 153, + CODE_FOR_umodsi3 = 154, + CODE_FOR_moddi3 = 155, + CODE_FOR_umoddi3 = 156, + CODE_FOR_sqrtsf2 = 157, + CODE_FOR_sqrtdf2 = 158, + CODE_FOR_sqrtv2sf2 = 159, + CODE_FOR_abssf2 = 166, + CODE_FOR_absdf2 = 167, + CODE_FOR_absv2sf2 = 168, + CODE_FOR_clzsi2 = 169, + CODE_FOR_clzdi2 = 170, + CODE_FOR_popcountsi2 = 171, + CODE_FOR_popcountdi2 = 172, + CODE_FOR_negsi2 = 174, + CODE_FOR_negdi2 = 175, + CODE_FOR_negsf2 = 176, + CODE_FOR_negdf2 = 177, + CODE_FOR_negv2sf2 = 178, + CODE_FOR_one_cmplsi2 = 179, + CODE_FOR_one_cmpldi2 = 180, + CODE_FOR_truncdfsf2 = 195, + CODE_FOR_truncdiqi2 = 196, + CODE_FOR_truncdihi2 = 197, + CODE_FOR_truncdisi2 = 198, + CODE_FOR_extendsidi2 = 232, + CODE_FOR_extendsfdf2 = 258, + CODE_FOR_fix_truncdfsi2_insn = 259, + CODE_FOR_fix_truncdfsi2_macro = 260, + CODE_FOR_fix_truncsfsi2_insn = 261, + CODE_FOR_fix_truncsfsi2_macro = 262, + CODE_FOR_fix_truncdfdi2 = 263, + CODE_FOR_fix_truncsfdi2 = 264, + CODE_FOR_floatsidf2 = 265, + CODE_FOR_floatdidf2 = 266, + CODE_FOR_floatsisf2 = 267, + CODE_FOR_floatdisf2 = 268, + CODE_FOR_mov_lwl = 278, + CODE_FOR_mov_ldl = 279, + CODE_FOR_mov_lwr = 280, + CODE_FOR_mov_ldr = 281, + CODE_FOR_mov_swl = 282, + CODE_FOR_mov_sdl = 283, + CODE_FOR_mov_swr = 284, + CODE_FOR_mov_sdr = 285, + CODE_FOR_load_gotsi = 298, + CODE_FOR_load_gotdi = 299, + CODE_FOR_movccf = 362, + CODE_FOR_mfhisi_di = 374, + CODE_FOR_mfhidi_di = CODE_FOR_nothing, + CODE_FOR_mfhisi_ti = 375, + CODE_FOR_mfhidi_ti = 376, + CODE_FOR_mthisi_di = 377, + CODE_FOR_mthidi_di = CODE_FOR_nothing, + CODE_FOR_mthisi_ti = 378, + CODE_FOR_mthidi_ti = 379, + CODE_FOR_load_lowdf = 380, + CODE_FOR_load_lowdi = 381, + CODE_FOR_load_lowv2sf = 382, + CODE_FOR_load_lowv2si = 383, + CODE_FOR_load_lowv4hi = 384, + CODE_FOR_load_lowv8qi = 385, + CODE_FOR_load_lowtf = 386, + CODE_FOR_load_highdf = 387, + CODE_FOR_load_highdi = 388, + CODE_FOR_load_highv2sf = 389, + CODE_FOR_load_highv2si = 390, + CODE_FOR_load_highv4hi = 391, + CODE_FOR_load_highv8qi = 392, + CODE_FOR_load_hightf = 393, + CODE_FOR_store_worddf = 394, + CODE_FOR_store_worddi = 395, + CODE_FOR_store_wordv2sf = 396, + CODE_FOR_store_wordv2si = 397, + CODE_FOR_store_wordv4hi = 398, + CODE_FOR_store_wordv8qi = 399, + CODE_FOR_store_wordtf = 400, + CODE_FOR_mthc1df = 401, + CODE_FOR_mthc1di = 402, + CODE_FOR_mthc1v2sf = 403, + CODE_FOR_mthc1v2si = 404, + CODE_FOR_mthc1v4hi = 405, + CODE_FOR_mthc1v8qi = 406, + CODE_FOR_mthc1tf = 407, + CODE_FOR_mfhc1df = 408, + CODE_FOR_mfhc1di = 409, + CODE_FOR_mfhc1v2sf = 410, + CODE_FOR_mfhc1v2si = 411, + CODE_FOR_mfhc1v4hi = 412, + CODE_FOR_mfhc1v8qi = 413, + CODE_FOR_mfhc1tf = 414, + CODE_FOR_loadgp_newabi_si = 415, + CODE_FOR_loadgp_newabi_di = 416, + CODE_FOR_loadgp_absolute_si = 417, + CODE_FOR_loadgp_absolute_di = 418, + CODE_FOR_loadgp_blockage = 419, + CODE_FOR_loadgp_rtp_si = 420, + CODE_FOR_loadgp_rtp_di = 421, + CODE_FOR_copygp_mips16_si = 422, + CODE_FOR_copygp_mips16_di = 423, + CODE_FOR_potential_cprestore_si = 424, + CODE_FOR_potential_cprestore_di = 425, + CODE_FOR_cprestore_si = 426, + CODE_FOR_cprestore_di = 427, + CODE_FOR_use_cprestore_si = 428, + CODE_FOR_use_cprestore_di = 429, + CODE_FOR_sync = 430, + CODE_FOR_synci = 431, + CODE_FOR_rdhwr_synci_step_si = 432, + CODE_FOR_rdhwr_synci_step_di = 433, + CODE_FOR_clear_hazard_si = 434, + CODE_FOR_clear_hazard_di = 435, + CODE_FOR_mips_cache = 436, + CODE_FOR_r10k_cache_barrier = 437, + CODE_FOR_lsa = 450, + CODE_FOR_dlsa = 451, + CODE_FOR_rotrsi3 = 456, + CODE_FOR_rotrdi3 = 457, + CODE_FOR_bswaphi2 = 458, + CODE_FOR_bswapsi2 = 459, + CODE_FOR_bswapdi2 = 460, + CODE_FOR_wsbh = 461, + CODE_FOR_dsbh = 462, + CODE_FOR_dshd = 463, + CODE_FOR_sunordered_sf_using_cc = 564, + CODE_FOR_suneq_sf_using_cc = 565, + CODE_FOR_sunlt_sf_using_cc = 566, + CODE_FOR_sunle_sf_using_cc = 567, + CODE_FOR_seq_sf_using_cc = 568, + CODE_FOR_slt_sf_using_cc = 569, + CODE_FOR_sle_sf_using_cc = 570, + CODE_FOR_sordered_sf_using_cc = CODE_FOR_nothing, + CODE_FOR_sltgt_sf_using_cc = CODE_FOR_nothing, + CODE_FOR_sne_sf_using_cc = CODE_FOR_nothing, + CODE_FOR_sunordered_df_using_cc = 571, + CODE_FOR_suneq_df_using_cc = 572, + CODE_FOR_sunlt_df_using_cc = 573, + CODE_FOR_sunle_df_using_cc = 574, + CODE_FOR_seq_df_using_cc = 575, + CODE_FOR_slt_df_using_cc = 576, + CODE_FOR_sle_df_using_cc = 577, + CODE_FOR_sordered_df_using_cc = CODE_FOR_nothing, + CODE_FOR_sltgt_df_using_cc = CODE_FOR_nothing, + CODE_FOR_sne_df_using_cc = CODE_FOR_nothing, + CODE_FOR_sunordered_sf_using_ccf = 578, + CODE_FOR_suneq_sf_using_ccf = 579, + CODE_FOR_sunlt_sf_using_ccf = 580, + CODE_FOR_sunle_sf_using_ccf = 581, + CODE_FOR_seq_sf_using_ccf = 582, + CODE_FOR_slt_sf_using_ccf = 583, + CODE_FOR_sle_sf_using_ccf = 584, + CODE_FOR_sordered_sf_using_ccf = 585, + CODE_FOR_sltgt_sf_using_ccf = 586, + CODE_FOR_sne_sf_using_ccf = 587, + CODE_FOR_sunordered_df_using_ccf = 588, + CODE_FOR_suneq_df_using_ccf = 589, + CODE_FOR_sunlt_df_using_ccf = 590, + CODE_FOR_sunle_df_using_ccf = 591, + CODE_FOR_seq_df_using_ccf = 592, + CODE_FOR_slt_df_using_ccf = 593, + CODE_FOR_sle_df_using_ccf = 594, + CODE_FOR_sordered_df_using_ccf = 595, + CODE_FOR_sltgt_df_using_ccf = 596, + CODE_FOR_sne_df_using_ccf = 597, + CODE_FOR_sge_sf_using_cc = 598, + CODE_FOR_sgt_sf_using_cc = 599, + CODE_FOR_sunge_sf_using_cc = 600, + CODE_FOR_sungt_sf_using_cc = 601, + CODE_FOR_sge_df_using_cc = 602, + CODE_FOR_sgt_df_using_cc = 603, + CODE_FOR_sunge_df_using_cc = 604, + CODE_FOR_sungt_df_using_cc = 605, + CODE_FOR_sge_sf_using_ccf = 606, + CODE_FOR_sgt_sf_using_ccf = 607, + CODE_FOR_sunge_sf_using_ccf = 608, + CODE_FOR_sungt_sf_using_ccf = 609, + CODE_FOR_sge_df_using_ccf = 610, + CODE_FOR_sgt_df_using_ccf = 611, + CODE_FOR_sunge_df_using_ccf = 612, + CODE_FOR_sungt_df_using_ccf = 613, + CODE_FOR_indirect_jump_si = 617, + CODE_FOR_indirect_jump_di = 618, + CODE_FOR_indirect_jump_and_restore_si = 619, + CODE_FOR_indirect_jump_and_restore_di = 620, + CODE_FOR_tablejump_si = 621, + CODE_FOR_tablejump_di = 622, + CODE_FOR_casesi_internal_mips16_si = 623, + CODE_FOR_casesi_internal_mips16_di = 624, + CODE_FOR_blockage = 625, + CODE_FOR_probe_stack_range_si = 626, + CODE_FOR_probe_stack_range_di = 627, + CODE_FOR_return_internal = 630, + CODE_FOR_simple_return_internal = 631, + CODE_FOR_mips_eret = 632, + CODE_FOR_mips_deret = 633, + CODE_FOR_mips_di = 634, + CODE_FOR_mips_ehb = 635, + CODE_FOR_mips_rdpgpr_si = 636, + CODE_FOR_mips_rdpgpr_di = 637, + CODE_FOR_cop0_move = 638, + CODE_FOR_eh_set_lr_si = 639, + CODE_FOR_eh_set_lr_di = 640, + CODE_FOR_restore_gp_si = 641, + CODE_FOR_restore_gp_di = 642, + CODE_FOR_move_gpsi = 643, + CODE_FOR_move_gpdi = 644, + CODE_FOR_load_callsi = 645, + CODE_FOR_load_calldi = 646, + CODE_FOR_set_got_version = 647, + CODE_FOR_update_got_version = 648, + CODE_FOR_sibcall_internal = 649, + CODE_FOR_sibcall_value_internal = 650, + CODE_FOR_sibcall_value_multiple_internal = 651, + CODE_FOR_call_internal = 652, + CODE_FOR_call_split = 653, + CODE_FOR_call_internal_direct = 654, + CODE_FOR_call_direct_split = 655, + CODE_FOR_call_value_internal = 656, + CODE_FOR_call_value_split = 657, + CODE_FOR_call_value_internal_direct = 658, + CODE_FOR_call_value_direct_split = 659, + CODE_FOR_call_value_multiple_internal = 660, + CODE_FOR_call_value_multiple_split = 661, + CODE_FOR_prefetch = 662, + CODE_FOR_nop = 665, + CODE_FOR_hazard_nop = 666, + CODE_FOR_insn_pseudo = 667, + CODE_FOR_consttable = 694, + CODE_FOR_consttable_end = 695, + CODE_FOR_consttable_tls_reloc = 696, + CODE_FOR_consttable_int = 697, + CODE_FOR_consttable_float = 698, + CODE_FOR_align = 699, + CODE_FOR_tls_get_tp_si = 701, + CODE_FOR_tls_get_tp_di = 702, + CODE_FOR_tls_get_tp_mips16_si = 705, + CODE_FOR_tls_get_tp_mips16_di = 706, + CODE_FOR_mips_get_fcsr_mips16_si = 710, + CODE_FOR_mips_get_fcsr_mips16_di = 711, + CODE_FOR_mips_set_fcsr_mips16_si = 713, + CODE_FOR_mips_set_fcsr_mips16_di = 714, + CODE_FOR_sync_compare_and_swapsi = 722, + CODE_FOR_sync_compare_and_swapdi = 723, + CODE_FOR_compare_and_swap_12 = 724, + CODE_FOR_sync_addsi = 725, + CODE_FOR_sync_adddi = 726, + CODE_FOR_sync_add_12 = 727, + CODE_FOR_sync_sub_12 = 728, + CODE_FOR_sync_ior_12 = 729, + CODE_FOR_sync_xor_12 = 730, + CODE_FOR_sync_and_12 = 731, + CODE_FOR_sync_old_add_12 = 732, + CODE_FOR_sync_old_sub_12 = 733, + CODE_FOR_sync_old_ior_12 = 734, + CODE_FOR_sync_old_xor_12 = 735, + CODE_FOR_sync_old_and_12 = 736, + CODE_FOR_sync_new_add_12 = 737, + CODE_FOR_sync_new_sub_12 = 738, + CODE_FOR_sync_new_ior_12 = 739, + CODE_FOR_sync_new_xor_12 = 740, + CODE_FOR_sync_new_and_12 = 741, + CODE_FOR_sync_nand_12 = 742, + CODE_FOR_sync_old_nand_12 = 743, + CODE_FOR_sync_new_nand_12 = 744, + CODE_FOR_sync_subsi = 745, + CODE_FOR_sync_subdi = 746, + CODE_FOR_sync_old_addsi = 747, + CODE_FOR_sync_old_adddi = 748, + CODE_FOR_sync_old_subsi = 749, + CODE_FOR_sync_old_subdi = 750, + CODE_FOR_sync_new_addsi = 751, + CODE_FOR_sync_new_adddi = 752, + CODE_FOR_sync_new_subsi = 753, + CODE_FOR_sync_new_subdi = 754, + CODE_FOR_sync_iorsi = 755, + CODE_FOR_sync_xorsi = 756, + CODE_FOR_sync_andsi = 757, + CODE_FOR_sync_iordi = 758, + CODE_FOR_sync_xordi = 759, + CODE_FOR_sync_anddi = 760, + CODE_FOR_sync_old_iorsi = 761, + CODE_FOR_sync_old_xorsi = 762, + CODE_FOR_sync_old_andsi = 763, + CODE_FOR_sync_old_iordi = 764, + CODE_FOR_sync_old_xordi = 765, + CODE_FOR_sync_old_anddi = 766, + CODE_FOR_sync_new_iorsi = 767, + CODE_FOR_sync_new_xorsi = 768, + CODE_FOR_sync_new_andsi = 769, + CODE_FOR_sync_new_iordi = 770, + CODE_FOR_sync_new_xordi = 771, + CODE_FOR_sync_new_anddi = 772, + CODE_FOR_sync_nandsi = 773, + CODE_FOR_sync_nanddi = 774, + CODE_FOR_sync_old_nandsi = 775, + CODE_FOR_sync_old_nanddi = 776, + CODE_FOR_sync_new_nandsi = 777, + CODE_FOR_sync_new_nanddi = 778, + CODE_FOR_sync_lock_test_and_setsi = 779, + CODE_FOR_sync_lock_test_and_setdi = 780, + CODE_FOR_test_and_set_12 = 781, + CODE_FOR_atomic_compare_and_swapsi = 782, + CODE_FOR_atomic_compare_and_swapdi = 783, + CODE_FOR_atomic_exchangesi_llsc = 784, + CODE_FOR_atomic_exchangedi_llsc = 785, + CODE_FOR_atomic_exchangesi_swap = 786, + CODE_FOR_atomic_exchangedi_swap = 787, + CODE_FOR_atomic_fetch_addsi_llsc = 788, + CODE_FOR_atomic_fetch_adddi_llsc = 789, + CODE_FOR_atomic_fetch_addsi_ldadd = 790, + CODE_FOR_atomic_fetch_adddi_ldadd = 791, + CODE_FOR_mips_cond_move_tf_ps = 794, + CODE_FOR_vec_perm_const_ps = 795, + CODE_FOR_vec_concatv2sf = 796, + CODE_FOR_vec_extractv2sf = 797, + CODE_FOR_mips_alnv_ps = 798, + CODE_FOR_mips_addr_ps = 799, + CODE_FOR_mips_cvt_pw_ps = 800, + CODE_FOR_mips_cvt_ps_pw = 801, + CODE_FOR_mips_mulr_ps = 802, + CODE_FOR_mips_cabs_cond_s = 804, + CODE_FOR_mips_cabs_cond_d = 805, + CODE_FOR_mips_c_cond_4s = 806, + CODE_FOR_mips_cabs_cond_4s = 807, + CODE_FOR_mips_c_cond_ps = 808, + CODE_FOR_mips_cabs_cond_ps = 809, + CODE_FOR_sunordered_ps = 810, + CODE_FOR_suneq_ps = 811, + CODE_FOR_sunlt_ps = 812, + CODE_FOR_sunle_ps = 813, + CODE_FOR_seq_ps = 814, + CODE_FOR_slt_ps = 815, + CODE_FOR_sle_ps = 816, + CODE_FOR_sordered_ps = 817, + CODE_FOR_sltgt_ps = 818, + CODE_FOR_sne_ps = 819, + CODE_FOR_sge_ps = 820, + CODE_FOR_sgt_ps = 821, + CODE_FOR_sunge_ps = 822, + CODE_FOR_sungt_ps = 823, + CODE_FOR_bc1any4t = 824, + CODE_FOR_bc1any4f = 825, + CODE_FOR_bc1any2t = 826, + CODE_FOR_bc1any2f = 827, + CODE_FOR_mips_rsqrt1_s = 830, + CODE_FOR_mips_rsqrt1_d = 831, + CODE_FOR_mips_rsqrt1_ps = 832, + CODE_FOR_mips_rsqrt2_s = 833, + CODE_FOR_mips_rsqrt2_d = 834, + CODE_FOR_mips_rsqrt2_ps = 835, + CODE_FOR_mips_recip1_s = 836, + CODE_FOR_mips_recip1_d = 837, + CODE_FOR_mips_recip1_ps = 838, + CODE_FOR_mips_recip2_s = 839, + CODE_FOR_mips_recip2_d = 840, + CODE_FOR_mips_recip2_ps = 841, + CODE_FOR_addv2hi3 = 842, + CODE_FOR_addv4qi3 = 843, + CODE_FOR_mips_addq_s_w = 844, + CODE_FOR_mips_addq_s_ph = 845, + CODE_FOR_mips_addu_s_qb = 846, + CODE_FOR_subv2hi3 = 847, + CODE_FOR_subv4qi3 = 848, + CODE_FOR_mips_subq_s_w = 849, + CODE_FOR_mips_subq_s_ph = 850, + CODE_FOR_mips_subu_s_qb = 851, + CODE_FOR_mips_addsc = 852, + CODE_FOR_mips_addwc = 853, + CODE_FOR_mips_modsub = 854, + CODE_FOR_mips_raddu_w_qb = 855, + CODE_FOR_mips_absq_s_w = 856, + CODE_FOR_mips_absq_s_ph = 857, + CODE_FOR_mips_precrq_qb_ph = 858, + CODE_FOR_mips_precrq_ph_w = 859, + CODE_FOR_mips_precrq_rs_ph_w = 860, + CODE_FOR_mips_precrqu_s_qb_ph = 861, + CODE_FOR_mips_preceq_w_phl = 862, + CODE_FOR_mips_preceq_w_phr = 863, + CODE_FOR_mips_precequ_ph_qbl = 864, + CODE_FOR_mips_precequ_ph_qbr = 865, + CODE_FOR_mips_precequ_ph_qbla = 866, + CODE_FOR_mips_precequ_ph_qbra = 867, + CODE_FOR_mips_preceu_ph_qbl = 868, + CODE_FOR_mips_preceu_ph_qbr = 869, + CODE_FOR_mips_preceu_ph_qbla = 870, + CODE_FOR_mips_preceu_ph_qbra = 871, + CODE_FOR_mips_shll_ph = 872, + CODE_FOR_mips_shll_qb = 873, + CODE_FOR_mips_shll_s_w = 874, + CODE_FOR_mips_shll_s_ph = 875, + CODE_FOR_mips_shrl_qb = 876, + CODE_FOR_mips_shra_ph = 877, + CODE_FOR_mips_shra_r_w = 878, + CODE_FOR_mips_shra_r_ph = 879, + CODE_FOR_mips_muleu_s_ph_qbl = 880, + CODE_FOR_mips_muleu_s_ph_qbr = 881, + CODE_FOR_mips_mulq_rs_ph = 882, + CODE_FOR_mips_muleq_s_w_phl = 883, + CODE_FOR_mips_muleq_s_w_phr = 884, + CODE_FOR_mips_dpau_h_qbl = 885, + CODE_FOR_mips_dpau_h_qbr = 886, + CODE_FOR_mips_dpsu_h_qbl = 887, + CODE_FOR_mips_dpsu_h_qbr = 888, + CODE_FOR_mips_dpaq_s_w_ph = 889, + CODE_FOR_mips_dpsq_s_w_ph = 890, + CODE_FOR_mips_mulsaq_s_w_ph = 891, + CODE_FOR_mips_dpaq_sa_l_w = 892, + CODE_FOR_mips_dpsq_sa_l_w = 893, + CODE_FOR_mips_maq_s_w_phl = 894, + CODE_FOR_mips_maq_s_w_phr = 895, + CODE_FOR_mips_maq_sa_w_phl = 896, + CODE_FOR_mips_maq_sa_w_phr = 897, + CODE_FOR_mips_bitrev = 898, + CODE_FOR_mips_insv = 899, + CODE_FOR_mips_repl_qb = 900, + CODE_FOR_mips_repl_ph = 901, + CODE_FOR_mips_cmp_eq_ph = 902, + CODE_FOR_mips_cmpu_eq_qb = 903, + CODE_FOR_mips_cmp_lt_ph = 904, + CODE_FOR_mips_cmpu_lt_qb = 905, + CODE_FOR_mips_cmp_le_ph = 906, + CODE_FOR_mips_cmpu_le_qb = 907, + CODE_FOR_mips_cmpgu_eq_qb = 908, + CODE_FOR_mips_cmpgu_lt_qb = 909, + CODE_FOR_mips_cmpgu_le_qb = 910, + CODE_FOR_mips_pick_ph = 911, + CODE_FOR_mips_pick_qb = 912, + CODE_FOR_mips_packrl_ph = 913, + CODE_FOR_mips_extr_w = 914, + CODE_FOR_mips_extr_r_w = 915, + CODE_FOR_mips_extr_rs_w = 916, + CODE_FOR_mips_extr_s_h = 917, + CODE_FOR_mips_extp = 918, + CODE_FOR_mips_extpdp = 919, + CODE_FOR_mips_shilo = 920, + CODE_FOR_mips_mthlip = 921, + CODE_FOR_mips_wrdsp = 922, + CODE_FOR_mips_rddsp = 923, + CODE_FOR_mips_lbx_extsi_si = 924, + CODE_FOR_mips_lbux_extsi_si = 925, + CODE_FOR_mips_lbx_extdi_si = 926, + CODE_FOR_mips_lbux_extdi_si = 927, + CODE_FOR_mips_lhx_extsi_si = 928, + CODE_FOR_mips_lhux_extsi_si = 929, + CODE_FOR_mips_lhx_extdi_si = 930, + CODE_FOR_mips_lhux_extdi_si = 931, + CODE_FOR_mips_lbx_extsi_di = 932, + CODE_FOR_mips_lbux_extsi_di = 933, + CODE_FOR_mips_lbx_extdi_di = 934, + CODE_FOR_mips_lbux_extdi_di = 935, + CODE_FOR_mips_lhx_extsi_di = 936, + CODE_FOR_mips_lhux_extsi_di = 937, + CODE_FOR_mips_lhx_extdi_di = 938, + CODE_FOR_mips_lhux_extdi_di = 939, + CODE_FOR_mips_lwx_si = 940, + CODE_FOR_mips_ldx_si = 941, + CODE_FOR_mips_lwx_di = 942, + CODE_FOR_mips_ldx_di = 943, + CODE_FOR_mips_bposge = 948, + CODE_FOR_mips_absq_s_qb = 949, + CODE_FOR_mips_addu_ph = 950, + CODE_FOR_mips_addu_s_ph = 951, + CODE_FOR_mips_adduh_qb = 952, + CODE_FOR_mips_adduh_r_qb = 953, + CODE_FOR_mips_append = 954, + CODE_FOR_mips_balign = 955, + CODE_FOR_mips_cmpgdu_eq_qb = 956, + CODE_FOR_mips_cmpgdu_lt_qb = 957, + CODE_FOR_mips_cmpgdu_le_qb = 958, + CODE_FOR_mips_dpa_w_ph = 959, + CODE_FOR_mips_dps_w_ph = 960, + CODE_FOR_mulv2hi3 = 961, + CODE_FOR_mips_mul_s_ph = 962, + CODE_FOR_mips_mulq_rs_w = 963, + CODE_FOR_mips_mulq_s_ph = 964, + CODE_FOR_mips_mulq_s_w = 965, + CODE_FOR_mips_mulsa_w_ph = 966, + CODE_FOR_mips_precr_qb_ph = 967, + CODE_FOR_mips_precr_sra_ph_w = 968, + CODE_FOR_mips_precr_sra_r_ph_w = 969, + CODE_FOR_mips_prepend = 970, + CODE_FOR_mips_shra_qb = 971, + CODE_FOR_mips_shra_r_qb = 972, + CODE_FOR_mips_shrl_ph = 973, + CODE_FOR_mips_subu_ph = 974, + CODE_FOR_mips_subu_s_ph = 975, + CODE_FOR_mips_subuh_qb = 976, + CODE_FOR_mips_subuh_r_qb = 977, + CODE_FOR_mips_addqh_ph = 978, + CODE_FOR_mips_addqh_r_ph = 979, + CODE_FOR_mips_addqh_w = 980, + CODE_FOR_mips_addqh_r_w = 981, + CODE_FOR_mips_subqh_ph = 982, + CODE_FOR_mips_subqh_r_ph = 983, + CODE_FOR_mips_subqh_w = 984, + CODE_FOR_mips_subqh_r_w = 985, + CODE_FOR_mips_dpax_w_ph = 986, + CODE_FOR_mips_dpsx_w_ph = 987, + CODE_FOR_mips_dpaqx_s_w_ph = 988, + CODE_FOR_mips_dpaqx_sa_w_ph = 989, + CODE_FOR_mips_dpsqx_s_w_ph = 990, + CODE_FOR_mips_dpsqx_sa_w_ph = 991, + CODE_FOR_addqq3 = 992, + CODE_FOR_addhq3 = 993, + CODE_FOR_addsq3 = 994, + CODE_FOR_adddq3 = 995, + CODE_FOR_adduqq3 = 996, + CODE_FOR_adduhq3 = 997, + CODE_FOR_addusq3 = 998, + CODE_FOR_addudq3 = 999, + CODE_FOR_addha3 = 1000, + CODE_FOR_addsa3 = 1001, + CODE_FOR_addda3 = 1002, + CODE_FOR_adduha3 = 1003, + CODE_FOR_addusa3 = 1004, + CODE_FOR_adduda3 = 1005, + CODE_FOR_usadduqq3 = 1006, + CODE_FOR_usadduhq3 = 1007, + CODE_FOR_usadduha3 = 1008, + CODE_FOR_usaddv4uqq3 = 1009, + CODE_FOR_usaddv2uhq3 = 1010, + CODE_FOR_usaddv2uha3 = 1011, + CODE_FOR_ssaddhq3 = 1012, + CODE_FOR_ssaddsq3 = 1013, + CODE_FOR_ssaddha3 = 1014, + CODE_FOR_ssaddsa3 = 1015, + CODE_FOR_ssaddv2hq3 = 1016, + CODE_FOR_ssaddv2ha3 = 1017, + CODE_FOR_subqq3 = 1018, + CODE_FOR_subhq3 = 1019, + CODE_FOR_subsq3 = 1020, + CODE_FOR_subdq3 = 1021, + CODE_FOR_subuqq3 = 1022, + CODE_FOR_subuhq3 = 1023, + CODE_FOR_subusq3 = 1024, + CODE_FOR_subudq3 = 1025, + CODE_FOR_subha3 = 1026, + CODE_FOR_subsa3 = 1027, + CODE_FOR_subda3 = 1028, + CODE_FOR_subuha3 = 1029, + CODE_FOR_subusa3 = 1030, + CODE_FOR_subuda3 = 1031, + CODE_FOR_ussubuqq3 = 1032, + CODE_FOR_ussubuhq3 = 1033, + CODE_FOR_ussubuha3 = 1034, + CODE_FOR_ussubv4uqq3 = 1035, + CODE_FOR_ussubv2uhq3 = 1036, + CODE_FOR_ussubv2uha3 = 1037, + CODE_FOR_sssubhq3 = 1038, + CODE_FOR_sssubsq3 = 1039, + CODE_FOR_sssubha3 = 1040, + CODE_FOR_sssubsa3 = 1041, + CODE_FOR_sssubv2hq3 = 1042, + CODE_FOR_sssubv2ha3 = 1043, + CODE_FOR_ssmulv2hq3 = 1044, + CODE_FOR_ssmulhq3 = 1045, + CODE_FOR_ssmulsq3 = 1046, + CODE_FOR_ssmaddsqdq4 = 1047, + CODE_FOR_ssmsubsqdq4 = 1048, + CODE_FOR_jraddiusp = 1053, + CODE_FOR_movv2si_internal = 1058, + CODE_FOR_movv4hi_internal = 1059, + CODE_FOR_movv8qi_internal = 1060, + CODE_FOR_loongson_vec_init1_v4hi = 1061, + CODE_FOR_loongson_vec_init1_v8qi = 1062, + CODE_FOR_vec_pack_ssat_v2si = 1064, + CODE_FOR_vec_pack_ssat_v4hi = 1065, + CODE_FOR_vec_pack_usat_v4hi = 1066, + CODE_FOR_addv2si3 = 1067, + CODE_FOR_addv4hi3 = 1068, + CODE_FOR_addv8qi3 = 1069, + CODE_FOR_loongson_paddd = 1070, + CODE_FOR_ssaddv4hi3 = 1071, + CODE_FOR_ssaddv8qi3 = 1072, + CODE_FOR_usaddv4hi3 = 1073, + CODE_FOR_usaddv8qi3 = 1074, + CODE_FOR_loongson_pandn_w = 1075, + CODE_FOR_loongson_pandn_h = 1076, + CODE_FOR_loongson_pandn_b = 1077, + CODE_FOR_loongson_pandn_d = 1078, + CODE_FOR_andv2si3 = 1079, + CODE_FOR_andv4hi3 = 1080, + CODE_FOR_andv8qi3 = 1081, + CODE_FOR_iorv2si3 = 1082, + CODE_FOR_iorv4hi3 = 1083, + CODE_FOR_iorv8qi3 = 1084, + CODE_FOR_xorv2si3 = 1085, + CODE_FOR_xorv4hi3 = 1086, + CODE_FOR_xorv8qi3 = 1087, + CODE_FOR_one_cmplv2si2 = 1091, + CODE_FOR_one_cmplv4hi2 = 1092, + CODE_FOR_one_cmplv8qi2 = 1093, + CODE_FOR_loongson_pavgh = 1094, + CODE_FOR_loongson_pavgb = 1095, + CODE_FOR_loongson_pcmpeqw = 1096, + CODE_FOR_loongson_pcmpeqh = 1097, + CODE_FOR_loongson_pcmpeqb = 1098, + CODE_FOR_loongson_pcmpgtw = 1099, + CODE_FOR_loongson_pcmpgth = 1100, + CODE_FOR_loongson_pcmpgtb = 1101, + CODE_FOR_loongson_pextrh = 1102, + CODE_FOR_loongson_pinsrh_0 = 1103, + CODE_FOR_loongson_pinsrh_1 = 1104, + CODE_FOR_loongson_pinsrh_2 = 1105, + CODE_FOR_loongson_pinsrh_3 = 1106, + CODE_FOR_loongson_pmaddhw = 1108, + CODE_FOR_smaxv4hi3 = 1109, + CODE_FOR_umaxv8qi3 = 1110, + CODE_FOR_sminv4hi3 = 1111, + CODE_FOR_uminv8qi3 = 1112, + CODE_FOR_loongson_pmovmskb = 1113, + CODE_FOR_umulv4hi3_highpart = 1114, + CODE_FOR_smulv4hi3_highpart = 1115, + CODE_FOR_mulv4hi3 = 1116, + CODE_FOR_loongson_pmuluw = 1117, + CODE_FOR_loongson_pasubub = 1118, + CODE_FOR_loongson_biadd = 1119, + CODE_FOR_reduc_uplus_v8qi = 1120, + CODE_FOR_loongson_psadbh = 1121, + CODE_FOR_loongson_pshufh = 1122, + CODE_FOR_ashlv2si3 = 1123, + CODE_FOR_ashlv4hi3 = 1124, + CODE_FOR_ashrv2si3 = 1125, + CODE_FOR_ashrv4hi3 = 1126, + CODE_FOR_lshrv2si3 = 1127, + CODE_FOR_lshrv4hi3 = 1128, + CODE_FOR_subv2si3 = 1129, + CODE_FOR_subv4hi3 = 1130, + CODE_FOR_subv8qi3 = 1131, + CODE_FOR_loongson_psubd = 1132, + CODE_FOR_sssubv4hi3 = 1133, + CODE_FOR_sssubv8qi3 = 1134, + CODE_FOR_ussubv4hi3 = 1135, + CODE_FOR_ussubv8qi3 = 1136, + CODE_FOR_loongson_punpckhbh = 1137, + CODE_FOR_loongson_punpckhhw = 1138, + CODE_FOR_loongson_punpckhhw_qi = 1139, + CODE_FOR_loongson_punpckhwd = 1140, + CODE_FOR_loongson_punpckhwd_qi = 1141, + CODE_FOR_loongson_punpckhwd_hi = 1142, + CODE_FOR_loongson_punpcklbh = 1143, + CODE_FOR_loongson_punpcklhw = 1144, + CODE_FOR_loongson_punpcklwd = 1146, + CODE_FOR_vec_shl_v2si = 1149, + CODE_FOR_vec_shl_v4hi = 1150, + CODE_FOR_vec_shl_v8qi = 1151, + CODE_FOR_vec_shl_di = 1152, + CODE_FOR_vec_shr_v2si = 1153, + CODE_FOR_vec_shr_v4hi = 1154, + CODE_FOR_vec_shr_v8qi = 1155, + CODE_FOR_vec_shr_di = 1156, + CODE_FOR_vec_loongson_extract_lo_v2si = 1157, + CODE_FOR_vec_loongson_extract_lo_v4hi = 1158, + CODE_FOR_vec_loongson_extract_lo_v8qi = 1159, + CODE_FOR_vec_pack_trunc_v2di = 1160, + CODE_FOR_vec_pack_trunc_v4si = 1161, + CODE_FOR_vec_pack_trunc_v8hi = 1162, + CODE_FOR_msa_vec_extract_d_f = 1163, + CODE_FOR_msa_vec_extract_w_f = 1164, + CODE_FOR_msa_insert_d_f = 1165, + CODE_FOR_msa_insert_w_f = 1166, + CODE_FOR_msa_insert_d = 1167, + CODE_FOR_msa_insert_w = 1168, + CODE_FOR_msa_insert_h = 1169, + CODE_FOR_msa_insert_b = 1170, + CODE_FOR_msa_insve_d_f = 1171, + CODE_FOR_msa_insve_w_f = 1172, + CODE_FOR_msa_insve_d = 1173, + CODE_FOR_msa_insve_w = 1174, + CODE_FOR_msa_insve_h = 1175, + CODE_FOR_msa_insve_b = 1176, + CODE_FOR_msa_insve_d_f_scalar = 1177, + CODE_FOR_msa_insve_w_f_scalar = 1178, + CODE_FOR_msa_copy_s_h = 1179, + CODE_FOR_msa_copy_u_h = 1180, + CODE_FOR_msa_copy_s_b = 1181, + CODE_FOR_msa_copy_u_b = 1182, + CODE_FOR_msa_copy_u_w = 1183, + CODE_FOR_msa_copy_s_w_64bit = 1184, + CODE_FOR_msa_copy_s_w_f_64bit = 1185, + CODE_FOR_msa_copy_s_w = 1186, + CODE_FOR_msa_copy_s_w_f = 1187, + CODE_FOR_msa_copy_s_d = 1188, + CODE_FOR_msa_copy_s_d_f = 1189, + CODE_FOR_vec_permv2df = 1190, + CODE_FOR_vec_permv4sf = 1191, + CODE_FOR_vec_permv2di = 1192, + CODE_FOR_vec_permv4si = 1193, + CODE_FOR_vec_permv8hi = 1194, + CODE_FOR_vec_permv16qi = 1195, + CODE_FOR_movv2df_msa = 1196, + CODE_FOR_movv4sf_msa = 1197, + CODE_FOR_movv2di_msa = 1198, + CODE_FOR_movv4si_msa = 1199, + CODE_FOR_movv8hi_msa = 1200, + CODE_FOR_movv16qi_msa = 1201, + CODE_FOR_addv2di3 = 1202, + CODE_FOR_addv4si3 = 1203, + CODE_FOR_addv8hi3 = 1204, + CODE_FOR_addv16qi3 = 1205, + CODE_FOR_subv2di3 = 1206, + CODE_FOR_subv4si3 = 1207, + CODE_FOR_subv8hi3 = 1208, + CODE_FOR_subv16qi3 = 1209, + CODE_FOR_mulv2di3 = 1210, + CODE_FOR_mulv4si3 = 1211, + CODE_FOR_mulv8hi3 = 1212, + CODE_FOR_mulv16qi3 = 1213, + CODE_FOR_msa_maddv_d = 1214, + CODE_FOR_msa_maddv_w = 1215, + CODE_FOR_msa_maddv_h = 1216, + CODE_FOR_msa_maddv_b = 1217, + CODE_FOR_msa_msubv_d = 1218, + CODE_FOR_msa_msubv_w = 1219, + CODE_FOR_msa_msubv_h = 1220, + CODE_FOR_msa_msubv_b = 1221, + CODE_FOR_divv2di3 = 1222, + CODE_FOR_divv4si3 = 1223, + CODE_FOR_divv8hi3 = 1224, + CODE_FOR_divv16qi3 = 1225, + CODE_FOR_udivv2di3 = 1226, + CODE_FOR_udivv4si3 = 1227, + CODE_FOR_udivv8hi3 = 1228, + CODE_FOR_udivv16qi3 = 1229, + CODE_FOR_modv2di3 = 1230, + CODE_FOR_modv4si3 = 1231, + CODE_FOR_modv8hi3 = 1232, + CODE_FOR_modv16qi3 = 1233, + CODE_FOR_umodv2di3 = 1234, + CODE_FOR_umodv4si3 = 1235, + CODE_FOR_umodv8hi3 = 1236, + CODE_FOR_umodv16qi3 = 1237, + CODE_FOR_xorv2di3 = 1238, + CODE_FOR_xorv4si3 = 1239, + CODE_FOR_xorv8hi3 = 1240, + CODE_FOR_xorv16qi3 = 1241, + CODE_FOR_iorv2di3 = 1242, + CODE_FOR_iorv4si3 = 1243, + CODE_FOR_iorv8hi3 = 1244, + CODE_FOR_iorv16qi3 = 1245, + CODE_FOR_andv2di3 = 1246, + CODE_FOR_andv4si3 = 1247, + CODE_FOR_andv8hi3 = 1248, + CODE_FOR_andv16qi3 = 1249, + CODE_FOR_one_cmplv2di2 = 1250, + CODE_FOR_one_cmplv4si2 = 1251, + CODE_FOR_one_cmplv8hi2 = 1252, + CODE_FOR_one_cmplv16qi2 = 1253, + CODE_FOR_vlshrv2di3 = 1254, + CODE_FOR_vlshrv4si3 = 1255, + CODE_FOR_vlshrv8hi3 = 1256, + CODE_FOR_vlshrv16qi3 = 1257, + CODE_FOR_vashrv2di3 = 1258, + CODE_FOR_vashrv4si3 = 1259, + CODE_FOR_vashrv8hi3 = 1260, + CODE_FOR_vashrv16qi3 = 1261, + CODE_FOR_vashlv2di3 = 1262, + CODE_FOR_vashlv4si3 = 1263, + CODE_FOR_vashlv8hi3 = 1264, + CODE_FOR_vashlv16qi3 = 1265, + CODE_FOR_addv2df3 = 1266, + CODE_FOR_addv4sf3 = 1267, + CODE_FOR_subv2df3 = 1268, + CODE_FOR_subv4sf3 = 1269, + CODE_FOR_mulv2df3 = 1270, + CODE_FOR_mulv4sf3 = 1271, + CODE_FOR_divv2df3 = 1272, + CODE_FOR_divv4sf3 = 1273, + CODE_FOR_fmav2df4 = 1274, + CODE_FOR_fmav4sf4 = 1275, + CODE_FOR_fnmav2df4 = 1276, + CODE_FOR_fnmav4sf4 = 1277, + CODE_FOR_sqrtv2df2 = 1278, + CODE_FOR_sqrtv4sf2 = 1279, + CODE_FOR_msa_add_a_d = 1280, + CODE_FOR_msa_add_a_w = 1281, + CODE_FOR_msa_add_a_h = 1282, + CODE_FOR_msa_add_a_b = 1283, + CODE_FOR_msa_adds_a_d = 1284, + CODE_FOR_msa_adds_a_w = 1285, + CODE_FOR_msa_adds_a_h = 1286, + CODE_FOR_msa_adds_a_b = 1287, + CODE_FOR_ssaddv2di3 = 1288, + CODE_FOR_ssaddv4si3 = 1289, + CODE_FOR_ssaddv8hi3 = 1290, + CODE_FOR_ssaddv16qi3 = 1291, + CODE_FOR_usaddv2di3 = 1292, + CODE_FOR_usaddv4si3 = 1293, + CODE_FOR_usaddv8hi3 = 1294, + CODE_FOR_usaddv16qi3 = 1295, + CODE_FOR_msa_asub_s_d = 1296, + CODE_FOR_msa_asub_s_w = 1297, + CODE_FOR_msa_asub_s_h = 1298, + CODE_FOR_msa_asub_s_b = 1299, + CODE_FOR_msa_asub_u_d = 1300, + CODE_FOR_msa_asub_u_w = 1301, + CODE_FOR_msa_asub_u_h = 1302, + CODE_FOR_msa_asub_u_b = 1303, + CODE_FOR_msa_ave_s_d = 1304, + CODE_FOR_msa_ave_s_w = 1305, + CODE_FOR_msa_ave_s_h = 1306, + CODE_FOR_msa_ave_s_b = 1307, + CODE_FOR_msa_ave_u_d = 1308, + CODE_FOR_msa_ave_u_w = 1309, + CODE_FOR_msa_ave_u_h = 1310, + CODE_FOR_msa_ave_u_b = 1311, + CODE_FOR_msa_aver_s_d = 1312, + CODE_FOR_msa_aver_s_w = 1313, + CODE_FOR_msa_aver_s_h = 1314, + CODE_FOR_msa_aver_s_b = 1315, + CODE_FOR_msa_aver_u_d = 1316, + CODE_FOR_msa_aver_u_w = 1317, + CODE_FOR_msa_aver_u_h = 1318, + CODE_FOR_msa_aver_u_b = 1319, + CODE_FOR_msa_bclr_d = 1320, + CODE_FOR_msa_bclr_w = 1321, + CODE_FOR_msa_bclr_h = 1322, + CODE_FOR_msa_bclr_b = 1323, + CODE_FOR_msa_bclri_d = 1324, + CODE_FOR_msa_bclri_w = 1325, + CODE_FOR_msa_bclri_h = 1326, + CODE_FOR_msa_bclri_b = 1327, + CODE_FOR_msa_binsl_d = 1328, + CODE_FOR_msa_binsl_w = 1329, + CODE_FOR_msa_binsl_h = 1330, + CODE_FOR_msa_binsl_b = 1331, + CODE_FOR_msa_binsli_d = 1332, + CODE_FOR_msa_binsli_w = 1333, + CODE_FOR_msa_binsli_h = 1334, + CODE_FOR_msa_binsli_b = 1335, + CODE_FOR_msa_binsr_d = 1336, + CODE_FOR_msa_binsr_w = 1337, + CODE_FOR_msa_binsr_h = 1338, + CODE_FOR_msa_binsr_b = 1339, + CODE_FOR_msa_binsri_d = 1340, + CODE_FOR_msa_binsri_w = 1341, + CODE_FOR_msa_binsri_h = 1342, + CODE_FOR_msa_binsri_b = 1343, + CODE_FOR_msa_bmnz_d = 1344, + CODE_FOR_msa_bmnz_w = 1345, + CODE_FOR_msa_bmnz_h = 1346, + CODE_FOR_msa_bmnz_b = 1347, + CODE_FOR_msa_bmz_d = 1348, + CODE_FOR_msa_bmz_w = 1349, + CODE_FOR_msa_bmz_h = 1350, + CODE_FOR_msa_bmz_b = 1351, + CODE_FOR_msa_bneg_d = 1352, + CODE_FOR_msa_bneg_w = 1353, + CODE_FOR_msa_bneg_h = 1354, + CODE_FOR_msa_bneg_b = 1355, + CODE_FOR_msa_bnegi_d = 1356, + CODE_FOR_msa_bnegi_w = 1357, + CODE_FOR_msa_bnegi_h = 1358, + CODE_FOR_msa_bnegi_b = 1359, + CODE_FOR_msa_bsel_d = 1360, + CODE_FOR_msa_bsel_w = 1361, + CODE_FOR_msa_bsel_h = 1362, + CODE_FOR_msa_bsel_b = 1363, + CODE_FOR_msa_bset_d = 1364, + CODE_FOR_msa_bset_w = 1365, + CODE_FOR_msa_bset_h = 1366, + CODE_FOR_msa_bset_b = 1367, + CODE_FOR_msa_bseti_d = 1368, + CODE_FOR_msa_bseti_w = 1369, + CODE_FOR_msa_bseti_h = 1370, + CODE_FOR_msa_bseti_b = 1371, + CODE_FOR_msa_ceq_d = 1372, + CODE_FOR_msa_cle_s_d = 1373, + CODE_FOR_msa_cle_u_d = 1374, + CODE_FOR_msa_clt_s_d = 1375, + CODE_FOR_msa_clt_u_d = 1376, + CODE_FOR_msa_ceq_w = 1377, + CODE_FOR_msa_cle_s_w = 1378, + CODE_FOR_msa_cle_u_w = 1379, + CODE_FOR_msa_clt_s_w = 1380, + CODE_FOR_msa_clt_u_w = 1381, + CODE_FOR_msa_ceq_h = 1382, + CODE_FOR_msa_cle_s_h = 1383, + CODE_FOR_msa_cle_u_h = 1384, + CODE_FOR_msa_clt_s_h = 1385, + CODE_FOR_msa_clt_u_h = 1386, + CODE_FOR_msa_ceq_b = 1387, + CODE_FOR_msa_cle_s_b = 1388, + CODE_FOR_msa_cle_u_b = 1389, + CODE_FOR_msa_clt_s_b = 1390, + CODE_FOR_msa_clt_u_b = 1391, + CODE_FOR_msa_dotp_s_d = 1392, + CODE_FOR_msa_dotp_u_d = 1393, + CODE_FOR_msa_dotp_s_w = 1394, + CODE_FOR_msa_dotp_u_w = 1395, + CODE_FOR_msa_dotp_s_h = 1396, + CODE_FOR_msa_dotp_u_h = 1397, + CODE_FOR_msa_dpadd_s_d = 1398, + CODE_FOR_msa_dpadd_u_d = 1399, + CODE_FOR_msa_dpadd_s_w = 1400, + CODE_FOR_msa_dpadd_u_w = 1401, + CODE_FOR_msa_dpadd_s_h = 1402, + CODE_FOR_msa_dpadd_u_h = 1403, + CODE_FOR_msa_dpsub_s_d = 1404, + CODE_FOR_msa_dpsub_u_d = 1405, + CODE_FOR_msa_dpsub_s_w = 1406, + CODE_FOR_msa_dpsub_u_w = 1407, + CODE_FOR_msa_dpsub_s_h = 1408, + CODE_FOR_msa_dpsub_u_h = 1409, + CODE_FOR_msa_fclass_d = 1410, + CODE_FOR_msa_fclass_w = 1411, + CODE_FOR_msa_fcaf_d = 1412, + CODE_FOR_msa_fcaf_w = 1413, + CODE_FOR_msa_fcune_d = 1414, + CODE_FOR_msa_fcune_w = 1415, + CODE_FOR_msa_fcun_d = 1416, + CODE_FOR_msa_fcor_d = 1417, + CODE_FOR_msa_fceq_d = 1418, + CODE_FOR_msa_fcne_d = 1419, + CODE_FOR_msa_fcle_d = 1420, + CODE_FOR_msa_fclt_d = 1421, + CODE_FOR_msa_fcueq_d = 1422, + CODE_FOR_msa_fcule_d = 1423, + CODE_FOR_msa_fcult_d = 1424, + CODE_FOR_msa_fcun_w = 1425, + CODE_FOR_msa_fcor_w = 1426, + CODE_FOR_msa_fceq_w = 1427, + CODE_FOR_msa_fcne_w = 1428, + CODE_FOR_msa_fcle_w = 1429, + CODE_FOR_msa_fclt_w = 1430, + CODE_FOR_msa_fcueq_w = 1431, + CODE_FOR_msa_fcule_w = 1432, + CODE_FOR_msa_fcult_w = 1433, + CODE_FOR_msa_fsaf_d = 1434, + CODE_FOR_msa_fsun_d = 1435, + CODE_FOR_msa_fsor_d = 1436, + CODE_FOR_msa_fseq_d = 1437, + CODE_FOR_msa_fsne_d = 1438, + CODE_FOR_msa_fsueq_d = 1439, + CODE_FOR_msa_fsune_d = 1440, + CODE_FOR_msa_fsule_d = 1441, + CODE_FOR_msa_fsult_d = 1442, + CODE_FOR_msa_fsle_d = 1443, + CODE_FOR_msa_fslt_d = 1444, + CODE_FOR_msa_fsaf_w = 1445, + CODE_FOR_msa_fsun_w = 1446, + CODE_FOR_msa_fsor_w = 1447, + CODE_FOR_msa_fseq_w = 1448, + CODE_FOR_msa_fsne_w = 1449, + CODE_FOR_msa_fsueq_w = 1450, + CODE_FOR_msa_fsune_w = 1451, + CODE_FOR_msa_fsule_w = 1452, + CODE_FOR_msa_fsult_w = 1453, + CODE_FOR_msa_fsle_w = 1454, + CODE_FOR_msa_fslt_w = 1455, + CODE_FOR_msa_fexp2_d = 1456, + CODE_FOR_msa_fexp2_w = 1457, + CODE_FOR_floatv2div2df2 = 1458, + CODE_FOR_floatv4siv4sf2 = 1459, + CODE_FOR_floatunsv2div2df2 = 1460, + CODE_FOR_floatunsv4siv4sf2 = 1461, + CODE_FOR_msa_ffql_d = 1462, + CODE_FOR_msa_ffql_w = 1463, + CODE_FOR_msa_ffqr_d = 1464, + CODE_FOR_msa_ffqr_w = 1465, + CODE_FOR_msa_fill_d_f = 1466, + CODE_FOR_msa_fill_w_f = 1467, + CODE_FOR_msa_fill_d = 1468, + CODE_FOR_msa_fill_w = 1469, + CODE_FOR_msa_fill_h = 1470, + CODE_FOR_msa_fill_b = 1471, + CODE_FOR_msa_flog2_d = 1472, + CODE_FOR_msa_flog2_w = 1473, + CODE_FOR_smaxv2df3 = 1474, + CODE_FOR_smaxv4sf3 = 1475, + CODE_FOR_msa_fmax_a_d = 1476, + CODE_FOR_msa_fmax_a_w = 1477, + CODE_FOR_sminv2df3 = 1478, + CODE_FOR_sminv4sf3 = 1479, + CODE_FOR_msa_fmin_a_d = 1480, + CODE_FOR_msa_fmin_a_w = 1481, + CODE_FOR_msa_frcp_d = 1482, + CODE_FOR_msa_frcp_w = 1483, + CODE_FOR_msa_frint_d = 1484, + CODE_FOR_msa_frint_w = 1485, + CODE_FOR_msa_frsqrt_d = 1486, + CODE_FOR_msa_frsqrt_w = 1487, + CODE_FOR_msa_ftint_s_d = 1488, + CODE_FOR_msa_ftint_s_w = 1489, + CODE_FOR_msa_ftint_u_d = 1490, + CODE_FOR_msa_ftint_u_w = 1491, + CODE_FOR_fix_truncv2dfv2di2 = 1492, + CODE_FOR_fix_truncv4sfv4si2 = 1493, + CODE_FOR_fixuns_truncv2dfv2di2 = 1494, + CODE_FOR_fixuns_truncv4sfv4si2 = 1495, + CODE_FOR_msa_ftq_h = 1496, + CODE_FOR_msa_ftq_w = 1497, + CODE_FOR_msa_hadd_s_h = 1498, + CODE_FOR_msa_hadd_u_h = 1499, + CODE_FOR_msa_hsub_s_h = 1500, + CODE_FOR_msa_hsub_u_h = 1501, + CODE_FOR_msa_hadd_s_w = 1502, + CODE_FOR_msa_hadd_u_w = 1503, + CODE_FOR_msa_hsub_s_w = 1504, + CODE_FOR_msa_hsub_u_w = 1505, + CODE_FOR_msa_hadd_s_d = 1506, + CODE_FOR_msa_hadd_u_d = 1507, + CODE_FOR_msa_hsub_s_d = 1508, + CODE_FOR_msa_hsub_u_d = 1509, + CODE_FOR_msa_ilvev_b = 1510, + CODE_FOR_msa_ilvev_h = 1511, + CODE_FOR_msa_ilvev_w = 1512, + CODE_FOR_msa_ilvev_w_f = 1513, + CODE_FOR_msa_ilvl_b = 1514, + CODE_FOR_msa_ilvl_h = 1515, + CODE_FOR_msa_ilvl_w = 1516, + CODE_FOR_msa_ilvl_w_f = 1517, + CODE_FOR_msa_ilvl_d = 1518, + CODE_FOR_msa_ilvl_d_f = 1519, + CODE_FOR_msa_ilvod_b = 1520, + CODE_FOR_msa_ilvod_h = 1521, + CODE_FOR_msa_ilvod_w = 1522, + CODE_FOR_msa_ilvod_w_f = 1523, + CODE_FOR_msa_ilvr_b = 1524, + CODE_FOR_msa_ilvr_h = 1525, + CODE_FOR_msa_ilvr_w = 1526, + CODE_FOR_msa_ilvr_w_f = 1527, + CODE_FOR_msa_ilvr_d = 1528, + CODE_FOR_msa_ilvr_d_f = 1529, + CODE_FOR_msa_madd_q_w = 1530, + CODE_FOR_msa_madd_q_h = 1531, + CODE_FOR_msa_maddr_q_w = 1532, + CODE_FOR_msa_maddr_q_h = 1533, + CODE_FOR_msa_max_a_d = 1534, + CODE_FOR_msa_max_a_w = 1535, + CODE_FOR_msa_max_a_h = 1536, + CODE_FOR_msa_max_a_b = 1537, + CODE_FOR_smaxv2di3 = 1538, + CODE_FOR_smaxv4si3 = 1539, + CODE_FOR_smaxv8hi3 = 1540, + CODE_FOR_smaxv16qi3 = 1541, + CODE_FOR_umaxv2di3 = 1542, + CODE_FOR_umaxv4si3 = 1543, + CODE_FOR_umaxv8hi3 = 1544, + CODE_FOR_umaxv16qi3 = 1545, + CODE_FOR_msa_min_a_d = 1546, + CODE_FOR_msa_min_a_w = 1547, + CODE_FOR_msa_min_a_h = 1548, + CODE_FOR_msa_min_a_b = 1549, + CODE_FOR_sminv2di3 = 1550, + CODE_FOR_sminv4si3 = 1551, + CODE_FOR_sminv8hi3 = 1552, + CODE_FOR_sminv16qi3 = 1553, + CODE_FOR_uminv2di3 = 1554, + CODE_FOR_uminv4si3 = 1555, + CODE_FOR_uminv8hi3 = 1556, + CODE_FOR_uminv16qi3 = 1557, + CODE_FOR_msa_msub_q_w = 1558, + CODE_FOR_msa_msub_q_h = 1559, + CODE_FOR_msa_msubr_q_w = 1560, + CODE_FOR_msa_msubr_q_h = 1561, + CODE_FOR_msa_mul_q_w = 1562, + CODE_FOR_msa_mul_q_h = 1563, + CODE_FOR_msa_mulr_q_w = 1564, + CODE_FOR_msa_mulr_q_h = 1565, + CODE_FOR_msa_nloc_d = 1566, + CODE_FOR_msa_nloc_w = 1567, + CODE_FOR_msa_nloc_h = 1568, + CODE_FOR_msa_nloc_b = 1569, + CODE_FOR_clzv2di2 = 1570, + CODE_FOR_clzv4si2 = 1571, + CODE_FOR_clzv8hi2 = 1572, + CODE_FOR_clzv16qi2 = 1573, + CODE_FOR_msa_nor_d = 1574, + CODE_FOR_msa_nor_w = 1575, + CODE_FOR_msa_nor_h = 1576, + CODE_FOR_msa_nor_b = 1577, + CODE_FOR_msa_pckev_b = 1578, + CODE_FOR_msa_pckev_h = 1579, + CODE_FOR_msa_pckev_w = 1580, + CODE_FOR_msa_pckev_w_f = 1581, + CODE_FOR_msa_pckod_b = 1582, + CODE_FOR_msa_pckod_h = 1583, + CODE_FOR_msa_pckod_w = 1584, + CODE_FOR_msa_pckod_w_f = 1585, + CODE_FOR_popcountv2di2 = 1586, + CODE_FOR_popcountv4si2 = 1587, + CODE_FOR_popcountv8hi2 = 1588, + CODE_FOR_popcountv16qi2 = 1589, + CODE_FOR_msa_sat_s_d = 1590, + CODE_FOR_msa_sat_s_w = 1591, + CODE_FOR_msa_sat_s_h = 1592, + CODE_FOR_msa_sat_s_b = 1593, + CODE_FOR_msa_sat_u_d = 1594, + CODE_FOR_msa_sat_u_w = 1595, + CODE_FOR_msa_sat_u_h = 1596, + CODE_FOR_msa_sat_u_b = 1597, + CODE_FOR_msa_shf_w = 1598, + CODE_FOR_msa_shf_h = 1599, + CODE_FOR_msa_shf_b = 1600, + CODE_FOR_msa_shf_w_f = 1601, + CODE_FOR_msa_srar_d = 1602, + CODE_FOR_msa_srar_w = 1603, + CODE_FOR_msa_srar_h = 1604, + CODE_FOR_msa_srar_b = 1605, + CODE_FOR_msa_srari_d = 1606, + CODE_FOR_msa_srari_w = 1607, + CODE_FOR_msa_srari_h = 1608, + CODE_FOR_msa_srari_b = 1609, + CODE_FOR_msa_srlr_d = 1610, + CODE_FOR_msa_srlr_w = 1611, + CODE_FOR_msa_srlr_h = 1612, + CODE_FOR_msa_srlr_b = 1613, + CODE_FOR_msa_srlri_d = 1614, + CODE_FOR_msa_srlri_w = 1615, + CODE_FOR_msa_srlri_h = 1616, + CODE_FOR_msa_srlri_b = 1617, + CODE_FOR_msa_subs_s_d = 1618, + CODE_FOR_msa_subs_s_w = 1619, + CODE_FOR_msa_subs_s_h = 1620, + CODE_FOR_msa_subs_s_b = 1621, + CODE_FOR_msa_subs_u_d = 1622, + CODE_FOR_msa_subs_u_w = 1623, + CODE_FOR_msa_subs_u_h = 1624, + CODE_FOR_msa_subs_u_b = 1625, + CODE_FOR_msa_subsuu_s_d = 1626, + CODE_FOR_msa_subsuu_s_w = 1627, + CODE_FOR_msa_subsuu_s_h = 1628, + CODE_FOR_msa_subsuu_s_b = 1629, + CODE_FOR_msa_subsus_u_d = 1630, + CODE_FOR_msa_subsus_u_w = 1631, + CODE_FOR_msa_subsus_u_h = 1632, + CODE_FOR_msa_subsus_u_b = 1633, + CODE_FOR_msa_sld_d_f = 1634, + CODE_FOR_msa_sld_w_f = 1635, + CODE_FOR_msa_sld_d = 1636, + CODE_FOR_msa_sld_w = 1637, + CODE_FOR_msa_sld_h = 1638, + CODE_FOR_msa_sld_b = 1639, + CODE_FOR_msa_sldi_d_f = 1640, + CODE_FOR_msa_sldi_w_f = 1641, + CODE_FOR_msa_sldi_d = 1642, + CODE_FOR_msa_sldi_w = 1643, + CODE_FOR_msa_sldi_h = 1644, + CODE_FOR_msa_sldi_b = 1645, + CODE_FOR_msa_splat_d_f = 1646, + CODE_FOR_msa_splat_w_f = 1647, + CODE_FOR_msa_splat_d = 1648, + CODE_FOR_msa_splat_w = 1649, + CODE_FOR_msa_splat_h = 1650, + CODE_FOR_msa_splat_b = 1651, + CODE_FOR_msa_splati_d_f = 1652, + CODE_FOR_msa_splati_w_f = 1653, + CODE_FOR_msa_splati_d = 1654, + CODE_FOR_msa_splati_w = 1655, + CODE_FOR_msa_splati_h = 1656, + CODE_FOR_msa_splati_b = 1657, + CODE_FOR_msa_splati_d_f_scalar = 1658, + CODE_FOR_msa_splati_w_f_scalar = 1659, + CODE_FOR_msa_cfcmsa = 1660, + CODE_FOR_msa_ctcmsa = 1661, + CODE_FOR_msa_fexdo_h = 1662, + CODE_FOR_vec_pack_trunc_v2df = 1663, + CODE_FOR_msa_fexupl_w = 1664, + CODE_FOR_msa_fexupl_d = 1665, + CODE_FOR_msa_fexupr_w = 1666, + CODE_FOR_msa_fexupr_d = 1667, + CODE_FOR_msa_bz_d_f = 1668, + CODE_FOR_msa_bnz_d_f = 1669, + CODE_FOR_msa_bz_w_f = 1670, + CODE_FOR_msa_bnz_w_f = 1671, + CODE_FOR_msa_bz_d = 1672, + CODE_FOR_msa_bnz_d = 1673, + CODE_FOR_msa_bz_w = 1674, + CODE_FOR_msa_bnz_w = 1675, + CODE_FOR_msa_bz_h = 1676, + CODE_FOR_msa_bnz_h = 1677, + CODE_FOR_msa_bz_b = 1678, + CODE_FOR_msa_bnz_b = 1679, + CODE_FOR_msa_bz_v_d_f = 1680, + CODE_FOR_msa_bnz_v_d_f = 1681, + CODE_FOR_msa_bz_v_w_f = 1682, + CODE_FOR_msa_bnz_v_w_f = 1683, + CODE_FOR_msa_bz_v_d = 1684, + CODE_FOR_msa_bnz_v_d = 1685, + CODE_FOR_msa_bz_v_w = 1686, + CODE_FOR_msa_bnz_v_w = 1687, + CODE_FOR_msa_bz_v_h = 1688, + CODE_FOR_msa_bnz_v_h = 1689, + CODE_FOR_msa_bz_v_b = 1690, + CODE_FOR_msa_bnz_v_b = 1691, + CODE_FOR_ctrapsi4 = 1692, + CODE_FOR_ctrapdi4 = 1693, + CODE_FOR_addsi3 = 1694, + CODE_FOR_adddi3 = 1695, + CODE_FOR_mulsf3 = 1696, + CODE_FOR_muldf3 = 1697, + CODE_FOR_mulsi3 = 1698, + CODE_FOR_muldi3 = 1699, + CODE_FOR_mulsidi3 = 1700, + CODE_FOR_umulsidi3 = 1701, + CODE_FOR_mulsidi3_32bit_r6 = 1702, + CODE_FOR_umulsidi3_32bit_r6 = 1703, + CODE_FOR_mulsidi3_32bit_mips16 = 1704, + CODE_FOR_umulsidi3_32bit_mips16 = 1705, + CODE_FOR_mulsidi3_64bit_mips16 = 1706, + CODE_FOR_umulsidi3_64bit_mips16 = 1707, + CODE_FOR_mulsidi3_64bit_split = 1708, + CODE_FOR_umulsidi3_64bit_split = 1709, + CODE_FOR_smulsi3_highpart = 1710, + CODE_FOR_umulsi3_highpart = 1711, + CODE_FOR_smulsi3_highpart_split = 1712, + CODE_FOR_umulsi3_highpart_split = 1713, + CODE_FOR_smuldi3_highpart = 1714, + CODE_FOR_umuldi3_highpart = 1715, + CODE_FOR_smuldi3_highpart_split = 1716, + CODE_FOR_umuldi3_highpart_split = 1717, + CODE_FOR_mulditi3 = 1718, + CODE_FOR_umulditi3 = 1719, + CODE_FOR_fmasf4 = 1720, + CODE_FOR_fmadf4 = 1721, + CODE_FOR_fmav2sf4 = 1722, + CODE_FOR_fmssf4 = 1723, + CODE_FOR_fmsdf4 = 1724, + CODE_FOR_fmsv2sf4 = 1725, + CODE_FOR_fnmasf4 = 1726, + CODE_FOR_fnmadf4 = 1727, + CODE_FOR_fnmav2sf4 = 1728, + CODE_FOR_fnmssf4 = 1729, + CODE_FOR_fnmsdf4 = 1730, + CODE_FOR_fnmsv2sf4 = 1731, + CODE_FOR_divsf3 = 1732, + CODE_FOR_divdf3 = 1733, + CODE_FOR_divv2sf3 = 1734, + CODE_FOR_divmodsi4 = 1735, + CODE_FOR_divmoddi4 = 1736, + CODE_FOR_udivmodsi4 = 1737, + CODE_FOR_udivmoddi4 = 1738, + CODE_FOR_divmodsi4_split = 1739, + CODE_FOR_udivmodsi4_split = 1740, + CODE_FOR_divmoddi4_split = 1741, + CODE_FOR_udivmoddi4_split = 1742, + CODE_FOR_andsi3 = 1743, + CODE_FOR_anddi3 = 1744, + CODE_FOR_iorsi3 = 1745, + CODE_FOR_iordi3 = 1746, + CODE_FOR_xorsi3 = 1747, + CODE_FOR_xordi3 = 1748, + CODE_FOR_zero_extendsidi2 = 1749, + CODE_FOR_zero_extendqisi2 = 1750, + CODE_FOR_zero_extendqidi2 = 1751, + CODE_FOR_zero_extendhisi2 = 1752, + CODE_FOR_zero_extendhidi2 = 1753, + CODE_FOR_zero_extendqihi2 = 1754, + CODE_FOR_extendqisi2 = 1755, + CODE_FOR_extendqidi2 = 1756, + CODE_FOR_extendhisi2 = 1757, + CODE_FOR_extendhidi2 = 1758, + CODE_FOR_extendqihi2 = 1759, + CODE_FOR_fix_truncdfsi2 = 1760, + CODE_FOR_fix_truncsfsi2 = 1761, + CODE_FOR_fixuns_truncdfsi2 = 1762, + CODE_FOR_fixuns_truncdfdi2 = 1763, + CODE_FOR_fixuns_truncsfsi2 = 1764, + CODE_FOR_fixuns_truncsfdi2 = 1765, + CODE_FOR_extvmisalignsi = 1766, + CODE_FOR_extvmisaligndi = 1767, + CODE_FOR_extvsi = 1768, + CODE_FOR_extvdi = 1769, + CODE_FOR_extzvmisalignsi = 1770, + CODE_FOR_extzvmisaligndi = 1771, + CODE_FOR_extzvsi = 1772, + CODE_FOR_extzvdi = 1773, + CODE_FOR_insvmisalignsi = 1774, + CODE_FOR_insvmisaligndi = 1775, + CODE_FOR_insvsi = 1776, + CODE_FOR_insvdi = 1777, + CODE_FOR_unspec_got_si = 1778, + CODE_FOR_unspec_got_di = 1779, + CODE_FOR_movdi = 1780, + CODE_FOR_movsi = 1781, + CODE_FOR_movv2hi = 1782, + CODE_FOR_movv4qi = 1783, + CODE_FOR_movv2hq = 1784, + CODE_FOR_movv2uhq = 1785, + CODE_FOR_movv2ha = 1786, + CODE_FOR_movv2uha = 1787, + CODE_FOR_movv4qq = 1788, + CODE_FOR_movv4uqq = 1789, + CODE_FOR_movhi = 1790, + CODE_FOR_movqi = 1791, + CODE_FOR_movsf = 1792, + CODE_FOR_movdf = 1793, + CODE_FOR_movti = 1794, + CODE_FOR_movtf = 1795, + CODE_FOR_movv2sf = 1796, + CODE_FOR_move_doubleword_fprdf = 1797, + CODE_FOR_move_doubleword_fprdi = 1798, + CODE_FOR_move_doubleword_fprv2sf = 1799, + CODE_FOR_move_doubleword_fprv2si = 1800, + CODE_FOR_move_doubleword_fprv4hi = 1801, + CODE_FOR_move_doubleword_fprv8qi = 1802, + CODE_FOR_move_doubleword_fprtf = 1803, + CODE_FOR_load_const_gp_si = 1804, + CODE_FOR_load_const_gp_di = 1805, + CODE_FOR_clear_cache = 1806, + CODE_FOR_movmemsi = 1807, + CODE_FOR_ashlsi3 = 1808, + CODE_FOR_ashrsi3 = 1809, + CODE_FOR_lshrsi3 = 1810, + CODE_FOR_ashldi3 = 1811, + CODE_FOR_ashrdi3 = 1812, + CODE_FOR_lshrdi3 = 1813, + CODE_FOR_cbranchsi4 = 1814, + CODE_FOR_cbranchdi4 = 1815, + CODE_FOR_cbranchsf4 = 1816, + CODE_FOR_cbranchdf4 = 1817, + CODE_FOR_condjump = 1818, + CODE_FOR_cstoresi4 = 1819, + CODE_FOR_cstoredi4 = 1820, + CODE_FOR_jump = 1821, + CODE_FOR_indirect_jump = 1822, + CODE_FOR_tablejump = 1823, + CODE_FOR_casesi = 1824, + CODE_FOR_builtin_setjmp_setup = 1825, + CODE_FOR_builtin_longjmp = 1826, + CODE_FOR_prologue = 1827, + CODE_FOR_epilogue = 1828, + CODE_FOR_sibcall_epilogue = 1829, + CODE_FOR_return = 1830, + CODE_FOR_simple_return = 1831, + CODE_FOR_eh_return = 1832, + CODE_FOR_exception_receiver = 1833, + CODE_FOR_nonlocal_goto_receiver = 1834, + CODE_FOR_sibcall = 1835, + CODE_FOR_sibcall_value = 1836, + CODE_FOR_call = 1837, + CODE_FOR_call_value = 1838, + CODE_FOR_untyped_call = 1839, + CODE_FOR_movsicc = 1840, + CODE_FOR_movdicc = 1841, + CODE_FOR_movsfcc = 1842, + CODE_FOR_movdfcc = 1843, + CODE_FOR_get_thread_pointersi = 1844, + CODE_FOR_get_thread_pointerdi = 1845, + CODE_FOR_mips_get_fcsr = 1846, + CODE_FOR_mips_set_fcsr = 1847, + CODE_FOR_memory_barrier = 1848, + CODE_FOR_sync_compare_and_swapqi = 1849, + CODE_FOR_sync_compare_and_swaphi = 1850, + CODE_FOR_sync_addqi = 1851, + CODE_FOR_sync_subqi = 1852, + CODE_FOR_sync_iorqi = 1853, + CODE_FOR_sync_xorqi = 1854, + CODE_FOR_sync_andqi = 1855, + CODE_FOR_sync_addhi = 1856, + CODE_FOR_sync_subhi = 1857, + CODE_FOR_sync_iorhi = 1858, + CODE_FOR_sync_xorhi = 1859, + CODE_FOR_sync_andhi = 1860, + CODE_FOR_sync_old_addqi = 1861, + CODE_FOR_sync_old_subqi = 1862, + CODE_FOR_sync_old_iorqi = 1863, + CODE_FOR_sync_old_xorqi = 1864, + CODE_FOR_sync_old_andqi = 1865, + CODE_FOR_sync_old_addhi = 1866, + CODE_FOR_sync_old_subhi = 1867, + CODE_FOR_sync_old_iorhi = 1868, + CODE_FOR_sync_old_xorhi = 1869, + CODE_FOR_sync_old_andhi = 1870, + CODE_FOR_sync_new_addqi = 1871, + CODE_FOR_sync_new_subqi = 1872, + CODE_FOR_sync_new_iorqi = 1873, + CODE_FOR_sync_new_xorqi = 1874, + CODE_FOR_sync_new_andqi = 1875, + CODE_FOR_sync_new_addhi = 1876, + CODE_FOR_sync_new_subhi = 1877, + CODE_FOR_sync_new_iorhi = 1878, + CODE_FOR_sync_new_xorhi = 1879, + CODE_FOR_sync_new_andhi = 1880, + CODE_FOR_sync_nandqi = 1881, + CODE_FOR_sync_nandhi = 1882, + CODE_FOR_sync_old_nandqi = 1883, + CODE_FOR_sync_old_nandhi = 1884, + CODE_FOR_sync_new_nandqi = 1885, + CODE_FOR_sync_new_nandhi = 1886, + CODE_FOR_sync_lock_test_and_setqi = 1887, + CODE_FOR_sync_lock_test_and_sethi = 1888, + CODE_FOR_atomic_exchangesi = 1889, + CODE_FOR_atomic_exchangedi = 1890, + CODE_FOR_atomic_fetch_addsi = 1891, + CODE_FOR_atomic_fetch_adddi = 1892, + CODE_FOR_movv2sfcc = 1893, + CODE_FOR_vec_perm_constv2sf = 1894, + CODE_FOR_mips_puu_ps = 1895, + CODE_FOR_mips_pul_ps = 1896, + CODE_FOR_mips_plu_ps = 1897, + CODE_FOR_mips_pll_ps = 1898, + CODE_FOR_vec_initv2sf = 1899, + CODE_FOR_vec_setv2sf = 1900, + CODE_FOR_mips_cvt_ps_s = 1901, + CODE_FOR_mips_cvt_s_pl = 1902, + CODE_FOR_mips_cvt_s_pu = 1903, + CODE_FOR_reduc_plus_scal_v2sf = 1904, + CODE_FOR_mips_abs_ps = 1905, + CODE_FOR_scc_ps = 1906, + CODE_FOR_single_cc = 1907, + CODE_FOR_vcondv2sfv2sf = 1908, + CODE_FOR_sminv2sf3 = 1909, + CODE_FOR_smaxv2sf3 = 1910, + CODE_FOR_reduc_smin_scal_v2sf = 1911, + CODE_FOR_reduc_smax_scal_v2sf = 1912, + CODE_FOR_mips_lbux = 1913, + CODE_FOR_mips_lhx = 1914, + CODE_FOR_mips_lwx = 1915, + CODE_FOR_mips_ldx = 1916, + CODE_FOR_mips_madd = 1917, + CODE_FOR_mips_maddu = 1918, + CODE_FOR_mips_msub = 1919, + CODE_FOR_mips_msubu = 1920, + CODE_FOR_movv2si = 1921, + CODE_FOR_movv4hi = 1922, + CODE_FOR_movv8qi = 1923, + CODE_FOR_vec_initv2si = 1924, + CODE_FOR_vec_initv4hi = 1925, + CODE_FOR_vec_initv8qi = 1926, + CODE_FOR_vec_setv4hi = 1927, + CODE_FOR_sdot_prodv4hi = 1928, + CODE_FOR_smaxv2si3 = 1929, + CODE_FOR_smaxv8qi3 = 1930, + CODE_FOR_sminv2si3 = 1931, + CODE_FOR_sminv8qi3 = 1932, + CODE_FOR_vec_perm_constv2si = 1933, + CODE_FOR_vec_perm_constv4hi = 1934, + CODE_FOR_vec_perm_constv8qi = 1935, + CODE_FOR_vec_unpacks_lo_v4hi = 1936, + CODE_FOR_vec_unpacks_lo_v8qi = 1937, + CODE_FOR_vec_unpacks_hi_v4hi = 1938, + CODE_FOR_vec_unpacks_hi_v8qi = 1939, + CODE_FOR_vec_unpacku_lo_v4hi = 1940, + CODE_FOR_vec_unpacku_lo_v8qi = 1941, + CODE_FOR_vec_unpacku_hi_v4hi = 1942, + CODE_FOR_vec_unpacku_hi_v8qi = 1943, + CODE_FOR_reduc_plus_scal_v2si = 1944, + CODE_FOR_reduc_plus_scal_v4hi = 1945, + CODE_FOR_reduc_plus_scal_v8qi = 1946, + CODE_FOR_reduc_smax_scal_v2si = 1947, + CODE_FOR_reduc_smax_scal_v4hi = 1948, + CODE_FOR_reduc_smax_scal_v8qi = 1949, + CODE_FOR_reduc_smin_scal_v2si = 1950, + CODE_FOR_reduc_smin_scal_v4hi = 1951, + CODE_FOR_reduc_smin_scal_v8qi = 1952, + CODE_FOR_reduc_umax_scal_v8qi = 1953, + CODE_FOR_reduc_umin_scal_v8qi = 1954, + CODE_FOR_vec_initv2df = 1955, + CODE_FOR_vec_initv4sf = 1956, + CODE_FOR_vec_initv2di = 1957, + CODE_FOR_vec_initv4si = 1958, + CODE_FOR_vec_initv8hi = 1959, + CODE_FOR_vec_initv16qi = 1960, + CODE_FOR_vec_unpacks_hi_v4sf = 1961, + CODE_FOR_vec_unpacks_lo_v4sf = 1962, + CODE_FOR_vec_unpacks_hi_v4si = 1963, + CODE_FOR_vec_unpacks_hi_v8hi = 1964, + CODE_FOR_vec_unpacks_hi_v16qi = 1965, + CODE_FOR_vec_unpacks_lo_v4si = 1966, + CODE_FOR_vec_unpacks_lo_v8hi = 1967, + CODE_FOR_vec_unpacks_lo_v16qi = 1968, + CODE_FOR_vec_unpacku_hi_v4si = 1969, + CODE_FOR_vec_unpacku_hi_v8hi = 1970, + CODE_FOR_vec_unpacku_hi_v16qi = 1971, + CODE_FOR_vec_unpacku_lo_v4si = 1972, + CODE_FOR_vec_unpacku_lo_v8hi = 1973, + CODE_FOR_vec_unpacku_lo_v16qi = 1974, + CODE_FOR_vec_extractv2di = 1975, + CODE_FOR_vec_extractv4si = 1976, + CODE_FOR_vec_extractv8hi = 1977, + CODE_FOR_vec_extractv16qi = 1978, + CODE_FOR_vec_extractv2df = 1979, + CODE_FOR_vec_extractv4sf = 1980, + CODE_FOR_vec_setv2di = 1981, + CODE_FOR_vec_setv4si = 1982, + CODE_FOR_vec_setv8hi = 1983, + CODE_FOR_vec_setv16qi = 1984, + CODE_FOR_vec_setv2df = 1985, + CODE_FOR_vec_setv4sf = 1986, + CODE_FOR_vconduv2dfv2di = 1987, + CODE_FOR_vconduv2dfv4si = 1988, + CODE_FOR_vconduv2dfv8hi = 1989, + CODE_FOR_vconduv2dfv16qi = 1990, + CODE_FOR_vconduv4sfv2di = 1991, + CODE_FOR_vconduv4sfv4si = 1992, + CODE_FOR_vconduv4sfv8hi = 1993, + CODE_FOR_vconduv4sfv16qi = 1994, + CODE_FOR_vconduv2div2di = 1995, + CODE_FOR_vconduv2div4si = 1996, + CODE_FOR_vconduv2div8hi = 1997, + CODE_FOR_vconduv2div16qi = 1998, + CODE_FOR_vconduv4siv2di = 1999, + CODE_FOR_vconduv4siv4si = 2000, + CODE_FOR_vconduv4siv8hi = 2001, + CODE_FOR_vconduv4siv16qi = 2002, + CODE_FOR_vconduv8hiv2di = 2003, + CODE_FOR_vconduv8hiv4si = 2004, + CODE_FOR_vconduv8hiv8hi = 2005, + CODE_FOR_vconduv8hiv16qi = 2006, + CODE_FOR_vconduv16qiv2di = 2007, + CODE_FOR_vconduv16qiv4si = 2008, + CODE_FOR_vconduv16qiv8hi = 2009, + CODE_FOR_vconduv16qiv16qi = 2010, + CODE_FOR_vcondv2dfv2df = 2011, + CODE_FOR_vcondv4sfv2df = 2012, + CODE_FOR_vcondv2div2df = 2013, + CODE_FOR_vcondv4siv2df = 2014, + CODE_FOR_vcondv8hiv2df = 2015, + CODE_FOR_vcondv16qiv2df = 2016, + CODE_FOR_vcondv2dfv4sf = 2017, + CODE_FOR_vcondv4sfv4sf = 2018, + CODE_FOR_vcondv2div4sf = 2019, + CODE_FOR_vcondv4siv4sf = 2020, + CODE_FOR_vcondv8hiv4sf = 2021, + CODE_FOR_vcondv16qiv4sf = 2022, + CODE_FOR_vcondv2dfv2di = 2023, + CODE_FOR_vcondv4sfv2di = 2024, + CODE_FOR_vcondv2div2di = 2025, + CODE_FOR_vcondv4siv2di = 2026, + CODE_FOR_vcondv8hiv2di = 2027, + CODE_FOR_vcondv16qiv2di = 2028, + CODE_FOR_vcondv2dfv4si = 2029, + CODE_FOR_vcondv4sfv4si = 2030, + CODE_FOR_vcondv2div4si = 2031, + CODE_FOR_vcondv4siv4si = 2032, + CODE_FOR_vcondv8hiv4si = 2033, + CODE_FOR_vcondv16qiv4si = 2034, + CODE_FOR_vcondv2dfv8hi = 2035, + CODE_FOR_vcondv4sfv8hi = 2036, + CODE_FOR_vcondv2div8hi = 2037, + CODE_FOR_vcondv4siv8hi = 2038, + CODE_FOR_vcondv8hiv8hi = 2039, + CODE_FOR_vcondv16qiv8hi = 2040, + CODE_FOR_vcondv2dfv16qi = 2041, + CODE_FOR_vcondv4sfv16qi = 2042, + CODE_FOR_vcondv2div16qi = 2043, + CODE_FOR_vcondv4siv16qi = 2044, + CODE_FOR_vcondv8hiv16qi = 2045, + CODE_FOR_vcondv16qiv16qi = 2046, + CODE_FOR_vec_perm_constv2df = 2047, + CODE_FOR_vec_perm_constv4sf = 2048, + CODE_FOR_vec_perm_constv2di = 2049, + CODE_FOR_vec_perm_constv4si = 2050, + CODE_FOR_vec_perm_constv8hi = 2051, + CODE_FOR_vec_perm_constv16qi = 2052, + CODE_FOR_absv2di2 = 2053, + CODE_FOR_absv4si2 = 2054, + CODE_FOR_absv8hi2 = 2055, + CODE_FOR_absv16qi2 = 2056, + CODE_FOR_negv2df2 = 2057, + CODE_FOR_negv4sf2 = 2058, + CODE_FOR_negv2di2 = 2059, + CODE_FOR_negv4si2 = 2060, + CODE_FOR_negv8hi2 = 2061, + CODE_FOR_negv16qi2 = 2062, + CODE_FOR_msa_ldiv2di = 2063, + CODE_FOR_msa_ldiv4si = 2064, + CODE_FOR_msa_ldiv8hi = 2065, + CODE_FOR_msa_ldiv16qi = 2066, + CODE_FOR_movv2df = 2067, + CODE_FOR_movv4sf = 2068, + CODE_FOR_movv2di = 2069, + CODE_FOR_movv4si = 2070, + CODE_FOR_movv8hi = 2071, + CODE_FOR_movv16qi = 2072, + CODE_FOR_movmisalignv2df = 2073, + CODE_FOR_movmisalignv4sf = 2074, + CODE_FOR_movmisalignv2di = 2075, + CODE_FOR_movmisalignv4si = 2076, + CODE_FOR_movmisalignv8hi = 2077, + CODE_FOR_movmisalignv16qi = 2078, + CODE_FOR_msa_ld_d_f = 2079, + CODE_FOR_msa_ld_w_f = 2080, + CODE_FOR_msa_ld_d = 2081, + CODE_FOR_msa_ld_w = 2082, + CODE_FOR_msa_ld_h = 2083, + CODE_FOR_msa_ld_b = 2084, + CODE_FOR_msa_st_d_f = 2085, + CODE_FOR_msa_st_w_f = 2086, + CODE_FOR_msa_st_d = 2087, + CODE_FOR_msa_st_w = 2088, + CODE_FOR_msa_st_h = 2089, + CODE_FOR_msa_st_b = 2090 +}; + +const unsigned int NUM_INSN_CODES = 2091; +#endif /* GCC_INSN_CODES_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/insn-constants.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/insn-constants.h new file mode 100644 index 0000000..24015cf --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/insn-constants.h @@ -0,0 +1,373 @@ +/* Generated automatically by the program `genconstants' + from the machine description file `md'. */ + +#ifndef GCC_INSN_CONSTANTS_H +#define GCC_INSN_CONSTANTS_H + +#define CCDSP_OU_REGNUM 185 +#define RETURN_ADDR_REGNUM 31 +#define GOT_VERSION_REGNUM 79 +#define SET_FCSR_REGNUM 4 +#define MIPS16_T_REGNUM 24 +#define CCDSP_EF_REGNUM 187 +#define CCDSP_CC_REGNUM 186 +#define CPRESTORE_SLOT_REGNUM 76 +#define PIC_FUNCTION_ADDR_REGNUM 25 +#define CCDSP_CA_REGNUM 184 +#define CCDSP_PO_REGNUM 182 +#define MAX_PIC_BRANCH_LENGTH 100 +#define TLS_GET_TP_REGNUM 3 +#define CCDSP_SC_REGNUM 183 +#define GET_FCSR_REGNUM 2 + +enum unspec { + UNSPEC_LOAD_LEFT = 0, + UNSPEC_LOAD_RIGHT = 1, + UNSPEC_STORE_LEFT = 2, + UNSPEC_STORE_RIGHT = 3, + UNSPEC_WSBH = 4, + UNSPEC_DSBH = 5, + UNSPEC_DSHD = 6, + UNSPEC_LOAD_LOW = 7, + UNSPEC_LOAD_HIGH = 8, + UNSPEC_STORE_WORD = 9, + UNSPEC_MFHC1 = 10, + UNSPEC_MTHC1 = 11, + UNSPEC_GET_FCSR = 12, + UNSPEC_SET_FCSR = 13, + UNSPEC_MFHI = 14, + UNSPEC_MTHI = 15, + UNSPEC_SET_HILO = 16, + UNSPEC_LOADGP = 17, + UNSPEC_COPYGP = 18, + UNSPEC_MOVE_GP = 19, + UNSPEC_POTENTIAL_CPRESTORE = 20, + UNSPEC_CPRESTORE = 21, + UNSPEC_RESTORE_GP = 22, + UNSPEC_EH_RETURN = 23, + UNSPEC_GP = 24, + UNSPEC_SET_GOT_VERSION = 25, + UNSPEC_UPDATE_GOT_VERSION = 26, + UNSPEC_LOAD_CALL = 27, + UNSPEC_LOAD_GOT = 28, + UNSPEC_TLS_LDM = 29, + UNSPEC_TLS_GET_TP = 30, + UNSPEC_UNSHIFTED_HIGH = 31, + UNSPEC_ALIGN = 32, + UNSPEC_CONSTTABLE = 33, + UNSPEC_CONSTTABLE_END = 34, + UNSPEC_CONSTTABLE_INT = 35, + UNSPEC_CONSTTABLE_FLOAT = 36, + UNSPEC_BLOCKAGE = 37, + UNSPEC_CLEAR_HAZARD = 38, + UNSPEC_RDHWR = 39, + UNSPEC_SYNCI = 40, + UNSPEC_SYNC = 41, + UNSPEC_MIPS_CACHE = 42, + UNSPEC_R10K_CACHE_BARRIER = 43, + UNSPEC_ERET = 44, + UNSPEC_DERET = 45, + UNSPEC_DI = 46, + UNSPEC_EHB = 47, + UNSPEC_RDPGPR = 48, + UNSPEC_COP0 = 49, + UNSPEC_CALL_ATTR = 50, + UNSPEC_CASESI_DISPATCH = 51, + UNSPEC_PROBE_STACK_RANGE = 52, + UNSPEC_INSN_PSEUDO = 53, + UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN = 54, + UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN = 55, + UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN = 56, + UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN = 57, + UNSPEC_COMPARE_AND_SWAP = 58, + UNSPEC_COMPARE_AND_SWAP_12 = 59, + UNSPEC_SYNC_OLD_OP = 60, + UNSPEC_SYNC_NEW_OP = 61, + UNSPEC_SYNC_NEW_OP_12 = 62, + UNSPEC_SYNC_OLD_OP_12 = 63, + UNSPEC_SYNC_EXCHANGE = 64, + UNSPEC_SYNC_EXCHANGE_12 = 65, + UNSPEC_MEMORY_BARRIER = 66, + UNSPEC_ATOMIC_COMPARE_AND_SWAP = 67, + UNSPEC_ATOMIC_EXCHANGE = 68, + UNSPEC_ATOMIC_FETCH_OP = 69, + UNSPEC_MOVE_TF_PS = 70, + UNSPEC_C = 71, + UNSPEC_ALNV_PS = 72, + UNSPEC_CABS = 73, + UNSPEC_ADDR_PS = 74, + UNSPEC_CVT_PW_PS = 75, + UNSPEC_CVT_PS_PW = 76, + UNSPEC_MULR_PS = 77, + UNSPEC_ABS_PS = 78, + UNSPEC_RSQRT1 = 79, + UNSPEC_RSQRT2 = 80, + UNSPEC_RECIP1 = 81, + UNSPEC_RECIP2 = 82, + UNSPEC_SINGLE_CC = 83, + UNSPEC_SCC = 84, + UNSPEC_ADDQ = 85, + UNSPEC_ADDQ_S = 86, + UNSPEC_SUBQ = 87, + UNSPEC_SUBQ_S = 88, + UNSPEC_ADDSC = 89, + UNSPEC_ADDWC = 90, + UNSPEC_MODSUB = 91, + UNSPEC_RADDU_W_QB = 92, + UNSPEC_ABSQ_S = 93, + UNSPEC_PRECRQ_QB_PH = 94, + UNSPEC_PRECRQ_PH_W = 95, + UNSPEC_PRECRQ_RS_PH_W = 96, + UNSPEC_PRECRQU_S_QB_PH = 97, + UNSPEC_PRECEQ_W_PHL = 98, + UNSPEC_PRECEQ_W_PHR = 99, + UNSPEC_PRECEQU_PH_QBL = 100, + UNSPEC_PRECEQU_PH_QBR = 101, + UNSPEC_PRECEQU_PH_QBLA = 102, + UNSPEC_PRECEQU_PH_QBRA = 103, + UNSPEC_PRECEU_PH_QBL = 104, + UNSPEC_PRECEU_PH_QBR = 105, + UNSPEC_PRECEU_PH_QBLA = 106, + UNSPEC_PRECEU_PH_QBRA = 107, + UNSPEC_SHLL = 108, + UNSPEC_SHLL_S = 109, + UNSPEC_SHRL_QB = 110, + UNSPEC_SHRA_PH = 111, + UNSPEC_SHRA_R = 112, + UNSPEC_MULEU_S_PH_QBL = 113, + UNSPEC_MULEU_S_PH_QBR = 114, + UNSPEC_MULQ_RS_PH = 115, + UNSPEC_MULEQ_S_W_PHL = 116, + UNSPEC_MULEQ_S_W_PHR = 117, + UNSPEC_DPAU_H_QBL = 118, + UNSPEC_DPAU_H_QBR = 119, + UNSPEC_DPSU_H_QBL = 120, + UNSPEC_DPSU_H_QBR = 121, + UNSPEC_DPAQ_S_W_PH = 122, + UNSPEC_DPSQ_S_W_PH = 123, + UNSPEC_MULSAQ_S_W_PH = 124, + UNSPEC_DPAQ_SA_L_W = 125, + UNSPEC_DPSQ_SA_L_W = 126, + UNSPEC_MAQ_S_W_PHL = 127, + UNSPEC_MAQ_S_W_PHR = 128, + UNSPEC_MAQ_SA_W_PHL = 129, + UNSPEC_MAQ_SA_W_PHR = 130, + UNSPEC_BITREV = 131, + UNSPEC_INSV = 132, + UNSPEC_REPL_QB = 133, + UNSPEC_REPL_PH = 134, + UNSPEC_CMP_EQ = 135, + UNSPEC_CMP_LT = 136, + UNSPEC_CMP_LE = 137, + UNSPEC_CMPGU_EQ_QB = 138, + UNSPEC_CMPGU_LT_QB = 139, + UNSPEC_CMPGU_LE_QB = 140, + UNSPEC_PICK = 141, + UNSPEC_PACKRL_PH = 142, + UNSPEC_EXTR_W = 143, + UNSPEC_EXTR_R_W = 144, + UNSPEC_EXTR_RS_W = 145, + UNSPEC_EXTR_S_H = 146, + UNSPEC_EXTP = 147, + UNSPEC_EXTPDP = 148, + UNSPEC_SHILO = 149, + UNSPEC_MTHLIP = 150, + UNSPEC_WRDSP = 151, + UNSPEC_RDDSP = 152, + UNSPEC_ABSQ_S_QB = 153, + UNSPEC_ADDU_PH = 154, + UNSPEC_ADDU_S_PH = 155, + UNSPEC_ADDUH_QB = 156, + UNSPEC_ADDUH_R_QB = 157, + UNSPEC_APPEND = 158, + UNSPEC_BALIGN = 159, + UNSPEC_CMPGDU_EQ_QB = 160, + UNSPEC_CMPGDU_LT_QB = 161, + UNSPEC_CMPGDU_LE_QB = 162, + UNSPEC_DPA_W_PH = 163, + UNSPEC_DPS_W_PH = 164, + UNSPEC_MADD = 165, + UNSPEC_MADDU = 166, + UNSPEC_MSUB = 167, + UNSPEC_MSUBU = 168, + UNSPEC_MUL_PH = 169, + UNSPEC_MUL_S_PH = 170, + UNSPEC_MULQ_RS_W = 171, + UNSPEC_MULQ_S_PH = 172, + UNSPEC_MULQ_S_W = 173, + UNSPEC_MULSA_W_PH = 174, + UNSPEC_MULT = 175, + UNSPEC_MULTU = 176, + UNSPEC_PRECR_QB_PH = 177, + UNSPEC_PRECR_SRA_PH_W = 178, + UNSPEC_PRECR_SRA_R_PH_W = 179, + UNSPEC_PREPEND = 180, + UNSPEC_SHRA_QB = 181, + UNSPEC_SHRA_R_QB = 182, + UNSPEC_SHRL_PH = 183, + UNSPEC_SUBU_PH = 184, + UNSPEC_SUBU_S_PH = 185, + UNSPEC_SUBUH_QB = 186, + UNSPEC_SUBUH_R_QB = 187, + UNSPEC_ADDQH_PH = 188, + UNSPEC_ADDQH_R_PH = 189, + UNSPEC_ADDQH_W = 190, + UNSPEC_ADDQH_R_W = 191, + UNSPEC_SUBQH_PH = 192, + UNSPEC_SUBQH_R_PH = 193, + UNSPEC_SUBQH_W = 194, + UNSPEC_SUBQH_R_W = 195, + UNSPEC_DPAX_W_PH = 196, + UNSPEC_DPSX_W_PH = 197, + UNSPEC_DPAQX_S_W_PH = 198, + UNSPEC_DPAQX_SA_W_PH = 199, + UNSPEC_DPSQX_S_W_PH = 200, + UNSPEC_DPSQX_SA_W_PH = 201, + UNSPEC_LOONGSON_PAVG = 202, + UNSPEC_LOONGSON_PCMPEQ = 203, + UNSPEC_LOONGSON_PCMPGT = 204, + UNSPEC_LOONGSON_PEXTR = 205, + UNSPEC_LOONGSON_PINSRH = 206, + UNSPEC_LOONGSON_VINIT = 207, + UNSPEC_LOONGSON_PMADD = 208, + UNSPEC_LOONGSON_PMOVMSK = 209, + UNSPEC_LOONGSON_PMULHU = 210, + UNSPEC_LOONGSON_PMULH = 211, + UNSPEC_LOONGSON_PMULU = 212, + UNSPEC_LOONGSON_PASUBUB = 213, + UNSPEC_LOONGSON_BIADD = 214, + UNSPEC_LOONGSON_PSADBH = 215, + UNSPEC_LOONGSON_PSHUFH = 216, + UNSPEC_LOONGSON_PUNPCKH = 217, + UNSPEC_LOONGSON_PUNPCKL = 218, + UNSPEC_LOONGSON_PADDD = 219, + UNSPEC_LOONGSON_PSUBD = 220, + UNSPEC_LOONGSON_DSLL = 221, + UNSPEC_LOONGSON_DSRL = 222, + UNSPEC_MSA_ASUB_S = 223, + UNSPEC_MSA_ASUB_U = 224, + UNSPEC_MSA_AVE_S = 225, + UNSPEC_MSA_AVE_U = 226, + UNSPEC_MSA_AVER_S = 227, + UNSPEC_MSA_AVER_U = 228, + UNSPEC_MSA_BCLR = 229, + UNSPEC_MSA_BCLRI = 230, + UNSPEC_MSA_BINSL = 231, + UNSPEC_MSA_BINSLI = 232, + UNSPEC_MSA_BINSR = 233, + UNSPEC_MSA_BINSRI = 234, + UNSPEC_MSA_BNEG = 235, + UNSPEC_MSA_BNEGI = 236, + UNSPEC_MSA_BSET = 237, + UNSPEC_MSA_BSETI = 238, + UNSPEC_MSA_BRANCH_V = 239, + UNSPEC_MSA_BRANCH = 240, + UNSPEC_MSA_CFCMSA = 241, + UNSPEC_MSA_CTCMSA = 242, + UNSPEC_MSA_FCAF = 243, + UNSPEC_MSA_FCLASS = 244, + UNSPEC_MSA_FCUNE = 245, + UNSPEC_MSA_FEXDO = 246, + UNSPEC_MSA_FEXP2 = 247, + UNSPEC_MSA_FEXUPL = 248, + UNSPEC_MSA_FEXUPR = 249, + UNSPEC_MSA_FFQL = 250, + UNSPEC_MSA_FFQR = 251, + UNSPEC_MSA_FLOG2 = 252, + UNSPEC_MSA_FRCP = 253, + UNSPEC_MSA_FRINT = 254, + UNSPEC_MSA_FRSQRT = 255, + UNSPEC_MSA_FSAF = 256, + UNSPEC_MSA_FSEQ = 257, + UNSPEC_MSA_FSLE = 258, + UNSPEC_MSA_FSLT = 259, + UNSPEC_MSA_FSNE = 260, + UNSPEC_MSA_FSOR = 261, + UNSPEC_MSA_FSUEQ = 262, + UNSPEC_MSA_FSULE = 263, + UNSPEC_MSA_FSULT = 264, + UNSPEC_MSA_FSUN = 265, + UNSPEC_MSA_FSUNE = 266, + UNSPEC_MSA_FTINT_S = 267, + UNSPEC_MSA_FTINT_U = 268, + UNSPEC_MSA_FTQ = 269, + UNSPEC_MSA_MADD_Q = 270, + UNSPEC_MSA_MADDR_Q = 271, + UNSPEC_MSA_MSUB_Q = 272, + UNSPEC_MSA_MSUBR_Q = 273, + UNSPEC_MSA_MUL_Q = 274, + UNSPEC_MSA_MULR_Q = 275, + UNSPEC_MSA_NLOC = 276, + UNSPEC_MSA_SAT_S = 277, + UNSPEC_MSA_SAT_U = 278, + UNSPEC_MSA_SLD = 279, + UNSPEC_MSA_SLDI = 280, + UNSPEC_MSA_SPLAT = 281, + UNSPEC_MSA_SPLATI = 282, + UNSPEC_MSA_SRAR = 283, + UNSPEC_MSA_SRARI = 284, + UNSPEC_MSA_SRLR = 285, + UNSPEC_MSA_SRLRI = 286, + UNSPEC_MSA_SUBS_S = 287, + UNSPEC_MSA_SUBS_U = 288, + UNSPEC_MSA_SUBSUU_S = 289, + UNSPEC_MSA_SUBSUS_U = 290, + UNSPEC_MSA_VSHF = 291, + UNSPEC_ADDRESS_FIRST = 292 +}; +#define NUM_UNSPEC_VALUES 293 +extern const char *const unspec_strings[]; + +enum processor { + PROCESSOR_R3000 = 0, + PROCESSOR_4KC = 1, + PROCESSOR_4KP = 2, + PROCESSOR_5KC = 3, + PROCESSOR_5KF = 4, + PROCESSOR_20KC = 5, + PROCESSOR_24KC = 6, + PROCESSOR_24KF2_1 = 7, + PROCESSOR_24KF1_1 = 8, + PROCESSOR_74KC = 9, + PROCESSOR_74KF2_1 = 10, + PROCESSOR_74KF1_1 = 11, + PROCESSOR_74KF3_2 = 12, + PROCESSOR_LOONGSON_2E = 13, + PROCESSOR_LOONGSON_2F = 14, + PROCESSOR_LOONGSON_3A = 15, + PROCESSOR_M4K = 16, + PROCESSOR_OCTEON = 17, + PROCESSOR_OCTEON2 = 18, + PROCESSOR_OCTEON3 = 19, + PROCESSOR_R3900 = 20, + PROCESSOR_R6000 = 21, + PROCESSOR_R4000 = 22, + PROCESSOR_R4100 = 23, + PROCESSOR_R4111 = 24, + PROCESSOR_R4120 = 25, + PROCESSOR_R4130 = 26, + PROCESSOR_R4300 = 27, + PROCESSOR_R4600 = 28, + PROCESSOR_R4650 = 29, + PROCESSOR_R4700 = 30, + PROCESSOR_R5000 = 31, + PROCESSOR_R5400 = 32, + PROCESSOR_R5500 = 33, + PROCESSOR_R5900 = 34, + PROCESSOR_R7000 = 35, + PROCESSOR_R8000 = 36, + PROCESSOR_R9000 = 37, + PROCESSOR_R10000 = 38, + PROCESSOR_SB1 = 39, + PROCESSOR_SB1A = 40, + PROCESSOR_SR71000 = 41, + PROCESSOR_XLR = 42, + PROCESSOR_XLP = 43, + PROCESSOR_P5600 = 44, + PROCESSOR_M5100 = 45, + PROCESSOR_I6400 = 46 +}; +#define NUM_PROCESSOR_VALUES 47 +extern const char *const processor_strings[]; + +#endif /* GCC_INSN_CONSTANTS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/insn-flags.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/insn-flags.h new file mode 100644 index 0000000..210661b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/insn-flags.h @@ -0,0 +1,3440 @@ +/* Generated automatically by the program `genflags' + from the machine description file `md'. */ + +#ifndef GCC_INSN_FLAGS_H +#define GCC_INSN_FLAGS_H + +#define HAVE_ls2_alu1_turn_enabled_insn (TUNE_LOONGSON_2EF) +#define HAVE_ls2_alu2_turn_enabled_insn (TUNE_LOONGSON_2EF) +#define HAVE_ls2_falu1_turn_enabled_insn (TUNE_LOONGSON_2EF) +#define HAVE_ls2_falu2_turn_enabled_insn (TUNE_LOONGSON_2EF) +#define HAVE_trap 1 +#define HAVE_addsf3 (TARGET_HARD_FLOAT) +#define HAVE_adddf3 (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT) +#define HAVE_addv2sf3 (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_subsf3 (TARGET_HARD_FLOAT) +#define HAVE_subdf3 (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT) +#define HAVE_subv2sf3 (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_subsi3 1 +#define HAVE_subdi3 (TARGET_64BIT) +#define HAVE_mulv2sf3 (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_mulsi3_mul3_nohilo (TARGET_LOONGSON_2EF || TARGET_LOONGSON_3A || ISA_HAS_R6MUL) +#define HAVE_muldi3_mul3_nohilo ((TARGET_LOONGSON_2EF || TARGET_LOONGSON_3A || ISA_HAS_R6DMUL) && (TARGET_64BIT)) +#define HAVE_mulsi3_mul3 (ISA_HAS_MUL3) +#define HAVE_muldi3_mul3 ((ISA_HAS_DMUL3) && (TARGET_64BIT)) +#define HAVE_mulsi3_internal (ISA_HAS_MULT && !TARGET_FIX_R4000) +#define HAVE_muldi3_internal ((ISA_HAS_DMULT && !TARGET_FIX_R4000) && (TARGET_64BIT)) +#define HAVE_mulsi3_r4000 (ISA_HAS_MULT && TARGET_FIX_R4000) +#define HAVE_muldi3_r4000 ((ISA_HAS_DMULT && TARGET_FIX_R4000) && (TARGET_64BIT)) +#define HAVE_mulsidi3_32bit (!TARGET_64BIT && (!TARGET_FIX_R4000 || ISA_HAS_DSP) && ISA_HAS_MULT) +#define HAVE_umulsidi3_32bit (!TARGET_64BIT && (!TARGET_FIX_R4000 || ISA_HAS_DSP) && ISA_HAS_MULT) +#define HAVE_mulsidi3_32bit_r4000 (!TARGET_64BIT && TARGET_FIX_R4000 && !ISA_HAS_DSP && ISA_HAS_MULT) +#define HAVE_umulsidi3_32bit_r4000 (!TARGET_64BIT && TARGET_FIX_R4000 && !ISA_HAS_DSP && ISA_HAS_MULT) +#define HAVE_mulsidi3_64bit (TARGET_64BIT && !TARGET_FIX_R4000 && !ISA_HAS_DMUL3 \ + && !TARGET_MIPS16 && ISA_HAS_MULT) +#define HAVE_umulsidi3_64bit (TARGET_64BIT && !TARGET_FIX_R4000 && !ISA_HAS_DMUL3 \ + && !TARGET_MIPS16 && ISA_HAS_MULT) +#define HAVE_mulsidi3_64bit_hilo (TARGET_64BIT && !TARGET_FIX_R4000) +#define HAVE_umulsidi3_64bit_hilo (TARGET_64BIT && !TARGET_FIX_R4000) +#define HAVE_mulsidi3_64bit_dmul (ISA_HAS_DMUL3) +#define HAVE_mulsidi3_64bit_r6dmul (ISA_HAS_R6DMUL) +#define HAVE_msubsidi4 (!TARGET_64BIT && (ISA_HAS_MSAC || GENERATE_MADD_MSUB || ISA_HAS_DSP)) +#define HAVE_umsubsidi4 (!TARGET_64BIT && (ISA_HAS_MSAC || GENERATE_MADD_MSUB || ISA_HAS_DSP)) +#define HAVE_smulsi3_highpart_r6 (ISA_HAS_R6MUL) +#define HAVE_umulsi3_highpart_r6 (ISA_HAS_R6MUL) +#define HAVE_smulsi3_highpart_internal (ISA_HAS_MULT && !ISA_HAS_MULHI && !TARGET_MIPS16) +#define HAVE_umulsi3_highpart_internal (ISA_HAS_MULT && !ISA_HAS_MULHI && !TARGET_MIPS16) +#define HAVE_smulsi3_highpart_mulhi_internal (ISA_HAS_MULHI) +#define HAVE_umulsi3_highpart_mulhi_internal (ISA_HAS_MULHI) +#define HAVE_smuldi3_highpart_r6 (ISA_HAS_R6DMUL) +#define HAVE_umuldi3_highpart_r6 (ISA_HAS_R6DMUL) +#define HAVE_smuldi3_highpart_internal (ISA_HAS_DMULT \ + && !TARGET_MIPS16 \ + && !(SIGN_EXTEND == ZERO_EXTEND && TARGET_FIX_VR4120)) +#define HAVE_umuldi3_highpart_internal (ISA_HAS_DMULT \ + && !TARGET_MIPS16 \ + && !(ZERO_EXTEND == ZERO_EXTEND && TARGET_FIX_VR4120)) +#define HAVE_mulditi3_internal (ISA_HAS_DMULT \ + && !TARGET_FIX_R4000 \ + && !(SIGN_EXTEND == ZERO_EXTEND && TARGET_FIX_VR4120)) +#define HAVE_umulditi3_internal (ISA_HAS_DMULT \ + && !TARGET_FIX_R4000 \ + && !(ZERO_EXTEND == ZERO_EXTEND && TARGET_FIX_VR4120)) +#define HAVE_mulditi3_r4000 (ISA_HAS_DMULT \ + && TARGET_FIX_R4000 \ + && !(SIGN_EXTEND == ZERO_EXTEND && TARGET_FIX_VR4120)) +#define HAVE_umulditi3_r4000 (ISA_HAS_DMULT \ + && TARGET_FIX_R4000 \ + && !(ZERO_EXTEND == ZERO_EXTEND && TARGET_FIX_VR4120)) +#define HAVE_madsi (TARGET_MAD) +#define HAVE_maddsidi4 ((TARGET_MAD || ISA_HAS_MACC || GENERATE_MADD_MSUB || ISA_HAS_DSP) \ + && !TARGET_64BIT) +#define HAVE_umaddsidi4 ((TARGET_MAD || ISA_HAS_MACC || GENERATE_MADD_MSUB || ISA_HAS_DSP) \ + && !TARGET_64BIT) +#define HAVE_divmodsi4_mips16 (ISA_HAS_DIV && !TARGET_FIX_VR4120 && TARGET_MIPS16) +#define HAVE_divmoddi4_mips16 ((ISA_HAS_DDIV && !TARGET_FIX_VR4120 && TARGET_MIPS16) && (TARGET_64BIT)) +#define HAVE_udivmodsi4_mips16 (ISA_HAS_DIV && TARGET_MIPS16) +#define HAVE_udivmoddi4_mips16 ((ISA_HAS_DDIV && TARGET_MIPS16) && (TARGET_64BIT)) +#define HAVE_divmodsi4_hilo_di ((ISA_HAS_DIV) && (!TARGET_64BIT)) +#define HAVE_udivmodsi4_hilo_di ((ISA_HAS_DIV) && (!TARGET_64BIT)) +#define HAVE_divmodsi4_hilo_ti ((ISA_HAS_DIV) && (TARGET_64BIT)) +#define HAVE_udivmodsi4_hilo_ti ((ISA_HAS_DIV) && (TARGET_64BIT)) +#define HAVE_divmoddi4_hilo_ti ((ISA_HAS_DDIV) && (TARGET_64BIT)) +#define HAVE_udivmoddi4_hilo_ti ((ISA_HAS_DDIV) && (TARGET_64BIT)) +#define HAVE_divsi3 (TARGET_LOONGSON_2EF || TARGET_LOONGSON_3A || ISA_HAS_R6DIV) +#define HAVE_udivsi3 (TARGET_LOONGSON_2EF || TARGET_LOONGSON_3A || ISA_HAS_R6DIV) +#define HAVE_divdi3 ((TARGET_LOONGSON_2EF || TARGET_LOONGSON_3A || ISA_HAS_R6DDIV) && (TARGET_64BIT)) +#define HAVE_udivdi3 ((TARGET_LOONGSON_2EF || TARGET_LOONGSON_3A || ISA_HAS_R6DDIV) && (TARGET_64BIT)) +#define HAVE_modsi3 (TARGET_LOONGSON_2EF || TARGET_LOONGSON_3A || ISA_HAS_R6DIV) +#define HAVE_umodsi3 (TARGET_LOONGSON_2EF || TARGET_LOONGSON_3A || ISA_HAS_R6DIV) +#define HAVE_moddi3 ((TARGET_LOONGSON_2EF || TARGET_LOONGSON_3A || ISA_HAS_R6DDIV) && (TARGET_64BIT)) +#define HAVE_umoddi3 ((TARGET_LOONGSON_2EF || TARGET_LOONGSON_3A || ISA_HAS_R6DDIV) && (TARGET_64BIT)) +#define HAVE_sqrtsf2 ((!ISA_MIPS1) && (TARGET_HARD_FLOAT)) +#define HAVE_sqrtdf2 ((!ISA_MIPS1) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_sqrtv2sf2 ((TARGET_SB1) && (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT)) +#define HAVE_abssf2 ((mips_abs == MIPS_IEEE_754_2008 || !HONOR_NANS (SFmode)) && (TARGET_HARD_FLOAT)) +#define HAVE_absdf2 ((mips_abs == MIPS_IEEE_754_2008 || !HONOR_NANS (DFmode)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_absv2sf2 ((mips_abs == MIPS_IEEE_754_2008 || !HONOR_NANS (V2SFmode)) && (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT)) +#define HAVE_clzsi2 (ISA_HAS_CLZ_CLO) +#define HAVE_clzdi2 ((ISA_HAS_CLZ_CLO) && (TARGET_64BIT)) +#define HAVE_popcountsi2 (ISA_HAS_POP) +#define HAVE_popcountdi2 ((ISA_HAS_POP) && (TARGET_64BIT)) +#define HAVE_negsi2 1 +#define HAVE_negdi2 (TARGET_64BIT && !TARGET_MIPS16) +#define HAVE_negsf2 ((mips_abs == MIPS_IEEE_754_2008 || !HONOR_NANS (SFmode)) && (TARGET_HARD_FLOAT)) +#define HAVE_negdf2 ((mips_abs == MIPS_IEEE_754_2008 || !HONOR_NANS (DFmode)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_negv2sf2 ((mips_abs == MIPS_IEEE_754_2008 || !HONOR_NANS (V2SFmode)) && (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT)) +#define HAVE_one_cmplsi2 1 +#define HAVE_one_cmpldi2 (TARGET_64BIT) +#define HAVE_truncdfsf2 (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT) +#define HAVE_truncdiqi2 (TARGET_64BIT) +#define HAVE_truncdihi2 (TARGET_64BIT) +#define HAVE_truncdisi2 (TARGET_64BIT) +#define HAVE_extendsidi2 (TARGET_64BIT) +#define HAVE_extendsfdf2 (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT) +#define HAVE_fix_truncdfsi2_insn (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && ISA_HAS_TRUNC_W) +#define HAVE_fix_truncdfsi2_macro (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && !ISA_HAS_TRUNC_W) +#define HAVE_fix_truncsfsi2_insn (TARGET_HARD_FLOAT && ISA_HAS_TRUNC_W) +#define HAVE_fix_truncsfsi2_macro (TARGET_HARD_FLOAT && !ISA_HAS_TRUNC_W) +#define HAVE_fix_truncdfdi2 (TARGET_HARD_FLOAT && TARGET_FLOAT64 && TARGET_DOUBLE_FLOAT) +#define HAVE_fix_truncsfdi2 (TARGET_HARD_FLOAT && TARGET_FLOAT64 && TARGET_DOUBLE_FLOAT) +#define HAVE_floatsidf2 (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT) +#define HAVE_floatdidf2 (TARGET_HARD_FLOAT && TARGET_FLOAT64 && TARGET_DOUBLE_FLOAT) +#define HAVE_floatsisf2 (TARGET_HARD_FLOAT) +#define HAVE_floatdisf2 (TARGET_HARD_FLOAT && TARGET_FLOAT64 && TARGET_DOUBLE_FLOAT) +#define HAVE_mov_lwl (!TARGET_MIPS16 && mips_mem_fits_mode_p (SImode, operands[1])) +#define HAVE_mov_ldl ((!TARGET_MIPS16 && mips_mem_fits_mode_p (DImode, operands[1])) && (TARGET_64BIT)) +#define HAVE_mov_lwr (!TARGET_MIPS16 && mips_mem_fits_mode_p (SImode, operands[1])) +#define HAVE_mov_ldr ((!TARGET_MIPS16 && mips_mem_fits_mode_p (DImode, operands[1])) && (TARGET_64BIT)) +#define HAVE_mov_swl (!TARGET_MIPS16 && mips_mem_fits_mode_p (SImode, operands[0])) +#define HAVE_mov_sdl ((!TARGET_MIPS16 && mips_mem_fits_mode_p (DImode, operands[0])) && (TARGET_64BIT)) +#define HAVE_mov_swr (!TARGET_MIPS16 && mips_mem_fits_mode_p (SImode, operands[0])) +#define HAVE_mov_sdr ((!TARGET_MIPS16 && mips_mem_fits_mode_p (DImode, operands[0])) && (TARGET_64BIT)) +#define HAVE_load_gotsi (Pmode == SImode) +#define HAVE_load_gotdi (Pmode == DImode) +#define HAVE_movccf (ISA_HAS_CCF) +#define HAVE_mfhisi_di (!TARGET_64BIT) +#define HAVE_mfhisi_ti (TARGET_64BIT) +#define HAVE_mfhidi_ti (TARGET_64BIT) +#define HAVE_mthisi_di (!TARGET_64BIT) +#define HAVE_mthisi_ti (TARGET_64BIT) +#define HAVE_mthidi_ti (TARGET_64BIT) +#define HAVE_load_lowdf ((TARGET_HARD_FLOAT) && (!TARGET_64BIT && TARGET_DOUBLE_FLOAT)) +#define HAVE_load_lowdi ((TARGET_HARD_FLOAT) && (!TARGET_64BIT && TARGET_DOUBLE_FLOAT)) +#define HAVE_load_lowv2sf ((TARGET_HARD_FLOAT) && (!TARGET_64BIT && TARGET_PAIRED_SINGLE_FLOAT)) +#define HAVE_load_lowv2si ((TARGET_HARD_FLOAT) && (!TARGET_64BIT && TARGET_LOONGSON_VECTORS)) +#define HAVE_load_lowv4hi ((TARGET_HARD_FLOAT) && (!TARGET_64BIT && TARGET_LOONGSON_VECTORS)) +#define HAVE_load_lowv8qi ((TARGET_HARD_FLOAT) && (!TARGET_64BIT && TARGET_LOONGSON_VECTORS)) +#define HAVE_load_lowtf ((TARGET_HARD_FLOAT) && (TARGET_64BIT && TARGET_FLOAT64)) +#define HAVE_load_highdf ((TARGET_HARD_FLOAT) && (!TARGET_64BIT && TARGET_DOUBLE_FLOAT)) +#define HAVE_load_highdi ((TARGET_HARD_FLOAT) && (!TARGET_64BIT && TARGET_DOUBLE_FLOAT)) +#define HAVE_load_highv2sf ((TARGET_HARD_FLOAT) && (!TARGET_64BIT && TARGET_PAIRED_SINGLE_FLOAT)) +#define HAVE_load_highv2si ((TARGET_HARD_FLOAT) && (!TARGET_64BIT && TARGET_LOONGSON_VECTORS)) +#define HAVE_load_highv4hi ((TARGET_HARD_FLOAT) && (!TARGET_64BIT && TARGET_LOONGSON_VECTORS)) +#define HAVE_load_highv8qi ((TARGET_HARD_FLOAT) && (!TARGET_64BIT && TARGET_LOONGSON_VECTORS)) +#define HAVE_load_hightf ((TARGET_HARD_FLOAT) && (TARGET_64BIT && TARGET_FLOAT64)) +#define HAVE_store_worddf ((TARGET_HARD_FLOAT) && (!TARGET_64BIT && TARGET_DOUBLE_FLOAT)) +#define HAVE_store_worddi ((TARGET_HARD_FLOAT) && (!TARGET_64BIT && TARGET_DOUBLE_FLOAT)) +#define HAVE_store_wordv2sf ((TARGET_HARD_FLOAT) && (!TARGET_64BIT && TARGET_PAIRED_SINGLE_FLOAT)) +#define HAVE_store_wordv2si ((TARGET_HARD_FLOAT) && (!TARGET_64BIT && TARGET_LOONGSON_VECTORS)) +#define HAVE_store_wordv4hi ((TARGET_HARD_FLOAT) && (!TARGET_64BIT && TARGET_LOONGSON_VECTORS)) +#define HAVE_store_wordv8qi ((TARGET_HARD_FLOAT) && (!TARGET_64BIT && TARGET_LOONGSON_VECTORS)) +#define HAVE_store_wordtf ((TARGET_HARD_FLOAT) && (TARGET_64BIT && TARGET_FLOAT64)) +#define HAVE_mthc1df ((TARGET_HARD_FLOAT && ISA_HAS_MXHC1) && (!TARGET_64BIT && TARGET_DOUBLE_FLOAT)) +#define HAVE_mthc1di ((TARGET_HARD_FLOAT && ISA_HAS_MXHC1) && (!TARGET_64BIT && TARGET_DOUBLE_FLOAT)) +#define HAVE_mthc1v2sf ((TARGET_HARD_FLOAT && ISA_HAS_MXHC1) && (!TARGET_64BIT && TARGET_PAIRED_SINGLE_FLOAT)) +#define HAVE_mthc1v2si ((TARGET_HARD_FLOAT && ISA_HAS_MXHC1) && (!TARGET_64BIT && TARGET_LOONGSON_VECTORS)) +#define HAVE_mthc1v4hi ((TARGET_HARD_FLOAT && ISA_HAS_MXHC1) && (!TARGET_64BIT && TARGET_LOONGSON_VECTORS)) +#define HAVE_mthc1v8qi ((TARGET_HARD_FLOAT && ISA_HAS_MXHC1) && (!TARGET_64BIT && TARGET_LOONGSON_VECTORS)) +#define HAVE_mthc1tf ((TARGET_HARD_FLOAT && ISA_HAS_MXHC1) && (TARGET_64BIT && TARGET_FLOAT64)) +#define HAVE_mfhc1df ((TARGET_HARD_FLOAT && ISA_HAS_MXHC1) && (!TARGET_64BIT && TARGET_DOUBLE_FLOAT)) +#define HAVE_mfhc1di ((TARGET_HARD_FLOAT && ISA_HAS_MXHC1) && (!TARGET_64BIT && TARGET_DOUBLE_FLOAT)) +#define HAVE_mfhc1v2sf ((TARGET_HARD_FLOAT && ISA_HAS_MXHC1) && (!TARGET_64BIT && TARGET_PAIRED_SINGLE_FLOAT)) +#define HAVE_mfhc1v2si ((TARGET_HARD_FLOAT && ISA_HAS_MXHC1) && (!TARGET_64BIT && TARGET_LOONGSON_VECTORS)) +#define HAVE_mfhc1v4hi ((TARGET_HARD_FLOAT && ISA_HAS_MXHC1) && (!TARGET_64BIT && TARGET_LOONGSON_VECTORS)) +#define HAVE_mfhc1v8qi ((TARGET_HARD_FLOAT && ISA_HAS_MXHC1) && (!TARGET_64BIT && TARGET_LOONGSON_VECTORS)) +#define HAVE_mfhc1tf ((TARGET_HARD_FLOAT && ISA_HAS_MXHC1) && (TARGET_64BIT && TARGET_FLOAT64)) +#define HAVE_loadgp_newabi_si ((mips_current_loadgp_style () == LOADGP_NEWABI) && (Pmode == SImode)) +#define HAVE_loadgp_newabi_di ((mips_current_loadgp_style () == LOADGP_NEWABI) && (Pmode == DImode)) +#define HAVE_loadgp_absolute_si ((mips_current_loadgp_style () == LOADGP_ABSOLUTE) && (Pmode == SImode)) +#define HAVE_loadgp_absolute_di ((mips_current_loadgp_style () == LOADGP_ABSOLUTE) && (Pmode == DImode)) +#define HAVE_loadgp_blockage 1 +#define HAVE_loadgp_rtp_si ((mips_current_loadgp_style () == LOADGP_RTP) && (Pmode == SImode)) +#define HAVE_loadgp_rtp_di ((mips_current_loadgp_style () == LOADGP_RTP) && (Pmode == DImode)) +#define HAVE_copygp_mips16_si ((TARGET_MIPS16) && (Pmode == SImode)) +#define HAVE_copygp_mips16_di ((TARGET_MIPS16) && (Pmode == DImode)) +#define HAVE_potential_cprestore_si ((!TARGET_CPRESTORE_DIRECTIVE || operands[2] == pic_offset_table_rtx) && (Pmode == SImode)) +#define HAVE_potential_cprestore_di ((!TARGET_CPRESTORE_DIRECTIVE || operands[2] == pic_offset_table_rtx) && (Pmode == DImode)) +#define HAVE_cprestore_si ((TARGET_CPRESTORE_DIRECTIVE) && (Pmode == SImode)) +#define HAVE_cprestore_di ((TARGET_CPRESTORE_DIRECTIVE) && (Pmode == DImode)) +#define HAVE_use_cprestore_si (Pmode == SImode) +#define HAVE_use_cprestore_di (Pmode == DImode) +#define HAVE_sync (GENERATE_SYNC) +#define HAVE_synci (TARGET_SYNCI) +#define HAVE_rdhwr_synci_step_si ((ISA_HAS_SYNCI) && (Pmode == SImode)) +#define HAVE_rdhwr_synci_step_di ((ISA_HAS_SYNCI) && (Pmode == DImode)) +#define HAVE_clear_hazard_si ((ISA_HAS_SYNCI) && (Pmode == SImode)) +#define HAVE_clear_hazard_di ((ISA_HAS_SYNCI) && (Pmode == DImode)) +#define HAVE_mips_cache (ISA_HAS_CACHE) +#define HAVE_r10k_cache_barrier (ISA_HAS_CACHE) +#define HAVE_lsa (ISA_HAS_LSA) +#define HAVE_dlsa ((ISA_HAS_DLSA) && (TARGET_64BIT)) +#define HAVE_rotrsi3 (ISA_HAS_ROR) +#define HAVE_rotrdi3 ((ISA_HAS_ROR) && (TARGET_64BIT)) +#define HAVE_bswaphi2 (ISA_HAS_WSBH) +#define HAVE_bswapsi2 (ISA_HAS_WSBH && ISA_HAS_ROR) +#define HAVE_bswapdi2 (TARGET_64BIT && ISA_HAS_WSBH) +#define HAVE_wsbh (ISA_HAS_WSBH) +#define HAVE_dsbh (TARGET_64BIT && ISA_HAS_WSBH) +#define HAVE_dshd (TARGET_64BIT && ISA_HAS_WSBH) +#define HAVE_sunordered_sf_using_cc (((!ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_suneq_sf_using_cc (((!ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_sunlt_sf_using_cc (((!ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_sunle_sf_using_cc (((!ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_seq_sf_using_cc (((!ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_slt_sf_using_cc (((!ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_sle_sf_using_cc (((!ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_sunordered_df_using_cc (((!ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_suneq_df_using_cc (((!ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_sunlt_df_using_cc (((!ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_sunle_df_using_cc (((!ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_seq_df_using_cc (((!ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_slt_df_using_cc (((!ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_sle_df_using_cc (((!ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_sunordered_sf_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_suneq_sf_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_sunlt_sf_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_sunle_sf_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_seq_sf_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_slt_sf_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_sle_sf_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_sordered_sf_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_sltgt_sf_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_sne_sf_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_sunordered_df_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_suneq_df_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_sunlt_df_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_sunle_df_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_seq_df_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_slt_df_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_sle_df_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_sordered_df_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_sltgt_df_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_sne_df_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_sge_sf_using_cc (((!ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_sgt_sf_using_cc (((!ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_sunge_sf_using_cc (((!ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_sungt_sf_using_cc (((!ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_sge_df_using_cc (((!ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_sgt_df_using_cc (((!ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_sunge_df_using_cc (((!ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_sungt_df_using_cc (((!ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_sge_sf_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_sgt_sf_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_sunge_sf_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_sungt_sf_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT)) && (TARGET_HARD_FLOAT)) +#define HAVE_sge_df_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_sgt_df_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_sunge_df_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_sungt_df_using_ccf (((ISA_HAS_CCF) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_indirect_jump_si (Pmode == SImode) +#define HAVE_indirect_jump_di (Pmode == DImode) +#define HAVE_indirect_jump_and_restore_si (Pmode == SImode) +#define HAVE_indirect_jump_and_restore_di (Pmode == DImode) +#define HAVE_tablejump_si (Pmode == SImode) +#define HAVE_tablejump_di (Pmode == DImode) +#define HAVE_casesi_internal_mips16_si ((TARGET_MIPS16_SHORT_JUMP_TABLES) && (Pmode == SImode)) +#define HAVE_casesi_internal_mips16_di ((TARGET_MIPS16_SHORT_JUMP_TABLES) && (Pmode == DImode)) +#define HAVE_blockage 1 +#define HAVE_probe_stack_range_si (Pmode == SImode) +#define HAVE_probe_stack_range_di (Pmode == DImode) +#define HAVE_return_internal 1 +#define HAVE_simple_return_internal 1 +#define HAVE_mips_eret 1 +#define HAVE_mips_deret 1 +#define HAVE_mips_di 1 +#define HAVE_mips_ehb 1 +#define HAVE_mips_rdpgpr_si (Pmode == SImode) +#define HAVE_mips_rdpgpr_di (Pmode == DImode) +#define HAVE_cop0_move 1 +#define HAVE_eh_set_lr_si (! TARGET_64BIT) +#define HAVE_eh_set_lr_di (TARGET_64BIT) +#define HAVE_restore_gp_si ((TARGET_CALL_CLOBBERED_GP) && (Pmode == SImode)) +#define HAVE_restore_gp_di ((TARGET_CALL_CLOBBERED_GP) && (Pmode == DImode)) +#define HAVE_move_gpsi 1 +#define HAVE_move_gpdi (TARGET_64BIT) +#define HAVE_load_callsi ((TARGET_USE_GOT) && (Pmode == SImode)) +#define HAVE_load_calldi ((TARGET_USE_GOT) && (Pmode == DImode)) +#define HAVE_set_got_version (TARGET_USE_GOT) +#define HAVE_update_got_version (TARGET_USE_GOT) +#define HAVE_sibcall_internal (TARGET_SIBCALLS && SIBLING_CALL_P (insn)) +#define HAVE_sibcall_value_internal (TARGET_SIBCALLS && SIBLING_CALL_P (insn)) +#define HAVE_sibcall_value_multiple_internal (TARGET_SIBCALLS && SIBLING_CALL_P (insn)) +#define HAVE_call_internal 1 +#define HAVE_call_split (TARGET_SPLIT_CALLS) +#define HAVE_call_internal_direct 1 +#define HAVE_call_direct_split (TARGET_SPLIT_CALLS) +#define HAVE_call_value_internal 1 +#define HAVE_call_value_split (TARGET_SPLIT_CALLS) +#define HAVE_call_value_internal_direct 1 +#define HAVE_call_value_direct_split (TARGET_SPLIT_CALLS) +#define HAVE_call_value_multiple_internal 1 +#define HAVE_call_value_multiple_split (TARGET_SPLIT_CALLS) +#define HAVE_prefetch (ISA_HAS_PREFETCH && TARGET_EXPLICIT_RELOCS) +#define HAVE_nop 1 +#define HAVE_hazard_nop 1 +#define HAVE_insn_pseudo 1 +#define HAVE_consttable 1 +#define HAVE_consttable_end 1 +#define HAVE_consttable_tls_reloc (TARGET_MIPS16_PCREL_LOADS) +#define HAVE_consttable_int (TARGET_MIPS16) +#define HAVE_consttable_float (TARGET_MIPS16) +#define HAVE_align 1 +#define HAVE_tls_get_tp_si ((HAVE_AS_TLS && !TARGET_MIPS16) && (Pmode == SImode)) +#define HAVE_tls_get_tp_di ((HAVE_AS_TLS && !TARGET_MIPS16) && (Pmode == DImode)) +#define HAVE_tls_get_tp_mips16_si ((HAVE_AS_TLS && TARGET_MIPS16) && (Pmode == SImode)) +#define HAVE_tls_get_tp_mips16_di ((HAVE_AS_TLS && TARGET_MIPS16) && (Pmode == DImode)) +#define HAVE_mips_get_fcsr_mips16_si ((TARGET_HARD_FLOAT_ABI && TARGET_MIPS16) && (Pmode == SImode)) +#define HAVE_mips_get_fcsr_mips16_di ((TARGET_HARD_FLOAT_ABI && TARGET_MIPS16) && (Pmode == DImode)) +#define HAVE_mips_set_fcsr_mips16_si ((TARGET_HARD_FLOAT_ABI && TARGET_MIPS16) && (Pmode == SImode)) +#define HAVE_mips_set_fcsr_mips16_di ((TARGET_HARD_FLOAT_ABI && TARGET_MIPS16) && (Pmode == DImode)) +#define HAVE_sync_compare_and_swapsi (GENERATE_LL_SC) +#define HAVE_sync_compare_and_swapdi ((GENERATE_LL_SC) && (TARGET_64BIT)) +#define HAVE_compare_and_swap_12 (GENERATE_LL_SC) +#define HAVE_sync_addsi (GENERATE_LL_SC) +#define HAVE_sync_adddi ((GENERATE_LL_SC) && (TARGET_64BIT)) +#define HAVE_sync_add_12 (GENERATE_LL_SC) +#define HAVE_sync_sub_12 (GENERATE_LL_SC) +#define HAVE_sync_ior_12 (GENERATE_LL_SC) +#define HAVE_sync_xor_12 (GENERATE_LL_SC) +#define HAVE_sync_and_12 (GENERATE_LL_SC) +#define HAVE_sync_old_add_12 (GENERATE_LL_SC) +#define HAVE_sync_old_sub_12 (GENERATE_LL_SC) +#define HAVE_sync_old_ior_12 (GENERATE_LL_SC) +#define HAVE_sync_old_xor_12 (GENERATE_LL_SC) +#define HAVE_sync_old_and_12 (GENERATE_LL_SC) +#define HAVE_sync_new_add_12 (GENERATE_LL_SC) +#define HAVE_sync_new_sub_12 (GENERATE_LL_SC) +#define HAVE_sync_new_ior_12 (GENERATE_LL_SC) +#define HAVE_sync_new_xor_12 (GENERATE_LL_SC) +#define HAVE_sync_new_and_12 (GENERATE_LL_SC) +#define HAVE_sync_nand_12 (GENERATE_LL_SC) +#define HAVE_sync_old_nand_12 (GENERATE_LL_SC) +#define HAVE_sync_new_nand_12 (GENERATE_LL_SC) +#define HAVE_sync_subsi (GENERATE_LL_SC) +#define HAVE_sync_subdi ((GENERATE_LL_SC) && (TARGET_64BIT)) +#define HAVE_sync_old_addsi (GENERATE_LL_SC) +#define HAVE_sync_old_adddi ((GENERATE_LL_SC) && (TARGET_64BIT)) +#define HAVE_sync_old_subsi (GENERATE_LL_SC) +#define HAVE_sync_old_subdi ((GENERATE_LL_SC) && (TARGET_64BIT)) +#define HAVE_sync_new_addsi (GENERATE_LL_SC) +#define HAVE_sync_new_adddi ((GENERATE_LL_SC) && (TARGET_64BIT)) +#define HAVE_sync_new_subsi (GENERATE_LL_SC) +#define HAVE_sync_new_subdi ((GENERATE_LL_SC) && (TARGET_64BIT)) +#define HAVE_sync_iorsi (GENERATE_LL_SC) +#define HAVE_sync_xorsi (GENERATE_LL_SC) +#define HAVE_sync_andsi (GENERATE_LL_SC) +#define HAVE_sync_iordi ((GENERATE_LL_SC) && (TARGET_64BIT)) +#define HAVE_sync_xordi ((GENERATE_LL_SC) && (TARGET_64BIT)) +#define HAVE_sync_anddi ((GENERATE_LL_SC) && (TARGET_64BIT)) +#define HAVE_sync_old_iorsi (GENERATE_LL_SC) +#define HAVE_sync_old_xorsi (GENERATE_LL_SC) +#define HAVE_sync_old_andsi (GENERATE_LL_SC) +#define HAVE_sync_old_iordi ((GENERATE_LL_SC) && (TARGET_64BIT)) +#define HAVE_sync_old_xordi ((GENERATE_LL_SC) && (TARGET_64BIT)) +#define HAVE_sync_old_anddi ((GENERATE_LL_SC) && (TARGET_64BIT)) +#define HAVE_sync_new_iorsi (GENERATE_LL_SC) +#define HAVE_sync_new_xorsi (GENERATE_LL_SC) +#define HAVE_sync_new_andsi (GENERATE_LL_SC) +#define HAVE_sync_new_iordi ((GENERATE_LL_SC) && (TARGET_64BIT)) +#define HAVE_sync_new_xordi ((GENERATE_LL_SC) && (TARGET_64BIT)) +#define HAVE_sync_new_anddi ((GENERATE_LL_SC) && (TARGET_64BIT)) +#define HAVE_sync_nandsi (GENERATE_LL_SC) +#define HAVE_sync_nanddi ((GENERATE_LL_SC) && (TARGET_64BIT)) +#define HAVE_sync_old_nandsi (GENERATE_LL_SC) +#define HAVE_sync_old_nanddi ((GENERATE_LL_SC) && (TARGET_64BIT)) +#define HAVE_sync_new_nandsi (GENERATE_LL_SC) +#define HAVE_sync_new_nanddi ((GENERATE_LL_SC) && (TARGET_64BIT)) +#define HAVE_sync_lock_test_and_setsi (GENERATE_LL_SC) +#define HAVE_sync_lock_test_and_setdi ((GENERATE_LL_SC) && (TARGET_64BIT)) +#define HAVE_test_and_set_12 (GENERATE_LL_SC) +#define HAVE_atomic_compare_and_swapsi (GENERATE_LL_SC) +#define HAVE_atomic_compare_and_swapdi ((GENERATE_LL_SC) && (TARGET_64BIT)) +#define HAVE_atomic_exchangesi_llsc (GENERATE_LL_SC && !ISA_HAS_SWAP) +#define HAVE_atomic_exchangedi_llsc ((GENERATE_LL_SC && !ISA_HAS_SWAP) && (TARGET_64BIT)) +#define HAVE_atomic_exchangesi_swap (ISA_HAS_SWAP) +#define HAVE_atomic_exchangedi_swap ((ISA_HAS_SWAP) && (TARGET_64BIT)) +#define HAVE_atomic_fetch_addsi_llsc (GENERATE_LL_SC && !ISA_HAS_LDADD) +#define HAVE_atomic_fetch_adddi_llsc ((GENERATE_LL_SC && !ISA_HAS_LDADD) && (TARGET_64BIT)) +#define HAVE_atomic_fetch_addsi_ldadd (ISA_HAS_LDADD) +#define HAVE_atomic_fetch_adddi_ldadd ((ISA_HAS_LDADD) && (TARGET_64BIT)) +#define HAVE_mips_cond_move_tf_ps (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_vec_perm_const_ps (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_vec_concatv2sf (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_vec_extractv2sf (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_mips_alnv_ps (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_mips_addr_ps (TARGET_HARD_FLOAT && TARGET_MIPS3D) +#define HAVE_mips_cvt_pw_ps (TARGET_HARD_FLOAT && TARGET_MIPS3D) +#define HAVE_mips_cvt_ps_pw (TARGET_HARD_FLOAT && TARGET_MIPS3D) +#define HAVE_mips_mulr_ps (TARGET_HARD_FLOAT && TARGET_MIPS3D) +#define HAVE_mips_cabs_cond_s ((TARGET_HARD_FLOAT && TARGET_MIPS3D) && (TARGET_HARD_FLOAT)) +#define HAVE_mips_cabs_cond_d ((TARGET_HARD_FLOAT && TARGET_MIPS3D) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_mips_c_cond_4s (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_mips_cabs_cond_4s (TARGET_HARD_FLOAT && TARGET_MIPS3D) +#define HAVE_mips_c_cond_ps (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_mips_cabs_cond_ps (TARGET_HARD_FLOAT && TARGET_MIPS3D) +#define HAVE_sunordered_ps (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_suneq_ps (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_sunlt_ps (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_sunle_ps (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_seq_ps (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_slt_ps (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_sle_ps (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_sordered_ps ((TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) && (ISA_HAS_CCF)) +#define HAVE_sltgt_ps ((TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) && (ISA_HAS_CCF)) +#define HAVE_sne_ps ((TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) && (ISA_HAS_CCF)) +#define HAVE_sge_ps (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_sgt_ps (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_sunge_ps (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_sungt_ps (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_bc1any4t (TARGET_HARD_FLOAT && TARGET_MIPS3D) +#define HAVE_bc1any4f (TARGET_HARD_FLOAT && TARGET_MIPS3D) +#define HAVE_bc1any2t (TARGET_HARD_FLOAT && TARGET_MIPS3D) +#define HAVE_bc1any2f (TARGET_HARD_FLOAT && TARGET_MIPS3D) +#define HAVE_mips_rsqrt1_s ((TARGET_HARD_FLOAT && TARGET_MIPS3D) && (TARGET_HARD_FLOAT)) +#define HAVE_mips_rsqrt1_d ((TARGET_HARD_FLOAT && TARGET_MIPS3D) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_mips_rsqrt1_ps ((TARGET_HARD_FLOAT && TARGET_MIPS3D) && (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT)) +#define HAVE_mips_rsqrt2_s ((TARGET_HARD_FLOAT && TARGET_MIPS3D) && (TARGET_HARD_FLOAT)) +#define HAVE_mips_rsqrt2_d ((TARGET_HARD_FLOAT && TARGET_MIPS3D) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_mips_rsqrt2_ps ((TARGET_HARD_FLOAT && TARGET_MIPS3D) && (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT)) +#define HAVE_mips_recip1_s ((TARGET_HARD_FLOAT && TARGET_MIPS3D) && (TARGET_HARD_FLOAT)) +#define HAVE_mips_recip1_d ((TARGET_HARD_FLOAT && TARGET_MIPS3D) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_mips_recip1_ps ((TARGET_HARD_FLOAT && TARGET_MIPS3D) && (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT)) +#define HAVE_mips_recip2_s ((TARGET_HARD_FLOAT && TARGET_MIPS3D) && (TARGET_HARD_FLOAT)) +#define HAVE_mips_recip2_d ((TARGET_HARD_FLOAT && TARGET_MIPS3D) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_mips_recip2_ps ((TARGET_HARD_FLOAT && TARGET_MIPS3D) && (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT)) +#define HAVE_addv2hi3 (ISA_HAS_DSP) +#define HAVE_addv4qi3 (ISA_HAS_DSP) +#define HAVE_mips_addq_s_w (ISA_HAS_DSP) +#define HAVE_mips_addq_s_ph (ISA_HAS_DSP) +#define HAVE_mips_addu_s_qb (ISA_HAS_DSP) +#define HAVE_subv2hi3 (ISA_HAS_DSP) +#define HAVE_subv4qi3 (ISA_HAS_DSP) +#define HAVE_mips_subq_s_w (ISA_HAS_DSP) +#define HAVE_mips_subq_s_ph (ISA_HAS_DSP) +#define HAVE_mips_subu_s_qb (ISA_HAS_DSP) +#define HAVE_mips_addsc (ISA_HAS_DSP) +#define HAVE_mips_addwc (ISA_HAS_DSP) +#define HAVE_mips_modsub (ISA_HAS_DSP) +#define HAVE_mips_raddu_w_qb (ISA_HAS_DSP) +#define HAVE_mips_absq_s_w (ISA_HAS_DSP) +#define HAVE_mips_absq_s_ph (ISA_HAS_DSP) +#define HAVE_mips_precrq_qb_ph (ISA_HAS_DSP) +#define HAVE_mips_precrq_ph_w (ISA_HAS_DSP) +#define HAVE_mips_precrq_rs_ph_w (ISA_HAS_DSP) +#define HAVE_mips_precrqu_s_qb_ph (ISA_HAS_DSP) +#define HAVE_mips_preceq_w_phl (ISA_HAS_DSP) +#define HAVE_mips_preceq_w_phr (ISA_HAS_DSP) +#define HAVE_mips_precequ_ph_qbl (ISA_HAS_DSP) +#define HAVE_mips_precequ_ph_qbr (ISA_HAS_DSP) +#define HAVE_mips_precequ_ph_qbla (ISA_HAS_DSP) +#define HAVE_mips_precequ_ph_qbra (ISA_HAS_DSP) +#define HAVE_mips_preceu_ph_qbl (ISA_HAS_DSP) +#define HAVE_mips_preceu_ph_qbr (ISA_HAS_DSP) +#define HAVE_mips_preceu_ph_qbla (ISA_HAS_DSP) +#define HAVE_mips_preceu_ph_qbra (ISA_HAS_DSP) +#define HAVE_mips_shll_ph (ISA_HAS_DSP) +#define HAVE_mips_shll_qb (ISA_HAS_DSP) +#define HAVE_mips_shll_s_w (ISA_HAS_DSP) +#define HAVE_mips_shll_s_ph (ISA_HAS_DSP) +#define HAVE_mips_shrl_qb (ISA_HAS_DSP) +#define HAVE_mips_shra_ph (ISA_HAS_DSP) +#define HAVE_mips_shra_r_w (ISA_HAS_DSP) +#define HAVE_mips_shra_r_ph (ISA_HAS_DSP) +#define HAVE_mips_muleu_s_ph_qbl (ISA_HAS_DSP) +#define HAVE_mips_muleu_s_ph_qbr (ISA_HAS_DSP) +#define HAVE_mips_mulq_rs_ph (ISA_HAS_DSP) +#define HAVE_mips_muleq_s_w_phl (ISA_HAS_DSP) +#define HAVE_mips_muleq_s_w_phr (ISA_HAS_DSP) +#define HAVE_mips_dpau_h_qbl (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_dpau_h_qbr (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_dpsu_h_qbl (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_dpsu_h_qbr (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_dpaq_s_w_ph (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_dpsq_s_w_ph (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_mulsaq_s_w_ph (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_dpaq_sa_l_w (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_dpsq_sa_l_w (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_maq_s_w_phl (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_maq_s_w_phr (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_maq_sa_w_phl (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_maq_sa_w_phr (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_bitrev (ISA_HAS_DSP) +#define HAVE_mips_insv (ISA_HAS_DSP) +#define HAVE_mips_repl_qb (ISA_HAS_DSP) +#define HAVE_mips_repl_ph (ISA_HAS_DSP) +#define HAVE_mips_cmp_eq_ph (ISA_HAS_DSP) +#define HAVE_mips_cmpu_eq_qb (ISA_HAS_DSP) +#define HAVE_mips_cmp_lt_ph (ISA_HAS_DSP) +#define HAVE_mips_cmpu_lt_qb (ISA_HAS_DSP) +#define HAVE_mips_cmp_le_ph (ISA_HAS_DSP) +#define HAVE_mips_cmpu_le_qb (ISA_HAS_DSP) +#define HAVE_mips_cmpgu_eq_qb (ISA_HAS_DSP) +#define HAVE_mips_cmpgu_lt_qb (ISA_HAS_DSP) +#define HAVE_mips_cmpgu_le_qb (ISA_HAS_DSP) +#define HAVE_mips_pick_ph (ISA_HAS_DSP) +#define HAVE_mips_pick_qb (ISA_HAS_DSP) +#define HAVE_mips_packrl_ph (ISA_HAS_DSP) +#define HAVE_mips_extr_w (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_extr_r_w (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_extr_rs_w (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_extr_s_h (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_extp (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_extpdp (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_shilo (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_mthlip (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_wrdsp (ISA_HAS_DSP) +#define HAVE_mips_rddsp (ISA_HAS_DSP) +#define HAVE_mips_lbx_extsi_si ((ISA_HAS_LBX) && (Pmode == SImode)) +#define HAVE_mips_lbux_extsi_si ((ISA_HAS_LBUX) && (Pmode == SImode)) +#define HAVE_mips_lbx_extdi_si ((ISA_HAS_LBX) && ((((TARGET_64BIT) && (Pmode == SImode)) && (Pmode == SImode)) && (Pmode == SImode))) +#define HAVE_mips_lbux_extdi_si ((ISA_HAS_LBUX) && ((((TARGET_64BIT) && (Pmode == SImode)) && (Pmode == SImode)) && (Pmode == SImode))) +#define HAVE_mips_lhx_extsi_si ((ISA_HAS_LHX) && (Pmode == SImode)) +#define HAVE_mips_lhux_extsi_si ((ISA_HAS_LHUX) && (Pmode == SImode)) +#define HAVE_mips_lhx_extdi_si ((ISA_HAS_LHX) && ((((TARGET_64BIT) && (Pmode == SImode)) && (Pmode == SImode)) && (Pmode == SImode))) +#define HAVE_mips_lhux_extdi_si ((ISA_HAS_LHUX) && ((((TARGET_64BIT) && (Pmode == SImode)) && (Pmode == SImode)) && (Pmode == SImode))) +#define HAVE_mips_lbx_extsi_di ((ISA_HAS_LBX) && (Pmode == DImode)) +#define HAVE_mips_lbux_extsi_di ((ISA_HAS_LBUX) && (Pmode == DImode)) +#define HAVE_mips_lbx_extdi_di ((ISA_HAS_LBX) && ((((TARGET_64BIT) && (Pmode == DImode)) && (Pmode == DImode)) && (Pmode == DImode))) +#define HAVE_mips_lbux_extdi_di ((ISA_HAS_LBUX) && ((((TARGET_64BIT) && (Pmode == DImode)) && (Pmode == DImode)) && (Pmode == DImode))) +#define HAVE_mips_lhx_extsi_di ((ISA_HAS_LHX) && (Pmode == DImode)) +#define HAVE_mips_lhux_extsi_di ((ISA_HAS_LHUX) && (Pmode == DImode)) +#define HAVE_mips_lhx_extdi_di ((ISA_HAS_LHX) && ((((TARGET_64BIT) && (Pmode == DImode)) && (Pmode == DImode)) && (Pmode == DImode))) +#define HAVE_mips_lhux_extdi_di ((ISA_HAS_LHUX) && ((((TARGET_64BIT) && (Pmode == DImode)) && (Pmode == DImode)) && (Pmode == DImode))) +#define HAVE_mips_lwx_si ((ISA_HAS_LWX) && (Pmode == SImode)) +#define HAVE_mips_ldx_si ((ISA_HAS_LDX) && ((((TARGET_64BIT) && (Pmode == SImode)) && (Pmode == SImode)) && (Pmode == SImode))) +#define HAVE_mips_lwx_di ((ISA_HAS_LWX) && (Pmode == DImode)) +#define HAVE_mips_ldx_di ((ISA_HAS_LDX) && ((((TARGET_64BIT) && (Pmode == DImode)) && (Pmode == DImode)) && (Pmode == DImode))) +#define HAVE_mips_bposge (ISA_HAS_DSP) +#define HAVE_mips_absq_s_qb (ISA_HAS_DSPR2) +#define HAVE_mips_addu_ph (ISA_HAS_DSPR2) +#define HAVE_mips_addu_s_ph (ISA_HAS_DSPR2) +#define HAVE_mips_adduh_qb (ISA_HAS_DSPR2) +#define HAVE_mips_adduh_r_qb (ISA_HAS_DSPR2) +#define HAVE_mips_append (ISA_HAS_DSPR2) +#define HAVE_mips_balign (ISA_HAS_DSPR2) +#define HAVE_mips_cmpgdu_eq_qb (ISA_HAS_DSPR2) +#define HAVE_mips_cmpgdu_lt_qb (ISA_HAS_DSPR2) +#define HAVE_mips_cmpgdu_le_qb (ISA_HAS_DSPR2) +#define HAVE_mips_dpa_w_ph (ISA_HAS_DSPR2 && !TARGET_64BIT) +#define HAVE_mips_dps_w_ph (ISA_HAS_DSPR2 && !TARGET_64BIT) +#define HAVE_mulv2hi3 (ISA_HAS_DSPR2) +#define HAVE_mips_mul_s_ph (ISA_HAS_DSPR2) +#define HAVE_mips_mulq_rs_w (ISA_HAS_DSPR2) +#define HAVE_mips_mulq_s_ph (ISA_HAS_DSPR2) +#define HAVE_mips_mulq_s_w (ISA_HAS_DSPR2) +#define HAVE_mips_mulsa_w_ph (ISA_HAS_DSPR2 && !TARGET_64BIT) +#define HAVE_mips_precr_qb_ph (ISA_HAS_DSPR2) +#define HAVE_mips_precr_sra_ph_w (ISA_HAS_DSPR2) +#define HAVE_mips_precr_sra_r_ph_w (ISA_HAS_DSPR2) +#define HAVE_mips_prepend (ISA_HAS_DSPR2) +#define HAVE_mips_shra_qb (ISA_HAS_DSPR2) +#define HAVE_mips_shra_r_qb (ISA_HAS_DSPR2) +#define HAVE_mips_shrl_ph (ISA_HAS_DSPR2) +#define HAVE_mips_subu_ph (ISA_HAS_DSPR2) +#define HAVE_mips_subu_s_ph (ISA_HAS_DSPR2) +#define HAVE_mips_subuh_qb (ISA_HAS_DSPR2) +#define HAVE_mips_subuh_r_qb (ISA_HAS_DSPR2) +#define HAVE_mips_addqh_ph (ISA_HAS_DSPR2) +#define HAVE_mips_addqh_r_ph (ISA_HAS_DSPR2) +#define HAVE_mips_addqh_w (ISA_HAS_DSPR2) +#define HAVE_mips_addqh_r_w (ISA_HAS_DSPR2) +#define HAVE_mips_subqh_ph (ISA_HAS_DSPR2) +#define HAVE_mips_subqh_r_ph (ISA_HAS_DSPR2) +#define HAVE_mips_subqh_w (ISA_HAS_DSPR2) +#define HAVE_mips_subqh_r_w (ISA_HAS_DSPR2) +#define HAVE_mips_dpax_w_ph (ISA_HAS_DSPR2 && !TARGET_64BIT) +#define HAVE_mips_dpsx_w_ph (ISA_HAS_DSPR2 && !TARGET_64BIT) +#define HAVE_mips_dpaqx_s_w_ph (ISA_HAS_DSPR2 && !TARGET_64BIT) +#define HAVE_mips_dpaqx_sa_w_ph (ISA_HAS_DSPR2 && !TARGET_64BIT) +#define HAVE_mips_dpsqx_s_w_ph (ISA_HAS_DSPR2 && !TARGET_64BIT) +#define HAVE_mips_dpsqx_sa_w_ph (ISA_HAS_DSPR2 && !TARGET_64BIT) +#define HAVE_addqq3 1 +#define HAVE_addhq3 1 +#define HAVE_addsq3 1 +#define HAVE_adddq3 (TARGET_64BIT) +#define HAVE_adduqq3 1 +#define HAVE_adduhq3 1 +#define HAVE_addusq3 1 +#define HAVE_addudq3 (TARGET_64BIT) +#define HAVE_addha3 1 +#define HAVE_addsa3 1 +#define HAVE_addda3 (TARGET_64BIT) +#define HAVE_adduha3 1 +#define HAVE_addusa3 1 +#define HAVE_adduda3 (TARGET_64BIT) +#define HAVE_usadduqq3 (ISA_HAS_DSP) +#define HAVE_usadduhq3 (ISA_HAS_DSPR2) +#define HAVE_usadduha3 (ISA_HAS_DSPR2) +#define HAVE_usaddv4uqq3 (ISA_HAS_DSP) +#define HAVE_usaddv2uhq3 (ISA_HAS_DSPR2) +#define HAVE_usaddv2uha3 (ISA_HAS_DSPR2) +#define HAVE_ssaddhq3 (ISA_HAS_DSP) +#define HAVE_ssaddsq3 (ISA_HAS_DSP) +#define HAVE_ssaddha3 (ISA_HAS_DSP) +#define HAVE_ssaddsa3 (ISA_HAS_DSP) +#define HAVE_ssaddv2hq3 (ISA_HAS_DSP) +#define HAVE_ssaddv2ha3 (ISA_HAS_DSP) +#define HAVE_subqq3 1 +#define HAVE_subhq3 1 +#define HAVE_subsq3 1 +#define HAVE_subdq3 (TARGET_64BIT) +#define HAVE_subuqq3 1 +#define HAVE_subuhq3 1 +#define HAVE_subusq3 1 +#define HAVE_subudq3 (TARGET_64BIT) +#define HAVE_subha3 1 +#define HAVE_subsa3 1 +#define HAVE_subda3 (TARGET_64BIT) +#define HAVE_subuha3 1 +#define HAVE_subusa3 1 +#define HAVE_subuda3 (TARGET_64BIT) +#define HAVE_ussubuqq3 (ISA_HAS_DSP) +#define HAVE_ussubuhq3 (ISA_HAS_DSPR2) +#define HAVE_ussubuha3 (ISA_HAS_DSPR2) +#define HAVE_ussubv4uqq3 (ISA_HAS_DSP) +#define HAVE_ussubv2uhq3 (ISA_HAS_DSPR2) +#define HAVE_ussubv2uha3 (ISA_HAS_DSPR2) +#define HAVE_sssubhq3 (ISA_HAS_DSP) +#define HAVE_sssubsq3 (ISA_HAS_DSP) +#define HAVE_sssubha3 (ISA_HAS_DSP) +#define HAVE_sssubsa3 (ISA_HAS_DSP) +#define HAVE_sssubv2hq3 (ISA_HAS_DSP) +#define HAVE_sssubv2ha3 (ISA_HAS_DSP) +#define HAVE_ssmulv2hq3 (ISA_HAS_DSP) +#define HAVE_ssmulhq3 (ISA_HAS_DSP) +#define HAVE_ssmulsq3 (ISA_HAS_DSPR2) +#define HAVE_ssmaddsqdq4 (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_ssmsubsqdq4 (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_jraddiusp (TARGET_MICROMIPS) +#define HAVE_movv2si_internal (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_movv4hi_internal (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_movv8qi_internal (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_vec_init1_v4hi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_vec_init1_v8qi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_pack_ssat_v2si (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_pack_ssat_v4hi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_pack_usat_v4hi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_addv2si3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_addv4hi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_addv8qi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_paddd (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_ssaddv4hi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_ssaddv8qi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_usaddv4hi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_usaddv8qi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_pandn_w (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_pandn_h (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_pandn_b (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_pandn_d (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_andv2si3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_andv4hi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_andv8qi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_iorv2si3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_iorv4hi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_iorv8qi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_xorv2si3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_xorv4hi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_xorv8qi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_one_cmplv2si2 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_one_cmplv4hi2 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_one_cmplv8qi2 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_pavgh (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_pavgb (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_pcmpeqw (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_pcmpeqh (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_pcmpeqb (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_pcmpgtw (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_pcmpgth (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_pcmpgtb (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_pextrh (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_pinsrh_0 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_pinsrh_1 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_pinsrh_2 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_pinsrh_3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_pmaddhw (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_smaxv4hi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_umaxv8qi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_sminv4hi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_uminv8qi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_pmovmskb (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_umulv4hi3_highpart (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_smulv4hi3_highpart (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_mulv4hi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_pmuluw (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_pasubub (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_biadd (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_reduc_uplus_v8qi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_psadbh (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_pshufh (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_ashlv2si3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_ashlv4hi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_ashrv2si3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_ashrv4hi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_lshrv2si3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_lshrv4hi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_subv2si3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_subv4hi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_subv8qi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_psubd (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_sssubv4hi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_sssubv8qi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_ussubv4hi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_ussubv8qi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_punpckhbh (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_punpckhhw (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_punpckhhw_qi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_punpckhwd (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_punpckhwd_qi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_punpckhwd_hi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_punpcklbh (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_punpcklhw (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_loongson_punpcklwd (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_shl_v2si (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_shl_v4hi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_shl_v8qi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_shl_di (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_shr_v2si (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_shr_v4hi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_shr_v8qi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_shr_di (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_loongson_extract_lo_v2si (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_loongson_extract_lo_v4hi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_loongson_extract_lo_v8qi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_pack_trunc_v2di (ISA_HAS_MSA) +#define HAVE_vec_pack_trunc_v4si (ISA_HAS_MSA) +#define HAVE_vec_pack_trunc_v8hi (ISA_HAS_MSA) +#define HAVE_msa_vec_extract_d_f (ISA_HAS_MSA) +#define HAVE_msa_vec_extract_w_f (ISA_HAS_MSA) +#define HAVE_msa_insert_d_f (ISA_HAS_MSA) +#define HAVE_msa_insert_w_f (ISA_HAS_MSA) +#define HAVE_msa_insert_d (ISA_HAS_MSA) +#define HAVE_msa_insert_w (ISA_HAS_MSA) +#define HAVE_msa_insert_h (ISA_HAS_MSA) +#define HAVE_msa_insert_b (ISA_HAS_MSA) +#define HAVE_msa_insve_d_f (ISA_HAS_MSA) +#define HAVE_msa_insve_w_f (ISA_HAS_MSA) +#define HAVE_msa_insve_d (ISA_HAS_MSA) +#define HAVE_msa_insve_w (ISA_HAS_MSA) +#define HAVE_msa_insve_h (ISA_HAS_MSA) +#define HAVE_msa_insve_b (ISA_HAS_MSA) +#define HAVE_msa_insve_d_f_scalar (ISA_HAS_MSA) +#define HAVE_msa_insve_w_f_scalar (ISA_HAS_MSA) +#define HAVE_msa_copy_s_h (ISA_HAS_MSA) +#define HAVE_msa_copy_u_h (ISA_HAS_MSA) +#define HAVE_msa_copy_s_b (ISA_HAS_MSA) +#define HAVE_msa_copy_u_b (ISA_HAS_MSA) +#define HAVE_msa_copy_u_w (ISA_HAS_MSA && TARGET_64BIT) +#define HAVE_msa_copy_s_w_64bit (ISA_HAS_MSA && TARGET_64BIT) +#define HAVE_msa_copy_s_w_f_64bit (ISA_HAS_MSA && TARGET_64BIT) +#define HAVE_msa_copy_s_w (ISA_HAS_MSA) +#define HAVE_msa_copy_s_w_f (ISA_HAS_MSA) +#define HAVE_msa_copy_s_d (ISA_HAS_MSA) +#define HAVE_msa_copy_s_d_f (ISA_HAS_MSA) +#define HAVE_vec_permv2df (ISA_HAS_MSA) +#define HAVE_vec_permv4sf (ISA_HAS_MSA) +#define HAVE_vec_permv2di (ISA_HAS_MSA) +#define HAVE_vec_permv4si (ISA_HAS_MSA) +#define HAVE_vec_permv8hi (ISA_HAS_MSA) +#define HAVE_vec_permv16qi (ISA_HAS_MSA) +#define HAVE_movv2df_msa (ISA_HAS_MSA) +#define HAVE_movv4sf_msa (ISA_HAS_MSA) +#define HAVE_movv2di_msa (ISA_HAS_MSA) +#define HAVE_movv4si_msa (ISA_HAS_MSA) +#define HAVE_movv8hi_msa (ISA_HAS_MSA) +#define HAVE_movv16qi_msa (ISA_HAS_MSA) +#define HAVE_addv2di3 (ISA_HAS_MSA) +#define HAVE_addv4si3 (ISA_HAS_MSA) +#define HAVE_addv8hi3 (ISA_HAS_MSA) +#define HAVE_addv16qi3 (ISA_HAS_MSA) +#define HAVE_subv2di3 (ISA_HAS_MSA) +#define HAVE_subv4si3 (ISA_HAS_MSA) +#define HAVE_subv8hi3 (ISA_HAS_MSA) +#define HAVE_subv16qi3 (ISA_HAS_MSA) +#define HAVE_mulv2di3 (ISA_HAS_MSA) +#define HAVE_mulv4si3 (ISA_HAS_MSA) +#define HAVE_mulv8hi3 (ISA_HAS_MSA) +#define HAVE_mulv16qi3 (ISA_HAS_MSA) +#define HAVE_msa_maddv_d (ISA_HAS_MSA) +#define HAVE_msa_maddv_w (ISA_HAS_MSA) +#define HAVE_msa_maddv_h (ISA_HAS_MSA) +#define HAVE_msa_maddv_b (ISA_HAS_MSA) +#define HAVE_msa_msubv_d (ISA_HAS_MSA) +#define HAVE_msa_msubv_w (ISA_HAS_MSA) +#define HAVE_msa_msubv_h (ISA_HAS_MSA) +#define HAVE_msa_msubv_b (ISA_HAS_MSA) +#define HAVE_divv2di3 (ISA_HAS_MSA) +#define HAVE_divv4si3 (ISA_HAS_MSA) +#define HAVE_divv8hi3 (ISA_HAS_MSA) +#define HAVE_divv16qi3 (ISA_HAS_MSA) +#define HAVE_udivv2di3 (ISA_HAS_MSA) +#define HAVE_udivv4si3 (ISA_HAS_MSA) +#define HAVE_udivv8hi3 (ISA_HAS_MSA) +#define HAVE_udivv16qi3 (ISA_HAS_MSA) +#define HAVE_modv2di3 (ISA_HAS_MSA) +#define HAVE_modv4si3 (ISA_HAS_MSA) +#define HAVE_modv8hi3 (ISA_HAS_MSA) +#define HAVE_modv16qi3 (ISA_HAS_MSA) +#define HAVE_umodv2di3 (ISA_HAS_MSA) +#define HAVE_umodv4si3 (ISA_HAS_MSA) +#define HAVE_umodv8hi3 (ISA_HAS_MSA) +#define HAVE_umodv16qi3 (ISA_HAS_MSA) +#define HAVE_xorv2di3 (ISA_HAS_MSA) +#define HAVE_xorv4si3 (ISA_HAS_MSA) +#define HAVE_xorv8hi3 (ISA_HAS_MSA) +#define HAVE_xorv16qi3 (ISA_HAS_MSA) +#define HAVE_iorv2di3 (ISA_HAS_MSA) +#define HAVE_iorv4si3 (ISA_HAS_MSA) +#define HAVE_iorv8hi3 (ISA_HAS_MSA) +#define HAVE_iorv16qi3 (ISA_HAS_MSA) +#define HAVE_andv2di3 (ISA_HAS_MSA) +#define HAVE_andv4si3 (ISA_HAS_MSA) +#define HAVE_andv8hi3 (ISA_HAS_MSA) +#define HAVE_andv16qi3 (ISA_HAS_MSA) +#define HAVE_one_cmplv2di2 (ISA_HAS_MSA) +#define HAVE_one_cmplv4si2 (ISA_HAS_MSA) +#define HAVE_one_cmplv8hi2 (ISA_HAS_MSA) +#define HAVE_one_cmplv16qi2 (ISA_HAS_MSA) +#define HAVE_vlshrv2di3 (ISA_HAS_MSA) +#define HAVE_vlshrv4si3 (ISA_HAS_MSA) +#define HAVE_vlshrv8hi3 (ISA_HAS_MSA) +#define HAVE_vlshrv16qi3 (ISA_HAS_MSA) +#define HAVE_vashrv2di3 (ISA_HAS_MSA) +#define HAVE_vashrv4si3 (ISA_HAS_MSA) +#define HAVE_vashrv8hi3 (ISA_HAS_MSA) +#define HAVE_vashrv16qi3 (ISA_HAS_MSA) +#define HAVE_vashlv2di3 (ISA_HAS_MSA) +#define HAVE_vashlv4si3 (ISA_HAS_MSA) +#define HAVE_vashlv8hi3 (ISA_HAS_MSA) +#define HAVE_vashlv16qi3 (ISA_HAS_MSA) +#define HAVE_addv2df3 (ISA_HAS_MSA) +#define HAVE_addv4sf3 (ISA_HAS_MSA) +#define HAVE_subv2df3 (ISA_HAS_MSA) +#define HAVE_subv4sf3 (ISA_HAS_MSA) +#define HAVE_mulv2df3 (ISA_HAS_MSA) +#define HAVE_mulv4sf3 (ISA_HAS_MSA) +#define HAVE_divv2df3 (ISA_HAS_MSA) +#define HAVE_divv4sf3 (ISA_HAS_MSA) +#define HAVE_fmav2df4 (ISA_HAS_MSA) +#define HAVE_fmav4sf4 (ISA_HAS_MSA) +#define HAVE_fnmav2df4 (ISA_HAS_MSA) +#define HAVE_fnmav4sf4 (ISA_HAS_MSA) +#define HAVE_sqrtv2df2 (ISA_HAS_MSA) +#define HAVE_sqrtv4sf2 (ISA_HAS_MSA) +#define HAVE_msa_add_a_d (ISA_HAS_MSA) +#define HAVE_msa_add_a_w (ISA_HAS_MSA) +#define HAVE_msa_add_a_h (ISA_HAS_MSA) +#define HAVE_msa_add_a_b (ISA_HAS_MSA) +#define HAVE_msa_adds_a_d (ISA_HAS_MSA) +#define HAVE_msa_adds_a_w (ISA_HAS_MSA) +#define HAVE_msa_adds_a_h (ISA_HAS_MSA) +#define HAVE_msa_adds_a_b (ISA_HAS_MSA) +#define HAVE_ssaddv2di3 (ISA_HAS_MSA) +#define HAVE_ssaddv4si3 (ISA_HAS_MSA) +#define HAVE_ssaddv8hi3 (ISA_HAS_MSA) +#define HAVE_ssaddv16qi3 (ISA_HAS_MSA) +#define HAVE_usaddv2di3 (ISA_HAS_MSA) +#define HAVE_usaddv4si3 (ISA_HAS_MSA) +#define HAVE_usaddv8hi3 (ISA_HAS_MSA) +#define HAVE_usaddv16qi3 (ISA_HAS_MSA) +#define HAVE_msa_asub_s_d (ISA_HAS_MSA) +#define HAVE_msa_asub_s_w (ISA_HAS_MSA) +#define HAVE_msa_asub_s_h (ISA_HAS_MSA) +#define HAVE_msa_asub_s_b (ISA_HAS_MSA) +#define HAVE_msa_asub_u_d (ISA_HAS_MSA) +#define HAVE_msa_asub_u_w (ISA_HAS_MSA) +#define HAVE_msa_asub_u_h (ISA_HAS_MSA) +#define HAVE_msa_asub_u_b (ISA_HAS_MSA) +#define HAVE_msa_ave_s_d (ISA_HAS_MSA) +#define HAVE_msa_ave_s_w (ISA_HAS_MSA) +#define HAVE_msa_ave_s_h (ISA_HAS_MSA) +#define HAVE_msa_ave_s_b (ISA_HAS_MSA) +#define HAVE_msa_ave_u_d (ISA_HAS_MSA) +#define HAVE_msa_ave_u_w (ISA_HAS_MSA) +#define HAVE_msa_ave_u_h (ISA_HAS_MSA) +#define HAVE_msa_ave_u_b (ISA_HAS_MSA) +#define HAVE_msa_aver_s_d (ISA_HAS_MSA) +#define HAVE_msa_aver_s_w (ISA_HAS_MSA) +#define HAVE_msa_aver_s_h (ISA_HAS_MSA) +#define HAVE_msa_aver_s_b (ISA_HAS_MSA) +#define HAVE_msa_aver_u_d (ISA_HAS_MSA) +#define HAVE_msa_aver_u_w (ISA_HAS_MSA) +#define HAVE_msa_aver_u_h (ISA_HAS_MSA) +#define HAVE_msa_aver_u_b (ISA_HAS_MSA) +#define HAVE_msa_bclr_d (ISA_HAS_MSA) +#define HAVE_msa_bclr_w (ISA_HAS_MSA) +#define HAVE_msa_bclr_h (ISA_HAS_MSA) +#define HAVE_msa_bclr_b (ISA_HAS_MSA) +#define HAVE_msa_bclri_d (ISA_HAS_MSA) +#define HAVE_msa_bclri_w (ISA_HAS_MSA) +#define HAVE_msa_bclri_h (ISA_HAS_MSA) +#define HAVE_msa_bclri_b (ISA_HAS_MSA) +#define HAVE_msa_binsl_d (ISA_HAS_MSA) +#define HAVE_msa_binsl_w (ISA_HAS_MSA) +#define HAVE_msa_binsl_h (ISA_HAS_MSA) +#define HAVE_msa_binsl_b (ISA_HAS_MSA) +#define HAVE_msa_binsli_d (ISA_HAS_MSA) +#define HAVE_msa_binsli_w (ISA_HAS_MSA) +#define HAVE_msa_binsli_h (ISA_HAS_MSA) +#define HAVE_msa_binsli_b (ISA_HAS_MSA) +#define HAVE_msa_binsr_d (ISA_HAS_MSA) +#define HAVE_msa_binsr_w (ISA_HAS_MSA) +#define HAVE_msa_binsr_h (ISA_HAS_MSA) +#define HAVE_msa_binsr_b (ISA_HAS_MSA) +#define HAVE_msa_binsri_d (ISA_HAS_MSA) +#define HAVE_msa_binsri_w (ISA_HAS_MSA) +#define HAVE_msa_binsri_h (ISA_HAS_MSA) +#define HAVE_msa_binsri_b (ISA_HAS_MSA) +#define HAVE_msa_bmnz_d (ISA_HAS_MSA) +#define HAVE_msa_bmnz_w (ISA_HAS_MSA) +#define HAVE_msa_bmnz_h (ISA_HAS_MSA) +#define HAVE_msa_bmnz_b (ISA_HAS_MSA) +#define HAVE_msa_bmz_d (ISA_HAS_MSA) +#define HAVE_msa_bmz_w (ISA_HAS_MSA) +#define HAVE_msa_bmz_h (ISA_HAS_MSA) +#define HAVE_msa_bmz_b (ISA_HAS_MSA) +#define HAVE_msa_bneg_d (ISA_HAS_MSA) +#define HAVE_msa_bneg_w (ISA_HAS_MSA) +#define HAVE_msa_bneg_h (ISA_HAS_MSA) +#define HAVE_msa_bneg_b (ISA_HAS_MSA) +#define HAVE_msa_bnegi_d (ISA_HAS_MSA) +#define HAVE_msa_bnegi_w (ISA_HAS_MSA) +#define HAVE_msa_bnegi_h (ISA_HAS_MSA) +#define HAVE_msa_bnegi_b (ISA_HAS_MSA) +#define HAVE_msa_bsel_d (ISA_HAS_MSA) +#define HAVE_msa_bsel_w (ISA_HAS_MSA) +#define HAVE_msa_bsel_h (ISA_HAS_MSA) +#define HAVE_msa_bsel_b (ISA_HAS_MSA) +#define HAVE_msa_bset_d (ISA_HAS_MSA) +#define HAVE_msa_bset_w (ISA_HAS_MSA) +#define HAVE_msa_bset_h (ISA_HAS_MSA) +#define HAVE_msa_bset_b (ISA_HAS_MSA) +#define HAVE_msa_bseti_d (ISA_HAS_MSA) +#define HAVE_msa_bseti_w (ISA_HAS_MSA) +#define HAVE_msa_bseti_h (ISA_HAS_MSA) +#define HAVE_msa_bseti_b (ISA_HAS_MSA) +#define HAVE_msa_ceq_d (ISA_HAS_MSA) +#define HAVE_msa_cle_s_d (ISA_HAS_MSA) +#define HAVE_msa_cle_u_d (ISA_HAS_MSA) +#define HAVE_msa_clt_s_d (ISA_HAS_MSA) +#define HAVE_msa_clt_u_d (ISA_HAS_MSA) +#define HAVE_msa_ceq_w (ISA_HAS_MSA) +#define HAVE_msa_cle_s_w (ISA_HAS_MSA) +#define HAVE_msa_cle_u_w (ISA_HAS_MSA) +#define HAVE_msa_clt_s_w (ISA_HAS_MSA) +#define HAVE_msa_clt_u_w (ISA_HAS_MSA) +#define HAVE_msa_ceq_h (ISA_HAS_MSA) +#define HAVE_msa_cle_s_h (ISA_HAS_MSA) +#define HAVE_msa_cle_u_h (ISA_HAS_MSA) +#define HAVE_msa_clt_s_h (ISA_HAS_MSA) +#define HAVE_msa_clt_u_h (ISA_HAS_MSA) +#define HAVE_msa_ceq_b (ISA_HAS_MSA) +#define HAVE_msa_cle_s_b (ISA_HAS_MSA) +#define HAVE_msa_cle_u_b (ISA_HAS_MSA) +#define HAVE_msa_clt_s_b (ISA_HAS_MSA) +#define HAVE_msa_clt_u_b (ISA_HAS_MSA) +#define HAVE_msa_dotp_s_d (ISA_HAS_MSA) +#define HAVE_msa_dotp_u_d (ISA_HAS_MSA) +#define HAVE_msa_dotp_s_w (ISA_HAS_MSA) +#define HAVE_msa_dotp_u_w (ISA_HAS_MSA) +#define HAVE_msa_dotp_s_h (ISA_HAS_MSA) +#define HAVE_msa_dotp_u_h (ISA_HAS_MSA) +#define HAVE_msa_dpadd_s_d (ISA_HAS_MSA) +#define HAVE_msa_dpadd_u_d (ISA_HAS_MSA) +#define HAVE_msa_dpadd_s_w (ISA_HAS_MSA) +#define HAVE_msa_dpadd_u_w (ISA_HAS_MSA) +#define HAVE_msa_dpadd_s_h (ISA_HAS_MSA) +#define HAVE_msa_dpadd_u_h (ISA_HAS_MSA) +#define HAVE_msa_dpsub_s_d (ISA_HAS_MSA) +#define HAVE_msa_dpsub_u_d (ISA_HAS_MSA) +#define HAVE_msa_dpsub_s_w (ISA_HAS_MSA) +#define HAVE_msa_dpsub_u_w (ISA_HAS_MSA) +#define HAVE_msa_dpsub_s_h (ISA_HAS_MSA) +#define HAVE_msa_dpsub_u_h (ISA_HAS_MSA) +#define HAVE_msa_fclass_d (ISA_HAS_MSA) +#define HAVE_msa_fclass_w (ISA_HAS_MSA) +#define HAVE_msa_fcaf_d (ISA_HAS_MSA) +#define HAVE_msa_fcaf_w (ISA_HAS_MSA) +#define HAVE_msa_fcune_d (ISA_HAS_MSA) +#define HAVE_msa_fcune_w (ISA_HAS_MSA) +#define HAVE_msa_fcun_d (ISA_HAS_MSA) +#define HAVE_msa_fcor_d (ISA_HAS_MSA) +#define HAVE_msa_fceq_d (ISA_HAS_MSA) +#define HAVE_msa_fcne_d (ISA_HAS_MSA) +#define HAVE_msa_fcle_d (ISA_HAS_MSA) +#define HAVE_msa_fclt_d (ISA_HAS_MSA) +#define HAVE_msa_fcueq_d (ISA_HAS_MSA) +#define HAVE_msa_fcule_d (ISA_HAS_MSA) +#define HAVE_msa_fcult_d (ISA_HAS_MSA) +#define HAVE_msa_fcun_w (ISA_HAS_MSA) +#define HAVE_msa_fcor_w (ISA_HAS_MSA) +#define HAVE_msa_fceq_w (ISA_HAS_MSA) +#define HAVE_msa_fcne_w (ISA_HAS_MSA) +#define HAVE_msa_fcle_w (ISA_HAS_MSA) +#define HAVE_msa_fclt_w (ISA_HAS_MSA) +#define HAVE_msa_fcueq_w (ISA_HAS_MSA) +#define HAVE_msa_fcule_w (ISA_HAS_MSA) +#define HAVE_msa_fcult_w (ISA_HAS_MSA) +#define HAVE_msa_fsaf_d (ISA_HAS_MSA) +#define HAVE_msa_fsun_d (ISA_HAS_MSA) +#define HAVE_msa_fsor_d (ISA_HAS_MSA) +#define HAVE_msa_fseq_d (ISA_HAS_MSA) +#define HAVE_msa_fsne_d (ISA_HAS_MSA) +#define HAVE_msa_fsueq_d (ISA_HAS_MSA) +#define HAVE_msa_fsune_d (ISA_HAS_MSA) +#define HAVE_msa_fsule_d (ISA_HAS_MSA) +#define HAVE_msa_fsult_d (ISA_HAS_MSA) +#define HAVE_msa_fsle_d (ISA_HAS_MSA) +#define HAVE_msa_fslt_d (ISA_HAS_MSA) +#define HAVE_msa_fsaf_w (ISA_HAS_MSA) +#define HAVE_msa_fsun_w (ISA_HAS_MSA) +#define HAVE_msa_fsor_w (ISA_HAS_MSA) +#define HAVE_msa_fseq_w (ISA_HAS_MSA) +#define HAVE_msa_fsne_w (ISA_HAS_MSA) +#define HAVE_msa_fsueq_w (ISA_HAS_MSA) +#define HAVE_msa_fsune_w (ISA_HAS_MSA) +#define HAVE_msa_fsule_w (ISA_HAS_MSA) +#define HAVE_msa_fsult_w (ISA_HAS_MSA) +#define HAVE_msa_fsle_w (ISA_HAS_MSA) +#define HAVE_msa_fslt_w (ISA_HAS_MSA) +#define HAVE_msa_fexp2_d (ISA_HAS_MSA) +#define HAVE_msa_fexp2_w (ISA_HAS_MSA) +#define HAVE_floatv2div2df2 (ISA_HAS_MSA) +#define HAVE_floatv4siv4sf2 (ISA_HAS_MSA) +#define HAVE_floatunsv2div2df2 (ISA_HAS_MSA) +#define HAVE_floatunsv4siv4sf2 (ISA_HAS_MSA) +#define HAVE_msa_ffql_d (ISA_HAS_MSA) +#define HAVE_msa_ffql_w (ISA_HAS_MSA) +#define HAVE_msa_ffqr_d (ISA_HAS_MSA) +#define HAVE_msa_ffqr_w (ISA_HAS_MSA) +#define HAVE_msa_fill_d_f (ISA_HAS_MSA) +#define HAVE_msa_fill_w_f (ISA_HAS_MSA) +#define HAVE_msa_fill_d (ISA_HAS_MSA) +#define HAVE_msa_fill_w (ISA_HAS_MSA) +#define HAVE_msa_fill_h (ISA_HAS_MSA) +#define HAVE_msa_fill_b (ISA_HAS_MSA) +#define HAVE_msa_flog2_d (ISA_HAS_MSA) +#define HAVE_msa_flog2_w (ISA_HAS_MSA) +#define HAVE_smaxv2df3 (ISA_HAS_MSA) +#define HAVE_smaxv4sf3 (ISA_HAS_MSA) +#define HAVE_msa_fmax_a_d (ISA_HAS_MSA) +#define HAVE_msa_fmax_a_w (ISA_HAS_MSA) +#define HAVE_sminv2df3 (ISA_HAS_MSA) +#define HAVE_sminv4sf3 (ISA_HAS_MSA) +#define HAVE_msa_fmin_a_d (ISA_HAS_MSA) +#define HAVE_msa_fmin_a_w (ISA_HAS_MSA) +#define HAVE_msa_frcp_d (ISA_HAS_MSA) +#define HAVE_msa_frcp_w (ISA_HAS_MSA) +#define HAVE_msa_frint_d (ISA_HAS_MSA) +#define HAVE_msa_frint_w (ISA_HAS_MSA) +#define HAVE_msa_frsqrt_d (ISA_HAS_MSA) +#define HAVE_msa_frsqrt_w (ISA_HAS_MSA) +#define HAVE_msa_ftint_s_d (ISA_HAS_MSA) +#define HAVE_msa_ftint_s_w (ISA_HAS_MSA) +#define HAVE_msa_ftint_u_d (ISA_HAS_MSA) +#define HAVE_msa_ftint_u_w (ISA_HAS_MSA) +#define HAVE_fix_truncv2dfv2di2 (ISA_HAS_MSA) +#define HAVE_fix_truncv4sfv4si2 (ISA_HAS_MSA) +#define HAVE_fixuns_truncv2dfv2di2 (ISA_HAS_MSA) +#define HAVE_fixuns_truncv4sfv4si2 (ISA_HAS_MSA) +#define HAVE_msa_ftq_h (ISA_HAS_MSA) +#define HAVE_msa_ftq_w (ISA_HAS_MSA) +#define HAVE_msa_hadd_s_h (ISA_HAS_MSA) +#define HAVE_msa_hadd_u_h (ISA_HAS_MSA) +#define HAVE_msa_hsub_s_h (ISA_HAS_MSA) +#define HAVE_msa_hsub_u_h (ISA_HAS_MSA) +#define HAVE_msa_hadd_s_w (ISA_HAS_MSA) +#define HAVE_msa_hadd_u_w (ISA_HAS_MSA) +#define HAVE_msa_hsub_s_w (ISA_HAS_MSA) +#define HAVE_msa_hsub_u_w (ISA_HAS_MSA) +#define HAVE_msa_hadd_s_d (ISA_HAS_MSA) +#define HAVE_msa_hadd_u_d (ISA_HAS_MSA) +#define HAVE_msa_hsub_s_d (ISA_HAS_MSA) +#define HAVE_msa_hsub_u_d (ISA_HAS_MSA) +#define HAVE_msa_ilvev_b (ISA_HAS_MSA) +#define HAVE_msa_ilvev_h (ISA_HAS_MSA) +#define HAVE_msa_ilvev_w (ISA_HAS_MSA) +#define HAVE_msa_ilvev_w_f (ISA_HAS_MSA) +#define HAVE_msa_ilvl_b (ISA_HAS_MSA) +#define HAVE_msa_ilvl_h (ISA_HAS_MSA) +#define HAVE_msa_ilvl_w (ISA_HAS_MSA) +#define HAVE_msa_ilvl_w_f (ISA_HAS_MSA) +#define HAVE_msa_ilvl_d (ISA_HAS_MSA) +#define HAVE_msa_ilvl_d_f (ISA_HAS_MSA) +#define HAVE_msa_ilvod_b (ISA_HAS_MSA) +#define HAVE_msa_ilvod_h (ISA_HAS_MSA) +#define HAVE_msa_ilvod_w (ISA_HAS_MSA) +#define HAVE_msa_ilvod_w_f (ISA_HAS_MSA) +#define HAVE_msa_ilvr_b (ISA_HAS_MSA) +#define HAVE_msa_ilvr_h (ISA_HAS_MSA) +#define HAVE_msa_ilvr_w (ISA_HAS_MSA) +#define HAVE_msa_ilvr_w_f (ISA_HAS_MSA) +#define HAVE_msa_ilvr_d (ISA_HAS_MSA) +#define HAVE_msa_ilvr_d_f (ISA_HAS_MSA) +#define HAVE_msa_madd_q_w (ISA_HAS_MSA) +#define HAVE_msa_madd_q_h (ISA_HAS_MSA) +#define HAVE_msa_maddr_q_w (ISA_HAS_MSA) +#define HAVE_msa_maddr_q_h (ISA_HAS_MSA) +#define HAVE_msa_max_a_d (ISA_HAS_MSA) +#define HAVE_msa_max_a_w (ISA_HAS_MSA) +#define HAVE_msa_max_a_h (ISA_HAS_MSA) +#define HAVE_msa_max_a_b (ISA_HAS_MSA) +#define HAVE_smaxv2di3 (ISA_HAS_MSA) +#define HAVE_smaxv4si3 (ISA_HAS_MSA) +#define HAVE_smaxv8hi3 (ISA_HAS_MSA) +#define HAVE_smaxv16qi3 (ISA_HAS_MSA) +#define HAVE_umaxv2di3 (ISA_HAS_MSA) +#define HAVE_umaxv4si3 (ISA_HAS_MSA) +#define HAVE_umaxv8hi3 (ISA_HAS_MSA) +#define HAVE_umaxv16qi3 (ISA_HAS_MSA) +#define HAVE_msa_min_a_d (ISA_HAS_MSA) +#define HAVE_msa_min_a_w (ISA_HAS_MSA) +#define HAVE_msa_min_a_h (ISA_HAS_MSA) +#define HAVE_msa_min_a_b (ISA_HAS_MSA) +#define HAVE_sminv2di3 (ISA_HAS_MSA) +#define HAVE_sminv4si3 (ISA_HAS_MSA) +#define HAVE_sminv8hi3 (ISA_HAS_MSA) +#define HAVE_sminv16qi3 (ISA_HAS_MSA) +#define HAVE_uminv2di3 (ISA_HAS_MSA) +#define HAVE_uminv4si3 (ISA_HAS_MSA) +#define HAVE_uminv8hi3 (ISA_HAS_MSA) +#define HAVE_uminv16qi3 (ISA_HAS_MSA) +#define HAVE_msa_msub_q_w (ISA_HAS_MSA) +#define HAVE_msa_msub_q_h (ISA_HAS_MSA) +#define HAVE_msa_msubr_q_w (ISA_HAS_MSA) +#define HAVE_msa_msubr_q_h (ISA_HAS_MSA) +#define HAVE_msa_mul_q_w (ISA_HAS_MSA) +#define HAVE_msa_mul_q_h (ISA_HAS_MSA) +#define HAVE_msa_mulr_q_w (ISA_HAS_MSA) +#define HAVE_msa_mulr_q_h (ISA_HAS_MSA) +#define HAVE_msa_nloc_d (ISA_HAS_MSA) +#define HAVE_msa_nloc_w (ISA_HAS_MSA) +#define HAVE_msa_nloc_h (ISA_HAS_MSA) +#define HAVE_msa_nloc_b (ISA_HAS_MSA) +#define HAVE_clzv2di2 (ISA_HAS_MSA) +#define HAVE_clzv4si2 (ISA_HAS_MSA) +#define HAVE_clzv8hi2 (ISA_HAS_MSA) +#define HAVE_clzv16qi2 (ISA_HAS_MSA) +#define HAVE_msa_nor_d (ISA_HAS_MSA) +#define HAVE_msa_nor_w (ISA_HAS_MSA) +#define HAVE_msa_nor_h (ISA_HAS_MSA) +#define HAVE_msa_nor_b (ISA_HAS_MSA) +#define HAVE_msa_pckev_b (ISA_HAS_MSA) +#define HAVE_msa_pckev_h (ISA_HAS_MSA) +#define HAVE_msa_pckev_w (ISA_HAS_MSA) +#define HAVE_msa_pckev_w_f (ISA_HAS_MSA) +#define HAVE_msa_pckod_b (ISA_HAS_MSA) +#define HAVE_msa_pckod_h (ISA_HAS_MSA) +#define HAVE_msa_pckod_w (ISA_HAS_MSA) +#define HAVE_msa_pckod_w_f (ISA_HAS_MSA) +#define HAVE_popcountv2di2 (ISA_HAS_MSA) +#define HAVE_popcountv4si2 (ISA_HAS_MSA) +#define HAVE_popcountv8hi2 (ISA_HAS_MSA) +#define HAVE_popcountv16qi2 (ISA_HAS_MSA) +#define HAVE_msa_sat_s_d (ISA_HAS_MSA) +#define HAVE_msa_sat_s_w (ISA_HAS_MSA) +#define HAVE_msa_sat_s_h (ISA_HAS_MSA) +#define HAVE_msa_sat_s_b (ISA_HAS_MSA) +#define HAVE_msa_sat_u_d (ISA_HAS_MSA) +#define HAVE_msa_sat_u_w (ISA_HAS_MSA) +#define HAVE_msa_sat_u_h (ISA_HAS_MSA) +#define HAVE_msa_sat_u_b (ISA_HAS_MSA) +#define HAVE_msa_shf_w (ISA_HAS_MSA) +#define HAVE_msa_shf_h (ISA_HAS_MSA) +#define HAVE_msa_shf_b (ISA_HAS_MSA) +#define HAVE_msa_shf_w_f (ISA_HAS_MSA) +#define HAVE_msa_srar_d (ISA_HAS_MSA) +#define HAVE_msa_srar_w (ISA_HAS_MSA) +#define HAVE_msa_srar_h (ISA_HAS_MSA) +#define HAVE_msa_srar_b (ISA_HAS_MSA) +#define HAVE_msa_srari_d (ISA_HAS_MSA) +#define HAVE_msa_srari_w (ISA_HAS_MSA) +#define HAVE_msa_srari_h (ISA_HAS_MSA) +#define HAVE_msa_srari_b (ISA_HAS_MSA) +#define HAVE_msa_srlr_d (ISA_HAS_MSA) +#define HAVE_msa_srlr_w (ISA_HAS_MSA) +#define HAVE_msa_srlr_h (ISA_HAS_MSA) +#define HAVE_msa_srlr_b (ISA_HAS_MSA) +#define HAVE_msa_srlri_d (ISA_HAS_MSA) +#define HAVE_msa_srlri_w (ISA_HAS_MSA) +#define HAVE_msa_srlri_h (ISA_HAS_MSA) +#define HAVE_msa_srlri_b (ISA_HAS_MSA) +#define HAVE_msa_subs_s_d (ISA_HAS_MSA) +#define HAVE_msa_subs_s_w (ISA_HAS_MSA) +#define HAVE_msa_subs_s_h (ISA_HAS_MSA) +#define HAVE_msa_subs_s_b (ISA_HAS_MSA) +#define HAVE_msa_subs_u_d (ISA_HAS_MSA) +#define HAVE_msa_subs_u_w (ISA_HAS_MSA) +#define HAVE_msa_subs_u_h (ISA_HAS_MSA) +#define HAVE_msa_subs_u_b (ISA_HAS_MSA) +#define HAVE_msa_subsuu_s_d (ISA_HAS_MSA) +#define HAVE_msa_subsuu_s_w (ISA_HAS_MSA) +#define HAVE_msa_subsuu_s_h (ISA_HAS_MSA) +#define HAVE_msa_subsuu_s_b (ISA_HAS_MSA) +#define HAVE_msa_subsus_u_d (ISA_HAS_MSA) +#define HAVE_msa_subsus_u_w (ISA_HAS_MSA) +#define HAVE_msa_subsus_u_h (ISA_HAS_MSA) +#define HAVE_msa_subsus_u_b (ISA_HAS_MSA) +#define HAVE_msa_sld_d_f (ISA_HAS_MSA) +#define HAVE_msa_sld_w_f (ISA_HAS_MSA) +#define HAVE_msa_sld_d (ISA_HAS_MSA) +#define HAVE_msa_sld_w (ISA_HAS_MSA) +#define HAVE_msa_sld_h (ISA_HAS_MSA) +#define HAVE_msa_sld_b (ISA_HAS_MSA) +#define HAVE_msa_sldi_d_f (ISA_HAS_MSA) +#define HAVE_msa_sldi_w_f (ISA_HAS_MSA) +#define HAVE_msa_sldi_d (ISA_HAS_MSA) +#define HAVE_msa_sldi_w (ISA_HAS_MSA) +#define HAVE_msa_sldi_h (ISA_HAS_MSA) +#define HAVE_msa_sldi_b (ISA_HAS_MSA) +#define HAVE_msa_splat_d_f (ISA_HAS_MSA) +#define HAVE_msa_splat_w_f (ISA_HAS_MSA) +#define HAVE_msa_splat_d (ISA_HAS_MSA) +#define HAVE_msa_splat_w (ISA_HAS_MSA) +#define HAVE_msa_splat_h (ISA_HAS_MSA) +#define HAVE_msa_splat_b (ISA_HAS_MSA) +#define HAVE_msa_splati_d_f (ISA_HAS_MSA) +#define HAVE_msa_splati_w_f (ISA_HAS_MSA) +#define HAVE_msa_splati_d (ISA_HAS_MSA) +#define HAVE_msa_splati_w (ISA_HAS_MSA) +#define HAVE_msa_splati_h (ISA_HAS_MSA) +#define HAVE_msa_splati_b (ISA_HAS_MSA) +#define HAVE_msa_splati_d_f_scalar (ISA_HAS_MSA) +#define HAVE_msa_splati_w_f_scalar (ISA_HAS_MSA) +#define HAVE_msa_cfcmsa (ISA_HAS_MSA) +#define HAVE_msa_ctcmsa (ISA_HAS_MSA) +#define HAVE_msa_fexdo_h (ISA_HAS_MSA) +#define HAVE_vec_pack_trunc_v2df (ISA_HAS_MSA) +#define HAVE_msa_fexupl_w (ISA_HAS_MSA) +#define HAVE_msa_fexupl_d (ISA_HAS_MSA) +#define HAVE_msa_fexupr_w (ISA_HAS_MSA) +#define HAVE_msa_fexupr_d (ISA_HAS_MSA) +#define HAVE_msa_bz_d_f (ISA_HAS_MSA) +#define HAVE_msa_bnz_d_f (ISA_HAS_MSA) +#define HAVE_msa_bz_w_f (ISA_HAS_MSA) +#define HAVE_msa_bnz_w_f (ISA_HAS_MSA) +#define HAVE_msa_bz_d (ISA_HAS_MSA) +#define HAVE_msa_bnz_d (ISA_HAS_MSA) +#define HAVE_msa_bz_w (ISA_HAS_MSA) +#define HAVE_msa_bnz_w (ISA_HAS_MSA) +#define HAVE_msa_bz_h (ISA_HAS_MSA) +#define HAVE_msa_bnz_h (ISA_HAS_MSA) +#define HAVE_msa_bz_b (ISA_HAS_MSA) +#define HAVE_msa_bnz_b (ISA_HAS_MSA) +#define HAVE_msa_bz_v_d_f (ISA_HAS_MSA) +#define HAVE_msa_bnz_v_d_f (ISA_HAS_MSA) +#define HAVE_msa_bz_v_w_f (ISA_HAS_MSA) +#define HAVE_msa_bnz_v_w_f (ISA_HAS_MSA) +#define HAVE_msa_bz_v_d (ISA_HAS_MSA) +#define HAVE_msa_bnz_v_d (ISA_HAS_MSA) +#define HAVE_msa_bz_v_w (ISA_HAS_MSA) +#define HAVE_msa_bnz_v_w (ISA_HAS_MSA) +#define HAVE_msa_bz_v_h (ISA_HAS_MSA) +#define HAVE_msa_bnz_v_h (ISA_HAS_MSA) +#define HAVE_msa_bz_v_b (ISA_HAS_MSA) +#define HAVE_msa_bnz_v_b (ISA_HAS_MSA) +#define HAVE_ctrapsi4 (ISA_HAS_COND_TRAPI || ISA_HAS_COND_TRAP) +#define HAVE_ctrapdi4 ((ISA_HAS_COND_TRAPI || ISA_HAS_COND_TRAP) && (TARGET_64BIT)) +#define HAVE_addsi3 1 +#define HAVE_adddi3 (TARGET_64BIT) +#define HAVE_mulsf3 (TARGET_HARD_FLOAT) +#define HAVE_muldf3 (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT) +#define HAVE_mulsi3 1 +#define HAVE_muldi3 ((ISA_HAS_DMULT || ISA_HAS_R6DMUL) && (TARGET_64BIT)) +#define HAVE_mulsidi3 (mips_mulsidi3_gen_fn (SIGN_EXTEND) != NULL) +#define HAVE_umulsidi3 (mips_mulsidi3_gen_fn (ZERO_EXTEND) != NULL) +#define HAVE_mulsidi3_32bit_r6 (!TARGET_64BIT && ISA_HAS_R6MUL) +#define HAVE_umulsidi3_32bit_r6 (!TARGET_64BIT && ISA_HAS_R6MUL) +#define HAVE_mulsidi3_32bit_mips16 (!TARGET_64BIT && TARGET_MIPS16) +#define HAVE_umulsidi3_32bit_mips16 (!TARGET_64BIT && TARGET_MIPS16) +#define HAVE_mulsidi3_64bit_mips16 (TARGET_64BIT && TARGET_MIPS16) +#define HAVE_umulsidi3_64bit_mips16 (TARGET_64BIT && TARGET_MIPS16) +#define HAVE_mulsidi3_64bit_split 1 +#define HAVE_umulsidi3_64bit_split 1 +#define HAVE_smulsi3_highpart 1 +#define HAVE_umulsi3_highpart 1 +#define HAVE_smulsi3_highpart_split 1 +#define HAVE_umulsi3_highpart_split 1 +#define HAVE_smuldi3_highpart (ISA_HAS_R6DMUL \ + || (ISA_HAS_DMULT \ + && !(SIGN_EXTEND == ZERO_EXTEND && TARGET_FIX_VR4120))) +#define HAVE_umuldi3_highpart (ISA_HAS_R6DMUL \ + || (ISA_HAS_DMULT \ + && !(ZERO_EXTEND == ZERO_EXTEND && TARGET_FIX_VR4120))) +#define HAVE_smuldi3_highpart_split 1 +#define HAVE_umuldi3_highpart_split 1 +#define HAVE_mulditi3 (ISA_HAS_DMULT && !(SIGN_EXTEND == ZERO_EXTEND && TARGET_FIX_VR4120)) +#define HAVE_umulditi3 (ISA_HAS_DMULT && !(ZERO_EXTEND == ZERO_EXTEND && TARGET_FIX_VR4120)) +#define HAVE_fmasf4 ((ISA_HAS_FUSED_MADDF || ISA_HAS_FUSED_MADD3 || ISA_HAS_FUSED_MADD4) && (TARGET_HARD_FLOAT)) +#define HAVE_fmadf4 ((ISA_HAS_FUSED_MADDF || ISA_HAS_FUSED_MADD3 || ISA_HAS_FUSED_MADD4) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_fmav2sf4 ((ISA_HAS_FUSED_MADDF || ISA_HAS_FUSED_MADD3 || ISA_HAS_FUSED_MADD4) && (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT)) +#define HAVE_fmssf4 (((ISA_HAS_FUSED_MADD3 || ISA_HAS_FUSED_MADD4)) && (TARGET_HARD_FLOAT)) +#define HAVE_fmsdf4 (((ISA_HAS_FUSED_MADD3 || ISA_HAS_FUSED_MADD4)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_fmsv2sf4 (((ISA_HAS_FUSED_MADD3 || ISA_HAS_FUSED_MADD4)) && (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT)) +#define HAVE_fnmasf4 (((ISA_HAS_FUSED_MADD3 || ISA_HAS_FUSED_MADD4) \ + && !HONOR_SIGNED_ZEROS (SFmode)) && (TARGET_HARD_FLOAT)) +#define HAVE_fnmadf4 (((ISA_HAS_FUSED_MADD3 || ISA_HAS_FUSED_MADD4) \ + && !HONOR_SIGNED_ZEROS (DFmode)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_fnmav2sf4 (((ISA_HAS_FUSED_MADD3 || ISA_HAS_FUSED_MADD4) \ + && !HONOR_SIGNED_ZEROS (V2SFmode)) && (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT)) +#define HAVE_fnmssf4 (((ISA_HAS_FUSED_MADD3 || ISA_HAS_FUSED_MADD4) \ + && !HONOR_SIGNED_ZEROS (SFmode)) && (TARGET_HARD_FLOAT)) +#define HAVE_fnmsdf4 (((ISA_HAS_FUSED_MADD3 || ISA_HAS_FUSED_MADD4) \ + && !HONOR_SIGNED_ZEROS (DFmode)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_fnmsv2sf4 (((ISA_HAS_FUSED_MADD3 || ISA_HAS_FUSED_MADD4) \ + && !HONOR_SIGNED_ZEROS (V2SFmode)) && (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT)) +#define HAVE_divsf3 ((!TARGET_FIX_SB1 || flag_unsafe_math_optimizations) && (TARGET_HARD_FLOAT)) +#define HAVE_divdf3 (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT) +#define HAVE_divv2sf3 ((TARGET_SB1 && (!TARGET_FIX_SB1 || flag_unsafe_math_optimizations)) && (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT)) +#define HAVE_divmodsi4 (ISA_HAS_DIV && !TARGET_FIX_VR4120) +#define HAVE_divmoddi4 ((ISA_HAS_DDIV && !TARGET_FIX_VR4120) && (TARGET_64BIT)) +#define HAVE_udivmodsi4 (ISA_HAS_DIV && !TARGET_FIX_VR4120) +#define HAVE_udivmoddi4 ((ISA_HAS_DDIV && !TARGET_FIX_VR4120) && (TARGET_64BIT)) +#define HAVE_divmodsi4_split 1 +#define HAVE_udivmodsi4_split 1 +#define HAVE_divmoddi4_split (TARGET_64BIT) +#define HAVE_udivmoddi4_split (TARGET_64BIT) +#define HAVE_andsi3 1 +#define HAVE_anddi3 (TARGET_64BIT) +#define HAVE_iorsi3 1 +#define HAVE_iordi3 (TARGET_64BIT) +#define HAVE_xorsi3 1 +#define HAVE_xordi3 (TARGET_64BIT) +#define HAVE_zero_extendsidi2 (TARGET_64BIT) +#define HAVE_zero_extendqisi2 1 +#define HAVE_zero_extendqidi2 (TARGET_64BIT) +#define HAVE_zero_extendhisi2 1 +#define HAVE_zero_extendhidi2 (TARGET_64BIT) +#define HAVE_zero_extendqihi2 1 +#define HAVE_extendqisi2 1 +#define HAVE_extendqidi2 (TARGET_64BIT) +#define HAVE_extendhisi2 1 +#define HAVE_extendhidi2 (TARGET_64BIT) +#define HAVE_extendqihi2 1 +#define HAVE_fix_truncdfsi2 (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT) +#define HAVE_fix_truncsfsi2 (TARGET_HARD_FLOAT) +#define HAVE_fixuns_truncdfsi2 (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT) +#define HAVE_fixuns_truncdfdi2 (TARGET_HARD_FLOAT && TARGET_64BIT && TARGET_DOUBLE_FLOAT) +#define HAVE_fixuns_truncsfsi2 (TARGET_HARD_FLOAT) +#define HAVE_fixuns_truncsfdi2 (TARGET_HARD_FLOAT && TARGET_64BIT && TARGET_DOUBLE_FLOAT) +#define HAVE_extvmisalignsi (ISA_HAS_LWL_LWR) +#define HAVE_extvmisaligndi ((ISA_HAS_LWL_LWR) && (TARGET_64BIT)) +#define HAVE_extvsi (ISA_HAS_EXTS) +#define HAVE_extvdi ((ISA_HAS_EXTS) && (TARGET_64BIT)) +#define HAVE_extzvmisalignsi (ISA_HAS_LWL_LWR) +#define HAVE_extzvmisaligndi ((ISA_HAS_LWL_LWR) && (TARGET_64BIT)) +#define HAVE_extzvsi 1 +#define HAVE_extzvdi (TARGET_64BIT) +#define HAVE_insvmisalignsi (ISA_HAS_LWL_LWR) +#define HAVE_insvmisaligndi ((ISA_HAS_LWL_LWR) && (TARGET_64BIT)) +#define HAVE_insvsi 1 +#define HAVE_insvdi (TARGET_64BIT) +#define HAVE_unspec_got_si (Pmode == SImode) +#define HAVE_unspec_got_di (Pmode == DImode) +#define HAVE_movdi 1 +#define HAVE_movsi 1 +#define HAVE_movv2hi (TARGET_DSP) +#define HAVE_movv4qi (TARGET_DSP) +#define HAVE_movv2hq (TARGET_DSP) +#define HAVE_movv2uhq (TARGET_DSP) +#define HAVE_movv2ha (TARGET_DSP) +#define HAVE_movv2uha (TARGET_DSP) +#define HAVE_movv4qq (TARGET_DSP) +#define HAVE_movv4uqq (TARGET_DSP) +#define HAVE_movhi 1 +#define HAVE_movqi 1 +#define HAVE_movsf 1 +#define HAVE_movdf 1 +#define HAVE_movti (TARGET_64BIT) +#define HAVE_movtf (TARGET_64BIT) +#define HAVE_movv2sf (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_move_doubleword_fprdf (!TARGET_64BIT && TARGET_DOUBLE_FLOAT) +#define HAVE_move_doubleword_fprdi (!TARGET_64BIT && TARGET_DOUBLE_FLOAT) +#define HAVE_move_doubleword_fprv2sf (!TARGET_64BIT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_move_doubleword_fprv2si (!TARGET_64BIT && TARGET_LOONGSON_VECTORS) +#define HAVE_move_doubleword_fprv4hi (!TARGET_64BIT && TARGET_LOONGSON_VECTORS) +#define HAVE_move_doubleword_fprv8qi (!TARGET_64BIT && TARGET_LOONGSON_VECTORS) +#define HAVE_move_doubleword_fprtf (TARGET_64BIT && TARGET_FLOAT64) +#define HAVE_load_const_gp_si (Pmode == SImode) +#define HAVE_load_const_gp_di (Pmode == DImode) +#define HAVE_clear_cache 1 +#define HAVE_movmemsi (!TARGET_MIPS16 && !TARGET_MEMCPY) +#define HAVE_ashlsi3 1 +#define HAVE_ashrsi3 1 +#define HAVE_lshrsi3 1 +#define HAVE_ashldi3 (TARGET_64BIT) +#define HAVE_ashrdi3 (TARGET_64BIT) +#define HAVE_lshrdi3 (TARGET_64BIT) +#define HAVE_cbranchsi4 1 +#define HAVE_cbranchdi4 (TARGET_64BIT) +#define HAVE_cbranchsf4 (TARGET_HARD_FLOAT) +#define HAVE_cbranchdf4 (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT) +#define HAVE_condjump 1 +#define HAVE_cstoresi4 1 +#define HAVE_cstoredi4 (TARGET_64BIT) +#define HAVE_jump 1 +#define HAVE_indirect_jump 1 +#define HAVE_tablejump (!TARGET_MIPS16_SHORT_JUMP_TABLES) +#define HAVE_casesi (TARGET_MIPS16_SHORT_JUMP_TABLES) +#define HAVE_builtin_setjmp_setup (TARGET_USE_GOT) +#define HAVE_builtin_longjmp (TARGET_USE_GOT) +#define HAVE_prologue 1 +#define HAVE_epilogue 1 +#define HAVE_sibcall_epilogue 1 +#define HAVE_return (mips_can_use_return_insn ()) +#define HAVE_simple_return 1 +#define HAVE_eh_return 1 +#define HAVE_exception_receiver (TARGET_USE_GOT) +#define HAVE_nonlocal_goto_receiver (TARGET_USE_GOT) +#define HAVE_sibcall (TARGET_SIBCALLS) +#define HAVE_sibcall_value (TARGET_SIBCALLS) +#define HAVE_call 1 +#define HAVE_call_value 1 +#define HAVE_untyped_call 1 +#define HAVE_movsicc (ISA_HAS_CONDMOVE || ISA_HAS_SEL) +#define HAVE_movdicc ((ISA_HAS_CONDMOVE || ISA_HAS_SEL) && (TARGET_64BIT)) +#define HAVE_movsfcc ((ISA_HAS_FP_CONDMOVE \ + || (ISA_HAS_SEL && ISA_HAS_CCF)) && (TARGET_HARD_FLOAT)) +#define HAVE_movdfcc ((ISA_HAS_FP_CONDMOVE \ + || (ISA_HAS_SEL && ISA_HAS_CCF)) && (TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT)) +#define HAVE_get_thread_pointersi ((HAVE_AS_TLS) && (Pmode == SImode)) +#define HAVE_get_thread_pointerdi ((HAVE_AS_TLS) && (Pmode == DImode)) +#define HAVE_mips_get_fcsr (TARGET_HARD_FLOAT_ABI) +#define HAVE_mips_set_fcsr (TARGET_HARD_FLOAT_ABI) +#define HAVE_memory_barrier (GENERATE_SYNC) +#define HAVE_sync_compare_and_swapqi (GENERATE_LL_SC) +#define HAVE_sync_compare_and_swaphi (GENERATE_LL_SC) +#define HAVE_sync_addqi (GENERATE_LL_SC) +#define HAVE_sync_subqi (GENERATE_LL_SC) +#define HAVE_sync_iorqi (GENERATE_LL_SC) +#define HAVE_sync_xorqi (GENERATE_LL_SC) +#define HAVE_sync_andqi (GENERATE_LL_SC) +#define HAVE_sync_addhi (GENERATE_LL_SC) +#define HAVE_sync_subhi (GENERATE_LL_SC) +#define HAVE_sync_iorhi (GENERATE_LL_SC) +#define HAVE_sync_xorhi (GENERATE_LL_SC) +#define HAVE_sync_andhi (GENERATE_LL_SC) +#define HAVE_sync_old_addqi (GENERATE_LL_SC) +#define HAVE_sync_old_subqi (GENERATE_LL_SC) +#define HAVE_sync_old_iorqi (GENERATE_LL_SC) +#define HAVE_sync_old_xorqi (GENERATE_LL_SC) +#define HAVE_sync_old_andqi (GENERATE_LL_SC) +#define HAVE_sync_old_addhi (GENERATE_LL_SC) +#define HAVE_sync_old_subhi (GENERATE_LL_SC) +#define HAVE_sync_old_iorhi (GENERATE_LL_SC) +#define HAVE_sync_old_xorhi (GENERATE_LL_SC) +#define HAVE_sync_old_andhi (GENERATE_LL_SC) +#define HAVE_sync_new_addqi (GENERATE_LL_SC) +#define HAVE_sync_new_subqi (GENERATE_LL_SC) +#define HAVE_sync_new_iorqi (GENERATE_LL_SC) +#define HAVE_sync_new_xorqi (GENERATE_LL_SC) +#define HAVE_sync_new_andqi (GENERATE_LL_SC) +#define HAVE_sync_new_addhi (GENERATE_LL_SC) +#define HAVE_sync_new_subhi (GENERATE_LL_SC) +#define HAVE_sync_new_iorhi (GENERATE_LL_SC) +#define HAVE_sync_new_xorhi (GENERATE_LL_SC) +#define HAVE_sync_new_andhi (GENERATE_LL_SC) +#define HAVE_sync_nandqi (GENERATE_LL_SC) +#define HAVE_sync_nandhi (GENERATE_LL_SC) +#define HAVE_sync_old_nandqi (GENERATE_LL_SC) +#define HAVE_sync_old_nandhi (GENERATE_LL_SC) +#define HAVE_sync_new_nandqi (GENERATE_LL_SC) +#define HAVE_sync_new_nandhi (GENERATE_LL_SC) +#define HAVE_sync_lock_test_and_setqi (GENERATE_LL_SC) +#define HAVE_sync_lock_test_and_sethi (GENERATE_LL_SC) +#define HAVE_atomic_exchangesi (GENERATE_LL_SC || ISA_HAS_SWAP) +#define HAVE_atomic_exchangedi ((GENERATE_LL_SC || ISA_HAS_SWAP) && (TARGET_64BIT)) +#define HAVE_atomic_fetch_addsi (GENERATE_LL_SC || ISA_HAS_LDADD) +#define HAVE_atomic_fetch_adddi ((GENERATE_LL_SC || ISA_HAS_LDADD) && (TARGET_64BIT)) +#define HAVE_movv2sfcc (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_vec_perm_constv2sf (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_mips_puu_ps (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_mips_pul_ps (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_mips_plu_ps (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_mips_pll_ps (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_vec_initv2sf (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_vec_setv2sf (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_mips_cvt_ps_s (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_mips_cvt_s_pl (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_mips_cvt_s_pu (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_reduc_plus_scal_v2sf (TARGET_HARD_FLOAT && TARGET_MIPS3D) +#define HAVE_mips_abs_ps (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_scc_ps 1 +#define HAVE_single_cc 1 +#define HAVE_vcondv2sfv2sf (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_sminv2sf3 (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_smaxv2sf3 (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_reduc_smin_scal_v2sf (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_reduc_smax_scal_v2sf (TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT) +#define HAVE_mips_lbux (ISA_HAS_DSP) +#define HAVE_mips_lhx (ISA_HAS_DSP) +#define HAVE_mips_lwx (ISA_HAS_DSP) +#define HAVE_mips_ldx ((ISA_HAS_DSP) && (TARGET_64BIT)) +#define HAVE_mips_madd (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_maddu (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_msub (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_mips_msubu (ISA_HAS_DSP && !TARGET_64BIT) +#define HAVE_movv2si (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_movv4hi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_movv8qi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_initv2si (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_initv4hi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_initv8qi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_setv4hi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_sdot_prodv4hi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_smaxv2si3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_smaxv8qi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_sminv2si3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_sminv8qi3 (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_perm_constv2si (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_perm_constv4hi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_perm_constv8qi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_unpacks_lo_v4hi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_unpacks_lo_v8qi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_unpacks_hi_v4hi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_unpacks_hi_v8qi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_unpacku_lo_v4hi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_unpacku_lo_v8qi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_unpacku_hi_v4hi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_unpacku_hi_v8qi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_reduc_plus_scal_v2si (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_reduc_plus_scal_v4hi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_reduc_plus_scal_v8qi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_reduc_smax_scal_v2si (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_reduc_smax_scal_v4hi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_reduc_smax_scal_v8qi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_reduc_smin_scal_v2si (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_reduc_smin_scal_v4hi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_reduc_smin_scal_v8qi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_reduc_umax_scal_v8qi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_reduc_umin_scal_v8qi (TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS) +#define HAVE_vec_initv2df (ISA_HAS_MSA) +#define HAVE_vec_initv4sf (ISA_HAS_MSA) +#define HAVE_vec_initv2di (ISA_HAS_MSA) +#define HAVE_vec_initv4si (ISA_HAS_MSA) +#define HAVE_vec_initv8hi (ISA_HAS_MSA) +#define HAVE_vec_initv16qi (ISA_HAS_MSA) +#define HAVE_vec_unpacks_hi_v4sf (ISA_HAS_MSA) +#define HAVE_vec_unpacks_lo_v4sf (ISA_HAS_MSA) +#define HAVE_vec_unpacks_hi_v4si (ISA_HAS_MSA) +#define HAVE_vec_unpacks_hi_v8hi (ISA_HAS_MSA) +#define HAVE_vec_unpacks_hi_v16qi (ISA_HAS_MSA) +#define HAVE_vec_unpacks_lo_v4si (ISA_HAS_MSA) +#define HAVE_vec_unpacks_lo_v8hi (ISA_HAS_MSA) +#define HAVE_vec_unpacks_lo_v16qi (ISA_HAS_MSA) +#define HAVE_vec_unpacku_hi_v4si (ISA_HAS_MSA) +#define HAVE_vec_unpacku_hi_v8hi (ISA_HAS_MSA) +#define HAVE_vec_unpacku_hi_v16qi (ISA_HAS_MSA) +#define HAVE_vec_unpacku_lo_v4si (ISA_HAS_MSA) +#define HAVE_vec_unpacku_lo_v8hi (ISA_HAS_MSA) +#define HAVE_vec_unpacku_lo_v16qi (ISA_HAS_MSA) +#define HAVE_vec_extractv2di (ISA_HAS_MSA) +#define HAVE_vec_extractv4si (ISA_HAS_MSA) +#define HAVE_vec_extractv8hi (ISA_HAS_MSA) +#define HAVE_vec_extractv16qi (ISA_HAS_MSA) +#define HAVE_vec_extractv2df (ISA_HAS_MSA) +#define HAVE_vec_extractv4sf (ISA_HAS_MSA) +#define HAVE_vec_setv2di (ISA_HAS_MSA) +#define HAVE_vec_setv4si (ISA_HAS_MSA) +#define HAVE_vec_setv8hi (ISA_HAS_MSA) +#define HAVE_vec_setv16qi (ISA_HAS_MSA) +#define HAVE_vec_setv2df (ISA_HAS_MSA) +#define HAVE_vec_setv4sf (ISA_HAS_MSA) +#define HAVE_vconduv2dfv2di (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V2DFmode) == GET_MODE_NUNITS (V2DImode))) +#define HAVE_vconduv2dfv4si (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V2DFmode) == GET_MODE_NUNITS (V4SImode))) +#define HAVE_vconduv2dfv8hi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V2DFmode) == GET_MODE_NUNITS (V8HImode))) +#define HAVE_vconduv2dfv16qi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V2DFmode) == GET_MODE_NUNITS (V16QImode))) +#define HAVE_vconduv4sfv2di (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V4SFmode) == GET_MODE_NUNITS (V2DImode))) +#define HAVE_vconduv4sfv4si (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V4SFmode) == GET_MODE_NUNITS (V4SImode))) +#define HAVE_vconduv4sfv8hi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V4SFmode) == GET_MODE_NUNITS (V8HImode))) +#define HAVE_vconduv4sfv16qi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V4SFmode) == GET_MODE_NUNITS (V16QImode))) +#define HAVE_vconduv2div2di (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V2DImode) == GET_MODE_NUNITS (V2DImode))) +#define HAVE_vconduv2div4si (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V2DImode) == GET_MODE_NUNITS (V4SImode))) +#define HAVE_vconduv2div8hi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V2DImode) == GET_MODE_NUNITS (V8HImode))) +#define HAVE_vconduv2div16qi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V2DImode) == GET_MODE_NUNITS (V16QImode))) +#define HAVE_vconduv4siv2di (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V4SImode) == GET_MODE_NUNITS (V2DImode))) +#define HAVE_vconduv4siv4si (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V4SImode) == GET_MODE_NUNITS (V4SImode))) +#define HAVE_vconduv4siv8hi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V4SImode) == GET_MODE_NUNITS (V8HImode))) +#define HAVE_vconduv4siv16qi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V4SImode) == GET_MODE_NUNITS (V16QImode))) +#define HAVE_vconduv8hiv2di (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V8HImode) == GET_MODE_NUNITS (V2DImode))) +#define HAVE_vconduv8hiv4si (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V8HImode) == GET_MODE_NUNITS (V4SImode))) +#define HAVE_vconduv8hiv8hi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V8HImode) == GET_MODE_NUNITS (V8HImode))) +#define HAVE_vconduv8hiv16qi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V8HImode) == GET_MODE_NUNITS (V16QImode))) +#define HAVE_vconduv16qiv2di (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V16QImode) == GET_MODE_NUNITS (V2DImode))) +#define HAVE_vconduv16qiv4si (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V16QImode) == GET_MODE_NUNITS (V4SImode))) +#define HAVE_vconduv16qiv8hi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V16QImode) == GET_MODE_NUNITS (V8HImode))) +#define HAVE_vconduv16qiv16qi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V16QImode) == GET_MODE_NUNITS (V16QImode))) +#define HAVE_vcondv2dfv2df (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V2DFmode) == GET_MODE_NUNITS (V2DFmode))) +#define HAVE_vcondv4sfv2df (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V4SFmode) == GET_MODE_NUNITS (V2DFmode))) +#define HAVE_vcondv2div2df (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V2DImode) == GET_MODE_NUNITS (V2DFmode))) +#define HAVE_vcondv4siv2df (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V4SImode) == GET_MODE_NUNITS (V2DFmode))) +#define HAVE_vcondv8hiv2df (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V8HImode) == GET_MODE_NUNITS (V2DFmode))) +#define HAVE_vcondv16qiv2df (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V16QImode) == GET_MODE_NUNITS (V2DFmode))) +#define HAVE_vcondv2dfv4sf (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V2DFmode) == GET_MODE_NUNITS (V4SFmode))) +#define HAVE_vcondv4sfv4sf (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V4SFmode) == GET_MODE_NUNITS (V4SFmode))) +#define HAVE_vcondv2div4sf (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V2DImode) == GET_MODE_NUNITS (V4SFmode))) +#define HAVE_vcondv4siv4sf (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V4SImode) == GET_MODE_NUNITS (V4SFmode))) +#define HAVE_vcondv8hiv4sf (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V8HImode) == GET_MODE_NUNITS (V4SFmode))) +#define HAVE_vcondv16qiv4sf (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V16QImode) == GET_MODE_NUNITS (V4SFmode))) +#define HAVE_vcondv2dfv2di (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V2DFmode) == GET_MODE_NUNITS (V2DImode))) +#define HAVE_vcondv4sfv2di (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V4SFmode) == GET_MODE_NUNITS (V2DImode))) +#define HAVE_vcondv2div2di (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V2DImode) == GET_MODE_NUNITS (V2DImode))) +#define HAVE_vcondv4siv2di (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V4SImode) == GET_MODE_NUNITS (V2DImode))) +#define HAVE_vcondv8hiv2di (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V8HImode) == GET_MODE_NUNITS (V2DImode))) +#define HAVE_vcondv16qiv2di (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V16QImode) == GET_MODE_NUNITS (V2DImode))) +#define HAVE_vcondv2dfv4si (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V2DFmode) == GET_MODE_NUNITS (V4SImode))) +#define HAVE_vcondv4sfv4si (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V4SFmode) == GET_MODE_NUNITS (V4SImode))) +#define HAVE_vcondv2div4si (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V2DImode) == GET_MODE_NUNITS (V4SImode))) +#define HAVE_vcondv4siv4si (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V4SImode) == GET_MODE_NUNITS (V4SImode))) +#define HAVE_vcondv8hiv4si (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V8HImode) == GET_MODE_NUNITS (V4SImode))) +#define HAVE_vcondv16qiv4si (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V16QImode) == GET_MODE_NUNITS (V4SImode))) +#define HAVE_vcondv2dfv8hi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V2DFmode) == GET_MODE_NUNITS (V8HImode))) +#define HAVE_vcondv4sfv8hi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V4SFmode) == GET_MODE_NUNITS (V8HImode))) +#define HAVE_vcondv2div8hi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V2DImode) == GET_MODE_NUNITS (V8HImode))) +#define HAVE_vcondv4siv8hi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V4SImode) == GET_MODE_NUNITS (V8HImode))) +#define HAVE_vcondv8hiv8hi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V8HImode) == GET_MODE_NUNITS (V8HImode))) +#define HAVE_vcondv16qiv8hi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V16QImode) == GET_MODE_NUNITS (V8HImode))) +#define HAVE_vcondv2dfv16qi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V2DFmode) == GET_MODE_NUNITS (V16QImode))) +#define HAVE_vcondv4sfv16qi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V4SFmode) == GET_MODE_NUNITS (V16QImode))) +#define HAVE_vcondv2div16qi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V2DImode) == GET_MODE_NUNITS (V16QImode))) +#define HAVE_vcondv4siv16qi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V4SImode) == GET_MODE_NUNITS (V16QImode))) +#define HAVE_vcondv8hiv16qi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V8HImode) == GET_MODE_NUNITS (V16QImode))) +#define HAVE_vcondv16qiv16qi (ISA_HAS_MSA \ + && (GET_MODE_NUNITS (V16QImode) == GET_MODE_NUNITS (V16QImode))) +#define HAVE_vec_perm_constv2df (ISA_HAS_MSA) +#define HAVE_vec_perm_constv4sf (ISA_HAS_MSA) +#define HAVE_vec_perm_constv2di (ISA_HAS_MSA) +#define HAVE_vec_perm_constv4si (ISA_HAS_MSA) +#define HAVE_vec_perm_constv8hi (ISA_HAS_MSA) +#define HAVE_vec_perm_constv16qi (ISA_HAS_MSA) +#define HAVE_absv2di2 (ISA_HAS_MSA) +#define HAVE_absv4si2 (ISA_HAS_MSA) +#define HAVE_absv8hi2 (ISA_HAS_MSA) +#define HAVE_absv16qi2 (ISA_HAS_MSA) +#define HAVE_negv2df2 (ISA_HAS_MSA) +#define HAVE_negv4sf2 (ISA_HAS_MSA) +#define HAVE_negv2di2 (ISA_HAS_MSA) +#define HAVE_negv4si2 (ISA_HAS_MSA) +#define HAVE_negv8hi2 (ISA_HAS_MSA) +#define HAVE_negv16qi2 (ISA_HAS_MSA) +#define HAVE_msa_ldiv2di (ISA_HAS_MSA) +#define HAVE_msa_ldiv4si (ISA_HAS_MSA) +#define HAVE_msa_ldiv8hi (ISA_HAS_MSA) +#define HAVE_msa_ldiv16qi (ISA_HAS_MSA) +#define HAVE_movv2df (ISA_HAS_MSA) +#define HAVE_movv4sf (ISA_HAS_MSA) +#define HAVE_movv2di (ISA_HAS_MSA) +#define HAVE_movv4si (ISA_HAS_MSA) +#define HAVE_movv8hi (ISA_HAS_MSA) +#define HAVE_movv16qi (ISA_HAS_MSA) +#define HAVE_movmisalignv2df (ISA_HAS_MSA) +#define HAVE_movmisalignv4sf (ISA_HAS_MSA) +#define HAVE_movmisalignv2di (ISA_HAS_MSA) +#define HAVE_movmisalignv4si (ISA_HAS_MSA) +#define HAVE_movmisalignv8hi (ISA_HAS_MSA) +#define HAVE_movmisalignv16qi (ISA_HAS_MSA) +#define HAVE_msa_ld_d_f (ISA_HAS_MSA) +#define HAVE_msa_ld_w_f (ISA_HAS_MSA) +#define HAVE_msa_ld_d (ISA_HAS_MSA) +#define HAVE_msa_ld_w (ISA_HAS_MSA) +#define HAVE_msa_ld_h (ISA_HAS_MSA) +#define HAVE_msa_ld_b (ISA_HAS_MSA) +#define HAVE_msa_st_d_f (ISA_HAS_MSA) +#define HAVE_msa_st_w_f (ISA_HAS_MSA) +#define HAVE_msa_st_d (ISA_HAS_MSA) +#define HAVE_msa_st_w (ISA_HAS_MSA) +#define HAVE_msa_st_h (ISA_HAS_MSA) +#define HAVE_msa_st_b (ISA_HAS_MSA) +extern rtx gen_ls2_alu1_turn_enabled_insn (void); +extern rtx gen_ls2_alu2_turn_enabled_insn (void); +extern rtx gen_ls2_falu1_turn_enabled_insn (void); +extern rtx gen_ls2_falu2_turn_enabled_insn (void); +extern rtx gen_trap (void); +extern rtx gen_addsf3 (rtx, rtx, rtx); +extern rtx gen_adddf3 (rtx, rtx, rtx); +extern rtx gen_addv2sf3 (rtx, rtx, rtx); +extern rtx gen_subsf3 (rtx, rtx, rtx); +extern rtx gen_subdf3 (rtx, rtx, rtx); +extern rtx gen_subv2sf3 (rtx, rtx, rtx); +extern rtx gen_subsi3 (rtx, rtx, rtx); +extern rtx gen_subdi3 (rtx, rtx, rtx); +extern rtx gen_mulv2sf3 (rtx, rtx, rtx); +extern rtx gen_mulsi3_mul3_nohilo (rtx, rtx, rtx); +extern rtx gen_muldi3_mul3_nohilo (rtx, rtx, rtx); +extern rtx gen_mulsi3_mul3 (rtx, rtx, rtx); +extern rtx gen_muldi3_mul3 (rtx, rtx, rtx); +extern rtx gen_mulsi3_internal (rtx, rtx, rtx); +extern rtx gen_muldi3_internal (rtx, rtx, rtx); +extern rtx gen_mulsi3_r4000 (rtx, rtx, rtx); +extern rtx gen_muldi3_r4000 (rtx, rtx, rtx); +extern rtx gen_mulsidi3_32bit (rtx, rtx, rtx); +extern rtx gen_umulsidi3_32bit (rtx, rtx, rtx); +extern rtx gen_mulsidi3_32bit_r4000 (rtx, rtx, rtx); +extern rtx gen_umulsidi3_32bit_r4000 (rtx, rtx, rtx); +extern rtx gen_mulsidi3_64bit (rtx, rtx, rtx); +extern rtx gen_umulsidi3_64bit (rtx, rtx, rtx); +extern rtx gen_mulsidi3_64bit_hilo (rtx, rtx, rtx); +extern rtx gen_umulsidi3_64bit_hilo (rtx, rtx, rtx); +extern rtx gen_mulsidi3_64bit_dmul (rtx, rtx, rtx); +extern rtx gen_mulsidi3_64bit_r6dmul (rtx, rtx, rtx); +extern rtx gen_msubsidi4 (rtx, rtx, rtx, rtx); +extern rtx gen_umsubsidi4 (rtx, rtx, rtx, rtx); +extern rtx gen_smulsi3_highpart_r6 (rtx, rtx, rtx); +extern rtx gen_umulsi3_highpart_r6 (rtx, rtx, rtx); +extern rtx gen_smulsi3_highpart_internal (rtx, rtx, rtx); +extern rtx gen_umulsi3_highpart_internal (rtx, rtx, rtx); +extern rtx gen_smulsi3_highpart_mulhi_internal (rtx, rtx, rtx); +extern rtx gen_umulsi3_highpart_mulhi_internal (rtx, rtx, rtx); +extern rtx gen_smuldi3_highpart_r6 (rtx, rtx, rtx); +extern rtx gen_umuldi3_highpart_r6 (rtx, rtx, rtx); +extern rtx gen_smuldi3_highpart_internal (rtx, rtx, rtx); +extern rtx gen_umuldi3_highpart_internal (rtx, rtx, rtx); +extern rtx gen_mulditi3_internal (rtx, rtx, rtx); +extern rtx gen_umulditi3_internal (rtx, rtx, rtx); +extern rtx gen_mulditi3_r4000 (rtx, rtx, rtx); +extern rtx gen_umulditi3_r4000 (rtx, rtx, rtx); +extern rtx gen_madsi (rtx, rtx, rtx); +extern rtx gen_maddsidi4 (rtx, rtx, rtx, rtx); +extern rtx gen_umaddsidi4 (rtx, rtx, rtx, rtx); +extern rtx gen_divmodsi4_mips16 (rtx, rtx, rtx, rtx, rtx); +extern rtx gen_divmoddi4_mips16 (rtx, rtx, rtx, rtx, rtx); +extern rtx gen_udivmodsi4_mips16 (rtx, rtx, rtx, rtx, rtx); +extern rtx gen_udivmoddi4_mips16 (rtx, rtx, rtx, rtx, rtx); +extern rtx gen_divmodsi4_hilo_di (rtx, rtx, rtx); +extern rtx gen_udivmodsi4_hilo_di (rtx, rtx, rtx); +static inline rtx gen_divmoddi4_hilo_di (rtx, rtx, rtx); +static inline rtx +gen_divmoddi4_hilo_di(rtx ARG_UNUSED (a), rtx ARG_UNUSED (b), rtx ARG_UNUSED (c)) +{ + return 0; +} +static inline rtx gen_udivmoddi4_hilo_di (rtx, rtx, rtx); +static inline rtx +gen_udivmoddi4_hilo_di(rtx ARG_UNUSED (a), rtx ARG_UNUSED (b), rtx ARG_UNUSED (c)) +{ + return 0; +} +extern rtx gen_divmodsi4_hilo_ti (rtx, rtx, rtx); +extern rtx gen_udivmodsi4_hilo_ti (rtx, rtx, rtx); +extern rtx gen_divmoddi4_hilo_ti (rtx, rtx, rtx); +extern rtx gen_udivmoddi4_hilo_ti (rtx, rtx, rtx); +extern rtx gen_divsi3 (rtx, rtx, rtx); +extern rtx gen_udivsi3 (rtx, rtx, rtx); +extern rtx gen_divdi3 (rtx, rtx, rtx); +extern rtx gen_udivdi3 (rtx, rtx, rtx); +extern rtx gen_modsi3 (rtx, rtx, rtx); +extern rtx gen_umodsi3 (rtx, rtx, rtx); +extern rtx gen_moddi3 (rtx, rtx, rtx); +extern rtx gen_umoddi3 (rtx, rtx, rtx); +extern rtx gen_sqrtsf2 (rtx, rtx); +extern rtx gen_sqrtdf2 (rtx, rtx); +extern rtx gen_sqrtv2sf2 (rtx, rtx); +extern rtx gen_abssf2 (rtx, rtx); +extern rtx gen_absdf2 (rtx, rtx); +extern rtx gen_absv2sf2 (rtx, rtx); +extern rtx gen_clzsi2 (rtx, rtx); +extern rtx gen_clzdi2 (rtx, rtx); +extern rtx gen_popcountsi2 (rtx, rtx); +extern rtx gen_popcountdi2 (rtx, rtx); +extern rtx gen_negsi2 (rtx, rtx); +extern rtx gen_negdi2 (rtx, rtx); +extern rtx gen_negsf2 (rtx, rtx); +extern rtx gen_negdf2 (rtx, rtx); +extern rtx gen_negv2sf2 (rtx, rtx); +extern rtx gen_one_cmplsi2 (rtx, rtx); +extern rtx gen_one_cmpldi2 (rtx, rtx); +extern rtx gen_truncdfsf2 (rtx, rtx); +extern rtx gen_truncdiqi2 (rtx, rtx); +extern rtx gen_truncdihi2 (rtx, rtx); +extern rtx gen_truncdisi2 (rtx, rtx); +extern rtx gen_extendsidi2 (rtx, rtx); +extern rtx gen_extendsfdf2 (rtx, rtx); +extern rtx gen_fix_truncdfsi2_insn (rtx, rtx); +extern rtx gen_fix_truncdfsi2_macro (rtx, rtx); +extern rtx gen_fix_truncsfsi2_insn (rtx, rtx); +extern rtx gen_fix_truncsfsi2_macro (rtx, rtx); +extern rtx gen_fix_truncdfdi2 (rtx, rtx); +extern rtx gen_fix_truncsfdi2 (rtx, rtx); +extern rtx gen_floatsidf2 (rtx, rtx); +extern rtx gen_floatdidf2 (rtx, rtx); +extern rtx gen_floatsisf2 (rtx, rtx); +extern rtx gen_floatdisf2 (rtx, rtx); +extern rtx gen_mov_lwl (rtx, rtx, rtx); +extern rtx gen_mov_ldl (rtx, rtx, rtx); +extern rtx gen_mov_lwr (rtx, rtx, rtx, rtx); +extern rtx gen_mov_ldr (rtx, rtx, rtx, rtx); +extern rtx gen_mov_swl (rtx, rtx, rtx); +extern rtx gen_mov_sdl (rtx, rtx, rtx); +extern rtx gen_mov_swr (rtx, rtx, rtx); +extern rtx gen_mov_sdr (rtx, rtx, rtx); +extern rtx gen_load_gotsi (rtx, rtx, rtx); +extern rtx gen_load_gotdi (rtx, rtx, rtx); +extern rtx gen_movccf (rtx, rtx); +extern rtx gen_mfhisi_di (rtx, rtx); +static inline rtx gen_mfhidi_di (rtx, rtx); +static inline rtx +gen_mfhidi_di(rtx ARG_UNUSED (a), rtx ARG_UNUSED (b)) +{ + return 0; +} +extern rtx gen_mfhisi_ti (rtx, rtx); +extern rtx gen_mfhidi_ti (rtx, rtx); +extern rtx gen_mthisi_di (rtx, rtx, rtx); +static inline rtx gen_mthidi_di (rtx, rtx, rtx); +static inline rtx +gen_mthidi_di(rtx ARG_UNUSED (a), rtx ARG_UNUSED (b), rtx ARG_UNUSED (c)) +{ + return 0; +} +extern rtx gen_mthisi_ti (rtx, rtx, rtx); +extern rtx gen_mthidi_ti (rtx, rtx, rtx); +extern rtx gen_load_lowdf (rtx, rtx); +extern rtx gen_load_lowdi (rtx, rtx); +extern rtx gen_load_lowv2sf (rtx, rtx); +extern rtx gen_load_lowv2si (rtx, rtx); +extern rtx gen_load_lowv4hi (rtx, rtx); +extern rtx gen_load_lowv8qi (rtx, rtx); +extern rtx gen_load_lowtf (rtx, rtx); +extern rtx gen_load_highdf (rtx, rtx, rtx); +extern rtx gen_load_highdi (rtx, rtx, rtx); +extern rtx gen_load_highv2sf (rtx, rtx, rtx); +extern rtx gen_load_highv2si (rtx, rtx, rtx); +extern rtx gen_load_highv4hi (rtx, rtx, rtx); +extern rtx gen_load_highv8qi (rtx, rtx, rtx); +extern rtx gen_load_hightf (rtx, rtx, rtx); +extern rtx gen_store_worddf (rtx, rtx, rtx); +extern rtx gen_store_worddi (rtx, rtx, rtx); +extern rtx gen_store_wordv2sf (rtx, rtx, rtx); +extern rtx gen_store_wordv2si (rtx, rtx, rtx); +extern rtx gen_store_wordv4hi (rtx, rtx, rtx); +extern rtx gen_store_wordv8qi (rtx, rtx, rtx); +extern rtx gen_store_wordtf (rtx, rtx, rtx); +extern rtx gen_mthc1df (rtx, rtx, rtx); +extern rtx gen_mthc1di (rtx, rtx, rtx); +extern rtx gen_mthc1v2sf (rtx, rtx, rtx); +extern rtx gen_mthc1v2si (rtx, rtx, rtx); +extern rtx gen_mthc1v4hi (rtx, rtx, rtx); +extern rtx gen_mthc1v8qi (rtx, rtx, rtx); +extern rtx gen_mthc1tf (rtx, rtx, rtx); +extern rtx gen_mfhc1df (rtx, rtx); +extern rtx gen_mfhc1di (rtx, rtx); +extern rtx gen_mfhc1v2sf (rtx, rtx); +extern rtx gen_mfhc1v2si (rtx, rtx); +extern rtx gen_mfhc1v4hi (rtx, rtx); +extern rtx gen_mfhc1v8qi (rtx, rtx); +extern rtx gen_mfhc1tf (rtx, rtx); +extern rtx gen_loadgp_newabi_si (rtx, rtx, rtx); +extern rtx gen_loadgp_newabi_di (rtx, rtx, rtx); +extern rtx gen_loadgp_absolute_si (rtx, rtx); +extern rtx gen_loadgp_absolute_di (rtx, rtx); +extern rtx gen_loadgp_blockage (void); +extern rtx gen_loadgp_rtp_si (rtx, rtx, rtx); +extern rtx gen_loadgp_rtp_di (rtx, rtx, rtx); +extern rtx gen_copygp_mips16_si (rtx, rtx); +extern rtx gen_copygp_mips16_di (rtx, rtx); +extern rtx gen_potential_cprestore_si (rtx, rtx, rtx, rtx); +extern rtx gen_potential_cprestore_di (rtx, rtx, rtx, rtx); +extern rtx gen_cprestore_si (rtx, rtx); +extern rtx gen_cprestore_di (rtx, rtx); +extern rtx gen_use_cprestore_si (rtx); +extern rtx gen_use_cprestore_di (rtx); +extern rtx gen_sync (void); +extern rtx gen_synci (rtx); +extern rtx gen_rdhwr_synci_step_si (rtx); +extern rtx gen_rdhwr_synci_step_di (rtx); +extern rtx gen_clear_hazard_si (void); +extern rtx gen_clear_hazard_di (void); +extern rtx gen_mips_cache (rtx, rtx); +extern rtx gen_r10k_cache_barrier (void); +extern rtx gen_lsa (rtx, rtx, rtx, rtx); +extern rtx gen_dlsa (rtx, rtx, rtx, rtx); +extern rtx gen_rotrsi3 (rtx, rtx, rtx); +extern rtx gen_rotrdi3 (rtx, rtx, rtx); +extern rtx gen_bswaphi2 (rtx, rtx); +extern rtx gen_bswapsi2 (rtx, rtx); +extern rtx gen_bswapdi2 (rtx, rtx); +extern rtx gen_wsbh (rtx, rtx); +extern rtx gen_dsbh (rtx, rtx); +extern rtx gen_dshd (rtx, rtx); +extern rtx gen_sunordered_sf_using_cc (rtx, rtx, rtx); +extern rtx gen_suneq_sf_using_cc (rtx, rtx, rtx); +extern rtx gen_sunlt_sf_using_cc (rtx, rtx, rtx); +extern rtx gen_sunle_sf_using_cc (rtx, rtx, rtx); +extern rtx gen_seq_sf_using_cc (rtx, rtx, rtx); +extern rtx gen_slt_sf_using_cc (rtx, rtx, rtx); +extern rtx gen_sle_sf_using_cc (rtx, rtx, rtx); +static inline rtx gen_sordered_sf_using_cc (rtx, rtx, rtx); +static inline rtx +gen_sordered_sf_using_cc(rtx ARG_UNUSED (a), rtx ARG_UNUSED (b), rtx ARG_UNUSED (c)) +{ + return 0; +} +static inline rtx gen_sltgt_sf_using_cc (rtx, rtx, rtx); +static inline rtx +gen_sltgt_sf_using_cc(rtx ARG_UNUSED (a), rtx ARG_UNUSED (b), rtx ARG_UNUSED (c)) +{ + return 0; +} +static inline rtx gen_sne_sf_using_cc (rtx, rtx, rtx); +static inline rtx +gen_sne_sf_using_cc(rtx ARG_UNUSED (a), rtx ARG_UNUSED (b), rtx ARG_UNUSED (c)) +{ + return 0; +} +extern rtx gen_sunordered_df_using_cc (rtx, rtx, rtx); +extern rtx gen_suneq_df_using_cc (rtx, rtx, rtx); +extern rtx gen_sunlt_df_using_cc (rtx, rtx, rtx); +extern rtx gen_sunle_df_using_cc (rtx, rtx, rtx); +extern rtx gen_seq_df_using_cc (rtx, rtx, rtx); +extern rtx gen_slt_df_using_cc (rtx, rtx, rtx); +extern rtx gen_sle_df_using_cc (rtx, rtx, rtx); +static inline rtx gen_sordered_df_using_cc (rtx, rtx, rtx); +static inline rtx +gen_sordered_df_using_cc(rtx ARG_UNUSED (a), rtx ARG_UNUSED (b), rtx ARG_UNUSED (c)) +{ + return 0; +} +static inline rtx gen_sltgt_df_using_cc (rtx, rtx, rtx); +static inline rtx +gen_sltgt_df_using_cc(rtx ARG_UNUSED (a), rtx ARG_UNUSED (b), rtx ARG_UNUSED (c)) +{ + return 0; +} +static inline rtx gen_sne_df_using_cc (rtx, rtx, rtx); +static inline rtx +gen_sne_df_using_cc(rtx ARG_UNUSED (a), rtx ARG_UNUSED (b), rtx ARG_UNUSED (c)) +{ + return 0; +} +extern rtx gen_sunordered_sf_using_ccf (rtx, rtx, rtx); +extern rtx gen_suneq_sf_using_ccf (rtx, rtx, rtx); +extern rtx gen_sunlt_sf_using_ccf (rtx, rtx, rtx); +extern rtx gen_sunle_sf_using_ccf (rtx, rtx, rtx); +extern rtx gen_seq_sf_using_ccf (rtx, rtx, rtx); +extern rtx gen_slt_sf_using_ccf (rtx, rtx, rtx); +extern rtx gen_sle_sf_using_ccf (rtx, rtx, rtx); +extern rtx gen_sordered_sf_using_ccf (rtx, rtx, rtx); +extern rtx gen_sltgt_sf_using_ccf (rtx, rtx, rtx); +extern rtx gen_sne_sf_using_ccf (rtx, rtx, rtx); +extern rtx gen_sunordered_df_using_ccf (rtx, rtx, rtx); +extern rtx gen_suneq_df_using_ccf (rtx, rtx, rtx); +extern rtx gen_sunlt_df_using_ccf (rtx, rtx, rtx); +extern rtx gen_sunle_df_using_ccf (rtx, rtx, rtx); +extern rtx gen_seq_df_using_ccf (rtx, rtx, rtx); +extern rtx gen_slt_df_using_ccf (rtx, rtx, rtx); +extern rtx gen_sle_df_using_ccf (rtx, rtx, rtx); +extern rtx gen_sordered_df_using_ccf (rtx, rtx, rtx); +extern rtx gen_sltgt_df_using_ccf (rtx, rtx, rtx); +extern rtx gen_sne_df_using_ccf (rtx, rtx, rtx); +extern rtx gen_sge_sf_using_cc (rtx, rtx, rtx); +extern rtx gen_sgt_sf_using_cc (rtx, rtx, rtx); +extern rtx gen_sunge_sf_using_cc (rtx, rtx, rtx); +extern rtx gen_sungt_sf_using_cc (rtx, rtx, rtx); +extern rtx gen_sge_df_using_cc (rtx, rtx, rtx); +extern rtx gen_sgt_df_using_cc (rtx, rtx, rtx); +extern rtx gen_sunge_df_using_cc (rtx, rtx, rtx); +extern rtx gen_sungt_df_using_cc (rtx, rtx, rtx); +extern rtx gen_sge_sf_using_ccf (rtx, rtx, rtx); +extern rtx gen_sgt_sf_using_ccf (rtx, rtx, rtx); +extern rtx gen_sunge_sf_using_ccf (rtx, rtx, rtx); +extern rtx gen_sungt_sf_using_ccf (rtx, rtx, rtx); +extern rtx gen_sge_df_using_ccf (rtx, rtx, rtx); +extern rtx gen_sgt_df_using_ccf (rtx, rtx, rtx); +extern rtx gen_sunge_df_using_ccf (rtx, rtx, rtx); +extern rtx gen_sungt_df_using_ccf (rtx, rtx, rtx); +extern rtx gen_indirect_jump_si (rtx); +extern rtx gen_indirect_jump_di (rtx); +extern rtx gen_indirect_jump_and_restore_si (rtx, rtx, rtx); +extern rtx gen_indirect_jump_and_restore_di (rtx, rtx, rtx); +extern rtx gen_tablejump_si (rtx, rtx); +extern rtx gen_tablejump_di (rtx, rtx); +extern rtx gen_casesi_internal_mips16_si (rtx, rtx, rtx, rtx); +extern rtx gen_casesi_internal_mips16_di (rtx, rtx, rtx, rtx); +extern rtx gen_blockage (void); +extern rtx gen_probe_stack_range_si (rtx, rtx, rtx); +extern rtx gen_probe_stack_range_di (rtx, rtx, rtx); +extern rtx gen_return_internal (rtx); +extern rtx gen_simple_return_internal (rtx); +extern rtx gen_mips_eret (void); +extern rtx gen_mips_deret (void); +extern rtx gen_mips_di (void); +extern rtx gen_mips_ehb (void); +extern rtx gen_mips_rdpgpr_si (rtx, rtx); +extern rtx gen_mips_rdpgpr_di (rtx, rtx); +extern rtx gen_cop0_move (rtx, rtx); +extern rtx gen_eh_set_lr_si (rtx); +extern rtx gen_eh_set_lr_di (rtx); +extern rtx gen_restore_gp_si (void); +extern rtx gen_restore_gp_di (void); +extern rtx gen_move_gpsi (rtx, rtx); +extern rtx gen_move_gpdi (rtx, rtx); +extern rtx gen_load_callsi (rtx, rtx, rtx); +extern rtx gen_load_calldi (rtx, rtx, rtx); +extern rtx gen_set_got_version (void); +extern rtx gen_update_got_version (void); +extern rtx gen_sibcall_internal (rtx, rtx); +extern rtx gen_sibcall_value_internal (rtx, rtx, rtx); +extern rtx gen_sibcall_value_multiple_internal (rtx, rtx, rtx, rtx); +extern rtx gen_call_internal (rtx, rtx); +extern rtx gen_call_split (rtx, rtx); +extern rtx gen_call_internal_direct (rtx, rtx); +extern rtx gen_call_direct_split (rtx, rtx); +extern rtx gen_call_value_internal (rtx, rtx, rtx); +extern rtx gen_call_value_split (rtx, rtx, rtx); +extern rtx gen_call_value_internal_direct (rtx, rtx, rtx); +extern rtx gen_call_value_direct_split (rtx, rtx, rtx); +extern rtx gen_call_value_multiple_internal (rtx, rtx, rtx, rtx); +extern rtx gen_call_value_multiple_split (rtx, rtx, rtx, rtx); +extern rtx gen_prefetch (rtx, rtx, rtx); +extern rtx gen_nop (void); +extern rtx gen_hazard_nop (void); +extern rtx gen_insn_pseudo (void); +extern rtx gen_consttable (rtx); +extern rtx gen_consttable_end (rtx); +extern rtx gen_consttable_tls_reloc (rtx, rtx); +extern rtx gen_consttable_int (rtx, rtx); +extern rtx gen_consttable_float (rtx); +extern rtx gen_align (rtx); +extern rtx gen_tls_get_tp_si (rtx); +extern rtx gen_tls_get_tp_di (rtx); +extern rtx gen_tls_get_tp_mips16_si (rtx, rtx); +extern rtx gen_tls_get_tp_mips16_di (rtx, rtx); +extern rtx gen_mips_get_fcsr_mips16_si (rtx); +extern rtx gen_mips_get_fcsr_mips16_di (rtx); +extern rtx gen_mips_set_fcsr_mips16_si (rtx); +extern rtx gen_mips_set_fcsr_mips16_di (rtx); +extern rtx gen_sync_compare_and_swapsi (rtx, rtx, rtx, rtx); +extern rtx gen_sync_compare_and_swapdi (rtx, rtx, rtx, rtx); +extern rtx gen_compare_and_swap_12 (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_sync_addsi (rtx, rtx); +extern rtx gen_sync_adddi (rtx, rtx); +extern rtx gen_sync_add_12 (rtx, rtx, rtx, rtx); +extern rtx gen_sync_sub_12 (rtx, rtx, rtx, rtx); +extern rtx gen_sync_ior_12 (rtx, rtx, rtx, rtx); +extern rtx gen_sync_xor_12 (rtx, rtx, rtx, rtx); +extern rtx gen_sync_and_12 (rtx, rtx, rtx, rtx); +extern rtx gen_sync_old_add_12 (rtx, rtx, rtx, rtx, rtx); +extern rtx gen_sync_old_sub_12 (rtx, rtx, rtx, rtx, rtx); +extern rtx gen_sync_old_ior_12 (rtx, rtx, rtx, rtx, rtx); +extern rtx gen_sync_old_xor_12 (rtx, rtx, rtx, rtx, rtx); +extern rtx gen_sync_old_and_12 (rtx, rtx, rtx, rtx, rtx); +extern rtx gen_sync_new_add_12 (rtx, rtx, rtx, rtx, rtx); +extern rtx gen_sync_new_sub_12 (rtx, rtx, rtx, rtx, rtx); +extern rtx gen_sync_new_ior_12 (rtx, rtx, rtx, rtx, rtx); +extern rtx gen_sync_new_xor_12 (rtx, rtx, rtx, rtx, rtx); +extern rtx gen_sync_new_and_12 (rtx, rtx, rtx, rtx, rtx); +extern rtx gen_sync_nand_12 (rtx, rtx, rtx, rtx); +extern rtx gen_sync_old_nand_12 (rtx, rtx, rtx, rtx, rtx); +extern rtx gen_sync_new_nand_12 (rtx, rtx, rtx, rtx, rtx); +extern rtx gen_sync_subsi (rtx, rtx); +extern rtx gen_sync_subdi (rtx, rtx); +extern rtx gen_sync_old_addsi (rtx, rtx, rtx); +extern rtx gen_sync_old_adddi (rtx, rtx, rtx); +extern rtx gen_sync_old_subsi (rtx, rtx, rtx); +extern rtx gen_sync_old_subdi (rtx, rtx, rtx); +extern rtx gen_sync_new_addsi (rtx, rtx, rtx); +extern rtx gen_sync_new_adddi (rtx, rtx, rtx); +extern rtx gen_sync_new_subsi (rtx, rtx, rtx); +extern rtx gen_sync_new_subdi (rtx, rtx, rtx); +extern rtx gen_sync_iorsi (rtx, rtx); +extern rtx gen_sync_xorsi (rtx, rtx); +extern rtx gen_sync_andsi (rtx, rtx); +extern rtx gen_sync_iordi (rtx, rtx); +extern rtx gen_sync_xordi (rtx, rtx); +extern rtx gen_sync_anddi (rtx, rtx); +extern rtx gen_sync_old_iorsi (rtx, rtx, rtx); +extern rtx gen_sync_old_xorsi (rtx, rtx, rtx); +extern rtx gen_sync_old_andsi (rtx, rtx, rtx); +extern rtx gen_sync_old_iordi (rtx, rtx, rtx); +extern rtx gen_sync_old_xordi (rtx, rtx, rtx); +extern rtx gen_sync_old_anddi (rtx, rtx, rtx); +extern rtx gen_sync_new_iorsi (rtx, rtx, rtx); +extern rtx gen_sync_new_xorsi (rtx, rtx, rtx); +extern rtx gen_sync_new_andsi (rtx, rtx, rtx); +extern rtx gen_sync_new_iordi (rtx, rtx, rtx); +extern rtx gen_sync_new_xordi (rtx, rtx, rtx); +extern rtx gen_sync_new_anddi (rtx, rtx, rtx); +extern rtx gen_sync_nandsi (rtx, rtx); +extern rtx gen_sync_nanddi (rtx, rtx); +extern rtx gen_sync_old_nandsi (rtx, rtx, rtx); +extern rtx gen_sync_old_nanddi (rtx, rtx, rtx); +extern rtx gen_sync_new_nandsi (rtx, rtx, rtx); +extern rtx gen_sync_new_nanddi (rtx, rtx, rtx); +extern rtx gen_sync_lock_test_and_setsi (rtx, rtx, rtx); +extern rtx gen_sync_lock_test_and_setdi (rtx, rtx, rtx); +extern rtx gen_test_and_set_12 (rtx, rtx, rtx, rtx, rtx); +extern rtx gen_atomic_compare_and_swapsi (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_atomic_compare_and_swapdi (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_atomic_exchangesi_llsc (rtx, rtx, rtx, rtx); +extern rtx gen_atomic_exchangedi_llsc (rtx, rtx, rtx, rtx); +extern rtx gen_atomic_exchangesi_swap (rtx, rtx, rtx); +extern rtx gen_atomic_exchangedi_swap (rtx, rtx, rtx); +extern rtx gen_atomic_fetch_addsi_llsc (rtx, rtx, rtx, rtx); +extern rtx gen_atomic_fetch_adddi_llsc (rtx, rtx, rtx, rtx); +extern rtx gen_atomic_fetch_addsi_ldadd (rtx, rtx, rtx); +extern rtx gen_atomic_fetch_adddi_ldadd (rtx, rtx, rtx); +extern rtx gen_mips_cond_move_tf_ps (rtx, rtx, rtx, rtx); +extern rtx gen_vec_perm_const_ps (rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vec_concatv2sf (rtx, rtx, rtx); +extern rtx gen_vec_extractv2sf (rtx, rtx, rtx); +extern rtx gen_mips_alnv_ps (rtx, rtx, rtx, rtx); +extern rtx gen_mips_addr_ps (rtx, rtx, rtx); +extern rtx gen_mips_cvt_pw_ps (rtx, rtx); +extern rtx gen_mips_cvt_ps_pw (rtx, rtx); +extern rtx gen_mips_mulr_ps (rtx, rtx, rtx); +extern rtx gen_mips_cabs_cond_s (rtx, rtx, rtx, rtx); +extern rtx gen_mips_cabs_cond_d (rtx, rtx, rtx, rtx); +extern rtx gen_mips_c_cond_4s (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_mips_cabs_cond_4s (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_mips_c_cond_ps (rtx, rtx, rtx, rtx); +extern rtx gen_mips_cabs_cond_ps (rtx, rtx, rtx, rtx); +extern rtx gen_sunordered_ps (rtx, rtx, rtx); +extern rtx gen_suneq_ps (rtx, rtx, rtx); +extern rtx gen_sunlt_ps (rtx, rtx, rtx); +extern rtx gen_sunle_ps (rtx, rtx, rtx); +extern rtx gen_seq_ps (rtx, rtx, rtx); +extern rtx gen_slt_ps (rtx, rtx, rtx); +extern rtx gen_sle_ps (rtx, rtx, rtx); +extern rtx gen_sordered_ps (rtx, rtx, rtx); +extern rtx gen_sltgt_ps (rtx, rtx, rtx); +extern rtx gen_sne_ps (rtx, rtx, rtx); +extern rtx gen_sge_ps (rtx, rtx, rtx); +extern rtx gen_sgt_ps (rtx, rtx, rtx); +extern rtx gen_sunge_ps (rtx, rtx, rtx); +extern rtx gen_sungt_ps (rtx, rtx, rtx); +extern rtx gen_bc1any4t (rtx, rtx); +extern rtx gen_bc1any4f (rtx, rtx); +extern rtx gen_bc1any2t (rtx, rtx); +extern rtx gen_bc1any2f (rtx, rtx); +extern rtx gen_mips_rsqrt1_s (rtx, rtx); +extern rtx gen_mips_rsqrt1_d (rtx, rtx); +extern rtx gen_mips_rsqrt1_ps (rtx, rtx); +extern rtx gen_mips_rsqrt2_s (rtx, rtx, rtx); +extern rtx gen_mips_rsqrt2_d (rtx, rtx, rtx); +extern rtx gen_mips_rsqrt2_ps (rtx, rtx, rtx); +extern rtx gen_mips_recip1_s (rtx, rtx); +extern rtx gen_mips_recip1_d (rtx, rtx); +extern rtx gen_mips_recip1_ps (rtx, rtx); +extern rtx gen_mips_recip2_s (rtx, rtx, rtx); +extern rtx gen_mips_recip2_d (rtx, rtx, rtx); +extern rtx gen_mips_recip2_ps (rtx, rtx, rtx); +extern rtx gen_addv2hi3 (rtx, rtx, rtx); +extern rtx gen_addv4qi3 (rtx, rtx, rtx); +extern rtx gen_mips_addq_s_w (rtx, rtx, rtx); +extern rtx gen_mips_addq_s_ph (rtx, rtx, rtx); +extern rtx gen_mips_addu_s_qb (rtx, rtx, rtx); +extern rtx gen_subv2hi3 (rtx, rtx, rtx); +extern rtx gen_subv4qi3 (rtx, rtx, rtx); +extern rtx gen_mips_subq_s_w (rtx, rtx, rtx); +extern rtx gen_mips_subq_s_ph (rtx, rtx, rtx); +extern rtx gen_mips_subu_s_qb (rtx, rtx, rtx); +extern rtx gen_mips_addsc (rtx, rtx, rtx); +extern rtx gen_mips_addwc (rtx, rtx, rtx); +extern rtx gen_mips_modsub (rtx, rtx, rtx); +extern rtx gen_mips_raddu_w_qb (rtx, rtx); +extern rtx gen_mips_absq_s_w (rtx, rtx); +extern rtx gen_mips_absq_s_ph (rtx, rtx); +extern rtx gen_mips_precrq_qb_ph (rtx, rtx, rtx); +extern rtx gen_mips_precrq_ph_w (rtx, rtx, rtx); +extern rtx gen_mips_precrq_rs_ph_w (rtx, rtx, rtx); +extern rtx gen_mips_precrqu_s_qb_ph (rtx, rtx, rtx); +extern rtx gen_mips_preceq_w_phl (rtx, rtx); +extern rtx gen_mips_preceq_w_phr (rtx, rtx); +extern rtx gen_mips_precequ_ph_qbl (rtx, rtx); +extern rtx gen_mips_precequ_ph_qbr (rtx, rtx); +extern rtx gen_mips_precequ_ph_qbla (rtx, rtx); +extern rtx gen_mips_precequ_ph_qbra (rtx, rtx); +extern rtx gen_mips_preceu_ph_qbl (rtx, rtx); +extern rtx gen_mips_preceu_ph_qbr (rtx, rtx); +extern rtx gen_mips_preceu_ph_qbla (rtx, rtx); +extern rtx gen_mips_preceu_ph_qbra (rtx, rtx); +extern rtx gen_mips_shll_ph (rtx, rtx, rtx); +extern rtx gen_mips_shll_qb (rtx, rtx, rtx); +extern rtx gen_mips_shll_s_w (rtx, rtx, rtx); +extern rtx gen_mips_shll_s_ph (rtx, rtx, rtx); +extern rtx gen_mips_shrl_qb (rtx, rtx, rtx); +extern rtx gen_mips_shra_ph (rtx, rtx, rtx); +extern rtx gen_mips_shra_r_w (rtx, rtx, rtx); +extern rtx gen_mips_shra_r_ph (rtx, rtx, rtx); +extern rtx gen_mips_muleu_s_ph_qbl (rtx, rtx, rtx); +extern rtx gen_mips_muleu_s_ph_qbr (rtx, rtx, rtx); +extern rtx gen_mips_mulq_rs_ph (rtx, rtx, rtx); +extern rtx gen_mips_muleq_s_w_phl (rtx, rtx, rtx); +extern rtx gen_mips_muleq_s_w_phr (rtx, rtx, rtx); +extern rtx gen_mips_dpau_h_qbl (rtx, rtx, rtx, rtx); +extern rtx gen_mips_dpau_h_qbr (rtx, rtx, rtx, rtx); +extern rtx gen_mips_dpsu_h_qbl (rtx, rtx, rtx, rtx); +extern rtx gen_mips_dpsu_h_qbr (rtx, rtx, rtx, rtx); +extern rtx gen_mips_dpaq_s_w_ph (rtx, rtx, rtx, rtx); +extern rtx gen_mips_dpsq_s_w_ph (rtx, rtx, rtx, rtx); +extern rtx gen_mips_mulsaq_s_w_ph (rtx, rtx, rtx, rtx); +extern rtx gen_mips_dpaq_sa_l_w (rtx, rtx, rtx, rtx); +extern rtx gen_mips_dpsq_sa_l_w (rtx, rtx, rtx, rtx); +extern rtx gen_mips_maq_s_w_phl (rtx, rtx, rtx, rtx); +extern rtx gen_mips_maq_s_w_phr (rtx, rtx, rtx, rtx); +extern rtx gen_mips_maq_sa_w_phl (rtx, rtx, rtx, rtx); +extern rtx gen_mips_maq_sa_w_phr (rtx, rtx, rtx, rtx); +extern rtx gen_mips_bitrev (rtx, rtx); +extern rtx gen_mips_insv (rtx, rtx, rtx); +extern rtx gen_mips_repl_qb (rtx, rtx); +extern rtx gen_mips_repl_ph (rtx, rtx); +extern rtx gen_mips_cmp_eq_ph (rtx, rtx); +extern rtx gen_mips_cmpu_eq_qb (rtx, rtx); +extern rtx gen_mips_cmp_lt_ph (rtx, rtx); +extern rtx gen_mips_cmpu_lt_qb (rtx, rtx); +extern rtx gen_mips_cmp_le_ph (rtx, rtx); +extern rtx gen_mips_cmpu_le_qb (rtx, rtx); +extern rtx gen_mips_cmpgu_eq_qb (rtx, rtx, rtx); +extern rtx gen_mips_cmpgu_lt_qb (rtx, rtx, rtx); +extern rtx gen_mips_cmpgu_le_qb (rtx, rtx, rtx); +extern rtx gen_mips_pick_ph (rtx, rtx, rtx); +extern rtx gen_mips_pick_qb (rtx, rtx, rtx); +extern rtx gen_mips_packrl_ph (rtx, rtx, rtx); +extern rtx gen_mips_extr_w (rtx, rtx, rtx); +extern rtx gen_mips_extr_r_w (rtx, rtx, rtx); +extern rtx gen_mips_extr_rs_w (rtx, rtx, rtx); +extern rtx gen_mips_extr_s_h (rtx, rtx, rtx); +extern rtx gen_mips_extp (rtx, rtx, rtx); +extern rtx gen_mips_extpdp (rtx, rtx, rtx); +extern rtx gen_mips_shilo (rtx, rtx, rtx); +extern rtx gen_mips_mthlip (rtx, rtx, rtx); +extern rtx gen_mips_wrdsp (rtx, rtx); +extern rtx gen_mips_rddsp (rtx, rtx); +extern rtx gen_mips_lbx_extsi_si (rtx, rtx, rtx); +extern rtx gen_mips_lbux_extsi_si (rtx, rtx, rtx); +extern rtx gen_mips_lbx_extdi_si (rtx, rtx, rtx); +extern rtx gen_mips_lbux_extdi_si (rtx, rtx, rtx); +extern rtx gen_mips_lhx_extsi_si (rtx, rtx, rtx); +extern rtx gen_mips_lhux_extsi_si (rtx, rtx, rtx); +extern rtx gen_mips_lhx_extdi_si (rtx, rtx, rtx); +extern rtx gen_mips_lhux_extdi_si (rtx, rtx, rtx); +extern rtx gen_mips_lbx_extsi_di (rtx, rtx, rtx); +extern rtx gen_mips_lbux_extsi_di (rtx, rtx, rtx); +extern rtx gen_mips_lbx_extdi_di (rtx, rtx, rtx); +extern rtx gen_mips_lbux_extdi_di (rtx, rtx, rtx); +extern rtx gen_mips_lhx_extsi_di (rtx, rtx, rtx); +extern rtx gen_mips_lhux_extsi_di (rtx, rtx, rtx); +extern rtx gen_mips_lhx_extdi_di (rtx, rtx, rtx); +extern rtx gen_mips_lhux_extdi_di (rtx, rtx, rtx); +extern rtx gen_mips_lwx_si (rtx, rtx, rtx); +extern rtx gen_mips_ldx_si (rtx, rtx, rtx); +extern rtx gen_mips_lwx_di (rtx, rtx, rtx); +extern rtx gen_mips_ldx_di (rtx, rtx, rtx); +extern rtx gen_mips_bposge (rtx, rtx); +extern rtx gen_mips_absq_s_qb (rtx, rtx); +extern rtx gen_mips_addu_ph (rtx, rtx, rtx); +extern rtx gen_mips_addu_s_ph (rtx, rtx, rtx); +extern rtx gen_mips_adduh_qb (rtx, rtx, rtx); +extern rtx gen_mips_adduh_r_qb (rtx, rtx, rtx); +extern rtx gen_mips_append (rtx, rtx, rtx, rtx); +extern rtx gen_mips_balign (rtx, rtx, rtx, rtx); +extern rtx gen_mips_cmpgdu_eq_qb (rtx, rtx, rtx); +extern rtx gen_mips_cmpgdu_lt_qb (rtx, rtx, rtx); +extern rtx gen_mips_cmpgdu_le_qb (rtx, rtx, rtx); +extern rtx gen_mips_dpa_w_ph (rtx, rtx, rtx, rtx); +extern rtx gen_mips_dps_w_ph (rtx, rtx, rtx, rtx); +extern rtx gen_mulv2hi3 (rtx, rtx, rtx); +extern rtx gen_mips_mul_s_ph (rtx, rtx, rtx); +extern rtx gen_mips_mulq_rs_w (rtx, rtx, rtx); +extern rtx gen_mips_mulq_s_ph (rtx, rtx, rtx); +extern rtx gen_mips_mulq_s_w (rtx, rtx, rtx); +extern rtx gen_mips_mulsa_w_ph (rtx, rtx, rtx, rtx); +extern rtx gen_mips_precr_qb_ph (rtx, rtx, rtx); +extern rtx gen_mips_precr_sra_ph_w (rtx, rtx, rtx, rtx); +extern rtx gen_mips_precr_sra_r_ph_w (rtx, rtx, rtx, rtx); +extern rtx gen_mips_prepend (rtx, rtx, rtx, rtx); +extern rtx gen_mips_shra_qb (rtx, rtx, rtx); +extern rtx gen_mips_shra_r_qb (rtx, rtx, rtx); +extern rtx gen_mips_shrl_ph (rtx, rtx, rtx); +extern rtx gen_mips_subu_ph (rtx, rtx, rtx); +extern rtx gen_mips_subu_s_ph (rtx, rtx, rtx); +extern rtx gen_mips_subuh_qb (rtx, rtx, rtx); +extern rtx gen_mips_subuh_r_qb (rtx, rtx, rtx); +extern rtx gen_mips_addqh_ph (rtx, rtx, rtx); +extern rtx gen_mips_addqh_r_ph (rtx, rtx, rtx); +extern rtx gen_mips_addqh_w (rtx, rtx, rtx); +extern rtx gen_mips_addqh_r_w (rtx, rtx, rtx); +extern rtx gen_mips_subqh_ph (rtx, rtx, rtx); +extern rtx gen_mips_subqh_r_ph (rtx, rtx, rtx); +extern rtx gen_mips_subqh_w (rtx, rtx, rtx); +extern rtx gen_mips_subqh_r_w (rtx, rtx, rtx); +extern rtx gen_mips_dpax_w_ph (rtx, rtx, rtx, rtx); +extern rtx gen_mips_dpsx_w_ph (rtx, rtx, rtx, rtx); +extern rtx gen_mips_dpaqx_s_w_ph (rtx, rtx, rtx, rtx); +extern rtx gen_mips_dpaqx_sa_w_ph (rtx, rtx, rtx, rtx); +extern rtx gen_mips_dpsqx_s_w_ph (rtx, rtx, rtx, rtx); +extern rtx gen_mips_dpsqx_sa_w_ph (rtx, rtx, rtx, rtx); +extern rtx gen_addqq3 (rtx, rtx, rtx); +extern rtx gen_addhq3 (rtx, rtx, rtx); +extern rtx gen_addsq3 (rtx, rtx, rtx); +extern rtx gen_adddq3 (rtx, rtx, rtx); +extern rtx gen_adduqq3 (rtx, rtx, rtx); +extern rtx gen_adduhq3 (rtx, rtx, rtx); +extern rtx gen_addusq3 (rtx, rtx, rtx); +extern rtx gen_addudq3 (rtx, rtx, rtx); +extern rtx gen_addha3 (rtx, rtx, rtx); +extern rtx gen_addsa3 (rtx, rtx, rtx); +extern rtx gen_addda3 (rtx, rtx, rtx); +extern rtx gen_adduha3 (rtx, rtx, rtx); +extern rtx gen_addusa3 (rtx, rtx, rtx); +extern rtx gen_adduda3 (rtx, rtx, rtx); +extern rtx gen_usadduqq3 (rtx, rtx, rtx); +extern rtx gen_usadduhq3 (rtx, rtx, rtx); +extern rtx gen_usadduha3 (rtx, rtx, rtx); +extern rtx gen_usaddv4uqq3 (rtx, rtx, rtx); +extern rtx gen_usaddv2uhq3 (rtx, rtx, rtx); +extern rtx gen_usaddv2uha3 (rtx, rtx, rtx); +extern rtx gen_ssaddhq3 (rtx, rtx, rtx); +extern rtx gen_ssaddsq3 (rtx, rtx, rtx); +extern rtx gen_ssaddha3 (rtx, rtx, rtx); +extern rtx gen_ssaddsa3 (rtx, rtx, rtx); +extern rtx gen_ssaddv2hq3 (rtx, rtx, rtx); +extern rtx gen_ssaddv2ha3 (rtx, rtx, rtx); +extern rtx gen_subqq3 (rtx, rtx, rtx); +extern rtx gen_subhq3 (rtx, rtx, rtx); +extern rtx gen_subsq3 (rtx, rtx, rtx); +extern rtx gen_subdq3 (rtx, rtx, rtx); +extern rtx gen_subuqq3 (rtx, rtx, rtx); +extern rtx gen_subuhq3 (rtx, rtx, rtx); +extern rtx gen_subusq3 (rtx, rtx, rtx); +extern rtx gen_subudq3 (rtx, rtx, rtx); +extern rtx gen_subha3 (rtx, rtx, rtx); +extern rtx gen_subsa3 (rtx, rtx, rtx); +extern rtx gen_subda3 (rtx, rtx, rtx); +extern rtx gen_subuha3 (rtx, rtx, rtx); +extern rtx gen_subusa3 (rtx, rtx, rtx); +extern rtx gen_subuda3 (rtx, rtx, rtx); +extern rtx gen_ussubuqq3 (rtx, rtx, rtx); +extern rtx gen_ussubuhq3 (rtx, rtx, rtx); +extern rtx gen_ussubuha3 (rtx, rtx, rtx); +extern rtx gen_ussubv4uqq3 (rtx, rtx, rtx); +extern rtx gen_ussubv2uhq3 (rtx, rtx, rtx); +extern rtx gen_ussubv2uha3 (rtx, rtx, rtx); +extern rtx gen_sssubhq3 (rtx, rtx, rtx); +extern rtx gen_sssubsq3 (rtx, rtx, rtx); +extern rtx gen_sssubha3 (rtx, rtx, rtx); +extern rtx gen_sssubsa3 (rtx, rtx, rtx); +extern rtx gen_sssubv2hq3 (rtx, rtx, rtx); +extern rtx gen_sssubv2ha3 (rtx, rtx, rtx); +extern rtx gen_ssmulv2hq3 (rtx, rtx, rtx); +extern rtx gen_ssmulhq3 (rtx, rtx, rtx); +extern rtx gen_ssmulsq3 (rtx, rtx, rtx); +extern rtx gen_ssmaddsqdq4 (rtx, rtx, rtx, rtx); +extern rtx gen_ssmsubsqdq4 (rtx, rtx, rtx, rtx); +extern rtx gen_jraddiusp (rtx); +extern rtx gen_movv2si_internal (rtx, rtx); +extern rtx gen_movv4hi_internal (rtx, rtx); +extern rtx gen_movv8qi_internal (rtx, rtx); +extern rtx gen_loongson_vec_init1_v4hi (rtx, rtx); +extern rtx gen_loongson_vec_init1_v8qi (rtx, rtx); +extern rtx gen_vec_pack_ssat_v2si (rtx, rtx, rtx); +extern rtx gen_vec_pack_ssat_v4hi (rtx, rtx, rtx); +extern rtx gen_vec_pack_usat_v4hi (rtx, rtx, rtx); +extern rtx gen_addv2si3 (rtx, rtx, rtx); +extern rtx gen_addv4hi3 (rtx, rtx, rtx); +extern rtx gen_addv8qi3 (rtx, rtx, rtx); +extern rtx gen_loongson_paddd (rtx, rtx, rtx); +extern rtx gen_ssaddv4hi3 (rtx, rtx, rtx); +extern rtx gen_ssaddv8qi3 (rtx, rtx, rtx); +extern rtx gen_usaddv4hi3 (rtx, rtx, rtx); +extern rtx gen_usaddv8qi3 (rtx, rtx, rtx); +extern rtx gen_loongson_pandn_w (rtx, rtx, rtx); +extern rtx gen_loongson_pandn_h (rtx, rtx, rtx); +extern rtx gen_loongson_pandn_b (rtx, rtx, rtx); +extern rtx gen_loongson_pandn_d (rtx, rtx, rtx); +extern rtx gen_andv2si3 (rtx, rtx, rtx); +extern rtx gen_andv4hi3 (rtx, rtx, rtx); +extern rtx gen_andv8qi3 (rtx, rtx, rtx); +extern rtx gen_iorv2si3 (rtx, rtx, rtx); +extern rtx gen_iorv4hi3 (rtx, rtx, rtx); +extern rtx gen_iorv8qi3 (rtx, rtx, rtx); +extern rtx gen_xorv2si3 (rtx, rtx, rtx); +extern rtx gen_xorv4hi3 (rtx, rtx, rtx); +extern rtx gen_xorv8qi3 (rtx, rtx, rtx); +extern rtx gen_one_cmplv2si2 (rtx, rtx); +extern rtx gen_one_cmplv4hi2 (rtx, rtx); +extern rtx gen_one_cmplv8qi2 (rtx, rtx); +extern rtx gen_loongson_pavgh (rtx, rtx, rtx); +extern rtx gen_loongson_pavgb (rtx, rtx, rtx); +extern rtx gen_loongson_pcmpeqw (rtx, rtx, rtx); +extern rtx gen_loongson_pcmpeqh (rtx, rtx, rtx); +extern rtx gen_loongson_pcmpeqb (rtx, rtx, rtx); +extern rtx gen_loongson_pcmpgtw (rtx, rtx, rtx); +extern rtx gen_loongson_pcmpgth (rtx, rtx, rtx); +extern rtx gen_loongson_pcmpgtb (rtx, rtx, rtx); +extern rtx gen_loongson_pextrh (rtx, rtx, rtx); +extern rtx gen_loongson_pinsrh_0 (rtx, rtx, rtx); +extern rtx gen_loongson_pinsrh_1 (rtx, rtx, rtx); +extern rtx gen_loongson_pinsrh_2 (rtx, rtx, rtx); +extern rtx gen_loongson_pinsrh_3 (rtx, rtx, rtx); +extern rtx gen_loongson_pmaddhw (rtx, rtx, rtx); +extern rtx gen_smaxv4hi3 (rtx, rtx, rtx); +extern rtx gen_umaxv8qi3 (rtx, rtx, rtx); +extern rtx gen_sminv4hi3 (rtx, rtx, rtx); +extern rtx gen_uminv8qi3 (rtx, rtx, rtx); +extern rtx gen_loongson_pmovmskb (rtx, rtx); +extern rtx gen_umulv4hi3_highpart (rtx, rtx, rtx); +extern rtx gen_smulv4hi3_highpart (rtx, rtx, rtx); +extern rtx gen_mulv4hi3 (rtx, rtx, rtx); +extern rtx gen_loongson_pmuluw (rtx, rtx, rtx); +extern rtx gen_loongson_pasubub (rtx, rtx, rtx); +extern rtx gen_loongson_biadd (rtx, rtx); +extern rtx gen_reduc_uplus_v8qi (rtx, rtx); +extern rtx gen_loongson_psadbh (rtx, rtx, rtx); +extern rtx gen_loongson_pshufh (rtx, rtx, rtx); +extern rtx gen_ashlv2si3 (rtx, rtx, rtx); +extern rtx gen_ashlv4hi3 (rtx, rtx, rtx); +extern rtx gen_ashrv2si3 (rtx, rtx, rtx); +extern rtx gen_ashrv4hi3 (rtx, rtx, rtx); +extern rtx gen_lshrv2si3 (rtx, rtx, rtx); +extern rtx gen_lshrv4hi3 (rtx, rtx, rtx); +extern rtx gen_subv2si3 (rtx, rtx, rtx); +extern rtx gen_subv4hi3 (rtx, rtx, rtx); +extern rtx gen_subv8qi3 (rtx, rtx, rtx); +extern rtx gen_loongson_psubd (rtx, rtx, rtx); +extern rtx gen_sssubv4hi3 (rtx, rtx, rtx); +extern rtx gen_sssubv8qi3 (rtx, rtx, rtx); +extern rtx gen_ussubv4hi3 (rtx, rtx, rtx); +extern rtx gen_ussubv8qi3 (rtx, rtx, rtx); +extern rtx gen_loongson_punpckhbh (rtx, rtx, rtx); +extern rtx gen_loongson_punpckhhw (rtx, rtx, rtx); +extern rtx gen_loongson_punpckhhw_qi (rtx, rtx, rtx); +extern rtx gen_loongson_punpckhwd (rtx, rtx, rtx); +extern rtx gen_loongson_punpckhwd_qi (rtx, rtx, rtx); +extern rtx gen_loongson_punpckhwd_hi (rtx, rtx, rtx); +extern rtx gen_loongson_punpcklbh (rtx, rtx, rtx); +extern rtx gen_loongson_punpcklhw (rtx, rtx, rtx); +extern rtx gen_loongson_punpcklwd (rtx, rtx, rtx); +extern rtx gen_vec_shl_v2si (rtx, rtx, rtx); +extern rtx gen_vec_shl_v4hi (rtx, rtx, rtx); +extern rtx gen_vec_shl_v8qi (rtx, rtx, rtx); +extern rtx gen_vec_shl_di (rtx, rtx, rtx); +extern rtx gen_vec_shr_v2si (rtx, rtx, rtx); +extern rtx gen_vec_shr_v4hi (rtx, rtx, rtx); +extern rtx gen_vec_shr_v8qi (rtx, rtx, rtx); +extern rtx gen_vec_shr_di (rtx, rtx, rtx); +extern rtx gen_vec_loongson_extract_lo_v2si (rtx, rtx); +extern rtx gen_vec_loongson_extract_lo_v4hi (rtx, rtx); +extern rtx gen_vec_loongson_extract_lo_v8qi (rtx, rtx); +extern rtx gen_vec_pack_trunc_v2di (rtx, rtx, rtx); +extern rtx gen_vec_pack_trunc_v4si (rtx, rtx, rtx); +extern rtx gen_vec_pack_trunc_v8hi (rtx, rtx, rtx); +extern rtx gen_msa_vec_extract_d_f (rtx, rtx); +extern rtx gen_msa_vec_extract_w_f (rtx, rtx); +extern rtx gen_msa_insert_d_f (rtx, rtx, rtx, rtx); +extern rtx gen_msa_insert_w_f (rtx, rtx, rtx, rtx); +extern rtx gen_msa_insert_d (rtx, rtx, rtx, rtx); +extern rtx gen_msa_insert_w (rtx, rtx, rtx, rtx); +extern rtx gen_msa_insert_h (rtx, rtx, rtx, rtx); +extern rtx gen_msa_insert_b (rtx, rtx, rtx, rtx); +extern rtx gen_msa_insve_d_f (rtx, rtx, rtx, rtx); +extern rtx gen_msa_insve_w_f (rtx, rtx, rtx, rtx); +extern rtx gen_msa_insve_d (rtx, rtx, rtx, rtx); +extern rtx gen_msa_insve_w (rtx, rtx, rtx, rtx); +extern rtx gen_msa_insve_h (rtx, rtx, rtx, rtx); +extern rtx gen_msa_insve_b (rtx, rtx, rtx, rtx); +extern rtx gen_msa_insve_d_f_scalar (rtx, rtx, rtx, rtx); +extern rtx gen_msa_insve_w_f_scalar (rtx, rtx, rtx, rtx); +extern rtx gen_msa_copy_s_h (rtx, rtx, rtx); +extern rtx gen_msa_copy_u_h (rtx, rtx, rtx); +extern rtx gen_msa_copy_s_b (rtx, rtx, rtx); +extern rtx gen_msa_copy_u_b (rtx, rtx, rtx); +extern rtx gen_msa_copy_u_w (rtx, rtx, rtx); +extern rtx gen_msa_copy_s_w_64bit (rtx, rtx, rtx); +extern rtx gen_msa_copy_s_w_f_64bit (rtx, rtx, rtx); +extern rtx gen_msa_copy_s_w (rtx, rtx, rtx); +extern rtx gen_msa_copy_s_w_f (rtx, rtx, rtx); +extern rtx gen_msa_copy_s_d (rtx, rtx, rtx); +extern rtx gen_msa_copy_s_d_f (rtx, rtx, rtx); +extern rtx gen_vec_permv2df (rtx, rtx, rtx, rtx); +extern rtx gen_vec_permv4sf (rtx, rtx, rtx, rtx); +extern rtx gen_vec_permv2di (rtx, rtx, rtx, rtx); +extern rtx gen_vec_permv4si (rtx, rtx, rtx, rtx); +extern rtx gen_vec_permv8hi (rtx, rtx, rtx, rtx); +extern rtx gen_vec_permv16qi (rtx, rtx, rtx, rtx); +extern rtx gen_movv2df_msa (rtx, rtx); +extern rtx gen_movv4sf_msa (rtx, rtx); +extern rtx gen_movv2di_msa (rtx, rtx); +extern rtx gen_movv4si_msa (rtx, rtx); +extern rtx gen_movv8hi_msa (rtx, rtx); +extern rtx gen_movv16qi_msa (rtx, rtx); +extern rtx gen_addv2di3 (rtx, rtx, rtx); +extern rtx gen_addv4si3 (rtx, rtx, rtx); +extern rtx gen_addv8hi3 (rtx, rtx, rtx); +extern rtx gen_addv16qi3 (rtx, rtx, rtx); +extern rtx gen_subv2di3 (rtx, rtx, rtx); +extern rtx gen_subv4si3 (rtx, rtx, rtx); +extern rtx gen_subv8hi3 (rtx, rtx, rtx); +extern rtx gen_subv16qi3 (rtx, rtx, rtx); +extern rtx gen_mulv2di3 (rtx, rtx, rtx); +extern rtx gen_mulv4si3 (rtx, rtx, rtx); +extern rtx gen_mulv8hi3 (rtx, rtx, rtx); +extern rtx gen_mulv16qi3 (rtx, rtx, rtx); +extern rtx gen_msa_maddv_d (rtx, rtx, rtx, rtx); +extern rtx gen_msa_maddv_w (rtx, rtx, rtx, rtx); +extern rtx gen_msa_maddv_h (rtx, rtx, rtx, rtx); +extern rtx gen_msa_maddv_b (rtx, rtx, rtx, rtx); +extern rtx gen_msa_msubv_d (rtx, rtx, rtx, rtx); +extern rtx gen_msa_msubv_w (rtx, rtx, rtx, rtx); +extern rtx gen_msa_msubv_h (rtx, rtx, rtx, rtx); +extern rtx gen_msa_msubv_b (rtx, rtx, rtx, rtx); +extern rtx gen_divv2di3 (rtx, rtx, rtx); +extern rtx gen_divv4si3 (rtx, rtx, rtx); +extern rtx gen_divv8hi3 (rtx, rtx, rtx); +extern rtx gen_divv16qi3 (rtx, rtx, rtx); +extern rtx gen_udivv2di3 (rtx, rtx, rtx); +extern rtx gen_udivv4si3 (rtx, rtx, rtx); +extern rtx gen_udivv8hi3 (rtx, rtx, rtx); +extern rtx gen_udivv16qi3 (rtx, rtx, rtx); +extern rtx gen_modv2di3 (rtx, rtx, rtx); +extern rtx gen_modv4si3 (rtx, rtx, rtx); +extern rtx gen_modv8hi3 (rtx, rtx, rtx); +extern rtx gen_modv16qi3 (rtx, rtx, rtx); +extern rtx gen_umodv2di3 (rtx, rtx, rtx); +extern rtx gen_umodv4si3 (rtx, rtx, rtx); +extern rtx gen_umodv8hi3 (rtx, rtx, rtx); +extern rtx gen_umodv16qi3 (rtx, rtx, rtx); +extern rtx gen_xorv2di3 (rtx, rtx, rtx); +extern rtx gen_xorv4si3 (rtx, rtx, rtx); +extern rtx gen_xorv8hi3 (rtx, rtx, rtx); +extern rtx gen_xorv16qi3 (rtx, rtx, rtx); +extern rtx gen_iorv2di3 (rtx, rtx, rtx); +extern rtx gen_iorv4si3 (rtx, rtx, rtx); +extern rtx gen_iorv8hi3 (rtx, rtx, rtx); +extern rtx gen_iorv16qi3 (rtx, rtx, rtx); +extern rtx gen_andv2di3 (rtx, rtx, rtx); +extern rtx gen_andv4si3 (rtx, rtx, rtx); +extern rtx gen_andv8hi3 (rtx, rtx, rtx); +extern rtx gen_andv16qi3 (rtx, rtx, rtx); +extern rtx gen_one_cmplv2di2 (rtx, rtx); +extern rtx gen_one_cmplv4si2 (rtx, rtx); +extern rtx gen_one_cmplv8hi2 (rtx, rtx); +extern rtx gen_one_cmplv16qi2 (rtx, rtx); +extern rtx gen_vlshrv2di3 (rtx, rtx, rtx); +extern rtx gen_vlshrv4si3 (rtx, rtx, rtx); +extern rtx gen_vlshrv8hi3 (rtx, rtx, rtx); +extern rtx gen_vlshrv16qi3 (rtx, rtx, rtx); +extern rtx gen_vashrv2di3 (rtx, rtx, rtx); +extern rtx gen_vashrv4si3 (rtx, rtx, rtx); +extern rtx gen_vashrv8hi3 (rtx, rtx, rtx); +extern rtx gen_vashrv16qi3 (rtx, rtx, rtx); +extern rtx gen_vashlv2di3 (rtx, rtx, rtx); +extern rtx gen_vashlv4si3 (rtx, rtx, rtx); +extern rtx gen_vashlv8hi3 (rtx, rtx, rtx); +extern rtx gen_vashlv16qi3 (rtx, rtx, rtx); +extern rtx gen_addv2df3 (rtx, rtx, rtx); +extern rtx gen_addv4sf3 (rtx, rtx, rtx); +extern rtx gen_subv2df3 (rtx, rtx, rtx); +extern rtx gen_subv4sf3 (rtx, rtx, rtx); +extern rtx gen_mulv2df3 (rtx, rtx, rtx); +extern rtx gen_mulv4sf3 (rtx, rtx, rtx); +extern rtx gen_divv2df3 (rtx, rtx, rtx); +extern rtx gen_divv4sf3 (rtx, rtx, rtx); +extern rtx gen_fmav2df4 (rtx, rtx, rtx, rtx); +extern rtx gen_fmav4sf4 (rtx, rtx, rtx, rtx); +extern rtx gen_fnmav2df4 (rtx, rtx, rtx, rtx); +extern rtx gen_fnmav4sf4 (rtx, rtx, rtx, rtx); +extern rtx gen_sqrtv2df2 (rtx, rtx); +extern rtx gen_sqrtv4sf2 (rtx, rtx); +extern rtx gen_msa_add_a_d (rtx, rtx, rtx); +extern rtx gen_msa_add_a_w (rtx, rtx, rtx); +extern rtx gen_msa_add_a_h (rtx, rtx, rtx); +extern rtx gen_msa_add_a_b (rtx, rtx, rtx); +extern rtx gen_msa_adds_a_d (rtx, rtx, rtx); +extern rtx gen_msa_adds_a_w (rtx, rtx, rtx); +extern rtx gen_msa_adds_a_h (rtx, rtx, rtx); +extern rtx gen_msa_adds_a_b (rtx, rtx, rtx); +extern rtx gen_ssaddv2di3 (rtx, rtx, rtx); +extern rtx gen_ssaddv4si3 (rtx, rtx, rtx); +extern rtx gen_ssaddv8hi3 (rtx, rtx, rtx); +extern rtx gen_ssaddv16qi3 (rtx, rtx, rtx); +extern rtx gen_usaddv2di3 (rtx, rtx, rtx); +extern rtx gen_usaddv4si3 (rtx, rtx, rtx); +extern rtx gen_usaddv8hi3 (rtx, rtx, rtx); +extern rtx gen_usaddv16qi3 (rtx, rtx, rtx); +extern rtx gen_msa_asub_s_d (rtx, rtx, rtx); +extern rtx gen_msa_asub_s_w (rtx, rtx, rtx); +extern rtx gen_msa_asub_s_h (rtx, rtx, rtx); +extern rtx gen_msa_asub_s_b (rtx, rtx, rtx); +extern rtx gen_msa_asub_u_d (rtx, rtx, rtx); +extern rtx gen_msa_asub_u_w (rtx, rtx, rtx); +extern rtx gen_msa_asub_u_h (rtx, rtx, rtx); +extern rtx gen_msa_asub_u_b (rtx, rtx, rtx); +extern rtx gen_msa_ave_s_d (rtx, rtx, rtx); +extern rtx gen_msa_ave_s_w (rtx, rtx, rtx); +extern rtx gen_msa_ave_s_h (rtx, rtx, rtx); +extern rtx gen_msa_ave_s_b (rtx, rtx, rtx); +extern rtx gen_msa_ave_u_d (rtx, rtx, rtx); +extern rtx gen_msa_ave_u_w (rtx, rtx, rtx); +extern rtx gen_msa_ave_u_h (rtx, rtx, rtx); +extern rtx gen_msa_ave_u_b (rtx, rtx, rtx); +extern rtx gen_msa_aver_s_d (rtx, rtx, rtx); +extern rtx gen_msa_aver_s_w (rtx, rtx, rtx); +extern rtx gen_msa_aver_s_h (rtx, rtx, rtx); +extern rtx gen_msa_aver_s_b (rtx, rtx, rtx); +extern rtx gen_msa_aver_u_d (rtx, rtx, rtx); +extern rtx gen_msa_aver_u_w (rtx, rtx, rtx); +extern rtx gen_msa_aver_u_h (rtx, rtx, rtx); +extern rtx gen_msa_aver_u_b (rtx, rtx, rtx); +extern rtx gen_msa_bclr_d (rtx, rtx, rtx); +extern rtx gen_msa_bclr_w (rtx, rtx, rtx); +extern rtx gen_msa_bclr_h (rtx, rtx, rtx); +extern rtx gen_msa_bclr_b (rtx, rtx, rtx); +extern rtx gen_msa_bclri_d (rtx, rtx, rtx); +extern rtx gen_msa_bclri_w (rtx, rtx, rtx); +extern rtx gen_msa_bclri_h (rtx, rtx, rtx); +extern rtx gen_msa_bclri_b (rtx, rtx, rtx); +extern rtx gen_msa_binsl_d (rtx, rtx, rtx, rtx); +extern rtx gen_msa_binsl_w (rtx, rtx, rtx, rtx); +extern rtx gen_msa_binsl_h (rtx, rtx, rtx, rtx); +extern rtx gen_msa_binsl_b (rtx, rtx, rtx, rtx); +extern rtx gen_msa_binsli_d (rtx, rtx, rtx, rtx); +extern rtx gen_msa_binsli_w (rtx, rtx, rtx, rtx); +extern rtx gen_msa_binsli_h (rtx, rtx, rtx, rtx); +extern rtx gen_msa_binsli_b (rtx, rtx, rtx, rtx); +extern rtx gen_msa_binsr_d (rtx, rtx, rtx, rtx); +extern rtx gen_msa_binsr_w (rtx, rtx, rtx, rtx); +extern rtx gen_msa_binsr_h (rtx, rtx, rtx, rtx); +extern rtx gen_msa_binsr_b (rtx, rtx, rtx, rtx); +extern rtx gen_msa_binsri_d (rtx, rtx, rtx, rtx); +extern rtx gen_msa_binsri_w (rtx, rtx, rtx, rtx); +extern rtx gen_msa_binsri_h (rtx, rtx, rtx, rtx); +extern rtx gen_msa_binsri_b (rtx, rtx, rtx, rtx); +extern rtx gen_msa_bmnz_d (rtx, rtx, rtx, rtx); +extern rtx gen_msa_bmnz_w (rtx, rtx, rtx, rtx); +extern rtx gen_msa_bmnz_h (rtx, rtx, rtx, rtx); +extern rtx gen_msa_bmnz_b (rtx, rtx, rtx, rtx); +extern rtx gen_msa_bmz_d (rtx, rtx, rtx, rtx); +extern rtx gen_msa_bmz_w (rtx, rtx, rtx, rtx); +extern rtx gen_msa_bmz_h (rtx, rtx, rtx, rtx); +extern rtx gen_msa_bmz_b (rtx, rtx, rtx, rtx); +extern rtx gen_msa_bneg_d (rtx, rtx, rtx); +extern rtx gen_msa_bneg_w (rtx, rtx, rtx); +extern rtx gen_msa_bneg_h (rtx, rtx, rtx); +extern rtx gen_msa_bneg_b (rtx, rtx, rtx); +extern rtx gen_msa_bnegi_d (rtx, rtx, rtx); +extern rtx gen_msa_bnegi_w (rtx, rtx, rtx); +extern rtx gen_msa_bnegi_h (rtx, rtx, rtx); +extern rtx gen_msa_bnegi_b (rtx, rtx, rtx); +extern rtx gen_msa_bsel_d (rtx, rtx, rtx, rtx); +extern rtx gen_msa_bsel_w (rtx, rtx, rtx, rtx); +extern rtx gen_msa_bsel_h (rtx, rtx, rtx, rtx); +extern rtx gen_msa_bsel_b (rtx, rtx, rtx, rtx); +extern rtx gen_msa_bset_d (rtx, rtx, rtx); +extern rtx gen_msa_bset_w (rtx, rtx, rtx); +extern rtx gen_msa_bset_h (rtx, rtx, rtx); +extern rtx gen_msa_bset_b (rtx, rtx, rtx); +extern rtx gen_msa_bseti_d (rtx, rtx, rtx); +extern rtx gen_msa_bseti_w (rtx, rtx, rtx); +extern rtx gen_msa_bseti_h (rtx, rtx, rtx); +extern rtx gen_msa_bseti_b (rtx, rtx, rtx); +extern rtx gen_msa_ceq_d (rtx, rtx, rtx); +extern rtx gen_msa_cle_s_d (rtx, rtx, rtx); +extern rtx gen_msa_cle_u_d (rtx, rtx, rtx); +extern rtx gen_msa_clt_s_d (rtx, rtx, rtx); +extern rtx gen_msa_clt_u_d (rtx, rtx, rtx); +extern rtx gen_msa_ceq_w (rtx, rtx, rtx); +extern rtx gen_msa_cle_s_w (rtx, rtx, rtx); +extern rtx gen_msa_cle_u_w (rtx, rtx, rtx); +extern rtx gen_msa_clt_s_w (rtx, rtx, rtx); +extern rtx gen_msa_clt_u_w (rtx, rtx, rtx); +extern rtx gen_msa_ceq_h (rtx, rtx, rtx); +extern rtx gen_msa_cle_s_h (rtx, rtx, rtx); +extern rtx gen_msa_cle_u_h (rtx, rtx, rtx); +extern rtx gen_msa_clt_s_h (rtx, rtx, rtx); +extern rtx gen_msa_clt_u_h (rtx, rtx, rtx); +extern rtx gen_msa_ceq_b (rtx, rtx, rtx); +extern rtx gen_msa_cle_s_b (rtx, rtx, rtx); +extern rtx gen_msa_cle_u_b (rtx, rtx, rtx); +extern rtx gen_msa_clt_s_b (rtx, rtx, rtx); +extern rtx gen_msa_clt_u_b (rtx, rtx, rtx); +extern rtx gen_msa_dotp_s_d (rtx, rtx, rtx); +extern rtx gen_msa_dotp_u_d (rtx, rtx, rtx); +extern rtx gen_msa_dotp_s_w (rtx, rtx, rtx); +extern rtx gen_msa_dotp_u_w (rtx, rtx, rtx); +extern rtx gen_msa_dotp_s_h (rtx, rtx, rtx); +extern rtx gen_msa_dotp_u_h (rtx, rtx, rtx); +extern rtx gen_msa_dpadd_s_d (rtx, rtx, rtx, rtx); +extern rtx gen_msa_dpadd_u_d (rtx, rtx, rtx, rtx); +extern rtx gen_msa_dpadd_s_w (rtx, rtx, rtx, rtx); +extern rtx gen_msa_dpadd_u_w (rtx, rtx, rtx, rtx); +extern rtx gen_msa_dpadd_s_h (rtx, rtx, rtx, rtx); +extern rtx gen_msa_dpadd_u_h (rtx, rtx, rtx, rtx); +extern rtx gen_msa_dpsub_s_d (rtx, rtx, rtx, rtx); +extern rtx gen_msa_dpsub_u_d (rtx, rtx, rtx, rtx); +extern rtx gen_msa_dpsub_s_w (rtx, rtx, rtx, rtx); +extern rtx gen_msa_dpsub_u_w (rtx, rtx, rtx, rtx); +extern rtx gen_msa_dpsub_s_h (rtx, rtx, rtx, rtx); +extern rtx gen_msa_dpsub_u_h (rtx, rtx, rtx, rtx); +extern rtx gen_msa_fclass_d (rtx, rtx); +extern rtx gen_msa_fclass_w (rtx, rtx); +extern rtx gen_msa_fcaf_d (rtx, rtx, rtx); +extern rtx gen_msa_fcaf_w (rtx, rtx, rtx); +extern rtx gen_msa_fcune_d (rtx, rtx, rtx); +extern rtx gen_msa_fcune_w (rtx, rtx, rtx); +extern rtx gen_msa_fcun_d (rtx, rtx, rtx); +extern rtx gen_msa_fcor_d (rtx, rtx, rtx); +extern rtx gen_msa_fceq_d (rtx, rtx, rtx); +extern rtx gen_msa_fcne_d (rtx, rtx, rtx); +extern rtx gen_msa_fcle_d (rtx, rtx, rtx); +extern rtx gen_msa_fclt_d (rtx, rtx, rtx); +extern rtx gen_msa_fcueq_d (rtx, rtx, rtx); +extern rtx gen_msa_fcule_d (rtx, rtx, rtx); +extern rtx gen_msa_fcult_d (rtx, rtx, rtx); +extern rtx gen_msa_fcun_w (rtx, rtx, rtx); +extern rtx gen_msa_fcor_w (rtx, rtx, rtx); +extern rtx gen_msa_fceq_w (rtx, rtx, rtx); +extern rtx gen_msa_fcne_w (rtx, rtx, rtx); +extern rtx gen_msa_fcle_w (rtx, rtx, rtx); +extern rtx gen_msa_fclt_w (rtx, rtx, rtx); +extern rtx gen_msa_fcueq_w (rtx, rtx, rtx); +extern rtx gen_msa_fcule_w (rtx, rtx, rtx); +extern rtx gen_msa_fcult_w (rtx, rtx, rtx); +extern rtx gen_msa_fsaf_d (rtx, rtx, rtx); +extern rtx gen_msa_fsun_d (rtx, rtx, rtx); +extern rtx gen_msa_fsor_d (rtx, rtx, rtx); +extern rtx gen_msa_fseq_d (rtx, rtx, rtx); +extern rtx gen_msa_fsne_d (rtx, rtx, rtx); +extern rtx gen_msa_fsueq_d (rtx, rtx, rtx); +extern rtx gen_msa_fsune_d (rtx, rtx, rtx); +extern rtx gen_msa_fsule_d (rtx, rtx, rtx); +extern rtx gen_msa_fsult_d (rtx, rtx, rtx); +extern rtx gen_msa_fsle_d (rtx, rtx, rtx); +extern rtx gen_msa_fslt_d (rtx, rtx, rtx); +extern rtx gen_msa_fsaf_w (rtx, rtx, rtx); +extern rtx gen_msa_fsun_w (rtx, rtx, rtx); +extern rtx gen_msa_fsor_w (rtx, rtx, rtx); +extern rtx gen_msa_fseq_w (rtx, rtx, rtx); +extern rtx gen_msa_fsne_w (rtx, rtx, rtx); +extern rtx gen_msa_fsueq_w (rtx, rtx, rtx); +extern rtx gen_msa_fsune_w (rtx, rtx, rtx); +extern rtx gen_msa_fsule_w (rtx, rtx, rtx); +extern rtx gen_msa_fsult_w (rtx, rtx, rtx); +extern rtx gen_msa_fsle_w (rtx, rtx, rtx); +extern rtx gen_msa_fslt_w (rtx, rtx, rtx); +extern rtx gen_msa_fexp2_d (rtx, rtx, rtx); +extern rtx gen_msa_fexp2_w (rtx, rtx, rtx); +extern rtx gen_floatv2div2df2 (rtx, rtx); +extern rtx gen_floatv4siv4sf2 (rtx, rtx); +extern rtx gen_floatunsv2div2df2 (rtx, rtx); +extern rtx gen_floatunsv4siv4sf2 (rtx, rtx); +extern rtx gen_msa_ffql_d (rtx, rtx); +extern rtx gen_msa_ffql_w (rtx, rtx); +extern rtx gen_msa_ffqr_d (rtx, rtx); +extern rtx gen_msa_ffqr_w (rtx, rtx); +extern rtx gen_msa_fill_d_f (rtx, rtx); +extern rtx gen_msa_fill_w_f (rtx, rtx); +extern rtx gen_msa_fill_d (rtx, rtx); +extern rtx gen_msa_fill_w (rtx, rtx); +extern rtx gen_msa_fill_h (rtx, rtx); +extern rtx gen_msa_fill_b (rtx, rtx); +extern rtx gen_msa_flog2_d (rtx, rtx); +extern rtx gen_msa_flog2_w (rtx, rtx); +extern rtx gen_smaxv2df3 (rtx, rtx, rtx); +extern rtx gen_smaxv4sf3 (rtx, rtx, rtx); +extern rtx gen_msa_fmax_a_d (rtx, rtx, rtx); +extern rtx gen_msa_fmax_a_w (rtx, rtx, rtx); +extern rtx gen_sminv2df3 (rtx, rtx, rtx); +extern rtx gen_sminv4sf3 (rtx, rtx, rtx); +extern rtx gen_msa_fmin_a_d (rtx, rtx, rtx); +extern rtx gen_msa_fmin_a_w (rtx, rtx, rtx); +extern rtx gen_msa_frcp_d (rtx, rtx); +extern rtx gen_msa_frcp_w (rtx, rtx); +extern rtx gen_msa_frint_d (rtx, rtx); +extern rtx gen_msa_frint_w (rtx, rtx); +extern rtx gen_msa_frsqrt_d (rtx, rtx); +extern rtx gen_msa_frsqrt_w (rtx, rtx); +extern rtx gen_msa_ftint_s_d (rtx, rtx); +extern rtx gen_msa_ftint_s_w (rtx, rtx); +extern rtx gen_msa_ftint_u_d (rtx, rtx); +extern rtx gen_msa_ftint_u_w (rtx, rtx); +extern rtx gen_fix_truncv2dfv2di2 (rtx, rtx); +extern rtx gen_fix_truncv4sfv4si2 (rtx, rtx); +extern rtx gen_fixuns_truncv2dfv2di2 (rtx, rtx); +extern rtx gen_fixuns_truncv4sfv4si2 (rtx, rtx); +extern rtx gen_msa_ftq_h (rtx, rtx, rtx); +extern rtx gen_msa_ftq_w (rtx, rtx, rtx); +extern rtx gen_msa_hadd_s_h (rtx, rtx, rtx); +extern rtx gen_msa_hadd_u_h (rtx, rtx, rtx); +extern rtx gen_msa_hsub_s_h (rtx, rtx, rtx); +extern rtx gen_msa_hsub_u_h (rtx, rtx, rtx); +extern rtx gen_msa_hadd_s_w (rtx, rtx, rtx); +extern rtx gen_msa_hadd_u_w (rtx, rtx, rtx); +extern rtx gen_msa_hsub_s_w (rtx, rtx, rtx); +extern rtx gen_msa_hsub_u_w (rtx, rtx, rtx); +extern rtx gen_msa_hadd_s_d (rtx, rtx, rtx); +extern rtx gen_msa_hadd_u_d (rtx, rtx, rtx); +extern rtx gen_msa_hsub_s_d (rtx, rtx, rtx); +extern rtx gen_msa_hsub_u_d (rtx, rtx, rtx); +extern rtx gen_msa_ilvev_b (rtx, rtx, rtx); +extern rtx gen_msa_ilvev_h (rtx, rtx, rtx); +extern rtx gen_msa_ilvev_w (rtx, rtx, rtx); +extern rtx gen_msa_ilvev_w_f (rtx, rtx, rtx); +extern rtx gen_msa_ilvl_b (rtx, rtx, rtx); +extern rtx gen_msa_ilvl_h (rtx, rtx, rtx); +extern rtx gen_msa_ilvl_w (rtx, rtx, rtx); +extern rtx gen_msa_ilvl_w_f (rtx, rtx, rtx); +extern rtx gen_msa_ilvl_d (rtx, rtx, rtx); +extern rtx gen_msa_ilvl_d_f (rtx, rtx, rtx); +extern rtx gen_msa_ilvod_b (rtx, rtx, rtx); +extern rtx gen_msa_ilvod_h (rtx, rtx, rtx); +extern rtx gen_msa_ilvod_w (rtx, rtx, rtx); +extern rtx gen_msa_ilvod_w_f (rtx, rtx, rtx); +extern rtx gen_msa_ilvr_b (rtx, rtx, rtx); +extern rtx gen_msa_ilvr_h (rtx, rtx, rtx); +extern rtx gen_msa_ilvr_w (rtx, rtx, rtx); +extern rtx gen_msa_ilvr_w_f (rtx, rtx, rtx); +extern rtx gen_msa_ilvr_d (rtx, rtx, rtx); +extern rtx gen_msa_ilvr_d_f (rtx, rtx, rtx); +extern rtx gen_msa_madd_q_w (rtx, rtx, rtx, rtx); +extern rtx gen_msa_madd_q_h (rtx, rtx, rtx, rtx); +extern rtx gen_msa_maddr_q_w (rtx, rtx, rtx, rtx); +extern rtx gen_msa_maddr_q_h (rtx, rtx, rtx, rtx); +extern rtx gen_msa_max_a_d (rtx, rtx, rtx); +extern rtx gen_msa_max_a_w (rtx, rtx, rtx); +extern rtx gen_msa_max_a_h (rtx, rtx, rtx); +extern rtx gen_msa_max_a_b (rtx, rtx, rtx); +extern rtx gen_smaxv2di3 (rtx, rtx, rtx); +extern rtx gen_smaxv4si3 (rtx, rtx, rtx); +extern rtx gen_smaxv8hi3 (rtx, rtx, rtx); +extern rtx gen_smaxv16qi3 (rtx, rtx, rtx); +extern rtx gen_umaxv2di3 (rtx, rtx, rtx); +extern rtx gen_umaxv4si3 (rtx, rtx, rtx); +extern rtx gen_umaxv8hi3 (rtx, rtx, rtx); +extern rtx gen_umaxv16qi3 (rtx, rtx, rtx); +extern rtx gen_msa_min_a_d (rtx, rtx, rtx); +extern rtx gen_msa_min_a_w (rtx, rtx, rtx); +extern rtx gen_msa_min_a_h (rtx, rtx, rtx); +extern rtx gen_msa_min_a_b (rtx, rtx, rtx); +extern rtx gen_sminv2di3 (rtx, rtx, rtx); +extern rtx gen_sminv4si3 (rtx, rtx, rtx); +extern rtx gen_sminv8hi3 (rtx, rtx, rtx); +extern rtx gen_sminv16qi3 (rtx, rtx, rtx); +extern rtx gen_uminv2di3 (rtx, rtx, rtx); +extern rtx gen_uminv4si3 (rtx, rtx, rtx); +extern rtx gen_uminv8hi3 (rtx, rtx, rtx); +extern rtx gen_uminv16qi3 (rtx, rtx, rtx); +extern rtx gen_msa_msub_q_w (rtx, rtx, rtx, rtx); +extern rtx gen_msa_msub_q_h (rtx, rtx, rtx, rtx); +extern rtx gen_msa_msubr_q_w (rtx, rtx, rtx, rtx); +extern rtx gen_msa_msubr_q_h (rtx, rtx, rtx, rtx); +extern rtx gen_msa_mul_q_w (rtx, rtx, rtx); +extern rtx gen_msa_mul_q_h (rtx, rtx, rtx); +extern rtx gen_msa_mulr_q_w (rtx, rtx, rtx); +extern rtx gen_msa_mulr_q_h (rtx, rtx, rtx); +extern rtx gen_msa_nloc_d (rtx, rtx); +extern rtx gen_msa_nloc_w (rtx, rtx); +extern rtx gen_msa_nloc_h (rtx, rtx); +extern rtx gen_msa_nloc_b (rtx, rtx); +extern rtx gen_clzv2di2 (rtx, rtx); +extern rtx gen_clzv4si2 (rtx, rtx); +extern rtx gen_clzv8hi2 (rtx, rtx); +extern rtx gen_clzv16qi2 (rtx, rtx); +extern rtx gen_msa_nor_d (rtx, rtx, rtx); +extern rtx gen_msa_nor_w (rtx, rtx, rtx); +extern rtx gen_msa_nor_h (rtx, rtx, rtx); +extern rtx gen_msa_nor_b (rtx, rtx, rtx); +extern rtx gen_msa_pckev_b (rtx, rtx, rtx); +extern rtx gen_msa_pckev_h (rtx, rtx, rtx); +extern rtx gen_msa_pckev_w (rtx, rtx, rtx); +extern rtx gen_msa_pckev_w_f (rtx, rtx, rtx); +extern rtx gen_msa_pckod_b (rtx, rtx, rtx); +extern rtx gen_msa_pckod_h (rtx, rtx, rtx); +extern rtx gen_msa_pckod_w (rtx, rtx, rtx); +extern rtx gen_msa_pckod_w_f (rtx, rtx, rtx); +extern rtx gen_popcountv2di2 (rtx, rtx); +extern rtx gen_popcountv4si2 (rtx, rtx); +extern rtx gen_popcountv8hi2 (rtx, rtx); +extern rtx gen_popcountv16qi2 (rtx, rtx); +extern rtx gen_msa_sat_s_d (rtx, rtx, rtx); +extern rtx gen_msa_sat_s_w (rtx, rtx, rtx); +extern rtx gen_msa_sat_s_h (rtx, rtx, rtx); +extern rtx gen_msa_sat_s_b (rtx, rtx, rtx); +extern rtx gen_msa_sat_u_d (rtx, rtx, rtx); +extern rtx gen_msa_sat_u_w (rtx, rtx, rtx); +extern rtx gen_msa_sat_u_h (rtx, rtx, rtx); +extern rtx gen_msa_sat_u_b (rtx, rtx, rtx); +extern rtx gen_msa_shf_w (rtx, rtx, rtx); +extern rtx gen_msa_shf_h (rtx, rtx, rtx); +extern rtx gen_msa_shf_b (rtx, rtx, rtx); +extern rtx gen_msa_shf_w_f (rtx, rtx, rtx); +extern rtx gen_msa_srar_d (rtx, rtx, rtx); +extern rtx gen_msa_srar_w (rtx, rtx, rtx); +extern rtx gen_msa_srar_h (rtx, rtx, rtx); +extern rtx gen_msa_srar_b (rtx, rtx, rtx); +extern rtx gen_msa_srari_d (rtx, rtx, rtx); +extern rtx gen_msa_srari_w (rtx, rtx, rtx); +extern rtx gen_msa_srari_h (rtx, rtx, rtx); +extern rtx gen_msa_srari_b (rtx, rtx, rtx); +extern rtx gen_msa_srlr_d (rtx, rtx, rtx); +extern rtx gen_msa_srlr_w (rtx, rtx, rtx); +extern rtx gen_msa_srlr_h (rtx, rtx, rtx); +extern rtx gen_msa_srlr_b (rtx, rtx, rtx); +extern rtx gen_msa_srlri_d (rtx, rtx, rtx); +extern rtx gen_msa_srlri_w (rtx, rtx, rtx); +extern rtx gen_msa_srlri_h (rtx, rtx, rtx); +extern rtx gen_msa_srlri_b (rtx, rtx, rtx); +extern rtx gen_msa_subs_s_d (rtx, rtx, rtx); +extern rtx gen_msa_subs_s_w (rtx, rtx, rtx); +extern rtx gen_msa_subs_s_h (rtx, rtx, rtx); +extern rtx gen_msa_subs_s_b (rtx, rtx, rtx); +extern rtx gen_msa_subs_u_d (rtx, rtx, rtx); +extern rtx gen_msa_subs_u_w (rtx, rtx, rtx); +extern rtx gen_msa_subs_u_h (rtx, rtx, rtx); +extern rtx gen_msa_subs_u_b (rtx, rtx, rtx); +extern rtx gen_msa_subsuu_s_d (rtx, rtx, rtx); +extern rtx gen_msa_subsuu_s_w (rtx, rtx, rtx); +extern rtx gen_msa_subsuu_s_h (rtx, rtx, rtx); +extern rtx gen_msa_subsuu_s_b (rtx, rtx, rtx); +extern rtx gen_msa_subsus_u_d (rtx, rtx, rtx); +extern rtx gen_msa_subsus_u_w (rtx, rtx, rtx); +extern rtx gen_msa_subsus_u_h (rtx, rtx, rtx); +extern rtx gen_msa_subsus_u_b (rtx, rtx, rtx); +extern rtx gen_msa_sld_d_f (rtx, rtx, rtx, rtx); +extern rtx gen_msa_sld_w_f (rtx, rtx, rtx, rtx); +extern rtx gen_msa_sld_d (rtx, rtx, rtx, rtx); +extern rtx gen_msa_sld_w (rtx, rtx, rtx, rtx); +extern rtx gen_msa_sld_h (rtx, rtx, rtx, rtx); +extern rtx gen_msa_sld_b (rtx, rtx, rtx, rtx); +extern rtx gen_msa_sldi_d_f (rtx, rtx, rtx, rtx); +extern rtx gen_msa_sldi_w_f (rtx, rtx, rtx, rtx); +extern rtx gen_msa_sldi_d (rtx, rtx, rtx, rtx); +extern rtx gen_msa_sldi_w (rtx, rtx, rtx, rtx); +extern rtx gen_msa_sldi_h (rtx, rtx, rtx, rtx); +extern rtx gen_msa_sldi_b (rtx, rtx, rtx, rtx); +extern rtx gen_msa_splat_d_f (rtx, rtx, rtx); +extern rtx gen_msa_splat_w_f (rtx, rtx, rtx); +extern rtx gen_msa_splat_d (rtx, rtx, rtx); +extern rtx gen_msa_splat_w (rtx, rtx, rtx); +extern rtx gen_msa_splat_h (rtx, rtx, rtx); +extern rtx gen_msa_splat_b (rtx, rtx, rtx); +extern rtx gen_msa_splati_d_f (rtx, rtx, rtx); +extern rtx gen_msa_splati_w_f (rtx, rtx, rtx); +extern rtx gen_msa_splati_d (rtx, rtx, rtx); +extern rtx gen_msa_splati_w (rtx, rtx, rtx); +extern rtx gen_msa_splati_h (rtx, rtx, rtx); +extern rtx gen_msa_splati_b (rtx, rtx, rtx); +extern rtx gen_msa_splati_d_f_scalar (rtx, rtx); +extern rtx gen_msa_splati_w_f_scalar (rtx, rtx); +extern rtx gen_msa_cfcmsa (rtx, rtx); +extern rtx gen_msa_ctcmsa (rtx, rtx); +extern rtx gen_msa_fexdo_h (rtx, rtx, rtx); +extern rtx gen_vec_pack_trunc_v2df (rtx, rtx, rtx); +extern rtx gen_msa_fexupl_w (rtx, rtx); +extern rtx gen_msa_fexupl_d (rtx, rtx); +extern rtx gen_msa_fexupr_w (rtx, rtx); +extern rtx gen_msa_fexupr_d (rtx, rtx); +extern rtx gen_msa_bz_d_f (rtx, rtx, rtx); +extern rtx gen_msa_bnz_d_f (rtx, rtx, rtx); +extern rtx gen_msa_bz_w_f (rtx, rtx, rtx); +extern rtx gen_msa_bnz_w_f (rtx, rtx, rtx); +extern rtx gen_msa_bz_d (rtx, rtx, rtx); +extern rtx gen_msa_bnz_d (rtx, rtx, rtx); +extern rtx gen_msa_bz_w (rtx, rtx, rtx); +extern rtx gen_msa_bnz_w (rtx, rtx, rtx); +extern rtx gen_msa_bz_h (rtx, rtx, rtx); +extern rtx gen_msa_bnz_h (rtx, rtx, rtx); +extern rtx gen_msa_bz_b (rtx, rtx, rtx); +extern rtx gen_msa_bnz_b (rtx, rtx, rtx); +extern rtx gen_msa_bz_v_d_f (rtx, rtx, rtx); +extern rtx gen_msa_bnz_v_d_f (rtx, rtx, rtx); +extern rtx gen_msa_bz_v_w_f (rtx, rtx, rtx); +extern rtx gen_msa_bnz_v_w_f (rtx, rtx, rtx); +extern rtx gen_msa_bz_v_d (rtx, rtx, rtx); +extern rtx gen_msa_bnz_v_d (rtx, rtx, rtx); +extern rtx gen_msa_bz_v_w (rtx, rtx, rtx); +extern rtx gen_msa_bnz_v_w (rtx, rtx, rtx); +extern rtx gen_msa_bz_v_h (rtx, rtx, rtx); +extern rtx gen_msa_bnz_v_h (rtx, rtx, rtx); +extern rtx gen_msa_bz_v_b (rtx, rtx, rtx); +extern rtx gen_msa_bnz_v_b (rtx, rtx, rtx); +extern rtx gen_ctrapsi4 (rtx, rtx, rtx, rtx); +extern rtx gen_ctrapdi4 (rtx, rtx, rtx, rtx); +extern rtx gen_addsi3 (rtx, rtx, rtx); +extern rtx gen_adddi3 (rtx, rtx, rtx); +extern rtx gen_mulsf3 (rtx, rtx, rtx); +extern rtx gen_muldf3 (rtx, rtx, rtx); +extern rtx gen_mulsi3 (rtx, rtx, rtx); +extern rtx gen_muldi3 (rtx, rtx, rtx); +extern rtx gen_mulsidi3 (rtx, rtx, rtx); +extern rtx gen_umulsidi3 (rtx, rtx, rtx); +extern rtx gen_mulsidi3_32bit_r6 (rtx, rtx, rtx); +extern rtx gen_umulsidi3_32bit_r6 (rtx, rtx, rtx); +extern rtx gen_mulsidi3_32bit_mips16 (rtx, rtx, rtx); +extern rtx gen_umulsidi3_32bit_mips16 (rtx, rtx, rtx); +extern rtx gen_mulsidi3_64bit_mips16 (rtx, rtx, rtx); +extern rtx gen_umulsidi3_64bit_mips16 (rtx, rtx, rtx); +extern rtx gen_mulsidi3_64bit_split (rtx, rtx, rtx, rtx); +extern rtx gen_umulsidi3_64bit_split (rtx, rtx, rtx, rtx); +extern rtx gen_smulsi3_highpart (rtx, rtx, rtx); +extern rtx gen_umulsi3_highpart (rtx, rtx, rtx); +extern rtx gen_smulsi3_highpart_split (rtx, rtx, rtx); +extern rtx gen_umulsi3_highpart_split (rtx, rtx, rtx); +extern rtx gen_smuldi3_highpart (rtx, rtx, rtx); +extern rtx gen_umuldi3_highpart (rtx, rtx, rtx); +extern rtx gen_smuldi3_highpart_split (rtx, rtx, rtx); +extern rtx gen_umuldi3_highpart_split (rtx, rtx, rtx); +extern rtx gen_mulditi3 (rtx, rtx, rtx); +extern rtx gen_umulditi3 (rtx, rtx, rtx); +extern rtx gen_fmasf4 (rtx, rtx, rtx, rtx); +extern rtx gen_fmadf4 (rtx, rtx, rtx, rtx); +extern rtx gen_fmav2sf4 (rtx, rtx, rtx, rtx); +extern rtx gen_fmssf4 (rtx, rtx, rtx, rtx); +extern rtx gen_fmsdf4 (rtx, rtx, rtx, rtx); +extern rtx gen_fmsv2sf4 (rtx, rtx, rtx, rtx); +extern rtx gen_fnmasf4 (rtx, rtx, rtx, rtx); +extern rtx gen_fnmadf4 (rtx, rtx, rtx, rtx); +extern rtx gen_fnmav2sf4 (rtx, rtx, rtx, rtx); +extern rtx gen_fnmssf4 (rtx, rtx, rtx, rtx); +extern rtx gen_fnmsdf4 (rtx, rtx, rtx, rtx); +extern rtx gen_fnmsv2sf4 (rtx, rtx, rtx, rtx); +extern rtx gen_divsf3 (rtx, rtx, rtx); +extern rtx gen_divdf3 (rtx, rtx, rtx); +extern rtx gen_divv2sf3 (rtx, rtx, rtx); +extern rtx gen_divmodsi4 (rtx, rtx, rtx, rtx); +extern rtx gen_divmoddi4 (rtx, rtx, rtx, rtx); +extern rtx gen_udivmodsi4 (rtx, rtx, rtx, rtx); +extern rtx gen_udivmoddi4 (rtx, rtx, rtx, rtx); +extern rtx gen_divmodsi4_split (rtx, rtx, rtx); +extern rtx gen_udivmodsi4_split (rtx, rtx, rtx); +extern rtx gen_divmoddi4_split (rtx, rtx, rtx); +extern rtx gen_udivmoddi4_split (rtx, rtx, rtx); +extern rtx gen_andsi3 (rtx, rtx, rtx); +extern rtx gen_anddi3 (rtx, rtx, rtx); +extern rtx gen_iorsi3 (rtx, rtx, rtx); +extern rtx gen_iordi3 (rtx, rtx, rtx); +extern rtx gen_xorsi3 (rtx, rtx, rtx); +extern rtx gen_xordi3 (rtx, rtx, rtx); +extern rtx gen_zero_extendsidi2 (rtx, rtx); +extern rtx gen_zero_extendqisi2 (rtx, rtx); +extern rtx gen_zero_extendqidi2 (rtx, rtx); +extern rtx gen_zero_extendhisi2 (rtx, rtx); +extern rtx gen_zero_extendhidi2 (rtx, rtx); +extern rtx gen_zero_extendqihi2 (rtx, rtx); +extern rtx gen_extendqisi2 (rtx, rtx); +extern rtx gen_extendqidi2 (rtx, rtx); +extern rtx gen_extendhisi2 (rtx, rtx); +extern rtx gen_extendhidi2 (rtx, rtx); +extern rtx gen_extendqihi2 (rtx, rtx); +extern rtx gen_fix_truncdfsi2 (rtx, rtx); +extern rtx gen_fix_truncsfsi2 (rtx, rtx); +extern rtx gen_fixuns_truncdfsi2 (rtx, rtx); +extern rtx gen_fixuns_truncdfdi2 (rtx, rtx); +extern rtx gen_fixuns_truncsfsi2 (rtx, rtx); +extern rtx gen_fixuns_truncsfdi2 (rtx, rtx); +extern rtx gen_extvmisalignsi (rtx, rtx, rtx, rtx); +extern rtx gen_extvmisaligndi (rtx, rtx, rtx, rtx); +extern rtx gen_extvsi (rtx, rtx, rtx, rtx); +extern rtx gen_extvdi (rtx, rtx, rtx, rtx); +extern rtx gen_extzvmisalignsi (rtx, rtx, rtx, rtx); +extern rtx gen_extzvmisaligndi (rtx, rtx, rtx, rtx); +extern rtx gen_extzvsi (rtx, rtx, rtx, rtx); +extern rtx gen_extzvdi (rtx, rtx, rtx, rtx); +extern rtx gen_insvmisalignsi (rtx, rtx, rtx, rtx); +extern rtx gen_insvmisaligndi (rtx, rtx, rtx, rtx); +extern rtx gen_insvsi (rtx, rtx, rtx, rtx); +extern rtx gen_insvdi (rtx, rtx, rtx, rtx); +extern rtx gen_unspec_got_si (rtx, rtx); +extern rtx gen_unspec_got_di (rtx, rtx); +extern rtx gen_movdi (rtx, rtx); +extern rtx gen_movsi (rtx, rtx); +extern rtx gen_movv2hi (rtx, rtx); +extern rtx gen_movv4qi (rtx, rtx); +extern rtx gen_movv2hq (rtx, rtx); +extern rtx gen_movv2uhq (rtx, rtx); +extern rtx gen_movv2ha (rtx, rtx); +extern rtx gen_movv2uha (rtx, rtx); +extern rtx gen_movv4qq (rtx, rtx); +extern rtx gen_movv4uqq (rtx, rtx); +extern rtx gen_movhi (rtx, rtx); +extern rtx gen_movqi (rtx, rtx); +extern rtx gen_movsf (rtx, rtx); +extern rtx gen_movdf (rtx, rtx); +extern rtx gen_movti (rtx, rtx); +extern rtx gen_movtf (rtx, rtx); +extern rtx gen_movv2sf (rtx, rtx); +extern rtx gen_move_doubleword_fprdf (rtx, rtx); +extern rtx gen_move_doubleword_fprdi (rtx, rtx); +extern rtx gen_move_doubleword_fprv2sf (rtx, rtx); +extern rtx gen_move_doubleword_fprv2si (rtx, rtx); +extern rtx gen_move_doubleword_fprv4hi (rtx, rtx); +extern rtx gen_move_doubleword_fprv8qi (rtx, rtx); +extern rtx gen_move_doubleword_fprtf (rtx, rtx); +extern rtx gen_load_const_gp_si (rtx); +extern rtx gen_load_const_gp_di (rtx); +extern rtx gen_clear_cache (rtx, rtx); +extern rtx gen_movmemsi (rtx, rtx, rtx, rtx); +extern rtx gen_ashlsi3 (rtx, rtx, rtx); +extern rtx gen_ashrsi3 (rtx, rtx, rtx); +extern rtx gen_lshrsi3 (rtx, rtx, rtx); +extern rtx gen_ashldi3 (rtx, rtx, rtx); +extern rtx gen_ashrdi3 (rtx, rtx, rtx); +extern rtx gen_lshrdi3 (rtx, rtx, rtx); +extern rtx gen_cbranchsi4 (rtx, rtx, rtx, rtx); +extern rtx gen_cbranchdi4 (rtx, rtx, rtx, rtx); +extern rtx gen_cbranchsf4 (rtx, rtx, rtx, rtx); +extern rtx gen_cbranchdf4 (rtx, rtx, rtx, rtx); +extern rtx gen_condjump (rtx, rtx); +extern rtx gen_cstoresi4 (rtx, rtx, rtx, rtx); +extern rtx gen_cstoredi4 (rtx, rtx, rtx, rtx); +extern rtx gen_jump (rtx); +extern rtx gen_indirect_jump (rtx); +extern rtx gen_tablejump (rtx, rtx); +extern rtx gen_casesi (rtx, rtx, rtx, rtx, rtx); +extern rtx gen_builtin_setjmp_setup (rtx); +extern rtx gen_builtin_longjmp (rtx); +extern rtx gen_prologue (void); +extern rtx gen_epilogue (void); +extern rtx gen_sibcall_epilogue (void); +extern rtx gen_return (void); +extern rtx gen_simple_return (void); +extern rtx gen_eh_return (rtx); +extern rtx gen_exception_receiver (void); +extern rtx gen_nonlocal_goto_receiver (void); +extern rtx gen_sibcall (rtx, rtx, rtx, rtx); +extern rtx gen_sibcall_value (rtx, rtx, rtx, rtx); +extern rtx gen_call (rtx, rtx, rtx, rtx); +extern rtx gen_call_value (rtx, rtx, rtx, rtx); +extern rtx gen_untyped_call (rtx, rtx, rtx); +extern rtx gen_movsicc (rtx, rtx, rtx, rtx); +extern rtx gen_movdicc (rtx, rtx, rtx, rtx); +extern rtx gen_movsfcc (rtx, rtx, rtx, rtx); +extern rtx gen_movdfcc (rtx, rtx, rtx, rtx); +extern rtx gen_get_thread_pointersi (rtx); +extern rtx gen_get_thread_pointerdi (rtx); +extern rtx gen_mips_get_fcsr (rtx); +extern rtx gen_mips_set_fcsr (rtx); +extern rtx gen_memory_barrier (void); +extern rtx gen_sync_compare_and_swapqi (rtx, rtx, rtx, rtx); +extern rtx gen_sync_compare_and_swaphi (rtx, rtx, rtx, rtx); +extern rtx gen_sync_addqi (rtx, rtx); +extern rtx gen_sync_subqi (rtx, rtx); +extern rtx gen_sync_iorqi (rtx, rtx); +extern rtx gen_sync_xorqi (rtx, rtx); +extern rtx gen_sync_andqi (rtx, rtx); +extern rtx gen_sync_addhi (rtx, rtx); +extern rtx gen_sync_subhi (rtx, rtx); +extern rtx gen_sync_iorhi (rtx, rtx); +extern rtx gen_sync_xorhi (rtx, rtx); +extern rtx gen_sync_andhi (rtx, rtx); +extern rtx gen_sync_old_addqi (rtx, rtx, rtx); +extern rtx gen_sync_old_subqi (rtx, rtx, rtx); +extern rtx gen_sync_old_iorqi (rtx, rtx, rtx); +extern rtx gen_sync_old_xorqi (rtx, rtx, rtx); +extern rtx gen_sync_old_andqi (rtx, rtx, rtx); +extern rtx gen_sync_old_addhi (rtx, rtx, rtx); +extern rtx gen_sync_old_subhi (rtx, rtx, rtx); +extern rtx gen_sync_old_iorhi (rtx, rtx, rtx); +extern rtx gen_sync_old_xorhi (rtx, rtx, rtx); +extern rtx gen_sync_old_andhi (rtx, rtx, rtx); +extern rtx gen_sync_new_addqi (rtx, rtx, rtx); +extern rtx gen_sync_new_subqi (rtx, rtx, rtx); +extern rtx gen_sync_new_iorqi (rtx, rtx, rtx); +extern rtx gen_sync_new_xorqi (rtx, rtx, rtx); +extern rtx gen_sync_new_andqi (rtx, rtx, rtx); +extern rtx gen_sync_new_addhi (rtx, rtx, rtx); +extern rtx gen_sync_new_subhi (rtx, rtx, rtx); +extern rtx gen_sync_new_iorhi (rtx, rtx, rtx); +extern rtx gen_sync_new_xorhi (rtx, rtx, rtx); +extern rtx gen_sync_new_andhi (rtx, rtx, rtx); +extern rtx gen_sync_nandqi (rtx, rtx); +extern rtx gen_sync_nandhi (rtx, rtx); +extern rtx gen_sync_old_nandqi (rtx, rtx, rtx); +extern rtx gen_sync_old_nandhi (rtx, rtx, rtx); +extern rtx gen_sync_new_nandqi (rtx, rtx, rtx); +extern rtx gen_sync_new_nandhi (rtx, rtx, rtx); +extern rtx gen_sync_lock_test_and_setqi (rtx, rtx, rtx); +extern rtx gen_sync_lock_test_and_sethi (rtx, rtx, rtx); +extern rtx gen_atomic_exchangesi (rtx, rtx, rtx, rtx); +extern rtx gen_atomic_exchangedi (rtx, rtx, rtx, rtx); +extern rtx gen_atomic_fetch_addsi (rtx, rtx, rtx, rtx); +extern rtx gen_atomic_fetch_adddi (rtx, rtx, rtx, rtx); +extern rtx gen_movv2sfcc (rtx, rtx, rtx, rtx); +extern rtx gen_vec_perm_constv2sf (rtx, rtx, rtx, rtx); +extern rtx gen_mips_puu_ps (rtx, rtx, rtx); +extern rtx gen_mips_pul_ps (rtx, rtx, rtx); +extern rtx gen_mips_plu_ps (rtx, rtx, rtx); +extern rtx gen_mips_pll_ps (rtx, rtx, rtx); +extern rtx gen_vec_initv2sf (rtx, rtx); +extern rtx gen_vec_setv2sf (rtx, rtx, rtx); +extern rtx gen_mips_cvt_ps_s (rtx, rtx, rtx); +extern rtx gen_mips_cvt_s_pl (rtx, rtx); +extern rtx gen_mips_cvt_s_pu (rtx, rtx); +extern rtx gen_reduc_plus_scal_v2sf (rtx, rtx); +extern rtx gen_mips_abs_ps (rtx, rtx); +extern rtx gen_scc_ps (rtx, rtx); +extern rtx gen_single_cc (rtx, rtx); +extern rtx gen_vcondv2sfv2sf (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_sminv2sf3 (rtx, rtx, rtx); +extern rtx gen_smaxv2sf3 (rtx, rtx, rtx); +extern rtx gen_reduc_smin_scal_v2sf (rtx, rtx); +extern rtx gen_reduc_smax_scal_v2sf (rtx, rtx); +extern rtx gen_mips_lbux (rtx, rtx, rtx); +extern rtx gen_mips_lhx (rtx, rtx, rtx); +extern rtx gen_mips_lwx (rtx, rtx, rtx); +extern rtx gen_mips_ldx (rtx, rtx, rtx); +extern rtx gen_mips_madd (rtx, rtx, rtx, rtx); +extern rtx gen_mips_maddu (rtx, rtx, rtx, rtx); +extern rtx gen_mips_msub (rtx, rtx, rtx, rtx); +extern rtx gen_mips_msubu (rtx, rtx, rtx, rtx); +extern rtx gen_movv2si (rtx, rtx); +extern rtx gen_movv4hi (rtx, rtx); +extern rtx gen_movv8qi (rtx, rtx); +extern rtx gen_vec_initv2si (rtx, rtx); +extern rtx gen_vec_initv4hi (rtx, rtx); +extern rtx gen_vec_initv8qi (rtx, rtx); +extern rtx gen_vec_setv4hi (rtx, rtx, rtx, rtx); +extern rtx gen_sdot_prodv4hi (rtx, rtx, rtx, rtx); +extern rtx gen_smaxv2si3 (rtx, rtx, rtx); +extern rtx gen_smaxv8qi3 (rtx, rtx, rtx); +extern rtx gen_sminv2si3 (rtx, rtx, rtx); +extern rtx gen_sminv8qi3 (rtx, rtx, rtx); +extern rtx gen_vec_perm_constv2si (rtx, rtx, rtx, rtx); +extern rtx gen_vec_perm_constv4hi (rtx, rtx, rtx, rtx); +extern rtx gen_vec_perm_constv8qi (rtx, rtx, rtx, rtx); +extern rtx gen_vec_unpacks_lo_v4hi (rtx, rtx); +extern rtx gen_vec_unpacks_lo_v8qi (rtx, rtx); +extern rtx gen_vec_unpacks_hi_v4hi (rtx, rtx); +extern rtx gen_vec_unpacks_hi_v8qi (rtx, rtx); +extern rtx gen_vec_unpacku_lo_v4hi (rtx, rtx); +extern rtx gen_vec_unpacku_lo_v8qi (rtx, rtx); +extern rtx gen_vec_unpacku_hi_v4hi (rtx, rtx); +extern rtx gen_vec_unpacku_hi_v8qi (rtx, rtx); +extern rtx gen_reduc_plus_scal_v2si (rtx, rtx); +extern rtx gen_reduc_plus_scal_v4hi (rtx, rtx); +extern rtx gen_reduc_plus_scal_v8qi (rtx, rtx); +extern rtx gen_reduc_smax_scal_v2si (rtx, rtx); +extern rtx gen_reduc_smax_scal_v4hi (rtx, rtx); +extern rtx gen_reduc_smax_scal_v8qi (rtx, rtx); +extern rtx gen_reduc_smin_scal_v2si (rtx, rtx); +extern rtx gen_reduc_smin_scal_v4hi (rtx, rtx); +extern rtx gen_reduc_smin_scal_v8qi (rtx, rtx); +extern rtx gen_reduc_umax_scal_v8qi (rtx, rtx); +extern rtx gen_reduc_umin_scal_v8qi (rtx, rtx); +extern rtx gen_vec_initv2df (rtx, rtx); +extern rtx gen_vec_initv4sf (rtx, rtx); +extern rtx gen_vec_initv2di (rtx, rtx); +extern rtx gen_vec_initv4si (rtx, rtx); +extern rtx gen_vec_initv8hi (rtx, rtx); +extern rtx gen_vec_initv16qi (rtx, rtx); +extern rtx gen_vec_unpacks_hi_v4sf (rtx, rtx); +extern rtx gen_vec_unpacks_lo_v4sf (rtx, rtx); +extern rtx gen_vec_unpacks_hi_v4si (rtx, rtx); +extern rtx gen_vec_unpacks_hi_v8hi (rtx, rtx); +extern rtx gen_vec_unpacks_hi_v16qi (rtx, rtx); +extern rtx gen_vec_unpacks_lo_v4si (rtx, rtx); +extern rtx gen_vec_unpacks_lo_v8hi (rtx, rtx); +extern rtx gen_vec_unpacks_lo_v16qi (rtx, rtx); +extern rtx gen_vec_unpacku_hi_v4si (rtx, rtx); +extern rtx gen_vec_unpacku_hi_v8hi (rtx, rtx); +extern rtx gen_vec_unpacku_hi_v16qi (rtx, rtx); +extern rtx gen_vec_unpacku_lo_v4si (rtx, rtx); +extern rtx gen_vec_unpacku_lo_v8hi (rtx, rtx); +extern rtx gen_vec_unpacku_lo_v16qi (rtx, rtx); +extern rtx gen_vec_extractv2di (rtx, rtx, rtx); +extern rtx gen_vec_extractv4si (rtx, rtx, rtx); +extern rtx gen_vec_extractv8hi (rtx, rtx, rtx); +extern rtx gen_vec_extractv16qi (rtx, rtx, rtx); +extern rtx gen_vec_extractv2df (rtx, rtx, rtx); +extern rtx gen_vec_extractv4sf (rtx, rtx, rtx); +extern rtx gen_vec_setv2di (rtx, rtx, rtx); +extern rtx gen_vec_setv4si (rtx, rtx, rtx); +extern rtx gen_vec_setv8hi (rtx, rtx, rtx); +extern rtx gen_vec_setv16qi (rtx, rtx, rtx); +extern rtx gen_vec_setv2df (rtx, rtx, rtx); +extern rtx gen_vec_setv4sf (rtx, rtx, rtx); +extern rtx gen_vconduv2dfv2di (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vconduv2dfv4si (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vconduv2dfv8hi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vconduv2dfv16qi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vconduv4sfv2di (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vconduv4sfv4si (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vconduv4sfv8hi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vconduv4sfv16qi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vconduv2div2di (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vconduv2div4si (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vconduv2div8hi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vconduv2div16qi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vconduv4siv2di (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vconduv4siv4si (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vconduv4siv8hi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vconduv4siv16qi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vconduv8hiv2di (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vconduv8hiv4si (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vconduv8hiv8hi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vconduv8hiv16qi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vconduv16qiv2di (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vconduv16qiv4si (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vconduv16qiv8hi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vconduv16qiv16qi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv2dfv2df (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv4sfv2df (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv2div2df (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv4siv2df (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv8hiv2df (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv16qiv2df (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv2dfv4sf (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv4sfv4sf (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv2div4sf (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv4siv4sf (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv8hiv4sf (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv16qiv4sf (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv2dfv2di (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv4sfv2di (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv2div2di (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv4siv2di (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv8hiv2di (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv16qiv2di (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv2dfv4si (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv4sfv4si (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv2div4si (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv4siv4si (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv8hiv4si (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv16qiv4si (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv2dfv8hi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv4sfv8hi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv2div8hi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv4siv8hi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv8hiv8hi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv16qiv8hi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv2dfv16qi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv4sfv16qi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv2div16qi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv4siv16qi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv8hiv16qi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vcondv16qiv16qi (rtx, rtx, rtx, rtx, rtx, rtx); +extern rtx gen_vec_perm_constv2df (rtx, rtx, rtx, rtx); +extern rtx gen_vec_perm_constv4sf (rtx, rtx, rtx, rtx); +extern rtx gen_vec_perm_constv2di (rtx, rtx, rtx, rtx); +extern rtx gen_vec_perm_constv4si (rtx, rtx, rtx, rtx); +extern rtx gen_vec_perm_constv8hi (rtx, rtx, rtx, rtx); +extern rtx gen_vec_perm_constv16qi (rtx, rtx, rtx, rtx); +extern rtx gen_absv2di2 (rtx, rtx); +extern rtx gen_absv4si2 (rtx, rtx); +extern rtx gen_absv8hi2 (rtx, rtx); +extern rtx gen_absv16qi2 (rtx, rtx); +extern rtx gen_negv2df2 (rtx, rtx); +extern rtx gen_negv4sf2 (rtx, rtx); +extern rtx gen_negv2di2 (rtx, rtx); +extern rtx gen_negv4si2 (rtx, rtx); +extern rtx gen_negv8hi2 (rtx, rtx); +extern rtx gen_negv16qi2 (rtx, rtx); +extern rtx gen_msa_ldiv2di (rtx, rtx); +extern rtx gen_msa_ldiv4si (rtx, rtx); +extern rtx gen_msa_ldiv8hi (rtx, rtx); +extern rtx gen_msa_ldiv16qi (rtx, rtx); +extern rtx gen_movv2df (rtx, rtx); +extern rtx gen_movv4sf (rtx, rtx); +extern rtx gen_movv2di (rtx, rtx); +extern rtx gen_movv4si (rtx, rtx); +extern rtx gen_movv8hi (rtx, rtx); +extern rtx gen_movv16qi (rtx, rtx); +extern rtx gen_movmisalignv2df (rtx, rtx); +extern rtx gen_movmisalignv4sf (rtx, rtx); +extern rtx gen_movmisalignv2di (rtx, rtx); +extern rtx gen_movmisalignv4si (rtx, rtx); +extern rtx gen_movmisalignv8hi (rtx, rtx); +extern rtx gen_movmisalignv16qi (rtx, rtx); +extern rtx gen_msa_ld_d_f (rtx, rtx, rtx); +extern rtx gen_msa_ld_w_f (rtx, rtx, rtx); +extern rtx gen_msa_ld_d (rtx, rtx, rtx); +extern rtx gen_msa_ld_w (rtx, rtx, rtx); +extern rtx gen_msa_ld_h (rtx, rtx, rtx); +extern rtx gen_msa_ld_b (rtx, rtx, rtx); +extern rtx gen_msa_st_d_f (rtx, rtx, rtx); +extern rtx gen_msa_st_w_f (rtx, rtx, rtx); +extern rtx gen_msa_st_d (rtx, rtx, rtx); +extern rtx gen_msa_st_w (rtx, rtx, rtx); +extern rtx gen_msa_st_h (rtx, rtx, rtx); +extern rtx gen_msa_st_b (rtx, rtx, rtx); + +#endif /* GCC_INSN_FLAGS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/insn-modes.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/insn-modes.h new file mode 100644 index 0000000..0be7e89 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/insn-modes.h @@ -0,0 +1,645 @@ +/* Generated automatically from machmode.def and config/mips/mips-modes.def + by genmodes. */ + +#ifndef GCC_INSN_MODES_H +#define GCC_INSN_MODES_H + +enum machine_mode +{ + VOIDmode, /* machmode.def:172 */ +#define HAVE_VOIDmode + BLKmode, /* machmode.def:176 */ +#define HAVE_BLKmode + CCmode, /* machmode.def:214 */ +#define HAVE_CCmode + CCV2mode, /* config/mips/mips-modes.def:45 */ +#define HAVE_CCV2mode + CCV4mode, /* config/mips/mips-modes.def:49 */ +#define HAVE_CCV4mode + CCDSPmode, /* config/mips/mips-modes.def:54 */ +#define HAVE_CCDSPmode + CCFmode, /* config/mips/mips-modes.def:57 */ +#define HAVE_CCFmode + BImode, /* machmode.def:179 */ +#define HAVE_BImode + QImode, /* machmode.def:187 */ +#define HAVE_QImode + HImode, /* machmode.def:188 */ +#define HAVE_HImode + SImode, /* machmode.def:189 */ +#define HAVE_SImode + DImode, /* machmode.def:190 */ +#define HAVE_DImode + TImode, /* machmode.def:191 */ +#define HAVE_TImode + QQmode, /* machmode.def:217 */ +#define HAVE_QQmode + HQmode, /* machmode.def:218 */ +#define HAVE_HQmode + SQmode, /* machmode.def:219 */ +#define HAVE_SQmode + DQmode, /* machmode.def:220 */ +#define HAVE_DQmode + TQmode, /* machmode.def:221 */ +#define HAVE_TQmode + UQQmode, /* machmode.def:223 */ +#define HAVE_UQQmode + UHQmode, /* machmode.def:224 */ +#define HAVE_UHQmode + USQmode, /* machmode.def:225 */ +#define HAVE_USQmode + UDQmode, /* machmode.def:226 */ +#define HAVE_UDQmode + UTQmode, /* machmode.def:227 */ +#define HAVE_UTQmode + HAmode, /* machmode.def:229 */ +#define HAVE_HAmode + SAmode, /* machmode.def:230 */ +#define HAVE_SAmode + DAmode, /* machmode.def:231 */ +#define HAVE_DAmode + TAmode, /* machmode.def:232 */ +#define HAVE_TAmode + UHAmode, /* machmode.def:234 */ +#define HAVE_UHAmode + USAmode, /* machmode.def:235 */ +#define HAVE_USAmode + UDAmode, /* machmode.def:236 */ +#define HAVE_UDAmode + UTAmode, /* machmode.def:237 */ +#define HAVE_UTAmode + SFmode, /* machmode.def:209 */ +#define HAVE_SFmode + DFmode, /* machmode.def:210 */ +#define HAVE_DFmode + TFmode, /* config/mips/mips-modes.def:20 */ +#define HAVE_TFmode + SDmode, /* machmode.def:249 */ +#define HAVE_SDmode + DDmode, /* machmode.def:250 */ +#define HAVE_DDmode + TDmode, /* machmode.def:251 */ +#define HAVE_TDmode + CQImode, /* machmode.def:245 */ +#define HAVE_CQImode + CHImode, /* machmode.def:245 */ +#define HAVE_CHImode + CSImode, /* machmode.def:245 */ +#define HAVE_CSImode + CDImode, /* machmode.def:245 */ +#define HAVE_CDImode + CTImode, /* machmode.def:245 */ +#define HAVE_CTImode + SCmode, /* machmode.def:246 */ +#define HAVE_SCmode + DCmode, /* machmode.def:246 */ +#define HAVE_DCmode + TCmode, /* machmode.def:246 */ +#define HAVE_TCmode + V4QImode, /* config/mips/mips-modes.def:23 */ +#define HAVE_V4QImode + V2HImode, /* config/mips/mips-modes.def:23 */ +#define HAVE_V2HImode + V8QImode, /* config/mips/mips-modes.def:24 */ +#define HAVE_V8QImode + V4HImode, /* config/mips/mips-modes.def:24 */ +#define HAVE_V4HImode + V2SImode, /* config/mips/mips-modes.def:24 */ +#define HAVE_V2SImode + V16QImode, /* config/mips/mips-modes.def:28 */ +#define HAVE_V16QImode + V8HImode, /* config/mips/mips-modes.def:28 */ +#define HAVE_V8HImode + V4SImode, /* config/mips/mips-modes.def:28 */ +#define HAVE_V4SImode + V2DImode, /* config/mips/mips-modes.def:28 */ +#define HAVE_V2DImode + V32QImode, /* config/mips/mips-modes.def:32 */ +#define HAVE_V32QImode + V16HImode, /* config/mips/mips-modes.def:33 */ +#define HAVE_V16HImode + V8SImode, /* config/mips/mips-modes.def:34 */ +#define HAVE_V8SImode + V4DImode, /* config/mips/mips-modes.def:35 */ +#define HAVE_V4DImode + V4QQmode, /* config/mips/mips-modes.def:39 */ +#define HAVE_V4QQmode + V2HQmode, /* config/mips/mips-modes.def:39 */ +#define HAVE_V2HQmode + V4UQQmode, /* config/mips/mips-modes.def:40 */ +#define HAVE_V4UQQmode + V2UHQmode, /* config/mips/mips-modes.def:40 */ +#define HAVE_V2UHQmode + V2HAmode, /* config/mips/mips-modes.def:41 */ +#define HAVE_V2HAmode + V2UHAmode, /* config/mips/mips-modes.def:42 */ +#define HAVE_V2UHAmode + V2SFmode, /* config/mips/mips-modes.def:25 */ +#define HAVE_V2SFmode + V4SFmode, /* config/mips/mips-modes.def:29 */ +#define HAVE_V4SFmode + V2DFmode, /* config/mips/mips-modes.def:29 */ +#define HAVE_V2DFmode + V8SFmode, /* config/mips/mips-modes.def:36 */ +#define HAVE_V8SFmode + V4DFmode, /* config/mips/mips-modes.def:37 */ +#define HAVE_V4DFmode + MAX_MACHINE_MODE, + + MIN_MODE_RANDOM = VOIDmode, + MAX_MODE_RANDOM = BLKmode, + + MIN_MODE_CC = CCmode, + MAX_MODE_CC = CCFmode, + + MIN_MODE_INT = QImode, + MAX_MODE_INT = TImode, + + MIN_MODE_PARTIAL_INT = VOIDmode, + MAX_MODE_PARTIAL_INT = VOIDmode, + + MIN_MODE_POINTER_BOUNDS = VOIDmode, + MAX_MODE_POINTER_BOUNDS = VOIDmode, + + MIN_MODE_FRACT = QQmode, + MAX_MODE_FRACT = TQmode, + + MIN_MODE_UFRACT = UQQmode, + MAX_MODE_UFRACT = UTQmode, + + MIN_MODE_ACCUM = HAmode, + MAX_MODE_ACCUM = TAmode, + + MIN_MODE_UACCUM = UHAmode, + MAX_MODE_UACCUM = UTAmode, + + MIN_MODE_FLOAT = SFmode, + MAX_MODE_FLOAT = TFmode, + + MIN_MODE_DECIMAL_FLOAT = SDmode, + MAX_MODE_DECIMAL_FLOAT = TDmode, + + MIN_MODE_COMPLEX_INT = CQImode, + MAX_MODE_COMPLEX_INT = CTImode, + + MIN_MODE_COMPLEX_FLOAT = SCmode, + MAX_MODE_COMPLEX_FLOAT = TCmode, + + MIN_MODE_VECTOR_INT = V4QImode, + MAX_MODE_VECTOR_INT = V4DImode, + + MIN_MODE_VECTOR_FRACT = V4QQmode, + MAX_MODE_VECTOR_FRACT = V2HQmode, + + MIN_MODE_VECTOR_UFRACT = V4UQQmode, + MAX_MODE_VECTOR_UFRACT = V2UHQmode, + + MIN_MODE_VECTOR_ACCUM = V2HAmode, + MAX_MODE_VECTOR_ACCUM = V2HAmode, + + MIN_MODE_VECTOR_UACCUM = V2UHAmode, + MAX_MODE_VECTOR_UACCUM = V2UHAmode, + + MIN_MODE_VECTOR_FLOAT = V2SFmode, + MAX_MODE_VECTOR_FLOAT = V4DFmode, + + NUM_MACHINE_MODES = MAX_MACHINE_MODE +}; + +#define CONST_MODE_SIZE +#define CONST_MODE_UNIT_SIZE +#define CONST_MODE_BASE_ALIGN +#define CONST_MODE_IBIT const +#define CONST_MODE_FBIT const + +#define BITS_PER_UNIT (8) +#define MAX_BITSIZE_MODE_ANY_INT (16*BITS_PER_UNIT) +#define MAX_BITSIZE_MODE_ANY_MODE (32*BITS_PER_UNIT) +#define NUM_INT_N_ENTS 1 + +#if !defined (USED_FOR_TARGET) && GCC_VERSION >= 4001 + +#ifdef __cplusplus +inline __attribute__((__always_inline__)) +#else +extern __inline__ __attribute__((__always_inline__, __gnu_inline__)) +#endif +unsigned short +mode_size_inline (machine_mode mode) +{ + extern unsigned short mode_size[NUM_MACHINE_MODES]; + gcc_assert (mode >= 0 && mode < NUM_MACHINE_MODES); + switch (mode) + { + case VOIDmode: return 0; + case BLKmode: return 0; + case CCmode: return 4; + case CCDSPmode: return 4; + case CCFmode: return 4; + case BImode: return 1; + case QImode: return 1; + case HImode: return 2; + case SImode: return 4; + case DImode: return 8; + case TImode: return 16; + case QQmode: return 1; + case HQmode: return 2; + case SQmode: return 4; + case DQmode: return 8; + case TQmode: return 16; + case UQQmode: return 1; + case UHQmode: return 2; + case USQmode: return 4; + case UDQmode: return 8; + case UTQmode: return 16; + case HAmode: return 2; + case SAmode: return 4; + case DAmode: return 8; + case TAmode: return 16; + case UHAmode: return 2; + case USAmode: return 4; + case UDAmode: return 8; + case UTAmode: return 16; + case SFmode: return 4; + case DFmode: return 8; + case TFmode: return 16; + case SDmode: return 4; + case DDmode: return 8; + case TDmode: return 16; + case CQImode: return 2; + case CHImode: return 4; + case CSImode: return 8; + case CDImode: return 16; + case CTImode: return 32; + case SCmode: return 8; + case DCmode: return 16; + case TCmode: return 32; + case V4QImode: return 4; + case V2HImode: return 4; + case V8QImode: return 8; + case V4HImode: return 8; + case V2SImode: return 8; + case V16QImode: return 16; + case V8HImode: return 16; + case V4SImode: return 16; + case V2DImode: return 16; + case V32QImode: return 32; + case V16HImode: return 32; + case V8SImode: return 32; + case V4DImode: return 32; + case V4QQmode: return 4; + case V2HQmode: return 4; + case V4UQQmode: return 4; + case V2UHQmode: return 4; + case V2HAmode: return 4; + case V2UHAmode: return 4; + case V2SFmode: return 8; + case V4SFmode: return 16; + case V2DFmode: return 16; + case V8SFmode: return 32; + case V4DFmode: return 32; + default: return mode_size[mode]; + } +} + +#ifdef __cplusplus +inline __attribute__((__always_inline__)) +#else +extern __inline__ __attribute__((__always_inline__, __gnu_inline__)) +#endif +unsigned char +mode_nunits_inline (machine_mode mode) +{ + extern const unsigned char mode_nunits[NUM_MACHINE_MODES]; + gcc_assert (mode >= 0 && mode < NUM_MACHINE_MODES); + switch (mode) + { + case VOIDmode: return 0; + case BLKmode: return 0; + case CCmode: return 1; + case CCV2mode: return 1; + case CCV4mode: return 1; + case CCDSPmode: return 1; + case CCFmode: return 1; + case BImode: return 1; + case QImode: return 1; + case HImode: return 1; + case SImode: return 1; + case DImode: return 1; + case TImode: return 1; + case QQmode: return 1; + case HQmode: return 1; + case SQmode: return 1; + case DQmode: return 1; + case TQmode: return 1; + case UQQmode: return 1; + case UHQmode: return 1; + case USQmode: return 1; + case UDQmode: return 1; + case UTQmode: return 1; + case HAmode: return 1; + case SAmode: return 1; + case DAmode: return 1; + case TAmode: return 1; + case UHAmode: return 1; + case USAmode: return 1; + case UDAmode: return 1; + case UTAmode: return 1; + case SFmode: return 1; + case DFmode: return 1; + case TFmode: return 1; + case SDmode: return 1; + case DDmode: return 1; + case TDmode: return 1; + case CQImode: return 2; + case CHImode: return 2; + case CSImode: return 2; + case CDImode: return 2; + case CTImode: return 2; + case SCmode: return 2; + case DCmode: return 2; + case TCmode: return 2; + case V4QImode: return 4; + case V2HImode: return 2; + case V8QImode: return 8; + case V4HImode: return 4; + case V2SImode: return 2; + case V16QImode: return 16; + case V8HImode: return 8; + case V4SImode: return 4; + case V2DImode: return 2; + case V32QImode: return 32; + case V16HImode: return 16; + case V8SImode: return 8; + case V4DImode: return 4; + case V4QQmode: return 4; + case V2HQmode: return 2; + case V4UQQmode: return 4; + case V2UHQmode: return 2; + case V2HAmode: return 2; + case V2UHAmode: return 2; + case V2SFmode: return 2; + case V4SFmode: return 4; + case V2DFmode: return 2; + case V8SFmode: return 8; + case V4DFmode: return 4; + default: return mode_nunits[mode]; + } +} + +#ifdef __cplusplus +inline __attribute__((__always_inline__)) +#else +extern __inline__ __attribute__((__always_inline__, __gnu_inline__)) +#endif +unsigned char +mode_inner_inline (machine_mode mode) +{ + extern const unsigned char mode_inner[NUM_MACHINE_MODES]; + gcc_assert (mode >= 0 && mode < NUM_MACHINE_MODES); + switch (mode) + { + case VOIDmode: return VOIDmode; + case BLKmode: return BLKmode; + case CCmode: return CCmode; + case CCV2mode: return CCV2mode; + case CCV4mode: return CCV4mode; + case CCDSPmode: return CCDSPmode; + case CCFmode: return CCFmode; + case BImode: return BImode; + case QImode: return QImode; + case HImode: return HImode; + case SImode: return SImode; + case DImode: return DImode; + case TImode: return TImode; + case QQmode: return QQmode; + case HQmode: return HQmode; + case SQmode: return SQmode; + case DQmode: return DQmode; + case TQmode: return TQmode; + case UQQmode: return UQQmode; + case UHQmode: return UHQmode; + case USQmode: return USQmode; + case UDQmode: return UDQmode; + case UTQmode: return UTQmode; + case HAmode: return HAmode; + case SAmode: return SAmode; + case DAmode: return DAmode; + case TAmode: return TAmode; + case UHAmode: return UHAmode; + case USAmode: return USAmode; + case UDAmode: return UDAmode; + case UTAmode: return UTAmode; + case SFmode: return SFmode; + case DFmode: return DFmode; + case TFmode: return TFmode; + case SDmode: return SDmode; + case DDmode: return DDmode; + case TDmode: return TDmode; + case CQImode: return QImode; + case CHImode: return HImode; + case CSImode: return SImode; + case CDImode: return DImode; + case CTImode: return TImode; + case SCmode: return SFmode; + case DCmode: return DFmode; + case TCmode: return TFmode; + case V4QImode: return QImode; + case V2HImode: return HImode; + case V8QImode: return QImode; + case V4HImode: return HImode; + case V2SImode: return SImode; + case V16QImode: return QImode; + case V8HImode: return HImode; + case V4SImode: return SImode; + case V2DImode: return DImode; + case V32QImode: return QImode; + case V16HImode: return HImode; + case V8SImode: return SImode; + case V4DImode: return DImode; + case V4QQmode: return QQmode; + case V2HQmode: return HQmode; + case V4UQQmode: return UQQmode; + case V2UHQmode: return UHQmode; + case V2HAmode: return HAmode; + case V2UHAmode: return UHAmode; + case V2SFmode: return SFmode; + case V4SFmode: return SFmode; + case V2DFmode: return DFmode; + case V8SFmode: return SFmode; + case V4DFmode: return DFmode; + default: return mode_inner[mode]; + } +} + +#ifdef __cplusplus +inline __attribute__((__always_inline__)) +#else +extern __inline__ __attribute__((__always_inline__, __gnu_inline__)) +#endif +unsigned char +mode_unit_size_inline (machine_mode mode) +{ + extern CONST_MODE_UNIT_SIZE unsigned char mode_unit_size[NUM_MACHINE_MODES]; + gcc_assert (mode >= 0 && mode < NUM_MACHINE_MODES); + switch (mode) + { + case VOIDmode: return 0; + case BLKmode: return 0; + case CCmode: return 4; + case CCDSPmode: return 4; + case CCFmode: return 4; + case BImode: return 1; + case QImode: return 1; + case HImode: return 2; + case SImode: return 4; + case DImode: return 8; + case TImode: return 16; + case QQmode: return 1; + case HQmode: return 2; + case SQmode: return 4; + case DQmode: return 8; + case TQmode: return 16; + case UQQmode: return 1; + case UHQmode: return 2; + case USQmode: return 4; + case UDQmode: return 8; + case UTQmode: return 16; + case HAmode: return 2; + case SAmode: return 4; + case DAmode: return 8; + case TAmode: return 16; + case UHAmode: return 2; + case USAmode: return 4; + case UDAmode: return 8; + case UTAmode: return 16; + case SFmode: return 4; + case DFmode: return 8; + case TFmode: return 16; + case SDmode: return 4; + case DDmode: return 8; + case TDmode: return 16; + case CQImode: return 1; + case CHImode: return 2; + case CSImode: return 4; + case CDImode: return 8; + case CTImode: return 16; + case SCmode: return 4; + case DCmode: return 8; + case TCmode: return 16; + case V4QImode: return 1; + case V2HImode: return 2; + case V8QImode: return 1; + case V4HImode: return 2; + case V2SImode: return 4; + case V16QImode: return 1; + case V8HImode: return 2; + case V4SImode: return 4; + case V2DImode: return 8; + case V32QImode: return 1; + case V16HImode: return 2; + case V8SImode: return 4; + case V4DImode: return 8; + case V4QQmode: return 1; + case V2HQmode: return 2; + case V4UQQmode: return 1; + case V2UHQmode: return 2; + case V2HAmode: return 2; + case V2UHAmode: return 2; + case V2SFmode: return 4; + case V4SFmode: return 4; + case V2DFmode: return 8; + case V8SFmode: return 4; + case V4DFmode: return 8; + default: return mode_unit_size[mode]; + } +} + +#ifdef __cplusplus +inline __attribute__((__always_inline__)) +#else +extern __inline__ __attribute__((__always_inline__, __gnu_inline__)) +#endif +unsigned short +mode_unit_precision_inline (machine_mode mode) +{ + extern const unsigned short mode_unit_precision[NUM_MACHINE_MODES]; + gcc_assert (mode >= 0 && mode < NUM_MACHINE_MODES); + switch (mode) + { + case VOIDmode: return 0; + case BLKmode: return 0; + case CCmode: return 4*BITS_PER_UNIT; + case CCV2mode: return 4*BITS_PER_UNIT; + case CCV4mode: return 4*BITS_PER_UNIT; + case CCDSPmode: return 4*BITS_PER_UNIT; + case CCFmode: return 4*BITS_PER_UNIT; + case BImode: return 1; + case QImode: return 1*BITS_PER_UNIT; + case HImode: return 2*BITS_PER_UNIT; + case SImode: return 4*BITS_PER_UNIT; + case DImode: return 8*BITS_PER_UNIT; + case TImode: return 16*BITS_PER_UNIT; + case QQmode: return 1*BITS_PER_UNIT; + case HQmode: return 2*BITS_PER_UNIT; + case SQmode: return 4*BITS_PER_UNIT; + case DQmode: return 8*BITS_PER_UNIT; + case TQmode: return 16*BITS_PER_UNIT; + case UQQmode: return 1*BITS_PER_UNIT; + case UHQmode: return 2*BITS_PER_UNIT; + case USQmode: return 4*BITS_PER_UNIT; + case UDQmode: return 8*BITS_PER_UNIT; + case UTQmode: return 16*BITS_PER_UNIT; + case HAmode: return 2*BITS_PER_UNIT; + case SAmode: return 4*BITS_PER_UNIT; + case DAmode: return 8*BITS_PER_UNIT; + case TAmode: return 16*BITS_PER_UNIT; + case UHAmode: return 2*BITS_PER_UNIT; + case USAmode: return 4*BITS_PER_UNIT; + case UDAmode: return 8*BITS_PER_UNIT; + case UTAmode: return 16*BITS_PER_UNIT; + case SFmode: return 4*BITS_PER_UNIT; + case DFmode: return 8*BITS_PER_UNIT; + case TFmode: return 16*BITS_PER_UNIT; + case SDmode: return 4*BITS_PER_UNIT; + case DDmode: return 8*BITS_PER_UNIT; + case TDmode: return 16*BITS_PER_UNIT; + case CQImode: return 1*BITS_PER_UNIT; + case CHImode: return 2*BITS_PER_UNIT; + case CSImode: return 4*BITS_PER_UNIT; + case CDImode: return 8*BITS_PER_UNIT; + case CTImode: return 16*BITS_PER_UNIT; + case SCmode: return 4*BITS_PER_UNIT; + case DCmode: return 8*BITS_PER_UNIT; + case TCmode: return 16*BITS_PER_UNIT; + case V4QImode: return 1*BITS_PER_UNIT; + case V2HImode: return 2*BITS_PER_UNIT; + case V8QImode: return 1*BITS_PER_UNIT; + case V4HImode: return 2*BITS_PER_UNIT; + case V2SImode: return 4*BITS_PER_UNIT; + case V16QImode: return 1*BITS_PER_UNIT; + case V8HImode: return 2*BITS_PER_UNIT; + case V4SImode: return 4*BITS_PER_UNIT; + case V2DImode: return 8*BITS_PER_UNIT; + case V32QImode: return 1*BITS_PER_UNIT; + case V16HImode: return 2*BITS_PER_UNIT; + case V8SImode: return 4*BITS_PER_UNIT; + case V4DImode: return 8*BITS_PER_UNIT; + case V4QQmode: return 1*BITS_PER_UNIT; + case V2HQmode: return 2*BITS_PER_UNIT; + case V4UQQmode: return 1*BITS_PER_UNIT; + case V2UHQmode: return 2*BITS_PER_UNIT; + case V2HAmode: return 2*BITS_PER_UNIT; + case V2UHAmode: return 2*BITS_PER_UNIT; + case V2SFmode: return 4*BITS_PER_UNIT; + case V4SFmode: return 4*BITS_PER_UNIT; + case V2DFmode: return 8*BITS_PER_UNIT; + case V8SFmode: return 4*BITS_PER_UNIT; + case V4DFmode: return 8*BITS_PER_UNIT; + default: return mode_unit_precision[mode]; + } +} + +#endif /* GCC_VERSION >= 4001 */ + +#endif /* insn-modes.h */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/internal-fn.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/internal-fn.h new file mode 100644 index 0000000..23ce08a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/internal-fn.h @@ -0,0 +1,183 @@ +/* Internal functions. + Copyright (C) 2011-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_INTERNAL_FN_H +#define GCC_INTERNAL_FN_H + +/* INTEGER_CST values for IFN_UNIQUE function arg-0. + + UNSPEC: Undifferentiated UNIQUE. + + FORK and JOIN mark the points at which OpenACC partitioned + execution is entered or exited. + DEP_VAR = UNIQUE ({FORK,JOIN}, DEP_VAR, AXIS) + + HEAD_MARK and TAIL_MARK are used to demark the sequence entering + or leaving partitioned execution. + DEP_VAR = UNIQUE ({HEAD,TAIL}_MARK, REMAINING_MARKS, ...PRIMARY_FLAGS) + + The PRIMARY_FLAGS only occur on the first HEAD_MARK of a sequence. */ +#define IFN_UNIQUE_CODES \ + DEF(UNSPEC), \ + DEF(OACC_FORK), DEF(OACC_JOIN), \ + DEF(OACC_HEAD_MARK), DEF(OACC_TAIL_MARK) + +enum ifn_unique_kind { +#define DEF(X) IFN_UNIQUE_##X + IFN_UNIQUE_CODES +#undef DEF +}; + +/* INTEGER_CST values for IFN_GOACC_LOOP arg-0. Allows the precise + stepping of the compute geometry over the loop iterations to be + deferred until it is known which compiler is generating the code. + The action is encoded in a constant first argument. + + CHUNK_MAX = LOOP (CODE_CHUNKS, DIR, RANGE, STEP, CHUNK_SIZE, MASK) + STEP = LOOP (CODE_STEP, DIR, RANGE, STEP, CHUNK_SIZE, MASK) + OFFSET = LOOP (CODE_OFFSET, DIR, RANGE, STEP, CHUNK_SIZE, MASK, CHUNK_NO) + BOUND = LOOP (CODE_BOUND, DIR, RANGE, STEP, CHUNK_SIZE, MASK, OFFSET) + + DIR - +1 for up loop, -1 for down loop + RANGE - Range of loop (END - BASE) + STEP - iteration step size + CHUNKING - size of chunking, (constant zero for no chunking) + CHUNK_NO - chunk number + MASK - partitioning mask. */ + +#define IFN_GOACC_LOOP_CODES \ + DEF(CHUNKS), DEF(STEP), DEF(OFFSET), DEF(BOUND) +enum ifn_goacc_loop_kind { +#define DEF(X) IFN_GOACC_LOOP_##X + IFN_GOACC_LOOP_CODES +#undef DEF +}; + +/* The GOACC_REDUCTION function defines a generic interface to support + gang, worker and vector reductions. All calls are of the following + form: + + V = REDUCTION (CODE, REF_TO_RES, LOCAL_VAR, LEVEL, OP, OFFSET) + + REF_TO_RES - is a reference to the original reduction varl, may be NULL + LOCAL_VAR is the intermediate reduction variable + LEVEL corresponds to the GOMP_DIM of the reduction + OP is the tree code of the reduction operation + OFFSET may be used as an offset into a reduction array for the + reductions occuring at this level. + In general the return value is LOCAL_VAR, which creates a data + dependency between calls operating on the same reduction. */ + +#define IFN_GOACC_REDUCTION_CODES \ + DEF(SETUP), DEF(INIT), DEF(FINI), DEF(TEARDOWN) +enum ifn_goacc_reduction_kind { +#define DEF(X) IFN_GOACC_REDUCTION_##X + IFN_GOACC_REDUCTION_CODES +#undef DEF +}; + +/* Initialize internal function tables. */ + +extern void init_internal_fns (); + +/* Return the name of internal function FN. The name is only meaningful + for dumps; it has no linkage. */ + +extern const char *const internal_fn_name_array[]; + +static inline const char * +internal_fn_name (enum internal_fn fn) +{ + return internal_fn_name_array[(int) fn]; +} + +/* Return the ECF_* flags for function FN. */ + +extern const int internal_fn_flags_array[]; + +static inline int +internal_fn_flags (enum internal_fn fn) +{ + return internal_fn_flags_array[(int) fn]; +} + +/* Return fnspec for function FN. */ + +extern GTY(()) const_tree internal_fn_fnspec_array[IFN_LAST + 1]; + +static inline const_tree +internal_fn_fnspec (enum internal_fn fn) +{ + return internal_fn_fnspec_array[(int) fn]; +} + +/* Describes an internal function that maps directly to an optab. */ +struct direct_internal_fn_info +{ + /* optabs can be parameterized by one or two modes. These fields describe + how to select those modes from the types of the return value and + arguments. A value of -1 says that the mode is determined by the + return type while a value N >= 0 says that the mode is determined by + the type of argument N. A value of -2 says that this internal + function isn't directly mapped to an optab. */ + signed int type0 : 8; + signed int type1 : 8; + /* True if the function is pointwise, so that it can be vectorized by + converting the return type and all argument types to vectors of the + same number of elements. E.g. we can vectorize an IFN_SQRT on + floats as an IFN_SQRT on vectors of N floats. + + This only needs 1 bit, but occupies the full 16 to ensure a nice + layout. */ + unsigned int vectorizable : 16; +}; + +extern const direct_internal_fn_info direct_internal_fn_array[IFN_LAST + 1]; + +/* Return true if FN is mapped directly to an optab. */ + +inline bool +direct_internal_fn_p (internal_fn fn) +{ + return direct_internal_fn_array[fn].type0 >= -1; +} + +/* Return optab information about internal function FN. Only meaningful + if direct_internal_fn_p (FN). */ + +inline const direct_internal_fn_info & +direct_internal_fn (internal_fn fn) +{ + gcc_checking_assert (direct_internal_fn_p (fn)); + return direct_internal_fn_array[fn]; +} + +extern tree_pair direct_internal_fn_types (internal_fn, tree, tree *); +extern tree_pair direct_internal_fn_types (internal_fn, gcall *); +extern bool direct_internal_fn_supported_p (internal_fn, tree_pair, + optimization_type); +extern bool direct_internal_fn_supported_p (internal_fn, tree, + optimization_type); +extern bool set_edom_supported_p (void); + +extern void expand_internal_call (gcall *); +extern void expand_internal_call (internal_fn, gcall *); +extern void expand_PHI (internal_fn, gcall *); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/intl.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/intl.h new file mode 100644 index 0000000..4e76826 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/intl.h @@ -0,0 +1,69 @@ +/* intl.h - internationalization + Copyright (C) 1998-2017 Free Software Foundation, Inc. + + GCC is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#ifndef GCC_INTL_H +#define GCC_INTL_H + +#ifdef HAVE_LOCALE_H +# include +#endif + +#ifndef HAVE_SETLOCALE +# define setlocale(category, locale) (locale) +#endif + +#ifdef ENABLE_NLS +#include +extern void gcc_init_libintl (void); +extern size_t gcc_gettext_width (const char *); +#else +/* Stubs. */ +# undef textdomain +# define textdomain(domain) (domain) +# undef bindtextdomain +# define bindtextdomain(domain, directory) (domain) +# undef gettext +# define gettext(msgid) (msgid) +# define ngettext(singular,plural,n) fake_ngettext (singular, plural, n) +# define gcc_init_libintl() /* nothing */ +# define gcc_gettext_width(s) strlen (s) + +extern const char *fake_ngettext (const char *singular, const char *plural, + unsigned long int n); + +#endif + +#ifndef _ +# define _(msgid) gettext (msgid) +#endif + +#ifndef N_ +# define N_(msgid) msgid +#endif + +#ifndef G_ +# define G_(gmsgid) gmsgid +#endif + +extern char *get_spaces (const char *); + +extern const char *open_quote; +extern const char *close_quote; +extern const char *locale_encoding; +extern bool locale_utf8; + +#endif /* intl.h */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-chkp.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-chkp.h new file mode 100644 index 0000000..454893d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-chkp.h @@ -0,0 +1,29 @@ +/* Declaration of interface functions of Pointer Bounds Checker. + Copyright (C) 2014-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_IPA_CHKP_H +#define GCC_IPA_CHKP_H + +extern tree chkp_copy_function_type_adding_bounds (tree orig_type); +extern tree chkp_maybe_clone_builtin_fndecl (tree fndecl); +extern cgraph_node *chkp_maybe_create_clone (tree fndecl); +extern bool chkp_instrumentable_p (tree fndecl); +extern bool chkp_wrap_function (tree fndecl); + +#endif /* GCC_IPA_CHKP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-icf-gimple.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-icf-gimple.h new file mode 100644 index 0000000..7e69024 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-icf-gimple.h @@ -0,0 +1,278 @@ +/* Interprocedural semantic function equality pass + Copyright (C) 2014-2017 Free Software Foundation, Inc. + + Contributed by Jan Hubicka and Martin Liska + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* Gimple identical code folding (class func_checker) is an infastructure + capable of comparing two given functions. The class compares every + gimple statement and uses many dictionaries to map source and target + SSA_NAMEs, declarations and other components. + + To use the infrastructure, create an instanse of func_checker and call + a comparsion function based on type of gimple statement. */ + +/* Prints string STRING to a FILE with a given number of SPACE_COUNT. */ +#define FPUTS_SPACES(file, space_count, string) \ + fprintf (file, "%*s" string, space_count, " "); + +/* fprintf function wrapper that transforms given FORMAT to follow given + number for SPACE_COUNT and call fprintf for a FILE. */ +#define FPRINTF_SPACES(file, space_count, format, ...) \ + fprintf (file, "%*s" format, space_count, " ", ##__VA_ARGS__); + +/* Prints a MESSAGE to dump_file if exists. FUNC is name of function and + LINE is location in the source file. */ + +static inline void +dump_message_1 (const char *message, const char *func, unsigned int line) +{ + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, " debug message: %s (%s:%u)\n", message, func, line); +} + +/* Prints a MESSAGE to dump_file if exists. */ +#define dump_message(message) dump_message_1 (message, __func__, __LINE__) + +/* Logs a MESSAGE to dump_file if exists and returns false. FUNC is name + of function and LINE is location in the source file. */ + +static inline bool +return_false_with_message_1 (const char *message, const char *func, + unsigned int line) +{ + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, " false returned: '%s' (%s:%u)\n", message, func, line); + return false; +} + +/* Logs a MESSAGE to dump_file if exists and returns false. */ +#define return_false_with_msg(message) \ + return_false_with_message_1 (message, __func__, __LINE__) + +/* Return false and log that false value is returned. */ +#define return_false() return_false_with_msg ("") + +/* Logs return value if RESULT is false. FUNC is name of function and LINE + is location in the source file. */ + +static inline bool +return_with_result (bool result, const char *func, unsigned int line) +{ + if (!result && dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, " false returned: (%s:%u)\n", func, line); + + return result; +} + +/* Logs return value if RESULT is false. */ +#define return_with_debug(result) return_with_result (result, __func__, __LINE__) + +/* Verbose logging function logging statements S1 and S2 of a CODE. + FUNC is name of function and LINE is location in the source file. */ + +static inline bool +return_different_stmts_1 (gimple *s1, gimple *s2, const char *code, + const char *func, unsigned int line) +{ + if (dump_file && (dump_flags & TDF_DETAILS)) + { + fprintf (dump_file, " different statement for code: %s (%s:%u):\n", + code, func, line); + + print_gimple_stmt (dump_file, s1, 3, TDF_DETAILS); + print_gimple_stmt (dump_file, s2, 3, TDF_DETAILS); + } + + return false; +} + +/* Verbose logging function logging statements S1 and S2 of a CODE. */ +#define return_different_stmts(s1, s2, code) \ + return_different_stmts_1 (s1, s2, code, __func__, __LINE__) + +namespace ipa_icf_gimple { + +/* Basic block struct for semantic equality pass. */ +class sem_bb +{ +public: + sem_bb (basic_block bb_, unsigned nondbg_stmt_count_, unsigned edge_count_): + bb (bb_), nondbg_stmt_count (nondbg_stmt_count_), edge_count (edge_count_) {} + + /* Basic block the structure belongs to. */ + basic_block bb; + + /* Number of non-debug statements in the basic block. */ + unsigned nondbg_stmt_count; + + /* Number of edges connected to the block. */ + unsigned edge_count; +}; + +/* A class aggregating all connections and semantic equivalents + for a given pair of semantic function candidates. */ +class func_checker +{ +public: + /* Initialize internal structures for a given SOURCE_FUNC_DECL and + TARGET_FUNC_DECL. Strict polymorphic comparison is processed if + an option COMPARE_POLYMORPHIC is true. For special cases, one can + set IGNORE_LABELS to skip label comparison. + Similarly, IGNORE_SOURCE_DECLS and IGNORE_TARGET_DECLS are sets + of declarations that can be skipped. */ + func_checker (tree source_func_decl, tree target_func_decl, + bool compare_polymorphic, + bool ignore_labels = false, + hash_set *ignored_source_nodes = NULL, + hash_set *ignored_target_nodes = NULL); + + /* Memory release routine. */ + ~func_checker(); + + /* Function visits all gimple labels and creates corresponding + mapping between basic blocks and labels. */ + void parse_labels (sem_bb *bb); + + /* Basic block equivalence comparison function that returns true if + basic blocks BB1 and BB2 correspond. */ + bool compare_bb (sem_bb *bb1, sem_bb *bb2); + + /* Verifies that trees T1 and T2 are equivalent from perspective of ICF. */ + bool compare_ssa_name (tree t1, tree t2); + + /* Verification function for edges E1 and E2. */ + bool compare_edge (edge e1, edge e2); + + /* Verifies for given GIMPLEs S1 and S2 that + call statements are semantically equivalent. */ + bool compare_gimple_call (gcall *s1, gcall *s2); + + /* Verifies for given GIMPLEs S1 and S2 that + assignment statements are semantically equivalent. */ + bool compare_gimple_assign (gimple *s1, gimple *s2); + + /* Verifies for given GIMPLEs S1 and S2 that + condition statements are semantically equivalent. */ + bool compare_gimple_cond (gimple *s1, gimple *s2); + + /* Verifies for given GIMPLE_LABEL stmts S1 and S2 that + label statements are semantically equivalent. */ + bool compare_gimple_label (const glabel *s1, const glabel *s2); + + /* Verifies for given GIMPLE_SWITCH stmts S1 and S2 that + switch statements are semantically equivalent. */ + bool compare_gimple_switch (const gswitch *s1, const gswitch *s2); + + /* Verifies for given GIMPLE_RETURN stmts S1 and S2 that + return statements are semantically equivalent. */ + bool compare_gimple_return (const greturn *s1, const greturn *s2); + + /* Verifies for given GIMPLEs S1 and S2 that + goto statements are semantically equivalent. */ + bool compare_gimple_goto (gimple *s1, gimple *s2); + + /* Verifies for given GIMPLE_RESX stmts S1 and S2 that + resx statements are semantically equivalent. */ + bool compare_gimple_resx (const gresx *s1, const gresx *s2); + + /* Verifies for given GIMPLE_ASM stmts S1 and S2 that ASM statements + are equivalent. + For the beginning, the pass only supports equality for + '__asm__ __volatile__ ("", "", "", "memory")'. */ + bool compare_gimple_asm (const gasm *s1, const gasm *s2); + + /* Verification function for declaration trees T1 and T2. */ + bool compare_decl (tree t1, tree t2); + + /* Verifies that tree labels T1 and T2 correspond. */ + bool compare_tree_ssa_label (tree t1, tree t2); + + /* Function compare for equality given memory operands T1 and T2. */ + bool compare_memory_operand (tree t1, tree t2); + + /* Function compare for equality given trees T1 and T2 which + can be either a constant or a declaration type. */ + bool compare_cst_or_decl (tree t1, tree t2); + + /* Function responsible for comparison of various operands T1 and T2. + If these components, from functions FUNC1 and FUNC2, are equal, true + is returned. */ + bool compare_operand (tree t1, tree t2); + + /* Compares GIMPLE ASM inputs (or outputs) where we iterate tree chain + and compare both TREE_PURPOSEs and TREE_VALUEs. */ + bool compare_asm_inputs_outputs (tree t1, tree t2); + + /* Verifies that trees T1 and T2, representing function declarations + are equivalent from perspective of ICF. */ + bool compare_function_decl (tree t1, tree t2); + + /* Verifies that trees T1 and T2 do correspond. */ + bool compare_variable_decl (tree t1, tree t2); + + /* Return true if types are compatible for polymorphic call analysis. + COMPARE_PTR indicates if polymorphic type comparsion should be + done for pointers, too. */ + static bool compatible_polymorphic_types_p (tree t1, tree t2, + bool compare_ptr); + + /* Return true if types are compatible from perspective of ICF. + FIRST_ARGUMENT indicates if the comparison is called for + first parameter of a function. */ + static bool compatible_types_p (tree t1, tree t2); + + +private: + /* Vector mapping source SSA names to target ones. */ + vec m_source_ssa_names; + + /* Vector mapping target SSA names to source ones. */ + vec m_target_ssa_names; + + /* Source TREE function declaration. */ + tree m_source_func_decl; + + /* Target TREE function declaration. */ + tree m_target_func_decl; + + /* Source symbol nodes that should be skipped by + declaration comparison. */ + hash_set *m_ignored_source_nodes; + + /* Target symbol nodes that should be skipped by + declaration comparison. */ + hash_set *m_ignored_target_nodes; + + /* Source to target edge map. */ + hash_map m_edge_map; + + /* Source to target declaration map. */ + hash_map m_decl_map; + + /* Label to basic block index mapping. */ + hash_map m_label_bb_map; + + /* Flag if polymorphic comparison should be executed. */ + bool m_compare_polymorphic; + + /* Flag if ignore labels in comparison. */ + bool m_ignore_labels; +}; + +} // ipa_icf_gimple namespace diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-icf.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-icf.h new file mode 100644 index 0000000..c57224c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-icf.h @@ -0,0 +1,637 @@ +/* Interprocedural semantic function equality pass + Copyright (C) 2014-2017 Free Software Foundation, Inc. + + Contributed by Jan Hubicka and Martin Liska + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +namespace ipa_icf { +class sem_item; + +/* Congruence class encompasses a collection of either functions or + read-only variables. These items are considered to be equivalent + if not proved the oposite. */ +class congruence_class +{ +public: + /* Congruence class constructor for a new class with _ID. */ + congruence_class (unsigned int _id): in_worklist (false), id(_id) + { + } + + /* Destructor. */ + ~congruence_class () + { + } + + /* Dump function prints all class members to a FILE with an INDENT. */ + void dump (FILE *file, unsigned int indent = 0) const; + + /* Returns true if there's a member that is used from another group. */ + bool is_class_used (void); + + /* Flag is used in case we want to remove a class from worklist and + delete operation is quite expensive for + the data structure (linked list). */ + bool in_worklist; + + /* Vector of all group members. */ + auto_vec members; + + /* Global unique class identifier. */ + unsigned int id; +}; + +/* Semantic item type enum. */ +enum sem_item_type +{ + FUNC, + VAR +}; + +/* Class is container for address references for a symtab_node. */ + +class symbol_compare_collection +{ +public: + /* Constructor. */ + symbol_compare_collection (symtab_node *node); + + /* Destructor. */ + ~symbol_compare_collection () + { + m_references.release (); + m_interposables.release (); + } + + /* Vector of address references. */ + vec m_references; + + /* Vector of interposable references. */ + vec m_interposables; +}; + +/* Hash traits for symbol_compare_collection map. */ + +struct symbol_compare_hash : nofree_ptr_hash +{ + static hashval_t + hash (value_type v) + { + inchash::hash hstate; + hstate.add_int (v->m_references.length ()); + + for (unsigned i = 0; i < v->m_references.length (); i++) + hstate.add_int (v->m_references[i]->ultimate_alias_target ()->order); + + hstate.add_int (v->m_interposables.length ()); + + for (unsigned i = 0; i < v->m_interposables.length (); i++) + hstate.add_int (v->m_interposables[i]->ultimate_alias_target ()->order); + + return hstate.end (); + } + + static bool + equal (value_type a, value_type b) + { + if (a->m_references.length () != b->m_references.length () + || a->m_interposables.length () != b->m_interposables.length ()) + return false; + + for (unsigned i = 0; i < a->m_references.length (); i++) + if (a->m_references[i]->equal_address_to (b->m_references[i]) != 1) + return false; + + for (unsigned i = 0; i < a->m_interposables.length (); i++) + if (!a->m_interposables[i]->semantically_equivalent_p + (b->m_interposables[i])) + return false; + + return true; + } +}; + + +/* Semantic item usage pair. */ +class sem_usage_pair +{ +public: + /* Constructor for key value pair, where _ITEM is key and _INDEX is a target. */ + sem_usage_pair (sem_item *_item, unsigned int _index); + + /* Target semantic item where an item is used. */ + sem_item *item; + + /* Index of usage of such an item. */ + unsigned int index; +}; + +/* Semantic item is a base class that encapsulates all shared functionality + for both semantic function and variable items. */ +class sem_item +{ +public: + /* Semantic item constructor for a node of _TYPE, where STACK is used + for bitmap memory allocation. */ + sem_item (sem_item_type _type, bitmap_obstack *stack); + + /* Semantic item constructor for a node of _TYPE, where STACK is used + for bitmap memory allocation. The item is based on symtab node _NODE. */ + sem_item (sem_item_type _type, symtab_node *_node, bitmap_obstack *stack); + + virtual ~sem_item (); + + /* Dump function for debugging purpose. */ + DEBUG_FUNCTION void dump (void); + + /* Initialize semantic item by info reachable during LTO WPA phase. */ + virtual void init_wpa (void) = 0; + + /* Semantic item initialization function. */ + virtual void init (void) = 0; + + /* Add reference to a semantic TARGET. */ + void add_reference (sem_item *target); + + /* Fast equality function based on knowledge known in WPA. */ + virtual bool equals_wpa (sem_item *item, + hash_map &ignored_nodes) = 0; + + /* Returns true if the item equals to ITEM given as arguemnt. */ + virtual bool equals (sem_item *item, + hash_map &ignored_nodes) = 0; + + /* References independent hash function. */ + virtual hashval_t get_hash (void) = 0; + + /* Set new hash value of the item. */ + void set_hash (hashval_t hash); + + /* Merges instance with an ALIAS_ITEM, where alias, thunk or redirection can + be applied. */ + virtual bool merge (sem_item *alias_item) = 0; + + /* Dump symbol to FILE. */ + virtual void dump_to_file (FILE *file) = 0; + + /* Update hash by address sensitive references. */ + void update_hash_by_addr_refs (hash_map &m_symtab_node_map); + + /* Update hash by computed local hash values taken from different + semantic items. */ + void update_hash_by_local_refs (hash_map &m_symtab_node_map); + + /* Return base tree that can be used for compatible_types_p and + contains_polymorphic_type_p comparison. */ + static bool get_base_types (tree *t1, tree *t2); + + /* Return true if target supports alias symbols. */ + bool target_supports_symbol_aliases_p (void); + + /* Item type. */ + sem_item_type type; + + /* Symtab node. */ + symtab_node *node; + + /* Declaration tree node. */ + tree decl; + + /* Semantic references used that generate congruence groups. */ + vec refs; + + /* Pointer to a congruence class the item belongs to. */ + congruence_class *cls; + + /* Index of the item in a class belonging to. */ + unsigned int index_in_class; + + /* List of semantic items where the instance is used. */ + vec usages; + + /* A bitmap with indices of all classes referencing this item. */ + bitmap usage_index_bitmap; + + /* List of tree references (either FUNC_DECL or VAR_DECL). */ + vec tree_refs; + + /* A set with symbol table references. */ + hash_set refs_set; + + /* Temporary hash used where hash values of references are added. */ + hashval_t global_hash; +protected: + /* Cached, once calculated hash for the item. */ + + /* Accumulate to HSTATE a hash of expression EXP. */ + static void add_expr (const_tree exp, inchash::hash &hstate); + /* Accumulate to HSTATE a hash of type T. */ + static void add_type (const_tree t, inchash::hash &hstate); + + /* Compare properties of symbol that does not affect semantics of symbol + itself but affects semantics of its references. + If ADDRESS is true, do extra checking needed for IPA_REF_ADDR. */ + static bool compare_referenced_symbol_properties (symtab_node *used_by, + symtab_node *n1, + symtab_node *n2, + bool address); + + /* Compare two attribute lists. */ + static bool compare_attributes (const_tree list1, const_tree list2); + + /* Hash properties compared by compare_referenced_symbol_properties. */ + void hash_referenced_symbol_properties (symtab_node *ref, + inchash::hash &hstate, + bool address); + + /* For a given symbol table nodes N1 and N2, we check that FUNCTION_DECLs + point to a same function. Comparison can be skipped if IGNORED_NODES + contains these nodes. ADDRESS indicate if address is taken. */ + bool compare_symbol_references (hash_map + &ignored_nodes, + symtab_node *n1, symtab_node *n2, + bool address); +protected: + /* Hash of item. */ + hashval_t m_hash; + + /* Indicated whether a hash value has been set or not. */ + bool m_hash_set; + +private: + /* Initialize internal data structures. Bitmap STACK is used for + bitmap memory allocation process. */ + void setup (bitmap_obstack *stack); +}; // class sem_item + +class sem_function: public sem_item +{ +public: + /* Semantic function constructor that uses STACK as bitmap memory stack. */ + sem_function (bitmap_obstack *stack); + + /* Constructor based on callgraph node _NODE. + Bitmap STACK is used for memory allocation. */ + sem_function (cgraph_node *_node, bitmap_obstack *stack); + + ~sem_function (); + + inline virtual void init_wpa (void) + { + } + + virtual void init (void); + virtual bool equals_wpa (sem_item *item, + hash_map &ignored_nodes); + virtual hashval_t get_hash (void); + virtual bool equals (sem_item *item, + hash_map &ignored_nodes); + virtual bool merge (sem_item *alias_item); + + /* Dump symbol to FILE. */ + virtual void dump_to_file (FILE *file) + { + gcc_assert (file); + dump_function_to_file (decl, file, TDF_DETAILS); + } + + /* Returns cgraph_node. */ + inline cgraph_node *get_node (void) + { + return dyn_cast (node); + } + + /* Improve accumulated hash for HSTATE based on a gimple statement STMT. */ + void hash_stmt (gimple *stmt, inchash::hash &inchash); + + /* Return true if polymorphic comparison must be processed. */ + bool compare_polymorphic_p (void); + + /* For a given call graph NODE, the function constructs new + semantic function item. */ + static sem_function *parse (cgraph_node *node, bitmap_obstack *stack); + + /* Perform additional checks needed to match types of used function + paramters. */ + bool compatible_parm_types_p (tree, tree); + + /* Exception handling region tree. */ + eh_region region_tree; + + /* Number of function arguments. */ + unsigned int arg_count; + + /* Total amount of edges in the function. */ + unsigned int edge_count; + + /* Vector of sizes of all basic blocks. */ + vec bb_sizes; + + /* Control flow graph checksum. */ + hashval_t cfg_checksum; + + /* GIMPLE codes hash value. */ + hashval_t gcode_hash; + + /* Total number of SSA names used in the function. */ + unsigned ssa_names_size; + + /* Array of structures for all basic blocks. */ + vec bb_sorted; + + /* Return true if parameter I may be used. */ + bool param_used_p (unsigned int i); + +private: + /* Calculates hash value based on a BASIC_BLOCK. */ + hashval_t get_bb_hash (const ipa_icf_gimple::sem_bb *basic_block); + + /* For given basic blocks BB1 and BB2 (from functions FUNC1 and FUNC), + true value is returned if phi nodes are semantically + equivalent in these blocks . */ + bool compare_phi_node (basic_block bb1, basic_block bb2); + + /* Basic blocks dictionary BB_DICT returns true if SOURCE index BB + corresponds to TARGET. */ + bool bb_dict_test (vec *bb_dict, int source, int target); + + /* If cgraph edges E1 and E2 are indirect calls, verify that + ICF flags are the same. */ + bool compare_edge_flags (cgraph_edge *e1, cgraph_edge *e2); + + /* Processes function equality comparison. */ + bool equals_private (sem_item *item); + + /* Returns true if tree T can be compared as a handled component. */ + static bool icf_handled_component_p (tree t); + + /* Function checker stores binding between functions. */ + ipa_icf_gimple::func_checker *m_checker; + + /* COMPARED_FUNC is a function that we compare to. */ + sem_function *m_compared_func; +}; // class sem_function + +class sem_variable: public sem_item +{ +public: + /* Semantic variable constructor that uses STACK as bitmap memory stack. */ + sem_variable (bitmap_obstack *stack); + + /* Constructor based on callgraph node _NODE. + Bitmap STACK is used for memory allocation. */ + + sem_variable (varpool_node *_node, bitmap_obstack *stack); + + inline virtual void init_wpa (void) {} + + /* Semantic variable initialization function. */ + inline virtual void init (void) + { + decl = get_node ()->decl; + } + + virtual hashval_t get_hash (void); + virtual bool merge (sem_item *alias_item); + virtual void dump_to_file (FILE *file); + virtual bool equals (sem_item *item, + hash_map &ignored_nodes); + + /* Fast equality variable based on knowledge known in WPA. */ + virtual bool equals_wpa (sem_item *item, + hash_map &ignored_nodes); + + /* Returns varpool_node. */ + inline varpool_node *get_node (void) + { + return dyn_cast (node); + } + + /* Parser function that visits a varpool NODE. */ + static sem_variable *parse (varpool_node *node, bitmap_obstack *stack); + +private: + /* Compares trees T1 and T2 for semantic equality. */ + static bool equals (tree t1, tree t2); +}; // class sem_variable + +class sem_item_optimizer; + +struct congruence_class_group +{ + hashval_t hash; + sem_item_type type; + vec classes; +}; + +/* Congruence class set structure. */ +struct congruence_class_hash : nofree_ptr_hash +{ + static inline hashval_t hash (const congruence_class_group *item) + { + return item->hash; + } + + static inline int equal (const congruence_class_group *item1, + const congruence_class_group *item2) + { + return item1->hash == item2->hash && item1->type == item2->type; + } +}; + +struct traverse_split_pair +{ + sem_item_optimizer *optimizer; + class congruence_class *cls; +}; + +/* Semantic item optimizer includes all top-level logic + related to semantic equality comparison. */ +class sem_item_optimizer +{ +public: + sem_item_optimizer (); + ~sem_item_optimizer (); + + /* Function responsible for visiting all potential functions and + read-only variables that can be merged. */ + void parse_funcs_and_vars (void); + + /* Optimizer entry point which returns true in case it processes + a merge operation. True is returned if there's a merge operation + processed. */ + bool execute (void); + + /* Dump function. */ + void dump (void); + + /* Verify congruence classes if checking is enabled. */ + void checking_verify_classes (void); + + /* Verify congruence classes. */ + void verify_classes (void); + + /* Write IPA ICF summary for symbols. */ + void write_summary (void); + + /* Read IPA ICF summary for symbols. */ + void read_summary (void); + + /* Callgraph removal hook called for a NODE with a custom DATA. */ + static void cgraph_removal_hook (cgraph_node *node, void *data); + + /* Varpool removal hook called for a NODE with a custom DATA. */ + static void varpool_removal_hook (varpool_node *node, void *data); + + /* Worklist of congruence classes that can potentially + refine classes of congruence. */ + std::list worklist; + + /* Remove semantic ITEM and release memory. */ + void remove_item (sem_item *item); + + /* Remove symtab NODE triggered by symtab removal hooks. */ + void remove_symtab_node (symtab_node *node); + + /* Register callgraph and varpool hooks. */ + void register_hooks (void); + + /* Unregister callgraph and varpool hooks. */ + void unregister_hooks (void); + + /* Adds a CLS to hashtable associated by hash value. */ + void add_class (congruence_class *cls); + + /* Gets a congruence class group based on given HASH value and TYPE. */ + congruence_class_group *get_group_by_hash (hashval_t hash, + sem_item_type type); + + /* Because types can be arbitrarily large, avoid quadratic bottleneck. */ + hash_map m_type_hash_cache; +private: + + /* For each semantic item, append hash values of references. */ + void update_hash_by_addr_refs (); + + /* Congruence classes are built by hash value. */ + void build_hash_based_classes (void); + + /* Semantic items in classes having more than one element and initialized. + In case of WPA, we load function body. */ + void parse_nonsingleton_classes (void); + + /* Equality function for semantic items is used to subdivide existing + classes. If IN_WPA, fast equality function is invoked. */ + void subdivide_classes_by_equality (bool in_wpa = false); + + /* Subdivide classes by address and interposable references + that members of the class reference. + Example can be a pair of functions that have an address + taken from a function. If these addresses are different the class + is split. */ + unsigned subdivide_classes_by_sensitive_refs(); + + /* Debug function prints all informations about congruence classes. */ + void dump_cong_classes (void); + + /* Build references according to call graph. */ + void build_graph (void); + + /* Iterative congruence reduction function. */ + void process_cong_reduction (void); + + /* After reduction is done, we can declare all items in a group + to be equal. PREV_CLASS_COUNT is start number of classes + before reduction. True is returned if there's a merge operation + processed. */ + bool merge_classes (unsigned int prev_class_count); + + /* Adds a newly created congruence class CLS to worklist. */ + void worklist_push (congruence_class *cls); + + /* Pops a class from worklist. */ + congruence_class *worklist_pop (); + + /* Every usage of a congruence class CLS is a candidate that can split the + collection of classes. Bitmap stack BMSTACK is used for bitmap + allocation. */ + void do_congruence_step (congruence_class *cls); + + /* Tests if a class CLS used as INDEXth splits any congruence classes. + Bitmap stack BMSTACK is used for bitmap allocation. */ + void do_congruence_step_for_index (congruence_class *cls, unsigned int index); + + /* Makes pairing between a congruence class CLS and semantic ITEM. */ + static void add_item_to_class (congruence_class *cls, sem_item *item); + + /* Disposes split map traverse function. CLS is congruence + class, BSLOT is bitmap slot we want to release. DATA is mandatory, + but unused argument. */ + static bool release_split_map (congruence_class * const &cls, bitmap const &b, + traverse_split_pair *pair); + + /* Process split operation for a cognruence class CLS, + where bitmap B splits congruence class members. DATA is used + as argument of split pair. */ + static bool traverse_congruence_split (congruence_class * const &cls, + bitmap const &b, + traverse_split_pair *pair); + + /* Reads a section from LTO stream file FILE_DATA. Input block for DATA + contains LEN bytes. */ + void read_section (lto_file_decl_data *file_data, const char *data, + size_t len); + + /* Removes all callgraph and varpool nodes that are marked by symtab + as deleted. */ + void filter_removed_items (void); + + /* Vector of semantic items. */ + vec m_items; + + /* A set containing all items removed by hooks. */ + hash_set m_removed_items_set; + + /* Hashtable of congruence classes. */ + hash_table m_classes; + + /* Count of congruence classes. */ + unsigned int m_classes_count; + + /* Map data structure maps symtab nodes to semantic items. */ + hash_map m_symtab_node_map; + + /* Set to true if a splitter class is removed. */ + bool splitter_class_removed; + + /* Global unique class id counter. */ + static unsigned int class_id; + + /* Callgraph node removal hook holder. */ + cgraph_node_hook_list *m_cgraph_node_hooks; + + /* Varpool node removal hook holder. */ + varpool_node_hook_list *m_varpool_node_hooks; + + /* Bitmap stack. */ + bitmap_obstack m_bmstack; +}; // class sem_item_optimizer + +} // ipa_icf namespace diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-inline.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-inline.h new file mode 100644 index 0000000..0010530 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-inline.h @@ -0,0 +1,351 @@ +/* Inlining decision heuristics. + Copyright (C) 2003-2017 Free Software Foundation, Inc. + Contributed by Jan Hubicka + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_IPA_INLINE_H +#define GCC_IPA_INLINE_H + + +/* Representation of inline parameters that do depend on context function is + inlined into (i.e. known constant values of function parameters. + + Conditions that are interesting for function body are collected into CONDS + vector. They are of simple for function_param OP VAL, where VAL is + IPA invariant. The conditions are then referred by predicates. */ + +struct GTY(()) condition +{ + /* If agg_contents is set, this is the offset from which the used data was + loaded. */ + HOST_WIDE_INT offset; + /* Size of the access reading the data (or the PARM_DECL SSA_NAME). */ + HOST_WIDE_INT size; + tree val; + int operand_num; + ENUM_BITFIELD(tree_code) code : 16; + /* Set if the used data were loaded from an aggregate parameter or from + data received by reference. */ + unsigned agg_contents : 1; + /* If agg_contents is set, this differentiates between loads from data + passed by reference and by value. */ + unsigned by_ref : 1; +}; + +/* Inline hints are reasons why inline heuristics should preffer inlining given + function. They are represtented as bitmap of the following values. */ +enum inline_hints_vals { + /* When inlining turns indirect call into a direct call, + it is good idea to do so. */ + INLINE_HINT_indirect_call = 1, + /* Inlining may make loop iterations or loop stride known. It is good idea + to do so because it enables loop optimizatoins. */ + INLINE_HINT_loop_iterations = 2, + INLINE_HINT_loop_stride = 4, + /* Inlining within same strongly connected component of callgraph is often + a loss due to increased stack frame usage and prologue setup costs. */ + INLINE_HINT_same_scc = 8, + /* Inlining functions in strongly connected component is not such a great + win. */ + INLINE_HINT_in_scc = 16, + /* If function is declared inline by user, it may be good idea to inline + it. */ + INLINE_HINT_declared_inline = 32, + /* Programs are usually still organized for non-LTO compilation and thus + if functions are in different modules, inlining may not be so important. + */ + INLINE_HINT_cross_module = 64, + /* If array indexes of loads/stores become known there may be room for + further optimization. */ + INLINE_HINT_array_index = 128, + /* We know that the callee is hot by profile. */ + INLINE_HINT_known_hot = 256 +}; +typedef int inline_hints; + + +typedef vec *conditions; + +/* Representation of predicates i.e. formulas using conditions defined + above. Predicates are simple logical formulas in conjunctive-disjunctive + form. + + Predicate is array of clauses terminated by 0. Every clause must be true + in order to make predicate true. + Clauses are represented as bitmaps of conditions. One of conditions + must be true in order for clause to be true. */ + +#define MAX_CLAUSES 8 +typedef unsigned int clause_t; +struct GTY(()) predicate +{ + clause_t clause[MAX_CLAUSES + 1]; +}; + +/* Represnetation of function body size and time depending on the inline + context. We keep simple array of record, every containing of predicate + and time/size to account. + + We keep values scaled up, so fractional sizes and times can be + accounted. */ +#define INLINE_SIZE_SCALE 2 +#define INLINE_TIME_SCALE (CGRAPH_FREQ_BASE * 2) +struct GTY(()) size_time_entry +{ + struct predicate predicate; + int size; + int time; +}; + +/* Function inlining information. */ +struct GTY(()) inline_summary +{ + /* Information about the function body itself. */ + + /* Estimated stack frame consumption by the function. */ + HOST_WIDE_INT estimated_self_stack_size; + /* Size of the function body. */ + int self_size; + /* Time of the function body. */ + int self_time; + /* Minimal size increase after inlining. */ + int min_size; + + /* False when there something makes inlining impossible (such as va_arg). */ + unsigned inlinable : 1; + /* True when function contains cilk spawn (and thus we can not inline + into it). */ + unsigned contains_cilk_spawn : 1; + /* True wen there is only one caller of the function before small function + inlining. */ + unsigned int single_caller : 1; + /* True if function contains any floating point expressions. */ + unsigned int fp_expressions : 1; + + /* Information about function that will result after applying all the + inline decisions present in the callgraph. Generally kept up to + date only for functions that are not inline clones. */ + + /* Estimated stack frame consumption by the function. */ + HOST_WIDE_INT estimated_stack_size; + /* Expected offset of the stack frame of inlined function. */ + HOST_WIDE_INT stack_frame_offset; + /* Estimated size of the function after inlining. */ + int time; + int size; + + /* Conditional size/time information. The summaries are being + merged during inlining. */ + conditions conds; + vec *entry; + + /* Predicate on when some loop in the function becomes to have known + bounds. */ + struct predicate * GTY((skip)) loop_iterations; + /* Predicate on when some loop in the function becomes to have known + stride. */ + struct predicate * GTY((skip)) loop_stride; + /* Predicate on when some array indexes become constants. */ + struct predicate * GTY((skip)) array_index; + /* Estimated growth for inlining all copies of the function before start + of small functions inlining. + This value will get out of date as the callers are duplicated, but + using up-to-date value in the badness metric mean a lot of extra + expenses. */ + int growth; + /* Number of SCC on the beginning of inlining process. */ + int scc_no; +}; + +class GTY((user)) inline_summary_t: public function_summary +{ +public: + inline_summary_t (symbol_table *symtab, bool ggc): + function_summary (symtab, ggc) {} + + static inline_summary_t *create_ggc (symbol_table *symtab) + { + struct inline_summary_t *summary = new (ggc_cleared_alloc ()) + inline_summary_t(symtab, true); + summary->disable_insertion_hook (); + return summary; + } + + + virtual void insert (cgraph_node *, inline_summary *); + virtual void remove (cgraph_node *node, inline_summary *); + virtual void duplicate (cgraph_node *src, cgraph_node *dst, + inline_summary *src_data, inline_summary *dst_data); +}; + +extern GTY(()) function_summary *inline_summaries; + +/* Information kept about parameter of call site. */ +struct inline_param_summary +{ + /* REG_BR_PROB_BASE based probability that parameter will change in between + two invocation of the calls. + I.e. loop invariant parameters + REG_BR_PROB_BASE/estimated_iterations and regular + parameters REG_BR_PROB_BASE. + + Value 0 is reserved for compile time invariants. */ + int change_prob; +}; + +/* Information kept about callgraph edges. */ +struct inline_edge_summary +{ + /* Estimated size and time of the call statement. */ + int call_stmt_size; + int call_stmt_time; + /* Depth of loop nest, 0 means no nesting. */ + unsigned short int loop_depth; + struct predicate *predicate; + /* Array indexed by parameters. + 0 means that parameter change all the time, REG_BR_PROB_BASE means + that parameter is constant. */ + vec param; +}; + +/* Need a typedef for inline_edge_summary because of inline function + 'inline_edge_summary' below. */ +typedef struct inline_edge_summary inline_edge_summary_t; +extern vec inline_edge_summary_vec; + +struct edge_growth_cache_entry +{ + int time, size; + inline_hints hints; +}; + +extern vec edge_growth_cache; + +/* In ipa-inline-analysis.c */ +void debug_inline_summary (struct cgraph_node *); +void dump_inline_summaries (FILE *f); +void dump_inline_summary (FILE *f, struct cgraph_node *node); +void dump_inline_hints (FILE *f, inline_hints); +void inline_generate_summary (void); +void inline_read_summary (void); +void inline_write_summary (void); +void inline_free_summary (void); +void inline_analyze_function (struct cgraph_node *node); +void initialize_inline_failed (struct cgraph_edge *); +int estimate_time_after_inlining (struct cgraph_node *, struct cgraph_edge *); +int estimate_size_after_inlining (struct cgraph_node *, struct cgraph_edge *); +void estimate_ipcp_clone_size_and_time (struct cgraph_node *, + vec, + vec, + vec, + int *, int *, inline_hints *); +int estimate_growth (struct cgraph_node *); +bool growth_likely_positive (struct cgraph_node *, int); +void inline_merge_summary (struct cgraph_edge *edge); +void inline_update_overall_summary (struct cgraph_node *node); +int do_estimate_edge_size (struct cgraph_edge *edge); +int do_estimate_edge_time (struct cgraph_edge *edge); +inline_hints do_estimate_edge_hints (struct cgraph_edge *edge); +void initialize_growth_caches (void); +void free_growth_caches (void); +void compute_inline_parameters (struct cgraph_node *, bool); +bool speculation_useful_p (struct cgraph_edge *e, bool anticipate_inlining); +unsigned int early_inliner (function *fun); +bool inline_account_function_p (struct cgraph_node *node); + + +/* In ipa-inline-transform.c */ +bool inline_call (struct cgraph_edge *, bool, vec *, int *, bool, + bool *callee_removed = NULL); +unsigned int inline_transform (struct cgraph_node *); +void clone_inlined_nodes (struct cgraph_edge *e, bool, bool, int *, + int freq_scale); + +extern int ncalls_inlined; +extern int nfunctions_inlined; + +static inline struct inline_edge_summary * +inline_edge_summary (struct cgraph_edge *edge) +{ + return &inline_edge_summary_vec[edge->uid]; +} + + +/* Return estimated size of the inline sequence of EDGE. */ + +static inline int +estimate_edge_size (struct cgraph_edge *edge) +{ + int ret; + if ((int)edge_growth_cache.length () <= edge->uid + || !(ret = edge_growth_cache[edge->uid].size)) + return do_estimate_edge_size (edge); + return ret - (ret > 0); +} + +/* Return estimated callee growth after inlining EDGE. */ + +static inline int +estimate_edge_growth (struct cgraph_edge *edge) +{ + gcc_checking_assert (inline_edge_summary (edge)->call_stmt_size + || !edge->callee->analyzed); + return (estimate_edge_size (edge) + - inline_edge_summary (edge)->call_stmt_size); +} + +/* Return estimated callee runtime increase after inlining + EDGE. */ + +static inline int +estimate_edge_time (struct cgraph_edge *edge) +{ + int ret; + if ((int)edge_growth_cache.length () <= edge->uid + || !(ret = edge_growth_cache[edge->uid].time)) + return do_estimate_edge_time (edge); + return ret - (ret > 0); +} + + +/* Return estimated callee runtime increase after inlining + EDGE. */ + +static inline inline_hints +estimate_edge_hints (struct cgraph_edge *edge) +{ + inline_hints ret; + if ((int)edge_growth_cache.length () <= edge->uid + || !(ret = edge_growth_cache[edge->uid].hints)) + return do_estimate_edge_hints (edge); + return ret - 1; +} + +/* Reset cached value for EDGE. */ + +static inline void +reset_edge_growth_cache (struct cgraph_edge *edge) +{ + if ((int)edge_growth_cache.length () > edge->uid) + { + struct edge_growth_cache_entry zero = {0, 0, 0}; + edge_growth_cache[edge->uid] = zero; + } +} + +#endif /* GCC_IPA_INLINE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-prop.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-prop.h new file mode 100644 index 0000000..74234eb --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-prop.h @@ -0,0 +1,857 @@ +/* Interprocedural analyses. + Copyright (C) 2005-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef IPA_PROP_H +#define IPA_PROP_H + +/* The following definitions and interfaces are used by + interprocedural analyses or parameters. */ + +#define IPA_UNDESCRIBED_USE -1 + +/* ipa-prop.c stuff (ipa-cp, indirect inlining): */ + +/* A jump function for a callsite represents the values passed as actual + arguments of the callsite. They were originally proposed in a paper called + "Interprocedural Constant Propagation", by David Callahan, Keith D Cooper, + Ken Kennedy, Linda Torczon in Comp86, pg 152-161. There are three main + types of values : + + Pass-through - the caller's formal parameter is passed as an actual + argument, possibly one simple operation performed on it. + Constant - a constant (is_gimple_ip_invariant)is passed as an actual + argument. + Unknown - neither of the above. + + IPA_JF_ANCESTOR is a special pass-through jump function, which means that + the result is an address of a part of the object pointed to by the formal + parameter to which the function refers. It is mainly intended to represent + getting addresses of ancestor fields in C++ + (e.g. &this_1(D)->D.1766.D.1756). Note that if the original pointer is + NULL, ancestor jump function must behave like a simple pass-through. + + Other pass-through functions can either simply pass on an unchanged formal + parameter or can apply one simple binary operation to it (such jump + functions are called polynomial). + + Jump functions are computed in ipa-prop.c by function + update_call_notes_after_inlining. Some information can be lost and jump + functions degraded accordingly when inlining, see + update_call_notes_after_inlining in the same file. */ + +enum jump_func_type +{ + IPA_JF_UNKNOWN = 0, /* newly allocated and zeroed jump functions default */ + IPA_JF_CONST, /* represented by field costant */ + IPA_JF_PASS_THROUGH, /* represented by field pass_through */ + IPA_JF_ANCESTOR /* represented by field ancestor */ +}; + +struct ipa_cst_ref_desc; + +/* Structure holding data required to describe a constant jump function. */ +struct GTY(()) ipa_constant_data +{ + /* THe value of the constant. */ + tree value; + /* Pointer to the structure that describes the reference. */ + struct ipa_cst_ref_desc GTY((skip)) *rdesc; +}; + +/* Structure holding data required to describe a pass-through jump function. */ + +struct GTY(()) ipa_pass_through_data +{ + /* If an operation is to be performed on the original parameter, this is the + second (constant) operand. */ + tree operand; + /* Number of the caller's formal parameter being passed. */ + int formal_id; + /* Operation that is performed on the argument before it is passed on. + NOP_EXPR means no operation. Otherwise oper must be a simple binary + arithmetic operation where the caller's parameter is the first operand and + operand field from this structure is the second one. */ + enum tree_code operation; + /* When the passed value is a pointer, it is set to true only when we are + certain that no write to the object it points to has occurred since the + caller functions started execution, except for changes noted in the + aggregate part of the jump function (see description of + ipa_agg_jump_function). The flag is used only when the operation is + NOP_EXPR. */ + unsigned agg_preserved : 1; +}; + +/* Structure holding data required to describe an ancestor pass-through + jump function. */ + +struct GTY(()) ipa_ancestor_jf_data +{ + /* Offset of the field representing the ancestor. */ + HOST_WIDE_INT offset; + /* Number of the caller's formal parameter being passed. */ + int formal_id; + /* Flag with the same meaning like agg_preserve in ipa_pass_through_data. */ + unsigned agg_preserved : 1; +}; + +/* An element in an aggegate part of a jump function describing a known value + at a given offset. When it is part of a pass-through jump function with + agg_preserved set or an ancestor jump function with agg_preserved set, all + unlisted positions are assumed to be preserved but the value can be a type + node, which means that the particular piece (starting at offset and having + the size of the type) is clobbered with an unknown value. When + agg_preserved is false or the type of the containing jump function is + different, all unlisted parts are assumed to be unknown and all values must + fulfill is_gimple_ip_invariant. */ + +struct GTY(()) ipa_agg_jf_item +{ + /* The offset at which the known value is located within the aggregate. */ + HOST_WIDE_INT offset; + + /* The known constant or type if this is a clobber. */ + tree value; +}; + + +/* Aggregate jump function - i.e. description of contents of aggregates passed + either by reference or value. */ + +struct GTY(()) ipa_agg_jump_function +{ + /* Description of the individual items. */ + vec *items; + /* True if the data was passed by reference (as opposed to by value). */ + bool by_ref; +}; + +typedef struct ipa_agg_jump_function *ipa_agg_jump_function_p; + +/* Information about zero/non-zero bits. */ +struct GTY(()) ipa_bits +{ + /* The propagated value. */ + widest_int value; + /* Mask corresponding to the value. + Similar to ccp_lattice_t, if xth bit of mask is 0, + implies xth bit of value is constant. */ + widest_int mask; +}; + +/* Info about value ranges. */ + +struct GTY(()) ipa_vr +{ + /* The data fields below are valid only if known is true. */ + bool known; + enum value_range_type type; + wide_int min; + wide_int max; +}; + +/* A jump function for a callsite represents the values passed as actual + arguments of the callsite. See enum jump_func_type for the various + types of jump functions supported. */ +struct GTY (()) ipa_jump_func +{ + /* Aggregate contants description. See struct ipa_agg_jump_function and its + description. */ + struct ipa_agg_jump_function agg; + + /* Information about zero/non-zero bits. The pointed to structure is shared + betweed different jump functions. Use ipa_set_jfunc_bits to set this + field. */ + struct ipa_bits *bits; + + /* Information about value range, containing valid data only when vr_known is + true. The pointed to structure is shared betweed different jump + functions. Use ipa_set_jfunc_vr to set this field. */ + struct value_range *m_vr; + + enum jump_func_type type; + /* Represents a value of a jump function. pass_through is used only in jump + function context. constant represents the actual constant in constant jump + functions and member_cst holds constant c++ member functions. */ + union jump_func_value + { + struct ipa_constant_data GTY ((tag ("IPA_JF_CONST"))) constant; + struct ipa_pass_through_data GTY ((tag ("IPA_JF_PASS_THROUGH"))) pass_through; + struct ipa_ancestor_jf_data GTY ((tag ("IPA_JF_ANCESTOR"))) ancestor; + } GTY ((desc ("%1.type"))) value; +}; + + +/* Return the constant stored in a constant jump functin JFUNC. */ + +static inline tree +ipa_get_jf_constant (struct ipa_jump_func *jfunc) +{ + gcc_checking_assert (jfunc->type == IPA_JF_CONST); + return jfunc->value.constant.value; +} + +static inline struct ipa_cst_ref_desc * +ipa_get_jf_constant_rdesc (struct ipa_jump_func *jfunc) +{ + gcc_checking_assert (jfunc->type == IPA_JF_CONST); + return jfunc->value.constant.rdesc; +} + +/* Return the operand of a pass through jmp function JFUNC. */ + +static inline tree +ipa_get_jf_pass_through_operand (struct ipa_jump_func *jfunc) +{ + gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH); + return jfunc->value.pass_through.operand; +} + +/* Return the number of the caller's formal parameter that a pass through jump + function JFUNC refers to. */ + +static inline int +ipa_get_jf_pass_through_formal_id (struct ipa_jump_func *jfunc) +{ + gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH); + return jfunc->value.pass_through.formal_id; +} + +/* Return operation of a pass through jump function JFUNC. */ + +static inline enum tree_code +ipa_get_jf_pass_through_operation (struct ipa_jump_func *jfunc) +{ + gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH); + return jfunc->value.pass_through.operation; +} + +/* Return the agg_preserved flag of a pass through jump function JFUNC. */ + +static inline bool +ipa_get_jf_pass_through_agg_preserved (struct ipa_jump_func *jfunc) +{ + gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH); + return jfunc->value.pass_through.agg_preserved; +} + +/* Return true if pass through jump function JFUNC preserves type + information. */ + +static inline bool +ipa_get_jf_pass_through_type_preserved (struct ipa_jump_func *jfunc) +{ + gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH); + return jfunc->value.pass_through.agg_preserved; +} + +/* Return the offset of an ancestor jump function JFUNC. */ + +static inline HOST_WIDE_INT +ipa_get_jf_ancestor_offset (struct ipa_jump_func *jfunc) +{ + gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR); + return jfunc->value.ancestor.offset; +} + +/* Return the number of the caller's formal parameter that an ancestor jump + function JFUNC refers to. */ + +static inline int +ipa_get_jf_ancestor_formal_id (struct ipa_jump_func *jfunc) +{ + gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR); + return jfunc->value.ancestor.formal_id; +} + +/* Return the agg_preserved flag of an ancestor jump function JFUNC. */ + +static inline bool +ipa_get_jf_ancestor_agg_preserved (struct ipa_jump_func *jfunc) +{ + gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR); + return jfunc->value.ancestor.agg_preserved; +} + +/* Return true if ancestor jump function JFUNC presrves type information. */ + +static inline bool +ipa_get_jf_ancestor_type_preserved (struct ipa_jump_func *jfunc) +{ + gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR); + return jfunc->value.ancestor.agg_preserved; +} + +/* Summary describing a single formal parameter. */ + +struct GTY(()) ipa_param_descriptor +{ + /* In analysis and modification phase, this is the PARAM_DECL of this + parameter, in IPA LTO phase, this is the type of the the described + parameter or NULL if not known. Do not read this field directly but + through ipa_get_param and ipa_get_type as appropriate. */ + tree decl_or_type; + /* If all uses of the parameter are described by ipa-prop structures, this + says how many there are. If any use could not be described by means of + ipa-prop structures, this is IPA_UNDESCRIBED_USE. */ + int controlled_uses; + unsigned int move_cost : 31; + /* The parameter is used. */ + unsigned used : 1; +}; + +/* ipa_node_params stores information related to formal parameters of functions + and some other information for interprocedural passes that operate on + parameters (such as ipa-cp). */ + +struct GTY((for_user)) ipa_node_params +{ + /* Default constructor. */ + ipa_node_params (); + + /* Default destructor. */ + ~ipa_node_params (); + + /* Information about individual formal parameters that are gathered when + summaries are generated. */ + vec *descriptors; + /* Pointer to an array of structures describing individual formal + parameters. */ + struct ipcp_param_lattices * GTY((skip)) lattices; + /* Only for versioned nodes this field would not be NULL, + it points to the node that IPA cp cloned from. */ + struct cgraph_node * GTY((skip)) ipcp_orig_node; + /* If this node is an ipa-cp clone, these are the known constants that + describe what it has been specialized for. */ + vec GTY((skip)) known_csts; + /* If this node is an ipa-cp clone, these are the known polymorphic contexts + that describe what it has been specialized for. */ + vec GTY((skip)) known_contexts; + /* Whether the param uses analysis and jump function computation has already + been performed. */ + unsigned analysis_done : 1; + /* Whether the function is enqueued in ipa-cp propagation stack. */ + unsigned node_enqueued : 1; + /* Whether we should create a specialized version based on values that are + known to be constant in all contexts. */ + unsigned do_clone_for_all_contexts : 1; + /* Set if this is an IPA-CP clone for all contexts. */ + unsigned is_all_contexts_clone : 1; + /* Node has been completely replaced by clones and will be removed after + ipa-cp is finished. */ + unsigned node_dead : 1; + /* Node is involved in a recursion, potentionally indirect. */ + unsigned node_within_scc : 1; + /* Node is calling a private function called only once. */ + unsigned node_calling_single_call : 1; + /* False when there is something makes versioning impossible. */ + unsigned versionable : 1; +}; + +inline +ipa_node_params::ipa_node_params () +: descriptors (NULL), lattices (NULL), ipcp_orig_node (NULL), + known_csts (vNULL), known_contexts (vNULL), analysis_done (0), + node_enqueued (0), do_clone_for_all_contexts (0), is_all_contexts_clone (0), + node_dead (0), node_within_scc (0), node_calling_single_call (0), + versionable (0) +{ +} + +inline +ipa_node_params::~ipa_node_params () +{ + free (lattices); + known_csts.release (); + known_contexts.release (); +} + +/* Intermediate information that we get from alias analysis about a particular + parameter in a particular basic_block. When a parameter or the memory it + references is marked modified, we use that information in all dominated + blocks without consulting alias analysis oracle. */ + +struct ipa_param_aa_status +{ + /* Set when this structure contains meaningful information. If not, the + structure describing a dominating BB should be used instead. */ + bool valid; + + /* Whether we have seen something which might have modified the data in + question. PARM is for the parameter itself, REF is for data it points to + but using the alias type of individual accesses and PT is the same thing + but for computing aggregate pass-through functions using a very inclusive + ao_ref. */ + bool parm_modified, ref_modified, pt_modified; +}; + +/* Information related to a given BB that used only when looking at function + body. */ + +struct ipa_bb_info +{ + /* Call graph edges going out of this BB. */ + vec cg_edges; + /* Alias analysis statuses of each formal parameter at this bb. */ + vec param_aa_statuses; +}; + +/* Structure with global information that is only used when looking at function + body. */ + +struct ipa_func_body_info +{ + /* The node that is being analyzed. */ + cgraph_node *node; + + /* Its info. */ + struct ipa_node_params *info; + + /* Information about individual BBs. */ + vec bb_infos; + + /* Number of parameters. */ + int param_count; + + /* Number of statements already walked by when analyzing this function. */ + unsigned int aa_walked; +}; + +/* ipa_node_params access functions. Please use these to access fields that + are or will be shared among various passes. */ + +/* Return the number of formal parameters. */ + +static inline int +ipa_get_param_count (struct ipa_node_params *info) +{ + return vec_safe_length (info->descriptors); +} + +/* Return the declaration of Ith formal parameter of the function corresponding + to INFO. Note there is no setter function as this array is built just once + using ipa_initialize_node_params. This function should not be called in + WPA. */ + +static inline tree +ipa_get_param (struct ipa_node_params *info, int i) +{ + gcc_checking_assert (info->descriptors); + gcc_checking_assert (!flag_wpa); + tree t = (*info->descriptors)[i].decl_or_type; + gcc_checking_assert (TREE_CODE (t) == PARM_DECL); + return t; +} + +/* Return the type of Ith formal parameter of the function corresponding + to INFO if it is known or NULL if not. */ + +static inline tree +ipa_get_type (struct ipa_node_params *info, int i) +{ + gcc_checking_assert (info->descriptors); + tree t = (*info->descriptors)[i].decl_or_type; + if (!t) + return NULL; + if (TYPE_P (t)) + return t; + gcc_checking_assert (TREE_CODE (t) == PARM_DECL); + return TREE_TYPE (t); +} + +/* Return the move cost of Ith formal parameter of the function corresponding + to INFO. */ + +static inline int +ipa_get_param_move_cost (struct ipa_node_params *info, int i) +{ + gcc_checking_assert (info->descriptors); + return (*info->descriptors)[i].move_cost; +} + +/* Set the used flag corresponding to the Ith formal parameter of the function + associated with INFO to VAL. */ + +static inline void +ipa_set_param_used (struct ipa_node_params *info, int i, bool val) +{ + gcc_checking_assert (info->descriptors); + (*info->descriptors)[i].used = val; +} + +/* Return how many uses described by ipa-prop a parameter has or + IPA_UNDESCRIBED_USE if there is a use that is not described by these + structures. */ +static inline int +ipa_get_controlled_uses (struct ipa_node_params *info, int i) +{ + /* FIXME: introducing speculation causes out of bounds access here. */ + if (vec_safe_length (info->descriptors) > (unsigned)i) + return (*info->descriptors)[i].controlled_uses; + return IPA_UNDESCRIBED_USE; +} + +/* Set the controlled counter of a given parameter. */ + +static inline void +ipa_set_controlled_uses (struct ipa_node_params *info, int i, int val) +{ + gcc_checking_assert (info->descriptors); + (*info->descriptors)[i].controlled_uses = val; +} + +/* Return the used flag corresponding to the Ith formal parameter of the + function associated with INFO. */ + +static inline bool +ipa_is_param_used (struct ipa_node_params *info, int i) +{ + gcc_checking_assert (info->descriptors); + return (*info->descriptors)[i].used; +} + +/* Information about replacements done in aggregates for a given node (each + node has its linked list). */ +struct GTY(()) ipa_agg_replacement_value +{ + /* Next item in the linked list. */ + struct ipa_agg_replacement_value *next; + /* Offset within the aggregate. */ + HOST_WIDE_INT offset; + /* The constant value. */ + tree value; + /* The paramter index. */ + int index; + /* Whether the value was passed by reference. */ + bool by_ref; +}; + +/* Structure holding information for the transformation phase of IPA-CP. */ + +struct GTY(()) ipcp_transformation_summary +{ + /* Linked list of known aggregate values. */ + ipa_agg_replacement_value *agg_values; + /* Known bits information. */ + vec *bits; + /* Value range information. */ + vec *m_vr; +}; + +void ipa_set_node_agg_value_chain (struct cgraph_node *node, + struct ipa_agg_replacement_value *aggvals); +void ipcp_grow_transformations_if_necessary (void); + +/* ipa_edge_args stores information related to a callsite and particularly its + arguments. It can be accessed by the IPA_EDGE_REF macro. */ +struct GTY(()) ipa_edge_args +{ + /* Vector of the callsite's jump function of each parameter. */ + vec *jump_functions; + vec *polymorphic_call_contexts; +}; + +/* ipa_edge_args access functions. Please use these to access fields that + are or will be shared among various passes. */ + +/* Return the number of actual arguments. */ + +static inline int +ipa_get_cs_argument_count (struct ipa_edge_args *args) +{ + return vec_safe_length (args->jump_functions); +} + +/* Returns a pointer to the jump function for the ith argument. Please note + there is no setter function as jump functions are all set up in + ipa_compute_jump_functions. */ + +static inline struct ipa_jump_func * +ipa_get_ith_jump_func (struct ipa_edge_args *args, int i) +{ + return &(*args->jump_functions)[i]; +} + +/* Returns a pointer to the polymorphic call context for the ith argument. + NULL if contexts are not computed. */ +static inline struct ipa_polymorphic_call_context * +ipa_get_ith_polymorhic_call_context (struct ipa_edge_args *args, int i) +{ + if (!args->polymorphic_call_contexts) + return NULL; + return &(*args->polymorphic_call_contexts)[i]; +} + +/* Function summary for ipa_node_params. */ +class GTY((user)) ipa_node_params_t: public function_summary +{ +public: + ipa_node_params_t (symbol_table *table, bool ggc): + function_summary (table, ggc) { } + + /* Hook that is called by summary when a node is duplicated. */ + virtual void duplicate (cgraph_node *node, + cgraph_node *node2, + ipa_node_params *data, + ipa_node_params *data2); +}; + +/* Function summary where the parameter infos are actually stored. */ +extern GTY(()) ipa_node_params_t * ipa_node_params_sum; + +/* Vector of IPA-CP transformation data for each clone. */ +extern GTY(()) vec *ipcp_transformations; +/* Vector where the parameter infos are actually stored. */ +extern GTY(()) vec *ipa_edge_args_vector; + + +/* Return the associated parameter/argument info corresponding to the given + node/edge. */ +#define IPA_NODE_REF(NODE) (ipa_node_params_sum->get (NODE)) +#define IPA_EDGE_REF(EDGE) (&(*ipa_edge_args_vector)[(EDGE)->uid]) +/* This macro checks validity of index returned by + ipa_get_param_decl_index function. */ +#define IS_VALID_JUMP_FUNC_INDEX(I) ((I) != -1) + +/* Creating and freeing ipa_node_params and ipa_edge_args. */ +void ipa_create_all_node_params (void); +void ipa_create_all_edge_args (void); +void ipa_check_create_edge_args (void); +void ipa_free_edge_args_substructures (struct ipa_edge_args *); +void ipa_free_all_node_params (void); +void ipa_free_all_edge_args (void); +void ipa_free_all_structures_after_ipa_cp (void); +void ipa_free_all_structures_after_iinln (void); + +void ipa_register_cgraph_hooks (void); +int count_formal_params (tree fndecl); + +/* This function ensures the array of node param infos is big enough to + accommodate a structure for all nodes and reallocates it if not. */ + +static inline void +ipa_check_create_node_params (void) +{ + if (!ipa_node_params_sum) + ipa_node_params_sum + = (new (ggc_cleared_alloc ()) + ipa_node_params_t (symtab, true)); +} + +/* Returns true if the array of edge infos is large enough to accommodate an + info for EDGE. The main purpose of this function is that debug dumping + function can check info availability without causing reallocations. */ + +static inline bool +ipa_edge_args_info_available_for_edge_p (struct cgraph_edge *edge) +{ + return ((unsigned) edge->uid < vec_safe_length (ipa_edge_args_vector)); +} + +static inline ipcp_transformation_summary * +ipcp_get_transformation_summary (cgraph_node *node) +{ + if ((unsigned) node->uid >= vec_safe_length (ipcp_transformations)) + return NULL; + return &(*ipcp_transformations)[node->uid]; +} + +/* Return the aggregate replacements for NODE, if there are any. */ + +static inline struct ipa_agg_replacement_value * +ipa_get_agg_replacements_for_node (cgraph_node *node) +{ + ipcp_transformation_summary *ts = ipcp_get_transformation_summary (node); + return ts ? ts->agg_values : NULL; +} + +/* Function formal parameters related computations. */ +void ipa_initialize_node_params (struct cgraph_node *node); +bool ipa_propagate_indirect_call_infos (struct cgraph_edge *cs, + vec *new_edges); + +/* Indirect edge and binfo processing. */ +tree ipa_get_indirect_edge_target (struct cgraph_edge *ie, + vec , + vec, + vec, + bool *); +struct cgraph_edge *ipa_make_edge_direct_to_target (struct cgraph_edge *, tree, + bool speculative = false); +tree ipa_impossible_devirt_target (struct cgraph_edge *, tree); +ipa_bits *ipa_get_ipa_bits_for_value (const widest_int &value, + const widest_int &mask); + + +/* Functions related to both. */ +void ipa_analyze_node (struct cgraph_node *); + +/* Aggregate jump function related functions. */ +tree ipa_find_agg_cst_for_param (struct ipa_agg_jump_function *agg, tree scalar, + HOST_WIDE_INT offset, bool by_ref, + bool *from_global_constant = NULL); +bool ipa_load_from_parm_agg (struct ipa_func_body_info *fbi, + vec *descriptors, + gimple *stmt, tree op, int *index_p, + HOST_WIDE_INT *offset_p, HOST_WIDE_INT *size_p, + bool *by_ref, bool *guaranteed_unmodified = NULL); + +/* Debugging interface. */ +void ipa_print_node_params (FILE *, struct cgraph_node *node); +void ipa_print_all_params (FILE *); +void ipa_print_node_jump_functions (FILE *f, struct cgraph_node *node); +void ipa_print_all_jump_functions (FILE * f); +void ipcp_verify_propagated_values (void); + +template +class ipcp_value; + +extern object_allocator > ipcp_cst_values_pool; +extern object_allocator > + ipcp_poly_ctx_values_pool; + +template +class ipcp_value_source; + +extern object_allocator > ipcp_sources_pool; + +class ipcp_agg_lattice; + +extern object_allocator ipcp_agg_lattice_pool; + +/* Operation to be performed for the parameter in ipa_parm_adjustment + below. */ +enum ipa_parm_op { + IPA_PARM_OP_NONE, + + /* This describes a brand new parameter. + + The field `type' should be set to the new type, `arg_prefix' + should be set to the string prefix for the new DECL_NAME, and + `new_decl' will ultimately hold the newly created argument. */ + IPA_PARM_OP_NEW, + + /* This new parameter is an unmodified parameter at index base_index. */ + IPA_PARM_OP_COPY, + + /* This adjustment describes a parameter that is about to be removed + completely. Most users will probably need to book keep those so that they + don't leave behinfd any non default def ssa names belonging to them. */ + IPA_PARM_OP_REMOVE +}; + +/* Structure to describe transformations of formal parameters and actual + arguments. Each instance describes one new parameter and they are meant to + be stored in a vector. Additionally, most users will probably want to store + adjustments about parameters that are being removed altogether so that SSA + names belonging to them can be replaced by SSA names of an artificial + variable. */ +struct ipa_parm_adjustment +{ + /* The original PARM_DECL itself, helpful for processing of the body of the + function itself. Intended for traversing function bodies. + ipa_modify_formal_parameters, ipa_modify_call_arguments and + ipa_combine_adjustments ignore this and use base_index. + ipa_modify_formal_parameters actually sets this. */ + tree base; + + /* Type of the new parameter. However, if by_ref is true, the real type will + be a pointer to this type. */ + tree type; + + /* Alias refrerence type to be used in MEM_REFs when adjusting caller + arguments. */ + tree alias_ptr_type; + + /* The new declaration when creating/replacing a parameter. Created + by ipa_modify_formal_parameters, useful for functions modifying + the body accordingly. For brand new arguments, this is the newly + created argument. */ + tree new_decl; + + /* New declaration of a substitute variable that we may use to replace all + non-default-def ssa names when a parm decl is going away. */ + tree new_ssa_base; + + /* If non-NULL and the original parameter is to be removed (copy_param below + is NULL), this is going to be its nonlocalized vars value. */ + tree nonlocal_value; + + /* This holds the prefix to be used for the new DECL_NAME. */ + const char *arg_prefix; + + /* Offset into the original parameter (for the cases when the new parameter + is a component of an original one). */ + HOST_WIDE_INT offset; + + /* Zero based index of the original parameter this one is based on. */ + int base_index; + + /* Whether this parameter is a new parameter, a copy of an old one, + or one about to be removed. */ + enum ipa_parm_op op; + + /* Storage order of the original parameter (for the cases when the new + parameter is a component of an original one). */ + unsigned reverse : 1; + + /* The parameter is to be passed by reference. */ + unsigned by_ref : 1; +}; + +typedef vec ipa_parm_adjustment_vec; + +vec ipa_get_vector_of_formal_parms (tree fndecl); +vec ipa_get_vector_of_formal_parm_types (tree fntype); +void ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec); +void ipa_modify_call_arguments (struct cgraph_edge *, gcall *, + ipa_parm_adjustment_vec); +ipa_parm_adjustment_vec ipa_combine_adjustments (ipa_parm_adjustment_vec, + ipa_parm_adjustment_vec); +void ipa_dump_param_adjustments (FILE *, ipa_parm_adjustment_vec, tree); +void ipa_dump_agg_replacement_values (FILE *f, + struct ipa_agg_replacement_value *av); +void ipa_prop_write_jump_functions (void); +void ipa_prop_read_jump_functions (void); +void ipcp_write_transformation_summaries (void); +void ipcp_read_transformation_summaries (void); +void ipa_update_after_lto_read (void); +int ipa_get_param_decl_index (struct ipa_node_params *, tree); +tree ipa_value_from_jfunc (struct ipa_node_params *info, + struct ipa_jump_func *jfunc); +unsigned int ipcp_transform_function (struct cgraph_node *node); +ipa_polymorphic_call_context ipa_context_from_jfunc (ipa_node_params *, + cgraph_edge *, + int, + ipa_jump_func *); +void ipa_dump_param (FILE *, struct ipa_node_params *info, int i); +bool ipa_modify_expr (tree *, bool, ipa_parm_adjustment_vec); +ipa_parm_adjustment *ipa_get_adjustment_candidate (tree **, bool *, + ipa_parm_adjustment_vec, + bool); +void ipa_release_body_info (struct ipa_func_body_info *); +tree ipa_get_callee_param_type (struct cgraph_edge *e, int i); + +/* From tree-sra.c: */ +tree build_ref_for_offset (location_t, tree, HOST_WIDE_INT, bool, tree, + gimple_stmt_iterator *, bool); + +/* In ipa-cp.c */ +void ipa_cp_c_finalize (void); + +#endif /* IPA_PROP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-ref.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-ref.h new file mode 100644 index 0000000..fc1e95f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-ref.h @@ -0,0 +1,138 @@ +/* IPA reference lists. + Copyright (C) 2010-2017 Free Software Foundation, Inc. + Contributed by Jan Hubicka + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_IPA_REF_H +#define GCC_IPA_REF_H + +struct cgraph_node; +class varpool_node; +class symtab_node; + + +/* How the reference is done. */ +enum GTY(()) ipa_ref_use +{ + IPA_REF_LOAD, + IPA_REF_STORE, + IPA_REF_ADDR, + IPA_REF_ALIAS, + IPA_REF_CHKP +}; + +/* Record of reference in callgraph or varpool. */ +struct GTY(()) ipa_ref +{ +public: + /* Remove reference. */ + void remove_reference (); + + /* Return true when execution of reference can lead to return from + function. */ + bool cannot_lead_to_return (); + + /* Return true if refernece may be used in address compare. */ + bool address_matters_p (); + + /* Return reference list this reference is in. */ + struct ipa_ref_list * referring_ref_list (void); + + /* Return reference list this reference is in. */ + struct ipa_ref_list * referred_ref_list (void); + + symtab_node *referring; + symtab_node *referred; + gimple *stmt; + unsigned int lto_stmt_uid; + unsigned int referred_index; + ENUM_BITFIELD (ipa_ref_use) use:3; + unsigned int speculative:1; +}; + +typedef struct ipa_ref ipa_ref_t; +typedef struct ipa_ref *ipa_ref_ptr; + + +/* List of references. This is stored in both callgraph and varpool nodes. */ +struct GTY(()) ipa_ref_list +{ +public: + /* Return first reference in list or NULL if empty. */ + struct ipa_ref *first_reference (void) + { + if (!vec_safe_length (references)) + return NULL; + return &(*references)[0]; + } + + /* Return first referring ref in list or NULL if empty. */ + struct ipa_ref *first_referring (void) + { + if (!referring.length ()) + return NULL; + return referring[0]; + } + + /* Return first referring alias. */ + struct ipa_ref *first_alias (void) + { + struct ipa_ref *r = first_referring (); + + return r && r->use == IPA_REF_ALIAS ? r : NULL; + } + + /* Return last referring alias. */ + struct ipa_ref *last_alias (void) + { + unsigned int i = 0; + + for(i = 0; i < referring.length (); i++) + if (referring[i]->use != IPA_REF_ALIAS) + break; + + return i == 0 ? NULL : referring[i - 1]; + } + + /* Return true if the symbol has an alias. */ + bool inline has_aliases_p (void) + { + return first_alias (); + } + + /* Clear reference list. */ + void clear (void) + { + referring.create (0); + references = NULL; + } + + /* Return number of references. */ + unsigned int nreferences (void) + { + return vec_safe_length (references); + } + + /* Store actual references in references vector. */ + vec *references; + /* Referring is vector of pointers to references. It must not live in GGC space + or GGC will try to mark middle of references vectors. */ + vec GTY((skip)) referring; +}; + +#endif /* GCC_IPA_REF_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-reference.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-reference.h new file mode 100644 index 0000000..392b2f0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-reference.h @@ -0,0 +1,36 @@ +/* IPA handling of references. + Copyright (C) 2004-2017 Free Software Foundation, Inc. + Contributed by Kenneth Zadeck + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_IPA_REFERENCE_H +#define GCC_IPA_REFERENCE_H + +/* In ipa-reference.c */ +bitmap ipa_reference_get_not_read_global (struct cgraph_node *fn); +bitmap ipa_reference_get_not_written_global (struct cgraph_node *fn); +void ipa_reference_c_finalize (void); + +inline int +ipa_reference_var_uid (tree t) +{ + return DECL_UID (symtab_node::get (t)->ultimate_alias_target (NULL)->decl); +} + +#endif /* GCC_IPA_REFERENCE_H */ + diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-utils.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-utils.h new file mode 100644 index 0000000..e992f65 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ipa-utils.h @@ -0,0 +1,266 @@ +/* Utilities for ipa analysis. + Copyright (C) 2004-2017 Free Software Foundation, Inc. + Contributed by Kenneth Zadeck + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_IPA_UTILS_H +#define GCC_IPA_UTILS_H + +struct ipa_dfs_info { + int dfn_number; + int low_link; + /* This field will have the samy value for any two nodes in the same strongly + connected component. */ + int scc_no; + bool new_node; + bool on_stack; + struct cgraph_node* next_cycle; + PTR aux; +}; + + +/* In ipa-utils.c */ +void ipa_print_order (FILE*, const char *, struct cgraph_node**, int); +int ipa_reduced_postorder (struct cgraph_node **, bool, bool, + bool (*ignore_edge) (struct cgraph_edge *)); +void ipa_free_postorder_info (void); +vec ipa_get_nodes_in_cycle (struct cgraph_node *); +bool ipa_edge_within_scc (struct cgraph_edge *); +int ipa_reverse_postorder (struct cgraph_node **); +tree get_base_var (tree); +void ipa_merge_profiles (struct cgraph_node *dst, + struct cgraph_node *src, bool preserve_body = false); +bool recursive_call_p (tree, tree); + +/* In ipa-profile.c */ +bool ipa_propagate_frequency (struct cgraph_node *node); + +/* In ipa-devirt.c */ + +struct odr_type_d; +typedef odr_type_d *odr_type; +void build_type_inheritance_graph (void); +void update_type_inheritance_graph (void); +vec +possible_polymorphic_call_targets (tree, HOST_WIDE_INT, + ipa_polymorphic_call_context, + bool *copletep = NULL, + void **cache_token = NULL, + bool speuclative = false); +odr_type get_odr_type (tree, bool insert = false); +bool odr_type_p (const_tree); +bool possible_polymorphic_call_target_p (tree ref, gimple *stmt, struct cgraph_node *n); +void dump_possible_polymorphic_call_targets (FILE *, tree, HOST_WIDE_INT, + const ipa_polymorphic_call_context &); +bool possible_polymorphic_call_target_p (tree, HOST_WIDE_INT, + const ipa_polymorphic_call_context &, + struct cgraph_node *); +tree polymorphic_ctor_dtor_p (tree, bool); +tree inlined_polymorphic_ctor_dtor_block_p (tree, bool); +bool decl_maybe_in_construction_p (tree, tree, gimple *, tree); +tree vtable_pointer_value_to_binfo (const_tree); +bool vtable_pointer_value_to_vtable (const_tree, tree *, unsigned HOST_WIDE_INT *); +tree subbinfo_with_vtable_at_offset (tree, unsigned HOST_WIDE_INT, tree); +void compare_virtual_tables (varpool_node *, varpool_node *); +bool type_all_derivations_known_p (const_tree); +bool type_known_to_have_no_derivations_p (tree); +bool contains_polymorphic_type_p (const_tree); +void register_odr_type (tree); +bool types_must_be_same_for_odr (tree, tree); +bool types_odr_comparable (tree, tree, bool strict = false); +cgraph_node *try_speculative_devirtualization (tree, HOST_WIDE_INT, + ipa_polymorphic_call_context); +void warn_types_mismatch (tree t1, tree t2, location_t loc1 = UNKNOWN_LOCATION, + location_t loc2 = UNKNOWN_LOCATION); +bool odr_or_derived_type_p (const_tree t); +bool odr_types_equivalent_p (tree type1, tree type2); + +/* Return vector containing possible targets of polymorphic call E. + If COMPLETEP is non-NULL, store true if the list is complete. + CACHE_TOKEN (if non-NULL) will get stored to an unique ID of entry + in the target cache. If user needs to visit every target list + just once, it can memoize them. + + Returned vector is placed into cache. It is NOT caller's responsibility + to free it. The vector can be freed on cgraph_remove_node call if + the particular node is a virtual function present in the cache. */ + +inline vec +possible_polymorphic_call_targets (struct cgraph_edge *e, + bool *completep = NULL, + void **cache_token = NULL, + bool speculative = false) +{ + ipa_polymorphic_call_context context(e); + + return possible_polymorphic_call_targets (e->indirect_info->otr_type, + e->indirect_info->otr_token, + context, + completep, cache_token, + speculative); +} + +/* Same as above but taking OBJ_TYPE_REF as an parameter. */ + +inline vec +possible_polymorphic_call_targets (tree ref, + gimple *call, + bool *completep = NULL, + void **cache_token = NULL) +{ + ipa_polymorphic_call_context context (current_function_decl, ref, call); + + return possible_polymorphic_call_targets (obj_type_ref_class (ref), + tree_to_uhwi + (OBJ_TYPE_REF_TOKEN (ref)), + context, + completep, cache_token); +} + +/* Dump possible targets of a polymorphic call E into F. */ + +inline void +dump_possible_polymorphic_call_targets (FILE *f, struct cgraph_edge *e) +{ + ipa_polymorphic_call_context context(e); + + dump_possible_polymorphic_call_targets (f, e->indirect_info->otr_type, + e->indirect_info->otr_token, + context); +} + +/* Return true if N can be possibly target of a polymorphic call of + E. */ + +inline bool +possible_polymorphic_call_target_p (struct cgraph_edge *e, + struct cgraph_node *n) +{ + ipa_polymorphic_call_context context(e); + + return possible_polymorphic_call_target_p (e->indirect_info->otr_type, + e->indirect_info->otr_token, + context, n); +} + +/* Return true if BINFO corresponds to a type with virtual methods. + + Every type has several BINFOs. One is the BINFO associated by the type + while other represents bases of derived types. The BINFOs representing + bases do not have BINFO_VTABLE pointer set when this is the single + inheritance (because vtables are shared). Look up the BINFO of type + and check presence of its vtable. */ + +inline bool +polymorphic_type_binfo_p (const_tree binfo) +{ + /* See if BINFO's type has an virtual table associtated with it. + Check is defensive because of Java FE produces BINFOs + without BINFO_TYPE set. */ + return (BINFO_TYPE (binfo) && TYPE_BINFO (BINFO_TYPE (binfo)) + && BINFO_VTABLE (TYPE_BINFO (BINFO_TYPE (binfo)))); +} + +/* Return true if T is a type with linkage defined. */ + +inline bool +type_with_linkage_p (const_tree t) +{ + if (!TYPE_NAME (t) || TREE_CODE (TYPE_NAME (t)) != TYPE_DECL + || !TYPE_STUB_DECL (t)) + return false; + /* In LTO do not get confused by non-C++ produced types or types built + with -fno-lto-odr-type-merigng. */ + if (in_lto_p) + { + /* To support -fno-lto-odr-type-merigng recognize types with vtables + to have linkage. */ + if (RECORD_OR_UNION_TYPE_P (t) + && TYPE_BINFO (t) && BINFO_VTABLE (TYPE_BINFO (t))) + return true; + /* With -flto-odr-type-merging C++ FE specify mangled names + for all types with the linkage. */ + return DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (t)); + } + + if (!RECORD_OR_UNION_TYPE_P (t) && TREE_CODE (t) != ENUMERAL_TYPE) + return false; + + /* Builtin types do not define linkage, their TYPE_CONTEXT is NULL. */ + if (!TYPE_CONTEXT (t)) + return false; + + return true; +} + +/* Return true if T is in anonymous namespace. + This works only on those C++ types with linkage defined. */ + +inline bool +type_in_anonymous_namespace_p (const_tree t) +{ + gcc_checking_assert (type_with_linkage_p (t)); + + if (!TREE_PUBLIC (TYPE_STUB_DECL (t))) + { + /* C++ FE uses magic as assembler names of anonymous types. + verify that this match with type_in_anonymous_namespace_p. */ + gcc_checking_assert (!in_lto_p || !DECL_ASSEMBLER_NAME_SET_P (t) + || !strcmp + ("", + IDENTIFIER_POINTER + (DECL_ASSEMBLER_NAME (TYPE_NAME (t))))); + return true; + } + return false; +} + +/* Return true of T is type with One Definition Rule info attached. + It means that either it is anonymous type or it has assembler name + set. */ + +inline bool +odr_type_p (const_tree t) +{ + /* We do not have this information when not in LTO, but we do not need + to care, since it is used only for type merging. */ + gcc_checking_assert (in_lto_p || flag_lto); + + if (!type_with_linkage_p (t)) + return false; + + /* To support -fno-lto-odr-type-merging consider types with vtables ODR. */ + if (type_in_anonymous_namespace_p (t)) + return true; + + if (TYPE_NAME (t) && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL + && DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (t))) + { + /* C++ FE uses magic as assembler names of anonymous types. + verify that this match with type_in_anonymous_namespace_p. */ + gcc_checking_assert (strcmp ("", + IDENTIFIER_POINTER + (DECL_ASSEMBLER_NAME (TYPE_NAME (t))))); + return true; + } + return false; +} + +#endif /* GCC_IPA_UTILS_H */ + + diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ira-int.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ira-int.h new file mode 100644 index 0000000..f547cea --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ira-int.h @@ -0,0 +1,1511 @@ +/* Integrated Register Allocator (IRA) intercommunication header file. + Copyright (C) 2006-2017 Free Software Foundation, Inc. + Contributed by Vladimir Makarov . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_IRA_INT_H +#define GCC_IRA_INT_H + +#include "recog.h" + +/* To provide consistency in naming, all IRA external variables, + functions, common typedefs start with prefix ira_. */ + +#if CHECKING_P +#define ENABLE_IRA_CHECKING +#endif + +#ifdef ENABLE_IRA_CHECKING +#define ira_assert(c) gcc_assert (c) +#else +/* Always define and include C, so that warnings for empty body in an + 'if' statement and unused variable do not occur. */ +#define ira_assert(c) ((void)(0 && (c))) +#endif + +/* Compute register frequency from edge frequency FREQ. It is + analogous to REG_FREQ_FROM_BB. When optimizing for size, or + profile driven feedback is available and the function is never + executed, frequency is always equivalent. Otherwise rescale the + edge frequency. */ +#define REG_FREQ_FROM_EDGE_FREQ(freq) \ + (optimize_function_for_size_p (cfun) \ + ? REG_FREQ_MAX : (freq * REG_FREQ_MAX / BB_FREQ_MAX) \ + ? (freq * REG_FREQ_MAX / BB_FREQ_MAX) : 1) + +/* A modified value of flag `-fira-verbose' used internally. */ +extern int internal_flag_ira_verbose; + +/* Dump file of the allocator if it is not NULL. */ +extern FILE *ira_dump_file; + +/* Typedefs for pointers to allocno live range, allocno, and copy of + allocnos. */ +typedef struct live_range *live_range_t; +typedef struct ira_allocno *ira_allocno_t; +typedef struct ira_allocno_pref *ira_pref_t; +typedef struct ira_allocno_copy *ira_copy_t; +typedef struct ira_object *ira_object_t; + +/* Definition of vector of allocnos and copies. */ + +/* Typedef for pointer to the subsequent structure. */ +typedef struct ira_loop_tree_node *ira_loop_tree_node_t; + +typedef unsigned short move_table[N_REG_CLASSES]; + +/* In general case, IRA is a regional allocator. The regions are + nested and form a tree. Currently regions are natural loops. The + following structure describes loop tree node (representing basic + block or loop). We need such tree because the loop tree from + cfgloop.h is not convenient for the optimization: basic blocks are + not a part of the tree from cfgloop.h. We also use the nodes for + storing additional information about basic blocks/loops for the + register allocation purposes. */ +struct ira_loop_tree_node +{ + /* The node represents basic block if children == NULL. */ + basic_block bb; /* NULL for loop. */ + /* NULL for BB or for loop tree root if we did not build CFG loop tree. */ + struct loop *loop; + /* NEXT/SUBLOOP_NEXT is the next node/loop-node of the same parent. + SUBLOOP_NEXT is always NULL for BBs. */ + ira_loop_tree_node_t subloop_next, next; + /* CHILDREN/SUBLOOPS is the first node/loop-node immediately inside + the node. They are NULL for BBs. */ + ira_loop_tree_node_t subloops, children; + /* The node immediately containing given node. */ + ira_loop_tree_node_t parent; + + /* Loop level in range [0, ira_loop_tree_height). */ + int level; + + /* All the following members are defined only for nodes representing + loops. */ + + /* The loop number from CFG loop tree. The root number is 0. */ + int loop_num; + + /* True if the loop was marked for removal from the register + allocation. */ + bool to_remove_p; + + /* Allocnos in the loop corresponding to their regnos. If it is + NULL the loop does not form a separate register allocation region + (e.g. because it has abnormal enter/exit edges and we can not put + code for register shuffling on the edges if a different + allocation is used for a pseudo-register on different sides of + the edges). Caps are not in the map (remember we can have more + one cap with the same regno in a region). */ + ira_allocno_t *regno_allocno_map; + + /* True if there is an entry to given loop not from its parent (or + grandparent) basic block. For example, it is possible for two + adjacent loops inside another loop. */ + bool entered_from_non_parent_p; + + /* Maximal register pressure inside loop for given register class + (defined only for the pressure classes). */ + int reg_pressure[N_REG_CLASSES]; + + /* Numbers of allocnos referred or living in the loop node (except + for its subloops). */ + bitmap all_allocnos; + + /* Numbers of allocnos living at the loop borders. */ + bitmap border_allocnos; + + /* Regnos of pseudos modified in the loop node (including its + subloops). */ + bitmap modified_regnos; + + /* Numbers of copies referred in the corresponding loop. */ + bitmap local_copies; +}; + +/* The root of the loop tree corresponding to the all function. */ +extern ira_loop_tree_node_t ira_loop_tree_root; + +/* Height of the loop tree. */ +extern int ira_loop_tree_height; + +/* All nodes representing basic blocks are referred through the + following array. We can not use basic block member `aux' for this + because it is used for insertion of insns on edges. */ +extern ira_loop_tree_node_t ira_bb_nodes; + +/* Two access macros to the nodes representing basic blocks. */ +#if defined ENABLE_IRA_CHECKING && (GCC_VERSION >= 2007) +#define IRA_BB_NODE_BY_INDEX(index) __extension__ \ +(({ ira_loop_tree_node_t _node = (&ira_bb_nodes[index]); \ + if (_node->children != NULL || _node->loop != NULL || _node->bb == NULL)\ + { \ + fprintf (stderr, \ + "\n%s: %d: error in %s: it is not a block node\n", \ + __FILE__, __LINE__, __FUNCTION__); \ + gcc_unreachable (); \ + } \ + _node; })) +#else +#define IRA_BB_NODE_BY_INDEX(index) (&ira_bb_nodes[index]) +#endif + +#define IRA_BB_NODE(bb) IRA_BB_NODE_BY_INDEX ((bb)->index) + +/* All nodes representing loops are referred through the following + array. */ +extern ira_loop_tree_node_t ira_loop_nodes; + +/* Two access macros to the nodes representing loops. */ +#if defined ENABLE_IRA_CHECKING && (GCC_VERSION >= 2007) +#define IRA_LOOP_NODE_BY_INDEX(index) __extension__ \ +(({ ira_loop_tree_node_t const _node = (&ira_loop_nodes[index]); \ + if (_node->children == NULL || _node->bb != NULL \ + || (_node->loop == NULL && current_loops != NULL)) \ + { \ + fprintf (stderr, \ + "\n%s: %d: error in %s: it is not a loop node\n", \ + __FILE__, __LINE__, __FUNCTION__); \ + gcc_unreachable (); \ + } \ + _node; })) +#else +#define IRA_LOOP_NODE_BY_INDEX(index) (&ira_loop_nodes[index]) +#endif + +#define IRA_LOOP_NODE(loop) IRA_LOOP_NODE_BY_INDEX ((loop)->num) + + +/* The structure describes program points where a given allocno lives. + If the live ranges of two allocnos are intersected, the allocnos + are in conflict. */ +struct live_range +{ + /* Object whose live range is described by given structure. */ + ira_object_t object; + /* Program point range. */ + int start, finish; + /* Next structure describing program points where the allocno + lives. */ + live_range_t next; + /* Pointer to structures with the same start/finish. */ + live_range_t start_next, finish_next; +}; + +/* Program points are enumerated by numbers from range + 0..IRA_MAX_POINT-1. There are approximately two times more program + points than insns. Program points are places in the program where + liveness info can be changed. In most general case (there are more + complicated cases too) some program points correspond to places + where input operand dies and other ones correspond to places where + output operands are born. */ +extern int ira_max_point; + +/* Arrays of size IRA_MAX_POINT mapping a program point to the allocno + live ranges with given start/finish point. */ +extern live_range_t *ira_start_point_ranges, *ira_finish_point_ranges; + +/* A structure representing conflict information for an allocno + (or one of its subwords). */ +struct ira_object +{ + /* The allocno associated with this record. */ + ira_allocno_t allocno; + /* Vector of accumulated conflicting conflict_redords with NULL end + marker (if OBJECT_CONFLICT_VEC_P is true) or conflict bit vector + otherwise. */ + void *conflicts_array; + /* Pointer to structures describing at what program point the + object lives. We always maintain the list in such way that *the + ranges in the list are not intersected and ordered by decreasing + their program points*. */ + live_range_t live_ranges; + /* The subword within ALLOCNO which is represented by this object. + Zero means the lowest-order subword (or the entire allocno in case + it is not being tracked in subwords). */ + int subword; + /* Allocated size of the conflicts array. */ + unsigned int conflicts_array_size; + /* A unique number for every instance of this structure, which is used + to represent it in conflict bit vectors. */ + int id; + /* Before building conflicts, MIN and MAX are initialized to + correspondingly minimal and maximal points of the accumulated + live ranges. Afterwards, they hold the minimal and maximal ids + of other ira_objects that this one can conflict with. */ + int min, max; + /* Initial and accumulated hard registers conflicting with this + object and as a consequences can not be assigned to the allocno. + All non-allocatable hard regs and hard regs of register classes + different from given allocno one are included in the sets. */ + HARD_REG_SET conflict_hard_regs, total_conflict_hard_regs; + /* Number of accumulated conflicts in the vector of conflicting + objects. */ + int num_accumulated_conflicts; + /* TRUE if conflicts are represented by a vector of pointers to + ira_object structures. Otherwise, we use a bit vector indexed + by conflict ID numbers. */ + unsigned int conflict_vec_p : 1; +}; + +/* A structure representing an allocno (allocation entity). Allocno + represents a pseudo-register in an allocation region. If + pseudo-register does not live in a region but it lives in the + nested regions, it is represented in the region by special allocno + called *cap*. There may be more one cap representing the same + pseudo-register in region. It means that the corresponding + pseudo-register lives in more one non-intersected subregion. */ +struct ira_allocno +{ + /* The allocno order number starting with 0. Each allocno has an + unique number and the number is never changed for the + allocno. */ + int num; + /* Regno for allocno or cap. */ + int regno; + /* Mode of the allocno which is the mode of the corresponding + pseudo-register. */ + ENUM_BITFIELD (machine_mode) mode : 8; + /* Widest mode of the allocno which in at least one case could be + for paradoxical subregs where wmode > mode. */ + ENUM_BITFIELD (machine_mode) wmode : 8; + /* Register class which should be used for allocation for given + allocno. NO_REGS means that we should use memory. */ + ENUM_BITFIELD (reg_class) aclass : 16; + /* During the reload, value TRUE means that we should not reassign a + hard register to the allocno got memory earlier. It is set up + when we removed memory-memory move insn before each iteration of + the reload. */ + unsigned int dont_reassign_p : 1; +#ifdef STACK_REGS + /* Set to TRUE if allocno can't be assigned to the stack hard + register correspondingly in this region and area including the + region and all its subregions recursively. */ + unsigned int no_stack_reg_p : 1, total_no_stack_reg_p : 1; +#endif + /* TRUE value means that there is no sense to spill the allocno + during coloring because the spill will result in additional + reloads in reload pass. */ + unsigned int bad_spill_p : 1; + /* TRUE if a hard register or memory has been assigned to the + allocno. */ + unsigned int assigned_p : 1; + /* TRUE if conflicts for given allocno are represented by vector of + pointers to the conflicting allocnos. Otherwise, we use a bit + vector where a bit with given index represents allocno with the + same number. */ + unsigned int conflict_vec_p : 1; + /* Hard register assigned to given allocno. Negative value means + that memory was allocated to the allocno. During the reload, + spilled allocno has value equal to the corresponding stack slot + number (0, ...) - 2. Value -1 is used for allocnos spilled by the + reload (at this point pseudo-register has only one allocno) which + did not get stack slot yet. */ + signed int hard_regno : 16; + /* Allocnos with the same regno are linked by the following member. + Allocnos corresponding to inner loops are first in the list (it + corresponds to depth-first traverse of the loops). */ + ira_allocno_t next_regno_allocno; + /* There may be different allocnos with the same regno in different + regions. Allocnos are bound to the corresponding loop tree node. + Pseudo-register may have only one regular allocno with given loop + tree node but more than one cap (see comments above). */ + ira_loop_tree_node_t loop_tree_node; + /* Accumulated usage references of the allocno. Here and below, + word 'accumulated' means info for given region and all nested + subregions. In this case, 'accumulated' means sum of references + of the corresponding pseudo-register in this region and in all + nested subregions recursively. */ + int nrefs; + /* Accumulated frequency of usage of the allocno. */ + int freq; + /* Minimal accumulated and updated costs of usage register of the + allocno class. */ + int class_cost, updated_class_cost; + /* Minimal accumulated, and updated costs of memory for the allocno. + At the allocation start, the original and updated costs are + equal. The updated cost may be changed after finishing + allocation in a region and starting allocation in a subregion. + The change reflects the cost of spill/restore code on the + subregion border if we assign memory to the pseudo in the + subregion. */ + int memory_cost, updated_memory_cost; + /* Accumulated number of points where the allocno lives and there is + excess pressure for its class. Excess pressure for a register + class at some point means that there are more allocnos of given + register class living at the point than number of hard-registers + of the class available for the allocation. */ + int excess_pressure_points_num; + /* Allocno hard reg preferences. */ + ira_pref_t allocno_prefs; + /* Copies to other non-conflicting allocnos. The copies can + represent move insn or potential move insn usually because of two + operand insn constraints. */ + ira_copy_t allocno_copies; + /* It is a allocno (cap) representing given allocno on upper loop tree + level. */ + ira_allocno_t cap; + /* It is a link to allocno (cap) on lower loop level represented by + given cap. Null if given allocno is not a cap. */ + ira_allocno_t cap_member; + /* The number of objects tracked in the following array. */ + int num_objects; + /* An array of structures describing conflict information and live + ranges for each object associated with the allocno. There may be + more than one such object in cases where the allocno represents a + multi-word register. */ + ira_object_t objects[2]; + /* Accumulated frequency of calls which given allocno + intersects. */ + int call_freq; + /* Accumulated number of the intersected calls. */ + int calls_crossed_num; + /* The number of calls across which it is live, but which should not + affect register preferences. */ + int cheap_calls_crossed_num; + /* Registers clobbered by intersected calls. */ + HARD_REG_SET crossed_calls_clobbered_regs; + /* Array of usage costs (accumulated and the one updated during + coloring) for each hard register of the allocno class. The + member value can be NULL if all costs are the same and equal to + CLASS_COST. For example, the costs of two different hard + registers can be different if one hard register is callee-saved + and another one is callee-used and the allocno lives through + calls. Another example can be case when for some insn the + corresponding pseudo-register value should be put in specific + register class (e.g. AREG for x86) which is a strict subset of + the allocno class (GENERAL_REGS for x86). We have updated costs + to reflect the situation when the usage cost of a hard register + is decreased because the allocno is connected to another allocno + by a copy and the another allocno has been assigned to the hard + register. */ + int *hard_reg_costs, *updated_hard_reg_costs; + /* Array of decreasing costs (accumulated and the one updated during + coloring) for allocnos conflicting with given allocno for hard + regno of the allocno class. The member value can be NULL if all + costs are the same. These costs are used to reflect preferences + of other allocnos not assigned yet during assigning to given + allocno. */ + int *conflict_hard_reg_costs, *updated_conflict_hard_reg_costs; + /* Different additional data. It is used to decrease size of + allocno data footprint. */ + void *add_data; +}; + + +/* All members of the allocno structures should be accessed only + through the following macros. */ +#define ALLOCNO_NUM(A) ((A)->num) +#define ALLOCNO_REGNO(A) ((A)->regno) +#define ALLOCNO_REG(A) ((A)->reg) +#define ALLOCNO_NEXT_REGNO_ALLOCNO(A) ((A)->next_regno_allocno) +#define ALLOCNO_LOOP_TREE_NODE(A) ((A)->loop_tree_node) +#define ALLOCNO_CAP(A) ((A)->cap) +#define ALLOCNO_CAP_MEMBER(A) ((A)->cap_member) +#define ALLOCNO_NREFS(A) ((A)->nrefs) +#define ALLOCNO_FREQ(A) ((A)->freq) +#define ALLOCNO_HARD_REGNO(A) ((A)->hard_regno) +#define ALLOCNO_CALL_FREQ(A) ((A)->call_freq) +#define ALLOCNO_CALLS_CROSSED_NUM(A) ((A)->calls_crossed_num) +#define ALLOCNO_CHEAP_CALLS_CROSSED_NUM(A) ((A)->cheap_calls_crossed_num) +#define ALLOCNO_CROSSED_CALLS_CLOBBERED_REGS(A) \ + ((A)->crossed_calls_clobbered_regs) +#define ALLOCNO_MEM_OPTIMIZED_DEST(A) ((A)->mem_optimized_dest) +#define ALLOCNO_MEM_OPTIMIZED_DEST_P(A) ((A)->mem_optimized_dest_p) +#define ALLOCNO_SOMEWHERE_RENAMED_P(A) ((A)->somewhere_renamed_p) +#define ALLOCNO_CHILD_RENAMED_P(A) ((A)->child_renamed_p) +#define ALLOCNO_DONT_REASSIGN_P(A) ((A)->dont_reassign_p) +#ifdef STACK_REGS +#define ALLOCNO_NO_STACK_REG_P(A) ((A)->no_stack_reg_p) +#define ALLOCNO_TOTAL_NO_STACK_REG_P(A) ((A)->total_no_stack_reg_p) +#endif +#define ALLOCNO_BAD_SPILL_P(A) ((A)->bad_spill_p) +#define ALLOCNO_ASSIGNED_P(A) ((A)->assigned_p) +#define ALLOCNO_MODE(A) ((A)->mode) +#define ALLOCNO_WMODE(A) ((A)->wmode) +#define ALLOCNO_PREFS(A) ((A)->allocno_prefs) +#define ALLOCNO_COPIES(A) ((A)->allocno_copies) +#define ALLOCNO_HARD_REG_COSTS(A) ((A)->hard_reg_costs) +#define ALLOCNO_UPDATED_HARD_REG_COSTS(A) ((A)->updated_hard_reg_costs) +#define ALLOCNO_CONFLICT_HARD_REG_COSTS(A) \ + ((A)->conflict_hard_reg_costs) +#define ALLOCNO_UPDATED_CONFLICT_HARD_REG_COSTS(A) \ + ((A)->updated_conflict_hard_reg_costs) +#define ALLOCNO_CLASS(A) ((A)->aclass) +#define ALLOCNO_CLASS_COST(A) ((A)->class_cost) +#define ALLOCNO_UPDATED_CLASS_COST(A) ((A)->updated_class_cost) +#define ALLOCNO_MEMORY_COST(A) ((A)->memory_cost) +#define ALLOCNO_UPDATED_MEMORY_COST(A) ((A)->updated_memory_cost) +#define ALLOCNO_EXCESS_PRESSURE_POINTS_NUM(A) \ + ((A)->excess_pressure_points_num) +#define ALLOCNO_OBJECT(A,N) ((A)->objects[N]) +#define ALLOCNO_NUM_OBJECTS(A) ((A)->num_objects) +#define ALLOCNO_ADD_DATA(A) ((A)->add_data) + +/* Typedef for pointer to the subsequent structure. */ +typedef struct ira_emit_data *ira_emit_data_t; + +/* Allocno bound data used for emit pseudo live range split insns and + to flattening IR. */ +struct ira_emit_data +{ + /* TRUE if the allocno assigned to memory was a destination of + removed move (see ira-emit.c) at loop exit because the value of + the corresponding pseudo-register is not changed inside the + loop. */ + unsigned int mem_optimized_dest_p : 1; + /* TRUE if the corresponding pseudo-register has disjoint live + ranges and the other allocnos of the pseudo-register except this + one changed REG. */ + unsigned int somewhere_renamed_p : 1; + /* TRUE if allocno with the same REGNO in a subregion has been + renamed, in other words, got a new pseudo-register. */ + unsigned int child_renamed_p : 1; + /* Final rtx representation of the allocno. */ + rtx reg; + /* Non NULL if we remove restoring value from given allocno to + MEM_OPTIMIZED_DEST at loop exit (see ira-emit.c) because the + allocno value is not changed inside the loop. */ + ira_allocno_t mem_optimized_dest; +}; + +#define ALLOCNO_EMIT_DATA(a) ((ira_emit_data_t) ALLOCNO_ADD_DATA (a)) + +/* Data used to emit live range split insns and to flattening IR. */ +extern ira_emit_data_t ira_allocno_emit_data; + +/* Abbreviation for frequent emit data access. */ +static inline rtx +allocno_emit_reg (ira_allocno_t a) +{ + return ALLOCNO_EMIT_DATA (a)->reg; +} + +#define OBJECT_ALLOCNO(O) ((O)->allocno) +#define OBJECT_SUBWORD(O) ((O)->subword) +#define OBJECT_CONFLICT_ARRAY(O) ((O)->conflicts_array) +#define OBJECT_CONFLICT_VEC(O) ((ira_object_t *)(O)->conflicts_array) +#define OBJECT_CONFLICT_BITVEC(O) ((IRA_INT_TYPE *)(O)->conflicts_array) +#define OBJECT_CONFLICT_ARRAY_SIZE(O) ((O)->conflicts_array_size) +#define OBJECT_CONFLICT_VEC_P(O) ((O)->conflict_vec_p) +#define OBJECT_NUM_CONFLICTS(O) ((O)->num_accumulated_conflicts) +#define OBJECT_CONFLICT_HARD_REGS(O) ((O)->conflict_hard_regs) +#define OBJECT_TOTAL_CONFLICT_HARD_REGS(O) ((O)->total_conflict_hard_regs) +#define OBJECT_MIN(O) ((O)->min) +#define OBJECT_MAX(O) ((O)->max) +#define OBJECT_CONFLICT_ID(O) ((O)->id) +#define OBJECT_LIVE_RANGES(O) ((O)->live_ranges) + +/* Map regno -> allocnos with given regno (see comments for + allocno member `next_regno_allocno'). */ +extern ira_allocno_t *ira_regno_allocno_map; + +/* Array of references to all allocnos. The order number of the + allocno corresponds to the index in the array. Removed allocnos + have NULL element value. */ +extern ira_allocno_t *ira_allocnos; + +/* The size of the previous array. */ +extern int ira_allocnos_num; + +/* Map a conflict id to its corresponding ira_object structure. */ +extern ira_object_t *ira_object_id_map; + +/* The size of the previous array. */ +extern int ira_objects_num; + +/* The following structure represents a hard register preference of + allocno. The preference represent move insns or potential move + insns usually because of two operand insn constraints. One move + operand is a hard register. */ +struct ira_allocno_pref +{ + /* The unique order number of the preference node starting with 0. */ + int num; + /* Preferred hard register. */ + int hard_regno; + /* Accumulated execution frequency of insns from which the + preference created. */ + int freq; + /* Given allocno. */ + ira_allocno_t allocno; + /* All preferences with the same allocno are linked by the following + member. */ + ira_pref_t next_pref; +}; + +/* Array of references to all allocno preferences. The order number + of the preference corresponds to the index in the array. */ +extern ira_pref_t *ira_prefs; + +/* Size of the previous array. */ +extern int ira_prefs_num; + +/* The following structure represents a copy of two allocnos. The + copies represent move insns or potential move insns usually because + of two operand insn constraints. To remove register shuffle, we + also create copies between allocno which is output of an insn and + allocno becoming dead in the insn. */ +struct ira_allocno_copy +{ + /* The unique order number of the copy node starting with 0. */ + int num; + /* Allocnos connected by the copy. The first allocno should have + smaller order number than the second one. */ + ira_allocno_t first, second; + /* Execution frequency of the copy. */ + int freq; + bool constraint_p; + /* It is a move insn which is an origin of the copy. The member + value for the copy representing two operand insn constraints or + for the copy created to remove register shuffle is NULL. In last + case the copy frequency is smaller than the corresponding insn + execution frequency. */ + rtx_insn *insn; + /* All copies with the same allocno as FIRST are linked by the two + following members. */ + ira_copy_t prev_first_allocno_copy, next_first_allocno_copy; + /* All copies with the same allocno as SECOND are linked by the two + following members. */ + ira_copy_t prev_second_allocno_copy, next_second_allocno_copy; + /* Region from which given copy is originated. */ + ira_loop_tree_node_t loop_tree_node; +}; + +/* Array of references to all copies. The order number of the copy + corresponds to the index in the array. Removed copies have NULL + element value. */ +extern ira_copy_t *ira_copies; + +/* Size of the previous array. */ +extern int ira_copies_num; + +/* The following structure describes a stack slot used for spilled + pseudo-registers. */ +struct ira_spilled_reg_stack_slot +{ + /* pseudo-registers assigned to the stack slot. */ + bitmap_head spilled_regs; + /* RTL representation of the stack slot. */ + rtx mem; + /* Size of the stack slot. */ + unsigned int width; +}; + +/* The number of elements in the following array. */ +extern int ira_spilled_reg_stack_slots_num; + +/* The following array contains info about spilled pseudo-registers + stack slots used in current function so far. */ +extern struct ira_spilled_reg_stack_slot *ira_spilled_reg_stack_slots; + +/* Correspondingly overall cost of the allocation, cost of the + allocnos assigned to hard-registers, cost of the allocnos assigned + to memory, cost of loads, stores and register move insns generated + for pseudo-register live range splitting (see ira-emit.c). */ +extern int64_t ira_overall_cost; +extern int64_t ira_reg_cost, ira_mem_cost; +extern int64_t ira_load_cost, ira_store_cost, ira_shuffle_cost; +extern int ira_move_loops_num, ira_additional_jumps_num; + + +/* This page contains a bitset implementation called 'min/max sets' used to + record conflicts in IRA. + They are named min/maxs set since we keep track of a minimum and a maximum + bit number for each set representing the bounds of valid elements. Otherwise, + the implementation resembles sbitmaps in that we store an array of integers + whose bits directly represent the members of the set. */ + +/* The type used as elements in the array, and the number of bits in + this type. */ + +#define IRA_INT_BITS HOST_BITS_PER_WIDE_INT +#define IRA_INT_TYPE HOST_WIDE_INT + +/* Set, clear or test bit number I in R, a bit vector of elements with + minimal index and maximal index equal correspondingly to MIN and + MAX. */ +#if defined ENABLE_IRA_CHECKING && (GCC_VERSION >= 2007) + +#define SET_MINMAX_SET_BIT(R, I, MIN, MAX) __extension__ \ + (({ int _min = (MIN), _max = (MAX), _i = (I); \ + if (_i < _min || _i > _max) \ + { \ + fprintf (stderr, \ + "\n%s: %d: error in %s: %d not in range [%d,%d]\n", \ + __FILE__, __LINE__, __FUNCTION__, _i, _min, _max); \ + gcc_unreachable (); \ + } \ + ((R)[(unsigned) (_i - _min) / IRA_INT_BITS] \ + |= ((IRA_INT_TYPE) 1 << ((unsigned) (_i - _min) % IRA_INT_BITS))); })) + + +#define CLEAR_MINMAX_SET_BIT(R, I, MIN, MAX) __extension__ \ + (({ int _min = (MIN), _max = (MAX), _i = (I); \ + if (_i < _min || _i > _max) \ + { \ + fprintf (stderr, \ + "\n%s: %d: error in %s: %d not in range [%d,%d]\n", \ + __FILE__, __LINE__, __FUNCTION__, _i, _min, _max); \ + gcc_unreachable (); \ + } \ + ((R)[(unsigned) (_i - _min) / IRA_INT_BITS] \ + &= ~((IRA_INT_TYPE) 1 << ((unsigned) (_i - _min) % IRA_INT_BITS))); })) + +#define TEST_MINMAX_SET_BIT(R, I, MIN, MAX) __extension__ \ + (({ int _min = (MIN), _max = (MAX), _i = (I); \ + if (_i < _min || _i > _max) \ + { \ + fprintf (stderr, \ + "\n%s: %d: error in %s: %d not in range [%d,%d]\n", \ + __FILE__, __LINE__, __FUNCTION__, _i, _min, _max); \ + gcc_unreachable (); \ + } \ + ((R)[(unsigned) (_i - _min) / IRA_INT_BITS] \ + & ((IRA_INT_TYPE) 1 << ((unsigned) (_i - _min) % IRA_INT_BITS))); })) + +#else + +#define SET_MINMAX_SET_BIT(R, I, MIN, MAX) \ + ((R)[(unsigned) ((I) - (MIN)) / IRA_INT_BITS] \ + |= ((IRA_INT_TYPE) 1 << ((unsigned) ((I) - (MIN)) % IRA_INT_BITS))) + +#define CLEAR_MINMAX_SET_BIT(R, I, MIN, MAX) \ + ((R)[(unsigned) ((I) - (MIN)) / IRA_INT_BITS] \ + &= ~((IRA_INT_TYPE) 1 << ((unsigned) ((I) - (MIN)) % IRA_INT_BITS))) + +#define TEST_MINMAX_SET_BIT(R, I, MIN, MAX) \ + ((R)[(unsigned) ((I) - (MIN)) / IRA_INT_BITS] \ + & ((IRA_INT_TYPE) 1 << ((unsigned) ((I) - (MIN)) % IRA_INT_BITS))) + +#endif + +/* The iterator for min/max sets. */ +struct minmax_set_iterator { + + /* Array containing the bit vector. */ + IRA_INT_TYPE *vec; + + /* The number of the current element in the vector. */ + unsigned int word_num; + + /* The number of bits in the bit vector. */ + unsigned int nel; + + /* The current bit index of the bit vector. */ + unsigned int bit_num; + + /* Index corresponding to the 1st bit of the bit vector. */ + int start_val; + + /* The word of the bit vector currently visited. */ + unsigned IRA_INT_TYPE word; +}; + +/* Initialize the iterator I for bit vector VEC containing minimal and + maximal values MIN and MAX. */ +static inline void +minmax_set_iter_init (minmax_set_iterator *i, IRA_INT_TYPE *vec, int min, + int max) +{ + i->vec = vec; + i->word_num = 0; + i->nel = max < min ? 0 : max - min + 1; + i->start_val = min; + i->bit_num = 0; + i->word = i->nel == 0 ? 0 : vec[0]; +} + +/* Return TRUE if we have more allocnos to visit, in which case *N is + set to the number of the element to be visited. Otherwise, return + FALSE. */ +static inline bool +minmax_set_iter_cond (minmax_set_iterator *i, int *n) +{ + /* Skip words that are zeros. */ + for (; i->word == 0; i->word = i->vec[i->word_num]) + { + i->word_num++; + i->bit_num = i->word_num * IRA_INT_BITS; + + /* If we have reached the end, break. */ + if (i->bit_num >= i->nel) + return false; + } + + /* Skip bits that are zero. */ + for (; (i->word & 1) == 0; i->word >>= 1) + i->bit_num++; + + *n = (int) i->bit_num + i->start_val; + + return true; +} + +/* Advance to the next element in the set. */ +static inline void +minmax_set_iter_next (minmax_set_iterator *i) +{ + i->word >>= 1; + i->bit_num++; +} + +/* Loop over all elements of a min/max set given by bit vector VEC and + their minimal and maximal values MIN and MAX. In each iteration, N + is set to the number of next allocno. ITER is an instance of + minmax_set_iterator used to iterate over the set. */ +#define FOR_EACH_BIT_IN_MINMAX_SET(VEC, MIN, MAX, N, ITER) \ + for (minmax_set_iter_init (&(ITER), (VEC), (MIN), (MAX)); \ + minmax_set_iter_cond (&(ITER), &(N)); \ + minmax_set_iter_next (&(ITER))) + +struct target_ira_int { + ~target_ira_int (); + + void free_ira_costs (); + void free_register_move_costs (); + + /* Initialized once. It is a maximal possible size of the allocated + struct costs. */ + size_t x_max_struct_costs_size; + + /* Allocated and initialized once, and used to initialize cost values + for each insn. */ + struct costs *x_init_cost; + + /* Allocated once, and used for temporary purposes. */ + struct costs *x_temp_costs; + + /* Allocated once, and used for the cost calculation. */ + struct costs *x_op_costs[MAX_RECOG_OPERANDS]; + struct costs *x_this_op_costs[MAX_RECOG_OPERANDS]; + + /* Hard registers that can not be used for the register allocator for + all functions of the current compilation unit. */ + HARD_REG_SET x_no_unit_alloc_regs; + + /* Map: hard regs X modes -> set of hard registers for storing value + of given mode starting with given hard register. */ + HARD_REG_SET (x_ira_reg_mode_hard_regset + [FIRST_PSEUDO_REGISTER][NUM_MACHINE_MODES]); + + /* Maximum cost of moving from a register in one class to a register + in another class. Based on TARGET_REGISTER_MOVE_COST. */ + move_table *x_ira_register_move_cost[MAX_MACHINE_MODE]; + + /* Similar, but here we don't have to move if the first index is a + subset of the second so in that case the cost is zero. */ + move_table *x_ira_may_move_in_cost[MAX_MACHINE_MODE]; + + /* Similar, but here we don't have to move if the first index is a + superset of the second so in that case the cost is zero. */ + move_table *x_ira_may_move_out_cost[MAX_MACHINE_MODE]; + + /* Keep track of the last mode we initialized move costs for. */ + int x_last_mode_for_init_move_cost; + + /* Array analog of the macro MEMORY_MOVE_COST but they contain maximal + cost not minimal. */ + short int x_ira_max_memory_move_cost[MAX_MACHINE_MODE][N_REG_CLASSES][2]; + + /* Map class->true if class is a possible allocno class, false + otherwise. */ + bool x_ira_reg_allocno_class_p[N_REG_CLASSES]; + + /* Map class->true if class is a pressure class, false otherwise. */ + bool x_ira_reg_pressure_class_p[N_REG_CLASSES]; + + /* Array of the number of hard registers of given class which are + available for allocation. The order is defined by the hard + register numbers. */ + short x_ira_non_ordered_class_hard_regs[N_REG_CLASSES][FIRST_PSEUDO_REGISTER]; + + /* Index (in ira_class_hard_regs; for given register class and hard + register (in general case a hard register can belong to several + register classes;. The index is negative for hard registers + unavailable for the allocation. */ + short x_ira_class_hard_reg_index[N_REG_CLASSES][FIRST_PSEUDO_REGISTER]; + + /* Index [CL][M] contains R if R appears somewhere in a register of the form: + + (reg:M R'), R' not in x_ira_prohibited_class_mode_regs[CL][M] + + For example, if: + + - (reg:M 2) is valid and occupies two registers; + - register 2 belongs to CL; and + - register 3 belongs to the same pressure class as CL + + then (reg:M 2) contributes to [CL][M] and registers 2 and 3 will be + in the set. */ + HARD_REG_SET x_ira_useful_class_mode_regs[N_REG_CLASSES][NUM_MACHINE_MODES]; + + /* The value is number of elements in the subsequent array. */ + int x_ira_important_classes_num; + + /* The array containing all non-empty classes. Such classes is + important for calculation of the hard register usage costs. */ + enum reg_class x_ira_important_classes[N_REG_CLASSES]; + + /* The array containing indexes of important classes in the previous + array. The array elements are defined only for important + classes. */ + int x_ira_important_class_nums[N_REG_CLASSES]; + + /* Map class->true if class is an uniform class, false otherwise. */ + bool x_ira_uniform_class_p[N_REG_CLASSES]; + + /* The biggest important class inside of intersection of the two + classes (that is calculated taking only hard registers available + for allocation into account;. If the both classes contain no hard + registers available for allocation, the value is calculated with + taking all hard-registers including fixed ones into account. */ + enum reg_class x_ira_reg_class_intersect[N_REG_CLASSES][N_REG_CLASSES]; + + /* Classes with end marker LIM_REG_CLASSES which are intersected with + given class (the first index). That includes given class itself. + This is calculated taking only hard registers available for + allocation into account. */ + enum reg_class x_ira_reg_class_super_classes[N_REG_CLASSES][N_REG_CLASSES]; + + /* The biggest (smallest) important class inside of (covering) union + of the two classes (that is calculated taking only hard registers + available for allocation into account). If the both classes + contain no hard registers available for allocation, the value is + calculated with taking all hard-registers including fixed ones + into account. In other words, the value is the corresponding + reg_class_subunion (reg_class_superunion) value. */ + enum reg_class x_ira_reg_class_subunion[N_REG_CLASSES][N_REG_CLASSES]; + enum reg_class x_ira_reg_class_superunion[N_REG_CLASSES][N_REG_CLASSES]; + + /* For each reg class, table listing all the classes contained in it + (excluding the class itself. Non-allocatable registers are + excluded from the consideration). */ + enum reg_class x_alloc_reg_class_subclasses[N_REG_CLASSES][N_REG_CLASSES]; + + /* Array whose values are hard regset of hard registers for which + move of the hard register in given mode into itself is + prohibited. */ + HARD_REG_SET x_ira_prohibited_mode_move_regs[NUM_MACHINE_MODES]; + + /* Flag of that the above array has been initialized. */ + bool x_ira_prohibited_mode_move_regs_initialized_p; +}; + +extern struct target_ira_int default_target_ira_int; +#if SWITCHABLE_TARGET +extern struct target_ira_int *this_target_ira_int; +#else +#define this_target_ira_int (&default_target_ira_int) +#endif + +#define ira_reg_mode_hard_regset \ + (this_target_ira_int->x_ira_reg_mode_hard_regset) +#define ira_register_move_cost \ + (this_target_ira_int->x_ira_register_move_cost) +#define ira_max_memory_move_cost \ + (this_target_ira_int->x_ira_max_memory_move_cost) +#define ira_may_move_in_cost \ + (this_target_ira_int->x_ira_may_move_in_cost) +#define ira_may_move_out_cost \ + (this_target_ira_int->x_ira_may_move_out_cost) +#define ira_reg_allocno_class_p \ + (this_target_ira_int->x_ira_reg_allocno_class_p) +#define ira_reg_pressure_class_p \ + (this_target_ira_int->x_ira_reg_pressure_class_p) +#define ira_non_ordered_class_hard_regs \ + (this_target_ira_int->x_ira_non_ordered_class_hard_regs) +#define ira_class_hard_reg_index \ + (this_target_ira_int->x_ira_class_hard_reg_index) +#define ira_useful_class_mode_regs \ + (this_target_ira_int->x_ira_useful_class_mode_regs) +#define ira_important_classes_num \ + (this_target_ira_int->x_ira_important_classes_num) +#define ira_important_classes \ + (this_target_ira_int->x_ira_important_classes) +#define ira_important_class_nums \ + (this_target_ira_int->x_ira_important_class_nums) +#define ira_uniform_class_p \ + (this_target_ira_int->x_ira_uniform_class_p) +#define ira_reg_class_intersect \ + (this_target_ira_int->x_ira_reg_class_intersect) +#define ira_reg_class_super_classes \ + (this_target_ira_int->x_ira_reg_class_super_classes) +#define ira_reg_class_subunion \ + (this_target_ira_int->x_ira_reg_class_subunion) +#define ira_reg_class_superunion \ + (this_target_ira_int->x_ira_reg_class_superunion) +#define ira_prohibited_mode_move_regs \ + (this_target_ira_int->x_ira_prohibited_mode_move_regs) + +/* ira.c: */ + +extern void *ira_allocate (size_t); +extern void ira_free (void *addr); +extern bitmap ira_allocate_bitmap (void); +extern void ira_free_bitmap (bitmap); +extern void ira_print_disposition (FILE *); +extern void ira_debug_disposition (void); +extern void ira_debug_allocno_classes (void); +extern void ira_init_register_move_cost (machine_mode); +extern void ira_setup_alts (rtx_insn *insn, HARD_REG_SET &alts); +extern int ira_get_dup_out_num (int op_num, HARD_REG_SET &alts); + +/* ira-build.c */ + +/* The current loop tree node and its regno allocno map. */ +extern ira_loop_tree_node_t ira_curr_loop_tree_node; +extern ira_allocno_t *ira_curr_regno_allocno_map; + +extern void ira_debug_pref (ira_pref_t); +extern void ira_debug_prefs (void); +extern void ira_debug_allocno_prefs (ira_allocno_t); + +extern void ira_debug_copy (ira_copy_t); +extern void debug (ira_allocno_copy &ref); +extern void debug (ira_allocno_copy *ptr); + +extern void ira_debug_copies (void); +extern void ira_debug_allocno_copies (ira_allocno_t); +extern void debug (ira_allocno &ref); +extern void debug (ira_allocno *ptr); + +extern void ira_traverse_loop_tree (bool, ira_loop_tree_node_t, + void (*) (ira_loop_tree_node_t), + void (*) (ira_loop_tree_node_t)); +extern ira_allocno_t ira_parent_allocno (ira_allocno_t); +extern ira_allocno_t ira_parent_or_cap_allocno (ira_allocno_t); +extern ira_allocno_t ira_create_allocno (int, bool, ira_loop_tree_node_t); +extern void ira_create_allocno_objects (ira_allocno_t); +extern void ira_set_allocno_class (ira_allocno_t, enum reg_class); +extern bool ira_conflict_vector_profitable_p (ira_object_t, int); +extern void ira_allocate_conflict_vec (ira_object_t, int); +extern void ira_allocate_object_conflicts (ira_object_t, int); +extern void ior_hard_reg_conflicts (ira_allocno_t, HARD_REG_SET *); +extern void ira_print_expanded_allocno (ira_allocno_t); +extern void ira_add_live_range_to_object (ira_object_t, int, int); +extern live_range_t ira_create_live_range (ira_object_t, int, int, + live_range_t); +extern live_range_t ira_copy_live_range_list (live_range_t); +extern live_range_t ira_merge_live_ranges (live_range_t, live_range_t); +extern bool ira_live_ranges_intersect_p (live_range_t, live_range_t); +extern void ira_finish_live_range (live_range_t); +extern void ira_finish_live_range_list (live_range_t); +extern void ira_free_allocno_updated_costs (ira_allocno_t); +extern ira_pref_t ira_create_pref (ira_allocno_t, int, int); +extern void ira_add_allocno_pref (ira_allocno_t, int, int); +extern void ira_remove_pref (ira_pref_t); +extern void ira_remove_allocno_prefs (ira_allocno_t); +extern ira_copy_t ira_create_copy (ira_allocno_t, ira_allocno_t, + int, bool, rtx_insn *, + ira_loop_tree_node_t); +extern ira_copy_t ira_add_allocno_copy (ira_allocno_t, ira_allocno_t, int, + bool, rtx_insn *, + ira_loop_tree_node_t); + +extern int *ira_allocate_cost_vector (reg_class_t); +extern void ira_free_cost_vector (int *, reg_class_t); + +extern void ira_flattening (int, int); +extern bool ira_build (void); +extern void ira_destroy (void); + +/* ira-costs.c */ +extern void ira_init_costs_once (void); +extern void ira_init_costs (void); +extern void ira_costs (void); +extern void ira_tune_allocno_costs (void); + +/* ira-lives.c */ + +extern void ira_rebuild_start_finish_chains (void); +extern void ira_print_live_range_list (FILE *, live_range_t); +extern void debug (live_range &ref); +extern void debug (live_range *ptr); +extern void ira_debug_live_range_list (live_range_t); +extern void ira_debug_allocno_live_ranges (ira_allocno_t); +extern void ira_debug_live_ranges (void); +extern void ira_create_allocno_live_ranges (void); +extern void ira_compress_allocno_live_ranges (void); +extern void ira_finish_allocno_live_ranges (void); +extern void ira_implicitly_set_insn_hard_regs (HARD_REG_SET *, + alternative_mask); + +/* ira-conflicts.c */ +extern void ira_debug_conflicts (bool); +extern void ira_build_conflicts (void); + +/* ira-color.c */ +extern void ira_debug_hard_regs_forest (void); +extern int ira_loop_edge_freq (ira_loop_tree_node_t, int, bool); +extern void ira_reassign_conflict_allocnos (int); +extern void ira_initiate_assign (void); +extern void ira_finish_assign (void); +extern void ira_color (void); + +/* ira-emit.c */ +extern void ira_initiate_emit_data (void); +extern void ira_finish_emit_data (void); +extern void ira_emit (bool); + + + +/* Return true if equivalence of pseudo REGNO is not a lvalue. */ +static inline bool +ira_equiv_no_lvalue_p (int regno) +{ + if (regno >= ira_reg_equiv_len) + return false; + return (ira_reg_equiv[regno].constant != NULL_RTX + || ira_reg_equiv[regno].invariant != NULL_RTX + || (ira_reg_equiv[regno].memory != NULL_RTX + && MEM_READONLY_P (ira_reg_equiv[regno].memory))); +} + + + +/* Initialize register costs for MODE if necessary. */ +static inline void +ira_init_register_move_cost_if_necessary (machine_mode mode) +{ + if (ira_register_move_cost[mode] == NULL) + ira_init_register_move_cost (mode); +} + + + +/* The iterator for all allocnos. */ +struct ira_allocno_iterator { + /* The number of the current element in IRA_ALLOCNOS. */ + int n; +}; + +/* Initialize the iterator I. */ +static inline void +ira_allocno_iter_init (ira_allocno_iterator *i) +{ + i->n = 0; +} + +/* Return TRUE if we have more allocnos to visit, in which case *A is + set to the allocno to be visited. Otherwise, return FALSE. */ +static inline bool +ira_allocno_iter_cond (ira_allocno_iterator *i, ira_allocno_t *a) +{ + int n; + + for (n = i->n; n < ira_allocnos_num; n++) + if (ira_allocnos[n] != NULL) + { + *a = ira_allocnos[n]; + i->n = n + 1; + return true; + } + return false; +} + +/* Loop over all allocnos. In each iteration, A is set to the next + allocno. ITER is an instance of ira_allocno_iterator used to iterate + the allocnos. */ +#define FOR_EACH_ALLOCNO(A, ITER) \ + for (ira_allocno_iter_init (&(ITER)); \ + ira_allocno_iter_cond (&(ITER), &(A));) + +/* The iterator for all objects. */ +struct ira_object_iterator { + /* The number of the current element in ira_object_id_map. */ + int n; +}; + +/* Initialize the iterator I. */ +static inline void +ira_object_iter_init (ira_object_iterator *i) +{ + i->n = 0; +} + +/* Return TRUE if we have more objects to visit, in which case *OBJ is + set to the object to be visited. Otherwise, return FALSE. */ +static inline bool +ira_object_iter_cond (ira_object_iterator *i, ira_object_t *obj) +{ + int n; + + for (n = i->n; n < ira_objects_num; n++) + if (ira_object_id_map[n] != NULL) + { + *obj = ira_object_id_map[n]; + i->n = n + 1; + return true; + } + return false; +} + +/* Loop over all objects. In each iteration, OBJ is set to the next + object. ITER is an instance of ira_object_iterator used to iterate + the objects. */ +#define FOR_EACH_OBJECT(OBJ, ITER) \ + for (ira_object_iter_init (&(ITER)); \ + ira_object_iter_cond (&(ITER), &(OBJ));) + +/* The iterator for objects associated with an allocno. */ +struct ira_allocno_object_iterator { + /* The number of the element the allocno's object array. */ + int n; +}; + +/* Initialize the iterator I. */ +static inline void +ira_allocno_object_iter_init (ira_allocno_object_iterator *i) +{ + i->n = 0; +} + +/* Return TRUE if we have more objects to visit in allocno A, in which + case *O is set to the object to be visited. Otherwise, return + FALSE. */ +static inline bool +ira_allocno_object_iter_cond (ira_allocno_object_iterator *i, ira_allocno_t a, + ira_object_t *o) +{ + int n = i->n++; + if (n < ALLOCNO_NUM_OBJECTS (a)) + { + *o = ALLOCNO_OBJECT (a, n); + return true; + } + return false; +} + +/* Loop over all objects associated with allocno A. In each + iteration, O is set to the next object. ITER is an instance of + ira_allocno_object_iterator used to iterate the conflicts. */ +#define FOR_EACH_ALLOCNO_OBJECT(A, O, ITER) \ + for (ira_allocno_object_iter_init (&(ITER)); \ + ira_allocno_object_iter_cond (&(ITER), (A), &(O));) + + +/* The iterator for prefs. */ +struct ira_pref_iterator { + /* The number of the current element in IRA_PREFS. */ + int n; +}; + +/* Initialize the iterator I. */ +static inline void +ira_pref_iter_init (ira_pref_iterator *i) +{ + i->n = 0; +} + +/* Return TRUE if we have more prefs to visit, in which case *PREF is + set to the pref to be visited. Otherwise, return FALSE. */ +static inline bool +ira_pref_iter_cond (ira_pref_iterator *i, ira_pref_t *pref) +{ + int n; + + for (n = i->n; n < ira_prefs_num; n++) + if (ira_prefs[n] != NULL) + { + *pref = ira_prefs[n]; + i->n = n + 1; + return true; + } + return false; +} + +/* Loop over all prefs. In each iteration, P is set to the next + pref. ITER is an instance of ira_pref_iterator used to iterate + the prefs. */ +#define FOR_EACH_PREF(P, ITER) \ + for (ira_pref_iter_init (&(ITER)); \ + ira_pref_iter_cond (&(ITER), &(P));) + + +/* The iterator for copies. */ +struct ira_copy_iterator { + /* The number of the current element in IRA_COPIES. */ + int n; +}; + +/* Initialize the iterator I. */ +static inline void +ira_copy_iter_init (ira_copy_iterator *i) +{ + i->n = 0; +} + +/* Return TRUE if we have more copies to visit, in which case *CP is + set to the copy to be visited. Otherwise, return FALSE. */ +static inline bool +ira_copy_iter_cond (ira_copy_iterator *i, ira_copy_t *cp) +{ + int n; + + for (n = i->n; n < ira_copies_num; n++) + if (ira_copies[n] != NULL) + { + *cp = ira_copies[n]; + i->n = n + 1; + return true; + } + return false; +} + +/* Loop over all copies. In each iteration, C is set to the next + copy. ITER is an instance of ira_copy_iterator used to iterate + the copies. */ +#define FOR_EACH_COPY(C, ITER) \ + for (ira_copy_iter_init (&(ITER)); \ + ira_copy_iter_cond (&(ITER), &(C));) + +/* The iterator for object conflicts. */ +struct ira_object_conflict_iterator { + + /* TRUE if the conflicts are represented by vector of allocnos. */ + bool conflict_vec_p; + + /* The conflict vector or conflict bit vector. */ + void *vec; + + /* The number of the current element in the vector (of type + ira_object_t or IRA_INT_TYPE). */ + unsigned int word_num; + + /* The bit vector size. It is defined only if + OBJECT_CONFLICT_VEC_P is FALSE. */ + unsigned int size; + + /* The current bit index of bit vector. It is defined only if + OBJECT_CONFLICT_VEC_P is FALSE. */ + unsigned int bit_num; + + /* The object id corresponding to the 1st bit of the bit vector. It + is defined only if OBJECT_CONFLICT_VEC_P is FALSE. */ + int base_conflict_id; + + /* The word of bit vector currently visited. It is defined only if + OBJECT_CONFLICT_VEC_P is FALSE. */ + unsigned IRA_INT_TYPE word; +}; + +/* Initialize the iterator I with ALLOCNO conflicts. */ +static inline void +ira_object_conflict_iter_init (ira_object_conflict_iterator *i, + ira_object_t obj) +{ + i->conflict_vec_p = OBJECT_CONFLICT_VEC_P (obj); + i->vec = OBJECT_CONFLICT_ARRAY (obj); + i->word_num = 0; + if (i->conflict_vec_p) + i->size = i->bit_num = i->base_conflict_id = i->word = 0; + else + { + if (OBJECT_MIN (obj) > OBJECT_MAX (obj)) + i->size = 0; + else + i->size = ((OBJECT_MAX (obj) - OBJECT_MIN (obj) + + IRA_INT_BITS) + / IRA_INT_BITS) * sizeof (IRA_INT_TYPE); + i->bit_num = 0; + i->base_conflict_id = OBJECT_MIN (obj); + i->word = (i->size == 0 ? 0 : ((IRA_INT_TYPE *) i->vec)[0]); + } +} + +/* Return TRUE if we have more conflicting allocnos to visit, in which + case *A is set to the allocno to be visited. Otherwise, return + FALSE. */ +static inline bool +ira_object_conflict_iter_cond (ira_object_conflict_iterator *i, + ira_object_t *pobj) +{ + ira_object_t obj; + + if (i->conflict_vec_p) + { + obj = ((ira_object_t *) i->vec)[i->word_num++]; + if (obj == NULL) + return false; + } + else + { + unsigned IRA_INT_TYPE word = i->word; + unsigned int bit_num = i->bit_num; + + /* Skip words that are zeros. */ + for (; word == 0; word = ((IRA_INT_TYPE *) i->vec)[i->word_num]) + { + i->word_num++; + + /* If we have reached the end, break. */ + if (i->word_num * sizeof (IRA_INT_TYPE) >= i->size) + return false; + + bit_num = i->word_num * IRA_INT_BITS; + } + + /* Skip bits that are zero. */ + for (; (word & 1) == 0; word >>= 1) + bit_num++; + + obj = ira_object_id_map[bit_num + i->base_conflict_id]; + i->bit_num = bit_num + 1; + i->word = word >> 1; + } + + *pobj = obj; + return true; +} + +/* Loop over all objects conflicting with OBJ. In each iteration, + CONF is set to the next conflicting object. ITER is an instance + of ira_object_conflict_iterator used to iterate the conflicts. */ +#define FOR_EACH_OBJECT_CONFLICT(OBJ, CONF, ITER) \ + for (ira_object_conflict_iter_init (&(ITER), (OBJ)); \ + ira_object_conflict_iter_cond (&(ITER), &(CONF));) + + + +/* The function returns TRUE if at least one hard register from ones + starting with HARD_REGNO and containing value of MODE are in set + HARD_REGSET. */ +static inline bool +ira_hard_reg_set_intersection_p (int hard_regno, machine_mode mode, + HARD_REG_SET hard_regset) +{ + int i; + + gcc_assert (hard_regno >= 0); + for (i = hard_regno_nregs[hard_regno][mode] - 1; i >= 0; i--) + if (TEST_HARD_REG_BIT (hard_regset, hard_regno + i)) + return true; + return false; +} + +/* Return number of hard registers in hard register SET. */ +static inline int +hard_reg_set_size (HARD_REG_SET set) +{ + int i, size; + + for (size = i = 0; i < FIRST_PSEUDO_REGISTER; i++) + if (TEST_HARD_REG_BIT (set, i)) + size++; + return size; +} + +/* The function returns TRUE if hard registers starting with + HARD_REGNO and containing value of MODE are fully in set + HARD_REGSET. */ +static inline bool +ira_hard_reg_in_set_p (int hard_regno, machine_mode mode, + HARD_REG_SET hard_regset) +{ + int i; + + ira_assert (hard_regno >= 0); + for (i = hard_regno_nregs[hard_regno][mode] - 1; i >= 0; i--) + if (!TEST_HARD_REG_BIT (hard_regset, hard_regno + i)) + return false; + return true; +} + + + +/* To save memory we use a lazy approach for allocation and + initialization of the cost vectors. We do this only when it is + really necessary. */ + +/* Allocate cost vector *VEC for hard registers of ACLASS and + initialize the elements by VAL if it is necessary */ +static inline void +ira_allocate_and_set_costs (int **vec, reg_class_t aclass, int val) +{ + int i, *reg_costs; + int len; + + if (*vec != NULL) + return; + *vec = reg_costs = ira_allocate_cost_vector (aclass); + len = ira_class_hard_regs_num[(int) aclass]; + for (i = 0; i < len; i++) + reg_costs[i] = val; +} + +/* Allocate cost vector *VEC for hard registers of ACLASS and copy + values of vector SRC into the vector if it is necessary */ +static inline void +ira_allocate_and_copy_costs (int **vec, enum reg_class aclass, int *src) +{ + int len; + + if (*vec != NULL || src == NULL) + return; + *vec = ira_allocate_cost_vector (aclass); + len = ira_class_hard_regs_num[aclass]; + memcpy (*vec, src, sizeof (int) * len); +} + +/* Allocate cost vector *VEC for hard registers of ACLASS and add + values of vector SRC into the vector if it is necessary */ +static inline void +ira_allocate_and_accumulate_costs (int **vec, enum reg_class aclass, int *src) +{ + int i, len; + + if (src == NULL) + return; + len = ira_class_hard_regs_num[aclass]; + if (*vec == NULL) + { + *vec = ira_allocate_cost_vector (aclass); + memset (*vec, 0, sizeof (int) * len); + } + for (i = 0; i < len; i++) + (*vec)[i] += src[i]; +} + +/* Allocate cost vector *VEC for hard registers of ACLASS and copy + values of vector SRC into the vector or initialize it by VAL (if + SRC is null). */ +static inline void +ira_allocate_and_set_or_copy_costs (int **vec, enum reg_class aclass, + int val, int *src) +{ + int i, *reg_costs; + int len; + + if (*vec != NULL) + return; + *vec = reg_costs = ira_allocate_cost_vector (aclass); + len = ira_class_hard_regs_num[aclass]; + if (src != NULL) + memcpy (reg_costs, src, sizeof (int) * len); + else + { + for (i = 0; i < len; i++) + reg_costs[i] = val; + } +} + +extern rtx ira_create_new_reg (rtx); +extern int first_moveable_pseudo, last_moveable_pseudo; + +#endif /* GCC_IRA_INT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ira.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ira.h new file mode 100644 index 0000000..667cfdc --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ira.h @@ -0,0 +1,224 @@ +/* Communication between the Integrated Register Allocator (IRA) and + the rest of the compiler. + Copyright (C) 2006-2017 Free Software Foundation, Inc. + Contributed by Vladimir Makarov . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_IRA_H +#define GCC_IRA_H + +#include "emit-rtl.h" + +/* True when we use LRA instead of reload pass for the current + function. */ +extern bool ira_use_lra_p; + +/* True if we have allocno conflicts. It is false for non-optimized + mode or when the conflict table is too big. */ +extern bool ira_conflicts_p; + +struct target_ira +{ + /* Map: hard register number -> allocno class it belongs to. If the + corresponding class is NO_REGS, the hard register is not available + for allocation. */ + enum reg_class x_ira_hard_regno_allocno_class[FIRST_PSEUDO_REGISTER]; + + /* Number of allocno classes. Allocno classes are register classes + which can be used for allocations of allocnos. */ + int x_ira_allocno_classes_num; + + /* The array containing allocno classes. Only first + IRA_ALLOCNO_CLASSES_NUM elements are used for this. */ + enum reg_class x_ira_allocno_classes[N_REG_CLASSES]; + + /* Map of all register classes to corresponding allocno classes + containing the given class. If given class is not a subset of an + allocno class, we translate it into the cheapest allocno class. */ + enum reg_class x_ira_allocno_class_translate[N_REG_CLASSES]; + + /* Number of pressure classes. Pressure classes are register + classes for which we calculate register pressure. */ + int x_ira_pressure_classes_num; + + /* The array containing pressure classes. Only first + IRA_PRESSURE_CLASSES_NUM elements are used for this. */ + enum reg_class x_ira_pressure_classes[N_REG_CLASSES]; + + /* Map of all register classes to corresponding pressure classes + containing the given class. If given class is not a subset of an + pressure class, we translate it into the cheapest pressure + class. */ + enum reg_class x_ira_pressure_class_translate[N_REG_CLASSES]; + + /* Biggest pressure register class containing stack registers. + NO_REGS if there are no stack registers. */ + enum reg_class x_ira_stack_reg_pressure_class; + + /* Maps: register class x machine mode -> maximal/minimal number of + hard registers of given class needed to store value of given + mode. */ + unsigned char x_ira_reg_class_max_nregs[N_REG_CLASSES][MAX_MACHINE_MODE]; + unsigned char x_ira_reg_class_min_nregs[N_REG_CLASSES][MAX_MACHINE_MODE]; + + /* Array analogous to target hook TARGET_MEMORY_MOVE_COST. */ + short x_ira_memory_move_cost[MAX_MACHINE_MODE][N_REG_CLASSES][2]; + + /* Array of number of hard registers of given class which are + available for the allocation. The order is defined by the + allocation order. */ + short x_ira_class_hard_regs[N_REG_CLASSES][FIRST_PSEUDO_REGISTER]; + + /* The number of elements of the above array for given register + class. */ + int x_ira_class_hard_regs_num[N_REG_CLASSES]; + + /* Register class subset relation: TRUE if the first class is a subset + of the second one considering only hard registers available for the + allocation. */ + int x_ira_class_subset_p[N_REG_CLASSES][N_REG_CLASSES]; + + /* The biggest class inside of intersection of the two classes (that + is calculated taking only hard registers available for allocation + into account. If the both classes contain no hard registers + available for allocation, the value is calculated with taking all + hard-registers including fixed ones into account. */ + enum reg_class x_ira_reg_class_subset[N_REG_CLASSES][N_REG_CLASSES]; + + /* True if the two classes (that is calculated taking only hard + registers available for allocation into account; are + intersected. */ + bool x_ira_reg_classes_intersect_p[N_REG_CLASSES][N_REG_CLASSES]; + + /* If class CL has a single allocatable register of mode M, + index [CL][M] gives the number of that register, otherwise it is -1. */ + short x_ira_class_singleton[N_REG_CLASSES][MAX_MACHINE_MODE]; + + /* Function specific hard registers can not be used for the register + allocation. */ + HARD_REG_SET x_ira_no_alloc_regs; + + /* Array whose values are hard regset of hard registers available for + the allocation of given register class whose HARD_REGNO_MODE_OK + values for given mode are zero. */ + HARD_REG_SET x_ira_prohibited_class_mode_regs[N_REG_CLASSES][NUM_MACHINE_MODES]; +}; + +extern struct target_ira default_target_ira; +#if SWITCHABLE_TARGET +extern struct target_ira *this_target_ira; +#else +#define this_target_ira (&default_target_ira) +#endif + +#define ira_hard_regno_allocno_class \ + (this_target_ira->x_ira_hard_regno_allocno_class) +#define ira_allocno_classes_num \ + (this_target_ira->x_ira_allocno_classes_num) +#define ira_allocno_classes \ + (this_target_ira->x_ira_allocno_classes) +#define ira_allocno_class_translate \ + (this_target_ira->x_ira_allocno_class_translate) +#define ira_pressure_classes_num \ + (this_target_ira->x_ira_pressure_classes_num) +#define ira_pressure_classes \ + (this_target_ira->x_ira_pressure_classes) +#define ira_pressure_class_translate \ + (this_target_ira->x_ira_pressure_class_translate) +#define ira_stack_reg_pressure_class \ + (this_target_ira->x_ira_stack_reg_pressure_class) +#define ira_reg_class_max_nregs \ + (this_target_ira->x_ira_reg_class_max_nregs) +#define ira_reg_class_min_nregs \ + (this_target_ira->x_ira_reg_class_min_nregs) +#define ira_memory_move_cost \ + (this_target_ira->x_ira_memory_move_cost) +#define ira_class_hard_regs \ + (this_target_ira->x_ira_class_hard_regs) +#define ira_class_hard_regs_num \ + (this_target_ira->x_ira_class_hard_regs_num) +#define ira_class_subset_p \ + (this_target_ira->x_ira_class_subset_p) +#define ira_reg_class_subset \ + (this_target_ira->x_ira_reg_class_subset) +#define ira_reg_classes_intersect_p \ + (this_target_ira->x_ira_reg_classes_intersect_p) +#define ira_class_singleton \ + (this_target_ira->x_ira_class_singleton) +#define ira_no_alloc_regs \ + (this_target_ira->x_ira_no_alloc_regs) +#define ira_prohibited_class_mode_regs \ + (this_target_ira->x_ira_prohibited_class_mode_regs) + +/* Major structure describing equivalence info for a pseudo. */ +struct ira_reg_equiv_s +{ + /* True if we can use this equivalence. */ + bool defined_p; + /* True if the usage of the equivalence is profitable. */ + bool profitable_p; + /* Equiv. memory, constant, invariant, and initializing insns of + given pseudo-register or NULL_RTX. */ + rtx memory; + rtx constant; + rtx invariant; + /* Always NULL_RTX if defined_p is false. */ + rtx_insn_list *init_insns; +}; + +/* The length of the following array. */ +extern int ira_reg_equiv_len; + +/* Info about equiv. info for each register. */ +extern struct ira_reg_equiv_s *ira_reg_equiv; + +extern void ira_init_once (void); +extern void ira_init (void); +extern void ira_setup_eliminable_regset (void); +extern rtx ira_eliminate_regs (rtx, machine_mode); +extern void ira_set_pseudo_classes (bool, FILE *); +extern void ira_expand_reg_equiv (void); +extern void ira_update_equiv_info_by_shuffle_insn (int, int, rtx_insn *); + +extern void ira_sort_regnos_for_alter_reg (int *, int, unsigned int *); +extern void ira_mark_allocation_change (int); +extern void ira_mark_memory_move_deletion (int, int); +extern bool ira_reassign_pseudos (int *, int, HARD_REG_SET, HARD_REG_SET *, + HARD_REG_SET *, bitmap); +extern rtx ira_reuse_stack_slot (int, unsigned int, unsigned int); +extern void ira_mark_new_stack_slot (rtx, int, unsigned int); +extern bool ira_better_spill_reload_regno_p (int *, int *, rtx, rtx, rtx_insn *); +extern bool ira_bad_reload_regno (int, rtx, rtx); + +extern void ira_adjust_equiv_reg_cost (unsigned, int); + +/* ira-costs.c */ +extern void ira_costs_c_finalize (void); + +/* Spilling static chain pseudo may result in generation of wrong + non-local goto code using frame-pointer to address saved stack + pointer value after restoring old frame pointer value. The + function returns TRUE if REGNO is such a static chain pseudo. */ +static inline bool +non_spilled_static_chain_regno_p (int regno) +{ + return (cfun->static_chain_decl && crtl->has_nonlocal_goto + && REG_EXPR (regno_reg_rtx[regno]) == cfun->static_chain_decl); +} + +#endif /* GCC_IRA_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/is-a.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/is-a.h new file mode 100644 index 0000000..2adc740 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/is-a.h @@ -0,0 +1,239 @@ +/* Dynamic testing for abstract is-a relationships. + Copyright (C) 2012-2017 Free Software Foundation, Inc. + Contributed by Lawrence Crowl. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + + +/* This header generic type query and conversion functions. + + +USING THE GENERIC TYPE FACILITY + + +The user functions are: + +bool is_a (pointer) + + Tests whether the pointer actually points to a more derived TYPE. + + Suppose you have a symtab_node *ptr, AKA symtab_node *ptr. You can test + whether it points to a 'derived' cgraph_node as follows. + + if (is_a (ptr)) + .... + + +TYPE as_a (pointer) + + Converts pointer to a TYPE. + + You can just assume that it is such a node. + + do_something_with (as_a *ptr); + +TYPE safe_as_a (pointer) + + Like as_a (pointer), but where pointer could be NULL. This + adds a check against NULL where the regular is_a_helper hook for TYPE + assumes non-NULL. + + do_something_with (safe_as_a *ptr); + +TYPE dyn_cast (pointer) + + Converts pointer to TYPE if and only if "is_a pointer". Otherwise, + returns NULL. This function is essentially a checked down cast. + + This functions reduce compile time and increase type safety when treating a + generic item as a more specific item. + + You can test and obtain a pointer to the 'derived' type in one indivisible + operation. + + if (cgraph_node *cptr = dyn_cast (ptr)) + .... + + As an example, the code change is from + + if (symtab_function_p (node)) + { + struct cgraph_node *cnode = cgraph (node); + .... + } + + to + + if (cgraph_node *cnode = dyn_cast (node)) + { + .... + } + + The necessary conditional test defines a variable that holds a known good + pointer to the specific item and avoids subsequent conversion calls and + the assertion checks that may come with them. + + When, the property test is embedded within a larger condition, the + variable declaration gets pulled out of the condition. (This approach + leaves some room for using the variable inappropriately.) + + if (symtab_variable_p (node) && varpool (node)->finalized) + varpool_analyze_node (varpool (node)); + + becomes + + varpool_node *vnode = dyn_cast (node); + if (vnode && vnode->finalized) + varpool_analyze_node (vnode); + + Note that we have converted two sets of assertions in the calls to varpool + into safe and efficient use of a variable. + +TYPE safe_dyn_cast (pointer) + + Like dyn_cast (pointer), except that it accepts null pointers + and returns null results for them. + + +If you use these functions and get a 'inline function not defined' or a +'missing symbol' error message for 'is_a_helper<....>::test', it means that +the connection between the types has not been made. See below. + + +EXTENDING THE GENERIC TYPE FACILITY + +Each connection between types must be made by defining a specialization of the +template member function 'test' of the template class 'is_a_helper'. For +example, + + template <> + template <> + inline bool + is_a_helper ::test (symtab_node *p) + { + return p->type == SYMTAB_FUNCTION; + } + +If a simple reinterpret_cast between the pointer types is incorrect, then you +must also specialize the template member function 'cast'. Failure to do so +when needed may result in a crash. For example, + + template <> + template <> + inline bool + is_a_helper ::cast (symtab_node *p) + { + return &p->x_function; + } + +*/ + +#ifndef GCC_IS_A_H +#define GCC_IS_A_H + +/* A generic type conversion internal helper class. */ + +template +struct is_a_helper +{ + template + static inline bool test (U *p); + template + static inline T cast (U *p); +}; + +/* Note that we deliberately do not define the 'test' member template. Not + doing so will result in a build-time error for type relationships that have + not been defined, rather than a run-time error. See the discussion above + for when to define this member. */ + +/* This is the generic implementation for casting from one type to another. + Do not use this routine directly; it is an internal function. See the + discussion above for when to define this member. */ + +template +template +inline T +is_a_helper ::cast (U *p) +{ + return reinterpret_cast (p); +} + + +/* The public interface. */ + +/* A generic test for a type relationship. See the discussion above for when + to use this function. The question answered is "Is type T a derived type of + type U?". */ + +template +inline bool +is_a (U *p) +{ + return is_a_helper::test (p); +} + +/* A generic conversion from a base type U to a derived type T. See the + discussion above for when to use this function. */ + +template +inline T +as_a (U *p) +{ + gcc_checking_assert (is_a (p)); + return is_a_helper ::cast (p); +} + +/* Similar to as_a<>, but where the pointer can be NULL, even if + is_a_helper doesn't check for NULL. */ + +template +inline T +safe_as_a (U *p) +{ + if (p) + { + gcc_checking_assert (is_a (p)); + return is_a_helper ::cast (p); + } + else + return NULL; +} + +/* A generic checked conversion from a base type U to a derived type T. See + the discussion above for when to use this function. */ + +template +inline T +dyn_cast (U *p) +{ + if (is_a (p)) + return is_a_helper ::cast (p); + else + return static_cast (0); +} + +/* Similar to dyn_cast, except that the pointer may be null. */ + +template +inline T +safe_dyn_cast (U *p) +{ + return p ? dyn_cast (p) : 0; +} + +#endif /* GCC_IS_A_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/langhooks-def.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/langhooks-def.h new file mode 100644 index 0000000..90d1f6a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/langhooks-def.h @@ -0,0 +1,347 @@ +/* Default macros to initialize the lang_hooks data structure. + Copyright (C) 2001-2017 Free Software Foundation, Inc. + Contributed by Alexandre Oliva + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_LANG_HOOKS_DEF_H +#define GCC_LANG_HOOKS_DEF_H + +#include "hooks.h" + +struct diagnostic_info; +class substring_loc; + +/* Note to creators of new hooks: + + The macros in this file should NOT be surrounded by a + #ifdef...#endif pair, since this file declares the defaults. Each + front end overrides any hooks it wishes to, in the file containing + its struct lang_hooks, AFTER including this file. */ + +/* See langhooks.h for the definition and documentation of each hook. */ + +extern void lhd_do_nothing (void); +extern void lhd_do_nothing_t (tree); +extern void lhd_do_nothing_f (struct function *); +extern tree lhd_pass_through_t (tree); +extern bool lhd_post_options (const char **); +extern alias_set_type lhd_get_alias_set (tree); +extern tree lhd_return_null_tree (tree); +extern tree lhd_return_null_const_tree (const_tree); +extern tree lhd_do_nothing_iii_return_null_tree (int, int, int); +extern void lhd_print_tree_nothing (FILE *, tree, int); +extern const char *lhd_decl_printable_name (tree, int); +extern const char *lhd_dwarf_name (tree, int); +extern int lhd_types_compatible_p (tree, tree); +extern void lhd_print_error_function (diagnostic_context *, + const char *, struct diagnostic_info *); +extern void lhd_set_decl_assembler_name (tree); +extern bool lhd_warn_unused_global_decl (const_tree); +extern tree lhd_type_for_size (unsigned precision, int unsignedp); +extern void lhd_incomplete_type_error (location_t, const_tree, const_tree); +extern tree lhd_type_promotes_to (tree); +extern void lhd_register_builtin_type (tree, const char *); +extern bool lhd_decl_ok_for_sibcall (const_tree); +extern size_t lhd_tree_size (enum tree_code); +extern HOST_WIDE_INT lhd_to_target_charset (HOST_WIDE_INT); +extern tree lhd_expr_to_decl (tree, bool *, bool *); +extern tree lhd_builtin_function (tree); +extern tree lhd_enum_underlying_base_type (const_tree); + +/* Declarations of default tree inlining hooks. */ +extern void lhd_initialize_diagnostics (diagnostic_context *); +extern void lhd_init_options (unsigned int, + struct cl_decoded_option *); +extern bool lhd_complain_wrong_lang_p (const struct cl_option *); +extern bool lhd_handle_option (size_t, const char *, int, int, location_t, + const struct cl_option_handlers *); + + +/* Declarations for tree gimplification hooks. */ +extern int lhd_gimplify_expr (tree *, gimple_seq *, gimple_seq *); +extern enum omp_clause_default_kind lhd_omp_predetermined_sharing (tree); +extern tree lhd_omp_assignment (tree, tree, tree); +extern void lhd_omp_finish_clause (tree, gimple_seq *); +struct gimplify_omp_ctx; +extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *, + tree); +extern bool lhd_omp_mappable_type (tree); +extern bool lhd_omp_scalar_p (tree); + +extern const char *lhd_get_substring_location (const substring_loc &, + location_t *out_loc); +extern int lhd_decl_dwarf_attribute (const_tree, int); +extern int lhd_type_dwarf_attribute (const_tree, int); + +#define LANG_HOOKS_NAME "GNU unknown" +#define LANG_HOOKS_IDENTIFIER_SIZE sizeof (struct lang_identifier) +#define LANG_HOOKS_INIT hook_bool_void_false +#define LANG_HOOKS_FINISH lhd_do_nothing +#define LANG_HOOKS_PARSE_FILE lhd_do_nothing +#define LANG_HOOKS_OPTION_LANG_MASK hook_uint_void_0 +#define LANG_HOOKS_INIT_OPTIONS_STRUCT hook_void_gcc_optionsp +#define LANG_HOOKS_INIT_OPTIONS lhd_init_options +#define LANG_HOOKS_INITIALIZE_DIAGNOSTICS lhd_initialize_diagnostics +#define LANG_HOOKS_COMPLAIN_WRONG_LANG_P lhd_complain_wrong_lang_p +#define LANG_HOOKS_HANDLE_OPTION lhd_handle_option +#define LANG_HOOKS_POST_OPTIONS lhd_post_options +#define LANG_HOOKS_MISSING_NORETURN_OK_P hook_bool_tree_true +#define LANG_HOOKS_GET_ALIAS_SET lhd_get_alias_set +#define LANG_HOOKS_FINISH_INCOMPLETE_DECL lhd_do_nothing_t +#define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL lhd_do_nothing_t +#define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME lhd_set_decl_assembler_name +#define LANG_HOOKS_PRINT_STATISTICS lhd_do_nothing +#define LANG_HOOKS_PRINT_XNODE lhd_print_tree_nothing +#define LANG_HOOKS_PRINT_DECL lhd_print_tree_nothing +#define LANG_HOOKS_PRINT_TYPE lhd_print_tree_nothing +#define LANG_HOOKS_PRINT_IDENTIFIER lhd_print_tree_nothing +#define LANG_HOOKS_PRINT_ERROR_FUNCTION lhd_print_error_function +#define LANG_HOOKS_DECL_PRINTABLE_NAME lhd_decl_printable_name +#define LANG_HOOKS_DWARF_NAME lhd_dwarf_name +#define LANG_HOOKS_FREE_LANG_DATA lhd_do_nothing_t +#define LANG_HOOKS_TREE_SIZE lhd_tree_size +#define LANG_HOOKS_TYPES_COMPATIBLE_P lhd_types_compatible_p +#define LANG_HOOKS_BUILTIN_FUNCTION lhd_builtin_function +#define LANG_HOOKS_BUILTIN_FUNCTION_EXT_SCOPE LANG_HOOKS_BUILTIN_FUNCTION +#define LANG_HOOKS_EXPR_TO_DECL lhd_expr_to_decl +#define LANG_HOOKS_TO_TARGET_CHARSET lhd_to_target_charset +#define LANG_HOOKS_INIT_TS lhd_do_nothing +#define LANG_HOOKS_EH_PERSONALITY lhd_gcc_personality +#define LANG_HOOKS_EH_RUNTIME_TYPE lhd_pass_through_t +#define LANG_HOOKS_EH_PROTECT_CLEANUP_ACTIONS NULL +#define LANG_HOOKS_BLOCK_MAY_FALLTHRU hook_bool_const_tree_true +#define LANG_HOOKS_EH_USE_CXA_END_CLEANUP false +#define LANG_HOOKS_DEEP_UNSHARING false +#define LANG_HOOKS_CUSTOM_FUNCTION_DESCRIPTORS false +#define LANG_HOOKS_RUN_LANG_SELFTESTS lhd_do_nothing +#define LANG_HOOKS_GET_SUBSTRING_LOCATION lhd_get_substring_location + +/* Attribute hooks. */ +#define LANG_HOOKS_ATTRIBUTE_TABLE NULL +#define LANG_HOOKS_COMMON_ATTRIBUTE_TABLE NULL +#define LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE NULL + +/* Tree inlining hooks. */ +#define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P \ + hook_bool_tree_tree_false + +#define LANG_HOOKS_TREE_INLINING_INITIALIZER { \ + LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P, \ +} + +/* Hooks for tree gimplification. */ +#define LANG_HOOKS_GIMPLIFY_EXPR lhd_gimplify_expr + +/* Tree dump hooks. */ +extern bool lhd_tree_dump_dump_tree (void *, tree); +extern int lhd_tree_dump_type_quals (const_tree); +extern tree lhd_make_node (enum tree_code); + +#define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN lhd_tree_dump_dump_tree +#define LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN lhd_tree_dump_type_quals + +#define LANG_HOOKS_TREE_DUMP_INITIALIZER { \ + LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN, \ + LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN \ +} + +/* Types hooks. There are no reasonable defaults for most of them, + so we create a compile-time error instead. */ +extern tree lhd_unit_size_without_reusable_padding (tree); + +#define LANG_HOOKS_MAKE_TYPE lhd_make_node +#define LANG_HOOKS_CLASSIFY_RECORD NULL +#define LANG_HOOKS_TYPE_FOR_SIZE lhd_type_for_size +#define LANG_HOOKS_INCOMPLETE_TYPE_ERROR lhd_incomplete_type_error +#define LANG_HOOKS_GENERIC_TYPE_P hook_bool_const_tree_false +#define LANG_HOOKS_GET_INNERMOST_GENERIC_PARMS hook_tree_const_tree_null +#define LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS hook_tree_const_tree_null +#define LANG_HOOKS_FUNCTION_PARAMETER_PACK_P hook_bool_const_tree_false +#define LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS hook_tree_const_tree_null +#define LANG_HOOKS_GENERIC_GENERIC_PARAMETER_DECL_P hook_bool_const_tree_false +#define LANG_HOOKS_FUNCTION_PARM_EXPANDED_FROM_PACK_P \ + hook_bool_tree_tree_false +#define LANG_HOOKS_GET_GENERIC_FUNCTION_DECL hook_tree_const_tree_null +#define LANG_HOOKS_TYPE_PROMOTES_TO lhd_type_promotes_to +#define LANG_HOOKS_REGISTER_BUILTIN_TYPE lhd_register_builtin_type +#define LANG_HOOKS_TYPE_MAX_SIZE lhd_return_null_const_tree +#define LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES \ + lhd_omp_firstprivatize_type_sizes +#define LANG_HOOKS_OMP_MAPPABLE_TYPE lhd_omp_mappable_type +#define LANG_HOOKS_TYPE_HASH_EQ NULL +#define LANG_HOOKS_COPY_LANG_QUALIFIERS NULL +#define LANG_HOOKS_GET_ARRAY_DESCR_INFO NULL +#define LANG_HOOKS_GET_SUBRANGE_BOUNDS NULL +#define LANG_HOOKS_GET_TYPE_BIAS NULL +#define LANG_HOOKS_DESCRIPTIVE_TYPE NULL +#define LANG_HOOKS_RECONSTRUCT_COMPLEX_TYPE reconstruct_complex_type +#define LANG_HOOKS_ENUM_UNDERLYING_BASE_TYPE lhd_enum_underlying_base_type +#define LANG_HOOKS_GET_DEBUG_TYPE NULL +#define LANG_HOOKS_GET_FIXED_POINT_TYPE_INFO NULL +#define LANG_HOOKS_TYPE_DWARF_ATTRIBUTE lhd_type_dwarf_attribute +#define LANG_HOOKS_UNIT_SIZE_WITHOUT_REUSABLE_PADDING lhd_unit_size_without_reusable_padding + +#define LANG_HOOKS_FOR_TYPES_INITIALIZER { \ + LANG_HOOKS_MAKE_TYPE, \ + LANG_HOOKS_CLASSIFY_RECORD, \ + LANG_HOOKS_TYPE_FOR_MODE, \ + LANG_HOOKS_TYPE_FOR_SIZE, \ + LANG_HOOKS_GENERIC_TYPE_P, \ + LANG_HOOKS_GET_ARGUMENT_PACK_ELEMS, \ + LANG_HOOKS_TYPE_PROMOTES_TO, \ + LANG_HOOKS_REGISTER_BUILTIN_TYPE, \ + LANG_HOOKS_INCOMPLETE_TYPE_ERROR, \ + LANG_HOOKS_TYPE_MAX_SIZE, \ + LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES, \ + LANG_HOOKS_OMP_MAPPABLE_TYPE, \ + LANG_HOOKS_TYPE_HASH_EQ, \ + LANG_HOOKS_COPY_LANG_QUALIFIERS, \ + LANG_HOOKS_GET_ARRAY_DESCR_INFO, \ + LANG_HOOKS_GET_SUBRANGE_BOUNDS, \ + LANG_HOOKS_GET_TYPE_BIAS, \ + LANG_HOOKS_DESCRIPTIVE_TYPE, \ + LANG_HOOKS_RECONSTRUCT_COMPLEX_TYPE, \ + LANG_HOOKS_ENUM_UNDERLYING_BASE_TYPE, \ + LANG_HOOKS_GET_DEBUG_TYPE, \ + LANG_HOOKS_GET_FIXED_POINT_TYPE_INFO, \ + LANG_HOOKS_TYPE_DWARF_ATTRIBUTE, \ + LANG_HOOKS_UNIT_SIZE_WITHOUT_REUSABLE_PADDING \ +} + +/* Declaration hooks. */ +#define LANG_HOOKS_GLOBAL_BINDINGS_P global_bindings_p +#define LANG_HOOKS_PUSHDECL pushdecl +#define LANG_HOOKS_GETDECLS getdecls +#define LANG_HOOKS_DECL_DWARF_ATTRIBUTE lhd_decl_dwarf_attribute +#define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL lhd_warn_unused_global_decl +#define LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS NULL +#define LANG_HOOKS_DECL_OK_FOR_SIBCALL lhd_decl_ok_for_sibcall +#define LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE hook_bool_const_tree_false +#define LANG_HOOKS_OMP_PREDETERMINED_SHARING lhd_omp_predetermined_sharing +#define LANG_HOOKS_OMP_REPORT_DECL lhd_pass_through_t +#define LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR hook_bool_tree_bool_false +#define LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE hook_bool_tree_bool_false +#define LANG_HOOKS_OMP_PRIVATE_OUTER_REF hook_bool_tree_false +#define LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR hook_tree_tree_tree_tree_null +#define LANG_HOOKS_OMP_CLAUSE_COPY_CTOR lhd_omp_assignment +#define LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP lhd_omp_assignment +#define LANG_HOOKS_OMP_CLAUSE_LINEAR_CTOR NULL +#define LANG_HOOKS_OMP_CLAUSE_DTOR hook_tree_tree_tree_null +#define LANG_HOOKS_OMP_FINISH_CLAUSE lhd_omp_finish_clause +#define LANG_HOOKS_OMP_SCALAR_P lhd_omp_scalar_p + +#define LANG_HOOKS_DECLS { \ + LANG_HOOKS_GLOBAL_BINDINGS_P, \ + LANG_HOOKS_PUSHDECL, \ + LANG_HOOKS_GETDECLS, \ + LANG_HOOKS_DECL_DWARF_ATTRIBUTE, \ + LANG_HOOKS_GENERIC_GENERIC_PARAMETER_DECL_P, \ + LANG_HOOKS_FUNCTION_PARM_EXPANDED_FROM_PACK_P, \ + LANG_HOOKS_GET_GENERIC_FUNCTION_DECL, \ + LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL, \ + LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS, \ + LANG_HOOKS_DECL_OK_FOR_SIBCALL, \ + LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE, \ + LANG_HOOKS_OMP_PREDETERMINED_SHARING, \ + LANG_HOOKS_OMP_REPORT_DECL, \ + LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR, \ + LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE, \ + LANG_HOOKS_OMP_PRIVATE_OUTER_REF, \ + LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR, \ + LANG_HOOKS_OMP_CLAUSE_COPY_CTOR, \ + LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP, \ + LANG_HOOKS_OMP_CLAUSE_LINEAR_CTOR, \ + LANG_HOOKS_OMP_CLAUSE_DTOR, \ + LANG_HOOKS_OMP_FINISH_CLAUSE, \ + LANG_HOOKS_OMP_SCALAR_P \ +} + +/* LTO hooks. */ +extern void lhd_begin_section (const char *); +extern void lhd_append_data (const void *, size_t, void *); +extern void lhd_end_section (void); + +#define LANG_HOOKS_BEGIN_SECTION lhd_begin_section +#define LANG_HOOKS_APPEND_DATA lhd_append_data +#define LANG_HOOKS_END_SECTION lhd_end_section + +#define LANG_HOOKS_LTO { \ + LANG_HOOKS_BEGIN_SECTION, \ + LANG_HOOKS_APPEND_DATA, \ + LANG_HOOKS_END_SECTION \ +} + +/* The whole thing. The structure is defined in langhooks.h. */ +#define LANG_HOOKS_INITIALIZER { \ + LANG_HOOKS_NAME, \ + LANG_HOOKS_IDENTIFIER_SIZE, \ + LANG_HOOKS_FREE_LANG_DATA, \ + LANG_HOOKS_TREE_SIZE, \ + LANG_HOOKS_OPTION_LANG_MASK, \ + LANG_HOOKS_INIT_OPTIONS_STRUCT, \ + LANG_HOOKS_INIT_OPTIONS, \ + LANG_HOOKS_INITIALIZE_DIAGNOSTICS, \ + LANG_HOOKS_COMPLAIN_WRONG_LANG_P, \ + LANG_HOOKS_HANDLE_OPTION, \ + LANG_HOOKS_POST_OPTIONS, \ + LANG_HOOKS_INIT, \ + LANG_HOOKS_FINISH, \ + LANG_HOOKS_PARSE_FILE, \ + LANG_HOOKS_MISSING_NORETURN_OK_P, \ + LANG_HOOKS_GET_ALIAS_SET, \ + LANG_HOOKS_FINISH_INCOMPLETE_DECL, \ + LANG_HOOKS_DUP_LANG_SPECIFIC_DECL, \ + LANG_HOOKS_SET_DECL_ASSEMBLER_NAME, \ + LANG_HOOKS_PRINT_STATISTICS, \ + LANG_HOOKS_PRINT_XNODE, \ + LANG_HOOKS_PRINT_DECL, \ + LANG_HOOKS_PRINT_TYPE, \ + LANG_HOOKS_PRINT_IDENTIFIER, \ + LANG_HOOKS_DECL_PRINTABLE_NAME, \ + LANG_HOOKS_DWARF_NAME, \ + LANG_HOOKS_TYPES_COMPATIBLE_P, \ + LANG_HOOKS_PRINT_ERROR_FUNCTION, \ + LANG_HOOKS_TO_TARGET_CHARSET, \ + LANG_HOOKS_ATTRIBUTE_TABLE, \ + LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, \ + LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE, \ + LANG_HOOKS_TREE_INLINING_INITIALIZER, \ + LANG_HOOKS_TREE_DUMP_INITIALIZER, \ + LANG_HOOKS_DECLS, \ + LANG_HOOKS_FOR_TYPES_INITIALIZER, \ + LANG_HOOKS_LTO, \ + LANG_HOOKS_GET_INNERMOST_GENERIC_PARMS, \ + LANG_HOOKS_GET_INNERMOST_GENERIC_ARGS, \ + LANG_HOOKS_FUNCTION_PARAMETER_PACK_P, \ + LANG_HOOKS_GIMPLIFY_EXPR, \ + LANG_HOOKS_BUILTIN_FUNCTION, \ + LANG_HOOKS_BUILTIN_FUNCTION_EXT_SCOPE, \ + LANG_HOOKS_INIT_TS, \ + LANG_HOOKS_EXPR_TO_DECL, \ + LANG_HOOKS_EH_PERSONALITY, \ + LANG_HOOKS_EH_RUNTIME_TYPE, \ + LANG_HOOKS_EH_PROTECT_CLEANUP_ACTIONS, \ + LANG_HOOKS_BLOCK_MAY_FALLTHRU, \ + LANG_HOOKS_EH_USE_CXA_END_CLEANUP, \ + LANG_HOOKS_DEEP_UNSHARING, \ + LANG_HOOKS_CUSTOM_FUNCTION_DESCRIPTORS, \ + LANG_HOOKS_RUN_LANG_SELFTESTS, \ + LANG_HOOKS_GET_SUBSTRING_LOCATION \ +} + +#endif /* GCC_LANG_HOOKS_DEF_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/langhooks.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/langhooks.h new file mode 100644 index 0000000..6130f03 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/langhooks.h @@ -0,0 +1,564 @@ +/* The lang_hooks data structure. + Copyright (C) 2001-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_LANG_HOOKS_H +#define GCC_LANG_HOOKS_H + +/* FIXME: This file should be #include-d after tree.h (for enum tree_code). */ + +struct diagnostic_info; + +struct gimplify_omp_ctx; + +struct array_descr_info; + +/* A print hook for print_tree (). */ +typedef void (*lang_print_tree_hook) (FILE *, tree, int indent); + +enum classify_record + { RECORD_IS_STRUCT, RECORD_IS_CLASS, RECORD_IS_INTERFACE }; + +class substring_loc; + +/* The following hooks are documented in langhooks.c. Must not be + NULL. */ + +struct lang_hooks_for_tree_inlining +{ + bool (*var_mod_type_p) (tree, tree); +}; + +/* The following hooks are used by tree-dump.c. */ + +struct lang_hooks_for_tree_dump +{ + /* Dump language-specific parts of tree nodes. Returns nonzero if it + does not want the usual dumping of the second argument. */ + bool (*dump_tree) (void *, tree); + + /* Determine type qualifiers in a language-specific way. */ + int (*type_quals) (const_tree); +}; + +/* Hooks related to types. */ + +struct lang_hooks_for_types +{ + /* Return a new type (with the indicated CODE), doing whatever + language-specific processing is required. */ + tree (*make_type) (enum tree_code); + + /* Return what kind of RECORD_TYPE this is, mainly for purposes of + debug information. If not defined, record types are assumed to + be structures. */ + enum classify_record (*classify_record) (tree); + + /* Given MODE and UNSIGNEDP, return a suitable type-tree with that + mode. */ + tree (*type_for_mode) (machine_mode, int); + + /* Given PRECISION and UNSIGNEDP, return a suitable type-tree for an + integer type with at least that precision. */ + tree (*type_for_size) (unsigned, int); + + /* True if the type is an instantiation of a generic type, + e.g. C++ template implicit specializations. */ + bool (*generic_p) (const_tree); + + /* Returns the TREE_VEC of elements of a given generic argument pack. */ + tree (*get_argument_pack_elems) (const_tree); + + /* Given a type, apply default promotions to unnamed function + arguments and return the new type. Return the same type if no + change. Required by any language that supports variadic + arguments. The default hook dies. */ + tree (*type_promotes_to) (tree); + + /* Register TYPE as a builtin type with the indicated NAME. The + TYPE is placed in the outermost lexical scope. The semantics + should be analogous to: + + typedef TYPE NAME; + + in C. The default hook ignores the declaration. */ + void (*register_builtin_type) (tree, const char *); + + /* This routine is called in tree.c to print an error message for + invalid use of an incomplete type. VALUE is the expression that + was used (or 0 if that isn't known) and TYPE is the type that was + invalid. LOC is the location of the use. */ + void (*incomplete_type_error) (location_t loc, const_tree value, + const_tree type); + + /* Called from assign_temp to return the maximum size, if there is one, + for a type. */ + tree (*max_size) (const_tree); + + /* Register language specific type size variables as potentially OpenMP + firstprivate variables. */ + void (*omp_firstprivatize_type_sizes) (struct gimplify_omp_ctx *, tree); + + /* Return true if TYPE is a mappable type. */ + bool (*omp_mappable_type) (tree type); + + /* Return TRUE if TYPE1 and TYPE2 are identical for type hashing purposes. + Called only after doing all language independent checks. + At present, this function is only called when both TYPE1 and TYPE2 are + FUNCTION_TYPE or METHOD_TYPE. */ + bool (*type_hash_eq) (const_tree, const_tree); + + /* If non-NULL, return TYPE1 with any language-specific modifiers copied from + TYPE2. */ + tree (*copy_lang_qualifiers) (const_tree, const_tree); + + /* Return TRUE if TYPE uses a hidden descriptor and fills in information + for the debugger about the array bounds, strides, etc. */ + bool (*get_array_descr_info) (const_tree, struct array_descr_info *); + + /* Fill in information for the debugger about the bounds of TYPE. */ + void (*get_subrange_bounds) (const_tree, tree *, tree *); + + /* Called on INTEGER_TYPEs. Return NULL_TREE for non-biased types. For + biased types, return as an INTEGER_CST node the value that is represented + by a physical zero. */ + tree (*get_type_bias) (const_tree); + + /* A type descriptive of TYPE's complex layout generated to help the + debugger to decode variable-length or self-referential constructs. + This is only used for the AT_GNAT_descriptive_type DWARF attribute. */ + tree (*descriptive_type) (const_tree); + + /* If we requested a pointer to a vector, build up the pointers that + we stripped off while looking for the inner type. Similarly for + return values from functions. The argument TYPE is the top of the + chain, and BOTTOM is the new type which we will point to. */ + tree (*reconstruct_complex_type) (tree, tree); + + /* Returns the tree that represents the underlying data type used to + implement the enumeration. The default implementation will just use + type_for_size. Used in dwarf2out.c to add a DW_AT_type base type + reference to a DW_TAG_enumeration. */ + tree (*enum_underlying_base_type) (const_tree); + + /* Return a type to use in the debug info instead of TYPE, or NULL_TREE to + keep TYPE. This is useful to keep a single "source type" when the + middle-end uses specialized types, for instance constrained discriminated + types in Ada. */ + tree (*get_debug_type) (const_tree); + + /* Return TRUE if TYPE implements a fixed point type and fills in information + for the debugger about scale factor, etc. */ + bool (*get_fixed_point_type_info) (const_tree, + struct fixed_point_type_info *); + + /* Returns -1 if dwarf ATTR shouldn't be added for TYPE, or the attribute + value otherwise. */ + int (*type_dwarf_attribute) (const_tree, int); + + /* Returns a tree for the unit size of T excluding tail padding that + might be used by objects inheriting from T. */ + tree (*unit_size_without_reusable_padding) (tree); +}; + +/* Language hooks related to decls and the symbol table. */ + +struct lang_hooks_for_decls +{ + /* Return true if we are in the global binding level. This hook is really + needed only if the language supports variable-sized types at the global + level, i.e. declared outside subprograms. */ + bool (*global_bindings_p) (void); + + /* Function to add a decl to the current scope level. Takes one + argument, a decl to add. Returns that decl, or, if the same + symbol is already declared, may return a different decl for that + name. */ + tree (*pushdecl) (tree); + + /* Returns the chain of decls so far in the current scope level. */ + tree (*getdecls) (void); + + /* Returns -1 if dwarf ATTR shouldn't be added for DECL, or the attribute + value otherwise. */ + int (*decl_dwarf_attribute) (const_tree, int); + + /* Returns True if the parameter is a generic parameter decl + of a generic type, e.g a template template parameter for the C++ FE. */ + bool (*generic_generic_parameter_decl_p) (const_tree); + + /* Determine if a function parameter got expanded from a + function parameter pack. */ + bool (*function_parm_expanded_from_pack_p) (tree, tree); + + /* Returns the generic declaration of a generic function instantiations. */ + tree (*get_generic_function_decl) (const_tree); + + /* Returns true when we should warn for an unused global DECL. + We will already have checked that it has static binding. */ + bool (*warn_unused_global) (const_tree); + + /* Perform any post compilation-proper parser cleanups and + processing. This is currently only needed for the C++ parser, + which hopefully can be cleaned up so this hook is no longer + necessary. */ + void (*post_compilation_parsing_cleanups) (void); + + /* True if this decl may be called via a sibcall. */ + bool (*ok_for_sibcall) (const_tree); + + /* True if OpenMP should privatize what this DECL points to rather + than the DECL itself. */ + bool (*omp_privatize_by_reference) (const_tree); + + /* Return sharing kind if OpenMP sharing attribute of DECL is + predetermined, OMP_CLAUSE_DEFAULT_UNSPECIFIED otherwise. */ + enum omp_clause_default_kind (*omp_predetermined_sharing) (tree); + + /* Return decl that should be reported for DEFAULT(NONE) failure + diagnostics. Usually the DECL passed in. */ + tree (*omp_report_decl) (tree); + + /* Return true if DECL's DECL_VALUE_EXPR (if any) should be + disregarded in OpenMP construct, because it is going to be + remapped during OpenMP lowering. SHARED is true if DECL + is going to be shared, false if it is going to be privatized. */ + bool (*omp_disregard_value_expr) (tree, bool); + + /* Return true if DECL that is shared iff SHARED is true should + be put into OMP_CLAUSE_PRIVATE_DEBUG. */ + bool (*omp_private_debug_clause) (tree, bool); + + /* Return true if DECL in private clause needs + OMP_CLAUSE_PRIVATE_OUTER_REF on the private clause. */ + bool (*omp_private_outer_ref) (tree); + + /* Build and return code for a default constructor for DECL in + response to CLAUSE. OUTER is corresponding outer region's + variable if needed. Return NULL if nothing to be done. */ + tree (*omp_clause_default_ctor) (tree clause, tree decl, tree outer); + + /* Build and return code for a copy constructor from SRC to DST. */ + tree (*omp_clause_copy_ctor) (tree clause, tree dst, tree src); + + /* Similarly, except use an assignment operator instead. */ + tree (*omp_clause_assign_op) (tree clause, tree dst, tree src); + + /* Build and return code for a constructor of DST that sets it to + SRC + ADD. */ + tree (*omp_clause_linear_ctor) (tree clause, tree dst, tree src, tree add); + + /* Build and return code destructing DECL. Return NULL if nothing + to be done. */ + tree (*omp_clause_dtor) (tree clause, tree decl); + + /* Do language specific checking on an implicitly determined clause. */ + void (*omp_finish_clause) (tree clause, gimple_seq *pre_p); + + /* Return true if DECL is a scalar variable (for the purpose of + implicit firstprivatization). */ + bool (*omp_scalar_p) (tree decl); +}; + +/* Language hooks related to LTO serialization. */ + +struct lang_hooks_for_lto +{ + /* Begin a new LTO section named NAME. */ + void (*begin_section) (const char *name); + + /* Write DATA of length LEN to the currently open LTO section. BLOCK is a + pointer to the dynamically allocated memory containing DATA. The + append_data function is responsible for freeing it when it is no longer + needed. */ + void (*append_data) (const void *data, size_t len, void *block); + + /* End the previously begun LTO section. */ + void (*end_section) (void); +}; + +/* Language-specific hooks. See langhooks-def.h for defaults. */ + +struct lang_hooks +{ + /* String identifying the front end and optionally language standard + version, e.g. "GNU C++98" or "GNU Java". */ + const char *name; + + /* sizeof (struct lang_identifier), so make_node () creates + identifier nodes long enough for the language-specific slots. */ + size_t identifier_size; + + /* Remove any parts of the tree that are used only by the FE. */ + void (*free_lang_data) (tree); + + /* Determines the size of any language-specific tcc_constant or + tcc_exceptional nodes. Since it is called from make_node, the + only information available is the tree code. Expected to die + on unrecognized codes. */ + size_t (*tree_size) (enum tree_code); + + /* Return the language mask used for converting argv into a sequence + of options. */ + unsigned int (*option_lang_mask) (void); + + /* Initialize variables in an options structure. */ + void (*init_options_struct) (struct gcc_options *opts); + + /* After the initialize_diagnostics hook is called, do any simple + initialization needed before any calls to handle_option, other + than that done by the init_options_struct hook. */ + void (*init_options) (unsigned int decoded_options_count, + struct cl_decoded_option *decoded_options); + + /* Callback used to perform language-specific initialization for the + global diagnostic context structure. */ + void (*initialize_diagnostics) (diagnostic_context *); + + /* Return true if a warning should be given about option OPTION, + which is for the wrong language, false if it should be quietly + ignored. */ + bool (*complain_wrong_lang_p) (const struct cl_option *option); + + /* Handle the switch CODE, which has real type enum opt_code from + options.h. If the switch takes an argument, it is passed in ARG + which points to permanent storage. The handler is responsible for + checking whether ARG is NULL, which indicates that no argument + was in fact supplied. For -f and -W switches, VALUE is 1 or 0 + for the positive and negative forms respectively. HANDLERS should + be passed to any recursive handle_option calls. LOC is the + location of the option. + + Return true if the switch is valid, false if invalid. */ + bool (*handle_option) (size_t code, const char *arg, int value, int kind, + location_t loc, + const struct cl_option_handlers *handlers); + + /* Called when all command line options have been parsed to allow + further processing and initialization + + Should return true to indicate that a compiler back-end is + not required, such as with the -E option. + + If errorcount is nonzero after this call the compiler exits + immediately and the finish hook is not called. */ + bool (*post_options) (const char **); + + /* Called after post_options to initialize the front end. Return + false to indicate that no further compilation be performed, in + which case the finish hook is called immediately. */ + bool (*init) (void); + + /* Called at the end of compilation, as a finalizer. */ + void (*finish) (void); + + /* Parses the entire file. */ + void (*parse_file) (void); + + /* Determines if it's ok for a function to have no noreturn attribute. */ + bool (*missing_noreturn_ok_p) (tree); + + /* Called to obtain the alias set to be used for an expression or type. + Returns -1 if the language does nothing special for it. */ + alias_set_type (*get_alias_set) (tree); + + /* Function to finish handling an incomplete decl at the end of + compilation. Default hook is does nothing. */ + void (*finish_incomplete_decl) (tree); + + /* Replace the DECL_LANG_SPECIFIC data, which may be NULL, of the + DECL_NODE with a newly GC-allocated copy. */ + void (*dup_lang_specific_decl) (tree); + + /* Set the DECL_ASSEMBLER_NAME for a node. If it is the sort of + thing that the assembler should talk about, set + DECL_ASSEMBLER_NAME to an appropriate IDENTIFIER_NODE. + Otherwise, set it to the ERROR_MARK_NODE to ensure that the + assembler does not talk about it. */ + void (*set_decl_assembler_name) (tree); + + /* The front end can add its own statistics to -fmem-report with + this hook. It should output to stderr. */ + void (*print_statistics) (void); + + /* Called by print_tree when there is a tree of class tcc_exceptional + that it doesn't know how to display. */ + lang_print_tree_hook print_xnode; + + /* Called to print language-dependent parts of tcc_decl, tcc_type, + and IDENTIFIER_NODE nodes. */ + lang_print_tree_hook print_decl; + lang_print_tree_hook print_type; + lang_print_tree_hook print_identifier; + + /* Computes the name to use to print a declaration. DECL is the + non-NULL declaration in question. VERBOSITY determines what + information will be printed: 0: DECL_NAME, demangled as + necessary. 1: and scope information. 2: and any other + information that might be interesting, such as function parameter + types in C++. The name is in the internal character set and + needs to be converted to the locale character set of diagnostics, + or to the execution character set for strings such as + __PRETTY_FUNCTION__. */ + const char *(*decl_printable_name) (tree decl, int verbosity); + + /* Computes the dwarf-2/3 name for a tree. VERBOSITY determines what + information will be printed: 0: DECL_NAME, demangled as + necessary. 1: and scope information. */ + const char *(*dwarf_name) (tree, int verbosity); + + /* This compares two types for equivalence ("compatible" in C-based languages). + This routine should only return 1 if it is sure. It should not be used + in contexts where erroneously returning 0 causes problems. */ + int (*types_compatible_p) (tree x, tree y); + + /* Called by report_error_function to print out function name. */ + void (*print_error_function) (diagnostic_context *, const char *, + struct diagnostic_info *); + + /* Convert a character from the host's to the target's character + set. The character should be in what C calls the "basic source + character set" (roughly, the set of characters defined by plain + old ASCII). The default is to return the character unchanged, + which is correct in most circumstances. Note that both argument + and result should be sign-extended under -fsigned-char, + zero-extended under -fno-signed-char. */ + HOST_WIDE_INT (*to_target_charset) (HOST_WIDE_INT); + + /* Pointers to machine-independent attribute tables, for front ends + using attribs.c. If one is NULL, it is ignored. Respectively, a + table of attributes specific to the language, a table of + attributes common to two or more languages (to allow easy + sharing), and a table of attributes for checking formats. */ + const struct attribute_spec *attribute_table; + const struct attribute_spec *common_attribute_table; + const struct attribute_spec *format_attribute_table; + + struct lang_hooks_for_tree_inlining tree_inlining; + + struct lang_hooks_for_tree_dump tree_dump; + + struct lang_hooks_for_decls decls; + + struct lang_hooks_for_types types; + + struct lang_hooks_for_lto lto; + + /* Returns a TREE_VEC of the generic parameters of an instantiation of + a generic type or decl, e.g. C++ template instantiation. If + TREE_CHAIN of the return value is set, it is an INTEGER_CST + indicating how many of the elements are non-default. */ + tree (*get_innermost_generic_parms) (const_tree); + + /* Returns the TREE_VEC of arguments of an instantiation + of a generic type of decl, e.g. C++ template instantiation. */ + tree (*get_innermost_generic_args) (const_tree); + + /* Determine if a tree is a function parameter pack. */ + bool (*function_parameter_pack_p) (const_tree); + + /* Perform language-specific gimplification on the argument. Returns an + enum gimplify_status, though we can't see that type here. */ + int (*gimplify_expr) (tree *, gimple_seq *, gimple_seq *); + + /* Do language specific processing in the builtin function DECL */ + tree (*builtin_function) (tree decl); + + /* Like builtin_function, but make sure the scope is the external scope. + This is used to delay putting in back end builtin functions until the ISA + that defines the builtin is declared via function specific target options, + which can save memory for machines like the x86_64 that have multiple + ISAs. If this points to the same function as builtin_function, the + backend must add all of the builtins at program initialization time. */ + tree (*builtin_function_ext_scope) (tree decl); + + /* Used to set up the tree_contains_structure array for a frontend. */ + void (*init_ts) (void); + + /* Called by recompute_tree_invariant_for_addr_expr to go from EXPR + to a contained expression or DECL, possibly updating *TC or *SE + if in the process TREE_CONSTANT or TREE_SIDE_EFFECTS need updating. */ + tree (*expr_to_decl) (tree expr, bool *tc, bool *se); + + /* The EH personality function decl. */ + tree (*eh_personality) (void); + + /* Map a type to a runtime object to match type. */ + tree (*eh_runtime_type) (tree); + + /* If non-NULL, this is a function that returns a function decl to be + executed if an unhandled exception is propagated out of a cleanup + region. For example, in C++, an exception thrown by a destructor + during stack unwinding is required to result in a call to + `std::terminate', so the C++ version of this function returns a + FUNCTION_DECL for `std::terminate'. */ + tree (*eh_protect_cleanup_actions) (void); + + /* Return true if a stmt can fallthru. Used by block_may_fallthru + to possibly handle language trees. */ + bool (*block_may_fallthru) (const_tree); + + /* True if this language uses __cxa_end_cleanup when the ARM EABI + is enabled. */ + bool eh_use_cxa_end_cleanup; + + /* True if this language requires deep unsharing of tree nodes prior to + gimplification. */ + bool deep_unsharing; + + /* True if this language may use custom descriptors for nested functions + instead of trampolines. */ + bool custom_function_descriptors; + + /* Run all lang-specific selftests. */ + void (*run_lang_selftests) (void); + + /* Attempt to determine the source location of the substring. + If successful, return NULL and write the source location to *OUT_LOC. + Otherwise return an error message. Error messages are intended + for GCC developers (to help debugging) rather than for end-users. */ + const char *(*get_substring_location) (const substring_loc &, + location_t *out_loc); + + /* Whenever you add entries here, make sure you adjust langhooks-def.h + and langhooks.c accordingly. */ +}; + +/* Each front end provides its own. */ +extern struct lang_hooks lang_hooks; + +extern tree add_builtin_function (const char *name, tree type, + int function_code, enum built_in_class cl, + const char *library_name, + tree attrs); + +extern tree add_builtin_function_ext_scope (const char *name, tree type, + int function_code, + enum built_in_class cl, + const char *library_name, + tree attrs); +extern tree add_builtin_type (const char *name, tree type); + +/* Language helper functions. */ + +extern bool lang_GNU_C (void); +extern bool lang_GNU_CXX (void); +extern bool lang_GNU_Fortran (void); +extern bool lang_GNU_OBJC (void); + +#endif /* GCC_LANG_HOOKS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lcm.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lcm.h new file mode 100644 index 0000000..e3e0ff3 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lcm.h @@ -0,0 +1,34 @@ +/* Generic partial redundancy elimination with lazy code motion header file. + Copyright (C) 2014-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_LCM_H +#define GCC_LCM_H + +extern struct edge_list *pre_edge_lcm_avs (int, sbitmap *, sbitmap *, + sbitmap *, sbitmap *, sbitmap *, + sbitmap *, sbitmap **, sbitmap **); +extern struct edge_list *pre_edge_lcm (int, sbitmap *, sbitmap *, + sbitmap *, sbitmap *, sbitmap **, + sbitmap **); +extern void compute_available (sbitmap *, sbitmap *, sbitmap *, sbitmap *); +extern struct edge_list *pre_edge_rev_lcm (int, sbitmap *, + sbitmap *, sbitmap *, + sbitmap *, sbitmap **, + sbitmap **); +#endif /* GCC_LCM_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/libfuncs.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/libfuncs.h new file mode 100644 index 0000000..3fc4047 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/libfuncs.h @@ -0,0 +1,84 @@ +/* Definitions for code generation pass of GNU compiler. + Copyright (C) 2001-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_LIBFUNCS_H +#define GCC_LIBFUNCS_H + + +/* Enumeration of indexes into libfunc_table. */ +enum libfunc_index +{ + LTI_unwind_sjlj_register, + LTI_unwind_sjlj_unregister, + LTI_synchronize, + LTI_MAX +}; + +/* Information about an optab-related libfunc. The op field is logically + an enum optab_d, and the mode fields are logically machine_mode. + However, in the absence of forward-declared enums, there's no practical + benefit of pulling in the defining headers. + + We use the same hashtable for normal optabs and conversion optabs. In + the first case mode2 is forced to VOIDmode. */ + +struct GTY((for_user)) libfunc_entry { + int op, mode1, mode2; + rtx libfunc; +}; + +/* Descriptor for libfunc_entry. */ + +struct libfunc_hasher : ggc_ptr_hash +{ + static hashval_t hash (libfunc_entry *); + static bool equal (libfunc_entry *, libfunc_entry *); +}; + +/* Target-dependent globals. */ +struct GTY(()) target_libfuncs { + /* SYMBOL_REF rtx's for the library functions that are called + implicitly and not via optabs. */ + rtx x_libfunc_table[LTI_MAX]; + + /* Hash table used to convert declarations into nodes. */ + hash_table *GTY(()) x_libfunc_hash; +}; + +extern GTY(()) struct target_libfuncs default_target_libfuncs; +#if SWITCHABLE_TARGET +extern struct target_libfuncs *this_target_libfuncs; +#else +#define this_target_libfuncs (&default_target_libfuncs) +#endif + +#define libfunc_table \ + (this_target_libfuncs->x_libfunc_table) + +/* Accessor macros for libfunc_table. */ + +#define unwind_sjlj_register_libfunc (libfunc_table[LTI_unwind_sjlj_register]) +#define unwind_sjlj_unregister_libfunc \ + (libfunc_table[LTI_unwind_sjlj_unregister]) +#define synchronize_libfunc (libfunc_table[LTI_synchronize]) + +/* In explow.c */ +extern void set_stack_check_libfunc (const char *); + +#endif /* GCC_LIBFUNCS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/libiberty.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/libiberty.h new file mode 100644 index 0000000..7a79612 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/libiberty.h @@ -0,0 +1,750 @@ +/* Function declarations for libiberty. + + Copyright (C) 1997-2017 Free Software Foundation, Inc. + + Note - certain prototypes declared in this header file are for + functions whoes implementation copyright does not belong to the + FSF. Those prototypes are present in this file for reference + purposes only and their presence in this file should not construed + as an indication of ownership by the FSF of the implementation of + those functions in any way or form whatsoever. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, + Boston, MA 02110-1301, USA. + + Written by Cygnus Support, 1994. + + The libiberty library provides a number of functions which are + missing on some operating systems. We do not declare those here, + to avoid conflicts with the system header files on operating + systems that do support those functions. In this file we only + declare those functions which are specific to libiberty. */ + +#ifndef LIBIBERTY_H +#define LIBIBERTY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "ansidecl.h" + +/* Get a definition for size_t. */ +#include +/* Get a definition for va_list. */ +#include + +#include + +/* If the OS supports it, ensure that the supplied stream is setup to + avoid any multi-threaded locking. Otherwise leave the FILE pointer + unchanged. If the stream is NULL do nothing. */ + +extern void unlock_stream (FILE *); + +/* If the OS supports it, ensure that the standard I/O streams, stdin, + stdout and stderr are setup to avoid any multi-threaded locking. + Otherwise do nothing. */ + +extern void unlock_std_streams (void); + +/* Open and return a FILE pointer. If the OS supports it, ensure that + the stream is setup to avoid any multi-threaded locking. Otherwise + return the FILE pointer unchanged. */ + +extern FILE *fopen_unlocked (const char *, const char *); +extern FILE *fdopen_unlocked (int, const char *); +extern FILE *freopen_unlocked (const char *, const char *, FILE *); + +/* Build an argument vector from a string. Allocates memory using + malloc. Use freeargv to free the vector. */ + +extern char **buildargv (const char *) ATTRIBUTE_MALLOC; + +/* Free a vector returned by buildargv. */ + +extern void freeargv (char **); + +/* Duplicate an argument vector. Allocates memory using malloc. Use + freeargv to free the vector. */ + +extern char **dupargv (char * const *) ATTRIBUTE_MALLOC; + +/* Expand "@file" arguments in argv. */ + +extern void expandargv (int *, char ***); + +/* Write argv to an @-file, inserting necessary quoting. */ + +extern int writeargv (char * const *, FILE *); + +/* Return the number of elements in argv. */ + +extern int countargv (char * const *); + +/* Return the last component of a path name. Note that we can't use a + prototype here because the parameter is declared inconsistently + across different systems, sometimes as "char *" and sometimes as + "const char *" */ + +/* HAVE_DECL_* is a three-state macro: undefined, 0 or 1. If it is + undefined, we haven't run the autoconf check so provide the + declaration without arguments. If it is 0, we checked and failed + to find the declaration so provide a fully prototyped one. If it + is 1, we found it so don't provide any declaration at all. */ +#if !HAVE_DECL_BASENAME +#if defined (__GNU_LIBRARY__ ) || defined (__linux__) \ + || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) \ + || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) \ + || defined (__DragonFly__) || defined (HAVE_DECL_BASENAME) +extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1); +#else +/* Do not allow basename to be used if there is no prototype seen. We + either need to use the above prototype or have one from + autoconf which would result in HAVE_DECL_BASENAME being set. */ +#define basename basename_cannot_be_used_without_a_prototype +#endif +#endif + +/* A well-defined basename () that is always compiled in. */ + +extern const char *lbasename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1); + +/* Same, but assumes DOS semantics (drive name, backslash is also a + dir separator) regardless of host. */ + +extern const char *dos_lbasename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1); + +/* Same, but assumes Unix semantics (absolute paths always start with + a slash, only forward slash is accepted as dir separator) + regardless of host. */ + +extern const char *unix_lbasename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1); + +/* A well-defined realpath () that is always compiled in. */ + +extern char *lrealpath (const char *); + +/* Concatenate an arbitrary number of strings. You must pass NULL as + the last argument of this function, to terminate the list of + strings. Allocates memory using xmalloc. */ + +extern char *concat (const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_SENTINEL; + +/* Concatenate an arbitrary number of strings. You must pass NULL as + the last argument of this function, to terminate the list of + strings. Allocates memory using xmalloc. The first argument is + not one of the strings to be concatenated, but if not NULL is a + pointer to be freed after the new string is created, similar to the + way xrealloc works. */ + +extern char *reconcat (char *, const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_SENTINEL; + +/* Determine the length of concatenating an arbitrary number of + strings. You must pass NULL as the last argument of this function, + to terminate the list of strings. */ + +extern unsigned long concat_length (const char *, ...) ATTRIBUTE_SENTINEL; + +/* Concatenate an arbitrary number of strings into a SUPPLIED area of + memory. You must pass NULL as the last argument of this function, + to terminate the list of strings. The supplied memory is assumed + to be large enough. */ + +extern char *concat_copy (char *, const char *, ...) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL; + +/* Concatenate an arbitrary number of strings into a GLOBAL area of + memory. You must pass NULL as the last argument of this function, + to terminate the list of strings. The supplied memory is assumed + to be large enough. */ + +extern char *concat_copy2 (const char *, ...) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_SENTINEL; + +/* This is the global area used by concat_copy2. */ + +extern char *libiberty_concat_ptr; + +/* Concatenate an arbitrary number of strings. You must pass NULL as + the last argument of this function, to terminate the list of + strings. Allocates memory using alloca. The arguments are + evaluated twice! */ +#define ACONCAT(ACONCAT_PARAMS) \ + (libiberty_concat_ptr = (char *) alloca (concat_length ACONCAT_PARAMS + 1), \ + concat_copy2 ACONCAT_PARAMS) + +/* Check whether two file descriptors refer to the same file. */ + +extern int fdmatch (int fd1, int fd2); + +/* Return the position of the first bit set in the argument. */ +/* Prototypes vary from system to system, so we only provide a + prototype on systems where we know that we need it. */ +#if defined (HAVE_DECL_FFS) && !HAVE_DECL_FFS +extern int ffs(int); +#endif + +/* Get the working directory. The result is cached, so don't call + chdir() between calls to getpwd(). */ + +extern char * getpwd (void); + +/* Get the current time. */ +/* Prototypes vary from system to system, so we only provide a + prototype on systems where we know that we need it. */ +#ifdef __MINGW32__ +/* Forward declaration to avoid #include . */ +struct timeval; +extern int gettimeofday (struct timeval *, void *); +#endif + +/* Get the amount of time the process has run, in microseconds. */ + +extern long get_run_time (void); + +/* Generate a relocated path to some installation directory. Allocates + return value using malloc. */ + +extern char *make_relative_prefix (const char *, const char *, + const char *) ATTRIBUTE_MALLOC; + +/* Generate a relocated path to some installation directory without + attempting to follow any soft links. Allocates + return value using malloc. */ + +extern char *make_relative_prefix_ignore_links (const char *, const char *, + const char *) ATTRIBUTE_MALLOC; + +/* Returns a pointer to a directory path suitable for creating temporary + files in. */ + +extern const char *choose_tmpdir (void) ATTRIBUTE_RETURNS_NONNULL; + +/* Choose a temporary directory to use for scratch files. */ + +extern char *choose_temp_base (void) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL; + +/* Return a temporary file name or NULL if unable to create one. */ + +extern char *make_temp_file (const char *) ATTRIBUTE_MALLOC; + +/* Remove a link to a file unless it is special. */ + +extern int unlink_if_ordinary (const char *); + +/* Allocate memory filled with spaces. Allocates using malloc. */ + +extern const char *spaces (int count); + +/* Return the maximum error number for which strerror will return a + string. */ + +extern int errno_max (void); + +/* Return the name of an errno value (e.g., strerrno (EINVAL) returns + "EINVAL"). */ + +extern const char *strerrno (int); + +/* Given the name of an errno value, return the value. */ + +extern int strtoerrno (const char *); + +/* ANSI's strerror(), but more robust. */ + +extern char *xstrerror (int) ATTRIBUTE_RETURNS_NONNULL; + +/* Return the maximum signal number for which strsignal will return a + string. */ + +extern int signo_max (void); + +/* Return a signal message string for a signal number + (e.g., strsignal (SIGHUP) returns something like "Hangup"). */ +/* This is commented out as it can conflict with one in system headers. + We still document its existence though. */ + +/*extern const char *strsignal (int);*/ + +/* Return the name of a signal number (e.g., strsigno (SIGHUP) returns + "SIGHUP"). */ + +extern const char *strsigno (int); + +/* Given the name of a signal, return its number. */ + +extern int strtosigno (const char *); + +/* Register a function to be run by xexit. Returns 0 on success. */ + +extern int xatexit (void (*fn) (void)); + +/* Exit, calling all the functions registered with xatexit. */ + +extern void xexit (int status) ATTRIBUTE_NORETURN; + +/* Set the program name used by xmalloc. */ + +extern void xmalloc_set_program_name (const char *); + +/* Report an allocation failure. */ +extern void xmalloc_failed (size_t) ATTRIBUTE_NORETURN; + +/* Allocate memory without fail. If malloc fails, this will print a + message to stderr (using the name set by xmalloc_set_program_name, + if any) and then call xexit. */ + +extern void *xmalloc (size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL; + +/* Reallocate memory without fail. This works like xmalloc. Note, + realloc type functions are not suitable for attribute malloc since + they may return the same address across multiple calls. */ + +extern void *xrealloc (void *, size_t) ATTRIBUTE_RETURNS_NONNULL; + +/* Allocate memory without fail and set it to zero. This works like + xmalloc. */ + +extern void *xcalloc (size_t, size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL; + +/* Copy a string into a memory buffer without fail. */ + +extern char *xstrdup (const char *) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL; + +/* Copy at most N characters from string into a buffer without fail. */ + +extern char *xstrndup (const char *, size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL; + +/* Copy an existing memory buffer to a new memory buffer without fail. */ + +extern void *xmemdup (const void *, size_t, size_t) ATTRIBUTE_MALLOC ATTRIBUTE_RETURNS_NONNULL; + +/* Physical memory routines. Return values are in BYTES. */ +extern double physmem_total (void); +extern double physmem_available (void); + +/* Compute the 32-bit CRC of a block of memory. */ +extern unsigned int xcrc32 (const unsigned char *, int, unsigned int); + +/* These macros provide a K&R/C89/C++-friendly way of allocating structures + with nice encapsulation. The XDELETE*() macros are technically + superfluous, but provided here for symmetry. Using them consistently + makes it easier to update client code to use different allocators such + as new/delete and new[]/delete[]. */ + +/* Scalar allocators. */ + +#define XALLOCA(T) ((T *) alloca (sizeof (T))) +#define XNEW(T) ((T *) xmalloc (sizeof (T))) +#define XCNEW(T) ((T *) xcalloc (1, sizeof (T))) +#define XDUP(T, P) ((T *) xmemdup ((P), sizeof (T), sizeof (T))) +#define XDELETE(P) free ((void*) (P)) + +/* Array allocators. */ + +#define XALLOCAVEC(T, N) ((T *) alloca (sizeof (T) * (N))) +#define XNEWVEC(T, N) ((T *) xmalloc (sizeof (T) * (N))) +#define XCNEWVEC(T, N) ((T *) xcalloc ((N), sizeof (T))) +#define XDUPVEC(T, P, N) ((T *) xmemdup ((P), sizeof (T) * (N), sizeof (T) * (N))) +#define XRESIZEVEC(T, P, N) ((T *) xrealloc ((void *) (P), sizeof (T) * (N))) +#define XDELETEVEC(P) free ((void*) (P)) + +/* Allocators for variable-sized structures and raw buffers. */ + +#define XALLOCAVAR(T, S) ((T *) alloca ((S))) +#define XNEWVAR(T, S) ((T *) xmalloc ((S))) +#define XCNEWVAR(T, S) ((T *) xcalloc (1, (S))) +#define XDUPVAR(T, P, S1, S2) ((T *) xmemdup ((P), (S1), (S2))) +#define XRESIZEVAR(T, P, S) ((T *) xrealloc ((P), (S))) + +/* Type-safe obstack allocator. */ + +#define XOBNEW(O, T) ((T *) obstack_alloc ((O), sizeof (T))) +#define XOBNEWVEC(O, T, N) ((T *) obstack_alloc ((O), sizeof (T) * (N))) +#define XOBNEWVAR(O, T, S) ((T *) obstack_alloc ((O), (S))) +#define XOBFINISH(O, T) ((T) obstack_finish ((O))) + +/* hex character manipulation routines */ + +#define _hex_array_size 256 +#define _hex_bad 99 +extern const unsigned char _hex_value[_hex_array_size]; +extern void hex_init (void); +#define hex_p(c) (hex_value (c) != _hex_bad) +/* If you change this, note well: Some code relies on side effects in + the argument being performed exactly once. */ +#define hex_value(c) ((unsigned int) _hex_value[(unsigned char) (c)]) + +/* Flags for pex_init. These are bits to be or'ed together. */ + +/* Record subprocess times, if possible. */ +#define PEX_RECORD_TIMES 0x1 + +/* Use pipes for communication between processes, if possible. */ +#define PEX_USE_PIPES 0x2 + +/* Save files used for communication between processes. */ +#define PEX_SAVE_TEMPS 0x4 + +/* Max number of alloca bytes per call before we must switch to malloc. + + ?? Swiped from gnulib's regex_internal.h header. Is this actually + the case? This number seems arbitrary, though sane. + + The OS usually guarantees only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + allocate anything larger than 4096 bytes. Also care for the possibility + of a few compiler-allocated temporary stack slots. */ +#define MAX_ALLOCA_SIZE 4032 + +/* Prepare to execute one or more programs, with standard output of + each program fed to standard input of the next. + FLAGS As above. + PNAME The name of the program to report in error messages. + TEMPBASE A base name to use for temporary files; may be NULL to + use a random name. + Returns NULL on error. */ + +extern struct pex_obj *pex_init (int flags, const char *pname, + const char *tempbase) ATTRIBUTE_RETURNS_NONNULL; + +/* Flags for pex_run. These are bits to be or'ed together. */ + +/* Last program in pipeline. Standard output of program goes to + OUTNAME, or, if OUTNAME is NULL, to standard output of caller. Do + not set this if you want to call pex_read_output. After this is + set, pex_run may no longer be called with the same struct + pex_obj. */ +#define PEX_LAST 0x1 + +/* Search for program in executable search path. */ +#define PEX_SEARCH 0x2 + +/* OUTNAME is a suffix. */ +#define PEX_SUFFIX 0x4 + +/* Send program's standard error to standard output. */ +#define PEX_STDERR_TO_STDOUT 0x8 + +/* Input file should be opened in binary mode. This flag is ignored + on Unix. */ +#define PEX_BINARY_INPUT 0x10 + +/* Output file should be opened in binary mode. This flag is ignored + on Unix. For proper behaviour PEX_BINARY_INPUT and + PEX_BINARY_OUTPUT have to match appropriately--i.e., a call using + PEX_BINARY_OUTPUT should be followed by a call using + PEX_BINARY_INPUT. */ +#define PEX_BINARY_OUTPUT 0x20 + +/* Capture stderr to a pipe. The output can be read by + calling pex_read_err and reading from the returned + FILE object. This flag may be specified only for + the last program in a pipeline. + + This flag is supported only on Unix and Windows. */ +#define PEX_STDERR_TO_PIPE 0x40 + +/* Capture stderr in binary mode. This flag is ignored + on Unix. */ +#define PEX_BINARY_ERROR 0x80 + +/* Append stdout to existing file instead of truncating it. */ +#define PEX_STDOUT_APPEND 0x100 + +/* Thes same as PEX_STDOUT_APPEND, but for STDERR. */ +#define PEX_STDERR_APPEND 0x200 + +/* Execute one program. Returns NULL on success. On error returns an + error string (typically just the name of a system call); the error + string is statically allocated. + + OBJ Returned by pex_init. + + FLAGS As above. + + EXECUTABLE The program to execute. + + ARGV NULL terminated array of arguments to pass to the program. + + OUTNAME Sets the output file name as follows: + + PEX_SUFFIX set (OUTNAME may not be NULL): + TEMPBASE parameter to pex_init not NULL: + Output file name is the concatenation of TEMPBASE + and OUTNAME. + TEMPBASE is NULL: + Output file name is a random file name ending in + OUTNAME. + PEX_SUFFIX not set: + OUTNAME not NULL: + Output file name is OUTNAME. + OUTNAME NULL, TEMPBASE not NULL: + Output file name is randomly chosen using + TEMPBASE. + OUTNAME NULL, TEMPBASE NULL: + Output file name is randomly chosen. + + If PEX_LAST is not set, the output file name is the + name to use for a temporary file holding stdout, if + any (there will not be a file if PEX_USE_PIPES is set + and the system supports pipes). If a file is used, it + will be removed when no longer needed unless + PEX_SAVE_TEMPS is set. + + If PEX_LAST is set, and OUTNAME is not NULL, standard + output is written to the output file name. The file + will not be removed. If PEX_LAST and PEX_SUFFIX are + both set, TEMPBASE may not be NULL. + + ERRNAME If not NULL, this is the name of a file to which + standard error is written. If NULL, standard error of + the program is standard error of the caller. + + ERR On an error return, *ERR is set to an errno value, or + to 0 if there is no relevant errno. +*/ + +extern const char *pex_run (struct pex_obj *obj, int flags, + const char *executable, char * const *argv, + const char *outname, const char *errname, + int *err); + +/* As for pex_run (), but takes an extra parameter to enable the + environment for the child process to be specified. + + ENV The environment for the child process, specified as + an array of character pointers. Each element of the + array should point to a string of the form VAR=VALUE, + with the exception of the last element which must be + a null pointer. +*/ + +extern const char *pex_run_in_environment (struct pex_obj *obj, int flags, + const char *executable, + char * const *argv, + char * const *env, + const char *outname, + const char *errname, int *err); + +/* Return a stream for a temporary file to pass to the first program + in the pipeline as input. The file name is chosen as for pex_run. + pex_run closes the file automatically; don't close it yourself. */ + +extern FILE *pex_input_file (struct pex_obj *obj, int flags, + const char *in_name); + +/* Return a stream for a pipe connected to the standard input of the + first program in the pipeline. You must have passed + `PEX_USE_PIPES' to `pex_init'. Close the returned stream + yourself. */ + +extern FILE *pex_input_pipe (struct pex_obj *obj, int binary); + +/* Read the standard output of the last program to be executed. + pex_run can not be called after this. BINARY should be non-zero if + the file should be opened in binary mode; this is ignored on Unix. + Returns NULL on error. Don't call fclose on the returned FILE; it + will be closed by pex_free. */ + +extern FILE *pex_read_output (struct pex_obj *, int binary); + +/* Read the standard error of the last program to be executed. + pex_run can not be called after this. BINARY should be non-zero if + the file should be opened in binary mode; this is ignored on Unix. + Returns NULL on error. Don't call fclose on the returned FILE; it + will be closed by pex_free. */ + +extern FILE *pex_read_err (struct pex_obj *, int binary); + +/* Return exit status of all programs in VECTOR. COUNT indicates the + size of VECTOR. The status codes in the vector are in the order of + the calls to pex_run. Returns 0 on error, 1 on success. */ + +extern int pex_get_status (struct pex_obj *, int count, int *vector); + +/* Return times of all programs in VECTOR. COUNT indicates the size + of VECTOR. struct pex_time is really just struct timeval, but that + is not portable to all systems. Returns 0 on error, 1 on + success. */ + +struct pex_time +{ + unsigned long user_seconds; + unsigned long user_microseconds; + unsigned long system_seconds; + unsigned long system_microseconds; +}; + +extern int pex_get_times (struct pex_obj *, int count, + struct pex_time *vector); + +/* Clean up a pex_obj. If you have not called pex_get_times or + pex_get_status, this will try to kill the subprocesses. */ + +extern void pex_free (struct pex_obj *); + +/* Just execute one program. Return value is as for pex_run. + FLAGS Combination of PEX_SEARCH and PEX_STDERR_TO_STDOUT. + EXECUTABLE As for pex_run. + ARGV As for pex_run. + PNAME As for pex_init. + OUTNAME As for pex_run when PEX_LAST is set. + ERRNAME As for pex_run. + STATUS Set to exit status on success. + ERR As for pex_run. +*/ + +extern const char *pex_one (int flags, const char *executable, + char * const *argv, const char *pname, + const char *outname, const char *errname, + int *status, int *err); + +/* pexecute and pwait are the old pexecute interface, still here for + backward compatibility. Don't use these for new code. Instead, + use pex_init/pex_run/pex_get_status/pex_free, or pex_one. */ + +/* Definitions used by the pexecute routine. */ + +#define PEXECUTE_FIRST 1 +#define PEXECUTE_LAST 2 +#define PEXECUTE_ONE (PEXECUTE_FIRST + PEXECUTE_LAST) +#define PEXECUTE_SEARCH 4 +#define PEXECUTE_VERBOSE 8 + +/* Execute a program. */ + +extern int pexecute (const char *, char * const *, const char *, + const char *, char **, char **, int); + +/* Wait for pexecute to finish. */ + +extern int pwait (int, int *, int); + +#if defined(HAVE_DECL_ASPRINTF) && !HAVE_DECL_ASPRINTF +/* Like sprintf but provides a pointer to malloc'd storage, which must + be freed by the caller. */ + +extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2; +#endif + +/* Like asprintf but allocates memory without fail. This works like + xmalloc. */ + +extern char *xasprintf (const char *, ...) ATTRIBUTE_MALLOC ATTRIBUTE_PRINTF_1; + +#if !HAVE_DECL_VASPRINTF +/* Like vsprintf but provides a pointer to malloc'd storage, which + must be freed by the caller. */ + +extern int vasprintf (char **, const char *, va_list) ATTRIBUTE_PRINTF(2,0); +#endif + +/* Like vasprintf but allocates memory without fail. This works like + xmalloc. */ + +extern char *xvasprintf (const char *, va_list) ATTRIBUTE_MALLOC ATTRIBUTE_PRINTF(1,0); + +#if defined(HAVE_DECL_SNPRINTF) && !HAVE_DECL_SNPRINTF +/* Like sprintf but prints at most N characters. */ +extern int snprintf (char *, size_t, const char *, ...) ATTRIBUTE_PRINTF_3; +#endif + +#if defined(HAVE_DECL_VSNPRINTF) && !HAVE_DECL_VSNPRINTF +/* Like vsprintf but prints at most N characters. */ +extern int vsnprintf (char *, size_t, const char *, va_list) ATTRIBUTE_PRINTF(3,0); +#endif + +#if defined (HAVE_DECL_STRNLEN) && !HAVE_DECL_STRNLEN +extern size_t strnlen (const char *, size_t); +#endif + +#if defined(HAVE_DECL_STRVERSCMP) && !HAVE_DECL_STRVERSCMP +/* Compare version strings. */ +extern int strverscmp (const char *, const char *); +#endif + +#if defined(HAVE_DECL_STRTOL) && !HAVE_DECL_STRTOL +extern long int strtol (const char *nptr, + char **endptr, int base); +#endif + +#if defined(HAVE_DECL_STRTOUL) && !HAVE_DECL_STRTOUL +extern unsigned long int strtoul (const char *nptr, + char **endptr, int base); +#endif + +#if defined(HAVE_LONG_LONG) && defined(HAVE_DECL_STRTOLL) && !HAVE_DECL_STRTOLL +__extension__ +extern long long int strtoll (const char *nptr, + char **endptr, int base); +#endif + +#if defined(HAVE_LONG_LONG) && defined(HAVE_DECL_STRTOULL) && !HAVE_DECL_STRTOULL +__extension__ +extern unsigned long long int strtoull (const char *nptr, + char **endptr, int base); +#endif + +#if defined(HAVE_DECL_STRVERSCMP) && !HAVE_DECL_STRVERSCMP +/* Compare version strings. */ +extern int strverscmp (const char *, const char *); +#endif + +/* Set the title of a process */ +extern void setproctitle (const char *name, ...); + +/* Increase stack limit if possible. */ +extern void stack_limit_increase (unsigned long); + +#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) + +/* Drastically simplified alloca configurator. If we're using GCC, + we use __builtin_alloca; otherwise we use the C alloca. The C + alloca is always available. You can override GCC by defining + USE_C_ALLOCA yourself. The canonical autoconf macro C_ALLOCA is + also set/unset as it is often used to indicate whether code needs + to call alloca(0). */ +extern void *C_alloca (size_t) ATTRIBUTE_MALLOC; +#undef alloca +#if GCC_VERSION >= 2000 && !defined USE_C_ALLOCA +# define alloca(x) __builtin_alloca(x) +# undef C_ALLOCA +# define ASTRDUP(X) \ + (__extension__ ({ const char *const libiberty_optr = (X); \ + const unsigned long libiberty_len = strlen (libiberty_optr) + 1; \ + char *const libiberty_nptr = (char *const) alloca (libiberty_len); \ + (char *) memcpy (libiberty_nptr, libiberty_optr, libiberty_len); })) +#else +# define alloca(x) C_alloca(x) +# undef USE_C_ALLOCA +# define USE_C_ALLOCA 1 +# undef C_ALLOCA +# define C_ALLOCA 1 +extern const char *libiberty_optr; +extern char *libiberty_nptr; +extern unsigned long libiberty_len; +# define ASTRDUP(X) \ + (libiberty_optr = (X), \ + libiberty_len = strlen (libiberty_optr) + 1, \ + libiberty_nptr = (char *) alloca (libiberty_len), \ + (char *) memcpy (libiberty_nptr, libiberty_optr, libiberty_len)) +#endif + +#ifdef __cplusplus +} +#endif + + +#endif /* ! defined (LIBIBERTY_H) */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/limitx.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/limitx.h new file mode 100644 index 0000000..dff1b70 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/limitx.h @@ -0,0 +1,35 @@ +/* Copyright (C) 1992-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +/* This administrivia gets added to the beginning of limits.h + if the system has its own version of limits.h. */ + +/* We use _GCC_LIMITS_H_ because we want this not to match + any macros that the system's limits.h uses for its own purposes. */ +#ifndef _GCC_LIMITS_H_ /* Terminated in limity.h. */ +#define _GCC_LIMITS_H_ + +#ifndef _LIBC_LIMITS_H_ +/* Use "..." so that we find syslimits.h only in this same directory. */ +#include "syslimits.h" +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/limity.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/limity.h new file mode 100644 index 0000000..8bb398f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/limity.h @@ -0,0 +1,10 @@ +/* This administrivia gets added to the end of limits.h + if the system has its own version of limits.h. */ + +#else /* not _GCC_LIMITS_H_ */ + +#ifdef _GCC_NEXT_LIMITS_H +#include_next /* recurse down to the real one */ +#endif + +#endif /* not _GCC_LIMITS_H_ */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/line-map.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/line-map.h new file mode 100644 index 0000000..522e8bb --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/line-map.h @@ -0,0 +1,1915 @@ +/* Map (unsigned int) keys to (source file, line, column) triples. + Copyright (C) 2001-2017 Free Software Foundation, Inc. + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; see the file COPYING3. If not see +. + + In other words, you are welcome to use, share and improve this program. + You are forbidden to forbid anyone else to use, share and improve + what you give them. Help stamp out software-hoarding! */ + +#ifndef LIBCPP_LINE_MAP_H +#define LIBCPP_LINE_MAP_H + +#ifndef GTY +#define GTY(x) /* nothing */ +#endif + +/* Reason for creating a new line map with linemap_add. LC_ENTER is + when including a new file, e.g. a #include directive in C. + LC_LEAVE is when reaching a file's end. LC_RENAME is when a file + name or line number changes for neither of the above reasons + (e.g. a #line directive in C); LC_RENAME_VERBATIM is like LC_RENAME + but a filename of "" is not specially interpreted as standard + input. LC_ENTER_MACRO is when a macro expansion is about to start. */ +enum lc_reason +{ + LC_ENTER = 0, + LC_LEAVE, + LC_RENAME, + LC_RENAME_VERBATIM, + LC_ENTER_MACRO + /* FIXME: add support for stringize and paste. */ +}; + +/* The type of line numbers. */ +typedef unsigned int linenum_type; + +/* The typedef "source_location" is a key within the location database, + identifying a source location or macro expansion, along with range + information, and (optionally) a pointer for use by gcc. + + This key only has meaning in relation to a line_maps instance. Within + gcc there is a single line_maps instance: "line_table", declared in + gcc/input.h and defined in gcc/input.c. + + The values of the keys are intended to be internal to libcpp, + but for ease-of-understanding the implementation, they are currently + assigned as follows: + + Actual | Value | Meaning + -----------+-------------------------------+------------------------------- + 0x00000000 | UNKNOWN_LOCATION (gcc/input.h)| Unknown/invalid location. + -----------+-------------------------------+------------------------------- + 0x00000001 | BUILTINS_LOCATION | The location for declarations + | (gcc/input.h) | in "" + -----------+-------------------------------+------------------------------- + 0x00000002 | RESERVED_LOCATION_COUNT | The first location to be + | (also | handed out, and the + | ordmap[0]->start_location) | first line in ordmap 0 + -----------+-------------------------------+------------------------------- + | ordmap[1]->start_location | First line in ordmap 1 + | ordmap[1]->start_location+32 | First column in that line + | (assuming range_bits == 5) | + | ordmap[1]->start_location+64 | 2nd column in that line + | ordmap[1]->start_location+4096| Second line in ordmap 1 + | (assuming column_bits == 12) + | + | Subsequent lines are offset by (1 << column_bits), + | e.g. 4096 for 12 bits, with a column value of 0 representing + | "the whole line". + | + | Within a line, the low "range_bits" (typically 5) are used for + | storing short ranges, so that there's an offset of + | (1 << range_bits) between individual columns within a line, + | typically 32. + | The low range_bits store the offset of the end point from the + | start point, and the start point is found by masking away + | the range bits. + | + | For example: + | ordmap[1]->start_location+64 "2nd column in that line" + | above means a caret at that location, with a range + | starting and finishing at the same place (the range bits + | are 0), a range of length 1. + | + | By contrast: + | ordmap[1]->start_location+68 + | has range bits 0x4, meaning a caret with a range starting at + | that location, but with endpoint 4 columns further on: a range + | of length 5. + | + | Ranges that have caret != start, or have an endpoint too + | far away to fit in range_bits are instead stored as ad-hoc + | locations. Hence for range_bits == 5 we can compactly store + | tokens of length <= 32 without needing to use the ad-hoc + | table. + | + | This packing scheme means we effectively have + | (column_bits - range_bits) + | of bits for the columns, typically (12 - 5) = 7, for 128 + | columns; longer line widths are accomodated by starting a + | new ordmap with a higher column_bits. + | + | ordmap[2]->start_location-1 | Final location in ordmap 1 + -----------+-------------------------------+------------------------------- + | ordmap[2]->start_location | First line in ordmap 2 + | ordmap[3]->start_location-1 | Final location in ordmap 2 + -----------+-------------------------------+------------------------------- + | | (etc) + -----------+-------------------------------+------------------------------- + | ordmap[n-1]->start_location | First line in final ord map + | | (etc) + | set->highest_location - 1 | Final location in that ordmap + -----------+-------------------------------+------------------------------- + | set->highest_location | Location of the where the next + | | ordinary linemap would start + -----------+-------------------------------+------------------------------- + | | + | VVVVVVVVVVVVVVVVVVVVVVVVVVV + | Ordinary maps grow this way + | + | (unallocated integers) + | + 0x60000000 | LINE_MAP_MAX_LOCATION_WITH_COLS + | Beyond this point, ordinary linemaps have 0 bits per column: + | each increment of the value corresponds to a new source line. + | + 0x70000000 | LINE_MAP_MAX_SOURCE_LOCATION + | Beyond the point, we give up on ordinary maps; attempts to + | create locations in them lead to UNKNOWN_LOCATION (0). + | + | (unallocated integers) + | + | Macro maps grow this way + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | | + -----------+-------------------------------+------------------------------- + | LINEMAPS_MACRO_LOWEST_LOCATION| Locations within macro maps + | macromap[m-1]->start_location | Start of last macro map + | | + -----------+-------------------------------+------------------------------- + | macromap[m-2]->start_location | Start of penultimate macro map + -----------+-------------------------------+------------------------------- + | macromap[1]->start_location | Start of macro map 1 + -----------+-------------------------------+------------------------------- + | macromap[0]->start_location | Start of macro map 0 + 0x7fffffff | MAX_SOURCE_LOCATION | Also used as a mask for + | | accessing the ad-hoc data table + -----------+-------------------------------+------------------------------- + 0x80000000 | Start of ad-hoc values; the lower 31 bits are used as an index + ... | into the line_table->location_adhoc_data_map.data array. + 0xffffffff | UINT_MAX | + -----------+-------------------------------+------------------------------- + + Examples of location encoding. + + Packed ranges + ============= + + Consider encoding the location of a token "foo", seen underlined here + on line 523, within an ordinary line_map that starts at line 500: + + 11111111112 + 12345678901234567890 + 522 + 523 return foo + bar; + ^~~ + 524 + + The location's caret and start are both at line 523, column 11; the + location's finish is on the same line, at column 13 (an offset of 2 + columns, for length 3). + + Line 523 is offset 23 from the starting line of the ordinary line_map. + + caret == start, and the offset of the finish fits within 5 bits, so + this can be stored as a packed range. + + This is encoded as: + ordmap->start + + (line_offset << ordmap->m_column_and_range_bits) + + (column << ordmap->m_range_bits) + + (range_offset); + i.e. (for line offset 23, column 11, range offset 2): + ordmap->start + + (23 << 12) + + (11 << 5) + + 2; + i.e.: + ordmap->start + 0x17162 + assuming that the line_map uses the default of 7 bits for columns and + 5 bits for packed range (giving 12 bits for m_column_and_range_bits). + + + "Pure" locations + ================ + + These are a special case of the above, where + caret == start == finish + They are stored as packed ranges with offset == 0. + For example, the location of the "f" of "foo" could be stored + as above, but with range offset 0, giving: + ordmap->start + + (23 << 12) + + (11 << 5) + + 0; + i.e.: + ordmap->start + 0x17160 + + + Unoptimized ranges + ================== + + Consider encoding the location of the binary expression + below: + + 11111111112 + 12345678901234567890 + 522 + 523 return foo + bar; + ~~~~^~~~~ + 524 + + The location's caret is at the "+", line 523 column 15, but starts + earlier, at the "f" of "foo" at column 11. The finish is at the "r" + of "bar" at column 19. + + This can't be stored as a packed range since start != caret. + Hence it is stored as an ad-hoc location e.g. 0x80000003. + + Stripping off the top bit gives us an index into the ad-hoc + lookaside table: + + line_table->location_adhoc_data_map.data[0x3] + + from which the caret, start and finish can be looked up, + encoded as "pure" locations: + + start == ordmap->start + (23 << 12) + (11 << 5) + == ordmap->start + 0x17160 (as above; the "f" of "foo") + + caret == ordmap->start + (23 << 12) + (15 << 5) + == ordmap->start + 0x171e0 + + finish == ordmap->start + (23 << 12) + (19 << 5) + == ordmap->start + 0x17260 + + To further see how source_location works in practice, see the + worked example in libcpp/location-example.txt. */ +typedef unsigned int source_location; + +/* Do not pack ranges if locations get higher than this. + If you change this, update: + gcc.dg/plugin/location-overflow-test-*.c. */ +const source_location LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES = 0x50000000; + +/* Do not track column numbers if locations get higher than this. + If you change this, update: + gcc.dg/plugin/location-overflow-test-*.c. */ +const source_location LINE_MAP_MAX_LOCATION_WITH_COLS = 0x60000000; + +/* A range of source locations. + + Ranges are closed: + m_start is the first location within the range, + m_finish is the last location within the range. + + We may need a more compact way to store these, but for now, + let's do it the simple way, as a pair. */ +struct GTY(()) source_range +{ + source_location m_start; + source_location m_finish; + + /* We avoid using constructors, since various structs that + don't yet have constructors will embed instances of + source_range. */ + + /* Make a source_range from a source_location. */ + static source_range from_location (source_location loc) + { + source_range result; + result.m_start = loc; + result.m_finish = loc; + return result; + } + + /* Make a source_range from a pair of source_location. */ + static source_range from_locations (source_location start, + source_location finish) + { + source_range result; + result.m_start = start; + result.m_finish = finish; + return result; + } + + /* Is there any part of this range on the given line? */ + bool intersects_line_p (const char *file, int line) const; +}; + +/* Memory allocation function typedef. Works like xrealloc. */ +typedef void *(*line_map_realloc) (void *, size_t); + +/* Memory allocator function that returns the actual allocated size, + for a given requested allocation. */ +typedef size_t (*line_map_round_alloc_size_func) (size_t); + +/* A line_map encodes a sequence of locations. + There are two kinds of maps. Ordinary maps and macro expansion + maps, a.k.a macro maps. + + A macro map encodes source locations of tokens that are part of a + macro replacement-list, at a macro expansion point. E.g, in: + + #define PLUS(A,B) A + B + + No macro map is going to be created there, because we are not at a + macro expansion point. We are at a macro /definition/ point. So the + locations of the tokens of the macro replacement-list (i.e, A + B) + will be locations in an ordinary map, not a macro map. + + On the other hand, if we later do: + + int a = PLUS (1,2); + + The invocation of PLUS here is a macro expansion. So we are at a + macro expansion point. The preprocessor expands PLUS (1,2) and + replaces it with the tokens of its replacement-list: 1 + 2. A macro + map is going to be created to hold (or rather to map, haha ...) the + locations of the tokens 1, + and 2. The macro map also records the + location of the expansion point of PLUS. That location is mapped in + the map that is active right before the location of the invocation + of PLUS. */ +struct GTY((tag ("0"), desc ("%h.reason == LC_ENTER_MACRO ? 2 : 1"))) line_map { + source_location start_location; + + /* The reason for creation of this line map. */ + ENUM_BITFIELD (lc_reason) reason : CHAR_BIT; +}; + +/* An ordinary line map encodes physical source locations. Those + physical source locations are called "spelling locations". + + Physical source file TO_FILE at line TO_LINE at column 0 is represented + by the logical START_LOCATION. TO_LINE+L at column C is represented by + START_LOCATION+(L*(1<column_and_range_bits (e.g. 12)-->| + +-------------------------+-----------------------+-------------------+ + | | column_and_range_bits | map->range_bits | + | | - range_bits | | + +-------------------------+-----------------------+-------------------+ + | row bits | effective column bits | short range bits | + | | (e.g. 7) | (e.g. 5) | + +-------------------------+-----------------------+-------------------+ */ + unsigned int m_range_bits : 8; +}; + +/* This is the highest possible source location encoded within an + ordinary or macro map. */ +const source_location MAX_SOURCE_LOCATION = 0x7FFFFFFF; + +struct cpp_hashnode; + +/* A macro line map encodes location of tokens coming from a macro + expansion. + + The offset from START_LOCATION is used to index into + MACRO_LOCATIONS; this holds the original location of the token. */ +struct GTY((tag ("2"))) line_map_macro : public line_map { + /* The cpp macro which expansion gave birth to this macro map. */ + struct cpp_hashnode * GTY ((nested_ptr (union tree_node, + "%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL", + "%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL"))) + macro; + + /* The number of tokens inside the replacement-list of MACRO. */ + unsigned int n_tokens; + + /* This array of location is actually an array of pairs of + locations. The elements inside it thus look like: + + x0,y0, x1,y1, x2,y2, ...., xn,yn. + + where n == n_tokens; + + Remember that these xI,yI are collected when libcpp is about to + expand a given macro. + + yI is the location in the macro definition, either of the token + itself or of a macro parameter that it replaces. + + Imagine this: + + #define PLUS(A, B) A + B <--- #1 + + int a = PLUS (1,2); <--- #2 + + There is a macro map for the expansion of PLUS in #2. PLUS is + expanded into its expansion-list. The expansion-list is the + replacement-list of PLUS where the macro parameters are replaced + with their arguments. So the replacement-list of PLUS is made of + the tokens: + + A, +, B + + and the expansion-list is made of the tokens: + + 1, +, 2 + + Let's consider the case of token "+". Its y1 [yI for I == 1] is + its spelling location in #1. + + y0 (thus for token "1") is the spelling location of A in #1. + + And y2 (of token "2") is the spelling location of B in #1. + + When the token is /not/ an argument for a macro, xI is the same + location as yI. Otherwise, xI is the location of the token + outside this macro expansion. If this macro was expanded from + another macro expansion, xI is a virtual location representing + the token in that macro expansion; otherwise, it is the spelling + location of the token. + + Note that a virtual location is a location returned by + linemap_add_macro_token. It encodes the relevant locations (x,y + pairs) of that token across the macro expansions from which it + (the token) might come from. + + In the example above x1 (for token "+") is going to be the same + as y1. x0 is the spelling location for the argument token "1", + and x2 is the spelling location for the argument token "2". */ + source_location * GTY((atomic)) macro_locations; + + /* This is the location of the expansion point of the current macro + map. It's the location of the macro name. That location is held + by the map that was current right before the current one. It + could have been either a macro or an ordinary map, depending on + if we are in a nested expansion context not. */ + source_location expansion; +}; + +#if CHECKING_P && (GCC_VERSION >= 2007) + +/* Assertion macro to be used in line-map code. */ +#define linemap_assert(EXPR) \ + do { \ + if (! (EXPR)) \ + abort (); \ + } while (0) + +/* Assert that becomes a conditional expression when checking is disabled at + compilation time. Use this for conditions that should not happen but if + they happen, it is better to handle them gracefully rather than crash + randomly later. + Usage: + + if (linemap_assert_fails(EXPR)) handle_error(); */ +#define linemap_assert_fails(EXPR) __extension__ \ + ({linemap_assert (EXPR); false;}) + +#else +/* Include EXPR, so that unused variable warnings do not occur. */ +#define linemap_assert(EXPR) ((void)(0 && (EXPR))) +#define linemap_assert_fails(EXPR) (! (EXPR)) +#endif + +/* Return TRUE if MAP encodes locations coming from a macro + replacement-list at macro expansion point. */ +bool +linemap_macro_expansion_map_p (const struct line_map *); + +/* Assert that MAP encodes locations of tokens that are not part of + the replacement-list of a macro expansion, downcasting from + line_map * to line_map_ordinary *. */ + +inline line_map_ordinary * +linemap_check_ordinary (struct line_map *map) +{ + linemap_assert (!linemap_macro_expansion_map_p (map)); + return (line_map_ordinary *)map; +} + +/* Assert that MAP encodes locations of tokens that are not part of + the replacement-list of a macro expansion, downcasting from + const line_map * to const line_map_ordinary *. */ + +inline const line_map_ordinary * +linemap_check_ordinary (const struct line_map *map) +{ + linemap_assert (!linemap_macro_expansion_map_p (map)); + return (const line_map_ordinary *)map; +} + +/* Assert that MAP is a macro expansion and downcast to the appropriate + subclass. */ + +inline line_map_macro *linemap_check_macro (line_map *map) +{ + linemap_assert (linemap_macro_expansion_map_p (map)); + return (line_map_macro *)map; +} + +/* Assert that MAP is a macro expansion and downcast to the appropriate + subclass. */ + +inline const line_map_macro * +linemap_check_macro (const line_map *map) +{ + linemap_assert (linemap_macro_expansion_map_p (map)); + return (const line_map_macro *)map; +} + +/* Read the start location of MAP. */ + +inline source_location +MAP_START_LOCATION (const line_map *map) +{ + return map->start_location; +} + +/* Get the starting line number of ordinary map MAP. */ + +inline linenum_type +ORDINARY_MAP_STARTING_LINE_NUMBER (const line_map_ordinary *ord_map) +{ + return ord_map->to_line; +} + +/* Get the index of the ordinary map at whose end + ordinary map MAP was included. + + File(s) at the bottom of the include stack have this set. */ + +inline int +ORDINARY_MAP_INCLUDER_FILE_INDEX (const line_map_ordinary *ord_map) +{ + return ord_map->included_from; +} + +/* Return a positive value if map encodes locations from a system + header, 0 otherwise. Returns 1 if ordinary map MAP encodes locations + in a system header and 2 if it encodes locations in a C system header + that therefore needs to be extern "C" protected in C++. */ + +inline unsigned char +ORDINARY_MAP_IN_SYSTEM_HEADER_P (const line_map_ordinary *ord_map) +{ + return ord_map->sysp; +} + +/* Get the filename of ordinary map MAP. */ + +inline const char * +ORDINARY_MAP_FILE_NAME (const line_map_ordinary *ord_map) +{ + return ord_map->to_file; +} + +/* Get the cpp macro whose expansion gave birth to macro map MAP. */ + +inline cpp_hashnode * +MACRO_MAP_MACRO (const line_map_macro *macro_map) +{ + return macro_map->macro; +} + +/* Get the number of tokens inside the replacement-list of the macro + that led to macro map MAP. */ + +inline unsigned int +MACRO_MAP_NUM_MACRO_TOKENS (const line_map_macro *macro_map) +{ + return macro_map->n_tokens; +} + +/* Get the array of pairs of locations within macro map MAP. + See the declaration of line_map_macro for more information. */ + +inline source_location * +MACRO_MAP_LOCATIONS (const line_map_macro *macro_map) +{ + return macro_map->macro_locations; +} + +/* Get the location of the expansion point of the macro map MAP. */ + +inline source_location +MACRO_MAP_EXPANSION_POINT_LOCATION (const line_map_macro *macro_map) +{ + return macro_map->expansion; +} + +/* The abstraction of a set of location maps. There can be several + types of location maps. This abstraction contains the attributes + that are independent from the type of the map. + + Essentially this is just a vector of T_linemap_subclass, + which can only ever grow in size. */ + +struct GTY(()) maps_info_ordinary { + /* This array contains the "ordinary" line maps, for all + events other than macro expansion + (e.g. when a new preprocessing unit starts or ends). */ + line_map_ordinary * GTY ((length ("%h.used"))) maps; + + /* The total number of allocated maps. */ + unsigned int allocated; + + /* The number of elements used in maps. This number is smaller + or equal to ALLOCATED. */ + unsigned int used; + + unsigned int cache; +}; + +struct GTY(()) maps_info_macro { + /* This array contains the macro line maps. + A macro line map is created whenever a macro expansion occurs. */ + line_map_macro * GTY ((length ("%h.used"))) maps; + + /* The total number of allocated maps. */ + unsigned int allocated; + + /* The number of elements used in maps. This number is smaller + or equal to ALLOCATED. */ + unsigned int used; + + unsigned int cache; +}; + +/* Data structure to associate a source_range together with an arbitrary + data pointer with a source location. */ +struct GTY(()) location_adhoc_data { + source_location locus; + source_range src_range; + void * GTY((skip)) data; +}; + +struct htab; + +/* The following data structure encodes a location with some adhoc data + and maps it to a new unsigned integer (called an adhoc location) + that replaces the original location to represent the mapping. + + The new adhoc_loc uses the highest bit as the enabling bit, i.e. if the + highest bit is 1, then the number is adhoc_loc. Otherwise, it serves as + the original location. Once identified as the adhoc_loc, the lower 31 + bits of the integer is used to index the location_adhoc_data array, + in which the locus and associated data is stored. */ + +struct GTY(()) location_adhoc_data_map { + struct htab * GTY((skip)) htab; + source_location curr_loc; + unsigned int allocated; + struct location_adhoc_data GTY((length ("%h.allocated"))) *data; +}; + +/* A set of chronological line_map structures. */ +struct GTY(()) line_maps { + + ~line_maps (); + + maps_info_ordinary info_ordinary; + + maps_info_macro info_macro; + + /* Depth of the include stack, including the current file. */ + unsigned int depth; + + /* If true, prints an include trace a la -H. */ + bool trace_includes; + + /* Highest source_location "given out". */ + source_location highest_location; + + /* Start of line of highest source_location "given out". */ + source_location highest_line; + + /* The maximum column number we can quickly allocate. Higher numbers + may require allocating a new line_map. */ + unsigned int max_column_hint; + + /* If non-null, the allocator to use when resizing 'maps'. If null, + xrealloc is used. */ + line_map_realloc reallocator; + + /* The allocators' function used to know the actual size it + allocated, for a certain allocation size requested. */ + line_map_round_alloc_size_func round_alloc_size; + + struct location_adhoc_data_map location_adhoc_data_map; + + /* The special location value that is used as spelling location for + built-in tokens. */ + source_location builtin_location; + + /* True if we've seen a #line or # 44 "file" directive. */ + bool seen_line_directive; + + /* The default value of range_bits in ordinary line maps. */ + unsigned int default_range_bits; + + unsigned int num_optimized_ranges; + unsigned int num_unoptimized_ranges; +}; + +/* Returns the number of allocated maps so far. MAP_KIND shall be TRUE + if we are interested in macro maps, FALSE otherwise. */ +inline unsigned int +LINEMAPS_ALLOCATED (const line_maps *set, bool map_kind) +{ + if (map_kind) + return set->info_macro.allocated; + else + return set->info_ordinary.allocated; +} + +/* As above, but by reference (e.g. as an lvalue). */ + +inline unsigned int & +LINEMAPS_ALLOCATED (line_maps *set, bool map_kind) +{ + if (map_kind) + return set->info_macro.allocated; + else + return set->info_ordinary.allocated; +} + +/* Returns the number of used maps so far. MAP_KIND shall be TRUE if + we are interested in macro maps, FALSE otherwise.*/ +inline unsigned int +LINEMAPS_USED (const line_maps *set, bool map_kind) +{ + if (map_kind) + return set->info_macro.used; + else + return set->info_ordinary.used; +} + +/* As above, but by reference (e.g. as an lvalue). */ + +inline unsigned int & +LINEMAPS_USED (line_maps *set, bool map_kind) +{ + if (map_kind) + return set->info_macro.used; + else + return set->info_ordinary.used; +} + +/* Returns the index of the last map that was looked up with + linemap_lookup. MAP_KIND shall be TRUE if we are interested in + macro maps, FALSE otherwise. */ +inline unsigned int +LINEMAPS_CACHE (const line_maps *set, bool map_kind) +{ + if (map_kind) + return set->info_macro.cache; + else + return set->info_ordinary.cache; +} + +/* As above, but by reference (e.g. as an lvalue). */ + +inline unsigned int & +LINEMAPS_CACHE (line_maps *set, bool map_kind) +{ + if (map_kind) + return set->info_macro.cache; + else + return set->info_ordinary.cache; +} + +/* Return the map at a given index. */ +inline line_map * +LINEMAPS_MAP_AT (const line_maps *set, bool map_kind, int index) +{ + if (map_kind) + return &set->info_macro.maps[index]; + else + return &set->info_ordinary.maps[index]; +} + +/* Returns the last map used in the line table SET. MAP_KIND + shall be TRUE if we are interested in macro maps, FALSE + otherwise.*/ +inline line_map * +LINEMAPS_LAST_MAP (const line_maps *set, bool map_kind) +{ + return LINEMAPS_MAP_AT (set, map_kind, + LINEMAPS_USED (set, map_kind) - 1); +} + +/* Returns the last map that was allocated in the line table SET. + MAP_KIND shall be TRUE if we are interested in macro maps, FALSE + otherwise.*/ +inline line_map * +LINEMAPS_LAST_ALLOCATED_MAP (const line_maps *set, bool map_kind) +{ + return LINEMAPS_MAP_AT (set, map_kind, + LINEMAPS_ALLOCATED (set, map_kind) - 1); +} + +/* Returns a pointer to the memory region where ordinary maps are + allocated in the line table SET. */ +inline line_map_ordinary * +LINEMAPS_ORDINARY_MAPS (const line_maps *set) +{ + return set->info_ordinary.maps; +} + +/* Returns the INDEXth ordinary map. */ +inline line_map_ordinary * +LINEMAPS_ORDINARY_MAP_AT (const line_maps *set, int index) +{ + linemap_assert (index >= 0); + linemap_assert ((unsigned int)index < set->info_ordinary.used); + return &set->info_ordinary.maps[index]; +} + +/* Return the number of ordinary maps allocated in the line table + SET. */ +inline unsigned int +LINEMAPS_ORDINARY_ALLOCATED (const line_maps *set) +{ + return LINEMAPS_ALLOCATED (set, false); +} + +/* Return the number of ordinary maps used in the line table SET. */ +inline unsigned int +LINEMAPS_ORDINARY_USED (const line_maps *set) +{ + return LINEMAPS_USED (set, false); +} + +/* Return the index of the last ordinary map that was looked up with + linemap_lookup. */ +inline unsigned int +LINEMAPS_ORDINARY_CACHE (const line_maps *set) +{ + return LINEMAPS_CACHE (set, false); +} + +/* As above, but by reference (e.g. as an lvalue). */ + +inline unsigned int & +LINEMAPS_ORDINARY_CACHE (line_maps *set) +{ + return LINEMAPS_CACHE (set, false); +} + +/* Returns a pointer to the last ordinary map used in the line table + SET. */ +inline line_map_ordinary * +LINEMAPS_LAST_ORDINARY_MAP (const line_maps *set) +{ + return (line_map_ordinary *)LINEMAPS_LAST_MAP (set, false); +} + +/* Returns a pointer to the last ordinary map allocated the line table + SET. */ +inline line_map_ordinary * +LINEMAPS_LAST_ALLOCATED_ORDINARY_MAP (const line_maps *set) +{ + return (line_map_ordinary *)LINEMAPS_LAST_ALLOCATED_MAP (set, false); +} + +/* Returns a pointer to the beginning of the region where macro maps + are allocated. */ +inline line_map_macro * +LINEMAPS_MACRO_MAPS (const line_maps *set) +{ + return set->info_macro.maps; +} + +/* Returns the INDEXth macro map. */ +inline line_map_macro * +LINEMAPS_MACRO_MAP_AT (const line_maps *set, int index) +{ + linemap_assert (index >= 0); + linemap_assert ((unsigned int)index < set->info_macro.used); + return &set->info_macro.maps[index]; +} + +/* Returns the number of macro maps that were allocated in the line + table SET. */ +inline unsigned int +LINEMAPS_MACRO_ALLOCATED (const line_maps *set) +{ + return LINEMAPS_ALLOCATED (set, true); +} + +/* Returns the number of macro maps used in the line table SET. */ +inline unsigned int +LINEMAPS_MACRO_USED (const line_maps *set) +{ + return LINEMAPS_USED (set, true); +} + +/* Returns the index of the last macro map looked up with + linemap_lookup. */ +inline unsigned int +LINEMAPS_MACRO_CACHE (const line_maps *set) +{ + return LINEMAPS_CACHE (set, true); +} + +/* As above, but by reference (e.g. as an lvalue). */ + +inline unsigned int & +LINEMAPS_MACRO_CACHE (line_maps *set) +{ + return LINEMAPS_CACHE (set, true); +} + +/* Returns the last macro map used in the line table SET. */ +inline line_map_macro * +LINEMAPS_LAST_MACRO_MAP (const line_maps *set) +{ + return (line_map_macro *)LINEMAPS_LAST_MAP (set, true); +} + +/* Returns the lowest location [of a token resulting from macro + expansion] encoded in this line table. */ +inline source_location +LINEMAPS_MACRO_LOWEST_LOCATION (const line_maps *set) +{ + return LINEMAPS_MACRO_USED (set) + ? MAP_START_LOCATION (LINEMAPS_LAST_MACRO_MAP (set)) + : MAX_SOURCE_LOCATION; +} + +/* Returns the last macro map allocated in the line table SET. */ +inline line_map_macro * +LINEMAPS_LAST_ALLOCATED_MACRO_MAP (const line_maps *set) +{ + return (line_map_macro *)LINEMAPS_LAST_ALLOCATED_MAP (set, true); +} + +extern source_location get_combined_adhoc_loc (struct line_maps *, + source_location, + source_range, + void *); +extern void *get_data_from_adhoc_loc (struct line_maps *, source_location); +extern source_location get_location_from_adhoc_loc (struct line_maps *, + source_location); + +extern source_range get_range_from_loc (line_maps *set, source_location loc); + +/* Get whether location LOC is an ad-hoc location. */ + +inline bool +IS_ADHOC_LOC (source_location loc) +{ + return (loc & MAX_SOURCE_LOCATION) != loc; +} + +/* Get whether location LOC is a "pure" location, or + whether it is an ad-hoc location, or embeds range information. */ + +bool +pure_location_p (line_maps *set, source_location loc); + +/* Given location LOC within SET, strip away any packed range information + or ad-hoc information. */ + +extern source_location get_pure_location (line_maps *set, + source_location loc); + +/* Combine LOC and BLOCK, giving a combined adhoc location. */ + +inline source_location +COMBINE_LOCATION_DATA (struct line_maps *set, + source_location loc, + source_range src_range, + void *block) +{ + return get_combined_adhoc_loc (set, loc, src_range, block); +} + +extern void rebuild_location_adhoc_htab (struct line_maps *); + +/* Initialize a line map set. SET is the line map set to initialize + and BUILTIN_LOCATION is the special location value to be used as + spelling location for built-in tokens. This BUILTIN_LOCATION has + to be strictly less than RESERVED_LOCATION_COUNT. */ +extern void linemap_init (struct line_maps *set, + source_location builtin_location); + +/* Check for and warn about line_maps entered but not exited. */ + +extern void linemap_check_files_exited (struct line_maps *); + +/* Return a source_location for the start (i.e. column==0) of + (physical) line TO_LINE in the current source file (as in the + most recent linemap_add). MAX_COLUMN_HINT is the highest column + number we expect to use in this line (but it does not change + the highest_location). */ + +extern source_location linemap_line_start +(struct line_maps *set, linenum_type to_line, unsigned int max_column_hint); + +/* Add a mapping of logical source line to physical source file and + line number. This function creates an "ordinary map", which is a + map that records locations of tokens that are not part of macro + replacement-lists present at a macro expansion point. + + The text pointed to by TO_FILE must have a lifetime + at least as long as the lifetime of SET. An empty + TO_FILE means standard input. If reason is LC_LEAVE, and + TO_FILE is NULL, then TO_FILE, TO_LINE and SYSP are given their + natural values considering the file we are returning to. + + A call to this function can relocate the previous set of + maps, so any stored line_map pointers should not be used. */ +extern const struct line_map *linemap_add + (struct line_maps *, enum lc_reason, unsigned int sysp, + const char *to_file, linenum_type to_line); + +/* Given a logical source location, returns the map which the + corresponding (source file, line, column) triplet can be deduced + from. Since the set is built chronologically, the logical lines are + monotonic increasing, and so the list is sorted and we can use a + binary search. If no line map have been allocated yet, this + function returns NULL. */ +extern const struct line_map *linemap_lookup + (struct line_maps *, source_location); + +/* Returns TRUE if the line table set tracks token locations across + macro expansion, FALSE otherwise. */ +bool linemap_tracks_macro_expansion_locs_p (struct line_maps *); + +/* Return the name of the macro associated to MACRO_MAP. */ +const char* linemap_map_get_macro_name (const line_map_macro *); + +/* Return a positive value if LOCATION is the locus of a token that is + located in a system header, O otherwise. It returns 1 if LOCATION + is the locus of a token that is located in a system header, and 2 + if LOCATION is the locus of a token located in a C system header + that therefore needs to be extern "C" protected in C++. + + Note that this function returns 1 if LOCATION belongs to a token + that is part of a macro replacement-list defined in a system + header, but expanded in a non-system file. */ +int linemap_location_in_system_header_p (struct line_maps *, + source_location); + +/* Return TRUE if LOCATION is a source code location of a token that is part of + a macro expansion, FALSE otherwise. */ +bool linemap_location_from_macro_expansion_p (const struct line_maps *, + source_location); + +/* TRUE if LOCATION is a source code location of a token that is part of the + definition of a macro, FALSE otherwise. */ +bool linemap_location_from_macro_definition_p (struct line_maps *, + source_location); + +/* With the precondition that LOCATION is the locus of a token that is + an argument of a function-like macro MACRO_MAP and appears in the + expansion of MACRO_MAP, return the locus of that argument in the + context of the caller of MACRO_MAP. */ + +extern source_location linemap_macro_map_loc_unwind_toward_spelling + (line_maps *set, const line_map_macro *macro_map, source_location location); + +/* source_location values from 0 to RESERVED_LOCATION_COUNT-1 will + be reserved for libcpp user as special values, no token from libcpp + will contain any of those locations. */ +const source_location RESERVED_LOCATION_COUNT = 2; + +/* Converts a map and a source_location to source line. */ +inline linenum_type +SOURCE_LINE (const line_map_ordinary *ord_map, source_location loc) +{ + return ((loc - ord_map->start_location) + >> ord_map->m_column_and_range_bits) + ord_map->to_line; +} + +/* Convert a map and source_location to source column number. */ +inline linenum_type +SOURCE_COLUMN (const line_map_ordinary *ord_map, source_location loc) +{ + return ((loc - ord_map->start_location) + & ((1 << ord_map->m_column_and_range_bits) - 1)) >> ord_map->m_range_bits; +} + +/* Return the location of the last source line within an ordinary + map. */ +inline source_location +LAST_SOURCE_LINE_LOCATION (const line_map_ordinary *map) +{ + return (((map[1].start_location - 1 + - map->start_location) + & ~((1 << map->m_column_and_range_bits) - 1)) + + map->start_location); +} + +/* Returns the last source line number within an ordinary map. This + is the (last) line of the #include, or other directive, that caused + a map change. */ +inline linenum_type +LAST_SOURCE_LINE (const line_map_ordinary *map) +{ + return SOURCE_LINE (map, LAST_SOURCE_LINE_LOCATION (map)); +} + +/* Return the last column number within an ordinary map. */ + +inline linenum_type +LAST_SOURCE_COLUMN (const line_map_ordinary *map) +{ + return SOURCE_COLUMN (map, LAST_SOURCE_LINE_LOCATION (map)); +} + +/* Returns the map a given map was included from, or NULL if the map + belongs to the main file, i.e, a file that wasn't included by + another one. */ +inline line_map_ordinary * +INCLUDED_FROM (struct line_maps *set, const line_map_ordinary *ord_map) +{ + return ((ord_map->included_from == -1) + ? NULL + : LINEMAPS_ORDINARY_MAP_AT (set, ord_map->included_from)); +} + +/* True if the map is at the bottom of the include stack. */ + +inline bool +MAIN_FILE_P (const line_map_ordinary *ord_map) +{ + return ord_map->included_from < 0; +} + +/* Encode and return a source_location from a column number. The + source line considered is the last source line used to call + linemap_line_start, i.e, the last source line which a location was + encoded from. */ +extern source_location +linemap_position_for_column (struct line_maps *, unsigned int); + +/* Encode and return a source location from a given line and + column. */ +source_location +linemap_position_for_line_and_column (line_maps *set, + const line_map_ordinary *, + linenum_type, unsigned int); + +/* Encode and return a source_location starting from location LOC and + shifting it by OFFSET columns. This function does not support + virtual locations. */ +source_location +linemap_position_for_loc_and_offset (struct line_maps *set, + source_location loc, + unsigned int offset); + +/* Return the file this map is for. */ +inline const char * +LINEMAP_FILE (const line_map_ordinary *ord_map) +{ + return ord_map->to_file; +} + +/* Return the line number this map started encoding location from. */ +inline linenum_type +LINEMAP_LINE (const line_map_ordinary *ord_map) +{ + return ord_map->to_line; +} + +/* Return a positive value if map encodes locations from a system + header, 0 otherwise. Returns 1 if MAP encodes locations in a + system header and 2 if it encodes locations in a C system header + that therefore needs to be extern "C" protected in C++. */ +inline unsigned char +LINEMAP_SYSP (const line_map_ordinary *ord_map) +{ + return ord_map->sysp; +} + +/* Return a positive value if PRE denotes the location of a token that + comes before the token of POST, 0 if PRE denotes the location of + the same token as the token for POST, and a negative value + otherwise. */ +int linemap_compare_locations (struct line_maps *set, + source_location pre, + source_location post); + +/* Return TRUE if LOC_A denotes the location a token that comes + topogically before the token denoted by location LOC_B, or if they + are equal. */ +inline bool +linemap_location_before_p (struct line_maps *set, + source_location loc_a, + source_location loc_b) +{ + return linemap_compare_locations (set, loc_a, loc_b) >= 0; +} + +typedef struct +{ + /* The name of the source file involved. */ + const char *file; + + /* The line-location in the source file. */ + int line; + + int column; + + void *data; + + /* In a system header?. */ + bool sysp; +} expanded_location; + +/* Both gcc and emacs number source *lines* starting at 1, but + they have differing conventions for *columns*. + + GCC uses a 1-based convention for source columns, + whereas Emacs's M-x column-number-mode uses a 0-based convention. + + For example, an error in the initial, left-hand + column of source line 3 is reported by GCC as: + + some-file.c:3:1: error: ...etc... + + On navigating to the location of that error in Emacs + (e.g. via "next-error"), + the locus is reported in the Mode Line + (assuming M-x column-number-mode) as: + + some-file.c 10% (3, 0) + + i.e. "3:1:" in GCC corresponds to "(3, 0)" in Emacs. */ + +/* A location within a rich_location: a caret&range, with + the caret potentially flagged for display. */ + +struct location_range +{ + source_location m_loc; + + /* Should a caret be drawn for this range? Typically this is + true for the 0th range, and false for subsequent ranges, + but the Fortran frontend overrides this for rendering things like: + + x = x + y + 1 2 + Error: Shapes for operands at (1) and (2) are not conformable + + where "1" and "2" are notionally carets. */ + bool m_show_caret_p; +}; + +/* A partially-embedded vec for use within rich_location for storing + ranges and fix-it hints. + + Elements [0..NUM_EMBEDDED) are allocated within m_embed, after + that they are within the dynamically-allocated m_extra. + + This allows for static allocation in the common case, whilst + supporting the rarer case of an arbitrary number of elements. + + Dynamic allocation is not performed unless it's needed. */ + +template +class semi_embedded_vec +{ + public: + semi_embedded_vec (); + ~semi_embedded_vec (); + + unsigned int count () const { return m_num; } + T& operator[] (int idx); + const T& operator[] (int idx) const; + + void push (const T&); + void truncate (int len); + + private: + int m_num; + T m_embedded[NUM_EMBEDDED]; + int m_alloc; + T *m_extra; +}; + +/* Constructor for semi_embedded_vec. In particular, no dynamic allocation + is done. */ + +template +semi_embedded_vec::semi_embedded_vec () +: m_num (0), m_alloc (0), m_extra (NULL) +{ +} + +/* semi_embedded_vec's dtor. Release any dynamically-allocated memory. */ + +template +semi_embedded_vec::~semi_embedded_vec () +{ + XDELETEVEC (m_extra); +} + +/* Look up element IDX, mutably. */ + +template +T& +semi_embedded_vec::operator[] (int idx) +{ + linemap_assert (idx < m_num); + if (idx < NUM_EMBEDDED) + return m_embedded[idx]; + else + { + linemap_assert (m_extra != NULL); + return m_extra[idx - NUM_EMBEDDED]; + } +} + +/* Look up element IDX (const). */ + +template +const T& +semi_embedded_vec::operator[] (int idx) const +{ + linemap_assert (idx < m_num); + if (idx < NUM_EMBEDDED) + return m_embedded[idx]; + else + { + linemap_assert (m_extra != NULL); + return m_extra[idx - NUM_EMBEDDED]; + } +} + +/* Append VALUE to the end of the semi_embedded_vec. */ + +template +void +semi_embedded_vec::push (const T& value) +{ + int idx = m_num++; + if (idx < NUM_EMBEDDED) + m_embedded[idx] = value; + else + { + /* Offset "idx" to be an index within m_extra. */ + idx -= NUM_EMBEDDED; + if (NULL == m_extra) + { + linemap_assert (m_alloc == 0); + m_alloc = 16; + m_extra = XNEWVEC (T, m_alloc); + } + else if (idx >= m_alloc) + { + linemap_assert (m_alloc > 0); + m_alloc *= 2; + m_extra = XRESIZEVEC (T, m_extra, m_alloc); + } + linemap_assert (m_extra); + linemap_assert (idx < m_alloc); + m_extra[idx] = value; + } +} + +/* Truncate to length LEN. No deallocation is performed. */ + +template +void +semi_embedded_vec::truncate (int len) +{ + linemap_assert (len <= m_num); + m_num = len; +} + +class fixit_hint; + class fixit_insert; + class fixit_replace; + +/* A "rich" source code location, for use when printing diagnostics. + A rich_location has one or more carets&ranges, where the carets + are optional. These are referred to as "ranges" from here. + Typically the zeroth range has a caret; other ranges sometimes + have carets. + + The "primary" location of a rich_location is the caret of range 0, + used for determining the line/column when printing diagnostic + text, such as: + + some-file.c:3:1: error: ...etc... + + Additional ranges may be added to help the user identify other + pertinent clauses in a diagnostic. + + rich_location instances are intended to be allocated on the stack + when generating diagnostics, and to be short-lived. + + Examples of rich locations + -------------------------- + + Example A + ********* + int i = "foo"; + ^ + This "rich" location is simply a single range (range 0), with + caret = start = finish at the given point. + + Example B + ********* + a = (foo && bar) + ~~~~~^~~~~~~ + This rich location has a single range (range 0), with the caret + at the first "&", and the start/finish at the parentheses. + Compare with example C below. + + Example C + ********* + a = (foo && bar) + ~~~ ^~ ~~~ + This rich location has three ranges: + - Range 0 has its caret and start location at the first "&" and + end at the second "&. + - Range 1 has its start and finish at the "f" and "o" of "foo"; + the caret is not flagged for display, but is perhaps at the "f" + of "foo". + - Similarly, range 2 has its start and finish at the "b" and "r" of + "bar"; the caret is not flagged for display, but is perhaps at the + "b" of "bar". + Compare with example B above. + + Example D (Fortran frontend) + **************************** + x = x + y + 1 2 + This rich location has range 0 at "1", and range 1 at "2". + Both are flagged for caret display. Both ranges have start/finish + equal to their caret point. The frontend overrides the diagnostic + context's default caret character for these ranges. + + Example E + ********* + printf ("arg0: %i arg1: %s arg2: %i", + ^~ + 100, 101, 102); + ~~~ + This rich location has two ranges: + - range 0 is at the "%s" with start = caret = "%" and finish at + the "s". + - range 1 has start/finish covering the "101" and is not flagged for + caret printing; it is perhaps at the start of "101". + + + Fix-it hints + ------------ + + Rich locations can also contain "fix-it hints", giving suggestions + for the user on how to edit their code to fix a problem. These + can be expressed as insertions, replacements, and removals of text. + The edits by default are relative to the zeroth range within the + rich_location, but optionally they can be expressed relative to + other locations (using various overloaded methods of the form + rich_location::add_fixit_*). + + For example: + + Example F: fix-it hint: insert_before + ************************************* + ptr = arr[0]; + ^~~~~~ + & + This rich location has a single range (range 0) covering "arr[0]", + with the caret at the start. The rich location has a single + insertion fix-it hint, inserted before range 0, added via + richloc.add_fixit_insert_before ("&"); + + Example G: multiple fix-it hints: insert_before and insert_after + **************************************************************** + #define FN(ARG0, ARG1, ARG2) fn(ARG0, ARG1, ARG2) + ^~~~ ^~~~ ^~~~ + ( ) ( ) ( ) + This rich location has three ranges, covering "arg0", "arg1", + and "arg2", all with caret-printing enabled. + The rich location has 6 insertion fix-it hints: each arg + has a pair of insertion fix-it hints, suggesting wrapping + them with parentheses: one a '(' inserted before, + the other a ')' inserted after, added via + richloc.add_fixit_insert_before (LOC, "("); + and + richloc.add_fixit_insert_after (LOC, ")"); + + Example H: fix-it hint: removal + ******************************* + struct s {int i};; + ^ + - + This rich location has a single range at the stray trailing + semicolon, along with a single removal fix-it hint, covering + the same range, added via: + richloc.add_fixit_remove (); + + Example I: fix-it hint: replace + ******************************* + c = s.colour; + ^~~~~~ + color + This rich location has a single range (range 0) covering "colour", + and a single "replace" fix-it hint, covering the same range, + added via + richloc.add_fixit_replace ("color"); + + Adding a fix-it hint can fail: for example, attempts to insert content + at the transition between two line maps may fail due to there being no + source_location (aka location_t) value to express the new location. + + Attempts to add a fix-it hint within a macro expansion will fail. + + We do not yet support newlines in fix-it text; attempts to do so will fail. + + The rich_location API handles these failures gracefully, so that + diagnostics can attempt to add fix-it hints without each needing + extensive checking. + + Fix-it hints within a rich_location are "atomic": if any hints can't + be applied, none of them will be (tracked by the m_seen_impossible_fixit + flag), and no fix-its hints will be displayed for that rich_location. + This implies that diagnostic messages need to be worded in such a way + that they make sense whether or not the fix-it hints are displayed, + or that richloc.seen_impossible_fixit_p () should be checked before + issuing the diagnostics. */ + +class rich_location +{ + public: + /* Constructors. */ + + /* Constructing from a location. */ + rich_location (line_maps *set, source_location loc); + + /* Destructor. */ + ~rich_location (); + + /* Accessors. */ + source_location get_loc () const { return get_loc (0); } + source_location get_loc (unsigned int idx) const; + + void + add_range (source_location loc, bool show_caret_p); + + void + set_range (line_maps *set, unsigned int idx, source_location loc, + bool show_caret_p); + + unsigned int get_num_locations () const { return m_ranges.count (); } + + const location_range *get_range (unsigned int idx) const; + location_range *get_range (unsigned int idx); + + expanded_location get_expanded_location (unsigned int idx); + + void + override_column (int column); + + /* Fix-it hints. */ + + /* Methods for adding insertion fix-it hints. */ + + /* Suggest inserting NEW_CONTENT immediately before the primary + range's start. */ + void + add_fixit_insert_before (const char *new_content); + + /* Suggest inserting NEW_CONTENT immediately before the start of WHERE. */ + void + add_fixit_insert_before (source_location where, + const char *new_content); + + /* Suggest inserting NEW_CONTENT immediately after the end of the primary + range. */ + void + add_fixit_insert_after (const char *new_content); + + /* Suggest inserting NEW_CONTENT immediately after the end of WHERE. */ + void + add_fixit_insert_after (source_location where, + const char *new_content); + + /* Methods for adding removal fix-it hints. */ + + /* Suggest removing the content covered by range 0. */ + void + add_fixit_remove (); + + /* Suggest removing the content covered between the start and finish + of WHERE. */ + void + add_fixit_remove (source_location where); + + /* Suggest removing the content covered by SRC_RANGE. */ + void + add_fixit_remove (source_range src_range); + + /* Methods for adding "replace" fix-it hints. */ + + /* Suggest replacing the content covered by range 0 with NEW_CONTENT. */ + void + add_fixit_replace (const char *new_content); + + /* Suggest replacing the content between the start and finish of + WHERE with NEW_CONTENT. */ + void + add_fixit_replace (source_location where, + const char *new_content); + + /* Suggest replacing the content covered by SRC_RANGE with + NEW_CONTENT. */ + void + add_fixit_replace (source_range src_range, + const char *new_content); + + unsigned int get_num_fixit_hints () const { return m_fixit_hints.count (); } + fixit_hint *get_fixit_hint (int idx) const { return m_fixit_hints[idx]; } + fixit_hint *get_last_fixit_hint () const; + bool seen_impossible_fixit_p () const { return m_seen_impossible_fixit; } + +private: + bool reject_impossible_fixit (source_location where); + void stop_supporting_fixits (); + void add_fixit (fixit_hint *hint); + +public: + static const int STATICALLY_ALLOCATED_RANGES = 3; + +protected: + line_maps *m_line_table; + semi_embedded_vec m_ranges; + + int m_column_override; + + bool m_have_expanded_location; + expanded_location m_expanded_location; + + static const int MAX_STATIC_FIXIT_HINTS = 2; + semi_embedded_vec m_fixit_hints; + + bool m_seen_impossible_fixit; +}; + +class fixit_hint +{ +public: + enum kind {INSERT, REPLACE}; + + virtual ~fixit_hint () {} + + virtual enum kind get_kind () const = 0; + virtual bool affects_line_p (const char *file, int line) const = 0; + virtual source_location get_start_loc () const = 0; + virtual bool maybe_get_end_loc (source_location *out) const = 0; + /* Vfunc for consolidating successor fixits. */ + virtual bool maybe_append_replace (line_maps *set, + source_range src_range, + const char *new_content) = 0; +}; + +class fixit_insert : public fixit_hint +{ + public: + fixit_insert (source_location where, + const char *new_content); + ~fixit_insert (); + enum kind get_kind () const { return INSERT; } + bool affects_line_p (const char *file, int line) const; + source_location get_start_loc () const { return m_where; } + bool maybe_get_end_loc (source_location *) const { return false; } + bool maybe_append_replace (line_maps *set, + source_range src_range, + const char *new_content); + + source_location get_location () const { return m_where; } + const char *get_string () const { return m_bytes; } + size_t get_length () const { return m_len; } + + private: + source_location m_where; + char *m_bytes; + size_t m_len; +}; + +class fixit_replace : public fixit_hint +{ + public: + fixit_replace (source_range src_range, + const char *new_content); + ~fixit_replace (); + + enum kind get_kind () const { return REPLACE; } + bool affects_line_p (const char *file, int line) const; + source_location get_start_loc () const { return m_src_range.m_start; } + bool maybe_get_end_loc (source_location *out) const + { + *out = m_src_range.m_finish; + return true; + } + bool maybe_append_replace (line_maps *set, + source_range src_range, + const char *new_content); + + source_range get_range () const { return m_src_range; } + const char *get_string () const { return m_bytes; } + size_t get_length () const { return m_len; } + + private: + source_range m_src_range; + char *m_bytes; + size_t m_len; +}; + + +/* This is enum is used by the function linemap_resolve_location + below. The meaning of the values is explained in the comment of + that function. */ +enum location_resolution_kind +{ + LRK_MACRO_EXPANSION_POINT, + LRK_SPELLING_LOCATION, + LRK_MACRO_DEFINITION_LOCATION +}; + +/* Resolve a virtual location into either a spelling location, an + expansion point location or a token argument replacement point + location. Return the map that encodes the virtual location as well + as the resolved location. + + If LOC is *NOT* the location of a token resulting from the + expansion of a macro, then the parameter LRK (which stands for + Location Resolution Kind) is ignored and the resulting location + just equals the one given in argument. + + Now if LOC *IS* the location of a token resulting from the + expansion of a macro, this is what happens. + + * If LRK is set to LRK_MACRO_EXPANSION_POINT + ------------------------------- + + The virtual location is resolved to the first macro expansion point + that led to this macro expansion. + + * If LRK is set to LRK_SPELLING_LOCATION + ------------------------------------- + + The virtual location is resolved to the locus where the token has + been spelled in the source. This can follow through all the macro + expansions that led to the token. + + * If LRK is set to LRK_MACRO_DEFINITION_LOCATION + -------------------------------------- + + The virtual location is resolved to the locus of the token in the + context of the macro definition. + + If LOC is the locus of a token that is an argument of a + function-like macro [replacing a parameter in the replacement list + of the macro] the virtual location is resolved to the locus of the + parameter that is replaced, in the context of the definition of the + macro. + + If LOC is the locus of a token that is not an argument of a + function-like macro, then the function behaves as if LRK was set to + LRK_SPELLING_LOCATION. + + If LOC_MAP is not NULL, *LOC_MAP is set to the map encoding the + returned location. Note that if the returned location wasn't originally + encoded by a map, the *MAP is set to NULL. This can happen if LOC + resolves to a location reserved for the client code, like + UNKNOWN_LOCATION or BUILTINS_LOCATION in GCC. */ + +source_location linemap_resolve_location (struct line_maps *, + source_location loc, + enum location_resolution_kind lrk, + const line_map_ordinary **loc_map); + +/* Suppose that LOC is the virtual location of a token coming from the + expansion of a macro M. This function then steps up to get the + location L of the point where M got expanded. If L is a spelling + location inside a macro expansion M', then this function returns + the point where M' was expanded. LOC_MAP is an output parameter. + When non-NULL, *LOC_MAP is set to the map of the returned + location. */ +source_location linemap_unwind_toward_expansion (struct line_maps *, + source_location loc, + const struct line_map **loc_map); + +/* If LOC is the virtual location of a token coming from the expansion + of a macro M and if its spelling location is reserved (e.g, a + location for a built-in token), then this function unwinds (using + linemap_unwind_toward_expansion) the location until a location that + is not reserved and is not in a system header is reached. In other + words, this unwinds the reserved location until a location that is + in real source code is reached. + + Otherwise, if the spelling location for LOC is not reserved or if + LOC doesn't come from the expansion of a macro, the function + returns LOC as is and *MAP is not touched. + + *MAP is set to the map of the returned location if the later is + different from LOC. */ +source_location linemap_unwind_to_first_non_reserved_loc (struct line_maps *, + source_location loc, + const struct line_map **map); + +/* Expand source code location LOC and return a user readable source + code location. LOC must be a spelling (non-virtual) location. If + it's a location < RESERVED_LOCATION_COUNT a zeroed expanded source + location is returned. */ +expanded_location linemap_expand_location (struct line_maps *, + const struct line_map *, + source_location loc); + +/* Statistics about maps allocation and usage as returned by + linemap_get_statistics. */ +struct linemap_stats +{ + long num_ordinary_maps_allocated; + long num_ordinary_maps_used; + long ordinary_maps_allocated_size; + long ordinary_maps_used_size; + long num_expanded_macros; + long num_macro_tokens; + long num_macro_maps_used; + long macro_maps_allocated_size; + long macro_maps_used_size; + long macro_maps_locations_size; + long duplicated_macro_maps_locations_size; + long adhoc_table_size; + long adhoc_table_entries_used; +}; + +/* Return the highest location emitted for a given file for which + there is a line map in SET. FILE_NAME is the file name to + consider. If the function returns TRUE, *LOC is set to the highest + location emitted for that file. */ +bool linemap_get_file_highest_location (struct line_maps * set, + const char *file_name, + source_location *loc); + +/* Compute and return statistics about the memory consumption of some + parts of the line table SET. */ +void linemap_get_statistics (struct line_maps *, struct linemap_stats *); + +/* Dump debugging information about source location LOC into the file + stream STREAM. SET is the line map set LOC comes from. */ +void linemap_dump_location (struct line_maps *, source_location, FILE *); + +/* Dump line map at index IX in line table SET to STREAM. If STREAM + is NULL, use stderr. IS_MACRO is true if the caller wants to + dump a macro map, false otherwise. */ +void linemap_dump (FILE *, struct line_maps *, unsigned, bool); + +/* Dump line table SET to STREAM. If STREAM is NULL, stderr is used. + NUM_ORDINARY specifies how many ordinary maps to dump. NUM_MACRO + specifies how many macro maps to dump. */ +void line_table_dump (FILE *, struct line_maps *, unsigned int, unsigned int); + +/* The rich_location class requires a way to expand source_location instances. + We would directly use expand_location_to_spelling_point, which is + implemented in gcc/input.c, but we also need to use it for rich_location + within genmatch.c. + Hence we require client code of libcpp to implement the following + symbol. */ +extern expanded_location +linemap_client_expand_location_to_spelling_point (source_location ); + +#endif /* !LIBCPP_LINE_MAP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/loop-unroll.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/loop-unroll.h new file mode 100644 index 0000000..31e51c1 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/loop-unroll.h @@ -0,0 +1,27 @@ +/* Loop unrolling header file. + Copyright (C) 2014-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_LOOP_UNROLL_H +#define GCC_LOOP_UNROLL_H + +extern void unroll_loops (int); +extern basic_block split_edge_and_insert (edge, rtx_insn *); + + +#endif /* GCC_LOOP_UNROLL_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lower-subreg.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lower-subreg.h new file mode 100644 index 0000000..4aed62f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lower-subreg.h @@ -0,0 +1,60 @@ +/* Target-dependent costs for lower-subreg.c. + Copyright (C) 2012-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef LOWER_SUBREG_H +#define LOWER_SUBREG_H 1 + +/* Information about whether, and where, lower-subreg should be applied. */ +struct lower_subreg_choices { + /* A boolean vector for move splitting that is indexed by mode and is + true for each mode that is to have its copies split. */ + bool move_modes_to_split[MAX_MACHINE_MODE]; + + /* True if zero-extensions from word_mode to twice_word_mode should + be split. */ + bool splitting_zext; + + /* Index X is true if twice_word_mode shifts by X + BITS_PER_WORD + should be split. */ + bool splitting_ashift[MAX_BITS_PER_WORD]; + bool splitting_lshiftrt[MAX_BITS_PER_WORD]; + bool splitting_ashiftrt[MAX_BITS_PER_WORD]; + + /* True if there is at least one mode that is worth splitting. */ + bool something_to_do; +}; + +/* Target-specific information for the subreg lowering pass. */ +struct target_lower_subreg { + /* An integer mode that is twice as wide as word_mode. */ + machine_mode x_twice_word_mode; + + /* What we have decided to do when optimizing for size (index 0) + and speed (index 1). */ + struct lower_subreg_choices x_choices[2]; +}; + +extern struct target_lower_subreg default_target_lower_subreg; +#if SWITCHABLE_TARGET +extern struct target_lower_subreg *this_target_lower_subreg; +#else +#define this_target_lower_subreg (&default_target_lower_subreg) +#endif + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lra-int.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lra-int.h new file mode 100644 index 0000000..4050717 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lra-int.h @@ -0,0 +1,526 @@ +/* Local Register Allocator (LRA) intercommunication header file. + Copyright (C) 2010-2017 Free Software Foundation, Inc. + Contributed by Vladimir Makarov . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_LRA_INT_H +#define GCC_LRA_INT_H + +#define lra_assert(c) gcc_checking_assert (c) + +/* The parameter used to prevent infinite reloading for an insn. Each + insn operands might require a reload and, if it is a memory, its + base and index registers might require a reload too. */ +#define LRA_MAX_INSN_RELOADS (MAX_RECOG_OPERANDS * 3) + +typedef struct lra_live_range *lra_live_range_t; + +/* The structure describes program points where a given pseudo lives. + The live ranges can be used to find conflicts with other pseudos. + If the live ranges of two pseudos are intersected, the pseudos are + in conflict. */ +struct lra_live_range +{ + /* Pseudo regno whose live range is described by given + structure. */ + int regno; + /* Program point range. */ + int start, finish; + /* Next structure describing program points where the pseudo + lives. */ + lra_live_range_t next; + /* Pointer to structures with the same start. */ + lra_live_range_t start_next; +}; + +typedef struct lra_copy *lra_copy_t; + +/* Copy between pseudos which affects assigning hard registers. */ +struct lra_copy +{ + /* True if regno1 is the destination of the copy. */ + bool regno1_dest_p; + /* Execution frequency of the copy. */ + int freq; + /* Pseudos connected by the copy. REGNO1 < REGNO2. */ + int regno1, regno2; + /* Next copy with correspondingly REGNO1 and REGNO2. */ + lra_copy_t regno1_next, regno2_next; +}; + +/* Common info about a register (pseudo or hard register). */ +struct lra_reg +{ + /* Bitmap of UIDs of insns (including debug insns) referring the + reg. */ + bitmap_head insn_bitmap; + /* The following fields are defined only for pseudos. */ + /* Hard registers with which the pseudo conflicts. */ + HARD_REG_SET conflict_hard_regs; + /* Call used registers with which the pseudo conflicts, taking into account + the registers used by functions called from calls which cross the + pseudo. */ + HARD_REG_SET actual_call_used_reg_set; + /* We assign hard registers to reload pseudos which can occur in few + places. So two hard register preferences are enough for them. + The following fields define the preferred hard registers. If + there are no such hard registers the first field value is + negative. If there is only one preferred hard register, the 2nd + field is negative. */ + int preferred_hard_regno1, preferred_hard_regno2; + /* Profits to use the corresponding preferred hard registers. If + the both hard registers defined, the first hard register has not + less profit than the second one. */ + int preferred_hard_regno_profit1, preferred_hard_regno_profit2; +#ifdef STACK_REGS + /* True if the pseudo should not be assigned to a stack register. */ + bool no_stack_p; +#endif + /* True if the pseudo crosses a call. It is setup in lra-lives.c + and used to check that the pseudo crossing a call did not get a + call used hard register. */ + bool call_p; + /* Number of references and execution frequencies of the register in + *non-debug* insns. */ + int nrefs, freq; + int last_reload; + /* rtx used to undo the inheritance. It can be non-null only + between subsequent inheritance and undo inheritance passes. */ + rtx restore_rtx; + /* Value holding by register. If the pseudos have the same value + they do not conflict. */ + int val; + /* Offset from relative eliminate register to pesudo reg. */ + int offset; + /* These members are set up in lra-lives.c and updated in + lra-coalesce.c. */ + /* The biggest size mode in which each pseudo reg is referred in + whole function (possibly via subreg). */ + machine_mode biggest_mode; + /* Live ranges of the pseudo. */ + lra_live_range_t live_ranges; + /* This member is set up in lra-lives.c for subsequent + assignments. */ + lra_copy_t copies; +}; + +/* References to the common info about each register. */ +extern struct lra_reg *lra_reg_info; + +/* Static info about each insn operand (common for all insns with the + same ICODE). Warning: if the structure definition is changed, the + initializer for debug_operand_data in lra.c should be changed + too. */ +struct lra_operand_data +{ + /* The machine description constraint string of the operand. */ + const char *constraint; + /* Alternatives for which early_clobber can be true. */ + alternative_mask early_clobber_alts; + /* It is taken only from machine description (which is different + from recog_data.operand_mode) and can be of VOIDmode. */ + ENUM_BITFIELD(machine_mode) mode : 16; + /* The type of the operand (in/out/inout). */ + ENUM_BITFIELD (op_type) type : 8; + /* Through if accessed through STRICT_LOW. */ + unsigned int strict_low : 1; + /* True if the operand is an operator. */ + unsigned int is_operator : 1; + /* True if there is an early clobber alternative for this operand. + This field is set up every time when corresponding + operand_alternative in lra_static_insn_data is set up. */ + unsigned int early_clobber : 1; + /* True if the operand is an address. */ + unsigned int is_address : 1; +}; + +/* Info about register occurrence in an insn. */ +struct lra_insn_reg +{ + /* Alternatives for which early_clobber can be true. */ + alternative_mask early_clobber_alts; + /* The biggest mode through which the insn refers to the register + occurrence (remember the register can be accessed through a + subreg in the insn). */ + ENUM_BITFIELD(machine_mode) biggest_mode : 16; + /* The type of the corresponding operand which is the register. */ + ENUM_BITFIELD (op_type) type : 8; + /* True if the reg is accessed through a subreg and the subreg is + just a part of the register. */ + unsigned int subreg_p : 1; + /* True if there is an early clobber alternative for this + operand. */ + unsigned int early_clobber : 1; + /* The corresponding regno of the register. */ + int regno; + /* Next reg info of the same insn. */ + struct lra_insn_reg *next; +}; + +/* Static part (common info for insns with the same ICODE) of LRA + internal insn info. It exists in at most one exemplar for each + non-negative ICODE. There is only one exception. Each asm insn has + own structure. Warning: if the structure definition is changed, + the initializer for debug_insn_static_data in lra.c should be + changed too. */ +struct lra_static_insn_data +{ + /* Static info about each insn operand. */ + struct lra_operand_data *operand; + /* Each duplication refers to the number of the corresponding + operand which is duplicated. */ + int *dup_num; + /* The number of an operand marked as commutative, -1 otherwise. */ + int commutative; + /* Number of operands, duplications, and alternatives of the + insn. */ + char n_operands; + char n_dups; + char n_alternatives; + /* Insns in machine description (or clobbers in asm) may contain + explicit hard regs which are not operands. The following list + describes such hard registers. */ + struct lra_insn_reg *hard_regs; + /* Array [n_alternatives][n_operand] of static constraint info for + given operand in given alternative. This info can be changed if + the target reg info is changed. */ + const struct operand_alternative *operand_alternative; +}; + +/* LRA internal info about an insn (LRA internal insn + representation). */ +struct lra_insn_recog_data +{ + /* The insn code. */ + int icode; + /* The alternative should be used for the insn, -1 if invalid, or we + should try to use any alternative, or the insn is a debug + insn. */ + int used_insn_alternative; + /* SP offset before the insn relative to one at the func start. */ + HOST_WIDE_INT sp_offset; + /* The insn itself. */ + rtx_insn *insn; + /* Common data for insns with the same ICODE. Asm insns (their + ICODE is negative) do not share such structures. */ + struct lra_static_insn_data *insn_static_data; + /* Two arrays of size correspondingly equal to the operand and the + duplication numbers: */ + rtx **operand_loc; /* The operand locations, NULL if no operands. */ + rtx **dup_loc; /* The dup locations, NULL if no dups. */ + /* Number of hard registers implicitly used/clobbered in given call + insn. The value can be NULL or points to array of the hard + register numbers ending with a negative value. To differ + clobbered and used hard regs, clobbered hard regs are incremented + by FIRST_PSEUDO_REGISTER. */ + int *arg_hard_regs; + /* Cached value of get_preferred_alternatives. */ + alternative_mask preferred_alternatives; + /* The following member value is always NULL for a debug insn. */ + struct lra_insn_reg *regs; +}; + +typedef struct lra_insn_recog_data *lra_insn_recog_data_t; + +/* Whether the clobber is used temporary in LRA. */ +#define LRA_TEMP_CLOBBER_P(x) \ + (RTL_FLAG_CHECK1 ("TEMP_CLOBBER_P", (x), CLOBBER)->unchanging) + +/* Cost factor for each additional reload and maximal cost reject for + insn reloads. One might ask about such strange numbers. Their + values occurred historically from former reload pass. */ +#define LRA_LOSER_COST_FACTOR 6 +#define LRA_MAX_REJECT 600 + +/* Maximum allowed number of assignment pass iterations after the + latest spill pass when any former reload pseudo was spilled. It is + for preventing LRA cycling in a bug case. */ +#define LRA_MAX_ASSIGNMENT_ITERATION_NUMBER 30 + +/* The maximal number of inheritance/split passes in LRA. It should + be more 1 in order to perform caller saves transformations and much + less MAX_CONSTRAINT_ITERATION_NUMBER to prevent LRA to do as many + as permitted constraint passes in some complicated cases. The + first inheritance/split pass has a biggest impact on generated code + quality. Each subsequent affects generated code in less degree. + For example, the 3rd pass does not change generated SPEC2000 code + at all on x86-64. */ +#define LRA_MAX_INHERITANCE_PASSES 2 + +#if LRA_MAX_INHERITANCE_PASSES <= 0 \ + || LRA_MAX_INHERITANCE_PASSES >= LRA_MAX_ASSIGNMENT_ITERATION_NUMBER - 8 +#error wrong LRA_MAX_INHERITANCE_PASSES value +#endif + +/* Analogous macro to the above one but for rematerialization. */ +#define LRA_MAX_REMATERIALIZATION_PASSES 2 + +#if LRA_MAX_REMATERIALIZATION_PASSES <= 0 \ + || LRA_MAX_REMATERIALIZATION_PASSES >= LRA_MAX_ASSIGNMENT_ITERATION_NUMBER - 8 +#error wrong LRA_MAX_REMATERIALIZATION_PASSES value +#endif + +/* lra.c: */ + +extern FILE *lra_dump_file; + +extern bool lra_reg_spill_p; + +extern HARD_REG_SET lra_no_alloc_regs; + +extern int lra_insn_recog_data_len; +extern lra_insn_recog_data_t *lra_insn_recog_data; + +extern int lra_curr_reload_num; + +extern void lra_dump_bitmap_with_title (const char *, bitmap, int); +extern hashval_t lra_rtx_hash (rtx x); +extern void lra_push_insn (rtx_insn *); +extern void lra_push_insn_by_uid (unsigned int); +extern void lra_push_insn_and_update_insn_regno_info (rtx_insn *); +extern rtx_insn *lra_pop_insn (void); +extern unsigned int lra_insn_stack_length (void); + +extern rtx lra_create_new_reg_with_unique_value (machine_mode, rtx, + enum reg_class, const char *); +extern void lra_set_regno_unique_value (int); +extern void lra_invalidate_insn_data (rtx_insn *); +extern void lra_set_insn_deleted (rtx_insn *); +extern void lra_delete_dead_insn (rtx_insn *); +extern void lra_emit_add (rtx, rtx, rtx); +extern void lra_emit_move (rtx, rtx); +extern void lra_update_dups (lra_insn_recog_data_t, signed char *); + +extern void lra_process_new_insns (rtx_insn *, rtx_insn *, rtx_insn *, + const char *); + +extern bool lra_substitute_pseudo (rtx *, int, rtx, bool); +extern bool lra_substitute_pseudo_within_insn (rtx_insn *, int, rtx, bool); + +extern lra_insn_recog_data_t lra_set_insn_recog_data (rtx_insn *); +extern lra_insn_recog_data_t lra_update_insn_recog_data (rtx_insn *); +extern void lra_set_used_insn_alternative (rtx_insn *, int); +extern void lra_set_used_insn_alternative_by_uid (int, int); + +extern void lra_invalidate_insn_regno_info (rtx_insn *); +extern void lra_update_insn_regno_info (rtx_insn *); +extern struct lra_insn_reg *lra_get_insn_regs (int); + +extern void lra_free_copies (void); +extern void lra_create_copy (int, int, int); +extern lra_copy_t lra_get_copy (int); +extern bool lra_former_scratch_p (int); +extern bool lra_former_scratch_operand_p (rtx_insn *, int); +extern void lra_register_new_scratch_op (rtx_insn *, int); + +extern int lra_new_regno_start; +extern int lra_constraint_new_regno_start; +extern int lra_bad_spill_regno_start; +extern bitmap_head lra_inheritance_pseudos; +extern bitmap_head lra_split_regs; +extern bitmap_head lra_subreg_reload_pseudos; +extern bitmap_head lra_optional_reload_pseudos; + +/* lra-constraints.c: */ + +extern void lra_init_equiv (void); +extern int lra_constraint_offset (int, machine_mode); + +extern int lra_constraint_iter; +extern bool lra_risky_transformations_p; +extern int lra_inheritance_iter; +extern int lra_undo_inheritance_iter; +extern bool lra_constrain_insn (rtx_insn *); +extern bool lra_constraints (bool); +extern void lra_constraints_init (void); +extern void lra_constraints_finish (void); +extern void lra_inheritance (void); +extern bool lra_undo_inheritance (void); + +/* lra-lives.c: */ + +extern int lra_live_max_point; +extern int *lra_point_freq; + +extern int lra_hard_reg_usage[FIRST_PSEUDO_REGISTER]; + +extern int lra_live_range_iter; +extern void lra_create_live_ranges (bool, bool); +extern lra_live_range_t lra_copy_live_range_list (lra_live_range_t); +extern lra_live_range_t lra_merge_live_ranges (lra_live_range_t, + lra_live_range_t); +extern bool lra_intersected_live_ranges_p (lra_live_range_t, + lra_live_range_t); +extern void lra_print_live_range_list (FILE *, lra_live_range_t); +extern void debug (lra_live_range &ref); +extern void debug (lra_live_range *ptr); +extern void lra_debug_live_range_list (lra_live_range_t); +extern void lra_debug_pseudo_live_ranges (int); +extern void lra_debug_live_ranges (void); +extern void lra_clear_live_ranges (void); +extern void lra_live_ranges_init (void); +extern void lra_live_ranges_finish (void); +extern void lra_setup_reload_pseudo_preferenced_hard_reg (int, int, int); + +/* lra-assigns.c: */ + +extern int lra_assignment_iter; +extern int lra_assignment_iter_after_spill; +extern void lra_setup_reg_renumber (int, int, bool); +extern bool lra_assign (void); + + +/* lra-coalesce.c: */ + +extern int lra_coalesce_iter; +extern bool lra_coalesce (void); + +/* lra-spills.c: */ + +extern bool lra_need_for_spills_p (void); +extern void lra_spill (void); +extern void lra_final_code_change (void); + +/* lra-remat.c: */ + +extern int lra_rematerialization_iter; +extern bool lra_remat (void); + +/* lra-elimination.c: */ + +extern void lra_debug_elim_table (void); +extern int lra_get_elimination_hard_regno (int); +extern rtx lra_eliminate_regs_1 (rtx_insn *, rtx, machine_mode, + bool, bool, HOST_WIDE_INT, bool); +extern void eliminate_regs_in_insn (rtx_insn *insn, bool, bool, HOST_WIDE_INT); +extern void lra_eliminate (bool, bool); + +extern void lra_eliminate_reg_if_possible (rtx *); + + + +/* Return the hard register which given pseudo REGNO assigned to. + Negative value means that the register got memory or we don't know + allocation yet. */ +static inline int +lra_get_regno_hard_regno (int regno) +{ + resize_reg_info (); + return reg_renumber[regno]; +} + +/* Change class of pseudo REGNO to NEW_CLASS. Print info about it + using TITLE. Output a new line if NL_P. */ +static void inline +lra_change_class (int regno, enum reg_class new_class, + const char *title, bool nl_p) +{ + lra_assert (regno >= FIRST_PSEUDO_REGISTER); + if (lra_dump_file != NULL) + fprintf (lra_dump_file, "%s class %s for r%d", + title, reg_class_names[new_class], regno); + setup_reg_classes (regno, new_class, NO_REGS, new_class); + if (lra_dump_file != NULL && nl_p) + fprintf (lra_dump_file, "\n"); +} + +/* Update insn operands which are duplication of NOP operand. The + insn is represented by its LRA internal representation ID. */ +static inline void +lra_update_dup (lra_insn_recog_data_t id, int nop) +{ + int i; + struct lra_static_insn_data *static_id = id->insn_static_data; + + for (i = 0; i < static_id->n_dups; i++) + if (static_id->dup_num[i] == nop) + *id->dup_loc[i] = *id->operand_loc[nop]; +} + +/* Process operator duplications in insn with ID. We do it after the + operands processing. Generally speaking, we could do this probably + simultaneously with operands processing because a common practice + is to enumerate the operators after their operands. */ +static inline void +lra_update_operator_dups (lra_insn_recog_data_t id) +{ + int i; + struct lra_static_insn_data *static_id = id->insn_static_data; + + for (i = 0; i < static_id->n_dups; i++) + { + int ndup = static_id->dup_num[i]; + + if (static_id->operand[ndup].is_operator) + *id->dup_loc[i] = *id->operand_loc[ndup]; + } +} + +/* Return info about INSN. Set up the info if it is not done yet. */ +static inline lra_insn_recog_data_t +lra_get_insn_recog_data (rtx_insn *insn) +{ + lra_insn_recog_data_t data; + unsigned int uid = INSN_UID (insn); + + if (lra_insn_recog_data_len > (int) uid + && (data = lra_insn_recog_data[uid]) != NULL) + { + /* Check that we did not change insn without updating the insn + info. */ + lra_assert (data->insn == insn + && (INSN_CODE (insn) < 0 + || data->icode == INSN_CODE (insn))); + return data; + } + return lra_set_insn_recog_data (insn); +} + +/* Update offset from pseudos with VAL by INCR. */ +static inline void +lra_update_reg_val_offset (int val, int incr) +{ + int i; + + for (i = FIRST_PSEUDO_REGISTER; i < max_reg_num (); i++) + { + if (lra_reg_info[i].val == val) + lra_reg_info[i].offset += incr; + } +} + +/* Return true if register content is equal to VAL with OFFSET. */ +static inline bool +lra_reg_val_equal_p (int regno, int val, int offset) +{ + if (lra_reg_info[regno].val == val + && lra_reg_info[regno].offset == offset) + return true; + + return false; +} + +/* Assign value of register FROM to TO. */ +static inline void +lra_assign_reg_val (int from, int to) +{ + lra_reg_info[to].val = lra_reg_info[from].val; + lra_reg_info[to].offset = lra_reg_info[from].offset; +} + +#endif /* GCC_LRA_INT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lra.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lra.h new file mode 100644 index 0000000..bd9422e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lra.h @@ -0,0 +1,44 @@ +/* Communication between the Local Register Allocator (LRA) and + the rest of the compiler. + Copyright (C) 2010-2017 Free Software Foundation, Inc. + Contributed by Vladimir Makarov . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_LRA_H +#define GCC_LRA_H + +extern bool lra_simple_p; + +/* Return the allocno reg class of REGNO. If it is a reload pseudo, + the pseudo should finally get hard register of the allocno + class. */ +static inline enum reg_class +lra_get_allocno_class (int regno) +{ + resize_reg_info (); + return reg_allocno_class (regno); +} + +extern rtx lra_create_new_reg (machine_mode, rtx, enum reg_class, + const char *); +extern rtx lra_eliminate_regs (rtx, machine_mode, rtx); +extern void lra (FILE *); +extern void lra_init_once (void); +extern void lra_finish_once (void); + +#endif /* GCC_LRA_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lto-compress.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lto-compress.h new file mode 100644 index 0000000..e7a846a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lto-compress.h @@ -0,0 +1,42 @@ +/* LTO IL compression streams. + + Copyright (C) 2009-2017 Free Software Foundation, Inc. + Contributed by Simon Baldwin + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_LTO_COMPRESS_H +#define GCC_LTO_COMPRESS_H + +struct lto_compression_stream; + +/* In lto-compress.c. */ +extern struct lto_compression_stream + *lto_start_compression (void (*callback) (const char *, unsigned, void *), + void *opaque); +extern void lto_compress_block (struct lto_compression_stream *stream, + const char *base, size_t num_chars); +extern void lto_end_compression (struct lto_compression_stream *stream); + +extern struct lto_compression_stream + *lto_start_uncompression (void (*callback) (const char *, unsigned, void *), + void *opaque); +extern void lto_uncompress_block (struct lto_compression_stream *stream, + const char *base, size_t num_chars); +extern void lto_end_uncompression (struct lto_compression_stream *stream); + +#endif /* GCC_LTO_COMPRESS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lto-section-names.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lto-section-names.h new file mode 100644 index 0000000..9684a95 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lto-section-names.h @@ -0,0 +1,41 @@ +/* Definitions for LTO section names. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_LTO_SECTION_NAMES_H +#define GCC_LTO_SECTION_NAMES_H + +/* The string that is the prefix on the section names we make for lto. + For decls the DECL_ASSEMBLER_NAME is appended to make the section + name for the functions and static_initializers. For other types of + sections a '.' and the section type are appended. */ +#define LTO_SECTION_NAME_PREFIX ".gnu.lto_" +#define OFFLOAD_SECTION_NAME_PREFIX ".gnu.offload_lto_" + +/* Can be either OFFLOAD_SECTION_NAME_PREFIX when we stream IR for offload + compiler, or LTO_SECTION_NAME_PREFIX for LTO case. */ +extern const char *section_name_prefix; + +/* Segment name for LTO sections. This is only used for Mach-O. */ + +#define LTO_SEGMENT_NAME "__GNU_LTO" + +#define OFFLOAD_VAR_TABLE_SECTION_NAME ".gnu.offload_vars" +#define OFFLOAD_FUNC_TABLE_SECTION_NAME ".gnu.offload_funcs" + +#endif /* GCC_LTO_SECTION_NAMES_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lto-streamer.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lto-streamer.h new file mode 100644 index 0000000..08bfc13 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/lto-streamer.h @@ -0,0 +1,1228 @@ +/* Data structures and declarations used for reading and writing + GIMPLE to a file stream. + + Copyright (C) 2009-2017 Free Software Foundation, Inc. + Contributed by Doug Kwan + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_LTO_STREAMER_H +#define GCC_LTO_STREAMER_H + +#include "plugin-api.h" +#include "gcov-io.h" +#include "diagnostic.h" + +/* Define when debugging the LTO streamer. This causes the writer + to output the numeric value for the memory address of the tree node + being emitted. When debugging a problem in the reader, check the + original address that the writer was emitting using lto_orig_address_get. + With this value, set a breakpoint in the writer (e.g., lto_output_tree) + to trace how the faulty node is being emitted. */ +/* #define LTO_STREAMER_DEBUG 1 */ + +/* The encoding for a function consists of the following sections: + + 1) The header. + 2) FIELD_DECLS. + 3) FUNCTION_DECLS. + 4) global VAR_DECLS. + 5) type_decls + 6) types. + 7) Names for the labels that have names + 8) The SSA names. + 9) The control flow graph. + 10-11)Gimple for local decls. + 12) Gimple for the function. + 13) Strings. + + 1) THE HEADER. + 2-6) THE GLOBAL DECLS AND TYPES. + + The global decls and types are encoded in the same way. For each + entry, there is word with the offset within the section to the + entry. + + 7) THE LABEL NAMES. + + Since most labels do not have names, this section my be of zero + length. It consists of an array of string table references, one + per label. In the lto code, the labels are given either + positive or negative indexes. the positive ones have names and + the negative ones do not. The positive index can be used to + find the name in this array. + + 9) THE CFG. + + 10) Index into the local decls. Since local decls can have local + decls inside them, they must be read in randomly in order to + properly restore them. + + 11-12) GIMPLE FOR THE LOCAL DECLS AND THE FUNCTION BODY. + + The gimple consists of a set of records. + + THE FUNCTION + + At the top level of (8) is the function. It consists of five + pieces: + + LTO_function - The tag. + eh tree - This is all of the exception handling regions + put out in a post order traversial of the + tree. Siblings are output as lists terminated + by a 0. The set of fields matches the fields + defined in except.c. + + last_basic_block - in uleb128 form. + + basic blocks - This is the set of basic blocks. + + zero - The termination of the basic blocks. + + BASIC BLOCKS + + There are two forms of basic blocks depending on if they are + empty or not. + + The basic block consists of: + + LTO_bb1 or LTO_bb0 - The tag. + + bb->index - the index in uleb128 form. + + #succs - The number of successors un uleb128 form. + + the successors - For each edge, a pair. The first of the + pair is the index of the successor in + uleb128 form and the second are the flags in + uleb128 form. + + the statements - A gimple tree, as described above. + These are only present for LTO_BB1. + Following each statement is an optional + exception handling record LTO_eh_region + which contains the region number (for + regions >= 0). + + zero - This is only present for LTO_BB1 and is used + to terminate the statements and exception + regions within this block. + + 12) STRINGS + + String are represented in the table as pairs, a length in ULEB128 + form followed by the data for the string. */ + +#define LTO_major_version 6 +#define LTO_minor_version 0 + +typedef unsigned char lto_decl_flags_t; + + +/* Tags representing the various IL objects written to the bytecode file + (GIMPLE statements, basic blocks, EH regions, tree nodes, etc). + + NOTE, when adding new LTO tags, also update lto_tag_name. */ +enum LTO_tags +{ + LTO_null = 0, + + /* Special for streamer. Reference to previously-streamed node. */ + LTO_tree_pickle_reference, + + /* Reserve enough entries to fit all the tree and gimple codes handled + by the streamer. This guarantees that: + + 1- Given a tree code C: + enum LTO_tags tag == C + 1 + + 2- Given a gimple code C: + enum LTO_tags tag == C + NUM_TREE_CODES + 1 + + Conversely, to map between LTO tags and tree/gimple codes, the + reverse operation must be applied. */ + LTO_bb0 = 1 + MAX_TREE_CODES + LAST_AND_UNUSED_GIMPLE_CODE, + LTO_bb1, + + /* EH region holding the previous statement. */ + LTO_eh_region, + + /* Shared INTEGER_CST node. */ + LTO_integer_cst, + + /* Function body. */ + LTO_function, + + /* EH table. */ + LTO_eh_table, + + /* EH region types. These mirror enum eh_region_type. */ + LTO_ert_cleanup, + LTO_ert_try, + LTO_ert_allowed_exceptions, + LTO_ert_must_not_throw, + + /* EH landing pad. */ + LTO_eh_landing_pad, + + /* EH try/catch node. */ + LTO_eh_catch, + + /* Special for global streamer. A blob of unnamed tree nodes. */ + LTO_tree_scc, + + /* References to indexable tree nodes. These objects are stored in + tables that are written separately from the function bodies that + reference them. This way they can be instantiated even when the + referencing functions aren't (e.g., during WPA) and it also allows + functions to be copied from one file to another without having + to unpickle the body first (the references are location + independent). + + NOTE, do not regroup these values as the grouping is exposed + in the range checks done in lto_input_tree. */ + LTO_field_decl_ref, /* Do not change. */ + LTO_function_decl_ref, + LTO_label_decl_ref, + LTO_namespace_decl_ref, + LTO_result_decl_ref, + LTO_ssa_name_ref, + LTO_type_decl_ref, + LTO_type_ref, + LTO_const_decl_ref, + LTO_imported_decl_ref, + LTO_translation_unit_decl_ref, + LTO_global_decl_ref, + LTO_namelist_decl_ref, /* Do not change. */ + + /* This tag must always be last. */ + LTO_NUM_TAGS +}; + + +/* Set of section types that are in an LTO file. This list will grow + as the number of IPA passes grows since each IPA pass will need its + own section type to store its summary information. + + When adding a new section type, you must also extend the + LTO_SECTION_NAME array in lto-section-in.c. */ +enum lto_section_type +{ + LTO_section_decls = 0, + LTO_section_function_body, + LTO_section_static_initializer, + LTO_section_symtab, + LTO_section_refs, + LTO_section_asm, + LTO_section_jump_functions, + LTO_section_ipa_pure_const, + LTO_section_ipa_reference, + LTO_section_ipa_profile, + LTO_section_symtab_nodes, + LTO_section_opts, + LTO_section_cgraph_opt_sum, + LTO_section_inline_summary, + LTO_section_ipcp_transform, + LTO_section_ipa_icf, + LTO_section_offload_table, + LTO_section_mode_table, + LTO_section_ipa_hsa, + LTO_N_SECTION_TYPES /* Must be last. */ +}; + +/* Indices to the various function, type and symbol streams. */ +enum lto_decl_stream_e_t +{ + LTO_DECL_STREAM_TYPE = 0, /* Must be first. */ + LTO_DECL_STREAM_FIELD_DECL, + LTO_DECL_STREAM_FN_DECL, + LTO_DECL_STREAM_VAR_DECL, + LTO_DECL_STREAM_TYPE_DECL, + LTO_DECL_STREAM_NAMESPACE_DECL, + LTO_DECL_STREAM_LABEL_DECL, + LTO_N_DECL_STREAMS +}; + +typedef enum ld_plugin_symbol_resolution ld_plugin_symbol_resolution_t; + + +/* Macro to define convenience functions for type and decl streams + in lto_file_decl_data. */ +#define DEFINE_DECL_STREAM_FUNCS(UPPER_NAME, name) \ +static inline tree \ +lto_file_decl_data_get_ ## name (struct lto_file_decl_data *data, \ + unsigned int idx) \ +{ \ + struct lto_in_decl_state *state = data->current_decl_state; \ + return (*state->streams[LTO_DECL_STREAM_## UPPER_NAME])[idx]; \ +} \ +\ +static inline unsigned int \ +lto_file_decl_data_num_ ## name ## s (struct lto_file_decl_data *data) \ +{ \ + struct lto_in_decl_state *state = data->current_decl_state; \ + return vec_safe_length (state->streams[LTO_DECL_STREAM_## UPPER_NAME]); \ +} + + +/* Return a char pointer to the start of a data stream for an lto pass + or function. The first parameter is the file data that contains + the information. The second parameter is the type of information + to be obtained. The third parameter is the name of the function + and is only used when finding a function body; otherwise it is + NULL. The fourth parameter is the length of the data returned. */ +typedef const char* (lto_get_section_data_f) (struct lto_file_decl_data *, + enum lto_section_type, + const char *, + size_t *); + +/* Return the data found from the above call. The first three + parameters are the same as above. The fourth parameter is the data + itself and the fifth is the length of the data. */ +typedef void (lto_free_section_data_f) (struct lto_file_decl_data *, + enum lto_section_type, + const char *, + const char *, + size_t); + +/* The location cache holds expanded locations for streamed in trees. + This is done to reduce memory usage of libcpp linemap that strongly preffers + locations to be inserted in the soruce order. */ + +class lto_location_cache +{ +public: + /* Apply all changes in location cache. Add locations into linemap and patch + trees. */ + bool apply_location_cache (); + /* Tree merging did not suceed; mark all changes in the cache as accepted. */ + void accept_location_cache (); + /* Tree merging did suceed; throw away recent changes. */ + void revert_location_cache (); + void input_location (location_t *loc, struct bitpack_d *bp, + struct data_in *data_in); + lto_location_cache () + : loc_cache (), accepted_length (0), current_file (NULL), current_line (0), + current_col (0), current_sysp (false), current_loc (UNKNOWN_LOCATION) + { + gcc_assert (!current_cache); + current_cache = this; + } + ~lto_location_cache () + { + apply_location_cache (); + gcc_assert (current_cache == this); + current_cache = NULL; + } + + /* There can be at most one instance of location cache (combining multiple + would bring it out of sync with libcpp linemap); point to current + one. */ + static lto_location_cache *current_cache; + +private: + static int cmp_loc (const void *pa, const void *pb); + + struct cached_location + { + const char *file; + location_t *loc; + int line, col; + bool sysp; + }; + + /* The location cache. */ + + auto_vec loc_cache; + + /* Accepted entries are ones used by trees that are known to be not unified + by tree merging. */ + + int accepted_length; + + /* Bookkeeping to remember state in between calls to lto_apply_location_cache + When streaming gimple, the location cache is not used and thus + lto_apply_location_cache happens per location basis. It is then + useful to avoid redundant calls of linemap API. */ + + const char *current_file; + int current_line; + int current_col; + bool current_sysp; + location_t current_loc; +}; + +/* Structure used as buffer for reading an LTO file. */ +class lto_input_block +{ +public: + /* Special constructor for the string table, it abuses this to + do random access but use the uhwi decoder. */ + lto_input_block (const char *data_, unsigned int p_, unsigned int len_, + const unsigned char *mode_table_) + : data (data_), mode_table (mode_table_), p (p_), len (len_) {} + lto_input_block (const char *data_, unsigned int len_, + const unsigned char *mode_table_) + : data (data_), mode_table (mode_table_), p (0), len (len_) {} + + const char *data; + const unsigned char *mode_table; + unsigned int p; + unsigned int len; +}; + + +/* The is the first part of the record for a function or constructor + in the .o file. */ +struct lto_header +{ + int16_t major_version; + int16_t minor_version; +}; + +/* The is the first part of the record in an LTO file for many of the + IPA passes. */ +struct lto_simple_header : lto_header +{ + /* Size of main gimple body of function. */ + int32_t main_size; +}; + +struct lto_simple_header_with_strings : lto_simple_header +{ + /* Size of the string table. */ + int32_t string_size; +}; + +/* The header for a function body. */ +struct lto_function_header : lto_simple_header_with_strings +{ + /* Size of the cfg. */ + int32_t cfg_size; +}; + + +/* Structure describing a symbol section. */ +struct lto_decl_header : lto_simple_header_with_strings +{ + /* Size of region for decl state. */ + int32_t decl_state_size; + + /* Number of nodes in globals stream. */ + int32_t num_nodes; +}; + + +/* Statistics gathered during LTO, WPA and LTRANS. */ +struct lto_stats_d +{ + unsigned HOST_WIDE_INT num_input_cgraph_nodes; + unsigned HOST_WIDE_INT num_output_symtab_nodes; + unsigned HOST_WIDE_INT num_input_files; + unsigned HOST_WIDE_INT num_output_files; + unsigned HOST_WIDE_INT num_cgraph_partitions; + unsigned HOST_WIDE_INT section_size[LTO_N_SECTION_TYPES]; + unsigned HOST_WIDE_INT num_function_bodies; + unsigned HOST_WIDE_INT num_trees[NUM_TREE_CODES]; + unsigned HOST_WIDE_INT num_output_il_bytes; + unsigned HOST_WIDE_INT num_compressed_il_bytes; + unsigned HOST_WIDE_INT num_input_il_bytes; + unsigned HOST_WIDE_INT num_uncompressed_il_bytes; + unsigned HOST_WIDE_INT num_tree_bodies_output; + unsigned HOST_WIDE_INT num_pickle_refs_output; +}; + +/* Entry of LTO symtab encoder. */ +struct lto_encoder_entry +{ + symtab_node *node; + /* Is the node in this partition (i.e. ltrans of this partition will + be responsible for outputting it)? */ + unsigned int in_partition:1; + /* Do we encode body in this partition? */ + unsigned int body:1; + /* Do we encode initializer in this partition? + For example the readonly variable initializers are encoded to aid + constant folding even if they are not in the partition. */ + unsigned int initializer:1; +}; + + +/* Encoder data structure used to stream callgraph nodes. */ +struct lto_symtab_encoder_d +{ + vec nodes; + hash_map *map; +}; + +typedef struct lto_symtab_encoder_d *lto_symtab_encoder_t; + +/* Iterator structure for cgraph node sets. */ +struct lto_symtab_encoder_iterator +{ + lto_symtab_encoder_t encoder; + unsigned index; +}; + + + +/* The lto_tree_ref_encoder struct is used to encode trees into indices. */ + +struct lto_tree_ref_encoder +{ + hash_map *tree_hash_table; /* Maps pointers to indices. */ + vec trees; /* Maps indices to pointers. */ +}; + + +/* Structure to hold states of input scope. */ +struct GTY((for_user)) lto_in_decl_state +{ + /* Array of lto_in_decl_buffers to store type and decls streams. */ + vec *streams[LTO_N_DECL_STREAMS]; + + /* If this in-decl state is associated with a function. FN_DECL + point to the FUNCTION_DECL. */ + tree fn_decl; + + /* True if decl state is compressed. */ + bool compressed; +}; + +typedef struct lto_in_decl_state *lto_in_decl_state_ptr; + +struct decl_state_hasher : ggc_ptr_hash +{ + static hashval_t + hash (lto_in_decl_state *s) + { + return htab_hash_pointer (s->fn_decl); + } + + static bool + equal (lto_in_decl_state *a, lto_in_decl_state *b) + { + return a->fn_decl == b->fn_decl; + } +}; + +/* The structure that holds all of the vectors of global types, + decls and cgraph nodes used in the serialization of this file. */ +struct lto_out_decl_state +{ + /* The buffers contain the sets of decls of various kinds and types we have + seen so far and the indexes assigned to them. */ + struct lto_tree_ref_encoder streams[LTO_N_DECL_STREAMS]; + + /* Encoder for cgraph nodes. */ + lto_symtab_encoder_t symtab_node_encoder; + + /* If this out-decl state belongs to a function, fn_decl points to that + function. Otherwise, it is NULL. */ + tree fn_decl; + + /* True if decl state is compressed. */ + bool compressed; +}; + +typedef struct lto_out_decl_state *lto_out_decl_state_ptr; + + +/* Compact representation of a index <-> resolution pair. Unpacked to an + vector later. */ +struct res_pair +{ + ld_plugin_symbol_resolution_t res; + unsigned index; +}; + + +/* One of these is allocated for each object file that being compiled + by lto. This structure contains the tables that are needed by the + serialized functions and ipa passes to connect themselves to the + global types and decls as they are reconstituted. */ +struct GTY(()) lto_file_decl_data +{ + /* Decl state currently used. */ + struct lto_in_decl_state *current_decl_state; + + /* Decl state corresponding to regions outside of any functions + in the compilation unit. */ + struct lto_in_decl_state *global_decl_state; + + /* Table of cgraph nodes present in this file. */ + lto_symtab_encoder_t GTY((skip)) symtab_node_encoder; + + /* Hash table maps lto-related section names to location in file. */ + hash_table *function_decl_states; + + /* The .o file that these offsets relate to. */ + const char *GTY((skip)) file_name; + + /* Hash table maps lto-related section names to location in file. */ + htab_t GTY((skip)) section_hash_table; + + /* Hash new name of renamed global declaration to its original name. */ + htab_t GTY((skip)) renaming_hash_table; + + /* Linked list used temporarily in reader */ + struct lto_file_decl_data *next; + + /* Sub ID for merged objects. */ + unsigned HOST_WIDE_INT id; + + /* Symbol resolutions for this file */ + vec GTY((skip)) respairs; + unsigned max_index; + + struct gcov_ctr_summary GTY((skip)) profile_info; + + /* Map assigning declarations their resolutions. */ + hash_map * GTY((skip)) resolution_map; + + /* Mode translation table. */ + const unsigned char *mode_table; +}; + +typedef struct lto_file_decl_data *lto_file_decl_data_ptr; + +struct lto_char_ptr_base +{ + char *ptr; +}; + +/* An incore byte stream to buffer the various parts of the function. + The entire structure should be zeroed when created. The record + consists of a set of blocks. The first sizeof (ptr) bytes are used + as a chain, and the rest store the bytes to be written. */ +struct lto_output_stream +{ + /* The pointer to the first block in the stream. */ + struct lto_char_ptr_base * first_block; + + /* The pointer to the last and current block in the stream. */ + struct lto_char_ptr_base * current_block; + + /* The pointer to where the next char should be written. */ + char * current_pointer; + + /* The number of characters left in the current block. */ + unsigned int left_in_block; + + /* The block size of the last block allocated. */ + unsigned int block_size; + + /* The total number of characters written. */ + unsigned int total_size; +}; + +/* A simple output block. This can be used for simple IPA passes that + do not need more than one stream. */ +struct lto_simple_output_block +{ + enum lto_section_type section_type; + struct lto_out_decl_state *decl_state; + + /* The stream that the main tree codes are written to. */ + struct lto_output_stream *main_stream; +}; + +/* String hashing. */ + +struct string_slot +{ + const char *s; + int len; + unsigned int slot_num; +}; + +/* Hashtable helpers. */ + +struct string_slot_hasher : nofree_ptr_hash +{ + static inline hashval_t hash (const string_slot *); + static inline bool equal (const string_slot *, const string_slot *); +}; + +/* Returns a hash code for DS. Adapted from libiberty's htab_hash_string + to support strings that may not end in '\0'. */ + +inline hashval_t +string_slot_hasher::hash (const string_slot *ds) +{ + hashval_t r = ds->len; + int i; + + for (i = 0; i < ds->len; i++) + r = r * 67 + (unsigned)ds->s[i] - 113; + return r; +} + +/* Returns nonzero if DS1 and DS2 are equal. */ + +inline bool +string_slot_hasher::equal (const string_slot *ds1, const string_slot *ds2) +{ + if (ds1->len == ds2->len) + return memcmp (ds1->s, ds2->s, ds1->len) == 0; + + return 0; +} + +/* Data structure holding all the data and descriptors used when writing + an LTO file. */ +struct output_block +{ + enum lto_section_type section_type; + struct lto_out_decl_state *decl_state; + + /* The stream that the main tree codes are written to. */ + struct lto_output_stream *main_stream; + + /* The stream that contains the string table. */ + struct lto_output_stream *string_stream; + + /* The stream that contains the cfg. */ + struct lto_output_stream *cfg_stream; + + /* The hash table that contains the set of strings we have seen so + far and the indexes assigned to them. */ + hash_table *string_hash_table; + + /* The current symbol that we are currently serializing. Null + if we are serializing something else. */ + symtab_node *symbol; + + /* These are the last file and line that were seen in the stream. + If the current node differs from these, it needs to insert + something into the stream and fix these up. */ + const char *current_file; + int current_line; + int current_col; + bool current_sysp; + + /* Cache of nodes written in this section. */ + struct streamer_tree_cache_d *writer_cache; + + /* All data persistent across whole duration of output block + can go here. */ + struct obstack obstack; +}; + + +/* Data and descriptors used when reading from an LTO file. */ +struct data_in +{ + /* The global decls and types. */ + struct lto_file_decl_data *file_data; + + /* The string table. */ + const char *strings; + + /* The length of the string table. */ + unsigned int strings_len; + + /* Maps each reference number to the resolution done by the linker. */ + vec globals_resolution; + + /* Cache of pickled nodes. */ + struct streamer_tree_cache_d *reader_cache; + + /* Cache of source code location. */ + lto_location_cache location_cache; +}; + + +/* In lto-section-in.c */ +extern struct lto_input_block * lto_create_simple_input_block ( + struct lto_file_decl_data *, + enum lto_section_type, const char **, size_t *); +extern void +lto_destroy_simple_input_block (struct lto_file_decl_data *, + enum lto_section_type, + struct lto_input_block *, const char *, size_t); +extern void lto_set_in_hooks (struct lto_file_decl_data **, + lto_get_section_data_f *, + lto_free_section_data_f *); +extern struct lto_file_decl_data **lto_get_file_decl_data (void); +extern const char *lto_get_section_data (struct lto_file_decl_data *, + enum lto_section_type, + const char *, size_t *, + bool decompress = false); +extern const char *lto_get_raw_section_data (struct lto_file_decl_data *, + enum lto_section_type, + const char *, size_t *); +extern void lto_free_section_data (struct lto_file_decl_data *, + enum lto_section_type, + const char *, const char *, size_t, + bool decompress = false); +extern void lto_free_raw_section_data (struct lto_file_decl_data *, + enum lto_section_type, + const char *, const char *, size_t); +extern htab_t lto_create_renaming_table (void); +extern void lto_record_renamed_decl (struct lto_file_decl_data *, + const char *, const char *); +extern const char *lto_get_decl_name_mapping (struct lto_file_decl_data *, + const char *); +extern struct lto_in_decl_state *lto_new_in_decl_state (void); +extern void lto_delete_in_decl_state (struct lto_in_decl_state *); +extern struct lto_in_decl_state *lto_get_function_in_decl_state ( + struct lto_file_decl_data *, tree); +extern void lto_free_function_in_decl_state (struct lto_in_decl_state *); +extern void lto_free_function_in_decl_state_for_node (symtab_node *); +extern void lto_section_overrun (struct lto_input_block *) ATTRIBUTE_NORETURN; +extern void lto_value_range_error (const char *, + HOST_WIDE_INT, HOST_WIDE_INT, + HOST_WIDE_INT) ATTRIBUTE_NORETURN; + +/* In lto-section-out.c */ +extern void lto_begin_section (const char *, bool); +extern void lto_end_section (void); +extern void lto_write_data (const void *, unsigned int); +extern void lto_write_raw_data (const void *, unsigned int); +extern void lto_write_stream (struct lto_output_stream *); +extern bool lto_output_decl_index (struct lto_output_stream *, + struct lto_tree_ref_encoder *, + tree, unsigned int *); +extern void lto_output_field_decl_index (struct lto_out_decl_state *, + struct lto_output_stream *, tree); +extern void lto_output_fn_decl_index (struct lto_out_decl_state *, + struct lto_output_stream *, tree); +extern void lto_output_namespace_decl_index (struct lto_out_decl_state *, + struct lto_output_stream *, tree); +extern void lto_output_var_decl_index (struct lto_out_decl_state *, + struct lto_output_stream *, tree); +extern void lto_output_type_decl_index (struct lto_out_decl_state *, + struct lto_output_stream *, tree); +extern void lto_output_type_ref_index (struct lto_out_decl_state *, + struct lto_output_stream *, tree); +extern struct lto_simple_output_block *lto_create_simple_output_block ( + enum lto_section_type); +extern void lto_destroy_simple_output_block (struct lto_simple_output_block *); +extern struct lto_out_decl_state *lto_new_out_decl_state (void); +extern void lto_delete_out_decl_state (struct lto_out_decl_state *); +extern struct lto_out_decl_state *lto_get_out_decl_state (void); +extern void lto_push_out_decl_state (struct lto_out_decl_state *); +extern struct lto_out_decl_state *lto_pop_out_decl_state (void); +extern void lto_record_function_out_decl_state (tree, + struct lto_out_decl_state *); +extern void lto_append_block (struct lto_output_stream *); + + +/* In lto-streamer.c. */ + +/* Set when streaming LTO for offloading compiler. */ +extern bool lto_stream_offload_p; + +extern const char *lto_tag_name (enum LTO_tags); +extern bitmap lto_bitmap_alloc (void); +extern void lto_bitmap_free (bitmap); +extern char *lto_get_section_name (int, const char *, struct lto_file_decl_data *); +extern void print_lto_report (const char *); +extern void lto_streamer_init (void); +extern bool gate_lto_out (void); +#ifdef LTO_STREAMER_DEBUG +extern void lto_orig_address_map (tree, intptr_t); +extern intptr_t lto_orig_address_get (tree); +extern void lto_orig_address_remove (tree); +#endif +extern void lto_check_version (int, int, const char *); +extern void lto_streamer_hooks_init (void); + +/* In lto-streamer-in.c */ +extern void lto_input_cgraph (struct lto_file_decl_data *, const char *); +extern void lto_reader_init (void); +extern void lto_input_function_body (struct lto_file_decl_data *, + struct cgraph_node *, + const char *); +extern void lto_input_variable_constructor (struct lto_file_decl_data *, + struct varpool_node *, + const char *); +extern void lto_input_constructors_and_inits (struct lto_file_decl_data *, + const char *); +extern void lto_input_toplevel_asms (struct lto_file_decl_data *, int); +extern void lto_input_mode_table (struct lto_file_decl_data *); +extern struct data_in *lto_data_in_create (struct lto_file_decl_data *, + const char *, unsigned, + vec ); +extern void lto_data_in_delete (struct data_in *); +extern void lto_input_data_block (struct lto_input_block *, void *, size_t); +void lto_input_location (location_t *, struct bitpack_d *, struct data_in *); +location_t stream_input_location_now (struct bitpack_d *bp, + struct data_in *data); +tree lto_input_tree_ref (struct lto_input_block *, struct data_in *, + struct function *, enum LTO_tags); +void lto_tag_check_set (enum LTO_tags, int, ...); +void lto_init_eh (void); +hashval_t lto_input_scc (struct lto_input_block *, struct data_in *, + unsigned *, unsigned *); +tree lto_input_tree_1 (struct lto_input_block *, struct data_in *, + enum LTO_tags, hashval_t hash); +tree lto_input_tree (struct lto_input_block *, struct data_in *); + + +/* In lto-streamer-out.c */ +extern void lto_register_decl_definition (tree, struct lto_file_decl_data *); +extern struct output_block *create_output_block (enum lto_section_type); +extern void destroy_output_block (struct output_block *); +extern void lto_output_tree (struct output_block *, tree, bool, bool); +extern void lto_output_toplevel_asms (void); +extern void produce_asm (struct output_block *ob, tree fn); +extern void lto_output (); +extern void produce_asm_for_decls (); +void lto_output_decl_state_streams (struct output_block *, + struct lto_out_decl_state *); +void lto_output_decl_state_refs (struct output_block *, + struct lto_output_stream *, + struct lto_out_decl_state *); +void lto_output_location (struct output_block *, struct bitpack_d *, location_t); +void lto_output_init_mode_table (void); + + +/* In lto-cgraph.c */ +extern bool asm_nodes_output; +lto_symtab_encoder_t lto_symtab_encoder_new (bool); +int lto_symtab_encoder_encode (lto_symtab_encoder_t, symtab_node *); +void lto_symtab_encoder_delete (lto_symtab_encoder_t); +bool lto_symtab_encoder_delete_node (lto_symtab_encoder_t, symtab_node *); +bool lto_symtab_encoder_encode_body_p (lto_symtab_encoder_t, + struct cgraph_node *); +bool lto_symtab_encoder_in_partition_p (lto_symtab_encoder_t, + symtab_node *); +void lto_set_symtab_encoder_in_partition (lto_symtab_encoder_t, + symtab_node *); + +bool lto_symtab_encoder_encode_initializer_p (lto_symtab_encoder_t, + varpool_node *); +void output_symtab (void); +void input_symtab (void); +void output_offload_tables (void); +void input_offload_tables (bool); +bool referenced_from_other_partition_p (struct ipa_ref_list *, + lto_symtab_encoder_t); +bool reachable_from_other_partition_p (struct cgraph_node *, + lto_symtab_encoder_t); +bool referenced_from_this_partition_p (symtab_node *, + lto_symtab_encoder_t); +bool reachable_from_this_partition_p (struct cgraph_node *, + lto_symtab_encoder_t); +lto_symtab_encoder_t compute_ltrans_boundary (lto_symtab_encoder_t encoder); +void select_what_to_stream (void); + +/* In options-save.c. */ +void cl_target_option_stream_out (struct output_block *, struct bitpack_d *, + struct cl_target_option *); + +void cl_target_option_stream_in (struct data_in *, + struct bitpack_d *, + struct cl_target_option *); + +void cl_optimization_stream_out (struct bitpack_d *, struct cl_optimization *); + +void cl_optimization_stream_in (struct bitpack_d *, struct cl_optimization *); + + + +/* In lto-opts.c. */ +extern void lto_write_options (void); + + +/* Statistics gathered during LTO, WPA and LTRANS. */ +extern struct lto_stats_d lto_stats; + +/* Section names corresponding to the values of enum lto_section_type. */ +extern const char *lto_section_name[]; + +/* Holds all the out decl states of functions output so far in the + current output file. */ +extern vec lto_function_decl_states; + +/* Return true if LTO tag TAG corresponds to a tree code. */ +static inline bool +lto_tag_is_tree_code_p (enum LTO_tags tag) +{ + return tag > LTO_tree_pickle_reference && (unsigned) tag <= MAX_TREE_CODES; +} + + +/* Return true if LTO tag TAG corresponds to a gimple code. */ +static inline bool +lto_tag_is_gimple_code_p (enum LTO_tags tag) +{ + return (unsigned) tag >= NUM_TREE_CODES + 2 + && (unsigned) tag < 2 + NUM_TREE_CODES + LAST_AND_UNUSED_GIMPLE_CODE; +} + + +/* Return the LTO tag corresponding to gimple code CODE. See enum + LTO_tags for details on the conversion. */ +static inline enum LTO_tags +lto_gimple_code_to_tag (enum gimple_code code) +{ + return (enum LTO_tags) ((unsigned) code + NUM_TREE_CODES + 2); +} + + +/* Return the GIMPLE code corresponding to TAG. See enum LTO_tags for + details on the conversion. */ +static inline enum gimple_code +lto_tag_to_gimple_code (enum LTO_tags tag) +{ + gcc_assert (lto_tag_is_gimple_code_p (tag)); + return (enum gimple_code) ((unsigned) tag - NUM_TREE_CODES - 2); +} + + +/* Return the LTO tag corresponding to tree code CODE. See enum + LTO_tags for details on the conversion. */ +static inline enum LTO_tags +lto_tree_code_to_tag (enum tree_code code) +{ + return (enum LTO_tags) ((unsigned) code + 2); +} + + +/* Return the tree code corresponding to TAG. See enum LTO_tags for + details on the conversion. */ +static inline enum tree_code +lto_tag_to_tree_code (enum LTO_tags tag) +{ + gcc_assert (lto_tag_is_tree_code_p (tag)); + return (enum tree_code) ((unsigned) tag - 2); +} + +/* Check that tag ACTUAL == EXPECTED. */ +static inline void +lto_tag_check (enum LTO_tags actual, enum LTO_tags expected) +{ + if (actual != expected) + internal_error ("bytecode stream: expected tag %s instead of %s", + lto_tag_name (expected), lto_tag_name (actual)); +} + +/* Check that tag ACTUAL is in the range [TAG1, TAG2]. */ +static inline void +lto_tag_check_range (enum LTO_tags actual, enum LTO_tags tag1, + enum LTO_tags tag2) +{ + if (actual < tag1 || actual > tag2) + internal_error ("bytecode stream: tag %s is not in the expected range " + "[%s, %s]", + lto_tag_name (actual), + lto_tag_name (tag1), + lto_tag_name (tag2)); +} + +/* Initialize an lto_out_decl_buffer ENCODER. */ +static inline void +lto_init_tree_ref_encoder (struct lto_tree_ref_encoder *encoder) +{ + encoder->tree_hash_table = new hash_map (251); + encoder->trees.create (0); +} + + +/* Destroy an lto_tree_ref_encoder ENCODER by freeing its contents. The + memory used by ENCODER is not freed by this function. */ +static inline void +lto_destroy_tree_ref_encoder (struct lto_tree_ref_encoder *encoder) +{ + /* Hash table may be delete already. */ + delete encoder->tree_hash_table; + encoder->tree_hash_table = NULL; + encoder->trees.release (); +} + +/* Return the number of trees encoded in ENCODER. */ +static inline unsigned int +lto_tree_ref_encoder_size (struct lto_tree_ref_encoder *encoder) +{ + return encoder->trees.length (); +} + +/* Return the IDX-th tree in ENCODER. */ +static inline tree +lto_tree_ref_encoder_get_tree (struct lto_tree_ref_encoder *encoder, + unsigned int idx) +{ + return encoder->trees[idx]; +} + +/* Return number of encoded nodes in ENCODER. */ +static inline int +lto_symtab_encoder_size (lto_symtab_encoder_t encoder) +{ + return encoder->nodes.length (); +} + +/* Value used to represent failure of lto_symtab_encoder_lookup. */ +#define LCC_NOT_FOUND (-1) + +/* Look up NODE in encoder. Return NODE's reference if it has been encoded + or LCC_NOT_FOUND if it is not there. */ + +static inline int +lto_symtab_encoder_lookup (lto_symtab_encoder_t encoder, + symtab_node *node) +{ + size_t *slot = encoder->map->get (node); + return (slot && *slot ? *(slot) - 1 : LCC_NOT_FOUND); +} + +/* Return true if iterator LSE points to nothing. */ +static inline bool +lsei_end_p (lto_symtab_encoder_iterator lsei) +{ + return lsei.index >= (unsigned)lto_symtab_encoder_size (lsei.encoder); +} + +/* Advance iterator LSE. */ +static inline void +lsei_next (lto_symtab_encoder_iterator *lsei) +{ + lsei->index++; +} + +/* Return the node pointed to by LSI. */ +static inline symtab_node * +lsei_node (lto_symtab_encoder_iterator lsei) +{ + return lsei.encoder->nodes[lsei.index].node; +} + +/* Return the node pointed to by LSI. */ +static inline struct cgraph_node * +lsei_cgraph_node (lto_symtab_encoder_iterator lsei) +{ + return dyn_cast (lsei.encoder->nodes[lsei.index].node); +} + +/* Return the node pointed to by LSI. */ +static inline varpool_node * +lsei_varpool_node (lto_symtab_encoder_iterator lsei) +{ + return dyn_cast (lsei.encoder->nodes[lsei.index].node); +} + +/* Return the cgraph node corresponding to REF using ENCODER. */ + +static inline symtab_node * +lto_symtab_encoder_deref (lto_symtab_encoder_t encoder, int ref) +{ + if (ref == LCC_NOT_FOUND) + return NULL; + + return encoder->nodes[ref].node; +} + +/* Return an iterator to the first node in LSI. */ +static inline lto_symtab_encoder_iterator +lsei_start (lto_symtab_encoder_t encoder) +{ + lto_symtab_encoder_iterator lsei; + + lsei.encoder = encoder; + lsei.index = 0; + return lsei; +} + +/* Advance iterator LSE. */ +static inline void +lsei_next_in_partition (lto_symtab_encoder_iterator *lsei) +{ + lsei_next (lsei); + while (!lsei_end_p (*lsei) + && !lto_symtab_encoder_in_partition_p (lsei->encoder, lsei_node (*lsei))) + lsei_next (lsei); +} + +/* Return an iterator to the first node in LSI. */ +static inline lto_symtab_encoder_iterator +lsei_start_in_partition (lto_symtab_encoder_t encoder) +{ + lto_symtab_encoder_iterator lsei = lsei_start (encoder); + + if (lsei_end_p (lsei)) + return lsei; + if (!lto_symtab_encoder_in_partition_p (encoder, lsei_node (lsei))) + lsei_next_in_partition (&lsei); + + return lsei; +} + +/* Advance iterator LSE. */ +static inline void +lsei_next_function_in_partition (lto_symtab_encoder_iterator *lsei) +{ + lsei_next (lsei); + while (!lsei_end_p (*lsei) + && (!is_a (lsei_node (*lsei)) + || !lto_symtab_encoder_in_partition_p (lsei->encoder, lsei_node (*lsei)))) + lsei_next (lsei); +} + +/* Return an iterator to the first node in LSI. */ +static inline lto_symtab_encoder_iterator +lsei_start_function_in_partition (lto_symtab_encoder_t encoder) +{ + lto_symtab_encoder_iterator lsei = lsei_start (encoder); + + if (lsei_end_p (lsei)) + return lsei; + if (!is_a (lsei_node (lsei)) + || !lto_symtab_encoder_in_partition_p (encoder, lsei_node (lsei))) + lsei_next_function_in_partition (&lsei); + + return lsei; +} + +/* Advance iterator LSE. */ +static inline void +lsei_next_variable_in_partition (lto_symtab_encoder_iterator *lsei) +{ + lsei_next (lsei); + while (!lsei_end_p (*lsei) + && (!is_a (lsei_node (*lsei)) + || !lto_symtab_encoder_in_partition_p (lsei->encoder, lsei_node (*lsei)))) + lsei_next (lsei); +} + +/* Return an iterator to the first node in LSI. */ +static inline lto_symtab_encoder_iterator +lsei_start_variable_in_partition (lto_symtab_encoder_t encoder) +{ + lto_symtab_encoder_iterator lsei = lsei_start (encoder); + + if (lsei_end_p (lsei)) + return lsei; + if (!is_a (lsei_node (lsei)) + || !lto_symtab_encoder_in_partition_p (encoder, lsei_node (lsei))) + lsei_next_variable_in_partition (&lsei); + + return lsei; +} + +DEFINE_DECL_STREAM_FUNCS (TYPE, type) +DEFINE_DECL_STREAM_FUNCS (FIELD_DECL, field_decl) +DEFINE_DECL_STREAM_FUNCS (FN_DECL, fn_decl) +DEFINE_DECL_STREAM_FUNCS (VAR_DECL, var_decl) +DEFINE_DECL_STREAM_FUNCS (TYPE_DECL, type_decl) +DEFINE_DECL_STREAM_FUNCS (NAMESPACE_DECL, namespace_decl) +DEFINE_DECL_STREAM_FUNCS (LABEL_DECL, label_decl) + +#endif /* GCC_LTO_STREAMER_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/machmode.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/machmode.h new file mode 100644 index 0000000..42b14d0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/machmode.h @@ -0,0 +1,375 @@ +/* Machine mode definitions for GCC; included by rtl.h and tree.h. + Copyright (C) 1991-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef HAVE_MACHINE_MODES +#define HAVE_MACHINE_MODES + +/* Make an enum class that gives all the machine modes. */ +#include "insn-modes.h" + +/* Get the name of mode MODE as a string. */ + +extern const char * const mode_name[NUM_MACHINE_MODES]; +#define GET_MODE_NAME(MODE) mode_name[MODE] + +/* Mode classes. */ + +#include "mode-classes.def" +#define DEF_MODE_CLASS(M) M +enum mode_class { MODE_CLASSES, MAX_MODE_CLASS }; +#undef DEF_MODE_CLASS +#undef MODE_CLASSES + +/* Get the general kind of object that mode MODE represents + (integer, floating, complex, etc.) */ + +extern const unsigned char mode_class[NUM_MACHINE_MODES]; +#define GET_MODE_CLASS(MODE) ((enum mode_class) mode_class[MODE]) + +/* Nonzero if MODE is an integral mode. */ +#define INTEGRAL_MODE_P(MODE) \ + (GET_MODE_CLASS (MODE) == MODE_INT \ + || GET_MODE_CLASS (MODE) == MODE_PARTIAL_INT \ + || GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT \ + || GET_MODE_CLASS (MODE) == MODE_VECTOR_INT) + +/* Nonzero if MODE is a floating-point mode. */ +#define FLOAT_MODE_P(MODE) \ + (GET_MODE_CLASS (MODE) == MODE_FLOAT \ + || GET_MODE_CLASS (MODE) == MODE_DECIMAL_FLOAT \ + || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT \ + || GET_MODE_CLASS (MODE) == MODE_VECTOR_FLOAT) + +/* Nonzero if MODE is a complex mode. */ +#define COMPLEX_MODE_P(MODE) \ + (GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT \ + || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT) + +/* Nonzero if MODE is a vector mode. */ +#define VECTOR_MODE_P(MODE) \ + (GET_MODE_CLASS (MODE) == MODE_VECTOR_INT \ + || GET_MODE_CLASS (MODE) == MODE_VECTOR_FLOAT \ + || GET_MODE_CLASS (MODE) == MODE_VECTOR_FRACT \ + || GET_MODE_CLASS (MODE) == MODE_VECTOR_UFRACT \ + || GET_MODE_CLASS (MODE) == MODE_VECTOR_ACCUM \ + || GET_MODE_CLASS (MODE) == MODE_VECTOR_UACCUM) + +/* Nonzero if MODE is a scalar integral mode. */ +#define SCALAR_INT_MODE_P(MODE) \ + (GET_MODE_CLASS (MODE) == MODE_INT \ + || GET_MODE_CLASS (MODE) == MODE_PARTIAL_INT) + +/* Nonzero if MODE is a scalar floating point mode. */ +#define SCALAR_FLOAT_MODE_P(MODE) \ + (GET_MODE_CLASS (MODE) == MODE_FLOAT \ + || GET_MODE_CLASS (MODE) == MODE_DECIMAL_FLOAT) + +/* Nonzero if MODE is a decimal floating point mode. */ +#define DECIMAL_FLOAT_MODE_P(MODE) \ + (GET_MODE_CLASS (MODE) == MODE_DECIMAL_FLOAT) + +/* Nonzero if MODE is a scalar fract mode. */ +#define SCALAR_FRACT_MODE_P(MODE) \ + (GET_MODE_CLASS (MODE) == MODE_FRACT) + +/* Nonzero if MODE is a scalar ufract mode. */ +#define SCALAR_UFRACT_MODE_P(MODE) \ + (GET_MODE_CLASS (MODE) == MODE_UFRACT) + +/* Nonzero if MODE is a scalar fract or ufract mode. */ +#define ALL_SCALAR_FRACT_MODE_P(MODE) \ + (SCALAR_FRACT_MODE_P (MODE) || SCALAR_UFRACT_MODE_P (MODE)) + +/* Nonzero if MODE is a scalar accum mode. */ +#define SCALAR_ACCUM_MODE_P(MODE) \ + (GET_MODE_CLASS (MODE) == MODE_ACCUM) + +/* Nonzero if MODE is a scalar uaccum mode. */ +#define SCALAR_UACCUM_MODE_P(MODE) \ + (GET_MODE_CLASS (MODE) == MODE_UACCUM) + +/* Nonzero if MODE is a scalar accum or uaccum mode. */ +#define ALL_SCALAR_ACCUM_MODE_P(MODE) \ + (SCALAR_ACCUM_MODE_P (MODE) || SCALAR_UACCUM_MODE_P (MODE)) + +/* Nonzero if MODE is a scalar fract or accum mode. */ +#define SIGNED_SCALAR_FIXED_POINT_MODE_P(MODE) \ + (SCALAR_FRACT_MODE_P (MODE) || SCALAR_ACCUM_MODE_P (MODE)) + +/* Nonzero if MODE is a scalar ufract or uaccum mode. */ +#define UNSIGNED_SCALAR_FIXED_POINT_MODE_P(MODE) \ + (SCALAR_UFRACT_MODE_P (MODE) || SCALAR_UACCUM_MODE_P (MODE)) + +/* Nonzero if MODE is a scalar fract, ufract, accum or uaccum mode. */ +#define ALL_SCALAR_FIXED_POINT_MODE_P(MODE) \ + (SIGNED_SCALAR_FIXED_POINT_MODE_P (MODE) \ + || UNSIGNED_SCALAR_FIXED_POINT_MODE_P (MODE)) + +/* Nonzero if MODE is a scalar/vector fract mode. */ +#define FRACT_MODE_P(MODE) \ + (GET_MODE_CLASS (MODE) == MODE_FRACT \ + || GET_MODE_CLASS (MODE) == MODE_VECTOR_FRACT) + +/* Nonzero if MODE is a scalar/vector ufract mode. */ +#define UFRACT_MODE_P(MODE) \ + (GET_MODE_CLASS (MODE) == MODE_UFRACT \ + || GET_MODE_CLASS (MODE) == MODE_VECTOR_UFRACT) + +/* Nonzero if MODE is a scalar/vector fract or ufract mode. */ +#define ALL_FRACT_MODE_P(MODE) \ + (FRACT_MODE_P (MODE) || UFRACT_MODE_P (MODE)) + +/* Nonzero if MODE is a scalar/vector accum mode. */ +#define ACCUM_MODE_P(MODE) \ + (GET_MODE_CLASS (MODE) == MODE_ACCUM \ + || GET_MODE_CLASS (MODE) == MODE_VECTOR_ACCUM) + +/* Nonzero if MODE is a scalar/vector uaccum mode. */ +#define UACCUM_MODE_P(MODE) \ + (GET_MODE_CLASS (MODE) == MODE_UACCUM \ + || GET_MODE_CLASS (MODE) == MODE_VECTOR_UACCUM) + +/* Nonzero if MODE is a scalar/vector accum or uaccum mode. */ +#define ALL_ACCUM_MODE_P(MODE) \ + (ACCUM_MODE_P (MODE) || UACCUM_MODE_P (MODE)) + +/* Nonzero if MODE is a scalar/vector fract or accum mode. */ +#define SIGNED_FIXED_POINT_MODE_P(MODE) \ + (FRACT_MODE_P (MODE) || ACCUM_MODE_P (MODE)) + +/* Nonzero if MODE is a scalar/vector ufract or uaccum mode. */ +#define UNSIGNED_FIXED_POINT_MODE_P(MODE) \ + (UFRACT_MODE_P (MODE) || UACCUM_MODE_P (MODE)) + +/* Nonzero if MODE is a scalar/vector fract, ufract, accum or uaccum mode. */ +#define ALL_FIXED_POINT_MODE_P(MODE) \ + (SIGNED_FIXED_POINT_MODE_P (MODE) \ + || UNSIGNED_FIXED_POINT_MODE_P (MODE)) + +/* Nonzero if CLASS modes can be widened. */ +#define CLASS_HAS_WIDER_MODES_P(CLASS) \ + (CLASS == MODE_INT \ + || CLASS == MODE_PARTIAL_INT \ + || CLASS == MODE_FLOAT \ + || CLASS == MODE_DECIMAL_FLOAT \ + || CLASS == MODE_COMPLEX_FLOAT \ + || CLASS == MODE_FRACT \ + || CLASS == MODE_UFRACT \ + || CLASS == MODE_ACCUM \ + || CLASS == MODE_UACCUM) + +#define POINTER_BOUNDS_MODE_P(MODE) \ + (GET_MODE_CLASS (MODE) == MODE_POINTER_BOUNDS) + +/* Get the size in bytes and bits of an object of mode MODE. */ + +extern CONST_MODE_SIZE unsigned short mode_size[NUM_MACHINE_MODES]; +#if GCC_VERSION >= 4001 +#define GET_MODE_SIZE(MODE) \ + ((unsigned short) (__builtin_constant_p (MODE) \ + ? mode_size_inline (MODE) : mode_size[MODE])) +#else +#define GET_MODE_SIZE(MODE) ((unsigned short) mode_size[MODE]) +#endif +#define GET_MODE_BITSIZE(MODE) \ + ((unsigned short) (GET_MODE_SIZE (MODE) * BITS_PER_UNIT)) + +/* Get the number of value bits of an object of mode MODE. */ +extern const unsigned short mode_precision[NUM_MACHINE_MODES]; +#define GET_MODE_PRECISION(MODE) mode_precision[MODE] + +/* Get the number of integral bits of an object of mode MODE. */ +extern CONST_MODE_IBIT unsigned char mode_ibit[NUM_MACHINE_MODES]; +#define GET_MODE_IBIT(MODE) mode_ibit[MODE] + +/* Get the number of fractional bits of an object of mode MODE. */ +extern CONST_MODE_FBIT unsigned char mode_fbit[NUM_MACHINE_MODES]; +#define GET_MODE_FBIT(MODE) mode_fbit[MODE] + +/* Get a bitmask containing 1 for all bits in a word + that fit within mode MODE. */ + +extern const unsigned HOST_WIDE_INT mode_mask_array[NUM_MACHINE_MODES]; + +#define GET_MODE_MASK(MODE) mode_mask_array[MODE] + +/* Return the mode of the basic parts of MODE. For vector modes this is the + mode of the vector elements. For complex modes it is the mode of the real + and imaginary parts. For other modes it is MODE itself. */ + +extern const unsigned char mode_inner[NUM_MACHINE_MODES]; +#if GCC_VERSION >= 4001 +#define GET_MODE_INNER(MODE) \ + ((machine_mode) (__builtin_constant_p (MODE) \ + ? mode_inner_inline (MODE) : mode_inner[MODE])) +#else +#define GET_MODE_INNER(MODE) ((machine_mode) mode_inner[MODE]) +#endif + +/* Get the size in bytes or bits of the basic parts of an + object of mode MODE. */ + +extern CONST_MODE_UNIT_SIZE unsigned char mode_unit_size[NUM_MACHINE_MODES]; +#if GCC_VERSION >= 4001 +#define GET_MODE_UNIT_SIZE(MODE) \ + ((unsigned char) (__builtin_constant_p (MODE) \ + ? mode_unit_size_inline (MODE) : mode_unit_size[MODE])) +#else +#define GET_MODE_UNIT_SIZE(MODE) mode_unit_size[MODE] +#endif + +#define GET_MODE_UNIT_BITSIZE(MODE) \ + ((unsigned short) (GET_MODE_UNIT_SIZE (MODE) * BITS_PER_UNIT)) + +extern const unsigned short mode_unit_precision[NUM_MACHINE_MODES]; +#if GCC_VERSION >= 4001 +#define GET_MODE_UNIT_PRECISION(MODE) \ + ((unsigned short) (__builtin_constant_p (MODE) \ + ? mode_unit_precision_inline (MODE)\ + : mode_unit_precision[MODE])) +#else +#define GET_MODE_UNIT_PRECISION(MODE) mode_unit_precision[MODE] +#endif + + +/* Get the number of units in the object. */ + +extern const unsigned char mode_nunits[NUM_MACHINE_MODES]; +#if GCC_VERSION >= 4001 +#define GET_MODE_NUNITS(MODE) \ + ((unsigned char) (__builtin_constant_p (MODE) \ + ? mode_nunits_inline (MODE) : mode_nunits[MODE])) +#else +#define GET_MODE_NUNITS(MODE) mode_nunits[MODE] +#endif + +/* Get the next wider natural mode (eg, QI -> HI -> SI -> DI -> TI). */ + +extern const unsigned char mode_wider[NUM_MACHINE_MODES]; +#define GET_MODE_WIDER_MODE(MODE) ((machine_mode) mode_wider[MODE]) + +/* For scalars, this is a mode with twice the precision. For vectors, + this is a mode with the same inner mode but with twice the elements. */ +extern const unsigned char mode_2xwider[NUM_MACHINE_MODES]; +#define GET_MODE_2XWIDER_MODE(MODE) ((machine_mode) mode_2xwider[MODE]) + +/* Get the complex mode from the component mode. */ +extern const unsigned char mode_complex[NUM_MACHINE_MODES]; +#define GET_MODE_COMPLEX_MODE(MODE) ((machine_mode) mode_complex[MODE]) + +/* Return the mode for data of a given size SIZE and mode class CLASS. + If LIMIT is nonzero, then don't use modes bigger than MAX_FIXED_MODE_SIZE. + The value is BLKmode if no other mode is found. */ + +extern machine_mode mode_for_size (unsigned int, enum mode_class, int); + +/* Similar, but find the smallest mode for a given width. */ + +extern machine_mode smallest_mode_for_size (unsigned int, + enum mode_class); + + +/* Return an integer mode of the exact same size as the input mode, + or BLKmode on failure. */ + +extern machine_mode int_mode_for_mode (machine_mode); + +extern machine_mode bitwise_mode_for_mode (machine_mode); + +/* Return a mode that is suitable for representing a vector, + or BLKmode on failure. */ + +extern machine_mode mode_for_vector (machine_mode, unsigned); + +/* A class for iterating through possible bitfield modes. */ +class bit_field_mode_iterator +{ +public: + bit_field_mode_iterator (HOST_WIDE_INT, HOST_WIDE_INT, + HOST_WIDE_INT, HOST_WIDE_INT, + unsigned int, bool); + bool next_mode (machine_mode *); + bool prefer_smaller_modes (); + +private: + machine_mode m_mode; + /* We use signed values here because the bit position can be negative + for invalid input such as gcc.dg/pr48335-8.c. */ + HOST_WIDE_INT m_bitsize; + HOST_WIDE_INT m_bitpos; + HOST_WIDE_INT m_bitregion_start; + HOST_WIDE_INT m_bitregion_end; + unsigned int m_align; + bool m_volatilep; + int m_count; +}; + +/* Find the best mode to use to access a bit field. */ + +extern machine_mode get_best_mode (int, int, + unsigned HOST_WIDE_INT, + unsigned HOST_WIDE_INT, + unsigned int, + machine_mode, bool); + +/* Determine alignment, 1<=result<=BIGGEST_ALIGNMENT. */ + +extern CONST_MODE_BASE_ALIGN unsigned short mode_base_align[NUM_MACHINE_MODES]; + +extern unsigned get_mode_alignment (machine_mode); + +#define GET_MODE_ALIGNMENT(MODE) get_mode_alignment (MODE) + +/* For each class, get the narrowest mode in that class. */ + +extern const unsigned char class_narrowest_mode[MAX_MODE_CLASS]; +#define GET_CLASS_NARROWEST_MODE(CLASS) \ + ((machine_mode) class_narrowest_mode[CLASS]) + +/* Define the integer modes whose sizes are BITS_PER_UNIT and BITS_PER_WORD + and the mode whose class is Pmode and whose size is POINTER_SIZE. */ + +extern machine_mode byte_mode; +extern machine_mode word_mode; +extern machine_mode ptr_mode; + +/* Target-dependent machine mode initialization - in insn-modes.c. */ +extern void init_adjust_machine_modes (void); + +#define TRULY_NOOP_TRUNCATION_MODES_P(MODE1, MODE2) \ + TRULY_NOOP_TRUNCATION (GET_MODE_PRECISION (MODE1), \ + GET_MODE_PRECISION (MODE2)) + +#define HWI_COMPUTABLE_MODE_P(MODE) \ + (SCALAR_INT_MODE_P (MODE) \ + && GET_MODE_PRECISION (MODE) <= HOST_BITS_PER_WIDE_INT) + +struct int_n_data_t { + /* These parts are initailized by genmodes output */ + unsigned int bitsize; + machine_mode m; + /* RID_* is RID_INTN_BASE + index into this array */ +}; + +/* This is also in tree.h. genmodes.c guarantees the're sorted from + smallest bitsize to largest bitsize. */ +extern bool int_n_enabled_p[NUM_INT_N_ENTS]; +extern const int_n_data_t int_n_data[NUM_INT_N_ENTS]; + +#endif /* not HAVE_MACHINE_MODES */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/md5.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/md5.h new file mode 100644 index 0000000..2188677 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/md5.h @@ -0,0 +1,154 @@ +/* md5.h - Declaration of functions and data types used for MD5 sum + computing library functions. + Copyright (C) 1995-2017 Free Software Foundation, Inc. + NOTE: The canonical source of this file is maintained with the GNU C + Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef _MD5_H +#define _MD5_H 1 + +#include + +#if defined HAVE_LIMITS_H || _LIBC +# include +#endif + +#include "ansidecl.h" + +/* The following contortions are an attempt to use the C preprocessor + to determine an unsigned integral type that is 32 bits wide. An + alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but + doing that would require that the configure script compile and *run* + the resulting executable. Locally running cross-compiled executables + is usually not possible. */ + +#ifdef _LIBC +# include +typedef u_int32_t md5_uint32; +typedef uintptr_t md5_uintptr; +#elif defined (HAVE_SYS_TYPES_H) && defined (HAVE_STDINT_H) +#include +#include +typedef uint32_t md5_uint32; +typedef uintptr_t md5_uintptr; +#else +# define INT_MAX_32_BITS 2147483647 + +/* If UINT_MAX isn't defined, assume it's a 32-bit type. + This should be valid for all systems GNU cares about because + that doesn't include 16-bit systems, and only modern systems + (that certainly have ) have 64+-bit integral types. */ + +# ifndef INT_MAX +# define INT_MAX INT_MAX_32_BITS +# endif + +# if INT_MAX == INT_MAX_32_BITS + typedef unsigned int md5_uint32; +# else +# if SHRT_MAX == INT_MAX_32_BITS + typedef unsigned short md5_uint32; +# else +# if LONG_MAX == INT_MAX_32_BITS + typedef unsigned long md5_uint32; +# else + /* The following line is intended to evoke an error. + Using #error is not portable enough. */ + "Cannot determine unsigned 32-bit data type." +# endif +# endif +# endif +/* We have to make a guess about the integer type equivalent in size + to pointers which should always be correct. */ +typedef unsigned long int md5_uintptr; +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Structure to save state of computation between the single steps. */ +struct md5_ctx +{ + md5_uint32 A; + md5_uint32 B; + md5_uint32 C; + md5_uint32 D; + + md5_uint32 total[2]; + md5_uint32 buflen; + char buffer[128] ATTRIBUTE_ALIGNED_ALIGNOF(md5_uint32); +}; + +/* + * The following three functions are build up the low level used in + * the functions `md5_stream' and `md5_buffer'. + */ + +/* Initialize structure containing state of computation. + (RFC 1321, 3.3: Step 3) */ +extern void md5_init_ctx (struct md5_ctx *ctx); + +/* Starting with the result of former calls of this function (or the + initialization function update the context for the next LEN bytes + starting at BUFFER. + It is necessary that LEN is a multiple of 64!!! */ +extern void md5_process_block (const void *buffer, size_t len, + struct md5_ctx *ctx); + +/* Starting with the result of former calls of this function (or the + initialization function update the context for the next LEN bytes + starting at BUFFER. + It is NOT required that LEN is a multiple of 64. */ +extern void md5_process_bytes (const void *buffer, size_t len, + struct md5_ctx *ctx); + +/* Process the remaining bytes in the buffer and put result from CTX + in first 16 bytes following RESBUF. The result is always in little + endian byte order, so that a byte-wise output yields to the wanted + ASCII representation of the message digest. + + IMPORTANT: On some systems it is required that RESBUF is correctly + aligned for a 32 bits value. */ +extern void *md5_finish_ctx (struct md5_ctx *ctx, void *resbuf); + + +/* Put result from CTX in first 16 bytes following RESBUF. The result is + always in little endian byte order, so that a byte-wise output yields + to the wanted ASCII representation of the message digest. + + IMPORTANT: On some systems it is required that RESBUF is correctly + aligned for a 32 bits value. */ +extern void *md5_read_ctx (const struct md5_ctx *ctx, void *resbuf); + + +/* Compute MD5 message digest for bytes read from STREAM. The + resulting message digest number will be written into the 16 bytes + beginning at RESBLOCK. */ +extern int md5_stream (FILE *stream, void *resblock); + +/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The + result is always in little endian byte order, so that a byte-wise + output yields to the wanted ASCII representation of the message + digest. */ +extern void *md5_buffer (const char *buffer, size_t len, void *resblock); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/mem-stats-traits.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/mem-stats-traits.h new file mode 100644 index 0000000..dfea6d8 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/mem-stats-traits.h @@ -0,0 +1,41 @@ +/* A memory statistics traits. + Copyright (C) 2015-2017 Free Software Foundation, Inc. + Contributed by Martin Liska + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_MEM_STATS_TRAITS_H +#define GCC_MEM_STATS_TRAITS_H + +/* Memory allocation origin. */ +enum mem_alloc_origin +{ + HASH_TABLE_ORIGIN, + HASH_MAP_ORIGIN, + HASH_SET_ORIGIN, + VEC_ORIGIN, + BITMAP_ORIGIN, + GGC_ORIGIN, + ALLOC_POOL_ORIGIN, + MEM_ALLOC_ORIGIN_LENGTH +}; + +/* Verbose names of the memory allocation origin. */ +static const char * mem_alloc_origin_names[] = { "Hash tables", "Hash maps", + "Hash sets", "Heap vectors", "Bitmaps", "GGC memory", "Allocation pool" }; + +#endif // GCC_MEM_STATS_TRAITS_H diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/mem-stats.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/mem-stats.h new file mode 100644 index 0000000..a5f8e32 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/mem-stats.h @@ -0,0 +1,636 @@ +/* A memory statistics tracking infrastructure. + Copyright (C) 2015-2017 Free Software Foundation, Inc. + Contributed by Martin Liska + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_MEM_STATS_H +#define GCC_MEM_STATS_H + +/* Forward declaration. */ +template, + Value> > +class hash_map; + +#define LOCATION_LINE_EXTRA_SPACE 30 +#define LOCATION_LINE_WIDTH 48 + +/* Memory allocation location. */ +struct mem_location +{ + /* Default constructor. */ + inline + mem_location () {} + + /* Constructor. */ + inline + mem_location (mem_alloc_origin origin, bool ggc, + const char *filename = NULL, int line = 0, + const char *function = NULL): + m_filename (filename), m_function (function), m_line (line), m_origin + (origin), m_ggc (ggc) {} + + /* Copy constructor. */ + inline + mem_location (mem_location &other): m_filename (other.m_filename), + m_function (other.m_function), m_line (other.m_line), + m_origin (other.m_origin), m_ggc (other.m_ggc) {} + + /* Compute hash value based on file name, function name and line in + source code. As there is just a single pointer registered for every + constant that points to e.g. the same file name, we can use hash + of the pointer. */ + hashval_t + hash () + { + inchash::hash hash; + + hash.add_ptr (m_filename); + hash.add_ptr (m_function); + hash.add_int (m_line); + + return hash.end (); + } + + /* Return true if the memory location is equal to OTHER. */ + int + equal (mem_location &other) + { + return m_filename == other.m_filename && m_function == other.m_function + && m_line == other.m_line; + } + + /* Return trimmed filename for the location. */ + inline const char * + get_trimmed_filename () + { + const char *s1 = m_filename; + const char *s2; + + while ((s2 = strstr (s1, "gcc/"))) + s1 = s2 + 4; + + return s1; + } + + inline char * + to_string () + { + unsigned l = strlen (get_trimmed_filename ()) + strlen (m_function) + + LOCATION_LINE_EXTRA_SPACE; + + char *s = XNEWVEC (char, l); + sprintf (s, "%s:%i (%s)", get_trimmed_filename (), + m_line, m_function); + + s[MIN (LOCATION_LINE_WIDTH, l - 1)] = '\0'; + + return s; + } + + /* Return display name associated to ORIGIN type. */ + static const char * + get_origin_name (mem_alloc_origin origin) + { + return mem_alloc_origin_names[(unsigned) origin]; + } + + /* File name of source code. */ + const char *m_filename; + /* Funcation name. */ + const char *m_function; + /* Line number in source code. */ + int m_line; + /* Origin type. */ + mem_alloc_origin m_origin; + /* Flag if used by GGC allocation. */ + bool m_ggc; +}; + +/* Memory usage register to a memory location. */ +struct mem_usage +{ + /* Default constructor. */ + mem_usage (): m_allocated (0), m_times (0), m_peak (0), m_instances (1) {} + + /* Constructor. */ + mem_usage (size_t allocated, size_t times, size_t peak, size_t instances = 0): + m_allocated (allocated), m_times (times), m_peak (peak), + m_instances (instances) {} + + /* Register overhead of SIZE bytes. */ + inline void + register_overhead (size_t size) + { + m_allocated += size; + m_times++; + + if (m_peak < m_allocated) + m_peak = m_allocated; + } + + /* Release overhead of SIZE bytes. */ + inline void + release_overhead (size_t size) + { + gcc_assert (size <= m_allocated); + + m_allocated -= size; + } + + /* Sum the usage with SECOND usage. */ + mem_usage + operator+ (const mem_usage &second) + { + return mem_usage (m_allocated + second.m_allocated, + m_times + second.m_times, + m_peak + second.m_peak, + m_instances + second.m_instances); + } + + /* Comparison operator. */ + inline bool + operator< (const mem_usage &second) const + { + return (m_allocated == second.m_allocated ? + (m_peak == second.m_peak ? m_times < second.m_times + : m_peak < second.m_peak) : m_allocated < second.m_allocated); + } + + /* Compare wrapper used by qsort method. */ + static int + compare (const void *first, const void *second) + { + typedef std::pair mem_pair_t; + + const mem_pair_t f = *(const mem_pair_t *)first; + const mem_pair_t s = *(const mem_pair_t *)second; + + return (*f.second) < (*s.second); + } + + /* Dump usage coupled to LOC location, where TOTAL is sum of all rows. */ + inline void + dump (mem_location *loc, mem_usage &total) const + { + char *location_string = loc->to_string (); + + fprintf (stderr, "%-48s %10" PRIu64 ":%5.1f%%" + "%10" PRIu64 "%10" PRIu64 ":%5.1f%%%10s\n", + location_string, (uint64_t)m_allocated, + get_percent (m_allocated, total.m_allocated), + (uint64_t)m_peak, (uint64_t)m_times, + get_percent (m_times, total.m_times), loc->m_ggc ? "ggc" : "heap"); + + free (location_string); + } + + /* Dump footer. */ + inline void + dump_footer () const + { + print_dash_line (); + fprintf (stderr, "%s%54" PRIu64 "%27" PRIu64 "\n", "Total", + (uint64_t)m_allocated, (uint64_t)m_times); + print_dash_line (); + } + + /* Return fraction of NOMINATOR and DENOMINATOR in percent. */ + static inline float + get_percent (size_t nominator, size_t denominator) + { + return denominator == 0 ? 0.0f : nominator * 100.0 / denominator; + } + + /* Print line made of dashes. */ + static inline void + print_dash_line (size_t count = 140) + { + while (count--) + fputc ('-', stderr); + fputc ('\n', stderr); + } + + /* Dump header with NAME. */ + static inline void + dump_header (const char *name) + { + fprintf (stderr, "%-48s %11s%16s%10s%17s\n", name, "Leak", "Peak", + "Times", "Type"); + print_dash_line (); + } + + /* Current number of allocated bytes. */ + size_t m_allocated; + /* Number of allocations. */ + size_t m_times; + /* Peak allocation in bytes. */ + size_t m_peak; + /* Number of container instances. */ + size_t m_instances; +}; + +/* Memory usage pair that connectes memory usage and number + of allocated bytes. */ +template +struct mem_usage_pair +{ + mem_usage_pair (T *usage_, size_t allocated_): usage (usage_), + allocated (allocated_) {} + + T *usage; + size_t allocated; +}; + +/* Memory allocation description. */ +template +class mem_alloc_description +{ +public: + struct mem_location_hash : nofree_ptr_hash + { + static hashval_t + hash (value_type l) + { + inchash::hash hstate; + + hstate.add_ptr ((const void *)l->m_filename); + hstate.add_ptr (l->m_function); + hstate.add_int (l->m_line); + + return hstate.end (); + } + + static bool + equal (value_type l1, value_type l2) + { + return l1->m_filename == l2->m_filename + && l1->m_function == l2->m_function + && l1->m_line == l2->m_line; + } + }; + + /* Internal class type definitions. */ + typedef hash_map mem_map_t; + typedef hash_map > reverse_mem_map_t; + typedef hash_map > reverse_object_map_t; + typedef std::pair mem_list_t; + + /* Default contructor. */ + mem_alloc_description (); + + /* Default destructor. */ + ~mem_alloc_description (); + + /* Returns true if instance PTR is registered by the memory description. */ + bool + contains_descriptor_for_instance (const void *ptr); + + /* Return descriptor for instance PTR. */ + T * + get_descriptor_for_instance (const void *ptr); + + /* Register memory allocation descriptor for container PTR which is + described by a memory LOCATION. */ + T * + register_descriptor (const void *ptr, mem_location *location); + + /* Register memory allocation descriptor for container PTR. ORIGIN identifies + type of container and GGC identifes if the allocation is handled in GGC + memory. Each location is identified by file NAME, LINE in source code and + FUNCTION name. */ + T * + register_descriptor (const void *ptr, mem_alloc_origin origin, + bool ggc, const char *name, int line, + const char *function); + + /* Register instance overhead identified by PTR pointer. Allocation takes + SIZE bytes. */ + T * + register_instance_overhead (size_t size, const void *ptr); + + /* For containers (and GGC) where we want to track every instance object, + we register allocation of SIZE bytes, identified by PTR pointer, belonging + to USAGE descriptor. */ + void + register_object_overhead (T *usage, size_t size, const void *ptr); + + /* Release PTR pointer of SIZE bytes. If REMOVE_FROM_MAP is set to true, + remove the instance from reverse map. */ + void + release_instance_overhead (void *ptr, size_t size, + bool remove_from_map = false); + + /* Release intance object identified by PTR pointer. */ + void + release_object_overhead (void *ptr); + + /* Get sum value for ORIGIN type of allocation for the descriptor. */ + T + get_sum (mem_alloc_origin origin); + + /* Get all tracked instances registered by the description. Items + are filtered by ORIGIN type, LENGTH is return value where we register + the number of elements in the list. If we want to process custom order, + CMP comparator can be provided. */ + mem_list_t * + get_list (mem_alloc_origin origin, unsigned *length, + int (*cmp) (const void *first, const void *second) = NULL); + + /* Dump all tracked instances of type ORIGIN. If we want to process custom + order, CMP comparator can be provided. */ + void dump (mem_alloc_origin origin, + int (*cmp) (const void *first, const void *second) = NULL); + + /* Reverse object map used for every object allocation mapping. */ + reverse_object_map_t *m_reverse_object_map; + +private: + /* Register overhead of SIZE bytes of ORIGIN type. PTR pointer is allocated + in NAME source file, at LINE in source code, in FUNCTION. */ + T *register_overhead (size_t size, mem_alloc_origin origin, const char *name, + int line, const char *function, const void *ptr); + + /* Allocation location coupled to the description. */ + mem_location m_location; + + /* Location to usage mapping. */ + mem_map_t *m_map; + + /* Reverse pointer to usage mapping. */ + reverse_mem_map_t *m_reverse_map; +}; + + +/* Returns true if instance PTR is registered by the memory description. */ + +template +inline bool +mem_alloc_description::contains_descriptor_for_instance (const void *ptr) +{ + return m_reverse_map->get (ptr); +} + +/* Return descriptor for instance PTR. */ + +template +inline T* +mem_alloc_description::get_descriptor_for_instance (const void *ptr) +{ + return m_reverse_map->get (ptr) ? (*m_reverse_map->get (ptr)).usage : NULL; +} + + + /* Register memory allocation descriptor for container PTR which is + described by a memory LOCATION. */ +template +inline T* +mem_alloc_description::register_descriptor (const void *ptr, + mem_location *location) +{ + T *usage = NULL; + + T **slot = m_map->get (location); + if (slot) + { + delete location; + usage = *slot; + usage->m_instances++; + } + else + { + usage = new T (); + m_map->put (location, usage); + } + + if (!m_reverse_map->get (ptr)) + m_reverse_map->put (ptr, mem_usage_pair (usage, 0)); + + return usage; +} + +/* Register memory allocation descriptor for container PTR. ORIGIN identifies + type of container and GGC identifes if the allocation is handled in GGC + memory. Each location is identified by file NAME, LINE in source code and + FUNCTION name. */ + +template +inline T* +mem_alloc_description::register_descriptor (const void *ptr, + mem_alloc_origin origin, + bool ggc, + const char *filename, + int line, + const char *function) +{ + mem_location *l = new mem_location (origin, ggc, filename, line, function); + return register_descriptor (ptr, l); +} + +/* Register instance overhead identified by PTR pointer. Allocation takes + SIZE bytes. */ + +template +inline T* +mem_alloc_description::register_instance_overhead (size_t size, + const void *ptr) +{ + mem_usage_pair *slot = m_reverse_map->get (ptr); + if (!slot) + { + /* Due to PCH, it can really happen. */ + return NULL; + } + + T *usage = (*slot).usage; + usage->register_overhead (size); + + return usage; +} + +/* For containers (and GGC) where we want to track every instance object, + we register allocation of SIZE bytes, identified by PTR pointer, belonging + to USAGE descriptor. */ + +template +void +mem_alloc_description::register_object_overhead (T *usage, size_t size, + const void *ptr) +{ + /* In case of GGC, it is possible to have already occupied the memory + location. */ + m_reverse_object_map->put (ptr, std::pair (usage, size)); +} + +/* Register overhead of SIZE bytes of ORIGIN type. PTR pointer is allocated + in NAME source file, at LINE in source code, in FUNCTION. */ + +template +inline T* +mem_alloc_description::register_overhead (size_t size, + mem_alloc_origin origin, + const char *filename, + int line, + const char *function, + const void *ptr) +{ + T *usage = register_descriptor (ptr, origin, filename, line, function); + usage->register_overhead (size); + + return usage; +} + +/* Release PTR pointer of SIZE bytes. */ + +template +inline void +mem_alloc_description::release_instance_overhead (void *ptr, size_t size, + bool remove_from_map) +{ + mem_usage_pair *slot = m_reverse_map->get (ptr); + + if (!slot) + { + /* Due to PCH, it can really happen. */ + return; + } + + mem_usage_pair usage_pair = *slot; + usage_pair.usage->release_overhead (size); + + if (remove_from_map) + m_reverse_map->remove (ptr); +} + +/* Release intance object identified by PTR pointer. */ + +template +inline void +mem_alloc_description::release_object_overhead (void *ptr) +{ + std::pair *entry = m_reverse_object_map->get (ptr); + if (entry) + { + entry->first->release_overhead (entry->second); + m_reverse_object_map->remove (ptr); + } +} + +/* Default contructor. */ + +template +inline +mem_alloc_description::mem_alloc_description () +{ + m_map = new mem_map_t (13, false, false); + m_reverse_map = new reverse_mem_map_t (13, false, false); + m_reverse_object_map = new reverse_object_map_t (13, false, false); +} + +/* Default destructor. */ + +template +inline +mem_alloc_description::~mem_alloc_description () +{ + for (typename mem_map_t::iterator it = m_map->begin (); it != m_map->end (); + ++it) + { + delete (*it).first; + delete (*it).second; + } + + delete m_map; + delete m_reverse_map; + delete m_reverse_object_map; +} + +/* Get all tracked instances registered by the description. Items are filtered + by ORIGIN type, LENGTH is return value where we register the number of + elements in the list. If we want to process custom order, CMP comparator + can be provided. */ + +template +inline +typename mem_alloc_description::mem_list_t * +mem_alloc_description::get_list (mem_alloc_origin origin, unsigned *length, + int (*cmp) (const void *first, const void *second)) +{ + /* vec data structure is not used because all vectors generate memory + allocation info a it would create a cycle. */ + size_t element_size = sizeof (mem_list_t); + mem_list_t *list = XCNEWVEC (mem_list_t, m_map->elements ()); + unsigned i = 0; + + for (typename mem_map_t::iterator it = m_map->begin (); it != m_map->end (); + ++it) + if ((*it).first->m_origin == origin) + list[i++] = std::pair (*it); + + qsort (list, i, element_size, cmp == NULL ? T::compare : cmp); + *length = i; + + return list; +} + +/* Get sum value for ORIGIN type of allocation for the descriptor. */ + +template +inline T +mem_alloc_description::get_sum (mem_alloc_origin origin) +{ + unsigned length; + mem_list_t *list = get_list (origin, &length); + T sum; + + for (unsigned i = 0; i < length; i++) + sum = sum + *list[i].second; + + XDELETEVEC (list); + + return sum; +} + +/* Dump all tracked instances of type ORIGIN. If we want to process custom + order, CMP comparator can be provided. */ + +template +inline void +mem_alloc_description::dump (mem_alloc_origin origin, + int (*cmp) (const void *first, + const void *second)) +{ + unsigned length; + + fprintf (stderr, "\n"); + + mem_list_t *list = get_list (origin, &length, cmp); + T total = get_sum (origin); + + T::dump_header (mem_location::get_origin_name (origin)); + for (int i = length - 1; i >= 0; i--) + list[i].second->dump (list[i].first, total); + + total.dump_footer (); + + XDELETEVEC (list); + + fprintf (stderr, "\n"); +} + +#endif // GCC_MEM_STATS_H diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/memmodel.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/memmodel.h new file mode 100644 index 0000000..4082614 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/memmodel.h @@ -0,0 +1,114 @@ +/* Prototypes of memory model helper functions. + Copyright (C) 2011-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_MEMMODEL_H +#define GCC_MEMMODEL_H + +/* Suppose that higher bits are target dependent. */ +#define MEMMODEL_MASK ((1<<16)-1) + +/* Legacy sync operations set this upper flag in the memory model. This allows + targets that need to do something stronger for sync operations to + differentiate with their target patterns and issue a more appropriate insn + sequence. See bugzilla 65697 for background. */ +#define MEMMODEL_SYNC (1<<15) + +/* Memory model without SYNC bit for targets/operations that do not care. */ +#define MEMMODEL_BASE_MASK (MEMMODEL_SYNC-1) + +/* Memory model types for the __atomic* builtins. + This must match the order in libstdc++-v3/include/bits/atomic_base.h. */ +enum memmodel +{ + MEMMODEL_RELAXED = 0, + MEMMODEL_CONSUME = 1, + MEMMODEL_ACQUIRE = 2, + MEMMODEL_RELEASE = 3, + MEMMODEL_ACQ_REL = 4, + MEMMODEL_SEQ_CST = 5, + MEMMODEL_LAST = 6, + MEMMODEL_SYNC_ACQUIRE = MEMMODEL_ACQUIRE | MEMMODEL_SYNC, + MEMMODEL_SYNC_RELEASE = MEMMODEL_RELEASE | MEMMODEL_SYNC, + MEMMODEL_SYNC_SEQ_CST = MEMMODEL_SEQ_CST | MEMMODEL_SYNC +}; + +/* Return the memory model from a host integer. */ +static inline enum memmodel +memmodel_from_int (unsigned HOST_WIDE_INT val) +{ + return (enum memmodel) (val & MEMMODEL_MASK); +} + +/* Return the base memory model from a host integer. */ +static inline enum memmodel +memmodel_base (unsigned HOST_WIDE_INT val) +{ + return (enum memmodel) (val & MEMMODEL_BASE_MASK); +} + +/* Return TRUE if the memory model is RELAXED. */ +static inline bool +is_mm_relaxed (enum memmodel model) +{ + return (model & MEMMODEL_BASE_MASK) == MEMMODEL_RELAXED; +} + +/* Return TRUE if the memory model is CONSUME. */ +static inline bool +is_mm_consume (enum memmodel model) +{ + return (model & MEMMODEL_BASE_MASK) == MEMMODEL_CONSUME; +} + +/* Return TRUE if the memory model is ACQUIRE. */ +static inline bool +is_mm_acquire (enum memmodel model) +{ + return (model & MEMMODEL_BASE_MASK) == MEMMODEL_ACQUIRE; +} + +/* Return TRUE if the memory model is RELEASE. */ +static inline bool +is_mm_release (enum memmodel model) +{ + return (model & MEMMODEL_BASE_MASK) == MEMMODEL_RELEASE; +} + +/* Return TRUE if the memory model is ACQ_REL. */ +static inline bool +is_mm_acq_rel (enum memmodel model) +{ + return (model & MEMMODEL_BASE_MASK) == MEMMODEL_ACQ_REL; +} + +/* Return TRUE if the memory model is SEQ_CST. */ +static inline bool +is_mm_seq_cst (enum memmodel model) +{ + return (model & MEMMODEL_BASE_MASK) == MEMMODEL_SEQ_CST; +} + +/* Return TRUE if the memory model is a SYNC variant. */ +static inline bool +is_mm_sync (enum memmodel model) +{ + return (model & MEMMODEL_SYNC); +} + +#endif /* GCC_MEMMODEL_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/memory-block.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/memory-block.h new file mode 100644 index 0000000..ff43ae8 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/memory-block.h @@ -0,0 +1,76 @@ +/* Shared pool of memory blocks for pool allocators. + Copyright (C) 2015-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + + +#ifndef MEMORY_BLOCK_H +#define MEMORY_BLOCK_H + +/* Shared pool which allows other memory pools to reuse each others' allocated + memory blocks instead of calling free/malloc again. */ +class memory_block_pool +{ +public: + /* Blocks have fixed size. This is necessary for sharing. */ + static const size_t block_size = 64 * 1024; + + memory_block_pool (); + + static inline void *allocate () ATTRIBUTE_MALLOC; + static inline void release (void *); + void clear_free_list (); + +private: + /* memory_block_pool singleton instance, defined in memory-block.cc. */ + static memory_block_pool instance; + + struct block_list + { + block_list *m_next; + }; + + /* Free list. */ + block_list *m_blocks; +}; + +/* Allocate a single block. Reuse a previously returned block, if possible. */ +inline void * +memory_block_pool::allocate () +{ + if (instance.m_blocks == NULL) + return XNEWVEC (char, block_size); + + void *result = instance.m_blocks; + instance.m_blocks = instance.m_blocks->m_next; + VALGRIND_DISCARD (VALGRIND_MAKE_MEM_UNDEFINED (result, block_size)); + return result; +} + +/* Return UNCAST_BLOCK to the pool. */ +inline void +memory_block_pool::release (void *uncast_block) +{ + block_list *block = new (uncast_block) block_list; + block->m_next = instance.m_blocks; + instance.m_blocks = block; +} + +extern void *mempool_obstack_chunk_alloc (size_t) ATTRIBUTE_MALLOC; +extern void mempool_obstack_chunk_free (void *); + +#endif /* MEMORY_BLOCK_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/obstack.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/obstack.h new file mode 100644 index 0000000..2afd55d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/obstack.h @@ -0,0 +1,535 @@ +/* obstack.h - object stack macros + Copyright (C) 1988-2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* Summary: + + All the apparent functions defined here are macros. The idea + is that you would use these pre-tested macros to solve a + very specific set of problems, and they would run fast. + Caution: no side-effects in arguments please!! They may be + evaluated MANY times!! + + These macros operate a stack of objects. Each object starts life + small, and may grow to maturity. (Consider building a word syllable + by syllable.) An object can move while it is growing. Once it has + been "finished" it never changes address again. So the "top of the + stack" is typically an immature growing object, while the rest of the + stack is of mature, fixed size and fixed address objects. + + These routines grab large chunks of memory, using a function you + supply, called 'obstack_chunk_alloc'. On occasion, they free chunks, + by calling 'obstack_chunk_free'. You must define them and declare + them before using any obstack macros. + + Each independent stack is represented by a 'struct obstack'. + Each of the obstack macros expects a pointer to such a structure + as the first argument. + + One motivation for this package is the problem of growing char strings + in symbol tables. Unless you are "fascist pig with a read-only mind" + --Gosper's immortal quote from HAKMEM item 154, out of context--you + would not like to put any arbitrary upper limit on the length of your + symbols. + + In practice this often means you will build many short symbols and a + few long symbols. At the time you are reading a symbol you don't know + how long it is. One traditional method is to read a symbol into a + buffer, realloc()ating the buffer every time you try to read a symbol + that is longer than the buffer. This is beaut, but you still will + want to copy the symbol from the buffer to a more permanent + symbol-table entry say about half the time. + + With obstacks, you can work differently. Use one obstack for all symbol + names. As you read a symbol, grow the name in the obstack gradually. + When the name is complete, finalize it. Then, if the symbol exists already, + free the newly read name. + + The way we do this is to take a large chunk, allocating memory from + low addresses. When you want to build a symbol in the chunk you just + add chars above the current "high water mark" in the chunk. When you + have finished adding chars, because you got to the end of the symbol, + you know how long the chars are, and you can create a new object. + Mostly the chars will not burst over the highest address of the chunk, + because you would typically expect a chunk to be (say) 100 times as + long as an average object. + + In case that isn't clear, when we have enough chars to make up + the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed) + so we just point to it where it lies. No moving of chars is + needed and this is the second win: potentially long strings need + never be explicitly shuffled. Once an object is formed, it does not + change its address during its lifetime. + + When the chars burst over a chunk boundary, we allocate a larger + chunk, and then copy the partly formed object from the end of the old + chunk to the beginning of the new larger chunk. We then carry on + accreting characters to the end of the object as we normally would. + + A special macro is provided to add a single char at a time to a + growing object. This allows the use of register variables, which + break the ordinary 'growth' macro. + + Summary: + We allocate large chunks. + We carve out one object at a time from the current chunk. + Once carved, an object never moves. + We are free to append data of any size to the currently + growing object. + Exactly one object is growing in an obstack at any one time. + You can run one obstack per control block. + You may have as many control blocks as you dare. + Because of the way we do it, you can "unwind" an obstack + back to a previous state. (You may remove objects much + as you would with a stack.) + */ + + +/* Don't do the contents of this file more than once. */ + +#ifndef _OBSTACK_H +#define _OBSTACK_H 1 + +#ifndef _OBSTACK_INTERFACE_VERSION +# define _OBSTACK_INTERFACE_VERSION 2 +#endif + +#include /* For size_t and ptrdiff_t. */ +#include /* For __GNU_LIBRARY__, and memcpy. */ + +#if _OBSTACK_INTERFACE_VERSION == 1 +/* For binary compatibility with obstack version 1, which used "int" + and "long" for these two types. */ +# define _OBSTACK_SIZE_T unsigned int +# define _CHUNK_SIZE_T unsigned long +# define _OBSTACK_CAST(type, expr) ((type) (expr)) +#else +/* Version 2 with sane types, especially for 64-bit hosts. */ +# define _OBSTACK_SIZE_T size_t +# define _CHUNK_SIZE_T size_t +# define _OBSTACK_CAST(type, expr) (expr) +#endif + +/* If B is the base of an object addressed by P, return the result of + aligning P to the next multiple of A + 1. B and P must be of type + char *. A + 1 must be a power of 2. */ + +#define __BPTR_ALIGN(B, P, A) ((B) + (((P) - (B) + (A)) & ~(A))) + +/* Similar to __BPTR_ALIGN (B, P, A), except optimize the common case + where pointers can be converted to integers, aligned as integers, + and converted back again. If ptrdiff_t is narrower than a + pointer (e.g., the AS/400), play it safe and compute the alignment + relative to B. Otherwise, use the faster strategy of computing the + alignment relative to 0. */ + +#define __PTR_ALIGN(B, P, A) \ + __BPTR_ALIGN (sizeof (ptrdiff_t) < sizeof (void *) ? (B) : (char *) 0, \ + P, A) + +#ifndef __attribute_pure__ +# if defined __GNUC_MINOR__ && __GNUC__ * 1000 + __GNUC_MINOR__ >= 2096 +# define __attribute_pure__ __attribute__ ((__pure__)) +# else +# define __attribute_pure__ +# endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +struct _obstack_chunk /* Lives at front of each chunk. */ +{ + char *limit; /* 1 past end of this chunk */ + struct _obstack_chunk *prev; /* address of prior chunk or NULL */ + char contents[4]; /* objects begin here */ +}; + +struct obstack /* control current object in current chunk */ +{ + _CHUNK_SIZE_T chunk_size; /* preferred size to allocate chunks in */ + struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */ + char *object_base; /* address of object we are building */ + char *next_free; /* where to add next char to current object */ + char *chunk_limit; /* address of char after current chunk */ + union + { + _OBSTACK_SIZE_T i; + void *p; + } temp; /* Temporary for some macros. */ + _OBSTACK_SIZE_T alignment_mask; /* Mask of alignment for each object. */ + + /* These prototypes vary based on 'use_extra_arg'. */ + union + { + void *(*plain) (size_t); + void *(*extra) (void *, size_t); + } chunkfun; + union + { + void (*plain) (void *); + void (*extra) (void *, void *); + } freefun; + + void *extra_arg; /* first arg for chunk alloc/dealloc funcs */ + unsigned use_extra_arg : 1; /* chunk alloc/dealloc funcs take extra arg */ + unsigned maybe_empty_object : 1; /* There is a possibility that the current + chunk contains a zero-length object. This + prevents freeing the chunk if we allocate + a bigger chunk to replace it. */ + unsigned alloc_failed : 1; /* No longer used, as we now call the failed + handler on error, but retained for binary + compatibility. */ +}; + +/* Declare the external functions we use; they are in obstack.c. */ + +extern void _obstack_newchunk (struct obstack *, _OBSTACK_SIZE_T); +extern void _obstack_free (struct obstack *, void *); +extern int _obstack_begin (struct obstack *, + _OBSTACK_SIZE_T, _OBSTACK_SIZE_T, + void *(*) (size_t), void (*) (void *)); +extern int _obstack_begin_1 (struct obstack *, + _OBSTACK_SIZE_T, _OBSTACK_SIZE_T, + void *(*) (void *, size_t), + void (*) (void *, void *), void *); +extern _OBSTACK_SIZE_T _obstack_memory_used (struct obstack *) + __attribute_pure__; + + +/* Error handler called when 'obstack_chunk_alloc' failed to allocate + more memory. This can be set to a user defined function which + should either abort gracefully or use longjump - but shouldn't + return. The default action is to print a message and abort. */ +extern void (*obstack_alloc_failed_handler) (void); + +/* Exit value used when 'print_and_abort' is used. */ +extern int obstack_exit_failure; + +/* Pointer to beginning of object being allocated or to be allocated next. + Note that this might not be the final address of the object + because a new chunk might be needed to hold the final size. */ + +#define obstack_base(h) ((void *) (h)->object_base) + +/* Size for allocating ordinary chunks. */ + +#define obstack_chunk_size(h) ((h)->chunk_size) + +/* Pointer to next byte not yet allocated in current chunk. */ + +#define obstack_next_free(h) ((void *) (h)->next_free) + +/* Mask specifying low bits that should be clear in address of an object. */ + +#define obstack_alignment_mask(h) ((h)->alignment_mask) + +/* To prevent prototype warnings provide complete argument list. */ +#define obstack_init(h) \ + _obstack_begin ((h), 0, 0, \ + _OBSTACK_CAST (void *(*) (size_t), obstack_chunk_alloc), \ + _OBSTACK_CAST (void (*) (void *), obstack_chunk_free)) + +#define obstack_begin(h, size) \ + _obstack_begin ((h), (size), 0, \ + _OBSTACK_CAST (void *(*) (size_t), obstack_chunk_alloc), \ + _OBSTACK_CAST (void (*) (void *), obstack_chunk_free)) + +#define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ + _obstack_begin ((h), (size), (alignment), \ + _OBSTACK_CAST (void *(*) (size_t), chunkfun), \ + _OBSTACK_CAST (void (*) (void *), freefun)) + +#define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \ + _obstack_begin_1 ((h), (size), (alignment), \ + _OBSTACK_CAST (void *(*) (void *, size_t), chunkfun), \ + _OBSTACK_CAST (void (*) (void *, void *), freefun), arg) + +#define obstack_chunkfun(h, newchunkfun) \ + ((void) ((h)->chunkfun.extra = (void *(*) (void *, size_t)) (newchunkfun))) + +#define obstack_freefun(h, newfreefun) \ + ((void) ((h)->freefun.extra = (void *(*) (void *, void *)) (newfreefun))) + +#define obstack_1grow_fast(h, achar) ((void) (*((h)->next_free)++ = (achar))) + +#define obstack_blank_fast(h, n) ((void) ((h)->next_free += (n))) + +#define obstack_memory_used(h) _obstack_memory_used (h) + +#if defined __GNUC__ +# if !defined __GNUC_MINOR__ || __GNUC__ * 1000 + __GNUC_MINOR__ < 2008 +# define __extension__ +# endif + +/* For GNU C, if not -traditional, + we can define these macros to compute all args only once + without using a global variable. + Also, we can avoid using the 'temp' slot, to make faster code. */ + +# define obstack_object_size(OBSTACK) \ + __extension__ \ + ({ struct obstack const *__o = (OBSTACK); \ + (_OBSTACK_SIZE_T) (__o->next_free - __o->object_base); }) + +/* The local variable is named __o1 to avoid a shadowed variable + warning when invoked from other obstack macros. */ +# define obstack_room(OBSTACK) \ + __extension__ \ + ({ struct obstack const *__o1 = (OBSTACK); \ + (_OBSTACK_SIZE_T) (__o1->chunk_limit - __o1->next_free); }) + +# define obstack_make_room(OBSTACK, length) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + _OBSTACK_SIZE_T __len = (length); \ + if (obstack_room (__o) < __len) \ + _obstack_newchunk (__o, __len); \ + (void) 0; }) + +# define obstack_empty_p(OBSTACK) \ + __extension__ \ + ({ struct obstack const *__o = (OBSTACK); \ + (__o->chunk->prev == 0 \ + && __o->next_free == __PTR_ALIGN ((char *) __o->chunk, \ + __o->chunk->contents, \ + __o->alignment_mask)); }) + +# define obstack_grow(OBSTACK, where, length) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + _OBSTACK_SIZE_T __len = (length); \ + if (obstack_room (__o) < __len) \ + _obstack_newchunk (__o, __len); \ + memcpy (__o->next_free, where, __len); \ + __o->next_free += __len; \ + (void) 0; }) + +# define obstack_grow0(OBSTACK, where, length) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + _OBSTACK_SIZE_T __len = (length); \ + if (obstack_room (__o) < __len + 1) \ + _obstack_newchunk (__o, __len + 1); \ + memcpy (__o->next_free, where, __len); \ + __o->next_free += __len; \ + *(__o->next_free)++ = 0; \ + (void) 0; }) + +# define obstack_1grow(OBSTACK, datum) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + if (obstack_room (__o) < 1) \ + _obstack_newchunk (__o, 1); \ + obstack_1grow_fast (__o, datum); }) + +/* These assume that the obstack alignment is good enough for pointers + or ints, and that the data added so far to the current object + shares that much alignment. */ + +# define obstack_ptr_grow(OBSTACK, datum) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + if (obstack_room (__o) < sizeof (void *)) \ + _obstack_newchunk (__o, sizeof (void *)); \ + obstack_ptr_grow_fast (__o, datum); }) + +# define obstack_int_grow(OBSTACK, datum) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + if (obstack_room (__o) < sizeof (int)) \ + _obstack_newchunk (__o, sizeof (int)); \ + obstack_int_grow_fast (__o, datum); }) + +# define obstack_ptr_grow_fast(OBSTACK, aptr) \ + __extension__ \ + ({ struct obstack *__o1 = (OBSTACK); \ + void *__p1 = __o1->next_free; \ + *(const void **) __p1 = (aptr); \ + __o1->next_free += sizeof (const void *); \ + (void) 0; }) + +# define obstack_int_grow_fast(OBSTACK, aint) \ + __extension__ \ + ({ struct obstack *__o1 = (OBSTACK); \ + void *__p1 = __o1->next_free; \ + *(int *) __p1 = (aint); \ + __o1->next_free += sizeof (int); \ + (void) 0; }) + +# define obstack_blank(OBSTACK, length) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + _OBSTACK_SIZE_T __len = (length); \ + if (obstack_room (__o) < __len) \ + _obstack_newchunk (__o, __len); \ + obstack_blank_fast (__o, __len); }) + +# define obstack_alloc(OBSTACK, length) \ + __extension__ \ + ({ struct obstack *__h = (OBSTACK); \ + obstack_blank (__h, (length)); \ + obstack_finish (__h); }) + +# define obstack_copy(OBSTACK, where, length) \ + __extension__ \ + ({ struct obstack *__h = (OBSTACK); \ + obstack_grow (__h, (where), (length)); \ + obstack_finish (__h); }) + +# define obstack_copy0(OBSTACK, where, length) \ + __extension__ \ + ({ struct obstack *__h = (OBSTACK); \ + obstack_grow0 (__h, (where), (length)); \ + obstack_finish (__h); }) + +/* The local variable is named __o1 to avoid a shadowed variable + warning when invoked from other obstack macros, typically obstack_free. */ +# define obstack_finish(OBSTACK) \ + __extension__ \ + ({ struct obstack *__o1 = (OBSTACK); \ + void *__value = (void *) __o1->object_base; \ + if (__o1->next_free == __value) \ + __o1->maybe_empty_object = 1; \ + __o1->next_free \ + = __PTR_ALIGN (__o1->object_base, __o1->next_free, \ + __o1->alignment_mask); \ + if ((size_t) (__o1->next_free - (char *) __o1->chunk) \ + > (size_t) (__o1->chunk_limit - (char *) __o1->chunk)) \ + __o1->next_free = __o1->chunk_limit; \ + __o1->object_base = __o1->next_free; \ + __value; }) + +# define obstack_free(OBSTACK, OBJ) \ + __extension__ \ + ({ struct obstack *__o = (OBSTACK); \ + void *__obj = (void *) (OBJ); \ + if (__obj > (void *) __o->chunk && __obj < (void *) __o->chunk_limit) \ + __o->next_free = __o->object_base = (char *) __obj; \ + else \ + _obstack_free (__o, __obj); }) + +#else /* not __GNUC__ */ + +# define obstack_object_size(h) \ + ((_OBSTACK_SIZE_T) ((h)->next_free - (h)->object_base)) + +# define obstack_room(h) \ + ((_OBSTACK_SIZE_T) ((h)->chunk_limit - (h)->next_free)) + +# define obstack_empty_p(h) \ + ((h)->chunk->prev == 0 \ + && (h)->next_free == __PTR_ALIGN ((char *) (h)->chunk, \ + (h)->chunk->contents, \ + (h)->alignment_mask)) + +/* Note that the call to _obstack_newchunk is enclosed in (..., 0) + so that we can avoid having void expressions + in the arms of the conditional expression. + Casting the third operand to void was tried before, + but some compilers won't accept it. */ + +# define obstack_make_room(h, length) \ + ((h)->temp.i = (length), \ + ((obstack_room (h) < (h)->temp.i) \ + ? (_obstack_newchunk (h, (h)->temp.i), 0) : 0), \ + (void) 0) + +# define obstack_grow(h, where, length) \ + ((h)->temp.i = (length), \ + ((obstack_room (h) < (h)->temp.i) \ + ? (_obstack_newchunk ((h), (h)->temp.i), 0) : 0), \ + memcpy ((h)->next_free, where, (h)->temp.i), \ + (h)->next_free += (h)->temp.i, \ + (void) 0) + +# define obstack_grow0(h, where, length) \ + ((h)->temp.i = (length), \ + ((obstack_room (h) < (h)->temp.i + 1) \ + ? (_obstack_newchunk ((h), (h)->temp.i + 1), 0) : 0), \ + memcpy ((h)->next_free, where, (h)->temp.i), \ + (h)->next_free += (h)->temp.i, \ + *((h)->next_free)++ = 0, \ + (void) 0) + +# define obstack_1grow(h, datum) \ + (((obstack_room (h) < 1) \ + ? (_obstack_newchunk ((h), 1), 0) : 0), \ + obstack_1grow_fast (h, datum)) + +# define obstack_ptr_grow(h, datum) \ + (((obstack_room (h) < sizeof (char *)) \ + ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \ + obstack_ptr_grow_fast (h, datum)) + +# define obstack_int_grow(h, datum) \ + (((obstack_room (h) < sizeof (int)) \ + ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \ + obstack_int_grow_fast (h, datum)) + +# define obstack_ptr_grow_fast(h, aptr) \ + (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr), \ + (void) 0) + +# define obstack_int_grow_fast(h, aint) \ + (((int *) ((h)->next_free += sizeof (int)))[-1] = (aint), \ + (void) 0) + +# define obstack_blank(h, length) \ + ((h)->temp.i = (length), \ + ((obstack_room (h) < (h)->temp.i) \ + ? (_obstack_newchunk ((h), (h)->temp.i), 0) : 0), \ + obstack_blank_fast (h, (h)->temp.i)) + +# define obstack_alloc(h, length) \ + (obstack_blank ((h), (length)), obstack_finish ((h))) + +# define obstack_copy(h, where, length) \ + (obstack_grow ((h), (where), (length)), obstack_finish ((h))) + +# define obstack_copy0(h, where, length) \ + (obstack_grow0 ((h), (where), (length)), obstack_finish ((h))) + +# define obstack_finish(h) \ + (((h)->next_free == (h)->object_base \ + ? (((h)->maybe_empty_object = 1), 0) \ + : 0), \ + (h)->temp.p = (h)->object_base, \ + (h)->next_free \ + = __PTR_ALIGN ((h)->object_base, (h)->next_free, \ + (h)->alignment_mask), \ + (((size_t) ((h)->next_free - (char *) (h)->chunk) \ + > (size_t) ((h)->chunk_limit - (char *) (h)->chunk)) \ + ? ((h)->next_free = (h)->chunk_limit) : 0), \ + (h)->object_base = (h)->next_free, \ + (h)->temp.p) + +# define obstack_free(h, obj) \ + ((h)->temp.p = (void *) (obj), \ + (((h)->temp.p > (void *) (h)->chunk \ + && (h)->temp.p < (void *) (h)->chunk_limit) \ + ? (void) ((h)->next_free = (h)->object_base = (char *) (h)->temp.p) \ + : _obstack_free ((h), (h)->temp.p))) + +#endif /* not __GNUC__ */ + +#ifdef __cplusplus +} /* C++ */ +#endif + +#endif /* _OBSTACK_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/omp-expand.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/omp-expand.h new file mode 100644 index 0000000..04fcf65 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/omp-expand.h @@ -0,0 +1,32 @@ +/* Expansion pass for OMP directives. Outlines regions of certain OMP + directives to separate functions, converts others into explicit calls to the + runtime library (libgomp) and so forth + +Copyright (C) 2005-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_OMP_EXPAND_H +#define GCC_OMP_EXPAND_H + +struct omp_region; +extern void omp_expand_local (basic_block head); +extern void omp_free_regions (void); +extern bool omp_make_gimple_edges (basic_block bb, struct omp_region **region, + int *region_idx); + +#endif /* GCC_OMP_EXPAND_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/omp-general.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/omp-general.h new file mode 100644 index 0000000..3cf7fce --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/omp-general.h @@ -0,0 +1,93 @@ +/* General types and functions that are uselful for processing of OpenMP, + OpenACC and similar directivers at various stages of compilation. + + Copyright (C) 2005-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_OMP_GENERAL_H +#define GCC_OMP_GENERAL_H + +#include "gomp-constants.h" + +/* Flags for an OpenACC loop. */ + +enum oacc_loop_flags { + OLF_SEQ = 1u << 0, /* Explicitly sequential */ + OLF_AUTO = 1u << 1, /* Compiler chooses axes. */ + OLF_INDEPENDENT = 1u << 2, /* Iterations are known independent. */ + OLF_GANG_STATIC = 1u << 3, /* Gang partitioning is static (has op). */ + OLF_TILE = 1u << 4, /* Tiled loop. */ + + /* Explicitly specified loop axes. */ + OLF_DIM_BASE = 5, + OLF_DIM_GANG = 1u << (OLF_DIM_BASE + GOMP_DIM_GANG), + OLF_DIM_WORKER = 1u << (OLF_DIM_BASE + GOMP_DIM_WORKER), + OLF_DIM_VECTOR = 1u << (OLF_DIM_BASE + GOMP_DIM_VECTOR), + + OLF_MAX = OLF_DIM_BASE + GOMP_DIM_MAX +}; + +/* A structure holding the elements of: + for (V = N1; V cond N2; V += STEP) [...] */ + +struct omp_for_data_loop +{ + tree v, n1, n2, step; + enum tree_code cond_code; +}; + +/* A structure describing the main elements of a parallel loop. */ + +struct omp_for_data +{ + struct omp_for_data_loop loop; + tree chunk_size; + gomp_for *for_stmt; + tree pre, iter_type; + tree tiling; /* Tiling values (if non null). */ + int collapse; /* Collapsed loops, 1 for a non-collapsed loop. */ + int ordered; + bool have_nowait, have_ordered, simd_schedule; + unsigned char sched_modifiers; + enum omp_clause_schedule_kind sched_kind; + struct omp_for_data_loop *loops; +}; + +#define OACC_FN_ATTRIB "oacc function" + +extern tree omp_find_clause (tree clauses, enum omp_clause_code kind); +extern bool omp_is_reference (tree decl); +extern void omp_adjust_for_condition (location_t loc, enum tree_code *cond_code, + tree *n2); +extern tree omp_get_for_step_from_incr (location_t loc, tree incr); +extern void omp_extract_for_data (gomp_for *for_stmt, struct omp_for_data *fd, + struct omp_for_data_loop *loops); +extern gimple *omp_build_barrier (tree lhs); +extern int omp_max_vf (void); +extern int omp_max_simt_vf (void); +extern tree oacc_launch_pack (unsigned code, tree device, unsigned op); +extern void oacc_replace_fn_attrib (tree fn, tree dims); +extern void oacc_set_fn_attrib (tree fn, tree clauses, bool is_kernel, + vec *args); +extern tree oacc_build_routine_dims (tree clauses); +extern tree oacc_get_fn_attrib (tree fn); +extern bool oacc_fn_attrib_kernels_p (tree attr); +extern int oacc_get_fn_dim_size (tree fn, int axis); +extern int oacc_get_ifn_dim_arg (const gimple *stmt); + +#endif /* GCC_OMP_GENERAL_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/omp-grid.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/omp-grid.h new file mode 100644 index 0000000..349bda4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/omp-grid.h @@ -0,0 +1,27 @@ +/* Lowering and expansion of OpenMP directives for HSA GPU agents. + + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_OMP_GRID_H +#define GCC_OMP_GRID_H + +extern tree omp_grid_lastprivate_predicate (struct omp_for_data *fd); +extern void omp_grid_gridify_all_targets (gimple_seq *body_p); + +#endif /* GCC_OMP_GRID_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/omp-low.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/omp-low.h new file mode 100644 index 0000000..0ff33f5 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/omp-low.h @@ -0,0 +1,31 @@ +/* Header file for openMP lowering directives. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_OMP_LOW_H +#define GCC_OMP_LOW_H + +extern tree omp_reduction_init_op (location_t, enum tree_code, tree); +extern tree omp_reduction_init (tree, tree); +extern tree omp_member_access_dummy_var (tree); +extern tree omp_find_combined_for (gimple_stmt_iterator *gsi_p, + bool *handled_ops_p, + struct walk_stmt_info *wi); + + +#endif /* GCC_OMP_LOW_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/omp-offload.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/omp-offload.h new file mode 100644 index 0000000..528448b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/omp-offload.h @@ -0,0 +1,30 @@ +/* Bits of OpenMP and OpenACC handling that is specific to device offloading + and a lowering pass for OpenACC device directives. + + Copyright (C) 2005-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_OMP_DEVICE_H +#define GCC_OMP_DEVICE_H + +extern GTY(()) vec *offload_funcs; +extern GTY(()) vec *offload_vars; + +extern void omp_finish_file (void); + +#endif /* GCC_OMP_DEVICE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/optabs-libfuncs.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/optabs-libfuncs.h new file mode 100644 index 0000000..a271d2d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/optabs-libfuncs.h @@ -0,0 +1,77 @@ +/* Mapping from optabs to underlying library functions + Copyright (C) 2001-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_OPTABS_LIBFUNCS_H +#define GCC_OPTABS_LIBFUNCS_H + +#include "insn-opinit.h" + +rtx convert_optab_libfunc (convert_optab, machine_mode, machine_mode); +rtx optab_libfunc (optab, machine_mode); + +void gen_int_libfunc (optab, const char *, char, machine_mode); +void gen_fp_libfunc (optab, const char *, char, machine_mode); +void gen_fixed_libfunc (optab, const char *, char, machine_mode); +void gen_signed_fixed_libfunc (optab, const char *, char, machine_mode); +void gen_unsigned_fixed_libfunc (optab, const char *, char, machine_mode); +void gen_int_fp_libfunc (optab, const char *, char, machine_mode); +void gen_intv_fp_libfunc (optab, const char *, char, machine_mode); +void gen_int_fp_fixed_libfunc (optab, const char *, char, machine_mode); +void gen_int_fp_signed_fixed_libfunc (optab, const char *, char, machine_mode); +void gen_int_fixed_libfunc (optab, const char *, char, machine_mode); +void gen_int_signed_fixed_libfunc (optab, const char *, char, machine_mode); +void gen_int_unsigned_fixed_libfunc (optab, const char *, char, machine_mode); + +void gen_interclass_conv_libfunc (convert_optab, const char *, + machine_mode, machine_mode); +void gen_int_to_fp_conv_libfunc (convert_optab, const char *, + machine_mode, machine_mode); +void gen_ufloat_conv_libfunc (convert_optab, const char *, + machine_mode, machine_mode); +void gen_int_to_fp_nondecimal_conv_libfunc (convert_optab, const char *, + machine_mode, machine_mode); +void gen_fp_to_int_conv_libfunc (convert_optab, const char *, + machine_mode, machine_mode); +void gen_intraclass_conv_libfunc (convert_optab, const char *, + machine_mode, machine_mode); +void gen_trunc_conv_libfunc (convert_optab, const char *, + machine_mode, machine_mode); +void gen_extend_conv_libfunc (convert_optab, const char *, + machine_mode, machine_mode); +void gen_fract_conv_libfunc (convert_optab, const char *, + machine_mode, machine_mode); +void gen_fractuns_conv_libfunc (convert_optab, const char *, + machine_mode, machine_mode); +void gen_satfract_conv_libfunc (convert_optab, const char *, + machine_mode, machine_mode); +void gen_satfractuns_conv_libfunc (convert_optab, const char *, + machine_mode, machine_mode); + +tree build_libfunc_function (const char *); +rtx init_one_libfunc (const char *); +rtx set_user_assembler_libfunc (const char *, const char *); + +void set_optab_libfunc (optab, machine_mode, const char *); +void set_conv_libfunc (convert_optab, machine_mode, + machine_mode, const char *); + +void init_optabs (void); +void init_sync_libfuncs (int max); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/optabs-query.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/optabs-query.h new file mode 100644 index 0000000..e85a7f1 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/optabs-query.h @@ -0,0 +1,182 @@ +/* IR-agnostic target query functions relating to optabs + Copyright (C) 2001-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_OPTABS_QUERY_H +#define GCC_OPTABS_QUERY_H + +#include "insn-opinit.h" + +/* Return the insn used to implement mode MODE of OP, or CODE_FOR_nothing + if the target does not have such an insn. */ + +inline enum insn_code +optab_handler (optab op, machine_mode mode) +{ + unsigned scode = (op << 16) | mode; + gcc_assert (op > LAST_CONV_OPTAB); + return raw_optab_handler (scode); +} + +/* Return the insn used to perform conversion OP from mode FROM_MODE + to mode TO_MODE; return CODE_FOR_nothing if the target does not have + such an insn. */ + +inline enum insn_code +convert_optab_handler (convert_optab op, machine_mode to_mode, + machine_mode from_mode) +{ + unsigned scode = (op << 16) | (from_mode << 8) | to_mode; + gcc_assert (op > unknown_optab && op <= LAST_CONV_OPTAB); + return raw_optab_handler (scode); +} + +enum insn_code convert_optab_handler (convert_optab, machine_mode, + machine_mode, optimization_type); + +/* Return the insn used to implement mode MODE of OP, or CODE_FOR_nothing + if the target does not have such an insn. */ + +inline enum insn_code +direct_optab_handler (direct_optab op, machine_mode mode) +{ + return optab_handler (op, mode); +} + +enum insn_code direct_optab_handler (convert_optab, machine_mode, + optimization_type); + +/* Return true if UNOPTAB is for a trapping-on-overflow operation. */ + +inline bool +trapv_unoptab_p (optab unoptab) +{ + return (unoptab == negv_optab + || unoptab == absv_optab); +} + +/* Return true if BINOPTAB is for a trapping-on-overflow operation. */ + +inline bool +trapv_binoptab_p (optab binoptab) +{ + return (binoptab == addv_optab + || binoptab == subv_optab + || binoptab == smulv_optab); +} + +/* Return insn code for a comparison operator with VMODE + resultin MASK_MODE, unsigned if UNS is true. */ + +static inline enum insn_code +get_vec_cmp_icode (machine_mode vmode, machine_mode mask_mode, bool uns) +{ + optab tab = uns ? vec_cmpu_optab : vec_cmp_optab; + return convert_optab_handler (tab, vmode, mask_mode); +} + +/* Return insn code for a comparison operator with VMODE + resultin MASK_MODE (only for EQ/NE). */ + +static inline enum insn_code +get_vec_cmp_eq_icode (machine_mode vmode, machine_mode mask_mode) +{ + return convert_optab_handler (vec_cmpeq_optab, vmode, mask_mode); +} + +/* Return insn code for a conditional operator with a comparison in + mode CMODE, unsigned if UNS is true, resulting in a value of mode VMODE. */ + +inline enum insn_code +get_vcond_icode (machine_mode vmode, machine_mode cmode, bool uns) +{ + enum insn_code icode = CODE_FOR_nothing; + if (uns) + icode = convert_optab_handler (vcondu_optab, vmode, cmode); + else + icode = convert_optab_handler (vcond_optab, vmode, cmode); + return icode; +} + +/* Return insn code for a conditional operator with a mask mode + MMODE resulting in a value of mode VMODE. */ + +static inline enum insn_code +get_vcond_mask_icode (machine_mode vmode, machine_mode mmode) +{ + return convert_optab_handler (vcond_mask_optab, vmode, mmode); +} + +/* Return insn code for a conditional operator with a comparison in + mode CMODE (only EQ/NE), resulting in a value of mode VMODE. */ + +static inline enum insn_code +get_vcond_eq_icode (machine_mode vmode, machine_mode cmode) +{ + return convert_optab_handler (vcondeq_optab, vmode, cmode); +} + +/* Enumerates the possible extraction_insn operations. */ +enum extraction_pattern { EP_insv, EP_extv, EP_extzv }; + +/* Describes an instruction that inserts or extracts a bitfield. */ +struct extraction_insn +{ + /* The code of the instruction. */ + enum insn_code icode; + + /* The mode that the structure operand should have. This is byte_mode + when using the legacy insv, extv and extzv patterns to access memory. */ + machine_mode struct_mode; + + /* The mode of the field to be inserted or extracted, and by extension + the mode of the insertion or extraction itself. */ + machine_mode field_mode; + + /* The mode of the field's bit position. This is only important + when the position is variable rather than constant. */ + machine_mode pos_mode; +}; + +bool get_best_reg_extraction_insn (extraction_insn *, + enum extraction_pattern, + unsigned HOST_WIDE_INT, machine_mode); +bool get_best_mem_extraction_insn (extraction_insn *, + enum extraction_pattern, + HOST_WIDE_INT, HOST_WIDE_INT, machine_mode); + +enum insn_code can_extend_p (machine_mode, machine_mode, int); +enum insn_code can_float_p (machine_mode, machine_mode, int); +enum insn_code can_fix_p (machine_mode, machine_mode, int, bool *); +bool can_conditionally_move_p (machine_mode mode); +bool can_vec_perm_p (machine_mode, bool, const unsigned char *); +enum insn_code widening_optab_handler (optab, machine_mode, machine_mode); +/* Find a widening optab even if it doesn't widen as much as we want. */ +#define find_widening_optab_handler(A,B,C,D) \ + find_widening_optab_handler_and_mode (A, B, C, D, NULL) +enum insn_code find_widening_optab_handler_and_mode (optab, machine_mode, + machine_mode, int, + machine_mode *); +int can_mult_highpart_p (machine_mode, bool); +bool can_vec_mask_load_store_p (machine_mode, machine_mode, bool); +bool can_compare_and_swap_p (machine_mode, bool); +bool can_atomic_exchange_p (machine_mode, bool); +bool can_atomic_load_p (machine_mode); +bool lshift_cheap_p (bool); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/optabs-tree.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/optabs-tree.h new file mode 100644 index 0000000..d0b27e0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/optabs-tree.h @@ -0,0 +1,45 @@ +/* Tree-based target query functions relating to optabs + Copyright (C) 2001-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_OPTABS_TREE_H +#define GCC_OPTABS_TREE_H + +#include "optabs-query.h" + +/* An extra flag to control optab_for_tree_code's behavior. This is needed to + distinguish between machines with a vector shift that takes a scalar for the + shift amount vs. machines that take a vector for the shift amount. */ +enum optab_subtype +{ + optab_default, + optab_scalar, + optab_vector +}; + +/* Return the optab used for computing the given operation on the type given by + the second argument. The third argument distinguishes between the types of + vector shifts and rotates. */ +optab optab_for_tree_code (enum tree_code, const_tree, enum optab_subtype); +bool supportable_convert_operation (enum tree_code, tree, tree, tree *, + enum tree_code *); +bool expand_vec_cmp_expr_p (tree, tree, enum tree_code); +bool expand_vec_cond_expr_p (tree, tree, enum tree_code); +void init_tree_optimization_optabs (tree); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/optabs.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/optabs.h new file mode 100644 index 0000000..b2dd31a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/optabs.h @@ -0,0 +1,351 @@ +/* Definitions for code generation pass of GNU compiler. + Copyright (C) 2001-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_OPTABS_H +#define GCC_OPTABS_H + +#include "optabs-query.h" +#include "optabs-libfuncs.h" + +/* Generate code for a widening multiply. */ +extern rtx expand_widening_mult (machine_mode, rtx, rtx, rtx, int, optab); + +/* Describes the type of an expand_operand. Each value is associated + with a create_*_operand function; see the comments above those + functions for details. */ +enum expand_operand_type { + EXPAND_FIXED, + EXPAND_OUTPUT, + EXPAND_INPUT, + EXPAND_CONVERT_TO, + EXPAND_CONVERT_FROM, + EXPAND_ADDRESS, + EXPAND_INTEGER +}; + +/* Information about an operand for instruction expansion. */ +struct expand_operand { + /* The type of operand. */ + ENUM_BITFIELD (expand_operand_type) type : 8; + + /* True if any conversion should treat VALUE as being unsigned + rather than signed. Only meaningful for certain types. */ + unsigned int unsigned_p : 1; + + /* Unused; available for future use. */ + unsigned int unused : 7; + + /* The mode passed to the convert_*_operand function. It has a + type-dependent meaning. */ + ENUM_BITFIELD (machine_mode) mode : 16; + + /* The value of the operand. */ + rtx value; +}; + +/* Initialize OP with the given fields. Initialise the other fields + to their default values. */ + +static inline void +create_expand_operand (struct expand_operand *op, + enum expand_operand_type type, + rtx value, machine_mode mode, + bool unsigned_p) +{ + op->type = type; + op->unsigned_p = unsigned_p; + op->unused = 0; + op->mode = mode; + op->value = value; +} + +/* Make OP describe an operand that must use rtx X, even if X is volatile. */ + +static inline void +create_fixed_operand (struct expand_operand *op, rtx x) +{ + create_expand_operand (op, EXPAND_FIXED, x, VOIDmode, false); +} + +/* Make OP describe an output operand that must have mode MODE. + X, if nonnull, is a suggestion for where the output should be stored. + It is OK for VALUE to be inconsistent with MODE, although it will just + be ignored in that case. */ + +static inline void +create_output_operand (struct expand_operand *op, rtx x, + machine_mode mode) +{ + create_expand_operand (op, EXPAND_OUTPUT, x, mode, false); +} + +/* Make OP describe an input operand that must have mode MODE and + value VALUE; MODE cannot be VOIDmode. The backend may request that + VALUE be copied into a different kind of rtx before being passed + as an operand. */ + +static inline void +create_input_operand (struct expand_operand *op, rtx value, + machine_mode mode) +{ + create_expand_operand (op, EXPAND_INPUT, value, mode, false); +} + +/* Like create_input_operand, except that VALUE must first be converted + to mode MODE. UNSIGNED_P says whether VALUE is unsigned. */ + +static inline void +create_convert_operand_to (struct expand_operand *op, rtx value, + machine_mode mode, bool unsigned_p) +{ + create_expand_operand (op, EXPAND_CONVERT_TO, value, mode, unsigned_p); +} + +/* Make OP describe an input operand that should have the same value + as VALUE, after any mode conversion that the backend might request. + If VALUE is a CONST_INT, it should be treated as having mode MODE. + UNSIGNED_P says whether VALUE is unsigned. */ + +static inline void +create_convert_operand_from (struct expand_operand *op, rtx value, + machine_mode mode, bool unsigned_p) +{ + create_expand_operand (op, EXPAND_CONVERT_FROM, value, mode, unsigned_p); +} + + +/* Make OP describe an input Pmode address operand. VALUE is the value + of the address, but it may need to be converted to Pmode first. */ + +static inline void +create_address_operand (struct expand_operand *op, rtx value) +{ + create_expand_operand (op, EXPAND_ADDRESS, value, Pmode, false); +} + +/* Make OP describe an input operand that has value INTVAL and that has + no inherent mode. This function should only be used for operands that + are always expand-time constants. The backend may request that INTVAL + be copied into a different kind of rtx, but it must specify the mode + of that rtx if so. */ + +static inline void +create_integer_operand (struct expand_operand *op, HOST_WIDE_INT intval) +{ + create_expand_operand (op, EXPAND_INTEGER, GEN_INT (intval), VOIDmode, false); +} + + +/* Passed to expand_simple_binop and expand_binop to say which options + to try to use if the requested operation can't be open-coded on the + requisite mode. Either OPTAB_LIB or OPTAB_LIB_WIDEN says try using + a library call. Either OPTAB_WIDEN or OPTAB_LIB_WIDEN says try + using a wider mode. OPTAB_MUST_WIDEN says try widening and don't + try anything else. */ + +enum optab_methods +{ + OPTAB_DIRECT, + OPTAB_LIB, + OPTAB_WIDEN, + OPTAB_LIB_WIDEN, + OPTAB_MUST_WIDEN +}; + +extern rtx expand_widen_pattern_expr (struct separate_ops *, rtx , rtx , rtx, + rtx, int); +extern rtx expand_ternary_op (machine_mode mode, optab ternary_optab, + rtx op0, rtx op1, rtx op2, rtx target, + int unsignedp); +extern rtx simplify_expand_binop (machine_mode mode, optab binoptab, + rtx op0, rtx op1, rtx target, int unsignedp, + enum optab_methods methods); +extern bool force_expand_binop (machine_mode, optab, rtx, rtx, rtx, int, + enum optab_methods); + +/* Generate code for a simple binary or unary operation. "Simple" in + this case means "can be unambiguously described by a (mode, code) + pair and mapped to a single optab." */ +extern rtx expand_simple_binop (machine_mode, enum rtx_code, rtx, + rtx, rtx, int, enum optab_methods); + +/* Expand a binary operation given optab and rtx operands. */ +extern rtx expand_binop (machine_mode, optab, rtx, rtx, rtx, int, + enum optab_methods); + +/* Expand a binary operation with both signed and unsigned forms. */ +extern rtx sign_expand_binop (machine_mode, optab, optab, rtx, rtx, + rtx, int, enum optab_methods); + +/* Generate code to perform an operation on one operand with two results. */ +extern int expand_twoval_unop (optab, rtx, rtx, rtx, int); + +/* Generate code to perform an operation on two operands with two results. */ +extern int expand_twoval_binop (optab, rtx, rtx, rtx, rtx, int); + +/* Generate code to perform an operation on two operands with two + results, using a library function. */ +extern bool expand_twoval_binop_libfunc (optab, rtx, rtx, rtx, rtx, + enum rtx_code); +extern rtx expand_simple_unop (machine_mode, enum rtx_code, rtx, rtx, + int); + +/* Expand a unary arithmetic operation given optab rtx operand. */ +extern rtx expand_unop (machine_mode, optab, rtx, rtx, int); + +/* Expand the absolute value operation. */ +extern rtx expand_abs_nojump (machine_mode, rtx, rtx, int); +extern rtx expand_abs (machine_mode, rtx, rtx, int, int); + +/* Expand the one's complement absolute value operation. */ +extern rtx expand_one_cmpl_abs_nojump (machine_mode, rtx, rtx); + +/* Expand the copysign operation. */ +extern rtx expand_copysign (rtx, rtx, rtx); +/* Generate an instruction with a given INSN_CODE with an output and + an input. */ +extern bool maybe_emit_unop_insn (enum insn_code, rtx, rtx, enum rtx_code); +extern void emit_unop_insn (enum insn_code, rtx, rtx, enum rtx_code); + +/* Emit code to make a call to a constant function or a library call. */ +extern void emit_libcall_block (rtx_insn *, rtx, rtx, rtx); + +/* The various uses that a comparison can have; used by can_compare_p: + jumps, conditional moves, store flag operations. */ +enum can_compare_purpose +{ + ccp_jump, + ccp_cmov, + ccp_store_flag +}; + +/* Nonzero if a compare of mode MODE can be done straightforwardly + (without splitting it into pieces). */ +extern int can_compare_p (enum rtx_code, machine_mode, + enum can_compare_purpose); +extern rtx prepare_operand (enum insn_code, rtx, int, machine_mode, + machine_mode, int); +/* Emit a pair of rtl insns to compare two rtx's and to jump + to a label if the comparison is true. */ +extern void emit_cmp_and_jump_insns (rtx, rtx, enum rtx_code, rtx, + machine_mode, int, rtx, int prob=-1); + +/* Generate code to indirectly jump to a location given in the rtx LOC. */ +extern void emit_indirect_jump (rtx); + +#include "insn-config.h" + +#ifndef GCC_INSN_CONFIG_H +#error "insn-config.h must be included before optabs.h" +#endif + +/* Emit a conditional move operation. */ +rtx emit_conditional_move (rtx, enum rtx_code, rtx, rtx, machine_mode, + rtx, rtx, machine_mode, int); + +/* Emit a conditional negate or bitwise complement operation. */ +rtx emit_conditional_neg_or_complement (rtx, rtx_code, machine_mode, rtx, + rtx, rtx); + +rtx emit_conditional_add (rtx, enum rtx_code, rtx, rtx, machine_mode, + rtx, rtx, machine_mode, int); + +/* Create but don't emit one rtl instruction to perform certain operations. + Modes must match; operands must meet the operation's predicates. + Likewise for subtraction and for just copying. */ +extern rtx_insn *gen_add2_insn (rtx, rtx); +extern rtx_insn *gen_add3_insn (rtx, rtx, rtx); +extern int have_add2_insn (rtx, rtx); +extern rtx_insn *gen_addptr3_insn (rtx, rtx, rtx); +extern int have_addptr3_insn (rtx, rtx, rtx); +extern rtx_insn *gen_sub2_insn (rtx, rtx); +extern rtx_insn *gen_sub3_insn (rtx, rtx, rtx); +extern int have_sub2_insn (rtx, rtx); + +/* Generate the body of an insn to extend Y (with mode MFROM) + into X (with mode MTO). Do zero-extension if UNSIGNEDP is nonzero. */ +extern rtx_insn *gen_extend_insn (rtx, rtx, machine_mode, machine_mode, int); + +/* Generate code for a FLOAT_EXPR. */ +extern void expand_float (rtx, rtx, int); + +/* Generate code for a FIX_EXPR. */ +extern void expand_fix (rtx, rtx, int); + +/* Generate code for a FIXED_CONVERT_EXPR. */ +extern void expand_fixed_convert (rtx, rtx, int, int); + +/* Generate code for float to integral conversion. */ +extern bool expand_sfix_optab (rtx, rtx, convert_optab); + +/* Report whether the machine description contains an insn which can + perform the operation described by CODE and MODE. */ +extern int have_insn_for (enum rtx_code, machine_mode); + +/* Generate a conditional trap instruction. */ +extern rtx_insn *gen_cond_trap (enum rtx_code, rtx, rtx, rtx); + +/* Generate code for VEC_PERM_EXPR. */ +extern rtx expand_vec_perm (machine_mode, rtx, rtx, rtx, rtx); + +/* Generate code for vector comparison. */ +extern rtx expand_vec_cmp_expr (tree, tree, rtx); + +/* Generate code for VEC_COND_EXPR. */ +extern rtx expand_vec_cond_expr (tree, tree, tree, tree, rtx); + +/* Generate code for MULT_HIGHPART_EXPR. */ +extern rtx expand_mult_highpart (machine_mode, rtx, rtx, rtx, bool); + +extern rtx expand_sync_lock_test_and_set (rtx, rtx, rtx); +extern rtx expand_atomic_test_and_set (rtx, rtx, enum memmodel); +extern rtx expand_atomic_exchange (rtx, rtx, rtx, enum memmodel); +extern bool expand_atomic_compare_and_swap (rtx *, rtx *, rtx, rtx, rtx, bool, + enum memmodel, enum memmodel); +/* Generate memory barriers. */ +extern void expand_mem_thread_fence (enum memmodel); +extern void expand_mem_signal_fence (enum memmodel); + +rtx expand_atomic_load (rtx, rtx, enum memmodel); +rtx expand_atomic_store (rtx, rtx, enum memmodel, bool); +rtx expand_atomic_fetch_op (rtx, rtx, rtx, enum rtx_code, enum memmodel, + bool); + +extern bool insn_operand_matches (enum insn_code icode, unsigned int opno, + rtx operand); +extern bool valid_multiword_target_p (rtx); +extern void create_convert_operand_from_type (struct expand_operand *op, + rtx value, tree type); +extern bool maybe_legitimize_operands (enum insn_code icode, + unsigned int opno, unsigned int nops, + struct expand_operand *ops); +extern rtx_insn *maybe_gen_insn (enum insn_code icode, unsigned int nops, + struct expand_operand *ops); +extern bool maybe_expand_insn (enum insn_code icode, unsigned int nops, + struct expand_operand *ops); +extern bool maybe_expand_jump_insn (enum insn_code icode, unsigned int nops, + struct expand_operand *ops); +extern void expand_insn (enum insn_code icode, unsigned int nops, + struct expand_operand *ops); +extern void expand_jump_insn (enum insn_code icode, unsigned int nops, + struct expand_operand *ops); + +extern enum rtx_code get_rtx_code (enum tree_code tcode, bool unsignedp); + +#endif /* GCC_OPTABS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/options.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/options.h new file mode 100644 index 0000000..cf468fb --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/options.h @@ -0,0 +1,7078 @@ +/* This file is auto-generated by opth-gen.awk. */ + +#ifndef OPTIONS_H +#define OPTIONS_H + +#include "flag-types.h" + +#include "config/mips/mips-opts.h" + +#if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) && !defined(IN_RTS) +#ifndef GENERATOR_FILE +#if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) +struct GTY(()) gcc_options +#else +struct gcc_options +#endif +{ +#endif +#ifdef GENERATOR_FILE +extern HOST_WIDE_INT frame_larger_than_size; +#else + HOST_WIDE_INT x_frame_larger_than_size; +#define frame_larger_than_size global_options.x_frame_larger_than_size +#endif +#ifdef GENERATOR_FILE +extern HOST_WIDE_INT larger_than_size; +#else + HOST_WIDE_INT x_larger_than_size; +#define larger_than_size global_options.x_larger_than_size +#endif +#ifdef GENERATOR_FILE +extern bool dump_base_name_prefixed; +#else + bool x_dump_base_name_prefixed; +#define dump_base_name_prefixed global_options.x_dump_base_name_prefixed +#endif +#ifdef GENERATOR_FILE +extern bool exit_after_options; +#else + bool x_exit_after_options; +#define exit_after_options global_options.x_exit_after_options +#endif +#ifdef GENERATOR_FILE +extern bool flag_disable_hsa; +#else + bool x_flag_disable_hsa; +#define flag_disable_hsa global_options.x_flag_disable_hsa +#endif +#ifdef GENERATOR_FILE +extern bool flag_dump_all_passed; +#else + bool x_flag_dump_all_passed; +#define flag_dump_all_passed global_options.x_flag_dump_all_passed +#endif +#ifdef GENERATOR_FILE +extern bool flag_opts_finished; +#else + bool x_flag_opts_finished; +#define flag_opts_finished global_options.x_flag_opts_finished +#endif +#ifdef GENERATOR_FILE +extern bool flag_stack_usage_info; +#else + bool x_flag_stack_usage_info; +#define flag_stack_usage_info global_options.x_flag_stack_usage_info +#endif +#ifdef GENERATOR_FILE +extern bool flag_warn_unused_result; +#else + bool x_flag_warn_unused_result; +#define flag_warn_unused_result global_options.x_flag_warn_unused_result +#endif +#ifdef GENERATOR_FILE +extern bool in_lto_p; +#else + bool x_in_lto_p; +#define in_lto_p global_options.x_in_lto_p +#endif +#ifdef GENERATOR_FILE +extern bool use_gnu_debug_info_extensions; +#else + bool x_use_gnu_debug_info_extensions; +#define use_gnu_debug_info_extensions global_options.x_use_gnu_debug_info_extensions +#endif +#ifdef GENERATOR_FILE +extern bool warn_frame_larger_than; +#else + bool x_warn_frame_larger_than; +#define warn_frame_larger_than global_options.x_warn_frame_larger_than +#endif +#ifdef GENERATOR_FILE +extern bool warn_larger_than; +#else + bool x_warn_larger_than; +#define warn_larger_than global_options.x_warn_larger_than +#endif +#ifdef GENERATOR_FILE +extern char *help_enum_printed; +#else + char * x_help_enum_printed; +#define help_enum_printed global_options.x_help_enum_printed +#endif +#ifdef GENERATOR_FILE +extern char *help_printed; +#else + char * x_help_printed; +#define help_printed global_options.x_help_printed +#endif +#ifdef GENERATOR_FILE +extern const char *main_input_basename; +#else + const char * x_main_input_basename; +#define main_input_basename global_options.x_main_input_basename +#endif +#ifdef GENERATOR_FILE +extern const char *main_input_filename; +#else + const char * x_main_input_filename; +#define main_input_filename global_options.x_main_input_filename +#endif +#ifdef GENERATOR_FILE +extern enum debug_info_levels debug_info_level; +#else + enum debug_info_levels x_debug_info_level; +#define debug_info_level global_options.x_debug_info_level +#endif +#ifdef GENERATOR_FILE +extern enum debug_info_type write_symbols; +#else + enum debug_info_type x_write_symbols; +#define write_symbols global_options.x_write_symbols +#endif +#ifdef GENERATOR_FILE +extern enum debug_struct_file debug_struct_generic[DINFO_USAGE_NUM_ENUMS]; +#else + enum debug_struct_file x_debug_struct_generic[DINFO_USAGE_NUM_ENUMS]; +#define debug_struct_generic global_options.x_debug_struct_generic +#endif +#ifdef GENERATOR_FILE +extern enum debug_struct_file debug_struct_ordinary[DINFO_USAGE_NUM_ENUMS]; +#else + enum debug_struct_file x_debug_struct_ordinary[DINFO_USAGE_NUM_ENUMS]; +#define debug_struct_ordinary global_options.x_debug_struct_ordinary +#endif +#ifdef GENERATOR_FILE +extern enum dwarf_gnat_encodings gnat_encodings; +#else + enum dwarf_gnat_encodings x_gnat_encodings; +#define gnat_encodings global_options.x_gnat_encodings +#endif +#ifdef GENERATOR_FILE +extern enum stack_check_type flag_stack_check; +#else + enum stack_check_type x_flag_stack_check; +#define flag_stack_check global_options.x_flag_stack_check +#endif +#ifdef GENERATOR_FILE +extern int *param_values; +#else + int * x_param_values; +#define param_values global_options.x_param_values +#endif +#ifdef GENERATOR_FILE +extern int flag_complex_method; +#else + int x_flag_complex_method; +#define flag_complex_method global_options.x_flag_complex_method +#endif +#ifdef GENERATOR_FILE +extern int flag_debug_asm; +#else + int x_flag_debug_asm; +#define flag_debug_asm global_options.x_flag_debug_asm +#endif +#ifdef GENERATOR_FILE +extern int flag_dump_rtl_in_asm; +#else + int x_flag_dump_rtl_in_asm; +#define flag_dump_rtl_in_asm global_options.x_flag_dump_rtl_in_asm +#endif +#ifdef GENERATOR_FILE +extern int flag_gen_aux_info; +#else + int x_flag_gen_aux_info; +#define flag_gen_aux_info global_options.x_flag_gen_aux_info +#endif +#ifdef GENERATOR_FILE +extern int flag_generate_lto; +#else + int x_flag_generate_lto; +#define flag_generate_lto global_options.x_flag_generate_lto +#endif +#ifdef GENERATOR_FILE +extern int flag_generate_offload; +#else + int x_flag_generate_offload; +#define flag_generate_offload global_options.x_flag_generate_offload +#endif +#ifdef GENERATOR_FILE +extern int flag_incremental_link; +#else + int x_flag_incremental_link; +#define flag_incremental_link global_options.x_flag_incremental_link +#endif +#ifdef GENERATOR_FILE +extern int flag_print_asm_name; +#else + int x_flag_print_asm_name; +#define flag_print_asm_name global_options.x_flag_print_asm_name +#endif +#ifdef GENERATOR_FILE +extern int flag_shlib; +#else + int x_flag_shlib; +#define flag_shlib global_options.x_flag_shlib +#endif +#ifdef GENERATOR_FILE +extern int main_input_baselength; +#else + int x_main_input_baselength; +#define main_input_baselength global_options.x_main_input_baselength +#endif +#ifdef GENERATOR_FILE +extern int optimize; +#else + int x_optimize; +#define optimize global_options.x_optimize +#endif +#ifdef GENERATOR_FILE +extern int optimize_debug; +#else + int x_optimize_debug; +#define optimize_debug global_options.x_optimize_debug +#endif +#ifdef GENERATOR_FILE +extern int optimize_fast; +#else + int x_optimize_fast; +#define optimize_fast global_options.x_optimize_fast +#endif +#ifdef GENERATOR_FILE +extern int optimize_size; +#else + int x_optimize_size; +#define optimize_size global_options.x_optimize_size +#endif +#ifdef GENERATOR_FILE +extern int rtl_dump_and_exit; +#else + int x_rtl_dump_and_exit; +#define rtl_dump_and_exit global_options.x_rtl_dump_and_exit +#endif +#ifdef GENERATOR_FILE +extern int target_flags; +#else + int x_target_flags; +#define target_flags global_options.x_target_flags +#endif +#ifdef GENERATOR_FILE +extern unsigned int flag_sanitize; +#else + unsigned int x_flag_sanitize; +#define flag_sanitize global_options.x_flag_sanitize +#endif +#ifdef GENERATOR_FILE +extern unsigned int flag_sanitize_recover; +#else + unsigned int x_flag_sanitize_recover; +#define flag_sanitize_recover global_options.x_flag_sanitize_recover +#endif +#ifdef GENERATOR_FILE +extern unsigned int help_columns; +#else + unsigned int x_help_columns; +#define help_columns global_options.x_help_columns +#endif +#ifdef GENERATOR_FILE +extern unsigned int initial_max_fld_align; +#else + unsigned int x_initial_max_fld_align; +#define initial_max_fld_align global_options.x_initial_max_fld_align +#endif +#ifdef GENERATOR_FILE +extern void *flag_instrument_functions_exclude_files; +#else + void * x_flag_instrument_functions_exclude_files; +#define flag_instrument_functions_exclude_files global_options.x_flag_instrument_functions_exclude_files +#endif +#ifdef GENERATOR_FILE +extern void *flag_instrument_functions_exclude_functions; +#else + void * x_flag_instrument_functions_exclude_functions; +#define flag_instrument_functions_exclude_functions global_options.x_flag_instrument_functions_exclude_functions +#endif +#ifdef GENERATOR_FILE +extern int help_flag; +#else + int x_help_flag; +#define help_flag global_options.x_help_flag +#endif +#ifdef GENERATOR_FILE +extern int no_sysroot_suffix; +#else + int x_no_sysroot_suffix; +#define no_sysroot_suffix global_options.x_no_sysroot_suffix +#endif +#ifdef GENERATOR_FILE +extern int flag_preprocess_only; +#else + int x_flag_preprocess_only; +#define flag_preprocess_only global_options.x_flag_preprocess_only +#endif +#ifdef GENERATOR_FILE +extern int g_switch_value; +#else + int x_g_switch_value; +#define g_switch_value global_options.x_g_switch_value +#endif +#ifdef GENERATOR_FILE +extern int warn_abi; +#else + int x_warn_abi; +#define warn_abi global_options.x_warn_abi +#endif +#ifdef GENERATOR_FILE +extern int warn_abi_tag; +#else + int x_warn_abi_tag; +#define warn_abi_tag global_options.x_warn_abi_tag +#endif +#ifdef GENERATOR_FILE +extern int warn_address; +#else + int x_warn_address; +#define warn_address global_options.x_warn_address +#endif +#ifdef GENERATOR_FILE +extern int warn_aggregate_return; +#else + int x_warn_aggregate_return; +#define warn_aggregate_return global_options.x_warn_aggregate_return +#endif +#ifdef GENERATOR_FILE +extern int warn_aggressive_loop_optimizations; +#else + int x_warn_aggressive_loop_optimizations; +#define warn_aggressive_loop_optimizations global_options.x_warn_aggressive_loop_optimizations +#endif +#ifdef GENERATOR_FILE +extern int warn_aliasing; +#else + int x_warn_aliasing; +#define warn_aliasing global_options.x_warn_aliasing +#endif +#ifdef GENERATOR_FILE +extern int warn_align_commons; +#else + int x_warn_align_commons; +#define warn_align_commons global_options.x_warn_align_commons +#endif +#ifdef GENERATOR_FILE +extern int warn_aligned_new; +#else + int x_warn_aligned_new; +#define warn_aligned_new global_options.x_warn_aligned_new +#endif +#ifdef GENERATOR_FILE +extern const char *warn_alloc_size_limit; +#else + const char *x_warn_alloc_size_limit; +#define warn_alloc_size_limit global_options.x_warn_alloc_size_limit +#endif +#ifdef GENERATOR_FILE +extern int warn_alloc_zero; +#else + int x_warn_alloc_zero; +#define warn_alloc_zero global_options.x_warn_alloc_zero +#endif +#ifdef GENERATOR_FILE +extern int warn_alloca; +#else + int x_warn_alloca; +#define warn_alloca global_options.x_warn_alloca +#endif +#ifdef GENERATOR_FILE +extern int warn_alloca_limit; +#else + int x_warn_alloca_limit; +#define warn_alloca_limit global_options.x_warn_alloca_limit +#endif +#ifdef GENERATOR_FILE +extern int warn_ampersand; +#else + int x_warn_ampersand; +#define warn_ampersand global_options.x_warn_ampersand +#endif +#ifdef GENERATOR_FILE +extern int warn_argument_mismatch; +#else + int x_warn_argument_mismatch; +#define warn_argument_mismatch global_options.x_warn_argument_mismatch +#endif +#ifdef GENERATOR_FILE +extern int warn_array_bounds; +#else + int x_warn_array_bounds; +#define warn_array_bounds global_options.x_warn_array_bounds +#endif +#ifdef GENERATOR_FILE +extern int warn_array_temporaries; +#else + int x_warn_array_temporaries; +#define warn_array_temporaries global_options.x_warn_array_temporaries +#endif +#ifdef GENERATOR_FILE +extern int warn_assign_intercept; +#else + int x_warn_assign_intercept; +#define warn_assign_intercept global_options.x_warn_assign_intercept +#endif +#ifdef GENERATOR_FILE +extern int warn_attributes; +#else + int x_warn_attributes; +#define warn_attributes global_options.x_warn_attributes +#endif +#ifdef GENERATOR_FILE +extern int warn_bad_function_cast; +#else + int x_warn_bad_function_cast; +#define warn_bad_function_cast global_options.x_warn_bad_function_cast +#endif +#ifdef GENERATOR_FILE +extern int warn_bool_compare; +#else + int x_warn_bool_compare; +#define warn_bool_compare global_options.x_warn_bool_compare +#endif +#ifdef GENERATOR_FILE +extern int warn_bool_op; +#else + int x_warn_bool_op; +#define warn_bool_op global_options.x_warn_bool_op +#endif +#ifdef GENERATOR_FILE +extern int warn_builtin_declaraion_mismatch; +#else + int x_warn_builtin_declaraion_mismatch; +#define warn_builtin_declaraion_mismatch global_options.x_warn_builtin_declaraion_mismatch +#endif +#ifdef GENERATOR_FILE +extern int cpp_warn_builtin_macro_redefined; +#else + int x_cpp_warn_builtin_macro_redefined; +#define cpp_warn_builtin_macro_redefined global_options.x_cpp_warn_builtin_macro_redefined +#endif +#ifdef GENERATOR_FILE +extern int warn_cxx_compat; +#else + int x_warn_cxx_compat; +#define warn_cxx_compat global_options.x_warn_cxx_compat +#endif +#ifdef GENERATOR_FILE +extern int warn_cxx11_compat; +#else + int x_warn_cxx11_compat; +#define warn_cxx11_compat global_options.x_warn_cxx11_compat +#endif +#ifdef GENERATOR_FILE +extern int warn_cxx14_compat; +#else + int x_warn_cxx14_compat; +#define warn_cxx14_compat global_options.x_warn_cxx14_compat +#endif +#ifdef GENERATOR_FILE +extern int warn_cxx1z_compat; +#else + int x_warn_cxx1z_compat; +#define warn_cxx1z_compat global_options.x_warn_cxx1z_compat +#endif +#ifdef GENERATOR_FILE +extern int warn_c_binding_type; +#else + int x_warn_c_binding_type; +#define warn_c_binding_type global_options.x_warn_c_binding_type +#endif +#ifdef GENERATOR_FILE +extern int warn_c90_c99_compat; +#else + int x_warn_c90_c99_compat; +#define warn_c90_c99_compat global_options.x_warn_c90_c99_compat +#endif +#ifdef GENERATOR_FILE +extern int warn_c99_c11_compat; +#else + int x_warn_c99_c11_compat; +#define warn_c99_c11_compat global_options.x_warn_c99_c11_compat +#endif +#ifdef GENERATOR_FILE +extern int warn_cast_align; +#else + int x_warn_cast_align; +#define warn_cast_align global_options.x_warn_cast_align +#endif +#ifdef GENERATOR_FILE +extern int warn_cast_qual; +#else + int x_warn_cast_qual; +#define warn_cast_qual global_options.x_warn_cast_qual +#endif +#ifdef GENERATOR_FILE +extern int warn_char_subscripts; +#else + int x_warn_char_subscripts; +#define warn_char_subscripts global_options.x_warn_char_subscripts +#endif +#ifdef GENERATOR_FILE +extern int warn_character_truncation; +#else + int x_warn_character_truncation; +#define warn_character_truncation global_options.x_warn_character_truncation +#endif +#ifdef GENERATOR_FILE +extern int warn_chkp; +#else + int x_warn_chkp; +#define warn_chkp global_options.x_warn_chkp +#endif +#ifdef GENERATOR_FILE +extern int warn_clobbered; +#else + int x_warn_clobbered; +#define warn_clobbered global_options.x_warn_clobbered +#endif +#ifdef GENERATOR_FILE +extern int cpp_warn_comment; +#else + int x_cpp_warn_comment; +#define cpp_warn_comment global_options.x_cpp_warn_comment +#endif +#ifdef GENERATOR_FILE +extern int warn_compare_reals; +#else + int x_warn_compare_reals; +#define warn_compare_reals global_options.x_warn_compare_reals +#endif +#ifdef GENERATOR_FILE +extern int warn_conditionally_supported; +#else + int x_warn_conditionally_supported; +#define warn_conditionally_supported global_options.x_warn_conditionally_supported +#endif +#ifdef GENERATOR_FILE +extern int warn_conversion; +#else + int x_warn_conversion; +#define warn_conversion global_options.x_warn_conversion +#endif +#ifdef GENERATOR_FILE +extern int warn_conversion_extra; +#else + int x_warn_conversion_extra; +#define warn_conversion_extra global_options.x_warn_conversion_extra +#endif +#ifdef GENERATOR_FILE +extern int warn_conversion_null; +#else + int x_warn_conversion_null; +#define warn_conversion_null global_options.x_warn_conversion_null +#endif +#ifdef GENERATOR_FILE +extern int warn_coverage_mismatch; +#else + int x_warn_coverage_mismatch; +#define warn_coverage_mismatch global_options.x_warn_coverage_mismatch +#endif +#ifdef GENERATOR_FILE +extern int warn_cpp; +#else + int x_warn_cpp; +#define warn_cpp global_options.x_warn_cpp +#endif +#ifdef GENERATOR_FILE +extern int warn_ctor_dtor_privacy; +#else + int x_warn_ctor_dtor_privacy; +#define warn_ctor_dtor_privacy global_options.x_warn_ctor_dtor_privacy +#endif +#ifdef GENERATOR_FILE +extern int warn_dangling_else; +#else + int x_warn_dangling_else; +#define warn_dangling_else global_options.x_warn_dangling_else +#endif +#ifdef GENERATOR_FILE +extern int cpp_warn_date_time; +#else + int x_cpp_warn_date_time; +#define cpp_warn_date_time global_options.x_cpp_warn_date_time +#endif +#ifdef GENERATOR_FILE +extern int warn_declaration_after_statement; +#else + int x_warn_declaration_after_statement; +#define warn_declaration_after_statement global_options.x_warn_declaration_after_statement +#endif +#ifdef GENERATOR_FILE +extern int warn_delete_incomplete; +#else + int x_warn_delete_incomplete; +#define warn_delete_incomplete global_options.x_warn_delete_incomplete +#endif +#ifdef GENERATOR_FILE +extern int warn_delnonvdtor; +#else + int x_warn_delnonvdtor; +#define warn_delnonvdtor global_options.x_warn_delnonvdtor +#endif +#ifdef GENERATOR_FILE +extern int warn_deprecated; +#else + int x_warn_deprecated; +#define warn_deprecated global_options.x_warn_deprecated +#endif +#ifdef GENERATOR_FILE +extern int warn_deprecated_decl; +#else + int x_warn_deprecated_decl; +#define warn_deprecated_decl global_options.x_warn_deprecated_decl +#endif +#ifdef GENERATOR_FILE +extern int warn_designated_init; +#else + int x_warn_designated_init; +#define warn_designated_init global_options.x_warn_designated_init +#endif +#ifdef GENERATOR_FILE +extern int warn_disabled_optimization; +#else + int x_warn_disabled_optimization; +#define warn_disabled_optimization global_options.x_warn_disabled_optimization +#endif +#ifdef GENERATOR_FILE +extern int warn_discarded_array_qualifiers; +#else + int x_warn_discarded_array_qualifiers; +#define warn_discarded_array_qualifiers global_options.x_warn_discarded_array_qualifiers +#endif +#ifdef GENERATOR_FILE +extern int warn_discarded_qualifiers; +#else + int x_warn_discarded_qualifiers; +#define warn_discarded_qualifiers global_options.x_warn_discarded_qualifiers +#endif +#ifdef GENERATOR_FILE +extern int warn_div_by_zero; +#else + int x_warn_div_by_zero; +#define warn_div_by_zero global_options.x_warn_div_by_zero +#endif +#ifdef GENERATOR_FILE +extern int warn_double_promotion; +#else + int x_warn_double_promotion; +#define warn_double_promotion global_options.x_warn_double_promotion +#endif +#ifdef GENERATOR_FILE +extern int warn_duplicate_decl_specifier; +#else + int x_warn_duplicate_decl_specifier; +#define warn_duplicate_decl_specifier global_options.x_warn_duplicate_decl_specifier +#endif +#ifdef GENERATOR_FILE +extern int warn_duplicated_branches; +#else + int x_warn_duplicated_branches; +#define warn_duplicated_branches global_options.x_warn_duplicated_branches +#endif +#ifdef GENERATOR_FILE +extern int warn_duplicated_cond; +#else + int x_warn_duplicated_cond; +#define warn_duplicated_cond global_options.x_warn_duplicated_cond +#endif +#ifdef GENERATOR_FILE +extern int warn_ecpp; +#else + int x_warn_ecpp; +#define warn_ecpp global_options.x_warn_ecpp +#endif +#ifdef GENERATOR_FILE +extern int warn_empty_body; +#else + int x_warn_empty_body; +#define warn_empty_body global_options.x_warn_empty_body +#endif +#ifdef GENERATOR_FILE +extern int cpp_warn_endif_labels; +#else + int x_cpp_warn_endif_labels; +#define cpp_warn_endif_labels global_options.x_cpp_warn_endif_labels +#endif +#ifdef GENERATOR_FILE +extern int warn_enum_compare; +#else + int x_warn_enum_compare; +#define warn_enum_compare global_options.x_warn_enum_compare +#endif +#ifdef GENERATOR_FILE +extern int warnings_are_errors; +#else + int x_warnings_are_errors; +#define warnings_are_errors global_options.x_warnings_are_errors +#endif +#ifdef GENERATOR_FILE +extern int cpp_warn_expansion_to_defined; +#else + int x_cpp_warn_expansion_to_defined; +#define cpp_warn_expansion_to_defined global_options.x_cpp_warn_expansion_to_defined +#endif +#ifdef GENERATOR_FILE +extern int extra_warnings; +#else + int x_extra_warnings; +#define extra_warnings global_options.x_extra_warnings +#endif +#ifdef GENERATOR_FILE +extern int flag_fatal_errors; +#else + int x_flag_fatal_errors; +#define flag_fatal_errors global_options.x_flag_fatal_errors +#endif +#ifdef GENERATOR_FILE +extern int warn_float_conversion; +#else + int x_warn_float_conversion; +#define warn_float_conversion global_options.x_warn_float_conversion +#endif +#ifdef GENERATOR_FILE +extern int warn_float_equal; +#else + int x_warn_float_equal; +#define warn_float_equal global_options.x_warn_float_equal +#endif +#ifdef GENERATOR_FILE +extern int warn_format_contains_nul; +#else + int x_warn_format_contains_nul; +#define warn_format_contains_nul global_options.x_warn_format_contains_nul +#endif +#ifdef GENERATOR_FILE +extern int warn_format_extra_args; +#else + int x_warn_format_extra_args; +#define warn_format_extra_args global_options.x_warn_format_extra_args +#endif +#ifdef GENERATOR_FILE +extern int warn_format_nonliteral; +#else + int x_warn_format_nonliteral; +#define warn_format_nonliteral global_options.x_warn_format_nonliteral +#endif +#ifdef GENERATOR_FILE +extern int warn_format_overflow; +#else + int x_warn_format_overflow; +#define warn_format_overflow global_options.x_warn_format_overflow +#endif +#ifdef GENERATOR_FILE +extern int warn_format_security; +#else + int x_warn_format_security; +#define warn_format_security global_options.x_warn_format_security +#endif +#ifdef GENERATOR_FILE +extern int warn_format_signedness; +#else + int x_warn_format_signedness; +#define warn_format_signedness global_options.x_warn_format_signedness +#endif +#ifdef GENERATOR_FILE +extern int warn_format_trunc; +#else + int x_warn_format_trunc; +#define warn_format_trunc global_options.x_warn_format_trunc +#endif +#ifdef GENERATOR_FILE +extern int warn_format_y2k; +#else + int x_warn_format_y2k; +#define warn_format_y2k global_options.x_warn_format_y2k +#endif +#ifdef GENERATOR_FILE +extern int warn_format_zero_length; +#else + int x_warn_format_zero_length; +#define warn_format_zero_length global_options.x_warn_format_zero_length +#endif +#ifdef GENERATOR_FILE +extern int warn_format; +#else + int x_warn_format; +#define warn_format global_options.x_warn_format +#endif +#ifdef GENERATOR_FILE +extern int warn_frame_address; +#else + int x_warn_frame_address; +#define warn_frame_address global_options.x_warn_frame_address +#endif +#ifdef GENERATOR_FILE +extern int warn_free_nonheap_object; +#else + int x_warn_free_nonheap_object; +#define warn_free_nonheap_object global_options.x_warn_free_nonheap_object +#endif +#ifdef GENERATOR_FILE +extern int warn_function_elimination; +#else + int x_warn_function_elimination; +#define warn_function_elimination global_options.x_warn_function_elimination +#endif +#ifdef GENERATOR_FILE +extern int warn_hsa; +#else + int x_warn_hsa; +#define warn_hsa global_options.x_warn_hsa +#endif +#ifdef GENERATOR_FILE +extern int warn_ignored_attributes; +#else + int x_warn_ignored_attributes; +#define warn_ignored_attributes global_options.x_warn_ignored_attributes +#endif +#ifdef GENERATOR_FILE +extern int warn_ignored_qualifiers; +#else + int x_warn_ignored_qualifiers; +#define warn_ignored_qualifiers global_options.x_warn_ignored_qualifiers +#endif +#ifdef GENERATOR_FILE +extern int warn_implicit; +#else + int x_warn_implicit; +#define warn_implicit global_options.x_warn_implicit +#endif +#ifdef GENERATOR_FILE +extern int warn_implicit_fallthrough; +#else + int x_warn_implicit_fallthrough; +#define warn_implicit_fallthrough global_options.x_warn_implicit_fallthrough +#endif +#ifdef GENERATOR_FILE +extern int warn_implicit_function_declaration; +#else + int x_warn_implicit_function_declaration; +#define warn_implicit_function_declaration global_options.x_warn_implicit_function_declaration +#endif +#ifdef GENERATOR_FILE +extern int warn_implicit_int; +#else + int x_warn_implicit_int; +#define warn_implicit_int global_options.x_warn_implicit_int +#endif +#ifdef GENERATOR_FILE +extern int warn_implicit_interface; +#else + int x_warn_implicit_interface; +#define warn_implicit_interface global_options.x_warn_implicit_interface +#endif +#ifdef GENERATOR_FILE +extern int warn_implicit_procedure; +#else + int x_warn_implicit_procedure; +#define warn_implicit_procedure global_options.x_warn_implicit_procedure +#endif +#ifdef GENERATOR_FILE +extern int warn_incompatible_pointer_types; +#else + int x_warn_incompatible_pointer_types; +#define warn_incompatible_pointer_types global_options.x_warn_incompatible_pointer_types +#endif +#ifdef GENERATOR_FILE +extern int warn_inh_var_ctor; +#else + int x_warn_inh_var_ctor; +#define warn_inh_var_ctor global_options.x_warn_inh_var_ctor +#endif +#ifdef GENERATOR_FILE +extern int warn_init_self; +#else + int x_warn_init_self; +#define warn_init_self global_options.x_warn_init_self +#endif +#ifdef GENERATOR_FILE +extern int warn_inline; +#else + int x_warn_inline; +#define warn_inline global_options.x_warn_inline +#endif +#ifdef GENERATOR_FILE +extern int warn_int_conversion; +#else + int x_warn_int_conversion; +#define warn_int_conversion global_options.x_warn_int_conversion +#endif +#ifdef GENERATOR_FILE +extern int warn_int_in_bool_context; +#else + int x_warn_int_in_bool_context; +#define warn_int_in_bool_context global_options.x_warn_int_in_bool_context +#endif +#ifdef GENERATOR_FILE +extern int warn_int_to_pointer_cast; +#else + int x_warn_int_to_pointer_cast; +#define warn_int_to_pointer_cast global_options.x_warn_int_to_pointer_cast +#endif +#ifdef GENERATOR_FILE +extern int warn_integer_division; +#else + int x_warn_integer_division; +#define warn_integer_division global_options.x_warn_integer_division +#endif +#ifdef GENERATOR_FILE +extern int warn_intrinsic_shadow; +#else + int x_warn_intrinsic_shadow; +#define warn_intrinsic_shadow global_options.x_warn_intrinsic_shadow +#endif +#ifdef GENERATOR_FILE +extern int warn_intrinsics_std; +#else + int x_warn_intrinsics_std; +#define warn_intrinsics_std global_options.x_warn_intrinsics_std +#endif +#ifdef GENERATOR_FILE +extern int warn_invalid_memory_model; +#else + int x_warn_invalid_memory_model; +#define warn_invalid_memory_model global_options.x_warn_invalid_memory_model +#endif +#ifdef GENERATOR_FILE +extern int warn_invalid_offsetof; +#else + int x_warn_invalid_offsetof; +#define warn_invalid_offsetof global_options.x_warn_invalid_offsetof +#endif +#ifdef GENERATOR_FILE +extern int cpp_warn_invalid_pch; +#else + int x_cpp_warn_invalid_pch; +#define cpp_warn_invalid_pch global_options.x_cpp_warn_invalid_pch +#endif +#ifdef GENERATOR_FILE +extern int warn_jump_misses_init; +#else + int x_warn_jump_misses_init; +#define warn_jump_misses_init global_options.x_warn_jump_misses_init +#endif +#ifdef GENERATOR_FILE +extern int warn_line_truncation; +#else + int x_warn_line_truncation; +#define warn_line_truncation global_options.x_warn_line_truncation +#endif +#ifdef GENERATOR_FILE +extern int cpp_warn_literal_suffix; +#else + int x_cpp_warn_literal_suffix; +#define cpp_warn_literal_suffix global_options.x_cpp_warn_literal_suffix +#endif +#ifdef GENERATOR_FILE +extern int warn_logical_not_paren; +#else + int x_warn_logical_not_paren; +#define warn_logical_not_paren global_options.x_warn_logical_not_paren +#endif +#ifdef GENERATOR_FILE +extern int warn_logical_op; +#else + int x_warn_logical_op; +#define warn_logical_op global_options.x_warn_logical_op +#endif +#ifdef GENERATOR_FILE +extern int warn_long_long; +#else + int x_warn_long_long; +#define warn_long_long global_options.x_warn_long_long +#endif +#ifdef GENERATOR_FILE +extern int warn_lto_type_mismatch; +#else + int x_warn_lto_type_mismatch; +#define warn_lto_type_mismatch global_options.x_warn_lto_type_mismatch +#endif +#ifdef GENERATOR_FILE +extern int warn_main; +#else + int x_warn_main; +#define warn_main global_options.x_warn_main +#endif +#ifdef GENERATOR_FILE +extern int warn_maybe_uninitialized; +#else + int x_warn_maybe_uninitialized; +#define warn_maybe_uninitialized global_options.x_warn_maybe_uninitialized +#endif +#ifdef GENERATOR_FILE +extern int warn_memset_elt_size; +#else + int x_warn_memset_elt_size; +#define warn_memset_elt_size global_options.x_warn_memset_elt_size +#endif +#ifdef GENERATOR_FILE +extern int warn_memset_transposed_args; +#else + int x_warn_memset_transposed_args; +#define warn_memset_transposed_args global_options.x_warn_memset_transposed_args +#endif +#ifdef GENERATOR_FILE +extern int warn_misleading_indentation; +#else + int x_warn_misleading_indentation; +#define warn_misleading_indentation global_options.x_warn_misleading_indentation +#endif +#ifdef GENERATOR_FILE +extern int warn_missing_braces; +#else + int x_warn_missing_braces; +#define warn_missing_braces global_options.x_warn_missing_braces +#endif +#ifdef GENERATOR_FILE +extern int warn_missing_declarations; +#else + int x_warn_missing_declarations; +#define warn_missing_declarations global_options.x_warn_missing_declarations +#endif +#ifdef GENERATOR_FILE +extern int warn_missing_field_initializers; +#else + int x_warn_missing_field_initializers; +#define warn_missing_field_initializers global_options.x_warn_missing_field_initializers +#endif +#ifdef GENERATOR_FILE +extern int cpp_warn_missing_include_dirs; +#else + int x_cpp_warn_missing_include_dirs; +#define cpp_warn_missing_include_dirs global_options.x_cpp_warn_missing_include_dirs +#endif +#ifdef GENERATOR_FILE +extern int warn_missing_parameter_type; +#else + int x_warn_missing_parameter_type; +#define warn_missing_parameter_type global_options.x_warn_missing_parameter_type +#endif +#ifdef GENERATOR_FILE +extern int warn_missing_prototypes; +#else + int x_warn_missing_prototypes; +#define warn_missing_prototypes global_options.x_warn_missing_prototypes +#endif +#ifdef GENERATOR_FILE +extern int cpp_warn_multichar; +#else + int x_cpp_warn_multichar; +#define cpp_warn_multichar global_options.x_cpp_warn_multichar +#endif +#ifdef GENERATOR_FILE +extern int warn_multiple_inheritance; +#else + int x_warn_multiple_inheritance; +#define warn_multiple_inheritance global_options.x_warn_multiple_inheritance +#endif +#ifdef GENERATOR_FILE +extern int warn_namespaces; +#else + int x_warn_namespaces; +#define warn_namespaces global_options.x_warn_namespaces +#endif +#ifdef GENERATOR_FILE +extern int warn_narrowing; +#else + int x_warn_narrowing; +#define warn_narrowing global_options.x_warn_narrowing +#endif +#ifdef GENERATOR_FILE +extern int warn_nested_externs; +#else + int x_warn_nested_externs; +#define warn_nested_externs global_options.x_warn_nested_externs +#endif +#ifdef GENERATOR_FILE +extern int warn_noexcept; +#else + int x_warn_noexcept; +#define warn_noexcept global_options.x_warn_noexcept +#endif +#ifdef GENERATOR_FILE +extern int warn_noexcept_type; +#else + int x_warn_noexcept_type; +#define warn_noexcept_type global_options.x_warn_noexcept_type +#endif +#ifdef GENERATOR_FILE +extern int warn_nontemplate_friend; +#else + int x_warn_nontemplate_friend; +#define warn_nontemplate_friend global_options.x_warn_nontemplate_friend +#endif +#ifdef GENERATOR_FILE +extern int warn_nonvdtor; +#else + int x_warn_nonvdtor; +#define warn_nonvdtor global_options.x_warn_nonvdtor +#endif +#ifdef GENERATOR_FILE +extern int warn_nonnull; +#else + int x_warn_nonnull; +#define warn_nonnull global_options.x_warn_nonnull +#endif +#ifdef GENERATOR_FILE +extern int warn_nonnull_compare; +#else + int x_warn_nonnull_compare; +#define warn_nonnull_compare global_options.x_warn_nonnull_compare +#endif +#ifdef GENERATOR_FILE +extern int cpp_warn_normalize; +#else + int x_cpp_warn_normalize; +#define cpp_warn_normalize global_options.x_cpp_warn_normalize +#endif +#ifdef GENERATOR_FILE +extern int warn_null_dereference; +#else + int x_warn_null_dereference; +#define warn_null_dereference global_options.x_warn_null_dereference +#endif +#ifdef GENERATOR_FILE +extern int warn_odr_violations; +#else + int x_warn_odr_violations; +#define warn_odr_violations global_options.x_warn_odr_violations +#endif +#ifdef GENERATOR_FILE +extern int warn_old_style_cast; +#else + int x_warn_old_style_cast; +#define warn_old_style_cast global_options.x_warn_old_style_cast +#endif +#ifdef GENERATOR_FILE +extern int warn_old_style_declaration; +#else + int x_warn_old_style_declaration; +#define warn_old_style_declaration global_options.x_warn_old_style_declaration +#endif +#ifdef GENERATOR_FILE +extern int warn_old_style_definition; +#else + int x_warn_old_style_definition; +#define warn_old_style_definition global_options.x_warn_old_style_definition +#endif +#ifdef GENERATOR_FILE +extern int warn_openmp_simd; +#else + int x_warn_openmp_simd; +#define warn_openmp_simd global_options.x_warn_openmp_simd +#endif +#ifdef GENERATOR_FILE +extern int warn_overflow; +#else + int x_warn_overflow; +#define warn_overflow global_options.x_warn_overflow +#endif +#ifdef GENERATOR_FILE +extern int warn_overlength_strings; +#else + int x_warn_overlength_strings; +#define warn_overlength_strings global_options.x_warn_overlength_strings +#endif +#ifdef GENERATOR_FILE +extern int warn_overloaded_virtual; +#else + int x_warn_overloaded_virtual; +#define warn_overloaded_virtual global_options.x_warn_overloaded_virtual +#endif +#ifdef GENERATOR_FILE +extern int warn_override_init; +#else + int x_warn_override_init; +#define warn_override_init global_options.x_warn_override_init +#endif +#ifdef GENERATOR_FILE +extern int warn_override_init_side_effects; +#else + int x_warn_override_init_side_effects; +#define warn_override_init_side_effects global_options.x_warn_override_init_side_effects +#endif +#ifdef GENERATOR_FILE +extern int warn_packed; +#else + int x_warn_packed; +#define warn_packed global_options.x_warn_packed +#endif +#ifdef GENERATOR_FILE +extern int warn_packed_bitfield_compat; +#else + int x_warn_packed_bitfield_compat; +#define warn_packed_bitfield_compat global_options.x_warn_packed_bitfield_compat +#endif +#ifdef GENERATOR_FILE +extern int warn_padded; +#else + int x_warn_padded; +#define warn_padded global_options.x_warn_padded +#endif +#ifdef GENERATOR_FILE +extern int warn_parentheses; +#else + int x_warn_parentheses; +#define warn_parentheses global_options.x_warn_parentheses +#endif +#ifdef GENERATOR_FILE +extern int pedantic; +#else + int x_pedantic; +#define pedantic global_options.x_pedantic +#endif +#ifdef GENERATOR_FILE +extern int warn_placement_new; +#else + int x_warn_placement_new; +#define warn_placement_new global_options.x_warn_placement_new +#endif +#ifdef GENERATOR_FILE +extern int warn_pmf2ptr; +#else + int x_warn_pmf2ptr; +#define warn_pmf2ptr global_options.x_warn_pmf2ptr +#endif +#ifdef GENERATOR_FILE +extern int warn_pointer_arith; +#else + int x_warn_pointer_arith; +#define warn_pointer_arith global_options.x_warn_pointer_arith +#endif +#ifdef GENERATOR_FILE +extern int warn_pointer_compare; +#else + int x_warn_pointer_compare; +#define warn_pointer_compare global_options.x_warn_pointer_compare +#endif +#ifdef GENERATOR_FILE +extern int warn_pointer_sign; +#else + int x_warn_pointer_sign; +#define warn_pointer_sign global_options.x_warn_pointer_sign +#endif +#ifdef GENERATOR_FILE +extern int warn_pointer_to_int_cast; +#else + int x_warn_pointer_to_int_cast; +#define warn_pointer_to_int_cast global_options.x_warn_pointer_to_int_cast +#endif +#ifdef GENERATOR_FILE +extern int warn_pragmas; +#else + int x_warn_pragmas; +#define warn_pragmas global_options.x_warn_pragmas +#endif +#ifdef GENERATOR_FILE +extern int warn_property_assign_default; +#else + int x_warn_property_assign_default; +#define warn_property_assign_default global_options.x_warn_property_assign_default +#endif +#ifdef GENERATOR_FILE +extern int warn_protocol; +#else + int x_warn_protocol; +#define warn_protocol global_options.x_warn_protocol +#endif +#ifdef GENERATOR_FILE +extern int warn_psabi; +#else + int x_warn_psabi; +#define warn_psabi global_options.x_warn_psabi +#endif +#ifdef GENERATOR_FILE +extern int warn_real_q_constant; +#else + int x_warn_real_q_constant; +#define warn_real_q_constant global_options.x_warn_real_q_constant +#endif +#ifdef GENERATOR_FILE +extern int warn_realloc_lhs; +#else + int x_warn_realloc_lhs; +#define warn_realloc_lhs global_options.x_warn_realloc_lhs +#endif +#ifdef GENERATOR_FILE +extern int warn_realloc_lhs_all; +#else + int x_warn_realloc_lhs_all; +#define warn_realloc_lhs_all global_options.x_warn_realloc_lhs_all +#endif +#ifdef GENERATOR_FILE +extern int warn_redundant_decls; +#else + int x_warn_redundant_decls; +#define warn_redundant_decls global_options.x_warn_redundant_decls +#endif +#ifdef GENERATOR_FILE +extern int warn_register; +#else + int x_warn_register; +#define warn_register global_options.x_warn_register +#endif +#ifdef GENERATOR_FILE +extern int warn_reorder; +#else + int x_warn_reorder; +#define warn_reorder global_options.x_warn_reorder +#endif +#ifdef GENERATOR_FILE +extern int warn_restrict; +#else + int x_warn_restrict; +#define warn_restrict global_options.x_warn_restrict +#endif +#ifdef GENERATOR_FILE +extern int warn_return_local_addr; +#else + int x_warn_return_local_addr; +#define warn_return_local_addr global_options.x_warn_return_local_addr +#endif +#ifdef GENERATOR_FILE +extern int warn_return_type; +#else + int x_warn_return_type; +#define warn_return_type global_options.x_warn_return_type +#endif +#ifdef GENERATOR_FILE +extern int warn_selector; +#else + int x_warn_selector; +#define warn_selector global_options.x_warn_selector +#endif +#ifdef GENERATOR_FILE +extern int warn_sequence_point; +#else + int x_warn_sequence_point; +#define warn_sequence_point global_options.x_warn_sequence_point +#endif +#ifdef GENERATOR_FILE +extern int warn_shadow; +#else + int x_warn_shadow; +#define warn_shadow global_options.x_warn_shadow +#endif +#ifdef GENERATOR_FILE +extern int warn_shadow_ivar; +#else + int x_warn_shadow_ivar; +#define warn_shadow_ivar global_options.x_warn_shadow_ivar +#endif +#ifdef GENERATOR_FILE +extern int warn_shadow_compatible_local; +#else + int x_warn_shadow_compatible_local; +#define warn_shadow_compatible_local global_options.x_warn_shadow_compatible_local +#endif +#ifdef GENERATOR_FILE +extern int warn_shadow_local; +#else + int x_warn_shadow_local; +#define warn_shadow_local global_options.x_warn_shadow_local +#endif +#ifdef GENERATOR_FILE +extern int warn_shift_count_negative; +#else + int x_warn_shift_count_negative; +#define warn_shift_count_negative global_options.x_warn_shift_count_negative +#endif +#ifdef GENERATOR_FILE +extern int warn_shift_count_overflow; +#else + int x_warn_shift_count_overflow; +#define warn_shift_count_overflow global_options.x_warn_shift_count_overflow +#endif +#ifdef GENERATOR_FILE +extern int warn_shift_negative_value; +#else + int x_warn_shift_negative_value; +#define warn_shift_negative_value global_options.x_warn_shift_negative_value +#endif +#ifdef GENERATOR_FILE +extern int warn_shift_overflow; +#else + int x_warn_shift_overflow; +#define warn_shift_overflow global_options.x_warn_shift_overflow +#endif +#ifdef GENERATOR_FILE +extern int warn_sign_compare; +#else + int x_warn_sign_compare; +#define warn_sign_compare global_options.x_warn_sign_compare +#endif +#ifdef GENERATOR_FILE +extern int warn_sign_conversion; +#else + int x_warn_sign_conversion; +#define warn_sign_conversion global_options.x_warn_sign_conversion +#endif +#ifdef GENERATOR_FILE +extern int warn_sign_promo; +#else + int x_warn_sign_promo; +#define warn_sign_promo global_options.x_warn_sign_promo +#endif +#ifdef GENERATOR_FILE +extern int warn_sized_deallocation; +#else + int x_warn_sized_deallocation; +#define warn_sized_deallocation global_options.x_warn_sized_deallocation +#endif +#ifdef GENERATOR_FILE +extern int warn_sizeof_array_argument; +#else + int x_warn_sizeof_array_argument; +#define warn_sizeof_array_argument global_options.x_warn_sizeof_array_argument +#endif +#ifdef GENERATOR_FILE +extern int warn_sizeof_pointer_memaccess; +#else + int x_warn_sizeof_pointer_memaccess; +#define warn_sizeof_pointer_memaccess global_options.x_warn_sizeof_pointer_memaccess +#endif +#ifdef GENERATOR_FILE +extern int warn_stack_protect; +#else + int x_warn_stack_protect; +#define warn_stack_protect global_options.x_warn_stack_protect +#endif +#ifdef GENERATOR_FILE +extern int warn_stack_usage; +#else + int x_warn_stack_usage; +#define warn_stack_usage global_options.x_warn_stack_usage +#endif +#ifdef GENERATOR_FILE +extern int warn_strict_aliasing; +#else + int x_warn_strict_aliasing; +#define warn_strict_aliasing global_options.x_warn_strict_aliasing +#endif +#ifdef GENERATOR_FILE +extern int warn_strict_null_sentinel; +#else + int x_warn_strict_null_sentinel; +#define warn_strict_null_sentinel global_options.x_warn_strict_null_sentinel +#endif +#ifdef GENERATOR_FILE +extern int warn_strict_overflow; +#else + int x_warn_strict_overflow; +#define warn_strict_overflow global_options.x_warn_strict_overflow +#endif +#ifdef GENERATOR_FILE +extern int warn_strict_prototypes; +#else + int x_warn_strict_prototypes; +#define warn_strict_prototypes global_options.x_warn_strict_prototypes +#endif +#ifdef GENERATOR_FILE +extern int warn_strict_selector_match; +#else + int x_warn_strict_selector_match; +#define warn_strict_selector_match global_options.x_warn_strict_selector_match +#endif +#ifdef GENERATOR_FILE +extern int warn_stringop_overflow; +#else + int x_warn_stringop_overflow; +#define warn_stringop_overflow global_options.x_warn_stringop_overflow +#endif +#ifdef GENERATOR_FILE +extern int warn_subobject_linkage; +#else + int x_warn_subobject_linkage; +#define warn_subobject_linkage global_options.x_warn_subobject_linkage +#endif +#ifdef GENERATOR_FILE +extern int warn_suggest_attribute_const; +#else + int x_warn_suggest_attribute_const; +#define warn_suggest_attribute_const global_options.x_warn_suggest_attribute_const +#endif +#ifdef GENERATOR_FILE +extern int warn_suggest_attribute_format; +#else + int x_warn_suggest_attribute_format; +#define warn_suggest_attribute_format global_options.x_warn_suggest_attribute_format +#endif +#ifdef GENERATOR_FILE +extern int warn_suggest_attribute_noreturn; +#else + int x_warn_suggest_attribute_noreturn; +#define warn_suggest_attribute_noreturn global_options.x_warn_suggest_attribute_noreturn +#endif +#ifdef GENERATOR_FILE +extern int warn_suggest_attribute_pure; +#else + int x_warn_suggest_attribute_pure; +#define warn_suggest_attribute_pure global_options.x_warn_suggest_attribute_pure +#endif +#ifdef GENERATOR_FILE +extern int warn_suggest_final_methods; +#else + int x_warn_suggest_final_methods; +#define warn_suggest_final_methods global_options.x_warn_suggest_final_methods +#endif +#ifdef GENERATOR_FILE +extern int warn_suggest_final_types; +#else + int x_warn_suggest_final_types; +#define warn_suggest_final_types global_options.x_warn_suggest_final_types +#endif +#ifdef GENERATOR_FILE +extern int warn_override; +#else + int x_warn_override; +#define warn_override global_options.x_warn_override +#endif +#ifdef GENERATOR_FILE +extern int warn_surprising; +#else + int x_warn_surprising; +#define warn_surprising global_options.x_warn_surprising +#endif +#ifdef GENERATOR_FILE +extern int warn_switch; +#else + int x_warn_switch; +#define warn_switch global_options.x_warn_switch +#endif +#ifdef GENERATOR_FILE +extern int warn_switch_bool; +#else + int x_warn_switch_bool; +#define warn_switch_bool global_options.x_warn_switch_bool +#endif +#ifdef GENERATOR_FILE +extern int warn_switch_default; +#else + int x_warn_switch_default; +#define warn_switch_default global_options.x_warn_switch_default +#endif +#ifdef GENERATOR_FILE +extern int warn_switch_enum; +#else + int x_warn_switch_enum; +#define warn_switch_enum global_options.x_warn_switch_enum +#endif +#ifdef GENERATOR_FILE +extern int warn_switch_unreachable; +#else + int x_warn_switch_unreachable; +#define warn_switch_unreachable global_options.x_warn_switch_unreachable +#endif +#ifdef GENERATOR_FILE +extern int warn_sync_nand; +#else + int x_warn_sync_nand; +#define warn_sync_nand global_options.x_warn_sync_nand +#endif +#ifdef GENERATOR_FILE +extern int warn_synth; +#else + int x_warn_synth; +#define warn_synth global_options.x_warn_synth +#endif +#ifdef GENERATOR_FILE +extern int warn_system_headers; +#else + int x_warn_system_headers; +#define warn_system_headers global_options.x_warn_system_headers +#endif +#ifdef GENERATOR_FILE +extern int warn_tabs; +#else + int x_warn_tabs; +#define warn_tabs global_options.x_warn_tabs +#endif +#ifdef GENERATOR_FILE +extern int warn_target_lifetime; +#else + int x_warn_target_lifetime; +#define warn_target_lifetime global_options.x_warn_target_lifetime +#endif +#ifdef GENERATOR_FILE +extern int warn_tautological_compare; +#else + int x_warn_tautological_compare; +#define warn_tautological_compare global_options.x_warn_tautological_compare +#endif +#ifdef GENERATOR_FILE +extern int warn_templates; +#else + int x_warn_templates; +#define warn_templates global_options.x_warn_templates +#endif +#ifdef GENERATOR_FILE +extern int warn_terminate; +#else + int x_warn_terminate; +#define warn_terminate global_options.x_warn_terminate +#endif +#ifdef GENERATOR_FILE +extern int warn_traditional; +#else + int x_warn_traditional; +#define warn_traditional global_options.x_warn_traditional +#endif +#ifdef GENERATOR_FILE +extern int warn_traditional_conversion; +#else + int x_warn_traditional_conversion; +#define warn_traditional_conversion global_options.x_warn_traditional_conversion +#endif +#ifdef GENERATOR_FILE +extern int warn_trampolines; +#else + int x_warn_trampolines; +#define warn_trampolines global_options.x_warn_trampolines +#endif +#ifdef GENERATOR_FILE +extern int cpp_warn_trigraphs; +#else + int x_cpp_warn_trigraphs; +#define cpp_warn_trigraphs global_options.x_cpp_warn_trigraphs +#endif +#ifdef GENERATOR_FILE +extern int warn_type_limits; +#else + int x_warn_type_limits; +#define warn_type_limits global_options.x_warn_type_limits +#endif +#ifdef GENERATOR_FILE +extern int warn_undeclared_selector; +#else + int x_warn_undeclared_selector; +#define warn_undeclared_selector global_options.x_warn_undeclared_selector +#endif +#ifdef GENERATOR_FILE +extern int cpp_warn_undef; +#else + int x_cpp_warn_undef; +#define cpp_warn_undef global_options.x_cpp_warn_undef +#endif +#ifdef GENERATOR_FILE +extern int warn_undefined_do_loop; +#else + int x_warn_undefined_do_loop; +#define warn_undefined_do_loop global_options.x_warn_undefined_do_loop +#endif +#ifdef GENERATOR_FILE +extern int warn_underflow; +#else + int x_warn_underflow; +#define warn_underflow global_options.x_warn_underflow +#endif +#ifdef GENERATOR_FILE +extern int warn_uninitialized; +#else + int x_warn_uninitialized; +#define warn_uninitialized global_options.x_warn_uninitialized +#endif +#ifdef GENERATOR_FILE +extern int warn_unknown_pragmas; +#else + int x_warn_unknown_pragmas; +#define warn_unknown_pragmas global_options.x_warn_unknown_pragmas +#endif +#ifdef GENERATOR_FILE +extern int warn_unsafe_loop_optimizations; +#else + int x_warn_unsafe_loop_optimizations; +#define warn_unsafe_loop_optimizations global_options.x_warn_unsafe_loop_optimizations +#endif +#ifdef GENERATOR_FILE +extern int warn_unsuffixed_float_constants; +#else + int x_warn_unsuffixed_float_constants; +#define warn_unsuffixed_float_constants global_options.x_warn_unsuffixed_float_constants +#endif +#ifdef GENERATOR_FILE +extern int warn_unused; +#else + int x_warn_unused; +#define warn_unused global_options.x_warn_unused +#endif +#ifdef GENERATOR_FILE +extern int warn_unused_but_set_parameter; +#else + int x_warn_unused_but_set_parameter; +#define warn_unused_but_set_parameter global_options.x_warn_unused_but_set_parameter +#endif +#ifdef GENERATOR_FILE +extern int warn_unused_but_set_variable; +#else + int x_warn_unused_but_set_variable; +#define warn_unused_but_set_variable global_options.x_warn_unused_but_set_variable +#endif +#ifdef GENERATOR_FILE +extern int warn_unused_const_variable; +#else + int x_warn_unused_const_variable; +#define warn_unused_const_variable global_options.x_warn_unused_const_variable +#endif +#ifdef GENERATOR_FILE +extern int warn_unused_dummy_argument; +#else + int x_warn_unused_dummy_argument; +#define warn_unused_dummy_argument global_options.x_warn_unused_dummy_argument +#endif +#ifdef GENERATOR_FILE +extern int warn_unused_function; +#else + int x_warn_unused_function; +#define warn_unused_function global_options.x_warn_unused_function +#endif +#ifdef GENERATOR_FILE +extern int warn_unused_label; +#else + int x_warn_unused_label; +#define warn_unused_label global_options.x_warn_unused_label +#endif +#ifdef GENERATOR_FILE +extern int warn_unused_local_typedefs; +#else + int x_warn_unused_local_typedefs; +#define warn_unused_local_typedefs global_options.x_warn_unused_local_typedefs +#endif +#ifdef GENERATOR_FILE +extern int cpp_warn_unused_macros; +#else + int x_cpp_warn_unused_macros; +#define cpp_warn_unused_macros global_options.x_cpp_warn_unused_macros +#endif +#ifdef GENERATOR_FILE +extern int warn_unused_parameter; +#else + int x_warn_unused_parameter; +#define warn_unused_parameter global_options.x_warn_unused_parameter +#endif +#ifdef GENERATOR_FILE +extern int warn_unused_result; +#else + int x_warn_unused_result; +#define warn_unused_result global_options.x_warn_unused_result +#endif +#ifdef GENERATOR_FILE +extern int warn_unused_value; +#else + int x_warn_unused_value; +#define warn_unused_value global_options.x_warn_unused_value +#endif +#ifdef GENERATOR_FILE +extern int warn_unused_variable; +#else + int x_warn_unused_variable; +#define warn_unused_variable global_options.x_warn_unused_variable +#endif +#ifdef GENERATOR_FILE +extern int warn_use_without_only; +#else + int x_warn_use_without_only; +#define warn_use_without_only global_options.x_warn_use_without_only +#endif +#ifdef GENERATOR_FILE +extern int warn_useless_cast; +#else + int x_warn_useless_cast; +#define warn_useless_cast global_options.x_warn_useless_cast +#endif +#ifdef GENERATOR_FILE +extern int warn_varargs; +#else + int x_warn_varargs; +#define warn_varargs global_options.x_warn_varargs +#endif +#ifdef GENERATOR_FILE +extern int cpp_warn_variadic_macros; +#else + int x_cpp_warn_variadic_macros; +#define cpp_warn_variadic_macros global_options.x_cpp_warn_variadic_macros +#endif +#ifdef GENERATOR_FILE +extern int warn_vector_operation_performance; +#else + int x_warn_vector_operation_performance; +#define warn_vector_operation_performance global_options.x_warn_vector_operation_performance +#endif +#ifdef GENERATOR_FILE +extern int warn_virtual_inheritance; +#else + int x_warn_virtual_inheritance; +#define warn_virtual_inheritance global_options.x_warn_virtual_inheritance +#endif +#ifdef GENERATOR_FILE +extern int warn_virtual_move_assign; +#else + int x_warn_virtual_move_assign; +#define warn_virtual_move_assign global_options.x_warn_virtual_move_assign +#endif +#ifdef GENERATOR_FILE +extern int warn_vla; +#else + int x_warn_vla; +#define warn_vla global_options.x_warn_vla +#endif +#ifdef GENERATOR_FILE +extern int warn_vla_limit; +#else + int x_warn_vla_limit; +#define warn_vla_limit global_options.x_warn_vla_limit +#endif +#ifdef GENERATOR_FILE +extern int warn_volatile_register_var; +#else + int x_warn_volatile_register_var; +#define warn_volatile_register_var global_options.x_warn_volatile_register_var +#endif +#ifdef GENERATOR_FILE +extern int warn_write_strings; +#else + int x_warn_write_strings; +#define warn_write_strings global_options.x_warn_write_strings +#endif +#ifdef GENERATOR_FILE +extern int warn_zero_as_null_pointer_constant; +#else + int x_warn_zero_as_null_pointer_constant; +#define warn_zero_as_null_pointer_constant global_options.x_warn_zero_as_null_pointer_constant +#endif +#ifdef GENERATOR_FILE +extern int warn_zerotrip; +#else + int x_warn_zerotrip; +#define warn_zerotrip global_options.x_warn_zerotrip +#endif +#ifdef GENERATOR_FILE +extern const char *aux_info_file_name; +#else + const char *x_aux_info_file_name; +#define aux_info_file_name global_options.x_aux_info_file_name +#endif +#ifdef GENERATOR_FILE +extern const char *aux_base_name; +#else + const char *x_aux_base_name; +#define aux_base_name global_options.x_aux_base_name +#endif +#ifdef GENERATOR_FILE +extern const char *dump_base_name; +#else + const char *x_dump_base_name; +#define dump_base_name global_options.x_dump_base_name +#endif +#ifdef GENERATOR_FILE +extern const char *dump_dir_name; +#else + const char *x_dump_dir_name; +#define dump_dir_name global_options.x_dump_dir_name +#endif +#ifdef GENERATOR_FILE +extern int flag_pic; +#else + int x_flag_pic; +#define flag_pic global_options.x_flag_pic +#endif +#ifdef GENERATOR_FILE +extern int flag_pie; +#else + int x_flag_pie; +#define flag_pie global_options.x_flag_pie +#endif +#ifdef GENERATOR_FILE +extern int flag_abi_compat_version; +#else + int x_flag_abi_compat_version; +#define flag_abi_compat_version global_options.x_flag_abi_compat_version +#endif +#ifdef GENERATOR_FILE +extern int flag_abi_version; +#else + int x_flag_abi_version; +#define flag_abi_version global_options.x_flag_abi_version +#endif +#ifdef GENERATOR_FILE +extern int flag_access_control; +#else + int x_flag_access_control; +#define flag_access_control global_options.x_flag_access_control +#endif +#ifdef GENERATOR_FILE +extern const char *ada_specs_parent; +#else + const char *x_ada_specs_parent; +#define ada_specs_parent global_options.x_ada_specs_parent +#endif +#ifdef GENERATOR_FILE +extern int flag_aggressive_function_elimination; +#else + int x_flag_aggressive_function_elimination; +#define flag_aggressive_function_elimination global_options.x_flag_aggressive_function_elimination +#endif +#ifdef GENERATOR_FILE +extern int flag_aggressive_loop_optimizations; +#else + int x_flag_aggressive_loop_optimizations; +#define flag_aggressive_loop_optimizations global_options.x_flag_aggressive_loop_optimizations +#endif +#ifdef GENERATOR_FILE +extern int flag_align_commons; +#else + int x_flag_align_commons; +#define flag_align_commons global_options.x_flag_align_commons +#endif +#ifdef GENERATOR_FILE +extern int align_functions; +#else + int x_align_functions; +#define align_functions global_options.x_align_functions +#endif +#ifdef GENERATOR_FILE +extern int align_jumps; +#else + int x_align_jumps; +#define align_jumps global_options.x_align_jumps +#endif +#ifdef GENERATOR_FILE +extern int align_labels; +#else + int x_align_labels; +#define align_labels global_options.x_align_labels +#endif +#ifdef GENERATOR_FILE +extern int align_loops; +#else + int x_align_loops; +#define align_loops global_options.x_align_loops +#endif +#ifdef GENERATOR_FILE +extern int aligned_new_threshold; +#else + int x_aligned_new_threshold; +#define aligned_new_threshold global_options.x_aligned_new_threshold +#endif +#ifdef GENERATOR_FILE +extern int flag_all_intrinsics; +#else + int x_flag_all_intrinsics; +#define flag_all_intrinsics global_options.x_flag_all_intrinsics +#endif +#ifdef GENERATOR_FILE +extern int flag_allow_leading_underscore; +#else + int x_flag_allow_leading_underscore; +#define flag_allow_leading_underscore global_options.x_flag_allow_leading_underscore +#endif +#ifdef GENERATOR_FILE +extern int flag_allow_parameterless_variadic_functions; +#else + int x_flag_allow_parameterless_variadic_functions; +#define flag_allow_parameterless_variadic_functions global_options.x_flag_allow_parameterless_variadic_functions +#endif +#ifdef GENERATOR_FILE +extern void *common_deferred_options; +#else + void *x_common_deferred_options; +#define common_deferred_options global_options.x_common_deferred_options +#endif +#ifdef GENERATOR_FILE +extern int flag_no_asm; +#else + int x_flag_no_asm; +#define flag_no_asm global_options.x_flag_no_asm +#endif +#ifdef GENERATOR_FILE +extern int flag_associative_math; +#else + int x_flag_associative_math; +#define flag_associative_math global_options.x_flag_associative_math +#endif +#ifdef GENERATOR_FILE +extern int flag_asynchronous_unwind_tables; +#else + int x_flag_asynchronous_unwind_tables; +#define flag_asynchronous_unwind_tables global_options.x_flag_asynchronous_unwind_tables +#endif +#ifdef GENERATOR_FILE +extern int flag_auto_inc_dec; +#else + int x_flag_auto_inc_dec; +#define flag_auto_inc_dec global_options.x_flag_auto_inc_dec +#endif +#ifdef GENERATOR_FILE +extern int flag_auto_profile; +#else + int x_flag_auto_profile; +#define flag_auto_profile global_options.x_flag_auto_profile +#endif +#ifdef GENERATOR_FILE +extern const char *auto_profile_file; +#else + const char *x_auto_profile_file; +#define auto_profile_file global_options.x_auto_profile_file +#endif +#ifdef GENERATOR_FILE +extern int flag_automatic; +#else + int x_flag_automatic; +#define flag_automatic global_options.x_flag_automatic +#endif +#ifdef GENERATOR_FILE +extern int flag_backslash; +#else + int x_flag_backslash; +#define flag_backslash global_options.x_flag_backslash +#endif +#ifdef GENERATOR_FILE +extern int flag_backtrace; +#else + int x_flag_backtrace; +#define flag_backtrace global_options.x_flag_backtrace +#endif +#ifdef GENERATOR_FILE +extern int flag_blas_matmul_limit; +#else + int x_flag_blas_matmul_limit; +#define flag_blas_matmul_limit global_options.x_flag_blas_matmul_limit +#endif +#ifdef GENERATOR_FILE +extern int flag_bounds_check; +#else + int x_flag_bounds_check; +#define flag_bounds_check global_options.x_flag_bounds_check +#endif +#ifdef GENERATOR_FILE +extern int flag_branch_on_count_reg; +#else + int x_flag_branch_on_count_reg; +#define flag_branch_on_count_reg global_options.x_flag_branch_on_count_reg +#endif +#ifdef GENERATOR_FILE +extern int flag_branch_probabilities; +#else + int x_flag_branch_probabilities; +#define flag_branch_probabilities global_options.x_flag_branch_probabilities +#endif +#ifdef GENERATOR_FILE +extern int flag_branch_target_load_optimize; +#else + int x_flag_branch_target_load_optimize; +#define flag_branch_target_load_optimize global_options.x_flag_branch_target_load_optimize +#endif +#ifdef GENERATOR_FILE +extern int flag_branch_target_load_optimize2; +#else + int x_flag_branch_target_load_optimize2; +#define flag_branch_target_load_optimize2 global_options.x_flag_branch_target_load_optimize2 +#endif +#ifdef GENERATOR_FILE +extern int flag_btr_bb_exclusive; +#else + int x_flag_btr_bb_exclusive; +#define flag_btr_bb_exclusive global_options.x_flag_btr_bb_exclusive +#endif +#ifdef GENERATOR_FILE +extern int flag_building_libgcc; +#else + int x_flag_building_libgcc; +#define flag_building_libgcc global_options.x_flag_building_libgcc +#endif +#ifdef GENERATOR_FILE +extern int flag_no_builtin; +#else + int x_flag_no_builtin; +#define flag_no_builtin global_options.x_flag_no_builtin +#endif +#ifdef GENERATOR_FILE +extern int flag_caller_saves; +#else + int x_flag_caller_saves; +#define flag_caller_saves global_options.x_flag_caller_saves +#endif +#ifdef GENERATOR_FILE +extern int flag_check_data_deps; +#else + int x_flag_check_data_deps; +#define flag_check_data_deps global_options.x_flag_check_data_deps +#endif +#ifdef GENERATOR_FILE +extern int flag_check_new; +#else + int x_flag_check_new; +#define flag_check_new global_options.x_flag_check_new +#endif +#ifdef GENERATOR_FILE +extern int flag_check_pointer_bounds; +#else + int x_flag_check_pointer_bounds; +#define flag_check_pointer_bounds global_options.x_flag_check_pointer_bounds +#endif +#ifdef GENERATOR_FILE +extern int flag_checking; +#else + int x_flag_checking; +#define flag_checking global_options.x_flag_checking +#endif +#ifdef GENERATOR_FILE +extern int flag_chkp_incomplete_type; +#else + int x_flag_chkp_incomplete_type; +#define flag_chkp_incomplete_type global_options.x_flag_chkp_incomplete_type +#endif +#ifdef GENERATOR_FILE +extern int flag_chkp_check_read; +#else + int x_flag_chkp_check_read; +#define flag_chkp_check_read global_options.x_flag_chkp_check_read +#endif +#ifdef GENERATOR_FILE +extern int flag_chkp_check_write; +#else + int x_flag_chkp_check_write; +#define flag_chkp_check_write global_options.x_flag_chkp_check_write +#endif +#ifdef GENERATOR_FILE +extern int flag_chkp_first_field_has_own_bounds; +#else + int x_flag_chkp_first_field_has_own_bounds; +#define flag_chkp_first_field_has_own_bounds global_options.x_flag_chkp_first_field_has_own_bounds +#endif +#ifdef GENERATOR_FILE +extern int flag_chkp_flexible_struct_trailing_arrays; +#else + int x_flag_chkp_flexible_struct_trailing_arrays; +#define flag_chkp_flexible_struct_trailing_arrays global_options.x_flag_chkp_flexible_struct_trailing_arrays +#endif +#ifdef GENERATOR_FILE +extern int flag_chkp_instrument_calls; +#else + int x_flag_chkp_instrument_calls; +#define flag_chkp_instrument_calls global_options.x_flag_chkp_instrument_calls +#endif +#ifdef GENERATOR_FILE +extern int flag_chkp_instrument_marked_only; +#else + int x_flag_chkp_instrument_marked_only; +#define flag_chkp_instrument_marked_only global_options.x_flag_chkp_instrument_marked_only +#endif +#ifdef GENERATOR_FILE +extern int flag_chkp_narrow_bounds; +#else + int x_flag_chkp_narrow_bounds; +#define flag_chkp_narrow_bounds global_options.x_flag_chkp_narrow_bounds +#endif +#ifdef GENERATOR_FILE +extern int flag_chkp_narrow_to_innermost_arrray; +#else + int x_flag_chkp_narrow_to_innermost_arrray; +#define flag_chkp_narrow_to_innermost_arrray global_options.x_flag_chkp_narrow_to_innermost_arrray +#endif +#ifdef GENERATOR_FILE +extern int flag_chkp_optimize; +#else + int x_flag_chkp_optimize; +#define flag_chkp_optimize global_options.x_flag_chkp_optimize +#endif +#ifdef GENERATOR_FILE +extern int flag_chkp_store_bounds; +#else + int x_flag_chkp_store_bounds; +#define flag_chkp_store_bounds global_options.x_flag_chkp_store_bounds +#endif +#ifdef GENERATOR_FILE +extern int flag_chkp_zero_dynamic_size_as_infinite; +#else + int x_flag_chkp_zero_dynamic_size_as_infinite; +#define flag_chkp_zero_dynamic_size_as_infinite global_options.x_flag_chkp_zero_dynamic_size_as_infinite +#endif +#ifdef GENERATOR_FILE +extern int flag_chkp_use_fast_string_functions; +#else + int x_flag_chkp_use_fast_string_functions; +#define flag_chkp_use_fast_string_functions global_options.x_flag_chkp_use_fast_string_functions +#endif +#ifdef GENERATOR_FILE +extern int flag_chkp_use_nochk_string_functions; +#else + int x_flag_chkp_use_nochk_string_functions; +#define flag_chkp_use_nochk_string_functions global_options.x_flag_chkp_use_nochk_string_functions +#endif +#ifdef GENERATOR_FILE +extern int flag_chkp_use_static_bounds; +#else + int x_flag_chkp_use_static_bounds; +#define flag_chkp_use_static_bounds global_options.x_flag_chkp_use_static_bounds +#endif +#ifdef GENERATOR_FILE +extern int flag_chkp_use_static_const_bounds; +#else + int x_flag_chkp_use_static_const_bounds; +#define flag_chkp_use_static_const_bounds global_options.x_flag_chkp_use_static_const_bounds +#endif +#ifdef GENERATOR_FILE +extern int flag_chkp_use_wrappers; +#else + int x_flag_chkp_use_wrappers; +#define flag_chkp_use_wrappers global_options.x_flag_chkp_use_wrappers +#endif +#ifdef GENERATOR_FILE +extern int flag_chkp_zero_input_bounds_for_main; +#else + int x_flag_chkp_zero_input_bounds_for_main; +#define flag_chkp_zero_input_bounds_for_main global_options.x_flag_chkp_zero_input_bounds_for_main +#endif +#ifdef GENERATOR_FILE +extern int flag_cilkplus; +#else + int x_flag_cilkplus; +#define flag_cilkplus global_options.x_flag_cilkplus +#endif +#ifdef GENERATOR_FILE +extern enum gfc_fcoarray flag_coarray; +#else + enum gfc_fcoarray x_flag_coarray; +#define flag_coarray global_options.x_flag_coarray +#endif +#ifdef GENERATOR_FILE +extern int flag_code_hoisting; +#else + int x_flag_code_hoisting; +#define flag_code_hoisting global_options.x_flag_code_hoisting +#endif +#ifdef GENERATOR_FILE +extern int flag_combine_stack_adjustments; +#else + int x_flag_combine_stack_adjustments; +#define flag_combine_stack_adjustments global_options.x_flag_combine_stack_adjustments +#endif +#ifdef GENERATOR_FILE +extern int flag_no_common; +#else + int x_flag_no_common; +#define flag_no_common global_options.x_flag_no_common +#endif +#ifdef GENERATOR_FILE +extern int flag_compare_debug; +#else + int x_flag_compare_debug; +#define flag_compare_debug global_options.x_flag_compare_debug +#endif +#ifdef GENERATOR_FILE +extern const char *flag_compare_debug_opt; +#else + const char *x_flag_compare_debug_opt; +#define flag_compare_debug_opt global_options.x_flag_compare_debug_opt +#endif +#ifdef GENERATOR_FILE +extern int flag_compare_elim_after_reload; +#else + int x_flag_compare_elim_after_reload; +#define flag_compare_elim_after_reload global_options.x_flag_compare_elim_after_reload +#endif +#ifdef GENERATOR_FILE +extern int flag_concepts; +#else + int x_flag_concepts; +#define flag_concepts global_options.x_flag_concepts +#endif +#ifdef GENERATOR_FILE +extern int flag_conserve_space; +#else + int x_flag_conserve_space; +#define flag_conserve_space global_options.x_flag_conserve_space +#endif +#ifdef GENERATOR_FILE +extern int flag_conserve_stack; +#else + int x_flag_conserve_stack; +#define flag_conserve_stack global_options.x_flag_conserve_stack +#endif +#ifdef GENERATOR_FILE +extern int max_constexpr_depth; +#else + int x_max_constexpr_depth; +#define max_constexpr_depth global_options.x_max_constexpr_depth +#endif +#ifdef GENERATOR_FILE +extern int constexpr_loop_limit; +#else + int x_constexpr_loop_limit; +#define constexpr_loop_limit global_options.x_constexpr_loop_limit +#endif +#ifdef GENERATOR_FILE +extern enum gfc_convert flag_convert; +#else + enum gfc_convert x_flag_convert; +#define flag_convert global_options.x_flag_convert +#endif +#ifdef GENERATOR_FILE +extern int flag_cprop_registers; +#else + int x_flag_cprop_registers; +#define flag_cprop_registers global_options.x_flag_cprop_registers +#endif +#ifdef GENERATOR_FILE +extern int flag_cray_pointer; +#else + int x_flag_cray_pointer; +#define flag_cray_pointer global_options.x_flag_cray_pointer +#endif +#ifdef GENERATOR_FILE +extern int flag_crossjumping; +#else + int x_flag_crossjumping; +#define flag_crossjumping global_options.x_flag_crossjumping +#endif +#ifdef GENERATOR_FILE +extern int flag_cse_follow_jumps; +#else + int x_flag_cse_follow_jumps; +#define flag_cse_follow_jumps global_options.x_flag_cse_follow_jumps +#endif +#ifdef GENERATOR_FILE +extern int flag_cx_fortran_rules; +#else + int x_flag_cx_fortran_rules; +#define flag_cx_fortran_rules global_options.x_flag_cx_fortran_rules +#endif +#ifdef GENERATOR_FILE +extern int flag_cx_limited_range; +#else + int x_flag_cx_limited_range; +#define flag_cx_limited_range global_options.x_flag_cx_limited_range +#endif +#ifdef GENERATOR_FILE +extern int flag_data_sections; +#else + int x_flag_data_sections; +#define flag_data_sections global_options.x_flag_data_sections +#endif +#ifdef GENERATOR_FILE +extern int flag_dce; +#else + int x_flag_dce; +#define flag_dce global_options.x_flag_dce +#endif +#ifdef GENERATOR_FILE +extern int flag_debug_types_section; +#else + int x_flag_debug_types_section; +#define flag_debug_types_section global_options.x_flag_debug_types_section +#endif +#ifdef GENERATOR_FILE +extern int flag_dec; +#else + int x_flag_dec; +#define flag_dec global_options.x_flag_dec +#endif +#ifdef GENERATOR_FILE +extern int flag_dec_intrinsic_ints; +#else + int x_flag_dec_intrinsic_ints; +#define flag_dec_intrinsic_ints global_options.x_flag_dec_intrinsic_ints +#endif +#ifdef GENERATOR_FILE +extern int flag_dec_math; +#else + int x_flag_dec_math; +#define flag_dec_math global_options.x_flag_dec_math +#endif +#ifdef GENERATOR_FILE +extern int flag_dec_static; +#else + int x_flag_dec_static; +#define flag_dec_static global_options.x_flag_dec_static +#endif +#ifdef GENERATOR_FILE +extern int flag_dec_structure; +#else + int x_flag_dec_structure; +#define flag_dec_structure global_options.x_flag_dec_structure +#endif +#ifdef GENERATOR_FILE +extern int flag_declone_ctor_dtor; +#else + int x_flag_declone_ctor_dtor; +#define flag_declone_ctor_dtor global_options.x_flag_declone_ctor_dtor +#endif +#ifdef GENERATOR_FILE +extern int flag_deduce_init_list; +#else + int x_flag_deduce_init_list; +#define flag_deduce_init_list global_options.x_flag_deduce_init_list +#endif +#ifdef GENERATOR_FILE +extern int flag_default_double; +#else + int x_flag_default_double; +#define flag_default_double global_options.x_flag_default_double +#endif +#ifdef GENERATOR_FILE +extern int flag_default_integer; +#else + int x_flag_default_integer; +#define flag_default_integer global_options.x_flag_default_integer +#endif +#ifdef GENERATOR_FILE +extern int flag_default_real; +#else + int x_flag_default_real; +#define flag_default_real global_options.x_flag_default_real +#endif +#ifdef GENERATOR_FILE +extern int flag_defer_pop; +#else + int x_flag_defer_pop; +#define flag_defer_pop global_options.x_flag_defer_pop +#endif +#ifdef GENERATOR_FILE +extern int flag_delayed_branch; +#else + int x_flag_delayed_branch; +#define flag_delayed_branch global_options.x_flag_delayed_branch +#endif +#ifdef GENERATOR_FILE +extern int flag_delete_dead_exceptions; +#else + int x_flag_delete_dead_exceptions; +#define flag_delete_dead_exceptions global_options.x_flag_delete_dead_exceptions +#endif +#ifdef GENERATOR_FILE +extern int flag_delete_null_pointer_checks; +#else + int x_flag_delete_null_pointer_checks; +#define flag_delete_null_pointer_checks global_options.x_flag_delete_null_pointer_checks +#endif +#ifdef GENERATOR_FILE +extern int flag_devirtualize; +#else + int x_flag_devirtualize; +#define flag_devirtualize global_options.x_flag_devirtualize +#endif +#ifdef GENERATOR_FILE +extern int flag_ltrans_devirtualize; +#else + int x_flag_ltrans_devirtualize; +#define flag_ltrans_devirtualize global_options.x_flag_ltrans_devirtualize +#endif +#ifdef GENERATOR_FILE +extern int flag_devirtualize_speculatively; +#else + int x_flag_devirtualize_speculatively; +#define flag_devirtualize_speculatively global_options.x_flag_devirtualize_speculatively +#endif +#ifdef GENERATOR_FILE +extern int flag_diagnostics_show_color; +#else + int x_flag_diagnostics_show_color; +#define flag_diagnostics_show_color global_options.x_flag_diagnostics_show_color +#endif +#ifdef GENERATOR_FILE +extern int flag_diagnostics_generate_patch; +#else + int x_flag_diagnostics_generate_patch; +#define flag_diagnostics_generate_patch global_options.x_flag_diagnostics_generate_patch +#endif +#ifdef GENERATOR_FILE +extern int flag_diagnostics_parseable_fixits; +#else + int x_flag_diagnostics_parseable_fixits; +#define flag_diagnostics_parseable_fixits global_options.x_flag_diagnostics_parseable_fixits +#endif +#ifdef GENERATOR_FILE +extern int flag_diagnostics_show_caret; +#else + int x_flag_diagnostics_show_caret; +#define flag_diagnostics_show_caret global_options.x_flag_diagnostics_show_caret +#endif +#ifdef GENERATOR_FILE +extern int flag_diagnostics_show_option; +#else + int x_flag_diagnostics_show_option; +#define flag_diagnostics_show_option global_options.x_flag_diagnostics_show_option +#endif +#ifdef GENERATOR_FILE +extern int flag_dollar_ok; +#else + int x_flag_dollar_ok; +#define flag_dollar_ok global_options.x_flag_dollar_ok +#endif +#ifdef GENERATOR_FILE +extern int flag_dse; +#else + int x_flag_dse; +#define flag_dse global_options.x_flag_dse +#endif +#ifdef GENERATOR_FILE +extern int flag_dump_ada_spec; +#else + int x_flag_dump_ada_spec; +#define flag_dump_ada_spec global_options.x_flag_dump_ada_spec +#endif +#ifdef GENERATOR_FILE +extern int flag_dump_ada_spec_slim; +#else + int x_flag_dump_ada_spec_slim; +#define flag_dump_ada_spec_slim global_options.x_flag_dump_ada_spec_slim +#endif +#ifdef GENERATOR_FILE +extern const char *flag_dump_final_insns; +#else + const char *x_flag_dump_final_insns; +#define flag_dump_final_insns global_options.x_flag_dump_final_insns +#endif +#ifdef GENERATOR_FILE +extern int flag_dump_fortran_optimized; +#else + int x_flag_dump_fortran_optimized; +#define flag_dump_fortran_optimized global_options.x_flag_dump_fortran_optimized +#endif +#ifdef GENERATOR_FILE +extern int flag_dump_fortran_original; +#else + int x_flag_dump_fortran_original; +#define flag_dump_fortran_original global_options.x_flag_dump_fortran_original +#endif +#ifdef GENERATOR_FILE +extern const char *flag_dump_go_spec; +#else + const char *x_flag_dump_go_spec; +#define flag_dump_go_spec global_options.x_flag_dump_go_spec +#endif +#ifdef GENERATOR_FILE +extern int flag_dump_locations; +#else + int x_flag_dump_locations; +#define flag_dump_locations global_options.x_flag_dump_locations +#endif +#ifdef GENERATOR_FILE +extern int flag_dump_noaddr; +#else + int x_flag_dump_noaddr; +#define flag_dump_noaddr global_options.x_flag_dump_noaddr +#endif +#ifdef GENERATOR_FILE +extern int flag_dump_passes; +#else + int x_flag_dump_passes; +#define flag_dump_passes global_options.x_flag_dump_passes +#endif +#ifdef GENERATOR_FILE +extern int flag_dump_unnumbered; +#else + int x_flag_dump_unnumbered; +#define flag_dump_unnumbered global_options.x_flag_dump_unnumbered +#endif +#ifdef GENERATOR_FILE +extern int flag_dump_unnumbered_links; +#else + int x_flag_dump_unnumbered_links; +#define flag_dump_unnumbered_links global_options.x_flag_dump_unnumbered_links +#endif +#ifdef GENERATOR_FILE +extern int flag_dwarf2_cfi_asm; +#else + int x_flag_dwarf2_cfi_asm; +#define flag_dwarf2_cfi_asm global_options.x_flag_dwarf2_cfi_asm +#endif +#ifdef GENERATOR_FILE +extern int flag_early_inlining; +#else + int x_flag_early_inlining; +#define flag_early_inlining global_options.x_flag_early_inlining +#endif +#ifdef GENERATOR_FILE +extern int flag_elide_constructors; +#else + int x_flag_elide_constructors; +#define flag_elide_constructors global_options.x_flag_elide_constructors +#endif +#ifdef GENERATOR_FILE +extern int flag_eliminate_dwarf2_dups; +#else + int x_flag_eliminate_dwarf2_dups; +#define flag_eliminate_dwarf2_dups global_options.x_flag_eliminate_dwarf2_dups +#endif +#ifdef GENERATOR_FILE +extern int flag_debug_only_used_symbols; +#else + int x_flag_debug_only_used_symbols; +#define flag_debug_only_used_symbols global_options.x_flag_debug_only_used_symbols +#endif +#ifdef GENERATOR_FILE +extern int flag_eliminate_unused_debug_types; +#else + int x_flag_eliminate_unused_debug_types; +#define flag_eliminate_unused_debug_types global_options.x_flag_eliminate_unused_debug_types +#endif +#ifdef GENERATOR_FILE +extern int flag_emit_class_debug_always; +#else + int x_flag_emit_class_debug_always; +#define flag_emit_class_debug_always global_options.x_flag_emit_class_debug_always +#endif +#ifdef GENERATOR_FILE +extern int flag_enforce_eh_specs; +#else + int x_flag_enforce_eh_specs; +#define flag_enforce_eh_specs global_options.x_flag_enforce_eh_specs +#endif +#ifdef GENERATOR_FILE +extern int flag_exceptions; +#else + int x_flag_exceptions; +#define flag_exceptions global_options.x_flag_exceptions +#endif +#ifdef GENERATOR_FILE +extern enum excess_precision flag_excess_precision_cmdline; +#else + enum excess_precision x_flag_excess_precision_cmdline; +#define flag_excess_precision_cmdline global_options.x_flag_excess_precision_cmdline +#endif +#ifdef GENERATOR_FILE +extern int flag_expensive_optimizations; +#else + int x_flag_expensive_optimizations; +#define flag_expensive_optimizations global_options.x_flag_expensive_optimizations +#endif +#ifdef GENERATOR_FILE +extern int flag_ext_numeric_literals; +#else + int x_flag_ext_numeric_literals; +#define flag_ext_numeric_literals global_options.x_flag_ext_numeric_literals +#endif +#ifdef GENERATOR_FILE +extern int flag_extern_tls_init; +#else + int x_flag_extern_tls_init; +#define flag_extern_tls_init global_options.x_flag_extern_tls_init +#endif +#ifdef GENERATOR_FILE +extern int flag_external_blas; +#else + int x_flag_external_blas; +#define flag_external_blas global_options.x_flag_external_blas +#endif +#ifdef GENERATOR_FILE +extern int flag_f2c; +#else + int x_flag_f2c; +#define flag_f2c global_options.x_flag_f2c +#endif +#ifdef GENERATOR_FILE +extern int flag_fat_lto_objects; +#else + int x_flag_fat_lto_objects; +#define flag_fat_lto_objects global_options.x_flag_fat_lto_objects +#endif +#ifdef GENERATOR_FILE +extern int flag_finite_math_only; +#else + int x_flag_finite_math_only; +#define flag_finite_math_only global_options.x_flag_finite_math_only +#endif +#ifdef GENERATOR_FILE +extern int flag_fixed_line_length; +#else + int x_flag_fixed_line_length; +#define flag_fixed_line_length global_options.x_flag_fixed_line_length +#endif +#ifdef GENERATOR_FILE +extern int flag_float_store; +#else + int x_flag_float_store; +#define flag_float_store global_options.x_flag_float_store +#endif +#ifdef GENERATOR_FILE +extern int flag_new_for_scope; +#else + int x_flag_new_for_scope; +#define flag_new_for_scope global_options.x_flag_new_for_scope +#endif +#ifdef GENERATOR_FILE +extern int flag_forward_propagate; +#else + int x_flag_forward_propagate; +#define flag_forward_propagate global_options.x_flag_forward_propagate +#endif +#ifdef GENERATOR_FILE +extern enum fp_contract_mode flag_fp_contract_mode; +#else + enum fp_contract_mode x_flag_fp_contract_mode; +#define flag_fp_contract_mode global_options.x_flag_fp_contract_mode +#endif +#ifdef GENERATOR_FILE +extern int flag_fp_int_builtin_inexact; +#else + int x_flag_fp_int_builtin_inexact; +#define flag_fp_int_builtin_inexact global_options.x_flag_fp_int_builtin_inexact +#endif +#ifdef GENERATOR_FILE +extern int flag_free_line_length; +#else + int x_flag_free_line_length; +#define flag_free_line_length global_options.x_flag_free_line_length +#endif +#ifdef GENERATOR_FILE +extern int flag_friend_injection; +#else + int x_flag_friend_injection; +#define flag_friend_injection global_options.x_flag_friend_injection +#endif +#ifdef GENERATOR_FILE +extern int flag_frontend_optimize; +#else + int x_flag_frontend_optimize; +#define flag_frontend_optimize global_options.x_flag_frontend_optimize +#endif +#ifdef GENERATOR_FILE +extern int flag_no_function_cse; +#else + int x_flag_no_function_cse; +#define flag_no_function_cse global_options.x_flag_no_function_cse +#endif +#ifdef GENERATOR_FILE +extern int flag_function_sections; +#else + int x_flag_function_sections; +#define flag_function_sections global_options.x_flag_function_sections +#endif +#ifdef GENERATOR_FILE +extern int flag_gcse; +#else + int x_flag_gcse; +#define flag_gcse global_options.x_flag_gcse +#endif +#ifdef GENERATOR_FILE +extern int flag_gcse_after_reload; +#else + int x_flag_gcse_after_reload; +#define flag_gcse_after_reload global_options.x_flag_gcse_after_reload +#endif +#ifdef GENERATOR_FILE +extern int flag_gcse_las; +#else + int x_flag_gcse_las; +#define flag_gcse_las global_options.x_flag_gcse_las +#endif +#ifdef GENERATOR_FILE +extern int flag_gcse_lm; +#else + int x_flag_gcse_lm; +#define flag_gcse_lm global_options.x_flag_gcse_lm +#endif +#ifdef GENERATOR_FILE +extern int flag_gcse_sm; +#else + int x_flag_gcse_sm; +#define flag_gcse_sm global_options.x_flag_gcse_sm +#endif +#ifdef GENERATOR_FILE +extern int flag_gimple; +#else + int x_flag_gimple; +#define flag_gimple global_options.x_flag_gimple +#endif +#ifdef GENERATOR_FILE +extern int flag_no_gnu_keywords; +#else + int x_flag_no_gnu_keywords; +#define flag_no_gnu_keywords global_options.x_flag_no_gnu_keywords +#endif +#ifdef GENERATOR_FILE +extern int flag_next_runtime; +#else + int x_flag_next_runtime; +#define flag_next_runtime global_options.x_flag_next_runtime +#endif +#ifdef GENERATOR_FILE +extern int flag_tm; +#else + int x_flag_tm; +#define flag_tm global_options.x_flag_tm +#endif +#ifdef GENERATOR_FILE +extern int flag_gnu_unique; +#else + int x_flag_gnu_unique; +#define flag_gnu_unique global_options.x_flag_gnu_unique +#endif +#ifdef GENERATOR_FILE +extern int flag_gnu89_inline; +#else + int x_flag_gnu89_inline; +#define flag_gnu89_inline global_options.x_flag_gnu89_inline +#endif +#ifdef GENERATOR_FILE +extern int go_check_divide_overflow; +#else + int x_go_check_divide_overflow; +#define go_check_divide_overflow global_options.x_go_check_divide_overflow +#endif +#ifdef GENERATOR_FILE +extern int go_check_divide_zero; +#else + int x_go_check_divide_zero; +#define go_check_divide_zero global_options.x_go_check_divide_zero +#endif +#ifdef GENERATOR_FILE +extern int go_compiling_runtime; +#else + int x_go_compiling_runtime; +#define go_compiling_runtime global_options.x_go_compiling_runtime +#endif +#ifdef GENERATOR_FILE +extern int go_debug_escape_level; +#else + int x_go_debug_escape_level; +#define go_debug_escape_level global_options.x_go_debug_escape_level +#endif +#ifdef GENERATOR_FILE +extern int flag_graphite; +#else + int x_flag_graphite; +#define flag_graphite global_options.x_flag_graphite +#endif +#ifdef GENERATOR_FILE +extern int flag_graphite_identity; +#else + int x_flag_graphite_identity; +#define flag_graphite_identity global_options.x_flag_graphite_identity +#endif +#ifdef GENERATOR_FILE +extern int flag_guess_branch_prob; +#else + int x_flag_guess_branch_prob; +#define flag_guess_branch_prob global_options.x_flag_guess_branch_prob +#endif +#ifdef GENERATOR_FILE +extern int flag_hoist_adjacent_loads; +#else + int x_flag_hoist_adjacent_loads; +#define flag_hoist_adjacent_loads global_options.x_flag_hoist_adjacent_loads +#endif +#ifdef GENERATOR_FILE +extern int flag_no_ident; +#else + int x_flag_no_ident; +#define flag_no_ident global_options.x_flag_no_ident +#endif +#ifdef GENERATOR_FILE +extern int flag_if_conversion; +#else + int x_flag_if_conversion; +#define flag_if_conversion global_options.x_flag_if_conversion +#endif +#ifdef GENERATOR_FILE +extern int flag_if_conversion2; +#else + int x_flag_if_conversion2; +#define flag_if_conversion2 global_options.x_flag_if_conversion2 +#endif +#ifdef GENERATOR_FILE +extern int flag_implement_inlines; +#else + int x_flag_implement_inlines; +#define flag_implement_inlines global_options.x_flag_implement_inlines +#endif +#ifdef GENERATOR_FILE +extern int flag_implicit_inline_templates; +#else + int x_flag_implicit_inline_templates; +#define flag_implicit_inline_templates global_options.x_flag_implicit_inline_templates +#endif +#ifdef GENERATOR_FILE +extern int flag_implicit_none; +#else + int x_flag_implicit_none; +#define flag_implicit_none global_options.x_flag_implicit_none +#endif +#ifdef GENERATOR_FILE +extern int flag_implicit_templates; +#else + int x_flag_implicit_templates; +#define flag_implicit_templates global_options.x_flag_implicit_templates +#endif +#ifdef GENERATOR_FILE +extern int flag_indirect_inlining; +#else + int x_flag_indirect_inlining; +#define flag_indirect_inlining global_options.x_flag_indirect_inlining +#endif +#ifdef GENERATOR_FILE +extern int flag_inhibit_size_directive; +#else + int x_flag_inhibit_size_directive; +#define flag_inhibit_size_directive global_options.x_flag_inhibit_size_directive +#endif +#ifdef GENERATOR_FILE +extern int flag_init_derived; +#else + int x_flag_init_derived; +#define flag_init_derived global_options.x_flag_init_derived +#endif +#ifdef GENERATOR_FILE +extern enum gfc_init_local_real flag_init_real; +#else + enum gfc_init_local_real x_flag_init_real; +#define flag_init_real global_options.x_flag_init_real +#endif +#ifdef GENERATOR_FILE +extern int flag_no_inline; +#else + int x_flag_no_inline; +#define flag_no_inline global_options.x_flag_no_inline +#endif +#ifdef GENERATOR_FILE +extern int flag_inline_atomics; +#else + int x_flag_inline_atomics; +#define flag_inline_atomics global_options.x_flag_inline_atomics +#endif +#ifdef GENERATOR_FILE +extern int flag_inline_functions; +#else + int x_flag_inline_functions; +#define flag_inline_functions global_options.x_flag_inline_functions +#endif +#ifdef GENERATOR_FILE +extern int flag_inline_functions_called_once; +#else + int x_flag_inline_functions_called_once; +#define flag_inline_functions_called_once global_options.x_flag_inline_functions_called_once +#endif +#ifdef GENERATOR_FILE +extern int flag_inline_matmul_limit; +#else + int x_flag_inline_matmul_limit; +#define flag_inline_matmul_limit global_options.x_flag_inline_matmul_limit +#endif +#ifdef GENERATOR_FILE +extern int flag_inline_small_functions; +#else + int x_flag_inline_small_functions; +#define flag_inline_small_functions global_options.x_flag_inline_small_functions +#endif +#ifdef GENERATOR_FILE +extern int flag_instrument_function_entry_exit; +#else + int x_flag_instrument_function_entry_exit; +#define flag_instrument_function_entry_exit global_options.x_flag_instrument_function_entry_exit +#endif +#ifdef GENERATOR_FILE +extern int flag_integer4_kind; +#else + int x_flag_integer4_kind; +#define flag_integer4_kind global_options.x_flag_integer4_kind +#endif +#ifdef GENERATOR_FILE +extern int flag_ipa_bit_cp; +#else + int x_flag_ipa_bit_cp; +#define flag_ipa_bit_cp global_options.x_flag_ipa_bit_cp +#endif +#ifdef GENERATOR_FILE +extern int flag_ipa_cp; +#else + int x_flag_ipa_cp; +#define flag_ipa_cp global_options.x_flag_ipa_cp +#endif +#ifdef GENERATOR_FILE +extern int flag_ipa_cp_clone; +#else + int x_flag_ipa_cp_clone; +#define flag_ipa_cp_clone global_options.x_flag_ipa_cp_clone +#endif +#ifdef GENERATOR_FILE +extern int flag_ipa_icf; +#else + int x_flag_ipa_icf; +#define flag_ipa_icf global_options.x_flag_ipa_icf +#endif +#ifdef GENERATOR_FILE +extern int flag_ipa_icf_functions; +#else + int x_flag_ipa_icf_functions; +#define flag_ipa_icf_functions global_options.x_flag_ipa_icf_functions +#endif +#ifdef GENERATOR_FILE +extern int flag_ipa_icf_variables; +#else + int x_flag_ipa_icf_variables; +#define flag_ipa_icf_variables global_options.x_flag_ipa_icf_variables +#endif +#ifdef GENERATOR_FILE +extern int flag_ipa_profile; +#else + int x_flag_ipa_profile; +#define flag_ipa_profile global_options.x_flag_ipa_profile +#endif +#ifdef GENERATOR_FILE +extern int flag_ipa_pta; +#else + int x_flag_ipa_pta; +#define flag_ipa_pta global_options.x_flag_ipa_pta +#endif +#ifdef GENERATOR_FILE +extern int flag_ipa_pure_const; +#else + int x_flag_ipa_pure_const; +#define flag_ipa_pure_const global_options.x_flag_ipa_pure_const +#endif +#ifdef GENERATOR_FILE +extern int flag_ipa_ra; +#else + int x_flag_ipa_ra; +#define flag_ipa_ra global_options.x_flag_ipa_ra +#endif +#ifdef GENERATOR_FILE +extern int flag_ipa_reference; +#else + int x_flag_ipa_reference; +#define flag_ipa_reference global_options.x_flag_ipa_reference +#endif +#ifdef GENERATOR_FILE +extern int flag_ipa_sra; +#else + int x_flag_ipa_sra; +#define flag_ipa_sra global_options.x_flag_ipa_sra +#endif +#ifdef GENERATOR_FILE +extern int flag_ipa_vrp; +#else + int x_flag_ipa_vrp; +#define flag_ipa_vrp global_options.x_flag_ipa_vrp +#endif +#ifdef GENERATOR_FILE +extern enum ira_algorithm flag_ira_algorithm; +#else + enum ira_algorithm x_flag_ira_algorithm; +#define flag_ira_algorithm global_options.x_flag_ira_algorithm +#endif +#ifdef GENERATOR_FILE +extern int flag_ira_hoist_pressure; +#else + int x_flag_ira_hoist_pressure; +#define flag_ira_hoist_pressure global_options.x_flag_ira_hoist_pressure +#endif +#ifdef GENERATOR_FILE +extern int flag_ira_loop_pressure; +#else + int x_flag_ira_loop_pressure; +#define flag_ira_loop_pressure global_options.x_flag_ira_loop_pressure +#endif +#ifdef GENERATOR_FILE +extern enum ira_region flag_ira_region; +#else + enum ira_region x_flag_ira_region; +#define flag_ira_region global_options.x_flag_ira_region +#endif +#ifdef GENERATOR_FILE +extern int flag_ira_share_save_slots; +#else + int x_flag_ira_share_save_slots; +#define flag_ira_share_save_slots global_options.x_flag_ira_share_save_slots +#endif +#ifdef GENERATOR_FILE +extern int flag_ira_share_spill_slots; +#else + int x_flag_ira_share_spill_slots; +#define flag_ira_share_spill_slots global_options.x_flag_ira_share_spill_slots +#endif +#ifdef GENERATOR_FILE +extern int flag_ira_verbose; +#else + int x_flag_ira_verbose; +#define flag_ira_verbose global_options.x_flag_ira_verbose +#endif +#ifdef GENERATOR_FILE +extern int flag_isolate_erroneous_paths_attribute; +#else + int x_flag_isolate_erroneous_paths_attribute; +#define flag_isolate_erroneous_paths_attribute global_options.x_flag_isolate_erroneous_paths_attribute +#endif +#ifdef GENERATOR_FILE +extern int flag_isolate_erroneous_paths_dereference; +#else + int x_flag_isolate_erroneous_paths_dereference; +#define flag_isolate_erroneous_paths_dereference global_options.x_flag_isolate_erroneous_paths_dereference +#endif +#ifdef GENERATOR_FILE +extern enum ivar_visibility default_ivar_visibility; +#else + enum ivar_visibility x_default_ivar_visibility; +#define default_ivar_visibility global_options.x_default_ivar_visibility +#endif +#ifdef GENERATOR_FILE +extern int flag_ivopts; +#else + int x_flag_ivopts; +#define flag_ivopts global_options.x_flag_ivopts +#endif +#ifdef GENERATOR_FILE +extern int flag_jump_tables; +#else + int x_flag_jump_tables; +#define flag_jump_tables global_options.x_flag_jump_tables +#endif +#ifdef GENERATOR_FILE +extern int flag_keep_gc_roots_live; +#else + int x_flag_keep_gc_roots_live; +#define flag_keep_gc_roots_live global_options.x_flag_keep_gc_roots_live +#endif +#ifdef GENERATOR_FILE +extern int flag_keep_inline_dllexport; +#else + int x_flag_keep_inline_dllexport; +#define flag_keep_inline_dllexport global_options.x_flag_keep_inline_dllexport +#endif +#ifdef GENERATOR_FILE +extern int flag_keep_inline_functions; +#else + int x_flag_keep_inline_functions; +#define flag_keep_inline_functions global_options.x_flag_keep_inline_functions +#endif +#ifdef GENERATOR_FILE +extern int flag_keep_static_consts; +#else + int x_flag_keep_static_consts; +#define flag_keep_static_consts global_options.x_flag_keep_static_consts +#endif +#ifdef GENERATOR_FILE +extern int flag_keep_static_functions; +#else + int x_flag_keep_static_functions; +#define flag_keep_static_functions global_options.x_flag_keep_static_functions +#endif +#ifdef GENERATOR_FILE +extern int flag_lax_vector_conversions; +#else + int x_flag_lax_vector_conversions; +#define flag_lax_vector_conversions global_options.x_flag_lax_vector_conversions +#endif +#ifdef GENERATOR_FILE +extern int flag_leading_underscore; +#else + int x_flag_leading_underscore; +#define flag_leading_underscore global_options.x_flag_leading_underscore +#endif +#ifdef GENERATOR_FILE +extern int flag_lifetime_dse; +#else + int x_flag_lifetime_dse; +#define flag_lifetime_dse global_options.x_flag_lifetime_dse +#endif +#ifdef GENERATOR_FILE +extern int flag_limit_function_alignment; +#else + int x_flag_limit_function_alignment; +#define flag_limit_function_alignment global_options.x_flag_limit_function_alignment +#endif +#ifdef GENERATOR_FILE +extern enum lto_linker_output flag_lto_linker_output; +#else + enum lto_linker_output x_flag_lto_linker_output; +#define flag_lto_linker_output global_options.x_flag_lto_linker_output +#endif +#ifdef GENERATOR_FILE +extern int flag_live_range_shrinkage; +#else + int x_flag_live_range_shrinkage; +#define flag_live_range_shrinkage global_options.x_flag_live_range_shrinkage +#endif +#ifdef GENERATOR_FILE +extern int flag_local_ivars; +#else + int x_flag_local_ivars; +#define flag_local_ivars global_options.x_flag_local_ivars +#endif +#ifdef GENERATOR_FILE +extern int flag_loop_nest_optimize; +#else + int x_flag_loop_nest_optimize; +#define flag_loop_nest_optimize global_options.x_flag_loop_nest_optimize +#endif +#ifdef GENERATOR_FILE +extern int flag_loop_parallelize_all; +#else + int x_flag_loop_parallelize_all; +#define flag_loop_parallelize_all global_options.x_flag_loop_parallelize_all +#endif +#ifdef GENERATOR_FILE +extern int flag_lra_remat; +#else + int x_flag_lra_remat; +#define flag_lra_remat global_options.x_flag_lra_remat +#endif +#ifdef GENERATOR_FILE +extern int flag_lto_compression_level; +#else + int x_flag_lto_compression_level; +#define flag_lto_compression_level global_options.x_flag_lto_compression_level +#endif +#ifdef GENERATOR_FILE +extern int flag_lto_odr_type_mering; +#else + int x_flag_lto_odr_type_mering; +#define flag_lto_odr_type_mering global_options.x_flag_lto_odr_type_mering +#endif +#ifdef GENERATOR_FILE +extern enum lto_partition_model flag_lto_partition; +#else + enum lto_partition_model x_flag_lto_partition; +#define flag_lto_partition global_options.x_flag_lto_partition +#endif +#ifdef GENERATOR_FILE +extern int flag_lto_report; +#else + int x_flag_lto_report; +#define flag_lto_report global_options.x_flag_lto_report +#endif +#ifdef GENERATOR_FILE +extern int flag_lto_report_wpa; +#else + int x_flag_lto_report_wpa; +#define flag_lto_report_wpa global_options.x_flag_lto_report_wpa +#endif +#ifdef GENERATOR_FILE +extern const char *flag_lto; +#else + const char *x_flag_lto; +#define flag_lto global_options.x_flag_lto +#endif +#ifdef GENERATOR_FILE +extern int flag_ltrans; +#else + int x_flag_ltrans; +#define flag_ltrans global_options.x_flag_ltrans +#endif +#ifdef GENERATOR_FILE +extern const char *ltrans_output_list; +#else + const char *x_ltrans_output_list; +#define ltrans_output_list global_options.x_ltrans_output_list +#endif +#ifdef GENERATOR_FILE +extern int flag_errno_math; +#else + int x_flag_errno_math; +#define flag_errno_math global_options.x_flag_errno_math +#endif +#ifdef GENERATOR_FILE +extern int flag_max_array_constructor; +#else + int x_flag_max_array_constructor; +#define flag_max_array_constructor global_options.x_flag_max_array_constructor +#endif +#ifdef GENERATOR_FILE +extern int flag_max_errors; +#else + int x_flag_max_errors; +#define flag_max_errors global_options.x_flag_max_errors +#endif +#ifdef GENERATOR_FILE +extern int flag_max_stack_var_size; +#else + int x_flag_max_stack_var_size; +#define flag_max_stack_var_size global_options.x_flag_max_stack_var_size +#endif +#ifdef GENERATOR_FILE +extern int flag_max_subrecord_length; +#else + int x_flag_max_subrecord_length; +#define flag_max_subrecord_length global_options.x_flag_max_subrecord_length +#endif +#ifdef GENERATOR_FILE +extern int mem_report; +#else + int x_mem_report; +#define mem_report global_options.x_mem_report +#endif +#ifdef GENERATOR_FILE +extern int mem_report_wpa; +#else + int x_mem_report_wpa; +#define mem_report_wpa global_options.x_mem_report_wpa +#endif +#ifdef GENERATOR_FILE +extern int flag_merge_constants; +#else + int x_flag_merge_constants; +#define flag_merge_constants global_options.x_flag_merge_constants +#endif +#ifdef GENERATOR_FILE +extern int flag_merge_debug_strings; +#else + int x_flag_merge_debug_strings; +#define flag_merge_debug_strings global_options.x_flag_merge_debug_strings +#endif +#ifdef GENERATOR_FILE +extern int flag_module_private; +#else + int x_flag_module_private; +#define flag_module_private global_options.x_flag_module_private +#endif +#ifdef GENERATOR_FILE +extern int flag_modulo_sched; +#else + int x_flag_modulo_sched; +#define flag_modulo_sched global_options.x_flag_modulo_sched +#endif +#ifdef GENERATOR_FILE +extern int flag_modulo_sched_allow_regmoves; +#else + int x_flag_modulo_sched_allow_regmoves; +#define flag_modulo_sched_allow_regmoves global_options.x_flag_modulo_sched_allow_regmoves +#endif +#ifdef GENERATOR_FILE +extern int flag_move_loop_invariants; +#else + int x_flag_move_loop_invariants; +#define flag_move_loop_invariants global_options.x_flag_move_loop_invariants +#endif +#ifdef GENERATOR_FILE +extern int flag_ms_extensions; +#else + int x_flag_ms_extensions; +#define flag_ms_extensions global_options.x_flag_ms_extensions +#endif +#ifdef GENERATOR_FILE +extern int flag_new_inheriting_ctors; +#else + int x_flag_new_inheriting_ctors; +#define flag_new_inheriting_ctors global_options.x_flag_new_inheriting_ctors +#endif +#ifdef GENERATOR_FILE +extern int flag_new_ttp; +#else + int x_flag_new_ttp; +#define flag_new_ttp global_options.x_flag_new_ttp +#endif +#ifdef GENERATOR_FILE +extern int flag_nil_receivers; +#else + int x_flag_nil_receivers; +#define flag_nil_receivers global_options.x_flag_nil_receivers +#endif +#ifdef GENERATOR_FILE +extern int flag_non_call_exceptions; +#else + int x_flag_non_call_exceptions; +#define flag_non_call_exceptions global_options.x_flag_non_call_exceptions +#endif +#ifdef GENERATOR_FILE +extern int flag_no_nonansi_builtin; +#else + int x_flag_no_nonansi_builtin; +#define flag_no_nonansi_builtin global_options.x_flag_no_nonansi_builtin +#endif +#ifdef GENERATOR_FILE +extern int flag_nothrow_opt; +#else + int x_flag_nothrow_opt; +#define flag_nothrow_opt global_options.x_flag_nothrow_opt +#endif +#ifdef GENERATOR_FILE +extern int flag_objc_abi; +#else + int x_flag_objc_abi; +#define flag_objc_abi global_options.x_flag_objc_abi +#endif +#ifdef GENERATOR_FILE +extern int flag_objc_call_cxx_cdtors; +#else + int x_flag_objc_call_cxx_cdtors; +#define flag_objc_call_cxx_cdtors global_options.x_flag_objc_call_cxx_cdtors +#endif +#ifdef GENERATOR_FILE +extern int flag_objc_direct_dispatch; +#else + int x_flag_objc_direct_dispatch; +#define flag_objc_direct_dispatch global_options.x_flag_objc_direct_dispatch +#endif +#ifdef GENERATOR_FILE +extern int flag_objc_exceptions; +#else + int x_flag_objc_exceptions; +#define flag_objc_exceptions global_options.x_flag_objc_exceptions +#endif +#ifdef GENERATOR_FILE +extern int flag_objc_gc; +#else + int x_flag_objc_gc; +#define flag_objc_gc global_options.x_flag_objc_gc +#endif +#ifdef GENERATOR_FILE +extern int flag_objc_nilcheck; +#else + int x_flag_objc_nilcheck; +#define flag_objc_nilcheck global_options.x_flag_objc_nilcheck +#endif +#ifdef GENERATOR_FILE +extern int flag_objc_sjlj_exceptions; +#else + int x_flag_objc_sjlj_exceptions; +#define flag_objc_sjlj_exceptions global_options.x_flag_objc_sjlj_exceptions +#endif +#ifdef GENERATOR_FILE +extern int flag_objc1_only; +#else + int x_flag_objc1_only; +#define flag_objc1_only global_options.x_flag_objc1_only +#endif +#ifdef GENERATOR_FILE +extern enum offload_abi flag_offload_abi; +#else + enum offload_abi x_flag_offload_abi; +#define flag_offload_abi global_options.x_flag_offload_abi +#endif +#ifdef GENERATOR_FILE +extern int flag_omit_frame_pointer; +#else + int x_flag_omit_frame_pointer; +#define flag_omit_frame_pointer global_options.x_flag_omit_frame_pointer +#endif +#ifdef GENERATOR_FILE +extern int flag_openacc; +#else + int x_flag_openacc; +#define flag_openacc global_options.x_flag_openacc +#endif +#ifdef GENERATOR_FILE +extern const char *flag_openacc_dims; +#else + const char *x_flag_openacc_dims; +#define flag_openacc_dims global_options.x_flag_openacc_dims +#endif +#ifdef GENERATOR_FILE +extern int flag_openmp; +#else + int x_flag_openmp; +#define flag_openmp global_options.x_flag_openmp +#endif +#ifdef GENERATOR_FILE +extern int flag_openmp_simd; +#else + int x_flag_openmp_simd; +#define flag_openmp_simd global_options.x_flag_openmp_simd +#endif +#ifdef GENERATOR_FILE +extern int flag_opt_info; +#else + int x_flag_opt_info; +#define flag_opt_info global_options.x_flag_opt_info +#endif +#ifdef GENERATOR_FILE +extern int flag_optimize_sibling_calls; +#else + int x_flag_optimize_sibling_calls; +#define flag_optimize_sibling_calls global_options.x_flag_optimize_sibling_calls +#endif +#ifdef GENERATOR_FILE +extern int flag_optimize_strlen; +#else + int x_flag_optimize_strlen; +#define flag_optimize_strlen global_options.x_flag_optimize_strlen +#endif +#ifdef GENERATOR_FILE +extern int flag_pack_derived; +#else + int x_flag_pack_derived; +#define flag_pack_derived global_options.x_flag_pack_derived +#endif +#ifdef GENERATOR_FILE +extern int flag_pack_struct; +#else + int x_flag_pack_struct; +#define flag_pack_struct global_options.x_flag_pack_struct +#endif +#ifdef GENERATOR_FILE +extern int flag_partial_inlining; +#else + int x_flag_partial_inlining; +#define flag_partial_inlining global_options.x_flag_partial_inlining +#endif +#ifdef GENERATOR_FILE +extern int flag_pcc_struct_return; +#else + int x_flag_pcc_struct_return; +#define flag_pcc_struct_return global_options.x_flag_pcc_struct_return +#endif +#ifdef GENERATOR_FILE +extern int flag_peel_loops; +#else + int x_flag_peel_loops; +#define flag_peel_loops global_options.x_flag_peel_loops +#endif +#ifdef GENERATOR_FILE +extern int flag_no_peephole; +#else + int x_flag_no_peephole; +#define flag_no_peephole global_options.x_flag_no_peephole +#endif +#ifdef GENERATOR_FILE +extern int flag_peephole2; +#else + int x_flag_peephole2; +#define flag_peephole2 global_options.x_flag_peephole2 +#endif +#ifdef GENERATOR_FILE +extern int flag_permissive; +#else + int x_flag_permissive; +#define flag_permissive global_options.x_flag_permissive +#endif +#ifdef GENERATOR_FILE +extern enum permitted_flt_eval_methods flag_permitted_flt_eval_methods; +#else + enum permitted_flt_eval_methods x_flag_permitted_flt_eval_methods; +#define flag_permitted_flt_eval_methods global_options.x_flag_permitted_flt_eval_methods +#endif +#ifdef GENERATOR_FILE +extern int flag_plan9_extensions; +#else + int x_flag_plan9_extensions; +#define flag_plan9_extensions global_options.x_flag_plan9_extensions +#endif +#ifdef GENERATOR_FILE +extern int flag_plt; +#else + int x_flag_plt; +#define flag_plt global_options.x_flag_plt +#endif +#ifdef GENERATOR_FILE +extern int post_ipa_mem_report; +#else + int x_post_ipa_mem_report; +#define post_ipa_mem_report global_options.x_post_ipa_mem_report +#endif +#ifdef GENERATOR_FILE +extern int pre_ipa_mem_report; +#else + int x_pre_ipa_mem_report; +#define pre_ipa_mem_report global_options.x_pre_ipa_mem_report +#endif +#ifdef GENERATOR_FILE +extern int flag_predictive_commoning; +#else + int x_flag_predictive_commoning; +#define flag_predictive_commoning global_options.x_flag_predictive_commoning +#endif +#ifdef GENERATOR_FILE +extern int flag_prefetch_loop_arrays; +#else + int x_flag_prefetch_loop_arrays; +#define flag_prefetch_loop_arrays global_options.x_flag_prefetch_loop_arrays +#endif +#ifdef GENERATOR_FILE +extern int flag_pretty_templates; +#else + int x_flag_pretty_templates; +#define flag_pretty_templates global_options.x_flag_pretty_templates +#endif +#ifdef GENERATOR_FILE +extern int flag_printf_return_value; +#else + int x_flag_printf_return_value; +#define flag_printf_return_value global_options.x_flag_printf_return_value +#endif +#ifdef GENERATOR_FILE +extern int profile_flag; +#else + int x_profile_flag; +#define profile_flag global_options.x_profile_flag +#endif +#ifdef GENERATOR_FILE +extern int profile_arc_flag; +#else + int x_profile_arc_flag; +#define profile_arc_flag global_options.x_profile_arc_flag +#endif +#ifdef GENERATOR_FILE +extern int flag_profile_correction; +#else + int x_flag_profile_correction; +#define flag_profile_correction global_options.x_flag_profile_correction +#endif +#ifdef GENERATOR_FILE +extern const char *profile_data_prefix; +#else + const char *x_profile_data_prefix; +#define profile_data_prefix global_options.x_profile_data_prefix +#endif +#ifdef GENERATOR_FILE +extern int flag_profile_reorder_functions; +#else + int x_flag_profile_reorder_functions; +#define flag_profile_reorder_functions global_options.x_flag_profile_reorder_functions +#endif +#ifdef GENERATOR_FILE +extern int profile_report; +#else + int x_profile_report; +#define profile_report global_options.x_profile_report +#endif +#ifdef GENERATOR_FILE +extern enum profile_update flag_profile_update; +#else + enum profile_update x_flag_profile_update; +#define flag_profile_update global_options.x_flag_profile_update +#endif +#ifdef GENERATOR_FILE +extern int flag_profile_use; +#else + int x_flag_profile_use; +#define flag_profile_use global_options.x_flag_profile_use +#endif +#ifdef GENERATOR_FILE +extern int flag_profile_values; +#else + int x_flag_profile_values; +#define flag_profile_values global_options.x_flag_profile_values +#endif +#ifdef GENERATOR_FILE +extern int flag_protect_parens; +#else + int x_flag_protect_parens; +#define flag_protect_parens global_options.x_flag_protect_parens +#endif +#ifdef GENERATOR_FILE +extern int flag_range_check; +#else + int x_flag_range_check; +#define flag_range_check global_options.x_flag_range_check +#endif +#ifdef GENERATOR_FILE +extern int flag_real4_kind; +#else + int x_flag_real4_kind; +#define flag_real4_kind global_options.x_flag_real4_kind +#endif +#ifdef GENERATOR_FILE +extern int flag_real8_kind; +#else + int x_flag_real8_kind; +#define flag_real8_kind global_options.x_flag_real8_kind +#endif +#ifdef GENERATOR_FILE +extern int flag_realloc_lhs; +#else + int x_flag_realloc_lhs; +#define flag_realloc_lhs global_options.x_flag_realloc_lhs +#endif +#ifdef GENERATOR_FILE +extern int flag_reciprocal_math; +#else + int x_flag_reciprocal_math; +#define flag_reciprocal_math global_options.x_flag_reciprocal_math +#endif +#ifdef GENERATOR_FILE +extern int flag_record_gcc_switches; +#else + int x_flag_record_gcc_switches; +#define flag_record_gcc_switches global_options.x_flag_record_gcc_switches +#endif +#ifdef GENERATOR_FILE +extern int flag_record_marker; +#else + int x_flag_record_marker; +#define flag_record_marker global_options.x_flag_record_marker +#endif +#ifdef GENERATOR_FILE +extern int flag_recursive; +#else + int x_flag_recursive; +#define flag_recursive global_options.x_flag_recursive +#endif +#ifdef GENERATOR_FILE +extern int flag_ree; +#else + int x_flag_ree; +#define flag_ree global_options.x_flag_ree +#endif +#ifdef GENERATOR_FILE +extern int flag_rename_registers; +#else + int x_flag_rename_registers; +#define flag_rename_registers global_options.x_flag_rename_registers +#endif +#ifdef GENERATOR_FILE +extern int flag_reorder_blocks; +#else + int x_flag_reorder_blocks; +#define flag_reorder_blocks global_options.x_flag_reorder_blocks +#endif +#ifdef GENERATOR_FILE +extern enum reorder_blocks_algorithm flag_reorder_blocks_algorithm; +#else + enum reorder_blocks_algorithm x_flag_reorder_blocks_algorithm; +#define flag_reorder_blocks_algorithm global_options.x_flag_reorder_blocks_algorithm +#endif +#ifdef GENERATOR_FILE +extern int flag_reorder_blocks_and_partition; +#else + int x_flag_reorder_blocks_and_partition; +#define flag_reorder_blocks_and_partition global_options.x_flag_reorder_blocks_and_partition +#endif +#ifdef GENERATOR_FILE +extern int flag_reorder_functions; +#else + int x_flag_reorder_functions; +#define flag_reorder_functions global_options.x_flag_reorder_functions +#endif +#ifdef GENERATOR_FILE +extern int flag_repack_arrays; +#else + int x_flag_repack_arrays; +#define flag_repack_arrays global_options.x_flag_repack_arrays +#endif +#ifdef GENERATOR_FILE +extern int flag_replace_objc_classes; +#else + int x_flag_replace_objc_classes; +#define flag_replace_objc_classes global_options.x_flag_replace_objc_classes +#endif +#ifdef GENERATOR_FILE +extern int flag_report_bug; +#else + int x_flag_report_bug; +#define flag_report_bug global_options.x_flag_report_bug +#endif +#ifdef GENERATOR_FILE +extern int go_require_return_statement; +#else + int x_go_require_return_statement; +#define go_require_return_statement global_options.x_go_require_return_statement +#endif +#ifdef GENERATOR_FILE +extern int flag_rerun_cse_after_loop; +#else + int x_flag_rerun_cse_after_loop; +#define flag_rerun_cse_after_loop global_options.x_flag_rerun_cse_after_loop +#endif +#ifdef GENERATOR_FILE +extern int flag_resched_modulo_sched; +#else + int x_flag_resched_modulo_sched; +#define flag_resched_modulo_sched global_options.x_flag_resched_modulo_sched +#endif +#ifdef GENERATOR_FILE +extern int flag_rounding_math; +#else + int x_flag_rounding_math; +#define flag_rounding_math global_options.x_flag_rounding_math +#endif +#ifdef GENERATOR_FILE +extern int flag_rtti; +#else + int x_flag_rtti; +#define flag_rtti global_options.x_flag_rtti +#endif +#ifdef GENERATOR_FILE +extern int flag_sanitize_address_use_after_scope; +#else + int x_flag_sanitize_address_use_after_scope; +#define flag_sanitize_address_use_after_scope global_options.x_flag_sanitize_address_use_after_scope +#endif +#ifdef GENERATOR_FILE +extern int flag_sanitize_coverage; +#else + int x_flag_sanitize_coverage; +#define flag_sanitize_coverage global_options.x_flag_sanitize_coverage +#endif +#ifdef GENERATOR_FILE +extern int flag_sanitize_undefined_trap_on_error; +#else + int x_flag_sanitize_undefined_trap_on_error; +#define flag_sanitize_undefined_trap_on_error global_options.x_flag_sanitize_undefined_trap_on_error +#endif +#ifdef GENERATOR_FILE +extern int flag_sched_critical_path_heuristic; +#else + int x_flag_sched_critical_path_heuristic; +#define flag_sched_critical_path_heuristic global_options.x_flag_sched_critical_path_heuristic +#endif +#ifdef GENERATOR_FILE +extern int flag_sched_dep_count_heuristic; +#else + int x_flag_sched_dep_count_heuristic; +#define flag_sched_dep_count_heuristic global_options.x_flag_sched_dep_count_heuristic +#endif +#ifdef GENERATOR_FILE +extern int flag_sched_group_heuristic; +#else + int x_flag_sched_group_heuristic; +#define flag_sched_group_heuristic global_options.x_flag_sched_group_heuristic +#endif +#ifdef GENERATOR_FILE +extern int flag_schedule_interblock; +#else + int x_flag_schedule_interblock; +#define flag_schedule_interblock global_options.x_flag_schedule_interblock +#endif +#ifdef GENERATOR_FILE +extern int flag_sched_last_insn_heuristic; +#else + int x_flag_sched_last_insn_heuristic; +#define flag_sched_last_insn_heuristic global_options.x_flag_sched_last_insn_heuristic +#endif +#ifdef GENERATOR_FILE +extern int flag_sched_pressure; +#else + int x_flag_sched_pressure; +#define flag_sched_pressure global_options.x_flag_sched_pressure +#endif +#ifdef GENERATOR_FILE +extern int flag_sched_rank_heuristic; +#else + int x_flag_sched_rank_heuristic; +#define flag_sched_rank_heuristic global_options.x_flag_sched_rank_heuristic +#endif +#ifdef GENERATOR_FILE +extern int flag_schedule_speculative; +#else + int x_flag_schedule_speculative; +#define flag_schedule_speculative global_options.x_flag_schedule_speculative +#endif +#ifdef GENERATOR_FILE +extern int flag_sched_spec_insn_heuristic; +#else + int x_flag_sched_spec_insn_heuristic; +#define flag_sched_spec_insn_heuristic global_options.x_flag_sched_spec_insn_heuristic +#endif +#ifdef GENERATOR_FILE +extern int flag_schedule_speculative_load; +#else + int x_flag_schedule_speculative_load; +#define flag_schedule_speculative_load global_options.x_flag_schedule_speculative_load +#endif +#ifdef GENERATOR_FILE +extern int flag_schedule_speculative_load_dangerous; +#else + int x_flag_schedule_speculative_load_dangerous; +#define flag_schedule_speculative_load_dangerous global_options.x_flag_schedule_speculative_load_dangerous +#endif +#ifdef GENERATOR_FILE +extern int flag_sched_stalled_insns; +#else + int x_flag_sched_stalled_insns; +#define flag_sched_stalled_insns global_options.x_flag_sched_stalled_insns +#endif +#ifdef GENERATOR_FILE +extern int flag_sched_stalled_insns_dep; +#else + int x_flag_sched_stalled_insns_dep; +#define flag_sched_stalled_insns_dep global_options.x_flag_sched_stalled_insns_dep +#endif +#ifdef GENERATOR_FILE +extern int sched_verbose_param; +#else + int x_sched_verbose_param; +#define sched_verbose_param global_options.x_sched_verbose_param +#endif +#ifdef GENERATOR_FILE +extern int flag_sched2_use_superblocks; +#else + int x_flag_sched2_use_superblocks; +#define flag_sched2_use_superblocks global_options.x_flag_sched2_use_superblocks +#endif +#ifdef GENERATOR_FILE +extern int flag_schedule_fusion; +#else + int x_flag_schedule_fusion; +#define flag_schedule_fusion global_options.x_flag_schedule_fusion +#endif +#ifdef GENERATOR_FILE +extern int flag_schedule_insns; +#else + int x_flag_schedule_insns; +#define flag_schedule_insns global_options.x_flag_schedule_insns +#endif +#ifdef GENERATOR_FILE +extern int flag_schedule_insns_after_reload; +#else + int x_flag_schedule_insns_after_reload; +#define flag_schedule_insns_after_reload global_options.x_flag_schedule_insns_after_reload +#endif +#ifdef GENERATOR_FILE +extern int flag_second_underscore; +#else + int x_flag_second_underscore; +#define flag_second_underscore global_options.x_flag_second_underscore +#endif +#ifdef GENERATOR_FILE +extern int flag_section_anchors; +#else + int x_flag_section_anchors; +#define flag_section_anchors global_options.x_flag_section_anchors +#endif +#ifdef GENERATOR_FILE +extern int flag_sel_sched_pipelining; +#else + int x_flag_sel_sched_pipelining; +#define flag_sel_sched_pipelining global_options.x_flag_sel_sched_pipelining +#endif +#ifdef GENERATOR_FILE +extern int flag_sel_sched_pipelining_outer_loops; +#else + int x_flag_sel_sched_pipelining_outer_loops; +#define flag_sel_sched_pipelining_outer_loops global_options.x_flag_sel_sched_pipelining_outer_loops +#endif +#ifdef GENERATOR_FILE +extern int flag_sel_sched_reschedule_pipelined; +#else + int x_flag_sel_sched_reschedule_pipelined; +#define flag_sel_sched_reschedule_pipelined global_options.x_flag_sel_sched_reschedule_pipelined +#endif +#ifdef GENERATOR_FILE +extern int flag_selective_scheduling; +#else + int x_flag_selective_scheduling; +#define flag_selective_scheduling global_options.x_flag_selective_scheduling +#endif +#ifdef GENERATOR_FILE +extern int flag_selective_scheduling2; +#else + int x_flag_selective_scheduling2; +#define flag_selective_scheduling2 global_options.x_flag_selective_scheduling2 +#endif +#ifdef GENERATOR_FILE +extern const char *flag_self_test; +#else + const char *x_flag_self_test; +#define flag_self_test global_options.x_flag_self_test +#endif +#ifdef GENERATOR_FILE +extern int flag_semantic_interposition; +#else + int x_flag_semantic_interposition; +#define flag_semantic_interposition global_options.x_flag_semantic_interposition +#endif +#ifdef GENERATOR_FILE +extern int flag_short_enums; +#else + int x_flag_short_enums; +#define flag_short_enums global_options.x_flag_short_enums +#endif +#ifdef GENERATOR_FILE +extern int flag_short_wchar; +#else + int x_flag_short_wchar; +#define flag_short_wchar global_options.x_flag_short_wchar +#endif +#ifdef GENERATOR_FILE +extern int flag_show_column; +#else + int x_flag_show_column; +#define flag_show_column global_options.x_flag_show_column +#endif +#ifdef GENERATOR_FILE +extern int flag_shrink_wrap; +#else + int x_flag_shrink_wrap; +#define flag_shrink_wrap global_options.x_flag_shrink_wrap +#endif +#ifdef GENERATOR_FILE +extern int flag_shrink_wrap_separate; +#else + int x_flag_shrink_wrap_separate; +#define flag_shrink_wrap_separate global_options.x_flag_shrink_wrap_separate +#endif +#ifdef GENERATOR_FILE +extern int flag_sign_zero; +#else + int x_flag_sign_zero; +#define flag_sign_zero global_options.x_flag_sign_zero +#endif +#ifdef GENERATOR_FILE +extern int flag_signaling_nans; +#else + int x_flag_signaling_nans; +#define flag_signaling_nans global_options.x_flag_signaling_nans +#endif +#ifdef GENERATOR_FILE +extern int flag_signed_bitfields; +#else + int x_flag_signed_bitfields; +#define flag_signed_bitfields global_options.x_flag_signed_bitfields +#endif +#ifdef GENERATOR_FILE +extern int flag_signed_char; +#else + int x_flag_signed_char; +#define flag_signed_char global_options.x_flag_signed_char +#endif +#ifdef GENERATOR_FILE +extern int flag_signed_zeros; +#else + int x_flag_signed_zeros; +#define flag_signed_zeros global_options.x_flag_signed_zeros +#endif +#ifdef GENERATOR_FILE +extern enum vect_cost_model flag_simd_cost_model; +#else + enum vect_cost_model x_flag_simd_cost_model; +#define flag_simd_cost_model global_options.x_flag_simd_cost_model +#endif +#ifdef GENERATOR_FILE +extern int flag_single_precision_constant; +#else + int x_flag_single_precision_constant; +#define flag_single_precision_constant global_options.x_flag_single_precision_constant +#endif +#ifdef GENERATOR_FILE +extern int flag_sized_deallocation; +#else + int x_flag_sized_deallocation; +#define flag_sized_deallocation global_options.x_flag_sized_deallocation +#endif +#ifdef GENERATOR_FILE +extern int flag_split_ivs_in_unroller; +#else + int x_flag_split_ivs_in_unroller; +#define flag_split_ivs_in_unroller global_options.x_flag_split_ivs_in_unroller +#endif +#ifdef GENERATOR_FILE +extern int flag_split_loops; +#else + int x_flag_split_loops; +#define flag_split_loops global_options.x_flag_split_loops +#endif +#ifdef GENERATOR_FILE +extern int flag_split_paths; +#else + int x_flag_split_paths; +#define flag_split_paths global_options.x_flag_split_paths +#endif +#ifdef GENERATOR_FILE +extern int flag_split_stack; +#else + int x_flag_split_stack; +#define flag_split_stack global_options.x_flag_split_stack +#endif +#ifdef GENERATOR_FILE +extern int flag_split_wide_types; +#else + int x_flag_split_wide_types; +#define flag_split_wide_types global_options.x_flag_split_wide_types +#endif +#ifdef GENERATOR_FILE +extern int flag_ssa_backprop; +#else + int x_flag_ssa_backprop; +#define flag_ssa_backprop global_options.x_flag_ssa_backprop +#endif +#ifdef GENERATOR_FILE +extern int flag_ssa_phiopt; +#else + int x_flag_ssa_phiopt; +#define flag_ssa_phiopt global_options.x_flag_ssa_phiopt +#endif +#ifdef GENERATOR_FILE +extern enum scalar_storage_order_kind default_sso; +#else + enum scalar_storage_order_kind x_default_sso; +#define default_sso global_options.x_default_sso +#endif +#ifdef GENERATOR_FILE +extern int flag_stack_arrays; +#else + int x_flag_stack_arrays; +#define flag_stack_arrays global_options.x_flag_stack_arrays +#endif +#ifdef GENERATOR_FILE +extern int flag_stack_protect; +#else + int x_flag_stack_protect; +#define flag_stack_protect global_options.x_flag_stack_protect +#endif +#ifdef GENERATOR_FILE +extern enum stack_reuse_level flag_stack_reuse; +#else + enum stack_reuse_level x_flag_stack_reuse; +#define flag_stack_reuse global_options.x_flag_stack_reuse +#endif +#ifdef GENERATOR_FILE +extern int flag_stack_usage; +#else + int x_flag_stack_usage; +#define flag_stack_usage global_options.x_flag_stack_usage +#endif +#ifdef GENERATOR_FILE +extern int flag_detailed_statistics; +#else + int x_flag_detailed_statistics; +#define flag_detailed_statistics global_options.x_flag_detailed_statistics +#endif +#ifdef GENERATOR_FILE +extern int flag_stdarg_opt; +#else + int x_flag_stdarg_opt; +#define flag_stdarg_opt global_options.x_flag_stdarg_opt +#endif +#ifdef GENERATOR_FILE +extern int flag_store_merging; +#else + int x_flag_store_merging; +#define flag_store_merging global_options.x_flag_store_merging +#endif +#ifdef GENERATOR_FILE +extern int flag_strict_aliasing; +#else + int x_flag_strict_aliasing; +#define flag_strict_aliasing global_options.x_flag_strict_aliasing +#endif +#ifdef GENERATOR_FILE +extern int flag_strict_enums; +#else + int x_flag_strict_enums; +#define flag_strict_enums global_options.x_flag_strict_enums +#endif +#ifdef GENERATOR_FILE +extern int flag_strict_overflow; +#else + int x_flag_strict_overflow; +#define flag_strict_overflow global_options.x_flag_strict_overflow +#endif +#ifdef GENERATOR_FILE +extern int flag_strict_volatile_bitfields; +#else + int x_flag_strict_volatile_bitfields; +#define flag_strict_volatile_bitfields global_options.x_flag_strict_volatile_bitfields +#endif +#ifdef GENERATOR_FILE +extern int flag_strong_eval_order; +#else + int x_flag_strong_eval_order; +#define flag_strong_eval_order global_options.x_flag_strong_eval_order +#endif +#ifdef GENERATOR_FILE +extern int flag_sync_libcalls; +#else + int x_flag_sync_libcalls; +#define flag_sync_libcalls global_options.x_flag_sync_libcalls +#endif +#ifdef GENERATOR_FILE +extern int flag_syntax_only; +#else + int x_flag_syntax_only; +#define flag_syntax_only global_options.x_flag_syntax_only +#endif +#ifdef GENERATOR_FILE +extern int template_backtrace_limit; +#else + int x_template_backtrace_limit; +#define template_backtrace_limit global_options.x_template_backtrace_limit +#endif +#ifdef GENERATOR_FILE +extern int flag_test_coverage; +#else + int x_flag_test_coverage; +#define flag_test_coverage global_options.x_flag_test_coverage +#endif +#ifdef GENERATOR_FILE +extern int flag_test_forall_temp; +#else + int x_flag_test_forall_temp; +#define flag_test_forall_temp global_options.x_flag_test_forall_temp +#endif +#ifdef GENERATOR_FILE +extern int flag_thread_jumps; +#else + int x_flag_thread_jumps; +#define flag_thread_jumps global_options.x_flag_thread_jumps +#endif +#ifdef GENERATOR_FILE +extern int flag_threadsafe_statics; +#else + int x_flag_threadsafe_statics; +#define flag_threadsafe_statics global_options.x_flag_threadsafe_statics +#endif +#ifdef GENERATOR_FILE +extern int time_report; +#else + int x_time_report; +#define time_report global_options.x_time_report +#endif +#ifdef GENERATOR_FILE +extern int time_report_details; +#else + int x_time_report_details; +#define time_report_details global_options.x_time_report_details +#endif +#ifdef GENERATOR_FILE +extern enum tls_model flag_tls_default; +#else + enum tls_model x_flag_tls_default; +#define flag_tls_default global_options.x_flag_tls_default +#endif +#ifdef GENERATOR_FILE +extern int flag_toplevel_reorder; +#else + int x_flag_toplevel_reorder; +#define flag_toplevel_reorder global_options.x_flag_toplevel_reorder +#endif +#ifdef GENERATOR_FILE +extern int flag_tracer; +#else + int x_flag_tracer; +#define flag_tracer global_options.x_flag_tracer +#endif +#ifdef GENERATOR_FILE +extern int flag_trampolines; +#else + int x_flag_trampolines; +#define flag_trampolines global_options.x_flag_trampolines +#endif +#ifdef GENERATOR_FILE +extern int flag_trapping_math; +#else + int x_flag_trapping_math; +#define flag_trapping_math global_options.x_flag_trapping_math +#endif +#ifdef GENERATOR_FILE +extern int flag_trapv; +#else + int x_flag_trapv; +#define flag_trapv global_options.x_flag_trapv +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_bit_ccp; +#else + int x_flag_tree_bit_ccp; +#define flag_tree_bit_ccp global_options.x_flag_tree_bit_ccp +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_builtin_call_dce; +#else + int x_flag_tree_builtin_call_dce; +#define flag_tree_builtin_call_dce global_options.x_flag_tree_builtin_call_dce +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_ccp; +#else + int x_flag_tree_ccp; +#define flag_tree_ccp global_options.x_flag_tree_ccp +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_ch; +#else + int x_flag_tree_ch; +#define flag_tree_ch global_options.x_flag_tree_ch +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_coalesce_vars; +#else + int x_flag_tree_coalesce_vars; +#define flag_tree_coalesce_vars global_options.x_flag_tree_coalesce_vars +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_copy_prop; +#else + int x_flag_tree_copy_prop; +#define flag_tree_copy_prop global_options.x_flag_tree_copy_prop +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_cselim; +#else + int x_flag_tree_cselim; +#define flag_tree_cselim global_options.x_flag_tree_cselim +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_dce; +#else + int x_flag_tree_dce; +#define flag_tree_dce global_options.x_flag_tree_dce +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_dom; +#else + int x_flag_tree_dom; +#define flag_tree_dom global_options.x_flag_tree_dom +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_dse; +#else + int x_flag_tree_dse; +#define flag_tree_dse global_options.x_flag_tree_dse +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_forwprop; +#else + int x_flag_tree_forwprop; +#define flag_tree_forwprop global_options.x_flag_tree_forwprop +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_fre; +#else + int x_flag_tree_fre; +#define flag_tree_fre global_options.x_flag_tree_fre +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_loop_distribute_patterns; +#else + int x_flag_tree_loop_distribute_patterns; +#define flag_tree_loop_distribute_patterns global_options.x_flag_tree_loop_distribute_patterns +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_loop_distribution; +#else + int x_flag_tree_loop_distribution; +#define flag_tree_loop_distribution global_options.x_flag_tree_loop_distribution +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_loop_if_convert; +#else + int x_flag_tree_loop_if_convert; +#define flag_tree_loop_if_convert global_options.x_flag_tree_loop_if_convert +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_loop_im; +#else + int x_flag_tree_loop_im; +#define flag_tree_loop_im global_options.x_flag_tree_loop_im +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_loop_ivcanon; +#else + int x_flag_tree_loop_ivcanon; +#define flag_tree_loop_ivcanon global_options.x_flag_tree_loop_ivcanon +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_loop_optimize; +#else + int x_flag_tree_loop_optimize; +#define flag_tree_loop_optimize global_options.x_flag_tree_loop_optimize +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_loop_vectorize; +#else + int x_flag_tree_loop_vectorize; +#define flag_tree_loop_vectorize global_options.x_flag_tree_loop_vectorize +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_live_range_split; +#else + int x_flag_tree_live_range_split; +#define flag_tree_live_range_split global_options.x_flag_tree_live_range_split +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_parallelize_loops; +#else + int x_flag_tree_parallelize_loops; +#define flag_tree_parallelize_loops global_options.x_flag_tree_parallelize_loops +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_partial_pre; +#else + int x_flag_tree_partial_pre; +#define flag_tree_partial_pre global_options.x_flag_tree_partial_pre +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_phiprop; +#else + int x_flag_tree_phiprop; +#define flag_tree_phiprop global_options.x_flag_tree_phiprop +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_pre; +#else + int x_flag_tree_pre; +#define flag_tree_pre global_options.x_flag_tree_pre +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_pta; +#else + int x_flag_tree_pta; +#define flag_tree_pta global_options.x_flag_tree_pta +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_reassoc; +#else + int x_flag_tree_reassoc; +#define flag_tree_reassoc global_options.x_flag_tree_reassoc +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_scev_cprop; +#else + int x_flag_tree_scev_cprop; +#define flag_tree_scev_cprop global_options.x_flag_tree_scev_cprop +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_sink; +#else + int x_flag_tree_sink; +#define flag_tree_sink global_options.x_flag_tree_sink +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_slp_vectorize; +#else + int x_flag_tree_slp_vectorize; +#define flag_tree_slp_vectorize global_options.x_flag_tree_slp_vectorize +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_slsr; +#else + int x_flag_tree_slsr; +#define flag_tree_slsr global_options.x_flag_tree_slsr +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_sra; +#else + int x_flag_tree_sra; +#define flag_tree_sra global_options.x_flag_tree_sra +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_switch_conversion; +#else + int x_flag_tree_switch_conversion; +#define flag_tree_switch_conversion global_options.x_flag_tree_switch_conversion +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_tail_merge; +#else + int x_flag_tree_tail_merge; +#define flag_tree_tail_merge global_options.x_flag_tree_tail_merge +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_ter; +#else + int x_flag_tree_ter; +#define flag_tree_ter global_options.x_flag_tree_ter +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_vectorize; +#else + int x_flag_tree_vectorize; +#define flag_tree_vectorize global_options.x_flag_tree_vectorize +#endif +#ifdef GENERATOR_FILE +extern int flag_tree_vrp; +#else + int x_flag_tree_vrp; +#define flag_tree_vrp global_options.x_flag_tree_vrp +#endif +#ifdef GENERATOR_FILE +extern int flag_unconstrained_commons; +#else + int x_flag_unconstrained_commons; +#define flag_unconstrained_commons global_options.x_flag_unconstrained_commons +#endif +#ifdef GENERATOR_FILE +extern int flag_underscoring; +#else + int x_flag_underscoring; +#define flag_underscoring global_options.x_flag_underscoring +#endif +#ifdef GENERATOR_FILE +extern int flag_unit_at_a_time; +#else + int x_flag_unit_at_a_time; +#define flag_unit_at_a_time global_options.x_flag_unit_at_a_time +#endif +#ifdef GENERATOR_FILE +extern int flag_unroll_all_loops; +#else + int x_flag_unroll_all_loops; +#define flag_unroll_all_loops global_options.x_flag_unroll_all_loops +#endif +#ifdef GENERATOR_FILE +extern int flag_unroll_loops; +#else + int x_flag_unroll_loops; +#define flag_unroll_loops global_options.x_flag_unroll_loops +#endif +#ifdef GENERATOR_FILE +extern int flag_unsafe_math_optimizations; +#else + int x_flag_unsafe_math_optimizations; +#define flag_unsafe_math_optimizations global_options.x_flag_unsafe_math_optimizations +#endif +#ifdef GENERATOR_FILE +extern int flag_unswitch_loops; +#else + int x_flag_unswitch_loops; +#define flag_unswitch_loops global_options.x_flag_unswitch_loops +#endif +#ifdef GENERATOR_FILE +extern int flag_unwind_tables; +#else + int x_flag_unwind_tables; +#define flag_unwind_tables global_options.x_flag_unwind_tables +#endif +#ifdef GENERATOR_FILE +extern int flag_use_cxa_atexit; +#else + int x_flag_use_cxa_atexit; +#define flag_use_cxa_atexit global_options.x_flag_use_cxa_atexit +#endif +#ifdef GENERATOR_FILE +extern int flag_use_cxa_get_exception_ptr; +#else + int x_flag_use_cxa_get_exception_ptr; +#define flag_use_cxa_get_exception_ptr global_options.x_flag_use_cxa_get_exception_ptr +#endif +#ifdef GENERATOR_FILE +extern int flag_use_linker_plugin; +#else + int x_flag_use_linker_plugin; +#define flag_use_linker_plugin global_options.x_flag_use_linker_plugin +#endif +#ifdef GENERATOR_FILE +extern int flag_var_tracking; +#else + int x_flag_var_tracking; +#define flag_var_tracking global_options.x_flag_var_tracking +#endif +#ifdef GENERATOR_FILE +extern int flag_var_tracking_assignments; +#else + int x_flag_var_tracking_assignments; +#define flag_var_tracking_assignments global_options.x_flag_var_tracking_assignments +#endif +#ifdef GENERATOR_FILE +extern int flag_var_tracking_assignments_toggle; +#else + int x_flag_var_tracking_assignments_toggle; +#define flag_var_tracking_assignments_toggle global_options.x_flag_var_tracking_assignments_toggle +#endif +#ifdef GENERATOR_FILE +extern int flag_var_tracking_uninit; +#else + int x_flag_var_tracking_uninit; +#define flag_var_tracking_uninit global_options.x_flag_var_tracking_uninit +#endif +#ifdef GENERATOR_FILE +extern int flag_variable_expansion_in_unroller; +#else + int x_flag_variable_expansion_in_unroller; +#define flag_variable_expansion_in_unroller global_options.x_flag_variable_expansion_in_unroller +#endif +#ifdef GENERATOR_FILE +extern enum vect_cost_model flag_vect_cost_model; +#else + enum vect_cost_model x_flag_vect_cost_model; +#define flag_vect_cost_model global_options.x_flag_vect_cost_model +#endif +#ifdef GENERATOR_FILE +extern int flag_verbose_asm; +#else + int x_flag_verbose_asm; +#define flag_verbose_asm global_options.x_flag_verbose_asm +#endif +#ifdef GENERATOR_FILE +extern int flag_visibility_ms_compat; +#else + int x_flag_visibility_ms_compat; +#define flag_visibility_ms_compat global_options.x_flag_visibility_ms_compat +#endif +#ifdef GENERATOR_FILE +extern enum symbol_visibility default_visibility; +#else + enum symbol_visibility x_default_visibility; +#define default_visibility global_options.x_default_visibility +#endif +#ifdef GENERATOR_FILE +extern int flag_value_profile_transformations; +#else + int x_flag_value_profile_transformations; +#define flag_value_profile_transformations global_options.x_flag_value_profile_transformations +#endif +#ifdef GENERATOR_FILE +extern enum vtv_priority flag_vtable_verify; +#else + enum vtv_priority x_flag_vtable_verify; +#define flag_vtable_verify global_options.x_flag_vtable_verify +#endif +#ifdef GENERATOR_FILE +extern int flag_vtv_counts; +#else + int x_flag_vtv_counts; +#define flag_vtv_counts global_options.x_flag_vtv_counts +#endif +#ifdef GENERATOR_FILE +extern int flag_vtv_debug; +#else + int x_flag_vtv_debug; +#define flag_vtv_debug global_options.x_flag_vtv_debug +#endif +#ifdef GENERATOR_FILE +extern int flag_weak; +#else + int x_flag_weak; +#define flag_weak global_options.x_flag_weak +#endif +#ifdef GENERATOR_FILE +extern int flag_web; +#else + int x_flag_web; +#define flag_web global_options.x_flag_web +#endif +#ifdef GENERATOR_FILE +extern int flag_whole_program; +#else + int x_flag_whole_program; +#define flag_whole_program global_options.x_flag_whole_program +#endif +#ifdef GENERATOR_FILE +extern int flag_working_directory; +#else + int x_flag_working_directory; +#define flag_working_directory global_options.x_flag_working_directory +#endif +#ifdef GENERATOR_FILE +extern const char *flag_wpa; +#else + const char *x_flag_wpa; +#define flag_wpa global_options.x_flag_wpa +#endif +#ifdef GENERATOR_FILE +extern int flag_wrapv; +#else + int x_flag_wrapv; +#define flag_wrapv global_options.x_flag_wrapv +#endif +#ifdef GENERATOR_FILE +extern int flag_zero_initialized_in_bss; +#else + int x_flag_zero_initialized_in_bss; +#define flag_zero_initialized_in_bss global_options.x_flag_zero_initialized_in_bss +#endif +#ifdef GENERATOR_FILE +extern int flag_zero_link; +#else + int x_flag_zero_link; +#define flag_zero_link global_options.x_flag_zero_link +#endif +#ifdef GENERATOR_FILE +extern int debug_column_info; +#else + int x_debug_column_info; +#define debug_column_info global_options.x_debug_column_info +#endif +#ifdef GENERATOR_FILE +extern int dwarf_version; +#else + int x_dwarf_version; +#define dwarf_version global_options.x_dwarf_version +#endif +#ifdef GENERATOR_FILE +extern int flag_gen_declaration; +#else + int x_flag_gen_declaration; +#define flag_gen_declaration global_options.x_flag_gen_declaration +#endif +#ifdef GENERATOR_FILE +extern int debug_generate_pub_sections; +#else + int x_debug_generate_pub_sections; +#define debug_generate_pub_sections global_options.x_debug_generate_pub_sections +#endif +#ifdef GENERATOR_FILE +extern int dwarf_record_gcc_switches; +#else + int x_dwarf_record_gcc_switches; +#define dwarf_record_gcc_switches global_options.x_dwarf_record_gcc_switches +#endif +#ifdef GENERATOR_FILE +extern int dwarf_split_debug_info; +#else + int x_dwarf_split_debug_info; +#define dwarf_split_debug_info global_options.x_dwarf_split_debug_info +#endif +#ifdef GENERATOR_FILE +extern int dwarf_strict; +#else + int x_dwarf_strict; +#define dwarf_strict global_options.x_dwarf_strict +#endif +#ifdef GENERATOR_FILE +extern int flag_gtoggle; +#else + int x_flag_gtoggle; +#define flag_gtoggle global_options.x_flag_gtoggle +#endif +#ifdef GENERATOR_FILE +extern const char *imultiarch; +#else + const char *x_imultiarch; +#define imultiarch global_options.x_imultiarch +#endif +#ifdef GENERATOR_FILE +extern const char *plugindir_string; +#else + const char *x_plugindir_string; +#define plugindir_string global_options.x_plugindir_string +#endif +#ifdef GENERATOR_FILE +extern int mips_abi; +#else + int x_mips_abi; +#define mips_abi global_options.x_mips_abi +#endif +#ifdef GENERATOR_FILE +extern int mips_abs; +#else + int x_mips_abs; +#define mips_abs global_options.x_mips_abs +#endif +#ifdef GENERATOR_FILE +extern int flag_android; +#else + int x_flag_android; +#define flag_android global_options.x_flag_android +#endif +#ifdef GENERATOR_FILE +extern int mips_arch_option; +#else + int x_mips_arch_option; +#define mips_arch_option global_options.x_mips_arch_option +#endif +#ifdef GENERATOR_FILE +extern int linux_libc; +#else + int x_linux_libc; +#define linux_libc global_options.x_linux_libc +#endif +#ifdef GENERATOR_FILE +extern int mips_branch_cost; +#else + int x_mips_branch_cost; +#define mips_branch_cost global_options.x_mips_branch_cost +#endif +#ifdef GENERATOR_FILE +extern enum mips_code_readable_setting mips_code_readable; +#else + enum mips_code_readable_setting x_mips_code_readable; +#define mips_code_readable global_options.x_mips_code_readable +#endif +#ifdef GENERATOR_FILE +extern enum mips_cb_setting mips_cb; +#else + enum mips_cb_setting x_mips_cb; +#define mips_cb global_options.x_mips_cb +#endif +#ifdef GENERATOR_FILE +extern int TARGET_DEBUG_MODE; +#else + int x_TARGET_DEBUG_MODE; +#define TARGET_DEBUG_MODE global_options.x_TARGET_DEBUG_MODE +#endif +#ifdef GENERATOR_FILE +extern int TARGET_DEBUG_D_MODE; +#else + int x_TARGET_DEBUG_D_MODE; +#define TARGET_DEBUG_D_MODE global_options.x_TARGET_DEBUG_D_MODE +#endif +#ifdef GENERATOR_FILE +extern int TARGET_MDMX; +#else + int x_TARGET_MDMX; +#define TARGET_MDMX global_options.x_TARGET_MDMX +#endif +#ifdef GENERATOR_FILE +extern int TARGET_DSP; +#else + int x_TARGET_DSP; +#define TARGET_DSP global_options.x_TARGET_DSP +#endif +#ifdef GENERATOR_FILE +extern int TARGET_DSPR2; +#else + int x_TARGET_DSPR2; +#define TARGET_DSPR2 global_options.x_TARGET_DSPR2 +#endif +#ifdef GENERATOR_FILE +extern int TARGET_EMBEDDED_DATA; +#else + int x_TARGET_EMBEDDED_DATA; +#define TARGET_EMBEDDED_DATA global_options.x_TARGET_EMBEDDED_DATA +#endif +#ifdef GENERATOR_FILE +extern int TARGET_EVA; +#else + int x_TARGET_EVA; +#define TARGET_EVA global_options.x_TARGET_EVA +#endif +#ifdef GENERATOR_FILE +extern int TARGET_EXTERN_SDATA; +#else + int x_TARGET_EXTERN_SDATA; +#define TARGET_EXTERN_SDATA global_options.x_TARGET_EXTERN_SDATA +#endif +#ifdef GENERATOR_FILE +extern int TARGET_FIX_24K; +#else + int x_TARGET_FIX_24K; +#define TARGET_FIX_24K global_options.x_TARGET_FIX_24K +#endif +#ifdef GENERATOR_FILE +extern int TARGET_FIX_RM7000; +#else + int x_TARGET_FIX_RM7000; +#define TARGET_FIX_RM7000 global_options.x_TARGET_FIX_RM7000 +#endif +#ifdef GENERATOR_FILE +extern int TARGET_FIX_SB1; +#else + int x_TARGET_FIX_SB1; +#define TARGET_FIX_SB1 global_options.x_TARGET_FIX_SB1 +#endif +#ifdef GENERATOR_FILE +extern int TARGET_FIX_VR4120; +#else + int x_TARGET_FIX_VR4120; +#define TARGET_FIX_VR4120 global_options.x_TARGET_FIX_VR4120 +#endif +#ifdef GENERATOR_FILE +extern int TARGET_FIX_VR4130; +#else + int x_TARGET_FIX_VR4130; +#define TARGET_FIX_VR4130 global_options.x_TARGET_FIX_VR4130 +#endif +#ifdef GENERATOR_FILE +extern int TARGET_4300_MUL_FIX; +#else + int x_TARGET_4300_MUL_FIX; +#define TARGET_4300_MUL_FIX global_options.x_TARGET_4300_MUL_FIX +#endif +#ifdef GENERATOR_FILE +extern int TARGET_FLIP_MIPS16; +#else + int x_TARGET_FLIP_MIPS16; +#define TARGET_FLIP_MIPS16 global_options.x_TARGET_FLIP_MIPS16 +#endif +#ifdef GENERATOR_FILE +extern const char *mips_cache_flush_func; +#else + const char *x_mips_cache_flush_func; +#define mips_cache_flush_func global_options.x_mips_cache_flush_func +#endif +#ifdef GENERATOR_FILE +extern int TARGET_FP_EXCEPTIONS; +#else + int x_TARGET_FP_EXCEPTIONS; +#define TARGET_FP_EXCEPTIONS global_options.x_TARGET_FP_EXCEPTIONS +#endif +#ifdef GENERATOR_FILE +extern int flag_frame_header_optimization; +#else + int x_flag_frame_header_optimization; +#define flag_frame_header_optimization global_options.x_flag_frame_header_optimization +#endif +#ifdef GENERATOR_FILE +extern int TARGET_GPOPT; +#else + int x_TARGET_GPOPT; +#define TARGET_GPOPT global_options.x_TARGET_GPOPT +#endif +#ifdef GENERATOR_FILE +extern int TARGET_INTERLINK_COMPRESSED; +#else + int x_TARGET_INTERLINK_COMPRESSED; +#define TARGET_INTERLINK_COMPRESSED global_options.x_TARGET_INTERLINK_COMPRESSED +#endif +#ifdef GENERATOR_FILE +extern int mips_isa_option; +#else + int x_mips_isa_option; +#define mips_isa_option global_options.x_mips_isa_option +#endif +#ifdef GENERATOR_FILE +extern int TARGET_MIPS3D; +#else + int x_TARGET_MIPS3D; +#define TARGET_MIPS3D global_options.x_TARGET_MIPS3D +#endif +#ifdef GENERATOR_FILE +extern int TARGET_LOAD_STORE_PAIRS; +#else + int x_TARGET_LOAD_STORE_PAIRS; +#define TARGET_LOAD_STORE_PAIRS global_options.x_TARGET_LOAD_STORE_PAIRS +#endif +#ifdef GENERATOR_FILE +extern int TARGET_LOCAL_SDATA; +#else + int x_TARGET_LOCAL_SDATA; +#define TARGET_LOCAL_SDATA global_options.x_TARGET_LOCAL_SDATA +#endif +#ifdef GENERATOR_FILE +extern int TARGET_LONG_CALLS; +#else + int x_TARGET_LONG_CALLS; +#define TARGET_LONG_CALLS global_options.x_TARGET_LONG_CALLS +#endif +#ifdef GENERATOR_FILE +extern int mips_lra_flag; +#else + int x_mips_lra_flag; +#define mips_lra_flag global_options.x_mips_lra_flag +#endif +#ifdef GENERATOR_FILE +extern int mips_lxc1_sxc1; +#else + int x_mips_lxc1_sxc1; +#define mips_lxc1_sxc1 global_options.x_mips_lxc1_sxc1 +#endif +#ifdef GENERATOR_FILE +extern int TARGET_MAD; +#else + int x_TARGET_MAD; +#define TARGET_MAD global_options.x_TARGET_MAD +#endif +#ifdef GENERATOR_FILE +extern int mips_madd4; +#else + int x_mips_madd4; +#define mips_madd4 global_options.x_mips_madd4 +#endif +#ifdef GENERATOR_FILE +extern int TARGET_MCOUNT_RA_ADDRESS; +#else + int x_TARGET_MCOUNT_RA_ADDRESS; +#define TARGET_MCOUNT_RA_ADDRESS global_options.x_TARGET_MCOUNT_RA_ADDRESS +#endif +#ifdef GENERATOR_FILE +extern int TARGET_MCU; +#else + int x_TARGET_MCU; +#define TARGET_MCU global_options.x_TARGET_MCU +#endif +#ifdef GENERATOR_FILE +extern int TARGET_MSA; +#else + int x_TARGET_MSA; +#define TARGET_MSA global_options.x_TARGET_MSA +#endif +#ifdef GENERATOR_FILE +extern int TARGET_MT; +#else + int x_TARGET_MT; +#define TARGET_MT global_options.x_TARGET_MT +#endif +#ifdef GENERATOR_FILE +extern int mips_nan; +#else + int x_mips_nan; +#define mips_nan global_options.x_mips_nan +#endif +#ifdef GENERATOR_FILE +extern int TARGET_NO_FLOAT; +#else + int x_TARGET_NO_FLOAT; +#define TARGET_NO_FLOAT global_options.x_TARGET_NO_FLOAT +#endif +#ifdef GENERATOR_FILE +extern int TARGET_PLT; +#else + int x_TARGET_PLT; +#define TARGET_PLT global_options.x_TARGET_PLT +#endif +#ifdef GENERATOR_FILE +extern enum mips_r10k_cache_barrier_setting mips_r10k_cache_barrier; +#else + enum mips_r10k_cache_barrier_setting x_mips_r10k_cache_barrier; +#define mips_r10k_cache_barrier global_options.x_mips_r10k_cache_barrier +#endif +#ifdef GENERATOR_FILE +extern int TARGET_SHARED; +#else + int x_TARGET_SHARED; +#define TARGET_SHARED global_options.x_TARGET_SHARED +#endif +#ifdef GENERATOR_FILE +extern int TARGET_SYM32; +#else + int x_TARGET_SYM32; +#define TARGET_SYM32 global_options.x_TARGET_SYM32 +#endif +#ifdef GENERATOR_FILE +extern int mips_tune_option; +#else + int x_mips_tune_option; +#define mips_tune_option global_options.x_mips_tune_option +#endif +#ifdef GENERATOR_FILE +extern int TARGET_UNINIT_CONST_IN_RODATA; +#else + int x_TARGET_UNINIT_CONST_IN_RODATA; +#define TARGET_UNINIT_CONST_IN_RODATA global_options.x_TARGET_UNINIT_CONST_IN_RODATA +#endif +#ifdef GENERATOR_FILE +extern int TARGET_VIRT; +#else + int x_TARGET_VIRT; +#define TARGET_VIRT global_options.x_TARGET_VIRT +#endif +#ifdef GENERATOR_FILE +extern int TARGET_XGOT; +#else + int x_TARGET_XGOT; +#define TARGET_XGOT global_options.x_TARGET_XGOT +#endif +#ifdef GENERATOR_FILE +extern int TARGET_XPA; +#else + int x_TARGET_XPA; +#define TARGET_XPA global_options.x_TARGET_XPA +#endif +#ifdef GENERATOR_FILE +extern const char *asm_file_name; +#else + const char *x_asm_file_name; +#define asm_file_name global_options.x_asm_file_name +#endif +#ifdef GENERATOR_FILE +extern int pass_exit_codes; +#else + int x_pass_exit_codes; +#define pass_exit_codes global_options.x_pass_exit_codes +#endif +#ifdef GENERATOR_FILE +extern int flag_pedantic_errors; +#else + int x_flag_pedantic_errors; +#define flag_pedantic_errors global_options.x_flag_pedantic_errors +#endif +#ifdef GENERATOR_FILE +extern int use_pipes; +#else + int x_use_pipes; +#define use_pipes global_options.x_use_pipes +#endif +#ifdef GENERATOR_FILE +extern const char *print_file_name; +#else + const char *x_print_file_name; +#define print_file_name global_options.x_print_file_name +#endif +#ifdef GENERATOR_FILE +extern int print_multi_directory; +#else + int x_print_multi_directory; +#define print_multi_directory global_options.x_print_multi_directory +#endif +#ifdef GENERATOR_FILE +extern int print_multi_lib; +#else + int x_print_multi_lib; +#define print_multi_lib global_options.x_print_multi_lib +#endif +#ifdef GENERATOR_FILE +extern int print_multi_os_directory; +#else + int x_print_multi_os_directory; +#define print_multi_os_directory global_options.x_print_multi_os_directory +#endif +#ifdef GENERATOR_FILE +extern int print_multiarch; +#else + int x_print_multiarch; +#define print_multiarch global_options.x_print_multiarch +#endif +#ifdef GENERATOR_FILE +extern const char *print_prog_name; +#else + const char *x_print_prog_name; +#define print_prog_name global_options.x_print_prog_name +#endif +#ifdef GENERATOR_FILE +extern int print_search_dirs; +#else + int x_print_search_dirs; +#define print_search_dirs global_options.x_print_search_dirs +#endif +#ifdef GENERATOR_FILE +extern int print_sysroot; +#else + int x_print_sysroot; +#define print_sysroot global_options.x_print_sysroot +#endif +#ifdef GENERATOR_FILE +extern int print_sysroot_headers_suffix; +#else + int x_print_sysroot_headers_suffix; +#define print_sysroot_headers_suffix global_options.x_print_sysroot_headers_suffix +#endif +#ifdef GENERATOR_FILE +extern int quiet_flag; +#else + int x_quiet_flag; +#define quiet_flag global_options.x_quiet_flag +#endif +#ifdef GENERATOR_FILE +extern int report_times; +#else + int x_report_times; +#define report_times global_options.x_report_times +#endif +#ifdef GENERATOR_FILE +extern int flag_undef; +#else + int x_flag_undef; +#define flag_undef global_options.x_flag_undef +#endif +#ifdef GENERATOR_FILE +extern int verbose_flag; +#else + int x_verbose_flag; +#define verbose_flag global_options.x_verbose_flag +#endif +#ifdef GENERATOR_FILE +extern int version_flag; +#else + int x_version_flag; +#define version_flag global_options.x_version_flag +#endif +#ifdef GENERATOR_FILE +extern int inhibit_warnings; +#else + int x_inhibit_warnings; +#define inhibit_warnings global_options.x_inhibit_warnings +#endif +#ifdef GENERATOR_FILE +extern const char *wrapper_string; +#else + const char *x_wrapper_string; +#define wrapper_string global_options.x_wrapper_string +#endif +#ifndef GENERATOR_FILE + int x_VAR_mno_flush_func; +#define x_VAR_mno_flush_func do_not_use +#endif +#ifndef GENERATOR_FILE + bool frontend_set_flag_associative_math; +#endif +#ifndef GENERATOR_FILE + bool frontend_set_flag_cx_limited_range; +#endif +#ifndef GENERATOR_FILE + bool frontend_set_flag_excess_precision_cmdline; +#endif +#ifndef GENERATOR_FILE + bool frontend_set_flag_finite_math_only; +#endif +#ifndef GENERATOR_FILE + bool frontend_set_flag_errno_math; +#endif +#ifndef GENERATOR_FILE + bool frontend_set_flag_reciprocal_math; +#endif +#ifndef GENERATOR_FILE + bool frontend_set_flag_rounding_math; +#endif +#ifndef GENERATOR_FILE + bool frontend_set_flag_signaling_nans; +#endif +#ifndef GENERATOR_FILE + bool frontend_set_flag_signed_zeros; +#endif +#ifndef GENERATOR_FILE + bool frontend_set_flag_trapping_math; +#endif +#ifndef GENERATOR_FILE + bool frontend_set_flag_unsafe_math_optimizations; +#endif +#ifndef GENERATOR_FILE +}; +extern struct gcc_options global_options; +extern const struct gcc_options global_options_init; +extern struct gcc_options global_options_set; +#define target_flags_explicit global_options_set.x_target_flags +#endif +#endif + +#if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) && !defined(IN_RTS) + +/* Structure to save/restore optimization and target specific options. */ +struct GTY(()) cl_optimization +{ + int x_align_functions; + int x_align_jumps; + int x_align_labels; + int x_align_loops; + int x_flag_sched_stalled_insns; + int x_flag_sched_stalled_insns_dep; + int x_flag_tree_parallelize_loops; + enum fp_contract_mode x_flag_fp_contract_mode; + enum ira_algorithm x_flag_ira_algorithm; + enum ira_region x_flag_ira_region; + enum reorder_blocks_algorithm x_flag_reorder_blocks_algorithm; + enum vect_cost_model x_flag_simd_cost_model; + enum stack_reuse_level x_flag_stack_reuse; + enum vect_cost_model x_flag_vect_cost_model; + unsigned char x_optimize; + unsigned char x_optimize_size; + unsigned char x_optimize_debug; + signed char x_flag_aggressive_loop_optimizations; + signed char x_flag_associative_math; + signed char x_flag_asynchronous_unwind_tables; + signed char x_flag_auto_inc_dec; + signed char x_flag_branch_on_count_reg; + signed char x_flag_branch_probabilities; + signed char x_flag_branch_target_load_optimize; + signed char x_flag_branch_target_load_optimize2; + signed char x_flag_btr_bb_exclusive; + signed char x_flag_caller_saves; + signed char x_flag_code_hoisting; + signed char x_flag_combine_stack_adjustments; + signed char x_flag_compare_elim_after_reload; + signed char x_flag_conserve_stack; + signed char x_flag_cprop_registers; + signed char x_flag_crossjumping; + signed char x_flag_cse_follow_jumps; + signed char x_flag_cx_fortran_rules; + signed char x_flag_cx_limited_range; + signed char x_flag_dce; + signed char x_flag_defer_pop; + signed char x_flag_delayed_branch; + signed char x_flag_delete_dead_exceptions; + signed char x_flag_delete_null_pointer_checks; + signed char x_flag_devirtualize; + signed char x_flag_devirtualize_speculatively; + signed char x_flag_dse; + signed char x_flag_early_inlining; + signed char x_flag_exceptions; + signed char x_flag_expensive_optimizations; + signed char x_flag_finite_math_only; + signed char x_flag_float_store; + signed char x_flag_forward_propagate; + signed char x_flag_fp_int_builtin_inexact; + signed char x_flag_no_function_cse; + signed char x_flag_gcse; + signed char x_flag_gcse_after_reload; + signed char x_flag_gcse_las; + signed char x_flag_gcse_lm; + signed char x_flag_gcse_sm; + signed char x_flag_graphite; + signed char x_flag_graphite_identity; + signed char x_flag_guess_branch_prob; + signed char x_flag_hoist_adjacent_loads; + signed char x_flag_if_conversion; + signed char x_flag_if_conversion2; + signed char x_flag_indirect_inlining; + signed char x_flag_no_inline; + signed char x_flag_inline_atomics; + signed char x_flag_inline_functions; + signed char x_flag_inline_functions_called_once; + signed char x_flag_inline_small_functions; + signed char x_flag_ipa_bit_cp; + signed char x_flag_ipa_cp; + signed char x_flag_ipa_cp_clone; + signed char x_flag_ipa_icf; + signed char x_flag_ipa_icf_functions; + signed char x_flag_ipa_icf_variables; + signed char x_flag_ipa_profile; + signed char x_flag_ipa_pta; + signed char x_flag_ipa_pure_const; + signed char x_flag_ipa_ra; + signed char x_flag_ipa_reference; + signed char x_flag_ipa_sra; + signed char x_flag_ipa_vrp; + signed char x_flag_ira_hoist_pressure; + signed char x_flag_ira_loop_pressure; + signed char x_flag_ira_share_save_slots; + signed char x_flag_ira_share_spill_slots; + signed char x_flag_isolate_erroneous_paths_attribute; + signed char x_flag_isolate_erroneous_paths_dereference; + signed char x_flag_ivopts; + signed char x_flag_jump_tables; + signed char x_flag_keep_gc_roots_live; + signed char x_flag_lifetime_dse; + signed char x_flag_limit_function_alignment; + signed char x_flag_live_range_shrinkage; + signed char x_flag_loop_nest_optimize; + signed char x_flag_loop_parallelize_all; + signed char x_flag_lra_remat; + signed char x_flag_errno_math; + signed char x_flag_modulo_sched; + signed char x_flag_modulo_sched_allow_regmoves; + signed char x_flag_move_loop_invariants; + signed char x_flag_non_call_exceptions; + signed char x_flag_nothrow_opt; + signed char x_flag_omit_frame_pointer; + signed char x_flag_opt_info; + signed char x_flag_optimize_sibling_calls; + signed char x_flag_optimize_strlen; + signed char x_flag_pack_struct; + signed char x_flag_partial_inlining; + signed char x_flag_peel_loops; + signed char x_flag_no_peephole; + signed char x_flag_peephole2; + signed char x_flag_plt; + signed char x_flag_predictive_commoning; + signed char x_flag_prefetch_loop_arrays; + signed char x_flag_printf_return_value; + signed char x_flag_reciprocal_math; + signed char x_flag_pcc_struct_return; + signed char x_flag_rename_registers; + signed char x_flag_reorder_blocks; + signed char x_flag_reorder_blocks_and_partition; + signed char x_flag_reorder_functions; + signed char x_flag_rerun_cse_after_loop; + signed char x_flag_resched_modulo_sched; + signed char x_flag_rounding_math; + signed char x_flag_rtti; + signed char x_flag_sched_critical_path_heuristic; + signed char x_flag_sched_dep_count_heuristic; + signed char x_flag_sched_group_heuristic; + signed char x_flag_schedule_interblock; + signed char x_flag_sched_last_insn_heuristic; + signed char x_flag_sched_pressure; + signed char x_flag_sched_rank_heuristic; + signed char x_flag_schedule_speculative; + signed char x_flag_sched_spec_insn_heuristic; + signed char x_flag_schedule_speculative_load; + signed char x_flag_schedule_speculative_load_dangerous; + signed char x_flag_sched2_use_superblocks; + signed char x_flag_schedule_fusion; + signed char x_flag_schedule_insns; + signed char x_flag_schedule_insns_after_reload; + signed char x_flag_section_anchors; + signed char x_flag_sel_sched_pipelining; + signed char x_flag_sel_sched_pipelining_outer_loops; + signed char x_flag_sel_sched_reschedule_pipelined; + signed char x_flag_selective_scheduling; + signed char x_flag_selective_scheduling2; + signed char x_flag_short_enums; + signed char x_flag_short_wchar; + signed char x_flag_shrink_wrap; + signed char x_flag_shrink_wrap_separate; + signed char x_flag_signaling_nans; + signed char x_flag_signed_zeros; + signed char x_flag_single_precision_constant; + signed char x_flag_split_ivs_in_unroller; + signed char x_flag_split_loops; + signed char x_flag_split_paths; + signed char x_flag_split_wide_types; + signed char x_flag_ssa_backprop; + signed char x_flag_ssa_phiopt; + signed char x_flag_stack_protect; + signed char x_flag_stdarg_opt; + signed char x_flag_store_merging; + signed char x_flag_strict_aliasing; + signed char x_flag_strict_enums; + signed char x_flag_strict_overflow; + signed char x_flag_strict_volatile_bitfields; + signed char x_flag_thread_jumps; + signed char x_flag_threadsafe_statics; + signed char x_flag_tracer; + signed char x_flag_trapping_math; + signed char x_flag_trapv; + signed char x_flag_tree_bit_ccp; + signed char x_flag_tree_builtin_call_dce; + signed char x_flag_tree_ccp; + signed char x_flag_tree_ch; + signed char x_flag_tree_coalesce_vars; + signed char x_flag_tree_copy_prop; + signed char x_flag_tree_cselim; + signed char x_flag_tree_dce; + signed char x_flag_tree_dom; + signed char x_flag_tree_dse; + signed char x_flag_tree_forwprop; + signed char x_flag_tree_fre; + signed char x_flag_tree_loop_distribute_patterns; + signed char x_flag_tree_loop_distribution; + signed char x_flag_tree_loop_if_convert; + signed char x_flag_tree_loop_im; + signed char x_flag_tree_loop_ivcanon; + signed char x_flag_tree_loop_optimize; + signed char x_flag_tree_loop_vectorize; + signed char x_flag_tree_live_range_split; + signed char x_flag_tree_partial_pre; + signed char x_flag_tree_phiprop; + signed char x_flag_tree_pre; + signed char x_flag_tree_pta; + signed char x_flag_tree_reassoc; + signed char x_flag_tree_scev_cprop; + signed char x_flag_tree_sink; + signed char x_flag_tree_slp_vectorize; + signed char x_flag_tree_slsr; + signed char x_flag_tree_sra; + signed char x_flag_tree_switch_conversion; + signed char x_flag_tree_tail_merge; + signed char x_flag_tree_ter; + signed char x_flag_tree_vectorize; + signed char x_flag_tree_vrp; + signed char x_flag_unconstrained_commons; + signed char x_flag_unroll_all_loops; + signed char x_flag_unroll_loops; + signed char x_flag_unsafe_math_optimizations; + signed char x_flag_unswitch_loops; + signed char x_flag_unwind_tables; + signed char x_flag_var_tracking; + signed char x_flag_var_tracking_assignments; + signed char x_flag_var_tracking_assignments_toggle; + signed char x_flag_var_tracking_uninit; + signed char x_flag_variable_expansion_in_unroller; + signed char x_flag_value_profile_transformations; + signed char x_flag_web; + signed char x_flag_wrapv; + signed char x_flag_frame_header_optimization; +}; + +/* Structure to save/restore selected target specific options. */ +struct GTY(()) cl_target_option +{ + signed char x_mips_lra_flag; +}; + + +/* Save optimization variables into a structure. */ +extern void cl_optimization_save (struct cl_optimization *, struct gcc_options *); + +/* Restore optimization variables from a structure. */ +extern void cl_optimization_restore (struct gcc_options *, struct cl_optimization *); + +/* Print optimization variables from a structure. */ +extern void cl_optimization_print (FILE *, int, struct cl_optimization *); + +/* Print different optimization variables from structures provided as arguments. */ +extern void cl_optimization_print_diff (FILE *, int, cl_optimization *ptr1, cl_optimization *ptr2); + +/* Save selected option variables into a structure. */ +extern void cl_target_option_save (struct cl_target_option *, struct gcc_options *); + +/* Restore selected option variables from a structure. */ +extern void cl_target_option_restore (struct gcc_options *, struct cl_target_option *); + +/* Print target option variables from a structure. */ +extern void cl_target_option_print (FILE *, int, struct cl_target_option *); + +/* Print different target option variables from structures provided as arguments. */ +extern void cl_target_option_print_diff (FILE *, int, cl_target_option *ptr1, cl_target_option *ptr2); + +/* Compare two target option variables from a structure. */ +extern bool cl_target_option_eq (const struct cl_target_option *, const struct cl_target_option *); + +/* Hash option variables from a structure. */ +extern hashval_t cl_target_option_hash (const struct cl_target_option *); + +/* Hash optimization from a structure. */ +extern hashval_t cl_optimization_hash (const struct cl_optimization *); + +/* Generator files may not have access to location_t, and don't need these. */ +#if defined(UNKNOWN_LOCATION) +bool +common_handle_option_auto (struct gcc_options *opts, + struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + unsigned int lang_mask, int kind, + location_t loc, + const struct cl_option_handlers *handlers, + diagnostic_context *dc); +bool +Ada_handle_option_auto (struct gcc_options *opts, + struct gcc_options *opts_set, + size_t scode, const char *arg, int value, + unsigned int lang_mask, int kind, + location_t loc, + const struct cl_option_handlers *handlers, + diagnostic_context *dc); +bool +AdaSCIL_handle_option_auto (struct gcc_options *opts, + struct gcc_options *opts_set, + size_t scode, const char *arg, int value, + unsigned int lang_mask, int kind, + location_t loc, + const struct cl_option_handlers *handlers, + diagnostic_context *dc); +bool +AdaWhy_handle_option_auto (struct gcc_options *opts, + struct gcc_options *opts_set, + size_t scode, const char *arg, int value, + unsigned int lang_mask, int kind, + location_t loc, + const struct cl_option_handlers *handlers, + diagnostic_context *dc); +bool +BRIG_handle_option_auto (struct gcc_options *opts, + struct gcc_options *opts_set, + size_t scode, const char *arg, int value, + unsigned int lang_mask, int kind, + location_t loc, + const struct cl_option_handlers *handlers, + diagnostic_context *dc); +bool +C_handle_option_auto (struct gcc_options *opts, + struct gcc_options *opts_set, + size_t scode, const char *arg, int value, + unsigned int lang_mask, int kind, + location_t loc, + const struct cl_option_handlers *handlers, + diagnostic_context *dc); +bool +CXX_handle_option_auto (struct gcc_options *opts, + struct gcc_options *opts_set, + size_t scode, const char *arg, int value, + unsigned int lang_mask, int kind, + location_t loc, + const struct cl_option_handlers *handlers, + diagnostic_context *dc); +bool +Fortran_handle_option_auto (struct gcc_options *opts, + struct gcc_options *opts_set, + size_t scode, const char *arg, int value, + unsigned int lang_mask, int kind, + location_t loc, + const struct cl_option_handlers *handlers, + diagnostic_context *dc); +bool +Go_handle_option_auto (struct gcc_options *opts, + struct gcc_options *opts_set, + size_t scode, const char *arg, int value, + unsigned int lang_mask, int kind, + location_t loc, + const struct cl_option_handlers *handlers, + diagnostic_context *dc); +bool +LTO_handle_option_auto (struct gcc_options *opts, + struct gcc_options *opts_set, + size_t scode, const char *arg, int value, + unsigned int lang_mask, int kind, + location_t loc, + const struct cl_option_handlers *handlers, + diagnostic_context *dc); +bool +ObjC_handle_option_auto (struct gcc_options *opts, + struct gcc_options *opts_set, + size_t scode, const char *arg, int value, + unsigned int lang_mask, int kind, + location_t loc, + const struct cl_option_handlers *handlers, + diagnostic_context *dc); +bool +ObjCXX_handle_option_auto (struct gcc_options *opts, + struct gcc_options *opts_set, + size_t scode, const char *arg, int value, + unsigned int lang_mask, int kind, + location_t loc, + const struct cl_option_handlers *handlers, + diagnostic_context *dc); +void cpp_handle_option_auto (const struct gcc_options * opts, size_t scode, + struct cpp_options * cpp_opts); +void init_global_opts_from_cpp(struct gcc_options * opts, + const struct cpp_options * cpp_opts); +#endif +#endif + +#define MASK_ABICALLS (1U << 0) +#define OPTION_MASK_ANDROID (1U << 0) +#define MASK_BRANCHLIKELY (1U << 1) +#define MASK_CHECK_ZERO_DIV (1U << 2) +#define MASK_DIVIDE_BREAKS (1U << 3) +#define MASK_SINGLE_FLOAT (1U << 4) +#define MASK_BIG_ENDIAN (1U << 5) +#define MASK_EXPLICIT_RELOCS (1U << 6) +#define MASK_FIX_R10000 (1U << 7) +#define MASK_FIX_R4000 (1U << 8) +#define MASK_FIX_R4400 (1U << 9) +#define MASK_FLOAT64 (1U << 10) +#define MASK_FLOATXX (1U << 11) +#define MASK_64BIT (1U << 12) +#define MASK_SOFT_FLOAT_ABI (1U << 13) +#define MASK_IMADD (1U << 14) +#define MASK_MIPS16 (1U << 15) +#define MASK_LLSC (1U << 16) +#define MASK_LONG64 (1U << 17) +#define MASK_MEMCPY (1U << 18) +#define MASK_MICROMIPS (1U << 19) +#define MASK_ODD_SPREG (1U << 20) +#define MASK_PAIRED_SINGLE_FLOAT (1U << 21) +#define MASK_RELAX_PIC_CALLS (1U << 22) +#define MASK_SMARTMIPS (1U << 23) +#define MASK_SPLIT_ADDRESSES (1U << 24) +#define MASK_SYNCI (1U << 25) +#define MASK_VR4130_ALIGN (1U << 26) + +#define TARGET_ABICALLS ((target_flags & MASK_ABICALLS) != 0) +#define TARGET_ABICALLS_P(target_flags) (((target_flags) & MASK_ABICALLS) != 0) +#define TARGET_ANDROID ((flag_android & OPTION_MASK_ANDROID) != 0) +#define TARGET_ANDROID_P(flag_android) (((flag_android) & OPTION_MASK_ANDROID) != 0) +#define TARGET_BRANCHLIKELY ((target_flags & MASK_BRANCHLIKELY) != 0) +#define TARGET_BRANCHLIKELY_P(target_flags) (((target_flags) & MASK_BRANCHLIKELY) != 0) +#define TARGET_CHECK_ZERO_DIV ((target_flags & MASK_CHECK_ZERO_DIV) != 0) +#define TARGET_CHECK_ZERO_DIV_P(target_flags) (((target_flags) & MASK_CHECK_ZERO_DIV) != 0) +#define TARGET_DIVIDE_BREAKS ((target_flags & MASK_DIVIDE_BREAKS) != 0) +#define TARGET_DIVIDE_BREAKS_P(target_flags) (((target_flags) & MASK_DIVIDE_BREAKS) != 0) +#define TARGET_SINGLE_FLOAT ((target_flags & MASK_SINGLE_FLOAT) != 0) +#define TARGET_SINGLE_FLOAT_P(target_flags) (((target_flags) & MASK_SINGLE_FLOAT) != 0) +#define TARGET_BIG_ENDIAN ((target_flags & MASK_BIG_ENDIAN) != 0) +#define TARGET_BIG_ENDIAN_P(target_flags) (((target_flags) & MASK_BIG_ENDIAN) != 0) +#define TARGET_EXPLICIT_RELOCS ((target_flags & MASK_EXPLICIT_RELOCS) != 0) +#define TARGET_EXPLICIT_RELOCS_P(target_flags) (((target_flags) & MASK_EXPLICIT_RELOCS) != 0) +#define TARGET_FIX_R10000 ((target_flags & MASK_FIX_R10000) != 0) +#define TARGET_FIX_R10000_P(target_flags) (((target_flags) & MASK_FIX_R10000) != 0) +#define TARGET_FIX_R4000 ((target_flags & MASK_FIX_R4000) != 0) +#define TARGET_FIX_R4000_P(target_flags) (((target_flags) & MASK_FIX_R4000) != 0) +#define TARGET_FIX_R4400 ((target_flags & MASK_FIX_R4400) != 0) +#define TARGET_FIX_R4400_P(target_flags) (((target_flags) & MASK_FIX_R4400) != 0) +#define TARGET_FLOAT64 ((target_flags & MASK_FLOAT64) != 0) +#define TARGET_FLOAT64_P(target_flags) (((target_flags) & MASK_FLOAT64) != 0) +#define TARGET_FLOATXX ((target_flags & MASK_FLOATXX) != 0) +#define TARGET_FLOATXX_P(target_flags) (((target_flags) & MASK_FLOATXX) != 0) +#define TARGET_64BIT ((target_flags & MASK_64BIT) != 0) +#define TARGET_64BIT_P(target_flags) (((target_flags) & MASK_64BIT) != 0) +#define TARGET_SOFT_FLOAT_ABI ((target_flags & MASK_SOFT_FLOAT_ABI) != 0) +#define TARGET_SOFT_FLOAT_ABI_P(target_flags) (((target_flags) & MASK_SOFT_FLOAT_ABI) != 0) +#define TARGET_IMADD ((target_flags & MASK_IMADD) != 0) +#define TARGET_IMADD_P(target_flags) (((target_flags) & MASK_IMADD) != 0) +#define TARGET_MIPS16 ((target_flags & MASK_MIPS16) != 0) +#define TARGET_MIPS16_P(target_flags) (((target_flags) & MASK_MIPS16) != 0) +#define TARGET_LLSC ((target_flags & MASK_LLSC) != 0) +#define TARGET_LLSC_P(target_flags) (((target_flags) & MASK_LLSC) != 0) +#define TARGET_LONG64 ((target_flags & MASK_LONG64) != 0) +#define TARGET_LONG64_P(target_flags) (((target_flags) & MASK_LONG64) != 0) +#define TARGET_MEMCPY ((target_flags & MASK_MEMCPY) != 0) +#define TARGET_MEMCPY_P(target_flags) (((target_flags) & MASK_MEMCPY) != 0) +#define TARGET_MICROMIPS ((target_flags & MASK_MICROMIPS) != 0) +#define TARGET_MICROMIPS_P(target_flags) (((target_flags) & MASK_MICROMIPS) != 0) +#define TARGET_ODD_SPREG ((target_flags & MASK_ODD_SPREG) != 0) +#define TARGET_ODD_SPREG_P(target_flags) (((target_flags) & MASK_ODD_SPREG) != 0) +#define TARGET_PAIRED_SINGLE_FLOAT ((target_flags & MASK_PAIRED_SINGLE_FLOAT) != 0) +#define TARGET_PAIRED_SINGLE_FLOAT_P(target_flags) (((target_flags) & MASK_PAIRED_SINGLE_FLOAT) != 0) +#define TARGET_RELAX_PIC_CALLS ((target_flags & MASK_RELAX_PIC_CALLS) != 0) +#define TARGET_RELAX_PIC_CALLS_P(target_flags) (((target_flags) & MASK_RELAX_PIC_CALLS) != 0) +#define TARGET_SMARTMIPS ((target_flags & MASK_SMARTMIPS) != 0) +#define TARGET_SMARTMIPS_P(target_flags) (((target_flags) & MASK_SMARTMIPS) != 0) +#define TARGET_SPLIT_ADDRESSES ((target_flags & MASK_SPLIT_ADDRESSES) != 0) +#define TARGET_SPLIT_ADDRESSES_P(target_flags) (((target_flags) & MASK_SPLIT_ADDRESSES) != 0) +#define TARGET_SYNCI ((target_flags & MASK_SYNCI) != 0) +#define TARGET_SYNCI_P(target_flags) (((target_flags) & MASK_SYNCI) != 0) +#define TARGET_VR4130_ALIGN ((target_flags & MASK_VR4130_ALIGN) != 0) +#define TARGET_VR4130_ALIGN_P(target_flags) (((target_flags) & MASK_VR4130_ALIGN) != 0) + +#define TARGET_DIVIDE_TRAPS ((target_flags & MASK_DIVIDE_BREAKS) == 0) +#define TARGET_DOUBLE_FLOAT ((target_flags & MASK_SINGLE_FLOAT) == 0) +#define TARGET_LITTLE_ENDIAN ((target_flags & MASK_BIG_ENDIAN) == 0) +#define TARGET_HARD_FLOAT_ABI ((target_flags & MASK_SOFT_FLOAT_ABI) == 0) +#define TARGET_LONG32 ((target_flags & MASK_LONG64) == 0) + +#define CL_Ada (1U << 0) +#define CL_AdaSCIL (1U << 1) +#define CL_AdaWhy (1U << 2) +#define CL_BRIG (1U << 3) +#define CL_C (1U << 4) +#define CL_CXX (1U << 5) +#define CL_Fortran (1U << 6) +#define CL_Go (1U << 7) +#define CL_LTO (1U << 8) +#define CL_ObjC (1U << 9) +#define CL_ObjCXX (1U << 10) +#define CL_LANG_ALL ((1U << 11) - 1) + +enum opt_code +{ + OPT____ = 0, /* -### */ + /* OPT__all_warnings = 1, */ /* --all-warnings */ + /* OPT__ansi = 2, */ /* --ansi */ + /* OPT__assemble = 3, */ /* --assemble */ + /* OPT__assert = 4, */ /* --assert */ + /* OPT__assert_ = 5, */ /* --assert= */ + /* OPT__comments = 6, */ /* --comments */ + /* OPT__comments_in_macros = 7, */ /* --comments-in-macros */ + /* OPT__compile = 8, */ /* --compile */ + /* OPT__coverage = 9, */ /* --coverage */ + /* OPT__debug = 10, */ /* --debug */ + /* OPT__define_macro = 11, */ /* --define-macro */ + /* OPT__define_macro_ = 12, */ /* --define-macro= */ + /* OPT__dependencies = 13, */ /* --dependencies */ + /* OPT__dump = 14, */ /* --dump */ + /* OPT__dump_ = 15, */ /* --dump= */ + /* OPT__dumpbase = 16, */ /* --dumpbase */ + /* OPT__dumpdir = 17, */ /* --dumpdir */ + /* OPT__entry = 18, */ /* --entry */ + /* OPT__entry_ = 19, */ /* --entry= */ + /* OPT__extra_warnings = 20, */ /* --extra-warnings */ + /* OPT__for_assembler = 21, */ /* --for-assembler */ + /* OPT__for_assembler_ = 22, */ /* --for-assembler= */ + /* OPT__for_linker = 23, */ /* --for-linker */ + /* OPT__for_linker_ = 24, */ /* --for-linker= */ + /* OPT__force_link = 25, */ /* --force-link */ + /* OPT__force_link_ = 26, */ /* --force-link= */ + OPT__help = 27, /* --help */ + OPT__help_ = 28, /* --help= */ + /* OPT__imacros = 29, */ /* --imacros */ + /* OPT__imacros_ = 30, */ /* --imacros= */ + /* OPT__include = 31, */ /* --include */ + /* OPT__include_barrier = 32, */ /* --include-barrier */ + /* OPT__include_directory = 33, */ /* --include-directory */ + /* OPT__include_directory_after = 34, */ /* --include-directory-after */ + /* OPT__include_directory_after_ = 35, */ /* --include-directory-after= */ + /* OPT__include_directory_ = 36, */ /* --include-directory= */ + /* OPT__include_prefix = 37, */ /* --include-prefix */ + /* OPT__include_prefix_ = 38, */ /* --include-prefix= */ + /* OPT__include_with_prefix = 39, */ /* --include-with-prefix */ + /* OPT__include_with_prefix_after = 40, */ /* --include-with-prefix-after */ + /* OPT__include_with_prefix_after_ = 41, *//* --include-with-prefix-after= */ + /* OPT__include_with_prefix_before = 42, *//* --include-with-prefix-before */ + /* OPT__include_with_prefix_before_ = 43, *//* --include-with-prefix-before= */ + /* OPT__include_with_prefix_ = 44, */ /* --include-with-prefix= */ + /* OPT__include_ = 45, */ /* --include= */ + /* OPT__language = 46, */ /* --language */ + /* OPT__language_ = 47, */ /* --language= */ + /* OPT__library_directory = 48, */ /* --library-directory */ + /* OPT__library_directory_ = 49, */ /* --library-directory= */ + /* OPT__no_canonical_prefixes = 50, */ /* --no-canonical-prefixes */ + /* OPT__no_integrated_cpp = 51, */ /* --no-integrated-cpp */ + /* OPT__no_line_commands = 52, */ /* --no-line-commands */ + /* OPT__no_standard_includes = 53, */ /* --no-standard-includes */ + /* OPT__no_standard_libraries = 54, */ /* --no-standard-libraries */ + OPT__no_sysroot_suffix = 55, /* --no-sysroot-suffix */ + /* OPT__no_warnings = 56, */ /* --no-warnings */ + /* OPT__optimize = 57, */ /* --optimize */ + /* OPT__output = 58, */ /* --output */ + OPT__output_pch_ = 59, /* --output-pch= */ + /* OPT__output_ = 60, */ /* --output= */ + OPT__param = 61, /* --param */ + /* OPT__param_ = 62, */ /* --param= */ + /* OPT__pass_exit_codes = 63, */ /* --pass-exit-codes */ + /* OPT__pedantic = 64, */ /* --pedantic */ + /* OPT__pedantic_errors = 65, */ /* --pedantic-errors */ + /* OPT__pie = 66, */ /* --pie */ + /* OPT__pipe = 67, */ /* --pipe */ + /* OPT__prefix = 68, */ /* --prefix */ + /* OPT__prefix_ = 69, */ /* --prefix= */ + /* OPT__preprocess = 70, */ /* --preprocess */ + /* OPT__print_file_name = 71, */ /* --print-file-name */ + /* OPT__print_file_name_ = 72, */ /* --print-file-name= */ + /* OPT__print_libgcc_file_name = 73, */ /* --print-libgcc-file-name */ + /* OPT__print_missing_file_dependencies = 74, *//* --print-missing-file-dependencies */ + /* OPT__print_multi_directory = 75, */ /* --print-multi-directory */ + /* OPT__print_multi_lib = 76, */ /* --print-multi-lib */ + /* OPT__print_multi_os_directory = 77, */ /* --print-multi-os-directory */ + /* OPT__print_multiarch = 78, */ /* --print-multiarch */ + /* OPT__print_prog_name = 79, */ /* --print-prog-name */ + /* OPT__print_prog_name_ = 80, */ /* --print-prog-name= */ + /* OPT__print_search_dirs = 81, */ /* --print-search-dirs */ + /* OPT__print_sysroot = 82, */ /* --print-sysroot */ + /* OPT__print_sysroot_headers_suffix = 83, *//* --print-sysroot-headers-suffix */ + /* OPT__profile = 84, */ /* --profile */ + /* OPT__save_temps = 85, */ /* --save-temps */ + /* OPT__shared = 86, */ /* --shared */ + /* OPT__specs = 87, */ /* --specs */ + /* OPT__specs_ = 88, */ /* --specs= */ + /* OPT__static = 89, */ /* --static */ + /* OPT__symbolic = 90, */ /* --symbolic */ + /* OPT__sysroot = 91, */ /* --sysroot */ + OPT__sysroot_ = 92, /* --sysroot= */ + OPT__target_help = 93, /* --target-help */ + /* OPT__time = 94, */ /* --time */ + /* OPT__trace_includes = 95, */ /* --trace-includes */ + /* OPT__traditional = 96, */ /* --traditional */ + /* OPT__traditional_cpp = 97, */ /* --traditional-cpp */ + /* OPT__trigraphs = 98, */ /* --trigraphs */ + /* OPT__undefine_macro = 99, */ /* --undefine-macro */ + /* OPT__undefine_macro_ = 100, */ /* --undefine-macro= */ + /* OPT__user_dependencies = 101, */ /* --user-dependencies */ + /* OPT__verbose = 102, */ /* --verbose */ + OPT__version = 103, /* --version */ + /* OPT__write_dependencies = 104, */ /* --write-dependencies */ + /* OPT__write_user_dependencies = 105, */ /* --write-user-dependencies */ + OPT_A = 106, /* -A */ + OPT_B = 107, /* -B */ + OPT_C = 108, /* -C */ + OPT_CC = 109, /* -CC */ + OPT_D = 110, /* -D */ + OPT_E = 111, /* -E */ + OPT_EB = 112, /* -EB */ + OPT_EL = 113, /* -EL */ + OPT_F = 114, /* -F */ + OPT_G = 115, /* -G */ + OPT_H = 116, /* -H */ + OPT_I = 117, /* -I */ + OPT_J = 118, /* -J */ + OPT_L = 119, /* -L */ + OPT_M = 120, /* -M */ + OPT_MD = 121, /* -MD */ + OPT_MF = 122, /* -MF */ + OPT_MG = 123, /* -MG */ + OPT_MM = 124, /* -MM */ + OPT_MMD = 125, /* -MMD */ + OPT_MP = 126, /* -MP */ + OPT_MQ = 127, /* -MQ */ + OPT_MT = 128, /* -MT */ + OPT_N = 129, /* -N */ + OPT_O = 130, /* -O */ + OPT_Ofast = 131, /* -Ofast */ + OPT_Og = 132, /* -Og */ + OPT_Os = 133, /* -Os */ + OPT_P = 134, /* -P */ + OPT_Q = 135, /* -Q */ + OPT_Qn = 136, /* -Qn */ + OPT_Qy = 137, /* -Qy */ + OPT_R = 138, /* -R */ + OPT_S = 139, /* -S */ + OPT_T = 140, /* -T */ + OPT_Tbss = 141, /* -Tbss */ + OPT_Tbss_ = 142, /* -Tbss= */ + OPT_Tdata = 143, /* -Tdata */ + OPT_Tdata_ = 144, /* -Tdata= */ + OPT_Ttext = 145, /* -Ttext */ + OPT_Ttext_ = 146, /* -Ttext= */ + OPT_U = 147, /* -U */ + /* OPT_W = 148, */ /* -W */ + OPT_Wa_ = 149, /* -Wa, */ + OPT_Wabi = 150, /* -Wabi */ + OPT_Wabi_tag = 151, /* -Wabi-tag */ + OPT_Wabi_ = 152, /* -Wabi= */ + OPT_Waddress = 153, /* -Waddress */ + OPT_Waggregate_return = 154, /* -Waggregate-return */ + OPT_Waggressive_loop_optimizations = 155, /* -Waggressive-loop-optimizations */ + OPT_Waliasing = 156, /* -Waliasing */ + OPT_Walign_commons = 157, /* -Walign-commons */ + /* OPT_Waligned_new = 158, */ /* -Waligned-new */ + OPT_Waligned_new_ = 159, /* -Waligned-new= */ + OPT_Wall = 160, /* -Wall */ + OPT_Walloc_size_larger_than_ = 161, /* -Walloc-size-larger-than= */ + OPT_Walloc_zero = 162, /* -Walloc-zero */ + OPT_Walloca = 163, /* -Walloca */ + OPT_Walloca_larger_than_ = 164, /* -Walloca-larger-than= */ + OPT_Wampersand = 165, /* -Wampersand */ + OPT_Wargument_mismatch = 166, /* -Wargument-mismatch */ + OPT_Warray_bounds = 167, /* -Warray-bounds */ + OPT_Warray_bounds_ = 168, /* -Warray-bounds= */ + OPT_Warray_temporaries = 169, /* -Warray-temporaries */ + OPT_Wassign_intercept = 170, /* -Wassign-intercept */ + OPT_Wattributes = 171, /* -Wattributes */ + OPT_Wbad_function_cast = 172, /* -Wbad-function-cast */ + OPT_Wbool_compare = 173, /* -Wbool-compare */ + OPT_Wbool_operation = 174, /* -Wbool-operation */ + OPT_Wbuiltin_declaration_mismatch = 175, /* -Wbuiltin-declaration-mismatch */ + OPT_Wbuiltin_macro_redefined = 176, /* -Wbuiltin-macro-redefined */ + OPT_Wc___compat = 177, /* -Wc++-compat */ + /* OPT_Wc__0x_compat = 178, */ /* -Wc++0x-compat */ + OPT_Wc__11_compat = 179, /* -Wc++11-compat */ + OPT_Wc__14_compat = 180, /* -Wc++14-compat */ + /* OPT_Wc__17_compat = 181, */ /* -Wc++17-compat */ + OPT_Wc__1z_compat = 182, /* -Wc++1z-compat */ + OPT_Wc_binding_type = 183, /* -Wc-binding-type */ + OPT_Wc90_c99_compat = 184, /* -Wc90-c99-compat */ + OPT_Wc99_c11_compat = 185, /* -Wc99-c11-compat */ + OPT_Wcast_align = 186, /* -Wcast-align */ + OPT_Wcast_qual = 187, /* -Wcast-qual */ + OPT_Wchar_subscripts = 188, /* -Wchar-subscripts */ + OPT_Wcharacter_truncation = 189, /* -Wcharacter-truncation */ + OPT_Wchkp = 190, /* -Wchkp */ + OPT_Wclobbered = 191, /* -Wclobbered */ + OPT_Wcomment = 192, /* -Wcomment */ + /* OPT_Wcomments = 193, */ /* -Wcomments */ + OPT_Wcompare_reals = 194, /* -Wcompare-reals */ + OPT_Wconditionally_supported = 195, /* -Wconditionally-supported */ + OPT_Wconversion = 196, /* -Wconversion */ + OPT_Wconversion_extra = 197, /* -Wconversion-extra */ + OPT_Wconversion_null = 198, /* -Wconversion-null */ + OPT_Wcoverage_mismatch = 199, /* -Wcoverage-mismatch */ + OPT_Wcpp = 200, /* -Wcpp */ + OPT_Wctor_dtor_privacy = 201, /* -Wctor-dtor-privacy */ + OPT_Wdangling_else = 202, /* -Wdangling-else */ + OPT_Wdate_time = 203, /* -Wdate-time */ + OPT_Wdeclaration_after_statement = 204, /* -Wdeclaration-after-statement */ + OPT_Wdelete_incomplete = 205, /* -Wdelete-incomplete */ + OPT_Wdelete_non_virtual_dtor = 206, /* -Wdelete-non-virtual-dtor */ + OPT_Wdeprecated = 207, /* -Wdeprecated */ + OPT_Wdeprecated_declarations = 208, /* -Wdeprecated-declarations */ + OPT_Wdesignated_init = 209, /* -Wdesignated-init */ + OPT_Wdisabled_optimization = 210, /* -Wdisabled-optimization */ + OPT_Wdiscarded_array_qualifiers = 211, /* -Wdiscarded-array-qualifiers */ + OPT_Wdiscarded_qualifiers = 212, /* -Wdiscarded-qualifiers */ + OPT_Wdiv_by_zero = 213, /* -Wdiv-by-zero */ + OPT_Wdouble_promotion = 214, /* -Wdouble-promotion */ + OPT_Wduplicate_decl_specifier = 215, /* -Wduplicate-decl-specifier */ + OPT_Wduplicated_branches = 216, /* -Wduplicated-branches */ + OPT_Wduplicated_cond = 217, /* -Wduplicated-cond */ + OPT_Weffc__ = 218, /* -Weffc++ */ + OPT_Wempty_body = 219, /* -Wempty-body */ + OPT_Wendif_labels = 220, /* -Wendif-labels */ + OPT_Wenum_compare = 221, /* -Wenum-compare */ + OPT_Werror = 222, /* -Werror */ + /* OPT_Werror_implicit_function_declaration = 223, *//* -Werror-implicit-function-declaration */ + OPT_Werror_ = 224, /* -Werror= */ + OPT_Wexpansion_to_defined = 225, /* -Wexpansion-to-defined */ + OPT_Wextra = 226, /* -Wextra */ + OPT_Wfatal_errors = 227, /* -Wfatal-errors */ + OPT_Wfloat_conversion = 228, /* -Wfloat-conversion */ + OPT_Wfloat_equal = 229, /* -Wfloat-equal */ + /* OPT_Wformat = 230, */ /* -Wformat */ + OPT_Wformat_contains_nul = 231, /* -Wformat-contains-nul */ + OPT_Wformat_extra_args = 232, /* -Wformat-extra-args */ + OPT_Wformat_nonliteral = 233, /* -Wformat-nonliteral */ + /* OPT_Wformat_overflow = 234, */ /* -Wformat-overflow */ + OPT_Wformat_overflow_ = 235, /* -Wformat-overflow= */ + OPT_Wformat_security = 236, /* -Wformat-security */ + OPT_Wformat_signedness = 237, /* -Wformat-signedness */ + /* OPT_Wformat_truncation = 238, */ /* -Wformat-truncation */ + OPT_Wformat_truncation_ = 239, /* -Wformat-truncation= */ + OPT_Wformat_y2k = 240, /* -Wformat-y2k */ + OPT_Wformat_zero_length = 241, /* -Wformat-zero-length */ + OPT_Wformat_ = 242, /* -Wformat= */ + OPT_Wframe_address = 243, /* -Wframe-address */ + OPT_Wframe_larger_than_ = 244, /* -Wframe-larger-than= */ + OPT_Wfree_nonheap_object = 245, /* -Wfree-nonheap-object */ + OPT_Wfunction_elimination = 246, /* -Wfunction-elimination */ + OPT_Whsa = 247, /* -Whsa */ + OPT_Wignored_attributes = 248, /* -Wignored-attributes */ + OPT_Wignored_qualifiers = 249, /* -Wignored-qualifiers */ + OPT_Wimplicit = 250, /* -Wimplicit */ + /* OPT_Wimplicit_fallthrough = 251, */ /* -Wimplicit-fallthrough */ + OPT_Wimplicit_fallthrough_ = 252, /* -Wimplicit-fallthrough= */ + OPT_Wimplicit_function_declaration = 253, /* -Wimplicit-function-declaration */ + OPT_Wimplicit_int = 254, /* -Wimplicit-int */ + OPT_Wimplicit_interface = 255, /* -Wimplicit-interface */ + OPT_Wimplicit_procedure = 256, /* -Wimplicit-procedure */ + /* OPT_Wimport = 257, */ /* -Wimport */ + OPT_Wincompatible_pointer_types = 258, /* -Wincompatible-pointer-types */ + OPT_Winherited_variadic_ctor = 259, /* -Winherited-variadic-ctor */ + OPT_Winit_self = 260, /* -Winit-self */ + OPT_Winline = 261, /* -Winline */ + OPT_Wint_conversion = 262, /* -Wint-conversion */ + OPT_Wint_in_bool_context = 263, /* -Wint-in-bool-context */ + OPT_Wint_to_pointer_cast = 264, /* -Wint-to-pointer-cast */ + OPT_Winteger_division = 265, /* -Winteger-division */ + OPT_Wintrinsic_shadow = 266, /* -Wintrinsic-shadow */ + OPT_Wintrinsics_std = 267, /* -Wintrinsics-std */ + OPT_Winvalid_memory_model = 268, /* -Winvalid-memory-model */ + OPT_Winvalid_offsetof = 269, /* -Winvalid-offsetof */ + OPT_Winvalid_pch = 270, /* -Winvalid-pch */ + OPT_Wjump_misses_init = 271, /* -Wjump-misses-init */ + OPT_Wl_ = 272, /* -Wl, */ + /* OPT_Wlarger_than_ = 273, */ /* -Wlarger-than- */ + OPT_Wlarger_than_ = 274, /* -Wlarger-than= */ + OPT_Wline_truncation = 275, /* -Wline-truncation */ + OPT_Wliteral_suffix = 276, /* -Wliteral-suffix */ + OPT_Wlogical_not_parentheses = 277, /* -Wlogical-not-parentheses */ + OPT_Wlogical_op = 278, /* -Wlogical-op */ + OPT_Wlong_long = 279, /* -Wlong-long */ + OPT_Wlto_type_mismatch = 280, /* -Wlto-type-mismatch */ + OPT_Wmain = 281, /* -Wmain */ + OPT_Wmaybe_uninitialized = 282, /* -Wmaybe-uninitialized */ + OPT_Wmemset_elt_size = 283, /* -Wmemset-elt-size */ + OPT_Wmemset_transposed_args = 284, /* -Wmemset-transposed-args */ + OPT_Wmisleading_indentation = 285, /* -Wmisleading-indentation */ + OPT_Wmissing_braces = 286, /* -Wmissing-braces */ + OPT_Wmissing_declarations = 287, /* -Wmissing-declarations */ + OPT_Wmissing_field_initializers = 288, /* -Wmissing-field-initializers */ + /* OPT_Wmissing_format_attribute = 289, */ /* -Wmissing-format-attribute */ + OPT_Wmissing_include_dirs = 290, /* -Wmissing-include-dirs */ + /* OPT_Wmissing_noreturn = 291, */ /* -Wmissing-noreturn */ + OPT_Wmissing_parameter_type = 292, /* -Wmissing-parameter-type */ + OPT_Wmissing_prototypes = 293, /* -Wmissing-prototypes */ + /* OPT_Wmudflap = 294, */ /* -Wmudflap */ + OPT_Wmultichar = 295, /* -Wmultichar */ + OPT_Wmultiple_inheritance = 296, /* -Wmultiple-inheritance */ + OPT_Wnamespaces = 297, /* -Wnamespaces */ + OPT_Wnarrowing = 298, /* -Wnarrowing */ + OPT_Wnested_externs = 299, /* -Wnested-externs */ + OPT_Wnoexcept = 300, /* -Wnoexcept */ + OPT_Wnoexcept_type = 301, /* -Wnoexcept-type */ + OPT_Wnon_template_friend = 302, /* -Wnon-template-friend */ + OPT_Wnon_virtual_dtor = 303, /* -Wnon-virtual-dtor */ + OPT_Wnonnull = 304, /* -Wnonnull */ + OPT_Wnonnull_compare = 305, /* -Wnonnull-compare */ + /* OPT_Wnormalized = 306, */ /* -Wnormalized */ + OPT_Wnormalized_ = 307, /* -Wnormalized= */ + OPT_Wnull_dereference = 308, /* -Wnull-dereference */ + OPT_Wodr = 309, /* -Wodr */ + OPT_Wold_style_cast = 310, /* -Wold-style-cast */ + OPT_Wold_style_declaration = 311, /* -Wold-style-declaration */ + OPT_Wold_style_definition = 312, /* -Wold-style-definition */ + OPT_Wopenmp_simd = 313, /* -Wopenmp-simd */ + OPT_Woverflow = 314, /* -Woverflow */ + OPT_Woverlength_strings = 315, /* -Woverlength-strings */ + OPT_Woverloaded_virtual = 316, /* -Woverloaded-virtual */ + OPT_Woverride_init = 317, /* -Woverride-init */ + OPT_Woverride_init_side_effects = 318, /* -Woverride-init-side-effects */ + OPT_Wp_ = 319, /* -Wp, */ + OPT_Wpacked = 320, /* -Wpacked */ + OPT_Wpacked_bitfield_compat = 321, /* -Wpacked-bitfield-compat */ + OPT_Wpadded = 322, /* -Wpadded */ + OPT_Wparentheses = 323, /* -Wparentheses */ + OPT_Wpedantic = 324, /* -Wpedantic */ + /* OPT_Wplacement_new = 325, */ /* -Wplacement-new */ + OPT_Wplacement_new_ = 326, /* -Wplacement-new= */ + OPT_Wpmf_conversions = 327, /* -Wpmf-conversions */ + OPT_Wpointer_arith = 328, /* -Wpointer-arith */ + OPT_Wpointer_compare = 329, /* -Wpointer-compare */ + OPT_Wpointer_sign = 330, /* -Wpointer-sign */ + OPT_Wpointer_to_int_cast = 331, /* -Wpointer-to-int-cast */ + OPT_Wpragmas = 332, /* -Wpragmas */ + OPT_Wproperty_assign_default = 333, /* -Wproperty-assign-default */ + OPT_Wprotocol = 334, /* -Wprotocol */ + OPT_Wpsabi = 335, /* -Wpsabi */ + OPT_Wreal_q_constant = 336, /* -Wreal-q-constant */ + OPT_Wrealloc_lhs = 337, /* -Wrealloc-lhs */ + OPT_Wrealloc_lhs_all = 338, /* -Wrealloc-lhs-all */ + OPT_Wredundant_decls = 339, /* -Wredundant-decls */ + OPT_Wregister = 340, /* -Wregister */ + OPT_Wreorder = 341, /* -Wreorder */ + OPT_Wrestrict = 342, /* -Wrestrict */ + OPT_Wreturn_local_addr = 343, /* -Wreturn-local-addr */ + OPT_Wreturn_type = 344, /* -Wreturn-type */ + OPT_Wscalar_storage_order = 345, /* -Wscalar-storage-order */ + OPT_Wselector = 346, /* -Wselector */ + OPT_Wsequence_point = 347, /* -Wsequence-point */ + OPT_Wshadow = 348, /* -Wshadow */ + /* OPT_Wshadow_compatible_local = 349, */ /* -Wshadow-compatible-local */ + OPT_Wshadow_ivar = 350, /* -Wshadow-ivar */ + /* OPT_Wshadow_local = 351, */ /* -Wshadow-local */ + OPT_Wshadow_compatible_local = 352, /* -Wshadow=compatible-local */ + /* OPT_Wshadow_global = 353, */ /* -Wshadow=global */ + OPT_Wshadow_local = 354, /* -Wshadow=local */ + OPT_Wshift_count_negative = 355, /* -Wshift-count-negative */ + OPT_Wshift_count_overflow = 356, /* -Wshift-count-overflow */ + OPT_Wshift_negative_value = 357, /* -Wshift-negative-value */ + /* OPT_Wshift_overflow = 358, */ /* -Wshift-overflow */ + OPT_Wshift_overflow_ = 359, /* -Wshift-overflow= */ + OPT_Wsign_compare = 360, /* -Wsign-compare */ + OPT_Wsign_conversion = 361, /* -Wsign-conversion */ + OPT_Wsign_promo = 362, /* -Wsign-promo */ + OPT_Wsized_deallocation = 363, /* -Wsized-deallocation */ + OPT_Wsizeof_array_argument = 364, /* -Wsizeof-array-argument */ + OPT_Wsizeof_pointer_memaccess = 365, /* -Wsizeof-pointer-memaccess */ + OPT_Wstack_protector = 366, /* -Wstack-protector */ + OPT_Wstack_usage_ = 367, /* -Wstack-usage= */ + OPT_Wstrict_aliasing = 368, /* -Wstrict-aliasing */ + OPT_Wstrict_aliasing_ = 369, /* -Wstrict-aliasing= */ + OPT_Wstrict_null_sentinel = 370, /* -Wstrict-null-sentinel */ + OPT_Wstrict_overflow = 371, /* -Wstrict-overflow */ + OPT_Wstrict_overflow_ = 372, /* -Wstrict-overflow= */ + OPT_Wstrict_prototypes = 373, /* -Wstrict-prototypes */ + OPT_Wstrict_selector_match = 374, /* -Wstrict-selector-match */ + /* OPT_Wstringop_overflow = 375, */ /* -Wstringop-overflow */ + OPT_Wstringop_overflow_ = 376, /* -Wstringop-overflow= */ + OPT_Wsubobject_linkage = 377, /* -Wsubobject-linkage */ + OPT_Wsuggest_attribute_const = 378, /* -Wsuggest-attribute=const */ + OPT_Wsuggest_attribute_format = 379, /* -Wsuggest-attribute=format */ + OPT_Wsuggest_attribute_noreturn = 380, /* -Wsuggest-attribute=noreturn */ + OPT_Wsuggest_attribute_pure = 381, /* -Wsuggest-attribute=pure */ + OPT_Wsuggest_final_methods = 382, /* -Wsuggest-final-methods */ + OPT_Wsuggest_final_types = 383, /* -Wsuggest-final-types */ + OPT_Wsuggest_override = 384, /* -Wsuggest-override */ + OPT_Wsurprising = 385, /* -Wsurprising */ + OPT_Wswitch = 386, /* -Wswitch */ + OPT_Wswitch_bool = 387, /* -Wswitch-bool */ + OPT_Wswitch_default = 388, /* -Wswitch-default */ + OPT_Wswitch_enum = 389, /* -Wswitch-enum */ + OPT_Wswitch_unreachable = 390, /* -Wswitch-unreachable */ + OPT_Wsync_nand = 391, /* -Wsync-nand */ + OPT_Wsynth = 392, /* -Wsynth */ + OPT_Wsystem_headers = 393, /* -Wsystem-headers */ + OPT_Wtabs = 394, /* -Wtabs */ + OPT_Wtarget_lifetime = 395, /* -Wtarget-lifetime */ + OPT_Wtautological_compare = 396, /* -Wtautological-compare */ + OPT_Wtemplates = 397, /* -Wtemplates */ + OPT_Wterminate = 398, /* -Wterminate */ + OPT_Wtraditional = 399, /* -Wtraditional */ + OPT_Wtraditional_conversion = 400, /* -Wtraditional-conversion */ + OPT_Wtrampolines = 401, /* -Wtrampolines */ + OPT_Wtrigraphs = 402, /* -Wtrigraphs */ + OPT_Wtype_limits = 403, /* -Wtype-limits */ + OPT_Wundeclared_selector = 404, /* -Wundeclared-selector */ + OPT_Wundef = 405, /* -Wundef */ + OPT_Wundefined_do_loop = 406, /* -Wundefined-do-loop */ + OPT_Wunderflow = 407, /* -Wunderflow */ + OPT_Wuninitialized = 408, /* -Wuninitialized */ + OPT_Wunknown_pragmas = 409, /* -Wunknown-pragmas */ + /* OPT_Wunreachable_code = 410, */ /* -Wunreachable-code */ + OPT_Wunsafe_loop_optimizations = 411, /* -Wunsafe-loop-optimizations */ + OPT_Wunsuffixed_float_constants = 412, /* -Wunsuffixed-float-constants */ + OPT_Wunused = 413, /* -Wunused */ + OPT_Wunused_but_set_parameter = 414, /* -Wunused-but-set-parameter */ + OPT_Wunused_but_set_variable = 415, /* -Wunused-but-set-variable */ + /* OPT_Wunused_const_variable = 416, */ /* -Wunused-const-variable */ + OPT_Wunused_const_variable_ = 417, /* -Wunused-const-variable= */ + OPT_Wunused_dummy_argument = 418, /* -Wunused-dummy-argument */ + OPT_Wunused_function = 419, /* -Wunused-function */ + OPT_Wunused_label = 420, /* -Wunused-label */ + OPT_Wunused_local_typedefs = 421, /* -Wunused-local-typedefs */ + OPT_Wunused_macros = 422, /* -Wunused-macros */ + OPT_Wunused_parameter = 423, /* -Wunused-parameter */ + OPT_Wunused_result = 424, /* -Wunused-result */ + OPT_Wunused_value = 425, /* -Wunused-value */ + OPT_Wunused_variable = 426, /* -Wunused-variable */ + OPT_Wuse_without_only = 427, /* -Wuse-without-only */ + OPT_Wuseless_cast = 428, /* -Wuseless-cast */ + OPT_Wvarargs = 429, /* -Wvarargs */ + OPT_Wvariadic_macros = 430, /* -Wvariadic-macros */ + OPT_Wvector_operation_performance = 431, /* -Wvector-operation-performance */ + OPT_Wvirtual_inheritance = 432, /* -Wvirtual-inheritance */ + OPT_Wvirtual_move_assign = 433, /* -Wvirtual-move-assign */ + OPT_Wvla = 434, /* -Wvla */ + OPT_Wvla_larger_than_ = 435, /* -Wvla-larger-than= */ + OPT_Wvolatile_register_var = 436, /* -Wvolatile-register-var */ + OPT_Wwrite_strings = 437, /* -Wwrite-strings */ + OPT_Wzero_as_null_pointer_constant = 438, /* -Wzero-as-null-pointer-constant */ + OPT_Wzerotrip = 439, /* -Wzerotrip */ + OPT_Xassembler = 440, /* -Xassembler */ + OPT_Xlinker = 441, /* -Xlinker */ + OPT_Xpreprocessor = 442, /* -Xpreprocessor */ + OPT_Z = 443, /* -Z */ + OPT_ansi = 444, /* -ansi */ + OPT_aux_info = 445, /* -aux-info */ + /* OPT_aux_info_ = 446, */ /* -aux-info= */ + OPT_auxbase = 447, /* -auxbase */ + OPT_auxbase_strip = 448, /* -auxbase-strip */ + OPT_c = 449, /* -c */ + OPT_coverage = 450, /* -coverage */ + OPT_cpp = 451, /* -cpp */ + OPT_cpp_ = 452, /* -cpp= */ + OPT_d = 453, /* -d */ + OPT_dumpbase = 454, /* -dumpbase */ + OPT_dumpdir = 455, /* -dumpdir */ + OPT_dumpfullversion = 456, /* -dumpfullversion */ + OPT_dumpmachine = 457, /* -dumpmachine */ + OPT_dumpspecs = 458, /* -dumpspecs */ + OPT_dumpversion = 459, /* -dumpversion */ + OPT_e = 460, /* -e */ + OPT_export_dynamic = 461, /* -export-dynamic */ + OPT_fPIC = 462, /* -fPIC */ + OPT_fPIE = 463, /* -fPIE */ + OPT_fRTS_ = 464, /* -fRTS= */ + OPT_fabi_compat_version_ = 465, /* -fabi-compat-version= */ + OPT_fabi_version_ = 466, /* -fabi-version= */ + OPT_faccess_control = 467, /* -faccess-control */ + OPT_fada_spec_parent_ = 468, /* -fada-spec-parent= */ + OPT_faggressive_function_elimination = 469,/* -faggressive-function-elimination */ + OPT_faggressive_loop_optimizations = 470, /* -faggressive-loop-optimizations */ + OPT_falign_commons = 471, /* -falign-commons */ + OPT_falign_functions = 472, /* -falign-functions */ + OPT_falign_functions_ = 473, /* -falign-functions= */ + OPT_falign_jumps = 474, /* -falign-jumps */ + OPT_falign_jumps_ = 475, /* -falign-jumps= */ + OPT_falign_labels = 476, /* -falign-labels */ + OPT_falign_labels_ = 477, /* -falign-labels= */ + OPT_falign_loops = 478, /* -falign-loops */ + OPT_falign_loops_ = 479, /* -falign-loops= */ + /* OPT_faligned_new = 480, */ /* -faligned-new */ + OPT_faligned_new_ = 481, /* -faligned-new= */ + OPT_fall_intrinsics = 482, /* -fall-intrinsics */ + /* OPT_fall_virtual = 483, */ /* -fall-virtual */ + OPT_fallow_leading_underscore = 484, /* -fallow-leading-underscore */ + OPT_fallow_parameterless_variadic_functions = 485,/* -fallow-parameterless-variadic-functions */ + /* OPT_falt_external_templates = 486, */ /* -falt-external-templates */ + /* OPT_fargument_alias = 487, */ /* -fargument-alias */ + /* OPT_fargument_noalias = 488, */ /* -fargument-noalias */ + /* OPT_fargument_noalias_anything = 489, *//* -fargument-noalias-anything */ + /* OPT_fargument_noalias_global = 490, */ /* -fargument-noalias-global */ + OPT_fasan_shadow_offset_ = 491, /* -fasan-shadow-offset= */ + OPT_fasm = 492, /* -fasm */ + OPT_fassociative_math = 493, /* -fassociative-math */ + OPT_fasynchronous_unwind_tables = 494, /* -fasynchronous-unwind-tables */ + OPT_fauto_inc_dec = 495, /* -fauto-inc-dec */ + OPT_fauto_profile = 496, /* -fauto-profile */ + OPT_fauto_profile_ = 497, /* -fauto-profile= */ + OPT_fautomatic = 498, /* -fautomatic */ + OPT_fbackslash = 499, /* -fbackslash */ + OPT_fbacktrace = 500, /* -fbacktrace */ + OPT_fblas_matmul_limit_ = 501, /* -fblas-matmul-limit= */ + OPT_fbounds_check = 502, /* -fbounds-check */ + OPT_fbranch_count_reg = 503, /* -fbranch-count-reg */ + OPT_fbranch_probabilities = 504, /* -fbranch-probabilities */ + OPT_fbranch_target_load_optimize = 505, /* -fbranch-target-load-optimize */ + OPT_fbranch_target_load_optimize2 = 506, /* -fbranch-target-load-optimize2 */ + OPT_fbtr_bb_exclusive = 507, /* -fbtr-bb-exclusive */ + OPT_fbuilding_libgcc = 508, /* -fbuilding-libgcc */ + OPT_fbuiltin = 509, /* -fbuiltin */ + OPT_fbuiltin_ = 510, /* -fbuiltin- */ + OPT_fbuiltin_printf = 511, /* -fbuiltin-printf */ + OPT_fcall_saved_ = 512, /* -fcall-saved- */ + OPT_fcall_used_ = 513, /* -fcall-used- */ + OPT_fcaller_saves = 514, /* -fcaller-saves */ + OPT_fcanonical_system_headers = 515, /* -fcanonical-system-headers */ + OPT_fcheck_array_temporaries = 516, /* -fcheck-array-temporaries */ + OPT_fcheck_data_deps = 517, /* -fcheck-data-deps */ + OPT_fcheck_new = 518, /* -fcheck-new */ + OPT_fcheck_pointer_bounds = 519, /* -fcheck-pointer-bounds */ + OPT_fcheck_ = 520, /* -fcheck= */ + OPT_fchecking = 521, /* -fchecking */ + OPT_fchecking_ = 522, /* -fchecking= */ + OPT_fchkp_check_incomplete_type = 523, /* -fchkp-check-incomplete-type */ + OPT_fchkp_check_read = 524, /* -fchkp-check-read */ + OPT_fchkp_check_write = 525, /* -fchkp-check-write */ + OPT_fchkp_first_field_has_own_bounds = 526,/* -fchkp-first-field-has-own-bounds */ + OPT_fchkp_flexible_struct_trailing_arrays = 527,/* -fchkp-flexible-struct-trailing-arrays */ + OPT_fchkp_instrument_calls = 528, /* -fchkp-instrument-calls */ + OPT_fchkp_instrument_marked_only = 529, /* -fchkp-instrument-marked-only */ + OPT_fchkp_narrow_bounds = 530, /* -fchkp-narrow-bounds */ + OPT_fchkp_narrow_to_innermost_array = 531, /* -fchkp-narrow-to-innermost-array */ + OPT_fchkp_optimize = 532, /* -fchkp-optimize */ + OPT_fchkp_store_bounds = 533, /* -fchkp-store-bounds */ + OPT_fchkp_treat_zero_dynamic_size_as_infinite = 534,/* -fchkp-treat-zero-dynamic-size-as-infinite */ + OPT_fchkp_use_fast_string_functions = 535, /* -fchkp-use-fast-string-functions */ + OPT_fchkp_use_nochk_string_functions = 536,/* -fchkp-use-nochk-string-functions */ + OPT_fchkp_use_static_bounds = 537, /* -fchkp-use-static-bounds */ + OPT_fchkp_use_static_const_bounds = 538, /* -fchkp-use-static-const-bounds */ + OPT_fchkp_use_wrappers = 539, /* -fchkp-use-wrappers */ + OPT_fchkp_zero_input_bounds_for_main = 540,/* -fchkp-zero-input-bounds-for-main */ + OPT_fcilkplus = 541, /* -fcilkplus */ + OPT_fcoarray_ = 542, /* -fcoarray= */ + OPT_fcode_hoisting = 543, /* -fcode-hoisting */ + OPT_fcombine_stack_adjustments = 544, /* -fcombine-stack-adjustments */ + OPT_fcommon = 545, /* -fcommon */ + OPT_fcompare_debug = 546, /* -fcompare-debug */ + OPT_fcompare_debug_second = 547, /* -fcompare-debug-second */ + OPT_fcompare_debug_ = 548, /* -fcompare-debug= */ + OPT_fcompare_elim = 549, /* -fcompare-elim */ + OPT_fconcepts = 550, /* -fconcepts */ + OPT_fcond_mismatch = 551, /* -fcond-mismatch */ + OPT_fconserve_space = 552, /* -fconserve-space */ + OPT_fconserve_stack = 553, /* -fconserve-stack */ + OPT_fconstant_string_class_ = 554, /* -fconstant-string-class= */ + OPT_fconstexpr_depth_ = 555, /* -fconstexpr-depth= */ + OPT_fconstexpr_loop_limit_ = 556, /* -fconstexpr-loop-limit= */ + OPT_fconvert_ = 557, /* -fconvert= */ + OPT_fcprop_registers = 558, /* -fcprop-registers */ + OPT_fcray_pointer = 559, /* -fcray-pointer */ + OPT_fcrossjumping = 560, /* -fcrossjumping */ + OPT_fcse_follow_jumps = 561, /* -fcse-follow-jumps */ + /* OPT_fcse_skip_blocks = 562, */ /* -fcse-skip-blocks */ + OPT_fcx_fortran_rules = 563, /* -fcx-fortran-rules */ + OPT_fcx_limited_range = 564, /* -fcx-limited-range */ + OPT_fd_lines_as_code = 565, /* -fd-lines-as-code */ + OPT_fd_lines_as_comments = 566, /* -fd-lines-as-comments */ + OPT_fdata_sections = 567, /* -fdata-sections */ + OPT_fdbg_cnt_list = 568, /* -fdbg-cnt-list */ + OPT_fdbg_cnt_ = 569, /* -fdbg-cnt= */ + OPT_fdce = 570, /* -fdce */ + OPT_fdebug_cpp = 571, /* -fdebug-cpp */ + OPT_fdebug_prefix_map_ = 572, /* -fdebug-prefix-map= */ + OPT_fdebug_types_section = 573, /* -fdebug-types-section */ + OPT_fdec = 574, /* -fdec */ + OPT_fdec_intrinsic_ints = 575, /* -fdec-intrinsic-ints */ + OPT_fdec_math = 576, /* -fdec-math */ + OPT_fdec_static = 577, /* -fdec-static */ + OPT_fdec_structure = 578, /* -fdec-structure */ + OPT_fdeclone_ctor_dtor = 579, /* -fdeclone-ctor-dtor */ + OPT_fdeduce_init_list = 580, /* -fdeduce-init-list */ + OPT_fdefault_double_8 = 581, /* -fdefault-double-8 */ + /* OPT_fdefault_inline = 582, */ /* -fdefault-inline */ + OPT_fdefault_integer_8 = 583, /* -fdefault-integer-8 */ + OPT_fdefault_real_8 = 584, /* -fdefault-real-8 */ + OPT_fdefer_pop = 585, /* -fdefer-pop */ + OPT_fdelayed_branch = 586, /* -fdelayed-branch */ + OPT_fdelete_dead_exceptions = 587, /* -fdelete-dead-exceptions */ + OPT_fdelete_null_pointer_checks = 588, /* -fdelete-null-pointer-checks */ + OPT_fdevirtualize = 589, /* -fdevirtualize */ + OPT_fdevirtualize_at_ltrans = 590, /* -fdevirtualize-at-ltrans */ + OPT_fdevirtualize_speculatively = 591, /* -fdevirtualize-speculatively */ + /* OPT_fdiagnostics_color = 592, */ /* -fdiagnostics-color */ + OPT_fdiagnostics_color_ = 593, /* -fdiagnostics-color= */ + OPT_fdiagnostics_generate_patch = 594, /* -fdiagnostics-generate-patch */ + OPT_fdiagnostics_parseable_fixits = 595, /* -fdiagnostics-parseable-fixits */ + OPT_fdiagnostics_show_caret = 596, /* -fdiagnostics-show-caret */ + OPT_fdiagnostics_show_location_ = 597, /* -fdiagnostics-show-location= */ + OPT_fdiagnostics_show_option = 598, /* -fdiagnostics-show-option */ + OPT_fdirectives_only = 599, /* -fdirectives-only */ + OPT_fdisable_ = 600, /* -fdisable- */ + OPT_fdollar_ok = 601, /* -fdollar-ok */ + OPT_fdollars_in_identifiers = 602, /* -fdollars-in-identifiers */ + OPT_fdse = 603, /* -fdse */ + OPT_fdump_ = 604, /* -fdump- */ + OPT_fdump_ada_spec = 605, /* -fdump-ada-spec */ + OPT_fdump_ada_spec_slim = 606, /* -fdump-ada-spec-slim */ + /* OPT_fdump_core = 607, */ /* -fdump-core */ + OPT_fdump_final_insns = 608, /* -fdump-final-insns */ + OPT_fdump_final_insns_ = 609, /* -fdump-final-insns= */ + OPT_fdump_fortran_optimized = 610, /* -fdump-fortran-optimized */ + OPT_fdump_fortran_original = 611, /* -fdump-fortran-original */ + OPT_fdump_go_spec_ = 612, /* -fdump-go-spec= */ + OPT_fdump_internal_locations = 613, /* -fdump-internal-locations */ + OPT_fdump_noaddr = 614, /* -fdump-noaddr */ + /* OPT_fdump_parse_tree = 615, */ /* -fdump-parse-tree */ + OPT_fdump_passes = 616, /* -fdump-passes */ + OPT_fdump_unnumbered = 617, /* -fdump-unnumbered */ + OPT_fdump_unnumbered_links = 618, /* -fdump-unnumbered-links */ + OPT_fdwarf2_cfi_asm = 619, /* -fdwarf2-cfi-asm */ + OPT_fearly_inlining = 620, /* -fearly-inlining */ + OPT_felide_constructors = 621, /* -felide-constructors */ + OPT_feliminate_dwarf2_dups = 622, /* -feliminate-dwarf2-dups */ + OPT_feliminate_unused_debug_symbols = 623, /* -feliminate-unused-debug-symbols */ + OPT_feliminate_unused_debug_types = 624, /* -feliminate-unused-debug-types */ + OPT_femit_class_debug_always = 625, /* -femit-class-debug-always */ + OPT_femit_struct_debug_baseonly = 626, /* -femit-struct-debug-baseonly */ + OPT_femit_struct_debug_detailed_ = 627, /* -femit-struct-debug-detailed= */ + OPT_femit_struct_debug_reduced = 628, /* -femit-struct-debug-reduced */ + OPT_fenable_ = 629, /* -fenable- */ + OPT_fenforce_eh_specs = 630, /* -fenforce-eh-specs */ + /* OPT_fenum_int_equiv = 631, */ /* -fenum-int-equiv */ + OPT_fexceptions = 632, /* -fexceptions */ + OPT_fexcess_precision_ = 633, /* -fexcess-precision= */ + OPT_fexec_charset_ = 634, /* -fexec-charset= */ + OPT_fexpensive_optimizations = 635, /* -fexpensive-optimizations */ + OPT_fext_numeric_literals = 636, /* -fext-numeric-literals */ + OPT_fextended_identifiers = 637, /* -fextended-identifiers */ + OPT_fextern_tls_init = 638, /* -fextern-tls-init */ + OPT_fexternal_blas = 639, /* -fexternal-blas */ + /* OPT_fexternal_templates = 640, */ /* -fexternal-templates */ + OPT_ff2c = 641, /* -ff2c */ + OPT_ffast_math = 642, /* -ffast-math */ + OPT_ffat_lto_objects = 643, /* -ffat-lto-objects */ + OPT_ffinite_math_only = 644, /* -ffinite-math-only */ + OPT_ffixed_ = 645, /* -ffixed- */ + OPT_ffixed_form = 646, /* -ffixed-form */ + OPT_ffixed_line_length_ = 647, /* -ffixed-line-length- */ + OPT_ffixed_line_length_none = 648, /* -ffixed-line-length-none */ + OPT_ffloat_store = 649, /* -ffloat-store */ + OPT_ffor_scope = 650, /* -ffor-scope */ + /* OPT_fforce_addr = 651, */ /* -fforce-addr */ + OPT_fforward_propagate = 652, /* -fforward-propagate */ + OPT_ffp_contract_ = 653, /* -ffp-contract= */ + OPT_ffp_int_builtin_inexact = 654, /* -ffp-int-builtin-inexact */ + OPT_ffpe_summary_ = 655, /* -ffpe-summary= */ + OPT_ffpe_trap_ = 656, /* -ffpe-trap= */ + OPT_ffree_form = 657, /* -ffree-form */ + OPT_ffree_line_length_ = 658, /* -ffree-line-length- */ + OPT_ffree_line_length_none = 659, /* -ffree-line-length-none */ + OPT_ffreestanding = 660, /* -ffreestanding */ + OPT_ffriend_injection = 661, /* -ffriend-injection */ + OPT_ffrontend_optimize = 662, /* -ffrontend-optimize */ + OPT_ffunction_cse = 663, /* -ffunction-cse */ + OPT_ffunction_sections = 664, /* -ffunction-sections */ + OPT_fgcse = 665, /* -fgcse */ + OPT_fgcse_after_reload = 666, /* -fgcse-after-reload */ + OPT_fgcse_las = 667, /* -fgcse-las */ + OPT_fgcse_lm = 668, /* -fgcse-lm */ + OPT_fgcse_sm = 669, /* -fgcse-sm */ + OPT_fgimple = 670, /* -fgimple */ + OPT_fgnat_encodings_ = 671, /* -fgnat-encodings= */ + OPT_fgnu_keywords = 672, /* -fgnu-keywords */ + OPT_fgnu_runtime = 673, /* -fgnu-runtime */ + OPT_fgnu_tm = 674, /* -fgnu-tm */ + OPT_fgnu_unique = 675, /* -fgnu-unique */ + OPT_fgnu89_inline = 676, /* -fgnu89-inline */ + OPT_fgo_c_header_ = 677, /* -fgo-c-header= */ + OPT_fgo_check_divide_overflow = 678, /* -fgo-check-divide-overflow */ + OPT_fgo_check_divide_zero = 679, /* -fgo-check-divide-zero */ + OPT_fgo_compiling_runtime = 680, /* -fgo-compiling-runtime */ + OPT_fgo_debug_escape = 681, /* -fgo-debug-escape */ + OPT_fgo_dump_ = 682, /* -fgo-dump- */ + OPT_fgo_optimize_ = 683, /* -fgo-optimize- */ + OPT_fgo_pkgpath_ = 684, /* -fgo-pkgpath= */ + OPT_fgo_prefix_ = 685, /* -fgo-prefix= */ + OPT_fgo_relative_import_path_ = 686, /* -fgo-relative-import-path= */ + OPT_fgraphite = 687, /* -fgraphite */ + OPT_fgraphite_identity = 688, /* -fgraphite-identity */ + OPT_fguess_branch_probability = 689, /* -fguess-branch-probability */ + /* OPT_fguiding_decls = 690, */ /* -fguiding-decls */ + /* OPT_fhandle_exceptions = 691, */ /* -fhandle-exceptions */ + /* OPT_fhelp = 692, */ /* -fhelp */ + /* OPT_fhelp_ = 693, */ /* -fhelp= */ + OPT_fhoist_adjacent_loads = 694, /* -fhoist-adjacent-loads */ + /* OPT_fhonor_std = 695, */ /* -fhonor-std */ + OPT_fhosted = 696, /* -fhosted */ + /* OPT_fhuge_objects = 697, */ /* -fhuge-objects */ + OPT_fident = 698, /* -fident */ + OPT_fif_conversion = 699, /* -fif-conversion */ + OPT_fif_conversion2 = 700, /* -fif-conversion2 */ + OPT_fimplement_inlines = 701, /* -fimplement-inlines */ + OPT_fimplicit_inline_templates = 702, /* -fimplicit-inline-templates */ + OPT_fimplicit_none = 703, /* -fimplicit-none */ + OPT_fimplicit_templates = 704, /* -fimplicit-templates */ + OPT_findirect_inlining = 705, /* -findirect-inlining */ + OPT_finhibit_size_directive = 706, /* -finhibit-size-directive */ + OPT_finit_character_ = 707, /* -finit-character= */ + OPT_finit_derived = 708, /* -finit-derived */ + OPT_finit_integer_ = 709, /* -finit-integer= */ + OPT_finit_local_zero = 710, /* -finit-local-zero */ + OPT_finit_logical_ = 711, /* -finit-logical= */ + OPT_finit_real_ = 712, /* -finit-real= */ + OPT_finline = 713, /* -finline */ + OPT_finline_atomics = 714, /* -finline-atomics */ + OPT_finline_functions = 715, /* -finline-functions */ + OPT_finline_functions_called_once = 716, /* -finline-functions-called-once */ + /* OPT_finline_limit_ = 717, */ /* -finline-limit- */ + OPT_finline_limit_ = 718, /* -finline-limit= */ + OPT_finline_matmul_limit_ = 719, /* -finline-matmul-limit= */ + OPT_finline_small_functions = 720, /* -finline-small-functions */ + OPT_finput_charset_ = 721, /* -finput-charset= */ + OPT_finstrument_functions = 722, /* -finstrument-functions */ + OPT_finstrument_functions_exclude_file_list_ = 723,/* -finstrument-functions-exclude-file-list= */ + OPT_finstrument_functions_exclude_function_list_ = 724,/* -finstrument-functions-exclude-function-list= */ + OPT_finteger_4_integer_8 = 725, /* -finteger-4-integer-8 */ + OPT_fintrinsic_modules_path = 726, /* -fintrinsic-modules-path */ + OPT_fintrinsic_modules_path_ = 727, /* -fintrinsic-modules-path= */ + OPT_fipa_bit_cp = 728, /* -fipa-bit-cp */ + OPT_fipa_cp = 729, /* -fipa-cp */ + /* OPT_fipa_cp_alignment = 730, */ /* -fipa-cp-alignment */ + OPT_fipa_cp_clone = 731, /* -fipa-cp-clone */ + OPT_fipa_icf = 732, /* -fipa-icf */ + OPT_fipa_icf_functions = 733, /* -fipa-icf-functions */ + OPT_fipa_icf_variables = 734, /* -fipa-icf-variables */ + /* OPT_fipa_matrix_reorg = 735, */ /* -fipa-matrix-reorg */ + OPT_fipa_profile = 736, /* -fipa-profile */ + OPT_fipa_pta = 737, /* -fipa-pta */ + OPT_fipa_pure_const = 738, /* -fipa-pure-const */ + OPT_fipa_ra = 739, /* -fipa-ra */ + OPT_fipa_reference = 740, /* -fipa-reference */ + OPT_fipa_sra = 741, /* -fipa-sra */ + /* OPT_fipa_struct_reorg = 742, */ /* -fipa-struct-reorg */ + OPT_fipa_vrp = 743, /* -fipa-vrp */ + OPT_fira_algorithm_ = 744, /* -fira-algorithm= */ + OPT_fira_hoist_pressure = 745, /* -fira-hoist-pressure */ + OPT_fira_loop_pressure = 746, /* -fira-loop-pressure */ + OPT_fira_region_ = 747, /* -fira-region= */ + OPT_fira_share_save_slots = 748, /* -fira-share-save-slots */ + OPT_fira_share_spill_slots = 749, /* -fira-share-spill-slots */ + OPT_fira_verbose_ = 750, /* -fira-verbose= */ + OPT_fisolate_erroneous_paths_attribute = 751,/* -fisolate-erroneous-paths-attribute */ + OPT_fisolate_erroneous_paths_dereference = 752,/* -fisolate-erroneous-paths-dereference */ + OPT_fivar_visibility_ = 753, /* -fivar-visibility= */ + OPT_fivopts = 754, /* -fivopts */ + OPT_fjump_tables = 755, /* -fjump-tables */ + OPT_fkeep_gc_roots_live = 756, /* -fkeep-gc-roots-live */ + OPT_fkeep_inline_dllexport = 757, /* -fkeep-inline-dllexport */ + OPT_fkeep_inline_functions = 758, /* -fkeep-inline-functions */ + OPT_fkeep_static_consts = 759, /* -fkeep-static-consts */ + OPT_fkeep_static_functions = 760, /* -fkeep-static-functions */ + /* OPT_flabels_ok = 761, */ /* -flabels-ok */ + OPT_flax_vector_conversions = 762, /* -flax-vector-conversions */ + OPT_fleading_underscore = 763, /* -fleading-underscore */ + OPT_flifetime_dse = 764, /* -flifetime-dse */ + OPT_flifetime_dse_ = 765, /* -flifetime-dse= */ + OPT_flimit_function_alignment = 766, /* -flimit-function-alignment */ + OPT_flinker_output_ = 767, /* -flinker-output= */ + OPT_flive_range_shrinkage = 768, /* -flive-range-shrinkage */ + OPT_flocal_ivars = 769, /* -flocal-ivars */ + /* OPT_floop_block = 770, */ /* -floop-block */ + /* OPT_floop_flatten = 771, */ /* -floop-flatten */ + /* OPT_floop_interchange = 772, */ /* -floop-interchange */ + OPT_floop_nest_optimize = 773, /* -floop-nest-optimize */ + /* OPT_floop_optimize = 774, */ /* -floop-optimize */ + OPT_floop_parallelize_all = 775, /* -floop-parallelize-all */ + /* OPT_floop_strip_mine = 776, */ /* -floop-strip-mine */ + /* OPT_floop_unroll_and_jam = 777, */ /* -floop-unroll-and-jam */ + OPT_flra_remat = 778, /* -flra-remat */ + OPT_flto = 779, /* -flto */ + OPT_flto_compression_level_ = 780, /* -flto-compression-level= */ + OPT_flto_odr_type_merging = 781, /* -flto-odr-type-merging */ + OPT_flto_partition_ = 782, /* -flto-partition= */ + OPT_flto_report = 783, /* -flto-report */ + OPT_flto_report_wpa = 784, /* -flto-report-wpa */ + OPT_flto_ = 785, /* -flto= */ + OPT_fltrans = 786, /* -fltrans */ + OPT_fltrans_output_list_ = 787, /* -fltrans-output-list= */ + OPT_fmath_errno = 788, /* -fmath-errno */ + OPT_fmax_array_constructor_ = 789, /* -fmax-array-constructor= */ + OPT_fmax_errors_ = 790, /* -fmax-errors= */ + OPT_fmax_identifier_length_ = 791, /* -fmax-identifier-length= */ + OPT_fmax_stack_var_size_ = 792, /* -fmax-stack-var-size= */ + OPT_fmax_subrecord_length_ = 793, /* -fmax-subrecord-length= */ + OPT_fmem_report = 794, /* -fmem-report */ + OPT_fmem_report_wpa = 795, /* -fmem-report-wpa */ + OPT_fmerge_all_constants = 796, /* -fmerge-all-constants */ + OPT_fmerge_constants = 797, /* -fmerge-constants */ + OPT_fmerge_debug_strings = 798, /* -fmerge-debug-strings */ + OPT_fmessage_length_ = 799, /* -fmessage-length= */ + OPT_fmodule_private = 800, /* -fmodule-private */ + OPT_fmodulo_sched = 801, /* -fmodulo-sched */ + OPT_fmodulo_sched_allow_regmoves = 802, /* -fmodulo-sched-allow-regmoves */ + OPT_fmove_loop_invariants = 803, /* -fmove-loop-invariants */ + OPT_fms_extensions = 804, /* -fms-extensions */ + /* OPT_fmudflap = 805, */ /* -fmudflap */ + /* OPT_fmudflapir = 806, */ /* -fmudflapir */ + /* OPT_fmudflapth = 807, */ /* -fmudflapth */ + /* OPT_fname_mangling_version_ = 808, */ /* -fname-mangling-version- */ + /* OPT_fnew_abi = 809, */ /* -fnew-abi */ + OPT_fnew_inheriting_ctors = 810, /* -fnew-inheriting-ctors */ + OPT_fnew_ttp_matching = 811, /* -fnew-ttp-matching */ + OPT_fnext_runtime = 812, /* -fnext-runtime */ + OPT_fnil_receivers = 813, /* -fnil-receivers */ + OPT_fnon_call_exceptions = 814, /* -fnon-call-exceptions */ + OPT_fnonansi_builtins = 815, /* -fnonansi-builtins */ + /* OPT_fnonnull_objects = 816, */ /* -fnonnull-objects */ + OPT_fnothrow_opt = 817, /* -fnothrow-opt */ + OPT_fobjc_abi_version_ = 818, /* -fobjc-abi-version= */ + OPT_fobjc_call_cxx_cdtors = 819, /* -fobjc-call-cxx-cdtors */ + OPT_fobjc_direct_dispatch = 820, /* -fobjc-direct-dispatch */ + OPT_fobjc_exceptions = 821, /* -fobjc-exceptions */ + OPT_fobjc_gc = 822, /* -fobjc-gc */ + OPT_fobjc_nilcheck = 823, /* -fobjc-nilcheck */ + OPT_fobjc_sjlj_exceptions = 824, /* -fobjc-sjlj-exceptions */ + OPT_fobjc_std_objc1 = 825, /* -fobjc-std=objc1 */ + OPT_foffload_abi_ = 826, /* -foffload-abi= */ + OPT_foffload_ = 827, /* -foffload= */ + OPT_fomit_frame_pointer = 828, /* -fomit-frame-pointer */ + OPT_fopenacc = 829, /* -fopenacc */ + OPT_fopenacc_dim_ = 830, /* -fopenacc-dim= */ + OPT_fopenmp = 831, /* -fopenmp */ + OPT_fopenmp_simd = 832, /* -fopenmp-simd */ + OPT_foperator_names = 833, /* -foperator-names */ + OPT_fopt_info = 834, /* -fopt-info */ + OPT_fopt_info_ = 835, /* -fopt-info- */ + /* OPT_foptimize_register_move = 836, */ /* -foptimize-register-move */ + OPT_foptimize_sibling_calls = 837, /* -foptimize-sibling-calls */ + OPT_foptimize_strlen = 838, /* -foptimize-strlen */ + /* OPT_foptional_diags = 839, */ /* -foptional-diags */ + OPT_fpack_derived = 840, /* -fpack-derived */ + OPT_fpack_struct = 841, /* -fpack-struct */ + OPT_fpack_struct_ = 842, /* -fpack-struct= */ + OPT_fpartial_inlining = 843, /* -fpartial-inlining */ + OPT_fpcc_struct_return = 844, /* -fpcc-struct-return */ + OPT_fpch_deps = 845, /* -fpch-deps */ + OPT_fpch_preprocess = 846, /* -fpch-preprocess */ + OPT_fpeel_loops = 847, /* -fpeel-loops */ + OPT_fpeephole = 848, /* -fpeephole */ + OPT_fpeephole2 = 849, /* -fpeephole2 */ + OPT_fpermissive = 850, /* -fpermissive */ + OPT_fpermitted_flt_eval_methods_ = 851, /* -fpermitted-flt-eval-methods= */ + OPT_fpic = 852, /* -fpic */ + OPT_fpie = 853, /* -fpie */ + OPT_fplan9_extensions = 854, /* -fplan9-extensions */ + OPT_fplt = 855, /* -fplt */ + OPT_fplugin_arg_ = 856, /* -fplugin-arg- */ + OPT_fplugin_ = 857, /* -fplugin= */ + OPT_fpost_ipa_mem_report = 858, /* -fpost-ipa-mem-report */ + OPT_fpre_ipa_mem_report = 859, /* -fpre-ipa-mem-report */ + OPT_fpredictive_commoning = 860, /* -fpredictive-commoning */ + OPT_fprefetch_loop_arrays = 861, /* -fprefetch-loop-arrays */ + OPT_fpreprocessed = 862, /* -fpreprocessed */ + OPT_fpretty_templates = 863, /* -fpretty-templates */ + OPT_fprintf_return_value = 864, /* -fprintf-return-value */ + OPT_fprofile = 865, /* -fprofile */ + OPT_fprofile_arcs = 866, /* -fprofile-arcs */ + OPT_fprofile_correction = 867, /* -fprofile-correction */ + OPT_fprofile_dir_ = 868, /* -fprofile-dir= */ + OPT_fprofile_generate = 869, /* -fprofile-generate */ + OPT_fprofile_generate_ = 870, /* -fprofile-generate= */ + OPT_fprofile_reorder_functions = 871, /* -fprofile-reorder-functions */ + OPT_fprofile_report = 872, /* -fprofile-report */ + OPT_fprofile_update_ = 873, /* -fprofile-update= */ + OPT_fprofile_use = 874, /* -fprofile-use */ + OPT_fprofile_use_ = 875, /* -fprofile-use= */ + OPT_fprofile_values = 876, /* -fprofile-values */ + OPT_fprotect_parens = 877, /* -fprotect-parens */ + OPT_frandom_seed = 878, /* -frandom-seed */ + OPT_frandom_seed_ = 879, /* -frandom-seed= */ + OPT_frange_check = 880, /* -frange-check */ + OPT_freal_4_real_10 = 881, /* -freal-4-real-10 */ + OPT_freal_4_real_16 = 882, /* -freal-4-real-16 */ + OPT_freal_4_real_8 = 883, /* -freal-4-real-8 */ + OPT_freal_8_real_10 = 884, /* -freal-8-real-10 */ + OPT_freal_8_real_16 = 885, /* -freal-8-real-16 */ + OPT_freal_8_real_4 = 886, /* -freal-8-real-4 */ + OPT_frealloc_lhs = 887, /* -frealloc-lhs */ + OPT_freciprocal_math = 888, /* -freciprocal-math */ + OPT_frecord_gcc_switches = 889, /* -frecord-gcc-switches */ + OPT_frecord_marker_4 = 890, /* -frecord-marker=4 */ + OPT_frecord_marker_8 = 891, /* -frecord-marker=8 */ + OPT_frecursive = 892, /* -frecursive */ + OPT_free = 893, /* -free */ + OPT_freg_struct_return = 894, /* -freg-struct-return */ + /* OPT_fregmove = 895, */ /* -fregmove */ + OPT_frename_registers = 896, /* -frename-registers */ + OPT_freorder_blocks = 897, /* -freorder-blocks */ + OPT_freorder_blocks_algorithm_ = 898, /* -freorder-blocks-algorithm= */ + OPT_freorder_blocks_and_partition = 899, /* -freorder-blocks-and-partition */ + OPT_freorder_functions = 900, /* -freorder-functions */ + OPT_frepack_arrays = 901, /* -frepack-arrays */ + OPT_freplace_objc_classes = 902, /* -freplace-objc-classes */ + OPT_frepo = 903, /* -frepo */ + OPT_freport_bug = 904, /* -freport-bug */ + OPT_frequire_return_statement = 905, /* -frequire-return-statement */ + OPT_frerun_cse_after_loop = 906, /* -frerun-cse-after-loop */ + /* OPT_frerun_loop_opt = 907, */ /* -frerun-loop-opt */ + OPT_freschedule_modulo_scheduled_loops = 908,/* -freschedule-modulo-scheduled-loops */ + OPT_fresolution_ = 909, /* -fresolution= */ + OPT_frounding_math = 910, /* -frounding-math */ + OPT_frtti = 911, /* -frtti */ + OPT_fsanitize_address_use_after_scope = 912,/* -fsanitize-address-use-after-scope */ + OPT_fsanitize_coverage_trace_pc = 913, /* -fsanitize-coverage=trace-pc */ + OPT_fsanitize_recover = 914, /* -fsanitize-recover */ + OPT_fsanitize_recover_ = 915, /* -fsanitize-recover= */ + OPT_fsanitize_sections_ = 916, /* -fsanitize-sections= */ + OPT_fsanitize_undefined_trap_on_error = 917,/* -fsanitize-undefined-trap-on-error */ + OPT_fsanitize_ = 918, /* -fsanitize= */ + OPT_fsched_critical_path_heuristic = 919, /* -fsched-critical-path-heuristic */ + OPT_fsched_dep_count_heuristic = 920, /* -fsched-dep-count-heuristic */ + OPT_fsched_group_heuristic = 921, /* -fsched-group-heuristic */ + OPT_fsched_interblock = 922, /* -fsched-interblock */ + OPT_fsched_last_insn_heuristic = 923, /* -fsched-last-insn-heuristic */ + OPT_fsched_pressure = 924, /* -fsched-pressure */ + OPT_fsched_rank_heuristic = 925, /* -fsched-rank-heuristic */ + OPT_fsched_spec = 926, /* -fsched-spec */ + OPT_fsched_spec_insn_heuristic = 927, /* -fsched-spec-insn-heuristic */ + OPT_fsched_spec_load = 928, /* -fsched-spec-load */ + OPT_fsched_spec_load_dangerous = 929, /* -fsched-spec-load-dangerous */ + OPT_fsched_stalled_insns = 930, /* -fsched-stalled-insns */ + OPT_fsched_stalled_insns_dep = 931, /* -fsched-stalled-insns-dep */ + OPT_fsched_stalled_insns_dep_ = 932, /* -fsched-stalled-insns-dep= */ + OPT_fsched_stalled_insns_ = 933, /* -fsched-stalled-insns= */ + OPT_fsched_verbose_ = 934, /* -fsched-verbose= */ + OPT_fsched2_use_superblocks = 935, /* -fsched2-use-superblocks */ + /* OPT_fsched2_use_traces = 936, */ /* -fsched2-use-traces */ + OPT_fschedule_fusion = 937, /* -fschedule-fusion */ + OPT_fschedule_insns = 938, /* -fschedule-insns */ + OPT_fschedule_insns2 = 939, /* -fschedule-insns2 */ + OPT_fsecond_underscore = 940, /* -fsecond-underscore */ + OPT_fsection_anchors = 941, /* -fsection-anchors */ + /* OPT_fsee = 942, */ /* -fsee */ + OPT_fsel_sched_pipelining = 943, /* -fsel-sched-pipelining */ + OPT_fsel_sched_pipelining_outer_loops = 944,/* -fsel-sched-pipelining-outer-loops */ + OPT_fsel_sched_reschedule_pipelined = 945, /* -fsel-sched-reschedule-pipelined */ + OPT_fselective_scheduling = 946, /* -fselective-scheduling */ + OPT_fselective_scheduling2 = 947, /* -fselective-scheduling2 */ + OPT_fself_test_ = 948, /* -fself-test= */ + OPT_fsemantic_interposition = 949, /* -fsemantic-interposition */ + OPT_fshort_enums = 950, /* -fshort-enums */ + OPT_fshort_wchar = 951, /* -fshort-wchar */ + OPT_fshow_column = 952, /* -fshow-column */ + OPT_fshrink_wrap = 953, /* -fshrink-wrap */ + OPT_fshrink_wrap_separate = 954, /* -fshrink-wrap-separate */ + OPT_fsign_zero = 955, /* -fsign-zero */ + OPT_fsignaling_nans = 956, /* -fsignaling-nans */ + OPT_fsigned_bitfields = 957, /* -fsigned-bitfields */ + OPT_fsigned_char = 958, /* -fsigned-char */ + OPT_fsigned_zeros = 959, /* -fsigned-zeros */ + OPT_fsimd_cost_model_ = 960, /* -fsimd-cost-model= */ + OPT_fsingle_precision_constant = 961, /* -fsingle-precision-constant */ + OPT_fsized_deallocation = 962, /* -fsized-deallocation */ + OPT_fsplit_ivs_in_unroller = 963, /* -fsplit-ivs-in-unroller */ + OPT_fsplit_loops = 964, /* -fsplit-loops */ + OPT_fsplit_paths = 965, /* -fsplit-paths */ + OPT_fsplit_stack = 966, /* -fsplit-stack */ + OPT_fsplit_wide_types = 967, /* -fsplit-wide-types */ + /* OPT_fsquangle = 968, */ /* -fsquangle */ + OPT_fssa_backprop = 969, /* -fssa-backprop */ + OPT_fssa_phiopt = 970, /* -fssa-phiopt */ + OPT_fsso_struct_ = 971, /* -fsso-struct= */ + OPT_fstack_arrays = 972, /* -fstack-arrays */ + /* OPT_fstack_check = 973, */ /* -fstack-check */ + OPT_fstack_check_ = 974, /* -fstack-check= */ + OPT_fstack_limit = 975, /* -fstack-limit */ + OPT_fstack_limit_register_ = 976, /* -fstack-limit-register= */ + OPT_fstack_limit_symbol_ = 977, /* -fstack-limit-symbol= */ + OPT_fstack_protector = 978, /* -fstack-protector */ + OPT_fstack_protector_all = 979, /* -fstack-protector-all */ + OPT_fstack_protector_explicit = 980, /* -fstack-protector-explicit */ + OPT_fstack_protector_strong = 981, /* -fstack-protector-strong */ + OPT_fstack_reuse_ = 982, /* -fstack-reuse= */ + OPT_fstack_usage = 983, /* -fstack-usage */ + OPT_fstats = 984, /* -fstats */ + OPT_fstdarg_opt = 985, /* -fstdarg-opt */ + OPT_fstore_merging = 986, /* -fstore-merging */ + /* OPT_fstrength_reduce = 987, */ /* -fstrength-reduce */ + OPT_fstrict_aliasing = 988, /* -fstrict-aliasing */ + OPT_fstrict_enums = 989, /* -fstrict-enums */ + OPT_fstrict_overflow = 990, /* -fstrict-overflow */ + /* OPT_fstrict_prototype = 991, */ /* -fstrict-prototype */ + OPT_fstrict_volatile_bitfields = 992, /* -fstrict-volatile-bitfields */ + /* OPT_fstrong_eval_order = 993, */ /* -fstrong-eval-order */ + OPT_fstrong_eval_order_ = 994, /* -fstrong-eval-order= */ + OPT_fsync_libcalls = 995, /* -fsync-libcalls */ + OPT_fsyntax_only = 996, /* -fsyntax-only */ + OPT_ftabstop_ = 997, /* -ftabstop= */ + /* OPT_ftarget_help = 998, */ /* -ftarget-help */ + OPT_ftemplate_backtrace_limit_ = 999, /* -ftemplate-backtrace-limit= */ + /* OPT_ftemplate_depth_ = 1000, */ /* -ftemplate-depth- */ + OPT_ftemplate_depth_ = 1001, /* -ftemplate-depth= */ + OPT_ftest_coverage = 1002, /* -ftest-coverage */ + OPT_ftest_forall_temp = 1003, /* -ftest-forall-temp */ + /* OPT_fthis_is_variable = 1004, */ /* -fthis-is-variable */ + OPT_fthread_jumps = 1005, /* -fthread-jumps */ + OPT_fthreadsafe_statics = 1006, /* -fthreadsafe-statics */ + OPT_ftime_report = 1007, /* -ftime-report */ + OPT_ftime_report_details = 1008, /* -ftime-report-details */ + OPT_ftls_model_ = 1009, /* -ftls-model= */ + OPT_ftoplevel_reorder = 1010, /* -ftoplevel-reorder */ + OPT_ftracer = 1011, /* -ftracer */ + OPT_ftrack_macro_expansion = 1012, /* -ftrack-macro-expansion */ + OPT_ftrack_macro_expansion_ = 1013, /* -ftrack-macro-expansion= */ + OPT_ftrampolines = 1014, /* -ftrampolines */ + OPT_ftrapping_math = 1015, /* -ftrapping-math */ + OPT_ftrapv = 1016, /* -ftrapv */ + OPT_ftree_bit_ccp = 1017, /* -ftree-bit-ccp */ + OPT_ftree_builtin_call_dce = 1018, /* -ftree-builtin-call-dce */ + OPT_ftree_ccp = 1019, /* -ftree-ccp */ + OPT_ftree_ch = 1020, /* -ftree-ch */ + /* OPT_ftree_coalesce_inlined_vars = 1021, *//* -ftree-coalesce-inlined-vars */ + OPT_ftree_coalesce_vars = 1022, /* -ftree-coalesce-vars */ + OPT_ftree_copy_prop = 1023, /* -ftree-copy-prop */ + /* OPT_ftree_copyrename = 1024, */ /* -ftree-copyrename */ + OPT_ftree_cselim = 1025, /* -ftree-cselim */ + OPT_ftree_dce = 1026, /* -ftree-dce */ + OPT_ftree_dominator_opts = 1027, /* -ftree-dominator-opts */ + OPT_ftree_dse = 1028, /* -ftree-dse */ + OPT_ftree_forwprop = 1029, /* -ftree-forwprop */ + OPT_ftree_fre = 1030, /* -ftree-fre */ + OPT_ftree_loop_distribute_patterns = 1031, /* -ftree-loop-distribute-patterns */ + OPT_ftree_loop_distribution = 1032, /* -ftree-loop-distribution */ + OPT_ftree_loop_if_convert = 1033, /* -ftree-loop-if-convert */ + /* OPT_ftree_loop_if_convert_stores = 1034, *//* -ftree-loop-if-convert-stores */ + OPT_ftree_loop_im = 1035, /* -ftree-loop-im */ + OPT_ftree_loop_ivcanon = 1036, /* -ftree-loop-ivcanon */ + /* OPT_ftree_loop_linear = 1037, */ /* -ftree-loop-linear */ + OPT_ftree_loop_optimize = 1038, /* -ftree-loop-optimize */ + OPT_ftree_loop_vectorize = 1039, /* -ftree-loop-vectorize */ + OPT_ftree_lrs = 1040, /* -ftree-lrs */ + OPT_ftree_parallelize_loops_ = 1041, /* -ftree-parallelize-loops= */ + OPT_ftree_partial_pre = 1042, /* -ftree-partial-pre */ + OPT_ftree_phiprop = 1043, /* -ftree-phiprop */ + OPT_ftree_pre = 1044, /* -ftree-pre */ + OPT_ftree_pta = 1045, /* -ftree-pta */ + OPT_ftree_reassoc = 1046, /* -ftree-reassoc */ + /* OPT_ftree_salias = 1047, */ /* -ftree-salias */ + OPT_ftree_scev_cprop = 1048, /* -ftree-scev-cprop */ + OPT_ftree_sink = 1049, /* -ftree-sink */ + OPT_ftree_slp_vectorize = 1050, /* -ftree-slp-vectorize */ + OPT_ftree_slsr = 1051, /* -ftree-slsr */ + OPT_ftree_sra = 1052, /* -ftree-sra */ + /* OPT_ftree_store_ccp = 1053, */ /* -ftree-store-ccp */ + /* OPT_ftree_store_copy_prop = 1054, */ /* -ftree-store-copy-prop */ + OPT_ftree_switch_conversion = 1055, /* -ftree-switch-conversion */ + OPT_ftree_tail_merge = 1056, /* -ftree-tail-merge */ + OPT_ftree_ter = 1057, /* -ftree-ter */ + /* OPT_ftree_vect_loop_version = 1058, */ /* -ftree-vect-loop-version */ + OPT_ftree_vectorize = 1059, /* -ftree-vectorize */ + /* OPT_ftree_vectorizer_verbose_ = 1060, *//* -ftree-vectorizer-verbose= */ + OPT_ftree_vrp = 1061, /* -ftree-vrp */ + OPT_funconstrained_commons = 1062, /* -funconstrained-commons */ + OPT_funderscoring = 1063, /* -funderscoring */ + OPT_funit_at_a_time = 1064, /* -funit-at-a-time */ + OPT_funroll_all_loops = 1065, /* -funroll-all-loops */ + OPT_funroll_loops = 1066, /* -funroll-loops */ + /* OPT_funsafe_loop_optimizations = 1067, *//* -funsafe-loop-optimizations */ + OPT_funsafe_math_optimizations = 1068, /* -funsafe-math-optimizations */ + OPT_funsigned_bitfields = 1069, /* -funsigned-bitfields */ + OPT_funsigned_char = 1070, /* -funsigned-char */ + OPT_funswitch_loops = 1071, /* -funswitch-loops */ + OPT_funwind_tables = 1072, /* -funwind-tables */ + OPT_fuse_cxa_atexit = 1073, /* -fuse-cxa-atexit */ + OPT_fuse_cxa_get_exception_ptr = 1074, /* -fuse-cxa-get-exception-ptr */ + OPT_fuse_ld_bfd = 1075, /* -fuse-ld=bfd */ + OPT_fuse_ld_gold = 1076, /* -fuse-ld=gold */ + OPT_fuse_linker_plugin = 1077, /* -fuse-linker-plugin */ + OPT_fvar_tracking = 1078, /* -fvar-tracking */ + OPT_fvar_tracking_assignments = 1079, /* -fvar-tracking-assignments */ + OPT_fvar_tracking_assignments_toggle = 1080,/* -fvar-tracking-assignments-toggle */ + OPT_fvar_tracking_uninit = 1081, /* -fvar-tracking-uninit */ + OPT_fvariable_expansion_in_unroller = 1082,/* -fvariable-expansion-in-unroller */ + /* OPT_fvect_cost_model = 1083, */ /* -fvect-cost-model */ + OPT_fvect_cost_model_ = 1084, /* -fvect-cost-model= */ + OPT_fverbose_asm = 1085, /* -fverbose-asm */ + /* OPT_fversion = 1086, */ /* -fversion */ + OPT_fvisibility_inlines_hidden = 1087, /* -fvisibility-inlines-hidden */ + OPT_fvisibility_ms_compat = 1088, /* -fvisibility-ms-compat */ + OPT_fvisibility_ = 1089, /* -fvisibility= */ + OPT_fvpt = 1090, /* -fvpt */ + /* OPT_fvtable_gc = 1091, */ /* -fvtable-gc */ + /* OPT_fvtable_thunks = 1092, */ /* -fvtable-thunks */ + OPT_fvtable_verify_ = 1093, /* -fvtable-verify= */ + OPT_fvtv_counts = 1094, /* -fvtv-counts */ + OPT_fvtv_debug = 1095, /* -fvtv-debug */ + OPT_fweak = 1096, /* -fweak */ + OPT_fweb = 1097, /* -fweb */ + /* OPT_fwhole_file = 1098, */ /* -fwhole-file */ + OPT_fwhole_program = 1099, /* -fwhole-program */ + OPT_fwide_exec_charset_ = 1100, /* -fwide-exec-charset= */ + OPT_fworking_directory = 1101, /* -fworking-directory */ + OPT_fwpa = 1102, /* -fwpa */ + OPT_fwpa_ = 1103, /* -fwpa= */ + OPT_fwrapv = 1104, /* -fwrapv */ + /* OPT_fxref = 1105, */ /* -fxref */ + /* OPT_fzee = 1106, */ /* -fzee */ + OPT_fzero_initialized_in_bss = 1107, /* -fzero-initialized-in-bss */ + OPT_fzero_link = 1108, /* -fzero-link */ + OPT_g = 1109, /* -g */ + OPT_gant = 1110, /* -gant */ + OPT_gcoff = 1111, /* -gcoff */ + OPT_gcolumn_info = 1112, /* -gcolumn-info */ + OPT_gdwarf = 1113, /* -gdwarf */ + OPT_gdwarf_ = 1114, /* -gdwarf- */ + OPT_gen_decls = 1115, /* -gen-decls */ + OPT_ggdb = 1116, /* -ggdb */ + OPT_ggnu_pubnames = 1117, /* -ggnu-pubnames */ + OPT_gnat = 1118, /* -gnat */ + OPT_gnatO = 1119, /* -gnatO */ + OPT_gno_column_info = 1120, /* -gno-column-info */ + OPT_gno_pubnames = 1121, /* -gno-pubnames */ + OPT_gno_record_gcc_switches = 1122, /* -gno-record-gcc-switches */ + OPT_gno_split_dwarf = 1123, /* -gno-split-dwarf */ + OPT_gno_strict_dwarf = 1124, /* -gno-strict-dwarf */ + OPT_gpubnames = 1125, /* -gpubnames */ + OPT_grecord_gcc_switches = 1126, /* -grecord-gcc-switches */ + OPT_gsplit_dwarf = 1127, /* -gsplit-dwarf */ + OPT_gstabs = 1128, /* -gstabs */ + OPT_gstabs_ = 1129, /* -gstabs+ */ + OPT_gstrict_dwarf = 1130, /* -gstrict-dwarf */ + OPT_gtoggle = 1131, /* -gtoggle */ + OPT_gvms = 1132, /* -gvms */ + OPT_gxcoff = 1133, /* -gxcoff */ + OPT_gxcoff_ = 1134, /* -gxcoff+ */ + OPT_gz = 1135, /* -gz */ + OPT_gz_ = 1136, /* -gz= */ + OPT_h = 1137, /* -h */ + OPT_idirafter = 1138, /* -idirafter */ + OPT_imacros = 1139, /* -imacros */ + OPT_imultiarch = 1140, /* -imultiarch */ + OPT_imultilib = 1141, /* -imultilib */ + OPT_include = 1142, /* -include */ + OPT_iplugindir_ = 1143, /* -iplugindir= */ + OPT_iprefix = 1144, /* -iprefix */ + OPT_iquote = 1145, /* -iquote */ + OPT_isysroot = 1146, /* -isysroot */ + OPT_isystem = 1147, /* -isystem */ + OPT_iwithprefix = 1148, /* -iwithprefix */ + OPT_iwithprefixbefore = 1149, /* -iwithprefixbefore */ + OPT_k8 = 1150, /* -k8 */ + OPT_l = 1151, /* -l */ + OPT_lang_asm = 1152, /* -lang-asm */ + OPT_mabi_ = 1153, /* -mabi= */ + OPT_mabicalls = 1154, /* -mabicalls */ + OPT_mabs_ = 1155, /* -mabs= */ + OPT_mandroid = 1156, /* -mandroid */ + OPT_march_ = 1157, /* -march= */ + OPT_mbionic = 1158, /* -mbionic */ + OPT_mbranch_cost_ = 1159, /* -mbranch-cost= */ + OPT_mbranch_likely = 1160, /* -mbranch-likely */ + OPT_mcheck_zero_division = 1161, /* -mcheck-zero-division */ + OPT_mcode_readable_ = 1162, /* -mcode-readable= */ + OPT_mcompact_branches_ = 1163, /* -mcompact-branches= */ + OPT_mdebug = 1164, /* -mdebug */ + OPT_mdebugd = 1165, /* -mdebugd */ + OPT_mdivide_breaks = 1166, /* -mdivide-breaks */ + OPT_mdivide_traps = 1167, /* -mdivide-traps */ + OPT_mdmx = 1168, /* -mdmx */ + OPT_mdouble_float = 1169, /* -mdouble-float */ + OPT_mdsp = 1170, /* -mdsp */ + OPT_mdspr2 = 1171, /* -mdspr2 */ + OPT_meb = 1172, /* -meb */ + OPT_mel = 1173, /* -mel */ + OPT_membedded_data = 1174, /* -membedded-data */ + OPT_meva = 1175, /* -meva */ + OPT_mexplicit_relocs = 1176, /* -mexplicit-relocs */ + OPT_mextern_sdata = 1177, /* -mextern-sdata */ + OPT_mfix_24k = 1178, /* -mfix-24k */ + OPT_mfix_r10000 = 1179, /* -mfix-r10000 */ + OPT_mfix_r4000 = 1180, /* -mfix-r4000 */ + OPT_mfix_r4400 = 1181, /* -mfix-r4400 */ + OPT_mfix_rm7000 = 1182, /* -mfix-rm7000 */ + OPT_mfix_sb1 = 1183, /* -mfix-sb1 */ + OPT_mfix_vr4120 = 1184, /* -mfix-vr4120 */ + OPT_mfix_vr4130 = 1185, /* -mfix-vr4130 */ + OPT_mfix4300 = 1186, /* -mfix4300 */ + OPT_mflip_mips16 = 1187, /* -mflip-mips16 */ + OPT_mflush_func_ = 1188, /* -mflush-func= */ + OPT_mfp_exceptions = 1189, /* -mfp-exceptions */ + OPT_mfp32 = 1190, /* -mfp32 */ + OPT_mfp64 = 1191, /* -mfp64 */ + OPT_mfpxx = 1192, /* -mfpxx */ + OPT_mframe_header_opt = 1193, /* -mframe-header-opt */ + /* OPT_mfused_madd = 1194, */ /* -mfused-madd */ + OPT_mglibc = 1195, /* -mglibc */ + OPT_mgp32 = 1196, /* -mgp32 */ + OPT_mgp64 = 1197, /* -mgp64 */ + OPT_mgpopt = 1198, /* -mgpopt */ + OPT_mhard_float = 1199, /* -mhard-float */ + OPT_mimadd = 1200, /* -mimadd */ + OPT_minterlink_compressed = 1201, /* -minterlink-compressed */ + OPT_minterlink_mips16 = 1202, /* -minterlink-mips16 */ + OPT_mips = 1203, /* -mips */ + OPT_mips16 = 1204, /* -mips16 */ + OPT_mips3d = 1205, /* -mips3d */ + OPT_mllsc = 1206, /* -mllsc */ + OPT_mload_store_pairs = 1207, /* -mload-store-pairs */ + OPT_mlocal_sdata = 1208, /* -mlocal-sdata */ + OPT_mlong_calls = 1209, /* -mlong-calls */ + OPT_mlong32 = 1210, /* -mlong32 */ + OPT_mlong64 = 1211, /* -mlong64 */ + OPT_mlra = 1212, /* -mlra */ + OPT_mlxc1_sxc1 = 1213, /* -mlxc1-sxc1 */ + OPT_mmad = 1214, /* -mmad */ + OPT_mmadd4 = 1215, /* -mmadd4 */ + OPT_mmcount_ra_address = 1216, /* -mmcount-ra-address */ + OPT_mmcu = 1217, /* -mmcu */ + OPT_mmemcpy = 1218, /* -mmemcpy */ + OPT_mmicromips = 1219, /* -mmicromips */ + OPT_mmsa = 1220, /* -mmsa */ + OPT_mmt = 1221, /* -mmt */ + OPT_mmusl = 1222, /* -mmusl */ + OPT_mnan_ = 1223, /* -mnan= */ + OPT_mno_float = 1224, /* -mno-float */ + OPT_mno_flush_func = 1225, /* -mno-flush-func */ + OPT_mno_mdmx = 1226, /* -mno-mdmx */ + OPT_mno_mips16 = 1227, /* -mno-mips16 */ + OPT_mno_mips3d = 1228, /* -mno-mips3d */ + OPT_modd_spreg = 1229, /* -modd-spreg */ + OPT_mpaired_single = 1230, /* -mpaired-single */ + OPT_mplt = 1231, /* -mplt */ + OPT_mr10k_cache_barrier_ = 1232, /* -mr10k-cache-barrier= */ + OPT_mrelax_pic_calls = 1233, /* -mrelax-pic-calls */ + OPT_mshared = 1234, /* -mshared */ + OPT_msingle_float = 1235, /* -msingle-float */ + OPT_msmartmips = 1236, /* -msmartmips */ + OPT_msoft_float = 1237, /* -msoft-float */ + OPT_msplit_addresses = 1238, /* -msplit-addresses */ + OPT_msym32 = 1239, /* -msym32 */ + OPT_msynci = 1240, /* -msynci */ + OPT_mtune_ = 1241, /* -mtune= */ + OPT_muclibc = 1242, /* -muclibc */ + OPT_muninit_const_in_rodata = 1243, /* -muninit-const-in-rodata */ + OPT_mvirt = 1244, /* -mvirt */ + OPT_mvr4130_align = 1245, /* -mvr4130-align */ + OPT_mxgot = 1246, /* -mxgot */ + OPT_mxpa = 1247, /* -mxpa */ + OPT_n = 1248, /* -n */ + OPT_no_canonical_prefixes = 1249, /* -no-canonical-prefixes */ + OPT_no_integrated_cpp = 1250, /* -no-integrated-cpp */ + OPT_no_pie = 1251, /* -no-pie */ + OPT_noasmopt = 1252, /* -noasmopt */ + OPT_nocpp = 1253, /* -nocpp */ + OPT_nodefaultlibs = 1254, /* -nodefaultlibs */ + OPT_nostartfiles = 1255, /* -nostartfiles */ + OPT_nostdinc = 1256, /* -nostdinc */ + OPT_nostdinc__ = 1257, /* -nostdinc++ */ + OPT_nostdlib = 1258, /* -nostdlib */ + OPT_o = 1259, /* -o */ + OPT_p = 1260, /* -p */ + OPT_pass_exit_codes = 1261, /* -pass-exit-codes */ + /* OPT_pedantic = 1262, */ /* -pedantic */ + OPT_pedantic_errors = 1263, /* -pedantic-errors */ + OPT_pg = 1264, /* -pg */ + OPT_pie = 1265, /* -pie */ + OPT_pipe = 1266, /* -pipe */ + OPT_posix = 1267, /* -posix */ + OPT_print_file_name_ = 1268, /* -print-file-name= */ + OPT_print_libgcc_file_name = 1269, /* -print-libgcc-file-name */ + OPT_print_multi_directory = 1270, /* -print-multi-directory */ + OPT_print_multi_lib = 1271, /* -print-multi-lib */ + OPT_print_multi_os_directory = 1272, /* -print-multi-os-directory */ + OPT_print_multiarch = 1273, /* -print-multiarch */ + OPT_print_objc_runtime_info = 1274, /* -print-objc-runtime-info */ + OPT_print_prog_name_ = 1275, /* -print-prog-name= */ + OPT_print_search_dirs = 1276, /* -print-search-dirs */ + OPT_print_sysroot = 1277, /* -print-sysroot */ + OPT_print_sysroot_headers_suffix = 1278, /* -print-sysroot-headers-suffix */ + OPT_profile = 1279, /* -profile */ + OPT_pthread = 1280, /* -pthread */ + OPT_quiet = 1281, /* -quiet */ + OPT_r = 1282, /* -r */ + OPT_rdynamic = 1283, /* -rdynamic */ + OPT_remap = 1284, /* -remap */ + OPT_s = 1285, /* -s */ + OPT_save_temps = 1286, /* -save-temps */ + OPT_save_temps_ = 1287, /* -save-temps= */ + OPT_shared = 1288, /* -shared */ + OPT_shared_libgcc = 1289, /* -shared-libgcc */ + /* OPT_specs = 1290, */ /* -specs */ + OPT_specs_ = 1291, /* -specs= */ + OPT_static = 1292, /* -static */ + OPT_static_libasan = 1293, /* -static-libasan */ + OPT_static_libgcc = 1294, /* -static-libgcc */ + OPT_static_libgfortran = 1295, /* -static-libgfortran */ + OPT_static_libgo = 1296, /* -static-libgo */ + OPT_static_liblsan = 1297, /* -static-liblsan */ + OPT_static_libmpx = 1298, /* -static-libmpx */ + OPT_static_libmpxwrappers = 1299, /* -static-libmpxwrappers */ + OPT_static_libstdc__ = 1300, /* -static-libstdc++ */ + OPT_static_libtsan = 1301, /* -static-libtsan */ + OPT_static_libubsan = 1302, /* -static-libubsan */ + /* OPT_std_c__03 = 1303, */ /* -std=c++03 */ + /* OPT_std_c__0x = 1304, */ /* -std=c++0x */ + OPT_std_c__11 = 1305, /* -std=c++11 */ + OPT_std_c__14 = 1306, /* -std=c++14 */ + /* OPT_std_c__17 = 1307, */ /* -std=c++17 */ + /* OPT_std_c__1y = 1308, */ /* -std=c++1y */ + OPT_std_c__1z = 1309, /* -std=c++1z */ + OPT_std_c__98 = 1310, /* -std=c++98 */ + OPT_std_c11 = 1311, /* -std=c11 */ + /* OPT_std_c1x = 1312, */ /* -std=c1x */ + /* OPT_std_c89 = 1313, */ /* -std=c89 */ + OPT_std_c90 = 1314, /* -std=c90 */ + OPT_std_c99 = 1315, /* -std=c99 */ + /* OPT_std_c9x = 1316, */ /* -std=c9x */ + OPT_std_f2003 = 1317, /* -std=f2003 */ + OPT_std_f2008 = 1318, /* -std=f2008 */ + OPT_std_f2008ts = 1319, /* -std=f2008ts */ + OPT_std_f95 = 1320, /* -std=f95 */ + OPT_std_gnu = 1321, /* -std=gnu */ + /* OPT_std_gnu__03 = 1322, */ /* -std=gnu++03 */ + /* OPT_std_gnu__0x = 1323, */ /* -std=gnu++0x */ + OPT_std_gnu__11 = 1324, /* -std=gnu++11 */ + OPT_std_gnu__14 = 1325, /* -std=gnu++14 */ + /* OPT_std_gnu__17 = 1326, */ /* -std=gnu++17 */ + /* OPT_std_gnu__1y = 1327, */ /* -std=gnu++1y */ + OPT_std_gnu__1z = 1328, /* -std=gnu++1z */ + OPT_std_gnu__98 = 1329, /* -std=gnu++98 */ + OPT_std_gnu11 = 1330, /* -std=gnu11 */ + /* OPT_std_gnu1x = 1331, */ /* -std=gnu1x */ + /* OPT_std_gnu89 = 1332, */ /* -std=gnu89 */ + OPT_std_gnu90 = 1333, /* -std=gnu90 */ + OPT_std_gnu99 = 1334, /* -std=gnu99 */ + /* OPT_std_gnu9x = 1335, */ /* -std=gnu9x */ + /* OPT_std_iso9899_1990 = 1336, */ /* -std=iso9899:1990 */ + OPT_std_iso9899_199409 = 1337, /* -std=iso9899:199409 */ + /* OPT_std_iso9899_1999 = 1338, */ /* -std=iso9899:1999 */ + /* OPT_std_iso9899_199x = 1339, */ /* -std=iso9899:199x */ + /* OPT_std_iso9899_2011 = 1340, */ /* -std=iso9899:2011 */ + OPT_std_legacy = 1341, /* -std=legacy */ + OPT_symbolic = 1342, /* -symbolic */ + OPT_t = 1343, /* -t */ + OPT_time = 1344, /* -time */ + OPT_time_ = 1345, /* -time= */ + OPT_tno_android_cc = 1346, /* -tno-android-cc */ + OPT_tno_android_ld = 1347, /* -tno-android-ld */ + OPT_traditional = 1348, /* -traditional */ + OPT_traditional_cpp = 1349, /* -traditional-cpp */ + OPT_trigraphs = 1350, /* -trigraphs */ + OPT_u = 1351, /* -u */ + OPT_undef = 1352, /* -undef */ + OPT_v = 1353, /* -v */ + OPT_version = 1354, /* -version */ + OPT_w = 1355, /* -w */ + OPT_wrapper = 1356, /* -wrapper */ + OPT_x = 1357, /* -x */ + OPT_z = 1358, /* -z */ + N_OPTS, + OPT_SPECIAL_unknown, + OPT_SPECIAL_ignore, + OPT_SPECIAL_program_name, + OPT_SPECIAL_input_file +}; + +#ifdef GCC_C_COMMON_C +/* Mapping from cpp message reasons to the options that enable them. */ +#include +struct cpp_reason_option_codes_t +{ + const int reason; /* cpplib message reason. */ + const int option_code; /* gcc option that controls this message. */ +}; + +static const struct cpp_reason_option_codes_t cpp_reason_option_codes[] = { + {CPP_W_BUILTIN_MACRO_REDEFINED, OPT_Wbuiltin_macro_redefined}, + {CPP_W_CXX_OPERATOR_NAMES, OPT_Wc___compat}, + {CPP_W_CXX11_COMPAT, OPT_Wc__11_compat}, + {CPP_W_C90_C99_COMPAT, OPT_Wc90_c99_compat}, + {CPP_W_COMMENTS, OPT_Wcomment}, + {CPP_W_WARNING_DIRECTIVE, OPT_Wcpp}, + {CPP_W_DATE_TIME, OPT_Wdate_time}, + {CPP_W_DEPRECATED, OPT_Wdeprecated}, + {CPP_W_ENDIF_LABELS, OPT_Wendif_labels}, + {CPP_W_EXPANSION_TO_DEFINED, OPT_Wexpansion_to_defined}, + {CPP_W_INVALID_PCH, OPT_Winvalid_pch}, + {CPP_W_LITERAL_SUFFIX, OPT_Wliteral_suffix}, + {CPP_W_LONG_LONG, OPT_Wlong_long}, + {CPP_W_MISSING_INCLUDE_DIRS, OPT_Wmissing_include_dirs}, + {CPP_W_MULTICHAR, OPT_Wmultichar}, + {CPP_W_NORMALIZE, OPT_Wnormalized_}, + {CPP_W_PEDANTIC, OPT_Wpedantic}, + {CPP_W_TRADITIONAL, OPT_Wtraditional}, + {CPP_W_TRIGRAPHS, OPT_Wtrigraphs}, + {CPP_W_UNDEF, OPT_Wundef}, + {CPP_W_UNUSED_MACROS, OPT_Wunused_macros}, + {CPP_W_VARIADIC_MACROS, OPT_Wvariadic_macros}, + {CPP_W_NONE, 0}, +}; +#endif + +#endif /* OPTIONS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/opts-diagnostic.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/opts-diagnostic.h new file mode 100644 index 0000000..b016e37 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/opts-diagnostic.h @@ -0,0 +1,25 @@ +/* Command line option handling. Interactions with diagnostics code. + Copyright (C) 2010-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_OPTS_DIAGNOSTIC_H +#define GCC_OPTS_DIAGNOSTIC_H + +extern char *option_name (diagnostic_context *context, int option_index, + diagnostic_t orig_diag_kind, diagnostic_t diag_kind); +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/opts.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/opts.h new file mode 100644 index 0000000..4184719 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/opts.h @@ -0,0 +1,435 @@ +/* Command line option handling. + Copyright (C) 2002-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_OPTS_H +#define GCC_OPTS_H + +#include "obstack.h" + +/* Specifies how a switch's VAR_VALUE relates to its FLAG_VAR. */ +enum cl_var_type { + /* The switch is enabled when FLAG_VAR is nonzero. */ + CLVC_BOOLEAN, + + /* The switch is enabled when FLAG_VAR == VAR_VALUE. */ + CLVC_EQUAL, + + /* The switch is enabled when VAR_VALUE is not set in FLAG_VAR. */ + CLVC_BIT_CLEAR, + + /* The switch is enabled when VAR_VALUE is set in FLAG_VAR. */ + CLVC_BIT_SET, + + /* The switch takes a string argument and FLAG_VAR points to that + argument. */ + CLVC_STRING, + + /* The switch takes an enumerated argument (VAR_ENUM says what + enumeration) and FLAG_VAR points to that argument. */ + CLVC_ENUM, + + /* The switch should be stored in the VEC pointed to by FLAG_VAR for + later processing. */ + CLVC_DEFER +}; + +struct cl_option +{ + /* Text of the option, including initial '-'. */ + const char *opt_text; + /* Help text for --help, or NULL. */ + const char *help; + /* Error message for missing argument, or NULL. */ + const char *missing_argument_error; + /* Warning to give when this option is used, or NULL. */ + const char *warn_message; + /* Argument of alias target when positive option given, or NULL. */ + const char *alias_arg; + /* Argument of alias target when negative option given, or NULL. */ + const char *neg_alias_arg; + /* Alias target, or N_OPTS if not an alias. */ + unsigned short alias_target; + /* Previous option that is an initial substring of this one, or + N_OPTS if none. */ + unsigned short back_chain; + /* Option length, not including initial '-'. */ + unsigned char opt_len; + /* Next option in a sequence marked with Negative, or -1 if none. */ + int neg_index; + /* CL_* flags for this option. */ + unsigned int flags; + /* Disabled in this configuration. */ + BOOL_BITFIELD cl_disabled : 1; + /* Options marked with CL_SEPARATE take a number of separate + arguments (1 to 4) that is one more than the number in this + bit-field. */ + unsigned int cl_separate_nargs : 2; + /* Option is an alias when used with separate argument. */ + BOOL_BITFIELD cl_separate_alias : 1; + /* Alias to negative form of option. */ + BOOL_BITFIELD cl_negative_alias : 1; + /* Option takes no argument in the driver. */ + BOOL_BITFIELD cl_no_driver_arg : 1; + /* Reject this option in the driver. */ + BOOL_BITFIELD cl_reject_driver : 1; + /* Reject no- form. */ + BOOL_BITFIELD cl_reject_negative : 1; + /* Missing argument OK (joined). */ + BOOL_BITFIELD cl_missing_ok : 1; + /* Argument is an integer >=0. */ + BOOL_BITFIELD cl_uinteger : 1; + /* Argument is a HOST_WIDE_INT. */ + BOOL_BITFIELD cl_host_wide_int : 1; + /* Argument should be converted to lowercase. */ + BOOL_BITFIELD cl_tolower : 1; + /* Report argument with -fverbose-asm */ + BOOL_BITFIELD cl_report : 1; + /* Offset of field for this option in struct gcc_options, or + (unsigned short) -1 if none. */ + unsigned short flag_var_offset; + /* Index in cl_enums of enum used for this option's arguments, for + CLVC_ENUM options. */ + unsigned short var_enum; + /* How this option's value is determined and sets a field. */ + enum cl_var_type var_type; + /* Value or bit-mask with which to set a field. */ + HOST_WIDE_INT var_value; +}; + +/* Records that the state of an option consists of SIZE bytes starting + at DATA. DATA might point to CH in some cases. */ +struct cl_option_state { + const void *data; + size_t size; + char ch; +}; + +extern const struct cl_option cl_options[]; +extern const unsigned int cl_options_count; +extern const char *const lang_names[]; +extern const unsigned int cl_lang_count; + +#define CL_PARAMS (1U << 16) /* Fake entry. Used to display --param info with --help. */ +#define CL_WARNING (1U << 17) /* Enables an (optional) warning message. */ +#define CL_OPTIMIZATION (1U << 18) /* Enables an (optional) optimization. */ +#define CL_DRIVER (1U << 19) /* Driver option. */ +#define CL_TARGET (1U << 20) /* Target-specific option. */ +#define CL_COMMON (1U << 21) /* Language-independent. */ + +#define CL_MIN_OPTION_CLASS CL_PARAMS +#define CL_MAX_OPTION_CLASS CL_COMMON + +/* From here on the bits describe attributes of the options. + Before this point the bits have described the class of the option. + This distinction is important because --help will not list options + which only have these higher bits set. */ + +#define CL_JOINED (1U << 22) /* If takes joined argument. */ +#define CL_SEPARATE (1U << 23) /* If takes a separate argument. */ +#define CL_UNDOCUMENTED (1U << 24) /* Do not output with --help. */ +#define CL_NO_DWARF_RECORD (1U << 25) /* Do not add to producer string. */ +#define CL_PCH_IGNORE (1U << 26) /* Do compare state for pch. */ + +/* Flags for an enumerated option argument. */ +#define CL_ENUM_CANONICAL (1 << 0) /* Canonical for this value. */ +#define CL_ENUM_DRIVER_ONLY (1 << 1) /* Only accepted in the driver. */ + +/* Structure describing an enumerated option argument. */ + +struct cl_enum_arg +{ + /* The argument text, or NULL at the end of the array. */ + const char *arg; + + /* The corresponding integer value. */ + int value; + + /* Flags associated with this argument. */ + unsigned int flags; +}; + +/* Structure describing an enumerated set of option arguments. */ + +struct cl_enum +{ + /* Help text, or NULL if the values should not be listed in --help + output. */ + const char *help; + + /* Error message for unknown arguments, or NULL to use a generic + error. */ + const char *unknown_error; + + /* Array of possible values. */ + const struct cl_enum_arg *values; + + /* The size of the type used to store a value. */ + size_t var_size; + + /* Function to set a variable of this type. */ + void (*set) (void *var, int value); + + /* Function to get the value of a variable of this type. */ + int (*get) (const void *var); +}; + +extern const struct cl_enum cl_enums[]; +extern const unsigned int cl_enums_count; + +/* Possible ways in which a command-line option may be erroneous. + These do not include not being known at all; an option index of + OPT_SPECIAL_unknown is used for that. */ + +#define CL_ERR_DISABLED (1 << 0) /* Disabled in this configuration. */ +#define CL_ERR_MISSING_ARG (1 << 1) /* Argument required but missing. */ +#define CL_ERR_WRONG_LANG (1 << 2) /* Option for wrong language. */ +#define CL_ERR_UINT_ARG (1 << 3) /* Bad unsigned integer argument. */ +#define CL_ERR_ENUM_ARG (1 << 4) /* Bad enumerated argument. */ +#define CL_ERR_NEGATIVE (1 << 5) /* Negative form of option + not permitted (together + with OPT_SPECIAL_unknown). */ + +/* Structure describing the result of decoding an option. */ + +struct cl_decoded_option +{ + /* The index of this option, or an OPT_SPECIAL_* value for + non-options and unknown options. */ + size_t opt_index; + + /* Any warning to give for use of this option, or NULL if none. */ + const char *warn_message; + + /* The string argument, or NULL if none. For OPT_SPECIAL_* cases, + the option or non-option command-line argument. */ + const char *arg; + + /* The original text of option plus arguments, with separate argv + elements concatenated into one string with spaces separating + them. This is for such uses as diagnostics and + -frecord-gcc-switches. */ + const char *orig_option_with_args_text; + + /* The canonical form of the option and its argument, for when it is + necessary to reconstruct argv elements (in particular, for + processing specs and passing options to subprocesses from the + driver). */ + const char *canonical_option[4]; + + /* The number of elements in the canonical form of the option and + arguments; always at least 1. */ + size_t canonical_option_num_elements; + + /* For a boolean option, 1 for the true case and 0 for the "no-" + case. For an unsigned integer option, the value of the + argument. 1 in all other cases. */ + int value; + + /* Any flags describing errors detected in this option. */ + int errors; +}; + +/* Structure describing an option deferred for handling after the main + option handlers. */ + +struct cl_deferred_option +{ + /* Elements from struct cl_decoded_option used for deferred + options. */ + size_t opt_index; + const char *arg; + int value; +}; + +/* Structure describing a single option-handling callback. */ + +struct cl_option_handler_func +{ + /* The function called to handle the option. */ + bool (*handler) (struct gcc_options *opts, + struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + unsigned int lang_mask, int kind, location_t loc, + const struct cl_option_handlers *handlers, + diagnostic_context *dc, + void (*target_option_override_hook) (void)); + + /* The mask that must have some bit in common with the flags for the + option for this particular handler to be used. */ + unsigned int mask; +}; + +/* Structure describing the callbacks used in handling options. */ + +struct cl_option_handlers +{ + /* Callback for an unknown option to determine whether to give an + error for it, and possibly store information to diagnose the + option at a later point. Return true if an error should be + given, false otherwise. */ + bool (*unknown_option_callback) (const struct cl_decoded_option *decoded); + + /* Callback to handle, and possibly diagnose, an option for another + language. */ + void (*wrong_lang_callback) (const struct cl_decoded_option *decoded, + unsigned int lang_mask); + + /* Target option override hook. */ + void (*target_option_override_hook) (void); + + /* The number of individual handlers. */ + size_t num_handlers; + + /* The handlers themselves. */ + struct cl_option_handler_func handlers[3]; +}; + +/* Hold command-line options associated with stack limitation. */ +extern const char *opt_fstack_limit_symbol_arg; +extern int opt_fstack_limit_register_no; + +/* Input file names. */ + +extern const char **in_fnames; + +/* The count of input filenames. */ + +extern unsigned num_in_fnames; + +extern char *opts_concat (const char *first, ...); + +/* Obstack for option strings. */ + +extern struct obstack opts_obstack; + +size_t find_opt (const char *input, unsigned int lang_mask); +extern int integral_argument (const char *arg); +extern bool enum_value_to_arg (const struct cl_enum_arg *enum_args, + const char **argp, int value, + unsigned int lang_mask); +extern void decode_cmdline_options_to_array (unsigned int argc, + const char **argv, + unsigned int lang_mask, + struct cl_decoded_option **decoded_options, + unsigned int *decoded_options_count); +extern void init_options_once (void); +extern void init_options_struct (struct gcc_options *opts, + struct gcc_options *opts_set); +extern void init_opts_obstack (void); +extern void finalize_options_struct (struct gcc_options *opts); +extern void decode_cmdline_options_to_array_default_mask (unsigned int argc, + const char **argv, + struct cl_decoded_option **decoded_options, + unsigned int *decoded_options_count); +extern void set_default_handlers (struct cl_option_handlers *handlers, + void (*target_option_override_hook) (void)); +extern void decode_options (struct gcc_options *opts, + struct gcc_options *opts_set, + struct cl_decoded_option *decoded_options, + unsigned int decoded_options_count, + location_t loc, + diagnostic_context *dc, + void (*target_option_override_hook) (void)); +extern int option_enabled (int opt_idx, void *opts); +extern bool get_option_state (struct gcc_options *, int, + struct cl_option_state *); +extern void set_option (struct gcc_options *opts, + struct gcc_options *opts_set, + int opt_index, int value, const char *arg, int kind, + location_t loc, diagnostic_context *dc); +extern void *option_flag_var (int opt_index, struct gcc_options *opts); +bool handle_generated_option (struct gcc_options *opts, + struct gcc_options *opts_set, + size_t opt_index, const char *arg, int value, + unsigned int lang_mask, int kind, location_t loc, + const struct cl_option_handlers *handlers, + bool generated_p, diagnostic_context *dc); +void generate_option (size_t opt_index, const char *arg, int value, + unsigned int lang_mask, + struct cl_decoded_option *decoded); +void generate_option_input_file (const char *file, + struct cl_decoded_option *decoded); +extern void read_cmdline_option (struct gcc_options *opts, + struct gcc_options *opts_set, + struct cl_decoded_option *decoded, + location_t loc, + unsigned int lang_mask, + const struct cl_option_handlers *handlers, + diagnostic_context *dc); +extern void control_warning_option (unsigned int opt_index, int kind, + const char *arg, bool imply, location_t loc, + unsigned int lang_mask, + const struct cl_option_handlers *handlers, + struct gcc_options *opts, + struct gcc_options *opts_set, + diagnostic_context *dc); +extern char *write_langs (unsigned int mask); +extern void print_ignored_options (void); +extern void handle_common_deferred_options (void); +unsigned int parse_sanitizer_options (const char *, location_t, int, + unsigned int, int, bool); +extern bool common_handle_option (struct gcc_options *opts, + struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + unsigned int lang_mask, int kind, + location_t loc, + const struct cl_option_handlers *handlers, + diagnostic_context *dc, + void (*target_option_override_hook) (void)); +extern bool target_handle_option (struct gcc_options *opts, + struct gcc_options *opts_set, + const struct cl_decoded_option *decoded, + unsigned int lang_mask, int kind, + location_t loc, + const struct cl_option_handlers *handlers, + diagnostic_context *dc, + void (*target_option_override_hook) (void)); +extern void finish_options (struct gcc_options *opts, + struct gcc_options *opts_set, + location_t loc); +extern void default_options_optimization (struct gcc_options *opts, + struct gcc_options *opts_set, + struct cl_decoded_option *decoded_options, + unsigned int decoded_options_count, + location_t loc, + unsigned int lang_mask, + const struct cl_option_handlers *handlers, + diagnostic_context *dc); +extern void set_struct_debug_option (struct gcc_options *opts, + location_t loc, + const char *value); +extern bool opt_enum_arg_to_value (size_t opt_index, const char *arg, + int *value, unsigned int lang_mask); + +extern const struct sanitizer_opts_s +{ + const char *const name; + unsigned int flag; + size_t len; + bool can_recover; +} sanitizer_opts[]; + +extern void add_misspelling_candidates (auto_vec *candidates, + const struct cl_option *option, + const char *base_option); +extern const char *candidates_list_and_hint (const char *arg, char *&str, + const auto_vec & + candidates); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/output.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/output.h new file mode 100644 index 0000000..7a93fa8 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/output.h @@ -0,0 +1,618 @@ +/* Declarations for insn-output.c and other code to write to asm_out_file. + These functions are defined in final.c, and varasm.c. + Copyright (C) 1987-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_OUTPUT_H +#define GCC_OUTPUT_H + +/* Initialize data in final at the beginning of a compilation. */ +extern void init_final (const char *); + +/* Enable APP processing of subsequent output. + Used before the output from an `asm' statement. */ +extern void app_enable (void); + +/* Disable APP processing of subsequent output. + Called from varasm.c before most kinds of output. */ +extern void app_disable (void); + +/* Return the number of slots filled in the current + delayed branch sequence (we don't count the insn needing the + delay slot). Zero if not in a delayed branch sequence. */ +extern int dbr_sequence_length (void); + +/* Indicate that branch shortening hasn't yet been done. */ +extern void init_insn_lengths (void); + +/* Obtain the current length of an insn. If branch shortening has been done, + get its actual length. Otherwise, get its maximum length. */ +extern int get_attr_length (rtx_insn *); + +/* Obtain the current length of an insn. If branch shortening has been done, + get its actual length. Otherwise, get its minimum length. */ +extern int get_attr_min_length (rtx_insn *); + +/* Make a pass over all insns and compute their actual lengths by shortening + any branches of variable length if possible. */ +extern void shorten_branches (rtx_insn *); + +const char *get_some_local_dynamic_name (); + +/* Output assembler code for the start of a function, + and initialize some of the variables in this file + for the new function. The label for the function and associated + assembler pseudo-ops have already been output in + `assemble_start_function'. */ +extern void final_start_function (rtx_insn *, FILE *, int); + +/* Output assembler code for the end of a function. + For clarity, args are same as those of `final_start_function' + even though not all of them are needed. */ +extern void final_end_function (void); + +/* Output assembler code for some insns: all or part of a function. */ +extern void final (rtx_insn *, FILE *, int); + +/* The final scan for one insn, INSN. Args are same as in `final', except + that INSN is the insn being scanned. Value returned is the next insn to + be scanned. */ +extern rtx_insn *final_scan_insn (rtx_insn *, FILE *, int, int, int *); + +/* Replace a SUBREG with a REG or a MEM, based on the thing it is a + subreg of. */ +extern rtx alter_subreg (rtx *, bool); + +/* Print an operand using machine-dependent assembler syntax. */ +extern void output_operand (rtx, int); + +/* Report inconsistency between the assembler template and the operands. + In an `asm', it's the user's fault; otherwise, the compiler's fault. */ +extern void output_operand_lossage (const char *, ...) ATTRIBUTE_PRINTF_1; + +/* Output a string of assembler code, substituting insn operands. + Defined in final.c. */ +extern void output_asm_insn (const char *, rtx *); + +/* Compute a worst-case reference address of a branch so that it + can be safely used in the presence of aligned labels. + Defined in final.c. */ +extern int insn_current_reference_address (rtx_insn *); + +/* Find the alignment associated with a CODE_LABEL. + Defined in final.c. */ +extern int label_to_alignment (rtx); + +/* Find the alignment maximum skip associated with a CODE_LABEL. + Defined in final.c. */ +extern int label_to_max_skip (rtx); + +/* Output a LABEL_REF, or a bare CODE_LABEL, as an assembler symbol. */ +extern void output_asm_label (rtx); + +/* Marks SYMBOL_REFs in x as referenced through use of assemble_external. */ +extern void mark_symbol_refs_as_used (rtx); + +/* Print a memory reference operand for address X with access mode MODE + using machine-dependent assembler syntax. */ +extern void output_address (machine_mode, rtx); + +/* Print an integer constant expression in assembler syntax. + Addition and subtraction are the only arithmetic + that may appear in these expressions. */ +extern void output_addr_const (FILE *, rtx); + +/* Output a string of assembler code, substituting numbers, strings + and fixed syntactic prefixes. */ +#if GCC_VERSION >= 3004 +#define ATTRIBUTE_ASM_FPRINTF(m, n) __attribute__ ((__format__ (__asm_fprintf__, m, n))) ATTRIBUTE_NONNULL(m) +#else +#define ATTRIBUTE_ASM_FPRINTF(m, n) ATTRIBUTE_NONNULL(m) +#endif + +extern void fprint_whex (FILE *, unsigned HOST_WIDE_INT); +extern void fprint_ul (FILE *, unsigned long); +extern int sprint_ul (char *, unsigned long); + +extern void asm_fprintf (FILE *file, const char *p, ...) + ATTRIBUTE_ASM_FPRINTF(2, 3); + +/* Return nonzero if this function has no function calls. */ +extern int leaf_function_p (void); + +/* Return 1 if branch is a forward branch. + Uses insn_shuid array, so it works only in the final pass. May be used by + output templates to add branch prediction hints, for example. */ +extern int final_forward_branch_p (rtx_insn *); + +/* Return 1 if this function uses only the registers that can be + safely renumbered. */ +extern int only_leaf_regs_used (void); + +/* Scan IN_RTX and its subexpressions, and renumber all regs into those + available in leaf functions. */ +extern void leaf_renumber_regs_insn (rtx); + +/* Locate the proper template for the given insn-code. */ +extern const char *get_insn_template (int, rtx); + +/* Functions in varasm.c. */ + +/* Emit any pending weak declarations. */ +extern void weak_finish (void); + +/* Decode an `asm' spec for a declaration as a register name. + Return the register number, or -1 if nothing specified, + or -2 if the ASMSPEC is not `cc' or `memory' and is not recognized, + or -3 if ASMSPEC is `cc' and is not recognized, + or -4 if ASMSPEC is `memory' and is not recognized. + Accept an exact spelling or a decimal number. + Prefixes such as % are optional. */ +extern int decode_reg_name (const char *); + +/* Similar to decode_reg_name, but takes an extra parameter that is a + pointer to the number of (internal) registers described by the + external name. */ +extern int decode_reg_name_and_count (const char *, int *); + +extern void do_assemble_alias (tree, tree); + +extern void default_assemble_visibility (tree, int); + +/* Output a string of literal assembler code + for an `asm' keyword used between functions. */ +extern void assemble_asm (tree); + +/* Get the function's name from a decl, as described by its RTL. */ +extern const char *get_fnname_from_decl (tree); + +/* Output assembler code for the constant pool of a function and associated + with defining the name of the function. DECL describes the function. + NAME is the function's name. For the constant pool, we use the current + constant pool data. */ +extern void assemble_start_function (tree, const char *); + +/* Output assembler code associated with defining the size of the + function. DECL describes the function. NAME is the function's name. */ +extern void assemble_end_function (tree, const char *); + +/* Assemble everything that is needed for a variable or function declaration. + Not used for automatic variables, and not used for function definitions. + Should not be called for variables of incomplete structure type. + + TOP_LEVEL is nonzero if this variable has file scope. + AT_END is nonzero if this is the special handling, at end of compilation, + to define things that have had only tentative definitions. + DONT_OUTPUT_DATA if nonzero means don't actually output the + initial value (that will be done by the caller). */ +extern void assemble_variable (tree, int, int, int); + +/* Put the vtable verification constructor initialization function + into the preinit array. */ +extern void assemble_vtv_preinit_initializer (tree); + +/* Assemble everything that is needed for a variable declaration that has + no definition in the current translation unit. */ +extern void assemble_undefined_decl (tree); + +/* Compute the alignment of variable specified by DECL. + DONT_OUTPUT_DATA is from assemble_variable. */ +extern void align_variable (tree decl, bool dont_output_data); + +/* Queue for outputting something to declare an external symbol to the + assembler. (Most assemblers don't need this, so we normally output + nothing.) Do nothing if DECL is not external. */ +extern void assemble_external (tree); + +/* Assemble code to leave SIZE bytes of zeros. */ +extern void assemble_zeros (unsigned HOST_WIDE_INT); + +/* Assemble an alignment pseudo op for an ALIGN-bit boundary. */ +extern void assemble_align (int); + +/* Assemble a string constant with the specified C string as contents. */ +extern void assemble_string (const char *, int); + +/* Similar, for calling a library function FUN. */ +extern void assemble_external_libcall (rtx); + +/* Assemble a label named NAME. */ +extern void assemble_label (FILE *, const char *); + +/* Output to FILE (an assembly file) a reference to NAME. If NAME + starts with a *, the rest of NAME is output verbatim. Otherwise + NAME is transformed in a target-specific way (usually by the + addition of an underscore). */ +extern void assemble_name_raw (FILE *, const char *); + +/* Like assemble_name_raw, but should be used when NAME might refer to + an entity that is also represented as a tree (like a function or + variable). If NAME does refer to such an entity, that entity will + be marked as referenced. */ +extern void assemble_name (FILE *, const char *); + +/* Return the assembler directive for creating a given kind of integer + object. SIZE is the number of bytes in the object and ALIGNED_P + indicates whether it is known to be aligned. Return NULL if the + assembly dialect has no such directive. + + The returned string should be printed at the start of a new line and + be followed immediately by the object's initial value. */ +extern const char *integer_asm_op (int, int); + +/* Use directive OP to assemble an integer object X. Print OP at the + start of the line, followed immediately by the value of X. */ +extern void assemble_integer_with_op (const char *, rtx); + +/* The default implementation of the asm_out.integer target hook. */ +extern bool default_assemble_integer (rtx, unsigned int, int); + +/* Assemble the integer constant X into an object of SIZE bytes. ALIGN is + the alignment of the integer in bits. Return 1 if we were able to output + the constant, otherwise 0. If FORCE is nonzero the constant must + be outputable. */ +extern bool assemble_integer (rtx, unsigned, unsigned, int); + +/* Return section for TEXT_SECITON_NAME if DECL or DECL_SECTION_NAME (DECL) + is NULL. */ +extern section *get_named_text_section (tree, const char *, const char *); + +/* An interface to assemble_integer for the common case in which a value is + fully aligned and must be printed. VALUE is the value of the integer + object and SIZE is the number of bytes it contains. */ +#define assemble_aligned_integer(SIZE, VALUE) \ + assemble_integer (VALUE, SIZE, (SIZE) * BITS_PER_UNIT, 1) + +/* Assemble the floating-point constant D into an object of size MODE. ALIGN + is the alignment of the constant in bits. If REVERSE is true, D is output + in reverse storage order. */ +extern void assemble_real (REAL_VALUE_TYPE, machine_mode, unsigned, + bool = false); + +/* Write the address of the entity given by SYMBOL to SEC. */ +extern void assemble_addr_to_section (rtx, section *); + +/* Return TRUE if and only if the constant pool has no entries. Note + that even entries we might end up choosing not to emit are counted + here, so there is the potential for missed optimizations. */ +extern bool constant_pool_empty_p (void); + +extern rtx_insn *peephole (rtx_insn *); + +extern void output_shared_constant_pool (void); + +extern void output_object_blocks (void); + +extern void output_quoted_string (FILE *, const char *); + +/* When outputting delayed branch sequences, this rtx holds the + sequence being output. It is null when no delayed branch + sequence is being output, so it can be used as a test in the + insn output code. + + This variable is defined in final.c. */ +extern rtx_sequence *final_sequence; + +/* The line number of the beginning of the current function. Various + md code needs this so that it can output relative linenumbers. */ + +extern int sdb_begin_function_line; + +/* File in which assembler code is being written. */ + +#ifdef BUFSIZ +extern FILE *asm_out_file; +#endif + +/* The first global object in the file. */ +extern const char *first_global_object_name; + +/* The first weak object in the file. */ +extern const char *weak_global_object_name; + +/* Nonnull if the insn currently being emitted was a COND_EXEC pattern. */ +extern rtx current_insn_predicate; + +/* Last insn processed by final_scan_insn. */ +extern rtx_insn *current_output_insn; + +/* Nonzero while outputting an `asm' with operands. + This means that inconsistencies are the user's fault, so don't die. + The precise value is the insn being output, to pass to error_for_asm. */ +extern const rtx_insn *this_is_asm_operands; + +/* Carry information from ASM_DECLARE_OBJECT_NAME + to ASM_FINISH_DECLARE_OBJECT. */ +extern int size_directive_output; +extern tree last_assemble_variable_decl; + +extern bool first_function_block_is_cold; + +/* Decide whether DECL needs to be in a writable section. + RELOC is the same as for SELECT_SECTION. */ +extern bool decl_readonly_section (const_tree, int); + +/* This can be used to compute RELOC for the function above, when + given a constant expression. */ +extern int compute_reloc_for_constant (tree); + +/* User label prefix in effect for this compilation. */ +extern const char *user_label_prefix; + +/* Default target function prologue and epilogue assembler output. */ +extern void default_function_pro_epilogue (FILE *, HOST_WIDE_INT); + +/* Default target function switched text sections. */ +extern void default_function_switched_text_sections (FILE *, tree, bool); + +/* Default target hook that outputs nothing to a stream. */ +extern void no_asm_to_stream (FILE *); + +/* Flags controlling properties of a section. */ +#define SECTION_ENTSIZE 0x000ff /* entity size in section */ +#define SECTION_CODE 0x00100 /* contains code */ +#define SECTION_WRITE 0x00200 /* data is writable */ +#define SECTION_DEBUG 0x00400 /* contains debug data */ +#define SECTION_LINKONCE 0x00800 /* is linkonce */ +#define SECTION_SMALL 0x01000 /* contains "small data" */ +#define SECTION_BSS 0x02000 /* contains zeros only */ +#define SECTION_FORGET 0x04000 /* forget that we've entered the section */ +#define SECTION_MERGE 0x08000 /* contains mergeable data */ +#define SECTION_STRINGS 0x10000 /* contains zero terminated strings without + embedded zeros */ +#define SECTION_OVERRIDE 0x20000 /* allow override of default flags */ +#define SECTION_TLS 0x40000 /* contains thread-local storage */ +#define SECTION_NOTYPE 0x80000 /* don't output @progbits */ +#define SECTION_DECLARED 0x100000 /* section has been used */ +#define SECTION_STYLE_MASK 0x600000 /* bits used for SECTION_STYLE */ +#define SECTION_COMMON 0x800000 /* contains common data */ +#define SECTION_RELRO 0x1000000 /* data is readonly after relocation processing */ +#define SECTION_EXCLUDE 0x2000000 /* discarded by the linker */ +#define SECTION_MACH_DEP 0x4000000 /* subsequent bits reserved for target */ + +/* This SECTION_STYLE is used for unnamed sections that we can switch + to using a special assembler directive. */ +#define SECTION_UNNAMED 0x000000 + +/* This SECTION_STYLE is used for named sections that we can switch + to using a general section directive. */ +#define SECTION_NAMED 0x200000 + +/* This SECTION_STYLE is used for sections that we cannot switch to at + all. The choice of section is implied by the directive that we use + to declare the object. */ +#define SECTION_NOSWITCH 0x400000 + +/* A helper function for default_elf_select_section and + default_elf_unique_section. Categorizes the DECL. */ + +enum section_category +{ + SECCAT_TEXT, + + SECCAT_RODATA, + SECCAT_RODATA_MERGE_STR, + SECCAT_RODATA_MERGE_STR_INIT, + SECCAT_RODATA_MERGE_CONST, + SECCAT_SRODATA, + + SECCAT_DATA, + + /* To optimize loading of shared programs, define following subsections + of data section: + _REL Contains data that has relocations, so they get grouped + together and dynamic linker will visit fewer pages in memory. + _RO Contains data that is otherwise read-only. This is useful + with prelinking as most relocations won't be dynamically + linked and thus stay read only. + _LOCAL Marks data containing relocations only to local objects. + These relocations will get fully resolved by prelinking. */ + SECCAT_DATA_REL, + SECCAT_DATA_REL_LOCAL, + SECCAT_DATA_REL_RO, + SECCAT_DATA_REL_RO_LOCAL, + + SECCAT_SDATA, + SECCAT_TDATA, + + SECCAT_BSS, + SECCAT_SBSS, + SECCAT_TBSS +}; + +/* Information that is provided by all instances of the section type. */ +struct GTY(()) section_common { + /* The set of SECTION_* flags that apply to this section. */ + unsigned int flags; +}; + +/* Information about a SECTION_NAMED section. */ +struct GTY(()) named_section { + struct section_common common; + + /* The name of the section. */ + const char *name; + + /* If nonnull, the VAR_DECL or FUNCTION_DECL with which the + section is associated. */ + tree decl; +}; + +/* A callback that writes the assembly code for switching to an unnamed + section. The argument provides callback-specific data. */ +typedef void (*unnamed_section_callback) (const void *); + +/* Information about a SECTION_UNNAMED section. */ +struct GTY(()) unnamed_section { + struct section_common common; + + /* The callback used to switch to the section, and the data that + should be passed to the callback. */ + unnamed_section_callback GTY ((skip)) callback; + const void *GTY ((skip)) data; + + /* The next entry in the chain of unnamed sections. */ + section *next; +}; + +/* A callback that writes the assembly code for a decl in a + SECTION_NOSWITCH section. DECL is the decl that should be assembled + and NAME is the name of its SYMBOL_REF. SIZE is the size of the decl + in bytes and ROUNDED is that size rounded up to the next + BIGGEST_ALIGNMENT / BITS_PER_UNIT boundary. + + Return true if the callback used DECL_ALIGN to set the object's + alignment. A false return value implies that we are relying + on the rounded size to align the decl. */ +typedef bool (*noswitch_section_callback) (tree decl, const char *name, + unsigned HOST_WIDE_INT size, + unsigned HOST_WIDE_INT rounded); + +/* Information about a SECTION_NOSWITCH section. */ +struct GTY(()) noswitch_section { + struct section_common common; + + /* The callback used to assemble decls in this section. */ + noswitch_section_callback GTY ((skip)) callback; +}; + +/* Information about a section, which may be named or unnamed. */ +union GTY ((desc ("SECTION_STYLE (&(%h))"), for_user)) section { + struct section_common GTY ((skip)) common; + struct named_section GTY ((tag ("SECTION_NAMED"))) named; + struct unnamed_section GTY ((tag ("SECTION_UNNAMED"))) unnamed; + struct noswitch_section GTY ((tag ("SECTION_NOSWITCH"))) noswitch; +}; + +/* Return the style of section SECT. */ +#define SECTION_STYLE(SECT) ((SECT)->common.flags & SECTION_STYLE_MASK) + +struct object_block; + +/* Special well-known sections. */ +extern GTY(()) section *text_section; +extern GTY(()) section *data_section; +extern GTY(()) section *readonly_data_section; +extern GTY(()) section *sdata_section; +extern GTY(()) section *ctors_section; +extern GTY(()) section *dtors_section; +extern GTY(()) section *bss_section; +extern GTY(()) section *sbss_section; +extern GTY(()) section *exception_section; +extern GTY(()) section *eh_frame_section; +extern GTY(()) section *tls_comm_section; +extern GTY(()) section *comm_section; +extern GTY(()) section *lcomm_section; +extern GTY(()) section *bss_noswitch_section; + +extern GTY(()) section *in_section; +extern GTY(()) bool in_cold_section_p; + +extern section *get_unnamed_section (unsigned int, void (*) (const void *), + const void *); +extern section *get_section (const char *, unsigned int, tree); +extern section *get_named_section (tree, const char *, int); +extern section *get_variable_section (tree, bool); +extern void place_block_symbol (rtx); +extern rtx get_section_anchor (struct object_block *, HOST_WIDE_INT, + enum tls_model); +extern section *mergeable_constant_section (machine_mode, + unsigned HOST_WIDE_INT, + unsigned int); +extern section *function_section (tree); +extern section *unlikely_text_section (void); +extern section *current_function_section (void); + +/* Return the numbered .ctors.N (if CONSTRUCTOR_P) or .dtors.N (if + not) section for PRIORITY. */ +extern section *get_cdtor_priority_section (int, bool); + +extern bool unlikely_text_section_p (section *); +extern void switch_to_section (section *); +extern void output_section_asm_op (const void *); + +extern void record_tm_clone_pair (tree, tree); +extern void finish_tm_clone_pairs (void); +extern tree get_tm_clone_pair (tree); + +extern void default_asm_output_source_filename (FILE *, const char *); +extern void output_file_directive (FILE *, const char *); + +extern unsigned int default_section_type_flags (tree, const char *, int); + +extern bool have_global_bss_p (void); +extern bool bss_initializer_p (const_tree); + +extern void default_no_named_section (const char *, unsigned int, tree); +extern void default_elf_asm_named_section (const char *, unsigned int, tree); +extern enum section_category categorize_decl_for_section (const_tree, int); +extern void default_coff_asm_named_section (const char *, unsigned int, tree); +extern void default_pe_asm_named_section (const char *, unsigned int, tree); + +extern void default_named_section_asm_out_destructor (rtx, int); +extern void default_dtor_section_asm_out_destructor (rtx, int); +extern void default_named_section_asm_out_constructor (rtx, int); +extern void default_ctor_section_asm_out_constructor (rtx, int); + +extern section *default_select_section (tree, int, unsigned HOST_WIDE_INT); +extern section *default_elf_select_section (tree, int, unsigned HOST_WIDE_INT); +extern void default_unique_section (tree, int); +extern section *default_function_rodata_section (tree); +extern section *default_no_function_rodata_section (tree); +extern section *default_clone_table_section (void); +extern section *default_select_rtx_section (machine_mode, rtx, + unsigned HOST_WIDE_INT); +extern section *default_elf_select_rtx_section (machine_mode, rtx, + unsigned HOST_WIDE_INT); +extern void default_encode_section_info (tree, rtx, int); +extern const char *default_strip_name_encoding (const char *); +extern void default_asm_output_anchor (rtx); +extern bool default_use_anchors_for_symbol_p (const_rtx); +extern bool default_binds_local_p (const_tree); +extern bool default_binds_local_p_1 (const_tree, int); +extern bool default_binds_local_p_2 (const_tree); +extern bool default_binds_local_p_3 (const_tree, bool, bool, bool, bool); +extern void default_globalize_label (FILE *, const char *); +extern void default_globalize_decl_name (FILE *, tree); +extern void default_emit_unwind_label (FILE *, tree, int, int); +extern void default_emit_except_table_label (FILE *); +extern void default_generate_internal_label (char *, const char *, + unsigned long); +extern void default_internal_label (FILE *, const char *, unsigned long); +extern void default_asm_declare_constant_name (FILE *, const char *, + const_tree, HOST_WIDE_INT); +extern void default_file_start (void); +extern void file_end_indicate_exec_stack (void); +extern void file_end_indicate_split_stack (void); + +extern void default_elf_asm_output_external (FILE *file, tree, + const char *); +extern void default_elf_asm_output_limited_string (FILE *, const char *); +extern void default_elf_asm_output_ascii (FILE *, const char *, unsigned int); +extern void default_elf_internal_label (FILE *, const char *, unsigned long); + +extern void default_elf_init_array_asm_out_constructor (rtx, int); +extern void default_elf_fini_array_asm_out_destructor (rtx, int); +extern int maybe_assemble_visibility (tree); + +extern int default_address_cost (rtx, machine_mode, addr_space_t, bool); + +/* Output stack usage information. */ +extern void output_stack_usage (void); + +#endif /* ! GCC_OUTPUT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/params-enum.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/params-enum.h new file mode 100644 index 0000000..f80d0df --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/params-enum.h @@ -0,0 +1,39 @@ +/* params-enums.h - Run-time parameter enums. + Copyright (C) 2015-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#define DEFPARAM(ENUM, OPTION, HELP, DEFAULT, MIN, MAX) +#define DEFPARAMENUMNAME(ENUM) ENUM ## _KIND +#define DEFPARAMENUMVAL(ENUM, V) ENUM ## _KIND_ ## V +#define DEFPARAMENUMTERM(ENUM) ENUM ## _KIND_ ## LAST +#define DEFPARAMENUM5(ENUM, OPTION, HELP, DEFAULT, V0, V1, V2, V3, V4) \ + enum DEFPARAMENUMNAME (ENUM) \ + { \ + DEFPARAMENUMVAL (ENUM, V0), \ + DEFPARAMENUMVAL (ENUM, V1), \ + DEFPARAMENUMVAL (ENUM, V2), \ + DEFPARAMENUMVAL (ENUM, V3), \ + DEFPARAMENUMVAL (ENUM, V4), \ + DEFPARAMENUMTERM (ENUM) \ + }; +#include "params.def" +#undef DEFPARAMENUM5 +#undef DEFPARAMENUMTERM +#undef DEFPARAMENUMVAL +#undef DEFPARAMENUMNAME +#undef DEFPARAM diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/params-list.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/params-list.h new file mode 100644 index 0000000..051eba4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/params-list.h @@ -0,0 +1,26 @@ +/* File used to generate params.list + Copyright (C) 2015-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#define DEFPARAM(enumerator, option, nocmsgid, default, min, max) \ + enumerator, +#define DEFPARAMENUM5(enumerator, option, nocmsgid, default, \ + v0, v1, v2, v3, v4) enumerator, +#include "params.def" +#undef DEFPARAM +#undef DEFPARAMENUM5 diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/params-options.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/params-options.h new file mode 100644 index 0000000..6bfb7ce --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/params-options.h @@ -0,0 +1,27 @@ +/* File used to generate params.list + Copyright (C) 2015-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#define DEFPARAM(enumerator, option, nocmsgid, default, min, max) \ + option=default,min,max +#define DEFPARAMENUM5(enumerator, option, nocmsgid, default, \ + v0, v1, v2, v3, v4) \ + option=v0,v1,v2,v3,v4 +#include "params.def" +#undef DEFPARAM +#undef DEFPARAMENUM5 diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/params.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/params.h new file mode 100644 index 0000000..b61cff9 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/params.h @@ -0,0 +1,250 @@ +/* params.h - Run-time parameters. + Copyright (C) 2001-2017 Free Software Foundation, Inc. + Written by Mark Mitchell . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* This module provides a means for setting integral parameters + dynamically. Instead of encoding magic numbers in various places, + use this module to organize all the magic numbers in a single + place. The values of the parameters can be set on the + command-line, thereby providing a way to control the amount of + effort spent on particular optimization passes, or otherwise tune + the behavior of the compiler. + + Since their values can be set on the command-line, these parameters + should not be used for non-dynamic memory allocation. */ + +#ifndef GCC_PARAMS_H +#define GCC_PARAMS_H + +/* No parameter shall have this value. */ + +#define INVALID_PARAM_VAL (-1) + +/* The information associated with each parameter. */ + +struct param_info +{ + /* The name used with the `--param =' switch to set this + value. */ + const char *const option; + + /* The default value. */ + int default_value; + + /* Minimum acceptable value. */ + int min_value; + + /* Maximum acceptable value, if greater than minimum */ + int max_value; + + /* A short description of the option. */ + const char *const help; + + /* The optional names corresponding to the values. */ + const char **value_names; +}; + +/* An array containing the compiler parameters and their current + values. */ + +extern param_info *compiler_params; + +/* Returns the number of entries in the table, for the use by plugins. */ +extern size_t get_num_compiler_params (void); + +/* Add the N PARAMS to the current list of compiler parameters. */ + +extern void add_params (const param_info params[], size_t n); + +/* Set the VALUE associated with the parameter given by NAME in the + table PARAMS using PARAMS_SET to indicate which have been + explicitly set. */ + +extern void set_param_value (const char *name, int value, + int *params, int *params_set); + + +/* The parameters in use by language-independent code. */ + +enum compiler_param +{ +#include "params.list" + LAST_PARAM +}; + +extern bool find_param (const char *, enum compiler_param *); +extern const char *find_param_fuzzy (const char *name); +extern bool param_string_value_p (enum compiler_param, const char *, int *); + +/* The value of the parameter given by ENUM. Not an lvalue. */ +#define PARAM_VALUE(ENUM) \ + ((int) global_options.x_param_values[(int) ENUM]) + +/* Set the value of the parameter given by NUM to VALUE, implicitly, + if it has not been set explicitly by the user, in the table PARAMS + using PARAMS_SET to indicate which have been explicitly set. */ + +extern void maybe_set_param_value (compiler_param num, int value, + int *params, int *params_set); + +/* Set the default value of a parameter given by NUM to VALUE, before + option processing. */ + +extern void set_default_param_value (compiler_param num, int value); + +/* Add all parameters and default values that can be set in both the + driver and the compiler proper. */ + +extern void global_init_params (void); + +/* Note that all parameters have been added and all default values + set. */ +extern void finish_params (void); + +/* Reset all state in params.c */ + +extern void params_c_finalize (void); + +/* Return the default value of parameter NUM. */ + +extern int default_param_value (compiler_param num); + +/* Initialize an array PARAMS with default values of the + parameters. */ +extern void init_param_values (int *params); + +/* Macros for the various parameters. */ +#define MAX_INLINE_INSNS_SINGLE \ + PARAM_VALUE (PARAM_MAX_INLINE_INSNS_SINGLE) +#define MAX_INLINE_INSNS \ + PARAM_VALUE (PARAM_MAX_INLINE_INSNS) +#define MAX_INLINE_SLOPE \ + PARAM_VALUE (PARAM_MAX_INLINE_SLOPE) +#define MIN_INLINE_INSNS \ + PARAM_VALUE (PARAM_MIN_INLINE_INSNS) +#define MAX_INLINE_INSNS_AUTO \ + PARAM_VALUE (PARAM_MAX_INLINE_INSNS_AUTO) +#define MAX_VARIABLE_EXPANSIONS \ + PARAM_VALUE (PARAM_MAX_VARIABLE_EXPANSIONS) +#define MIN_VECT_LOOP_BOUND \ + PARAM_VALUE (PARAM_MIN_VECT_LOOP_BOUND) +#define MAX_DELAY_SLOT_INSN_SEARCH \ + PARAM_VALUE (PARAM_MAX_DELAY_SLOT_INSN_SEARCH) +#define MAX_DELAY_SLOT_LIVE_SEARCH \ + PARAM_VALUE (PARAM_MAX_DELAY_SLOT_LIVE_SEARCH) +#define MAX_PENDING_LIST_LENGTH \ + PARAM_VALUE (PARAM_MAX_PENDING_LIST_LENGTH) +#define MAX_GCSE_MEMORY \ + ((size_t) PARAM_VALUE (PARAM_MAX_GCSE_MEMORY)) +#define MAX_GCSE_INSERTION_RATIO \ + ((size_t) PARAM_VALUE (PARAM_MAX_GCSE_INSERTION_RATIO)) +#define GCSE_AFTER_RELOAD_PARTIAL_FRACTION \ + PARAM_VALUE (PARAM_GCSE_AFTER_RELOAD_PARTIAL_FRACTION) +#define GCSE_AFTER_RELOAD_CRITICAL_FRACTION \ + PARAM_VALUE (PARAM_GCSE_AFTER_RELOAD_CRITICAL_FRACTION) +#define GCSE_COST_DISTANCE_RATIO \ + PARAM_VALUE (PARAM_GCSE_COST_DISTANCE_RATIO) +#define GCSE_UNRESTRICTED_COST \ + PARAM_VALUE (PARAM_GCSE_UNRESTRICTED_COST) +#define MAX_HOIST_DEPTH \ + PARAM_VALUE (PARAM_MAX_HOIST_DEPTH) +#define MAX_UNROLLED_INSNS \ + PARAM_VALUE (PARAM_MAX_UNROLLED_INSNS) +#define MAX_SMS_LOOP_NUMBER \ + PARAM_VALUE (PARAM_MAX_SMS_LOOP_NUMBER) +#define SMS_MAX_II_FACTOR \ + PARAM_VALUE (PARAM_SMS_MAX_II_FACTOR) +#define SMS_DFA_HISTORY \ + PARAM_VALUE (PARAM_SMS_DFA_HISTORY) +#define SMS_LOOP_AVERAGE_COUNT_THRESHOLD \ + PARAM_VALUE (PARAM_SMS_LOOP_AVERAGE_COUNT_THRESHOLD) +#define INTEGER_SHARE_LIMIT \ + PARAM_VALUE (PARAM_INTEGER_SHARE_LIMIT) +#define MAX_LAST_VALUE_RTL \ + PARAM_VALUE (PARAM_MAX_LAST_VALUE_RTL) +#define MIN_VIRTUAL_MAPPINGS \ + PARAM_VALUE (PARAM_MIN_VIRTUAL_MAPPINGS) +#define VIRTUAL_MAPPINGS_TO_SYMS_RATIO \ + PARAM_VALUE (PARAM_VIRTUAL_MAPPINGS_TO_SYMS_RATIO) +#define MAX_FIELDS_FOR_FIELD_SENSITIVE \ + ((size_t) PARAM_VALUE (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE)) +#define MAX_SCHED_READY_INSNS \ + PARAM_VALUE (PARAM_MAX_SCHED_READY_INSNS) +#define PREFETCH_LATENCY \ + PARAM_VALUE (PARAM_PREFETCH_LATENCY) +#define SIMULTANEOUS_PREFETCHES \ + PARAM_VALUE (PARAM_SIMULTANEOUS_PREFETCHES) +#define L1_CACHE_SIZE \ + PARAM_VALUE (PARAM_L1_CACHE_SIZE) +#define L1_CACHE_LINE_SIZE \ + PARAM_VALUE (PARAM_L1_CACHE_LINE_SIZE) +#define L2_CACHE_SIZE \ + PARAM_VALUE (PARAM_L2_CACHE_SIZE) +#define USE_CANONICAL_TYPES \ + PARAM_VALUE (PARAM_USE_CANONICAL_TYPES) +#define IRA_MAX_LOOPS_NUM \ + PARAM_VALUE (PARAM_IRA_MAX_LOOPS_NUM) +#define IRA_MAX_CONFLICT_TABLE_SIZE \ + PARAM_VALUE (PARAM_IRA_MAX_CONFLICT_TABLE_SIZE) +#define IRA_LOOP_RESERVED_REGS \ + PARAM_VALUE (PARAM_IRA_LOOP_RESERVED_REGS) +#define LRA_MAX_CONSIDERED_RELOAD_PSEUDOS \ + PARAM_VALUE (PARAM_LRA_MAX_CONSIDERED_RELOAD_PSEUDOS) +#define LRA_INHERITANCE_EBB_PROBABILITY_CUTOFF \ + PARAM_VALUE (PARAM_LRA_INHERITANCE_EBB_PROBABILITY_CUTOFF) +#define SWITCH_CONVERSION_BRANCH_RATIO \ + PARAM_VALUE (PARAM_SWITCH_CONVERSION_BRANCH_RATIO) +#define LOOP_INVARIANT_MAX_BBS_IN_LOOP \ + PARAM_VALUE (PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP) +#define SLP_MAX_INSNS_IN_BB \ + PARAM_VALUE (PARAM_SLP_MAX_INSNS_IN_BB) +#define MIN_INSN_TO_PREFETCH_RATIO \ + PARAM_VALUE (PARAM_MIN_INSN_TO_PREFETCH_RATIO) +#define PREFETCH_MIN_INSN_TO_MEM_RATIO \ + PARAM_VALUE (PARAM_PREFETCH_MIN_INSN_TO_MEM_RATIO) +#define MIN_NONDEBUG_INSN_UID \ + PARAM_VALUE (PARAM_MIN_NONDEBUG_INSN_UID) +#define MAX_STORES_TO_SINK \ + PARAM_VALUE (PARAM_MAX_STORES_TO_SINK) +#define ALLOW_LOAD_DATA_RACES \ + PARAM_VALUE (PARAM_ALLOW_LOAD_DATA_RACES) +#define ALLOW_STORE_DATA_RACES \ + PARAM_VALUE (PARAM_ALLOW_STORE_DATA_RACES) +#define ALLOW_PACKED_LOAD_DATA_RACES \ + PARAM_VALUE (PARAM_ALLOW_PACKED_LOAD_DATA_RACES) +#define ALLOW_PACKED_STORE_DATA_RACES \ + PARAM_VALUE (PARAM_ALLOW_PACKED_STORE_DATA_RACES) +#define ASAN_STACK \ + PARAM_VALUE (PARAM_ASAN_STACK) +#define ASAN_GLOBALS \ + PARAM_VALUE (PARAM_ASAN_GLOBALS) +#define ASAN_INSTRUMENT_READS \ + PARAM_VALUE (PARAM_ASAN_INSTRUMENT_READS) +#define ASAN_INSTRUMENT_WRITES \ + PARAM_VALUE (PARAM_ASAN_INSTRUMENT_WRITES) +#define ASAN_MEMINTRIN \ + PARAM_VALUE (PARAM_ASAN_MEMINTRIN) +#define ASAN_USE_AFTER_RETURN \ + PARAM_VALUE (PARAM_ASAN_USE_AFTER_RETURN) +#define ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD \ + PARAM_VALUE (PARAM_ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD) +#define ASAN_PARAM_USE_AFTER_SCOPE_DIRECT_EMISSION_THRESHOLD \ + ((unsigned) PARAM_VALUE (PARAM_USE_AFTER_SCOPE_DIRECT_EMISSION_THRESHOLD)) + +#endif /* ! GCC_PARAMS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/pass_manager.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/pass_manager.h new file mode 100644 index 0000000..ae97cd4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/pass_manager.h @@ -0,0 +1,152 @@ +/* pass_manager.h - The pipeline of optimization passes + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_PASS_MANAGER_H +#define GCC_PASS_MANAGER_H + +class opt_pass; +struct register_pass_info; + +/* Define a list of pass lists so that both passes.c and plugins can easily + find all the pass lists. */ +#define GCC_PASS_LISTS \ + DEF_PASS_LIST (all_lowering_passes) \ + DEF_PASS_LIST (all_small_ipa_passes) \ + DEF_PASS_LIST (all_regular_ipa_passes) \ + DEF_PASS_LIST (all_late_ipa_passes) \ + DEF_PASS_LIST (all_passes) + +#define DEF_PASS_LIST(LIST) PASS_LIST_NO_##LIST, +enum pass_list +{ + GCC_PASS_LISTS + PASS_LIST_NUM +}; +#undef DEF_PASS_LIST + +namespace gcc { + +class context; + +class pass_manager +{ +public: + void *operator new (size_t sz); + void operator delete (void *ptr); + + pass_manager (context *ctxt); + ~pass_manager (); + + void register_pass (struct register_pass_info *pass_info); + void register_one_dump_file (opt_pass *pass); + + opt_pass *get_pass_for_id (int id) const; + + void dump_passes () const; + + void dump_profile_report () const; + + void finish_optimization_passes (); + + /* Access to specific passes, so that the majority can be private. */ + void execute_early_local_passes (); + unsigned int execute_pass_mode_switching (); + + /* Various passes are manually cloned by epiphany. */ + opt_pass *get_pass_split_all_insns () const { + return pass_split_all_insns_1; + } + opt_pass *get_pass_mode_switching () const { + return pass_mode_switching_1; + } + opt_pass *get_pass_peephole2 () const { return pass_peephole2_1; } + opt_pass *get_pass_profile () const { return pass_profile_1; } + + void register_pass_name (opt_pass *pass, const char *name); + + opt_pass *get_pass_by_name (const char *name); + + opt_pass *get_rest_of_compilation () const + { + return pass_rest_of_compilation_1; + } + opt_pass *get_clean_slate () const { return pass_clean_state_1; } + +public: + /* The root of the compilation pass tree, once constructed. */ + opt_pass *all_passes; + opt_pass *all_small_ipa_passes; + opt_pass *all_lowering_passes; + opt_pass *all_regular_ipa_passes; + opt_pass *all_late_ipa_passes; + + /* A map from static pass id to optimization pass. */ + opt_pass **passes_by_id; + int passes_by_id_size; + + opt_pass **pass_lists[PASS_LIST_NUM]; + +private: + void set_pass_for_id (int id, opt_pass *pass); + void register_dump_files (opt_pass *pass); + void create_pass_tab () const; + +private: + context *m_ctxt; + hash_map *m_name_to_pass_map; + + /* References to all of the individual passes. + These fields are generated via macro expansion. + + For example: + NEXT_PASS (pass_build_cfg, 1); + within pass-instances.def means that there is a field: + opt_pass *pass_build_cfg_1; + + Similarly, the various: + NEXT_PASS (pass_copy_prop, 1); + ... + NEXT_PASS (pass_copy_prop, 8); + in pass-instances.def lead to fields: + opt_pass *pass_copy_prop_1; + ... + opt_pass *pass_copy_prop_8; */ + +#define INSERT_PASSES_AFTER(PASS) +#define PUSH_INSERT_PASSES_WITHIN(PASS) +#define POP_INSERT_PASSES() +#define NEXT_PASS(PASS, NUM) opt_pass *PASS ## _ ## NUM +#define NEXT_PASS_WITH_ARG(PASS, NUM, ARG) NEXT_PASS (PASS, NUM) +#define TERMINATE_PASS_LIST(PASS) + +#include "pass-instances.def" + +#undef INSERT_PASSES_AFTER +#undef PUSH_INSERT_PASSES_WITHIN +#undef POP_INSERT_PASSES +#undef NEXT_PASS +#undef NEXT_PASS_WITH_ARG +#undef TERMINATE_PASS_LIST + +}; // class pass_manager + +} // namespace gcc + +#endif /* ! GCC_PASS_MANAGER_H */ + diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/plugin-api.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/plugin-api.h new file mode 100644 index 0000000..3a3e8b4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/plugin-api.h @@ -0,0 +1,457 @@ +/* plugin-api.h -- External linker plugin API. */ + +/* Copyright (C) 2009-2017 Free Software Foundation, Inc. + Written by Cary Coutant . + + This file is part of binutils. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + +/* This file defines the interface for writing a linker plugin, which is + described at < http://gcc.gnu.org/wiki/whopr/driver >. */ + +#ifndef PLUGIN_API_H +#define PLUGIN_API_H + +#ifdef HAVE_STDINT_H +#include +#elif defined(HAVE_INTTYPES_H) +#include +#endif +#include +#if !defined(HAVE_STDINT_H) && !defined(HAVE_INTTYPES_H) && \ + !defined(UINT64_MAX) && !defined(uint64_t) +#error can not find uint64_t type +#endif + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* Status code returned by most API routines. */ + +enum ld_plugin_status +{ + LDPS_OK = 0, + LDPS_NO_SYMS, /* Attempt to get symbols that haven't been added. */ + LDPS_BAD_HANDLE, /* No claimed object associated with given handle. */ + LDPS_ERR + /* Additional Error codes TBD. */ +}; + +/* The version of the API specification. */ + +enum ld_plugin_api_version +{ + LD_PLUGIN_API_VERSION = 1 +}; + +/* The type of output file being generated by the linker. */ + +enum ld_plugin_output_file_type +{ + LDPO_REL, + LDPO_EXEC, + LDPO_DYN, + LDPO_PIE +}; + +/* An input file managed by the plugin library. */ + +struct ld_plugin_input_file +{ + const char *name; + int fd; + off_t offset; + off_t filesize; + void *handle; +}; + +/* A symbol belonging to an input file managed by the plugin library. */ + +struct ld_plugin_symbol +{ + char *name; + char *version; + int def; + int visibility; + uint64_t size; + char *comdat_key; + int resolution; +}; + +/* An object's section. */ + +struct ld_plugin_section +{ + const void* handle; + unsigned int shndx; +}; + +/* Whether the symbol is a definition, reference, or common, weak or not. */ + +enum ld_plugin_symbol_kind +{ + LDPK_DEF, + LDPK_WEAKDEF, + LDPK_UNDEF, + LDPK_WEAKUNDEF, + LDPK_COMMON +}; + +/* The visibility of the symbol. */ + +enum ld_plugin_symbol_visibility +{ + LDPV_DEFAULT, + LDPV_PROTECTED, + LDPV_INTERNAL, + LDPV_HIDDEN +}; + +/* How a symbol is resolved. */ + +enum ld_plugin_symbol_resolution +{ + LDPR_UNKNOWN = 0, + + /* Symbol is still undefined at this point. */ + LDPR_UNDEF, + + /* This is the prevailing definition of the symbol, with references from + regular object code. */ + LDPR_PREVAILING_DEF, + + /* This is the prevailing definition of the symbol, with no + references from regular objects. It is only referenced from IR + code. */ + LDPR_PREVAILING_DEF_IRONLY, + + /* This definition was pre-empted by a definition in a regular + object file. */ + LDPR_PREEMPTED_REG, + + /* This definition was pre-empted by a definition in another IR file. */ + LDPR_PREEMPTED_IR, + + /* This symbol was resolved by a definition in another IR file. */ + LDPR_RESOLVED_IR, + + /* This symbol was resolved by a definition in a regular object + linked into the main executable. */ + LDPR_RESOLVED_EXEC, + + /* This symbol was resolved by a definition in a shared object. */ + LDPR_RESOLVED_DYN, + + /* This is the prevailing definition of the symbol, with no + references from regular objects. It is only referenced from IR + code, but the symbol is exported and may be referenced from + a dynamic object (not seen at link time). */ + LDPR_PREVAILING_DEF_IRONLY_EXP +}; + +/* The plugin library's "claim file" handler. */ + +typedef +enum ld_plugin_status +(*ld_plugin_claim_file_handler) ( + const struct ld_plugin_input_file *file, int *claimed); + +/* The plugin library's "all symbols read" handler. */ + +typedef +enum ld_plugin_status +(*ld_plugin_all_symbols_read_handler) (void); + +/* The plugin library's cleanup handler. */ + +typedef +enum ld_plugin_status +(*ld_plugin_cleanup_handler) (void); + +/* The linker's interface for registering the "claim file" handler. */ + +typedef +enum ld_plugin_status +(*ld_plugin_register_claim_file) (ld_plugin_claim_file_handler handler); + +/* The linker's interface for registering the "all symbols read" handler. */ + +typedef +enum ld_plugin_status +(*ld_plugin_register_all_symbols_read) ( + ld_plugin_all_symbols_read_handler handler); + +/* The linker's interface for registering the cleanup handler. */ + +typedef +enum ld_plugin_status +(*ld_plugin_register_cleanup) (ld_plugin_cleanup_handler handler); + +/* The linker's interface for adding symbols from a claimed input file. */ + +typedef +enum ld_plugin_status +(*ld_plugin_add_symbols) (void *handle, int nsyms, + const struct ld_plugin_symbol *syms); + +/* The linker's interface for getting the input file information with + an open (possibly re-opened) file descriptor. */ + +typedef +enum ld_plugin_status +(*ld_plugin_get_input_file) (const void *handle, + struct ld_plugin_input_file *file); + +typedef +enum ld_plugin_status +(*ld_plugin_get_view) (const void *handle, const void **viewp); + +/* The linker's interface for releasing the input file. */ + +typedef +enum ld_plugin_status +(*ld_plugin_release_input_file) (const void *handle); + +/* The linker's interface for retrieving symbol resolution information. */ + +typedef +enum ld_plugin_status +(*ld_plugin_get_symbols) (const void *handle, int nsyms, + struct ld_plugin_symbol *syms); + +/* The linker's interface for adding a compiled input file. */ + +typedef +enum ld_plugin_status +(*ld_plugin_add_input_file) (const char *pathname); + +/* The linker's interface for adding a library that should be searched. */ + +typedef +enum ld_plugin_status +(*ld_plugin_add_input_library) (const char *libname); + +/* The linker's interface for adding a library path that should be searched. */ + +typedef +enum ld_plugin_status +(*ld_plugin_set_extra_library_path) (const char *path); + +/* The linker's interface for issuing a warning or error message. */ + +typedef +enum ld_plugin_status +(*ld_plugin_message) (int level, const char *format, ...); + +/* The linker's interface for retrieving the number of sections in an object. + The handle is obtained in the claim_file handler. This interface should + only be invoked in the claim_file handler. This function sets *COUNT to + the number of sections in the object. */ + +typedef +enum ld_plugin_status +(*ld_plugin_get_input_section_count) (const void* handle, unsigned int *count); + +/* The linker's interface for retrieving the section type of a specific + section in an object. This interface should only be invoked in the + claim_file handler. This function sets *TYPE to an ELF SHT_xxx value. */ + +typedef +enum ld_plugin_status +(*ld_plugin_get_input_section_type) (const struct ld_plugin_section section, + unsigned int *type); + +/* The linker's interface for retrieving the name of a specific section in + an object. This interface should only be invoked in the claim_file handler. + This function sets *SECTION_NAME_PTR to a null-terminated buffer allocated + by malloc. The plugin must free *SECTION_NAME_PTR. */ + +typedef +enum ld_plugin_status +(*ld_plugin_get_input_section_name) (const struct ld_plugin_section section, + char **section_name_ptr); + +/* The linker's interface for retrieving the contents of a specific section + in an object. This interface should only be invoked in the claim_file + handler. This function sets *SECTION_CONTENTS to point to a buffer that is + valid until clam_file handler returns. It sets *LEN to the size of the + buffer. */ + +typedef +enum ld_plugin_status +(*ld_plugin_get_input_section_contents) (const struct ld_plugin_section section, + const unsigned char **section_contents, + size_t* len); + +/* The linker's interface for specifying the desired order of sections. + The sections should be specifed using the array SECTION_LIST in the + order in which they should appear in the final layout. NUM_SECTIONS + specifies the number of entries in each array. This should be invoked + in the all_symbols_read handler. */ + +typedef +enum ld_plugin_status +(*ld_plugin_update_section_order) (const struct ld_plugin_section *section_list, + unsigned int num_sections); + +/* The linker's interface for specifying that reordering of sections is + desired so that the linker can prepare for it. This should be invoked + before update_section_order, preferably in the claim_file handler. */ + +typedef +enum ld_plugin_status +(*ld_plugin_allow_section_ordering) (void); + +/* The linker's interface for specifying that a subset of sections is + to be mapped to a unique segment. If the plugin wants to call + unique_segment_for_sections, it must call this function from a + claim_file_handler or when it is first loaded. */ + +typedef +enum ld_plugin_status +(*ld_plugin_allow_unique_segment_for_sections) (void); + +/* The linker's interface for specifying that a specific set of sections + must be mapped to a unique segment. ELF segments do not have names + and the NAME is used as the name of the newly created output section + that is then placed in the unique PT_LOAD segment. FLAGS is used to + specify if any additional segment flags need to be set. For instance, + a specific segment flag can be set to identify this segment. Unsetting + segment flags that would be set by default is not possible. The + parameter SEGMENT_ALIGNMENT when non-zero will override the default. */ + +typedef +enum ld_plugin_status +(*ld_plugin_unique_segment_for_sections) ( + const char* segment_name, + uint64_t segment_flags, + uint64_t segment_alignment, + const struct ld_plugin_section * section_list, + unsigned int num_sections); + +/* The linker's interface for retrieving the section alignment requirement + of a specific section in an object. This interface should only be invoked in the + claim_file handler. This function sets *ADDRALIGN to the ELF sh_addralign + value of the input section. */ + +typedef +enum ld_plugin_status +(*ld_plugin_get_input_section_alignment) (const struct ld_plugin_section section, + unsigned int *addralign); + +/* The linker's interface for retrieving the section size of a specific section + in an object. This interface should only be invoked in the claim_file handler. + This function sets *SECSIZE to the ELF sh_size + value of the input section. */ + +typedef +enum ld_plugin_status +(*ld_plugin_get_input_section_size) (const struct ld_plugin_section section, + uint64_t *secsize); + +enum ld_plugin_level +{ + LDPL_INFO, + LDPL_WARNING, + LDPL_ERROR, + LDPL_FATAL +}; + +/* Values for the tv_tag field of the transfer vector. */ + +enum ld_plugin_tag +{ + LDPT_NULL = 0, + LDPT_API_VERSION = 1, + LDPT_GOLD_VERSION = 2, + LDPT_LINKER_OUTPUT = 3, + LDPT_OPTION = 4, + LDPT_REGISTER_CLAIM_FILE_HOOK = 5, + LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK = 6, + LDPT_REGISTER_CLEANUP_HOOK = 7, + LDPT_ADD_SYMBOLS = 8, + LDPT_GET_SYMBOLS = 9, + LDPT_ADD_INPUT_FILE = 10, + LDPT_MESSAGE = 11, + LDPT_GET_INPUT_FILE = 12, + LDPT_RELEASE_INPUT_FILE = 13, + LDPT_ADD_INPUT_LIBRARY = 14, + LDPT_OUTPUT_NAME = 15, + LDPT_SET_EXTRA_LIBRARY_PATH = 16, + LDPT_GNU_LD_VERSION = 17, + LDPT_GET_VIEW = 18, + LDPT_GET_INPUT_SECTION_COUNT = 19, + LDPT_GET_INPUT_SECTION_TYPE = 20, + LDPT_GET_INPUT_SECTION_NAME = 21, + LDPT_GET_INPUT_SECTION_CONTENTS = 22, + LDPT_UPDATE_SECTION_ORDER = 23, + LDPT_ALLOW_SECTION_ORDERING = 24, + LDPT_GET_SYMBOLS_V2 = 25, + LDPT_ALLOW_UNIQUE_SEGMENT_FOR_SECTIONS = 26, + LDPT_UNIQUE_SEGMENT_FOR_SECTIONS = 27, + LDPT_GET_SYMBOLS_V3 = 28, + LDPT_GET_INPUT_SECTION_ALIGNMENT = 29, + LDPT_GET_INPUT_SECTION_SIZE = 30 +}; + +/* The plugin transfer vector. */ + +struct ld_plugin_tv +{ + enum ld_plugin_tag tv_tag; + union + { + int tv_val; + const char *tv_string; + ld_plugin_register_claim_file tv_register_claim_file; + ld_plugin_register_all_symbols_read tv_register_all_symbols_read; + ld_plugin_register_cleanup tv_register_cleanup; + ld_plugin_add_symbols tv_add_symbols; + ld_plugin_get_symbols tv_get_symbols; + ld_plugin_add_input_file tv_add_input_file; + ld_plugin_message tv_message; + ld_plugin_get_input_file tv_get_input_file; + ld_plugin_get_view tv_get_view; + ld_plugin_release_input_file tv_release_input_file; + ld_plugin_add_input_library tv_add_input_library; + ld_plugin_set_extra_library_path tv_set_extra_library_path; + ld_plugin_get_input_section_count tv_get_input_section_count; + ld_plugin_get_input_section_type tv_get_input_section_type; + ld_plugin_get_input_section_name tv_get_input_section_name; + ld_plugin_get_input_section_contents tv_get_input_section_contents; + ld_plugin_update_section_order tv_update_section_order; + ld_plugin_allow_section_ordering tv_allow_section_ordering; + ld_plugin_allow_unique_segment_for_sections tv_allow_unique_segment_for_sections; + ld_plugin_unique_segment_for_sections tv_unique_segment_for_sections; + ld_plugin_get_input_section_alignment tv_get_input_section_alignment; + ld_plugin_get_input_section_size tv_get_input_section_size; + } tv_u; +}; + +/* The plugin library's "onload" entry point. */ + +typedef +enum ld_plugin_status +(*ld_plugin_onload) (struct ld_plugin_tv *tv); + +#ifdef __cplusplus +} +#endif + +#endif /* !defined(PLUGIN_API_H) */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/plugin-version.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/plugin-version.h new file mode 100644 index 0000000..42c6a10 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/plugin-version.h @@ -0,0 +1,18 @@ +#include "configargs.h" + +#define GCCPLUGIN_VERSION_MAJOR 7 +#define GCCPLUGIN_VERSION_MINOR 3 +#define GCCPLUGIN_VERSION_PATCHLEVEL 0 +#define GCCPLUGIN_VERSION (GCCPLUGIN_VERSION_MAJOR*1000 + GCCPLUGIN_VERSION_MINOR) + +static char basever[] = "7.3.0"; +static char datestamp[] = "20180125"; +static char devphase[] = ""; +static char revision[] = ""; + +/* FIXME plugins: We should make the version information more precise. + One way to do is to add a checksum. */ + +static struct plugin_gcc_version gcc_version = {basever, datestamp, + devphase, revision, + configuration_arguments}; diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/plugin.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/plugin.h new file mode 100644 index 0000000..68a673b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/plugin.h @@ -0,0 +1,205 @@ +/* Header file for internal GCC plugin mechanism. + Copyright (C) 2009-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef PLUGIN_H +#define PLUGIN_H + +#include "highlev-plugin-common.h" + +/* Event names. */ +enum plugin_event +{ +# define DEFEVENT(NAME) NAME, +# include "plugin.def" +# undef DEFEVENT + PLUGIN_EVENT_FIRST_DYNAMIC +}; + +/* All globals declared here have C linkage to reduce link compatibility + issues with implementation language choice and mangling. */ +#ifdef __cplusplus +extern "C" { +#endif + +extern const char **plugin_event_name; + +struct plugin_argument +{ + char *key; /* key of the argument. */ + char *value; /* value is optional and can be NULL. */ +}; + +/* Additional information about the plugin. Used by --help and --version. */ + +struct plugin_info +{ + const char *version; + const char *help; +}; + +/* Represents the gcc version. Used to avoid using an incompatible plugin. */ + +struct plugin_gcc_version +{ + const char *basever; + const char *datestamp; + const char *devphase; + const char *revision; + const char *configuration_arguments; +}; + +/* Object that keeps track of the plugin name and its arguments. */ +struct plugin_name_args +{ + char *base_name; /* Short name of the plugin (filename without + .so suffix). */ + const char *full_name; /* Path to the plugin as specified with + -fplugin=. */ + int argc; /* Number of arguments specified with + -fplugin-arg-... */ + struct plugin_argument *argv; /* Array of ARGC key-value pairs. */ + const char *version; /* Version string provided by plugin. */ + const char *help; /* Help string provided by plugin. */ +}; + +/* The default version check. Compares every field in VERSION. */ + +extern bool plugin_default_version_check (struct plugin_gcc_version *, + struct plugin_gcc_version *); + +/* Function type for the plugin initialization routine. Each plugin module + should define this as an externally-visible function with name + "plugin_init." + + PLUGIN_INFO - plugin invocation information. + VERSION - the plugin_gcc_version symbol of GCC. + + Returns 0 if initialization finishes successfully. */ + +typedef int (*plugin_init_func) (struct plugin_name_args *plugin_info, + struct plugin_gcc_version *version); + +/* Declaration for "plugin_init" function so that it doesn't need to be + duplicated in every plugin. */ +extern int plugin_init (struct plugin_name_args *plugin_info, + struct plugin_gcc_version *version); + +/* Function type for a plugin callback routine. + + GCC_DATA - event-specific data provided by GCC + USER_DATA - plugin-specific data provided by the plugin */ + +typedef void (*plugin_callback_func) (void *gcc_data, void *user_data); + +/* Called from the plugin's initialization code. Register a single callback. + This function can be called multiple times. + + PLUGIN_NAME - display name for this plugin + EVENT - which event the callback is for + CALLBACK - the callback to be called at the event + USER_DATA - plugin-provided data. +*/ + +/* Number of event ids / names registered so far. */ + +extern int get_event_last (void); + +int get_named_event_id (const char *name, enum insert_option insert); + +/* This is also called without a callback routine for the + PLUGIN_PASS_MANAGER_SETUP, PLUGIN_INFO and PLUGIN_REGISTER_GGC_ROOTS + pseudo-events, with a specific user_data. + */ + +extern void register_callback (const char *plugin_name, + int event, + plugin_callback_func callback, + void *user_data); + +extern int unregister_callback (const char *plugin_name, int event); + + +/* Retrieve the plugin directory name, as returned by the + -fprint-file-name=plugin argument to the gcc program, which is the + -iplugindir program argument to cc1. */ +extern const char* default_plugin_dir_name (void); + +#ifdef __cplusplus +} +#endif + +/* In case the C++ compiler does name mangling for globals, declare + plugin_is_GPL_compatible extern "C" so that a later definition + in a plugin file will have this linkage. */ +#ifdef __cplusplus +extern "C" { +#endif +extern int plugin_is_GPL_compatible; +#ifdef __cplusplus +} +#endif + + +struct attribute_spec; +struct scoped_attributes; + +extern void add_new_plugin (const char *); +extern void parse_plugin_arg_opt (const char *); +extern int invoke_plugin_callbacks_full (int, void *); +extern void initialize_plugins (void); +extern bool plugins_active_p (void); +extern void dump_active_plugins (FILE *); +extern void debug_active_plugins (void); +extern void warn_if_plugins (void); +extern void plugins_internal_error_function (diagnostic_context *, + const char *, va_list *); +extern void print_plugins_versions (FILE *file, const char *indent); +extern void print_plugins_help (FILE *file, const char *indent); +extern void finalize_plugins (void); + +extern bool flag_plugin_added; + +/* Called from inside GCC. Invoke all plugin callbacks registered with + the specified event. + Return PLUGEVT_SUCCESS if at least one callback was called, + PLUGEVT_NO_CALLBACK if there was no callback. + + EVENT - the event identifier + GCC_DATA - event-specific data provided by the compiler */ + +static inline int +invoke_plugin_callbacks (int event ATTRIBUTE_UNUSED, + void *gcc_data ATTRIBUTE_UNUSED) +{ +#ifdef ENABLE_PLUGIN + /* True iff at least one plugin has been added. */ + if (flag_plugin_added) + return invoke_plugin_callbacks_full (event, gcc_data); +#endif + + return PLUGEVT_NO_CALLBACK; +} + +/* In attribs.c. */ + +extern void register_attribute (const struct attribute_spec *attr); +extern struct scoped_attributes* register_scoped_attributes (const struct attribute_spec *, + const char *); + +#endif /* PLUGIN_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/predict.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/predict.h new file mode 100644 index 0000000..6fc7c2c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/predict.h @@ -0,0 +1,96 @@ +/* Definitions for branch prediction routines in the GNU compiler. + Copyright (C) 2001-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_PREDICT_H +#define GCC_PREDICT_H + +/* Random guesstimation given names. + PROB_VERY_UNLIKELY should be small enough so basic block predicted + by it gets below HOT_BB_FREQUENCY_FRACTION. */ +#define PROB_VERY_UNLIKELY (REG_BR_PROB_BASE / 2000 - 1) +#define PROB_EVEN (REG_BR_PROB_BASE / 2) +#define PROB_VERY_LIKELY (REG_BR_PROB_BASE - PROB_VERY_UNLIKELY) +#define PROB_ALWAYS (REG_BR_PROB_BASE) +#define PROB_UNLIKELY (REG_BR_PROB_BASE / 5 - 1) +#define PROB_LIKELY (REG_BR_PROB_BASE - PROB_UNLIKELY) + +#define DEF_PREDICTOR(ENUM, NAME, HITRATE, FLAGS) ENUM, +enum br_predictor +{ +#include "predict.def" + + /* Upper bound on non-language-specific builtins. */ + END_PREDICTORS +}; +#undef DEF_PREDICTOR +enum prediction +{ + NOT_TAKEN, + TAKEN +}; + +extern gcov_type get_hot_bb_threshold (void); +extern void set_hot_bb_threshold (gcov_type); +extern bool maybe_hot_count_p (struct function *, gcov_type); +extern bool maybe_hot_bb_p (struct function *, const_basic_block); +extern bool maybe_hot_edge_p (edge); +extern bool probably_never_executed_bb_p (struct function *, const_basic_block); +extern bool probably_never_executed_edge_p (struct function *, edge); +extern bool optimize_function_for_size_p (struct function *); +extern bool optimize_function_for_speed_p (struct function *); +extern optimization_type function_optimization_type (struct function *); +extern bool optimize_bb_for_size_p (const_basic_block); +extern bool optimize_bb_for_speed_p (const_basic_block); +extern optimization_type bb_optimization_type (const_basic_block); +extern bool optimize_edge_for_size_p (edge); +extern bool optimize_edge_for_speed_p (edge); +extern bool optimize_insn_for_size_p (void); +extern bool optimize_insn_for_speed_p (void); +extern bool optimize_loop_for_size_p (struct loop *); +extern bool optimize_loop_for_speed_p (struct loop *); +extern bool optimize_loop_nest_for_speed_p (struct loop *); +extern bool optimize_loop_nest_for_size_p (struct loop *); +extern bool predictable_edge_p (edge); +extern void rtl_profile_for_bb (basic_block); +extern void rtl_profile_for_edge (edge); +extern void default_rtl_profile (void); +extern bool rtl_predicted_by_p (const_basic_block, enum br_predictor); +extern bool gimple_predicted_by_p (const_basic_block, enum br_predictor); +extern bool edge_probability_reliable_p (const_edge); +extern bool br_prob_note_reliable_p (const_rtx); +extern void predict_insn_def (rtx_insn *, enum br_predictor, enum prediction); +extern void rtl_predict_edge (edge, enum br_predictor, int); +extern void gimple_predict_edge (edge, enum br_predictor, int); +extern void remove_predictions_associated_with_edge (edge); +extern void predict_edge_def (edge, enum br_predictor, enum prediction); +extern void invert_br_probabilities (rtx); +extern void guess_outgoing_edge_probabilities (basic_block); +extern void tree_estimate_probability (bool); +extern void handle_missing_profiles (void); +extern int counts_to_freqs (void); +extern bool expensive_function_p (int); +extern void estimate_bb_frequencies (bool); +extern void compute_function_frequency (void); +extern tree build_predict_expr (enum br_predictor, enum prediction); +extern const char *predictor_name (enum br_predictor); +extern void rebuild_frequencies (void); +extern void report_predictor_hitrates (void); +extern void force_edge_cold (edge, bool); + +#endif /* GCC_PREDICT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/prefix.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/prefix.h new file mode 100644 index 0000000..35426d2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/prefix.h @@ -0,0 +1,40 @@ +/* Provide prototypes for functions exported from prefix.c. + Copyright (C) 1999-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU Library General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at +your option) any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with GCC; see the file COPYING3. If not see +. */ + + +#ifndef GCC_PREFIX_H +#define GCC_PREFIX_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* These functions are called by the Ada frontend with C convention. */ + +/* Update PATH using KEY if PATH starts with PREFIX. The returned + string is always malloc-ed, and the caller is responsible for + freeing it. */ +extern char *update_path (const char *path, const char *key); +extern void set_std_prefix (const char *, int); + +#ifdef __cplusplus +} +#endif + +#endif /* ! GCC_PREFIX_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/pretty-print.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/pretty-print.h new file mode 100644 index 0000000..2596678 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/pretty-print.h @@ -0,0 +1,389 @@ +/* Various declarations for language-independent pretty-print subroutines. + Copyright (C) 2002-2017 Free Software Foundation, Inc. + Contributed by Gabriel Dos Reis + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_PRETTY_PRINT_H +#define GCC_PRETTY_PRINT_H + +#include "obstack.h" +#include "wide-int-print.h" + +/* Maximum number of format string arguments. */ +#define PP_NL_ARGMAX 30 + +/* The type of a text to be formatted according a format specification + along with a list of things. */ +struct text_info +{ + const char *format_spec; + va_list *args_ptr; + int err_no; /* for %m */ + void **x_data; + rich_location *m_richloc; + + void set_location (unsigned int idx, location_t loc, bool caret_p); + location_t get_location (unsigned int index_of_location) const; +}; + +/* How often diagnostics are prefixed by their locations: + o DIAGNOSTICS_SHOW_PREFIX_NEVER: never - not yet supported; + o DIAGNOSTICS_SHOW_PREFIX_ONCE: emit only once; + o DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE: emit each time a physical + line is started. */ +enum diagnostic_prefixing_rule_t +{ + DIAGNOSTICS_SHOW_PREFIX_ONCE = 0x0, + DIAGNOSTICS_SHOW_PREFIX_NEVER = 0x1, + DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE = 0x2 +}; + +/* The chunk_info data structure forms a stack of the results from the + first phase of formatting (pp_format) which have not yet been + output (pp_output_formatted_text). A stack is necessary because + the diagnostic starter may decide to generate its own output by way + of the formatter. */ +struct chunk_info +{ + /* Pointer to previous chunk on the stack. */ + struct chunk_info *prev; + + /* Array of chunks to output. Each chunk is a NUL-terminated string. + In the first phase of formatting, even-numbered chunks are + to be output verbatim, odd-numbered chunks are format specifiers. + The second phase replaces all odd-numbered chunks with formatted + text, and the third phase simply emits all the chunks in sequence + with appropriate line-wrapping. */ + const char *args[PP_NL_ARGMAX * 2]; +}; + +/* The output buffer datatype. This is best seen as an abstract datatype + whose fields should not be accessed directly by clients. */ +struct output_buffer +{ + output_buffer (); + ~output_buffer (); + + /* Obstack where the text is built up. */ + struct obstack formatted_obstack; + + /* Obstack containing a chunked representation of the format + specification plus arguments. */ + struct obstack chunk_obstack; + + /* Currently active obstack: one of the above two. This is used so + that the text formatters don't need to know which phase we're in. */ + struct obstack *obstack; + + /* Stack of chunk arrays. These come from the chunk_obstack. */ + struct chunk_info *cur_chunk_array; + + /* Where to output formatted text. */ + FILE *stream; + + /* The amount of characters output so far. */ + int line_length; + + /* This must be large enough to hold any printed integer or + floating-point value. */ + char digit_buffer[128]; + + /* Nonzero means that text should be flushed when + appropriate. Otherwise, text is buffered until either + pp_really_flush or pp_clear_output_area are called. */ + bool flush_p; +}; + +/* Finishes constructing a NULL-terminated character string representing + the buffered text. */ +static inline const char * +output_buffer_formatted_text (output_buffer *buff) +{ + obstack_1grow (buff->obstack, '\0'); + return (const char *) obstack_base (buff->obstack); +} + +/* Append to the output buffer a string specified by its + STARTing character and LENGTH. */ +static inline void +output_buffer_append_r (output_buffer *buff, const char *start, int length) +{ + gcc_checking_assert (start); + obstack_grow (buff->obstack, start, length); + for (int i = 0; i < length; i++) + if (start[i] == '\n') + buff->line_length = 0; + else + buff->line_length++; +} + +/* Return a pointer to the last character emitted in the + output_buffer. A NULL pointer means no character available. */ +static inline const char * +output_buffer_last_position_in_text (const output_buffer *buff) +{ + const char *p = NULL; + struct obstack *text = buff->obstack; + + if (obstack_base (text) != obstack_next_free (text)) + p = ((const char *) obstack_next_free (text)) - 1; + return p; +} + + +/* The type of pretty-printer flags passed to clients. */ +typedef unsigned int pp_flags; + +enum pp_padding +{ + pp_none, pp_before, pp_after +}; + +/* Structure for switching in and out of verbatim mode in a convenient + manner. */ +struct pp_wrapping_mode_t +{ + /* Current prefixing rule. */ + diagnostic_prefixing_rule_t rule; + + /* The ideal upper bound of number of characters per line, as suggested + by front-end. */ + int line_cutoff; +}; + +/* Maximum characters per line in automatic line wrapping mode. + Zero means don't wrap lines. */ +#define pp_line_cutoff(PP) (PP)->wrapping.line_cutoff + +/* Prefixing rule used in formatting a diagnostic message. */ +#define pp_prefixing_rule(PP) (PP)->wrapping.rule + +/* Get or set the wrapping mode as a single entity. */ +#define pp_wrapping_mode(PP) (PP)->wrapping + +/* The type of a hook that formats client-specific data onto a pretty_printer. + A client-supplied formatter returns true if everything goes well, + otherwise it returns false. */ +typedef bool (*printer_fn) (pretty_printer *, text_info *, const char *, + int, bool, bool, bool); + +/* Client supplied function used to decode formats. */ +#define pp_format_decoder(PP) (PP)->format_decoder + +/* TRUE if a newline character needs to be added before further + formatting. */ +#define pp_needs_newline(PP) (PP)->need_newline + +/* True if PRETTY-PRINTER is in line-wrapping mode. */ +#define pp_is_wrapping_line(PP) (pp_line_cutoff (PP) > 0) + +/* The amount of whitespace to be emitted when starting a new line. */ +#define pp_indentation(PP) (PP)->indent_skip + +/* True if identifiers are translated to the locale character set on + output. */ +#define pp_translate_identifiers(PP) (PP)->translate_identifiers + +/* True if colors should be shown. */ +#define pp_show_color(PP) (PP)->show_color + +/* The data structure that contains the bare minimum required to do + proper pretty-printing. Clients may derived from this structure + and add additional fields they need. */ +struct pretty_printer +{ + // Default construct a pretty printer with specified prefix + // and a maximum line length cut off limit. + explicit pretty_printer (const char* = NULL, int = 0); + + virtual ~pretty_printer (); + + /* Where we print external representation of ENTITY. */ + output_buffer *buffer; + + /* The prefix for each new line. */ + const char *prefix; + + /* Where to put whitespace around the entity being formatted. */ + pp_padding padding; + + /* The real upper bound of number of characters per line, taking into + account the case of a very very looong prefix. */ + int maximum_length; + + /* Indentation count. */ + int indent_skip; + + /* Current wrapping mode. */ + pp_wrapping_mode_t wrapping; + + /* If non-NULL, this function formats a TEXT into the BUFFER. When called, + TEXT->format_spec points to a format code. FORMAT_DECODER should call + pp_string (and related functions) to add data to the BUFFER. + FORMAT_DECODER can read arguments from *TEXT->args_pts using VA_ARG. + If the BUFFER needs additional characters from the format string, it + should advance the TEXT->format_spec as it goes. When FORMAT_DECODER + returns, TEXT->format_spec should point to the last character processed. + */ + printer_fn format_decoder; + + /* Nonzero if current PREFIX was emitted at least once. */ + bool emitted_prefix; + + /* Nonzero means one should emit a newline before outputting anything. */ + bool need_newline; + + /* Nonzero means identifiers are translated to the locale character + set on output. */ + bool translate_identifiers; + + /* Nonzero means that text should be colorized. */ + bool show_color; +}; + +static inline const char * +pp_get_prefix (const pretty_printer *pp) { return pp->prefix; } + +#define pp_space(PP) pp_character (PP, ' ') +#define pp_left_paren(PP) pp_character (PP, '(') +#define pp_right_paren(PP) pp_character (PP, ')') +#define pp_left_bracket(PP) pp_character (PP, '[') +#define pp_right_bracket(PP) pp_character (PP, ']') +#define pp_left_brace(PP) pp_character (PP, '{') +#define pp_right_brace(PP) pp_character (PP, '}') +#define pp_semicolon(PP) pp_character (PP, ';') +#define pp_comma(PP) pp_character (PP, ',') +#define pp_dot(PP) pp_character (PP, '.') +#define pp_colon(PP) pp_character (PP, ':') +#define pp_colon_colon(PP) pp_string (PP, "::") +#define pp_arrow(PP) pp_string (PP, "->") +#define pp_equal(PP) pp_character (PP, '=') +#define pp_question(PP) pp_character (PP, '?') +#define pp_bar(PP) pp_character (PP, '|') +#define pp_bar_bar(PP) pp_string (PP, "||") +#define pp_carret(PP) pp_character (PP, '^') +#define pp_ampersand(PP) pp_character (PP, '&') +#define pp_ampersand_ampersand(PP) pp_string (PP, "&&") +#define pp_less(PP) pp_character (PP, '<') +#define pp_less_equal(PP) pp_string (PP, "<=") +#define pp_greater(PP) pp_character (PP, '>') +#define pp_greater_equal(PP) pp_string (PP, ">=") +#define pp_plus(PP) pp_character (PP, '+') +#define pp_minus(PP) pp_character (PP, '-') +#define pp_star(PP) pp_character (PP, '*') +#define pp_slash(PP) pp_character (PP, '/') +#define pp_modulo(PP) pp_character (PP, '%') +#define pp_exclamation(PP) pp_character (PP, '!') +#define pp_complement(PP) pp_character (PP, '~') +#define pp_quote(PP) pp_character (PP, '\'') +#define pp_backquote(PP) pp_character (PP, '`') +#define pp_doublequote(PP) pp_character (PP, '"') +#define pp_underscore(PP) pp_character (PP, '_') +#define pp_maybe_newline_and_indent(PP, N) \ + if (pp_needs_newline (PP)) pp_newline_and_indent (PP, N) +#define pp_scalar(PP, FORMAT, SCALAR) \ + do \ + { \ + sprintf (pp_buffer (PP)->digit_buffer, FORMAT, SCALAR); \ + pp_string (PP, pp_buffer (PP)->digit_buffer); \ + } \ + while (0) +#define pp_decimal_int(PP, I) pp_scalar (PP, "%d", I) +#define pp_unsigned_wide_integer(PP, I) \ + pp_scalar (PP, HOST_WIDE_INT_PRINT_UNSIGNED, (unsigned HOST_WIDE_INT) I) +#define pp_wide_int(PP, W, SGN) \ + do \ + { \ + print_dec (W, pp_buffer (PP)->digit_buffer, SGN); \ + pp_string (PP, pp_buffer (PP)->digit_buffer); \ + } \ + while (0) +#define pp_wide_integer(PP, I) \ + pp_scalar (PP, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) I) +#define pp_pointer(PP, P) pp_scalar (PP, "%p", P) + +#define pp_identifier(PP, ID) pp_string (PP, (pp_translate_identifiers (PP) \ + ? identifier_to_locale (ID) \ + : (ID))) + + +#define pp_buffer(PP) (PP)->buffer + +extern void pp_set_line_maximum_length (pretty_printer *, int); +extern void pp_set_prefix (pretty_printer *, const char *); +extern void pp_destroy_prefix (pretty_printer *); +extern int pp_remaining_character_count_for_line (pretty_printer *); +extern void pp_clear_output_area (pretty_printer *); +extern const char *pp_formatted_text (pretty_printer *); +extern const char *pp_last_position_in_text (const pretty_printer *); +extern void pp_emit_prefix (pretty_printer *); +extern void pp_append_text (pretty_printer *, const char *, const char *); +extern void pp_newline_and_flush (pretty_printer *); +extern void pp_newline_and_indent (pretty_printer *, int); +extern void pp_separate_with (pretty_printer *, char); + +/* If we haven't already defined a front-end-specific diagnostics + style, use the generic one. */ +#ifdef GCC_DIAG_STYLE +#define GCC_PPDIAG_STYLE GCC_DIAG_STYLE +#else +#define GCC_PPDIAG_STYLE __gcc_diag__ +#endif + +/* This header may be included before diagnostics-core.h, hence the duplicate + definitions to allow for GCC-specific formats. */ +#if GCC_VERSION >= 3005 +#define ATTRIBUTE_GCC_PPDIAG(m, n) __attribute__ ((__format__ (GCC_PPDIAG_STYLE, m ,n))) ATTRIBUTE_NONNULL(m) +#else +#define ATTRIBUTE_GCC_PPDIAG(m, n) ATTRIBUTE_NONNULL(m) +#endif +extern void pp_printf (pretty_printer *, const char *, ...) + ATTRIBUTE_GCC_PPDIAG(2,3); + +extern void pp_verbatim (pretty_printer *, const char *, ...) + ATTRIBUTE_GCC_PPDIAG(2,3); +extern void pp_flush (pretty_printer *); +extern void pp_really_flush (pretty_printer *); +extern void pp_format (pretty_printer *, text_info *); +extern void pp_output_formatted_text (pretty_printer *); +extern void pp_format_verbatim (pretty_printer *, text_info *); + +extern void pp_indent (pretty_printer *); +extern void pp_newline (pretty_printer *); +extern void pp_character (pretty_printer *, int); +extern void pp_string (pretty_printer *, const char *); +extern void pp_write_text_to_stream (pretty_printer *); +extern void pp_write_text_as_dot_label_to_stream (pretty_printer *, bool); +extern void pp_maybe_space (pretty_printer *); + +/* Switch into verbatim mode and return the old mode. */ +static inline pp_wrapping_mode_t +pp_set_verbatim_wrapping_ (pretty_printer *pp) +{ + pp_wrapping_mode_t oldmode = pp_wrapping_mode (pp); + pp_line_cutoff (pp) = 0; + pp_prefixing_rule (pp) = DIAGNOSTICS_SHOW_PREFIX_NEVER; + return oldmode; +} +#define pp_set_verbatim_wrapping(PP) pp_set_verbatim_wrapping_ (PP) + +extern const char *identifier_to_locale (const char *); +extern void *(*identifier_to_locale_alloc) (size_t); +extern void (*identifier_to_locale_free) (void *); + +#endif /* GCC_PRETTY_PRINT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/print-rtl.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/print-rtl.h new file mode 100644 index 0000000..81dfcba --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/print-rtl.h @@ -0,0 +1,162 @@ +/* Print RTL for GCC. + Copyright (C) 1987-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_PRINT_RTL_H +#define GCC_PRINT_RTL_H + +#ifndef GENERATOR_FILE +#include "bitmap.h" +#endif /* #ifndef GENERATOR_FILE */ + +class rtx_reuse_manager; + +/* A class for writing rtx to a FILE *. */ + +class rtx_writer +{ + public: + rtx_writer (FILE *outfile, int ind, bool simple, bool compact, + rtx_reuse_manager *reuse_manager); + + void print_rtx (const_rtx in_rtx); + void print_rtl (const_rtx rtx_first); + int print_rtl_single_with_indent (const_rtx x, int ind); + + void finish_directive (); + + private: + void print_rtx_operand_code_0 (const_rtx in_rtx, int idx); + void print_rtx_operand_code_e (const_rtx in_rtx, int idx); + void print_rtx_operand_codes_E_and_V (const_rtx in_rtx, int idx); + void print_rtx_operand_code_i (const_rtx in_rtx, int idx); + void print_rtx_operand_code_r (const_rtx in_rtx); + void print_rtx_operand_code_u (const_rtx in_rtx, int idx); + void print_rtx_operand (const_rtx in_rtx, int idx); + bool operand_has_default_value_p (const_rtx in_rtx, int idx); + + private: + FILE *m_outfile; + int m_sawclose; + int m_indent; + bool m_in_call_function_usage; + + /* True means use simplified format without flags, modes, etc. */ + bool m_simple; + + /* If true, use compact dump format: + - PREV/NEXT_INSN UIDs are omitted + - INSN_CODEs are omitted, + - register numbers are omitted for hard and virtual regs, and + non-virtual pseudos are offset relative to the first such reg, and + printed with a '%' sigil e.g. "%0" for (LAST_VIRTUAL_REGISTER + 1), + - insn names are prefixed with "c" (e.g. "cinsn", "cnote", etc). */ + bool m_compact; + + /* An optional instance of rtx_reuse_manager. */ + rtx_reuse_manager *m_rtx_reuse_manager; +}; + +#ifdef BUFSIZ +extern void print_rtl (FILE *, const_rtx); +#endif +extern void print_rtx_insn_vec (FILE *file, const vec &vec); + +extern void dump_value_slim (FILE *, const_rtx, int); +extern void dump_insn_slim (FILE *, const rtx_insn *); +extern void dump_rtl_slim (FILE *, const rtx_insn *, const rtx_insn *, + int, int); +extern void print_value (pretty_printer *, const_rtx, int); +extern void print_pattern (pretty_printer *, const_rtx, int); +extern void print_insn (pretty_printer *pp, const rtx_insn *x, int verbose); + +extern void rtl_dump_bb_for_graph (pretty_printer *, basic_block); +extern const char *str_pattern_slim (const_rtx); + +extern void print_rtx_function (FILE *file, function *fn, bool compact); + +#ifndef GENERATOR_FILE + +/* For some rtx codes (such as SCRATCH), instances are defined to only be + equal for pointer equality: two distinct SCRATCH instances are non-equal. + copy_rtx preserves this equality by reusing the SCRATCH instance. + + For example, in this x86 instruction: + + (cinsn (set (mem/v:BLK (scratch:DI) [0 A8]) + (unspec:BLK [ + (mem/v:BLK (scratch:DI) [0 A8]) + ] UNSPEC_MEMORY_BLOCKAGE)) "test.c":2 + (nil)) + + the two instances of "(scratch:DI)" are actually the same underlying + rtx pointer (and thus "equal"), and the insn will only be recognized + (as "*memory_blockage") if this pointer-equality is preserved. + + To be able to preserve this pointer-equality when round-tripping + through dumping/loading the rtl, we need some syntax. The first + time a reused rtx is encountered in the dump, we prefix it with + a reuse ID: + + (0|scratch:DI) + + Subsequent references to the rtx in the dump can be expressed using + "reuse_rtx" e.g.: + + (reuse_rtx 0) + + This class is responsible for tracking a set of reuse IDs during a dump. + + Dumping with reuse-support is done in two passes: + + (a) a first pass in which "preprocess" is called on each top-level rtx + to be seen in the dump. This traverses the rtx and its descendents, + identifying rtx that will be seen more than once in the actual dump, + and assigning them reuse IDs. + + (b) the actual dump, via print_rtx etc. print_rtx detect the presence + of a live rtx_reuse_manager and uses it if there is one. Any rtx + that were assigned reuse IDs will be printed with it the first time + that they are seen, and then printed as "(reuse_rtx ID)" subsequently. + + The first phase is needed since otherwise there would be no way to tell + if an rtx will be reused when first encountering it. */ + +class rtx_reuse_manager +{ + public: + rtx_reuse_manager (); + + /* The first pass. */ + void preprocess (const_rtx x); + + /* The second pass (within print_rtx). */ + bool has_reuse_id (const_rtx x, int *out); + bool seen_def_p (int reuse_id); + void set_seen_def (int reuse_id); + + private: + hash_map m_rtx_occurrence_count; + hash_map m_rtx_reuse_ids; + bitmap_head m_defs_seen; + int m_next_id; +}; + +#endif /* #ifndef GENERATOR_FILE */ + +#endif // GCC_PRINT_RTL_H diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/print-tree.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/print-tree.h new file mode 100644 index 0000000..29efc07 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/print-tree.h @@ -0,0 +1,47 @@ +/* Declarations for printing trees in human readable form + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_PRINT_TREE_H +#define GCC_PRINT_TREE_H + +extern void debug_tree (tree); +extern void debug_raw (const tree_node &ref); +extern void debug_raw (const tree_node *ptr); +extern void debug (const tree_node &ref); +extern void debug (const tree_node *ptr); +extern void debug_verbose (const tree_node &ref); +extern void debug_verbose (const tree_node *ptr); +extern void debug_head (const tree_node &ref); +extern void debug_head (const tree_node *ptr); +extern void debug_body (const tree_node &ref); +extern void debug_body (const tree_node *ptr); +extern void debug_vec_tree (vec *); +extern void debug (vec &ref); +extern void debug (vec *ptr); +extern void debug_raw (vec &ref); +extern void debug_raw (vec *ptr); +#ifdef BUFSIZ +extern void dump_addr (FILE*, const char *, const void *); +extern void print_node (FILE *, const char *, tree, int, + bool brief_for_visited = true); +extern void print_node_brief (FILE *, const char *, const_tree, int); +extern void indent_to (FILE *, int); +#endif + +#endif // GCC_PRINT_TREE_H diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/profile.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/profile.h new file mode 100644 index 0000000..2c5bf3d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/profile.h @@ -0,0 +1,59 @@ +/* Header file for minimum-cost maximal flow routines used to smooth basic + block and edge frequency counts. + Copyright (C) 2008-2017 Free Software Foundation, Inc. + Contributed by Paul Yuan (yingbo.com@gmail.com) + and Vinodha Ramasamy (vinodha@google.com). + +This file is part of GCC. +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef PROFILE_H +#define PROFILE_H + +/* Additional information about edges. */ +struct edge_profile_info +{ + unsigned int count_valid:1; + + /* Is on the spanning tree. */ + unsigned int on_tree:1; + + /* Pretend this edge does not exist (it is abnormal and we've + inserted a fake to compensate). */ + unsigned int ignore:1; +}; + +#define EDGE_INFO(e) ((struct edge_profile_info *) (e)->aux) + +typedef struct gcov_working_set_info gcov_working_set_t; +extern gcov_working_set_t *find_working_set (unsigned pct_times_10); +extern void add_working_set (gcov_working_set_t *); + +/* Smoothes the initial assigned basic block and edge counts using + a minimum cost flow algorithm. */ +extern void mcf_smooth_cfg (void); + +extern gcov_type sum_edge_counts (vec *edges); + +extern void init_node_map (bool); +extern void del_node_map (void); + +extern void get_working_sets (void); + +/* Counter summary from the last set of coverage counts read by + profile.c. */ +extern const struct gcov_ctr_summary *profile_info; + +#endif /* PROFILE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/read-md.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/read-md.h new file mode 100644 index 0000000..fea7011 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/read-md.h @@ -0,0 +1,343 @@ +/* MD reader definitions. + Copyright (C) 1987-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_READ_MD_H +#define GCC_READ_MD_H + +#include "obstack.h" + +/* Records a position in the file. */ +struct file_location { + file_location () {} + file_location (const char *, int, int); + + const char *filename; + int lineno; + int colno; +}; + +inline file_location::file_location (const char *filename_in, int lineno_in, int colno_in) +: filename (filename_in), lineno (lineno_in), colno (colno_in) {} + +/* Holds one symbol or number in the .md file. */ +struct md_name { + /* The name as it appeared in the .md file. Names are syntactically + limited to the length of this buffer. */ + char buffer[256]; + + /* The name that should actually be used by the generator programs. + This is an expansion of NAME, after things like constant substitution. */ + char *string; +}; + +/* This structure represents a constant defined by define_constant, + define_enum, or such-like. */ +struct md_constant { + /* The name of the constant. */ + char *name; + + /* The string to which the constants expands. */ + char *value; + + /* If the constant is associated with a enumeration, this field + points to that enumeration, otherwise it is null. */ + struct enum_type *parent_enum; +}; + +/* This structure represents one value in an enum_type. */ +struct enum_value { + /* The next value in the enum, or null if this is the last. */ + struct enum_value *next; + + /* The name of the value as it appears in the .md file. */ + char *name; + + /* The definition of the related C value. */ + struct md_constant *def; +}; + +/* This structure represents an enum defined by define_enum or the like. */ +struct enum_type { + /* The C name of the enumeration. */ + char *name; + + /* True if this is an md-style enum (DEFINE_ENUM) rather than + a C-style enum (DEFINE_C_ENUM). */ + bool md_p; + + /* The values of the enumeration. There is always at least one. */ + struct enum_value *values; + + /* A pointer to the null terminator in VALUES. */ + struct enum_value **tail_ptr; + + /* The number of enumeration values. */ + unsigned int num_values; +}; + +/* A class for reading .md files and RTL dump files. + + Implemented in read-md.c. + + This class has responsibility for reading chars from input files, and + for certain common top-level directives including the "include" + directive. + + It does not handle parsing the hierarchically-nested expressions of + rtl.def; for that see the rtx_reader subclass below (implemented in + read-rtl.c). */ + +class md_reader +{ + public: + md_reader (bool compact); + virtual ~md_reader (); + + bool read_md_files (int, const char **, bool (*) (const char *)); + bool read_file (const char *filename); + bool read_file_fragment (const char *filename, + int first_line, + int last_line); + + /* A hook that handles a single .md-file directive, up to but not + including the closing ')'. It takes two arguments: the file position + at which the directive started, and the name of the directive. The next + unread character is the optional space after the directive name. */ + virtual void handle_unknown_directive (file_location, const char *) = 0; + + file_location get_current_location () const; + + bool is_compact () const { return m_compact; } + + /* Defined in read-md.c. */ + int read_char (void); + void unread_char (int ch); + file_location read_name (struct md_name *name); + file_location read_name_or_nil (struct md_name *); + void read_escape (); + char *read_quoted_string (); + char *read_braced_string (); + char *read_string (int star_if_braced); + void read_skip_construct (int depth, file_location loc); + void require_char (char expected); + void require_char_ws (char expected); + void require_word_ws (const char *expected); + int peek_char (void); + + void set_md_ptr_loc (const void *ptr, const char *filename, int lineno); + const struct ptr_loc *get_md_ptr_loc (const void *ptr); + void copy_md_ptr_loc (const void *new_ptr, const void *old_ptr); + void fprint_md_ptr_loc (FILE *outf, const void *ptr); + void print_md_ptr_loc (const void *ptr); + + struct enum_type *lookup_enum_type (const char *name); + void traverse_enum_types (htab_trav callback, void *info); + + void handle_constants (); + void traverse_md_constants (htab_trav callback, void *info); + void handle_enum (file_location loc, bool md_p); + + const char *join_c_conditions (const char *cond1, const char *cond2); + void fprint_c_condition (FILE *outf, const char *cond); + void print_c_condition (const char *cond); + + /* Defined in read-rtl.c. */ + const char *apply_iterator_to_string (const char *string); + rtx copy_rtx_for_iterators (rtx original); + void read_conditions (); + void record_potential_iterator_use (struct iterator_group *group, + void *ptr, const char *name); + struct mapping *read_mapping (struct iterator_group *group, htab_t table); + + const char *get_top_level_filename () const { return m_toplevel_fname; } + const char *get_filename () const { return m_read_md_filename; } + int get_lineno () const { return m_read_md_lineno; } + int get_colno () const { return m_read_md_colno; } + + struct obstack *get_string_obstack () { return &m_string_obstack; } + htab_t get_md_constants () { return m_md_constants; } + + private: + /* A singly-linked list of filenames. */ + struct file_name_list { + struct file_name_list *next; + const char *fname; + }; + + private: + void handle_file (); + void handle_toplevel_file (); + void handle_include (file_location loc); + void add_include_path (const char *arg); + + bool read_name_1 (struct md_name *name, file_location *out_loc); + + private: + /* Are we reading a compact dump? */ + bool m_compact; + + /* The name of the toplevel file that indirectly included + m_read_md_file. */ + const char *m_toplevel_fname; + + /* The directory part of m_toplevel_fname + NULL if m_toplevel_fname is a bare filename. */ + char *m_base_dir; + + /* The file we are reading. */ + FILE *m_read_md_file; + + /* The filename of m_read_md_file. */ + const char *m_read_md_filename; + + /* The current line number in m_read_md_file. */ + int m_read_md_lineno; + + /* The current column number in m_read_md_file. */ + int m_read_md_colno; + + /* The column number before the last newline, so that + we can handle unread_char ('\n') at least once whilst + retaining column information. */ + int m_last_line_colno; + + /* The first directory to search. */ + file_name_list *m_first_dir_md_include; + + /* A pointer to the null terminator of the md include chain. */ + file_name_list **m_last_dir_md_include_ptr; + + /* Obstack used for allocating MD strings. */ + struct obstack m_string_obstack; + + /* A table of ptr_locs, hashed on the PTR field. */ + htab_t m_ptr_locs; + + /* An obstack for the above. Plain xmalloc is a bit heavyweight for a + small structure like ptr_loc. */ + struct obstack m_ptr_loc_obstack; + + /* A hash table of triples (A, B, C), where each of A, B and C is a condition + and A is equivalent to "B && C". This is used to keep track of the source + of conditions that are made up of separate MD strings (such as the split + condition of a define_insn_and_split). */ + htab_t m_joined_conditions; + + /* An obstack for allocating joined_conditions entries. */ + struct obstack m_joined_conditions_obstack; + + /* A table of md_constant structures, hashed by name. Null if no + constant expansion should occur. */ + htab_t m_md_constants; + + /* A table of enum_type structures, hashed by name. */ + htab_t m_enum_types; + + /* If non-zero, filter the input to just this subset of lines. */ + int m_first_line; + int m_last_line; +}; + +/* Global singleton; constrast with rtx_reader_ptr below. */ +extern md_reader *md_reader_ptr; + +/* An md_reader subclass which skips unknown directives, for + the gen* tools that purely use read-md.o. */ + +class noop_reader : public md_reader +{ + public: + noop_reader () : md_reader (false) {} + + /* A dummy implementation which skips unknown directives. */ + void handle_unknown_directive (file_location, const char *); +}; + +/* An md_reader subclass that actually handles full hierarchical + rtx expressions. + + Implemented in read-rtl.c. */ + +class rtx_reader : public md_reader +{ + public: + rtx_reader (bool compact); + ~rtx_reader (); + + bool read_rtx (const char *rtx_name, vec *rtxen); + rtx read_rtx_code (const char *code_name); + virtual rtx read_rtx_operand (rtx return_rtx, int idx); + rtx read_nested_rtx (); + rtx read_rtx_variadic (rtx form); + char *read_until (const char *terminator_chars, bool consume_terminator); + + virtual void handle_any_trailing_information (rtx) {} + virtual rtx postprocess (rtx x) { return x; } + + /* Hook to allow function_reader subclass to put STRINGBUF into gc-managed + memory, rather than within an obstack. + This base class implementation is a no-op. */ + virtual const char *finalize_string (char *stringbuf) { return stringbuf; } + + protected: + /* Analogous to rtx_writer's m_in_call_function_usage. */ + bool m_in_call_function_usage; + + /* Support for "reuse_rtx" directives. */ + auto_vec m_reuse_rtx_by_id; +}; + +/* Global singleton; constrast with md_reader_ptr above. */ +extern rtx_reader *rtx_reader_ptr; + +extern void (*include_callback) (const char *); + +/* Read the next character from the MD file. */ + +static inline int +read_char (void) +{ + return md_reader_ptr->read_char (); +} + +/* Put back CH, which was the last character read from the MD file. */ + +static inline void +unread_char (int ch) +{ + md_reader_ptr->unread_char (ch); +} + +extern hashval_t leading_string_hash (const void *); +extern int leading_string_eq_p (const void *, const void *); +extern const char *join_c_conditions (const char *, const char *); +extern void message_at (file_location, const char *, ...) ATTRIBUTE_PRINTF_2; +extern void error_at (file_location, const char *, ...) ATTRIBUTE_PRINTF_2; +extern void fatal_at (file_location, const char *, ...) ATTRIBUTE_PRINTF_2; +extern void fatal_with_file_and_line (const char *, ...) + ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; +extern void fatal_expected_char (int, int) ATTRIBUTE_NORETURN; +extern int read_skip_spaces (void); +extern int n_comma_elts (const char *); +extern const char *scan_comma_elt (const char **); +extern void upcase_string (char *); +extern void traverse_enum_types (htab_trav, void *); +extern struct enum_type *lookup_enum_type (const char *); + +#endif /* GCC_READ_MD_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/read-rtl-function.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/read-rtl-function.h new file mode 100644 index 0000000..10ceab8 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/read-rtl-function.h @@ -0,0 +1,28 @@ +/* read-rtl-function.h - Reader for RTL function dumps + Copyright (C) 2016-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_READ_RTL_FUNCTION_H +#define GCC_READ_RTL_FUNCTION_H + +extern bool read_rtl_function_body (const char *path); + +extern bool read_rtl_function_body_from_file_range (location_t start_loc, + location_t end_loc); + +#endif /* GCC_READ_RTL_FUNCTION_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/real.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/real.h new file mode 100644 index 0000000..e7248e3 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/real.h @@ -0,0 +1,521 @@ +/* Definitions of floating-point access for GNU compiler. + Copyright (C) 1989-2017 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 3, or (at your option) any later + version. + + GCC is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#ifndef GCC_REAL_H +#define GCC_REAL_H + +/* An expanded form of the represented number. */ + +/* Enumerate the special cases of numbers that we encounter. */ +enum real_value_class { + rvc_zero, + rvc_normal, + rvc_inf, + rvc_nan +}; + +#define SIGNIFICAND_BITS (128 + HOST_BITS_PER_LONG) +#define EXP_BITS (32 - 6) +#define MAX_EXP ((1 << (EXP_BITS - 1)) - 1) +#define SIGSZ (SIGNIFICAND_BITS / HOST_BITS_PER_LONG) +#define SIG_MSB ((unsigned long)1 << (HOST_BITS_PER_LONG - 1)) + +struct GTY(()) real_value { + /* Use the same underlying type for all bit-fields, so as to make + sure they're packed together, otherwise REAL_VALUE_TYPE_SIZE will + be miscomputed. */ + unsigned int /* ENUM_BITFIELD (real_value_class) */ cl : 2; + unsigned int decimal : 1; + unsigned int sign : 1; + unsigned int signalling : 1; + unsigned int canonical : 1; + unsigned int uexp : EXP_BITS; + unsigned long sig[SIGSZ]; +}; + +#define REAL_EXP(REAL) \ + ((int)((REAL)->uexp ^ (unsigned int)(1 << (EXP_BITS - 1))) \ + - (1 << (EXP_BITS - 1))) +#define SET_REAL_EXP(REAL, EXP) \ + ((REAL)->uexp = ((unsigned int)(EXP) & (unsigned int)((1 << EXP_BITS) - 1))) + +/* Various headers condition prototypes on #ifdef REAL_VALUE_TYPE, so it + needs to be a macro. We do need to continue to have a structure tag + so that other headers can forward declare it. */ +#define REAL_VALUE_TYPE struct real_value + +/* We store a REAL_VALUE_TYPE into an rtx, and we do this by putting it in + consecutive "w" slots. Moreover, we've got to compute the number of "w" + slots at preprocessor time, which means we can't use sizeof. Guess. */ + +#define REAL_VALUE_TYPE_SIZE (SIGNIFICAND_BITS + 32) +#define REAL_WIDTH \ + (REAL_VALUE_TYPE_SIZE/HOST_BITS_PER_WIDE_INT \ + + (REAL_VALUE_TYPE_SIZE%HOST_BITS_PER_WIDE_INT ? 1 : 0)) /* round up */ + +/* Verify the guess. */ +extern char test_real_width + [sizeof (REAL_VALUE_TYPE) <= REAL_WIDTH * sizeof (HOST_WIDE_INT) ? 1 : -1]; + +/* Calculate the format for CONST_DOUBLE. We need as many slots as + are necessary to overlay a REAL_VALUE_TYPE on them. This could be + as many as four (32-bit HOST_WIDE_INT, 128-bit REAL_VALUE_TYPE). + + A number of places assume that there are always at least two 'w' + slots in a CONST_DOUBLE, so we provide them even if one would suffice. */ + +#if REAL_WIDTH == 1 +# define CONST_DOUBLE_FORMAT "ww" +#else +# if REAL_WIDTH == 2 +# define CONST_DOUBLE_FORMAT "ww" +# else +# if REAL_WIDTH == 3 +# define CONST_DOUBLE_FORMAT "www" +# else +# if REAL_WIDTH == 4 +# define CONST_DOUBLE_FORMAT "wwww" +# else +# if REAL_WIDTH == 5 +# define CONST_DOUBLE_FORMAT "wwwww" +# else +# if REAL_WIDTH == 6 +# define CONST_DOUBLE_FORMAT "wwwwww" +# else + #error "REAL_WIDTH > 6 not supported" +# endif +# endif +# endif +# endif +# endif +#endif + + +/* Describes the properties of the specific target format in use. */ +struct real_format +{ + /* Move to and from the target bytes. */ + void (*encode) (const struct real_format *, long *, + const REAL_VALUE_TYPE *); + void (*decode) (const struct real_format *, REAL_VALUE_TYPE *, + const long *); + + /* The radix of the exponent and digits of the significand. */ + int b; + + /* Size of the significand in digits of radix B. */ + int p; + + /* Size of the significant of a NaN, in digits of radix B. */ + int pnan; + + /* The minimum negative integer, x, such that b**(x-1) is normalized. */ + int emin; + + /* The maximum integer, x, such that b**(x-1) is representable. */ + int emax; + + /* The bit position of the sign bit, for determining whether a value + is positive/negative, or -1 for a complex encoding. */ + int signbit_ro; + + /* The bit position of the sign bit, for changing the sign of a number, + or -1 for a complex encoding. */ + int signbit_rw; + + /* If this is an IEEE interchange format, the number of bits in the + format; otherwise, if it is an IEEE extended format, one more + than the greatest number of bits in an interchange format it + extends; otherwise 0. Formats need not follow the IEEE 754-2008 + recommended practice regarding how signaling NaNs are identified, + and may vary in the choice of default NaN, but must follow other + IEEE practice regarding having NaNs, infinities and subnormal + values, and the relation of minimum and maximum exponents, and, + for interchange formats, the details of the encoding. */ + int ieee_bits; + + /* Default rounding mode for operations on this format. */ + bool round_towards_zero; + bool has_sign_dependent_rounding; + + /* Properties of the format. */ + bool has_nans; + bool has_inf; + bool has_denorm; + bool has_signed_zero; + bool qnan_msb_set; + bool canonical_nan_lsbs_set; + const char *name; +}; + + +/* The target format used for each floating point mode. + Float modes are followed by decimal float modes, with entries for + float modes indexed by (MODE - first float mode), and entries for + decimal float modes indexed by (MODE - first decimal float mode) + + the number of float modes. */ +extern const struct real_format * + real_format_for_mode[MAX_MODE_FLOAT - MIN_MODE_FLOAT + 1 + + MAX_MODE_DECIMAL_FLOAT - MIN_MODE_DECIMAL_FLOAT + 1]; + +#define REAL_MODE_FORMAT(MODE) \ + (real_format_for_mode[DECIMAL_FLOAT_MODE_P (MODE) \ + ? (((MODE) - MIN_MODE_DECIMAL_FLOAT) \ + + (MAX_MODE_FLOAT - MIN_MODE_FLOAT + 1)) \ + : GET_MODE_CLASS (MODE) == MODE_FLOAT \ + ? ((MODE) - MIN_MODE_FLOAT) \ + : (gcc_unreachable (), 0)]) + +#define FLOAT_MODE_FORMAT(MODE) \ + (REAL_MODE_FORMAT (SCALAR_FLOAT_MODE_P (MODE)? (MODE) \ + : GET_MODE_INNER (MODE))) + +/* The following macro determines whether the floating point format is + composite, i.e. may contain non-consecutive mantissa bits, in which + case compile-time FP overflow may not model run-time overflow. */ +#define MODE_COMPOSITE_P(MODE) \ + (FLOAT_MODE_P (MODE) \ + && FLOAT_MODE_FORMAT (MODE)->pnan < FLOAT_MODE_FORMAT (MODE)->p) + +/* Accessor macros for format properties. */ +#define MODE_HAS_NANS(MODE) \ + (FLOAT_MODE_P (MODE) && FLOAT_MODE_FORMAT (MODE)->has_nans) +#define MODE_HAS_INFINITIES(MODE) \ + (FLOAT_MODE_P (MODE) && FLOAT_MODE_FORMAT (MODE)->has_inf) +#define MODE_HAS_SIGNED_ZEROS(MODE) \ + (FLOAT_MODE_P (MODE) && FLOAT_MODE_FORMAT (MODE)->has_signed_zero) +#define MODE_HAS_SIGN_DEPENDENT_ROUNDING(MODE) \ + (FLOAT_MODE_P (MODE) \ + && FLOAT_MODE_FORMAT (MODE)->has_sign_dependent_rounding) + +/* This class allows functions in this file to accept a floating-point + format as either a mode or an explicit real_format pointer. In the + former case the mode must be VOIDmode (which means "no particular + format") or must satisfy SCALAR_FLOAT_MODE_P. */ +class format_helper +{ +public: + format_helper (const real_format *format) : m_format (format) {} + format_helper (machine_mode m); + const real_format *operator-> () const { return m_format; } + operator const real_format *() const { return m_format; } + + bool decimal_p () const { return m_format && m_format->b == 10; } + +private: + const real_format *m_format; +}; + +inline format_helper::format_helper (machine_mode m) + : m_format (m == VOIDmode ? 0 : REAL_MODE_FORMAT (m)) +{} + +/* Declare functions in real.c. */ + +/* True if the given mode has a NaN representation and the treatment of + NaN operands is important. Certain optimizations, such as folding + x * 0 into 0, are not correct for NaN operands, and are normally + disabled for modes with NaNs. The user can ask for them to be + done anyway using the -funsafe-math-optimizations switch. */ +extern bool HONOR_NANS (machine_mode); +extern bool HONOR_NANS (const_tree); +extern bool HONOR_NANS (const_rtx); + +/* Like HONOR_NANs, but true if we honor signaling NaNs (or sNaNs). */ +extern bool HONOR_SNANS (machine_mode); +extern bool HONOR_SNANS (const_tree); +extern bool HONOR_SNANS (const_rtx); + +/* As for HONOR_NANS, but true if the mode can represent infinity and + the treatment of infinite values is important. */ +extern bool HONOR_INFINITIES (machine_mode); +extern bool HONOR_INFINITIES (const_tree); +extern bool HONOR_INFINITIES (const_rtx); + +/* Like HONOR_NANS, but true if the given mode distinguishes between + positive and negative zero, and the sign of zero is important. */ +extern bool HONOR_SIGNED_ZEROS (machine_mode); +extern bool HONOR_SIGNED_ZEROS (const_tree); +extern bool HONOR_SIGNED_ZEROS (const_rtx); + +/* Like HONOR_NANS, but true if given mode supports sign-dependent rounding, + and the rounding mode is important. */ +extern bool HONOR_SIGN_DEPENDENT_ROUNDING (machine_mode); +extern bool HONOR_SIGN_DEPENDENT_ROUNDING (const_tree); +extern bool HONOR_SIGN_DEPENDENT_ROUNDING (const_rtx); + +/* Binary or unary arithmetic on tree_code. */ +extern bool real_arithmetic (REAL_VALUE_TYPE *, int, const REAL_VALUE_TYPE *, + const REAL_VALUE_TYPE *); + +/* Compare reals by tree_code. */ +extern bool real_compare (int, const REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *); + +/* Determine whether a floating-point value X is infinite. */ +extern bool real_isinf (const REAL_VALUE_TYPE *); + +/* Determine whether a floating-point value X is a NaN. */ +extern bool real_isnan (const REAL_VALUE_TYPE *); + +/* Determine whether a floating-point value X is a signaling NaN. */ +extern bool real_issignaling_nan (const REAL_VALUE_TYPE *); + +/* Determine whether a floating-point value X is finite. */ +extern bool real_isfinite (const REAL_VALUE_TYPE *); + +/* Determine whether a floating-point value X is negative. */ +extern bool real_isneg (const REAL_VALUE_TYPE *); + +/* Determine whether a floating-point value X is minus zero. */ +extern bool real_isnegzero (const REAL_VALUE_TYPE *); + +/* Test relationships between reals. */ +extern bool real_identical (const REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *); +extern bool real_equal (const REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *); +extern bool real_less (const REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *); + +/* Extend or truncate to a new format. */ +extern void real_convert (REAL_VALUE_TYPE *, format_helper, + const REAL_VALUE_TYPE *); + +/* Return true if truncating to NEW is exact. */ +extern bool exact_real_truncate (format_helper, const REAL_VALUE_TYPE *); + +/* Render R as a decimal floating point constant. */ +extern void real_to_decimal (char *, const REAL_VALUE_TYPE *, size_t, + size_t, int); + +/* Render R as a decimal floating point constant, rounded so as to be + parsed back to the same value when interpreted in mode MODE. */ +extern void real_to_decimal_for_mode (char *, const REAL_VALUE_TYPE *, size_t, + size_t, int, machine_mode); + +/* Render R as a hexadecimal floating point constant. */ +extern void real_to_hexadecimal (char *, const REAL_VALUE_TYPE *, + size_t, size_t, int); + +/* Render R as an integer. */ +extern HOST_WIDE_INT real_to_integer (const REAL_VALUE_TYPE *); + +/* Initialize R from a decimal or hexadecimal string. Return -1 if + the value underflows, +1 if overflows, and 0 otherwise. */ +extern int real_from_string (REAL_VALUE_TYPE *, const char *); +/* Wrapper to allow different internal representation for decimal floats. */ +extern void real_from_string3 (REAL_VALUE_TYPE *, const char *, format_helper); + +extern long real_to_target (long *, const REAL_VALUE_TYPE *, format_helper); + +extern void real_from_target (REAL_VALUE_TYPE *, const long *, + format_helper); + +extern void real_inf (REAL_VALUE_TYPE *); + +extern bool real_nan (REAL_VALUE_TYPE *, const char *, int, format_helper); + +extern void real_maxval (REAL_VALUE_TYPE *, int, machine_mode); + +extern void real_2expN (REAL_VALUE_TYPE *, int, format_helper); + +extern unsigned int real_hash (const REAL_VALUE_TYPE *); + + +/* Target formats defined in real.c. */ +extern const struct real_format ieee_single_format; +extern const struct real_format mips_single_format; +extern const struct real_format motorola_single_format; +extern const struct real_format spu_single_format; +extern const struct real_format ieee_double_format; +extern const struct real_format mips_double_format; +extern const struct real_format motorola_double_format; +extern const struct real_format ieee_extended_motorola_format; +extern const struct real_format ieee_extended_intel_96_format; +extern const struct real_format ieee_extended_intel_96_round_53_format; +extern const struct real_format ieee_extended_intel_128_format; +extern const struct real_format ibm_extended_format; +extern const struct real_format mips_extended_format; +extern const struct real_format ieee_quad_format; +extern const struct real_format mips_quad_format; +extern const struct real_format vax_f_format; +extern const struct real_format vax_d_format; +extern const struct real_format vax_g_format; +extern const struct real_format real_internal_format; +extern const struct real_format decimal_single_format; +extern const struct real_format decimal_double_format; +extern const struct real_format decimal_quad_format; +extern const struct real_format ieee_half_format; +extern const struct real_format arm_half_format; + + +/* ====================================================================== */ +/* Crap. */ + +/* Determine whether a floating-point value X is infinite. */ +#define REAL_VALUE_ISINF(x) real_isinf (&(x)) + +/* Determine whether a floating-point value X is a NaN. */ +#define REAL_VALUE_ISNAN(x) real_isnan (&(x)) + +/* Determine whether a floating-point value X is a signaling NaN. */ +#define REAL_VALUE_ISSIGNALING_NAN(x) real_issignaling_nan (&(x)) + +/* Determine whether a floating-point value X is negative. */ +#define REAL_VALUE_NEGATIVE(x) real_isneg (&(x)) + +/* Determine whether a floating-point value X is minus zero. */ +#define REAL_VALUE_MINUS_ZERO(x) real_isnegzero (&(x)) + +/* IN is a REAL_VALUE_TYPE. OUT is an array of longs. */ +#define REAL_VALUE_TO_TARGET_LONG_DOUBLE(IN, OUT) \ + real_to_target (OUT, &(IN), \ + mode_for_size (LONG_DOUBLE_TYPE_SIZE, MODE_FLOAT, 0)) + +#define REAL_VALUE_TO_TARGET_DOUBLE(IN, OUT) \ + real_to_target (OUT, &(IN), mode_for_size (64, MODE_FLOAT, 0)) + +/* IN is a REAL_VALUE_TYPE. OUT is a long. */ +#define REAL_VALUE_TO_TARGET_SINGLE(IN, OUT) \ + ((OUT) = real_to_target (NULL, &(IN), mode_for_size (32, MODE_FLOAT, 0))) + +/* Real values to IEEE 754 decimal floats. */ + +/* IN is a REAL_VALUE_TYPE. OUT is an array of longs. */ +#define REAL_VALUE_TO_TARGET_DECIMAL128(IN, OUT) \ + real_to_target (OUT, &(IN), mode_for_size (128, MODE_DECIMAL_FLOAT, 0)) + +#define REAL_VALUE_TO_TARGET_DECIMAL64(IN, OUT) \ + real_to_target (OUT, &(IN), mode_for_size (64, MODE_DECIMAL_FLOAT, 0)) + +/* IN is a REAL_VALUE_TYPE. OUT is a long. */ +#define REAL_VALUE_TO_TARGET_DECIMAL32(IN, OUT) \ + ((OUT) = real_to_target (NULL, &(IN), mode_for_size (32, MODE_DECIMAL_FLOAT, 0))) + +extern REAL_VALUE_TYPE real_value_truncate (format_helper, REAL_VALUE_TYPE); + +extern REAL_VALUE_TYPE real_value_negate (const REAL_VALUE_TYPE *); +extern REAL_VALUE_TYPE real_value_abs (const REAL_VALUE_TYPE *); + +extern int significand_size (format_helper); + +extern REAL_VALUE_TYPE real_from_string2 (const char *, format_helper); + +#define REAL_VALUE_ATOF(s, m) \ + real_from_string2 (s, m) + +#define CONST_DOUBLE_ATOF(s, m) \ + const_double_from_real_value (real_from_string2 (s, m), m) + +#define REAL_VALUE_FIX(r) \ + real_to_integer (&(r)) + +/* ??? Not quite right. */ +#define REAL_VALUE_UNSIGNED_FIX(r) \ + real_to_integer (&(r)) + +/* ??? These were added for Paranoia support. */ + +/* Return floor log2(R). */ +extern int real_exponent (const REAL_VALUE_TYPE *); + +/* R = A * 2**EXP. */ +extern void real_ldexp (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *, int); + +/* **** End of software floating point emulator interface macros **** */ + +/* Constant real values 0, 1, 2, -1 and 0.5. */ + +extern REAL_VALUE_TYPE dconst0; +extern REAL_VALUE_TYPE dconst1; +extern REAL_VALUE_TYPE dconst2; +extern REAL_VALUE_TYPE dconstm1; +extern REAL_VALUE_TYPE dconsthalf; + +#define dconst_e() (*dconst_e_ptr ()) +#define dconst_third() (*dconst_third_ptr ()) +#define dconst_quarter() (*dconst_quarter_ptr ()) +#define dconst_sixth() (*dconst_sixth_ptr ()) +#define dconst_ninth() (*dconst_ninth_ptr ()) +#define dconst_sqrt2() (*dconst_sqrt2_ptr ()) + +/* Function to return the real value special constant 'e'. */ +extern const REAL_VALUE_TYPE * dconst_e_ptr (void); + +/* Returns a cached REAL_VALUE_TYPE corresponding to 1/n, for various n. */ +extern const REAL_VALUE_TYPE *dconst_third_ptr (void); +extern const REAL_VALUE_TYPE *dconst_quarter_ptr (void); +extern const REAL_VALUE_TYPE *dconst_sixth_ptr (void); +extern const REAL_VALUE_TYPE *dconst_ninth_ptr (void); + +/* Returns the special REAL_VALUE_TYPE corresponding to sqrt(2). */ +extern const REAL_VALUE_TYPE * dconst_sqrt2_ptr (void); + +/* Function to return a real value (not a tree node) + from a given integer constant. */ +REAL_VALUE_TYPE real_value_from_int_cst (const_tree, const_tree); + +/* Return a CONST_DOUBLE with value R and mode M. */ +extern rtx const_double_from_real_value (REAL_VALUE_TYPE, machine_mode); + +/* Replace R by 1/R in the given format, if the result is exact. */ +extern bool exact_real_inverse (format_helper, REAL_VALUE_TYPE *); + +/* Return true if arithmetic on values in IMODE that were promoted + from values in TMODE is equivalent to direct arithmetic on values + in TMODE. */ +bool real_can_shorten_arithmetic (machine_mode, machine_mode); + +/* In tree.c: wrap up a REAL_VALUE_TYPE in a tree node. */ +extern tree build_real (tree, REAL_VALUE_TYPE); + +/* Likewise, but first truncate the value to the type. */ +extern tree build_real_truncate (tree, REAL_VALUE_TYPE); + +/* Calculate R as X raised to the integer exponent N in format FMT. */ +extern bool real_powi (REAL_VALUE_TYPE *, format_helper, + const REAL_VALUE_TYPE *, HOST_WIDE_INT); + +/* Standard round to integer value functions. */ +extern void real_trunc (REAL_VALUE_TYPE *, format_helper, + const REAL_VALUE_TYPE *); +extern void real_floor (REAL_VALUE_TYPE *, format_helper, + const REAL_VALUE_TYPE *); +extern void real_ceil (REAL_VALUE_TYPE *, format_helper, + const REAL_VALUE_TYPE *); +extern void real_round (REAL_VALUE_TYPE *, format_helper, + const REAL_VALUE_TYPE *); + +/* Set the sign of R to the sign of X. */ +extern void real_copysign (REAL_VALUE_TYPE *, const REAL_VALUE_TYPE *); + +/* Check whether the real constant value given is an integer. */ +extern bool real_isinteger (const REAL_VALUE_TYPE *, format_helper); +extern bool real_isinteger (const REAL_VALUE_TYPE *, HOST_WIDE_INT *); + +/* Write into BUF the maximum representable finite floating-point + number, (1 - b**-p) * b**emax for a given FP format FMT as a hex + float string. BUF must be large enough to contain the result. */ +extern void get_max_float (const struct real_format *, char *, size_t); + +#ifndef GENERATOR_FILE +/* real related routines. */ +extern wide_int real_to_integer (const REAL_VALUE_TYPE *, bool *, int); +extern void real_from_integer (REAL_VALUE_TYPE *, format_helper, + const wide_int_ref &, signop); +#endif + +#endif /* ! GCC_REAL_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/realmpfr.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/realmpfr.h new file mode 100644 index 0000000..0ea36d2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/realmpfr.h @@ -0,0 +1,41 @@ +/* Definitions of floating-point conversion from compiler + internal format to MPFR. + Copyright (C) 2010-2017 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 3, or (at your option) any later + version. + + GCC is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#ifndef GCC_REALGMP_H +#define GCC_REALGMP_H + +#include +#include + +/* Convert between MPFR and REAL_VALUE_TYPE. The caller is + responsible for initializing and clearing the MPFR parameter. */ + +extern void real_from_mpfr (REAL_VALUE_TYPE *, mpfr_srcptr, tree, mp_rnd_t); +extern void real_from_mpfr (REAL_VALUE_TYPE *, mpfr_srcptr, + const real_format *, mp_rnd_t); +extern void mpfr_from_real (mpfr_ptr, const REAL_VALUE_TYPE *, mp_rnd_t); + +#if (GCC_VERSION >= 3000) + /* For compatibility with mpfr 2.4 and earlier, we want to only use + GMP_RND*. */ + #pragma GCC poison MPFR_RNDN MPFR_RNDZ MPFR_RNDU MPFR_RNDD +#endif + +#endif /* ! GCC_REALGMP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/recog.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/recog.h new file mode 100644 index 0000000..07c60fe --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/recog.h @@ -0,0 +1,415 @@ +/* Declarations for interface to insn recognizer and insn-output.c. + Copyright (C) 1987-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_RECOG_H +#define GCC_RECOG_H + +/* Random number that should be large enough for all purposes. Also define + a type that has at least MAX_RECOG_ALTERNATIVES + 1 bits, with the extra + bit giving an invalid value that can be used to mean "uninitialized". */ +#define MAX_RECOG_ALTERNATIVES 35 +typedef uint64_t alternative_mask; + +/* A mask of all alternatives. */ +#define ALL_ALTERNATIVES ((alternative_mask) -1) + +/* A mask containing just alternative X. */ +#define ALTERNATIVE_BIT(X) ((alternative_mask) 1 << (X)) + +/* Types of operands. */ +enum op_type { + OP_IN, + OP_OUT, + OP_INOUT +}; + +struct operand_alternative +{ + /* Pointer to the beginning of the constraint string for this alternative, + for easier access by alternative number. */ + const char *constraint; + + /* The register class valid for this alternative (possibly NO_REGS). */ + ENUM_BITFIELD (reg_class) cl : 16; + + /* "Badness" of this alternative, computed from number of '?' and '!' + characters in the constraint string. */ + unsigned int reject : 16; + + /* -1 if no matching constraint was found, or an operand number. */ + int matches : 8; + /* The same information, but reversed: -1 if this operand is not + matched by any other, or the operand number of the operand that + matches this one. */ + int matched : 8; + + /* Nonzero if '&' was found in the constraint string. */ + unsigned int earlyclobber : 1; + /* Nonzero if TARGET_MEM_CONSTRAINT was found in the constraint + string. */ + unsigned int memory_ok : 1; + /* Nonzero if 'p' was found in the constraint string. */ + unsigned int is_address : 1; + /* Nonzero if 'X' was found in the constraint string, or if the constraint + string for this alternative was empty. */ + unsigned int anything_ok : 1; + + unsigned int unused : 12; +}; + +/* Return the class for operand I of alternative ALT, taking matching + constraints into account. */ + +static inline enum reg_class +alternative_class (const operand_alternative *alt, int i) +{ + return alt[i].matches >= 0 ? alt[alt[i].matches].cl : alt[i].cl; +} + +extern void init_recog (void); +extern void init_recog_no_volatile (void); +extern int check_asm_operands (rtx); +extern int asm_operand_ok (rtx, const char *, const char **); +extern bool validate_change (rtx, rtx *, rtx, bool); +extern bool validate_unshare_change (rtx, rtx *, rtx, bool); +extern bool canonicalize_change_group (rtx_insn *insn, rtx x); +extern int insn_invalid_p (rtx_insn *, bool); +extern int verify_changes (int); +extern void confirm_change_group (void); +extern int apply_change_group (void); +extern int num_validated_changes (void); +extern void cancel_changes (int); +extern int constrain_operands (int, alternative_mask); +extern int constrain_operands_cached (rtx_insn *, int); +extern int memory_address_addr_space_p (machine_mode, rtx, addr_space_t); +#define memory_address_p(mode,addr) \ + memory_address_addr_space_p ((mode), (addr), ADDR_SPACE_GENERIC) +extern int strict_memory_address_addr_space_p (machine_mode, rtx, + addr_space_t); +#define strict_memory_address_p(mode,addr) \ + strict_memory_address_addr_space_p ((mode), (addr), ADDR_SPACE_GENERIC) +extern int validate_replace_rtx_subexp (rtx, rtx, rtx_insn *, rtx *); +extern int validate_replace_rtx (rtx, rtx, rtx_insn *); +extern int validate_replace_rtx_part (rtx, rtx, rtx *, rtx_insn *); +extern int validate_replace_rtx_part_nosimplify (rtx, rtx, rtx *, rtx_insn *); +extern void validate_replace_rtx_group (rtx, rtx, rtx_insn *); +extern void validate_replace_src_group (rtx, rtx, rtx_insn *); +extern bool validate_simplify_insn (rtx_insn *insn); +extern int num_changes_pending (void); +extern int next_insn_tests_no_inequality (rtx_insn *); +extern bool reg_fits_class_p (const_rtx, reg_class_t, int, machine_mode); + +extern int offsettable_memref_p (rtx); +extern int offsettable_nonstrict_memref_p (rtx); +extern int offsettable_address_addr_space_p (int, machine_mode, rtx, + addr_space_t); +#define offsettable_address_p(strict,mode,addr) \ + offsettable_address_addr_space_p ((strict), (mode), (addr), \ + ADDR_SPACE_GENERIC) +extern bool mode_dependent_address_p (rtx, addr_space_t); + +extern int recog (rtx, rtx_insn *, int *); +#ifndef GENERATOR_FILE +static inline int recog_memoized (rtx_insn *insn); +#endif +extern void add_clobbers (rtx, int); +extern int added_clobbers_hard_reg_p (int); +extern void insn_extract (rtx_insn *); +extern void extract_insn (rtx_insn *); +extern void extract_constrain_insn (rtx_insn *insn); +extern void extract_constrain_insn_cached (rtx_insn *); +extern void extract_insn_cached (rtx_insn *); +extern void preprocess_constraints (int, int, const char **, + operand_alternative *); +extern const operand_alternative *preprocess_insn_constraints (unsigned int); +extern void preprocess_constraints (rtx_insn *); +extern rtx_insn *peep2_next_insn (int); +extern int peep2_regno_dead_p (int, int); +extern int peep2_reg_dead_p (int, rtx); +#ifdef CLEAR_HARD_REG_SET +extern rtx peep2_find_free_register (int, int, const char *, + machine_mode, HARD_REG_SET *); +#endif +extern rtx_insn *peephole2_insns (rtx, rtx_insn *, int *); + +extern int store_data_bypass_p (rtx_insn *, rtx_insn *); +extern int if_test_bypass_p (rtx_insn *, rtx_insn *); + +#ifndef GENERATOR_FILE +/* Try recognizing the instruction INSN, + and return the code number that results. + Remember the code so that repeated calls do not + need to spend the time for actual rerecognition. + + This function is the normal interface to instruction recognition. + The automatically-generated function `recog' is normally called + through this one. */ + +static inline int +recog_memoized (rtx_insn *insn) +{ + if (INSN_CODE (insn) < 0) + INSN_CODE (insn) = recog (PATTERN (insn), insn, 0); + return INSN_CODE (insn); +} +#endif + +/* Skip chars until the next ',' or the end of the string. This is + useful to skip alternatives in a constraint string. */ +static inline const char * +skip_alternative (const char *p) +{ + const char *r = p; + while (*r != '\0' && *r != ',') + r++; + if (*r == ',') + r++; + return r; +} + +/* Nonzero means volatile operands are recognized. */ +extern int volatile_ok; + +/* Set by constrain_operands to the number of the alternative that + matched. */ +extern int which_alternative; + +/* The following vectors hold the results from insn_extract. */ + +struct recog_data_d +{ + /* It is very tempting to make the 5 operand related arrays into a + structure and index on that. However, to be source compatible + with all of the existing md file insn constraints and output + templates, we need `operand' as a flat array. Without that + member, making an array for the rest seems pointless. */ + + /* Gives value of operand N. */ + rtx operand[MAX_RECOG_OPERANDS]; + + /* Gives location where operand N was found. */ + rtx *operand_loc[MAX_RECOG_OPERANDS]; + + /* Gives the constraint string for operand N. */ + const char *constraints[MAX_RECOG_OPERANDS]; + + /* Nonzero if operand N is a match_operator or a match_parallel. */ + char is_operator[MAX_RECOG_OPERANDS]; + + /* Gives the mode of operand N. */ + machine_mode operand_mode[MAX_RECOG_OPERANDS]; + + /* Gives the type (in, out, inout) for operand N. */ + enum op_type operand_type[MAX_RECOG_OPERANDS]; + + /* Gives location where the Nth duplicate-appearance of an operand + was found. This is something that matched MATCH_DUP. */ + rtx *dup_loc[MAX_DUP_OPERANDS]; + + /* Gives the operand number that was duplicated in the Nth + duplicate-appearance of an operand. */ + char dup_num[MAX_DUP_OPERANDS]; + + /* ??? Note that these are `char' instead of `unsigned char' to (try to) + avoid certain lossage from K&R C, wherein `unsigned char' default + promotes to `unsigned int' instead of `int' as in ISO C. As of 1999, + the most common places to bootstrap from K&R C are SunOS and HPUX, + both of which have signed characters by default. The only other + supported natives that have both K&R C and unsigned characters are + ROMP and Irix 3, and neither have been seen for a while, but do + continue to consider unsignedness when performing arithmetic inside + a comparison. */ + + /* The number of operands of the insn. */ + char n_operands; + + /* The number of MATCH_DUPs in the insn. */ + char n_dups; + + /* The number of alternatives in the constraints for the insn. */ + char n_alternatives; + + /* True if insn is ASM_OPERANDS. */ + bool is_asm; + + /* In case we are caching, hold insn data was generated for. */ + rtx_insn *insn; +}; + +extern struct recog_data_d recog_data; + +extern const operand_alternative *recog_op_alt; + +/* Return a pointer to an array in which index OP describes the constraints + on operand OP of the current instruction alternative (which_alternative). + Only valid after calling preprocess_constraints and constrain_operands. */ + +inline static const operand_alternative * +which_op_alt () +{ + gcc_checking_assert (IN_RANGE (which_alternative, 0, + recog_data.n_alternatives - 1)); + return &recog_op_alt[which_alternative * recog_data.n_operands]; +} + +/* A table defined in insn-output.c that give information about + each insn-code value. */ + +typedef int (*insn_operand_predicate_fn) (rtx, machine_mode); +typedef const char * (*insn_output_fn) (rtx *, rtx_insn *); + +struct insn_gen_fn +{ + typedef rtx_insn * (*f0) (void); + typedef rtx_insn * (*f1) (rtx); + typedef rtx_insn * (*f2) (rtx, rtx); + typedef rtx_insn * (*f3) (rtx, rtx, rtx); + typedef rtx_insn * (*f4) (rtx, rtx, rtx, rtx); + typedef rtx_insn * (*f5) (rtx, rtx, rtx, rtx, rtx); + typedef rtx_insn * (*f6) (rtx, rtx, rtx, rtx, rtx, rtx); + typedef rtx_insn * (*f7) (rtx, rtx, rtx, rtx, rtx, rtx, rtx); + typedef rtx_insn * (*f8) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx); + typedef rtx_insn * (*f9) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx); + typedef rtx_insn * (*f10) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx); + typedef rtx_insn * (*f11) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx); + typedef rtx_insn * (*f12) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx); + typedef rtx_insn * (*f13) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx); + typedef rtx_insn * (*f14) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx); + typedef rtx_insn * (*f15) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx); + typedef rtx_insn * (*f16) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx); + + typedef f0 stored_funcptr; + + rtx_insn * operator () (void) const { return ((f0)func) (); } + rtx_insn * operator () (rtx a0) const { return ((f1)func) (a0); } + rtx_insn * operator () (rtx a0, rtx a1) const { return ((f2)func) (a0, a1); } + rtx_insn * operator () (rtx a0, rtx a1, rtx a2) const { return ((f3)func) (a0, a1, a2); } + rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3) const { return ((f4)func) (a0, a1, a2, a3); } + rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4) const { return ((f5)func) (a0, a1, a2, a3, a4); } + rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5) const { return ((f6)func) (a0, a1, a2, a3, a4, a5); } + rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6) const { return ((f7)func) (a0, a1, a2, a3, a4, a5, a6); } + rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7) const { return ((f8)func) (a0, a1, a2, a3, a4, a5, a6, a7); } + rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8) const { return ((f9)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8); } + rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9) const { return ((f10)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); } + rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10) const { return ((f11)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); } + rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10, rtx a11) const { return ((f12)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); } + rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10, rtx a11, rtx a12) const { return ((f13)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); } + rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10, rtx a11, rtx a12, rtx a13) const { return ((f14)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); } + rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10, rtx a11, rtx a12, rtx a13, rtx a14) const { return ((f15)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); } + rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10, rtx a11, rtx a12, rtx a13, rtx a14, rtx a15) const { return ((f16)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); } + + // This is for compatibility of code that invokes functions like + // (*funcptr) (arg) + insn_gen_fn operator * (void) const { return *this; } + + // The wrapped function pointer must be public and there must not be any + // constructors. Otherwise the insn_data_d struct initializers generated + // by genoutput.c will result in static initializer functions, which defeats + // the purpose of the generated insn_data_d array. + stored_funcptr func; +}; + +struct insn_operand_data +{ + const insn_operand_predicate_fn predicate; + + const char *const constraint; + + ENUM_BITFIELD(machine_mode) const mode : 16; + + const char strict_low; + + const char is_operator; + + const char eliminable; + + const char allows_mem; +}; + +/* Legal values for insn_data.output_format. Indicate what type of data + is stored in insn_data.output. */ +#define INSN_OUTPUT_FORMAT_NONE 0 /* abort */ +#define INSN_OUTPUT_FORMAT_SINGLE 1 /* const char * */ +#define INSN_OUTPUT_FORMAT_MULTI 2 /* const char * const * */ +#define INSN_OUTPUT_FORMAT_FUNCTION 3 /* const char * (*)(...) */ + +struct insn_data_d +{ + const char *const name; +#if HAVE_DESIGNATED_UNION_INITIALIZERS + union { + const char *single; + const char *const *multi; + insn_output_fn function; + } output; +#else + struct { + const char *single; + const char *const *multi; + insn_output_fn function; + } output; +#endif + const insn_gen_fn genfun; + const struct insn_operand_data *const operand; + + const char n_generator_args; + const char n_operands; + const char n_dups; + const char n_alternatives; + const char output_format; +}; + +extern const struct insn_data_d insn_data[]; +extern int peep2_current_count; + +#ifndef GENERATOR_FILE +#include "insn-codes.h" + +/* An enum of boolean attributes that may only depend on the current + subtarget, not on things like operands or compiler phase. */ +enum bool_attr { + BA_ENABLED, + BA_PREFERRED_FOR_SPEED, + BA_PREFERRED_FOR_SIZE, + BA_LAST = BA_PREFERRED_FOR_SIZE +}; + +/* Target-dependent globals. */ +struct target_recog { + bool x_initialized; + alternative_mask x_bool_attr_masks[NUM_INSN_CODES][BA_LAST + 1]; + operand_alternative *x_op_alt[NUM_INSN_CODES]; +}; + +extern struct target_recog default_target_recog; +#if SWITCHABLE_TARGET +extern struct target_recog *this_target_recog; +#else +#define this_target_recog (&default_target_recog) +#endif + +alternative_mask get_enabled_alternatives (rtx_insn *); +alternative_mask get_preferred_alternatives (rtx_insn *); +alternative_mask get_preferred_alternatives (rtx_insn *, basic_block); +bool check_bool_attrs (rtx_insn *); + +void recog_init (); +#endif + +#endif /* GCC_RECOG_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/regcprop.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/regcprop.h new file mode 100644 index 0000000..299b315 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/regcprop.h @@ -0,0 +1,25 @@ +/* Copy propagation on hard registers. + Copyright (C) 1989-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_REGCPROP_H +#define GCC_REGCPROP_H + +extern void copyprop_hardreg_forward_bb_without_debug_insn (basic_block bb); + +#endif /* GCC_REGCPROP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/regrename.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/regrename.h new file mode 100644 index 0000000..e249b1f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/regrename.h @@ -0,0 +1,107 @@ +/* This file contains definitions for the register renamer. + Copyright (C) 2011-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_REGRENAME_H +#define GCC_REGRENAME_H + +/* We keep linked lists of DU_HEAD structures, each of which describes + a chain of occurrences of a reg. */ +struct du_head +{ + /* The next chain. */ + struct du_head *next_chain; + /* The first and last elements of this chain. */ + struct du_chain *first, *last; + /* The chain that this chain is tied to. */ + struct du_head *tied_chain; + /* Describes the register being tracked. */ + unsigned regno; + int nregs; + + /* A unique id to be used as an index into the conflicts bitmaps. */ + unsigned id; + /* A bitmap to record conflicts with other chains. */ + bitmap_head conflicts; + /* Conflicts with untracked hard registers. */ + HARD_REG_SET hard_conflicts; + + /* Nonzero if the chain crosses a call. */ + unsigned int need_caller_save_reg:1; + /* Nonzero if the register is used in a way that prevents renaming, + such as the SET_DEST of a CALL_INSN or an asm operand that used + to be a hard register. */ + unsigned int cannot_rename:1; + /* Nonzero if the chain has already been renamed. */ + unsigned int renamed:1; + + /* Fields for use by target code. */ + unsigned int target_data_1; + unsigned int target_data_2; +}; + +typedef struct du_head *du_head_p; + +/* This struct describes a single occurrence of a register. */ +struct du_chain +{ + /* Links to the next occurrence of the register. */ + struct du_chain *next_use; + + /* The insn where the register appears. */ + rtx_insn *insn; + /* The location inside the insn. */ + rtx *loc; + /* The register class required by the insn at this location. */ + ENUM_BITFIELD(reg_class) cl : 16; +}; + +/* This struct describes data gathered during regrename_analyze about + a single operand of an insn. */ +struct operand_rr_info +{ + /* The number of chains recorded for this operand. */ + short n_chains; + bool failed; + /* Holds either the chain for the operand itself, or for the registers in + a memory operand. */ + struct du_chain *chains[MAX_REGS_PER_ADDRESS]; + struct du_head *heads[MAX_REGS_PER_ADDRESS]; +}; + +/* A struct to hold a vector of operand_rr_info structures describing the + operands of an insn. */ +struct insn_rr_info +{ + operand_rr_info *op_info; +}; + + +extern vec insn_rr; + +extern void regrename_init (bool); +extern void regrename_finish (void); +extern void regrename_analyze (bitmap); +extern du_head_p regrename_chain_from_id (unsigned int); +extern int find_rename_reg (du_head_p, enum reg_class, HARD_REG_SET *, int, + bool); +extern bool regrename_do_replace (du_head_p, int); +extern reg_class regrename_find_superclass (du_head_p, int *, + HARD_REG_SET *); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/regs.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/regs.h new file mode 100644 index 0000000..bdaa9ba --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/regs.h @@ -0,0 +1,389 @@ +/* Define per-register tables for data flow info and register allocation. + Copyright (C) 1987-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_REGS_H +#define GCC_REGS_H + +#define REG_BYTES(R) mode_size[(int) GET_MODE (R)] + +/* When you only have the mode of a pseudo register before it has a hard + register chosen for it, this reports the size of each hard register + a pseudo in such a mode would get allocated to. A target may + override this. */ + +#ifndef REGMODE_NATURAL_SIZE +#define REGMODE_NATURAL_SIZE(MODE) UNITS_PER_WORD +#endif + +/* Maximum register number used in this function, plus one. */ + +extern int max_regno; + +/* REG_N_REFS and REG_N_SETS are initialized by a call to + regstat_init_n_sets_and_refs from the current values of + DF_REG_DEF_COUNT and DF_REG_USE_COUNT. REG_N_REFS and REG_N_SETS + should only be used if a pass need to change these values in some + magical way or the pass needs to have accurate values for these + and is not using incremental df scanning. + + At the end of a pass that uses REG_N_REFS and REG_N_SETS, a call + should be made to regstat_free_n_sets_and_refs. + + Local alloc seems to play pretty loose with these values. + REG_N_REFS is set to 0 if the register is used in an asm. + Furthermore, local_alloc calls regclass to hack both REG_N_REFS and + REG_N_SETS for three address insns. Other passes seem to have + other special values. */ + + + +/* Structure to hold values for REG_N_SETS (i) and REG_N_REFS (i). */ + +struct regstat_n_sets_and_refs_t +{ + int sets; /* # of times (REG n) is set */ + int refs; /* # of times (REG n) is used or set */ +}; + +extern struct regstat_n_sets_and_refs_t *regstat_n_sets_and_refs; + +/* Indexed by n, gives number of times (REG n) is used or set. */ +static inline int +REG_N_REFS (int regno) +{ + return regstat_n_sets_and_refs[regno].refs; +} + +/* Indexed by n, gives number of times (REG n) is used or set. */ +#define SET_REG_N_REFS(N,V) (regstat_n_sets_and_refs[N].refs = V) +#define INC_REG_N_REFS(N,V) (regstat_n_sets_and_refs[N].refs += V) + +/* Indexed by n, gives number of times (REG n) is set. */ +static inline int +REG_N_SETS (int regno) +{ + return regstat_n_sets_and_refs[regno].sets; +} + +/* Indexed by n, gives number of times (REG n) is set. */ +#define SET_REG_N_SETS(N,V) (regstat_n_sets_and_refs[N].sets = V) +#define INC_REG_N_SETS(N,V) (regstat_n_sets_and_refs[N].sets += V) + +/* Given a REG, return TRUE if the reg is a PARM_DECL, FALSE otherwise. */ +extern bool reg_is_parm_p (rtx); + +/* Functions defined in regstat.c. */ +extern void regstat_init_n_sets_and_refs (void); +extern void regstat_free_n_sets_and_refs (void); +extern void regstat_compute_ri (void); +extern void regstat_free_ri (void); +extern bitmap regstat_get_setjmp_crosses (void); +extern void regstat_compute_calls_crossed (void); +extern void regstat_free_calls_crossed (void); +extern void dump_reg_info (FILE *); + +/* Register information indexed by register number. This structure is + initialized by calling regstat_compute_ri and is destroyed by + calling regstat_free_ri. */ +struct reg_info_t +{ + int freq; /* # estimated frequency (REG n) is used or set */ + int deaths; /* # of times (REG n) dies */ + int calls_crossed; /* # of calls (REG n) is live across */ + int basic_block; /* # of basic blocks (REG n) is used in */ +}; + +extern struct reg_info_t *reg_info_p; + +/* The number allocated elements of reg_info_p. */ +extern size_t reg_info_p_size; + +/* Estimate frequency of references to register N. */ + +#define REG_FREQ(N) (reg_info_p[N].freq) + +/* The weights for each insn varies from 0 to REG_FREQ_BASE. + This constant does not need to be high, as in infrequently executed + regions we want to count instructions equivalently to optimize for + size instead of speed. */ +#define REG_FREQ_MAX 1000 + +/* Compute register frequency from the BB frequency. When optimizing for size, + or profile driven feedback is available and the function is never executed, + frequency is always equivalent. Otherwise rescale the basic block + frequency. */ +#define REG_FREQ_FROM_BB(bb) (optimize_function_for_size_p (cfun) \ + ? REG_FREQ_MAX \ + : ((bb)->frequency * REG_FREQ_MAX / BB_FREQ_MAX)\ + ? ((bb)->frequency * REG_FREQ_MAX / BB_FREQ_MAX)\ + : 1) + +/* Indexed by N, gives number of insns in which register N dies. + Note that if register N is live around loops, it can die + in transitions between basic blocks, and that is not counted here. + So this is only a reliable indicator of how many regions of life there are + for registers that are contained in one basic block. */ + +#define REG_N_DEATHS(N) (reg_info_p[N].deaths) + +/* Get the number of consecutive words required to hold pseudo-reg N. */ + +#define PSEUDO_REGNO_SIZE(N) \ + ((GET_MODE_SIZE (PSEUDO_REGNO_MODE (N)) + UNITS_PER_WORD - 1) \ + / UNITS_PER_WORD) + +/* Get the number of bytes required to hold pseudo-reg N. */ + +#define PSEUDO_REGNO_BYTES(N) \ + GET_MODE_SIZE (PSEUDO_REGNO_MODE (N)) + +/* Get the machine mode of pseudo-reg N. */ + +#define PSEUDO_REGNO_MODE(N) GET_MODE (regno_reg_rtx[N]) + +/* Indexed by N, gives number of CALL_INSNS across which (REG n) is live. */ + +#define REG_N_CALLS_CROSSED(N) (reg_info_p[N].calls_crossed) + +/* Indexed by n, gives number of basic block that (REG n) is used in. + If the value is REG_BLOCK_GLOBAL (-1), + it means (REG n) is used in more than one basic block. + REG_BLOCK_UNKNOWN (0) means it hasn't been seen yet so we don't know. + This information remains valid for the rest of the compilation + of the current function; it is used to control register allocation. */ + +#define REG_BLOCK_UNKNOWN 0 +#define REG_BLOCK_GLOBAL -1 + +#define REG_BASIC_BLOCK(N) (reg_info_p[N].basic_block) + +/* Vector of substitutions of register numbers, + used to map pseudo regs into hardware regs. + + This can't be folded into reg_n_info without changing all of the + machine dependent directories, since the reload functions + in the machine dependent files access it. */ + +extern short *reg_renumber; + +/* Flag set by local-alloc or global-alloc if they decide to allocate + something in a call-clobbered register. */ + +extern int caller_save_needed; + +/* Select a register mode required for caller save of hard regno REGNO. */ +#ifndef HARD_REGNO_CALLER_SAVE_MODE +#define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \ + choose_hard_reg_mode (REGNO, NREGS, false) +#endif + +/* Registers that get partially clobbered by a call in a given mode. + These must not be call used registers. */ +#ifndef HARD_REGNO_CALL_PART_CLOBBERED +#define HARD_REGNO_CALL_PART_CLOBBERED(REGNO, MODE) 0 +#endif + +/* Target-dependent globals. */ +struct target_regs { + /* For each starting hard register, the number of consecutive hard + registers that a given machine mode occupies. */ + unsigned char x_hard_regno_nregs[FIRST_PSEUDO_REGISTER][MAX_MACHINE_MODE]; + + /* For each hard register, the widest mode object that it can contain. + This will be a MODE_INT mode if the register can hold integers. Otherwise + it will be a MODE_FLOAT or a MODE_CC mode, whichever is valid for the + register. */ + machine_mode x_reg_raw_mode[FIRST_PSEUDO_REGISTER]; + + /* Vector indexed by machine mode saying whether there are regs of + that mode. */ + bool x_have_regs_of_mode[MAX_MACHINE_MODE]; + + /* 1 if the corresponding class contains a register of the given mode. */ + char x_contains_reg_of_mode[N_REG_CLASSES][MAX_MACHINE_MODE]; + + /* 1 if the corresponding class contains a register of the given mode + which is not global and can therefore be allocated. */ + char x_contains_allocatable_reg_of_mode[N_REG_CLASSES][MAX_MACHINE_MODE]; + + /* Record for each mode whether we can move a register directly to or + from an object of that mode in memory. If we can't, we won't try + to use that mode directly when accessing a field of that mode. */ + char x_direct_load[NUM_MACHINE_MODES]; + char x_direct_store[NUM_MACHINE_MODES]; + + /* Record for each mode whether we can float-extend from memory. */ + bool x_float_extend_from_mem[NUM_MACHINE_MODES][NUM_MACHINE_MODES]; +}; + +extern struct target_regs default_target_regs; +#if SWITCHABLE_TARGET +extern struct target_regs *this_target_regs; +#else +#define this_target_regs (&default_target_regs) +#endif + +#define hard_regno_nregs \ + (this_target_regs->x_hard_regno_nregs) +#define reg_raw_mode \ + (this_target_regs->x_reg_raw_mode) +#define have_regs_of_mode \ + (this_target_regs->x_have_regs_of_mode) +#define contains_reg_of_mode \ + (this_target_regs->x_contains_reg_of_mode) +#define contains_allocatable_reg_of_mode \ + (this_target_regs->x_contains_allocatable_reg_of_mode) +#define direct_load \ + (this_target_regs->x_direct_load) +#define direct_store \ + (this_target_regs->x_direct_store) +#define float_extend_from_mem \ + (this_target_regs->x_float_extend_from_mem) + +/* Return an exclusive upper bound on the registers occupied by hard + register (reg:MODE REGNO). */ + +static inline unsigned int +end_hard_regno (machine_mode mode, unsigned int regno) +{ + return regno + hard_regno_nregs[regno][(int) mode]; +} + +/* Add to REGS all the registers required to store a value of mode MODE + in register REGNO. */ + +static inline void +add_to_hard_reg_set (HARD_REG_SET *regs, machine_mode mode, + unsigned int regno) +{ + unsigned int end_regno; + + end_regno = end_hard_regno (mode, regno); + do + SET_HARD_REG_BIT (*regs, regno); + while (++regno < end_regno); +} + +/* Likewise, but remove the registers. */ + +static inline void +remove_from_hard_reg_set (HARD_REG_SET *regs, machine_mode mode, + unsigned int regno) +{ + unsigned int end_regno; + + end_regno = end_hard_regno (mode, regno); + do + CLEAR_HARD_REG_BIT (*regs, regno); + while (++regno < end_regno); +} + +/* Return true if REGS contains the whole of (reg:MODE REGNO). */ + +static inline bool +in_hard_reg_set_p (const HARD_REG_SET regs, machine_mode mode, + unsigned int regno) +{ + unsigned int end_regno; + + gcc_assert (HARD_REGISTER_NUM_P (regno)); + + if (!TEST_HARD_REG_BIT (regs, regno)) + return false; + + end_regno = end_hard_regno (mode, regno); + + if (!HARD_REGISTER_NUM_P (end_regno - 1)) + return false; + + while (++regno < end_regno) + if (!TEST_HARD_REG_BIT (regs, regno)) + return false; + + return true; +} + +/* Return true if (reg:MODE REGNO) includes an element of REGS. */ + +static inline bool +overlaps_hard_reg_set_p (const HARD_REG_SET regs, machine_mode mode, + unsigned int regno) +{ + unsigned int end_regno; + + if (TEST_HARD_REG_BIT (regs, regno)) + return true; + + end_regno = end_hard_regno (mode, regno); + while (++regno < end_regno) + if (TEST_HARD_REG_BIT (regs, regno)) + return true; + + return false; +} + +/* Like add_to_hard_reg_set, but use a REGNO/NREGS range instead of + REGNO and MODE. */ + +static inline void +add_range_to_hard_reg_set (HARD_REG_SET *regs, unsigned int regno, + int nregs) +{ + while (nregs-- > 0) + SET_HARD_REG_BIT (*regs, regno + nregs); +} + +/* Likewise, but remove the registers. */ + +static inline void +remove_range_from_hard_reg_set (HARD_REG_SET *regs, unsigned int regno, + int nregs) +{ + while (nregs-- > 0) + CLEAR_HARD_REG_BIT (*regs, regno + nregs); +} + +/* Like overlaps_hard_reg_set_p, but use a REGNO/NREGS range instead of + REGNO and MODE. */ +static inline bool +range_overlaps_hard_reg_set_p (const HARD_REG_SET set, unsigned regno, + int nregs) +{ + while (nregs-- > 0) + if (TEST_HARD_REG_BIT (set, regno + nregs)) + return true; + return false; +} + +/* Like in_hard_reg_set_p, but use a REGNO/NREGS range instead of + REGNO and MODE. */ +static inline bool +range_in_hard_reg_set_p (const HARD_REG_SET set, unsigned regno, int nregs) +{ + while (nregs-- > 0) + if (!TEST_HARD_REG_BIT (set, regno + nregs)) + return false; + return true; +} + +/* Get registers used by given function call instruction. */ +extern bool get_call_reg_set_usage (rtx_insn *insn, HARD_REG_SET *reg_set, + HARD_REG_SET default_set); + +#endif /* GCC_REGS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/regset.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/regset.h new file mode 100644 index 0000000..4527c84 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/regset.h @@ -0,0 +1,124 @@ +/* Define regsets. + Copyright (C) 1987-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_REGSET_H +#define GCC_REGSET_H + +/* TODO: regset is just a bitmap in its implementation. The compiler does + not consistently use one or the other, i.e. sometimes variables are + declared as bitmap but they are actually regsets and regset accessors + are used, and vice versa, or mixed (see e.g. spilled_regs in IRA). + + This should be cleaned up, either by just dropping the regset type, or + by changing all bitmaps that are really regsets to the regset type. For + the latter option, a good start would be to change everything allocated + on the reg_obstack to regset. */ + + +/* Head of register set linked list. */ +typedef bitmap_head regset_head; + +/* A pointer to a regset_head. */ +typedef bitmap regset; + +/* Allocate a register set with oballoc. */ +#define ALLOC_REG_SET(OBSTACK) BITMAP_ALLOC (OBSTACK) + +/* Do any cleanup needed on a regset when it is no longer used. */ +#define FREE_REG_SET(REGSET) BITMAP_FREE (REGSET) + +/* Initialize a new regset. */ +#define INIT_REG_SET(HEAD) bitmap_initialize (HEAD, ®_obstack) + +/* Clear a register set by freeing up the linked list. */ +#define CLEAR_REG_SET(HEAD) bitmap_clear (HEAD) + +/* Copy a register set to another register set. */ +#define COPY_REG_SET(TO, FROM) bitmap_copy (TO, FROM) + +/* Compare two register sets. */ +#define REG_SET_EQUAL_P(A, B) bitmap_equal_p (A, B) + +/* `and' a register set with a second register set. */ +#define AND_REG_SET(TO, FROM) bitmap_and_into (TO, FROM) + +/* `and' the complement of a register set with a register set. */ +#define AND_COMPL_REG_SET(TO, FROM) bitmap_and_compl_into (TO, FROM) + +/* Inclusive or a register set with a second register set. */ +#define IOR_REG_SET(TO, FROM) bitmap_ior_into (TO, FROM) + +/* Exclusive or a register set with a second register set. */ +#define XOR_REG_SET(TO, FROM) bitmap_xor_into (TO, FROM) + +/* Or into TO the register set FROM1 `and'ed with the complement of FROM2. */ +#define IOR_AND_COMPL_REG_SET(TO, FROM1, FROM2) \ + bitmap_ior_and_compl_into (TO, FROM1, FROM2) + +/* Clear a single register in a register set. */ +#define CLEAR_REGNO_REG_SET(HEAD, REG) bitmap_clear_bit (HEAD, REG) + +/* Set a single register in a register set. */ +#define SET_REGNO_REG_SET(HEAD, REG) bitmap_set_bit (HEAD, REG) + +/* Return true if a register is set in a register set. */ +#define REGNO_REG_SET_P(TO, REG) bitmap_bit_p (TO, REG) + +/* Copy the hard registers in a register set to the hard register set. */ +extern void reg_set_to_hard_reg_set (HARD_REG_SET *, const_bitmap); +#define REG_SET_TO_HARD_REG_SET(TO, FROM) \ +do { \ + CLEAR_HARD_REG_SET (TO); \ + reg_set_to_hard_reg_set (&TO, FROM); \ +} while (0) + +typedef bitmap_iterator reg_set_iterator; + +/* Loop over all registers in REGSET, starting with MIN, setting REGNUM to the + register number and executing CODE for all registers that are set. */ +#define EXECUTE_IF_SET_IN_REG_SET(REGSET, MIN, REGNUM, RSI) \ + EXECUTE_IF_SET_IN_BITMAP (REGSET, MIN, REGNUM, RSI) + +/* Loop over all registers in REGSET1 and REGSET2, starting with MIN, setting + REGNUM to the register number and executing CODE for all registers that are + set in the first regset and not set in the second. */ +#define EXECUTE_IF_AND_COMPL_IN_REG_SET(REGSET1, REGSET2, MIN, REGNUM, RSI) \ + EXECUTE_IF_AND_COMPL_IN_BITMAP (REGSET1, REGSET2, MIN, REGNUM, RSI) + +/* Loop over all registers in REGSET1 and REGSET2, starting with MIN, setting + REGNUM to the register number and executing CODE for all registers that are + set in both regsets. */ +#define EXECUTE_IF_AND_IN_REG_SET(REGSET1, REGSET2, MIN, REGNUM, RSI) \ + EXECUTE_IF_AND_IN_BITMAP (REGSET1, REGSET2, MIN, REGNUM, RSI) \ + +/* Same information as REGS_INVALIDATED_BY_CALL but in regset form to be used + in dataflow more conveniently. */ + +extern regset regs_invalidated_by_call_regset; + +/* Same information as FIXED_REG_SET but in regset form. */ +extern regset fixed_reg_set_regset; + +/* An obstack for regsets. */ +extern bitmap_obstack reg_obstack; + +/* In df-core.c (which should use regset consistently instead of bitmap...) */ +extern void dump_regset (regset, FILE *); + +#endif /* GCC_REGSET_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/reload.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/reload.h new file mode 100644 index 0000000..87e786e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/reload.h @@ -0,0 +1,465 @@ +/* Communication between reload.c, reload1.c and the rest of compiler. + Copyright (C) 1987-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_RELOAD_H +#define GCC_RELOAD_H + +/* If secondary reloads are the same for inputs and outputs, define those + macros here. */ + +#ifdef SECONDARY_RELOAD_CLASS +#define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X) \ + SECONDARY_RELOAD_CLASS (CLASS, MODE, X) +#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, X) \ + SECONDARY_RELOAD_CLASS (CLASS, MODE, X) +#endif + +extern int register_move_cost (machine_mode, reg_class_t, reg_class_t); +extern int memory_move_cost (machine_mode, reg_class_t, bool); +extern int memory_move_secondary_cost (machine_mode, reg_class_t, bool); + +/* Maximum number of reloads we can need. */ +#define MAX_RELOADS (2 * MAX_RECOG_OPERANDS * (MAX_REGS_PER_ADDRESS + 1)) + +/* Encode the usage of a reload. The following codes are supported: + + RELOAD_FOR_INPUT reload of an input operand + RELOAD_FOR_OUTPUT likewise, for output + RELOAD_FOR_INSN a reload that must not conflict with anything + used in the insn, but may conflict with + something used before or after the insn + RELOAD_FOR_INPUT_ADDRESS reload for parts of the address of an object + that is an input reload + RELOAD_FOR_INPADDR_ADDRESS reload needed for RELOAD_FOR_INPUT_ADDRESS + RELOAD_FOR_OUTPUT_ADDRESS like RELOAD_FOR INPUT_ADDRESS, for output + RELOAD_FOR_OUTADDR_ADDRESS reload needed for RELOAD_FOR_OUTPUT_ADDRESS + RELOAD_FOR_OPERAND_ADDRESS reload for the address of a non-reloaded + operand; these don't conflict with + any other addresses. + RELOAD_FOR_OPADDR_ADDR reload needed for RELOAD_FOR_OPERAND_ADDRESS + reloads; usually secondary reloads + RELOAD_OTHER none of the above, usually multiple uses + RELOAD_FOR_OTHER_ADDRESS reload for part of the address of an input + that is marked RELOAD_OTHER. + + This used to be "enum reload_when_needed" but some debuggers have trouble + with an enum tag and variable of the same name. */ + +enum reload_type +{ + RELOAD_FOR_INPUT, RELOAD_FOR_OUTPUT, RELOAD_FOR_INSN, + RELOAD_FOR_INPUT_ADDRESS, RELOAD_FOR_INPADDR_ADDRESS, + RELOAD_FOR_OUTPUT_ADDRESS, RELOAD_FOR_OUTADDR_ADDRESS, + RELOAD_FOR_OPERAND_ADDRESS, RELOAD_FOR_OPADDR_ADDR, + RELOAD_OTHER, RELOAD_FOR_OTHER_ADDRESS +}; + +#ifdef GCC_INSN_CODES_H +/* Each reload is recorded with a structure like this. */ +struct reload +{ + /* The value to reload from */ + rtx in; + /* Where to store reload-reg afterward if nec (often the same as + reload_in) */ + rtx out; + + /* The class of registers to reload into. */ + enum reg_class rclass; + + /* The mode this operand should have when reloaded, on input. */ + machine_mode inmode; + /* The mode this operand should have when reloaded, on output. */ + machine_mode outmode; + + /* The mode of the reload register. */ + machine_mode mode; + + /* the largest number of registers this reload will require. */ + unsigned int nregs; + + /* Positive amount to increment or decrement by if + reload_in is a PRE_DEC, PRE_INC, POST_DEC, POST_INC. + Ignored otherwise (don't assume it is zero). */ + int inc; + /* A reg for which reload_in is the equivalent. + If reload_in is a symbol_ref which came from + reg_equiv_constant, then this is the pseudo + which has that symbol_ref as equivalent. */ + rtx in_reg; + rtx out_reg; + + /* Used in find_reload_regs to record the allocated register. */ + int regno; + /* This is the register to reload into. If it is zero when `find_reloads' + returns, you must find a suitable register in the class specified by + reload_reg_class, and store here an rtx for that register with mode from + reload_inmode or reload_outmode. */ + rtx reg_rtx; + /* The operand number being reloaded. This is used to group related reloads + and need not always be equal to the actual operand number in the insn, + though it current will be; for in-out operands, it is one of the two + operand numbers. */ + int opnum; + + /* Gives the reload number of a secondary input reload, when needed; + otherwise -1. */ + int secondary_in_reload; + /* Gives the reload number of a secondary output reload, when needed; + otherwise -1. */ + int secondary_out_reload; + /* If a secondary input reload is required, gives the INSN_CODE that uses the + secondary reload as a scratch register, or CODE_FOR_nothing if the + secondary reload register is to be an intermediate register. */ + enum insn_code secondary_in_icode; + /* Likewise, for a secondary output reload. */ + enum insn_code secondary_out_icode; + + /* Classifies reload as needed either for addressing an input reload, + addressing an output, for addressing a non-reloaded mem ref, or for + unspecified purposes (i.e., more than one of the above). */ + enum reload_type when_needed; + + /* Nonzero for an optional reload. Optional reloads are ignored unless the + value is already sitting in a register. */ + unsigned int optional:1; + /* nonzero if this reload shouldn't be combined with another reload. */ + unsigned int nocombine:1; + /* Nonzero if this is a secondary register for one or more reloads. */ + unsigned int secondary_p:1; + /* Nonzero if this reload must use a register not already allocated to a + group. */ + unsigned int nongroup:1; +}; + +extern struct reload rld[MAX_RELOADS]; +extern int n_reloads; +#endif + +/* Target-dependent globals. */ +struct target_reload { + /* Nonzero if indirect addressing is supported when the innermost MEM is + of the form (MEM (SYMBOL_REF sym)). It is assumed that the level to + which these are valid is the same as spill_indirect_levels, above. */ + bool x_indirect_symref_ok; + + /* Nonzero if indirect addressing is supported on the machine; this means + that spilling (REG n) does not require reloading it into a register in + order to do (MEM (REG n)) or (MEM (PLUS (REG n) (CONST_INT c))). The + value indicates the level of indirect addressing supported, e.g., two + means that (MEM (MEM (REG n))) is also valid if (REG n) does not get + a hard register. */ + unsigned char x_spill_indirect_levels; + + /* True if caller-save has been reinitialized. */ + bool x_caller_save_initialized_p; + + /* Modes for each hard register that we can save. The smallest mode is wide + enough to save the entire contents of the register. When saving the + register because it is live we first try to save in multi-register modes. + If that is not possible the save is done one register at a time. */ + machine_mode (x_regno_save_mode + [FIRST_PSEUDO_REGISTER] + [MAX_MOVE_MAX / MIN_UNITS_PER_WORD + 1]); + + /* Nonzero if an address (plus (reg frame_pointer) (reg ...)) is valid + in the given mode. */ + bool x_double_reg_address_ok[MAX_MACHINE_MODE]; + + /* We will only make a register eligible for caller-save if it can be + saved in its widest mode with a simple SET insn as long as the memory + address is valid. We record the INSN_CODE is those insns here since + when we emit them, the addresses might not be valid, so they might not + be recognized. */ + int x_cached_reg_save_code[FIRST_PSEUDO_REGISTER][MAX_MACHINE_MODE]; + int x_cached_reg_restore_code[FIRST_PSEUDO_REGISTER][MAX_MACHINE_MODE]; +}; + +extern struct target_reload default_target_reload; +#if SWITCHABLE_TARGET +extern struct target_reload *this_target_reload; +#else +#define this_target_reload (&default_target_reload) +#endif + +#define indirect_symref_ok \ + (this_target_reload->x_indirect_symref_ok) +#define double_reg_address_ok \ + (this_target_reload->x_double_reg_address_ok) +#define caller_save_initialized_p \ + (this_target_reload->x_caller_save_initialized_p) + +/* Register equivalences. Indexed by register number. */ +struct reg_equivs_t +{ + /* The constant value to which pseudo reg N is equivalent, + or zero if pseudo reg N is not equivalent to a constant. + find_reloads looks at this in order to replace pseudo reg N + with the constant it stands for. */ + rtx constant; + + /* An invariant value to which pseudo reg N is equivalent. + eliminate_regs_in_insn uses this to replace pseudos in particular + contexts. */ + rtx invariant; + + /* A memory location to which pseudo reg N is equivalent, + prior to any register elimination (such as frame pointer to stack + pointer). Depending on whether or not it is a valid address, this value + is transferred to either equiv_address or equiv_mem. */ + rtx memory_loc; + + /* The address of stack slot to which pseudo reg N is equivalent. + This is used when the address is not valid as a memory address + (because its displacement is too big for the machine.) */ + rtx address; + + /* The memory slot to which pseudo reg N is equivalent, + or zero if pseudo reg N is not equivalent to a memory slot. */ + rtx mem; + + /* An EXPR_LIST of REG_EQUIVs containing MEMs with + alternate representations of the location of pseudo reg N. */ + rtx_expr_list *alt_mem_list; + + /* The list of insns that initialized reg N from its equivalent + constant or memory slot. */ + rtx_insn_list *init; +}; + +#define reg_equiv_constant(ELT) \ + (*reg_equivs)[(ELT)].constant +#define reg_equiv_invariant(ELT) \ + (*reg_equivs)[(ELT)].invariant +#define reg_equiv_memory_loc(ELT) \ + (*reg_equivs)[(ELT)].memory_loc +#define reg_equiv_address(ELT) \ + (*reg_equivs)[(ELT)].address +#define reg_equiv_mem(ELT) \ + (*reg_equivs)[(ELT)].mem +#define reg_equiv_alt_mem_list(ELT) \ + (*reg_equivs)[(ELT)].alt_mem_list +#define reg_equiv_init(ELT) \ + (*reg_equivs)[(ELT)].init + +extern vec *reg_equivs; + +/* All the "earlyclobber" operands of the current insn + are recorded here. */ +extern int n_earlyclobbers; +extern rtx reload_earlyclobbers[MAX_RECOG_OPERANDS]; + +/* Save the number of operands. */ +extern int reload_n_operands; + +/* First uid used by insns created by reload in this function. + Used in find_equiv_reg. */ +extern int reload_first_uid; + +extern int num_not_at_initial_offset; + +#if defined SET_HARD_REG_BIT && defined CLEAR_REG_SET +/* This structure describes instructions which are relevant for reload. + Apart from all regular insns, this also includes CODE_LABELs, since they + must be examined for register elimination. */ +struct insn_chain +{ + /* Links to the neighbor instructions. */ + struct insn_chain *next, *prev; + + /* Link through a chains set up by calculate_needs_all_insns, containing + all insns that need reloading. */ + struct insn_chain *next_need_reload; + + /* The rtx of the insn. */ + rtx_insn *insn; + + /* The basic block this insn is in. */ + int block; + + /* Nonzero if find_reloads said the insn requires reloading. */ + unsigned int need_reload:1; + /* Nonzero if find_reloads needs to be run during reload_as_needed to + perform modifications on any operands. */ + unsigned int need_operand_change:1; + /* Nonzero if eliminate_regs_in_insn said it requires eliminations. */ + unsigned int need_elim:1; + /* Nonzero if this insn was inserted by perform_caller_saves. */ + unsigned int is_caller_save_insn:1; + + /* Register life information: record all live hard registers, and + all live pseudos that have a hard register. This set also + contains pseudos spilled by IRA. */ + bitmap_head live_throughout; + bitmap_head dead_or_set; + + /* Copies of the global variables computed by find_reloads. */ + struct reload *rld; + int n_reloads; + + /* Indicates which registers have already been used for spills. */ + HARD_REG_SET used_spill_regs; +}; + +/* A chain of insn_chain structures to describe all non-note insns in + a function. */ +extern struct insn_chain *reload_insn_chain; + +/* Allocate a new insn_chain structure. */ +extern struct insn_chain *new_insn_chain (void); +#endif + +#if defined SET_HARD_REG_BIT +extern void compute_use_by_pseudos (HARD_REG_SET *, bitmap); +#endif + +/* Functions from reload.c: */ + +extern reg_class_t secondary_reload_class (bool, reg_class_t, + machine_mode, rtx); + +#ifdef GCC_INSN_CODES_H +extern enum reg_class scratch_reload_class (enum insn_code); +#endif + +/* Return a memory location that will be used to copy X in mode MODE. + If we haven't already made a location for this mode in this insn, + call find_reloads_address on the location being returned. */ +extern rtx get_secondary_mem (rtx, machine_mode, int, enum reload_type); + +/* Clear any secondary memory locations we've made. */ +extern void clear_secondary_mem (void); + +/* Transfer all replacements that used to be in reload FROM to be in + reload TO. */ +extern void transfer_replacements (int, int); + +/* IN_RTX is the value loaded by a reload that we now decided to inherit, + or a subpart of it. If we have any replacements registered for IN_RTX, + cancel the reloads that were supposed to load them. + Return nonzero if we canceled any reloads. */ +extern int remove_address_replacements (rtx in_rtx); + +/* Like rtx_equal_p except that it allows a REG and a SUBREG to match + if they are the same hard reg, and has special hacks for + autoincrement and autodecrement. */ +extern int operands_match_p (rtx, rtx); + +/* Return 1 if altering OP will not modify the value of CLOBBER. */ +extern int safe_from_earlyclobber (rtx, rtx); + +/* Search the body of INSN for values that need reloading and record them + with push_reload. REPLACE nonzero means record also where the values occur + so that subst_reloads can be used. */ +extern int find_reloads (rtx_insn *, int, int, int, short *); + +/* Compute the sum of X and Y, making canonicalizations assumed in an + address, namely: sum constant integers, surround the sum of two + constants with a CONST, put the constant as the second operand, and + group the constant on the outermost sum. */ +extern rtx form_sum (machine_mode, rtx, rtx); + +/* Substitute into the current INSN the registers into which we have reloaded + the things that need reloading. */ +extern void subst_reloads (rtx_insn *); + +/* Make a copy of any replacements being done into X and move those copies + to locations in Y, a copy of X. We only look at the highest level of + the RTL. */ +extern void copy_replacements (rtx, rtx); + +/* Change any replacements being done to *X to be done to *Y */ +extern void move_replacements (rtx *x, rtx *y); + +/* If LOC was scheduled to be replaced by something, return the replacement. + Otherwise, return *LOC. */ +extern rtx find_replacement (rtx *); + +/* Nonzero if modifying X will affect IN. */ +extern int reg_overlap_mentioned_for_reload_p (rtx, rtx); + +/* Check the insns before INSN to see if there is a suitable register + containing the same value as GOAL. */ +extern rtx find_equiv_reg (rtx, rtx_insn *, enum reg_class, int, short *, + int, machine_mode); + +/* Return 1 if register REGNO is the subject of a clobber in insn INSN. */ +extern int regno_clobbered_p (unsigned int, rtx_insn *, machine_mode, int); + +/* Return 1 if X is an operand of an insn that is being earlyclobbered. */ +extern int earlyclobber_operand_p (rtx); + +/* Record one reload that needs to be performed. */ +extern int push_reload (rtx, rtx, rtx *, rtx *, enum reg_class, + machine_mode, machine_mode, + int, int, int, enum reload_type); + +/* Functions in reload1.c: */ + +/* Initialize the reload pass once per compilation. */ +extern void init_reload (void); + +/* The reload pass itself. */ +extern bool reload (rtx_insn *, int); + +/* Mark the slots in regs_ever_live for the hard regs + used by pseudo-reg number REGNO. */ +extern void mark_home_live (int); + +/* Scan X and replace any eliminable registers (such as fp) with a + replacement (such as sp), plus an offset. */ +extern rtx eliminate_regs (rtx, machine_mode, rtx); +extern bool elimination_target_reg_p (rtx); + +/* Called from the register allocator to estimate costs of eliminating + invariant registers. */ +extern void calculate_elim_costs_all_insns (void); + +/* Deallocate the reload register used by reload number R. */ +extern void deallocate_reload_reg (int r); + +/* Functions in caller-save.c: */ + +/* Initialize for caller-save. */ +extern void init_caller_save (void); + +/* Initialize save areas by showing that we haven't allocated any yet. */ +extern void init_save_areas (void); + +/* Allocate save areas for any hard registers that might need saving. */ +extern void setup_save_areas (void); + +/* Find the places where hard regs are live across calls and save them. */ +extern void save_call_clobbered_regs (void); + +/* Replace (subreg (reg)) with the appropriate (reg) for any operands. */ +extern void cleanup_subreg_operands (rtx_insn *); + +/* Debugging support. */ +extern void debug_reload_to_stream (FILE *); +extern void debug_reload (void); + +/* Compute the actual register we should reload to, in case we're + reloading to/from a register that is wider than a word. */ +extern rtx reload_adjust_reg_for_mode (rtx, machine_mode); + +/* Allocate or grow the reg_equiv tables, initializing new entries to 0. */ +extern void grow_reg_equivs (void); + +#endif /* GCC_RELOAD_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/resource.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/resource.h new file mode 100644 index 0000000..0941deb --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/resource.h @@ -0,0 +1,54 @@ +/* Definitions for computing resource usage of specific insns. + Copyright (C) 1999-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_RESOURCE_H +#define GCC_RESOURCE_H + +/* Macro to clear all resources. */ +#define CLEAR_RESOURCE(RES) \ + do { (RES)->memory = (RES)->volatil = (RES)->cc = 0; \ + CLEAR_HARD_REG_SET ((RES)->regs); } while (0) + +/* The resources used by a given insn. */ +struct resources +{ + char memory; /* Insn sets or needs a memory location. */ + char volatil; /* Insn sets or needs a volatile memory loc. */ + char cc; /* Insn sets or needs the condition codes. */ + HARD_REG_SET regs; /* Which registers are set or needed. */ +}; + +/* The kinds of rtl mark_*_resources will consider */ +enum mark_resource_type +{ + MARK_SRC_DEST = 0, + MARK_SRC_DEST_CALL = 1 +}; + +extern void mark_target_live_regs (rtx_insn *, rtx, struct resources *); +extern void mark_set_resources (rtx, struct resources *, int, + enum mark_resource_type); +extern void mark_referenced_resources (rtx, struct resources *, bool); +extern void clear_hashed_info_for_insn (rtx_insn *); +extern void incr_ticks_for_insn (rtx_insn *); +extern void mark_end_of_function_resources (rtx, bool); +extern void init_resource_info (rtx_insn *); +extern void free_resource_info (void); + +#endif /* GCC_RESOURCE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtl-chkp.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtl-chkp.h new file mode 100644 index 0000000..06ffbfc --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtl-chkp.h @@ -0,0 +1,38 @@ +/* Declaration of interface functions of Pointer Bounds Checker. + Copyright (C) 2014-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_RTL_CHKP_H +#define GCC_RTL_CHKP_H + +#define DECL_BOUNDS_RTL(NODE) (chkp_get_rtl_bounds (DECL_WRTL_CHECK (NODE))) + +#define SET_DECL_BOUNDS_RTL(NODE, VAL) \ + (chkp_set_rtl_bounds (DECL_WRTL_CHECK (NODE), VAL)) + +extern rtx chkp_get_rtl_bounds (tree node); +extern void chkp_set_rtl_bounds (tree node, rtx val); +extern void chkp_reset_rtl_bounds (); +extern void chkp_split_slot (rtx slot, rtx *slot_val, rtx *slot_bnd); +extern rtx chkp_join_splitted_slot (rtx val, rtx bnd); +extern rtx chkp_get_value_with_offs (rtx par, rtx offs); +extern void chkp_copy_bounds_for_stack_parm (rtx slot, rtx value, tree type); +extern void chkp_emit_bounds_store (rtx bounds, rtx value, rtx mem); +extern void chkp_put_regs_to_expr_list (rtx par); + +#endif /* GCC_RTL_CHKP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtl-error.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtl-error.h new file mode 100644 index 0000000..14872e4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtl-error.h @@ -0,0 +1,31 @@ +/* RTL specific diagnostic subroutines for GCC + Copyright (C) 2010-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_RTL_ERROR_H +#define GCC_RTL_ERROR_H + +#include "rtl.h" +#include "diagnostic-core.h" + +extern void error_for_asm (const rtx_insn *, const char *, + ...) ATTRIBUTE_GCC_DIAG(2,3); +extern void warning_for_asm (const rtx_insn *, const char *, + ...) ATTRIBUTE_GCC_DIAG(2,3); + +#endif /* GCC_RTL_ERROR_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtl-iter.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtl-iter.h new file mode 100644 index 0000000..02f15cf --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtl-iter.h @@ -0,0 +1,291 @@ +/* RTL iterators + Copyright (C) 2014-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* This structure describes the subrtxes of an rtx as follows: + + - if the rtx has no subrtxes, START and COUNT are both 0. + + - if all the subrtxes of an rtx are stored in a contiguous block + of XEXPs ("e"s), START is the index of the first XEXP and COUNT + is the number of them. + + - otherwise START is arbitrary and COUNT is UCHAR_MAX. + + rtx_all_subrtx_bounds applies to all codes. rtx_nonconst_subrtx_bounds + is like rtx_all_subrtx_bounds except that all constant rtxes are treated + as having no subrtxes. */ +struct rtx_subrtx_bound_info { + unsigned char start; + unsigned char count; +}; +extern rtx_subrtx_bound_info rtx_all_subrtx_bounds[]; +extern rtx_subrtx_bound_info rtx_nonconst_subrtx_bounds[]; + +/* Return true if CODE has no subrtxes. */ + +static inline bool +leaf_code_p (enum rtx_code code) +{ + return rtx_all_subrtx_bounds[code].count == 0; +} + +/* Used to iterate over subrtxes of an rtx. T abstracts the type of + access. */ +template +class generic_subrtx_iterator +{ + static const size_t LOCAL_ELEMS = 16; + typedef typename T::value_type value_type; + typedef typename T::rtx_type rtx_type; + typedef typename T::rtunion_type rtunion_type; + +public: + struct array_type + { + array_type (); + ~array_type (); + value_type stack[LOCAL_ELEMS]; + vec *heap; + }; + generic_subrtx_iterator (array_type &, value_type, + const rtx_subrtx_bound_info *); + + value_type operator * () const; + bool at_end () const; + void next (); + void skip_subrtxes (); + void substitute (value_type); + +private: + /* The bounds to use for iterating over subrtxes. */ + const rtx_subrtx_bound_info *m_bounds; + + /* The storage used for the worklist. */ + array_type &m_array; + + /* The current rtx. */ + value_type m_current; + + /* The base of the current worklist. */ + value_type *m_base; + + /* The number of subrtxes in M_BASE. */ + size_t m_end; + + /* The following booleans shouldn't end up in registers or memory + but just direct control flow. */ + + /* True if the iteration is over. */ + bool m_done; + + /* True if we should skip the subrtxes of M_CURRENT. */ + bool m_skip; + + /* True if M_CURRENT has been replaced with a different rtx. */ + bool m_substitute; + + static void free_array (array_type &); + static size_t add_subrtxes_to_queue (array_type &, value_type *, size_t, + rtx_type); + static value_type *add_single_to_queue (array_type &, value_type *, size_t, + value_type); +}; + +template +inline generic_subrtx_iterator ::array_type::array_type () : heap (0) {} + +template +inline generic_subrtx_iterator ::array_type::~array_type () +{ + if (__builtin_expect (heap != 0, false)) + free_array (*this); +} + +/* Iterate over X and its subrtxes, in arbitrary order. Use ARRAY to + store the worklist. We use an external array in order to avoid + capturing the fields of this structure when taking the address of + the array. Use BOUNDS to find the bounds of simple "e"-string codes. */ + +template +inline generic_subrtx_iterator :: +generic_subrtx_iterator (array_type &array, value_type x, + const rtx_subrtx_bound_info *bounds) + : m_bounds (bounds), + m_array (array), + m_current (x), + m_base (m_array.stack), + m_end (0), + m_done (false), + m_skip (false), + m_substitute (false) +{ +} + +/* Return the current subrtx. */ + +template +inline typename T::value_type +generic_subrtx_iterator ::operator * () const +{ + return m_current; +} + +/* Return true if the iteration has finished. */ + +template +inline bool +generic_subrtx_iterator ::at_end () const +{ + return m_done; +} + +/* Move on to the next subrtx. */ + +template +inline void +generic_subrtx_iterator ::next () +{ + if (m_substitute) + { + m_substitute = false; + m_skip = false; + return; + } + if (!m_skip) + { + /* Add the subrtxes of M_CURRENT. */ + rtx_type x = T::get_rtx (m_current); + if (__builtin_expect (x != 0, true)) + { + enum rtx_code code = GET_CODE (x); + ssize_t count = m_bounds[code].count; + if (count > 0) + { + /* Handle the simple case of a single "e" block that is known + to fit into the current array. */ + if (__builtin_expect (m_end + count <= LOCAL_ELEMS + 1, true)) + { + /* Set M_CURRENT to the first subrtx and queue the rest. */ + ssize_t start = m_bounds[code].start; + rtunion_type *src = &x->u.fld[start]; + if (__builtin_expect (count > 2, false)) + m_base[m_end++] = T::get_value (src[2].rt_rtx); + if (count > 1) + m_base[m_end++] = T::get_value (src[1].rt_rtx); + m_current = T::get_value (src[0].rt_rtx); + return; + } + /* Handle cases which aren't simple "e" sequences or where + the sequence might overrun M_BASE. */ + count = add_subrtxes_to_queue (m_array, m_base, m_end, x); + if (count > 0) + { + m_end += count; + if (m_end > LOCAL_ELEMS) + m_base = m_array.heap->address (); + m_current = m_base[--m_end]; + return; + } + } + } + } + else + m_skip = false; + if (m_end == 0) + m_done = true; + else + m_current = m_base[--m_end]; +} + +/* Skip the subrtxes of the current rtx. */ + +template +inline void +generic_subrtx_iterator ::skip_subrtxes () +{ + m_skip = true; +} + +/* Ignore the subrtxes of the current rtx and look at X instead. */ + +template +inline void +generic_subrtx_iterator ::substitute (value_type x) +{ + m_substitute = true; + m_current = x; +} + +/* Iterators for const_rtx. */ +struct const_rtx_accessor +{ + typedef const_rtx value_type; + typedef const_rtx rtx_type; + typedef const rtunion rtunion_type; + static rtx_type get_rtx (value_type x) { return x; } + static value_type get_value (rtx_type x) { return x; } +}; +typedef generic_subrtx_iterator subrtx_iterator; + +/* Iterators for non-constant rtx. */ +struct rtx_var_accessor +{ + typedef rtx value_type; + typedef rtx rtx_type; + typedef rtunion rtunion_type; + static rtx_type get_rtx (value_type x) { return x; } + static value_type get_value (rtx_type x) { return x; } +}; +typedef generic_subrtx_iterator subrtx_var_iterator; + +/* Iterators for rtx *. */ +struct rtx_ptr_accessor +{ + typedef rtx *value_type; + typedef rtx rtx_type; + typedef rtunion rtunion_type; + static rtx_type get_rtx (value_type ptr) { return *ptr; } + static value_type get_value (rtx_type &x) { return &x; } +}; +typedef generic_subrtx_iterator subrtx_ptr_iterator; + +#define ALL_BOUNDS rtx_all_subrtx_bounds +#define NONCONST_BOUNDS rtx_nonconst_subrtx_bounds + +/* Use ITER to iterate over const_rtx X and its recursive subrtxes, + using subrtx_iterator::array ARRAY as the storage for the worklist. + ARRAY can be reused for multiple consecutive iterations but shouldn't + be shared by two concurrent iterations. TYPE is ALL if all subrtxes + are of interest or NONCONST if it is safe to ignore subrtxes of + constants. */ +#define FOR_EACH_SUBRTX(ITER, ARRAY, X, TYPE) \ + for (subrtx_iterator ITER (ARRAY, X, TYPE##_BOUNDS); !ITER.at_end (); \ + ITER.next ()) + +/* Like FOR_EACH_SUBRTX, but iterate over subrtxes of an rtx X. */ +#define FOR_EACH_SUBRTX_VAR(ITER, ARRAY, X, TYPE) \ + for (subrtx_var_iterator ITER (ARRAY, X, TYPE##_BOUNDS); !ITER.at_end (); \ + ITER.next ()) + +/* Like FOR_EACH_SUBRTX, but iterate over subrtx pointers of rtx pointer X. + For example, if X is &PATTERN (insn) and the pattern is a SET, iterate + over &PATTERN (insn), &SET_DEST (PATTERN (insn)), etc. */ +#define FOR_EACH_SUBRTX_PTR(ITER, ARRAY, X, TYPE) \ + for (subrtx_ptr_iterator ITER (ARRAY, X, TYPE##_BOUNDS); !ITER.at_end (); \ + ITER.next ()) diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtl.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtl.h new file mode 100644 index 0000000..9333042 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtl.h @@ -0,0 +1,3840 @@ +/* Register Transfer Language (RTL) definitions for GCC + Copyright (C) 1987-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_RTL_H +#define GCC_RTL_H + +/* This file is occasionally included by generator files which expect + machmode.h and other files to exist and would not normally have been + included by coretypes.h. */ +#ifdef GENERATOR_FILE +#include "machmode.h" +#include "signop.h" +#include "wide-int.h" +#include "double-int.h" +#include "real.h" +#include "fixed-value.h" +#include "statistics.h" +#include "vec.h" +#include "hash-table.h" +#include "hash-set.h" +#include "input.h" +#include "is-a.h" +#endif /* GENERATOR_FILE */ + +#include "hard-reg-set.h" + +/* Value used by some passes to "recognize" noop moves as valid + instructions. */ +#define NOOP_MOVE_INSN_CODE INT_MAX + +/* Register Transfer Language EXPRESSIONS CODES */ + +#define RTX_CODE enum rtx_code +enum rtx_code { + +#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) ENUM , +#include "rtl.def" /* rtl expressions are documented here */ +#undef DEF_RTL_EXPR + + LAST_AND_UNUSED_RTX_CODE}; /* A convenient way to get a value for + NUM_RTX_CODE. + Assumes default enum value assignment. */ + +/* The cast here, saves many elsewhere. */ +#define NUM_RTX_CODE ((int) LAST_AND_UNUSED_RTX_CODE) + +/* Similar, but since generator files get more entries... */ +#ifdef GENERATOR_FILE +# define NON_GENERATOR_NUM_RTX_CODE ((int) MATCH_OPERAND) +#endif + +/* Register Transfer Language EXPRESSIONS CODE CLASSES */ + +enum rtx_class { + /* We check bit 0-1 of some rtx class codes in the predicates below. */ + + /* Bit 0 = comparison if 0, arithmetic is 1 + Bit 1 = 1 if commutative. */ + RTX_COMPARE, /* 0 */ + RTX_COMM_COMPARE, + RTX_BIN_ARITH, + RTX_COMM_ARITH, + + /* Must follow the four preceding values. */ + RTX_UNARY, /* 4 */ + + RTX_EXTRA, + RTX_MATCH, + RTX_INSN, + + /* Bit 0 = 1 if constant. */ + RTX_OBJ, /* 8 */ + RTX_CONST_OBJ, + + RTX_TERNARY, + RTX_BITFIELD_OPS, + RTX_AUTOINC +}; + +#define RTX_OBJ_MASK (~1) +#define RTX_OBJ_RESULT (RTX_OBJ & RTX_OBJ_MASK) +#define RTX_COMPARE_MASK (~1) +#define RTX_COMPARE_RESULT (RTX_COMPARE & RTX_COMPARE_MASK) +#define RTX_ARITHMETIC_MASK (~1) +#define RTX_ARITHMETIC_RESULT (RTX_COMM_ARITH & RTX_ARITHMETIC_MASK) +#define RTX_BINARY_MASK (~3) +#define RTX_BINARY_RESULT (RTX_COMPARE & RTX_BINARY_MASK) +#define RTX_COMMUTATIVE_MASK (~2) +#define RTX_COMMUTATIVE_RESULT (RTX_COMM_COMPARE & RTX_COMMUTATIVE_MASK) +#define RTX_NON_COMMUTATIVE_RESULT (RTX_COMPARE & RTX_COMMUTATIVE_MASK) + +extern const unsigned char rtx_length[NUM_RTX_CODE]; +#define GET_RTX_LENGTH(CODE) (rtx_length[(int) (CODE)]) + +extern const char * const rtx_name[NUM_RTX_CODE]; +#define GET_RTX_NAME(CODE) (rtx_name[(int) (CODE)]) + +extern const char * const rtx_format[NUM_RTX_CODE]; +#define GET_RTX_FORMAT(CODE) (rtx_format[(int) (CODE)]) + +extern const enum rtx_class rtx_class[NUM_RTX_CODE]; +#define GET_RTX_CLASS(CODE) (rtx_class[(int) (CODE)]) + +/* True if CODE is part of the insn chain (i.e. has INSN_UID, PREV_INSN + and NEXT_INSN fields). */ +#define INSN_CHAIN_CODE_P(CODE) IN_RANGE (CODE, DEBUG_INSN, NOTE) + +extern const unsigned char rtx_code_size[NUM_RTX_CODE]; +extern const unsigned char rtx_next[NUM_RTX_CODE]; + +/* The flags and bitfields of an ADDR_DIFF_VEC. BASE is the base label + relative to which the offsets are calculated, as explained in rtl.def. */ +struct addr_diff_vec_flags +{ + /* Set at the start of shorten_branches - ONLY WHEN OPTIMIZING - : */ + unsigned min_align: 8; + /* Flags: */ + unsigned base_after_vec: 1; /* BASE is after the ADDR_DIFF_VEC. */ + unsigned min_after_vec: 1; /* minimum address target label is + after the ADDR_DIFF_VEC. */ + unsigned max_after_vec: 1; /* maximum address target label is + after the ADDR_DIFF_VEC. */ + unsigned min_after_base: 1; /* minimum address target label is + after BASE. */ + unsigned max_after_base: 1; /* maximum address target label is + after BASE. */ + /* Set by the actual branch shortening process - ONLY WHEN OPTIMIZING - : */ + unsigned offset_unsigned: 1; /* offsets have to be treated as unsigned. */ + unsigned : 2; + unsigned scale : 8; +}; + +/* Structure used to describe the attributes of a MEM. These are hashed + so MEMs that the same attributes share a data structure. This means + they cannot be modified in place. */ +struct GTY(()) mem_attrs +{ + /* The expression that the MEM accesses, or null if not known. + This expression might be larger than the memory reference itself. + (In other words, the MEM might access only part of the object.) */ + tree expr; + + /* The offset of the memory reference from the start of EXPR. + Only valid if OFFSET_KNOWN_P. */ + HOST_WIDE_INT offset; + + /* The size of the memory reference in bytes. Only valid if + SIZE_KNOWN_P. */ + HOST_WIDE_INT size; + + /* The alias set of the memory reference. */ + alias_set_type alias; + + /* The alignment of the reference in bits. Always a multiple of + BITS_PER_UNIT. Note that EXPR may have a stricter alignment + than the memory reference itself. */ + unsigned int align; + + /* The address space that the memory reference uses. */ + unsigned char addrspace; + + /* True if OFFSET is known. */ + bool offset_known_p; + + /* True if SIZE is known. */ + bool size_known_p; +}; + +/* Structure used to describe the attributes of a REG in similar way as + mem_attrs does for MEM above. Note that the OFFSET field is calculated + in the same way as for mem_attrs, rather than in the same way as a + SUBREG_BYTE. For example, if a big-endian target stores a byte + object in the low part of a 4-byte register, the OFFSET field + will be -3 rather than 0. */ + +struct GTY((for_user)) reg_attrs { + tree decl; /* decl corresponding to REG. */ + HOST_WIDE_INT offset; /* Offset from start of DECL. */ +}; + +/* Common union for an element of an rtx. */ + +union rtunion +{ + int rt_int; + unsigned int rt_uint; + const char *rt_str; + rtx rt_rtx; + rtvec rt_rtvec; + machine_mode rt_type; + addr_diff_vec_flags rt_addr_diff_vec_flags; + struct cselib_val *rt_cselib; + tree rt_tree; + basic_block rt_bb; + mem_attrs *rt_mem; + struct constant_descriptor_rtx *rt_constant; + struct dw_cfi_node *rt_cfi; +}; + +/* Describes the properties of a REG. */ +struct GTY(()) reg_info { + /* The value of REGNO. */ + unsigned int regno; + + /* The value of REG_NREGS. */ + unsigned int nregs : 8; + unsigned int unused : 24; + + /* The value of REG_ATTRS. */ + reg_attrs *attrs; +}; + +/* This structure remembers the position of a SYMBOL_REF within an + object_block structure. A SYMBOL_REF only provides this information + if SYMBOL_REF_HAS_BLOCK_INFO_P is true. */ +struct GTY(()) block_symbol { + /* The usual SYMBOL_REF fields. */ + rtunion GTY ((skip)) fld[2]; + + /* The block that contains this object. */ + struct object_block *block; + + /* The offset of this object from the start of its block. It is negative + if the symbol has not yet been assigned an offset. */ + HOST_WIDE_INT offset; +}; + +/* Describes a group of objects that are to be placed together in such + a way that their relative positions are known. */ +struct GTY((for_user)) object_block { + /* The section in which these objects should be placed. */ + section *sect; + + /* The alignment of the first object, measured in bits. */ + unsigned int alignment; + + /* The total size of the objects, measured in bytes. */ + HOST_WIDE_INT size; + + /* The SYMBOL_REFs for each object. The vector is sorted in + order of increasing offset and the following conditions will + hold for each element X: + + SYMBOL_REF_HAS_BLOCK_INFO_P (X) + !SYMBOL_REF_ANCHOR_P (X) + SYMBOL_REF_BLOCK (X) == [address of this structure] + SYMBOL_REF_BLOCK_OFFSET (X) >= 0. */ + vec *objects; + + /* All the anchor SYMBOL_REFs used to address these objects, sorted + in order of increasing offset, and then increasing TLS model. + The following conditions will hold for each element X in this vector: + + SYMBOL_REF_HAS_BLOCK_INFO_P (X) + SYMBOL_REF_ANCHOR_P (X) + SYMBOL_REF_BLOCK (X) == [address of this structure] + SYMBOL_REF_BLOCK_OFFSET (X) >= 0. */ + vec *anchors; +}; + +struct GTY((variable_size)) hwivec_def { + HOST_WIDE_INT elem[1]; +}; + +/* Number of elements of the HWIVEC if RTX is a CONST_WIDE_INT. */ +#define CWI_GET_NUM_ELEM(RTX) \ + ((int)RTL_FLAG_CHECK1("CWI_GET_NUM_ELEM", (RTX), CONST_WIDE_INT)->u2.num_elem) +#define CWI_PUT_NUM_ELEM(RTX, NUM) \ + (RTL_FLAG_CHECK1("CWI_PUT_NUM_ELEM", (RTX), CONST_WIDE_INT)->u2.num_elem = (NUM)) + +/* RTL expression ("rtx"). */ + +/* The GTY "desc" and "tag" options below are a kludge: we need a desc + field for gengtype to recognize that inheritance is occurring, + so that all subclasses are redirected to the traversal hook for the + base class. + However, all of the fields are in the base class, and special-casing + is at work. Hence we use desc and tag of 0, generating a switch + statement of the form: + switch (0) + { + case 0: // all the work happens here + } + in order to work with the existing special-casing in gengtype. */ + +struct GTY((desc("0"), tag("0"), + chain_next ("RTX_NEXT (&%h)"), + chain_prev ("RTX_PREV (&%h)"))) rtx_def { + /* The kind of expression this is. */ + ENUM_BITFIELD(rtx_code) code: 16; + + /* The kind of value the expression has. */ + ENUM_BITFIELD(machine_mode) mode : 8; + + /* 1 in a MEM if we should keep the alias set for this mem unchanged + when we access a component. + 1 in a JUMP_INSN if it is a crossing jump. + 1 in a CALL_INSN if it is a sibling call. + 1 in a SET that is for a return. + In a CODE_LABEL, part of the two-bit alternate entry field. + 1 in a CONCAT is VAL_EXPR_IS_COPIED in var-tracking.c. + 1 in a VALUE is SP_BASED_VALUE_P in cselib.c. + 1 in a SUBREG generated by LRA for reload insns. + 1 in a REG if this is a static chain register. + 1 in a CALL for calls instrumented by Pointer Bounds Checker. + Dumped as "/j" in RTL dumps. */ + unsigned int jump : 1; + /* In a CODE_LABEL, part of the two-bit alternate entry field. + 1 in a MEM if it cannot trap. + 1 in a CALL_INSN logically equivalent to + ECF_LOOPING_CONST_OR_PURE and DECL_LOOPING_CONST_OR_PURE_P. + Dumped as "/c" in RTL dumps. */ + unsigned int call : 1; + /* 1 in a REG, MEM, or CONCAT if the value is set at most once, anywhere. + 1 in a SUBREG used for SUBREG_PROMOTED_UNSIGNED_P. + 1 in a SYMBOL_REF if it addresses something in the per-function + constants pool. + 1 in a CALL_INSN logically equivalent to ECF_CONST and TREE_READONLY. + 1 in a NOTE, or EXPR_LIST for a const call. + 1 in a JUMP_INSN of an annulling branch. + 1 in a CONCAT is VAL_EXPR_IS_CLOBBERED in var-tracking.c. + 1 in a preserved VALUE is PRESERVED_VALUE_P in cselib.c. + 1 in a clobber temporarily created for LRA. + Dumped as "/u" in RTL dumps. */ + unsigned int unchanging : 1; + /* 1 in a MEM or ASM_OPERANDS expression if the memory reference is volatile. + 1 in an INSN, CALL_INSN, JUMP_INSN, CODE_LABEL, BARRIER, or NOTE + if it has been deleted. + 1 in a REG expression if corresponds to a variable declared by the user, + 0 for an internally generated temporary. + 1 in a SUBREG used for SUBREG_PROMOTED_UNSIGNED_P. + 1 in a LABEL_REF, REG_LABEL_TARGET or REG_LABEL_OPERAND note for a + non-local label. + In a SYMBOL_REF, this flag is used for machine-specific purposes. + In a PREFETCH, this flag indicates that it should be considered a + scheduling barrier. + 1 in a CONCAT is VAL_NEEDS_RESOLUTION in var-tracking.c. + Dumped as "/v" in RTL dumps. */ + unsigned int volatil : 1; + /* 1 in a REG if the register is used only in exit code a loop. + 1 in a SUBREG expression if was generated from a variable with a + promoted mode. + 1 in a CODE_LABEL if the label is used for nonlocal gotos + and must not be deleted even if its count is zero. + 1 in an INSN, JUMP_INSN or CALL_INSN if this insn must be scheduled + together with the preceding insn. Valid only within sched. + 1 in an INSN, JUMP_INSN, or CALL_INSN if insn is in a delay slot and + from the target of a branch. Valid from reorg until end of compilation; + cleared before used. + + The name of the field is historical. It used to be used in MEMs + to record whether the MEM accessed part of a structure. + Dumped as "/s" in RTL dumps. */ + unsigned int in_struct : 1; + /* At the end of RTL generation, 1 if this rtx is used. This is used for + copying shared structure. See `unshare_all_rtl'. + In a REG, this is not needed for that purpose, and used instead + in `leaf_renumber_regs_insn'. + 1 in a SYMBOL_REF, means that emit_library_call + has used it as the function. + 1 in a CONCAT is VAL_HOLDS_TRACK_EXPR in var-tracking.c. + 1 in a VALUE or DEBUG_EXPR is VALUE_RECURSED_INTO in var-tracking.c. */ + unsigned int used : 1; + /* 1 in an INSN or a SET if this rtx is related to the call frame, + either changing how we compute the frame address or saving and + restoring registers in the prologue and epilogue. + 1 in a REG or MEM if it is a pointer. + 1 in a SYMBOL_REF if it addresses something in the per-function + constant string pool. + 1 in a VALUE is VALUE_CHANGED in var-tracking.c. + Dumped as "/f" in RTL dumps. */ + unsigned frame_related : 1; + /* 1 in a REG or PARALLEL that is the current function's return value. + 1 in a SYMBOL_REF for a weak symbol. + 1 in a CALL_INSN logically equivalent to ECF_PURE and DECL_PURE_P. + 1 in a CONCAT is VAL_EXPR_HAS_REVERSE in var-tracking.c. + 1 in a VALUE or DEBUG_EXPR is NO_LOC_P in var-tracking.c. + Dumped as "/i" in RTL dumps. */ + unsigned return_val : 1; + + union { + /* The final union field is aligned to 64 bits on LP64 hosts, + giving a 32-bit gap after the fields above. We optimize the + layout for that case and use the gap for extra code-specific + information. */ + + /* The ORIGINAL_REGNO of a REG. */ + unsigned int original_regno; + + /* The INSN_UID of an RTX_INSN-class code. */ + int insn_uid; + + /* The SYMBOL_REF_FLAGS of a SYMBOL_REF. */ + unsigned int symbol_ref_flags; + + /* The PAT_VAR_LOCATION_STATUS of a VAR_LOCATION. */ + enum var_init_status var_location_status; + + /* In a CONST_WIDE_INT (aka hwivec_def), this is the number of + HOST_WIDE_INTs in the hwivec_def. */ + unsigned int num_elem; + } GTY ((skip)) u2; + + /* The first element of the operands of this rtx. + The number of operands and their types are controlled + by the `code' field, according to rtl.def. */ + union u { + rtunion fld[1]; + HOST_WIDE_INT hwint[1]; + struct reg_info reg; + struct block_symbol block_sym; + struct real_value rv; + struct fixed_value fv; + struct hwivec_def hwiv; + } GTY ((special ("rtx_def"), desc ("GET_CODE (&%0)"))) u; +}; + +/* A node for constructing singly-linked lists of rtx. */ + +class GTY(()) rtx_expr_list : public rtx_def +{ + /* No extra fields, but adds invariant: (GET_CODE (X) == EXPR_LIST). */ + +public: + /* Get next in list. */ + rtx_expr_list *next () const; + + /* Get at the underlying rtx. */ + rtx element () const; +}; + +template <> +template <> +inline bool +is_a_helper ::test (rtx rt) +{ + return rt->code == EXPR_LIST; +} + +class GTY(()) rtx_insn_list : public rtx_def +{ + /* No extra fields, but adds invariant: (GET_CODE (X) == INSN_LIST). + + This is an instance of: + + DEF_RTL_EXPR(INSN_LIST, "insn_list", "ue", RTX_EXTRA) + + i.e. a node for constructing singly-linked lists of rtx_insn *, where + the list is "external" to the insn (as opposed to the doubly-linked + list embedded within rtx_insn itself). */ + +public: + /* Get next in list. */ + rtx_insn_list *next () const; + + /* Get at the underlying instruction. */ + rtx_insn *insn () const; + +}; + +template <> +template <> +inline bool +is_a_helper ::test (rtx rt) +{ + return rt->code == INSN_LIST; +} + +/* A node with invariant GET_CODE (X) == SEQUENCE i.e. a vector of rtx, + typically (but not always) of rtx_insn *, used in the late passes. */ + +class GTY(()) rtx_sequence : public rtx_def +{ + /* No extra fields, but adds invariant: (GET_CODE (X) == SEQUENCE). */ + +public: + /* Get number of elements in sequence. */ + int len () const; + + /* Get i-th element of the sequence. */ + rtx element (int index) const; + + /* Get i-th element of the sequence, with a checked cast to + rtx_insn *. */ + rtx_insn *insn (int index) const; +}; + +template <> +template <> +inline bool +is_a_helper ::test (rtx rt) +{ + return rt->code == SEQUENCE; +} + +template <> +template <> +inline bool +is_a_helper ::test (const_rtx rt) +{ + return rt->code == SEQUENCE; +} + +class GTY(()) rtx_insn : public rtx_def +{ +public: + /* No extra fields, but adds the invariant: + + (INSN_P (X) + || NOTE_P (X) + || JUMP_TABLE_DATA_P (X) + || BARRIER_P (X) + || LABEL_P (X)) + + i.e. that we must be able to use the following: + INSN_UID () + NEXT_INSN () + PREV_INSN () + i.e. we have an rtx that has an INSN_UID field and can be part of + a linked list of insns. + */ + + /* Returns true if this insn has been deleted. */ + + bool deleted () const { return volatil; } + + /* Mark this insn as deleted. */ + + void set_deleted () { volatil = true; } + + /* Mark this insn as not deleted. */ + + void set_undeleted () { volatil = false; } +}; + +/* Subclasses of rtx_insn. */ + +class GTY(()) rtx_debug_insn : public rtx_insn +{ + /* No extra fields, but adds the invariant: + DEBUG_INSN_P (X) aka (GET_CODE (X) == DEBUG_INSN) + i.e. an annotation for tracking variable assignments. + + This is an instance of: + DEF_RTL_EXPR(DEBUG_INSN, "debug_insn", "uuBeiie", RTX_INSN) + from rtl.def. */ +}; + +class GTY(()) rtx_nonjump_insn : public rtx_insn +{ + /* No extra fields, but adds the invariant: + NONJUMP_INSN_P (X) aka (GET_CODE (X) == INSN) + i.e an instruction that cannot jump. + + This is an instance of: + DEF_RTL_EXPR(INSN, "insn", "uuBeiie", RTX_INSN) + from rtl.def. */ +}; + +class GTY(()) rtx_jump_insn : public rtx_insn +{ +public: + /* No extra fields, but adds the invariant: + JUMP_P (X) aka (GET_CODE (X) == JUMP_INSN) + i.e. an instruction that can possibly jump. + + This is an instance of: + DEF_RTL_EXPR(JUMP_INSN, "jump_insn", "uuBeiie0", RTX_INSN) + from rtl.def. */ + + /* Returns jump target of this instruction. The returned value is not + necessarily a code label: it may also be a RETURN or SIMPLE_RETURN + expression. Also, when the code label is marked "deleted", it is + replaced by a NOTE. In some cases the value is NULL_RTX. */ + + inline rtx jump_label () const; + + /* Returns jump target cast to rtx_code_label *. */ + + inline rtx_code_label *jump_target () const; + + /* Set jump target. */ + + inline void set_jump_target (rtx_code_label *); +}; + +class GTY(()) rtx_call_insn : public rtx_insn +{ + /* No extra fields, but adds the invariant: + CALL_P (X) aka (GET_CODE (X) == CALL_INSN) + i.e. an instruction that can possibly call a subroutine + but which will not change which instruction comes next + in the current function. + + This is an instance of: + DEF_RTL_EXPR(CALL_INSN, "call_insn", "uuBeiiee", RTX_INSN) + from rtl.def. */ +}; + +class GTY(()) rtx_jump_table_data : public rtx_insn +{ + /* No extra fields, but adds the invariant: + JUMP_TABLE_DATA_P (X) aka (GET_CODE (INSN) == JUMP_TABLE_DATA) + i.e. a data for a jump table, considered an instruction for + historical reasons. + + This is an instance of: + DEF_RTL_EXPR(JUMP_TABLE_DATA, "jump_table_data", "uuBe0000", RTX_INSN) + from rtl.def. */ + +public: + + /* This can be either: + + (a) a table of absolute jumps, in which case PATTERN (this) is an + ADDR_VEC with arg 0 a vector of labels, or + + (b) a table of relative jumps (e.g. for -fPIC), in which case + PATTERN (this) is an ADDR_DIFF_VEC, with arg 0 a LABEL_REF and + arg 1 the vector of labels. + + This method gets the underlying vec. */ + + inline rtvec get_labels () const; +}; + +class GTY(()) rtx_barrier : public rtx_insn +{ + /* No extra fields, but adds the invariant: + BARRIER_P (X) aka (GET_CODE (X) == BARRIER) + i.e. a marker that indicates that control will not flow through. + + This is an instance of: + DEF_RTL_EXPR(BARRIER, "barrier", "uu00000", RTX_EXTRA) + from rtl.def. */ +}; + +class GTY(()) rtx_code_label : public rtx_insn +{ + /* No extra fields, but adds the invariant: + LABEL_P (X) aka (GET_CODE (X) == CODE_LABEL) + i.e. a label in the assembler. + + This is an instance of: + DEF_RTL_EXPR(CODE_LABEL, "code_label", "uuB00is", RTX_EXTRA) + from rtl.def. */ +}; + +class GTY(()) rtx_note : public rtx_insn +{ + /* No extra fields, but adds the invariant: + NOTE_P(X) aka (GET_CODE (X) == NOTE) + i.e. a note about the corresponding source code. + + This is an instance of: + DEF_RTL_EXPR(NOTE, "note", "uuB0ni", RTX_EXTRA) + from rtl.def. */ +}; + +/* The size in bytes of an rtx header (code, mode and flags). */ +#define RTX_HDR_SIZE offsetof (struct rtx_def, u) + +/* The size in bytes of an rtx with code CODE. */ +#define RTX_CODE_SIZE(CODE) rtx_code_size[CODE] + +#define NULL_RTX (rtx) 0 + +/* The "next" and "previous" RTX, relative to this one. */ + +#define RTX_NEXT(X) (rtx_next[GET_CODE (X)] == 0 ? NULL \ + : *(rtx *)(((char *)X) + rtx_next[GET_CODE (X)])) + +/* FIXME: the "NEXT_INSN (PREV_INSN (X)) == X" condition shouldn't be needed. + */ +#define RTX_PREV(X) ((INSN_P (X) \ + || NOTE_P (X) \ + || JUMP_TABLE_DATA_P (X) \ + || BARRIER_P (X) \ + || LABEL_P (X)) \ + && PREV_INSN (as_a (X)) != NULL \ + && NEXT_INSN (PREV_INSN (as_a (X))) == X \ + ? PREV_INSN (as_a (X)) : NULL) + +/* Define macros to access the `code' field of the rtx. */ + +#define GET_CODE(RTX) ((enum rtx_code) (RTX)->code) +#define PUT_CODE(RTX, CODE) ((RTX)->code = (CODE)) + +#define GET_MODE(RTX) ((machine_mode) (RTX)->mode) +#define PUT_MODE_RAW(RTX, MODE) ((RTX)->mode = (MODE)) + +/* RTL vector. These appear inside RTX's when there is a need + for a variable number of things. The principle use is inside + PARALLEL expressions. */ + +struct GTY(()) rtvec_def { + int num_elem; /* number of elements */ + rtx GTY ((length ("%h.num_elem"))) elem[1]; +}; + +#define NULL_RTVEC (rtvec) 0 + +#define GET_NUM_ELEM(RTVEC) ((RTVEC)->num_elem) +#define PUT_NUM_ELEM(RTVEC, NUM) ((RTVEC)->num_elem = (NUM)) + +/* Predicate yielding nonzero iff X is an rtx for a register. */ +#define REG_P(X) (GET_CODE (X) == REG) + +/* Predicate yielding nonzero iff X is an rtx for a memory location. */ +#define MEM_P(X) (GET_CODE (X) == MEM) + +#if TARGET_SUPPORTS_WIDE_INT + +/* Match CONST_*s that can represent compile-time constant integers. */ +#define CASE_CONST_SCALAR_INT \ + case CONST_INT: \ + case CONST_WIDE_INT + +/* Match CONST_*s for which pointer equality corresponds to value + equality. */ +#define CASE_CONST_UNIQUE \ + case CONST_INT: \ + case CONST_WIDE_INT: \ + case CONST_DOUBLE: \ + case CONST_FIXED + +/* Match all CONST_* rtxes. */ +#define CASE_CONST_ANY \ + case CONST_INT: \ + case CONST_WIDE_INT: \ + case CONST_DOUBLE: \ + case CONST_FIXED: \ + case CONST_VECTOR + +#else + +/* Match CONST_*s that can represent compile-time constant integers. */ +#define CASE_CONST_SCALAR_INT \ + case CONST_INT: \ + case CONST_DOUBLE + +/* Match CONST_*s for which pointer equality corresponds to value + equality. */ +#define CASE_CONST_UNIQUE \ + case CONST_INT: \ + case CONST_DOUBLE: \ + case CONST_FIXED + +/* Match all CONST_* rtxes. */ +#define CASE_CONST_ANY \ + case CONST_INT: \ + case CONST_DOUBLE: \ + case CONST_FIXED: \ + case CONST_VECTOR +#endif + +/* Predicate yielding nonzero iff X is an rtx for a constant integer. */ +#define CONST_INT_P(X) (GET_CODE (X) == CONST_INT) + +/* Predicate yielding nonzero iff X is an rtx for a constant integer. */ +#define CONST_WIDE_INT_P(X) (GET_CODE (X) == CONST_WIDE_INT) + +/* Predicate yielding nonzero iff X is an rtx for a constant fixed-point. */ +#define CONST_FIXED_P(X) (GET_CODE (X) == CONST_FIXED) + +/* Predicate yielding true iff X is an rtx for a double-int + or floating point constant. */ +#define CONST_DOUBLE_P(X) (GET_CODE (X) == CONST_DOUBLE) + +/* Predicate yielding true iff X is an rtx for a double-int. */ +#define CONST_DOUBLE_AS_INT_P(X) \ + (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == VOIDmode) + +/* Predicate yielding true iff X is an rtx for a integer const. */ +#if TARGET_SUPPORTS_WIDE_INT +#define CONST_SCALAR_INT_P(X) \ + (CONST_INT_P (X) || CONST_WIDE_INT_P (X)) +#else +#define CONST_SCALAR_INT_P(X) \ + (CONST_INT_P (X) || CONST_DOUBLE_AS_INT_P (X)) +#endif + +/* Predicate yielding true iff X is an rtx for a double-int. */ +#define CONST_DOUBLE_AS_FLOAT_P(X) \ + (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) != VOIDmode) + +/* Predicate yielding nonzero iff X is a label insn. */ +#define LABEL_P(X) (GET_CODE (X) == CODE_LABEL) + +/* Predicate yielding nonzero iff X is a jump insn. */ +#define JUMP_P(X) (GET_CODE (X) == JUMP_INSN) + +/* Predicate yielding nonzero iff X is a call insn. */ +#define CALL_P(X) (GET_CODE (X) == CALL_INSN) + +/* Predicate yielding nonzero iff X is an insn that cannot jump. */ +#define NONJUMP_INSN_P(X) (GET_CODE (X) == INSN) + +/* Predicate yielding nonzero iff X is a debug note/insn. */ +#define DEBUG_INSN_P(X) (GET_CODE (X) == DEBUG_INSN) + +/* Predicate yielding nonzero iff X is an insn that is not a debug insn. */ +#define NONDEBUG_INSN_P(X) (INSN_P (X) && !DEBUG_INSN_P (X)) + +/* Nonzero if DEBUG_INSN_P may possibly hold. */ +#define MAY_HAVE_DEBUG_INSNS (flag_var_tracking_assignments) + +/* Predicate yielding nonzero iff X is a real insn. */ +#define INSN_P(X) \ + (NONJUMP_INSN_P (X) || DEBUG_INSN_P (X) || JUMP_P (X) || CALL_P (X)) + +/* Predicate yielding nonzero iff X is a note insn. */ +#define NOTE_P(X) (GET_CODE (X) == NOTE) + +/* Predicate yielding nonzero iff X is a barrier insn. */ +#define BARRIER_P(X) (GET_CODE (X) == BARRIER) + +/* Predicate yielding nonzero iff X is a data for a jump table. */ +#define JUMP_TABLE_DATA_P(INSN) (GET_CODE (INSN) == JUMP_TABLE_DATA) + +/* Predicate yielding nonzero iff RTX is a subreg. */ +#define SUBREG_P(RTX) (GET_CODE (RTX) == SUBREG) + +/* Predicate yielding true iff RTX is a symbol ref. */ +#define SYMBOL_REF_P(RTX) (GET_CODE (RTX) == SYMBOL_REF) + +template <> +template <> +inline bool +is_a_helper ::test (rtx rt) +{ + return (INSN_P (rt) + || NOTE_P (rt) + || JUMP_TABLE_DATA_P (rt) + || BARRIER_P (rt) + || LABEL_P (rt)); +} + +template <> +template <> +inline bool +is_a_helper ::test (const_rtx rt) +{ + return (INSN_P (rt) + || NOTE_P (rt) + || JUMP_TABLE_DATA_P (rt) + || BARRIER_P (rt) + || LABEL_P (rt)); +} + +template <> +template <> +inline bool +is_a_helper ::test (rtx rt) +{ + return DEBUG_INSN_P (rt); +} + +template <> +template <> +inline bool +is_a_helper ::test (rtx rt) +{ + return NONJUMP_INSN_P (rt); +} + +template <> +template <> +inline bool +is_a_helper ::test (rtx rt) +{ + return JUMP_P (rt); +} + +template <> +template <> +inline bool +is_a_helper ::test (rtx_insn *insn) +{ + return JUMP_P (insn); +} + +template <> +template <> +inline bool +is_a_helper ::test (rtx rt) +{ + return CALL_P (rt); +} + +template <> +template <> +inline bool +is_a_helper ::test (rtx_insn *insn) +{ + return CALL_P (insn); +} + +template <> +template <> +inline bool +is_a_helper ::test (rtx rt) +{ + return JUMP_TABLE_DATA_P (rt); +} + +template <> +template <> +inline bool +is_a_helper ::test (rtx_insn *insn) +{ + return JUMP_TABLE_DATA_P (insn); +} + +template <> +template <> +inline bool +is_a_helper ::test (rtx rt) +{ + return BARRIER_P (rt); +} + +template <> +template <> +inline bool +is_a_helper ::test (rtx rt) +{ + return LABEL_P (rt); +} + +template <> +template <> +inline bool +is_a_helper ::test (rtx_insn *insn) +{ + return LABEL_P (insn); +} + +template <> +template <> +inline bool +is_a_helper ::test (rtx rt) +{ + return NOTE_P (rt); +} + +template <> +template <> +inline bool +is_a_helper ::test (rtx_insn *insn) +{ + return NOTE_P (insn); +} + +/* Predicate yielding nonzero iff X is a return or simple_return. */ +#define ANY_RETURN_P(X) \ + (GET_CODE (X) == RETURN || GET_CODE (X) == SIMPLE_RETURN) + +/* 1 if X is a unary operator. */ + +#define UNARY_P(X) \ + (GET_RTX_CLASS (GET_CODE (X)) == RTX_UNARY) + +/* 1 if X is a binary operator. */ + +#define BINARY_P(X) \ + ((GET_RTX_CLASS (GET_CODE (X)) & RTX_BINARY_MASK) == RTX_BINARY_RESULT) + +/* 1 if X is an arithmetic operator. */ + +#define ARITHMETIC_P(X) \ + ((GET_RTX_CLASS (GET_CODE (X)) & RTX_ARITHMETIC_MASK) \ + == RTX_ARITHMETIC_RESULT) + +/* 1 if X is an arithmetic operator. */ + +#define COMMUTATIVE_ARITH_P(X) \ + (GET_RTX_CLASS (GET_CODE (X)) == RTX_COMM_ARITH) + +/* 1 if X is a commutative arithmetic operator or a comparison operator. + These two are sometimes selected together because it is possible to + swap the two operands. */ + +#define SWAPPABLE_OPERANDS_P(X) \ + ((1 << GET_RTX_CLASS (GET_CODE (X))) \ + & ((1 << RTX_COMM_ARITH) | (1 << RTX_COMM_COMPARE) \ + | (1 << RTX_COMPARE))) + +/* 1 if X is a non-commutative operator. */ + +#define NON_COMMUTATIVE_P(X) \ + ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMMUTATIVE_MASK) \ + == RTX_NON_COMMUTATIVE_RESULT) + +/* 1 if X is a commutative operator on integers. */ + +#define COMMUTATIVE_P(X) \ + ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMMUTATIVE_MASK) \ + == RTX_COMMUTATIVE_RESULT) + +/* 1 if X is a relational operator. */ + +#define COMPARISON_P(X) \ + ((GET_RTX_CLASS (GET_CODE (X)) & RTX_COMPARE_MASK) == RTX_COMPARE_RESULT) + +/* 1 if X is a constant value that is an integer. */ + +#define CONSTANT_P(X) \ + (GET_RTX_CLASS (GET_CODE (X)) == RTX_CONST_OBJ) + +/* 1 if X can be used to represent an object. */ +#define OBJECT_P(X) \ + ((GET_RTX_CLASS (GET_CODE (X)) & RTX_OBJ_MASK) == RTX_OBJ_RESULT) + +/* General accessor macros for accessing the fields of an rtx. */ + +#if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007) +/* The bit with a star outside the statement expr and an & inside is + so that N can be evaluated only once. */ +#define RTL_CHECK1(RTX, N, C1) __extension__ \ +(*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \ + const enum rtx_code _code = GET_CODE (_rtx); \ + if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \ + rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \ + __FUNCTION__); \ + if (GET_RTX_FORMAT (_code)[_n] != C1) \ + rtl_check_failed_type1 (_rtx, _n, C1, __FILE__, __LINE__, \ + __FUNCTION__); \ + &_rtx->u.fld[_n]; })) + +#define RTL_CHECK2(RTX, N, C1, C2) __extension__ \ +(*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \ + const enum rtx_code _code = GET_CODE (_rtx); \ + if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \ + rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \ + __FUNCTION__); \ + if (GET_RTX_FORMAT (_code)[_n] != C1 \ + && GET_RTX_FORMAT (_code)[_n] != C2) \ + rtl_check_failed_type2 (_rtx, _n, C1, C2, __FILE__, __LINE__, \ + __FUNCTION__); \ + &_rtx->u.fld[_n]; })) + +#define RTL_CHECKC1(RTX, N, C) __extension__ \ +(*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \ + if (GET_CODE (_rtx) != (C)) \ + rtl_check_failed_code1 (_rtx, (C), __FILE__, __LINE__, \ + __FUNCTION__); \ + &_rtx->u.fld[_n]; })) + +#define RTL_CHECKC2(RTX, N, C1, C2) __extension__ \ +(*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \ + const enum rtx_code _code = GET_CODE (_rtx); \ + if (_code != (C1) && _code != (C2)) \ + rtl_check_failed_code2 (_rtx, (C1), (C2), __FILE__, __LINE__, \ + __FUNCTION__); \ + &_rtx->u.fld[_n]; })) + +#define RTVEC_ELT(RTVEC, I) __extension__ \ +(*({ __typeof (RTVEC) const _rtvec = (RTVEC); const int _i = (I); \ + if (_i < 0 || _i >= GET_NUM_ELEM (_rtvec)) \ + rtvec_check_failed_bounds (_rtvec, _i, __FILE__, __LINE__, \ + __FUNCTION__); \ + &_rtvec->elem[_i]; })) + +#define XWINT(RTX, N) __extension__ \ +(*({ __typeof (RTX) const _rtx = (RTX); const int _n = (N); \ + const enum rtx_code _code = GET_CODE (_rtx); \ + if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \ + rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \ + __FUNCTION__); \ + if (GET_RTX_FORMAT (_code)[_n] != 'w') \ + rtl_check_failed_type1 (_rtx, _n, 'w', __FILE__, __LINE__, \ + __FUNCTION__); \ + &_rtx->u.hwint[_n]; })) + +#define CWI_ELT(RTX, I) __extension__ \ +(*({ __typeof (RTX) const _cwi = (RTX); \ + int _max = CWI_GET_NUM_ELEM (_cwi); \ + const int _i = (I); \ + if (_i < 0 || _i >= _max) \ + cwi_check_failed_bounds (_cwi, _i, __FILE__, __LINE__, \ + __FUNCTION__); \ + &_cwi->u.hwiv.elem[_i]; })) + +#define XCWINT(RTX, N, C) __extension__ \ +(*({ __typeof (RTX) const _rtx = (RTX); \ + if (GET_CODE (_rtx) != (C)) \ + rtl_check_failed_code1 (_rtx, (C), __FILE__, __LINE__, \ + __FUNCTION__); \ + &_rtx->u.hwint[N]; })) + +#define XCMWINT(RTX, N, C, M) __extension__ \ +(*({ __typeof (RTX) const _rtx = (RTX); \ + if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) != (M)) \ + rtl_check_failed_code_mode (_rtx, (C), (M), false, __FILE__, \ + __LINE__, __FUNCTION__); \ + &_rtx->u.hwint[N]; })) + +#define XCNMPRV(RTX, C, M) __extension__ \ +({ __typeof (RTX) const _rtx = (RTX); \ + if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) == (M)) \ + rtl_check_failed_code_mode (_rtx, (C), (M), true, __FILE__, \ + __LINE__, __FUNCTION__); \ + &_rtx->u.rv; }) + +#define XCNMPFV(RTX, C, M) __extension__ \ +({ __typeof (RTX) const _rtx = (RTX); \ + if (GET_CODE (_rtx) != (C) || GET_MODE (_rtx) == (M)) \ + rtl_check_failed_code_mode (_rtx, (C), (M), true, __FILE__, \ + __LINE__, __FUNCTION__); \ + &_rtx->u.fv; }) + +#define REG_CHECK(RTX) __extension__ \ +({ __typeof (RTX) const _rtx = (RTX); \ + if (GET_CODE (_rtx) != REG) \ + rtl_check_failed_code1 (_rtx, REG, __FILE__, __LINE__, \ + __FUNCTION__); \ + &_rtx->u.reg; }) + +#define BLOCK_SYMBOL_CHECK(RTX) __extension__ \ +({ __typeof (RTX) const _symbol = (RTX); \ + const unsigned int flags = SYMBOL_REF_FLAGS (_symbol); \ + if ((flags & SYMBOL_FLAG_HAS_BLOCK_INFO) == 0) \ + rtl_check_failed_block_symbol (__FILE__, __LINE__, \ + __FUNCTION__); \ + &_symbol->u.block_sym; }) + +#define HWIVEC_CHECK(RTX,C) __extension__ \ +({ __typeof (RTX) const _symbol = (RTX); \ + RTL_CHECKC1 (_symbol, 0, C); \ + &_symbol->u.hwiv; }) + +extern void rtl_check_failed_bounds (const_rtx, int, const char *, int, + const char *) + ATTRIBUTE_NORETURN; +extern void rtl_check_failed_type1 (const_rtx, int, int, const char *, int, + const char *) + ATTRIBUTE_NORETURN; +extern void rtl_check_failed_type2 (const_rtx, int, int, int, const char *, + int, const char *) + ATTRIBUTE_NORETURN; +extern void rtl_check_failed_code1 (const_rtx, enum rtx_code, const char *, + int, const char *) + ATTRIBUTE_NORETURN; +extern void rtl_check_failed_code2 (const_rtx, enum rtx_code, enum rtx_code, + const char *, int, const char *) + ATTRIBUTE_NORETURN; +extern void rtl_check_failed_code_mode (const_rtx, enum rtx_code, machine_mode, + bool, const char *, int, const char *) + ATTRIBUTE_NORETURN; +extern void rtl_check_failed_block_symbol (const char *, int, const char *) + ATTRIBUTE_NORETURN; +extern void cwi_check_failed_bounds (const_rtx, int, const char *, int, + const char *) + ATTRIBUTE_NORETURN; +extern void rtvec_check_failed_bounds (const_rtvec, int, const char *, int, + const char *) + ATTRIBUTE_NORETURN; + +#else /* not ENABLE_RTL_CHECKING */ + +#define RTL_CHECK1(RTX, N, C1) ((RTX)->u.fld[N]) +#define RTL_CHECK2(RTX, N, C1, C2) ((RTX)->u.fld[N]) +#define RTL_CHECKC1(RTX, N, C) ((RTX)->u.fld[N]) +#define RTL_CHECKC2(RTX, N, C1, C2) ((RTX)->u.fld[N]) +#define RTVEC_ELT(RTVEC, I) ((RTVEC)->elem[I]) +#define XWINT(RTX, N) ((RTX)->u.hwint[N]) +#define CWI_ELT(RTX, I) ((RTX)->u.hwiv.elem[I]) +#define XCWINT(RTX, N, C) ((RTX)->u.hwint[N]) +#define XCMWINT(RTX, N, C, M) ((RTX)->u.hwint[N]) +#define XCNMWINT(RTX, N, C, M) ((RTX)->u.hwint[N]) +#define XCNMPRV(RTX, C, M) (&(RTX)->u.rv) +#define XCNMPFV(RTX, C, M) (&(RTX)->u.fv) +#define REG_CHECK(RTX) (&(RTX)->u.reg) +#define BLOCK_SYMBOL_CHECK(RTX) (&(RTX)->u.block_sym) +#define HWIVEC_CHECK(RTX,C) (&(RTX)->u.hwiv) + +#endif + +/* General accessor macros for accessing the flags of an rtx. */ + +/* Access an individual rtx flag, with no checking of any kind. */ +#define RTX_FLAG(RTX, FLAG) ((RTX)->FLAG) + +#if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION >= 2007) +#define RTL_FLAG_CHECK1(NAME, RTX, C1) __extension__ \ +({ __typeof (RTX) const _rtx = (RTX); \ + if (GET_CODE (_rtx) != C1) \ + rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \ + __FUNCTION__); \ + _rtx; }) + +#define RTL_FLAG_CHECK2(NAME, RTX, C1, C2) __extension__ \ +({ __typeof (RTX) const _rtx = (RTX); \ + if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2) \ + rtl_check_failed_flag (NAME,_rtx, __FILE__, __LINE__, \ + __FUNCTION__); \ + _rtx; }) + +#define RTL_FLAG_CHECK3(NAME, RTX, C1, C2, C3) __extension__ \ +({ __typeof (RTX) const _rtx = (RTX); \ + if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2 \ + && GET_CODE (_rtx) != C3) \ + rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \ + __FUNCTION__); \ + _rtx; }) + +#define RTL_FLAG_CHECK4(NAME, RTX, C1, C2, C3, C4) __extension__ \ +({ __typeof (RTX) const _rtx = (RTX); \ + if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2 \ + && GET_CODE (_rtx) != C3 && GET_CODE(_rtx) != C4) \ + rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \ + __FUNCTION__); \ + _rtx; }) + +#define RTL_FLAG_CHECK5(NAME, RTX, C1, C2, C3, C4, C5) __extension__ \ +({ __typeof (RTX) const _rtx = (RTX); \ + if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \ + && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \ + && GET_CODE (_rtx) != C5) \ + rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \ + __FUNCTION__); \ + _rtx; }) + +#define RTL_FLAG_CHECK6(NAME, RTX, C1, C2, C3, C4, C5, C6) \ + __extension__ \ +({ __typeof (RTX) const _rtx = (RTX); \ + if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \ + && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \ + && GET_CODE (_rtx) != C5 && GET_CODE (_rtx) != C6) \ + rtl_check_failed_flag (NAME,_rtx, __FILE__, __LINE__, \ + __FUNCTION__); \ + _rtx; }) + +#define RTL_FLAG_CHECK7(NAME, RTX, C1, C2, C3, C4, C5, C6, C7) \ + __extension__ \ +({ __typeof (RTX) const _rtx = (RTX); \ + if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \ + && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \ + && GET_CODE (_rtx) != C5 && GET_CODE (_rtx) != C6 \ + && GET_CODE (_rtx) != C7) \ + rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \ + __FUNCTION__); \ + _rtx; }) + +#define RTL_INSN_CHAIN_FLAG_CHECK(NAME, RTX) \ + __extension__ \ +({ __typeof (RTX) const _rtx = (RTX); \ + if (!INSN_CHAIN_CODE_P (GET_CODE (_rtx))) \ + rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \ + __FUNCTION__); \ + _rtx; }) + +extern void rtl_check_failed_flag (const char *, const_rtx, const char *, + int, const char *) + ATTRIBUTE_NORETURN + ; + +#else /* not ENABLE_RTL_FLAG_CHECKING */ + +#define RTL_FLAG_CHECK1(NAME, RTX, C1) (RTX) +#define RTL_FLAG_CHECK2(NAME, RTX, C1, C2) (RTX) +#define RTL_FLAG_CHECK3(NAME, RTX, C1, C2, C3) (RTX) +#define RTL_FLAG_CHECK4(NAME, RTX, C1, C2, C3, C4) (RTX) +#define RTL_FLAG_CHECK5(NAME, RTX, C1, C2, C3, C4, C5) (RTX) +#define RTL_FLAG_CHECK6(NAME, RTX, C1, C2, C3, C4, C5, C6) (RTX) +#define RTL_FLAG_CHECK7(NAME, RTX, C1, C2, C3, C4, C5, C6, C7) (RTX) +#define RTL_INSN_CHAIN_FLAG_CHECK(NAME, RTX) (RTX) +#endif + +#define XINT(RTX, N) (RTL_CHECK2 (RTX, N, 'i', 'n').rt_int) +#define XUINT(RTX, N) (RTL_CHECK2 (RTX, N, 'i', 'n').rt_uint) +#define XSTR(RTX, N) (RTL_CHECK2 (RTX, N, 's', 'S').rt_str) +#define XEXP(RTX, N) (RTL_CHECK2 (RTX, N, 'e', 'u').rt_rtx) +#define XVEC(RTX, N) (RTL_CHECK2 (RTX, N, 'E', 'V').rt_rtvec) +#define XMODE(RTX, N) (RTL_CHECK1 (RTX, N, 'M').rt_type) +#define XTREE(RTX, N) (RTL_CHECK1 (RTX, N, 't').rt_tree) +#define XBBDEF(RTX, N) (RTL_CHECK1 (RTX, N, 'B').rt_bb) +#define XTMPL(RTX, N) (RTL_CHECK1 (RTX, N, 'T').rt_str) +#define XCFI(RTX, N) (RTL_CHECK1 (RTX, N, 'C').rt_cfi) + +#define XVECEXP(RTX, N, M) RTVEC_ELT (XVEC (RTX, N), M) +#define XVECLEN(RTX, N) GET_NUM_ELEM (XVEC (RTX, N)) + +/* These are like XINT, etc. except that they expect a '0' field instead + of the normal type code. */ + +#define X0INT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_int) +#define X0UINT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_uint) +#define X0STR(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_str) +#define X0EXP(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_rtx) +#define X0VEC(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_rtvec) +#define X0MODE(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_type) +#define X0TREE(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_tree) +#define X0BBDEF(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_bb) +#define X0ADVFLAGS(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_addr_diff_vec_flags) +#define X0CSELIB(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_cselib) +#define X0MEMATTR(RTX, N) (RTL_CHECKC1 (RTX, N, MEM).rt_mem) +#define X0CONSTANT(RTX, N) (RTL_CHECK1 (RTX, N, '0').rt_constant) + +/* Access a '0' field with any type. */ +#define X0ANY(RTX, N) RTL_CHECK1 (RTX, N, '0') + +#define XCINT(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_int) +#define XCUINT(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_uint) +#define XCSTR(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_str) +#define XCEXP(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_rtx) +#define XCVEC(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_rtvec) +#define XCMODE(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_type) +#define XCTREE(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_tree) +#define XCBBDEF(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_bb) +#define XCCFI(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_cfi) +#define XCCSELIB(RTX, N, C) (RTL_CHECKC1 (RTX, N, C).rt_cselib) + +#define XCVECEXP(RTX, N, M, C) RTVEC_ELT (XCVEC (RTX, N, C), M) +#define XCVECLEN(RTX, N, C) GET_NUM_ELEM (XCVEC (RTX, N, C)) + +#define XC2EXP(RTX, N, C1, C2) (RTL_CHECKC2 (RTX, N, C1, C2).rt_rtx) + + +/* Methods of rtx_expr_list. */ + +inline rtx_expr_list *rtx_expr_list::next () const +{ + rtx tmp = XEXP (this, 1); + return safe_as_a (tmp); +} + +inline rtx rtx_expr_list::element () const +{ + return XEXP (this, 0); +} + +/* Methods of rtx_insn_list. */ + +inline rtx_insn_list *rtx_insn_list::next () const +{ + rtx tmp = XEXP (this, 1); + return safe_as_a (tmp); +} + +inline rtx_insn *rtx_insn_list::insn () const +{ + rtx tmp = XEXP (this, 0); + return safe_as_a (tmp); +} + +/* Methods of rtx_sequence. */ + +inline int rtx_sequence::len () const +{ + return XVECLEN (this, 0); +} + +inline rtx rtx_sequence::element (int index) const +{ + return XVECEXP (this, 0, index); +} + +inline rtx_insn *rtx_sequence::insn (int index) const +{ + return as_a (XVECEXP (this, 0, index)); +} + +/* ACCESS MACROS for particular fields of insns. */ + +/* Holds a unique number for each insn. + These are not necessarily sequentially increasing. */ +inline int INSN_UID (const_rtx insn) +{ + return RTL_INSN_CHAIN_FLAG_CHECK ("INSN_UID", + (insn))->u2.insn_uid; +} +inline int& INSN_UID (rtx insn) +{ + return RTL_INSN_CHAIN_FLAG_CHECK ("INSN_UID", + (insn))->u2.insn_uid; +} + +/* Chain insns together in sequence. */ + +/* For now these are split in two: an rvalue form: + PREV_INSN/NEXT_INSN + and an lvalue form: + SET_NEXT_INSN/SET_PREV_INSN. */ + +inline rtx_insn *PREV_INSN (const rtx_insn *insn) +{ + rtx prev = XEXP (insn, 0); + return safe_as_a (prev); +} + +inline rtx& SET_PREV_INSN (rtx_insn *insn) +{ + return XEXP (insn, 0); +} + +inline rtx_insn *NEXT_INSN (const rtx_insn *insn) +{ + rtx next = XEXP (insn, 1); + return safe_as_a (next); +} + +inline rtx& SET_NEXT_INSN (rtx_insn *insn) +{ + return XEXP (insn, 1); +} + +inline basic_block BLOCK_FOR_INSN (const_rtx insn) +{ + return XBBDEF (insn, 2); +} + +inline basic_block& BLOCK_FOR_INSN (rtx insn) +{ + return XBBDEF (insn, 2); +} + +inline void set_block_for_insn (rtx_insn *insn, basic_block bb) +{ + BLOCK_FOR_INSN (insn) = bb; +} + +/* The body of an insn. */ +inline rtx PATTERN (const_rtx insn) +{ + return XEXP (insn, 3); +} + +inline rtx& PATTERN (rtx insn) +{ + return XEXP (insn, 3); +} + +inline unsigned int INSN_LOCATION (const rtx_insn *insn) +{ + return XUINT (insn, 4); +} + +inline unsigned int& INSN_LOCATION (rtx_insn *insn) +{ + return XUINT (insn, 4); +} + +inline bool INSN_HAS_LOCATION (const rtx_insn *insn) +{ + return LOCATION_LOCUS (INSN_LOCATION (insn)) != UNKNOWN_LOCATION; +} + +/* LOCATION of an RTX if relevant. */ +#define RTL_LOCATION(X) (INSN_P (X) ? \ + INSN_LOCATION (as_a (X)) \ + : UNKNOWN_LOCATION) + +/* Code number of instruction, from when it was recognized. + -1 means this instruction has not been recognized yet. */ +#define INSN_CODE(INSN) XINT (INSN, 5) + +inline rtvec rtx_jump_table_data::get_labels () const +{ + rtx pat = PATTERN (this); + if (GET_CODE (pat) == ADDR_VEC) + return XVEC (pat, 0); + else + return XVEC (pat, 1); /* presumably an ADDR_DIFF_VEC */ +} + +#define RTX_FRAME_RELATED_P(RTX) \ + (RTL_FLAG_CHECK6 ("RTX_FRAME_RELATED_P", (RTX), DEBUG_INSN, INSN, \ + CALL_INSN, JUMP_INSN, BARRIER, SET)->frame_related) + +/* 1 if JUMP RTX is a crossing jump. */ +#define CROSSING_JUMP_P(RTX) \ + (RTL_FLAG_CHECK1 ("CROSSING_JUMP_P", (RTX), JUMP_INSN)->jump) + +/* 1 if RTX is a call to a const function. Built from ECF_CONST and + TREE_READONLY. */ +#define RTL_CONST_CALL_P(RTX) \ + (RTL_FLAG_CHECK1 ("RTL_CONST_CALL_P", (RTX), CALL_INSN)->unchanging) + +/* 1 if RTX is a call to a pure function. Built from ECF_PURE and + DECL_PURE_P. */ +#define RTL_PURE_CALL_P(RTX) \ + (RTL_FLAG_CHECK1 ("RTL_PURE_CALL_P", (RTX), CALL_INSN)->return_val) + +/* 1 if RTX is a call to a const or pure function. */ +#define RTL_CONST_OR_PURE_CALL_P(RTX) \ + (RTL_CONST_CALL_P (RTX) || RTL_PURE_CALL_P (RTX)) + +/* 1 if RTX is a call to a looping const or pure function. Built from + ECF_LOOPING_CONST_OR_PURE and DECL_LOOPING_CONST_OR_PURE_P. */ +#define RTL_LOOPING_CONST_OR_PURE_CALL_P(RTX) \ + (RTL_FLAG_CHECK1 ("CONST_OR_PURE_CALL_P", (RTX), CALL_INSN)->call) + +/* 1 if RTX is a call_insn for a sibling call. */ +#define SIBLING_CALL_P(RTX) \ + (RTL_FLAG_CHECK1 ("SIBLING_CALL_P", (RTX), CALL_INSN)->jump) + +/* 1 if RTX is a jump_insn, call_insn, or insn that is an annulling branch. */ +#define INSN_ANNULLED_BRANCH_P(RTX) \ + (RTL_FLAG_CHECK1 ("INSN_ANNULLED_BRANCH_P", (RTX), JUMP_INSN)->unchanging) + +/* 1 if RTX is an insn in a delay slot and is from the target of the branch. + If the branch insn has INSN_ANNULLED_BRANCH_P set, this insn should only be + executed if the branch is taken. For annulled branches with this bit + clear, the insn should be executed only if the branch is not taken. */ +#define INSN_FROM_TARGET_P(RTX) \ + (RTL_FLAG_CHECK3 ("INSN_FROM_TARGET_P", (RTX), INSN, JUMP_INSN, \ + CALL_INSN)->in_struct) + +/* In an ADDR_DIFF_VEC, the flags for RTX for use by branch shortening. + See the comments for ADDR_DIFF_VEC in rtl.def. */ +#define ADDR_DIFF_VEC_FLAGS(RTX) X0ADVFLAGS (RTX, 4) + +/* In a VALUE, the value cselib has assigned to RTX. + This is a "struct cselib_val", see cselib.h. */ +#define CSELIB_VAL_PTR(RTX) X0CSELIB (RTX, 0) + +/* Holds a list of notes on what this insn does to various REGs. + It is a chain of EXPR_LIST rtx's, where the second operand is the + chain pointer and the first operand is the REG being described. + The mode field of the EXPR_LIST contains not a real machine mode + but a value from enum reg_note. */ +#define REG_NOTES(INSN) XEXP(INSN, 6) + +/* In an ENTRY_VALUE this is the DECL_INCOMING_RTL of the argument in + question. */ +#define ENTRY_VALUE_EXP(RTX) (RTL_CHECKC1 (RTX, 0, ENTRY_VALUE).rt_rtx) + +enum reg_note +{ +#define DEF_REG_NOTE(NAME) NAME, +#include "reg-notes.def" +#undef DEF_REG_NOTE + REG_NOTE_MAX +}; + +/* Define macros to extract and insert the reg-note kind in an EXPR_LIST. */ +#define REG_NOTE_KIND(LINK) ((enum reg_note) GET_MODE (LINK)) +#define PUT_REG_NOTE_KIND(LINK, KIND) \ + PUT_MODE_RAW (LINK, (machine_mode) (KIND)) + +/* Names for REG_NOTE's in EXPR_LIST insn's. */ + +extern const char * const reg_note_name[]; +#define GET_REG_NOTE_NAME(MODE) (reg_note_name[(int) (MODE)]) + +/* This field is only present on CALL_INSNs. It holds a chain of EXPR_LIST of + USE and CLOBBER expressions. + USE expressions list the registers filled with arguments that + are passed to the function. + CLOBBER expressions document the registers explicitly clobbered + by this CALL_INSN. + Pseudo registers can not be mentioned in this list. */ +#define CALL_INSN_FUNCTION_USAGE(INSN) XEXP(INSN, 7) + +/* The label-number of a code-label. The assembler label + is made from `L' and the label-number printed in decimal. + Label numbers are unique in a compilation. */ +#define CODE_LABEL_NUMBER(INSN) XINT (INSN, 5) + +/* In a NOTE that is a line number, this is a string for the file name that the + line is in. We use the same field to record block numbers temporarily in + NOTE_INSN_BLOCK_BEG and NOTE_INSN_BLOCK_END notes. (We avoid lots of casts + between ints and pointers if we use a different macro for the block number.) + */ + +/* Opaque data. */ +#define NOTE_DATA(INSN) RTL_CHECKC1 (INSN, 3, NOTE) +#define NOTE_DELETED_LABEL_NAME(INSN) XCSTR (INSN, 3, NOTE) +#define SET_INSN_DELETED(INSN) set_insn_deleted (INSN); +#define NOTE_BLOCK(INSN) XCTREE (INSN, 3, NOTE) +#define NOTE_EH_HANDLER(INSN) XCINT (INSN, 3, NOTE) +#define NOTE_BASIC_BLOCK(INSN) XCBBDEF (INSN, 3, NOTE) +#define NOTE_VAR_LOCATION(INSN) XCEXP (INSN, 3, NOTE) +#define NOTE_CFI(INSN) XCCFI (INSN, 3, NOTE) +#define NOTE_LABEL_NUMBER(INSN) XCINT (INSN, 3, NOTE) + +/* In a NOTE that is a line number, this is the line number. + Other kinds of NOTEs are identified by negative numbers here. */ +#define NOTE_KIND(INSN) XCINT (INSN, 4, NOTE) + +/* Nonzero if INSN is a note marking the beginning of a basic block. */ +#define NOTE_INSN_BASIC_BLOCK_P(INSN) \ + (NOTE_P (INSN) && NOTE_KIND (INSN) == NOTE_INSN_BASIC_BLOCK) + +/* Variable declaration and the location of a variable. */ +#define PAT_VAR_LOCATION_DECL(PAT) (XCTREE ((PAT), 0, VAR_LOCATION)) +#define PAT_VAR_LOCATION_LOC(PAT) (XCEXP ((PAT), 1, VAR_LOCATION)) + +/* Initialization status of the variable in the location. Status + can be unknown, uninitialized or initialized. See enumeration + type below. */ +#define PAT_VAR_LOCATION_STATUS(PAT) \ + (RTL_FLAG_CHECK1 ("PAT_VAR_LOCATION_STATUS", PAT, VAR_LOCATION) \ + ->u2.var_location_status) + +/* Accessors for a NOTE_INSN_VAR_LOCATION. */ +#define NOTE_VAR_LOCATION_DECL(NOTE) \ + PAT_VAR_LOCATION_DECL (NOTE_VAR_LOCATION (NOTE)) +#define NOTE_VAR_LOCATION_LOC(NOTE) \ + PAT_VAR_LOCATION_LOC (NOTE_VAR_LOCATION (NOTE)) +#define NOTE_VAR_LOCATION_STATUS(NOTE) \ + PAT_VAR_LOCATION_STATUS (NOTE_VAR_LOCATION (NOTE)) + +/* The VAR_LOCATION rtx in a DEBUG_INSN. */ +#define INSN_VAR_LOCATION(INSN) PATTERN (INSN) + +/* Accessors for a tree-expanded var location debug insn. */ +#define INSN_VAR_LOCATION_DECL(INSN) \ + PAT_VAR_LOCATION_DECL (INSN_VAR_LOCATION (INSN)) +#define INSN_VAR_LOCATION_LOC(INSN) \ + PAT_VAR_LOCATION_LOC (INSN_VAR_LOCATION (INSN)) +#define INSN_VAR_LOCATION_STATUS(INSN) \ + PAT_VAR_LOCATION_STATUS (INSN_VAR_LOCATION (INSN)) + +/* Expand to the RTL that denotes an unknown variable location in a + DEBUG_INSN. */ +#define gen_rtx_UNKNOWN_VAR_LOC() (gen_rtx_CLOBBER (VOIDmode, const0_rtx)) + +/* Determine whether X is such an unknown location. */ +#define VAR_LOC_UNKNOWN_P(X) \ + (GET_CODE (X) == CLOBBER && XEXP ((X), 0) == const0_rtx) + +/* 1 if RTX is emitted after a call, but it should take effect before + the call returns. */ +#define NOTE_DURING_CALL_P(RTX) \ + (RTL_FLAG_CHECK1 ("NOTE_VAR_LOCATION_DURING_CALL_P", (RTX), NOTE)->call) + +/* DEBUG_EXPR_DECL corresponding to a DEBUG_EXPR RTX. */ +#define DEBUG_EXPR_TREE_DECL(RTX) XCTREE (RTX, 0, DEBUG_EXPR) + +/* VAR_DECL/PARM_DECL DEBUG_IMPLICIT_PTR takes address of. */ +#define DEBUG_IMPLICIT_PTR_DECL(RTX) XCTREE (RTX, 0, DEBUG_IMPLICIT_PTR) + +/* PARM_DECL DEBUG_PARAMETER_REF references. */ +#define DEBUG_PARAMETER_REF_DECL(RTX) XCTREE (RTX, 0, DEBUG_PARAMETER_REF) + +/* Codes that appear in the NOTE_KIND field for kinds of notes + that are not line numbers. These codes are all negative. + + Notice that we do not try to use zero here for any of + the special note codes because sometimes the source line + actually can be zero! This happens (for example) when we + are generating code for the per-translation-unit constructor + and destructor routines for some C++ translation unit. */ + +enum insn_note +{ +#define DEF_INSN_NOTE(NAME) NAME, +#include "insn-notes.def" +#undef DEF_INSN_NOTE + + NOTE_INSN_MAX +}; + +/* Names for NOTE insn's other than line numbers. */ + +extern const char * const note_insn_name[NOTE_INSN_MAX]; +#define GET_NOTE_INSN_NAME(NOTE_CODE) \ + (note_insn_name[(NOTE_CODE)]) + +/* The name of a label, in case it corresponds to an explicit label + in the input source code. */ +#define LABEL_NAME(RTX) XCSTR (RTX, 6, CODE_LABEL) + +/* In jump.c, each label contains a count of the number + of LABEL_REFs that point at it, so unused labels can be deleted. */ +#define LABEL_NUSES(RTX) XCINT (RTX, 4, CODE_LABEL) + +/* Labels carry a two-bit field composed of the ->jump and ->call + bits. This field indicates whether the label is an alternate + entry point, and if so, what kind. */ +enum label_kind +{ + LABEL_NORMAL = 0, /* ordinary label */ + LABEL_STATIC_ENTRY, /* alternate entry point, not exported */ + LABEL_GLOBAL_ENTRY, /* alternate entry point, exported */ + LABEL_WEAK_ENTRY /* alternate entry point, exported as weak symbol */ +}; + +#if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION > 2007) + +/* Retrieve the kind of LABEL. */ +#define LABEL_KIND(LABEL) __extension__ \ +({ __typeof (LABEL) const _label = (LABEL); \ + if (! LABEL_P (_label)) \ + rtl_check_failed_flag ("LABEL_KIND", _label, __FILE__, __LINE__, \ + __FUNCTION__); \ + (enum label_kind) ((_label->jump << 1) | _label->call); }) + +/* Set the kind of LABEL. */ +#define SET_LABEL_KIND(LABEL, KIND) do { \ + __typeof (LABEL) const _label = (LABEL); \ + const unsigned int _kind = (KIND); \ + if (! LABEL_P (_label)) \ + rtl_check_failed_flag ("SET_LABEL_KIND", _label, __FILE__, __LINE__, \ + __FUNCTION__); \ + _label->jump = ((_kind >> 1) & 1); \ + _label->call = (_kind & 1); \ +} while (0) + +#else + +/* Retrieve the kind of LABEL. */ +#define LABEL_KIND(LABEL) \ + ((enum label_kind) (((LABEL)->jump << 1) | (LABEL)->call)) + +/* Set the kind of LABEL. */ +#define SET_LABEL_KIND(LABEL, KIND) do { \ + rtx const _label = (LABEL); \ + const unsigned int _kind = (KIND); \ + _label->jump = ((_kind >> 1) & 1); \ + _label->call = (_kind & 1); \ +} while (0) + +#endif /* rtl flag checking */ + +#define LABEL_ALT_ENTRY_P(LABEL) (LABEL_KIND (LABEL) != LABEL_NORMAL) + +/* In jump.c, each JUMP_INSN can point to a label that it can jump to, + so that if the JUMP_INSN is deleted, the label's LABEL_NUSES can + be decremented and possibly the label can be deleted. */ +#define JUMP_LABEL(INSN) XCEXP (INSN, 7, JUMP_INSN) + +inline rtx_insn *JUMP_LABEL_AS_INSN (const rtx_insn *insn) +{ + return safe_as_a (JUMP_LABEL (insn)); +} + +/* Methods of rtx_jump_insn. */ + +inline rtx rtx_jump_insn::jump_label () const +{ + return JUMP_LABEL (this); +} + +inline rtx_code_label *rtx_jump_insn::jump_target () const +{ + return safe_as_a (JUMP_LABEL (this)); +} + +inline void rtx_jump_insn::set_jump_target (rtx_code_label *target) +{ + JUMP_LABEL (this) = target; +} + +/* Once basic blocks are found, each CODE_LABEL starts a chain that + goes through all the LABEL_REFs that jump to that label. The chain + eventually winds up at the CODE_LABEL: it is circular. */ +#define LABEL_REFS(LABEL) XCEXP (LABEL, 3, CODE_LABEL) + +/* Get the label that a LABEL_REF references. */ +static inline rtx_insn * +label_ref_label (const_rtx ref) +{ + return as_a (XCEXP (ref, 0, LABEL_REF)); +} + +/* Set the label that LABEL_REF ref refers to. */ + +static inline void +set_label_ref_label (rtx ref, rtx_insn *label) +{ + XCEXP (ref, 0, LABEL_REF) = label; +} + +/* For a REG rtx, REGNO extracts the register number. REGNO can only + be used on RHS. Use SET_REGNO to change the value. */ +#define REGNO(RTX) (rhs_regno(RTX)) +#define SET_REGNO(RTX, N) (df_ref_change_reg_with_loc (RTX, N)) + +/* Return the number of consecutive registers in a REG. This is always + 1 for pseudo registers and is determined by HARD_REGNO_NREGS for + hard registers. */ +#define REG_NREGS(RTX) (REG_CHECK (RTX)->nregs) + +/* ORIGINAL_REGNO holds the number the register originally had; for a + pseudo register turned into a hard reg this will hold the old pseudo + register number. */ +#define ORIGINAL_REGNO(RTX) \ + (RTL_FLAG_CHECK1 ("ORIGINAL_REGNO", (RTX), REG)->u2.original_regno) + +/* Force the REGNO macro to only be used on the lhs. */ +static inline unsigned int +rhs_regno (const_rtx x) +{ + return REG_CHECK (x)->regno; +} + +/* Return the final register in REG X plus one. */ +static inline unsigned int +END_REGNO (const_rtx x) +{ + return REGNO (x) + REG_NREGS (x); +} + +/* Change the REGNO and REG_NREGS of REG X to the specified values, + bypassing the df machinery. */ +static inline void +set_regno_raw (rtx x, unsigned int regno, unsigned int nregs) +{ + reg_info *reg = REG_CHECK (x); + reg->regno = regno; + reg->nregs = nregs; +} + +/* 1 if RTX is a reg or parallel that is the current function's return + value. */ +#define REG_FUNCTION_VALUE_P(RTX) \ + (RTL_FLAG_CHECK2 ("REG_FUNCTION_VALUE_P", (RTX), REG, PARALLEL)->return_val) + +/* 1 if RTX is a reg that corresponds to a variable declared by the user. */ +#define REG_USERVAR_P(RTX) \ + (RTL_FLAG_CHECK1 ("REG_USERVAR_P", (RTX), REG)->volatil) + +/* 1 if RTX is a reg that holds a pointer value. */ +#define REG_POINTER(RTX) \ + (RTL_FLAG_CHECK1 ("REG_POINTER", (RTX), REG)->frame_related) + +/* 1 if RTX is a mem that holds a pointer value. */ +#define MEM_POINTER(RTX) \ + (RTL_FLAG_CHECK1 ("MEM_POINTER", (RTX), MEM)->frame_related) + +/* 1 if the given register REG corresponds to a hard register. */ +#define HARD_REGISTER_P(REG) (HARD_REGISTER_NUM_P (REGNO (REG))) + +/* 1 if the given register number REG_NO corresponds to a hard register. */ +#define HARD_REGISTER_NUM_P(REG_NO) ((REG_NO) < FIRST_PSEUDO_REGISTER) + +/* For a CONST_INT rtx, INTVAL extracts the integer. */ +#define INTVAL(RTX) XCWINT (RTX, 0, CONST_INT) +#define UINTVAL(RTX) ((unsigned HOST_WIDE_INT) INTVAL (RTX)) + +/* For a CONST_WIDE_INT, CONST_WIDE_INT_NUNITS is the number of + elements actually needed to represent the constant. + CONST_WIDE_INT_ELT gets one of the elements. 0 is the least + significant HOST_WIDE_INT. */ +#define CONST_WIDE_INT_VEC(RTX) HWIVEC_CHECK (RTX, CONST_WIDE_INT) +#define CONST_WIDE_INT_NUNITS(RTX) CWI_GET_NUM_ELEM (RTX) +#define CONST_WIDE_INT_ELT(RTX, N) CWI_ELT (RTX, N) + +/* For a CONST_DOUBLE: +#if TARGET_SUPPORTS_WIDE_INT == 0 + For a VOIDmode, there are two integers CONST_DOUBLE_LOW is the + low-order word and ..._HIGH the high-order. +#endif + For a float, there is a REAL_VALUE_TYPE structure, and + CONST_DOUBLE_REAL_VALUE(r) is a pointer to it. */ +#define CONST_DOUBLE_LOW(r) XCMWINT (r, 0, CONST_DOUBLE, VOIDmode) +#define CONST_DOUBLE_HIGH(r) XCMWINT (r, 1, CONST_DOUBLE, VOIDmode) +#define CONST_DOUBLE_REAL_VALUE(r) \ + ((const struct real_value *) XCNMPRV (r, CONST_DOUBLE, VOIDmode)) + +#define CONST_FIXED_VALUE(r) \ + ((const struct fixed_value *) XCNMPFV (r, CONST_FIXED, VOIDmode)) +#define CONST_FIXED_VALUE_HIGH(r) \ + ((HOST_WIDE_INT) (CONST_FIXED_VALUE (r)->data.high)) +#define CONST_FIXED_VALUE_LOW(r) \ + ((HOST_WIDE_INT) (CONST_FIXED_VALUE (r)->data.low)) + +/* For a CONST_VECTOR, return element #n. */ +#define CONST_VECTOR_ELT(RTX, N) XCVECEXP (RTX, 0, N, CONST_VECTOR) + +/* For a CONST_VECTOR, return the number of elements in a vector. */ +#define CONST_VECTOR_NUNITS(RTX) XCVECLEN (RTX, 0, CONST_VECTOR) + +/* For a SUBREG rtx, SUBREG_REG extracts the value we want a subreg of. + SUBREG_BYTE extracts the byte-number. */ + +#define SUBREG_REG(RTX) XCEXP (RTX, 0, SUBREG) +#define SUBREG_BYTE(RTX) XCUINT (RTX, 1, SUBREG) + +/* in rtlanal.c */ +/* Return the right cost to give to an operation + to make the cost of the corresponding register-to-register instruction + N times that of a fast register-to-register instruction. */ +#define COSTS_N_INSNS(N) ((N) * 4) + +/* Maximum cost of an rtl expression. This value has the special meaning + not to use an rtx with this cost under any circumstances. */ +#define MAX_COST INT_MAX + +/* Return true if CODE always has VOIDmode. */ + +static inline bool +always_void_p (enum rtx_code code) +{ + return code == SET; +} + +/* A structure to hold all available cost information about an rtl + expression. */ +struct full_rtx_costs +{ + int speed; + int size; +}; + +/* Initialize a full_rtx_costs structure C to the maximum cost. */ +static inline void +init_costs_to_max (struct full_rtx_costs *c) +{ + c->speed = MAX_COST; + c->size = MAX_COST; +} + +/* Initialize a full_rtx_costs structure C to zero cost. */ +static inline void +init_costs_to_zero (struct full_rtx_costs *c) +{ + c->speed = 0; + c->size = 0; +} + +/* Compare two full_rtx_costs structures A and B, returning true + if A < B when optimizing for speed. */ +static inline bool +costs_lt_p (struct full_rtx_costs *a, struct full_rtx_costs *b, + bool speed) +{ + if (speed) + return (a->speed < b->speed + || (a->speed == b->speed && a->size < b->size)); + else + return (a->size < b->size + || (a->size == b->size && a->speed < b->speed)); +} + +/* Increase both members of the full_rtx_costs structure C by the + cost of N insns. */ +static inline void +costs_add_n_insns (struct full_rtx_costs *c, int n) +{ + c->speed += COSTS_N_INSNS (n); + c->size += COSTS_N_INSNS (n); +} + +/* Describes the shape of a subreg: + + inner_mode == the mode of the SUBREG_REG + offset == the SUBREG_BYTE + outer_mode == the mode of the SUBREG itself. */ +struct subreg_shape { + subreg_shape (machine_mode, unsigned int, machine_mode); + bool operator == (const subreg_shape &) const; + bool operator != (const subreg_shape &) const; + unsigned int unique_id () const; + + machine_mode inner_mode; + unsigned int offset; + machine_mode outer_mode; +}; + +inline +subreg_shape::subreg_shape (machine_mode inner_mode_in, + unsigned int offset_in, + machine_mode outer_mode_in) + : inner_mode (inner_mode_in), offset (offset_in), outer_mode (outer_mode_in) +{} + +inline bool +subreg_shape::operator == (const subreg_shape &other) const +{ + return (inner_mode == other.inner_mode + && offset == other.offset + && outer_mode == other.outer_mode); +} + +inline bool +subreg_shape::operator != (const subreg_shape &other) const +{ + return !operator == (other); +} + +/* Return an integer that uniquely identifies this shape. Structures + like rtx_def assume that a mode can fit in an 8-bit bitfield and no + current mode is anywhere near being 65536 bytes in size, so the + id comfortably fits in an int. */ + +inline unsigned int +subreg_shape::unique_id () const +{ + STATIC_ASSERT (MAX_MACHINE_MODE <= 256); + return (int) inner_mode + ((int) outer_mode << 8) + (offset << 16); +} + +/* Return the shape of a SUBREG rtx. */ + +static inline subreg_shape +shape_of_subreg (const_rtx x) +{ + return subreg_shape (GET_MODE (SUBREG_REG (x)), + SUBREG_BYTE (x), GET_MODE (x)); +} + +/* Information about an address. This structure is supposed to be able + to represent all supported target addresses. Please extend it if it + is not yet general enough. */ +struct address_info { + /* The mode of the value being addressed, or VOIDmode if this is + a load-address operation with no known address mode. */ + machine_mode mode; + + /* The address space. */ + addr_space_t as; + + /* True if this is an RTX_AUTOINC address. */ + bool autoinc_p; + + /* A pointer to the top-level address. */ + rtx *outer; + + /* A pointer to the inner address, after all address mutations + have been stripped from the top-level address. It can be one + of the following: + + - A {PRE,POST}_{INC,DEC} of *BASE. SEGMENT, INDEX and DISP are null. + + - A {PRE,POST}_MODIFY of *BASE. In this case either INDEX or DISP + points to the step value, depending on whether the step is variable + or constant respectively. SEGMENT is null. + + - A plain sum of the form SEGMENT + BASE + INDEX + DISP, + with null fields evaluating to 0. */ + rtx *inner; + + /* Components that make up *INNER. Each one may be null or nonnull. + When nonnull, their meanings are as follows: + + - *SEGMENT is the "segment" of memory to which the address refers. + This value is entirely target-specific and is only called a "segment" + because that's its most typical use. It contains exactly one UNSPEC, + pointed to by SEGMENT_TERM. The contents of *SEGMENT do not need + reloading. + + - *BASE is a variable expression representing a base address. + It contains exactly one REG, SUBREG or MEM, pointed to by BASE_TERM. + + - *INDEX is a variable expression representing an index value. + It may be a scaled expression, such as a MULT. It has exactly + one REG, SUBREG or MEM, pointed to by INDEX_TERM. + + - *DISP is a constant, possibly mutated. DISP_TERM points to the + unmutated RTX_CONST_OBJ. */ + rtx *segment; + rtx *base; + rtx *index; + rtx *disp; + + rtx *segment_term; + rtx *base_term; + rtx *index_term; + rtx *disp_term; + + /* In a {PRE,POST}_MODIFY address, this points to a second copy + of BASE_TERM, otherwise it is null. */ + rtx *base_term2; + + /* ADDRESS if this structure describes an address operand, MEM if + it describes a MEM address. */ + enum rtx_code addr_outer_code; + + /* If BASE is nonnull, this is the code of the rtx that contains it. */ + enum rtx_code base_outer_code; +}; + +/* This is used to bundle an rtx and a mode together so that the pair + can be used with the wi:: routines. If we ever put modes into rtx + integer constants, this should go away and then just pass an rtx in. */ +typedef std::pair rtx_mode_t; + +namespace wi +{ + template <> + struct int_traits + { + static const enum precision_type precision_type = VAR_PRECISION; + static const bool host_dependent_precision = false; + /* This ought to be true, except for the special case that BImode + is canonicalized to STORE_FLAG_VALUE, which might be 1. */ + static const bool is_sign_extended = false; + static unsigned int get_precision (const rtx_mode_t &); + static wi::storage_ref decompose (HOST_WIDE_INT *, unsigned int, + const rtx_mode_t &); + }; +} + +inline unsigned int +wi::int_traits ::get_precision (const rtx_mode_t &x) +{ + gcc_checking_assert (x.second != BLKmode && x.second != VOIDmode); + return GET_MODE_PRECISION (x.second); +} + +inline wi::storage_ref +wi::int_traits ::decompose (HOST_WIDE_INT *, + unsigned int precision, + const rtx_mode_t &x) +{ + gcc_checking_assert (precision == get_precision (x)); + switch (GET_CODE (x.first)) + { + case CONST_INT: + if (precision < HOST_BITS_PER_WIDE_INT) + /* Nonzero BImodes are stored as STORE_FLAG_VALUE, which on many + targets is 1 rather than -1. */ + gcc_checking_assert (INTVAL (x.first) + == sext_hwi (INTVAL (x.first), precision) + || (x.second == BImode && INTVAL (x.first) == 1)); + + return wi::storage_ref (&INTVAL (x.first), 1, precision); + + case CONST_WIDE_INT: + return wi::storage_ref (&CONST_WIDE_INT_ELT (x.first, 0), + CONST_WIDE_INT_NUNITS (x.first), precision); + +#if TARGET_SUPPORTS_WIDE_INT == 0 + case CONST_DOUBLE: + return wi::storage_ref (&CONST_DOUBLE_LOW (x.first), 2, precision); +#endif + + default: + gcc_unreachable (); + } +} + +namespace wi +{ + hwi_with_prec shwi (HOST_WIDE_INT, machine_mode mode); + wide_int min_value (machine_mode, signop); + wide_int max_value (machine_mode, signop); +} + +inline wi::hwi_with_prec +wi::shwi (HOST_WIDE_INT val, machine_mode mode) +{ + return shwi (val, GET_MODE_PRECISION (mode)); +} + +/* Produce the smallest number that is represented in MODE. The precision + is taken from MODE and the sign from SGN. */ +inline wide_int +wi::min_value (machine_mode mode, signop sgn) +{ + return min_value (GET_MODE_PRECISION (mode), sgn); +} + +/* Produce the largest number that is represented in MODE. The precision + is taken from MODE and the sign from SGN. */ +inline wide_int +wi::max_value (machine_mode mode, signop sgn) +{ + return max_value (GET_MODE_PRECISION (mode), sgn); +} + +extern void init_rtlanal (void); +extern int rtx_cost (rtx, machine_mode, enum rtx_code, int, bool); +extern int address_cost (rtx, machine_mode, addr_space_t, bool); +extern void get_full_rtx_cost (rtx, machine_mode, enum rtx_code, int, + struct full_rtx_costs *); +extern unsigned int subreg_lsb (const_rtx); +extern unsigned int subreg_lsb_1 (machine_mode, machine_mode, + unsigned int); +extern unsigned int subreg_size_offset_from_lsb (unsigned int, unsigned int, + unsigned int); + +/* Return the subreg byte offset for a subreg whose outer mode is + OUTER_MODE, whose inner mode is INNER_MODE, and where there are + LSB_SHIFT *bits* between the lsb of the outer value and the lsb of + the inner value. This is the inverse of subreg_lsb_1 (which converts + byte offsets to bit shifts). */ + +inline unsigned int +subreg_offset_from_lsb (machine_mode outer_mode, + machine_mode inner_mode, + unsigned int lsb_shift) +{ + return subreg_size_offset_from_lsb (GET_MODE_SIZE (outer_mode), + GET_MODE_SIZE (inner_mode), lsb_shift); +} + +extern unsigned int subreg_regno_offset (unsigned int, machine_mode, + unsigned int, machine_mode); +extern bool subreg_offset_representable_p (unsigned int, machine_mode, + unsigned int, machine_mode); +extern unsigned int subreg_regno (const_rtx); +extern int simplify_subreg_regno (unsigned int, machine_mode, + unsigned int, machine_mode); +extern unsigned int subreg_nregs (const_rtx); +extern unsigned int subreg_nregs_with_regno (unsigned int, const_rtx); +extern unsigned HOST_WIDE_INT nonzero_bits (const_rtx, machine_mode); +extern unsigned int num_sign_bit_copies (const_rtx, machine_mode); +extern bool constant_pool_constant_p (rtx); +extern bool truncated_to_mode (machine_mode, const_rtx); +extern int low_bitmask_len (machine_mode, unsigned HOST_WIDE_INT); +extern void split_double (rtx, rtx *, rtx *); +extern rtx *strip_address_mutations (rtx *, enum rtx_code * = 0); +extern void decompose_address (struct address_info *, rtx *, + machine_mode, addr_space_t, enum rtx_code); +extern void decompose_lea_address (struct address_info *, rtx *); +extern void decompose_mem_address (struct address_info *, rtx); +extern void update_address (struct address_info *); +extern HOST_WIDE_INT get_index_scale (const struct address_info *); +extern enum rtx_code get_index_code (const struct address_info *); + +/* 1 if RTX is a subreg containing a reg that is already known to be + sign- or zero-extended from the mode of the subreg to the mode of + the reg. SUBREG_PROMOTED_UNSIGNED_P gives the signedness of the + extension. + + When used as a LHS, is means that this extension must be done + when assigning to SUBREG_REG. */ + +#define SUBREG_PROMOTED_VAR_P(RTX) \ + (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED", (RTX), SUBREG)->in_struct) + +/* Valid for subregs which are SUBREG_PROMOTED_VAR_P(). In that case + this gives the necessary extensions: + 0 - signed (SPR_SIGNED) + 1 - normal unsigned (SPR_UNSIGNED) + 2 - value is both sign and unsign extended for mode + (SPR_SIGNED_AND_UNSIGNED). + -1 - pointer unsigned, which most often can be handled like unsigned + extension, except for generating instructions where we need to + emit special code (ptr_extend insns) on some architectures + (SPR_POINTER). */ + +const int SRP_POINTER = -1; +const int SRP_SIGNED = 0; +const int SRP_UNSIGNED = 1; +const int SRP_SIGNED_AND_UNSIGNED = 2; + +/* Sets promoted mode for SUBREG_PROMOTED_VAR_P(). */ +#define SUBREG_PROMOTED_SET(RTX, VAL) \ +do { \ + rtx const _rtx = RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SET", \ + (RTX), SUBREG); \ + switch (VAL) \ + { \ + case SRP_POINTER: \ + _rtx->volatil = 0; \ + _rtx->unchanging = 0; \ + break; \ + case SRP_SIGNED: \ + _rtx->volatil = 0; \ + _rtx->unchanging = 1; \ + break; \ + case SRP_UNSIGNED: \ + _rtx->volatil = 1; \ + _rtx->unchanging = 0; \ + break; \ + case SRP_SIGNED_AND_UNSIGNED: \ + _rtx->volatil = 1; \ + _rtx->unchanging = 1; \ + break; \ + } \ +} while (0) + +/* Gets the value stored in promoted mode for SUBREG_PROMOTED_VAR_P(), + including SRP_SIGNED_AND_UNSIGNED if promoted for + both signed and unsigned. */ +#define SUBREG_PROMOTED_GET(RTX) \ + (2 * (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_GET", (RTX), SUBREG)->volatil)\ + + (RTX)->unchanging - 1) + +/* Returns sign of promoted mode for SUBREG_PROMOTED_VAR_P(). */ +#define SUBREG_PROMOTED_SIGN(RTX) \ + ((RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SIGN", (RTX), SUBREG)->volatil) ? 1\ + : (RTX)->unchanging - 1) + +/* Predicate to check if RTX of SUBREG_PROMOTED_VAR_P() is promoted + for SIGNED type. */ +#define SUBREG_PROMOTED_SIGNED_P(RTX) \ + (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_SIGNED_P", (RTX), SUBREG)->unchanging) + +/* Predicate to check if RTX of SUBREG_PROMOTED_VAR_P() is promoted + for UNSIGNED type. */ +#define SUBREG_PROMOTED_UNSIGNED_P(RTX) \ + (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_UNSIGNED_P", (RTX), SUBREG)->volatil) + +/* Checks if RTX of SUBREG_PROMOTED_VAR_P() is promoted for given SIGN. */ +#define SUBREG_CHECK_PROMOTED_SIGN(RTX, SIGN) \ +((SIGN) == SRP_POINTER ? SUBREG_PROMOTED_GET (RTX) == SRP_POINTER \ + : (SIGN) == SRP_SIGNED ? SUBREG_PROMOTED_SIGNED_P (RTX) \ + : SUBREG_PROMOTED_UNSIGNED_P (RTX)) + +/* True if the REG is the static chain register for some CALL_INSN. */ +#define STATIC_CHAIN_REG_P(RTX) \ + (RTL_FLAG_CHECK1 ("STATIC_CHAIN_REG_P", (RTX), REG)->jump) + +/* True if the subreg was generated by LRA for reload insns. Such + subregs are valid only during LRA. */ +#define LRA_SUBREG_P(RTX) \ + (RTL_FLAG_CHECK1 ("LRA_SUBREG_P", (RTX), SUBREG)->jump) + +/* True if call is instrumented by Pointer Bounds Checker. */ +#define CALL_EXPR_WITH_BOUNDS_P(RTX) \ + (RTL_FLAG_CHECK1 ("CALL_EXPR_WITH_BOUNDS_P", (RTX), CALL)->jump) + +/* Access various components of an ASM_OPERANDS rtx. */ + +#define ASM_OPERANDS_TEMPLATE(RTX) XCSTR (RTX, 0, ASM_OPERANDS) +#define ASM_OPERANDS_OUTPUT_CONSTRAINT(RTX) XCSTR (RTX, 1, ASM_OPERANDS) +#define ASM_OPERANDS_OUTPUT_IDX(RTX) XCINT (RTX, 2, ASM_OPERANDS) +#define ASM_OPERANDS_INPUT_VEC(RTX) XCVEC (RTX, 3, ASM_OPERANDS) +#define ASM_OPERANDS_INPUT_CONSTRAINT_VEC(RTX) XCVEC (RTX, 4, ASM_OPERANDS) +#define ASM_OPERANDS_INPUT(RTX, N) XCVECEXP (RTX, 3, N, ASM_OPERANDS) +#define ASM_OPERANDS_INPUT_LENGTH(RTX) XCVECLEN (RTX, 3, ASM_OPERANDS) +#define ASM_OPERANDS_INPUT_CONSTRAINT_EXP(RTX, N) \ + XCVECEXP (RTX, 4, N, ASM_OPERANDS) +#define ASM_OPERANDS_INPUT_CONSTRAINT(RTX, N) \ + XSTR (XCVECEXP (RTX, 4, N, ASM_OPERANDS), 0) +#define ASM_OPERANDS_INPUT_MODE(RTX, N) \ + GET_MODE (XCVECEXP (RTX, 4, N, ASM_OPERANDS)) +#define ASM_OPERANDS_LABEL_VEC(RTX) XCVEC (RTX, 5, ASM_OPERANDS) +#define ASM_OPERANDS_LABEL_LENGTH(RTX) XCVECLEN (RTX, 5, ASM_OPERANDS) +#define ASM_OPERANDS_LABEL(RTX, N) XCVECEXP (RTX, 5, N, ASM_OPERANDS) +#define ASM_OPERANDS_SOURCE_LOCATION(RTX) XCUINT (RTX, 6, ASM_OPERANDS) +#define ASM_INPUT_SOURCE_LOCATION(RTX) XCUINT (RTX, 1, ASM_INPUT) + +/* 1 if RTX is a mem that is statically allocated in read-only memory. */ +#define MEM_READONLY_P(RTX) \ + (RTL_FLAG_CHECK1 ("MEM_READONLY_P", (RTX), MEM)->unchanging) + +/* 1 if RTX is a mem and we should keep the alias set for this mem + unchanged when we access a component. Set to 1, or example, when we + are already in a non-addressable component of an aggregate. */ +#define MEM_KEEP_ALIAS_SET_P(RTX) \ + (RTL_FLAG_CHECK1 ("MEM_KEEP_ALIAS_SET_P", (RTX), MEM)->jump) + +/* 1 if RTX is a mem or asm_operand for a volatile reference. */ +#define MEM_VOLATILE_P(RTX) \ + (RTL_FLAG_CHECK3 ("MEM_VOLATILE_P", (RTX), MEM, ASM_OPERANDS, \ + ASM_INPUT)->volatil) + +/* 1 if RTX is a mem that cannot trap. */ +#define MEM_NOTRAP_P(RTX) \ + (RTL_FLAG_CHECK1 ("MEM_NOTRAP_P", (RTX), MEM)->call) + +/* The memory attribute block. We provide access macros for each value + in the block and provide defaults if none specified. */ +#define MEM_ATTRS(RTX) X0MEMATTR (RTX, 1) + +/* The register attribute block. We provide access macros for each value + in the block and provide defaults if none specified. */ +#define REG_ATTRS(RTX) (REG_CHECK (RTX)->attrs) + +#ifndef GENERATOR_FILE +/* For a MEM rtx, the alias set. If 0, this MEM is not in any alias + set, and may alias anything. Otherwise, the MEM can only alias + MEMs in a conflicting alias set. This value is set in a + language-dependent manner in the front-end, and should not be + altered in the back-end. These set numbers are tested with + alias_sets_conflict_p. */ +#define MEM_ALIAS_SET(RTX) (get_mem_attrs (RTX)->alias) + +/* For a MEM rtx, the decl it is known to refer to, if it is known to + refer to part of a DECL. It may also be a COMPONENT_REF. */ +#define MEM_EXPR(RTX) (get_mem_attrs (RTX)->expr) + +/* For a MEM rtx, true if its MEM_OFFSET is known. */ +#define MEM_OFFSET_KNOWN_P(RTX) (get_mem_attrs (RTX)->offset_known_p) + +/* For a MEM rtx, the offset from the start of MEM_EXPR. */ +#define MEM_OFFSET(RTX) (get_mem_attrs (RTX)->offset) + +/* For a MEM rtx, the address space. */ +#define MEM_ADDR_SPACE(RTX) (get_mem_attrs (RTX)->addrspace) + +/* For a MEM rtx, true if its MEM_SIZE is known. */ +#define MEM_SIZE_KNOWN_P(RTX) (get_mem_attrs (RTX)->size_known_p) + +/* For a MEM rtx, the size in bytes of the MEM. */ +#define MEM_SIZE(RTX) (get_mem_attrs (RTX)->size) + +/* For a MEM rtx, the alignment in bits. We can use the alignment of the + mode as a default when STRICT_ALIGNMENT, but not if not. */ +#define MEM_ALIGN(RTX) (get_mem_attrs (RTX)->align) +#else +#define MEM_ADDR_SPACE(RTX) ADDR_SPACE_GENERIC +#endif + +/* For a REG rtx, the decl it is known to refer to, if it is known to + refer to part of a DECL. */ +#define REG_EXPR(RTX) (REG_ATTRS (RTX) == 0 ? 0 : REG_ATTRS (RTX)->decl) + +/* For a REG rtx, the offset from the start of REG_EXPR, if known, as an + HOST_WIDE_INT. */ +#define REG_OFFSET(RTX) (REG_ATTRS (RTX) == 0 ? 0 : REG_ATTRS (RTX)->offset) + +/* Copy the attributes that apply to memory locations from RHS to LHS. */ +#define MEM_COPY_ATTRIBUTES(LHS, RHS) \ + (MEM_VOLATILE_P (LHS) = MEM_VOLATILE_P (RHS), \ + MEM_NOTRAP_P (LHS) = MEM_NOTRAP_P (RHS), \ + MEM_READONLY_P (LHS) = MEM_READONLY_P (RHS), \ + MEM_KEEP_ALIAS_SET_P (LHS) = MEM_KEEP_ALIAS_SET_P (RHS), \ + MEM_POINTER (LHS) = MEM_POINTER (RHS), \ + MEM_ATTRS (LHS) = MEM_ATTRS (RHS)) + +/* 1 if RTX is a label_ref for a nonlocal label. */ +/* Likewise in an expr_list for a REG_LABEL_OPERAND or + REG_LABEL_TARGET note. */ +#define LABEL_REF_NONLOCAL_P(RTX) \ + (RTL_FLAG_CHECK1 ("LABEL_REF_NONLOCAL_P", (RTX), LABEL_REF)->volatil) + +/* 1 if RTX is a code_label that should always be considered to be needed. */ +#define LABEL_PRESERVE_P(RTX) \ + (RTL_FLAG_CHECK2 ("LABEL_PRESERVE_P", (RTX), CODE_LABEL, NOTE)->in_struct) + +/* During sched, 1 if RTX is an insn that must be scheduled together + with the preceding insn. */ +#define SCHED_GROUP_P(RTX) \ + (RTL_FLAG_CHECK4 ("SCHED_GROUP_P", (RTX), DEBUG_INSN, INSN, \ + JUMP_INSN, CALL_INSN)->in_struct) + +/* For a SET rtx, SET_DEST is the place that is set + and SET_SRC is the value it is set to. */ +#define SET_DEST(RTX) XC2EXP (RTX, 0, SET, CLOBBER) +#define SET_SRC(RTX) XCEXP (RTX, 1, SET) +#define SET_IS_RETURN_P(RTX) \ + (RTL_FLAG_CHECK1 ("SET_IS_RETURN_P", (RTX), SET)->jump) + +/* For a TRAP_IF rtx, TRAP_CONDITION is an expression. */ +#define TRAP_CONDITION(RTX) XCEXP (RTX, 0, TRAP_IF) +#define TRAP_CODE(RTX) XCEXP (RTX, 1, TRAP_IF) + +/* For a COND_EXEC rtx, COND_EXEC_TEST is the condition to base + conditionally executing the code on, COND_EXEC_CODE is the code + to execute if the condition is true. */ +#define COND_EXEC_TEST(RTX) XCEXP (RTX, 0, COND_EXEC) +#define COND_EXEC_CODE(RTX) XCEXP (RTX, 1, COND_EXEC) + +/* 1 if RTX is a symbol_ref that addresses this function's rtl + constants pool. */ +#define CONSTANT_POOL_ADDRESS_P(RTX) \ + (RTL_FLAG_CHECK1 ("CONSTANT_POOL_ADDRESS_P", (RTX), SYMBOL_REF)->unchanging) + +/* 1 if RTX is a symbol_ref that addresses a value in the file's + tree constant pool. This information is private to varasm.c. */ +#define TREE_CONSTANT_POOL_ADDRESS_P(RTX) \ + (RTL_FLAG_CHECK1 ("TREE_CONSTANT_POOL_ADDRESS_P", \ + (RTX), SYMBOL_REF)->frame_related) + +/* Used if RTX is a symbol_ref, for machine-specific purposes. */ +#define SYMBOL_REF_FLAG(RTX) \ + (RTL_FLAG_CHECK1 ("SYMBOL_REF_FLAG", (RTX), SYMBOL_REF)->volatil) + +/* 1 if RTX is a symbol_ref that has been the library function in + emit_library_call. */ +#define SYMBOL_REF_USED(RTX) \ + (RTL_FLAG_CHECK1 ("SYMBOL_REF_USED", (RTX), SYMBOL_REF)->used) + +/* 1 if RTX is a symbol_ref for a weak symbol. */ +#define SYMBOL_REF_WEAK(RTX) \ + (RTL_FLAG_CHECK1 ("SYMBOL_REF_WEAK", (RTX), SYMBOL_REF)->return_val) + +/* A pointer attached to the SYMBOL_REF; either SYMBOL_REF_DECL or + SYMBOL_REF_CONSTANT. */ +#define SYMBOL_REF_DATA(RTX) X0ANY ((RTX), 1) + +/* Set RTX's SYMBOL_REF_DECL to DECL. RTX must not be a constant + pool symbol. */ +#define SET_SYMBOL_REF_DECL(RTX, DECL) \ + (gcc_assert (!CONSTANT_POOL_ADDRESS_P (RTX)), X0TREE ((RTX), 1) = (DECL)) + +/* The tree (decl or constant) associated with the symbol, or null. */ +#define SYMBOL_REF_DECL(RTX) \ + (CONSTANT_POOL_ADDRESS_P (RTX) ? NULL : X0TREE ((RTX), 1)) + +/* Set RTX's SYMBOL_REF_CONSTANT to C. RTX must be a constant pool symbol. */ +#define SET_SYMBOL_REF_CONSTANT(RTX, C) \ + (gcc_assert (CONSTANT_POOL_ADDRESS_P (RTX)), X0CONSTANT ((RTX), 1) = (C)) + +/* The rtx constant pool entry for a symbol, or null. */ +#define SYMBOL_REF_CONSTANT(RTX) \ + (CONSTANT_POOL_ADDRESS_P (RTX) ? X0CONSTANT ((RTX), 1) : NULL) + +/* A set of flags on a symbol_ref that are, in some respects, redundant with + information derivable from the tree decl associated with this symbol. + Except that we build a *lot* of SYMBOL_REFs that aren't associated with a + decl. In some cases this is a bug. But beyond that, it's nice to cache + this information to avoid recomputing it. Finally, this allows space for + the target to store more than one bit of information, as with + SYMBOL_REF_FLAG. */ +#define SYMBOL_REF_FLAGS(RTX) \ + (RTL_FLAG_CHECK1 ("SYMBOL_REF_FLAGS", (RTX), SYMBOL_REF) \ + ->u2.symbol_ref_flags) + +/* These flags are common enough to be defined for all targets. They + are computed by the default version of targetm.encode_section_info. */ + +/* Set if this symbol is a function. */ +#define SYMBOL_FLAG_FUNCTION (1 << 0) +#define SYMBOL_REF_FUNCTION_P(RTX) \ + ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_FUNCTION) != 0) +/* Set if targetm.binds_local_p is true. */ +#define SYMBOL_FLAG_LOCAL (1 << 1) +#define SYMBOL_REF_LOCAL_P(RTX) \ + ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_LOCAL) != 0) +/* Set if targetm.in_small_data_p is true. */ +#define SYMBOL_FLAG_SMALL (1 << 2) +#define SYMBOL_REF_SMALL_P(RTX) \ + ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_SMALL) != 0) +/* The three-bit field at [5:3] is true for TLS variables; use + SYMBOL_REF_TLS_MODEL to extract the field as an enum tls_model. */ +#define SYMBOL_FLAG_TLS_SHIFT 3 +#define SYMBOL_REF_TLS_MODEL(RTX) \ + ((enum tls_model) ((SYMBOL_REF_FLAGS (RTX) >> SYMBOL_FLAG_TLS_SHIFT) & 7)) +/* Set if this symbol is not defined in this translation unit. */ +#define SYMBOL_FLAG_EXTERNAL (1 << 6) +#define SYMBOL_REF_EXTERNAL_P(RTX) \ + ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_EXTERNAL) != 0) +/* Set if this symbol has a block_symbol structure associated with it. */ +#define SYMBOL_FLAG_HAS_BLOCK_INFO (1 << 7) +#define SYMBOL_REF_HAS_BLOCK_INFO_P(RTX) \ + ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_HAS_BLOCK_INFO) != 0) +/* Set if this symbol is a section anchor. SYMBOL_REF_ANCHOR_P implies + SYMBOL_REF_HAS_BLOCK_INFO_P. */ +#define SYMBOL_FLAG_ANCHOR (1 << 8) +#define SYMBOL_REF_ANCHOR_P(RTX) \ + ((SYMBOL_REF_FLAGS (RTX) & SYMBOL_FLAG_ANCHOR) != 0) + +/* Subsequent bits are available for the target to use. */ +#define SYMBOL_FLAG_MACH_DEP_SHIFT 9 +#define SYMBOL_FLAG_MACH_DEP (1 << SYMBOL_FLAG_MACH_DEP_SHIFT) + +/* If SYMBOL_REF_HAS_BLOCK_INFO_P (RTX), this is the object_block + structure to which the symbol belongs, or NULL if it has not been + assigned a block. */ +#define SYMBOL_REF_BLOCK(RTX) (BLOCK_SYMBOL_CHECK (RTX)->block) + +/* If SYMBOL_REF_HAS_BLOCK_INFO_P (RTX), this is the offset of RTX from + the first object in SYMBOL_REF_BLOCK (RTX). The value is negative if + RTX has not yet been assigned to a block, or it has not been given an + offset within that block. */ +#define SYMBOL_REF_BLOCK_OFFSET(RTX) (BLOCK_SYMBOL_CHECK (RTX)->offset) + +/* True if RTX is flagged to be a scheduling barrier. */ +#define PREFETCH_SCHEDULE_BARRIER_P(RTX) \ + (RTL_FLAG_CHECK1 ("PREFETCH_SCHEDULE_BARRIER_P", (RTX), PREFETCH)->volatil) + +/* Indicate whether the machine has any sort of auto increment addressing. + If not, we can avoid checking for REG_INC notes. */ + +#if (defined (HAVE_PRE_INCREMENT) || defined (HAVE_PRE_DECREMENT) \ + || defined (HAVE_POST_INCREMENT) || defined (HAVE_POST_DECREMENT) \ + || defined (HAVE_PRE_MODIFY_DISP) || defined (HAVE_POST_MODIFY_DISP) \ + || defined (HAVE_PRE_MODIFY_REG) || defined (HAVE_POST_MODIFY_REG)) +#define AUTO_INC_DEC 1 +#else +#define AUTO_INC_DEC 0 +#endif + +/* Define a macro to look for REG_INC notes, + but save time on machines where they never exist. */ + +#if AUTO_INC_DEC +#define FIND_REG_INC_NOTE(INSN, REG) \ + ((REG) != NULL_RTX && REG_P ((REG)) \ + ? find_regno_note ((INSN), REG_INC, REGNO (REG)) \ + : find_reg_note ((INSN), REG_INC, (REG))) +#else +#define FIND_REG_INC_NOTE(INSN, REG) 0 +#endif + +#ifndef HAVE_PRE_INCREMENT +#define HAVE_PRE_INCREMENT 0 +#endif + +#ifndef HAVE_PRE_DECREMENT +#define HAVE_PRE_DECREMENT 0 +#endif + +#ifndef HAVE_POST_INCREMENT +#define HAVE_POST_INCREMENT 0 +#endif + +#ifndef HAVE_POST_DECREMENT +#define HAVE_POST_DECREMENT 0 +#endif + +#ifndef HAVE_POST_MODIFY_DISP +#define HAVE_POST_MODIFY_DISP 0 +#endif + +#ifndef HAVE_POST_MODIFY_REG +#define HAVE_POST_MODIFY_REG 0 +#endif + +#ifndef HAVE_PRE_MODIFY_DISP +#define HAVE_PRE_MODIFY_DISP 0 +#endif + +#ifndef HAVE_PRE_MODIFY_REG +#define HAVE_PRE_MODIFY_REG 0 +#endif + + +/* Some architectures do not have complete pre/post increment/decrement + instruction sets, or only move some modes efficiently. These macros + allow us to tune autoincrement generation. */ + +#ifndef USE_LOAD_POST_INCREMENT +#define USE_LOAD_POST_INCREMENT(MODE) HAVE_POST_INCREMENT +#endif + +#ifndef USE_LOAD_POST_DECREMENT +#define USE_LOAD_POST_DECREMENT(MODE) HAVE_POST_DECREMENT +#endif + +#ifndef USE_LOAD_PRE_INCREMENT +#define USE_LOAD_PRE_INCREMENT(MODE) HAVE_PRE_INCREMENT +#endif + +#ifndef USE_LOAD_PRE_DECREMENT +#define USE_LOAD_PRE_DECREMENT(MODE) HAVE_PRE_DECREMENT +#endif + +#ifndef USE_STORE_POST_INCREMENT +#define USE_STORE_POST_INCREMENT(MODE) HAVE_POST_INCREMENT +#endif + +#ifndef USE_STORE_POST_DECREMENT +#define USE_STORE_POST_DECREMENT(MODE) HAVE_POST_DECREMENT +#endif + +#ifndef USE_STORE_PRE_INCREMENT +#define USE_STORE_PRE_INCREMENT(MODE) HAVE_PRE_INCREMENT +#endif + +#ifndef USE_STORE_PRE_DECREMENT +#define USE_STORE_PRE_DECREMENT(MODE) HAVE_PRE_DECREMENT +#endif + +/* Nonzero when we are generating CONCATs. */ +extern int generating_concat_p; + +/* Nonzero when we are expanding trees to RTL. */ +extern int currently_expanding_to_rtl; + +/* Generally useful functions. */ + +#ifndef GENERATOR_FILE +/* Return the cost of SET X. SPEED_P is true if optimizing for speed + rather than size. */ + +static inline int +set_rtx_cost (rtx x, bool speed_p) +{ + return rtx_cost (x, VOIDmode, INSN, 4, speed_p); +} + +/* Like set_rtx_cost, but return both the speed and size costs in C. */ + +static inline void +get_full_set_rtx_cost (rtx x, struct full_rtx_costs *c) +{ + get_full_rtx_cost (x, VOIDmode, INSN, 4, c); +} + +/* Return the cost of moving X into a register, relative to the cost + of a register move. SPEED_P is true if optimizing for speed rather + than size. */ + +static inline int +set_src_cost (rtx x, machine_mode mode, bool speed_p) +{ + return rtx_cost (x, mode, SET, 1, speed_p); +} + +/* Like set_src_cost, but return both the speed and size costs in C. */ + +static inline void +get_full_set_src_cost (rtx x, machine_mode mode, struct full_rtx_costs *c) +{ + get_full_rtx_cost (x, mode, SET, 1, c); +} +#endif + +/* A convenience macro to validate the arguments of a zero_extract + expression. It determines whether SIZE lies inclusively within + [1, RANGE], POS lies inclusively within between [0, RANGE - 1] + and the sum lies inclusively within [1, RANGE]. RANGE must be + >= 1, but SIZE and POS may be negative. */ +#define EXTRACT_ARGS_IN_RANGE(SIZE, POS, RANGE) \ + (IN_RANGE ((POS), 0, (unsigned HOST_WIDE_INT) (RANGE) - 1) \ + && IN_RANGE ((SIZE), 1, (unsigned HOST_WIDE_INT) (RANGE) \ + - (unsigned HOST_WIDE_INT)(POS))) + +/* In explow.c */ +extern HOST_WIDE_INT trunc_int_for_mode (HOST_WIDE_INT, machine_mode); +extern rtx plus_constant (machine_mode, rtx, HOST_WIDE_INT, bool = false); + +/* In rtl.c */ +extern rtx rtx_alloc_stat (RTX_CODE MEM_STAT_DECL); +#define rtx_alloc(c) rtx_alloc_stat (c MEM_STAT_INFO) +extern rtx rtx_alloc_stat_v (RTX_CODE MEM_STAT_DECL, int); +#define rtx_alloc_v(c, SZ) rtx_alloc_stat_v (c MEM_STAT_INFO, SZ) +#define const_wide_int_alloc(NWORDS) \ + rtx_alloc_v (CONST_WIDE_INT, \ + (sizeof (struct hwivec_def) \ + + ((NWORDS)-1) * sizeof (HOST_WIDE_INT))) \ + +extern rtvec rtvec_alloc (int); +extern rtvec shallow_copy_rtvec (rtvec); +extern bool shared_const_p (const_rtx); +extern rtx copy_rtx (rtx); +extern enum rtx_code classify_insn (rtx); +extern void dump_rtx_statistics (void); + +/* In emit-rtl.c */ +extern rtx copy_rtx_if_shared (rtx); + +/* In rtl.c */ +extern unsigned int rtx_size (const_rtx); +extern rtx shallow_copy_rtx_stat (const_rtx MEM_STAT_DECL); +#define shallow_copy_rtx(a) shallow_copy_rtx_stat (a MEM_STAT_INFO) +extern int rtx_equal_p (const_rtx, const_rtx); +extern bool rtvec_all_equal_p (const_rtvec); + +/* Return true if X is a vector constant with a duplicated element value. */ + +inline bool +const_vec_duplicate_p (const_rtx x) +{ + return GET_CODE (x) == CONST_VECTOR && rtvec_all_equal_p (XVEC (x, 0)); +} + +/* Return true if X is a vector constant with a duplicated element value. + Store the duplicated element in *ELT if so. */ + +template +inline bool +const_vec_duplicate_p (T x, T *elt) +{ + if (const_vec_duplicate_p (x)) + { + *elt = CONST_VECTOR_ELT (x, 0); + return true; + } + return false; +} + +/* If X is a vector constant with a duplicated element value, return that + element value, otherwise return X. */ + +template +inline T +unwrap_const_vec_duplicate (T x) +{ + if (const_vec_duplicate_p (x)) + x = CONST_VECTOR_ELT (x, 0); + return x; +} + +/* In emit-rtl.c */ +extern rtvec gen_rtvec_v (int, rtx *); +extern rtvec gen_rtvec_v (int, rtx_insn **); +extern rtx gen_reg_rtx (machine_mode); +extern rtx gen_rtx_REG_offset (rtx, machine_mode, unsigned int, int); +extern rtx gen_reg_rtx_offset (rtx, machine_mode, int); +extern rtx gen_reg_rtx_and_attrs (rtx); +extern rtx_code_label *gen_label_rtx (void); +extern rtx gen_lowpart_common (machine_mode, rtx); + +/* In cse.c */ +extern rtx gen_lowpart_if_possible (machine_mode, rtx); + +/* In emit-rtl.c */ +extern rtx gen_highpart (machine_mode, rtx); +extern rtx gen_highpart_mode (machine_mode, machine_mode, rtx); +extern rtx operand_subword (rtx, unsigned int, int, machine_mode); + +/* In emit-rtl.c */ +extern rtx operand_subword_force (rtx, unsigned int, machine_mode); +extern bool paradoxical_subreg_p (const_rtx); +extern int subreg_lowpart_p (const_rtx); +extern unsigned int subreg_size_lowpart_offset (unsigned int, unsigned int); + +/* Return the SUBREG_BYTE for an OUTERMODE lowpart of an INNERMODE value. */ + +inline unsigned int +subreg_lowpart_offset (machine_mode outermode, machine_mode innermode) +{ + return subreg_size_lowpart_offset (GET_MODE_SIZE (outermode), + GET_MODE_SIZE (innermode)); +} + +extern unsigned int subreg_size_highpart_offset (unsigned int, unsigned int); + +/* Return the SUBREG_BYTE for an OUTERMODE highpart of an INNERMODE value. */ + +inline unsigned int +subreg_highpart_offset (machine_mode outermode, machine_mode innermode) +{ + return subreg_size_highpart_offset (GET_MODE_SIZE (outermode), + GET_MODE_SIZE (innermode)); +} + +extern int byte_lowpart_offset (machine_mode, machine_mode); +extern rtx make_safe_from (rtx, rtx); +extern rtx convert_memory_address_addr_space_1 (machine_mode, rtx, + addr_space_t, bool, bool); +extern rtx convert_memory_address_addr_space (machine_mode, rtx, + addr_space_t); +#define convert_memory_address(to_mode,x) \ + convert_memory_address_addr_space ((to_mode), (x), ADDR_SPACE_GENERIC) +extern const char *get_insn_name (int); +extern rtx_insn *get_last_insn_anywhere (void); +extern rtx_insn *get_first_nonnote_insn (void); +extern rtx_insn *get_last_nonnote_insn (void); +extern void start_sequence (void); +extern void push_to_sequence (rtx_insn *); +extern void push_to_sequence2 (rtx_insn *, rtx_insn *); +extern void end_sequence (void); +#if TARGET_SUPPORTS_WIDE_INT == 0 +extern double_int rtx_to_double_int (const_rtx); +#endif +extern void cwi_output_hex (FILE *, const_rtx); +#ifndef GENERATOR_FILE +extern rtx immed_wide_int_const (const wide_int_ref &, machine_mode); +#endif +#if TARGET_SUPPORTS_WIDE_INT == 0 +extern rtx immed_double_const (HOST_WIDE_INT, HOST_WIDE_INT, + machine_mode); +#endif + +/* In varasm.c */ +extern rtx force_const_mem (machine_mode, rtx); + +/* In varasm.c */ + +struct function; +extern rtx get_pool_constant (const_rtx); +extern rtx get_pool_constant_mark (rtx, bool *); +extern machine_mode get_pool_mode (const_rtx); +extern rtx simplify_subtraction (rtx); +extern void decide_function_section (tree); + +/* In emit-rtl.c */ +extern rtx_insn *emit_insn_before (rtx, rtx); +extern rtx_insn *emit_insn_before_noloc (rtx, rtx_insn *, basic_block); +extern rtx_insn *emit_insn_before_setloc (rtx, rtx_insn *, int); +extern rtx_jump_insn *emit_jump_insn_before (rtx, rtx); +extern rtx_jump_insn *emit_jump_insn_before_noloc (rtx, rtx_insn *); +extern rtx_jump_insn *emit_jump_insn_before_setloc (rtx, rtx_insn *, int); +extern rtx_insn *emit_call_insn_before (rtx, rtx_insn *); +extern rtx_insn *emit_call_insn_before_noloc (rtx, rtx_insn *); +extern rtx_insn *emit_call_insn_before_setloc (rtx, rtx_insn *, int); +extern rtx_insn *emit_debug_insn_before (rtx, rtx_insn *); +extern rtx_insn *emit_debug_insn_before_noloc (rtx, rtx); +extern rtx_insn *emit_debug_insn_before_setloc (rtx, rtx, int); +extern rtx_barrier *emit_barrier_before (rtx); +extern rtx_code_label *emit_label_before (rtx, rtx_insn *); +extern rtx_note *emit_note_before (enum insn_note, rtx_insn *); +extern rtx_insn *emit_insn_after (rtx, rtx); +extern rtx_insn *emit_insn_after_noloc (rtx, rtx, basic_block); +extern rtx_insn *emit_insn_after_setloc (rtx, rtx, int); +extern rtx_jump_insn *emit_jump_insn_after (rtx, rtx); +extern rtx_jump_insn *emit_jump_insn_after_noloc (rtx, rtx); +extern rtx_jump_insn *emit_jump_insn_after_setloc (rtx, rtx, int); +extern rtx_insn *emit_call_insn_after (rtx, rtx); +extern rtx_insn *emit_call_insn_after_noloc (rtx, rtx); +extern rtx_insn *emit_call_insn_after_setloc (rtx, rtx, int); +extern rtx_insn *emit_debug_insn_after (rtx, rtx); +extern rtx_insn *emit_debug_insn_after_noloc (rtx, rtx); +extern rtx_insn *emit_debug_insn_after_setloc (rtx, rtx, int); +extern rtx_barrier *emit_barrier_after (rtx); +extern rtx_insn *emit_label_after (rtx, rtx_insn *); +extern rtx_note *emit_note_after (enum insn_note, rtx_insn *); +extern rtx_insn *emit_insn (rtx); +extern rtx_insn *emit_debug_insn (rtx); +extern rtx_insn *emit_jump_insn (rtx); +extern rtx_insn *emit_call_insn (rtx); +extern rtx_code_label *emit_label (rtx); +extern rtx_jump_table_data *emit_jump_table_data (rtx); +extern rtx_barrier *emit_barrier (void); +extern rtx_note *emit_note (enum insn_note); +extern rtx_note *emit_note_copy (rtx_note *); +extern rtx_insn *gen_clobber (rtx); +extern rtx_insn *emit_clobber (rtx); +extern rtx_insn *gen_use (rtx); +extern rtx_insn *emit_use (rtx); +extern rtx_insn *make_insn_raw (rtx); +extern void add_function_usage_to (rtx, rtx); +extern rtx_call_insn *last_call_insn (void); +extern rtx_insn *previous_insn (rtx_insn *); +extern rtx_insn *next_insn (rtx_insn *); +extern rtx_insn *prev_nonnote_insn (rtx_insn *); +extern rtx_insn *prev_nonnote_insn_bb (rtx_insn *); +extern rtx_insn *next_nonnote_insn (rtx_insn *); +extern rtx_insn *next_nonnote_insn_bb (rtx_insn *); +extern rtx_insn *prev_nondebug_insn (rtx_insn *); +extern rtx_insn *next_nondebug_insn (rtx_insn *); +extern rtx_insn *prev_nonnote_nondebug_insn (rtx_insn *); +extern rtx_insn *next_nonnote_nondebug_insn (rtx_insn *); +extern rtx_insn *prev_real_insn (rtx_insn *); +extern rtx_insn *next_real_insn (rtx); +extern rtx_insn *prev_active_insn (rtx_insn *); +extern rtx_insn *next_active_insn (rtx_insn *); +extern int active_insn_p (const rtx_insn *); +extern rtx_insn *next_cc0_user (rtx_insn *); +extern rtx_insn *prev_cc0_setter (rtx_insn *); + +/* In emit-rtl.c */ +extern int insn_line (const rtx_insn *); +extern const char * insn_file (const rtx_insn *); +extern tree insn_scope (const rtx_insn *); +extern expanded_location insn_location (const rtx_insn *); +extern location_t prologue_location, epilogue_location; + +/* In jump.c */ +extern enum rtx_code reverse_condition (enum rtx_code); +extern enum rtx_code reverse_condition_maybe_unordered (enum rtx_code); +extern enum rtx_code swap_condition (enum rtx_code); +extern enum rtx_code unsigned_condition (enum rtx_code); +extern enum rtx_code signed_condition (enum rtx_code); +extern void mark_jump_label (rtx, rtx_insn *, int); + +/* In jump.c */ +extern rtx_insn *delete_related_insns (rtx); + +/* In recog.c */ +extern rtx *find_constant_term_loc (rtx *); + +/* In emit-rtl.c */ +extern rtx_insn *try_split (rtx, rtx_insn *, int); +extern int split_branch_probability; + +/* In insn-recog.c (generated by genrecog). */ +extern rtx_insn *split_insns (rtx, rtx_insn *); + +/* In simplify-rtx.c */ +extern rtx simplify_const_unary_operation (enum rtx_code, machine_mode, + rtx, machine_mode); +extern rtx simplify_unary_operation (enum rtx_code, machine_mode, rtx, + machine_mode); +extern rtx simplify_const_binary_operation (enum rtx_code, machine_mode, + rtx, rtx); +extern rtx simplify_binary_operation (enum rtx_code, machine_mode, rtx, + rtx); +extern rtx simplify_ternary_operation (enum rtx_code, machine_mode, + machine_mode, rtx, rtx, rtx); +extern rtx simplify_const_relational_operation (enum rtx_code, + machine_mode, rtx, rtx); +extern rtx simplify_relational_operation (enum rtx_code, machine_mode, + machine_mode, rtx, rtx); +extern rtx simplify_gen_binary (enum rtx_code, machine_mode, rtx, rtx); +extern rtx simplify_gen_unary (enum rtx_code, machine_mode, rtx, + machine_mode); +extern rtx simplify_gen_ternary (enum rtx_code, machine_mode, + machine_mode, rtx, rtx, rtx); +extern rtx simplify_gen_relational (enum rtx_code, machine_mode, + machine_mode, rtx, rtx); +extern rtx simplify_subreg (machine_mode, rtx, machine_mode, + unsigned int); +extern rtx simplify_gen_subreg (machine_mode, rtx, machine_mode, + unsigned int); +extern rtx lowpart_subreg (machine_mode, rtx, machine_mode); +extern rtx simplify_replace_fn_rtx (rtx, const_rtx, + rtx (*fn) (rtx, const_rtx, void *), void *); +extern rtx simplify_replace_rtx (rtx, const_rtx, rtx); +extern rtx simplify_rtx (const_rtx); +extern rtx avoid_constant_pool_reference (rtx); +extern rtx delegitimize_mem_from_attrs (rtx); +extern bool mode_signbit_p (machine_mode, const_rtx); +extern bool val_signbit_p (machine_mode, unsigned HOST_WIDE_INT); +extern bool val_signbit_known_set_p (machine_mode, + unsigned HOST_WIDE_INT); +extern bool val_signbit_known_clear_p (machine_mode, + unsigned HOST_WIDE_INT); + +/* In reginfo.c */ +extern machine_mode choose_hard_reg_mode (unsigned int, unsigned int, + bool); +extern const HARD_REG_SET &simplifiable_subregs (const subreg_shape &); + +/* In emit-rtl.c */ +extern rtx set_for_reg_notes (rtx); +extern rtx set_unique_reg_note (rtx, enum reg_note, rtx); +extern rtx set_dst_reg_note (rtx, enum reg_note, rtx, rtx); +extern void set_insn_deleted (rtx); + +/* Functions in rtlanal.c */ + +extern rtx single_set_2 (const rtx_insn *, const_rtx); +extern bool contains_symbol_ref_p (const_rtx); +extern bool contains_symbolic_reference_p (const_rtx); + +/* Handle the cheap and common cases inline for performance. */ + +inline rtx single_set (const rtx_insn *insn) +{ + if (!INSN_P (insn)) + return NULL_RTX; + + if (GET_CODE (PATTERN (insn)) == SET) + return PATTERN (insn); + + /* Defer to the more expensive case. */ + return single_set_2 (insn, PATTERN (insn)); +} + +extern machine_mode get_address_mode (rtx mem); +extern int rtx_addr_can_trap_p (const_rtx); +extern bool nonzero_address_p (const_rtx); +extern int rtx_unstable_p (const_rtx); +extern bool rtx_varies_p (const_rtx, bool); +extern bool rtx_addr_varies_p (const_rtx, bool); +extern rtx get_call_rtx_from (rtx); +extern HOST_WIDE_INT get_integer_term (const_rtx); +extern rtx get_related_value (const_rtx); +extern bool offset_within_block_p (const_rtx, HOST_WIDE_INT); +extern void split_const (rtx, rtx *, rtx *); +extern bool unsigned_reg_p (rtx); +extern int reg_mentioned_p (const_rtx, const_rtx); +extern int count_occurrences (const_rtx, const_rtx, int); +extern int reg_referenced_p (const_rtx, const_rtx); +extern int reg_used_between_p (const_rtx, const rtx_insn *, const rtx_insn *); +extern int reg_set_between_p (const_rtx, const rtx_insn *, const rtx_insn *); +extern int commutative_operand_precedence (rtx); +extern bool swap_commutative_operands_p (rtx, rtx); +extern int modified_between_p (const_rtx, const rtx_insn *, const rtx_insn *); +extern int no_labels_between_p (const rtx_insn *, const rtx_insn *); +extern int modified_in_p (const_rtx, const_rtx); +extern int reg_set_p (const_rtx, const_rtx); +extern int multiple_sets (const_rtx); +extern int set_noop_p (const_rtx); +extern int noop_move_p (const rtx_insn *); +extern bool refers_to_regno_p (unsigned int, unsigned int, const_rtx, rtx *); +extern int reg_overlap_mentioned_p (const_rtx, const_rtx); +extern const_rtx set_of (const_rtx, const_rtx); +extern void record_hard_reg_sets (rtx, const_rtx, void *); +extern void record_hard_reg_uses (rtx *, void *); +extern void find_all_hard_regs (const_rtx, HARD_REG_SET *); +extern void find_all_hard_reg_sets (const rtx_insn *, HARD_REG_SET *, bool); +extern void note_stores (const_rtx, void (*) (rtx, const_rtx, void *), void *); +extern void note_uses (rtx *, void (*) (rtx *, void *), void *); +extern int dead_or_set_p (const rtx_insn *, const_rtx); +extern int dead_or_set_regno_p (const rtx_insn *, unsigned int); +extern rtx find_reg_note (const_rtx, enum reg_note, const_rtx); +extern rtx find_regno_note (const_rtx, enum reg_note, unsigned int); +extern rtx find_reg_equal_equiv_note (const_rtx); +extern rtx find_constant_src (const rtx_insn *); +extern int find_reg_fusage (const_rtx, enum rtx_code, const_rtx); +extern int find_regno_fusage (const_rtx, enum rtx_code, unsigned int); +extern rtx alloc_reg_note (enum reg_note, rtx, rtx); +extern void add_reg_note (rtx, enum reg_note, rtx); +extern void add_int_reg_note (rtx_insn *, enum reg_note, int); +extern void add_shallow_copy_of_reg_note (rtx_insn *, rtx); +extern rtx duplicate_reg_note (rtx); +extern void remove_note (rtx_insn *, const_rtx); +extern bool remove_reg_equal_equiv_notes (rtx_insn *); +extern void remove_reg_equal_equiv_notes_for_regno (unsigned int); +extern int side_effects_p (const_rtx); +extern int volatile_refs_p (const_rtx); +extern int volatile_insn_p (const_rtx); +extern int may_trap_p_1 (const_rtx, unsigned); +extern int may_trap_p (const_rtx); +extern int may_trap_or_fault_p (const_rtx); +extern bool can_throw_internal (const_rtx); +extern bool can_throw_external (const_rtx); +extern bool insn_could_throw_p (const_rtx); +extern bool insn_nothrow_p (const_rtx); +extern bool can_nonlocal_goto (const rtx_insn *); +extern void copy_reg_eh_region_note_forward (rtx, rtx_insn *, rtx); +extern void copy_reg_eh_region_note_backward (rtx, rtx_insn *, rtx); +extern int inequality_comparisons_p (const_rtx); +extern rtx replace_rtx (rtx, rtx, rtx, bool = false); +extern void replace_label (rtx *, rtx, rtx, bool); +extern void replace_label_in_insn (rtx_insn *, rtx_insn *, rtx_insn *, bool); +extern bool rtx_referenced_p (const_rtx, const_rtx); +extern bool tablejump_p (const rtx_insn *, rtx_insn **, rtx_jump_table_data **); +extern int computed_jump_p (const rtx_insn *); +extern bool tls_referenced_p (const_rtx); +extern bool contains_mem_rtx_p (rtx x); + +/* Overload for refers_to_regno_p for checking a single register. */ +inline bool +refers_to_regno_p (unsigned int regnum, const_rtx x, rtx* loc = NULL) +{ + return refers_to_regno_p (regnum, regnum + 1, x, loc); +} + +/* Callback for for_each_inc_dec, to process the autoinc operation OP + within MEM that sets DEST to SRC + SRCOFF, or SRC if SRCOFF is + NULL. The callback is passed the same opaque ARG passed to + for_each_inc_dec. Return zero to continue looking for other + autoinc operations or any other value to interrupt the traversal and + return that value to the caller of for_each_inc_dec. */ +typedef int (*for_each_inc_dec_fn) (rtx mem, rtx op, rtx dest, rtx src, + rtx srcoff, void *arg); +extern int for_each_inc_dec (rtx, for_each_inc_dec_fn, void *arg); + +typedef int (*rtx_equal_p_callback_function) (const_rtx *, const_rtx *, + rtx *, rtx *); +extern int rtx_equal_p_cb (const_rtx, const_rtx, + rtx_equal_p_callback_function); + +typedef int (*hash_rtx_callback_function) (const_rtx, machine_mode, rtx *, + machine_mode *); +extern unsigned hash_rtx_cb (const_rtx, machine_mode, int *, int *, + bool, hash_rtx_callback_function); + +extern rtx regno_use_in (unsigned int, rtx); +extern int auto_inc_p (const_rtx); +extern bool in_insn_list_p (const rtx_insn_list *, const rtx_insn *); +extern void remove_node_from_expr_list (const_rtx, rtx_expr_list **); +extern void remove_node_from_insn_list (const rtx_insn *, rtx_insn_list **); +extern int loc_mentioned_in_p (rtx *, const_rtx); +extern rtx_insn *find_first_parameter_load (rtx_insn *, rtx_insn *); +extern bool keep_with_call_p (const rtx_insn *); +extern bool label_is_jump_target_p (const_rtx, const rtx_insn *); +extern int insn_rtx_cost (rtx, bool); +extern unsigned seq_cost (const rtx_insn *, bool); + +/* Given an insn and condition, return a canonical description of + the test being made. */ +extern rtx canonicalize_condition (rtx_insn *, rtx, int, rtx_insn **, rtx, + int, int); + +/* Given a JUMP_INSN, return a canonical description of the test + being made. */ +extern rtx get_condition (rtx_insn *, rtx_insn **, int, int); + +/* Information about a subreg of a hard register. */ +struct subreg_info +{ + /* Offset of first hard register involved in the subreg. */ + int offset; + /* Number of hard registers involved in the subreg. In the case of + a paradoxical subreg, this is the number of registers that would + be modified by writing to the subreg; some of them may be don't-care + when reading from the subreg. */ + int nregs; + /* Whether this subreg can be represented as a hard reg with the new + mode (by adding OFFSET to the original hard register). */ + bool representable_p; +}; + +extern void subreg_get_info (unsigned int, machine_mode, + unsigned int, machine_mode, + struct subreg_info *); + +/* lists.c */ + +extern void free_EXPR_LIST_list (rtx_expr_list **); +extern void free_INSN_LIST_list (rtx_insn_list **); +extern void free_EXPR_LIST_node (rtx); +extern void free_INSN_LIST_node (rtx); +extern rtx_insn_list *alloc_INSN_LIST (rtx, rtx); +extern rtx_insn_list *copy_INSN_LIST (rtx_insn_list *); +extern rtx_insn_list *concat_INSN_LIST (rtx_insn_list *, rtx_insn_list *); +extern rtx_expr_list *alloc_EXPR_LIST (int, rtx, rtx); +extern void remove_free_INSN_LIST_elem (rtx_insn *, rtx_insn_list **); +extern rtx remove_list_elem (rtx, rtx *); +extern rtx_insn *remove_free_INSN_LIST_node (rtx_insn_list **); +extern rtx remove_free_EXPR_LIST_node (rtx_expr_list **); + + +/* reginfo.c */ + +/* Resize reg info. */ +extern bool resize_reg_info (void); +/* Free up register info memory. */ +extern void free_reg_info (void); +extern void init_subregs_of_mode (void); +extern void finish_subregs_of_mode (void); + +/* recog.c */ +extern rtx extract_asm_operands (rtx); +extern int asm_noperands (const_rtx); +extern const char *decode_asm_operands (rtx, rtx *, rtx **, const char **, + machine_mode *, location_t *); +extern void get_referenced_operands (const char *, bool *, unsigned int); + +extern enum reg_class reg_preferred_class (int); +extern enum reg_class reg_alternate_class (int); +extern enum reg_class reg_allocno_class (int); +extern void setup_reg_classes (int, enum reg_class, enum reg_class, + enum reg_class); + +extern void split_all_insns (void); +extern unsigned int split_all_insns_noflow (void); + +#define MAX_SAVED_CONST_INT 64 +extern GTY(()) rtx const_int_rtx[MAX_SAVED_CONST_INT * 2 + 1]; + +#define const0_rtx (const_int_rtx[MAX_SAVED_CONST_INT]) +#define const1_rtx (const_int_rtx[MAX_SAVED_CONST_INT+1]) +#define const2_rtx (const_int_rtx[MAX_SAVED_CONST_INT+2]) +#define constm1_rtx (const_int_rtx[MAX_SAVED_CONST_INT-1]) +extern GTY(()) rtx const_true_rtx; + +extern GTY(()) rtx const_tiny_rtx[4][(int) MAX_MACHINE_MODE]; + +/* Returns a constant 0 rtx in mode MODE. Integer modes are treated the + same as VOIDmode. */ + +#define CONST0_RTX(MODE) (const_tiny_rtx[0][(int) (MODE)]) + +/* Likewise, for the constants 1 and 2 and -1. */ + +#define CONST1_RTX(MODE) (const_tiny_rtx[1][(int) (MODE)]) +#define CONST2_RTX(MODE) (const_tiny_rtx[2][(int) (MODE)]) +#define CONSTM1_RTX(MODE) (const_tiny_rtx[3][(int) (MODE)]) + +extern GTY(()) rtx pc_rtx; +extern GTY(()) rtx cc0_rtx; +extern GTY(()) rtx ret_rtx; +extern GTY(()) rtx simple_return_rtx; +extern GTY(()) rtx_insn *invalid_insn_rtx; + +/* If HARD_FRAME_POINTER_REGNUM is defined, then a special dummy reg + is used to represent the frame pointer. This is because the + hard frame pointer and the automatic variables are separated by an amount + that cannot be determined until after register allocation. We can assume + that in this case ELIMINABLE_REGS will be defined, one action of which + will be to eliminate FRAME_POINTER_REGNUM into HARD_FRAME_POINTER_REGNUM. */ +#ifndef HARD_FRAME_POINTER_REGNUM +#define HARD_FRAME_POINTER_REGNUM FRAME_POINTER_REGNUM +#endif + +#ifndef HARD_FRAME_POINTER_IS_FRAME_POINTER +#define HARD_FRAME_POINTER_IS_FRAME_POINTER \ + (HARD_FRAME_POINTER_REGNUM == FRAME_POINTER_REGNUM) +#endif + +#ifndef HARD_FRAME_POINTER_IS_ARG_POINTER +#define HARD_FRAME_POINTER_IS_ARG_POINTER \ + (HARD_FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM) +#endif + +/* Index labels for global_rtl. */ +enum global_rtl_index +{ + GR_STACK_POINTER, + GR_FRAME_POINTER, +/* For register elimination to work properly these hard_frame_pointer_rtx, + frame_pointer_rtx, and arg_pointer_rtx must be the same if they refer to + the same register. */ +#if FRAME_POINTER_REGNUM == ARG_POINTER_REGNUM + GR_ARG_POINTER = GR_FRAME_POINTER, +#endif +#if HARD_FRAME_POINTER_IS_FRAME_POINTER + GR_HARD_FRAME_POINTER = GR_FRAME_POINTER, +#else + GR_HARD_FRAME_POINTER, +#endif +#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM +#if HARD_FRAME_POINTER_IS_ARG_POINTER + GR_ARG_POINTER = GR_HARD_FRAME_POINTER, +#else + GR_ARG_POINTER, +#endif +#endif + GR_VIRTUAL_INCOMING_ARGS, + GR_VIRTUAL_STACK_ARGS, + GR_VIRTUAL_STACK_DYNAMIC, + GR_VIRTUAL_OUTGOING_ARGS, + GR_VIRTUAL_CFA, + GR_VIRTUAL_PREFERRED_STACK_BOUNDARY, + + GR_MAX +}; + +/* Target-dependent globals. */ +struct GTY(()) target_rtl { + /* All references to the hard registers in global_rtl_index go through + these unique rtl objects. On machines where the frame-pointer and + arg-pointer are the same register, they use the same unique object. + + After register allocation, other rtl objects which used to be pseudo-regs + may be clobbered to refer to the frame-pointer register. + But references that were originally to the frame-pointer can be + distinguished from the others because they contain frame_pointer_rtx. + + When to use frame_pointer_rtx and hard_frame_pointer_rtx is a little + tricky: until register elimination has taken place hard_frame_pointer_rtx + should be used if it is being set, and frame_pointer_rtx otherwise. After + register elimination hard_frame_pointer_rtx should always be used. + On machines where the two registers are same (most) then these are the + same. */ + rtx x_global_rtl[GR_MAX]; + + /* A unique representation of (REG:Pmode PIC_OFFSET_TABLE_REGNUM). */ + rtx x_pic_offset_table_rtx; + + /* A unique representation of (REG:Pmode RETURN_ADDRESS_POINTER_REGNUM). + This is used to implement __builtin_return_address for some machines; + see for instance the MIPS port. */ + rtx x_return_address_pointer_rtx; + + /* Commonly used RTL for hard registers. These objects are not + necessarily unique, so we allocate them separately from global_rtl. + They are initialized once per compilation unit, then copied into + regno_reg_rtx at the beginning of each function. */ + rtx x_initial_regno_reg_rtx[FIRST_PSEUDO_REGISTER]; + + /* A sample (mem:M stack_pointer_rtx) rtx for each mode M. */ + rtx x_top_of_stack[MAX_MACHINE_MODE]; + + /* Static hunks of RTL used by the aliasing code; these are treated + as persistent to avoid unnecessary RTL allocations. */ + rtx x_static_reg_base_value[FIRST_PSEUDO_REGISTER]; + + /* The default memory attributes for each mode. */ + struct mem_attrs *x_mode_mem_attrs[(int) MAX_MACHINE_MODE]; + + /* Track if RTL has been initialized. */ + bool target_specific_initialized; +}; + +extern GTY(()) struct target_rtl default_target_rtl; +#if SWITCHABLE_TARGET +extern struct target_rtl *this_target_rtl; +#else +#define this_target_rtl (&default_target_rtl) +#endif + +#define global_rtl \ + (this_target_rtl->x_global_rtl) +#define pic_offset_table_rtx \ + (this_target_rtl->x_pic_offset_table_rtx) +#define return_address_pointer_rtx \ + (this_target_rtl->x_return_address_pointer_rtx) +#define top_of_stack \ + (this_target_rtl->x_top_of_stack) +#define mode_mem_attrs \ + (this_target_rtl->x_mode_mem_attrs) + +/* All references to certain hard regs, except those created + by allocating pseudo regs into them (when that's possible), + go through these unique rtx objects. */ +#define stack_pointer_rtx (global_rtl[GR_STACK_POINTER]) +#define frame_pointer_rtx (global_rtl[GR_FRAME_POINTER]) +#define hard_frame_pointer_rtx (global_rtl[GR_HARD_FRAME_POINTER]) +#define arg_pointer_rtx (global_rtl[GR_ARG_POINTER]) + +#ifndef GENERATOR_FILE +/* Return the attributes of a MEM rtx. */ +static inline const struct mem_attrs * +get_mem_attrs (const_rtx x) +{ + struct mem_attrs *attrs; + + attrs = MEM_ATTRS (x); + if (!attrs) + attrs = mode_mem_attrs[(int) GET_MODE (x)]; + return attrs; +} +#endif + +/* Include the RTL generation functions. */ + +#ifndef GENERATOR_FILE +#include "genrtl.h" +#undef gen_rtx_ASM_INPUT +#define gen_rtx_ASM_INPUT(MODE, ARG0) \ + gen_rtx_fmt_si (ASM_INPUT, (MODE), (ARG0), 0) +#define gen_rtx_ASM_INPUT_loc(MODE, ARG0, LOC) \ + gen_rtx_fmt_si (ASM_INPUT, (MODE), (ARG0), (LOC)) +#endif + +/* There are some RTL codes that require special attention; the + generation functions included above do the raw handling. If you + add to this list, modify special_rtx in gengenrtl.c as well. */ + +extern rtx_expr_list *gen_rtx_EXPR_LIST (machine_mode, rtx, rtx); +extern rtx_insn_list *gen_rtx_INSN_LIST (machine_mode, rtx, rtx); +extern rtx_insn * +gen_rtx_INSN (machine_mode mode, rtx_insn *prev_insn, rtx_insn *next_insn, + basic_block bb, rtx pattern, int location, int code, + rtx reg_notes); +extern rtx gen_rtx_CONST_INT (machine_mode, HOST_WIDE_INT); +extern rtx gen_rtx_CONST_VECTOR (machine_mode, rtvec); +extern void set_mode_and_regno (rtx, machine_mode, unsigned int); +extern rtx gen_raw_REG (machine_mode, unsigned int); +extern rtx gen_rtx_REG (machine_mode, unsigned int); +extern rtx gen_rtx_SUBREG (machine_mode, rtx, int); +extern rtx gen_rtx_MEM (machine_mode, rtx); +extern rtx gen_rtx_VAR_LOCATION (machine_mode, tree, rtx, + enum var_init_status); + +#ifdef GENERATOR_FILE +#define PUT_MODE(RTX, MODE) PUT_MODE_RAW (RTX, MODE) +#else +static inline void +PUT_MODE (rtx x, machine_mode mode) +{ + if (REG_P (x)) + set_mode_and_regno (x, mode, REGNO (x)); + else + PUT_MODE_RAW (x, mode); +} +#endif + +#define GEN_INT(N) gen_rtx_CONST_INT (VOIDmode, (N)) + +/* Virtual registers are used during RTL generation to refer to locations into + the stack frame when the actual location isn't known until RTL generation + is complete. The routine instantiate_virtual_regs replaces these with + the proper value, which is normally {frame,arg,stack}_pointer_rtx plus + a constant. */ + +#define FIRST_VIRTUAL_REGISTER (FIRST_PSEUDO_REGISTER) + +/* This points to the first word of the incoming arguments passed on the stack, + either by the caller or by the callee when pretending it was passed by the + caller. */ + +#define virtual_incoming_args_rtx (global_rtl[GR_VIRTUAL_INCOMING_ARGS]) + +#define VIRTUAL_INCOMING_ARGS_REGNUM (FIRST_VIRTUAL_REGISTER) + +/* If FRAME_GROWS_DOWNWARD, this points to immediately above the first + variable on the stack. Otherwise, it points to the first variable on + the stack. */ + +#define virtual_stack_vars_rtx (global_rtl[GR_VIRTUAL_STACK_ARGS]) + +#define VIRTUAL_STACK_VARS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 1) + +/* This points to the location of dynamically-allocated memory on the stack + immediately after the stack pointer has been adjusted by the amount + desired. */ + +#define virtual_stack_dynamic_rtx (global_rtl[GR_VIRTUAL_STACK_DYNAMIC]) + +#define VIRTUAL_STACK_DYNAMIC_REGNUM ((FIRST_VIRTUAL_REGISTER) + 2) + +/* This points to the location in the stack at which outgoing arguments should + be written when the stack is pre-pushed (arguments pushed using push + insns always use sp). */ + +#define virtual_outgoing_args_rtx (global_rtl[GR_VIRTUAL_OUTGOING_ARGS]) + +#define VIRTUAL_OUTGOING_ARGS_REGNUM ((FIRST_VIRTUAL_REGISTER) + 3) + +/* This points to the Canonical Frame Address of the function. This + should correspond to the CFA produced by INCOMING_FRAME_SP_OFFSET, + but is calculated relative to the arg pointer for simplicity; the + frame pointer nor stack pointer are necessarily fixed relative to + the CFA until after reload. */ + +#define virtual_cfa_rtx (global_rtl[GR_VIRTUAL_CFA]) + +#define VIRTUAL_CFA_REGNUM ((FIRST_VIRTUAL_REGISTER) + 4) + +#define LAST_VIRTUAL_POINTER_REGISTER ((FIRST_VIRTUAL_REGISTER) + 4) + +/* This is replaced by crtl->preferred_stack_boundary / BITS_PER_UNIT + when finalized. */ + +#define virtual_preferred_stack_boundary_rtx \ + (global_rtl[GR_VIRTUAL_PREFERRED_STACK_BOUNDARY]) + +#define VIRTUAL_PREFERRED_STACK_BOUNDARY_REGNUM \ + ((FIRST_VIRTUAL_REGISTER) + 5) + +#define LAST_VIRTUAL_REGISTER ((FIRST_VIRTUAL_REGISTER) + 5) + +/* Nonzero if REGNUM is a pointer into the stack frame. */ +#define REGNO_PTR_FRAME_P(REGNUM) \ + ((REGNUM) == STACK_POINTER_REGNUM \ + || (REGNUM) == FRAME_POINTER_REGNUM \ + || (REGNUM) == HARD_FRAME_POINTER_REGNUM \ + || (REGNUM) == ARG_POINTER_REGNUM \ + || ((REGNUM) >= FIRST_VIRTUAL_REGISTER \ + && (REGNUM) <= LAST_VIRTUAL_POINTER_REGISTER)) + +/* REGNUM never really appearing in the INSN stream. */ +#define INVALID_REGNUM (~(unsigned int) 0) + +/* REGNUM for which no debug information can be generated. */ +#define IGNORED_DWARF_REGNUM (INVALID_REGNUM - 1) + +extern rtx output_constant_def (tree, int); +extern rtx lookup_constant_def (tree); + +/* Nonzero after end of reload pass. + Set to 1 or 0 by reload1.c. */ + +extern int reload_completed; + +/* Nonzero after thread_prologue_and_epilogue_insns has run. */ +extern int epilogue_completed; + +/* Set to 1 while reload_as_needed is operating. + Required by some machines to handle any generated moves differently. */ + +extern int reload_in_progress; + +/* Set to 1 while in lra. */ +extern int lra_in_progress; + +/* This macro indicates whether you may create a new + pseudo-register. */ + +#define can_create_pseudo_p() (!reload_in_progress && !reload_completed) + +#ifdef STACK_REGS +/* Nonzero after end of regstack pass. + Set to 1 or 0 by reg-stack.c. */ +extern int regstack_completed; +#endif + +/* If this is nonzero, we do not bother generating VOLATILE + around volatile memory references, and we are willing to + output indirect addresses. If cse is to follow, we reject + indirect addresses so a useful potential cse is generated; + if it is used only once, instruction combination will produce + the same indirect address eventually. */ +extern int cse_not_expected; + +/* Translates rtx code to tree code, for those codes needed by + real_arithmetic. The function returns an int because the caller may not + know what `enum tree_code' means. */ + +extern int rtx_to_tree_code (enum rtx_code); + +/* In cse.c */ +extern int delete_trivially_dead_insns (rtx_insn *, int); +extern int exp_equiv_p (const_rtx, const_rtx, int, bool); +extern unsigned hash_rtx (const_rtx x, machine_mode, int *, int *, bool); + +/* In dse.c */ +extern bool check_for_inc_dec (rtx_insn *insn); + +/* In jump.c */ +extern int comparison_dominates_p (enum rtx_code, enum rtx_code); +extern bool jump_to_label_p (const rtx_insn *); +extern int condjump_p (const rtx_insn *); +extern int any_condjump_p (const rtx_insn *); +extern int any_uncondjump_p (const rtx_insn *); +extern rtx pc_set (const rtx_insn *); +extern rtx condjump_label (const rtx_insn *); +extern int simplejump_p (const rtx_insn *); +extern int returnjump_p (const rtx_insn *); +extern int eh_returnjump_p (rtx_insn *); +extern int onlyjump_p (const rtx_insn *); +extern int only_sets_cc0_p (const_rtx); +extern int sets_cc0_p (const_rtx); +extern int invert_jump_1 (rtx_jump_insn *, rtx); +extern int invert_jump (rtx_jump_insn *, rtx, int); +extern int rtx_renumbered_equal_p (const_rtx, const_rtx); +extern int true_regnum (const_rtx); +extern unsigned int reg_or_subregno (const_rtx); +extern int redirect_jump_1 (rtx_insn *, rtx); +extern void redirect_jump_2 (rtx_jump_insn *, rtx, rtx, int, int); +extern int redirect_jump (rtx_jump_insn *, rtx, int); +extern void rebuild_jump_labels (rtx_insn *); +extern void rebuild_jump_labels_chain (rtx_insn *); +extern rtx reversed_comparison (const_rtx, machine_mode); +extern enum rtx_code reversed_comparison_code (const_rtx, const rtx_insn *); +extern enum rtx_code reversed_comparison_code_parts (enum rtx_code, const_rtx, + const_rtx, const rtx_insn *); +extern void delete_for_peephole (rtx_insn *, rtx_insn *); +extern int condjump_in_parallel_p (const rtx_insn *); + +/* In emit-rtl.c. */ +extern int max_reg_num (void); +extern int max_label_num (void); +extern int get_first_label_num (void); +extern void maybe_set_first_label_num (rtx_code_label *); +extern void delete_insns_since (rtx_insn *); +extern void mark_reg_pointer (rtx, int); +extern void mark_user_reg (rtx); +extern void reset_used_flags (rtx); +extern void set_used_flags (rtx); +extern void reorder_insns (rtx_insn *, rtx_insn *, rtx_insn *); +extern void reorder_insns_nobb (rtx_insn *, rtx_insn *, rtx_insn *); +extern int get_max_insn_count (void); +extern int in_sequence_p (void); +extern void init_emit (void); +extern void init_emit_regs (void); +extern void init_derived_machine_modes (void); +extern void init_emit_once (void); +extern void push_topmost_sequence (void); +extern void pop_topmost_sequence (void); +extern void set_new_first_and_last_insn (rtx_insn *, rtx_insn *); +extern unsigned int unshare_all_rtl (void); +extern void unshare_all_rtl_again (rtx_insn *); +extern void unshare_all_rtl_in_chain (rtx_insn *); +extern void verify_rtl_sharing (void); +extern void add_insn (rtx_insn *); +extern void add_insn_before (rtx, rtx, basic_block); +extern void add_insn_after (rtx, rtx, basic_block); +extern void remove_insn (rtx); +extern rtx_insn *emit (rtx, bool = true); +extern void emit_insn_at_entry (rtx); +extern rtx gen_lowpart_SUBREG (machine_mode, rtx); +extern rtx gen_const_mem (machine_mode, rtx); +extern rtx gen_frame_mem (machine_mode, rtx); +extern rtx gen_tmp_stack_mem (machine_mode, rtx); +extern bool validate_subreg (machine_mode, machine_mode, + const_rtx, unsigned int); + +/* In combine.c */ +extern unsigned int extended_count (const_rtx, machine_mode, int); +extern rtx remove_death (unsigned int, rtx_insn *); +extern void dump_combine_stats (FILE *); +extern void dump_combine_total_stats (FILE *); +extern rtx make_compound_operation (rtx, enum rtx_code); + +/* In sched-rgn.c. */ +extern void schedule_insns (void); + +/* In sched-ebb.c. */ +extern void schedule_ebbs (void); + +/* In sel-sched-dump.c. */ +extern void sel_sched_fix_param (const char *param, const char *val); + +/* In print-rtl.c */ +extern const char *print_rtx_head; +extern void debug (const rtx_def &ref); +extern void debug (const rtx_def *ptr); +extern void debug_rtx (const_rtx); +extern void debug_rtx_list (const rtx_insn *, int); +extern void debug_rtx_range (const rtx_insn *, const rtx_insn *); +extern const rtx_insn *debug_rtx_find (const rtx_insn *, int); +extern void print_mem_expr (FILE *, const_tree); +extern void print_rtl (FILE *, const_rtx); +extern void print_simple_rtl (FILE *, const_rtx); +extern int print_rtl_single (FILE *, const_rtx); +extern int print_rtl_single_with_indent (FILE *, const_rtx, int); +extern void print_inline_rtx (FILE *, const_rtx, int); + +/* In stmt.c */ +extern void expand_null_return (void); +extern void expand_naked_return (void); +extern void emit_jump (rtx); + +/* In expr.c */ +extern rtx move_by_pieces (rtx, rtx, unsigned HOST_WIDE_INT, + unsigned int, int); +extern HOST_WIDE_INT find_args_size_adjust (rtx_insn *); +extern int fixup_args_size_notes (rtx_insn *, rtx_insn *, int); + +/* In expmed.c */ +extern void init_expmed (void); +extern void expand_inc (rtx, rtx); +extern void expand_dec (rtx, rtx); + +/* In lower-subreg.c */ +extern void init_lower_subreg (void); + +/* In gcse.c */ +extern bool can_copy_p (machine_mode); +extern bool can_assign_to_reg_without_clobbers_p (rtx, machine_mode); +extern rtx fis_get_condition (rtx_insn *); + +/* In ira.c */ +extern HARD_REG_SET eliminable_regset; +extern void mark_elimination (int, int); + +/* In reginfo.c */ +extern int reg_classes_intersect_p (reg_class_t, reg_class_t); +extern int reg_class_subset_p (reg_class_t, reg_class_t); +extern void globalize_reg (tree, int); +extern void init_reg_modes_target (void); +extern void init_regs (void); +extern void reinit_regs (void); +extern void init_fake_stack_mems (void); +extern void save_register_info (void); +extern void init_reg_sets (void); +extern void regclass (rtx, int); +extern void reg_scan (rtx_insn *, unsigned int); +extern void fix_register (const char *, int, int); +extern const HARD_REG_SET *valid_mode_changes_for_regno (unsigned int); + +/* In reload1.c */ +extern int function_invariant_p (const_rtx); + +/* In calls.c */ +enum libcall_type +{ + LCT_NORMAL = 0, + LCT_CONST = 1, + LCT_PURE = 2, + LCT_NORETURN = 3, + LCT_THROW = 4, + LCT_RETURNS_TWICE = 5 +}; + +extern void emit_library_call (rtx, enum libcall_type, machine_mode, int, + ...); +extern rtx emit_library_call_value (rtx, rtx, enum libcall_type, + machine_mode, int, ...); + +/* In varasm.c */ +extern void init_varasm_once (void); + +extern rtx make_debug_expr_from_rtl (const_rtx); + +/* In read-rtl.c */ +#ifdef GENERATOR_FILE +extern bool read_rtx (const char *, vec *); +#endif + +/* In alias.c */ +extern rtx canon_rtx (rtx); +extern int true_dependence (const_rtx, machine_mode, const_rtx); +extern rtx get_addr (rtx); +extern int canon_true_dependence (const_rtx, machine_mode, rtx, + const_rtx, rtx); +extern int read_dependence (const_rtx, const_rtx); +extern int anti_dependence (const_rtx, const_rtx); +extern int canon_anti_dependence (const_rtx, bool, + const_rtx, machine_mode, rtx); +extern int output_dependence (const_rtx, const_rtx); +extern int canon_output_dependence (const_rtx, bool, + const_rtx, machine_mode, rtx); +extern int may_alias_p (const_rtx, const_rtx); +extern void init_alias_target (void); +extern void init_alias_analysis (void); +extern void end_alias_analysis (void); +extern void vt_equate_reg_base_value (const_rtx, const_rtx); +extern bool memory_modified_in_insn_p (const_rtx, const_rtx); +extern bool may_be_sp_based_p (rtx); +extern rtx gen_hard_reg_clobber (machine_mode, unsigned int); +extern rtx get_reg_known_value (unsigned int); +extern bool get_reg_known_equiv_p (unsigned int); +extern rtx get_reg_base_value (unsigned int); + +#ifdef STACK_REGS +extern int stack_regs_mentioned (const_rtx insn); +#endif + +/* In toplev.c */ +extern GTY(()) rtx stack_limit_rtx; + +/* In var-tracking.c */ +extern unsigned int variable_tracking_main (void); + +/* In stor-layout.c. */ +extern void get_mode_bounds (machine_mode, int, machine_mode, + rtx *, rtx *); + +/* In loop-iv.c */ +extern rtx canon_condition (rtx); +extern void simplify_using_condition (rtx, rtx *, bitmap); + +/* In final.c */ +extern unsigned int compute_alignments (void); +extern void update_alignments (vec &); +extern int asm_str_count (const char *templ); + +struct rtl_hooks +{ + rtx (*gen_lowpart) (machine_mode, rtx); + rtx (*gen_lowpart_no_emit) (machine_mode, rtx); + rtx (*reg_nonzero_bits) (const_rtx, machine_mode, const_rtx, machine_mode, + unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT *); + rtx (*reg_num_sign_bit_copies) (const_rtx, machine_mode, const_rtx, machine_mode, + unsigned int, unsigned int *); + bool (*reg_truncated_to_mode) (machine_mode, const_rtx); + + /* Whenever you add entries here, make sure you adjust rtlhooks-def.h. */ +}; + +/* Each pass can provide its own. */ +extern struct rtl_hooks rtl_hooks; + +/* ... but then it has to restore these. */ +extern const struct rtl_hooks general_rtl_hooks; + +/* Keep this for the nonce. */ +#define gen_lowpart rtl_hooks.gen_lowpart + +extern void insn_locations_init (void); +extern void insn_locations_finalize (void); +extern void set_curr_insn_location (location_t); +extern location_t curr_insn_location (void); + +/* rtl-error.c */ +extern void _fatal_insn_not_found (const_rtx, const char *, int, const char *) + ATTRIBUTE_NORETURN; +extern void _fatal_insn (const char *, const_rtx, const char *, int, const char *) + ATTRIBUTE_NORETURN; + +#define fatal_insn(msgid, insn) \ + _fatal_insn (msgid, insn, __FILE__, __LINE__, __FUNCTION__) +#define fatal_insn_not_found(insn) \ + _fatal_insn_not_found (insn, __FILE__, __LINE__, __FUNCTION__) + +/* reginfo.c */ +extern tree GTY(()) global_regs_decl[FIRST_PSEUDO_REGISTER]; + +/* Information about the function that is propagated by the RTL backend. + Available only for functions that has been already assembled. */ + +struct GTY(()) cgraph_rtl_info { + unsigned int preferred_incoming_stack_boundary; + + /* Call unsaved hard registers really used by the corresponding + function (including ones used by functions called by the + function). */ + HARD_REG_SET function_used_regs; + /* Set if function_used_regs is valid. */ + unsigned function_used_regs_valid: 1; +}; + +/* If loads from memories of mode MODE always sign or zero extend, + return SIGN_EXTEND or ZERO_EXTEND as appropriate. Return UNKNOWN + otherwise. */ + +inline rtx_code +load_extend_op (machine_mode mode) +{ + if (SCALAR_INT_MODE_P (mode) + && GET_MODE_PRECISION (mode) < BITS_PER_WORD) + return LOAD_EXTEND_OP (mode); + return UNKNOWN; +} + +/* gtype-desc.c. */ +extern void gt_ggc_mx (rtx &); +extern void gt_pch_nx (rtx &); +extern void gt_pch_nx (rtx &, gt_pointer_operator, void *); + +#endif /* ! GCC_RTL_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtlhash.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtlhash.h new file mode 100644 index 0000000..85c5256 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtlhash.h @@ -0,0 +1,31 @@ +/* Register Transfer Language (RTL) hash functions. + Copyright (C) 1987-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef RTL_HASH_H +#define RTL_HASH_H 1 + + +namespace inchash +{ + +extern void add_rtx (const_rtx, hash &); + +} + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtlhooks-def.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtlhooks-def.h new file mode 100644 index 0000000..9361892 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/rtlhooks-def.h @@ -0,0 +1,50 @@ +/* Default macros to initialize an rtl_hooks data structure. + Copyright (C) 2004-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_RTL_HOOKS_DEF_H +#define GCC_RTL_HOOKS_DEF_H + +#include "rtl.h" + +#define RTL_HOOKS_GEN_LOWPART gen_lowpart_general +#define RTL_HOOKS_GEN_LOWPART_NO_EMIT gen_lowpart_if_possible +#define RTL_HOOKS_REG_NONZERO_REG_BITS reg_nonzero_bits_general +#define RTL_HOOKS_REG_NUM_SIGN_BIT_COPIES reg_num_sign_bit_copies_general +#define RTL_HOOKS_REG_TRUNCATED_TO_MODE reg_truncated_to_mode_general + +/* The structure is defined in rtl.h. */ +#define RTL_HOOKS_INITIALIZER { \ + RTL_HOOKS_GEN_LOWPART, \ + RTL_HOOKS_GEN_LOWPART_NO_EMIT, \ + RTL_HOOKS_REG_NONZERO_REG_BITS, \ + RTL_HOOKS_REG_NUM_SIGN_BIT_COPIES, \ + RTL_HOOKS_REG_TRUNCATED_TO_MODE \ +} + +extern rtx gen_lowpart_general (machine_mode, rtx); +extern rtx reg_nonzero_bits_general (const_rtx, machine_mode, const_rtx, + machine_mode, + unsigned HOST_WIDE_INT, + unsigned HOST_WIDE_INT *); +extern rtx reg_num_sign_bit_copies_general (const_rtx, machine_mode, const_rtx, + machine_mode, + unsigned int, unsigned int *); +extern bool reg_truncated_to_mode_general (machine_mode, const_rtx); + +#endif /* GCC_RTL_HOOKS_DEF_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/run-rtl-passes.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/run-rtl-passes.h new file mode 100644 index 0000000..1390303 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/run-rtl-passes.h @@ -0,0 +1,25 @@ +/* run-rtl-passes.h - Run a subset of the RTL passes + Copyright (C) 2016-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_RUN_RTL_PASSES_H +#define GCC_RUN_RTL_PASSES_H + +extern void run_rtl_passes (char *initial_pass_name); + +#endif /* GCC_RUN_RTL_PASSES_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/safe-ctype.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/safe-ctype.h new file mode 100644 index 0000000..16d8ebf --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/safe-ctype.h @@ -0,0 +1,150 @@ +/* replacement macros. + + Copyright (C) 2000-2017 Free Software Foundation, Inc. + Contributed by Zack Weinberg . + +This file is part of the libiberty library. +Libiberty is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +Libiberty is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with libiberty; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, +Boston, MA 02110-1301, USA. */ + +/* This is a compatible replacement of the standard C library's + with the following properties: + + - Implements all isxxx() macros required by C99. + - Also implements some character classes useful when + parsing C-like languages. + - Does not change behavior depending on the current locale. + - Behaves properly for all values in the range of a signed or + unsigned char. + + To avoid conflicts, this header defines the isxxx functions in upper + case, e.g. ISALPHA not isalpha. */ + +#ifndef SAFE_CTYPE_H +#define SAFE_CTYPE_H + +/* Determine host character set. */ +#define HOST_CHARSET_UNKNOWN 0 +#define HOST_CHARSET_ASCII 1 +#define HOST_CHARSET_EBCDIC 2 + +#if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \ + && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21 +# define HOST_CHARSET HOST_CHARSET_ASCII +#else +# if '\n' == 0x15 && ' ' == 0x40 && '0' == 0xF0 \ + && 'A' == 0xC1 && 'a' == 0x81 && '!' == 0x5A +# define HOST_CHARSET HOST_CHARSET_EBCDIC +# else +# define HOST_CHARSET HOST_CHARSET_UNKNOWN +# endif +#endif + +/* Categories. */ + +enum { + /* In C99 */ + _sch_isblank = 0x0001, /* space \t */ + _sch_iscntrl = 0x0002, /* nonprinting characters */ + _sch_isdigit = 0x0004, /* 0-9 */ + _sch_islower = 0x0008, /* a-z */ + _sch_isprint = 0x0010, /* any printing character including ' ' */ + _sch_ispunct = 0x0020, /* all punctuation */ + _sch_isspace = 0x0040, /* space \t \n \r \f \v */ + _sch_isupper = 0x0080, /* A-Z */ + _sch_isxdigit = 0x0100, /* 0-9A-Fa-f */ + + /* Extra categories useful to cpplib. */ + _sch_isidst = 0x0200, /* A-Za-z_ */ + _sch_isvsp = 0x0400, /* \n \r */ + _sch_isnvsp = 0x0800, /* space \t \f \v \0 */ + + /* Combinations of the above. */ + _sch_isalpha = _sch_isupper|_sch_islower, /* A-Za-z */ + _sch_isalnum = _sch_isalpha|_sch_isdigit, /* A-Za-z0-9 */ + _sch_isidnum = _sch_isidst|_sch_isdigit, /* A-Za-z0-9_ */ + _sch_isgraph = _sch_isalnum|_sch_ispunct, /* isprint and not space */ + _sch_iscppsp = _sch_isvsp|_sch_isnvsp, /* isspace + \0 */ + _sch_isbasic = _sch_isprint|_sch_iscppsp /* basic charset of ISO C + (plus ` and @) */ +}; + +/* Character classification. */ +extern const unsigned short _sch_istable[256]; + +#define _sch_test(c, bit) (_sch_istable[(c) & 0xff] & (unsigned short)(bit)) + +#define ISALPHA(c) _sch_test(c, _sch_isalpha) +#define ISALNUM(c) _sch_test(c, _sch_isalnum) +#define ISBLANK(c) _sch_test(c, _sch_isblank) +#define ISCNTRL(c) _sch_test(c, _sch_iscntrl) +#define ISDIGIT(c) _sch_test(c, _sch_isdigit) +#define ISGRAPH(c) _sch_test(c, _sch_isgraph) +#define ISLOWER(c) _sch_test(c, _sch_islower) +#define ISPRINT(c) _sch_test(c, _sch_isprint) +#define ISPUNCT(c) _sch_test(c, _sch_ispunct) +#define ISSPACE(c) _sch_test(c, _sch_isspace) +#define ISUPPER(c) _sch_test(c, _sch_isupper) +#define ISXDIGIT(c) _sch_test(c, _sch_isxdigit) + +#define ISIDNUM(c) _sch_test(c, _sch_isidnum) +#define ISIDST(c) _sch_test(c, _sch_isidst) +#define IS_ISOBASIC(c) _sch_test(c, _sch_isbasic) +#define IS_VSPACE(c) _sch_test(c, _sch_isvsp) +#define IS_NVSPACE(c) _sch_test(c, _sch_isnvsp) +#define IS_SPACE_OR_NUL(c) _sch_test(c, _sch_iscppsp) + +/* Character transformation. */ +extern const unsigned char _sch_toupper[256]; +extern const unsigned char _sch_tolower[256]; +#define TOUPPER(c) _sch_toupper[(c) & 0xff] +#define TOLOWER(c) _sch_tolower[(c) & 0xff] + +/* Prevent the users of safe-ctype.h from accidently using the routines + from ctype.h. Initially, the approach was to produce an error when + detecting that ctype.h has been included. But this was causing + trouble as ctype.h might get indirectly included as a result of + including another system header (for instance gnulib's stdint.h). + So we include ctype.h here and then immediately redefine its macros. */ + +#include +#undef isalpha +#define isalpha(c) do_not_use_isalpha_with_safe_ctype +#undef isalnum +#define isalnum(c) do_not_use_isalnum_with_safe_ctype +#undef iscntrl +#define iscntrl(c) do_not_use_iscntrl_with_safe_ctype +#undef isdigit +#define isdigit(c) do_not_use_isdigit_with_safe_ctype +#undef isgraph +#define isgraph(c) do_not_use_isgraph_with_safe_ctype +#undef islower +#define islower(c) do_not_use_islower_with_safe_ctype +#undef isprint +#define isprint(c) do_not_use_isprint_with_safe_ctype +#undef ispunct +#define ispunct(c) do_not_use_ispunct_with_safe_ctype +#undef isspace +#define isspace(c) do_not_use_isspace_with_safe_ctype +#undef isupper +#define isupper(c) do_not_use_isupper_with_safe_ctype +#undef isxdigit +#define isxdigit(c) do_not_use_isxdigit_with_safe_ctype +#undef toupper +#define toupper(c) do_not_use_toupper_with_safe_ctype +#undef tolower +#define tolower(c) do_not_use_tolower_with_safe_ctype + +#endif /* SAFE_CTYPE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sbitmap.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sbitmap.h new file mode 100644 index 0000000..ce4d27d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sbitmap.h @@ -0,0 +1,287 @@ +/* Simple bitmaps. + Copyright (C) 1999-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_SBITMAP_H +#define GCC_SBITMAP_H + +/* Implementation of sets using simple bitmap vectors. + + This set representation is suitable for non-sparse sets with a known + (a priori) universe. The set is represented as a simple array of the + host's fastest unsigned integer. For a given member I in the set: + - the element for I will be at sbitmap[I / (bits per element)] + - the position for I within element is I % (bits per element) + + This representation is very space-efficient for large non-sparse sets + with random access patterns. + + The following operations can be performed in O(1) time: + + * set_size : SBITMAP_SIZE + * member_p : bitmap_bit_p + * add_member : bitmap_set_bit + * remove_member : bitmap_clear_bit + + Most other operations on this set representation are O(U) where U is + the size of the set universe: + + * clear : bitmap_clear + * choose_one : bitmap_first_set_bit / + bitmap_last_set_bit + * forall : EXECUTE_IF_SET_IN_BITMAP + * set_copy : bitmap_copy + * set_intersection : bitmap_and + * set_union : bitmap_ior + * set_difference : bitmap_and_compl + * set_disjuction : (not implemented) + * set_compare : bitmap_equal_p + + Some operations on 3 sets that occur frequently in data flow problems + are also implemented: + + * A | (B & C) : bitmap_or_and + * A | (B & ~C) : bitmap_ior_and_compl + * A & (B | C) : bitmap_and_or + + Most of the set functions have two variants: One that returns non-zero + if members were added or removed from the target set, and one that just + performs the operation without feedback. The former operations are a + bit more expensive but the result can often be used to avoid iterations + on other sets. + + Allocating a bitmap is done with sbitmap_alloc, and resizing is + performed with sbitmap_resize. + + The storage requirements for simple bitmap sets is O(U) where U is the + size of the set universe (colloquially the number of bits in the bitmap). + + This set representation works well for relatively small data flow problems + (there are special routines for that, see sbitmap_vector_*). The set + operations can be vectorized and there is almost no computating overhead, + so that even sparse simple bitmap sets outperform dedicated sparse set + representations like linked-list bitmaps. For larger problems, the size + overhead of simple bitmap sets gets too high and other set representations + have to be used. */ + +#define SBITMAP_ELT_BITS (HOST_BITS_PER_WIDEST_FAST_INT * 1u) +#define SBITMAP_ELT_TYPE unsigned HOST_WIDEST_FAST_INT + +struct simple_bitmap_def +{ + unsigned int n_bits; /* Number of bits. */ + unsigned int size; /* Size in elements. */ + SBITMAP_ELT_TYPE elms[1]; /* The elements. */ +}; + +/* Return the set size needed for N elements. */ +#define SBITMAP_SET_SIZE(N) (((N) + SBITMAP_ELT_BITS - 1) / SBITMAP_ELT_BITS) + +/* Return the number of bits in BITMAP. */ +#define SBITMAP_SIZE(BITMAP) ((BITMAP)->n_bits) + +/* Test if bit number bitno in the bitmap is set. */ +static inline SBITMAP_ELT_TYPE +bitmap_bit_p (const_sbitmap map, int bitno) +{ + size_t i = bitno / SBITMAP_ELT_BITS; + unsigned int s = bitno % SBITMAP_ELT_BITS; + return (map->elms[i] >> s) & (SBITMAP_ELT_TYPE) 1; +} + +/* Set bit number BITNO in the sbitmap MAP. */ + +static inline void +bitmap_set_bit (sbitmap map, int bitno) +{ + map->elms[bitno / SBITMAP_ELT_BITS] + |= (SBITMAP_ELT_TYPE) 1 << (bitno) % SBITMAP_ELT_BITS; +} + +/* Reset bit number BITNO in the sbitmap MAP. */ + +static inline void +bitmap_clear_bit (sbitmap map, int bitno) +{ + map->elms[bitno / SBITMAP_ELT_BITS] + &= ~((SBITMAP_ELT_TYPE) 1 << (bitno) % SBITMAP_ELT_BITS); +} + +/* The iterator for sbitmap. */ +struct sbitmap_iterator { + /* The pointer to the first word of the bitmap. */ + const SBITMAP_ELT_TYPE *ptr; + + /* The size of the bitmap. */ + unsigned int size; + + /* The current word index. */ + unsigned int word_num; + + /* The current bit index (not modulo SBITMAP_ELT_BITS). */ + unsigned int bit_num; + + /* The words currently visited. */ + SBITMAP_ELT_TYPE word; +}; + +/* Initialize the iterator I with sbitmap BMP and the initial index + MIN. */ + +static inline void +bmp_iter_set_init (sbitmap_iterator *i, const_sbitmap bmp, + unsigned int min, unsigned *bit_no ATTRIBUTE_UNUSED) +{ + i->word_num = min / (unsigned int) SBITMAP_ELT_BITS; + i->bit_num = min; + i->size = bmp->size; + i->ptr = bmp->elms; + + if (i->word_num >= i->size) + i->word = 0; + else + i->word = (i->ptr[i->word_num] + >> (i->bit_num % (unsigned int) SBITMAP_ELT_BITS)); +} + +/* Return true if we have more bits to visit, in which case *N is set + to the index of the bit to be visited. Otherwise, return + false. */ + +static inline bool +bmp_iter_set (sbitmap_iterator *i, unsigned int *n) +{ + /* Skip words that are zeros. */ + for (; i->word == 0; i->word = i->ptr[i->word_num]) + { + i->word_num++; + + /* If we have reached the end, break. */ + if (i->word_num >= i->size) + return false; + + i->bit_num = i->word_num * SBITMAP_ELT_BITS; + } + + /* Skip bits that are zero. */ + for (; (i->word & 1) == 0; i->word >>= 1) + i->bit_num++; + + *n = i->bit_num; + + return true; +} + +/* Advance to the next bit. */ + +static inline void +bmp_iter_next (sbitmap_iterator *i, unsigned *bit_no ATTRIBUTE_UNUSED) +{ + i->word >>= 1; + i->bit_num++; +} + +/* Loop over all elements of SBITMAP, starting with MIN. In each + iteration, N is set to the index of the bit being visited. ITER is + an instance of sbitmap_iterator used to iterate the bitmap. */ + +#ifndef EXECUTE_IF_SET_IN_BITMAP +/* See bitmap.h for the other definition of EXECUTE_IF_SET_IN_BITMAP. */ +#define EXECUTE_IF_SET_IN_BITMAP(BITMAP, MIN, BITNUM, ITER) \ + for (bmp_iter_set_init (&(ITER), (BITMAP), (MIN), &(BITNUM)); \ + bmp_iter_set (&(ITER), &(BITNUM)); \ + bmp_iter_next (&(ITER), &(BITNUM))) +#endif + +inline void sbitmap_free (sbitmap map) +{ + free (map); +} + +inline void sbitmap_vector_free (sbitmap * vec) +{ + free (vec); +} + +extern void dump_bitmap (FILE *, const_sbitmap); +extern void debug_raw (const simple_bitmap_def &ref); +extern void debug_raw (const simple_bitmap_def *ptr); +extern void dump_bitmap_file (FILE *, const_sbitmap); +extern void debug (const simple_bitmap_def &ref); +extern void debug (const simple_bitmap_def *ptr); +extern void dump_bitmap_vector (FILE *, const char *, const char *, sbitmap *, + int); +extern sbitmap sbitmap_alloc (unsigned int); +extern sbitmap *sbitmap_vector_alloc (unsigned int, unsigned int); +extern sbitmap sbitmap_resize (sbitmap, unsigned int, int); +extern void bitmap_copy (sbitmap, const_sbitmap); +extern int bitmap_equal_p (const_sbitmap, const_sbitmap); +extern unsigned int bitmap_count_bits (const_sbitmap); +extern bool bitmap_empty_p (const_sbitmap); +extern void bitmap_clear (sbitmap); +extern void bitmap_clear_range (sbitmap, unsigned, unsigned); +extern void bitmap_set_range (sbitmap, unsigned, unsigned); +extern void bitmap_ones (sbitmap); +extern void bitmap_vector_clear (sbitmap *, unsigned int); +extern void bitmap_vector_ones (sbitmap *, unsigned int); + +extern bool bitmap_ior_and_compl (sbitmap, const_sbitmap, + const_sbitmap, const_sbitmap); +extern void bitmap_and_compl (sbitmap, const_sbitmap, const_sbitmap); +extern void bitmap_not (sbitmap, const_sbitmap); +extern bool bitmap_or_and (sbitmap, const_sbitmap, + const_sbitmap, const_sbitmap); +extern bool bitmap_and_or (sbitmap, const_sbitmap, + const_sbitmap, const_sbitmap); +extern bool bitmap_intersect_p (const_sbitmap, const_sbitmap); +extern bool bitmap_and (sbitmap, const_sbitmap, const_sbitmap); +extern bool bitmap_ior (sbitmap, const_sbitmap, const_sbitmap); +extern bool bitmap_xor (sbitmap, const_sbitmap, const_sbitmap); +extern bool bitmap_subset_p (const_sbitmap, const_sbitmap); + +extern int bitmap_first_set_bit (const_sbitmap); +extern int bitmap_last_set_bit (const_sbitmap); + +extern void debug_bitmap (const_sbitmap); +extern sbitmap sbitmap_realloc (sbitmap, unsigned int); + +/* a class that ties the lifetime of a sbitmap to its scope. */ +class auto_sbitmap +{ +public: + explicit auto_sbitmap (unsigned int size) : + m_bitmap (sbitmap_alloc (size)) {} + ~auto_sbitmap () { sbitmap_free (m_bitmap); } + + /* Allow calling sbitmap functions on our bitmap. */ + operator sbitmap () { return m_bitmap; } + +private: + /* Prevent making a copy that refers to our sbitmap. */ + auto_sbitmap (const auto_sbitmap &); + auto_sbitmap &operator = (const auto_sbitmap &); +#if __cplusplus >= 201103L + auto_sbitmap (auto_sbitmap &&); + auto_sbitmap &operator = (auto_sbitmap &&); +#endif + + /* The bitmap we are managing. */ + sbitmap m_bitmap; +}; + +#endif /* ! GCC_SBITMAP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sched-int.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sched-int.h new file mode 100644 index 0000000..624d892 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sched-int.h @@ -0,0 +1,1691 @@ +/* Instruction scheduling pass. This file contains definitions used + internally in the scheduler. + Copyright (C) 1992-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_SCHED_INT_H +#define GCC_SCHED_INT_H + +#ifdef INSN_SCHEDULING + +/* Identificator of a scheduler pass. */ +enum sched_pass_id_t { SCHED_PASS_UNKNOWN, SCHED_RGN_PASS, SCHED_EBB_PASS, + SCHED_SMS_PASS, SCHED_SEL_PASS }; + +/* The algorithm used to implement -fsched-pressure. */ +enum sched_pressure_algorithm +{ + SCHED_PRESSURE_NONE, + SCHED_PRESSURE_WEIGHTED, + SCHED_PRESSURE_MODEL +}; + +typedef vec bb_vec_t; +typedef vec insn_vec_t; +typedef vec rtx_vec_t; + +extern void sched_init_bbs (void); + +extern void sched_extend_luids (void); +extern void sched_init_insn_luid (rtx_insn *); +extern void sched_init_luids (bb_vec_t); +extern void sched_finish_luids (void); + +extern void sched_extend_target (void); + +extern void haifa_init_h_i_d (bb_vec_t); +extern void haifa_finish_h_i_d (void); + +/* Hooks that are common to all the schedulers. */ +struct common_sched_info_def +{ + /* Called after blocks were rearranged due to movement of jump instruction. + The first parameter - index of basic block, in which jump currently is. + The second parameter - index of basic block, in which jump used + to be. + The third parameter - index of basic block, that follows the second + parameter. */ + void (*fix_recovery_cfg) (int, int, int); + + /* Called to notify frontend, that new basic block is being added. + The first parameter - new basic block. + The second parameter - block, after which new basic block is being added, + or the exit block, if recovery block is being added, + or NULL, if standalone block is being added. */ + void (*add_block) (basic_block, basic_block); + + /* Estimate number of insns in the basic block. */ + int (*estimate_number_of_insns) (basic_block); + + /* Given a non-insn (!INSN_P (x)) return + -1 - if this rtx don't need a luid. + 0 - if it should have the same luid as the previous insn. + 1 - if it needs a separate luid. */ + int (*luid_for_non_insn) (rtx); + + /* Scheduler pass identifier. It is preferably used in assertions. */ + enum sched_pass_id_t sched_pass_id; +}; + +extern struct common_sched_info_def *common_sched_info; + +extern const struct common_sched_info_def haifa_common_sched_info; + +/* Return true if selective scheduling pass is working. */ +static inline bool +sel_sched_p (void) +{ + return common_sched_info->sched_pass_id == SCHED_SEL_PASS; +} + +/* Returns maximum priority that an insn was assigned to. */ +extern int get_rgn_sched_max_insns_priority (void); + +/* Increases effective priority for INSN by AMOUNT. */ +extern void sel_add_to_insn_priority (rtx, int); + +/* True if during selective scheduling we need to emulate some of haifa + scheduler behavior. */ +extern int sched_emulate_haifa_p; + +/* Mapping from INSN_UID to INSN_LUID. In the end all other per insn data + structures should be indexed by luid. */ +extern vec sched_luids; +#define INSN_LUID(INSN) (sched_luids[INSN_UID (INSN)]) +#define LUID_BY_UID(UID) (sched_luids[UID]) + +#define SET_INSN_LUID(INSN, LUID) \ +(sched_luids[INSN_UID (INSN)] = (LUID)) + +/* The highest INSN_LUID. */ +extern int sched_max_luid; + +extern int insn_luid (rtx); + +/* This list holds ripped off notes from the current block. These notes will + be attached to the beginning of the block when its scheduling is + finished. */ +extern rtx_insn *note_list; + +extern void remove_notes (rtx_insn *, rtx_insn *); +extern rtx_insn *restore_other_notes (rtx_insn *, basic_block); +extern void sched_insns_init (rtx); +extern void sched_insns_finish (void); + +extern void *xrecalloc (void *, size_t, size_t, size_t); + +extern void reemit_notes (rtx_insn *); + +/* Functions in haifa-sched.c. */ +extern int haifa_classify_insn (const_rtx); + +/* Functions in sel-sched-ir.c. */ +extern void sel_find_rgns (void); +extern void sel_mark_hard_insn (rtx); + +extern size_t dfa_state_size; + +extern void advance_state (state_t); + +extern void setup_sched_dump (void); +extern void sched_init (void); +extern void sched_finish (void); + +extern bool sel_insn_is_speculation_check (rtx); + +/* Describe the ready list of the scheduler. + VEC holds space enough for all insns in the current region. VECLEN + says how many exactly. + FIRST is the index of the element with the highest priority; i.e. the + last one in the ready list, since elements are ordered by ascending + priority. + N_READY determines how many insns are on the ready list. + N_DEBUG determines how many debug insns are on the ready list. */ +struct ready_list +{ + rtx_insn **vec; + int veclen; + int first; + int n_ready; + int n_debug; +}; + +extern signed char *ready_try; +extern struct ready_list ready; + +extern int max_issue (struct ready_list *, int, state_t, bool, int *); + +extern void ebb_compute_jump_reg_dependencies (rtx, regset); + +extern edge find_fallthru_edge_from (basic_block); + +extern void (* sched_init_only_bb) (basic_block, basic_block); +extern basic_block (* sched_split_block) (basic_block, rtx); +extern basic_block sched_split_block_1 (basic_block, rtx); +extern basic_block (* sched_create_empty_bb) (basic_block); +extern basic_block sched_create_empty_bb_1 (basic_block); + +extern basic_block sched_create_recovery_block (basic_block *); +extern void sched_create_recovery_edges (basic_block, basic_block, + basic_block); + +/* Pointer to data describing the current DFA state. */ +extern state_t curr_state; + +/* Type to represent status of a dependence. */ +typedef unsigned int ds_t; +#define BITS_PER_DEP_STATUS HOST_BITS_PER_INT + +/* Type to represent weakness of speculative dependence. */ +typedef unsigned int dw_t; + +extern enum reg_note ds_to_dk (ds_t); +extern ds_t dk_to_ds (enum reg_note); + +/* Describe a dependency that can be broken by making a replacement + in one of the patterns. LOC is the location, ORIG and NEWVAL the + two alternative contents, and INSN the instruction that must be + changed. */ +struct dep_replacement +{ + rtx *loc; + rtx orig; + rtx newval; + rtx_insn *insn; +}; + +/* Information about the dependency. */ +struct _dep +{ + /* Producer. */ + rtx_insn *pro; + + /* Consumer. */ + rtx_insn *con; + + /* If nonnull, holds a pointer to information about how to break the + dependency by making a replacement in one of the insns. There is + only one such dependency for each insn that must be modified in + order to break such a dependency. */ + struct dep_replacement *replace; + + /* Dependency status. This field holds all dependency types and additional + information for speculative dependencies. */ + ds_t status; + + /* Dependency major type. This field is superseded by STATUS above. + Though, it is still in place because some targets use it. */ + ENUM_BITFIELD(reg_note) type:6; + + unsigned nonreg:1; + unsigned multiple:1; + + /* Cached cost of the dependency. Make sure to update UNKNOWN_DEP_COST + when changing the size of this field. */ + int cost:20; +}; + +#define UNKNOWN_DEP_COST ((int) ((unsigned int) -1 << 19)) + +typedef struct _dep dep_def; +typedef dep_def *dep_t; + +#define DEP_PRO(D) ((D)->pro) +#define DEP_CON(D) ((D)->con) +#define DEP_TYPE(D) ((D)->type) +#define DEP_STATUS(D) ((D)->status) +#define DEP_COST(D) ((D)->cost) +#define DEP_NONREG(D) ((D)->nonreg) +#define DEP_MULTIPLE(D) ((D)->multiple) +#define DEP_REPLACE(D) ((D)->replace) + +/* Functions to work with dep. */ + +extern void init_dep_1 (dep_t, rtx_insn *, rtx_insn *, enum reg_note, ds_t); +extern void init_dep (dep_t, rtx_insn *, rtx_insn *, enum reg_note); + +extern void sd_debug_dep (dep_t); + +/* Definition of this struct resides below. */ +struct _dep_node; +typedef struct _dep_node *dep_node_t; + +/* A link in the dependency list. This is essentially an equivalent of a + single {INSN, DEPS}_LIST rtx. */ +struct _dep_link +{ + /* Dep node with all the data. */ + dep_node_t node; + + /* Next link in the list. For the last one it is NULL. */ + struct _dep_link *next; + + /* Pointer to the next field of the previous link in the list. + For the first link this points to the deps_list->first. + + With help of this field it is easy to remove and insert links to the + list. */ + struct _dep_link **prev_nextp; +}; +typedef struct _dep_link *dep_link_t; + +#define DEP_LINK_NODE(N) ((N)->node) +#define DEP_LINK_NEXT(N) ((N)->next) +#define DEP_LINK_PREV_NEXTP(N) ((N)->prev_nextp) + +/* Macros to work dep_link. For most usecases only part of the dependency + information is need. These macros conveniently provide that piece of + information. */ + +#define DEP_LINK_DEP(N) (DEP_NODE_DEP (DEP_LINK_NODE (N))) +#define DEP_LINK_PRO(N) (DEP_PRO (DEP_LINK_DEP (N))) +#define DEP_LINK_CON(N) (DEP_CON (DEP_LINK_DEP (N))) +#define DEP_LINK_TYPE(N) (DEP_TYPE (DEP_LINK_DEP (N))) +#define DEP_LINK_STATUS(N) (DEP_STATUS (DEP_LINK_DEP (N))) + +/* A list of dep_links. */ +struct _deps_list +{ + /* First element. */ + dep_link_t first; + + /* Total number of elements in the list. */ + int n_links; +}; +typedef struct _deps_list *deps_list_t; + +#define DEPS_LIST_FIRST(L) ((L)->first) +#define DEPS_LIST_N_LINKS(L) ((L)->n_links) + +/* Suppose we have a dependence Y between insn pro1 and con1, where pro1 has + additional dependents con0 and con2, and con1 is dependent on additional + insns pro0 and pro1: + + .con0 pro0 + . ^ | + . | | + . | | + . X A + . | | + . | | + . | V + .pro1--Y-->con1 + . | ^ + . | | + . | | + . Z B + . | | + . | | + . V | + .con2 pro2 + + This is represented using a "dep_node" for each dependence arc, which are + connected as follows (diagram is centered around Y which is fully shown; + other dep_nodes shown partially): + + . +------------+ +--------------+ +------------+ + . : dep_node X : | dep_node Y | : dep_node Z : + . : : | | : : + . : : | | : : + . : forw : | forw | : forw : + . : +--------+ : | +--------+ | : +--------+ : + forw_deps : |dep_link| : | |dep_link| | : |dep_link| : + +-----+ : | +----+ | : | | +----+ | | : | +----+ | : + |first|----->| |next|-+------+->| |next|-+--+----->| |next|-+--->NULL + +-----+ : | +----+ | : | | +----+ | | : | +----+ | : + . ^ ^ : | ^ | : | | ^ | | : | | : + . | | : | | | : | | | | | : | | : + . | +--<----+--+ +--+---<--+--+--+ +--+--+--<---+--+ | : + . | : | | | : | | | | | : | | | : + . | : | +----+ | : | | +----+ | | : | +----+ | : + . | : | |prev| | : | | |prev| | | : | |prev| | : + . | : | |next| | : | | |next| | | : | |next| | : + . | : | +----+ | : | | +----+ | | : | +----+ | : + . | : | | :<-+ | | | |<-+ : | | :<-+ + . | : | +----+ | : | | | +----+ | | | : | +----+ | : | + . | : | |node|-+----+ | | |node|-+--+--+ : | |node|-+----+ + . | : | +----+ | : | | +----+ | | : | +----+ | : + . | : | | : | | | | : | | : + . | : +--------+ : | +--------+ | : +--------+ : + . | : : | | : : + . | : SAME pro1 : | +--------+ | : SAME pro1 : + . | : DIFF con0 : | |dep | | : DIFF con2 : + . | : : | | | | : : + . | | | +----+ | | + .RTX<------------------------+--+-|pro1| | | + .pro1 | | +----+ | | + . | | | | + . | | +----+ | | + .RTX<------------------------+--+-|con1| | | + .con1 | | +----+ | | + . | | | | | + . | | | +----+ | | + . | | | |kind| | | + . | | | +----+ | | + . | : : | | |stat| | | : : + . | : DIFF pro0 : | | +----+ | | : DIFF pro2 : + . | : SAME con1 : | | | | : SAME con1 : + . | : : | +--------+ | : : + . | : : | | : : + . | : back : | back | : back : + . v : +--------+ : | +--------+ | : +--------+ : + back_deps : |dep_link| : | |dep_link| | : |dep_link| : + +-----+ : | +----+ | : | | +----+ | | : | +----+ | : + |first|----->| |next|-+------+->| |next|-+--+----->| |next|-+--->NULL + +-----+ : | +----+ | : | | +----+ | | : | +----+ | : + . ^ : | ^ | : | | ^ | | : | | : + . | : | | | : | | | | | : | | : + . +--<----+--+ +--+---<--+--+--+ +--+--+--<---+--+ | : + . : | | | : | | | | | : | | | : + . : | +----+ | : | | +----+ | | : | +----+ | : + . : | |prev| | : | | |prev| | | : | |prev| | : + . : | |next| | : | | |next| | | : | |next| | : + . : | +----+ | : | | +----+ | | : | +----+ | : + . : | | :<-+ | | | |<-+ : | | :<-+ + . : | +----+ | : | | | +----+ | | | : | +----+ | : | + . : | |node|-+----+ | | |node|-+--+--+ : | |node|-+----+ + . : | +----+ | : | | +----+ | | : | +----+ | : + . : | | : | | | | : | | : + . : +--------+ : | +--------+ | : +--------+ : + . : : | | : : + . : dep_node A : | dep_node Y | : dep_node B : + . +------------+ +--------------+ +------------+ +*/ + +struct _dep_node +{ + /* Backward link. */ + struct _dep_link back; + + /* The dep. */ + struct _dep dep; + + /* Forward link. */ + struct _dep_link forw; +}; + +#define DEP_NODE_BACK(N) (&(N)->back) +#define DEP_NODE_DEP(N) (&(N)->dep) +#define DEP_NODE_FORW(N) (&(N)->forw) + +/* The following enumeration values tell us what dependencies we + should use to implement the barrier. We use true-dependencies for + TRUE_BARRIER and anti-dependencies for MOVE_BARRIER. */ +enum reg_pending_barrier_mode +{ + NOT_A_BARRIER = 0, + MOVE_BARRIER, + TRUE_BARRIER +}; + +/* Whether a register movement is associated with a call. */ +enum post_call_group +{ + not_post_call, + post_call, + post_call_initial +}; + +/* Insns which affect pseudo-registers. */ +struct deps_reg +{ + rtx_insn_list *uses; + rtx_insn_list *sets; + rtx_insn_list *implicit_sets; + rtx_insn_list *control_uses; + rtx_insn_list *clobbers; + int uses_length; + int clobbers_length; +}; + +/* Describe state of dependencies used during sched_analyze phase. */ +struct deps_desc +{ + /* The *_insns and *_mems are paired lists. Each pending memory operation + will have a pointer to the MEM rtx on one list and a pointer to the + containing insn on the other list in the same place in the list. */ + + /* We can't use add_dependence like the old code did, because a single insn + may have multiple memory accesses, and hence needs to be on the list + once for each memory access. Add_dependence won't let you add an insn + to a list more than once. */ + + /* An INSN_LIST containing all insns with pending read operations. */ + rtx_insn_list *pending_read_insns; + + /* An EXPR_LIST containing all MEM rtx's which are pending reads. */ + rtx_expr_list *pending_read_mems; + + /* An INSN_LIST containing all insns with pending write operations. */ + rtx_insn_list *pending_write_insns; + + /* An EXPR_LIST containing all MEM rtx's which are pending writes. */ + rtx_expr_list *pending_write_mems; + + /* An INSN_LIST containing all jump insns. */ + rtx_insn_list *pending_jump_insns; + + /* We must prevent the above lists from ever growing too large since + the number of dependencies produced is at least O(N*N), + and execution time is at least O(4*N*N), as a function of the + length of these pending lists. */ + + /* Indicates the length of the pending_read list. */ + int pending_read_list_length; + + /* Indicates the length of the pending_write list. */ + int pending_write_list_length; + + /* Length of the pending memory flush list plus the length of the pending + jump insn list. Large functions with no calls may build up extremely + large lists. */ + int pending_flush_length; + + /* The last insn upon which all memory references must depend. + This is an insn which flushed the pending lists, creating a dependency + between it and all previously pending memory references. This creates + a barrier (or a checkpoint) which no memory reference is allowed to cross. + + This includes all non constant CALL_INSNs. When we do interprocedural + alias analysis, this restriction can be relaxed. + This may also be an INSN that writes memory if the pending lists grow + too large. */ + rtx_insn_list *last_pending_memory_flush; + + /* A list of the last function calls we have seen. We use a list to + represent last function calls from multiple predecessor blocks. + Used to prevent register lifetimes from expanding unnecessarily. */ + rtx_insn_list *last_function_call; + + /* A list of the last function calls that may not return normally + we have seen. We use a list to represent last function calls from + multiple predecessor blocks. Used to prevent moving trapping insns + across such calls. */ + rtx_insn_list *last_function_call_may_noreturn; + + /* A list of insns which use a pseudo register that does not already + cross a call. We create dependencies between each of those insn + and the next call insn, to ensure that they won't cross a call after + scheduling is done. */ + rtx_insn_list *sched_before_next_call; + + /* Similarly, a list of insns which should not cross a branch. */ + rtx_insn_list *sched_before_next_jump; + + /* Used to keep post-call pseudo/hard reg movements together with + the call. */ + enum post_call_group in_post_call_group_p; + + /* The last debug insn we've seen. */ + rtx_insn *last_debug_insn; + + /* The last insn bearing REG_ARGS_SIZE that we've seen. */ + rtx_insn *last_args_size; + + /* A list of all prologue insns we have seen without intervening epilogue + insns, and one of all epilogue insns we have seen without intervening + prologue insns. This is used to prevent mixing prologue and epilogue + insns. See PR78029. */ + rtx_insn_list *last_prologue; + rtx_insn_list *last_epilogue; + + /* Whether the last *logue insn was an epilogue insn or a prologue insn + instead. */ + bool last_logue_was_epilogue; + + /* The maximum register number for the following arrays. Before reload + this is max_reg_num; after reload it is FIRST_PSEUDO_REGISTER. */ + int max_reg; + + /* Element N is the next insn that sets (hard or pseudo) register + N within the current basic block; or zero, if there is no + such insn. Needed for new registers which may be introduced + by splitting insns. */ + struct deps_reg *reg_last; + + /* Element N is set for each register that has any nonzero element + in reg_last[N].{uses,sets,clobbers}. */ + regset_head reg_last_in_use; + + /* Shows the last value of reg_pending_barrier associated with the insn. */ + enum reg_pending_barrier_mode last_reg_pending_barrier; + + /* True when this context should be treated as a readonly by + the analysis. */ + BOOL_BITFIELD readonly : 1; +}; + +typedef struct deps_desc *deps_t; + +/* This structure holds some state of the current scheduling pass, and + contains some function pointers that abstract out some of the non-generic + functionality from functions such as schedule_block or schedule_insn. + There is one global variable, current_sched_info, which points to the + sched_info structure currently in use. */ +struct haifa_sched_info +{ + /* Add all insns that are initially ready to the ready list. Called once + before scheduling a set of insns. */ + void (*init_ready_list) (void); + /* Called after taking an insn from the ready list. Returns nonzero if + this insn can be scheduled, nonzero if we should silently discard it. */ + int (*can_schedule_ready_p) (rtx_insn *); + /* Return nonzero if there are more insns that should be scheduled. */ + int (*schedule_more_p) (void); + /* Called after an insn has all its hard dependencies resolved. + Adjusts status of instruction (which is passed through second parameter) + to indicate if instruction should be moved to the ready list or the + queue, or if it should silently discard it (until next resolved + dependence). */ + ds_t (*new_ready) (rtx_insn *, ds_t); + /* Compare priority of two insns. Return a positive number if the second + insn is to be preferred for scheduling, and a negative one if the first + is to be preferred. Zero if they are equally good. */ + int (*rank) (rtx_insn *, rtx_insn *); + /* Return a string that contains the insn uid and optionally anything else + necessary to identify this insn in an output. It's valid to use a + static buffer for this. The ALIGNED parameter should cause the string + to be formatted so that multiple output lines will line up nicely. */ + const char *(*print_insn) (const rtx_insn *, int); + /* Return nonzero if an insn should be included in priority + calculations. */ + int (*contributes_to_priority) (rtx_insn *, rtx_insn *); + + /* Return true if scheduling insn (passed as the parameter) will trigger + finish of scheduling current block. */ + bool (*insn_finishes_block_p) (rtx_insn *); + + /* The boundaries of the set of insns to be scheduled. */ + rtx_insn *prev_head, *next_tail; + + /* Filled in after the schedule is finished; the first and last scheduled + insns. */ + rtx_insn *head, *tail; + + /* If nonzero, enables an additional sanity check in schedule_block. */ + unsigned int queue_must_finish_empty:1; + + /* Maximum priority that has been assigned to an insn. */ + int sched_max_insns_priority; + + /* Hooks to support speculative scheduling. */ + + /* Called to notify frontend that instruction is being added (second + parameter == 0) or removed (second parameter == 1). */ + void (*add_remove_insn) (rtx_insn *, int); + + /* Called to notify the frontend that instruction INSN is being + scheduled. */ + void (*begin_schedule_ready) (rtx_insn *insn); + + /* Called to notify the frontend that an instruction INSN is about to be + moved to its correct place in the final schedule. This is done for all + insns in order of the schedule. LAST indicates the last scheduled + instruction. */ + void (*begin_move_insn) (rtx_insn *insn, rtx_insn *last); + + /* If the second parameter is not NULL, return nonnull value, if the + basic block should be advanced. + If the second parameter is NULL, return the next basic block in EBB. + The first parameter is the current basic block in EBB. */ + basic_block (*advance_target_bb) (basic_block, rtx_insn *); + + /* Allocate memory, store the frontend scheduler state in it, and + return it. */ + void *(*save_state) (void); + /* Restore frontend scheduler state from the argument, and free the + memory. */ + void (*restore_state) (void *); + + /* ??? FIXME: should use straight bitfields inside sched_info instead of + this flag field. */ + unsigned int flags; +}; + +/* This structure holds description of the properties for speculative + scheduling. */ +struct spec_info_def +{ + /* Holds types of allowed speculations: BEGIN_{DATA|CONTROL}, + BE_IN_{DATA_CONTROL}. */ + int mask; + + /* A dump file for additional information on speculative scheduling. */ + FILE *dump; + + /* Minimal cumulative weakness of speculative instruction's + dependencies, so that insn will be scheduled. */ + dw_t data_weakness_cutoff; + + /* Minimal usefulness of speculative instruction to be considered for + scheduling. */ + int control_weakness_cutoff; + + /* Flags from the enum SPEC_SCHED_FLAGS. */ + int flags; +}; +typedef struct spec_info_def *spec_info_t; + +extern spec_info_t spec_info; + +extern struct haifa_sched_info *current_sched_info; + +/* Do register pressure sensitive insn scheduling if the flag is set + up. */ +extern enum sched_pressure_algorithm sched_pressure; + +/* Map regno -> its pressure class. The map defined only when + SCHED_PRESSURE_P is true. */ +extern enum reg_class *sched_regno_pressure_class; + +/* Indexed by INSN_UID, the collection of all data associated with + a single instruction. */ + +struct _haifa_deps_insn_data +{ + /* The number of incoming edges in the forward dependency graph. + As scheduling proceeds, counts are decreased. An insn moves to + the ready queue when its counter reaches zero. */ + int dep_count; + + /* Nonzero if instruction has internal dependence + (e.g. add_dependence was invoked with (insn == elem)). */ + unsigned int has_internal_dep; + + /* NB: We can't place 'struct _deps_list' here instead of deps_list_t into + h_i_d because when h_i_d extends, addresses of the deps_list->first + change without updating deps_list->first->next->prev_nextp. Thus + BACK_DEPS and RESOLVED_BACK_DEPS are allocated on the heap and FORW_DEPS + list is allocated on the obstack. */ + + /* A list of hard backward dependencies. The insn is a consumer of all the + deps mentioned here. */ + deps_list_t hard_back_deps; + + /* A list of speculative (weak) dependencies. The insn is a consumer of all + the deps mentioned here. */ + deps_list_t spec_back_deps; + + /* A list of insns which depend on the instruction. Unlike 'back_deps', + it represents forward dependencies. */ + deps_list_t forw_deps; + + /* A list of scheduled producers of the instruction. Links are being moved + from 'back_deps' to 'resolved_back_deps' while scheduling. */ + deps_list_t resolved_back_deps; + + /* A list of scheduled consumers of the instruction. Links are being moved + from 'forw_deps' to 'resolved_forw_deps' while scheduling to fasten the + search in 'forw_deps'. */ + deps_list_t resolved_forw_deps; + + /* If the insn is conditional (either through COND_EXEC, or because + it is a conditional branch), this records the condition. NULL + for insns that haven't been seen yet or don't have a condition; + const_true_rtx to mark an insn without a condition, or with a + condition that has been clobbered by a subsequent insn. */ + rtx cond; + + /* For a conditional insn, a list of insns that could set the condition + register. Used when generating control dependencies. */ + rtx_insn_list *cond_deps; + + /* True if the condition in 'cond' should be reversed to get the actual + condition. */ + unsigned int reverse_cond : 1; + + /* Some insns (e.g. call) are not allowed to move across blocks. */ + unsigned int cant_move : 1; +}; + + +/* Bits used for storing values of the fields in the following + structure. */ +#define INCREASE_BITS 8 + +/* The structure describes how the corresponding insn increases the + register pressure for each pressure class. */ +struct reg_pressure_data +{ + /* Pressure increase for given class because of clobber. */ + unsigned int clobber_increase : INCREASE_BITS; + /* Increase in register pressure for given class because of register + sets. */ + unsigned int set_increase : INCREASE_BITS; + /* Pressure increase for given class because of unused register + set. */ + unsigned int unused_set_increase : INCREASE_BITS; + /* Pressure change: #sets - #deaths. */ + int change : INCREASE_BITS; +}; + +/* The following structure describes usage of registers by insns. */ +struct reg_use_data +{ + /* Regno used in the insn. */ + int regno; + /* Insn using the regno. */ + rtx_insn *insn; + /* Cyclic list of elements with the same regno. */ + struct reg_use_data *next_regno_use; + /* List of elements with the same insn. */ + struct reg_use_data *next_insn_use; +}; + +/* The following structure describes used sets of registers by insns. + Registers are pseudos whose pressure class is not NO_REGS or hard + registers available for allocations. */ +struct reg_set_data +{ + /* Regno used in the insn. */ + int regno; + /* Insn setting the regno. */ + rtx insn; + /* List of elements with the same insn. */ + struct reg_set_data *next_insn_set; +}; + +enum autopref_multipass_data_status { + /* Entry is irrelevant for auto-prefetcher. */ + AUTOPREF_MULTIPASS_DATA_IRRELEVANT = -2, + /* Entry is uninitialized. */ + AUTOPREF_MULTIPASS_DATA_UNINITIALIZED = -1, + /* Entry is relevant for auto-prefetcher and insn can be delayed + to allow another insn through. */ + AUTOPREF_MULTIPASS_DATA_NORMAL = 0, + /* Entry is relevant for auto-prefetcher, but insn should not be + delayed as that will break scheduling. */ + AUTOPREF_MULTIPASS_DATA_DONT_DELAY = 1 +}; + +/* Data for modeling cache auto-prefetcher. */ +struct autopref_multipass_data_ +{ + /* Base part of memory address. */ + rtx base; + + /* Memory offsets from the base. For single simple sets + only min_offset is valid. For multi-set insns min_offset + and max_offset record the minimum and maximum offsets from the same + base among the sets inside the PARALLEL. */ + int min_offset; + int max_offset; + + /* True if this is a load/store-multiple instruction. */ + bool multi_mem_insn_p; + + /* Entry status. */ + enum autopref_multipass_data_status status; +}; +typedef struct autopref_multipass_data_ autopref_multipass_data_def; +typedef autopref_multipass_data_def *autopref_multipass_data_t; + +struct _haifa_insn_data +{ + /* We can't place 'struct _deps_list' into h_i_d instead of deps_list_t + because when h_i_d extends, addresses of the deps_list->first + change without updating deps_list->first->next->prev_nextp. */ + + /* Logical uid gives the original ordering of the insns. */ + int luid; + + /* A priority for each insn. */ + int priority; + + /* The fusion priority for each insn. */ + int fusion_priority; + + /* The minimum clock tick at which the insn becomes ready. This is + used to note timing constraints for the insns in the pending list. */ + int tick; + + /* For insns that are scheduled at a fixed difference from another, + this records the tick in which they must be ready. */ + int exact_tick; + + /* INTER_TICK is used to adjust INSN_TICKs of instructions from the + subsequent blocks in a region. */ + int inter_tick; + + /* Used temporarily to estimate an INSN_TICK value for an insn given + current knowledge. */ + int tick_estimate; + + /* See comment on QUEUE_INDEX macro in haifa-sched.c. */ + int queue_index; + + short cost; + + /* '> 0' if priority is valid, + '== 0' if priority was not yet computed, + '< 0' if priority in invalid and should be recomputed. */ + signed char priority_status; + + /* Set if there's DEF-USE dependence between some speculatively + moved load insn and this one. */ + unsigned int fed_by_spec_load : 1; + unsigned int is_load_insn : 1; + /* Nonzero if this insn has negative-cost forward dependencies against + an already scheduled insn. */ + unsigned int feeds_backtrack_insn : 1; + + /* Nonzero if this insn is a shadow of another, scheduled after a fixed + delay. We only emit shadows at the end of a cycle, with no other + real insns following them. */ + unsigned int shadow_p : 1; + + /* Used internally in unschedule_insns_until to mark insns that must have + their TODO_SPEC recomputed. */ + unsigned int must_recompute_spec : 1; + + /* What speculations are necessary to apply to schedule the instruction. */ + ds_t todo_spec; + + /* What speculations were already applied. */ + ds_t done_spec; + + /* What speculations are checked by this instruction. */ + ds_t check_spec; + + /* Recovery block for speculation checks. */ + basic_block recovery_block; + + /* Original pattern of the instruction. */ + rtx orig_pat; + + /* For insns with DEP_CONTROL dependencies, the predicated pattern if it + was ever successfully constructed. */ + rtx predicated_pat; + + /* The following array contains info how the insn increases register + pressure. There is an element for each cover class of pseudos + referenced in insns. */ + struct reg_pressure_data *reg_pressure; + /* The following array contains maximal reg pressure between last + scheduled insn and given insn. There is an element for each + pressure class of pseudos referenced in insns. This info updated + after scheduling each insn for each insn between the two + mentioned insns. */ + int *max_reg_pressure; + /* The following list contains info about used pseudos and hard + registers available for allocation. */ + struct reg_use_data *reg_use_list; + /* The following list contains info about set pseudos and hard + registers available for allocation. */ + struct reg_set_data *reg_set_list; + /* Info about how scheduling the insn changes cost of register + pressure excess (between source and target). */ + int reg_pressure_excess_cost_change; + int model_index; + + /* Original order of insns in the ready list. */ + int rfs_debug_orig_order; + + /* The deciding reason for INSN's place in the ready list. */ + int last_rfs_win; + + /* Two entries for cache auto-prefetcher model: one for mem reads, + and one for mem writes. */ + autopref_multipass_data_def autopref_multipass_data[2]; +}; + +typedef struct _haifa_insn_data haifa_insn_data_def; +typedef haifa_insn_data_def *haifa_insn_data_t; + + +extern vec h_i_d; + +#define HID(INSN) (&h_i_d[INSN_UID (INSN)]) + +/* Accessor macros for h_i_d. There are more in haifa-sched.c and + sched-rgn.c. */ +#define INSN_PRIORITY(INSN) (HID (INSN)->priority) +#define INSN_FUSION_PRIORITY(INSN) (HID (INSN)->fusion_priority) +#define INSN_REG_PRESSURE(INSN) (HID (INSN)->reg_pressure) +#define INSN_MAX_REG_PRESSURE(INSN) (HID (INSN)->max_reg_pressure) +#define INSN_REG_USE_LIST(INSN) (HID (INSN)->reg_use_list) +#define INSN_REG_SET_LIST(INSN) (HID (INSN)->reg_set_list) +#define INSN_REG_PRESSURE_EXCESS_COST_CHANGE(INSN) \ + (HID (INSN)->reg_pressure_excess_cost_change) +#define INSN_PRIORITY_STATUS(INSN) (HID (INSN)->priority_status) +#define INSN_MODEL_INDEX(INSN) (HID (INSN)->model_index) +#define INSN_AUTOPREF_MULTIPASS_DATA(INSN) \ + (HID (INSN)->autopref_multipass_data) + +typedef struct _haifa_deps_insn_data haifa_deps_insn_data_def; +typedef haifa_deps_insn_data_def *haifa_deps_insn_data_t; + + +extern vec h_d_i_d; + +#define HDID(INSN) (&h_d_i_d[INSN_LUID (INSN)]) +#define INSN_DEP_COUNT(INSN) (HDID (INSN)->dep_count) +#define HAS_INTERNAL_DEP(INSN) (HDID (INSN)->has_internal_dep) +#define INSN_FORW_DEPS(INSN) (HDID (INSN)->forw_deps) +#define INSN_RESOLVED_BACK_DEPS(INSN) (HDID (INSN)->resolved_back_deps) +#define INSN_RESOLVED_FORW_DEPS(INSN) (HDID (INSN)->resolved_forw_deps) +#define INSN_HARD_BACK_DEPS(INSN) (HDID (INSN)->hard_back_deps) +#define INSN_SPEC_BACK_DEPS(INSN) (HDID (INSN)->spec_back_deps) +#define INSN_CACHED_COND(INSN) (HDID (INSN)->cond) +#define INSN_REVERSE_COND(INSN) (HDID (INSN)->reverse_cond) +#define INSN_COND_DEPS(INSN) (HDID (INSN)->cond_deps) +#define CANT_MOVE(INSN) (HDID (INSN)->cant_move) +#define CANT_MOVE_BY_LUID(LUID) (h_d_i_d[LUID].cant_move) + + +#define INSN_PRIORITY(INSN) (HID (INSN)->priority) +#define INSN_PRIORITY_STATUS(INSN) (HID (INSN)->priority_status) +#define INSN_PRIORITY_KNOWN(INSN) (INSN_PRIORITY_STATUS (INSN) > 0) +#define TODO_SPEC(INSN) (HID (INSN)->todo_spec) +#define DONE_SPEC(INSN) (HID (INSN)->done_spec) +#define CHECK_SPEC(INSN) (HID (INSN)->check_spec) +#define RECOVERY_BLOCK(INSN) (HID (INSN)->recovery_block) +#define ORIG_PAT(INSN) (HID (INSN)->orig_pat) +#define PREDICATED_PAT(INSN) (HID (INSN)->predicated_pat) + +/* INSN is either a simple or a branchy speculation check. */ +#define IS_SPECULATION_CHECK_P(INSN) \ + (sel_sched_p () ? sel_insn_is_speculation_check (INSN) : RECOVERY_BLOCK (INSN) != NULL) + +/* INSN is a speculation check that will simply reexecute the speculatively + scheduled instruction if the speculation fails. */ +#define IS_SPECULATION_SIMPLE_CHECK_P(INSN) \ + (RECOVERY_BLOCK (INSN) == EXIT_BLOCK_PTR_FOR_FN (cfun)) + +/* INSN is a speculation check that will branch to RECOVERY_BLOCK if the + speculation fails. Insns in that block will reexecute the speculatively + scheduled code and then will return immediately after INSN thus preserving + semantics of the program. */ +#define IS_SPECULATION_BRANCHY_CHECK_P(INSN) \ + (RECOVERY_BLOCK (INSN) != NULL \ + && RECOVERY_BLOCK (INSN) != EXIT_BLOCK_PTR_FOR_FN (cfun)) + + +/* Dep status (aka ds_t) of the link encapsulates all information for a given + dependency, including everything that is needed for speculative scheduling. + + The lay-out of a ds_t is as follows: + + 1. Integers corresponding to the probability of the dependence to *not* + exist. This is the probability that overcoming this dependence will + not be followed by execution of the recovery code. Note that however + high this probability is, the recovery code should still always be + generated to preserve semantics of the program. + + The probability values can be set or retrieved using the functions + the set_dep_weak() and get_dep_weak() in sched-deps.c. The values + are always in the range [0, MAX_DEP_WEAK]. + + BEGIN_DATA : BITS_PER_DEP_WEAK + BE_IN_DATA : BITS_PER_DEP_WEAK + BEGIN_CONTROL : BITS_PER_DEP_WEAK + BE_IN_CONTROL : BITS_PER_DEP_WEAK + + The basic type of DS_T is a host int. For a 32-bits int, the values + will each take 6 bits. + + 2. The type of dependence. This supercedes the old-style REG_NOTE_KIND + values. TODO: Use this field instead of DEP_TYPE, or make DEP_TYPE + extract the dependence type from here. + + dep_type : 4 => DEP_{TRUE|OUTPUT|ANTI|CONTROL} + + 3. Various flags: + + HARD_DEP : 1 => Set if an instruction has a non-speculative + dependence. This is an instruction property + so this bit can only appear in the TODO_SPEC + field of an instruction. + DEP_POSTPONED : 1 => Like HARD_DEP, but the hard dependence may + still be broken by adjusting the instruction. + DEP_CANCELLED : 1 => Set if a dependency has been broken using + some form of speculation. + RESERVED : 1 => Reserved for use in the delay slot scheduler. + + See also: check_dep_status () in sched-deps.c . */ + +/* The number of bits per weakness probability. There are 4 weakness types + and we need 8 bits for other data in a DS_T. */ +#define BITS_PER_DEP_WEAK ((BITS_PER_DEP_STATUS - 8) / 4) + +/* Mask of speculative weakness in dep_status. */ +#define DEP_WEAK_MASK ((1 << BITS_PER_DEP_WEAK) - 1) + +/* This constant means that dependence is fake with 99.999...% probability. + This is the maximum value, that can appear in dep_status. + Note, that we don't want MAX_DEP_WEAK to be the same as DEP_WEAK_MASK for + debugging reasons. Though, it can be set to DEP_WEAK_MASK, and, when + done so, we'll get fast (mul for)/(div by) NO_DEP_WEAK. */ +#define MAX_DEP_WEAK (DEP_WEAK_MASK - 1) + +/* This constant means that dependence is 99.999...% real and it is a really + bad idea to overcome it (though this can be done, preserving program + semantics). */ +#define MIN_DEP_WEAK 1 + +/* This constant represents 100% probability. + E.g. it is used to represent weakness of dependence, that doesn't exist. + This value never appears in a ds_t, it is only used for computing the + weakness of a dependence. */ +#define NO_DEP_WEAK (MAX_DEP_WEAK + MIN_DEP_WEAK) + +/* Default weakness of speculative dependence. Used when we can't say + neither bad nor good about the dependence. */ +#define UNCERTAIN_DEP_WEAK (MAX_DEP_WEAK - MAX_DEP_WEAK / 4) + +/* Offset for speculative weaknesses in dep_status. */ +enum SPEC_TYPES_OFFSETS { + BEGIN_DATA_BITS_OFFSET = 0, + BE_IN_DATA_BITS_OFFSET = BEGIN_DATA_BITS_OFFSET + BITS_PER_DEP_WEAK, + BEGIN_CONTROL_BITS_OFFSET = BE_IN_DATA_BITS_OFFSET + BITS_PER_DEP_WEAK, + BE_IN_CONTROL_BITS_OFFSET = BEGIN_CONTROL_BITS_OFFSET + BITS_PER_DEP_WEAK +}; + +/* The following defines provide numerous constants used to distinguish + between different types of speculative dependencies. They are also + used as masks to clear/preserve the bits corresponding to the type + of dependency weakness. */ + +/* Dependence can be overcome with generation of new data speculative + instruction. */ +#define BEGIN_DATA (((ds_t) DEP_WEAK_MASK) << BEGIN_DATA_BITS_OFFSET) + +/* This dependence is to the instruction in the recovery block, that was + formed to recover after data-speculation failure. + Thus, this dependence can overcome with generating of the copy of + this instruction in the recovery block. */ +#define BE_IN_DATA (((ds_t) DEP_WEAK_MASK) << BE_IN_DATA_BITS_OFFSET) + +/* Dependence can be overcome with generation of new control speculative + instruction. */ +#define BEGIN_CONTROL (((ds_t) DEP_WEAK_MASK) << BEGIN_CONTROL_BITS_OFFSET) + +/* This dependence is to the instruction in the recovery block, that was + formed to recover after control-speculation failure. + Thus, this dependence can be overcome with generating of the copy of + this instruction in the recovery block. */ +#define BE_IN_CONTROL (((ds_t) DEP_WEAK_MASK) << BE_IN_CONTROL_BITS_OFFSET) + +/* A few convenient combinations. */ +#define BEGIN_SPEC (BEGIN_DATA | BEGIN_CONTROL) +#define DATA_SPEC (BEGIN_DATA | BE_IN_DATA) +#define CONTROL_SPEC (BEGIN_CONTROL | BE_IN_CONTROL) +#define SPECULATIVE (DATA_SPEC | CONTROL_SPEC) +#define BE_IN_SPEC (BE_IN_DATA | BE_IN_CONTROL) + +/* Constants, that are helpful in iterating through dep_status. */ +#define FIRST_SPEC_TYPE BEGIN_DATA +#define LAST_SPEC_TYPE BE_IN_CONTROL +#define SPEC_TYPE_SHIFT BITS_PER_DEP_WEAK + +/* Dependence on instruction can be of multiple types + (e.g. true and output). This fields enhance REG_NOTE_KIND information + of the dependence. */ +#define DEP_TRUE (((ds_t) 1) << (BE_IN_CONTROL_BITS_OFFSET + BITS_PER_DEP_WEAK)) +#define DEP_OUTPUT (DEP_TRUE << 1) +#define DEP_ANTI (DEP_OUTPUT << 1) +#define DEP_CONTROL (DEP_ANTI << 1) + +#define DEP_TYPES (DEP_TRUE | DEP_OUTPUT | DEP_ANTI | DEP_CONTROL) + +/* Instruction has non-speculative dependence. This bit represents the + property of an instruction - not the one of a dependence. + Therefore, it can appear only in the TODO_SPEC field of an instruction. */ +#define HARD_DEP (DEP_CONTROL << 1) + +/* Like HARD_DEP, but dependencies can perhaps be broken by modifying + the instructions. This is used for example to change: + + rn++ => rm=[rn + 4] + rm=[rn] rn++ + + For instructions that have this bit set, one of the dependencies of + the instructions will have a non-NULL REPLACE field in its DEP_T. + Just like HARD_DEP, this bit is only ever set in TODO_SPEC. */ +#define DEP_POSTPONED (HARD_DEP << 1) + +/* Set if a dependency is cancelled via speculation. */ +#define DEP_CANCELLED (DEP_POSTPONED << 1) + + +/* This represents the results of calling sched-deps.c functions, + which modify dependencies. */ +enum DEPS_ADJUST_RESULT { + /* No dependence needed (e.g. producer == consumer). */ + DEP_NODEP, + /* Dependence is already present and wasn't modified. */ + DEP_PRESENT, + /* Existing dependence was modified to include additional information. */ + DEP_CHANGED, + /* New dependence has been created. */ + DEP_CREATED +}; + +/* Represents the bits that can be set in the flags field of the + sched_info structure. */ +enum SCHED_FLAGS { + /* If set, generate links between instruction as DEPS_LIST. + Otherwise, generate usual INSN_LIST links. */ + USE_DEPS_LIST = 1, + /* Perform data or control (or both) speculation. + Results in generation of data and control speculative dependencies. + Requires USE_DEPS_LIST set. */ + DO_SPECULATION = USE_DEPS_LIST << 1, + DO_BACKTRACKING = DO_SPECULATION << 1, + DO_PREDICATION = DO_BACKTRACKING << 1, + DONT_BREAK_DEPENDENCIES = DO_PREDICATION << 1, + SCHED_RGN = DONT_BREAK_DEPENDENCIES << 1, + SCHED_EBB = SCHED_RGN << 1, + /* Scheduler can possibly create new basic blocks. Used for assertions. */ + NEW_BBS = SCHED_EBB << 1, + SEL_SCHED = NEW_BBS << 1 +}; + +enum SPEC_SCHED_FLAGS { + COUNT_SPEC_IN_CRITICAL_PATH = 1, + SEL_SCHED_SPEC_DONT_CHECK_CONTROL = COUNT_SPEC_IN_CRITICAL_PATH << 1 +}; + +#define NOTE_NOT_BB_P(NOTE) (NOTE_P (NOTE) && (NOTE_KIND (NOTE) \ + != NOTE_INSN_BASIC_BLOCK)) + +extern FILE *sched_dump; +extern int sched_verbose; + +extern spec_info_t spec_info; +extern bool haifa_recovery_bb_ever_added_p; + +/* Exception Free Loads: + + We define five classes of speculative loads: IFREE, IRISKY, + PFREE, PRISKY, and MFREE. + + IFREE loads are loads that are proved to be exception-free, just + by examining the load insn. Examples for such loads are loads + from TOC and loads of global data. + + IRISKY loads are loads that are proved to be exception-risky, + just by examining the load insn. Examples for such loads are + volatile loads and loads from shared memory. + + PFREE loads are loads for which we can prove, by examining other + insns, that they are exception-free. Currently, this class consists + of loads for which we are able to find a "similar load", either in + the target block, or, if only one split-block exists, in that split + block. Load2 is similar to load1 if both have same single base + register. We identify only part of the similar loads, by finding + an insn upon which both load1 and load2 have a DEF-USE dependence. + + PRISKY loads are loads for which we can prove, by examining other + insns, that they are exception-risky. Currently we have two proofs for + such loads. The first proof detects loads that are probably guarded by a + test on the memory address. This proof is based on the + backward and forward data dependence information for the region. + Let load-insn be the examined load. + Load-insn is PRISKY iff ALL the following hold: + + - insn1 is not in the same block as load-insn + - there is a DEF-USE dependence chain (insn1, ..., load-insn) + - test-insn is either a compare or a branch, not in the same block + as load-insn + - load-insn is reachable from test-insn + - there is a DEF-USE dependence chain (insn1, ..., test-insn) + + This proof might fail when the compare and the load are fed + by an insn not in the region. To solve this, we will add to this + group all loads that have no input DEF-USE dependence. + + The second proof detects loads that are directly or indirectly + fed by a speculative load. This proof is affected by the + scheduling process. We will use the flag fed_by_spec_load. + Initially, all insns have this flag reset. After a speculative + motion of an insn, if insn is either a load, or marked as + fed_by_spec_load, we will also mark as fed_by_spec_load every + insn1 for which a DEF-USE dependence (insn, insn1) exists. A + load which is fed_by_spec_load is also PRISKY. + + MFREE (maybe-free) loads are all the remaining loads. They may be + exception-free, but we cannot prove it. + + Now, all loads in IFREE and PFREE classes are considered + exception-free, while all loads in IRISKY and PRISKY classes are + considered exception-risky. As for loads in the MFREE class, + these are considered either exception-free or exception-risky, + depending on whether we are pessimistic or optimistic. We have + to take the pessimistic approach to assure the safety of + speculative scheduling, but we can take the optimistic approach + by invoking the -fsched_spec_load_dangerous option. */ + +enum INSN_TRAP_CLASS +{ + TRAP_FREE = 0, IFREE = 1, PFREE_CANDIDATE = 2, + PRISKY_CANDIDATE = 3, IRISKY = 4, TRAP_RISKY = 5 +}; + +#define WORST_CLASS(class1, class2) \ +((class1 > class2) ? class1 : class2) + +#ifndef __GNUC__ +#define __inline +#endif + +#ifndef HAIFA_INLINE +#define HAIFA_INLINE __inline +#endif + +struct sched_deps_info_def +{ + /* Called when computing dependencies for a JUMP_INSN. This function + should store the set of registers that must be considered as set by + the jump in the regset. */ + void (*compute_jump_reg_dependencies) (rtx, regset); + + /* Start analyzing insn. */ + void (*start_insn) (rtx_insn *); + + /* Finish analyzing insn. */ + void (*finish_insn) (void); + + /* Start analyzing insn LHS (Left Hand Side). */ + void (*start_lhs) (rtx); + + /* Finish analyzing insn LHS. */ + void (*finish_lhs) (void); + + /* Start analyzing insn RHS (Right Hand Side). */ + void (*start_rhs) (rtx); + + /* Finish analyzing insn RHS. */ + void (*finish_rhs) (void); + + /* Note set of the register. */ + void (*note_reg_set) (int); + + /* Note clobber of the register. */ + void (*note_reg_clobber) (int); + + /* Note use of the register. */ + void (*note_reg_use) (int); + + /* Note memory dependence of type DS between MEM1 and MEM2 (which is + in the INSN2). */ + void (*note_mem_dep) (rtx mem1, rtx mem2, rtx_insn *insn2, ds_t ds); + + /* Note a dependence of type DS from the INSN. */ + void (*note_dep) (rtx_insn *, ds_t ds); + + /* Nonzero if we should use cselib for better alias analysis. This + must be 0 if the dependency information is used after sched_analyze + has completed, e.g. if we're using it to initialize state for successor + blocks in region scheduling. */ + unsigned int use_cselib : 1; + + /* If set, generate links between instruction as DEPS_LIST. + Otherwise, generate usual INSN_LIST links. */ + unsigned int use_deps_list : 1; + + /* Generate data and control speculative dependencies. + Requires USE_DEPS_LIST set. */ + unsigned int generate_spec_deps : 1; +}; + +extern struct sched_deps_info_def *sched_deps_info; + + +/* Functions in sched-deps.c. */ +extern rtx sched_get_reverse_condition_uncached (const rtx_insn *); +extern bool sched_insns_conditions_mutex_p (const rtx_insn *, + const rtx_insn *); +extern bool sched_insn_is_legitimate_for_speculation_p (const rtx_insn *, ds_t); +extern void add_dependence (rtx_insn *, rtx_insn *, enum reg_note); +extern void sched_analyze (struct deps_desc *, rtx_insn *, rtx_insn *); +extern void init_deps (struct deps_desc *, bool); +extern void init_deps_reg_last (struct deps_desc *); +extern void free_deps (struct deps_desc *); +extern void init_deps_global (void); +extern void finish_deps_global (void); +extern void deps_analyze_insn (struct deps_desc *, rtx_insn *); +extern void remove_from_deps (struct deps_desc *, rtx_insn *); +extern void init_insn_reg_pressure_info (rtx_insn *); +extern void get_implicit_reg_pending_clobbers (HARD_REG_SET *, rtx_insn *); + +extern dw_t get_dep_weak (ds_t, ds_t); +extern ds_t set_dep_weak (ds_t, ds_t, dw_t); +extern dw_t estimate_dep_weak (rtx, rtx); +extern ds_t ds_merge (ds_t, ds_t); +extern ds_t ds_full_merge (ds_t, ds_t, rtx, rtx); +extern ds_t ds_max_merge (ds_t, ds_t); +extern dw_t ds_weak (ds_t); +extern ds_t ds_get_speculation_types (ds_t); +extern ds_t ds_get_max_dep_weak (ds_t); + +extern void sched_deps_init (bool); +extern void sched_deps_finish (void); + +extern void haifa_note_reg_set (int); +extern void haifa_note_reg_clobber (int); +extern void haifa_note_reg_use (int); + +extern void maybe_extend_reg_info_p (void); + +extern void deps_start_bb (struct deps_desc *, rtx_insn *); +extern enum reg_note ds_to_dt (ds_t); + +extern bool deps_pools_are_empty_p (void); +extern void sched_free_deps (rtx_insn *, rtx_insn *, bool); +extern void extend_dependency_caches (int, bool); + +extern void debug_ds (ds_t); + + +/* Functions in haifa-sched.c. */ +extern void initialize_live_range_shrinkage (void); +extern void finish_live_range_shrinkage (void); +extern void sched_init_region_reg_pressure_info (void); +extern void free_global_sched_pressure_data (void); +extern int haifa_classify_insn (const_rtx); +extern void get_ebb_head_tail (basic_block, basic_block, + rtx_insn **, rtx_insn **); +extern int no_real_insns_p (const rtx_insn *, const rtx_insn *); + +extern int insn_cost (rtx_insn *); +extern int dep_cost_1 (dep_t, dw_t); +extern int dep_cost (dep_t); +extern int set_priorities (rtx_insn *, rtx_insn *); + +extern void sched_setup_bb_reg_pressure_info (basic_block, rtx_insn *); +extern bool schedule_block (basic_block *, state_t); + +extern int cycle_issued_insns; +extern int issue_rate; +extern int dfa_lookahead; + +extern int autopref_multipass_dfa_lookahead_guard (rtx_insn *, int); + +extern rtx_insn *ready_element (struct ready_list *, int); +extern rtx_insn **ready_lastpos (struct ready_list *); + +extern int try_ready (rtx_insn *); +extern void sched_extend_ready_list (int); +extern void sched_finish_ready_list (void); +extern void sched_change_pattern (rtx, rtx); +extern int sched_speculate_insn (rtx_insn *, ds_t, rtx *); +extern void unlink_bb_notes (basic_block, basic_block); +extern void add_block (basic_block, basic_block); +extern rtx_note *bb_note (basic_block); +extern void concat_note_lists (rtx_insn *, rtx_insn **); +extern rtx_insn *sched_emit_insn (rtx); +extern rtx_insn *get_ready_element (int); +extern int number_in_ready (void); + +/* Types and functions in sched-ebb.c. */ + +extern basic_block schedule_ebb (rtx_insn *, rtx_insn *, bool); +extern void schedule_ebbs_init (void); +extern void schedule_ebbs_finish (void); + +/* Types and functions in sched-rgn.c. */ + +/* A region is the main entity for interblock scheduling: insns + are allowed to move between blocks in the same region, along + control flow graph edges, in the 'up' direction. */ +struct region +{ + /* Number of extended basic blocks in region. */ + int rgn_nr_blocks; + /* cblocks in the region (actually index in rgn_bb_table). */ + int rgn_blocks; + /* Dependencies for this region are already computed. Basically, indicates, + that this is a recovery block. */ + unsigned int dont_calc_deps : 1; + /* This region has at least one non-trivial ebb. */ + unsigned int has_real_ebb : 1; +}; + +extern int nr_regions; +extern region *rgn_table; +extern int *rgn_bb_table; +extern int *block_to_bb; +extern int *containing_rgn; + +/* Often used short-hand in the scheduler. The rest of the compiler uses + BLOCK_FOR_INSN(INSN) and an indirect reference to get the basic block + number ("index"). For historical reasons, the scheduler does not. */ +#define BLOCK_NUM(INSN) (BLOCK_FOR_INSN (INSN)->index + 0) + +#define RGN_NR_BLOCKS(rgn) (rgn_table[rgn].rgn_nr_blocks) +#define RGN_BLOCKS(rgn) (rgn_table[rgn].rgn_blocks) +#define RGN_DONT_CALC_DEPS(rgn) (rgn_table[rgn].dont_calc_deps) +#define RGN_HAS_REAL_EBB(rgn) (rgn_table[rgn].has_real_ebb) +#define BLOCK_TO_BB(block) (block_to_bb[block]) +#define CONTAINING_RGN(block) (containing_rgn[block]) + +/* The mapping from ebb to block. */ +extern int *ebb_head; +#define BB_TO_BLOCK(ebb) (rgn_bb_table[ebb_head[ebb]]) +#define EBB_FIRST_BB(ebb) BASIC_BLOCK_FOR_FN (cfun, BB_TO_BLOCK (ebb)) +#define EBB_LAST_BB(ebb) \ + BASIC_BLOCK_FOR_FN (cfun, rgn_bb_table[ebb_head[ebb + 1] - 1]) +#define INSN_BB(INSN) (BLOCK_TO_BB (BLOCK_NUM (INSN))) + +extern int current_nr_blocks; +extern int current_blocks; +extern int target_bb; +extern bool sched_no_dce; + +extern void set_modulo_params (int, int, int, int); +extern void record_delay_slot_pair (rtx_insn *, rtx_insn *, int, int); +extern rtx_insn *real_insn_for_shadow (rtx_insn *); +extern void discard_delay_pairs_above (int); +extern void free_delay_pairs (void); +extern void add_delay_dependencies (rtx_insn *); +extern bool sched_is_disabled_for_current_region_p (void); +extern void sched_rgn_init (bool); +extern void sched_rgn_finish (void); +extern void rgn_setup_region (int); +extern void sched_rgn_compute_dependencies (int); +extern void sched_rgn_local_init (int); +extern void sched_rgn_local_finish (void); +extern void sched_rgn_local_free (void); +extern void extend_regions (void); +extern void rgn_make_new_region_out_of_new_block (basic_block); + +extern void compute_priorities (void); +extern void increase_insn_priority (rtx_insn *, int); +extern void debug_rgn_dependencies (int); +extern void debug_dependencies (rtx_insn *, rtx_insn *); +extern void dump_rgn_dependencies_dot (FILE *); +extern void dump_rgn_dependencies_dot (const char *); + +extern void free_rgn_deps (void); +extern int contributes_to_priority (rtx_insn *, rtx_insn *); +extern void extend_rgns (int *, int *, sbitmap, int *); +extern void deps_join (struct deps_desc *, struct deps_desc *); + +extern void rgn_setup_common_sched_info (void); +extern void rgn_setup_sched_infos (void); + +extern void debug_regions (void); +extern void debug_region (int); +extern void dump_region_dot (FILE *, int); +extern void dump_region_dot_file (const char *, int); + +extern void haifa_sched_init (void); +extern void haifa_sched_finish (void); + +extern void find_modifiable_mems (rtx_insn *, rtx_insn *); + +/* sched-deps.c interface to walk, add, search, update, resolve, delete + and debug instruction dependencies. */ + +/* Constants defining dependences lists. */ + +/* No list. */ +#define SD_LIST_NONE (0) + +/* hard_back_deps. */ +#define SD_LIST_HARD_BACK (1) + +/* spec_back_deps. */ +#define SD_LIST_SPEC_BACK (2) + +/* forw_deps. */ +#define SD_LIST_FORW (4) + +/* resolved_back_deps. */ +#define SD_LIST_RES_BACK (8) + +/* resolved_forw_deps. */ +#define SD_LIST_RES_FORW (16) + +#define SD_LIST_BACK (SD_LIST_HARD_BACK | SD_LIST_SPEC_BACK) + +/* A type to hold above flags. */ +typedef int sd_list_types_def; + +extern void sd_next_list (const_rtx, sd_list_types_def *, deps_list_t *, bool *); + +/* Iterator to walk through, resolve and delete dependencies. */ +struct _sd_iterator +{ + /* What lists to walk. Can be any combination of SD_LIST_* flags. */ + sd_list_types_def types; + + /* Instruction dependencies lists of which will be walked. */ + rtx insn; + + /* Pointer to the next field of the previous element. This is not + simply a pointer to the next element to allow easy deletion from the + list. When a dep is being removed from the list the iterator + will automatically advance because the value in *linkp will start + referring to the next element. */ + dep_link_t *linkp; + + /* True if the current list is a resolved one. */ + bool resolved_p; +}; + +typedef struct _sd_iterator sd_iterator_def; + +/* ??? We can move some definitions that are used in below inline functions + out of sched-int.h to sched-deps.c provided that the below functions will + become global externals. + These definitions include: + * struct _deps_list: opaque pointer is needed at global scope. + * struct _dep_link: opaque pointer is needed at scope of sd_iterator_def. + * struct _dep_node: opaque pointer is needed at scope of + struct _deps_link. */ + +/* Return initialized iterator. */ +static inline sd_iterator_def +sd_iterator_start (rtx insn, sd_list_types_def types) +{ + /* Some dep_link a pointer to which will return NULL. */ + static dep_link_t null_link = NULL; + + sd_iterator_def i; + + i.types = types; + i.insn = insn; + i.linkp = &null_link; + + /* Avoid 'uninitialized warning'. */ + i.resolved_p = false; + + return i; +} + +/* Return the current element. */ +static inline bool +sd_iterator_cond (sd_iterator_def *it_ptr, dep_t *dep_ptr) +{ + while (true) + { + dep_link_t link = *it_ptr->linkp; + + if (link != NULL) + { + *dep_ptr = DEP_LINK_DEP (link); + return true; + } + else + { + sd_list_types_def types = it_ptr->types; + + if (types != SD_LIST_NONE) + /* Switch to next list. */ + { + deps_list_t list; + + sd_next_list (it_ptr->insn, + &it_ptr->types, &list, &it_ptr->resolved_p); + + if (list) + { + it_ptr->linkp = &DEPS_LIST_FIRST (list); + continue; + } + } + + *dep_ptr = NULL; + return false; + } + } +} + +/* Advance iterator. */ +static inline void +sd_iterator_next (sd_iterator_def *it_ptr) +{ + it_ptr->linkp = &DEP_LINK_NEXT (*it_ptr->linkp); +} + +/* A cycle wrapper. */ +#define FOR_EACH_DEP(INSN, LIST_TYPES, ITER, DEP) \ + for ((ITER) = sd_iterator_start ((INSN), (LIST_TYPES)); \ + sd_iterator_cond (&(ITER), &(DEP)); \ + sd_iterator_next (&(ITER))) + +#define IS_DISPATCH_ON 1 +#define IS_CMP 2 +#define DISPATCH_VIOLATION 3 +#define FITS_DISPATCH_WINDOW 4 +#define DISPATCH_INIT 5 +#define ADD_TO_DISPATCH_WINDOW 6 + +extern int sd_lists_size (const_rtx, sd_list_types_def); +extern bool sd_lists_empty_p (const_rtx, sd_list_types_def); +extern void sd_init_insn (rtx_insn *); +extern void sd_finish_insn (rtx_insn *); +extern dep_t sd_find_dep_between (rtx, rtx, bool); +extern void sd_add_dep (dep_t, bool); +extern enum DEPS_ADJUST_RESULT sd_add_or_update_dep (dep_t, bool); +extern void sd_resolve_dep (sd_iterator_def); +extern void sd_unresolve_dep (sd_iterator_def); +extern void sd_copy_back_deps (rtx_insn *, rtx_insn *, bool); +extern void sd_delete_dep (sd_iterator_def); +extern void sd_debug_lists (rtx, sd_list_types_def); + +/* Macros and declarations for scheduling fusion. */ +#define FUSION_MAX_PRIORITY (INT_MAX) +extern bool sched_fusion; + +#endif /* INSN_SCHEDULING */ + +#endif /* GCC_SCHED_INT_H */ + diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sdbout.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sdbout.h new file mode 100644 index 0000000..204b687 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sdbout.h @@ -0,0 +1,26 @@ +/* sdbout.h - Various declarations for functions found in sdbout.c + Copyright (C) 1998-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_SDBOUT_H +#define GCC_SDBOUT_H + +extern void sdbout_symbol (tree, int); +extern void sdbout_types (tree); + +#endif /* GCC_SDBOUT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sel-sched-dump.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sel-sched-dump.h new file mode 100644 index 0000000..ac35a1e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sel-sched-dump.h @@ -0,0 +1,233 @@ +/* Instruction scheduling pass. Log dumping infrastructure. + Copyright (C) 2006-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + + +#ifndef GCC_SEL_SCHED_DUMP_H +#define GCC_SEL_SCHED_DUMP_H + + + +/* These values control the dumping of control flow graph to the .dot file. */ +enum sel_dump_cfg_def + { + /* Dump only current region. */ + SEL_DUMP_CFG_CURRENT_REGION = 2, + + /* Dump note_list for this bb. */ + SEL_DUMP_CFG_BB_NOTES_LIST = 4, + + /* Dump availability set from the bb header. */ + SEL_DUMP_CFG_AV_SET = 8, + + /* Dump liveness set from the bb header. */ + SEL_DUMP_CFG_LV_SET = 16, + + /* Dump insns of the given block. */ + SEL_DUMP_CFG_BB_INSNS = 32, + + /* Show current fences when dumping cfg. */ + SEL_DUMP_CFG_FENCES = 64, + + /* Show insn's seqnos when dumping cfg. */ + SEL_DUMP_CFG_INSN_SEQNO = 128, + + /* Dump function name when dumping cfg. */ + SEL_DUMP_CFG_FUNCTION_NAME = 256, + + /* Dump loop father number of the given bb. */ + SEL_DUMP_CFG_BB_LOOP = 512, + + /* The default flags for cfg dumping. */ + SEL_DUMP_CFG_FLAGS = (SEL_DUMP_CFG_CURRENT_REGION + | SEL_DUMP_CFG_BB_NOTES_LIST + | SEL_DUMP_CFG_AV_SET + | SEL_DUMP_CFG_LV_SET + | SEL_DUMP_CFG_BB_INSNS + | SEL_DUMP_CFG_FENCES + | SEL_DUMP_CFG_INSN_SEQNO + | SEL_DUMP_CFG_BB_LOOP) + }; + +/* These values control the dumping of insns containing in expressions. */ +enum dump_insn_rtx_def + { + /* Dump insn's UID. */ + DUMP_INSN_RTX_UID = 2, + + /* Dump insn's pattern. */ + DUMP_INSN_RTX_PATTERN = 4, + + /* Dump insn's basic block number. */ + DUMP_INSN_RTX_BBN = 8, + + /* Dump all of the above. */ + DUMP_INSN_RTX_ALL = (DUMP_INSN_RTX_UID | DUMP_INSN_RTX_PATTERN + | DUMP_INSN_RTX_BBN) + }; + +extern void dump_insn_rtx_1 (rtx, int); +extern void dump_insn_rtx (rtx); +extern void debug_insn_rtx (rtx); + +/* These values control dumping of vinsns. The meaning of different fields + of a vinsn is explained in sel-sched-ir.h. */ +enum dump_vinsn_def + { + /* Dump the insn behind this vinsn. */ + DUMP_VINSN_INSN_RTX = 2, + + /* Dump vinsn's type. */ + DUMP_VINSN_TYPE = 4, + + /* Dump vinsn's count. */ + DUMP_VINSN_COUNT = 8, + + /* Dump the cost (default latency) of the insn behind this vinsn. */ + DUMP_VINSN_COST = 16, + + /* Dump all of the above. */ + DUMP_VINSN_ALL = (DUMP_VINSN_INSN_RTX | DUMP_VINSN_TYPE | DUMP_VINSN_COUNT + | DUMP_VINSN_COST) + }; + +extern void dump_vinsn_1 (vinsn_t, int); +extern void dump_vinsn (vinsn_t); +extern void debug_vinsn (vinsn_t); + +extern void debug (vinsn_def &ref); +extern void debug (vinsn_def *ptr); +extern void debug_verbose (vinsn_def &ref); +extern void debug_verbose (vinsn_def *ptr); + + +/* These values control dumping of expressions. The meaning of the fields + is explained in sel-sched-ir.h. */ +enum dump_expr_def + { + /* Dump the vinsn behind this expression. */ + DUMP_EXPR_VINSN = 2, + + /* Dump expression's SPEC parameter. */ + DUMP_EXPR_SPEC = 4, + + /* Dump expression's priority. */ + DUMP_EXPR_PRIORITY = 8, + + /* Dump the number of times this expression was scheduled. */ + DUMP_EXPR_SCHED_TIMES = 16, + + /* Dump speculative status of the expression. */ + DUMP_EXPR_SPEC_DONE_DS = 32, + + /* Dump the basic block number which originated this expression. */ + DUMP_EXPR_ORIG_BB = 64, + + /* Dump expression's usefulness. */ + DUMP_EXPR_USEFULNESS = 128, + + /* Dump all of the above. */ + DUMP_EXPR_ALL = (DUMP_EXPR_VINSN | DUMP_EXPR_SPEC | DUMP_EXPR_PRIORITY + | DUMP_EXPR_SCHED_TIMES | DUMP_EXPR_SPEC_DONE_DS + | DUMP_EXPR_ORIG_BB | DUMP_EXPR_USEFULNESS) + }; + +extern void dump_expr_1 (expr_t, int); +extern void dump_expr (expr_t); +extern void debug_expr (expr_t); + +extern void debug (expr_def &ref); +extern void debug (expr_def *ptr); +extern void debug_verbose (expr_def &ref); +extern void debug_verbose (expr_def *ptr); + + +/* A enumeration for dumping flags of an insn. The difference from + dump_insn_rtx_def is that these fields are for insns in stream only. */ +enum dump_insn_def +{ + /* Dump expression of this insn. */ + DUMP_INSN_EXPR = 2, + + /* Dump insn's seqno. */ + DUMP_INSN_SEQNO = 4, + + /* Dump the cycle on which insn was scheduled. */ + DUMP_INSN_SCHED_CYCLE = 8, + + /* Dump insn's UID. */ + DUMP_INSN_UID = 16, + + /* Dump insn's pattern. */ + DUMP_INSN_PATTERN = 32, + + /* Dump insn's basic block number. */ + DUMP_INSN_BBN = 64, + + /* Dump all of the above. */ + DUMP_INSN_ALL = (DUMP_INSN_EXPR | DUMP_INSN_SEQNO | DUMP_INSN_BBN + | DUMP_INSN_SCHED_CYCLE | DUMP_INSN_UID | DUMP_INSN_PATTERN) +}; + +extern void dump_insn_1 (insn_t, int); +extern void dump_insn (insn_t); +extern void debug_insn (insn_t); + +/* When this flag is on, we are dumping to the .dot file. + When it is off, we are dumping to log. */ +extern bool sched_dump_to_dot_p; + + +/* Functions from sel-sched-dump.c. */ +extern void sel_print (const char *fmt, ...) ATTRIBUTE_PRINTF_1; +extern const char * sel_print_insn (const rtx_insn *, int); +extern void free_sel_dump_data (void); + +extern void block_start (void); +extern void block_finish (void); +extern int get_print_blocks_num (void); +extern void line_start (void); +extern void line_finish (void); + +extern void sel_print_rtl (rtx x); +extern void dump_insn_1 (insn_t, int); +extern void dump_insn (insn_t); +extern void dump_insn_vector (rtx_vec_t); +extern void dump_expr (expr_t); +extern void dump_used_regs (bitmap); +extern void dump_av_set (av_set_t); +extern void dump_lv_set (regset); +extern void dump_blist (blist_t); +extern void dump_flist (flist_t); +extern void dump_hard_reg_set (const char *, HARD_REG_SET); +extern void sel_debug_cfg_1 (int); +extern void sel_debug_cfg (void); +extern void setup_dump_cfg_params (void); + +/* Debug functions. */ +extern void debug_expr (expr_t); +extern void debug_av_set (av_set_t); +extern void debug_lv_set (regset); +extern void debug_ilist (ilist_t); +extern void debug_blist (blist_t); +extern void debug (vec &ref); +extern void debug (vec *ptr); +extern void debug_insn_vector (rtx_vec_t); +extern void debug_hard_reg_set (HARD_REG_SET); +extern rtx debug_mem_addr_value (rtx); +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sel-sched-ir.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sel-sched-ir.h new file mode 100644 index 0000000..76ec10d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sel-sched-ir.h @@ -0,0 +1,1671 @@ +/* Instruction scheduling pass. This file contains definitions used + internally in the scheduler. + Copyright (C) 2006-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_SEL_SCHED_IR_H +#define GCC_SEL_SCHED_IR_H + +/* For state_t. */ +/* For reg_note. */ + +/* tc_t is a short for target context. This is a state of the target + backend. */ +typedef void *tc_t; + +/* List data types used for av sets, fences, paths, and boundaries. */ + +/* Forward declarations for types that are part of some list nodes. */ +struct _list_node; + +/* List backend. */ +typedef struct _list_node *_list_t; +#define _LIST_NEXT(L) ((L)->next) + +/* Instruction data that is part of vinsn type. */ +struct idata_def; +typedef struct idata_def *idata_t; + +/* A virtual instruction, i.e. an instruction as seen by the scheduler. */ +struct vinsn_def; +typedef struct vinsn_def *vinsn_t; + +/* RTX list. + This type is the backend for ilist. */ +typedef _list_t _xlist_t; +#define _XLIST_X(L) ((L)->u.x) +#define _XLIST_NEXT(L) (_LIST_NEXT (L)) + +/* Instruction. */ +typedef rtx_insn *insn_t; + +/* List of insns. */ +typedef _list_t ilist_t; +#define ILIST_INSN(L) ((L)->u.insn) +#define ILIST_NEXT(L) (_LIST_NEXT (L)) + +/* This lists possible transformations that done locally, i.e. in + moveup_expr. */ +enum local_trans_type + { + TRANS_SUBSTITUTION, + TRANS_SPECULATION + }; + +/* This struct is used to record the history of expression's + transformations. */ +struct expr_history_def_1 +{ + /* UID of the insn. */ + unsigned uid; + + /* How the expression looked like. */ + vinsn_t old_expr_vinsn; + + /* How the expression looks after the transformation. */ + vinsn_t new_expr_vinsn; + + /* And its speculative status. */ + ds_t spec_ds; + + /* Type of the transformation. */ + enum local_trans_type type; +}; + +typedef struct expr_history_def_1 expr_history_def; + + +/* Expression information. */ +struct _expr +{ + /* Insn description. */ + vinsn_t vinsn; + + /* SPEC is the degree of speculativeness. + FIXME: now spec is increased when an rhs is moved through a + conditional, thus showing only control speculativeness. In the + future we'd like to count data spec separately to allow a better + control on scheduling. */ + int spec; + + /* Degree of speculativeness measured as probability of executing + instruction's original basic block given relative to + the current scheduling point. */ + int usefulness; + + /* A priority of this expression. */ + int priority; + + /* A priority adjustment of this expression. */ + int priority_adj; + + /* Number of times the insn was scheduled. */ + int sched_times; + + /* A basic block index this was originated from. Zero when there is + more than one originator. */ + int orig_bb_index; + + /* Instruction should be of SPEC_DONE_DS type in order to be moved to this + point. */ + ds_t spec_done_ds; + + /* SPEC_TO_CHECK_DS hold speculation types that should be checked + (used only during move_op ()). */ + ds_t spec_to_check_ds; + + /* Cycle on which original insn was scheduled. Zero when it has not yet + been scheduled or more than one originator. */ + int orig_sched_cycle; + + /* This vector contains the history of insn's transformations. */ + vec history_of_changes; + + /* True (1) when original target (register or memory) of this instruction + is available for scheduling, false otherwise. -1 means we're not sure; + please run find_used_regs to clarify. */ + signed char target_available; + + /* True when this expression needs a speculation check to be scheduled. + This is used during find_used_regs. */ + BOOL_BITFIELD needs_spec_check_p : 1; + + /* True when the expression was substituted. Used for statistical + purposes. */ + BOOL_BITFIELD was_substituted : 1; + + /* True when the expression was renamed. */ + BOOL_BITFIELD was_renamed : 1; + + /* True when expression can't be moved. */ + BOOL_BITFIELD cant_move : 1; +}; + +typedef struct _expr expr_def; +typedef expr_def *expr_t; + +#define EXPR_VINSN(EXPR) ((EXPR)->vinsn) +#define EXPR_INSN_RTX(EXPR) (VINSN_INSN_RTX (EXPR_VINSN (EXPR))) +#define EXPR_PATTERN(EXPR) (VINSN_PATTERN (EXPR_VINSN (EXPR))) +#define EXPR_LHS(EXPR) (VINSN_LHS (EXPR_VINSN (EXPR))) +#define EXPR_RHS(EXPR) (VINSN_RHS (EXPR_VINSN (EXPR))) +#define EXPR_TYPE(EXPR) (VINSN_TYPE (EXPR_VINSN (EXPR))) +#define EXPR_SEPARABLE_P(EXPR) (VINSN_SEPARABLE_P (EXPR_VINSN (EXPR))) + +#define EXPR_SPEC(EXPR) ((EXPR)->spec) +#define EXPR_USEFULNESS(EXPR) ((EXPR)->usefulness) +#define EXPR_PRIORITY(EXPR) ((EXPR)->priority) +#define EXPR_PRIORITY_ADJ(EXPR) ((EXPR)->priority_adj) +#define EXPR_SCHED_TIMES(EXPR) ((EXPR)->sched_times) +#define EXPR_ORIG_BB_INDEX(EXPR) ((EXPR)->orig_bb_index) +#define EXPR_ORIG_SCHED_CYCLE(EXPR) ((EXPR)->orig_sched_cycle) +#define EXPR_SPEC_DONE_DS(EXPR) ((EXPR)->spec_done_ds) +#define EXPR_SPEC_TO_CHECK_DS(EXPR) ((EXPR)->spec_to_check_ds) +#define EXPR_HISTORY_OF_CHANGES(EXPR) ((EXPR)->history_of_changes) +#define EXPR_TARGET_AVAILABLE(EXPR) ((EXPR)->target_available) +#define EXPR_NEEDS_SPEC_CHECK_P(EXPR) ((EXPR)->needs_spec_check_p) +#define EXPR_WAS_SUBSTITUTED(EXPR) ((EXPR)->was_substituted) +#define EXPR_WAS_RENAMED(EXPR) ((EXPR)->was_renamed) +#define EXPR_CANT_MOVE(EXPR) ((EXPR)->cant_move) + +/* Insn definition for list of original insns in find_used_regs. */ +struct _def +{ + insn_t orig_insn; + + /* FIXME: Get rid of CROSSES_CALL in each def, since if we're moving up + rhs from two different places, but only one of the code motion paths + crosses a call, we can't use any of the call_used_regs, no matter which + path or whether all paths crosses a call. Thus we should move CROSSES_CALL + to static params. */ + bool crosses_call; +}; +typedef struct _def *def_t; + + +/* Availability sets are sets of expressions we're scheduling. */ +typedef _list_t av_set_t; +#define _AV_SET_EXPR(L) (&(L)->u.expr) +#define _AV_SET_NEXT(L) (_LIST_NEXT (L)) + + +/* Boundary of the current fence group. */ +struct _bnd +{ + /* The actual boundary instruction. */ + insn_t to; + + /* Its path to the fence. */ + ilist_t ptr; + + /* Availability set at the boundary. */ + av_set_t av; + + /* This set moved to the fence. */ + av_set_t av1; + + /* Deps context at this boundary. As long as we have one boundary per fence, + this is just a pointer to the same deps context as in the corresponding + fence. */ + deps_t dc; +}; +typedef struct _bnd *bnd_t; +#define BND_TO(B) ((B)->to) + +/* PTR stands not for pointer as you might think, but as a Path To Root of the + current instruction group from boundary B. */ +#define BND_PTR(B) ((B)->ptr) +#define BND_AV(B) ((B)->av) +#define BND_AV1(B) ((B)->av1) +#define BND_DC(B) ((B)->dc) + +/* List of boundaries. */ +typedef _list_t blist_t; +#define BLIST_BND(L) (&(L)->u.bnd) +#define BLIST_NEXT(L) (_LIST_NEXT (L)) + + +/* Fence information. A fence represents current scheduling point and also + blocks code motion through it when pipelining. */ +struct _fence +{ + /* Insn before which we gather an instruction group.*/ + insn_t insn; + + /* Modeled state of the processor pipeline. */ + state_t state; + + /* Current cycle that is being scheduled on this fence. */ + int cycle; + + /* Number of insns that were scheduled on the current cycle. + This information has to be local to a fence. */ + int cycle_issued_insns; + + /* At the end of fill_insns () this field holds the list of the instructions + that are inner boundaries of the scheduled parallel group. */ + ilist_t bnds; + + /* Deps context at this fence. It is used to model dependencies at the + fence so that insn ticks can be properly evaluated. */ + deps_t dc; + + /* Target context at this fence. Used to save and load any local target + scheduling information when changing fences. */ + tc_t tc; + + /* A vector of insns that are scheduled but not yet completed. */ + vec *executing_insns; + + /* A vector indexed by UIDs that caches the earliest cycle on which + an insn can be scheduled on this fence. */ + int *ready_ticks; + + /* Its size. */ + int ready_ticks_size; + + /* Insn, which has been scheduled last on this fence. */ + rtx_insn *last_scheduled_insn; + + /* The last value of can_issue_more variable on this fence. */ + int issue_more; + + /* If non-NULL force the next scheduled insn to be SCHED_NEXT. */ + rtx_insn *sched_next; + + /* True if fill_insns processed this fence. */ + BOOL_BITFIELD processed_p : 1; + + /* True if fill_insns actually scheduled something on this fence. */ + BOOL_BITFIELD scheduled_p : 1; + + /* True when the next insn scheduled here would start a cycle. */ + BOOL_BITFIELD starts_cycle_p : 1; + + /* True when the next insn scheduled here would be scheduled after a stall. */ + BOOL_BITFIELD after_stall_p : 1; +}; +typedef struct _fence *fence_t; + +#define FENCE_INSN(F) ((F)->insn) +#define FENCE_STATE(F) ((F)->state) +#define FENCE_BNDS(F) ((F)->bnds) +#define FENCE_PROCESSED_P(F) ((F)->processed_p) +#define FENCE_SCHEDULED_P(F) ((F)->scheduled_p) +#define FENCE_ISSUED_INSNS(F) ((F)->cycle_issued_insns) +#define FENCE_CYCLE(F) ((F)->cycle) +#define FENCE_STARTS_CYCLE_P(F) ((F)->starts_cycle_p) +#define FENCE_AFTER_STALL_P(F) ((F)->after_stall_p) +#define FENCE_DC(F) ((F)->dc) +#define FENCE_TC(F) ((F)->tc) +#define FENCE_LAST_SCHEDULED_INSN(F) ((F)->last_scheduled_insn) +#define FENCE_ISSUE_MORE(F) ((F)->issue_more) +#define FENCE_EXECUTING_INSNS(F) ((F)->executing_insns) +#define FENCE_READY_TICKS(F) ((F)->ready_ticks) +#define FENCE_READY_TICKS_SIZE(F) ((F)->ready_ticks_size) +#define FENCE_SCHED_NEXT(F) ((F)->sched_next) + +/* List of fences. */ +typedef _list_t flist_t; +#define FLIST_FENCE(L) (&(L)->u.fence) +#define FLIST_NEXT(L) (_LIST_NEXT (L)) + +/* List of fences with pointer to the tail node. */ +struct flist_tail_def +{ + flist_t head; + flist_t *tailp; +}; + +typedef struct flist_tail_def *flist_tail_t; +#define FLIST_TAIL_HEAD(L) ((L)->head) +#define FLIST_TAIL_TAILP(L) ((L)->tailp) + +/* List node information. A list node can be any of the types above. */ +struct _list_node +{ + _list_t next; + + union + { + rtx x; + insn_t insn; + struct _bnd bnd; + expr_def expr; + struct _fence fence; + struct _def def; + void *data; + } u; +}; + + +/* _list_t functions. + All of _*list_* functions are used through accessor macros, thus + we can't move them in sel-sched-ir.c. */ +extern object_allocator<_list_node> sched_lists_pool; + +static inline _list_t +_list_alloc (void) +{ + return sched_lists_pool.allocate (); +} + +static inline void +_list_add (_list_t *lp) +{ + _list_t l = _list_alloc (); + + _LIST_NEXT (l) = *lp; + *lp = l; +} + +static inline void +_list_remove_nofree (_list_t *lp) +{ + _list_t n = *lp; + + *lp = _LIST_NEXT (n); +} + +static inline void +_list_remove (_list_t *lp) +{ + _list_t n = *lp; + + *lp = _LIST_NEXT (n); + sched_lists_pool.remove (n); +} + +static inline void +_list_clear (_list_t *l) +{ + while (*l) + _list_remove (l); +} + + +/* List iterator backend. */ +struct _list_iterator +{ + /* The list we're iterating. */ + _list_t *lp; + + /* True when this iterator supprts removing. */ + bool can_remove_p; + + /* True when we've actually removed something. */ + bool removed_p; +}; + +static inline void +_list_iter_start (_list_iterator *ip, _list_t *lp, bool can_remove_p) +{ + ip->lp = lp; + ip->can_remove_p = can_remove_p; + ip->removed_p = false; +} + +static inline void +_list_iter_next (_list_iterator *ip) +{ + if (!ip->removed_p) + ip->lp = &_LIST_NEXT (*ip->lp); + else + ip->removed_p = false; +} + +static inline void +_list_iter_remove (_list_iterator *ip) +{ + gcc_assert (!ip->removed_p && ip->can_remove_p); + _list_remove (ip->lp); + ip->removed_p = true; +} + +static inline void +_list_iter_remove_nofree (_list_iterator *ip) +{ + gcc_assert (!ip->removed_p && ip->can_remove_p); + _list_remove_nofree (ip->lp); + ip->removed_p = true; +} + +/* General macros to traverse a list. FOR_EACH_* interfaces are + implemented using these. */ +#define _FOR_EACH(TYPE, ELEM, I, L) \ + for (_list_iter_start (&(I), &(L), false); \ + _list_iter_cond_##TYPE (*(I).lp, &(ELEM)); \ + _list_iter_next (&(I))) + +#define _FOR_EACH_1(TYPE, ELEM, I, LP) \ + for (_list_iter_start (&(I), (LP), true); \ + _list_iter_cond_##TYPE (*(I).lp, &(ELEM)); \ + _list_iter_next (&(I))) + + +/* _xlist_t functions. */ + +static inline void +_xlist_add (_xlist_t *lp, rtx x) +{ + _list_add (lp); + _XLIST_X (*lp) = x; +} + +#define _xlist_remove(LP) (_list_remove (LP)) +#define _xlist_clear(LP) (_list_clear (LP)) + +static inline bool +_xlist_is_in_p (_xlist_t l, rtx x) +{ + while (l) + { + if (_XLIST_X (l) == x) + return true; + l = _XLIST_NEXT (l); + } + + return false; +} + +/* Used through _FOR_EACH. */ +static inline bool +_list_iter_cond_x (_xlist_t l, rtx *xp) +{ + if (l) + { + *xp = _XLIST_X (l); + return true; + } + + return false; +} + +#define _xlist_iter_remove(IP) (_list_iter_remove (IP)) + +typedef _list_iterator _xlist_iterator; +#define _FOR_EACH_X(X, I, L) _FOR_EACH (x, (X), (I), (L)) +#define _FOR_EACH_X_1(X, I, LP) _FOR_EACH_1 (x, (X), (I), (LP)) + + +/* ilist_t functions. */ + +static inline void +ilist_add (ilist_t *lp, insn_t insn) +{ + _list_add (lp); + ILIST_INSN (*lp) = insn; +} +#define ilist_remove(LP) (_list_remove (LP)) +#define ilist_clear(LP) (_list_clear (LP)) + +static inline bool +ilist_is_in_p (ilist_t l, insn_t insn) +{ + while (l) + { + if (ILIST_INSN (l) == insn) + return true; + l = ILIST_NEXT (l); + } + + return false; +} + +/* Used through _FOR_EACH. */ +static inline bool +_list_iter_cond_insn (ilist_t l, insn_t *ip) +{ + if (l) + { + *ip = ILIST_INSN (l); + return true; + } + + return false; +} + +#define ilist_iter_remove(IP) (_list_iter_remove (IP)) + +typedef _list_iterator ilist_iterator; +#define FOR_EACH_INSN(INSN, I, L) _FOR_EACH (insn, (INSN), (I), (L)) +#define FOR_EACH_INSN_1(INSN, I, LP) _FOR_EACH_1 (insn, (INSN), (I), (LP)) + + +/* Av set iterators. */ +typedef _list_iterator av_set_iterator; +#define FOR_EACH_EXPR(EXPR, I, AV) _FOR_EACH (expr, (EXPR), (I), (AV)) +#define FOR_EACH_EXPR_1(EXPR, I, AV) _FOR_EACH_1 (expr, (EXPR), (I), (AV)) + +inline bool +_list_iter_cond_expr (av_set_t av, expr_t *exprp) +{ + if (av) + { + *exprp = _AV_SET_EXPR (av); + return true; + } + + return false; +} + + +/* Def list iterators. */ +typedef _list_t def_list_t; +typedef _list_iterator def_list_iterator; + +#define DEF_LIST_NEXT(L) (_LIST_NEXT (L)) +#define DEF_LIST_DEF(L) (&(L)->u.def) + +#define FOR_EACH_DEF(DEF, I, DEF_LIST) _FOR_EACH (def, (DEF), (I), (DEF_LIST)) + +static inline bool +_list_iter_cond_def (def_list_t def_list, def_t *def) +{ + if (def_list) + { + *def = DEF_LIST_DEF (def_list); + return true; + } + + return false; +} + + +/* InstructionData. Contains information about insn pattern. */ +struct idata_def +{ + /* Type of the insn. + o CALL_INSN - Call insn + o JUMP_INSN - Jump insn + o INSN - INSN that cannot be cloned + o USE - INSN that can be cloned + o SET - INSN that can be cloned and separable into lhs and rhs + o PC - simplejump. Insns that simply redirect control flow should not + have any dependencies. Sched-deps.c, though, might consider them as + producers or consumers of certain registers. To avoid that we handle + dependency for simple jumps ourselves. */ + int type; + + /* If insn is a SET, this is its left hand side. */ + rtx lhs; + + /* If insn is a SET, this is its right hand side. */ + rtx rhs; + + /* Registers that are set/used by this insn. This info is now gathered + via sched-deps.c. The downside of this is that we also use live info + from flow that is accumulated in the basic blocks. These two infos + can be slightly inconsistent, hence in the beginning we make a pass + through CFG and calculating the conservative solution for the info in + basic blocks. When this scheduler will be switched to use dataflow, + this can be unified as df gives us both per basic block and per + instruction info. Actually, we don't do that pass and just hope + for the best. */ + regset reg_sets; + + regset reg_clobbers; + + regset reg_uses; +}; + +#define IDATA_TYPE(ID) ((ID)->type) +#define IDATA_LHS(ID) ((ID)->lhs) +#define IDATA_RHS(ID) ((ID)->rhs) +#define IDATA_REG_SETS(ID) ((ID)->reg_sets) +#define IDATA_REG_USES(ID) ((ID)->reg_uses) +#define IDATA_REG_CLOBBERS(ID) ((ID)->reg_clobbers) + +/* Type to represent all needed info to emit an insn. + This is a virtual equivalent of the insn. + Every insn in the stream has an associated vinsn. This is used + to reduce memory consumption basing on the fact that many insns + don't change through the scheduler. + + vinsn can be either normal or unique. + * Normal vinsn is the one, that can be cloned multiple times and typically + corresponds to normal instruction. + + * Unique vinsn derivates from CALL, ASM, JUMP (for a while) and other + unusual stuff. Such a vinsn is described by its INSN field, which is a + reference to the original instruction. */ +struct vinsn_def +{ + /* Associated insn. */ + rtx_insn *insn_rtx; + + /* Its description. */ + struct idata_def id; + + /* Hash of vinsn. It is computed either from pattern or from rhs using + hash_rtx. It is not placed in ID for faster compares. */ + unsigned hash; + + /* Hash of the insn_rtx pattern. */ + unsigned hash_rtx; + + /* Smart pointer counter. */ + int count; + + /* Cached cost of the vinsn. To access it please use vinsn_cost (). */ + int cost; + + /* Mark insns that may trap so we don't move them through jumps. */ + bool may_trap_p; +}; + +#define VINSN_INSN_RTX(VI) ((VI)->insn_rtx) +#define VINSN_PATTERN(VI) (PATTERN (VINSN_INSN_RTX (VI))) + +#define VINSN_ID(VI) (&((VI)->id)) +#define VINSN_HASH(VI) ((VI)->hash) +#define VINSN_HASH_RTX(VI) ((VI)->hash_rtx) +#define VINSN_TYPE(VI) (IDATA_TYPE (VINSN_ID (VI))) +#define VINSN_SEPARABLE_P(VI) (VINSN_TYPE (VI) == SET) +#define VINSN_CLONABLE_P(VI) (VINSN_SEPARABLE_P (VI) || VINSN_TYPE (VI) == USE) +#define VINSN_UNIQUE_P(VI) (!VINSN_CLONABLE_P (VI)) +#define VINSN_LHS(VI) (IDATA_LHS (VINSN_ID (VI))) +#define VINSN_RHS(VI) (IDATA_RHS (VINSN_ID (VI))) +#define VINSN_REG_SETS(VI) (IDATA_REG_SETS (VINSN_ID (VI))) +#define VINSN_REG_USES(VI) (IDATA_REG_USES (VINSN_ID (VI))) +#define VINSN_REG_CLOBBERS(VI) (IDATA_REG_CLOBBERS (VINSN_ID (VI))) +#define VINSN_COUNT(VI) ((VI)->count) +#define VINSN_MAY_TRAP_P(VI) ((VI)->may_trap_p) + + +/* An entry of the hashtable describing transformations happened when + moving up through an insn. */ +struct transformed_insns +{ + /* Previous vinsn. Used to find the proper element. */ + vinsn_t vinsn_old; + + /* A new vinsn. */ + vinsn_t vinsn_new; + + /* Speculative status. */ + ds_t ds; + + /* Type of transformation happened. */ + enum local_trans_type type; + + /* Whether a conflict on the target register happened. */ + BOOL_BITFIELD was_target_conflict : 1; + + /* Whether a check was needed. */ + BOOL_BITFIELD needs_check : 1; +}; + +/* Indexed by INSN_LUID, the collection of all data associated with + a single instruction that is in the stream. */ +struct _sel_insn_data +{ + /* The expression that contains vinsn for this insn and some + flow-sensitive data like priority. */ + expr_def expr; + + /* If (WS_LEVEL == GLOBAL_LEVEL) then AV is empty. */ + int ws_level; + + /* A number that helps in defining a traversing order for a region. */ + int seqno; + + /* A liveness data computed above this insn. */ + regset live; + + /* An INSN_UID bit is set when deps analysis result is already known. */ + bitmap analyzed_deps; + + /* An INSN_UID bit is set when a hard dep was found, not set when + no dependence is found. This is meaningful only when the analyzed_deps + bitmap has its bit set. */ + bitmap found_deps; + + /* An INSN_UID bit is set when this is a bookkeeping insn generated from + a parent with this uid. If a parent is a bookkeeping copy, all its + originators are transitively included in this set. */ + bitmap originators; + + /* A hashtable caching the result of insn transformations through this one. */ + htab_t transformed_insns; + + /* A context incapsulating this insn. */ + struct deps_desc deps_context; + + /* This field is initialized at the beginning of scheduling and is used + to handle sched group instructions. If it is non-null, then it points + to the instruction, which should be forced to schedule next. Such + instructions are unique. */ + insn_t sched_next; + + /* Cycle at which insn was scheduled. It is greater than zero if insn was + scheduled. This is used for bundling. */ + int sched_cycle; + + /* Cycle at which insn's data will be fully ready. */ + int ready_cycle; + + /* Speculations that are being checked by this insn. */ + ds_t spec_checked_ds; + + /* Whether the live set valid or not. */ + BOOL_BITFIELD live_valid_p : 1; + /* Insn is an ASM. */ + BOOL_BITFIELD asm_p : 1; + + /* True when an insn is scheduled after we've determined that a stall is + required. + This is used when emulating the Haifa scheduler for bundling. */ + BOOL_BITFIELD after_stall_p : 1; +}; + +typedef struct _sel_insn_data sel_insn_data_def; +typedef sel_insn_data_def *sel_insn_data_t; + +extern vec s_i_d; + +/* Accessor macros for s_i_d. */ +#define SID(INSN) (&s_i_d[INSN_LUID (INSN)]) +#define SID_BY_UID(UID) (&s_i_d[LUID_BY_UID (UID)]) + +extern sel_insn_data_def insn_sid (insn_t); + +#define INSN_ASM_P(INSN) (SID (INSN)->asm_p) +#define INSN_SCHED_NEXT(INSN) (SID (INSN)->sched_next) +#define INSN_ANALYZED_DEPS(INSN) (SID (INSN)->analyzed_deps) +#define INSN_FOUND_DEPS(INSN) (SID (INSN)->found_deps) +#define INSN_DEPS_CONTEXT(INSN) (SID (INSN)->deps_context) +#define INSN_ORIGINATORS(INSN) (SID (INSN)->originators) +#define INSN_ORIGINATORS_BY_UID(UID) (SID_BY_UID (UID)->originators) +#define INSN_TRANSFORMED_INSNS(INSN) (SID (INSN)->transformed_insns) + +#define INSN_EXPR(INSN) (&SID (INSN)->expr) +#define INSN_LIVE(INSN) (SID (INSN)->live) +#define INSN_LIVE_VALID_P(INSN) (SID (INSN)->live_valid_p) +#define INSN_VINSN(INSN) (EXPR_VINSN (INSN_EXPR (INSN))) +#define INSN_TYPE(INSN) (VINSN_TYPE (INSN_VINSN (INSN))) +#define INSN_SIMPLEJUMP_P(INSN) (INSN_TYPE (INSN) == PC) +#define INSN_LHS(INSN) (VINSN_LHS (INSN_VINSN (INSN))) +#define INSN_RHS(INSN) (VINSN_RHS (INSN_VINSN (INSN))) +#define INSN_REG_SETS(INSN) (VINSN_REG_SETS (INSN_VINSN (INSN))) +#define INSN_REG_CLOBBERS(INSN) (VINSN_REG_CLOBBERS (INSN_VINSN (INSN))) +#define INSN_REG_USES(INSN) (VINSN_REG_USES (INSN_VINSN (INSN))) +#define INSN_SCHED_TIMES(INSN) (EXPR_SCHED_TIMES (INSN_EXPR (INSN))) +#define INSN_SEQNO(INSN) (SID (INSN)->seqno) +#define INSN_AFTER_STALL_P(INSN) (SID (INSN)->after_stall_p) +#define INSN_SCHED_CYCLE(INSN) (SID (INSN)->sched_cycle) +#define INSN_READY_CYCLE(INSN) (SID (INSN)->ready_cycle) +#define INSN_SPEC_CHECKED_DS(INSN) (SID (INSN)->spec_checked_ds) + +/* A global level shows whether an insn is valid or not. */ +extern int global_level; + +#define INSN_WS_LEVEL(INSN) (SID (INSN)->ws_level) + +extern av_set_t get_av_set (insn_t); +extern int get_av_level (insn_t); + +#define AV_SET(INSN) (get_av_set (INSN)) +#define AV_LEVEL(INSN) (get_av_level (INSN)) +#define AV_SET_VALID_P(INSN) (AV_LEVEL (INSN) == global_level) + +/* A list of fences currently in the works. */ +extern flist_t fences; + +/* A NOP pattern used as a placeholder for real insns. */ +extern rtx nop_pattern; + +/* An insn that 'contained' in EXIT block. */ +extern rtx_insn *exit_insn; + +/* Provide a separate luid for the insn. */ +#define INSN_INIT_TODO_LUID (1) + +/* Initialize s_s_i_d. */ +#define INSN_INIT_TODO_SSID (2) + +/* Initialize data for simplejump. */ +#define INSN_INIT_TODO_SIMPLEJUMP (4) + +/* Return true if INSN is a local NOP. The nop is local in the sense that + it was emitted by the scheduler as a temporary insn and will soon be + deleted. These nops are identified by their pattern. */ +#define INSN_NOP_P(INSN) (PATTERN (INSN) == nop_pattern) + +/* Return true if INSN is linked into instruction stream. + NB: It is impossible for INSN to have one field null and the other not + null: gcc_assert ((PREV_INSN (INSN) == NULL_RTX) + == (NEXT_INSN (INSN) == NULL_RTX)) is valid. */ +#define INSN_IN_STREAM_P(INSN) (PREV_INSN (INSN) && NEXT_INSN (INSN)) + +/* Return true if INSN is in current fence. */ +#define IN_CURRENT_FENCE_P(INSN) (flist_lookup (fences, INSN) != NULL) + +/* Marks loop as being considered for pipelining. */ +#define MARK_LOOP_FOR_PIPELINING(LOOP) ((LOOP)->aux = (void *)(size_t)(1)) +#define LOOP_MARKED_FOR_PIPELINING_P(LOOP) ((size_t)((LOOP)->aux)) + +/* Saved loop preheader to transfer when scheduling the loop. */ +#define LOOP_PREHEADER_BLOCKS(LOOP) ((size_t)((LOOP)->aux) == 1 \ + ? NULL \ + : ((vec *) (LOOP)->aux)) +#define SET_LOOP_PREHEADER_BLOCKS(LOOP,BLOCKS) ((LOOP)->aux \ + = (BLOCKS != NULL \ + ? BLOCKS \ + : (LOOP)->aux)) + +extern bitmap blocks_to_reschedule; + + +/* A variable to track which part of rtx we are scanning in + sched-deps.c: sched_analyze_insn (). */ +enum deps_where_t +{ + DEPS_IN_INSN, + DEPS_IN_LHS, + DEPS_IN_RHS, + DEPS_IN_NOWHERE +}; + + +/* Per basic block data for the whole CFG. */ +struct sel_global_bb_info_def +{ + /* For each bb header this field contains a set of live registers. + For all other insns this field has a NULL. + We also need to know LV sets for the instructions, that are immediately + after the border of the region. */ + regset lv_set; + + /* Status of LV_SET. + true - block has usable LV_SET. + false - block's LV_SET should be recomputed. */ + bool lv_set_valid_p; +}; + +typedef sel_global_bb_info_def *sel_global_bb_info_t; + + +/* Per basic block data. This array is indexed by basic block index. */ +extern vec sel_global_bb_info; + +extern void sel_extend_global_bb_info (void); +extern void sel_finish_global_bb_info (void); + +/* Get data for BB. */ +#define SEL_GLOBAL_BB_INFO(BB) \ + (&sel_global_bb_info[(BB)->index]) + +/* Access macros. */ +#define BB_LV_SET(BB) (SEL_GLOBAL_BB_INFO (BB)->lv_set) +#define BB_LV_SET_VALID_P(BB) (SEL_GLOBAL_BB_INFO (BB)->lv_set_valid_p) + +/* Per basic block data for the region. */ +struct sel_region_bb_info_def +{ + /* This insn stream is constructed in such a way that it should be + traversed by PREV_INSN field - (*not* NEXT_INSN). */ + rtx_insn *note_list; + + /* Cached availability set at the beginning of a block. + See also AV_LEVEL () for conditions when this av_set can be used. */ + av_set_t av_set; + + /* If (AV_LEVEL == GLOBAL_LEVEL) then AV is valid. */ + int av_level; +}; + +typedef sel_region_bb_info_def *sel_region_bb_info_t; + + +/* Per basic block data. This array is indexed by basic block index. */ +extern vec sel_region_bb_info; + +/* Get data for BB. */ +#define SEL_REGION_BB_INFO(BB) (&sel_region_bb_info[(BB)->index]) + +/* Get BB's note_list. + A note_list is a list of various notes that was scattered across BB + before scheduling, and will be appended at the beginning of BB after + scheduling is finished. */ +#define BB_NOTE_LIST(BB) (SEL_REGION_BB_INFO (BB)->note_list) + +#define BB_AV_SET(BB) (SEL_REGION_BB_INFO (BB)->av_set) +#define BB_AV_LEVEL(BB) (SEL_REGION_BB_INFO (BB)->av_level) +#define BB_AV_SET_VALID_P(BB) (BB_AV_LEVEL (BB) == global_level) + +/* Used in bb_in_ebb_p. */ +extern bitmap_head *forced_ebb_heads; + +/* The loop nest being pipelined. */ +extern struct loop *current_loop_nest; + +/* Saves pipelined blocks. Bitmap is indexed by bb->index. */ +extern sbitmap bbs_pipelined; + +/* Various flags. */ +extern bool enable_moveup_set_path_p; +extern bool pipelining_p; +extern bool bookkeeping_p; +extern int max_insns_to_rename; +extern bool preheader_removed; + +/* Software lookahead window size. + According to the results in Nakatani and Ebcioglu [1993], window size of 16 + is enough to extract most ILP in integer code. */ +#define MAX_WS (PARAM_VALUE (PARAM_SELSCHED_MAX_LOOKAHEAD)) + +extern regset sel_all_regs; + + +/* Successor iterator backend. */ +struct succ_iterator +{ + /* True if we're at BB end. */ + bool bb_end; + + /* An edge on which we're iterating. */ + edge e1; + + /* The previous edge saved after skipping empty blocks. */ + edge e2; + + /* Edge iterator used when there are successors in other basic blocks. */ + edge_iterator ei; + + /* Successor block we're traversing. */ + basic_block bb; + + /* Flags that are passed to the iterator. We return only successors + that comply to these flags. */ + short flags; + + /* When flags include SUCCS_ALL, this will be set to the exact type + of the successor we're traversing now. */ + short current_flags; + + /* If skip to loop exits, save here information about loop exits. */ + int current_exit; + vec loop_exits; +}; + +/* A structure returning all successor's information. */ +struct succs_info +{ + /* Flags that these succcessors were computed with. */ + short flags; + + /* Successors that correspond to the flags. */ + insn_vec_t succs_ok; + + /* Their probabilities. As of now, we don't need this for other + successors. */ + vec probs_ok; + + /* Other successors. */ + insn_vec_t succs_other; + + /* Probability of all successors. */ + int all_prob; + + /* The number of all successors. */ + int all_succs_n; + + /* The number of good successors. */ + int succs_ok_n; +}; + +/* Some needed definitions. */ +extern basic_block after_recovery; + +extern rtx_insn *sel_bb_head (basic_block); +extern rtx_insn *sel_bb_end (basic_block); +extern bool sel_bb_empty_p (basic_block); +extern bool in_current_region_p (basic_block); + +/* True when BB is a header of the inner loop. */ +static inline bool +inner_loop_header_p (basic_block bb) +{ + struct loop *inner_loop; + + if (!current_loop_nest) + return false; + + if (bb == EXIT_BLOCK_PTR_FOR_FN (cfun)) + return false; + + inner_loop = bb->loop_father; + if (inner_loop == current_loop_nest) + return false; + + /* If successor belongs to another loop. */ + if (bb == inner_loop->header + && flow_bb_inside_loop_p (current_loop_nest, bb)) + { + /* Could be '=' here because of wrong loop depths. */ + gcc_assert (loop_depth (inner_loop) >= loop_depth (current_loop_nest)); + return true; + } + + return false; +} + +/* Return exit edges of LOOP, filtering out edges with the same dest bb. */ +static inline vec +get_loop_exit_edges_unique_dests (const struct loop *loop) +{ + vec edges = vNULL; + struct loop_exit *exit; + + gcc_assert (loop->latch != EXIT_BLOCK_PTR_FOR_FN (cfun) + && current_loops->state & LOOPS_HAVE_RECORDED_EXITS); + + for (exit = loop->exits->next; exit->e; exit = exit->next) + { + int i; + edge e; + bool was_dest = false; + + for (i = 0; edges.iterate (i, &e); i++) + if (e->dest == exit->e->dest) + { + was_dest = true; + break; + } + + if (!was_dest) + edges.safe_push (exit->e); + } + return edges; +} + +static bool +sel_bb_empty_or_nop_p (basic_block bb) +{ + insn_t first = sel_bb_head (bb), last; + + if (first == NULL_RTX) + return true; + + if (!INSN_NOP_P (first)) + return false; + + if (bb == EXIT_BLOCK_PTR_FOR_FN (cfun)) + return false; + + last = sel_bb_end (bb); + if (first != last) + return false; + + return true; +} + +/* Collect all loop exits recursively, skipping empty BBs between them. + E.g. if BB is a loop header which has several loop exits, + traverse all of them and if any of them turns out to be another loop header + (after skipping empty BBs), add its loop exits to the resulting vector + as well. */ +static inline vec +get_all_loop_exits (basic_block bb) +{ + vec exits = vNULL; + + /* If bb is empty, and we're skipping to loop exits, then + consider bb as a possible gate to the inner loop now. */ + while (sel_bb_empty_or_nop_p (bb) + && in_current_region_p (bb) + && EDGE_COUNT (bb->succs) > 0) + { + bb = single_succ (bb); + + /* This empty block could only lead outside the region. */ + gcc_assert (! in_current_region_p (bb)); + } + + /* And now check whether we should skip over inner loop. */ + if (inner_loop_header_p (bb)) + { + struct loop *this_loop; + struct loop *pred_loop = NULL; + int i; + edge e; + + for (this_loop = bb->loop_father; + this_loop && this_loop != current_loop_nest; + this_loop = loop_outer (this_loop)) + pred_loop = this_loop; + + this_loop = pred_loop; + gcc_assert (this_loop != NULL); + + exits = get_loop_exit_edges_unique_dests (this_loop); + + /* Traverse all loop headers. */ + for (i = 0; exits.iterate (i, &e); i++) + if (in_current_region_p (e->dest) + || inner_loop_header_p (e->dest)) + { + vec next_exits = get_all_loop_exits (e->dest); + + if (next_exits.exists ()) + { + int j; + edge ne; + + /* Add all loop exits for the current edge into the + resulting vector. */ + for (j = 0; next_exits.iterate (j, &ne); j++) + exits.safe_push (ne); + + /* Remove the original edge. */ + exits.ordered_remove (i); + + /* Decrease the loop counter so we won't skip anything. */ + i--; + continue; + } + } + } + + return exits; +} + +/* Flags to pass to compute_succs_info and FOR_EACH_SUCC. + Any successor will fall into exactly one category. */ + +/* Include normal successors. */ +#define SUCCS_NORMAL (1) + +/* Include back-edge successors. */ +#define SUCCS_BACK (2) + +/* Include successors that are outside of the current region. */ +#define SUCCS_OUT (4) + +/* When pipelining of the outer loops is enabled, skip innermost loops + to their exits. */ +#define SUCCS_SKIP_TO_LOOP_EXITS (8) + +/* Include all successors. */ +#define SUCCS_ALL (SUCCS_NORMAL | SUCCS_BACK | SUCCS_OUT) + +/* We need to return a succ_iterator to avoid 'unitialized' warning + during bootstrap. */ +static inline succ_iterator +_succ_iter_start (insn_t *succp, insn_t insn, int flags) +{ + succ_iterator i; + + basic_block bb = BLOCK_FOR_INSN (insn); + + gcc_assert (INSN_P (insn) || NOTE_INSN_BASIC_BLOCK_P (insn)); + + i.flags = flags; + + /* Avoid 'uninitialized' warning. */ + *succp = NULL; + i.e1 = NULL; + i.e2 = NULL; + i.bb = bb; + i.current_flags = 0; + i.current_exit = -1; + i.loop_exits.create (0); + + if (bb != EXIT_BLOCK_PTR_FOR_FN (cfun) && BB_END (bb) != insn) + { + i.bb_end = false; + + /* Avoid 'uninitialized' warning. */ + i.ei.index = 0; + i.ei.container = 0; + } + else + { + i.ei = ei_start (bb->succs); + i.bb_end = true; + } + + return i; +} + +static inline bool +_succ_iter_cond (succ_iterator *ip, insn_t *succp, insn_t insn, + bool check (edge, succ_iterator *)) +{ + if (!ip->bb_end) + { + /* When we're in a middle of a basic block, return + the next insn immediately, but only when SUCCS_NORMAL is set. */ + if (*succp != NULL || (ip->flags & SUCCS_NORMAL) == 0) + return false; + + *succp = NEXT_INSN (insn); + ip->current_flags = SUCCS_NORMAL; + return true; + } + else + { + while (1) + { + edge e_tmp = NULL; + + /* First, try loop exits, if we have them. */ + if (ip->loop_exits.exists ()) + { + do + { + ip->loop_exits.iterate (ip->current_exit, &e_tmp); + ip->current_exit++; + } + while (e_tmp && !check (e_tmp, ip)); + + if (!e_tmp) + ip->loop_exits.release (); + } + + /* If we have found a successor, then great. */ + if (e_tmp) + { + ip->e1 = e_tmp; + break; + } + + /* If not, then try the next edge. */ + while (ei_cond (ip->ei, &(ip->e1))) + { + basic_block bb = ip->e1->dest; + + /* Consider bb as a possible loop header. */ + if ((ip->flags & SUCCS_SKIP_TO_LOOP_EXITS) + && flag_sel_sched_pipelining_outer_loops + && (!in_current_region_p (bb) + || BLOCK_TO_BB (ip->bb->index) + < BLOCK_TO_BB (bb->index))) + { + /* Get all loop exits recursively. */ + ip->loop_exits = get_all_loop_exits (bb); + + if (ip->loop_exits.exists ()) + { + ip->current_exit = 0; + /* Move the iterator now, because we won't do + succ_iter_next until loop exits will end. */ + ei_next (&(ip->ei)); + break; + } + } + + /* bb is not a loop header, check as usual. */ + if (check (ip->e1, ip)) + break; + + ei_next (&(ip->ei)); + } + + /* If loop_exits are non null, we have found an inner loop; + do one more iteration to fetch an edge from these exits. */ + if (ip->loop_exits.exists ()) + continue; + + /* Otherwise, we've found an edge in a usual way. Break now. */ + break; + } + + if (ip->e1) + { + basic_block bb = ip->e2->dest; + + if (bb == EXIT_BLOCK_PTR_FOR_FN (cfun) || bb == after_recovery) + *succp = exit_insn; + else + { + *succp = sel_bb_head (bb); + + gcc_assert (ip->flags != SUCCS_NORMAL + || *succp == NEXT_INSN (bb_note (bb))); + gcc_assert (BLOCK_FOR_INSN (*succp) == bb); + } + + return true; + } + else + return false; + } +} + +static inline void +_succ_iter_next (succ_iterator *ip) +{ + gcc_assert (!ip->e2 || ip->e1); + + if (ip->bb_end && ip->e1 && !ip->loop_exits.exists ()) + ei_next (&(ip->ei)); +} + +/* Returns true when E1 is an eligible successor edge, possibly skipping + empty blocks. When E2P is not null, the resulting edge is written there. + FLAGS are used to specify whether back edges and out-of-region edges + should be considered. */ +static inline bool +_eligible_successor_edge_p (edge e1, succ_iterator *ip) +{ + edge e2 = e1; + basic_block bb; + int flags = ip->flags; + bool src_outside_rgn = !in_current_region_p (e1->src); + + gcc_assert (flags != 0); + + if (src_outside_rgn) + { + /* Any successor of the block that is outside current region is + ineligible, except when we're skipping to loop exits. */ + gcc_assert (flags & (SUCCS_OUT | SUCCS_SKIP_TO_LOOP_EXITS)); + + if (flags & SUCCS_OUT) + return false; + } + + bb = e2->dest; + + /* Skip empty blocks, but be careful not to leave the region. */ + while (1) + { + if (!sel_bb_empty_p (bb)) + { + edge ne; + basic_block nbb; + + if (!sel_bb_empty_or_nop_p (bb)) + break; + + ne = EDGE_SUCC (bb, 0); + nbb = ne->dest; + + if (!in_current_region_p (nbb) + && !(flags & SUCCS_OUT)) + break; + + e2 = ne; + bb = nbb; + continue; + } + + if (!in_current_region_p (bb) + && !(flags & SUCCS_OUT)) + return false; + + if (EDGE_COUNT (bb->succs) == 0) + return false; + + e2 = EDGE_SUCC (bb, 0); + bb = e2->dest; + } + + /* Save the second edge for later checks. */ + ip->e2 = e2; + + if (in_current_region_p (bb)) + { + /* BLOCK_TO_BB sets topological order of the region here. + It is important to use real predecessor here, which is ip->bb, + as we may well have e1->src outside current region, + when skipping to loop exits. */ + bool succeeds_in_top_order = (BLOCK_TO_BB (ip->bb->index) + < BLOCK_TO_BB (bb->index)); + + /* This is true for the all cases except the last one. */ + ip->current_flags = SUCCS_NORMAL; + + /* We are advancing forward in the region, as usual. */ + if (succeeds_in_top_order) + { + /* We are skipping to loop exits here. */ + gcc_assert (!src_outside_rgn + || flag_sel_sched_pipelining_outer_loops); + return !!(flags & SUCCS_NORMAL); + } + + /* This is a back edge. During pipelining we ignore back edges, + but only when it leads to the same loop. It can lead to the header + of the outer loop, which will also be the preheader of + the current loop. */ + if (pipelining_p + && e1->src->loop_father == bb->loop_father) + return !!(flags & SUCCS_NORMAL); + + /* A back edge should be requested explicitly. */ + ip->current_flags = SUCCS_BACK; + return !!(flags & SUCCS_BACK); + } + + ip->current_flags = SUCCS_OUT; + return !!(flags & SUCCS_OUT); +} + +#define FOR_EACH_SUCC_1(SUCC, ITER, INSN, FLAGS) \ + for ((ITER) = _succ_iter_start (&(SUCC), (INSN), (FLAGS)); \ + _succ_iter_cond (&(ITER), &(SUCC), (INSN), _eligible_successor_edge_p); \ + _succ_iter_next (&(ITER))) + +#define FOR_EACH_SUCC(SUCC, ITER, INSN) \ + FOR_EACH_SUCC_1 (SUCC, ITER, INSN, SUCCS_NORMAL) + +/* Return the current edge along which a successor was built. */ +#define SUCC_ITER_EDGE(ITER) ((ITER)->e1) + +/* Return the next block of BB not running into inconsistencies. */ +static inline basic_block +bb_next_bb (basic_block bb) +{ + switch (EDGE_COUNT (bb->succs)) + { + case 0: + return bb->next_bb; + + case 1: + return single_succ (bb); + + case 2: + return FALLTHRU_EDGE (bb)->dest; + + default: + return bb->next_bb; + } + + gcc_unreachable (); +} + + + +/* Functions that are used in sel-sched.c. */ + +/* List functions. */ +extern ilist_t ilist_copy (ilist_t); +extern ilist_t ilist_invert (ilist_t); +extern void blist_add (blist_t *, insn_t, ilist_t, deps_t); +extern void blist_remove (blist_t *); +extern void flist_tail_init (flist_tail_t); + +extern fence_t flist_lookup (flist_t, insn_t); +extern void flist_clear (flist_t *); +extern void def_list_add (def_list_t *, insn_t, bool); + +/* Target context functions. */ +extern tc_t create_target_context (bool); +extern void set_target_context (tc_t); +extern void reset_target_context (tc_t, bool); + +/* Deps context functions. */ +extern void advance_deps_context (deps_t, insn_t); + +/* Fences functions. */ +extern void init_fences (insn_t); +extern void add_clean_fence_to_fences (flist_tail_t, insn_t, fence_t); +extern void add_dirty_fence_to_fences (flist_tail_t, insn_t, fence_t); +extern void move_fence_to_fences (flist_t, flist_tail_t); + +/* Pool functions. */ +extern regset get_regset_from_pool (void); +extern regset get_clear_regset_from_pool (void); +extern void return_regset_to_pool (regset); +extern void free_regset_pool (void); + +extern insn_t get_nop_from_pool (insn_t); +extern void return_nop_to_pool (insn_t, bool); +extern void free_nop_pool (void); + +/* Vinsns functions. */ +extern bool vinsn_separable_p (vinsn_t); +extern bool vinsn_cond_branch_p (vinsn_t); +extern void recompute_vinsn_lhs_rhs (vinsn_t); +extern int sel_vinsn_cost (vinsn_t); +extern insn_t sel_gen_insn_from_rtx_after (rtx, expr_t, int, insn_t); +extern insn_t sel_gen_recovery_insn_from_rtx_after (rtx, expr_t, int, insn_t); +extern insn_t sel_gen_insn_from_expr_after (expr_t, vinsn_t, int, insn_t); +extern insn_t sel_move_insn (expr_t, int, insn_t); +extern void vinsn_attach (vinsn_t); +extern void vinsn_detach (vinsn_t); +extern vinsn_t vinsn_copy (vinsn_t, bool); +extern bool vinsn_equal_p (vinsn_t, vinsn_t); + +/* EXPR functions. */ +extern void copy_expr (expr_t, expr_t); +extern void copy_expr_onside (expr_t, expr_t); +extern void merge_expr_data (expr_t, expr_t, insn_t); +extern void merge_expr (expr_t, expr_t, insn_t); +extern void clear_expr (expr_t); +extern unsigned expr_dest_regno (expr_t); +extern rtx expr_dest_reg (expr_t); +extern int find_in_history_vect (vec , + rtx, vinsn_t, bool); +extern void insert_in_history_vect (vec *, + unsigned, enum local_trans_type, + vinsn_t, vinsn_t, ds_t); +extern void mark_unavailable_targets (av_set_t, av_set_t, regset); +extern int speculate_expr (expr_t, ds_t); + +/* Av set functions. */ +extern void av_set_add (av_set_t *, expr_t); +extern void av_set_iter_remove (av_set_iterator *); +extern expr_t av_set_lookup (av_set_t, vinsn_t); +extern expr_t merge_with_other_exprs (av_set_t *, av_set_iterator *, expr_t); +extern bool av_set_is_in_p (av_set_t, vinsn_t); +extern av_set_t av_set_copy (av_set_t); +extern void av_set_union_and_clear (av_set_t *, av_set_t *, insn_t); +extern void av_set_union_and_live (av_set_t *, av_set_t *, regset, regset, insn_t); +extern void av_set_clear (av_set_t *); +extern void av_set_leave_one_nonspec (av_set_t *); +extern expr_t av_set_element (av_set_t, int); +extern void av_set_substract_cond_branches (av_set_t *); +extern void av_set_split_usefulness (av_set_t, int, int); +extern void av_set_code_motion_filter (av_set_t *, av_set_t); + +extern void sel_save_haifa_priorities (void); + +extern void sel_init_global_and_expr (bb_vec_t); +extern void sel_finish_global_and_expr (void); + +extern regset compute_live (insn_t); +extern bool register_unavailable_p (regset, rtx); + +/* Dependence analysis functions. */ +extern void sel_clear_has_dependence (void); +extern ds_t has_dependence_p (expr_t, insn_t, ds_t **); + +extern int tick_check_p (expr_t, deps_t, fence_t); + +/* Functions to work with insns. */ +extern bool lhs_of_insn_equals_to_dest_p (insn_t, rtx); +extern bool insn_eligible_for_subst_p (insn_t); +extern void get_dest_and_mode (rtx, rtx *, machine_mode *); + +extern bool bookkeeping_can_be_created_if_moved_through_p (insn_t); +extern bool sel_remove_insn (insn_t, bool, bool); +extern bool bb_header_p (insn_t); +extern void sel_init_invalid_data_sets (insn_t); +extern bool insn_at_boundary_p (insn_t); + +/* Basic block and CFG functions. */ + +extern rtx_insn *sel_bb_head (basic_block); +extern bool sel_bb_head_p (insn_t); +extern rtx_insn *sel_bb_end (basic_block); +extern bool sel_bb_end_p (insn_t); +extern bool sel_bb_empty_p (basic_block); + +extern bool in_current_region_p (basic_block); +extern basic_block fallthru_bb_of_jump (const rtx_insn *); + +extern void sel_init_bbs (bb_vec_t); +extern void sel_finish_bbs (void); + +extern struct succs_info * compute_succs_info (insn_t, short); +extern void free_succs_info (struct succs_info *); +extern bool sel_insn_has_single_succ_p (insn_t, int); +extern bool sel_num_cfg_preds_gt_1 (insn_t); +extern int get_seqno_by_preds (rtx_insn *); + +extern bool bb_ends_ebb_p (basic_block); +extern bool in_same_ebb_p (insn_t, insn_t); + +extern bool tidy_control_flow (basic_block, bool); +extern void free_bb_note_pool (void); + +extern void purge_empty_blocks (void); +extern basic_block sel_split_edge (edge); +extern basic_block sel_create_recovery_block (insn_t); +extern bool sel_redirect_edge_and_branch (edge, basic_block); +extern void sel_redirect_edge_and_branch_force (edge, basic_block); +extern void sel_init_pipelining (void); +extern void sel_finish_pipelining (void); +extern void sel_sched_region (int); +extern loop_p get_loop_nest_for_rgn (unsigned int); +extern bool considered_for_pipelining_p (struct loop *); +extern void make_region_from_loop_preheader (vec *&); +extern void sel_add_loop_preheaders (bb_vec_t *); +extern bool sel_is_loop_preheader_p (basic_block); +extern void clear_outdated_rtx_info (basic_block); +extern void free_data_sets (basic_block); +extern void exchange_data_sets (basic_block, basic_block); +extern void copy_data_sets (basic_block, basic_block); + +extern void sel_register_cfg_hooks (void); +extern void sel_unregister_cfg_hooks (void); + +/* Expression transformation routines. */ +extern rtx_insn *create_insn_rtx_from_pattern (rtx, rtx); +extern vinsn_t create_vinsn_from_insn_rtx (rtx_insn *, bool); +extern rtx_insn *create_copy_of_insn_rtx (rtx); +extern void change_vinsn_in_expr (expr_t, vinsn_t); + +/* Various initialization functions. */ +extern void init_lv_sets (void); +extern void free_lv_sets (void); +extern void setup_nop_and_exit_insns (void); +extern void free_nop_and_exit_insns (void); +extern void free_data_for_scheduled_insn (insn_t); +extern void setup_nop_vinsn (void); +extern void free_nop_vinsn (void); +extern void sel_set_sched_flags (void); +extern void sel_setup_sched_infos (void); +extern void alloc_sched_pools (void); +extern void free_sched_pools (void); + +#endif /* GCC_SEL_SCHED_IR_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sel-sched.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sel-sched.h new file mode 100644 index 0000000..c34f3bd --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sel-sched.h @@ -0,0 +1,27 @@ +/* Instruction scheduling pass. + Copyright (C) 2006-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_SEL_SCHED_H +#define GCC_SEL_SCHED_H + +/* The main entry point. */ +extern void run_selective_scheduling (void); +extern bool maybe_skip_selective_scheduling (void); + +#endif /* GCC_SEL_SCHED_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/selftest-rtl.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/selftest-rtl.h new file mode 100644 index 0000000..2218f9c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/selftest-rtl.h @@ -0,0 +1,91 @@ +/* A self-testing framework, for use by -fself-test. + Copyright (C) 2016-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_SELFTEST_RTL_H +#define GCC_SELFTEST_RTL_H + +/* The selftest code should entirely disappear in a production + configuration, hence we guard all of it with #if CHECKING_P. */ + +#if CHECKING_P + +class rtx_reuse_manager; + +namespace selftest { + +/* Verify that X is dumped as EXPECTED_DUMP, using compact mode. + Use LOC as the effective location when reporting errors. */ + +extern void +assert_rtl_dump_eq (const location &loc, const char *expected_dump, rtx x, + rtx_reuse_manager *reuse_manager); + +/* Verify that RTX is dumped as EXPECTED_DUMP, using compact mode. */ + +#define ASSERT_RTL_DUMP_EQ(EXPECTED_DUMP, RTX) \ + assert_rtl_dump_eq (SELFTEST_LOCATION, (EXPECTED_DUMP), (RTX), NULL) + +/* As above, but using REUSE_MANAGER when dumping. */ + +#define ASSERT_RTL_DUMP_EQ_WITH_REUSE(EXPECTED_DUMP, RTX, REUSE_MANAGER) \ + assert_rtl_dump_eq (SELFTEST_LOCATION, (EXPECTED_DUMP), (RTX), \ + (REUSE_MANAGER)) + +/* Evaluate rtx EXPECTED and ACTUAL and compare them with == + (i.e. pointer equality), calling ::selftest::pass if they are + equal, aborting if they are non-equal. */ + +#define ASSERT_RTX_PTR_EQ(EXPECTED, ACTUAL) \ + SELFTEST_BEGIN_STMT \ + const char *desc = "ASSERT_RTX_PTR_EQ (" #EXPECTED ", " #ACTUAL ")"; \ + ::selftest::assert_rtx_ptr_eq_at (SELFTEST_LOCATION, desc, (EXPECTED), \ + (ACTUAL)); \ + SELFTEST_END_STMT + +/* Compare rtx EXPECTED and ACTUAL by pointer equality, calling + ::selftest::pass if they are equal, aborting if they are non-equal. + LOC is the effective location of the assertion, MSG describes it. */ + +extern void assert_rtx_ptr_eq_at (const location &loc, const char *msg, + rtx expected, rtx actual); + +/* A class for testing RTL function dumps. */ + +class rtl_dump_test +{ + public: + /* Takes ownership of PATH. */ + rtl_dump_test (const location &loc, char *path); + ~rtl_dump_test (); + + private: + char *m_path; +}; + +/* Get the insn with the given uid, or NULL if not found. */ + +extern rtx_insn *get_insn_by_uid (int uid); + +extern void verify_three_block_rtl_cfg (function *fun); + +} /* end of namespace selftest. */ + +#endif /* #if CHECKING_P */ + +#endif /* GCC_SELFTEST_RTL_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/selftest.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/selftest.h new file mode 100644 index 0000000..dad53e9 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/selftest.h @@ -0,0 +1,326 @@ +/* A self-testing framework, for use by -fself-test. + Copyright (C) 2015-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_SELFTEST_H +#define GCC_SELFTEST_H + +/* The selftest code should entirely disappear in a production + configuration, hence we guard all of it with #if CHECKING_P. */ + +#if CHECKING_P + +namespace selftest { + +/* A struct describing the source-location of a selftest, to make it + easier to track down failing tests. */ + +struct location +{ + location (const char *file, int line, const char *function) + : m_file (file), m_line (line), m_function (function) {} + + const char *m_file; + int m_line; + const char *m_function; +}; + +/* A macro for use in selftests and by the ASSERT_ macros below, + constructing a selftest::location for the current source location. */ + +#define SELFTEST_LOCATION \ + (::selftest::location (__FILE__, __LINE__, __FUNCTION__)) + +/* The entrypoint for running all tests. */ + +extern void run_tests (); + +/* Record the successful outcome of some aspect of the test. */ + +extern void pass (const location &loc, const char *msg); + +/* Report the failed outcome of some aspect of the test and abort. */ + +extern void fail (const location &loc, const char *msg) + ATTRIBUTE_NORETURN; + +/* As "fail", but using printf-style formatted output. */ + +extern void fail_formatted (const location &loc, const char *fmt, ...) + ATTRIBUTE_PRINTF_2 ATTRIBUTE_NORETURN; + +/* Implementation detail of ASSERT_STREQ. */ + +extern void assert_streq (const location &loc, + const char *desc_expected, const char *desc_actual, + const char *val_expected, const char *val_actual); + +/* Implementation detail of ASSERT_STR_CONTAINS. */ + +extern void assert_str_contains (const location &loc, + const char *desc_haystack, + const char *desc_needle, + const char *val_haystack, + const char *val_needle); + +/* A named temporary file for use in selftests. + Usable for writing out files, and as the base class for + temp_source_file. + The file is unlinked in the destructor. */ + +class named_temp_file +{ + public: + named_temp_file (const char *suffix); + ~named_temp_file (); + const char *get_filename () const { return m_filename; } + + private: + char *m_filename; +}; + +/* A class for writing out a temporary sourcefile for use in selftests + of input handling. */ + +class temp_source_file : public named_temp_file +{ + public: + temp_source_file (const location &loc, const char *suffix, + const char *content); +}; + +/* Various selftests involving location-handling require constructing a + line table and one or more line maps within it. + + For maximum test coverage we want to run these tests with a variety + of situations: + - line_table->default_range_bits: some frontends use a non-zero value + and others use zero + - the fallback modes within line-map.c: there are various threshold + values for source_location/location_t beyond line-map.c changes + behavior (disabling of the range-packing optimization, disabling + of column-tracking). We can exercise these by starting the line_table + at interesting values at or near these thresholds. + + The following struct describes a particular case within our test + matrix. */ + +struct line_table_case; + +/* A class for overriding the global "line_table" within a selftest, + restoring its value afterwards. At most one instance of this + class can exist at once, due to the need to keep the old value + of line_table as a GC root. */ + +class line_table_test +{ + public: + /* Default constructor. Override "line_table", using sane defaults + for the temporary line_table. */ + line_table_test (); + + /* Constructor. Override "line_table", using the case described by C. */ + line_table_test (const line_table_case &c); + + /* Destructor. Restore the saved line_table. */ + ~line_table_test (); +}; + +/* Run TESTCASE multiple times, once for each case in our test matrix. */ + +extern void +for_each_line_table_case (void (*testcase) (const line_table_case &)); + +/* Read the contents of PATH into memory, returning a 0-terminated buffer + that must be freed by the caller. + Fail (and abort) if there are any problems, with LOC as the reported + location of the failure. */ + +extern char *read_file (const location &loc, const char *path); + +/* A helper function for writing tests that interact with the + garbage collector. */ + +extern void forcibly_ggc_collect (); + +/* Convert a path relative to SRCDIR/gcc/testsuite/selftests + to a real path (either absolute, or relative to pwd). + The result should be freed by the caller. */ + +extern char *locate_file (const char *path); + +/* The path of SRCDIR/testsuite/selftests. */ + +extern const char *path_to_selftest_files; + +/* Declarations for specific families of tests (by source file), in + alphabetical order. */ +extern void bitmap_c_tests (); +extern void diagnostic_c_tests (); +extern void diagnostic_show_locus_c_tests (); +extern void edit_context_c_tests (); +extern void et_forest_c_tests (); +extern void fold_const_c_tests (); +extern void fibonacci_heap_c_tests (); +extern void function_tests_c_tests (); +extern void gimple_c_tests (); +extern void ggc_tests_c_tests (); +extern void hash_map_tests_c_tests (); +extern void hash_set_tests_c_tests (); +extern void input_c_tests (); +extern void pretty_print_c_tests (); +extern void read_rtl_function_c_tests (); +extern void rtl_tests_c_tests (); +extern void selftest_c_tests (); +extern void spellcheck_c_tests (); +extern void spellcheck_tree_c_tests (); +extern void sreal_c_tests (); +extern void store_merging_c_tests (); +extern void typed_splay_tree_c_tests (); +extern void tree_c_tests (); +extern void tree_cfg_c_tests (); +extern void vec_c_tests (); +extern void wide_int_cc_tests (); + +extern int num_passes; + +} /* end of namespace selftest. */ + +/* Macros for writing tests. */ + +/* Evaluate EXPR and coerce to bool, calling + ::selftest::pass if it is true, + ::selftest::fail if it false. */ + +#define ASSERT_TRUE(EXPR) \ + ASSERT_TRUE_AT (SELFTEST_LOCATION, (EXPR)) + +/* Like ASSERT_TRUE, but treat LOC as the effective location of the + selftest. */ + +#define ASSERT_TRUE_AT(LOC, EXPR) \ + SELFTEST_BEGIN_STMT \ + const char *desc = "ASSERT_TRUE (" #EXPR ")"; \ + bool actual = (EXPR); \ + if (actual) \ + ::selftest::pass ((LOC), desc); \ + else \ + ::selftest::fail ((LOC), desc); \ + SELFTEST_END_STMT + +/* Evaluate EXPR and coerce to bool, calling + ::selftest::pass if it is false, + ::selftest::fail if it true. */ + +#define ASSERT_FALSE(EXPR) \ + ASSERT_FALSE_AT (SELFTEST_LOCATION, (EXPR)) + +/* Like ASSERT_FALSE, but treat LOC as the effective location of the + selftest. */ + +#define ASSERT_FALSE_AT(LOC, EXPR) \ + SELFTEST_BEGIN_STMT \ + const char *desc = "ASSERT_FALSE (" #EXPR ")"; \ + bool actual = (EXPR); \ + if (actual) \ + ::selftest::fail ((LOC), desc); \ + else \ + ::selftest::pass ((LOC), desc); \ + SELFTEST_END_STMT + +/* Evaluate EXPECTED and ACTUAL and compare them with ==, calling + ::selftest::pass if they are equal, + ::selftest::fail if they are non-equal. */ + +#define ASSERT_EQ(EXPECTED, ACTUAL) \ + ASSERT_EQ_AT ((SELFTEST_LOCATION), (EXPECTED), (ACTUAL)) + +/* Like ASSERT_EQ, but treat LOC as the effective location of the + selftest. */ + +#define ASSERT_EQ_AT(LOC, EXPECTED, ACTUAL) \ + SELFTEST_BEGIN_STMT \ + const char *desc = "ASSERT_EQ (" #EXPECTED ", " #ACTUAL ")"; \ + if ((EXPECTED) == (ACTUAL)) \ + ::selftest::pass ((LOC), desc); \ + else \ + ::selftest::fail ((LOC), desc); \ + SELFTEST_END_STMT + +/* Evaluate EXPECTED and ACTUAL and compare them with !=, calling + ::selftest::pass if they are non-equal, + ::selftest::fail if they are equal. */ + +#define ASSERT_NE(EXPECTED, ACTUAL) \ + SELFTEST_BEGIN_STMT \ + const char *desc = "ASSERT_NE (" #EXPECTED ", " #ACTUAL ")"; \ + if ((EXPECTED) != (ACTUAL)) \ + ::selftest::pass (SELFTEST_LOCATION, desc); \ + else \ + ::selftest::fail (SELFTEST_LOCATION, desc); \ + SELFTEST_END_STMT + +/* Evaluate EXPECTED and ACTUAL and compare them with strcmp, calling + ::selftest::pass if they are equal, + ::selftest::fail if they are non-equal. */ + +#define ASSERT_STREQ(EXPECTED, ACTUAL) \ + SELFTEST_BEGIN_STMT \ + ::selftest::assert_streq (SELFTEST_LOCATION, #EXPECTED, #ACTUAL, \ + (EXPECTED), (ACTUAL)); \ + SELFTEST_END_STMT + +/* Like ASSERT_STREQ, but treat LOC as the effective location of the + selftest. */ + +#define ASSERT_STREQ_AT(LOC, EXPECTED, ACTUAL) \ + SELFTEST_BEGIN_STMT \ + ::selftest::assert_streq ((LOC), #EXPECTED, #ACTUAL, \ + (EXPECTED), (ACTUAL)); \ + SELFTEST_END_STMT + +/* Evaluate HAYSTACK and NEEDLE and use strstr to determine if NEEDLE + is within HAYSTACK. + ::selftest::pass if NEEDLE is found. + ::selftest::fail if it is not found. */ + +#define ASSERT_STR_CONTAINS(HAYSTACK, NEEDLE) \ + SELFTEST_BEGIN_STMT \ + ::selftest::assert_str_contains (SELFTEST_LOCATION, #HAYSTACK, #NEEDLE, \ + (HAYSTACK), (NEEDLE)); \ + SELFTEST_END_STMT + +/* Evaluate PRED1 (VAL1), calling ::selftest::pass if it is true, + ::selftest::fail if it is false. */ + +#define ASSERT_PRED1(PRED1, VAL1) \ + SELFTEST_BEGIN_STMT \ + const char *desc = "ASSERT_PRED1 (" #PRED1 ", " #VAL1 ")"; \ + bool actual = (PRED1) (VAL1); \ + if (actual) \ + ::selftest::pass (SELFTEST_LOCATION, desc); \ + else \ + ::selftest::fail (SELFTEST_LOCATION, desc); \ + SELFTEST_END_STMT + +#define SELFTEST_BEGIN_STMT do { +#define SELFTEST_END_STMT } while (0) + +#endif /* #if CHECKING_P */ + +#endif /* GCC_SELFTEST_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sese.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sese.h new file mode 100644 index 0000000..e51f1b4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sese.h @@ -0,0 +1,350 @@ +/* Single entry single exit control flow regions. + Copyright (C) 2008-2017 Free Software Foundation, Inc. + Contributed by Jan Sjodin and + Sebastian Pop . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_SESE_H +#define GCC_SESE_H + +typedef hash_map parameter_rename_map_t; +typedef hash_map > bb_map_t; +typedef hash_map > rename_map_t; +typedef struct ifsese_s *ifsese; +/* First phi is the new codegenerated phi second one is original phi. */ +typedef std::pair phi_rename; +/* First edge is the init edge and second is the back edge w.r.t. a loop. */ +typedef std::pair init_back_edge_pair_t; + +/* A Single Entry, Single Exit region is a part of the CFG delimited + by two edges. */ +struct sese_l +{ + sese_l (edge e, edge x) : entry (e), exit (x) {} + + operator bool () const { return entry && exit; } + + edge entry; + edge exit; +}; + +void print_edge (FILE *file, const_edge e); +void print_sese (FILE *file, const sese_l &s); +void dump_edge (const_edge e); +void dump_sese (const sese_l &); + +/* Get the entry of an sese S. */ + +static inline basic_block +get_entry_bb (sese_l &s) +{ + return s.entry->dest; +} + +/* Get the exit of an sese S. */ + +static inline basic_block +get_exit_bb (sese_l &s) +{ + return s.exit->src; +} + +/* Returns the index of V where ELEM can be found. -1 Otherwise. */ +template +int +vec_find (const vec &v, const T &elem) +{ + int i; + T t; + FOR_EACH_VEC_ELT (v, i, t) + if (elem == t) + return i; + return -1; +} + +/* A helper structure for bookkeeping information about a scop in graphite. */ +typedef struct sese_info_t +{ + /* The SESE region. */ + sese_l region; + + /* Parameters used within the SCOP. */ + vec params; + + /* Maps an old name to one or more new names. When there are several new + names, one has to select the definition corresponding to the immediate + dominator. */ + rename_map_t *rename_map; + + /* Parameters to be renamed. */ + parameter_rename_map_t *parameter_rename_map; + + /* Loops completely contained in this SESE. */ + vec loop_nest; + + /* Basic blocks contained in this SESE. */ + vec bbs; + + /* Copied basic blocks indexed by the original bb. */ + bb_map_t *copied_bb_map; + + /* A vector of phi nodes to be updated when all arguments are available. The + pair contains first the old_phi and second the new_phi. */ + vec incomplete_phis; + + /* The condition region generated for this sese. */ + ifsese if_region; + +} *sese_info_p; + +extern sese_info_p new_sese_info (edge, edge); +extern void free_sese_info (sese_info_p); +extern void sese_insert_phis_for_liveouts (sese_info_p, basic_block, edge, edge); +extern struct loop *outermost_loop_in_sese (sese_l &, basic_block); +extern tree scalar_evolution_in_region (const sese_l &, loop_p, tree); +extern bool scev_analyzable_p (tree, sese_l &); +extern bool invariant_in_sese_p_rec (tree, const sese_l &, bool *); + +/* The number of parameters in REGION. */ + +static inline unsigned +sese_nb_params (sese_info_p region) +{ + return region->params.length (); +} + +/* Checks whether BB is contained in the region delimited by ENTRY and + EXIT blocks. */ + +static inline bool +bb_in_region (const_basic_block bb, const_basic_block entry, const_basic_block exit) +{ + /* FIXME: PR67842. */ +#if 0 + if (flag_checking) + { + edge e; + edge_iterator ei; + + /* Check that there are no edges coming in the region: all the + predecessors of EXIT are dominated by ENTRY. */ + FOR_EACH_EDGE (e, ei, exit->preds) + gcc_assert (dominated_by_p (CDI_DOMINATORS, e->src, entry)); + } +#endif + + return dominated_by_p (CDI_DOMINATORS, bb, entry) + && !(dominated_by_p (CDI_DOMINATORS, bb, exit) + && !dominated_by_p (CDI_DOMINATORS, entry, exit)); +} + +/* Checks whether BB is contained in the region delimited by ENTRY and + EXIT blocks. */ + +static inline bool +bb_in_sese_p (basic_block bb, const sese_l &r) +{ + return bb_in_region (bb, r.entry->dest, r.exit->dest); +} + +/* Returns true when STMT is defined in REGION. */ + +static inline bool +stmt_in_sese_p (gimple *stmt, const sese_l &r) +{ + basic_block bb = gimple_bb (stmt); + return bb && bb_in_sese_p (bb, r); +} + +/* Returns true when NAME is defined in REGION. */ + +static inline bool +defined_in_sese_p (tree name, const sese_l &r) +{ + return stmt_in_sese_p (SSA_NAME_DEF_STMT (name), r); +} + +/* Returns true when LOOP is in REGION. */ + +static inline bool +loop_in_sese_p (struct loop *loop, const sese_l ®ion) +{ + return (bb_in_sese_p (loop->header, region) + && bb_in_sese_p (loop->latch, region)); +} + +/* Returns the loop depth of LOOP in REGION. The loop depth + is the same as the normal loop depth, but limited by a region. + + Example: + + loop_0 + loop_1 + { + S0 + <- region start + S1 + + loop_2 + S2 + + S3 + <- region end + } + + loop_0 does not exist in the region -> invalid + loop_1 exists, but is not completely contained in the region -> depth 0 + loop_2 is completely contained -> depth 1 */ + +static inline unsigned int +sese_loop_depth (const sese_l ®ion, loop_p loop) +{ + unsigned int depth = 0; + + while (loop_in_sese_p (loop, region)) + { + depth++; + loop = loop_outer (loop); + } + + return depth; +} + +/* A single entry single exit specialized for conditions. */ + +typedef struct ifsese_s { + sese_info_p region; + sese_info_p true_region; + sese_info_p false_region; +} *ifsese; + +extern void if_region_set_false_region (ifsese, sese_info_p); +extern ifsese move_sese_in_condition (sese_info_p); +extern void set_ifsese_condition (ifsese, tree); +extern edge get_true_edge_from_guard_bb (basic_block); +extern edge get_false_edge_from_guard_bb (basic_block); + +static inline edge +if_region_entry (ifsese if_region) +{ + return if_region->region->region.entry; +} + +static inline edge +if_region_exit (ifsese if_region) +{ + return if_region->region->region.exit; +} + +static inline basic_block +if_region_get_condition_block (ifsese if_region) +{ + return if_region_entry (if_region)->dest; +} + +/* Free and compute again all the dominators information. */ + +static inline void +recompute_all_dominators (void) +{ + mark_irreducible_loops (); + free_dominance_info (CDI_DOMINATORS); + calculate_dominance_info (CDI_DOMINATORS); + + free_dominance_info (CDI_POST_DOMINATORS); + calculate_dominance_info (CDI_POST_DOMINATORS); +} + +typedef std::pair scalar_use; + +typedef struct gimple_poly_bb +{ + basic_block bb; + struct poly_bb *pbb; + + /* Lists containing the restrictions of the conditional statements + dominating this bb. This bb can only be executed, if all conditions + are true. + + Example: + + for (i = 0; i <= 20; i++) + { + A + + if (2i <= 8) + B + } + + So for B there is an additional condition (2i <= 8). + + List of COND_EXPR and SWITCH_EXPR. A COND_EXPR is true only if the + corresponding element in CONDITION_CASES is not NULL_TREE. For a + SWITCH_EXPR the corresponding element in CONDITION_CASES is a + CASE_LABEL_EXPR. */ + vec conditions; + vec condition_cases; + vec data_refs; + vec read_scalar_refs; + vec write_scalar_refs; +} *gimple_poly_bb_p; + +#define GBB_BB(GBB) (GBB)->bb +#define GBB_PBB(GBB) (GBB)->pbb +#define GBB_DATA_REFS(GBB) (GBB)->data_refs +#define GBB_CONDITIONS(GBB) (GBB)->conditions +#define GBB_CONDITION_CASES(GBB) (GBB)->condition_cases + +/* Return the innermost loop that contains the basic block GBB. */ + +static inline struct loop * +gbb_loop (gimple_poly_bb_p gbb) +{ + return GBB_BB (gbb)->loop_father; +} + +/* Returns the gimple loop, that corresponds to the loop_iterator_INDEX. + If there is no corresponding gimple loop, we return NULL. */ + +static inline loop_p +gbb_loop_at_index (gimple_poly_bb_p gbb, sese_l ®ion, int index) +{ + loop_p loop = gbb_loop (gbb); + int depth = sese_loop_depth (region, loop); + + while (--depth > index) + loop = loop_outer (loop); + + gcc_assert (loop_in_sese_p (loop, region)); + + return loop; +} + +/* The number of common loops in REGION for GBB1 and GBB2. */ + +static inline int +nb_common_loops (sese_l ®ion, gimple_poly_bb_p gbb1, gimple_poly_bb_p gbb2) +{ + loop_p l1 = gbb_loop (gbb1); + loop_p l2 = gbb_loop (gbb2); + loop_p common = find_common_loop (l1, l2); + + return sese_loop_depth (region, common); +} + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/shrink-wrap.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/shrink-wrap.h new file mode 100644 index 0000000..91650b7 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/shrink-wrap.h @@ -0,0 +1,34 @@ +/* Shrink-wrapping related functions. + Copyright (C) 1989-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_SHRINK_WRAP_H +#define GCC_SHRINK_WRAP_H + +#include "function.h" + +/* In shrink-wrap.c. */ +extern bool requires_stack_frame_p (rtx_insn *, HARD_REG_SET, HARD_REG_SET); +extern void try_shrink_wrapping (edge *entry_edge, rtx_insn *prologue_seq); +extern void try_shrink_wrapping_separate (basic_block first_bb); +#define SHRINK_WRAPPING_ENABLED \ + (flag_shrink_wrap && targetm.have_simple_return ()) + +#endif /* GCC_SHRINK_WRAP_H */ + + diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/signop.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/signop.h new file mode 100644 index 0000000..caa6d26 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/signop.h @@ -0,0 +1,33 @@ +/* Operations with SIGNED and UNSIGNED. -*- C++ -*- + Copyright (C) 2012-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3, or (at your option) any +later version. + +GCC is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef SIGNOP_H +#define SIGNOP_H + +/* This type is used for the large number of functions that produce + different results depending on if the operands are signed types or + unsigned types. The signedness of a tree type can be found by + using the TYPE_SIGN macro. */ + +enum signop { + SIGNED, + UNSIGNED +}; + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sparseset.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sparseset.h new file mode 100644 index 0000000..3b002e8 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sparseset.h @@ -0,0 +1,219 @@ +/* SparseSet implementation. + Copyright (C) 2007-2017 Free Software Foundation, Inc. + Contributed by Peter Bergner + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_SPARSESET_H +#define GCC_SPARSESET_H + +/* Implementation of the Briggs and Torczon sparse set representation. + The sparse set representation was first published in: + + "An Efficient Representation for Sparse Sets", + ACM LOPLAS, Vol. 2, Nos. 1-4, March-December 1993, Pages 59-69. + + The sparse set representation is suitable for integer sets with a + fixed-size universe. Two vectors are used to store the members of + the set. If an element I is in the set, then sparse[I] is the + index of I in the dense vector, and dense[sparse[I]] == I. The dense + vector works like a stack. The size of the stack is the cardinality + of the set. + + The following operations can be performed in O(1) time: + + * clear : sparseset_clear + * cardinality : sparseset_cardinality + * set_size : sparseset_size + * member_p : sparseset_bit_p + * add_member : sparseset_set_bit + * remove_member : sparseset_clear_bit + * choose_one : sparseset_pop + + Additionally, the sparse set representation supports enumeration of + the members in O(N) time, where n is the number of members in the set. + The members of the set are stored cache-friendly in the dense vector. + This makes it a competitive choice for iterating over relatively sparse + sets requiring operations: + + * forall : EXECUTE_IF_SET_IN_SPARSESET + * set_copy : sparseset_copy + * set_intersection : sparseset_and + * set_union : sparseset_ior + * set_difference : sparseset_and_compl + * set_disjuction : (not implemented) + * set_compare : sparseset_equal_p + + NB: It is OK to use remove_member during EXECUTE_IF_SET_IN_SPARSESET. + The iterator is updated for it. + + Based on the efficiency of these operations, this representation of + sparse sets will often be superior to alternatives such as simple + bitmaps, linked-list bitmaps, array bitmaps, balanced binary trees, + hash tables, linked lists, etc., if the set is sufficiently sparse. + In the LOPLAS paper the cut-off point where sparse sets became faster + than simple bitmaps (see sbitmap.h) when N / U < 64 (where U is the + size of the universe of the set). + + Because the set universe is fixed, the set cannot be resized. For + sparse sets with initially unknown size, linked-list bitmaps are a + better choice, see bitmap.h. + + Sparse sets storage requirements are relatively large: O(U) with a + larger constant than sbitmaps (if the storage requirement for an + sbitmap with universe U is S, then the storage required for a sparse + set for the same universe are 2*HOST_BITS_PER_WIDEST_FAST_INT * S). + Accessing the sparse vector is not very cache-friendly, but iterating + over the members in the set is cache-friendly because only the dense + vector is used. */ + +/* Data Structure used for the SparseSet representation. */ + +#define SPARSESET_ELT_BITS ((unsigned) HOST_BITS_PER_WIDEST_FAST_INT) +#define SPARSESET_ELT_TYPE unsigned HOST_WIDEST_FAST_INT + +typedef struct sparseset_def +{ + SPARSESET_ELT_TYPE *dense; /* Dense array. */ + SPARSESET_ELT_TYPE *sparse; /* Sparse array. */ + SPARSESET_ELT_TYPE members; /* Number of elements. */ + SPARSESET_ELT_TYPE size; /* Maximum number of elements. */ + SPARSESET_ELT_TYPE iter; /* Iterator index. */ + unsigned char iter_inc; /* Iteration increment amount. */ + bool iterating; + SPARSESET_ELT_TYPE elms[2]; /* Combined dense and sparse arrays. */ +} *sparseset; + +#define sparseset_free(MAP) free(MAP) +extern sparseset sparseset_alloc (SPARSESET_ELT_TYPE n_elms); +extern void sparseset_clear_bit (sparseset, SPARSESET_ELT_TYPE); +extern void sparseset_copy (sparseset, sparseset); +extern void sparseset_and (sparseset, sparseset, sparseset); +extern void sparseset_and_compl (sparseset, sparseset, sparseset); +extern void sparseset_ior (sparseset, sparseset, sparseset); +extern bool sparseset_equal_p (sparseset, sparseset); + +/* Operation: S = {} + Clear the set of all elements. */ + +static inline void +sparseset_clear (sparseset s) +{ + s->members = 0; + s->iterating = false; +} + +/* Return the number of elements currently in the set. */ + +static inline SPARSESET_ELT_TYPE +sparseset_cardinality (sparseset s) +{ + return s->members; +} + +/* Return the maximum number of elements this set can hold. */ + +static inline SPARSESET_ELT_TYPE +sparseset_size (sparseset s) +{ + return s->size; +} + +/* Return true if e is a member of the set S, otherwise return false. */ + +static inline bool +sparseset_bit_p (sparseset s, SPARSESET_ELT_TYPE e) +{ + SPARSESET_ELT_TYPE idx; + + gcc_checking_assert (e < s->size); + + idx = s->sparse[e]; + + return idx < s->members && s->dense[idx] == e; +} + +/* Low level insertion routine not meant for use outside of sparseset.[ch]. + Assumes E is valid and not already a member of the set S. */ + +static inline void +sparseset_insert_bit (sparseset s, SPARSESET_ELT_TYPE e, SPARSESET_ELT_TYPE idx) +{ + s->sparse[e] = idx; + s->dense[idx] = e; +} + +/* Operation: S = S + {e} + Insert E into the set S, if it isn't already a member. */ + +static inline void +sparseset_set_bit (sparseset s, SPARSESET_ELT_TYPE e) +{ + if (!sparseset_bit_p (s, e)) + sparseset_insert_bit (s, e, s->members++); +} + +/* Return and remove the last member added to the set S. */ + +static inline SPARSESET_ELT_TYPE +sparseset_pop (sparseset s) +{ + SPARSESET_ELT_TYPE mem = s->members; + + gcc_checking_assert (mem != 0); + + s->members = mem - 1; + return s->dense[s->members]; +} + +static inline void +sparseset_iter_init (sparseset s) +{ + s->iter = 0; + s->iter_inc = 1; + s->iterating = true; +} + +static inline bool +sparseset_iter_p (sparseset s) +{ + if (s->iterating && s->iter < s->members) + return true; + else + return s->iterating = false; +} + +static inline SPARSESET_ELT_TYPE +sparseset_iter_elm (sparseset s) +{ + return s->dense[s->iter]; +} + +static inline void +sparseset_iter_next (sparseset s) +{ + s->iter += s->iter_inc; + s->iter_inc = 1; +} + +#define EXECUTE_IF_SET_IN_SPARSESET(SPARSESET, ITER) \ + for (sparseset_iter_init (SPARSESET); \ + sparseset_iter_p (SPARSESET) \ + && (((ITER) = sparseset_iter_elm (SPARSESET)) || 1); \ + sparseset_iter_next (SPARSESET)) + +#endif /* GCC_SPARSESET_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/spellcheck-tree.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/spellcheck-tree.h new file mode 100644 index 0000000..eecfd1a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/spellcheck-tree.h @@ -0,0 +1,77 @@ +/* Find near-matches for identifiers. + Copyright (C) 2015-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_SPELLCHECK_TREE_H +#define GCC_SPELLCHECK_TREE_H + +#include "spellcheck.h" + +/* spellcheck-tree.c */ + +extern edit_distance_t +levenshtein_distance (tree ident_s, tree ident_t); + +extern tree +find_closest_identifier (tree target, const auto_vec *candidates); + +/* Specialization of edit_distance_traits for identifiers. */ + +template <> +struct edit_distance_traits +{ + static size_t get_length (tree id) + { + gcc_assert (TREE_CODE (id) == IDENTIFIER_NODE); + return IDENTIFIER_LENGTH (id); + } + + static const char *get_string (tree id) + { + gcc_assert (TREE_CODE (id) == IDENTIFIER_NODE); + return IDENTIFIER_POINTER (id); + } +}; + +/* Specialization of edit_distance_traits for preprocessor macros. */ + +template <> +struct edit_distance_traits +{ + static size_t get_length (cpp_hashnode *hashnode) + { + return hashnode->ident.len; + } + + static const char *get_string (cpp_hashnode *hashnode) + { + return (const char *)hashnode->ident.str; + } +}; + +/* Specialization of best_match<> for finding the closest preprocessor + macro to a given identifier. */ + +class best_macro_match : public best_match +{ + public: + best_macro_match (tree goal, edit_distance_t best_distance_so_far, + cpp_reader *reader); +}; + +#endif /* GCC_SPELLCHECK_TREE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/spellcheck.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/spellcheck.h new file mode 100644 index 0000000..2edc695 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/spellcheck.h @@ -0,0 +1,192 @@ +/* Find near-matches for strings and identifiers. + Copyright (C) 2015-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_SPELLCHECK_H +#define GCC_SPELLCHECK_H + +typedef unsigned int edit_distance_t; +const edit_distance_t MAX_EDIT_DISTANCE = UINT_MAX; + +/* spellcheck.c */ +extern edit_distance_t +levenshtein_distance (const char *s, int len_s, + const char *t, int len_t); + +extern edit_distance_t +levenshtein_distance (const char *s, const char *t); + +extern const char * +find_closest_string (const char *target, + const auto_vec *candidates); + +/* A traits class for describing a string-like type usable by + class best_match. + Specializations should provide the implementations of the following: + + static size_t get_length (TYPE); + static const char *get_string (TYPE); + + get_string should return a non-NULL ptr, which does not need to be + 0-terminated. */ + +template +struct edit_distance_traits {}; + +/* Specialization of edit_distance_traits for C-style strings. */ + +template <> +struct edit_distance_traits +{ + static size_t get_length (const char *str) + { + gcc_assert (str); + return strlen (str); + } + + static const char *get_string (const char *str) + { + gcc_assert (str); + return str; + } +}; + +/* A type for use when determining the best match against a string, + expressed as a template so that we can match against various + string-like types (const char *, frontend identifiers, and preprocessor + macros). + + This type accumulates the best possible match against GOAL_TYPE for + a sequence of elements of CANDIDATE_TYPE, whilst minimizing the + number of calls to levenshtein_distance and to + edit_distance_traits::get_length. */ + +template +class best_match +{ + public: + typedef GOAL_TYPE goal_t; + typedef CANDIDATE_TYPE candidate_t; + typedef edit_distance_traits goal_traits; + typedef edit_distance_traits candidate_traits; + + /* Constructor. */ + + best_match (GOAL_TYPE goal, + edit_distance_t best_distance_so_far = MAX_EDIT_DISTANCE) + : m_goal (goal_traits::get_string (goal)), + m_goal_len (goal_traits::get_length (goal)), + m_best_candidate (NULL), + m_best_distance (best_distance_so_far) + {} + + /* Compare the edit distance between CANDIDATE and m_goal, + and if it's the best so far, record it. */ + + void consider (candidate_t candidate) + { + size_t candidate_len = candidate_traits::get_length (candidate); + + /* Calculate a lower bound on the candidate's distance to the goal, + based on the difference in lengths; it will require at least + this many insertions/deletions. */ + edit_distance_t min_candidate_distance + = abs ((ssize_t)candidate_len - (ssize_t)m_goal_len); + + /* If the candidate's length is sufficiently different to that + of the goal string, then the number of insertions/deletions + may be >= the best distance so far. If so, we can reject + the candidate immediately without needing to compute + the exact distance, since it won't be an improvement. */ + if (min_candidate_distance >= m_best_distance) + return; + + /* If the candidate will be unable to beat the criterion in + get_best_meaningful_candidate, reject it without computing + the exact distance. */ + unsigned int cutoff = MAX (m_goal_len, candidate_len) / 2; + if (min_candidate_distance > cutoff) + return; + + /* Otherwise, compute the distance and see if the candidate + has beaten the previous best value. */ + edit_distance_t dist + = levenshtein_distance (m_goal, m_goal_len, + candidate_traits::get_string (candidate), + candidate_len); + if (dist < m_best_distance) + { + m_best_distance = dist; + m_best_candidate = candidate; + m_best_candidate_len = candidate_len; + } + } + + /* Assuming that BEST_CANDIDATE is known to be better than + m_best_candidate, update (without recomputing the edit distance to + the goal). */ + + void set_best_so_far (CANDIDATE_TYPE best_candidate, + edit_distance_t best_distance, + size_t best_candidate_len) + { + gcc_assert (best_distance < m_best_distance); + m_best_candidate = best_candidate; + m_best_distance = best_distance; + m_best_candidate_len = best_candidate_len; + } + + /* Get the best candidate so far, but applying a filter to ensure + that we return NULL if none of the candidates are close to the goal, + to avoid offering nonsensical suggestions to the user. */ + + candidate_t get_best_meaningful_candidate () const + { + /* If more than half of the letters were misspelled, the suggestion is + likely to be meaningless. */ + if (m_best_candidate) + { + unsigned int cutoff = MAX (m_goal_len, m_best_candidate_len) / 2; + if (m_best_distance > cutoff) + return NULL; + } + + /* If the goal string somehow makes it into the candidate list, offering + it as a suggestion will be nonsensical e.g. + 'constexpr' does not name a type; did you mean 'constexpr'? + Ultimately such suggestions are due to bugs in constructing the + candidate list, but as a band-aid, do not offer suggestions for + distance == 0 (where candidate == goal). */ + if (m_best_distance == 0) + return NULL; + + return m_best_candidate; + } + + edit_distance_t get_best_distance () const { return m_best_distance; } + size_t get_best_candidate_length () const { return m_best_candidate_len; } + + private: + const char *m_goal; + size_t m_goal_len; + candidate_t m_best_candidate; + edit_distance_t m_best_distance; + size_t m_best_candidate_len; +}; + +#endif /* GCC_SPELLCHECK_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/splay-tree.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/splay-tree.h new file mode 100644 index 0000000..d8210f0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/splay-tree.h @@ -0,0 +1,156 @@ +/* A splay-tree datatype. + Copyright (C) 1998-2017 Free Software Foundation, Inc. + Contributed by Mark Mitchell (mark@markmitchell.com). + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to + the Free Software Foundation, 51 Franklin Street - Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* For an easily readable description of splay-trees, see: + + Lewis, Harry R. and Denenberg, Larry. Data Structures and Their + Algorithms. Harper-Collins, Inc. 1991. + + The major feature of splay trees is that all basic tree operations + are amortized O(log n) time for a tree with n nodes. */ + +#ifndef _SPLAY_TREE_H +#define _SPLAY_TREE_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "ansidecl.h" + +#ifdef HAVE_STDINT_H +#include +#endif +#ifdef HAVE_INTTYPES_H +#include +#endif + +/* Use typedefs for the key and data types to facilitate changing + these types, if necessary. These types should be sufficiently wide + that any pointer or scalar can be cast to these types, and then + cast back, without loss of precision. */ +typedef uintptr_t splay_tree_key; +typedef uintptr_t splay_tree_value; + +/* Forward declaration for a node in the tree. */ +typedef struct splay_tree_node_s *splay_tree_node; + +/* The type of a function which compares two splay-tree keys. The + function should return values as for qsort. */ +typedef int (*splay_tree_compare_fn) (splay_tree_key, splay_tree_key); + +/* The type of a function used to deallocate any resources associated + with the key. */ +typedef void (*splay_tree_delete_key_fn) (splay_tree_key); + +/* The type of a function used to deallocate any resources associated + with the value. */ +typedef void (*splay_tree_delete_value_fn) (splay_tree_value); + +/* The type of a function used to iterate over the tree. */ +typedef int (*splay_tree_foreach_fn) (splay_tree_node, void*); + +/* The type of a function used to allocate memory for tree root and + node structures. The first argument is the number of bytes needed; + the second is a data pointer the splay tree functions pass through + to the allocator. This function must never return zero. */ +typedef void *(*splay_tree_allocate_fn) (int, void *); + +/* The type of a function used to free memory allocated using the + corresponding splay_tree_allocate_fn. The first argument is the + memory to be freed; the latter is a data pointer the splay tree + functions pass through to the freer. */ +typedef void (*splay_tree_deallocate_fn) (void *, void *); + +/* The nodes in the splay tree. */ +struct splay_tree_node_s { + /* The key. */ + splay_tree_key key; + + /* The value. */ + splay_tree_value value; + + /* The left and right children, respectively. */ + splay_tree_node left; + splay_tree_node right; +}; + +/* The splay tree itself. */ +struct splay_tree_s { + /* The root of the tree. */ + splay_tree_node root; + + /* The comparision function. */ + splay_tree_compare_fn comp; + + /* The deallocate-key function. NULL if no cleanup is necessary. */ + splay_tree_delete_key_fn delete_key; + + /* The deallocate-value function. NULL if no cleanup is necessary. */ + splay_tree_delete_value_fn delete_value; + + /* Node allocate function. Takes allocate_data as a parameter. */ + splay_tree_allocate_fn allocate; + + /* Free function for nodes and trees. Takes allocate_data as a parameter. */ + splay_tree_deallocate_fn deallocate; + + /* Parameter for allocate/free functions. */ + void *allocate_data; +}; + +typedef struct splay_tree_s *splay_tree; + +extern splay_tree splay_tree_new (splay_tree_compare_fn, + splay_tree_delete_key_fn, + splay_tree_delete_value_fn); +extern splay_tree splay_tree_new_with_allocator (splay_tree_compare_fn, + splay_tree_delete_key_fn, + splay_tree_delete_value_fn, + splay_tree_allocate_fn, + splay_tree_deallocate_fn, + void *); +extern splay_tree splay_tree_new_typed_alloc (splay_tree_compare_fn, + splay_tree_delete_key_fn, + splay_tree_delete_value_fn, + splay_tree_allocate_fn, + splay_tree_allocate_fn, + splay_tree_deallocate_fn, + void *); +extern void splay_tree_delete (splay_tree); +extern splay_tree_node splay_tree_insert (splay_tree, + splay_tree_key, + splay_tree_value); +extern void splay_tree_remove (splay_tree, splay_tree_key); +extern splay_tree_node splay_tree_lookup (splay_tree, splay_tree_key); +extern splay_tree_node splay_tree_predecessor (splay_tree, splay_tree_key); +extern splay_tree_node splay_tree_successor (splay_tree, splay_tree_key); +extern splay_tree_node splay_tree_max (splay_tree); +extern splay_tree_node splay_tree_min (splay_tree); +extern int splay_tree_foreach (splay_tree, splay_tree_foreach_fn, void*); +extern int splay_tree_compare_ints (splay_tree_key, splay_tree_key); +extern int splay_tree_compare_pointers (splay_tree_key, splay_tree_key); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _SPLAY_TREE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sreal.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sreal.h new file mode 100644 index 0000000..917ce3e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/sreal.h @@ -0,0 +1,271 @@ +/* Definitions for simple data type for real numbers. + Copyright (C) 2002-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_SREAL_H +#define GCC_SREAL_H + +/* SREAL_PART_BITS has to be an even number. */ +#define SREAL_PART_BITS 32 + +#define UINT64_BITS 64 + +#define SREAL_MIN_SIG ((int64_t) 1 << (SREAL_PART_BITS - 2)) +#define SREAL_MAX_SIG (((int64_t) 1 << (SREAL_PART_BITS - 1)) - 1) +#define SREAL_MAX_EXP (INT_MAX / 4) + +#define SREAL_BITS SREAL_PART_BITS + +#define SREAL_SIGN(v) (v < 0 ? -1: 1) +#define SREAL_ABS(v) (v < 0 ? -v: v) + +/* Structure for holding a simple real number. */ +class sreal +{ +public: + /* Construct an uninitialized sreal. */ + sreal () : m_sig (-1), m_exp (-1) {} + + /* Construct a sreal. */ + sreal (int64_t sig, int exp = 0) : m_sig (sig), m_exp (exp) + { + normalize (); + } + + void dump (FILE *) const; + int64_t to_int () const; + double to_double () const; + sreal operator+ (const sreal &other) const; + sreal operator- (const sreal &other) const; + sreal operator* (const sreal &other) const; + sreal operator/ (const sreal &other) const; + + bool operator< (const sreal &other) const + { + if (m_exp == other.m_exp) + return m_sig < other.m_sig; + else + { + bool negative = m_sig < 0; + bool other_negative = other.m_sig < 0; + + if (negative != other_negative) + return negative > other_negative; + + bool r = m_exp < other.m_exp; + return negative ? !r : r; + } + } + + bool operator== (const sreal &other) const + { + return m_exp == other.m_exp && m_sig == other.m_sig; + } + + sreal operator- () const + { + sreal tmp = *this; + tmp.m_sig *= -1; + + return tmp; + } + + sreal shift (int s) const + { + /* Zero needs no shifting. */ + if (!m_sig) + return *this; + gcc_checking_assert (s <= SREAL_MAX_EXP); + gcc_checking_assert (s >= -SREAL_MAX_EXP); + + /* Overflows/drop to 0 could be handled gracefully, but hopefully we do not + need to do so. */ + gcc_checking_assert (m_exp + s <= SREAL_MAX_EXP); + gcc_checking_assert (m_exp + s >= -SREAL_MAX_EXP); + + sreal tmp = *this; + tmp.m_exp += s; + + return tmp; + } + + /* Global minimum sreal can hold. */ + inline static sreal min () + { + sreal min; + /* This never needs normalization. */ + min.m_sig = -SREAL_MAX_SIG; + min.m_exp = SREAL_MAX_EXP; + return min; + } + + /* Global minimum sreal can hold. */ + inline static sreal max () + { + sreal max; + /* This never needs normalization. */ + max.m_sig = SREAL_MAX_SIG; + max.m_exp = SREAL_MAX_EXP; + return max; + } + +private: + inline void normalize (); + inline void normalize_up (); + inline void normalize_down (); + void shift_right (int amount); + static sreal signedless_plus (const sreal &a, const sreal &b, bool negative); + static sreal signedless_minus (const sreal &a, const sreal &b, bool negative); + + int64_t m_sig; /* Significant. */ + signed int m_exp; /* Exponent. */ +}; + +extern void debug (const sreal &ref); +extern void debug (const sreal *ptr); + +inline sreal &operator+= (sreal &a, const sreal &b) +{ + return a = a + b; +} + +inline sreal &operator-= (sreal &a, const sreal &b) +{ + return a = a - b; +} + +inline sreal &operator/= (sreal &a, const sreal &b) +{ + return a = a / b; +} + +inline sreal &operator*= (sreal &a, const sreal &b) +{ + return a = a * b; +} + +inline bool operator!= (const sreal &a, const sreal &b) +{ + return !(a == b); +} + +inline bool operator> (const sreal &a, const sreal &b) +{ + return !(a == b || a < b); +} + +inline bool operator<= (const sreal &a, const sreal &b) +{ + return a < b || a == b; +} + +inline bool operator>= (const sreal &a, const sreal &b) +{ + return a == b || a > b; +} + +inline sreal operator<< (const sreal &a, int exp) +{ + return a.shift (exp); +} + +inline sreal operator>> (const sreal &a, int exp) +{ + return a.shift (-exp); +} + +/* Make significant to be >= SREAL_MIN_SIG. + + Make this separate method so inliner can handle hot path better. */ + +inline void +sreal::normalize_up () +{ + unsigned HOST_WIDE_INT sig = absu_hwi (m_sig); + int shift = SREAL_PART_BITS - 2 - floor_log2 (sig); + + gcc_checking_assert (shift > 0); + sig <<= shift; + m_exp -= shift; + gcc_checking_assert (sig <= SREAL_MAX_SIG && sig >= SREAL_MIN_SIG); + + /* Check underflow. */ + if (m_exp < -SREAL_MAX_EXP) + { + m_exp = -SREAL_MAX_EXP; + sig = 0; + } + if (SREAL_SIGN (m_sig) == -1) + m_sig = -sig; + else + m_sig = sig; +} + +/* Make significant to be <= SREAL_MAX_SIG. + + Make this separate method so inliner can handle hot path better. */ + +inline void +sreal::normalize_down () +{ + int last_bit; + unsigned HOST_WIDE_INT sig = absu_hwi (m_sig); + int shift = floor_log2 (sig) - SREAL_PART_BITS + 2; + + gcc_checking_assert (shift > 0); + last_bit = (sig >> (shift-1)) & 1; + sig >>= shift; + m_exp += shift; + gcc_checking_assert (sig <= SREAL_MAX_SIG && sig >= SREAL_MIN_SIG); + + /* Round the number. */ + sig += last_bit; + if (sig > SREAL_MAX_SIG) + { + sig >>= 1; + m_exp++; + } + + /* Check overflow. */ + if (m_exp > SREAL_MAX_EXP) + { + m_exp = SREAL_MAX_EXP; + sig = SREAL_MAX_SIG; + } + if (SREAL_SIGN (m_sig) == -1) + m_sig = -sig; + else + m_sig = sig; +} + +/* Normalize *this; the hot path. */ + +inline void +sreal::normalize () +{ + unsigned HOST_WIDE_INT sig = absu_hwi (m_sig); + + if (sig == 0) + m_exp = -SREAL_MAX_EXP; + else if (sig > SREAL_MAX_SIG) + normalize_down (); + else if (sig < SREAL_MIN_SIG) + normalize_up (); +} + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ssa-iterators.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ssa-iterators.h new file mode 100644 index 0000000..c8aa77b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ssa-iterators.h @@ -0,0 +1,1004 @@ +/* Header file for SSA iterators. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_SSA_ITERATORS_H +#define GCC_SSA_ITERATORS_H + +/* Immediate use lists are used to directly access all uses for an SSA + name and get pointers to the statement for each use. + + The structure ssa_use_operand_t consists of PREV and NEXT pointers + to maintain the list. A USE pointer, which points to address where + the use is located and a LOC pointer which can point to the + statement where the use is located, or, in the case of the root + node, it points to the SSA name itself. + + The list is anchored by an occurrence of ssa_operand_d *in* the + ssa_name node itself (named 'imm_uses'). This node is uniquely + identified by having a NULL USE pointer. and the LOC pointer + pointing back to the ssa_name node itself. This node forms the + base for a circular list, and initially this is the only node in + the list. + + Fast iteration allows each use to be examined, but does not allow + any modifications to the uses or stmts. + + Normal iteration allows insertion, deletion, and modification. the + iterator manages this by inserting a marker node into the list + immediately before the node currently being examined in the list. + this marker node is uniquely identified by having null stmt *and* a + null use pointer. + + When iterating to the next use, the iteration routines check to see + if the node after the marker has changed. if it has, then the node + following the marker is now the next one to be visited. if not, the + marker node is moved past that node in the list (visualize it as + bumping the marker node through the list). this continues until + the marker node is moved to the original anchor position. the + marker node is then removed from the list. + + If iteration is halted early, the marker node must be removed from + the list before continuing. */ +struct imm_use_iterator +{ + /* This is the current use the iterator is processing. */ + ssa_use_operand_t *imm_use; + /* This marks the last use in the list (use node from SSA_NAME) */ + ssa_use_operand_t *end_p; + /* This node is inserted and used to mark the end of the uses for a stmt. */ + ssa_use_operand_t iter_node; + /* This is the next ssa_name to visit. IMM_USE may get removed before + the next one is traversed to, so it must be cached early. */ + ssa_use_operand_t *next_imm_name; +}; + + +/* Use this iterator when simply looking at stmts. Adding, deleting or + modifying stmts will cause this iterator to malfunction. */ + +#define FOR_EACH_IMM_USE_FAST(DEST, ITER, SSAVAR) \ + for ((DEST) = first_readonly_imm_use (&(ITER), (SSAVAR)); \ + !end_readonly_imm_use_p (&(ITER)); \ + (void) ((DEST) = next_readonly_imm_use (&(ITER)))) + +/* Use this iterator to visit each stmt which has a use of SSAVAR. */ + +#define FOR_EACH_IMM_USE_STMT(STMT, ITER, SSAVAR) \ + for ((STMT) = first_imm_use_stmt (&(ITER), (SSAVAR)); \ + !end_imm_use_stmt_p (&(ITER)); \ + (void) ((STMT) = next_imm_use_stmt (&(ITER)))) + +/* Use this to terminate the FOR_EACH_IMM_USE_STMT loop early. Failure to + do so will result in leaving a iterator marker node in the immediate + use list, and nothing good will come from that. */ +#define BREAK_FROM_IMM_USE_STMT(ITER) \ + { \ + end_imm_use_stmt_traverse (&(ITER)); \ + break; \ + } + + +/* Use this iterator in combination with FOR_EACH_IMM_USE_STMT to + get access to each occurrence of ssavar on the stmt returned by + that iterator.. for instance: + + FOR_EACH_IMM_USE_STMT (stmt, iter, ssavar) + { + FOR_EACH_IMM_USE_ON_STMT (use_p, iter) + { + SET_USE (use_p, blah); + } + update_stmt (stmt); + } */ + +#define FOR_EACH_IMM_USE_ON_STMT(DEST, ITER) \ + for ((DEST) = first_imm_use_on_stmt (&(ITER)); \ + !end_imm_use_on_stmt_p (&(ITER)); \ + (void) ((DEST) = next_imm_use_on_stmt (&(ITER)))) + + + +extern bool single_imm_use_1 (const ssa_use_operand_t *head, + use_operand_p *use_p, gimple **stmt); + + +enum ssa_op_iter_type { + ssa_op_iter_none = 0, + ssa_op_iter_tree, + ssa_op_iter_use, + ssa_op_iter_def +}; + +/* This structure is used in the operand iterator loops. It contains the + items required to determine which operand is retrieved next. During + optimization, this structure is scalarized, and any unused fields are + optimized away, resulting in little overhead. */ + +struct ssa_op_iter +{ + enum ssa_op_iter_type iter_type; + bool done; + int flags; + unsigned i; + unsigned numops; + use_optype_p uses; + gimple *stmt; +}; + +/* NOTE: Keep these in sync with doc/tree-ssa.texi. */ +/* These flags are used to determine which operands are returned during + execution of the loop. */ +#define SSA_OP_USE 0x01 /* Real USE operands. */ +#define SSA_OP_DEF 0x02 /* Real DEF operands. */ +#define SSA_OP_VUSE 0x04 /* VUSE operands. */ +#define SSA_OP_VDEF 0x08 /* VDEF operands. */ +/* These are commonly grouped operand flags. */ +#define SSA_OP_VIRTUAL_USES (SSA_OP_VUSE) +#define SSA_OP_VIRTUAL_DEFS (SSA_OP_VDEF) +#define SSA_OP_ALL_VIRTUALS (SSA_OP_VIRTUAL_USES | SSA_OP_VIRTUAL_DEFS) +#define SSA_OP_ALL_USES (SSA_OP_VIRTUAL_USES | SSA_OP_USE) +#define SSA_OP_ALL_DEFS (SSA_OP_VIRTUAL_DEFS | SSA_OP_DEF) +#define SSA_OP_ALL_OPERANDS (SSA_OP_ALL_USES | SSA_OP_ALL_DEFS) + +/* This macro executes a loop over the operands of STMT specified in FLAG, + returning each operand as a 'tree' in the variable TREEVAR. ITER is an + ssa_op_iter structure used to control the loop. */ +#define FOR_EACH_SSA_TREE_OPERAND(TREEVAR, STMT, ITER, FLAGS) \ + for (TREEVAR = op_iter_init_tree (&(ITER), STMT, FLAGS); \ + !op_iter_done (&(ITER)); \ + (void) (TREEVAR = op_iter_next_tree (&(ITER)))) + +/* This macro executes a loop over the operands of STMT specified in FLAG, + returning each operand as a 'use_operand_p' in the variable USEVAR. + ITER is an ssa_op_iter structure used to control the loop. */ +#define FOR_EACH_SSA_USE_OPERAND(USEVAR, STMT, ITER, FLAGS) \ + for (USEVAR = op_iter_init_use (&(ITER), STMT, FLAGS); \ + !op_iter_done (&(ITER)); \ + USEVAR = op_iter_next_use (&(ITER))) + +/* This macro executes a loop over the operands of STMT specified in FLAG, + returning each operand as a 'def_operand_p' in the variable DEFVAR. + ITER is an ssa_op_iter structure used to control the loop. */ +#define FOR_EACH_SSA_DEF_OPERAND(DEFVAR, STMT, ITER, FLAGS) \ + for (DEFVAR = op_iter_init_def (&(ITER), STMT, FLAGS); \ + !op_iter_done (&(ITER)); \ + DEFVAR = op_iter_next_def (&(ITER))) + +/* This macro will execute a loop over all the arguments of a PHI which + match FLAGS. A use_operand_p is always returned via USEVAR. FLAGS + can be either SSA_OP_USE or SSA_OP_VIRTUAL_USES or SSA_OP_ALL_USES. */ +#define FOR_EACH_PHI_ARG(USEVAR, STMT, ITER, FLAGS) \ + for ((USEVAR) = op_iter_init_phiuse (&(ITER), STMT, FLAGS); \ + !op_iter_done (&(ITER)); \ + (USEVAR) = op_iter_next_use (&(ITER))) + + +/* This macro will execute a loop over a stmt, regardless of whether it is + a real stmt or a PHI node, looking at the USE nodes matching FLAGS. */ +#define FOR_EACH_PHI_OR_STMT_USE(USEVAR, STMT, ITER, FLAGS) \ + for ((USEVAR) = (gimple_code (STMT) == GIMPLE_PHI \ + ? op_iter_init_phiuse (&(ITER), \ + as_a (STMT), \ + FLAGS) \ + : op_iter_init_use (&(ITER), STMT, FLAGS)); \ + !op_iter_done (&(ITER)); \ + (USEVAR) = op_iter_next_use (&(ITER))) + +/* This macro will execute a loop over a stmt, regardless of whether it is + a real stmt or a PHI node, looking at the DEF nodes matching FLAGS. */ +#define FOR_EACH_PHI_OR_STMT_DEF(DEFVAR, STMT, ITER, FLAGS) \ + for ((DEFVAR) = (gimple_code (STMT) == GIMPLE_PHI \ + ? op_iter_init_phidef (&(ITER), \ + as_a (STMT), \ + FLAGS) \ + : op_iter_init_def (&(ITER), STMT, FLAGS)); \ + !op_iter_done (&(ITER)); \ + (DEFVAR) = op_iter_next_def (&(ITER))) + +/* This macro returns an operand in STMT as a tree if it is the ONLY + operand matching FLAGS. If there are 0 or more than 1 operand matching + FLAGS, then NULL_TREE is returned. */ +#define SINGLE_SSA_TREE_OPERAND(STMT, FLAGS) \ + single_ssa_tree_operand (STMT, FLAGS) + +/* This macro returns an operand in STMT as a use_operand_p if it is the ONLY + operand matching FLAGS. If there are 0 or more than 1 operand matching + FLAGS, then NULL_USE_OPERAND_P is returned. */ +#define SINGLE_SSA_USE_OPERAND(STMT, FLAGS) \ + single_ssa_use_operand (STMT, FLAGS) + +/* This macro returns an operand in STMT as a def_operand_p if it is the ONLY + operand matching FLAGS. If there are 0 or more than 1 operand matching + FLAGS, then NULL_DEF_OPERAND_P is returned. */ +#define SINGLE_SSA_DEF_OPERAND(STMT, FLAGS) \ + single_ssa_def_operand (STMT, FLAGS) + +/* This macro returns TRUE if there are no operands matching FLAGS in STMT. */ +#define ZERO_SSA_OPERANDS(STMT, FLAGS) zero_ssa_operands (STMT, FLAGS) + +/* This macro counts the number of operands in STMT matching FLAGS. */ +#define NUM_SSA_OPERANDS(STMT, FLAGS) num_ssa_operands (STMT, FLAGS) + + +/* Delink an immediate_uses node from its chain. */ +static inline void +delink_imm_use (ssa_use_operand_t *linknode) +{ + /* Return if this node is not in a list. */ + if (linknode->prev == NULL) + return; + + linknode->prev->next = linknode->next; + linknode->next->prev = linknode->prev; + linknode->prev = NULL; + linknode->next = NULL; +} + +/* Link ssa_imm_use node LINKNODE into the chain for LIST. */ +static inline void +link_imm_use_to_list (ssa_use_operand_t *linknode, ssa_use_operand_t *list) +{ + /* Link the new node at the head of the list. If we are in the process of + traversing the list, we won't visit any new nodes added to it. */ + linknode->prev = list; + linknode->next = list->next; + list->next->prev = linknode; + list->next = linknode; +} + +/* Link ssa_imm_use node LINKNODE into the chain for DEF. */ +static inline void +link_imm_use (ssa_use_operand_t *linknode, tree def) +{ + ssa_use_operand_t *root; + + if (!def || TREE_CODE (def) != SSA_NAME) + linknode->prev = NULL; + else + { + root = &(SSA_NAME_IMM_USE_NODE (def)); + if (linknode->use) + gcc_checking_assert (*(linknode->use) == def); + link_imm_use_to_list (linknode, root); + } +} + +/* Set the value of a use pointed to by USE to VAL. */ +static inline void +set_ssa_use_from_ptr (use_operand_p use, tree val) +{ + delink_imm_use (use); + *(use->use) = val; + link_imm_use (use, val); +} + +/* Link ssa_imm_use node LINKNODE into the chain for DEF, with use occurring + in STMT. */ +static inline void +link_imm_use_stmt (ssa_use_operand_t *linknode, tree def, gimple *stmt) +{ + if (stmt) + link_imm_use (linknode, def); + else + link_imm_use (linknode, NULL); + linknode->loc.stmt = stmt; +} + +/* Relink a new node in place of an old node in the list. */ +static inline void +relink_imm_use (ssa_use_operand_t *node, ssa_use_operand_t *old) +{ + /* The node one had better be in the same list. */ + gcc_checking_assert (*(old->use) == *(node->use)); + node->prev = old->prev; + node->next = old->next; + if (old->prev) + { + old->prev->next = node; + old->next->prev = node; + /* Remove the old node from the list. */ + old->prev = NULL; + } +} + +/* Relink ssa_imm_use node LINKNODE into the chain for OLD, with use occurring + in STMT. */ +static inline void +relink_imm_use_stmt (ssa_use_operand_t *linknode, ssa_use_operand_t *old, + gimple *stmt) +{ + if (stmt) + relink_imm_use (linknode, old); + else + link_imm_use (linknode, NULL); + linknode->loc.stmt = stmt; +} + + +/* Return true is IMM has reached the end of the immediate use list. */ +static inline bool +end_readonly_imm_use_p (const imm_use_iterator *imm) +{ + return (imm->imm_use == imm->end_p); +} + +/* Initialize iterator IMM to process the list for VAR. */ +static inline use_operand_p +first_readonly_imm_use (imm_use_iterator *imm, tree var) +{ + imm->end_p = &(SSA_NAME_IMM_USE_NODE (var)); + imm->imm_use = imm->end_p->next; + imm->iter_node.next = imm->imm_use->next; + if (end_readonly_imm_use_p (imm)) + return NULL_USE_OPERAND_P; + return imm->imm_use; +} + +/* Bump IMM to the next use in the list. */ +static inline use_operand_p +next_readonly_imm_use (imm_use_iterator *imm) +{ + use_operand_p old = imm->imm_use; + + /* If this assertion fails, it indicates the 'next' pointer has changed + since the last bump. This indicates that the list is being modified + via stmt changes, or SET_USE, or somesuch thing, and you need to be + using the SAFE version of the iterator. */ + if (flag_checking) + { + gcc_assert (imm->iter_node.next == old->next); + imm->iter_node.next = old->next->next; + } + + imm->imm_use = old->next; + if (end_readonly_imm_use_p (imm)) + return NULL_USE_OPERAND_P; + return imm->imm_use; +} + + +/* Return true if VAR has no nondebug uses. */ +static inline bool +has_zero_uses (const_tree var) +{ + const ssa_use_operand_t *const head = &(SSA_NAME_IMM_USE_NODE (var)); + const ssa_use_operand_t *ptr; + + for (ptr = head->next; ptr != head; ptr = ptr->next) + if (USE_STMT (ptr) && !is_gimple_debug (USE_STMT (ptr))) + return false; + + return true; +} + +/* Return true if VAR has a single nondebug use. */ +static inline bool +has_single_use (const_tree var) +{ + const ssa_use_operand_t *const head = &(SSA_NAME_IMM_USE_NODE (var)); + const ssa_use_operand_t *ptr; + bool single = false; + + for (ptr = head->next; ptr != head; ptr = ptr->next) + if (USE_STMT(ptr) && !is_gimple_debug (USE_STMT (ptr))) + { + if (single) + return false; + else + single = true; + } + + return single; +} + +/* If VAR has only a single immediate nondebug use, return true, and + set USE_P and STMT to the use pointer and stmt of occurrence. */ +static inline bool +single_imm_use (const_tree var, use_operand_p *use_p, gimple **stmt) +{ + const ssa_use_operand_t *const ptr = &(SSA_NAME_IMM_USE_NODE (var)); + + /* If there aren't any uses whatsoever, we're done. */ + if (ptr == ptr->next) + { + return_false: + *use_p = NULL_USE_OPERAND_P; + *stmt = NULL; + return false; + } + + /* If there's a single use, check that it's not a debug stmt. */ + if (ptr == ptr->next->next) + { + if (USE_STMT (ptr->next) && !is_gimple_debug (USE_STMT (ptr->next))) + { + *use_p = ptr->next; + *stmt = ptr->next->loc.stmt; + return true; + } + else + goto return_false; + } + + return single_imm_use_1 (ptr, use_p, stmt); +} + +/* Return the number of nondebug immediate uses of VAR. */ +static inline unsigned int +num_imm_uses (const_tree var) +{ + const ssa_use_operand_t *const start = &(SSA_NAME_IMM_USE_NODE (var)); + const ssa_use_operand_t *ptr; + unsigned int num = 0; + + if (!MAY_HAVE_DEBUG_STMTS) + { + for (ptr = start->next; ptr != start; ptr = ptr->next) + if (USE_STMT (ptr)) + num++; + } + else + for (ptr = start->next; ptr != start; ptr = ptr->next) + if (USE_STMT (ptr) && !is_gimple_debug (USE_STMT (ptr))) + num++; + + return num; +} + +/* ----------------------------------------------------------------------- */ + +/* The following set of routines are used to iterator over various type of + SSA operands. */ + +/* Return true if PTR is finished iterating. */ +static inline bool +op_iter_done (const ssa_op_iter *ptr) +{ + return ptr->done; +} + +/* Get the next iterator use value for PTR. */ +static inline use_operand_p +op_iter_next_use (ssa_op_iter *ptr) +{ + use_operand_p use_p; + gcc_checking_assert (ptr->iter_type == ssa_op_iter_use); + if (ptr->uses) + { + use_p = USE_OP_PTR (ptr->uses); + ptr->uses = ptr->uses->next; + return use_p; + } + if (ptr->i < ptr->numops) + { + return PHI_ARG_DEF_PTR (ptr->stmt, (ptr->i)++); + } + ptr->done = true; + return NULL_USE_OPERAND_P; +} + +/* Get the next iterator def value for PTR. */ +static inline def_operand_p +op_iter_next_def (ssa_op_iter *ptr) +{ + gcc_checking_assert (ptr->iter_type == ssa_op_iter_def); + if (ptr->flags & SSA_OP_VDEF) + { + tree *p; + ptr->flags &= ~SSA_OP_VDEF; + p = gimple_vdef_ptr (ptr->stmt); + if (p && *p) + return p; + } + if (ptr->flags & SSA_OP_DEF) + { + while (ptr->i < ptr->numops) + { + tree *val = gimple_op_ptr (ptr->stmt, ptr->i); + ptr->i++; + if (*val) + { + if (TREE_CODE (*val) == TREE_LIST) + val = &TREE_VALUE (*val); + if (TREE_CODE (*val) == SSA_NAME + || is_gimple_reg (*val)) + return val; + } + } + ptr->flags &= ~SSA_OP_DEF; + } + + ptr->done = true; + return NULL_DEF_OPERAND_P; +} + +/* Get the next iterator tree value for PTR. */ +static inline tree +op_iter_next_tree (ssa_op_iter *ptr) +{ + tree val; + gcc_checking_assert (ptr->iter_type == ssa_op_iter_tree); + if (ptr->uses) + { + val = USE_OP (ptr->uses); + ptr->uses = ptr->uses->next; + return val; + } + if (ptr->flags & SSA_OP_VDEF) + { + ptr->flags &= ~SSA_OP_VDEF; + if ((val = gimple_vdef (ptr->stmt))) + return val; + } + if (ptr->flags & SSA_OP_DEF) + { + while (ptr->i < ptr->numops) + { + val = gimple_op (ptr->stmt, ptr->i); + ptr->i++; + if (val) + { + if (TREE_CODE (val) == TREE_LIST) + val = TREE_VALUE (val); + if (TREE_CODE (val) == SSA_NAME + || is_gimple_reg (val)) + return val; + } + } + ptr->flags &= ~SSA_OP_DEF; + } + + ptr->done = true; + return NULL_TREE; +} + + +/* This functions clears the iterator PTR, and marks it done. This is normally + used to prevent warnings in the compile about might be uninitialized + components. */ + +static inline void +clear_and_done_ssa_iter (ssa_op_iter *ptr) +{ + ptr->i = 0; + ptr->numops = 0; + ptr->uses = NULL; + ptr->iter_type = ssa_op_iter_none; + ptr->stmt = NULL; + ptr->done = true; + ptr->flags = 0; +} + +/* Initialize the iterator PTR to the virtual defs in STMT. */ +static inline void +op_iter_init (ssa_op_iter *ptr, gimple *stmt, int flags) +{ + /* PHI nodes require a different iterator initialization path. We + do not support iterating over virtual defs or uses without + iterating over defs or uses at the same time. */ + gcc_checking_assert (gimple_code (stmt) != GIMPLE_PHI + && (!(flags & SSA_OP_VDEF) || (flags & SSA_OP_DEF)) + && (!(flags & SSA_OP_VUSE) || (flags & SSA_OP_USE))); + ptr->numops = 0; + if (flags & (SSA_OP_DEF | SSA_OP_VDEF)) + { + switch (gimple_code (stmt)) + { + case GIMPLE_ASSIGN: + case GIMPLE_CALL: + ptr->numops = 1; + break; + case GIMPLE_ASM: + ptr->numops = gimple_asm_noutputs (as_a (stmt)); + break; + case GIMPLE_TRANSACTION: + ptr->numops = 0; + flags &= ~SSA_OP_DEF; + break; + default: + ptr->numops = 0; + flags &= ~(SSA_OP_DEF | SSA_OP_VDEF); + break; + } + } + ptr->uses = (flags & (SSA_OP_USE|SSA_OP_VUSE)) ? gimple_use_ops (stmt) : NULL; + if (!(flags & SSA_OP_VUSE) + && ptr->uses + && gimple_vuse (stmt) != NULL_TREE) + ptr->uses = ptr->uses->next; + ptr->done = false; + ptr->i = 0; + + ptr->stmt = stmt; + ptr->flags = flags; +} + +/* Initialize iterator PTR to the use operands in STMT based on FLAGS. Return + the first use. */ +static inline use_operand_p +op_iter_init_use (ssa_op_iter *ptr, gimple *stmt, int flags) +{ + gcc_checking_assert ((flags & SSA_OP_ALL_DEFS) == 0 + && (flags & SSA_OP_USE)); + op_iter_init (ptr, stmt, flags); + ptr->iter_type = ssa_op_iter_use; + return op_iter_next_use (ptr); +} + +/* Initialize iterator PTR to the def operands in STMT based on FLAGS. Return + the first def. */ +static inline def_operand_p +op_iter_init_def (ssa_op_iter *ptr, gimple *stmt, int flags) +{ + gcc_checking_assert ((flags & SSA_OP_ALL_USES) == 0 + && (flags & SSA_OP_DEF)); + op_iter_init (ptr, stmt, flags); + ptr->iter_type = ssa_op_iter_def; + return op_iter_next_def (ptr); +} + +/* Initialize iterator PTR to the operands in STMT based on FLAGS. Return + the first operand as a tree. */ +static inline tree +op_iter_init_tree (ssa_op_iter *ptr, gimple *stmt, int flags) +{ + op_iter_init (ptr, stmt, flags); + ptr->iter_type = ssa_op_iter_tree; + return op_iter_next_tree (ptr); +} + + +/* If there is a single operand in STMT matching FLAGS, return it. Otherwise + return NULL. */ +static inline tree +single_ssa_tree_operand (gimple *stmt, int flags) +{ + tree var; + ssa_op_iter iter; + + var = op_iter_init_tree (&iter, stmt, flags); + if (op_iter_done (&iter)) + return NULL_TREE; + op_iter_next_tree (&iter); + if (op_iter_done (&iter)) + return var; + return NULL_TREE; +} + + +/* If there is a single operand in STMT matching FLAGS, return it. Otherwise + return NULL. */ +static inline use_operand_p +single_ssa_use_operand (gimple *stmt, int flags) +{ + use_operand_p var; + ssa_op_iter iter; + + var = op_iter_init_use (&iter, stmt, flags); + if (op_iter_done (&iter)) + return NULL_USE_OPERAND_P; + op_iter_next_use (&iter); + if (op_iter_done (&iter)) + return var; + return NULL_USE_OPERAND_P; +} + +/* Return the single virtual use operand in STMT if present. Otherwise + return NULL. */ +static inline use_operand_p +ssa_vuse_operand (gimple *stmt) +{ + if (! gimple_vuse (stmt)) + return NULL_USE_OPERAND_P; + return USE_OP_PTR (gimple_use_ops (stmt)); +} + + +/* If there is a single operand in STMT matching FLAGS, return it. Otherwise + return NULL. */ +static inline def_operand_p +single_ssa_def_operand (gimple *stmt, int flags) +{ + def_operand_p var; + ssa_op_iter iter; + + var = op_iter_init_def (&iter, stmt, flags); + if (op_iter_done (&iter)) + return NULL_DEF_OPERAND_P; + op_iter_next_def (&iter); + if (op_iter_done (&iter)) + return var; + return NULL_DEF_OPERAND_P; +} + + +/* Return true if there are zero operands in STMT matching the type + given in FLAGS. */ +static inline bool +zero_ssa_operands (gimple *stmt, int flags) +{ + ssa_op_iter iter; + + op_iter_init_tree (&iter, stmt, flags); + return op_iter_done (&iter); +} + + +/* Return the number of operands matching FLAGS in STMT. */ +static inline int +num_ssa_operands (gimple *stmt, int flags) +{ + ssa_op_iter iter; + tree t; + int num = 0; + + gcc_checking_assert (gimple_code (stmt) != GIMPLE_PHI); + FOR_EACH_SSA_TREE_OPERAND (t, stmt, iter, flags) + num++; + return num; +} + +/* If there is a single DEF in the PHI node which matches FLAG, return it. + Otherwise return NULL_DEF_OPERAND_P. */ +static inline tree +single_phi_def (gphi *stmt, int flags) +{ + tree def = PHI_RESULT (stmt); + if ((flags & SSA_OP_DEF) && is_gimple_reg (def)) + return def; + if ((flags & SSA_OP_VIRTUAL_DEFS) && !is_gimple_reg (def)) + return def; + return NULL_TREE; +} + +/* Initialize the iterator PTR for uses matching FLAGS in PHI. FLAGS should + be either SSA_OP_USES or SSA_OP_VIRTUAL_USES. */ +static inline use_operand_p +op_iter_init_phiuse (ssa_op_iter *ptr, gphi *phi, int flags) +{ + tree phi_def = gimple_phi_result (phi); + int comp; + + clear_and_done_ssa_iter (ptr); + ptr->done = false; + + gcc_checking_assert ((flags & (SSA_OP_USE | SSA_OP_VIRTUAL_USES)) != 0); + + comp = (is_gimple_reg (phi_def) ? SSA_OP_USE : SSA_OP_VIRTUAL_USES); + + /* If the PHI node doesn't the operand type we care about, we're done. */ + if ((flags & comp) == 0) + { + ptr->done = true; + return NULL_USE_OPERAND_P; + } + + ptr->stmt = phi; + ptr->numops = gimple_phi_num_args (phi); + ptr->iter_type = ssa_op_iter_use; + ptr->flags = flags; + return op_iter_next_use (ptr); +} + + +/* Start an iterator for a PHI definition. */ + +static inline def_operand_p +op_iter_init_phidef (ssa_op_iter *ptr, gphi *phi, int flags) +{ + tree phi_def = PHI_RESULT (phi); + int comp; + + clear_and_done_ssa_iter (ptr); + ptr->done = false; + + gcc_checking_assert ((flags & (SSA_OP_DEF | SSA_OP_VIRTUAL_DEFS)) != 0); + + comp = (is_gimple_reg (phi_def) ? SSA_OP_DEF : SSA_OP_VIRTUAL_DEFS); + + /* If the PHI node doesn't have the operand type we care about, + we're done. */ + if ((flags & comp) == 0) + { + ptr->done = true; + return NULL_DEF_OPERAND_P; + } + + ptr->iter_type = ssa_op_iter_def; + /* The first call to op_iter_next_def will terminate the iterator since + all the fields are NULL. Simply return the result here as the first and + therefore only result. */ + return PHI_RESULT_PTR (phi); +} + +/* Return true is IMM has reached the end of the immediate use stmt list. */ + +static inline bool +end_imm_use_stmt_p (const imm_use_iterator *imm) +{ + return (imm->imm_use == imm->end_p); +} + +/* Finished the traverse of an immediate use stmt list IMM by removing the + placeholder node from the list. */ + +static inline void +end_imm_use_stmt_traverse (imm_use_iterator *imm) +{ + delink_imm_use (&(imm->iter_node)); +} + +/* Immediate use traversal of uses within a stmt require that all the + uses on a stmt be sequentially listed. This routine is used to build up + this sequential list by adding USE_P to the end of the current list + currently delimited by HEAD and LAST_P. The new LAST_P value is + returned. */ + +static inline use_operand_p +move_use_after_head (use_operand_p use_p, use_operand_p head, + use_operand_p last_p) +{ + gcc_checking_assert (USE_FROM_PTR (use_p) == USE_FROM_PTR (head)); + /* Skip head when we find it. */ + if (use_p != head) + { + /* If use_p is already linked in after last_p, continue. */ + if (last_p->next == use_p) + last_p = use_p; + else + { + /* Delink from current location, and link in at last_p. */ + delink_imm_use (use_p); + link_imm_use_to_list (use_p, last_p); + last_p = use_p; + } + } + return last_p; +} + + +/* This routine will relink all uses with the same stmt as HEAD into the list + immediately following HEAD for iterator IMM. */ + +static inline void +link_use_stmts_after (use_operand_p head, imm_use_iterator *imm) +{ + use_operand_p use_p; + use_operand_p last_p = head; + gimple *head_stmt = USE_STMT (head); + tree use = USE_FROM_PTR (head); + ssa_op_iter op_iter; + int flag; + + /* Only look at virtual or real uses, depending on the type of HEAD. */ + flag = (is_gimple_reg (use) ? SSA_OP_USE : SSA_OP_VIRTUAL_USES); + + if (gphi *phi = dyn_cast (head_stmt)) + { + FOR_EACH_PHI_ARG (use_p, phi, op_iter, flag) + if (USE_FROM_PTR (use_p) == use) + last_p = move_use_after_head (use_p, head, last_p); + } + else + { + if (flag == SSA_OP_USE) + { + FOR_EACH_SSA_USE_OPERAND (use_p, head_stmt, op_iter, flag) + if (USE_FROM_PTR (use_p) == use) + last_p = move_use_after_head (use_p, head, last_p); + } + else if ((use_p = gimple_vuse_op (head_stmt)) != NULL_USE_OPERAND_P) + { + if (USE_FROM_PTR (use_p) == use) + last_p = move_use_after_head (use_p, head, last_p); + } + } + /* Link iter node in after last_p. */ + if (imm->iter_node.prev != NULL) + delink_imm_use (&imm->iter_node); + link_imm_use_to_list (&(imm->iter_node), last_p); +} + +/* Initialize IMM to traverse over uses of VAR. Return the first statement. */ +static inline gimple * +first_imm_use_stmt (imm_use_iterator *imm, tree var) +{ + imm->end_p = &(SSA_NAME_IMM_USE_NODE (var)); + imm->imm_use = imm->end_p->next; + imm->next_imm_name = NULL_USE_OPERAND_P; + + /* iter_node is used as a marker within the immediate use list to indicate + where the end of the current stmt's uses are. Initialize it to NULL + stmt and use, which indicates a marker node. */ + imm->iter_node.prev = NULL_USE_OPERAND_P; + imm->iter_node.next = NULL_USE_OPERAND_P; + imm->iter_node.loc.stmt = NULL; + imm->iter_node.use = NULL; + + if (end_imm_use_stmt_p (imm)) + return NULL; + + link_use_stmts_after (imm->imm_use, imm); + + return USE_STMT (imm->imm_use); +} + +/* Bump IMM to the next stmt which has a use of var. */ + +static inline gimple * +next_imm_use_stmt (imm_use_iterator *imm) +{ + imm->imm_use = imm->iter_node.next; + if (end_imm_use_stmt_p (imm)) + { + if (imm->iter_node.prev != NULL) + delink_imm_use (&imm->iter_node); + return NULL; + } + + link_use_stmts_after (imm->imm_use, imm); + return USE_STMT (imm->imm_use); +} + +/* This routine will return the first use on the stmt IMM currently refers + to. */ + +static inline use_operand_p +first_imm_use_on_stmt (imm_use_iterator *imm) +{ + imm->next_imm_name = imm->imm_use->next; + return imm->imm_use; +} + +/* Return TRUE if the last use on the stmt IMM refers to has been visited. */ + +static inline bool +end_imm_use_on_stmt_p (const imm_use_iterator *imm) +{ + return (imm->imm_use == &(imm->iter_node)); +} + +/* Bump to the next use on the stmt IMM refers to, return NULL if done. */ + +static inline use_operand_p +next_imm_use_on_stmt (imm_use_iterator *imm) +{ + imm->imm_use = imm->next_imm_name; + if (end_imm_use_on_stmt_p (imm)) + return NULL_USE_OPERAND_P; + else + { + imm->next_imm_name = imm->imm_use->next; + return imm->imm_use; + } +} + +/* Delink all immediate_use information for STMT. */ +static inline void +delink_stmt_imm_use (gimple *stmt) +{ + ssa_op_iter iter; + use_operand_p use_p; + + if (ssa_operands_active (cfun)) + FOR_EACH_PHI_OR_STMT_USE (use_p, stmt, iter, SSA_OP_ALL_USES) + delink_imm_use (use_p); +} + +#endif /* GCC_TREE_SSA_ITERATORS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ssa.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ssa.h new file mode 100644 index 0000000..4bc6b3f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ssa.h @@ -0,0 +1,33 @@ +/* Common SSA files + Copyright (C) 2015-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_SSA_H +#define GCC_SSA_H + +/* This is an aggregation header file. This means it should contain only + other include files. */ + +#include "stringpool.h" +#include "gimple-ssa.h" +#include "tree-vrp.h" +#include "tree-ssanames.h" +#include "tree-phinodes.h" +#include "ssa-iterators.h" + +#endif /* GCC_SSA_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/statistics.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/statistics.h new file mode 100644 index 0000000..185fd19 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/statistics.h @@ -0,0 +1,71 @@ +/* Memory and optimization statistics helpers. + Copyright (C) 2004-2017 Free Software Foundation, Inc. + Contributed by Cygnus Solutions. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#ifndef GCC_STATISTICS +#define GCC_STATISTICS + +#if ! defined GATHER_STATISTICS +#error GATHER_STATISTICS must be defined +#endif + +#define GCC_MEM_STAT_ARGUMENTS const char * ARG_UNUSED (_loc_name), int ARG_UNUSED (_loc_line), const char * ARG_UNUSED (_loc_function) +#if GATHER_STATISTICS +#define ALONE_MEM_STAT_DECL GCC_MEM_STAT_ARGUMENTS +#define ALONE_FINAL_MEM_STAT_DECL ALONE_MEM_STAT_DECL +#define ALONE_PASS_MEM_STAT _loc_name, _loc_line, _loc_function +#define ALONE_FINAL_PASS_MEM_STAT ALONE_PASS_MEM_STAT +#define ALONE_MEM_STAT_INFO __FILE__, __LINE__, __FUNCTION__ +#define MEM_STAT_DECL , ALONE_MEM_STAT_DECL +#define FINAL_MEM_STAT_DECL , ALONE_FINAL_MEM_STAT_DECL +#define PASS_MEM_STAT , ALONE_PASS_MEM_STAT +#define FINAL_PASS_MEM_STAT , ALONE_FINAL_PASS_MEM_STAT +#define MEM_STAT_INFO , ALONE_MEM_STAT_INFO +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) +#define ALONE_CXX_MEM_STAT_INFO const char * _loc_name = __builtin_FILE (), int _loc_line = __builtin_LINE (), const char * _loc_function = __builtin_FUNCTION () +#else +#define ALONE_CXX_MEM_STAT_INFO const char * _loc_name = __FILE__, int _loc_line = __LINE__, const char * _loc_function = NULL +#endif +#define CXX_MEM_STAT_INFO , ALONE_CXX_MEM_STAT_INFO +#else +#define ALONE_MEM_STAT_DECL void +#define ALONE_FINAL_MEM_STAT_DECL GCC_MEM_STAT_ARGUMENTS +#define ALONE_PASS_MEM_STAT +#define ALONE_FINAL_PASS_MEM_STAT 0,0,0 +#define ALONE_MEM_STAT_INFO +#define MEM_STAT_DECL +#define FINAL_MEM_STAT_DECL , ALONE_FINAL_MEM_STAT_DECL +#define PASS_MEM_STAT +#define FINAL_PASS_MEM_STAT , ALONE_FINAL_PASS_MEM_STAT +#define MEM_STAT_INFO ALONE_MEM_STAT_INFO +#define ALONE_CXX_MEM_STAT_INFO +#define CXX_MEM_STAT_INFO +#endif + +struct function; + +/* In statistics.c */ +extern void statistics_early_init (void); +extern void statistics_init (void); +extern void statistics_fini (void); +extern void statistics_fini_pass (void); +extern void statistics_counter_event (struct function *, const char *, int); +extern void statistics_histogram_event (struct function *, const char *, int); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/stmt.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/stmt.h new file mode 100644 index 0000000..c3d9557 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/stmt.h @@ -0,0 +1,53 @@ +/* Declarations and data structures for stmt.c. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_STMT_H +#define GCC_STMT_H + +extern void expand_label (tree); +extern bool parse_output_constraint (const char **, int, int, int, + bool *, bool *, bool *); +extern bool parse_input_constraint (const char **, int, int, int, int, + const char * const *, bool *, bool *); +extern tree resolve_asm_operand_names (tree, tree, tree, tree); +#ifdef HARD_CONST +/* Silly ifdef to avoid having all includers depend on hard-reg-set.h. */ +extern tree tree_overlaps_hard_reg_set (tree, HARD_REG_SET *); +#endif + +/* Return the CODE_LABEL rtx for a LABEL_DECL, creating it if necessary. + If label was deleted, the corresponding note + (NOTE_INSN_DELETED{_DEBUG,}_LABEL) insn will be returned. */ +extern rtx_insn *label_rtx (tree); + +/* As label_rtx, but additionally the label is placed on the forced label + list of its containing function (i.e. it is treated as reachable even + if how is not obvious). */ +extern rtx_insn *force_label_rtx (tree); + +/* As label_rtx, but checks that label was not deleted. */ +extern rtx_code_label *jump_target_rtx (tree); + +/* Expand a GIMPLE_SWITCH statement. */ +extern void expand_case (gswitch *); + +/* Like expand_case but special-case for SJLJ exception dispatching. */ +extern void expand_sjlj_dispatch_table (rtx, vec ); + +#endif // GCC_STMT_H diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/stor-layout.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/stor-layout.h new file mode 100644 index 0000000..84ca01b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/stor-layout.h @@ -0,0 +1,120 @@ +/* Definitions and declarations for stor-layout.c. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_STOR_LAYOUT_H +#define GCC_STOR_LAYOUT_H + +extern void set_min_and_max_values_for_integral_type (tree, int, signop); +extern void fixup_signed_type (tree); +extern unsigned int update_alignment_for_field (record_layout_info, tree, + unsigned int); +extern record_layout_info start_record_layout (tree); +extern tree bit_from_pos (tree, tree); +extern tree byte_from_pos (tree, tree); +extern void pos_from_bit (tree *, tree *, unsigned int, tree); +extern void normalize_offset (tree *, tree *, unsigned int); +extern tree rli_size_unit_so_far (record_layout_info); +extern tree rli_size_so_far (record_layout_info); +extern void normalize_rli (record_layout_info); +extern void place_field (record_layout_info, tree); +extern void compute_record_mode (tree); +extern void finish_bitfield_layout (tree); +extern void finish_record_layout (record_layout_info, int); +extern unsigned int element_precision (const_tree); +extern void finalize_size_functions (void); +extern void fixup_unsigned_type (tree); +extern void initialize_sizetypes (void); + +/* Finish up a builtin RECORD_TYPE. Give it a name and provide its + fields. Optionally specify an alignment, and then lay it out. */ +extern void finish_builtin_struct (tree, const char *, tree, tree); + +/* Given a VAR_DECL, PARM_DECL, RESULT_DECL or FIELD_DECL node, + calculates the DECL_SIZE, DECL_SIZE_UNIT, DECL_ALIGN and DECL_MODE + fields. Call this only once for any given decl node. + + Second argument is the boundary that this field can be assumed to + be starting at (in bits). Zero means it can be assumed aligned + on any boundary that may be needed. */ +extern void layout_decl (tree, unsigned); + +/* Given a ..._TYPE node, calculate the TYPE_SIZE, TYPE_SIZE_UNIT, + TYPE_ALIGN and TYPE_MODE fields. If called more than once on one + node, does nothing except for the first time. */ +extern void layout_type (tree); + +/* Return the least alignment in bytes required for type TYPE. */ +extern unsigned int min_align_of_type (tree); + +/* Construct various nodes representing fract or accum data types. */ +extern tree make_fract_type (int, int, int); +extern tree make_accum_type (int, int, int); + +#define make_signed_fract_type(P) make_fract_type (P, 0, 0) +#define make_unsigned_fract_type(P) make_fract_type (P, 1, 0) +#define make_sat_signed_fract_type(P) make_fract_type (P, 0, 1) +#define make_sat_unsigned_fract_type(P) make_fract_type (P, 1, 1) +#define make_signed_accum_type(P) make_accum_type (P, 0, 0) +#define make_unsigned_accum_type(P) make_accum_type (P, 1, 0) +#define make_sat_signed_accum_type(P) make_accum_type (P, 0, 1) +#define make_sat_unsigned_accum_type(P) make_accum_type (P, 1, 1) + +#define make_or_reuse_signed_fract_type(P) \ + make_or_reuse_fract_type (P, 0, 0) +#define make_or_reuse_unsigned_fract_type(P) \ + make_or_reuse_fract_type (P, 1, 0) +#define make_or_reuse_sat_signed_fract_type(P) \ + make_or_reuse_fract_type (P, 0, 1) +#define make_or_reuse_sat_unsigned_fract_type(P) \ + make_or_reuse_fract_type (P, 1, 1) +#define make_or_reuse_signed_accum_type(P) \ + make_or_reuse_accum_type (P, 0, 0) +#define make_or_reuse_unsigned_accum_type(P) \ + make_or_reuse_accum_type (P, 1, 0) +#define make_or_reuse_sat_signed_accum_type(P) \ + make_or_reuse_accum_type (P, 0, 1) +#define make_or_reuse_sat_unsigned_accum_type(P) \ + make_or_reuse_accum_type (P, 1, 1) + +extern tree make_signed_type (int); +extern tree make_unsigned_type (int); + +/* Return the mode for data of a given size SIZE and mode class CLASS. + If LIMIT is nonzero, then don't use modes bigger than MAX_FIXED_MODE_SIZE. + The value is BLKmode if no other mode is found. This is like + mode_for_size, but is passed a tree. */ +extern machine_mode mode_for_size_tree (const_tree, enum mode_class, int); + +extern tree bitwise_type_for_mode (machine_mode); + +/* Given a VAR_DECL, PARM_DECL or RESULT_DECL, clears the results of + a previous call to layout_decl and calls it again. */ +extern void relayout_decl (tree); + +/* variable_size (EXP) is like save_expr (EXP) except that it + is for the special case of something that is part of a + variable size for a data type. It makes special arrangements + to compute the value at the right time when the data type + belongs to a function parameter. */ +extern tree variable_size (tree); + +/* Vector types need to check target flags to determine type. */ +extern machine_mode vector_type_mode (const_tree); + +#endif // GCC_STOR_LAYOUT_H diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/streamer-hooks.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/streamer-hooks.h new file mode 100644 index 0000000..d59b649 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/streamer-hooks.h @@ -0,0 +1,82 @@ +/* Streamer hooks. Support for adding streamer-specific callbacks to + generic streaming routines. + + Copyright (C) 2011-2017 Free Software Foundation, Inc. + Contributed by Diego Novillo + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_STREAMER_HOOKS_H +#define GCC_STREAMER_HOOKS_H + +/* Forward declarations to avoid including unnecessary headers. */ +struct output_block; +struct lto_input_block; +struct data_in; + +/* Streamer hooks. These functions do additional processing as + needed by the module. There are two types of callbacks, those that + replace the default behavior and those that supplement it. + + Hooks marked [REQ] are required to be set. Those marked [OPT] may + be NULL, if the streamer does not need to implement them. */ +struct streamer_hooks { + /* [REQ] Called by every tree streaming routine that needs to write + a tree node. The arguments are: output_block where to write the + node, the tree node to write and a boolean flag that should be true + if the caller wants to write a reference to the tree, instead of the + tree itself. The second boolean parameter specifies this for + the tree itself, the first for all siblings that are streamed. + The referencing mechanism is up to each streamer to implement. */ + void (*write_tree) (struct output_block *, tree, bool, bool); + + /* [REQ] Called by every tree streaming routine that needs to read + a tree node. It takes two arguments: an lto_input_block pointing + to the buffer where to read from and a data_in instance with tables + and descriptors needed by the unpickling routines. It returns the + tree instantiated from the stream. */ + tree (*read_tree) (struct lto_input_block *, struct data_in *); + + /* [REQ] Called by every streaming routine that needs to read a location. */ + void (*input_location) (location_t *, struct bitpack_d *, struct data_in *); + + /* [REQ] Called by every streaming routine that needs to write a location. */ + void (*output_location) (struct output_block *, struct bitpack_d *, location_t); +}; + +#define stream_write_tree(OB, EXPR, REF_P) \ + streamer_hooks.write_tree (OB, EXPR, REF_P, REF_P) + +#define stream_write_tree_shallow_non_ref(OB, EXPR, REF_P) \ + streamer_hooks.write_tree (OB, EXPR, REF_P, false) + +#define stream_read_tree(IB, DATA_IN) \ + streamer_hooks.read_tree (IB, DATA_IN) + +#define stream_input_location(LOCPTR, BP, DATA_IN) \ + streamer_hooks.input_location (LOCPTR, BP, DATA_IN) + +#define stream_output_location(OB, BP, LOC) \ + streamer_hooks.output_location (OB, BP, LOC) + +/* Streamer hooks. */ +extern struct streamer_hooks streamer_hooks; + +/* In streamer-hooks.c. */ +void streamer_hooks_init (void); + +#endif /* GCC_STREAMER_HOOKS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/stringpool.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/stringpool.h new file mode 100644 index 0000000..be3a057 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/stringpool.h @@ -0,0 +1,43 @@ +/* Declarations and definitons for stringpool.c. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_STRINGPOOL_H +#define GCC_STRINGPOOL_H + +/* Return the (unique) IDENTIFIER_NODE node for a given name. + The name is supplied as a char *. */ +extern tree get_identifier (const char *); + +/* If an identifier with the name TEXT (a null-terminated string) has + previously been referred to, return that node; otherwise return + NULL_TREE. */ +extern tree maybe_get_identifier (const char *); + +/* Identical to get_identifier, except that the length is assumed + known. */ +extern tree get_identifier_with_length (const char *, size_t); + +#if GCC_VERSION >= 3000 +#define get_identifier(str) \ + (__builtin_constant_p (str) \ + ? get_identifier_with_length ((str), strlen (str)) \ + : get_identifier (str)) +#endif + +#endif // GCC_STRINGPOOL_H diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/substring-locations.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/substring-locations.h new file mode 100644 index 0000000..a91cc6c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/substring-locations.h @@ -0,0 +1,102 @@ +/* Source locations within string literals. + Copyright (C) 2016-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_SUBSTRING_LOCATIONS_H +#define GCC_SUBSTRING_LOCATIONS_H + +/* The substring_loc class encapsulates information on the source location + of a range of characters within a STRING_CST. + + If needed by a diagnostic, the actual location_t of the substring_loc + can be calculated by calling its get_location method. This calls a + langhook, since this is inherently frontend-specific. For the C family + of frontends, it calls back into libcpp to reparse the strings. This + gets the location information "on demand", rather than storing the + location information in the initial lex for every string. Thus the + substring_loc can also be thought of as a deferred call into libcpp, + to allow the non-trivial work of reparsing the string to be delayed + until we actually need it (to emit a diagnostic for a particular range + of characters). + + substring_loc::get_location returns NULL if it succeeds, or an + error message if it fails. Error messages are intended for GCC + developers (to help debugging) rather than for end-users. + + The easiest way to use a substring_loc is via the format_warning_* APIs, + which gracefully handle failure of substring_loc::get_location by using + the location of the string as a whole if substring-information is + unavailable. */ + +class substring_loc +{ + public: + /* Constructor. FMT_STRING_LOC is the location of the string as + a whole. STRING_TYPE is the type of the string. It should be an + ARRAY_TYPE of INTEGER_TYPE, or a POINTER_TYPE to such an ARRAY_TYPE. + CARET_IDX, START_IDX, and END_IDX are offsets from the start + of the string data. */ + substring_loc (location_t fmt_string_loc, tree string_type, + int caret_idx, int start_idx, int end_idx) + : m_fmt_string_loc (fmt_string_loc), m_string_type (string_type), + m_caret_idx (caret_idx), m_start_idx (start_idx), m_end_idx (end_idx) {} + + void set_caret_index (int caret_idx) { m_caret_idx = caret_idx; } + + const char *get_location (location_t *out_loc) const; + + location_t get_fmt_string_loc () const { return m_fmt_string_loc; } + tree get_string_type () const { return m_string_type; } + int get_caret_idx () const { return m_caret_idx; } + int get_start_idx () const { return m_start_idx; } + int get_end_idx () const { return m_end_idx; } + + private: + location_t m_fmt_string_loc; + tree m_string_type; + int m_caret_idx; + int m_start_idx; + int m_end_idx; +}; + +/* Functions for emitting a warning about a format string. */ + +extern bool format_warning_va (const substring_loc &fmt_loc, + const source_range *param_range, + const char *corrected_substring, + int opt, const char *gmsgid, va_list *ap) + ATTRIBUTE_GCC_DIAG (5,0); + +extern bool format_warning_at_substring (const substring_loc &fmt_loc, + const source_range *param_range, + const char *corrected_substring, + int opt, const char *gmsgid, ...) + ATTRIBUTE_GCC_DIAG (5,0); + +/* Implementation detail, for use when implementing + LANG_HOOKS_GET_SUBSTRING_LOCATION. */ + +extern const char *get_source_location_for_substring (cpp_reader *pfile, + string_concat_db *concats, + location_t strloc, + enum cpp_ttype type, + int caret_idx, + int start_idx, int end_idx, + location_t *out_loc); + +#endif /* ! GCC_SUBSTRING_LOCATIONS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/symbol-summary.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/symbol-summary.h new file mode 100644 index 0000000..d0246f4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/symbol-summary.h @@ -0,0 +1,254 @@ +/* Callgraph summary data structure. + Copyright (C) 2014-2017 Free Software Foundation, Inc. + Contributed by Martin Liska + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_SYMBOL_SUMMARY_H +#define GCC_SYMBOL_SUMMARY_H + +/* We want to pass just pointer types as argument for function_summary + template class. */ + +template +class function_summary +{ +private: + function_summary(); +}; + +template +class GTY((user)) function_summary +{ +public: + /* Default construction takes SYMTAB as an argument. */ + function_summary (symbol_table *symtab, bool ggc = false): m_ggc (ggc), + m_insertion_enabled (true), m_released (false), m_map (13, ggc), + m_symtab (symtab) + { + m_symtab_insertion_hook = + symtab->add_cgraph_insertion_hook + (function_summary::symtab_insertion, this); + + m_symtab_removal_hook = + symtab->add_cgraph_removal_hook + (function_summary::symtab_removal, this); + m_symtab_duplication_hook = + symtab->add_cgraph_duplication_hook + (function_summary::symtab_duplication, this); + } + + /* Destructor. */ + virtual ~function_summary () + { + release (); + } + + /* Destruction method that can be called for GGT purpose. */ + void release () + { + if (m_released) + return; + + m_symtab->remove_cgraph_insertion_hook (m_symtab_insertion_hook); + m_symtab->remove_cgraph_removal_hook (m_symtab_removal_hook); + m_symtab->remove_cgraph_duplication_hook (m_symtab_duplication_hook); + + /* Release all summaries. */ + typedef typename hash_map ::iterator map_iterator; + for (map_iterator it = m_map.begin (); it != m_map.end (); ++it) + release ((*it).second); + + m_released = true; + } + + /* Traverses all summarys with a function F called with + ARG as argument. */ + template + void traverse (Arg a) const + { + m_map.traverse (a); + } + + /* Basic implementation of insert operation. */ + virtual void insert (cgraph_node *, T *) {} + + /* Basic implementation of removal operation. */ + virtual void remove (cgraph_node *, T *) {} + + /* Basic implementation of duplication operation. */ + virtual void duplicate (cgraph_node *, cgraph_node *, T *, T *) {} + + /* Allocates new data that are stored within map. */ + T* allocate_new () + { + /* Call gcc_internal_because we do not want to call finalizer for + a type T. We call dtor explicitly. */ + return m_ggc ? new (ggc_internal_alloc (sizeof (T))) T () : new T () ; + } + + /* Release an item that is stored within map. */ + void release (T *item) + { + if (m_ggc) + { + item->~T (); + ggc_free (item); + } + else + delete item; + } + + /* Getter for summary callgraph node pointer. */ + T* get (cgraph_node *node) + { + gcc_checking_assert (node->summary_uid); + return get (node->summary_uid); + } + + /* Return number of elements handled by data structure. */ + size_t elements () + { + return m_map.elements (); + } + + /* Enable insertion hook invocation. */ + void enable_insertion_hook () + { + m_insertion_enabled = true; + } + + /* Enable insertion hook invocation. */ + void disable_insertion_hook () + { + m_insertion_enabled = false; + } + + /* Symbol insertion hook that is registered to symbol table. */ + static void symtab_insertion (cgraph_node *node, void *data) + { + gcc_checking_assert (node->summary_uid); + function_summary *summary = (function_summary *) (data); + + if (summary->m_insertion_enabled) + summary->insert (node, summary->get (node)); + } + + /* Symbol removal hook that is registered to symbol table. */ + static void symtab_removal (cgraph_node *node, void *data) + { + gcc_checking_assert (node->summary_uid); + function_summary *summary = (function_summary *) (data); + + int summary_uid = node->summary_uid; + T **v = summary->m_map.get (summary_uid); + + if (v) + { + summary->remove (node, *v); + + if (!summary->m_ggc) + delete (*v); + + summary->m_map.remove (summary_uid); + } + } + + /* Symbol duplication hook that is registered to symbol table. */ + static void symtab_duplication (cgraph_node *node, cgraph_node *node2, + void *data) + { + function_summary *summary = (function_summary *) (data); + T **v = summary->m_map.get (node->summary_uid); + + gcc_checking_assert (node2->summary_uid > 0); + + if (v) + { + /* This load is necessary, because we insert a new value! */ + T *data = *v; + T *duplicate = summary->allocate_new (); + summary->m_map.put (node2->summary_uid, duplicate); + summary->duplicate (node, node2, data, duplicate); + } + } + +protected: + /* Indication if we use ggc summary. */ + bool m_ggc; + +private: + typedef int_hash map_hash; + + /* Getter for summary callgraph ID. */ + T* get (int uid) + { + bool existed; + T **v = &m_map.get_or_insert (uid, &existed); + if (!existed) + *v = allocate_new (); + + return *v; + } + + /* Indicates if insertion hook is enabled. */ + bool m_insertion_enabled; + /* Indicates if the summary is released. */ + bool m_released; + /* Main summary store, where summary ID is used as key. */ + hash_map m_map; + /* Internal summary insertion hook pointer. */ + cgraph_node_hook_list *m_symtab_insertion_hook; + /* Internal summary removal hook pointer. */ + cgraph_node_hook_list *m_symtab_removal_hook; + /* Internal summary duplication hook pointer. */ + cgraph_2node_hook_list *m_symtab_duplication_hook; + /* Symbol table the summary is registered to. */ + symbol_table *m_symtab; + + template friend void gt_ggc_mx (function_summary * const &); + template friend void gt_pch_nx (function_summary * const &); + template friend void gt_pch_nx (function_summary * const &, + gt_pointer_operator, void *); +}; + +template +void +gt_ggc_mx(function_summary* const &summary) +{ + gcc_checking_assert (summary->m_ggc); + gt_ggc_mx (&summary->m_map); +} + +template +void +gt_pch_nx(function_summary* const &summary) +{ + gcc_checking_assert (summary->m_ggc); + gt_pch_nx (&summary->m_map); +} + +template +void +gt_pch_nx(function_summary* const& summary, gt_pointer_operator op, + void *cookie) +{ + gcc_checking_assert (summary->m_ggc); + gt_pch_nx (&summary->m_map, op, cookie); +} + +#endif /* GCC_SYMBOL_SUMMARY_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/symtab.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/symtab.h new file mode 100644 index 0000000..cf0c33f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/symtab.h @@ -0,0 +1,103 @@ +/* Hash tables. + Copyright (C) 2000-2017 Free Software Foundation, Inc. + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; see the file COPYING3. If not see +. */ + +#ifndef LIBCPP_SYMTAB_H +#define LIBCPP_SYMTAB_H + +#include "obstack.h" + +#ifndef GTY +#define GTY(x) /* nothing */ +#endif + +/* This is what each hash table entry points to. It may be embedded + deeply within another object. */ +typedef struct ht_identifier ht_identifier; +typedef struct ht_identifier *ht_identifier_ptr; +struct GTY(()) ht_identifier { + const unsigned char *str; + unsigned int len; + unsigned int hash_value; +}; + +#define HT_LEN(NODE) ((NODE)->len) +#define HT_STR(NODE) ((NODE)->str) + +typedef struct ht cpp_hash_table; +typedef struct ht_identifier *hashnode; + +enum ht_lookup_option {HT_NO_INSERT = 0, HT_ALLOC}; + +/* An identifier hash table for cpplib and the front ends. */ +struct ht +{ + /* Identifiers are allocated from here. */ + struct obstack stack; + + hashnode *entries; + /* Call back, allocate a node. */ + hashnode (*alloc_node) (cpp_hash_table *); + /* Call back, allocate something that hangs off a node like a cpp_macro. + NULL means use the usual allocator. */ + void * (*alloc_subobject) (size_t); + + unsigned int nslots; /* Total slots in the entries array. */ + unsigned int nelements; /* Number of live elements. */ + + /* Link to reader, if any. For the benefit of cpplib. */ + struct cpp_reader *pfile; + + /* Table usage statistics. */ + unsigned int searches; + unsigned int collisions; + + /* Should 'entries' be freed when it is no longer needed? */ + bool entries_owned; +}; + +/* Initialize the hashtable with 2 ^ order entries. */ +extern cpp_hash_table *ht_create (unsigned int order); + +/* Frees all memory associated with a hash table. */ +extern void ht_destroy (cpp_hash_table *); + +extern hashnode ht_lookup (cpp_hash_table *, const unsigned char *, + size_t, enum ht_lookup_option); +extern hashnode ht_lookup_with_hash (cpp_hash_table *, const unsigned char *, + size_t, unsigned int, + enum ht_lookup_option); +#define HT_HASHSTEP(r, c) ((r) * 67 + ((c) - 113)); +#define HT_HASHFINISH(r, len) ((r) + (len)) + +/* For all nodes in TABLE, make a callback. The callback takes + TABLE->PFILE, the node, and a PTR, and the callback sequence stops + if the callback returns zero. */ +typedef int (*ht_cb) (struct cpp_reader *, hashnode, const void *); +extern void ht_forall (cpp_hash_table *, ht_cb, const void *); + +/* For all nodes in TABLE, call the callback. If the callback returns + a nonzero value, the node is removed from the table. */ +extern void ht_purge (cpp_hash_table *, ht_cb, const void *); + +/* Restore the hash table. */ +extern void ht_load (cpp_hash_table *ht, hashnode *entries, + unsigned int nslots, unsigned int nelements, bool own); + +/* Dump allocation statistics to stderr. */ +extern void ht_dump_statistics (cpp_hash_table *); + +#endif /* LIBCPP_SYMTAB_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/system.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/system.h new file mode 100644 index 0000000..0cbf60a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/system.h @@ -0,0 +1,1172 @@ +/* Get common system includes and various definitions and declarations based + on autoconf macros. + Copyright (C) 1998-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + + +#ifndef GCC_SYSTEM_H +#define GCC_SYSTEM_H + +/* Define this so that inttypes.h defines the PRI?64 macros even + when compiling with a C++ compiler. Define it here so in the + event inttypes.h gets pulled in by another header it is already + defined. */ +#define __STDC_FORMAT_MACROS + +/* We must include stdarg.h before stdio.h. */ +#include + +#ifndef va_copy +# ifdef __va_copy +# define va_copy(d,s) __va_copy (d, s) +# else +# define va_copy(d,s) ((d) = (s)) +# endif +#endif + +#ifdef HAVE_STDDEF_H +# include +#endif + +#include + +/* Define a generic NULL if one hasn't already been defined. */ +#ifndef NULL +#define NULL 0 +#endif + +/* Use the unlocked open routines from libiberty. */ + +/* Some of these are #define on some systems, e.g. on AIX to redirect + the names to 64bit capable functions for LARGE_FILES support. These + redefs are pointless here so we can override them. */ + +#undef fopen +#undef freopen + +#define fopen(PATH, MODE) fopen_unlocked (PATH, MODE) +#define fdopen(FILDES, MODE) fdopen_unlocked (FILDES, MODE) +#define freopen(PATH, MODE, STREAM) freopen_unlocked (PATH, MODE, STREAM) + +/* The compiler is not a multi-threaded application and therefore we + do not have to use the locking functions. In fact, using the locking + functions can cause the compiler to be significantly slower under + I/O bound conditions (such as -g -O0 on very large source files). + + HAVE_DECL_PUTC_UNLOCKED actually indicates whether or not the stdio + code is multi-thread safe by default. If it is set to 0, then do + not worry about using the _unlocked functions. + + fputs_unlocked, fwrite_unlocked, and fprintf_unlocked are + extensions and need to be prototyped by hand (since we do not + define _GNU_SOURCE). */ + +#if defined HAVE_DECL_PUTC_UNLOCKED && HAVE_DECL_PUTC_UNLOCKED + +# ifdef HAVE_PUTC_UNLOCKED +# undef putc +# define putc(C, Stream) putc_unlocked (C, Stream) +# endif +# ifdef HAVE_PUTCHAR_UNLOCKED +# undef putchar +# define putchar(C) putchar_unlocked (C) +# endif +# ifdef HAVE_GETC_UNLOCKED +# undef getc +# define getc(Stream) getc_unlocked (Stream) +# endif +# ifdef HAVE_GETCHAR_UNLOCKED +# undef getchar +# define getchar() getchar_unlocked () +# endif +# ifdef HAVE_FPUTC_UNLOCKED +# undef fputc +# define fputc(C, Stream) fputc_unlocked (C, Stream) +# endif + +#ifdef __cplusplus +extern "C" { +#endif + +# ifdef HAVE_CLEARERR_UNLOCKED +# undef clearerr +# define clearerr(Stream) clearerr_unlocked (Stream) +# if defined (HAVE_DECL_CLEARERR_UNLOCKED) && !HAVE_DECL_CLEARERR_UNLOCKED +extern void clearerr_unlocked (FILE *); +# endif +# endif +# ifdef HAVE_FEOF_UNLOCKED +# undef feof +# define feof(Stream) feof_unlocked (Stream) +# if defined (HAVE_DECL_FEOF_UNLOCKED) && !HAVE_DECL_FEOF_UNLOCKED +extern int feof_unlocked (FILE *); +# endif +# endif +# ifdef HAVE_FILENO_UNLOCKED +# undef fileno +# define fileno(Stream) fileno_unlocked (Stream) +# if defined (HAVE_DECL_FILENO_UNLOCKED) && !HAVE_DECL_FILENO_UNLOCKED +extern int fileno_unlocked (FILE *); +# endif +# endif +# ifdef HAVE_FFLUSH_UNLOCKED +# undef fflush +# define fflush(Stream) fflush_unlocked (Stream) +# if defined (HAVE_DECL_FFLUSH_UNLOCKED) && !HAVE_DECL_FFLUSH_UNLOCKED +extern int fflush_unlocked (FILE *); +# endif +# endif +# ifdef HAVE_FGETC_UNLOCKED +# undef fgetc +# define fgetc(Stream) fgetc_unlocked (Stream) +# if defined (HAVE_DECL_FGETC_UNLOCKED) && !HAVE_DECL_FGETC_UNLOCKED +extern int fgetc_unlocked (FILE *); +# endif +# endif +# ifdef HAVE_FGETS_UNLOCKED +# undef fgets +# define fgets(S, n, Stream) fgets_unlocked (S, n, Stream) +# if defined (HAVE_DECL_FGETS_UNLOCKED) && !HAVE_DECL_FGETS_UNLOCKED +extern char *fgets_unlocked (char *, int, FILE *); +# endif +# endif +# ifdef HAVE_FPUTS_UNLOCKED +# undef fputs +# define fputs(String, Stream) fputs_unlocked (String, Stream) +# if defined (HAVE_DECL_FPUTS_UNLOCKED) && !HAVE_DECL_FPUTS_UNLOCKED +extern int fputs_unlocked (const char *, FILE *); +# endif +# endif +# ifdef HAVE_FERROR_UNLOCKED +# undef ferror +# define ferror(Stream) ferror_unlocked (Stream) +# if defined (HAVE_DECL_FERROR_UNLOCKED) && !HAVE_DECL_FERROR_UNLOCKED +extern int ferror_unlocked (FILE *); +# endif +# endif +# ifdef HAVE_FREAD_UNLOCKED +# undef fread +# define fread(Ptr, Size, N, Stream) fread_unlocked (Ptr, Size, N, Stream) +# if defined (HAVE_DECL_FREAD_UNLOCKED) && !HAVE_DECL_FREAD_UNLOCKED +extern size_t fread_unlocked (void *, size_t, size_t, FILE *); +# endif +# endif +# ifdef HAVE_FWRITE_UNLOCKED +# undef fwrite +# define fwrite(Ptr, Size, N, Stream) fwrite_unlocked (Ptr, Size, N, Stream) +# if defined (HAVE_DECL_FWRITE_UNLOCKED) && !HAVE_DECL_FWRITE_UNLOCKED +extern size_t fwrite_unlocked (const void *, size_t, size_t, FILE *); +# endif +# endif +# ifdef HAVE_FPRINTF_UNLOCKED +# undef fprintf +/* We can't use a function-like macro here because we don't know if + we have varargs macros. */ +# define fprintf fprintf_unlocked +# if defined (HAVE_DECL_FPRINTF_UNLOCKED) && !HAVE_DECL_FPRINTF_UNLOCKED +extern int fprintf_unlocked (FILE *, const char *, ...); +# endif +# endif + +#ifdef __cplusplus +} +#endif + +#endif + +/* ??? Glibc's fwrite/fread_unlocked macros cause + "warning: signed and unsigned type in conditional expression". */ +#undef fread_unlocked +#undef fwrite_unlocked + +/* Include before "safe-ctype.h" to avoid GCC poisoning + the ctype macros through safe-ctype.h */ + +#ifdef __cplusplus +#ifdef INCLUDE_STRING +# include +#endif +#endif + +/* There are an extraordinary number of issues with . + The last straw is that it varies with the locale. Use libiberty's + replacement instead. */ +#include "safe-ctype.h" + +#include + +#include + +#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO +extern int errno; +#endif + +#ifdef __cplusplus +#if defined (INCLUDE_ALGORITHM) || !defined (HAVE_SWAP_IN_UTILITY) +# include +#endif +#ifdef INCLUDE_LIST +# include +#endif +#ifdef INCLUDE_MAP +# include +#endif +#ifdef INCLUDE_SET +# include +#endif +#ifdef INCLUDE_VECTOR +# include +#endif +# include +# include +# include +#endif + +/* Some of glibc's string inlines cause warnings. Plus we'd rather + rely on (and therefore test) GCC's string builtins. */ +#define __NO_STRING_INLINES + +#ifdef STRING_WITH_STRINGS +# include +# include +#else +# ifdef HAVE_STRING_H +# include +# else +# ifdef HAVE_STRINGS_H +# include +# endif +# endif +#endif + +#ifdef HAVE_STDLIB_H +# include +#endif + +/* When compiling C++ we need to include as well as so + that it is processed before we poison "malloc"; otherwise, if a source + file uses a standard library header that includes , we will get + an error about 'using std::malloc'. */ +#ifdef __cplusplus +#include +#endif + +/* Undef vec_free from AIX stdlib.h header which conflicts with vec.h. */ +#undef vec_free + +/* If we don't have an overriding definition, set SUCCESS_EXIT_CODE and + FATAL_EXIT_CODE to EXIT_SUCCESS and EXIT_FAILURE respectively, + or 0 and 1 if those macros are not defined. */ +#ifndef SUCCESS_EXIT_CODE +# ifdef EXIT_SUCCESS +# define SUCCESS_EXIT_CODE EXIT_SUCCESS +# else +# define SUCCESS_EXIT_CODE 0 +# endif +#endif + +#ifndef FATAL_EXIT_CODE +# ifdef EXIT_FAILURE +# define FATAL_EXIT_CODE EXIT_FAILURE +# else +# define FATAL_EXIT_CODE 1 +# endif +#endif + +#define ICE_EXIT_CODE 4 + +#ifdef HAVE_UNISTD_H +# include +#endif + +#ifdef HAVE_SYS_PARAM_H +# include +/* We use these identifiers later and they appear in some vendor param.h's. */ +# undef PREFETCH +# undef m_slot +#endif + +#if HAVE_LIMITS_H +# include +#endif + +/* A macro to determine whether a VALUE lies inclusively within a + certain range without evaluating the VALUE more than once. This + macro won't warn if the VALUE is unsigned and the LOWER bound is + zero, as it would e.g. with "VALUE >= 0 && ...". Note the LOWER + bound *is* evaluated twice, and LOWER must not be greater than + UPPER. However the bounds themselves can be either positive or + negative. */ +#define IN_RANGE(VALUE, LOWER, UPPER) \ + ((unsigned HOST_WIDE_INT) (VALUE) - (unsigned HOST_WIDE_INT) (LOWER) \ + <= (unsigned HOST_WIDE_INT) (UPPER) - (unsigned HOST_WIDE_INT) (LOWER)) + +/* Infrastructure for defining missing _MAX and _MIN macros. Note that + macros defined with these cannot be used in #if. */ + +/* The extra casts work around common compiler bugs. */ +#define INTTYPE_SIGNED(t) (! ((t) 0 < (t) -1)) +/* The outer cast is needed to work around a bug in Cray C 5.0.3.0. + It is necessary at least when t == time_t. */ +#define INTTYPE_MINIMUM(t) ((t) (INTTYPE_SIGNED (t) \ + ? (t) 1 << (sizeof (t) * CHAR_BIT - 1) : (t) 0)) +#define INTTYPE_MAXIMUM(t) ((t) (~ (t) 0 - INTTYPE_MINIMUM (t))) + +/* Use that infrastructure to provide a few constants. */ +#ifndef UCHAR_MAX +# define UCHAR_MAX INTTYPE_MAXIMUM (unsigned char) +#endif + +#ifdef TIME_WITH_SYS_TIME +# include +# include +#else +# if HAVE_SYS_TIME_H +# include +# else +# ifdef HAVE_TIME_H +# include +# endif +# endif +#endif + +#ifdef HAVE_FCNTL_H +# include +#else +# ifdef HAVE_SYS_FILE_H +# include +# endif +#endif + +#ifndef SEEK_SET +# define SEEK_SET 0 +# define SEEK_CUR 1 +# define SEEK_END 2 +#endif +#ifndef F_OK +# define F_OK 0 +# define X_OK 1 +# define W_OK 2 +# define R_OK 4 +#endif +#ifndef O_RDONLY +# define O_RDONLY 0 +#endif +#ifndef O_WRONLY +# define O_WRONLY 1 +#endif +#ifndef O_BINARY +# define O_BINARY 0 +#endif + +/* Some systems define these in, e.g., param.h. We undefine these names + here to avoid the warnings. We prefer to use our definitions since we + know they are correct. */ + +#undef MIN +#undef MAX +#define MIN(X,Y) ((X) < (Y) ? (X) : (Y)) +#define MAX(X,Y) ((X) > (Y) ? (X) : (Y)) + +/* Returns the least number N such that N * Y >= X. */ +#define CEIL(x,y) (((x) + (y) - 1) / (y)) + +/* This macro rounds x up to the y boundary. */ +#define ROUND_UP(x,y) (((x) + (y) - 1) & ~((y) - 1)) + +/* This macro rounds x down to the y boundary. */ +#define ROUND_DOWN(x,y) ((x) & ~((y) - 1)) + +#ifdef HAVE_SYS_WAIT_H +#include +#endif + +#ifndef WIFSIGNALED +#define WIFSIGNALED(S) (((S) & 0xff) != 0 && ((S) & 0xff) != 0x7f) +#endif +#ifndef WTERMSIG +#define WTERMSIG(S) ((S) & 0x7f) +#endif +#ifndef WIFEXITED +#define WIFEXITED(S) (((S) & 0xff) == 0) +#endif +#ifndef WEXITSTATUS +#define WEXITSTATUS(S) (((S) & 0xff00) >> 8) +#endif +#ifndef WSTOPSIG +#define WSTOPSIG WEXITSTATUS +#endif +#ifndef WCOREDUMP +#define WCOREDUMP(S) ((S) & WCOREFLG) +#endif +#ifndef WCOREFLG +#define WCOREFLG 0200 +#endif + +#include +#if !defined (SIGCHLD) && defined (SIGCLD) +# define SIGCHLD SIGCLD +#endif + +#ifdef HAVE_SYS_MMAN_H +# include +#endif + +#ifndef MAP_FAILED +# define MAP_FAILED ((void *)-1) +#endif + +#if !defined (MAP_ANONYMOUS) && defined (MAP_ANON) +# define MAP_ANONYMOUS MAP_ANON +#endif + +#ifdef HAVE_SYS_RESOURCE_H +# include +#endif + +#ifdef HAVE_SYS_TIMES_H +# include +#endif + +/* The HAVE_DECL_* macros are three-state, undefined, 0 or 1. If they + are defined to 0 then we must provide the relevant declaration + here. These checks will be in the undefined state while configure + is running so be careful to test "defined (HAVE_DECL_*)". */ + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined (HAVE_DECL_ATOF) && !HAVE_DECL_ATOF +extern double atof (const char *); +#endif + +#if defined (HAVE_DECL_ATOL) && !HAVE_DECL_ATOL +extern long atol (const char *); +#endif + +#if defined (HAVE_DECL_FREE) && !HAVE_DECL_FREE +extern void free (void *); +#endif + +#if defined (HAVE_DECL_GETCWD) && !HAVE_DECL_GETCWD +extern char *getcwd (char *, size_t); +#endif + +#if defined (HAVE_DECL_GETENV) && !HAVE_DECL_GETENV +extern char *getenv (const char *); +#endif + +#if defined (HAVE_DECL_GETOPT) && !HAVE_DECL_GETOPT +extern int getopt (int, char * const *, const char *); +#endif + +#if defined (HAVE_DECL_GETPAGESIZE) && !HAVE_DECL_GETPAGESIZE +extern int getpagesize (void); +#endif + +#if defined (HAVE_DECL_GETWD) && !HAVE_DECL_GETWD +extern char *getwd (char *); +#endif + +#if defined (HAVE_DECL_SBRK) && !HAVE_DECL_SBRK +extern void *sbrk (int); +#endif + +#if defined (HAVE_DECL_SETENV) && !HAVE_DECL_SETENV +int setenv(const char *, const char *, int); +#endif + +#if defined (HAVE_DECL_STRSTR) && !HAVE_DECL_STRSTR +extern char *strstr (const char *, const char *); +#endif + +#if defined (HAVE_DECL_STPCPY) && !HAVE_DECL_STPCPY +extern char *stpcpy (char *, const char *); +#endif + +#if defined (HAVE_DECL_UNSETENV) && !HAVE_DECL_UNSETENV +int unsetenv(const char *); +#endif + +#if defined (HAVE_DECL_MALLOC) && !HAVE_DECL_MALLOC +extern void *malloc (size_t); +#endif + +#if defined (HAVE_DECL_CALLOC) && !HAVE_DECL_CALLOC +extern void *calloc (size_t, size_t); +#endif + +#if defined (HAVE_DECL_REALLOC) && !HAVE_DECL_REALLOC +extern void *realloc (void *, size_t); +#endif + +#ifdef __cplusplus +} +#endif + +#ifdef HAVE_STDINT_H +#include +#endif + +#ifdef HAVE_INTTYPES_H +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* If the system doesn't provide strsignal, we get it defined in + libiberty but no declaration is supplied. */ +#if !defined (HAVE_STRSIGNAL) \ + || (defined (HAVE_DECL_STRSIGNAL) && !HAVE_DECL_STRSIGNAL) +# ifndef strsignal +extern const char *strsignal (int); +# endif +#endif + +#ifdef HAVE_GETRLIMIT +# if defined (HAVE_DECL_GETRLIMIT) && !HAVE_DECL_GETRLIMIT +# ifndef getrlimit +struct rlimit; +extern int getrlimit (int, struct rlimit *); +# endif +# endif +#endif + +#ifdef HAVE_SETRLIMIT +# if defined (HAVE_DECL_SETRLIMIT) && !HAVE_DECL_SETRLIMIT +# ifndef setrlimit +struct rlimit; +extern int setrlimit (int, const struct rlimit *); +# endif +# endif +#endif + +#if defined (HAVE_DECL_ABORT) && !HAVE_DECL_ABORT +extern void abort (void); +#endif + +#if defined (HAVE_DECL_SNPRINTF) && !HAVE_DECL_SNPRINTF +extern int snprintf (char *, size_t, const char *, ...); +#endif + +#if defined (HAVE_DECL_VSNPRINTF) && !HAVE_DECL_VSNPRINTF +extern int vsnprintf (char *, size_t, const char *, va_list); +#endif + +#ifdef __cplusplus +} +#endif + +/* 1 if we have C99 designated initializers. */ +#if !defined(HAVE_DESIGNATED_INITIALIZERS) +#ifdef __cplusplus +#define HAVE_DESIGNATED_INITIALIZERS 0 +#else +#define HAVE_DESIGNATED_INITIALIZERS \ + ((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L)) +#endif +#endif + +#if !defined(HAVE_DESIGNATED_UNION_INITIALIZERS) +#ifdef __cplusplus +#define HAVE_DESIGNATED_UNION_INITIALIZERS (GCC_VERSION >= 4007) +#else +#define HAVE_DESIGNATED_UNION_INITIALIZERS \ + ((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L)) +#endif +#endif + +#if HAVE_SYS_STAT_H +# include +#endif + +/* Test if something is a normal file. */ +#ifndef S_ISREG +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +#endif + +/* Test if something is a directory. */ +#ifndef S_ISDIR +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#endif + +/* Test if something is a character special file. */ +#ifndef S_ISCHR +#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +#endif + +/* Test if something is a block special file. */ +#ifndef S_ISBLK +#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +#endif + +/* Test if something is a socket. */ +#ifndef S_ISSOCK +# ifdef S_IFSOCK +# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) +# else +# define S_ISSOCK(m) 0 +# endif +#endif + +/* Test if something is a FIFO. */ +#ifndef S_ISFIFO +# ifdef S_IFIFO +# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +# else +# define S_ISFIFO(m) 0 +# endif +#endif + +/* Define well known filenos if the system does not define them. */ +#ifndef STDIN_FILENO +# define STDIN_FILENO 0 +#endif +#ifndef STDOUT_FILENO +# define STDOUT_FILENO 1 +#endif +#ifndef STDERR_FILENO +# define STDERR_FILENO 2 +#endif + +/* Some systems have mkdir that takes a single argument. */ +#ifdef MKDIR_TAKES_ONE_ARG +# define mkdir(a,b) mkdir (a) +#endif + +#ifndef HAVE_KILL +# define kill(p,s) raise (s) +#endif + +/* Provide a way to print an address via printf. */ +#ifndef HOST_PTR_PRINTF +#define HOST_PTR_PRINTF "%p" +#endif /* ! HOST_PTR_PRINTF */ + +/* By default, colon separates directories in a path. */ +#ifndef PATH_SEPARATOR +#define PATH_SEPARATOR ':' +#endif + +/* Filename handling macros. */ +#include "filenames.h" + +/* These should be phased out in favor of IS_DIR_SEPARATOR, where possible. */ +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# ifdef HAVE_DOS_BASED_FILE_SYSTEM +# define DIR_SEPARATOR_2 '\\' +# endif +#endif + +#if defined (ENABLE_PLUGIN) && defined (HAVE_DLFCN_H) +/* If plugin support is enabled, we could use libdl. */ +#include +#endif + +/* Do not introduce a gmp.h dependency on the build system. */ +#ifndef GENERATOR_FILE +#include +#endif + +/* Get libiberty declarations. */ +#include "libiberty.h" + +#undef FFS /* Some systems predefine this symbol; don't let it interfere. */ +#undef FLOAT /* Likewise. */ +#undef ABS /* Likewise. */ +#undef PC /* Likewise. */ + +/* Provide a default for the HOST_BIT_BUCKET. + This suffices for POSIX-like hosts. */ + +#ifndef HOST_BIT_BUCKET +#define HOST_BIT_BUCKET "/dev/null" +#endif + +#ifndef offsetof +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER) +#endif + +/* Various error reporting routines want to use __FUNCTION__. */ +#if (GCC_VERSION < 2007) +#ifndef __FUNCTION__ +#define __FUNCTION__ "?" +#endif /* ! __FUNCTION__ */ +#endif + +/* __builtin_expect(A, B) evaluates to A, but notifies the compiler that + the most likely value of A is B. This feature was added at some point + between 2.95 and 3.0. Let's use 3.0 as the lower bound for now. */ +#if (GCC_VERSION < 3000) +#define __builtin_expect(a, b) (a) +#endif + +/* Redefine abort to report an internal error w/o coredump, and + reporting the location of the error in the source file. */ +extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; +#define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__) + +/* Use gcc_assert(EXPR) to test invariants. */ +#if ENABLE_ASSERT_CHECKING +#define gcc_assert(EXPR) \ + ((void)(!(EXPR) ? fancy_abort (__FILE__, __LINE__, __FUNCTION__), 0 : 0)) +#elif (GCC_VERSION >= 4005) +#define gcc_assert(EXPR) \ + ((void)(__builtin_expect (!(EXPR), 0) ? __builtin_unreachable (), 0 : 0)) +#else +/* Include EXPR, so that unused variable warnings do not occur. */ +#define gcc_assert(EXPR) ((void)(0 && (EXPR))) +#endif + +#if CHECKING_P +#define gcc_checking_assert(EXPR) gcc_assert (EXPR) +#else +/* N.B.: in release build EXPR is not evaluated. */ +#define gcc_checking_assert(EXPR) ((void)(0 && (EXPR))) +#endif + +/* Use gcc_unreachable() to mark unreachable locations (like an + unreachable default case of a switch. Do not use gcc_assert(0). */ +#if (GCC_VERSION >= 4005) && !ENABLE_ASSERT_CHECKING +#define gcc_unreachable() __builtin_unreachable () +#else +#define gcc_unreachable() (fancy_abort (__FILE__, __LINE__, __FUNCTION__)) +#endif + +#if GCC_VERSION >= 7000 && defined(__has_attribute) +# if __has_attribute(fallthrough) +# define gcc_fallthrough() __attribute__((fallthrough)) +# else +# define gcc_fallthrough() +# endif +#else +# define gcc_fallthrough() +#endif + +#if GCC_VERSION >= 3001 +#define STATIC_CONSTANT_P(X) (__builtin_constant_p (X) && (X)) +#else +#define STATIC_CONSTANT_P(X) (false && (X)) +#endif + +/* static_assert (COND, MESSAGE) is available in C++11 onwards. */ +#if __cplusplus >= 201103L +#define STATIC_ASSERT(X) \ + static_assert ((X), #X) +#else +#define STATIC_ASSERT(X) \ + typedef int assertion1[(X) ? 1 : -1] ATTRIBUTE_UNUSED +#endif + +/* Provide a fake boolean type. We make no attempt to use the + C99 _Bool, as it may not be available in the bootstrap compiler, + and even if it is, it is liable to be buggy. + This must be after all inclusion of system headers, as some of + them will mess us up. */ + +#undef TRUE +#undef FALSE + +#ifdef __cplusplus + /* Obsolete. */ +# define TRUE true +# define FALSE false +#else /* !__cplusplus */ +# undef bool +# undef true +# undef false + +# define bool unsigned char +# define true 1 +# define false 0 + + /* Obsolete. */ +# define TRUE true +# define FALSE false +#endif /* !__cplusplus */ + +/* Some compilers do not allow the use of unsigned char in bitfields. */ +#define BOOL_BITFIELD unsigned int + +/* As the last action in this file, we poison the identifiers that + shouldn't be used. Note, luckily gcc-3.0's token-based integrated + preprocessor won't trip on poisoned identifiers that arrive from + the expansion of macros. E.g. #define strrchr rindex, won't error + if rindex is poisoned after this directive is issued and later on + strrchr is called. + + Note: We define bypass macros for the few cases where we really + want to use the libc memory allocation routines. Otherwise we + insist you use the "x" versions from libiberty. */ + +#define really_call_malloc malloc +#define really_call_calloc calloc +#define really_call_realloc realloc + +#if defined(FLEX_SCANNER) || defined(YYBISON) || defined(YYBYACC) +/* Flex and bison use malloc and realloc. Yuk. Note that this means + really_call_* cannot be used in a .l or .y file. */ +#define malloc xmalloc +#define realloc xrealloc +#endif + +#if (GCC_VERSION >= 3000) + +/* Note autoconf checks for prototype declarations and includes + system.h while doing so. Only poison these tokens if actually + compiling gcc, so that the autoconf declaration tests for malloc + etc don't spuriously fail. */ +#ifdef IN_GCC + +#ifndef USES_ISL +#undef calloc +#undef strdup +#undef strndup + #pragma GCC poison calloc strdup strndup +#endif + +#if !defined(FLEX_SCANNER) && !defined(YYBISON) +#undef malloc +#undef realloc + #pragma GCC poison malloc realloc +#endif + +/* The %m format should be used when GCC's main diagnostic functions + supporting %m are available, and xstrerror from libiberty + otherwise. */ +#undef strerror + #pragma GCC poison strerror + +/* loc_t is defined on some systems and too inviting for some + programmers to avoid. */ +#undef loc_t + #pragma GCC poison loc_t + +/* Old target macros that have moved to the target hooks structure. */ + #pragma GCC poison ASM_OPEN_PAREN ASM_CLOSE_PAREN \ + FUNCTION_PROLOGUE FUNCTION_EPILOGUE \ + FUNCTION_END_PROLOGUE FUNCTION_BEGIN_EPILOGUE \ + DECL_MACHINE_ATTRIBUTES COMP_TYPE_ATTRIBUTES INSERT_ATTRIBUTES \ + VALID_MACHINE_DECL_ATTRIBUTE VALID_MACHINE_TYPE_ATTRIBUTE \ + SET_DEFAULT_TYPE_ATTRIBUTES SET_DEFAULT_DECL_ATTRIBUTES \ + MERGE_MACHINE_TYPE_ATTRIBUTES MERGE_MACHINE_DECL_ATTRIBUTES \ + MD_INIT_BUILTINS MD_EXPAND_BUILTIN ASM_OUTPUT_CONSTRUCTOR \ + ASM_OUTPUT_DESTRUCTOR SIGNED_CHAR_SPEC MAX_CHAR_TYPE_SIZE \ + WCHAR_UNSIGNED UNIQUE_SECTION SELECT_SECTION SELECT_RTX_SECTION \ + ENCODE_SECTION_INFO STRIP_NAME_ENCODING ASM_GLOBALIZE_LABEL \ + ASM_OUTPUT_MI_THUNK CONST_COSTS RTX_COSTS DEFAULT_RTX_COSTS \ + ADDRESS_COST MACHINE_DEPENDENT_REORG ASM_FILE_START ASM_FILE_END \ + ASM_SIMPLIFY_DWARF_ADDR INIT_TARGET_OPTABS INIT_SUBTARGET_OPTABS \ + INIT_GOFAST_OPTABS MULSI3_LIBCALL MULDI3_LIBCALL DIVSI3_LIBCALL \ + DIVDI3_LIBCALL UDIVSI3_LIBCALL UDIVDI3_LIBCALL MODSI3_LIBCALL \ + MODDI3_LIBCALL UMODSI3_LIBCALL UMODDI3_LIBCALL BUILD_VA_LIST_TYPE \ + PRETEND_OUTGOING_VARARGS_NAMED STRUCT_VALUE_INCOMING_REGNUM \ + ASM_OUTPUT_SECTION_NAME PROMOTE_FUNCTION_ARGS PROMOTE_FUNCTION_MODE \ + STRUCT_VALUE_INCOMING STRICT_ARGUMENT_NAMING \ + PROMOTE_FUNCTION_RETURN PROMOTE_PROTOTYPES STRUCT_VALUE_REGNUM \ + SETUP_INCOMING_VARARGS EXPAND_BUILTIN_SAVEREGS \ + DEFAULT_SHORT_ENUMS SPLIT_COMPLEX_ARGS MD_ASM_CLOBBERS \ + HANDLE_PRAGMA_REDEFINE_EXTNAME HANDLE_PRAGMA_EXTERN_PREFIX \ + MUST_PASS_IN_STACK FUNCTION_ARG_PASS_BY_REFERENCE \ + VECTOR_MODE_SUPPORTED_P TARGET_SUPPORTS_HIDDEN \ + FUNCTION_ARG_PARTIAL_NREGS ASM_OUTPUT_DWARF_DTPREL \ + ALLOCATE_INITIAL_VALUE LEGITIMIZE_ADDRESS FRAME_POINTER_REQUIRED \ + CAN_ELIMINATE TRAMPOLINE_TEMPLATE INITIALIZE_TRAMPOLINE \ + TRAMPOLINE_ADJUST_ADDRESS STATIC_CHAIN STATIC_CHAIN_INCOMING \ + RETURN_POPS_ARGS UNITS_PER_SIMD_WORD OVERRIDE_OPTIONS \ + OPTIMIZATION_OPTIONS CLASS_LIKELY_SPILLED_P \ + USING_SJLJ_EXCEPTIONS TARGET_UNWIND_INFO \ + LABEL_ALIGN_MAX_SKIP LOOP_ALIGN_MAX_SKIP \ + LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP JUMP_ALIGN_MAX_SKIP \ + CAN_DEBUG_WITHOUT_FP UNLIKELY_EXECUTED_TEXT_SECTION_NAME \ + HOT_TEXT_SECTION_NAME LEGITIMATE_CONSTANT_P ALWAYS_STRIP_DOTDOT \ + OUTPUT_ADDR_CONST_EXTRA SMALL_REGISTER_CLASSES ASM_OUTPUT_IDENT \ + ASM_BYTE_OP MEMBER_TYPE_FORCES_BLK LIBGCC2_HAS_SF_MODE \ + LIBGCC2_HAS_DF_MODE LIBGCC2_HAS_XF_MODE LIBGCC2_HAS_TF_MODE \ + CLEAR_BY_PIECES_P MOVE_BY_PIECES_P SET_BY_PIECES_P \ + STORE_BY_PIECES_P TARGET_FLT_EVAL_METHOD + +/* Target macros only used for code built for the target, that have + moved to libgcc-tm.h or have never been present elsewhere. */ + #pragma GCC poison DECLARE_LIBRARY_RENAMES LIBGCC2_GNU_PREFIX \ + MD_UNWIND_SUPPORT MD_FROB_UPDATE_CONTEXT ENABLE_EXECUTE_STACK \ + REG_VALUE_IN_UNWIND_CONTEXT ASSUME_EXTENDED_UNWIND_CONTEXT + +/* Other obsolete target macros, or macros that used to be in target + headers and were not used, and may be obsolete or may never have + been used. */ + #pragma GCC poison INT_ASM_OP ASM_OUTPUT_EH_REGION_BEG CPP_PREDEFINES \ + ASM_OUTPUT_EH_REGION_END ASM_OUTPUT_LABELREF_AS_INT SMALL_STACK \ + DOESNT_NEED_UNWINDER EH_TABLE_LOOKUP OBJC_SELECTORS_WITHOUT_LABELS \ + OMIT_EH_TABLE EASY_DIV_EXPR IMPLICIT_FIX_EXPR \ + LONGJMP_RESTORE_FROM_STACK MAX_INT_TYPE_SIZE ASM_IDENTIFY_GCC \ + STDC_VALUE TRAMPOLINE_ALIGN ASM_IDENTIFY_GCC_AFTER_SOURCE \ + SLOW_ZERO_EXTEND SUBREG_REGNO_OFFSET DWARF_LINE_MIN_INSTR_LENGTH \ + TRADITIONAL_RETURN_FLOAT NO_BUILTIN_SIZE_TYPE \ + NO_BUILTIN_PTRDIFF_TYPE NO_BUILTIN_WCHAR_TYPE NO_BUILTIN_WINT_TYPE \ + BLOCK_PROFILER BLOCK_PROFILER_CODE FUNCTION_BLOCK_PROFILER \ + FUNCTION_BLOCK_PROFILER_EXIT MACHINE_STATE_SAVE \ + MACHINE_STATE_RESTORE SCCS_DIRECTIVE SECTION_ASM_OP BYTEORDER \ + ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL HOST_WORDS_BIG_ENDIAN \ + OBJC_PROLOGUE ALLOCATE_TRAMPOLINE HANDLE_PRAGMA ROUND_TYPE_SIZE \ + ROUND_TYPE_SIZE_UNIT CONST_SECTION_ASM_OP CRT_GET_RFIB_TEXT \ + DBX_LBRAC_FIRST DBX_OUTPUT_ENUM DBX_OUTPUT_SOURCE_FILENAME \ + DBX_WORKING_DIRECTORY INSN_CACHE_DEPTH INSN_CACHE_SIZE \ + INSN_CACHE_LINE_WIDTH INIT_SECTION_PREAMBLE NEED_ATEXIT ON_EXIT \ + EXIT_BODY OBJECT_FORMAT_ROSE MULTIBYTE_CHARS MAP_CHARACTER \ + LIBGCC_NEEDS_DOUBLE FINAL_PRESCAN_LABEL DEFAULT_CALLER_SAVES \ + LOAD_ARGS_REVERSED MAX_INTEGER_COMPUTATION_MODE \ + CONVERT_HARD_REGISTER_TO_SSA_P ASM_OUTPUT_MAIN_SOURCE_FILENAME \ + FIRST_INSN_ADDRESS TEXT_SECTION SHARED_BSS_SECTION_ASM_OP \ + PROMOTED_MODE EXPAND_BUILTIN_VA_END \ + LINKER_DOES_NOT_WORK_WITH_DWARF2 FUNCTION_ARG_KEEP_AS_REFERENCE \ + GIV_SORT_CRITERION MAX_LONG_TYPE_SIZE MAX_LONG_DOUBLE_TYPE_SIZE \ + MAX_WCHAR_TYPE_SIZE SHARED_SECTION_ASM_OP INTEGRATE_THRESHOLD \ + FINAL_REG_PARM_STACK_SPACE MAYBE_REG_PARM_STACK_SPACE \ + TRADITIONAL_PIPELINE_INTERFACE DFA_PIPELINE_INTERFACE \ + DBX_OUTPUT_STANDARD_TYPES BUILTIN_SETJMP_FRAME_VALUE \ + SUNOS4_SHARED_LIBRARIES PROMOTE_FOR_CALL_ONLY \ + SPACE_AFTER_L_OPTION NO_RECURSIVE_FUNCTION_CSE \ + DEFAULT_MAIN_RETURN TARGET_MEM_FUNCTIONS EXPAND_BUILTIN_VA_ARG \ + COLLECT_PARSE_FLAG DWARF2_GENERATE_TEXT_SECTION_LABEL WINNING_GDB \ + ASM_OUTPUT_FILENAME ASM_OUTPUT_SOURCE_LINE FILE_NAME_JOINER \ + GDB_INV_REF_REGPARM_STABS_LETTER DBX_MEMPARM_STABS_LETTER \ + PUT_SDB_SRC_FILE STABS_GCC_MARKER DBX_OUTPUT_FUNCTION_END \ + DBX_OUTPUT_GCC_MARKER DBX_FINISH_SYMBOL SDB_GENERATE_FAKE \ + NON_SAVING_SETJMP TARGET_LATE_RTL_PROLOGUE_EPILOGUE \ + CASE_DROPS_THROUGH TARGET_BELL TARGET_BS TARGET_CR TARGET_DIGIT0 \ + TARGET_ESC TARGET_FF TARGET_NEWLINE TARGET_TAB TARGET_VT \ + LINK_LIBGCC_SPECIAL DONT_ACCESS_GBLS_AFTER_EPILOGUE \ + TARGET_OPTIONS TARGET_SWITCHES EXTRA_CC_MODES FINALIZE_PIC \ + PREDICATE_CODES SPECIAL_MODE_PREDICATES UNALIGNED_WORD_ASM_OP \ + EXTRA_SECTIONS EXTRA_SECTION_FUNCTIONS READONLY_DATA_SECTION \ + TARGET_ASM_EXCEPTION_SECTION TARGET_ASM_EH_FRAME_SECTION \ + SMALL_ARG_MAX ASM_OUTPUT_SHARED_BSS ASM_OUTPUT_SHARED_COMMON \ + ASM_OUTPUT_SHARED_LOCAL ASM_MAKE_LABEL_LINKONCE \ + STACK_CHECK_PROBE_INTERVAL STACK_CHECK_PROBE_LOAD \ + ORDER_REGS_FOR_LOCAL_ALLOC FUNCTION_OUTGOING_VALUE \ + ASM_DECLARE_CONSTANT_NAME MODIFY_TARGET_NAME SWITCHES_NEED_SPACES \ + SWITCH_CURTAILS_COMPILATION SWITCH_TAKES_ARG WORD_SWITCH_TAKES_ARG \ + TARGET_OPTION_TRANSLATE_TABLE HANDLE_PRAGMA_PACK_PUSH_POP \ + HANDLE_SYSV_PRAGMA HANDLE_PRAGMA_WEAK CONDITIONAL_REGISTER_USAGE \ + FUNCTION_ARG_BOUNDARY MUST_USE_SJLJ_EXCEPTIONS US_SOFTWARE_GOFAST \ + USING_SVR4_H SVR4_ASM_SPEC FUNCTION_ARG FUNCTION_ARG_ADVANCE \ + FUNCTION_INCOMING_ARG IRA_COVER_CLASSES TARGET_VERSION \ + MACHINE_TYPE TARGET_HAS_TARGETCM ASM_OUTPUT_BSS \ + SETJMP_VIA_SAVE_AREA FORBIDDEN_INC_DEC_CLASSES \ + PREFERRED_OUTPUT_RELOAD_CLASS SYSTEM_INCLUDE_DIR \ + STANDARD_INCLUDE_DIR STANDARD_INCLUDE_COMPONENT \ + LINK_ELIMINATE_DUPLICATE_LDIRECTORIES MIPS_DEBUGGING_INFO \ + IDENT_ASM_OP ALL_COP_ADDITIONAL_REGISTER_NAMES DBX_OUTPUT_LBRAC \ + DBX_OUTPUT_NFUN DBX_OUTPUT_RBRAC RANGE_TEST_NON_SHORT_CIRCUIT \ + REAL_VALUE_TRUNCATE REVERSE_CONDEXEC_PREDICATES_P \ + TARGET_ALIGN_ANON_BITFIELDS TARGET_NARROW_VOLATILE_BITFIELDS \ + IDENT_ASM_OP UNALIGNED_SHORT_ASM_OP UNALIGNED_INT_ASM_OP \ + UNALIGNED_LONG_ASM_OP UNALIGNED_DOUBLE_INT_ASM_OP \ + USE_COMMON_FOR_ONE_ONLY IFCVT_EXTRA_FIELDS IFCVT_INIT_EXTRA_FIELDS \ + CASE_USE_BIT_TESTS FIXUNS_TRUNC_LIKE_FIX_TRUNC \ + GO_IF_MODE_DEPENDENT_ADDRESS DELAY_SLOTS_FOR_EPILOGUE \ + ELIGIBLE_FOR_EPILOGUE_DELAY TARGET_C99_FUNCTIONS TARGET_HAS_SINCOS \ + REG_CLASS_FROM_LETTER CONST_OK_FOR_LETTER_P \ + CONST_DOUBLE_OK_FOR_LETTER_P EXTRA_CONSTRAINT \ + REG_CLASS_FROM_CONSTRAINT REG_CLASS_FOR_CONSTRAINT \ + EXTRA_CONSTRAINT_STR EXTRA_MEMORY_CONSTRAINT \ + EXTRA_ADDRESS_CONSTRAINT CONST_DOUBLE_OK_FOR_CONSTRAINT_P \ + CALLER_SAVE_PROFITABLE LARGEST_EXPONENT_IS_NORMAL \ + ROUND_TOWARDS_ZERO SF_SIZE DF_SIZE XF_SIZE TF_SIZE LIBGCC2_TF_CEXT \ + LIBGCC2_LONG_DOUBLE_TYPE_SIZE STRUCT_VALUE \ + EH_FRAME_IN_DATA_SECTION TARGET_FLT_EVAL_METHOD_NON_DEFAULT \ + JCR_SECTION_NAME TARGET_USE_JCR_SECTION + +/* Hooks that are no longer used. */ + #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE \ + LANG_HOOKS_MARK_TREE LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES \ + LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS \ + LANG_HOOKS_PUSHLEVEL LANG_HOOKS_SET_BLOCK \ + LANG_HOOKS_MAYBE_BUILD_CLEANUP LANG_HOOKS_UPDATE_DECL_AFTER_SAVING \ + LANG_HOOKS_POPLEVEL LANG_HOOKS_TRUTHVALUE_CONVERSION \ + TARGET_PROMOTE_FUNCTION_ARGS TARGET_PROMOTE_FUNCTION_RETURN \ + LANG_HOOKS_MISSING_ARGUMENT LANG_HOOKS_HASH_TYPES \ + TARGET_HANDLE_OFAST TARGET_OPTION_OPTIMIZATION \ + TARGET_IRA_COVER_CLASSES TARGET_HELP \ + TARGET_HANDLE_PRAGMA_EXTERN_PREFIX \ + TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN \ + TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD \ + TARGET_MD_ASM_CLOBBERS TARGET_RELAXED_ORDERING \ + EXTENDED_SDB_BASIC_TYPES TARGET_INVALID_PARAMETER_TYPE \ + TARGET_INVALID_RETURN_TYPE + +/* Arrays that were deleted in favor of a functional interface. */ + #pragma GCC poison built_in_decls implicit_built_in_decls + +/* Hooks into libgcc2. */ + #pragma GCC poison LIBGCC2_DOUBLE_TYPE_SIZE LIBGCC2_WORDS_BIG_ENDIAN \ + LIBGCC2_FLOAT_WORDS_BIG_ENDIAN + +/* Miscellaneous macros that are no longer used. */ + #pragma GCC poison USE_MAPPED_LOCATION GET_ENVIRONMENT + +/* Libiberty macros that are no longer used in GCC. */ +#undef ANSI_PROTOTYPES +#undef PTR_CONST +#undef LONG_DOUBLE +#undef VPARAMS +#undef VA_OPEN +#undef VA_FIXEDARG +#undef VA_CLOSE +#undef VA_START + #pragma GCC poison ANSI_PROTOTYPES PTR_CONST LONG_DOUBLE VPARAMS VA_OPEN \ + VA_FIXEDARG VA_CLOSE VA_START +#endif /* IN_GCC */ + +/* Front ends should never have to include middle-end headers. Enforce + this by poisoning the header double-include protection defines. */ +#ifdef IN_GCC_FRONTEND +#pragma GCC poison GCC_RTL_H GCC_EXCEPT_H GCC_EXPR_H +#endif + +/* Note: not all uses of the `index' token (e.g. variable names and + structure members) have been eliminated. */ +#undef bcopy +#undef bzero +#undef bcmp +#undef rindex + #pragma GCC poison bcopy bzero bcmp rindex + +/* Poison ENABLE_CHECKING macro that should be replaced with + 'if (flag_checking)', or with CHECKING_P macro. */ +#pragma GCC poison ENABLE_CHECKING + +#endif /* GCC >= 3.0 */ + +/* This macro allows casting away const-ness to pass -Wcast-qual + warnings. DO NOT USE THIS UNLESS YOU REALLY HAVE TO! It should + only be used in certain specific cases. One valid case is where + the C standard definitions or prototypes force you to. E.g. if you + need to free a const object, or if you pass a const string to + execv, et al. Another valid use would be in an allocation function + that creates const objects that need to be initialized. In some + cases we have non-const functions that return the argument + (e.g. next_nonnote_insn). Rather than create const shadow + functions, we can cast away const-ness in calling these interfaces + if we're careful to verify that the called function does indeed not + modify its argument and the return value is only used in a const + context. (This can be somewhat dangerous as these assumptions can + change after the fact). Beyond these uses, most other cases of + using this macro should be viewed with extreme caution. */ + +#ifdef __cplusplus +#define CONST_CAST2(TOTYPE,FROMTYPE,X) (const_cast (X)) +#else +#if defined(__GNUC__) && GCC_VERSION > 4000 +/* GCC 4.0.x has a bug where it may ICE on this expression, + so does GCC 3.4.x (PR17436). */ +#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq) +#elif defined(__GNUC__) +static inline char * +helper_const_non_const_cast (const char *p) +{ + union { + const char *const_c; + char *c; + } val; + val.const_c = p; + return val.c; +} + +#define CONST_CAST2(TOTYPE,FROMTYPE,X) \ + ((TOTYPE) helper_const_non_const_cast ((const char *) (FROMTYPE) (X))) +#else +#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((TOTYPE)(FROMTYPE)(X)) +#endif +#endif +#define CONST_CAST(TYPE,X) CONST_CAST2 (TYPE, const TYPE, (X)) +#define CONST_CAST_TREE(X) CONST_CAST (union tree_node *, (X)) +#define CONST_CAST_RTX(X) CONST_CAST (struct rtx_def *, (X)) +#define CONST_CAST_RTX_INSN(X) CONST_CAST (struct rtx_insn *, (X)) +#define CONST_CAST_BB(X) CONST_CAST (struct basic_block_def *, (X)) +#define CONST_CAST_GIMPLE(X) CONST_CAST (gimple *, (X)) + +/* Activate certain diagnostics as warnings (not errors via the + -Werror flag). */ +#if GCC_VERSION >= 4003 +/* If asserts are disabled, activate -Wuninitialized as a warning (not + an error/-Werror). */ +#ifndef ENABLE_ASSERT_CHECKING +#pragma GCC diagnostic warning "-Wuninitialized" +#endif +#endif + +#ifdef ENABLE_VALGRIND_ANNOTATIONS +# ifdef HAVE_VALGRIND_MEMCHECK_H +# include +# elif defined HAVE_MEMCHECK_H +# include +# else +# include +# endif +/* Compatibility macros to let valgrind 3.1 work. */ +# ifndef VALGRIND_MAKE_MEM_NOACCESS +# define VALGRIND_MAKE_MEM_NOACCESS VALGRIND_MAKE_NOACCESS +# endif +# ifndef VALGRIND_MAKE_MEM_DEFINED +# define VALGRIND_MAKE_MEM_DEFINED VALGRIND_MAKE_READABLE +# endif +# ifndef VALGRIND_MAKE_MEM_UNDEFINED +# define VALGRIND_MAKE_MEM_UNDEFINED VALGRIND_MAKE_WRITABLE +# endif +#else +/* Avoid #ifdef:s when we can help it. */ +#define VALGRIND_DISCARD(x) +#define VALGRIND_MALLOCLIKE_BLOCK(w,x,y,z) +#define VALGRIND_FREELIKE_BLOCK(x,y) +#endif + +/* Macros to temporarily ignore some warnings. */ +#if GCC_VERSION >= 6000 +#define GCC_DIAGNOSTIC_STRINGIFY(x) #x +#define GCC_DIAGNOSTIC_PUSH_IGNORED(x) \ + _Pragma ("GCC diagnostic push") \ + _Pragma (GCC_DIAGNOSTIC_STRINGIFY (GCC diagnostic ignored #x)) +#define GCC_DIAGNOSTIC_POP _Pragma ("GCC diagnostic pop") +#else +#define GCC_DIAGNOSTIC_PUSH_IGNORED(x) +#define GCC_DIAGNOSTIC_POP +#endif + +/* In LTO -fwhole-program build we still want to keep the debug functions available + for debugger. Mark them as used to prevent removal. */ +#if (GCC_VERSION > 4000) +#define DEBUG_FUNCTION __attribute__ ((__used__)) +#define DEBUG_VARIABLE __attribute__ ((__used__)) +#else +#define DEBUG_FUNCTION +#define DEBUG_VARIABLE +#endif + +/* General macro to extract bit Y of X. */ +#define TEST_BIT(X, Y) (((X) >> (Y)) & 1) + +/* Get definitions of HOST_WIDE_INT. */ +#include "hwint.h" + +#endif /* ! GCC_SYSTEM_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/target-def.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/target-def.h new file mode 100644 index 0000000..c99bfaa --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/target-def.h @@ -0,0 +1,110 @@ +/* Default initializers for a generic GCC target. + Copyright (C) 2001-2017 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING3. If not see + . + + In other words, you are welcome to use, share and improve this program. + You are forbidden to forbid anyone else to use, share and improve + what you give them. Help stamp out software-hoarding! */ + +/* See target.def for a description of what this file contains and how to + use it. + + We want to have non-NULL default definitions of all hook functions, + even if they do nothing. */ + +/* Note that if one of these macros must be defined in an OS .h file + rather than the .c file, then we need to wrap the default + definition in a #ifndef, since files include tm.h before this one. */ + +#define TARGET_ASM_ALIGNED_HI_OP "\t.short\t" +#define TARGET_ASM_ALIGNED_SI_OP "\t.long\t" +#define TARGET_ASM_ALIGNED_DI_OP NULL +#define TARGET_ASM_ALIGNED_TI_OP NULL + +/* GAS and SYSV4 assemblers accept these. */ +#if defined (OBJECT_FORMAT_ELF) +#define TARGET_ASM_UNALIGNED_HI_OP "\t.2byte\t" +#define TARGET_ASM_UNALIGNED_SI_OP "\t.4byte\t" +#define TARGET_ASM_UNALIGNED_DI_OP "\t.8byte\t" +#define TARGET_ASM_UNALIGNED_TI_OP NULL +#else +#define TARGET_ASM_UNALIGNED_HI_OP NULL +#define TARGET_ASM_UNALIGNED_SI_OP NULL +#define TARGET_ASM_UNALIGNED_DI_OP NULL +#define TARGET_ASM_UNALIGNED_TI_OP NULL +#endif /* OBJECT_FORMAT_ELF */ + +#if !defined(TARGET_ASM_CONSTRUCTOR) && !defined(USE_COLLECT2) +# ifdef CTORS_SECTION_ASM_OP +# define TARGET_ASM_CONSTRUCTOR default_ctor_section_asm_out_constructor +# else +# ifdef TARGET_ASM_NAMED_SECTION +# define TARGET_ASM_CONSTRUCTOR default_named_section_asm_out_constructor +# else +# define TARGET_ASM_CONSTRUCTOR default_stabs_asm_out_constructor +# endif +# endif +#endif + +#if !defined(TARGET_ASM_DESTRUCTOR) && !defined(USE_COLLECT2) +# ifdef DTORS_SECTION_ASM_OP +# define TARGET_ASM_DESTRUCTOR default_dtor_section_asm_out_destructor +# else +# ifdef TARGET_ASM_NAMED_SECTION +# define TARGET_ASM_DESTRUCTOR default_named_section_asm_out_destructor +# else +# define TARGET_ASM_DESTRUCTOR default_stabs_asm_out_destructor +# endif +# endif +#endif + +#if !defined(TARGET_HAVE_CTORS_DTORS) +# if defined(TARGET_ASM_CONSTRUCTOR) && defined(TARGET_ASM_DESTRUCTOR) +# define TARGET_HAVE_CTORS_DTORS true +# endif +#endif + +#ifndef TARGET_TERMINATE_DW2_EH_FRAME_INFO +#ifdef EH_FRAME_SECTION_NAME +#define TARGET_TERMINATE_DW2_EH_FRAME_INFO false +#endif +#endif + +#if !defined(TARGET_ASM_OUTPUT_ANCHOR) && !defined(ASM_OUTPUT_DEF) +#define TARGET_ASM_OUTPUT_ANCHOR NULL +#endif + +#define TARGET_ASM_ALIGNED_INT_OP \ + {TARGET_ASM_ALIGNED_HI_OP, \ + TARGET_ASM_ALIGNED_SI_OP, \ + TARGET_ASM_ALIGNED_DI_OP, \ + TARGET_ASM_ALIGNED_TI_OP} + +#define TARGET_ASM_UNALIGNED_INT_OP \ + {TARGET_ASM_UNALIGNED_HI_OP, \ + TARGET_ASM_UNALIGNED_SI_OP, \ + TARGET_ASM_UNALIGNED_DI_OP, \ + TARGET_ASM_UNALIGNED_TI_OP} + +#if !defined (TARGET_FUNCTION_INCOMING_ARG) +#define TARGET_FUNCTION_INCOMING_ARG TARGET_FUNCTION_ARG +#endif + +#include "target-hooks-def.h" + +#include "hooks.h" +#include "targhooks.h" +#include "insn-target-def.h" diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/target-globals.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/target-globals.h new file mode 100644 index 0000000..6762c97 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/target-globals.h @@ -0,0 +1,91 @@ +/* Target-dependent globals. + Copyright (C) 2010-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef TARGET_GLOBALS_H +#define TARGET_GLOBALS_H 1 + +#if SWITCHABLE_TARGET +extern struct target_flag_state *this_target_flag_state; +extern struct target_regs *this_target_regs; +extern struct target_rtl *this_target_rtl; +extern struct target_recog *this_target_recog; +extern struct target_hard_regs *this_target_hard_regs; +extern struct target_reload *this_target_reload; +extern struct target_expmed *this_target_expmed; +extern struct target_optabs *this_target_optabs; +extern struct target_libfuncs *this_target_libfuncs; +extern struct target_cfgloop *this_target_cfgloop; +extern struct target_ira *this_target_ira; +extern struct target_ira_int *this_target_ira_int; +extern struct target_builtins *this_target_builtins; +extern struct target_gcse *this_target_gcse; +extern struct target_bb_reorder *this_target_bb_reorder; +extern struct target_lower_subreg *this_target_lower_subreg; +#endif + +struct GTY(()) target_globals { + ~target_globals (); + + struct target_flag_state *GTY((skip)) flag_state; + struct target_regs *GTY((skip)) regs; + struct target_rtl *rtl; + struct target_recog *GTY((skip)) recog; + struct target_hard_regs *GTY((skip)) hard_regs; + struct target_reload *GTY((skip)) reload; + struct target_expmed *GTY((skip)) expmed; + struct target_optabs *GTY((skip)) optabs; + struct target_libfuncs *libfuncs; + struct target_cfgloop *GTY((skip)) cfgloop; + struct target_ira *GTY((skip)) ira; + struct target_ira_int *GTY((skip)) ira_int; + struct target_builtins *GTY((skip)) builtins; + struct target_gcse *GTY((skip)) gcse; + struct target_bb_reorder *GTY((skip)) bb_reorder; + struct target_lower_subreg *GTY((skip)) lower_subreg; +}; + +#if SWITCHABLE_TARGET +extern struct target_globals default_target_globals; + +extern struct target_globals *save_target_globals (void); +extern struct target_globals *save_target_globals_default_opts (void); + +static inline void +restore_target_globals (struct target_globals *g) +{ + this_target_flag_state = g->flag_state; + this_target_regs = g->regs; + this_target_rtl = g->rtl; + this_target_recog = g->recog; + this_target_hard_regs = g->hard_regs; + this_target_reload = g->reload; + this_target_expmed = g->expmed; + this_target_optabs = g->optabs; + this_target_libfuncs = g->libfuncs; + this_target_cfgloop = g->cfgloop; + this_target_ira = g->ira; + this_target_ira_int = g->ira_int; + this_target_builtins = g->builtins; + this_target_gcse = g->gcse; + this_target_bb_reorder = g->bb_reorder; + this_target_lower_subreg = g->lower_subreg; +} +#endif + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/target-hooks-macros.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/target-hooks-macros.h new file mode 100644 index 0000000..8e3e2af --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/target-hooks-macros.h @@ -0,0 +1,80 @@ +/* Common macros for target hook definitions. + Copyright (C) 2001-2017 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING3. If not see + . */ + +/* The following macros should be provided by the including file: + + DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT): Define a function-valued hook. + DEFHOOKPOD(NAME, DOC, TYPE, INIT): Define a piece-of-data 'hook'. */ + +/* Defaults for optional macros: + DEFHOOKPODX(NAME, TYPE, INIT): Like DEFHOOKPOD, but share documentation + with the previous 'hook'. */ +#ifndef DEFHOOKPODX +#define DEFHOOKPODX(NAME, TYPE, INIT) DEFHOOKPOD (NAME, 0, TYPE, INIT) +#endif + +/* HOOKSTRUCT(FRAGMENT): Declarator fragments to encapsulate all the + members into a struct gcc_target, which in turn contains several + sub-structs. */ +#ifndef HOOKSTRUCT +#define HOOKSTRUCT(FRAGMENT) +#endif +/* HOOK_VECTOR: Start a struct declaration, which then gets its own initializer. + HOOK_VECTOR_END: Close a struct declaration, providing a member declarator + name for nested use. */ +#ifndef HOOK_VECTOR_1 +#define HOOK_VECTOR_1(NAME, FRAGMENT) HOOKSTRUCT (FRAGMENT) +#endif +#define HOOK_VECTOR(INIT_NAME, SNAME) HOOK_VECTOR_1 (INIT_NAME, struct SNAME {) +#define HOOK_VECTOR_END(DECL_NAME) HOOK_VECTOR_1(,} DECL_NAME ;) + +/* FIXME: For pre-existing hooks, we can't place the documentation in the + documentation field here till we get permission from the FSF to include + it in GPLed software - the target hook documentation is so far only + available under the GFDL. */ + +/* A hook should generally be documented by a string in the DOC parameter, + which should contain texinfo markup. If the documentation is only available + under the GPL, but not under the GFDL, put it in a comment above the hook + definition. If the function declaration is available both under GPL and + GFDL, but the documentation is only available under the GFDL, put the + documentaton in tm.texi.in, heading with @hook and closing + the paragraph with @end deftypefn / deftypevr as appropriate, and marking + the next autogenerated hook with @hook . + In both these cases, leave the DOC string empty, i.e. "". + Sometimes, for some historic reason the function declaration + has to be documented differently + than what it is. In that case, use DEFHOOK_UNDOC to suppress auto-generation + of documentation. DEFHOOK_UNDOC takes a DOC string which it ignores, so + you can put GPLed documentation string there if you have hopes that you + can clear the declaration & documentation for GFDL distribution later, + in which case you can then simply change the DEFHOOK_UNDOC to DEFHOOK + to turn on the autogeneration of the documentation. + + A documentation string of "*" means not to emit any documentation at all, + and is mainly used internally for DEFHOOK_UNDOC. It should generally not + be used otherwise, but it has its use for exceptional cases where automatic + documentation is not wanted, and the real documentation is elsewere, like + for TARGET_ASM_{,UN}ALIGNED_INT_OP, which are hooks only for implementation + purposes; they refer to structs, the components of which are documented as + separate hooks TARGET_ASM_{,UN}ALIGNED_[HSDT]I_OP. + A DOC string of 0 is for internal use of DEFHOOKPODX and special table + entries only. */ + +/* Empty macro arguments are undefined in C90, so use an empty macro + to close top-level hook structures. */ +#define C90_EMPTY_HACK diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/target.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/target.h new file mode 100644 index 0000000..393de40 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/target.h @@ -0,0 +1,232 @@ +/* Data structure definitions for a generic GCC target. + Copyright (C) 2001-2017 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING3. If not see + . + + In other words, you are welcome to use, share and improve this program. + You are forbidden to forbid anyone else to use, share and improve + what you give them. Help stamp out software-hoarding! */ + + +/* This file contains a data structure that describes a GCC target. + At present it is incomplete, but in future it should grow to + contain most or all target machine and target O/S specific + information. + + This structure has its initializer declared in target-def.h in the + form of large macro TARGET_INITIALIZER that expands to many smaller + macros. + + The smaller macros each initialize one component of the structure, + and each has a default. Each target should have a file that + includes target.h and target-def.h, and overrides any inappropriate + defaults by undefining the relevant macro and defining a suitable + replacement. That file should then contain the definition of + "targetm" like so: + + struct gcc_target targetm = TARGET_INITIALIZER; + + Doing things this way allows us to bring together everything that + defines a GCC target. By supplying a default that is appropriate + to most targets, we can easily add new items without needing to + edit dozens of target configuration files. It should also allow us + to gradually reduce the amount of conditional compilation that is + scattered throughout GCC. */ + +#ifndef GCC_TARGET_H +#define GCC_TARGET_H + +#include "insn-codes.h" +#include "tm.h" +#include "hard-reg-set.h" + +#if CHECKING_P + +struct cumulative_args_t { void *magic; void *p; }; + +#else /* !CHECKING_P */ + +/* When using a GCC build compiler, we could use + __attribute__((transparent_union)) to get cumulative_args_t function + arguments passed like scalars where the ABI would mandate a less + efficient way of argument passing otherwise. However, that would come + at the cost of less type-safe !CHECKING_P compilation. */ + +union cumulative_args_t { void *p; }; + +#endif /* !CHECKING_P */ + +/* Types used by the record_gcc_switches() target function. */ +enum print_switch_type +{ + SWITCH_TYPE_PASSED, /* A switch passed on the command line. */ + SWITCH_TYPE_ENABLED, /* An option that is currently enabled. */ + SWITCH_TYPE_DESCRIPTIVE, /* Descriptive text, not a switch or option. */ + SWITCH_TYPE_LINE_START, /* Please emit any necessary text at the start of a line. */ + SWITCH_TYPE_LINE_END /* Please emit a line terminator. */ +}; + +/* Types of memory operation understood by the "by_pieces" infrastructure. + Used by the TARGET_USE_BY_PIECES_INFRASTRUCTURE_P target hook and + internally by the functions in expr.c. */ + +enum by_pieces_operation +{ + CLEAR_BY_PIECES, + MOVE_BY_PIECES, + SET_BY_PIECES, + STORE_BY_PIECES, + COMPARE_BY_PIECES +}; + +extern unsigned HOST_WIDE_INT by_pieces_ninsns (unsigned HOST_WIDE_INT, + unsigned int, + unsigned int, + by_pieces_operation); + +typedef int (* print_switch_fn_type) (print_switch_type, const char *); + +/* An example implementation for ELF targets. Defined in varasm.c */ +extern int elf_record_gcc_switches (print_switch_type type, const char *); + +/* Some places still assume that all pointer or address modes are the + standard Pmode and ptr_mode. These optimizations become invalid if + the target actually supports multiple different modes. For now, + we disable such optimizations on such targets, using this function. */ +extern bool target_default_pointer_address_modes_p (void); + +/* For hooks which use the MOVE_RATIO macro, this gives the legacy default + behavior. */ +extern unsigned int get_move_ratio (bool); + +struct stdarg_info; +struct spec_info_def; +struct hard_reg_set_container; +struct cgraph_node; +struct cgraph_simd_clone; + +/* The struct used by the secondary_reload target hook. */ +struct secondary_reload_info +{ + /* icode is actually an enum insn_code, but we don't want to force every + file that includes target.h to include optabs.h . */ + int icode; + int extra_cost; /* Cost for using (a) scratch register(s) to be taken + into account by copy_cost. */ + /* The next two members are for the use of the backward + compatibility hook. */ + struct secondary_reload_info *prev_sri; + int t_icode; /* Actually an enum insn_code - see above. */ +}; + +/* This is defined in sched-int.h . */ +struct _dep; + +/* This is defined in ddg.h . */ +struct ddg; + +/* This is defined in cfgloop.h . */ +struct loop; + +/* This is defined in ifcvt.h. */ +struct noce_if_info; + +/* This is defined in tree-ssa-alias.h. */ +struct ao_ref; + +/* This is defined in tree-vectorizer.h. */ +struct _stmt_vec_info; + +/* These are defined in tree-vect-stmts.c. */ +extern tree stmt_vectype (struct _stmt_vec_info *); +extern bool stmt_in_inner_loop_p (struct _stmt_vec_info *); + +/* Assembler instructions for creating various kinds of integer object. */ + +struct asm_int_op +{ + const char *hi; + const char *si; + const char *di; + const char *ti; +}; + +/* Types of costs for vectorizer cost model. */ +enum vect_cost_for_stmt +{ + scalar_stmt, + scalar_load, + scalar_store, + vector_stmt, + vector_load, + unaligned_load, + unaligned_store, + vector_store, + vec_to_scalar, + scalar_to_vec, + cond_branch_not_taken, + cond_branch_taken, + vec_perm, + vec_promote_demote, + vec_construct +}; + +/* Separate locations for which the vectorizer cost model should + track costs. */ +enum vect_cost_model_location { + vect_prologue = 0, + vect_body = 1, + vect_epilogue = 2 +}; + +/* The target structure. This holds all the backend hooks. */ +#define DEFHOOKPOD(NAME, DOC, TYPE, INIT) TYPE NAME; +#define DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT) TYPE (* NAME) PARAMS; +#define DEFHOOK_UNDOC DEFHOOK +#define HOOKSTRUCT(FRAGMENT) FRAGMENT + +#include "target.def" + +extern struct gcc_target targetm; + +#ifdef GCC_TM_H + +#ifndef CUMULATIVE_ARGS_MAGIC +#define CUMULATIVE_ARGS_MAGIC ((void *) &targetm.calls) +#endif + +static inline CUMULATIVE_ARGS * +get_cumulative_args (cumulative_args_t arg) +{ +#if CHECKING_P + gcc_assert (arg.magic == CUMULATIVE_ARGS_MAGIC); +#endif /* CHECKING_P */ + return (CUMULATIVE_ARGS *) arg.p; +} + +static inline cumulative_args_t +pack_cumulative_args (CUMULATIVE_ARGS *arg) +{ + cumulative_args_t ret; + +#if CHECKING_P + ret.magic = CUMULATIVE_ARGS_MAGIC; +#endif /* CHECKING_P */ + ret.p = (void *) arg; + return ret; +} +#endif /* GCC_TM_H */ + +#endif /* GCC_TARGET_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/targhooks.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/targhooks.h new file mode 100644 index 0000000..18070df --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/targhooks.h @@ -0,0 +1,267 @@ +/* Default target hook functions. + Copyright (C) 2003-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TARGHOOKS_H +#define GCC_TARGHOOKS_H + +extern bool default_legitimate_address_p (machine_mode, rtx, bool); + +extern void default_external_libcall (rtx); +extern rtx default_legitimize_address (rtx, rtx, machine_mode); +extern bool default_legitimize_address_displacement (rtx *, rtx *, + machine_mode); + +extern int default_unspec_may_trap_p (const_rtx, unsigned); +extern machine_mode default_promote_function_mode (const_tree, machine_mode, + int *, const_tree, int); +extern machine_mode default_promote_function_mode_always_promote + (const_tree, machine_mode, int *, const_tree, int); + +extern machine_mode default_cc_modes_compatible (machine_mode, + machine_mode); + +extern bool default_return_in_memory (const_tree, const_tree); + +extern rtx default_expand_builtin_saveregs (void); +extern void default_setup_incoming_varargs (cumulative_args_t, machine_mode, tree, int *, int); +extern rtx default_builtin_setjmp_frame_value (void); +extern bool default_pretend_outgoing_varargs_named (cumulative_args_t); + +extern machine_mode default_eh_return_filter_mode (void); +extern machine_mode default_libgcc_cmp_return_mode (void); +extern machine_mode default_libgcc_shift_count_mode (void); +extern machine_mode default_unwind_word_mode (void); +extern unsigned HOST_WIDE_INT default_shift_truncation_mask + (machine_mode); +extern unsigned int default_min_divisions_for_recip_mul (machine_mode); +extern int default_mode_rep_extended (machine_mode, machine_mode); + +extern tree default_stack_protect_guard (void); +extern tree default_external_stack_protect_fail (void); +extern tree default_hidden_stack_protect_fail (void); + +extern machine_mode default_mode_for_suffix (char); + +extern tree default_cxx_guard_type (void); +extern tree default_cxx_get_cookie_size (tree); + +extern bool hook_pass_by_reference_must_pass_in_stack + (cumulative_args_t, machine_mode mode, const_tree, bool); +extern bool hook_callee_copies_named + (cumulative_args_t ca, machine_mode, const_tree, bool); + +extern void default_print_operand (FILE *, rtx, int); +extern void default_print_operand_address (FILE *, machine_mode, rtx); +extern bool default_print_operand_punct_valid_p (unsigned char); +extern tree default_mangle_assembler_name (const char *); + +extern bool default_scalar_mode_supported_p (machine_mode); +extern bool default_libgcc_floating_mode_supported_p (machine_mode); +extern machine_mode default_floatn_mode (int, bool); +extern bool targhook_words_big_endian (void); +extern bool targhook_float_words_big_endian (void); +extern bool default_float_exceptions_rounding_supported_p (void); +extern bool default_decimal_float_supported_p (void); +extern bool default_fixed_point_supported_p (void); + +extern bool default_has_ifunc_p (void); + +extern const char * default_invalid_within_doloop (const rtx_insn *); + +extern tree default_builtin_vectorized_function (unsigned int, tree, tree); +extern tree default_builtin_md_vectorized_function (tree, tree, tree); + +extern tree default_builtin_vectorized_conversion (unsigned int, tree, tree); + +extern int default_builtin_vectorization_cost (enum vect_cost_for_stmt, tree, int); + +extern tree default_builtin_reciprocal (tree); + +extern HOST_WIDE_INT default_vector_alignment (const_tree); + +extern bool default_builtin_vector_alignment_reachable (const_tree, bool); +extern bool +default_builtin_support_vector_misalignment (machine_mode mode, + const_tree, + int, bool); +extern machine_mode default_preferred_simd_mode (machine_mode mode); +extern unsigned int default_autovectorize_vector_sizes (void); +extern machine_mode default_get_mask_mode (unsigned, unsigned); +extern void *default_init_cost (struct loop *); +extern unsigned default_add_stmt_cost (void *, int, enum vect_cost_for_stmt, + struct _stmt_vec_info *, int, + enum vect_cost_model_location); +extern void default_finish_cost (void *, unsigned *, unsigned *, unsigned *); +extern void default_destroy_cost_data (void *); + +/* OpenACC hooks. */ +extern bool default_goacc_validate_dims (tree, int [], int); +extern int default_goacc_dim_limit (int); +extern bool default_goacc_fork_join (gcall *, const int [], bool); +extern void default_goacc_reduction (gcall *); + +/* These are here, and not in hooks.[ch], because not all users of + hooks.h include tm.h, and thus we don't have CUMULATIVE_ARGS. */ + +extern bool hook_bool_CUMULATIVE_ARGS_false (cumulative_args_t); +extern bool hook_bool_CUMULATIVE_ARGS_true (cumulative_args_t); + +extern bool hook_bool_CUMULATIVE_ARGS_mode_tree_bool_false + (cumulative_args_t, machine_mode, const_tree, bool); +extern bool hook_bool_CUMULATIVE_ARGS_mode_tree_bool_true + (cumulative_args_t, machine_mode, const_tree, bool); +extern int hook_int_CUMULATIVE_ARGS_mode_tree_bool_0 + (cumulative_args_t, machine_mode, tree, bool); +extern const char *hook_invalid_arg_for_unprototyped_fn + (const_tree, const_tree, const_tree); +extern void default_function_arg_advance + (cumulative_args_t, machine_mode, const_tree, bool); +extern rtx default_function_arg + (cumulative_args_t, machine_mode, const_tree, bool); +extern rtx default_function_incoming_arg + (cumulative_args_t, machine_mode, const_tree, bool); +extern unsigned int default_function_arg_boundary (machine_mode, + const_tree); +extern unsigned int default_function_arg_round_boundary (machine_mode, + const_tree); +extern bool hook_bool_const_rtx_commutative_p (const_rtx, int); +extern rtx default_function_value (const_tree, const_tree, bool); +extern rtx default_libcall_value (machine_mode, const_rtx); +extern bool default_function_value_regno_p (const unsigned int); +extern rtx default_internal_arg_pointer (void); +extern rtx default_static_chain (const_tree, bool); +extern void default_trampoline_init (rtx, tree, rtx); +extern int default_return_pops_args (tree, tree, int); +extern reg_class_t default_branch_target_register_class (void); +extern reg_class_t default_ira_change_pseudo_allocno_class (int, reg_class_t, + reg_class_t); +extern bool default_lra_p (void); +extern int default_register_priority (int); +extern bool default_register_usage_leveling_p (void); +extern bool default_different_addr_displacement_p (void); +extern reg_class_t default_secondary_reload (bool, rtx, reg_class_t, + machine_mode, + secondary_reload_info *); +extern void default_target_option_override (void); +extern void hook_void_bitmap (bitmap); +extern int default_reloc_rw_mask (void); +extern tree default_mangle_decl_assembler_name (tree, tree); +extern tree default_emutls_var_fields (tree, tree *); +extern tree default_emutls_var_init (tree, tree, tree); +extern bool default_hard_regno_scratch_ok (unsigned int); +extern bool default_mode_dependent_address_p (const_rtx, addr_space_t); +extern bool default_target_option_valid_attribute_p (tree, tree, tree, int); +extern bool default_target_option_pragma_parse (tree, tree); +extern bool default_target_can_inline_p (tree, tree); +extern bool default_valid_pointer_mode (machine_mode); +extern bool default_ref_may_alias_errno (struct ao_ref *); +extern machine_mode default_addr_space_pointer_mode (addr_space_t); +extern machine_mode default_addr_space_address_mode (addr_space_t); +extern bool default_addr_space_valid_pointer_mode (machine_mode, + addr_space_t); +extern bool default_addr_space_legitimate_address_p (machine_mode, rtx, + bool, addr_space_t); +extern rtx default_addr_space_legitimize_address (rtx, rtx, machine_mode, + addr_space_t); +extern bool default_addr_space_subset_p (addr_space_t, addr_space_t); +extern bool default_addr_space_zero_address_valid (addr_space_t); +extern int default_addr_space_debug (addr_space_t); +extern void default_addr_space_diagnose_usage (addr_space_t, location_t); +extern rtx default_addr_space_convert (rtx, tree, tree); +extern unsigned int default_case_values_threshold (void); +extern bool default_have_conditional_execution (void); + +extern bool default_libc_has_function (enum function_class); +extern bool no_c99_libc_has_function (enum function_class); +extern bool gnu_libc_has_function (enum function_class); + +extern tree default_builtin_tm_load_store (tree); + +extern int default_memory_move_cost (machine_mode, reg_class_t, bool); +extern int default_register_move_cost (machine_mode, reg_class_t, + reg_class_t); + +extern bool default_use_by_pieces_infrastructure_p (unsigned HOST_WIDE_INT, + unsigned int, + enum by_pieces_operation, + bool); +extern int default_compare_by_pieces_branch_ratio (machine_mode); + +extern bool default_profile_before_prologue (void); +extern reg_class_t default_preferred_reload_class (rtx, reg_class_t); +extern reg_class_t default_preferred_output_reload_class (rtx, reg_class_t); +extern reg_class_t default_preferred_rename_class (reg_class_t rclass); +extern bool default_class_likely_spilled_p (reg_class_t); +extern unsigned char default_class_max_nregs (reg_class_t, machine_mode); + +extern enum unwind_info_type default_debug_unwind_info (void); + +extern void default_canonicalize_comparison (int *, rtx *, rtx *, bool); + +extern int default_label_align_after_barrier_max_skip (rtx_insn *); +extern int default_loop_align_max_skip (rtx_insn *); +extern int default_label_align_max_skip (rtx_insn *); +extern int default_jump_align_max_skip (rtx_insn *); +extern section * default_function_section(tree decl, enum node_frequency freq, + bool startup, bool exit); +extern machine_mode default_dwarf_frame_reg_mode (int); +extern machine_mode default_get_reg_raw_mode (int); +extern bool default_keep_leaf_when_profiled (); + +extern void *default_get_pch_validity (size_t *); +extern const char *default_pch_valid_p (const void *, size_t); + +extern void default_asm_output_ident_directive (const char*); + +extern machine_mode default_cstore_mode (enum insn_code); +extern bool default_member_type_forces_blk (const_tree, machine_mode); +extern void default_atomic_assign_expand_fenv (tree *, tree *, tree *); +extern tree build_va_arg_indirect_ref (tree); +extern tree std_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *); +extern bool can_use_doloop_if_innermost (const widest_int &, + const widest_int &, + unsigned int, bool); + +extern rtx default_load_bounds_for_arg (rtx, rtx, rtx); +extern void default_store_bounds_for_arg (rtx, rtx, rtx, rtx); +extern rtx default_load_returned_bounds (rtx); +extern void default_store_returned_bounds (rtx,rtx); +extern tree default_chkp_bound_type (void); +extern enum machine_mode default_chkp_bound_mode (void); +extern tree default_builtin_chkp_function (unsigned int); +extern rtx default_chkp_function_value_bounds (const_tree, const_tree, bool); +extern tree default_chkp_make_bounds_constant (HOST_WIDE_INT lb, HOST_WIDE_INT ub); +extern int default_chkp_initialize_bounds (tree var, tree lb, tree ub, + tree *stmts); +extern void default_setup_incoming_vararg_bounds (cumulative_args_t ca ATTRIBUTE_UNUSED, + enum machine_mode mode ATTRIBUTE_UNUSED, + tree type ATTRIBUTE_UNUSED, + int *pretend_arg_size ATTRIBUTE_UNUSED, + int second_time ATTRIBUTE_UNUSED); +extern bool default_optab_supported_p (int, machine_mode, machine_mode, + optimization_type); +extern unsigned int default_max_noce_ifcvt_seq_cost (edge); +extern bool default_noce_conversion_profitable_p (rtx_insn *, + struct noce_if_info *); +extern unsigned int default_min_arithmetic_precision (void); + +extern enum flt_eval_method +default_excess_precision (enum excess_precision_type ATTRIBUTE_UNUSED); + +#endif /* GCC_TARGHOOKS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/timevar.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/timevar.h new file mode 100644 index 0000000..b7f91d1 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/timevar.h @@ -0,0 +1,261 @@ +/* Timing variables for measuring compiler performance. + Copyright (C) 2000-2017 Free Software Foundation, Inc. + Contributed by Alex Samuel + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#ifndef GCC_TIMEVAR_H +#define GCC_TIMEVAR_H + +/* Timing variables are used to measure elapsed time in various + portions of the compiler. Each measures elapsed user, system, and + wall-clock time, as appropriate to and supported by the host + system. + + Timing variables are defined using the DEFTIMEVAR macro in + timevar.def. Each has an enumeral identifier, used when referring + to the timing variable in code, and a character string name. + + Timing variables can be used in two ways: + + - On the timing stack, using timevar_push and timevar_pop. + Timing variables may be pushed onto the stack; elapsed time is + attributed to the topmost timing variable on the stack. When + another variable is pushed on, the previous topmost variable is + `paused' until the pushed variable is popped back off. + + - As a standalone timer, using timevar_start and timevar_stop. + All time elapsed between the two calls is attributed to the + variable. +*/ + +/* This structure stores the various varieties of time that can be + measured. Times are stored in seconds. The time may be an + absolute time or a time difference; in the former case, the time + base is undefined, except that the difference between two times + produces a valid time difference. */ + +struct timevar_time_def +{ + /* User time in this process. */ + double user; + + /* System time (if applicable for this host platform) in this + process. */ + double sys; + + /* Wall clock time. */ + double wall; + + /* Garbage collector memory. */ + size_t ggc_mem; +}; + +/* An enumeration of timing variable identifiers. Constructed from + the contents of timevar.def. */ + +#define DEFTIMEVAR(identifier__, name__) \ + identifier__, +typedef enum +{ + TV_NONE, +#include "timevar.def" + TIMEVAR_LAST +} +timevar_id_t; +#undef DEFTIMEVAR + +/* A class to hold all state relating to timing. */ + +class timer; + +/* The singleton instance of timing state. + + This is non-NULL if timevars should be used. In GCC, this happens with + the -ftime-report flag. Hence this is NULL for the common, + needs-to-be-fast case, with an early reject happening for this being + NULL. */ +extern timer *g_timer; + +/* Total amount of memory allocated by garbage collector. */ +extern size_t timevar_ggc_mem_total; + +extern void timevar_init (void); +extern void timevar_start (timevar_id_t); +extern void timevar_stop (timevar_id_t); +extern bool timevar_cond_start (timevar_id_t); +extern void timevar_cond_stop (timevar_id_t, bool); + +/* The public (within GCC) interface for timing. */ + +class timer +{ + public: + timer (); + ~timer (); + + void start (timevar_id_t tv); + void stop (timevar_id_t tv); + void push (timevar_id_t tv); + void pop (timevar_id_t tv); + bool cond_start (timevar_id_t tv); + void cond_stop (timevar_id_t tv); + + void push_client_item (const char *item_name); + void pop_client_item (); + + void print (FILE *fp); + + const char *get_topmost_item_name () const; + + private: + /* Private member functions. */ + void validate_phases (FILE *fp) const; + + struct timevar_def; + void push_internal (struct timevar_def *tv); + void pop_internal (); + static void print_row (FILE *fp, + const timevar_time_def *total, + const char *name, const timevar_time_def &elapsed); + static bool all_zero (const timevar_time_def &elapsed); + + private: + typedef hash_map child_map_t; + + /* Private type: a timing variable. */ + struct timevar_def + { + /* Elapsed time for this variable. */ + struct timevar_time_def elapsed; + + /* If this variable is timed independently of the timing stack, + using timevar_start, this contains the start time. */ + struct timevar_time_def start_time; + + /* The name of this timing variable. */ + const char *name; + + /* Nonzero if this timing variable is running as a standalone + timer. */ + unsigned standalone : 1; + + /* Nonzero if this timing variable was ever started or pushed onto + the timing stack. */ + unsigned used : 1; + + child_map_t *children; + }; + + /* Private type: an element on the timing stack + Elapsed time is attributed to the topmost timing variable on the + stack. */ + struct timevar_stack_def + { + /* The timing variable at this stack level. */ + struct timevar_def *timevar; + + /* The next lower timing variable context in the stack. */ + struct timevar_stack_def *next; + }; + + /* A class for managing a collection of named timing items, for use + e.g. by libgccjit for timing client code. This class is declared + inside timevar.c to avoid everything using timevar.h + from needing vec and hash_map. */ + class named_items; + + private: + + /* Data members (all private). */ + + /* Declared timing variables. Constructed from the contents of + timevar.def. */ + timevar_def m_timevars[TIMEVAR_LAST]; + + /* The top of the timing stack. */ + timevar_stack_def *m_stack; + + /* A list of unused (i.e. allocated and subsequently popped) + timevar_stack_def instances. */ + timevar_stack_def *m_unused_stack_instances; + + /* The time at which the topmost element on the timing stack was + pushed. Time elapsed since then is attributed to the topmost + element. */ + timevar_time_def m_start_time; + + /* If non-NULL, for use when timing libgccjit's client code. */ + named_items *m_jit_client_items; + + friend class named_items; +}; + +/* Provided for backward compatibility. */ +static inline void +timevar_push (timevar_id_t tv) +{ + if (g_timer) + g_timer->push (tv); +} + +static inline void +timevar_pop (timevar_id_t tv) +{ + if (g_timer) + g_timer->pop (tv); +} + +// This is a simple timevar wrapper class that pushes a timevar in its +// constructor and pops the timevar in its destructor. +class auto_timevar +{ + public: + auto_timevar (timer *t, timevar_id_t tv) + : m_timer (t), + m_tv (tv) + { + if (m_timer) + m_timer->push (m_tv); + } + + explicit auto_timevar (timevar_id_t tv) + : m_timer (g_timer) + , m_tv (tv) + { + if (m_timer) + m_timer->push (m_tv); + } + + ~auto_timevar () + { + if (m_timer) + m_timer->pop (m_tv); + } + + private: + + // Private to disallow copies. + auto_timevar (const auto_timevar &); + + timer *m_timer; + timevar_id_t m_tv; +}; + +extern void print_time (const char *, long); + +#endif /* ! GCC_TIMEVAR_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tm-preds.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tm-preds.h new file mode 100644 index 0000000..8b06ff3 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tm-preds.h @@ -0,0 +1,354 @@ +/* Generated automatically by the program 'build/genpreds' + from the machine description file '../../gcc/config/mips/mips.md'. */ + +#ifndef GCC_TM_PREDS_H +#define GCC_TM_PREDS_H + +#ifdef HAVE_MACHINE_MODES +extern int general_operand (rtx, machine_mode); +extern int address_operand (rtx, machine_mode); +extern int register_operand (rtx, machine_mode); +extern int pmode_register_operand (rtx, machine_mode); +extern int scratch_operand (rtx, machine_mode); +extern int immediate_operand (rtx, machine_mode); +extern int const_int_operand (rtx, machine_mode); +extern int const_double_operand (rtx, machine_mode); +extern int nonimmediate_operand (rtx, machine_mode); +extern int nonmemory_operand (rtx, machine_mode); +extern int push_operand (rtx, machine_mode); +extern int pop_operand (rtx, machine_mode); +extern int memory_operand (rtx, machine_mode); +extern int indirect_operand (rtx, machine_mode); +extern int ordered_comparison_operator (rtx, machine_mode); +extern int comparison_operator (rtx, machine_mode); +extern int const_uns_arith_operand (rtx, machine_mode); +extern int uns_arith_operand (rtx, machine_mode); +extern int const_arith_operand (rtx, machine_mode); +extern int arith_operand (rtx, machine_mode); +extern int const_immlsa_operand (rtx, machine_mode); +extern int const_msa_branch_operand (rtx, machine_mode); +extern int const_uimm3_operand (rtx, machine_mode); +extern int const_uimm4_operand (rtx, machine_mode); +extern int const_uimm5_operand (rtx, machine_mode); +extern int const_uimm6_operand (rtx, machine_mode); +extern int const_uimm8_operand (rtx, machine_mode); +extern int const_imm5_operand (rtx, machine_mode); +extern int const_imm10_operand (rtx, machine_mode); +extern int reg_imm10_operand (rtx, machine_mode); +extern int aq10b_operand (rtx, machine_mode); +extern int aq10h_operand (rtx, machine_mode); +extern int aq10w_operand (rtx, machine_mode); +extern int aq10d_operand (rtx, machine_mode); +extern int sle_operand (rtx, machine_mode); +extern int sleu_operand (rtx, machine_mode); +extern int const_0_operand (rtx, machine_mode); +extern int const_m1_operand (rtx, machine_mode); +extern int reg_or_m1_operand (rtx, machine_mode); +extern int reg_or_0_operand (rtx, machine_mode); +extern int const_1_operand (rtx, machine_mode); +extern int reg_or_1_operand (rtx, machine_mode); +extern int const_exp_2_operand (rtx, machine_mode); +extern int const_exp_4_operand (rtx, machine_mode); +extern int const_exp_8_operand (rtx, machine_mode); +extern int const_exp_16_operand (rtx, machine_mode); +extern int const_0_or_1_operand (rtx, machine_mode); +extern int const_2_or_3_operand (rtx, machine_mode); +extern int const_0_to_3_operand (rtx, machine_mode); +extern int qi_mask_operand (rtx, machine_mode); +extern int hi_mask_operand (rtx, machine_mode); +extern int si_mask_operand (rtx, machine_mode); +extern int and_load_operand (rtx, machine_mode); +extern int low_bitmask_operand (rtx, machine_mode); +extern int and_reg_operand (rtx, machine_mode); +extern int and_operand (rtx, machine_mode); +extern int d_operand (rtx, machine_mode); +extern int lwsp_swsp_operand (rtx, machine_mode); +extern int lw16_sw16_operand (rtx, machine_mode); +extern int lhu16_sh16_operand (rtx, machine_mode); +extern int lbu16_operand (rtx, machine_mode); +extern int sb16_operand (rtx, machine_mode); +extern int db4_operand (rtx, machine_mode); +extern int db7_operand (rtx, machine_mode); +extern int db8_operand (rtx, machine_mode); +extern int ib3_operand (rtx, machine_mode); +extern int sb4_operand (rtx, machine_mode); +extern int sb5_operand (rtx, machine_mode); +extern int sb8_operand (rtx, machine_mode); +extern int sd8_operand (rtx, machine_mode); +extern int ub4_operand (rtx, machine_mode); +extern int ub8_operand (rtx, machine_mode); +extern int uh4_operand (rtx, machine_mode); +extern int uw4_operand (rtx, machine_mode); +extern int uw5_operand (rtx, machine_mode); +extern int uw6_operand (rtx, machine_mode); +extern int uw8_operand (rtx, machine_mode); +extern int addiur2_operand (rtx, machine_mode); +extern int addiusp_operand (rtx, machine_mode); +extern int andi16_operand (rtx, machine_mode); +extern int movep_src_register (rtx, machine_mode); +extern int movep_src_operand (rtx, machine_mode); +extern int lo_operand (rtx, machine_mode); +extern int hilo_operand (rtx, machine_mode); +extern int fcc_reload_operand (rtx, machine_mode); +extern int muldiv_target_operand (rtx, machine_mode); +extern int const_call_insn_operand (rtx, machine_mode); +extern int call_insn_operand (rtx, machine_mode); +extern int splittable_const_int_operand (rtx, machine_mode); +extern int move_operand (rtx, machine_mode); +extern int cprestore_save_slot_operand (rtx, machine_mode); +extern int cprestore_load_slot_operand (rtx, machine_mode); +extern int consttable_operand (rtx, machine_mode); +extern int symbolic_operand (rtx, machine_mode); +extern int absolute_symbolic_operand (rtx, machine_mode); +extern int symbolic_operand_with_high (rtx, machine_mode); +extern int force_to_mem_operand (rtx, machine_mode); +extern int got_disp_operand (rtx, machine_mode); +extern int got_page_ofst_operand (rtx, machine_mode); +extern int tls_reloc_operand (rtx, machine_mode); +extern int symbol_ref_operand (rtx, machine_mode); +extern int stack_operand (rtx, machine_mode); +extern int macc_msac_operand (rtx, machine_mode); +extern int equality_operator (rtx, machine_mode); +extern int extend_operator (rtx, machine_mode); +extern int trap_comparison_operator (rtx, machine_mode); +extern int order_operator (rtx, machine_mode); +extern int mips_cstore_operator (rtx, machine_mode); +extern int small_data_pattern (rtx, machine_mode); +extern int mem_noofs_operand (rtx, machine_mode); +extern int non_volatile_mem_operand (rtx, machine_mode); +extern int const_vector_same_val_operand (rtx, machine_mode); +extern int const_vector_same_simm5_operand (rtx, machine_mode); +extern int const_vector_same_uimm5_operand (rtx, machine_mode); +extern int const_vector_same_ximm5_operand (rtx, machine_mode); +extern int const_vector_same_uimm6_operand (rtx, machine_mode); +extern int const_vector_same_uimm8_operand (rtx, machine_mode); +extern int par_const_vector_shf_set_operand (rtx, machine_mode); +extern int reg_or_vector_same_val_operand (rtx, machine_mode); +extern int reg_or_vector_same_simm5_operand (rtx, machine_mode); +extern int reg_or_vector_same_uimm5_operand (rtx, machine_mode); +extern int reg_or_vector_same_ximm5_operand (rtx, machine_mode); +extern int reg_or_vector_same_uimm6_operand (rtx, machine_mode); +#endif /* HAVE_MACHINE_MODES */ + +#define CONSTRAINT_NUM_DEFINED_P 1 +enum constraint_num +{ + CONSTRAINT__UNKNOWN = 0, + CONSTRAINT_r, + CONSTRAINT_d, + CONSTRAINT_t, + CONSTRAINT_f, + CONSTRAINT_h, + CONSTRAINT_l, + CONSTRAINT_x, + CONSTRAINT_b, + CONSTRAINT_u, + CONSTRAINT_c, + CONSTRAINT_e, + CONSTRAINT_j, + CONSTRAINT_v, + CONSTRAINT_y, + CONSTRAINT_z, + CONSTRAINT_A, + CONSTRAINT_a, + CONSTRAINT_B, + CONSTRAINT_C, + CONSTRAINT_D, + CONSTRAINT_ka, + CONSTRAINT_kb, + CONSTRAINT_I, + CONSTRAINT_J, + CONSTRAINT_K, + CONSTRAINT_L, + CONSTRAINT_M, + CONSTRAINT_N, + CONSTRAINT_O, + CONSTRAINT_P, + CONSTRAINT_m, + CONSTRAINT_o, + CONSTRAINT_R, + CONSTRAINT_W, + CONSTRAINT_ZC, + CONSTRAINT_ZR, + CONSTRAINT_ZS, + CONSTRAINT_ZT, + CONSTRAINT_ZU, + CONSTRAINT_ZV, + CONSTRAINT_ZW, + CONSTRAINT_p, + CONSTRAINT_ZD, + CONSTRAINT_kf, + CONSTRAINT_G, + CONSTRAINT_Q, + CONSTRAINT_Udb7, + CONSTRAINT_Udb8, + CONSTRAINT_Uead, + CONSTRAINT_Uean, + CONSTRAINT_Uesp, + CONSTRAINT_Uib3, + CONSTRAINT_Usb4, + CONSTRAINT_Usb5, + CONSTRAINT_Usb8, + CONSTRAINT_Usd8, + CONSTRAINT_Uub8, + CONSTRAINT_Uuw5, + CONSTRAINT_Uuw6, + CONSTRAINT_Uuw8, + CONSTRAINT_YG, + CONSTRAINT_YA, + CONSTRAINT_YB, + CONSTRAINT_Yb, + CONSTRAINT_Yh, + CONSTRAINT_Yw, + CONSTRAINT_Yx, + CONSTRAINT_YI, + CONSTRAINT_YC, + CONSTRAINT_YZ, + CONSTRAINT_Unv5, + CONSTRAINT_Uuv5, + CONSTRAINT_Usv5, + CONSTRAINT_Uuv6, + CONSTRAINT_Urv8, + CONSTRAINT_ks, + CONSTRAINT_S, + CONSTRAINT_V, + CONSTRAINT__l, + CONSTRAINT__g, + CONSTRAINT_i, + CONSTRAINT_s, + CONSTRAINT_n, + CONSTRAINT_E, + CONSTRAINT_F, + CONSTRAINT_X, + CONSTRAINT_Yd, + CONSTRAINT_Yf, + CONSTRAINT__LIMIT +}; + +extern enum constraint_num lookup_constraint_1 (const char *); +extern const unsigned char lookup_constraint_array[]; + +/* Return the constraint at the beginning of P, or CONSTRAINT__UNKNOWN if it + isn't recognized. */ + +static inline enum constraint_num +lookup_constraint (const char *p) +{ + unsigned int index = lookup_constraint_array[(unsigned char) *p]; + return (index == UCHAR_MAX + ? lookup_constraint_1 (p) + : (enum constraint_num) index); +} + +extern bool (*constraint_satisfied_p_array[]) (rtx); + +/* Return true if X satisfies constraint C. */ + +static inline bool +constraint_satisfied_p (rtx x, enum constraint_num c) +{ + int i = (int) c - (int) CONSTRAINT_I; + return i >= 0 && constraint_satisfied_p_array[i] (x); +} + +static inline bool +insn_extra_register_constraint (enum constraint_num c) +{ + return c >= CONSTRAINT_r && c <= CONSTRAINT_kb; +} + +static inline bool +insn_extra_memory_constraint (enum constraint_num c) +{ + return c >= CONSTRAINT_m && c <= CONSTRAINT_ZW; +} + +static inline bool +insn_extra_special_memory_constraint (enum constraint_num) +{ + return false; +} + +static inline bool +insn_extra_address_constraint (enum constraint_num c) +{ + return c >= CONSTRAINT_p && c <= CONSTRAINT_ZD; +} + +static inline void +insn_extra_constraint_allows_reg_mem (enum constraint_num c, + bool *allows_reg, bool *allows_mem) +{ + if (c >= CONSTRAINT_kf && c <= CONSTRAINT_Urv8) + return; + if (c >= CONSTRAINT_ks && c <= CONSTRAINT_S) + { + *allows_reg = true; + return; + } + if (c >= CONSTRAINT_V && c <= CONSTRAINT__g) + { + *allows_mem = true; + return; + } + (void) c; + *allows_reg = true; + *allows_mem = true; +} + +static inline size_t +insn_constraint_len (char fc, const char *str ATTRIBUTE_UNUSED) +{ + switch (fc) + { + case 'U': return 4; + case 'Y': return 2; + case 'Z': return 2; + case 'k': return 2; + default: break; + } + return 1; +} + +#define CONSTRAINT_LEN(c_,s_) insn_constraint_len (c_,s_) + +extern enum reg_class reg_class_for_constraint_1 (enum constraint_num); + +static inline enum reg_class +reg_class_for_constraint (enum constraint_num c) +{ + if (insn_extra_register_constraint (c)) + return reg_class_for_constraint_1 (c); + return NO_REGS; +} + +extern bool insn_const_int_ok_for_constraint (HOST_WIDE_INT, enum constraint_num); +#define CONST_OK_FOR_CONSTRAINT_P(v_,c_,s_) \ + insn_const_int_ok_for_constraint (v_, lookup_constraint (s_)) + +enum constraint_type +{ + CT_REGISTER, + CT_CONST_INT, + CT_MEMORY, + CT_SPECIAL_MEMORY, + CT_ADDRESS, + CT_FIXED_FORM +}; + +static inline enum constraint_type +get_constraint_type (enum constraint_num c) +{ + if (c >= CONSTRAINT_p) + { + if (c >= CONSTRAINT_kf) + return CT_FIXED_FORM; + return CT_ADDRESS; + } + if (c >= CONSTRAINT_m) + return CT_MEMORY; + if (c >= CONSTRAINT_I) + return CT_CONST_INT; + return CT_REGISTER; +} +#endif /* tm-preds.h */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tm.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tm.h new file mode 100644 index 0000000..4057721 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tm.h @@ -0,0 +1,57 @@ +#ifndef GCC_TM_H +#define GCC_TM_H +#define TARGET_CPU_DEFAULT (((MASK_SPLIT_ADDRESSES)|MASK_EXPLICIT_RELOCS)|MASK_RELAX_PIC_CALLS) +#ifndef TARGET_ENDIAN_DEFAULT +# define TARGET_ENDIAN_DEFAULT 0 +#endif +#ifndef LIBC_GLIBC +# define LIBC_GLIBC 1 +#endif +#ifndef LIBC_UCLIBC +# define LIBC_UCLIBC 2 +#endif +#ifndef LIBC_BIONIC +# define LIBC_BIONIC 3 +#endif +#ifndef LIBC_MUSL +# define LIBC_MUSL 4 +#endif +#ifndef DEFAULT_LIBC +# define DEFAULT_LIBC LIBC_UCLIBC +#endif +#ifndef ANDROID_DEFAULT +# define ANDROID_DEFAULT 0 +#endif +#ifndef MIPS_ISA_DEFAULT +# define MIPS_ISA_DEFAULT 32 +#endif +#ifndef MIPS_ABI_DEFAULT +# define MIPS_ABI_DEFAULT ABI_32 +#endif +#ifdef IN_GCC +# include "options.h" +# include "insn-constants.h" +# include "config/dbxelf.h" +# include "config/elfos.h" +# include "config/gnu-user.h" +# include "config/linux.h" +# include "config/linux-android.h" +# include "config/glibc-stdint.h" +# include "config/vxworks-dummy.h" +# include "config/mips/mips.h" +# include "config/mips/gnu-user.h" +# include "config/mips/linux.h" +# include "config/mips/linux-common.h" +# include "config/initfini-array.h" +#endif +#if defined IN_GCC && !defined GENERATOR_FILE && !defined USED_FOR_TARGET +# include "insn-flags.h" +#endif +#if defined IN_GCC && !defined GENERATOR_FILE +# include "insn-modes.h" +#endif +#if defined IN_GCC && defined GENERATOR_FILE && !defined BITS_PER_UNIT +#include "machmode.h" +#endif +# include "defaults.h" +#endif /* GCC_TM_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tm_p.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tm_p.h new file mode 100644 index 0000000..93401e9 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tm_p.h @@ -0,0 +1,8 @@ +#ifndef GCC_TM_P_H +#define GCC_TM_P_H +#ifdef IN_GCC +# include "config/mips/mips-protos.h" +# include "config/linux-protos.h" +# include "tm-preds.h" +#endif +#endif /* GCC_TM_P_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/toplev.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/toplev.h new file mode 100644 index 0000000..2f6b587 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/toplev.h @@ -0,0 +1,98 @@ +/* toplev.h - Various declarations for functions found in toplev.c + Copyright (C) 1998-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TOPLEV_H +#define GCC_TOPLEV_H + +/* Decoded options, and number of such options. */ +extern struct cl_decoded_option *save_decoded_options; +extern unsigned int save_decoded_options_count; + +class timer; + +/* Invoking the compiler. */ +class toplev +{ +public: + toplev (timer *external_timer, + bool init_signals); + ~toplev (); + + int main (int argc, char **argv); + + void finalize (); + +private: + + void start_timevars (); + + void run_self_tests (); + + bool m_use_TV_TOTAL; + bool m_init_signals; +}; + +extern void rest_of_decl_compilation (tree, int, int); +extern void rest_of_type_compilation (tree, int); +extern void init_optimization_passes (void); +extern bool enable_rtl_dump_file (void); + +/* In except.c. Initialize exception handling. This is used by the Ada + and LTO front ends to initialize EH "on demand". See lto-streamer-in.c + and ada/gcc-interface/misc.c. */ +extern void init_eh (void); + +extern void announce_function (tree); + +extern void wrapup_global_declaration_1 (tree); +extern bool wrapup_global_declaration_2 (tree); +extern bool wrapup_global_declarations (tree *, int); + +extern void global_decl_processing (void); + +extern void dump_memory_report (bool); +extern void dump_profile_report (void); + +extern void target_reinit (void); + +/* A unique local time stamp, might be zero if none is available. */ +extern unsigned local_tick; + +/* See toplev.c. */ +extern int flag_rerun_cse_after_global_opts; + +extern void print_version (FILE *, const char *, bool); + +/* The hashtable, so that the C front ends can pass it to cpplib. */ +extern struct ht *ident_hash; + +/* Functions used to get and set GCC's notion of in what directory + compilation was started. */ + +extern const char *get_src_pwd (void); +extern bool set_src_pwd (const char *); + +/* Functions used to manipulate the random seed. */ + +extern HOST_WIDE_INT get_random_seed (bool); +extern const char *set_random_seed (const char *); + +extern void initialize_rtl (void); + +#endif /* ! GCC_TOPLEV_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tracer.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tracer.h new file mode 100644 index 0000000..ca2117b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tracer.h @@ -0,0 +1,26 @@ +/* Header file for Tracer. + Copyright (C) 2015-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TRACER_H +#define GCC_TRACER_H + +extern basic_block transform_duplicate (basic_block bb, basic_block bb2); +extern bool ignore_bb_p (const_basic_block bb); + +#endif /* GCC_TRACER_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/trans-mem.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/trans-mem.h new file mode 100644 index 0000000..5bf2e54 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/trans-mem.h @@ -0,0 +1,52 @@ +/* Miscellaneous transactional memory support definitions. + Copyright (C) 2009-2017 Free Software Foundation, Inc. + Contributed by Richard Henderson + and Aldy Hernandez . + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 3, or (at your option) any later + version. + + GCC is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#ifndef GCC_TRANS_MEM_H +#define GCC_TRANS_MEM_H + +/* These defines must match the enumerations in libitm.h. */ +#define PR_INSTRUMENTEDCODE 0x0001 +#define PR_UNINSTRUMENTEDCODE 0x0002 +#define PR_MULTIWAYCODE (PR_INSTRUMENTEDCODE | PR_UNINSTRUMENTEDCODE) +#define PR_HASNOXMMUPDATE 0x0004 +#define PR_HASNOABORT 0x0008 +#define PR_HASNOIRREVOCABLE 0x0020 +#define PR_DOESGOIRREVOCABLE 0x0040 +#define PR_HASNOSIMPLEREADS 0x0080 +#define PR_AWBARRIERSOMITTED 0x0100 +#define PR_RARBARRIERSOMITTED 0x0200 +#define PR_UNDOLOGCODE 0x0400 +#define PR_PREFERUNINSTRUMENTED 0x0800 +#define PR_EXCEPTIONBLOCK 0x1000 +#define PR_HASELSE 0x2000 +#define PR_READONLY 0x4000 + +extern void compute_transaction_bits (void); +extern bool is_tm_ending (gimple *); +extern tree build_tm_abort_call (location_t, bool); +extern bool is_tm_safe (const_tree); +extern bool is_tm_pure (const_tree); +extern bool is_tm_may_cancel_outer (tree); +extern bool is_tm_ending_fndecl (tree); +extern void record_tm_replacement (tree, tree); +extern void tm_malloc_replacement (tree); + +#endif // GCC_TRANS_MEM_H diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-affine.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-affine.h new file mode 100644 index 0000000..b8eb8cc --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-affine.h @@ -0,0 +1,104 @@ +/* Operations with affine combinations of trees. + Copyright (C) 2005-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3, or (at your option) any +later version. + +GCC is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* Affine combination of trees. We keep track of at most MAX_AFF_ELTS elements + to make things simpler; this is sufficient in most cases. */ + +#ifndef GCC_TREE_AFFINE_H +#define GCC_TREE_AFFINE_H + + +#define MAX_AFF_ELTS 8 + +/* Element of an affine combination. */ + +struct aff_comb_elt +{ + /* The value of the element. */ + tree val; + + /* Its coefficient in the combination. */ + widest_int coef; +}; + +struct aff_tree +{ + /* Type of the result of the combination. */ + tree type; + + /* Constant offset. */ + widest_int offset; + + /* Number of elements of the combination. */ + unsigned n; + + /* Elements and their coefficients. Type of elements may be different from + TYPE, but their sizes must be the same (STRIP_NOPS is applied to the + elements). + + The coefficients are always sign extended from the precision of TYPE + (regardless of signedness of TYPE). */ + struct aff_comb_elt elts[MAX_AFF_ELTS]; + + /* Remainder of the expression. Usually NULL, used only if there are more + than MAX_AFF_ELTS elements. Type of REST will be either sizetype for + TYPE of POINTER_TYPEs or TYPE. */ + tree rest; +}; + +struct name_expansion; + +widest_int wide_int_ext_for_comb (const widest_int &, aff_tree *); +void aff_combination_const (aff_tree *, tree, const widest_int &); +void aff_combination_elt (aff_tree *, tree, tree); +void aff_combination_scale (aff_tree *, const widest_int &); +void aff_combination_mult (aff_tree *, aff_tree *, aff_tree *); +void aff_combination_add (aff_tree *, aff_tree *); +void aff_combination_add_elt (aff_tree *, tree, const widest_int &); +void aff_combination_remove_elt (aff_tree *, unsigned); +void aff_combination_convert (aff_tree *, tree); +void tree_to_aff_combination (tree, tree, aff_tree *); +tree aff_combination_to_tree (aff_tree *); +void unshare_aff_combination (aff_tree *); +bool aff_combination_constant_multiple_p (aff_tree *, aff_tree *, widest_int *); +void aff_combination_expand (aff_tree *, hash_map **); +void tree_to_aff_combination_expand (tree, tree, aff_tree *, + hash_map **); +tree get_inner_reference_aff (tree, aff_tree *, widest_int *); +void free_affine_expand_cache (hash_map **); +bool aff_comb_cannot_overlap_p (aff_tree *, const widest_int &, + const widest_int &); + +/* Debugging functions. */ +void debug_aff (aff_tree *); + +/* Return true if AFF is actually ZERO. */ +static inline bool +aff_combination_zero_p (aff_tree *aff) +{ + if (!aff) + return true; + + if (aff->n == 0 && aff->offset == 0) + return true; + + return false; +} + +#endif /* GCC_TREE_AFFINE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-cfg.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-cfg.h new file mode 100644 index 0000000..5582a62 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-cfg.h @@ -0,0 +1,121 @@ +/* Data and Control Flow Analysis for Trees. + Copyright (C) 2001-2017 Free Software Foundation, Inc. + Contributed by Diego Novillo + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef _TREE_CFG_H +#define _TREE_CFG_H + +/* Location to track pending stmt for edge insertion. */ +#define PENDING_STMT(e) ((e)->insns.g) + +/* Garbage collection and PCH support for edge_def. */ +extern void gt_ggc_mx (edge_def *e); +extern void gt_pch_nx (edge_def *e); +extern void gt_pch_nx (edge_def *e, gt_pointer_operator, void *); + +extern void init_empty_tree_cfg_for_function (struct function *); +extern void init_empty_tree_cfg (void); +extern void start_recording_case_labels (void); +extern void end_recording_case_labels (void); +extern basic_block label_to_block_fn (struct function *, tree); +#define label_to_block(t) (label_to_block_fn (cfun, t)) +extern void cleanup_dead_labels (void); +extern void group_case_labels_stmt (gswitch *); +extern void group_case_labels (void); +extern void replace_uses_by (tree, tree); +extern basic_block single_noncomplex_succ (basic_block bb); +extern void notice_special_calls (gcall *); +extern void clear_special_calls (void); +extern edge find_taken_edge (basic_block, tree); +extern void gimple_debug_bb (basic_block); +extern basic_block gimple_debug_bb_n (int); +extern void gimple_debug_cfg (int); +extern void gimple_dump_cfg (FILE *, int); +extern void dump_cfg_stats (FILE *); +extern void debug_cfg_stats (void); +extern bool computed_goto_p (gimple *); +extern bool stmt_can_make_abnormal_goto (gimple *); +extern basic_block get_abnormal_succ_dispatcher (basic_block); +extern bool is_ctrl_stmt (gimple *); +extern bool is_ctrl_altering_stmt (gimple *); +extern bool simple_goto_p (gimple *); +extern bool stmt_ends_bb_p (gimple *); +extern bool assert_unreachable_fallthru_edge_p (edge); +extern void delete_tree_cfg_annotations (function *); +extern gphi *get_virtual_phi (basic_block); +extern gimple *first_stmt (basic_block); +extern gimple *last_stmt (basic_block); +extern gimple *last_and_only_stmt (basic_block); +extern void verify_gimple_in_seq (gimple_seq); +extern void verify_gimple_in_cfg (struct function *, bool); +extern tree gimple_block_label (basic_block); +extern void add_phi_args_after_copy_bb (basic_block); +extern void add_phi_args_after_copy (basic_block *, unsigned, edge); +extern basic_block split_edge_bb_loc (edge); +extern bool gimple_duplicate_sese_region (edge, edge, basic_block *, unsigned, + basic_block *, bool); +extern bool gimple_duplicate_sese_tail (edge, edge, basic_block *, unsigned, + basic_block *); +extern void gather_blocks_in_sese_region (basic_block entry, basic_block exit, + vec *bbs_p); +extern void verify_sese (basic_block, basic_block, vec *); +extern bool gather_ssa_name_hash_map_from (tree const &, tree const &, void *); +extern basic_block move_sese_region_to_fn (struct function *, basic_block, + basic_block, tree); +extern void dump_function_to_file (tree, FILE *, int); +extern void debug_function (tree, int) ; +extern void print_loops_bb (FILE *, basic_block, int, int); +extern void print_loops (FILE *, int); +extern void debug (struct loop &ref); +extern void debug (struct loop *ptr); +extern void debug_verbose (struct loop &ref); +extern void debug_verbose (struct loop *ptr); +extern void debug_loops (int); +extern void debug_loop (struct loop *, int); +extern void debug_loop_num (unsigned, int); +extern void remove_edge_and_dominated_blocks (edge); +extern bool gimple_purge_dead_eh_edges (basic_block); +extern bool gimple_purge_all_dead_eh_edges (const_bitmap); +extern bool gimple_purge_dead_abnormal_call_edges (basic_block); +extern bool gimple_purge_all_dead_abnormal_call_edges (const_bitmap); +extern tree gimplify_build3 (gimple_stmt_iterator *, enum tree_code, + tree, tree, tree, tree); +extern tree gimplify_build2 (gimple_stmt_iterator *, enum tree_code, + tree, tree, tree); +extern tree gimplify_build1 (gimple_stmt_iterator *, enum tree_code, + tree, tree); +extern void extract_true_false_edges_from_block (basic_block, edge *, edge *); +extern unsigned int execute_fixup_cfg (void); +extern unsigned int split_critical_edges (void); +extern basic_block insert_cond_bb (basic_block, gimple *, gimple *); +extern bool gimple_find_sub_bbs (gimple_seq, gimple_stmt_iterator *); +extern bool extract_true_false_controlled_edges (basic_block, basic_block, + edge *, edge *); + +/* Return true if the LHS of a call should be removed. */ + +inline bool +should_remove_lhs_p (tree lhs) +{ + return (lhs + && TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (lhs))) == INTEGER_CST + && !TREE_ADDRESSABLE (TREE_TYPE (lhs))); +} + +#endif /* _TREE_CFG_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-cfgcleanup.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-cfgcleanup.h new file mode 100644 index 0000000..f64f711 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-cfgcleanup.h @@ -0,0 +1,28 @@ +/* Header file for CFG cleanup for trees. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_CFGCLEANUP_H +#define GCC_TREE_CFGCLEANUP_H + +/* In tree-cfgcleanup.c */ +extern bitmap cfgcleanup_altered_bbs; +extern bool cleanup_tree_cfg (void); +extern bool fixup_noreturn_call (gimple *stmt); + +#endif /* GCC_TREE_CFGCLEANUP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-check.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-check.h new file mode 100644 index 0000000..7a63998 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-check.h @@ -0,0 +1,356 @@ +/* This file is generated using gencheck. Do not edit. */ + +#ifndef GCC_TREE_CHECK_H +#define GCC_TREE_CHECK_H + +#define ERROR_MARK_CHECK(t) TREE_CHECK (t, ERROR_MARK) +#define IDENTIFIER_NODE_CHECK(t) TREE_CHECK (t, IDENTIFIER_NODE) +#define TREE_LIST_CHECK(t) TREE_CHECK (t, TREE_LIST) +#define TREE_VEC_CHECK(t) TREE_CHECK (t, TREE_VEC) +#define BLOCK_CHECK(t) TREE_CHECK (t, BLOCK) +#define OFFSET_TYPE_CHECK(t) TREE_CHECK (t, OFFSET_TYPE) +#define ENUMERAL_TYPE_CHECK(t) TREE_CHECK (t, ENUMERAL_TYPE) +#define BOOLEAN_TYPE_CHECK(t) TREE_CHECK (t, BOOLEAN_TYPE) +#define INTEGER_TYPE_CHECK(t) TREE_CHECK (t, INTEGER_TYPE) +#define REAL_TYPE_CHECK(t) TREE_CHECK (t, REAL_TYPE) +#define POINTER_TYPE_CHECK(t) TREE_CHECK (t, POINTER_TYPE) +#define REFERENCE_TYPE_CHECK(t) TREE_CHECK (t, REFERENCE_TYPE) +#define NULLPTR_TYPE_CHECK(t) TREE_CHECK (t, NULLPTR_TYPE) +#define FIXED_POINT_TYPE_CHECK(t) TREE_CHECK (t, FIXED_POINT_TYPE) +#define COMPLEX_TYPE_CHECK(t) TREE_CHECK (t, COMPLEX_TYPE) +#define VECTOR_TYPE_CHECK(t) TREE_CHECK (t, VECTOR_TYPE) +#define ARRAY_TYPE_CHECK(t) TREE_CHECK (t, ARRAY_TYPE) +#define RECORD_TYPE_CHECK(t) TREE_CHECK (t, RECORD_TYPE) +#define UNION_TYPE_CHECK(t) TREE_CHECK (t, UNION_TYPE) +#define QUAL_UNION_TYPE_CHECK(t) TREE_CHECK (t, QUAL_UNION_TYPE) +#define VOID_TYPE_CHECK(t) TREE_CHECK (t, VOID_TYPE) +#define POINTER_BOUNDS_TYPE_CHECK(t) TREE_CHECK (t, POINTER_BOUNDS_TYPE) +#define FUNCTION_TYPE_CHECK(t) TREE_CHECK (t, FUNCTION_TYPE) +#define METHOD_TYPE_CHECK(t) TREE_CHECK (t, METHOD_TYPE) +#define LANG_TYPE_CHECK(t) TREE_CHECK (t, LANG_TYPE) +#define VOID_CST_CHECK(t) TREE_CHECK (t, VOID_CST) +#define INTEGER_CST_CHECK(t) TREE_CHECK (t, INTEGER_CST) +#define REAL_CST_CHECK(t) TREE_CHECK (t, REAL_CST) +#define FIXED_CST_CHECK(t) TREE_CHECK (t, FIXED_CST) +#define COMPLEX_CST_CHECK(t) TREE_CHECK (t, COMPLEX_CST) +#define VECTOR_CST_CHECK(t) TREE_CHECK (t, VECTOR_CST) +#define STRING_CST_CHECK(t) TREE_CHECK (t, STRING_CST) +#define FUNCTION_DECL_CHECK(t) TREE_CHECK (t, FUNCTION_DECL) +#define LABEL_DECL_CHECK(t) TREE_CHECK (t, LABEL_DECL) +#define FIELD_DECL_CHECK(t) TREE_CHECK (t, FIELD_DECL) +#define VAR_DECL_CHECK(t) TREE_CHECK (t, VAR_DECL) +#define CONST_DECL_CHECK(t) TREE_CHECK (t, CONST_DECL) +#define PARM_DECL_CHECK(t) TREE_CHECK (t, PARM_DECL) +#define TYPE_DECL_CHECK(t) TREE_CHECK (t, TYPE_DECL) +#define RESULT_DECL_CHECK(t) TREE_CHECK (t, RESULT_DECL) +#define DEBUG_EXPR_DECL_CHECK(t) TREE_CHECK (t, DEBUG_EXPR_DECL) +#define NAMESPACE_DECL_CHECK(t) TREE_CHECK (t, NAMESPACE_DECL) +#define IMPORTED_DECL_CHECK(t) TREE_CHECK (t, IMPORTED_DECL) +#define NAMELIST_DECL_CHECK(t) TREE_CHECK (t, NAMELIST_DECL) +#define TRANSLATION_UNIT_DECL_CHECK(t) TREE_CHECK (t, TRANSLATION_UNIT_DECL) +#define COMPONENT_REF_CHECK(t) TREE_CHECK (t, COMPONENT_REF) +#define BIT_FIELD_REF_CHECK(t) TREE_CHECK (t, BIT_FIELD_REF) +#define ARRAY_REF_CHECK(t) TREE_CHECK (t, ARRAY_REF) +#define ARRAY_RANGE_REF_CHECK(t) TREE_CHECK (t, ARRAY_RANGE_REF) +#define REALPART_EXPR_CHECK(t) TREE_CHECK (t, REALPART_EXPR) +#define IMAGPART_EXPR_CHECK(t) TREE_CHECK (t, IMAGPART_EXPR) +#define VIEW_CONVERT_EXPR_CHECK(t) TREE_CHECK (t, VIEW_CONVERT_EXPR) +#define INDIRECT_REF_CHECK(t) TREE_CHECK (t, INDIRECT_REF) +#define OBJ_TYPE_REF_CHECK(t) TREE_CHECK (t, OBJ_TYPE_REF) +#define CONSTRUCTOR_CHECK(t) TREE_CHECK (t, CONSTRUCTOR) +#define COMPOUND_EXPR_CHECK(t) TREE_CHECK (t, COMPOUND_EXPR) +#define MODIFY_EXPR_CHECK(t) TREE_CHECK (t, MODIFY_EXPR) +#define INIT_EXPR_CHECK(t) TREE_CHECK (t, INIT_EXPR) +#define TARGET_EXPR_CHECK(t) TREE_CHECK (t, TARGET_EXPR) +#define COND_EXPR_CHECK(t) TREE_CHECK (t, COND_EXPR) +#define VEC_COND_EXPR_CHECK(t) TREE_CHECK (t, VEC_COND_EXPR) +#define VEC_PERM_EXPR_CHECK(t) TREE_CHECK (t, VEC_PERM_EXPR) +#define BIND_EXPR_CHECK(t) TREE_CHECK (t, BIND_EXPR) +#define CALL_EXPR_CHECK(t) TREE_CHECK (t, CALL_EXPR) +#define WITH_CLEANUP_EXPR_CHECK(t) TREE_CHECK (t, WITH_CLEANUP_EXPR) +#define CLEANUP_POINT_EXPR_CHECK(t) TREE_CHECK (t, CLEANUP_POINT_EXPR) +#define PLACEHOLDER_EXPR_CHECK(t) TREE_CHECK (t, PLACEHOLDER_EXPR) +#define PLUS_EXPR_CHECK(t) TREE_CHECK (t, PLUS_EXPR) +#define MINUS_EXPR_CHECK(t) TREE_CHECK (t, MINUS_EXPR) +#define MULT_EXPR_CHECK(t) TREE_CHECK (t, MULT_EXPR) +#define POINTER_PLUS_EXPR_CHECK(t) TREE_CHECK (t, POINTER_PLUS_EXPR) +#define MULT_HIGHPART_EXPR_CHECK(t) TREE_CHECK (t, MULT_HIGHPART_EXPR) +#define TRUNC_DIV_EXPR_CHECK(t) TREE_CHECK (t, TRUNC_DIV_EXPR) +#define CEIL_DIV_EXPR_CHECK(t) TREE_CHECK (t, CEIL_DIV_EXPR) +#define FLOOR_DIV_EXPR_CHECK(t) TREE_CHECK (t, FLOOR_DIV_EXPR) +#define ROUND_DIV_EXPR_CHECK(t) TREE_CHECK (t, ROUND_DIV_EXPR) +#define TRUNC_MOD_EXPR_CHECK(t) TREE_CHECK (t, TRUNC_MOD_EXPR) +#define CEIL_MOD_EXPR_CHECK(t) TREE_CHECK (t, CEIL_MOD_EXPR) +#define FLOOR_MOD_EXPR_CHECK(t) TREE_CHECK (t, FLOOR_MOD_EXPR) +#define ROUND_MOD_EXPR_CHECK(t) TREE_CHECK (t, ROUND_MOD_EXPR) +#define RDIV_EXPR_CHECK(t) TREE_CHECK (t, RDIV_EXPR) +#define EXACT_DIV_EXPR_CHECK(t) TREE_CHECK (t, EXACT_DIV_EXPR) +#define FIX_TRUNC_EXPR_CHECK(t) TREE_CHECK (t, FIX_TRUNC_EXPR) +#define FLOAT_EXPR_CHECK(t) TREE_CHECK (t, FLOAT_EXPR) +#define NEGATE_EXPR_CHECK(t) TREE_CHECK (t, NEGATE_EXPR) +#define MIN_EXPR_CHECK(t) TREE_CHECK (t, MIN_EXPR) +#define MAX_EXPR_CHECK(t) TREE_CHECK (t, MAX_EXPR) +#define ABS_EXPR_CHECK(t) TREE_CHECK (t, ABS_EXPR) +#define LSHIFT_EXPR_CHECK(t) TREE_CHECK (t, LSHIFT_EXPR) +#define RSHIFT_EXPR_CHECK(t) TREE_CHECK (t, RSHIFT_EXPR) +#define LROTATE_EXPR_CHECK(t) TREE_CHECK (t, LROTATE_EXPR) +#define RROTATE_EXPR_CHECK(t) TREE_CHECK (t, RROTATE_EXPR) +#define BIT_IOR_EXPR_CHECK(t) TREE_CHECK (t, BIT_IOR_EXPR) +#define BIT_XOR_EXPR_CHECK(t) TREE_CHECK (t, BIT_XOR_EXPR) +#define BIT_AND_EXPR_CHECK(t) TREE_CHECK (t, BIT_AND_EXPR) +#define BIT_NOT_EXPR_CHECK(t) TREE_CHECK (t, BIT_NOT_EXPR) +#define TRUTH_ANDIF_EXPR_CHECK(t) TREE_CHECK (t, TRUTH_ANDIF_EXPR) +#define TRUTH_ORIF_EXPR_CHECK(t) TREE_CHECK (t, TRUTH_ORIF_EXPR) +#define TRUTH_AND_EXPR_CHECK(t) TREE_CHECK (t, TRUTH_AND_EXPR) +#define TRUTH_OR_EXPR_CHECK(t) TREE_CHECK (t, TRUTH_OR_EXPR) +#define TRUTH_XOR_EXPR_CHECK(t) TREE_CHECK (t, TRUTH_XOR_EXPR) +#define TRUTH_NOT_EXPR_CHECK(t) TREE_CHECK (t, TRUTH_NOT_EXPR) +#define LT_EXPR_CHECK(t) TREE_CHECK (t, LT_EXPR) +#define LE_EXPR_CHECK(t) TREE_CHECK (t, LE_EXPR) +#define GT_EXPR_CHECK(t) TREE_CHECK (t, GT_EXPR) +#define GE_EXPR_CHECK(t) TREE_CHECK (t, GE_EXPR) +#define EQ_EXPR_CHECK(t) TREE_CHECK (t, EQ_EXPR) +#define NE_EXPR_CHECK(t) TREE_CHECK (t, NE_EXPR) +#define UNORDERED_EXPR_CHECK(t) TREE_CHECK (t, UNORDERED_EXPR) +#define ORDERED_EXPR_CHECK(t) TREE_CHECK (t, ORDERED_EXPR) +#define UNLT_EXPR_CHECK(t) TREE_CHECK (t, UNLT_EXPR) +#define UNLE_EXPR_CHECK(t) TREE_CHECK (t, UNLE_EXPR) +#define UNGT_EXPR_CHECK(t) TREE_CHECK (t, UNGT_EXPR) +#define UNGE_EXPR_CHECK(t) TREE_CHECK (t, UNGE_EXPR) +#define UNEQ_EXPR_CHECK(t) TREE_CHECK (t, UNEQ_EXPR) +#define LTGT_EXPR_CHECK(t) TREE_CHECK (t, LTGT_EXPR) +#define RANGE_EXPR_CHECK(t) TREE_CHECK (t, RANGE_EXPR) +#define PAREN_EXPR_CHECK(t) TREE_CHECK (t, PAREN_EXPR) +#define CONVERT_EXPR_CHECK(t) TREE_CHECK (t, CONVERT_EXPR) +#define ADDR_SPACE_CONVERT_EXPR_CHECK(t) TREE_CHECK (t, ADDR_SPACE_CONVERT_EXPR) +#define FIXED_CONVERT_EXPR_CHECK(t) TREE_CHECK (t, FIXED_CONVERT_EXPR) +#define NOP_EXPR_CHECK(t) TREE_CHECK (t, NOP_EXPR) +#define NON_LVALUE_EXPR_CHECK(t) TREE_CHECK (t, NON_LVALUE_EXPR) +#define COMPOUND_LITERAL_EXPR_CHECK(t) TREE_CHECK (t, COMPOUND_LITERAL_EXPR) +#define SAVE_EXPR_CHECK(t) TREE_CHECK (t, SAVE_EXPR) +#define ADDR_EXPR_CHECK(t) TREE_CHECK (t, ADDR_EXPR) +#define FDESC_EXPR_CHECK(t) TREE_CHECK (t, FDESC_EXPR) +#define BIT_INSERT_EXPR_CHECK(t) TREE_CHECK (t, BIT_INSERT_EXPR) +#define COMPLEX_EXPR_CHECK(t) TREE_CHECK (t, COMPLEX_EXPR) +#define CONJ_EXPR_CHECK(t) TREE_CHECK (t, CONJ_EXPR) +#define PREDECREMENT_EXPR_CHECK(t) TREE_CHECK (t, PREDECREMENT_EXPR) +#define PREINCREMENT_EXPR_CHECK(t) TREE_CHECK (t, PREINCREMENT_EXPR) +#define POSTDECREMENT_EXPR_CHECK(t) TREE_CHECK (t, POSTDECREMENT_EXPR) +#define POSTINCREMENT_EXPR_CHECK(t) TREE_CHECK (t, POSTINCREMENT_EXPR) +#define VA_ARG_EXPR_CHECK(t) TREE_CHECK (t, VA_ARG_EXPR) +#define TRY_CATCH_EXPR_CHECK(t) TREE_CHECK (t, TRY_CATCH_EXPR) +#define TRY_FINALLY_EXPR_CHECK(t) TREE_CHECK (t, TRY_FINALLY_EXPR) +#define DECL_EXPR_CHECK(t) TREE_CHECK (t, DECL_EXPR) +#define LABEL_EXPR_CHECK(t) TREE_CHECK (t, LABEL_EXPR) +#define GOTO_EXPR_CHECK(t) TREE_CHECK (t, GOTO_EXPR) +#define RETURN_EXPR_CHECK(t) TREE_CHECK (t, RETURN_EXPR) +#define EXIT_EXPR_CHECK(t) TREE_CHECK (t, EXIT_EXPR) +#define LOOP_EXPR_CHECK(t) TREE_CHECK (t, LOOP_EXPR) +#define SWITCH_EXPR_CHECK(t) TREE_CHECK (t, SWITCH_EXPR) +#define CASE_LABEL_EXPR_CHECK(t) TREE_CHECK (t, CASE_LABEL_EXPR) +#define ASM_EXPR_CHECK(t) TREE_CHECK (t, ASM_EXPR) +#define SSA_NAME_CHECK(t) TREE_CHECK (t, SSA_NAME) +#define CATCH_EXPR_CHECK(t) TREE_CHECK (t, CATCH_EXPR) +#define EH_FILTER_EXPR_CHECK(t) TREE_CHECK (t, EH_FILTER_EXPR) +#define SCEV_KNOWN_CHECK(t) TREE_CHECK (t, SCEV_KNOWN) +#define SCEV_NOT_KNOWN_CHECK(t) TREE_CHECK (t, SCEV_NOT_KNOWN) +#define POLYNOMIAL_CHREC_CHECK(t) TREE_CHECK (t, POLYNOMIAL_CHREC) +#define STATEMENT_LIST_CHECK(t) TREE_CHECK (t, STATEMENT_LIST) +#define ASSERT_EXPR_CHECK(t) TREE_CHECK (t, ASSERT_EXPR) +#define TREE_BINFO_CHECK(t) TREE_CHECK (t, TREE_BINFO) +#define WITH_SIZE_EXPR_CHECK(t) TREE_CHECK (t, WITH_SIZE_EXPR) +#define REALIGN_LOAD_EXPR_CHECK(t) TREE_CHECK (t, REALIGN_LOAD_EXPR) +#define TARGET_MEM_REF_CHECK(t) TREE_CHECK (t, TARGET_MEM_REF) +#define MEM_REF_CHECK(t) TREE_CHECK (t, MEM_REF) +#define OACC_PARALLEL_CHECK(t) TREE_CHECK (t, OACC_PARALLEL) +#define OACC_KERNELS_CHECK(t) TREE_CHECK (t, OACC_KERNELS) +#define OACC_DATA_CHECK(t) TREE_CHECK (t, OACC_DATA) +#define OACC_HOST_DATA_CHECK(t) TREE_CHECK (t, OACC_HOST_DATA) +#define OMP_PARALLEL_CHECK(t) TREE_CHECK (t, OMP_PARALLEL) +#define OMP_TASK_CHECK(t) TREE_CHECK (t, OMP_TASK) +#define OMP_FOR_CHECK(t) TREE_CHECK (t, OMP_FOR) +#define OMP_SIMD_CHECK(t) TREE_CHECK (t, OMP_SIMD) +#define CILK_SIMD_CHECK(t) TREE_CHECK (t, CILK_SIMD) +#define CILK_FOR_CHECK(t) TREE_CHECK (t, CILK_FOR) +#define OMP_DISTRIBUTE_CHECK(t) TREE_CHECK (t, OMP_DISTRIBUTE) +#define OMP_TASKLOOP_CHECK(t) TREE_CHECK (t, OMP_TASKLOOP) +#define OACC_LOOP_CHECK(t) TREE_CHECK (t, OACC_LOOP) +#define OMP_TEAMS_CHECK(t) TREE_CHECK (t, OMP_TEAMS) +#define OMP_TARGET_DATA_CHECK(t) TREE_CHECK (t, OMP_TARGET_DATA) +#define OMP_TARGET_CHECK(t) TREE_CHECK (t, OMP_TARGET) +#define OMP_SECTIONS_CHECK(t) TREE_CHECK (t, OMP_SECTIONS) +#define OMP_ORDERED_CHECK(t) TREE_CHECK (t, OMP_ORDERED) +#define OMP_CRITICAL_CHECK(t) TREE_CHECK (t, OMP_CRITICAL) +#define OMP_SINGLE_CHECK(t) TREE_CHECK (t, OMP_SINGLE) +#define OMP_SECTION_CHECK(t) TREE_CHECK (t, OMP_SECTION) +#define OMP_MASTER_CHECK(t) TREE_CHECK (t, OMP_MASTER) +#define OMP_TASKGROUP_CHECK(t) TREE_CHECK (t, OMP_TASKGROUP) +#define OACC_CACHE_CHECK(t) TREE_CHECK (t, OACC_CACHE) +#define OACC_DECLARE_CHECK(t) TREE_CHECK (t, OACC_DECLARE) +#define OACC_ENTER_DATA_CHECK(t) TREE_CHECK (t, OACC_ENTER_DATA) +#define OACC_EXIT_DATA_CHECK(t) TREE_CHECK (t, OACC_EXIT_DATA) +#define OACC_UPDATE_CHECK(t) TREE_CHECK (t, OACC_UPDATE) +#define OMP_TARGET_UPDATE_CHECK(t) TREE_CHECK (t, OMP_TARGET_UPDATE) +#define OMP_TARGET_ENTER_DATA_CHECK(t) TREE_CHECK (t, OMP_TARGET_ENTER_DATA) +#define OMP_TARGET_EXIT_DATA_CHECK(t) TREE_CHECK (t, OMP_TARGET_EXIT_DATA) +#define OMP_ATOMIC_CHECK(t) TREE_CHECK (t, OMP_ATOMIC) +#define OMP_ATOMIC_READ_CHECK(t) TREE_CHECK (t, OMP_ATOMIC_READ) +#define OMP_ATOMIC_CAPTURE_OLD_CHECK(t) TREE_CHECK (t, OMP_ATOMIC_CAPTURE_OLD) +#define OMP_ATOMIC_CAPTURE_NEW_CHECK(t) TREE_CHECK (t, OMP_ATOMIC_CAPTURE_NEW) +#define OMP_CLAUSE_CHECK(t) TREE_CHECK (t, OMP_CLAUSE) +#define TRANSACTION_EXPR_CHECK(t) TREE_CHECK (t, TRANSACTION_EXPR) +#define REDUC_MAX_EXPR_CHECK(t) TREE_CHECK (t, REDUC_MAX_EXPR) +#define REDUC_MIN_EXPR_CHECK(t) TREE_CHECK (t, REDUC_MIN_EXPR) +#define REDUC_PLUS_EXPR_CHECK(t) TREE_CHECK (t, REDUC_PLUS_EXPR) +#define DOT_PROD_EXPR_CHECK(t) TREE_CHECK (t, DOT_PROD_EXPR) +#define WIDEN_SUM_EXPR_CHECK(t) TREE_CHECK (t, WIDEN_SUM_EXPR) +#define SAD_EXPR_CHECK(t) TREE_CHECK (t, SAD_EXPR) +#define WIDEN_MULT_EXPR_CHECK(t) TREE_CHECK (t, WIDEN_MULT_EXPR) +#define WIDEN_MULT_PLUS_EXPR_CHECK(t) TREE_CHECK (t, WIDEN_MULT_PLUS_EXPR) +#define WIDEN_MULT_MINUS_EXPR_CHECK(t) TREE_CHECK (t, WIDEN_MULT_MINUS_EXPR) +#define WIDEN_LSHIFT_EXPR_CHECK(t) TREE_CHECK (t, WIDEN_LSHIFT_EXPR) +#define FMA_EXPR_CHECK(t) TREE_CHECK (t, FMA_EXPR) +#define VEC_WIDEN_MULT_HI_EXPR_CHECK(t) TREE_CHECK (t, VEC_WIDEN_MULT_HI_EXPR) +#define VEC_WIDEN_MULT_LO_EXPR_CHECK(t) TREE_CHECK (t, VEC_WIDEN_MULT_LO_EXPR) +#define VEC_WIDEN_MULT_EVEN_EXPR_CHECK(t) TREE_CHECK (t, VEC_WIDEN_MULT_EVEN_EXPR) +#define VEC_WIDEN_MULT_ODD_EXPR_CHECK(t) TREE_CHECK (t, VEC_WIDEN_MULT_ODD_EXPR) +#define VEC_UNPACK_HI_EXPR_CHECK(t) TREE_CHECK (t, VEC_UNPACK_HI_EXPR) +#define VEC_UNPACK_LO_EXPR_CHECK(t) TREE_CHECK (t, VEC_UNPACK_LO_EXPR) +#define VEC_UNPACK_FLOAT_HI_EXPR_CHECK(t) TREE_CHECK (t, VEC_UNPACK_FLOAT_HI_EXPR) +#define VEC_UNPACK_FLOAT_LO_EXPR_CHECK(t) TREE_CHECK (t, VEC_UNPACK_FLOAT_LO_EXPR) +#define VEC_PACK_TRUNC_EXPR_CHECK(t) TREE_CHECK (t, VEC_PACK_TRUNC_EXPR) +#define VEC_PACK_SAT_EXPR_CHECK(t) TREE_CHECK (t, VEC_PACK_SAT_EXPR) +#define VEC_PACK_FIX_TRUNC_EXPR_CHECK(t) TREE_CHECK (t, VEC_PACK_FIX_TRUNC_EXPR) +#define VEC_WIDEN_LSHIFT_HI_EXPR_CHECK(t) TREE_CHECK (t, VEC_WIDEN_LSHIFT_HI_EXPR) +#define VEC_WIDEN_LSHIFT_LO_EXPR_CHECK(t) TREE_CHECK (t, VEC_WIDEN_LSHIFT_LO_EXPR) +#define PREDICT_EXPR_CHECK(t) TREE_CHECK (t, PREDICT_EXPR) +#define OPTIMIZATION_NODE_CHECK(t) TREE_CHECK (t, OPTIMIZATION_NODE) +#define TARGET_OPTION_NODE_CHECK(t) TREE_CHECK (t, TARGET_OPTION_NODE) +#define ANNOTATE_EXPR_CHECK(t) TREE_CHECK (t, ANNOTATE_EXPR) +#define CILK_SPAWN_STMT_CHECK(t) TREE_CHECK (t, CILK_SPAWN_STMT) +#define CILK_SYNC_STMT_CHECK(t) TREE_CHECK (t, CILK_SYNC_STMT) +#define C_MAYBE_CONST_EXPR_CHECK(t) TREE_CHECK (t, C_MAYBE_CONST_EXPR) +#define EXCESS_PRECISION_EXPR_CHECK(t) TREE_CHECK (t, EXCESS_PRECISION_EXPR) +#define USERDEF_LITERAL_CHECK(t) TREE_CHECK (t, USERDEF_LITERAL) +#define SIZEOF_EXPR_CHECK(t) TREE_CHECK (t, SIZEOF_EXPR) +#define ARRAY_NOTATION_REF_CHECK(t) TREE_CHECK (t, ARRAY_NOTATION_REF) +#define UNCONSTRAINED_ARRAY_TYPE_CHECK(t) TREE_CHECK (t, UNCONSTRAINED_ARRAY_TYPE) +#define UNCONSTRAINED_ARRAY_REF_CHECK(t) TREE_CHECK (t, UNCONSTRAINED_ARRAY_REF) +#define NULL_EXPR_CHECK(t) TREE_CHECK (t, NULL_EXPR) +#define PLUS_NOMOD_EXPR_CHECK(t) TREE_CHECK (t, PLUS_NOMOD_EXPR) +#define MINUS_NOMOD_EXPR_CHECK(t) TREE_CHECK (t, MINUS_NOMOD_EXPR) +#define POWER_EXPR_CHECK(t) TREE_CHECK (t, POWER_EXPR) +#define ATTR_ADDR_EXPR_CHECK(t) TREE_CHECK (t, ATTR_ADDR_EXPR) +#define STMT_STMT_CHECK(t) TREE_CHECK (t, STMT_STMT) +#define LOOP_STMT_CHECK(t) TREE_CHECK (t, LOOP_STMT) +#define EXIT_STMT_CHECK(t) TREE_CHECK (t, EXIT_STMT) +#define OFFSET_REF_CHECK(t) TREE_CHECK (t, OFFSET_REF) +#define PTRMEM_CST_CHECK(t) TREE_CHECK (t, PTRMEM_CST) +#define NEW_EXPR_CHECK(t) TREE_CHECK (t, NEW_EXPR) +#define VEC_NEW_EXPR_CHECK(t) TREE_CHECK (t, VEC_NEW_EXPR) +#define DELETE_EXPR_CHECK(t) TREE_CHECK (t, DELETE_EXPR) +#define VEC_DELETE_EXPR_CHECK(t) TREE_CHECK (t, VEC_DELETE_EXPR) +#define SCOPE_REF_CHECK(t) TREE_CHECK (t, SCOPE_REF) +#define MEMBER_REF_CHECK(t) TREE_CHECK (t, MEMBER_REF) +#define TYPE_EXPR_CHECK(t) TREE_CHECK (t, TYPE_EXPR) +#define AGGR_INIT_EXPR_CHECK(t) TREE_CHECK (t, AGGR_INIT_EXPR) +#define VEC_INIT_EXPR_CHECK(t) TREE_CHECK (t, VEC_INIT_EXPR) +#define THROW_EXPR_CHECK(t) TREE_CHECK (t, THROW_EXPR) +#define EMPTY_CLASS_EXPR_CHECK(t) TREE_CHECK (t, EMPTY_CLASS_EXPR) +#define BASELINK_CHECK(t) TREE_CHECK (t, BASELINK) +#define TEMPLATE_DECL_CHECK(t) TREE_CHECK (t, TEMPLATE_DECL) +#define TEMPLATE_PARM_INDEX_CHECK(t) TREE_CHECK (t, TEMPLATE_PARM_INDEX) +#define TEMPLATE_TEMPLATE_PARM_CHECK(t) TREE_CHECK (t, TEMPLATE_TEMPLATE_PARM) +#define TEMPLATE_TYPE_PARM_CHECK(t) TREE_CHECK (t, TEMPLATE_TYPE_PARM) +#define TYPENAME_TYPE_CHECK(t) TREE_CHECK (t, TYPENAME_TYPE) +#define TYPEOF_TYPE_CHECK(t) TREE_CHECK (t, TYPEOF_TYPE) +#define BOUND_TEMPLATE_TEMPLATE_PARM_CHECK(t) TREE_CHECK (t, BOUND_TEMPLATE_TEMPLATE_PARM) +#define UNBOUND_CLASS_TEMPLATE_CHECK(t) TREE_CHECK (t, UNBOUND_CLASS_TEMPLATE) +#define USING_DECL_CHECK(t) TREE_CHECK (t, USING_DECL) +#define USING_STMT_CHECK(t) TREE_CHECK (t, USING_STMT) +#define DEFAULT_ARG_CHECK(t) TREE_CHECK (t, DEFAULT_ARG) +#define DEFERRED_NOEXCEPT_CHECK(t) TREE_CHECK (t, DEFERRED_NOEXCEPT) +#define TEMPLATE_ID_EXPR_CHECK(t) TREE_CHECK (t, TEMPLATE_ID_EXPR) +#define OVERLOAD_CHECK(t) TREE_CHECK (t, OVERLOAD) +#define PSEUDO_DTOR_EXPR_CHECK(t) TREE_CHECK (t, PSEUDO_DTOR_EXPR) +#define MODOP_EXPR_CHECK(t) TREE_CHECK (t, MODOP_EXPR) +#define CAST_EXPR_CHECK(t) TREE_CHECK (t, CAST_EXPR) +#define REINTERPRET_CAST_EXPR_CHECK(t) TREE_CHECK (t, REINTERPRET_CAST_EXPR) +#define CONST_CAST_EXPR_CHECK(t) TREE_CHECK (t, CONST_CAST_EXPR) +#define STATIC_CAST_EXPR_CHECK(t) TREE_CHECK (t, STATIC_CAST_EXPR) +#define DYNAMIC_CAST_EXPR_CHECK(t) TREE_CHECK (t, DYNAMIC_CAST_EXPR) +#define IMPLICIT_CONV_EXPR_CHECK(t) TREE_CHECK (t, IMPLICIT_CONV_EXPR) +#define DOTSTAR_EXPR_CHECK(t) TREE_CHECK (t, DOTSTAR_EXPR) +#define TYPEID_EXPR_CHECK(t) TREE_CHECK (t, TYPEID_EXPR) +#define NOEXCEPT_EXPR_CHECK(t) TREE_CHECK (t, NOEXCEPT_EXPR) +#define NON_DEPENDENT_EXPR_CHECK(t) TREE_CHECK (t, NON_DEPENDENT_EXPR) +#define CTOR_INITIALIZER_CHECK(t) TREE_CHECK (t, CTOR_INITIALIZER) +#define TRY_BLOCK_CHECK(t) TREE_CHECK (t, TRY_BLOCK) +#define EH_SPEC_BLOCK_CHECK(t) TREE_CHECK (t, EH_SPEC_BLOCK) +#define HANDLER_CHECK(t) TREE_CHECK (t, HANDLER) +#define MUST_NOT_THROW_EXPR_CHECK(t) TREE_CHECK (t, MUST_NOT_THROW_EXPR) +#define CLEANUP_STMT_CHECK(t) TREE_CHECK (t, CLEANUP_STMT) +#define IF_STMT_CHECK(t) TREE_CHECK (t, IF_STMT) +#define FOR_STMT_CHECK(t) TREE_CHECK (t, FOR_STMT) +#define RANGE_FOR_STMT_CHECK(t) TREE_CHECK (t, RANGE_FOR_STMT) +#define WHILE_STMT_CHECK(t) TREE_CHECK (t, WHILE_STMT) +#define DO_STMT_CHECK(t) TREE_CHECK (t, DO_STMT) +#define BREAK_STMT_CHECK(t) TREE_CHECK (t, BREAK_STMT) +#define CONTINUE_STMT_CHECK(t) TREE_CHECK (t, CONTINUE_STMT) +#define SWITCH_STMT_CHECK(t) TREE_CHECK (t, SWITCH_STMT) +#define EXPR_STMT_CHECK(t) TREE_CHECK (t, EXPR_STMT) +#define TAG_DEFN_CHECK(t) TREE_CHECK (t, TAG_DEFN) +#define OFFSETOF_EXPR_CHECK(t) TREE_CHECK (t, OFFSETOF_EXPR) +#define ADDRESSOF_EXPR_CHECK(t) TREE_CHECK (t, ADDRESSOF_EXPR) +#define ARROW_EXPR_CHECK(t) TREE_CHECK (t, ARROW_EXPR) +#define ALIGNOF_EXPR_CHECK(t) TREE_CHECK (t, ALIGNOF_EXPR) +#define AT_ENCODE_EXPR_CHECK(t) TREE_CHECK (t, AT_ENCODE_EXPR) +#define STMT_EXPR_CHECK(t) TREE_CHECK (t, STMT_EXPR) +#define UNARY_PLUS_EXPR_CHECK(t) TREE_CHECK (t, UNARY_PLUS_EXPR) +#define STATIC_ASSERT_CHECK(t) TREE_CHECK (t, STATIC_ASSERT) +#define TYPE_ARGUMENT_PACK_CHECK(t) TREE_CHECK (t, TYPE_ARGUMENT_PACK) +#define NONTYPE_ARGUMENT_PACK_CHECK(t) TREE_CHECK (t, NONTYPE_ARGUMENT_PACK) +#define TYPE_PACK_EXPANSION_CHECK(t) TREE_CHECK (t, TYPE_PACK_EXPANSION) +#define EXPR_PACK_EXPANSION_CHECK(t) TREE_CHECK (t, EXPR_PACK_EXPANSION) +#define ARGUMENT_PACK_SELECT_CHECK(t) TREE_CHECK (t, ARGUMENT_PACK_SELECT) +#define UNARY_LEFT_FOLD_EXPR_CHECK(t) TREE_CHECK (t, UNARY_LEFT_FOLD_EXPR) +#define UNARY_RIGHT_FOLD_EXPR_CHECK(t) TREE_CHECK (t, UNARY_RIGHT_FOLD_EXPR) +#define BINARY_LEFT_FOLD_EXPR_CHECK(t) TREE_CHECK (t, BINARY_LEFT_FOLD_EXPR) +#define BINARY_RIGHT_FOLD_EXPR_CHECK(t) TREE_CHECK (t, BINARY_RIGHT_FOLD_EXPR) +#define TRAIT_EXPR_CHECK(t) TREE_CHECK (t, TRAIT_EXPR) +#define LAMBDA_EXPR_CHECK(t) TREE_CHECK (t, LAMBDA_EXPR) +#define DECLTYPE_TYPE_CHECK(t) TREE_CHECK (t, DECLTYPE_TYPE) +#define UNDERLYING_TYPE_CHECK(t) TREE_CHECK (t, UNDERLYING_TYPE) +#define BASES_CHECK(t) TREE_CHECK (t, BASES) +#define TEMPLATE_INFO_CHECK(t) TREE_CHECK (t, TEMPLATE_INFO) +#define CONSTRAINT_INFO_CHECK(t) TREE_CHECK (t, CONSTRAINT_INFO) +#define WILDCARD_DECL_CHECK(t) TREE_CHECK (t, WILDCARD_DECL) +#define REQUIRES_EXPR_CHECK(t) TREE_CHECK (t, REQUIRES_EXPR) +#define SIMPLE_REQ_CHECK(t) TREE_CHECK (t, SIMPLE_REQ) +#define TYPE_REQ_CHECK(t) TREE_CHECK (t, TYPE_REQ) +#define COMPOUND_REQ_CHECK(t) TREE_CHECK (t, COMPOUND_REQ) +#define NESTED_REQ_CHECK(t) TREE_CHECK (t, NESTED_REQ) +#define PRED_CONSTR_CHECK(t) TREE_CHECK (t, PRED_CONSTR) +#define CHECK_CONSTR_CHECK(t) TREE_CHECK (t, CHECK_CONSTR) +#define EXPR_CONSTR_CHECK(t) TREE_CHECK (t, EXPR_CONSTR) +#define TYPE_CONSTR_CHECK(t) TREE_CHECK (t, TYPE_CONSTR) +#define ICONV_CONSTR_CHECK(t) TREE_CHECK (t, ICONV_CONSTR) +#define DEDUCT_CONSTR_CHECK(t) TREE_CHECK (t, DEDUCT_CONSTR) +#define EXCEPT_CONSTR_CHECK(t) TREE_CHECK (t, EXCEPT_CONSTR) +#define PARM_CONSTR_CHECK(t) TREE_CHECK (t, PARM_CONSTR) +#define CONJ_CONSTR_CHECK(t) TREE_CHECK (t, CONJ_CONSTR) +#define DISJ_CONSTR_CHECK(t) TREE_CHECK (t, DISJ_CONSTR) +#define CLASS_INTERFACE_TYPE_CHECK(t) TREE_CHECK (t, CLASS_INTERFACE_TYPE) +#define CLASS_IMPLEMENTATION_TYPE_CHECK(t) TREE_CHECK (t, CLASS_IMPLEMENTATION_TYPE) +#define CATEGORY_INTERFACE_TYPE_CHECK(t) TREE_CHECK (t, CATEGORY_INTERFACE_TYPE) +#define CATEGORY_IMPLEMENTATION_TYPE_CHECK(t) TREE_CHECK (t, CATEGORY_IMPLEMENTATION_TYPE) +#define PROTOCOL_INTERFACE_TYPE_CHECK(t) TREE_CHECK (t, PROTOCOL_INTERFACE_TYPE) +#define KEYWORD_DECL_CHECK(t) TREE_CHECK (t, KEYWORD_DECL) +#define INSTANCE_METHOD_DECL_CHECK(t) TREE_CHECK (t, INSTANCE_METHOD_DECL) +#define CLASS_METHOD_DECL_CHECK(t) TREE_CHECK (t, CLASS_METHOD_DECL) +#define PROPERTY_DECL_CHECK(t) TREE_CHECK (t, PROPERTY_DECL) +#define MESSAGE_SEND_EXPR_CHECK(t) TREE_CHECK (t, MESSAGE_SEND_EXPR) +#define CLASS_REFERENCE_EXPR_CHECK(t) TREE_CHECK (t, CLASS_REFERENCE_EXPR) +#define PROPERTY_REF_CHECK(t) TREE_CHECK (t, PROPERTY_REF) + +#endif /* GCC_TREE_CHECK_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-chkp.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-chkp.h new file mode 100644 index 0000000..1411054 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-chkp.h @@ -0,0 +1,64 @@ +/* Declaration of interface functions of Pointer Bounds Checker. + Copyright (C) 2014-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_CHKP_H +#define GCC_TREE_CHKP_H + +#define DECL_BOUNDS(NODE) (chkp_get_bounds (DECL_WRTL_CHECK (NODE))) + +#define SET_DECL_BOUNDS(NODE, VAL) \ + (chkp_set_bounds (DECL_WRTL_CHECK (NODE), VAL)) + +extern tree chkp_get_bounds (tree node); +extern void chkp_set_bounds (tree node, tree val); +extern bool chkp_register_var_initializer (tree var); +extern void chkp_finish_file (void); +extern bool chkp_type_has_pointer (const_tree type); +extern unsigned chkp_type_bounds_count (const_tree type); +extern tree chkp_make_bounds_for_struct_addr (tree ptr); +extern tree chkp_get_zero_bounds_var (void); +extern tree chkp_get_none_bounds_var (void); +extern void chkp_check_mem_access (tree first, tree last, tree bounds, + gimple_stmt_iterator iter, + location_t location, + tree dirflag); +extern void chkp_fix_cfg (void); +extern bool chkp_variable_size_type (tree type); +extern tree chkp_build_make_bounds_call (tree lb, tree size); +extern tree chkp_build_bndldx_call (tree addr, tree ptr); +extern tree chkp_build_bndstx_call (tree addr, tree ptr, tree bounds); +extern void chkp_find_bound_slots (const_tree type, bitmap res); +extern void chkp_build_bndstx (tree addr, tree ptr, tree bounds, + gimple_stmt_iterator *gsi); +extern gcall *chkp_retbnd_call_by_val (tree val); +extern bool chkp_function_instrumented_p (tree fndecl); +extern void chkp_function_mark_instrumented (tree fndecl); +extern void chkp_copy_bounds_for_assign (gimple *assign, + struct cgraph_edge *edge); +extern bool chkp_gimple_call_builtin_p (gimple *call, + enum built_in_function code); +extern rtx chkp_expand_zero_bounds (void); +extern void chkp_expand_bounds_reset_for_mem (tree mem, tree ptr); +extern tree chkp_insert_retbnd_call (tree bndval, tree retval, + gimple_stmt_iterator *gsi); +extern gcall *chkp_copy_call_skip_bounds (gcall *call); +extern bool chkp_redirect_edge (cgraph_edge *e); +extern void chkp_fixup_inlined_call (tree lhs, tree rhs); + +#endif /* GCC_TREE_CHKP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-chrec.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-chrec.h new file mode 100644 index 0000000..e980ec1 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-chrec.h @@ -0,0 +1,257 @@ +/* Chains of recurrences. + Copyright (C) 2003-2017 Free Software Foundation, Inc. + Contributed by Sebastian Pop + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_CHREC_H +#define GCC_TREE_CHREC_H + +/* The following trees are unique elements. Thus the comparison of another + element to these elements should be done on the pointer to these trees, + and not on their value. */ + +extern tree chrec_not_analyzed_yet; +extern GTY(()) tree chrec_dont_know; +extern GTY(()) tree chrec_known; + +/* After having added an automatically generated element, please + include it in the following function. */ + +static inline bool +automatically_generated_chrec_p (const_tree chrec) +{ + return (chrec == chrec_dont_know + || chrec == chrec_known); +} + +/* The tree nodes aka. CHRECs. */ + +static inline bool +tree_is_chrec (const_tree expr) +{ + if (TREE_CODE (expr) == POLYNOMIAL_CHREC + || automatically_generated_chrec_p (expr)) + return true; + else + return false; +} + + +enum ev_direction {EV_DIR_GROWS, EV_DIR_DECREASES, EV_DIR_UNKNOWN}; +enum ev_direction scev_direction (const_tree); + +/* Chrec folding functions. */ +extern tree chrec_fold_plus (tree, tree, tree); +extern tree chrec_fold_minus (tree, tree, tree); +extern tree chrec_fold_multiply (tree, tree, tree); +extern tree chrec_convert (tree, tree, gimple *, bool = true, tree = NULL); +extern tree chrec_convert_rhs (tree, tree, gimple *); +extern tree chrec_convert_aggressive (tree, tree, bool *); + +/* Operations. */ +extern tree chrec_apply (unsigned, tree, tree); +extern tree chrec_apply_map (tree, vec ); +extern tree chrec_replace_initial_condition (tree, tree); +extern tree initial_condition (tree); +extern tree initial_condition_in_loop_num (tree, unsigned); +extern tree evolution_part_in_loop_num (tree, unsigned); +extern tree hide_evolution_in_other_loops_than_loop (tree, unsigned); +extern tree reset_evolution_in_loop (unsigned, tree, tree); +extern tree chrec_merge (tree, tree); +extern void for_each_scev_op (tree *, bool (*) (tree *, void *), void *); +extern bool convert_affine_scev (struct loop *, tree, tree *, tree *, gimple *, + bool, tree = NULL); + +/* Observers. */ +extern bool eq_evolutions_p (const_tree, const_tree); +extern bool is_multivariate_chrec (const_tree); +extern bool chrec_contains_symbols (const_tree); +extern bool chrec_contains_symbols_defined_in_loop (const_tree, unsigned); +extern bool chrec_contains_undetermined (const_tree); +extern bool tree_contains_chrecs (const_tree, int *); +extern bool evolution_function_is_affine_multivariate_p (const_tree, int); +extern bool evolution_function_is_univariate_p (const_tree); +extern unsigned nb_vars_in_chrec (tree); +extern bool evolution_function_is_invariant_p (tree, int); +extern bool scev_is_linear_expression (tree); +extern bool evolution_function_right_is_integer_cst (const_tree); + +/* Determines whether CHREC is equal to zero. */ + +static inline bool +chrec_zerop (const_tree chrec) +{ + if (chrec == NULL_TREE) + return false; + + if (TREE_CODE (chrec) == INTEGER_CST) + return integer_zerop (chrec); + + return false; +} + +/* Determines whether CHREC is a loop invariant with respect to LOOP_NUM. + Set the result in RES and return true when the property can be computed. */ + +static inline bool +no_evolution_in_loop_p (tree chrec, unsigned loop_num, bool *res) +{ + tree scev; + + if (chrec == chrec_not_analyzed_yet + || chrec == chrec_dont_know + || chrec_contains_symbols_defined_in_loop (chrec, loop_num)) + return false; + + STRIP_NOPS (chrec); + scev = hide_evolution_in_other_loops_than_loop (chrec, loop_num); + *res = !tree_contains_chrecs (scev, NULL); + return true; +} + +/* Build a polynomial chain of recurrence. */ + +static inline tree +build_polynomial_chrec (unsigned loop_num, + tree left, + tree right) +{ + bool val; + + if (left == chrec_dont_know + || right == chrec_dont_know) + return chrec_dont_know; + + if (!no_evolution_in_loop_p (left, loop_num, &val) + || !val) + return chrec_dont_know; + + /* Types of left and right sides of a chrec should be compatible, but + pointer CHRECs are special in that the evolution is of ptroff type. */ + if (POINTER_TYPE_P (TREE_TYPE (left))) + gcc_checking_assert (ptrofftype_p (TREE_TYPE (right))); + else + { + /* Pointer types should occur only on the left hand side, i.e. in + the base of the chrec, and not in the step. */ + gcc_checking_assert (!POINTER_TYPE_P (TREE_TYPE (right)) + && types_compatible_p (TREE_TYPE (left), + TREE_TYPE (right))); + } + + if (chrec_zerop (right)) + return left; + + return build3 (POLYNOMIAL_CHREC, TREE_TYPE (left), + build_int_cst (NULL_TREE, loop_num), left, right); +} + +/* Determines whether the expression CHREC is a constant. */ + +static inline bool +evolution_function_is_constant_p (const_tree chrec) +{ + if (chrec == NULL_TREE) + return false; + + switch (TREE_CODE (chrec)) + { + case INTEGER_CST: + case REAL_CST: + return true; + + default: + return false; + } +} + +/* Determine whether CHREC is an affine evolution function in LOOPNUM. */ + +static inline bool +evolution_function_is_affine_in_loop (const_tree chrec, int loopnum) +{ + if (chrec == NULL_TREE) + return false; + + switch (TREE_CODE (chrec)) + { + case POLYNOMIAL_CHREC: + if (evolution_function_is_invariant_p (CHREC_LEFT (chrec), loopnum) + && evolution_function_is_invariant_p (CHREC_RIGHT (chrec), loopnum)) + return true; + else + return false; + + default: + return false; + } +} + +/* Determine whether CHREC is an affine evolution function or not. */ + +static inline bool +evolution_function_is_affine_p (const_tree chrec) +{ + return chrec + && TREE_CODE (chrec) == POLYNOMIAL_CHREC + && evolution_function_is_invariant_p (CHREC_RIGHT (chrec), + CHREC_VARIABLE (chrec)) + && (TREE_CODE (CHREC_RIGHT (chrec)) != POLYNOMIAL_CHREC + || evolution_function_is_affine_p (CHREC_RIGHT (chrec))); +} + +/* Determines whether EXPR does not contains chrec expressions. */ + +static inline bool +tree_does_not_contain_chrecs (const_tree expr) +{ + return !tree_contains_chrecs (expr, NULL); +} + +/* Returns the type of the chrec. */ + +static inline tree +chrec_type (const_tree chrec) +{ + if (automatically_generated_chrec_p (chrec)) + return NULL_TREE; + + return TREE_TYPE (chrec); +} + +static inline tree +chrec_fold_op (enum tree_code code, tree type, tree op0, tree op1) +{ + switch (code) + { + case PLUS_EXPR: + return chrec_fold_plus (type, op0, op1); + + case MINUS_EXPR: + return chrec_fold_minus (type, op0, op1); + + case MULT_EXPR: + return chrec_fold_multiply (type, op0, op1); + + default: + gcc_unreachable (); + } + +} + +#endif /* GCC_TREE_CHREC_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-core.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-core.h new file mode 100644 index 0000000..a646ecb --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-core.h @@ -0,0 +1,2100 @@ +/* Core data structures for the 'tree' type. + Copyright (C) 1989-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_CORE_H +#define GCC_TREE_CORE_H + +#include "symtab.h" + +/* This file contains all the data structures that define the 'tree' type. + There are no accessor macros nor functions in this file. Only the + basic data structures, extern declarations and type definitions. */ + +/*--------------------------------------------------------------------------- + Forward type declarations. Mostly to avoid including unnecessary headers +---------------------------------------------------------------------------*/ +struct function; +struct real_value; +struct fixed_value; +struct ptr_info_def; +struct range_info_def; +struct die_struct; + + +/*--------------------------------------------------------------------------- + #defined constants +---------------------------------------------------------------------------*/ +/* Nonzero if this is a call to a function whose return value depends + solely on its arguments, has no side effects, and does not read + global memory. This corresponds to TREE_READONLY for function + decls. */ +#define ECF_CONST (1 << 0) + +/* Nonzero if this is a call to "pure" function (like const function, + but may read memory. This corresponds to DECL_PURE_P for function + decls. */ +#define ECF_PURE (1 << 1) + +/* Nonzero if this is ECF_CONST or ECF_PURE but cannot be proven to no + infinite loop. This corresponds to DECL_LOOPING_CONST_OR_PURE_P + for function decls.*/ +#define ECF_LOOPING_CONST_OR_PURE (1 << 2) + +/* Nonzero if this call will never return. */ +#define ECF_NORETURN (1 << 3) + +/* Nonzero if this is a call to malloc or a related function. */ +#define ECF_MALLOC (1 << 4) + +/* Nonzero if it is plausible that this is a call to alloca. */ +#define ECF_MAY_BE_ALLOCA (1 << 5) + +/* Nonzero if this is a call to a function that won't throw an exception. */ +#define ECF_NOTHROW (1 << 6) + +/* Nonzero if this is a call to setjmp or a related function. */ +#define ECF_RETURNS_TWICE (1 << 7) + +/* Nonzero if this call replaces the current stack frame. */ +#define ECF_SIBCALL (1 << 8) + +/* Function does not read or write memory (but may have side effects, so + it does not necessarily fit ECF_CONST). */ +#define ECF_NOVOPS (1 << 9) + +/* The function does not lead to calls within current function unit. */ +#define ECF_LEAF (1 << 10) + +/* Nonzero if this call returns its first argument. */ +#define ECF_RET1 (1 << 11) + +/* Nonzero if this call does not affect transactions. */ +#define ECF_TM_PURE (1 << 12) + +/* Nonzero if this call is into the transaction runtime library. */ +#define ECF_TM_BUILTIN (1 << 13) + +/* Nonzero if this is an indirect call by descriptor. */ +#define ECF_BY_DESCRIPTOR (1 << 14) + +/* Call argument flags. */ +/* Nonzero if the argument is not dereferenced recursively, thus only + directly reachable memory is read or written. */ +#define EAF_DIRECT (1 << 0) + +/* Nonzero if memory reached by the argument is not clobbered. */ +#define EAF_NOCLOBBER (1 << 1) + +/* Nonzero if the argument does not escape. */ +#define EAF_NOESCAPE (1 << 2) + +/* Nonzero if the argument is not used by the function. */ +#define EAF_UNUSED (1 << 3) + +/* Call return flags. */ +/* Mask for the argument number that is returned. Lower two bits of + the return flags, encodes argument slots zero to three. */ +#define ERF_RETURN_ARG_MASK (3) + +/* Nonzero if the return value is equal to the argument number + flags & ERF_RETURN_ARG_MASK. */ +#define ERF_RETURNS_ARG (1 << 2) + +/* Nonzero if the return value does not alias with anything. Functions + with the malloc attribute have this set on their return value. */ +#define ERF_NOALIAS (1 << 3) + + +/*--------------------------------------------------------------------------- + Enumerations +---------------------------------------------------------------------------*/ +/* Codes of tree nodes. */ +#define DEFTREECODE(SYM, STRING, TYPE, NARGS) SYM, +#define END_OF_BASE_TREE_CODES LAST_AND_UNUSED_TREE_CODE, + +enum tree_code { +#include "all-tree.def" +MAX_TREE_CODES +}; + +#undef DEFTREECODE +#undef END_OF_BASE_TREE_CODES + +/* Number of language-independent tree codes. */ +#define NUM_TREE_CODES \ + ((int) LAST_AND_UNUSED_TREE_CODE) + +#define CODE_CONTAINS_STRUCT(CODE, STRUCT) \ + (tree_contains_struct[(CODE)][(STRUCT)]) + + +/* Classify which part of the compiler has defined a given builtin function. + Note that we assume below that this is no more than two bits. */ +enum built_in_class { + NOT_BUILT_IN = 0, + BUILT_IN_FRONTEND, + BUILT_IN_MD, + BUILT_IN_NORMAL +}; + +/* Last marker used for LTO stremaing of built_in_class. We can not add it + to the enum since we need the enumb to fit in 2 bits. */ +#define BUILT_IN_LAST (BUILT_IN_NORMAL + 1) + +/* Codes that identify the various built in functions + so that expand_call can identify them quickly. */ +#define DEF_BUILTIN(ENUM, N, C, T, LT, B, F, NA, AT, IM, COND) ENUM, +enum built_in_function { +#include "builtins.def" + + BEGIN_CHKP_BUILTINS, + +#define DEF_BUILTIN(ENUM, N, C, T, LT, B, F, NA, AT, IM, COND) +#define DEF_BUILTIN_CHKP(ENUM, N, C, T, LT, B, F, NA, AT, IM, COND) \ + ENUM##_CHKP = ENUM + BEGIN_CHKP_BUILTINS + 1, +#include "builtins.def" + + END_CHKP_BUILTINS = BEGIN_CHKP_BUILTINS * 2 + 1, + + /* Complex division routines in libgcc. These are done via builtins + because emit_library_call_value can't handle complex values. */ + BUILT_IN_COMPLEX_MUL_MIN, + BUILT_IN_COMPLEX_MUL_MAX + = BUILT_IN_COMPLEX_MUL_MIN + + MAX_MODE_COMPLEX_FLOAT + - MIN_MODE_COMPLEX_FLOAT, + + BUILT_IN_COMPLEX_DIV_MIN, + BUILT_IN_COMPLEX_DIV_MAX + = BUILT_IN_COMPLEX_DIV_MIN + + MAX_MODE_COMPLEX_FLOAT + - MIN_MODE_COMPLEX_FLOAT, + + /* Upper bound on non-language-specific builtins. */ + END_BUILTINS +}; + +/* Internal functions. */ +enum internal_fn { +#define DEF_INTERNAL_FN(CODE, FLAGS, FNSPEC) IFN_##CODE, +#include "internal-fn.def" + IFN_LAST +}; + +/* An enum that combines target-independent built-in functions with + internal functions, so that they can be treated in a similar way. + The numbers for built-in functions are the same as for the + built_in_function enum. The numbers for internal functions + start at END_BUITLINS. */ +enum combined_fn { +#define DEF_BUILTIN(ENUM, N, C, T, LT, B, F, NA, AT, IM, COND) \ + CFN_##ENUM = int (ENUM), +#include "builtins.def" + +#define DEF_BUILTIN(ENUM, N, C, T, LT, B, F, NA, AT, IM, COND) +#define DEF_BUILTIN_CHKP(ENUM, N, C, T, LT, B, F, NA, AT, IM, COND) \ + CFN_##ENUM##_CHKP = int (ENUM##_CHKP), +#include "builtins.def" + +#define DEF_INTERNAL_FN(CODE, FLAGS, FNSPEC) \ + CFN_##CODE = int (END_BUILTINS) + int (IFN_##CODE), +#include "internal-fn.def" + + CFN_LAST +}; + +/* Tree code classes. Each tree_code has an associated code class + represented by a TREE_CODE_CLASS. */ +enum tree_code_class { + tcc_exceptional, /* An exceptional code (fits no category). */ + tcc_constant, /* A constant. */ + /* Order of tcc_type and tcc_declaration is important. */ + tcc_type, /* A type object code. */ + tcc_declaration, /* A declaration (also serving as variable refs). */ + tcc_reference, /* A reference to storage. */ + tcc_comparison, /* A comparison expression. */ + tcc_unary, /* A unary arithmetic expression. */ + tcc_binary, /* A binary arithmetic expression. */ + tcc_statement, /* A statement expression, which have side effects + but usually no interesting value. */ + tcc_vl_exp, /* A function call or other expression with a + variable-length operand vector. */ + tcc_expression /* Any other expression. */ +}; + +/* OMP_CLAUSE codes. Do not reorder, as this is used to index into + the tables omp_clause_num_ops and omp_clause_code_name. */ +enum omp_clause_code { + /* Clause zero is special-cased inside the parser + (c_parser_omp_variable_list). */ + OMP_CLAUSE_ERROR = 0, + + /* OpenACC/OpenMP clause: private (variable_list). */ + OMP_CLAUSE_PRIVATE, + + /* OpenMP clause: shared (variable_list). */ + OMP_CLAUSE_SHARED, + + /* OpenACC/OpenMP clause: firstprivate (variable_list). */ + OMP_CLAUSE_FIRSTPRIVATE, + + /* OpenMP clause: lastprivate (variable_list). */ + OMP_CLAUSE_LASTPRIVATE, + + /* OpenACC/OpenMP clause: reduction (operator:variable_list). + OMP_CLAUSE_REDUCTION_CODE: The tree_code of the operator. + Operand 1: OMP_CLAUSE_REDUCTION_INIT: Stmt-list to initialize the var. + Operand 2: OMP_CLAUSE_REDUCTION_MERGE: Stmt-list to merge private var + into the shared one. + Operand 3: OMP_CLAUSE_REDUCTION_PLACEHOLDER: A dummy VAR_DECL + placeholder used in OMP_CLAUSE_REDUCTION_{INIT,MERGE}. + Operand 4: OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER: Another dummy + VAR_DECL placeholder, used like the above for C/C++ array + reductions. */ + OMP_CLAUSE_REDUCTION, + + /* OpenMP clause: copyin (variable_list). */ + OMP_CLAUSE_COPYIN, + + /* OpenMP clause: copyprivate (variable_list). */ + OMP_CLAUSE_COPYPRIVATE, + + /* OpenMP clause: linear (variable-list[:linear-step]). */ + OMP_CLAUSE_LINEAR, + + /* OpenMP clause: aligned (variable-list[:alignment]). */ + OMP_CLAUSE_ALIGNED, + + /* OpenMP clause: depend ({in,out,inout}:variable-list). */ + OMP_CLAUSE_DEPEND, + + /* OpenMP clause: uniform (argument-list). */ + OMP_CLAUSE_UNIFORM, + + /* OpenMP clause: to (extended-list). + Only when it appears in declare target. */ + OMP_CLAUSE_TO_DECLARE, + + /* OpenMP clause: link (variable-list). */ + OMP_CLAUSE_LINK, + + /* OpenMP clause: from (variable-list). */ + OMP_CLAUSE_FROM, + + /* OpenMP clause: to (variable-list). */ + OMP_CLAUSE_TO, + + /* OpenACC clauses: {copy, copyin, copyout, create, delete, deviceptr, + device, host (self), present, present_or_copy (pcopy), present_or_copyin + (pcopyin), present_or_copyout (pcopyout), present_or_create (pcreate)} + (variable-list). + + OpenMP clause: map ({alloc:,to:,from:,tofrom:,}variable-list). */ + OMP_CLAUSE_MAP, + + /* OpenACC clause: use_device (variable_list). + OpenMP clause: use_device_ptr (variable-list). */ + OMP_CLAUSE_USE_DEVICE_PTR, + + /* OpenMP clause: is_device_ptr (variable-list). */ + OMP_CLAUSE_IS_DEVICE_PTR, + + /* Internal structure to hold OpenACC cache directive's variable-list. + #pragma acc cache (variable-list). */ + OMP_CLAUSE__CACHE_, + + /* OpenACC clause: gang [(gang-argument-list)]. + Where + gang-argument-list: [gang-argument-list, ] gang-argument + gang-argument: [num:] integer-expression + | static: size-expression + size-expression: * | integer-expression. */ + OMP_CLAUSE_GANG, + + /* OpenACC clause: async [(integer-expression)]. */ + OMP_CLAUSE_ASYNC, + + /* OpenACC clause: wait [(integer-expression-list)]. */ + OMP_CLAUSE_WAIT, + + /* OpenACC clause: auto. */ + OMP_CLAUSE_AUTO, + + /* OpenACC clause: seq. */ + OMP_CLAUSE_SEQ, + + /* Internal clause: temporary for combined loops expansion. */ + OMP_CLAUSE__LOOPTEMP_, + + /* OpenACC/OpenMP clause: if (scalar-expression). */ + OMP_CLAUSE_IF, + + /* OpenMP clause: num_threads (integer-expression). */ + OMP_CLAUSE_NUM_THREADS, + + /* OpenMP clause: schedule. */ + OMP_CLAUSE_SCHEDULE, + + /* OpenMP clause: nowait. */ + OMP_CLAUSE_NOWAIT, + + /* OpenMP clause: ordered [(constant-integer-expression)]. */ + OMP_CLAUSE_ORDERED, + + /* OpenMP clause: default. */ + OMP_CLAUSE_DEFAULT, + + /* OpenACC/OpenMP clause: collapse (constant-integer-expression). */ + OMP_CLAUSE_COLLAPSE, + + /* OpenMP clause: untied. */ + OMP_CLAUSE_UNTIED, + + /* OpenMP clause: final (scalar-expression). */ + OMP_CLAUSE_FINAL, + + /* OpenMP clause: mergeable. */ + OMP_CLAUSE_MERGEABLE, + + /* OpenMP clause: device (integer-expression). */ + OMP_CLAUSE_DEVICE, + + /* OpenMP clause: dist_schedule (static[:chunk-size]). */ + OMP_CLAUSE_DIST_SCHEDULE, + + /* OpenMP clause: inbranch. */ + OMP_CLAUSE_INBRANCH, + + /* OpenMP clause: notinbranch. */ + OMP_CLAUSE_NOTINBRANCH, + + /* OpenMP clause: num_teams(integer-expression). */ + OMP_CLAUSE_NUM_TEAMS, + + /* OpenMP clause: thread_limit(integer-expression). */ + OMP_CLAUSE_THREAD_LIMIT, + + /* OpenMP clause: proc_bind ({master,close,spread}). */ + OMP_CLAUSE_PROC_BIND, + + /* OpenMP clause: safelen (constant-integer-expression). */ + OMP_CLAUSE_SAFELEN, + + /* OpenMP clause: simdlen (constant-integer-expression). */ + OMP_CLAUSE_SIMDLEN, + + /* OpenMP clause: for. */ + OMP_CLAUSE_FOR, + + /* OpenMP clause: parallel. */ + OMP_CLAUSE_PARALLEL, + + /* OpenMP clause: sections. */ + OMP_CLAUSE_SECTIONS, + + /* OpenMP clause: taskgroup. */ + OMP_CLAUSE_TASKGROUP, + + /* OpenMP clause: priority (integer-expression). */ + OMP_CLAUSE_PRIORITY, + + /* OpenMP clause: grainsize (integer-expression). */ + OMP_CLAUSE_GRAINSIZE, + + /* OpenMP clause: num_tasks (integer-expression). */ + OMP_CLAUSE_NUM_TASKS, + + /* OpenMP clause: nogroup. */ + OMP_CLAUSE_NOGROUP, + + /* OpenMP clause: threads. */ + OMP_CLAUSE_THREADS, + + /* OpenMP clause: simd. */ + OMP_CLAUSE_SIMD, + + /* OpenMP clause: hint (integer-expression). */ + OMP_CLAUSE_HINT, + + /* OpenMP clause: defaultmap (tofrom: scalar). */ + OMP_CLAUSE_DEFAULTMAP, + + /* Internally used only clause, holding SIMD uid. */ + OMP_CLAUSE__SIMDUID_, + + /* Internally used only clause, flag whether this is SIMT simd + loop or not. */ + OMP_CLAUSE__SIMT_, + + /* Internally used only clause, holding _Cilk_for # of iterations + on OMP_PARALLEL. */ + OMP_CLAUSE__CILK_FOR_COUNT_, + + /* OpenACC clause: independent. */ + OMP_CLAUSE_INDEPENDENT, + + /* OpenACC clause: worker [( [num:] integer-expression)]. */ + OMP_CLAUSE_WORKER, + + /* OpenACC clause: vector [( [length:] integer-expression)]. */ + OMP_CLAUSE_VECTOR, + + /* OpenACC clause: num_gangs (integer-expression). */ + OMP_CLAUSE_NUM_GANGS, + + /* OpenACC clause: num_workers (integer-expression). */ + OMP_CLAUSE_NUM_WORKERS, + + /* OpenACC clause: vector_length (integer-expression). */ + OMP_CLAUSE_VECTOR_LENGTH, + + /* OpenACC clause: tile ( size-expr-list ). */ + OMP_CLAUSE_TILE, + + /* OpenMP internal-only clause to specify grid dimensions of a gridified + kernel. */ + OMP_CLAUSE__GRIDDIM_ +}; + +#undef DEFTREESTRUCT +#define DEFTREESTRUCT(ENUM, NAME) ENUM, +enum tree_node_structure_enum { +#include "treestruct.def" + LAST_TS_ENUM +}; +#undef DEFTREESTRUCT + +enum omp_clause_schedule_kind { + OMP_CLAUSE_SCHEDULE_STATIC, + OMP_CLAUSE_SCHEDULE_DYNAMIC, + OMP_CLAUSE_SCHEDULE_GUIDED, + OMP_CLAUSE_SCHEDULE_AUTO, + OMP_CLAUSE_SCHEDULE_RUNTIME, + OMP_CLAUSE_SCHEDULE_CILKFOR, + OMP_CLAUSE_SCHEDULE_MASK = (1 << 3) - 1, + OMP_CLAUSE_SCHEDULE_MONOTONIC = (1 << 3), + OMP_CLAUSE_SCHEDULE_NONMONOTONIC = (1 << 4), + OMP_CLAUSE_SCHEDULE_LAST = 2 * OMP_CLAUSE_SCHEDULE_NONMONOTONIC - 1 +}; + +enum omp_clause_default_kind { + OMP_CLAUSE_DEFAULT_UNSPECIFIED, + OMP_CLAUSE_DEFAULT_SHARED, + OMP_CLAUSE_DEFAULT_NONE, + OMP_CLAUSE_DEFAULT_PRIVATE, + OMP_CLAUSE_DEFAULT_FIRSTPRIVATE, + OMP_CLAUSE_DEFAULT_LAST +}; + +/* There is a TYPE_QUAL value for each type qualifier. They can be + combined by bitwise-or to form the complete set of qualifiers for a + type. */ +enum cv_qualifier { + TYPE_UNQUALIFIED = 0x0, + TYPE_QUAL_CONST = 0x1, + TYPE_QUAL_VOLATILE = 0x2, + TYPE_QUAL_RESTRICT = 0x4, + TYPE_QUAL_ATOMIC = 0x8 +}; + +/* Standard named or nameless data types of the C compiler. */ +enum tree_index { + TI_ERROR_MARK, + TI_INTQI_TYPE, + TI_INTHI_TYPE, + TI_INTSI_TYPE, + TI_INTDI_TYPE, + TI_INTTI_TYPE, + + TI_UINTQI_TYPE, + TI_UINTHI_TYPE, + TI_UINTSI_TYPE, + TI_UINTDI_TYPE, + TI_UINTTI_TYPE, + + TI_ATOMICQI_TYPE, + TI_ATOMICHI_TYPE, + TI_ATOMICSI_TYPE, + TI_ATOMICDI_TYPE, + TI_ATOMICTI_TYPE, + + TI_UINT16_TYPE, + TI_UINT32_TYPE, + TI_UINT64_TYPE, + + TI_VOID, + + TI_INTEGER_ZERO, + TI_INTEGER_ONE, + TI_INTEGER_THREE, + TI_INTEGER_MINUS_ONE, + TI_NULL_POINTER, + + TI_SIZE_ZERO, + TI_SIZE_ONE, + + TI_BITSIZE_ZERO, + TI_BITSIZE_ONE, + TI_BITSIZE_UNIT, + + TI_PUBLIC, + TI_PROTECTED, + TI_PRIVATE, + + TI_BOOLEAN_FALSE, + TI_BOOLEAN_TRUE, + + TI_FLOAT_TYPE, + TI_DOUBLE_TYPE, + TI_LONG_DOUBLE_TYPE, + + /* The _FloatN and _FloatNx types must be consecutive, and in the + same sequence as the corresponding complex types, which must also + be consecutive; _FloatN must come before _FloatNx; the order must + also be the same as in the floatn_nx_types array and the RID_* + values in c-common.h. This is so that iterations over these + types work as intended. */ + TI_FLOAT16_TYPE, + TI_FLOATN_TYPE_FIRST = TI_FLOAT16_TYPE, + TI_FLOATN_NX_TYPE_FIRST = TI_FLOAT16_TYPE, + TI_FLOAT32_TYPE, + TI_FLOAT64_TYPE, + TI_FLOAT128_TYPE, + TI_FLOATN_TYPE_LAST = TI_FLOAT128_TYPE, +#define NUM_FLOATN_TYPES (TI_FLOATN_TYPE_LAST - TI_FLOATN_TYPE_FIRST + 1) + TI_FLOAT32X_TYPE, + TI_FLOATNX_TYPE_FIRST = TI_FLOAT32X_TYPE, + TI_FLOAT64X_TYPE, + TI_FLOAT128X_TYPE, + TI_FLOATNX_TYPE_LAST = TI_FLOAT128X_TYPE, + TI_FLOATN_NX_TYPE_LAST = TI_FLOAT128X_TYPE, +#define NUM_FLOATNX_TYPES (TI_FLOATNX_TYPE_LAST - TI_FLOATNX_TYPE_FIRST + 1) +#define NUM_FLOATN_NX_TYPES (TI_FLOATN_NX_TYPE_LAST \ + - TI_FLOATN_NX_TYPE_FIRST \ + + 1) + + /* Put the complex types after their component types, so that in (sequential) + tree streaming we can assert that their component types have already been + handled (see tree-streamer.c:record_common_node). */ + TI_COMPLEX_INTEGER_TYPE, + TI_COMPLEX_FLOAT_TYPE, + TI_COMPLEX_DOUBLE_TYPE, + TI_COMPLEX_LONG_DOUBLE_TYPE, + + TI_COMPLEX_FLOAT16_TYPE, + TI_COMPLEX_FLOATN_NX_TYPE_FIRST = TI_COMPLEX_FLOAT16_TYPE, + TI_COMPLEX_FLOAT32_TYPE, + TI_COMPLEX_FLOAT64_TYPE, + TI_COMPLEX_FLOAT128_TYPE, + TI_COMPLEX_FLOAT32X_TYPE, + TI_COMPLEX_FLOAT64X_TYPE, + TI_COMPLEX_FLOAT128X_TYPE, + + TI_FLOAT_PTR_TYPE, + TI_DOUBLE_PTR_TYPE, + TI_LONG_DOUBLE_PTR_TYPE, + TI_INTEGER_PTR_TYPE, + + TI_VOID_TYPE, + TI_PTR_TYPE, + TI_CONST_PTR_TYPE, + TI_SIZE_TYPE, + TI_PID_TYPE, + TI_PTRDIFF_TYPE, + TI_VA_LIST_TYPE, + TI_VA_LIST_GPR_COUNTER_FIELD, + TI_VA_LIST_FPR_COUNTER_FIELD, + TI_BOOLEAN_TYPE, + TI_FILEPTR_TYPE, + TI_CONST_TM_PTR_TYPE, + TI_POINTER_SIZED_TYPE, + + TI_POINTER_BOUNDS_TYPE, + + TI_DFLOAT32_TYPE, + TI_DFLOAT64_TYPE, + TI_DFLOAT128_TYPE, + TI_DFLOAT32_PTR_TYPE, + TI_DFLOAT64_PTR_TYPE, + TI_DFLOAT128_PTR_TYPE, + + TI_VOID_LIST_NODE, + + TI_MAIN_IDENTIFIER, + + TI_SAT_SFRACT_TYPE, + TI_SAT_FRACT_TYPE, + TI_SAT_LFRACT_TYPE, + TI_SAT_LLFRACT_TYPE, + TI_SAT_USFRACT_TYPE, + TI_SAT_UFRACT_TYPE, + TI_SAT_ULFRACT_TYPE, + TI_SAT_ULLFRACT_TYPE, + TI_SFRACT_TYPE, + TI_FRACT_TYPE, + TI_LFRACT_TYPE, + TI_LLFRACT_TYPE, + TI_USFRACT_TYPE, + TI_UFRACT_TYPE, + TI_ULFRACT_TYPE, + TI_ULLFRACT_TYPE, + TI_SAT_SACCUM_TYPE, + TI_SAT_ACCUM_TYPE, + TI_SAT_LACCUM_TYPE, + TI_SAT_LLACCUM_TYPE, + TI_SAT_USACCUM_TYPE, + TI_SAT_UACCUM_TYPE, + TI_SAT_ULACCUM_TYPE, + TI_SAT_ULLACCUM_TYPE, + TI_SACCUM_TYPE, + TI_ACCUM_TYPE, + TI_LACCUM_TYPE, + TI_LLACCUM_TYPE, + TI_USACCUM_TYPE, + TI_UACCUM_TYPE, + TI_ULACCUM_TYPE, + TI_ULLACCUM_TYPE, + TI_QQ_TYPE, + TI_HQ_TYPE, + TI_SQ_TYPE, + TI_DQ_TYPE, + TI_TQ_TYPE, + TI_UQQ_TYPE, + TI_UHQ_TYPE, + TI_USQ_TYPE, + TI_UDQ_TYPE, + TI_UTQ_TYPE, + TI_SAT_QQ_TYPE, + TI_SAT_HQ_TYPE, + TI_SAT_SQ_TYPE, + TI_SAT_DQ_TYPE, + TI_SAT_TQ_TYPE, + TI_SAT_UQQ_TYPE, + TI_SAT_UHQ_TYPE, + TI_SAT_USQ_TYPE, + TI_SAT_UDQ_TYPE, + TI_SAT_UTQ_TYPE, + TI_HA_TYPE, + TI_SA_TYPE, + TI_DA_TYPE, + TI_TA_TYPE, + TI_UHA_TYPE, + TI_USA_TYPE, + TI_UDA_TYPE, + TI_UTA_TYPE, + TI_SAT_HA_TYPE, + TI_SAT_SA_TYPE, + TI_SAT_DA_TYPE, + TI_SAT_TA_TYPE, + TI_SAT_UHA_TYPE, + TI_SAT_USA_TYPE, + TI_SAT_UDA_TYPE, + TI_SAT_UTA_TYPE, + + TI_OPTIMIZATION_DEFAULT, + TI_OPTIMIZATION_CURRENT, + TI_TARGET_OPTION_DEFAULT, + TI_TARGET_OPTION_CURRENT, + TI_CURRENT_TARGET_PRAGMA, + TI_CURRENT_OPTIMIZE_PRAGMA, + + TI_MAX +}; + +/* An enumeration of the standard C integer types. These must be + ordered so that shorter types appear before longer ones, and so + that signed types appear before unsigned ones, for the correct + functioning of interpret_integer() in c-lex.c. */ +enum integer_type_kind { + itk_char, + itk_signed_char, + itk_unsigned_char, + itk_short, + itk_unsigned_short, + itk_int, + itk_unsigned_int, + itk_long, + itk_unsigned_long, + itk_long_long, + itk_unsigned_long_long, + + itk_intN_0, + itk_unsigned_intN_0, + itk_intN_1, + itk_unsigned_intN_1, + itk_intN_2, + itk_unsigned_intN_2, + itk_intN_3, + itk_unsigned_intN_3, + + itk_none +}; + +/* A pointer-to-function member type looks like: + + struct { + __P __pfn; + ptrdiff_t __delta; + }; + + If __pfn is NULL, it is a NULL pointer-to-member-function. + + (Because the vtable is always the first thing in the object, we + don't need its offset.) If the function is virtual, then PFN is + one plus twice the index into the vtable; otherwise, it is just a + pointer to the function. + + Unfortunately, using the lowest bit of PFN doesn't work in + architectures that don't impose alignment requirements on function + addresses, or that use the lowest bit to tell one ISA from another, + for example. For such architectures, we use the lowest bit of + DELTA instead of the lowest bit of the PFN, and DELTA will be + multiplied by 2. */ +enum ptrmemfunc_vbit_where_t { + ptrmemfunc_vbit_in_pfn, + ptrmemfunc_vbit_in_delta +}; + +/* Flags that may be passed in the third argument of decl_attributes, and + to handler functions for attributes. */ +enum attribute_flags { + /* The type passed in is the type of a DECL, and any attributes that + should be passed in again to be applied to the DECL rather than the + type should be returned. */ + ATTR_FLAG_DECL_NEXT = 1, + /* The type passed in is a function return type, and any attributes that + should be passed in again to be applied to the function type rather + than the return type should be returned. */ + ATTR_FLAG_FUNCTION_NEXT = 2, + /* The type passed in is an array element type, and any attributes that + should be passed in again to be applied to the array type rather + than the element type should be returned. */ + ATTR_FLAG_ARRAY_NEXT = 4, + /* The type passed in is a structure, union or enumeration type being + created, and should be modified in place. */ + ATTR_FLAG_TYPE_IN_PLACE = 8, + /* The attributes are being applied by default to a library function whose + name indicates known behavior, and should be silently ignored if they + are not in fact compatible with the function type. */ + ATTR_FLAG_BUILT_IN = 16, + /* A given attribute has been parsed as a C++-11 attribute. */ + ATTR_FLAG_CXX11 = 32 +}; + +/* Types used to represent sizes. */ +enum size_type_kind { + stk_sizetype, /* Normal representation of sizes in bytes. */ + stk_ssizetype, /* Signed representation of sizes in bytes. */ + stk_bitsizetype, /* Normal representation of sizes in bits. */ + stk_sbitsizetype, /* Signed representation of sizes in bits. */ + stk_type_kind_last +}; + +enum operand_equal_flag { + OEP_ONLY_CONST = 1, + OEP_PURE_SAME = 2, + OEP_MATCH_SIDE_EFFECTS = 4, + OEP_ADDRESS_OF = 8, + /* Internal within operand_equal_p: */ + OEP_NO_HASH_CHECK = 16, + /* Internal within inchash::add_expr: */ + OEP_HASH_CHECK = 32, + /* Makes operand_equal_p handle more expressions: */ + OEP_LEXICOGRAPHIC = 64 +}; + +/* Enum and arrays used for tree allocation stats. + Keep in sync with tree.c:tree_node_kind_names. */ +enum tree_node_kind { + d_kind, + t_kind, + b_kind, + s_kind, + r_kind, + e_kind, + c_kind, + id_kind, + vec_kind, + binfo_kind, + ssa_name_kind, + constr_kind, + x_kind, + lang_decl, + lang_type, + omp_clause_kind, + all_kinds +}; + +enum annot_expr_kind { + annot_expr_ivdep_kind, + annot_expr_no_vector_kind, + annot_expr_vector_kind, + annot_expr_kind_last +}; + +/*--------------------------------------------------------------------------- + Type definitions +---------------------------------------------------------------------------*/ +/* When processing aliases at the symbol table level, we need the + declaration of target. For this reason we need to queue aliases and + process them after all declarations has been produced. */ +struct GTY(()) alias_pair { + tree decl; + tree target; +}; + +/* An initialization priority. */ +typedef unsigned short priority_type; + +/* The type of a callback function for walking over tree structure. */ +typedef tree (*walk_tree_fn) (tree *, int *, void *); + +/* The type of a callback function that represents a custom walk_tree. */ +typedef tree (*walk_tree_lh) (tree *, int *, tree (*) (tree *, int *, void *), + void *, hash_set *); + + +/*--------------------------------------------------------------------------- + Main data structures +---------------------------------------------------------------------------*/ +/* A tree node can represent a data type, a variable, an expression + or a statement. Each node has a TREE_CODE which says what kind of + thing it represents. Some common codes are: + INTEGER_TYPE -- represents a type of integers. + ARRAY_TYPE -- represents a type of pointer. + VAR_DECL -- represents a declared variable. + INTEGER_CST -- represents a constant integer value. + PLUS_EXPR -- represents a sum (an expression). + + As for the contents of a tree node: there are some fields + that all nodes share. Each TREE_CODE has various special-purpose + fields as well. The fields of a node are never accessed directly, + always through accessor macros. */ + +/* Every kind of tree node starts with this structure, + so all nodes have these fields. + + See the accessor macros, defined below, for documentation of the + fields, and the table below which connects the fields and the + accessor macros. */ + +struct GTY(()) tree_base { + ENUM_BITFIELD(tree_code) code : 16; + + unsigned side_effects_flag : 1; + unsigned constant_flag : 1; + unsigned addressable_flag : 1; + unsigned volatile_flag : 1; + unsigned readonly_flag : 1; + unsigned asm_written_flag: 1; + unsigned nowarning_flag : 1; + unsigned visited : 1; + + unsigned used_flag : 1; + unsigned nothrow_flag : 1; + unsigned static_flag : 1; + unsigned public_flag : 1; + unsigned private_flag : 1; + unsigned protected_flag : 1; + unsigned deprecated_flag : 1; + unsigned default_def_flag : 1; + + union { + /* The bits in the following structure should only be used with + accessor macros that constrain inputs with tree checking. */ + struct { + unsigned lang_flag_0 : 1; + unsigned lang_flag_1 : 1; + unsigned lang_flag_2 : 1; + unsigned lang_flag_3 : 1; + unsigned lang_flag_4 : 1; + unsigned lang_flag_5 : 1; + unsigned lang_flag_6 : 1; + unsigned saturating_flag : 1; + + unsigned unsigned_flag : 1; + unsigned packed_flag : 1; + unsigned user_align : 1; + unsigned nameless_flag : 1; + unsigned atomic_flag : 1; + unsigned spare0 : 3; + + unsigned spare1 : 8; + + /* This field is only used with TREE_TYPE nodes; the only reason it is + present in tree_base instead of tree_type is to save space. The size + of the field must be large enough to hold addr_space_t values. */ + unsigned address_space : 8; + } bits; + + /* The following fields are present in tree_base to save space. The + nodes using them do not require any of the flags above and so can + make better use of the 4-byte sized word. */ + + /* The number of HOST_WIDE_INTs in an INTEGER_CST. */ + struct { + /* The number of HOST_WIDE_INTs if the INTEGER_CST is accessed in + its native precision. */ + unsigned char unextended; + + /* The number of HOST_WIDE_INTs if the INTEGER_CST is extended to + wider precisions based on its TYPE_SIGN. */ + unsigned char extended; + + /* The number of HOST_WIDE_INTs if the INTEGER_CST is accessed in + offset_int precision, with smaller integers being extended + according to their TYPE_SIGN. This is equal to one of the two + fields above but is cached for speed. */ + unsigned char offset; + } int_length; + + /* VEC length. This field is only used with TREE_VEC. */ + int length; + + /* SSA version number. This field is only used with SSA_NAME. */ + unsigned int version; + + /* Internal function code. */ + enum internal_fn ifn; + + /* The following two fields are used for MEM_REF and TARGET_MEM_REF + expression trees and specify known data non-dependences. For + two memory references in a function they are known to not + alias if dependence_info.clique are equal and dependence_info.base + are distinct. */ + struct { + unsigned short clique; + unsigned short base; + } dependence_info; + } GTY((skip(""))) u; +}; + +/* The following table lists the uses of each of the above flags and + for which types of nodes they are defined. + + addressable_flag: + + TREE_ADDRESSABLE in + VAR_DECL, PARM_DECL, RESULT_DECL, FUNCTION_DECL, LABEL_DECL + SSA_NAME + all types + CONSTRUCTOR, IDENTIFIER_NODE + STMT_EXPR + + CALL_EXPR_TAILCALL in + CALL_EXPR + + CASE_LOW_SEEN in + CASE_LABEL_EXPR + + PREDICT_EXPR_OUTCOME in + PREDICT_EXPR + + static_flag: + + TREE_STATIC in + VAR_DECL, FUNCTION_DECL + CONSTRUCTOR + + TREE_NO_TRAMPOLINE in + ADDR_EXPR + + BINFO_VIRTUAL_P in + TREE_BINFO + + TREE_SYMBOL_REFERENCED in + IDENTIFIER_NODE + + CLEANUP_EH_ONLY in + TARGET_EXPR, WITH_CLEANUP_EXPR + + TRY_CATCH_IS_CLEANUP in + TRY_CATCH_EXPR + + ASM_INPUT_P in + ASM_EXPR + + TYPE_REF_CAN_ALIAS_ALL in + POINTER_TYPE, REFERENCE_TYPE + + CASE_HIGH_SEEN in + CASE_LABEL_EXPR + + ENUM_IS_SCOPED in + ENUMERAL_TYPE + + TRANSACTION_EXPR_OUTER in + TRANSACTION_EXPR + + SSA_NAME_ANTI_RANGE_P in + SSA_NAME + + MUST_TAIL_CALL in + CALL_EXPR + + public_flag: + + TREE_OVERFLOW in + INTEGER_CST, REAL_CST, COMPLEX_CST, VECTOR_CST + + TREE_PUBLIC in + VAR_DECL, FUNCTION_DECL + IDENTIFIER_NODE + + CONSTRUCTOR_NO_CLEARING in + CONSTRUCTOR + + ASM_VOLATILE_P in + ASM_EXPR + + CALL_EXPR_VA_ARG_PACK in + CALL_EXPR + + TYPE_CACHED_VALUES_P in + all types + + SAVE_EXPR_RESOLVED_P in + SAVE_EXPR + + OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE in + OMP_CLAUSE_LASTPRIVATE + + OMP_CLAUSE_PRIVATE_DEBUG in + OMP_CLAUSE_PRIVATE + + OMP_CLAUSE_LINEAR_NO_COPYIN in + OMP_CLAUSE_LINEAR + + OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION in + OMP_CLAUSE_MAP + + OMP_CLAUSE_REDUCTION_OMP_ORIG_REF in + OMP_CLAUSE_REDUCTION + + TRANSACTION_EXPR_RELAXED in + TRANSACTION_EXPR + + FALLTHROUGH_LABEL_P in + LABEL_DECL + + SSA_NAME_IS_VIRTUAL_OPERAND in + SSA_NAME + + private_flag: + + TREE_PRIVATE in + all decls + + CALL_EXPR_RETURN_SLOT_OPT in + CALL_EXPR + + OMP_SECTION_LAST in + OMP_SECTION + + OMP_PARALLEL_COMBINED in + OMP_PARALLEL + + OMP_ATOMIC_SEQ_CST in + OMP_ATOMIC* + + OMP_CLAUSE_PRIVATE_OUTER_REF in + OMP_CLAUSE_PRIVATE + + OMP_CLAUSE_LINEAR_NO_COPYOUT in + OMP_CLAUSE_LINEAR + + TYPE_REF_IS_RVALUE in + REFERENCE_TYPE + + ENUM_IS_OPAQUE in + ENUMERAL_TYPE + + protected_flag: + + TREE_PROTECTED in + BLOCK + all decls + + CALL_FROM_THUNK_P and + CALL_ALLOCA_FOR_VAR_P in + CALL_EXPR + + OMP_CLAUSE_LINEAR_VARIABLE_STRIDE in + OMP_CLAUSE_LINEAR + + side_effects_flag: + + TREE_SIDE_EFFECTS in + all expressions + all decls + all constants + + FORCED_LABEL in + LABEL_DECL + + volatile_flag: + + TREE_THIS_VOLATILE in + all expressions + all decls + + TYPE_VOLATILE in + all types + + readonly_flag: + + TREE_READONLY in + all expressions + all decls + + TYPE_READONLY in + all types + + constant_flag: + + TREE_CONSTANT in + all expressions + all decls + all constants + + TYPE_SIZES_GIMPLIFIED in + all types + + unsigned_flag: + + TYPE_UNSIGNED in + all types + + DECL_UNSIGNED in + all decls + + asm_written_flag: + + TREE_ASM_WRITTEN in + VAR_DECL, FUNCTION_DECL, TYPE_DECL + RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE + BLOCK, STRING_CST + + SSA_NAME_OCCURS_IN_ABNORMAL_PHI in + SSA_NAME + + used_flag: + + TREE_USED in + all expressions + all decls + IDENTIFIER_NODE + + nothrow_flag: + + TREE_NOTHROW in + CALL_EXPR + FUNCTION_DECL + + TREE_THIS_NOTRAP in + INDIRECT_REF, MEM_REF, TARGET_MEM_REF, ARRAY_REF, ARRAY_RANGE_REF + + SSA_NAME_IN_FREE_LIST in + SSA_NAME + + DECL_NONALIASED in + VAR_DECL + + deprecated_flag: + + TREE_DEPRECATED in + all decls + all types + + IDENTIFIER_TRANSPARENT_ALIAS in + IDENTIFIER_NODE + + visited: + + TREE_VISITED in + all trees (used liberally by many passes) + + saturating_flag: + + TYPE_REVERSE_STORAGE_ORDER in + RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE, ARRAY_TYPE + + TYPE_SATURATING in + other types + + VAR_DECL_IS_VIRTUAL_OPERAND in + VAR_DECL + + nowarning_flag: + + TREE_NO_WARNING in + all expressions + all decls + + TYPE_ARTIFICIAL in + all types + + default_def_flag: + + TYPE_FINAL_P in + RECORD_TYPE, UNION_TYPE and QUAL_UNION_TYPE + + TYPE_VECTOR_OPAQUE in + VECTOR_TYPE + + SSA_NAME_IS_DEFAULT_DEF in + SSA_NAME + + DECL_NONLOCAL_FRAME in + VAR_DECL + + REF_REVERSE_STORAGE_ORDER in + BIT_FIELD_REF, MEM_REF + + FUNC_ADDR_BY_DESCRIPTOR in + ADDR_EXPR + + CALL_EXPR_BY_DESCRIPTOR in + CALL_EXPR +*/ + +struct GTY(()) tree_typed { + struct tree_base base; + tree type; +}; + +struct GTY(()) tree_common { + struct tree_typed typed; + tree chain; +}; + +struct GTY(()) tree_int_cst { + struct tree_typed typed; + HOST_WIDE_INT val[1]; +}; + + +struct GTY(()) tree_real_cst { + struct tree_typed typed; + struct real_value * real_cst_ptr; +}; + +struct GTY(()) tree_fixed_cst { + struct tree_typed typed; + struct fixed_value * fixed_cst_ptr; +}; + +struct GTY(()) tree_string { + struct tree_typed typed; + int length; + char str[1]; +}; + +struct GTY(()) tree_complex { + struct tree_typed typed; + tree real; + tree imag; +}; + +struct GTY(()) tree_vector { + struct tree_typed typed; + tree GTY ((length ("TYPE_VECTOR_SUBPARTS (TREE_TYPE ((tree)&%h))"))) elts[1]; +}; + +struct GTY(()) tree_identifier { + struct tree_common common; + struct ht_identifier id; +}; + +struct GTY(()) tree_list { + struct tree_common common; + tree purpose; + tree value; +}; + +struct GTY(()) tree_vec { + struct tree_common common; + tree GTY ((length ("TREE_VEC_LENGTH ((tree)&%h)"))) a[1]; +}; + +/* A single element of a CONSTRUCTOR. VALUE holds the actual value of the + element. INDEX can optionally design the position of VALUE: in arrays, + it is the index where VALUE has to be placed; in structures, it is the + FIELD_DECL of the member. */ +struct GTY(()) constructor_elt { + tree index; + tree value; +}; + +struct GTY(()) tree_constructor { + struct tree_typed typed; + vec *elts; +}; + +enum omp_clause_depend_kind +{ + OMP_CLAUSE_DEPEND_IN, + OMP_CLAUSE_DEPEND_OUT, + OMP_CLAUSE_DEPEND_INOUT, + OMP_CLAUSE_DEPEND_SOURCE, + OMP_CLAUSE_DEPEND_SINK, + OMP_CLAUSE_DEPEND_LAST +}; + +enum omp_clause_proc_bind_kind +{ + /* Numbers should match omp_proc_bind_t enum in omp.h. */ + OMP_CLAUSE_PROC_BIND_FALSE = 0, + OMP_CLAUSE_PROC_BIND_TRUE = 1, + OMP_CLAUSE_PROC_BIND_MASTER = 2, + OMP_CLAUSE_PROC_BIND_CLOSE = 3, + OMP_CLAUSE_PROC_BIND_SPREAD = 4, + OMP_CLAUSE_PROC_BIND_LAST +}; + +enum omp_clause_linear_kind +{ + OMP_CLAUSE_LINEAR_DEFAULT, + OMP_CLAUSE_LINEAR_REF, + OMP_CLAUSE_LINEAR_VAL, + OMP_CLAUSE_LINEAR_UVAL +}; + +struct GTY(()) tree_exp { + struct tree_typed typed; + location_t locus; + tree GTY ((special ("tree_exp"), + desc ("TREE_CODE ((tree) &%0)"))) + operands[1]; +}; + +/* Immediate use linking structure. This structure is used for maintaining + a doubly linked list of uses of an SSA_NAME. */ +struct GTY(()) ssa_use_operand_t { + struct ssa_use_operand_t* GTY((skip(""))) prev; + struct ssa_use_operand_t* GTY((skip(""))) next; + /* Immediate uses for a given SSA name are maintained as a cyclic + list. To recognize the root of this list, the location field + needs to point to the original SSA name. Since statements and + SSA names are of different data types, we need this union. See + the explanation in struct imm_use_iterator. */ + union { gimple *stmt; tree ssa_name; } GTY((skip(""))) loc; + tree *GTY((skip(""))) use; +}; + +struct GTY(()) tree_ssa_name { + struct tree_typed typed; + + /* _DECL wrapped by this SSA name. */ + tree var; + + /* Statement that defines this SSA name. */ + gimple *def_stmt; + + /* Value range information. */ + union ssa_name_info_type { + /* Pointer attributes used for alias analysis. */ + struct GTY ((tag ("0"))) ptr_info_def *ptr_info; + /* Value range attributes used for zero/sign extension elimination. */ + struct GTY ((tag ("1"))) range_info_def *range_info; + } GTY ((desc ("%1.typed.type ?" \ + "!POINTER_TYPE_P (TREE_TYPE ((tree)&%1)) : 2"))) info; + + /* Immediate uses list for this SSA_NAME. */ + struct ssa_use_operand_t imm_uses; +}; + +struct GTY(()) phi_arg_d { + /* imm_use MUST be the first element in struct because we do some + pointer arithmetic with it. See phi_arg_index_from_use. */ + struct ssa_use_operand_t imm_use; + tree def; + location_t locus; +}; + +struct GTY(()) tree_omp_clause { + struct tree_common common; + location_t locus; + enum omp_clause_code code; + union omp_clause_subcode { + enum omp_clause_default_kind default_kind; + enum omp_clause_schedule_kind schedule_kind; + enum omp_clause_depend_kind depend_kind; + /* See include/gomp-constants.h for enum gomp_map_kind's values. */ + unsigned int map_kind; + enum omp_clause_proc_bind_kind proc_bind_kind; + enum tree_code reduction_code; + enum omp_clause_linear_kind linear_kind; + enum tree_code if_modifier; + /* The dimension a OMP_CLAUSE__GRIDDIM_ clause of a gridified target + construct describes. */ + unsigned int dimension; + } GTY ((skip)) subcode; + + /* The gimplification of OMP_CLAUSE_REDUCTION_{INIT,MERGE} for omp-low's + usage. */ + gimple_seq gimple_reduction_init; + gimple_seq gimple_reduction_merge; + + tree GTY ((length ("omp_clause_num_ops[OMP_CLAUSE_CODE ((tree)&%h)]"))) + ops[1]; +}; + +struct GTY(()) tree_block { + struct tree_base base; + tree chain; + + unsigned abstract_flag : 1; + unsigned block_num : 31; + + location_t locus; + location_t end_locus; + + tree vars; + vec *nonlocalized_vars; + + tree subblocks; + tree supercontext; + tree abstract_origin; + tree fragment_origin; + tree fragment_chain; + + /* Pointer to the DWARF lexical block. */ + struct die_struct *die; +}; + +struct GTY(()) tree_type_common { + struct tree_common common; + tree size; + tree size_unit; + tree attributes; + unsigned int uid; + + unsigned int precision : 10; + unsigned no_force_blk_flag : 1; + unsigned needs_constructing_flag : 1; + unsigned transparent_aggr_flag : 1; + unsigned restrict_flag : 1; + unsigned contains_placeholder_bits : 2; + + ENUM_BITFIELD(machine_mode) mode : 8; + + unsigned string_flag : 1; + unsigned lang_flag_0 : 1; + unsigned lang_flag_1 : 1; + unsigned lang_flag_2 : 1; + unsigned lang_flag_3 : 1; + unsigned lang_flag_4 : 1; + unsigned lang_flag_5 : 1; + unsigned lang_flag_6 : 1; + unsigned lang_flag_7 : 1; + + /* TYPE_ALIGN in log2; this has to be large enough to hold values + of the maximum of BIGGEST_ALIGNMENT and MAX_OFILE_ALIGNMENT, + the latter being usually the larger. For ELF it is 8<<28, + so we need to store the value 32 (not 31, as we need the zero + as well), hence six bits. */ + unsigned align : 6; + unsigned typeless_storage : 1; + unsigned spare : 24; + + alias_set_type alias_set; + tree pointer_to; + tree reference_to; + union tree_type_symtab { + int GTY ((tag ("TYPE_SYMTAB_IS_ADDRESS"))) address; + const char * GTY ((tag ("TYPE_SYMTAB_IS_POINTER"))) pointer; + struct die_struct * GTY ((tag ("TYPE_SYMTAB_IS_DIE"))) die; + } GTY ((desc ("debug_hooks->tree_type_symtab_field"))) symtab; + tree canonical; + tree next_variant; + tree main_variant; + tree context; + tree name; +}; + +struct GTY(()) tree_type_with_lang_specific { + struct tree_type_common common; + /* Points to a structure whose details depend on the language in use. */ + struct lang_type *lang_specific; +}; + +struct GTY(()) tree_type_non_common { + struct tree_type_with_lang_specific with_lang_specific; + tree values; + tree minval; + tree maxval; + tree binfo; +}; + +struct GTY (()) tree_binfo { + struct tree_common common; + + tree offset; + tree vtable; + tree virtuals; + tree vptr_field; + vec *base_accesses; + tree inheritance; + + tree vtt_subvtt; + tree vtt_vptr; + + vec base_binfos; +}; + +struct GTY(()) tree_decl_minimal { + struct tree_common common; + location_t locus; + unsigned int uid; + tree name; + tree context; +}; + +struct GTY(()) tree_decl_common { + struct tree_decl_minimal common; + tree size; + + ENUM_BITFIELD(machine_mode) mode : 8; + + unsigned nonlocal_flag : 1; + unsigned virtual_flag : 1; + unsigned ignored_flag : 1; + unsigned abstract_flag : 1; + unsigned artificial_flag : 1; + unsigned preserve_flag: 1; + unsigned debug_expr_is_from : 1; + + unsigned lang_flag_0 : 1; + unsigned lang_flag_1 : 1; + unsigned lang_flag_2 : 1; + unsigned lang_flag_3 : 1; + unsigned lang_flag_4 : 1; + unsigned lang_flag_5 : 1; + unsigned lang_flag_6 : 1; + unsigned lang_flag_7 : 1; + unsigned lang_flag_8 : 1; + + /* In VAR_DECL and PARM_DECL, this is DECL_REGISTER. */ + unsigned decl_flag_0 : 1; + /* In FIELD_DECL, this is DECL_BIT_FIELD + In VAR_DECL and FUNCTION_DECL, this is DECL_EXTERNAL. + In TYPE_DECL, this is TYPE_DECL_SUPPRESS_DEBUG. */ + unsigned decl_flag_1 : 1; + /* In FIELD_DECL, this is DECL_NONADDRESSABLE_P + In VAR_DECL, PARM_DECL and RESULT_DECL, this is + DECL_HAS_VALUE_EXPR_P. */ + unsigned decl_flag_2 : 1; + /* 1 bit unused. */ + unsigned decl_flag_3 : 1; + /* Logically, these two would go in a theoretical base shared by var and + parm decl. */ + unsigned gimple_reg_flag : 1; + /* In VAR_DECL, PARM_DECL and RESULT_DECL, this is DECL_BY_REFERENCE. */ + unsigned decl_by_reference_flag : 1; + /* In a VAR_DECL and PARM_DECL, this is DECL_READ_P. */ + unsigned decl_read_flag : 1; + /* In a VAR_DECL or RESULT_DECL, this is DECL_NONSHAREABLE. */ + unsigned decl_nonshareable_flag : 1; + + /* DECL_OFFSET_ALIGN, used only for FIELD_DECLs. */ + unsigned int off_align : 6; + + /* DECL_ALIGN. It should have the same size as TYPE_ALIGN. */ + unsigned int align : 6; + + /* 20 bits unused. */ + + /* UID for points-to sets, stable over copying from inlining. */ + unsigned int pt_uid; + + tree size_unit; + tree initial; + tree attributes; + tree abstract_origin; + + /* Points to a structure whose details depend on the language in use. */ + struct lang_decl *lang_specific; +}; + +struct GTY(()) tree_decl_with_rtl { + struct tree_decl_common common; + rtx rtl; +}; + +struct GTY(()) tree_field_decl { + struct tree_decl_common common; + + tree offset; + tree bit_field_type; + tree qualifier; + tree bit_offset; + tree fcontext; +}; + +struct GTY(()) tree_label_decl { + struct tree_decl_with_rtl common; + int label_decl_uid; + int eh_landing_pad_nr; +}; + +struct GTY(()) tree_result_decl { + struct tree_decl_with_rtl common; +}; + +struct GTY(()) tree_const_decl { + struct tree_decl_common common; +}; + +struct GTY(()) tree_parm_decl { + struct tree_decl_with_rtl common; + rtx incoming_rtl; +}; + +struct GTY(()) tree_decl_with_vis { + struct tree_decl_with_rtl common; + tree assembler_name; + struct symtab_node *symtab_node; + + /* Belong to VAR_DECL exclusively. */ + unsigned defer_output : 1; + unsigned hard_register : 1; + unsigned common_flag : 1; + unsigned in_text_section : 1; + unsigned in_constant_pool : 1; + unsigned dllimport_flag : 1; + /* Don't belong to VAR_DECL exclusively. */ + unsigned weak_flag : 1; + + unsigned seen_in_bind_expr : 1; + unsigned comdat_flag : 1; + /* Used for FUNCTION_DECL, VAR_DECL and in C++ for TYPE_DECL. */ + ENUM_BITFIELD(symbol_visibility) visibility : 2; + unsigned visibility_specified : 1; + + /* Belong to FUNCTION_DECL exclusively. */ + unsigned init_priority_p : 1; + /* Used by C++ only. Might become a generic decl flag. */ + unsigned shadowed_for_var_p : 1; + /* Belong to FUNCTION_DECL exclusively. */ + unsigned cxx_constructor : 1; + /* Belong to FUNCTION_DECL exclusively. */ + unsigned cxx_destructor : 1; + /* Belong to FUNCTION_DECL exclusively. */ + unsigned final : 1; + /* Belong to FUNCTION_DECL exclusively. */ + unsigned regdecl_flag : 1; + /* 14 unused bits. */ +}; + +struct GTY(()) tree_var_decl { + struct tree_decl_with_vis common; +}; + +struct GTY(()) tree_decl_non_common { + struct tree_decl_with_vis common; + /* Almost all FE's use this. */ + tree result; +}; + +/* FUNCTION_DECL inherits from DECL_NON_COMMON because of the use of the + arguments/result/saved_tree fields by front ends. It was either inherit + FUNCTION_DECL from non_common, or inherit non_common from FUNCTION_DECL, + which seemed a bit strange. */ + +struct GTY(()) tree_function_decl { + struct tree_decl_non_common common; + + struct function *f; + + /* Arguments of the function. */ + tree arguments; + /* The personality function. Used for stack unwinding. */ + tree personality; + + /* Function specific options that are used by this function. */ + tree function_specific_target; /* target options */ + tree function_specific_optimization; /* optimization options */ + + /* Generic function body. */ + tree saved_tree; + /* Index within a virtual table. */ + tree vindex; + + /* In a FUNCTION_DECL for which DECL_BUILT_IN holds, this is + DECL_FUNCTION_CODE. Otherwise unused. + ??? The bitfield needs to be able to hold all target function + codes as well. */ + ENUM_BITFIELD(built_in_function) function_code : 12; + ENUM_BITFIELD(built_in_class) built_in_class : 2; + + unsigned static_ctor_flag : 1; + unsigned static_dtor_flag : 1; + + unsigned uninlinable : 1; + unsigned possibly_inlined : 1; + unsigned novops_flag : 1; + unsigned returns_twice_flag : 1; + unsigned malloc_flag : 1; + unsigned operator_new_flag : 1; + unsigned declared_inline_flag : 1; + unsigned no_inline_warning_flag : 1; + + unsigned no_instrument_function_entry_exit : 1; + unsigned no_limit_stack : 1; + unsigned disregard_inline_limits : 1; + unsigned pure_flag : 1; + unsigned looping_const_or_pure_flag : 1; + unsigned has_debug_args_flag : 1; + unsigned tm_clone_flag : 1; + unsigned versioned_function : 1; + /* No bits left. */ +}; + +struct GTY(()) tree_translation_unit_decl { + struct tree_decl_common common; + /* Source language of this translation unit. Used for DWARF output. */ + const char * GTY((skip(""))) language; + /* TODO: Non-optimization used to build this translation unit. */ + /* TODO: Root of a partial DWARF tree for global types and decls. */ +}; + +struct GTY(()) tree_type_decl { + struct tree_decl_non_common common; + +}; + +struct GTY ((chain_next ("%h.next"), chain_prev ("%h.prev"))) tree_statement_list_node + { + struct tree_statement_list_node *prev; + struct tree_statement_list_node *next; + tree stmt; +}; + +struct GTY(()) tree_statement_list + { + struct tree_typed typed; + struct tree_statement_list_node *head; + struct tree_statement_list_node *tail; +}; + + +/* Optimization options used by a function. */ + +struct GTY(()) tree_optimization_option { + struct tree_base base; + + /* The optimization options used by the user. */ + struct cl_optimization *opts; + + /* Target optabs for this set of optimization options. This is of + type `struct target_optabs *'. */ + void *GTY ((atomic)) optabs; + + /* The value of this_target_optabs against which the optabs above were + generated. */ + struct target_optabs *GTY ((skip)) base_optabs; +}; + +/* Forward declaration, defined in target-globals.h. */ + +struct GTY(()) target_globals; + +/* Target options used by a function. */ + +struct GTY(()) tree_target_option { + struct tree_base base; + + /* Target globals for the corresponding target option. */ + struct target_globals *globals; + + /* The optimization options used by the user. */ + struct cl_target_option *opts; +}; + +/* Define the overall contents of a tree node. + It may be any of the structures declared above + for various types of node. */ +union GTY ((ptr_alias (union lang_tree_node), + desc ("tree_node_structure (&%h)"), variable_size)) tree_node { + struct tree_base GTY ((tag ("TS_BASE"))) base; + struct tree_typed GTY ((tag ("TS_TYPED"))) typed; + struct tree_common GTY ((tag ("TS_COMMON"))) common; + struct tree_int_cst GTY ((tag ("TS_INT_CST"))) int_cst; + struct tree_real_cst GTY ((tag ("TS_REAL_CST"))) real_cst; + struct tree_fixed_cst GTY ((tag ("TS_FIXED_CST"))) fixed_cst; + struct tree_vector GTY ((tag ("TS_VECTOR"))) vector; + struct tree_string GTY ((tag ("TS_STRING"))) string; + struct tree_complex GTY ((tag ("TS_COMPLEX"))) complex; + struct tree_identifier GTY ((tag ("TS_IDENTIFIER"))) identifier; + struct tree_decl_minimal GTY((tag ("TS_DECL_MINIMAL"))) decl_minimal; + struct tree_decl_common GTY ((tag ("TS_DECL_COMMON"))) decl_common; + struct tree_decl_with_rtl GTY ((tag ("TS_DECL_WRTL"))) decl_with_rtl; + struct tree_decl_non_common GTY ((tag ("TS_DECL_NON_COMMON"))) + decl_non_common; + struct tree_parm_decl GTY ((tag ("TS_PARM_DECL"))) parm_decl; + struct tree_decl_with_vis GTY ((tag ("TS_DECL_WITH_VIS"))) decl_with_vis; + struct tree_var_decl GTY ((tag ("TS_VAR_DECL"))) var_decl; + struct tree_field_decl GTY ((tag ("TS_FIELD_DECL"))) field_decl; + struct tree_label_decl GTY ((tag ("TS_LABEL_DECL"))) label_decl; + struct tree_result_decl GTY ((tag ("TS_RESULT_DECL"))) result_decl; + struct tree_const_decl GTY ((tag ("TS_CONST_DECL"))) const_decl; + struct tree_type_decl GTY ((tag ("TS_TYPE_DECL"))) type_decl; + struct tree_function_decl GTY ((tag ("TS_FUNCTION_DECL"))) function_decl; + struct tree_translation_unit_decl GTY ((tag ("TS_TRANSLATION_UNIT_DECL"))) + translation_unit_decl; + struct tree_type_common GTY ((tag ("TS_TYPE_COMMON"))) type_common; + struct tree_type_with_lang_specific GTY ((tag ("TS_TYPE_WITH_LANG_SPECIFIC"))) + type_with_lang_specific; + struct tree_type_non_common GTY ((tag ("TS_TYPE_NON_COMMON"))) + type_non_common; + struct tree_list GTY ((tag ("TS_LIST"))) list; + struct tree_vec GTY ((tag ("TS_VEC"))) vec; + struct tree_exp GTY ((tag ("TS_EXP"))) exp; + struct tree_ssa_name GTY ((tag ("TS_SSA_NAME"))) ssa_name; + struct tree_block GTY ((tag ("TS_BLOCK"))) block; + struct tree_binfo GTY ((tag ("TS_BINFO"))) binfo; + struct tree_statement_list GTY ((tag ("TS_STATEMENT_LIST"))) stmt_list; + struct tree_constructor GTY ((tag ("TS_CONSTRUCTOR"))) constructor; + struct tree_omp_clause GTY ((tag ("TS_OMP_CLAUSE"))) omp_clause; + struct tree_optimization_option GTY ((tag ("TS_OPTIMIZATION"))) optimization; + struct tree_target_option GTY ((tag ("TS_TARGET_OPTION"))) target_option; +}; + +/* Structure describing an attribute and a function to handle it. */ +struct attribute_spec { + /* The name of the attribute (without any leading or trailing __), + or NULL to mark the end of a table of attributes. */ + const char *name; + /* The minimum length of the list of arguments of the attribute. */ + int min_length; + /* The maximum length of the list of arguments of the attribute + (-1 for no maximum). */ + int max_length; + /* Whether this attribute requires a DECL. If it does, it will be passed + from types of DECLs, function return types and array element types to + the DECLs, function types and array types respectively; but when + applied to a type in any other circumstances, it will be ignored with + a warning. (If greater control is desired for a given attribute, + this should be false, and the flags argument to the handler may be + used to gain greater control in that case.) */ + bool decl_required; + /* Whether this attribute requires a type. If it does, it will be passed + from a DECL to the type of that DECL. */ + bool type_required; + /* Whether this attribute requires a function (or method) type. If it does, + it will be passed from a function pointer type to the target type, + and from a function return type (which is not itself a function + pointer type) to the function type. */ + bool function_type_required; + /* Function to handle this attribute. NODE points to the node to which + the attribute is to be applied. If a DECL, it should be modified in + place; if a TYPE, a copy should be created. NAME is the name of the + attribute (possibly with leading or trailing __). ARGS is the TREE_LIST + of the arguments (which may be NULL). FLAGS gives further information + about the context of the attribute. Afterwards, the attributes will + be added to the DECL_ATTRIBUTES or TYPE_ATTRIBUTES, as appropriate, + unless *NO_ADD_ATTRS is set to true (which should be done on error, + as well as in any other cases when the attributes should not be added + to the DECL or TYPE). Depending on FLAGS, any attributes to be + applied to another type or DECL later may be returned; + otherwise the return value should be NULL_TREE. This pointer may be + NULL if no special handling is required beyond the checks implied + by the rest of this structure. */ + tree (*handler) (tree *node, tree name, tree args, + int flags, bool *no_add_attrs); + /* Specifies if attribute affects type's identity. */ + bool affects_type_identity; +}; + +/* These functions allow a front-end to perform a manual layout of a + RECORD_TYPE. (For instance, if the placement of subsequent fields + depends on the placement of fields so far.) Begin by calling + start_record_layout. Then, call place_field for each of the + fields. Then, call finish_record_layout. See layout_type for the + default way in which these functions are used. */ +typedef struct record_layout_info_s { + /* The RECORD_TYPE that we are laying out. */ + tree t; + /* The offset into the record so far, in bytes, not including bits in + BITPOS. */ + tree offset; + /* The last known alignment of SIZE. */ + unsigned int offset_align; + /* The bit position within the last OFFSET_ALIGN bits, in bits. */ + tree bitpos; + /* The alignment of the record so far, in bits. */ + unsigned int record_align; + /* The alignment of the record so far, ignoring #pragma pack and + __attribute__ ((packed)), in bits. */ + unsigned int unpacked_align; + /* The previous field laid out. */ + tree prev_field; + /* The static variables (i.e., class variables, as opposed to + instance variables) encountered in T. */ + vec *pending_statics; + /* Bits remaining in the current alignment group */ + int remaining_in_alignment; + /* True if we've seen a packed field that didn't have normal + alignment anyway. */ + int packed_maybe_necessary; +} *record_layout_info; + +/* Iterator for going through the function arguments. */ +struct function_args_iterator { + tree next; /* TREE_LIST pointing to the next argument */ +}; + +/* Structures to map from a tree to another tree. */ +struct GTY(()) tree_map_base { + tree from; +}; + +/* Map from a tree to another tree. */ + +struct GTY((for_user)) tree_map { + struct tree_map_base base; + unsigned int hash; + tree to; +}; + +/* Map from a decl tree to another tree. */ +struct GTY((for_user)) tree_decl_map { + struct tree_map_base base; + tree to; +}; + +/* Map from a tree to an int. */ +struct GTY((for_user)) tree_int_map { + struct tree_map_base base; + unsigned int to; +}; + +/* Map from a decl tree to a tree vector. */ +struct GTY((for_user)) tree_vec_map { + struct tree_map_base base; + vec *to; +}; + +/* Abstract iterators for CALL_EXPRs. These static inline definitions + have to go towards the end of tree.h so that union tree_node is fully + defined by this point. */ + +/* Structure containing iterator state. */ +struct call_expr_arg_iterator { + tree t; /* the call_expr */ + int n; /* argument count */ + int i; /* next argument index */ +}; + +struct const_call_expr_arg_iterator { + const_tree t; /* the call_expr */ + int n; /* argument count */ + int i; /* next argument index */ +}; + +/* The builtin_info structure holds the FUNCTION_DECL of the standard builtin + function, and flags. */ +struct GTY(()) builtin_info_type { + tree decl; + /* Whether the user can use instead of explicitly using calls + to __builtin_. */ + unsigned implicit_p : 1; + /* Whether the user has provided a declaration of . */ + unsigned declared_p : 1; +}; + +/* Information about a _FloatN or _FloatNx type that may be + supported. */ +struct floatn_type_info { + /* The number N in the type name. */ + int n; + /* Whether it is an extended type _FloatNx (true) or an interchange + type (false). */ + bool extended; +}; + + +/*--------------------------------------------------------------------------- + Global variables +---------------------------------------------------------------------------*/ +/* Matrix describing the structures contained in a given tree code. */ +extern unsigned char tree_contains_struct[MAX_TREE_CODES][64]; + +/* Class of tree given its code. */ +extern const enum tree_code_class tree_code_type[]; + +/* Each tree code class has an associated string representation. + These must correspond to the tree_code_class entries. */ +extern const char *const tree_code_class_strings[]; + +/* Number of argument-words in each kind of tree-node. */ +extern const unsigned char tree_code_length[]; + +/* Vector of all alias pairs for global symbols. */ +extern GTY(()) vec *alias_pairs; + +/* Names of all the built_in classes. */ +extern const char *const built_in_class_names[BUILT_IN_LAST]; + +/* Names of all the built_in functions. */ +extern const char * built_in_names[(int) END_BUILTINS]; + +/* Number of operands and names for each OMP_CLAUSE node. */ +extern unsigned const char omp_clause_num_ops[]; +extern const char * const omp_clause_code_name[]; + +/* A vector of all translation-units. */ +extern GTY (()) vec *all_translation_units; + +/* Vector of standard trees used by the C compiler. */ +extern GTY(()) tree global_trees[TI_MAX]; + +/* The standard C integer types. Use integer_type_kind to index into + this array. */ +extern GTY(()) tree integer_types[itk_none]; + +/* Types used to represent sizes. */ +extern GTY(()) tree sizetype_tab[(int) stk_type_kind_last]; + +/* Arrays for keeping track of tree node statistics. */ +extern int tree_node_counts[]; +extern int tree_node_sizes[]; + +/* True if we are in gimple form and the actions of the folders need to + be restricted. False if we are not in gimple form and folding is not + restricted to creating gimple expressions. */ +extern bool in_gimple_form; + +/* Functional interface to the builtin functions. */ +extern GTY(()) builtin_info_type builtin_info[(int)END_BUILTINS]; + +/* If nonzero, an upper limit on alignment of structure fields, in bits, */ +extern unsigned int maximum_field_alignment; + +/* Points to the FUNCTION_DECL of the function whose body we are reading. */ +extern GTY(()) tree current_function_decl; + +/* Nonzero means a FUNC_BEGIN label was emitted. */ +extern GTY(()) const char * current_function_func_begin_label; + +/* Information about the _FloatN and _FloatNx types. */ +extern const floatn_type_info floatn_nx_types[NUM_FLOATN_NX_TYPES]; + +#endif // GCC_TREE_CORE_H diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-data-ref.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-data-ref.h new file mode 100644 index 0000000..9003ea5 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-data-ref.h @@ -0,0 +1,561 @@ +/* Data references and dependences detectors. + Copyright (C) 2003-2017 Free Software Foundation, Inc. + Contributed by Sebastian Pop + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_DATA_REF_H +#define GCC_TREE_DATA_REF_H + +#include "graphds.h" +#include "tree-chrec.h" + +/* + innermost_loop_behavior describes the evolution of the address of the memory + reference in the innermost enclosing loop. The address is expressed as + BASE + STEP * # of iteration, and base is further decomposed as the base + pointer (BASE_ADDRESS), loop invariant offset (OFFSET) and + constant offset (INIT). Examples, in loop nest + + for (i = 0; i < 100; i++) + for (j = 3; j < 100; j++) + + Example 1 Example 2 + data-ref a[j].b[i][j] *(p + x + 16B + 4B * j) + + + innermost_loop_behavior + base_address &a p + offset i * D_i x + init 3 * D_j + offsetof (b) 28 + step D_j 4 + + */ +struct innermost_loop_behavior +{ + tree base_address; + tree offset; + tree init; + tree step; + + /* Alignment information. ALIGNED_TO is set to the largest power of two + that divides OFFSET. */ + tree aligned_to; +}; + +/* Describes the evolutions of indices of the memory reference. The indices + are indices of the ARRAY_REFs, indexes in artificial dimensions + added for member selection of records and the operands of MEM_REFs. + BASE_OBJECT is the part of the reference that is loop-invariant + (note that this reference does not have to cover the whole object + being accessed, in which case UNCONSTRAINED_BASE is set; hence it is + not recommended to use BASE_OBJECT in any code generation). + For the examples above, + + base_object: a *(p + x + 4B * j_0) + indices: {j_0, +, 1}_2 {16, +, 4}_2 + 4 + {i_0, +, 1}_1 + {j_0, +, 1}_2 +*/ + +struct indices +{ + /* The object. */ + tree base_object; + + /* A list of chrecs. Access functions of the indices. */ + vec access_fns; + + /* Whether BASE_OBJECT is an access representing the whole object + or whether the access could not be constrained. */ + bool unconstrained_base; +}; + +struct dr_alias +{ + /* The alias information that should be used for new pointers to this + location. */ + struct ptr_info_def *ptr_info; +}; + +/* An integer vector. A vector formally consists of an element of a vector + space. A vector space is a set that is closed under vector addition + and scalar multiplication. In this vector space, an element is a list of + integers. */ +typedef int *lambda_vector; + +/* An integer matrix. A matrix consists of m vectors of length n (IE + all vectors are the same length). */ +typedef lambda_vector *lambda_matrix; + + + +struct data_reference +{ + /* A pointer to the statement that contains this DR. */ + gimple *stmt; + + /* A pointer to the memory reference. */ + tree ref; + + /* Auxiliary info specific to a pass. */ + void *aux; + + /* True when the data reference is in RHS of a stmt. */ + bool is_read; + + /* Behavior of the memory reference in the innermost loop. */ + struct innermost_loop_behavior innermost; + + /* Subscripts of this data reference. */ + struct indices indices; + + /* Alias information for the data reference. */ + struct dr_alias alias; +}; + +#define DR_STMT(DR) (DR)->stmt +#define DR_REF(DR) (DR)->ref +#define DR_BASE_OBJECT(DR) (DR)->indices.base_object +#define DR_UNCONSTRAINED_BASE(DR) (DR)->indices.unconstrained_base +#define DR_ACCESS_FNS(DR) (DR)->indices.access_fns +#define DR_ACCESS_FN(DR, I) DR_ACCESS_FNS (DR)[I] +#define DR_NUM_DIMENSIONS(DR) DR_ACCESS_FNS (DR).length () +#define DR_IS_READ(DR) (DR)->is_read +#define DR_IS_WRITE(DR) (!DR_IS_READ (DR)) +#define DR_BASE_ADDRESS(DR) (DR)->innermost.base_address +#define DR_OFFSET(DR) (DR)->innermost.offset +#define DR_INIT(DR) (DR)->innermost.init +#define DR_STEP(DR) (DR)->innermost.step +#define DR_PTR_INFO(DR) (DR)->alias.ptr_info +#define DR_ALIGNED_TO(DR) (DR)->innermost.aligned_to +#define DR_INNERMOST(DR) (DR)->innermost + +typedef struct data_reference *data_reference_p; + +enum data_dependence_direction { + dir_positive, + dir_negative, + dir_equal, + dir_positive_or_negative, + dir_positive_or_equal, + dir_negative_or_equal, + dir_star, + dir_independent +}; + +/* The description of the grid of iterations that overlap. At most + two loops are considered at the same time just now, hence at most + two functions are needed. For each of the functions, we store + the vector of coefficients, f[0] + x * f[1] + y * f[2] + ..., + where x, y, ... are variables. */ + +#define MAX_DIM 2 + +/* Special values of N. */ +#define NO_DEPENDENCE 0 +#define NOT_KNOWN (MAX_DIM + 1) +#define CF_NONTRIVIAL_P(CF) ((CF)->n != NO_DEPENDENCE && (CF)->n != NOT_KNOWN) +#define CF_NOT_KNOWN_P(CF) ((CF)->n == NOT_KNOWN) +#define CF_NO_DEPENDENCE_P(CF) ((CF)->n == NO_DEPENDENCE) + +typedef vec affine_fn; + +struct conflict_function +{ + unsigned n; + affine_fn fns[MAX_DIM]; +}; + +/* What is a subscript? Given two array accesses a subscript is the + tuple composed of the access functions for a given dimension. + Example: Given A[f1][f2][f3] and B[g1][g2][g3], there are three + subscripts: (f1, g1), (f2, g2), (f3, g3). These three subscripts + are stored in the data_dependence_relation structure under the form + of an array of subscripts. */ + +struct subscript +{ + /* A description of the iterations for which the elements are + accessed twice. */ + conflict_function *conflicting_iterations_in_a; + conflict_function *conflicting_iterations_in_b; + + /* This field stores the information about the iteration domain + validity of the dependence relation. */ + tree last_conflict; + + /* Distance from the iteration that access a conflicting element in + A to the iteration that access this same conflicting element in + B. The distance is a tree scalar expression, i.e. a constant or a + symbolic expression, but certainly not a chrec function. */ + tree distance; +}; + +typedef struct subscript *subscript_p; + +#define SUB_CONFLICTS_IN_A(SUB) SUB->conflicting_iterations_in_a +#define SUB_CONFLICTS_IN_B(SUB) SUB->conflicting_iterations_in_b +#define SUB_LAST_CONFLICT(SUB) SUB->last_conflict +#define SUB_DISTANCE(SUB) SUB->distance + +/* A data_dependence_relation represents a relation between two + data_references A and B. */ + +struct data_dependence_relation +{ + + struct data_reference *a; + struct data_reference *b; + + /* A "yes/no/maybe" field for the dependence relation: + + - when "ARE_DEPENDENT == NULL_TREE", there exist a dependence + relation between A and B, and the description of this relation + is given in the SUBSCRIPTS array, + + - when "ARE_DEPENDENT == chrec_known", there is no dependence and + SUBSCRIPTS is empty, + + - when "ARE_DEPENDENT == chrec_dont_know", there may be a dependence, + but the analyzer cannot be more specific. */ + tree are_dependent; + + /* For each subscript in the dependence test, there is an element in + this array. This is the attribute that labels the edge A->B of + the data_dependence_relation. */ + vec subscripts; + + /* The analyzed loop nest. */ + vec loop_nest; + + /* The classic direction vector. */ + vec dir_vects; + + /* The classic distance vector. */ + vec dist_vects; + + /* An index in loop_nest for the innermost loop that varies for + this data dependence relation. */ + unsigned inner_loop; + + /* Is the dependence reversed with respect to the lexicographic order? */ + bool reversed_p; + + /* When the dependence relation is affine, it can be represented by + a distance vector. */ + bool affine_p; + + /* Set to true when the dependence relation is on the same data + access. */ + bool self_reference_p; +}; + +typedef struct data_dependence_relation *ddr_p; + +#define DDR_A(DDR) DDR->a +#define DDR_B(DDR) DDR->b +#define DDR_AFFINE_P(DDR) DDR->affine_p +#define DDR_ARE_DEPENDENT(DDR) DDR->are_dependent +#define DDR_SUBSCRIPTS(DDR) DDR->subscripts +#define DDR_SUBSCRIPT(DDR, I) DDR_SUBSCRIPTS (DDR)[I] +#define DDR_NUM_SUBSCRIPTS(DDR) DDR_SUBSCRIPTS (DDR).length () + +#define DDR_LOOP_NEST(DDR) DDR->loop_nest +/* The size of the direction/distance vectors: the number of loops in + the loop nest. */ +#define DDR_NB_LOOPS(DDR) (DDR_LOOP_NEST (DDR).length ()) +#define DDR_INNER_LOOP(DDR) DDR->inner_loop +#define DDR_SELF_REFERENCE(DDR) DDR->self_reference_p + +#define DDR_DIST_VECTS(DDR) ((DDR)->dist_vects) +#define DDR_DIR_VECTS(DDR) ((DDR)->dir_vects) +#define DDR_NUM_DIST_VECTS(DDR) \ + (DDR_DIST_VECTS (DDR).length ()) +#define DDR_NUM_DIR_VECTS(DDR) \ + (DDR_DIR_VECTS (DDR).length ()) +#define DDR_DIR_VECT(DDR, I) \ + DDR_DIR_VECTS (DDR)[I] +#define DDR_DIST_VECT(DDR, I) \ + DDR_DIST_VECTS (DDR)[I] +#define DDR_REVERSED_P(DDR) DDR->reversed_p + + +bool dr_analyze_innermost (struct data_reference *, struct loop *); +extern bool compute_data_dependences_for_loop (struct loop *, bool, + vec *, + vec *, + vec *); +extern void debug_ddrs (vec ); +extern void dump_data_reference (FILE *, struct data_reference *); +extern void debug (data_reference &ref); +extern void debug (data_reference *ptr); +extern void debug_data_reference (struct data_reference *); +extern void debug_data_references (vec ); +extern void debug (vec &ref); +extern void debug (vec *ptr); +extern void debug_data_dependence_relation (struct data_dependence_relation *); +extern void dump_data_dependence_relations (FILE *, vec ); +extern void debug (vec &ref); +extern void debug (vec *ptr); +extern void debug_data_dependence_relations (vec ); +extern void free_dependence_relation (struct data_dependence_relation *); +extern void free_dependence_relations (vec ); +extern void free_data_ref (data_reference_p); +extern void free_data_refs (vec ); +extern bool find_data_references_in_stmt (struct loop *, gimple *, + vec *); +extern bool graphite_find_data_references_in_stmt (loop_p, loop_p, gimple *, + vec *); +tree find_data_references_in_loop (struct loop *, vec *); +bool loop_nest_has_data_refs (loop_p loop); +struct data_reference *create_data_ref (loop_p, loop_p, tree, gimple *, bool); +extern bool find_loop_nest (struct loop *, vec *); +extern struct data_dependence_relation *initialize_data_dependence_relation + (struct data_reference *, struct data_reference *, vec); +extern void compute_affine_dependence (struct data_dependence_relation *, + loop_p); +extern void compute_self_dependence (struct data_dependence_relation *); +extern bool compute_all_dependences (vec , + vec *, + vec, bool); +extern tree find_data_references_in_bb (struct loop *, basic_block, + vec *); + +extern bool dr_may_alias_p (const struct data_reference *, + const struct data_reference *, bool); +extern bool dr_equal_offsets_p (struct data_reference *, + struct data_reference *); + +/* Return true when the base objects of data references A and B are + the same memory object. */ + +static inline bool +same_data_refs_base_objects (data_reference_p a, data_reference_p b) +{ + return DR_NUM_DIMENSIONS (a) == DR_NUM_DIMENSIONS (b) + && operand_equal_p (DR_BASE_OBJECT (a), DR_BASE_OBJECT (b), 0); +} + +/* Return true when the data references A and B are accessing the same + memory object with the same access functions. */ + +static inline bool +same_data_refs (data_reference_p a, data_reference_p b) +{ + unsigned int i; + + /* The references are exactly the same. */ + if (operand_equal_p (DR_REF (a), DR_REF (b), 0)) + return true; + + if (!same_data_refs_base_objects (a, b)) + return false; + + for (i = 0; i < DR_NUM_DIMENSIONS (a); i++) + if (!eq_evolutions_p (DR_ACCESS_FN (a, i), DR_ACCESS_FN (b, i))) + return false; + + return true; +} + +/* Return true when the DDR contains two data references that have the + same access functions. */ + +static inline bool +same_access_functions (const struct data_dependence_relation *ddr) +{ + unsigned i; + + for (i = 0; i < DDR_NUM_SUBSCRIPTS (ddr); i++) + if (!eq_evolutions_p (DR_ACCESS_FN (DDR_A (ddr), i), + DR_ACCESS_FN (DDR_B (ddr), i))) + return false; + + return true; +} + +/* Returns true when all the dependences are computable. */ + +inline bool +known_dependences_p (vec dependence_relations) +{ + ddr_p ddr; + unsigned int i; + + FOR_EACH_VEC_ELT (dependence_relations, i, ddr) + if (DDR_ARE_DEPENDENT (ddr) == chrec_dont_know) + return false; + + return true; +} + +/* Returns the dependence level for a vector DIST of size LENGTH. + LEVEL = 0 means a lexicographic dependence, i.e. a dependence due + to the sequence of statements, not carried by any loop. */ + +static inline unsigned +dependence_level (lambda_vector dist_vect, int length) +{ + int i; + + for (i = 0; i < length; i++) + if (dist_vect[i] != 0) + return i + 1; + + return 0; +} + +/* Return the dependence level for the DDR relation. */ + +static inline unsigned +ddr_dependence_level (ddr_p ddr) +{ + unsigned vector; + unsigned level = 0; + + if (DDR_DIST_VECTS (ddr).exists ()) + level = dependence_level (DDR_DIST_VECT (ddr, 0), DDR_NB_LOOPS (ddr)); + + for (vector = 1; vector < DDR_NUM_DIST_VECTS (ddr); vector++) + level = MIN (level, dependence_level (DDR_DIST_VECT (ddr, vector), + DDR_NB_LOOPS (ddr))); + return level; +} + +/* Return the index of the variable VAR in the LOOP_NEST array. */ + +static inline int +index_in_loop_nest (int var, vec loop_nest) +{ + struct loop *loopi; + int var_index; + + for (var_index = 0; loop_nest.iterate (var_index, &loopi); + var_index++) + if (loopi->num == var) + break; + + return var_index; +} + +/* Returns true when the data reference DR the form "A[i] = ..." + with a stride equal to its unit type size. */ + +static inline bool +adjacent_dr_p (struct data_reference *dr) +{ + /* If this is a bitfield store bail out. */ + if (TREE_CODE (DR_REF (dr)) == COMPONENT_REF + && DECL_BIT_FIELD (TREE_OPERAND (DR_REF (dr), 1))) + return false; + + if (!DR_STEP (dr) + || TREE_CODE (DR_STEP (dr)) != INTEGER_CST) + return false; + + return tree_int_cst_equal (fold_unary (ABS_EXPR, TREE_TYPE (DR_STEP (dr)), + DR_STEP (dr)), + TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (dr)))); +} + +void split_constant_offset (tree , tree *, tree *); + +/* Compute the greatest common divisor of a VECTOR of SIZE numbers. */ + +static inline int +lambda_vector_gcd (lambda_vector vector, int size) +{ + int i; + int gcd1 = 0; + + if (size > 0) + { + gcd1 = vector[0]; + for (i = 1; i < size; i++) + gcd1 = gcd (gcd1, vector[i]); + } + return gcd1; +} + +/* Allocate a new vector of given SIZE. */ + +static inline lambda_vector +lambda_vector_new (int size) +{ + /* ??? We shouldn't abuse the GC allocator here. */ + return ggc_cleared_vec_alloc (size); +} + +/* Clear out vector VEC1 of length SIZE. */ + +static inline void +lambda_vector_clear (lambda_vector vec1, int size) +{ + memset (vec1, 0, size * sizeof (*vec1)); +} + +/* Returns true when the vector V is lexicographically positive, in + other words, when the first nonzero element is positive. */ + +static inline bool +lambda_vector_lexico_pos (lambda_vector v, + unsigned n) +{ + unsigned i; + for (i = 0; i < n; i++) + { + if (v[i] == 0) + continue; + if (v[i] < 0) + return false; + if (v[i] > 0) + return true; + } + return true; +} + +/* Return true if vector VEC1 of length SIZE is the zero vector. */ + +static inline bool +lambda_vector_zerop (lambda_vector vec1, int size) +{ + int i; + for (i = 0; i < size; i++) + if (vec1[i] != 0) + return false; + return true; +} + +/* Allocate a matrix of M rows x N cols. */ + +static inline lambda_matrix +lambda_matrix_new (int m, int n, struct obstack *lambda_obstack) +{ + lambda_matrix mat; + int i; + + mat = XOBNEWVEC (lambda_obstack, lambda_vector, m); + + for (i = 0; i < m; i++) + mat[i] = XOBNEWVEC (lambda_obstack, int, n); + + return mat; +} + +#endif /* GCC_TREE_DATA_REF_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-dfa.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-dfa.h new file mode 100644 index 0000000..fb1f53f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-dfa.h @@ -0,0 +1,42 @@ +/* Header file for tree data flow functions. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_DFA_H +#define GCC_TREE_DFA_H + +extern void renumber_gimple_stmt_uids (void); +extern void renumber_gimple_stmt_uids_in_blocks (basic_block *, int); +extern void dump_variable (FILE *, tree); +extern void debug_variable (tree); +extern void dump_dfa_stats (FILE *); +extern void debug_dfa_stats (void); +extern tree ssa_default_def (struct function *, tree); +extern void set_ssa_default_def (struct function *, tree, tree); +extern tree get_or_create_ssa_default_def (struct function *, tree); +extern tree get_ref_base_and_extent (tree, HOST_WIDE_INT *, + HOST_WIDE_INT *, HOST_WIDE_INT *, bool *); +extern tree get_addr_base_and_unit_offset_1 (tree, HOST_WIDE_INT *, + tree (*) (tree)); +extern tree get_addr_base_and_unit_offset (tree, HOST_WIDE_INT *); +extern bool stmt_references_abnormal_ssa_name (gimple *); +extern void replace_abnormal_ssa_names (gimple *); +extern void dump_enumerated_decls (FILE *, int); + + +#endif /* GCC_TREE_DFA_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-diagnostic.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-diagnostic.h new file mode 100644 index 0000000..e95183f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-diagnostic.h @@ -0,0 +1,60 @@ +/* Various declarations for language-independent diagnostics + subroutines that are only for use in the compilers proper and not + the driver or other programs. + Copyright (C) 2000-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_DIAGNOSTIC_H +#define GCC_TREE_DIAGNOSTIC_H + +/* TREE_BLOCK if the diagnostic is to be reported in some inline + function inlined into other function, otherwise NULL. */ +#define diagnostic_abstract_origin(DI) \ + ((tree) diagnostic_info_auxiliary_data (DI)) + +/* Function of last diagnostic message; more generally, function such + that if next diagnostic message is in it then we don't have to + mention the function name. */ +#define diagnostic_last_function(DC) \ + ((tree) diagnostic_context_auxiliary_data (DC)) + +/* True if the last function in which a diagnostic was reported is + different from the current one. */ +#define diagnostic_last_function_changed(DC, DI) \ + (diagnostic_last_function (DC) != (diagnostic_abstract_origin (DI) \ + ? diagnostic_abstract_origin (DI) \ + : current_function_decl)) + +/* Remember the current function as being the last one in which we report + a diagnostic. */ +#define diagnostic_set_last_function(DC, DI) \ + diagnostic_context_auxiliary_data (DC) \ + = (((DI) && diagnostic_abstract_origin (DI)) \ + ? diagnostic_abstract_origin (DI) \ + : current_function_decl) + +void diagnostic_report_current_function (diagnostic_context *, + diagnostic_info *); +void virt_loc_aware_diagnostic_finalizer (diagnostic_context *, + diagnostic_info *); + +void tree_diagnostics_defaults (diagnostic_context *context); +bool default_tree_printer (pretty_printer *, text_info *, const char *, + int, bool, bool, bool); + +#endif /* ! GCC_TREE_DIAGNOSTIC_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-dump.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-dump.h new file mode 100644 index 0000000..c4df8f2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-dump.h @@ -0,0 +1,93 @@ +/* Tree-dumping functionality for intermediate representation. + Copyright (C) 1999-2017 Free Software Foundation, Inc. + Written by Mark Mitchell + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_DUMP_H +#define GCC_TREE_DUMP_H + +#include "splay-tree.h" +#include "dumpfile.h" + +typedef struct dump_info *dump_info_p; + +/* Flags used with queue functions. */ +#define DUMP_NONE 0 +#define DUMP_BINFO 1 + +/* Information about a node to be dumped. */ + +typedef struct dump_node_info +{ + /* The index for the node. */ + unsigned int index; + /* Nonzero if the node is a binfo. */ + unsigned int binfo_p : 1; +} *dump_node_info_p; + +/* A dump_queue is a link in the queue of things to be dumped. */ + +typedef struct dump_queue +{ + /* The queued tree node. */ + splay_tree_node node; + /* The next node in the queue. */ + struct dump_queue *next; +} *dump_queue_p; + +/* A dump_info gives information about how we should perform the dump + and about the current state of the dump. */ + +struct dump_info +{ + /* The stream on which to dump the information. */ + FILE *stream; + /* The original node. */ + const_tree node; + /* User flags. */ + int flags; + /* The next unused node index. */ + unsigned int index; + /* The next column. */ + unsigned int column; + /* The first node in the queue of nodes to be written out. */ + dump_queue_p queue; + /* The last node in the queue. */ + dump_queue_p queue_end; + /* Free queue nodes. */ + dump_queue_p free_list; + /* The tree nodes which we have already written out. The + keys are the addresses of the nodes; the values are the integer + indices we assigned them. */ + splay_tree nodes; +}; + +/* Dump the CHILD and its children. */ +#define dump_child(field, child) \ + queue_and_dump_index (di, field, child, DUMP_NONE) + +extern void dump_pointer (dump_info_p, const char *, void *); +extern void dump_int (dump_info_p, const char *, int); +extern void dump_string (dump_info_p, const char *); +extern void dump_string_field (dump_info_p, const char *, const char *); +extern void queue_and_dump_index (dump_info_p, const char *, const_tree, int); +extern void queue_and_dump_type (dump_info_p, const_tree); +extern void dump_function (int, tree); +extern int dump_flag (dump_info_p, int, const_tree); + +#endif /* ! GCC_TREE_DUMP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-eh.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-eh.h new file mode 100644 index 0000000..2883628 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-eh.h @@ -0,0 +1,55 @@ +/* Header file for exception handling. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_EH_H +#define GCC_TREE_EH_H + + +typedef struct eh_region_d *eh_region; + +extern void using_eh_for_cleanups (void); +extern void add_stmt_to_eh_lp (gimple *, int); +extern bool remove_stmt_from_eh_lp_fn (struct function *, gimple *); +extern bool remove_stmt_from_eh_lp (gimple *); +extern int lookup_stmt_eh_lp_fn (struct function *, gimple *); +extern int lookup_stmt_eh_lp (gimple *); +extern bool make_eh_dispatch_edges (geh_dispatch *); +extern void make_eh_edges (gimple *); +extern edge redirect_eh_edge (edge, basic_block); +extern void redirect_eh_dispatch_edge (geh_dispatch *, edge, basic_block); +extern bool operation_could_trap_helper_p (enum tree_code, bool, bool, bool, + bool, tree, bool *); +extern bool operation_could_trap_p (enum tree_code, bool, bool, tree); +extern bool tree_could_trap_p (tree); +extern bool stmt_could_throw_p (gimple *); +extern bool tree_could_throw_p (tree); +extern bool stmt_can_throw_external (gimple *); +extern bool stmt_can_throw_internal (gimple *); +extern bool maybe_clean_eh_stmt_fn (struct function *, gimple *); +extern bool maybe_clean_eh_stmt (gimple *); +extern bool maybe_clean_or_replace_eh_stmt (gimple *, gimple *); +extern bool maybe_duplicate_eh_stmt_fn (struct function *, gimple *, + struct function *, gimple *, + hash_map *, int); +extern bool maybe_duplicate_eh_stmt (gimple *, gimple *); +extern void maybe_remove_unreachable_handlers (void); +extern bool verify_eh_edges (gimple *); +extern bool verify_eh_dispatch_edge (geh_dispatch *); + +#endif /* GCC_TREE_EH_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-hash-traits.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-hash-traits.h new file mode 100644 index 0000000..01fda3c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-hash-traits.h @@ -0,0 +1,84 @@ +/* Traits for hashing trees. + Copyright (C) 2014-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef tree_hash_traits_h +#define tree_hash_traits_h + +/* Hash for trees based on operand_equal_p. */ +struct tree_operand_hash : ggc_ptr_hash +{ + static inline hashval_t hash (const value_type &); + static inline bool equal (const value_type &, + const compare_type &); +}; + +inline hashval_t +tree_operand_hash::hash (const value_type &t) +{ + return iterative_hash_expr (t, 0); +} + +inline bool +tree_operand_hash::equal (const value_type &t1, + const compare_type &t2) +{ + return operand_equal_p (t1, t2, 0); +} + +/* Hasher for tree decls. Pointer equality is enough here, but the DECL_UID + is a better hash than the pointer value and gives a predictable traversal + order. */ +struct tree_decl_hash : ggc_ptr_hash +{ + static inline hashval_t hash (tree); +}; + +inline hashval_t +tree_decl_hash::hash (tree t) +{ + return DECL_UID (t); +} + +/* Hash for SSA_NAMEs in the same function. Pointer equality is enough + here, but the SSA_NAME_VERSION is a better hash than the pointer + value and gives a predictable traversal order. */ +struct tree_ssa_name_hash : ggc_ptr_hash +{ + static inline hashval_t hash (tree); +}; + +inline hashval_t +tree_ssa_name_hash::hash (tree t) +{ + return SSA_NAME_VERSION (t); +} + +/* Hasher for general trees, based on their TREE_HASH. */ +struct tree_hash : ggc_ptr_hash +{ + static hashval_t hash (tree); +}; + +inline hashval_t +tree_hash::hash (tree t) +{ + return TREE_HASH (t); +} + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-hasher.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-hasher.h new file mode 100644 index 0000000..2241830 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-hasher.h @@ -0,0 +1,65 @@ +/* Hash Table Helper for Trees + Copyright (C) 2012-2017 Free Software Foundation, Inc. + Contributed by Lawrence Crowl + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_HASHER_H +#define GCC_TREE_HASHER_H 1 + +struct int_tree_map { + unsigned int uid; + tree to; +}; + +/* Hashtable helpers. */ + +struct int_tree_hasher +{ + typedef int_tree_map value_type; + typedef int_tree_map compare_type; + static inline hashval_t hash (const value_type &); + static inline bool equal (const value_type &, const compare_type &); + static bool is_deleted (const value_type &v) + { + return v.to == reinterpret_cast (1); + } + static void mark_deleted (value_type &v) { v.to = reinterpret_cast (0x1); } + static bool is_empty (const value_type &v) { return v.to == NULL; } + static void mark_empty (value_type &v) { v.to = NULL; } + static void remove (value_type &) {} +}; + +/* Hash a UID in a int_tree_map. */ + +inline hashval_t +int_tree_hasher::hash (const value_type &item) +{ + return item.uid; +} + +/* Return true if the uid in both int tree maps are equal. */ + +inline bool +int_tree_hasher::equal (const value_type &a, const compare_type &b) +{ + return (a.uid == b.uid); +} + +typedef hash_table int_tree_htab_type; + +#endif /* GCC_TREE_HASHER_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-if-conv.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-if-conv.h new file mode 100644 index 0000000..9a8d17d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-if-conv.h @@ -0,0 +1,24 @@ +/* Copyright (C) 2016-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_IF_CONV_H +#define GCC_TREE_IF_CONV_H + +unsigned int tree_if_conversion (struct loop *); + +#endif /* GCC_TREE_IF_CONV_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-inline.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-inline.h new file mode 100644 index 0000000..ffb8333 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-inline.h @@ -0,0 +1,231 @@ +/* Tree inlining hooks and declarations. + Copyright (C) 2001-2017 Free Software Foundation, Inc. + Contributed by Alexandre Oliva + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_INLINE_H +#define GCC_TREE_INLINE_H + + +struct cgraph_edge; + +/* Indicate the desired behavior wrt call graph edges. We can either + duplicate the edge (inlining, cloning), move the edge (versioning, + parallelization), or move the edges of the clones (saving). */ + +enum copy_body_cge_which +{ + CB_CGE_DUPLICATE, + CB_CGE_MOVE, + CB_CGE_MOVE_CLONES +}; + +typedef int_hash dependence_hash; + +/* Data required for function body duplication. */ + +struct copy_body_data +{ + /* FUNCTION_DECL for function being inlined, or in general the + source function providing the original trees. */ + tree src_fn; + + /* FUNCTION_DECL for function being inlined into, or in general + the destination function receiving the new trees. */ + tree dst_fn; + + /* Callgraph node of the source function. */ + struct cgraph_node *src_node; + + /* Callgraph node of the destination function. */ + struct cgraph_node *dst_node; + + /* struct function for function being inlined. Usually this is the same + as DECL_STRUCT_FUNCTION (src_fn), but can be different if saved_cfg + and saved_eh are in use. */ + struct function *src_cfun; + + /* The VAR_DECL for the return value. */ + tree retvar; + + /* The VAR_DECL for the return bounds. */ + tree retbnd; + + /* Assign statements that need bounds copy. */ + vec assign_stmts; + + /* The map from local declarations in the inlined function to + equivalents in the function into which it is being inlined. */ + hash_map *decl_map; + + /* Create a new decl to replace DECL in the destination function. */ + tree (*copy_decl) (tree, struct copy_body_data *); + + /* Current BLOCK. */ + tree block; + + /* GIMPLE_CALL if va arg parameter packs should be expanded or NULL + is not. */ + gcall *call_stmt; + + /* Exception landing pad the inlined call lies in. */ + int eh_lp_nr; + + /* Maps region and landing pad structures from the function being copied + to duplicates created within the function we inline into. */ + hash_map *eh_map; + + /* We use the same mechanism do all sorts of different things. Rather + than enumerating the different cases, we categorize the behavior + in the various situations. */ + + /* What to do with call graph edges. */ + enum copy_body_cge_which transform_call_graph_edges; + + /* True if a new CFG should be created. False for inlining, true for + everything else. */ + bool transform_new_cfg; + + /* True if RETURN_EXPRs should be transformed to just the contained + MODIFY_EXPR. The branch semantics of the return will be handled + by manipulating the CFG rather than a statement. */ + bool transform_return_to_modify; + + /* True if the parameters of the source function are transformed. + Only true for inlining. */ + bool transform_parameter; + + /* True if this statement will need to be regimplified. */ + bool regimplify; + + /* True if trees should not be unshared. */ + bool do_not_unshare; + + /* > 0 if we are remapping a type currently. */ + int remapping_type_depth; + + /* A function to be called when duplicating BLOCK nodes. */ + void (*transform_lang_insert_block) (tree); + + /* Statements that might be possibly folded. */ + hash_set *statements_to_fold; + + /* Entry basic block to currently copied body. */ + basic_block entry_bb; + + /* For partial function versioning, bitmap of bbs to be copied, + otherwise NULL. */ + bitmap blocks_to_copy; + + /* Debug statements that need processing. */ + vec debug_stmts; + + /* A map from local declarations in the inlined function to + equivalents in the function into which it is being inlined, where + the originals have been mapped to a value rather than to a + variable. */ + hash_map *debug_map; + + /* A map from the inlined functions dependence info cliques to + equivalents in the function into which it is being inlined. */ + hash_map *dependence_map; + + /* A list of addressable local variables remapped into the caller + when inlining a call within an OpenMP SIMD-on-SIMT loop. */ + vec *dst_simt_vars; + + /* Cilk keywords currently need to replace some variables that + ordinary nested functions do not. */ + bool remap_var_for_cilk; + + /* Do not create new declarations when within type remapping. */ + bool prevent_decl_creation_for_types; +}; + +/* Weights of constructions for estimate_num_insns. */ + +struct eni_weights +{ + /* Cost per call. */ + unsigned call_cost; + + /* Cost per indirect call. */ + unsigned indirect_call_cost; + + /* Cost per call to a target specific builtin */ + unsigned target_builtin_call_cost; + + /* Cost of "expensive" div and mod operations. */ + unsigned div_mod_cost; + + /* Cost for omp construct. */ + unsigned omp_cost; + + /* Cost for tm transaction. */ + unsigned tm_cost; + + /* Cost of return. */ + unsigned return_cost; + + /* True when time of statement should be estimated. Thus, the + cost of a switch statement is logarithmic rather than linear in number + of cases. */ + bool time_based; +}; + +/* Weights that estimate_num_insns uses for heuristics in inlining. */ + +extern eni_weights eni_inlining_weights; + +/* Weights that estimate_num_insns uses to estimate the size of the + produced code. */ + +extern eni_weights eni_size_weights; + +/* Weights that estimate_num_insns uses to estimate the time necessary + to execute the produced code. */ + +extern eni_weights eni_time_weights; + +/* Function prototypes. */ +void init_inline_once (void); +extern tree copy_tree_body_r (tree *, int *, void *); +extern void insert_decl_map (copy_body_data *, tree, tree); +unsigned int optimize_inline_calls (tree); +tree maybe_inline_call_in_expr (tree); +bool tree_inlinable_function_p (tree); +tree copy_tree_r (tree *, int *, void *); +tree copy_decl_no_change (tree decl, copy_body_data *id); +int estimate_move_cost (tree type, bool); +int estimate_num_insns (gimple *, eni_weights *); +int estimate_num_insns_fn (tree, eni_weights *); +int estimate_num_insns_seq (gimple_seq, eni_weights *); +bool tree_versionable_function_p (tree); +extern tree remap_decl (tree decl, copy_body_data *id); +extern tree remap_type (tree type, copy_body_data *id); +extern gimple_seq copy_gimple_seq_and_replace_locals (gimple_seq seq); +extern bool debug_find_tree (tree, tree); +extern tree copy_fn (tree, tree&, tree&); +extern const char *copy_forbidden (struct function *fun); +extern tree copy_decl_for_dup_finish (copy_body_data *id, tree decl, tree copy); + +/* This is in tree-inline.c since the routine uses + data structures from the inliner. */ +extern tree build_duplicate_type (tree); + +#endif /* GCC_TREE_INLINE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-into-ssa.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-into-ssa.h new file mode 100644 index 0000000..65c146b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-into-ssa.h @@ -0,0 +1,53 @@ +/* Header file for normal form into SSA. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_INTO_SSA_H +#define GCC_TREE_INTO_SSA_H + +extern tree get_current_def (tree); +extern void set_current_def (tree, tree); +void delete_update_ssa (void); +tree create_new_def_for (tree, gimple *, def_operand_p); +void mark_virtual_operands_for_renaming (struct function *); +void mark_virtual_operand_for_renaming (tree); +void mark_virtual_phi_result_for_renaming (gphi *); +bool need_ssa_update_p (struct function *); +bool name_registered_for_update_p (tree); +void release_ssa_name_after_update_ssa (tree); +void update_ssa (unsigned); + +/* Prototypes for debugging functions. */ +extern void debug_decl_set (bitmap set); +extern void dump_defs_stack (FILE *, int); +extern void debug_defs_stack (int); +extern void dump_currdefs (FILE *); +extern void debug_currdefs (void); +extern void dump_tree_ssa (FILE *); +extern void debug_tree_ssa (void); +extern void dump_tree_ssa_stats (FILE *); +extern void debug_tree_ssa_stats (void); +extern void dump_var_infos (FILE *); +extern void debug_var_infos (void); +extern void dump_names_replaced_by (FILE *, tree); +extern void debug_names_replaced_by (tree); +extern void dump_update_ssa (FILE *); +extern void debug_update_ssa (void); +extern bitmap names_to_release; + +#endif /* GCC_TREE_INTO_SSA_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-iterator.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-iterator.h new file mode 100644 index 0000000..4e71355 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-iterator.h @@ -0,0 +1,123 @@ +/* Iterator routines for manipulating GENERIC tree statement list. + Copyright (C) 2003-2017 Free Software Foundation, Inc. + Contributed by Andrew MacLeod + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + + +/* This file is dependent upon the implementation of tree's. It provides an + abstract interface to the tree objects such that if all tree creation and + manipulations are done through this interface, we can easily change the + implementation of tree's, and not impact other code. */ + +#ifndef GCC_TREE_ITERATOR_H +#define GCC_TREE_ITERATOR_H 1 + +/* Iterator object for GENERIC or GIMPLE TREE statements. */ + +struct tree_stmt_iterator { + struct tree_statement_list_node *ptr; + tree container; +}; + +static inline tree_stmt_iterator +tsi_start (tree t) +{ + tree_stmt_iterator i; + + i.ptr = STATEMENT_LIST_HEAD (t); + i.container = t; + + return i; +} + +static inline tree_stmt_iterator +tsi_last (tree t) +{ + tree_stmt_iterator i; + + i.ptr = STATEMENT_LIST_TAIL (t); + i.container = t; + + return i; +} + +static inline bool +tsi_end_p (tree_stmt_iterator i) +{ + return i.ptr == NULL; +} + +static inline bool +tsi_one_before_end_p (tree_stmt_iterator i) +{ + return i.ptr != NULL && i.ptr->next == NULL; +} + +static inline void +tsi_next (tree_stmt_iterator *i) +{ + i->ptr = i->ptr->next; +} + +static inline void +tsi_prev (tree_stmt_iterator *i) +{ + i->ptr = i->ptr->prev; +} + +static inline tree * +tsi_stmt_ptr (tree_stmt_iterator i) +{ + return &i.ptr->stmt; +} + +static inline tree +tsi_stmt (tree_stmt_iterator i) +{ + return i.ptr->stmt; +} + +enum tsi_iterator_update +{ + TSI_NEW_STMT, /* Only valid when single statement is added, move + iterator to it. */ + TSI_SAME_STMT, /* Leave the iterator at the same statement. */ + TSI_CHAIN_START, /* Only valid when chain of statements is added, move + iterator to the first statement in the chain. */ + TSI_CHAIN_END, /* Only valid when chain of statements is added, move + iterator to the last statement in the chain. */ + TSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable for + linking other statements/chains of statements in + the same direction. */ +}; + +extern void tsi_link_before (tree_stmt_iterator *, tree, + enum tsi_iterator_update); +extern void tsi_link_after (tree_stmt_iterator *, tree, + enum tsi_iterator_update); + +extern void tsi_delink (tree_stmt_iterator *); + +extern tree alloc_stmt_list (void); +extern void free_stmt_list (tree); +extern void append_to_statement_list (tree, tree *); +extern void append_to_statement_list_force (tree, tree *); +extern tree expr_first (tree); +extern tree expr_last (tree); + +#endif /* GCC_TREE_ITERATOR_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-nested.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-nested.h new file mode 100644 index 0000000..1076402 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-nested.h @@ -0,0 +1,27 @@ +/* Header file for Nested function decomposition for GIMPLE. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_NESTED_H +#define GCC_TREE_NESTED_H + +extern tree build_addr (tree); +extern void insert_field_into_struct (tree, tree); +extern void lower_nested_functions (tree); + +#endif /* GCC_TREE_NESTED_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-object-size.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-object-size.h new file mode 100644 index 0000000..1b55805 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-object-size.h @@ -0,0 +1,27 @@ +/* Declarations for tree-object-size.c. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_OBJECT_SIZE_H +#define GCC_TREE_OBJECT_SIZE_H + +extern void init_object_sizes (void); +extern void fini_object_sizes (void); +extern bool compute_builtin_object_size (tree, int, unsigned HOST_WIDE_INT *); + +#endif // GCC_TREE_OBJECT_SIZE_H diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-outof-ssa.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-outof-ssa.h new file mode 100644 index 0000000..e751a26 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-outof-ssa.h @@ -0,0 +1,78 @@ +/* Routines for expanding from SSA form to RTL. + Copyright (C) 2009-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + + +#ifndef GCC_TREE_OUTOF_SSA_H +#define GCC_TREE_OUTOF_SSA_H + + +/* This structure (of which only a singleton SA exists) is used to + pass around information between the outof-SSA functions, cfgexpand + and expand itself. */ +struct ssaexpand +{ + /* The computed partitions of SSA names are stored here. */ + var_map map; + + /* For an SSA name version V bit V is set iff TER decided that + its definition should be forwarded. */ + bitmap values; + + /* For a partition number I partition_to_pseudo[I] contains the + RTL expression of the allocated space of it (either a MEM or + a pseudos REG). */ + rtx *partition_to_pseudo; + + /* If partition I contains an SSA name that has a default def for a + parameter, bit I will be set in this bitmap. */ + bitmap partitions_for_parm_default_defs; +}; + +/* This is the singleton described above. */ +extern struct ssaexpand SA; + +/* Returns the RTX expression representing the storage of the outof-SSA + partition that the SSA name EXP is a member of. */ +static inline rtx +get_rtx_for_ssa_name (tree exp) +{ + int p = partition_find (SA.map->var_partition, SSA_NAME_VERSION (exp)); + if (SA.map->partition_to_view) + p = SA.map->partition_to_view[p]; + gcc_assert (p != NO_PARTITION); + return SA.partition_to_pseudo[p]; +} + +/* If TER decided to forward the definition of SSA name EXP this function + returns the defining statement, otherwise NULL. */ +static inline gimple * +get_gimple_for_ssa_name (tree exp) +{ + int v = SSA_NAME_VERSION (exp); + if (SA.values && bitmap_bit_p (SA.values, v)) + return SSA_NAME_DEF_STMT (exp); + return NULL; +} + +extern bool ssa_is_replaceable_p (gimple *stmt); +extern void finish_out_of_ssa (struct ssaexpand *sa); +extern unsigned int rewrite_out_of_ssa (struct ssaexpand *sa); +extern void expand_phi_nodes (struct ssaexpand *sa); + +#endif /* GCC_TREE_OUTOF_SSA_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-parloops.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-parloops.h new file mode 100644 index 0000000..436146a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-parloops.h @@ -0,0 +1,25 @@ +/* Header file for loop autoparallelization. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_PARLOOPS_H +#define GCC_TREE_PARLOOPS_H + +extern bool parallelized_function_p (tree); + +#endif /* GCC_TREE_PARLOOPS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-pass.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-pass.h new file mode 100644 index 0000000..85bfba7 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-pass.h @@ -0,0 +1,654 @@ +/* Definitions for describing one tree-ssa optimization pass. + Copyright (C) 2004-2017 Free Software Foundation, Inc. + Contributed by Richard Henderson + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + + +#ifndef GCC_TREE_PASS_H +#define GCC_TREE_PASS_H 1 + +#include "timevar.h" +#include "dumpfile.h" + +struct function; + +/* Optimization pass type. */ +enum opt_pass_type +{ + GIMPLE_PASS, + RTL_PASS, + SIMPLE_IPA_PASS, + IPA_PASS +}; + +/* Metadata for a pass, non-varying across all instances of a pass. */ +struct pass_data +{ + /* Optimization pass type. */ + enum opt_pass_type type; + + /* Terse name of the pass used as a fragment of the dump file + name. If the name starts with a star, no dump happens. */ + const char *name; + + /* The -fopt-info optimization group flags as defined in dumpfile.h. */ + unsigned int optinfo_flags; + + /* The timevar id associated with this pass. */ + /* ??? Ideally would be dynamically assigned. */ + timevar_id_t tv_id; + + /* Sets of properties input and output from this pass. */ + unsigned int properties_required; + unsigned int properties_provided; + unsigned int properties_destroyed; + + /* Flags indicating common sets things to do before and after. */ + unsigned int todo_flags_start; + unsigned int todo_flags_finish; +}; + +namespace gcc +{ + class context; +} // namespace gcc + +/* An instance of a pass. This is also "pass_data" to minimize the + changes in existing code. */ +class opt_pass : public pass_data +{ +public: + virtual ~opt_pass () { } + + /* Create a copy of this pass. + + Passes that can have multiple instances must provide their own + implementation of this, to ensure that any sharing of state between + this instance and the copy is "wired up" correctly. + + The default implementation prints an error message and aborts. */ + virtual opt_pass *clone (); + virtual void set_pass_param (unsigned int, bool); + + /* This pass and all sub-passes are executed only if the function returns + true. The default implementation returns true. */ + virtual bool gate (function *fun); + + /* This is the code to run. If this is not overridden, then there should + be sub-passes otherwise this pass does nothing. + The return value contains TODOs to execute in addition to those in + TODO_flags_finish. */ + virtual unsigned int execute (function *fun); + +protected: + opt_pass (const pass_data&, gcc::context *); + +public: + /* A list of sub-passes to run, dependent on gate predicate. */ + opt_pass *sub; + + /* Next in the list of passes to run, independent of gate predicate. */ + opt_pass *next; + + /* Static pass number, used as a fragment of the dump file name. */ + int static_pass_number; + +protected: + gcc::context *m_ctxt; +}; + +/* Description of GIMPLE pass. */ +class gimple_opt_pass : public opt_pass +{ +protected: + gimple_opt_pass (const pass_data& data, gcc::context *ctxt) + : opt_pass (data, ctxt) + { + } +}; + +/* Description of RTL pass. */ +class rtl_opt_pass : public opt_pass +{ +protected: + rtl_opt_pass (const pass_data& data, gcc::context *ctxt) + : opt_pass (data, ctxt) + { + } +}; + +class varpool_node; +struct cgraph_node; +struct lto_symtab_encoder_d; + +/* Description of IPA pass with generate summary, write, execute, read and + transform stages. */ +class ipa_opt_pass_d : public opt_pass +{ +public: + /* IPA passes can analyze function body and variable initializers + using this hook and produce summary. */ + void (*generate_summary) (void); + + /* This hook is used to serialize IPA summaries on disk. */ + void (*write_summary) (void); + + /* This hook is used to deserialize IPA summaries from disk. */ + void (*read_summary) (void); + + /* This hook is used to serialize IPA optimization summaries on disk. */ + void (*write_optimization_summary) (void); + + /* This hook is used to deserialize IPA summaries from disk. */ + void (*read_optimization_summary) (void); + + /* Hook to convert gimple stmt uids into true gimple statements. The second + parameter is an array of statements indexed by their uid. */ + void (*stmt_fixup) (struct cgraph_node *, gimple **); + + /* Results of interprocedural propagation of an IPA pass is applied to + function body via this hook. */ + unsigned int function_transform_todo_flags_start; + unsigned int (*function_transform) (struct cgraph_node *); + void (*variable_transform) (varpool_node *); + +protected: + ipa_opt_pass_d (const pass_data& data, gcc::context *ctxt, + void (*generate_summary) (void), + void (*write_summary) (void), + void (*read_summary) (void), + void (*write_optimization_summary) (void), + void (*read_optimization_summary) (void), + void (*stmt_fixup) (struct cgraph_node *, gimple **), + unsigned int function_transform_todo_flags_start, + unsigned int (*function_transform) (struct cgraph_node *), + void (*variable_transform) (varpool_node *)) + : opt_pass (data, ctxt), + generate_summary (generate_summary), + write_summary (write_summary), + read_summary (read_summary), + write_optimization_summary (write_optimization_summary), + read_optimization_summary (read_optimization_summary), + stmt_fixup (stmt_fixup), + function_transform_todo_flags_start (function_transform_todo_flags_start), + function_transform (function_transform), + variable_transform (variable_transform) + { + } +}; + +/* Description of simple IPA pass. Simple IPA passes have just one execute + hook. */ +class simple_ipa_opt_pass : public opt_pass +{ +protected: + simple_ipa_opt_pass (const pass_data& data, gcc::context *ctxt) + : opt_pass (data, ctxt) + { + } +}; + +/* Pass properties. */ +#define PROP_gimple_any (1 << 0) /* entire gimple grammar */ +#define PROP_gimple_lcf (1 << 1) /* lowered control flow */ +#define PROP_gimple_leh (1 << 2) /* lowered eh */ +#define PROP_cfg (1 << 3) +#define PROP_ssa (1 << 5) +#define PROP_no_crit_edges (1 << 6) +#define PROP_rtl (1 << 7) +#define PROP_gimple_lomp (1 << 8) /* lowered OpenMP directives */ +#define PROP_cfglayout (1 << 9) /* cfglayout mode on RTL */ +#define PROP_gimple_lcx (1 << 10) /* lowered complex */ +#define PROP_loops (1 << 11) /* preserve loop structures */ +#define PROP_gimple_lvec (1 << 12) /* lowered vector */ +#define PROP_gimple_eomp (1 << 13) /* no OpenMP directives */ +#define PROP_gimple_lva (1 << 14) /* No va_arg internal function. */ +#define PROP_gimple_opt_math (1 << 15) /* Disable canonicalization + of math functions; the + current choices have + been optimized. */ +#define PROP_gimple_lomp_dev (1 << 16) /* done omp_device_lower */ + +#define PROP_trees \ + (PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh | PROP_gimple_lomp) + +/* To-do flags. */ +#define TODO_do_not_ggc_collect (1 << 1) +#define TODO_cleanup_cfg (1 << 5) +#define TODO_verify_il (1 << 6) +#define TODO_dump_symtab (1 << 7) +#define TODO_remove_functions (1 << 8) +#define TODO_rebuild_frequencies (1 << 9) + +/* To-do flags for calls to update_ssa. */ + +/* Update the SSA form inserting PHI nodes for newly exposed symbols + and virtual names marked for updating. When updating real names, + only insert PHI nodes for a real name O_j in blocks reached by all + the new and old definitions for O_j. If the iterated dominance + frontier for O_j is not pruned, we may end up inserting PHI nodes + in blocks that have one or more edges with no incoming definition + for O_j. This would lead to uninitialized warnings for O_j's + symbol. */ +#define TODO_update_ssa (1 << 11) + +/* Update the SSA form without inserting any new PHI nodes at all. + This is used by passes that have either inserted all the PHI nodes + themselves or passes that need only to patch use-def and def-def + chains for virtuals (e.g., DCE). */ +#define TODO_update_ssa_no_phi (1 << 12) + +/* Insert PHI nodes everywhere they are needed. No pruning of the + IDF is done. This is used by passes that need the PHI nodes for + O_j even if it means that some arguments will come from the default + definition of O_j's symbol. + + WARNING: If you need to use this flag, chances are that your pass + may be doing something wrong. Inserting PHI nodes for an old name + where not all edges carry a new replacement may lead to silent + codegen errors or spurious uninitialized warnings. */ +#define TODO_update_ssa_full_phi (1 << 13) + +/* Passes that update the SSA form on their own may want to delegate + the updating of virtual names to the generic updater. Since FUD + chains are easier to maintain, this simplifies the work they need + to do. NOTE: If this flag is used, any OLD->NEW mappings for real + names are explicitly destroyed and only the symbols marked for + renaming are processed. */ +#define TODO_update_ssa_only_virtuals (1 << 14) + +/* Some passes leave unused local variables that can be removed from + cfun->local_decls. This reduces the size of dump files + and the memory footprint for VAR_DECLs. */ +#define TODO_remove_unused_locals (1 << 15) + +/* Call df_finish at the end of the pass. This is done after all of + the dumpers have been allowed to run so that they have access to + the instance before it is destroyed. */ +#define TODO_df_finish (1 << 17) + +/* Call df_verify at the end of the pass if checking is enabled. */ +#define TODO_df_verify (1 << 18) + +/* Internally used for the first instance of a pass. */ +#define TODO_mark_first_instance (1 << 19) + +/* Rebuild aliasing info. */ +#define TODO_rebuild_alias (1 << 20) + +/* Rebuild the addressable-vars bitmap and do register promotion. */ +#define TODO_update_address_taken (1 << 21) + +/* Rebuild the callgraph edges. */ +#define TODO_rebuild_cgraph_edges (1 << 22) + +/* Release function body and stop pass manager. */ +#define TODO_discard_function (1 << 23) + +/* Internally used in execute_function_todo(). */ +#define TODO_update_ssa_any \ + (TODO_update_ssa \ + | TODO_update_ssa_no_phi \ + | TODO_update_ssa_full_phi \ + | TODO_update_ssa_only_virtuals) + +#define TODO_verify_all TODO_verify_il + + +/* Register pass info. */ + +enum pass_positioning_ops +{ + PASS_POS_INSERT_AFTER, /* Insert after the reference pass. */ + PASS_POS_INSERT_BEFORE, /* Insert before the reference pass. */ + PASS_POS_REPLACE /* Replace the reference pass. */ +}; + +struct register_pass_info +{ + opt_pass *pass; /* New pass to register. */ + const char *reference_pass_name; /* Name of the reference pass for hooking + up the new pass. */ + int ref_pass_instance_number; /* Insert the pass at the specified + instance number of the reference pass. + Do it for every instance if it is 0. */ + enum pass_positioning_ops pos_op; /* how to insert the new pass. */ +}; + +/* Registers a new pass. Either fill out the register_pass_info or specify + the individual parameters. The pass object is expected to have been + allocated using operator new and the pass manager takes the ownership of + the pass object. */ +extern void register_pass (register_pass_info *); +extern void register_pass (opt_pass* pass, pass_positioning_ops pos, + const char* ref_pass_name, int ref_pass_inst_number); + +extern simple_ipa_opt_pass *make_pass_ipa_chkp_versioning (gcc::context *ctxt); +extern simple_ipa_opt_pass *make_pass_ipa_chkp_early_produce_thunks (gcc::context *ctxt); +extern simple_ipa_opt_pass *make_pass_ipa_chkp_produce_thunks (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_chkp (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_chkp_opt (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_asan (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_asan_O0 (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_tsan (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_tsan_O0 (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_sancov (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_sancov_O0 (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_lower_cf (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_refactor_eh (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_lower_eh (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_lower_eh_dispatch (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_lower_resx (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_build_cfg (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_early_tree_profile (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_cleanup_eh (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_sra (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_sra_early (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_early_ipa_sra (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_tail_recursion (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_tail_calls (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_fix_loops (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_tree_loop (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_tree_no_loop (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_tree_loop_init (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_lim (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_tree_unswitch (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_loop_split (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_predcom (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_iv_canon (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_scev_cprop (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_empty_loop (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_record_bounds (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_graphite (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_graphite_transforms (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_if_conversion (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_loop_distribution (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_vectorize (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_simduid_cleanup (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_slp_vectorize (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_complete_unroll (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_complete_unrolli (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_parallelize_loops (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_loop_prefetch (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_iv_optimize (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_tree_loop_done (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_ch (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_ch_vect (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_ccp (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_split_paths (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_phi_only_cprop (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_build_ssa (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_build_alias (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_build_ealias (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_dominator (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_dce (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_cd_dce (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_call_cdce (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_merge_phi (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_thread_jumps (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_early_thread_jumps (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_split_crit_edges (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_laddress (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_pre (gcc::context *ctxt); +extern unsigned int tail_merge_optimize (unsigned int); +extern gimple_opt_pass *make_pass_profile (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_strip_predict_hints (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_lower_complex_O0 (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_lower_complex (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_lower_vector (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_lower_vector_ssa (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_lower_omp (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_diagnose_omp_blocks (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_expand_omp (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_expand_omp_ssa (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_omp_target_link (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_oacc_device_lower (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_omp_device_lower (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_object_sizes (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_strlen (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_fold_builtins (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_post_ipa_warn (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_stdarg (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_early_warn_uninitialized (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_late_warn_uninitialized (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_cse_reciprocals (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_cse_sincos (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_optimize_bswap (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_store_merging (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_optimize_widening_mul (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_warn_function_return (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_warn_function_noreturn (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_cselim (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_phiopt (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_forwprop (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_phiprop (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_tree_ifcombine (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_dse (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_nrv (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_rename_ssa_copies (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_sink_code (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_fre (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_check_data_deps (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_copy_prop (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_isolate_erroneous_paths (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_early_vrp (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_vrp (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_uncprop (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_return_slot (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_reassoc (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_rebuild_cgraph_edges (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_remove_cgraph_callee_edges (gcc::context + *ctxt); +extern gimple_opt_pass *make_pass_build_cgraph_edges (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_local_pure_const (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_nothrow (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_tracer (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_warn_unused_result (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_diagnose_tm_blocks (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_lower_tm (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_tm_init (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_tm_mark (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_tm_memopt (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_tm_edges (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_split_functions (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_feedback_split_functions (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_strength_reduction (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_vtable_verify (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_ubsan (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_sanopt (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_oacc_kernels (gcc::context *ctxt); +extern simple_ipa_opt_pass *make_pass_ipa_oacc (gcc::context *ctxt); +extern simple_ipa_opt_pass *make_pass_ipa_oacc_kernels (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_gen_hsail (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_warn_nonnull_compare (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_sprintf_length (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_walloca (gcc::context *ctxt); + +/* IPA Passes */ +extern simple_ipa_opt_pass *make_pass_ipa_lower_emutls (gcc::context *ctxt); +extern simple_ipa_opt_pass + *make_pass_ipa_function_and_variable_visibility (gcc::context *ctxt); +extern simple_ipa_opt_pass *make_pass_ipa_tree_profile (gcc::context *ctxt); +extern simple_ipa_opt_pass *make_pass_ipa_auto_profile (gcc::context *ctxt); + +extern simple_ipa_opt_pass *make_pass_build_ssa_passes (gcc::context *ctxt); +extern simple_ipa_opt_pass *make_pass_chkp_instrumentation_passes (gcc::context *ctxt); +extern simple_ipa_opt_pass *make_pass_local_optimization_passes (gcc::context *ctxt); + +extern ipa_opt_pass_d *make_pass_ipa_whole_program_visibility (gcc::context + *ctxt); +extern simple_ipa_opt_pass *make_pass_ipa_increase_alignment (gcc::context + *ctxt); +extern ipa_opt_pass_d *make_pass_ipa_inline (gcc::context *ctxt); +extern simple_ipa_opt_pass *make_pass_ipa_free_lang_data (gcc::context *ctxt); +extern simple_ipa_opt_pass *make_pass_ipa_free_inline_summary (gcc::context + *ctxt); +extern ipa_opt_pass_d *make_pass_ipa_cp (gcc::context *ctxt); +extern ipa_opt_pass_d *make_pass_ipa_icf (gcc::context *ctxt); +extern ipa_opt_pass_d *make_pass_ipa_devirt (gcc::context *ctxt); +extern ipa_opt_pass_d *make_pass_ipa_reference (gcc::context *ctxt); +extern ipa_opt_pass_d *make_pass_ipa_hsa (gcc::context *ctxt); +extern ipa_opt_pass_d *make_pass_ipa_pure_const (gcc::context *ctxt); +extern simple_ipa_opt_pass *make_pass_ipa_pta (gcc::context *ctxt); +extern simple_ipa_opt_pass *make_pass_ipa_tm (gcc::context *ctxt); +extern simple_ipa_opt_pass *make_pass_target_clone (gcc::context *ctxt); +extern simple_ipa_opt_pass *make_pass_dispatcher_calls (gcc::context *ctxt); +extern simple_ipa_opt_pass *make_pass_omp_simd_clone (gcc::context *ctxt); +extern ipa_opt_pass_d *make_pass_ipa_profile (gcc::context *ctxt); +extern ipa_opt_pass_d *make_pass_ipa_cdtor_merge (gcc::context *ctxt); +extern ipa_opt_pass_d *make_pass_ipa_single_use (gcc::context *ctxt); +extern ipa_opt_pass_d *make_pass_ipa_comdats (gcc::context *ctxt); +extern simple_ipa_opt_pass *make_pass_materialize_all_clones (gcc::context * + ctxt); + +extern gimple_opt_pass *make_pass_cleanup_cfg_post_optimizing (gcc::context + *ctxt); +extern gimple_opt_pass *make_pass_fixup_cfg (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_backprop (gcc::context *ctxt); + +extern rtl_opt_pass *make_pass_expand (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_instantiate_virtual_regs (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_rtl_fwprop (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_rtl_fwprop_addr (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_jump (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_jump2 (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_lower_subreg (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_cse (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_fast_rtl_dce (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_ud_rtl_dce (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_rtl_dce (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_rtl_dse1 (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_rtl_dse2 (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_rtl_dse3 (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_rtl_cprop (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_rtl_pre (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_rtl_hoist (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_rtl_store_motion (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_cse_after_global_opts (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_rtl_ifcvt (gcc::context *ctxt); + +extern rtl_opt_pass *make_pass_into_cfg_layout_mode (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_outof_cfg_layout_mode (gcc::context *ctxt); + +extern rtl_opt_pass *make_pass_loop2 (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_rtl_loop_init (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_rtl_move_loop_invariants (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_rtl_unroll_loops (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_rtl_doloop (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_rtl_loop_done (gcc::context *ctxt); + +extern rtl_opt_pass *make_pass_web (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_cse2 (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_df_initialize_opt (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_df_initialize_no_opt (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_reginfo_init (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_inc_dec (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_stack_ptr_mod (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_initialize_regs (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_combine (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_if_after_combine (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_ree (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_partition_blocks (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_match_asm_constraints (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_split_all_insns (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_fast_rtl_byte_dce (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_lower_subreg2 (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_mode_switching (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_sms (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_sched (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_live_range_shrinkage (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_ira (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_reload (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_clean_state (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_branch_prob (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_value_profile_transformations (gcc::context + *ctxt); +extern rtl_opt_pass *make_pass_postreload_cse (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_gcse2 (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_split_after_reload (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_branch_target_load_optimize1 (gcc::context + *ctxt); +extern rtl_opt_pass *make_pass_thread_prologue_and_epilogue (gcc::context + *ctxt); +extern rtl_opt_pass *make_pass_stack_adjustments (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_sched_fusion (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_peephole2 (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_if_after_reload (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_regrename (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_cprop_hardreg (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_reorder_blocks (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_branch_target_load_optimize2 (gcc::context + *ctxt); +extern rtl_opt_pass *make_pass_leaf_regs (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_split_before_sched2 (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_compare_elim_after_reload (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_sched2 (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_stack_regs (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_stack_regs_run (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_df_finish (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_compute_alignments (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_duplicate_computed_gotos (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_variable_tracking (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_free_cfg (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_machine_reorg (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_cleanup_barriers (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_delay_slots (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_split_for_shorten_branches (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_split_before_regstack (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_convert_to_eh_region_ranges (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_shorten_branches (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_set_nothrow_function_flags (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_dwarf2_frame (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_final (gcc::context *ctxt); +extern rtl_opt_pass *make_pass_rtl_seqabstr (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_release_ssa_names (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_early_inline (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_inline_parameters (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_update_address_taken (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_convert_switch (gcc::context *ctxt); +extern gimple_opt_pass *make_pass_lower_vaarg (gcc::context *ctxt); + +/* Current optimization pass. */ +extern opt_pass *current_pass; + +extern bool execute_one_pass (opt_pass *); +extern void execute_pass_list (function *, opt_pass *); +extern void execute_ipa_pass_list (opt_pass *); +extern void execute_ipa_summary_passes (ipa_opt_pass_d *); +extern void execute_all_ipa_transforms (void); +extern void execute_all_ipa_stmt_fixups (struct cgraph_node *, gimple **); +extern bool pass_init_dump_file (opt_pass *); +extern void pass_fini_dump_file (opt_pass *); + +extern void print_current_pass (FILE *); +extern void debug_pass (void); +extern void ipa_write_summaries (void); +extern void ipa_write_optimization_summaries (struct lto_symtab_encoder_d *); +extern void ipa_read_summaries (void); +extern void ipa_read_optimization_summaries (void); +extern void register_one_dump_file (opt_pass *); +extern bool function_called_by_processed_nodes_p (void); + +/* Declare for plugins. */ +extern void do_per_function_toporder (void (*) (function *, void *), void *); + +extern void disable_pass (const char *); +extern void enable_pass (const char *); +extern void dump_passes (void); + +#endif /* GCC_TREE_PASS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-phinodes.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-phinodes.h new file mode 100644 index 0000000..7c46750 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-phinodes.h @@ -0,0 +1,68 @@ +/* Header file for PHI node routines + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_PHINODES_H +#define GCC_TREE_PHINODES_H + +extern void phinodes_print_statistics (void); +extern void reserve_phi_args_for_new_edge (basic_block); +extern void add_phi_node_to_bb (gphi *phi, basic_block bb); +extern gphi *create_phi_node (tree, basic_block); +extern void add_phi_arg (gphi *, tree, edge, source_location); +extern void remove_phi_args (edge); +extern void remove_phi_node (gimple_stmt_iterator *, bool); +extern void remove_phi_nodes (basic_block); +extern tree degenerate_phi_result (gphi *); +extern void set_phi_nodes (basic_block, gimple_seq); + +static inline use_operand_p +gimple_phi_arg_imm_use_ptr (gimple *gs, int i) +{ + return &gimple_phi_arg (gs, i)->imm_use; +} + +/* Return the phi argument which contains the specified use. */ + +static inline int +phi_arg_index_from_use (use_operand_p use) +{ + struct phi_arg_d *element, *root; + size_t index; + gimple *phi; + + /* Since the use is the first thing in a PHI argument element, we can + calculate its index based on casting it to an argument, and performing + pointer arithmetic. */ + + phi = USE_STMT (use); + + element = (struct phi_arg_d *)use; + root = gimple_phi_arg (phi, 0); + index = element - root; + + /* Make sure the calculation doesn't have any leftover bytes. If it does, + then imm_use is likely not the first element in phi_arg_d. */ + gcc_checking_assert ((((char *)element - (char *)root) + % sizeof (struct phi_arg_d)) == 0 + && index < gimple_phi_capacity (phi)); + + return index; +} + +#endif /* GCC_TREE_PHINODES_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-pretty-print.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-pretty-print.h new file mode 100644 index 0000000..40b6f75 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-pretty-print.h @@ -0,0 +1,54 @@ +/* Various declarations for language-independent pretty-print + subroutines that are only for use in the compilers proper and not + the driver or other programs. + Copyright (C) 2002-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_PRETTY_PRINT_H +#define GCC_TREE_PRETTY_PRINT_H + +#include "pretty-print.h" + +#define pp_unsupported_tree(PP, T) \ + pp_verbatim (PP, "#%qs not supported by %s#", \ + get_tree_code_name (TREE_CODE (T)), __FUNCTION__) + +#define pp_ti_abstract_origin(TI) ((tree *) (TI)->x_data) + + +extern void debug_generic_expr (tree); +extern void debug_generic_stmt (tree); +extern void debug_tree_chain (tree); +extern void print_generic_decl (FILE *, tree, int); +extern void print_generic_stmt (FILE *, tree, int); +extern void print_generic_stmt_indented (FILE *, tree, int, int); +extern void print_generic_expr (FILE *, tree, int); +extern void dump_omp_clauses (pretty_printer *, tree, int, int); +extern int dump_generic_node (pretty_printer *, tree, int, int, bool); +extern void print_declaration (pretty_printer *, tree, int, int); +extern int op_code_prio (enum tree_code); +extern int op_prio (const_tree); +extern const char *op_symbol_code (enum tree_code); +extern void print_call_name (pretty_printer *, tree, int); +extern void percent_K_format (text_info *); +extern void pp_tree_identifier (pretty_printer *, tree); +extern void dump_function_header (FILE *, tree, int); +extern void pp_double_int (pretty_printer *pp, double_int d, bool uns); +extern void dump_location (pretty_printer *buffer, location_t loc); + +#endif /* ! GCC_TREE_PRETTY_PRINT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-scalar-evolution.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-scalar-evolution.h new file mode 100644 index 0000000..c3980d0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-scalar-evolution.h @@ -0,0 +1,74 @@ +/* Scalar evolution detector. + Copyright (C) 2003-2017 Free Software Foundation, Inc. + Contributed by Sebastian Pop + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_SCALAR_EVOLUTION_H +#define GCC_TREE_SCALAR_EVOLUTION_H + +extern tree number_of_latch_executions (struct loop *); +extern gcond *get_loop_exit_condition (const struct loop *); + +extern void scev_initialize (void); +extern bool scev_initialized_p (void); +extern void scev_reset (void); +extern void scev_reset_htab (void); +extern void scev_finalize (void); +extern tree analyze_scalar_evolution (struct loop *, tree); +extern tree instantiate_scev (basic_block, struct loop *, tree); +extern tree resolve_mixers (struct loop *, tree, bool *); +extern void gather_stats_on_scev_database (void); +extern void final_value_replacement_loop (struct loop *); +extern unsigned int scev_const_prop (void); +extern bool expression_expensive_p (tree); +extern bool simple_iv_with_niters (struct loop *, struct loop *, tree, + struct affine_iv *, tree *, bool); +extern bool simple_iv (struct loop *, struct loop *, tree, struct affine_iv *, + bool); +extern bool iv_can_overflow_p (struct loop *, tree, tree, tree); +extern tree compute_overall_effect_of_inner_loop (struct loop *, tree); + +/* Returns the basic block preceding LOOP, or the CFG entry block when + the loop is function's body. */ + +static inline basic_block +block_before_loop (loop_p loop) +{ + edge preheader = loop_preheader_edge (loop); + return (preheader ? preheader->src : ENTRY_BLOCK_PTR_FOR_FN (cfun)); +} + +/* Analyze all the parameters of the chrec that were left under a + symbolic form. LOOP is the loop in which symbolic names have to + be analyzed and instantiated. */ + +static inline tree +instantiate_parameters (struct loop *loop, tree chrec) +{ + return instantiate_scev (block_before_loop (loop), loop, chrec); +} + +/* Returns the loop of the polynomial chrec CHREC. */ + +static inline struct loop * +get_chrec_loop (const_tree chrec) +{ + return get_loop (cfun, CHREC_VARIABLE (chrec)); +} + +#endif /* GCC_TREE_SCALAR_EVOLUTION_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-address.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-address.h new file mode 100644 index 0000000..311348e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-address.h @@ -0,0 +1,32 @@ +/* Header file for memory address lowering and mode selection. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_SSA_ADDRESS_H +#define GCC_TREE_SSA_ADDRESS_H + +extern rtx addr_for_mem_ref (struct mem_address *, addr_space_t, bool); +extern rtx addr_for_mem_ref (tree exp, addr_space_t as, bool really_expand); +extern void get_address_description (tree, struct mem_address *); +extern tree tree_mem_ref_addr (tree, tree); +tree create_mem_ref (gimple_stmt_iterator *, tree, + struct aff_tree *, tree, tree, tree, bool); +extern void copy_ref_info (tree, tree); +tree maybe_fold_tmr (tree); + +#endif /* GCC_TREE_SSA_ADDRESS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-alias.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-alias.h new file mode 100644 index 0000000..8c89c69 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-alias.h @@ -0,0 +1,188 @@ +/* Tree based alias analysis and alias oracle. + Copyright (C) 2008-2017 Free Software Foundation, Inc. + Contributed by Richard Guenther + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + GCC is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#ifndef TREE_SSA_ALIAS_H +#define TREE_SSA_ALIAS_H + +/* The points-to solution. + + The points-to solution is a union of pt_vars and the abstract + sets specified by the flags. */ +struct GTY(()) pt_solution +{ + /* Nonzero if points-to analysis couldn't determine where this pointer + is pointing to. */ + unsigned int anything : 1; + + /* Nonzero if the points-to set includes any global memory. Note that + even if this is zero pt_vars can still include global variables. */ + unsigned int nonlocal : 1; + + /* Nonzero if the points-to set includes the local escaped solution by + reference. */ + unsigned int escaped : 1; + + /* Nonzero if the points-to set includes the IPA escaped solution by + reference. */ + unsigned int ipa_escaped : 1; + + /* Nonzero if the points-to set includes 'nothing', the points-to set + includes memory at address NULL. */ + unsigned int null : 1; + + /* Nonzero if the vars bitmap includes a variable included in 'nonlocal'. */ + unsigned int vars_contains_nonlocal : 1; + /* Nonzero if the vars bitmap includes a variable included in 'escaped'. */ + unsigned int vars_contains_escaped : 1; + /* Nonzero if the vars bitmap includes a anonymous heap variable that + escaped the function and thus became global. */ + unsigned int vars_contains_escaped_heap : 1; + /* Nonzero if the vars bitmap includes a anonymous variable used to + represent storage pointed to by a restrict qualified pointer. */ + unsigned int vars_contains_restrict : 1; + /* Nonzero if the vars bitmap includes an interposable variable. */ + unsigned int vars_contains_interposable : 1; + + /* Set of variables that this pointer may point to. */ + bitmap vars; +}; + + +/* Simplified and cached information about a memory reference tree. + Used by the alias-oracle internally and externally in alternate + interfaces. */ +struct ao_ref +{ + /* The original full memory reference tree or NULL_TREE if that is + not available. */ + tree ref; + + /* The following fields are the decomposed reference as returned + by get_ref_base_and_extent. */ + /* The base object of the memory reference or NULL_TREE if all of + the following fields are not yet computed. */ + tree base; + /* The offset relative to the base. */ + HOST_WIDE_INT offset; + /* The size of the access. */ + HOST_WIDE_INT size; + /* The maximum possible extent of the access or -1 if unconstrained. */ + HOST_WIDE_INT max_size; + + /* The alias set of the access or -1 if not yet computed. */ + alias_set_type ref_alias_set; + + /* The alias set of the base object or -1 if not yet computed. */ + alias_set_type base_alias_set; + + /* Whether the memory is considered a volatile access. */ + bool volatile_p; +}; + + +/* In tree-ssa-alias.c */ +extern void ao_ref_init (ao_ref *, tree); +extern void ao_ref_init_from_ptr_and_size (ao_ref *, tree, tree); +extern tree ao_ref_base (ao_ref *); +extern alias_set_type ao_ref_alias_set (ao_ref *); +extern alias_set_type ao_ref_base_alias_set (ao_ref *); +extern bool ptr_deref_may_alias_global_p (tree); +extern bool ptr_derefs_may_alias_p (tree, tree); +extern bool ptrs_compare_unequal (tree, tree); +extern bool ref_may_alias_global_p (tree); +extern bool ref_may_alias_global_p (ao_ref *); +extern bool refs_may_alias_p (tree, tree); +extern bool refs_may_alias_p_1 (ao_ref *, ao_ref *, bool); +extern bool refs_anti_dependent_p (tree, tree); +extern bool refs_output_dependent_p (tree, tree); +extern bool ref_maybe_used_by_stmt_p (gimple *, tree); +extern bool ref_maybe_used_by_stmt_p (gimple *, ao_ref *); +extern bool stmt_may_clobber_global_p (gimple *); +extern bool stmt_may_clobber_ref_p (gimple *, tree); +extern bool stmt_may_clobber_ref_p_1 (gimple *, ao_ref *); +extern bool call_may_clobber_ref_p (gcall *, tree); +extern bool call_may_clobber_ref_p_1 (gcall *, ao_ref *); +extern bool stmt_kills_ref_p (gimple *, tree); +extern bool stmt_kills_ref_p (gimple *, ao_ref *); +extern tree get_continuation_for_phi (gimple *, ao_ref *, + unsigned int *, bitmap *, bool, + void *(*)(ao_ref *, tree, void *, bool *), + void *); +extern void *walk_non_aliased_vuses (ao_ref *, tree, + void *(*)(ao_ref *, tree, + unsigned int, void *), + void *(*)(ao_ref *, tree, void *, bool *), + tree (*)(tree), + void *); +extern int walk_aliased_vdefs (ao_ref *, tree, + bool (*)(ao_ref *, tree, void *), + void *, bitmap *, + bool *function_entry_reached = NULL, + unsigned int limit = 0); +extern void dump_alias_info (FILE *); +extern void debug_alias_info (void); +extern void dump_points_to_solution (FILE *, struct pt_solution *); +extern void debug (pt_solution &ref); +extern void debug (pt_solution *ptr); +extern void dump_points_to_info_for (FILE *, tree); +extern void debug_points_to_info_for (tree); +extern void dump_alias_stats (FILE *); + + +/* In tree-ssa-structalias.c */ +extern unsigned int compute_may_aliases (void); +extern bool pt_solution_empty_p (struct pt_solution *); +extern bool pt_solution_singleton_or_null_p (struct pt_solution *, unsigned *); +extern bool pt_solution_includes_global (struct pt_solution *); +extern bool pt_solution_includes (struct pt_solution *, const_tree); +extern bool pt_solutions_intersect (struct pt_solution *, struct pt_solution *); +extern void pt_solution_reset (struct pt_solution *); +extern void pt_solution_set (struct pt_solution *, bitmap, bool); +extern void pt_solution_set_var (struct pt_solution *, tree); + +extern void dump_pta_stats (FILE *); + +extern GTY(()) struct pt_solution ipa_escaped_pt; + +/* Return true, if the two ranges [POS1, SIZE1] and [POS2, SIZE2] + overlap. SIZE1 and/or SIZE2 can be (unsigned)-1 in which case the + range is open-ended. Otherwise return false. */ + +static inline bool +ranges_overlap_p (HOST_WIDE_INT pos1, + unsigned HOST_WIDE_INT size1, + HOST_WIDE_INT pos2, + unsigned HOST_WIDE_INT size2) +{ + if (pos1 >= pos2 + && (size2 == (unsigned HOST_WIDE_INT)-1 + || pos1 < (pos2 + (HOST_WIDE_INT) size2))) + return true; + if (pos2 >= pos1 + && (size1 == (unsigned HOST_WIDE_INT)-1 + || pos2 < (pos1 + (HOST_WIDE_INT) size1))) + return true; + + return false; +} + + + +#endif /* TREE_SSA_ALIAS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-ccp.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-ccp.h new file mode 100644 index 0000000..836ddd0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-ccp.h @@ -0,0 +1,29 @@ +/* Copyright (C) 2016-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3, or (at your option) any +later version. + +GCC is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef TREE_SSA_CCP_H +#define TREE_SSA_CCP_H + +void bit_value_binop (enum tree_code, signop, int, widest_int *, widest_int *, + signop, int, const widest_int &, const widest_int &, + signop, int, const widest_int &, const widest_int &); + +void bit_value_unop (enum tree_code, signop, int, widest_int *, widest_int *, + signop, int, const widest_int &, const widest_int &); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-coalesce.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-coalesce.h new file mode 100644 index 0000000..9eebddd --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-coalesce.h @@ -0,0 +1,27 @@ +/* Header file for tree-ssa-coalesce.c exports. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_SSA_COALESCE_H +#define GCC_TREE_SSA_COALESCE_H + +extern var_map coalesce_ssa_name (void); +extern bool gimple_can_coalesce_p (tree, tree); +extern bitmap get_parm_default_def_partitions (var_map); + +#endif /* GCC_TREE_SSA_COALESCE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-dom.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-dom.h new file mode 100644 index 0000000..ad1b7ef --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-dom.h @@ -0,0 +1,28 @@ +/* Header file for SSA dominator optimizations. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_SSA_DOM_H +#define GCC_TREE_SSA_DOM_H + +extern bool simple_iv_increment_p (gimple *); +extern void record_temporary_equivalences (edge, + class const_and_copies *, + class avail_exprs_stack *); + +#endif /* GCC_TREE_SSA_DOM_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-live.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-live.h new file mode 100644 index 0000000..6685bef --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-live.h @@ -0,0 +1,313 @@ +/* Routines for liveness in SSA trees. + Copyright (C) 2003-2017 Free Software Foundation, Inc. + Contributed by Andrew MacLeod + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + + +#ifndef _TREE_SSA_LIVE_H +#define _TREE_SSA_LIVE_H 1 + +#include "partition.h" + +/* Used to create the variable mapping when we go out of SSA form. + + Mapping from an ssa_name to a partition number is maintained, as well as + partition number back to ssa_name. + + This data structure also supports "views", which work on a subset of all + partitions. This allows the coalescer to decide what partitions are + interesting to it, and only work with those partitions. Whenever the view + is changed, the partition numbers change, but none of the partition groupings + change. (ie, it is truly a view since it doesn't change anything) + + The final component of the data structure is the basevar map. This provides + a list of all the different base variables which occur in a partition view, + and a unique index for each one. Routines are provided to quickly produce + the base variable of a partition. + + Note that members of a partition MUST all have the same base variable. */ + +typedef struct _var_map +{ + /* The partition manager of all variables. */ + partition var_partition; + + /* Vector for managing partitions views. */ + int *partition_to_view; + int *view_to_partition; + + /* Current number of partitions in var_map based on the current view. */ + unsigned int num_partitions; + + /* Original full partition size. */ + unsigned int partition_size; + + /* Number of base variables in the base var list. */ + int num_basevars; + + /* Map of partitions numbers to base variable table indexes. */ + int *partition_to_base_index; +} *var_map; + + +/* Value used to represent no partition number. */ +#define NO_PARTITION -1 + +extern var_map init_var_map (int); +extern void delete_var_map (var_map); +extern int var_union (var_map, tree, tree); +extern void partition_view_normal (var_map); +extern void partition_view_bitmap (var_map, bitmap); +extern void dump_scope_blocks (FILE *, int); +extern void debug_scope_block (tree, int); +extern void debug_scope_blocks (int); +extern void remove_unused_locals (void); +extern void dump_var_map (FILE *, var_map); +extern void debug (_var_map &ref); +extern void debug (_var_map *ptr); + + +/* Return number of partitions in MAP. */ + +static inline unsigned +num_var_partitions (var_map map) +{ + return map->num_partitions; +} + + +/* Given partition index I from MAP, return the variable which represents that + partition. */ + +static inline tree +partition_to_var (var_map map, int i) +{ + tree name; + if (map->view_to_partition) + i = map->view_to_partition[i]; + i = partition_find (map->var_partition, i); + name = ssa_name (i); + return name; +} + + +/* Given ssa_name VERSION, if it has a partition in MAP, return the var it + is associated with. Otherwise return NULL. */ + +static inline tree +version_to_var (var_map map, int version) +{ + int part; + part = partition_find (map->var_partition, version); + if (map->partition_to_view) + part = map->partition_to_view[part]; + if (part == NO_PARTITION) + return NULL_TREE; + + return partition_to_var (map, part); +} + + +/* Given VAR, return the partition number in MAP which contains it. + NO_PARTITION is returned if it's not in any partition. */ + +static inline int +var_to_partition (var_map map, tree var) +{ + int part; + + part = partition_find (map->var_partition, SSA_NAME_VERSION (var)); + if (map->partition_to_view) + part = map->partition_to_view[part]; + return part; +} + + +/* Given VAR, return the variable which represents the entire partition + it is a member of in MAP. NULL is returned if it is not in a partition. */ + +static inline tree +var_to_partition_to_var (var_map map, tree var) +{ + int part; + + part = var_to_partition (map, var); + if (part == NO_PARTITION) + return NULL_TREE; + return partition_to_var (map, part); +} + + +/* Return the index into the basevar table for PARTITION's base in MAP. */ + +static inline int +basevar_index (var_map map, int partition) +{ + gcc_checking_assert (partition >= 0 + && partition <= (int) num_var_partitions (map)); + return map->partition_to_base_index[partition]; +} + + +/* Return the number of different base variables in MAP. */ + +static inline int +num_basevars (var_map map) +{ + return map->num_basevars; +} + + +/* ---------------- live on entry/exit info ------------------------------ + + This structure is used to represent live range information on SSA based + trees. A partition map must be provided, and based on the active partitions, + live-on-entry information and live-on-exit information can be calculated. + As well, partitions are marked as to whether they are global (live + outside the basic block they are defined in). + + The live-on-entry information is per block. It provide a bitmap for + each block which has a bit set for each partition that is live on entry to + that block. + + The live-on-exit information is per block. It provides a bitmap for each + block indicating which partitions are live on exit from the block. + + For the purposes of this implementation, we treat the elements of a PHI + as follows: + + Uses in a PHI are considered LIVE-ON-EXIT to the block from which they + originate. They are *NOT* considered live on entry to the block + containing the PHI node. + + The Def of a PHI node is *not* considered live on entry to the block. + It is considered to be "define early" in the block. Picture it as each + block having a stmt (or block-preheader) before the first real stmt in + the block which defines all the variables that are defined by PHIs. + + ----------------------------------------------------------------------- */ + + +typedef struct tree_live_info_d +{ + /* Var map this relates to. */ + var_map map; + + /* Bitmap indicating which partitions are global. */ + bitmap global; + + /* Bitmaps of live on entry blocks for partition elements. */ + bitmap_head *livein; + + /* Bitmaps of what variables are live on exit for a basic blocks. */ + bitmap_head *liveout; + + /* Number of basic blocks when live on exit calculated. */ + int num_blocks; + + /* Vector used when creating live ranges as a visited stack. */ + int *work_stack; + + /* Top of workstack. */ + int *stack_top; + + /* Obstacks to allocate the bitmaps on. */ + bitmap_obstack livein_obstack; + bitmap_obstack liveout_obstack; +} *tree_live_info_p; + + +#define LIVEDUMP_ENTRY 0x01 +#define LIVEDUMP_EXIT 0x02 +#define LIVEDUMP_ALL (LIVEDUMP_ENTRY | LIVEDUMP_EXIT) +extern void delete_tree_live_info (tree_live_info_p); +extern tree_live_info_p calculate_live_ranges (var_map, bool); +extern void debug (tree_live_info_d &ref); +extern void debug (tree_live_info_d *ptr); +extern void dump_live_info (FILE *, tree_live_info_p, int); + + +/* Return TRUE if P is marked as a global in LIVE. */ + +static inline int +partition_is_global (tree_live_info_p live, int p) +{ + gcc_checking_assert (live->global); + return bitmap_bit_p (live->global, p); +} + + +/* Return the bitmap from LIVE representing the live on entry blocks for + partition P. */ + +static inline bitmap +live_on_entry (tree_live_info_p live, basic_block bb) +{ + gcc_checking_assert (live->livein + && bb != ENTRY_BLOCK_PTR_FOR_FN (cfun) + && bb != EXIT_BLOCK_PTR_FOR_FN (cfun)); + + return &live->livein[bb->index]; +} + + +/* Return the bitmap from LIVE representing the live on exit partitions from + block BB. */ + +static inline bitmap +live_on_exit (tree_live_info_p live, basic_block bb) +{ + gcc_checking_assert (live->liveout + && bb != ENTRY_BLOCK_PTR_FOR_FN (cfun) + && bb != EXIT_BLOCK_PTR_FOR_FN (cfun)); + + return &live->liveout[bb->index]; +} + + +/* Return the partition map which the information in LIVE utilizes. */ + +static inline var_map +live_var_map (tree_live_info_p live) +{ + return live->map; +} + + +/* Merge the live on entry information in LIVE for partitions P1 and P2. Place + the result into P1. Clear P2. */ + +static inline void +live_merge_and_clear (tree_live_info_p live, int p1, int p2) +{ + gcc_checking_assert (&live->livein[p1] && &live->livein[p2]); + bitmap_ior_into (&live->livein[p1], &live->livein[p2]); + bitmap_clear (&live->livein[p2]); +} + + +/* Mark partition P as live on entry to basic block BB in LIVE. */ + +static inline void +make_live_on_entry (tree_live_info_p live, basic_block bb , int p) +{ + bitmap_set_bit (&live->livein[bb->index], p); + bitmap_set_bit (live->global, p); +} + +#endif /* _TREE_SSA_LIVE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-loop-ivopts.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-loop-ivopts.h new file mode 100644 index 0000000..004a2c9 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-loop-ivopts.h @@ -0,0 +1,36 @@ +/* Header file for Induction variable optimizations. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_SSA_LOOP_IVOPTS_H +#define GCC_TREE_SSA_LOOP_IVOPTS_H + +extern edge single_dom_exit (struct loop *); +extern void dump_iv (FILE *, struct iv *); +extern void dump_use (FILE *, struct iv_use *); +extern void dump_uses (FILE *, struct ivopts_data *); +extern void dump_cand (FILE *, struct iv_cand *); +extern bool contains_abnormal_ssa_name_p (tree); +extern struct loop *outermost_invariant_loop_for_expr (struct loop *, tree); +extern bool expr_invariant_in_loop_p (struct loop *, tree); +bool may_be_nonaddressable_p (tree expr); +bool multiplier_allowed_in_address_p (HOST_WIDE_INT, machine_mode, + addr_space_t); +void tree_ssa_iv_optimize (void); + +#endif /* GCC_TREE_SSA_LOOP_IVOPTS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-loop-manip.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-loop-manip.h new file mode 100644 index 0000000..a139050 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-loop-manip.h @@ -0,0 +1,61 @@ +/* Header file for High-level loop manipulation functions. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_SSA_LOOP_MANIP_H +#define GCC_TREE_SSA_LOOP_MANIP_H + +typedef void (*transform_callback)(struct loop *, void *); + +extern void create_iv (tree, tree, tree, struct loop *, gimple_stmt_iterator *, + bool, tree *, tree *); +extern void rewrite_into_loop_closed_ssa_1 (bitmap, unsigned, int, + struct loop *); +extern void rewrite_into_loop_closed_ssa (bitmap, unsigned); +extern void rewrite_virtuals_into_loop_closed_ssa (struct loop *); +extern void verify_loop_closed_ssa (bool); + +static inline void +checking_verify_loop_closed_ssa (bool verify_ssa_p) +{ + if (flag_checking) + verify_loop_closed_ssa (verify_ssa_p); +} + +extern basic_block split_loop_exit_edge (edge); +extern basic_block ip_end_pos (struct loop *); +extern basic_block ip_normal_pos (struct loop *); +extern void standard_iv_increment_position (struct loop *, + gimple_stmt_iterator *, bool *); +extern bool gimple_duplicate_loop_to_header_edge (struct loop *, edge, + unsigned int, sbitmap, + edge, vec *, + int); +extern bool can_unroll_loop_p (struct loop *loop, unsigned factor, + struct tree_niter_desc *niter); +extern gcov_type niter_for_unrolled_loop (struct loop *, unsigned); +extern void tree_transform_and_unroll_loop (struct loop *, unsigned, + edge, struct tree_niter_desc *, + transform_callback, void *); +extern void tree_unroll_loop (struct loop *, unsigned, + edge, struct tree_niter_desc *); +extern tree canonicalize_loop_ivs (struct loop *, tree *, bool); + + + +#endif /* GCC_TREE_SSA_LOOP_MANIP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-loop-niter.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-loop-niter.h new file mode 100644 index 0000000..b009857 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-loop-niter.h @@ -0,0 +1,58 @@ +/* Header file for loop interation estimates. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_SSA_LOOP_NITER_H +#define GCC_TREE_SSA_LOOP_NITER_H + +extern tree expand_simple_operations (tree, tree = NULL); +extern tree simplify_using_initial_conditions (struct loop *, tree); +extern bool loop_only_exit_p (const struct loop *, const_edge); +extern bool number_of_iterations_exit (struct loop *, edge, + struct tree_niter_desc *niter, bool, + bool every_iteration = true); +extern bool number_of_iterations_exit_assumptions (struct loop *, edge, + struct tree_niter_desc *, + gcond **, bool = true); +extern tree find_loop_niter (struct loop *, edge *); +extern bool finite_loop_p (struct loop *); +extern tree loop_niter_by_eval (struct loop *, edge); +extern tree find_loop_niter_by_eval (struct loop *, edge *); +extern bool estimated_loop_iterations (struct loop *, widest_int *); +extern HOST_WIDE_INT estimated_loop_iterations_int (struct loop *); +extern bool max_loop_iterations (struct loop *, widest_int *); +extern HOST_WIDE_INT max_loop_iterations_int (struct loop *); +extern bool likely_max_loop_iterations (struct loop *, widest_int *); +extern HOST_WIDE_INT likely_max_loop_iterations_int (struct loop *); +extern HOST_WIDE_INT max_stmt_executions_int (struct loop *); +extern HOST_WIDE_INT likely_max_stmt_executions_int (struct loop *); +extern HOST_WIDE_INT estimated_stmt_executions_int (struct loop *); +extern bool max_stmt_executions (struct loop *, widest_int *); +extern bool likely_max_stmt_executions (struct loop *, widest_int *); +extern bool estimated_stmt_executions (struct loop *, widest_int *); +extern void estimate_numbers_of_iterations (void); +extern bool stmt_dominates_stmt_p (gimple *, gimple *); +extern bool nowrap_type_p (tree); +extern bool scev_probably_wraps_p (tree, tree, tree, gimple *, + struct loop *, bool); +extern void free_loop_control_ivs (struct loop *); +extern void free_numbers_of_iterations_estimates_loop (struct loop *); +extern void free_numbers_of_iterations_estimates (function *); +extern void substitute_in_loop_info (struct loop *, tree, tree); + +#endif /* GCC_TREE_SSA_LOOP_NITER_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-loop.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-loop.h new file mode 100644 index 0000000..2955710 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-loop.h @@ -0,0 +1,82 @@ +/* Header file for SSA loop optimizations. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_SSA_LOOP_H +#define GCC_TREE_SSA_LOOP_H + + +/* Affine iv. */ + +struct affine_iv +{ + /* Iv = BASE + STEP * i. */ + tree base, step; + + /* True if this iv does not overflow. */ + bool no_overflow; +}; + +/* Description of number of iterations of a loop. All the expressions inside + the structure can be evaluated at the end of the loop's preheader + (and due to ssa form, also anywhere inside the body of the loop). */ + +struct tree_niter_desc +{ + tree assumptions; /* The boolean expression. If this expression evaluates + to false, then the other fields in this structure + should not be used; there is no guarantee that they + will be correct. */ + tree may_be_zero; /* The boolean expression. If it evaluates to true, + the loop will exit in the first iteration (i.e. + its latch will not be executed), even if the niter + field says otherwise. */ + tree niter; /* The expression giving the number of iterations of + a loop (provided that assumptions == true and + may_be_zero == false), more precisely the number + of executions of the latch of the loop. */ + widest_int max; /* The upper bound on the number of iterations of + the loop. */ + + /* The simplified shape of the exit condition. The loop exits if + CONTROL CMP BOUND is false, where CMP is one of NE_EXPR, + LT_EXPR, or GT_EXPR, and step of CONTROL is positive if CMP is + LE_EXPR and negative if CMP is GE_EXPR. This information is used + by loop unrolling. */ + affine_iv control; + tree bound; + enum tree_code cmp; +}; + +extern bool for_each_index (tree *, bool (*) (tree, tree *, void *), void *); +extern char *get_lsm_tmp_name (tree ref, unsigned n, const char *suffix = NULL); +extern unsigned tree_num_loop_insns (struct loop *, struct eni_weights *); + +/* Returns the loop of the statement STMT. */ + +static inline struct loop * +loop_containing_stmt (gimple *stmt) +{ + basic_block bb = gimple_bb (stmt); + if (!bb) + return NULL; + + return bb->loop_father; +} + +#endif /* GCC_TREE_SSA_LOOP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-operands.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-operands.h new file mode 100644 index 0000000..db7d007 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-operands.h @@ -0,0 +1,122 @@ +/* SSA operand management for trees. + Copyright (C) 2003-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_SSA_OPERANDS_H +#define GCC_TREE_SSA_OPERANDS_H + +/* Interface to SSA operands. */ + + +/* This represents a pointer to a DEF operand. */ +typedef tree *def_operand_p; + +/* This represents a pointer to a USE operand. */ +typedef ssa_use_operand_t *use_operand_p; + +/* NULL operand types. */ +#define NULL_USE_OPERAND_P ((use_operand_p)NULL) +#define NULL_DEF_OPERAND_P ((def_operand_p)NULL) + +/* This represents the USE operands of a stmt. */ +struct use_optype_d +{ + struct use_optype_d *next; + struct ssa_use_operand_t use_ptr; +}; +typedef struct use_optype_d *use_optype_p; + +/* This structure represents a variable sized buffer which is allocated by the + operand memory manager. Operands are suballocated out of this block. The + MEM array varies in size. */ + +struct GTY((chain_next("%h.next"))) ssa_operand_memory_d { + struct ssa_operand_memory_d *next; + char mem[1]; +}; + +/* Per-function operand caches. */ +struct GTY(()) ssa_operands { + struct ssa_operand_memory_d *operand_memory; + unsigned operand_memory_index; + /* Current size of the operand memory buffer. */ + unsigned int ssa_operand_mem_size; + + bool ops_active; + + struct use_optype_d * GTY ((skip (""))) free_uses; +}; + +#define USE_FROM_PTR(PTR) get_use_from_ptr (PTR) +#define DEF_FROM_PTR(PTR) get_def_from_ptr (PTR) +#define SET_USE(USE, V) set_ssa_use_from_ptr (USE, V) +#define SET_DEF(DEF, V) ((*(DEF)) = (V)) + +#define USE_STMT(USE) (USE)->loc.stmt + +#define USE_OP_PTR(OP) (&((OP)->use_ptr)) +#define USE_OP(OP) (USE_FROM_PTR (USE_OP_PTR (OP))) + +#define PHI_RESULT_PTR(PHI) gimple_phi_result_ptr (PHI) +#define PHI_RESULT(PHI) DEF_FROM_PTR (PHI_RESULT_PTR (PHI)) +#define SET_PHI_RESULT(PHI, V) SET_DEF (PHI_RESULT_PTR (PHI), (V)) +/* +#define PHI_ARG_DEF(PHI, I) USE_FROM_PTR (PHI_ARG_DEF_PTR ((PHI), (I))) +*/ +#define PHI_ARG_DEF_PTR(PHI, I) gimple_phi_arg_imm_use_ptr ((PHI), (I)) +#define PHI_ARG_DEF(PHI, I) gimple_phi_arg_def ((PHI), (I)) +#define SET_PHI_ARG_DEF(PHI, I, V) \ + SET_USE (PHI_ARG_DEF_PTR ((PHI), (I)), (V)) +#define PHI_ARG_DEF_FROM_EDGE(PHI, E) \ + PHI_ARG_DEF ((PHI), (E)->dest_idx) +#define PHI_ARG_DEF_PTR_FROM_EDGE(PHI, E) \ + PHI_ARG_DEF_PTR ((PHI), (E)->dest_idx) +#define PHI_ARG_INDEX_FROM_USE(USE) phi_arg_index_from_use (USE) + + +extern bool ssa_operands_active (struct function *); +extern void init_ssa_operands (struct function *fn); +extern void fini_ssa_operands (struct function *); +extern bool verify_ssa_operands (struct function *, gimple *stmt); +extern void free_stmt_operands (struct function *, gimple *); +extern void update_stmt_operands (struct function *, gimple *); +extern void swap_ssa_operands (gimple *, tree *, tree *); +extern bool verify_imm_links (FILE *f, tree var); + +extern void dump_immediate_uses_for (FILE *file, tree var); +extern void dump_immediate_uses (FILE *file); +extern void debug_immediate_uses (void); +extern void debug_immediate_uses_for (tree var); + +extern void unlink_stmt_vdef (gimple *); + +/* Return the tree pointed-to by USE. */ +static inline tree +get_use_from_ptr (use_operand_p use) +{ + return *(use->use); +} + +/* Return the tree pointed-to by DEF. */ +static inline tree +get_def_from_ptr (def_operand_p def) +{ + return *def; +} + +#endif /* GCC_TREE_SSA_OPERANDS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-propagate.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-propagate.h new file mode 100644 index 0000000..9a8ecc8 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-propagate.h @@ -0,0 +1,88 @@ +/* Data structures and function declarations for the SSA value propagation + engine. + Copyright (C) 2004-2017 Free Software Foundation, Inc. + Contributed by Diego Novillo + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef _TREE_SSA_PROPAGATE_H +#define _TREE_SSA_PROPAGATE_H 1 + +/* If SIM_P is true, statement S will be simulated again. */ + +static inline void +prop_set_simulate_again (gimple *s, bool visit_p) +{ + gimple_set_visited (s, visit_p); +} + +/* Return true if statement T should be simulated again. */ + +static inline bool +prop_simulate_again_p (gimple *s) +{ + return gimple_visited_p (s); +} + +/* Lattice values used for propagation purposes. Specific instances + of a propagation engine must return these values from the statement + and PHI visit functions to direct the engine. */ +enum ssa_prop_result { + /* The statement produces nothing of interest. No edges will be + added to the work lists. */ + SSA_PROP_NOT_INTERESTING, + + /* The statement produces an interesting value. The set SSA_NAMEs + returned by SSA_PROP_VISIT_STMT should be added to + INTERESTING_SSA_EDGES. If the statement being visited is a + conditional jump, SSA_PROP_VISIT_STMT should indicate which edge + out of the basic block should be marked executable. */ + SSA_PROP_INTERESTING, + + /* The statement produces a varying (i.e., useless) value and + should not be simulated again. If the statement being visited + is a conditional jump, all the edges coming out of the block + will be considered executable. */ + SSA_PROP_VARYING +}; + + +/* Call-back functions used by the value propagation engine. */ +typedef enum ssa_prop_result (*ssa_prop_visit_stmt_fn) (gimple *, edge *, + tree *); +typedef enum ssa_prop_result (*ssa_prop_visit_phi_fn) (gphi *); +typedef bool (*ssa_prop_fold_stmt_fn) (gimple_stmt_iterator *gsi); +typedef tree (*ssa_prop_get_value_fn) (tree); + + +extern bool valid_gimple_rhs_p (tree); +extern void move_ssa_defining_stmt_for_defs (gimple *, gimple *); +extern bool update_gimple_call (gimple_stmt_iterator *, tree, int, ...); +extern bool update_call_from_tree (gimple_stmt_iterator *, tree); +extern void ssa_propagate (ssa_prop_visit_stmt_fn, ssa_prop_visit_phi_fn); +extern bool stmt_makes_single_store (gimple *); +extern bool substitute_and_fold (ssa_prop_get_value_fn, ssa_prop_fold_stmt_fn); +extern bool may_propagate_copy (tree, tree); +extern bool may_propagate_copy_into_stmt (gimple *, tree); +extern bool may_propagate_copy_into_asm (tree); +extern void propagate_value (use_operand_p, tree); +extern void replace_exp (use_operand_p, tree); +extern void propagate_tree_value (tree *, tree); +extern void propagate_tree_value_into_stmt (gimple_stmt_iterator *, tree); +extern bool replace_uses_in (gimple *stmt, ssa_prop_get_value_fn get_value); + +#endif /* _TREE_SSA_PROPAGATE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-sccvn.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-sccvn.h new file mode 100644 index 0000000..ec00c37 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-sccvn.h @@ -0,0 +1,300 @@ +/* Tree SCC value numbering + Copyright (C) 2007-2017 Free Software Foundation, Inc. + Contributed by Daniel Berlin + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + GCC is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#ifndef TREE_SSA_SCCVN_H +#define TREE_SSA_SCCVN_H + +/* In tree-ssa-sccvn.c */ +bool expressions_equal_p (tree, tree); + + +/* TOP of the VN lattice. */ +extern tree VN_TOP; + +/* N-ary operations in the hashtable consist of length operands, an + opcode, and a type. Result is the value number of the operation, + and hashcode is stored to avoid having to calculate it + repeatedly. */ + +typedef struct vn_nary_op_s +{ + /* Unique identify that all expressions with the same value have. */ + unsigned int value_id; + ENUM_BITFIELD(tree_code) opcode : 16; + unsigned length : 16; + hashval_t hashcode; + tree result; + tree type; + tree op[1]; +} *vn_nary_op_t; +typedef const struct vn_nary_op_s *const_vn_nary_op_t; + +/* Return the size of a vn_nary_op_t with LENGTH operands. */ + +static inline size_t +sizeof_vn_nary_op (unsigned int length) +{ + return sizeof (struct vn_nary_op_s) + sizeof (tree) * length - sizeof (tree); +} + +/* Phi nodes in the hashtable consist of their non-VN_TOP phi + arguments, and the basic block the phi is in. Result is the value + number of the operation, and hashcode is stored to avoid having to + calculate it repeatedly. Phi nodes not in the same block are never + considered equivalent. */ + +typedef struct vn_phi_s +{ + /* Unique identifier that all expressions with the same value have. */ + unsigned int value_id; + hashval_t hashcode; + vec phiargs; + basic_block block; + /* Controlling condition lhs/rhs. */ + tree cclhs; + tree ccrhs; + tree type; + tree result; +} *vn_phi_t; +typedef const struct vn_phi_s *const_vn_phi_t; + +/* Reference operands only exist in reference operations structures. + They consist of an opcode, type, and some number of operands. For + a given opcode, some, all, or none of the operands may be used. + The operands are there to store the information that makes up the + portion of the addressing calculation that opcode performs. */ + +typedef struct vn_reference_op_struct +{ + ENUM_BITFIELD(tree_code) opcode : 16; + /* Dependence info, used for [TARGET_]MEM_REF only. */ + unsigned short clique; + unsigned short base; + /* 1 for instrumented calls. */ + unsigned with_bounds : 1; + unsigned reverse : 1; + /* For storing TYPE_ALIGN for array ref element size computation. */ + unsigned align : 6; + /* Constant offset this op adds or -1 if it is variable. */ + HOST_WIDE_INT off; + tree type; + tree op0; + tree op1; + tree op2; +} vn_reference_op_s; +typedef vn_reference_op_s *vn_reference_op_t; +typedef const vn_reference_op_s *const_vn_reference_op_t; + +inline unsigned +vn_ref_op_align_unit (vn_reference_op_t op) +{ + return op->align ? ((unsigned)1 << (op->align - 1)) / BITS_PER_UNIT : 0; +} + +/* A reference operation in the hashtable is representation as + the vuse, representing the memory state at the time of + the operation, and a collection of operands that make up the + addressing calculation. If two vn_reference_t's have the same set + of operands, they access the same memory location. We also store + the resulting value number, and the hashcode. */ + +typedef struct vn_reference_s +{ + /* Unique identifier that all expressions with the same value have. */ + unsigned int value_id; + hashval_t hashcode; + tree vuse; + alias_set_type set; + tree type; + vec operands; + tree result; + tree result_vdef; +} *vn_reference_t; +typedef const struct vn_reference_s *const_vn_reference_t; + +typedef struct vn_constant_s +{ + unsigned int value_id; + hashval_t hashcode; + tree constant; +} *vn_constant_t; + +enum vn_kind { VN_NONE, VN_CONSTANT, VN_NARY, VN_REFERENCE, VN_PHI }; +enum vn_kind vn_get_stmt_kind (gimple *); + +/* Hash the type TYPE using bits that distinguishes it in the + types_compatible_p sense. */ + +static inline hashval_t +vn_hash_type (tree type) +{ + return (INTEGRAL_TYPE_P (type) + + (INTEGRAL_TYPE_P (type) + ? TYPE_PRECISION (type) + TYPE_UNSIGNED (type) : 0)); +} + +/* Hash the constant CONSTANT with distinguishing type incompatible + constants in the types_compatible_p sense. */ + +static inline hashval_t +vn_hash_constant_with_type (tree constant) +{ + inchash::hash hstate; + inchash::add_expr (constant, hstate); + hstate.merge_hash (vn_hash_type (TREE_TYPE (constant))); + return hstate.end (); +} + +/* Compare the constants C1 and C2 with distinguishing type incompatible + constants in the types_compatible_p sense. */ + +static inline bool +vn_constant_eq_with_type (tree c1, tree c2) +{ + return (expressions_equal_p (c1, c2) + && types_compatible_p (TREE_TYPE (c1), TREE_TYPE (c2))); +} + +typedef struct vn_ssa_aux +{ + /* Value number. This may be an SSA name or a constant. */ + tree valnum; + /* Statements to insert if needs_insertion is true. */ + gimple_seq expr; + + /* Saved SSA name info. */ + tree_ssa_name::ssa_name_info_type info; + + /* Unique identifier that all expressions with the same value have. */ + unsigned int value_id; + + /* SCC information. */ + unsigned int dfsnum; + unsigned int low; + unsigned visited : 1; + unsigned on_sccstack : 1; + + /* Whether the SSA_NAME has been value numbered already. This is + only saying whether visit_use has been called on it at least + once. It cannot be used to avoid visitation for SSA_NAME's + involved in non-singleton SCC's. */ + unsigned use_processed : 1; + + /* Whether the SSA_NAME has no defining statement and thus an + insertion of such with EXPR as definition is required before + a use can be created of it. */ + unsigned needs_insertion : 1; + + /* Whether range-info is anti-range. */ + unsigned range_info_anti_range_p : 1; +} *vn_ssa_aux_t; + +enum vn_lookup_kind { VN_NOWALK, VN_WALK, VN_WALKREWRITE }; + +/* Return the value numbering info for an SSA_NAME. */ +extern vn_ssa_aux_t VN_INFO (tree); +extern vn_ssa_aux_t VN_INFO_GET (tree); +tree vn_get_expr_for (tree); +bool run_scc_vn (vn_lookup_kind); +void free_scc_vn (void); +void scc_vn_restore_ssa_info (void); +tree vn_nary_op_lookup (tree, vn_nary_op_t *); +tree vn_nary_op_lookup_stmt (gimple *, vn_nary_op_t *); +tree vn_nary_op_lookup_pieces (unsigned int, enum tree_code, + tree, tree *, vn_nary_op_t *); +vn_nary_op_t vn_nary_op_insert (tree, tree); +vn_nary_op_t vn_nary_op_insert_pieces (unsigned int, enum tree_code, + tree, tree *, tree, unsigned int); +bool ao_ref_init_from_vn_reference (ao_ref *, alias_set_type, tree, + vec ); +vec vn_reference_operands_for_lookup (tree); +tree vn_reference_lookup_pieces (tree, alias_set_type, tree, + vec , + vn_reference_t *, vn_lookup_kind); +tree vn_reference_lookup (tree, tree, vn_lookup_kind, vn_reference_t *, bool); +void vn_reference_lookup_call (gcall *, vn_reference_t *, vn_reference_t); +vn_reference_t vn_reference_insert_pieces (tree, alias_set_type, tree, + vec , + tree, unsigned int); + +bool vn_nary_op_eq (const_vn_nary_op_t const vno1, + const_vn_nary_op_t const vno2); +bool vn_nary_may_trap (vn_nary_op_t); +bool vn_reference_eq (const_vn_reference_t const, const_vn_reference_t const); +unsigned int get_max_value_id (void); +unsigned int get_next_value_id (void); +unsigned int get_constant_value_id (tree); +unsigned int get_or_alloc_constant_value_id (tree); +bool value_id_constant_p (unsigned int); +tree fully_constant_vn_reference_p (vn_reference_t); +tree vn_nary_simplify (vn_nary_op_t); + +/* Valueize NAME if it is an SSA name, otherwise just return it. */ + +static inline tree +vn_valueize (tree name) +{ + if (TREE_CODE (name) == SSA_NAME) + { + tree tem = VN_INFO (name)->valnum; + return tem == VN_TOP ? name : tem; + } + return name; +} + +/* Get at the original range info for NAME. */ + +inline range_info_def * +VN_INFO_RANGE_INFO (tree name) +{ + return (VN_INFO (name)->info.range_info + ? VN_INFO (name)->info.range_info + : SSA_NAME_RANGE_INFO (name)); +} + +/* Whether the original range info of NAME is an anti-range. */ + +inline bool +VN_INFO_ANTI_RANGE_P (tree name) +{ + return (VN_INFO (name)->info.range_info + ? VN_INFO (name)->range_info_anti_range_p + : SSA_NAME_ANTI_RANGE_P (name)); +} + +/* Get at the original range info kind for NAME. */ + +inline value_range_type +VN_INFO_RANGE_TYPE (tree name) +{ + return VN_INFO_ANTI_RANGE_P (name) ? VR_ANTI_RANGE : VR_RANGE; +} + +/* Get at the original pointer info for NAME. */ + +inline ptr_info_def * +VN_INFO_PTR_INFO (tree name) +{ + return (VN_INFO (name)->info.ptr_info + ? VN_INFO (name)->info.ptr_info + : SSA_NAME_PTR_INFO (name)); +} + +#endif /* TREE_SSA_SCCVN_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-scopedtables.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-scopedtables.h new file mode 100644 index 0000000..df304ae --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-scopedtables.h @@ -0,0 +1,207 @@ +/* Header file for SSA dominator optimizations. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_SSA_SCOPED_TABLES_H +#define GCC_TREE_SSA_SCOPED_TABLES_H + +/* Representation of a "naked" right-hand-side expression, to be used + in recording available expressions in the expression hash table. */ + +enum expr_kind +{ + EXPR_SINGLE, + EXPR_UNARY, + EXPR_BINARY, + EXPR_TERNARY, + EXPR_CALL, + EXPR_PHI +}; + +struct hashable_expr +{ + tree type; + enum expr_kind kind; + union { + struct { tree rhs; } single; + struct { enum tree_code op; tree opnd; } unary; + struct { enum tree_code op; tree opnd0, opnd1; } binary; + struct { enum tree_code op; tree opnd0, opnd1, opnd2; } ternary; + struct { gcall *fn_from; bool pure; size_t nargs; tree *args; } call; + struct { size_t nargs; tree *args; } phi; + } ops; +}; + +/* Structure for recording known value of a conditional expression. + + Clients build vectors of these objects to record known values + that occur on edges. */ + +struct cond_equivalence +{ + /* The condition, in a HASHABLE_EXPR form. */ + struct hashable_expr cond; + + /* The result of the condition (true or false. */ + tree value; +}; + +/* Structure for entries in the expression hash table. */ + +typedef class expr_hash_elt * expr_hash_elt_t; + +class expr_hash_elt +{ + public: + expr_hash_elt (gimple *, tree); + expr_hash_elt (tree); + expr_hash_elt (struct hashable_expr *, tree); + expr_hash_elt (class expr_hash_elt &); + ~expr_hash_elt (); + void print (FILE *); + tree vop (void) { return m_vop; } + tree lhs (void) { return m_lhs; } + struct hashable_expr *expr (void) { return &m_expr; } + expr_hash_elt *stamp (void) { return m_stamp; } + hashval_t hash (void) { return m_hash; } + + private: + /* The expression (rhs) we want to record. */ + struct hashable_expr m_expr; + + /* The value (lhs) of this expression. */ + tree m_lhs; + + /* The virtual operand associated with the nearest dominating stmt + loading from or storing to expr. */ + tree m_vop; + + /* The hash value for RHS. */ + hashval_t m_hash; + + /* A unique stamp, typically the address of the hash + element itself, used in removing entries from the table. */ + struct expr_hash_elt *m_stamp; + + /* We should never be making assignments between objects in this class. + Though it might allow us to exploit C++11 move semantics if we + defined the move constructor and move assignment operator. */ + expr_hash_elt& operator= (const expr_hash_elt&); +}; + +/* Hashtable helpers. */ + +struct expr_elt_hasher : pointer_hash +{ + static inline hashval_t hash (const value_type &p) + { return p->hash (); } + static bool equal (const value_type &, const compare_type &); + static inline void remove (value_type &element) + { delete element; } +}; + + +/* This class defines a unwindable expression equivalence table + layered on top of the expression hash table. + + Essentially it's just a stack of available expression value pairs with + a special marker (NULL, NULL) to indicate unwind points. */ + +class avail_exprs_stack +{ + public: + /* We need access to the AVAIL_EXPR hash table so that we can + remove entries from the hash table when unwinding the stack. */ + avail_exprs_stack (hash_table *table) + { m_stack.create (20); m_avail_exprs = table; } + ~avail_exprs_stack (void) { m_stack.release (); } + + /* Push the unwinding marker onto the stack. */ + void push_marker (void) { record_expr (NULL, NULL, 'M'); } + + /* Restore the AVAIL_EXPRs table to its state when the last marker + was pushed. */ + void pop_to_marker (void); + + /* Record a single available expression that can be unwound. */ + void record_expr (expr_hash_elt_t, expr_hash_elt_t, char); + + /* Get the underlying hash table. Would this be better as + class inheritance? */ + hash_table *avail_exprs (void) + { return m_avail_exprs; } + + /* Lookup and conditionally insert an expression into the table, + recording enough information to unwind as needed. */ + tree lookup_avail_expr (gimple *, bool, bool); + + void record_cond (cond_equivalence *); + + private: + vec > m_stack; + hash_table *m_avail_exprs; + + /* We do not allow copying this object or initializing one + from another. */ + avail_exprs_stack& operator= (const avail_exprs_stack&); + avail_exprs_stack (class avail_exprs_stack &); +}; + +/* This class defines an unwindable const/copy equivalence table + layered on top of SSA_NAME_VALUE/set_ssa_name_value. + + Essentially it's just a stack of name,prev value pairs with a + special marker (NULL) to indicate unwind points. */ + +class const_and_copies +{ + public: + const_and_copies (void) { m_stack.create (20); }; + ~const_and_copies (void) { m_stack.release (); } + + /* Push the unwinding marker onto the stack. */ + void push_marker (void) { m_stack.safe_push (NULL_TREE); } + + /* Restore the const/copies table to its state when the last marker + was pushed. */ + void pop_to_marker (void); + + /* Record a single const/copy pair that can be unwound. This version + may follow the value chain for the RHS. */ + void record_const_or_copy (tree, tree); + + /* Record a single const/copy pair that can be unwound. This version + does not follow the value chain for the RHS. */ + void record_const_or_copy_raw (tree, tree, tree); + + /* Special entry point when we want to provide an explicit previous + value for the first argument. Try to get rid of this in the future. + + This version may also follow the value chain for the RHS. */ + void record_const_or_copy (tree, tree, tree); + + private: + vec m_stack; + const_and_copies& operator= (const const_and_copies&); + const_and_copies (class const_and_copies &); +}; + +void initialize_expr_from_cond (tree cond, struct hashable_expr *expr); +void record_conditions (vec *p, tree, tree); + +#endif /* GCC_TREE_SSA_SCOPED_TABLES_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-ter.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-ter.h new file mode 100644 index 0000000..7652e1e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-ter.h @@ -0,0 +1,26 @@ +/* Header file for tree-ssa-ter.c exports. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_SSA_TER_H +#define GCC_TREE_SSA_TER_H + +extern bitmap find_replaceable_exprs (var_map); +extern void dump_replaceable_exprs (FILE *, bitmap); + +#endif /* GCC_TREE_SSA_TER_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-threadbackward.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-threadbackward.h new file mode 100644 index 0000000..f758ff1 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-threadbackward.h @@ -0,0 +1,25 @@ +/* Header file for SSA dominator optimizations. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_SSA_THREADFSM_H +#define GCC_TREE_SSA_THREADFSM_H + +extern void find_jump_threads_backwards (edge); + +#endif /* GCC_TREE_SSA_THREADFSM_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-threadedge.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-threadedge.h new file mode 100644 index 0000000..49dfa9c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-threadedge.h @@ -0,0 +1,39 @@ +/* Header file for SSA jump threading. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_SSA_THREADEDGE_H +#define GCC_TREE_SSA_THREADEDGE_H + +extern vec ssa_name_values; +#define SSA_NAME_VALUE(x) \ + (SSA_NAME_VERSION (x) < ssa_name_values.length () \ + ? ssa_name_values[SSA_NAME_VERSION (x)] \ + : NULL_TREE) +extern void set_ssa_name_value (tree, tree); +extern void threadedge_initialize_values (void); +extern void threadedge_finalize_values (void); +extern bool potentially_threadable_block (basic_block); +extern void propagate_threaded_block_debug_into (basic_block, basic_block); +extern void thread_outgoing_edges (basic_block, gcond *, + const_and_copies *, + avail_exprs_stack *, + tree (*) (gimple *, gimple *, + avail_exprs_stack *, basic_block)); + +#endif /* GCC_TREE_SSA_THREADEDGE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-threadupdate.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-threadupdate.h new file mode 100644 index 0000000..296eff2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa-threadupdate.h @@ -0,0 +1,63 @@ +/* Communication between registering jump thread requests and + updating the SSA/CFG for jump threading. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef _TREE_SSA_THREADUPDATE_H +#define _TREE_SSA_THREADUPDATE_H 1 + +/* In tree-ssa-threadupdate.c. */ +extern bool thread_through_all_blocks (bool); +enum jump_thread_edge_type +{ + EDGE_START_JUMP_THREAD, + EDGE_FSM_THREAD, + EDGE_COPY_SRC_BLOCK, + EDGE_COPY_SRC_JOINER_BLOCK, + EDGE_NO_COPY_SRC_BLOCK +}; + +class jump_thread_edge +{ +public: + jump_thread_edge (edge e, enum jump_thread_edge_type type) + : e (e), type (type) {} + + edge e; + enum jump_thread_edge_type type; +}; + +extern void register_jump_thread (vec *); +extern void remove_jump_threads_including (edge); +extern void delete_jump_thread_path (vec *); +extern void remove_ctrl_stmt_and_useless_edges (basic_block, basic_block); +extern void free_dom_edge_info (edge); + +enum bb_dom_status +{ + /* BB does not dominate latch of the LOOP. */ + DOMST_NONDOMINATING, + /* The LOOP is broken (there is no path from the header to its latch. */ + DOMST_LOOP_BROKEN, + /* BB dominates the latch of the LOOP. */ + DOMST_DOMINATING +}; + +enum bb_dom_status determine_bb_domination_status (struct loop *, basic_block); + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa.h new file mode 100644 index 0000000..c99b5ea --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssa.h @@ -0,0 +1,92 @@ +/* Header file for any pass which requires SSA routines. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_SSA_H +#define GCC_TREE_SSA_H + +/* Mapping for redirected edges. */ +struct edge_var_map { + tree result; /* PHI result. */ + tree def; /* PHI arg definition. */ + source_location locus; /* PHI arg location. */ +}; + +/* A vector of var maps. */ +typedef vec edge_var_map_vector; + + +extern void redirect_edge_var_map_add (edge, tree, tree, source_location); +extern void redirect_edge_var_map_clear (edge); +extern void redirect_edge_var_map_dup (edge, edge); +extern vec *redirect_edge_var_map_vector (edge); +extern void redirect_edge_var_map_empty (void); +extern edge ssa_redirect_edge (edge, basic_block); +extern void flush_pending_stmts (edge); +extern void gimple_replace_ssa_lhs (gimple *, tree); +extern tree target_for_debug_bind (tree); +extern void insert_debug_temp_for_var_def (gimple_stmt_iterator *, tree); +extern void insert_debug_temps_for_defs (gimple_stmt_iterator *); +extern void reset_debug_uses (gimple *); +extern void release_defs_bitset (bitmap toremove); +extern void verify_ssa (bool, bool); +extern void init_tree_ssa (function *); +extern void delete_tree_ssa (function *); +extern bool tree_ssa_useless_type_conversion (tree); +extern tree tree_ssa_strip_useless_type_conversions (tree); + + +extern bool ssa_defined_default_def_p (tree t); +extern bool ssa_undefined_value_p (tree, bool = true); +extern bool gimple_uses_undefined_value_p (gimple *); +extern void execute_update_addresses_taken (void); + +/* Given an edge_var_map V, return the PHI arg definition. */ + +static inline tree +redirect_edge_var_map_def (edge_var_map *v) +{ + return v->def; +} + +/* Given an edge_var_map V, return the PHI result. */ + +static inline tree +redirect_edge_var_map_result (edge_var_map *v) +{ + return v->result; +} + +/* Given an edge_var_map V, return the PHI arg location. */ + +static inline source_location +redirect_edge_var_map_location (edge_var_map *v) +{ + return v->locus; +} + +/* Verify SSA invariants, if internal consistency checks are enabled. */ + +static inline void +checking_verify_ssa (bool check_modified_stmt, bool check_ssa_operands) +{ + if (flag_checking) + verify_ssa (check_modified_stmt, check_ssa_operands); +} + +#endif /* GCC_TREE_SSA_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssanames.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssanames.h new file mode 100644 index 0000000..9a18394 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-ssanames.h @@ -0,0 +1,156 @@ +/* SSA name expresssons routines + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_SSANAMES_H +#define GCC_TREE_SSANAMES_H + +/* Aliasing information for SSA_NAMEs representing pointer variables. */ + +struct GTY(()) ptr_info_def +{ + /* The points-to solution. */ + struct pt_solution pt; + + /* Alignment and misalignment of the pointer in bytes. Together + align and misalign specify low known bits of the pointer. + ptr & (align - 1) == misalign. */ + + /* When known, this is the power-of-two byte alignment of the object this + pointer points into. This is usually DECL_ALIGN_UNIT for decls and + MALLOC_ABI_ALIGNMENT for allocated storage. When the alignment is not + known, it is zero. Do not access directly but use functions + get_ptr_info_alignment, set_ptr_info_alignment, + mark_ptr_info_alignment_unknown and similar. */ + unsigned int align; + + /* When alignment is known, the byte offset this pointer differs from the + above alignment. Access only through the same helper functions as align + above. */ + unsigned int misalign; +}; + +/* Value range information for SSA_NAMEs representing non-pointer variables. */ + +struct GTY ((variable_size)) range_info_def { + /* Minimum, maximum and nonzero bits. */ + TRAILING_WIDE_INT_ACCESSOR (min, ints, 0) + TRAILING_WIDE_INT_ACCESSOR (max, ints, 1) + TRAILING_WIDE_INT_ACCESSOR (nonzero_bits, ints, 2) + trailing_wide_ints <3> ints; +}; + + +#define SSANAMES(fun) (fun)->gimple_df->ssa_names +#define DEFAULT_DEFS(fun) (fun)->gimple_df->default_defs + +#define num_ssa_names (vec_safe_length (cfun->gimple_df->ssa_names)) +#define ssa_name(i) ((*cfun->gimple_df->ssa_names)[(i)]) + +#define FOR_EACH_SSA_NAME(I, VAR, FN) \ + for (I = 1; SSANAMES (FN)->iterate (I, &VAR); ++I) \ + if (VAR) + +/* Sets the value range to SSA. */ +extern void set_range_info (tree, enum value_range_type, const wide_int_ref &, + const wide_int_ref &); +/* Gets the value range from SSA. */ +extern enum value_range_type get_range_info (const_tree, wide_int *, + wide_int *); +extern void set_nonzero_bits (tree, const wide_int_ref &); +extern wide_int get_nonzero_bits (const_tree); +extern bool ssa_name_has_boolean_range (tree); +extern void init_ssanames (struct function *, int); +extern void fini_ssanames (struct function *); +extern void ssanames_print_statistics (void); +extern tree make_ssa_name_fn (struct function *, tree, gimple *, + unsigned int version = 0); +extern void release_ssa_name_fn (struct function *, tree); +extern bool get_ptr_info_alignment (struct ptr_info_def *, unsigned int *, + unsigned int *); +extern void mark_ptr_info_alignment_unknown (struct ptr_info_def *); +extern void set_ptr_info_alignment (struct ptr_info_def *, unsigned int, + unsigned int); +extern void adjust_ptr_info_misalignment (struct ptr_info_def *, + unsigned int); +extern struct ptr_info_def *get_ptr_info (tree); +extern void set_ptr_nonnull (tree); +extern bool get_ptr_nonnull (const_tree); + +extern tree copy_ssa_name_fn (struct function *, tree, gimple *); +extern void duplicate_ssa_name_ptr_info (tree, struct ptr_info_def *); +extern tree duplicate_ssa_name_fn (struct function *, tree, gimple *); +extern void duplicate_ssa_name_range_info (tree, enum value_range_type, + struct range_info_def *); +extern void reset_flow_sensitive_info (tree); +extern void reset_flow_sensitive_info_in_bb (basic_block); +extern void release_defs (gimple *); +extern void replace_ssa_name_symbol (tree, tree); +extern void flush_ssaname_freelist (void); + + +/* Return an SSA_NAME node for variable VAR defined in statement STMT + in function cfun. */ + +static inline tree +make_ssa_name (tree var, gimple *stmt = NULL) +{ + return make_ssa_name_fn (cfun, var, stmt); +} + +/* Return an SSA_NAME node using the template SSA name NAME defined in + statement STMT in function cfun. */ + +static inline tree +copy_ssa_name (tree var, gimple *stmt = NULL) +{ + return copy_ssa_name_fn (cfun, var, stmt); +} + +/* Creates a duplicate of a SSA name NAME tobe defined by statement STMT + in function cfun. */ + +static inline tree +duplicate_ssa_name (tree var, gimple *stmt) +{ + return duplicate_ssa_name_fn (cfun, var, stmt); +} + +/* Release the SSA name NAME used in function cfun. */ + +static inline void +release_ssa_name (tree name) +{ + release_ssa_name_fn (cfun, name); +} + +/* Return an anonymous SSA_NAME node for type TYPE defined in statement STMT + in function cfun. Arrange so that it uses NAME in dumps. */ + +static inline tree +make_temp_ssa_name (tree type, gimple *stmt, const char *name) +{ + tree ssa_name; + gcc_checking_assert (TYPE_P (type)); + ssa_name = make_ssa_name_fn (cfun, type, stmt); + SET_SSA_NAME_VAR_OR_IDENTIFIER (ssa_name, get_identifier (name)); + return ssa_name; +} + + +#endif /* GCC_TREE_SSANAMES_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-stdarg.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-stdarg.h new file mode 100644 index 0000000..16a22c6 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-stdarg.h @@ -0,0 +1,36 @@ +/* Header for a pass computing data for optimizing stdarg functions. + Copyright (C) 2004-2017 Free Software Foundation, Inc. + Contributed by Jakub Jelinek + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_STDARG_H +#define GCC_TREE_STDARG_H 1 + +struct stdarg_info +{ + bitmap va_list_vars, va_list_escape_vars; + basic_block bb; + int compute_sizes, va_start_count; + bool va_list_escapes; + int *offsets; + /* These 2 fields are only meaningful if va_start_count == 1. */ + basic_block va_start_bb; + tree va_start_ap; +}; + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-streamer.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-streamer.h new file mode 100644 index 0000000..1a77187 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-streamer.h @@ -0,0 +1,124 @@ +/* Data structures and functions for streaming trees. + + Copyright (C) 2011-2017 Free Software Foundation, Inc. + Contributed by Diego Novillo + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_STREAMER_H +#define GCC_TREE_STREAMER_H + +#include "streamer-hooks.h" +#include "data-streamer.h" + +/* Cache of pickled nodes. Used to avoid writing the same node more + than once. The first time a tree node is streamed out, it is + entered in this cache. Subsequent references to the same node are + resolved by looking it up in this cache. + + This is used in two ways: + + - On the writing side, the first time T is added to STREAMER_CACHE, + a new reference index is created for T and T is emitted on the + stream. If T needs to be emitted again to the stream, instead of + pickling it again, the reference index is emitted. + + - On the reading side, the first time T is read from the stream, it + is reconstructed in memory and a new reference index created for + T. The reconstructed T is inserted in some array so that when + the reference index for T is found in the input stream, it can be + used to look up into the array to get the reconstructed T. */ + +struct streamer_tree_cache_d +{ + /* The mapping between tree nodes and slots into the nodes array. */ + hash_map *node_map; + + /* The nodes pickled so far. */ + vec nodes; + /* The node hashes (if available). */ + vec hashes; + + /* Next index to assign. */ + unsigned next_idx; +}; + +/* In tree-streamer-in.c. */ +tree streamer_read_string_cst (struct data_in *, struct lto_input_block *); +tree streamer_read_chain (struct lto_input_block *, struct data_in *); +tree streamer_alloc_tree (struct lto_input_block *, struct data_in *, + enum LTO_tags); +void streamer_read_tree_body (struct lto_input_block *, struct data_in *, tree); +tree streamer_get_pickled_tree (struct lto_input_block *, struct data_in *); +void streamer_read_tree_bitfields (struct lto_input_block *, + struct data_in *, tree); + +/* In tree-streamer-out.c. */ +void streamer_write_string_cst (struct output_block *, + struct lto_output_stream *, tree); +void streamer_write_chain (struct output_block *, tree, bool); +void streamer_write_tree_header (struct output_block *, tree); +void streamer_write_tree_bitfields (struct output_block *, tree); +void streamer_write_tree_body (struct output_block *, tree, bool); +void streamer_write_integer_cst (struct output_block *, tree, bool); + +/* In tree-streamer.c. */ +extern unsigned char streamer_mode_table[1 << 8]; +void streamer_check_handled_ts_structures (void); +bool streamer_tree_cache_insert (struct streamer_tree_cache_d *, tree, + hashval_t, unsigned *); +void streamer_tree_cache_replace_tree (struct streamer_tree_cache_d *, tree, + unsigned); +void streamer_tree_cache_append (struct streamer_tree_cache_d *, tree, + hashval_t); +bool streamer_tree_cache_lookup (struct streamer_tree_cache_d *, tree, + unsigned *); +struct streamer_tree_cache_d *streamer_tree_cache_create (bool, bool, bool); +void streamer_tree_cache_delete (struct streamer_tree_cache_d *); + +/* Return the tree node at slot IX in CACHE. */ + +static inline tree +streamer_tree_cache_get_tree (struct streamer_tree_cache_d *cache, unsigned ix) +{ + return cache->nodes[ix]; +} + +/* Return the tree hash value at slot IX in CACHE. */ + +static inline hashval_t +streamer_tree_cache_get_hash (struct streamer_tree_cache_d *cache, unsigned ix) +{ + return cache->hashes[ix]; +} + +static inline void +bp_pack_machine_mode (struct bitpack_d *bp, machine_mode mode) +{ + streamer_mode_table[mode] = 1; + bp_pack_enum (bp, machine_mode, 1 << 8, mode); +} + +static inline machine_mode +bp_unpack_machine_mode (struct bitpack_d *bp) +{ + return (machine_mode) + ((struct lto_input_block *) + bp->stream)->mode_table[bp_unpack_enum (bp, machine_mode, 1 << 8)]; +} + +#endif /* GCC_TREE_STREAMER_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-vectorizer.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-vectorizer.h new file mode 100644 index 0000000..12bb904 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-vectorizer.h @@ -0,0 +1,1219 @@ +/* Vectorizer + Copyright (C) 2003-2017 Free Software Foundation, Inc. + Contributed by Dorit Naishlos + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_VECTORIZER_H +#define GCC_TREE_VECTORIZER_H + +#include "tree-data-ref.h" +#include "target.h" + +/* Used for naming of new temporaries. */ +enum vect_var_kind { + vect_simple_var, + vect_pointer_var, + vect_scalar_var, + vect_mask_var +}; + +/* Defines type of operation. */ +enum operation_type { + unary_op = 1, + binary_op, + ternary_op +}; + +/* Define type of available alignment support. */ +enum dr_alignment_support { + dr_unaligned_unsupported, + dr_unaligned_supported, + dr_explicit_realign, + dr_explicit_realign_optimized, + dr_aligned +}; + +/* Define type of def-use cross-iteration cycle. */ +enum vect_def_type { + vect_uninitialized_def = 0, + vect_constant_def = 1, + vect_external_def, + vect_internal_def, + vect_induction_def, + vect_reduction_def, + vect_double_reduction_def, + vect_nested_cycle, + vect_unknown_def_type +}; + +/* Define type of reduction. */ +enum vect_reduction_type { + TREE_CODE_REDUCTION, + COND_REDUCTION, + INTEGER_INDUC_COND_REDUCTION, + CONST_COND_REDUCTION +}; + +#define VECTORIZABLE_CYCLE_DEF(D) (((D) == vect_reduction_def) \ + || ((D) == vect_double_reduction_def) \ + || ((D) == vect_nested_cycle)) + +/* Structure to encapsulate information about a group of like + instructions to be presented to the target cost model. */ +struct stmt_info_for_cost { + int count; + enum vect_cost_for_stmt kind; + gimple *stmt; + int misalign; +}; + +typedef vec stmt_vector_for_cost; + +/************************************************************************ + SLP + ************************************************************************/ +typedef struct _slp_tree *slp_tree; + +/* A computation tree of an SLP instance. Each node corresponds to a group of + stmts to be packed in a SIMD stmt. */ +struct _slp_tree { + /* Nodes that contain def-stmts of this node statements operands. */ + vec children; + /* A group of scalar stmts to be vectorized together. */ + vec stmts; + /* Load permutation relative to the stores, NULL if there is no + permutation. */ + vec load_permutation; + /* Vectorized stmt/s. */ + vec vec_stmts; + /* Number of vector stmts that are created to replace the group of scalar + stmts. It is calculated during the transformation phase as the number of + scalar elements in one scalar iteration (GROUP_SIZE) multiplied by VF + divided by vector size. */ + unsigned int vec_stmts_size; + /* Whether the scalar computations use two different operators. */ + bool two_operators; + /* The DEF type of this node. */ + enum vect_def_type def_type; +}; + + +/* SLP instance is a sequence of stmts in a loop that can be packed into + SIMD stmts. */ +typedef struct _slp_instance { + /* The root of SLP tree. */ + slp_tree root; + + /* Size of groups of scalar stmts that will be replaced by SIMD stmt/s. */ + unsigned int group_size; + + /* The unrolling factor required to vectorized this SLP instance. */ + unsigned int unrolling_factor; + + /* The group of nodes that contain loads of this SLP instance. */ + vec loads; +} *slp_instance; + + +/* Access Functions. */ +#define SLP_INSTANCE_TREE(S) (S)->root +#define SLP_INSTANCE_GROUP_SIZE(S) (S)->group_size +#define SLP_INSTANCE_UNROLLING_FACTOR(S) (S)->unrolling_factor +#define SLP_INSTANCE_LOADS(S) (S)->loads + +#define SLP_TREE_CHILDREN(S) (S)->children +#define SLP_TREE_SCALAR_STMTS(S) (S)->stmts +#define SLP_TREE_VEC_STMTS(S) (S)->vec_stmts +#define SLP_TREE_NUMBER_OF_VEC_STMTS(S) (S)->vec_stmts_size +#define SLP_TREE_LOAD_PERMUTATION(S) (S)->load_permutation +#define SLP_TREE_TWO_OPERATORS(S) (S)->two_operators +#define SLP_TREE_DEF_TYPE(S) (S)->def_type + + + +/* This struct is used to store the information of a data reference, + including the data ref itself and the segment length for aliasing + checks. This is used to merge alias checks. */ + +struct dr_with_seg_len +{ + dr_with_seg_len (data_reference_p d, tree len) + : dr (d), seg_len (len) {} + + data_reference_p dr; + tree seg_len; +}; + +/* This struct contains two dr_with_seg_len objects with aliasing data + refs. Two comparisons are generated from them. */ + +struct dr_with_seg_len_pair_t +{ + dr_with_seg_len_pair_t (const dr_with_seg_len& d1, + const dr_with_seg_len& d2) + : first (d1), second (d2) {} + + dr_with_seg_len first; + dr_with_seg_len second; +}; + + + +/* Vectorizer state common between loop and basic-block vectorization. */ +struct vec_info { + enum { bb, loop } kind; + + /* All SLP instances. */ + vec slp_instances; + + /* All data references. */ + vec datarefs; + + /* All data dependences. */ + vec ddrs; + + /* All interleaving chains of stores, represented by the first + stmt in the chain. */ + vec grouped_stores; + + /* Cost data used by the target cost model. */ + void *target_cost_data; +}; + +struct _loop_vec_info; +struct _bb_vec_info; + +template<> +template<> +inline bool +is_a_helper <_loop_vec_info *>::test (vec_info *i) +{ + return i->kind == vec_info::loop; +} + +template<> +template<> +inline bool +is_a_helper <_bb_vec_info *>::test (vec_info *i) +{ + return i->kind == vec_info::bb; +} + + +/*-----------------------------------------------------------------*/ +/* Info on vectorized loops. */ +/*-----------------------------------------------------------------*/ +typedef struct _loop_vec_info : public vec_info { + + /* The loop to which this info struct refers to. */ + struct loop *loop; + + /* The loop basic blocks. */ + basic_block *bbs; + + /* Number of latch executions. */ + tree num_itersm1; + /* Number of iterations. */ + tree num_iters; + /* Number of iterations of the original loop. */ + tree num_iters_unchanged; + /* Condition under which this loop is analyzed and versioned. */ + tree num_iters_assumptions; + + /* Threshold of number of iterations below which vectorzation will not be + performed. It is calculated from MIN_PROFITABLE_ITERS and + PARAM_MIN_VECT_LOOP_BOUND. */ + unsigned int th; + + /* Unrolling factor */ + int vectorization_factor; + + /* Unknown DRs according to which loop was peeled. */ + struct data_reference *unaligned_dr; + + /* peeling_for_alignment indicates whether peeling for alignment will take + place, and what the peeling factor should be: + peeling_for_alignment = X means: + If X=0: Peeling for alignment will not be applied. + If X>0: Peel first X iterations. + If X=-1: Generate a runtime test to calculate the number of iterations + to be peeled, using the dataref recorded in the field + unaligned_dr. */ + int peeling_for_alignment; + + /* The mask used to check the alignment of pointers or arrays. */ + int ptr_mask; + + /* The loop nest in which the data dependences are computed. */ + vec loop_nest; + + /* Data Dependence Relations defining address ranges that are candidates + for a run-time aliasing check. */ + vec may_alias_ddrs; + + /* Data Dependence Relations defining address ranges together with segment + lengths from which the run-time aliasing check is built. */ + vec comp_alias_ddrs; + + /* Statements in the loop that have data references that are candidates for a + runtime (loop versioning) misalignment check. */ + vec may_misalign_stmts; + + /* Reduction cycles detected in the loop. Used in loop-aware SLP. */ + vec reductions; + + /* All reduction chains in the loop, represented by the first + stmt in the chain. */ + vec reduction_chains; + + /* Cost vector for a single scalar iteration. */ + vec scalar_cost_vec; + + /* The unrolling factor needed to SLP the loop. In case of that pure SLP is + applied to the loop, i.e., no unrolling is needed, this is 1. */ + unsigned slp_unrolling_factor; + + /* Cost of a single scalar iteration. */ + int single_scalar_iteration_cost; + + /* Is the loop vectorizable? */ + bool vectorizable; + + /* When we have grouped data accesses with gaps, we may introduce invalid + memory accesses. We peel the last iteration of the loop to prevent + this. */ + bool peeling_for_gaps; + + /* When the number of iterations is not a multiple of the vector size + we need to peel off iterations at the end to form an epilogue loop. */ + bool peeling_for_niter; + + /* Reductions are canonicalized so that the last operand is the reduction + operand. If this places a constant into RHS1, this decanonicalizes + GIMPLE for other phases, so we must track when this has occurred and + fix it up. */ + bool operands_swapped; + + /* True if there are no loop carried data dependencies in the loop. + If loop->safelen <= 1, then this is always true, either the loop + didn't have any loop carried data dependencies, or the loop is being + vectorized guarded with some runtime alias checks, or couldn't + be vectorized at all, but then this field shouldn't be used. + For loop->safelen >= 2, the user has asserted that there are no + backward dependencies, but there still could be loop carried forward + dependencies in such loops. This flag will be false if normal + vectorizer data dependency analysis would fail or require versioning + for alias, but because of loop->safelen >= 2 it has been vectorized + even without versioning for alias. E.g. in: + #pragma omp simd + for (int i = 0; i < m; i++) + a[i] = a[i + k] * c; + (or #pragma simd or #pragma ivdep) we can vectorize this and it will + DTRT even for k > 0 && k < m, but without safelen we would not + vectorize this, so this field would be false. */ + bool no_data_dependencies; + + /* Mark loops having masked stores. */ + bool has_mask_store; + + /* If if-conversion versioned this loop before conversion, this is the + loop version without if-conversion. */ + struct loop *scalar_loop; + + /* For loops being epilogues of already vectorized loops + this points to the original vectorized loop. Otherwise NULL. */ + _loop_vec_info *orig_loop_info; + +} *loop_vec_info; + +/* Access Functions. */ +#define LOOP_VINFO_LOOP(L) (L)->loop +#define LOOP_VINFO_BBS(L) (L)->bbs +#define LOOP_VINFO_NITERSM1(L) (L)->num_itersm1 +#define LOOP_VINFO_NITERS(L) (L)->num_iters +/* Since LOOP_VINFO_NITERS and LOOP_VINFO_NITERSM1 can change after + prologue peeling retain total unchanged scalar loop iterations for + cost model. */ +#define LOOP_VINFO_NITERS_UNCHANGED(L) (L)->num_iters_unchanged +#define LOOP_VINFO_NITERS_ASSUMPTIONS(L) (L)->num_iters_assumptions +#define LOOP_VINFO_COST_MODEL_THRESHOLD(L) (L)->th +#define LOOP_VINFO_VECTORIZABLE_P(L) (L)->vectorizable +#define LOOP_VINFO_VECT_FACTOR(L) (L)->vectorization_factor +#define LOOP_VINFO_PTR_MASK(L) (L)->ptr_mask +#define LOOP_VINFO_LOOP_NEST(L) (L)->loop_nest +#define LOOP_VINFO_DATAREFS(L) (L)->datarefs +#define LOOP_VINFO_DDRS(L) (L)->ddrs +#define LOOP_VINFO_INT_NITERS(L) (TREE_INT_CST_LOW ((L)->num_iters)) +#define LOOP_VINFO_PEELING_FOR_ALIGNMENT(L) (L)->peeling_for_alignment +#define LOOP_VINFO_UNALIGNED_DR(L) (L)->unaligned_dr +#define LOOP_VINFO_MAY_MISALIGN_STMTS(L) (L)->may_misalign_stmts +#define LOOP_VINFO_MAY_ALIAS_DDRS(L) (L)->may_alias_ddrs +#define LOOP_VINFO_COMP_ALIAS_DDRS(L) (L)->comp_alias_ddrs +#define LOOP_VINFO_GROUPED_STORES(L) (L)->grouped_stores +#define LOOP_VINFO_SLP_INSTANCES(L) (L)->slp_instances +#define LOOP_VINFO_SLP_UNROLLING_FACTOR(L) (L)->slp_unrolling_factor +#define LOOP_VINFO_REDUCTIONS(L) (L)->reductions +#define LOOP_VINFO_REDUCTION_CHAINS(L) (L)->reduction_chains +#define LOOP_VINFO_TARGET_COST_DATA(L) (L)->target_cost_data +#define LOOP_VINFO_PEELING_FOR_GAPS(L) (L)->peeling_for_gaps +#define LOOP_VINFO_OPERANDS_SWAPPED(L) (L)->operands_swapped +#define LOOP_VINFO_PEELING_FOR_NITER(L) (L)->peeling_for_niter +#define LOOP_VINFO_NO_DATA_DEPENDENCIES(L) (L)->no_data_dependencies +#define LOOP_VINFO_SCALAR_LOOP(L) (L)->scalar_loop +#define LOOP_VINFO_HAS_MASK_STORE(L) (L)->has_mask_store +#define LOOP_VINFO_SCALAR_ITERATION_COST(L) (L)->scalar_cost_vec +#define LOOP_VINFO_SINGLE_SCALAR_ITERATION_COST(L) (L)->single_scalar_iteration_cost +#define LOOP_VINFO_ORIG_LOOP_INFO(L) (L)->orig_loop_info + +#define LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT(L) \ + ((L)->may_misalign_stmts.length () > 0) +#define LOOP_REQUIRES_VERSIONING_FOR_ALIAS(L) \ + ((L)->may_alias_ddrs.length () > 0) +#define LOOP_REQUIRES_VERSIONING_FOR_NITERS(L) \ + (LOOP_VINFO_NITERS_ASSUMPTIONS (L)) +#define LOOP_REQUIRES_VERSIONING(L) \ + (LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT (L) \ + || LOOP_REQUIRES_VERSIONING_FOR_ALIAS (L) \ + || LOOP_REQUIRES_VERSIONING_FOR_NITERS (L)) + +#define LOOP_VINFO_NITERS_KNOWN_P(L) \ + (tree_fits_shwi_p ((L)->num_iters) && tree_to_shwi ((L)->num_iters) > 0) + +#define LOOP_VINFO_EPILOGUE_P(L) \ + (LOOP_VINFO_ORIG_LOOP_INFO (L) != NULL) + +#define LOOP_VINFO_ORIG_VECT_FACTOR(L) \ + (LOOP_VINFO_VECT_FACTOR (LOOP_VINFO_ORIG_LOOP_INFO (L))) + +static inline loop_vec_info +loop_vec_info_for_loop (struct loop *loop) +{ + return (loop_vec_info) loop->aux; +} + +static inline bool +nested_in_vect_loop_p (struct loop *loop, gimple *stmt) +{ + return (loop->inner + && (loop->inner == (gimple_bb (stmt))->loop_father)); +} + +typedef struct _bb_vec_info : public vec_info +{ + basic_block bb; + gimple_stmt_iterator region_begin; + gimple_stmt_iterator region_end; +} *bb_vec_info; + +#define BB_VINFO_BB(B) (B)->bb +#define BB_VINFO_GROUPED_STORES(B) (B)->grouped_stores +#define BB_VINFO_SLP_INSTANCES(B) (B)->slp_instances +#define BB_VINFO_DATAREFS(B) (B)->datarefs +#define BB_VINFO_DDRS(B) (B)->ddrs +#define BB_VINFO_TARGET_COST_DATA(B) (B)->target_cost_data + +static inline bb_vec_info +vec_info_for_bb (basic_block bb) +{ + return (bb_vec_info) bb->aux; +} + +/*-----------------------------------------------------------------*/ +/* Info on vectorized defs. */ +/*-----------------------------------------------------------------*/ +enum stmt_vec_info_type { + undef_vec_info_type = 0, + load_vec_info_type, + store_vec_info_type, + shift_vec_info_type, + op_vec_info_type, + call_vec_info_type, + call_simd_clone_vec_info_type, + assignment_vec_info_type, + condition_vec_info_type, + comparison_vec_info_type, + reduc_vec_info_type, + induc_vec_info_type, + type_promotion_vec_info_type, + type_demotion_vec_info_type, + type_conversion_vec_info_type, + loop_exit_ctrl_vec_info_type +}; + +/* Indicates whether/how a variable is used in the scope of loop/basic + block. */ +enum vect_relevant { + vect_unused_in_scope = 0, + + /* The def is only used outside the loop. */ + vect_used_only_live, + /* The def is in the inner loop, and the use is in the outer loop, and the + use is a reduction stmt. */ + vect_used_in_outer_by_reduction, + /* The def is in the inner loop, and the use is in the outer loop (and is + not part of reduction). */ + vect_used_in_outer, + + /* defs that feed computations that end up (only) in a reduction. These + defs may be used by non-reduction stmts, but eventually, any + computations/values that are affected by these defs are used to compute + a reduction (i.e. don't get stored to memory, for example). We use this + to identify computations that we can change the order in which they are + computed. */ + vect_used_by_reduction, + + vect_used_in_scope +}; + +/* The type of vectorization that can be applied to the stmt: regular loop-based + vectorization; pure SLP - the stmt is a part of SLP instances and does not + have uses outside SLP instances; or hybrid SLP and loop-based - the stmt is + a part of SLP instance and also must be loop-based vectorized, since it has + uses outside SLP sequences. + + In the loop context the meanings of pure and hybrid SLP are slightly + different. By saying that pure SLP is applied to the loop, we mean that we + exploit only intra-iteration parallelism in the loop; i.e., the loop can be + vectorized without doing any conceptual unrolling, cause we don't pack + together stmts from different iterations, only within a single iteration. + Loop hybrid SLP means that we exploit both intra-iteration and + inter-iteration parallelism (e.g., number of elements in the vector is 4 + and the slp-group-size is 2, in which case we don't have enough parallelism + within an iteration, so we obtain the rest of the parallelism from subsequent + iterations by unrolling the loop by 2). */ +enum slp_vect_type { + loop_vect = 0, + pure_slp, + hybrid +}; + +/* Describes how we're going to vectorize an individual load or store, + or a group of loads or stores. */ +enum vect_memory_access_type { + /* An access to an invariant address. This is used only for loads. */ + VMAT_INVARIANT, + + /* A simple contiguous access. */ + VMAT_CONTIGUOUS, + + /* A contiguous access that goes down in memory rather than up, + with no additional permutation. This is used only for stores + of invariants. */ + VMAT_CONTIGUOUS_DOWN, + + /* A simple contiguous access in which the elements need to be permuted + after loading or before storing. Only used for loop vectorization; + SLP uses separate permutes. */ + VMAT_CONTIGUOUS_PERMUTE, + + /* A simple contiguous access in which the elements need to be reversed + after loading or before storing. */ + VMAT_CONTIGUOUS_REVERSE, + + /* An access that uses IFN_LOAD_LANES or IFN_STORE_LANES. */ + VMAT_LOAD_STORE_LANES, + + /* An access in which each scalar element is loaded or stored + individually. */ + VMAT_ELEMENTWISE, + + /* A hybrid of VMAT_CONTIGUOUS and VMAT_ELEMENTWISE, used for grouped + SLP accesses. Each unrolled iteration uses a contiguous load + or store for the whole group, but the groups from separate iterations + are combined in the same way as for VMAT_ELEMENTWISE. */ + VMAT_STRIDED_SLP, + + /* The access uses gather loads or scatter stores. */ + VMAT_GATHER_SCATTER +}; + +typedef struct data_reference *dr_p; + +typedef struct _stmt_vec_info { + + enum stmt_vec_info_type type; + + /* Indicates whether this stmts is part of a computation whose result is + used outside the loop. */ + bool live; + + /* Stmt is part of some pattern (computation idiom) */ + bool in_pattern_p; + + /* Is this statement vectorizable or should it be skipped in (partial) + vectorization. */ + bool vectorizable; + + /* The stmt to which this info struct refers to. */ + gimple *stmt; + + /* The vec_info with respect to which STMT is vectorized. */ + vec_info *vinfo; + + /* The vector type to be used for the LHS of this statement. */ + tree vectype; + + /* The vectorized version of the stmt. */ + gimple *vectorized_stmt; + + + /** The following is relevant only for stmts that contain a non-scalar + data-ref (array/pointer/struct access). A GIMPLE stmt is expected to have + at most one such data-ref. **/ + + /* Information about the data-ref (access function, etc), + relative to the inner-most containing loop. */ + struct data_reference *data_ref_info; + + /* Information about the data-ref relative to this loop + nest (the loop that is being considered for vectorization). */ + tree dr_base_address; + tree dr_init; + tree dr_offset; + tree dr_step; + tree dr_aligned_to; + + /* For loop PHI nodes, the base and evolution part of it. This makes sure + this information is still available in vect_update_ivs_after_vectorizer + where we may not be able to re-analyze the PHI nodes evolution as + peeling for the prologue loop can make it unanalyzable. The evolution + part is still correct after peeling, but the base may have changed from + the version here. */ + tree loop_phi_evolution_base_unchanged; + tree loop_phi_evolution_part; + + /* Used for various bookkeeping purposes, generally holding a pointer to + some other stmt S that is in some way "related" to this stmt. + Current use of this field is: + If this stmt is part of a pattern (i.e. the field 'in_pattern_p' is + true): S is the "pattern stmt" that represents (and replaces) the + sequence of stmts that constitutes the pattern. Similarly, the + related_stmt of the "pattern stmt" points back to this stmt (which is + the last stmt in the original sequence of stmts that constitutes the + pattern). */ + gimple *related_stmt; + + /* Used to keep a sequence of def stmts of a pattern stmt if such exists. */ + gimple_seq pattern_def_seq; + + /* List of datarefs that are known to have the same alignment as the dataref + of this stmt. */ + vec same_align_refs; + + /* Selected SIMD clone's function info. First vector element + is SIMD clone's function decl, followed by a pair of trees (base + step) + for linear arguments (pair of NULLs for other arguments). */ + vec simd_clone_info; + + /* Classify the def of this stmt. */ + enum vect_def_type def_type; + + /* Whether the stmt is SLPed, loop-based vectorized, or both. */ + enum slp_vect_type slp_type; + + /* Interleaving and reduction chains info. */ + /* First element in the group. */ + gimple *first_element; + /* Pointer to the next element in the group. */ + gimple *next_element; + /* For data-refs, in case that two or more stmts share data-ref, this is the + pointer to the previously detected stmt with the same dr. */ + gimple *same_dr_stmt; + /* The size of the group. */ + unsigned int size; + /* For stores, number of stores from this group seen. We vectorize the last + one. */ + unsigned int store_count; + /* For loads only, the gap from the previous load. For consecutive loads, GAP + is 1. */ + unsigned int gap; + + /* The minimum negative dependence distance this stmt participates in + or zero if none. */ + unsigned int min_neg_dist; + + /* Not all stmts in the loop need to be vectorized. e.g, the increment + of the loop induction variable and computation of array indexes. relevant + indicates whether the stmt needs to be vectorized. */ + enum vect_relevant relevant; + + /* For loads if this is a gather, for stores if this is a scatter. */ + bool gather_scatter_p; + + /* True if this is an access with loop-invariant stride. */ + bool strided_p; + + /* For both loads and stores. */ + bool simd_lane_access_p; + + /* Classifies how the load or store is going to be implemented + for loop vectorization. */ + vect_memory_access_type memory_access_type; + + /* For reduction loops, this is the type of reduction. */ + enum vect_reduction_type v_reduc_type; + + /* For CONST_COND_REDUCTION, record the reduc code. */ + enum tree_code const_cond_reduc_code; + + /* The number of scalar stmt references from active SLP instances. */ + unsigned int num_slp_uses; +} *stmt_vec_info; + +/* Information about a gather/scatter call. */ +struct gather_scatter_info { + /* The FUNCTION_DECL for the built-in gather/scatter function. */ + tree decl; + + /* The loop-invariant base value. */ + tree base; + + /* The original scalar offset, which is a non-loop-invariant SSA_NAME. */ + tree offset; + + /* Each offset element should be multiplied by this amount before + being added to the base. */ + int scale; + + /* The definition type for the vectorized offset. */ + enum vect_def_type offset_dt; + + /* The type of the vectorized offset. */ + tree offset_vectype; +}; + +/* Access Functions. */ +#define STMT_VINFO_TYPE(S) (S)->type +#define STMT_VINFO_STMT(S) (S)->stmt +inline loop_vec_info +STMT_VINFO_LOOP_VINFO (stmt_vec_info stmt_vinfo) +{ + if (loop_vec_info loop_vinfo = dyn_cast (stmt_vinfo->vinfo)) + return loop_vinfo; + return NULL; +} +inline bb_vec_info +STMT_VINFO_BB_VINFO (stmt_vec_info stmt_vinfo) +{ + if (bb_vec_info bb_vinfo = dyn_cast (stmt_vinfo->vinfo)) + return bb_vinfo; + return NULL; +} +#define STMT_VINFO_RELEVANT(S) (S)->relevant +#define STMT_VINFO_LIVE_P(S) (S)->live +#define STMT_VINFO_VECTYPE(S) (S)->vectype +#define STMT_VINFO_VEC_STMT(S) (S)->vectorized_stmt +#define STMT_VINFO_VECTORIZABLE(S) (S)->vectorizable +#define STMT_VINFO_DATA_REF(S) (S)->data_ref_info +#define STMT_VINFO_GATHER_SCATTER_P(S) (S)->gather_scatter_p +#define STMT_VINFO_STRIDED_P(S) (S)->strided_p +#define STMT_VINFO_MEMORY_ACCESS_TYPE(S) (S)->memory_access_type +#define STMT_VINFO_SIMD_LANE_ACCESS_P(S) (S)->simd_lane_access_p +#define STMT_VINFO_VEC_REDUCTION_TYPE(S) (S)->v_reduc_type +#define STMT_VINFO_VEC_CONST_COND_REDUC_CODE(S) (S)->const_cond_reduc_code + +#define STMT_VINFO_DR_BASE_ADDRESS(S) (S)->dr_base_address +#define STMT_VINFO_DR_INIT(S) (S)->dr_init +#define STMT_VINFO_DR_OFFSET(S) (S)->dr_offset +#define STMT_VINFO_DR_STEP(S) (S)->dr_step +#define STMT_VINFO_DR_ALIGNED_TO(S) (S)->dr_aligned_to + +#define STMT_VINFO_IN_PATTERN_P(S) (S)->in_pattern_p +#define STMT_VINFO_RELATED_STMT(S) (S)->related_stmt +#define STMT_VINFO_PATTERN_DEF_SEQ(S) (S)->pattern_def_seq +#define STMT_VINFO_SAME_ALIGN_REFS(S) (S)->same_align_refs +#define STMT_VINFO_SIMD_CLONE_INFO(S) (S)->simd_clone_info +#define STMT_VINFO_DEF_TYPE(S) (S)->def_type +#define STMT_VINFO_GROUP_FIRST_ELEMENT(S) (S)->first_element +#define STMT_VINFO_GROUP_NEXT_ELEMENT(S) (S)->next_element +#define STMT_VINFO_GROUP_SIZE(S) (S)->size +#define STMT_VINFO_GROUP_STORE_COUNT(S) (S)->store_count +#define STMT_VINFO_GROUP_GAP(S) (S)->gap +#define STMT_VINFO_GROUP_SAME_DR_STMT(S) (S)->same_dr_stmt +#define STMT_VINFO_GROUPED_ACCESS(S) ((S)->first_element != NULL && (S)->data_ref_info) +#define STMT_VINFO_LOOP_PHI_EVOLUTION_BASE_UNCHANGED(S) (S)->loop_phi_evolution_base_unchanged +#define STMT_VINFO_LOOP_PHI_EVOLUTION_PART(S) (S)->loop_phi_evolution_part +#define STMT_VINFO_MIN_NEG_DIST(S) (S)->min_neg_dist +#define STMT_VINFO_NUM_SLP_USES(S) (S)->num_slp_uses + +#define GROUP_FIRST_ELEMENT(S) (S)->first_element +#define GROUP_NEXT_ELEMENT(S) (S)->next_element +#define GROUP_SIZE(S) (S)->size +#define GROUP_STORE_COUNT(S) (S)->store_count +#define GROUP_GAP(S) (S)->gap +#define GROUP_SAME_DR_STMT(S) (S)->same_dr_stmt + +#define STMT_VINFO_RELEVANT_P(S) ((S)->relevant != vect_unused_in_scope) + +#define HYBRID_SLP_STMT(S) ((S)->slp_type == hybrid) +#define PURE_SLP_STMT(S) ((S)->slp_type == pure_slp) +#define STMT_SLP_TYPE(S) (S)->slp_type + +struct dataref_aux { + int misalignment; + /* If true the alignment of base_decl needs to be increased. */ + bool base_misaligned; + /* If true we know the base is at least vector element alignment aligned. */ + bool base_element_aligned; + tree base_decl; +}; + +#define DR_VECT_AUX(dr) ((dataref_aux *)(dr)->aux) + +#define VECT_MAX_COST 1000 + +/* The maximum number of intermediate steps required in multi-step type + conversion. */ +#define MAX_INTERM_CVT_STEPS 3 + +/* The maximum vectorization factor supported by any target (V64QI). */ +#define MAX_VECTORIZATION_FACTOR 64 + +/* Nonzero if TYPE represents a (scalar) boolean type or type + in the middle-end compatible with it (unsigned precision 1 integral + types). Used to determine which types should be vectorized as + VECTOR_BOOLEAN_TYPE_P. */ + +#define VECT_SCALAR_BOOLEAN_TYPE_P(TYPE) \ + (TREE_CODE (TYPE) == BOOLEAN_TYPE \ + || ((TREE_CODE (TYPE) == INTEGER_TYPE \ + || TREE_CODE (TYPE) == ENUMERAL_TYPE) \ + && TYPE_PRECISION (TYPE) == 1 \ + && TYPE_UNSIGNED (TYPE))) + +extern vec stmt_vec_info_vec; + +void init_stmt_vec_info_vec (void); +void free_stmt_vec_info_vec (void); + +/* Return a stmt_vec_info corresponding to STMT. */ + +static inline stmt_vec_info +vinfo_for_stmt (gimple *stmt) +{ + unsigned int uid = gimple_uid (stmt); + if (uid == 0) + return NULL; + + return stmt_vec_info_vec[uid - 1]; +} + +/* Set vectorizer information INFO for STMT. */ + +static inline void +set_vinfo_for_stmt (gimple *stmt, stmt_vec_info info) +{ + unsigned int uid = gimple_uid (stmt); + if (uid == 0) + { + gcc_checking_assert (info); + uid = stmt_vec_info_vec.length () + 1; + gimple_set_uid (stmt, uid); + stmt_vec_info_vec.safe_push (info); + } + else + { + gcc_checking_assert (info == NULL); + stmt_vec_info_vec[uid - 1] = info; + } +} + +/* Return the earlier statement between STMT1 and STMT2. */ + +static inline gimple * +get_earlier_stmt (gimple *stmt1, gimple *stmt2) +{ + unsigned int uid1, uid2; + + if (stmt1 == NULL) + return stmt2; + + if (stmt2 == NULL) + return stmt1; + + uid1 = gimple_uid (stmt1); + uid2 = gimple_uid (stmt2); + + if (uid1 == 0 || uid2 == 0) + return NULL; + + gcc_checking_assert (uid1 <= stmt_vec_info_vec.length () + && uid2 <= stmt_vec_info_vec.length ()); + + if (uid1 < uid2) + return stmt1; + else + return stmt2; +} + +/* Return the later statement between STMT1 and STMT2. */ + +static inline gimple * +get_later_stmt (gimple *stmt1, gimple *stmt2) +{ + unsigned int uid1, uid2; + + if (stmt1 == NULL) + return stmt2; + + if (stmt2 == NULL) + return stmt1; + + uid1 = gimple_uid (stmt1); + uid2 = gimple_uid (stmt2); + + if (uid1 == 0 || uid2 == 0) + return NULL; + + gcc_assert (uid1 <= stmt_vec_info_vec.length ()); + gcc_assert (uid2 <= stmt_vec_info_vec.length ()); + + if (uid1 > uid2) + return stmt1; + else + return stmt2; +} + +/* Return TRUE if a statement represented by STMT_INFO is a part of a + pattern. */ + +static inline bool +is_pattern_stmt_p (stmt_vec_info stmt_info) +{ + gimple *related_stmt; + stmt_vec_info related_stmt_info; + + related_stmt = STMT_VINFO_RELATED_STMT (stmt_info); + if (related_stmt + && (related_stmt_info = vinfo_for_stmt (related_stmt)) + && STMT_VINFO_IN_PATTERN_P (related_stmt_info)) + return true; + + return false; +} + +/* Return true if BB is a loop header. */ + +static inline bool +is_loop_header_bb_p (basic_block bb) +{ + if (bb == (bb->loop_father)->header) + return true; + gcc_checking_assert (EDGE_COUNT (bb->preds) == 1); + return false; +} + +/* Return pow2 (X). */ + +static inline int +vect_pow2 (int x) +{ + int i, res = 1; + + for (i = 0; i < x; i++) + res *= 2; + + return res; +} + +/* Alias targetm.vectorize.builtin_vectorization_cost. */ + +static inline int +builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost, + tree vectype, int misalign) +{ + return targetm.vectorize.builtin_vectorization_cost (type_of_cost, + vectype, misalign); +} + +/* Get cost by calling cost target builtin. */ + +static inline +int vect_get_stmt_cost (enum vect_cost_for_stmt type_of_cost) +{ + return builtin_vectorization_cost (type_of_cost, NULL, 0); +} + +/* Alias targetm.vectorize.init_cost. */ + +static inline void * +init_cost (struct loop *loop_info) +{ + return targetm.vectorize.init_cost (loop_info); +} + +/* Alias targetm.vectorize.add_stmt_cost. */ + +static inline unsigned +add_stmt_cost (void *data, int count, enum vect_cost_for_stmt kind, + stmt_vec_info stmt_info, int misalign, + enum vect_cost_model_location where) +{ + return targetm.vectorize.add_stmt_cost (data, count, kind, + stmt_info, misalign, where); +} + +/* Alias targetm.vectorize.finish_cost. */ + +static inline void +finish_cost (void *data, unsigned *prologue_cost, + unsigned *body_cost, unsigned *epilogue_cost) +{ + targetm.vectorize.finish_cost (data, prologue_cost, body_cost, epilogue_cost); +} + +/* Alias targetm.vectorize.destroy_cost_data. */ + +static inline void +destroy_cost_data (void *data) +{ + targetm.vectorize.destroy_cost_data (data); +} + +/*-----------------------------------------------------------------*/ +/* Info on data references alignment. */ +/*-----------------------------------------------------------------*/ +inline void +set_dr_misalignment (struct data_reference *dr, int val) +{ + dataref_aux *data_aux = DR_VECT_AUX (dr); + + if (!data_aux) + { + data_aux = XCNEW (dataref_aux); + dr->aux = data_aux; + } + + data_aux->misalignment = val; +} + +inline int +dr_misalignment (struct data_reference *dr) +{ + return DR_VECT_AUX (dr)->misalignment; +} + +/* Reflects actual alignment of first access in the vectorized loop, + taking into account peeling/versioning if applied. */ +#define DR_MISALIGNMENT(DR) dr_misalignment (DR) +#define SET_DR_MISALIGNMENT(DR, VAL) set_dr_misalignment (DR, VAL) + +/* Return TRUE if the data access is aligned, and FALSE otherwise. */ + +static inline bool +aligned_access_p (struct data_reference *data_ref_info) +{ + return (DR_MISALIGNMENT (data_ref_info) == 0); +} + +/* Return TRUE if the alignment of the data access is known, and FALSE + otherwise. */ + +static inline bool +known_alignment_for_access_p (struct data_reference *data_ref_info) +{ + return (DR_MISALIGNMENT (data_ref_info) != -1); +} + + +/* Return true if the vect cost model is unlimited. */ +static inline bool +unlimited_cost_model (loop_p loop) +{ + if (loop != NULL && loop->force_vectorize + && flag_simd_cost_model != VECT_COST_MODEL_DEFAULT) + return flag_simd_cost_model == VECT_COST_MODEL_UNLIMITED; + return (flag_vect_cost_model == VECT_COST_MODEL_UNLIMITED); +} + +/* Source location */ +extern source_location vect_location; + +/*-----------------------------------------------------------------*/ +/* Function prototypes. */ +/*-----------------------------------------------------------------*/ + +/* Simple loop peeling and versioning utilities for vectorizer's purposes - + in tree-vect-loop-manip.c. */ +extern void slpeel_make_loop_iterate_ntimes (struct loop *, tree); +extern bool slpeel_can_duplicate_loop_p (const struct loop *, const_edge); +struct loop *slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *, + struct loop *, edge); +extern void vect_loop_versioning (loop_vec_info, unsigned int, bool); +extern struct loop *vect_do_peeling (loop_vec_info, tree, tree, + tree *, int, bool, bool); +extern source_location find_loop_location (struct loop *); +extern bool vect_can_advance_ivs_p (loop_vec_info); + +/* In tree-vect-stmts.c. */ +extern unsigned int current_vector_size; +extern tree get_vectype_for_scalar_type (tree); +extern tree get_mask_type_for_scalar_type (tree); +extern tree get_same_sized_vectype (tree, tree); +extern bool vect_is_simple_use (tree, vec_info *, gimple **, + enum vect_def_type *); +extern bool vect_is_simple_use (tree, vec_info *, gimple **, + enum vect_def_type *, tree *); +extern bool supportable_widening_operation (enum tree_code, gimple *, tree, + tree, enum tree_code *, + enum tree_code *, int *, + vec *); +extern bool supportable_narrowing_operation (enum tree_code, tree, tree, + enum tree_code *, + int *, vec *); +extern stmt_vec_info new_stmt_vec_info (gimple *stmt, vec_info *); +extern void free_stmt_vec_info (gimple *stmt); +extern void vect_model_simple_cost (stmt_vec_info, int, enum vect_def_type *, + stmt_vector_for_cost *, + stmt_vector_for_cost *); +extern void vect_model_store_cost (stmt_vec_info, int, vect_memory_access_type, + enum vect_def_type, slp_tree, + stmt_vector_for_cost *, + stmt_vector_for_cost *); +extern void vect_model_load_cost (stmt_vec_info, int, vect_memory_access_type, + slp_tree, stmt_vector_for_cost *, + stmt_vector_for_cost *); +extern unsigned record_stmt_cost (stmt_vector_for_cost *, int, + enum vect_cost_for_stmt, stmt_vec_info, + int, enum vect_cost_model_location); +extern void vect_finish_stmt_generation (gimple *, gimple *, + gimple_stmt_iterator *); +extern bool vect_mark_stmts_to_be_vectorized (loop_vec_info); +extern tree vect_get_vec_def_for_operand_1 (gimple *, enum vect_def_type); +extern tree vect_get_vec_def_for_operand (tree, gimple *, tree = NULL); +extern tree vect_init_vector (gimple *, tree, tree, + gimple_stmt_iterator *); +extern tree vect_get_vec_def_for_stmt_copy (enum vect_def_type, tree); +extern bool vect_transform_stmt (gimple *, gimple_stmt_iterator *, + bool *, slp_tree, slp_instance); +extern void vect_remove_stores (gimple *); +extern bool vect_analyze_stmt (gimple *, bool *, slp_tree); +extern bool vectorizable_condition (gimple *, gimple_stmt_iterator *, + gimple **, tree, int, slp_tree); +extern void vect_get_load_cost (struct data_reference *, int, bool, + unsigned int *, unsigned int *, + stmt_vector_for_cost *, + stmt_vector_for_cost *, bool); +extern void vect_get_store_cost (struct data_reference *, int, + unsigned int *, stmt_vector_for_cost *); +extern bool vect_supportable_shift (enum tree_code, tree); +extern void vect_get_vec_defs (tree, tree, gimple *, vec *, + vec *, slp_tree, int); +extern tree vect_gen_perm_mask_any (tree, const unsigned char *); +extern tree vect_gen_perm_mask_checked (tree, const unsigned char *); +extern void optimize_mask_stores (struct loop*); + +/* In tree-vect-data-refs.c. */ +extern bool vect_can_force_dr_alignment_p (const_tree, unsigned int); +extern enum dr_alignment_support vect_supportable_dr_alignment + (struct data_reference *, bool); +extern tree vect_get_smallest_scalar_type (gimple *, HOST_WIDE_INT *, + HOST_WIDE_INT *); +extern bool vect_analyze_data_ref_dependences (loop_vec_info, int *); +extern bool vect_slp_analyze_instance_dependence (slp_instance); +extern bool vect_enhance_data_refs_alignment (loop_vec_info); +extern bool vect_analyze_data_refs_alignment (loop_vec_info); +extern bool vect_verify_datarefs_alignment (loop_vec_info); +extern bool vect_slp_analyze_and_verify_instance_alignment (slp_instance); +extern bool vect_analyze_data_ref_accesses (vec_info *); +extern bool vect_prune_runtime_alias_test_list (loop_vec_info); +extern bool vect_check_gather_scatter (gimple *, loop_vec_info, + gather_scatter_info *); +extern bool vect_analyze_data_refs (vec_info *, int *); +extern tree vect_create_data_ref_ptr (gimple *, tree, struct loop *, tree, + tree *, gimple_stmt_iterator *, + gimple **, bool, bool *, + tree = NULL_TREE); +extern tree bump_vector_ptr (tree, gimple *, gimple_stmt_iterator *, gimple *, + tree); +extern tree vect_create_destination_var (tree, tree); +extern bool vect_grouped_store_supported (tree, unsigned HOST_WIDE_INT); +extern bool vect_store_lanes_supported (tree, unsigned HOST_WIDE_INT); +extern bool vect_grouped_load_supported (tree, bool, unsigned HOST_WIDE_INT); +extern bool vect_load_lanes_supported (tree, unsigned HOST_WIDE_INT); +extern void vect_permute_store_chain (vec ,unsigned int, gimple *, + gimple_stmt_iterator *, vec *); +extern tree vect_setup_realignment (gimple *, gimple_stmt_iterator *, tree *, + enum dr_alignment_support, tree, + struct loop **); +extern void vect_transform_grouped_load (gimple *, vec , int, + gimple_stmt_iterator *); +extern void vect_record_grouped_load_vectors (gimple *, vec ); +extern tree vect_get_new_vect_var (tree, enum vect_var_kind, const char *); +extern tree vect_get_new_ssa_name (tree, enum vect_var_kind, + const char * = NULL); +extern tree vect_create_addr_base_for_vector_ref (gimple *, gimple_seq *, + tree, struct loop *, + tree = NULL_TREE); + +/* In tree-vect-loop.c. */ +/* FORNOW: Used in tree-parloops.c. */ +extern void destroy_loop_vec_info (loop_vec_info, bool); +extern gimple *vect_force_simple_reduction (loop_vec_info, gimple *, bool, + bool *, bool); +/* Drive for loop analysis stage. */ +extern loop_vec_info vect_analyze_loop (struct loop *, loop_vec_info); +extern tree vect_build_loop_niters (loop_vec_info); +extern void vect_gen_vector_loop_niters (loop_vec_info, tree, tree *, bool); +/* Drive for loop transformation stage. */ +extern struct loop *vect_transform_loop (loop_vec_info); +extern loop_vec_info vect_analyze_loop_form (struct loop *); +extern bool vectorizable_live_operation (gimple *, gimple_stmt_iterator *, + slp_tree, int, gimple **); +extern bool vectorizable_reduction (gimple *, gimple_stmt_iterator *, + gimple **, slp_tree); +extern bool vectorizable_induction (gimple *, gimple_stmt_iterator *, gimple **); +extern tree get_initial_def_for_reduction (gimple *, tree, tree *); +extern int vect_min_worthwhile_factor (enum tree_code); +extern int vect_get_known_peeling_cost (loop_vec_info, int, int *, + stmt_vector_for_cost *, + stmt_vector_for_cost *, + stmt_vector_for_cost *); + +/* In tree-vect-slp.c. */ +extern void vect_free_slp_instance (slp_instance); +extern bool vect_transform_slp_perm_load (slp_tree, vec , + gimple_stmt_iterator *, int, + slp_instance, bool, unsigned *); +extern bool vect_slp_analyze_operations (vec slp_instances, + void *); +extern bool vect_schedule_slp (vec_info *); +extern bool vect_analyze_slp (vec_info *, unsigned); +extern bool vect_make_slp_decision (loop_vec_info); +extern void vect_detect_hybrid_slp (loop_vec_info); +extern void vect_get_slp_defs (vec , slp_tree, + vec > *, int); +extern bool vect_slp_bb (basic_block); +extern gimple *vect_find_last_scalar_stmt_in_slp (slp_tree); +extern bool is_simple_and_all_uses_invariant (gimple *, loop_vec_info); + +/* In tree-vect-patterns.c. */ +/* Pattern recognition functions. + Additional pattern recognition functions can (and will) be added + in the future. */ +typedef gimple *(* vect_recog_func_ptr) (vec *, tree *, tree *); +#define NUM_PATTERNS 14 +void vect_pattern_recog (vec_info *); + +/* In tree-vectorizer.c. */ +unsigned vectorize_loops (void); +void vect_destroy_datarefs (vec_info *); +bool vect_stmt_in_region_p (vec_info *, gimple *); +void vect_free_loop_info_assumptions (struct loop *); + +#endif /* GCC_TREE_VECTORIZER_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-vrp.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-vrp.h new file mode 100644 index 0000000..ef2c68a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree-vrp.h @@ -0,0 +1,59 @@ +/* Support routines for Value Range Propagation (VRP). + Copyright (C) 2016-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* Type of value ranges. See value_range_d In tree-vrp.c for a + description of these types. */ +enum value_range_type { VR_UNDEFINED, VR_RANGE, + VR_ANTI_RANGE, VR_VARYING, VR_LAST }; + +/* Range of values that can be associated with an SSA_NAME after VRP + has executed. */ +struct GTY((for_user)) value_range +{ + /* Lattice value represented by this range. */ + enum value_range_type type; + + /* Minimum and maximum values represented by this range. These + values should be interpreted as follows: + + - If TYPE is VR_UNDEFINED or VR_VARYING then MIN and MAX must + be NULL. + + - If TYPE == VR_RANGE then MIN holds the minimum value and + MAX holds the maximum value of the range [MIN, MAX]. + + - If TYPE == ANTI_RANGE the variable is known to NOT + take any values in the range [MIN, MAX]. */ + tree min; + tree max; + + /* Set of SSA names whose value ranges are equivalent to this one. + This set is only valid when TYPE is VR_RANGE or VR_ANTI_RANGE. */ + bitmap equiv; +}; + +extern void vrp_intersect_ranges (value_range *vr0, value_range *vr1); +extern void vrp_meet (value_range *vr0, const value_range *vr1); +extern void dump_value_range (FILE *, const value_range *); +extern void extract_range_from_unary_expr (value_range *vr, + enum tree_code code, + tree type, + value_range *vr0_, + tree op0_type); + diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree.h new file mode 100644 index 0000000..f20b77f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tree.h @@ -0,0 +1,5503 @@ +/* Definitions for the ubiquitous 'tree' type for GNU compilers. + Copyright (C) 1989-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TREE_H +#define GCC_TREE_H + +#include "tree-core.h" + +/* Convert a target-independent built-in function code to a combined_fn. */ + +inline combined_fn +as_combined_fn (built_in_function fn) +{ + return combined_fn (int (fn)); +} + +/* Convert an internal function code to a combined_fn. */ + +inline combined_fn +as_combined_fn (internal_fn fn) +{ + return combined_fn (int (fn) + int (END_BUILTINS)); +} + +/* Return true if CODE is a target-independent built-in function. */ + +inline bool +builtin_fn_p (combined_fn code) +{ + return int (code) < int (END_BUILTINS); +} + +/* Return the target-independent built-in function represented by CODE. + Only valid if builtin_fn_p (CODE). */ + +inline built_in_function +as_builtin_fn (combined_fn code) +{ + gcc_checking_assert (builtin_fn_p (code)); + return built_in_function (int (code)); +} + +/* Return true if CODE is an internal function. */ + +inline bool +internal_fn_p (combined_fn code) +{ + return int (code) >= int (END_BUILTINS); +} + +/* Return the internal function represented by CODE. Only valid if + internal_fn_p (CODE). */ + +inline internal_fn +as_internal_fn (combined_fn code) +{ + gcc_checking_assert (internal_fn_p (code)); + return internal_fn (int (code) - int (END_BUILTINS)); +} + +/* Macros for initializing `tree_contains_struct'. */ +#define MARK_TS_BASE(C) \ + do { \ + tree_contains_struct[C][TS_BASE] = 1; \ + } while (0) + +#define MARK_TS_TYPED(C) \ + do { \ + MARK_TS_BASE (C); \ + tree_contains_struct[C][TS_TYPED] = 1; \ + } while (0) + +#define MARK_TS_COMMON(C) \ + do { \ + MARK_TS_TYPED (C); \ + tree_contains_struct[C][TS_COMMON] = 1; \ + } while (0) + +#define MARK_TS_TYPE_COMMON(C) \ + do { \ + MARK_TS_COMMON (C); \ + tree_contains_struct[C][TS_TYPE_COMMON] = 1; \ + } while (0) + +#define MARK_TS_TYPE_WITH_LANG_SPECIFIC(C) \ + do { \ + MARK_TS_TYPE_COMMON (C); \ + tree_contains_struct[C][TS_TYPE_WITH_LANG_SPECIFIC] = 1; \ + } while (0) + +#define MARK_TS_DECL_MINIMAL(C) \ + do { \ + MARK_TS_COMMON (C); \ + tree_contains_struct[C][TS_DECL_MINIMAL] = 1; \ + } while (0) + +#define MARK_TS_DECL_COMMON(C) \ + do { \ + MARK_TS_DECL_MINIMAL (C); \ + tree_contains_struct[C][TS_DECL_COMMON] = 1; \ + } while (0) + +#define MARK_TS_DECL_WRTL(C) \ + do { \ + MARK_TS_DECL_COMMON (C); \ + tree_contains_struct[C][TS_DECL_WRTL] = 1; \ + } while (0) + +#define MARK_TS_DECL_WITH_VIS(C) \ + do { \ + MARK_TS_DECL_WRTL (C); \ + tree_contains_struct[C][TS_DECL_WITH_VIS] = 1; \ + } while (0) + +#define MARK_TS_DECL_NON_COMMON(C) \ + do { \ + MARK_TS_DECL_WITH_VIS (C); \ + tree_contains_struct[C][TS_DECL_NON_COMMON] = 1; \ + } while (0) + + +/* Returns the string representing CLASS. */ + +#define TREE_CODE_CLASS_STRING(CLASS)\ + tree_code_class_strings[(int) (CLASS)] + +#define TREE_CODE_CLASS(CODE) tree_code_type[(int) (CODE)] + +/* Nonzero if NODE represents an exceptional code. */ + +#define EXCEPTIONAL_CLASS_P(NODE)\ + (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_exceptional) + +/* Nonzero if NODE represents a constant. */ + +#define CONSTANT_CLASS_P(NODE)\ + (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_constant) + +/* Nonzero if NODE represents a type. */ + +#define TYPE_P(NODE)\ + (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_type) + +/* Nonzero if NODE represents a declaration. */ + +#define DECL_P(NODE)\ + (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_declaration) + +/* True if NODE designates a variable declaration. */ +#define VAR_P(NODE) \ + (TREE_CODE (NODE) == VAR_DECL) + +/* Nonzero if DECL represents a VAR_DECL or FUNCTION_DECL. */ + +#define VAR_OR_FUNCTION_DECL_P(DECL)\ + (TREE_CODE (DECL) == VAR_DECL || TREE_CODE (DECL) == FUNCTION_DECL) + +/* Nonzero if NODE represents a INDIRECT_REF. Keep these checks in + ascending code order. */ + +#define INDIRECT_REF_P(NODE)\ + (TREE_CODE (NODE) == INDIRECT_REF) + +/* Nonzero if NODE represents a reference. */ + +#define REFERENCE_CLASS_P(NODE)\ + (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_reference) + +/* Nonzero if NODE represents a comparison. */ + +#define COMPARISON_CLASS_P(NODE)\ + (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_comparison) + +/* Nonzero if NODE represents a unary arithmetic expression. */ + +#define UNARY_CLASS_P(NODE)\ + (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_unary) + +/* Nonzero if NODE represents a binary arithmetic expression. */ + +#define BINARY_CLASS_P(NODE)\ + (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_binary) + +/* Nonzero if NODE represents a statement expression. */ + +#define STATEMENT_CLASS_P(NODE)\ + (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_statement) + +/* Nonzero if NODE represents a function call-like expression with a + variable-length operand vector. */ + +#define VL_EXP_CLASS_P(NODE)\ + (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_vl_exp) + +/* Nonzero if NODE represents any other expression. */ + +#define EXPRESSION_CLASS_P(NODE)\ + (TREE_CODE_CLASS (TREE_CODE (NODE)) == tcc_expression) + +/* Returns nonzero iff NODE represents a type or declaration. */ + +#define IS_TYPE_OR_DECL_P(NODE)\ + (TYPE_P (NODE) || DECL_P (NODE)) + +/* Returns nonzero iff CLASS is the tree-code class of an + expression. */ + +#define IS_EXPR_CODE_CLASS(CLASS)\ + ((CLASS) >= tcc_reference && (CLASS) <= tcc_expression) + +/* Returns nonzero iff NODE is an expression of some kind. */ + +#define EXPR_P(NODE) IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (NODE))) + +#define TREE_CODE_LENGTH(CODE) tree_code_length[(int) (CODE)] + + +/* Helper macros for math builtins. */ + +#define CASE_FLT_FN(FN) case FN: case FN##F: case FN##L +#define CASE_FLT_FN_FLOATN_NX(FN) \ + case FN##F16: case FN##F32: case FN##F64: case FN##F128: \ + case FN##F32X: case FN##F64X: case FN##F128X +#define CASE_FLT_FN_REENT(FN) case FN##_R: case FN##F_R: case FN##L_R +#define CASE_INT_FN(FN) case FN: case FN##L: case FN##LL: case FN##IMAX + +#define NULL_TREE (tree) NULL + +/* Define accessors for the fields that all tree nodes have + (though some fields are not used for all kinds of nodes). */ + +/* The tree-code says what kind of node it is. + Codes are defined in tree.def. */ +#define TREE_CODE(NODE) ((enum tree_code) (NODE)->base.code) +#define TREE_SET_CODE(NODE, VALUE) ((NODE)->base.code = (VALUE)) + +/* When checking is enabled, errors will be generated if a tree node + is accessed incorrectly. The macros die with a fatal error. */ +#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007) + +#define TREE_CHECK(T, CODE) \ +(tree_check ((T), __FILE__, __LINE__, __FUNCTION__, (CODE))) + +#define TREE_NOT_CHECK(T, CODE) \ +(tree_not_check ((T), __FILE__, __LINE__, __FUNCTION__, (CODE))) + +#define TREE_CHECK2(T, CODE1, CODE2) \ +(tree_check2 ((T), __FILE__, __LINE__, __FUNCTION__, (CODE1), (CODE2))) + +#define TREE_NOT_CHECK2(T, CODE1, CODE2) \ +(tree_not_check2 ((T), __FILE__, __LINE__, __FUNCTION__, (CODE1), (CODE2))) + +#define TREE_CHECK3(T, CODE1, CODE2, CODE3) \ +(tree_check3 ((T), __FILE__, __LINE__, __FUNCTION__, (CODE1), (CODE2), (CODE3))) + +#define TREE_NOT_CHECK3(T, CODE1, CODE2, CODE3) \ +(tree_not_check3 ((T), __FILE__, __LINE__, __FUNCTION__, \ + (CODE1), (CODE2), (CODE3))) + +#define TREE_CHECK4(T, CODE1, CODE2, CODE3, CODE4) \ +(tree_check4 ((T), __FILE__, __LINE__, __FUNCTION__, \ + (CODE1), (CODE2), (CODE3), (CODE4))) + +#define TREE_NOT_CHECK4(T, CODE1, CODE2, CODE3, CODE4) \ +(tree_not_check4 ((T), __FILE__, __LINE__, __FUNCTION__, \ + (CODE1), (CODE2), (CODE3), (CODE4))) + +#define TREE_CHECK5(T, CODE1, CODE2, CODE3, CODE4, CODE5) \ +(tree_check5 ((T), __FILE__, __LINE__, __FUNCTION__, \ + (CODE1), (CODE2), (CODE3), (CODE4), (CODE5))) + +#define TREE_NOT_CHECK5(T, CODE1, CODE2, CODE3, CODE4, CODE5) \ +(tree_not_check5 ((T), __FILE__, __LINE__, __FUNCTION__, \ + (CODE1), (CODE2), (CODE3), (CODE4), (CODE5))) + +#define CONTAINS_STRUCT_CHECK(T, STRUCT) \ +(contains_struct_check ((T), (STRUCT), __FILE__, __LINE__, __FUNCTION__)) + +#define TREE_CLASS_CHECK(T, CLASS) \ +(tree_class_check ((T), (CLASS), __FILE__, __LINE__, __FUNCTION__)) + +#define TREE_RANGE_CHECK(T, CODE1, CODE2) \ +(tree_range_check ((T), (CODE1), (CODE2), __FILE__, __LINE__, __FUNCTION__)) + +#define OMP_CLAUSE_SUBCODE_CHECK(T, CODE) \ +(omp_clause_subcode_check ((T), (CODE), __FILE__, __LINE__, __FUNCTION__)) + +#define OMP_CLAUSE_RANGE_CHECK(T, CODE1, CODE2) \ +(omp_clause_range_check ((T), (CODE1), (CODE2), \ + __FILE__, __LINE__, __FUNCTION__)) + +/* These checks have to be special cased. */ +#define EXPR_CHECK(T) \ +(expr_check ((T), __FILE__, __LINE__, __FUNCTION__)) + +/* These checks have to be special cased. */ +#define NON_TYPE_CHECK(T) \ +(non_type_check ((T), __FILE__, __LINE__, __FUNCTION__)) + +/* These checks have to be special cased. */ +#define ANY_INTEGRAL_TYPE_CHECK(T) \ +(any_integral_type_check ((T), __FILE__, __LINE__, __FUNCTION__)) + +#define TREE_INT_CST_ELT_CHECK(T, I) \ +(*tree_int_cst_elt_check ((T), (I), __FILE__, __LINE__, __FUNCTION__)) + +#define TREE_VEC_ELT_CHECK(T, I) \ +(*(CONST_CAST2 (tree *, typeof (T)*, \ + tree_vec_elt_check ((T), (I), __FILE__, __LINE__, __FUNCTION__)))) + +#define OMP_CLAUSE_ELT_CHECK(T, I) \ +(*(omp_clause_elt_check ((T), (I), __FILE__, __LINE__, __FUNCTION__))) + +/* Special checks for TREE_OPERANDs. */ +#define TREE_OPERAND_CHECK(T, I) \ +(*(CONST_CAST2 (tree*, typeof (T)*, \ + tree_operand_check ((T), (I), __FILE__, __LINE__, __FUNCTION__)))) + +#define TREE_OPERAND_CHECK_CODE(T, CODE, I) \ +(*(tree_operand_check_code ((T), (CODE), (I), \ + __FILE__, __LINE__, __FUNCTION__))) + +/* Nodes are chained together for many purposes. + Types are chained together to record them for being output to the debugger + (see the function `chain_type'). + Decls in the same scope are chained together to record the contents + of the scope. + Statement nodes for successive statements used to be chained together. + Often lists of things are represented by TREE_LIST nodes that + are chained together. */ + +#define TREE_CHAIN(NODE) \ +(CONTAINS_STRUCT_CHECK (NODE, TS_COMMON)->common.chain) + +/* In all nodes that are expressions, this is the data type of the expression. + In POINTER_TYPE nodes, this is the type that the pointer points to. + In ARRAY_TYPE nodes, this is the type of the elements. + In VECTOR_TYPE nodes, this is the type of the elements. */ +#define TREE_TYPE(NODE) \ +(CONTAINS_STRUCT_CHECK (NODE, TS_TYPED)->typed.type) + +extern void tree_contains_struct_check_failed (const_tree, + const enum tree_node_structure_enum, + const char *, int, const char *) + ATTRIBUTE_NORETURN; + +extern void tree_check_failed (const_tree, const char *, int, const char *, + ...) ATTRIBUTE_NORETURN; +extern void tree_not_check_failed (const_tree, const char *, int, const char *, + ...) ATTRIBUTE_NORETURN; +extern void tree_class_check_failed (const_tree, const enum tree_code_class, + const char *, int, const char *) + ATTRIBUTE_NORETURN; +extern void tree_range_check_failed (const_tree, const char *, int, + const char *, enum tree_code, + enum tree_code) + ATTRIBUTE_NORETURN; +extern void tree_not_class_check_failed (const_tree, + const enum tree_code_class, + const char *, int, const char *) + ATTRIBUTE_NORETURN; +extern void tree_int_cst_elt_check_failed (int, int, const char *, + int, const char *) + ATTRIBUTE_NORETURN; +extern void tree_vec_elt_check_failed (int, int, const char *, + int, const char *) + ATTRIBUTE_NORETURN; +extern void phi_node_elt_check_failed (int, int, const char *, + int, const char *) + ATTRIBUTE_NORETURN; +extern void tree_operand_check_failed (int, const_tree, + const char *, int, const char *) + ATTRIBUTE_NORETURN; +extern void omp_clause_check_failed (const_tree, const char *, int, + const char *, enum omp_clause_code) + ATTRIBUTE_NORETURN; +extern void omp_clause_operand_check_failed (int, const_tree, const char *, + int, const char *) + ATTRIBUTE_NORETURN; +extern void omp_clause_range_check_failed (const_tree, const char *, int, + const char *, enum omp_clause_code, + enum omp_clause_code) + ATTRIBUTE_NORETURN; + +#else /* not ENABLE_TREE_CHECKING, or not gcc */ + +#define CONTAINS_STRUCT_CHECK(T, ENUM) (T) +#define TREE_CHECK(T, CODE) (T) +#define TREE_NOT_CHECK(T, CODE) (T) +#define TREE_CHECK2(T, CODE1, CODE2) (T) +#define TREE_NOT_CHECK2(T, CODE1, CODE2) (T) +#define TREE_CHECK3(T, CODE1, CODE2, CODE3) (T) +#define TREE_NOT_CHECK3(T, CODE1, CODE2, CODE3) (T) +#define TREE_CHECK4(T, CODE1, CODE2, CODE3, CODE4) (T) +#define TREE_NOT_CHECK4(T, CODE1, CODE2, CODE3, CODE4) (T) +#define TREE_CHECK5(T, CODE1, CODE2, CODE3, CODE4, CODE5) (T) +#define TREE_NOT_CHECK5(T, CODE1, CODE2, CODE3, CODE4, CODE5) (T) +#define TREE_CLASS_CHECK(T, CODE) (T) +#define TREE_RANGE_CHECK(T, CODE1, CODE2) (T) +#define EXPR_CHECK(T) (T) +#define NON_TYPE_CHECK(T) (T) +#define TREE_INT_CST_ELT_CHECK(T, I) ((T)->int_cst.val[I]) +#define TREE_VEC_ELT_CHECK(T, I) ((T)->vec.a[I]) +#define TREE_OPERAND_CHECK(T, I) ((T)->exp.operands[I]) +#define TREE_OPERAND_CHECK_CODE(T, CODE, I) ((T)->exp.operands[I]) +#define OMP_CLAUSE_ELT_CHECK(T, i) ((T)->omp_clause.ops[i]) +#define OMP_CLAUSE_RANGE_CHECK(T, CODE1, CODE2) (T) +#define OMP_CLAUSE_SUBCODE_CHECK(T, CODE) (T) +#define ANY_INTEGRAL_TYPE_CHECK(T) (T) + +#define TREE_CHAIN(NODE) ((NODE)->common.chain) +#define TREE_TYPE(NODE) ((NODE)->typed.type) + +#endif + +#define TREE_BLOCK(NODE) (tree_block (NODE)) +#define TREE_SET_BLOCK(T, B) (tree_set_block ((T), (B))) + +#include "tree-check.h" + +#define TYPE_CHECK(T) TREE_CLASS_CHECK (T, tcc_type) +#define DECL_MINIMAL_CHECK(T) CONTAINS_STRUCT_CHECK (T, TS_DECL_MINIMAL) +#define DECL_COMMON_CHECK(T) CONTAINS_STRUCT_CHECK (T, TS_DECL_COMMON) +#define DECL_WRTL_CHECK(T) CONTAINS_STRUCT_CHECK (T, TS_DECL_WRTL) +#define DECL_WITH_VIS_CHECK(T) CONTAINS_STRUCT_CHECK (T, TS_DECL_WITH_VIS) +#define DECL_NON_COMMON_CHECK(T) CONTAINS_STRUCT_CHECK (T, TS_DECL_NON_COMMON) +#define CST_CHECK(T) TREE_CLASS_CHECK (T, tcc_constant) +#define STMT_CHECK(T) TREE_CLASS_CHECK (T, tcc_statement) +#define VL_EXP_CHECK(T) TREE_CLASS_CHECK (T, tcc_vl_exp) +#define FUNC_OR_METHOD_CHECK(T) TREE_CHECK2 (T, FUNCTION_TYPE, METHOD_TYPE) +#define PTR_OR_REF_CHECK(T) TREE_CHECK2 (T, POINTER_TYPE, REFERENCE_TYPE) + +#define RECORD_OR_UNION_CHECK(T) \ + TREE_CHECK3 (T, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE) +#define NOT_RECORD_OR_UNION_CHECK(T) \ + TREE_NOT_CHECK3 (T, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE) + +#define NUMERICAL_TYPE_CHECK(T) \ + TREE_CHECK5 (T, INTEGER_TYPE, ENUMERAL_TYPE, BOOLEAN_TYPE, REAL_TYPE, \ + FIXED_POINT_TYPE) + +/* Here is how primitive or already-canonicalized types' hash codes + are made. */ +#define TYPE_HASH(TYPE) (TYPE_UID (TYPE)) + +/* A simple hash function for an arbitrary tree node. This must not be + used in hash tables which are saved to a PCH. */ +#define TREE_HASH(NODE) ((size_t) (NODE) & 0777777) + +/* Tests if CODE is a conversion expr (NOP_EXPR or CONVERT_EXPR). */ +#define CONVERT_EXPR_CODE_P(CODE) \ + ((CODE) == NOP_EXPR || (CODE) == CONVERT_EXPR) + +/* Similarly, but accept an expression instead of a tree code. */ +#define CONVERT_EXPR_P(EXP) CONVERT_EXPR_CODE_P (TREE_CODE (EXP)) + +/* Generate case for NOP_EXPR, CONVERT_EXPR. */ + +#define CASE_CONVERT \ + case NOP_EXPR: \ + case CONVERT_EXPR + +/* Given an expression as a tree, strip any conversion that generates + no instruction. Accepts both tree and const_tree arguments since + we are not modifying the tree itself. */ + +#define STRIP_NOPS(EXP) \ + (EXP) = tree_strip_nop_conversions (CONST_CAST_TREE (EXP)) + +/* Like STRIP_NOPS, but don't let the signedness change either. */ + +#define STRIP_SIGN_NOPS(EXP) \ + (EXP) = tree_strip_sign_nop_conversions (CONST_CAST_TREE (EXP)) + +/* Like STRIP_NOPS, but don't alter the TREE_TYPE either. */ + +#define STRIP_TYPE_NOPS(EXP) \ + while ((CONVERT_EXPR_P (EXP) \ + || TREE_CODE (EXP) == NON_LVALUE_EXPR) \ + && TREE_OPERAND (EXP, 0) != error_mark_node \ + && (TREE_TYPE (EXP) \ + == TREE_TYPE (TREE_OPERAND (EXP, 0)))) \ + (EXP) = TREE_OPERAND (EXP, 0) + +/* Remove unnecessary type conversions according to + tree_ssa_useless_type_conversion. */ + +#define STRIP_USELESS_TYPE_CONVERSION(EXP) \ + (EXP) = tree_ssa_strip_useless_type_conversions (EXP) + +/* Nonzero if TYPE represents a vector type. */ + +#define VECTOR_TYPE_P(TYPE) (TREE_CODE (TYPE) == VECTOR_TYPE) + +/* Nonzero if TYPE represents a vector of booleans. */ + +#define VECTOR_BOOLEAN_TYPE_P(TYPE) \ + (TREE_CODE (TYPE) == VECTOR_TYPE \ + && TREE_CODE (TREE_TYPE (TYPE)) == BOOLEAN_TYPE) + +/* Nonzero if TYPE represents an integral type. Note that we do not + include COMPLEX types here. Keep these checks in ascending code + order. */ + +#define INTEGRAL_TYPE_P(TYPE) \ + (TREE_CODE (TYPE) == ENUMERAL_TYPE \ + || TREE_CODE (TYPE) == BOOLEAN_TYPE \ + || TREE_CODE (TYPE) == INTEGER_TYPE) + +/* Nonzero if TYPE represents an integral type, including complex + and vector integer types. */ + +#define ANY_INTEGRAL_TYPE_P(TYPE) \ + (INTEGRAL_TYPE_P (TYPE) \ + || ((TREE_CODE (TYPE) == COMPLEX_TYPE \ + || VECTOR_TYPE_P (TYPE)) \ + && INTEGRAL_TYPE_P (TREE_TYPE (TYPE)))) + +/* Nonzero if TYPE represents a non-saturating fixed-point type. */ + +#define NON_SAT_FIXED_POINT_TYPE_P(TYPE) \ + (TREE_CODE (TYPE) == FIXED_POINT_TYPE && !TYPE_SATURATING (TYPE)) + +/* Nonzero if TYPE represents a saturating fixed-point type. */ + +#define SAT_FIXED_POINT_TYPE_P(TYPE) \ + (TREE_CODE (TYPE) == FIXED_POINT_TYPE && TYPE_SATURATING (TYPE)) + +/* Nonzero if TYPE represents a fixed-point type. */ + +#define FIXED_POINT_TYPE_P(TYPE) (TREE_CODE (TYPE) == FIXED_POINT_TYPE) + +/* Nonzero if TYPE represents a scalar floating-point type. */ + +#define SCALAR_FLOAT_TYPE_P(TYPE) (TREE_CODE (TYPE) == REAL_TYPE) + +/* Nonzero if TYPE represents a complex floating-point type. */ + +#define COMPLEX_FLOAT_TYPE_P(TYPE) \ + (TREE_CODE (TYPE) == COMPLEX_TYPE \ + && TREE_CODE (TREE_TYPE (TYPE)) == REAL_TYPE) + +/* Nonzero if TYPE represents a vector integer type. */ + +#define VECTOR_INTEGER_TYPE_P(TYPE) \ + (VECTOR_TYPE_P (TYPE) \ + && TREE_CODE (TREE_TYPE (TYPE)) == INTEGER_TYPE) + + +/* Nonzero if TYPE represents a vector floating-point type. */ + +#define VECTOR_FLOAT_TYPE_P(TYPE) \ + (VECTOR_TYPE_P (TYPE) \ + && TREE_CODE (TREE_TYPE (TYPE)) == REAL_TYPE) + +/* Nonzero if TYPE represents a floating-point type, including complex + and vector floating-point types. The vector and complex check does + not use the previous two macros to enable early folding. */ + +#define FLOAT_TYPE_P(TYPE) \ + (SCALAR_FLOAT_TYPE_P (TYPE) \ + || ((TREE_CODE (TYPE) == COMPLEX_TYPE \ + || VECTOR_TYPE_P (TYPE)) \ + && SCALAR_FLOAT_TYPE_P (TREE_TYPE (TYPE)))) + +/* Nonzero if TYPE represents a decimal floating-point type. */ +#define DECIMAL_FLOAT_TYPE_P(TYPE) \ + (SCALAR_FLOAT_TYPE_P (TYPE) \ + && DECIMAL_FLOAT_MODE_P (TYPE_MODE (TYPE))) + +/* Nonzero if TYPE is a record or union type. */ +#define RECORD_OR_UNION_TYPE_P(TYPE) \ + (TREE_CODE (TYPE) == RECORD_TYPE \ + || TREE_CODE (TYPE) == UNION_TYPE \ + || TREE_CODE (TYPE) == QUAL_UNION_TYPE) + +/* Nonzero if TYPE represents an aggregate (multi-component) type. + Keep these checks in ascending code order. */ + +#define AGGREGATE_TYPE_P(TYPE) \ + (TREE_CODE (TYPE) == ARRAY_TYPE || RECORD_OR_UNION_TYPE_P (TYPE)) + +/* Nonzero if TYPE represents a pointer or reference type. + (It should be renamed to INDIRECT_TYPE_P.) Keep these checks in + ascending code order. */ + +#define POINTER_TYPE_P(TYPE) \ + (TREE_CODE (TYPE) == POINTER_TYPE || TREE_CODE (TYPE) == REFERENCE_TYPE) + +/* Nonzero if TYPE represents a pointer to function. */ +#define FUNCTION_POINTER_TYPE_P(TYPE) \ + (POINTER_TYPE_P (TYPE) && TREE_CODE (TREE_TYPE (TYPE)) == FUNCTION_TYPE) + +/* Nonzero if this type is a complete type. */ +#define COMPLETE_TYPE_P(NODE) (TYPE_SIZE (NODE) != NULL_TREE) + +/* Nonzero if this type is a pointer bounds type. */ +#define POINTER_BOUNDS_TYPE_P(NODE) \ + (TREE_CODE (NODE) == POINTER_BOUNDS_TYPE) + +/* Nonzero if this node has a pointer bounds type. */ +#define POINTER_BOUNDS_P(NODE) \ + (POINTER_BOUNDS_TYPE_P (TREE_TYPE (NODE))) + +/* Nonzero if this type supposes bounds existence. */ +#define BOUNDED_TYPE_P(type) (POINTER_TYPE_P (type)) + +/* Nonzero for objects with bounded type. */ +#define BOUNDED_P(node) \ + BOUNDED_TYPE_P (TREE_TYPE (node)) + +/* Nonzero if this type is the (possibly qualified) void type. */ +#define VOID_TYPE_P(NODE) (TREE_CODE (NODE) == VOID_TYPE) + +/* Nonzero if this type is complete or is cv void. */ +#define COMPLETE_OR_VOID_TYPE_P(NODE) \ + (COMPLETE_TYPE_P (NODE) || VOID_TYPE_P (NODE)) + +/* Nonzero if this type is complete or is an array with unspecified bound. */ +#define COMPLETE_OR_UNBOUND_ARRAY_TYPE_P(NODE) \ + (COMPLETE_TYPE_P (TREE_CODE (NODE) == ARRAY_TYPE ? TREE_TYPE (NODE) : (NODE))) + +#define FUNC_OR_METHOD_TYPE_P(NODE) \ + (TREE_CODE (NODE) == FUNCTION_TYPE || TREE_CODE (NODE) == METHOD_TYPE) + +/* Define many boolean fields that all tree nodes have. */ + +/* In VAR_DECL, PARM_DECL and RESULT_DECL nodes, nonzero means address + of this is needed. So it cannot be in a register. + In a FUNCTION_DECL it has no meaning. + In LABEL_DECL nodes, it means a goto for this label has been seen + from a place outside all binding contours that restore stack levels. + In an artificial SSA_NAME that points to a stack partition with at least + two variables, it means that at least one variable has TREE_ADDRESSABLE. + In ..._TYPE nodes, it means that objects of this type must be fully + addressable. This means that pieces of this object cannot go into + register parameters, for example. If this a function type, this + means that the value must be returned in memory. + In CONSTRUCTOR nodes, it means object constructed must be in memory. + In IDENTIFIER_NODEs, this means that some extern decl for this name + had its address taken. That matters for inline functions. + In a STMT_EXPR, it means we want the result of the enclosed expression. */ +#define TREE_ADDRESSABLE(NODE) ((NODE)->base.addressable_flag) + +/* Set on a CALL_EXPR if the call is in a tail position, ie. just before the + exit of a function. Calls for which this is true are candidates for tail + call optimizations. */ +#define CALL_EXPR_TAILCALL(NODE) \ + (CALL_EXPR_CHECK (NODE)->base.addressable_flag) + +/* Set on a CALL_EXPR if the call has been marked as requiring tail call + optimization for correctness. */ +#define CALL_EXPR_MUST_TAIL_CALL(NODE) \ + (CALL_EXPR_CHECK (NODE)->base.static_flag) + +/* Used as a temporary field on a CASE_LABEL_EXPR to indicate that the + CASE_LOW operand has been processed. */ +#define CASE_LOW_SEEN(NODE) \ + (CASE_LABEL_EXPR_CHECK (NODE)->base.addressable_flag) + +#define PREDICT_EXPR_OUTCOME(NODE) \ + ((enum prediction) (PREDICT_EXPR_CHECK (NODE)->base.addressable_flag)) +#define SET_PREDICT_EXPR_OUTCOME(NODE, OUTCOME) \ + (PREDICT_EXPR_CHECK (NODE)->base.addressable_flag = (int) OUTCOME) +#define PREDICT_EXPR_PREDICTOR(NODE) \ + ((enum br_predictor)tree_to_shwi (TREE_OPERAND (PREDICT_EXPR_CHECK (NODE), 0))) + +/* In a VAR_DECL, nonzero means allocate static storage. + In a FUNCTION_DECL, nonzero if function has been defined. + In a CONSTRUCTOR, nonzero means allocate static storage. */ +#define TREE_STATIC(NODE) ((NODE)->base.static_flag) + +/* In an ADDR_EXPR, nonzero means do not use a trampoline. */ +#define TREE_NO_TRAMPOLINE(NODE) (ADDR_EXPR_CHECK (NODE)->base.static_flag) + +/* In a TARGET_EXPR or WITH_CLEANUP_EXPR, means that the pertinent cleanup + should only be executed if an exception is thrown, not on normal exit + of its scope. */ +#define CLEANUP_EH_ONLY(NODE) ((NODE)->base.static_flag) + +/* In a TRY_CATCH_EXPR, means that the handler should be considered a + separate cleanup in honor_protect_cleanup_actions. */ +#define TRY_CATCH_IS_CLEANUP(NODE) \ + (TRY_CATCH_EXPR_CHECK (NODE)->base.static_flag) + +/* Used as a temporary field on a CASE_LABEL_EXPR to indicate that the + CASE_HIGH operand has been processed. */ +#define CASE_HIGH_SEEN(NODE) \ + (CASE_LABEL_EXPR_CHECK (NODE)->base.static_flag) + +/* Used to mark scoped enums. */ +#define ENUM_IS_SCOPED(NODE) (ENUMERAL_TYPE_CHECK (NODE)->base.static_flag) + +/* Determines whether an ENUMERAL_TYPE has defined the list of constants. */ +#define ENUM_IS_OPAQUE(NODE) (ENUMERAL_TYPE_CHECK (NODE)->base.private_flag) + +/* In an expr node (usually a conversion) this means the node was made + implicitly and should not lead to any sort of warning. In a decl node, + warnings concerning the decl should be suppressed. This is used at + least for used-before-set warnings, and it set after one warning is + emitted. */ +#define TREE_NO_WARNING(NODE) ((NODE)->base.nowarning_flag) + +/* Used to indicate that this TYPE represents a compiler-generated entity. */ +#define TYPE_ARTIFICIAL(NODE) (TYPE_CHECK (NODE)->base.nowarning_flag) + +/* In an IDENTIFIER_NODE, this means that assemble_name was called with + this string as an argument. */ +#define TREE_SYMBOL_REFERENCED(NODE) \ + (IDENTIFIER_NODE_CHECK (NODE)->base.static_flag) + +/* Nonzero in a pointer or reference type means the data pointed to + by this type can alias anything. */ +#define TYPE_REF_CAN_ALIAS_ALL(NODE) \ + (PTR_OR_REF_CHECK (NODE)->base.static_flag) + +/* In an INTEGER_CST, REAL_CST, COMPLEX_CST, or VECTOR_CST, this means + there was an overflow in folding. */ + +#define TREE_OVERFLOW(NODE) (CST_CHECK (NODE)->base.public_flag) + +/* TREE_OVERFLOW can only be true for EXPR of CONSTANT_CLASS_P. */ + +#define TREE_OVERFLOW_P(EXPR) \ + (CONSTANT_CLASS_P (EXPR) && TREE_OVERFLOW (EXPR)) + +/* In a VAR_DECL, FUNCTION_DECL, NAMESPACE_DECL or TYPE_DECL, + nonzero means name is to be accessible from outside this translation unit. + In an IDENTIFIER_NODE, nonzero means an external declaration + accessible from outside this translation unit was previously seen + for this name in an inner scope. */ +#define TREE_PUBLIC(NODE) ((NODE)->base.public_flag) + +/* In a _TYPE, indicates whether TYPE_CACHED_VALUES contains a vector + of cached values, or is something else. */ +#define TYPE_CACHED_VALUES_P(NODE) (TYPE_CHECK (NODE)->base.public_flag) + +/* In a SAVE_EXPR, indicates that the original expression has already + been substituted with a VAR_DECL that contains the value. */ +#define SAVE_EXPR_RESOLVED_P(NODE) \ + (SAVE_EXPR_CHECK (NODE)->base.public_flag) + +/* Set on a CALL_EXPR if this stdarg call should be passed the argument + pack. */ +#define CALL_EXPR_VA_ARG_PACK(NODE) \ + (CALL_EXPR_CHECK (NODE)->base.public_flag) + +/* In any expression, decl, or constant, nonzero means it has side effects or + reevaluation of the whole expression could produce a different value. + This is set if any subexpression is a function call, a side effect or a + reference to a volatile variable. In a ..._DECL, this is set only if the + declaration said `volatile'. This will never be set for a constant. */ +#define TREE_SIDE_EFFECTS(NODE) \ + (NON_TYPE_CHECK (NODE)->base.side_effects_flag) + +/* In a LABEL_DECL, nonzero means this label had its address taken + and therefore can never be deleted and is a jump target for + computed gotos. */ +#define FORCED_LABEL(NODE) (LABEL_DECL_CHECK (NODE)->base.side_effects_flag) + +/* Whether a case or a user-defined label is allowed to fall through to. + This is used to implement -Wimplicit-fallthrough. */ +#define FALLTHROUGH_LABEL_P(NODE) \ + (LABEL_DECL_CHECK (NODE)->base.private_flag) + +/* Nonzero means this expression is volatile in the C sense: + its address should be of type `volatile WHATEVER *'. + In other words, the declared item is volatile qualified. + This is used in _DECL nodes and _REF nodes. + On a FUNCTION_DECL node, this means the function does not + return normally. This is the same effect as setting + the attribute noreturn on the function in C. + + In a ..._TYPE node, means this type is volatile-qualified. + But use TYPE_VOLATILE instead of this macro when the node is a type, + because eventually we may make that a different bit. + + If this bit is set in an expression, so is TREE_SIDE_EFFECTS. */ +#define TREE_THIS_VOLATILE(NODE) ((NODE)->base.volatile_flag) + +/* Nonzero means this node will not trap. In an INDIRECT_REF, means + accessing the memory pointed to won't generate a trap. However, + this only applies to an object when used appropriately: it doesn't + mean that writing a READONLY mem won't trap. + + In ARRAY_REF and ARRAY_RANGE_REF means that we know that the index + (or slice of the array) always belongs to the range of the array. + I.e. that the access will not trap, provided that the access to + the base to the array will not trap. */ +#define TREE_THIS_NOTRAP(NODE) \ + (TREE_CHECK5 (NODE, INDIRECT_REF, MEM_REF, TARGET_MEM_REF, ARRAY_REF, \ + ARRAY_RANGE_REF)->base.nothrow_flag) + +/* In a VAR_DECL, PARM_DECL or FIELD_DECL, or any kind of ..._REF node, + nonzero means it may not be the lhs of an assignment. + Nonzero in a FUNCTION_DECL means this function should be treated + as "const" function (can only read its arguments). */ +#define TREE_READONLY(NODE) (NON_TYPE_CHECK (NODE)->base.readonly_flag) + +/* Value of expression is constant. Always on in all ..._CST nodes. May + also appear in an expression or decl where the value is constant. */ +#define TREE_CONSTANT(NODE) (NON_TYPE_CHECK (NODE)->base.constant_flag) + +/* Nonzero if NODE, a type, has had its sizes gimplified. */ +#define TYPE_SIZES_GIMPLIFIED(NODE) \ + (TYPE_CHECK (NODE)->base.constant_flag) + +/* In a decl (most significantly a FIELD_DECL), means an unsigned field. */ +#define DECL_UNSIGNED(NODE) \ + (DECL_COMMON_CHECK (NODE)->base.u.bits.unsigned_flag) + +/* In integral and pointer types, means an unsigned type. */ +#define TYPE_UNSIGNED(NODE) (TYPE_CHECK (NODE)->base.u.bits.unsigned_flag) + +/* Same as TYPE_UNSIGNED but converted to SIGNOP. */ +#define TYPE_SIGN(NODE) ((signop) TYPE_UNSIGNED (NODE)) + +/* True if overflow wraps around for the given integral type. That + is, TYPE_MAX + 1 == TYPE_MIN. */ +#define TYPE_OVERFLOW_WRAPS(TYPE) \ + (ANY_INTEGRAL_TYPE_CHECK(TYPE)->base.u.bits.unsigned_flag || flag_wrapv) + +/* True if overflow is undefined for the given integral type. We may + optimize on the assumption that values in the type never overflow. + + IMPORTANT NOTE: Any optimization based on TYPE_OVERFLOW_UNDEFINED + must issue a warning based on warn_strict_overflow. In some cases + it will be appropriate to issue the warning immediately, and in + other cases it will be appropriate to simply set a flag and let the + caller decide whether a warning is appropriate or not. */ +#define TYPE_OVERFLOW_UNDEFINED(TYPE) \ + (!ANY_INTEGRAL_TYPE_CHECK(TYPE)->base.u.bits.unsigned_flag \ + && !flag_wrapv && !flag_trapv && flag_strict_overflow) + +/* True if overflow for the given integral type should issue a + trap. */ +#define TYPE_OVERFLOW_TRAPS(TYPE) \ + (!ANY_INTEGRAL_TYPE_CHECK(TYPE)->base.u.bits.unsigned_flag && flag_trapv) + +/* True if an overflow is to be preserved for sanitization. */ +#define TYPE_OVERFLOW_SANITIZED(TYPE) \ + (INTEGRAL_TYPE_P (TYPE) \ + && !TYPE_OVERFLOW_WRAPS (TYPE) \ + && (flag_sanitize & SANITIZE_SI_OVERFLOW)) + +/* True if pointer types have undefined overflow. */ +#define POINTER_TYPE_OVERFLOW_UNDEFINED (flag_strict_overflow) + +/* Nonzero in a VAR_DECL or STRING_CST means assembler code has been written. + Nonzero in a FUNCTION_DECL means that the function has been compiled. + This is interesting in an inline function, since it might not need + to be compiled separately. + Nonzero in a RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE, ENUMERAL_TYPE + or TYPE_DECL if the debugging info for the type has been written. + In a BLOCK node, nonzero if reorder_blocks has already seen this block. + In an SSA_NAME node, nonzero if the SSA_NAME occurs in an abnormal + PHI node. */ +#define TREE_ASM_WRITTEN(NODE) ((NODE)->base.asm_written_flag) + +/* Nonzero in a _DECL if the name is used in its scope. + Nonzero in an expr node means inhibit warning if value is unused. + In IDENTIFIER_NODEs, this means that some extern decl for this name + was used. + In a BLOCK, this means that the block contains variables that are used. */ +#define TREE_USED(NODE) ((NODE)->base.used_flag) + +/* In a FUNCTION_DECL, nonzero means a call to the function cannot + throw an exception. In a CALL_EXPR, nonzero means the call cannot + throw. We can't easily check the node type here as the C++ + frontend also uses this flag (for AGGR_INIT_EXPR). */ +#define TREE_NOTHROW(NODE) ((NODE)->base.nothrow_flag) + +/* In a CALL_EXPR, means that it's safe to use the target of the call + expansion as the return slot for a call that returns in memory. */ +#define CALL_EXPR_RETURN_SLOT_OPT(NODE) \ + (CALL_EXPR_CHECK (NODE)->base.private_flag) + +/* Cilk keywords accessors. */ +#define CILK_SPAWN_FN(NODE) TREE_OPERAND (CILK_SPAWN_STMT_CHECK (NODE), 0) + +/* In a RESULT_DECL, PARM_DECL and VAR_DECL, means that it is + passed by invisible reference (and the TREE_TYPE is a pointer to the true + type). */ +#define DECL_BY_REFERENCE(NODE) \ + (TREE_CHECK3 (NODE, VAR_DECL, PARM_DECL, \ + RESULT_DECL)->decl_common.decl_by_reference_flag) + +/* In VAR_DECL and PARM_DECL, set when the decl has been used except for + being set. */ +#define DECL_READ_P(NODE) \ + (TREE_CHECK2 (NODE, VAR_DECL, PARM_DECL)->decl_common.decl_read_flag) + +/* In VAR_DECL or RESULT_DECL, set when significant code movement precludes + attempting to share the stack slot with some other variable. */ +#define DECL_NONSHAREABLE(NODE) \ + (TREE_CHECK2 (NODE, VAR_DECL, \ + RESULT_DECL)->decl_common.decl_nonshareable_flag) + +/* In a CALL_EXPR, means that the call is the jump from a thunk to the + thunked-to function. */ +#define CALL_FROM_THUNK_P(NODE) (CALL_EXPR_CHECK (NODE)->base.protected_flag) + +/* In a CALL_EXPR, if the function being called is BUILT_IN_ALLOCA, means that + it has been built for the declaration of a variable-sized object. */ +#define CALL_ALLOCA_FOR_VAR_P(NODE) \ + (CALL_EXPR_CHECK (NODE)->base.protected_flag) + +/* In a CALL_EXPR, means call was instrumented by Pointer Bounds Checker. */ +#define CALL_WITH_BOUNDS_P(NODE) (CALL_EXPR_CHECK (NODE)->base.deprecated_flag) + +/* Used in classes in C++. */ +#define TREE_PRIVATE(NODE) ((NODE)->base.private_flag) +/* Used in classes in C++. */ +#define TREE_PROTECTED(NODE) ((NODE)->base.protected_flag) + +/* True if reference type NODE is a C++ rvalue reference. */ +#define TYPE_REF_IS_RVALUE(NODE) \ + (REFERENCE_TYPE_CHECK (NODE)->base.private_flag) + +/* Nonzero in a _DECL if the use of the name is defined as a + deprecated feature by __attribute__((deprecated)). */ +#define TREE_DEPRECATED(NODE) \ + ((NODE)->base.deprecated_flag) + +/* Nonzero in an IDENTIFIER_NODE if the name is a local alias, whose + uses are to be substituted for uses of the TREE_CHAINed identifier. */ +#define IDENTIFIER_TRANSPARENT_ALIAS(NODE) \ + (IDENTIFIER_NODE_CHECK (NODE)->base.deprecated_flag) + +/* In an aggregate type, indicates that the scalar fields of the type are + stored in reverse order from the target order. This effectively + toggles BYTES_BIG_ENDIAN and WORDS_BIG_ENDIAN within the type. */ +#define TYPE_REVERSE_STORAGE_ORDER(NODE) \ + (TREE_CHECK4 (NODE, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE, ARRAY_TYPE)->base.u.bits.saturating_flag) + +/* In a non-aggregate type, indicates a saturating type. */ +#define TYPE_SATURATING(NODE) \ + (TREE_NOT_CHECK4 (NODE, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE, ARRAY_TYPE)->base.u.bits.saturating_flag) + +/* In a BIT_FIELD_REF and MEM_REF, indicates that the reference is to a group + of bits stored in reverse order from the target order. This effectively + toggles both BYTES_BIG_ENDIAN and WORDS_BIG_ENDIAN for the reference. + + The overall strategy is to preserve the invariant that every scalar in + memory is associated with a single storage order, i.e. all accesses to + this scalar are done with the same storage order. This invariant makes + it possible to factor out the storage order in most transformations, as + only the address and/or the value (in target order) matter for them. + But, of course, the storage order must be preserved when the accesses + themselves are rewritten or transformed. */ +#define REF_REVERSE_STORAGE_ORDER(NODE) \ + (TREE_CHECK2 (NODE, BIT_FIELD_REF, MEM_REF)->base.default_def_flag) + + /* In an ADDR_EXPR, indicates that this is a pointer to nested function + represented by a descriptor instead of a trampoline. */ +#define FUNC_ADDR_BY_DESCRIPTOR(NODE) \ + (TREE_CHECK (NODE, ADDR_EXPR)->base.default_def_flag) + +/* In a CALL_EXPR, indicates that this is an indirect call for which + pointers to nested function are descriptors instead of trampolines. */ +#define CALL_EXPR_BY_DESCRIPTOR(NODE) \ + (TREE_CHECK (NODE, CALL_EXPR)->base.default_def_flag) + +/* These flags are available for each language front end to use internally. */ +#define TREE_LANG_FLAG_0(NODE) \ + (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_0) +#define TREE_LANG_FLAG_1(NODE) \ + (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_1) +#define TREE_LANG_FLAG_2(NODE) \ + (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_2) +#define TREE_LANG_FLAG_3(NODE) \ + (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_3) +#define TREE_LANG_FLAG_4(NODE) \ + (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_4) +#define TREE_LANG_FLAG_5(NODE) \ + (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_5) +#define TREE_LANG_FLAG_6(NODE) \ + (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_6) + +/* Define additional fields and accessors for nodes representing constants. */ + +#define TREE_INT_CST_NUNITS(NODE) \ + (INTEGER_CST_CHECK (NODE)->base.u.int_length.unextended) +#define TREE_INT_CST_EXT_NUNITS(NODE) \ + (INTEGER_CST_CHECK (NODE)->base.u.int_length.extended) +#define TREE_INT_CST_OFFSET_NUNITS(NODE) \ + (INTEGER_CST_CHECK (NODE)->base.u.int_length.offset) +#define TREE_INT_CST_ELT(NODE, I) TREE_INT_CST_ELT_CHECK (NODE, I) +#define TREE_INT_CST_LOW(NODE) \ + ((unsigned HOST_WIDE_INT) TREE_INT_CST_ELT (NODE, 0)) + +#define TREE_REAL_CST_PTR(NODE) (REAL_CST_CHECK (NODE)->real_cst.real_cst_ptr) +#define TREE_REAL_CST(NODE) (*TREE_REAL_CST_PTR (NODE)) + +#define TREE_FIXED_CST_PTR(NODE) \ + (FIXED_CST_CHECK (NODE)->fixed_cst.fixed_cst_ptr) +#define TREE_FIXED_CST(NODE) (*TREE_FIXED_CST_PTR (NODE)) + +/* In a STRING_CST */ +/* In C terms, this is sizeof, not strlen. */ +#define TREE_STRING_LENGTH(NODE) (STRING_CST_CHECK (NODE)->string.length) +#define TREE_STRING_POINTER(NODE) \ + ((const char *)(STRING_CST_CHECK (NODE)->string.str)) + +/* In a COMPLEX_CST node. */ +#define TREE_REALPART(NODE) (COMPLEX_CST_CHECK (NODE)->complex.real) +#define TREE_IMAGPART(NODE) (COMPLEX_CST_CHECK (NODE)->complex.imag) + +/* In a VECTOR_CST node. */ +#define VECTOR_CST_NELTS(NODE) (TYPE_VECTOR_SUBPARTS (TREE_TYPE (NODE))) +#define VECTOR_CST_ELTS(NODE) (VECTOR_CST_CHECK (NODE)->vector.elts) +#define VECTOR_CST_ELT(NODE,IDX) (VECTOR_CST_CHECK (NODE)->vector.elts[IDX]) + +/* Define fields and accessors for some special-purpose tree nodes. */ + +#define IDENTIFIER_LENGTH(NODE) \ + (IDENTIFIER_NODE_CHECK (NODE)->identifier.id.len) +#define IDENTIFIER_POINTER(NODE) \ + ((const char *) IDENTIFIER_NODE_CHECK (NODE)->identifier.id.str) +#define IDENTIFIER_HASH_VALUE(NODE) \ + (IDENTIFIER_NODE_CHECK (NODE)->identifier.id.hash_value) + +/* Translate a hash table identifier pointer to a tree_identifier + pointer, and vice versa. */ + +#define HT_IDENT_TO_GCC_IDENT(NODE) \ + ((tree) ((char *) (NODE) - sizeof (struct tree_common))) +#define GCC_IDENT_TO_HT_IDENT(NODE) (&((struct tree_identifier *) (NODE))->id) + +/* In a TREE_LIST node. */ +#define TREE_PURPOSE(NODE) (TREE_LIST_CHECK (NODE)->list.purpose) +#define TREE_VALUE(NODE) (TREE_LIST_CHECK (NODE)->list.value) + +/* In a TREE_VEC node. */ +#define TREE_VEC_LENGTH(NODE) (TREE_VEC_CHECK (NODE)->base.u.length) +#define TREE_VEC_END(NODE) \ + ((void) TREE_VEC_CHECK (NODE), &((NODE)->vec.a[(NODE)->vec.base.u.length])) + +#define TREE_VEC_ELT(NODE,I) TREE_VEC_ELT_CHECK (NODE, I) + +/* In a CONSTRUCTOR node. */ +#define CONSTRUCTOR_ELTS(NODE) (CONSTRUCTOR_CHECK (NODE)->constructor.elts) +#define CONSTRUCTOR_ELT(NODE,IDX) \ + (&(*CONSTRUCTOR_ELTS (NODE))[IDX]) +#define CONSTRUCTOR_NELTS(NODE) \ + (vec_safe_length (CONSTRUCTOR_ELTS (NODE))) +#define CONSTRUCTOR_NO_CLEARING(NODE) \ + (CONSTRUCTOR_CHECK (NODE)->base.public_flag) + +/* Iterate through the vector V of CONSTRUCTOR_ELT elements, yielding the + value of each element (stored within VAL). IX must be a scratch variable + of unsigned integer type. */ +#define FOR_EACH_CONSTRUCTOR_VALUE(V, IX, VAL) \ + for (IX = 0; (IX >= vec_safe_length (V)) \ + ? false \ + : ((VAL = (*(V))[IX].value), \ + true); \ + (IX)++) + +/* Iterate through the vector V of CONSTRUCTOR_ELT elements, yielding both + the value of each element (stored within VAL) and its index (stored + within INDEX). IX must be a scratch variable of unsigned integer type. */ +#define FOR_EACH_CONSTRUCTOR_ELT(V, IX, INDEX, VAL) \ + for (IX = 0; (IX >= vec_safe_length (V)) \ + ? false \ + : (((void) (VAL = (*V)[IX].value)), \ + (INDEX = (*V)[IX].index), \ + true); \ + (IX)++) + +/* Append a new constructor element to V, with the specified INDEX and VAL. */ +#define CONSTRUCTOR_APPEND_ELT(V, INDEX, VALUE) \ + do { \ + constructor_elt _ce___ = {INDEX, VALUE}; \ + vec_safe_push ((V), _ce___); \ + } while (0) + +/* True if NODE, a FIELD_DECL, is to be processed as a bitfield for + constructor output purposes. */ +#define CONSTRUCTOR_BITFIELD_P(NODE) \ + (DECL_BIT_FIELD (FIELD_DECL_CHECK (NODE)) && DECL_MODE (NODE) != BLKmode) + +/* True if NODE is a clobber right hand side, an expression of indeterminate + value that clobbers the LHS in a copy instruction. We use a volatile + empty CONSTRUCTOR for this, as it matches most of the necessary semantic. + In particular the volatile flag causes us to not prematurely remove + such clobber instructions. */ +#define TREE_CLOBBER_P(NODE) \ + (TREE_CODE (NODE) == CONSTRUCTOR && TREE_THIS_VOLATILE (NODE)) + +/* Define fields and accessors for some nodes that represent expressions. */ + +/* Nonzero if NODE is an empty statement (NOP_EXPR <0>). */ +#define IS_EMPTY_STMT(NODE) (TREE_CODE (NODE) == NOP_EXPR \ + && VOID_TYPE_P (TREE_TYPE (NODE)) \ + && integer_zerop (TREE_OPERAND (NODE, 0))) + +/* In ordinary expression nodes. */ +#define TREE_OPERAND_LENGTH(NODE) tree_operand_length (NODE) +#define TREE_OPERAND(NODE, I) TREE_OPERAND_CHECK (NODE, I) + +/* In a tcc_vl_exp node, operand 0 is an INT_CST node holding the operand + length. Its value includes the length operand itself; that is, + the minimum valid length is 1. + Note that we have to bypass the use of TREE_OPERAND to access + that field to avoid infinite recursion in expanding the macros. */ +#define VL_EXP_OPERAND_LENGTH(NODE) \ + ((int)TREE_INT_CST_LOW (VL_EXP_CHECK (NODE)->exp.operands[0])) + +/* Nonzero if is_gimple_debug() may possibly hold. */ +#define MAY_HAVE_DEBUG_STMTS (flag_var_tracking_assignments) + +/* In a LOOP_EXPR node. */ +#define LOOP_EXPR_BODY(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_EXPR, 0) + +/* The source location of this expression. Non-tree_exp nodes such as + decls and constants can be shared among multiple locations, so + return nothing. */ +#define EXPR_LOCATION(NODE) \ + (CAN_HAVE_LOCATION_P ((NODE)) ? (NODE)->exp.locus : UNKNOWN_LOCATION) +#define SET_EXPR_LOCATION(NODE, LOCUS) EXPR_CHECK ((NODE))->exp.locus = (LOCUS) +#define EXPR_HAS_LOCATION(NODE) (LOCATION_LOCUS (EXPR_LOCATION (NODE)) \ + != UNKNOWN_LOCATION) +/* The location to be used in a diagnostic about this expression. Do not + use this macro if the location will be assigned to other expressions. */ +#define EXPR_LOC_OR_LOC(NODE, LOCUS) (EXPR_HAS_LOCATION (NODE) \ + ? (NODE)->exp.locus : (LOCUS)) +#define EXPR_FILENAME(NODE) LOCATION_FILE (EXPR_CHECK ((NODE))->exp.locus) +#define EXPR_LINENO(NODE) LOCATION_LINE (EXPR_CHECK (NODE)->exp.locus) + +#define CAN_HAVE_RANGE_P(NODE) (CAN_HAVE_LOCATION_P (NODE)) +#define EXPR_LOCATION_RANGE(NODE) (get_expr_source_range (EXPR_CHECK ((NODE)))) + +#define EXPR_HAS_RANGE(NODE) \ + (CAN_HAVE_RANGE_P (NODE) \ + ? EXPR_LOCATION_RANGE (NODE).m_start != UNKNOWN_LOCATION \ + : false) + +/* True if a tree is an expression or statement that can have a + location. */ +#define CAN_HAVE_LOCATION_P(NODE) ((NODE) && EXPR_P (NODE)) + +static inline source_range +get_expr_source_range (tree expr) +{ + location_t loc = EXPR_LOCATION (expr); + return get_range_from_loc (line_table, loc); +} + +extern void protected_set_expr_location (tree, location_t); + +/* In a TARGET_EXPR node. */ +#define TARGET_EXPR_SLOT(NODE) TREE_OPERAND_CHECK_CODE (NODE, TARGET_EXPR, 0) +#define TARGET_EXPR_INITIAL(NODE) TREE_OPERAND_CHECK_CODE (NODE, TARGET_EXPR, 1) +#define TARGET_EXPR_CLEANUP(NODE) TREE_OPERAND_CHECK_CODE (NODE, TARGET_EXPR, 2) + +/* DECL_EXPR accessor. This gives access to the DECL associated with + the given declaration statement. */ +#define DECL_EXPR_DECL(NODE) TREE_OPERAND (DECL_EXPR_CHECK (NODE), 0) + +#define EXIT_EXPR_COND(NODE) TREE_OPERAND (EXIT_EXPR_CHECK (NODE), 0) + +/* COMPOUND_LITERAL_EXPR accessors. */ +#define COMPOUND_LITERAL_EXPR_DECL_EXPR(NODE) \ + TREE_OPERAND (COMPOUND_LITERAL_EXPR_CHECK (NODE), 0) +#define COMPOUND_LITERAL_EXPR_DECL(NODE) \ + DECL_EXPR_DECL (COMPOUND_LITERAL_EXPR_DECL_EXPR (NODE)) + +/* SWITCH_EXPR accessors. These give access to the condition, body and + original condition type (before any compiler conversions) + of the switch statement, respectively. */ +#define SWITCH_COND(NODE) TREE_OPERAND (SWITCH_EXPR_CHECK (NODE), 0) +#define SWITCH_BODY(NODE) TREE_OPERAND (SWITCH_EXPR_CHECK (NODE), 1) +#define SWITCH_LABELS(NODE) TREE_OPERAND (SWITCH_EXPR_CHECK (NODE), 2) + +/* CASE_LABEL_EXPR accessors. These give access to the high and low values + of a case label, respectively. */ +#define CASE_LOW(NODE) TREE_OPERAND (CASE_LABEL_EXPR_CHECK (NODE), 0) +#define CASE_HIGH(NODE) TREE_OPERAND (CASE_LABEL_EXPR_CHECK (NODE), 1) +#define CASE_LABEL(NODE) TREE_OPERAND (CASE_LABEL_EXPR_CHECK (NODE), 2) +#define CASE_CHAIN(NODE) TREE_OPERAND (CASE_LABEL_EXPR_CHECK (NODE), 3) + +/* The operands of a TARGET_MEM_REF. Operands 0 and 1 have to match + corresponding MEM_REF operands. */ +#define TMR_BASE(NODE) (TREE_OPERAND (TARGET_MEM_REF_CHECK (NODE), 0)) +#define TMR_OFFSET(NODE) (TREE_OPERAND (TARGET_MEM_REF_CHECK (NODE), 1)) +#define TMR_INDEX(NODE) (TREE_OPERAND (TARGET_MEM_REF_CHECK (NODE), 2)) +#define TMR_STEP(NODE) (TREE_OPERAND (TARGET_MEM_REF_CHECK (NODE), 3)) +#define TMR_INDEX2(NODE) (TREE_OPERAND (TARGET_MEM_REF_CHECK (NODE), 4)) + +#define MR_DEPENDENCE_CLIQUE(NODE) \ + (TREE_CHECK2 (NODE, MEM_REF, TARGET_MEM_REF)->base.u.dependence_info.clique) +#define MR_DEPENDENCE_BASE(NODE) \ + (TREE_CHECK2 (NODE, MEM_REF, TARGET_MEM_REF)->base.u.dependence_info.base) + +/* The operands of a BIND_EXPR. */ +#define BIND_EXPR_VARS(NODE) (TREE_OPERAND (BIND_EXPR_CHECK (NODE), 0)) +#define BIND_EXPR_BODY(NODE) (TREE_OPERAND (BIND_EXPR_CHECK (NODE), 1)) +#define BIND_EXPR_BLOCK(NODE) (TREE_OPERAND (BIND_EXPR_CHECK (NODE), 2)) + +/* GOTO_EXPR accessor. This gives access to the label associated with + a goto statement. */ +#define GOTO_DESTINATION(NODE) TREE_OPERAND ((NODE), 0) + +/* ASM_EXPR accessors. ASM_STRING returns a STRING_CST for the + instruction (e.g., "mov x, y"). ASM_OUTPUTS, ASM_INPUTS, and + ASM_CLOBBERS represent the outputs, inputs, and clobbers for the + statement. */ +#define ASM_STRING(NODE) TREE_OPERAND (ASM_EXPR_CHECK (NODE), 0) +#define ASM_OUTPUTS(NODE) TREE_OPERAND (ASM_EXPR_CHECK (NODE), 1) +#define ASM_INPUTS(NODE) TREE_OPERAND (ASM_EXPR_CHECK (NODE), 2) +#define ASM_CLOBBERS(NODE) TREE_OPERAND (ASM_EXPR_CHECK (NODE), 3) +#define ASM_LABELS(NODE) TREE_OPERAND (ASM_EXPR_CHECK (NODE), 4) +/* Nonzero if we want to create an ASM_INPUT instead of an + ASM_OPERAND with no operands. */ +#define ASM_INPUT_P(NODE) (ASM_EXPR_CHECK (NODE)->base.static_flag) +#define ASM_VOLATILE_P(NODE) (ASM_EXPR_CHECK (NODE)->base.public_flag) + +/* COND_EXPR accessors. */ +#define COND_EXPR_COND(NODE) (TREE_OPERAND (COND_EXPR_CHECK (NODE), 0)) +#define COND_EXPR_THEN(NODE) (TREE_OPERAND (COND_EXPR_CHECK (NODE), 1)) +#define COND_EXPR_ELSE(NODE) (TREE_OPERAND (COND_EXPR_CHECK (NODE), 2)) + +/* Accessors for the chains of recurrences. */ +#define CHREC_VAR(NODE) TREE_OPERAND (POLYNOMIAL_CHREC_CHECK (NODE), 0) +#define CHREC_LEFT(NODE) TREE_OPERAND (POLYNOMIAL_CHREC_CHECK (NODE), 1) +#define CHREC_RIGHT(NODE) TREE_OPERAND (POLYNOMIAL_CHREC_CHECK (NODE), 2) +#define CHREC_VARIABLE(NODE) TREE_INT_CST_LOW (CHREC_VAR (NODE)) + +/* LABEL_EXPR accessor. This gives access to the label associated with + the given label expression. */ +#define LABEL_EXPR_LABEL(NODE) TREE_OPERAND (LABEL_EXPR_CHECK (NODE), 0) + +/* CATCH_EXPR accessors. */ +#define CATCH_TYPES(NODE) TREE_OPERAND (CATCH_EXPR_CHECK (NODE), 0) +#define CATCH_BODY(NODE) TREE_OPERAND (CATCH_EXPR_CHECK (NODE), 1) + +/* EH_FILTER_EXPR accessors. */ +#define EH_FILTER_TYPES(NODE) TREE_OPERAND (EH_FILTER_EXPR_CHECK (NODE), 0) +#define EH_FILTER_FAILURE(NODE) TREE_OPERAND (EH_FILTER_EXPR_CHECK (NODE), 1) + +/* OBJ_TYPE_REF accessors. */ +#define OBJ_TYPE_REF_EXPR(NODE) TREE_OPERAND (OBJ_TYPE_REF_CHECK (NODE), 0) +#define OBJ_TYPE_REF_OBJECT(NODE) TREE_OPERAND (OBJ_TYPE_REF_CHECK (NODE), 1) +#define OBJ_TYPE_REF_TOKEN(NODE) TREE_OPERAND (OBJ_TYPE_REF_CHECK (NODE), 2) + +/* ASSERT_EXPR accessors. */ +#define ASSERT_EXPR_VAR(NODE) TREE_OPERAND (ASSERT_EXPR_CHECK (NODE), 0) +#define ASSERT_EXPR_COND(NODE) TREE_OPERAND (ASSERT_EXPR_CHECK (NODE), 1) + +/* CALL_EXPR accessors. */ +#define CALL_EXPR_FN(NODE) TREE_OPERAND (CALL_EXPR_CHECK (NODE), 1) +#define CALL_EXPR_STATIC_CHAIN(NODE) TREE_OPERAND (CALL_EXPR_CHECK (NODE), 2) +#define CALL_EXPR_ARG(NODE, I) TREE_OPERAND (CALL_EXPR_CHECK (NODE), (I) + 3) +#define call_expr_nargs(NODE) (VL_EXP_OPERAND_LENGTH (NODE) - 3) +#define CALL_EXPR_IFN(NODE) (CALL_EXPR_CHECK (NODE)->base.u.ifn) + +/* CALL_EXPR_ARGP returns a pointer to the argument vector for NODE. + We can't use &CALL_EXPR_ARG (NODE, 0) because that will complain if + the argument count is zero when checking is enabled. Instead, do + the pointer arithmetic to advance past the 3 fixed operands in a + CALL_EXPR. That produces a valid pointer to just past the end of the + operand array, even if it's not valid to dereference it. */ +#define CALL_EXPR_ARGP(NODE) \ + (&(TREE_OPERAND (CALL_EXPR_CHECK (NODE), 0)) + 3) + +/* TM directives and accessors. */ +#define TRANSACTION_EXPR_BODY(NODE) \ + TREE_OPERAND (TRANSACTION_EXPR_CHECK (NODE), 0) +#define TRANSACTION_EXPR_OUTER(NODE) \ + (TRANSACTION_EXPR_CHECK (NODE)->base.static_flag) +#define TRANSACTION_EXPR_RELAXED(NODE) \ + (TRANSACTION_EXPR_CHECK (NODE)->base.public_flag) + +/* OpenMP and OpenACC directive and clause accessors. */ + +/* Generic accessors for OMP nodes that keep the body as operand 0, and clauses + as operand 1. */ +#define OMP_BODY(NODE) \ + TREE_OPERAND (TREE_RANGE_CHECK (NODE, OACC_PARALLEL, OMP_TASKGROUP), 0) +#define OMP_CLAUSES(NODE) \ + TREE_OPERAND (TREE_RANGE_CHECK (NODE, OACC_PARALLEL, OMP_SINGLE), 1) + +/* Generic accessors for OMP nodes that keep clauses as operand 0. */ +#define OMP_STANDALONE_CLAUSES(NODE) \ + TREE_OPERAND (TREE_RANGE_CHECK (NODE, OACC_CACHE, OMP_TARGET_EXIT_DATA), 0) + +#define OACC_DATA_BODY(NODE) \ + TREE_OPERAND (OACC_DATA_CHECK (NODE), 0) +#define OACC_DATA_CLAUSES(NODE) \ + TREE_OPERAND (OACC_DATA_CHECK (NODE), 1) + +#define OACC_HOST_DATA_BODY(NODE) \ + TREE_OPERAND (OACC_HOST_DATA_CHECK (NODE), 0) +#define OACC_HOST_DATA_CLAUSES(NODE) \ + TREE_OPERAND (OACC_HOST_DATA_CHECK (NODE), 1) + +#define OACC_CACHE_CLAUSES(NODE) \ + TREE_OPERAND (OACC_CACHE_CHECK (NODE), 0) + +#define OACC_DECLARE_CLAUSES(NODE) \ + TREE_OPERAND (OACC_DECLARE_CHECK (NODE), 0) + +#define OACC_ENTER_DATA_CLAUSES(NODE) \ + TREE_OPERAND (OACC_ENTER_DATA_CHECK (NODE), 0) + +#define OACC_EXIT_DATA_CLAUSES(NODE) \ + TREE_OPERAND (OACC_EXIT_DATA_CHECK (NODE), 0) + +#define OACC_UPDATE_CLAUSES(NODE) \ + TREE_OPERAND (OACC_UPDATE_CHECK (NODE), 0) + +#define OMP_PARALLEL_BODY(NODE) TREE_OPERAND (OMP_PARALLEL_CHECK (NODE), 0) +#define OMP_PARALLEL_CLAUSES(NODE) TREE_OPERAND (OMP_PARALLEL_CHECK (NODE), 1) + +#define OMP_TASK_BODY(NODE) TREE_OPERAND (OMP_TASK_CHECK (NODE), 0) +#define OMP_TASK_CLAUSES(NODE) TREE_OPERAND (OMP_TASK_CHECK (NODE), 1) + +#define OMP_TASKREG_CHECK(NODE) TREE_RANGE_CHECK (NODE, OMP_PARALLEL, OMP_TASK) +#define OMP_TASKREG_BODY(NODE) TREE_OPERAND (OMP_TASKREG_CHECK (NODE), 0) +#define OMP_TASKREG_CLAUSES(NODE) TREE_OPERAND (OMP_TASKREG_CHECK (NODE), 1) + +#define OMP_LOOP_CHECK(NODE) TREE_RANGE_CHECK (NODE, OMP_FOR, OACC_LOOP) +#define OMP_FOR_BODY(NODE) TREE_OPERAND (OMP_LOOP_CHECK (NODE), 0) +#define OMP_FOR_CLAUSES(NODE) TREE_OPERAND (OMP_LOOP_CHECK (NODE), 1) +#define OMP_FOR_INIT(NODE) TREE_OPERAND (OMP_LOOP_CHECK (NODE), 2) +#define OMP_FOR_COND(NODE) TREE_OPERAND (OMP_LOOP_CHECK (NODE), 3) +#define OMP_FOR_INCR(NODE) TREE_OPERAND (OMP_LOOP_CHECK (NODE), 4) +#define OMP_FOR_PRE_BODY(NODE) TREE_OPERAND (OMP_LOOP_CHECK (NODE), 5) +#define OMP_FOR_ORIG_DECLS(NODE) TREE_OPERAND (OMP_LOOP_CHECK (NODE), 6) + +#define OMP_SECTIONS_BODY(NODE) TREE_OPERAND (OMP_SECTIONS_CHECK (NODE), 0) +#define OMP_SECTIONS_CLAUSES(NODE) TREE_OPERAND (OMP_SECTIONS_CHECK (NODE), 1) + +#define OMP_SECTION_BODY(NODE) TREE_OPERAND (OMP_SECTION_CHECK (NODE), 0) + +#define OMP_SINGLE_BODY(NODE) TREE_OPERAND (OMP_SINGLE_CHECK (NODE), 0) +#define OMP_SINGLE_CLAUSES(NODE) TREE_OPERAND (OMP_SINGLE_CHECK (NODE), 1) + +#define OMP_MASTER_BODY(NODE) TREE_OPERAND (OMP_MASTER_CHECK (NODE), 0) + +#define OMP_TASKGROUP_BODY(NODE) TREE_OPERAND (OMP_TASKGROUP_CHECK (NODE), 0) + +#define OMP_ORDERED_BODY(NODE) TREE_OPERAND (OMP_ORDERED_CHECK (NODE), 0) +#define OMP_ORDERED_CLAUSES(NODE) TREE_OPERAND (OMP_ORDERED_CHECK (NODE), 1) + +#define OMP_CRITICAL_BODY(NODE) TREE_OPERAND (OMP_CRITICAL_CHECK (NODE), 0) +#define OMP_CRITICAL_CLAUSES(NODE) TREE_OPERAND (OMP_CRITICAL_CHECK (NODE), 1) +#define OMP_CRITICAL_NAME(NODE) TREE_OPERAND (OMP_CRITICAL_CHECK (NODE), 2) + +#define OMP_TEAMS_BODY(NODE) TREE_OPERAND (OMP_TEAMS_CHECK (NODE), 0) +#define OMP_TEAMS_CLAUSES(NODE) TREE_OPERAND (OMP_TEAMS_CHECK (NODE), 1) + +#define OMP_TARGET_DATA_BODY(NODE) \ + TREE_OPERAND (OMP_TARGET_DATA_CHECK (NODE), 0) +#define OMP_TARGET_DATA_CLAUSES(NODE)\ + TREE_OPERAND (OMP_TARGET_DATA_CHECK (NODE), 1) + +#define OMP_TARGET_BODY(NODE) TREE_OPERAND (OMP_TARGET_CHECK (NODE), 0) +#define OMP_TARGET_CLAUSES(NODE) TREE_OPERAND (OMP_TARGET_CHECK (NODE), 1) + +#define OMP_TARGET_UPDATE_CLAUSES(NODE)\ + TREE_OPERAND (OMP_TARGET_UPDATE_CHECK (NODE), 0) + +#define OMP_TARGET_ENTER_DATA_CLAUSES(NODE)\ + TREE_OPERAND (OMP_TARGET_ENTER_DATA_CHECK (NODE), 0) + +#define OMP_TARGET_EXIT_DATA_CLAUSES(NODE)\ + TREE_OPERAND (OMP_TARGET_EXIT_DATA_CHECK (NODE), 0) + +#define OMP_CLAUSE_SIZE(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_RANGE_CHECK (OMP_CLAUSE_CHECK (NODE), \ + OMP_CLAUSE_FROM, \ + OMP_CLAUSE__CACHE_), 1) + +#define OMP_CLAUSE_CHAIN(NODE) TREE_CHAIN (OMP_CLAUSE_CHECK (NODE)) +#define OMP_CLAUSE_DECL(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_RANGE_CHECK (OMP_CLAUSE_CHECK (NODE), \ + OMP_CLAUSE_PRIVATE, \ + OMP_CLAUSE__LOOPTEMP_), 0) +#define OMP_CLAUSE_HAS_LOCATION(NODE) \ + (LOCATION_LOCUS ((OMP_CLAUSE_CHECK (NODE))->omp_clause.locus) \ + != UNKNOWN_LOCATION) +#define OMP_CLAUSE_LOCATION(NODE) (OMP_CLAUSE_CHECK (NODE))->omp_clause.locus + +/* True on an OMP_SECTION statement that was the last lexical member. + This status is meaningful in the implementation of lastprivate. */ +#define OMP_SECTION_LAST(NODE) \ + (OMP_SECTION_CHECK (NODE)->base.private_flag) + +/* True on an OMP_PARALLEL statement if it represents an explicit + combined parallel work-sharing constructs. */ +#define OMP_PARALLEL_COMBINED(NODE) \ + (OMP_PARALLEL_CHECK (NODE)->base.private_flag) + +/* True on an OMP_TEAMS statement if it represents an explicit + combined teams distribute constructs. */ +#define OMP_TEAMS_COMBINED(NODE) \ + (OMP_TEAMS_CHECK (NODE)->base.private_flag) + +/* True on an OMP_TARGET statement if it represents explicit + combined target teams, target parallel or target simd constructs. */ +#define OMP_TARGET_COMBINED(NODE) \ + (OMP_TARGET_CHECK (NODE)->base.private_flag) + +/* True if OMP_ATOMIC* is supposed to be sequentially consistent + as opposed to relaxed. */ +#define OMP_ATOMIC_SEQ_CST(NODE) \ + (TREE_RANGE_CHECK (NODE, OMP_ATOMIC, \ + OMP_ATOMIC_CAPTURE_NEW)->base.private_flag) + +/* True on a PRIVATE clause if its decl is kept around for debugging + information only and its DECL_VALUE_EXPR is supposed to point + to what it has been remapped to. */ +#define OMP_CLAUSE_PRIVATE_DEBUG(NODE) \ + (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_PRIVATE)->base.public_flag) + +/* True on a PRIVATE clause if ctor needs access to outer region's + variable. */ +#define OMP_CLAUSE_PRIVATE_OUTER_REF(NODE) \ + TREE_PRIVATE (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_PRIVATE)) + +/* True if a PRIVATE clause is for a C++ class IV on taskloop construct + (thus should be private on the outer taskloop and firstprivate on + task). */ +#define OMP_CLAUSE_PRIVATE_TASKLOOP_IV(NODE) \ + TREE_PROTECTED (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_PRIVATE)) + +/* True on a FIRSTPRIVATE clause if it has been added implicitly. */ +#define OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT(NODE) \ + (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_FIRSTPRIVATE)->base.public_flag) + +/* True on a LASTPRIVATE clause if a FIRSTPRIVATE clause for the same + decl is present in the chain. */ +#define OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE(NODE) \ + (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LASTPRIVATE)->base.public_flag) +#define OMP_CLAUSE_LASTPRIVATE_STMT(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, \ + OMP_CLAUSE_LASTPRIVATE),\ + 1) +#define OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ(NODE) \ + (OMP_CLAUSE_CHECK (NODE))->omp_clause.gimple_reduction_init + +/* True if a LASTPRIVATE clause is for a C++ class IV on taskloop construct + (thus should be lastprivate on the outer taskloop and firstprivate on + task). */ +#define OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV(NODE) \ + TREE_PROTECTED (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LASTPRIVATE)) + +/* True on a SHARED clause if a FIRSTPRIVATE clause for the same + decl is present in the chain (this can happen only for taskloop + with FIRSTPRIVATE/LASTPRIVATE on it originally. */ +#define OMP_CLAUSE_SHARED_FIRSTPRIVATE(NODE) \ + (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SHARED)->base.public_flag) + +/* True on a SHARED clause if a scalar is not modified in the body and + thus could be optimized as firstprivate. */ +#define OMP_CLAUSE_SHARED_READONLY(NODE) \ + TREE_PRIVATE (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SHARED)) + +#define OMP_CLAUSE_IF_MODIFIER(NODE) \ + (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_IF)->omp_clause.subcode.if_modifier) + +#define OMP_CLAUSE_FINAL_EXPR(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_FINAL), 0) +#define OMP_CLAUSE_IF_EXPR(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_IF), 0) +#define OMP_CLAUSE_NUM_THREADS_EXPR(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_NUM_THREADS),0) +#define OMP_CLAUSE_SCHEDULE_CHUNK_EXPR(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SCHEDULE), 0) +#define OMP_CLAUSE_NUM_TASKS_EXPR(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_NUM_TASKS), 0) +#define OMP_CLAUSE_HINT_EXPR(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_HINT), 0) + +#define OMP_CLAUSE_GRAINSIZE_EXPR(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_GRAINSIZE),0) + +#define OMP_CLAUSE_PRIORITY_EXPR(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_PRIORITY),0) + +/* OpenACC clause expressions */ +#define OMP_CLAUSE_EXPR(NODE, CLAUSE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, CLAUSE), 0) +#define OMP_CLAUSE_GANG_EXPR(NODE) \ + OMP_CLAUSE_OPERAND ( \ + OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_GANG), 0) +#define OMP_CLAUSE_GANG_STATIC_EXPR(NODE) \ + OMP_CLAUSE_OPERAND ( \ + OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_GANG), 1) +#define OMP_CLAUSE_ASYNC_EXPR(NODE) \ + OMP_CLAUSE_OPERAND ( \ + OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_ASYNC), 0) +#define OMP_CLAUSE_WAIT_EXPR(NODE) \ + OMP_CLAUSE_OPERAND ( \ + OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_WAIT), 0) +#define OMP_CLAUSE_VECTOR_EXPR(NODE) \ + OMP_CLAUSE_OPERAND ( \ + OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_VECTOR), 0) +#define OMP_CLAUSE_WORKER_EXPR(NODE) \ + OMP_CLAUSE_OPERAND ( \ + OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_WORKER), 0) +#define OMP_CLAUSE_NUM_GANGS_EXPR(NODE) \ + OMP_CLAUSE_OPERAND ( \ + OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_NUM_GANGS), 0) +#define OMP_CLAUSE_NUM_WORKERS_EXPR(NODE) \ + OMP_CLAUSE_OPERAND ( \ + OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_NUM_WORKERS), 0) +#define OMP_CLAUSE_VECTOR_LENGTH_EXPR(NODE) \ + OMP_CLAUSE_OPERAND ( \ + OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_VECTOR_LENGTH), 0) + +#define OMP_CLAUSE_DEPEND_KIND(NODE) \ + (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_DEPEND)->omp_clause.subcode.depend_kind) + +#define OMP_CLAUSE_DEPEND_SINK_NEGATIVE(NODE) \ + TREE_PUBLIC (TREE_LIST_CHECK (NODE)) + +#define OMP_CLAUSE_MAP_KIND(NODE) \ + ((enum gomp_map_kind) OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)->omp_clause.subcode.map_kind) +#define OMP_CLAUSE_SET_MAP_KIND(NODE, MAP_KIND) \ + (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)->omp_clause.subcode.map_kind \ + = (unsigned int) (MAP_KIND)) + +/* Nonzero if this map clause is for array (rather than pointer) based array + section with zero bias. Both the non-decl OMP_CLAUSE_MAP and corresponding + OMP_CLAUSE_MAP with GOMP_MAP_POINTER are marked with this flag. */ +#define OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION(NODE) \ + (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)->base.public_flag) +/* Nonzero if this is a mapped array section, that might need special + treatment if OMP_CLAUSE_SIZE is zero. */ +#define OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION(NODE) \ + TREE_PROTECTED (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)) +/* Nonzero if this map clause is for an ACC parallel reduction variable. */ +#define OMP_CLAUSE_MAP_IN_REDUCTION(NODE) \ + TREE_PRIVATE (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_MAP)) + +#define OMP_CLAUSE_PROC_BIND_KIND(NODE) \ + (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_PROC_BIND)->omp_clause.subcode.proc_bind_kind) + +#define OMP_CLAUSE_COLLAPSE_EXPR(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_COLLAPSE), 0) +#define OMP_CLAUSE_COLLAPSE_ITERVAR(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_COLLAPSE), 1) +#define OMP_CLAUSE_COLLAPSE_COUNT(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_COLLAPSE), 2) + +#define OMP_CLAUSE_ORDERED_EXPR(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_ORDERED), 0) + +#define OMP_CLAUSE_REDUCTION_CODE(NODE) \ + (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION)->omp_clause.subcode.reduction_code) +#define OMP_CLAUSE_REDUCTION_INIT(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION), 1) +#define OMP_CLAUSE_REDUCTION_MERGE(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION), 2) +#define OMP_CLAUSE_REDUCTION_GIMPLE_INIT(NODE) \ + (OMP_CLAUSE_CHECK (NODE))->omp_clause.gimple_reduction_init +#define OMP_CLAUSE_REDUCTION_GIMPLE_MERGE(NODE) \ + (OMP_CLAUSE_CHECK (NODE))->omp_clause.gimple_reduction_merge +#define OMP_CLAUSE_REDUCTION_PLACEHOLDER(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION), 3) +#define OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION), 4) + +/* True if a REDUCTION clause may reference the original list item (omp_orig) + in its OMP_CLAUSE_REDUCTION_{,GIMPLE_}INIT. */ +#define OMP_CLAUSE_REDUCTION_OMP_ORIG_REF(NODE) \ + (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION)->base.public_flag) + +/* True if a LINEAR clause doesn't need copy in. True for iterator vars which + are always initialized inside of the loop construct, false otherwise. */ +#define OMP_CLAUSE_LINEAR_NO_COPYIN(NODE) \ + (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LINEAR)->base.public_flag) + +/* True if a LINEAR clause doesn't need copy out. True for iterator vars which + are declared inside of the simd construct. */ +#define OMP_CLAUSE_LINEAR_NO_COPYOUT(NODE) \ + TREE_PRIVATE (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LINEAR)) + +/* True if a LINEAR clause has a stride that is variable. */ +#define OMP_CLAUSE_LINEAR_VARIABLE_STRIDE(NODE) \ + TREE_PROTECTED (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LINEAR)) + +/* True if a LINEAR clause is for an array or allocatable variable that + needs special handling by the frontend. */ +#define OMP_CLAUSE_LINEAR_ARRAY(NODE) \ + (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LINEAR)->base.deprecated_flag) + +#define OMP_CLAUSE_LINEAR_STEP(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LINEAR), 1) + +#define OMP_CLAUSE_LINEAR_STMT(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LINEAR), 2) + +#define OMP_CLAUSE_LINEAR_GIMPLE_SEQ(NODE) \ + (OMP_CLAUSE_CHECK (NODE))->omp_clause.gimple_reduction_init + +#define OMP_CLAUSE_LINEAR_KIND(NODE) \ + (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_LINEAR)->omp_clause.subcode.linear_kind) + +#define OMP_CLAUSE_ALIGNED_ALIGNMENT(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_ALIGNED), 1) + +#define OMP_CLAUSE_NUM_TEAMS_EXPR(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_NUM_TEAMS), 0) + +#define OMP_CLAUSE_THREAD_LIMIT_EXPR(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, \ + OMP_CLAUSE_THREAD_LIMIT), 0) + +#define OMP_CLAUSE_DEVICE_ID(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_DEVICE), 0) + +#define OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, \ + OMP_CLAUSE_DIST_SCHEDULE), 0) + +#define OMP_CLAUSE_SAFELEN_EXPR(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SAFELEN), 0) + +#define OMP_CLAUSE_SIMDLEN_EXPR(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SIMDLEN), 0) + +#define OMP_CLAUSE__SIMDUID__DECL(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE__SIMDUID_), 0) + +#define OMP_CLAUSE_SCHEDULE_KIND(NODE) \ + (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SCHEDULE)->omp_clause.subcode.schedule_kind) + +/* True if a SCHEDULE clause has the simd modifier on it. */ +#define OMP_CLAUSE_SCHEDULE_SIMD(NODE) \ + (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_SCHEDULE)->base.public_flag) + +#define OMP_CLAUSE_DEFAULT_KIND(NODE) \ + (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_DEFAULT)->omp_clause.subcode.default_kind) + +#define OMP_CLAUSE_TILE_LIST(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_TILE), 0) +#define OMP_CLAUSE_TILE_ITERVAR(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_TILE), 1) +#define OMP_CLAUSE_TILE_COUNT(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_TILE), 2) + +#define OMP_CLAUSE__GRIDDIM__DIMENSION(NODE) \ + (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE__GRIDDIM_)\ + ->omp_clause.subcode.dimension) +#define OMP_CLAUSE__GRIDDIM__SIZE(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE__GRIDDIM_), 0) +#define OMP_CLAUSE__GRIDDIM__GROUP(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE__GRIDDIM_), 1) + +/* SSA_NAME accessors. */ + +/* Whether SSA_NAME NODE is a virtual operand. This simply caches the + information in the underlying SSA_NAME_VAR for efficiency. */ +#define SSA_NAME_IS_VIRTUAL_OPERAND(NODE) \ + SSA_NAME_CHECK (NODE)->base.public_flag + +/* Returns the IDENTIFIER_NODE giving the SSA name a name or NULL_TREE + if there is no name associated with it. */ +#define SSA_NAME_IDENTIFIER(NODE) \ + (SSA_NAME_CHECK (NODE)->ssa_name.var != NULL_TREE \ + ? (TREE_CODE ((NODE)->ssa_name.var) == IDENTIFIER_NODE \ + ? (NODE)->ssa_name.var \ + : DECL_NAME ((NODE)->ssa_name.var)) \ + : NULL_TREE) + +/* Returns the variable being referenced. This can be NULL_TREE for + temporaries not associated with any user variable. + Once released, this is the only field that can be relied upon. */ +#define SSA_NAME_VAR(NODE) \ + (SSA_NAME_CHECK (NODE)->ssa_name.var == NULL_TREE \ + || TREE_CODE ((NODE)->ssa_name.var) == IDENTIFIER_NODE \ + ? NULL_TREE : (NODE)->ssa_name.var) + +#define SET_SSA_NAME_VAR_OR_IDENTIFIER(NODE,VAR) \ + do \ + { \ + tree var_ = (VAR); \ + SSA_NAME_CHECK (NODE)->ssa_name.var = var_; \ + SSA_NAME_IS_VIRTUAL_OPERAND (NODE) \ + = (var_ \ + && TREE_CODE (var_) == VAR_DECL \ + && VAR_DECL_IS_VIRTUAL_OPERAND (var_)); \ + } \ + while (0) + +/* Returns the statement which defines this SSA name. */ +#define SSA_NAME_DEF_STMT(NODE) SSA_NAME_CHECK (NODE)->ssa_name.def_stmt + +/* Returns the SSA version number of this SSA name. Note that in + tree SSA, version numbers are not per variable and may be recycled. */ +#define SSA_NAME_VERSION(NODE) SSA_NAME_CHECK (NODE)->base.u.version + +/* Nonzero if this SSA name occurs in an abnormal PHI. SSA_NAMES are + never output, so we can safely use the ASM_WRITTEN_FLAG for this + status bit. */ +#define SSA_NAME_OCCURS_IN_ABNORMAL_PHI(NODE) \ + SSA_NAME_CHECK (NODE)->base.asm_written_flag + +/* Nonzero if this SSA_NAME expression is currently on the free list of + SSA_NAMES. Using NOTHROW_FLAG seems reasonably safe since throwing + has no meaning for an SSA_NAME. */ +#define SSA_NAME_IN_FREE_LIST(NODE) \ + SSA_NAME_CHECK (NODE)->base.nothrow_flag + +/* Nonzero if this SSA_NAME is the default definition for the + underlying symbol. A default SSA name is created for symbol S if + the very first reference to S in the function is a read operation. + Default definitions are always created by an empty statement and + belong to no basic block. */ +#define SSA_NAME_IS_DEFAULT_DEF(NODE) \ + SSA_NAME_CHECK (NODE)->base.default_def_flag + +/* Attributes for SSA_NAMEs for pointer-type variables. */ +#define SSA_NAME_PTR_INFO(N) \ + SSA_NAME_CHECK (N)->ssa_name.info.ptr_info + +/* True if SSA_NAME_RANGE_INFO describes an anti-range. */ +#define SSA_NAME_ANTI_RANGE_P(N) \ + SSA_NAME_CHECK (N)->base.static_flag + +/* The type of range described by SSA_NAME_RANGE_INFO. */ +#define SSA_NAME_RANGE_TYPE(N) \ + (SSA_NAME_ANTI_RANGE_P (N) ? VR_ANTI_RANGE : VR_RANGE) + +/* Value range info attributes for SSA_NAMEs of non pointer-type variables. */ +#define SSA_NAME_RANGE_INFO(N) \ + SSA_NAME_CHECK (N)->ssa_name.info.range_info + +/* Return the immediate_use information for an SSA_NAME. */ +#define SSA_NAME_IMM_USE_NODE(NODE) SSA_NAME_CHECK (NODE)->ssa_name.imm_uses + +#define OMP_CLAUSE_CODE(NODE) \ + (OMP_CLAUSE_CHECK (NODE))->omp_clause.code + +#define OMP_CLAUSE_SET_CODE(NODE, CODE) \ + ((OMP_CLAUSE_CHECK (NODE))->omp_clause.code = (CODE)) + +#define OMP_CLAUSE_OPERAND(NODE, I) \ + OMP_CLAUSE_ELT_CHECK (NODE, I) + +/* In a BLOCK node. */ +#define BLOCK_VARS(NODE) (BLOCK_CHECK (NODE)->block.vars) +#define BLOCK_NONLOCALIZED_VARS(NODE) \ + (BLOCK_CHECK (NODE)->block.nonlocalized_vars) +#define BLOCK_NUM_NONLOCALIZED_VARS(NODE) \ + vec_safe_length (BLOCK_NONLOCALIZED_VARS (NODE)) +#define BLOCK_NONLOCALIZED_VAR(NODE,N) (*BLOCK_NONLOCALIZED_VARS (NODE))[N] +#define BLOCK_SUBBLOCKS(NODE) (BLOCK_CHECK (NODE)->block.subblocks) +#define BLOCK_SUPERCONTEXT(NODE) (BLOCK_CHECK (NODE)->block.supercontext) +#define BLOCK_CHAIN(NODE) (BLOCK_CHECK (NODE)->block.chain) +#define BLOCK_ABSTRACT_ORIGIN(NODE) (BLOCK_CHECK (NODE)->block.abstract_origin) +#define BLOCK_ABSTRACT(NODE) (BLOCK_CHECK (NODE)->block.abstract_flag) +#define BLOCK_DIE(NODE) (BLOCK_CHECK (NODE)->block.die) + +/* True if BLOCK has the same ranges as its BLOCK_SUPERCONTEXT. */ +#define BLOCK_SAME_RANGE(NODE) (BLOCK_CHECK (NODE)->base.u.bits.nameless_flag) + +/* True if BLOCK appears in cold section. */ +#define BLOCK_IN_COLD_SECTION_P(NODE) \ + (BLOCK_CHECK (NODE)->base.u.bits.atomic_flag) + +/* An index number for this block. These values are not guaranteed to + be unique across functions -- whether or not they are depends on + the debugging output format in use. */ +#define BLOCK_NUMBER(NODE) (BLOCK_CHECK (NODE)->block.block_num) + +/* If block reordering splits a lexical block into discontiguous + address ranges, we'll make a copy of the original block. + + Note that this is logically distinct from BLOCK_ABSTRACT_ORIGIN. + In that case, we have one source block that has been replicated + (through inlining or unrolling) into many logical blocks, and that + these logical blocks have different physical variables in them. + + In this case, we have one logical block split into several + non-contiguous address ranges. Most debug formats can't actually + represent this idea directly, so we fake it by creating multiple + logical blocks with the same variables in them. However, for those + that do support non-contiguous regions, these allow the original + logical block to be reconstructed, along with the set of address + ranges. + + One of the logical block fragments is arbitrarily chosen to be + the ORIGIN. The other fragments will point to the origin via + BLOCK_FRAGMENT_ORIGIN; the origin itself will have this pointer + be null. The list of fragments will be chained through + BLOCK_FRAGMENT_CHAIN from the origin. */ + +#define BLOCK_FRAGMENT_ORIGIN(NODE) (BLOCK_CHECK (NODE)->block.fragment_origin) +#define BLOCK_FRAGMENT_CHAIN(NODE) (BLOCK_CHECK (NODE)->block.fragment_chain) + +/* For an inlined function, this gives the location where it was called + from. This is only set in the top level block, which corresponds to the + inlined function scope. This is used in the debug output routines. */ + +#define BLOCK_SOURCE_LOCATION(NODE) (BLOCK_CHECK (NODE)->block.locus) + +/* This gives the location of the end of the block, useful to attach + code implicitly generated for outgoing paths. */ + +#define BLOCK_SOURCE_END_LOCATION(NODE) (BLOCK_CHECK (NODE)->block.end_locus) + +/* Define fields and accessors for nodes representing data types. */ + +/* See tree.def for documentation of the use of these fields. + Look at the documentation of the various ..._TYPE tree codes. + + Note that the type.values, type.minval, and type.maxval fields are + overloaded and used for different macros in different kinds of types. + Each macro must check to ensure the tree node is of the proper kind of + type. Note also that some of the front-ends also overload these fields, + so they must be checked as well. */ + +#define TYPE_UID(NODE) (TYPE_CHECK (NODE)->type_common.uid) +#define TYPE_SIZE(NODE) (TYPE_CHECK (NODE)->type_common.size) +#define TYPE_SIZE_UNIT(NODE) (TYPE_CHECK (NODE)->type_common.size_unit) +#define TYPE_POINTER_TO(NODE) (TYPE_CHECK (NODE)->type_common.pointer_to) +#define TYPE_REFERENCE_TO(NODE) (TYPE_CHECK (NODE)->type_common.reference_to) +#define TYPE_PRECISION(NODE) (TYPE_CHECK (NODE)->type_common.precision) +#define TYPE_NAME(NODE) (TYPE_CHECK (NODE)->type_common.name) +#define TYPE_NEXT_VARIANT(NODE) (TYPE_CHECK (NODE)->type_common.next_variant) +#define TYPE_MAIN_VARIANT(NODE) (TYPE_CHECK (NODE)->type_common.main_variant) +#define TYPE_CONTEXT(NODE) (TYPE_CHECK (NODE)->type_common.context) + +#define TYPE_MODE_RAW(NODE) (TYPE_CHECK (NODE)->type_common.mode) +#define TYPE_MODE(NODE) \ + (VECTOR_TYPE_P (TYPE_CHECK (NODE)) \ + ? vector_type_mode (NODE) : (NODE)->type_common.mode) +#define SET_TYPE_MODE(NODE, MODE) \ + (TYPE_CHECK (NODE)->type_common.mode = (MODE)) + +extern machine_mode element_mode (const_tree t); + +/* The "canonical" type for this type node, which is used by frontends to + compare the type for equality with another type. If two types are + equal (based on the semantics of the language), then they will have + equivalent TYPE_CANONICAL entries. + + As a special case, if TYPE_CANONICAL is NULL_TREE, and thus + TYPE_STRUCTURAL_EQUALITY_P is true, then it cannot + be used for comparison against other types. Instead, the type is + said to require structural equality checks, described in + TYPE_STRUCTURAL_EQUALITY_P. + + For unqualified aggregate and function types the middle-end relies on + TYPE_CANONICAL to tell whether two variables can be assigned + to each other without a conversion. The middle-end also makes sure + to assign the same alias-sets to the type partition with equal + TYPE_CANONICAL of their unqualified variants. */ +#define TYPE_CANONICAL(NODE) (TYPE_CHECK (NODE)->type_common.canonical) +/* Indicates that the type node requires structural equality + checks. The compiler will need to look at the composition of the + type to determine whether it is equal to another type, rather than + just comparing canonical type pointers. For instance, we would need + to look at the return and parameter types of a FUNCTION_TYPE + node. */ +#define TYPE_STRUCTURAL_EQUALITY_P(NODE) (TYPE_CANONICAL (NODE) == NULL_TREE) +/* Sets the TYPE_CANONICAL field to NULL_TREE, indicating that the + type node requires structural equality. */ +#define SET_TYPE_STRUCTURAL_EQUALITY(NODE) (TYPE_CANONICAL (NODE) = NULL_TREE) + +#define TYPE_IBIT(NODE) (GET_MODE_IBIT (TYPE_MODE (NODE))) +#define TYPE_FBIT(NODE) (GET_MODE_FBIT (TYPE_MODE (NODE))) + +/* The (language-specific) typed-based alias set for this type. + Objects whose TYPE_ALIAS_SETs are different cannot alias each + other. If the TYPE_ALIAS_SET is -1, no alias set has yet been + assigned to this type. If the TYPE_ALIAS_SET is 0, objects of this + type can alias objects of any type. */ +#define TYPE_ALIAS_SET(NODE) (TYPE_CHECK (NODE)->type_common.alias_set) + +/* Nonzero iff the typed-based alias set for this type has been + calculated. */ +#define TYPE_ALIAS_SET_KNOWN_P(NODE) \ + (TYPE_CHECK (NODE)->type_common.alias_set != -1) + +/* A TREE_LIST of IDENTIFIER nodes of the attributes that apply + to this type. */ +#define TYPE_ATTRIBUTES(NODE) (TYPE_CHECK (NODE)->type_common.attributes) + +/* The alignment necessary for objects of this type. + The value is an int, measured in bits and must be a power of two. + We support also an "alignment" of zero. */ +#define TYPE_ALIGN(NODE) \ + (TYPE_CHECK (NODE)->type_common.align \ + ? ((unsigned)1) << ((NODE)->type_common.align - 1) : 0) + +/* Specify that TYPE_ALIGN(NODE) is X. */ +#define SET_TYPE_ALIGN(NODE, X) \ + (TYPE_CHECK (NODE)->type_common.align = ffs_hwi (X)) + +/* 1 if the alignment for this type was requested by "aligned" attribute, + 0 if it is the default for this type. */ +#define TYPE_USER_ALIGN(NODE) (TYPE_CHECK (NODE)->base.u.bits.user_align) + +/* The alignment for NODE, in bytes. */ +#define TYPE_ALIGN_UNIT(NODE) (TYPE_ALIGN (NODE) / BITS_PER_UNIT) + +/* If your language allows you to declare types, and you want debug info + for them, then you need to generate corresponding TYPE_DECL nodes. + These "stub" TYPE_DECL nodes have no name, and simply point at the + type node. You then set the TYPE_STUB_DECL field of the type node + to point back at the TYPE_DECL node. This allows the debug routines + to know that the two nodes represent the same type, so that we only + get one debug info record for them. */ +#define TYPE_STUB_DECL(NODE) (TREE_CHAIN (TYPE_CHECK (NODE))) + +/* In a RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE or ARRAY_TYPE, it means + the type has BLKmode only because it lacks the alignment required for + its size. */ +#define TYPE_NO_FORCE_BLK(NODE) \ + (TYPE_CHECK (NODE)->type_common.no_force_blk_flag) + +/* Nonzero in a type considered volatile as a whole. */ +#define TYPE_VOLATILE(NODE) (TYPE_CHECK (NODE)->base.volatile_flag) + +/* Nonzero in a type considered atomic as a whole. */ +#define TYPE_ATOMIC(NODE) (TYPE_CHECK (NODE)->base.u.bits.atomic_flag) + +/* Means this type is const-qualified. */ +#define TYPE_READONLY(NODE) (TYPE_CHECK (NODE)->base.readonly_flag) + +/* If nonzero, this type is `restrict'-qualified, in the C sense of + the term. */ +#define TYPE_RESTRICT(NODE) (TYPE_CHECK (NODE)->type_common.restrict_flag) + +/* If nonzero, type's name shouldn't be emitted into debug info. */ +#define TYPE_NAMELESS(NODE) (TYPE_CHECK (NODE)->base.u.bits.nameless_flag) + +/* The address space the type is in. */ +#define TYPE_ADDR_SPACE(NODE) (TYPE_CHECK (NODE)->base.u.bits.address_space) + +/* Encode/decode the named memory support as part of the qualifier. If more + than 8 qualifiers are added, these macros need to be adjusted. */ +#define ENCODE_QUAL_ADDR_SPACE(NUM) ((NUM & 0xFF) << 8) +#define DECODE_QUAL_ADDR_SPACE(X) (((X) >> 8) & 0xFF) + +/* Return all qualifiers except for the address space qualifiers. */ +#define CLEAR_QUAL_ADDR_SPACE(X) ((X) & ~0xFF00) + +/* Only keep the address space out of the qualifiers and discard the other + qualifiers. */ +#define KEEP_QUAL_ADDR_SPACE(X) ((X) & 0xFF00) + +/* The set of type qualifiers for this type. */ +#define TYPE_QUALS(NODE) \ + ((int) ((TYPE_READONLY (NODE) * TYPE_QUAL_CONST) \ + | (TYPE_VOLATILE (NODE) * TYPE_QUAL_VOLATILE) \ + | (TYPE_ATOMIC (NODE) * TYPE_QUAL_ATOMIC) \ + | (TYPE_RESTRICT (NODE) * TYPE_QUAL_RESTRICT) \ + | (ENCODE_QUAL_ADDR_SPACE (TYPE_ADDR_SPACE (NODE))))) + +/* The same as TYPE_QUALS without the address space qualifications. */ +#define TYPE_QUALS_NO_ADDR_SPACE(NODE) \ + ((int) ((TYPE_READONLY (NODE) * TYPE_QUAL_CONST) \ + | (TYPE_VOLATILE (NODE) * TYPE_QUAL_VOLATILE) \ + | (TYPE_ATOMIC (NODE) * TYPE_QUAL_ATOMIC) \ + | (TYPE_RESTRICT (NODE) * TYPE_QUAL_RESTRICT))) + +/* The same as TYPE_QUALS without the address space and atomic + qualifications. */ +#define TYPE_QUALS_NO_ADDR_SPACE_NO_ATOMIC(NODE) \ + ((int) ((TYPE_READONLY (NODE) * TYPE_QUAL_CONST) \ + | (TYPE_VOLATILE (NODE) * TYPE_QUAL_VOLATILE) \ + | (TYPE_RESTRICT (NODE) * TYPE_QUAL_RESTRICT))) + +/* These flags are available for each language front end to use internally. */ +#define TYPE_LANG_FLAG_0(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_0) +#define TYPE_LANG_FLAG_1(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_1) +#define TYPE_LANG_FLAG_2(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_2) +#define TYPE_LANG_FLAG_3(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_3) +#define TYPE_LANG_FLAG_4(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_4) +#define TYPE_LANG_FLAG_5(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_5) +#define TYPE_LANG_FLAG_6(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_6) +#define TYPE_LANG_FLAG_7(NODE) (TYPE_CHECK (NODE)->type_common.lang_flag_7) + +/* Used to keep track of visited nodes in tree traversals. This is set to + 0 by copy_node and make_node. */ +#define TREE_VISITED(NODE) ((NODE)->base.visited) + +/* If set in an ARRAY_TYPE, indicates a string type (for languages + that distinguish string from array of char). + If set in a INTEGER_TYPE, indicates a character type. */ +#define TYPE_STRING_FLAG(NODE) (TYPE_CHECK (NODE)->type_common.string_flag) + +/* For a VECTOR_TYPE, this is the number of sub-parts of the vector. */ +#define TYPE_VECTOR_SUBPARTS(VECTOR_TYPE) \ + (HOST_WIDE_INT_1U \ + << VECTOR_TYPE_CHECK (VECTOR_TYPE)->type_common.precision) + +/* Set precision to n when we have 2^n sub-parts of the vector. */ +#define SET_TYPE_VECTOR_SUBPARTS(VECTOR_TYPE, X) \ + (VECTOR_TYPE_CHECK (VECTOR_TYPE)->type_common.precision = exact_log2 (X)) + +/* Nonzero in a VECTOR_TYPE if the frontends should not emit warnings + about missing conversions to other vector types of the same size. */ +#define TYPE_VECTOR_OPAQUE(NODE) \ + (VECTOR_TYPE_CHECK (NODE)->base.default_def_flag) + +/* Indicates that objects of this type must be initialized by calling a + function when they are created. */ +#define TYPE_NEEDS_CONSTRUCTING(NODE) \ + (TYPE_CHECK (NODE)->type_common.needs_constructing_flag) + +/* Indicates that a UNION_TYPE object should be passed the same way that + the first union alternative would be passed, or that a RECORD_TYPE + object should be passed the same way that the first (and only) member + would be passed. */ +#define TYPE_TRANSPARENT_AGGR(NODE) \ + (RECORD_OR_UNION_CHECK (NODE)->type_common.transparent_aggr_flag) + +/* For an ARRAY_TYPE, indicates that it is not permitted to take the + address of a component of the type. This is the counterpart of + DECL_NONADDRESSABLE_P for arrays, see the definition of this flag. */ +#define TYPE_NONALIASED_COMPONENT(NODE) \ + (ARRAY_TYPE_CHECK (NODE)->type_common.transparent_aggr_flag) + +/* For an ARRAY_TYPE, a RECORD_TYPE, a UNION_TYPE or a QUAL_UNION_TYPE + whether the array is typeless storage or the type contains a member + with this flag set. Such types are exempt from type-based alias + analysis. For ARRAY_TYPEs with AGGREGATE_TYPE_P element types + the flag should be inherited from the element type, can change + when type is finalized and because of that should not be used in + type hashing. For ARRAY_TYPEs with non-AGGREGATE_TYPE_P element types + the flag should not be changed after the array is created and should + be used in type hashing. */ +#define TYPE_TYPELESS_STORAGE(NODE) \ + (TREE_CHECK4 (NODE, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE, \ + ARRAY_TYPE)->type_common.typeless_storage) + +/* Indicated that objects of this type should be laid out in as + compact a way as possible. */ +#define TYPE_PACKED(NODE) (TYPE_CHECK (NODE)->base.u.bits.packed_flag) + +/* Used by type_contains_placeholder_p to avoid recomputation. + Values are: 0 (unknown), 1 (false), 2 (true). Never access + this field directly. */ +#define TYPE_CONTAINS_PLACEHOLDER_INTERNAL(NODE) \ + (TYPE_CHECK (NODE)->type_common.contains_placeholder_bits) + +/* Nonzero if RECORD_TYPE represents a final derivation of class. */ +#define TYPE_FINAL_P(NODE) \ + (RECORD_OR_UNION_CHECK (NODE)->base.default_def_flag) + +/* The debug output functions use the symtab union field to store + information specific to the debugging format. The different debug + output hooks store different types in the union field. These three + macros are used to access different fields in the union. The debug + hooks are responsible for consistently using only a specific + macro. */ + +/* Symtab field as an integer. Used by stabs generator in dbxout.c to + hold the type's number in the generated stabs. */ +#define TYPE_SYMTAB_ADDRESS(NODE) \ + (TYPE_CHECK (NODE)->type_common.symtab.address) + +/* Symtab field as a string. Used by COFF generator in sdbout.c to + hold struct/union type tag names. */ +#define TYPE_SYMTAB_POINTER(NODE) \ + (TYPE_CHECK (NODE)->type_common.symtab.pointer) + +/* Symtab field as a pointer to a DWARF DIE. Used by DWARF generator + in dwarf2out.c to point to the DIE generated for the type. */ +#define TYPE_SYMTAB_DIE(NODE) \ + (TYPE_CHECK (NODE)->type_common.symtab.die) + +/* The garbage collector needs to know the interpretation of the + symtab field. These constants represent the different types in the + union. */ + +#define TYPE_SYMTAB_IS_ADDRESS (0) +#define TYPE_SYMTAB_IS_POINTER (1) +#define TYPE_SYMTAB_IS_DIE (2) + +#define TYPE_LANG_SPECIFIC(NODE) \ + (TYPE_CHECK (NODE)->type_with_lang_specific.lang_specific) + +#define TYPE_VALUES(NODE) (ENUMERAL_TYPE_CHECK (NODE)->type_non_common.values) +#define TYPE_DOMAIN(NODE) (ARRAY_TYPE_CHECK (NODE)->type_non_common.values) +#define TYPE_FIELDS(NODE) \ + (RECORD_OR_UNION_CHECK (NODE)->type_non_common.values) +#define TYPE_CACHED_VALUES(NODE) (TYPE_CHECK (NODE)->type_non_common.values) +#define TYPE_ARG_TYPES(NODE) \ + (FUNC_OR_METHOD_CHECK (NODE)->type_non_common.values) +#define TYPE_VALUES_RAW(NODE) (TYPE_CHECK (NODE)->type_non_common.values) + +#define TYPE_METHODS(NODE) \ + (RECORD_OR_UNION_CHECK (NODE)->type_non_common.maxval) +#define TYPE_VFIELD(NODE) \ + (RECORD_OR_UNION_CHECK (NODE)->type_non_common.minval) +#define TYPE_METHOD_BASETYPE(NODE) \ + (FUNC_OR_METHOD_CHECK (NODE)->type_non_common.maxval) +#define TYPE_OFFSET_BASETYPE(NODE) \ + (OFFSET_TYPE_CHECK (NODE)->type_non_common.maxval) +#define TYPE_MAXVAL(NODE) (TYPE_CHECK (NODE)->type_non_common.maxval) +#define TYPE_MINVAL(NODE) (TYPE_CHECK (NODE)->type_non_common.minval) +#define TYPE_NEXT_PTR_TO(NODE) \ + (POINTER_TYPE_CHECK (NODE)->type_non_common.minval) +#define TYPE_NEXT_REF_TO(NODE) \ + (REFERENCE_TYPE_CHECK (NODE)->type_non_common.minval) +#define TYPE_MIN_VALUE(NODE) \ + (NUMERICAL_TYPE_CHECK (NODE)->type_non_common.minval) +#define TYPE_MAX_VALUE(NODE) \ + (NUMERICAL_TYPE_CHECK (NODE)->type_non_common.maxval) + +/* If non-NULL, this is an upper bound of the size (in bytes) of an + object of the given ARRAY_TYPE_NON_COMMON. This allows temporaries to be + allocated. */ +#define TYPE_ARRAY_MAX_SIZE(ARRAY_TYPE) \ + (ARRAY_TYPE_CHECK (ARRAY_TYPE)->type_non_common.maxval) + +/* For record and union types, information about this type, as a base type + for itself. */ +#define TYPE_BINFO(NODE) (RECORD_OR_UNION_CHECK (NODE)->type_non_common.binfo) + +/* For non record and union types, used in a language-dependent way. */ +#define TYPE_LANG_SLOT_1(NODE) \ + (NOT_RECORD_OR_UNION_CHECK (NODE)->type_non_common.binfo) + +/* Define accessor macros for information about type inheritance + and basetypes. + + A "basetype" means a particular usage of a data type for inheritance + in another type. Each such basetype usage has its own "binfo" + object to describe it. The binfo object is a TREE_VEC node. + + Inheritance is represented by the binfo nodes allocated for a + given type. For example, given types C and D, such that D is + inherited by C, 3 binfo nodes will be allocated: one for describing + the binfo properties of C, similarly one for D, and one for + describing the binfo properties of D as a base type for C. + Thus, given a pointer to class C, one can get a pointer to the binfo + of D acting as a basetype for C by looking at C's binfo's basetypes. */ + +/* BINFO specific flags. */ + +/* Nonzero means that the derivation chain is via a `virtual' declaration. */ +#define BINFO_VIRTUAL_P(NODE) (TREE_BINFO_CHECK (NODE)->base.static_flag) + +/* Flags for language dependent use. */ +#define BINFO_FLAG_0(NODE) TREE_LANG_FLAG_0 (TREE_BINFO_CHECK (NODE)) +#define BINFO_FLAG_1(NODE) TREE_LANG_FLAG_1 (TREE_BINFO_CHECK (NODE)) +#define BINFO_FLAG_2(NODE) TREE_LANG_FLAG_2 (TREE_BINFO_CHECK (NODE)) +#define BINFO_FLAG_3(NODE) TREE_LANG_FLAG_3 (TREE_BINFO_CHECK (NODE)) +#define BINFO_FLAG_4(NODE) TREE_LANG_FLAG_4 (TREE_BINFO_CHECK (NODE)) +#define BINFO_FLAG_5(NODE) TREE_LANG_FLAG_5 (TREE_BINFO_CHECK (NODE)) +#define BINFO_FLAG_6(NODE) TREE_LANG_FLAG_6 (TREE_BINFO_CHECK (NODE)) + +/* The actual data type node being inherited in this basetype. */ +#define BINFO_TYPE(NODE) TREE_TYPE (TREE_BINFO_CHECK (NODE)) + +/* The offset where this basetype appears in its containing type. + BINFO_OFFSET slot holds the offset (in bytes) + from the base of the complete object to the base of the part of the + object that is allocated on behalf of this `type'. + This is always 0 except when there is multiple inheritance. */ + +#define BINFO_OFFSET(NODE) (TREE_BINFO_CHECK (NODE)->binfo.offset) +#define BINFO_OFFSET_ZEROP(NODE) (integer_zerop (BINFO_OFFSET (NODE))) + +/* The virtual function table belonging to this basetype. Virtual + function tables provide a mechanism for run-time method dispatching. + The entries of a virtual function table are language-dependent. */ + +#define BINFO_VTABLE(NODE) (TREE_BINFO_CHECK (NODE)->binfo.vtable) + +/* The virtual functions in the virtual function table. This is + a TREE_LIST that is used as an initial approximation for building + a virtual function table for this basetype. */ +#define BINFO_VIRTUALS(NODE) (TREE_BINFO_CHECK (NODE)->binfo.virtuals) + +/* A vector of binfos for the direct basetypes inherited by this + basetype. + + If this basetype describes type D as inherited in C, and if the + basetypes of D are E and F, then this vector contains binfos for + inheritance of E and F by C. */ +#define BINFO_BASE_BINFOS(NODE) (&TREE_BINFO_CHECK (NODE)->binfo.base_binfos) + +/* The number of basetypes for NODE. */ +#define BINFO_N_BASE_BINFOS(NODE) (BINFO_BASE_BINFOS (NODE)->length ()) + +/* Accessor macro to get to the Nth base binfo of this binfo. */ +#define BINFO_BASE_BINFO(NODE,N) \ + ((*BINFO_BASE_BINFOS (NODE))[(N)]) +#define BINFO_BASE_ITERATE(NODE,N,B) \ + (BINFO_BASE_BINFOS (NODE)->iterate ((N), &(B))) +#define BINFO_BASE_APPEND(NODE,T) \ + (BINFO_BASE_BINFOS (NODE)->quick_push ((T))) + +/* For a BINFO record describing a virtual base class, i.e., one where + TREE_VIA_VIRTUAL is set, this field assists in locating the virtual + base. The actual contents are language-dependent. In the C++ + front-end this field is an INTEGER_CST giving an offset into the + vtable where the offset to the virtual base can be found. */ +#define BINFO_VPTR_FIELD(NODE) (TREE_BINFO_CHECK (NODE)->binfo.vptr_field) + +/* Indicates the accesses this binfo has to its bases. The values are + access_public_node, access_protected_node or access_private_node. + If this array is not present, public access is implied. */ +#define BINFO_BASE_ACCESSES(NODE) \ + (TREE_BINFO_CHECK (NODE)->binfo.base_accesses) + +#define BINFO_BASE_ACCESS(NODE,N) \ + (*BINFO_BASE_ACCESSES (NODE))[(N)] +#define BINFO_BASE_ACCESS_APPEND(NODE,T) \ + BINFO_BASE_ACCESSES (NODE)->quick_push ((T)) + +/* The index in the VTT where this subobject's sub-VTT can be found. + NULL_TREE if there is no sub-VTT. */ +#define BINFO_SUBVTT_INDEX(NODE) (TREE_BINFO_CHECK (NODE)->binfo.vtt_subvtt) + +/* The index in the VTT where the vptr for this subobject can be + found. NULL_TREE if there is no secondary vptr in the VTT. */ +#define BINFO_VPTR_INDEX(NODE) (TREE_BINFO_CHECK (NODE)->binfo.vtt_vptr) + +/* The BINFO_INHERITANCE_CHAIN points at the binfo for the base + inheriting this base for non-virtual bases. For virtual bases it + points either to the binfo for which this is a primary binfo, or to + the binfo of the most derived type. */ +#define BINFO_INHERITANCE_CHAIN(NODE) \ + (TREE_BINFO_CHECK (NODE)->binfo.inheritance) + + +/* Define fields and accessors for nodes representing declared names. */ + +/* Nonzero if DECL represents an SSA name or a variable that can possibly + have an associated SSA name. */ +#define SSA_VAR_P(DECL) \ + (TREE_CODE (DECL) == VAR_DECL \ + || TREE_CODE (DECL) == PARM_DECL \ + || TREE_CODE (DECL) == RESULT_DECL \ + || TREE_CODE (DECL) == SSA_NAME) + + +#define DECL_CHAIN(NODE) (TREE_CHAIN (DECL_MINIMAL_CHECK (NODE))) + +/* This is the name of the object as written by the user. + It is an IDENTIFIER_NODE. */ +#define DECL_NAME(NODE) (DECL_MINIMAL_CHECK (NODE)->decl_minimal.name) + +/* The IDENTIFIER_NODE associated with the TYPE_NAME field. */ +#define TYPE_IDENTIFIER(NODE) \ + (TYPE_NAME (NODE) && DECL_P (TYPE_NAME (NODE)) \ + ? DECL_NAME (TYPE_NAME (NODE)) : TYPE_NAME (NODE)) + +/* Every ..._DECL node gets a unique number. */ +#define DECL_UID(NODE) (DECL_MINIMAL_CHECK (NODE)->decl_minimal.uid) + +/* DEBUG_EXPR_DECLs get negative UID numbers, to catch erroneous + uses. */ +#define DEBUG_TEMP_UID(NODE) (-DECL_UID (TREE_CHECK ((NODE), DEBUG_EXPR_DECL))) + +/* Every ..._DECL node gets a unique number that stays the same even + when the decl is copied by the inliner once it is set. */ +#define DECL_PT_UID(NODE) \ + (DECL_COMMON_CHECK (NODE)->decl_common.pt_uid == -1u \ + ? (NODE)->decl_minimal.uid : (NODE)->decl_common.pt_uid) +/* Initialize the ..._DECL node pt-uid to the decls uid. */ +#define SET_DECL_PT_UID(NODE, UID) \ + (DECL_COMMON_CHECK (NODE)->decl_common.pt_uid = (UID)) +/* Whether the ..._DECL node pt-uid has been initialized and thus needs to + be preserved when copyin the decl. */ +#define DECL_PT_UID_SET_P(NODE) \ + (DECL_COMMON_CHECK (NODE)->decl_common.pt_uid != -1u) + +/* These two fields describe where in the source code the declaration + was. If the declaration appears in several places (as for a C + function that is declared first and then defined later), this + information should refer to the definition. */ +#define DECL_SOURCE_LOCATION(NODE) \ + (DECL_MINIMAL_CHECK (NODE)->decl_minimal.locus) +#define DECL_SOURCE_FILE(NODE) LOCATION_FILE (DECL_SOURCE_LOCATION (NODE)) +#define DECL_SOURCE_LINE(NODE) LOCATION_LINE (DECL_SOURCE_LOCATION (NODE)) +#define DECL_SOURCE_COLUMN(NODE) LOCATION_COLUMN (DECL_SOURCE_LOCATION (NODE)) +/* This accessor returns TRUE if the decl it operates on was created + by a front-end or back-end rather than by user code. In this case + builtin-ness is indicated by source location. */ +#define DECL_IS_BUILTIN(DECL) \ + (LOCATION_LOCUS (DECL_SOURCE_LOCATION (DECL)) <= BUILTINS_LOCATION) + +#define DECL_LOCATION_RANGE(NODE) \ + (get_decl_source_range (DECL_MINIMAL_CHECK (NODE))) + +/* For FIELD_DECLs, this is the RECORD_TYPE, UNION_TYPE, or + QUAL_UNION_TYPE node that the field is a member of. For VAR_DECL, + PARM_DECL, FUNCTION_DECL, LABEL_DECL, RESULT_DECL, and CONST_DECL + nodes, this points to either the FUNCTION_DECL for the containing + function, the RECORD_TYPE or UNION_TYPE for the containing type, or + NULL_TREE or a TRANSLATION_UNIT_DECL if the given decl has "file + scope". In particular, for VAR_DECLs which are virtual table pointers + (they have DECL_VIRTUAL set), we use DECL_CONTEXT to determine the type + they belong to. */ +#define DECL_CONTEXT(NODE) (DECL_MINIMAL_CHECK (NODE)->decl_minimal.context) +#define DECL_FIELD_CONTEXT(NODE) \ + (FIELD_DECL_CHECK (NODE)->decl_minimal.context) + +/* If nonzero, decl's name shouldn't be emitted into debug info. */ +#define DECL_NAMELESS(NODE) (DECL_MINIMAL_CHECK (NODE)->base.u.bits.nameless_flag) + +/* For any sort of a ..._DECL node, this points to the original (abstract) + decl node which this decl is an inlined/cloned instance of, or else it + is NULL indicating that this decl is not an instance of some other decl. + + The C front-end also uses this in a nested declaration of an inline + function, to point back to the definition. */ +#define DECL_ABSTRACT_ORIGIN(NODE) \ + (DECL_COMMON_CHECK (NODE)->decl_common.abstract_origin) + +/* Like DECL_ABSTRACT_ORIGIN, but returns NODE if there's no abstract + origin. This is useful when setting the DECL_ABSTRACT_ORIGIN. */ +#define DECL_ORIGIN(NODE) \ + (DECL_ABSTRACT_ORIGIN (NODE) ? DECL_ABSTRACT_ORIGIN (NODE) : (NODE)) + +/* Nonzero for any sort of ..._DECL node means this decl node represents an + inline instance of some original (abstract) decl from an inline function; + suppress any warnings about shadowing some other variable. FUNCTION_DECL + nodes can also have their abstract origin set to themselves. */ +#define DECL_FROM_INLINE(NODE) \ + (DECL_ABSTRACT_ORIGIN (NODE) != NULL_TREE \ + && DECL_ABSTRACT_ORIGIN (NODE) != (NODE)) + +/* In a DECL this is the field where attributes are stored. */ +#define DECL_ATTRIBUTES(NODE) \ + (DECL_COMMON_CHECK (NODE)->decl_common.attributes) + +/* For a FUNCTION_DECL, holds the tree of BINDINGs. + For a TRANSLATION_UNIT_DECL, holds the namespace's BLOCK. + For a VAR_DECL, holds the initial value. + For a PARM_DECL, used for DECL_ARG_TYPE--default + values for parameters are encoded in the type of the function, + not in the PARM_DECL slot. + For a FIELD_DECL, this is used for enumeration values and the C + frontend uses it for temporarily storing bitwidth of bitfields. + + ??? Need to figure out some way to check this isn't a PARM_DECL. */ +#define DECL_INITIAL(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.initial) + +/* Holds the size of the datum, in bits, as a tree expression. + Need not be constant. */ +#define DECL_SIZE(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.size) +/* Likewise for the size in bytes. */ +#define DECL_SIZE_UNIT(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.size_unit) +/* Returns the alignment required for the datum, in bits. It must + be a power of two, but an "alignment" of zero is supported + (e.g. as "uninitialized" sentinel). */ +#define DECL_ALIGN(NODE) \ + (DECL_COMMON_CHECK (NODE)->decl_common.align \ + ? ((unsigned)1) << ((NODE)->decl_common.align - 1) : 0) +/* Specify that DECL_ALIGN(NODE) is X. */ +#define SET_DECL_ALIGN(NODE, X) \ + (DECL_COMMON_CHECK (NODE)->decl_common.align = ffs_hwi (X)) + +/* The alignment of NODE, in bytes. */ +#define DECL_ALIGN_UNIT(NODE) (DECL_ALIGN (NODE) / BITS_PER_UNIT) +/* Set if the alignment of this DECL has been set by the user, for + example with an 'aligned' attribute. */ +#define DECL_USER_ALIGN(NODE) \ + (DECL_COMMON_CHECK (NODE)->base.u.bits.user_align) +/* Holds the machine mode corresponding to the declaration of a variable or + field. Always equal to TYPE_MODE (TREE_TYPE (decl)) except for a + FIELD_DECL. */ +#define DECL_MODE(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.mode) +#define SET_DECL_MODE(NODE, MODE) \ + (DECL_COMMON_CHECK (NODE)->decl_common.mode = (MODE)) + +/* For FUNCTION_DECL, if it is built-in, this identifies which built-in + operation it is. Note, however, that this field is overloaded, with + DECL_BUILT_IN_CLASS as the discriminant, so the latter must always be + checked before any access to the former. */ +#define DECL_FUNCTION_CODE(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.function_code) + +#define DECL_FUNCTION_PERSONALITY(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.personality) + +/* Nonzero for a given ..._DECL node means that the name of this node should + be ignored for symbolic debug purposes. For a TYPE_DECL, this means that + the associated type should be ignored. For a FUNCTION_DECL, the body of + the function should also be ignored. */ +#define DECL_IGNORED_P(NODE) \ + (DECL_COMMON_CHECK (NODE)->decl_common.ignored_flag) + +/* Nonzero for a given ..._DECL node means that this node represents an + "abstract instance" of the given declaration (e.g. in the original + declaration of an inline function). When generating symbolic debugging + information, we mustn't try to generate any address information for nodes + marked as "abstract instances" because we don't actually generate + any code or allocate any data space for such instances. */ +#define DECL_ABSTRACT_P(NODE) \ + (DECL_COMMON_CHECK (NODE)->decl_common.abstract_flag) + +/* Language-specific decl information. */ +#define DECL_LANG_SPECIFIC(NODE) \ + (DECL_COMMON_CHECK (NODE)->decl_common.lang_specific) + +/* In a VAR_DECL or FUNCTION_DECL, nonzero means external reference: + do not allocate storage, and refer to a definition elsewhere. Note that + this does not necessarily imply the entity represented by NODE + has no program source-level definition in this translation unit. For + example, for a FUNCTION_DECL, DECL_SAVED_TREE may be non-NULL and + DECL_EXTERNAL may be true simultaneously; that can be the case for + a C99 "extern inline" function. */ +#define DECL_EXTERNAL(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.decl_flag_1) + +/* Nonzero in a ..._DECL means this variable is ref'd from a nested function. + For VAR_DECL nodes, PARM_DECL nodes, and FUNCTION_DECL nodes. + + For LABEL_DECL nodes, nonzero if nonlocal gotos to the label are permitted. + + Also set in some languages for variables, etc., outside the normal + lexical scope, such as class instance variables. */ +#define DECL_NONLOCAL(NODE) \ + (DECL_COMMON_CHECK (NODE)->decl_common.nonlocal_flag) + +/* Used in VAR_DECLs to indicate that the variable is a vtable. + Used in FIELD_DECLs for vtable pointers. + Used in FUNCTION_DECLs to indicate that the function is virtual. */ +#define DECL_VIRTUAL_P(NODE) \ + (DECL_COMMON_CHECK (NODE)->decl_common.virtual_flag) + +/* Used to indicate that this DECL represents a compiler-generated entity. */ +#define DECL_ARTIFICIAL(NODE) \ + (DECL_COMMON_CHECK (NODE)->decl_common.artificial_flag) + +/* Additional flags for language-specific uses. */ +#define DECL_LANG_FLAG_0(NODE) \ + (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_0) +#define DECL_LANG_FLAG_1(NODE) \ + (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_1) +#define DECL_LANG_FLAG_2(NODE) \ + (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_2) +#define DECL_LANG_FLAG_3(NODE) \ + (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_3) +#define DECL_LANG_FLAG_4(NODE) \ + (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_4) +#define DECL_LANG_FLAG_5(NODE) \ + (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_5) +#define DECL_LANG_FLAG_6(NODE) \ + (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_6) +#define DECL_LANG_FLAG_7(NODE) \ + (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_7) +#define DECL_LANG_FLAG_8(NODE) \ + (DECL_COMMON_CHECK (NODE)->decl_common.lang_flag_8) + +/* Nonzero for a scope which is equal to file scope. */ +#define SCOPE_FILE_SCOPE_P(EXP) \ + (! (EXP) || TREE_CODE (EXP) == TRANSLATION_UNIT_DECL) +/* Nonzero for a decl which is at file scope. */ +#define DECL_FILE_SCOPE_P(EXP) SCOPE_FILE_SCOPE_P (DECL_CONTEXT (EXP)) +/* Nonzero for a type which is at file scope. */ +#define TYPE_FILE_SCOPE_P(EXP) SCOPE_FILE_SCOPE_P (TYPE_CONTEXT (EXP)) + +/* Nonzero for a decl that is decorated using attribute used. + This indicates to compiler tools that this decl needs to be preserved. */ +#define DECL_PRESERVE_P(DECL) \ + DECL_COMMON_CHECK (DECL)->decl_common.preserve_flag + +/* For function local variables of COMPLEX and VECTOR types, + indicates that the variable is not aliased, and that all + modifications to the variable have been adjusted so that + they are killing assignments. Thus the variable may now + be treated as a GIMPLE register, and use real instead of + virtual ops in SSA form. */ +#define DECL_GIMPLE_REG_P(DECL) \ + DECL_COMMON_CHECK (DECL)->decl_common.gimple_reg_flag + +extern tree decl_value_expr_lookup (tree); +extern void decl_value_expr_insert (tree, tree); + +/* In a VAR_DECL or PARM_DECL, the location at which the value may be found, + if transformations have made this more complicated than evaluating the + decl itself. */ +#define DECL_HAS_VALUE_EXPR_P(NODE) \ + (TREE_CHECK3 (NODE, VAR_DECL, PARM_DECL, RESULT_DECL) \ + ->decl_common.decl_flag_2) +#define DECL_VALUE_EXPR(NODE) \ + (decl_value_expr_lookup (DECL_WRTL_CHECK (NODE))) +#define SET_DECL_VALUE_EXPR(NODE, VAL) \ + (decl_value_expr_insert (DECL_WRTL_CHECK (NODE), VAL)) + +/* Holds the RTL expression for the value of a variable or function. + This value can be evaluated lazily for functions, variables with + static storage duration, and labels. */ +#define DECL_RTL(NODE) \ + (DECL_WRTL_CHECK (NODE)->decl_with_rtl.rtl \ + ? (NODE)->decl_with_rtl.rtl \ + : (make_decl_rtl (NODE), (NODE)->decl_with_rtl.rtl)) + +/* Set the DECL_RTL for NODE to RTL. */ +#define SET_DECL_RTL(NODE, RTL) set_decl_rtl (NODE, RTL) + +/* Returns nonzero if NODE is a tree node that can contain RTL. */ +#define HAS_RTL_P(NODE) (CODE_CONTAINS_STRUCT (TREE_CODE (NODE), TS_DECL_WRTL)) + +/* Returns nonzero if the DECL_RTL for NODE has already been set. */ +#define DECL_RTL_SET_P(NODE) \ + (HAS_RTL_P (NODE) && DECL_WRTL_CHECK (NODE)->decl_with_rtl.rtl != NULL) + +/* Copy the RTL from NODE1 to NODE2. If the RTL was not set for + NODE1, it will not be set for NODE2; this is a lazy copy. */ +#define COPY_DECL_RTL(NODE1, NODE2) \ + (DECL_WRTL_CHECK (NODE2)->decl_with_rtl.rtl \ + = DECL_WRTL_CHECK (NODE1)->decl_with_rtl.rtl) + +/* The DECL_RTL for NODE, if it is set, or NULL, if it is not set. */ +#define DECL_RTL_IF_SET(NODE) (DECL_RTL_SET_P (NODE) ? DECL_RTL (NODE) : NULL) + +#if (GCC_VERSION >= 2007) +#define DECL_RTL_KNOWN_SET(decl) __extension__ \ +({ tree const __d = (decl); \ + gcc_checking_assert (DECL_RTL_SET_P (__d)); \ + /* Dereference it so the compiler knows it can't be NULL even \ + without assertion checking. */ \ + &*DECL_RTL_IF_SET (__d); }) +#else +#define DECL_RTL_KNOWN_SET(decl) (&*DECL_RTL_IF_SET (decl)) +#endif + +/* In VAR_DECL and PARM_DECL nodes, nonzero means declared `register'. */ +#define DECL_REGISTER(NODE) (DECL_WRTL_CHECK (NODE)->decl_common.decl_flag_0) + +/* In a FIELD_DECL, this is the field position, counting in bytes, of the + DECL_OFFSET_ALIGN-bit-sized word containing the bit closest to the beginning + of the structure. */ +#define DECL_FIELD_OFFSET(NODE) (FIELD_DECL_CHECK (NODE)->field_decl.offset) + +/* In a FIELD_DECL, this is the offset, in bits, of the first bit of the + field from DECL_FIELD_OFFSET. This field may be nonzero even for fields + that are not bit fields (since DECL_OFFSET_ALIGN may be larger than the + natural alignment of the field's type). */ +#define DECL_FIELD_BIT_OFFSET(NODE) \ + (FIELD_DECL_CHECK (NODE)->field_decl.bit_offset) + +/* In a FIELD_DECL, this indicates whether the field was a bit-field and + if so, the type that was originally specified for it. + TREE_TYPE may have been modified (in finish_struct). */ +#define DECL_BIT_FIELD_TYPE(NODE) \ + (FIELD_DECL_CHECK (NODE)->field_decl.bit_field_type) + +/* In a FIELD_DECL of a RECORD_TYPE, this is a pointer to the storage + representative FIELD_DECL. */ +#define DECL_BIT_FIELD_REPRESENTATIVE(NODE) \ + (FIELD_DECL_CHECK (NODE)->field_decl.qualifier) + +/* For a FIELD_DECL in a QUAL_UNION_TYPE, records the expression, which + if nonzero, indicates that the field occupies the type. */ +#define DECL_QUALIFIER(NODE) (FIELD_DECL_CHECK (NODE)->field_decl.qualifier) + +/* For FIELD_DECLs, off_align holds the number of low-order bits of + DECL_FIELD_OFFSET which are known to be always zero. + DECL_OFFSET_ALIGN thus returns the alignment that DECL_FIELD_OFFSET + has. */ +#define DECL_OFFSET_ALIGN(NODE) \ + (((unsigned HOST_WIDE_INT)1) << FIELD_DECL_CHECK (NODE)->decl_common.off_align) + +/* Specify that DECL_OFFSET_ALIGN(NODE) is X. */ +#define SET_DECL_OFFSET_ALIGN(NODE, X) \ + (FIELD_DECL_CHECK (NODE)->decl_common.off_align = ffs_hwi (X) - 1) + +/* For FIELD_DECLS, DECL_FCONTEXT is the *first* baseclass in + which this FIELD_DECL is defined. This information is needed when + writing debugging information about vfield and vbase decls for C++. */ +#define DECL_FCONTEXT(NODE) (FIELD_DECL_CHECK (NODE)->field_decl.fcontext) + +/* In a FIELD_DECL, indicates this field should be bit-packed. */ +#define DECL_PACKED(NODE) (FIELD_DECL_CHECK (NODE)->base.u.bits.packed_flag) + +/* Nonzero in a FIELD_DECL means it is a bit field, and must be accessed + specially. */ +#define DECL_BIT_FIELD(NODE) (FIELD_DECL_CHECK (NODE)->decl_common.decl_flag_1) + +/* Used in a FIELD_DECL to indicate that we cannot form the address of + this component. This makes it possible for Type-Based Alias Analysis + to disambiguate accesses to this field with indirect accesses using + the field's type: + + struct S { int i; } s; + int *p; + + If the flag is set on 'i', TBAA computes that s.i and *p never conflict. + + From the implementation's viewpoint, the alias set of the type of the + field 'i' (int) will not be recorded as a subset of that of the type of + 's' (struct S) in record_component_aliases. The counterpart is that + accesses to s.i must not be given the alias set of the type of 'i' + (int) but instead directly that of the type of 's' (struct S). */ +#define DECL_NONADDRESSABLE_P(NODE) \ + (FIELD_DECL_CHECK (NODE)->decl_common.decl_flag_2) + +/* A numeric unique identifier for a LABEL_DECL. The UID allocation is + dense, unique within any one function, and may be used to index arrays. + If the value is -1, then no UID has been assigned. */ +#define LABEL_DECL_UID(NODE) \ + (LABEL_DECL_CHECK (NODE)->label_decl.label_decl_uid) + +/* In a LABEL_DECL, the EH region number for which the label is the + post_landing_pad. */ +#define EH_LANDING_PAD_NR(NODE) \ + (LABEL_DECL_CHECK (NODE)->label_decl.eh_landing_pad_nr) + +/* For a PARM_DECL, records the data type used to pass the argument, + which may be different from the type seen in the program. */ +#define DECL_ARG_TYPE(NODE) (PARM_DECL_CHECK (NODE)->decl_common.initial) + +/* For PARM_DECL, holds an RTL for the stack slot or register + where the data was actually passed. */ +#define DECL_INCOMING_RTL(NODE) \ + (PARM_DECL_CHECK (NODE)->parm_decl.incoming_rtl) + +/* Nonzero for a given ..._DECL node means that no warnings should be + generated just because this node is unused. */ +#define DECL_IN_SYSTEM_HEADER(NODE) \ + (in_system_header_at (DECL_SOURCE_LOCATION (NODE))) + +/* Used to indicate that the linkage status of this DECL is not yet known, + so it should not be output now. */ +#define DECL_DEFER_OUTPUT(NODE) \ + (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.defer_output) + +/* In a VAR_DECL that's static, + nonzero if the space is in the text section. */ +#define DECL_IN_TEXT_SECTION(NODE) \ + (VAR_DECL_CHECK (NODE)->decl_with_vis.in_text_section) + +/* In a VAR_DECL that's static, + nonzero if it belongs to the global constant pool. */ +#define DECL_IN_CONSTANT_POOL(NODE) \ + (VAR_DECL_CHECK (NODE)->decl_with_vis.in_constant_pool) + +/* Nonzero for a given ..._DECL node means that this node should be + put in .common, if possible. If a DECL_INITIAL is given, and it + is not error_mark_node, then the decl cannot be put in .common. */ +#define DECL_COMMON(NODE) \ + (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.common_flag) + +/* In a VAR_DECL, nonzero if the decl is a register variable with + an explicit asm specification. */ +#define DECL_HARD_REGISTER(NODE) \ + (VAR_DECL_CHECK (NODE)->decl_with_vis.hard_register) + + /* Used to indicate that this DECL has weak linkage. */ +#define DECL_WEAK(NODE) (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.weak_flag) + +/* Used to indicate that the DECL is a dllimport. */ +#define DECL_DLLIMPORT_P(NODE) \ + (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.dllimport_flag) + +/* Used in a DECL to indicate that, even if it TREE_PUBLIC, it need + not be put out unless it is needed in this translation unit. + Entities like this are shared across translation units (like weak + entities), but are guaranteed to be generated by any translation + unit that needs them, and therefore need not be put out anywhere + where they are not needed. DECL_COMDAT is just a hint to the + back-end; it is up to front-ends which set this flag to ensure + that there will never be any harm, other than bloat, in putting out + something which is DECL_COMDAT. */ +#define DECL_COMDAT(NODE) \ + (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.comdat_flag) + +#define DECL_COMDAT_GROUP(NODE) \ + decl_comdat_group (NODE) + +/* Used in TREE_PUBLIC decls to indicate that copies of this DECL in + multiple translation units should be merged. */ +#define DECL_ONE_ONLY(NODE) (DECL_COMDAT_GROUP (NODE) != NULL_TREE \ + && (TREE_PUBLIC (NODE) || DECL_EXTERNAL (NODE))) + +/* The name of the object as the assembler will see it (but before any + translations made by ASM_OUTPUT_LABELREF). Often this is the same + as DECL_NAME. It is an IDENTIFIER_NODE. + + ASSEMBLER_NAME of TYPE_DECLS may store global name of type used for + One Definition Rule based type merging at LTO. It is computed only for + LTO compilation and C++. */ +#define DECL_ASSEMBLER_NAME(NODE) decl_assembler_name (NODE) + +/* Return true if NODE is a NODE that can contain a DECL_ASSEMBLER_NAME. + This is true of all DECL nodes except FIELD_DECL. */ +#define HAS_DECL_ASSEMBLER_NAME_P(NODE) \ + (CODE_CONTAINS_STRUCT (TREE_CODE (NODE), TS_DECL_WITH_VIS)) + +/* Returns nonzero if the DECL_ASSEMBLER_NAME for NODE has been set. If zero, + the NODE might still have a DECL_ASSEMBLER_NAME -- it just hasn't been set + yet. */ +#define DECL_ASSEMBLER_NAME_SET_P(NODE) \ + (HAS_DECL_ASSEMBLER_NAME_P (NODE) \ + && DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.assembler_name != NULL_TREE) + +/* Set the DECL_ASSEMBLER_NAME for NODE to NAME. */ +#define SET_DECL_ASSEMBLER_NAME(NODE, NAME) \ + (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.assembler_name = (NAME)) + +/* Copy the DECL_ASSEMBLER_NAME from DECL1 to DECL2. Note that if DECL1's + DECL_ASSEMBLER_NAME has not yet been set, using this macro will not cause + the DECL_ASSEMBLER_NAME of either DECL to be set. In other words, the + semantics of using this macro, are different than saying: + + SET_DECL_ASSEMBLER_NAME(DECL2, DECL_ASSEMBLER_NAME (DECL1)) + + which will try to set the DECL_ASSEMBLER_NAME for DECL1. */ + +#define COPY_DECL_ASSEMBLER_NAME(DECL1, DECL2) \ + (DECL_ASSEMBLER_NAME_SET_P (DECL1) \ + ? (void) SET_DECL_ASSEMBLER_NAME (DECL2, \ + DECL_ASSEMBLER_NAME (DECL1)) \ + : (void) 0) + +/* Records the section name in a section attribute. Used to pass + the name from decl_attributes to make_function_rtl and make_decl_rtl. */ +#define DECL_SECTION_NAME(NODE) decl_section_name (NODE) + +/* Nonzero in a decl means that the gimplifier has seen (or placed) + this variable in a BIND_EXPR. */ +#define DECL_SEEN_IN_BIND_EXPR_P(NODE) \ + (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.seen_in_bind_expr) + +/* Value of the decls's visibility attribute */ +#define DECL_VISIBILITY(NODE) \ + (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.visibility) + +/* Nonzero means that the decl had its visibility specified rather than + being inferred. */ +#define DECL_VISIBILITY_SPECIFIED(NODE) \ + (DECL_WITH_VIS_CHECK (NODE)->decl_with_vis.visibility_specified) + +/* In a VAR_DECL, the model to use if the data should be allocated from + thread-local storage. */ +#define DECL_TLS_MODEL(NODE) decl_tls_model (NODE) + +/* In a VAR_DECL, nonzero if the data should be allocated from + thread-local storage. */ +#define DECL_THREAD_LOCAL_P(NODE) \ + ((TREE_STATIC (NODE) || DECL_EXTERNAL (NODE)) && decl_tls_model (NODE) >= TLS_MODEL_REAL) + +/* In a non-local VAR_DECL with static storage duration, true if the + variable has an initialization priority. If false, the variable + will be initialized at the DEFAULT_INIT_PRIORITY. */ +#define DECL_HAS_INIT_PRIORITY_P(NODE) \ + (VAR_DECL_CHECK (NODE)->decl_with_vis.init_priority_p) + +extern tree decl_debug_expr_lookup (tree); +extern void decl_debug_expr_insert (tree, tree); + +/* For VAR_DECL, this is set to an expression that it was split from. */ +#define DECL_HAS_DEBUG_EXPR_P(NODE) \ + (VAR_DECL_CHECK (NODE)->decl_common.debug_expr_is_from) +#define DECL_DEBUG_EXPR(NODE) \ + (decl_debug_expr_lookup (VAR_DECL_CHECK (NODE))) + +#define SET_DECL_DEBUG_EXPR(NODE, VAL) \ + (decl_debug_expr_insert (VAR_DECL_CHECK (NODE), VAL)) + +extern priority_type decl_init_priority_lookup (tree); +extern priority_type decl_fini_priority_lookup (tree); +extern void decl_init_priority_insert (tree, priority_type); +extern void decl_fini_priority_insert (tree, priority_type); + +/* For a VAR_DECL or FUNCTION_DECL the initialization priority of + NODE. */ +#define DECL_INIT_PRIORITY(NODE) \ + (decl_init_priority_lookup (NODE)) +/* Set the initialization priority for NODE to VAL. */ +#define SET_DECL_INIT_PRIORITY(NODE, VAL) \ + (decl_init_priority_insert (NODE, VAL)) + +/* For a FUNCTION_DECL the finalization priority of NODE. */ +#define DECL_FINI_PRIORITY(NODE) \ + (decl_fini_priority_lookup (NODE)) +/* Set the finalization priority for NODE to VAL. */ +#define SET_DECL_FINI_PRIORITY(NODE, VAL) \ + (decl_fini_priority_insert (NODE, VAL)) + +/* The initialization priority for entities for which no explicit + initialization priority has been specified. */ +#define DEFAULT_INIT_PRIORITY 65535 + +/* The maximum allowed initialization priority. */ +#define MAX_INIT_PRIORITY 65535 + +/* The largest priority value reserved for use by system runtime + libraries. */ +#define MAX_RESERVED_INIT_PRIORITY 100 + +/* In a VAR_DECL, nonzero if this is a global variable for VOPs. */ +#define VAR_DECL_IS_VIRTUAL_OPERAND(NODE) \ + (VAR_DECL_CHECK (NODE)->base.u.bits.saturating_flag) + +/* In a VAR_DECL, nonzero if this is a non-local frame structure. */ +#define DECL_NONLOCAL_FRAME(NODE) \ + (VAR_DECL_CHECK (NODE)->base.default_def_flag) + +/* In a VAR_DECL, nonzero if this variable is not aliased by any pointer. */ +#define DECL_NONALIASED(NODE) \ + (VAR_DECL_CHECK (NODE)->base.nothrow_flag) + +/* This field is used to reference anything in decl.result and is meant only + for use by the garbage collector. */ +#define DECL_RESULT_FLD(NODE) \ + (DECL_NON_COMMON_CHECK (NODE)->decl_non_common.result) + +/* The DECL_VINDEX is used for FUNCTION_DECLS in two different ways. + Before the struct containing the FUNCTION_DECL is laid out, + DECL_VINDEX may point to a FUNCTION_DECL in a base class which + is the FUNCTION_DECL which this FUNCTION_DECL will replace as a virtual + function. When the class is laid out, this pointer is changed + to an INTEGER_CST node which is suitable for use as an index + into the virtual function table. */ +#define DECL_VINDEX(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.vindex) + +/* In FUNCTION_DECL, holds the decl for the return value. */ +#define DECL_RESULT(NODE) (FUNCTION_DECL_CHECK (NODE)->decl_non_common.result) + +/* In a FUNCTION_DECL, nonzero if the function cannot be inlined. */ +#define DECL_UNINLINABLE(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.uninlinable) + +/* In a FUNCTION_DECL, the saved representation of the body of the + entire function. */ +#define DECL_SAVED_TREE(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.saved_tree) + +/* Nonzero in a FUNCTION_DECL means this function should be treated + as if it were a malloc, meaning it returns a pointer that is + not an alias. */ +#define DECL_IS_MALLOC(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.malloc_flag) + +/* Nonzero in a FUNCTION_DECL means this function should be treated as + C++ operator new, meaning that it returns a pointer for which we + should not use type based aliasing. */ +#define DECL_IS_OPERATOR_NEW(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.operator_new_flag) + +/* Nonzero in a FUNCTION_DECL means this function may return more + than once. */ +#define DECL_IS_RETURNS_TWICE(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.returns_twice_flag) + +/* Nonzero in a FUNCTION_DECL means this function should be treated + as "pure" function (like const function, but may read global memory). */ +#define DECL_PURE_P(NODE) (FUNCTION_DECL_CHECK (NODE)->function_decl.pure_flag) + +/* Nonzero only if one of TREE_READONLY or DECL_PURE_P is nonzero AND + the const or pure function may not terminate. When this is nonzero + for a const or pure function, it can be dealt with by cse passes + but cannot be removed by dce passes since you are not allowed to + change an infinite looping program into one that terminates without + error. */ +#define DECL_LOOPING_CONST_OR_PURE_P(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.looping_const_or_pure_flag) + +/* Nonzero in a FUNCTION_DECL means this function should be treated + as "novops" function (function that does not read global memory, + but may have arbitrary side effects). */ +#define DECL_IS_NOVOPS(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.novops_flag) + +/* Used in FUNCTION_DECLs to indicate that they should be run automatically + at the beginning or end of execution. */ +#define DECL_STATIC_CONSTRUCTOR(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.static_ctor_flag) + +#define DECL_STATIC_DESTRUCTOR(NODE) \ +(FUNCTION_DECL_CHECK (NODE)->function_decl.static_dtor_flag) + +/* Used in FUNCTION_DECLs to indicate that function entry and exit should + be instrumented with calls to support routines. */ +#define DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.no_instrument_function_entry_exit) + +/* Used in FUNCTION_DECLs to indicate that limit-stack-* should be + disabled in this function. */ +#define DECL_NO_LIMIT_STACK(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.no_limit_stack) + +/* In a FUNCTION_DECL indicates that a static chain is needed. */ +#define DECL_STATIC_CHAIN(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->decl_with_vis.regdecl_flag) + +/* Nonzero for a decl that cgraph has decided should be inlined into + at least one call site. It is not meaningful to look at this + directly; always use cgraph_function_possibly_inlined_p. */ +#define DECL_POSSIBLY_INLINED(DECL) \ + FUNCTION_DECL_CHECK (DECL)->function_decl.possibly_inlined + +/* Nonzero in a FUNCTION_DECL means that this function was declared inline, + such as via the `inline' keyword in C/C++. This flag controls the linkage + semantics of 'inline' */ +#define DECL_DECLARED_INLINE_P(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.declared_inline_flag) + +/* Nonzero in a FUNCTION_DECL means this function should not get + -Winline warnings. */ +#define DECL_NO_INLINE_WARNING_P(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.no_inline_warning_flag) + +/* Nonzero if a FUNCTION_CODE is a TM load/store. */ +#define BUILTIN_TM_LOAD_STORE_P(FN) \ + ((FN) >= BUILT_IN_TM_STORE_1 && (FN) <= BUILT_IN_TM_LOAD_RFW_LDOUBLE) + +/* Nonzero if a FUNCTION_CODE is a TM load. */ +#define BUILTIN_TM_LOAD_P(FN) \ + ((FN) >= BUILT_IN_TM_LOAD_1 && (FN) <= BUILT_IN_TM_LOAD_RFW_LDOUBLE) + +/* Nonzero if a FUNCTION_CODE is a TM store. */ +#define BUILTIN_TM_STORE_P(FN) \ + ((FN) >= BUILT_IN_TM_STORE_1 && (FN) <= BUILT_IN_TM_STORE_WAW_LDOUBLE) + +#define CASE_BUILT_IN_TM_LOAD(FN) \ + case BUILT_IN_TM_LOAD_##FN: \ + case BUILT_IN_TM_LOAD_RAR_##FN: \ + case BUILT_IN_TM_LOAD_RAW_##FN: \ + case BUILT_IN_TM_LOAD_RFW_##FN + +#define CASE_BUILT_IN_TM_STORE(FN) \ + case BUILT_IN_TM_STORE_##FN: \ + case BUILT_IN_TM_STORE_WAR_##FN: \ + case BUILT_IN_TM_STORE_WAW_##FN + +/* Nonzero in a FUNCTION_DECL that should be always inlined by the inliner + disregarding size and cost heuristics. This is equivalent to using + the always_inline attribute without the required diagnostics if the + function cannot be inlined. */ +#define DECL_DISREGARD_INLINE_LIMITS(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.disregard_inline_limits) + +extern vec **decl_debug_args_lookup (tree); +extern vec **decl_debug_args_insert (tree); + +/* Nonzero if a FUNCTION_DECL has DEBUG arguments attached to it. */ +#define DECL_HAS_DEBUG_ARGS_P(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.has_debug_args_flag) + +/* For FUNCTION_DECL, this holds a pointer to a structure ("struct function") + that describes the status of this function. */ +#define DECL_STRUCT_FUNCTION(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.f) + +/* In a FUNCTION_DECL, nonzero means a built in function of a + standard library or more generally a built in function that is + recognized by optimizers and expanders. + + Note that it is different from the DECL_IS_BUILTIN accessor. For + instance, user declared prototypes of C library functions are not + DECL_IS_BUILTIN but may be DECL_BUILT_IN. */ +#define DECL_BUILT_IN(NODE) (DECL_BUILT_IN_CLASS (NODE) != NOT_BUILT_IN) + +/* For a builtin function, identify which part of the compiler defined it. */ +#define DECL_BUILT_IN_CLASS(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.built_in_class) + +/* In FUNCTION_DECL, a chain of ..._DECL nodes. */ +#define DECL_ARGUMENTS(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.arguments) + +/* In FUNCTION_DECL, the function specific target options to use when compiling + this function. */ +#define DECL_FUNCTION_SPECIFIC_TARGET(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.function_specific_target) + +/* In FUNCTION_DECL, the function specific optimization options to use when + compiling this function. */ +#define DECL_FUNCTION_SPECIFIC_OPTIMIZATION(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.function_specific_optimization) + +/* In FUNCTION_DECL, this is set if this function has other versions generated + using "target" attributes. The default version is the one which does not + have any "target" attribute set. */ +#define DECL_FUNCTION_VERSIONED(NODE)\ + (FUNCTION_DECL_CHECK (NODE)->function_decl.versioned_function) + +/* In FUNCTION_DECL, this is set if this function is a C++ constructor. + Devirtualization machinery uses this knowledge for determing type of the + object constructed. Also we assume that constructor address is not + important. */ +#define DECL_CXX_CONSTRUCTOR_P(NODE)\ + (FUNCTION_DECL_CHECK (NODE)->decl_with_vis.cxx_constructor) + +/* In FUNCTION_DECL, this is set if this function is a C++ destructor. + Devirtualization machinery uses this to track types in destruction. */ +#define DECL_CXX_DESTRUCTOR_P(NODE)\ + (FUNCTION_DECL_CHECK (NODE)->decl_with_vis.cxx_destructor) + +/* In FUNCTION_DECL that represent an virtual method this is set when + the method is final. */ +#define DECL_FINAL_P(NODE)\ + (FUNCTION_DECL_CHECK (NODE)->decl_with_vis.final) + +/* The source language of the translation-unit. */ +#define TRANSLATION_UNIT_LANGUAGE(NODE) \ + (TRANSLATION_UNIT_DECL_CHECK (NODE)->translation_unit_decl.language) + +/* TRANSLATION_UNIT_DECL inherits from DECL_MINIMAL. */ + +/* For a TYPE_DECL, holds the "original" type. (TREE_TYPE has the copy.) */ +#define DECL_ORIGINAL_TYPE(NODE) \ + (TYPE_DECL_CHECK (NODE)->decl_non_common.result) + +/* In a TYPE_DECL nonzero means the detail info about this type is not dumped + into stabs. Instead it will generate cross reference ('x') of names. + This uses the same flag as DECL_EXTERNAL. */ +#define TYPE_DECL_SUPPRESS_DEBUG(NODE) \ + (TYPE_DECL_CHECK (NODE)->decl_common.decl_flag_1) + +/* Getter of the imported declaration associated to the + IMPORTED_DECL node. */ +#define IMPORTED_DECL_ASSOCIATED_DECL(NODE) \ +(DECL_INITIAL (IMPORTED_DECL_CHECK (NODE))) + +/* Getter of the symbol declaration associated with the + NAMELIST_DECL node. */ +#define NAMELIST_DECL_ASSOCIATED_DECL(NODE) \ + (DECL_INITIAL (NODE)) + +/* A STATEMENT_LIST chains statements together in GENERIC and GIMPLE. + To reduce overhead, the nodes containing the statements are not trees. + This avoids the overhead of tree_common on all linked list elements. + + Use the interface in tree-iterator.h to access this node. */ + +#define STATEMENT_LIST_HEAD(NODE) \ + (STATEMENT_LIST_CHECK (NODE)->stmt_list.head) +#define STATEMENT_LIST_TAIL(NODE) \ + (STATEMENT_LIST_CHECK (NODE)->stmt_list.tail) + +#define TREE_OPTIMIZATION(NODE) \ + (OPTIMIZATION_NODE_CHECK (NODE)->optimization.opts) + +#define TREE_OPTIMIZATION_OPTABS(NODE) \ + (OPTIMIZATION_NODE_CHECK (NODE)->optimization.optabs) + +#define TREE_OPTIMIZATION_BASE_OPTABS(NODE) \ + (OPTIMIZATION_NODE_CHECK (NODE)->optimization.base_optabs) + +/* Return a tree node that encapsulates the optimization options in OPTS. */ +extern tree build_optimization_node (struct gcc_options *opts); + +#define TREE_TARGET_OPTION(NODE) \ + (TARGET_OPTION_NODE_CHECK (NODE)->target_option.opts) + +#define TREE_TARGET_GLOBALS(NODE) \ + (TARGET_OPTION_NODE_CHECK (NODE)->target_option.globals) + +/* Return a tree node that encapsulates the target options in OPTS. */ +extern tree build_target_option_node (struct gcc_options *opts); + +extern void prepare_target_option_nodes_for_pch (void); + +#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007) + +inline tree +tree_check (tree __t, const char *__f, int __l, const char *__g, tree_code __c) +{ + if (TREE_CODE (__t) != __c) + tree_check_failed (__t, __f, __l, __g, __c, 0); + return __t; +} + +inline tree +tree_not_check (tree __t, const char *__f, int __l, const char *__g, + enum tree_code __c) +{ + if (TREE_CODE (__t) == __c) + tree_not_check_failed (__t, __f, __l, __g, __c, 0); + return __t; +} + +inline tree +tree_check2 (tree __t, const char *__f, int __l, const char *__g, + enum tree_code __c1, enum tree_code __c2) +{ + if (TREE_CODE (__t) != __c1 + && TREE_CODE (__t) != __c2) + tree_check_failed (__t, __f, __l, __g, __c1, __c2, 0); + return __t; +} + +inline tree +tree_not_check2 (tree __t, const char *__f, int __l, const char *__g, + enum tree_code __c1, enum tree_code __c2) +{ + if (TREE_CODE (__t) == __c1 + || TREE_CODE (__t) == __c2) + tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, 0); + return __t; +} + +inline tree +tree_check3 (tree __t, const char *__f, int __l, const char *__g, + enum tree_code __c1, enum tree_code __c2, enum tree_code __c3) +{ + if (TREE_CODE (__t) != __c1 + && TREE_CODE (__t) != __c2 + && TREE_CODE (__t) != __c3) + tree_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, 0); + return __t; +} + +inline tree +tree_not_check3 (tree __t, const char *__f, int __l, const char *__g, + enum tree_code __c1, enum tree_code __c2, enum tree_code __c3) +{ + if (TREE_CODE (__t) == __c1 + || TREE_CODE (__t) == __c2 + || TREE_CODE (__t) == __c3) + tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, 0); + return __t; +} + +inline tree +tree_check4 (tree __t, const char *__f, int __l, const char *__g, + enum tree_code __c1, enum tree_code __c2, enum tree_code __c3, + enum tree_code __c4) +{ + if (TREE_CODE (__t) != __c1 + && TREE_CODE (__t) != __c2 + && TREE_CODE (__t) != __c3 + && TREE_CODE (__t) != __c4) + tree_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, 0); + return __t; +} + +inline tree +tree_not_check4 (tree __t, const char *__f, int __l, const char *__g, + enum tree_code __c1, enum tree_code __c2, enum tree_code __c3, + enum tree_code __c4) +{ + if (TREE_CODE (__t) == __c1 + || TREE_CODE (__t) == __c2 + || TREE_CODE (__t) == __c3 + || TREE_CODE (__t) == __c4) + tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, 0); + return __t; +} + +inline tree +tree_check5 (tree __t, const char *__f, int __l, const char *__g, + enum tree_code __c1, enum tree_code __c2, enum tree_code __c3, + enum tree_code __c4, enum tree_code __c5) +{ + if (TREE_CODE (__t) != __c1 + && TREE_CODE (__t) != __c2 + && TREE_CODE (__t) != __c3 + && TREE_CODE (__t) != __c4 + && TREE_CODE (__t) != __c5) + tree_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, __c5, 0); + return __t; +} + +inline tree +tree_not_check5 (tree __t, const char *__f, int __l, const char *__g, + enum tree_code __c1, enum tree_code __c2, enum tree_code __c3, + enum tree_code __c4, enum tree_code __c5) +{ + if (TREE_CODE (__t) == __c1 + || TREE_CODE (__t) == __c2 + || TREE_CODE (__t) == __c3 + || TREE_CODE (__t) == __c4 + || TREE_CODE (__t) == __c5) + tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, __c5, 0); + return __t; +} + +inline tree +contains_struct_check (tree __t, const enum tree_node_structure_enum __s, + const char *__f, int __l, const char *__g) +{ + if (tree_contains_struct[TREE_CODE (__t)][__s] != 1) + tree_contains_struct_check_failed (__t, __s, __f, __l, __g); + return __t; +} + +inline tree +tree_class_check (tree __t, const enum tree_code_class __class, + const char *__f, int __l, const char *__g) +{ + if (TREE_CODE_CLASS (TREE_CODE (__t)) != __class) + tree_class_check_failed (__t, __class, __f, __l, __g); + return __t; +} + +inline tree +tree_range_check (tree __t, + enum tree_code __code1, enum tree_code __code2, + const char *__f, int __l, const char *__g) +{ + if (TREE_CODE (__t) < __code1 || TREE_CODE (__t) > __code2) + tree_range_check_failed (__t, __f, __l, __g, __code1, __code2); + return __t; +} + +inline tree +omp_clause_subcode_check (tree __t, enum omp_clause_code __code, + const char *__f, int __l, const char *__g) +{ + if (TREE_CODE (__t) != OMP_CLAUSE) + tree_check_failed (__t, __f, __l, __g, OMP_CLAUSE, 0); + if (__t->omp_clause.code != __code) + omp_clause_check_failed (__t, __f, __l, __g, __code); + return __t; +} + +inline tree +omp_clause_range_check (tree __t, + enum omp_clause_code __code1, + enum omp_clause_code __code2, + const char *__f, int __l, const char *__g) +{ + if (TREE_CODE (__t) != OMP_CLAUSE) + tree_check_failed (__t, __f, __l, __g, OMP_CLAUSE, 0); + if ((int) __t->omp_clause.code < (int) __code1 + || (int) __t->omp_clause.code > (int) __code2) + omp_clause_range_check_failed (__t, __f, __l, __g, __code1, __code2); + return __t; +} + +/* These checks have to be special cased. */ + +inline tree +expr_check (tree __t, const char *__f, int __l, const char *__g) +{ + char const __c = TREE_CODE_CLASS (TREE_CODE (__t)); + if (!IS_EXPR_CODE_CLASS (__c)) + tree_class_check_failed (__t, tcc_expression, __f, __l, __g); + return __t; +} + +/* These checks have to be special cased. */ + +inline tree +non_type_check (tree __t, const char *__f, int __l, const char *__g) +{ + if (TYPE_P (__t)) + tree_not_class_check_failed (__t, tcc_type, __f, __l, __g); + return __t; +} + +inline const HOST_WIDE_INT * +tree_int_cst_elt_check (const_tree __t, int __i, + const char *__f, int __l, const char *__g) +{ + if (TREE_CODE (__t) != INTEGER_CST) + tree_check_failed (__t, __f, __l, __g, INTEGER_CST, 0); + if (__i < 0 || __i >= __t->base.u.int_length.extended) + tree_int_cst_elt_check_failed (__i, __t->base.u.int_length.extended, + __f, __l, __g); + return &CONST_CAST_TREE (__t)->int_cst.val[__i]; +} + +inline HOST_WIDE_INT * +tree_int_cst_elt_check (tree __t, int __i, + const char *__f, int __l, const char *__g) +{ + if (TREE_CODE (__t) != INTEGER_CST) + tree_check_failed (__t, __f, __l, __g, INTEGER_CST, 0); + if (__i < 0 || __i >= __t->base.u.int_length.extended) + tree_int_cst_elt_check_failed (__i, __t->base.u.int_length.extended, + __f, __l, __g); + return &CONST_CAST_TREE (__t)->int_cst.val[__i]; +} + +/* Workaround -Wstrict-overflow false positive during profiledbootstrap. */ + +# if GCC_VERSION >= 4006 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-overflow" +#endif + +inline tree * +tree_vec_elt_check (tree __t, int __i, + const char *__f, int __l, const char *__g) +{ + if (TREE_CODE (__t) != TREE_VEC) + tree_check_failed (__t, __f, __l, __g, TREE_VEC, 0); + if (__i < 0 || __i >= __t->base.u.length) + tree_vec_elt_check_failed (__i, __t->base.u.length, __f, __l, __g); + return &CONST_CAST_TREE (__t)->vec.a[__i]; +} + +# if GCC_VERSION >= 4006 +#pragma GCC diagnostic pop +#endif + +inline tree * +omp_clause_elt_check (tree __t, int __i, + const char *__f, int __l, const char *__g) +{ + if (TREE_CODE (__t) != OMP_CLAUSE) + tree_check_failed (__t, __f, __l, __g, OMP_CLAUSE, 0); + if (__i < 0 || __i >= omp_clause_num_ops [__t->omp_clause.code]) + omp_clause_operand_check_failed (__i, __t, __f, __l, __g); + return &__t->omp_clause.ops[__i]; +} + +/* These checks have to be special cased. */ + +inline tree +any_integral_type_check (tree __t, const char *__f, int __l, const char *__g) +{ + if (!ANY_INTEGRAL_TYPE_P (__t)) + tree_check_failed (__t, __f, __l, __g, BOOLEAN_TYPE, ENUMERAL_TYPE, + INTEGER_TYPE, 0); + return __t; +} + +inline const_tree +tree_check (const_tree __t, const char *__f, int __l, const char *__g, + tree_code __c) +{ + if (TREE_CODE (__t) != __c) + tree_check_failed (__t, __f, __l, __g, __c, 0); + return __t; +} + +inline const_tree +tree_not_check (const_tree __t, const char *__f, int __l, const char *__g, + enum tree_code __c) +{ + if (TREE_CODE (__t) == __c) + tree_not_check_failed (__t, __f, __l, __g, __c, 0); + return __t; +} + +inline const_tree +tree_check2 (const_tree __t, const char *__f, int __l, const char *__g, + enum tree_code __c1, enum tree_code __c2) +{ + if (TREE_CODE (__t) != __c1 + && TREE_CODE (__t) != __c2) + tree_check_failed (__t, __f, __l, __g, __c1, __c2, 0); + return __t; +} + +inline const_tree +tree_not_check2 (const_tree __t, const char *__f, int __l, const char *__g, + enum tree_code __c1, enum tree_code __c2) +{ + if (TREE_CODE (__t) == __c1 + || TREE_CODE (__t) == __c2) + tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, 0); + return __t; +} + +inline const_tree +tree_check3 (const_tree __t, const char *__f, int __l, const char *__g, + enum tree_code __c1, enum tree_code __c2, enum tree_code __c3) +{ + if (TREE_CODE (__t) != __c1 + && TREE_CODE (__t) != __c2 + && TREE_CODE (__t) != __c3) + tree_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, 0); + return __t; +} + +inline const_tree +tree_not_check3 (const_tree __t, const char *__f, int __l, const char *__g, + enum tree_code __c1, enum tree_code __c2, enum tree_code __c3) +{ + if (TREE_CODE (__t) == __c1 + || TREE_CODE (__t) == __c2 + || TREE_CODE (__t) == __c3) + tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, 0); + return __t; +} + +inline const_tree +tree_check4 (const_tree __t, const char *__f, int __l, const char *__g, + enum tree_code __c1, enum tree_code __c2, enum tree_code __c3, + enum tree_code __c4) +{ + if (TREE_CODE (__t) != __c1 + && TREE_CODE (__t) != __c2 + && TREE_CODE (__t) != __c3 + && TREE_CODE (__t) != __c4) + tree_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, 0); + return __t; +} + +inline const_tree +tree_not_check4 (const_tree __t, const char *__f, int __l, const char *__g, + enum tree_code __c1, enum tree_code __c2, enum tree_code __c3, + enum tree_code __c4) +{ + if (TREE_CODE (__t) == __c1 + || TREE_CODE (__t) == __c2 + || TREE_CODE (__t) == __c3 + || TREE_CODE (__t) == __c4) + tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, 0); + return __t; +} + +inline const_tree +tree_check5 (const_tree __t, const char *__f, int __l, const char *__g, + enum tree_code __c1, enum tree_code __c2, enum tree_code __c3, + enum tree_code __c4, enum tree_code __c5) +{ + if (TREE_CODE (__t) != __c1 + && TREE_CODE (__t) != __c2 + && TREE_CODE (__t) != __c3 + && TREE_CODE (__t) != __c4 + && TREE_CODE (__t) != __c5) + tree_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, __c5, 0); + return __t; +} + +inline const_tree +tree_not_check5 (const_tree __t, const char *__f, int __l, const char *__g, + enum tree_code __c1, enum tree_code __c2, enum tree_code __c3, + enum tree_code __c4, enum tree_code __c5) +{ + if (TREE_CODE (__t) == __c1 + || TREE_CODE (__t) == __c2 + || TREE_CODE (__t) == __c3 + || TREE_CODE (__t) == __c4 + || TREE_CODE (__t) == __c5) + tree_not_check_failed (__t, __f, __l, __g, __c1, __c2, __c3, __c4, __c5, 0); + return __t; +} + +inline const_tree +contains_struct_check (const_tree __t, const enum tree_node_structure_enum __s, + const char *__f, int __l, const char *__g) +{ + if (tree_contains_struct[TREE_CODE (__t)][__s] != 1) + tree_contains_struct_check_failed (__t, __s, __f, __l, __g); + return __t; +} + +inline const_tree +tree_class_check (const_tree __t, const enum tree_code_class __class, + const char *__f, int __l, const char *__g) +{ + if (TREE_CODE_CLASS (TREE_CODE (__t)) != __class) + tree_class_check_failed (__t, __class, __f, __l, __g); + return __t; +} + +inline const_tree +tree_range_check (const_tree __t, + enum tree_code __code1, enum tree_code __code2, + const char *__f, int __l, const char *__g) +{ + if (TREE_CODE (__t) < __code1 || TREE_CODE (__t) > __code2) + tree_range_check_failed (__t, __f, __l, __g, __code1, __code2); + return __t; +} + +inline const_tree +omp_clause_subcode_check (const_tree __t, enum omp_clause_code __code, + const char *__f, int __l, const char *__g) +{ + if (TREE_CODE (__t) != OMP_CLAUSE) + tree_check_failed (__t, __f, __l, __g, OMP_CLAUSE, 0); + if (__t->omp_clause.code != __code) + omp_clause_check_failed (__t, __f, __l, __g, __code); + return __t; +} + +inline const_tree +omp_clause_range_check (const_tree __t, + enum omp_clause_code __code1, + enum omp_clause_code __code2, + const char *__f, int __l, const char *__g) +{ + if (TREE_CODE (__t) != OMP_CLAUSE) + tree_check_failed (__t, __f, __l, __g, OMP_CLAUSE, 0); + if ((int) __t->omp_clause.code < (int) __code1 + || (int) __t->omp_clause.code > (int) __code2) + omp_clause_range_check_failed (__t, __f, __l, __g, __code1, __code2); + return __t; +} + +inline const_tree +expr_check (const_tree __t, const char *__f, int __l, const char *__g) +{ + char const __c = TREE_CODE_CLASS (TREE_CODE (__t)); + if (!IS_EXPR_CODE_CLASS (__c)) + tree_class_check_failed (__t, tcc_expression, __f, __l, __g); + return __t; +} + +inline const_tree +non_type_check (const_tree __t, const char *__f, int __l, const char *__g) +{ + if (TYPE_P (__t)) + tree_not_class_check_failed (__t, tcc_type, __f, __l, __g); + return __t; +} + +# if GCC_VERSION >= 4006 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-overflow" +#endif + +inline const_tree * +tree_vec_elt_check (const_tree __t, int __i, + const char *__f, int __l, const char *__g) +{ + if (TREE_CODE (__t) != TREE_VEC) + tree_check_failed (__t, __f, __l, __g, TREE_VEC, 0); + if (__i < 0 || __i >= __t->base.u.length) + tree_vec_elt_check_failed (__i, __t->base.u.length, __f, __l, __g); + return CONST_CAST (const_tree *, &__t->vec.a[__i]); + //return &__t->vec.a[__i]; +} + +# if GCC_VERSION >= 4006 +#pragma GCC diagnostic pop +#endif + +inline const_tree * +omp_clause_elt_check (const_tree __t, int __i, + const char *__f, int __l, const char *__g) +{ + if (TREE_CODE (__t) != OMP_CLAUSE) + tree_check_failed (__t, __f, __l, __g, OMP_CLAUSE, 0); + if (__i < 0 || __i >= omp_clause_num_ops [__t->omp_clause.code]) + omp_clause_operand_check_failed (__i, __t, __f, __l, __g); + return CONST_CAST (const_tree *, &__t->omp_clause.ops[__i]); +} + +inline const_tree +any_integral_type_check (const_tree __t, const char *__f, int __l, + const char *__g) +{ + if (!ANY_INTEGRAL_TYPE_P (__t)) + tree_check_failed (__t, __f, __l, __g, BOOLEAN_TYPE, ENUMERAL_TYPE, + INTEGER_TYPE, 0); + return __t; +} + +#endif + +/* Compute the number of operands in an expression node NODE. For + tcc_vl_exp nodes like CALL_EXPRs, this is stored in the node itself, + otherwise it is looked up from the node's code. */ +static inline int +tree_operand_length (const_tree node) +{ + if (VL_EXP_CLASS_P (node)) + return VL_EXP_OPERAND_LENGTH (node); + else + return TREE_CODE_LENGTH (TREE_CODE (node)); +} + +#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007) + +/* Special checks for TREE_OPERANDs. */ +inline tree * +tree_operand_check (tree __t, int __i, + const char *__f, int __l, const char *__g) +{ + const_tree __u = EXPR_CHECK (__t); + if (__i < 0 || __i >= TREE_OPERAND_LENGTH (__u)) + tree_operand_check_failed (__i, __u, __f, __l, __g); + return &CONST_CAST_TREE (__u)->exp.operands[__i]; +} + +inline tree * +tree_operand_check_code (tree __t, enum tree_code __code, int __i, + const char *__f, int __l, const char *__g) +{ + if (TREE_CODE (__t) != __code) + tree_check_failed (__t, __f, __l, __g, __code, 0); + if (__i < 0 || __i >= TREE_OPERAND_LENGTH (__t)) + tree_operand_check_failed (__i, __t, __f, __l, __g); + return &__t->exp.operands[__i]; +} + +inline const_tree * +tree_operand_check (const_tree __t, int __i, + const char *__f, int __l, const char *__g) +{ + const_tree __u = EXPR_CHECK (__t); + if (__i < 0 || __i >= TREE_OPERAND_LENGTH (__u)) + tree_operand_check_failed (__i, __u, __f, __l, __g); + return CONST_CAST (const_tree *, &__u->exp.operands[__i]); +} + +inline const_tree * +tree_operand_check_code (const_tree __t, enum tree_code __code, int __i, + const char *__f, int __l, const char *__g) +{ + if (TREE_CODE (__t) != __code) + tree_check_failed (__t, __f, __l, __g, __code, 0); + if (__i < 0 || __i >= TREE_OPERAND_LENGTH (__t)) + tree_operand_check_failed (__i, __t, __f, __l, __g); + return CONST_CAST (const_tree *, &__t->exp.operands[__i]); +} + +#endif + +#define error_mark_node global_trees[TI_ERROR_MARK] + +#define intQI_type_node global_trees[TI_INTQI_TYPE] +#define intHI_type_node global_trees[TI_INTHI_TYPE] +#define intSI_type_node global_trees[TI_INTSI_TYPE] +#define intDI_type_node global_trees[TI_INTDI_TYPE] +#define intTI_type_node global_trees[TI_INTTI_TYPE] + +#define unsigned_intQI_type_node global_trees[TI_UINTQI_TYPE] +#define unsigned_intHI_type_node global_trees[TI_UINTHI_TYPE] +#define unsigned_intSI_type_node global_trees[TI_UINTSI_TYPE] +#define unsigned_intDI_type_node global_trees[TI_UINTDI_TYPE] +#define unsigned_intTI_type_node global_trees[TI_UINTTI_TYPE] + +#define atomicQI_type_node global_trees[TI_ATOMICQI_TYPE] +#define atomicHI_type_node global_trees[TI_ATOMICHI_TYPE] +#define atomicSI_type_node global_trees[TI_ATOMICSI_TYPE] +#define atomicDI_type_node global_trees[TI_ATOMICDI_TYPE] +#define atomicTI_type_node global_trees[TI_ATOMICTI_TYPE] + +#define uint16_type_node global_trees[TI_UINT16_TYPE] +#define uint32_type_node global_trees[TI_UINT32_TYPE] +#define uint64_type_node global_trees[TI_UINT64_TYPE] + +#define void_node global_trees[TI_VOID] + +#define integer_zero_node global_trees[TI_INTEGER_ZERO] +#define integer_one_node global_trees[TI_INTEGER_ONE] +#define integer_three_node global_trees[TI_INTEGER_THREE] +#define integer_minus_one_node global_trees[TI_INTEGER_MINUS_ONE] +#define size_zero_node global_trees[TI_SIZE_ZERO] +#define size_one_node global_trees[TI_SIZE_ONE] +#define bitsize_zero_node global_trees[TI_BITSIZE_ZERO] +#define bitsize_one_node global_trees[TI_BITSIZE_ONE] +#define bitsize_unit_node global_trees[TI_BITSIZE_UNIT] + +/* Base access nodes. */ +#define access_public_node global_trees[TI_PUBLIC] +#define access_protected_node global_trees[TI_PROTECTED] +#define access_private_node global_trees[TI_PRIVATE] + +#define null_pointer_node global_trees[TI_NULL_POINTER] + +#define float_type_node global_trees[TI_FLOAT_TYPE] +#define double_type_node global_trees[TI_DOUBLE_TYPE] +#define long_double_type_node global_trees[TI_LONG_DOUBLE_TYPE] + +/* Nodes for particular _FloatN and _FloatNx types in sequence. */ +#define FLOATN_TYPE_NODE(IDX) global_trees[TI_FLOATN_TYPE_FIRST + (IDX)] +#define FLOATN_NX_TYPE_NODE(IDX) global_trees[TI_FLOATN_NX_TYPE_FIRST + (IDX)] +#define FLOATNX_TYPE_NODE(IDX) global_trees[TI_FLOATNX_TYPE_FIRST + (IDX)] + +/* Names for individual types (code should normally iterate over all + such types; these are only for back-end use, or in contexts such as + *.def where iteration is not possible). */ +#define float16_type_node global_trees[TI_FLOAT16_TYPE] +#define float32_type_node global_trees[TI_FLOAT32_TYPE] +#define float64_type_node global_trees[TI_FLOAT64_TYPE] +#define float128_type_node global_trees[TI_FLOAT128_TYPE] +#define float32x_type_node global_trees[TI_FLOAT32X_TYPE] +#define float64x_type_node global_trees[TI_FLOAT64X_TYPE] +#define float128x_type_node global_trees[TI_FLOAT128X_TYPE] + +#define float_ptr_type_node global_trees[TI_FLOAT_PTR_TYPE] +#define double_ptr_type_node global_trees[TI_DOUBLE_PTR_TYPE] +#define long_double_ptr_type_node global_trees[TI_LONG_DOUBLE_PTR_TYPE] +#define integer_ptr_type_node global_trees[TI_INTEGER_PTR_TYPE] + +#define complex_integer_type_node global_trees[TI_COMPLEX_INTEGER_TYPE] +#define complex_float_type_node global_trees[TI_COMPLEX_FLOAT_TYPE] +#define complex_double_type_node global_trees[TI_COMPLEX_DOUBLE_TYPE] +#define complex_long_double_type_node global_trees[TI_COMPLEX_LONG_DOUBLE_TYPE] + +#define COMPLEX_FLOATN_NX_TYPE_NODE(IDX) global_trees[TI_COMPLEX_FLOATN_NX_TYPE_FIRST + (IDX)] + +#define pointer_bounds_type_node global_trees[TI_POINTER_BOUNDS_TYPE] + +#define void_type_node global_trees[TI_VOID_TYPE] +/* The C type `void *'. */ +#define ptr_type_node global_trees[TI_PTR_TYPE] +/* The C type `const void *'. */ +#define const_ptr_type_node global_trees[TI_CONST_PTR_TYPE] +/* The C type `size_t'. */ +#define size_type_node global_trees[TI_SIZE_TYPE] +#define pid_type_node global_trees[TI_PID_TYPE] +#define ptrdiff_type_node global_trees[TI_PTRDIFF_TYPE] +#define va_list_type_node global_trees[TI_VA_LIST_TYPE] +#define va_list_gpr_counter_field global_trees[TI_VA_LIST_GPR_COUNTER_FIELD] +#define va_list_fpr_counter_field global_trees[TI_VA_LIST_FPR_COUNTER_FIELD] +/* The C type `FILE *'. */ +#define fileptr_type_node global_trees[TI_FILEPTR_TYPE] +/* The C type `const struct tm *'. */ +#define const_tm_ptr_type_node global_trees[TI_CONST_TM_PTR_TYPE] +#define pointer_sized_int_node global_trees[TI_POINTER_SIZED_TYPE] + +#define boolean_type_node global_trees[TI_BOOLEAN_TYPE] +#define boolean_false_node global_trees[TI_BOOLEAN_FALSE] +#define boolean_true_node global_trees[TI_BOOLEAN_TRUE] + +/* The decimal floating point types. */ +#define dfloat32_type_node global_trees[TI_DFLOAT32_TYPE] +#define dfloat64_type_node global_trees[TI_DFLOAT64_TYPE] +#define dfloat128_type_node global_trees[TI_DFLOAT128_TYPE] +#define dfloat32_ptr_type_node global_trees[TI_DFLOAT32_PTR_TYPE] +#define dfloat64_ptr_type_node global_trees[TI_DFLOAT64_PTR_TYPE] +#define dfloat128_ptr_type_node global_trees[TI_DFLOAT128_PTR_TYPE] + +/* The fixed-point types. */ +#define sat_short_fract_type_node global_trees[TI_SAT_SFRACT_TYPE] +#define sat_fract_type_node global_trees[TI_SAT_FRACT_TYPE] +#define sat_long_fract_type_node global_trees[TI_SAT_LFRACT_TYPE] +#define sat_long_long_fract_type_node global_trees[TI_SAT_LLFRACT_TYPE] +#define sat_unsigned_short_fract_type_node \ + global_trees[TI_SAT_USFRACT_TYPE] +#define sat_unsigned_fract_type_node global_trees[TI_SAT_UFRACT_TYPE] +#define sat_unsigned_long_fract_type_node \ + global_trees[TI_SAT_ULFRACT_TYPE] +#define sat_unsigned_long_long_fract_type_node \ + global_trees[TI_SAT_ULLFRACT_TYPE] +#define short_fract_type_node global_trees[TI_SFRACT_TYPE] +#define fract_type_node global_trees[TI_FRACT_TYPE] +#define long_fract_type_node global_trees[TI_LFRACT_TYPE] +#define long_long_fract_type_node global_trees[TI_LLFRACT_TYPE] +#define unsigned_short_fract_type_node global_trees[TI_USFRACT_TYPE] +#define unsigned_fract_type_node global_trees[TI_UFRACT_TYPE] +#define unsigned_long_fract_type_node global_trees[TI_ULFRACT_TYPE] +#define unsigned_long_long_fract_type_node \ + global_trees[TI_ULLFRACT_TYPE] +#define sat_short_accum_type_node global_trees[TI_SAT_SACCUM_TYPE] +#define sat_accum_type_node global_trees[TI_SAT_ACCUM_TYPE] +#define sat_long_accum_type_node global_trees[TI_SAT_LACCUM_TYPE] +#define sat_long_long_accum_type_node global_trees[TI_SAT_LLACCUM_TYPE] +#define sat_unsigned_short_accum_type_node \ + global_trees[TI_SAT_USACCUM_TYPE] +#define sat_unsigned_accum_type_node global_trees[TI_SAT_UACCUM_TYPE] +#define sat_unsigned_long_accum_type_node \ + global_trees[TI_SAT_ULACCUM_TYPE] +#define sat_unsigned_long_long_accum_type_node \ + global_trees[TI_SAT_ULLACCUM_TYPE] +#define short_accum_type_node global_trees[TI_SACCUM_TYPE] +#define accum_type_node global_trees[TI_ACCUM_TYPE] +#define long_accum_type_node global_trees[TI_LACCUM_TYPE] +#define long_long_accum_type_node global_trees[TI_LLACCUM_TYPE] +#define unsigned_short_accum_type_node global_trees[TI_USACCUM_TYPE] +#define unsigned_accum_type_node global_trees[TI_UACCUM_TYPE] +#define unsigned_long_accum_type_node global_trees[TI_ULACCUM_TYPE] +#define unsigned_long_long_accum_type_node \ + global_trees[TI_ULLACCUM_TYPE] +#define qq_type_node global_trees[TI_QQ_TYPE] +#define hq_type_node global_trees[TI_HQ_TYPE] +#define sq_type_node global_trees[TI_SQ_TYPE] +#define dq_type_node global_trees[TI_DQ_TYPE] +#define tq_type_node global_trees[TI_TQ_TYPE] +#define uqq_type_node global_trees[TI_UQQ_TYPE] +#define uhq_type_node global_trees[TI_UHQ_TYPE] +#define usq_type_node global_trees[TI_USQ_TYPE] +#define udq_type_node global_trees[TI_UDQ_TYPE] +#define utq_type_node global_trees[TI_UTQ_TYPE] +#define sat_qq_type_node global_trees[TI_SAT_QQ_TYPE] +#define sat_hq_type_node global_trees[TI_SAT_HQ_TYPE] +#define sat_sq_type_node global_trees[TI_SAT_SQ_TYPE] +#define sat_dq_type_node global_trees[TI_SAT_DQ_TYPE] +#define sat_tq_type_node global_trees[TI_SAT_TQ_TYPE] +#define sat_uqq_type_node global_trees[TI_SAT_UQQ_TYPE] +#define sat_uhq_type_node global_trees[TI_SAT_UHQ_TYPE] +#define sat_usq_type_node global_trees[TI_SAT_USQ_TYPE] +#define sat_udq_type_node global_trees[TI_SAT_UDQ_TYPE] +#define sat_utq_type_node global_trees[TI_SAT_UTQ_TYPE] +#define ha_type_node global_trees[TI_HA_TYPE] +#define sa_type_node global_trees[TI_SA_TYPE] +#define da_type_node global_trees[TI_DA_TYPE] +#define ta_type_node global_trees[TI_TA_TYPE] +#define uha_type_node global_trees[TI_UHA_TYPE] +#define usa_type_node global_trees[TI_USA_TYPE] +#define uda_type_node global_trees[TI_UDA_TYPE] +#define uta_type_node global_trees[TI_UTA_TYPE] +#define sat_ha_type_node global_trees[TI_SAT_HA_TYPE] +#define sat_sa_type_node global_trees[TI_SAT_SA_TYPE] +#define sat_da_type_node global_trees[TI_SAT_DA_TYPE] +#define sat_ta_type_node global_trees[TI_SAT_TA_TYPE] +#define sat_uha_type_node global_trees[TI_SAT_UHA_TYPE] +#define sat_usa_type_node global_trees[TI_SAT_USA_TYPE] +#define sat_uda_type_node global_trees[TI_SAT_UDA_TYPE] +#define sat_uta_type_node global_trees[TI_SAT_UTA_TYPE] + +/* The node that should be placed at the end of a parameter list to + indicate that the function does not take a variable number of + arguments. The TREE_VALUE will be void_type_node and there will be + no TREE_CHAIN. Language-independent code should not assume + anything else about this node. */ +#define void_list_node global_trees[TI_VOID_LIST_NODE] + +#define main_identifier_node global_trees[TI_MAIN_IDENTIFIER] +#define MAIN_NAME_P(NODE) \ + (IDENTIFIER_NODE_CHECK (NODE) == main_identifier_node) + +/* Optimization options (OPTIMIZATION_NODE) to use for default and current + functions. */ +#define optimization_default_node global_trees[TI_OPTIMIZATION_DEFAULT] +#define optimization_current_node global_trees[TI_OPTIMIZATION_CURRENT] + +/* Default/current target options (TARGET_OPTION_NODE). */ +#define target_option_default_node global_trees[TI_TARGET_OPTION_DEFAULT] +#define target_option_current_node global_trees[TI_TARGET_OPTION_CURRENT] + +/* Default tree list option(), optimize() pragmas to be linked into the + attribute list. */ +#define current_target_pragma global_trees[TI_CURRENT_TARGET_PRAGMA] +#define current_optimize_pragma global_trees[TI_CURRENT_OPTIMIZE_PRAGMA] + +#define char_type_node integer_types[itk_char] +#define signed_char_type_node integer_types[itk_signed_char] +#define unsigned_char_type_node integer_types[itk_unsigned_char] +#define short_integer_type_node integer_types[itk_short] +#define short_unsigned_type_node integer_types[itk_unsigned_short] +#define integer_type_node integer_types[itk_int] +#define unsigned_type_node integer_types[itk_unsigned_int] +#define long_integer_type_node integer_types[itk_long] +#define long_unsigned_type_node integer_types[itk_unsigned_long] +#define long_long_integer_type_node integer_types[itk_long_long] +#define long_long_unsigned_type_node integer_types[itk_unsigned_long_long] + +/* True if NODE is an erroneous expression. */ + +#define error_operand_p(NODE) \ + ((NODE) == error_mark_node \ + || ((NODE) && TREE_TYPE ((NODE)) == error_mark_node)) + +extern tree decl_assembler_name (tree); +extern tree decl_comdat_group (const_tree); +extern tree decl_comdat_group_id (const_tree); +extern const char *decl_section_name (const_tree); +extern void set_decl_section_name (tree, const char *); +extern enum tls_model decl_tls_model (const_tree); +extern void set_decl_tls_model (tree, enum tls_model); + +/* Compute the number of bytes occupied by 'node'. This routine only + looks at TREE_CODE and, if the code is TREE_VEC, TREE_VEC_LENGTH. */ + +extern size_t tree_size (const_tree); + +/* Compute the number of bytes occupied by a tree with code CODE. + This function cannot be used for TREE_VEC or INTEGER_CST nodes, + which are of variable length. */ +extern size_t tree_code_size (enum tree_code); + +/* Allocate and return a new UID from the DECL_UID namespace. */ +extern int allocate_decl_uid (void); + +/* Lowest level primitive for allocating a node. + The TREE_CODE is the only argument. Contents are initialized + to zero except for a few of the common fields. */ + +extern tree make_node_stat (enum tree_code MEM_STAT_DECL); +#define make_node(t) make_node_stat (t MEM_STAT_INFO) + +/* Free tree node. */ + +extern void free_node (tree); + +/* Make a copy of a node, with all the same contents. */ + +extern tree copy_node_stat (tree MEM_STAT_DECL); +#define copy_node(t) copy_node_stat (t MEM_STAT_INFO) + +/* Make a copy of a chain of TREE_LIST nodes. */ + +extern tree copy_list (tree); + +/* Make a CASE_LABEL_EXPR. */ + +extern tree build_case_label (tree, tree, tree); + +/* Make a BINFO. */ +extern tree make_tree_binfo_stat (unsigned MEM_STAT_DECL); +#define make_tree_binfo(t) make_tree_binfo_stat (t MEM_STAT_INFO) + +/* Make an INTEGER_CST. */ + +extern tree make_int_cst_stat (int, int MEM_STAT_DECL); +#define make_int_cst(LEN, EXT_LEN) \ + make_int_cst_stat (LEN, EXT_LEN MEM_STAT_INFO) + +/* Make a TREE_VEC. */ + +extern tree make_tree_vec_stat (int MEM_STAT_DECL); +#define make_tree_vec(t) make_tree_vec_stat (t MEM_STAT_INFO) + +/* Grow a TREE_VEC. */ + +extern tree grow_tree_vec_stat (tree v, int MEM_STAT_DECL); +#define grow_tree_vec(v, t) grow_tree_vec_stat (v, t MEM_STAT_INFO) + +/* Construct various types of nodes. */ + +extern tree build_nt (enum tree_code, ...); +extern tree build_nt_call_vec (tree, vec *); + +extern tree build0_stat (enum tree_code, tree MEM_STAT_DECL); +#define build0(c,t) build0_stat (c,t MEM_STAT_INFO) +extern tree build1_stat (enum tree_code, tree, tree MEM_STAT_DECL); +#define build1(c,t1,t2) build1_stat (c,t1,t2 MEM_STAT_INFO) +extern tree build2_stat (enum tree_code, tree, tree, tree MEM_STAT_DECL); +#define build2(c,t1,t2,t3) build2_stat (c,t1,t2,t3 MEM_STAT_INFO) +extern tree build3_stat (enum tree_code, tree, tree, tree, tree MEM_STAT_DECL); +#define build3(c,t1,t2,t3,t4) build3_stat (c,t1,t2,t3,t4 MEM_STAT_INFO) +extern tree build4_stat (enum tree_code, tree, tree, tree, tree, + tree MEM_STAT_DECL); +#define build4(c,t1,t2,t3,t4,t5) build4_stat (c,t1,t2,t3,t4,t5 MEM_STAT_INFO) +extern tree build5_stat (enum tree_code, tree, tree, tree, tree, tree, + tree MEM_STAT_DECL); +#define build5(c,t1,t2,t3,t4,t5,t6) build5_stat (c,t1,t2,t3,t4,t5,t6 MEM_STAT_INFO) + +/* _loc versions of build[1-5]. */ + +static inline tree +build1_stat_loc (location_t loc, enum tree_code code, tree type, + tree arg1 MEM_STAT_DECL) +{ + tree t = build1_stat (code, type, arg1 PASS_MEM_STAT); + if (CAN_HAVE_LOCATION_P (t)) + SET_EXPR_LOCATION (t, loc); + return t; +} +#define build1_loc(l,c,t1,t2) build1_stat_loc (l,c,t1,t2 MEM_STAT_INFO) + +static inline tree +build2_stat_loc (location_t loc, enum tree_code code, tree type, tree arg0, + tree arg1 MEM_STAT_DECL) +{ + tree t = build2_stat (code, type, arg0, arg1 PASS_MEM_STAT); + if (CAN_HAVE_LOCATION_P (t)) + SET_EXPR_LOCATION (t, loc); + return t; +} +#define build2_loc(l,c,t1,t2,t3) build2_stat_loc (l,c,t1,t2,t3 MEM_STAT_INFO) + +static inline tree +build3_stat_loc (location_t loc, enum tree_code code, tree type, tree arg0, + tree arg1, tree arg2 MEM_STAT_DECL) +{ + tree t = build3_stat (code, type, arg0, arg1, arg2 PASS_MEM_STAT); + if (CAN_HAVE_LOCATION_P (t)) + SET_EXPR_LOCATION (t, loc); + return t; +} +#define build3_loc(l,c,t1,t2,t3,t4) \ + build3_stat_loc (l,c,t1,t2,t3,t4 MEM_STAT_INFO) + +static inline tree +build4_stat_loc (location_t loc, enum tree_code code, tree type, tree arg0, + tree arg1, tree arg2, tree arg3 MEM_STAT_DECL) +{ + tree t = build4_stat (code, type, arg0, arg1, arg2, arg3 PASS_MEM_STAT); + if (CAN_HAVE_LOCATION_P (t)) + SET_EXPR_LOCATION (t, loc); + return t; +} +#define build4_loc(l,c,t1,t2,t3,t4,t5) \ + build4_stat_loc (l,c,t1,t2,t3,t4,t5 MEM_STAT_INFO) + +static inline tree +build5_stat_loc (location_t loc, enum tree_code code, tree type, tree arg0, + tree arg1, tree arg2, tree arg3, tree arg4 MEM_STAT_DECL) +{ + tree t = build5_stat (code, type, arg0, arg1, arg2, arg3, + arg4 PASS_MEM_STAT); + if (CAN_HAVE_LOCATION_P (t)) + SET_EXPR_LOCATION (t, loc); + return t; +} +#define build5_loc(l,c,t1,t2,t3,t4,t5,t6) \ + build5_stat_loc (l,c,t1,t2,t3,t4,t5,t6 MEM_STAT_INFO) + +extern tree build_var_debug_value_stat (tree, tree MEM_STAT_DECL); +#define build_var_debug_value(t1,t2) \ + build_var_debug_value_stat (t1,t2 MEM_STAT_INFO) + +/* Constructs double_int from tree CST. */ + +extern tree double_int_to_tree (tree, double_int); + +extern tree wide_int_to_tree (tree type, const wide_int_ref &cst); +extern tree force_fit_type (tree, const wide_int_ref &, int, bool); + +/* Create an INT_CST node with a CST value zero extended. */ + +/* static inline */ +extern tree build_int_cst (tree, HOST_WIDE_INT); +extern tree build_int_cstu (tree type, unsigned HOST_WIDE_INT cst); +extern tree build_int_cst_type (tree, HOST_WIDE_INT); +extern tree make_vector_stat (unsigned MEM_STAT_DECL); +#define make_vector(n) make_vector_stat (n MEM_STAT_INFO) +extern tree build_vector_stat (tree, tree * MEM_STAT_DECL); +#define build_vector(t,v) build_vector_stat (t, v MEM_STAT_INFO) +extern tree build_vector_from_ctor (tree, vec *); +extern tree build_vector_from_val (tree, tree); +extern void recompute_constructor_flags (tree); +extern void verify_constructor_flags (tree); +extern tree build_constructor (tree, vec *); +extern tree build_constructor_single (tree, tree, tree); +extern tree build_constructor_from_list (tree, tree); +extern tree build_constructor_va (tree, int, ...); +extern tree build_real_from_int_cst (tree, const_tree); +extern tree build_complex (tree, tree, tree); +extern tree build_complex_inf (tree, bool); +extern tree build_each_one_cst (tree); +extern tree build_one_cst (tree); +extern tree build_minus_one_cst (tree); +extern tree build_all_ones_cst (tree); +extern tree build_zero_cst (tree); +extern tree build_string (int, const char *); +extern tree build_tree_list_stat (tree, tree MEM_STAT_DECL); +#define build_tree_list(t, q) build_tree_list_stat (t, q MEM_STAT_INFO) +extern tree build_tree_list_vec_stat (const vec *MEM_STAT_DECL); +#define build_tree_list_vec(v) build_tree_list_vec_stat (v MEM_STAT_INFO) +extern tree build_decl_stat (location_t, enum tree_code, + tree, tree MEM_STAT_DECL); +extern tree build_fn_decl (const char *, tree); +#define build_decl(l,c,t,q) build_decl_stat (l, c, t, q MEM_STAT_INFO) +extern tree build_translation_unit_decl (tree); +extern tree build_block (tree, tree, tree, tree); +extern tree build_empty_stmt (location_t); +extern tree build_omp_clause (location_t, enum omp_clause_code); + +extern tree build_vl_exp_stat (enum tree_code, int MEM_STAT_DECL); +#define build_vl_exp(c, n) build_vl_exp_stat (c, n MEM_STAT_INFO) + +extern tree build_call_nary (tree, tree, int, ...); +extern tree build_call_valist (tree, tree, int, va_list); +#define build_call_array(T1,T2,N,T3)\ + build_call_array_loc (UNKNOWN_LOCATION, T1, T2, N, T3) +extern tree build_call_array_loc (location_t, tree, tree, int, const tree *); +extern tree build_call_vec (tree, tree, vec *); +extern tree build_call_expr_loc_array (location_t, tree, int, tree *); +extern tree build_call_expr_loc_vec (location_t, tree, vec *); +extern tree build_call_expr_loc (location_t, tree, int, ...); +extern tree build_call_expr (tree, int, ...); +extern tree build_call_expr_internal_loc (location_t, enum internal_fn, + tree, int, ...); +extern tree build_call_expr_internal_loc_array (location_t, enum internal_fn, + tree, int, const tree *); +extern tree maybe_build_call_expr_loc (location_t, combined_fn, tree, + int, ...); +extern tree build_string_literal (int, const char *); + +/* Construct various nodes representing data types. */ + +extern tree signed_or_unsigned_type_for (int, tree); +extern tree signed_type_for (tree); +extern tree unsigned_type_for (tree); +extern tree truth_type_for (tree); +extern tree build_pointer_type_for_mode (tree, machine_mode, bool); +extern tree build_pointer_type (tree); +extern tree build_reference_type_for_mode (tree, machine_mode, bool); +extern tree build_reference_type (tree); +extern tree build_vector_type_for_mode (tree, machine_mode); +extern tree build_vector_type (tree innertype, int nunits); +extern tree build_truth_vector_type (unsigned, unsigned); +extern tree build_same_sized_truth_vector_type (tree vectype); +extern tree build_opaque_vector_type (tree innertype, int nunits); +extern tree build_index_type (tree); +extern tree build_array_type (tree, tree, bool = false); +extern tree build_nonshared_array_type (tree, tree); +extern tree build_array_type_nelts (tree, unsigned HOST_WIDE_INT); +extern tree build_function_type (tree, tree); +extern tree build_function_type_list (tree, ...); +extern tree build_varargs_function_type_list (tree, ...); +extern tree build_function_type_array (tree, int, tree *); +extern tree build_varargs_function_type_array (tree, int, tree *); +#define build_function_type_vec(RET, V) \ + build_function_type_array (RET, vec_safe_length (V), vec_safe_address (V)) +#define build_varargs_function_type_vec(RET, V) \ + build_varargs_function_type_array (RET, vec_safe_length (V), \ + vec_safe_address (V)) +extern tree build_method_type_directly (tree, tree, tree); +extern tree build_method_type (tree, tree); +extern tree build_offset_type (tree, tree); +extern tree build_complex_type (tree, bool named = false); +extern tree array_type_nelts (const_tree); + +extern tree value_member (tree, tree); +extern tree purpose_member (const_tree, tree); +extern bool vec_member (const_tree, vec *); +extern tree chain_index (int, tree); + +extern int attribute_list_equal (const_tree, const_tree); +extern int attribute_list_contained (const_tree, const_tree); +extern int tree_int_cst_equal (const_tree, const_tree); + +extern bool tree_fits_shwi_p (const_tree) +#ifndef ENABLE_TREE_CHECKING + ATTRIBUTE_PURE /* tree_fits_shwi_p is pure only when checking is disabled. */ +#endif + ; +extern bool tree_fits_uhwi_p (const_tree) +#ifndef ENABLE_TREE_CHECKING + ATTRIBUTE_PURE /* tree_fits_uhwi_p is pure only when checking is disabled. */ +#endif + ; +extern HOST_WIDE_INT tree_to_shwi (const_tree); +extern unsigned HOST_WIDE_INT tree_to_uhwi (const_tree); +#if !defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 4003) +extern inline __attribute__ ((__gnu_inline__)) HOST_WIDE_INT +tree_to_shwi (const_tree t) +{ + gcc_assert (tree_fits_shwi_p (t)); + return TREE_INT_CST_LOW (t); +} + +extern inline __attribute__ ((__gnu_inline__)) unsigned HOST_WIDE_INT +tree_to_uhwi (const_tree t) +{ + gcc_assert (tree_fits_uhwi_p (t)); + return TREE_INT_CST_LOW (t); +} +#endif +extern int tree_int_cst_sgn (const_tree); +extern int tree_int_cst_sign_bit (const_tree); +extern unsigned int tree_int_cst_min_precision (tree, signop); +extern tree strip_array_types (tree); +extern tree excess_precision_type (tree); +extern bool valid_constant_size_p (const_tree); + + +/* From expmed.c. Since rtl.h is included after tree.h, we can't + put the prototype here. Rtl.h does declare the prototype if + tree.h had been included. */ + +extern tree make_tree (tree, rtx); + +/* Return a type like TTYPE except that its TYPE_ATTRIBUTES + is ATTRIBUTE. + + Such modified types already made are recorded so that duplicates + are not made. */ + +extern tree build_type_attribute_variant (tree, tree); +extern tree build_decl_attribute_variant (tree, tree); +extern tree build_type_attribute_qual_variant (tree, tree, int); + +extern bool attribute_value_equal (const_tree, const_tree); + +/* Return 0 if the attributes for two types are incompatible, 1 if they + are compatible, and 2 if they are nearly compatible (which causes a + warning to be generated). */ +extern int comp_type_attributes (const_tree, const_tree); + +/* Default versions of target-overridable functions. */ +extern tree merge_decl_attributes (tree, tree); +extern tree merge_type_attributes (tree, tree); + +/* This function is a private implementation detail of lookup_attribute() + and you should never call it directly. */ +extern tree private_lookup_attribute (const char *, size_t, tree); + +/* This function is a private implementation detail + of lookup_attribute_by_prefix() and you should never call it directly. */ +extern tree private_lookup_attribute_by_prefix (const char *, size_t, tree); + +/* Given an attribute name ATTR_NAME and a list of attributes LIST, + return a pointer to the attribute's list element if the attribute + is part of the list, or NULL_TREE if not found. If the attribute + appears more than once, this only returns the first occurrence; the + TREE_CHAIN of the return value should be passed back in if further + occurrences are wanted. ATTR_NAME must be in the form 'text' (not + '__text__'). */ + +static inline tree +lookup_attribute (const char *attr_name, tree list) +{ + gcc_checking_assert (attr_name[0] != '_'); + /* In most cases, list is NULL_TREE. */ + if (list == NULL_TREE) + return NULL_TREE; + else + /* Do the strlen() before calling the out-of-line implementation. + In most cases attr_name is a string constant, and the compiler + will optimize the strlen() away. */ + return private_lookup_attribute (attr_name, strlen (attr_name), list); +} + +/* Given an attribute name ATTR_NAME and a list of attributes LIST, + return a pointer to the attribute's list first element if the attribute + starts with ATTR_NAME. ATTR_NAME must be in the form 'text' (not + '__text__'). */ + +static inline tree +lookup_attribute_by_prefix (const char *attr_name, tree list) +{ + gcc_checking_assert (attr_name[0] != '_'); + /* In most cases, list is NULL_TREE. */ + if (list == NULL_TREE) + return NULL_TREE; + else + return private_lookup_attribute_by_prefix (attr_name, strlen (attr_name), + list); +} + + +/* This function is a private implementation detail of + is_attribute_p() and you should never call it directly. */ +extern bool private_is_attribute_p (const char *, size_t, const_tree); + +/* Given an identifier node IDENT and a string ATTR_NAME, return true + if the identifier node is a valid attribute name for the string. + ATTR_NAME must be in the form 'text' (not '__text__'). IDENT could + be the identifier for 'text' or for '__text__'. */ + +static inline bool +is_attribute_p (const char *attr_name, const_tree ident) +{ + gcc_checking_assert (attr_name[0] != '_'); + /* Do the strlen() before calling the out-of-line implementation. + In most cases attr_name is a string constant, and the compiler + will optimize the strlen() away. */ + return private_is_attribute_p (attr_name, strlen (attr_name), ident); +} + +/* Remove any instances of attribute ATTR_NAME in LIST and return the + modified list. ATTR_NAME must be in the form 'text' (not + '__text__'). */ + +extern tree remove_attribute (const char *, tree); + +/* Given two attributes lists, return a list of their union. */ + +extern tree merge_attributes (tree, tree); + +/* Given two Windows decl attributes lists, possibly including + dllimport, return a list of their union . */ +extern tree merge_dllimport_decl_attributes (tree, tree); + +/* Handle a "dllimport" or "dllexport" attribute. */ +extern tree handle_dll_attribute (tree *, tree, tree, int, bool *); + +/* Returns true iff CAND and BASE have equivalent language-specific + qualifiers. */ + +extern bool check_lang_type (const_tree cand, const_tree base); + +/* Returns true iff unqualified CAND and BASE are equivalent. */ + +extern bool check_base_type (const_tree cand, const_tree base); + +/* Check whether CAND is suitable to be returned from get_qualified_type + (BASE, TYPE_QUALS). */ + +extern bool check_qualified_type (const_tree, const_tree, int); + +/* Return a version of the TYPE, qualified as indicated by the + TYPE_QUALS, if one exists. If no qualified version exists yet, + return NULL_TREE. */ + +extern tree get_qualified_type (tree, int); + +/* Like get_qualified_type, but creates the type if it does not + exist. This function never returns NULL_TREE. */ + +extern tree build_qualified_type (tree, int); + +/* Create a variant of type T with alignment ALIGN. */ + +extern tree build_aligned_type (tree, unsigned int); + +/* Like build_qualified_type, but only deals with the `const' and + `volatile' qualifiers. This interface is retained for backwards + compatibility with the various front-ends; new code should use + build_qualified_type instead. */ + +#define build_type_variant(TYPE, CONST_P, VOLATILE_P) \ + build_qualified_type ((TYPE), \ + ((CONST_P) ? TYPE_QUAL_CONST : 0) \ + | ((VOLATILE_P) ? TYPE_QUAL_VOLATILE : 0)) + +/* Make a copy of a type node. */ + +extern tree build_distinct_type_copy (tree); +extern tree build_variant_type_copy (tree); + +/* Given a hashcode and a ..._TYPE node (for which the hashcode was made), + return a canonicalized ..._TYPE node, so that duplicates are not made. + How the hash code is computed is up to the caller, as long as any two + callers that could hash identical-looking type nodes agree. */ + +extern tree type_hash_canon (unsigned int, tree); + +extern tree convert (tree, tree); +extern unsigned int expr_align (const_tree); +extern tree size_in_bytes_loc (location_t, const_tree); +inline tree +size_in_bytes (const_tree t) +{ + return size_in_bytes_loc (input_location, t); +} + +extern HOST_WIDE_INT int_size_in_bytes (const_tree); +extern HOST_WIDE_INT max_int_size_in_bytes (const_tree); +extern tree bit_position (const_tree); +extern tree byte_position (const_tree); +extern HOST_WIDE_INT int_byte_position (const_tree); + +/* Type for sizes of data-type. */ + +#define sizetype sizetype_tab[(int) stk_sizetype] +#define bitsizetype sizetype_tab[(int) stk_bitsizetype] +#define ssizetype sizetype_tab[(int) stk_ssizetype] +#define sbitsizetype sizetype_tab[(int) stk_sbitsizetype] +#define size_int(L) size_int_kind (L, stk_sizetype) +#define ssize_int(L) size_int_kind (L, stk_ssizetype) +#define bitsize_int(L) size_int_kind (L, stk_bitsizetype) +#define sbitsize_int(L) size_int_kind (L, stk_sbitsizetype) + +/* Log2 of BITS_PER_UNIT. */ + +#if BITS_PER_UNIT == 8 +#define LOG2_BITS_PER_UNIT 3 +#elif BITS_PER_UNIT == 16 +#define LOG2_BITS_PER_UNIT 4 +#else +#error Unknown BITS_PER_UNIT +#endif + +/* Concatenate two lists (chains of TREE_LIST nodes) X and Y + by making the last node in X point to Y. + Returns X, except if X is 0 returns Y. */ + +extern tree chainon (tree, tree); + +/* Make a new TREE_LIST node from specified PURPOSE, VALUE and CHAIN. */ + +extern tree tree_cons_stat (tree, tree, tree MEM_STAT_DECL); +#define tree_cons(t,q,w) tree_cons_stat (t,q,w MEM_STAT_INFO) + +/* Return the last tree node in a chain. */ + +extern tree tree_last (tree); + +/* Reverse the order of elements in a chain, and return the new head. */ + +extern tree nreverse (tree); + +/* Returns the length of a chain of nodes + (number of chain pointers to follow before reaching a null pointer). */ + +extern int list_length (const_tree); + +/* Returns the first FIELD_DECL in a type. */ + +extern tree first_field (const_tree); + +/* Given an initializer INIT, return TRUE if INIT is zero or some + aggregate of zeros. Otherwise return FALSE. */ + +extern bool initializer_zerop (const_tree); + +/* Given a vector VEC, return its first element if all elements are + the same. Otherwise return NULL_TREE. */ + +extern tree uniform_vector_p (const_tree); + +/* Given a CONSTRUCTOR CTOR, return the element values as a vector. */ + +extern vec *ctor_to_vec (tree); + +/* zerop (tree x) is nonzero if X is a constant of value 0. */ + +extern int zerop (const_tree); + +/* integer_zerop (tree x) is nonzero if X is an integer constant of value 0. */ + +extern int integer_zerop (const_tree); + +/* integer_onep (tree x) is nonzero if X is an integer constant of value 1. */ + +extern int integer_onep (const_tree); + +/* integer_onep (tree x) is nonzero if X is an integer constant of value 1, or + a vector or complex where each part is 1. */ + +extern int integer_each_onep (const_tree); + +/* integer_all_onesp (tree x) is nonzero if X is an integer constant + all of whose significant bits are 1. */ + +extern int integer_all_onesp (const_tree); + +/* integer_minus_onep (tree x) is nonzero if X is an integer constant of + value -1. */ + +extern int integer_minus_onep (const_tree); + +/* integer_pow2p (tree x) is nonzero is X is an integer constant with + exactly one bit 1. */ + +extern int integer_pow2p (const_tree); + +/* integer_nonzerop (tree x) is nonzero if X is an integer constant + with a nonzero value. */ + +extern int integer_nonzerop (const_tree); + +/* integer_truep (tree x) is nonzero if X is an integer constant of value 1 or + a vector where each element is an integer constant of value -1. */ + +extern int integer_truep (const_tree); + +extern bool cst_and_fits_in_hwi (const_tree); +extern tree num_ending_zeros (const_tree); + +/* fixed_zerop (tree x) is nonzero if X is a fixed-point constant of + value 0. */ + +extern int fixed_zerop (const_tree); + +/* staticp (tree x) is nonzero if X is a reference to data allocated + at a fixed address in memory. Returns the outermost data. */ + +extern tree staticp (tree); + +/* save_expr (EXP) returns an expression equivalent to EXP + but it can be used multiple times within context CTX + and only evaluate EXP once. */ + +extern tree save_expr (tree); + +/* Return true if T is function-invariant. */ + +extern bool tree_invariant_p (tree); + +/* Look inside EXPR into any simple arithmetic operations. Return the + outermost non-arithmetic or non-invariant node. */ + +extern tree skip_simple_arithmetic (tree); + +/* Look inside EXPR into simple arithmetic operations involving constants. + Return the outermost non-arithmetic or non-constant node. */ + +extern tree skip_simple_constant_arithmetic (tree); + +/* Return which tree structure is used by T. */ + +enum tree_node_structure_enum tree_node_structure (const_tree); + +/* Return true if EXP contains a PLACEHOLDER_EXPR, i.e. if it represents a + size or offset that depends on a field within a record. */ + +extern bool contains_placeholder_p (const_tree); + +/* This macro calls the above function but short-circuits the common + case of a constant to save time. Also check for null. */ + +#define CONTAINS_PLACEHOLDER_P(EXP) \ + ((EXP) != 0 && ! TREE_CONSTANT (EXP) && contains_placeholder_p (EXP)) + +/* Return true if any part of the structure of TYPE involves a PLACEHOLDER_EXPR + directly. This includes size, bounds, qualifiers (for QUAL_UNION_TYPE) and + field positions. */ + +extern bool type_contains_placeholder_p (tree); + +/* Given a tree EXP, find all occurrences of references to fields + in a PLACEHOLDER_EXPR and place them in vector REFS without + duplicates. Also record VAR_DECLs and CONST_DECLs. Note that + we assume here that EXP contains only arithmetic expressions + or CALL_EXPRs with PLACEHOLDER_EXPRs occurring only in their + argument list. */ + +extern void find_placeholder_in_expr (tree, vec *); + +/* This macro calls the above function but short-circuits the common + case of a constant to save time and also checks for NULL. */ + +#define FIND_PLACEHOLDER_IN_EXPR(EXP, V) \ +do { \ + if((EXP) && !TREE_CONSTANT (EXP)) \ + find_placeholder_in_expr (EXP, V); \ +} while (0) + +/* Given a tree EXP, a FIELD_DECL F, and a replacement value R, + return a tree with all occurrences of references to F in a + PLACEHOLDER_EXPR replaced by R. Also handle VAR_DECLs and + CONST_DECLs. Note that we assume here that EXP contains only + arithmetic expressions or CALL_EXPRs with PLACEHOLDER_EXPRs + occurring only in their argument list. */ + +extern tree substitute_in_expr (tree, tree, tree); + +/* This macro calls the above function but short-circuits the common + case of a constant to save time and also checks for NULL. */ + +#define SUBSTITUTE_IN_EXPR(EXP, F, R) \ + ((EXP) == 0 || TREE_CONSTANT (EXP) ? (EXP) : substitute_in_expr (EXP, F, R)) + +/* Similar, but look for a PLACEHOLDER_EXPR in EXP and find a replacement + for it within OBJ, a tree that is an object or a chain of references. */ + +extern tree substitute_placeholder_in_expr (tree, tree); + +/* This macro calls the above function but short-circuits the common + case of a constant to save time and also checks for NULL. */ + +#define SUBSTITUTE_PLACEHOLDER_IN_EXPR(EXP, OBJ) \ + ((EXP) == 0 || TREE_CONSTANT (EXP) ? (EXP) \ + : substitute_placeholder_in_expr (EXP, OBJ)) + + +/* stabilize_reference (EXP) returns a reference equivalent to EXP + but it can be used multiple times + and only evaluate the subexpressions once. */ + +extern tree stabilize_reference (tree); + +/* Return EXP, stripped of any conversions to wider types + in such a way that the result of converting to type FOR_TYPE + is the same as if EXP were converted to FOR_TYPE. + If FOR_TYPE is 0, it signifies EXP's type. */ + +extern tree get_unwidened (tree, tree); + +/* Return OP or a simpler expression for a narrower value + which can be sign-extended or zero-extended to give back OP. + Store in *UNSIGNEDP_PTR either 1 if the value should be zero-extended + or 0 if the value should be sign-extended. */ + +extern tree get_narrower (tree, int *); + +/* Return true if T is an expression that get_inner_reference handles. */ + +static inline bool +handled_component_p (const_tree t) +{ + switch (TREE_CODE (t)) + { + case COMPONENT_REF: + case BIT_FIELD_REF: + case ARRAY_REF: + case ARRAY_RANGE_REF: + case REALPART_EXPR: + case IMAGPART_EXPR: + case VIEW_CONVERT_EXPR: + return true; + + default: + return false; + } +} + +/* Return true T is a component with reverse storage order. */ + +static inline bool +reverse_storage_order_for_component_p (tree t) +{ + /* The storage order only applies to scalar components. */ + if (AGGREGATE_TYPE_P (TREE_TYPE (t)) || VECTOR_TYPE_P (TREE_TYPE (t))) + return false; + + if (TREE_CODE (t) == REALPART_EXPR || TREE_CODE (t) == IMAGPART_EXPR) + t = TREE_OPERAND (t, 0); + + switch (TREE_CODE (t)) + { + case ARRAY_REF: + case COMPONENT_REF: + /* ??? Fortran can take COMPONENT_REF of a VOID_TYPE. */ + /* ??? UBSan can take COMPONENT_REF of a REFERENCE_TYPE. */ + return AGGREGATE_TYPE_P (TREE_TYPE (TREE_OPERAND (t, 0))) + && TYPE_REVERSE_STORAGE_ORDER (TREE_TYPE (TREE_OPERAND (t, 0))); + + case BIT_FIELD_REF: + case MEM_REF: + return REF_REVERSE_STORAGE_ORDER (t); + + case ARRAY_RANGE_REF: + case VIEW_CONVERT_EXPR: + default: + return false; + } + + gcc_unreachable (); +} + +/* Return true if T is a storage order barrier, i.e. a VIEW_CONVERT_EXPR + that can modify the storage order of objects. Note that, even if the + TYPE_REVERSE_STORAGE_ORDER flag is set on both the inner type and the + outer type, a VIEW_CONVERT_EXPR can modify the storage order because + it can change the partition of the aggregate object into scalars. */ + +static inline bool +storage_order_barrier_p (const_tree t) +{ + if (TREE_CODE (t) != VIEW_CONVERT_EXPR) + return false; + + if (AGGREGATE_TYPE_P (TREE_TYPE (t)) + && TYPE_REVERSE_STORAGE_ORDER (TREE_TYPE (t))) + return true; + + tree op = TREE_OPERAND (t, 0); + + if (AGGREGATE_TYPE_P (TREE_TYPE (op)) + && TYPE_REVERSE_STORAGE_ORDER (TREE_TYPE (op))) + return true; + + return false; +} + +/* Given a DECL or TYPE, return the scope in which it was declared, or + NUL_TREE if there is no containing scope. */ + +extern tree get_containing_scope (const_tree); + +/* Return the FUNCTION_DECL which provides this _DECL with its context, + or zero if none. */ +extern tree decl_function_context (const_tree); + +/* Return the RECORD_TYPE, UNION_TYPE, or QUAL_UNION_TYPE which provides + this _DECL with its context, or zero if none. */ +extern tree decl_type_context (const_tree); + +/* Return 1 if EXPR is the real constant zero. */ +extern int real_zerop (const_tree); + +/* Initialize the iterator I with arguments from function FNDECL */ + +static inline void +function_args_iter_init (function_args_iterator *i, const_tree fntype) +{ + i->next = TYPE_ARG_TYPES (fntype); +} + +/* Return a pointer that holds the next argument if there are more arguments to + handle, otherwise return NULL. */ + +static inline tree * +function_args_iter_cond_ptr (function_args_iterator *i) +{ + return (i->next) ? &TREE_VALUE (i->next) : NULL; +} + +/* Return the next argument if there are more arguments to handle, otherwise + return NULL. */ + +static inline tree +function_args_iter_cond (function_args_iterator *i) +{ + return (i->next) ? TREE_VALUE (i->next) : NULL_TREE; +} + +/* Advance to the next argument. */ +static inline void +function_args_iter_next (function_args_iterator *i) +{ + gcc_assert (i->next != NULL_TREE); + i->next = TREE_CHAIN (i->next); +} + +/* We set BLOCK_SOURCE_LOCATION only to inlined function entry points. */ + +static inline bool +inlined_function_outer_scope_p (const_tree block) +{ + return LOCATION_LOCUS (BLOCK_SOURCE_LOCATION (block)) != UNKNOWN_LOCATION; +} + +/* Loop over all function arguments of FNTYPE. In each iteration, PTR is set + to point to the next tree element. ITER is an instance of + function_args_iterator used to iterate the arguments. */ +#define FOREACH_FUNCTION_ARGS_PTR(FNTYPE, PTR, ITER) \ + for (function_args_iter_init (&(ITER), (FNTYPE)); \ + (PTR = function_args_iter_cond_ptr (&(ITER))) != NULL; \ + function_args_iter_next (&(ITER))) + +/* Loop over all function arguments of FNTYPE. In each iteration, TREE is set + to the next tree element. ITER is an instance of function_args_iterator + used to iterate the arguments. */ +#define FOREACH_FUNCTION_ARGS(FNTYPE, TREE, ITER) \ + for (function_args_iter_init (&(ITER), (FNTYPE)); \ + (TREE = function_args_iter_cond (&(ITER))) != NULL_TREE; \ + function_args_iter_next (&(ITER))) + +/* In tree.c */ +extern unsigned crc32_string (unsigned, const char *); +extern unsigned crc32_byte (unsigned, char); +extern unsigned crc32_unsigned (unsigned, unsigned); +extern void clean_symbol_name (char *); +extern tree get_file_function_name (const char *); +extern tree get_callee_fndecl (const_tree); +extern combined_fn get_call_combined_fn (const_tree); +extern int type_num_arguments (const_tree); +extern bool associative_tree_code (enum tree_code); +extern bool commutative_tree_code (enum tree_code); +extern bool commutative_ternary_tree_code (enum tree_code); +extern bool operation_can_overflow (enum tree_code); +extern bool operation_no_trapping_overflow (tree, enum tree_code); +extern tree upper_bound_in_type (tree, tree); +extern tree lower_bound_in_type (tree, tree); +extern int operand_equal_for_phi_arg_p (const_tree, const_tree); +extern tree create_artificial_label (location_t); +extern const char *get_name (tree); +extern bool stdarg_p (const_tree); +extern bool prototype_p (const_tree); +extern bool is_typedef_decl (const_tree x); +extern bool typedef_variant_p (const_tree); +extern bool auto_var_in_fn_p (const_tree, const_tree); +extern tree build_low_bits_mask (tree, unsigned); +extern bool tree_nop_conversion_p (const_tree, const_tree); +extern tree tree_strip_nop_conversions (tree); +extern tree tree_strip_sign_nop_conversions (tree); +extern const_tree strip_invariant_refs (const_tree); +extern tree lhd_gcc_personality (void); +extern void assign_assembler_name_if_needed (tree); +extern void warn_deprecated_use (tree, tree); +extern void cache_integer_cst (tree); +extern const char *combined_fn_name (combined_fn); + +/* Compare and hash for any structure which begins with a canonical + pointer. Assumes all pointers are interchangeable, which is sort + of already assumed by gcc elsewhere IIRC. */ + +static inline int +struct_ptr_eq (const void *a, const void *b) +{ + const void * const * x = (const void * const *) a; + const void * const * y = (const void * const *) b; + return *x == *y; +} + +static inline hashval_t +struct_ptr_hash (const void *a) +{ + const void * const * x = (const void * const *) a; + return (intptr_t)*x >> 4; +} + +/* Return nonzero if CODE is a tree code that represents a truth value. */ +static inline bool +truth_value_p (enum tree_code code) +{ + return (TREE_CODE_CLASS (code) == tcc_comparison + || code == TRUTH_AND_EXPR || code == TRUTH_ANDIF_EXPR + || code == TRUTH_OR_EXPR || code == TRUTH_ORIF_EXPR + || code == TRUTH_XOR_EXPR || code == TRUTH_NOT_EXPR); +} + +/* Return whether TYPE is a type suitable for an offset for + a POINTER_PLUS_EXPR. */ +static inline bool +ptrofftype_p (tree type) +{ + return (INTEGRAL_TYPE_P (type) + && TYPE_PRECISION (type) == TYPE_PRECISION (sizetype) + && TYPE_UNSIGNED (type) == TYPE_UNSIGNED (sizetype)); +} + +/* Return true if the argument is a complete type or an array + of unknown bound (whose type is incomplete but) whose elements + have complete type. */ +static inline bool +complete_or_array_type_p (const_tree type) +{ + return COMPLETE_TYPE_P (type) + || (TREE_CODE (type) == ARRAY_TYPE + && COMPLETE_TYPE_P (TREE_TYPE (type))); +} + +extern tree strip_float_extensions (tree); +extern int really_constant_p (const_tree); +extern bool decl_address_invariant_p (const_tree); +extern bool decl_address_ip_invariant_p (const_tree); +extern bool int_fits_type_p (const_tree, const_tree); +#ifndef GENERATOR_FILE +extern void get_type_static_bounds (const_tree, mpz_t, mpz_t); +#endif +extern bool variably_modified_type_p (tree, tree); +extern int tree_log2 (const_tree); +extern int tree_floor_log2 (const_tree); +extern unsigned int tree_ctz (const_tree); +extern int simple_cst_equal (const_tree, const_tree); + +namespace inchash +{ + +extern void add_expr (const_tree, hash &, unsigned int = 0); + +} + +/* Compat version until all callers are converted. Return hash for + TREE with SEED. */ +static inline hashval_t iterative_hash_expr(const_tree tree, hashval_t seed) +{ + inchash::hash hstate (seed); + inchash::add_expr (tree, hstate); + return hstate.end (); +} + +extern int compare_tree_int (const_tree, unsigned HOST_WIDE_INT); +extern int type_list_equal (const_tree, const_tree); +extern int chain_member (const_tree, const_tree); +extern void dump_tree_statistics (void); +extern void recompute_tree_invariant_for_addr_expr (tree); +extern bool needs_to_live_in_memory (const_tree); +extern tree reconstruct_complex_type (tree, tree); +extern int real_onep (const_tree); +extern int real_minus_onep (const_tree); +extern void init_ttree (void); +extern void build_common_tree_nodes (bool); +extern void build_common_builtin_nodes (void); +extern tree build_nonstandard_integer_type (unsigned HOST_WIDE_INT, int); +extern tree build_nonstandard_boolean_type (unsigned HOST_WIDE_INT); +extern tree build_range_type (tree, tree, tree); +extern tree build_nonshared_range_type (tree, tree, tree); +extern bool subrange_type_for_debug_p (const_tree, tree *, tree *); +extern HOST_WIDE_INT int_cst_value (const_tree); +extern tree tree_block (tree); +extern void tree_set_block (tree, tree); +extern location_t *block_nonartificial_location (tree); +extern location_t tree_nonartificial_location (tree); +extern tree block_ultimate_origin (const_tree); +extern tree get_binfo_at_offset (tree, HOST_WIDE_INT, tree); +extern bool virtual_method_call_p (const_tree); +extern tree obj_type_ref_class (const_tree ref); +extern bool types_same_for_odr (const_tree type1, const_tree type2, + bool strict=false); +extern bool contains_bitfld_component_ref_p (const_tree); +extern bool block_may_fallthru (const_tree); +extern void using_eh_for_cleanups (void); +extern bool using_eh_for_cleanups_p (void); +extern const char *get_tree_code_name (enum tree_code); +extern void set_call_expr_flags (tree, int); +extern tree walk_tree_1 (tree*, walk_tree_fn, void*, hash_set*, + walk_tree_lh); +extern tree walk_tree_without_duplicates_1 (tree*, walk_tree_fn, void*, + walk_tree_lh); +#define walk_tree(a,b,c,d) \ + walk_tree_1 (a, b, c, d, NULL) +#define walk_tree_without_duplicates(a,b,c) \ + walk_tree_without_duplicates_1 (a, b, c, NULL) + +extern tree drop_tree_overflow (tree); + +/* Given a memory reference expression T, return its base address. + The base address of a memory reference expression is the main + object being referenced. */ +extern tree get_base_address (tree t); + +/* Return a tree of sizetype representing the size, in bytes, of the element + of EXP, an ARRAY_REF or an ARRAY_RANGE_REF. */ +extern tree array_ref_element_size (tree); + +/* Return a tree representing the upper bound of the array mentioned in + EXP, an ARRAY_REF or an ARRAY_RANGE_REF. */ +extern tree array_ref_up_bound (tree); + +/* Return a tree representing the lower bound of the array mentioned in + EXP, an ARRAY_REF or an ARRAY_RANGE_REF. */ +extern tree array_ref_low_bound (tree); + +/* Returns true if REF is an array reference or a component reference + to an array at the end of a structure. If this is the case, the array + may be allocated larger than its upper bound implies. */ +extern bool array_at_struct_end_p (tree); + +/* Return a tree representing the offset, in bytes, of the field referenced + by EXP. This does not include any offset in DECL_FIELD_BIT_OFFSET. */ +extern tree component_ref_field_offset (tree); + +extern int tree_map_base_eq (const void *, const void *); +extern unsigned int tree_map_base_hash (const void *); +extern int tree_map_base_marked_p (const void *); +extern void DEBUG_FUNCTION verify_type (const_tree t); +extern bool gimple_canonical_types_compatible_p (const_tree, const_tree, + bool trust_type_canonical = true); +extern bool type_with_interoperable_signedness (const_tree); +extern bitmap get_nonnull_args (const_tree); +extern int get_range_pos_neg (tree); + +/* Return simplified tree code of type that is used for canonical type + merging. */ +inline enum tree_code +tree_code_for_canonical_type_merging (enum tree_code code) +{ + /* By C standard, each enumerated type shall be compatible with char, + a signed integer, or an unsigned integer. The choice of type is + implementation defined (in our case it depends on -fshort-enum). + + For this reason we make no distinction between ENUMERAL_TYPE and INTEGER + type and compare only by their signedness and precision. */ + if (code == ENUMERAL_TYPE) + return INTEGER_TYPE; + /* To allow inter-operability between languages having references and + C, we consider reference types and pointers alike. Note that this is + not strictly necessary for C-Fortran 2008 interoperability because + Fortran define C_PTR type that needs to be compatible with C pointers + and we handle this one as ptr_type_node. */ + if (code == REFERENCE_TYPE) + return POINTER_TYPE; + return code; +} + +/* Return ture if get_alias_set care about TYPE_CANONICAL of given type. + We don't define the types for pointers, arrays and vectors. The reason is + that pointers are handled specially: ptr_type_node accesses conflict with + accesses to all other pointers. This is done by alias.c. + Because alias sets of arrays and vectors are the same as types of their + elements, we can't compute canonical type either. Otherwise we could go + form void *[10] to int *[10] (because they are equivalent for canonical type + machinery) and get wrong TBAA. */ + +inline bool +canonical_type_used_p (const_tree t) +{ + return !(POINTER_TYPE_P (t) + || TREE_CODE (t) == ARRAY_TYPE + || TREE_CODE (t) == VECTOR_TYPE); +} + +#define tree_map_eq tree_map_base_eq +extern unsigned int tree_map_hash (const void *); +#define tree_map_marked_p tree_map_base_marked_p + +#define tree_decl_map_eq tree_map_base_eq +extern unsigned int tree_decl_map_hash (const void *); +#define tree_decl_map_marked_p tree_map_base_marked_p + +struct tree_decl_map_cache_hasher : ggc_cache_ptr_hash +{ + static hashval_t hash (tree_decl_map *m) { return tree_decl_map_hash (m); } + static bool + equal (tree_decl_map *a, tree_decl_map *b) + { + return tree_decl_map_eq (a, b); + } + + static int + keep_cache_entry (tree_decl_map *&m) + { + return ggc_marked_p (m->base.from); + } +}; + +#define tree_int_map_eq tree_map_base_eq +#define tree_int_map_hash tree_map_base_hash +#define tree_int_map_marked_p tree_map_base_marked_p + +#define tree_vec_map_eq tree_map_base_eq +#define tree_vec_map_hash tree_decl_map_hash +#define tree_vec_map_marked_p tree_map_base_marked_p + +/* Initialize the abstract argument list iterator object ITER with the + arguments from CALL_EXPR node EXP. */ +static inline void +init_call_expr_arg_iterator (tree exp, call_expr_arg_iterator *iter) +{ + iter->t = exp; + iter->n = call_expr_nargs (exp); + iter->i = 0; +} + +static inline void +init_const_call_expr_arg_iterator (const_tree exp, const_call_expr_arg_iterator *iter) +{ + iter->t = exp; + iter->n = call_expr_nargs (exp); + iter->i = 0; +} + +/* Return the next argument from abstract argument list iterator object ITER, + and advance its state. Return NULL_TREE if there are no more arguments. */ +static inline tree +next_call_expr_arg (call_expr_arg_iterator *iter) +{ + tree result; + if (iter->i >= iter->n) + return NULL_TREE; + result = CALL_EXPR_ARG (iter->t, iter->i); + iter->i++; + return result; +} + +static inline const_tree +next_const_call_expr_arg (const_call_expr_arg_iterator *iter) +{ + const_tree result; + if (iter->i >= iter->n) + return NULL_TREE; + result = CALL_EXPR_ARG (iter->t, iter->i); + iter->i++; + return result; +} + +/* Initialize the abstract argument list iterator object ITER, then advance + past and return the first argument. Useful in for expressions, e.g. + for (arg = first_call_expr_arg (exp, &iter); arg; + arg = next_call_expr_arg (&iter)) */ +static inline tree +first_call_expr_arg (tree exp, call_expr_arg_iterator *iter) +{ + init_call_expr_arg_iterator (exp, iter); + return next_call_expr_arg (iter); +} + +static inline const_tree +first_const_call_expr_arg (const_tree exp, const_call_expr_arg_iterator *iter) +{ + init_const_call_expr_arg_iterator (exp, iter); + return next_const_call_expr_arg (iter); +} + +/* Test whether there are more arguments in abstract argument list iterator + ITER, without changing its state. */ +static inline bool +more_call_expr_args_p (const call_expr_arg_iterator *iter) +{ + return (iter->i < iter->n); +} + +/* Iterate through each argument ARG of CALL_EXPR CALL, using variable ITER + (of type call_expr_arg_iterator) to hold the iteration state. */ +#define FOR_EACH_CALL_EXPR_ARG(arg, iter, call) \ + for ((arg) = first_call_expr_arg ((call), &(iter)); (arg); \ + (arg) = next_call_expr_arg (&(iter))) + +#define FOR_EACH_CONST_CALL_EXPR_ARG(arg, iter, call) \ + for ((arg) = first_const_call_expr_arg ((call), &(iter)); (arg); \ + (arg) = next_const_call_expr_arg (&(iter))) + +/* Return true if tree node T is a language-specific node. */ +static inline bool +is_lang_specific (const_tree t) +{ + return TREE_CODE (t) == LANG_TYPE || TREE_CODE (t) >= NUM_TREE_CODES; +} + +/* Valid builtin number. */ +#define BUILTIN_VALID_P(FNCODE) \ + (IN_RANGE ((int)FNCODE, ((int)BUILT_IN_NONE) + 1, ((int) END_BUILTINS) - 1)) + +/* Return the tree node for an explicit standard builtin function or NULL. */ +static inline tree +builtin_decl_explicit (enum built_in_function fncode) +{ + gcc_checking_assert (BUILTIN_VALID_P (fncode)); + + return builtin_info[(size_t)fncode].decl; +} + +/* Return the tree node for an implicit builtin function or NULL. */ +static inline tree +builtin_decl_implicit (enum built_in_function fncode) +{ + size_t uns_fncode = (size_t)fncode; + gcc_checking_assert (BUILTIN_VALID_P (fncode)); + + if (!builtin_info[uns_fncode].implicit_p) + return NULL_TREE; + + return builtin_info[uns_fncode].decl; +} + +/* Set explicit builtin function nodes and whether it is an implicit + function. */ + +static inline void +set_builtin_decl (enum built_in_function fncode, tree decl, bool implicit_p) +{ + size_t ufncode = (size_t)fncode; + + gcc_checking_assert (BUILTIN_VALID_P (fncode) + && (decl != NULL_TREE || !implicit_p)); + + builtin_info[ufncode].decl = decl; + builtin_info[ufncode].implicit_p = implicit_p; + builtin_info[ufncode].declared_p = false; +} + +/* Set the implicit flag for a builtin function. */ + +static inline void +set_builtin_decl_implicit_p (enum built_in_function fncode, bool implicit_p) +{ + size_t uns_fncode = (size_t)fncode; + + gcc_checking_assert (BUILTIN_VALID_P (fncode) + && builtin_info[uns_fncode].decl != NULL_TREE); + + builtin_info[uns_fncode].implicit_p = implicit_p; +} + +/* Set the declared flag for a builtin function. */ + +static inline void +set_builtin_decl_declared_p (enum built_in_function fncode, bool declared_p) +{ + size_t uns_fncode = (size_t)fncode; + + gcc_checking_assert (BUILTIN_VALID_P (fncode) + && builtin_info[uns_fncode].decl != NULL_TREE); + + builtin_info[uns_fncode].declared_p = declared_p; +} + +/* Return whether the standard builtin function can be used as an explicit + function. */ + +static inline bool +builtin_decl_explicit_p (enum built_in_function fncode) +{ + gcc_checking_assert (BUILTIN_VALID_P (fncode)); + return (builtin_info[(size_t)fncode].decl != NULL_TREE); +} + +/* Return whether the standard builtin function can be used implicitly. */ + +static inline bool +builtin_decl_implicit_p (enum built_in_function fncode) +{ + size_t uns_fncode = (size_t)fncode; + + gcc_checking_assert (BUILTIN_VALID_P (fncode)); + return (builtin_info[uns_fncode].decl != NULL_TREE + && builtin_info[uns_fncode].implicit_p); +} + +/* Return whether the standard builtin function was declared. */ + +static inline bool +builtin_decl_declared_p (enum built_in_function fncode) +{ + size_t uns_fncode = (size_t)fncode; + + gcc_checking_assert (BUILTIN_VALID_P (fncode)); + return (builtin_info[uns_fncode].decl != NULL_TREE + && builtin_info[uns_fncode].declared_p); +} + +/* Return true if T (assumed to be a DECL) is a global variable. + A variable is considered global if its storage is not automatic. */ + +static inline bool +is_global_var (const_tree t) +{ + return (TREE_STATIC (t) || DECL_EXTERNAL (t)); +} + +/* Return true if VAR may be aliased. A variable is considered as + maybe aliased if it has its address taken by the local TU + or possibly by another TU and might be modified through a pointer. */ + +static inline bool +may_be_aliased (const_tree var) +{ + return (TREE_CODE (var) != CONST_DECL + && (TREE_PUBLIC (var) + || DECL_EXTERNAL (var) + || TREE_ADDRESSABLE (var)) + && !((TREE_STATIC (var) || TREE_PUBLIC (var) || DECL_EXTERNAL (var)) + && ((TREE_READONLY (var) + && !TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (var))) + || (TREE_CODE (var) == VAR_DECL + && DECL_NONALIASED (var))))); +} + +/* Return pointer to optimization flags of FNDECL. */ +static inline struct cl_optimization * +opts_for_fn (const_tree fndecl) +{ + tree fn_opts = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl); + if (fn_opts == NULL_TREE) + fn_opts = optimization_default_node; + return TREE_OPTIMIZATION (fn_opts); +} + +/* Return pointer to target flags of FNDECL. */ +static inline cl_target_option * +target_opts_for_fn (const_tree fndecl) +{ + tree fn_opts = DECL_FUNCTION_SPECIFIC_TARGET (fndecl); + if (fn_opts == NULL_TREE) + fn_opts = target_option_default_node; + return fn_opts == NULL_TREE ? NULL : TREE_TARGET_OPTION (fn_opts); +} + +/* opt flag for function FNDECL, e.g. opts_for_fn (fndecl, optimize) is + the optimization level of function fndecl. */ +#define opt_for_fn(fndecl, opt) (opts_for_fn (fndecl)->x_##opt) + +/* For anonymous aggregate types, we need some sort of name to + hold on to. In practice, this should not appear, but it should + not be harmful if it does. */ +extern const char *anon_aggrname_format(); +extern bool anon_aggrname_p (const_tree); + +/* The tree and const_tree overload templates. */ +namespace wi +{ + template <> + struct int_traits + { + static const enum precision_type precision_type = VAR_PRECISION; + static const bool host_dependent_precision = false; + static const bool is_sign_extended = false; + static unsigned int get_precision (const_tree); + static wi::storage_ref decompose (HOST_WIDE_INT *, unsigned int, + const_tree); + }; + + template <> + struct int_traits : public int_traits {}; + + template + class extended_tree + { + private: + const_tree m_t; + + public: + extended_tree (const_tree); + + unsigned int get_precision () const; + const HOST_WIDE_INT *get_val () const; + unsigned int get_len () const; + }; + + template + struct int_traits > + { + static const enum precision_type precision_type = CONST_PRECISION; + static const bool host_dependent_precision = false; + static const bool is_sign_extended = true; + static const unsigned int precision = N; + }; + + generic_wide_int > + to_widest (const_tree); + + generic_wide_int > to_offset (const_tree); + + wide_int to_wide (const_tree, unsigned int); +} + +inline unsigned int +wi::int_traits ::get_precision (const_tree tcst) +{ + return TYPE_PRECISION (TREE_TYPE (tcst)); +} + +/* Convert the tree_cst X into a wide_int of PRECISION. */ +inline wi::storage_ref +wi::int_traits ::decompose (HOST_WIDE_INT *, + unsigned int precision, const_tree x) +{ + return wi::storage_ref (&TREE_INT_CST_ELT (x, 0), TREE_INT_CST_NUNITS (x), + precision); +} + +inline generic_wide_int > +wi::to_widest (const_tree t) +{ + return t; +} + +inline generic_wide_int > +wi::to_offset (const_tree t) +{ + return t; +} + +/* Convert INTEGER_CST T to a wide_int of precision PREC, extending or + truncating as necessary. When extending, use sign extension if T's + type is signed and zero extension if T's type is unsigned. */ + +inline wide_int +wi::to_wide (const_tree t, unsigned int prec) +{ + return wide_int::from (t, prec, TYPE_SIGN (TREE_TYPE (t))); +} + +template +inline wi::extended_tree ::extended_tree (const_tree t) + : m_t (t) +{ + gcc_checking_assert (TYPE_PRECISION (TREE_TYPE (t)) <= N); +} + +template +inline unsigned int +wi::extended_tree ::get_precision () const +{ + return N; +} + +template +inline const HOST_WIDE_INT * +wi::extended_tree ::get_val () const +{ + return &TREE_INT_CST_ELT (m_t, 0); +} + +template +inline unsigned int +wi::extended_tree ::get_len () const +{ + if (N == ADDR_MAX_PRECISION) + return TREE_INT_CST_OFFSET_NUNITS (m_t); + else if (N >= WIDE_INT_MAX_PRECISION) + return TREE_INT_CST_EXT_NUNITS (m_t); + else + /* This class is designed to be used for specific output precisions + and needs to be as fast as possible, so there is no fallback for + other casees. */ + gcc_unreachable (); +} + +namespace wi +{ + template + bool fits_to_boolean_p (const T &x, const_tree); + + template + bool fits_to_tree_p (const T &x, const_tree); + + wide_int min_value (const_tree); + wide_int max_value (const_tree); + wide_int from_mpz (const_tree, mpz_t, bool); +} + +template +bool +wi::fits_to_boolean_p (const T &x, const_tree type) +{ + return eq_p (x, 0) || eq_p (x, TYPE_UNSIGNED (type) ? 1 : -1); +} + +template +bool +wi::fits_to_tree_p (const T &x, const_tree type) +{ + /* Non-standard boolean types can have arbitrary precision but various + transformations assume that they can only take values 0 and +/-1. */ + if (TREE_CODE (type) == BOOLEAN_TYPE) + return fits_to_boolean_p (x, type); + + if (TYPE_UNSIGNED (type)) + return eq_p (x, zext (x, TYPE_PRECISION (type))); + else + return eq_p (x, sext (x, TYPE_PRECISION (type))); +} + +/* Produce the smallest number that is represented in TYPE. The precision + and sign are taken from TYPE. */ +inline wide_int +wi::min_value (const_tree type) +{ + return min_value (TYPE_PRECISION (type), TYPE_SIGN (type)); +} + +/* Produce the largest number that is represented in TYPE. The precision + and sign are taken from TYPE. */ +inline wide_int +wi::max_value (const_tree type) +{ + return max_value (TYPE_PRECISION (type), TYPE_SIGN (type)); +} + +/* Return true if INTEGER_CST T1 is less than INTEGER_CST T2, + extending both according to their respective TYPE_SIGNs. */ + +inline bool +tree_int_cst_lt (const_tree t1, const_tree t2) +{ + return wi::to_widest (t1) < wi::to_widest (t2); +} + +/* Return true if INTEGER_CST T1 is less than or equal to INTEGER_CST T2, + extending both according to their respective TYPE_SIGNs. */ + +inline bool +tree_int_cst_le (const_tree t1, const_tree t2) +{ + return wi::to_widest (t1) <= wi::to_widest (t2); +} + +/* Returns -1 if T1 < T2, 0 if T1 == T2, and 1 if T1 > T2. T1 and T2 + are both INTEGER_CSTs and their values are extended according to their + respective TYPE_SIGNs. */ + +inline int +tree_int_cst_compare (const_tree t1, const_tree t2) +{ + return wi::cmps (wi::to_widest (t1), wi::to_widest (t2)); +} + +/* FIXME - These declarations belong in builtins.h, expr.h and emit-rtl.h, + but none of these files are allowed to be included from front ends. + They should be split in two. One suitable for the FEs, the other suitable + for the BE. */ + +/* Assign the RTX to declaration. */ +extern void set_decl_rtl (tree, rtx); +extern bool complete_ctor_at_level_p (const_tree, HOST_WIDE_INT, const_tree); + +/* Given an expression EXP that is a handled_component_p, + look for the ultimate containing object, which is returned and specify + the access position and size. */ +extern tree get_inner_reference (tree, HOST_WIDE_INT *, HOST_WIDE_INT *, + tree *, machine_mode *, int *, int *, int *); + +extern tree build_personality_function (const char *); + +struct GTY(()) int_n_trees_t { + /* These parts are initialized at runtime */ + tree signed_type; + tree unsigned_type; +}; + +/* This is also in machmode.h */ +extern bool int_n_enabled_p[NUM_INT_N_ENTS]; +extern GTY(()) struct int_n_trees_t int_n_trees[NUM_INT_N_ENTS]; + +/* Like bit_position, but return as an integer. It must be representable in + that way (since it could be a signed value, we don't have the + option of returning -1 like int_size_in_byte can. */ + +inline HOST_WIDE_INT +int_bit_position (const_tree field) +{ + return ((wi::to_offset (DECL_FIELD_OFFSET (field)) << LOG2_BITS_PER_UNIT) + + wi::to_offset (DECL_FIELD_BIT_OFFSET (field))).to_shwi (); +} + +/* Return true if it makes sense to consider alias set for a type T. */ + +inline bool +type_with_alias_set_p (const_tree t) +{ + /* Function and method types are never accessed as memory locations. */ + if (TREE_CODE (t) == FUNCTION_TYPE || TREE_CODE (t) == METHOD_TYPE) + return false; + + if (COMPLETE_TYPE_P (t)) + return true; + + /* Incomplete types can not be accessed in general except for arrays + where we can fetch its element despite we have no array bounds. */ + if (TREE_CODE (t) == ARRAY_TYPE && COMPLETE_TYPE_P (TREE_TYPE (t))) + return true; + + return false; +} + +extern location_t set_block (location_t loc, tree block); + +extern void gt_ggc_mx (tree &); +extern void gt_pch_nx (tree &); +extern void gt_pch_nx (tree &, gt_pointer_operator, void *); + +extern bool nonnull_arg_p (const_tree); +extern bool is_redundant_typedef (const_tree); +extern bool expr_type_first_operand_type_p (tree_code); + +extern location_t +set_source_range (tree expr, location_t start, location_t finish); + +extern location_t +set_source_range (tree expr, source_range src_range); + +static inline source_range +get_decl_source_range (tree decl) +{ + location_t loc = DECL_SOURCE_LOCATION (decl); + return get_range_from_loc (line_table, loc); +} + +/* Return true if it makes sense to promote/demote from_type to to_type. */ +inline bool +desired_pro_or_demotion_p (const_tree to_type, const_tree from_type) +{ + unsigned int to_type_precision = TYPE_PRECISION (to_type); + + /* OK to promote if to_type is no bigger than word_mode. */ + if (to_type_precision <= GET_MODE_PRECISION (word_mode)) + return true; + + /* Otherwise, allow only if narrowing or same precision conversions. */ + return to_type_precision <= TYPE_PRECISION (from_type); +} + +#endif /* GCC_TREE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tsan.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tsan.h new file mode 100644 index 0000000..cdcc068 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tsan.h @@ -0,0 +1,26 @@ +/* ThreadSanitizer, a data race detector. + Copyright (C) 2011-2017 Free Software Foundation, Inc. + Contributed by Dmitry Vyukov + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef TREE_TSAN +#define TREE_TSAN + +extern void tsan_finish_file (void); + +#endif /* TREE_TSAN */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tsystem.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tsystem.h new file mode 100644 index 0000000..37c941b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/tsystem.h @@ -0,0 +1,137 @@ +/* Get common system includes and various definitions and declarations + based on target macros. + Copyright (C) 2000-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +#ifndef GCC_TSYSTEM_H +#define GCC_TSYSTEM_H + +/* System headers (e.g. stdio.h, stdlib.h, unistd.h) sometimes + indirectly include getopt.h. Our -I flags will cause gcc's gnu + getopt.h to be included, not the platform's copy. In the default + case, gnu getopt.h will provide us with a no-argument prototype + which will generate -Wstrict-prototypes warnings. None of the + target files actually use getopt, so it is safe to tell gnu + getopt.h we never need this prototype. */ +#ifndef HAVE_DECL_GETOPT +#define HAVE_DECL_GETOPT 1 +#endif + +/* We want everything from the glibc headers. */ +#define _GNU_SOURCE 1 + +/* GCC supplies these headers. */ +#include +#include + +#ifdef inhibit_libc + +#ifndef malloc +extern void *malloc (size_t); +#endif + +#ifndef free +extern void free (void *); +#endif + +#ifndef atexit +extern int atexit (void (*)(void)); +#endif + +#ifndef abort +extern void abort (void) __attribute__ ((__noreturn__)); +#endif + +#ifndef strlen +extern size_t strlen (const char *); +#endif + +#ifndef memcpy +extern void *memcpy (void *, const void *, size_t); +#endif + +#ifndef memset +extern void *memset (void *, int, size_t); +#endif + +#else /* ! inhibit_libc */ +/* We disable this when inhibit_libc, so that gcc can still be built without + needing header files first. */ +/* ??? This is not a good solution, since prototypes may be required in + some cases for correct code. */ + +/* GCC supplies this header. */ +#include + +/* All systems have this header. */ +#include + +/* All systems have this header. */ +#include + +/* All systems have this header. */ +#include + +#ifndef errno +extern int errno; +#endif + +/* If these system headers do not exist, fixincludes must create them. */ +#include +#include +#include + +/* GCC supplies this header. */ +#include + +/* If these system headers do not exist, fixincludes must create them. */ +#include + +#endif /* inhibit_libc */ + +/* Define a generic NULL if one hasn't already been defined. */ +#ifndef NULL +#define NULL 0 +#endif + +/* GCC always provides __builtin_alloca(x). */ +#undef alloca +#define alloca(x) __builtin_alloca(x) + +#ifdef ENABLE_RUNTIME_CHECKING +#define gcc_assert(EXPR) ((void)(!(EXPR) ? abort (), 0 : 0)) +#else +/* Include EXPR, so that unused variable warnings do not occur. */ +#define gcc_assert(EXPR) ((void)(0 && (EXPR))) +#endif +/* Use gcc_unreachable() to mark unreachable locations (like an + unreachable default case of a switch. Do not use gcc_assert(0). */ +#define gcc_unreachable() (abort ()) + +#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq) +#define CONST_CAST(TYPE,X) CONST_CAST2 (TYPE, const TYPE, (X)) + +/* Filename handling macros. */ +#include "filenames.h" + +#endif /* ! GCC_TSYSTEM_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/typeclass.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/typeclass.h new file mode 100644 index 0000000..47a4534 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/typeclass.h @@ -0,0 +1,43 @@ +/* Type class enum + Copyright (C) 2004-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +#ifndef GCC_TYPECLASS_H +#define GCC_TYPECLASS_H + +/* Values returned by __builtin_classify_type. */ + +enum type_class +{ + no_type_class = -1, + void_type_class, integer_type_class, char_type_class, + enumeral_type_class, boolean_type_class, + pointer_type_class, reference_type_class, offset_type_class, + real_type_class, complex_type_class, + function_type_class, method_type_class, + record_type_class, union_type_class, + array_type_class, string_type_class, + lang_type_class +}; + +#endif /* GCC_TYPECLASS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/typed-splay-tree.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/typed-splay-tree.h new file mode 100644 index 0000000..b41ff7a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/typed-splay-tree.h @@ -0,0 +1,197 @@ +/* A typesafe wrapper around libiberty's splay-tree.h. + Copyright (C) 2015-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_TYPED_SPLAY_TREE_H +#define GCC_TYPED_SPLAY_TREE_H + +#include "splay-tree.h" + +/* Typesafe wrapper around libiberty's splay-tree.h. */ +template +class typed_splay_tree +{ + public: + typedef KEY_TYPE key_type; + typedef VALUE_TYPE value_type; + + typedef int (*compare_fn) (key_type, key_type); + typedef void (*delete_key_fn) (key_type); + typedef void (*delete_value_fn) (value_type); + typedef int (*foreach_fn) (key_type, value_type, void *); + + typed_splay_tree (compare_fn, + delete_key_fn, + delete_value_fn); + ~typed_splay_tree (); + + value_type lookup (key_type k); + value_type predecessor (key_type k); + value_type successor (key_type k); + void insert (key_type k, value_type v); + value_type max (); + value_type min (); + int foreach (foreach_fn, void *); + + private: + /* Helper type for typed_splay_tree::foreach. */ + struct closure + { + closure (foreach_fn outer_cb, void *outer_user_data) + : m_outer_cb (outer_cb), m_outer_user_data (outer_user_data) {} + + foreach_fn m_outer_cb; + void *m_outer_user_data; + }; + + static int inner_foreach_fn (splay_tree_node node, void *user_data); + + static value_type node_to_value (splay_tree_node node); + + private: + ::splay_tree m_inner; +}; + +/* Constructor for typed_splay_tree . */ + +template +inline typed_splay_tree:: + typed_splay_tree (compare_fn compare_fn, + delete_key_fn delete_key_fn, + delete_value_fn delete_value_fn) +{ + m_inner = splay_tree_new ((splay_tree_compare_fn)compare_fn, + (splay_tree_delete_key_fn)delete_key_fn, + (splay_tree_delete_value_fn)delete_value_fn); +} + +/* Destructor for typed_splay_tree . */ + +template +inline typed_splay_tree:: + ~typed_splay_tree () +{ + splay_tree_delete (m_inner); +} + +/* Lookup KEY, returning a value if present, and NULL + otherwise. */ + +template +inline VALUE_TYPE +typed_splay_tree::lookup (key_type key) +{ + splay_tree_node node = splay_tree_lookup (m_inner, (splay_tree_key)key); + return node_to_value (node); +} + +/* Return the immediate predecessor of KEY, or NULL if there is no + predecessor. KEY need not be present in the tree. */ + +template +inline VALUE_TYPE +typed_splay_tree::predecessor (key_type key) +{ + splay_tree_node node = splay_tree_predecessor (m_inner, (splay_tree_key)key); + return node_to_value (node); +} + +/* Return the immediate successor of KEY, or NULL if there is no + successor. KEY need not be present in the tree. */ + +template +inline VALUE_TYPE +typed_splay_tree::successor (key_type k) +{ + splay_tree_node node = splay_tree_successor (m_inner, (splay_tree_key)k); + return node_to_value (node); +} + +/* Insert a new node (associating KEY with VALUE). If a + previous node with the indicated KEY exists, its data is replaced + with the new value. */ + +template +inline void +typed_splay_tree::insert (key_type key, + value_type value) +{ + splay_tree_insert (m_inner, + (splay_tree_key)key, + (splay_tree_value)value); +} + +/* Get the value with maximal key. */ + +template +inline VALUE_TYPE +typed_splay_tree::max () +{ + return node_to_value (splay_tree_max (m_inner)); +} + +/* Get the value with minimal key. */ + +template +inline VALUE_TYPE +typed_splay_tree::min () +{ + return node_to_value (splay_tree_min (m_inner)); +} + +/* Call OUTER_CB, passing it the OUTER_USER_DATA, for every node, + following an in-order traversal. If OUTER_CB ever returns a non-zero + value, the iteration ceases immediately, and the value is returned. + Otherwise, this function returns 0. */ + +template +inline int +typed_splay_tree::foreach (foreach_fn outer_cb, + void *outer_user_data) +{ + closure c (outer_cb, outer_user_data); + + return splay_tree_foreach (m_inner, inner_foreach_fn, &c); +} + +/* Helper function for typed_splay_tree::foreach. */ + +template +int +typed_splay_tree::inner_foreach_fn (splay_tree_node node, + void *user_data) +{ + closure *c = (closure *)user_data; + + return c->m_outer_cb ((KEY_TYPE)node->key, (VALUE_TYPE)node->value, + c->m_outer_user_data); +} + +/* Internal function for converting from splay_tree_node to + VALUE_TYPE. */ +template +inline VALUE_TYPE +typed_splay_tree::node_to_value (splay_tree_node node) +{ + if (node) + return (value_type)node->value; + else + return 0; +} + +#endif /* GCC_TYPED_SPLAY_TREE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ubsan.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ubsan.h new file mode 100644 index 0000000..56c4136 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/ubsan.h @@ -0,0 +1,69 @@ +/* UndefinedBehaviorSanitizer, undefined behavior detector. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + Contributed by Marek Polacek + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_UBSAN_H +#define GCC_UBSAN_H + +/* The various kinds of NULL pointer checks. */ +enum ubsan_null_ckind { + UBSAN_LOAD_OF, + UBSAN_STORE_OF, + UBSAN_REF_BINDING, + UBSAN_MEMBER_ACCESS, + UBSAN_MEMBER_CALL, + UBSAN_CTOR_CALL, + UBSAN_DOWNCAST_POINTER, + UBSAN_DOWNCAST_REFERENCE, + UBSAN_UPCAST, + UBSAN_CAST_TO_VBASE +}; + +/* This controls how ubsan prints types. Used in ubsan_type_descriptor. */ +enum ubsan_print_style { + UBSAN_PRINT_NORMAL, + UBSAN_PRINT_POINTER, + UBSAN_PRINT_ARRAY +}; + +/* This controls ubsan_encode_value behavior. */ +enum ubsan_encode_value_phase { + UBSAN_ENCODE_VALUE_GENERIC, + UBSAN_ENCODE_VALUE_GIMPLE, + UBSAN_ENCODE_VALUE_RTL +}; + +extern bool do_ubsan_in_current_function (void); +extern bool ubsan_expand_bounds_ifn (gimple_stmt_iterator *); +extern bool ubsan_expand_null_ifn (gimple_stmt_iterator *); +extern bool ubsan_expand_objsize_ifn (gimple_stmt_iterator *); +extern bool ubsan_expand_vptr_ifn (gimple_stmt_iterator *); +extern bool ubsan_instrument_unreachable (gimple_stmt_iterator *); +extern tree ubsan_create_data (const char *, int, const location_t *, ...); +extern tree ubsan_type_descriptor (tree, ubsan_print_style + = UBSAN_PRINT_NORMAL); +extern tree ubsan_encode_value (tree, ubsan_encode_value_phase + = UBSAN_ENCODE_VALUE_GENERIC); +extern bool is_ubsan_builtin_p (tree); +extern tree ubsan_build_overflow_builtin (tree_code, location_t, tree, tree, + tree, tree *); +extern tree ubsan_instrument_float_cast (location_t, tree, tree); +extern tree ubsan_get_source_location_type (void); + +#endif /* GCC_UBSAN_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/valtrack.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/valtrack.h new file mode 100644 index 0000000..1feeb8d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/valtrack.h @@ -0,0 +1,139 @@ +/* Infrastructure for tracking user variable locations and values + throughout compilation. + Copyright (C) 2010-2017 Free Software Foundation, Inc. + Contributed by Alexandre Oliva . + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_VALTRACK_H +#define GCC_VALTRACK_H + +/* Debug uses of dead regs. */ + +/* Entry that maps a dead pseudo (REG) used in a debug insns that dies + at different blocks to the debug temp (DTEMP) it was replaced + with. */ + +struct dead_debug_global_entry +{ + rtx reg; + rtx dtemp; +}; + +/* Descriptor for hash_table to hash by dead_debug_global_entry's REG + and map to DTEMP. */ + +struct dead_debug_hash_descr : free_ptr_hash +{ + /* Hash on the pseudo number. */ + static inline hashval_t hash (const dead_debug_global_entry *my); + /* Entries are identical if they refer to the same pseudo. */ + static inline bool equal (const dead_debug_global_entry *my, + const dead_debug_global_entry *other); +}; + +/* Hash on the pseudo number. */ +inline hashval_t +dead_debug_hash_descr::hash (const dead_debug_global_entry *my) +{ + return REGNO (my->reg); +} + +/* Entries are identical if they refer to the same pseudo. */ +inline bool +dead_debug_hash_descr::equal (const dead_debug_global_entry *my, + const dead_debug_global_entry *other) +{ + return my->reg == other->reg; +} + +/* Maintain a global table of pseudos used in debug insns after their + deaths in other blocks, and debug temps their deathpoint values are + to be bound to. */ + +struct dead_debug_global +{ + /* This hash table that maps pseudos to debug temps. */ + hash_table *htab; + /* For each entry in htab, the bit corresponding to its REGNO will + be set. */ + bitmap used; +}; + +/* Node of a linked list of uses of dead REGs in debug insns. */ + +struct dead_debug_use +{ + df_ref use; + struct dead_debug_use *next; +}; + +/* Linked list of the above, with a bitmap of the REGs in the + list. */ + +struct dead_debug_local +{ + /* The first dead_debug_use entry in the list. */ + struct dead_debug_use *head; + /* A pointer to the global tracking data structure. */ + struct dead_debug_global *global; + /* A bitmap that has bits set for each REG used in the + dead_debug_use list, and for each entry in the global hash + table. */ + bitmap used; + /* A bitmap that has bits set for each INSN that is to be + rescanned. */ + bitmap to_rescan; +}; + +/* This type controls the behavior of dead_debug_insert_temp WRT + UREGNO and INSN. */ + +enum debug_temp_where + { + /* Bind a newly-created debug temporary to a REG for UREGNO, and + insert the debug insn before INSN. REG is expected to die at + INSN. */ + DEBUG_TEMP_BEFORE_WITH_REG = -1, + /* Bind a newly-created debug temporary to the value INSN stores + in REG, and insert the debug insn before INSN. */ + DEBUG_TEMP_BEFORE_WITH_VALUE = 0, + /* Bind a newly-created debug temporary to a REG for UREGNO, and + insert the debug insn after INSN. REG is expected to be set at + INSN. */ + DEBUG_TEMP_AFTER_WITH_REG = 1, + /* Like DEBUG_TEMP_AFTER_WITH_REG, but force addition of a debug + temporary even if there is just a single debug use. This is used + on regs that are becoming REG_DEAD on INSN and so uses of the + reg later on are invalid. */ + DEBUG_TEMP_AFTER_WITH_REG_FORCE = 2 + }; + +extern void dead_debug_global_init (struct dead_debug_global *, bitmap); +extern void dead_debug_global_finish (struct dead_debug_global *, bitmap); +extern void dead_debug_local_init (struct dead_debug_local *, bitmap, + struct dead_debug_global *); +extern void dead_debug_local_finish (struct dead_debug_local *, bitmap); +extern void dead_debug_add (struct dead_debug_local *, df_ref, unsigned int); +extern int dead_debug_insert_temp (struct dead_debug_local *, + unsigned int uregno, rtx_insn *insn, + enum debug_temp_where); + +extern void propagate_for_debug (rtx_insn *, rtx_insn *, rtx, rtx, basic_block); + + +#endif /* GCC_VALTRACK_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/value-prof.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/value-prof.h new file mode 100644 index 0000000..a853340 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/value-prof.h @@ -0,0 +1,120 @@ +/* Definitions for transformations based on profile information for values. + Copyright (C) 2003-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_VALUE_PROF_H +#define GCC_VALUE_PROF_H + +/* Supported histogram types. */ +enum hist_type +{ + HIST_TYPE_INTERVAL, /* Measures histogram of values inside a specified + interval. */ + HIST_TYPE_POW2, /* Histogram of power of 2 values. */ + HIST_TYPE_SINGLE_VALUE, /* Tries to identify the value that is (almost) + always constant. */ + HIST_TYPE_INDIR_CALL, /* Tries to identify the function that is (almost) + called in indirect call */ + HIST_TYPE_AVERAGE, /* Compute average value (sum of all values). */ + HIST_TYPE_IOR, /* Used to compute expected alignment. */ + HIST_TYPE_TIME_PROFILE, /* Used for time profile */ + HIST_TYPE_INDIR_CALL_TOPN, /* Tries to identify the top N most frequently + called functions in indirect call. */ + HIST_TYPE_MAX +}; + +#define COUNTER_FOR_HIST_TYPE(TYPE) ((int) (TYPE) + GCOV_FIRST_VALUE_COUNTER) +#define HIST_TYPE_FOR_COUNTER(COUNTER) \ + ((enum hist_type) ((COUNTER) - GCOV_FIRST_VALUE_COUNTER)) + + +/* The value to measure. */ +struct histogram_value_t +{ + struct + { + tree value; /* The value to profile. */ + gimple *stmt; /* Insn containing the value. */ + gcov_type *counters; /* Pointer to first counter. */ + struct histogram_value_t *next; /* Linked list pointer. */ + } hvalue; + enum hist_type type; /* Type of information to measure. */ + unsigned n_counters; /* Number of required counters. */ + struct function *fun; + union + { + struct + { + int int_start; /* First value in interval. */ + unsigned int steps; /* Number of values in it. */ + } intvl; /* Interval histogram data. */ + } hdata; /* Profiled information specific data. */ +}; + +typedef struct histogram_value_t *histogram_value; +typedef const struct histogram_value_t *const_histogram_value; + + +typedef vec histogram_values; + +extern void gimple_find_values_to_profile (histogram_values *); +extern bool gimple_value_profile_transformations (void); + +histogram_value gimple_alloc_histogram_value (struct function *, enum hist_type, + gimple *stmt, tree); +histogram_value gimple_histogram_value (struct function *, gimple *); +histogram_value gimple_histogram_value_of_type (struct function *, gimple *, + enum hist_type); +void gimple_add_histogram_value (struct function *, gimple *, histogram_value); +void dump_histograms_for_stmt (struct function *, FILE *, gimple *); +void gimple_remove_histogram_value (struct function *, gimple *, histogram_value); +void gimple_remove_stmt_histograms (struct function *, gimple *); +void gimple_duplicate_stmt_histograms (struct function *, gimple *, + struct function *, gimple *); +void gimple_move_stmt_histograms (struct function *, gimple *, gimple *); +void verify_histograms (void); +void free_histograms (function *); +void stringop_block_profile (gimple *, unsigned int *, HOST_WIDE_INT *); +gcall *gimple_ic (gcall *, struct cgraph_node *, int, gcov_type, + gcov_type); +bool check_ic_target (gcall *, struct cgraph_node *); + + +/* In tree-profile.c. */ +extern void gimple_init_gcov_profiler (void); +extern void gimple_gen_edge_profiler (int, edge); +extern void gimple_gen_interval_profiler (histogram_value, unsigned, unsigned); +extern void gimple_gen_pow2_profiler (histogram_value, unsigned, unsigned); +extern void gimple_gen_one_value_profiler (histogram_value, unsigned, unsigned); +extern void gimple_gen_ic_profiler (histogram_value, unsigned, unsigned); +extern void gimple_gen_ic_func_profiler (void); +extern void gimple_gen_time_profiler (unsigned, unsigned); +extern void gimple_gen_average_profiler (histogram_value, unsigned, unsigned); +extern void gimple_gen_ior_profiler (histogram_value, unsigned, unsigned); +extern void stream_out_histogram_value (struct output_block *, histogram_value); +extern void stream_in_histogram_value (struct lto_input_block *, gimple *); +extern struct cgraph_node* find_func_by_profile_id (int func_id); + + +/* In profile.c. */ +extern void init_branch_prob (void); +extern void branch_prob (void); +extern void end_branch_prob (void); + +#endif /* GCC_VALUE_PROF_H */ + diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/varasm.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/varasm.h new file mode 100644 index 0000000..c752b8a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/varasm.h @@ -0,0 +1,82 @@ +/* Declarations for varasm.h. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_VARASM_H +#define GCC_VARASM_H + +/* The following global holds the "function name" for the code in the + cold section of a function, if hot/cold function splitting is enabled + and there was actually code that went into the cold section. A + pseudo function name is needed for the cold section of code for some + debugging tools that perform symbolization. */ +extern tree cold_function_name; + +extern tree tree_output_constant_def (tree); +extern void make_decl_rtl (tree); +extern rtx make_decl_rtl_for_debug (tree); +extern void make_decl_one_only (tree, tree); +extern int supports_one_only (void); +extern void resolve_unique_section (tree, int, int); +extern void mark_referenced (tree); +extern void mark_decl_referenced (tree); +extern void notice_global_symbol (tree); +extern void set_user_assembler_name (tree, const char *); +extern void process_pending_assemble_externals (void); +extern bool decl_replaceable_p (tree); +extern bool decl_binds_to_current_def_p (const_tree); +extern enum tls_model decl_default_tls_model (const_tree); + +/* Declare DECL to be a weak symbol. */ +extern void declare_weak (tree); + +/* Merge weak status. */ +extern void merge_weak (tree, tree); + +/* Make one symbol an alias for another. */ +extern void assemble_alias (tree, tree); + +/* Return nonzero if VALUE is a valid constant-valued expression + for use in initializing a static variable; one that can be an + element of a "constant" initializer. + + Return null_pointer_node if the value is absolute; + if it is relocatable, return the variable that determines the relocation. + We assume that VALUE has been folded as much as possible; + therefore, we do not need to check for such things as + arithmetic-combinations of integers. */ +extern tree initializer_constant_valid_p (tree, tree, bool = false); + +/* Return true if VALUE is a valid constant-valued expression + for use in initializing a static bit-field; one that can be + an element of a "constant" initializer. */ +extern bool initializer_constant_valid_for_bitfield_p (tree); + +/* Whether a constructor CTOR is a valid static constant initializer if all + its elements are. This used to be internal to initializer_constant_valid_p + and has been exposed to let other functions like categorize_ctor_elements + evaluate the property while walking a constructor for other purposes. */ +extern bool constructor_static_from_elts_p (const_tree); + +extern void init_varasm_status (void); + +extern rtx assemble_static_space (unsigned HOST_WIDE_INT); + +extern rtx assemble_trampoline_template (void); + +#endif // GCC_VARASM_H diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/vec.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/vec.h new file mode 100644 index 0000000..fee4616 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/vec.h @@ -0,0 +1,1772 @@ +/* Vector API for GNU compiler. + Copyright (C) 2004-2017 Free Software Foundation, Inc. + Contributed by Nathan Sidwell + Re-implemented in C++ by Diego Novillo + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_VEC_H +#define GCC_VEC_H + +/* Some gen* file have no ggc support as the header file gtype-desc.h is + missing. Provide these definitions in case ggc.h has not been included. + This is not a problem because any code that runs before gengtype is built + will never need to use GC vectors.*/ + +extern void ggc_free (void *); +extern size_t ggc_round_alloc_size (size_t requested_size); +extern void *ggc_realloc (void *, size_t MEM_STAT_DECL); + +/* Templated vector type and associated interfaces. + + The interface functions are typesafe and use inline functions, + sometimes backed by out-of-line generic functions. The vectors are + designed to interoperate with the GTY machinery. + + There are both 'index' and 'iterate' accessors. The index accessor + is implemented by operator[]. The iterator returns a boolean + iteration condition and updates the iteration variable passed by + reference. Because the iterator will be inlined, the address-of + can be optimized away. + + Each operation that increases the number of active elements is + available in 'quick' and 'safe' variants. The former presumes that + there is sufficient allocated space for the operation to succeed + (it dies if there is not). The latter will reallocate the + vector, if needed. Reallocation causes an exponential increase in + vector size. If you know you will be adding N elements, it would + be more efficient to use the reserve operation before adding the + elements with the 'quick' operation. This will ensure there are at + least as many elements as you ask for, it will exponentially + increase if there are too few spare slots. If you want reserve a + specific number of slots, but do not want the exponential increase + (for instance, you know this is the last allocation), use the + reserve_exact operation. You can also create a vector of a + specific size from the get go. + + You should prefer the push and pop operations, as they append and + remove from the end of the vector. If you need to remove several + items in one go, use the truncate operation. The insert and remove + operations allow you to change elements in the middle of the + vector. There are two remove operations, one which preserves the + element ordering 'ordered_remove', and one which does not + 'unordered_remove'. The latter function copies the end element + into the removed slot, rather than invoke a memmove operation. The + 'lower_bound' function will determine where to place an item in the + array using insert that will maintain sorted order. + + Vectors are template types with three arguments: the type of the + elements in the vector, the allocation strategy, and the physical + layout to use + + Four allocation strategies are supported: + + - Heap: allocation is done using malloc/free. This is the + default allocation strategy. + + - GC: allocation is done using ggc_alloc/ggc_free. + + - GC atomic: same as GC with the exception that the elements + themselves are assumed to be of an atomic type that does + not need to be garbage collected. This means that marking + routines do not need to traverse the array marking the + individual elements. This increases the performance of + GC activities. + + Two physical layouts are supported: + + - Embedded: The vector is structured using the trailing array + idiom. The last member of the structure is an array of size + 1. When the vector is initially allocated, a single memory + block is created to hold the vector's control data and the + array of elements. These vectors cannot grow without + reallocation (see discussion on embeddable vectors below). + + - Space efficient: The vector is structured as a pointer to an + embedded vector. This is the default layout. It means that + vectors occupy a single word of storage before initial + allocation. Vectors are allowed to grow (the internal + pointer is reallocated but the main vector instance does not + need to relocate). + + The type, allocation and layout are specified when the vector is + declared. + + If you need to directly manipulate a vector, then the 'address' + accessor will return the address of the start of the vector. Also + the 'space' predicate will tell you whether there is spare capacity + in the vector. You will not normally need to use these two functions. + + Notes on the different layout strategies + + * Embeddable vectors (vec) + + These vectors are suitable to be embedded in other data + structures so that they can be pre-allocated in a contiguous + memory block. + + Embeddable vectors are implemented using the trailing array + idiom, thus they are not resizeable without changing the address + of the vector object itself. This means you cannot have + variables or fields of embeddable vector type -- always use a + pointer to a vector. The one exception is the final field of a + structure, which could be a vector type. + + You will have to use the embedded_size & embedded_init calls to + create such objects, and they will not be resizeable (so the + 'safe' allocation variants are not available). + + Properties of embeddable vectors: + + - The whole vector and control data are allocated in a single + contiguous block. It uses the trailing-vector idiom, so + allocation must reserve enough space for all the elements + in the vector plus its control data. + - The vector cannot be re-allocated. + - The vector cannot grow nor shrink. + - No indirections needed for access/manipulation. + - It requires 2 words of storage (prior to vector allocation). + + + * Space efficient vector (vec) + + These vectors can grow dynamically and are allocated together + with their control data. They are suited to be included in data + structures. Prior to initial allocation, they only take a single + word of storage. + + These vectors are implemented as a pointer to embeddable vectors. + The semantics allow for this pointer to be NULL to represent + empty vectors. This way, empty vectors occupy minimal space in + the structure containing them. + + Properties: + + - The whole vector and control data are allocated in a single + contiguous block. + - The whole vector may be re-allocated. + - Vector data may grow and shrink. + - Access and manipulation requires a pointer test and + indirection. + - It requires 1 word of storage (prior to vector allocation). + + An example of their use would be, + + struct my_struct { + // A space-efficient vector of tree pointers in GC memory. + vec v; + }; + + struct my_struct *s; + + if (s->v.length ()) { we have some contents } + s->v.safe_push (decl); // append some decl onto the end + for (ix = 0; s->v.iterate (ix, &elt); ix++) + { do something with elt } +*/ + +/* Support function for statistics. */ +extern void dump_vec_loc_statistics (void); + +/* Hashtable mapping vec addresses to descriptors. */ +extern htab_t vec_mem_usage_hash; + +/* Control data for vectors. This contains the number of allocated + and used slots inside a vector. */ + +struct vec_prefix +{ + /* FIXME - These fields should be private, but we need to cater to + compilers that have stricter notions of PODness for types. */ + + /* Memory allocation support routines in vec.c. */ + void register_overhead (void *, size_t, size_t CXX_MEM_STAT_INFO); + void release_overhead (void *, size_t, bool CXX_MEM_STAT_INFO); + static unsigned calculate_allocation (vec_prefix *, unsigned, bool); + static unsigned calculate_allocation_1 (unsigned, unsigned); + + /* Note that vec_prefix should be a base class for vec, but we use + offsetof() on vector fields of tree structures (e.g., + tree_binfo::base_binfos), and offsetof only supports base types. + + To compensate, we make vec_prefix a field inside vec and make + vec a friend class of vec_prefix so it can access its fields. */ + template friend struct vec; + + /* The allocator types also need access to our internals. */ + friend struct va_gc; + friend struct va_gc_atomic; + friend struct va_heap; + + unsigned m_alloc : 31; + unsigned m_using_auto_storage : 1; + unsigned m_num; +}; + +/* Calculate the number of slots to reserve a vector, making sure that + RESERVE slots are free. If EXACT grow exactly, otherwise grow + exponentially. PFX is the control data for the vector. */ + +inline unsigned +vec_prefix::calculate_allocation (vec_prefix *pfx, unsigned reserve, + bool exact) +{ + if (exact) + return (pfx ? pfx->m_num : 0) + reserve; + else if (!pfx) + return MAX (4, reserve); + return calculate_allocation_1 (pfx->m_alloc, pfx->m_num + reserve); +} + +template struct vec; + +/* Valid vector layouts + + vl_embed - Embeddable vector that uses the trailing array idiom. + vl_ptr - Space efficient vector that uses a pointer to an + embeddable vector. */ +struct vl_embed { }; +struct vl_ptr { }; + + +/* Types of supported allocations + + va_heap - Allocation uses malloc/free. + va_gc - Allocation uses ggc_alloc. + va_gc_atomic - Same as GC, but individual elements of the array + do not need to be marked during collection. */ + +/* Allocator type for heap vectors. */ +struct va_heap +{ + /* Heap vectors are frequently regular instances, so use the vl_ptr + layout for them. */ + typedef vl_ptr default_layout; + + template + static void reserve (vec *&, unsigned, bool + CXX_MEM_STAT_INFO); + + template + static void release (vec *&); +}; + + +/* Allocator for heap memory. Ensure there are at least RESERVE free + slots in V. If EXACT is true, grow exactly, else grow + exponentially. As a special case, if the vector had not been + allocated and RESERVE is 0, no vector will be created. */ + +template +inline void +va_heap::reserve (vec *&v, unsigned reserve, bool exact + MEM_STAT_DECL) +{ + unsigned alloc + = vec_prefix::calculate_allocation (v ? &v->m_vecpfx : 0, reserve, exact); + gcc_checking_assert (alloc); + + if (GATHER_STATISTICS && v) + v->m_vecpfx.release_overhead (v, v->allocated (), false); + + size_t size = vec::embedded_size (alloc); + unsigned nelem = v ? v->length () : 0; + v = static_cast *> (xrealloc (v, size)); + v->embedded_init (alloc, nelem); + + if (GATHER_STATISTICS) + v->m_vecpfx.register_overhead (v, alloc, nelem PASS_MEM_STAT); +} + + +/* Free the heap space allocated for vector V. */ + +template +void +va_heap::release (vec *&v) +{ + if (v == NULL) + return; + + if (GATHER_STATISTICS) + v->m_vecpfx.release_overhead (v, v->allocated (), true); + ::free (v); + v = NULL; +} + + +/* Allocator type for GC vectors. Notice that we need the structure + declaration even if GC is not enabled. */ + +struct va_gc +{ + /* Use vl_embed as the default layout for GC vectors. Due to GTY + limitations, GC vectors must always be pointers, so it is more + efficient to use a pointer to the vl_embed layout, rather than + using a pointer to a pointer as would be the case with vl_ptr. */ + typedef vl_embed default_layout; + + template + static void reserve (vec *&, unsigned, bool + CXX_MEM_STAT_INFO); + + template + static void release (vec *&v); +}; + + +/* Free GC memory used by V and reset V to NULL. */ + +template +inline void +va_gc::release (vec *&v) +{ + if (v) + ::ggc_free (v); + v = NULL; +} + + +/* Allocator for GC memory. Ensure there are at least RESERVE free + slots in V. If EXACT is true, grow exactly, else grow + exponentially. As a special case, if the vector had not been + allocated and RESERVE is 0, no vector will be created. */ + +template +void +va_gc::reserve (vec *&v, unsigned reserve, bool exact + MEM_STAT_DECL) +{ + unsigned alloc + = vec_prefix::calculate_allocation (v ? &v->m_vecpfx : 0, reserve, exact); + if (!alloc) + { + ::ggc_free (v); + v = NULL; + return; + } + + /* Calculate the amount of space we want. */ + size_t size = vec::embedded_size (alloc); + + /* Ask the allocator how much space it will really give us. */ + size = ::ggc_round_alloc_size (size); + + /* Adjust the number of slots accordingly. */ + size_t vec_offset = sizeof (vec_prefix); + size_t elt_size = sizeof (T); + alloc = (size - vec_offset) / elt_size; + + /* And finally, recalculate the amount of space we ask for. */ + size = vec_offset + alloc * elt_size; + + unsigned nelem = v ? v->length () : 0; + v = static_cast *> (::ggc_realloc (v, size + PASS_MEM_STAT)); + v->embedded_init (alloc, nelem); +} + + +/* Allocator type for GC vectors. This is for vectors of types + atomics w.r.t. collection, so allocation and deallocation is + completely inherited from va_gc. */ +struct va_gc_atomic : va_gc +{ +}; + + +/* Generic vector template. Default values for A and L indicate the + most commonly used strategies. + + FIXME - Ideally, they would all be vl_ptr to encourage using regular + instances for vectors, but the existing GTY machinery is limited + in that it can only deal with GC objects that are pointers + themselves. + + This means that vector operations that need to deal with + potentially NULL pointers, must be provided as free + functions (see the vec_safe_* functions above). */ +template +struct GTY((user)) vec +{ +}; + +/* Type to provide NULL values for vec. This is used to + provide nil initializers for vec instances. Since vec must be + a POD, we cannot have proper ctor/dtor for it. To initialize + a vec instance, you can assign it the value vNULL. This isn't + needed for file-scope and function-local static vectors, which + are zero-initialized by default. */ +struct vnull +{ + template +#if __cpp_constexpr >= 200704 + constexpr +#endif + operator vec () { return vec(); } +}; +extern vnull vNULL; + + +/* Embeddable vector. These vectors are suitable to be embedded + in other data structures so that they can be pre-allocated in a + contiguous memory block. + + Embeddable vectors are implemented using the trailing array idiom, + thus they are not resizeable without changing the address of the + vector object itself. This means you cannot have variables or + fields of embeddable vector type -- always use a pointer to a + vector. The one exception is the final field of a structure, which + could be a vector type. + + You will have to use the embedded_size & embedded_init calls to + create such objects, and they will not be resizeable (so the 'safe' + allocation variants are not available). + + Properties: + + - The whole vector and control data are allocated in a single + contiguous block. It uses the trailing-vector idiom, so + allocation must reserve enough space for all the elements + in the vector plus its control data. + - The vector cannot be re-allocated. + - The vector cannot grow nor shrink. + - No indirections needed for access/manipulation. + - It requires 2 words of storage (prior to vector allocation). */ + +template +struct GTY((user)) vec +{ +public: + unsigned allocated (void) const { return m_vecpfx.m_alloc; } + unsigned length (void) const { return m_vecpfx.m_num; } + bool is_empty (void) const { return m_vecpfx.m_num == 0; } + T *address (void) { return m_vecdata; } + const T *address (void) const { return m_vecdata; } + T *begin () { return address (); } + const T *begin () const { return address (); } + T *end () { return address () + length (); } + const T *end () const { return address () + length (); } + const T &operator[] (unsigned) const; + T &operator[] (unsigned); + T &last (void); + bool space (unsigned) const; + bool iterate (unsigned, T *) const; + bool iterate (unsigned, T **) const; + vec *copy (ALONE_CXX_MEM_STAT_INFO) const; + void splice (const vec &); + void splice (const vec *src); + T *quick_push (const T &); + T &pop (void); + void truncate (unsigned); + void quick_insert (unsigned, const T &); + void ordered_remove (unsigned); + void unordered_remove (unsigned); + void block_remove (unsigned, unsigned); + void qsort (int (*) (const void *, const void *)); + T *bsearch (const void *key, int (*compar)(const void *, const void *)); + unsigned lower_bound (T, bool (*)(const T &, const T &)) const; + bool contains (const T &search) const; + static size_t embedded_size (unsigned); + void embedded_init (unsigned, unsigned = 0, unsigned = 0); + void quick_grow (unsigned len); + void quick_grow_cleared (unsigned len); + + /* vec class can access our internal data and functions. */ + template friend struct vec; + + /* The allocator types also need access to our internals. */ + friend struct va_gc; + friend struct va_gc_atomic; + friend struct va_heap; + + /* FIXME - These fields should be private, but we need to cater to + compilers that have stricter notions of PODness for types. */ + vec_prefix m_vecpfx; + T m_vecdata[1]; +}; + + +/* Convenience wrapper functions to use when dealing with pointers to + embedded vectors. Some functionality for these vectors must be + provided via free functions for these reasons: + + 1- The pointer may be NULL (e.g., before initial allocation). + + 2- When the vector needs to grow, it must be reallocated, so + the pointer will change its value. + + Because of limitations with the current GC machinery, all vectors + in GC memory *must* be pointers. */ + + +/* If V contains no room for NELEMS elements, return false. Otherwise, + return true. */ +template +inline bool +vec_safe_space (const vec *v, unsigned nelems) +{ + return v ? v->space (nelems) : nelems == 0; +} + + +/* If V is NULL, return 0. Otherwise, return V->length(). */ +template +inline unsigned +vec_safe_length (const vec *v) +{ + return v ? v->length () : 0; +} + + +/* If V is NULL, return NULL. Otherwise, return V->address(). */ +template +inline T * +vec_safe_address (vec *v) +{ + return v ? v->address () : NULL; +} + + +/* If V is NULL, return true. Otherwise, return V->is_empty(). */ +template +inline bool +vec_safe_is_empty (vec *v) +{ + return v ? v->is_empty () : true; +} + +/* If V does not have space for NELEMS elements, call + V->reserve(NELEMS, EXACT). */ +template +inline bool +vec_safe_reserve (vec *&v, unsigned nelems, bool exact = false + CXX_MEM_STAT_INFO) +{ + bool extend = nelems ? !vec_safe_space (v, nelems) : false; + if (extend) + A::reserve (v, nelems, exact PASS_MEM_STAT); + return extend; +} + +template +inline bool +vec_safe_reserve_exact (vec *&v, unsigned nelems + CXX_MEM_STAT_INFO) +{ + return vec_safe_reserve (v, nelems, true PASS_MEM_STAT); +} + + +/* Allocate GC memory for V with space for NELEMS slots. If NELEMS + is 0, V is initialized to NULL. */ + +template +inline void +vec_alloc (vec *&v, unsigned nelems CXX_MEM_STAT_INFO) +{ + v = NULL; + vec_safe_reserve (v, nelems, false PASS_MEM_STAT); +} + + +/* Free the GC memory allocated by vector V and set it to NULL. */ + +template +inline void +vec_free (vec *&v) +{ + A::release (v); +} + + +/* Grow V to length LEN. Allocate it, if necessary. */ +template +inline void +vec_safe_grow (vec *&v, unsigned len CXX_MEM_STAT_INFO) +{ + unsigned oldlen = vec_safe_length (v); + gcc_checking_assert (len >= oldlen); + vec_safe_reserve_exact (v, len - oldlen PASS_MEM_STAT); + v->quick_grow (len); +} + + +/* If V is NULL, allocate it. Call V->safe_grow_cleared(LEN). */ +template +inline void +vec_safe_grow_cleared (vec *&v, unsigned len CXX_MEM_STAT_INFO) +{ + unsigned oldlen = vec_safe_length (v); + vec_safe_grow (v, len PASS_MEM_STAT); + memset (&(v->address ()[oldlen]), 0, sizeof (T) * (len - oldlen)); +} + + +/* If V is NULL return false, otherwise return V->iterate(IX, PTR). */ +template +inline bool +vec_safe_iterate (const vec *v, unsigned ix, T **ptr) +{ + if (v) + return v->iterate (ix, ptr); + else + { + *ptr = 0; + return false; + } +} + +template +inline bool +vec_safe_iterate (const vec *v, unsigned ix, T *ptr) +{ + if (v) + return v->iterate (ix, ptr); + else + { + *ptr = 0; + return false; + } +} + + +/* If V has no room for one more element, reallocate it. Then call + V->quick_push(OBJ). */ +template +inline T * +vec_safe_push (vec *&v, const T &obj CXX_MEM_STAT_INFO) +{ + vec_safe_reserve (v, 1, false PASS_MEM_STAT); + return v->quick_push (obj); +} + + +/* if V has no room for one more element, reallocate it. Then call + V->quick_insert(IX, OBJ). */ +template +inline void +vec_safe_insert (vec *&v, unsigned ix, const T &obj + CXX_MEM_STAT_INFO) +{ + vec_safe_reserve (v, 1, false PASS_MEM_STAT); + v->quick_insert (ix, obj); +} + + +/* If V is NULL, do nothing. Otherwise, call V->truncate(SIZE). */ +template +inline void +vec_safe_truncate (vec *v, unsigned size) +{ + if (v) + v->truncate (size); +} + + +/* If SRC is not NULL, return a pointer to a copy of it. */ +template +inline vec * +vec_safe_copy (vec *src CXX_MEM_STAT_INFO) +{ + return src ? src->copy (ALONE_PASS_MEM_STAT) : NULL; +} + +/* Copy the elements from SRC to the end of DST as if by memcpy. + Reallocate DST, if necessary. */ +template +inline void +vec_safe_splice (vec *&dst, const vec *src + CXX_MEM_STAT_INFO) +{ + unsigned src_len = vec_safe_length (src); + if (src_len) + { + vec_safe_reserve_exact (dst, vec_safe_length (dst) + src_len + PASS_MEM_STAT); + dst->splice (*src); + } +} + +/* Return true if SEARCH is an element of V. Note that this is O(N) in the + size of the vector and so should be used with care. */ + +template +inline bool +vec_safe_contains (vec *v, const T &search) +{ + return v ? v->contains (search) : false; +} + +/* Index into vector. Return the IX'th element. IX must be in the + domain of the vector. */ + +template +inline const T & +vec::operator[] (unsigned ix) const +{ + gcc_checking_assert (ix < m_vecpfx.m_num); + return m_vecdata[ix]; +} + +template +inline T & +vec::operator[] (unsigned ix) +{ + gcc_checking_assert (ix < m_vecpfx.m_num); + return m_vecdata[ix]; +} + + +/* Get the final element of the vector, which must not be empty. */ + +template +inline T & +vec::last (void) +{ + gcc_checking_assert (m_vecpfx.m_num > 0); + return (*this)[m_vecpfx.m_num - 1]; +} + + +/* If this vector has space for NELEMS additional entries, return + true. You usually only need to use this if you are doing your + own vector reallocation, for instance on an embedded vector. This + returns true in exactly the same circumstances that vec::reserve + will. */ + +template +inline bool +vec::space (unsigned nelems) const +{ + return m_vecpfx.m_alloc - m_vecpfx.m_num >= nelems; +} + + +/* Return iteration condition and update PTR to point to the IX'th + element of this vector. Use this to iterate over the elements of a + vector as follows, + + for (ix = 0; vec::iterate (v, ix, &ptr); ix++) + continue; */ + +template +inline bool +vec::iterate (unsigned ix, T *ptr) const +{ + if (ix < m_vecpfx.m_num) + { + *ptr = m_vecdata[ix]; + return true; + } + else + { + *ptr = 0; + return false; + } +} + + +/* Return iteration condition and update *PTR to point to the + IX'th element of this vector. Use this to iterate over the + elements of a vector as follows, + + for (ix = 0; v->iterate (ix, &ptr); ix++) + continue; + + This variant is for vectors of objects. */ + +template +inline bool +vec::iterate (unsigned ix, T **ptr) const +{ + if (ix < m_vecpfx.m_num) + { + *ptr = CONST_CAST (T *, &m_vecdata[ix]); + return true; + } + else + { + *ptr = 0; + return false; + } +} + + +/* Return a pointer to a copy of this vector. */ + +template +inline vec * +vec::copy (ALONE_MEM_STAT_DECL) const +{ + vec *new_vec = NULL; + unsigned len = length (); + if (len) + { + vec_alloc (new_vec, len PASS_MEM_STAT); + new_vec->embedded_init (len, len); + memcpy (new_vec->address (), m_vecdata, sizeof (T) * len); + } + return new_vec; +} + + +/* Copy the elements from SRC to the end of this vector as if by memcpy. + The vector must have sufficient headroom available. */ + +template +inline void +vec::splice (const vec &src) +{ + unsigned len = src.length (); + if (len) + { + gcc_checking_assert (space (len)); + memcpy (address () + length (), src.address (), len * sizeof (T)); + m_vecpfx.m_num += len; + } +} + +template +inline void +vec::splice (const vec *src) +{ + if (src) + splice (*src); +} + + +/* Push OBJ (a new element) onto the end of the vector. There must be + sufficient space in the vector. Return a pointer to the slot + where OBJ was inserted. */ + +template +inline T * +vec::quick_push (const T &obj) +{ + gcc_checking_assert (space (1)); + T *slot = &m_vecdata[m_vecpfx.m_num++]; + *slot = obj; + return slot; +} + + +/* Pop and return the last element off the end of the vector. */ + +template +inline T & +vec::pop (void) +{ + gcc_checking_assert (length () > 0); + return m_vecdata[--m_vecpfx.m_num]; +} + + +/* Set the length of the vector to SIZE. The new length must be less + than or equal to the current length. This is an O(1) operation. */ + +template +inline void +vec::truncate (unsigned size) +{ + gcc_checking_assert (length () >= size); + m_vecpfx.m_num = size; +} + + +/* Insert an element, OBJ, at the IXth position of this vector. There + must be sufficient space. */ + +template +inline void +vec::quick_insert (unsigned ix, const T &obj) +{ + gcc_checking_assert (length () < allocated ()); + gcc_checking_assert (ix <= length ()); + T *slot = &m_vecdata[ix]; + memmove (slot + 1, slot, (m_vecpfx.m_num++ - ix) * sizeof (T)); + *slot = obj; +} + + +/* Remove an element from the IXth position of this vector. Ordering of + remaining elements is preserved. This is an O(N) operation due to + memmove. */ + +template +inline void +vec::ordered_remove (unsigned ix) +{ + gcc_checking_assert (ix < length ()); + T *slot = &m_vecdata[ix]; + memmove (slot, slot + 1, (--m_vecpfx.m_num - ix) * sizeof (T)); +} + + +/* Remove an element from the IXth position of this vector. Ordering of + remaining elements is destroyed. This is an O(1) operation. */ + +template +inline void +vec::unordered_remove (unsigned ix) +{ + gcc_checking_assert (ix < length ()); + m_vecdata[ix] = m_vecdata[--m_vecpfx.m_num]; +} + + +/* Remove LEN elements starting at the IXth. Ordering is retained. + This is an O(N) operation due to memmove. */ + +template +inline void +vec::block_remove (unsigned ix, unsigned len) +{ + gcc_checking_assert (ix + len <= length ()); + T *slot = &m_vecdata[ix]; + m_vecpfx.m_num -= len; + memmove (slot, slot + len, (m_vecpfx.m_num - ix) * sizeof (T)); +} + + +/* Sort the contents of this vector with qsort. CMP is the comparison + function to pass to qsort. */ + +template +inline void +vec::qsort (int (*cmp) (const void *, const void *)) +{ + if (length () > 1) + ::qsort (address (), length (), sizeof (T), cmp); +} + + +/* Search the contents of the sorted vector with a binary search. + CMP is the comparison function to pass to bsearch. */ + +template +inline T * +vec::bsearch (const void *key, + int (*compar) (const void *, const void *)) +{ + const void *base = this->address (); + size_t nmemb = this->length (); + size_t size = sizeof (T); + /* The following is a copy of glibc stdlib-bsearch.h. */ + size_t l, u, idx; + const void *p; + int comparison; + + l = 0; + u = nmemb; + while (l < u) + { + idx = (l + u) / 2; + p = (const void *) (((const char *) base) + (idx * size)); + comparison = (*compar) (key, p); + if (comparison < 0) + u = idx; + else if (comparison > 0) + l = idx + 1; + else + return (T *)const_cast(p); + } + + return NULL; +} + +/* Return true if SEARCH is an element of V. Note that this is O(N) in the + size of the vector and so should be used with care. */ + +template +inline bool +vec::contains (const T &search) const +{ + unsigned int len = length (); + for (unsigned int i = 0; i < len; i++) + if ((*this)[i] == search) + return true; + + return false; +} + +/* Find and return the first position in which OBJ could be inserted + without changing the ordering of this vector. LESSTHAN is a + function that returns true if the first argument is strictly less + than the second. */ + +template +unsigned +vec::lower_bound (T obj, bool (*lessthan)(const T &, const T &)) + const +{ + unsigned int len = length (); + unsigned int half, middle; + unsigned int first = 0; + while (len > 0) + { + half = len / 2; + middle = first; + middle += half; + T middle_elem = (*this)[middle]; + if (lessthan (middle_elem, obj)) + { + first = middle; + ++first; + len = len - half - 1; + } + else + len = half; + } + return first; +} + + +/* Return the number of bytes needed to embed an instance of an + embeddable vec inside another data structure. + + Use these methods to determine the required size and initialization + of a vector V of type T embedded within another structure (as the + final member): + + size_t vec::embedded_size (unsigned alloc); + void v->embedded_init (unsigned alloc, unsigned num); + + These allow the caller to perform the memory allocation. */ + +template +inline size_t +vec::embedded_size (unsigned alloc) +{ + typedef vec vec_embedded; + return offsetof (vec_embedded, m_vecdata) + alloc * sizeof (T); +} + + +/* Initialize the vector to contain room for ALLOC elements and + NUM active elements. */ + +template +inline void +vec::embedded_init (unsigned alloc, unsigned num, unsigned aut) +{ + m_vecpfx.m_alloc = alloc; + m_vecpfx.m_using_auto_storage = aut; + m_vecpfx.m_num = num; +} + + +/* Grow the vector to a specific length. LEN must be as long or longer than + the current length. The new elements are uninitialized. */ + +template +inline void +vec::quick_grow (unsigned len) +{ + gcc_checking_assert (length () <= len && len <= m_vecpfx.m_alloc); + m_vecpfx.m_num = len; +} + + +/* Grow the vector to a specific length. LEN must be as long or longer than + the current length. The new elements are initialized to zero. */ + +template +inline void +vec::quick_grow_cleared (unsigned len) +{ + unsigned oldlen = length (); + size_t sz = sizeof (T) * (len - oldlen); + quick_grow (len); + if (sz != 0) + memset (&(address ()[oldlen]), 0, sz); +} + + +/* Garbage collection support for vec. */ + +template +void +gt_ggc_mx (vec *v) +{ + extern void gt_ggc_mx (T &); + for (unsigned i = 0; i < v->length (); i++) + gt_ggc_mx ((*v)[i]); +} + +template +void +gt_ggc_mx (vec *v ATTRIBUTE_UNUSED) +{ + /* Nothing to do. Vectors of atomic types wrt GC do not need to + be traversed. */ +} + + +/* PCH support for vec. */ + +template +void +gt_pch_nx (vec *v) +{ + extern void gt_pch_nx (T &); + for (unsigned i = 0; i < v->length (); i++) + gt_pch_nx ((*v)[i]); +} + +template +void +gt_pch_nx (vec *v, gt_pointer_operator op, void *cookie) +{ + for (unsigned i = 0; i < v->length (); i++) + op (&((*v)[i]), cookie); +} + +template +void +gt_pch_nx (vec *v, gt_pointer_operator op, void *cookie) +{ + extern void gt_pch_nx (T *, gt_pointer_operator, void *); + for (unsigned i = 0; i < v->length (); i++) + gt_pch_nx (&((*v)[i]), op, cookie); +} + + +/* Space efficient vector. These vectors can grow dynamically and are + allocated together with their control data. They are suited to be + included in data structures. Prior to initial allocation, they + only take a single word of storage. + + These vectors are implemented as a pointer to an embeddable vector. + The semantics allow for this pointer to be NULL to represent empty + vectors. This way, empty vectors occupy minimal space in the + structure containing them. + + Properties: + + - The whole vector and control data are allocated in a single + contiguous block. + - The whole vector may be re-allocated. + - Vector data may grow and shrink. + - Access and manipulation requires a pointer test and + indirection. + - It requires 1 word of storage (prior to vector allocation). + + + Limitations: + + These vectors must be PODs because they are stored in unions. + (http://en.wikipedia.org/wiki/Plain_old_data_structures). + As long as we use C++03, we cannot have constructors nor + destructors in classes that are stored in unions. */ + +template +struct vec +{ +public: + /* Memory allocation and deallocation for the embedded vector. + Needed because we cannot have proper ctors/dtors defined. */ + void create (unsigned nelems CXX_MEM_STAT_INFO); + void release (void); + + /* Vector operations. */ + bool exists (void) const + { return m_vec != NULL; } + + bool is_empty (void) const + { return m_vec ? m_vec->is_empty () : true; } + + unsigned length (void) const + { return m_vec ? m_vec->length () : 0; } + + T *address (void) + { return m_vec ? m_vec->m_vecdata : NULL; } + + const T *address (void) const + { return m_vec ? m_vec->m_vecdata : NULL; } + + T *begin () { return address (); } + const T *begin () const { return address (); } + T *end () { return begin () + length (); } + const T *end () const { return begin () + length (); } + const T &operator[] (unsigned ix) const + { return (*m_vec)[ix]; } + + bool operator!=(const vec &other) const + { return !(*this == other); } + + bool operator==(const vec &other) const + { return address () == other.address (); } + + T &operator[] (unsigned ix) + { return (*m_vec)[ix]; } + + T &last (void) + { return m_vec->last (); } + + bool space (int nelems) const + { return m_vec ? m_vec->space (nelems) : nelems == 0; } + + bool iterate (unsigned ix, T *p) const; + bool iterate (unsigned ix, T **p) const; + vec copy (ALONE_CXX_MEM_STAT_INFO) const; + bool reserve (unsigned, bool = false CXX_MEM_STAT_INFO); + bool reserve_exact (unsigned CXX_MEM_STAT_INFO); + void splice (const vec &); + void safe_splice (const vec & CXX_MEM_STAT_INFO); + T *quick_push (const T &); + T *safe_push (const T &CXX_MEM_STAT_INFO); + T &pop (void); + void truncate (unsigned); + void safe_grow (unsigned CXX_MEM_STAT_INFO); + void safe_grow_cleared (unsigned CXX_MEM_STAT_INFO); + void quick_grow (unsigned); + void quick_grow_cleared (unsigned); + void quick_insert (unsigned, const T &); + void safe_insert (unsigned, const T & CXX_MEM_STAT_INFO); + void ordered_remove (unsigned); + void unordered_remove (unsigned); + void block_remove (unsigned, unsigned); + void qsort (int (*) (const void *, const void *)); + T *bsearch (const void *key, int (*compar)(const void *, const void *)); + unsigned lower_bound (T, bool (*)(const T &, const T &)) const; + bool contains (const T &search) const; + + bool using_auto_storage () const; + + /* FIXME - This field should be private, but we need to cater to + compilers that have stricter notions of PODness for types. */ + vec *m_vec; +}; + + +/* auto_vec is a subclass of vec that automatically manages creating and + releasing the internal vector. If N is non zero then it has N elements of + internal storage. The default is no internal storage, and you probably only + want to ask for internal storage for vectors on the stack because if the + size of the vector is larger than the internal storage that space is wasted. + */ +template +class auto_vec : public vec +{ +public: + auto_vec () + { + m_auto.embedded_init (MAX (N, 2), 0, 1); + this->m_vec = &m_auto; + } + + ~auto_vec () + { + this->release (); + } + +private: + vec m_auto; + T m_data[MAX (N - 1, 1)]; +}; + +/* auto_vec is a sub class of vec whose storage is released when it is + destroyed. */ +template +class auto_vec : public vec +{ +public: + auto_vec () { this->m_vec = NULL; } + auto_vec (size_t n) { this->create (n); } + ~auto_vec () { this->release (); } +}; + + +/* Allocate heap memory for pointer V and create the internal vector + with space for NELEMS elements. If NELEMS is 0, the internal + vector is initialized to empty. */ + +template +inline void +vec_alloc (vec *&v, unsigned nelems CXX_MEM_STAT_INFO) +{ + v = new vec; + v->create (nelems PASS_MEM_STAT); +} + + +/* Conditionally allocate heap memory for VEC and its internal vector. */ + +template +inline void +vec_check_alloc (vec *&vec, unsigned nelems CXX_MEM_STAT_INFO) +{ + if (!vec) + vec_alloc (vec, nelems PASS_MEM_STAT); +} + + +/* Free the heap memory allocated by vector V and set it to NULL. */ + +template +inline void +vec_free (vec *&v) +{ + if (v == NULL) + return; + + v->release (); + delete v; + v = NULL; +} + + +/* Return iteration condition and update PTR to point to the IX'th + element of this vector. Use this to iterate over the elements of a + vector as follows, + + for (ix = 0; v.iterate (ix, &ptr); ix++) + continue; */ + +template +inline bool +vec::iterate (unsigned ix, T *ptr) const +{ + if (m_vec) + return m_vec->iterate (ix, ptr); + else + { + *ptr = 0; + return false; + } +} + + +/* Return iteration condition and update *PTR to point to the + IX'th element of this vector. Use this to iterate over the + elements of a vector as follows, + + for (ix = 0; v->iterate (ix, &ptr); ix++) + continue; + + This variant is for vectors of objects. */ + +template +inline bool +vec::iterate (unsigned ix, T **ptr) const +{ + if (m_vec) + return m_vec->iterate (ix, ptr); + else + { + *ptr = 0; + return false; + } +} + + +/* Convenience macro for forward iteration. */ +#define FOR_EACH_VEC_ELT(V, I, P) \ + for (I = 0; (V).iterate ((I), &(P)); ++(I)) + +#define FOR_EACH_VEC_SAFE_ELT(V, I, P) \ + for (I = 0; vec_safe_iterate ((V), (I), &(P)); ++(I)) + +/* Likewise, but start from FROM rather than 0. */ +#define FOR_EACH_VEC_ELT_FROM(V, I, P, FROM) \ + for (I = (FROM); (V).iterate ((I), &(P)); ++(I)) + +/* Convenience macro for reverse iteration. */ +#define FOR_EACH_VEC_ELT_REVERSE(V, I, P) \ + for (I = (V).length () - 1; \ + (V).iterate ((I), &(P)); \ + (I)--) + +#define FOR_EACH_VEC_SAFE_ELT_REVERSE(V, I, P) \ + for (I = vec_safe_length (V) - 1; \ + vec_safe_iterate ((V), (I), &(P)); \ + (I)--) + + +/* Return a copy of this vector. */ + +template +inline vec +vec::copy (ALONE_MEM_STAT_DECL) const +{ + vec new_vec = vNULL; + if (length ()) + new_vec.m_vec = m_vec->copy (); + return new_vec; +} + + +/* Ensure that the vector has at least RESERVE slots available (if + EXACT is false), or exactly RESERVE slots available (if EXACT is + true). + + This may create additional headroom if EXACT is false. + + Note that this can cause the embedded vector to be reallocated. + Returns true iff reallocation actually occurred. */ + +template +inline bool +vec::reserve (unsigned nelems, bool exact MEM_STAT_DECL) +{ + if (space (nelems)) + return false; + + /* For now play a game with va_heap::reserve to hide our auto storage if any, + this is necessary because it doesn't have enough information to know the + embedded vector is in auto storage, and so should not be freed. */ + vec *oldvec = m_vec; + unsigned int oldsize = 0; + bool handle_auto_vec = m_vec && using_auto_storage (); + if (handle_auto_vec) + { + m_vec = NULL; + oldsize = oldvec->length (); + nelems += oldsize; + } + + va_heap::reserve (m_vec, nelems, exact PASS_MEM_STAT); + if (handle_auto_vec) + { + memcpy (m_vec->address (), oldvec->address (), sizeof (T) * oldsize); + m_vec->m_vecpfx.m_num = oldsize; + } + + return true; +} + + +/* Ensure that this vector has exactly NELEMS slots available. This + will not create additional headroom. Note this can cause the + embedded vector to be reallocated. Returns true iff reallocation + actually occurred. */ + +template +inline bool +vec::reserve_exact (unsigned nelems MEM_STAT_DECL) +{ + return reserve (nelems, true PASS_MEM_STAT); +} + + +/* Create the internal vector and reserve NELEMS for it. This is + exactly like vec::reserve, but the internal vector is + unconditionally allocated from scratch. The old one, if it + existed, is lost. */ + +template +inline void +vec::create (unsigned nelems MEM_STAT_DECL) +{ + m_vec = NULL; + if (nelems > 0) + reserve_exact (nelems PASS_MEM_STAT); +} + + +/* Free the memory occupied by the embedded vector. */ + +template +inline void +vec::release (void) +{ + if (!m_vec) + return; + + if (using_auto_storage ()) + { + m_vec->m_vecpfx.m_num = 0; + return; + } + + va_heap::release (m_vec); +} + +/* Copy the elements from SRC to the end of this vector as if by memcpy. + SRC and this vector must be allocated with the same memory + allocation mechanism. This vector is assumed to have sufficient + headroom available. */ + +template +inline void +vec::splice (const vec &src) +{ + if (src.m_vec) + m_vec->splice (*(src.m_vec)); +} + + +/* Copy the elements in SRC to the end of this vector as if by memcpy. + SRC and this vector must be allocated with the same mechanism. + If there is not enough headroom in this vector, it will be reallocated + as needed. */ + +template +inline void +vec::safe_splice (const vec &src + MEM_STAT_DECL) +{ + if (src.length ()) + { + reserve_exact (src.length ()); + splice (src); + } +} + + +/* Push OBJ (a new element) onto the end of the vector. There must be + sufficient space in the vector. Return a pointer to the slot + where OBJ was inserted. */ + +template +inline T * +vec::quick_push (const T &obj) +{ + return m_vec->quick_push (obj); +} + + +/* Push a new element OBJ onto the end of this vector. Reallocates + the embedded vector, if needed. Return a pointer to the slot where + OBJ was inserted. */ + +template +inline T * +vec::safe_push (const T &obj MEM_STAT_DECL) +{ + reserve (1, false PASS_MEM_STAT); + return quick_push (obj); +} + + +/* Pop and return the last element off the end of the vector. */ + +template +inline T & +vec::pop (void) +{ + return m_vec->pop (); +} + + +/* Set the length of the vector to LEN. The new length must be less + than or equal to the current length. This is an O(1) operation. */ + +template +inline void +vec::truncate (unsigned size) +{ + if (m_vec) + m_vec->truncate (size); + else + gcc_checking_assert (size == 0); +} + + +/* Grow the vector to a specific length. LEN must be as long or + longer than the current length. The new elements are + uninitialized. Reallocate the internal vector, if needed. */ + +template +inline void +vec::safe_grow (unsigned len MEM_STAT_DECL) +{ + unsigned oldlen = length (); + gcc_checking_assert (oldlen <= len); + reserve_exact (len - oldlen PASS_MEM_STAT); + if (m_vec) + m_vec->quick_grow (len); + else + gcc_checking_assert (len == 0); +} + + +/* Grow the embedded vector to a specific length. LEN must be as + long or longer than the current length. The new elements are + initialized to zero. Reallocate the internal vector, if needed. */ + +template +inline void +vec::safe_grow_cleared (unsigned len MEM_STAT_DECL) +{ + unsigned oldlen = length (); + size_t sz = sizeof (T) * (len - oldlen); + safe_grow (len PASS_MEM_STAT); + if (sz != 0) + memset (&(address ()[oldlen]), 0, sz); +} + + +/* Same as vec::safe_grow but without reallocation of the internal vector. + If the vector cannot be extended, a runtime assertion will be triggered. */ + +template +inline void +vec::quick_grow (unsigned len) +{ + gcc_checking_assert (m_vec); + m_vec->quick_grow (len); +} + + +/* Same as vec::quick_grow_cleared but without reallocation of the + internal vector. If the vector cannot be extended, a runtime + assertion will be triggered. */ + +template +inline void +vec::quick_grow_cleared (unsigned len) +{ + gcc_checking_assert (m_vec); + m_vec->quick_grow_cleared (len); +} + + +/* Insert an element, OBJ, at the IXth position of this vector. There + must be sufficient space. */ + +template +inline void +vec::quick_insert (unsigned ix, const T &obj) +{ + m_vec->quick_insert (ix, obj); +} + + +/* Insert an element, OBJ, at the IXth position of the vector. + Reallocate the embedded vector, if necessary. */ + +template +inline void +vec::safe_insert (unsigned ix, const T &obj MEM_STAT_DECL) +{ + reserve (1, false PASS_MEM_STAT); + quick_insert (ix, obj); +} + + +/* Remove an element from the IXth position of this vector. Ordering of + remaining elements is preserved. This is an O(N) operation due to + a memmove. */ + +template +inline void +vec::ordered_remove (unsigned ix) +{ + m_vec->ordered_remove (ix); +} + + +/* Remove an element from the IXth position of this vector. Ordering + of remaining elements is destroyed. This is an O(1) operation. */ + +template +inline void +vec::unordered_remove (unsigned ix) +{ + m_vec->unordered_remove (ix); +} + + +/* Remove LEN elements starting at the IXth. Ordering is retained. + This is an O(N) operation due to memmove. */ + +template +inline void +vec::block_remove (unsigned ix, unsigned len) +{ + m_vec->block_remove (ix, len); +} + + +/* Sort the contents of this vector with qsort. CMP is the comparison + function to pass to qsort. */ + +template +inline void +vec::qsort (int (*cmp) (const void *, const void *)) +{ + if (m_vec) + m_vec->qsort (cmp); +} + + +/* Search the contents of the sorted vector with a binary search. + CMP is the comparison function to pass to bsearch. */ + +template +inline T * +vec::bsearch (const void *key, + int (*cmp) (const void *, const void *)) +{ + if (m_vec) + return m_vec->bsearch (key, cmp); + return NULL; +} + + +/* Find and return the first position in which OBJ could be inserted + without changing the ordering of this vector. LESSTHAN is a + function that returns true if the first argument is strictly less + than the second. */ + +template +inline unsigned +vec::lower_bound (T obj, + bool (*lessthan)(const T &, const T &)) + const +{ + return m_vec ? m_vec->lower_bound (obj, lessthan) : 0; +} + +/* Return true if SEARCH is an element of V. Note that this is O(N) in the + size of the vector and so should be used with care. */ + +template +inline bool +vec::contains (const T &search) const +{ + return m_vec ? m_vec->contains (search) : false; +} + +template +inline bool +vec::using_auto_storage () const +{ + return m_vec->m_vecpfx.m_using_auto_storage; +} + +/* Release VEC and call release of all element vectors. */ + +template +inline void +release_vec_vec (vec > &vec) +{ + for (unsigned i = 0; i < vec.length (); i++) + vec[i].release (); + + vec.release (); +} + +#if (GCC_VERSION >= 3000) +# pragma GCC poison m_vec m_vecpfx m_vecdata +#endif + +#endif // GCC_VEC_H diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/version.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/version.h new file mode 100644 index 0000000..8891903 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/version.h @@ -0,0 +1,6 @@ +#ifndef GCC_VERSION_H +#define GCC_VERSION_H +extern const char version_string[]; +extern const char pkgversion_string[]; +extern const char bug_report_url[]; +#endif /* ! GCC_VERSION_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/vmsdbg.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/vmsdbg.h new file mode 100644 index 0000000..23d0d87 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/vmsdbg.h @@ -0,0 +1,249 @@ +/* Definitions for the data structures and codes used in VMS debugging. + Copyright (C) 2001-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_VMSDBG_H +#define GCC_VMSDBG_H 1 + +/* We define types and constants used in VMS Debug output. Note that the + structs only approximate the output that is written. We write the output + explicitly, field by field. This output would only agree with the + structs in this file if no padding were done. The sizes after each + struct are the size actually written, which is usually smaller than the + size of the struct. */ + +/* Header type codes. */ +typedef enum _DST_TYPE {DST_K_TBG = 0x17, + DST_K_SOURCE = 155, DST_K_PROLOG = 162, + DST_K_BLKBEG = 176, DST_K_BLKEND = 177, + DST_K_LINE_NUM = 185, DST_K_MODBEG = 188, + DST_K_MODEND = 189, DST_K_RTNBEG = 190, + DST_K_RTNEND = 191} DST_DTYPE; + +/* Header. */ + +typedef struct _DST_HEADER +{ + union + { + unsigned short int dst_w_length; + unsigned short int dst_x_length; + } dst__header_length; + union + { + ENUM_BITFIELD (_DST_TYPE) dst_w_type : 16; + ENUM_BITFIELD (_DST_TYPE) dst_x_type : 16; + } dst__header_type; +} DST_HEADER; +#define DST_K_DST_HEADER_SIZE sizeof 4 + +/* Language type codes. */ +typedef enum _DST_LANGUAGE {DST_K_FORTRAN = 1, DST_K_C = 7, DST_K_ADA = 9, + DST_K_UNKNOWN = 10, DST_K_CXX = 15} DST_LANGUAGE; + +/* Module header (a module is the result of a single compilation). */ + +typedef struct _DST_MODULE_BEGIN +{ + DST_HEADER dst_a_modbeg_header; + struct + { + unsigned dst_v_modbeg_hide : 1; + unsigned dst_v_modbeg_version : 1; + unsigned dst_v_modbeg_unused : 6; + } dst_b_modbeg_flags; + unsigned char dst_b_modbeg_unused; + DST_LANGUAGE dst_l_modbeg_language; + unsigned short int dst_w_version_major; + unsigned short int dst_w_version_minor; + unsigned char dst_b_modbeg_name; +} DST_MODULE_BEGIN; +#define DST_K_MODBEG_SIZE 15 + +/* Module trailer. */ + +typedef struct _DST_MB_TRLR +{ + unsigned char dst_b_compiler; +} DST_MB_TRLR; + +#define DST_K_MB_TRLR_SIZE 1 + +#define DST_K_VERSION_MAJOR 1 +#define DST_K_VERSION_MINOR 13 + +typedef struct _DST_MODULE_END +{ + DST_HEADER dst_a_modend_header; +} DST_MODULE_END; +#define DST_K_MODEND_SIZE sizeof 4 + +/* Routine header. */ + +typedef struct _DST_ROUTINE_BEGIN +{ + DST_HEADER dst_a_rtnbeg_header; + struct + { + unsigned dst_v_rtnbeg_unused : 4; + unsigned dst_v_rtnbeg_unalloc : 1; + unsigned dst_v_rtnbeg_prototype : 1; + unsigned dst_v_rtnbeg_inlined : 1; + unsigned dst_v_rtnbeg_no_call : 1; + } dst_b_rtnbeg_flags; + int *dst_l_rtnbeg_address; + int *dst_l_rtnbeg_pd_address; + unsigned char dst_b_rtnbeg_name; +} DST_ROUTINE_BEGIN; +#define DST_K_RTNBEG_SIZE 14 + +/* Routine trailer */ + +typedef struct _DST_ROUTINE_END +{ + DST_HEADER dst_a_rtnend_header; + char dst_b_rtnend_unused; + unsigned int dst_l_rtnend_size; +} DST_ROUTINE_END; +#define DST_K_RTNEND_SIZE 9 + +/* Block header. */ + +typedef struct _DST_BLOCK_BEGIN +{ + DST_HEADER dst_a_blkbeg_header; + unsigned char dst_b_blkbeg_unused; + int *dst_l_blkbeg_address; + unsigned char dst_b_blkbeg_name; +} DST_BLOCK_BEGIN; +#define DST_K_BLKBEG_SIZE 10 + +/* Block trailer. */ + +typedef struct _DST_BLOCK_END +{ + DST_HEADER dst_a_blkend_header; + unsigned char dst_b_blkend_unused; + unsigned int dst_l_blkend_size; +} DST_BLOCK_END; +#define DST_K_BLKEND_SIZE 9 + +/* Line number header. */ + +typedef struct _DST_LINE_NUM_HEADER +{ + DST_HEADER dst_a_line_num_header; +} DST_LINE_NUM_HEADER; +#define DST_K_LINE_NUM_HEADER_SIZE 4 + +/* PC to Line number correlation. */ + +typedef struct _DST_PCLINE_COMMANDS +{ + char dst_b_pcline_command; + union + { + unsigned int dst_l_pcline_unslong; + unsigned short int dst_w_pcline_unsword; + unsigned char dst_b_pcline_unsbyte; + } dst_a_pcline_access_fields; +} DST_PCLINE_COMMANDS; + +/* PC and Line number correlation codes. */ + +#define DST_K_PCLINE_COMMANDS_SIZE 5 +#define DST_K_PCLINE_COMMANDS_SIZE_MIN 2 +#define DST_K_PCLINE_COMMANDS_SIZE_MAX 5 +#define DST_K_DELTA_PC_LOW -128 +#define DST_K_DELTA_PC_HIGH 0 +#define DST_K_DELTA_PC_W 1 +#define DST_K_INCR_LINUM 2 +#define DST_K_INCR_LINUM_W 3 +#define DST_K_SET_LINUM 9 +#define DST_K_SET_ABS_PC 16 +#define DST_K_DELTA_PC_L 17 +#define DST_K_INCR_LINUM_L 18 +#define DST_K_SET_LINUM_B 19 +#define DST_K_SET_LINUM_L 20 + +/* Source file correlation header. */ + +typedef struct _DST_SOURCE_CORR +{ + DST_HEADER dst_a_source_corr_header; +} DST_SOURCE_CORR; +#define DST_K_SOURCE_CORR_HEADER_SIZE 4 + +/* Source file correlation codes. */ + +#define DST_K_SRC_DECLFILE 1 +#define DST_K_SRC_SETFILE 2 +#define DST_K_SRC_SETREC_L 3 +#define DST_K_SRC_SETREC_W 4 +#define DST_K_SRC_SETLNUM_L 5 +#define DST_K_SRC_SETLNUM_W 6 +#define DST_K_SRC_INCRLNUM_B 7 +#define DST_K_SRC_DEFLINES_W 10 +#define DST_K_SRC_DEFLINES_B 11 +#define DST_K_SRC_FORMFEED 16 +#define DST_K_SRC_MIN_CMD 1 +#define DST_K_SRC_MAX_CMD 16 + +/* Source file header. */ + +typedef struct _DST_SRC_COMMAND +{ + unsigned char dst_b_src_command; + union + { + struct + { + unsigned char dst_b_src_df_length; + unsigned char dst_b_src_df_flags; + unsigned short int dst_w_src_df_fileid; + int64_t dst_q_src_df_rms_cdt; + unsigned int dst_l_src_df_rms_ebk; + unsigned short int dst_w_src_df_rms_ffb; + unsigned char dst_b_src_df_rms_rfo; + unsigned char dst_b_src_df_filename; + } dst_a_src_decl_src; + unsigned int dst_l_src_unslong; + unsigned short int dst_w_src_unsword; + unsigned char dst_b_src_unsbyte; + } dst_a_src_cmd_fields; +} DST_SRC_COMMAND; +#define DST_K_SRC_COMMAND_SIZE 21 + +/* Source file trailer. */ + +typedef struct _DST_SRC_CMDTRLR +{ + unsigned char dst_b_src_df_libmodname; +} DST_SRC_CMDTRLR; +#define DST_K_SRC_CMDTRLR_SIZE 1 + +/* Prolog header. */ + +typedef struct _DST_PROLOG +{ + DST_HEADER dst_a_prolog_header; + unsigned int dst_l_prolog_bkpt_addr; +} DST_PROLOG; +#define DST_K_PROLOG_SIZE 8 + +#endif /* GCC_VMSDBG_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/vtable-verify.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/vtable-verify.h new file mode 100644 index 0000000..d01df27 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/vtable-verify.h @@ -0,0 +1,143 @@ +/* Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* Virtual Table Pointer Security. */ + +#ifndef VTABLE_VERIFY_H +#define VTABLE_VERIFY_H + +#include "sbitmap.h" + +/* The function decl used to create calls to __VLTVtableVerify. It must + be global because it needs to be initialized in the C++ front end, but + used in the middle end (in the vtable verification pass). */ + +extern tree verify_vtbl_ptr_fndecl; + +/* Global variable keeping track of how many vtable map variables we + have created. */ +extern unsigned num_vtable_map_nodes; + +/* Keep track of how many virtual calls we are actually verifying. */ +extern int total_num_virtual_calls; +extern int total_num_verified_vcalls; + +/* Each vtable map variable corresponds to a virtual class. Each + vtable map variable has a hash table associated with it, that keeps + track of the vtable pointers for which we have generated a call to + __VLTRegisterPair (with the current vtable map variable). This is + the hash table node that is used for each entry in this hash table + of vtable pointers. + + Sometimes there are multiple valid vtable pointer entries that use + the same vtable pointer decl with different offsets. Therefore, + for each vtable pointer in the hash table, there is also an array + of offsets used with that vtable. */ + +struct vtable_registration +{ + tree vtable_decl; /* The var decl of the vtable. */ + vec offsets; /* The offsets array. */ +}; + +struct registration_hasher : nofree_ptr_hash +{ + static inline hashval_t hash (const vtable_registration *); + static inline bool equal (const vtable_registration *, + const vtable_registration *); +}; + +typedef hash_table register_table_type; +typedef register_table_type::iterator registration_iterator_type; + +/* This struct is used to represent the class hierarchy information + that we need. Each vtable map variable has an associated class + hierarchy node (struct vtv_graph_node). Note: In this struct, + 'children' means immediate descendants in the class hierarchy; + 'descendant' means any descendant however many levels deep. */ + +struct vtv_graph_node { + tree class_type; /* The record_type of the class. */ + unsigned class_uid; /* A unique, monotonically + ascending id for class node. + Each vtable map node also has + an id. The class uid is the + same as the vtable map node id + for nodes corresponding to the + same class. */ + unsigned num_processed_children; /* # of children for whom we have + computed the class hierarchy + transitive closure. */ + vec parents; /* Vector of parents in the graph. */ + vec children; /* Vector of children in the graph.*/ + sbitmap descendants; /* Bitmap representing all this node's + descendants in the graph. */ +}; + +/* This is the node used for our hashtable of vtable map variable + information. When we create a vtable map variable (var decl) we + put it into one of these nodes; create a corresponding + vtv_graph_node for our class hierarchy info and store that in this + node; generate a unique (monotonically ascending) id for both the + vtbl_map_node and the vtv_graph_node; and insert the node into two + data structures (to make it easy to find in several different + ways): 1). A hash table ("vtbl_map_hash" in vtable-verify.c). + This gives us an easy way to check to see if we already have a node + for the vtable map variable or not; and 2). An array (vector) of + vtbl_map_nodes, where the array index corresponds to the unique id + of the vtbl_map_node, which gives us an easy way to use bitmaps to + represent and find the vtable map nodes. */ + +struct vtbl_map_node { + tree vtbl_map_decl; /* The var decl for the vtable map + variable. */ + tree class_name; /* The DECL_ASSEMBLER_NAME of the + class. */ + struct vtv_graph_node *class_info; /* Our class hierarchy info for the + class. */ + unsigned uid; /* The unique id for the vtable map + variable. */ + struct vtbl_map_node *next, *prev; /* Pointers for the linked list + structure. */ + register_table_type *registered; /* Hashtable of vtable pointers for which + we have generated a _VLTRegisterPair + call with this vtable map variable. */ + bool is_used; /* Boolean indicating if we used this vtable map + variable in a call to __VLTVerifyVtablePointer. */ +}; + +/* Controls debugging for vtable verification. */ +extern bool vtv_debug; + +/* The global vector of vtbl_map_nodes. */ +extern vec vtbl_map_nodes_vec; + +/* The global vectors for mangled class names for anonymous classes. */ +extern GTY(()) vec *vtbl_mangled_name_types; +extern GTY(()) vec *vtbl_mangled_name_ids; + +extern void vtbl_register_mangled_name (tree, tree); +extern struct vtbl_map_node *vtbl_map_get_node (tree); +extern struct vtbl_map_node *find_or_create_vtbl_map_node (tree); +extern void vtbl_map_node_class_insert (struct vtbl_map_node *, unsigned); +extern bool vtbl_map_node_registration_find (struct vtbl_map_node *, + tree, unsigned); +extern bool vtbl_map_node_registration_insert (struct vtbl_map_node *, + tree, unsigned); + +#endif /* VTABLE_VERIFY_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/wide-int-print.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/wide-int-print.h new file mode 100644 index 0000000..8ff01a4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/wide-int-print.h @@ -0,0 +1,38 @@ +/* Print wide integers. + Copyright (C) 2013-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3, or (at your option) any +later version. + +GCC is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef WIDE_INT_PRINT_H +#define WIDE_INT_PRINT_H + +#include + +#define WIDE_INT_PRINT_BUFFER_SIZE (WIDE_INT_MAX_PRECISION / 4 + 4) + +/* Printing functions. */ + +extern void print_dec (const wide_int_ref &wi, char *buf, signop sgn); +extern void print_dec (const wide_int_ref &wi, FILE *file, signop sgn); +extern void print_decs (const wide_int_ref &wi, char *buf); +extern void print_decs (const wide_int_ref &wi, FILE *file); +extern void print_decu (const wide_int_ref &wi, char *buf); +extern void print_decu (const wide_int_ref &wi, FILE *file); +extern void print_hex (const wide_int_ref &wi, char *buf); +extern void print_hex (const wide_int_ref &wi, FILE *file); + +#endif /* WIDE_INT_PRINT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/wide-int.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/wide-int.h new file mode 100644 index 0000000..2115b61 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/wide-int.h @@ -0,0 +1,3277 @@ +/* Operations with very long integers. -*- C++ -*- + Copyright (C) 2012-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3, or (at your option) any +later version. + +GCC is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef WIDE_INT_H +#define WIDE_INT_H + +/* wide-int.[cc|h] implements a class that efficiently performs + mathematical operations on finite precision integers. wide_ints + are designed to be transient - they are not for long term storage + of values. There is tight integration between wide_ints and the + other longer storage GCC representations (rtl and tree). + + The actual precision of a wide_int depends on the flavor. There + are three predefined flavors: + + 1) wide_int (the default). This flavor does the math in the + precision of its input arguments. It is assumed (and checked) + that the precisions of the operands and results are consistent. + This is the most efficient flavor. It is not possible to examine + bits above the precision that has been specified. Because of + this, the default flavor has semantics that are simple to + understand and in general model the underlying hardware that the + compiler is targetted for. + + This flavor must be used at the RTL level of gcc because there + is, in general, not enough information in the RTL representation + to extend a value beyond the precision specified in the mode. + + This flavor should also be used at the TREE and GIMPLE levels of + the compiler except for the circumstances described in the + descriptions of the other two flavors. + + The default wide_int representation does not contain any + information inherent about signedness of the represented value, + so it can be used to represent both signed and unsigned numbers. + For operations where the results depend on signedness (full width + multiply, division, shifts, comparisons, and operations that need + overflow detected), the signedness must be specified separately. + + 2) offset_int. This is a fixed-precision integer that can hold + any address offset, measured in either bits or bytes, with at + least one extra sign bit. At the moment the maximum address + size GCC supports is 64 bits. With 8-bit bytes and an extra + sign bit, offset_int therefore needs to have at least 68 bits + of precision. We round this up to 128 bits for efficiency. + Values of type T are converted to this precision by sign- or + zero-extending them based on the signedness of T. + + The extra sign bit means that offset_int is effectively a signed + 128-bit integer, i.e. it behaves like int128_t. + + Since the values are logically signed, there is no need to + distinguish between signed and unsigned operations. Sign-sensitive + comparison operators <, <=, > and >= are therefore supported. + Shift operators << and >> are also supported, with >> being + an _arithmetic_ right shift. + + [ Note that, even though offset_int is effectively int128_t, + it can still be useful to use unsigned comparisons like + wi::leu_p (a, b) as a more efficient short-hand for + "a >= 0 && a <= b". ] + + 3) widest_int. This representation is an approximation of + infinite precision math. However, it is not really infinite + precision math as in the GMP library. It is really finite + precision math where the precision is 4 times the size of the + largest integer that the target port can represent. + + Like offset_int, widest_int is wider than all the values that + it needs to represent, so the integers are logically signed. + Sign-sensitive comparison operators <, <=, > and >= are supported, + as are << and >>. + + There are several places in the GCC where this should/must be used: + + * Code that does induction variable optimizations. This code + works with induction variables of many different types at the + same time. Because of this, it ends up doing many different + calculations where the operands are not compatible types. The + widest_int makes this easy, because it provides a field where + nothing is lost when converting from any variable, + + * There are a small number of passes that currently use the + widest_int that should use the default. These should be + changed. + + There are surprising features of offset_int and widest_int + that the users should be careful about: + + 1) Shifts and rotations are just weird. You have to specify a + precision in which the shift or rotate is to happen in. The bits + above this precision are zeroed. While this is what you + want, it is clearly non obvious. + + 2) Larger precision math sometimes does not produce the same + answer as would be expected for doing the math at the proper + precision. In particular, a multiply followed by a divide will + produce a different answer if the first product is larger than + what can be represented in the input precision. + + The offset_int and the widest_int flavors are more expensive + than the default wide int, so in addition to the caveats with these + two, the default is the prefered representation. + + All three flavors of wide_int are represented as a vector of + HOST_WIDE_INTs. The default and widest_int vectors contain enough elements + to hold a value of MAX_BITSIZE_MODE_ANY_INT bits. offset_int contains only + enough elements to hold ADDR_MAX_PRECISION bits. The values are stored + in the vector with the least significant HOST_BITS_PER_WIDE_INT bits + in element 0. + + The default wide_int contains three fields: the vector (VAL), + the precision and a length (LEN). The length is the number of HWIs + needed to represent the value. widest_int and offset_int have a + constant precision that cannot be changed, so they only store the + VAL and LEN fields. + + Since most integers used in a compiler are small values, it is + generally profitable to use a representation of the value that is + as small as possible. LEN is used to indicate the number of + elements of the vector that are in use. The numbers are stored as + sign extended numbers as a means of compression. Leading + HOST_WIDE_INTs that contain strings of either -1 or 0 are removed + as long as they can be reconstructed from the top bit that is being + represented. + + The precision and length of a wide_int are always greater than 0. + Any bits in a wide_int above the precision are sign-extended from the + most significant bit. For example, a 4-bit value 0x8 is represented as + VAL = { 0xf...fff8 }. However, as an optimization, we allow other integer + constants to be represented with undefined bits above the precision. + This allows INTEGER_CSTs to be pre-extended according to TYPE_SIGN, + so that the INTEGER_CST representation can be used both in TYPE_PRECISION + and in wider precisions. + + There are constructors to create the various forms of wide_int from + trees, rtl and constants. For trees you can simply say: + + tree t = ...; + wide_int x = t; + + However, a little more syntax is required for rtl constants since + they do not have an explicit precision. To make an rtl into a + wide_int, you have to pair it with a mode. The canonical way to do + this is with rtx_mode_t as in: + + rtx r = ... + wide_int x = rtx_mode_t (r, mode); + + Similarly, a wide_int can only be constructed from a host value if + the target precision is given explicitly, such as in: + + wide_int x = wi::shwi (c, prec); // sign-extend C if necessary + wide_int y = wi::uhwi (c, prec); // zero-extend C if necessary + + However, offset_int and widest_int have an inherent precision and so + can be initialized directly from a host value: + + offset_int x = (int) c; // sign-extend C + widest_int x = (unsigned int) c; // zero-extend C + + It is also possible to do arithmetic directly on trees, rtxes and + constants. For example: + + wi::add (t1, t2); // add equal-sized INTEGER_CSTs t1 and t2 + wi::add (t1, 1); // add 1 to INTEGER_CST t1 + wi::add (r1, r2); // add equal-sized rtx constants r1 and r2 + wi::lshift (1, 100); // 1 << 100 as a widest_int + + Many binary operations place restrictions on the combinations of inputs, + using the following rules: + + - {tree, rtx, wide_int} op {tree, rtx, wide_int} -> wide_int + The inputs must be the same precision. The result is a wide_int + of the same precision + + - {tree, rtx, wide_int} op (un)signed HOST_WIDE_INT -> wide_int + (un)signed HOST_WIDE_INT op {tree, rtx, wide_int} -> wide_int + The HOST_WIDE_INT is extended or truncated to the precision of + the other input. The result is a wide_int of the same precision + as that input. + + - (un)signed HOST_WIDE_INT op (un)signed HOST_WIDE_INT -> widest_int + The inputs are extended to widest_int precision and produce a + widest_int result. + + - offset_int op offset_int -> offset_int + offset_int op (un)signed HOST_WIDE_INT -> offset_int + (un)signed HOST_WIDE_INT op offset_int -> offset_int + + - widest_int op widest_int -> widest_int + widest_int op (un)signed HOST_WIDE_INT -> widest_int + (un)signed HOST_WIDE_INT op widest_int -> widest_int + + Other combinations like: + + - widest_int op offset_int and + - wide_int op offset_int + + are not allowed. The inputs should instead be extended or truncated + so that they match. + + The inputs to comparison functions like wi::eq_p and wi::lts_p + follow the same compatibility rules, although their return types + are different. Unary functions on X produce the same result as + a binary operation X + X. Shift functions X op Y also produce + the same result as X + X; the precision of the shift amount Y + can be arbitrarily different from X. */ + +/* The MAX_BITSIZE_MODE_ANY_INT is automatically generated by a very + early examination of the target's mode file. The WIDE_INT_MAX_ELTS + can accomodate at least 1 more bit so that unsigned numbers of that + mode can be represented as a signed value. Note that it is still + possible to create fixed_wide_ints that have precisions greater than + MAX_BITSIZE_MODE_ANY_INT. This can be useful when representing a + double-width multiplication result, for example. */ +#define WIDE_INT_MAX_ELTS \ + ((MAX_BITSIZE_MODE_ANY_INT + HOST_BITS_PER_WIDE_INT) / HOST_BITS_PER_WIDE_INT) + +#define WIDE_INT_MAX_PRECISION (WIDE_INT_MAX_ELTS * HOST_BITS_PER_WIDE_INT) + +/* This is the max size of any pointer on any machine. It does not + seem to be as easy to sniff this out of the machine description as + it is for MAX_BITSIZE_MODE_ANY_INT since targets may support + multiple address sizes and may have different address sizes for + different address spaces. However, currently the largest pointer + on any platform is 64 bits. When that changes, then it is likely + that a target hook should be defined so that targets can make this + value larger for those targets. */ +#define ADDR_MAX_BITSIZE 64 + +/* This is the internal precision used when doing any address + arithmetic. The '4' is really 3 + 1. Three of the bits are for + the number of extra bits needed to do bit addresses and the other bit + is to allow everything to be signed without loosing any precision. + Then everything is rounded up to the next HWI for efficiency. */ +#define ADDR_MAX_PRECISION \ + ((ADDR_MAX_BITSIZE + 4 + HOST_BITS_PER_WIDE_INT - 1) \ + & ~(HOST_BITS_PER_WIDE_INT - 1)) + +/* The number of HWIs needed to store an offset_int. */ +#define OFFSET_INT_ELTS (ADDR_MAX_PRECISION / HOST_BITS_PER_WIDE_INT) + +/* The type of result produced by a binary operation on types T1 and T2. + Defined purely for brevity. */ +#define WI_BINARY_RESULT(T1, T2) \ + typename wi::binary_traits ::result_type + +/* The type of result produced by T1 << T2. Leads to substitution failure + if the operation isn't supported. Defined purely for brevity. */ +#define WI_SIGNED_SHIFT_RESULT(T1, T2) \ + typename wi::binary_traits ::signed_shift_result_type + +/* The type of result produced by a signed binary predicate on types T1 and T2. + This is bool if signed comparisons make sense for T1 and T2 and leads to + substitution failure otherwise. */ +#define WI_SIGNED_BINARY_PREDICATE_RESULT(T1, T2) \ + typename wi::binary_traits ::signed_predicate_result + +/* The type of result produced by a unary operation on type T. */ +#define WI_UNARY_RESULT(T) \ + typename wi::unary_traits ::result_type + +/* Define a variable RESULT to hold the result of a binary operation on + X and Y, which have types T1 and T2 respectively. Define VAL to + point to the blocks of RESULT. Once the user of the macro has + filled in VAL, it should call RESULT.set_len to set the number + of initialized blocks. */ +#define WI_BINARY_RESULT_VAR(RESULT, VAL, T1, X, T2, Y) \ + WI_BINARY_RESULT (T1, T2) RESULT = \ + wi::int_traits ::get_binary_result (X, Y); \ + HOST_WIDE_INT *VAL = RESULT.write_val () + +/* Similar for the result of a unary operation on X, which has type T. */ +#define WI_UNARY_RESULT_VAR(RESULT, VAL, T, X) \ + WI_UNARY_RESULT (T) RESULT = \ + wi::int_traits ::get_binary_result (X, X); \ + HOST_WIDE_INT *VAL = RESULT.write_val () + +template class generic_wide_int; +template class fixed_wide_int_storage; +class wide_int_storage; + +/* An N-bit integer. Until we can use typedef templates, use this instead. */ +#define FIXED_WIDE_INT(N) \ + generic_wide_int < fixed_wide_int_storage > + +typedef generic_wide_int wide_int; +typedef FIXED_WIDE_INT (ADDR_MAX_PRECISION) offset_int; +typedef FIXED_WIDE_INT (WIDE_INT_MAX_PRECISION) widest_int; + +template +struct wide_int_ref_storage; + +typedef generic_wide_int > wide_int_ref; + +/* This can be used instead of wide_int_ref if the referenced value is + known to have type T. It carries across properties of T's representation, + such as whether excess upper bits in a HWI are defined, and can therefore + help avoid redundant work. + + The macro could be replaced with a template typedef, once we're able + to use those. */ +#define WIDE_INT_REF_FOR(T) \ + generic_wide_int \ + ::is_sign_extended> > + +namespace wi +{ + /* Classifies an integer based on its precision. */ + enum precision_type { + /* The integer has both a precision and defined signedness. This allows + the integer to be converted to any width, since we know whether to fill + any extra bits with zeros or signs. */ + FLEXIBLE_PRECISION, + + /* The integer has a variable precision but no defined signedness. */ + VAR_PRECISION, + + /* The integer has a constant precision (known at GCC compile time) + and is signed. */ + CONST_PRECISION + }; + + /* This class, which has no default implementation, is expected to + provide the following members: + + static const enum precision_type precision_type; + Classifies the type of T. + + static const unsigned int precision; + Only defined if precision_type == CONST_PRECISION. Specifies the + precision of all integers of type T. + + static const bool host_dependent_precision; + True if the precision of T depends (or can depend) on the host. + + static unsigned int get_precision (const T &x) + Return the number of bits in X. + + static wi::storage_ref *decompose (HOST_WIDE_INT *scratch, + unsigned int precision, const T &x) + Decompose X as a PRECISION-bit integer, returning the associated + wi::storage_ref. SCRATCH is available as scratch space if needed. + The routine should assert that PRECISION is acceptable. */ + template struct int_traits; + + /* This class provides a single type, result_type, which specifies the + type of integer produced by a binary operation whose inputs have + types T1 and T2. The definition should be symmetric. */ + template ::precision_type, + enum precision_type P2 = int_traits ::precision_type> + struct binary_traits; + + /* The result of a unary operation on T is the same as the result of + a binary operation on two values of type T. */ + template + struct unary_traits : public binary_traits {}; + + /* Specify the result type for each supported combination of binary + inputs. Note that CONST_PRECISION and VAR_PRECISION cannot be + mixed, in order to give stronger type checking. When both inputs + are CONST_PRECISION, they must have the same precision. */ + template + struct binary_traits + { + typedef widest_int result_type; + }; + + template + struct binary_traits + { + typedef wide_int result_type; + }; + + template + struct binary_traits + { + /* Spelled out explicitly (rather than through FIXED_WIDE_INT) + so as not to confuse gengtype. */ + typedef generic_wide_int < fixed_wide_int_storage + ::precision> > result_type; + typedef bool signed_predicate_result; + }; + + template + struct binary_traits + { + typedef wide_int result_type; + }; + + template + struct binary_traits + { + /* Spelled out explicitly (rather than through FIXED_WIDE_INT) + so as not to confuse gengtype. */ + typedef generic_wide_int < fixed_wide_int_storage + ::precision> > result_type; + typedef result_type signed_shift_result_type; + typedef bool signed_predicate_result; + }; + + template + struct binary_traits + { + /* Spelled out explicitly (rather than through FIXED_WIDE_INT) + so as not to confuse gengtype. */ + STATIC_ASSERT (int_traits ::precision == int_traits ::precision); + typedef generic_wide_int < fixed_wide_int_storage + ::precision> > result_type; + typedef result_type signed_shift_result_type; + typedef bool signed_predicate_result; + }; + + template + struct binary_traits + { + typedef wide_int result_type; + }; +} + +/* Public functions for querying and operating on integers. */ +namespace wi +{ + template + unsigned int get_precision (const T &); + + template + unsigned int get_binary_precision (const T1 &, const T2 &); + + template + void copy (T1 &, const T2 &); + +#define UNARY_PREDICATE \ + template bool +#define UNARY_FUNCTION \ + template WI_UNARY_RESULT (T) +#define BINARY_PREDICATE \ + template bool +#define BINARY_FUNCTION \ + template WI_BINARY_RESULT (T1, T2) +#define SHIFT_FUNCTION \ + template WI_UNARY_RESULT (T1) + + UNARY_PREDICATE fits_shwi_p (const T &); + UNARY_PREDICATE fits_uhwi_p (const T &); + UNARY_PREDICATE neg_p (const T &, signop = SIGNED); + + template + HOST_WIDE_INT sign_mask (const T &); + + BINARY_PREDICATE eq_p (const T1 &, const T2 &); + BINARY_PREDICATE ne_p (const T1 &, const T2 &); + BINARY_PREDICATE lt_p (const T1 &, const T2 &, signop); + BINARY_PREDICATE lts_p (const T1 &, const T2 &); + BINARY_PREDICATE ltu_p (const T1 &, const T2 &); + BINARY_PREDICATE le_p (const T1 &, const T2 &, signop); + BINARY_PREDICATE les_p (const T1 &, const T2 &); + BINARY_PREDICATE leu_p (const T1 &, const T2 &); + BINARY_PREDICATE gt_p (const T1 &, const T2 &, signop); + BINARY_PREDICATE gts_p (const T1 &, const T2 &); + BINARY_PREDICATE gtu_p (const T1 &, const T2 &); + BINARY_PREDICATE ge_p (const T1 &, const T2 &, signop); + BINARY_PREDICATE ges_p (const T1 &, const T2 &); + BINARY_PREDICATE geu_p (const T1 &, const T2 &); + + template + int cmp (const T1 &, const T2 &, signop); + + template + int cmps (const T1 &, const T2 &); + + template + int cmpu (const T1 &, const T2 &); + + UNARY_FUNCTION bit_not (const T &); + UNARY_FUNCTION neg (const T &); + UNARY_FUNCTION neg (const T &, bool *); + UNARY_FUNCTION abs (const T &); + UNARY_FUNCTION ext (const T &, unsigned int, signop); + UNARY_FUNCTION sext (const T &, unsigned int); + UNARY_FUNCTION zext (const T &, unsigned int); + UNARY_FUNCTION set_bit (const T &, unsigned int); + + BINARY_FUNCTION min (const T1 &, const T2 &, signop); + BINARY_FUNCTION smin (const T1 &, const T2 &); + BINARY_FUNCTION umin (const T1 &, const T2 &); + BINARY_FUNCTION max (const T1 &, const T2 &, signop); + BINARY_FUNCTION smax (const T1 &, const T2 &); + BINARY_FUNCTION umax (const T1 &, const T2 &); + + BINARY_FUNCTION bit_and (const T1 &, const T2 &); + BINARY_FUNCTION bit_and_not (const T1 &, const T2 &); + BINARY_FUNCTION bit_or (const T1 &, const T2 &); + BINARY_FUNCTION bit_or_not (const T1 &, const T2 &); + BINARY_FUNCTION bit_xor (const T1 &, const T2 &); + BINARY_FUNCTION add (const T1 &, const T2 &); + BINARY_FUNCTION add (const T1 &, const T2 &, signop, bool *); + BINARY_FUNCTION sub (const T1 &, const T2 &); + BINARY_FUNCTION sub (const T1 &, const T2 &, signop, bool *); + BINARY_FUNCTION mul (const T1 &, const T2 &); + BINARY_FUNCTION mul (const T1 &, const T2 &, signop, bool *); + BINARY_FUNCTION smul (const T1 &, const T2 &, bool *); + BINARY_FUNCTION umul (const T1 &, const T2 &, bool *); + BINARY_FUNCTION mul_high (const T1 &, const T2 &, signop); + BINARY_FUNCTION div_trunc (const T1 &, const T2 &, signop, bool * = 0); + BINARY_FUNCTION sdiv_trunc (const T1 &, const T2 &); + BINARY_FUNCTION udiv_trunc (const T1 &, const T2 &); + BINARY_FUNCTION div_floor (const T1 &, const T2 &, signop, bool * = 0); + BINARY_FUNCTION udiv_floor (const T1 &, const T2 &); + BINARY_FUNCTION sdiv_floor (const T1 &, const T2 &); + BINARY_FUNCTION div_ceil (const T1 &, const T2 &, signop, bool * = 0); + BINARY_FUNCTION div_round (const T1 &, const T2 &, signop, bool * = 0); + BINARY_FUNCTION divmod_trunc (const T1 &, const T2 &, signop, + WI_BINARY_RESULT (T1, T2) *); + BINARY_FUNCTION gcd (const T1 &, const T2 &, signop = UNSIGNED); + BINARY_FUNCTION mod_trunc (const T1 &, const T2 &, signop, bool * = 0); + BINARY_FUNCTION smod_trunc (const T1 &, const T2 &); + BINARY_FUNCTION umod_trunc (const T1 &, const T2 &); + BINARY_FUNCTION mod_floor (const T1 &, const T2 &, signop, bool * = 0); + BINARY_FUNCTION umod_floor (const T1 &, const T2 &); + BINARY_FUNCTION mod_ceil (const T1 &, const T2 &, signop, bool * = 0); + BINARY_FUNCTION mod_round (const T1 &, const T2 &, signop, bool * = 0); + + template + bool multiple_of_p (const T1 &, const T2 &, signop); + + template + bool multiple_of_p (const T1 &, const T2 &, signop, + WI_BINARY_RESULT (T1, T2) *); + + SHIFT_FUNCTION lshift (const T1 &, const T2 &); + SHIFT_FUNCTION lrshift (const T1 &, const T2 &); + SHIFT_FUNCTION arshift (const T1 &, const T2 &); + SHIFT_FUNCTION rshift (const T1 &, const T2 &, signop sgn); + SHIFT_FUNCTION lrotate (const T1 &, const T2 &, unsigned int = 0); + SHIFT_FUNCTION rrotate (const T1 &, const T2 &, unsigned int = 0); + +#undef SHIFT_FUNCTION +#undef BINARY_PREDICATE +#undef BINARY_FUNCTION +#undef UNARY_PREDICATE +#undef UNARY_FUNCTION + + bool only_sign_bit_p (const wide_int_ref &, unsigned int); + bool only_sign_bit_p (const wide_int_ref &); + int clz (const wide_int_ref &); + int clrsb (const wide_int_ref &); + int ctz (const wide_int_ref &); + int exact_log2 (const wide_int_ref &); + int floor_log2 (const wide_int_ref &); + int ffs (const wide_int_ref &); + int popcount (const wide_int_ref &); + int parity (const wide_int_ref &); + + template + unsigned HOST_WIDE_INT extract_uhwi (const T &, unsigned int, unsigned int); + + template + unsigned int min_precision (const T &, signop); +} + +namespace wi +{ + /* Contains the components of a decomposed integer for easy, direct + access. */ + struct storage_ref + { + storage_ref (const HOST_WIDE_INT *, unsigned int, unsigned int); + + const HOST_WIDE_INT *val; + unsigned int len; + unsigned int precision; + + /* Provide enough trappings for this class to act as storage for + generic_wide_int. */ + unsigned int get_len () const; + unsigned int get_precision () const; + const HOST_WIDE_INT *get_val () const; + }; +} + +inline::wi::storage_ref::storage_ref (const HOST_WIDE_INT *val_in, + unsigned int len_in, + unsigned int precision_in) + : val (val_in), len (len_in), precision (precision_in) +{ +} + +inline unsigned int +wi::storage_ref::get_len () const +{ + return len; +} + +inline unsigned int +wi::storage_ref::get_precision () const +{ + return precision; +} + +inline const HOST_WIDE_INT * +wi::storage_ref::get_val () const +{ + return val; +} + +/* This class defines an integer type using the storage provided by the + template argument. The storage class must provide the following + functions: + + unsigned int get_precision () const + Return the number of bits in the integer. + + HOST_WIDE_INT *get_val () const + Return a pointer to the array of blocks that encodes the integer. + + unsigned int get_len () const + Return the number of blocks in get_val (). If this is smaller + than the number of blocks implied by get_precision (), the + remaining blocks are sign extensions of block get_len () - 1. + + Although not required by generic_wide_int itself, writable storage + classes can also provide the following functions: + + HOST_WIDE_INT *write_val () + Get a modifiable version of get_val () + + unsigned int set_len (unsigned int len) + Set the value returned by get_len () to LEN. */ +template +class GTY(()) generic_wide_int : public storage +{ +public: + generic_wide_int (); + + template + generic_wide_int (const T &); + + template + generic_wide_int (const T &, unsigned int); + + /* Conversions. */ + HOST_WIDE_INT to_shwi (unsigned int) const; + HOST_WIDE_INT to_shwi () const; + unsigned HOST_WIDE_INT to_uhwi (unsigned int) const; + unsigned HOST_WIDE_INT to_uhwi () const; + HOST_WIDE_INT to_short_addr () const; + + /* Public accessors for the interior of a wide int. */ + HOST_WIDE_INT sign_mask () const; + HOST_WIDE_INT elt (unsigned int) const; + unsigned HOST_WIDE_INT ulow () const; + unsigned HOST_WIDE_INT uhigh () const; + HOST_WIDE_INT slow () const; + HOST_WIDE_INT shigh () const; + + template + generic_wide_int &operator = (const T &); + +#define BINARY_PREDICATE(OP, F) \ + template \ + bool OP (const T &c) const { return wi::F (*this, c); } + +#define UNARY_OPERATOR(OP, F) \ + WI_UNARY_RESULT (generic_wide_int) OP () const { return wi::F (*this); } + +#define BINARY_OPERATOR(OP, F) \ + template \ + WI_BINARY_RESULT (generic_wide_int, T) \ + OP (const T &c) const { return wi::F (*this, c); } + +#define ASSIGNMENT_OPERATOR(OP, F) \ + template \ + generic_wide_int &OP (const T &c) { return (*this = wi::F (*this, c)); } + +/* Restrict these to cases where the shift operator is defined. */ +#define SHIFT_ASSIGNMENT_OPERATOR(OP, OP2) \ + template \ + generic_wide_int &OP (const T &c) { return (*this = *this OP2 c); } + +#define INCDEC_OPERATOR(OP, DELTA) \ + generic_wide_int &OP () { *this += DELTA; return *this; } + + UNARY_OPERATOR (operator ~, bit_not) + UNARY_OPERATOR (operator -, neg) + BINARY_PREDICATE (operator ==, eq_p) + BINARY_PREDICATE (operator !=, ne_p) + BINARY_OPERATOR (operator &, bit_and) + BINARY_OPERATOR (and_not, bit_and_not) + BINARY_OPERATOR (operator |, bit_or) + BINARY_OPERATOR (or_not, bit_or_not) + BINARY_OPERATOR (operator ^, bit_xor) + BINARY_OPERATOR (operator +, add) + BINARY_OPERATOR (operator -, sub) + BINARY_OPERATOR (operator *, mul) + ASSIGNMENT_OPERATOR (operator &=, bit_and) + ASSIGNMENT_OPERATOR (operator |=, bit_or) + ASSIGNMENT_OPERATOR (operator ^=, bit_xor) + ASSIGNMENT_OPERATOR (operator +=, add) + ASSIGNMENT_OPERATOR (operator -=, sub) + ASSIGNMENT_OPERATOR (operator *=, mul) + SHIFT_ASSIGNMENT_OPERATOR (operator <<=, <<) + SHIFT_ASSIGNMENT_OPERATOR (operator >>=, >>) + INCDEC_OPERATOR (operator ++, 1) + INCDEC_OPERATOR (operator --, -1) + +#undef BINARY_PREDICATE +#undef UNARY_OPERATOR +#undef BINARY_OPERATOR +#undef SHIFT_ASSIGNMENT_OPERATOR +#undef ASSIGNMENT_OPERATOR +#undef INCDEC_OPERATOR + + /* Debugging functions. */ + void dump () const; + + static const bool is_sign_extended + = wi::int_traits >::is_sign_extended; +}; + +template +inline generic_wide_int ::generic_wide_int () {} + +template +template +inline generic_wide_int ::generic_wide_int (const T &x) + : storage (x) +{ +} + +template +template +inline generic_wide_int ::generic_wide_int (const T &x, + unsigned int precision) + : storage (x, precision) +{ +} + +/* Return THIS as a signed HOST_WIDE_INT, sign-extending from PRECISION. + If THIS does not fit in PRECISION, the information is lost. */ +template +inline HOST_WIDE_INT +generic_wide_int ::to_shwi (unsigned int precision) const +{ + if (precision < HOST_BITS_PER_WIDE_INT) + return sext_hwi (this->get_val ()[0], precision); + else + return this->get_val ()[0]; +} + +/* Return THIS as a signed HOST_WIDE_INT, in its natural precision. */ +template +inline HOST_WIDE_INT +generic_wide_int ::to_shwi () const +{ + if (is_sign_extended) + return this->get_val ()[0]; + else + return to_shwi (this->get_precision ()); +} + +/* Return THIS as an unsigned HOST_WIDE_INT, zero-extending from + PRECISION. If THIS does not fit in PRECISION, the information + is lost. */ +template +inline unsigned HOST_WIDE_INT +generic_wide_int ::to_uhwi (unsigned int precision) const +{ + if (precision < HOST_BITS_PER_WIDE_INT) + return zext_hwi (this->get_val ()[0], precision); + else + return this->get_val ()[0]; +} + +/* Return THIS as an signed HOST_WIDE_INT, in its natural precision. */ +template +inline unsigned HOST_WIDE_INT +generic_wide_int ::to_uhwi () const +{ + return to_uhwi (this->get_precision ()); +} + +/* TODO: The compiler is half converted from using HOST_WIDE_INT to + represent addresses to using offset_int to represent addresses. + We use to_short_addr at the interface from new code to old, + unconverted code. */ +template +inline HOST_WIDE_INT +generic_wide_int ::to_short_addr () const +{ + return this->get_val ()[0]; +} + +/* Return the implicit value of blocks above get_len (). */ +template +inline HOST_WIDE_INT +generic_wide_int ::sign_mask () const +{ + unsigned int len = this->get_len (); + unsigned HOST_WIDE_INT high = this->get_val ()[len - 1]; + if (!is_sign_extended) + { + unsigned int precision = this->get_precision (); + int excess = len * HOST_BITS_PER_WIDE_INT - precision; + if (excess > 0) + high <<= excess; + } + return (HOST_WIDE_INT) (high) < 0 ? -1 : 0; +} + +/* Return the signed value of the least-significant explicitly-encoded + block. */ +template +inline HOST_WIDE_INT +generic_wide_int ::slow () const +{ + return this->get_val ()[0]; +} + +/* Return the signed value of the most-significant explicitly-encoded + block. */ +template +inline HOST_WIDE_INT +generic_wide_int ::shigh () const +{ + return this->get_val ()[this->get_len () - 1]; +} + +/* Return the unsigned value of the least-significant + explicitly-encoded block. */ +template +inline unsigned HOST_WIDE_INT +generic_wide_int ::ulow () const +{ + return this->get_val ()[0]; +} + +/* Return the unsigned value of the most-significant + explicitly-encoded block. */ +template +inline unsigned HOST_WIDE_INT +generic_wide_int ::uhigh () const +{ + return this->get_val ()[this->get_len () - 1]; +} + +/* Return block I, which might be implicitly or explicit encoded. */ +template +inline HOST_WIDE_INT +generic_wide_int ::elt (unsigned int i) const +{ + if (i >= this->get_len ()) + return sign_mask (); + else + return this->get_val ()[i]; +} + +template +template +inline generic_wide_int & +generic_wide_int ::operator = (const T &x) +{ + storage::operator = (x); + return *this; +} + +/* Dump the contents of the integer to stderr, for debugging. */ +template +void +generic_wide_int ::dump () const +{ + unsigned int len = this->get_len (); + const HOST_WIDE_INT *val = this->get_val (); + unsigned int precision = this->get_precision (); + fprintf (stderr, "["); + if (len * HOST_BITS_PER_WIDE_INT < precision) + fprintf (stderr, "...,"); + for (unsigned int i = 0; i < len - 1; ++i) + fprintf (stderr, HOST_WIDE_INT_PRINT_HEX ",", val[len - 1 - i]); + fprintf (stderr, HOST_WIDE_INT_PRINT_HEX "], precision = %d\n", + val[0], precision); +} + +namespace wi +{ + template + struct int_traits < generic_wide_int > + : public wi::int_traits + { + static unsigned int get_precision (const generic_wide_int &); + static wi::storage_ref decompose (HOST_WIDE_INT *, unsigned int, + const generic_wide_int &); + }; +} + +template +inline unsigned int +wi::int_traits < generic_wide_int >:: +get_precision (const generic_wide_int &x) +{ + return x.get_precision (); +} + +template +inline wi::storage_ref +wi::int_traits < generic_wide_int >:: +decompose (HOST_WIDE_INT *, unsigned int precision, + const generic_wide_int &x) +{ + gcc_checking_assert (precision == x.get_precision ()); + return wi::storage_ref (x.get_val (), x.get_len (), precision); +} + +/* Provide the storage for a wide_int_ref. This acts like a read-only + wide_int, with the optimization that VAL is normally a pointer to + another integer's storage, so that no array copy is needed. */ +template +struct wide_int_ref_storage : public wi::storage_ref +{ +private: + /* Scratch space that can be used when decomposing the original integer. + It must live as long as this object. */ + HOST_WIDE_INT scratch[2]; + +public: + wide_int_ref_storage (const wi::storage_ref &); + + template + wide_int_ref_storage (const T &); + + template + wide_int_ref_storage (const T &, unsigned int); +}; + +/* Create a reference from an existing reference. */ +template +inline wide_int_ref_storage :: +wide_int_ref_storage (const wi::storage_ref &x) + : storage_ref (x) +{} + +/* Create a reference to integer X in its natural precision. Note + that the natural precision is host-dependent for primitive + types. */ +template +template +inline wide_int_ref_storage ::wide_int_ref_storage (const T &x) + : storage_ref (wi::int_traits ::decompose (scratch, + wi::get_precision (x), x)) +{ +} + +/* Create a reference to integer X in precision PRECISION. */ +template +template +inline wide_int_ref_storage ::wide_int_ref_storage (const T &x, + unsigned int precision) + : storage_ref (wi::int_traits ::decompose (scratch, precision, x)) +{ +} + +namespace wi +{ + template + struct int_traits > + { + static const enum precision_type precision_type = VAR_PRECISION; + /* wi::storage_ref can be a reference to a primitive type, + so this is the conservatively-correct setting. */ + static const bool host_dependent_precision = true; + static const bool is_sign_extended = SE; + }; +} + +namespace wi +{ + unsigned int force_to_size (HOST_WIDE_INT *, const HOST_WIDE_INT *, + unsigned int, unsigned int, unsigned int, + signop sgn); + unsigned int from_array (HOST_WIDE_INT *, const HOST_WIDE_INT *, + unsigned int, unsigned int, bool = true); +} + +/* The storage used by wide_int. */ +class GTY(()) wide_int_storage +{ +private: + HOST_WIDE_INT val[WIDE_INT_MAX_ELTS]; + unsigned int len; + unsigned int precision; + +public: + wide_int_storage (); + template + wide_int_storage (const T &); + + /* The standard generic_wide_int storage methods. */ + unsigned int get_precision () const; + const HOST_WIDE_INT *get_val () const; + unsigned int get_len () const; + HOST_WIDE_INT *write_val (); + void set_len (unsigned int, bool = false); + + template + wide_int_storage &operator = (const T &); + + static wide_int from (const wide_int_ref &, unsigned int, signop); + static wide_int from_array (const HOST_WIDE_INT *, unsigned int, + unsigned int, bool = true); + static wide_int create (unsigned int); + + /* FIXME: target-dependent, so should disappear. */ + wide_int bswap () const; +}; + +namespace wi +{ + template <> + struct int_traits + { + static const enum precision_type precision_type = VAR_PRECISION; + /* Guaranteed by a static assert in the wide_int_storage constructor. */ + static const bool host_dependent_precision = false; + static const bool is_sign_extended = true; + template + static wide_int get_binary_result (const T1 &, const T2 &); + }; +} + +inline wide_int_storage::wide_int_storage () {} + +/* Initialize the storage from integer X, in its natural precision. + Note that we do not allow integers with host-dependent precision + to become wide_ints; wide_ints must always be logically independent + of the host. */ +template +inline wide_int_storage::wide_int_storage (const T &x) +{ + { STATIC_ASSERT (!wi::int_traits::host_dependent_precision); } + { STATIC_ASSERT (wi::int_traits::precision_type != wi::CONST_PRECISION); } + WIDE_INT_REF_FOR (T) xi (x); + precision = xi.precision; + wi::copy (*this, xi); +} + +template +inline wide_int_storage& +wide_int_storage::operator = (const T &x) +{ + { STATIC_ASSERT (!wi::int_traits::host_dependent_precision); } + { STATIC_ASSERT (wi::int_traits::precision_type != wi::CONST_PRECISION); } + WIDE_INT_REF_FOR (T) xi (x); + precision = xi.precision; + wi::copy (*this, xi); + return *this; +} + +inline unsigned int +wide_int_storage::get_precision () const +{ + return precision; +} + +inline const HOST_WIDE_INT * +wide_int_storage::get_val () const +{ + return val; +} + +inline unsigned int +wide_int_storage::get_len () const +{ + return len; +} + +inline HOST_WIDE_INT * +wide_int_storage::write_val () +{ + return val; +} + +inline void +wide_int_storage::set_len (unsigned int l, bool is_sign_extended) +{ + len = l; + if (!is_sign_extended && len * HOST_BITS_PER_WIDE_INT > precision) + val[len - 1] = sext_hwi (val[len - 1], + precision % HOST_BITS_PER_WIDE_INT); +} + +/* Treat X as having signedness SGN and convert it to a PRECISION-bit + number. */ +inline wide_int +wide_int_storage::from (const wide_int_ref &x, unsigned int precision, + signop sgn) +{ + wide_int result = wide_int::create (precision); + result.set_len (wi::force_to_size (result.write_val (), x.val, x.len, + x.precision, precision, sgn)); + return result; +} + +/* Create a wide_int from the explicit block encoding given by VAL and + LEN. PRECISION is the precision of the integer. NEED_CANON_P is + true if the encoding may have redundant trailing blocks. */ +inline wide_int +wide_int_storage::from_array (const HOST_WIDE_INT *val, unsigned int len, + unsigned int precision, bool need_canon_p) +{ + wide_int result = wide_int::create (precision); + result.set_len (wi::from_array (result.write_val (), val, len, precision, + need_canon_p)); + return result; +} + +/* Return an uninitialized wide_int with precision PRECISION. */ +inline wide_int +wide_int_storage::create (unsigned int precision) +{ + wide_int x; + x.precision = precision; + return x; +} + +template +inline wide_int +wi::int_traits ::get_binary_result (const T1 &x, const T2 &y) +{ + /* This shouldn't be used for two flexible-precision inputs. */ + STATIC_ASSERT (wi::int_traits ::precision_type != FLEXIBLE_PRECISION + || wi::int_traits ::precision_type != FLEXIBLE_PRECISION); + if (wi::int_traits ::precision_type == FLEXIBLE_PRECISION) + return wide_int::create (wi::get_precision (y)); + else + return wide_int::create (wi::get_precision (x)); +} + +/* The storage used by FIXED_WIDE_INT (N). */ +template +class GTY(()) fixed_wide_int_storage +{ +private: + HOST_WIDE_INT val[(N + HOST_BITS_PER_WIDE_INT + 1) / HOST_BITS_PER_WIDE_INT]; + unsigned int len; + +public: + fixed_wide_int_storage (); + template + fixed_wide_int_storage (const T &); + + /* The standard generic_wide_int storage methods. */ + unsigned int get_precision () const; + const HOST_WIDE_INT *get_val () const; + unsigned int get_len () const; + HOST_WIDE_INT *write_val (); + void set_len (unsigned int, bool = false); + + static FIXED_WIDE_INT (N) from (const wide_int_ref &, signop); + static FIXED_WIDE_INT (N) from_array (const HOST_WIDE_INT *, unsigned int, + bool = true); +}; + +namespace wi +{ + template + struct int_traits < fixed_wide_int_storage > + { + static const enum precision_type precision_type = CONST_PRECISION; + static const bool host_dependent_precision = false; + static const bool is_sign_extended = true; + static const unsigned int precision = N; + template + static FIXED_WIDE_INT (N) get_binary_result (const T1 &, const T2 &); + }; +} + +template +inline fixed_wide_int_storage ::fixed_wide_int_storage () {} + +/* Initialize the storage from integer X, in precision N. */ +template +template +inline fixed_wide_int_storage ::fixed_wide_int_storage (const T &x) +{ + /* Check for type compatibility. We don't want to initialize a + fixed-width integer from something like a wide_int. */ + WI_BINARY_RESULT (T, FIXED_WIDE_INT (N)) *assertion ATTRIBUTE_UNUSED; + wi::copy (*this, WIDE_INT_REF_FOR (T) (x, N)); +} + +template +inline unsigned int +fixed_wide_int_storage ::get_precision () const +{ + return N; +} + +template +inline const HOST_WIDE_INT * +fixed_wide_int_storage ::get_val () const +{ + return val; +} + +template +inline unsigned int +fixed_wide_int_storage ::get_len () const +{ + return len; +} + +template +inline HOST_WIDE_INT * +fixed_wide_int_storage ::write_val () +{ + return val; +} + +template +inline void +fixed_wide_int_storage ::set_len (unsigned int l, bool) +{ + len = l; + /* There are no excess bits in val[len - 1]. */ + STATIC_ASSERT (N % HOST_BITS_PER_WIDE_INT == 0); +} + +/* Treat X as having signedness SGN and convert it to an N-bit number. */ +template +inline FIXED_WIDE_INT (N) +fixed_wide_int_storage ::from (const wide_int_ref &x, signop sgn) +{ + FIXED_WIDE_INT (N) result; + result.set_len (wi::force_to_size (result.write_val (), x.val, x.len, + x.precision, N, sgn)); + return result; +} + +/* Create a FIXED_WIDE_INT (N) from the explicit block encoding given by + VAL and LEN. NEED_CANON_P is true if the encoding may have redundant + trailing blocks. */ +template +inline FIXED_WIDE_INT (N) +fixed_wide_int_storage ::from_array (const HOST_WIDE_INT *val, + unsigned int len, + bool need_canon_p) +{ + FIXED_WIDE_INT (N) result; + result.set_len (wi::from_array (result.write_val (), val, len, + N, need_canon_p)); + return result; +} + +template +template +inline FIXED_WIDE_INT (N) +wi::int_traits < fixed_wide_int_storage >:: +get_binary_result (const T1 &, const T2 &) +{ + return FIXED_WIDE_INT (N) (); +} + +/* A reference to one element of a trailing_wide_ints structure. */ +class trailing_wide_int_storage +{ +private: + /* The precision of the integer, which is a fixed property of the + parent trailing_wide_ints. */ + unsigned int m_precision; + + /* A pointer to the length field. */ + unsigned char *m_len; + + /* A pointer to the HWI array. There are enough elements to hold all + values of precision M_PRECISION. */ + HOST_WIDE_INT *m_val; + +public: + trailing_wide_int_storage (unsigned int, unsigned char *, HOST_WIDE_INT *); + + /* The standard generic_wide_int storage methods. */ + unsigned int get_len () const; + unsigned int get_precision () const; + const HOST_WIDE_INT *get_val () const; + HOST_WIDE_INT *write_val (); + void set_len (unsigned int, bool = false); + + template + trailing_wide_int_storage &operator = (const T &); +}; + +typedef generic_wide_int trailing_wide_int; + +/* trailing_wide_int behaves like a wide_int. */ +namespace wi +{ + template <> + struct int_traits + : public int_traits {}; +} + +/* An array of N wide_int-like objects that can be put at the end of + a variable-sized structure. Use extra_size to calculate how many + bytes beyond the sizeof need to be allocated. Use set_precision + to initialize the structure. */ +template +class GTY(()) trailing_wide_ints +{ +private: + /* The shared precision of each number. */ + unsigned short m_precision; + + /* The shared maximum length of each number. */ + unsigned char m_max_len; + + /* The current length of each number. */ + unsigned char m_len[N]; + + /* The variable-length part of the structure, which always contains + at least one HWI. Element I starts at index I * M_MAX_LEN. */ + HOST_WIDE_INT m_val[1]; + +public: + void set_precision (unsigned int); + trailing_wide_int operator [] (unsigned int); + static size_t extra_size (unsigned int); +}; + +inline trailing_wide_int_storage:: +trailing_wide_int_storage (unsigned int precision, unsigned char *len, + HOST_WIDE_INT *val) + : m_precision (precision), m_len (len), m_val (val) +{ +} + +inline unsigned int +trailing_wide_int_storage::get_len () const +{ + return *m_len; +} + +inline unsigned int +trailing_wide_int_storage::get_precision () const +{ + return m_precision; +} + +inline const HOST_WIDE_INT * +trailing_wide_int_storage::get_val () const +{ + return m_val; +} + +inline HOST_WIDE_INT * +trailing_wide_int_storage::write_val () +{ + return m_val; +} + +inline void +trailing_wide_int_storage::set_len (unsigned int len, bool is_sign_extended) +{ + *m_len = len; + if (!is_sign_extended && len * HOST_BITS_PER_WIDE_INT > m_precision) + m_val[len - 1] = sext_hwi (m_val[len - 1], + m_precision % HOST_BITS_PER_WIDE_INT); +} + +template +inline trailing_wide_int_storage & +trailing_wide_int_storage::operator = (const T &x) +{ + WIDE_INT_REF_FOR (T) xi (x, m_precision); + wi::copy (*this, xi); + return *this; +} + +/* Initialize the structure and record that all elements have precision + PRECISION. */ +template +inline void +trailing_wide_ints ::set_precision (unsigned int precision) +{ + m_precision = precision; + m_max_len = ((precision + HOST_BITS_PER_WIDE_INT - 1) + / HOST_BITS_PER_WIDE_INT); +} + +/* Return a reference to element INDEX. */ +template +inline trailing_wide_int +trailing_wide_ints ::operator [] (unsigned int index) +{ + return trailing_wide_int_storage (m_precision, &m_len[index], + &m_val[index * m_max_len]); +} + +/* Return how many extra bytes need to be added to the end of the structure + in order to handle N wide_ints of precision PRECISION. */ +template +inline size_t +trailing_wide_ints ::extra_size (unsigned int precision) +{ + unsigned int max_len = ((precision + HOST_BITS_PER_WIDE_INT - 1) + / HOST_BITS_PER_WIDE_INT); + return (N * max_len - 1) * sizeof (HOST_WIDE_INT); +} + +/* This macro is used in structures that end with a trailing_wide_ints field + called FIELD. It declares get_NAME() and set_NAME() methods to access + element I of FIELD. */ +#define TRAILING_WIDE_INT_ACCESSOR(NAME, FIELD, I) \ + trailing_wide_int get_##NAME () { return FIELD[I]; } \ + template void set_##NAME (const T &x) { FIELD[I] = x; } + +namespace wi +{ + /* Implementation of int_traits for primitive integer types like "int". */ + template + struct primitive_int_traits + { + static const enum precision_type precision_type = FLEXIBLE_PRECISION; + static const bool host_dependent_precision = true; + static const bool is_sign_extended = true; + static unsigned int get_precision (T); + static wi::storage_ref decompose (HOST_WIDE_INT *, unsigned int, T); + }; +} + +template +inline unsigned int +wi::primitive_int_traits ::get_precision (T) +{ + return sizeof (T) * CHAR_BIT; +} + +template +inline wi::storage_ref +wi::primitive_int_traits ::decompose (HOST_WIDE_INT *scratch, + unsigned int precision, T x) +{ + scratch[0] = x; + if (signed_p || scratch[0] >= 0 || precision <= HOST_BITS_PER_WIDE_INT) + return wi::storage_ref (scratch, 1, precision); + scratch[1] = 0; + return wi::storage_ref (scratch, 2, precision); +} + +/* Allow primitive C types to be used in wi:: routines. */ +namespace wi +{ + template <> + struct int_traits + : public primitive_int_traits {}; + + template <> + struct int_traits + : public primitive_int_traits {}; + + template <> + struct int_traits + : public primitive_int_traits {}; + + template <> + struct int_traits + : public primitive_int_traits {}; + +#if defined HAVE_LONG_LONG + template <> + struct int_traits + : public primitive_int_traits {}; + + template <> + struct int_traits + : public primitive_int_traits {}; +#endif +} + +namespace wi +{ + /* Stores HWI-sized integer VAL, treating it as having signedness SGN + and precision PRECISION. */ + struct hwi_with_prec + { + hwi_with_prec (HOST_WIDE_INT, unsigned int, signop); + HOST_WIDE_INT val; + unsigned int precision; + signop sgn; + }; + + hwi_with_prec shwi (HOST_WIDE_INT, unsigned int); + hwi_with_prec uhwi (unsigned HOST_WIDE_INT, unsigned int); + + hwi_with_prec minus_one (unsigned int); + hwi_with_prec zero (unsigned int); + hwi_with_prec one (unsigned int); + hwi_with_prec two (unsigned int); +} + +inline wi::hwi_with_prec::hwi_with_prec (HOST_WIDE_INT v, unsigned int p, + signop s) + : val (v), precision (p), sgn (s) +{ +} + +/* Return a signed integer that has value VAL and precision PRECISION. */ +inline wi::hwi_with_prec +wi::shwi (HOST_WIDE_INT val, unsigned int precision) +{ + return hwi_with_prec (val, precision, SIGNED); +} + +/* Return an unsigned integer that has value VAL and precision PRECISION. */ +inline wi::hwi_with_prec +wi::uhwi (unsigned HOST_WIDE_INT val, unsigned int precision) +{ + return hwi_with_prec (val, precision, UNSIGNED); +} + +/* Return a wide int of -1 with precision PRECISION. */ +inline wi::hwi_with_prec +wi::minus_one (unsigned int precision) +{ + return wi::shwi (-1, precision); +} + +/* Return a wide int of 0 with precision PRECISION. */ +inline wi::hwi_with_prec +wi::zero (unsigned int precision) +{ + return wi::shwi (0, precision); +} + +/* Return a wide int of 1 with precision PRECISION. */ +inline wi::hwi_with_prec +wi::one (unsigned int precision) +{ + return wi::shwi (1, precision); +} + +/* Return a wide int of 2 with precision PRECISION. */ +inline wi::hwi_with_prec +wi::two (unsigned int precision) +{ + return wi::shwi (2, precision); +} + +namespace wi +{ + template <> + struct int_traits + { + static const enum precision_type precision_type = VAR_PRECISION; + /* hwi_with_prec has an explicitly-given precision, rather than the + precision of HOST_WIDE_INT. */ + static const bool host_dependent_precision = false; + static const bool is_sign_extended = true; + static unsigned int get_precision (const wi::hwi_with_prec &); + static wi::storage_ref decompose (HOST_WIDE_INT *, unsigned int, + const wi::hwi_with_prec &); + }; +} + +inline unsigned int +wi::int_traits ::get_precision (const wi::hwi_with_prec &x) +{ + return x.precision; +} + +inline wi::storage_ref +wi::int_traits :: +decompose (HOST_WIDE_INT *scratch, unsigned int precision, + const wi::hwi_with_prec &x) +{ + gcc_checking_assert (precision == x.precision); + scratch[0] = x.val; + if (x.sgn == SIGNED || x.val >= 0 || precision <= HOST_BITS_PER_WIDE_INT) + return wi::storage_ref (scratch, 1, precision); + scratch[1] = 0; + return wi::storage_ref (scratch, 2, precision); +} + +/* Private functions for handling large cases out of line. They take + individual length and array parameters because that is cheaper for + the inline caller than constructing an object on the stack and + passing a reference to it. (Although many callers use wide_int_refs, + we generally want those to be removed by SRA.) */ +namespace wi +{ + bool eq_p_large (const HOST_WIDE_INT *, unsigned int, + const HOST_WIDE_INT *, unsigned int, unsigned int); + bool lts_p_large (const HOST_WIDE_INT *, unsigned int, unsigned int, + const HOST_WIDE_INT *, unsigned int); + bool ltu_p_large (const HOST_WIDE_INT *, unsigned int, unsigned int, + const HOST_WIDE_INT *, unsigned int); + int cmps_large (const HOST_WIDE_INT *, unsigned int, unsigned int, + const HOST_WIDE_INT *, unsigned int); + int cmpu_large (const HOST_WIDE_INT *, unsigned int, unsigned int, + const HOST_WIDE_INT *, unsigned int); + unsigned int sext_large (HOST_WIDE_INT *, const HOST_WIDE_INT *, + unsigned int, + unsigned int, unsigned int); + unsigned int zext_large (HOST_WIDE_INT *, const HOST_WIDE_INT *, + unsigned int, + unsigned int, unsigned int); + unsigned int set_bit_large (HOST_WIDE_INT *, const HOST_WIDE_INT *, + unsigned int, unsigned int, unsigned int); + unsigned int lshift_large (HOST_WIDE_INT *, const HOST_WIDE_INT *, + unsigned int, unsigned int, unsigned int); + unsigned int lrshift_large (HOST_WIDE_INT *, const HOST_WIDE_INT *, + unsigned int, unsigned int, unsigned int, + unsigned int); + unsigned int arshift_large (HOST_WIDE_INT *, const HOST_WIDE_INT *, + unsigned int, unsigned int, unsigned int, + unsigned int); + unsigned int and_large (HOST_WIDE_INT *, const HOST_WIDE_INT *, unsigned int, + const HOST_WIDE_INT *, unsigned int, unsigned int); + unsigned int and_not_large (HOST_WIDE_INT *, const HOST_WIDE_INT *, + unsigned int, const HOST_WIDE_INT *, + unsigned int, unsigned int); + unsigned int or_large (HOST_WIDE_INT *, const HOST_WIDE_INT *, unsigned int, + const HOST_WIDE_INT *, unsigned int, unsigned int); + unsigned int or_not_large (HOST_WIDE_INT *, const HOST_WIDE_INT *, + unsigned int, const HOST_WIDE_INT *, + unsigned int, unsigned int); + unsigned int xor_large (HOST_WIDE_INT *, const HOST_WIDE_INT *, unsigned int, + const HOST_WIDE_INT *, unsigned int, unsigned int); + unsigned int add_large (HOST_WIDE_INT *, const HOST_WIDE_INT *, unsigned int, + const HOST_WIDE_INT *, unsigned int, unsigned int, + signop, bool *); + unsigned int sub_large (HOST_WIDE_INT *, const HOST_WIDE_INT *, unsigned int, + const HOST_WIDE_INT *, unsigned int, unsigned int, + signop, bool *); + unsigned int mul_internal (HOST_WIDE_INT *, const HOST_WIDE_INT *, + unsigned int, const HOST_WIDE_INT *, + unsigned int, unsigned int, signop, bool *, + bool); + unsigned int divmod_internal (HOST_WIDE_INT *, unsigned int *, + HOST_WIDE_INT *, const HOST_WIDE_INT *, + unsigned int, unsigned int, + const HOST_WIDE_INT *, + unsigned int, unsigned int, + signop, bool *); +} + +/* Return the number of bits that integer X can hold. */ +template +inline unsigned int +wi::get_precision (const T &x) +{ + return wi::int_traits ::get_precision (x); +} + +/* Return the number of bits that the result of a binary operation can + hold when the input operands are X and Y. */ +template +inline unsigned int +wi::get_binary_precision (const T1 &x, const T2 &y) +{ + return get_precision (wi::int_traits :: + get_binary_result (x, y)); +} + +/* Copy the contents of Y to X, but keeping X's current precision. */ +template +inline void +wi::copy (T1 &x, const T2 &y) +{ + HOST_WIDE_INT *xval = x.write_val (); + const HOST_WIDE_INT *yval = y.get_val (); + unsigned int len = y.get_len (); + unsigned int i = 0; + do + xval[i] = yval[i]; + while (++i < len); + x.set_len (len, y.is_sign_extended); +} + +/* Return true if X fits in a HOST_WIDE_INT with no loss of precision. */ +template +inline bool +wi::fits_shwi_p (const T &x) +{ + WIDE_INT_REF_FOR (T) xi (x); + return xi.len == 1; +} + +/* Return true if X fits in an unsigned HOST_WIDE_INT with no loss of + precision. */ +template +inline bool +wi::fits_uhwi_p (const T &x) +{ + WIDE_INT_REF_FOR (T) xi (x); + if (xi.precision <= HOST_BITS_PER_WIDE_INT) + return true; + if (xi.len == 1) + return xi.slow () >= 0; + return xi.len == 2 && xi.uhigh () == 0; +} + +/* Return true if X is negative based on the interpretation of SGN. + For UNSIGNED, this is always false. */ +template +inline bool +wi::neg_p (const T &x, signop sgn) +{ + WIDE_INT_REF_FOR (T) xi (x); + if (sgn == UNSIGNED) + return false; + return xi.sign_mask () < 0; +} + +/* Return -1 if the top bit of X is set and 0 if the top bit is clear. */ +template +inline HOST_WIDE_INT +wi::sign_mask (const T &x) +{ + WIDE_INT_REF_FOR (T) xi (x); + return xi.sign_mask (); +} + +/* Return true if X == Y. X and Y must be binary-compatible. */ +template +inline bool +wi::eq_p (const T1 &x, const T2 &y) +{ + unsigned int precision = get_binary_precision (x, y); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y, precision); + if (xi.is_sign_extended && yi.is_sign_extended) + { + /* This case reduces to array equality. */ + if (xi.len != yi.len) + return false; + unsigned int i = 0; + do + if (xi.val[i] != yi.val[i]) + return false; + while (++i != xi.len); + return true; + } + if (__builtin_expect (yi.len == 1, true)) + { + /* XI is only equal to YI if it too has a single HWI. */ + if (xi.len != 1) + return false; + /* Excess bits in xi.val[0] will be signs or zeros, so comparisons + with 0 are simple. */ + if (STATIC_CONSTANT_P (yi.val[0] == 0)) + return xi.val[0] == 0; + /* Otherwise flush out any excess bits first. */ + unsigned HOST_WIDE_INT diff = xi.val[0] ^ yi.val[0]; + int excess = HOST_BITS_PER_WIDE_INT - precision; + if (excess > 0) + diff <<= excess; + return diff == 0; + } + return eq_p_large (xi.val, xi.len, yi.val, yi.len, precision); +} + +/* Return true if X != Y. X and Y must be binary-compatible. */ +template +inline bool +wi::ne_p (const T1 &x, const T2 &y) +{ + return !eq_p (x, y); +} + +/* Return true if X < Y when both are treated as signed values. */ +template +inline bool +wi::lts_p (const T1 &x, const T2 &y) +{ + unsigned int precision = get_binary_precision (x, y); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y, precision); + /* We optimize x < y, where y is 64 or fewer bits. */ + if (wi::fits_shwi_p (yi)) + { + /* Make lts_p (x, 0) as efficient as wi::neg_p (x). */ + if (STATIC_CONSTANT_P (yi.val[0] == 0)) + return neg_p (xi); + /* If x fits directly into a shwi, we can compare directly. */ + if (wi::fits_shwi_p (xi)) + return xi.to_shwi () < yi.to_shwi (); + /* If x doesn't fit and is negative, then it must be more + negative than any value in y, and hence smaller than y. */ + if (neg_p (xi)) + return true; + /* If x is positive, then it must be larger than any value in y, + and hence greater than y. */ + return false; + } + /* Optimize the opposite case, if it can be detected at compile time. */ + if (STATIC_CONSTANT_P (xi.len == 1)) + /* If YI is negative it is lower than the least HWI. + If YI is positive it is greater than the greatest HWI. */ + return !neg_p (yi); + return lts_p_large (xi.val, xi.len, precision, yi.val, yi.len); +} + +/* Return true if X < Y when both are treated as unsigned values. */ +template +inline bool +wi::ltu_p (const T1 &x, const T2 &y) +{ + unsigned int precision = get_binary_precision (x, y); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y, precision); + /* Optimize comparisons with constants. */ + if (STATIC_CONSTANT_P (yi.len == 1 && yi.val[0] >= 0)) + return xi.len == 1 && xi.to_uhwi () < (unsigned HOST_WIDE_INT) yi.val[0]; + if (STATIC_CONSTANT_P (xi.len == 1 && xi.val[0] >= 0)) + return yi.len != 1 || yi.to_uhwi () > (unsigned HOST_WIDE_INT) xi.val[0]; + /* Optimize the case of two HWIs. The HWIs are implicitly sign-extended + for precisions greater than HOST_BITS_WIDE_INT, but sign-extending both + values does not change the result. */ + if (__builtin_expect (xi.len + yi.len == 2, true)) + { + unsigned HOST_WIDE_INT xl = xi.to_uhwi (); + unsigned HOST_WIDE_INT yl = yi.to_uhwi (); + return xl < yl; + } + return ltu_p_large (xi.val, xi.len, precision, yi.val, yi.len); +} + +/* Return true if X < Y. Signedness of X and Y is indicated by SGN. */ +template +inline bool +wi::lt_p (const T1 &x, const T2 &y, signop sgn) +{ + if (sgn == SIGNED) + return lts_p (x, y); + else + return ltu_p (x, y); +} + +/* Return true if X <= Y when both are treated as signed values. */ +template +inline bool +wi::les_p (const T1 &x, const T2 &y) +{ + return !lts_p (y, x); +} + +/* Return true if X <= Y when both are treated as unsigned values. */ +template +inline bool +wi::leu_p (const T1 &x, const T2 &y) +{ + return !ltu_p (y, x); +} + +/* Return true if X <= Y. Signedness of X and Y is indicated by SGN. */ +template +inline bool +wi::le_p (const T1 &x, const T2 &y, signop sgn) +{ + if (sgn == SIGNED) + return les_p (x, y); + else + return leu_p (x, y); +} + +/* Return true if X > Y when both are treated as signed values. */ +template +inline bool +wi::gts_p (const T1 &x, const T2 &y) +{ + return lts_p (y, x); +} + +/* Return true if X > Y when both are treated as unsigned values. */ +template +inline bool +wi::gtu_p (const T1 &x, const T2 &y) +{ + return ltu_p (y, x); +} + +/* Return true if X > Y. Signedness of X and Y is indicated by SGN. */ +template +inline bool +wi::gt_p (const T1 &x, const T2 &y, signop sgn) +{ + if (sgn == SIGNED) + return gts_p (x, y); + else + return gtu_p (x, y); +} + +/* Return true if X >= Y when both are treated as signed values. */ +template +inline bool +wi::ges_p (const T1 &x, const T2 &y) +{ + return !lts_p (x, y); +} + +/* Return true if X >= Y when both are treated as unsigned values. */ +template +inline bool +wi::geu_p (const T1 &x, const T2 &y) +{ + return !ltu_p (x, y); +} + +/* Return true if X >= Y. Signedness of X and Y is indicated by SGN. */ +template +inline bool +wi::ge_p (const T1 &x, const T2 &y, signop sgn) +{ + if (sgn == SIGNED) + return ges_p (x, y); + else + return geu_p (x, y); +} + +/* Return -1 if X < Y, 0 if X == Y and 1 if X > Y. Treat both X and Y + as signed values. */ +template +inline int +wi::cmps (const T1 &x, const T2 &y) +{ + unsigned int precision = get_binary_precision (x, y); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y, precision); + if (wi::fits_shwi_p (yi)) + { + /* Special case for comparisons with 0. */ + if (STATIC_CONSTANT_P (yi.val[0] == 0)) + return neg_p (xi) ? -1 : !(xi.len == 1 && xi.val[0] == 0); + /* If x fits into a signed HWI, we can compare directly. */ + if (wi::fits_shwi_p (xi)) + { + HOST_WIDE_INT xl = xi.to_shwi (); + HOST_WIDE_INT yl = yi.to_shwi (); + return xl < yl ? -1 : xl > yl; + } + /* If x doesn't fit and is negative, then it must be more + negative than any signed HWI, and hence smaller than y. */ + if (neg_p (xi)) + return -1; + /* If x is positive, then it must be larger than any signed HWI, + and hence greater than y. */ + return 1; + } + /* Optimize the opposite case, if it can be detected at compile time. */ + if (STATIC_CONSTANT_P (xi.len == 1)) + /* If YI is negative it is lower than the least HWI. + If YI is positive it is greater than the greatest HWI. */ + return neg_p (yi) ? 1 : -1; + return cmps_large (xi.val, xi.len, precision, yi.val, yi.len); +} + +/* Return -1 if X < Y, 0 if X == Y and 1 if X > Y. Treat both X and Y + as unsigned values. */ +template +inline int +wi::cmpu (const T1 &x, const T2 &y) +{ + unsigned int precision = get_binary_precision (x, y); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y, precision); + /* Optimize comparisons with constants. */ + if (STATIC_CONSTANT_P (yi.len == 1 && yi.val[0] >= 0)) + { + /* If XI doesn't fit in a HWI then it must be larger than YI. */ + if (xi.len != 1) + return 1; + /* Otherwise compare directly. */ + unsigned HOST_WIDE_INT xl = xi.to_uhwi (); + unsigned HOST_WIDE_INT yl = yi.val[0]; + return xl < yl ? -1 : xl > yl; + } + if (STATIC_CONSTANT_P (xi.len == 1 && xi.val[0] >= 0)) + { + /* If YI doesn't fit in a HWI then it must be larger than XI. */ + if (yi.len != 1) + return -1; + /* Otherwise compare directly. */ + unsigned HOST_WIDE_INT xl = xi.val[0]; + unsigned HOST_WIDE_INT yl = yi.to_uhwi (); + return xl < yl ? -1 : xl > yl; + } + /* Optimize the case of two HWIs. The HWIs are implicitly sign-extended + for precisions greater than HOST_BITS_WIDE_INT, but sign-extending both + values does not change the result. */ + if (__builtin_expect (xi.len + yi.len == 2, true)) + { + unsigned HOST_WIDE_INT xl = xi.to_uhwi (); + unsigned HOST_WIDE_INT yl = yi.to_uhwi (); + return xl < yl ? -1 : xl > yl; + } + return cmpu_large (xi.val, xi.len, precision, yi.val, yi.len); +} + +/* Return -1 if X < Y, 0 if X == Y and 1 if X > Y. Signedness of + X and Y indicated by SGN. */ +template +inline int +wi::cmp (const T1 &x, const T2 &y, signop sgn) +{ + if (sgn == SIGNED) + return cmps (x, y); + else + return cmpu (x, y); +} + +/* Return ~x. */ +template +inline WI_UNARY_RESULT (T) +wi::bit_not (const T &x) +{ + WI_UNARY_RESULT_VAR (result, val, T, x); + WIDE_INT_REF_FOR (T) xi (x, get_precision (result)); + for (unsigned int i = 0; i < xi.len; ++i) + val[i] = ~xi.val[i]; + result.set_len (xi.len); + return result; +} + +/* Return -x. */ +template +inline WI_UNARY_RESULT (T) +wi::neg (const T &x) +{ + return sub (0, x); +} + +/* Return -x. Indicate in *OVERFLOW if X is the minimum signed value. */ +template +inline WI_UNARY_RESULT (T) +wi::neg (const T &x, bool *overflow) +{ + *overflow = only_sign_bit_p (x); + return sub (0, x); +} + +/* Return the absolute value of x. */ +template +inline WI_UNARY_RESULT (T) +wi::abs (const T &x) +{ + return neg_p (x) ? neg (x) : WI_UNARY_RESULT (T) (x); +} + +/* Return the result of sign-extending the low OFFSET bits of X. */ +template +inline WI_UNARY_RESULT (T) +wi::sext (const T &x, unsigned int offset) +{ + WI_UNARY_RESULT_VAR (result, val, T, x); + unsigned int precision = get_precision (result); + WIDE_INT_REF_FOR (T) xi (x, precision); + + if (offset <= HOST_BITS_PER_WIDE_INT) + { + val[0] = sext_hwi (xi.ulow (), offset); + result.set_len (1, true); + } + else + result.set_len (sext_large (val, xi.val, xi.len, precision, offset)); + return result; +} + +/* Return the result of zero-extending the low OFFSET bits of X. */ +template +inline WI_UNARY_RESULT (T) +wi::zext (const T &x, unsigned int offset) +{ + WI_UNARY_RESULT_VAR (result, val, T, x); + unsigned int precision = get_precision (result); + WIDE_INT_REF_FOR (T) xi (x, precision); + + /* This is not just an optimization, it is actually required to + maintain canonization. */ + if (offset >= precision) + { + wi::copy (result, xi); + return result; + } + + /* In these cases we know that at least the top bit will be clear, + so no sign extension is necessary. */ + if (offset < HOST_BITS_PER_WIDE_INT) + { + val[0] = zext_hwi (xi.ulow (), offset); + result.set_len (1, true); + } + else + result.set_len (zext_large (val, xi.val, xi.len, precision, offset), true); + return result; +} + +/* Return the result of extending the low OFFSET bits of X according to + signedness SGN. */ +template +inline WI_UNARY_RESULT (T) +wi::ext (const T &x, unsigned int offset, signop sgn) +{ + return sgn == SIGNED ? sext (x, offset) : zext (x, offset); +} + +/* Return an integer that represents X | (1 << bit). */ +template +inline WI_UNARY_RESULT (T) +wi::set_bit (const T &x, unsigned int bit) +{ + WI_UNARY_RESULT_VAR (result, val, T, x); + unsigned int precision = get_precision (result); + WIDE_INT_REF_FOR (T) xi (x, precision); + if (precision <= HOST_BITS_PER_WIDE_INT) + { + val[0] = xi.ulow () | (HOST_WIDE_INT_1U << bit); + result.set_len (1); + } + else + result.set_len (set_bit_large (val, xi.val, xi.len, precision, bit)); + return result; +} + +/* Return the mininum of X and Y, treating them both as having + signedness SGN. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::min (const T1 &x, const T2 &y, signop sgn) +{ + WI_BINARY_RESULT_VAR (result, val ATTRIBUTE_UNUSED, T1, x, T2, y); + unsigned int precision = get_precision (result); + if (wi::le_p (x, y, sgn)) + wi::copy (result, WIDE_INT_REF_FOR (T1) (x, precision)); + else + wi::copy (result, WIDE_INT_REF_FOR (T2) (y, precision)); + return result; +} + +/* Return the minimum of X and Y, treating both as signed values. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::smin (const T1 &x, const T2 &y) +{ + return wi::min (x, y, SIGNED); +} + +/* Return the minimum of X and Y, treating both as unsigned values. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::umin (const T1 &x, const T2 &y) +{ + return wi::min (x, y, UNSIGNED); +} + +/* Return the maxinum of X and Y, treating them both as having + signedness SGN. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::max (const T1 &x, const T2 &y, signop sgn) +{ + WI_BINARY_RESULT_VAR (result, val ATTRIBUTE_UNUSED, T1, x, T2, y); + unsigned int precision = get_precision (result); + if (wi::ge_p (x, y, sgn)) + wi::copy (result, WIDE_INT_REF_FOR (T1) (x, precision)); + else + wi::copy (result, WIDE_INT_REF_FOR (T2) (y, precision)); + return result; +} + +/* Return the maximum of X and Y, treating both as signed values. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::smax (const T1 &x, const T2 &y) +{ + return wi::max (x, y, SIGNED); +} + +/* Return the maximum of X and Y, treating both as unsigned values. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::umax (const T1 &x, const T2 &y) +{ + return wi::max (x, y, UNSIGNED); +} + +/* Return X & Y. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::bit_and (const T1 &x, const T2 &y) +{ + WI_BINARY_RESULT_VAR (result, val, T1, x, T2, y); + unsigned int precision = get_precision (result); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y, precision); + bool is_sign_extended = xi.is_sign_extended && yi.is_sign_extended; + if (__builtin_expect (xi.len + yi.len == 2, true)) + { + val[0] = xi.ulow () & yi.ulow (); + result.set_len (1, is_sign_extended); + } + else + result.set_len (and_large (val, xi.val, xi.len, yi.val, yi.len, + precision), is_sign_extended); + return result; +} + +/* Return X & ~Y. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::bit_and_not (const T1 &x, const T2 &y) +{ + WI_BINARY_RESULT_VAR (result, val, T1, x, T2, y); + unsigned int precision = get_precision (result); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y, precision); + bool is_sign_extended = xi.is_sign_extended && yi.is_sign_extended; + if (__builtin_expect (xi.len + yi.len == 2, true)) + { + val[0] = xi.ulow () & ~yi.ulow (); + result.set_len (1, is_sign_extended); + } + else + result.set_len (and_not_large (val, xi.val, xi.len, yi.val, yi.len, + precision), is_sign_extended); + return result; +} + +/* Return X | Y. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::bit_or (const T1 &x, const T2 &y) +{ + WI_BINARY_RESULT_VAR (result, val, T1, x, T2, y); + unsigned int precision = get_precision (result); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y, precision); + bool is_sign_extended = xi.is_sign_extended && yi.is_sign_extended; + if (__builtin_expect (xi.len + yi.len == 2, true)) + { + val[0] = xi.ulow () | yi.ulow (); + result.set_len (1, is_sign_extended); + } + else + result.set_len (or_large (val, xi.val, xi.len, + yi.val, yi.len, precision), is_sign_extended); + return result; +} + +/* Return X | ~Y. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::bit_or_not (const T1 &x, const T2 &y) +{ + WI_BINARY_RESULT_VAR (result, val, T1, x, T2, y); + unsigned int precision = get_precision (result); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y, precision); + bool is_sign_extended = xi.is_sign_extended && yi.is_sign_extended; + if (__builtin_expect (xi.len + yi.len == 2, true)) + { + val[0] = xi.ulow () | ~yi.ulow (); + result.set_len (1, is_sign_extended); + } + else + result.set_len (or_not_large (val, xi.val, xi.len, yi.val, yi.len, + precision), is_sign_extended); + return result; +} + +/* Return X ^ Y. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::bit_xor (const T1 &x, const T2 &y) +{ + WI_BINARY_RESULT_VAR (result, val, T1, x, T2, y); + unsigned int precision = get_precision (result); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y, precision); + bool is_sign_extended = xi.is_sign_extended && yi.is_sign_extended; + if (__builtin_expect (xi.len + yi.len == 2, true)) + { + val[0] = xi.ulow () ^ yi.ulow (); + result.set_len (1, is_sign_extended); + } + else + result.set_len (xor_large (val, xi.val, xi.len, + yi.val, yi.len, precision), is_sign_extended); + return result; +} + +/* Return X + Y. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::add (const T1 &x, const T2 &y) +{ + WI_BINARY_RESULT_VAR (result, val, T1, x, T2, y); + unsigned int precision = get_precision (result); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y, precision); + if (precision <= HOST_BITS_PER_WIDE_INT) + { + val[0] = xi.ulow () + yi.ulow (); + result.set_len (1); + } + /* If the precision is known at compile time to be greater than + HOST_BITS_PER_WIDE_INT, we can optimize the single-HWI case + knowing that (a) all bits in those HWIs are significant and + (b) the result has room for at least two HWIs. This provides + a fast path for things like offset_int and widest_int. + + The STATIC_CONSTANT_P test prevents this path from being + used for wide_ints. wide_ints with precisions greater than + HOST_BITS_PER_WIDE_INT are relatively rare and there's not much + point handling them inline. */ + else if (STATIC_CONSTANT_P (precision > HOST_BITS_PER_WIDE_INT) + && __builtin_expect (xi.len + yi.len == 2, true)) + { + unsigned HOST_WIDE_INT xl = xi.ulow (); + unsigned HOST_WIDE_INT yl = yi.ulow (); + unsigned HOST_WIDE_INT resultl = xl + yl; + val[0] = resultl; + val[1] = (HOST_WIDE_INT) resultl < 0 ? 0 : -1; + result.set_len (1 + (((resultl ^ xl) & (resultl ^ yl)) + >> (HOST_BITS_PER_WIDE_INT - 1))); + } + else + result.set_len (add_large (val, xi.val, xi.len, + yi.val, yi.len, precision, + UNSIGNED, 0)); + return result; +} + +/* Return X + Y. Treat X and Y as having the signednes given by SGN + and indicate in *OVERFLOW whether the operation overflowed. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::add (const T1 &x, const T2 &y, signop sgn, bool *overflow) +{ + WI_BINARY_RESULT_VAR (result, val, T1, x, T2, y); + unsigned int precision = get_precision (result); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y, precision); + if (precision <= HOST_BITS_PER_WIDE_INT) + { + unsigned HOST_WIDE_INT xl = xi.ulow (); + unsigned HOST_WIDE_INT yl = yi.ulow (); + unsigned HOST_WIDE_INT resultl = xl + yl; + if (sgn == SIGNED) + *overflow = (((resultl ^ xl) & (resultl ^ yl)) + >> (precision - 1)) & 1; + else + *overflow = ((resultl << (HOST_BITS_PER_WIDE_INT - precision)) + < (xl << (HOST_BITS_PER_WIDE_INT - precision))); + val[0] = resultl; + result.set_len (1); + } + else + result.set_len (add_large (val, xi.val, xi.len, + yi.val, yi.len, precision, + sgn, overflow)); + return result; +} + +/* Return X - Y. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::sub (const T1 &x, const T2 &y) +{ + WI_BINARY_RESULT_VAR (result, val, T1, x, T2, y); + unsigned int precision = get_precision (result); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y, precision); + if (precision <= HOST_BITS_PER_WIDE_INT) + { + val[0] = xi.ulow () - yi.ulow (); + result.set_len (1); + } + /* If the precision is known at compile time to be greater than + HOST_BITS_PER_WIDE_INT, we can optimize the single-HWI case + knowing that (a) all bits in those HWIs are significant and + (b) the result has room for at least two HWIs. This provides + a fast path for things like offset_int and widest_int. + + The STATIC_CONSTANT_P test prevents this path from being + used for wide_ints. wide_ints with precisions greater than + HOST_BITS_PER_WIDE_INT are relatively rare and there's not much + point handling them inline. */ + else if (STATIC_CONSTANT_P (precision > HOST_BITS_PER_WIDE_INT) + && __builtin_expect (xi.len + yi.len == 2, true)) + { + unsigned HOST_WIDE_INT xl = xi.ulow (); + unsigned HOST_WIDE_INT yl = yi.ulow (); + unsigned HOST_WIDE_INT resultl = xl - yl; + val[0] = resultl; + val[1] = (HOST_WIDE_INT) resultl < 0 ? 0 : -1; + result.set_len (1 + (((resultl ^ xl) & (xl ^ yl)) + >> (HOST_BITS_PER_WIDE_INT - 1))); + } + else + result.set_len (sub_large (val, xi.val, xi.len, + yi.val, yi.len, precision, + UNSIGNED, 0)); + return result; +} + +/* Return X - Y. Treat X and Y as having the signednes given by SGN + and indicate in *OVERFLOW whether the operation overflowed. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::sub (const T1 &x, const T2 &y, signop sgn, bool *overflow) +{ + WI_BINARY_RESULT_VAR (result, val, T1, x, T2, y); + unsigned int precision = get_precision (result); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y, precision); + if (precision <= HOST_BITS_PER_WIDE_INT) + { + unsigned HOST_WIDE_INT xl = xi.ulow (); + unsigned HOST_WIDE_INT yl = yi.ulow (); + unsigned HOST_WIDE_INT resultl = xl - yl; + if (sgn == SIGNED) + *overflow = (((xl ^ yl) & (resultl ^ xl)) >> (precision - 1)) & 1; + else + *overflow = ((resultl << (HOST_BITS_PER_WIDE_INT - precision)) + > (xl << (HOST_BITS_PER_WIDE_INT - precision))); + val[0] = resultl; + result.set_len (1); + } + else + result.set_len (sub_large (val, xi.val, xi.len, + yi.val, yi.len, precision, + sgn, overflow)); + return result; +} + +/* Return X * Y. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::mul (const T1 &x, const T2 &y) +{ + WI_BINARY_RESULT_VAR (result, val, T1, x, T2, y); + unsigned int precision = get_precision (result); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y, precision); + if (precision <= HOST_BITS_PER_WIDE_INT) + { + val[0] = xi.ulow () * yi.ulow (); + result.set_len (1); + } + else + result.set_len (mul_internal (val, xi.val, xi.len, yi.val, yi.len, + precision, UNSIGNED, 0, false)); + return result; +} + +/* Return X * Y. Treat X and Y as having the signednes given by SGN + and indicate in *OVERFLOW whether the operation overflowed. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::mul (const T1 &x, const T2 &y, signop sgn, bool *overflow) +{ + WI_BINARY_RESULT_VAR (result, val, T1, x, T2, y); + unsigned int precision = get_precision (result); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y, precision); + result.set_len (mul_internal (val, xi.val, xi.len, + yi.val, yi.len, precision, + sgn, overflow, false)); + return result; +} + +/* Return X * Y, treating both X and Y as signed values. Indicate in + *OVERFLOW whether the operation overflowed. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::smul (const T1 &x, const T2 &y, bool *overflow) +{ + return mul (x, y, SIGNED, overflow); +} + +/* Return X * Y, treating both X and Y as unsigned values. Indicate in + *OVERFLOW whether the operation overflowed. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::umul (const T1 &x, const T2 &y, bool *overflow) +{ + return mul (x, y, UNSIGNED, overflow); +} + +/* Perform a widening multiplication of X and Y, extending the values + according to SGN, and return the high part of the result. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::mul_high (const T1 &x, const T2 &y, signop sgn) +{ + WI_BINARY_RESULT_VAR (result, val, T1, x, T2, y); + unsigned int precision = get_precision (result); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y, precision); + result.set_len (mul_internal (val, xi.val, xi.len, + yi.val, yi.len, precision, + sgn, 0, true)); + return result; +} + +/* Return X / Y, rouding towards 0. Treat X and Y as having the + signedness given by SGN. Indicate in *OVERFLOW if the result + overflows. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::div_trunc (const T1 &x, const T2 &y, signop sgn, bool *overflow) +{ + WI_BINARY_RESULT_VAR (quotient, quotient_val, T1, x, T2, y); + unsigned int precision = get_precision (quotient); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y); + + quotient.set_len (divmod_internal (quotient_val, 0, 0, xi.val, xi.len, + precision, + yi.val, yi.len, yi.precision, + sgn, overflow)); + return quotient; +} + +/* Return X / Y, rouding towards 0. Treat X and Y as signed values. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::sdiv_trunc (const T1 &x, const T2 &y) +{ + return div_trunc (x, y, SIGNED); +} + +/* Return X / Y, rouding towards 0. Treat X and Y as unsigned values. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::udiv_trunc (const T1 &x, const T2 &y) +{ + return div_trunc (x, y, UNSIGNED); +} + +/* Return X / Y, rouding towards -inf. Treat X and Y as having the + signedness given by SGN. Indicate in *OVERFLOW if the result + overflows. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::div_floor (const T1 &x, const T2 &y, signop sgn, bool *overflow) +{ + WI_BINARY_RESULT_VAR (quotient, quotient_val, T1, x, T2, y); + WI_BINARY_RESULT_VAR (remainder, remainder_val, T1, x, T2, y); + unsigned int precision = get_precision (quotient); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y); + + unsigned int remainder_len; + quotient.set_len (divmod_internal (quotient_val, + &remainder_len, remainder_val, + xi.val, xi.len, precision, + yi.val, yi.len, yi.precision, sgn, + overflow)); + remainder.set_len (remainder_len); + if (wi::neg_p (x, sgn) != wi::neg_p (y, sgn) && remainder != 0) + return quotient - 1; + return quotient; +} + +/* Return X / Y, rouding towards -inf. Treat X and Y as signed values. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::sdiv_floor (const T1 &x, const T2 &y) +{ + return div_floor (x, y, SIGNED); +} + +/* Return X / Y, rouding towards -inf. Treat X and Y as unsigned values. */ +/* ??? Why do we have both this and udiv_trunc. Aren't they the same? */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::udiv_floor (const T1 &x, const T2 &y) +{ + return div_floor (x, y, UNSIGNED); +} + +/* Return X / Y, rouding towards +inf. Treat X and Y as having the + signedness given by SGN. Indicate in *OVERFLOW if the result + overflows. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::div_ceil (const T1 &x, const T2 &y, signop sgn, bool *overflow) +{ + WI_BINARY_RESULT_VAR (quotient, quotient_val, T1, x, T2, y); + WI_BINARY_RESULT_VAR (remainder, remainder_val, T1, x, T2, y); + unsigned int precision = get_precision (quotient); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y); + + unsigned int remainder_len; + quotient.set_len (divmod_internal (quotient_val, + &remainder_len, remainder_val, + xi.val, xi.len, precision, + yi.val, yi.len, yi.precision, sgn, + overflow)); + remainder.set_len (remainder_len); + if (wi::neg_p (x, sgn) == wi::neg_p (y, sgn) && remainder != 0) + return quotient + 1; + return quotient; +} + +/* Return X / Y, rouding towards nearest with ties away from zero. + Treat X and Y as having the signedness given by SGN. Indicate + in *OVERFLOW if the result overflows. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::div_round (const T1 &x, const T2 &y, signop sgn, bool *overflow) +{ + WI_BINARY_RESULT_VAR (quotient, quotient_val, T1, x, T2, y); + WI_BINARY_RESULT_VAR (remainder, remainder_val, T1, x, T2, y); + unsigned int precision = get_precision (quotient); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y); + + unsigned int remainder_len; + quotient.set_len (divmod_internal (quotient_val, + &remainder_len, remainder_val, + xi.val, xi.len, precision, + yi.val, yi.len, yi.precision, sgn, + overflow)); + remainder.set_len (remainder_len); + + if (remainder != 0) + { + if (sgn == SIGNED) + { + WI_BINARY_RESULT (T1, T2) abs_remainder = wi::abs (remainder); + if (wi::geu_p (abs_remainder, wi::sub (wi::abs (y), abs_remainder))) + { + if (wi::neg_p (x, sgn) != wi::neg_p (y, sgn)) + return quotient - 1; + else + return quotient + 1; + } + } + else + { + if (wi::geu_p (remainder, wi::sub (y, remainder))) + return quotient + 1; + } + } + return quotient; +} + +/* Return X / Y, rouding towards 0. Treat X and Y as having the + signedness given by SGN. Store the remainder in *REMAINDER_PTR. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::divmod_trunc (const T1 &x, const T2 &y, signop sgn, + WI_BINARY_RESULT (T1, T2) *remainder_ptr) +{ + WI_BINARY_RESULT_VAR (quotient, quotient_val, T1, x, T2, y); + WI_BINARY_RESULT_VAR (remainder, remainder_val, T1, x, T2, y); + unsigned int precision = get_precision (quotient); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y); + + unsigned int remainder_len; + quotient.set_len (divmod_internal (quotient_val, + &remainder_len, remainder_val, + xi.val, xi.len, precision, + yi.val, yi.len, yi.precision, sgn, 0)); + remainder.set_len (remainder_len); + + *remainder_ptr = remainder; + return quotient; +} + +/* Compute the greatest common divisor of two numbers A and B using + Euclid's algorithm. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::gcd (const T1 &a, const T2 &b, signop sgn) +{ + T1 x, y, z; + + x = wi::abs (a); + y = wi::abs (b); + + while (gt_p (x, 0, sgn)) + { + z = mod_trunc (y, x, sgn); + y = x; + x = z; + } + + return y; +} + +/* Compute X / Y, rouding towards 0, and return the remainder. + Treat X and Y as having the signedness given by SGN. Indicate + in *OVERFLOW if the division overflows. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::mod_trunc (const T1 &x, const T2 &y, signop sgn, bool *overflow) +{ + WI_BINARY_RESULT_VAR (remainder, remainder_val, T1, x, T2, y); + unsigned int precision = get_precision (remainder); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y); + + unsigned int remainder_len; + divmod_internal (0, &remainder_len, remainder_val, + xi.val, xi.len, precision, + yi.val, yi.len, yi.precision, sgn, overflow); + remainder.set_len (remainder_len); + + return remainder; +} + +/* Compute X / Y, rouding towards 0, and return the remainder. + Treat X and Y as signed values. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::smod_trunc (const T1 &x, const T2 &y) +{ + return mod_trunc (x, y, SIGNED); +} + +/* Compute X / Y, rouding towards 0, and return the remainder. + Treat X and Y as unsigned values. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::umod_trunc (const T1 &x, const T2 &y) +{ + return mod_trunc (x, y, UNSIGNED); +} + +/* Compute X / Y, rouding towards -inf, and return the remainder. + Treat X and Y as having the signedness given by SGN. Indicate + in *OVERFLOW if the division overflows. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::mod_floor (const T1 &x, const T2 &y, signop sgn, bool *overflow) +{ + WI_BINARY_RESULT_VAR (quotient, quotient_val, T1, x, T2, y); + WI_BINARY_RESULT_VAR (remainder, remainder_val, T1, x, T2, y); + unsigned int precision = get_precision (quotient); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y); + + unsigned int remainder_len; + quotient.set_len (divmod_internal (quotient_val, + &remainder_len, remainder_val, + xi.val, xi.len, precision, + yi.val, yi.len, yi.precision, sgn, + overflow)); + remainder.set_len (remainder_len); + + if (wi::neg_p (x, sgn) != wi::neg_p (y, sgn) && remainder != 0) + return remainder + y; + return remainder; +} + +/* Compute X / Y, rouding towards -inf, and return the remainder. + Treat X and Y as unsigned values. */ +/* ??? Why do we have both this and umod_trunc. Aren't they the same? */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::umod_floor (const T1 &x, const T2 &y) +{ + return mod_floor (x, y, UNSIGNED); +} + +/* Compute X / Y, rouding towards +inf, and return the remainder. + Treat X and Y as having the signedness given by SGN. Indicate + in *OVERFLOW if the division overflows. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::mod_ceil (const T1 &x, const T2 &y, signop sgn, bool *overflow) +{ + WI_BINARY_RESULT_VAR (quotient, quotient_val, T1, x, T2, y); + WI_BINARY_RESULT_VAR (remainder, remainder_val, T1, x, T2, y); + unsigned int precision = get_precision (quotient); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y); + + unsigned int remainder_len; + quotient.set_len (divmod_internal (quotient_val, + &remainder_len, remainder_val, + xi.val, xi.len, precision, + yi.val, yi.len, yi.precision, sgn, + overflow)); + remainder.set_len (remainder_len); + + if (wi::neg_p (x, sgn) == wi::neg_p (y, sgn) && remainder != 0) + return remainder - y; + return remainder; +} + +/* Compute X / Y, rouding towards nearest with ties away from zero, + and return the remainder. Treat X and Y as having the signedness + given by SGN. Indicate in *OVERFLOW if the division overflows. */ +template +inline WI_BINARY_RESULT (T1, T2) +wi::mod_round (const T1 &x, const T2 &y, signop sgn, bool *overflow) +{ + WI_BINARY_RESULT_VAR (quotient, quotient_val, T1, x, T2, y); + WI_BINARY_RESULT_VAR (remainder, remainder_val, T1, x, T2, y); + unsigned int precision = get_precision (quotient); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y); + + unsigned int remainder_len; + quotient.set_len (divmod_internal (quotient_val, + &remainder_len, remainder_val, + xi.val, xi.len, precision, + yi.val, yi.len, yi.precision, sgn, + overflow)); + remainder.set_len (remainder_len); + + if (remainder != 0) + { + if (sgn == SIGNED) + { + WI_BINARY_RESULT (T1, T2) abs_remainder = wi::abs (remainder); + if (wi::geu_p (abs_remainder, wi::sub (wi::abs (y), abs_remainder))) + { + if (wi::neg_p (x, sgn) != wi::neg_p (y, sgn)) + return remainder + y; + else + return remainder - y; + } + } + else + { + if (wi::geu_p (remainder, wi::sub (y, remainder))) + return remainder - y; + } + } + return remainder; +} + +/* Return true if X is a multiple of Y. Treat X and Y as having the + signedness given by SGN. */ +template +inline bool +wi::multiple_of_p (const T1 &x, const T2 &y, signop sgn) +{ + return wi::mod_trunc (x, y, sgn) == 0; +} + +/* Return true if X is a multiple of Y, storing X / Y in *RES if so. + Treat X and Y as having the signedness given by SGN. */ +template +inline bool +wi::multiple_of_p (const T1 &x, const T2 &y, signop sgn, + WI_BINARY_RESULT (T1, T2) *res) +{ + WI_BINARY_RESULT (T1, T2) remainder; + WI_BINARY_RESULT (T1, T2) quotient + = divmod_trunc (x, y, sgn, &remainder); + if (remainder == 0) + { + *res = quotient; + return true; + } + return false; +} + +/* Return X << Y. Return 0 if Y is greater than or equal to + the precision of X. */ +template +inline WI_UNARY_RESULT (T1) +wi::lshift (const T1 &x, const T2 &y) +{ + WI_UNARY_RESULT_VAR (result, val, T1, x); + unsigned int precision = get_precision (result); + WIDE_INT_REF_FOR (T1) xi (x, precision); + WIDE_INT_REF_FOR (T2) yi (y); + /* Handle the simple cases quickly. */ + if (geu_p (yi, precision)) + { + val[0] = 0; + result.set_len (1); + } + else + { + unsigned int shift = yi.to_uhwi (); + /* For fixed-precision integers like offset_int and widest_int, + handle the case where the shift value is constant and the + result is a single nonnegative HWI (meaning that we don't + need to worry about val[1]). This is particularly common + for converting a byte count to a bit count. + + For variable-precision integers like wide_int, handle HWI + and sub-HWI integers inline. */ + if (STATIC_CONSTANT_P (xi.precision > HOST_BITS_PER_WIDE_INT) + ? (STATIC_CONSTANT_P (shift < HOST_BITS_PER_WIDE_INT - 1) + && xi.len == 1 + && xi.val[0] <= (HOST_WIDE_INT) ((unsigned HOST_WIDE_INT) + HOST_WIDE_INT_MAX >> shift)) + : precision <= HOST_BITS_PER_WIDE_INT) + { + val[0] = xi.ulow () << shift; + result.set_len (1); + } + else + result.set_len (lshift_large (val, xi.val, xi.len, + precision, shift)); + } + return result; +} + +/* Return X >> Y, using a logical shift. Return 0 if Y is greater than + or equal to the precision of X. */ +template +inline WI_UNARY_RESULT (T1) +wi::lrshift (const T1 &x, const T2 &y) +{ + WI_UNARY_RESULT_VAR (result, val, T1, x); + /* Do things in the precision of the input rather than the output, + since the result can be no larger than that. */ + WIDE_INT_REF_FOR (T1) xi (x); + WIDE_INT_REF_FOR (T2) yi (y); + /* Handle the simple cases quickly. */ + if (geu_p (yi, xi.precision)) + { + val[0] = 0; + result.set_len (1); + } + else + { + unsigned int shift = yi.to_uhwi (); + /* For fixed-precision integers like offset_int and widest_int, + handle the case where the shift value is constant and the + shifted value is a single nonnegative HWI (meaning that all + bits above the HWI are zero). This is particularly common + for converting a bit count to a byte count. + + For variable-precision integers like wide_int, handle HWI + and sub-HWI integers inline. */ + if (STATIC_CONSTANT_P (xi.precision > HOST_BITS_PER_WIDE_INT) + ? (shift < HOST_BITS_PER_WIDE_INT + && xi.len == 1 + && xi.val[0] >= 0) + : xi.precision <= HOST_BITS_PER_WIDE_INT) + { + val[0] = xi.to_uhwi () >> shift; + result.set_len (1); + } + else + result.set_len (lrshift_large (val, xi.val, xi.len, xi.precision, + get_precision (result), shift)); + } + return result; +} + +/* Return X >> Y, using an arithmetic shift. Return a sign mask if + Y is greater than or equal to the precision of X. */ +template +inline WI_UNARY_RESULT (T1) +wi::arshift (const T1 &x, const T2 &y) +{ + WI_UNARY_RESULT_VAR (result, val, T1, x); + /* Do things in the precision of the input rather than the output, + since the result can be no larger than that. */ + WIDE_INT_REF_FOR (T1) xi (x); + WIDE_INT_REF_FOR (T2) yi (y); + /* Handle the simple cases quickly. */ + if (geu_p (yi, xi.precision)) + { + val[0] = sign_mask (x); + result.set_len (1); + } + else + { + unsigned int shift = yi.to_uhwi (); + if (xi.precision <= HOST_BITS_PER_WIDE_INT) + { + val[0] = sext_hwi (xi.ulow () >> shift, xi.precision - shift); + result.set_len (1, true); + } + else + result.set_len (arshift_large (val, xi.val, xi.len, xi.precision, + get_precision (result), shift)); + } + return result; +} + +/* Return X >> Y, using an arithmetic shift if SGN is SIGNED and a + logical shift otherwise. */ +template +inline WI_UNARY_RESULT (T1) +wi::rshift (const T1 &x, const T2 &y, signop sgn) +{ + if (sgn == UNSIGNED) + return lrshift (x, y); + else + return arshift (x, y); +} + +/* Return the result of rotating the low WIDTH bits of X left by Y + bits and zero-extending the result. Use a full-width rotate if + WIDTH is zero. */ +template +WI_UNARY_RESULT (T1) +wi::lrotate (const T1 &x, const T2 &y, unsigned int width) +{ + unsigned int precision = get_binary_precision (x, x); + if (width == 0) + width = precision; + WI_UNARY_RESULT (T2) ymod = umod_trunc (y, width); + WI_UNARY_RESULT (T1) left = wi::lshift (x, ymod); + WI_UNARY_RESULT (T1) right = wi::lrshift (x, wi::sub (width, ymod)); + if (width != precision) + return wi::zext (left, width) | wi::zext (right, width); + return left | right; +} + +/* Return the result of rotating the low WIDTH bits of X right by Y + bits and zero-extending the result. Use a full-width rotate if + WIDTH is zero. */ +template +WI_UNARY_RESULT (T1) +wi::rrotate (const T1 &x, const T2 &y, unsigned int width) +{ + unsigned int precision = get_binary_precision (x, x); + if (width == 0) + width = precision; + WI_UNARY_RESULT (T2) ymod = umod_trunc (y, width); + WI_UNARY_RESULT (T1) right = wi::lrshift (x, ymod); + WI_UNARY_RESULT (T1) left = wi::lshift (x, wi::sub (width, ymod)); + if (width != precision) + return wi::zext (left, width) | wi::zext (right, width); + return left | right; +} + +/* Return 0 if the number of 1s in X is even and 1 if the number of 1s + is odd. */ +inline int +wi::parity (const wide_int_ref &x) +{ + return popcount (x) & 1; +} + +/* Extract WIDTH bits from X, starting at BITPOS. */ +template +inline unsigned HOST_WIDE_INT +wi::extract_uhwi (const T &x, unsigned int bitpos, unsigned int width) +{ + unsigned precision = get_precision (x); + if (precision < bitpos + width) + precision = bitpos + width; + WIDE_INT_REF_FOR (T) xi (x, precision); + + /* Handle this rare case after the above, so that we assert about + bogus BITPOS values. */ + if (width == 0) + return 0; + + unsigned int start = bitpos / HOST_BITS_PER_WIDE_INT; + unsigned int shift = bitpos % HOST_BITS_PER_WIDE_INT; + unsigned HOST_WIDE_INT res = xi.elt (start); + res >>= shift; + if (shift + width > HOST_BITS_PER_WIDE_INT) + { + unsigned HOST_WIDE_INT upper = xi.elt (start + 1); + res |= upper << (-shift % HOST_BITS_PER_WIDE_INT); + } + return zext_hwi (res, width); +} + +/* Return the minimum precision needed to store X with sign SGN. */ +template +inline unsigned int +wi::min_precision (const T &x, signop sgn) +{ + if (sgn == SIGNED) + return get_precision (x) - clrsb (x); + else + return get_precision (x) - clz (x); +} + +#define SIGNED_BINARY_PREDICATE(OP, F) \ + template \ + inline WI_SIGNED_BINARY_PREDICATE_RESULT (T1, T2) \ + OP (const T1 &x, const T2 &y) \ + { \ + return wi::F (x, y); \ + } + +SIGNED_BINARY_PREDICATE (operator <, lts_p) +SIGNED_BINARY_PREDICATE (operator <=, les_p) +SIGNED_BINARY_PREDICATE (operator >, gts_p) +SIGNED_BINARY_PREDICATE (operator >=, ges_p) + +#undef SIGNED_BINARY_PREDICATE + +template +inline WI_SIGNED_SHIFT_RESULT (T1, T2) +operator << (const T1 &x, const T2 &y) +{ + return wi::lshift (x, y); +} + +template +inline WI_SIGNED_SHIFT_RESULT (T1, T2) +operator >> (const T1 &x, const T2 &y) +{ + return wi::arshift (x, y); +} + +template +void +gt_ggc_mx (generic_wide_int *) +{ +} + +template +void +gt_pch_nx (generic_wide_int *) +{ +} + +template +void +gt_pch_nx (generic_wide_int *, void (*) (void *, void *), void *) +{ +} + +template +void +gt_ggc_mx (trailing_wide_ints *) +{ +} + +template +void +gt_pch_nx (trailing_wide_ints *) +{ +} + +template +void +gt_pch_nx (trailing_wide_ints *, void (*) (void *, void *), void *) +{ +} + +namespace wi +{ + /* Used for overloaded functions in which the only other acceptable + scalar type is a pointer. It stops a plain 0 from being treated + as a null pointer. */ + struct never_used1 {}; + struct never_used2 {}; + + wide_int min_value (unsigned int, signop); + wide_int min_value (never_used1 *); + wide_int min_value (never_used2 *); + wide_int max_value (unsigned int, signop); + wide_int max_value (never_used1 *); + wide_int max_value (never_used2 *); + + /* FIXME: this is target dependent, so should be elsewhere. + It also seems to assume that CHAR_BIT == BITS_PER_UNIT. */ + wide_int from_buffer (const unsigned char *, unsigned int); + +#ifndef GENERATOR_FILE + void to_mpz (const wide_int_ref &, mpz_t, signop); +#endif + + wide_int mask (unsigned int, bool, unsigned int); + wide_int shifted_mask (unsigned int, unsigned int, bool, unsigned int); + wide_int set_bit_in_zero (unsigned int, unsigned int); + wide_int insert (const wide_int &x, const wide_int &y, unsigned int, + unsigned int); + + template + T mask (unsigned int, bool); + + template + T shifted_mask (unsigned int, unsigned int, bool); + + template + T set_bit_in_zero (unsigned int); + + unsigned int mask (HOST_WIDE_INT *, unsigned int, bool, unsigned int); + unsigned int shifted_mask (HOST_WIDE_INT *, unsigned int, unsigned int, + bool, unsigned int); + unsigned int from_array (HOST_WIDE_INT *, const HOST_WIDE_INT *, + unsigned int, unsigned int, bool); +} + +/* Return a PRECISION-bit integer in which the low WIDTH bits are set + and the other bits are clear, or the inverse if NEGATE_P. */ +inline wide_int +wi::mask (unsigned int width, bool negate_p, unsigned int precision) +{ + wide_int result = wide_int::create (precision); + result.set_len (mask (result.write_val (), width, negate_p, precision)); + return result; +} + +/* Return a PRECISION-bit integer in which the low START bits are clear, + the next WIDTH bits are set, and the other bits are clear, + or the inverse if NEGATE_P. */ +inline wide_int +wi::shifted_mask (unsigned int start, unsigned int width, bool negate_p, + unsigned int precision) +{ + wide_int result = wide_int::create (precision); + result.set_len (shifted_mask (result.write_val (), start, width, negate_p, + precision)); + return result; +} + +/* Return a PRECISION-bit integer in which bit BIT is set and all the + others are clear. */ +inline wide_int +wi::set_bit_in_zero (unsigned int bit, unsigned int precision) +{ + return shifted_mask (bit, 1, false, precision); +} + +/* Return an integer of type T in which the low WIDTH bits are set + and the other bits are clear, or the inverse if NEGATE_P. */ +template +inline T +wi::mask (unsigned int width, bool negate_p) +{ + STATIC_ASSERT (wi::int_traits::precision); + T result; + result.set_len (mask (result.write_val (), width, negate_p, + wi::int_traits ::precision)); + return result; +} + +/* Return an integer of type T in which the low START bits are clear, + the next WIDTH bits are set, and the other bits are clear, or the + inverse if NEGATE_P. */ +template +inline T +wi::shifted_mask (unsigned int start, unsigned int width, bool negate_p) +{ + STATIC_ASSERT (wi::int_traits::precision); + T result; + result.set_len (shifted_mask (result.write_val (), start, width, + negate_p, + wi::int_traits ::precision)); + return result; +} + +/* Return an integer of type T in which bit BIT is set and all the + others are clear. */ +template +inline T +wi::set_bit_in_zero (unsigned int bit) +{ + return shifted_mask (bit, 1, false); +} + +#endif /* WIDE_INT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/xcoff.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/xcoff.h new file mode 100644 index 0000000..7953b24 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/xcoff.h @@ -0,0 +1,40 @@ +/* Copyright (C) 2003-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_XCOFF_H +#define GCC_XCOFF_H + +/* Storage classes in XCOFF object file format designed for DBX's use. + This info is from the `Files Reference' manual for IBM's AIX version 3 + for the RS6000. */ + +#define C_GSYM 0x80 +#define C_LSYM 0x81 +#define C_PSYM 0x82 +#define C_RSYM 0x83 +#define C_RPSYM 0x84 +#define C_STSYM 0x85 + +#define C_BCOMM 0x87 +#define C_ECOML 0x88 +#define C_ECOMM 0x89 +#define C_DECL 0x8c +#define C_ENTRY 0x8d +#define C_FUN 0x8e + +#endif /* GCC_XCOFF_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/xcoffout.h b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/xcoffout.h new file mode 100644 index 0000000..6b0b0a0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/lib/gcc/mipsel-buildroot-linux-uclibc/7.3.0/plugin/include/xcoffout.h @@ -0,0 +1,194 @@ +/* XCOFF definitions. These are needed in dbxout.c, final.c, + and xcoffout.h. + Copyright (C) 1998-2017 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_XCOFFOUT_H +#define GCC_XCOFFOUT_H + +/* Tags and typedefs are C_DECL in XCOFF, not C_LSYM. */ + +#define DBX_TYPE_DECL_STABS_CODE N_DECL + +/* Use the XCOFF predefined type numbers. */ + +#define DBX_ASSIGN_FUNDAMENTAL_TYPE_NUMBER(TYPE) \ + xcoff_assign_fundamental_type_number (TYPE) + +/* Any type with a negative type index has already been output. */ + +#define DBX_TYPE_DEFINED(TYPE) (TYPE_SYMTAB_ADDRESS (TYPE) < 0) + +/* Must use N_STSYM for static const variables (those in the text section) + instead of N_FUN. */ + +#define DBX_STATIC_CONST_VAR_CODE N_STSYM + +/* For static variables, output code to define the start of a static block. */ + +#define DBX_STATIC_BLOCK_START(ASMFILE,CODE) \ +{ \ + if ((CODE) == N_STSYM) \ + fprintf ((ASMFILE), "\t.bs\t%s[RW]\n", xcoff_private_data_section_name);\ + else if ((CODE) == N_LCSYM) \ + fprintf ((ASMFILE), "\t.bs\t%s\n", xcoff_bss_section_name); \ +} + +/* For static variables, output code to define the end of a static block. */ + +#define DBX_STATIC_BLOCK_END(ASMFILE,CODE) \ +{ \ + if ((CODE) == N_STSYM || (CODE) == N_LCSYM) \ + fputs ("\t.es\n", (ASMFILE)); \ +} + +/* We must use N_RPYSM instead of N_RSYM for register parameters. */ + +#define DBX_REGPARM_STABS_CODE N_RPSYM + +/* We must use 'R' instead of 'P' for register parameters. */ + +#define DBX_REGPARM_STABS_LETTER 'R' + +/* Define our own finish symbol function, since xcoff stabs have their + own different format. */ + +#define DBX_FINISH_STABS(SYM, CODE, LINE, ADDR, LABEL, NUMBER) do { \ + if (ADDR) \ + { \ + /* If we are writing a function name, we must emit a dot in \ + order to refer to the function code, not its descriptor. */ \ + if (CODE == N_FUN) \ + putc ('.', asm_out_file); \ + \ + /* If we are writing a function name, we must ensure that \ + there is no storage-class suffix on the name. */ \ + if (CODE == N_FUN && GET_CODE (ADDR) == SYMBOL_REF) \ + { \ + const char *_p = XSTR (ADDR, 0); \ + if (*_p == '*') \ + fputs (_p+1, asm_out_file); \ + else \ + for (; *_p != '[' && *_p; _p++) \ + putc (*_p != '$' ? *_p : '_', asm_out_file); \ + } \ + else \ + output_addr_const (asm_out_file, ADDR); \ + } \ + /* Another special case: N_GSYM always gets the symbol name, \ + whether or not LABEL or NUMBER are set. */ \ + else if (CODE == N_GSYM) \ + assemble_name (asm_out_file, XSTR (XEXP (DECL_RTL (SYM), 0), 0)); \ + else if (LABEL) \ + assemble_name (asm_out_file, LABEL); \ + else \ + dbxout_int (NUMBER); \ + putc (',', asm_out_file); \ + dbxout_int (stab_to_sclass (CODE)); \ + fputs (",0\n", asm_out_file); \ +} while (0) + +/* These are IBM XCOFF extensions we need to reference in dbxout.c + and xcoffout.c. */ + +/* AIX XCOFF uses this for typedefs. This can have any value, since it is + only used for translation into a C_DECL storage class. */ +#ifndef N_DECL +#define N_DECL 0x8c +#endif +/* AIX XCOFF uses this for parameters passed in registers. This can have + any value, since it is only used for translation into a C_RPSYM storage + class. */ +#ifndef N_RPSYM +#define N_RPSYM 0x8e +#endif + +/* Name of the current include file. */ + +extern const char *xcoff_current_include_file; + +/* Names of bss and data sections. These should be unique names for each + compilation unit. */ + +extern char *xcoff_bss_section_name; +extern char *xcoff_private_data_section_name; +extern char *xcoff_tls_data_section_name; +extern char *xcoff_tbss_section_name; +extern char *xcoff_read_only_section_name; + +/* Last source file name mentioned in a NOTE insn. */ + +extern const char *xcoff_lastfile; + +/* Don't write out path name for main source file. */ +#define NO_DBX_MAIN_SOURCE_DIRECTORY 1 + +/* Write out main source file name using ".file" rather than ".stabs". + We don't actually do this here, because the assembler gets confused if there + is more than one .file directive. rs6000_xcoff_file_start is already + emitting a .file directory, so we don't output one here also. + Initialize xcoff_lastfile. */ +#define DBX_OUTPUT_MAIN_SOURCE_FILENAME(FILE,FILENAME) \ + xcoff_lastfile = (FILENAME) + +/* If we are still in an include file, its end must be marked. */ +#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \ +do { \ + if (xcoff_current_include_file) \ + { \ + fputs ("\t.ei\t", (FILE)); \ + output_quoted_string ((FILE), xcoff_current_include_file); \ + putc ('\n', (FILE)); \ + xcoff_current_include_file = NULL; \ + } \ +} while (0) + +/* Do not emit any marker for XCOFF until assembler allows XFT_CV. */ +#define NO_DBX_GCC_MARKER + +/* XCOFF32 maximum length is 64K; XLC limits to 16K. */ +#define DBX_CONTIN_LENGTH 16384 + +/* XLC uses '?' as continuation character. */ +#define DBX_CONTIN_CHAR '?' + +/* Don't try to use the `x' type-cross-reference character in DBX data. + Also has the consequence of putting each struct, union or enum + into a separate .stabs, containing only cross-refs to the others. */ +#define DBX_NO_XREFS + +/* We must put stabs in the text section. If we don't the assembler + won't handle them correctly; it will sometimes put stabs where gdb + can't find them. */ + +#define DEBUG_SYMS_TEXT + +/* Prototype functions in xcoffout.c. */ + +extern int stab_to_sclass (int); +extern void xcoffout_begin_prologue (unsigned int, unsigned int, const char *); +extern void xcoffout_begin_block (unsigned, unsigned); +extern void xcoffout_end_epilogue (unsigned int, const char *); +extern void xcoffout_end_function (unsigned int); +extern void xcoffout_end_block (unsigned, unsigned); +extern int xcoff_assign_fundamental_type_number (tree); +extern void xcoffout_declare_function (FILE *, tree, const char *); +extern void xcoffout_source_line (unsigned int, unsigned int, const char *, + int, bool); + +#endif /* GCC_XCOFFOUT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/backward/auto_ptr.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/backward/auto_ptr.h new file mode 100644 index 0000000..9ad1873 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/backward/auto_ptr.h @@ -0,0 +1,333 @@ +// auto_ptr implementation -*- C++ -*- + +// Copyright (C) 2007-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file backward/auto_ptr.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _BACKWARD_AUTO_PTR_H +#define _BACKWARD_AUTO_PTR_H 1 + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * A wrapper class to provide auto_ptr with reference semantics. + * For example, an auto_ptr can be assigned (or constructed from) + * the result of a function which returns an auto_ptr by value. + * + * All the auto_ptr_ref stuff should happen behind the scenes. + */ + template + struct auto_ptr_ref + { + _Tp1* _M_ptr; + + explicit + auto_ptr_ref(_Tp1* __p): _M_ptr(__p) { } + } _GLIBCXX_DEPRECATED; + + + /** + * @brief A simple smart pointer providing strict ownership semantics. + * + * The Standard says: + *
+   *  An @c auto_ptr owns the object it holds a pointer to.  Copying
+   *  an @c auto_ptr copies the pointer and transfers ownership to the
+   *  destination.  If more than one @c auto_ptr owns the same object
+   *  at the same time the behavior of the program is undefined.
+   *
+   *  The uses of @c auto_ptr include providing temporary
+   *  exception-safety for dynamically allocated memory, passing
+   *  ownership of dynamically allocated memory to a function, and
+   *  returning dynamically allocated memory from a function.  @c
+   *  auto_ptr does not meet the CopyConstructible and Assignable
+   *  requirements for Standard Library container elements and thus
+   *  instantiating a Standard Library container with an @c auto_ptr
+   *  results in undefined behavior.
+   *  
+ * Quoted from [20.4.5]/3. + * + * Good examples of what can and cannot be done with auto_ptr can + * be found in the libstdc++ testsuite. + * + * _GLIBCXX_RESOLVE_LIB_DEFECTS + * 127. auto_ptr<> conversion issues + * These resolutions have all been incorporated. + */ + template + class auto_ptr + { + private: + _Tp* _M_ptr; + + public: + /// The pointed-to type. + typedef _Tp element_type; + + /** + * @brief An %auto_ptr is usually constructed from a raw pointer. + * @param __p A pointer (defaults to NULL). + * + * This object now @e owns the object pointed to by @a __p. + */ + explicit + auto_ptr(element_type* __p = 0) throw() : _M_ptr(__p) { } + + /** + * @brief An %auto_ptr can be constructed from another %auto_ptr. + * @param __a Another %auto_ptr of the same type. + * + * This object now @e owns the object previously owned by @a __a, + * which has given up ownership. + */ + auto_ptr(auto_ptr& __a) throw() : _M_ptr(__a.release()) { } + + /** + * @brief An %auto_ptr can be constructed from another %auto_ptr. + * @param __a Another %auto_ptr of a different but related type. + * + * A pointer-to-Tp1 must be convertible to a + * pointer-to-Tp/element_type. + * + * This object now @e owns the object previously owned by @a __a, + * which has given up ownership. + */ + template + auto_ptr(auto_ptr<_Tp1>& __a) throw() : _M_ptr(__a.release()) { } + + /** + * @brief %auto_ptr assignment operator. + * @param __a Another %auto_ptr of the same type. + * + * This object now @e owns the object previously owned by @a __a, + * which has given up ownership. The object that this one @e + * used to own and track has been deleted. + */ + auto_ptr& + operator=(auto_ptr& __a) throw() + { + reset(__a.release()); + return *this; + } + + /** + * @brief %auto_ptr assignment operator. + * @param __a Another %auto_ptr of a different but related type. + * + * A pointer-to-Tp1 must be convertible to a pointer-to-Tp/element_type. + * + * This object now @e owns the object previously owned by @a __a, + * which has given up ownership. The object that this one @e + * used to own and track has been deleted. + */ + template + auto_ptr& + operator=(auto_ptr<_Tp1>& __a) throw() + { + reset(__a.release()); + return *this; + } + + /** + * When the %auto_ptr goes out of scope, the object it owns is + * deleted. If it no longer owns anything (i.e., @c get() is + * @c NULL), then this has no effect. + * + * The C++ standard says there is supposed to be an empty throw + * specification here, but omitting it is standard conforming. Its + * presence can be detected only if _Tp::~_Tp() throws, but this is + * prohibited. [17.4.3.6]/2 + */ + ~auto_ptr() { delete _M_ptr; } + + /** + * @brief Smart pointer dereferencing. + * + * If this %auto_ptr no longer owns anything, then this + * operation will crash. (For a smart pointer, no longer owns + * anything is the same as being a null pointer, and you know + * what happens when you dereference one of those...) + */ + element_type& + operator*() const throw() + { + __glibcxx_assert(_M_ptr != 0); + return *_M_ptr; + } + + /** + * @brief Smart pointer dereferencing. + * + * This returns the pointer itself, which the language then will + * automatically cause to be dereferenced. + */ + element_type* + operator->() const throw() + { + __glibcxx_assert(_M_ptr != 0); + return _M_ptr; + } + + /** + * @brief Bypassing the smart pointer. + * @return The raw pointer being managed. + * + * You can get a copy of the pointer that this object owns, for + * situations such as passing to a function which only accepts + * a raw pointer. + * + * @note This %auto_ptr still owns the memory. + */ + element_type* + get() const throw() { return _M_ptr; } + + /** + * @brief Bypassing the smart pointer. + * @return The raw pointer being managed. + * + * You can get a copy of the pointer that this object owns, for + * situations such as passing to a function which only accepts + * a raw pointer. + * + * @note This %auto_ptr no longer owns the memory. When this object + * goes out of scope, nothing will happen. + */ + element_type* + release() throw() + { + element_type* __tmp = _M_ptr; + _M_ptr = 0; + return __tmp; + } + + /** + * @brief Forcibly deletes the managed object. + * @param __p A pointer (defaults to NULL). + * + * This object now @e owns the object pointed to by @a __p. The + * previous object has been deleted. + */ + void + reset(element_type* __p = 0) throw() + { + if (__p != _M_ptr) + { + delete _M_ptr; + _M_ptr = __p; + } + } + + /** + * @brief Automatic conversions + * + * These operations are supposed to convert an %auto_ptr into and from + * an auto_ptr_ref automatically as needed. This would allow + * constructs such as + * @code + * auto_ptr func_returning_auto_ptr(.....); + * ... + * auto_ptr ptr = func_returning_auto_ptr(.....); + * @endcode + * + * But it doesn't work, and won't be fixed. For further details see + * http://cplusplus.github.io/LWG/lwg-closed.html#463 + */ + auto_ptr(auto_ptr_ref __ref) throw() + : _M_ptr(__ref._M_ptr) { } + + auto_ptr& + operator=(auto_ptr_ref __ref) throw() + { + if (__ref._M_ptr != this->get()) + { + delete _M_ptr; + _M_ptr = __ref._M_ptr; + } + return *this; + } + + template + operator auto_ptr_ref<_Tp1>() throw() + { return auto_ptr_ref<_Tp1>(this->release()); } + + template + operator auto_ptr<_Tp1>() throw() + { return auto_ptr<_Tp1>(this->release()); } + } _GLIBCXX_DEPRECATED; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 541. shared_ptr template assignment and void + template<> + class auto_ptr + { + public: + typedef void element_type; + } _GLIBCXX_DEPRECATED; + +#if __cplusplus >= 201103L + template<_Lock_policy _Lp> + template + inline + __shared_count<_Lp>::__shared_count(std::auto_ptr<_Tp>&& __r) + : _M_pi(new _Sp_counted_ptr<_Tp*, _Lp>(__r.get())) + { __r.release(); } + + template + template + inline + __shared_ptr<_Tp, _Lp>::__shared_ptr(std::auto_ptr<_Tp1>&& __r) + : _M_ptr(__r.get()), _M_refcount() + { + __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) + static_assert( sizeof(_Tp1) > 0, "incomplete type" ); + _Tp1* __tmp = __r.get(); + _M_refcount = __shared_count<_Lp>(std::move(__r)); + _M_enable_shared_from_this_with(__tmp); + } + + template + template + inline + shared_ptr<_Tp>::shared_ptr(std::auto_ptr<_Tp1>&& __r) + : __shared_ptr<_Tp>(std::move(__r)) { } + + template + template + inline + unique_ptr<_Tp, _Dp>::unique_ptr(auto_ptr<_Up>&& __u) noexcept + : _M_t(__u.release(), deleter_type()) { } +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _BACKWARD_AUTO_PTR_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/backward/backward_warning.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/backward/backward_warning.h new file mode 100644 index 0000000..7eba3f8 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/backward/backward_warning.h @@ -0,0 +1,60 @@ +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file backward/backward_warning.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iosfwd} + */ + +#ifndef _BACKWARD_BACKWARD_WARNING_H +#define _BACKWARD_BACKWARD_WARNING_H 1 + +#ifdef __DEPRECATED +#warning \ + This file includes at least one deprecated or antiquated header which \ + may be removed without further notice at a future date. Please use a \ + non-deprecated interface with equivalent functionality instead. For a \ + listing of replacement headers and interfaces, consult the file \ + backward_warning.h. To disable this warning use -Wno-deprecated. + +/* + A list of valid replacements is as follows: + + Use: Instead of: + , basic_stringbuf , strstreambuf + , basic_istringstream , istrstream + , basic_ostringstream , ostrstream + , basic_stringstream , strstream + , unordered_set , hash_set + , unordered_multiset , hash_multiset + , unordered_map , hash_map + , unordered_multimap , hash_multimap + , bind , binder1st + , bind , binder2nd + , bind , bind1st + , bind , bind2nd + , unique_ptr , auto_ptr +*/ + +#endif + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/backward/binders.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/backward/binders.h new file mode 100644 index 0000000..7564a6c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/backward/binders.h @@ -0,0 +1,182 @@ +// Functor implementations -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file backward/binders.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{functional} + */ + +#ifndef _BACKWARD_BINDERS_H +#define _BACKWARD_BINDERS_H 1 + +// Suppress deprecated warning for this file. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // 20.3.6 binders + /** @defgroup binders Binder Classes + * @ingroup functors + * + * Binders turn functions/functors with two arguments into functors + * with a single argument, storing an argument to be applied later. + * For example, a variable @c B of type @c binder1st is constructed + * from a functor @c f and an argument @c x. Later, B's @c + * operator() is called with a single argument @c y. The return + * value is the value of @c f(x,y). @c B can be @a called with + * various arguments (y1, y2, ...) and will in turn call @c + * f(x,y1), @c f(x,y2), ... + * + * The function @c bind1st is provided to save some typing. It takes the + * function and an argument as parameters, and returns an instance of + * @c binder1st. + * + * The type @c binder2nd and its creator function @c bind2nd do the same + * thing, but the stored argument is passed as the second parameter instead + * of the first, e.g., @c bind2nd(std::minus(),1.3) will create a + * functor whose @c operator() accepts a floating-point number, subtracts + * 1.3 from it, and returns the result. (If @c bind1st had been used, + * the functor would perform 1.3 - x instead. + * + * Creator-wrapper functions like @c bind1st are intended to be used in + * calling algorithms. Their return values will be temporary objects. + * (The goal is to not require you to type names like + * @c std::binder1st> for declaring a variable to hold the + * return value from @c bind1st(std::plus(),5). + * + * These become more useful when combined with the composition functions. + * + * These functions are deprecated in C++11 and can be replaced by + * @c std::bind (or @c std::tr1::bind) which is more powerful and flexible, + * supporting functions with any number of arguments. Uses of @c bind1st + * can be replaced by @c std::bind(f, x, std::placeholders::_1) and + * @c bind2nd by @c std::bind(f, std::placeholders::_1, x). + * @{ + */ + /// One of the @link binders binder functors@endlink. + template + class binder1st + : public unary_function + { + protected: + _Operation op; + typename _Operation::first_argument_type value; + + public: + binder1st(const _Operation& __x, + const typename _Operation::first_argument_type& __y) + : op(__x), value(__y) { } + + typename _Operation::result_type + operator()(const typename _Operation::second_argument_type& __x) const + { return op(value, __x); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 109. Missing binders for non-const sequence elements + typename _Operation::result_type + operator()(typename _Operation::second_argument_type& __x) const + { return op(value, __x); } + } _GLIBCXX_DEPRECATED; + + /// One of the @link binders binder functors@endlink. + template + inline binder1st<_Operation> + bind1st(const _Operation& __fn, const _Tp& __x) + { + typedef typename _Operation::first_argument_type _Arg1_type; + return binder1st<_Operation>(__fn, _Arg1_type(__x)); + } + + /// One of the @link binders binder functors@endlink. + template + class binder2nd + : public unary_function + { + protected: + _Operation op; + typename _Operation::second_argument_type value; + + public: + binder2nd(const _Operation& __x, + const typename _Operation::second_argument_type& __y) + : op(__x), value(__y) { } + + typename _Operation::result_type + operator()(const typename _Operation::first_argument_type& __x) const + { return op(__x, value); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 109. Missing binders for non-const sequence elements + typename _Operation::result_type + operator()(typename _Operation::first_argument_type& __x) const + { return op(__x, value); } + } _GLIBCXX_DEPRECATED; + + /// One of the @link binders binder functors@endlink. + template + inline binder2nd<_Operation> + bind2nd(const _Operation& __fn, const _Tp& __x) + { + typedef typename _Operation::second_argument_type _Arg2_type; + return binder2nd<_Operation>(__fn, _Arg2_type(__x)); + } + /** @} */ + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#pragma GCC diagnostic pop + +#endif /* _BACKWARD_BINDERS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/backward/hash_fun.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/backward/hash_fun.h new file mode 100644 index 0000000..dc38ad5 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/backward/hash_fun.h @@ -0,0 +1,170 @@ +// 'struct hash' from SGI -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +/** @file backward/hash_fun.h + * This file is a GNU extension to the Standard C++ Library (possibly + * containing extensions from the HP/SGI STL subset). + */ + +#ifndef _BACKWARD_HASH_FUN_H +#define _BACKWARD_HASH_FUN_H 1 + +#include + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + using std::size_t; + + template + struct hash { }; + + inline size_t + __stl_hash_string(const char* __s) + { + unsigned long __h = 0; + for ( ; *__s; ++__s) + __h = 5 * __h + *__s; + return size_t(__h); + } + + template<> + struct hash + { + size_t + operator()(const char* __s) const + { return __stl_hash_string(__s); } + }; + + template<> + struct hash + { + size_t + operator()(const char* __s) const + { return __stl_hash_string(__s); } + }; + + template<> + struct hash + { + size_t + operator()(char __x) const + { return __x; } + }; + + template<> + struct hash + { + size_t + operator()(unsigned char __x) const + { return __x; } + }; + + template<> + struct hash + { + size_t + operator()(unsigned char __x) const + { return __x; } + }; + + template<> + struct hash + { + size_t + operator()(short __x) const + { return __x; } + }; + + template<> + struct hash + { + size_t + operator()(unsigned short __x) const + { return __x; } + }; + + template<> + struct hash + { + size_t + operator()(int __x) const + { return __x; } + }; + + template<> + struct hash + { + size_t + operator()(unsigned int __x) const + { return __x; } + }; + + template<> + struct hash + { + size_t + operator()(long __x) const + { return __x; } + }; + + template<> + struct hash + { + size_t + operator()(unsigned long __x) const + { return __x; } + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/backward/hashtable.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/backward/hashtable.h new file mode 100644 index 0000000..956fe5e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/backward/hashtable.h @@ -0,0 +1,1167 @@ +// Hashtable implementation used by containers -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +/** @file backward/hashtable.h + * This file is a GNU extension to the Standard C++ Library (possibly + * containing extensions from the HP/SGI STL subset). + */ + +#ifndef _BACKWARD_HASHTABLE_H +#define _BACKWARD_HASHTABLE_H 1 + +// Hashtable class, used to implement the hashed associative containers +// hash_set, hash_map, hash_multiset, and hash_multimap. + +#include +#include +#include +#include +#include + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + using std::size_t; + using std::ptrdiff_t; + using std::forward_iterator_tag; + using std::input_iterator_tag; + using std::_Construct; + using std::_Destroy; + using std::distance; + using std::vector; + using std::pair; + using std::__iterator_category; + + template + struct _Hashtable_node + { + _Hashtable_node* _M_next; + _Val _M_val; + }; + + template > + class hashtable; + + template + struct _Hashtable_iterator; + + template + struct _Hashtable_const_iterator; + + template + struct _Hashtable_iterator + { + typedef hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc> + _Hashtable; + typedef _Hashtable_iterator<_Val, _Key, _HashFcn, + _ExtractKey, _EqualKey, _Alloc> + iterator; + typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, + _ExtractKey, _EqualKey, _Alloc> + const_iterator; + typedef _Hashtable_node<_Val> _Node; + typedef forward_iterator_tag iterator_category; + typedef _Val value_type; + typedef ptrdiff_t difference_type; + typedef size_t size_type; + typedef _Val& reference; + typedef _Val* pointer; + + _Node* _M_cur; + _Hashtable* _M_ht; + + _Hashtable_iterator(_Node* __n, _Hashtable* __tab) + : _M_cur(__n), _M_ht(__tab) { } + + _Hashtable_iterator() { } + + reference + operator*() const + { return _M_cur->_M_val; } + + pointer + operator->() const + { return &(operator*()); } + + iterator& + operator++(); + + iterator + operator++(int); + + bool + operator==(const iterator& __it) const + { return _M_cur == __it._M_cur; } + + bool + operator!=(const iterator& __it) const + { return _M_cur != __it._M_cur; } + }; + + template + struct _Hashtable_const_iterator + { + typedef hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc> + _Hashtable; + typedef _Hashtable_iterator<_Val,_Key,_HashFcn, + _ExtractKey,_EqualKey,_Alloc> + iterator; + typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, + _ExtractKey, _EqualKey, _Alloc> + const_iterator; + typedef _Hashtable_node<_Val> _Node; + + typedef forward_iterator_tag iterator_category; + typedef _Val value_type; + typedef ptrdiff_t difference_type; + typedef size_t size_type; + typedef const _Val& reference; + typedef const _Val* pointer; + + const _Node* _M_cur; + const _Hashtable* _M_ht; + + _Hashtable_const_iterator(const _Node* __n, const _Hashtable* __tab) + : _M_cur(__n), _M_ht(__tab) { } + + _Hashtable_const_iterator() { } + + _Hashtable_const_iterator(const iterator& __it) + : _M_cur(__it._M_cur), _M_ht(__it._M_ht) { } + + reference + operator*() const + { return _M_cur->_M_val; } + + pointer + operator->() const + { return &(operator*()); } + + const_iterator& + operator++(); + + const_iterator + operator++(int); + + bool + operator==(const const_iterator& __it) const + { return _M_cur == __it._M_cur; } + + bool + operator!=(const const_iterator& __it) const + { return _M_cur != __it._M_cur; } + }; + + // Note: assumes long is at least 32 bits. + enum { _S_num_primes = 29 }; + + template + struct _Hashtable_prime_list + { + static const _PrimeType __stl_prime_list[_S_num_primes]; + + static const _PrimeType* + _S_get_prime_list(); + }; + + template const _PrimeType + _Hashtable_prime_list<_PrimeType>::__stl_prime_list[_S_num_primes] = + { + 5ul, 53ul, 97ul, 193ul, 389ul, + 769ul, 1543ul, 3079ul, 6151ul, 12289ul, + 24593ul, 49157ul, 98317ul, 196613ul, 393241ul, + 786433ul, 1572869ul, 3145739ul, 6291469ul, 12582917ul, + 25165843ul, 50331653ul, 100663319ul, 201326611ul, 402653189ul, + 805306457ul, 1610612741ul, 3221225473ul, 4294967291ul + }; + + template inline const _PrimeType* + _Hashtable_prime_list<_PrimeType>::_S_get_prime_list() + { + return __stl_prime_list; + } + + inline unsigned long + __stl_next_prime(unsigned long __n) + { + const unsigned long* __first = _Hashtable_prime_list::_S_get_prime_list(); + const unsigned long* __last = __first + (int)_S_num_primes; + const unsigned long* pos = std::lower_bound(__first, __last, __n); + return pos == __last ? *(__last - 1) : *pos; + } + + // Forward declaration of operator==. + template + class hashtable; + + template + bool + operator==(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1, + const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2); + + // Hashtables handle allocators a bit differently than other + // containers do. If we're using standard-conforming allocators, then + // a hashtable unconditionally has a member variable to hold its + // allocator, even if it so happens that all instances of the + // allocator type are identical. This is because, for hashtables, + // this extra storage is negligible. Additionally, a base class + // wouldn't serve any other purposes; it wouldn't, for example, + // simplify the exception-handling code. + template + class hashtable + { + public: + typedef _Key key_type; + typedef _Val value_type; + typedef _HashFcn hasher; + typedef _EqualKey key_equal; + + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + + hasher + hash_funct() const + { return _M_hash; } + + key_equal + key_eq() const + { return _M_equals; } + + private: + typedef _Hashtable_node<_Val> _Node; + + public: + typedef typename _Alloc::template rebind::other allocator_type; + allocator_type + get_allocator() const + { return _M_node_allocator; } + + private: + typedef typename _Alloc::template rebind<_Node>::other _Node_Alloc; + typedef typename _Alloc::template rebind<_Node*>::other _Nodeptr_Alloc; + typedef vector<_Node*, _Nodeptr_Alloc> _Vector_type; + + _Node_Alloc _M_node_allocator; + + _Node* + _M_get_node() + { return _M_node_allocator.allocate(1); } + + void + _M_put_node(_Node* __p) + { _M_node_allocator.deallocate(__p, 1); } + + private: + hasher _M_hash; + key_equal _M_equals; + _ExtractKey _M_get_key; + _Vector_type _M_buckets; + size_type _M_num_elements; + + public: + typedef _Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey, + _EqualKey, _Alloc> + iterator; + typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey, + _EqualKey, _Alloc> + const_iterator; + + friend struct + _Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>; + + friend struct + _Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey, + _EqualKey, _Alloc>; + + public: + hashtable(size_type __n, const _HashFcn& __hf, + const _EqualKey& __eql, const _ExtractKey& __ext, + const allocator_type& __a = allocator_type()) + : _M_node_allocator(__a), _M_hash(__hf), _M_equals(__eql), + _M_get_key(__ext), _M_buckets(__a), _M_num_elements(0) + { _M_initialize_buckets(__n); } + + hashtable(size_type __n, const _HashFcn& __hf, + const _EqualKey& __eql, + const allocator_type& __a = allocator_type()) + : _M_node_allocator(__a), _M_hash(__hf), _M_equals(__eql), + _M_get_key(_ExtractKey()), _M_buckets(__a), _M_num_elements(0) + { _M_initialize_buckets(__n); } + + hashtable(const hashtable& __ht) + : _M_node_allocator(__ht.get_allocator()), _M_hash(__ht._M_hash), + _M_equals(__ht._M_equals), _M_get_key(__ht._M_get_key), + _M_buckets(__ht.get_allocator()), _M_num_elements(0) + { _M_copy_from(__ht); } + + hashtable& + operator= (const hashtable& __ht) + { + if (&__ht != this) + { + clear(); + _M_hash = __ht._M_hash; + _M_equals = __ht._M_equals; + _M_get_key = __ht._M_get_key; + _M_copy_from(__ht); + } + return *this; + } + + ~hashtable() + { clear(); } + + size_type + size() const + { return _M_num_elements; } + + size_type + max_size() const + { return size_type(-1); } + + bool + empty() const + { return size() == 0; } + + void + swap(hashtable& __ht) + { + std::swap(_M_hash, __ht._M_hash); + std::swap(_M_equals, __ht._M_equals); + std::swap(_M_get_key, __ht._M_get_key); + _M_buckets.swap(__ht._M_buckets); + std::swap(_M_num_elements, __ht._M_num_elements); + } + + iterator + begin() + { + for (size_type __n = 0; __n < _M_buckets.size(); ++__n) + if (_M_buckets[__n]) + return iterator(_M_buckets[__n], this); + return end(); + } + + iterator + end() + { return iterator(0, this); } + + const_iterator + begin() const + { + for (size_type __n = 0; __n < _M_buckets.size(); ++__n) + if (_M_buckets[__n]) + return const_iterator(_M_buckets[__n], this); + return end(); + } + + const_iterator + end() const + { return const_iterator(0, this); } + + template + friend bool + operator==(const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&, + const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&); + + public: + size_type + bucket_count() const + { return _M_buckets.size(); } + + size_type + max_bucket_count() const + { return _Hashtable_prime_list:: + _S_get_prime_list()[(int)_S_num_primes - 1]; + } + + size_type + elems_in_bucket(size_type __bucket) const + { + size_type __result = 0; + for (_Node* __n = _M_buckets[__bucket]; __n; __n = __n->_M_next) + __result += 1; + return __result; + } + + pair + insert_unique(const value_type& __obj) + { + resize(_M_num_elements + 1); + return insert_unique_noresize(__obj); + } + + iterator + insert_equal(const value_type& __obj) + { + resize(_M_num_elements + 1); + return insert_equal_noresize(__obj); + } + + pair + insert_unique_noresize(const value_type& __obj); + + iterator + insert_equal_noresize(const value_type& __obj); + + template + void + insert_unique(_InputIterator __f, _InputIterator __l) + { insert_unique(__f, __l, __iterator_category(__f)); } + + template + void + insert_equal(_InputIterator __f, _InputIterator __l) + { insert_equal(__f, __l, __iterator_category(__f)); } + + template + void + insert_unique(_InputIterator __f, _InputIterator __l, + input_iterator_tag) + { + for ( ; __f != __l; ++__f) + insert_unique(*__f); + } + + template + void + insert_equal(_InputIterator __f, _InputIterator __l, + input_iterator_tag) + { + for ( ; __f != __l; ++__f) + insert_equal(*__f); + } + + template + void + insert_unique(_ForwardIterator __f, _ForwardIterator __l, + forward_iterator_tag) + { + size_type __n = distance(__f, __l); + resize(_M_num_elements + __n); + for ( ; __n > 0; --__n, ++__f) + insert_unique_noresize(*__f); + } + + template + void + insert_equal(_ForwardIterator __f, _ForwardIterator __l, + forward_iterator_tag) + { + size_type __n = distance(__f, __l); + resize(_M_num_elements + __n); + for ( ; __n > 0; --__n, ++__f) + insert_equal_noresize(*__f); + } + + reference + find_or_insert(const value_type& __obj); + + iterator + find(const key_type& __key) + { + size_type __n = _M_bkt_num_key(__key); + _Node* __first; + for (__first = _M_buckets[__n]; + __first && !_M_equals(_M_get_key(__first->_M_val), __key); + __first = __first->_M_next) + { } + return iterator(__first, this); + } + + const_iterator + find(const key_type& __key) const + { + size_type __n = _M_bkt_num_key(__key); + const _Node* __first; + for (__first = _M_buckets[__n]; + __first && !_M_equals(_M_get_key(__first->_M_val), __key); + __first = __first->_M_next) + { } + return const_iterator(__first, this); + } + + size_type + count(const key_type& __key) const + { + const size_type __n = _M_bkt_num_key(__key); + size_type __result = 0; + + for (const _Node* __cur = _M_buckets[__n]; __cur; + __cur = __cur->_M_next) + if (_M_equals(_M_get_key(__cur->_M_val), __key)) + ++__result; + return __result; + } + + pair + equal_range(const key_type& __key); + + pair + equal_range(const key_type& __key) const; + + size_type + erase(const key_type& __key); + + void + erase(const iterator& __it); + + void + erase(iterator __first, iterator __last); + + void + erase(const const_iterator& __it); + + void + erase(const_iterator __first, const_iterator __last); + + void + resize(size_type __num_elements_hint); + + void + clear(); + + private: + size_type + _M_next_size(size_type __n) const + { return __stl_next_prime(__n); } + + void + _M_initialize_buckets(size_type __n) + { + const size_type __n_buckets = _M_next_size(__n); + _M_buckets.reserve(__n_buckets); + _M_buckets.insert(_M_buckets.end(), __n_buckets, (_Node*) 0); + _M_num_elements = 0; + } + + size_type + _M_bkt_num_key(const key_type& __key) const + { return _M_bkt_num_key(__key, _M_buckets.size()); } + + size_type + _M_bkt_num(const value_type& __obj) const + { return _M_bkt_num_key(_M_get_key(__obj)); } + + size_type + _M_bkt_num_key(const key_type& __key, size_t __n) const + { return _M_hash(__key) % __n; } + + size_type + _M_bkt_num(const value_type& __obj, size_t __n) const + { return _M_bkt_num_key(_M_get_key(__obj), __n); } + + _Node* + _M_new_node(const value_type& __obj) + { + _Node* __n = _M_get_node(); + __n->_M_next = 0; + __try + { + this->get_allocator().construct(&__n->_M_val, __obj); + return __n; + } + __catch(...) + { + _M_put_node(__n); + __throw_exception_again; + } + } + + void + _M_delete_node(_Node* __n) + { + this->get_allocator().destroy(&__n->_M_val); + _M_put_node(__n); + } + + void + _M_erase_bucket(const size_type __n, _Node* __first, _Node* __last); + + void + _M_erase_bucket(const size_type __n, _Node* __last); + + void + _M_copy_from(const hashtable& __ht); + }; + + template + _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>& + _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>:: + operator++() + { + const _Node* __old = _M_cur; + _M_cur = _M_cur->_M_next; + if (!_M_cur) + { + size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val); + while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size()) + _M_cur = _M_ht->_M_buckets[__bucket]; + } + return *this; + } + + template + inline _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All> + _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>:: + operator++(int) + { + iterator __tmp = *this; + ++*this; + return __tmp; + } + + template + _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>& + _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>:: + operator++() + { + const _Node* __old = _M_cur; + _M_cur = _M_cur->_M_next; + if (!_M_cur) + { + size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val); + while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size()) + _M_cur = _M_ht->_M_buckets[__bucket]; + } + return *this; + } + + template + inline _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All> + _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>:: + operator++(int) + { + const_iterator __tmp = *this; + ++*this; + return __tmp; + } + + template + bool + operator==(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1, + const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2) + { + typedef typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::_Node _Node; + + if (__ht1._M_buckets.size() != __ht2._M_buckets.size()) + return false; + + for (size_t __n = 0; __n < __ht1._M_buckets.size(); ++__n) + { + _Node* __cur1 = __ht1._M_buckets[__n]; + _Node* __cur2 = __ht2._M_buckets[__n]; + // Check same length of lists + for (; __cur1 && __cur2; + __cur1 = __cur1->_M_next, __cur2 = __cur2->_M_next) + { } + if (__cur1 || __cur2) + return false; + // Now check one's elements are in the other + for (__cur1 = __ht1._M_buckets[__n] ; __cur1; + __cur1 = __cur1->_M_next) + { + bool _found__cur1 = false; + for (__cur2 = __ht2._M_buckets[__n]; + __cur2; __cur2 = __cur2->_M_next) + { + if (__cur1->_M_val == __cur2->_M_val) + { + _found__cur1 = true; + break; + } + } + if (!_found__cur1) + return false; + } + } + return true; + } + + template + inline bool + operator!=(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1, + const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2) + { return !(__ht1 == __ht2); } + + template + inline void + swap(hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht1, + hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht2) + { __ht1.swap(__ht2); } + + template + pair::iterator, bool> + hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: + insert_unique_noresize(const value_type& __obj) + { + const size_type __n = _M_bkt_num(__obj); + _Node* __first = _M_buckets[__n]; + + for (_Node* __cur = __first; __cur; __cur = __cur->_M_next) + if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj))) + return pair(iterator(__cur, this), false); + + _Node* __tmp = _M_new_node(__obj); + __tmp->_M_next = __first; + _M_buckets[__n] = __tmp; + ++_M_num_elements; + return pair(iterator(__tmp, this), true); + } + + template + typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator + hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: + insert_equal_noresize(const value_type& __obj) + { + const size_type __n = _M_bkt_num(__obj); + _Node* __first = _M_buckets[__n]; + + for (_Node* __cur = __first; __cur; __cur = __cur->_M_next) + if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj))) + { + _Node* __tmp = _M_new_node(__obj); + __tmp->_M_next = __cur->_M_next; + __cur->_M_next = __tmp; + ++_M_num_elements; + return iterator(__tmp, this); + } + + _Node* __tmp = _M_new_node(__obj); + __tmp->_M_next = __first; + _M_buckets[__n] = __tmp; + ++_M_num_elements; + return iterator(__tmp, this); + } + + template + typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::reference + hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: + find_or_insert(const value_type& __obj) + { + resize(_M_num_elements + 1); + + size_type __n = _M_bkt_num(__obj); + _Node* __first = _M_buckets[__n]; + + for (_Node* __cur = __first; __cur; __cur = __cur->_M_next) + if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj))) + return __cur->_M_val; + + _Node* __tmp = _M_new_node(__obj); + __tmp->_M_next = __first; + _M_buckets[__n] = __tmp; + ++_M_num_elements; + return __tmp->_M_val; + } + + template + pair::iterator, + typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator> + hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: + equal_range(const key_type& __key) + { + typedef pair _Pii; + const size_type __n = _M_bkt_num_key(__key); + + for (_Node* __first = _M_buckets[__n]; __first; + __first = __first->_M_next) + if (_M_equals(_M_get_key(__first->_M_val), __key)) + { + for (_Node* __cur = __first->_M_next; __cur; + __cur = __cur->_M_next) + if (!_M_equals(_M_get_key(__cur->_M_val), __key)) + return _Pii(iterator(__first, this), iterator(__cur, this)); + for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m) + if (_M_buckets[__m]) + return _Pii(iterator(__first, this), + iterator(_M_buckets[__m], this)); + return _Pii(iterator(__first, this), end()); + } + return _Pii(end(), end()); + } + + template + pair::const_iterator, + typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::const_iterator> + hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: + equal_range(const key_type& __key) const + { + typedef pair _Pii; + const size_type __n = _M_bkt_num_key(__key); + + for (const _Node* __first = _M_buckets[__n]; __first; + __first = __first->_M_next) + { + if (_M_equals(_M_get_key(__first->_M_val), __key)) + { + for (const _Node* __cur = __first->_M_next; __cur; + __cur = __cur->_M_next) + if (!_M_equals(_M_get_key(__cur->_M_val), __key)) + return _Pii(const_iterator(__first, this), + const_iterator(__cur, this)); + for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m) + if (_M_buckets[__m]) + return _Pii(const_iterator(__first, this), + const_iterator(_M_buckets[__m], this)); + return _Pii(const_iterator(__first, this), end()); + } + } + return _Pii(end(), end()); + } + + template + typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::size_type + hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: + erase(const key_type& __key) + { + const size_type __n = _M_bkt_num_key(__key); + _Node* __first = _M_buckets[__n]; + _Node* __saved_slot = 0; + size_type __erased = 0; + + if (__first) + { + _Node* __cur = __first; + _Node* __next = __cur->_M_next; + while (__next) + { + if (_M_equals(_M_get_key(__next->_M_val), __key)) + { + if (&_M_get_key(__next->_M_val) != &__key) + { + __cur->_M_next = __next->_M_next; + _M_delete_node(__next); + __next = __cur->_M_next; + ++__erased; + --_M_num_elements; + } + else + { + __saved_slot = __cur; + __cur = __next; + __next = __cur->_M_next; + } + } + else + { + __cur = __next; + __next = __cur->_M_next; + } + } + bool __delete_first = _M_equals(_M_get_key(__first->_M_val), __key); + if (__saved_slot) + { + __next = __saved_slot->_M_next; + __saved_slot->_M_next = __next->_M_next; + _M_delete_node(__next); + ++__erased; + --_M_num_elements; + } + if (__delete_first) + { + _M_buckets[__n] = __first->_M_next; + _M_delete_node(__first); + ++__erased; + --_M_num_elements; + } + } + return __erased; + } + + template + void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: + erase(const iterator& __it) + { + _Node* __p = __it._M_cur; + if (__p) + { + const size_type __n = _M_bkt_num(__p->_M_val); + _Node* __cur = _M_buckets[__n]; + + if (__cur == __p) + { + _M_buckets[__n] = __cur->_M_next; + _M_delete_node(__cur); + --_M_num_elements; + } + else + { + _Node* __next = __cur->_M_next; + while (__next) + { + if (__next == __p) + { + __cur->_M_next = __next->_M_next; + _M_delete_node(__next); + --_M_num_elements; + break; + } + else + { + __cur = __next; + __next = __cur->_M_next; + } + } + } + } + } + + template + void + hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: + erase(iterator __first, iterator __last) + { + size_type __f_bucket = __first._M_cur ? _M_bkt_num(__first._M_cur->_M_val) + : _M_buckets.size(); + + size_type __l_bucket = __last._M_cur ? _M_bkt_num(__last._M_cur->_M_val) + : _M_buckets.size(); + + if (__first._M_cur == __last._M_cur) + return; + else if (__f_bucket == __l_bucket) + _M_erase_bucket(__f_bucket, __first._M_cur, __last._M_cur); + else + { + _M_erase_bucket(__f_bucket, __first._M_cur, 0); + for (size_type __n = __f_bucket + 1; __n < __l_bucket; ++__n) + _M_erase_bucket(__n, 0); + if (__l_bucket != _M_buckets.size()) + _M_erase_bucket(__l_bucket, __last._M_cur); + } + } + + template + inline void + hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: + erase(const_iterator __first, const_iterator __last) + { + erase(iterator(const_cast<_Node*>(__first._M_cur), + const_cast(__first._M_ht)), + iterator(const_cast<_Node*>(__last._M_cur), + const_cast(__last._M_ht))); + } + + template + inline void + hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: + erase(const const_iterator& __it) + { erase(iterator(const_cast<_Node*>(__it._M_cur), + const_cast(__it._M_ht))); } + + template + void + hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: + resize(size_type __num_elements_hint) + { + const size_type __old_n = _M_buckets.size(); + if (__num_elements_hint > __old_n) + { + const size_type __n = _M_next_size(__num_elements_hint); + if (__n > __old_n) + { + _Vector_type __tmp(__n, (_Node*)(0), _M_buckets.get_allocator()); + __try + { + for (size_type __bucket = 0; __bucket < __old_n; ++__bucket) + { + _Node* __first = _M_buckets[__bucket]; + while (__first) + { + size_type __new_bucket = _M_bkt_num(__first->_M_val, + __n); + _M_buckets[__bucket] = __first->_M_next; + __first->_M_next = __tmp[__new_bucket]; + __tmp[__new_bucket] = __first; + __first = _M_buckets[__bucket]; + } + } + _M_buckets.swap(__tmp); + } + __catch(...) + { + for (size_type __bucket = 0; __bucket < __tmp.size(); + ++__bucket) + { + while (__tmp[__bucket]) + { + _Node* __next = __tmp[__bucket]->_M_next; + _M_delete_node(__tmp[__bucket]); + __tmp[__bucket] = __next; + } + } + __throw_exception_again; + } + } + } + } + + template + void + hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: + _M_erase_bucket(const size_type __n, _Node* __first, _Node* __last) + { + _Node* __cur = _M_buckets[__n]; + if (__cur == __first) + _M_erase_bucket(__n, __last); + else + { + _Node* __next; + for (__next = __cur->_M_next; + __next != __first; + __cur = __next, __next = __cur->_M_next) + ; + while (__next != __last) + { + __cur->_M_next = __next->_M_next; + _M_delete_node(__next); + __next = __cur->_M_next; + --_M_num_elements; + } + } + } + + template + void + hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: + _M_erase_bucket(const size_type __n, _Node* __last) + { + _Node* __cur = _M_buckets[__n]; + while (__cur != __last) + { + _Node* __next = __cur->_M_next; + _M_delete_node(__cur); + __cur = __next; + _M_buckets[__n] = __cur; + --_M_num_elements; + } + } + + template + void + hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: + clear() + { + if (_M_num_elements == 0) + return; + + for (size_type __i = 0; __i < _M_buckets.size(); ++__i) + { + _Node* __cur = _M_buckets[__i]; + while (__cur != 0) + { + _Node* __next = __cur->_M_next; + _M_delete_node(__cur); + __cur = __next; + } + _M_buckets[__i] = 0; + } + _M_num_elements = 0; + } + + template + void + hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: + _M_copy_from(const hashtable& __ht) + { + _M_buckets.clear(); + _M_buckets.reserve(__ht._M_buckets.size()); + _M_buckets.insert(_M_buckets.end(), __ht._M_buckets.size(), (_Node*) 0); + __try + { + for (size_type __i = 0; __i < __ht._M_buckets.size(); ++__i) { + const _Node* __cur = __ht._M_buckets[__i]; + if (__cur) + { + _Node* __local_copy = _M_new_node(__cur->_M_val); + _M_buckets[__i] = __local_copy; + + for (_Node* __next = __cur->_M_next; + __next; + __cur = __next, __next = __cur->_M_next) + { + __local_copy->_M_next = _M_new_node(__next->_M_val); + __local_copy = __local_copy->_M_next; + } + } + } + _M_num_elements = __ht._M_num_elements; + } + __catch(...) + { + clear(); + __throw_exception_again; + } + } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/algorithmfwd.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/algorithmfwd.h new file mode 100644 index 0000000..3ff4ff7 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/algorithmfwd.h @@ -0,0 +1,855 @@ +// Forward declarations -*- C++ -*- + +// Copyright (C) 2007-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/algorithmfwd.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{algorithm} + */ + +#ifndef _GLIBCXX_ALGORITHMFWD_H +#define _GLIBCXX_ALGORITHMFWD_H 1 + +#pragma GCC system_header + +#include +#include +#include +#if __cplusplus >= 201103L +#include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /* + adjacent_find + all_of (C++11) + any_of (C++11) + binary_search + clamp (C++17) + copy + copy_backward + copy_if (C++11) + copy_n (C++11) + count + count_if + equal + equal_range + fill + fill_n + find + find_end + find_first_of + find_if + find_if_not (C++11) + for_each + generate + generate_n + includes + inplace_merge + is_heap (C++11) + is_heap_until (C++11) + is_partitioned (C++11) + is_sorted (C++11) + is_sorted_until (C++11) + iter_swap + lexicographical_compare + lower_bound + make_heap + max + max_element + merge + min + min_element + minmax (C++11) + minmax_element (C++11) + mismatch + next_permutation + none_of (C++11) + nth_element + partial_sort + partial_sort_copy + partition + partition_copy (C++11) + partition_point (C++11) + pop_heap + prev_permutation + push_heap + random_shuffle + remove + remove_copy + remove_copy_if + remove_if + replace + replace_copy + replace_copy_if + replace_if + reverse + reverse_copy + rotate + rotate_copy + search + search_n + set_difference + set_intersection + set_symmetric_difference + set_union + shuffle (C++11) + sort + sort_heap + stable_partition + stable_sort + swap + swap_ranges + transform + unique + unique_copy + upper_bound + */ + + /** + * @defgroup algorithms Algorithms + * + * Components for performing algorithmic operations. Includes + * non-modifying sequence, modifying (mutating) sequence, sorting, + * searching, merge, partition, heap, set, minima, maxima, and + * permutation operations. + */ + + /** + * @defgroup mutating_algorithms Mutating + * @ingroup algorithms + */ + + /** + * @defgroup non_mutating_algorithms Non-Mutating + * @ingroup algorithms + */ + + /** + * @defgroup sorting_algorithms Sorting + * @ingroup algorithms + */ + + /** + * @defgroup set_algorithms Set Operation + * @ingroup sorting_algorithms + * + * These algorithms are common set operations performed on sequences + * that are already sorted. The number of comparisons will be + * linear. + */ + + /** + * @defgroup binary_search_algorithms Binary Search + * @ingroup sorting_algorithms + * + * These algorithms are variations of a classic binary search, and + * all assume that the sequence being searched is already sorted. + * + * The number of comparisons will be logarithmic (and as few as + * possible). The number of steps through the sequence will be + * logarithmic for random-access iterators (e.g., pointers), and + * linear otherwise. + * + * The LWG has passed Defect Report 270, which notes: The + * proposed resolution reinterprets binary search. Instead of + * thinking about searching for a value in a sorted range, we view + * that as an important special case of a more general algorithm: + * searching for the partition point in a partitioned range. We + * also add a guarantee that the old wording did not: we ensure that + * the upper bound is no earlier than the lower bound, that the pair + * returned by equal_range is a valid range, and that the first part + * of that pair is the lower bound. + * + * The actual effect of the first sentence is that a comparison + * functor passed by the user doesn't necessarily need to induce a + * strict weak ordering relation. Rather, it partitions the range. + */ + + // adjacent_find + +#if __cplusplus >= 201103L + template + bool + all_of(_IIter, _IIter, _Predicate); + + template + bool + any_of(_IIter, _IIter, _Predicate); +#endif + + template + bool + binary_search(_FIter, _FIter, const _Tp&); + + template + bool + binary_search(_FIter, _FIter, const _Tp&, _Compare); + +#if __cplusplus > 201402L + template + _GLIBCXX14_CONSTEXPR + const _Tp& + clamp(const _Tp&, const _Tp&, const _Tp&); + + template + _GLIBCXX14_CONSTEXPR + const _Tp& + clamp(const _Tp&, const _Tp&, const _Tp&, _Compare); +#endif + + template + _OIter + copy(_IIter, _IIter, _OIter); + + template + _BIter2 + copy_backward(_BIter1, _BIter1, _BIter2); + +#if __cplusplus >= 201103L + template + _OIter + copy_if(_IIter, _IIter, _OIter, _Predicate); + + template + _OIter + copy_n(_IIter, _Size, _OIter); +#endif + + // count + // count_if + + template + pair<_FIter, _FIter> + equal_range(_FIter, _FIter, const _Tp&); + + template + pair<_FIter, _FIter> + equal_range(_FIter, _FIter, const _Tp&, _Compare); + + template + void + fill(_FIter, _FIter, const _Tp&); + + template + _OIter + fill_n(_OIter, _Size, const _Tp&); + + // find + + template + _FIter1 + find_end(_FIter1, _FIter1, _FIter2, _FIter2); + + template + _FIter1 + find_end(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); + + // find_first_of + // find_if + +#if __cplusplus >= 201103L + template + _IIter + find_if_not(_IIter, _IIter, _Predicate); +#endif + + // for_each + // generate + // generate_n + + template + bool + includes(_IIter1, _IIter1, _IIter2, _IIter2); + + template + bool + includes(_IIter1, _IIter1, _IIter2, _IIter2, _Compare); + + template + void + inplace_merge(_BIter, _BIter, _BIter); + + template + void + inplace_merge(_BIter, _BIter, _BIter, _Compare); + +#if __cplusplus >= 201103L + template + bool + is_heap(_RAIter, _RAIter); + + template + bool + is_heap(_RAIter, _RAIter, _Compare); + + template + _RAIter + is_heap_until(_RAIter, _RAIter); + + template + _RAIter + is_heap_until(_RAIter, _RAIter, _Compare); + + template + bool + is_partitioned(_IIter, _IIter, _Predicate); + + template + bool + is_permutation(_FIter1, _FIter1, _FIter2); + + template + bool + is_permutation(_FIter1, _FIter1, _FIter2, _BinaryPredicate); + + template + bool + is_sorted(_FIter, _FIter); + + template + bool + is_sorted(_FIter, _FIter, _Compare); + + template + _FIter + is_sorted_until(_FIter, _FIter); + + template + _FIter + is_sorted_until(_FIter, _FIter, _Compare); +#endif + + template + void + iter_swap(_FIter1, _FIter2); + + template + _FIter + lower_bound(_FIter, _FIter, const _Tp&); + + template + _FIter + lower_bound(_FIter, _FIter, const _Tp&, _Compare); + + template + void + make_heap(_RAIter, _RAIter); + + template + void + make_heap(_RAIter, _RAIter, _Compare); + + template + _GLIBCXX14_CONSTEXPR + const _Tp& + max(const _Tp&, const _Tp&); + + template + _GLIBCXX14_CONSTEXPR + const _Tp& + max(const _Tp&, const _Tp&, _Compare); + + // max_element + // merge + + template + _GLIBCXX14_CONSTEXPR + const _Tp& + min(const _Tp&, const _Tp&); + + template + _GLIBCXX14_CONSTEXPR + const _Tp& + min(const _Tp&, const _Tp&, _Compare); + + // min_element + +#if __cplusplus >= 201103L + template + _GLIBCXX14_CONSTEXPR + pair + minmax(const _Tp&, const _Tp&); + + template + _GLIBCXX14_CONSTEXPR + pair + minmax(const _Tp&, const _Tp&, _Compare); + + template + _GLIBCXX14_CONSTEXPR + pair<_FIter, _FIter> + minmax_element(_FIter, _FIter); + + template + _GLIBCXX14_CONSTEXPR + pair<_FIter, _FIter> + minmax_element(_FIter, _FIter, _Compare); + + template + _GLIBCXX14_CONSTEXPR + _Tp + min(initializer_list<_Tp>); + + template + _GLIBCXX14_CONSTEXPR + _Tp + min(initializer_list<_Tp>, _Compare); + + template + _GLIBCXX14_CONSTEXPR + _Tp + max(initializer_list<_Tp>); + + template + _GLIBCXX14_CONSTEXPR + _Tp + max(initializer_list<_Tp>, _Compare); + + template + _GLIBCXX14_CONSTEXPR + pair<_Tp, _Tp> + minmax(initializer_list<_Tp>); + + template + _GLIBCXX14_CONSTEXPR + pair<_Tp, _Tp> + minmax(initializer_list<_Tp>, _Compare); +#endif + + // mismatch + + template + bool + next_permutation(_BIter, _BIter); + + template + bool + next_permutation(_BIter, _BIter, _Compare); + +#if __cplusplus >= 201103L + template + bool + none_of(_IIter, _IIter, _Predicate); +#endif + + // nth_element + // partial_sort + + template + _RAIter + partial_sort_copy(_IIter, _IIter, _RAIter, _RAIter); + + template + _RAIter + partial_sort_copy(_IIter, _IIter, _RAIter, _RAIter, _Compare); + + // partition + +#if __cplusplus >= 201103L + template + pair<_OIter1, _OIter2> + partition_copy(_IIter, _IIter, _OIter1, _OIter2, _Predicate); + + template + _FIter + partition_point(_FIter, _FIter, _Predicate); +#endif + + template + void + pop_heap(_RAIter, _RAIter); + + template + void + pop_heap(_RAIter, _RAIter, _Compare); + + template + bool + prev_permutation(_BIter, _BIter); + + template + bool + prev_permutation(_BIter, _BIter, _Compare); + + template + void + push_heap(_RAIter, _RAIter); + + template + void + push_heap(_RAIter, _RAIter, _Compare); + + // random_shuffle + + template + _FIter + remove(_FIter, _FIter, const _Tp&); + + template + _FIter + remove_if(_FIter, _FIter, _Predicate); + + template + _OIter + remove_copy(_IIter, _IIter, _OIter, const _Tp&); + + template + _OIter + remove_copy_if(_IIter, _IIter, _OIter, _Predicate); + + // replace + + template + _OIter + replace_copy(_IIter, _IIter, _OIter, const _Tp&, const _Tp&); + + template + _OIter + replace_copy_if(_Iter, _Iter, _OIter, _Predicate, const _Tp&); + + // replace_if + + template + void + reverse(_BIter, _BIter); + + template + _OIter + reverse_copy(_BIter, _BIter, _OIter); + + inline namespace _V2 + { + template + _FIter + rotate(_FIter, _FIter, _FIter); + } + + template + _OIter + rotate_copy(_FIter, _FIter, _FIter, _OIter); + + // search + // search_n + // set_difference + // set_intersection + // set_symmetric_difference + // set_union + +#if (__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99_STDINT_TR1) + template + void + shuffle(_RAIter, _RAIter, _UGenerator&&); +#endif + + template + void + sort_heap(_RAIter, _RAIter); + + template + void + sort_heap(_RAIter, _RAIter, _Compare); + + template + _BIter + stable_partition(_BIter, _BIter, _Predicate); + +#if __cplusplus < 201103L + // For C++11 swap() is declared in . + + template + inline void + swap(_Tp& __a, _Tp& __b); + + template + inline void + swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]); +#endif + + template + _FIter2 + swap_ranges(_FIter1, _FIter1, _FIter2); + + // transform + + template + _FIter + unique(_FIter, _FIter); + + template + _FIter + unique(_FIter, _FIter, _BinaryPredicate); + + // unique_copy + + template + _FIter + upper_bound(_FIter, _FIter, const _Tp&); + + template + _FIter + upper_bound(_FIter, _FIter, const _Tp&, _Compare); + +_GLIBCXX_END_NAMESPACE_VERSION + +_GLIBCXX_BEGIN_NAMESPACE_ALGO + + template + _FIter + adjacent_find(_FIter, _FIter); + + template + _FIter + adjacent_find(_FIter, _FIter, _BinaryPredicate); + + template + typename iterator_traits<_IIter>::difference_type + count(_IIter, _IIter, const _Tp&); + + template + typename iterator_traits<_IIter>::difference_type + count_if(_IIter, _IIter, _Predicate); + + template + bool + equal(_IIter1, _IIter1, _IIter2); + + template + bool + equal(_IIter1, _IIter1, _IIter2, _BinaryPredicate); + + template + _IIter + find(_IIter, _IIter, const _Tp&); + + template + _FIter1 + find_first_of(_FIter1, _FIter1, _FIter2, _FIter2); + + template + _FIter1 + find_first_of(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); + + template + _IIter + find_if(_IIter, _IIter, _Predicate); + + template + _Funct + for_each(_IIter, _IIter, _Funct); + + template + void + generate(_FIter, _FIter, _Generator); + + template + _OIter + generate_n(_OIter, _Size, _Generator); + + template + bool + lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2); + + template + bool + lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, _Compare); + + template + _GLIBCXX14_CONSTEXPR + _FIter + max_element(_FIter, _FIter); + + template + _GLIBCXX14_CONSTEXPR + _FIter + max_element(_FIter, _FIter, _Compare); + + template + _OIter + merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); + + template + _OIter + merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); + + template + _GLIBCXX14_CONSTEXPR + _FIter + min_element(_FIter, _FIter); + + template + _GLIBCXX14_CONSTEXPR + _FIter + min_element(_FIter, _FIter, _Compare); + + template + pair<_IIter1, _IIter2> + mismatch(_IIter1, _IIter1, _IIter2); + + template + pair<_IIter1, _IIter2> + mismatch(_IIter1, _IIter1, _IIter2, _BinaryPredicate); + + template + void + nth_element(_RAIter, _RAIter, _RAIter); + + template + void + nth_element(_RAIter, _RAIter, _RAIter, _Compare); + + template + void + partial_sort(_RAIter, _RAIter, _RAIter); + + template + void + partial_sort(_RAIter, _RAIter, _RAIter, _Compare); + + template + _BIter + partition(_BIter, _BIter, _Predicate); + + template + void + random_shuffle(_RAIter, _RAIter); + + template + void + random_shuffle(_RAIter, _RAIter, +#if __cplusplus >= 201103L + _Generator&&); +#else + _Generator&); +#endif + + template + void + replace(_FIter, _FIter, const _Tp&, const _Tp&); + + template + void + replace_if(_FIter, _FIter, _Predicate, const _Tp&); + + template + _FIter1 + search(_FIter1, _FIter1, _FIter2, _FIter2); + + template + _FIter1 + search(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); + + template + _FIter + search_n(_FIter, _FIter, _Size, const _Tp&); + + template + _FIter + search_n(_FIter, _FIter, _Size, const _Tp&, _BinaryPredicate); + + template + _OIter + set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); + + template + _OIter + set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); + + template + _OIter + set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); + + template + _OIter + set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); + + template + _OIter + set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); + + template + _OIter + set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, + _OIter, _Compare); + + template + _OIter + set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); + + template + _OIter + set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); + + template + void + sort(_RAIter, _RAIter); + + template + void + sort(_RAIter, _RAIter, _Compare); + + template + void + stable_sort(_RAIter, _RAIter); + + template + void + stable_sort(_RAIter, _RAIter, _Compare); + + template + _OIter + transform(_IIter, _IIter, _OIter, _UnaryOperation); + + template + _OIter + transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation); + + template + _OIter + unique_copy(_IIter, _IIter, _OIter); + + template + _OIter + unique_copy(_IIter, _IIter, _OIter, _BinaryPredicate); + +_GLIBCXX_END_NAMESPACE_ALGO +} // namespace std + +#ifdef _GLIBCXX_PARALLEL +# include +#endif + +#endif + diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/alloc_traits.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/alloc_traits.h new file mode 100644 index 0000000..4d1e489 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/alloc_traits.h @@ -0,0 +1,605 @@ +// Allocator traits -*- C++ -*- + +// Copyright (C) 2011-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/alloc_traits.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _ALLOC_TRAITS_H +#define _ALLOC_TRAITS_H 1 + +#if __cplusplus >= 201103L + +#include +#include +#include + +#define __cpp_lib_allocator_traits_is_always_equal 201411 + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + struct __allocator_traits_base + { + template + struct __rebind : __replace_first_arg<_Tp, _Up> { }; + + template + struct __rebind<_Tp, _Up, + __void_t::other>> + { using type = typename _Tp::template rebind<_Up>::other; }; + + protected: + template + using __pointer = typename _Tp::pointer; + template + using __c_pointer = typename _Tp::const_pointer; + template + using __v_pointer = typename _Tp::void_pointer; + template + using __cv_pointer = typename _Tp::const_void_pointer; + template + using __pocca = typename _Tp::propagate_on_container_copy_assignment; + template + using __pocma = typename _Tp::propagate_on_container_move_assignment; + template + using __pocs = typename _Tp::propagate_on_container_swap; + template + using __equal = typename _Tp::is_always_equal; + }; + + template + using __alloc_rebind + = typename __allocator_traits_base::template __rebind<_Alloc, _Up>::type; + + /** + * @brief Uniform interface to all allocator types. + * @ingroup allocators + */ + template + struct allocator_traits : __allocator_traits_base + { + /// The allocator type + typedef _Alloc allocator_type; + /// The allocated type + typedef typename _Alloc::value_type value_type; + + /** + * @brief The allocator's pointer type. + * + * @c Alloc::pointer if that type exists, otherwise @c value_type* + */ + using pointer = __detected_or_t; + + private: + // Select _Func<_Alloc> or pointer_traits::rebind<_Tp> + template class _Func, typename _Tp, typename = void> + struct _Ptr + { + using type = typename pointer_traits::template rebind<_Tp>; + }; + + template class _Func, typename _Tp> + struct _Ptr<_Func, _Tp, __void_t<_Func<_Alloc>>> + { + using type = _Func<_Alloc>; + }; + + // Select _A2::difference_type or pointer_traits<_Ptr>::difference_type + template + struct _Diff + { using type = typename pointer_traits<_PtrT>::difference_type; }; + + template + struct _Diff<_A2, _PtrT, __void_t> + { using type = typename _A2::difference_type; }; + + // Select _A2::size_type or make_unsigned<_DiffT>::type + template + struct _Size : make_unsigned<_DiffT> { }; + + template + struct _Size<_A2, _DiffT, __void_t> + { using type = typename _A2::size_type; }; + + public: + /** + * @brief The allocator's const pointer type. + * + * @c Alloc::const_pointer if that type exists, otherwise + * pointer_traits::rebind + */ + using const_pointer = typename _Ptr<__c_pointer, const value_type>::type; + + /** + * @brief The allocator's void pointer type. + * + * @c Alloc::void_pointer if that type exists, otherwise + * pointer_traits::rebind + */ + using void_pointer = typename _Ptr<__v_pointer, void>::type; + + /** + * @brief The allocator's const void pointer type. + * + * @c Alloc::const_void_pointer if that type exists, otherwise + * pointer_traits::rebind + */ + using const_void_pointer = typename _Ptr<__cv_pointer, const void>::type; + + /** + * @brief The allocator's difference type + * + * @c Alloc::difference_type if that type exists, otherwise + * pointer_traits::difference_type + */ + using difference_type = typename _Diff<_Alloc, pointer>::type; + + /** + * @brief The allocator's size type + * + * @c Alloc::size_type if that type exists, otherwise + * make_unsigned::type + */ + using size_type = typename _Size<_Alloc, difference_type>::type; + + /** + * @brief How the allocator is propagated on copy assignment + * + * @c Alloc::propagate_on_container_copy_assignment if that type exists, + * otherwise @c false_type + */ + using propagate_on_container_copy_assignment + = __detected_or_t; + + /** + * @brief How the allocator is propagated on move assignment + * + * @c Alloc::propagate_on_container_move_assignment if that type exists, + * otherwise @c false_type + */ + using propagate_on_container_move_assignment + = __detected_or_t; + + /** + * @brief How the allocator is propagated on swap + * + * @c Alloc::propagate_on_container_swap if that type exists, + * otherwise @c false_type + */ + using propagate_on_container_swap + = __detected_or_t; + + /** + * @brief Whether all instances of the allocator type compare equal. + * + * @c Alloc::is_always_equal if that type exists, + * otherwise @c is_empty::type + */ + using is_always_equal + = __detected_or_t::type, __equal, _Alloc>; + + template + using rebind_alloc = __alloc_rebind<_Alloc, _Tp>; + template + using rebind_traits = allocator_traits>; + + private: + template + static auto + _S_allocate(_Alloc2& __a, size_type __n, const_void_pointer __hint, int) + -> decltype(__a.allocate(__n, __hint)) + { return __a.allocate(__n, __hint); } + + template + static pointer + _S_allocate(_Alloc2& __a, size_type __n, const_void_pointer, ...) + { return __a.allocate(__n); } + + template + struct __construct_helper + { + template()->construct( + std::declval<_Tp*>(), std::declval<_Args>()...))> + static true_type __test(int); + + template + static false_type __test(...); + + using type = decltype(__test<_Alloc>(0)); + }; + + template + using __has_construct + = typename __construct_helper<_Tp, _Args...>::type; + + template + static _Require<__has_construct<_Tp, _Args...>> + _S_construct(_Alloc& __a, _Tp* __p, _Args&&... __args) + { __a.construct(__p, std::forward<_Args>(__args)...); } + + template + static + _Require<__and_<__not_<__has_construct<_Tp, _Args...>>, + is_constructible<_Tp, _Args...>>> + _S_construct(_Alloc&, _Tp* __p, _Args&&... __args) + { ::new((void*)__p) _Tp(std::forward<_Args>(__args)...); } + + template + static auto + _S_destroy(_Alloc2& __a, _Tp* __p, int) + -> decltype(__a.destroy(__p)) + { __a.destroy(__p); } + + template + static void + _S_destroy(_Alloc2&, _Tp* __p, ...) + { __p->~_Tp(); } + + template + static auto + _S_max_size(_Alloc2& __a, int) + -> decltype(__a.max_size()) + { return __a.max_size(); } + + template + static size_type + _S_max_size(_Alloc2&, ...) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2466. allocator_traits::max_size() default behavior is incorrect + return __gnu_cxx::__numeric_traits::__max + / sizeof(value_type); + } + + template + static auto + _S_select(_Alloc2& __a, int) + -> decltype(__a.select_on_container_copy_construction()) + { return __a.select_on_container_copy_construction(); } + + template + static _Alloc2 + _S_select(_Alloc2& __a, ...) + { return __a; } + + public: + + /** + * @brief Allocate memory. + * @param __a An allocator. + * @param __n The number of objects to allocate space for. + * + * Calls @c a.allocate(n) + */ + static pointer + allocate(_Alloc& __a, size_type __n) + { return __a.allocate(__n); } + + /** + * @brief Allocate memory. + * @param __a An allocator. + * @param __n The number of objects to allocate space for. + * @param __hint Aid to locality. + * @return Memory of suitable size and alignment for @a n objects + * of type @c value_type + * + * Returns a.allocate(n, hint) if that expression is + * well-formed, otherwise returns @c a.allocate(n) + */ + static pointer + allocate(_Alloc& __a, size_type __n, const_void_pointer __hint) + { return _S_allocate(__a, __n, __hint, 0); } + + /** + * @brief Deallocate memory. + * @param __a An allocator. + * @param __p Pointer to the memory to deallocate. + * @param __n The number of objects space was allocated for. + * + * Calls a.deallocate(p, n) + */ + static void + deallocate(_Alloc& __a, pointer __p, size_type __n) + { __a.deallocate(__p, __n); } + + /** + * @brief Construct an object of type @a _Tp + * @param __a An allocator. + * @param __p Pointer to memory of suitable size and alignment for Tp + * @param __args Constructor arguments. + * + * Calls __a.construct(__p, std::forward(__args)...) + * if that expression is well-formed, otherwise uses placement-new + * to construct an object of type @a _Tp at location @a __p from the + * arguments @a __args... + */ + template + static auto construct(_Alloc& __a, _Tp* __p, _Args&&... __args) + -> decltype(_S_construct(__a, __p, std::forward<_Args>(__args)...)) + { _S_construct(__a, __p, std::forward<_Args>(__args)...); } + + /** + * @brief Destroy an object of type @a _Tp + * @param __a An allocator. + * @param __p Pointer to the object to destroy + * + * Calls @c __a.destroy(__p) if that expression is well-formed, + * otherwise calls @c __p->~_Tp() + */ + template + static void destroy(_Alloc& __a, _Tp* __p) + { _S_destroy(__a, __p, 0); } + + /** + * @brief The maximum supported allocation size + * @param __a An allocator. + * @return @c __a.max_size() or @c numeric_limits::max() + * + * Returns @c __a.max_size() if that expression is well-formed, + * otherwise returns @c numeric_limits::max() + */ + static size_type max_size(const _Alloc& __a) noexcept + { return _S_max_size(__a, 0); } + + /** + * @brief Obtain an allocator to use when copying a container. + * @param __rhs An allocator. + * @return @c __rhs.select_on_container_copy_construction() or @a __rhs + * + * Returns @c __rhs.select_on_container_copy_construction() if that + * expression is well-formed, otherwise returns @a __rhs + */ + static _Alloc + select_on_container_copy_construction(const _Alloc& __rhs) + { return _S_select(__rhs, 0); } + }; + + /// Partial specialization for std::allocator. + template + struct allocator_traits> + { + /// The allocator type + using allocator_type = allocator<_Tp>; + /// The allocated type + using value_type = _Tp; + + /// The allocator's pointer type. + using pointer = _Tp*; + + /// The allocator's const pointer type. + using const_pointer = const _Tp*; + + /// The allocator's void pointer type. + using void_pointer = void*; + + /// The allocator's const void pointer type. + using const_void_pointer = const void*; + + /// The allocator's difference type + using difference_type = std::ptrdiff_t; + + /// The allocator's size type + using size_type = std::size_t; + + /// How the allocator is propagated on copy assignment + using propagate_on_container_copy_assignment = false_type; + + /// How the allocator is propagated on move assignment + using propagate_on_container_move_assignment = true_type; + + /// How the allocator is propagated on swap + using propagate_on_container_swap = false_type; + + /// Whether all instances of the allocator type compare equal. + using is_always_equal = true_type; + + template + using rebind_alloc = allocator<_Up>; + + template + using rebind_traits = allocator_traits>; + + /** + * @brief Allocate memory. + * @param __a An allocator. + * @param __n The number of objects to allocate space for. + * + * Calls @c a.allocate(n) + */ + static pointer + allocate(allocator_type& __a, size_type __n) + { return __a.allocate(__n); } + + /** + * @brief Allocate memory. + * @param __a An allocator. + * @param __n The number of objects to allocate space for. + * @param __hint Aid to locality. + * @return Memory of suitable size and alignment for @a n objects + * of type @c value_type + * + * Returns a.allocate(n, hint) + */ + static pointer + allocate(allocator_type& __a, size_type __n, const_void_pointer __hint) + { return __a.allocate(__n, __hint); } + + /** + * @brief Deallocate memory. + * @param __a An allocator. + * @param __p Pointer to the memory to deallocate. + * @param __n The number of objects space was allocated for. + * + * Calls a.deallocate(p, n) + */ + static void + deallocate(allocator_type& __a, pointer __p, size_type __n) + { __a.deallocate(__p, __n); } + + /** + * @brief Construct an object of type @a _Up + * @param __a An allocator. + * @param __p Pointer to memory of suitable size and alignment for Tp + * @param __args Constructor arguments. + * + * Calls __a.construct(__p, std::forward(__args)...) + */ + template + static void + construct(allocator_type& __a, _Up* __p, _Args&&... __args) + { __a.construct(__p, std::forward<_Args>(__args)...); } + + /** + * @brief Destroy an object of type @a _Up + * @param __a An allocator. + * @param __p Pointer to the object to destroy + * + * Calls @c __a.destroy(__p). + */ + template + static void + destroy(allocator_type& __a, _Up* __p) + { __a.destroy(__p); } + + /** + * @brief The maximum supported allocation size + * @param __a An allocator. + * @return @c __a.max_size() + */ + static size_type + max_size(const allocator_type& __a) noexcept + { return __a.max_size(); } + + /** + * @brief Obtain an allocator to use when copying a container. + * @param __rhs An allocator. + * @return @c __rhs + */ + static allocator_type + select_on_container_copy_construction(const allocator_type& __rhs) + { return __rhs; } + }; + + + template + inline void + __do_alloc_on_copy(_Alloc& __one, const _Alloc& __two, true_type) + { __one = __two; } + + template + inline void + __do_alloc_on_copy(_Alloc&, const _Alloc&, false_type) + { } + + template + inline void __alloc_on_copy(_Alloc& __one, const _Alloc& __two) + { + typedef allocator_traits<_Alloc> __traits; + typedef typename __traits::propagate_on_container_copy_assignment __pocca; + __do_alloc_on_copy(__one, __two, __pocca()); + } + + template + inline _Alloc __alloc_on_copy(const _Alloc& __a) + { + typedef allocator_traits<_Alloc> __traits; + return __traits::select_on_container_copy_construction(__a); + } + + template + inline void __do_alloc_on_move(_Alloc& __one, _Alloc& __two, true_type) + { __one = std::move(__two); } + + template + inline void __do_alloc_on_move(_Alloc&, _Alloc&, false_type) + { } + + template + inline void __alloc_on_move(_Alloc& __one, _Alloc& __two) + { + typedef allocator_traits<_Alloc> __traits; + typedef typename __traits::propagate_on_container_move_assignment __pocma; + __do_alloc_on_move(__one, __two, __pocma()); + } + + template + inline void __do_alloc_on_swap(_Alloc& __one, _Alloc& __two, true_type) + { + using std::swap; + swap(__one, __two); + } + + template + inline void __do_alloc_on_swap(_Alloc&, _Alloc&, false_type) + { } + + template + inline void __alloc_on_swap(_Alloc& __one, _Alloc& __two) + { + typedef allocator_traits<_Alloc> __traits; + typedef typename __traits::propagate_on_container_swap __pocs; + __do_alloc_on_swap(__one, __two, __pocs()); + } + + template + class __is_copy_insertable_impl + { + typedef allocator_traits<_Alloc> _Traits; + + template(), + std::declval<_Up*>(), + std::declval()))> + static true_type + _M_select(int); + + template + static false_type + _M_select(...); + + public: + typedef decltype(_M_select(0)) type; + }; + + // true if _Alloc::value_type is CopyInsertable into containers using _Alloc + template + struct __is_copy_insertable + : __is_copy_insertable_impl<_Alloc>::type + { }; + + // std::allocator<_Tp> just requires CopyConstructible + template + struct __is_copy_insertable> + : is_copy_constructible<_Tp> + { }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/allocated_ptr.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/allocated_ptr.h new file mode 100644 index 0000000..773b3f5 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/allocated_ptr.h @@ -0,0 +1,111 @@ +// Guarded Allocation -*- C++ -*- + +// Copyright (C) 2014-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/allocated_ptr.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _ALLOCATED_PTR_H +#define _ALLOCATED_PTR_H 1 + +#if __cplusplus < 201103L +# include +#else +# include +# include +# include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /// Non-standard RAII type for managing pointers obtained from allocators. + template + struct __allocated_ptr + { + using pointer = typename allocator_traits<_Alloc>::pointer; + using value_type = typename allocator_traits<_Alloc>::value_type; + + /// Take ownership of __ptr + __allocated_ptr(_Alloc& __a, pointer __ptr) noexcept + : _M_alloc(std::__addressof(__a)), _M_ptr(__ptr) + { } + + /// Convert __ptr to allocator's pointer type and take ownership of it + template>> + __allocated_ptr(_Alloc& __a, _Ptr __ptr) + : _M_alloc(std::__addressof(__a)), + _M_ptr(pointer_traits::pointer_to(*__ptr)) + { } + + /// Transfer ownership of the owned pointer + __allocated_ptr(__allocated_ptr&& __gd) noexcept + : _M_alloc(__gd._M_alloc), _M_ptr(__gd._M_ptr) + { __gd._M_ptr = nullptr; } + + /// Deallocate the owned pointer + ~__allocated_ptr() + { + if (_M_ptr != nullptr) + std::allocator_traits<_Alloc>::deallocate(*_M_alloc, _M_ptr, 1); + } + + /// Release ownership of the owned pointer + __allocated_ptr& + operator=(std::nullptr_t) noexcept + { + _M_ptr = nullptr; + return *this; + } + + /// Get the address that the owned pointer refers to. + value_type* get() { return _S_raw_ptr(_M_ptr); } + + private: + static value_type* _S_raw_ptr(value_type* __ptr) { return __ptr; } + + template + static auto + _S_raw_ptr(_Ptr __ptr) -> decltype(_S_raw_ptr(__ptr.operator->())) + { return _S_raw_ptr(__ptr.operator->()); } + + _Alloc* _M_alloc; + pointer _M_ptr; + }; + + /// Allocate space for a single object using __a + template + __allocated_ptr<_Alloc> + __allocate_guarded(_Alloc& __a) + { + return { __a, std::allocator_traits<_Alloc>::allocate(__a, 1) }; + } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/allocator.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/allocator.h new file mode 100644 index 0000000..2081386 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/allocator.h @@ -0,0 +1,247 @@ +// Allocators -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * Copyright (c) 1996-1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/allocator.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _ALLOCATOR_H +#define _ALLOCATOR_H 1 + +#include // Define the base class to std::allocator. +#include +#if __cplusplus >= 201103L +#include +#endif + +#define __cpp_lib_incomplete_container_elements 201505 +#if __cplusplus >= 201103L +# define __cpp_lib_allocator_is_always_equal 201411 +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup allocators + * @{ + */ + + /// allocator specialization. + template<> + class allocator + { + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef void* pointer; + typedef const void* const_pointer; + typedef void value_type; + + template + struct rebind + { typedef allocator<_Tp1> other; }; + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2103. std::allocator propagate_on_container_move_assignment + typedef true_type propagate_on_container_move_assignment; + + typedef true_type is_always_equal; + + template + void + construct(_Up* __p, _Args&&... __args) + { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } + + template + void + destroy(_Up* __p) { __p->~_Up(); } +#endif + }; + + /** + * @brief The @a standard allocator, as per [20.4]. + * + * See https://gcc.gnu.org/onlinedocs/libstdc++/manual/memory.html#std.util.memory.allocator + * for further details. + * + * @tparam _Tp Type of allocated object. + */ + template + class allocator: public __allocator_base<_Tp> + { + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Tp* pointer; + typedef const _Tp* const_pointer; + typedef _Tp& reference; + typedef const _Tp& const_reference; + typedef _Tp value_type; + + template + struct rebind + { typedef allocator<_Tp1> other; }; + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2103. std::allocator propagate_on_container_move_assignment + typedef true_type propagate_on_container_move_assignment; + + typedef true_type is_always_equal; +#endif + + allocator() throw() { } + + allocator(const allocator& __a) throw() + : __allocator_base<_Tp>(__a) { } + + template + allocator(const allocator<_Tp1>&) throw() { } + + ~allocator() throw() { } + + // Inherit everything else. + }; + + template + inline bool + operator==(const allocator<_T1>&, const allocator<_T2>&) + _GLIBCXX_USE_NOEXCEPT + { return true; } + + template + inline bool + operator==(const allocator<_Tp>&, const allocator<_Tp>&) + _GLIBCXX_USE_NOEXCEPT + { return true; } + + template + inline bool + operator!=(const allocator<_T1>&, const allocator<_T2>&) + _GLIBCXX_USE_NOEXCEPT + { return false; } + + template + inline bool + operator!=(const allocator<_Tp>&, const allocator<_Tp>&) + _GLIBCXX_USE_NOEXCEPT + { return false; } + + /// @} group allocator + + // Inhibit implicit instantiations for required instantiations, + // which are defined via explicit instantiations elsewhere. +#if _GLIBCXX_EXTERN_TEMPLATE + extern template class allocator; + extern template class allocator; +#endif + + // Undefine. +#undef __allocator_base + + // To implement Option 3 of DR 431. + template + struct __alloc_swap + { static void _S_do_it(_Alloc&, _Alloc&) _GLIBCXX_NOEXCEPT { } }; + + template + struct __alloc_swap<_Alloc, false> + { + static void + _S_do_it(_Alloc& __one, _Alloc& __two) _GLIBCXX_NOEXCEPT + { + // Precondition: swappable allocators. + if (__one != __two) + swap(__one, __two); + } + }; + + // Optimize for stateless allocators. + template + struct __alloc_neq + { + static bool + _S_do_it(const _Alloc&, const _Alloc&) + { return false; } + }; + + template + struct __alloc_neq<_Alloc, false> + { + static bool + _S_do_it(const _Alloc& __one, const _Alloc& __two) + { return __one != __two; } + }; + +#if __cplusplus >= 201103L + template, + is_nothrow_move_constructible>::value> + struct __shrink_to_fit_aux + { static bool _S_do_it(_Tp&) noexcept { return false; } }; + + template + struct __shrink_to_fit_aux<_Tp, true> + { + static bool + _S_do_it(_Tp& __c) noexcept + { +#if __cpp_exceptions + try + { + _Tp(__make_move_if_noexcept_iterator(__c.begin()), + __make_move_if_noexcept_iterator(__c.end()), + __c.get_allocator()).swap(__c); + return true; + } + catch(...) + { return false; } +#else + return false; +#endif + } + }; +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/atomic_base.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/atomic_base.h new file mode 100644 index 0000000..e79ff67 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/atomic_base.h @@ -0,0 +1,796 @@ +// -*- C++ -*- header. + +// Copyright (C) 2008-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/atomic_base.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{atomic} + */ + +#ifndef _GLIBCXX_ATOMIC_BASE_H +#define _GLIBCXX_ATOMIC_BASE_H 1 + +#pragma GCC system_header + +#include +#include +#include + +#ifndef _GLIBCXX_ALWAYS_INLINE +#define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__)) +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @defgroup atomics Atomics + * + * Components for performing atomic operations. + * @{ + */ + + /// Enumeration for memory_order + typedef enum memory_order + { + memory_order_relaxed, + memory_order_consume, + memory_order_acquire, + memory_order_release, + memory_order_acq_rel, + memory_order_seq_cst + } memory_order; + + enum __memory_order_modifier + { + __memory_order_mask = 0x0ffff, + __memory_order_modifier_mask = 0xffff0000, + __memory_order_hle_acquire = 0x10000, + __memory_order_hle_release = 0x20000 + }; + + constexpr memory_order + operator|(memory_order __m, __memory_order_modifier __mod) + { + return memory_order(__m | int(__mod)); + } + + constexpr memory_order + operator&(memory_order __m, __memory_order_modifier __mod) + { + return memory_order(__m & int(__mod)); + } + + // Drop release ordering as per [atomics.types.operations.req]/21 + constexpr memory_order + __cmpexch_failure_order2(memory_order __m) noexcept + { + return __m == memory_order_acq_rel ? memory_order_acquire + : __m == memory_order_release ? memory_order_relaxed : __m; + } + + constexpr memory_order + __cmpexch_failure_order(memory_order __m) noexcept + { + return memory_order(__cmpexch_failure_order2(__m & __memory_order_mask) + | (__m & __memory_order_modifier_mask)); + } + + _GLIBCXX_ALWAYS_INLINE void + atomic_thread_fence(memory_order __m) noexcept + { __atomic_thread_fence(__m); } + + _GLIBCXX_ALWAYS_INLINE void + atomic_signal_fence(memory_order __m) noexcept + { __atomic_signal_fence(__m); } + + /// kill_dependency + template + inline _Tp + kill_dependency(_Tp __y) noexcept + { + _Tp __ret(__y); + return __ret; + } + + + // Base types for atomics. + template + struct __atomic_base; + + +#define ATOMIC_VAR_INIT(_VI) { _VI } + + template + struct atomic; + + template + struct atomic<_Tp*>; + + /* The target's "set" value for test-and-set may not be exactly 1. */ +#if __GCC_ATOMIC_TEST_AND_SET_TRUEVAL == 1 + typedef bool __atomic_flag_data_type; +#else + typedef unsigned char __atomic_flag_data_type; +#endif + + /** + * @brief Base type for atomic_flag. + * + * Base type is POD with data, allowing atomic_flag to derive from + * it and meet the standard layout type requirement. In addition to + * compatibility with a C interface, this allows different + * implementations of atomic_flag to use the same atomic operation + * functions, via a standard conversion to the __atomic_flag_base + * argument. + */ + _GLIBCXX_BEGIN_EXTERN_C + + struct __atomic_flag_base + { + __atomic_flag_data_type _M_i; + }; + + _GLIBCXX_END_EXTERN_C + +#define ATOMIC_FLAG_INIT { 0 } + + /// atomic_flag + struct atomic_flag : public __atomic_flag_base + { + atomic_flag() noexcept = default; + ~atomic_flag() noexcept = default; + atomic_flag(const atomic_flag&) = delete; + atomic_flag& operator=(const atomic_flag&) = delete; + atomic_flag& operator=(const atomic_flag&) volatile = delete; + + // Conversion to ATOMIC_FLAG_INIT. + constexpr atomic_flag(bool __i) noexcept + : __atomic_flag_base{ _S_init(__i) } + { } + + _GLIBCXX_ALWAYS_INLINE bool + test_and_set(memory_order __m = memory_order_seq_cst) noexcept + { + return __atomic_test_and_set (&_M_i, __m); + } + + _GLIBCXX_ALWAYS_INLINE bool + test_and_set(memory_order __m = memory_order_seq_cst) volatile noexcept + { + return __atomic_test_and_set (&_M_i, __m); + } + + _GLIBCXX_ALWAYS_INLINE void + clear(memory_order __m = memory_order_seq_cst) noexcept + { + memory_order __b = __m & __memory_order_mask; + __glibcxx_assert(__b != memory_order_consume); + __glibcxx_assert(__b != memory_order_acquire); + __glibcxx_assert(__b != memory_order_acq_rel); + + __atomic_clear (&_M_i, __m); + } + + _GLIBCXX_ALWAYS_INLINE void + clear(memory_order __m = memory_order_seq_cst) volatile noexcept + { + memory_order __b = __m & __memory_order_mask; + __glibcxx_assert(__b != memory_order_consume); + __glibcxx_assert(__b != memory_order_acquire); + __glibcxx_assert(__b != memory_order_acq_rel); + + __atomic_clear (&_M_i, __m); + } + + private: + static constexpr __atomic_flag_data_type + _S_init(bool __i) + { return __i ? __GCC_ATOMIC_TEST_AND_SET_TRUEVAL : 0; } + }; + + + /// Base class for atomic integrals. + // + // For each of the integral types, define atomic_[integral type] struct + // + // atomic_bool bool + // atomic_char char + // atomic_schar signed char + // atomic_uchar unsigned char + // atomic_short short + // atomic_ushort unsigned short + // atomic_int int + // atomic_uint unsigned int + // atomic_long long + // atomic_ulong unsigned long + // atomic_llong long long + // atomic_ullong unsigned long long + // atomic_char16_t char16_t + // atomic_char32_t char32_t + // atomic_wchar_t wchar_t + // + // NB: Assuming _ITp is an integral scalar type that is 1, 2, 4, or + // 8 bytes, since that is what GCC built-in functions for atomic + // memory access expect. + template + struct __atomic_base + { + private: + typedef _ITp __int_type; + + static constexpr int _S_alignment = + sizeof(_ITp) > alignof(_ITp) ? sizeof(_ITp) : alignof(_ITp); + + alignas(_S_alignment) __int_type _M_i; + + public: + __atomic_base() noexcept = default; + ~__atomic_base() noexcept = default; + __atomic_base(const __atomic_base&) = delete; + __atomic_base& operator=(const __atomic_base&) = delete; + __atomic_base& operator=(const __atomic_base&) volatile = delete; + + // Requires __int_type convertible to _M_i. + constexpr __atomic_base(__int_type __i) noexcept : _M_i (__i) { } + + operator __int_type() const noexcept + { return load(); } + + operator __int_type() const volatile noexcept + { return load(); } + + __int_type + operator=(__int_type __i) noexcept + { + store(__i); + return __i; + } + + __int_type + operator=(__int_type __i) volatile noexcept + { + store(__i); + return __i; + } + + __int_type + operator++(int) noexcept + { return fetch_add(1); } + + __int_type + operator++(int) volatile noexcept + { return fetch_add(1); } + + __int_type + operator--(int) noexcept + { return fetch_sub(1); } + + __int_type + operator--(int) volatile noexcept + { return fetch_sub(1); } + + __int_type + operator++() noexcept + { return __atomic_add_fetch(&_M_i, 1, memory_order_seq_cst); } + + __int_type + operator++() volatile noexcept + { return __atomic_add_fetch(&_M_i, 1, memory_order_seq_cst); } + + __int_type + operator--() noexcept + { return __atomic_sub_fetch(&_M_i, 1, memory_order_seq_cst); } + + __int_type + operator--() volatile noexcept + { return __atomic_sub_fetch(&_M_i, 1, memory_order_seq_cst); } + + __int_type + operator+=(__int_type __i) noexcept + { return __atomic_add_fetch(&_M_i, __i, memory_order_seq_cst); } + + __int_type + operator+=(__int_type __i) volatile noexcept + { return __atomic_add_fetch(&_M_i, __i, memory_order_seq_cst); } + + __int_type + operator-=(__int_type __i) noexcept + { return __atomic_sub_fetch(&_M_i, __i, memory_order_seq_cst); } + + __int_type + operator-=(__int_type __i) volatile noexcept + { return __atomic_sub_fetch(&_M_i, __i, memory_order_seq_cst); } + + __int_type + operator&=(__int_type __i) noexcept + { return __atomic_and_fetch(&_M_i, __i, memory_order_seq_cst); } + + __int_type + operator&=(__int_type __i) volatile noexcept + { return __atomic_and_fetch(&_M_i, __i, memory_order_seq_cst); } + + __int_type + operator|=(__int_type __i) noexcept + { return __atomic_or_fetch(&_M_i, __i, memory_order_seq_cst); } + + __int_type + operator|=(__int_type __i) volatile noexcept + { return __atomic_or_fetch(&_M_i, __i, memory_order_seq_cst); } + + __int_type + operator^=(__int_type __i) noexcept + { return __atomic_xor_fetch(&_M_i, __i, memory_order_seq_cst); } + + __int_type + operator^=(__int_type __i) volatile noexcept + { return __atomic_xor_fetch(&_M_i, __i, memory_order_seq_cst); } + + bool + is_lock_free() const noexcept + { + // Use a fake, minimally aligned pointer. + return __atomic_is_lock_free(sizeof(_M_i), + reinterpret_cast(-__alignof(_M_i))); + } + + bool + is_lock_free() const volatile noexcept + { + // Use a fake, minimally aligned pointer. + return __atomic_is_lock_free(sizeof(_M_i), + reinterpret_cast(-__alignof(_M_i))); + } + + _GLIBCXX_ALWAYS_INLINE void + store(__int_type __i, memory_order __m = memory_order_seq_cst) noexcept + { + memory_order __b = __m & __memory_order_mask; + __glibcxx_assert(__b != memory_order_acquire); + __glibcxx_assert(__b != memory_order_acq_rel); + __glibcxx_assert(__b != memory_order_consume); + + __atomic_store_n(&_M_i, __i, __m); + } + + _GLIBCXX_ALWAYS_INLINE void + store(__int_type __i, + memory_order __m = memory_order_seq_cst) volatile noexcept + { + memory_order __b = __m & __memory_order_mask; + __glibcxx_assert(__b != memory_order_acquire); + __glibcxx_assert(__b != memory_order_acq_rel); + __glibcxx_assert(__b != memory_order_consume); + + __atomic_store_n(&_M_i, __i, __m); + } + + _GLIBCXX_ALWAYS_INLINE __int_type + load(memory_order __m = memory_order_seq_cst) const noexcept + { + memory_order __b = __m & __memory_order_mask; + __glibcxx_assert(__b != memory_order_release); + __glibcxx_assert(__b != memory_order_acq_rel); + + return __atomic_load_n(&_M_i, __m); + } + + _GLIBCXX_ALWAYS_INLINE __int_type + load(memory_order __m = memory_order_seq_cst) const volatile noexcept + { + memory_order __b = __m & __memory_order_mask; + __glibcxx_assert(__b != memory_order_release); + __glibcxx_assert(__b != memory_order_acq_rel); + + return __atomic_load_n(&_M_i, __m); + } + + _GLIBCXX_ALWAYS_INLINE __int_type + exchange(__int_type __i, + memory_order __m = memory_order_seq_cst) noexcept + { + return __atomic_exchange_n(&_M_i, __i, __m); + } + + + _GLIBCXX_ALWAYS_INLINE __int_type + exchange(__int_type __i, + memory_order __m = memory_order_seq_cst) volatile noexcept + { + return __atomic_exchange_n(&_M_i, __i, __m); + } + + _GLIBCXX_ALWAYS_INLINE bool + compare_exchange_weak(__int_type& __i1, __int_type __i2, + memory_order __m1, memory_order __m2) noexcept + { + memory_order __b2 = __m2 & __memory_order_mask; + memory_order __b1 = __m1 & __memory_order_mask; + __glibcxx_assert(__b2 != memory_order_release); + __glibcxx_assert(__b2 != memory_order_acq_rel); + __glibcxx_assert(__b2 <= __b1); + + return __atomic_compare_exchange_n(&_M_i, &__i1, __i2, 1, __m1, __m2); + } + + _GLIBCXX_ALWAYS_INLINE bool + compare_exchange_weak(__int_type& __i1, __int_type __i2, + memory_order __m1, + memory_order __m2) volatile noexcept + { + memory_order __b2 = __m2 & __memory_order_mask; + memory_order __b1 = __m1 & __memory_order_mask; + __glibcxx_assert(__b2 != memory_order_release); + __glibcxx_assert(__b2 != memory_order_acq_rel); + __glibcxx_assert(__b2 <= __b1); + + return __atomic_compare_exchange_n(&_M_i, &__i1, __i2, 1, __m1, __m2); + } + + _GLIBCXX_ALWAYS_INLINE bool + compare_exchange_weak(__int_type& __i1, __int_type __i2, + memory_order __m = memory_order_seq_cst) noexcept + { + return compare_exchange_weak(__i1, __i2, __m, + __cmpexch_failure_order(__m)); + } + + _GLIBCXX_ALWAYS_INLINE bool + compare_exchange_weak(__int_type& __i1, __int_type __i2, + memory_order __m = memory_order_seq_cst) volatile noexcept + { + return compare_exchange_weak(__i1, __i2, __m, + __cmpexch_failure_order(__m)); + } + + _GLIBCXX_ALWAYS_INLINE bool + compare_exchange_strong(__int_type& __i1, __int_type __i2, + memory_order __m1, memory_order __m2) noexcept + { + memory_order __b2 = __m2 & __memory_order_mask; + memory_order __b1 = __m1 & __memory_order_mask; + __glibcxx_assert(__b2 != memory_order_release); + __glibcxx_assert(__b2 != memory_order_acq_rel); + __glibcxx_assert(__b2 <= __b1); + + return __atomic_compare_exchange_n(&_M_i, &__i1, __i2, 0, __m1, __m2); + } + + _GLIBCXX_ALWAYS_INLINE bool + compare_exchange_strong(__int_type& __i1, __int_type __i2, + memory_order __m1, + memory_order __m2) volatile noexcept + { + memory_order __b2 = __m2 & __memory_order_mask; + memory_order __b1 = __m1 & __memory_order_mask; + + __glibcxx_assert(__b2 != memory_order_release); + __glibcxx_assert(__b2 != memory_order_acq_rel); + __glibcxx_assert(__b2 <= __b1); + + return __atomic_compare_exchange_n(&_M_i, &__i1, __i2, 0, __m1, __m2); + } + + _GLIBCXX_ALWAYS_INLINE bool + compare_exchange_strong(__int_type& __i1, __int_type __i2, + memory_order __m = memory_order_seq_cst) noexcept + { + return compare_exchange_strong(__i1, __i2, __m, + __cmpexch_failure_order(__m)); + } + + _GLIBCXX_ALWAYS_INLINE bool + compare_exchange_strong(__int_type& __i1, __int_type __i2, + memory_order __m = memory_order_seq_cst) volatile noexcept + { + return compare_exchange_strong(__i1, __i2, __m, + __cmpexch_failure_order(__m)); + } + + _GLIBCXX_ALWAYS_INLINE __int_type + fetch_add(__int_type __i, + memory_order __m = memory_order_seq_cst) noexcept + { return __atomic_fetch_add(&_M_i, __i, __m); } + + _GLIBCXX_ALWAYS_INLINE __int_type + fetch_add(__int_type __i, + memory_order __m = memory_order_seq_cst) volatile noexcept + { return __atomic_fetch_add(&_M_i, __i, __m); } + + _GLIBCXX_ALWAYS_INLINE __int_type + fetch_sub(__int_type __i, + memory_order __m = memory_order_seq_cst) noexcept + { return __atomic_fetch_sub(&_M_i, __i, __m); } + + _GLIBCXX_ALWAYS_INLINE __int_type + fetch_sub(__int_type __i, + memory_order __m = memory_order_seq_cst) volatile noexcept + { return __atomic_fetch_sub(&_M_i, __i, __m); } + + _GLIBCXX_ALWAYS_INLINE __int_type + fetch_and(__int_type __i, + memory_order __m = memory_order_seq_cst) noexcept + { return __atomic_fetch_and(&_M_i, __i, __m); } + + _GLIBCXX_ALWAYS_INLINE __int_type + fetch_and(__int_type __i, + memory_order __m = memory_order_seq_cst) volatile noexcept + { return __atomic_fetch_and(&_M_i, __i, __m); } + + _GLIBCXX_ALWAYS_INLINE __int_type + fetch_or(__int_type __i, + memory_order __m = memory_order_seq_cst) noexcept + { return __atomic_fetch_or(&_M_i, __i, __m); } + + _GLIBCXX_ALWAYS_INLINE __int_type + fetch_or(__int_type __i, + memory_order __m = memory_order_seq_cst) volatile noexcept + { return __atomic_fetch_or(&_M_i, __i, __m); } + + _GLIBCXX_ALWAYS_INLINE __int_type + fetch_xor(__int_type __i, + memory_order __m = memory_order_seq_cst) noexcept + { return __atomic_fetch_xor(&_M_i, __i, __m); } + + _GLIBCXX_ALWAYS_INLINE __int_type + fetch_xor(__int_type __i, + memory_order __m = memory_order_seq_cst) volatile noexcept + { return __atomic_fetch_xor(&_M_i, __i, __m); } + }; + + + /// Partial specialization for pointer types. + template + struct __atomic_base<_PTp*> + { + private: + typedef _PTp* __pointer_type; + + __pointer_type _M_p; + + // Factored out to facilitate explicit specialization. + constexpr ptrdiff_t + _M_type_size(ptrdiff_t __d) const { return __d * sizeof(_PTp); } + + constexpr ptrdiff_t + _M_type_size(ptrdiff_t __d) const volatile { return __d * sizeof(_PTp); } + + public: + __atomic_base() noexcept = default; + ~__atomic_base() noexcept = default; + __atomic_base(const __atomic_base&) = delete; + __atomic_base& operator=(const __atomic_base&) = delete; + __atomic_base& operator=(const __atomic_base&) volatile = delete; + + // Requires __pointer_type convertible to _M_p. + constexpr __atomic_base(__pointer_type __p) noexcept : _M_p (__p) { } + + operator __pointer_type() const noexcept + { return load(); } + + operator __pointer_type() const volatile noexcept + { return load(); } + + __pointer_type + operator=(__pointer_type __p) noexcept + { + store(__p); + return __p; + } + + __pointer_type + operator=(__pointer_type __p) volatile noexcept + { + store(__p); + return __p; + } + + __pointer_type + operator++(int) noexcept + { return fetch_add(1); } + + __pointer_type + operator++(int) volatile noexcept + { return fetch_add(1); } + + __pointer_type + operator--(int) noexcept + { return fetch_sub(1); } + + __pointer_type + operator--(int) volatile noexcept + { return fetch_sub(1); } + + __pointer_type + operator++() noexcept + { return __atomic_add_fetch(&_M_p, _M_type_size(1), + memory_order_seq_cst); } + + __pointer_type + operator++() volatile noexcept + { return __atomic_add_fetch(&_M_p, _M_type_size(1), + memory_order_seq_cst); } + + __pointer_type + operator--() noexcept + { return __atomic_sub_fetch(&_M_p, _M_type_size(1), + memory_order_seq_cst); } + + __pointer_type + operator--() volatile noexcept + { return __atomic_sub_fetch(&_M_p, _M_type_size(1), + memory_order_seq_cst); } + + __pointer_type + operator+=(ptrdiff_t __d) noexcept + { return __atomic_add_fetch(&_M_p, _M_type_size(__d), + memory_order_seq_cst); } + + __pointer_type + operator+=(ptrdiff_t __d) volatile noexcept + { return __atomic_add_fetch(&_M_p, _M_type_size(__d), + memory_order_seq_cst); } + + __pointer_type + operator-=(ptrdiff_t __d) noexcept + { return __atomic_sub_fetch(&_M_p, _M_type_size(__d), + memory_order_seq_cst); } + + __pointer_type + operator-=(ptrdiff_t __d) volatile noexcept + { return __atomic_sub_fetch(&_M_p, _M_type_size(__d), + memory_order_seq_cst); } + + bool + is_lock_free() const noexcept + { + // Produce a fake, minimally aligned pointer. + return __atomic_is_lock_free(sizeof(_M_p), + reinterpret_cast(-__alignof(_M_p))); + } + + bool + is_lock_free() const volatile noexcept + { + // Produce a fake, minimally aligned pointer. + return __atomic_is_lock_free(sizeof(_M_p), + reinterpret_cast(-__alignof(_M_p))); + } + + _GLIBCXX_ALWAYS_INLINE void + store(__pointer_type __p, + memory_order __m = memory_order_seq_cst) noexcept + { + memory_order __b = __m & __memory_order_mask; + + __glibcxx_assert(__b != memory_order_acquire); + __glibcxx_assert(__b != memory_order_acq_rel); + __glibcxx_assert(__b != memory_order_consume); + + __atomic_store_n(&_M_p, __p, __m); + } + + _GLIBCXX_ALWAYS_INLINE void + store(__pointer_type __p, + memory_order __m = memory_order_seq_cst) volatile noexcept + { + memory_order __b = __m & __memory_order_mask; + __glibcxx_assert(__b != memory_order_acquire); + __glibcxx_assert(__b != memory_order_acq_rel); + __glibcxx_assert(__b != memory_order_consume); + + __atomic_store_n(&_M_p, __p, __m); + } + + _GLIBCXX_ALWAYS_INLINE __pointer_type + load(memory_order __m = memory_order_seq_cst) const noexcept + { + memory_order __b = __m & __memory_order_mask; + __glibcxx_assert(__b != memory_order_release); + __glibcxx_assert(__b != memory_order_acq_rel); + + return __atomic_load_n(&_M_p, __m); + } + + _GLIBCXX_ALWAYS_INLINE __pointer_type + load(memory_order __m = memory_order_seq_cst) const volatile noexcept + { + memory_order __b = __m & __memory_order_mask; + __glibcxx_assert(__b != memory_order_release); + __glibcxx_assert(__b != memory_order_acq_rel); + + return __atomic_load_n(&_M_p, __m); + } + + _GLIBCXX_ALWAYS_INLINE __pointer_type + exchange(__pointer_type __p, + memory_order __m = memory_order_seq_cst) noexcept + { + return __atomic_exchange_n(&_M_p, __p, __m); + } + + + _GLIBCXX_ALWAYS_INLINE __pointer_type + exchange(__pointer_type __p, + memory_order __m = memory_order_seq_cst) volatile noexcept + { + return __atomic_exchange_n(&_M_p, __p, __m); + } + + _GLIBCXX_ALWAYS_INLINE bool + compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2, + memory_order __m1, + memory_order __m2) noexcept + { + memory_order __b2 = __m2 & __memory_order_mask; + memory_order __b1 = __m1 & __memory_order_mask; + __glibcxx_assert(__b2 != memory_order_release); + __glibcxx_assert(__b2 != memory_order_acq_rel); + __glibcxx_assert(__b2 <= __b1); + + return __atomic_compare_exchange_n(&_M_p, &__p1, __p2, 0, __m1, __m2); + } + + _GLIBCXX_ALWAYS_INLINE bool + compare_exchange_strong(__pointer_type& __p1, __pointer_type __p2, + memory_order __m1, + memory_order __m2) volatile noexcept + { + memory_order __b2 = __m2 & __memory_order_mask; + memory_order __b1 = __m1 & __memory_order_mask; + + __glibcxx_assert(__b2 != memory_order_release); + __glibcxx_assert(__b2 != memory_order_acq_rel); + __glibcxx_assert(__b2 <= __b1); + + return __atomic_compare_exchange_n(&_M_p, &__p1, __p2, 0, __m1, __m2); + } + + _GLIBCXX_ALWAYS_INLINE __pointer_type + fetch_add(ptrdiff_t __d, + memory_order __m = memory_order_seq_cst) noexcept + { return __atomic_fetch_add(&_M_p, _M_type_size(__d), __m); } + + _GLIBCXX_ALWAYS_INLINE __pointer_type + fetch_add(ptrdiff_t __d, + memory_order __m = memory_order_seq_cst) volatile noexcept + { return __atomic_fetch_add(&_M_p, _M_type_size(__d), __m); } + + _GLIBCXX_ALWAYS_INLINE __pointer_type + fetch_sub(ptrdiff_t __d, + memory_order __m = memory_order_seq_cst) noexcept + { return __atomic_fetch_sub(&_M_p, _M_type_size(__d), __m); } + + _GLIBCXX_ALWAYS_INLINE __pointer_type + fetch_sub(ptrdiff_t __d, + memory_order __m = memory_order_seq_cst) volatile noexcept + { return __atomic_fetch_sub(&_M_p, _M_type_size(__d), __m); } + }; + + // @} group atomics + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/atomic_futex.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/atomic_futex.h new file mode 100644 index 0000000..afcfeb7 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/atomic_futex.h @@ -0,0 +1,290 @@ +// -*- C++ -*- header. + +// Copyright (C) 2015-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/atomic_futex.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. + */ + +#ifndef _GLIBCXX_ATOMIC_FUTEX_H +#define _GLIBCXX_ATOMIC_FUTEX_H 1 + +#pragma GCC system_header + +#include +#include +#include +#if ! (defined(_GLIBCXX_HAVE_LINUX_FUTEX) && ATOMIC_INT_LOCK_FREE > 1) +#include +#include +#endif + +#ifndef _GLIBCXX_ALWAYS_INLINE +#define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__)) +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) +#if defined(_GLIBCXX_HAVE_LINUX_FUTEX) && ATOMIC_INT_LOCK_FREE > 1 + struct __atomic_futex_unsigned_base + { + // Returns false iff a timeout occurred. + bool + _M_futex_wait_until(unsigned *__addr, unsigned __val, bool __has_timeout, + chrono::seconds __s, chrono::nanoseconds __ns); + + // This can be executed after the object has been destroyed. + static void _M_futex_notify_all(unsigned* __addr); + }; + + template + class __atomic_futex_unsigned : __atomic_futex_unsigned_base + { + typedef chrono::system_clock __clock_t; + + // This must be lock-free and at offset 0. + atomic _M_data; + + public: + explicit + __atomic_futex_unsigned(unsigned __data) : _M_data(__data) + { } + + _GLIBCXX_ALWAYS_INLINE unsigned + _M_load(memory_order __mo) + { + return _M_data.load(__mo) & ~_Waiter_bit; + } + + private: + // If a timeout occurs, returns a current value after the timeout; + // otherwise, returns the operand's value if equal is true or a different + // value if equal is false. + // The assumed value is the caller's assumption about the current value + // when making the call. + unsigned + _M_load_and_test_until(unsigned __assumed, unsigned __operand, + bool __equal, memory_order __mo, bool __has_timeout, + chrono::seconds __s, chrono::nanoseconds __ns) + { + for (;;) + { + // Don't bother checking the value again because we expect the caller + // to have done it recently. + // memory_order_relaxed is sufficient because we can rely on just the + // modification order (store_notify uses an atomic RMW operation too), + // and the futex syscalls synchronize between themselves. + _M_data.fetch_or(_Waiter_bit, memory_order_relaxed); + bool __ret = _M_futex_wait_until((unsigned*)(void*)&_M_data, + __assumed | _Waiter_bit, + __has_timeout, __s, __ns); + // Fetch the current value after waiting (clears _Waiter_bit). + __assumed = _M_load(__mo); + if (!__ret || ((__operand == __assumed) == __equal)) + return __assumed; + // TODO adapt wait time + } + } + + // Returns the operand's value if equal is true or a different value if + // equal is false. + // The assumed value is the caller's assumption about the current value + // when making the call. + unsigned + _M_load_and_test(unsigned __assumed, unsigned __operand, + bool __equal, memory_order __mo) + { + return _M_load_and_test_until(__assumed, __operand, __equal, __mo, + false, {}, {}); + } + + // If a timeout occurs, returns a current value after the timeout; + // otherwise, returns the operand's value if equal is true or a different + // value if equal is false. + // The assumed value is the caller's assumption about the current value + // when making the call. + template + unsigned + _M_load_and_test_until_impl(unsigned __assumed, unsigned __operand, + bool __equal, memory_order __mo, + const chrono::time_point<__clock_t, _Dur>& __atime) + { + auto __s = chrono::time_point_cast(__atime); + auto __ns = chrono::duration_cast(__atime - __s); + // XXX correct? + return _M_load_and_test_until(__assumed, __operand, __equal, __mo, + true, __s.time_since_epoch(), __ns); + } + + public: + + _GLIBCXX_ALWAYS_INLINE unsigned + _M_load_when_not_equal(unsigned __val, memory_order __mo) + { + unsigned __i = _M_load(__mo); + if ((__i & ~_Waiter_bit) != __val) + return (__i & ~_Waiter_bit); + // TODO Spin-wait first. + return _M_load_and_test(__i, __val, false, __mo); + } + + _GLIBCXX_ALWAYS_INLINE void + _M_load_when_equal(unsigned __val, memory_order __mo) + { + unsigned __i = _M_load(__mo); + if ((__i & ~_Waiter_bit) == __val) + return; + // TODO Spin-wait first. + _M_load_and_test(__i, __val, true, __mo); + } + + // Returns false iff a timeout occurred. + template + _GLIBCXX_ALWAYS_INLINE bool + _M_load_when_equal_for(unsigned __val, memory_order __mo, + const chrono::duration<_Rep, _Period>& __rtime) + { + return _M_load_when_equal_until(__val, __mo, + __clock_t::now() + __rtime); + } + + // Returns false iff a timeout occurred. + template + _GLIBCXX_ALWAYS_INLINE bool + _M_load_when_equal_until(unsigned __val, memory_order __mo, + const chrono::time_point<_Clock, _Duration>& __atime) + { + // DR 887 - Sync unknown clock to known clock. + const typename _Clock::time_point __c_entry = _Clock::now(); + const __clock_t::time_point __s_entry = __clock_t::now(); + const auto __delta = __atime - __c_entry; + const auto __s_atime = __s_entry + __delta; + return _M_load_when_equal_until(__val, __mo, __s_atime); + } + + // Returns false iff a timeout occurred. + template + _GLIBCXX_ALWAYS_INLINE bool + _M_load_when_equal_until(unsigned __val, memory_order __mo, + const chrono::time_point<__clock_t, _Duration>& __atime) + { + unsigned __i = _M_load(__mo); + if ((__i & ~_Waiter_bit) == __val) + return true; + // TODO Spin-wait first. Ignore effect on timeout. + __i = _M_load_and_test_until_impl(__i, __val, true, __mo, __atime); + return (__i & ~_Waiter_bit) == __val; + } + + _GLIBCXX_ALWAYS_INLINE void + _M_store_notify_all(unsigned __val, memory_order __mo) + { + unsigned* __futex = (unsigned *)(void *)&_M_data; + if (_M_data.exchange(__val, __mo) & _Waiter_bit) + _M_futex_notify_all(__futex); + } + }; + +#else // ! (_GLIBCXX_HAVE_LINUX_FUTEX && ATOMIC_INT_LOCK_FREE > 1) + + // If futexes are not available, use a mutex and a condvar to wait. + // Because we access the data only within critical sections, all accesses + // are sequentially consistent; thus, we satisfy any provided memory_order. + template + class __atomic_futex_unsigned + { + typedef chrono::system_clock __clock_t; + + unsigned _M_data; + mutex _M_mutex; + condition_variable _M_condvar; + + public: + explicit + __atomic_futex_unsigned(unsigned __data) : _M_data(__data) + { } + + _GLIBCXX_ALWAYS_INLINE unsigned + _M_load(memory_order __mo) + { + unique_lock __lock(_M_mutex); + return _M_data; + } + + _GLIBCXX_ALWAYS_INLINE unsigned + _M_load_when_not_equal(unsigned __val, memory_order __mo) + { + unique_lock __lock(_M_mutex); + while (_M_data == __val) + _M_condvar.wait(__lock); + return _M_data; + } + + _GLIBCXX_ALWAYS_INLINE void + _M_load_when_equal(unsigned __val, memory_order __mo) + { + unique_lock __lock(_M_mutex); + while (_M_data != __val) + _M_condvar.wait(__lock); + } + + template + _GLIBCXX_ALWAYS_INLINE bool + _M_load_when_equal_for(unsigned __val, memory_order __mo, + const chrono::duration<_Rep, _Period>& __rtime) + { + unique_lock __lock(_M_mutex); + return _M_condvar.wait_for(__lock, __rtime, + [&] { return _M_data == __val;}); + } + + template + _GLIBCXX_ALWAYS_INLINE bool + _M_load_when_equal_until(unsigned __val, memory_order __mo, + const chrono::time_point<_Clock, _Duration>& __atime) + { + unique_lock __lock(_M_mutex); + return _M_condvar.wait_until(__lock, __atime, + [&] { return _M_data == __val;}); + } + + _GLIBCXX_ALWAYS_INLINE void + _M_store_notify_all(unsigned __val, memory_order __mo) + { + unique_lock __lock(_M_mutex); + _M_data = __val; + _M_condvar.notify_all(); + } + }; + +#endif // _GLIBCXX_HAVE_LINUX_FUTEX && ATOMIC_INT_LOCK_FREE > 1 +#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/atomic_lockfree_defines.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/atomic_lockfree_defines.h new file mode 100644 index 0000000..9aa4142 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/atomic_lockfree_defines.h @@ -0,0 +1,63 @@ +// -*- C++ -*- header. + +// Copyright (C) 2008-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/atomic_lockfree_defines.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{atomic} + */ + +#ifndef _GLIBCXX_ATOMIC_LOCK_FREE_H +#define _GLIBCXX_ATOMIC_LOCK_FREE_H 1 + +#pragma GCC system_header + +/** + * @addtogroup atomics + * @{ + */ + +/** + * Lock-free property. + * + * 0 indicates that the types are never lock-free. + * 1 indicates that the types are sometimes lock-free. + * 2 indicates that the types are always lock-free. + */ + +#if __cplusplus >= 201103L +#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE +#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE +#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE +#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE +#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE +#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE +#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE +#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE +#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE +#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE +#endif + +// @} group atomics + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/basic_ios.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/basic_ios.h new file mode 100644 index 0000000..f0b8682 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/basic_ios.h @@ -0,0 +1,518 @@ +// Iostreams base classes -*- C++ -*- + +// Copyright (C) 1997-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/basic_ios.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{ios} + */ + +#ifndef _BASIC_IOS_H +#define _BASIC_IOS_H 1 + +#pragma GCC system_header + +#include +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + inline const _Facet& + __check_facet(const _Facet* __f) + { + if (!__f) + __throw_bad_cast(); + return *__f; + } + + /** + * @brief Template class basic_ios, virtual base class for all + * stream classes. + * @ingroup io + * + * @tparam _CharT Type of character stream. + * @tparam _Traits Traits for character type, defaults to + * char_traits<_CharT>. + * + * Most of the member functions called dispatched on stream objects + * (e.g., @c std::cout.foo(bar);) are consolidated in this class. + */ + template + class basic_ios : public ios_base + { + public: + //@{ + /** + * These are standard types. They permit a standardized way of + * referring to names of (or names dependent on) the template + * parameters, which are specific to the implementation. + */ + typedef _CharT char_type; + typedef typename _Traits::int_type int_type; + typedef typename _Traits::pos_type pos_type; + typedef typename _Traits::off_type off_type; + typedef _Traits traits_type; + //@} + + //@{ + /** + * These are non-standard types. + */ + typedef ctype<_CharT> __ctype_type; + typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> > + __num_put_type; + typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > + __num_get_type; + //@} + + // Data members: + protected: + basic_ostream<_CharT, _Traits>* _M_tie; + mutable char_type _M_fill; + mutable bool _M_fill_init; + basic_streambuf<_CharT, _Traits>* _M_streambuf; + + // Cached use_facet, which is based on the current locale info. + const __ctype_type* _M_ctype; + // For ostream. + const __num_put_type* _M_num_put; + // For istream. + const __num_get_type* _M_num_get; + + public: + //@{ + /** + * @brief The quick-and-easy status check. + * + * This allows you to write constructs such as + * if (!a_stream) ... and while (a_stream) ... + */ +#if __cplusplus >= 201103L + explicit operator bool() const + { return !this->fail(); } +#else + operator void*() const + { return this->fail() ? 0 : const_cast(this); } +#endif + + bool + operator!() const + { return this->fail(); } + //@} + + /** + * @brief Returns the error state of the stream buffer. + * @return A bit pattern (well, isn't everything?) + * + * See std::ios_base::iostate for the possible bit values. Most + * users will call one of the interpreting wrappers, e.g., good(). + */ + iostate + rdstate() const + { return _M_streambuf_state; } + + /** + * @brief [Re]sets the error state. + * @param __state The new state flag(s) to set. + * + * See std::ios_base::iostate for the possible bit values. Most + * users will not need to pass an argument. + */ + void + clear(iostate __state = goodbit); + + /** + * @brief Sets additional flags in the error state. + * @param __state The additional state flag(s) to set. + * + * See std::ios_base::iostate for the possible bit values. + */ + void + setstate(iostate __state) + { this->clear(this->rdstate() | __state); } + + // Flip the internal state on for the proper state bits, then + // rethrows the propagated exception if bit also set in + // exceptions(). + void + _M_setstate(iostate __state) + { + // 27.6.1.2.1 Common requirements. + // Turn this on without causing an ios::failure to be thrown. + _M_streambuf_state |= __state; + if (this->exceptions() & __state) + __throw_exception_again; + } + + /** + * @brief Fast error checking. + * @return True if no error flags are set. + * + * A wrapper around rdstate. + */ + bool + good() const + { return this->rdstate() == 0; } + + /** + * @brief Fast error checking. + * @return True if the eofbit is set. + * + * Note that other iostate flags may also be set. + */ + bool + eof() const + { return (this->rdstate() & eofbit) != 0; } + + /** + * @brief Fast error checking. + * @return True if either the badbit or the failbit is set. + * + * Checking the badbit in fail() is historical practice. + * Note that other iostate flags may also be set. + */ + bool + fail() const + { return (this->rdstate() & (badbit | failbit)) != 0; } + + /** + * @brief Fast error checking. + * @return True if the badbit is set. + * + * Note that other iostate flags may also be set. + */ + bool + bad() const + { return (this->rdstate() & badbit) != 0; } + + /** + * @brief Throwing exceptions on errors. + * @return The current exceptions mask. + * + * This changes nothing in the stream. See the one-argument version + * of exceptions(iostate) for the meaning of the return value. + */ + iostate + exceptions() const + { return _M_exception; } + + /** + * @brief Throwing exceptions on errors. + * @param __except The new exceptions mask. + * + * By default, error flags are set silently. You can set an + * exceptions mask for each stream; if a bit in the mask becomes set + * in the error flags, then an exception of type + * std::ios_base::failure is thrown. + * + * If the error flag is already set when the exceptions mask is + * added, the exception is immediately thrown. Try running the + * following under GCC 3.1 or later: + * @code + * #include + * #include + * #include + * + * int main() + * { + * std::set_terminate (__gnu_cxx::__verbose_terminate_handler); + * + * std::ifstream f ("/etc/motd"); + * + * std::cerr << "Setting badbit\n"; + * f.setstate (std::ios_base::badbit); + * + * std::cerr << "Setting exception mask\n"; + * f.exceptions (std::ios_base::badbit); + * } + * @endcode + */ + void + exceptions(iostate __except) + { + _M_exception = __except; + this->clear(_M_streambuf_state); + } + + // Constructor/destructor: + /** + * @brief Constructor performs initialization. + * + * The parameter is passed by derived streams. + */ + explicit + basic_ios(basic_streambuf<_CharT, _Traits>* __sb) + : ios_base(), _M_tie(0), _M_fill(), _M_fill_init(false), _M_streambuf(0), + _M_ctype(0), _M_num_put(0), _M_num_get(0) + { this->init(__sb); } + + /** + * @brief Empty. + * + * The destructor does nothing. More specifically, it does not + * destroy the streambuf held by rdbuf(). + */ + virtual + ~basic_ios() { } + + // Members: + /** + * @brief Fetches the current @e tied stream. + * @return A pointer to the tied stream, or NULL if the stream is + * not tied. + * + * A stream may be @e tied (or synchronized) to a second output + * stream. When this stream performs any I/O, the tied stream is + * first flushed. For example, @c std::cin is tied to @c std::cout. + */ + basic_ostream<_CharT, _Traits>* + tie() const + { return _M_tie; } + + /** + * @brief Ties this stream to an output stream. + * @param __tiestr The output stream. + * @return The previously tied output stream, or NULL if the stream + * was not tied. + * + * This sets up a new tie; see tie() for more. + */ + basic_ostream<_CharT, _Traits>* + tie(basic_ostream<_CharT, _Traits>* __tiestr) + { + basic_ostream<_CharT, _Traits>* __old = _M_tie; + _M_tie = __tiestr; + return __old; + } + + /** + * @brief Accessing the underlying buffer. + * @return The current stream buffer. + * + * This does not change the state of the stream. + */ + basic_streambuf<_CharT, _Traits>* + rdbuf() const + { return _M_streambuf; } + + /** + * @brief Changing the underlying buffer. + * @param __sb The new stream buffer. + * @return The previous stream buffer. + * + * Associates a new buffer with the current stream, and clears the + * error state. + * + * Due to historical accidents which the LWG refuses to correct, the + * I/O library suffers from a design error: this function is hidden + * in derived classes by overrides of the zero-argument @c rdbuf(), + * which is non-virtual for hysterical raisins. As a result, you + * must use explicit qualifications to access this function via any + * derived class. For example: + * + * @code + * std::fstream foo; // or some other derived type + * std::streambuf* p = .....; + * + * foo.ios::rdbuf(p); // ios == basic_ios + * @endcode + */ + basic_streambuf<_CharT, _Traits>* + rdbuf(basic_streambuf<_CharT, _Traits>* __sb); + + /** + * @brief Copies fields of __rhs into this. + * @param __rhs The source values for the copies. + * @return Reference to this object. + * + * All fields of __rhs are copied into this object except that rdbuf() + * and rdstate() remain unchanged. All values in the pword and iword + * arrays are copied. Before copying, each callback is invoked with + * erase_event. After copying, each (new) callback is invoked with + * copyfmt_event. The final step is to copy exceptions(). + */ + basic_ios& + copyfmt(const basic_ios& __rhs); + + /** + * @brief Retrieves the @a empty character. + * @return The current fill character. + * + * It defaults to a space (' ') in the current locale. + */ + char_type + fill() const + { + if (!_M_fill_init) + { + _M_fill = this->widen(' '); + _M_fill_init = true; + } + return _M_fill; + } + + /** + * @brief Sets a new @a empty character. + * @param __ch The new character. + * @return The previous fill character. + * + * The fill character is used to fill out space when P+ characters + * have been requested (e.g., via setw), Q characters are actually + * used, and Qfill(); + _M_fill = __ch; + return __old; + } + + // Locales: + /** + * @brief Moves to a new locale. + * @param __loc The new locale. + * @return The previous locale. + * + * Calls @c ios_base::imbue(loc), and if a stream buffer is associated + * with this stream, calls that buffer's @c pubimbue(loc). + * + * Additional l10n notes are at + * http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html + */ + locale + imbue(const locale& __loc); + + /** + * @brief Squeezes characters. + * @param __c The character to narrow. + * @param __dfault The character to narrow. + * @return The narrowed character. + * + * Maps a character of @c char_type to a character of @c char, + * if possible. + * + * Returns the result of + * @code + * std::use_facet >(getloc()).narrow(c,dfault) + * @endcode + * + * Additional l10n notes are at + * http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html + */ + char + narrow(char_type __c, char __dfault) const + { return __check_facet(_M_ctype).narrow(__c, __dfault); } + + /** + * @brief Widens characters. + * @param __c The character to widen. + * @return The widened character. + * + * Maps a character of @c char to a character of @c char_type. + * + * Returns the result of + * @code + * std::use_facet >(getloc()).widen(c) + * @endcode + * + * Additional l10n notes are at + * http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html + */ + char_type + widen(char __c) const + { return __check_facet(_M_ctype).widen(__c); } + + protected: + // 27.4.5.1 basic_ios constructors + /** + * @brief Empty. + * + * The default constructor does nothing and is not normally + * accessible to users. + */ + basic_ios() + : ios_base(), _M_tie(0), _M_fill(char_type()), _M_fill_init(false), + _M_streambuf(0), _M_ctype(0), _M_num_put(0), _M_num_get(0) + { } + + /** + * @brief All setup is performed here. + * + * This is called from the public constructor. It is not virtual and + * cannot be redefined. + */ + void + init(basic_streambuf<_CharT, _Traits>* __sb); + +#if __cplusplus >= 201103L + basic_ios(const basic_ios&) = delete; + basic_ios& operator=(const basic_ios&) = delete; + + void + move(basic_ios& __rhs) + { + ios_base::_M_move(__rhs); + _M_cache_locale(_M_ios_locale); + this->tie(__rhs.tie(nullptr)); + _M_fill = __rhs._M_fill; + _M_fill_init = __rhs._M_fill_init; + _M_streambuf = nullptr; + } + + void + move(basic_ios&& __rhs) + { this->move(__rhs); } + + void + swap(basic_ios& __rhs) noexcept + { + ios_base::_M_swap(__rhs); + _M_cache_locale(_M_ios_locale); + __rhs._M_cache_locale(__rhs._M_ios_locale); + std::swap(_M_tie, __rhs._M_tie); + std::swap(_M_fill, __rhs._M_fill); + std::swap(_M_fill_init, __rhs._M_fill_init); + } + + void + set_rdbuf(basic_streambuf<_CharT, _Traits>* __sb) + { _M_streambuf = __sb; } +#endif + + void + _M_cache_locale(const locale& __loc); + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#include + +#endif /* _BASIC_IOS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/basic_string.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/basic_string.h new file mode 100644 index 0000000..7df3968 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/basic_string.h @@ -0,0 +1,6694 @@ +// Components for manipulating sequences of characters -*- C++ -*- + +// Copyright (C) 1997-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/basic_string.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{string} + */ + +// +// ISO C++ 14882: 21 Strings library +// + +#ifndef _BASIC_STRING_H +#define _BASIC_STRING_H 1 + +#pragma GCC system_header + +#include +#include +#include + +#if __cplusplus >= 201103L +#include +#endif + +#if __cplusplus > 201402L +# include +#endif + + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#if _GLIBCXX_USE_CXX11_ABI +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + /** + * @class basic_string basic_string.h + * @brief Managing sequences of characters and character-like objects. + * + * @ingroup strings + * @ingroup sequences + * + * @tparam _CharT Type of character + * @tparam _Traits Traits for character type, defaults to + * char_traits<_CharT>. + * @tparam _Alloc Allocator type, defaults to allocator<_CharT>. + * + * Meets the requirements of a container, a + * reversible container, and a + * sequence. Of the + * optional sequence requirements, only + * @c push_back, @c at, and @c %array access are supported. + */ + template + class basic_string + { + typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template + rebind<_CharT>::other _Char_alloc_type; + typedef __gnu_cxx::__alloc_traits<_Char_alloc_type> _Alloc_traits; + + // Types: + public: + typedef _Traits traits_type; + typedef typename _Traits::char_type value_type; + typedef _Char_alloc_type allocator_type; + typedef typename _Alloc_traits::size_type size_type; + typedef typename _Alloc_traits::difference_type difference_type; + typedef typename _Alloc_traits::reference reference; + typedef typename _Alloc_traits::const_reference const_reference; + typedef typename _Alloc_traits::pointer pointer; + typedef typename _Alloc_traits::const_pointer const_pointer; + typedef __gnu_cxx::__normal_iterator iterator; + typedef __gnu_cxx::__normal_iterator + const_iterator; + typedef std::reverse_iterator const_reverse_iterator; + typedef std::reverse_iterator reverse_iterator; + + /// Value returned by various member functions when they fail. + static const size_type npos = static_cast(-1); + + private: + // type used for positions in insert, erase etc. +#if __cplusplus < 201103L + typedef iterator __const_iterator; +#else + typedef const_iterator __const_iterator; +#endif + +#if __cplusplus > 201402L + // A helper type for avoiding boiler-plate. + typedef basic_string_view<_CharT, _Traits> __sv_type; + + template + using _If_sv = enable_if_t< + __and_, + __not_>, + __not_>>::value, + _Res>; + + // Allows an implicit conversion to __sv_type. + static __sv_type + _S_to_string_view(__sv_type __svt) noexcept + { return __svt; } + + // Wraps a string_view by explicit conversion and thus + // allows to add an internal constructor that does not + // participate in overload resolution when a string_view + // is provided. + struct __sv_wrapper + { + explicit __sv_wrapper(__sv_type __sv) noexcept : _M_sv(__sv) { } + __sv_type _M_sv; + }; +#endif + + // Use empty-base optimization: http://www.cantrip.org/emptyopt.html + struct _Alloc_hider : allocator_type // TODO check __is_final + { +#if __cplusplus < 201103L + _Alloc_hider(pointer __dat, const _Alloc& __a = _Alloc()) + : allocator_type(__a), _M_p(__dat) { } +#else + _Alloc_hider(pointer __dat, const _Alloc& __a) + : allocator_type(__a), _M_p(__dat) { } + + _Alloc_hider(pointer __dat, _Alloc&& __a = _Alloc()) + : allocator_type(std::move(__a)), _M_p(__dat) { } +#endif + + pointer _M_p; // The actual data. + }; + + _Alloc_hider _M_dataplus; + size_type _M_string_length; + + enum { _S_local_capacity = 15 / sizeof(_CharT) }; + + union + { + _CharT _M_local_buf[_S_local_capacity + 1]; + size_type _M_allocated_capacity; + }; + + void + _M_data(pointer __p) + { _M_dataplus._M_p = __p; } + + void + _M_length(size_type __length) + { _M_string_length = __length; } + + pointer + _M_data() const + { return _M_dataplus._M_p; } + + pointer + _M_local_data() + { +#if __cplusplus >= 201103L + return std::pointer_traits::pointer_to(*_M_local_buf); +#else + return pointer(_M_local_buf); +#endif + } + + const_pointer + _M_local_data() const + { +#if __cplusplus >= 201103L + return std::pointer_traits::pointer_to(*_M_local_buf); +#else + return const_pointer(_M_local_buf); +#endif + } + + void + _M_capacity(size_type __capacity) + { _M_allocated_capacity = __capacity; } + + void + _M_set_length(size_type __n) + { + _M_length(__n); + traits_type::assign(_M_data()[__n], _CharT()); + } + + bool + _M_is_local() const + { return _M_data() == _M_local_data(); } + + // Create & Destroy + pointer + _M_create(size_type&, size_type); + + void + _M_dispose() + { + if (!_M_is_local()) + _M_destroy(_M_allocated_capacity); + } + + void + _M_destroy(size_type __size) throw() + { _Alloc_traits::deallocate(_M_get_allocator(), _M_data(), __size + 1); } + + // _M_construct_aux is used to implement the 21.3.1 para 15 which + // requires special behaviour if _InIterator is an integral type + template + void + _M_construct_aux(_InIterator __beg, _InIterator __end, + std::__false_type) + { + typedef typename iterator_traits<_InIterator>::iterator_category _Tag; + _M_construct(__beg, __end, _Tag()); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 438. Ambiguity in the "do the right thing" clause + template + void + _M_construct_aux(_Integer __beg, _Integer __end, std::__true_type) + { _M_construct_aux_2(static_cast(__beg), __end); } + + void + _M_construct_aux_2(size_type __req, _CharT __c) + { _M_construct(__req, __c); } + + template + void + _M_construct(_InIterator __beg, _InIterator __end) + { + typedef typename std::__is_integer<_InIterator>::__type _Integral; + _M_construct_aux(__beg, __end, _Integral()); + } + + // For Input Iterators, used in istreambuf_iterators, etc. + template + void + _M_construct(_InIterator __beg, _InIterator __end, + std::input_iterator_tag); + + // For forward_iterators up to random_access_iterators, used for + // string::iterator, _CharT*, etc. + template + void + _M_construct(_FwdIterator __beg, _FwdIterator __end, + std::forward_iterator_tag); + + void + _M_construct(size_type __req, _CharT __c); + + allocator_type& + _M_get_allocator() + { return _M_dataplus; } + + const allocator_type& + _M_get_allocator() const + { return _M_dataplus; } + + private: + +#ifdef _GLIBCXX_DISAMBIGUATE_REPLACE_INST + // The explicit instantiations in misc-inst.cc require this due to + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64063 + template::__value + && !__are_same<_Tp, const _CharT*>::__value + && !__are_same<_Tp, iterator>::__value + && !__are_same<_Tp, const_iterator>::__value> + struct __enable_if_not_native_iterator + { typedef basic_string& __type; }; + template + struct __enable_if_not_native_iterator<_Tp, false> { }; +#endif + + size_type + _M_check(size_type __pos, const char* __s) const + { + if (__pos > this->size()) + __throw_out_of_range_fmt(__N("%s: __pos (which is %zu) > " + "this->size() (which is %zu)"), + __s, __pos, this->size()); + return __pos; + } + + void + _M_check_length(size_type __n1, size_type __n2, const char* __s) const + { + if (this->max_size() - (this->size() - __n1) < __n2) + __throw_length_error(__N(__s)); + } + + + // NB: _M_limit doesn't check for a bad __pos value. + size_type + _M_limit(size_type __pos, size_type __off) const _GLIBCXX_NOEXCEPT + { + const bool __testoff = __off < this->size() - __pos; + return __testoff ? __off : this->size() - __pos; + } + + // True if _Rep and source do not overlap. + bool + _M_disjunct(const _CharT* __s) const _GLIBCXX_NOEXCEPT + { + return (less()(__s, _M_data()) + || less()(_M_data() + this->size(), __s)); + } + + // When __n = 1 way faster than the general multichar + // traits_type::copy/move/assign. + static void + _S_copy(_CharT* __d, const _CharT* __s, size_type __n) + { + if (__n == 1) + traits_type::assign(*__d, *__s); + else + traits_type::copy(__d, __s, __n); + } + + static void + _S_move(_CharT* __d, const _CharT* __s, size_type __n) + { + if (__n == 1) + traits_type::assign(*__d, *__s); + else + traits_type::move(__d, __s, __n); + } + + static void + _S_assign(_CharT* __d, size_type __n, _CharT __c) + { + if (__n == 1) + traits_type::assign(*__d, __c); + else + traits_type::assign(__d, __n, __c); + } + + // _S_copy_chars is a separate template to permit specialization + // to optimize for the common case of pointers as iterators. + template + static void + _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2) + { + for (; __k1 != __k2; ++__k1, (void)++__p) + traits_type::assign(*__p, *__k1); // These types are off. + } + + static void + _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2) _GLIBCXX_NOEXCEPT + { _S_copy_chars(__p, __k1.base(), __k2.base()); } + + static void + _S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2) + _GLIBCXX_NOEXCEPT + { _S_copy_chars(__p, __k1.base(), __k2.base()); } + + static void + _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2) _GLIBCXX_NOEXCEPT + { _S_copy(__p, __k1, __k2 - __k1); } + + static void + _S_copy_chars(_CharT* __p, const _CharT* __k1, const _CharT* __k2) + _GLIBCXX_NOEXCEPT + { _S_copy(__p, __k1, __k2 - __k1); } + + static int + _S_compare(size_type __n1, size_type __n2) _GLIBCXX_NOEXCEPT + { + const difference_type __d = difference_type(__n1 - __n2); + + if (__d > __gnu_cxx::__numeric_traits::__max) + return __gnu_cxx::__numeric_traits::__max; + else if (__d < __gnu_cxx::__numeric_traits::__min) + return __gnu_cxx::__numeric_traits::__min; + else + return int(__d); + } + + void + _M_assign(const basic_string&); + + void + _M_mutate(size_type __pos, size_type __len1, const _CharT* __s, + size_type __len2); + + void + _M_erase(size_type __pos, size_type __n); + + public: + // Construct/copy/destroy: + // NB: We overload ctors in some cases instead of using default + // arguments, per 17.4.4.4 para. 2 item 2. + + /** + * @brief Default constructor creates an empty string. + */ + basic_string() + _GLIBCXX_NOEXCEPT_IF(is_nothrow_default_constructible<_Alloc>::value) + : _M_dataplus(_M_local_data()) + { _M_set_length(0); } + + /** + * @brief Construct an empty string using allocator @a a. + */ + explicit + basic_string(const _Alloc& __a) _GLIBCXX_NOEXCEPT + : _M_dataplus(_M_local_data(), __a) + { _M_set_length(0); } + + /** + * @brief Construct string with copy of value of @a __str. + * @param __str Source string. + */ + basic_string(const basic_string& __str) + : _M_dataplus(_M_local_data(), + _Alloc_traits::_S_select_on_copy(__str._M_get_allocator())) + { _M_construct(__str._M_data(), __str._M_data() + __str.length()); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2583. no way to supply an allocator for basic_string(str, pos) + /** + * @brief Construct string as copy of a substring. + * @param __str Source string. + * @param __pos Index of first character to copy from. + * @param __a Allocator to use. + */ + basic_string(const basic_string& __str, size_type __pos, + const _Alloc& __a = _Alloc()) + : _M_dataplus(_M_local_data(), __a) + { + const _CharT* __start = __str._M_data() + + __str._M_check(__pos, "basic_string::basic_string"); + _M_construct(__start, __start + __str._M_limit(__pos, npos)); + } + + /** + * @brief Construct string as copy of a substring. + * @param __str Source string. + * @param __pos Index of first character to copy from. + * @param __n Number of characters to copy. + */ + basic_string(const basic_string& __str, size_type __pos, + size_type __n) + : _M_dataplus(_M_local_data()) + { + const _CharT* __start = __str._M_data() + + __str._M_check(__pos, "basic_string::basic_string"); + _M_construct(__start, __start + __str._M_limit(__pos, __n)); + } + + /** + * @brief Construct string as copy of a substring. + * @param __str Source string. + * @param __pos Index of first character to copy from. + * @param __n Number of characters to copy. + * @param __a Allocator to use. + */ + basic_string(const basic_string& __str, size_type __pos, + size_type __n, const _Alloc& __a) + : _M_dataplus(_M_local_data(), __a) + { + const _CharT* __start + = __str._M_data() + __str._M_check(__pos, "string::string"); + _M_construct(__start, __start + __str._M_limit(__pos, __n)); + } + + /** + * @brief Construct string initialized by a character %array. + * @param __s Source character %array. + * @param __n Number of characters to copy. + * @param __a Allocator to use (default is default allocator). + * + * NB: @a __s must have at least @a __n characters, '\\0' + * has no special meaning. + */ + basic_string(const _CharT* __s, size_type __n, + const _Alloc& __a = _Alloc()) + : _M_dataplus(_M_local_data(), __a) + { _M_construct(__s, __s + __n); } + + /** + * @brief Construct string as copy of a C string. + * @param __s Source C string. + * @param __a Allocator to use (default is default allocator). + */ + basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()) + : _M_dataplus(_M_local_data(), __a) + { _M_construct(__s, __s ? __s + traits_type::length(__s) : __s+npos); } + + /** + * @brief Construct string as multiple characters. + * @param __n Number of characters. + * @param __c Character to use. + * @param __a Allocator to use (default is default allocator). + */ + basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc()) + : _M_dataplus(_M_local_data(), __a) + { _M_construct(__n, __c); } + +#if __cplusplus >= 201103L + /** + * @brief Move construct string. + * @param __str Source string. + * + * The newly-created string contains the exact contents of @a __str. + * @a __str is a valid, but unspecified string. + **/ + basic_string(basic_string&& __str) noexcept + : _M_dataplus(_M_local_data(), std::move(__str._M_get_allocator())) + { + if (__str._M_is_local()) + { + traits_type::copy(_M_local_buf, __str._M_local_buf, + _S_local_capacity + 1); + } + else + { + _M_data(__str._M_data()); + _M_capacity(__str._M_allocated_capacity); + } + + // Must use _M_length() here not _M_set_length() because + // basic_stringbuf relies on writing into unallocated capacity so + // we mess up the contents if we put a '\0' in the string. + _M_length(__str.length()); + __str._M_data(__str._M_local_data()); + __str._M_set_length(0); + } + + /** + * @brief Construct string from an initializer %list. + * @param __l std::initializer_list of characters. + * @param __a Allocator to use (default is default allocator). + */ + basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()) + : _M_dataplus(_M_local_data(), __a) + { _M_construct(__l.begin(), __l.end()); } + + basic_string(const basic_string& __str, const _Alloc& __a) + : _M_dataplus(_M_local_data(), __a) + { _M_construct(__str.begin(), __str.end()); } + + basic_string(basic_string&& __str, const _Alloc& __a) + noexcept(_Alloc_traits::_S_always_equal()) + : _M_dataplus(_M_local_data(), __a) + { + if (__str._M_is_local()) + { + traits_type::copy(_M_local_buf, __str._M_local_buf, + _S_local_capacity + 1); + _M_length(__str.length()); + __str._M_set_length(0); + } + else if (_Alloc_traits::_S_always_equal() + || __str.get_allocator() == __a) + { + _M_data(__str._M_data()); + _M_length(__str.length()); + _M_capacity(__str._M_allocated_capacity); + __str._M_data(__str._M_local_buf); + __str._M_set_length(0); + } + else + _M_construct(__str.begin(), __str.end()); + } + +#endif // C++11 + + /** + * @brief Construct string as copy of a range. + * @param __beg Start of range. + * @param __end End of range. + * @param __a Allocator to use (default is default allocator). + */ +#if __cplusplus >= 201103L + template> +#else + template +#endif + basic_string(_InputIterator __beg, _InputIterator __end, + const _Alloc& __a = _Alloc()) + : _M_dataplus(_M_local_data(), __a) + { _M_construct(__beg, __end); } + +#if __cplusplus > 201402L + /** + * @brief Construct string from a substring of a string_view. + * @param __t Source object convertible to string view. + * @param __pos The index of the first character to copy from __t. + * @param __n The number of characters to copy from __t. + * @param __a Allocator to use. + */ + template> + basic_string(const _Tp& __t, size_type __pos, size_type __n, + const _Alloc& __a = _Alloc()) + : basic_string(_S_to_string_view(__t).substr(__pos, __n), __a) { } + + /** + * @brief Construct string from a string_view. + * @param __t Source object convertible to string view. + * @param __a Allocator to use (default is default allocator). + */ + template> + explicit + basic_string(const _Tp& __t, const _Alloc& __a = _Alloc()) + : basic_string(__sv_wrapper(_S_to_string_view(__t)), __a) { } + + /** + * @brief Only internally used: Construct string from a string view + * wrapper. + * @param __svw string view wrapper. + * @param __a Allocator to use. + */ + explicit + basic_string(__sv_wrapper __svw, const _Alloc& __a) + : basic_string(__svw._M_sv.data(), __svw._M_sv.size(), __a) { } +#endif // C++17 + + /** + * @brief Destroy the string instance. + */ + ~basic_string() + { _M_dispose(); } + + /** + * @brief Assign the value of @a str to this string. + * @param __str Source string. + */ + basic_string& + operator=(const basic_string& __str) + { +#if __cplusplus >= 201103L + if (_Alloc_traits::_S_propagate_on_copy_assign()) + { + if (!_Alloc_traits::_S_always_equal() && !_M_is_local() + && _M_get_allocator() != __str._M_get_allocator()) + { + // Propagating allocator cannot free existing storage so must + // deallocate it before replacing current allocator. + if (__str.size() <= _S_local_capacity) + { + _M_destroy(_M_allocated_capacity); + _M_data(_M_local_data()); + _M_set_length(0); + } + else + { + const auto __len = __str.size(); + auto __alloc = __str._M_get_allocator(); + // If this allocation throws there are no effects: + auto __ptr = _Alloc_traits::allocate(__alloc, __len + 1); + _M_destroy(_M_allocated_capacity); + _M_data(__ptr); + _M_capacity(__len); + _M_set_length(__len); + } + } + std::__alloc_on_copy(_M_get_allocator(), __str._M_get_allocator()); + } +#endif + return this->assign(__str); + } + + /** + * @brief Copy contents of @a s into this string. + * @param __s Source null-terminated string. + */ + basic_string& + operator=(const _CharT* __s) + { return this->assign(__s); } + + /** + * @brief Set value to string of length 1. + * @param __c Source character. + * + * Assigning to a character makes this string length 1 and + * (*this)[0] == @a c. + */ + basic_string& + operator=(_CharT __c) + { + this->assign(1, __c); + return *this; + } + +#if __cplusplus >= 201103L + /** + * @brief Move assign the value of @a str to this string. + * @param __str Source string. + * + * The contents of @a str are moved into this string (without copying). + * @a str is a valid, but unspecified string. + **/ + // PR 58265, this should be noexcept. + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2063. Contradictory requirements for string move assignment + basic_string& + operator=(basic_string&& __str) + noexcept(_Alloc_traits::_S_nothrow_move()) + { + if (!_M_is_local() && _Alloc_traits::_S_propagate_on_move_assign() + && !_Alloc_traits::_S_always_equal() + && _M_get_allocator() != __str._M_get_allocator()) + { + // Destroy existing storage before replacing allocator. + _M_destroy(_M_allocated_capacity); + _M_data(_M_local_data()); + _M_set_length(0); + } + // Replace allocator if POCMA is true. + std::__alloc_on_move(_M_get_allocator(), __str._M_get_allocator()); + + if (!__str._M_is_local() + && (_Alloc_traits::_S_propagate_on_move_assign() + || _Alloc_traits::_S_always_equal())) + { + pointer __data = nullptr; + size_type __capacity; + if (!_M_is_local()) + { + if (_Alloc_traits::_S_always_equal()) + { + __data = _M_data(); + __capacity = _M_allocated_capacity; + } + else + _M_destroy(_M_allocated_capacity); + } + + _M_data(__str._M_data()); + _M_length(__str.length()); + _M_capacity(__str._M_allocated_capacity); + if (__data) + { + __str._M_data(__data); + __str._M_capacity(__capacity); + } + else + __str._M_data(__str._M_local_buf); + } + else + assign(__str); + __str.clear(); + return *this; + } + + /** + * @brief Set value to string constructed from initializer %list. + * @param __l std::initializer_list. + */ + basic_string& + operator=(initializer_list<_CharT> __l) + { + this->assign(__l.begin(), __l.size()); + return *this; + } +#endif // C++11 + +#if __cplusplus > 201402L + /** + * @brief Set value to string constructed from a string_view. + * @param __svt An object convertible to string_view. + */ + template + _If_sv<_Tp, basic_string&> + operator=(const _Tp& __svt) + { return this->assign(__svt); } + + /** + * @brief Convert to a string_view. + * @return A string_view. + */ + operator __sv_type() const noexcept + { return __sv_type(data(), size()); } +#endif // C++17 + + // Iterators: + /** + * Returns a read/write iterator that points to the first character in + * the %string. + */ + iterator + begin() _GLIBCXX_NOEXCEPT + { return iterator(_M_data()); } + + /** + * Returns a read-only (constant) iterator that points to the first + * character in the %string. + */ + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return const_iterator(_M_data()); } + + /** + * Returns a read/write iterator that points one past the last + * character in the %string. + */ + iterator + end() _GLIBCXX_NOEXCEPT + { return iterator(_M_data() + this->size()); } + + /** + * Returns a read-only (constant) iterator that points one past the + * last character in the %string. + */ + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return const_iterator(_M_data() + this->size()); } + + /** + * Returns a read/write reverse iterator that points to the last + * character in the %string. Iteration is done in reverse element + * order. + */ + reverse_iterator + rbegin() _GLIBCXX_NOEXCEPT + { return reverse_iterator(this->end()); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to the last character in the %string. Iteration is done in + * reverse element order. + */ + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(this->end()); } + + /** + * Returns a read/write reverse iterator that points to one before the + * first character in the %string. Iteration is done in reverse + * element order. + */ + reverse_iterator + rend() _GLIBCXX_NOEXCEPT + { return reverse_iterator(this->begin()); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to one before the first character in the %string. Iteration + * is done in reverse element order. + */ + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(this->begin()); } + +#if __cplusplus >= 201103L + /** + * Returns a read-only (constant) iterator that points to the first + * character in the %string. + */ + const_iterator + cbegin() const noexcept + { return const_iterator(this->_M_data()); } + + /** + * Returns a read-only (constant) iterator that points one past the + * last character in the %string. + */ + const_iterator + cend() const noexcept + { return const_iterator(this->_M_data() + this->size()); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to the last character in the %string. Iteration is done in + * reverse element order. + */ + const_reverse_iterator + crbegin() const noexcept + { return const_reverse_iterator(this->end()); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to one before the first character in the %string. Iteration + * is done in reverse element order. + */ + const_reverse_iterator + crend() const noexcept + { return const_reverse_iterator(this->begin()); } +#endif + + public: + // Capacity: + /// Returns the number of characters in the string, not including any + /// null-termination. + size_type + size() const _GLIBCXX_NOEXCEPT + { return _M_string_length; } + + /// Returns the number of characters in the string, not including any + /// null-termination. + size_type + length() const _GLIBCXX_NOEXCEPT + { return _M_string_length; } + + /// Returns the size() of the largest possible %string. + size_type + max_size() const _GLIBCXX_NOEXCEPT + { return (_Alloc_traits::max_size(_M_get_allocator()) - 1) / 2; } + + /** + * @brief Resizes the %string to the specified number of characters. + * @param __n Number of characters the %string should contain. + * @param __c Character to fill any new elements. + * + * This function will %resize the %string to the specified + * number of characters. If the number is smaller than the + * %string's current size the %string is truncated, otherwise + * the %string is extended and new elements are %set to @a __c. + */ + void + resize(size_type __n, _CharT __c); + + /** + * @brief Resizes the %string to the specified number of characters. + * @param __n Number of characters the %string should contain. + * + * This function will resize the %string to the specified length. If + * the new size is smaller than the %string's current size the %string + * is truncated, otherwise the %string is extended and new characters + * are default-constructed. For basic types such as char, this means + * setting them to 0. + */ + void + resize(size_type __n) + { this->resize(__n, _CharT()); } + +#if __cplusplus >= 201103L + /// A non-binding request to reduce capacity() to size(). + void + shrink_to_fit() noexcept + { +#if __cpp_exceptions + if (capacity() > size()) + { + try + { reserve(0); } + catch(...) + { } + } +#endif + } +#endif + + /** + * Returns the total number of characters that the %string can hold + * before needing to allocate more memory. + */ + size_type + capacity() const _GLIBCXX_NOEXCEPT + { + return _M_is_local() ? size_type(_S_local_capacity) + : _M_allocated_capacity; + } + + /** + * @brief Attempt to preallocate enough memory for specified number of + * characters. + * @param __res_arg Number of characters required. + * @throw std::length_error If @a __res_arg exceeds @c max_size(). + * + * This function attempts to reserve enough memory for the + * %string to hold the specified number of characters. If the + * number requested is more than max_size(), length_error is + * thrown. + * + * The advantage of this function is that if optimal code is a + * necessity and the user can determine the string length that will be + * required, the user can reserve the memory in %advance, and thus + * prevent a possible reallocation of memory and copying of %string + * data. + */ + void + reserve(size_type __res_arg = 0); + + /** + * Erases the string, making it empty. + */ + void + clear() _GLIBCXX_NOEXCEPT + { _M_set_length(0); } + + /** + * Returns true if the %string is empty. Equivalent to + * *this == "". + */ + bool + empty() const _GLIBCXX_NOEXCEPT + { return this->size() == 0; } + + // Element access: + /** + * @brief Subscript access to the data contained in the %string. + * @param __pos The index of the character to access. + * @return Read-only (constant) reference to the character. + * + * This operator allows for easy, array-style, data access. + * Note that data access with this operator is unchecked and + * out_of_range lookups are not defined. (For checked lookups + * see at().) + */ + const_reference + operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT + { + __glibcxx_assert(__pos <= size()); + return _M_data()[__pos]; + } + + /** + * @brief Subscript access to the data contained in the %string. + * @param __pos The index of the character to access. + * @return Read/write reference to the character. + * + * This operator allows for easy, array-style, data access. + * Note that data access with this operator is unchecked and + * out_of_range lookups are not defined. (For checked lookups + * see at().) + */ + reference + operator[](size_type __pos) + { + // Allow pos == size() both in C++98 mode, as v3 extension, + // and in C++11 mode. + __glibcxx_assert(__pos <= size()); + // In pedantic mode be strict in C++98 mode. + _GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L || __pos < size()); + return _M_data()[__pos]; + } + + /** + * @brief Provides access to the data contained in the %string. + * @param __n The index of the character to access. + * @return Read-only (const) reference to the character. + * @throw std::out_of_range If @a n is an invalid index. + * + * This function provides for safer data access. The parameter is + * first checked that it is in the range of the string. The function + * throws out_of_range if the check fails. + */ + const_reference + at(size_type __n) const + { + if (__n >= this->size()) + __throw_out_of_range_fmt(__N("basic_string::at: __n " + "(which is %zu) >= this->size() " + "(which is %zu)"), + __n, this->size()); + return _M_data()[__n]; + } + + /** + * @brief Provides access to the data contained in the %string. + * @param __n The index of the character to access. + * @return Read/write reference to the character. + * @throw std::out_of_range If @a n is an invalid index. + * + * This function provides for safer data access. The parameter is + * first checked that it is in the range of the string. The function + * throws out_of_range if the check fails. + */ + reference + at(size_type __n) + { + if (__n >= size()) + __throw_out_of_range_fmt(__N("basic_string::at: __n " + "(which is %zu) >= this->size() " + "(which is %zu)"), + __n, this->size()); + return _M_data()[__n]; + } + +#if __cplusplus >= 201103L + /** + * Returns a read/write reference to the data at the first + * element of the %string. + */ + reference + front() noexcept + { + __glibcxx_assert(!empty()); + return operator[](0); + } + + /** + * Returns a read-only (constant) reference to the data at the first + * element of the %string. + */ + const_reference + front() const noexcept + { + __glibcxx_assert(!empty()); + return operator[](0); + } + + /** + * Returns a read/write reference to the data at the last + * element of the %string. + */ + reference + back() noexcept + { + __glibcxx_assert(!empty()); + return operator[](this->size() - 1); + } + + /** + * Returns a read-only (constant) reference to the data at the + * last element of the %string. + */ + const_reference + back() const noexcept + { + __glibcxx_assert(!empty()); + return operator[](this->size() - 1); + } +#endif + + // Modifiers: + /** + * @brief Append a string to this string. + * @param __str The string to append. + * @return Reference to this string. + */ + basic_string& + operator+=(const basic_string& __str) + { return this->append(__str); } + + /** + * @brief Append a C string. + * @param __s The C string to append. + * @return Reference to this string. + */ + basic_string& + operator+=(const _CharT* __s) + { return this->append(__s); } + + /** + * @brief Append a character. + * @param __c The character to append. + * @return Reference to this string. + */ + basic_string& + operator+=(_CharT __c) + { + this->push_back(__c); + return *this; + } + +#if __cplusplus >= 201103L + /** + * @brief Append an initializer_list of characters. + * @param __l The initializer_list of characters to be appended. + * @return Reference to this string. + */ + basic_string& + operator+=(initializer_list<_CharT> __l) + { return this->append(__l.begin(), __l.size()); } +#endif // C++11 + +#if __cplusplus > 201402L + /** + * @brief Append a string_view. + * @param __svt An object convertible to string_view to be appended. + * @return Reference to this string. + */ + template + _If_sv<_Tp, basic_string&> + operator+=(const _Tp& __svt) + { return this->append(__svt); } +#endif // C++17 + + /** + * @brief Append a string to this string. + * @param __str The string to append. + * @return Reference to this string. + */ + basic_string& + append(const basic_string& __str) + { return _M_append(__str._M_data(), __str.size()); } + + /** + * @brief Append a substring. + * @param __str The string to append. + * @param __pos Index of the first character of str to append. + * @param __n The number of characters to append. + * @return Reference to this string. + * @throw std::out_of_range if @a __pos is not a valid index. + * + * This function appends @a __n characters from @a __str + * starting at @a __pos to this string. If @a __n is is larger + * than the number of available characters in @a __str, the + * remainder of @a __str is appended. + */ + basic_string& + append(const basic_string& __str, size_type __pos, size_type __n) + { return _M_append(__str._M_data() + + __str._M_check(__pos, "basic_string::append"), + __str._M_limit(__pos, __n)); } + + /** + * @brief Append a C substring. + * @param __s The C string to append. + * @param __n The number of characters to append. + * @return Reference to this string. + */ + basic_string& + append(const _CharT* __s, size_type __n) + { + __glibcxx_requires_string_len(__s, __n); + _M_check_length(size_type(0), __n, "basic_string::append"); + return _M_append(__s, __n); + } + + /** + * @brief Append a C string. + * @param __s The C string to append. + * @return Reference to this string. + */ + basic_string& + append(const _CharT* __s) + { + __glibcxx_requires_string(__s); + const size_type __n = traits_type::length(__s); + _M_check_length(size_type(0), __n, "basic_string::append"); + return _M_append(__s, __n); + } + + /** + * @brief Append multiple characters. + * @param __n The number of characters to append. + * @param __c The character to use. + * @return Reference to this string. + * + * Appends __n copies of __c to this string. + */ + basic_string& + append(size_type __n, _CharT __c) + { return _M_replace_aux(this->size(), size_type(0), __n, __c); } + +#if __cplusplus >= 201103L + /** + * @brief Append an initializer_list of characters. + * @param __l The initializer_list of characters to append. + * @return Reference to this string. + */ + basic_string& + append(initializer_list<_CharT> __l) + { return this->append(__l.begin(), __l.size()); } +#endif // C++11 + + /** + * @brief Append a range of characters. + * @param __first Iterator referencing the first character to append. + * @param __last Iterator marking the end of the range. + * @return Reference to this string. + * + * Appends characters in the range [__first,__last) to this string. + */ +#if __cplusplus >= 201103L + template> +#else + template +#endif + basic_string& + append(_InputIterator __first, _InputIterator __last) + { return this->replace(end(), end(), __first, __last); } + +#if __cplusplus > 201402L + /** + * @brief Append a string_view. + * @param __svt An object convertible to string_view to be appended. + * @return Reference to this string. + */ + template + _If_sv<_Tp, basic_string&> + append(const _Tp& __svt) + { + __sv_type __sv = __svt; + return this->append(__sv.data(), __sv.size()); + } + + /** + * @brief Append a range of characters from a string_view. + * @param __svt An object convertible to string_view to be appended from. + * @param __pos The position in the string_view to append from. + * @param __n The number of characters to append from the string_view. + * @return Reference to this string. + */ + template + _If_sv<_Tp, basic_string&> + append(const _Tp& __svt, size_type __pos, size_type __n = npos) + { + __sv_type __sv = __svt; + return _M_append(__sv.data() + + __sv._M_check(__pos, "basic_string::append"), + __sv._M_limit(__pos, __n)); + } +#endif // C++17 + + /** + * @brief Append a single character. + * @param __c Character to append. + */ + void + push_back(_CharT __c) + { + const size_type __size = this->size(); + if (__size + 1 > this->capacity()) + this->_M_mutate(__size, size_type(0), 0, size_type(1)); + traits_type::assign(this->_M_data()[__size], __c); + this->_M_set_length(__size + 1); + } + + /** + * @brief Set value to contents of another string. + * @param __str Source string to use. + * @return Reference to this string. + */ + basic_string& + assign(const basic_string& __str) + { + this->_M_assign(__str); + return *this; + } + +#if __cplusplus >= 201103L + /** + * @brief Set value to contents of another string. + * @param __str Source string to use. + * @return Reference to this string. + * + * This function sets this string to the exact contents of @a __str. + * @a __str is a valid, but unspecified string. + */ + basic_string& + assign(basic_string&& __str) + noexcept(_Alloc_traits::_S_nothrow_move()) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2063. Contradictory requirements for string move assignment + return *this = std::move(__str); + } +#endif // C++11 + + /** + * @brief Set value to a substring of a string. + * @param __str The string to use. + * @param __pos Index of the first character of str. + * @param __n Number of characters to use. + * @return Reference to this string. + * @throw std::out_of_range if @a pos is not a valid index. + * + * This function sets this string to the substring of @a __str + * consisting of @a __n characters at @a __pos. If @a __n is + * is larger than the number of available characters in @a + * __str, the remainder of @a __str is used. + */ + basic_string& + assign(const basic_string& __str, size_type __pos, size_type __n) + { return _M_replace(size_type(0), this->size(), __str._M_data() + + __str._M_check(__pos, "basic_string::assign"), + __str._M_limit(__pos, __n)); } + + /** + * @brief Set value to a C substring. + * @param __s The C string to use. + * @param __n Number of characters to use. + * @return Reference to this string. + * + * This function sets the value of this string to the first @a __n + * characters of @a __s. If @a __n is is larger than the number of + * available characters in @a __s, the remainder of @a __s is used. + */ + basic_string& + assign(const _CharT* __s, size_type __n) + { + __glibcxx_requires_string_len(__s, __n); + return _M_replace(size_type(0), this->size(), __s, __n); + } + + /** + * @brief Set value to contents of a C string. + * @param __s The C string to use. + * @return Reference to this string. + * + * This function sets the value of this string to the value of @a __s. + * The data is copied, so there is no dependence on @a __s once the + * function returns. + */ + basic_string& + assign(const _CharT* __s) + { + __glibcxx_requires_string(__s); + return _M_replace(size_type(0), this->size(), __s, + traits_type::length(__s)); + } + + /** + * @brief Set value to multiple characters. + * @param __n Length of the resulting string. + * @param __c The character to use. + * @return Reference to this string. + * + * This function sets the value of this string to @a __n copies of + * character @a __c. + */ + basic_string& + assign(size_type __n, _CharT __c) + { return _M_replace_aux(size_type(0), this->size(), __n, __c); } + + /** + * @brief Set value to a range of characters. + * @param __first Iterator referencing the first character to append. + * @param __last Iterator marking the end of the range. + * @return Reference to this string. + * + * Sets value of string to characters in the range [__first,__last). + */ +#if __cplusplus >= 201103L + template> +#else + template +#endif + basic_string& + assign(_InputIterator __first, _InputIterator __last) + { return this->replace(begin(), end(), __first, __last); } + +#if __cplusplus >= 201103L + /** + * @brief Set value to an initializer_list of characters. + * @param __l The initializer_list of characters to assign. + * @return Reference to this string. + */ + basic_string& + assign(initializer_list<_CharT> __l) + { return this->assign(__l.begin(), __l.size()); } +#endif // C++11 + +#if __cplusplus > 201402L + /** + * @brief Set value from a string_view. + * @param __svt The source object convertible to string_view. + * @return Reference to this string. + */ + template + _If_sv<_Tp, basic_string&> + assign(const _Tp& __svt) + { + __sv_type __sv = __svt; + return this->assign(__sv.data(), __sv.size()); + } + + /** + * @brief Set value from a range of characters in a string_view. + * @param __svt The source object convertible to string_view. + * @param __pos The position in the string_view to assign from. + * @param __n The number of characters to assign. + * @return Reference to this string. + */ + template + _If_sv<_Tp, basic_string&> + assign(const _Tp& __svt, size_type __pos, size_type __n = npos) + { + __sv_type __sv = __svt; + return _M_replace(size_type(0), this->size(), __sv.data() + + __sv._M_check(__pos, "basic_string::assign"), + __sv._M_limit(__pos, __n)); + } +#endif // C++17 + +#if __cplusplus >= 201103L + /** + * @brief Insert multiple characters. + * @param __p Const_iterator referencing location in string to + * insert at. + * @param __n Number of characters to insert + * @param __c The character to insert. + * @return Iterator referencing the first inserted char. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Inserts @a __n copies of character @a __c starting at the + * position referenced by iterator @a __p. If adding + * characters causes the length to exceed max_size(), + * length_error is thrown. The value of the string doesn't + * change if an error is thrown. + */ + iterator + insert(const_iterator __p, size_type __n, _CharT __c) + { + _GLIBCXX_DEBUG_PEDASSERT(__p >= begin() && __p <= end()); + const size_type __pos = __p - begin(); + this->replace(__p, __p, __n, __c); + return iterator(this->_M_data() + __pos); + } +#else + /** + * @brief Insert multiple characters. + * @param __p Iterator referencing location in string to insert at. + * @param __n Number of characters to insert + * @param __c The character to insert. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Inserts @a __n copies of character @a __c starting at the + * position referenced by iterator @a __p. If adding + * characters causes the length to exceed max_size(), + * length_error is thrown. The value of the string doesn't + * change if an error is thrown. + */ + void + insert(iterator __p, size_type __n, _CharT __c) + { this->replace(__p, __p, __n, __c); } +#endif + +#if __cplusplus >= 201103L + /** + * @brief Insert a range of characters. + * @param __p Const_iterator referencing location in string to + * insert at. + * @param __beg Start of range. + * @param __end End of range. + * @return Iterator referencing the first inserted char. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Inserts characters in range [beg,end). If adding characters + * causes the length to exceed max_size(), length_error is + * thrown. The value of the string doesn't change if an error + * is thrown. + */ + template> + iterator + insert(const_iterator __p, _InputIterator __beg, _InputIterator __end) + { + _GLIBCXX_DEBUG_PEDASSERT(__p >= begin() && __p <= end()); + const size_type __pos = __p - begin(); + this->replace(__p, __p, __beg, __end); + return iterator(this->_M_data() + __pos); + } +#else + /** + * @brief Insert a range of characters. + * @param __p Iterator referencing location in string to insert at. + * @param __beg Start of range. + * @param __end End of range. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Inserts characters in range [__beg,__end). If adding + * characters causes the length to exceed max_size(), + * length_error is thrown. The value of the string doesn't + * change if an error is thrown. + */ + template + void + insert(iterator __p, _InputIterator __beg, _InputIterator __end) + { this->replace(__p, __p, __beg, __end); } +#endif + +#if __cplusplus >= 201103L + /** + * @brief Insert an initializer_list of characters. + * @param __p Iterator referencing location in string to insert at. + * @param __l The initializer_list of characters to insert. + * @throw std::length_error If new length exceeds @c max_size(). + */ + void + insert(iterator __p, initializer_list<_CharT> __l) + { + _GLIBCXX_DEBUG_PEDASSERT(__p >= begin() && __p <= end()); + this->insert(__p - begin(), __l.begin(), __l.size()); + } +#endif // C++11 + + /** + * @brief Insert value of a string. + * @param __pos1 Iterator referencing location in string to insert at. + * @param __str The string to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Inserts value of @a __str starting at @a __pos1. If adding + * characters causes the length to exceed max_size(), + * length_error is thrown. The value of the string doesn't + * change if an error is thrown. + */ + basic_string& + insert(size_type __pos1, const basic_string& __str) + { return this->replace(__pos1, size_type(0), + __str._M_data(), __str.size()); } + + /** + * @brief Insert a substring. + * @param __pos1 Iterator referencing location in string to insert at. + * @param __str The string to insert. + * @param __pos2 Start of characters in str to insert. + * @param __n Number of characters to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * @throw std::out_of_range If @a pos1 > size() or + * @a __pos2 > @a str.size(). + * + * Starting at @a pos1, insert @a __n character of @a __str + * beginning with @a __pos2. If adding characters causes the + * length to exceed max_size(), length_error is thrown. If @a + * __pos1 is beyond the end of this string or @a __pos2 is + * beyond the end of @a __str, out_of_range is thrown. The + * value of the string doesn't change if an error is thrown. + */ + basic_string& + insert(size_type __pos1, const basic_string& __str, + size_type __pos2, size_type __n) + { return this->replace(__pos1, size_type(0), __str._M_data() + + __str._M_check(__pos2, "basic_string::insert"), + __str._M_limit(__pos2, __n)); } + + /** + * @brief Insert a C substring. + * @param __pos Iterator referencing location in string to insert at. + * @param __s The C string to insert. + * @param __n The number of characters to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * @throw std::out_of_range If @a __pos is beyond the end of this + * string. + * + * Inserts the first @a __n characters of @a __s starting at @a + * __pos. If adding characters causes the length to exceed + * max_size(), length_error is thrown. If @a __pos is beyond + * end(), out_of_range is thrown. The value of the string + * doesn't change if an error is thrown. + */ + basic_string& + insert(size_type __pos, const _CharT* __s, size_type __n) + { return this->replace(__pos, size_type(0), __s, __n); } + + /** + * @brief Insert a C string. + * @param __pos Iterator referencing location in string to insert at. + * @param __s The C string to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * @throw std::out_of_range If @a pos is beyond the end of this + * string. + * + * Inserts the first @a n characters of @a __s starting at @a __pos. If + * adding characters causes the length to exceed max_size(), + * length_error is thrown. If @a __pos is beyond end(), out_of_range is + * thrown. The value of the string doesn't change if an error is + * thrown. + */ + basic_string& + insert(size_type __pos, const _CharT* __s) + { + __glibcxx_requires_string(__s); + return this->replace(__pos, size_type(0), __s, + traits_type::length(__s)); + } + + /** + * @brief Insert multiple characters. + * @param __pos Index in string to insert at. + * @param __n Number of characters to insert + * @param __c The character to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * @throw std::out_of_range If @a __pos is beyond the end of this + * string. + * + * Inserts @a __n copies of character @a __c starting at index + * @a __pos. If adding characters causes the length to exceed + * max_size(), length_error is thrown. If @a __pos > length(), + * out_of_range is thrown. The value of the string doesn't + * change if an error is thrown. + */ + basic_string& + insert(size_type __pos, size_type __n, _CharT __c) + { return _M_replace_aux(_M_check(__pos, "basic_string::insert"), + size_type(0), __n, __c); } + + /** + * @brief Insert one character. + * @param __p Iterator referencing position in string to insert at. + * @param __c The character to insert. + * @return Iterator referencing newly inserted char. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Inserts character @a __c at position referenced by @a __p. + * If adding character causes the length to exceed max_size(), + * length_error is thrown. If @a __p is beyond end of string, + * out_of_range is thrown. The value of the string doesn't + * change if an error is thrown. + */ + iterator + insert(__const_iterator __p, _CharT __c) + { + _GLIBCXX_DEBUG_PEDASSERT(__p >= begin() && __p <= end()); + const size_type __pos = __p - begin(); + _M_replace_aux(__pos, size_type(0), size_type(1), __c); + return iterator(_M_data() + __pos); + } + +#if __cplusplus > 201402L + /** + * @brief Insert a string_view. + * @param __pos Iterator referencing position in string to insert at. + * @param __svt The object convertible to string_view to insert. + * @return Reference to this string. + */ + template + _If_sv<_Tp, basic_string&> + insert(size_type __pos, const _Tp& __svt) + { + __sv_type __sv = __svt; + return this->insert(__pos, __sv.data(), __sv.size()); + } + + /** + * @brief Insert a string_view. + * @param __pos Iterator referencing position in string to insert at. + * @param __svt The object convertible to string_view to insert from. + * @param __pos Iterator referencing position in string_view to insert + * from. + * @param __n The number of characters to insert. + * @return Reference to this string. + */ + template + _If_sv<_Tp, basic_string&> + insert(size_type __pos1, const _Tp& __svt, + size_type __pos2, size_type __n = npos) + { + __sv_type __sv = __svt; + return this->replace(__pos1, size_type(0), __sv.data() + + __sv._M_check(__pos2, "basic_string::insert"), + __sv._M_limit(__pos2, __n)); + } +#endif // C++17 + + /** + * @brief Remove characters. + * @param __pos Index of first character to remove (default 0). + * @param __n Number of characters to remove (default remainder). + * @return Reference to this string. + * @throw std::out_of_range If @a pos is beyond the end of this + * string. + * + * Removes @a __n characters from this string starting at @a + * __pos. The length of the string is reduced by @a __n. If + * there are < @a __n characters to remove, the remainder of + * the string is truncated. If @a __p is beyond end of string, + * out_of_range is thrown. The value of the string doesn't + * change if an error is thrown. + */ + basic_string& + erase(size_type __pos = 0, size_type __n = npos) + { + _M_check(__pos, "basic_string::erase"); + if (__n == npos) + this->_M_set_length(__pos); + else if (__n != 0) + this->_M_erase(__pos, _M_limit(__pos, __n)); + return *this; + } + + /** + * @brief Remove one character. + * @param __position Iterator referencing the character to remove. + * @return iterator referencing same location after removal. + * + * Removes the character at @a __position from this string. The value + * of the string doesn't change if an error is thrown. + */ + iterator + erase(__const_iterator __position) + { + _GLIBCXX_DEBUG_PEDASSERT(__position >= begin() + && __position < end()); + const size_type __pos = __position - begin(); + this->_M_erase(__pos, size_type(1)); + return iterator(_M_data() + __pos); + } + + /** + * @brief Remove a range of characters. + * @param __first Iterator referencing the first character to remove. + * @param __last Iterator referencing the end of the range. + * @return Iterator referencing location of first after removal. + * + * Removes the characters in the range [first,last) from this string. + * The value of the string doesn't change if an error is thrown. + */ + iterator + erase(__const_iterator __first, __const_iterator __last) + { + _GLIBCXX_DEBUG_PEDASSERT(__first >= begin() && __first <= __last + && __last <= end()); + const size_type __pos = __first - begin(); + if (__last == end()) + this->_M_set_length(__pos); + else + this->_M_erase(__pos, __last - __first); + return iterator(this->_M_data() + __pos); + } + +#if __cplusplus >= 201103L + /** + * @brief Remove the last character. + * + * The string must be non-empty. + */ + void + pop_back() noexcept + { + __glibcxx_assert(!empty()); + _M_erase(size() - 1, 1); + } +#endif // C++11 + + /** + * @brief Replace characters with value from another string. + * @param __pos Index of first character to replace. + * @param __n Number of characters to be replaced. + * @param __str String to insert. + * @return Reference to this string. + * @throw std::out_of_range If @a pos is beyond the end of this + * string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__pos,__pos+__n) from + * this string. In place, the value of @a __str is inserted. + * If @a __pos is beyond end of string, out_of_range is thrown. + * If the length of the result exceeds max_size(), length_error + * is thrown. The value of the string doesn't change if an + * error is thrown. + */ + basic_string& + replace(size_type __pos, size_type __n, const basic_string& __str) + { return this->replace(__pos, __n, __str._M_data(), __str.size()); } + + /** + * @brief Replace characters with value from another string. + * @param __pos1 Index of first character to replace. + * @param __n1 Number of characters to be replaced. + * @param __str String to insert. + * @param __pos2 Index of first character of str to use. + * @param __n2 Number of characters from str to use. + * @return Reference to this string. + * @throw std::out_of_range If @a __pos1 > size() or @a __pos2 > + * __str.size(). + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__pos1,__pos1 + n) from this + * string. In place, the value of @a __str is inserted. If @a __pos is + * beyond end of string, out_of_range is thrown. If the length of the + * result exceeds max_size(), length_error is thrown. The value of the + * string doesn't change if an error is thrown. + */ + basic_string& + replace(size_type __pos1, size_type __n1, const basic_string& __str, + size_type __pos2, size_type __n2) + { return this->replace(__pos1, __n1, __str._M_data() + + __str._M_check(__pos2, "basic_string::replace"), + __str._M_limit(__pos2, __n2)); } + + /** + * @brief Replace characters with value of a C substring. + * @param __pos Index of first character to replace. + * @param __n1 Number of characters to be replaced. + * @param __s C string to insert. + * @param __n2 Number of characters from @a s to use. + * @return Reference to this string. + * @throw std::out_of_range If @a pos1 > size(). + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__pos,__pos + __n1) + * from this string. In place, the first @a __n2 characters of + * @a __s are inserted, or all of @a __s if @a __n2 is too large. If + * @a __pos is beyond end of string, out_of_range is thrown. If + * the length of result exceeds max_size(), length_error is + * thrown. The value of the string doesn't change if an error + * is thrown. + */ + basic_string& + replace(size_type __pos, size_type __n1, const _CharT* __s, + size_type __n2) + { + __glibcxx_requires_string_len(__s, __n2); + return _M_replace(_M_check(__pos, "basic_string::replace"), + _M_limit(__pos, __n1), __s, __n2); + } + + /** + * @brief Replace characters with value of a C string. + * @param __pos Index of first character to replace. + * @param __n1 Number of characters to be replaced. + * @param __s C string to insert. + * @return Reference to this string. + * @throw std::out_of_range If @a pos > size(). + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__pos,__pos + __n1) + * from this string. In place, the characters of @a __s are + * inserted. If @a __pos is beyond end of string, out_of_range + * is thrown. If the length of result exceeds max_size(), + * length_error is thrown. The value of the string doesn't + * change if an error is thrown. + */ + basic_string& + replace(size_type __pos, size_type __n1, const _CharT* __s) + { + __glibcxx_requires_string(__s); + return this->replace(__pos, __n1, __s, traits_type::length(__s)); + } + + /** + * @brief Replace characters with multiple characters. + * @param __pos Index of first character to replace. + * @param __n1 Number of characters to be replaced. + * @param __n2 Number of characters to insert. + * @param __c Character to insert. + * @return Reference to this string. + * @throw std::out_of_range If @a __pos > size(). + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [pos,pos + n1) from this + * string. In place, @a __n2 copies of @a __c are inserted. + * If @a __pos is beyond end of string, out_of_range is thrown. + * If the length of result exceeds max_size(), length_error is + * thrown. The value of the string doesn't change if an error + * is thrown. + */ + basic_string& + replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) + { return _M_replace_aux(_M_check(__pos, "basic_string::replace"), + _M_limit(__pos, __n1), __n2, __c); } + + /** + * @brief Replace range of characters with string. + * @param __i1 Iterator referencing start of range to replace. + * @param __i2 Iterator referencing end of range to replace. + * @param __str String value to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__i1,__i2). In place, + * the value of @a __str is inserted. If the length of result + * exceeds max_size(), length_error is thrown. The value of + * the string doesn't change if an error is thrown. + */ + basic_string& + replace(__const_iterator __i1, __const_iterator __i2, + const basic_string& __str) + { return this->replace(__i1, __i2, __str._M_data(), __str.size()); } + + /** + * @brief Replace range of characters with C substring. + * @param __i1 Iterator referencing start of range to replace. + * @param __i2 Iterator referencing end of range to replace. + * @param __s C string value to insert. + * @param __n Number of characters from s to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__i1,__i2). In place, + * the first @a __n characters of @a __s are inserted. If the + * length of result exceeds max_size(), length_error is thrown. + * The value of the string doesn't change if an error is + * thrown. + */ + basic_string& + replace(__const_iterator __i1, __const_iterator __i2, + const _CharT* __s, size_type __n) + { + _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 + && __i2 <= end()); + return this->replace(__i1 - begin(), __i2 - __i1, __s, __n); + } + + /** + * @brief Replace range of characters with C string. + * @param __i1 Iterator referencing start of range to replace. + * @param __i2 Iterator referencing end of range to replace. + * @param __s C string value to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__i1,__i2). In place, + * the characters of @a __s are inserted. If the length of + * result exceeds max_size(), length_error is thrown. The + * value of the string doesn't change if an error is thrown. + */ + basic_string& + replace(__const_iterator __i1, __const_iterator __i2, const _CharT* __s) + { + __glibcxx_requires_string(__s); + return this->replace(__i1, __i2, __s, traits_type::length(__s)); + } + + /** + * @brief Replace range of characters with multiple characters + * @param __i1 Iterator referencing start of range to replace. + * @param __i2 Iterator referencing end of range to replace. + * @param __n Number of characters to insert. + * @param __c Character to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__i1,__i2). In place, + * @a __n copies of @a __c are inserted. If the length of + * result exceeds max_size(), length_error is thrown. The + * value of the string doesn't change if an error is thrown. + */ + basic_string& + replace(__const_iterator __i1, __const_iterator __i2, size_type __n, + _CharT __c) + { + _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 + && __i2 <= end()); + return _M_replace_aux(__i1 - begin(), __i2 - __i1, __n, __c); + } + + /** + * @brief Replace range of characters with range. + * @param __i1 Iterator referencing start of range to replace. + * @param __i2 Iterator referencing end of range to replace. + * @param __k1 Iterator referencing start of range to insert. + * @param __k2 Iterator referencing end of range to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__i1,__i2). In place, + * characters in the range [__k1,__k2) are inserted. If the + * length of result exceeds max_size(), length_error is thrown. + * The value of the string doesn't change if an error is + * thrown. + */ +#if __cplusplus >= 201103L + template> + basic_string& + replace(const_iterator __i1, const_iterator __i2, + _InputIterator __k1, _InputIterator __k2) + { + _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 + && __i2 <= end()); + __glibcxx_requires_valid_range(__k1, __k2); + return this->_M_replace_dispatch(__i1, __i2, __k1, __k2, + std::__false_type()); + } +#else + template +#ifdef _GLIBCXX_DISAMBIGUATE_REPLACE_INST + typename __enable_if_not_native_iterator<_InputIterator>::__type +#else + basic_string& +#endif + replace(iterator __i1, iterator __i2, + _InputIterator __k1, _InputIterator __k2) + { + _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 + && __i2 <= end()); + __glibcxx_requires_valid_range(__k1, __k2); + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral()); + } +#endif + + // Specializations for the common case of pointer and iterator: + // useful to avoid the overhead of temporary buffering in _M_replace. + basic_string& + replace(__const_iterator __i1, __const_iterator __i2, + _CharT* __k1, _CharT* __k2) + { + _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 + && __i2 <= end()); + __glibcxx_requires_valid_range(__k1, __k2); + return this->replace(__i1 - begin(), __i2 - __i1, + __k1, __k2 - __k1); + } + + basic_string& + replace(__const_iterator __i1, __const_iterator __i2, + const _CharT* __k1, const _CharT* __k2) + { + _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 + && __i2 <= end()); + __glibcxx_requires_valid_range(__k1, __k2); + return this->replace(__i1 - begin(), __i2 - __i1, + __k1, __k2 - __k1); + } + + basic_string& + replace(__const_iterator __i1, __const_iterator __i2, + iterator __k1, iterator __k2) + { + _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 + && __i2 <= end()); + __glibcxx_requires_valid_range(__k1, __k2); + return this->replace(__i1 - begin(), __i2 - __i1, + __k1.base(), __k2 - __k1); + } + + basic_string& + replace(__const_iterator __i1, __const_iterator __i2, + const_iterator __k1, const_iterator __k2) + { + _GLIBCXX_DEBUG_PEDASSERT(begin() <= __i1 && __i1 <= __i2 + && __i2 <= end()); + __glibcxx_requires_valid_range(__k1, __k2); + return this->replace(__i1 - begin(), __i2 - __i1, + __k1.base(), __k2 - __k1); + } + +#if __cplusplus >= 201103L + /** + * @brief Replace range of characters with initializer_list. + * @param __i1 Iterator referencing start of range to replace. + * @param __i2 Iterator referencing end of range to replace. + * @param __l The initializer_list of characters to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__i1,__i2). In place, + * characters in the range [__k1,__k2) are inserted. If the + * length of result exceeds max_size(), length_error is thrown. + * The value of the string doesn't change if an error is + * thrown. + */ + basic_string& replace(const_iterator __i1, const_iterator __i2, + initializer_list<_CharT> __l) + { return this->replace(__i1, __i2, __l.begin(), __l.size()); } +#endif // C++11 + +#if __cplusplus > 201402L + /** + * @brief Replace range of characters with string_view. + * @param __pos The position to replace at. + * @param __n The number of characters to replace. + * @param __svt The object convertible to string_view to insert. + * @return Reference to this string. + */ + template + _If_sv<_Tp, basic_string&> + replace(size_type __pos, size_type __n, const _Tp& __svt) + { + __sv_type __sv = __svt; + return this->replace(__pos, __n, __sv.data(), __sv.size()); + } + + /** + * @brief Replace range of characters with string_view. + * @param __pos1 The position to replace at. + * @param __n1 The number of characters to replace. + * @param __svt The object convertible to string_view to insert from. + * @param __pos2 The position in the string_view to insert from. + * @param __n2 The number of characters to insert. + * @return Reference to this string. + */ + template + _If_sv<_Tp, basic_string&> + replace(size_type __pos1, size_type __n1, const _Tp& __svt, + size_type __pos2, size_type __n2 = npos) + { + __sv_type __sv = __svt; + return this->replace(__pos1, __n1, __sv.data() + + __sv._M_check(__pos2, "basic_string::replace"), + __sv._M_limit(__pos2, __n2)); + } + + /** + * @brief Replace range of characters with string_view. + * @param __i1 An iterator referencing the start position + to replace at. + * @param __i2 An iterator referencing the end position + for the replace. + * @param __svt The object convertible to string_view to insert from. + * @return Reference to this string. + */ + template + _If_sv<_Tp, basic_string&> + replace(const_iterator __i1, const_iterator __i2, const _Tp& __svt) + { + __sv_type __sv = __svt; + return this->replace(__i1 - begin(), __i2 - __i1, __sv); + } +#endif // C++17 + + private: + template + basic_string& + _M_replace_dispatch(const_iterator __i1, const_iterator __i2, + _Integer __n, _Integer __val, __true_type) + { return _M_replace_aux(__i1 - begin(), __i2 - __i1, __n, __val); } + + template + basic_string& + _M_replace_dispatch(const_iterator __i1, const_iterator __i2, + _InputIterator __k1, _InputIterator __k2, + __false_type); + + basic_string& + _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2, + _CharT __c); + + basic_string& + _M_replace(size_type __pos, size_type __len1, const _CharT* __s, + const size_type __len2); + + basic_string& + _M_append(const _CharT* __s, size_type __n); + + public: + + /** + * @brief Copy substring into C string. + * @param __s C string to copy value into. + * @param __n Number of characters to copy. + * @param __pos Index of first character to copy. + * @return Number of characters actually copied + * @throw std::out_of_range If __pos > size(). + * + * Copies up to @a __n characters starting at @a __pos into the + * C string @a __s. If @a __pos is %greater than size(), + * out_of_range is thrown. + */ + size_type + copy(_CharT* __s, size_type __n, size_type __pos = 0) const; + + /** + * @brief Swap contents with another string. + * @param __s String to swap with. + * + * Exchanges the contents of this string with that of @a __s in constant + * time. + */ + void + swap(basic_string& __s) _GLIBCXX_NOEXCEPT; + + // String operations: + /** + * @brief Return const pointer to null-terminated contents. + * + * This is a handle to internal data. Do not modify or dire things may + * happen. + */ + const _CharT* + c_str() const _GLIBCXX_NOEXCEPT + { return _M_data(); } + + /** + * @brief Return const pointer to contents. + * + * This is a pointer to internal data. It is undefined to modify + * the contents through the returned pointer. To get a pointer that + * allows modifying the contents use @c &str[0] instead, + * (or in C++17 the non-const @c str.data() overload). + */ + const _CharT* + data() const _GLIBCXX_NOEXCEPT + { return _M_data(); } + +#if __cplusplus > 201402L + /** + * @brief Return non-const pointer to contents. + * + * This is a pointer to the character sequence held by the string. + * Modifying the characters in the sequence is allowed. + */ + _CharT* + data() noexcept + { return _M_data(); } +#endif + + /** + * @brief Return copy of allocator used to construct this string. + */ + allocator_type + get_allocator() const _GLIBCXX_NOEXCEPT + { return _M_get_allocator(); } + + /** + * @brief Find position of a C substring. + * @param __s C string to locate. + * @param __pos Index of character to search from. + * @param __n Number of characters from @a s to search for. + * @return Index of start of first occurrence. + * + * Starting from @a __pos, searches forward for the first @a + * __n characters in @a __s within this string. If found, + * returns the index where it begins. If not found, returns + * npos. + */ + size_type + find(const _CharT* __s, size_type __pos, size_type __n) const + _GLIBCXX_NOEXCEPT; + + /** + * @brief Find position of a string. + * @param __str String to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of start of first occurrence. + * + * Starting from @a __pos, searches forward for value of @a __str within + * this string. If found, returns the index where it begins. If not + * found, returns npos. + */ + size_type + find(const basic_string& __str, size_type __pos = 0) const + _GLIBCXX_NOEXCEPT + { return this->find(__str.data(), __pos, __str.size()); } + +#if __cplusplus > 201402L + /** + * @brief Find position of a string_view. + * @param __svt The object convertible to string_view to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of start of first occurrence. + */ + template + _If_sv<_Tp, size_type> + find(const _Tp& __svt, size_type __pos = 0) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return this->find(__sv.data(), __pos, __sv.size()); + } +#endif // C++17 + + /** + * @brief Find position of a C string. + * @param __s C string to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of start of first occurrence. + * + * Starting from @a __pos, searches forward for the value of @a + * __s within this string. If found, returns the index where + * it begins. If not found, returns npos. + */ + size_type + find(const _CharT* __s, size_type __pos = 0) const _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_string(__s); + return this->find(__s, __pos, traits_type::length(__s)); + } + + /** + * @brief Find position of a character. + * @param __c Character to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for @a __c within + * this string. If found, returns the index where it was + * found. If not found, returns npos. + */ + size_type + find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT; + + /** + * @brief Find last position of a string. + * @param __str String to locate. + * @param __pos Index of character to search back from (default end). + * @return Index of start of last occurrence. + * + * Starting from @a __pos, searches backward for value of @a + * __str within this string. If found, returns the index where + * it begins. If not found, returns npos. + */ + size_type + rfind(const basic_string& __str, size_type __pos = npos) const + _GLIBCXX_NOEXCEPT + { return this->rfind(__str.data(), __pos, __str.size()); } + +#if __cplusplus > 201402L + /** + * @brief Find last position of a string_view. + * @param __svt The object convertible to string_view to locate. + * @param __pos Index of character to search back from (default end). + * @return Index of start of last occurrence. + */ + template + _If_sv<_Tp, size_type> + rfind(const _Tp& __svt, size_type __pos = npos) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return this->rfind(__sv.data(), __pos, __sv.size()); + } +#endif // C++17 + + /** + * @brief Find last position of a C substring. + * @param __s C string to locate. + * @param __pos Index of character to search back from. + * @param __n Number of characters from s to search for. + * @return Index of start of last occurrence. + * + * Starting from @a __pos, searches backward for the first @a + * __n characters in @a __s within this string. If found, + * returns the index where it begins. If not found, returns + * npos. + */ + size_type + rfind(const _CharT* __s, size_type __pos, size_type __n) const + _GLIBCXX_NOEXCEPT; + + /** + * @brief Find last position of a C string. + * @param __s C string to locate. + * @param __pos Index of character to start search at (default end). + * @return Index of start of last occurrence. + * + * Starting from @a __pos, searches backward for the value of + * @a __s within this string. If found, returns the index + * where it begins. If not found, returns npos. + */ + size_type + rfind(const _CharT* __s, size_type __pos = npos) const + { + __glibcxx_requires_string(__s); + return this->rfind(__s, __pos, traits_type::length(__s)); + } + + /** + * @brief Find last position of a character. + * @param __c Character to locate. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for @a __c within + * this string. If found, returns the index where it was + * found. If not found, returns npos. + */ + size_type + rfind(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT; + + /** + * @brief Find position of a character of string. + * @param __str String containing characters to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for one of the + * characters of @a __str within this string. If found, + * returns the index where it was found. If not found, returns + * npos. + */ + size_type + find_first_of(const basic_string& __str, size_type __pos = 0) const + _GLIBCXX_NOEXCEPT + { return this->find_first_of(__str.data(), __pos, __str.size()); } + +#if __cplusplus > 201402L + /** + * @brief Find position of a character of a string_view. + * @param __svt An object convertible to string_view containing + * characters to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + */ + template + _If_sv<_Tp, size_type> + find_first_of(const _Tp& __svt, size_type __pos = 0) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return this->find_first_of(__sv.data(), __pos, __sv.size()); + } +#endif // C++17 + + /** + * @brief Find position of a character of C substring. + * @param __s String containing characters to locate. + * @param __pos Index of character to search from. + * @param __n Number of characters from s to search for. + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for one of the + * first @a __n characters of @a __s within this string. If + * found, returns the index where it was found. If not found, + * returns npos. + */ + size_type + find_first_of(const _CharT* __s, size_type __pos, size_type __n) const + _GLIBCXX_NOEXCEPT; + + /** + * @brief Find position of a character of C string. + * @param __s String containing characters to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for one of the + * characters of @a __s within this string. If found, returns + * the index where it was found. If not found, returns npos. + */ + size_type + find_first_of(const _CharT* __s, size_type __pos = 0) const + _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_string(__s); + return this->find_first_of(__s, __pos, traits_type::length(__s)); + } + + /** + * @brief Find position of a character. + * @param __c Character to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for the character + * @a __c within this string. If found, returns the index + * where it was found. If not found, returns npos. + * + * Note: equivalent to find(__c, __pos). + */ + size_type + find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT + { return this->find(__c, __pos); } + + /** + * @brief Find last position of a character of string. + * @param __str String containing characters to locate. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for one of the + * characters of @a __str within this string. If found, + * returns the index where it was found. If not found, returns + * npos. + */ + size_type + find_last_of(const basic_string& __str, size_type __pos = npos) const + _GLIBCXX_NOEXCEPT + { return this->find_last_of(__str.data(), __pos, __str.size()); } + +#if __cplusplus > 201402L + /** + * @brief Find last position of a character of string. + * @param __svt An object convertible to string_view containing + * characters to locate. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + */ + template + _If_sv<_Tp, size_type> + find_last_of(const _Tp& __svt, size_type __pos = npos) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return this->find_last_of(__sv.data(), __pos, __sv.size()); + } +#endif // C++17 + + /** + * @brief Find last position of a character of C substring. + * @param __s C string containing characters to locate. + * @param __pos Index of character to search back from. + * @param __n Number of characters from s to search for. + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for one of the + * first @a __n characters of @a __s within this string. If + * found, returns the index where it was found. If not found, + * returns npos. + */ + size_type + find_last_of(const _CharT* __s, size_type __pos, size_type __n) const + _GLIBCXX_NOEXCEPT; + + /** + * @brief Find last position of a character of C string. + * @param __s C string containing characters to locate. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for one of the + * characters of @a __s within this string. If found, returns + * the index where it was found. If not found, returns npos. + */ + size_type + find_last_of(const _CharT* __s, size_type __pos = npos) const + _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_string(__s); + return this->find_last_of(__s, __pos, traits_type::length(__s)); + } + + /** + * @brief Find last position of a character. + * @param __c Character to locate. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for @a __c within + * this string. If found, returns the index where it was + * found. If not found, returns npos. + * + * Note: equivalent to rfind(__c, __pos). + */ + size_type + find_last_of(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT + { return this->rfind(__c, __pos); } + + /** + * @brief Find position of a character not in string. + * @param __str String containing characters to avoid. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for a character not contained + * in @a __str within this string. If found, returns the index where it + * was found. If not found, returns npos. + */ + size_type + find_first_not_of(const basic_string& __str, size_type __pos = 0) const + _GLIBCXX_NOEXCEPT + { return this->find_first_not_of(__str.data(), __pos, __str.size()); } + +#if __cplusplus > 201402L + /** + * @brief Find position of a character not in a string_view. + * @param __svt A object convertible to string_view containing + * characters to avoid. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + */ + template + _If_sv<_Tp, size_type> + find_first_not_of(const _Tp& __svt, size_type __pos = 0) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return this->find_first_not_of(__sv.data(), __pos, __sv.size()); + } +#endif // C++17 + + /** + * @brief Find position of a character not in C substring. + * @param __s C string containing characters to avoid. + * @param __pos Index of character to search from. + * @param __n Number of characters from __s to consider. + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for a character not + * contained in the first @a __n characters of @a __s within + * this string. If found, returns the index where it was + * found. If not found, returns npos. + */ + size_type + find_first_not_of(const _CharT* __s, size_type __pos, + size_type __n) const _GLIBCXX_NOEXCEPT; + + /** + * @brief Find position of a character not in C string. + * @param __s C string containing characters to avoid. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for a character not + * contained in @a __s within this string. If found, returns + * the index where it was found. If not found, returns npos. + */ + size_type + find_first_not_of(const _CharT* __s, size_type __pos = 0) const + _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_string(__s); + return this->find_first_not_of(__s, __pos, traits_type::length(__s)); + } + + /** + * @brief Find position of a different character. + * @param __c Character to avoid. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for a character + * other than @a __c within this string. If found, returns the + * index where it was found. If not found, returns npos. + */ + size_type + find_first_not_of(_CharT __c, size_type __pos = 0) const + _GLIBCXX_NOEXCEPT; + + /** + * @brief Find last position of a character not in string. + * @param __str String containing characters to avoid. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for a character + * not contained in @a __str within this string. If found, + * returns the index where it was found. If not found, returns + * npos. + */ + size_type + find_last_not_of(const basic_string& __str, size_type __pos = npos) const + _GLIBCXX_NOEXCEPT + { return this->find_last_not_of(__str.data(), __pos, __str.size()); } + +#if __cplusplus > 201402L + /** + * @brief Find last position of a character not in a string_view. + * @param __svt An object convertible to string_view containing + * characters to avoid. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + */ + template + _If_sv<_Tp, size_type> + find_last_not_of(const _Tp& __svt, size_type __pos = npos) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return this->find_last_not_of(__sv.data(), __pos, __sv.size()); + } +#endif // C++17 + + /** + * @brief Find last position of a character not in C substring. + * @param __s C string containing characters to avoid. + * @param __pos Index of character to search back from. + * @param __n Number of characters from s to consider. + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for a character not + * contained in the first @a __n characters of @a __s within this string. + * If found, returns the index where it was found. If not found, + * returns npos. + */ + size_type + find_last_not_of(const _CharT* __s, size_type __pos, + size_type __n) const _GLIBCXX_NOEXCEPT; + /** + * @brief Find last position of a character not in C string. + * @param __s C string containing characters to avoid. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for a character + * not contained in @a __s within this string. If found, + * returns the index where it was found. If not found, returns + * npos. + */ + size_type + find_last_not_of(const _CharT* __s, size_type __pos = npos) const + _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_string(__s); + return this->find_last_not_of(__s, __pos, traits_type::length(__s)); + } + + /** + * @brief Find last position of a different character. + * @param __c Character to avoid. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for a character other than + * @a __c within this string. If found, returns the index where it was + * found. If not found, returns npos. + */ + size_type + find_last_not_of(_CharT __c, size_type __pos = npos) const + _GLIBCXX_NOEXCEPT; + + /** + * @brief Get a substring. + * @param __pos Index of first character (default 0). + * @param __n Number of characters in substring (default remainder). + * @return The new string. + * @throw std::out_of_range If __pos > size(). + * + * Construct and return a new string using the @a __n + * characters starting at @a __pos. If the string is too + * short, use the remainder of the characters. If @a __pos is + * beyond the end of the string, out_of_range is thrown. + */ + basic_string + substr(size_type __pos = 0, size_type __n = npos) const + { return basic_string(*this, + _M_check(__pos, "basic_string::substr"), __n); } + + /** + * @brief Compare to a string. + * @param __str String to compare against. + * @return Integer < 0, 0, or > 0. + * + * Returns an integer < 0 if this string is ordered before @a + * __str, 0 if their values are equivalent, or > 0 if this + * string is ordered after @a __str. Determines the effective + * length rlen of the strings to compare as the smallest of + * size() and str.size(). The function then compares the two + * strings by calling traits::compare(data(), str.data(),rlen). + * If the result of the comparison is nonzero returns it, + * otherwise the shorter one is ordered first. + */ + int + compare(const basic_string& __str) const + { + const size_type __size = this->size(); + const size_type __osize = __str.size(); + const size_type __len = std::min(__size, __osize); + + int __r = traits_type::compare(_M_data(), __str.data(), __len); + if (!__r) + __r = _S_compare(__size, __osize); + return __r; + } + +#if __cplusplus > 201402L + /** + * @brief Compare to a string_view. + * @param __svt An object convertible to string_view to compare against. + * @return Integer < 0, 0, or > 0. + */ + template + _If_sv<_Tp, int> + compare(const _Tp& __svt) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + const size_type __size = this->size(); + const size_type __osize = __sv.size(); + const size_type __len = std::min(__size, __osize); + + int __r = traits_type::compare(_M_data(), __sv.data(), __len); + if (!__r) + __r = _S_compare(__size, __osize); + return __r; + } + + /** + * @brief Compare to a string_view. + * @param __pos A position in the string to start comparing from. + * @param __n The number of characters to compare. + * @param __svt An object convertible to string_view to compare + * against. + * @return Integer < 0, 0, or > 0. + */ + template + _If_sv<_Tp, int> + compare(size_type __pos, size_type __n, const _Tp& __svt) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return __sv_type(*this).substr(__pos, __n).compare(__sv); + } + + /** + * @brief Compare to a string_view. + * @param __pos1 A position in the string to start comparing from. + * @param __n1 The number of characters to compare. + * @param __svt An object convertible to string_view to compare + * against. + * @param __pos2 A position in the string_view to start comparing from. + * @param __n2 The number of characters to compare. + * @return Integer < 0, 0, or > 0. + */ + template + _If_sv<_Tp, int> + compare(size_type __pos1, size_type __n1, const _Tp& __svt, + size_type __pos2, size_type __n2 = npos) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return __sv_type(*this) + .substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2)); + } +#endif // C++17 + + /** + * @brief Compare substring to a string. + * @param __pos Index of first character of substring. + * @param __n Number of characters in substring. + * @param __str String to compare against. + * @return Integer < 0, 0, or > 0. + * + * Form the substring of this string from the @a __n characters + * starting at @a __pos. Returns an integer < 0 if the + * substring is ordered before @a __str, 0 if their values are + * equivalent, or > 0 if the substring is ordered after @a + * __str. Determines the effective length rlen of the strings + * to compare as the smallest of the length of the substring + * and @a __str.size(). The function then compares the two + * strings by calling + * traits::compare(substring.data(),str.data(),rlen). If the + * result of the comparison is nonzero returns it, otherwise + * the shorter one is ordered first. + */ + int + compare(size_type __pos, size_type __n, const basic_string& __str) const; + + /** + * @brief Compare substring to a substring. + * @param __pos1 Index of first character of substring. + * @param __n1 Number of characters in substring. + * @param __str String to compare against. + * @param __pos2 Index of first character of substring of str. + * @param __n2 Number of characters in substring of str. + * @return Integer < 0, 0, or > 0. + * + * Form the substring of this string from the @a __n1 + * characters starting at @a __pos1. Form the substring of @a + * __str from the @a __n2 characters starting at @a __pos2. + * Returns an integer < 0 if this substring is ordered before + * the substring of @a __str, 0 if their values are equivalent, + * or > 0 if this substring is ordered after the substring of + * @a __str. Determines the effective length rlen of the + * strings to compare as the smallest of the lengths of the + * substrings. The function then compares the two strings by + * calling + * traits::compare(substring.data(),str.substr(pos2,n2).data(),rlen). + * If the result of the comparison is nonzero returns it, + * otherwise the shorter one is ordered first. + */ + int + compare(size_type __pos1, size_type __n1, const basic_string& __str, + size_type __pos2, size_type __n2) const; + + /** + * @brief Compare to a C string. + * @param __s C string to compare against. + * @return Integer < 0, 0, or > 0. + * + * Returns an integer < 0 if this string is ordered before @a __s, 0 if + * their values are equivalent, or > 0 if this string is ordered after + * @a __s. Determines the effective length rlen of the strings to + * compare as the smallest of size() and the length of a string + * constructed from @a __s. The function then compares the two strings + * by calling traits::compare(data(),s,rlen). If the result of the + * comparison is nonzero returns it, otherwise the shorter one is + * ordered first. + */ + int + compare(const _CharT* __s) const _GLIBCXX_NOEXCEPT; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 5 String::compare specification questionable + /** + * @brief Compare substring to a C string. + * @param __pos Index of first character of substring. + * @param __n1 Number of characters in substring. + * @param __s C string to compare against. + * @return Integer < 0, 0, or > 0. + * + * Form the substring of this string from the @a __n1 + * characters starting at @a pos. Returns an integer < 0 if + * the substring is ordered before @a __s, 0 if their values + * are equivalent, or > 0 if the substring is ordered after @a + * __s. Determines the effective length rlen of the strings to + * compare as the smallest of the length of the substring and + * the length of a string constructed from @a __s. The + * function then compares the two string by calling + * traits::compare(substring.data(),__s,rlen). If the result of + * the comparison is nonzero returns it, otherwise the shorter + * one is ordered first. + */ + int + compare(size_type __pos, size_type __n1, const _CharT* __s) const; + + /** + * @brief Compare substring against a character %array. + * @param __pos Index of first character of substring. + * @param __n1 Number of characters in substring. + * @param __s character %array to compare against. + * @param __n2 Number of characters of s. + * @return Integer < 0, 0, or > 0. + * + * Form the substring of this string from the @a __n1 + * characters starting at @a __pos. Form a string from the + * first @a __n2 characters of @a __s. Returns an integer < 0 + * if this substring is ordered before the string from @a __s, + * 0 if their values are equivalent, or > 0 if this substring + * is ordered after the string from @a __s. Determines the + * effective length rlen of the strings to compare as the + * smallest of the length of the substring and @a __n2. The + * function then compares the two strings by calling + * traits::compare(substring.data(),s,rlen). If the result of + * the comparison is nonzero returns it, otherwise the shorter + * one is ordered first. + * + * NB: s must have at least n2 characters, '\\0' has + * no special meaning. + */ + int + compare(size_type __pos, size_type __n1, const _CharT* __s, + size_type __n2) const; + + // Allow basic_stringbuf::__xfer_bufptrs to call _M_length: + template friend class basic_stringbuf; + }; +_GLIBCXX_END_NAMESPACE_CXX11 +#else // !_GLIBCXX_USE_CXX11_ABI + // Reference-counted COW string implentation + + /** + * @class basic_string basic_string.h + * @brief Managing sequences of characters and character-like objects. + * + * @ingroup strings + * @ingroup sequences + * + * @tparam _CharT Type of character + * @tparam _Traits Traits for character type, defaults to + * char_traits<_CharT>. + * @tparam _Alloc Allocator type, defaults to allocator<_CharT>. + * + * Meets the requirements of a container, a + * reversible container, and a + * sequence. Of the + * optional sequence requirements, only + * @c push_back, @c at, and @c %array access are supported. + * + * @doctodo + * + * + * Documentation? What's that? + * Nathan Myers . + * + * A string looks like this: + * + * @code + * [_Rep] + * _M_length + * [basic_string] _M_capacity + * _M_dataplus _M_refcount + * _M_p ----------------> unnamed array of char_type + * @endcode + * + * Where the _M_p points to the first character in the string, and + * you cast it to a pointer-to-_Rep and subtract 1 to get a + * pointer to the header. + * + * This approach has the enormous advantage that a string object + * requires only one allocation. All the ugliness is confined + * within a single %pair of inline functions, which each compile to + * a single @a add instruction: _Rep::_M_data(), and + * string::_M_rep(); and the allocation function which gets a + * block of raw bytes and with room enough and constructs a _Rep + * object at the front. + * + * The reason you want _M_data pointing to the character %array and + * not the _Rep is so that the debugger can see the string + * contents. (Probably we should add a non-inline member to get + * the _Rep for the debugger to use, so users can check the actual + * string length.) + * + * Note that the _Rep object is a POD so that you can have a + * static empty string _Rep object already @a constructed before + * static constructors have run. The reference-count encoding is + * chosen so that a 0 indicates one reference, so you never try to + * destroy the empty-string _Rep object. + * + * All but the last paragraph is considered pretty conventional + * for a C++ string implementation. + */ + // 21.3 Template class basic_string + template + class basic_string + { + typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type; + + // Types: + public: + typedef _Traits traits_type; + typedef typename _Traits::char_type value_type; + typedef _Alloc allocator_type; + typedef typename _CharT_alloc_type::size_type size_type; + typedef typename _CharT_alloc_type::difference_type difference_type; + typedef typename _CharT_alloc_type::reference reference; + typedef typename _CharT_alloc_type::const_reference const_reference; + typedef typename _CharT_alloc_type::pointer pointer; + typedef typename _CharT_alloc_type::const_pointer const_pointer; + typedef __gnu_cxx::__normal_iterator iterator; + typedef __gnu_cxx::__normal_iterator + const_iterator; + typedef std::reverse_iterator const_reverse_iterator; + typedef std::reverse_iterator reverse_iterator; + + private: + // _Rep: string representation + // Invariants: + // 1. String really contains _M_length + 1 characters: due to 21.3.4 + // must be kept null-terminated. + // 2. _M_capacity >= _M_length + // Allocated memory is always (_M_capacity + 1) * sizeof(_CharT). + // 3. _M_refcount has three states: + // -1: leaked, one reference, no ref-copies allowed, non-const. + // 0: one reference, non-const. + // n>0: n + 1 references, operations require a lock, const. + // 4. All fields==0 is an empty string, given the extra storage + // beyond-the-end for a null terminator; thus, the shared + // empty string representation needs no constructor. + + struct _Rep_base + { + size_type _M_length; + size_type _M_capacity; + _Atomic_word _M_refcount; + }; + + struct _Rep : _Rep_base + { + // Types: + typedef typename _Alloc::template rebind::other _Raw_bytes_alloc; + + // (Public) Data members: + + // The maximum number of individual char_type elements of an + // individual string is determined by _S_max_size. This is the + // value that will be returned by max_size(). (Whereas npos + // is the maximum number of bytes the allocator can allocate.) + // If one was to divvy up the theoretical largest size string, + // with a terminating character and m _CharT elements, it'd + // look like this: + // npos = sizeof(_Rep) + (m * sizeof(_CharT)) + sizeof(_CharT) + // Solving for m: + // m = ((npos - sizeof(_Rep))/sizeof(CharT)) - 1 + // In addition, this implementation quarters this amount. + static const size_type _S_max_size; + static const _CharT _S_terminal; + + // The following storage is init'd to 0 by the linker, resulting + // (carefully) in an empty string with one reference. + static size_type _S_empty_rep_storage[]; + + static _Rep& + _S_empty_rep() _GLIBCXX_NOEXCEPT + { + // NB: Mild hack to avoid strict-aliasing warnings. Note that + // _S_empty_rep_storage is never modified and the punning should + // be reasonably safe in this case. + void* __p = reinterpret_cast(&_S_empty_rep_storage); + return *reinterpret_cast<_Rep*>(__p); + } + + bool + _M_is_leaked() const _GLIBCXX_NOEXCEPT + { +#if defined(__GTHREADS) + // _M_refcount is mutated concurrently by _M_refcopy/_M_dispose, + // so we need to use an atomic load. However, _M_is_leaked + // predicate does not change concurrently (i.e. the string is either + // leaked or not), so a relaxed load is enough. + return __atomic_load_n(&this->_M_refcount, __ATOMIC_RELAXED) < 0; +#else + return this->_M_refcount < 0; +#endif + } + + bool + _M_is_shared() const _GLIBCXX_NOEXCEPT + { +#if defined(__GTHREADS) + // _M_refcount is mutated concurrently by _M_refcopy/_M_dispose, + // so we need to use an atomic load. Another thread can drop last + // but one reference concurrently with this check, so we need this + // load to be acquire to synchronize with release fetch_and_add in + // _M_dispose. + return __atomic_load_n(&this->_M_refcount, __ATOMIC_ACQUIRE) > 0; +#else + return this->_M_refcount > 0; +#endif + } + + void + _M_set_leaked() _GLIBCXX_NOEXCEPT + { this->_M_refcount = -1; } + + void + _M_set_sharable() _GLIBCXX_NOEXCEPT + { this->_M_refcount = 0; } + + void + _M_set_length_and_sharable(size_type __n) _GLIBCXX_NOEXCEPT + { +#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 + if (__builtin_expect(this != &_S_empty_rep(), false)) +#endif + { + this->_M_set_sharable(); // One reference. + this->_M_length = __n; + traits_type::assign(this->_M_refdata()[__n], _S_terminal); + // grrr. (per 21.3.4) + // You cannot leave those LWG people alone for a second. + } + } + + _CharT* + _M_refdata() throw() + { return reinterpret_cast<_CharT*>(this + 1); } + + _CharT* + _M_grab(const _Alloc& __alloc1, const _Alloc& __alloc2) + { + return (!_M_is_leaked() && __alloc1 == __alloc2) + ? _M_refcopy() : _M_clone(__alloc1); + } + + // Create & Destroy + static _Rep* + _S_create(size_type, size_type, const _Alloc&); + + void + _M_dispose(const _Alloc& __a) _GLIBCXX_NOEXCEPT + { +#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 + if (__builtin_expect(this != &_S_empty_rep(), false)) +#endif + { + // Be race-detector-friendly. For more info see bits/c++config. + _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount); + // Decrement of _M_refcount is acq_rel, because: + // - all but last decrements need to release to synchronize with + // the last decrement that will delete the object. + // - the last decrement needs to acquire to synchronize with + // all the previous decrements. + // - last but one decrement needs to release to synchronize with + // the acquire load in _M_is_shared that will conclude that + // the object is not shared anymore. + if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, + -1) <= 0) + { + _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount); + _M_destroy(__a); + } + } + } // XXX MT + + void + _M_destroy(const _Alloc&) throw(); + + _CharT* + _M_refcopy() throw() + { +#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 + if (__builtin_expect(this != &_S_empty_rep(), false)) +#endif + __gnu_cxx::__atomic_add_dispatch(&this->_M_refcount, 1); + return _M_refdata(); + } // XXX MT + + _CharT* + _M_clone(const _Alloc&, size_type __res = 0); + }; + + // Use empty-base optimization: http://www.cantrip.org/emptyopt.html + struct _Alloc_hider : _Alloc + { + _Alloc_hider(_CharT* __dat, const _Alloc& __a) _GLIBCXX_NOEXCEPT + : _Alloc(__a), _M_p(__dat) { } + + _CharT* _M_p; // The actual data. + }; + + public: + // Data Members (public): + // NB: This is an unsigned type, and thus represents the maximum + // size that the allocator can hold. + /// Value returned by various member functions when they fail. + static const size_type npos = static_cast(-1); + + private: + // Data Members (private): + mutable _Alloc_hider _M_dataplus; + + _CharT* + _M_data() const _GLIBCXX_NOEXCEPT + { return _M_dataplus._M_p; } + + _CharT* + _M_data(_CharT* __p) _GLIBCXX_NOEXCEPT + { return (_M_dataplus._M_p = __p); } + + _Rep* + _M_rep() const _GLIBCXX_NOEXCEPT + { return &((reinterpret_cast<_Rep*> (_M_data()))[-1]); } + + // For the internal use we have functions similar to `begin'/`end' + // but they do not call _M_leak. + iterator + _M_ibegin() const _GLIBCXX_NOEXCEPT + { return iterator(_M_data()); } + + iterator + _M_iend() const _GLIBCXX_NOEXCEPT + { return iterator(_M_data() + this->size()); } + + void + _M_leak() // for use in begin() & non-const op[] + { + if (!_M_rep()->_M_is_leaked()) + _M_leak_hard(); + } + + size_type + _M_check(size_type __pos, const char* __s) const + { + if (__pos > this->size()) + __throw_out_of_range_fmt(__N("%s: __pos (which is %zu) > " + "this->size() (which is %zu)"), + __s, __pos, this->size()); + return __pos; + } + + void + _M_check_length(size_type __n1, size_type __n2, const char* __s) const + { + if (this->max_size() - (this->size() - __n1) < __n2) + __throw_length_error(__N(__s)); + } + + // NB: _M_limit doesn't check for a bad __pos value. + size_type + _M_limit(size_type __pos, size_type __off) const _GLIBCXX_NOEXCEPT + { + const bool __testoff = __off < this->size() - __pos; + return __testoff ? __off : this->size() - __pos; + } + + // True if _Rep and source do not overlap. + bool + _M_disjunct(const _CharT* __s) const _GLIBCXX_NOEXCEPT + { + return (less()(__s, _M_data()) + || less()(_M_data() + this->size(), __s)); + } + + // When __n = 1 way faster than the general multichar + // traits_type::copy/move/assign. + static void + _M_copy(_CharT* __d, const _CharT* __s, size_type __n) _GLIBCXX_NOEXCEPT + { + if (__n == 1) + traits_type::assign(*__d, *__s); + else + traits_type::copy(__d, __s, __n); + } + + static void + _M_move(_CharT* __d, const _CharT* __s, size_type __n) _GLIBCXX_NOEXCEPT + { + if (__n == 1) + traits_type::assign(*__d, *__s); + else + traits_type::move(__d, __s, __n); + } + + static void + _M_assign(_CharT* __d, size_type __n, _CharT __c) _GLIBCXX_NOEXCEPT + { + if (__n == 1) + traits_type::assign(*__d, __c); + else + traits_type::assign(__d, __n, __c); + } + + // _S_copy_chars is a separate template to permit specialization + // to optimize for the common case of pointers as iterators. + template + static void + _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2) + { + for (; __k1 != __k2; ++__k1, (void)++__p) + traits_type::assign(*__p, *__k1); // These types are off. + } + + static void + _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2) _GLIBCXX_NOEXCEPT + { _S_copy_chars(__p, __k1.base(), __k2.base()); } + + static void + _S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2) + _GLIBCXX_NOEXCEPT + { _S_copy_chars(__p, __k1.base(), __k2.base()); } + + static void + _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2) _GLIBCXX_NOEXCEPT + { _M_copy(__p, __k1, __k2 - __k1); } + + static void + _S_copy_chars(_CharT* __p, const _CharT* __k1, const _CharT* __k2) + _GLIBCXX_NOEXCEPT + { _M_copy(__p, __k1, __k2 - __k1); } + + static int + _S_compare(size_type __n1, size_type __n2) _GLIBCXX_NOEXCEPT + { + const difference_type __d = difference_type(__n1 - __n2); + + if (__d > __gnu_cxx::__numeric_traits::__max) + return __gnu_cxx::__numeric_traits::__max; + else if (__d < __gnu_cxx::__numeric_traits::__min) + return __gnu_cxx::__numeric_traits::__min; + else + return int(__d); + } + + void + _M_mutate(size_type __pos, size_type __len1, size_type __len2); + + void + _M_leak_hard(); + + static _Rep& + _S_empty_rep() _GLIBCXX_NOEXCEPT + { return _Rep::_S_empty_rep(); } + +#if __cplusplus > 201402L + // A helper type for avoiding boiler-plate. + typedef basic_string_view<_CharT, _Traits> __sv_type; + + template + using _If_sv = enable_if_t< + __and_, + __not_>, + __not_>>::value, + _Res>; + + // Allows an implicit conversion to __sv_type. + static __sv_type + _S_to_string_view(__sv_type __svt) noexcept + { return __svt; } + + // Wraps a string_view by explicit conversion and thus + // allows to add an internal constructor that does not + // participate in overload resolution when a string_view + // is provided. + struct __sv_wrapper + { + explicit __sv_wrapper(__sv_type __sv) noexcept : _M_sv(__sv) { } + __sv_type _M_sv; + }; +#endif + + public: + // Construct/copy/destroy: + // NB: We overload ctors in some cases instead of using default + // arguments, per 17.4.4.4 para. 2 item 2. + + /** + * @brief Default constructor creates an empty string. + */ + basic_string() +#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 + : _M_dataplus(_S_empty_rep()._M_refdata(), _Alloc()) { } +#else + : _M_dataplus(_S_construct(size_type(), _CharT(), _Alloc()), _Alloc()){ } +#endif + + /** + * @brief Construct an empty string using allocator @a a. + */ + explicit + basic_string(const _Alloc& __a); + + // NB: per LWG issue 42, semantics different from IS: + /** + * @brief Construct string with copy of value of @a str. + * @param __str Source string. + */ + basic_string(const basic_string& __str); + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2583. no way to supply an allocator for basic_string(str, pos) + /** + * @brief Construct string as copy of a substring. + * @param __str Source string. + * @param __pos Index of first character to copy from. + * @param __a Allocator to use. + */ + basic_string(const basic_string& __str, size_type __pos, + const _Alloc& __a = _Alloc()); + + /** + * @brief Construct string as copy of a substring. + * @param __str Source string. + * @param __pos Index of first character to copy from. + * @param __n Number of characters to copy. + */ + basic_string(const basic_string& __str, size_type __pos, + size_type __n); + /** + * @brief Construct string as copy of a substring. + * @param __str Source string. + * @param __pos Index of first character to copy from. + * @param __n Number of characters to copy. + * @param __a Allocator to use. + */ + basic_string(const basic_string& __str, size_type __pos, + size_type __n, const _Alloc& __a); + + /** + * @brief Construct string initialized by a character %array. + * @param __s Source character %array. + * @param __n Number of characters to copy. + * @param __a Allocator to use (default is default allocator). + * + * NB: @a __s must have at least @a __n characters, '\\0' + * has no special meaning. + */ + basic_string(const _CharT* __s, size_type __n, + const _Alloc& __a = _Alloc()); + /** + * @brief Construct string as copy of a C string. + * @param __s Source C string. + * @param __a Allocator to use (default is default allocator). + */ + basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()); + /** + * @brief Construct string as multiple characters. + * @param __n Number of characters. + * @param __c Character to use. + * @param __a Allocator to use (default is default allocator). + */ + basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc()); + +#if __cplusplus >= 201103L + /** + * @brief Move construct string. + * @param __str Source string. + * + * The newly-created string contains the exact contents of @a __str. + * @a __str is a valid, but unspecified string. + **/ + basic_string(basic_string&& __str) +#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 + noexcept // FIXME C++11: should always be noexcept. +#endif + : _M_dataplus(__str._M_dataplus) + { +#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 + __str._M_data(_S_empty_rep()._M_refdata()); +#else + __str._M_data(_S_construct(size_type(), _CharT(), get_allocator())); +#endif + } + + /** + * @brief Construct string from an initializer %list. + * @param __l std::initializer_list of characters. + * @param __a Allocator to use (default is default allocator). + */ + basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()); +#endif // C++11 + + /** + * @brief Construct string as copy of a range. + * @param __beg Start of range. + * @param __end End of range. + * @param __a Allocator to use (default is default allocator). + */ + template + basic_string(_InputIterator __beg, _InputIterator __end, + const _Alloc& __a = _Alloc()); + +#if __cplusplus > 201402L + /** + * @brief Construct string from a substring of a string_view. + * @param __t Source object convertible to string view. + * @param __pos The index of the first character to copy from __t. + * @param __n The number of characters to copy from __t. + * @param __a Allocator to use. + */ + template> + basic_string(const _Tp& __t, size_type __pos, size_type __n, + const _Alloc& __a = _Alloc()) + : basic_string(_S_to_string_view(__t).substr(__pos, __n), __a) { } + + /** + * @brief Construct string from a string_view. + * @param __t Source object convertible to string view. + * @param __a Allocator to use (default is default allocator). + */ + template> + explicit + basic_string(const _Tp& __t, const _Alloc& __a = _Alloc()) + : basic_string(__sv_wrapper(_S_to_string_view(__t)), __a) { } + + /** + * @brief Only internally used: Construct string from a string view + * wrapper. + * @param __svw string view wrapper. + * @param __a Allocator to use. + */ + explicit + basic_string(__sv_wrapper __svw, const _Alloc& __a) + : basic_string(__svw._M_sv.data(), __svw._M_sv.size(), __a) { } +#endif // C++17 + + /** + * @brief Destroy the string instance. + */ + ~basic_string() _GLIBCXX_NOEXCEPT + { _M_rep()->_M_dispose(this->get_allocator()); } + + /** + * @brief Assign the value of @a str to this string. + * @param __str Source string. + */ + basic_string& + operator=(const basic_string& __str) + { return this->assign(__str); } + + /** + * @brief Copy contents of @a s into this string. + * @param __s Source null-terminated string. + */ + basic_string& + operator=(const _CharT* __s) + { return this->assign(__s); } + + /** + * @brief Set value to string of length 1. + * @param __c Source character. + * + * Assigning to a character makes this string length 1 and + * (*this)[0] == @a c. + */ + basic_string& + operator=(_CharT __c) + { + this->assign(1, __c); + return *this; + } + +#if __cplusplus >= 201103L + /** + * @brief Move assign the value of @a str to this string. + * @param __str Source string. + * + * The contents of @a str are moved into this string (without copying). + * @a str is a valid, but unspecified string. + **/ + // PR 58265, this should be noexcept. + basic_string& + operator=(basic_string&& __str) + { + // NB: DR 1204. + this->swap(__str); + return *this; + } + + /** + * @brief Set value to string constructed from initializer %list. + * @param __l std::initializer_list. + */ + basic_string& + operator=(initializer_list<_CharT> __l) + { + this->assign(__l.begin(), __l.size()); + return *this; + } +#endif // C++11 + +#if __cplusplus > 201402L + /** + * @brief Set value to string constructed from a string_view. + * @param __svt An object convertible to string_view. + */ + template + _If_sv<_Tp, basic_string&> + operator=(const _Tp& __svt) + { return this->assign(__svt); } + + /** + * @brief Convert to a string_view. + * @return A string_view. + */ + operator __sv_type() const noexcept + { return __sv_type(data(), size()); } +#endif // C++17 + + // Iterators: + /** + * Returns a read/write iterator that points to the first character in + * the %string. Unshares the string. + */ + iterator + begin() // FIXME C++11: should be noexcept. + { + _M_leak(); + return iterator(_M_data()); + } + + /** + * Returns a read-only (constant) iterator that points to the first + * character in the %string. + */ + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return const_iterator(_M_data()); } + + /** + * Returns a read/write iterator that points one past the last + * character in the %string. Unshares the string. + */ + iterator + end() // FIXME C++11: should be noexcept. + { + _M_leak(); + return iterator(_M_data() + this->size()); + } + + /** + * Returns a read-only (constant) iterator that points one past the + * last character in the %string. + */ + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return const_iterator(_M_data() + this->size()); } + + /** + * Returns a read/write reverse iterator that points to the last + * character in the %string. Iteration is done in reverse element + * order. Unshares the string. + */ + reverse_iterator + rbegin() // FIXME C++11: should be noexcept. + { return reverse_iterator(this->end()); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to the last character in the %string. Iteration is done in + * reverse element order. + */ + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(this->end()); } + + /** + * Returns a read/write reverse iterator that points to one before the + * first character in the %string. Iteration is done in reverse + * element order. Unshares the string. + */ + reverse_iterator + rend() // FIXME C++11: should be noexcept. + { return reverse_iterator(this->begin()); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to one before the first character in the %string. Iteration + * is done in reverse element order. + */ + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(this->begin()); } + +#if __cplusplus >= 201103L + /** + * Returns a read-only (constant) iterator that points to the first + * character in the %string. + */ + const_iterator + cbegin() const noexcept + { return const_iterator(this->_M_data()); } + + /** + * Returns a read-only (constant) iterator that points one past the + * last character in the %string. + */ + const_iterator + cend() const noexcept + { return const_iterator(this->_M_data() + this->size()); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to the last character in the %string. Iteration is done in + * reverse element order. + */ + const_reverse_iterator + crbegin() const noexcept + { return const_reverse_iterator(this->end()); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to one before the first character in the %string. Iteration + * is done in reverse element order. + */ + const_reverse_iterator + crend() const noexcept + { return const_reverse_iterator(this->begin()); } +#endif + + public: + // Capacity: + /// Returns the number of characters in the string, not including any + /// null-termination. + size_type + size() const _GLIBCXX_NOEXCEPT + { return _M_rep()->_M_length; } + + /// Returns the number of characters in the string, not including any + /// null-termination. + size_type + length() const _GLIBCXX_NOEXCEPT + { return _M_rep()->_M_length; } + + /// Returns the size() of the largest possible %string. + size_type + max_size() const _GLIBCXX_NOEXCEPT + { return _Rep::_S_max_size; } + + /** + * @brief Resizes the %string to the specified number of characters. + * @param __n Number of characters the %string should contain. + * @param __c Character to fill any new elements. + * + * This function will %resize the %string to the specified + * number of characters. If the number is smaller than the + * %string's current size the %string is truncated, otherwise + * the %string is extended and new elements are %set to @a __c. + */ + void + resize(size_type __n, _CharT __c); + + /** + * @brief Resizes the %string to the specified number of characters. + * @param __n Number of characters the %string should contain. + * + * This function will resize the %string to the specified length. If + * the new size is smaller than the %string's current size the %string + * is truncated, otherwise the %string is extended and new characters + * are default-constructed. For basic types such as char, this means + * setting them to 0. + */ + void + resize(size_type __n) + { this->resize(__n, _CharT()); } + +#if __cplusplus >= 201103L + /// A non-binding request to reduce capacity() to size(). + void + shrink_to_fit() _GLIBCXX_NOEXCEPT + { +#if __cpp_exceptions + if (capacity() > size()) + { + try + { reserve(0); } + catch(...) + { } + } +#endif + } +#endif + + /** + * Returns the total number of characters that the %string can hold + * before needing to allocate more memory. + */ + size_type + capacity() const _GLIBCXX_NOEXCEPT + { return _M_rep()->_M_capacity; } + + /** + * @brief Attempt to preallocate enough memory for specified number of + * characters. + * @param __res_arg Number of characters required. + * @throw std::length_error If @a __res_arg exceeds @c max_size(). + * + * This function attempts to reserve enough memory for the + * %string to hold the specified number of characters. If the + * number requested is more than max_size(), length_error is + * thrown. + * + * The advantage of this function is that if optimal code is a + * necessity and the user can determine the string length that will be + * required, the user can reserve the memory in %advance, and thus + * prevent a possible reallocation of memory and copying of %string + * data. + */ + void + reserve(size_type __res_arg = 0); + + /** + * Erases the string, making it empty. + */ +#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 + void + clear() _GLIBCXX_NOEXCEPT + { + if (_M_rep()->_M_is_shared()) + { + _M_rep()->_M_dispose(this->get_allocator()); + _M_data(_S_empty_rep()._M_refdata()); + } + else + _M_rep()->_M_set_length_and_sharable(0); + } +#else + // PR 56166: this should not throw. + void + clear() + { _M_mutate(0, this->size(), 0); } +#endif + + /** + * Returns true if the %string is empty. Equivalent to + * *this == "". + */ + bool + empty() const _GLIBCXX_NOEXCEPT + { return this->size() == 0; } + + // Element access: + /** + * @brief Subscript access to the data contained in the %string. + * @param __pos The index of the character to access. + * @return Read-only (constant) reference to the character. + * + * This operator allows for easy, array-style, data access. + * Note that data access with this operator is unchecked and + * out_of_range lookups are not defined. (For checked lookups + * see at().) + */ + const_reference + operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT + { + __glibcxx_assert(__pos <= size()); + return _M_data()[__pos]; + } + + /** + * @brief Subscript access to the data contained in the %string. + * @param __pos The index of the character to access. + * @return Read/write reference to the character. + * + * This operator allows for easy, array-style, data access. + * Note that data access with this operator is unchecked and + * out_of_range lookups are not defined. (For checked lookups + * see at().) Unshares the string. + */ + reference + operator[](size_type __pos) + { + // Allow pos == size() both in C++98 mode, as v3 extension, + // and in C++11 mode. + __glibcxx_assert(__pos <= size()); + // In pedantic mode be strict in C++98 mode. + _GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L || __pos < size()); + _M_leak(); + return _M_data()[__pos]; + } + + /** + * @brief Provides access to the data contained in the %string. + * @param __n The index of the character to access. + * @return Read-only (const) reference to the character. + * @throw std::out_of_range If @a n is an invalid index. + * + * This function provides for safer data access. The parameter is + * first checked that it is in the range of the string. The function + * throws out_of_range if the check fails. + */ + const_reference + at(size_type __n) const + { + if (__n >= this->size()) + __throw_out_of_range_fmt(__N("basic_string::at: __n " + "(which is %zu) >= this->size() " + "(which is %zu)"), + __n, this->size()); + return _M_data()[__n]; + } + + /** + * @brief Provides access to the data contained in the %string. + * @param __n The index of the character to access. + * @return Read/write reference to the character. + * @throw std::out_of_range If @a n is an invalid index. + * + * This function provides for safer data access. The parameter is + * first checked that it is in the range of the string. The function + * throws out_of_range if the check fails. Success results in + * unsharing the string. + */ + reference + at(size_type __n) + { + if (__n >= size()) + __throw_out_of_range_fmt(__N("basic_string::at: __n " + "(which is %zu) >= this->size() " + "(which is %zu)"), + __n, this->size()); + _M_leak(); + return _M_data()[__n]; + } + +#if __cplusplus >= 201103L + /** + * Returns a read/write reference to the data at the first + * element of the %string. + */ + reference + front() + { + __glibcxx_assert(!empty()); + return operator[](0); + } + + /** + * Returns a read-only (constant) reference to the data at the first + * element of the %string. + */ + const_reference + front() const noexcept + { + __glibcxx_assert(!empty()); + return operator[](0); + } + + /** + * Returns a read/write reference to the data at the last + * element of the %string. + */ + reference + back() + { + __glibcxx_assert(!empty()); + return operator[](this->size() - 1); + } + + /** + * Returns a read-only (constant) reference to the data at the + * last element of the %string. + */ + const_reference + back() const noexcept + { + __glibcxx_assert(!empty()); + return operator[](this->size() - 1); + } +#endif + + // Modifiers: + /** + * @brief Append a string to this string. + * @param __str The string to append. + * @return Reference to this string. + */ + basic_string& + operator+=(const basic_string& __str) + { return this->append(__str); } + + /** + * @brief Append a C string. + * @param __s The C string to append. + * @return Reference to this string. + */ + basic_string& + operator+=(const _CharT* __s) + { return this->append(__s); } + + /** + * @brief Append a character. + * @param __c The character to append. + * @return Reference to this string. + */ + basic_string& + operator+=(_CharT __c) + { + this->push_back(__c); + return *this; + } + +#if __cplusplus >= 201103L + /** + * @brief Append an initializer_list of characters. + * @param __l The initializer_list of characters to be appended. + * @return Reference to this string. + */ + basic_string& + operator+=(initializer_list<_CharT> __l) + { return this->append(__l.begin(), __l.size()); } +#endif // C++11 + +#if __cplusplus > 201402L + /** + * @brief Append a string_view. + * @param __svt The object convertible to string_view to be appended. + * @return Reference to this string. + */ + template + _If_sv<_Tp, basic_string&> + operator+=(const _Tp& __svt) + { return this->append(__svt); } +#endif // C++17 + + /** + * @brief Append a string to this string. + * @param __str The string to append. + * @return Reference to this string. + */ + basic_string& + append(const basic_string& __str); + + /** + * @brief Append a substring. + * @param __str The string to append. + * @param __pos Index of the first character of str to append. + * @param __n The number of characters to append. + * @return Reference to this string. + * @throw std::out_of_range if @a __pos is not a valid index. + * + * This function appends @a __n characters from @a __str + * starting at @a __pos to this string. If @a __n is is larger + * than the number of available characters in @a __str, the + * remainder of @a __str is appended. + */ + basic_string& + append(const basic_string& __str, size_type __pos, size_type __n); + + /** + * @brief Append a C substring. + * @param __s The C string to append. + * @param __n The number of characters to append. + * @return Reference to this string. + */ + basic_string& + append(const _CharT* __s, size_type __n); + + /** + * @brief Append a C string. + * @param __s The C string to append. + * @return Reference to this string. + */ + basic_string& + append(const _CharT* __s) + { + __glibcxx_requires_string(__s); + return this->append(__s, traits_type::length(__s)); + } + + /** + * @brief Append multiple characters. + * @param __n The number of characters to append. + * @param __c The character to use. + * @return Reference to this string. + * + * Appends __n copies of __c to this string. + */ + basic_string& + append(size_type __n, _CharT __c); + +#if __cplusplus >= 201103L + /** + * @brief Append an initializer_list of characters. + * @param __l The initializer_list of characters to append. + * @return Reference to this string. + */ + basic_string& + append(initializer_list<_CharT> __l) + { return this->append(__l.begin(), __l.size()); } +#endif // C++11 + + /** + * @brief Append a range of characters. + * @param __first Iterator referencing the first character to append. + * @param __last Iterator marking the end of the range. + * @return Reference to this string. + * + * Appends characters in the range [__first,__last) to this string. + */ + template + basic_string& + append(_InputIterator __first, _InputIterator __last) + { return this->replace(_M_iend(), _M_iend(), __first, __last); } + +#if __cplusplus > 201402L + /** + * @brief Append a string_view. + * @param __svt The object convertible to string_view to be appended. + * @return Reference to this string. + */ + template + _If_sv<_Tp, basic_string&> + append(const _Tp& __svt) + { + __sv_type __sv = __svt; + return this->append(__sv.data(), __sv.size()); + } + + /** + * @brief Append a range of characters from a string_view. + * @param __svt The object convertible to string_view to be appended + * from. + * @param __pos The position in the string_view to append from. + * @param __n The number of characters to append from the string_view. + * @return Reference to this string. + */ + template + _If_sv<_Tp, basic_string&> + append(const _Tp& __svt, size_type __pos, size_type __n = npos) + { + __sv_type __sv = __svt; + return append(__sv.data() + + __sv._M_check(__pos, "basic_string::append"), + __sv._M_limit(__pos, __n)); + } +#endif // C++17 + + /** + * @brief Append a single character. + * @param __c Character to append. + */ + void + push_back(_CharT __c) + { + const size_type __len = 1 + this->size(); + if (__len > this->capacity() || _M_rep()->_M_is_shared()) + this->reserve(__len); + traits_type::assign(_M_data()[this->size()], __c); + _M_rep()->_M_set_length_and_sharable(__len); + } + + /** + * @brief Set value to contents of another string. + * @param __str Source string to use. + * @return Reference to this string. + */ + basic_string& + assign(const basic_string& __str); + +#if __cplusplus >= 201103L + /** + * @brief Set value to contents of another string. + * @param __str Source string to use. + * @return Reference to this string. + * + * This function sets this string to the exact contents of @a __str. + * @a __str is a valid, but unspecified string. + */ + // PR 58265, this should be noexcept. + basic_string& + assign(basic_string&& __str) + { + this->swap(__str); + return *this; + } +#endif // C++11 + + /** + * @brief Set value to a substring of a string. + * @param __str The string to use. + * @param __pos Index of the first character of str. + * @param __n Number of characters to use. + * @return Reference to this string. + * @throw std::out_of_range if @a pos is not a valid index. + * + * This function sets this string to the substring of @a __str + * consisting of @a __n characters at @a __pos. If @a __n is + * is larger than the number of available characters in @a + * __str, the remainder of @a __str is used. + */ + basic_string& + assign(const basic_string& __str, size_type __pos, size_type __n) + { return this->assign(__str._M_data() + + __str._M_check(__pos, "basic_string::assign"), + __str._M_limit(__pos, __n)); } + + /** + * @brief Set value to a C substring. + * @param __s The C string to use. + * @param __n Number of characters to use. + * @return Reference to this string. + * + * This function sets the value of this string to the first @a __n + * characters of @a __s. If @a __n is is larger than the number of + * available characters in @a __s, the remainder of @a __s is used. + */ + basic_string& + assign(const _CharT* __s, size_type __n); + + /** + * @brief Set value to contents of a C string. + * @param __s The C string to use. + * @return Reference to this string. + * + * This function sets the value of this string to the value of @a __s. + * The data is copied, so there is no dependence on @a __s once the + * function returns. + */ + basic_string& + assign(const _CharT* __s) + { + __glibcxx_requires_string(__s); + return this->assign(__s, traits_type::length(__s)); + } + + /** + * @brief Set value to multiple characters. + * @param __n Length of the resulting string. + * @param __c The character to use. + * @return Reference to this string. + * + * This function sets the value of this string to @a __n copies of + * character @a __c. + */ + basic_string& + assign(size_type __n, _CharT __c) + { return _M_replace_aux(size_type(0), this->size(), __n, __c); } + + /** + * @brief Set value to a range of characters. + * @param __first Iterator referencing the first character to append. + * @param __last Iterator marking the end of the range. + * @return Reference to this string. + * + * Sets value of string to characters in the range [__first,__last). + */ + template + basic_string& + assign(_InputIterator __first, _InputIterator __last) + { return this->replace(_M_ibegin(), _M_iend(), __first, __last); } + +#if __cplusplus >= 201103L + /** + * @brief Set value to an initializer_list of characters. + * @param __l The initializer_list of characters to assign. + * @return Reference to this string. + */ + basic_string& + assign(initializer_list<_CharT> __l) + { return this->assign(__l.begin(), __l.size()); } +#endif // C++11 + +#if __cplusplus > 201402L + /** + * @brief Set value from a string_view. + * @param __svt The source object convertible to string_view. + * @return Reference to this string. + */ + template + _If_sv<_Tp, basic_string&> + assign(const _Tp& __svt) + { + __sv_type __sv = __svt; + return this->assign(__sv.data(), __sv.size()); + } + + /** + * @brief Set value from a range of characters in a string_view. + * @param __svt The source object convertible to string_view. + * @param __pos The position in the string_view to assign from. + * @param __n The number of characters to assign. + * @return Reference to this string. + */ + template + _If_sv<_Tp, basic_string&> + assign(const _Tp& __svt, size_type __pos, size_type __n = npos) + { + __sv_type __sv = __svt; + return assign(__sv.data() + + __sv._M_check(__pos, "basic_string::assign"), + __sv._M_limit(__pos, __n)); + } +#endif // C++17 + + /** + * @brief Insert multiple characters. + * @param __p Iterator referencing location in string to insert at. + * @param __n Number of characters to insert + * @param __c The character to insert. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Inserts @a __n copies of character @a __c starting at the + * position referenced by iterator @a __p. If adding + * characters causes the length to exceed max_size(), + * length_error is thrown. The value of the string doesn't + * change if an error is thrown. + */ + void + insert(iterator __p, size_type __n, _CharT __c) + { this->replace(__p, __p, __n, __c); } + + /** + * @brief Insert a range of characters. + * @param __p Iterator referencing location in string to insert at. + * @param __beg Start of range. + * @param __end End of range. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Inserts characters in range [__beg,__end). If adding + * characters causes the length to exceed max_size(), + * length_error is thrown. The value of the string doesn't + * change if an error is thrown. + */ + template + void + insert(iterator __p, _InputIterator __beg, _InputIterator __end) + { this->replace(__p, __p, __beg, __end); } + +#if __cplusplus >= 201103L + /** + * @brief Insert an initializer_list of characters. + * @param __p Iterator referencing location in string to insert at. + * @param __l The initializer_list of characters to insert. + * @throw std::length_error If new length exceeds @c max_size(). + */ + void + insert(iterator __p, initializer_list<_CharT> __l) + { + _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend()); + this->insert(__p - _M_ibegin(), __l.begin(), __l.size()); + } +#endif // C++11 + + /** + * @brief Insert value of a string. + * @param __pos1 Iterator referencing location in string to insert at. + * @param __str The string to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Inserts value of @a __str starting at @a __pos1. If adding + * characters causes the length to exceed max_size(), + * length_error is thrown. The value of the string doesn't + * change if an error is thrown. + */ + basic_string& + insert(size_type __pos1, const basic_string& __str) + { return this->insert(__pos1, __str, size_type(0), __str.size()); } + + /** + * @brief Insert a substring. + * @param __pos1 Iterator referencing location in string to insert at. + * @param __str The string to insert. + * @param __pos2 Start of characters in str to insert. + * @param __n Number of characters to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * @throw std::out_of_range If @a pos1 > size() or + * @a __pos2 > @a str.size(). + * + * Starting at @a pos1, insert @a __n character of @a __str + * beginning with @a __pos2. If adding characters causes the + * length to exceed max_size(), length_error is thrown. If @a + * __pos1 is beyond the end of this string or @a __pos2 is + * beyond the end of @a __str, out_of_range is thrown. The + * value of the string doesn't change if an error is thrown. + */ + basic_string& + insert(size_type __pos1, const basic_string& __str, + size_type __pos2, size_type __n) + { return this->insert(__pos1, __str._M_data() + + __str._M_check(__pos2, "basic_string::insert"), + __str._M_limit(__pos2, __n)); } + + /** + * @brief Insert a C substring. + * @param __pos Iterator referencing location in string to insert at. + * @param __s The C string to insert. + * @param __n The number of characters to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * @throw std::out_of_range If @a __pos is beyond the end of this + * string. + * + * Inserts the first @a __n characters of @a __s starting at @a + * __pos. If adding characters causes the length to exceed + * max_size(), length_error is thrown. If @a __pos is beyond + * end(), out_of_range is thrown. The value of the string + * doesn't change if an error is thrown. + */ + basic_string& + insert(size_type __pos, const _CharT* __s, size_type __n); + + /** + * @brief Insert a C string. + * @param __pos Iterator referencing location in string to insert at. + * @param __s The C string to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * @throw std::out_of_range If @a pos is beyond the end of this + * string. + * + * Inserts the first @a n characters of @a __s starting at @a __pos. If + * adding characters causes the length to exceed max_size(), + * length_error is thrown. If @a __pos is beyond end(), out_of_range is + * thrown. The value of the string doesn't change if an error is + * thrown. + */ + basic_string& + insert(size_type __pos, const _CharT* __s) + { + __glibcxx_requires_string(__s); + return this->insert(__pos, __s, traits_type::length(__s)); + } + + /** + * @brief Insert multiple characters. + * @param __pos Index in string to insert at. + * @param __n Number of characters to insert + * @param __c The character to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * @throw std::out_of_range If @a __pos is beyond the end of this + * string. + * + * Inserts @a __n copies of character @a __c starting at index + * @a __pos. If adding characters causes the length to exceed + * max_size(), length_error is thrown. If @a __pos > length(), + * out_of_range is thrown. The value of the string doesn't + * change if an error is thrown. + */ + basic_string& + insert(size_type __pos, size_type __n, _CharT __c) + { return _M_replace_aux(_M_check(__pos, "basic_string::insert"), + size_type(0), __n, __c); } + + /** + * @brief Insert one character. + * @param __p Iterator referencing position in string to insert at. + * @param __c The character to insert. + * @return Iterator referencing newly inserted char. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Inserts character @a __c at position referenced by @a __p. + * If adding character causes the length to exceed max_size(), + * length_error is thrown. If @a __p is beyond end of string, + * out_of_range is thrown. The value of the string doesn't + * change if an error is thrown. + */ + iterator + insert(iterator __p, _CharT __c) + { + _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend()); + const size_type __pos = __p - _M_ibegin(); + _M_replace_aux(__pos, size_type(0), size_type(1), __c); + _M_rep()->_M_set_leaked(); + return iterator(_M_data() + __pos); + } + +#if __cplusplus > 201402L + /** + * @brief Insert a string_view. + * @param __pos Iterator referencing position in string to insert at. + * @param __svt The object convertible to string_view to insert. + * @return Reference to this string. + */ + template + _If_sv<_Tp, basic_string&> + insert(size_type __pos, const _Tp& __svt) + { + __sv_type __sv = __svt; + return this->insert(__pos, __sv.data(), __sv.size()); + } + + /** + * @brief Insert a string_view. + * @param __pos Iterator referencing position in string to insert at. + * @param __svt The object convertible to string_view to insert from. + * @param __pos Iterator referencing position in string_view to insert + * from. + * @param __n The number of characters to insert. + * @return Reference to this string. + */ + template + _If_sv<_Tp, basic_string&> + insert(size_type __pos1, const _Tp& __svt, + size_type __pos2, size_type __n = npos) + { + __sv_type __sv = __svt; + return this->replace(__pos1, size_type(0), __sv.data() + + __sv._M_check(__pos2, "basic_string::insert"), + __sv._M_limit(__pos2, __n)); + } +#endif // C++17 + + /** + * @brief Remove characters. + * @param __pos Index of first character to remove (default 0). + * @param __n Number of characters to remove (default remainder). + * @return Reference to this string. + * @throw std::out_of_range If @a pos is beyond the end of this + * string. + * + * Removes @a __n characters from this string starting at @a + * __pos. The length of the string is reduced by @a __n. If + * there are < @a __n characters to remove, the remainder of + * the string is truncated. If @a __p is beyond end of string, + * out_of_range is thrown. The value of the string doesn't + * change if an error is thrown. + */ + basic_string& + erase(size_type __pos = 0, size_type __n = npos) + { + _M_mutate(_M_check(__pos, "basic_string::erase"), + _M_limit(__pos, __n), size_type(0)); + return *this; + } + + /** + * @brief Remove one character. + * @param __position Iterator referencing the character to remove. + * @return iterator referencing same location after removal. + * + * Removes the character at @a __position from this string. The value + * of the string doesn't change if an error is thrown. + */ + iterator + erase(iterator __position) + { + _GLIBCXX_DEBUG_PEDASSERT(__position >= _M_ibegin() + && __position < _M_iend()); + const size_type __pos = __position - _M_ibegin(); + _M_mutate(__pos, size_type(1), size_type(0)); + _M_rep()->_M_set_leaked(); + return iterator(_M_data() + __pos); + } + + /** + * @brief Remove a range of characters. + * @param __first Iterator referencing the first character to remove. + * @param __last Iterator referencing the end of the range. + * @return Iterator referencing location of first after removal. + * + * Removes the characters in the range [first,last) from this string. + * The value of the string doesn't change if an error is thrown. + */ + iterator + erase(iterator __first, iterator __last); + +#if __cplusplus >= 201103L + /** + * @brief Remove the last character. + * + * The string must be non-empty. + */ + void + pop_back() // FIXME C++11: should be noexcept. + { + __glibcxx_assert(!empty()); + erase(size() - 1, 1); + } +#endif // C++11 + + /** + * @brief Replace characters with value from another string. + * @param __pos Index of first character to replace. + * @param __n Number of characters to be replaced. + * @param __str String to insert. + * @return Reference to this string. + * @throw std::out_of_range If @a pos is beyond the end of this + * string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__pos,__pos+__n) from + * this string. In place, the value of @a __str is inserted. + * If @a __pos is beyond end of string, out_of_range is thrown. + * If the length of the result exceeds max_size(), length_error + * is thrown. The value of the string doesn't change if an + * error is thrown. + */ + basic_string& + replace(size_type __pos, size_type __n, const basic_string& __str) + { return this->replace(__pos, __n, __str._M_data(), __str.size()); } + + /** + * @brief Replace characters with value from another string. + * @param __pos1 Index of first character to replace. + * @param __n1 Number of characters to be replaced. + * @param __str String to insert. + * @param __pos2 Index of first character of str to use. + * @param __n2 Number of characters from str to use. + * @return Reference to this string. + * @throw std::out_of_range If @a __pos1 > size() or @a __pos2 > + * __str.size(). + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__pos1,__pos1 + n) from this + * string. In place, the value of @a __str is inserted. If @a __pos is + * beyond end of string, out_of_range is thrown. If the length of the + * result exceeds max_size(), length_error is thrown. The value of the + * string doesn't change if an error is thrown. + */ + basic_string& + replace(size_type __pos1, size_type __n1, const basic_string& __str, + size_type __pos2, size_type __n2) + { return this->replace(__pos1, __n1, __str._M_data() + + __str._M_check(__pos2, "basic_string::replace"), + __str._M_limit(__pos2, __n2)); } + + /** + * @brief Replace characters with value of a C substring. + * @param __pos Index of first character to replace. + * @param __n1 Number of characters to be replaced. + * @param __s C string to insert. + * @param __n2 Number of characters from @a s to use. + * @return Reference to this string. + * @throw std::out_of_range If @a pos1 > size(). + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__pos,__pos + __n1) + * from this string. In place, the first @a __n2 characters of + * @a __s are inserted, or all of @a __s if @a __n2 is too large. If + * @a __pos is beyond end of string, out_of_range is thrown. If + * the length of result exceeds max_size(), length_error is + * thrown. The value of the string doesn't change if an error + * is thrown. + */ + basic_string& + replace(size_type __pos, size_type __n1, const _CharT* __s, + size_type __n2); + + /** + * @brief Replace characters with value of a C string. + * @param __pos Index of first character to replace. + * @param __n1 Number of characters to be replaced. + * @param __s C string to insert. + * @return Reference to this string. + * @throw std::out_of_range If @a pos > size(). + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__pos,__pos + __n1) + * from this string. In place, the characters of @a __s are + * inserted. If @a __pos is beyond end of string, out_of_range + * is thrown. If the length of result exceeds max_size(), + * length_error is thrown. The value of the string doesn't + * change if an error is thrown. + */ + basic_string& + replace(size_type __pos, size_type __n1, const _CharT* __s) + { + __glibcxx_requires_string(__s); + return this->replace(__pos, __n1, __s, traits_type::length(__s)); + } + + /** + * @brief Replace characters with multiple characters. + * @param __pos Index of first character to replace. + * @param __n1 Number of characters to be replaced. + * @param __n2 Number of characters to insert. + * @param __c Character to insert. + * @return Reference to this string. + * @throw std::out_of_range If @a __pos > size(). + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [pos,pos + n1) from this + * string. In place, @a __n2 copies of @a __c are inserted. + * If @a __pos is beyond end of string, out_of_range is thrown. + * If the length of result exceeds max_size(), length_error is + * thrown. The value of the string doesn't change if an error + * is thrown. + */ + basic_string& + replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) + { return _M_replace_aux(_M_check(__pos, "basic_string::replace"), + _M_limit(__pos, __n1), __n2, __c); } + + /** + * @brief Replace range of characters with string. + * @param __i1 Iterator referencing start of range to replace. + * @param __i2 Iterator referencing end of range to replace. + * @param __str String value to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__i1,__i2). In place, + * the value of @a __str is inserted. If the length of result + * exceeds max_size(), length_error is thrown. The value of + * the string doesn't change if an error is thrown. + */ + basic_string& + replace(iterator __i1, iterator __i2, const basic_string& __str) + { return this->replace(__i1, __i2, __str._M_data(), __str.size()); } + + /** + * @brief Replace range of characters with C substring. + * @param __i1 Iterator referencing start of range to replace. + * @param __i2 Iterator referencing end of range to replace. + * @param __s C string value to insert. + * @param __n Number of characters from s to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__i1,__i2). In place, + * the first @a __n characters of @a __s are inserted. If the + * length of result exceeds max_size(), length_error is thrown. + * The value of the string doesn't change if an error is + * thrown. + */ + basic_string& + replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n) + { + _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 + && __i2 <= _M_iend()); + return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n); + } + + /** + * @brief Replace range of characters with C string. + * @param __i1 Iterator referencing start of range to replace. + * @param __i2 Iterator referencing end of range to replace. + * @param __s C string value to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__i1,__i2). In place, + * the characters of @a __s are inserted. If the length of + * result exceeds max_size(), length_error is thrown. The + * value of the string doesn't change if an error is thrown. + */ + basic_string& + replace(iterator __i1, iterator __i2, const _CharT* __s) + { + __glibcxx_requires_string(__s); + return this->replace(__i1, __i2, __s, traits_type::length(__s)); + } + + /** + * @brief Replace range of characters with multiple characters + * @param __i1 Iterator referencing start of range to replace. + * @param __i2 Iterator referencing end of range to replace. + * @param __n Number of characters to insert. + * @param __c Character to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__i1,__i2). In place, + * @a __n copies of @a __c are inserted. If the length of + * result exceeds max_size(), length_error is thrown. The + * value of the string doesn't change if an error is thrown. + */ + basic_string& + replace(iterator __i1, iterator __i2, size_type __n, _CharT __c) + { + _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 + && __i2 <= _M_iend()); + return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c); + } + + /** + * @brief Replace range of characters with range. + * @param __i1 Iterator referencing start of range to replace. + * @param __i2 Iterator referencing end of range to replace. + * @param __k1 Iterator referencing start of range to insert. + * @param __k2 Iterator referencing end of range to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__i1,__i2). In place, + * characters in the range [__k1,__k2) are inserted. If the + * length of result exceeds max_size(), length_error is thrown. + * The value of the string doesn't change if an error is + * thrown. + */ + template + basic_string& + replace(iterator __i1, iterator __i2, + _InputIterator __k1, _InputIterator __k2) + { + _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 + && __i2 <= _M_iend()); + __glibcxx_requires_valid_range(__k1, __k2); + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral()); + } + + // Specializations for the common case of pointer and iterator: + // useful to avoid the overhead of temporary buffering in _M_replace. + basic_string& + replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2) + { + _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 + && __i2 <= _M_iend()); + __glibcxx_requires_valid_range(__k1, __k2); + return this->replace(__i1 - _M_ibegin(), __i2 - __i1, + __k1, __k2 - __k1); + } + + basic_string& + replace(iterator __i1, iterator __i2, + const _CharT* __k1, const _CharT* __k2) + { + _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 + && __i2 <= _M_iend()); + __glibcxx_requires_valid_range(__k1, __k2); + return this->replace(__i1 - _M_ibegin(), __i2 - __i1, + __k1, __k2 - __k1); + } + + basic_string& + replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2) + { + _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 + && __i2 <= _M_iend()); + __glibcxx_requires_valid_range(__k1, __k2); + return this->replace(__i1 - _M_ibegin(), __i2 - __i1, + __k1.base(), __k2 - __k1); + } + + basic_string& + replace(iterator __i1, iterator __i2, + const_iterator __k1, const_iterator __k2) + { + _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2 + && __i2 <= _M_iend()); + __glibcxx_requires_valid_range(__k1, __k2); + return this->replace(__i1 - _M_ibegin(), __i2 - __i1, + __k1.base(), __k2 - __k1); + } + +#if __cplusplus >= 201103L + /** + * @brief Replace range of characters with initializer_list. + * @param __i1 Iterator referencing start of range to replace. + * @param __i2 Iterator referencing end of range to replace. + * @param __l The initializer_list of characters to insert. + * @return Reference to this string. + * @throw std::length_error If new length exceeds @c max_size(). + * + * Removes the characters in the range [__i1,__i2). In place, + * characters in the range [__k1,__k2) are inserted. If the + * length of result exceeds max_size(), length_error is thrown. + * The value of the string doesn't change if an error is + * thrown. + */ + basic_string& replace(iterator __i1, iterator __i2, + initializer_list<_CharT> __l) + { return this->replace(__i1, __i2, __l.begin(), __l.end()); } +#endif // C++11 + +#if __cplusplus > 201402L + /** + * @brief Replace range of characters with string_view. + * @param __pos The position to replace at. + * @param __n The number of characters to replace. + * @param __svt The object convertible to string_view to insert. + * @return Reference to this string. + */ + template + _If_sv<_Tp, basic_string&> + replace(size_type __pos, size_type __n, const _Tp& __svt) + { + __sv_type __sv = __svt; + return this->replace(__pos, __n, __sv.data(), __sv.size()); + } + + /** + * @brief Replace range of characters with string_view. + * @param __pos1 The position to replace at. + * @param __n1 The number of characters to replace. + * @param __svt The object convertible to string_view to insert from. + * @param __pos2 The position in the string_view to insert from. + * @param __n2 The number of characters to insert. + * @return Reference to this string. + */ + template + _If_sv<_Tp, basic_string&> + replace(size_type __pos1, size_type __n1, const _Tp& __svt, + size_type __pos2, size_type __n2 = npos) + { + __sv_type __sv = __svt; + return this->replace(__pos1, __n1, + __sv.data() + __sv._M_check(__pos2, "basic_string::replace"), + __sv._M_limit(__pos2, __n2)); + } + + /** + * @brief Replace range of characters with string_view. + * @param __i1 An iterator referencing the start position + to replace at. + * @param __i2 An iterator referencing the end position + for the replace. + * @param __svt The object convertible to string_view to insert from. + * @return Reference to this string. + */ + template + _If_sv<_Tp, basic_string&> + replace(const_iterator __i1, const_iterator __i2, const _Tp& __svt) + { + __sv_type __sv = __svt; + return this->replace(__i1 - begin(), __i2 - __i1, __sv); + } +#endif // C++17 + + private: + template + basic_string& + _M_replace_dispatch(iterator __i1, iterator __i2, _Integer __n, + _Integer __val, __true_type) + { return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); } + + template + basic_string& + _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1, + _InputIterator __k2, __false_type); + + basic_string& + _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2, + _CharT __c); + + basic_string& + _M_replace_safe(size_type __pos1, size_type __n1, const _CharT* __s, + size_type __n2); + + // _S_construct_aux is used to implement the 21.3.1 para 15 which + // requires special behaviour if _InIter is an integral type + template + static _CharT* + _S_construct_aux(_InIterator __beg, _InIterator __end, + const _Alloc& __a, __false_type) + { + typedef typename iterator_traits<_InIterator>::iterator_category _Tag; + return _S_construct(__beg, __end, __a, _Tag()); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 438. Ambiguity in the "do the right thing" clause + template + static _CharT* + _S_construct_aux(_Integer __beg, _Integer __end, + const _Alloc& __a, __true_type) + { return _S_construct_aux_2(static_cast(__beg), + __end, __a); } + + static _CharT* + _S_construct_aux_2(size_type __req, _CharT __c, const _Alloc& __a) + { return _S_construct(__req, __c, __a); } + + template + static _CharT* + _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a) + { + typedef typename std::__is_integer<_InIterator>::__type _Integral; + return _S_construct_aux(__beg, __end, __a, _Integral()); + } + + // For Input Iterators, used in istreambuf_iterators, etc. + template + static _CharT* + _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a, + input_iterator_tag); + + // For forward_iterators up to random_access_iterators, used for + // string::iterator, _CharT*, etc. + template + static _CharT* + _S_construct(_FwdIterator __beg, _FwdIterator __end, const _Alloc& __a, + forward_iterator_tag); + + static _CharT* + _S_construct(size_type __req, _CharT __c, const _Alloc& __a); + + public: + + /** + * @brief Copy substring into C string. + * @param __s C string to copy value into. + * @param __n Number of characters to copy. + * @param __pos Index of first character to copy. + * @return Number of characters actually copied + * @throw std::out_of_range If __pos > size(). + * + * Copies up to @a __n characters starting at @a __pos into the + * C string @a __s. If @a __pos is %greater than size(), + * out_of_range is thrown. + */ + size_type + copy(_CharT* __s, size_type __n, size_type __pos = 0) const; + + /** + * @brief Swap contents with another string. + * @param __s String to swap with. + * + * Exchanges the contents of this string with that of @a __s in constant + * time. + */ + // PR 58265, this should be noexcept. + void + swap(basic_string& __s); + + // String operations: + /** + * @brief Return const pointer to null-terminated contents. + * + * This is a handle to internal data. Do not modify or dire things may + * happen. + */ + const _CharT* + c_str() const _GLIBCXX_NOEXCEPT + { return _M_data(); } + + /** + * @brief Return const pointer to contents. + * + * This is a pointer to internal data. It is undefined to modify + * the contents through the returned pointer. To get a pointer that + * allows modifying the contents use @c &str[0] instead, + * (or in C++17 the non-const @c str.data() overload). + */ + const _CharT* + data() const _GLIBCXX_NOEXCEPT + { return _M_data(); } + +#if __cplusplus > 201402L + /** + * @brief Return non-const pointer to contents. + * + * This is a pointer to the character sequence held by the string. + * Modifying the characters in the sequence is allowed. + */ + _CharT* + data() noexcept + { return _M_data(); } +#endif + + /** + * @brief Return copy of allocator used to construct this string. + */ + allocator_type + get_allocator() const _GLIBCXX_NOEXCEPT + { return _M_dataplus; } + + /** + * @brief Find position of a C substring. + * @param __s C string to locate. + * @param __pos Index of character to search from. + * @param __n Number of characters from @a s to search for. + * @return Index of start of first occurrence. + * + * Starting from @a __pos, searches forward for the first @a + * __n characters in @a __s within this string. If found, + * returns the index where it begins. If not found, returns + * npos. + */ + size_type + find(const _CharT* __s, size_type __pos, size_type __n) const + _GLIBCXX_NOEXCEPT; + + /** + * @brief Find position of a string. + * @param __str String to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of start of first occurrence. + * + * Starting from @a __pos, searches forward for value of @a __str within + * this string. If found, returns the index where it begins. If not + * found, returns npos. + */ + size_type + find(const basic_string& __str, size_type __pos = 0) const + _GLIBCXX_NOEXCEPT + { return this->find(__str.data(), __pos, __str.size()); } + + /** + * @brief Find position of a C string. + * @param __s C string to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of start of first occurrence. + * + * Starting from @a __pos, searches forward for the value of @a + * __s within this string. If found, returns the index where + * it begins. If not found, returns npos. + */ + size_type + find(const _CharT* __s, size_type __pos = 0) const _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_string(__s); + return this->find(__s, __pos, traits_type::length(__s)); + } + + /** + * @brief Find position of a character. + * @param __c Character to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for @a __c within + * this string. If found, returns the index where it was + * found. If not found, returns npos. + */ + size_type + find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT; + +#if __cplusplus > 201402L + /** + * @brief Find position of a string_view. + * @param __svt The object convertible to string_view to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of start of first occurrence. + */ + template + _If_sv<_Tp, size_type> + find(const _Tp& __svt, size_type __pos = 0) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return this->find(__sv.data(), __pos, __sv.size()); + } +#endif // C++17 + + /** + * @brief Find last position of a string. + * @param __str String to locate. + * @param __pos Index of character to search back from (default end). + * @return Index of start of last occurrence. + * + * Starting from @a __pos, searches backward for value of @a + * __str within this string. If found, returns the index where + * it begins. If not found, returns npos. + */ + size_type + rfind(const basic_string& __str, size_type __pos = npos) const + _GLIBCXX_NOEXCEPT + { return this->rfind(__str.data(), __pos, __str.size()); } + + /** + * @brief Find last position of a C substring. + * @param __s C string to locate. + * @param __pos Index of character to search back from. + * @param __n Number of characters from s to search for. + * @return Index of start of last occurrence. + * + * Starting from @a __pos, searches backward for the first @a + * __n characters in @a __s within this string. If found, + * returns the index where it begins. If not found, returns + * npos. + */ + size_type + rfind(const _CharT* __s, size_type __pos, size_type __n) const + _GLIBCXX_NOEXCEPT; + + /** + * @brief Find last position of a C string. + * @param __s C string to locate. + * @param __pos Index of character to start search at (default end). + * @return Index of start of last occurrence. + * + * Starting from @a __pos, searches backward for the value of + * @a __s within this string. If found, returns the index + * where it begins. If not found, returns npos. + */ + size_type + rfind(const _CharT* __s, size_type __pos = npos) const _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_string(__s); + return this->rfind(__s, __pos, traits_type::length(__s)); + } + + /** + * @brief Find last position of a character. + * @param __c Character to locate. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for @a __c within + * this string. If found, returns the index where it was + * found. If not found, returns npos. + */ + size_type + rfind(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT; + +#if __cplusplus > 201402L + /** + * @brief Find last position of a string_view. + * @param __svt The object convertible to string_view to locate. + * @param __pos Index of character to search back from (default end). + * @return Index of start of last occurrence. + */ + template + _If_sv<_Tp, size_type> + rfind(const _Tp& __svt, size_type __pos = npos) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return this->rfind(__sv.data(), __pos, __sv.size()); + } +#endif // C++17 + + /** + * @brief Find position of a character of string. + * @param __str String containing characters to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for one of the + * characters of @a __str within this string. If found, + * returns the index where it was found. If not found, returns + * npos. + */ + size_type + find_first_of(const basic_string& __str, size_type __pos = 0) const + _GLIBCXX_NOEXCEPT + { return this->find_first_of(__str.data(), __pos, __str.size()); } + + /** + * @brief Find position of a character of C substring. + * @param __s String containing characters to locate. + * @param __pos Index of character to search from. + * @param __n Number of characters from s to search for. + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for one of the + * first @a __n characters of @a __s within this string. If + * found, returns the index where it was found. If not found, + * returns npos. + */ + size_type + find_first_of(const _CharT* __s, size_type __pos, size_type __n) const + _GLIBCXX_NOEXCEPT; + + /** + * @brief Find position of a character of C string. + * @param __s String containing characters to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for one of the + * characters of @a __s within this string. If found, returns + * the index where it was found. If not found, returns npos. + */ + size_type + find_first_of(const _CharT* __s, size_type __pos = 0) const + _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_string(__s); + return this->find_first_of(__s, __pos, traits_type::length(__s)); + } + + /** + * @brief Find position of a character. + * @param __c Character to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for the character + * @a __c within this string. If found, returns the index + * where it was found. If not found, returns npos. + * + * Note: equivalent to find(__c, __pos). + */ + size_type + find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT + { return this->find(__c, __pos); } + +#if __cplusplus > 201402L + /** + * @brief Find position of a character of a string_view. + * @param __svt An object convertible to string_view containing + * characters to locate. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + */ + template + _If_sv<_Tp, size_type> + find_first_of(const _Tp& __svt, size_type __pos = 0) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return this->find_first_of(__sv.data(), __pos, __sv.size()); + } +#endif // C++17 + + /** + * @brief Find last position of a character of string. + * @param __str String containing characters to locate. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for one of the + * characters of @a __str within this string. If found, + * returns the index where it was found. If not found, returns + * npos. + */ + size_type + find_last_of(const basic_string& __str, size_type __pos = npos) const + _GLIBCXX_NOEXCEPT + { return this->find_last_of(__str.data(), __pos, __str.size()); } + + /** + * @brief Find last position of a character of C substring. + * @param __s C string containing characters to locate. + * @param __pos Index of character to search back from. + * @param __n Number of characters from s to search for. + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for one of the + * first @a __n characters of @a __s within this string. If + * found, returns the index where it was found. If not found, + * returns npos. + */ + size_type + find_last_of(const _CharT* __s, size_type __pos, size_type __n) const + _GLIBCXX_NOEXCEPT; + + /** + * @brief Find last position of a character of C string. + * @param __s C string containing characters to locate. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for one of the + * characters of @a __s within this string. If found, returns + * the index where it was found. If not found, returns npos. + */ + size_type + find_last_of(const _CharT* __s, size_type __pos = npos) const + _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_string(__s); + return this->find_last_of(__s, __pos, traits_type::length(__s)); + } + + /** + * @brief Find last position of a character. + * @param __c Character to locate. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for @a __c within + * this string. If found, returns the index where it was + * found. If not found, returns npos. + * + * Note: equivalent to rfind(__c, __pos). + */ + size_type + find_last_of(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT + { return this->rfind(__c, __pos); } + +#if __cplusplus > 201402L + /** + * @brief Find last position of a character of string. + * @param __svt An object convertible to string_view containing + * characters to locate. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + */ + template + _If_sv<_Tp, size_type> + find_last_of(const _Tp& __svt, size_type __pos = npos) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return this->find_last_of(__sv.data(), __pos, __sv.size()); + } +#endif // C++17 + + /** + * @brief Find position of a character not in string. + * @param __str String containing characters to avoid. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for a character not contained + * in @a __str within this string. If found, returns the index where it + * was found. If not found, returns npos. + */ + size_type + find_first_not_of(const basic_string& __str, size_type __pos = 0) const + _GLIBCXX_NOEXCEPT + { return this->find_first_not_of(__str.data(), __pos, __str.size()); } + + /** + * @brief Find position of a character not in C substring. + * @param __s C string containing characters to avoid. + * @param __pos Index of character to search from. + * @param __n Number of characters from __s to consider. + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for a character not + * contained in the first @a __n characters of @a __s within + * this string. If found, returns the index where it was + * found. If not found, returns npos. + */ + size_type + find_first_not_of(const _CharT* __s, size_type __pos, + size_type __n) const _GLIBCXX_NOEXCEPT; + + /** + * @brief Find position of a character not in C string. + * @param __s C string containing characters to avoid. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for a character not + * contained in @a __s within this string. If found, returns + * the index where it was found. If not found, returns npos. + */ + size_type + find_first_not_of(const _CharT* __s, size_type __pos = 0) const + _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_string(__s); + return this->find_first_not_of(__s, __pos, traits_type::length(__s)); + } + + /** + * @brief Find position of a different character. + * @param __c Character to avoid. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + * + * Starting from @a __pos, searches forward for a character + * other than @a __c within this string. If found, returns the + * index where it was found. If not found, returns npos. + */ + size_type + find_first_not_of(_CharT __c, size_type __pos = 0) const + _GLIBCXX_NOEXCEPT; + +#if __cplusplus > 201402L + /** + * @brief Find position of a character not in a string_view. + * @param __svt An object convertible to string_view containing + * characters to avoid. + * @param __pos Index of character to search from (default 0). + * @return Index of first occurrence. + */ + template + _If_sv<_Tp, size_type> + find_first_not_of(const _Tp& __svt, size_type __pos = 0) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return this->find_first_not_of(__sv.data(), __pos, __sv.size()); + } +#endif // C++17 + + /** + * @brief Find last position of a character not in string. + * @param __str String containing characters to avoid. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for a character + * not contained in @a __str within this string. If found, + * returns the index where it was found. If not found, returns + * npos. + */ + size_type + find_last_not_of(const basic_string& __str, size_type __pos = npos) const + _GLIBCXX_NOEXCEPT + { return this->find_last_not_of(__str.data(), __pos, __str.size()); } + + /** + * @brief Find last position of a character not in C substring. + * @param __s C string containing characters to avoid. + * @param __pos Index of character to search back from. + * @param __n Number of characters from s to consider. + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for a character not + * contained in the first @a __n characters of @a __s within this string. + * If found, returns the index where it was found. If not found, + * returns npos. + */ + size_type + find_last_not_of(const _CharT* __s, size_type __pos, + size_type __n) const _GLIBCXX_NOEXCEPT; + /** + * @brief Find last position of a character not in C string. + * @param __s C string containing characters to avoid. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for a character + * not contained in @a __s within this string. If found, + * returns the index where it was found. If not found, returns + * npos. + */ + size_type + find_last_not_of(const _CharT* __s, size_type __pos = npos) const + _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_string(__s); + return this->find_last_not_of(__s, __pos, traits_type::length(__s)); + } + + /** + * @brief Find last position of a different character. + * @param __c Character to avoid. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + * + * Starting from @a __pos, searches backward for a character other than + * @a __c within this string. If found, returns the index where it was + * found. If not found, returns npos. + */ + size_type + find_last_not_of(_CharT __c, size_type __pos = npos) const + _GLIBCXX_NOEXCEPT; + +#if __cplusplus > 201402L + /** + * @brief Find last position of a character not in a string_view. + * @param __svt An object convertible to string_view containing + * characters to avoid. + * @param __pos Index of character to search back from (default end). + * @return Index of last occurrence. + */ + template + _If_sv<_Tp, size_type> + find_last_not_of(const _Tp& __svt, size_type __pos = npos) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return this->find_last_not_of(__sv.data(), __pos, __sv.size()); + } +#endif // C++17 + + /** + * @brief Get a substring. + * @param __pos Index of first character (default 0). + * @param __n Number of characters in substring (default remainder). + * @return The new string. + * @throw std::out_of_range If __pos > size(). + * + * Construct and return a new string using the @a __n + * characters starting at @a __pos. If the string is too + * short, use the remainder of the characters. If @a __pos is + * beyond the end of the string, out_of_range is thrown. + */ + basic_string + substr(size_type __pos = 0, size_type __n = npos) const + { return basic_string(*this, + _M_check(__pos, "basic_string::substr"), __n); } + + /** + * @brief Compare to a string. + * @param __str String to compare against. + * @return Integer < 0, 0, or > 0. + * + * Returns an integer < 0 if this string is ordered before @a + * __str, 0 if their values are equivalent, or > 0 if this + * string is ordered after @a __str. Determines the effective + * length rlen of the strings to compare as the smallest of + * size() and str.size(). The function then compares the two + * strings by calling traits::compare(data(), str.data(),rlen). + * If the result of the comparison is nonzero returns it, + * otherwise the shorter one is ordered first. + */ + int + compare(const basic_string& __str) const + { + const size_type __size = this->size(); + const size_type __osize = __str.size(); + const size_type __len = std::min(__size, __osize); + + int __r = traits_type::compare(_M_data(), __str.data(), __len); + if (!__r) + __r = _S_compare(__size, __osize); + return __r; + } + +#if __cplusplus > 201402L + /** + * @brief Compare to a string_view. + * @param __svt An object convertible to string_view to compare against. + * @return Integer < 0, 0, or > 0. + */ + template + _If_sv<_Tp, int> + compare(const _Tp& __svt) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + const size_type __size = this->size(); + const size_type __osize = __sv.size(); + const size_type __len = std::min(__size, __osize); + + int __r = traits_type::compare(_M_data(), __sv.data(), __len); + if (!__r) + __r = _S_compare(__size, __osize); + return __r; + } + + /** + * @brief Compare to a string_view. + * @param __pos A position in the string to start comparing from. + * @param __n The number of characters to compare. + * @param __svt An object convertible to string_view to compare + * against. + * @return Integer < 0, 0, or > 0. + */ + template + _If_sv<_Tp, int> + compare(size_type __pos, size_type __n, const _Tp& __svt) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return __sv_type(*this).substr(__pos, __n).compare(__sv); + } + + /** + * @brief Compare to a string_view. + * @param __pos1 A position in the string to start comparing from. + * @param __n1 The number of characters to compare. + * @param __svt An object convertible to string_view to compare + * against. + * @param __pos2 A position in the string_view to start comparing from. + * @param __n2 The number of characters to compare. + * @return Integer < 0, 0, or > 0. + */ + template + _If_sv<_Tp, int> + compare(size_type __pos1, size_type __n1, const _Tp& __svt, + size_type __pos2, size_type __n2 = npos) const + noexcept(is_same<_Tp, __sv_type>::value) + { + __sv_type __sv = __svt; + return __sv_type(*this) + .substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2)); + } +#endif // C++17 + + /** + * @brief Compare substring to a string. + * @param __pos Index of first character of substring. + * @param __n Number of characters in substring. + * @param __str String to compare against. + * @return Integer < 0, 0, or > 0. + * + * Form the substring of this string from the @a __n characters + * starting at @a __pos. Returns an integer < 0 if the + * substring is ordered before @a __str, 0 if their values are + * equivalent, or > 0 if the substring is ordered after @a + * __str. Determines the effective length rlen of the strings + * to compare as the smallest of the length of the substring + * and @a __str.size(). The function then compares the two + * strings by calling + * traits::compare(substring.data(),str.data(),rlen). If the + * result of the comparison is nonzero returns it, otherwise + * the shorter one is ordered first. + */ + int + compare(size_type __pos, size_type __n, const basic_string& __str) const; + + /** + * @brief Compare substring to a substring. + * @param __pos1 Index of first character of substring. + * @param __n1 Number of characters in substring. + * @param __str String to compare against. + * @param __pos2 Index of first character of substring of str. + * @param __n2 Number of characters in substring of str. + * @return Integer < 0, 0, or > 0. + * + * Form the substring of this string from the @a __n1 + * characters starting at @a __pos1. Form the substring of @a + * __str from the @a __n2 characters starting at @a __pos2. + * Returns an integer < 0 if this substring is ordered before + * the substring of @a __str, 0 if their values are equivalent, + * or > 0 if this substring is ordered after the substring of + * @a __str. Determines the effective length rlen of the + * strings to compare as the smallest of the lengths of the + * substrings. The function then compares the two strings by + * calling + * traits::compare(substring.data(),str.substr(pos2,n2).data(),rlen). + * If the result of the comparison is nonzero returns it, + * otherwise the shorter one is ordered first. + */ + int + compare(size_type __pos1, size_type __n1, const basic_string& __str, + size_type __pos2, size_type __n2) const; + + /** + * @brief Compare to a C string. + * @param __s C string to compare against. + * @return Integer < 0, 0, or > 0. + * + * Returns an integer < 0 if this string is ordered before @a __s, 0 if + * their values are equivalent, or > 0 if this string is ordered after + * @a __s. Determines the effective length rlen of the strings to + * compare as the smallest of size() and the length of a string + * constructed from @a __s. The function then compares the two strings + * by calling traits::compare(data(),s,rlen). If the result of the + * comparison is nonzero returns it, otherwise the shorter one is + * ordered first. + */ + int + compare(const _CharT* __s) const _GLIBCXX_NOEXCEPT; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 5 String::compare specification questionable + /** + * @brief Compare substring to a C string. + * @param __pos Index of first character of substring. + * @param __n1 Number of characters in substring. + * @param __s C string to compare against. + * @return Integer < 0, 0, or > 0. + * + * Form the substring of this string from the @a __n1 + * characters starting at @a pos. Returns an integer < 0 if + * the substring is ordered before @a __s, 0 if their values + * are equivalent, or > 0 if the substring is ordered after @a + * __s. Determines the effective length rlen of the strings to + * compare as the smallest of the length of the substring and + * the length of a string constructed from @a __s. The + * function then compares the two string by calling + * traits::compare(substring.data(),__s,rlen). If the result of + * the comparison is nonzero returns it, otherwise the shorter + * one is ordered first. + */ + int + compare(size_type __pos, size_type __n1, const _CharT* __s) const; + + /** + * @brief Compare substring against a character %array. + * @param __pos Index of first character of substring. + * @param __n1 Number of characters in substring. + * @param __s character %array to compare against. + * @param __n2 Number of characters of s. + * @return Integer < 0, 0, or > 0. + * + * Form the substring of this string from the @a __n1 + * characters starting at @a __pos. Form a string from the + * first @a __n2 characters of @a __s. Returns an integer < 0 + * if this substring is ordered before the string from @a __s, + * 0 if their values are equivalent, or > 0 if this substring + * is ordered after the string from @a __s. Determines the + * effective length rlen of the strings to compare as the + * smallest of the length of the substring and @a __n2. The + * function then compares the two strings by calling + * traits::compare(substring.data(),s,rlen). If the result of + * the comparison is nonzero returns it, otherwise the shorter + * one is ordered first. + * + * NB: s must have at least n2 characters, '\\0' has + * no special meaning. + */ + int + compare(size_type __pos, size_type __n1, const _CharT* __s, + size_type __n2) const; + +# ifdef _GLIBCXX_TM_TS_INTERNAL + friend void + ::_txnal_cow_string_C1_for_exceptions(void* that, const char* s, + void* exc); + friend const char* + ::_txnal_cow_string_c_str(const void *that); + friend void + ::_txnal_cow_string_D1(void *that); + friend void + ::_txnal_cow_string_D1_commit(void *that); +# endif + }; +#endif // !_GLIBCXX_USE_CXX11_ABI + + // operator+ + /** + * @brief Concatenate two strings. + * @param __lhs First string. + * @param __rhs Last string. + * @return New string with value of @a __lhs followed by @a __rhs. + */ + template + basic_string<_CharT, _Traits, _Alloc> + operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + { + basic_string<_CharT, _Traits, _Alloc> __str(__lhs); + __str.append(__rhs); + return __str; + } + + /** + * @brief Concatenate C string and string. + * @param __lhs First string. + * @param __rhs Last string. + * @return New string with value of @a __lhs followed by @a __rhs. + */ + template + basic_string<_CharT,_Traits,_Alloc> + operator+(const _CharT* __lhs, + const basic_string<_CharT,_Traits,_Alloc>& __rhs); + + /** + * @brief Concatenate character and string. + * @param __lhs First string. + * @param __rhs Last string. + * @return New string with @a __lhs followed by @a __rhs. + */ + template + basic_string<_CharT,_Traits,_Alloc> + operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs); + + /** + * @brief Concatenate string and C string. + * @param __lhs First string. + * @param __rhs Last string. + * @return New string with @a __lhs followed by @a __rhs. + */ + template + inline basic_string<_CharT, _Traits, _Alloc> + operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const _CharT* __rhs) + { + basic_string<_CharT, _Traits, _Alloc> __str(__lhs); + __str.append(__rhs); + return __str; + } + + /** + * @brief Concatenate string and character. + * @param __lhs First string. + * @param __rhs Last string. + * @return New string with @a __lhs followed by @a __rhs. + */ + template + inline basic_string<_CharT, _Traits, _Alloc> + operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) + { + typedef basic_string<_CharT, _Traits, _Alloc> __string_type; + typedef typename __string_type::size_type __size_type; + __string_type __str(__lhs); + __str.append(__size_type(1), __rhs); + return __str; + } + +#if __cplusplus >= 201103L + template + inline basic_string<_CharT, _Traits, _Alloc> + operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + { return std::move(__lhs.append(__rhs)); } + + template + inline basic_string<_CharT, _Traits, _Alloc> + operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + basic_string<_CharT, _Traits, _Alloc>&& __rhs) + { return std::move(__rhs.insert(0, __lhs)); } + + template + inline basic_string<_CharT, _Traits, _Alloc> + operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, + basic_string<_CharT, _Traits, _Alloc>&& __rhs) + { + const auto __size = __lhs.size() + __rhs.size(); + const bool __cond = (__size > __lhs.capacity() + && __size <= __rhs.capacity()); + return __cond ? std::move(__rhs.insert(0, __lhs)) + : std::move(__lhs.append(__rhs)); + } + + template + inline basic_string<_CharT, _Traits, _Alloc> + operator+(const _CharT* __lhs, + basic_string<_CharT, _Traits, _Alloc>&& __rhs) + { return std::move(__rhs.insert(0, __lhs)); } + + template + inline basic_string<_CharT, _Traits, _Alloc> + operator+(_CharT __lhs, + basic_string<_CharT, _Traits, _Alloc>&& __rhs) + { return std::move(__rhs.insert(0, 1, __lhs)); } + + template + inline basic_string<_CharT, _Traits, _Alloc> + operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, + const _CharT* __rhs) + { return std::move(__lhs.append(__rhs)); } + + template + inline basic_string<_CharT, _Traits, _Alloc> + operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, + _CharT __rhs) + { return std::move(__lhs.append(1, __rhs)); } +#endif + + // operator == + /** + * @brief Test equivalence of two strings. + * @param __lhs First string. + * @param __rhs Second string. + * @return True if @a __lhs.compare(@a __rhs) == 0. False otherwise. + */ + template + inline bool + operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.compare(__rhs) == 0; } + + template + inline + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, bool>::__type + operator==(const basic_string<_CharT>& __lhs, + const basic_string<_CharT>& __rhs) _GLIBCXX_NOEXCEPT + { return (__lhs.size() == __rhs.size() + && !std::char_traits<_CharT>::compare(__lhs.data(), __rhs.data(), + __lhs.size())); } + + /** + * @brief Test equivalence of C string and string. + * @param __lhs C string. + * @param __rhs String. + * @return True if @a __rhs.compare(@a __lhs) == 0. False otherwise. + */ + template + inline bool + operator==(const _CharT* __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + { return __rhs.compare(__lhs) == 0; } + + /** + * @brief Test equivalence of string and C string. + * @param __lhs String. + * @param __rhs C string. + * @return True if @a __lhs.compare(@a __rhs) == 0. False otherwise. + */ + template + inline bool + operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const _CharT* __rhs) + { return __lhs.compare(__rhs) == 0; } + + // operator != + /** + * @brief Test difference of two strings. + * @param __lhs First string. + * @param __rhs Second string. + * @return True if @a __lhs.compare(@a __rhs) != 0. False otherwise. + */ + template + inline bool + operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT + { return !(__lhs == __rhs); } + + /** + * @brief Test difference of C string and string. + * @param __lhs C string. + * @param __rhs String. + * @return True if @a __rhs.compare(@a __lhs) != 0. False otherwise. + */ + template + inline bool + operator!=(const _CharT* __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + { return !(__lhs == __rhs); } + + /** + * @brief Test difference of string and C string. + * @param __lhs String. + * @param __rhs C string. + * @return True if @a __lhs.compare(@a __rhs) != 0. False otherwise. + */ + template + inline bool + operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const _CharT* __rhs) + { return !(__lhs == __rhs); } + + // operator < + /** + * @brief Test if string precedes string. + * @param __lhs First string. + * @param __rhs Second string. + * @return True if @a __lhs precedes @a __rhs. False otherwise. + */ + template + inline bool + operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.compare(__rhs) < 0; } + + /** + * @brief Test if string precedes C string. + * @param __lhs String. + * @param __rhs C string. + * @return True if @a __lhs precedes @a __rhs. False otherwise. + */ + template + inline bool + operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const _CharT* __rhs) + { return __lhs.compare(__rhs) < 0; } + + /** + * @brief Test if C string precedes string. + * @param __lhs C string. + * @param __rhs String. + * @return True if @a __lhs precedes @a __rhs. False otherwise. + */ + template + inline bool + operator<(const _CharT* __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + { return __rhs.compare(__lhs) > 0; } + + // operator > + /** + * @brief Test if string follows string. + * @param __lhs First string. + * @param __rhs Second string. + * @return True if @a __lhs follows @a __rhs. False otherwise. + */ + template + inline bool + operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.compare(__rhs) > 0; } + + /** + * @brief Test if string follows C string. + * @param __lhs String. + * @param __rhs C string. + * @return True if @a __lhs follows @a __rhs. False otherwise. + */ + template + inline bool + operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const _CharT* __rhs) + { return __lhs.compare(__rhs) > 0; } + + /** + * @brief Test if C string follows string. + * @param __lhs C string. + * @param __rhs String. + * @return True if @a __lhs follows @a __rhs. False otherwise. + */ + template + inline bool + operator>(const _CharT* __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + { return __rhs.compare(__lhs) < 0; } + + // operator <= + /** + * @brief Test if string doesn't follow string. + * @param __lhs First string. + * @param __rhs Second string. + * @return True if @a __lhs doesn't follow @a __rhs. False otherwise. + */ + template + inline bool + operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.compare(__rhs) <= 0; } + + /** + * @brief Test if string doesn't follow C string. + * @param __lhs String. + * @param __rhs C string. + * @return True if @a __lhs doesn't follow @a __rhs. False otherwise. + */ + template + inline bool + operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const _CharT* __rhs) + { return __lhs.compare(__rhs) <= 0; } + + /** + * @brief Test if C string doesn't follow string. + * @param __lhs C string. + * @param __rhs String. + * @return True if @a __lhs doesn't follow @a __rhs. False otherwise. + */ + template + inline bool + operator<=(const _CharT* __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + { return __rhs.compare(__lhs) >= 0; } + + // operator >= + /** + * @brief Test if string doesn't precede string. + * @param __lhs First string. + * @param __rhs Second string. + * @return True if @a __lhs doesn't precede @a __rhs. False otherwise. + */ + template + inline bool + operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.compare(__rhs) >= 0; } + + /** + * @brief Test if string doesn't precede C string. + * @param __lhs String. + * @param __rhs C string. + * @return True if @a __lhs doesn't precede @a __rhs. False otherwise. + */ + template + inline bool + operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, + const _CharT* __rhs) + { return __lhs.compare(__rhs) >= 0; } + + /** + * @brief Test if C string doesn't precede string. + * @param __lhs C string. + * @param __rhs String. + * @return True if @a __lhs doesn't precede @a __rhs. False otherwise. + */ + template + inline bool + operator>=(const _CharT* __lhs, + const basic_string<_CharT, _Traits, _Alloc>& __rhs) + { return __rhs.compare(__lhs) <= 0; } + + /** + * @brief Swap contents of two strings. + * @param __lhs First string. + * @param __rhs Second string. + * + * Exchanges the contents of @a __lhs and @a __rhs in constant time. + */ + template + inline void + swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, + basic_string<_CharT, _Traits, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs))) + { __lhs.swap(__rhs); } + + + /** + * @brief Read stream into a string. + * @param __is Input stream. + * @param __str Buffer to store into. + * @return Reference to the input stream. + * + * Stores characters from @a __is into @a __str until whitespace is + * found, the end of the stream is encountered, or str.max_size() + * is reached. If is.width() is non-zero, that is the limit on the + * number of characters stored into @a __str. Any previous + * contents of @a __str are erased. + */ + template + basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __is, + basic_string<_CharT, _Traits, _Alloc>& __str); + + template<> + basic_istream& + operator>>(basic_istream& __is, basic_string& __str); + + /** + * @brief Write string to a stream. + * @param __os Output stream. + * @param __str String to write out. + * @return Reference to the output stream. + * + * Output characters of @a __str into os following the same rules as for + * writing a C string. + */ + template + inline basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, + const basic_string<_CharT, _Traits, _Alloc>& __str) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 586. string inserter not a formatted function + return __ostream_insert(__os, __str.data(), __str.size()); + } + + /** + * @brief Read a line from stream into a string. + * @param __is Input stream. + * @param __str Buffer to store into. + * @param __delim Character marking end of line. + * @return Reference to the input stream. + * + * Stores characters from @a __is into @a __str until @a __delim is + * found, the end of the stream is encountered, or str.max_size() + * is reached. Any previous contents of @a __str are erased. If + * @a __delim is encountered, it is extracted but not stored into + * @a __str. + */ + template + basic_istream<_CharT, _Traits>& + getline(basic_istream<_CharT, _Traits>& __is, + basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim); + + /** + * @brief Read a line from stream into a string. + * @param __is Input stream. + * @param __str Buffer to store into. + * @return Reference to the input stream. + * + * Stores characters from is into @a __str until '\n' is + * found, the end of the stream is encountered, or str.max_size() + * is reached. Any previous contents of @a __str are erased. If + * end of line is encountered, it is extracted but not stored into + * @a __str. + */ + template + inline basic_istream<_CharT, _Traits>& + getline(basic_istream<_CharT, _Traits>& __is, + basic_string<_CharT, _Traits, _Alloc>& __str) + { return std::getline(__is, __str, __is.widen('\n')); } + +#if __cplusplus >= 201103L + /// Read a line from an rvalue stream into a string. + template + inline basic_istream<_CharT, _Traits>& + getline(basic_istream<_CharT, _Traits>&& __is, + basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim) + { return std::getline(__is, __str, __delim); } + + /// Read a line from an rvalue stream into a string. + template + inline basic_istream<_CharT, _Traits>& + getline(basic_istream<_CharT, _Traits>&& __is, + basic_string<_CharT, _Traits, _Alloc>& __str) + { return std::getline(__is, __str); } +#endif + + template<> + basic_istream& + getline(basic_istream& __in, basic_string& __str, + char __delim); + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + basic_istream& + getline(basic_istream& __in, basic_string& __str, + wchar_t __delim); +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#if __cplusplus >= 201103L + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + +#if _GLIBCXX_USE_C99_STDLIB + // 21.4 Numeric Conversions [string.conversions]. + inline int + stoi(const string& __str, size_t* __idx = 0, int __base = 10) + { return __gnu_cxx::__stoa(&std::strtol, "stoi", __str.c_str(), + __idx, __base); } + + inline long + stol(const string& __str, size_t* __idx = 0, int __base = 10) + { return __gnu_cxx::__stoa(&std::strtol, "stol", __str.c_str(), + __idx, __base); } + + inline unsigned long + stoul(const string& __str, size_t* __idx = 0, int __base = 10) + { return __gnu_cxx::__stoa(&std::strtoul, "stoul", __str.c_str(), + __idx, __base); } + + inline long long + stoll(const string& __str, size_t* __idx = 0, int __base = 10) + { return __gnu_cxx::__stoa(&std::strtoll, "stoll", __str.c_str(), + __idx, __base); } + + inline unsigned long long + stoull(const string& __str, size_t* __idx = 0, int __base = 10) + { return __gnu_cxx::__stoa(&std::strtoull, "stoull", __str.c_str(), + __idx, __base); } + + // NB: strtof vs strtod. + inline float + stof(const string& __str, size_t* __idx = 0) + { return __gnu_cxx::__stoa(&std::strtof, "stof", __str.c_str(), __idx); } + + inline double + stod(const string& __str, size_t* __idx = 0) + { return __gnu_cxx::__stoa(&std::strtod, "stod", __str.c_str(), __idx); } + + inline long double + stold(const string& __str, size_t* __idx = 0) + { return __gnu_cxx::__stoa(&std::strtold, "stold", __str.c_str(), __idx); } +#endif // _GLIBCXX_USE_C99_STDLIB + +#if _GLIBCXX_USE_C99_STDIO + // NB: (v)snprintf vs sprintf. + + // DR 1261. + inline string + to_string(int __val) + { return __gnu_cxx::__to_xstring(&std::vsnprintf, 4 * sizeof(int), + "%d", __val); } + + inline string + to_string(unsigned __val) + { return __gnu_cxx::__to_xstring(&std::vsnprintf, + 4 * sizeof(unsigned), + "%u", __val); } + + inline string + to_string(long __val) + { return __gnu_cxx::__to_xstring(&std::vsnprintf, 4 * sizeof(long), + "%ld", __val); } + + inline string + to_string(unsigned long __val) + { return __gnu_cxx::__to_xstring(&std::vsnprintf, + 4 * sizeof(unsigned long), + "%lu", __val); } + + inline string + to_string(long long __val) + { return __gnu_cxx::__to_xstring(&std::vsnprintf, + 4 * sizeof(long long), + "%lld", __val); } + + inline string + to_string(unsigned long long __val) + { return __gnu_cxx::__to_xstring(&std::vsnprintf, + 4 * sizeof(unsigned long long), + "%llu", __val); } + + inline string + to_string(float __val) + { + const int __n = + __gnu_cxx::__numeric_traits::__max_exponent10 + 20; + return __gnu_cxx::__to_xstring(&std::vsnprintf, __n, + "%f", __val); + } + + inline string + to_string(double __val) + { + const int __n = + __gnu_cxx::__numeric_traits::__max_exponent10 + 20; + return __gnu_cxx::__to_xstring(&std::vsnprintf, __n, + "%f", __val); + } + + inline string + to_string(long double __val) + { + const int __n = + __gnu_cxx::__numeric_traits::__max_exponent10 + 20; + return __gnu_cxx::__to_xstring(&std::vsnprintf, __n, + "%Lf", __val); + } +#endif // _GLIBCXX_USE_C99_STDIO + +#if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_WCHAR + inline int + stoi(const wstring& __str, size_t* __idx = 0, int __base = 10) + { return __gnu_cxx::__stoa(&std::wcstol, "stoi", __str.c_str(), + __idx, __base); } + + inline long + stol(const wstring& __str, size_t* __idx = 0, int __base = 10) + { return __gnu_cxx::__stoa(&std::wcstol, "stol", __str.c_str(), + __idx, __base); } + + inline unsigned long + stoul(const wstring& __str, size_t* __idx = 0, int __base = 10) + { return __gnu_cxx::__stoa(&std::wcstoul, "stoul", __str.c_str(), + __idx, __base); } + + inline long long + stoll(const wstring& __str, size_t* __idx = 0, int __base = 10) + { return __gnu_cxx::__stoa(&std::wcstoll, "stoll", __str.c_str(), + __idx, __base); } + + inline unsigned long long + stoull(const wstring& __str, size_t* __idx = 0, int __base = 10) + { return __gnu_cxx::__stoa(&std::wcstoull, "stoull", __str.c_str(), + __idx, __base); } + + // NB: wcstof vs wcstod. + inline float + stof(const wstring& __str, size_t* __idx = 0) + { return __gnu_cxx::__stoa(&std::wcstof, "stof", __str.c_str(), __idx); } + + inline double + stod(const wstring& __str, size_t* __idx = 0) + { return __gnu_cxx::__stoa(&std::wcstod, "stod", __str.c_str(), __idx); } + + inline long double + stold(const wstring& __str, size_t* __idx = 0) + { return __gnu_cxx::__stoa(&std::wcstold, "stold", __str.c_str(), __idx); } + +#ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF + // DR 1261. + inline wstring + to_wstring(int __val) + { return __gnu_cxx::__to_xstring(&std::vswprintf, 4 * sizeof(int), + L"%d", __val); } + + inline wstring + to_wstring(unsigned __val) + { return __gnu_cxx::__to_xstring(&std::vswprintf, + 4 * sizeof(unsigned), + L"%u", __val); } + + inline wstring + to_wstring(long __val) + { return __gnu_cxx::__to_xstring(&std::vswprintf, 4 * sizeof(long), + L"%ld", __val); } + + inline wstring + to_wstring(unsigned long __val) + { return __gnu_cxx::__to_xstring(&std::vswprintf, + 4 * sizeof(unsigned long), + L"%lu", __val); } + + inline wstring + to_wstring(long long __val) + { return __gnu_cxx::__to_xstring(&std::vswprintf, + 4 * sizeof(long long), + L"%lld", __val); } + + inline wstring + to_wstring(unsigned long long __val) + { return __gnu_cxx::__to_xstring(&std::vswprintf, + 4 * sizeof(unsigned long long), + L"%llu", __val); } + + inline wstring + to_wstring(float __val) + { + const int __n = + __gnu_cxx::__numeric_traits::__max_exponent10 + 20; + return __gnu_cxx::__to_xstring(&std::vswprintf, __n, + L"%f", __val); + } + + inline wstring + to_wstring(double __val) + { + const int __n = + __gnu_cxx::__numeric_traits::__max_exponent10 + 20; + return __gnu_cxx::__to_xstring(&std::vswprintf, __n, + L"%f", __val); + } + + inline wstring + to_wstring(long double __val) + { + const int __n = + __gnu_cxx::__numeric_traits::__max_exponent10 + 20; + return __gnu_cxx::__to_xstring(&std::vswprintf, __n, + L"%Lf", __val); + } +#endif // _GLIBCXX_HAVE_BROKEN_VSWPRINTF +#endif // _GLIBCXX_USE_WCHAR_T && _GLIBCXX_USE_C99_WCHAR + +_GLIBCXX_END_NAMESPACE_CXX11 +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* C++11 */ + +#if __cplusplus >= 201103L + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // DR 1182. + +#ifndef _GLIBCXX_COMPATIBILITY_CXX0X + /// std::hash specialization for string. + template<> + struct hash + : public __hash_base + { + size_t + operator()(const string& __s) const noexcept + { return std::_Hash_impl::hash(__s.data(), __s.length()); } + }; + + template<> + struct __is_fast_hash> : std::false_type + { }; + +#ifdef _GLIBCXX_USE_WCHAR_T + /// std::hash specialization for wstring. + template<> + struct hash + : public __hash_base + { + size_t + operator()(const wstring& __s) const noexcept + { return std::_Hash_impl::hash(__s.data(), + __s.length() * sizeof(wchar_t)); } + }; + + template<> + struct __is_fast_hash> : std::false_type + { }; +#endif +#endif /* _GLIBCXX_COMPATIBILITY_CXX0X */ + +#ifdef _GLIBCXX_USE_C99_STDINT_TR1 + /// std::hash specialization for u16string. + template<> + struct hash + : public __hash_base + { + size_t + operator()(const u16string& __s) const noexcept + { return std::_Hash_impl::hash(__s.data(), + __s.length() * sizeof(char16_t)); } + }; + + template<> + struct __is_fast_hash> : std::false_type + { }; + + /// std::hash specialization for u32string. + template<> + struct hash + : public __hash_base + { + size_t + operator()(const u32string& __s) const noexcept + { return std::_Hash_impl::hash(__s.data(), + __s.length() * sizeof(char32_t)); } + }; + + template<> + struct __is_fast_hash> : std::false_type + { }; +#endif + +_GLIBCXX_END_NAMESPACE_VERSION + +#if __cplusplus > 201103L + +#define __cpp_lib_string_udls 201304 + + inline namespace literals + { + inline namespace string_literals + { +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + _GLIBCXX_DEFAULT_ABI_TAG + inline basic_string + operator""s(const char* __str, size_t __len) + { return basic_string{__str, __len}; } + +#ifdef _GLIBCXX_USE_WCHAR_T + _GLIBCXX_DEFAULT_ABI_TAG + inline basic_string + operator""s(const wchar_t* __str, size_t __len) + { return basic_string{__str, __len}; } +#endif + +#ifdef _GLIBCXX_USE_C99_STDINT_TR1 + _GLIBCXX_DEFAULT_ABI_TAG + inline basic_string + operator""s(const char16_t* __str, size_t __len) + { return basic_string{__str, __len}; } + + _GLIBCXX_DEFAULT_ABI_TAG + inline basic_string + operator""s(const char32_t* __str, size_t __len) + { return basic_string{__str, __len}; } +#endif + +_GLIBCXX_END_NAMESPACE_VERSION + } // inline namespace string_literals + } // inline namespace literals + +#endif // __cplusplus > 201103L + +} // namespace std + +#endif // C++11 + +#endif /* _BASIC_STRING_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/boost_concept_check.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/boost_concept_check.h new file mode 100644 index 0000000..fb9a643 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/boost_concept_check.h @@ -0,0 +1,790 @@ +// -*- C++ -*- + +// Copyright (C) 2004-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify, +// sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided +// "as is" without express or implied warranty, and with no claim as +// to its suitability for any purpose. +// + +/** @file bits/boost_concept_check.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iterator} + */ + +// GCC Note: based on version 1.12.0 of the Boost library. + +#ifndef _BOOST_CONCEPT_CHECK_H +#define _BOOST_CONCEPT_CHECK_H 1 + +#pragma GCC system_header + +#include +#include // for traits and tags + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#define _IsUnused __attribute__ ((__unused__)) + +// When the C-C code is in use, we would like this function to do as little +// as possible at runtime, use as few resources as possible, and hopefully +// be elided out of existence... hmmm. +template +inline void __function_requires() +{ + void (_Concept::*__x)() _IsUnused = &_Concept::__constraints; +} + +// No definition: if this is referenced, there's a problem with +// the instantiating type not being one of the required integer types. +// Unfortunately, this results in a link-time error, not a compile-time error. +void __error_type_must_be_an_integer_type(); +void __error_type_must_be_an_unsigned_integer_type(); +void __error_type_must_be_a_signed_integer_type(); + +// ??? Should the "concept_checking*" structs begin with more than _ ? +#define _GLIBCXX_CLASS_REQUIRES(_type_var, _ns, _concept) \ + typedef void (_ns::_concept <_type_var>::* _func##_type_var##_concept)(); \ + template <_func##_type_var##_concept _Tp1> \ + struct _concept_checking##_type_var##_concept { }; \ + typedef _concept_checking##_type_var##_concept< \ + &_ns::_concept <_type_var>::__constraints> \ + _concept_checking_typedef##_type_var##_concept + +#define _GLIBCXX_CLASS_REQUIRES2(_type_var1, _type_var2, _ns, _concept) \ + typedef void (_ns::_concept <_type_var1,_type_var2>::* _func##_type_var1##_type_var2##_concept)(); \ + template <_func##_type_var1##_type_var2##_concept _Tp1> \ + struct _concept_checking##_type_var1##_type_var2##_concept { }; \ + typedef _concept_checking##_type_var1##_type_var2##_concept< \ + &_ns::_concept <_type_var1,_type_var2>::__constraints> \ + _concept_checking_typedef##_type_var1##_type_var2##_concept + +#define _GLIBCXX_CLASS_REQUIRES3(_type_var1, _type_var2, _type_var3, _ns, _concept) \ + typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3>::* _func##_type_var1##_type_var2##_type_var3##_concept)(); \ + template <_func##_type_var1##_type_var2##_type_var3##_concept _Tp1> \ + struct _concept_checking##_type_var1##_type_var2##_type_var3##_concept { }; \ + typedef _concept_checking##_type_var1##_type_var2##_type_var3##_concept< \ + &_ns::_concept <_type_var1,_type_var2,_type_var3>::__constraints> \ + _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_concept + +#define _GLIBCXX_CLASS_REQUIRES4(_type_var1, _type_var2, _type_var3, _type_var4, _ns, _concept) \ + typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::* _func##_type_var1##_type_var2##_type_var3##_type_var4##_concept)(); \ + template <_func##_type_var1##_type_var2##_type_var3##_type_var4##_concept _Tp1> \ + struct _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept { }; \ + typedef _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept< \ + &_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::__constraints> \ + _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_type_var4##_concept + + +template +struct _Aux_require_same { }; + +template +struct _Aux_require_same<_Tp,_Tp> { typedef _Tp _Type; }; + + template + struct _SameTypeConcept + { + void __constraints() { + typedef typename _Aux_require_same<_Tp1, _Tp2>::_Type _Required; + } + }; + + template + struct _IntegerConcept { + void __constraints() { + __error_type_must_be_an_integer_type(); + } + }; + template <> struct _IntegerConcept { void __constraints() {} }; + template <> struct _IntegerConcept { void __constraints(){} }; + template <> struct _IntegerConcept { void __constraints() {} }; + template <> struct _IntegerConcept { void __constraints() {} }; + template <> struct _IntegerConcept { void __constraints() {} }; + template <> struct _IntegerConcept { void __constraints() {} }; + template <> struct _IntegerConcept { void __constraints() {} }; + template <> struct _IntegerConcept + { void __constraints() {} }; + + template + struct _SignedIntegerConcept { + void __constraints() { + __error_type_must_be_a_signed_integer_type(); + } + }; + template <> struct _SignedIntegerConcept { void __constraints() {} }; + template <> struct _SignedIntegerConcept { void __constraints() {} }; + template <> struct _SignedIntegerConcept { void __constraints() {} }; + template <> struct _SignedIntegerConcept { void __constraints(){}}; + + template + struct _UnsignedIntegerConcept { + void __constraints() { + __error_type_must_be_an_unsigned_integer_type(); + } + }; + template <> struct _UnsignedIntegerConcept + { void __constraints() {} }; + template <> struct _UnsignedIntegerConcept + { void __constraints() {} }; + template <> struct _UnsignedIntegerConcept + { void __constraints() {} }; + template <> struct _UnsignedIntegerConcept + { void __constraints() {} }; + + //=========================================================================== + // Basic Concepts + + template + struct _DefaultConstructibleConcept + { + void __constraints() { + _Tp __a _IsUnused; // require default constructor + } + }; + + template + struct _AssignableConcept + { + void __constraints() { + __a = __a; // require assignment operator + __const_constraints(__a); + } + void __const_constraints(const _Tp& __b) { + __a = __b; // const required for argument to assignment + } + _Tp __a; + // possibly should be "Tp* a;" and then dereference "a" in constraint + // functions? present way would require a default ctor, i think... + }; + + template + struct _CopyConstructibleConcept + { + void __constraints() { + _Tp __a(__b); // require copy constructor + _Tp* __ptr _IsUnused = &__a; // require address of operator + __const_constraints(__a); + } + void __const_constraints(const _Tp& __a) { + _Tp __c _IsUnused(__a); // require const copy constructor + const _Tp* __ptr _IsUnused = &__a; // require const address of operator + } + _Tp __b; + }; + + // The SGI STL version of Assignable requires copy constructor and operator= + template + struct _SGIAssignableConcept + { + void __constraints() { + _Tp __b _IsUnused(__a); + __a = __a; // require assignment operator + __const_constraints(__a); + } + void __const_constraints(const _Tp& __b) { + _Tp __c _IsUnused(__b); + __a = __b; // const required for argument to assignment + } + _Tp __a; + }; + + template + struct _ConvertibleConcept + { + void __constraints() { + _To __y _IsUnused = __x; + } + _From __x; + }; + + // The C++ standard requirements for many concepts talk about return + // types that must be "convertible to bool". The problem with this + // requirement is that it leaves the door open for evil proxies that + // define things like operator|| with strange return types. Two + // possible solutions are: + // 1) require the return type to be exactly bool + // 2) stay with convertible to bool, and also + // specify stuff about all the logical operators. + // For now we just test for convertible to bool. + template + void __aux_require_boolean_expr(const _Tp& __t) { + bool __x _IsUnused = __t; + } + +// FIXME + template + struct _EqualityComparableConcept + { + void __constraints() { + __aux_require_boolean_expr(__a == __b); + } + _Tp __a, __b; + }; + + template + struct _LessThanComparableConcept + { + void __constraints() { + __aux_require_boolean_expr(__a < __b); + } + _Tp __a, __b; + }; + + // This is equivalent to SGI STL's LessThanComparable. + template + struct _ComparableConcept + { + void __constraints() { + __aux_require_boolean_expr(__a < __b); + __aux_require_boolean_expr(__a > __b); + __aux_require_boolean_expr(__a <= __b); + __aux_require_boolean_expr(__a >= __b); + } + _Tp __a, __b; + }; + +#define _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(_OP,_NAME) \ + template \ + struct _NAME { \ + void __constraints() { (void)__constraints_(); } \ + bool __constraints_() { \ + return __a _OP __b; \ + } \ + _First __a; \ + _Second __b; \ + } + +#define _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(_OP,_NAME) \ + template \ + struct _NAME { \ + void __constraints() { (void)__constraints_(); } \ + _Ret __constraints_() { \ + return __a _OP __b; \ + } \ + _First __a; \ + _Second __b; \ + } + + _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(==, _EqualOpConcept); + _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(!=, _NotEqualOpConcept); + _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<, _LessThanOpConcept); + _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<=, _LessEqualOpConcept); + _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>, _GreaterThanOpConcept); + _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>=, _GreaterEqualOpConcept); + + _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(+, _PlusOpConcept); + _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(*, _TimesOpConcept); + _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(/, _DivideOpConcept); + _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(-, _SubtractOpConcept); + _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(%, _ModOpConcept); + +#undef _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT +#undef _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT + + //=========================================================================== + // Function Object Concepts + + template + struct _GeneratorConcept + { + void __constraints() { + const _Return& __r _IsUnused = __f();// require operator() member function + } + _Func __f; + }; + + + template + struct _GeneratorConcept<_Func,void> + { + void __constraints() { + __f(); // require operator() member function + } + _Func __f; + }; + + template + struct _UnaryFunctionConcept + { + void __constraints() { + __r = __f(__arg); // require operator() + } + _Func __f; + _Arg __arg; + _Return __r; + }; + + template + struct _UnaryFunctionConcept<_Func, void, _Arg> { + void __constraints() { + __f(__arg); // require operator() + } + _Func __f; + _Arg __arg; + }; + + template + struct _BinaryFunctionConcept + { + void __constraints() { + __r = __f(__first, __second); // require operator() + } + _Func __f; + _First __first; + _Second __second; + _Return __r; + }; + + template + struct _BinaryFunctionConcept<_Func, void, _First, _Second> + { + void __constraints() { + __f(__first, __second); // require operator() + } + _Func __f; + _First __first; + _Second __second; + }; + + template + struct _UnaryPredicateConcept + { + void __constraints() { + __aux_require_boolean_expr(__f(__arg)); // require op() returning bool + } + _Func __f; + _Arg __arg; + }; + + template + struct _BinaryPredicateConcept + { + void __constraints() { + __aux_require_boolean_expr(__f(__a, __b)); // require op() returning bool + } + _Func __f; + _First __a; + _Second __b; + }; + + // use this when functor is used inside a container class like std::set + template + struct _Const_BinaryPredicateConcept { + void __constraints() { + __const_constraints(__f); + } + void __const_constraints(const _Func& __fun) { + __function_requires<_BinaryPredicateConcept<_Func, _First, _Second> >(); + // operator() must be a const member function + __aux_require_boolean_expr(__fun(__a, __b)); + } + _Func __f; + _First __a; + _Second __b; + }; + + //=========================================================================== + // Iterator Concepts + + template + struct _TrivialIteratorConcept + { + void __constraints() { +// __function_requires< _DefaultConstructibleConcept<_Tp> >(); + __function_requires< _AssignableConcept<_Tp> >(); + __function_requires< _EqualityComparableConcept<_Tp> >(); +// typedef typename std::iterator_traits<_Tp>::value_type _V; + (void)*__i; // require dereference operator + } + _Tp __i; + }; + + template + struct _Mutable_TrivialIteratorConcept + { + void __constraints() { + __function_requires< _TrivialIteratorConcept<_Tp> >(); + *__i = *__j; // require dereference and assignment + } + _Tp __i, __j; + }; + + template + struct _InputIteratorConcept + { + void __constraints() { + __function_requires< _TrivialIteratorConcept<_Tp> >(); + // require iterator_traits typedef's + typedef typename std::iterator_traits<_Tp>::difference_type _Diff; +// __function_requires< _SignedIntegerConcept<_Diff> >(); + typedef typename std::iterator_traits<_Tp>::reference _Ref; + typedef typename std::iterator_traits<_Tp>::pointer _Pt; + typedef typename std::iterator_traits<_Tp>::iterator_category _Cat; + __function_requires< _ConvertibleConcept< + typename std::iterator_traits<_Tp>::iterator_category, + std::input_iterator_tag> >(); + ++__i; // require preincrement operator + __i++; // require postincrement operator + } + _Tp __i; + }; + + template + struct _OutputIteratorConcept + { + void __constraints() { + __function_requires< _AssignableConcept<_Tp> >(); + ++__i; // require preincrement operator + __i++; // require postincrement operator + *__i++ = __t; // require postincrement and assignment + } + _Tp __i; + _ValueT __t; + }; + + template + struct _ForwardIteratorConcept + { + void __constraints() { + __function_requires< _InputIteratorConcept<_Tp> >(); + __function_requires< _DefaultConstructibleConcept<_Tp> >(); + __function_requires< _ConvertibleConcept< + typename std::iterator_traits<_Tp>::iterator_category, + std::forward_iterator_tag> >(); + typedef typename std::iterator_traits<_Tp>::reference _Ref; + _Ref __r _IsUnused = *__i; + } + _Tp __i; + }; + + template + struct _Mutable_ForwardIteratorConcept + { + void __constraints() { + __function_requires< _ForwardIteratorConcept<_Tp> >(); + *__i++ = *__i; // require postincrement and assignment + } + _Tp __i; + }; + + template + struct _BidirectionalIteratorConcept + { + void __constraints() { + __function_requires< _ForwardIteratorConcept<_Tp> >(); + __function_requires< _ConvertibleConcept< + typename std::iterator_traits<_Tp>::iterator_category, + std::bidirectional_iterator_tag> >(); + --__i; // require predecrement operator + __i--; // require postdecrement operator + } + _Tp __i; + }; + + template + struct _Mutable_BidirectionalIteratorConcept + { + void __constraints() { + __function_requires< _BidirectionalIteratorConcept<_Tp> >(); + __function_requires< _Mutable_ForwardIteratorConcept<_Tp> >(); + *__i-- = *__i; // require postdecrement and assignment + } + _Tp __i; + }; + + + template + struct _RandomAccessIteratorConcept + { + void __constraints() { + __function_requires< _BidirectionalIteratorConcept<_Tp> >(); + __function_requires< _ComparableConcept<_Tp> >(); + __function_requires< _ConvertibleConcept< + typename std::iterator_traits<_Tp>::iterator_category, + std::random_access_iterator_tag> >(); + // ??? We don't use _Ref, are we just checking for "referenceability"? + typedef typename std::iterator_traits<_Tp>::reference _Ref; + + __i += __n; // require assignment addition operator + __i = __i + __n; __i = __n + __i; // require addition with difference type + __i -= __n; // require assignment subtraction op + __i = __i - __n; // require subtraction with + // difference type + __n = __i - __j; // require difference operator + (void)__i[__n]; // require element access operator + } + _Tp __a, __b; + _Tp __i, __j; + typename std::iterator_traits<_Tp>::difference_type __n; + }; + + template + struct _Mutable_RandomAccessIteratorConcept + { + void __constraints() { + __function_requires< _RandomAccessIteratorConcept<_Tp> >(); + __function_requires< _Mutable_BidirectionalIteratorConcept<_Tp> >(); + __i[__n] = *__i; // require element access and assignment + } + _Tp __i; + typename std::iterator_traits<_Tp>::difference_type __n; + }; + + //=========================================================================== + // Container Concepts + + template + struct _ContainerConcept + { + typedef typename _Container::value_type _Value_type; + typedef typename _Container::difference_type _Difference_type; + typedef typename _Container::size_type _Size_type; + typedef typename _Container::const_reference _Const_reference; + typedef typename _Container::const_pointer _Const_pointer; + typedef typename _Container::const_iterator _Const_iterator; + + void __constraints() { + __function_requires< _InputIteratorConcept<_Const_iterator> >(); + __function_requires< _AssignableConcept<_Container> >(); + const _Container __c; + __i = __c.begin(); + __i = __c.end(); + __n = __c.size(); + __n = __c.max_size(); + __b = __c.empty(); + } + bool __b; + _Const_iterator __i; + _Size_type __n; + }; + + template + struct _Mutable_ContainerConcept + { + typedef typename _Container::value_type _Value_type; + typedef typename _Container::reference _Reference; + typedef typename _Container::iterator _Iterator; + typedef typename _Container::pointer _Pointer; + + void __constraints() { + __function_requires< _ContainerConcept<_Container> >(); + __function_requires< _AssignableConcept<_Value_type> >(); + __function_requires< _InputIteratorConcept<_Iterator> >(); + + __i = __c.begin(); + __i = __c.end(); + __c.swap(__c2); + } + _Iterator __i; + _Container __c, __c2; + }; + + template + struct _ForwardContainerConcept + { + void __constraints() { + __function_requires< _ContainerConcept<_ForwardContainer> >(); + typedef typename _ForwardContainer::const_iterator _Const_iterator; + __function_requires< _ForwardIteratorConcept<_Const_iterator> >(); + } + }; + + template + struct _Mutable_ForwardContainerConcept + { + void __constraints() { + __function_requires< _ForwardContainerConcept<_ForwardContainer> >(); + __function_requires< _Mutable_ContainerConcept<_ForwardContainer> >(); + typedef typename _ForwardContainer::iterator _Iterator; + __function_requires< _Mutable_ForwardIteratorConcept<_Iterator> >(); + } + }; + + template + struct _ReversibleContainerConcept + { + typedef typename _ReversibleContainer::const_iterator _Const_iterator; + typedef typename _ReversibleContainer::const_reverse_iterator + _Const_reverse_iterator; + + void __constraints() { + __function_requires< _ForwardContainerConcept<_ReversibleContainer> >(); + __function_requires< _BidirectionalIteratorConcept<_Const_iterator> >(); + __function_requires< + _BidirectionalIteratorConcept<_Const_reverse_iterator> >(); + + const _ReversibleContainer __c; + _Const_reverse_iterator __i = __c.rbegin(); + __i = __c.rend(); + } + }; + + template + struct _Mutable_ReversibleContainerConcept + { + typedef typename _ReversibleContainer::iterator _Iterator; + typedef typename _ReversibleContainer::reverse_iterator _Reverse_iterator; + + void __constraints() { + __function_requires<_ReversibleContainerConcept<_ReversibleContainer> >(); + __function_requires< + _Mutable_ForwardContainerConcept<_ReversibleContainer> >(); + __function_requires<_Mutable_BidirectionalIteratorConcept<_Iterator> >(); + __function_requires< + _Mutable_BidirectionalIteratorConcept<_Reverse_iterator> >(); + + _Reverse_iterator __i = __c.rbegin(); + __i = __c.rend(); + } + _ReversibleContainer __c; + }; + + template + struct _RandomAccessContainerConcept + { + typedef typename _RandomAccessContainer::size_type _Size_type; + typedef typename _RandomAccessContainer::const_reference _Const_reference; + typedef typename _RandomAccessContainer::const_iterator _Const_iterator; + typedef typename _RandomAccessContainer::const_reverse_iterator + _Const_reverse_iterator; + + void __constraints() { + __function_requires< + _ReversibleContainerConcept<_RandomAccessContainer> >(); + __function_requires< _RandomAccessIteratorConcept<_Const_iterator> >(); + __function_requires< + _RandomAccessIteratorConcept<_Const_reverse_iterator> >(); + + const _RandomAccessContainer __c; + _Const_reference __r _IsUnused = __c[__n]; + } + _Size_type __n; + }; + + template + struct _Mutable_RandomAccessContainerConcept + { + typedef typename _RandomAccessContainer::size_type _Size_type; + typedef typename _RandomAccessContainer::reference _Reference; + typedef typename _RandomAccessContainer::iterator _Iterator; + typedef typename _RandomAccessContainer::reverse_iterator _Reverse_iterator; + + void __constraints() { + __function_requires< + _RandomAccessContainerConcept<_RandomAccessContainer> >(); + __function_requires< + _Mutable_ReversibleContainerConcept<_RandomAccessContainer> >(); + __function_requires< _Mutable_RandomAccessIteratorConcept<_Iterator> >(); + __function_requires< + _Mutable_RandomAccessIteratorConcept<_Reverse_iterator> >(); + + _Reference __r _IsUnused = __c[__i]; + } + _Size_type __i; + _RandomAccessContainer __c; + }; + + // A Sequence is inherently mutable + template + struct _SequenceConcept + { + typedef typename _Sequence::reference _Reference; + typedef typename _Sequence::const_reference _Const_reference; + + void __constraints() { + // Matt Austern's book puts DefaultConstructible here, the C++ + // standard places it in Container + // function_requires< DefaultConstructible >(); + __function_requires< _Mutable_ForwardContainerConcept<_Sequence> >(); + __function_requires< _DefaultConstructibleConcept<_Sequence> >(); + + _Sequence + __c _IsUnused(__n, __t), + __c2 _IsUnused(__first, __last); + + __c.insert(__p, __t); + __c.insert(__p, __n, __t); + __c.insert(__p, __first, __last); + + __c.erase(__p); + __c.erase(__p, __q); + + _Reference __r _IsUnused = __c.front(); + + __const_constraints(__c); + } + void __const_constraints(const _Sequence& __c) { + _Const_reference __r _IsUnused = __c.front(); + } + typename _Sequence::value_type __t; + typename _Sequence::size_type __n; + typename _Sequence::value_type *__first, *__last; + typename _Sequence::iterator __p, __q; + }; + + template + struct _FrontInsertionSequenceConcept + { + void __constraints() { + __function_requires< _SequenceConcept<_FrontInsertionSequence> >(); + + __c.push_front(__t); + __c.pop_front(); + } + _FrontInsertionSequence __c; + typename _FrontInsertionSequence::value_type __t; + }; + + template + struct _BackInsertionSequenceConcept + { + typedef typename _BackInsertionSequence::reference _Reference; + typedef typename _BackInsertionSequence::const_reference _Const_reference; + + void __constraints() { + __function_requires< _SequenceConcept<_BackInsertionSequence> >(); + + __c.push_back(__t); + __c.pop_back(); + _Reference __r _IsUnused = __c.back(); + } + void __const_constraints(const _BackInsertionSequence& __c) { + _Const_reference __r _IsUnused = __c.back(); + }; + _BackInsertionSequence __c; + typename _BackInsertionSequence::value_type __t; + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#undef _IsUnused + +#endif // _GLIBCXX_BOOST_CONCEPT_CHECK + + diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/c++0x_warning.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/c++0x_warning.h new file mode 100644 index 0000000..d2bc714 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/c++0x_warning.h @@ -0,0 +1,37 @@ +// Copyright (C) 2007-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/c++0x_warning.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iosfwd} + */ + +#ifndef _CXX0X_WARNING_H +#define _CXX0X_WARNING_H 1 + +#if __cplusplus < 201103L +#error This file requires compiler and library support \ +for the ISO C++ 2011 standard. This support must be enabled \ +with the -std=c++11 or -std=gnu++11 compiler options. +#endif + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/c++14_warning.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/c++14_warning.h new file mode 100644 index 0000000..5ead9c6 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/c++14_warning.h @@ -0,0 +1,37 @@ +// Copyright (C) 2013-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/c++14_warning.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iosfwd} + */ + +#ifndef _CXX14_WARNING_H +#define _CXX14_WARNING_H 1 + +#if __cplusplus <= 201103L +#error This file requires compiler and library support \ +for the ISO C++ 2014 standard. This support must be enabled \ +with the -std=c++14 or -std=gnu++14 compiler options. +#endif + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/char_traits.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/char_traits.h new file mode 100644 index 0000000..3ecc30e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/char_traits.h @@ -0,0 +1,706 @@ +// Character Traits for use by standard string and iostream -*- C++ -*- + +// Copyright (C) 1997-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/char_traits.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{string} + */ + +// +// ISO C++ 14882: 21 Strings library +// + +#ifndef _CHAR_TRAITS_H +#define _CHAR_TRAITS_H 1 + +#pragma GCC system_header + +#include // std::copy, std::fill_n +#include // For streampos +#include // For WEOF, wmemmove, wmemset, etc. + +#ifndef _GLIBCXX_ALWAYS_INLINE +#define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__)) +#endif + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @brief Mapping from character type to associated types. + * + * @note This is an implementation class for the generic version + * of char_traits. It defines int_type, off_type, pos_type, and + * state_type. By default these are unsigned long, streamoff, + * streampos, and mbstate_t. Users who need a different set of + * types, but who don't need to change the definitions of any function + * defined in char_traits, can specialize __gnu_cxx::_Char_types + * while leaving __gnu_cxx::char_traits alone. */ + template + struct _Char_types + { + typedef unsigned long int_type; + typedef std::streampos pos_type; + typedef std::streamoff off_type; + typedef std::mbstate_t state_type; + }; + + + /** + * @brief Base class used to implement std::char_traits. + * + * @note For any given actual character type, this definition is + * probably wrong. (Most of the member functions are likely to be + * right, but the int_type and state_type typedefs, and the eof() + * member function, are likely to be wrong.) The reason this class + * exists is so users can specialize it. Classes in namespace std + * may not be specialized for fundamental types, but classes in + * namespace __gnu_cxx may be. + * + * See https://gcc.gnu.org/onlinedocs/libstdc++/manual/strings.html#strings.string.character_types + * for advice on how to make use of this class for @a unusual character + * types. Also, check out include/ext/pod_char_traits.h. + */ + template + struct char_traits + { + typedef _CharT char_type; + typedef typename _Char_types<_CharT>::int_type int_type; + typedef typename _Char_types<_CharT>::pos_type pos_type; + typedef typename _Char_types<_CharT>::off_type off_type; + typedef typename _Char_types<_CharT>::state_type state_type; + + static _GLIBCXX14_CONSTEXPR void + assign(char_type& __c1, const char_type& __c2) + { __c1 = __c2; } + + static _GLIBCXX_CONSTEXPR bool + eq(const char_type& __c1, const char_type& __c2) + { return __c1 == __c2; } + + static _GLIBCXX_CONSTEXPR bool + lt(const char_type& __c1, const char_type& __c2) + { return __c1 < __c2; } + + static _GLIBCXX14_CONSTEXPR int + compare(const char_type* __s1, const char_type* __s2, std::size_t __n); + + static _GLIBCXX14_CONSTEXPR std::size_t + length(const char_type* __s); + + static _GLIBCXX14_CONSTEXPR const char_type* + find(const char_type* __s, std::size_t __n, const char_type& __a); + + static char_type* + move(char_type* __s1, const char_type* __s2, std::size_t __n); + + static char_type* + copy(char_type* __s1, const char_type* __s2, std::size_t __n); + + static char_type* + assign(char_type* __s, std::size_t __n, char_type __a); + + static _GLIBCXX_CONSTEXPR char_type + to_char_type(const int_type& __c) + { return static_cast(__c); } + + static _GLIBCXX_CONSTEXPR int_type + to_int_type(const char_type& __c) + { return static_cast(__c); } + + static _GLIBCXX_CONSTEXPR bool + eq_int_type(const int_type& __c1, const int_type& __c2) + { return __c1 == __c2; } + + static _GLIBCXX_CONSTEXPR int_type + eof() + { return static_cast(_GLIBCXX_STDIO_EOF); } + + static _GLIBCXX_CONSTEXPR int_type + not_eof(const int_type& __c) + { return !eq_int_type(__c, eof()) ? __c : to_int_type(char_type()); } + }; + +#define __cpp_lib_constexpr_char_traits 201611 + + template + _GLIBCXX14_CONSTEXPR int + char_traits<_CharT>:: + compare(const char_type* __s1, const char_type* __s2, std::size_t __n) + { + for (std::size_t __i = 0; __i < __n; ++__i) + if (lt(__s1[__i], __s2[__i])) + return -1; + else if (lt(__s2[__i], __s1[__i])) + return 1; + return 0; + } + + template + _GLIBCXX14_CONSTEXPR std::size_t + char_traits<_CharT>:: + length(const char_type* __p) + { + std::size_t __i = 0; + while (!eq(__p[__i], char_type())) + ++__i; + return __i; + } + + template + _GLIBCXX14_CONSTEXPR const typename char_traits<_CharT>::char_type* + char_traits<_CharT>:: + find(const char_type* __s, std::size_t __n, const char_type& __a) + { + for (std::size_t __i = 0; __i < __n; ++__i) + if (eq(__s[__i], __a)) + return __s + __i; + return 0; + } + + template + typename char_traits<_CharT>::char_type* + char_traits<_CharT>:: + move(char_type* __s1, const char_type* __s2, std::size_t __n) + { + return static_cast<_CharT*>(__builtin_memmove(__s1, __s2, + __n * sizeof(char_type))); + } + + template + typename char_traits<_CharT>::char_type* + char_traits<_CharT>:: + copy(char_type* __s1, const char_type* __s2, std::size_t __n) + { + // NB: Inline std::copy so no recursive dependencies. + std::copy(__s2, __s2 + __n, __s1); + return __s1; + } + + template + typename char_traits<_CharT>::char_type* + char_traits<_CharT>:: + assign(char_type* __s, std::size_t __n, char_type __a) + { + // NB: Inline std::fill_n so no recursive dependencies. + std::fill_n(__s, __n, __a); + return __s; + } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#if __cplusplus > 201402 + /** + * @brief Determine whether the characters of a NULL-terminated + * string are known at compile time. + * @param __s The string. + * + * Assumes that _CharT is a built-in character type. + */ + template + static _GLIBCXX_ALWAYS_INLINE constexpr bool + __constant_string_p(const _CharT* __s) + { + while (__builtin_constant_p(*__s) && *__s) + __s++; + return __builtin_constant_p(*__s); + } + + /** + * @brief Determine whether the characters of a character array are + * known at compile time. + * @param __a The character array. + * @param __n Number of characters. + * + * Assumes that _CharT is a built-in character type. + */ + template + static _GLIBCXX_ALWAYS_INLINE constexpr bool + __constant_char_array_p(const _CharT* __a, size_t __n) + { + size_t __i = 0; + while (__builtin_constant_p(__a[__i]) && __i < __n) + __i++; + return __i == __n; + } +#endif + + // 21.1 + /** + * @brief Basis for explicit traits specializations. + * + * @note For any given actual character type, this definition is + * probably wrong. Since this is just a thin wrapper around + * __gnu_cxx::char_traits, it is possible to achieve a more + * appropriate definition by specializing __gnu_cxx::char_traits. + * + * See https://gcc.gnu.org/onlinedocs/libstdc++/manual/strings.html#strings.string.character_types + * for advice on how to make use of this class for @a unusual character + * types. Also, check out include/ext/pod_char_traits.h. + */ + template + struct char_traits : public __gnu_cxx::char_traits<_CharT> + { }; + + + /// 21.1.3.1 char_traits specializations + template<> + struct char_traits + { + typedef char char_type; + typedef int int_type; + typedef streampos pos_type; + typedef streamoff off_type; + typedef mbstate_t state_type; + + static _GLIBCXX17_CONSTEXPR void + assign(char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT + { __c1 = __c2; } + + static _GLIBCXX_CONSTEXPR bool + eq(const char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT + { return __c1 == __c2; } + + static _GLIBCXX_CONSTEXPR bool + lt(const char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT + { + // LWG 467. + return (static_cast(__c1) + < static_cast(__c2)); + } + + static _GLIBCXX17_CONSTEXPR int + compare(const char_type* __s1, const char_type* __s2, size_t __n) + { +#if __cplusplus > 201402 + if (__builtin_constant_p(__n) + && __constant_char_array_p(__s1, __n) + && __constant_char_array_p(__s2, __n)) + return __gnu_cxx::char_traits::compare(__s1, __s2, __n); +#endif + if (__n == 0) + return 0; + return __builtin_memcmp(__s1, __s2, __n); + } + + static _GLIBCXX17_CONSTEXPR size_t + length(const char_type* __s) + { +#if __cplusplus > 201402 + if (__constant_string_p(__s)) + return __gnu_cxx::char_traits::length(__s); +#endif + return __builtin_strlen(__s); + } + + static _GLIBCXX17_CONSTEXPR const char_type* + find(const char_type* __s, size_t __n, const char_type& __a) + { +#if __cplusplus > 201402 + if (__builtin_constant_p(__n) + && __builtin_constant_p(__a) + && __constant_char_array_p(__s, __n)) + return __gnu_cxx::char_traits::find(__s, __n, __a); +#endif + if (__n == 0) + return 0; + return static_cast(__builtin_memchr(__s, __a, __n)); + } + + static char_type* + move(char_type* __s1, const char_type* __s2, size_t __n) + { + if (__n == 0) + return __s1; + return static_cast(__builtin_memmove(__s1, __s2, __n)); + } + + static char_type* + copy(char_type* __s1, const char_type* __s2, size_t __n) + { + if (__n == 0) + return __s1; + return static_cast(__builtin_memcpy(__s1, __s2, __n)); + } + + static char_type* + assign(char_type* __s, size_t __n, char_type __a) + { + if (__n == 0) + return __s; + return static_cast(__builtin_memset(__s, __a, __n)); + } + + static _GLIBCXX_CONSTEXPR char_type + to_char_type(const int_type& __c) _GLIBCXX_NOEXCEPT + { return static_cast(__c); } + + // To keep both the byte 0xff and the eof symbol 0xffffffff + // from ending up as 0xffffffff. + static _GLIBCXX_CONSTEXPR int_type + to_int_type(const char_type& __c) _GLIBCXX_NOEXCEPT + { return static_cast(static_cast(__c)); } + + static _GLIBCXX_CONSTEXPR bool + eq_int_type(const int_type& __c1, const int_type& __c2) _GLIBCXX_NOEXCEPT + { return __c1 == __c2; } + + static _GLIBCXX_CONSTEXPR int_type + eof() _GLIBCXX_NOEXCEPT + { return static_cast(_GLIBCXX_STDIO_EOF); } + + static _GLIBCXX_CONSTEXPR int_type + not_eof(const int_type& __c) _GLIBCXX_NOEXCEPT + { return (__c == eof()) ? 0 : __c; } + }; + + +#ifdef _GLIBCXX_USE_WCHAR_T + /// 21.1.3.2 char_traits specializations + template<> + struct char_traits + { + typedef wchar_t char_type; + typedef wint_t int_type; + typedef streamoff off_type; + typedef wstreampos pos_type; + typedef mbstate_t state_type; + + static _GLIBCXX17_CONSTEXPR void + assign(char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT + { __c1 = __c2; } + + static _GLIBCXX_CONSTEXPR bool + eq(const char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT + { return __c1 == __c2; } + + static _GLIBCXX_CONSTEXPR bool + lt(const char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT + { return __c1 < __c2; } + + static _GLIBCXX17_CONSTEXPR int + compare(const char_type* __s1, const char_type* __s2, size_t __n) + { +#if __cplusplus > 201402 + if (__builtin_constant_p(__n) + && __constant_char_array_p(__s1, __n) + && __constant_char_array_p(__s2, __n)) + return __gnu_cxx::char_traits::compare(__s1, __s2, __n); +#endif + if (__n == 0) + return 0; + else + return wmemcmp(__s1, __s2, __n); + } + + static _GLIBCXX17_CONSTEXPR size_t + length(const char_type* __s) + { +#if __cplusplus > 201402 + if (__constant_string_p(__s)) + return __gnu_cxx::char_traits::length(__s); + else +#endif + return wcslen(__s); + } + + static _GLIBCXX17_CONSTEXPR const char_type* + find(const char_type* __s, size_t __n, const char_type& __a) + { +#if __cplusplus > 201402 + if (__builtin_constant_p(__n) + && __builtin_constant_p(__a) + && __constant_char_array_p(__s, __n)) + return __gnu_cxx::char_traits::find(__s, __n, __a); +#endif + if (__n == 0) + return 0; + else + return wmemchr(__s, __a, __n); + } + + static char_type* + move(char_type* __s1, const char_type* __s2, size_t __n) + { + if (__n == 0) + return __s1; + return wmemmove(__s1, __s2, __n); + } + + static char_type* + copy(char_type* __s1, const char_type* __s2, size_t __n) + { + if (__n == 0) + return __s1; + return wmemcpy(__s1, __s2, __n); + } + + static char_type* + assign(char_type* __s, size_t __n, char_type __a) + { + if (__n == 0) + return __s; + return wmemset(__s, __a, __n); + } + + static _GLIBCXX_CONSTEXPR char_type + to_char_type(const int_type& __c) _GLIBCXX_NOEXCEPT + { return char_type(__c); } + + static _GLIBCXX_CONSTEXPR int_type + to_int_type(const char_type& __c) _GLIBCXX_NOEXCEPT + { return int_type(__c); } + + static _GLIBCXX_CONSTEXPR bool + eq_int_type(const int_type& __c1, const int_type& __c2) _GLIBCXX_NOEXCEPT + { return __c1 == __c2; } + + static _GLIBCXX_CONSTEXPR int_type + eof() _GLIBCXX_NOEXCEPT + { return static_cast(WEOF); } + + static _GLIBCXX_CONSTEXPR int_type + not_eof(const int_type& __c) _GLIBCXX_NOEXCEPT + { return eq_int_type(__c, eof()) ? 0 : __c; } + }; +#endif //_GLIBCXX_USE_WCHAR_T + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#if ((__cplusplus >= 201103L) \ + && defined(_GLIBCXX_USE_C99_STDINT_TR1)) + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template<> + struct char_traits + { + typedef char16_t char_type; + typedef uint_least16_t int_type; + typedef streamoff off_type; + typedef u16streampos pos_type; + typedef mbstate_t state_type; + + static _GLIBCXX17_CONSTEXPR void + assign(char_type& __c1, const char_type& __c2) noexcept + { __c1 = __c2; } + + static constexpr bool + eq(const char_type& __c1, const char_type& __c2) noexcept + { return __c1 == __c2; } + + static constexpr bool + lt(const char_type& __c1, const char_type& __c2) noexcept + { return __c1 < __c2; } + + static _GLIBCXX17_CONSTEXPR int + compare(const char_type* __s1, const char_type* __s2, size_t __n) + { + for (size_t __i = 0; __i < __n; ++__i) + if (lt(__s1[__i], __s2[__i])) + return -1; + else if (lt(__s2[__i], __s1[__i])) + return 1; + return 0; + } + + static _GLIBCXX17_CONSTEXPR size_t + length(const char_type* __s) + { + size_t __i = 0; + while (!eq(__s[__i], char_type())) + ++__i; + return __i; + } + + static _GLIBCXX17_CONSTEXPR const char_type* + find(const char_type* __s, size_t __n, const char_type& __a) + { + for (size_t __i = 0; __i < __n; ++__i) + if (eq(__s[__i], __a)) + return __s + __i; + return 0; + } + + static char_type* + move(char_type* __s1, const char_type* __s2, size_t __n) + { + if (__n == 0) + return __s1; + return (static_cast + (__builtin_memmove(__s1, __s2, __n * sizeof(char_type)))); + } + + static char_type* + copy(char_type* __s1, const char_type* __s2, size_t __n) + { + if (__n == 0) + return __s1; + return (static_cast + (__builtin_memcpy(__s1, __s2, __n * sizeof(char_type)))); + } + + static char_type* + assign(char_type* __s, size_t __n, char_type __a) + { + for (size_t __i = 0; __i < __n; ++__i) + assign(__s[__i], __a); + return __s; + } + + static constexpr char_type + to_char_type(const int_type& __c) noexcept + { return char_type(__c); } + + static constexpr int_type + to_int_type(const char_type& __c) noexcept + { return int_type(__c); } + + static constexpr bool + eq_int_type(const int_type& __c1, const int_type& __c2) noexcept + { return __c1 == __c2; } + + static constexpr int_type + eof() noexcept + { return static_cast(-1); } + + static constexpr int_type + not_eof(const int_type& __c) noexcept + { return eq_int_type(__c, eof()) ? 0 : __c; } + }; + + template<> + struct char_traits + { + typedef char32_t char_type; + typedef uint_least32_t int_type; + typedef streamoff off_type; + typedef u32streampos pos_type; + typedef mbstate_t state_type; + + static _GLIBCXX17_CONSTEXPR void + assign(char_type& __c1, const char_type& __c2) noexcept + { __c1 = __c2; } + + static constexpr bool + eq(const char_type& __c1, const char_type& __c2) noexcept + { return __c1 == __c2; } + + static constexpr bool + lt(const char_type& __c1, const char_type& __c2) noexcept + { return __c1 < __c2; } + + static _GLIBCXX17_CONSTEXPR int + compare(const char_type* __s1, const char_type* __s2, size_t __n) + { + for (size_t __i = 0; __i < __n; ++__i) + if (lt(__s1[__i], __s2[__i])) + return -1; + else if (lt(__s2[__i], __s1[__i])) + return 1; + return 0; + } + + static _GLIBCXX17_CONSTEXPR size_t + length(const char_type* __s) + { + size_t __i = 0; + while (!eq(__s[__i], char_type())) + ++__i; + return __i; + } + + static _GLIBCXX17_CONSTEXPR const char_type* + find(const char_type* __s, size_t __n, const char_type& __a) + { + for (size_t __i = 0; __i < __n; ++__i) + if (eq(__s[__i], __a)) + return __s + __i; + return 0; + } + + static char_type* + move(char_type* __s1, const char_type* __s2, size_t __n) + { + if (__n == 0) + return __s1; + return (static_cast + (__builtin_memmove(__s1, __s2, __n * sizeof(char_type)))); + } + + static char_type* + copy(char_type* __s1, const char_type* __s2, size_t __n) + { + if (__n == 0) + return __s1; + return (static_cast + (__builtin_memcpy(__s1, __s2, __n * sizeof(char_type)))); + } + + static char_type* + assign(char_type* __s, size_t __n, char_type __a) + { + for (size_t __i = 0; __i < __n; ++__i) + assign(__s[__i], __a); + return __s; + } + + static constexpr char_type + to_char_type(const int_type& __c) noexcept + { return char_type(__c); } + + static constexpr int_type + to_int_type(const char_type& __c) noexcept + { return int_type(__c); } + + static constexpr bool + eq_int_type(const int_type& __c1, const int_type& __c2) noexcept + { return __c1 == __c2; } + + static constexpr int_type + eof() noexcept + { return static_cast(-1); } + + static constexpr int_type + not_eof(const int_type& __c) noexcept + { return eq_int_type(__c, eof()) ? 0 : __c; } + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif + +#endif // _CHAR_TRAITS_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/codecvt.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/codecvt.h new file mode 100644 index 0000000..fc2da32 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/codecvt.h @@ -0,0 +1,681 @@ +// Locale support (codecvt) -*- C++ -*- + +// Copyright (C) 2000-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/codecvt.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{locale} + */ + +// +// ISO C++ 14882: 22.2.1.5 Template class codecvt +// + +// Written by Benjamin Kosnik + +#ifndef _CODECVT_H +#define _CODECVT_H 1 + +#pragma GCC system_header + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /// Empty base class for codecvt facet [22.2.1.5]. + class codecvt_base + { + public: + enum result + { + ok, + partial, + error, + noconv + }; + }; + + /** + * @brief Common base for codecvt functions. + * + * This template class provides implementations of the public functions + * that forward to the protected virtual functions. + * + * This template also provides abstract stubs for the protected virtual + * functions. + */ + template + class __codecvt_abstract_base + : public locale::facet, public codecvt_base + { + public: + // Types: + typedef codecvt_base::result result; + typedef _InternT intern_type; + typedef _ExternT extern_type; + typedef _StateT state_type; + + // 22.2.1.5.1 codecvt members + /** + * @brief Convert from internal to external character set. + * + * Converts input string of intern_type to output string of + * extern_type. This is analogous to wcsrtombs. It does this by + * calling codecvt::do_out. + * + * The source and destination character sets are determined by the + * facet's locale, internal and external types. + * + * The characters in [from,from_end) are converted and written to + * [to,to_end). from_next and to_next are set to point to the + * character following the last successfully converted character, + * respectively. If the result needed no conversion, from_next and + * to_next are not affected. + * + * The @a state argument should be initialized if the input is at the + * beginning and carried from a previous call if continuing + * conversion. There are no guarantees about how @a state is used. + * + * The result returned is a member of codecvt_base::result. If + * all the input is converted, returns codecvt_base::ok. If no + * conversion is necessary, returns codecvt_base::noconv. If + * the input ends early or there is insufficient space in the + * output, returns codecvt_base::partial. Otherwise the + * conversion failed and codecvt_base::error is returned. + * + * @param __state Persistent conversion state data. + * @param __from Start of input. + * @param __from_end End of input. + * @param __from_next Returns start of unconverted data. + * @param __to Start of output buffer. + * @param __to_end End of output buffer. + * @param __to_next Returns start of unused output area. + * @return codecvt_base::result. + */ + result + out(state_type& __state, const intern_type* __from, + const intern_type* __from_end, const intern_type*& __from_next, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const + { + return this->do_out(__state, __from, __from_end, __from_next, + __to, __to_end, __to_next); + } + + /** + * @brief Reset conversion state. + * + * Writes characters to output that would restore @a state to initial + * conditions. The idea is that if a partial conversion occurs, then + * the converting the characters written by this function would leave + * the state in initial conditions, rather than partial conversion + * state. It does this by calling codecvt::do_unshift(). + * + * For example, if 4 external characters always converted to 1 internal + * character, and input to in() had 6 external characters with state + * saved, this function would write two characters to the output and + * set the state to initialized conditions. + * + * The source and destination character sets are determined by the + * facet's locale, internal and external types. + * + * The result returned is a member of codecvt_base::result. If the + * state could be reset and data written, returns codecvt_base::ok. If + * no conversion is necessary, returns codecvt_base::noconv. If the + * output has insufficient space, returns codecvt_base::partial. + * Otherwise the reset failed and codecvt_base::error is returned. + * + * @param __state Persistent conversion state data. + * @param __to Start of output buffer. + * @param __to_end End of output buffer. + * @param __to_next Returns start of unused output area. + * @return codecvt_base::result. + */ + result + unshift(state_type& __state, extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const + { return this->do_unshift(__state, __to,__to_end,__to_next); } + + /** + * @brief Convert from external to internal character set. + * + * Converts input string of extern_type to output string of + * intern_type. This is analogous to mbsrtowcs. It does this by + * calling codecvt::do_in. + * + * The source and destination character sets are determined by the + * facet's locale, internal and external types. + * + * The characters in [from,from_end) are converted and written to + * [to,to_end). from_next and to_next are set to point to the + * character following the last successfully converted character, + * respectively. If the result needed no conversion, from_next and + * to_next are not affected. + * + * The @a state argument should be initialized if the input is at the + * beginning and carried from a previous call if continuing + * conversion. There are no guarantees about how @a state is used. + * + * The result returned is a member of codecvt_base::result. If + * all the input is converted, returns codecvt_base::ok. If no + * conversion is necessary, returns codecvt_base::noconv. If + * the input ends early or there is insufficient space in the + * output, returns codecvt_base::partial. Otherwise the + * conversion failed and codecvt_base::error is returned. + * + * @param __state Persistent conversion state data. + * @param __from Start of input. + * @param __from_end End of input. + * @param __from_next Returns start of unconverted data. + * @param __to Start of output buffer. + * @param __to_end End of output buffer. + * @param __to_next Returns start of unused output area. + * @return codecvt_base::result. + */ + result + in(state_type& __state, const extern_type* __from, + const extern_type* __from_end, const extern_type*& __from_next, + intern_type* __to, intern_type* __to_end, + intern_type*& __to_next) const + { + return this->do_in(__state, __from, __from_end, __from_next, + __to, __to_end, __to_next); + } + + int + encoding() const throw() + { return this->do_encoding(); } + + bool + always_noconv() const throw() + { return this->do_always_noconv(); } + + int + length(state_type& __state, const extern_type* __from, + const extern_type* __end, size_t __max) const + { return this->do_length(__state, __from, __end, __max); } + + int + max_length() const throw() + { return this->do_max_length(); } + + protected: + explicit + __codecvt_abstract_base(size_t __refs = 0) : locale::facet(__refs) { } + + virtual + ~__codecvt_abstract_base() { } + + /** + * @brief Convert from internal to external character set. + * + * Converts input string of intern_type to output string of + * extern_type. This function is a hook for derived classes to change + * the value returned. @see out for more information. + */ + virtual result + do_out(state_type& __state, const intern_type* __from, + const intern_type* __from_end, const intern_type*& __from_next, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const = 0; + + virtual result + do_unshift(state_type& __state, extern_type* __to, + extern_type* __to_end, extern_type*& __to_next) const = 0; + + virtual result + do_in(state_type& __state, const extern_type* __from, + const extern_type* __from_end, const extern_type*& __from_next, + intern_type* __to, intern_type* __to_end, + intern_type*& __to_next) const = 0; + + virtual int + do_encoding() const throw() = 0; + + virtual bool + do_always_noconv() const throw() = 0; + + virtual int + do_length(state_type&, const extern_type* __from, + const extern_type* __end, size_t __max) const = 0; + + virtual int + do_max_length() const throw() = 0; + }; + + /** + * @brief Primary class template codecvt. + * @ingroup locales + * + * NB: Generic, mostly useless implementation. + * + */ + template + class codecvt + : public __codecvt_abstract_base<_InternT, _ExternT, _StateT> + { + public: + // Types: + typedef codecvt_base::result result; + typedef _InternT intern_type; + typedef _ExternT extern_type; + typedef _StateT state_type; + + protected: + __c_locale _M_c_locale_codecvt; + + public: + static locale::id id; + + explicit + codecvt(size_t __refs = 0) + : __codecvt_abstract_base<_InternT, _ExternT, _StateT> (__refs), + _M_c_locale_codecvt(0) + { } + + explicit + codecvt(__c_locale __cloc, size_t __refs = 0); + + protected: + virtual + ~codecvt() { } + + virtual result + do_out(state_type& __state, const intern_type* __from, + const intern_type* __from_end, const intern_type*& __from_next, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const; + + virtual result + do_unshift(state_type& __state, extern_type* __to, + extern_type* __to_end, extern_type*& __to_next) const; + + virtual result + do_in(state_type& __state, const extern_type* __from, + const extern_type* __from_end, const extern_type*& __from_next, + intern_type* __to, intern_type* __to_end, + intern_type*& __to_next) const; + + virtual int + do_encoding() const throw(); + + virtual bool + do_always_noconv() const throw(); + + virtual int + do_length(state_type&, const extern_type* __from, + const extern_type* __end, size_t __max) const; + + virtual int + do_max_length() const throw(); + }; + + template + locale::id codecvt<_InternT, _ExternT, _StateT>::id; + + /// class codecvt specialization. + template<> + class codecvt + : public __codecvt_abstract_base + { + friend class messages; + + public: + // Types: + typedef char intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + protected: + __c_locale _M_c_locale_codecvt; + + public: + static locale::id id; + + explicit + codecvt(size_t __refs = 0); + + explicit + codecvt(__c_locale __cloc, size_t __refs = 0); + + protected: + virtual + ~codecvt(); + + virtual result + do_out(state_type& __state, const intern_type* __from, + const intern_type* __from_end, const intern_type*& __from_next, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const; + + virtual result + do_unshift(state_type& __state, extern_type* __to, + extern_type* __to_end, extern_type*& __to_next) const; + + virtual result + do_in(state_type& __state, const extern_type* __from, + const extern_type* __from_end, const extern_type*& __from_next, + intern_type* __to, intern_type* __to_end, + intern_type*& __to_next) const; + + virtual int + do_encoding() const throw(); + + virtual bool + do_always_noconv() const throw(); + + virtual int + do_length(state_type&, const extern_type* __from, + const extern_type* __end, size_t __max) const; + + virtual int + do_max_length() const throw(); + }; + +#ifdef _GLIBCXX_USE_WCHAR_T + /** @brief Class codecvt specialization. + * + * Converts between narrow and wide characters in the native character set + */ + template<> + class codecvt + : public __codecvt_abstract_base + { + friend class messages; + + public: + // Types: + typedef wchar_t intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + protected: + __c_locale _M_c_locale_codecvt; + + public: + static locale::id id; + + explicit + codecvt(size_t __refs = 0); + + explicit + codecvt(__c_locale __cloc, size_t __refs = 0); + + protected: + virtual + ~codecvt(); + + virtual result + do_out(state_type& __state, const intern_type* __from, + const intern_type* __from_end, const intern_type*& __from_next, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const; + + virtual result + do_unshift(state_type& __state, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const; + + virtual result + do_in(state_type& __state, + const extern_type* __from, const extern_type* __from_end, + const extern_type*& __from_next, + intern_type* __to, intern_type* __to_end, + intern_type*& __to_next) const; + + virtual + int do_encoding() const throw(); + + virtual + bool do_always_noconv() const throw(); + + virtual + int do_length(state_type&, const extern_type* __from, + const extern_type* __end, size_t __max) const; + + virtual int + do_max_length() const throw(); + }; +#endif //_GLIBCXX_USE_WCHAR_T + +#if __cplusplus >= 201103L +#ifdef _GLIBCXX_USE_C99_STDINT_TR1 + /** @brief Class codecvt specialization. + * + * Converts between UTF-16 and UTF-8. + */ + template<> + class codecvt + : public __codecvt_abstract_base + { + public: + // Types: + typedef char16_t intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + public: + static locale::id id; + + explicit + codecvt(size_t __refs = 0) + : __codecvt_abstract_base(__refs) { } + + protected: + virtual + ~codecvt(); + + virtual result + do_out(state_type& __state, const intern_type* __from, + const intern_type* __from_end, const intern_type*& __from_next, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const; + + virtual result + do_unshift(state_type& __state, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const; + + virtual result + do_in(state_type& __state, + const extern_type* __from, const extern_type* __from_end, + const extern_type*& __from_next, + intern_type* __to, intern_type* __to_end, + intern_type*& __to_next) const; + + virtual + int do_encoding() const throw(); + + virtual + bool do_always_noconv() const throw(); + + virtual + int do_length(state_type&, const extern_type* __from, + const extern_type* __end, size_t __max) const; + + virtual int + do_max_length() const throw(); + }; + + /** @brief Class codecvt specialization. + * + * Converts between UTF-32 and UTF-8. + */ + template<> + class codecvt + : public __codecvt_abstract_base + { + public: + // Types: + typedef char32_t intern_type; + typedef char extern_type; + typedef mbstate_t state_type; + + public: + static locale::id id; + + explicit + codecvt(size_t __refs = 0) + : __codecvt_abstract_base(__refs) { } + + protected: + virtual + ~codecvt(); + + virtual result + do_out(state_type& __state, const intern_type* __from, + const intern_type* __from_end, const intern_type*& __from_next, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const; + + virtual result + do_unshift(state_type& __state, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const; + + virtual result + do_in(state_type& __state, + const extern_type* __from, const extern_type* __from_end, + const extern_type*& __from_next, + intern_type* __to, intern_type* __to_end, + intern_type*& __to_next) const; + + virtual + int do_encoding() const throw(); + + virtual + bool do_always_noconv() const throw(); + + virtual + int do_length(state_type&, const extern_type* __from, + const extern_type* __end, size_t __max) const; + + virtual int + do_max_length() const throw(); + }; + +#endif // _GLIBCXX_USE_C99_STDINT_TR1 +#endif // C++11 + + /// class codecvt_byname [22.2.1.6]. + template + class codecvt_byname : public codecvt<_InternT, _ExternT, _StateT> + { + public: + explicit + codecvt_byname(const char* __s, size_t __refs = 0) + : codecvt<_InternT, _ExternT, _StateT>(__refs) + { + if (__builtin_strcmp(__s, "C") != 0 + && __builtin_strcmp(__s, "POSIX") != 0) + { + this->_S_destroy_c_locale(this->_M_c_locale_codecvt); + this->_S_create_c_locale(this->_M_c_locale_codecvt, __s); + } + } + +#if __cplusplus >= 201103L + explicit + codecvt_byname(const string& __s, size_t __refs = 0) + : codecvt_byname(__s.c_str(), __refs) { } +#endif + + protected: + virtual + ~codecvt_byname() { } + }; + +#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99_STDINT_TR1) + template<> + class codecvt_byname + : public codecvt + { + public: + explicit + codecvt_byname(const char* __s, size_t __refs = 0) + : codecvt(__refs) { } + + explicit + codecvt_byname(const string& __s, size_t __refs = 0) + : codecvt_byname(__s.c_str(), __refs) { } + + protected: + virtual + ~codecvt_byname() { } + }; + + template<> + class codecvt_byname + : public codecvt + { + public: + explicit + codecvt_byname(const char* __s, size_t __refs = 0) + : codecvt(__refs) { } + + explicit + codecvt_byname(const string& __s, size_t __refs = 0) + : codecvt_byname(__s.c_str(), __refs) { } + + protected: + virtual + ~codecvt_byname() { } + }; +#endif + + // Inhibit implicit instantiations for required instantiations, + // which are defined via explicit instantiations elsewhere. +#if _GLIBCXX_EXTERN_TEMPLATE + extern template class codecvt_byname; + + extern template + const codecvt& + use_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); + +#ifdef _GLIBCXX_USE_WCHAR_T + extern template class codecvt_byname; + + extern template + const codecvt& + use_facet >(const locale&); + + extern template + bool + has_facet >(const locale&); +#endif + +#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99_STDINT_TR1) + extern template class codecvt_byname; + extern template class codecvt_byname; +#endif + +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // _CODECVT_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/concept_check.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/concept_check.h new file mode 100644 index 0000000..83a96f4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/concept_check.h @@ -0,0 +1,81 @@ +// Concept-checking control -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/concept_check.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iterator} + */ + +#ifndef _CONCEPT_CHECK_H +#define _CONCEPT_CHECK_H 1 + +#pragma GCC system_header + +#include + +// All places in libstdc++-v3 where these are used, or /might/ be used, or +// don't need to be used, or perhaps /should/ be used, are commented with +// "concept requirements" (and maybe some more text). So grep like crazy +// if you're looking for additional places to use these. + +// Concept-checking code is off by default unless users turn it on via +// configure options or editing c++config.h. +// It is not supported for freestanding implementations. + +#if !defined(_GLIBCXX_CONCEPT_CHECKS) || !_GLIBCXX_HOSTED + +#define __glibcxx_function_requires(...) +#define __glibcxx_class_requires(_a,_b) +#define __glibcxx_class_requires2(_a,_b,_c) +#define __glibcxx_class_requires3(_a,_b,_c,_d) +#define __glibcxx_class_requires4(_a,_b,_c,_d,_e) + +#else // the checks are on + +#include + +// Note that the obvious and elegant approach of +// +//#define glibcxx_function_requires(C) debug::function_requires< debug::C >() +// +// won't work due to concept templates with more than one parameter, e.g., +// BinaryPredicateConcept. The preprocessor tries to split things up on +// the commas in the template argument list. We can't use an inner pair of +// parenthesis to hide the commas, because "debug::(Temp)" isn't +// a valid instantiation pattern. Thus, we steal a feature from C99. + +#define __glibcxx_function_requires(...) \ + __gnu_cxx::__function_requires< __gnu_cxx::__VA_ARGS__ >(); +#define __glibcxx_class_requires(_a,_C) \ + _GLIBCXX_CLASS_REQUIRES(_a, __gnu_cxx, _C); +#define __glibcxx_class_requires2(_a,_b,_C) \ + _GLIBCXX_CLASS_REQUIRES2(_a, _b, __gnu_cxx, _C); +#define __glibcxx_class_requires3(_a,_b,_c,_C) \ + _GLIBCXX_CLASS_REQUIRES3(_a, _b, _c, __gnu_cxx, _C); +#define __glibcxx_class_requires4(_a,_b,_c,_d,_C) \ + _GLIBCXX_CLASS_REQUIRES4(_a, _b, _c, _d, __gnu_cxx, _C); + +#endif // enable/disable + +#endif // _GLIBCXX_CONCEPT_CHECK diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/cpp_type_traits.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/cpp_type_traits.h new file mode 100644 index 0000000..932360c --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/cpp_type_traits.h @@ -0,0 +1,415 @@ +// The -*- C++ -*- type traits classes for internal use in libstdc++ + +// Copyright (C) 2000-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/cpp_type_traits.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{ext/type_traits} + */ + +// Written by Gabriel Dos Reis + +#ifndef _CPP_TYPE_TRAITS_H +#define _CPP_TYPE_TRAITS_H 1 + +#pragma GCC system_header + +#include + +// +// This file provides some compile-time information about various types. +// These representations were designed, on purpose, to be constant-expressions +// and not types as found in . In particular, they +// can be used in control structures and the optimizer hopefully will do +// the obvious thing. +// +// Why integral expressions, and not functions nor types? +// Firstly, these compile-time entities are used as template-arguments +// so function return values won't work: We need compile-time entities. +// We're left with types and constant integral expressions. +// Secondly, from the point of view of ease of use, type-based compile-time +// information is -not- *that* convenient. On has to write lots of +// overloaded functions and to hope that the compiler will select the right +// one. As a net effect, the overall structure isn't very clear at first +// glance. +// Thirdly, partial ordering and overload resolution (of function templates) +// is highly costly in terms of compiler-resource. It is a Good Thing to +// keep these resource consumption as least as possible. +// +// See valarray_array.h for a case use. +// +// -- Gaby (dosreis@cmla.ens-cachan.fr) 2000-03-06. +// +// Update 2005: types are also provided and has been +// removed. +// + +extern "C++" { + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + struct __true_type { }; + struct __false_type { }; + + template + struct __truth_type + { typedef __false_type __type; }; + + template<> + struct __truth_type + { typedef __true_type __type; }; + + // N.B. The conversions to bool are needed due to the issue + // explained in c++/19404. + template + struct __traitor + { + enum { __value = bool(_Sp::__value) || bool(_Tp::__value) }; + typedef typename __truth_type<__value>::__type __type; + }; + + // Compare for equality of types. + template + struct __are_same + { + enum { __value = 0 }; + typedef __false_type __type; + }; + + template + struct __are_same<_Tp, _Tp> + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + // Holds if the template-argument is a void type. + template + struct __is_void + { + enum { __value = 0 }; + typedef __false_type __type; + }; + + template<> + struct __is_void + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + // + // Integer types + // + template + struct __is_integer + { + enum { __value = 0 }; + typedef __false_type __type; + }; + + // Thirteen specializations (yes there are eleven standard integer + // types; long long and unsigned long long are + // supported as extensions). Up to four target-specific __int + // types are supported as well. + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + +# ifdef _GLIBCXX_USE_WCHAR_T + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; +# endif + +#if __cplusplus >= 201103L + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; +#endif + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_integer + { + enum { __value = 1 }; + typedef __true_type __type; + }; + +#define __INT_N(TYPE) \ + template<> \ + struct __is_integer \ + { \ + enum { __value = 1 }; \ + typedef __true_type __type; \ + }; \ + template<> \ + struct __is_integer \ + { \ + enum { __value = 1 }; \ + typedef __true_type __type; \ + }; + +#ifdef __GLIBCXX_TYPE_INT_N_0 +__INT_N(__GLIBCXX_TYPE_INT_N_0) +#endif +#ifdef __GLIBCXX_TYPE_INT_N_1 +__INT_N(__GLIBCXX_TYPE_INT_N_1) +#endif +#ifdef __GLIBCXX_TYPE_INT_N_2 +__INT_N(__GLIBCXX_TYPE_INT_N_2) +#endif +#ifdef __GLIBCXX_TYPE_INT_N_3 +__INT_N(__GLIBCXX_TYPE_INT_N_3) +#endif + +#undef __INT_N + + // + // Floating point types + // + template + struct __is_floating + { + enum { __value = 0 }; + typedef __false_type __type; + }; + + // three specializations (float, double and 'long double') + template<> + struct __is_floating + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_floating + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_floating + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + // + // Pointer types + // + template + struct __is_pointer + { + enum { __value = 0 }; + typedef __false_type __type; + }; + + template + struct __is_pointer<_Tp*> + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + // + // An arithmetic type is an integer type or a floating point type + // + template + struct __is_arithmetic + : public __traitor<__is_integer<_Tp>, __is_floating<_Tp> > + { }; + + // + // A scalar type is an arithmetic type or a pointer type + // + template + struct __is_scalar + : public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> > + { }; + + // + // For use in std::copy and std::find overloads for streambuf iterators. + // + template + struct __is_char + { + enum { __value = 0 }; + typedef __false_type __type; + }; + + template<> + struct __is_char + { + enum { __value = 1 }; + typedef __true_type __type; + }; + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + struct __is_char + { + enum { __value = 1 }; + typedef __true_type __type; + }; +#endif + + template + struct __is_byte + { + enum { __value = 0 }; + typedef __false_type __type; + }; + + template<> + struct __is_byte + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_byte + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template<> + struct __is_byte + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + // + // Move iterator type + // + template + struct __is_move_iterator + { + enum { __value = 0 }; + typedef __false_type __type; + }; + + // Fallback implementation of the function in bits/stl_iterator.h used to + // remove the move_iterator wrapper. + template + inline _Iterator + __miter_base(_Iterator __it) + { return __it; } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace +} // extern "C++" + +#endif //_CPP_TYPE_TRAITS_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/cxxabi_forced.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/cxxabi_forced.h new file mode 100644 index 0000000..40c9a16 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/cxxabi_forced.h @@ -0,0 +1,60 @@ +// cxxabi.h subset for cancellation -*- C++ -*- + +// Copyright (C) 2007-2017 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/cxxabi_forced.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{cxxabi.h} + */ + +#ifndef _CXXABI_FORCED_H +#define _CXXABI_FORCED_H 1 + +#pragma GCC system_header + +#pragma GCC visibility push(default) + +#ifdef __cplusplus +namespace __cxxabiv1 +{ + /** + * @brief Thrown as part of forced unwinding. + * @ingroup exceptions + * + * A magic placeholder class that can be caught by reference to + * recognize forced unwinding. + */ + class __forced_unwind + { + virtual ~__forced_unwind() throw(); + + // Prevent catch by value. + virtual void __pure_dummy() = 0; + }; +} +#endif // __cplusplus + +#pragma GCC visibility pop + +#endif // __CXXABI_FORCED_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/cxxabi_init_exception.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/cxxabi_init_exception.h new file mode 100644 index 0000000..bf7b4ba --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/cxxabi_init_exception.h @@ -0,0 +1,77 @@ +// ABI Support -*- C++ -*- + +// Copyright (C) 2016-2017 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/cxxabi_init_exception.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. + */ + +#ifndef _CXXABI_INIT_EXCEPTION_H +#define _CXXABI_INIT_EXCEPTION_H 1 + +#pragma GCC system_header + +#pragma GCC visibility push(default) + +#include +#include + +#ifndef _GLIBCXX_CDTOR_CALLABI +#define _GLIBCXX_CDTOR_CALLABI +#define _GLIBCXX_HAVE_CDTOR_CALLABI 0 +#else +#define _GLIBCXX_HAVE_CDTOR_CALLABI 1 +#endif + +#ifdef __cplusplus + +namespace std +{ + class type_info; +} + +namespace __cxxabiv1 +{ + struct __cxa_refcounted_exception; + + extern "C" + { + // Allocate memory for the primary exception plus the thrown object. + void* + __cxa_allocate_exception(size_t) _GLIBCXX_NOTHROW; + + // Initialize exception (this is a GNU extension) + __cxa_refcounted_exception* + __cxa_init_primary_exception(void *object, std::type_info *tinfo, + void (_GLIBCXX_CDTOR_CALLABI *dest) (void *)) _GLIBCXX_NOTHROW; + + } +} // namespace __cxxabiv1 + +#endif + +#pragma GCC visibility pop + +#endif // _CXXABI_INIT_EXCEPTION_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/enable_special_members.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/enable_special_members.h new file mode 100644 index 0000000..2c35eb5 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/enable_special_members.h @@ -0,0 +1,312 @@ +// -*- C++ -*- + +// Copyright (C) 2013-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/enable_special_members.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. + */ + +#ifndef _ENABLE_SPECIAL_MEMBERS_H +#define _ENABLE_SPECIAL_MEMBERS_H 1 + +#pragma GCC system_header + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + struct _Enable_default_constructor_tag + { + explicit constexpr _Enable_default_constructor_tag() = default; + }; + +/** + * @brief A mixin helper to conditionally enable or disable the default + * constructor. + * @sa _Enable_special_members + */ +template + struct _Enable_default_constructor + { + constexpr _Enable_default_constructor() noexcept = default; + constexpr _Enable_default_constructor(_Enable_default_constructor const&) + noexcept = default; + constexpr _Enable_default_constructor(_Enable_default_constructor&&) + noexcept = default; + _Enable_default_constructor& + operator=(_Enable_default_constructor const&) noexcept = default; + _Enable_default_constructor& + operator=(_Enable_default_constructor&&) noexcept = default; + + // Can be used in other ctors. + constexpr explicit + _Enable_default_constructor(_Enable_default_constructor_tag) { } + }; + + +/** + * @brief A mixin helper to conditionally enable or disable the default + * destructor. + * @sa _Enable_special_members + */ +template + struct _Enable_destructor { }; + +/** + * @brief A mixin helper to conditionally enable or disable the copy/move + * special members. + * @sa _Enable_special_members + */ +template + struct _Enable_copy_move { }; + +/** + * @brief A mixin helper to conditionally enable or disable the special + * members. + * + * The @c _Tag type parameter is to make mixin bases unique and thus avoid + * ambiguities. + */ +template + struct _Enable_special_members + : private _Enable_default_constructor<_Default, _Tag>, + private _Enable_destructor<_Destructor, _Tag>, + private _Enable_copy_move<_Copy, _CopyAssignment, + _Move, _MoveAssignment, + _Tag> + { }; + +// Boilerplate follows. + +template + struct _Enable_default_constructor + { + constexpr _Enable_default_constructor() noexcept = delete; + constexpr _Enable_default_constructor(_Enable_default_constructor const&) + noexcept = default; + constexpr _Enable_default_constructor(_Enable_default_constructor&&) + noexcept = default; + _Enable_default_constructor& + operator=(_Enable_default_constructor const&) noexcept = default; + _Enable_default_constructor& + operator=(_Enable_default_constructor&&) noexcept = default; + + // Can be used in other ctors. + constexpr explicit + _Enable_default_constructor(_Enable_default_constructor_tag) { } + }; + +template + struct _Enable_destructor + { ~_Enable_destructor() noexcept = delete; }; + +template + struct _Enable_copy_move + { + constexpr _Enable_copy_move() noexcept = default; + constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = delete; + constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = default; + _Enable_copy_move& + operator=(_Enable_copy_move const&) noexcept = default; + _Enable_copy_move& + operator=(_Enable_copy_move&&) noexcept = default; + }; + +template + struct _Enable_copy_move + { + constexpr _Enable_copy_move() noexcept = default; + constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = default; + constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = default; + _Enable_copy_move& + operator=(_Enable_copy_move const&) noexcept = delete; + _Enable_copy_move& + operator=(_Enable_copy_move&&) noexcept = default; + }; + +template + struct _Enable_copy_move + { + constexpr _Enable_copy_move() noexcept = default; + constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = delete; + constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = default; + _Enable_copy_move& + operator=(_Enable_copy_move const&) noexcept = delete; + _Enable_copy_move& + operator=(_Enable_copy_move&&) noexcept = default; + }; + +template + struct _Enable_copy_move + { + constexpr _Enable_copy_move() noexcept = default; + constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = default; + constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = delete; + _Enable_copy_move& + operator=(_Enable_copy_move const&) noexcept = default; + _Enable_copy_move& + operator=(_Enable_copy_move&&) noexcept = default; + }; + +template + struct _Enable_copy_move + { + constexpr _Enable_copy_move() noexcept = default; + constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = delete; + constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = delete; + _Enable_copy_move& + operator=(_Enable_copy_move const&) noexcept = default; + _Enable_copy_move& + operator=(_Enable_copy_move&&) noexcept = default; + }; + +template + struct _Enable_copy_move + { + constexpr _Enable_copy_move() noexcept = default; + constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = default; + constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = delete; + _Enable_copy_move& + operator=(_Enable_copy_move const&) noexcept = delete; + _Enable_copy_move& + operator=(_Enable_copy_move&&) noexcept = default; + }; + +template + struct _Enable_copy_move + { + constexpr _Enable_copy_move() noexcept = default; + constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = delete; + constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = delete; + _Enable_copy_move& + operator=(_Enable_copy_move const&) noexcept = delete; + _Enable_copy_move& + operator=(_Enable_copy_move&&) noexcept = default; + }; + +template + struct _Enable_copy_move + { + constexpr _Enable_copy_move() noexcept = default; + constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = default; + constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = default; + _Enable_copy_move& + operator=(_Enable_copy_move const&) noexcept = default; + _Enable_copy_move& + operator=(_Enable_copy_move&&) noexcept = delete; + }; + +template + struct _Enable_copy_move + { + constexpr _Enable_copy_move() noexcept = default; + constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = delete; + constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = default; + _Enable_copy_move& + operator=(_Enable_copy_move const&) noexcept = default; + _Enable_copy_move& + operator=(_Enable_copy_move&&) noexcept = delete; + }; + +template + struct _Enable_copy_move + { + constexpr _Enable_copy_move() noexcept = default; + constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = default; + constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = default; + _Enable_copy_move& + operator=(_Enable_copy_move const&) noexcept = delete; + _Enable_copy_move& + operator=(_Enable_copy_move&&) noexcept = delete; + }; + +template + struct _Enable_copy_move + { + constexpr _Enable_copy_move() noexcept = default; + constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = delete; + constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = default; + _Enable_copy_move& + operator=(_Enable_copy_move const&) noexcept = delete; + _Enable_copy_move& + operator=(_Enable_copy_move&&) noexcept = delete; + }; + +template + struct _Enable_copy_move + { + constexpr _Enable_copy_move() noexcept = default; + constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = default; + constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = delete; + _Enable_copy_move& + operator=(_Enable_copy_move const&) noexcept = default; + _Enable_copy_move& + operator=(_Enable_copy_move&&) noexcept = delete; + }; + +template + struct _Enable_copy_move + { + constexpr _Enable_copy_move() noexcept = default; + constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = delete; + constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = delete; + _Enable_copy_move& + operator=(_Enable_copy_move const&) noexcept = default; + _Enable_copy_move& + operator=(_Enable_copy_move&&) noexcept = delete; + }; + +template + struct _Enable_copy_move + { + constexpr _Enable_copy_move() noexcept = default; + constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = default; + constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = delete; + _Enable_copy_move& + operator=(_Enable_copy_move const&) noexcept = delete; + _Enable_copy_move& + operator=(_Enable_copy_move&&) noexcept = delete; + }; + +template + struct _Enable_copy_move + { + constexpr _Enable_copy_move() noexcept = default; + constexpr _Enable_copy_move(_Enable_copy_move const&) noexcept = delete; + constexpr _Enable_copy_move(_Enable_copy_move&&) noexcept = delete; + _Enable_copy_move& + operator=(_Enable_copy_move const&) noexcept = delete; + _Enable_copy_move& + operator=(_Enable_copy_move&&) noexcept = delete; + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // _ENABLE_SPECIAL_MEMBERS_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/exception.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/exception.h new file mode 100644 index 0000000..bfb6a06 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/exception.h @@ -0,0 +1,78 @@ +// Exception Handling support header for -*- C++ -*- + +// Copyright (C) 2016-2017 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/exception.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. + */ + +#ifndef __EXCEPTION_H +#define __EXCEPTION_H 1 + +#pragma GCC system_header + +#pragma GCC visibility push(default) + +#include + +extern "C++" { + +namespace std +{ + /** + * @defgroup exceptions Exceptions + * @ingroup diagnostics + * + * Classes and functions for reporting errors via exception classes. + * @{ + */ + + /** + * @brief Base class for all library exceptions. + * + * This is the base class for all exceptions thrown by the standard + * library, and by certain language expressions. You are free to derive + * your own %exception classes, or use a different hierarchy, or to + * throw non-class data (e.g., fundamental types). + */ + class exception + { + public: + exception() _GLIBCXX_USE_NOEXCEPT { } + virtual ~exception() _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT; + + /** Returns a C-style character string describing the general cause + * of the current error. */ + virtual const char* + what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT; + }; + +} // namespace std + +} + +#pragma GCC visibility pop + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/exception_defines.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/exception_defines.h new file mode 100644 index 0000000..3668a37 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/exception_defines.h @@ -0,0 +1,45 @@ +// -fno-exceptions Support -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/exception_defines.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{exception} + */ + +#ifndef _EXCEPTION_DEFINES_H +#define _EXCEPTION_DEFINES_H 1 + +#if ! __cpp_exceptions +// Iff -fno-exceptions, transform error handling code to work without it. +# define __try if (true) +# define __catch(X) if (false) +# define __throw_exception_again +#else +// Else proceed normally. +# define __try try +# define __catch(X) catch(X) +# define __throw_exception_again throw +#endif + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/exception_ptr.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/exception_ptr.h new file mode 100644 index 0000000..0ece81d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/exception_ptr.h @@ -0,0 +1,224 @@ +// Exception Handling support header (exception_ptr class) for -*- C++ -*- + +// Copyright (C) 2008-2017 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/exception_ptr.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{exception} + */ + +#ifndef _EXCEPTION_PTR_H +#define _EXCEPTION_PTR_H + +#pragma GCC visibility push(default) + +#include +#include +#include +#include +#include + +extern "C++" { + +namespace std +{ + class type_info; + + /** + * @addtogroup exceptions + * @{ + */ + namespace __exception_ptr + { + class exception_ptr; + } + + using __exception_ptr::exception_ptr; + + /** Obtain an exception_ptr to the currently handled exception. If there + * is none, or the currently handled exception is foreign, return the null + * value. + */ + exception_ptr current_exception() _GLIBCXX_USE_NOEXCEPT; + + template + exception_ptr make_exception_ptr(_Ex) _GLIBCXX_USE_NOEXCEPT; + + /// Throw the object pointed to by the exception_ptr. + void rethrow_exception(exception_ptr) __attribute__ ((__noreturn__)); + + namespace __exception_ptr + { + using std::rethrow_exception; + + /** + * @brief An opaque pointer to an arbitrary exception. + * @ingroup exceptions + */ + class exception_ptr + { + void* _M_exception_object; + + explicit exception_ptr(void* __e) _GLIBCXX_USE_NOEXCEPT; + + void _M_addref() _GLIBCXX_USE_NOEXCEPT; + void _M_release() _GLIBCXX_USE_NOEXCEPT; + + void *_M_get() const _GLIBCXX_NOEXCEPT __attribute__ ((__pure__)); + + friend exception_ptr std::current_exception() _GLIBCXX_USE_NOEXCEPT; + friend void std::rethrow_exception(exception_ptr); + template + friend exception_ptr std::make_exception_ptr(_Ex) _GLIBCXX_USE_NOEXCEPT; + + public: + exception_ptr() _GLIBCXX_USE_NOEXCEPT; + + exception_ptr(const exception_ptr&) _GLIBCXX_USE_NOEXCEPT; + +#if __cplusplus >= 201103L + exception_ptr(nullptr_t) noexcept + : _M_exception_object(0) + { } + + exception_ptr(exception_ptr&& __o) noexcept + : _M_exception_object(__o._M_exception_object) + { __o._M_exception_object = 0; } +#endif + +#if (__cplusplus < 201103L) || defined (_GLIBCXX_EH_PTR_COMPAT) + typedef void (exception_ptr::*__safe_bool)(); + + // For construction from nullptr or 0. + exception_ptr(__safe_bool) _GLIBCXX_USE_NOEXCEPT; +#endif + + exception_ptr& + operator=(const exception_ptr&) _GLIBCXX_USE_NOEXCEPT; + +#if __cplusplus >= 201103L + exception_ptr& + operator=(exception_ptr&& __o) noexcept + { + exception_ptr(static_cast(__o)).swap(*this); + return *this; + } +#endif + + ~exception_ptr() _GLIBCXX_USE_NOEXCEPT; + + void + swap(exception_ptr&) _GLIBCXX_USE_NOEXCEPT; + +#ifdef _GLIBCXX_EH_PTR_COMPAT + // Retained for compatibility with CXXABI_1.3. + void _M_safe_bool_dummy() _GLIBCXX_USE_NOEXCEPT + __attribute__ ((__const__)); + bool operator!() const _GLIBCXX_USE_NOEXCEPT + __attribute__ ((__pure__)); + operator __safe_bool() const _GLIBCXX_USE_NOEXCEPT; +#endif + +#if __cplusplus >= 201103L + explicit operator bool() const + { return _M_exception_object; } +#endif + + friend bool + operator==(const exception_ptr&, const exception_ptr&) + _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__)); + + const class std::type_info* + __cxa_exception_type() const _GLIBCXX_USE_NOEXCEPT + __attribute__ ((__pure__)); + }; + + bool + operator==(const exception_ptr&, const exception_ptr&) + _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__)); + + bool + operator!=(const exception_ptr&, const exception_ptr&) + _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__)); + + inline void + swap(exception_ptr& __lhs, exception_ptr& __rhs) + { __lhs.swap(__rhs); } + + template + inline void + __dest_thunk(void* __x) + { static_cast<_Ex*>(__x)->~_Ex(); } + + } // namespace __exception_ptr + + /// Obtain an exception_ptr pointing to a copy of the supplied object. + template + exception_ptr + make_exception_ptr(_Ex __ex) _GLIBCXX_USE_NOEXCEPT + { +#if __cpp_exceptions + try + { +#if __cpp_rtti && !_GLIBCXX_HAVE_CDTOR_CALLABI + void *__e = __cxxabiv1::__cxa_allocate_exception(sizeof(_Ex)); + (void)__cxxabiv1::__cxa_init_primary_exception( + __e, const_cast(&typeid(__ex)), + __exception_ptr::__dest_thunk<_Ex>); + ::new (__e) _Ex(__ex); + return exception_ptr(__e); +#else + throw __ex; +#endif + } + catch(...) + { + return current_exception(); + } +#else + return exception_ptr(); +#endif + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 1130. copy_exception name misleading + /// Obtain an exception_ptr pointing to a copy of the supplied object. + /// This function is deprecated, use std::make_exception_ptr instead. + template + exception_ptr + copy_exception(_Ex __ex) _GLIBCXX_USE_NOEXCEPT _GLIBCXX_DEPRECATED; + + template + exception_ptr + copy_exception(_Ex __ex) _GLIBCXX_USE_NOEXCEPT + { return std::make_exception_ptr<_Ex>(__ex); } + + // @} group exceptions +} // namespace std + +} // extern "C++" + +#pragma GCC visibility pop + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/forward_list.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/forward_list.h new file mode 100644 index 0000000..c37bf01 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/forward_list.h @@ -0,0 +1,1435 @@ +// -*- C++ -*- + +// Copyright (C) 2008-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/forward_list.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{forward_list} + */ + +#ifndef _FORWARD_LIST_H +#define _FORWARD_LIST_H 1 + +#pragma GCC system_header + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_CONTAINER + + /** + * @brief A helper basic node class for %forward_list. + * This is just a linked list with nothing inside it. + * There are purely list shuffling utility methods here. + */ + struct _Fwd_list_node_base + { + _Fwd_list_node_base() = default; + + _Fwd_list_node_base* _M_next = nullptr; + + _Fwd_list_node_base* + _M_transfer_after(_Fwd_list_node_base* __begin, + _Fwd_list_node_base* __end) noexcept + { + _Fwd_list_node_base* __keep = __begin->_M_next; + if (__end) + { + __begin->_M_next = __end->_M_next; + __end->_M_next = _M_next; + } + else + __begin->_M_next = 0; + _M_next = __keep; + return __end; + } + + void + _M_reverse_after() noexcept + { + _Fwd_list_node_base* __tail = _M_next; + if (!__tail) + return; + while (_Fwd_list_node_base* __temp = __tail->_M_next) + { + _Fwd_list_node_base* __keep = _M_next; + _M_next = __temp; + __tail->_M_next = __temp->_M_next; + _M_next->_M_next = __keep; + } + } + }; + + /** + * @brief A helper node class for %forward_list. + * This is just a linked list with uninitialized storage for a + * data value in each node. + * There is a sorting utility method. + */ + template + struct _Fwd_list_node + : public _Fwd_list_node_base + { + _Fwd_list_node() = default; + + __gnu_cxx::__aligned_buffer<_Tp> _M_storage; + + _Tp* + _M_valptr() noexcept + { return _M_storage._M_ptr(); } + + const _Tp* + _M_valptr() const noexcept + { return _M_storage._M_ptr(); } + }; + + /** + * @brief A forward_list::iterator. + * + * All the functions are op overloads. + */ + template + struct _Fwd_list_iterator + { + typedef _Fwd_list_iterator<_Tp> _Self; + typedef _Fwd_list_node<_Tp> _Node; + + typedef _Tp value_type; + typedef _Tp* pointer; + typedef _Tp& reference; + typedef ptrdiff_t difference_type; + typedef std::forward_iterator_tag iterator_category; + + _Fwd_list_iterator() noexcept + : _M_node() { } + + explicit + _Fwd_list_iterator(_Fwd_list_node_base* __n) noexcept + : _M_node(__n) { } + + reference + operator*() const noexcept + { return *static_cast<_Node*>(this->_M_node)->_M_valptr(); } + + pointer + operator->() const noexcept + { return static_cast<_Node*>(this->_M_node)->_M_valptr(); } + + _Self& + operator++() noexcept + { + _M_node = _M_node->_M_next; + return *this; + } + + _Self + operator++(int) noexcept + { + _Self __tmp(*this); + _M_node = _M_node->_M_next; + return __tmp; + } + + bool + operator==(const _Self& __x) const noexcept + { return _M_node == __x._M_node; } + + bool + operator!=(const _Self& __x) const noexcept + { return _M_node != __x._M_node; } + + _Self + _M_next() const noexcept + { + if (_M_node) + return _Fwd_list_iterator(_M_node->_M_next); + else + return _Fwd_list_iterator(0); + } + + _Fwd_list_node_base* _M_node; + }; + + /** + * @brief A forward_list::const_iterator. + * + * All the functions are op overloads. + */ + template + struct _Fwd_list_const_iterator + { + typedef _Fwd_list_const_iterator<_Tp> _Self; + typedef const _Fwd_list_node<_Tp> _Node; + typedef _Fwd_list_iterator<_Tp> iterator; + + typedef _Tp value_type; + typedef const _Tp* pointer; + typedef const _Tp& reference; + typedef ptrdiff_t difference_type; + typedef std::forward_iterator_tag iterator_category; + + _Fwd_list_const_iterator() noexcept + : _M_node() { } + + explicit + _Fwd_list_const_iterator(const _Fwd_list_node_base* __n) noexcept + : _M_node(__n) { } + + _Fwd_list_const_iterator(const iterator& __iter) noexcept + : _M_node(__iter._M_node) { } + + reference + operator*() const noexcept + { return *static_cast<_Node*>(this->_M_node)->_M_valptr(); } + + pointer + operator->() const noexcept + { return static_cast<_Node*>(this->_M_node)->_M_valptr(); } + + _Self& + operator++() noexcept + { + _M_node = _M_node->_M_next; + return *this; + } + + _Self + operator++(int) noexcept + { + _Self __tmp(*this); + _M_node = _M_node->_M_next; + return __tmp; + } + + bool + operator==(const _Self& __x) const noexcept + { return _M_node == __x._M_node; } + + bool + operator!=(const _Self& __x) const noexcept + { return _M_node != __x._M_node; } + + _Self + _M_next() const noexcept + { + if (this->_M_node) + return _Fwd_list_const_iterator(_M_node->_M_next); + else + return _Fwd_list_const_iterator(0); + } + + const _Fwd_list_node_base* _M_node; + }; + + /** + * @brief Forward list iterator equality comparison. + */ + template + inline bool + operator==(const _Fwd_list_iterator<_Tp>& __x, + const _Fwd_list_const_iterator<_Tp>& __y) noexcept + { return __x._M_node == __y._M_node; } + + /** + * @brief Forward list iterator inequality comparison. + */ + template + inline bool + operator!=(const _Fwd_list_iterator<_Tp>& __x, + const _Fwd_list_const_iterator<_Tp>& __y) noexcept + { return __x._M_node != __y._M_node; } + + /** + * @brief Base class for %forward_list. + */ + template + struct _Fwd_list_base + { + protected: + typedef __alloc_rebind<_Alloc, _Tp> _Tp_alloc_type; + typedef __alloc_rebind<_Alloc, _Fwd_list_node<_Tp>> _Node_alloc_type; + typedef __gnu_cxx::__alloc_traits<_Node_alloc_type> _Node_alloc_traits; + + struct _Fwd_list_impl + : public _Node_alloc_type + { + _Fwd_list_node_base _M_head; + + _Fwd_list_impl() + : _Node_alloc_type(), _M_head() + { } + + _Fwd_list_impl(const _Node_alloc_type& __a) + : _Node_alloc_type(__a), _M_head() + { } + + _Fwd_list_impl(_Node_alloc_type&& __a) + : _Node_alloc_type(std::move(__a)), _M_head() + { } + }; + + _Fwd_list_impl _M_impl; + + public: + typedef _Fwd_list_iterator<_Tp> iterator; + typedef _Fwd_list_const_iterator<_Tp> const_iterator; + typedef _Fwd_list_node<_Tp> _Node; + + _Node_alloc_type& + _M_get_Node_allocator() noexcept + { return this->_M_impl; } + + const _Node_alloc_type& + _M_get_Node_allocator() const noexcept + { return this->_M_impl; } + + _Fwd_list_base() + : _M_impl() { } + + _Fwd_list_base(_Node_alloc_type&& __a) + : _M_impl(std::move(__a)) { } + + _Fwd_list_base(_Fwd_list_base&& __lst, _Node_alloc_type&& __a); + + _Fwd_list_base(_Fwd_list_base&& __lst) + : _M_impl(std::move(__lst._M_get_Node_allocator())) + { + this->_M_impl._M_head._M_next = __lst._M_impl._M_head._M_next; + __lst._M_impl._M_head._M_next = 0; + } + + ~_Fwd_list_base() + { _M_erase_after(&_M_impl._M_head, 0); } + + protected: + + _Node* + _M_get_node() + { + auto __ptr = _Node_alloc_traits::allocate(_M_get_Node_allocator(), 1); + return std::__addressof(*__ptr); + } + + template + _Node* + _M_create_node(_Args&&... __args) + { + _Node* __node = this->_M_get_node(); + __try + { + _Tp_alloc_type __a(_M_get_Node_allocator()); + typedef allocator_traits<_Tp_alloc_type> _Alloc_traits; + ::new ((void*)__node) _Node; + _Alloc_traits::construct(__a, __node->_M_valptr(), + std::forward<_Args>(__args)...); + } + __catch(...) + { + this->_M_put_node(__node); + __throw_exception_again; + } + return __node; + } + + template + _Fwd_list_node_base* + _M_insert_after(const_iterator __pos, _Args&&... __args); + + void + _M_put_node(_Node* __p) + { + typedef typename _Node_alloc_traits::pointer _Ptr; + auto __ptr = std::pointer_traits<_Ptr>::pointer_to(*__p); + _Node_alloc_traits::deallocate(_M_get_Node_allocator(), __ptr, 1); + } + + _Fwd_list_node_base* + _M_erase_after(_Fwd_list_node_base* __pos); + + _Fwd_list_node_base* + _M_erase_after(_Fwd_list_node_base* __pos, + _Fwd_list_node_base* __last); + }; + + /** + * @brief A standard container with linear time access to elements, + * and fixed time insertion/deletion at any point in the sequence. + * + * @ingroup sequences + * + * @tparam _Tp Type of element. + * @tparam _Alloc Allocator type, defaults to allocator<_Tp>. + * + * Meets the requirements of a container, a + * sequence, including the + * optional sequence requirements with the + * %exception of @c at and @c operator[]. + * + * This is a @e singly @e linked %list. Traversal up the + * %list requires linear time, but adding and removing elements (or + * @e nodes) is done in constant time, regardless of where the + * change takes place. Unlike std::vector and std::deque, + * random-access iterators are not provided, so subscripting ( @c + * [] ) access is not allowed. For algorithms which only need + * sequential access, this lack makes no difference. + * + * Also unlike the other standard containers, std::forward_list provides + * specialized algorithms %unique to linked lists, such as + * splicing, sorting, and in-place reversal. + */ + template > + class forward_list : private _Fwd_list_base<_Tp, _Alloc> + { + private: + typedef _Fwd_list_base<_Tp, _Alloc> _Base; + typedef _Fwd_list_node<_Tp> _Node; + typedef _Fwd_list_node_base _Node_base; + typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; + typedef typename _Base::_Node_alloc_type _Node_alloc_type; + typedef typename _Base::_Node_alloc_traits _Node_alloc_traits; + typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Alloc_traits; + + public: + // types: + typedef _Tp value_type; + typedef typename _Alloc_traits::pointer pointer; + typedef typename _Alloc_traits::const_pointer const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + + typedef _Fwd_list_iterator<_Tp> iterator; + typedef _Fwd_list_const_iterator<_Tp> const_iterator; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + typedef _Alloc allocator_type; + + // 23.3.4.2 construct/copy/destroy: + + /** + * @brief Creates a %forward_list with no elements. + */ + forward_list() + noexcept(is_nothrow_default_constructible<_Node_alloc_type>::value) + : _Base() + { } + + /** + * @brief Creates a %forward_list with no elements. + * @param __al An allocator object. + */ + explicit + forward_list(const _Alloc& __al) noexcept + : _Base(_Node_alloc_type(__al)) + { } + + + /** + * @brief Copy constructor with allocator argument. + * @param __list Input list to copy. + * @param __al An allocator object. + */ + forward_list(const forward_list& __list, const _Alloc& __al) + : _Base(_Node_alloc_type(__al)) + { _M_range_initialize(__list.begin(), __list.end()); } + + /** + * @brief Move constructor with allocator argument. + * @param __list Input list to move. + * @param __al An allocator object. + */ + forward_list(forward_list&& __list, const _Alloc& __al) + noexcept(_Node_alloc_traits::_S_always_equal()) + : _Base(std::move(__list), _Node_alloc_type(__al)) + { + // If __list is not empty it means its allocator is not equal to __a, + // so we need to move from each element individually. + insert_after(cbefore_begin(), + std::__make_move_if_noexcept_iterator(__list.begin()), + std::__make_move_if_noexcept_iterator(__list.end())); + } + + /** + * @brief Creates a %forward_list with default constructed elements. + * @param __n The number of elements to initially create. + * @param __al An allocator object. + * + * This constructor creates the %forward_list with @a __n default + * constructed elements. + */ + explicit + forward_list(size_type __n, const _Alloc& __al = _Alloc()) + : _Base(_Node_alloc_type(__al)) + { _M_default_initialize(__n); } + + /** + * @brief Creates a %forward_list with copies of an exemplar element. + * @param __n The number of elements to initially create. + * @param __value An element to copy. + * @param __al An allocator object. + * + * This constructor fills the %forward_list with @a __n copies of + * @a __value. + */ + forward_list(size_type __n, const _Tp& __value, + const _Alloc& __al = _Alloc()) + : _Base(_Node_alloc_type(__al)) + { _M_fill_initialize(__n, __value); } + + /** + * @brief Builds a %forward_list from a range. + * @param __first An input iterator. + * @param __last An input iterator. + * @param __al An allocator object. + * + * Create a %forward_list consisting of copies of the elements from + * [@a __first,@a __last). This is linear in N (where N is + * distance(@a __first,@a __last)). + */ + template> + forward_list(_InputIterator __first, _InputIterator __last, + const _Alloc& __al = _Alloc()) + : _Base(_Node_alloc_type(__al)) + { _M_range_initialize(__first, __last); } + + /** + * @brief The %forward_list copy constructor. + * @param __list A %forward_list of identical element and allocator + * types. + */ + forward_list(const forward_list& __list) + : _Base(_Node_alloc_traits::_S_select_on_copy( + __list._M_get_Node_allocator())) + { _M_range_initialize(__list.begin(), __list.end()); } + + /** + * @brief The %forward_list move constructor. + * @param __list A %forward_list of identical element and allocator + * types. + * + * The newly-created %forward_list contains the exact contents of @a + * __list. The contents of @a __list are a valid, but unspecified + * %forward_list. + */ + forward_list(forward_list&& __list) noexcept + : _Base(std::move(__list)) { } + + /** + * @brief Builds a %forward_list from an initializer_list + * @param __il An initializer_list of value_type. + * @param __al An allocator object. + * + * Create a %forward_list consisting of copies of the elements + * in the initializer_list @a __il. This is linear in __il.size(). + */ + forward_list(std::initializer_list<_Tp> __il, + const _Alloc& __al = _Alloc()) + : _Base(_Node_alloc_type(__al)) + { _M_range_initialize(__il.begin(), __il.end()); } + + /** + * @brief The forward_list dtor. + */ + ~forward_list() noexcept + { } + + /** + * @brief The %forward_list assignment operator. + * @param __list A %forward_list of identical element and allocator + * types. + * + * All the elements of @a __list are copied. + * + * Whether the allocator is copied depends on the allocator traits. + */ + forward_list& + operator=(const forward_list& __list); + + /** + * @brief The %forward_list move assignment operator. + * @param __list A %forward_list of identical element and allocator + * types. + * + * The contents of @a __list are moved into this %forward_list + * (without copying, if the allocators permit it). + * + * Afterwards @a __list is a valid, but unspecified %forward_list + * + * Whether the allocator is moved depends on the allocator traits. + */ + forward_list& + operator=(forward_list&& __list) + noexcept(_Node_alloc_traits::_S_nothrow_move()) + { + constexpr bool __move_storage = + _Node_alloc_traits::_S_propagate_on_move_assign() + || _Node_alloc_traits::_S_always_equal(); + _M_move_assign(std::move(__list), __bool_constant<__move_storage>()); + return *this; + } + + /** + * @brief The %forward_list initializer list assignment operator. + * @param __il An initializer_list of value_type. + * + * Replace the contents of the %forward_list with copies of the + * elements in the initializer_list @a __il. This is linear in + * __il.size(). + */ + forward_list& + operator=(std::initializer_list<_Tp> __il) + { + assign(__il); + return *this; + } + + /** + * @brief Assigns a range to a %forward_list. + * @param __first An input iterator. + * @param __last An input iterator. + * + * This function fills a %forward_list with copies of the elements + * in the range [@a __first,@a __last). + * + * Note that the assignment completely changes the %forward_list and + * that the number of elements of the resulting %forward_list is the + * same as the number of elements assigned. + */ + template> + void + assign(_InputIterator __first, _InputIterator __last) + { + typedef is_assignable<_Tp, decltype(*__first)> __assignable; + _M_assign(__first, __last, __assignable()); + } + + /** + * @brief Assigns a given value to a %forward_list. + * @param __n Number of elements to be assigned. + * @param __val Value to be assigned. + * + * This function fills a %forward_list with @a __n copies of the + * given value. Note that the assignment completely changes the + * %forward_list, and that the resulting %forward_list has __n + * elements. + */ + void + assign(size_type __n, const _Tp& __val) + { _M_assign_n(__n, __val, is_copy_assignable<_Tp>()); } + + /** + * @brief Assigns an initializer_list to a %forward_list. + * @param __il An initializer_list of value_type. + * + * Replace the contents of the %forward_list with copies of the + * elements in the initializer_list @a __il. This is linear in + * il.size(). + */ + void + assign(std::initializer_list<_Tp> __il) + { assign(__il.begin(), __il.end()); } + + /// Get a copy of the memory allocation object. + allocator_type + get_allocator() const noexcept + { return allocator_type(this->_M_get_Node_allocator()); } + + // 23.3.4.3 iterators: + + /** + * Returns a read/write iterator that points before the first element + * in the %forward_list. Iteration is done in ordinary element order. + */ + iterator + before_begin() noexcept + { return iterator(&this->_M_impl._M_head); } + + /** + * Returns a read-only (constant) iterator that points before the + * first element in the %forward_list. Iteration is done in ordinary + * element order. + */ + const_iterator + before_begin() const noexcept + { return const_iterator(&this->_M_impl._M_head); } + + /** + * Returns a read/write iterator that points to the first element + * in the %forward_list. Iteration is done in ordinary element order. + */ + iterator + begin() noexcept + { return iterator(this->_M_impl._M_head._M_next); } + + /** + * Returns a read-only (constant) iterator that points to the first + * element in the %forward_list. Iteration is done in ordinary + * element order. + */ + const_iterator + begin() const noexcept + { return const_iterator(this->_M_impl._M_head._M_next); } + + /** + * Returns a read/write iterator that points one past the last + * element in the %forward_list. Iteration is done in ordinary + * element order. + */ + iterator + end() noexcept + { return iterator(0); } + + /** + * Returns a read-only iterator that points one past the last + * element in the %forward_list. Iteration is done in ordinary + * element order. + */ + const_iterator + end() const noexcept + { return const_iterator(0); } + + /** + * Returns a read-only (constant) iterator that points to the + * first element in the %forward_list. Iteration is done in ordinary + * element order. + */ + const_iterator + cbegin() const noexcept + { return const_iterator(this->_M_impl._M_head._M_next); } + + /** + * Returns a read-only (constant) iterator that points before the + * first element in the %forward_list. Iteration is done in ordinary + * element order. + */ + const_iterator + cbefore_begin() const noexcept + { return const_iterator(&this->_M_impl._M_head); } + + /** + * Returns a read-only (constant) iterator that points one past + * the last element in the %forward_list. Iteration is done in + * ordinary element order. + */ + const_iterator + cend() const noexcept + { return const_iterator(0); } + + /** + * Returns true if the %forward_list is empty. (Thus begin() would + * equal end().) + */ + bool + empty() const noexcept + { return this->_M_impl._M_head._M_next == 0; } + + /** + * Returns the largest possible number of elements of %forward_list. + */ + size_type + max_size() const noexcept + { return _Node_alloc_traits::max_size(this->_M_get_Node_allocator()); } + + // 23.3.4.4 element access: + + /** + * Returns a read/write reference to the data at the first + * element of the %forward_list. + */ + reference + front() + { + _Node* __front = static_cast<_Node*>(this->_M_impl._M_head._M_next); + return *__front->_M_valptr(); + } + + /** + * Returns a read-only (constant) reference to the data at the first + * element of the %forward_list. + */ + const_reference + front() const + { + _Node* __front = static_cast<_Node*>(this->_M_impl._M_head._M_next); + return *__front->_M_valptr(); + } + + // 23.3.4.5 modiï¬ers: + + /** + * @brief Constructs object in %forward_list at the front of the + * list. + * @param __args Arguments. + * + * This function will insert an object of type Tp constructed + * with Tp(std::forward(args)...) at the front of the list + * Due to the nature of a %forward_list this operation can + * be done in constant time, and does not invalidate iterators + * and references. + */ + template +#if __cplusplus > 201402L + reference +#else + void +#endif + emplace_front(_Args&&... __args) + { + this->_M_insert_after(cbefore_begin(), + std::forward<_Args>(__args)...); +#if __cplusplus > 201402L + return front(); +#endif + } + + /** + * @brief Add data to the front of the %forward_list. + * @param __val Data to be added. + * + * This is a typical stack operation. The function creates an + * element at the front of the %forward_list and assigns the given + * data to it. Due to the nature of a %forward_list this operation + * can be done in constant time, and does not invalidate iterators + * and references. + */ + void + push_front(const _Tp& __val) + { this->_M_insert_after(cbefore_begin(), __val); } + + /** + * + */ + void + push_front(_Tp&& __val) + { this->_M_insert_after(cbefore_begin(), std::move(__val)); } + + /** + * @brief Removes first element. + * + * This is a typical stack operation. It shrinks the %forward_list + * by one. Due to the nature of a %forward_list this operation can + * be done in constant time, and only invalidates iterators/references + * to the element being removed. + * + * Note that no data is returned, and if the first element's data + * is needed, it should be retrieved before pop_front() is + * called. + */ + void + pop_front() + { this->_M_erase_after(&this->_M_impl._M_head); } + + /** + * @brief Constructs object in %forward_list after the specified + * iterator. + * @param __pos A const_iterator into the %forward_list. + * @param __args Arguments. + * @return An iterator that points to the inserted data. + * + * This function will insert an object of type T constructed + * with T(std::forward(args)...) after the specified + * location. Due to the nature of a %forward_list this operation can + * be done in constant time, and does not invalidate iterators + * and references. + */ + template + iterator + emplace_after(const_iterator __pos, _Args&&... __args) + { return iterator(this->_M_insert_after(__pos, + std::forward<_Args>(__args)...)); } + + /** + * @brief Inserts given value into %forward_list after specified + * iterator. + * @param __pos An iterator into the %forward_list. + * @param __val Data to be inserted. + * @return An iterator that points to the inserted data. + * + * This function will insert a copy of the given value after + * the specified location. Due to the nature of a %forward_list this + * operation can be done in constant time, and does not + * invalidate iterators and references. + */ + iterator + insert_after(const_iterator __pos, const _Tp& __val) + { return iterator(this->_M_insert_after(__pos, __val)); } + + /** + * + */ + iterator + insert_after(const_iterator __pos, _Tp&& __val) + { return iterator(this->_M_insert_after(__pos, std::move(__val))); } + + /** + * @brief Inserts a number of copies of given data into the + * %forward_list. + * @param __pos An iterator into the %forward_list. + * @param __n Number of elements to be inserted. + * @param __val Data to be inserted. + * @return An iterator pointing to the last inserted copy of + * @a val or @a pos if @a n == 0. + * + * This function will insert a specified number of copies of the + * given data after the location specified by @a pos. + * + * This operation is linear in the number of elements inserted and + * does not invalidate iterators and references. + */ + iterator + insert_after(const_iterator __pos, size_type __n, const _Tp& __val); + + /** + * @brief Inserts a range into the %forward_list. + * @param __pos An iterator into the %forward_list. + * @param __first An input iterator. + * @param __last An input iterator. + * @return An iterator pointing to the last inserted element or + * @a __pos if @a __first == @a __last. + * + * This function will insert copies of the data in the range + * [@a __first,@a __last) into the %forward_list after the + * location specified by @a __pos. + * + * This operation is linear in the number of elements inserted and + * does not invalidate iterators and references. + */ + template> + iterator + insert_after(const_iterator __pos, + _InputIterator __first, _InputIterator __last); + + /** + * @brief Inserts the contents of an initializer_list into + * %forward_list after the specified iterator. + * @param __pos An iterator into the %forward_list. + * @param __il An initializer_list of value_type. + * @return An iterator pointing to the last inserted element + * or @a __pos if @a __il is empty. + * + * This function will insert copies of the data in the + * initializer_list @a __il into the %forward_list before the location + * specified by @a __pos. + * + * This operation is linear in the number of elements inserted and + * does not invalidate iterators and references. + */ + iterator + insert_after(const_iterator __pos, std::initializer_list<_Tp> __il) + { return insert_after(__pos, __il.begin(), __il.end()); } + + /** + * @brief Removes the element pointed to by the iterator following + * @c pos. + * @param __pos Iterator pointing before element to be erased. + * @return An iterator pointing to the element following the one + * that was erased, or end() if no such element exists. + * + * This function will erase the element at the given position and + * thus shorten the %forward_list by one. + * + * Due to the nature of a %forward_list this operation can be done + * in constant time, and only invalidates iterators/references to + * the element being removed. The user is also cautioned that + * this function only erases the element, and that if the element + * is itself a pointer, the pointed-to memory is not touched in + * any way. Managing the pointer is the user's responsibility. + */ + iterator + erase_after(const_iterator __pos) + { return iterator(this->_M_erase_after(const_cast<_Node_base*> + (__pos._M_node))); } + + /** + * @brief Remove a range of elements. + * @param __pos Iterator pointing before the first element to be + * erased. + * @param __last Iterator pointing to one past the last element to be + * erased. + * @return @ __last. + * + * This function will erase the elements in the range + * @a (__pos,__last) and shorten the %forward_list accordingly. + * + * This operation is linear time in the size of the range and only + * invalidates iterators/references to the element being removed. + * The user is also cautioned that this function only erases the + * elements, and that if the elements themselves are pointers, the + * pointed-to memory is not touched in any way. Managing the pointer + * is the user's responsibility. + */ + iterator + erase_after(const_iterator __pos, const_iterator __last) + { return iterator(this->_M_erase_after(const_cast<_Node_base*> + (__pos._M_node), + const_cast<_Node_base*> + (__last._M_node))); } + + /** + * @brief Swaps data with another %forward_list. + * @param __list A %forward_list of the same element and allocator + * types. + * + * This exchanges the elements between two lists in constant + * time. Note that the global std::swap() function is + * specialized such that std::swap(l1,l2) will feed to this + * function. + * + * Whether the allocators are swapped depends on the allocator traits. + */ + void + swap(forward_list& __list) noexcept + { + std::swap(this->_M_impl._M_head._M_next, + __list._M_impl._M_head._M_next); + _Node_alloc_traits::_S_on_swap(this->_M_get_Node_allocator(), + __list._M_get_Node_allocator()); + } + + /** + * @brief Resizes the %forward_list to the specified number of + * elements. + * @param __sz Number of elements the %forward_list should contain. + * + * This function will %resize the %forward_list to the specified + * number of elements. If the number is smaller than the + * %forward_list's current number of elements the %forward_list + * is truncated, otherwise the %forward_list is extended and the + * new elements are default constructed. + */ + void + resize(size_type __sz); + + /** + * @brief Resizes the %forward_list to the specified number of + * elements. + * @param __sz Number of elements the %forward_list should contain. + * @param __val Data with which new elements should be populated. + * + * This function will %resize the %forward_list to the specified + * number of elements. If the number is smaller than the + * %forward_list's current number of elements the %forward_list + * is truncated, otherwise the %forward_list is extended and new + * elements are populated with given data. + */ + void + resize(size_type __sz, const value_type& __val); + + /** + * @brief Erases all the elements. + * + * Note that this function only erases + * the elements, and that if the elements themselves are + * pointers, the pointed-to memory is not touched in any way. + * Managing the pointer is the user's responsibility. + */ + void + clear() noexcept + { this->_M_erase_after(&this->_M_impl._M_head, 0); } + + // 23.3.4.6 forward_list operations: + + /** + * @brief Insert contents of another %forward_list. + * @param __pos Iterator referencing the element to insert after. + * @param __list Source list. + * + * The elements of @a list are inserted in constant time after + * the element referenced by @a pos. @a list becomes an empty + * list. + * + * Requires this != @a x. + */ + void + splice_after(const_iterator __pos, forward_list&& __list) noexcept + { + if (!__list.empty()) + _M_splice_after(__pos, __list.before_begin(), __list.end()); + } + + void + splice_after(const_iterator __pos, forward_list& __list) noexcept + { splice_after(__pos, std::move(__list)); } + + /** + * @brief Insert element from another %forward_list. + * @param __pos Iterator referencing the element to insert after. + * @param __list Source list. + * @param __i Iterator referencing the element before the element + * to move. + * + * Removes the element in list @a list referenced by @a i and + * inserts it into the current list after @a pos. + */ + void + splice_after(const_iterator __pos, forward_list&& __list, + const_iterator __i) noexcept; + + void + splice_after(const_iterator __pos, forward_list& __list, + const_iterator __i) noexcept + { splice_after(__pos, std::move(__list), __i); } + + /** + * @brief Insert range from another %forward_list. + * @param __pos Iterator referencing the element to insert after. + * @param __list Source list. + * @param __before Iterator referencing before the start of range + * in list. + * @param __last Iterator referencing the end of range in list. + * + * Removes elements in the range (__before,__last) and inserts them + * after @a __pos in constant time. + * + * Undefined if @a __pos is in (__before,__last). + * @{ + */ + void + splice_after(const_iterator __pos, forward_list&&, + const_iterator __before, const_iterator __last) noexcept + { _M_splice_after(__pos, __before, __last); } + + void + splice_after(const_iterator __pos, forward_list&, + const_iterator __before, const_iterator __last) noexcept + { _M_splice_after(__pos, __before, __last); } + // @} + + /** + * @brief Remove all elements equal to value. + * @param __val The value to remove. + * + * Removes every element in the list equal to @a __val. + * Remaining elements stay in list order. Note that this + * function only erases the elements, and that if the elements + * themselves are pointers, the pointed-to memory is not + * touched in any way. Managing the pointer is the user's + * responsibility. + */ + void + remove(const _Tp& __val); + + /** + * @brief Remove all elements satisfying a predicate. + * @param __pred Unary predicate function or object. + * + * Removes every element in the list for which the predicate + * returns true. Remaining elements stay in list order. Note + * that this function only erases the elements, and that if the + * elements themselves are pointers, the pointed-to memory is + * not touched in any way. Managing the pointer is the user's + * responsibility. + */ + template + void + remove_if(_Pred __pred); + + /** + * @brief Remove consecutive duplicate elements. + * + * For each consecutive set of elements with the same value, + * remove all but the first one. Remaining elements stay in + * list order. Note that this function only erases the + * elements, and that if the elements themselves are pointers, + * the pointed-to memory is not touched in any way. Managing + * the pointer is the user's responsibility. + */ + void + unique() + { unique(std::equal_to<_Tp>()); } + + /** + * @brief Remove consecutive elements satisfying a predicate. + * @param __binary_pred Binary predicate function or object. + * + * For each consecutive set of elements [first,last) that + * satisfy predicate(first,i) where i is an iterator in + * [first,last), remove all but the first one. Remaining + * elements stay in list order. Note that this function only + * erases the elements, and that if the elements themselves are + * pointers, the pointed-to memory is not touched in any way. + * Managing the pointer is the user's responsibility. + */ + template + void + unique(_BinPred __binary_pred); + + /** + * @brief Merge sorted lists. + * @param __list Sorted list to merge. + * + * Assumes that both @a list and this list are sorted according to + * operator<(). Merges elements of @a __list into this list in + * sorted order, leaving @a __list empty when complete. Elements in + * this list precede elements in @a __list that are equal. + */ + void + merge(forward_list&& __list) + { merge(std::move(__list), std::less<_Tp>()); } + + void + merge(forward_list& __list) + { merge(std::move(__list)); } + + /** + * @brief Merge sorted lists according to comparison function. + * @param __list Sorted list to merge. + * @param __comp Comparison function defining sort order. + * + * Assumes that both @a __list and this list are sorted according to + * comp. Merges elements of @a __list into this list + * in sorted order, leaving @a __list empty when complete. Elements + * in this list precede elements in @a __list that are equivalent + * according to comp(). + */ + template + void + merge(forward_list&& __list, _Comp __comp); + + template + void + merge(forward_list& __list, _Comp __comp) + { merge(std::move(__list), __comp); } + + /** + * @brief Sort the elements of the list. + * + * Sorts the elements of this list in NlogN time. Equivalent + * elements remain in list order. + */ + void + sort() + { sort(std::less<_Tp>()); } + + /** + * @brief Sort the forward_list using a comparison function. + * + * Sorts the elements of this list in NlogN time. Equivalent + * elements remain in list order. + */ + template + void + sort(_Comp __comp); + + /** + * @brief Reverse the elements in list. + * + * Reverse the order of elements in the list in linear time. + */ + void + reverse() noexcept + { this->_M_impl._M_head._M_reverse_after(); } + + private: + // Called by the range constructor to implement [23.3.4.2]/9 + template + void + _M_range_initialize(_InputIterator __first, _InputIterator __last); + + // Called by forward_list(n,v,a), and the range constructor when it + // turns out to be the same thing. + void + _M_fill_initialize(size_type __n, const value_type& __value); + + // Called by splice_after and insert_after. + iterator + _M_splice_after(const_iterator __pos, const_iterator __before, + const_iterator __last); + + // Called by forward_list(n). + void + _M_default_initialize(size_type __n); + + // Called by resize(sz). + void + _M_default_insert_after(const_iterator __pos, size_type __n); + + // Called by operator=(forward_list&&) + void + _M_move_assign(forward_list&& __list, std::true_type) noexcept + { + clear(); + this->_M_impl._M_head._M_next = __list._M_impl._M_head._M_next; + __list._M_impl._M_head._M_next = nullptr; + std::__alloc_on_move(this->_M_get_Node_allocator(), + __list._M_get_Node_allocator()); + } + + // Called by operator=(forward_list&&) + void + _M_move_assign(forward_list&& __list, std::false_type) + { + if (__list._M_get_Node_allocator() == this->_M_get_Node_allocator()) + _M_move_assign(std::move(__list), std::true_type()); + else + // The rvalue's allocator cannot be moved, or is not equal, + // so we need to individually move each element. + this->assign(std::__make_move_if_noexcept_iterator(__list.begin()), + std::__make_move_if_noexcept_iterator(__list.end())); + } + + // Called by assign(_InputIterator, _InputIterator) if _Tp is + // CopyAssignable. + template + void + _M_assign(_InputIterator __first, _InputIterator __last, true_type) + { + auto __prev = before_begin(); + auto __curr = begin(); + auto __end = end(); + while (__curr != __end && __first != __last) + { + *__curr = *__first; + ++__prev; + ++__curr; + ++__first; + } + if (__first != __last) + insert_after(__prev, __first, __last); + else if (__curr != __end) + erase_after(__prev, __end); + } + + // Called by assign(_InputIterator, _InputIterator) if _Tp is not + // CopyAssignable. + template + void + _M_assign(_InputIterator __first, _InputIterator __last, false_type) + { + clear(); + insert_after(cbefore_begin(), __first, __last); + } + + // Called by assign(size_type, const _Tp&) if Tp is CopyAssignable + void + _M_assign_n(size_type __n, const _Tp& __val, true_type) + { + auto __prev = before_begin(); + auto __curr = begin(); + auto __end = end(); + while (__curr != __end && __n > 0) + { + *__curr = __val; + ++__prev; + ++__curr; + --__n; + } + if (__n > 0) + insert_after(__prev, __n, __val); + else if (__curr != __end) + erase_after(__prev, __end); + } + + // Called by assign(size_type, const _Tp&) if Tp is non-CopyAssignable + void + _M_assign_n(size_type __n, const _Tp& __val, false_type) + { + clear(); + insert_after(cbefore_begin(), __n, __val); + } + }; + + /** + * @brief Forward list equality comparison. + * @param __lx A %forward_list + * @param __ly A %forward_list of the same type as @a __lx. + * @return True iff the elements of the forward lists are equal. + * + * This is an equivalence relation. It is linear in the number of + * elements of the forward lists. Deques are considered equivalent + * if corresponding elements compare equal. + */ + template + bool + operator==(const forward_list<_Tp, _Alloc>& __lx, + const forward_list<_Tp, _Alloc>& __ly); + + /** + * @brief Forward list ordering relation. + * @param __lx A %forward_list. + * @param __ly A %forward_list of the same type as @a __lx. + * @return True iff @a __lx is lexicographically less than @a __ly. + * + * This is a total ordering relation. It is linear in the number of + * elements of the forward lists. The elements must be comparable + * with @c <. + * + * See std::lexicographical_compare() for how the determination is made. + */ + template + inline bool + operator<(const forward_list<_Tp, _Alloc>& __lx, + const forward_list<_Tp, _Alloc>& __ly) + { return std::lexicographical_compare(__lx.cbegin(), __lx.cend(), + __ly.cbegin(), __ly.cend()); } + + /// Based on operator== + template + inline bool + operator!=(const forward_list<_Tp, _Alloc>& __lx, + const forward_list<_Tp, _Alloc>& __ly) + { return !(__lx == __ly); } + + /// Based on operator< + template + inline bool + operator>(const forward_list<_Tp, _Alloc>& __lx, + const forward_list<_Tp, _Alloc>& __ly) + { return (__ly < __lx); } + + /// Based on operator< + template + inline bool + operator>=(const forward_list<_Tp, _Alloc>& __lx, + const forward_list<_Tp, _Alloc>& __ly) + { return !(__lx < __ly); } + + /// Based on operator< + template + inline bool + operator<=(const forward_list<_Tp, _Alloc>& __lx, + const forward_list<_Tp, _Alloc>& __ly) + { return !(__ly < __lx); } + + /// See std::forward_list::swap(). + template + inline void + swap(forward_list<_Tp, _Alloc>& __lx, + forward_list<_Tp, _Alloc>& __ly) + noexcept(noexcept(__lx.swap(__ly))) + { __lx.swap(__ly); } + +_GLIBCXX_END_NAMESPACE_CONTAINER +} // namespace std + +#endif // _FORWARD_LIST_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/functexcept.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/functexcept.h new file mode 100644 index 0000000..148351f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/functexcept.h @@ -0,0 +1,110 @@ +// Function-Based Exception Support -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/functexcept.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{exception} + * + * This header provides support for -fno-exceptions. + */ + +// +// ISO C++ 14882: 19.1 Exception classes +// + +#ifndef _FUNCTEXCEPT_H +#define _FUNCTEXCEPT_H 1 + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // Helper for exception objects in + void + __throw_bad_exception(void) __attribute__((__noreturn__)); + + // Helper for exception objects in + void + __throw_bad_alloc(void) __attribute__((__noreturn__)); + + // Helper for exception objects in + void + __throw_bad_cast(void) __attribute__((__noreturn__)); + + void + __throw_bad_typeid(void) __attribute__((__noreturn__)); + + // Helpers for exception objects in + void + __throw_logic_error(const char*) __attribute__((__noreturn__)); + + void + __throw_domain_error(const char*) __attribute__((__noreturn__)); + + void + __throw_invalid_argument(const char*) __attribute__((__noreturn__)); + + void + __throw_length_error(const char*) __attribute__((__noreturn__)); + + void + __throw_out_of_range(const char*) __attribute__((__noreturn__)); + + void + __throw_out_of_range_fmt(const char*, ...) __attribute__((__noreturn__)) + __attribute__((__format__(__gnu_printf__, 1, 2))); + + void + __throw_runtime_error(const char*) __attribute__((__noreturn__)); + + void + __throw_range_error(const char*) __attribute__((__noreturn__)); + + void + __throw_overflow_error(const char*) __attribute__((__noreturn__)); + + void + __throw_underflow_error(const char*) __attribute__((__noreturn__)); + + // Helpers for exception objects in + void + __throw_ios_failure(const char*) __attribute__((__noreturn__)); + + void + __throw_system_error(int) __attribute__((__noreturn__)); + + void + __throw_future_error(int) __attribute__((__noreturn__)); + + // Helpers for exception objects in + void + __throw_bad_function_call() __attribute__((__noreturn__)); + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/functional_hash.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/functional_hash.h new file mode 100644 index 0000000..38be172 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/functional_hash.h @@ -0,0 +1,274 @@ +// functional_hash.h header -*- C++ -*- + +// Copyright (C) 2007-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/functional_hash.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{functional} + */ + +#ifndef _FUNCTIONAL_HASH_H +#define _FUNCTIONAL_HASH_H 1 + +#pragma GCC system_header + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** @defgroup hashes Hashes + * @ingroup functors + * + * Hashing functors taking a variable type and returning a @c std::size_t. + * + * @{ + */ + + template + struct __hash_base + { + typedef _Result result_type; + typedef _Arg argument_type; + }; + + /// Primary class template hash. + template + struct hash; + + template + struct __poison_hash + { + static constexpr bool __enable_hash_call = false; + private: + // Private rather than deleted to be non-trivially-copyable. + __poison_hash(__poison_hash&&); + ~__poison_hash(); + }; + + template + struct __poison_hash<_Tp, __void_t()(declval<_Tp>()))>> + { + static constexpr bool __enable_hash_call = true; + }; + + // Helper struct for SFINAE-poisoning non-enum types. + template::value> + struct __hash_enum + { + private: + // Private rather than deleted to be non-trivially-copyable. + __hash_enum(__hash_enum&&); + ~__hash_enum(); + }; + + // Helper struct for hash with enum types. + template + struct __hash_enum<_Tp, true> : public __hash_base + { + size_t + operator()(_Tp __val) const noexcept + { + using __type = typename underlying_type<_Tp>::type; + return hash<__type>{}(static_cast<__type>(__val)); + } + }; + + /// Primary class template hash, usable for enum types only. + // Use with non-enum types still SFINAES. + template + struct hash : __hash_enum<_Tp> + { }; + + /// Partial specializations for pointer types. + template + struct hash<_Tp*> : public __hash_base + { + size_t + operator()(_Tp* __p) const noexcept + { return reinterpret_cast(__p); } + }; + + // Explicit specializations for integer types. +#define _Cxx_hashtable_define_trivial_hash(_Tp) \ + template<> \ + struct hash<_Tp> : public __hash_base \ + { \ + size_t \ + operator()(_Tp __val) const noexcept \ + { return static_cast(__val); } \ + }; + + /// Explicit specialization for bool. + _Cxx_hashtable_define_trivial_hash(bool) + + /// Explicit specialization for char. + _Cxx_hashtable_define_trivial_hash(char) + + /// Explicit specialization for signed char. + _Cxx_hashtable_define_trivial_hash(signed char) + + /// Explicit specialization for unsigned char. + _Cxx_hashtable_define_trivial_hash(unsigned char) + + /// Explicit specialization for wchar_t. + _Cxx_hashtable_define_trivial_hash(wchar_t) + + /// Explicit specialization for char16_t. + _Cxx_hashtable_define_trivial_hash(char16_t) + + /// Explicit specialization for char32_t. + _Cxx_hashtable_define_trivial_hash(char32_t) + + /// Explicit specialization for short. + _Cxx_hashtable_define_trivial_hash(short) + + /// Explicit specialization for int. + _Cxx_hashtable_define_trivial_hash(int) + + /// Explicit specialization for long. + _Cxx_hashtable_define_trivial_hash(long) + + /// Explicit specialization for long long. + _Cxx_hashtable_define_trivial_hash(long long) + + /// Explicit specialization for unsigned short. + _Cxx_hashtable_define_trivial_hash(unsigned short) + + /// Explicit specialization for unsigned int. + _Cxx_hashtable_define_trivial_hash(unsigned int) + + /// Explicit specialization for unsigned long. + _Cxx_hashtable_define_trivial_hash(unsigned long) + + /// Explicit specialization for unsigned long long. + _Cxx_hashtable_define_trivial_hash(unsigned long long) + +#ifdef __GLIBCXX_TYPE_INT_N_0 + _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_0) + _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_0 unsigned) +#endif +#ifdef __GLIBCXX_TYPE_INT_N_1 + _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_1) + _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_1 unsigned) +#endif +#ifdef __GLIBCXX_TYPE_INT_N_2 + _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_2) + _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_2 unsigned) +#endif +#ifdef __GLIBCXX_TYPE_INT_N_3 + _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_3) + _Cxx_hashtable_define_trivial_hash(__GLIBCXX_TYPE_INT_N_3 unsigned) +#endif + +#undef _Cxx_hashtable_define_trivial_hash + + struct _Hash_impl + { + static size_t + hash(const void* __ptr, size_t __clength, + size_t __seed = static_cast(0xc70f6907UL)) + { return _Hash_bytes(__ptr, __clength, __seed); } + + template + static size_t + hash(const _Tp& __val) + { return hash(&__val, sizeof(__val)); } + + template + static size_t + __hash_combine(const _Tp& __val, size_t __hash) + { return hash(&__val, sizeof(__val), __hash); } + }; + + // A hash function similar to FNV-1a (see PR59406 for how it differs). + struct _Fnv_hash_impl + { + static size_t + hash(const void* __ptr, size_t __clength, + size_t __seed = static_cast(2166136261UL)) + { return _Fnv_hash_bytes(__ptr, __clength, __seed); } + + template + static size_t + hash(const _Tp& __val) + { return hash(&__val, sizeof(__val)); } + + template + static size_t + __hash_combine(const _Tp& __val, size_t __hash) + { return hash(&__val, sizeof(__val), __hash); } + }; + + /// Specialization for float. + template<> + struct hash : public __hash_base + { + size_t + operator()(float __val) const noexcept + { + // 0 and -0 both hash to zero. + return __val != 0.0f ? std::_Hash_impl::hash(__val) : 0; + } + }; + + /// Specialization for double. + template<> + struct hash : public __hash_base + { + size_t + operator()(double __val) const noexcept + { + // 0 and -0 both hash to zero. + return __val != 0.0 ? std::_Hash_impl::hash(__val) : 0; + } + }; + + /// Specialization for long double. + template<> + struct hash + : public __hash_base + { + _GLIBCXX_PURE size_t + operator()(long double __val) const noexcept; + }; + + // @} group hashes + + // Hint about performance of hash functor. If not fast the hash-based + // containers will cache the hash code. + // Default behavior is to consider that hashers are fast unless specified + // otherwise. + template + struct __is_fast_hash : public std::true_type + { }; + + template<> + struct __is_fast_hash> : public std::false_type + { }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif // _FUNCTIONAL_HASH_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/gslice.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/gslice.h new file mode 100644 index 0000000..8909dfd --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/gslice.h @@ -0,0 +1,185 @@ +// The template and inlines for the -*- C++ -*- gslice class. + +// Copyright (C) 1997-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/gslice.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{valarray} + */ + +// Written by Gabriel Dos Reis + +#ifndef _GSLICE_H +#define _GSLICE_H 1 + +#pragma GCC system_header + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup numeric_arrays + * @{ + */ + + /** + * @brief Class defining multi-dimensional subset of an array. + * + * The slice class represents a multi-dimensional subset of an array, + * specified by three parameter sets: start offset, size array, and stride + * array. The start offset is the index of the first element of the array + * that is part of the subset. The size and stride array describe each + * dimension of the slice. Size is the number of elements in that + * dimension, and stride is the distance in the array between successive + * elements in that dimension. Each dimension's size and stride is taken + * to begin at an array element described by the previous dimension. The + * size array and stride array must be the same size. + * + * For example, if you have offset==3, stride[0]==11, size[1]==3, + * stride[1]==3, then slice[0,0]==array[3], slice[0,1]==array[6], + * slice[0,2]==array[9], slice[1,0]==array[14], slice[1,1]==array[17], + * slice[1,2]==array[20]. + */ + class gslice + { + public: + /// Construct an empty slice. + gslice(); + + /** + * @brief Construct a slice. + * + * Constructs a slice with as many dimensions as the length of the @a l + * and @a s arrays. + * + * @param __o Offset in array of first element. + * @param __l Array of dimension lengths. + * @param __s Array of dimension strides between array elements. + */ + gslice(size_t __o, const valarray& __l, + const valarray& __s); + + // XXX: the IS says the copy-ctor and copy-assignment operators are + // synthesized by the compiler but they are just unsuitable + // for a ref-counted semantic + /// Copy constructor. + gslice(const gslice&); + + /// Destructor. + ~gslice(); + + // XXX: See the note above. + /// Assignment operator. + gslice& operator=(const gslice&); + + /// Return array offset of first slice element. + size_t start() const; + + /// Return array of sizes of slice dimensions. + valarray size() const; + + /// Return array of array strides for each dimension. + valarray stride() const; + + private: + struct _Indexer + { + size_t _M_count; + size_t _M_start; + valarray _M_size; + valarray _M_stride; + valarray _M_index; // Linear array of referenced indices + + _Indexer() + : _M_count(1), _M_start(0), _M_size(), _M_stride(), _M_index() {} + + _Indexer(size_t, const valarray&, + const valarray&); + + void + _M_increment_use() + { ++_M_count; } + + size_t + _M_decrement_use() + { return --_M_count; } + }; + + _Indexer* _M_index; + + template friend class valarray; + }; + + inline size_t + gslice::start() const + { return _M_index ? _M_index->_M_start : 0; } + + inline valarray + gslice::size() const + { return _M_index ? _M_index->_M_size : valarray(); } + + inline valarray + gslice::stride() const + { return _M_index ? _M_index->_M_stride : valarray(); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 543. valarray slice default constructor + inline + gslice::gslice() + : _M_index(new gslice::_Indexer()) {} + + inline + gslice::gslice(size_t __o, const valarray& __l, + const valarray& __s) + : _M_index(new gslice::_Indexer(__o, __l, __s)) {} + + inline + gslice::gslice(const gslice& __g) + : _M_index(__g._M_index) + { if (_M_index) _M_index->_M_increment_use(); } + + inline + gslice::~gslice() + { + if (_M_index && _M_index->_M_decrement_use() == 0) + delete _M_index; + } + + inline gslice& + gslice::operator=(const gslice& __g) + { + if (__g._M_index) + __g._M_index->_M_increment_use(); + if (_M_index && _M_index->_M_decrement_use() == 0) + delete _M_index; + _M_index = __g._M_index; + return *this; + } + + // @} group numeric_arrays + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _GSLICE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/gslice_array.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/gslice_array.h new file mode 100644 index 0000000..dd45450 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/gslice_array.h @@ -0,0 +1,218 @@ +// The template and inlines for the -*- C++ -*- gslice_array class. + +// Copyright (C) 1997-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/gslice_array.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{valarray} + */ + +// Written by Gabriel Dos Reis + +#ifndef _GSLICE_ARRAY_H +#define _GSLICE_ARRAY_H 1 + +#pragma GCC system_header + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup numeric_arrays + * @{ + */ + + /** + * @brief Reference to multi-dimensional subset of an array. + * + * A gslice_array is a reference to the actual elements of an array + * specified by a gslice. The way to get a gslice_array is to call + * operator[](gslice) on a valarray. The returned gslice_array then + * permits carrying operations out on the referenced subset of elements in + * the original valarray. For example, operator+=(valarray) will add + * values to the subset of elements in the underlying valarray this + * gslice_array refers to. + * + * @param Tp Element type. + */ + template + class gslice_array + { + public: + typedef _Tp value_type; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 253. valarray helper functions are almost entirely useless + + /// Copy constructor. Both slices refer to the same underlying array. + gslice_array(const gslice_array&); + + /// Assignment operator. Assigns slice elements to corresponding + /// elements of @a a. + gslice_array& operator=(const gslice_array&); + + /// Assign slice elements to corresponding elements of @a v. + void operator=(const valarray<_Tp>&) const; + /// Multiply slice elements by corresponding elements of @a v. + void operator*=(const valarray<_Tp>&) const; + /// Divide slice elements by corresponding elements of @a v. + void operator/=(const valarray<_Tp>&) const; + /// Modulo slice elements by corresponding elements of @a v. + void operator%=(const valarray<_Tp>&) const; + /// Add corresponding elements of @a v to slice elements. + void operator+=(const valarray<_Tp>&) const; + /// Subtract corresponding elements of @a v from slice elements. + void operator-=(const valarray<_Tp>&) const; + /// Logical xor slice elements with corresponding elements of @a v. + void operator^=(const valarray<_Tp>&) const; + /// Logical and slice elements with corresponding elements of @a v. + void operator&=(const valarray<_Tp>&) const; + /// Logical or slice elements with corresponding elements of @a v. + void operator|=(const valarray<_Tp>&) const; + /// Left shift slice elements by corresponding elements of @a v. + void operator<<=(const valarray<_Tp>&) const; + /// Right shift slice elements by corresponding elements of @a v. + void operator>>=(const valarray<_Tp>&) const; + /// Assign all slice elements to @a t. + void operator=(const _Tp&) const; + + template + void operator=(const _Expr<_Dom, _Tp>&) const; + template + void operator*=(const _Expr<_Dom, _Tp>&) const; + template + void operator/=(const _Expr<_Dom, _Tp>&) const; + template + void operator%=(const _Expr<_Dom, _Tp>&) const; + template + void operator+=(const _Expr<_Dom, _Tp>&) const; + template + void operator-=(const _Expr<_Dom, _Tp>&) const; + template + void operator^=(const _Expr<_Dom, _Tp>&) const; + template + void operator&=(const _Expr<_Dom, _Tp>&) const; + template + void operator|=(const _Expr<_Dom, _Tp>&) const; + template + void operator<<=(const _Expr<_Dom, _Tp>&) const; + template + void operator>>=(const _Expr<_Dom, _Tp>&) const; + + private: + _Array<_Tp> _M_array; + const valarray& _M_index; + + friend class valarray<_Tp>; + + gslice_array(_Array<_Tp>, const valarray&); + + // not implemented + gslice_array(); + }; + + template + inline + gslice_array<_Tp>::gslice_array(_Array<_Tp> __a, + const valarray& __i) + : _M_array(__a), _M_index(__i) {} + + template + inline + gslice_array<_Tp>::gslice_array(const gslice_array<_Tp>& __a) + : _M_array(__a._M_array), _M_index(__a._M_index) {} + + template + inline gslice_array<_Tp>& + gslice_array<_Tp>::operator=(const gslice_array<_Tp>& __a) + { + std::__valarray_copy(_Array<_Tp>(__a._M_array), + _Array(__a._M_index), _M_index.size(), + _M_array, _Array(_M_index)); + return *this; + } + + template + inline void + gslice_array<_Tp>::operator=(const _Tp& __t) const + { + std::__valarray_fill(_M_array, _Array(_M_index), + _M_index.size(), __t); + } + + template + inline void + gslice_array<_Tp>::operator=(const valarray<_Tp>& __v) const + { + std::__valarray_copy(_Array<_Tp>(__v), __v.size(), + _M_array, _Array(_M_index)); + } + + template + template + inline void + gslice_array<_Tp>::operator=(const _Expr<_Dom, _Tp>& __e) const + { + std::__valarray_copy (__e, _M_index.size(), _M_array, + _Array(_M_index)); + } + +#undef _DEFINE_VALARRAY_OPERATOR +#define _DEFINE_VALARRAY_OPERATOR(_Op, _Name) \ + template \ + inline void \ + gslice_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const \ + { \ + _Array_augmented_##_Name(_M_array, _Array(_M_index), \ + _Array<_Tp>(__v), __v.size()); \ + } \ + \ + template \ + template \ + inline void \ + gslice_array<_Tp>::operator _Op##= (const _Expr<_Dom, _Tp>& __e) const\ + { \ + _Array_augmented_##_Name(_M_array, _Array(_M_index), __e,\ + _M_index.size()); \ + } + +_DEFINE_VALARRAY_OPERATOR(*, __multiplies) +_DEFINE_VALARRAY_OPERATOR(/, __divides) +_DEFINE_VALARRAY_OPERATOR(%, __modulus) +_DEFINE_VALARRAY_OPERATOR(+, __plus) +_DEFINE_VALARRAY_OPERATOR(-, __minus) +_DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor) +_DEFINE_VALARRAY_OPERATOR(&, __bitwise_and) +_DEFINE_VALARRAY_OPERATOR(|, __bitwise_or) +_DEFINE_VALARRAY_OPERATOR(<<, __shift_left) +_DEFINE_VALARRAY_OPERATOR(>>, __shift_right) + +#undef _DEFINE_VALARRAY_OPERATOR + + // @} group numeric_arrays + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _GSLICE_ARRAY_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/hash_bytes.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/hash_bytes.h new file mode 100644 index 0000000..f9b98a0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/hash_bytes.h @@ -0,0 +1,59 @@ +// Declarations for hash functions. -*- C++ -*- + +// Copyright (C) 2010-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/hash_bytes.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{functional} + */ + +#ifndef _HASH_BYTES_H +#define _HASH_BYTES_H 1 + +#pragma GCC system_header + +#include + +namespace std +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // Hash function implementation for the nontrivial specialization. + // All of them are based on a primitive that hashes a pointer to a + // byte array. The actual hash algorithm is not guaranteed to stay + // the same from release to release -- it may be updated or tuned to + // improve hash quality or speed. + size_t + _Hash_bytes(const void* __ptr, size_t __len, size_t __seed); + + // A similar hash primitive, using the FNV hash algorithm. This + // algorithm is guaranteed to stay the same from release to release. + // (although it might not produce the same values on different + // machines.) + size_t + _Fnv_hash_bytes(const void* __ptr, size_t __len, size_t __seed); + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/hashtable.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/hashtable.h new file mode 100644 index 0000000..e0806dc --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/hashtable.h @@ -0,0 +1,2216 @@ +// hashtable.h header -*- C++ -*- + +// Copyright (C) 2007-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/hashtable.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{unordered_map, unordered_set} + */ + +#ifndef _HASHTABLE_H +#define _HASHTABLE_H 1 + +#pragma GCC system_header + +#include +#if __cplusplus > 201402L +# include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + using __cache_default + = __not_<__and_, + // Mandatory to have erase not throwing. + __detail::__is_noexcept_hash<_Tp, _Hash>>>; + + /** + * Primary class template _Hashtable. + * + * @ingroup hashtable-detail + * + * @tparam _Value CopyConstructible type. + * + * @tparam _Key CopyConstructible type. + * + * @tparam _Alloc An allocator type + * ([lib.allocator.requirements]) whose _Alloc::value_type is + * _Value. As a conforming extension, we allow for + * _Alloc::value_type != _Value. + * + * @tparam _ExtractKey Function object that takes an object of type + * _Value and returns a value of type _Key. + * + * @tparam _Equal Function object that takes two objects of type k + * and returns a bool-like value that is true if the two objects + * are considered equal. + * + * @tparam _H1 The hash function. A unary function object with + * argument type _Key and result type size_t. Return values should + * be distributed over the entire range [0, numeric_limits:::max()]. + * + * @tparam _H2 The range-hashing function (in the terminology of + * Tavori and Dreizin). A binary function object whose argument + * types and result type are all size_t. Given arguments r and N, + * the return value is in the range [0, N). + * + * @tparam _Hash The ranged hash function (Tavori and Dreizin). A + * binary function whose argument types are _Key and size_t and + * whose result type is size_t. Given arguments k and N, the + * return value is in the range [0, N). Default: hash(k, N) = + * h2(h1(k), N). If _Hash is anything other than the default, _H1 + * and _H2 are ignored. + * + * @tparam _RehashPolicy Policy class with three members, all of + * which govern the bucket count. _M_next_bkt(n) returns a bucket + * count no smaller than n. _M_bkt_for_elements(n) returns a + * bucket count appropriate for an element count of n. + * _M_need_rehash(n_bkt, n_elt, n_ins) determines whether, if the + * current bucket count is n_bkt and the current element count is + * n_elt, we need to increase the bucket count. If so, returns + * make_pair(true, n), where n is the new bucket count. If not, + * returns make_pair(false, ) + * + * @tparam _Traits Compile-time class with three boolean + * std::integral_constant members: __cache_hash_code, __constant_iterators, + * __unique_keys. + * + * Each _Hashtable data structure has: + * + * - _Bucket[] _M_buckets + * - _Hash_node_base _M_before_begin + * - size_type _M_bucket_count + * - size_type _M_element_count + * + * with _Bucket being _Hash_node* and _Hash_node containing: + * + * - _Hash_node* _M_next + * - Tp _M_value + * - size_t _M_hash_code if cache_hash_code is true + * + * In terms of Standard containers the hashtable is like the aggregation of: + * + * - std::forward_list<_Node> containing the elements + * - std::vector::iterator> representing the buckets + * + * The non-empty buckets contain the node before the first node in the + * bucket. This design makes it possible to implement something like a + * std::forward_list::insert_after on container insertion and + * std::forward_list::erase_after on container erase + * calls. _M_before_begin is equivalent to + * std::forward_list::before_begin. Empty buckets contain + * nullptr. Note that one of the non-empty buckets contains + * &_M_before_begin which is not a dereferenceable node so the + * node pointer in a bucket shall never be dereferenced, only its + * next node can be. + * + * Walking through a bucket's nodes requires a check on the hash code to + * see if each node is still in the bucket. Such a design assumes a + * quite efficient hash functor and is one of the reasons it is + * highly advisable to set __cache_hash_code to true. + * + * The container iterators are simply built from nodes. This way + * incrementing the iterator is perfectly efficient independent of + * how many empty buckets there are in the container. + * + * On insert we compute the element's hash code and use it to find the + * bucket index. If the element must be inserted in an empty bucket + * we add it at the beginning of the singly linked list and make the + * bucket point to _M_before_begin. The bucket that used to point to + * _M_before_begin, if any, is updated to point to its new before + * begin node. + * + * On erase, the simple iterator design requires using the hash + * functor to get the index of the bucket to update. For this + * reason, when __cache_hash_code is set to false the hash functor must + * not throw and this is enforced by a static assertion. + * + * Functionality is implemented by decomposition into base classes, + * where the derived _Hashtable class is used in _Map_base, + * _Insert, _Rehash_base, and _Equality base classes to access the + * "this" pointer. _Hashtable_base is used in the base classes as a + * non-recursive, fully-completed-type so that detailed nested type + * information, such as iterator type and node type, can be + * used. This is similar to the "Curiously Recurring Template + * Pattern" (CRTP) technique, but uses a reconstructed, not + * explicitly passed, template pattern. + * + * Base class templates are: + * - __detail::_Hashtable_base + * - __detail::_Map_base + * - __detail::_Insert + * - __detail::_Rehash_base + * - __detail::_Equality + */ + template + class _Hashtable + : public __detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, + _H1, _H2, _Hash, _Traits>, + public __detail::_Map_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>, + public __detail::_Insert<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>, + public __detail::_Rehash_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>, + public __detail::_Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>, + private __detail::_Hashtable_alloc< + __alloc_rebind<_Alloc, + __detail::_Hash_node<_Value, + _Traits::__hash_cached::value>>> + { + using __traits_type = _Traits; + using __hash_cached = typename __traits_type::__hash_cached; + using __node_type = __detail::_Hash_node<_Value, __hash_cached::value>; + using __node_alloc_type = __alloc_rebind<_Alloc, __node_type>; + + using __hashtable_alloc = __detail::_Hashtable_alloc<__node_alloc_type>; + + using __value_alloc_traits = + typename __hashtable_alloc::__value_alloc_traits; + using __node_alloc_traits = + typename __hashtable_alloc::__node_alloc_traits; + using __node_base = typename __hashtable_alloc::__node_base; + using __bucket_type = typename __hashtable_alloc::__bucket_type; + + public: + typedef _Key key_type; + typedef _Value value_type; + typedef _Alloc allocator_type; + typedef _Equal key_equal; + + // mapped_type, if present, comes from _Map_base. + // hasher, if present, comes from _Hash_code_base/_Hashtable_base. + typedef typename __value_alloc_traits::pointer pointer; + typedef typename __value_alloc_traits::const_pointer const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + + private: + using __rehash_type = _RehashPolicy; + using __rehash_state = typename __rehash_type::_State; + + using __constant_iterators = typename __traits_type::__constant_iterators; + using __unique_keys = typename __traits_type::__unique_keys; + + using __key_extract = typename std::conditional< + __constant_iterators::value, + __detail::_Identity, + __detail::_Select1st>::type; + + using __hashtable_base = __detail:: + _Hashtable_base<_Key, _Value, _ExtractKey, + _Equal, _H1, _H2, _Hash, _Traits>; + + using __hash_code_base = typename __hashtable_base::__hash_code_base; + using __hash_code = typename __hashtable_base::__hash_code; + using __ireturn_type = typename __hashtable_base::__ireturn_type; + + using __map_base = __detail::_Map_base<_Key, _Value, _Alloc, _ExtractKey, + _Equal, _H1, _H2, _Hash, + _RehashPolicy, _Traits>; + + using __rehash_base = __detail::_Rehash_base<_Key, _Value, _Alloc, + _ExtractKey, _Equal, + _H1, _H2, _Hash, + _RehashPolicy, _Traits>; + + using __eq_base = __detail::_Equality<_Key, _Value, _Alloc, _ExtractKey, + _Equal, _H1, _H2, _Hash, + _RehashPolicy, _Traits>; + + using __reuse_or_alloc_node_type = + __detail::_ReuseOrAllocNode<__node_alloc_type>; + + // Metaprogramming for picking apart hash caching. + template + using __if_hash_cached = __or_<__not_<__hash_cached>, _Cond>; + + template + using __if_hash_not_cached = __or_<__hash_cached, _Cond>; + + // Compile-time diagnostics. + + // _Hash_code_base has everything protected, so use this derived type to + // access it. + struct __hash_code_base_access : __hash_code_base + { using __hash_code_base::_M_bucket_index; }; + + // Getting a bucket index from a node shall not throw because it is used + // in methods (erase, swap...) that shall not throw. + static_assert(noexcept(declval() + ._M_bucket_index((const __node_type*)nullptr, + (std::size_t)0)), + "Cache the hash code or qualify your functors involved" + " in hash code and bucket index computation with noexcept"); + + // Following two static assertions are necessary to guarantee + // that local_iterator will be default constructible. + + // When hash codes are cached local iterator inherits from H2 functor + // which must then be default constructible. + static_assert(__if_hash_cached>::value, + "Functor used to map hash code to bucket index" + " must be default constructible"); + + template + friend struct __detail::_Map_base; + + template + friend struct __detail::_Insert_base; + + template + friend struct __detail::_Insert; + + public: + using size_type = typename __hashtable_base::size_type; + using difference_type = typename __hashtable_base::difference_type; + + using iterator = typename __hashtable_base::iterator; + using const_iterator = typename __hashtable_base::const_iterator; + + using local_iterator = typename __hashtable_base::local_iterator; + using const_local_iterator = typename __hashtable_base:: + const_local_iterator; + +#if __cplusplus > 201402L + using node_type = _Node_handle<_Key, _Value, __node_alloc_type>; + using insert_return_type = _Node_insert_return; +#endif + + private: + __bucket_type* _M_buckets = &_M_single_bucket; + size_type _M_bucket_count = 1; + __node_base _M_before_begin; + size_type _M_element_count = 0; + _RehashPolicy _M_rehash_policy; + + // A single bucket used when only need for 1 bucket. Especially + // interesting in move semantic to leave hashtable with only 1 buckets + // which is not allocated so that we can have those operations noexcept + // qualified. + // Note that we can't leave hashtable with 0 bucket without adding + // numerous checks in the code to avoid 0 modulus. + __bucket_type _M_single_bucket = nullptr; + + bool + _M_uses_single_bucket(__bucket_type* __bkts) const + { return __builtin_expect(__bkts == &_M_single_bucket, false); } + + bool + _M_uses_single_bucket() const + { return _M_uses_single_bucket(_M_buckets); } + + __hashtable_alloc& + _M_base_alloc() { return *this; } + + __bucket_type* + _M_allocate_buckets(size_type __n) + { + if (__builtin_expect(__n == 1, false)) + { + _M_single_bucket = nullptr; + return &_M_single_bucket; + } + + return __hashtable_alloc::_M_allocate_buckets(__n); + } + + void + _M_deallocate_buckets(__bucket_type* __bkts, size_type __n) + { + if (_M_uses_single_bucket(__bkts)) + return; + + __hashtable_alloc::_M_deallocate_buckets(__bkts, __n); + } + + void + _M_deallocate_buckets() + { _M_deallocate_buckets(_M_buckets, _M_bucket_count); } + + // Gets bucket begin, deals with the fact that non-empty buckets contain + // their before begin node. + __node_type* + _M_bucket_begin(size_type __bkt) const; + + __node_type* + _M_begin() const + { return static_cast<__node_type*>(_M_before_begin._M_nxt); } + + template + void + _M_assign(const _Hashtable&, const _NodeGenerator&); + + void + _M_move_assign(_Hashtable&&, std::true_type); + + void + _M_move_assign(_Hashtable&&, std::false_type); + + void + _M_reset() noexcept; + + _Hashtable(const _H1& __h1, const _H2& __h2, const _Hash& __h, + const _Equal& __eq, const _ExtractKey& __exk, + const allocator_type& __a) + : __hashtable_base(__exk, __h1, __h2, __h, __eq), + __hashtable_alloc(__node_alloc_type(__a)) + { } + + public: + // Constructor, destructor, assignment, swap + _Hashtable() = default; + _Hashtable(size_type __bucket_hint, + const _H1&, const _H2&, const _Hash&, + const _Equal&, const _ExtractKey&, + const allocator_type&); + + template + _Hashtable(_InputIterator __first, _InputIterator __last, + size_type __bucket_hint, + const _H1&, const _H2&, const _Hash&, + const _Equal&, const _ExtractKey&, + const allocator_type&); + + _Hashtable(const _Hashtable&); + + _Hashtable(_Hashtable&&) noexcept; + + _Hashtable(const _Hashtable&, const allocator_type&); + + _Hashtable(_Hashtable&&, const allocator_type&); + + // Use delegating constructors. + explicit + _Hashtable(const allocator_type& __a) + : __hashtable_alloc(__node_alloc_type(__a)) + { } + + explicit + _Hashtable(size_type __n, + const _H1& __hf = _H1(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _Hashtable(__n, __hf, _H2(), _Hash(), __eql, + __key_extract(), __a) + { } + + template + _Hashtable(_InputIterator __f, _InputIterator __l, + size_type __n = 0, + const _H1& __hf = _H1(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _Hashtable(__f, __l, __n, __hf, _H2(), _Hash(), __eql, + __key_extract(), __a) + { } + + _Hashtable(initializer_list __l, + size_type __n = 0, + const _H1& __hf = _H1(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _Hashtable(__l.begin(), __l.end(), __n, __hf, _H2(), _Hash(), __eql, + __key_extract(), __a) + { } + + _Hashtable& + operator=(const _Hashtable& __ht); + + _Hashtable& + operator=(_Hashtable&& __ht) + noexcept(__node_alloc_traits::_S_nothrow_move() + && is_nothrow_move_assignable<_H1>::value + && is_nothrow_move_assignable<_Equal>::value) + { + constexpr bool __move_storage = + __node_alloc_traits::_S_propagate_on_move_assign() + || __node_alloc_traits::_S_always_equal(); + _M_move_assign(std::move(__ht), __bool_constant<__move_storage>()); + return *this; + } + + _Hashtable& + operator=(initializer_list __l) + { + __reuse_or_alloc_node_type __roan(_M_begin(), *this); + _M_before_begin._M_nxt = nullptr; + clear(); + this->_M_insert_range(__l.begin(), __l.end(), __roan); + return *this; + } + + ~_Hashtable() noexcept; + + void + swap(_Hashtable&) + noexcept(__and_<__is_nothrow_swappable<_H1>, + __is_nothrow_swappable<_Equal>>::value); + + // Basic container operations + iterator + begin() noexcept + { return iterator(_M_begin()); } + + const_iterator + begin() const noexcept + { return const_iterator(_M_begin()); } + + iterator + end() noexcept + { return iterator(nullptr); } + + const_iterator + end() const noexcept + { return const_iterator(nullptr); } + + const_iterator + cbegin() const noexcept + { return const_iterator(_M_begin()); } + + const_iterator + cend() const noexcept + { return const_iterator(nullptr); } + + size_type + size() const noexcept + { return _M_element_count; } + + bool + empty() const noexcept + { return size() == 0; } + + allocator_type + get_allocator() const noexcept + { return allocator_type(this->_M_node_allocator()); } + + size_type + max_size() const noexcept + { return __node_alloc_traits::max_size(this->_M_node_allocator()); } + + // Observers + key_equal + key_eq() const + { return this->_M_eq(); } + + // hash_function, if present, comes from _Hash_code_base. + + // Bucket operations + size_type + bucket_count() const noexcept + { return _M_bucket_count; } + + size_type + max_bucket_count() const noexcept + { return max_size(); } + + size_type + bucket_size(size_type __n) const + { return std::distance(begin(__n), end(__n)); } + + size_type + bucket(const key_type& __k) const + { return _M_bucket_index(__k, this->_M_hash_code(__k)); } + + local_iterator + begin(size_type __n) + { + return local_iterator(*this, _M_bucket_begin(__n), + __n, _M_bucket_count); + } + + local_iterator + end(size_type __n) + { return local_iterator(*this, nullptr, __n, _M_bucket_count); } + + const_local_iterator + begin(size_type __n) const + { + return const_local_iterator(*this, _M_bucket_begin(__n), + __n, _M_bucket_count); + } + + const_local_iterator + end(size_type __n) const + { return const_local_iterator(*this, nullptr, __n, _M_bucket_count); } + + // DR 691. + const_local_iterator + cbegin(size_type __n) const + { + return const_local_iterator(*this, _M_bucket_begin(__n), + __n, _M_bucket_count); + } + + const_local_iterator + cend(size_type __n) const + { return const_local_iterator(*this, nullptr, __n, _M_bucket_count); } + + float + load_factor() const noexcept + { + return static_cast(size()) / static_cast(bucket_count()); + } + + // max_load_factor, if present, comes from _Rehash_base. + + // Generalization of max_load_factor. Extension, not found in + // TR1. Only useful if _RehashPolicy is something other than + // the default. + const _RehashPolicy& + __rehash_policy() const + { return _M_rehash_policy; } + + void + __rehash_policy(const _RehashPolicy& __pol) + { _M_rehash_policy = __pol; } + + // Lookup. + iterator + find(const key_type& __k); + + const_iterator + find(const key_type& __k) const; + + size_type + count(const key_type& __k) const; + + std::pair + equal_range(const key_type& __k); + + std::pair + equal_range(const key_type& __k) const; + + protected: + // Bucket index computation helpers. + size_type + _M_bucket_index(__node_type* __n) const noexcept + { return __hash_code_base::_M_bucket_index(__n, _M_bucket_count); } + + size_type + _M_bucket_index(const key_type& __k, __hash_code __c) const + { return __hash_code_base::_M_bucket_index(__k, __c, _M_bucket_count); } + + // Find and insert helper functions and types + // Find the node before the one matching the criteria. + __node_base* + _M_find_before_node(size_type, const key_type&, __hash_code) const; + + __node_type* + _M_find_node(size_type __bkt, const key_type& __key, + __hash_code __c) const + { + __node_base* __before_n = _M_find_before_node(__bkt, __key, __c); + if (__before_n) + return static_cast<__node_type*>(__before_n->_M_nxt); + return nullptr; + } + + // Insert a node at the beginning of a bucket. + void + _M_insert_bucket_begin(size_type, __node_type*); + + // Remove the bucket first node + void + _M_remove_bucket_begin(size_type __bkt, __node_type* __next_n, + size_type __next_bkt); + + // Get the node before __n in the bucket __bkt + __node_base* + _M_get_previous_node(size_type __bkt, __node_base* __n); + + // Insert node with hash code __code, in bucket bkt if no rehash (assumes + // no element with its key already present). Take ownership of the node, + // deallocate it on exception. + iterator + _M_insert_unique_node(size_type __bkt, __hash_code __code, + __node_type* __n); + + // Insert node with hash code __code. Take ownership of the node, + // deallocate it on exception. + iterator + _M_insert_multi_node(__node_type* __hint, + __hash_code __code, __node_type* __n); + + template + std::pair + _M_emplace(std::true_type, _Args&&... __args); + + template + iterator + _M_emplace(std::false_type __uk, _Args&&... __args) + { return _M_emplace(cend(), __uk, std::forward<_Args>(__args)...); } + + // Emplace with hint, useless when keys are unique. + template + iterator + _M_emplace(const_iterator, std::true_type __uk, _Args&&... __args) + { return _M_emplace(__uk, std::forward<_Args>(__args)...).first; } + + template + iterator + _M_emplace(const_iterator, std::false_type, _Args&&... __args); + + template + std::pair + _M_insert(_Arg&&, const _NodeGenerator&, std::true_type); + + template + iterator + _M_insert(_Arg&& __arg, const _NodeGenerator& __node_gen, + std::false_type __uk) + { + return _M_insert(cend(), std::forward<_Arg>(__arg), __node_gen, + __uk); + } + + // Insert with hint, not used when keys are unique. + template + iterator + _M_insert(const_iterator, _Arg&& __arg, + const _NodeGenerator& __node_gen, std::true_type __uk) + { + return + _M_insert(std::forward<_Arg>(__arg), __node_gen, __uk).first; + } + + // Insert with hint when keys are not unique. + template + iterator + _M_insert(const_iterator, _Arg&&, + const _NodeGenerator&, std::false_type); + + size_type + _M_erase(std::true_type, const key_type&); + + size_type + _M_erase(std::false_type, const key_type&); + + iterator + _M_erase(size_type __bkt, __node_base* __prev_n, __node_type* __n); + + public: + // Emplace + template + __ireturn_type + emplace(_Args&&... __args) + { return _M_emplace(__unique_keys(), std::forward<_Args>(__args)...); } + + template + iterator + emplace_hint(const_iterator __hint, _Args&&... __args) + { + return _M_emplace(__hint, __unique_keys(), + std::forward<_Args>(__args)...); + } + + // Insert member functions via inheritance. + + // Erase + iterator + erase(const_iterator); + + // LWG 2059. + iterator + erase(iterator __it) + { return erase(const_iterator(__it)); } + + size_type + erase(const key_type& __k) + { return _M_erase(__unique_keys(), __k); } + + iterator + erase(const_iterator, const_iterator); + + void + clear() noexcept; + + // Set number of buckets to be appropriate for container of n element. + void rehash(size_type __n); + + // DR 1189. + // reserve, if present, comes from _Rehash_base. + +#if __cplusplus > 201402L + /// Re-insert an extracted node into a container with unique keys. + insert_return_type + _M_reinsert_node(node_type&& __nh) + { + insert_return_type __ret; + if (__nh.empty()) + __ret.position = end(); + else + { + __glibcxx_assert(get_allocator() == __nh.get_allocator()); + + const key_type& __k = __nh._M_key(); + __hash_code __code = this->_M_hash_code(__k); + size_type __bkt = _M_bucket_index(__k, __code); + if (__node_type* __n = _M_find_node(__bkt, __k, __code)) + { + __ret.node = std::move(__nh); + __ret.position = iterator(__n); + __ret.inserted = false; + } + else + { + __ret.position + = _M_insert_unique_node(__bkt, __code, __nh._M_ptr); + __nh._M_ptr = nullptr; + __ret.inserted = true; + } + } + return __ret; + } + + /// Re-insert an extracted node into a container with equivalent keys. + iterator + _M_reinsert_node_multi(const_iterator __hint, node_type&& __nh) + { + iterator __ret; + if (__nh.empty()) + __ret = end(); + else + { + __glibcxx_assert(get_allocator() == __nh.get_allocator()); + + auto __code = this->_M_hash_code(__nh._M_key()); + auto __node = std::exchange(__nh._M_ptr, nullptr); + // FIXME: this deallocates the node on exception. + __ret = _M_insert_multi_node(__hint._M_cur, __code, __node); + } + return __ret; + } + + /// Extract a node. + node_type + extract(const_iterator __pos) + { + __node_type* __n = __pos._M_cur; + size_t __bkt = _M_bucket_index(__n); + + // Look for previous node to unlink it from the erased one, this + // is why we need buckets to contain the before begin to make + // this search fast. + __node_base* __prev_n = _M_get_previous_node(__bkt, __n); + + if (__prev_n == _M_buckets[__bkt]) + _M_remove_bucket_begin(__bkt, __n->_M_next(), + __n->_M_nxt ? _M_bucket_index(__n->_M_next()) : 0); + else if (__n->_M_nxt) + { + size_type __next_bkt = _M_bucket_index(__n->_M_next()); + if (__next_bkt != __bkt) + _M_buckets[__next_bkt] = __prev_n; + } + + __prev_n->_M_nxt = __n->_M_nxt; + __n->_M_nxt = nullptr; + --_M_element_count; + return { __n, this->_M_node_allocator() }; + } + + /// Extract a node. + node_type + extract(const _Key& __k) + { + node_type __nh; + auto __pos = find(__k); + if (__pos != end()) + __nh = extract(const_iterator(__pos)); + return __nh; + } + + /// Merge from a compatible container into one with unique keys. + template + void + _M_merge_unique(_Compatible_Hashtable& __src) noexcept + { + static_assert(is_same_v, "Node types are compatible"); + __glibcxx_assert(get_allocator() == __src.get_allocator()); + + for (auto __i = __src.begin(), __end = __src.end(); __i != __end;) + { + auto __pos = __i++; + const key_type& __k = this->_M_extract()(__pos._M_cur->_M_v()); + __hash_code __code = this->_M_hash_code(__k); + size_type __bkt = _M_bucket_index(__k, __code); + if (_M_find_node(__bkt, __k, __code) == nullptr) + { + auto __nh = __src.extract(__pos); + _M_insert_unique_node(__bkt, __code, __nh._M_ptr); + __nh._M_ptr = nullptr; + } + } + } + + /// Merge from a compatible container into one with equivalent keys. + template + void + _M_merge_multi(_Compatible_Hashtable& __src) noexcept + { + static_assert(is_same_v, "Node types are compatible"); + __glibcxx_assert(get_allocator() == __src.get_allocator()); + + this->reserve(size() + __src.size()); + for (auto __i = __src.begin(), __end = __src.end(); __i != __end;) + _M_reinsert_node_multi(cend(), __src.extract(__i++)); + } +#endif // C++17 + + private: + // Helper rehash method used when keys are unique. + void _M_rehash_aux(size_type __n, std::true_type); + + // Helper rehash method used when keys can be non-unique. + void _M_rehash_aux(size_type __n, std::false_type); + + // Unconditionally change size of bucket array to n, restore + // hash policy state to __state on exception. + void _M_rehash(size_type __n, const __rehash_state& __state); + }; + + + // Definitions of class template _Hashtable's out-of-line member functions. + template + auto + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _M_bucket_begin(size_type __bkt) const + -> __node_type* + { + __node_base* __n = _M_buckets[__bkt]; + return __n ? static_cast<__node_type*>(__n->_M_nxt) : nullptr; + } + + template + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _Hashtable(size_type __bucket_hint, + const _H1& __h1, const _H2& __h2, const _Hash& __h, + const _Equal& __eq, const _ExtractKey& __exk, + const allocator_type& __a) + : _Hashtable(__h1, __h2, __h, __eq, __exk, __a) + { + auto __bkt = _M_rehash_policy._M_next_bkt(__bucket_hint); + if (__bkt > _M_bucket_count) + { + _M_buckets = _M_allocate_buckets(__bkt); + _M_bucket_count = __bkt; + } + } + + template + template + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _Hashtable(_InputIterator __f, _InputIterator __l, + size_type __bucket_hint, + const _H1& __h1, const _H2& __h2, const _Hash& __h, + const _Equal& __eq, const _ExtractKey& __exk, + const allocator_type& __a) + : _Hashtable(__h1, __h2, __h, __eq, __exk, __a) + { + auto __nb_elems = __detail::__distance_fw(__f, __l); + auto __bkt_count = + _M_rehash_policy._M_next_bkt( + std::max(_M_rehash_policy._M_bkt_for_elements(__nb_elems), + __bucket_hint)); + + if (__bkt_count > _M_bucket_count) + { + _M_buckets = _M_allocate_buckets(__bkt_count); + _M_bucket_count = __bkt_count; + } + + for (; __f != __l; ++__f) + this->insert(*__f); + } + + template + auto + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + operator=(const _Hashtable& __ht) + -> _Hashtable& + { + if (&__ht == this) + return *this; + + if (__node_alloc_traits::_S_propagate_on_copy_assign()) + { + auto& __this_alloc = this->_M_node_allocator(); + auto& __that_alloc = __ht._M_node_allocator(); + if (!__node_alloc_traits::_S_always_equal() + && __this_alloc != __that_alloc) + { + // Replacement allocator cannot free existing storage. + this->_M_deallocate_nodes(_M_begin()); + _M_before_begin._M_nxt = nullptr; + _M_deallocate_buckets(); + _M_buckets = nullptr; + std::__alloc_on_copy(__this_alloc, __that_alloc); + __hashtable_base::operator=(__ht); + _M_bucket_count = __ht._M_bucket_count; + _M_element_count = __ht._M_element_count; + _M_rehash_policy = __ht._M_rehash_policy; + __try + { + _M_assign(__ht, + [this](const __node_type* __n) + { return this->_M_allocate_node(__n->_M_v()); }); + } + __catch(...) + { + // _M_assign took care of deallocating all memory. Now we + // must make sure this instance remains in a usable state. + _M_reset(); + __throw_exception_again; + } + return *this; + } + std::__alloc_on_copy(__this_alloc, __that_alloc); + } + + // Reuse allocated buckets and nodes. + __bucket_type* __former_buckets = nullptr; + std::size_t __former_bucket_count = _M_bucket_count; + const __rehash_state& __former_state = _M_rehash_policy._M_state(); + + if (_M_bucket_count != __ht._M_bucket_count) + { + __former_buckets = _M_buckets; + _M_buckets = _M_allocate_buckets(__ht._M_bucket_count); + _M_bucket_count = __ht._M_bucket_count; + } + else + __builtin_memset(_M_buckets, 0, + _M_bucket_count * sizeof(__bucket_type)); + + __try + { + __hashtable_base::operator=(__ht); + _M_element_count = __ht._M_element_count; + _M_rehash_policy = __ht._M_rehash_policy; + __reuse_or_alloc_node_type __roan(_M_begin(), *this); + _M_before_begin._M_nxt = nullptr; + _M_assign(__ht, + [&__roan](const __node_type* __n) + { return __roan(__n->_M_v()); }); + if (__former_buckets) + _M_deallocate_buckets(__former_buckets, __former_bucket_count); + } + __catch(...) + { + if (__former_buckets) + { + // Restore previous buckets. + _M_deallocate_buckets(); + _M_rehash_policy._M_reset(__former_state); + _M_buckets = __former_buckets; + _M_bucket_count = __former_bucket_count; + } + __builtin_memset(_M_buckets, 0, + _M_bucket_count * sizeof(__bucket_type)); + __throw_exception_again; + } + return *this; + } + + template + template + void + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _M_assign(const _Hashtable& __ht, const _NodeGenerator& __node_gen) + { + __bucket_type* __buckets = nullptr; + if (!_M_buckets) + _M_buckets = __buckets = _M_allocate_buckets(_M_bucket_count); + + __try + { + if (!__ht._M_before_begin._M_nxt) + return; + + // First deal with the special first node pointed to by + // _M_before_begin. + __node_type* __ht_n = __ht._M_begin(); + __node_type* __this_n = __node_gen(__ht_n); + this->_M_copy_code(__this_n, __ht_n); + _M_before_begin._M_nxt = __this_n; + _M_buckets[_M_bucket_index(__this_n)] = &_M_before_begin; + + // Then deal with other nodes. + __node_base* __prev_n = __this_n; + for (__ht_n = __ht_n->_M_next(); __ht_n; __ht_n = __ht_n->_M_next()) + { + __this_n = __node_gen(__ht_n); + __prev_n->_M_nxt = __this_n; + this->_M_copy_code(__this_n, __ht_n); + size_type __bkt = _M_bucket_index(__this_n); + if (!_M_buckets[__bkt]) + _M_buckets[__bkt] = __prev_n; + __prev_n = __this_n; + } + } + __catch(...) + { + clear(); + if (__buckets) + _M_deallocate_buckets(); + __throw_exception_again; + } + } + + template + void + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _M_reset() noexcept + { + _M_rehash_policy._M_reset(); + _M_bucket_count = 1; + _M_single_bucket = nullptr; + _M_buckets = &_M_single_bucket; + _M_before_begin._M_nxt = nullptr; + _M_element_count = 0; + } + + template + void + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _M_move_assign(_Hashtable&& __ht, std::true_type) + { + this->_M_deallocate_nodes(_M_begin()); + _M_deallocate_buckets(); + __hashtable_base::operator=(std::move(__ht)); + _M_rehash_policy = __ht._M_rehash_policy; + if (!__ht._M_uses_single_bucket()) + _M_buckets = __ht._M_buckets; + else + { + _M_buckets = &_M_single_bucket; + _M_single_bucket = __ht._M_single_bucket; + } + _M_bucket_count = __ht._M_bucket_count; + _M_before_begin._M_nxt = __ht._M_before_begin._M_nxt; + _M_element_count = __ht._M_element_count; + std::__alloc_on_move(this->_M_node_allocator(), __ht._M_node_allocator()); + + // Fix buckets containing the _M_before_begin pointers that can't be + // moved. + if (_M_begin()) + _M_buckets[_M_bucket_index(_M_begin())] = &_M_before_begin; + __ht._M_reset(); + } + + template + void + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _M_move_assign(_Hashtable&& __ht, std::false_type) + { + if (__ht._M_node_allocator() == this->_M_node_allocator()) + _M_move_assign(std::move(__ht), std::true_type()); + else + { + // Can't move memory, move elements then. + __bucket_type* __former_buckets = nullptr; + size_type __former_bucket_count = _M_bucket_count; + const __rehash_state& __former_state = _M_rehash_policy._M_state(); + + if (_M_bucket_count != __ht._M_bucket_count) + { + __former_buckets = _M_buckets; + _M_buckets = _M_allocate_buckets(__ht._M_bucket_count); + _M_bucket_count = __ht._M_bucket_count; + } + else + __builtin_memset(_M_buckets, 0, + _M_bucket_count * sizeof(__bucket_type)); + + __try + { + __hashtable_base::operator=(std::move(__ht)); + _M_element_count = __ht._M_element_count; + _M_rehash_policy = __ht._M_rehash_policy; + __reuse_or_alloc_node_type __roan(_M_begin(), *this); + _M_before_begin._M_nxt = nullptr; + _M_assign(__ht, + [&__roan](__node_type* __n) + { return __roan(std::move_if_noexcept(__n->_M_v())); }); + __ht.clear(); + } + __catch(...) + { + if (__former_buckets) + { + _M_deallocate_buckets(); + _M_rehash_policy._M_reset(__former_state); + _M_buckets = __former_buckets; + _M_bucket_count = __former_bucket_count; + } + __builtin_memset(_M_buckets, 0, + _M_bucket_count * sizeof(__bucket_type)); + __throw_exception_again; + } + } + } + + template + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _Hashtable(const _Hashtable& __ht) + : __hashtable_base(__ht), + __map_base(__ht), + __rehash_base(__ht), + __hashtable_alloc( + __node_alloc_traits::_S_select_on_copy(__ht._M_node_allocator())), + _M_buckets(nullptr), + _M_bucket_count(__ht._M_bucket_count), + _M_element_count(__ht._M_element_count), + _M_rehash_policy(__ht._M_rehash_policy) + { + _M_assign(__ht, + [this](const __node_type* __n) + { return this->_M_allocate_node(__n->_M_v()); }); + } + + template + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _Hashtable(_Hashtable&& __ht) noexcept + : __hashtable_base(__ht), + __map_base(__ht), + __rehash_base(__ht), + __hashtable_alloc(std::move(__ht._M_base_alloc())), + _M_buckets(__ht._M_buckets), + _M_bucket_count(__ht._M_bucket_count), + _M_before_begin(__ht._M_before_begin._M_nxt), + _M_element_count(__ht._M_element_count), + _M_rehash_policy(__ht._M_rehash_policy) + { + // Update, if necessary, buckets if __ht is using its single bucket. + if (__ht._M_uses_single_bucket()) + { + _M_buckets = &_M_single_bucket; + _M_single_bucket = __ht._M_single_bucket; + } + + // Update, if necessary, bucket pointing to before begin that hasn't + // moved. + if (_M_begin()) + _M_buckets[_M_bucket_index(_M_begin())] = &_M_before_begin; + + __ht._M_reset(); + } + + template + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _Hashtable(const _Hashtable& __ht, const allocator_type& __a) + : __hashtable_base(__ht), + __map_base(__ht), + __rehash_base(__ht), + __hashtable_alloc(__node_alloc_type(__a)), + _M_buckets(), + _M_bucket_count(__ht._M_bucket_count), + _M_element_count(__ht._M_element_count), + _M_rehash_policy(__ht._M_rehash_policy) + { + _M_assign(__ht, + [this](const __node_type* __n) + { return this->_M_allocate_node(__n->_M_v()); }); + } + + template + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _Hashtable(_Hashtable&& __ht, const allocator_type& __a) + : __hashtable_base(__ht), + __map_base(__ht), + __rehash_base(__ht), + __hashtable_alloc(__node_alloc_type(__a)), + _M_buckets(nullptr), + _M_bucket_count(__ht._M_bucket_count), + _M_element_count(__ht._M_element_count), + _M_rehash_policy(__ht._M_rehash_policy) + { + if (__ht._M_node_allocator() == this->_M_node_allocator()) + { + if (__ht._M_uses_single_bucket()) + { + _M_buckets = &_M_single_bucket; + _M_single_bucket = __ht._M_single_bucket; + } + else + _M_buckets = __ht._M_buckets; + + _M_before_begin._M_nxt = __ht._M_before_begin._M_nxt; + // Update, if necessary, bucket pointing to before begin that hasn't + // moved. + if (_M_begin()) + _M_buckets[_M_bucket_index(_M_begin())] = &_M_before_begin; + __ht._M_reset(); + } + else + { + _M_assign(__ht, + [this](__node_type* __n) + { + return this->_M_allocate_node( + std::move_if_noexcept(__n->_M_v())); + }); + __ht.clear(); + } + } + + template + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + ~_Hashtable() noexcept + { + clear(); + _M_deallocate_buckets(); + } + + template + void + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + swap(_Hashtable& __x) + noexcept(__and_<__is_nothrow_swappable<_H1>, + __is_nothrow_swappable<_Equal>>::value) + { + // The only base class with member variables is hash_code_base. + // We define _Hash_code_base::_M_swap because different + // specializations have different members. + this->_M_swap(__x); + + std::__alloc_on_swap(this->_M_node_allocator(), __x._M_node_allocator()); + std::swap(_M_rehash_policy, __x._M_rehash_policy); + + // Deal properly with potentially moved instances. + if (this->_M_uses_single_bucket()) + { + if (!__x._M_uses_single_bucket()) + { + _M_buckets = __x._M_buckets; + __x._M_buckets = &__x._M_single_bucket; + } + } + else if (__x._M_uses_single_bucket()) + { + __x._M_buckets = _M_buckets; + _M_buckets = &_M_single_bucket; + } + else + std::swap(_M_buckets, __x._M_buckets); + + std::swap(_M_bucket_count, __x._M_bucket_count); + std::swap(_M_before_begin._M_nxt, __x._M_before_begin._M_nxt); + std::swap(_M_element_count, __x._M_element_count); + std::swap(_M_single_bucket, __x._M_single_bucket); + + // Fix buckets containing the _M_before_begin pointers that can't be + // swapped. + if (_M_begin()) + _M_buckets[_M_bucket_index(_M_begin())] = &_M_before_begin; + + if (__x._M_begin()) + __x._M_buckets[__x._M_bucket_index(__x._M_begin())] + = &__x._M_before_begin; + } + + template + auto + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + find(const key_type& __k) + -> iterator + { + __hash_code __code = this->_M_hash_code(__k); + std::size_t __n = _M_bucket_index(__k, __code); + __node_type* __p = _M_find_node(__n, __k, __code); + return __p ? iterator(__p) : end(); + } + + template + auto + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + find(const key_type& __k) const + -> const_iterator + { + __hash_code __code = this->_M_hash_code(__k); + std::size_t __n = _M_bucket_index(__k, __code); + __node_type* __p = _M_find_node(__n, __k, __code); + return __p ? const_iterator(__p) : end(); + } + + template + auto + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + count(const key_type& __k) const + -> size_type + { + __hash_code __code = this->_M_hash_code(__k); + std::size_t __n = _M_bucket_index(__k, __code); + __node_type* __p = _M_bucket_begin(__n); + if (!__p) + return 0; + + std::size_t __result = 0; + for (;; __p = __p->_M_next()) + { + if (this->_M_equals(__k, __code, __p)) + ++__result; + else if (__result) + // All equivalent values are next to each other, if we + // found a non-equivalent value after an equivalent one it + // means that we won't find any new equivalent value. + break; + if (!__p->_M_nxt || _M_bucket_index(__p->_M_next()) != __n) + break; + } + return __result; + } + + template + auto + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + equal_range(const key_type& __k) + -> pair + { + __hash_code __code = this->_M_hash_code(__k); + std::size_t __n = _M_bucket_index(__k, __code); + __node_type* __p = _M_find_node(__n, __k, __code); + + if (__p) + { + __node_type* __p1 = __p->_M_next(); + while (__p1 && _M_bucket_index(__p1) == __n + && this->_M_equals(__k, __code, __p1)) + __p1 = __p1->_M_next(); + + return std::make_pair(iterator(__p), iterator(__p1)); + } + else + return std::make_pair(end(), end()); + } + + template + auto + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + equal_range(const key_type& __k) const + -> pair + { + __hash_code __code = this->_M_hash_code(__k); + std::size_t __n = _M_bucket_index(__k, __code); + __node_type* __p = _M_find_node(__n, __k, __code); + + if (__p) + { + __node_type* __p1 = __p->_M_next(); + while (__p1 && _M_bucket_index(__p1) == __n + && this->_M_equals(__k, __code, __p1)) + __p1 = __p1->_M_next(); + + return std::make_pair(const_iterator(__p), const_iterator(__p1)); + } + else + return std::make_pair(end(), end()); + } + + // Find the node whose key compares equal to k in the bucket n. + // Return nullptr if no node is found. + template + auto + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _M_find_before_node(size_type __n, const key_type& __k, + __hash_code __code) const + -> __node_base* + { + __node_base* __prev_p = _M_buckets[__n]; + if (!__prev_p) + return nullptr; + + for (__node_type* __p = static_cast<__node_type*>(__prev_p->_M_nxt);; + __p = __p->_M_next()) + { + if (this->_M_equals(__k, __code, __p)) + return __prev_p; + + if (!__p->_M_nxt || _M_bucket_index(__p->_M_next()) != __n) + break; + __prev_p = __p; + } + return nullptr; + } + + template + void + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _M_insert_bucket_begin(size_type __bkt, __node_type* __node) + { + if (_M_buckets[__bkt]) + { + // Bucket is not empty, we just need to insert the new node + // after the bucket before begin. + __node->_M_nxt = _M_buckets[__bkt]->_M_nxt; + _M_buckets[__bkt]->_M_nxt = __node; + } + else + { + // The bucket is empty, the new node is inserted at the + // beginning of the singly-linked list and the bucket will + // contain _M_before_begin pointer. + __node->_M_nxt = _M_before_begin._M_nxt; + _M_before_begin._M_nxt = __node; + if (__node->_M_nxt) + // We must update former begin bucket that is pointing to + // _M_before_begin. + _M_buckets[_M_bucket_index(__node->_M_next())] = __node; + _M_buckets[__bkt] = &_M_before_begin; + } + } + + template + void + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _M_remove_bucket_begin(size_type __bkt, __node_type* __next, + size_type __next_bkt) + { + if (!__next || __next_bkt != __bkt) + { + // Bucket is now empty + // First update next bucket if any + if (__next) + _M_buckets[__next_bkt] = _M_buckets[__bkt]; + + // Second update before begin node if necessary + if (&_M_before_begin == _M_buckets[__bkt]) + _M_before_begin._M_nxt = __next; + _M_buckets[__bkt] = nullptr; + } + } + + template + auto + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _M_get_previous_node(size_type __bkt, __node_base* __n) + -> __node_base* + { + __node_base* __prev_n = _M_buckets[__bkt]; + while (__prev_n->_M_nxt != __n) + __prev_n = __prev_n->_M_nxt; + return __prev_n; + } + + template + template + auto + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _M_emplace(std::true_type, _Args&&... __args) + -> pair + { + // First build the node to get access to the hash code + __node_type* __node = this->_M_allocate_node(std::forward<_Args>(__args)...); + const key_type& __k = this->_M_extract()(__node->_M_v()); + __hash_code __code; + __try + { + __code = this->_M_hash_code(__k); + } + __catch(...) + { + this->_M_deallocate_node(__node); + __throw_exception_again; + } + + size_type __bkt = _M_bucket_index(__k, __code); + if (__node_type* __p = _M_find_node(__bkt, __k, __code)) + { + // There is already an equivalent node, no insertion + this->_M_deallocate_node(__node); + return std::make_pair(iterator(__p), false); + } + + // Insert the node + return std::make_pair(_M_insert_unique_node(__bkt, __code, __node), + true); + } + + template + template + auto + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _M_emplace(const_iterator __hint, std::false_type, _Args&&... __args) + -> iterator + { + // First build the node to get its hash code. + __node_type* __node = + this->_M_allocate_node(std::forward<_Args>(__args)...); + + __hash_code __code; + __try + { + __code = this->_M_hash_code(this->_M_extract()(__node->_M_v())); + } + __catch(...) + { + this->_M_deallocate_node(__node); + __throw_exception_again; + } + + return _M_insert_multi_node(__hint._M_cur, __code, __node); + } + + template + auto + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _M_insert_unique_node(size_type __bkt, __hash_code __code, + __node_type* __node) + -> iterator + { + const __rehash_state& __saved_state = _M_rehash_policy._M_state(); + std::pair __do_rehash + = _M_rehash_policy._M_need_rehash(_M_bucket_count, _M_element_count, 1); + + __try + { + if (__do_rehash.first) + { + _M_rehash(__do_rehash.second, __saved_state); + __bkt = _M_bucket_index(this->_M_extract()(__node->_M_v()), __code); + } + + this->_M_store_code(__node, __code); + + // Always insert at the beginning of the bucket. + _M_insert_bucket_begin(__bkt, __node); + ++_M_element_count; + return iterator(__node); + } + __catch(...) + { + this->_M_deallocate_node(__node); + __throw_exception_again; + } + } + + // Insert node, in bucket bkt if no rehash (assumes no element with its key + // already present). Take ownership of the node, deallocate it on exception. + template + auto + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _M_insert_multi_node(__node_type* __hint, __hash_code __code, + __node_type* __node) + -> iterator + { + const __rehash_state& __saved_state = _M_rehash_policy._M_state(); + std::pair __do_rehash + = _M_rehash_policy._M_need_rehash(_M_bucket_count, _M_element_count, 1); + + __try + { + if (__do_rehash.first) + _M_rehash(__do_rehash.second, __saved_state); + + this->_M_store_code(__node, __code); + const key_type& __k = this->_M_extract()(__node->_M_v()); + size_type __bkt = _M_bucket_index(__k, __code); + + // Find the node before an equivalent one or use hint if it exists and + // if it is equivalent. + __node_base* __prev + = __builtin_expect(__hint != nullptr, false) + && this->_M_equals(__k, __code, __hint) + ? __hint + : _M_find_before_node(__bkt, __k, __code); + if (__prev) + { + // Insert after the node before the equivalent one. + __node->_M_nxt = __prev->_M_nxt; + __prev->_M_nxt = __node; + if (__builtin_expect(__prev == __hint, false)) + // hint might be the last bucket node, in this case we need to + // update next bucket. + if (__node->_M_nxt + && !this->_M_equals(__k, __code, __node->_M_next())) + { + size_type __next_bkt = _M_bucket_index(__node->_M_next()); + if (__next_bkt != __bkt) + _M_buckets[__next_bkt] = __node; + } + } + else + // The inserted node has no equivalent in the + // hashtable. We must insert the new node at the + // beginning of the bucket to preserve equivalent + // elements' relative positions. + _M_insert_bucket_begin(__bkt, __node); + ++_M_element_count; + return iterator(__node); + } + __catch(...) + { + this->_M_deallocate_node(__node); + __throw_exception_again; + } + } + + // Insert v if no element with its key is already present. + template + template + auto + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _M_insert(_Arg&& __v, const _NodeGenerator& __node_gen, std::true_type) + -> pair + { + const key_type& __k = this->_M_extract()(__v); + __hash_code __code = this->_M_hash_code(__k); + size_type __bkt = _M_bucket_index(__k, __code); + + __node_type* __n = _M_find_node(__bkt, __k, __code); + if (__n) + return std::make_pair(iterator(__n), false); + + __n = __node_gen(std::forward<_Arg>(__v)); + return std::make_pair(_M_insert_unique_node(__bkt, __code, __n), true); + } + + // Insert v unconditionally. + template + template + auto + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _M_insert(const_iterator __hint, _Arg&& __v, + const _NodeGenerator& __node_gen, std::false_type) + -> iterator + { + // First compute the hash code so that we don't do anything if it + // throws. + __hash_code __code = this->_M_hash_code(this->_M_extract()(__v)); + + // Second allocate new node so that we don't rehash if it throws. + __node_type* __node = __node_gen(std::forward<_Arg>(__v)); + + return _M_insert_multi_node(__hint._M_cur, __code, __node); + } + + template + auto + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + erase(const_iterator __it) + -> iterator + { + __node_type* __n = __it._M_cur; + std::size_t __bkt = _M_bucket_index(__n); + + // Look for previous node to unlink it from the erased one, this + // is why we need buckets to contain the before begin to make + // this search fast. + __node_base* __prev_n = _M_get_previous_node(__bkt, __n); + return _M_erase(__bkt, __prev_n, __n); + } + + template + auto + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _M_erase(size_type __bkt, __node_base* __prev_n, __node_type* __n) + -> iterator + { + if (__prev_n == _M_buckets[__bkt]) + _M_remove_bucket_begin(__bkt, __n->_M_next(), + __n->_M_nxt ? _M_bucket_index(__n->_M_next()) : 0); + else if (__n->_M_nxt) + { + size_type __next_bkt = _M_bucket_index(__n->_M_next()); + if (__next_bkt != __bkt) + _M_buckets[__next_bkt] = __prev_n; + } + + __prev_n->_M_nxt = __n->_M_nxt; + iterator __result(__n->_M_next()); + this->_M_deallocate_node(__n); + --_M_element_count; + + return __result; + } + + template + auto + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _M_erase(std::true_type, const key_type& __k) + -> size_type + { + __hash_code __code = this->_M_hash_code(__k); + std::size_t __bkt = _M_bucket_index(__k, __code); + + // Look for the node before the first matching node. + __node_base* __prev_n = _M_find_before_node(__bkt, __k, __code); + if (!__prev_n) + return 0; + + // We found a matching node, erase it. + __node_type* __n = static_cast<__node_type*>(__prev_n->_M_nxt); + _M_erase(__bkt, __prev_n, __n); + return 1; + } + + template + auto + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _M_erase(std::false_type, const key_type& __k) + -> size_type + { + __hash_code __code = this->_M_hash_code(__k); + std::size_t __bkt = _M_bucket_index(__k, __code); + + // Look for the node before the first matching node. + __node_base* __prev_n = _M_find_before_node(__bkt, __k, __code); + if (!__prev_n) + return 0; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 526. Is it undefined if a function in the standard changes + // in parameters? + // We use one loop to find all matching nodes and another to deallocate + // them so that the key stays valid during the first loop. It might be + // invalidated indirectly when destroying nodes. + __node_type* __n = static_cast<__node_type*>(__prev_n->_M_nxt); + __node_type* __n_last = __n; + std::size_t __n_last_bkt = __bkt; + do + { + __n_last = __n_last->_M_next(); + if (!__n_last) + break; + __n_last_bkt = _M_bucket_index(__n_last); + } + while (__n_last_bkt == __bkt && this->_M_equals(__k, __code, __n_last)); + + // Deallocate nodes. + size_type __result = 0; + do + { + __node_type* __p = __n->_M_next(); + this->_M_deallocate_node(__n); + __n = __p; + ++__result; + --_M_element_count; + } + while (__n != __n_last); + + if (__prev_n == _M_buckets[__bkt]) + _M_remove_bucket_begin(__bkt, __n_last, __n_last_bkt); + else if (__n_last && __n_last_bkt != __bkt) + _M_buckets[__n_last_bkt] = __prev_n; + __prev_n->_M_nxt = __n_last; + return __result; + } + + template + auto + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + erase(const_iterator __first, const_iterator __last) + -> iterator + { + __node_type* __n = __first._M_cur; + __node_type* __last_n = __last._M_cur; + if (__n == __last_n) + return iterator(__n); + + std::size_t __bkt = _M_bucket_index(__n); + + __node_base* __prev_n = _M_get_previous_node(__bkt, __n); + bool __is_bucket_begin = __n == _M_bucket_begin(__bkt); + std::size_t __n_bkt = __bkt; + for (;;) + { + do + { + __node_type* __tmp = __n; + __n = __n->_M_next(); + this->_M_deallocate_node(__tmp); + --_M_element_count; + if (!__n) + break; + __n_bkt = _M_bucket_index(__n); + } + while (__n != __last_n && __n_bkt == __bkt); + if (__is_bucket_begin) + _M_remove_bucket_begin(__bkt, __n, __n_bkt); + if (__n == __last_n) + break; + __is_bucket_begin = true; + __bkt = __n_bkt; + } + + if (__n && (__n_bkt != __bkt || __is_bucket_begin)) + _M_buckets[__n_bkt] = __prev_n; + __prev_n->_M_nxt = __n; + return iterator(__n); + } + + template + void + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + clear() noexcept + { + this->_M_deallocate_nodes(_M_begin()); + __builtin_memset(_M_buckets, 0, _M_bucket_count * sizeof(__bucket_type)); + _M_element_count = 0; + _M_before_begin._M_nxt = nullptr; + } + + template + void + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + rehash(size_type __n) + { + const __rehash_state& __saved_state = _M_rehash_policy._M_state(); + std::size_t __buckets + = std::max(_M_rehash_policy._M_bkt_for_elements(_M_element_count + 1), + __n); + __buckets = _M_rehash_policy._M_next_bkt(__buckets); + + if (__buckets != _M_bucket_count) + _M_rehash(__buckets, __saved_state); + else + // No rehash, restore previous state to keep a consistent state. + _M_rehash_policy._M_reset(__saved_state); + } + + template + void + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _M_rehash(size_type __n, const __rehash_state& __state) + { + __try + { + _M_rehash_aux(__n, __unique_keys()); + } + __catch(...) + { + // A failure here means that buckets allocation failed. We only + // have to restore hash policy previous state. + _M_rehash_policy._M_reset(__state); + __throw_exception_again; + } + } + + // Rehash when there is no equivalent elements. + template + void + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _M_rehash_aux(size_type __n, std::true_type) + { + __bucket_type* __new_buckets = _M_allocate_buckets(__n); + __node_type* __p = _M_begin(); + _M_before_begin._M_nxt = nullptr; + std::size_t __bbegin_bkt = 0; + while (__p) + { + __node_type* __next = __p->_M_next(); + std::size_t __bkt = __hash_code_base::_M_bucket_index(__p, __n); + if (!__new_buckets[__bkt]) + { + __p->_M_nxt = _M_before_begin._M_nxt; + _M_before_begin._M_nxt = __p; + __new_buckets[__bkt] = &_M_before_begin; + if (__p->_M_nxt) + __new_buckets[__bbegin_bkt] = __p; + __bbegin_bkt = __bkt; + } + else + { + __p->_M_nxt = __new_buckets[__bkt]->_M_nxt; + __new_buckets[__bkt]->_M_nxt = __p; + } + __p = __next; + } + + _M_deallocate_buckets(); + _M_bucket_count = __n; + _M_buckets = __new_buckets; + } + + // Rehash when there can be equivalent elements, preserve their relative + // order. + template + void + _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>:: + _M_rehash_aux(size_type __n, std::false_type) + { + __bucket_type* __new_buckets = _M_allocate_buckets(__n); + + __node_type* __p = _M_begin(); + _M_before_begin._M_nxt = nullptr; + std::size_t __bbegin_bkt = 0; + std::size_t __prev_bkt = 0; + __node_type* __prev_p = nullptr; + bool __check_bucket = false; + + while (__p) + { + __node_type* __next = __p->_M_next(); + std::size_t __bkt = __hash_code_base::_M_bucket_index(__p, __n); + + if (__prev_p && __prev_bkt == __bkt) + { + // Previous insert was already in this bucket, we insert after + // the previously inserted one to preserve equivalent elements + // relative order. + __p->_M_nxt = __prev_p->_M_nxt; + __prev_p->_M_nxt = __p; + + // Inserting after a node in a bucket require to check that we + // haven't change the bucket last node, in this case next + // bucket containing its before begin node must be updated. We + // schedule a check as soon as we move out of the sequence of + // equivalent nodes to limit the number of checks. + __check_bucket = true; + } + else + { + if (__check_bucket) + { + // Check if we shall update the next bucket because of + // insertions into __prev_bkt bucket. + if (__prev_p->_M_nxt) + { + std::size_t __next_bkt + = __hash_code_base::_M_bucket_index(__prev_p->_M_next(), + __n); + if (__next_bkt != __prev_bkt) + __new_buckets[__next_bkt] = __prev_p; + } + __check_bucket = false; + } + + if (!__new_buckets[__bkt]) + { + __p->_M_nxt = _M_before_begin._M_nxt; + _M_before_begin._M_nxt = __p; + __new_buckets[__bkt] = &_M_before_begin; + if (__p->_M_nxt) + __new_buckets[__bbegin_bkt] = __p; + __bbegin_bkt = __bkt; + } + else + { + __p->_M_nxt = __new_buckets[__bkt]->_M_nxt; + __new_buckets[__bkt]->_M_nxt = __p; + } + } + __prev_p = __p; + __prev_bkt = __bkt; + __p = __next; + } + + if (__check_bucket && __prev_p->_M_nxt) + { + std::size_t __next_bkt + = __hash_code_base::_M_bucket_index(__prev_p->_M_next(), __n); + if (__next_bkt != __prev_bkt) + __new_buckets[__next_bkt] = __prev_p; + } + + _M_deallocate_buckets(); + _M_bucket_count = __n; + _M_buckets = __new_buckets; + } + +#if __cplusplus > 201402L + template class _Hash_merge_helper { }; +#endif // C++17 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // _HASHTABLE_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/hashtable_policy.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/hashtable_policy.h new file mode 100644 index 0000000..8af8c49 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/hashtable_policy.h @@ -0,0 +1,2129 @@ +// Internal policy header for unordered_set and unordered_map -*- C++ -*- + +// Copyright (C) 2010-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/hashtable_policy.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. + * @headername{unordered_map,unordered_set} + */ + +#ifndef _HASHTABLE_POLICY_H +#define _HASHTABLE_POLICY_H 1 + +#include // for std::min. + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + class _Hashtable; + +_GLIBCXX_END_NAMESPACE_VERSION + +namespace __detail +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @defgroup hashtable-detail Base and Implementation Classes + * @ingroup unordered_associative_containers + * @{ + */ + template + struct _Hashtable_base; + + // Helper function: return distance(first, last) for forward + // iterators, or 0 for input iterators. + template + inline typename std::iterator_traits<_Iterator>::difference_type + __distance_fw(_Iterator __first, _Iterator __last, + std::input_iterator_tag) + { return 0; } + + template + inline typename std::iterator_traits<_Iterator>::difference_type + __distance_fw(_Iterator __first, _Iterator __last, + std::forward_iterator_tag) + { return std::distance(__first, __last); } + + template + inline typename std::iterator_traits<_Iterator>::difference_type + __distance_fw(_Iterator __first, _Iterator __last) + { + typedef typename std::iterator_traits<_Iterator>::iterator_category _Tag; + return __distance_fw(__first, __last, _Tag()); + } + + // Helper type used to detect whether the hash functor is noexcept. + template + struct __is_noexcept_hash : std::__bool_constant< + noexcept(declval()(declval()))> + { }; + + struct _Identity + { + template + _Tp&& + operator()(_Tp&& __x) const + { return std::forward<_Tp>(__x); } + }; + + struct _Select1st + { + template + auto + operator()(_Tp&& __x) const + -> decltype(std::get<0>(std::forward<_Tp>(__x))) + { return std::get<0>(std::forward<_Tp>(__x)); } + }; + + template + struct _Hashtable_alloc; + + // Functor recycling a pool of nodes and using allocation once the pool is + // empty. + template + struct _ReuseOrAllocNode + { + private: + using __node_alloc_type = _NodeAlloc; + using __hashtable_alloc = _Hashtable_alloc<__node_alloc_type>; + using __value_alloc_type = typename __hashtable_alloc::__value_alloc_type; + using __value_alloc_traits = + typename __hashtable_alloc::__value_alloc_traits; + using __node_alloc_traits = + typename __hashtable_alloc::__node_alloc_traits; + using __node_type = typename __hashtable_alloc::__node_type; + + public: + _ReuseOrAllocNode(__node_type* __nodes, __hashtable_alloc& __h) + : _M_nodes(__nodes), _M_h(__h) { } + _ReuseOrAllocNode(const _ReuseOrAllocNode&) = delete; + + ~_ReuseOrAllocNode() + { _M_h._M_deallocate_nodes(_M_nodes); } + + template + __node_type* + operator()(_Arg&& __arg) const + { + if (_M_nodes) + { + __node_type* __node = _M_nodes; + _M_nodes = _M_nodes->_M_next(); + __node->_M_nxt = nullptr; + __value_alloc_type __a(_M_h._M_node_allocator()); + __value_alloc_traits::destroy(__a, __node->_M_valptr()); + __try + { + __value_alloc_traits::construct(__a, __node->_M_valptr(), + std::forward<_Arg>(__arg)); + } + __catch(...) + { + __node->~__node_type(); + __node_alloc_traits::deallocate(_M_h._M_node_allocator(), + __node, 1); + __throw_exception_again; + } + return __node; + } + return _M_h._M_allocate_node(std::forward<_Arg>(__arg)); + } + + private: + mutable __node_type* _M_nodes; + __hashtable_alloc& _M_h; + }; + + // Functor similar to the previous one but without any pool of nodes to + // recycle. + template + struct _AllocNode + { + private: + using __hashtable_alloc = _Hashtable_alloc<_NodeAlloc>; + using __node_type = typename __hashtable_alloc::__node_type; + + public: + _AllocNode(__hashtable_alloc& __h) + : _M_h(__h) { } + + template + __node_type* + operator()(_Arg&& __arg) const + { return _M_h._M_allocate_node(std::forward<_Arg>(__arg)); } + + private: + __hashtable_alloc& _M_h; + }; + + // Auxiliary types used for all instantiations of _Hashtable nodes + // and iterators. + + /** + * struct _Hashtable_traits + * + * Important traits for hash tables. + * + * @tparam _Cache_hash_code Boolean value. True if the value of + * the hash function is stored along with the value. This is a + * time-space tradeoff. Storing it may improve lookup speed by + * reducing the number of times we need to call the _Equal + * function. + * + * @tparam _Constant_iterators Boolean value. True if iterator and + * const_iterator are both constant iterator types. This is true + * for unordered_set and unordered_multiset, false for + * unordered_map and unordered_multimap. + * + * @tparam _Unique_keys Boolean value. True if the return value + * of _Hashtable::count(k) is always at most one, false if it may + * be an arbitrary number. This is true for unordered_set and + * unordered_map, false for unordered_multiset and + * unordered_multimap. + */ + template + struct _Hashtable_traits + { + using __hash_cached = __bool_constant<_Cache_hash_code>; + using __constant_iterators = __bool_constant<_Constant_iterators>; + using __unique_keys = __bool_constant<_Unique_keys>; + }; + + /** + * struct _Hash_node_base + * + * Nodes, used to wrap elements stored in the hash table. A policy + * template parameter of class template _Hashtable controls whether + * nodes also store a hash code. In some cases (e.g. strings) this + * may be a performance win. + */ + struct _Hash_node_base + { + _Hash_node_base* _M_nxt; + + _Hash_node_base() noexcept : _M_nxt() { } + + _Hash_node_base(_Hash_node_base* __next) noexcept : _M_nxt(__next) { } + }; + + /** + * struct _Hash_node_value_base + * + * Node type with the value to store. + */ + template + struct _Hash_node_value_base : _Hash_node_base + { + typedef _Value value_type; + + __gnu_cxx::__aligned_buffer<_Value> _M_storage; + + _Value* + _M_valptr() noexcept + { return _M_storage._M_ptr(); } + + const _Value* + _M_valptr() const noexcept + { return _M_storage._M_ptr(); } + + _Value& + _M_v() noexcept + { return *_M_valptr(); } + + const _Value& + _M_v() const noexcept + { return *_M_valptr(); } + }; + + /** + * Primary template struct _Hash_node. + */ + template + struct _Hash_node; + + /** + * Specialization for nodes with caches, struct _Hash_node. + * + * Base class is __detail::_Hash_node_value_base. + */ + template + struct _Hash_node<_Value, true> : _Hash_node_value_base<_Value> + { + std::size_t _M_hash_code; + + _Hash_node* + _M_next() const noexcept + { return static_cast<_Hash_node*>(this->_M_nxt); } + }; + + /** + * Specialization for nodes without caches, struct _Hash_node. + * + * Base class is __detail::_Hash_node_value_base. + */ + template + struct _Hash_node<_Value, false> : _Hash_node_value_base<_Value> + { + _Hash_node* + _M_next() const noexcept + { return static_cast<_Hash_node*>(this->_M_nxt); } + }; + + /// Base class for node iterators. + template + struct _Node_iterator_base + { + using __node_type = _Hash_node<_Value, _Cache_hash_code>; + + __node_type* _M_cur; + + _Node_iterator_base(__node_type* __p) noexcept + : _M_cur(__p) { } + + void + _M_incr() noexcept + { _M_cur = _M_cur->_M_next(); } + }; + + template + inline bool + operator==(const _Node_iterator_base<_Value, _Cache_hash_code>& __x, + const _Node_iterator_base<_Value, _Cache_hash_code >& __y) + noexcept + { return __x._M_cur == __y._M_cur; } + + template + inline bool + operator!=(const _Node_iterator_base<_Value, _Cache_hash_code>& __x, + const _Node_iterator_base<_Value, _Cache_hash_code>& __y) + noexcept + { return __x._M_cur != __y._M_cur; } + + /// Node iterators, used to iterate through all the hashtable. + template + struct _Node_iterator + : public _Node_iterator_base<_Value, __cache> + { + private: + using __base_type = _Node_iterator_base<_Value, __cache>; + using __node_type = typename __base_type::__node_type; + + public: + typedef _Value value_type; + typedef std::ptrdiff_t difference_type; + typedef std::forward_iterator_tag iterator_category; + + using pointer = typename std::conditional<__constant_iterators, + const _Value*, _Value*>::type; + + using reference = typename std::conditional<__constant_iterators, + const _Value&, _Value&>::type; + + _Node_iterator() noexcept + : __base_type(0) { } + + explicit + _Node_iterator(__node_type* __p) noexcept + : __base_type(__p) { } + + reference + operator*() const noexcept + { return this->_M_cur->_M_v(); } + + pointer + operator->() const noexcept + { return this->_M_cur->_M_valptr(); } + + _Node_iterator& + operator++() noexcept + { + this->_M_incr(); + return *this; + } + + _Node_iterator + operator++(int) noexcept + { + _Node_iterator __tmp(*this); + this->_M_incr(); + return __tmp; + } + }; + + /// Node const_iterators, used to iterate through all the hashtable. + template + struct _Node_const_iterator + : public _Node_iterator_base<_Value, __cache> + { + private: + using __base_type = _Node_iterator_base<_Value, __cache>; + using __node_type = typename __base_type::__node_type; + + public: + typedef _Value value_type; + typedef std::ptrdiff_t difference_type; + typedef std::forward_iterator_tag iterator_category; + + typedef const _Value* pointer; + typedef const _Value& reference; + + _Node_const_iterator() noexcept + : __base_type(0) { } + + explicit + _Node_const_iterator(__node_type* __p) noexcept + : __base_type(__p) { } + + _Node_const_iterator(const _Node_iterator<_Value, __constant_iterators, + __cache>& __x) noexcept + : __base_type(__x._M_cur) { } + + reference + operator*() const noexcept + { return this->_M_cur->_M_v(); } + + pointer + operator->() const noexcept + { return this->_M_cur->_M_valptr(); } + + _Node_const_iterator& + operator++() noexcept + { + this->_M_incr(); + return *this; + } + + _Node_const_iterator + operator++(int) noexcept + { + _Node_const_iterator __tmp(*this); + this->_M_incr(); + return __tmp; + } + }; + + // Many of class template _Hashtable's template parameters are policy + // classes. These are defaults for the policies. + + /// Default range hashing function: use division to fold a large number + /// into the range [0, N). + struct _Mod_range_hashing + { + typedef std::size_t first_argument_type; + typedef std::size_t second_argument_type; + typedef std::size_t result_type; + + result_type + operator()(first_argument_type __num, + second_argument_type __den) const noexcept + { return __num % __den; } + }; + + /// Default ranged hash function H. In principle it should be a + /// function object composed from objects of type H1 and H2 such that + /// h(k, N) = h2(h1(k), N), but that would mean making extra copies of + /// h1 and h2. So instead we'll just use a tag to tell class template + /// hashtable to do that composition. + struct _Default_ranged_hash { }; + + /// Default value for rehash policy. Bucket size is (usually) the + /// smallest prime that keeps the load factor small enough. + struct _Prime_rehash_policy + { + using __has_load_factor = std::true_type; + + _Prime_rehash_policy(float __z = 1.0) noexcept + : _M_max_load_factor(__z), _M_next_resize(0) { } + + float + max_load_factor() const noexcept + { return _M_max_load_factor; } + + // Return a bucket size no smaller than n. + std::size_t + _M_next_bkt(std::size_t __n) const; + + // Return a bucket count appropriate for n elements + std::size_t + _M_bkt_for_elements(std::size_t __n) const + { return __builtin_ceil(__n / (long double)_M_max_load_factor); } + + // __n_bkt is current bucket count, __n_elt is current element count, + // and __n_ins is number of elements to be inserted. Do we need to + // increase bucket count? If so, return make_pair(true, n), where n + // is the new bucket count. If not, return make_pair(false, 0). + std::pair + _M_need_rehash(std::size_t __n_bkt, std::size_t __n_elt, + std::size_t __n_ins) const; + + typedef std::size_t _State; + + _State + _M_state() const + { return _M_next_resize; } + + void + _M_reset() noexcept + { _M_next_resize = 0; } + + void + _M_reset(_State __state) + { _M_next_resize = __state; } + + static const std::size_t _S_growth_factor = 2; + + float _M_max_load_factor; + mutable std::size_t _M_next_resize; + }; + + /// Range hashing function assuming that second arg is a power of 2. + struct _Mask_range_hashing + { + typedef std::size_t first_argument_type; + typedef std::size_t second_argument_type; + typedef std::size_t result_type; + + result_type + operator()(first_argument_type __num, + second_argument_type __den) const noexcept + { return __num & (__den - 1); } + }; + + /// Compute closest power of 2. + _GLIBCXX14_CONSTEXPR + inline std::size_t + __clp2(std::size_t __n) noexcept + { +#if __SIZEOF_SIZE_T__ >= 8 + std::uint_fast64_t __x = __n; +#else + std::uint_fast32_t __x = __n; +#endif + // Algorithm from Hacker's Delight, Figure 3-3. + __x = __x - 1; + __x = __x | (__x >> 1); + __x = __x | (__x >> 2); + __x = __x | (__x >> 4); + __x = __x | (__x >> 8); + __x = __x | (__x >>16); +#if __SIZEOF_SIZE_T__ >= 8 + __x = __x | (__x >>32); +#endif + return __x + 1; + } + + /// Rehash policy providing power of 2 bucket numbers. Avoids modulo + /// operations. + struct _Power2_rehash_policy + { + using __has_load_factor = std::true_type; + + _Power2_rehash_policy(float __z = 1.0) noexcept + : _M_max_load_factor(__z), _M_next_resize(0) { } + + float + max_load_factor() const noexcept + { return _M_max_load_factor; } + + // Return a bucket size no smaller than n (as long as n is not above the + // highest power of 2). + std::size_t + _M_next_bkt(std::size_t __n) noexcept + { + const auto __max_width = std::min(sizeof(size_t), 8); + const auto __max_bkt = size_t(1) << (__max_width * __CHAR_BIT__ - 1); + std::size_t __res = __clp2(__n); + + if (__res == __n) + __res <<= 1; + + if (__res == 0) + __res = __max_bkt; + + if (__res == __max_bkt) + // Set next resize to the max value so that we never try to rehash again + // as we already reach the biggest possible bucket number. + // Note that it might result in max_load_factor not being respected. + _M_next_resize = std::size_t(-1); + else + _M_next_resize + = __builtin_ceil(__res * (long double)_M_max_load_factor); + + return __res; + } + + // Return a bucket count appropriate for n elements + std::size_t + _M_bkt_for_elements(std::size_t __n) const noexcept + { return __builtin_ceil(__n / (long double)_M_max_load_factor); } + + // __n_bkt is current bucket count, __n_elt is current element count, + // and __n_ins is number of elements to be inserted. Do we need to + // increase bucket count? If so, return make_pair(true, n), where n + // is the new bucket count. If not, return make_pair(false, 0). + std::pair + _M_need_rehash(std::size_t __n_bkt, std::size_t __n_elt, + std::size_t __n_ins) noexcept + { + if (__n_elt + __n_ins >= _M_next_resize) + { + long double __min_bkts = (__n_elt + __n_ins) + / (long double)_M_max_load_factor; + if (__min_bkts >= __n_bkt) + return std::make_pair(true, + _M_next_bkt(std::max(__builtin_floor(__min_bkts) + 1, + __n_bkt * _S_growth_factor))); + + _M_next_resize + = __builtin_floor(__n_bkt * (long double)_M_max_load_factor); + return std::make_pair(false, 0); + } + else + return std::make_pair(false, 0); + } + + typedef std::size_t _State; + + _State + _M_state() const noexcept + { return _M_next_resize; } + + void + _M_reset() noexcept + { _M_next_resize = 0; } + + void + _M_reset(_State __state) noexcept + { _M_next_resize = __state; } + + static const std::size_t _S_growth_factor = 2; + + float _M_max_load_factor; + std::size_t _M_next_resize; + }; + + // Base classes for std::_Hashtable. We define these base classes + // because in some cases we want to do different things depending on + // the value of a policy class. In some cases the policy class + // affects which member functions and nested typedefs are defined; + // we handle that by specializing base class templates. Several of + // the base class templates need to access other members of class + // template _Hashtable, so we use a variant of the "Curiously + // Recurring Template Pattern" (CRTP) technique. + + /** + * Primary class template _Map_base. + * + * If the hashtable has a value type of the form pair and a + * key extraction policy (_ExtractKey) that returns the first part + * of the pair, the hashtable gets a mapped_type typedef. If it + * satisfies those criteria and also has unique keys, then it also + * gets an operator[]. + */ + template + struct _Map_base { }; + + /// Partial specialization, __unique_keys set to false. + template + struct _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits, false> + { + using mapped_type = typename std::tuple_element<1, _Pair>::type; + }; + + /// Partial specialization, __unique_keys set to true. + template + struct _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits, true> + { + private: + using __hashtable_base = __detail::_Hashtable_base<_Key, _Pair, + _Select1st, + _Equal, _H1, _H2, _Hash, + _Traits>; + + using __hashtable = _Hashtable<_Key, _Pair, _Alloc, + _Select1st, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>; + + using __hash_code = typename __hashtable_base::__hash_code; + using __node_type = typename __hashtable_base::__node_type; + + public: + using key_type = typename __hashtable_base::key_type; + using iterator = typename __hashtable_base::iterator; + using mapped_type = typename std::tuple_element<1, _Pair>::type; + + mapped_type& + operator[](const key_type& __k); + + mapped_type& + operator[](key_type&& __k); + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 761. unordered_map needs an at() member function. + mapped_type& + at(const key_type& __k); + + const mapped_type& + at(const key_type& __k) const; + }; + + template + auto + _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits, true>:: + operator[](const key_type& __k) + -> mapped_type& + { + __hashtable* __h = static_cast<__hashtable*>(this); + __hash_code __code = __h->_M_hash_code(__k); + std::size_t __n = __h->_M_bucket_index(__k, __code); + __node_type* __p = __h->_M_find_node(__n, __k, __code); + + if (!__p) + { + __p = __h->_M_allocate_node(std::piecewise_construct, + std::tuple(__k), + std::tuple<>()); + return __h->_M_insert_unique_node(__n, __code, __p)->second; + } + + return __p->_M_v().second; + } + + template + auto + _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits, true>:: + operator[](key_type&& __k) + -> mapped_type& + { + __hashtable* __h = static_cast<__hashtable*>(this); + __hash_code __code = __h->_M_hash_code(__k); + std::size_t __n = __h->_M_bucket_index(__k, __code); + __node_type* __p = __h->_M_find_node(__n, __k, __code); + + if (!__p) + { + __p = __h->_M_allocate_node(std::piecewise_construct, + std::forward_as_tuple(std::move(__k)), + std::tuple<>()); + return __h->_M_insert_unique_node(__n, __code, __p)->second; + } + + return __p->_M_v().second; + } + + template + auto + _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits, true>:: + at(const key_type& __k) + -> mapped_type& + { + __hashtable* __h = static_cast<__hashtable*>(this); + __hash_code __code = __h->_M_hash_code(__k); + std::size_t __n = __h->_M_bucket_index(__k, __code); + __node_type* __p = __h->_M_find_node(__n, __k, __code); + + if (!__p) + __throw_out_of_range(__N("_Map_base::at")); + return __p->_M_v().second; + } + + template + auto + _Map_base<_Key, _Pair, _Alloc, _Select1st, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits, true>:: + at(const key_type& __k) const + -> const mapped_type& + { + const __hashtable* __h = static_cast(this); + __hash_code __code = __h->_M_hash_code(__k); + std::size_t __n = __h->_M_bucket_index(__k, __code); + __node_type* __p = __h->_M_find_node(__n, __k, __code); + + if (!__p) + __throw_out_of_range(__N("_Map_base::at")); + return __p->_M_v().second; + } + + /** + * Primary class template _Insert_base. + * + * Defines @c insert member functions appropriate to all _Hashtables. + */ + template + struct _Insert_base + { + protected: + using __hashtable = _Hashtable<_Key, _Value, _Alloc, _ExtractKey, + _Equal, _H1, _H2, _Hash, + _RehashPolicy, _Traits>; + + using __hashtable_base = _Hashtable_base<_Key, _Value, _ExtractKey, + _Equal, _H1, _H2, _Hash, + _Traits>; + + using value_type = typename __hashtable_base::value_type; + using iterator = typename __hashtable_base::iterator; + using const_iterator = typename __hashtable_base::const_iterator; + using size_type = typename __hashtable_base::size_type; + + using __unique_keys = typename __hashtable_base::__unique_keys; + using __ireturn_type = typename __hashtable_base::__ireturn_type; + using __node_type = _Hash_node<_Value, _Traits::__hash_cached::value>; + using __node_alloc_type = __alloc_rebind<_Alloc, __node_type>; + using __node_gen_type = _AllocNode<__node_alloc_type>; + + __hashtable& + _M_conjure_hashtable() + { return *(static_cast<__hashtable*>(this)); } + + template + void + _M_insert_range(_InputIterator __first, _InputIterator __last, + const _NodeGetter&); + + public: + __ireturn_type + insert(const value_type& __v) + { + __hashtable& __h = _M_conjure_hashtable(); + __node_gen_type __node_gen(__h); + return __h._M_insert(__v, __node_gen, __unique_keys()); + } + + iterator + insert(const_iterator __hint, const value_type& __v) + { + __hashtable& __h = _M_conjure_hashtable(); + __node_gen_type __node_gen(__h); + return __h._M_insert(__hint, __v, __node_gen, __unique_keys()); + } + + void + insert(initializer_list __l) + { this->insert(__l.begin(), __l.end()); } + + template + void + insert(_InputIterator __first, _InputIterator __last) + { + __hashtable& __h = _M_conjure_hashtable(); + __node_gen_type __node_gen(__h); + return _M_insert_range(__first, __last, __node_gen); + } + }; + + template + template + void + _Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, + _RehashPolicy, _Traits>:: + _M_insert_range(_InputIterator __first, _InputIterator __last, + const _NodeGetter& __node_gen) + { + using __rehash_type = typename __hashtable::__rehash_type; + using __rehash_state = typename __hashtable::__rehash_state; + using pair_type = std::pair; + + size_type __n_elt = __detail::__distance_fw(__first, __last); + + __hashtable& __h = _M_conjure_hashtable(); + __rehash_type& __rehash = __h._M_rehash_policy; + const __rehash_state& __saved_state = __rehash._M_state(); + pair_type __do_rehash = __rehash._M_need_rehash(__h._M_bucket_count, + __h._M_element_count, + __n_elt); + + if (__do_rehash.first) + __h._M_rehash(__do_rehash.second, __saved_state); + + for (; __first != __last; ++__first) + __h._M_insert(*__first, __node_gen, __unique_keys()); + } + + /** + * Primary class template _Insert. + * + * Defines @c insert member functions that depend on _Hashtable policies, + * via partial specializations. + */ + template + struct _Insert; + + /// Specialization. + template + struct _Insert<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, + _RehashPolicy, _Traits, true> + : public _Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits> + { + using __base_type = _Insert_base<_Key, _Value, _Alloc, _ExtractKey, + _Equal, _H1, _H2, _Hash, + _RehashPolicy, _Traits>; + + using __hashtable_base = _Hashtable_base<_Key, _Value, _ExtractKey, + _Equal, _H1, _H2, _Hash, + _Traits>; + + using value_type = typename __base_type::value_type; + using iterator = typename __base_type::iterator; + using const_iterator = typename __base_type::const_iterator; + + using __unique_keys = typename __base_type::__unique_keys; + using __ireturn_type = typename __hashtable_base::__ireturn_type; + using __hashtable = typename __base_type::__hashtable; + using __node_gen_type = typename __base_type::__node_gen_type; + + using __base_type::insert; + + __ireturn_type + insert(value_type&& __v) + { + __hashtable& __h = this->_M_conjure_hashtable(); + __node_gen_type __node_gen(__h); + return __h._M_insert(std::move(__v), __node_gen, __unique_keys()); + } + + iterator + insert(const_iterator __hint, value_type&& __v) + { + __hashtable& __h = this->_M_conjure_hashtable(); + __node_gen_type __node_gen(__h); + return __h._M_insert(__hint, std::move(__v), __node_gen, + __unique_keys()); + } + }; + + /// Specialization. + template + struct _Insert<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, + _RehashPolicy, _Traits, false> + : public _Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits> + { + using __base_type = _Insert_base<_Key, _Value, _Alloc, _ExtractKey, + _Equal, _H1, _H2, _Hash, + _RehashPolicy, _Traits>; + using value_type = typename __base_type::value_type; + using iterator = typename __base_type::iterator; + using const_iterator = typename __base_type::const_iterator; + + using __unique_keys = typename __base_type::__unique_keys; + using __hashtable = typename __base_type::__hashtable; + using __ireturn_type = typename __base_type::__ireturn_type; + + using __base_type::insert; + + template + using __is_cons = std::is_constructible; + + template + using _IFcons = std::enable_if<__is_cons<_Pair>::value>; + + template + using _IFconsp = typename _IFcons<_Pair>::type; + + template> + __ireturn_type + insert(_Pair&& __v) + { + __hashtable& __h = this->_M_conjure_hashtable(); + return __h._M_emplace(__unique_keys(), std::forward<_Pair>(__v)); + } + + template> + iterator + insert(const_iterator __hint, _Pair&& __v) + { + __hashtable& __h = this->_M_conjure_hashtable(); + return __h._M_emplace(__hint, __unique_keys(), + std::forward<_Pair>(__v)); + } + }; + + template + using __has_load_factor = typename _Policy::__has_load_factor; + + /** + * Primary class template _Rehash_base. + * + * Give hashtable the max_load_factor functions and reserve iff the + * rehash policy supports it. + */ + template> + struct _Rehash_base; + + /// Specialization when rehash policy doesn't provide load factor management. + template + struct _Rehash_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits, + std::false_type> + { + }; + + /// Specialization when rehash policy provide load factor management. + template + struct _Rehash_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits, + std::true_type> + { + using __hashtable = _Hashtable<_Key, _Value, _Alloc, _ExtractKey, + _Equal, _H1, _H2, _Hash, + _RehashPolicy, _Traits>; + + float + max_load_factor() const noexcept + { + const __hashtable* __this = static_cast(this); + return __this->__rehash_policy().max_load_factor(); + } + + void + max_load_factor(float __z) + { + __hashtable* __this = static_cast<__hashtable*>(this); + __this->__rehash_policy(_RehashPolicy(__z)); + } + + void + reserve(std::size_t __n) + { + __hashtable* __this = static_cast<__hashtable*>(this); + __this->rehash(__builtin_ceil(__n / max_load_factor())); + } + }; + + /** + * Primary class template _Hashtable_ebo_helper. + * + * Helper class using EBO when it is not forbidden (the type is not + * final) and when it is worth it (the type is empty.) + */ + template + struct _Hashtable_ebo_helper; + + /// Specialization using EBO. + template + struct _Hashtable_ebo_helper<_Nm, _Tp, true> + : private _Tp + { + _Hashtable_ebo_helper() = default; + + template + _Hashtable_ebo_helper(_OtherTp&& __tp) + : _Tp(std::forward<_OtherTp>(__tp)) + { } + + static const _Tp& + _S_cget(const _Hashtable_ebo_helper& __eboh) + { return static_cast(__eboh); } + + static _Tp& + _S_get(_Hashtable_ebo_helper& __eboh) + { return static_cast<_Tp&>(__eboh); } + }; + + /// Specialization not using EBO. + template + struct _Hashtable_ebo_helper<_Nm, _Tp, false> + { + _Hashtable_ebo_helper() = default; + + template + _Hashtable_ebo_helper(_OtherTp&& __tp) + : _M_tp(std::forward<_OtherTp>(__tp)) + { } + + static const _Tp& + _S_cget(const _Hashtable_ebo_helper& __eboh) + { return __eboh._M_tp; } + + static _Tp& + _S_get(_Hashtable_ebo_helper& __eboh) + { return __eboh._M_tp; } + + private: + _Tp _M_tp; + }; + + /** + * Primary class template _Local_iterator_base. + * + * Base class for local iterators, used to iterate within a bucket + * but not between buckets. + */ + template + struct _Local_iterator_base; + + /** + * Primary class template _Hash_code_base. + * + * Encapsulates two policy issues that aren't quite orthogonal. + * (1) the difference between using a ranged hash function and using + * the combination of a hash function and a range-hashing function. + * In the former case we don't have such things as hash codes, so + * we have a dummy type as placeholder. + * (2) Whether or not we cache hash codes. Caching hash codes is + * meaningless if we have a ranged hash function. + * + * We also put the key extraction objects here, for convenience. + * Each specialization derives from one or more of the template + * parameters to benefit from Ebo. This is important as this type + * is inherited in some cases by the _Local_iterator_base type used + * to implement local_iterator and const_local_iterator. As with + * any iterator type we prefer to make it as small as possible. + * + * Primary template is unused except as a hook for specializations. + */ + template + struct _Hash_code_base; + + /// Specialization: ranged hash function, no caching hash codes. H1 + /// and H2 are provided but ignored. We define a dummy hash code type. + template + struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false> + : private _Hashtable_ebo_helper<0, _ExtractKey>, + private _Hashtable_ebo_helper<1, _Hash> + { + private: + using __ebo_extract_key = _Hashtable_ebo_helper<0, _ExtractKey>; + using __ebo_hash = _Hashtable_ebo_helper<1, _Hash>; + + protected: + typedef void* __hash_code; + typedef _Hash_node<_Value, false> __node_type; + + // We need the default constructor for the local iterators and _Hashtable + // default constructor. + _Hash_code_base() = default; + + _Hash_code_base(const _ExtractKey& __ex, const _H1&, const _H2&, + const _Hash& __h) + : __ebo_extract_key(__ex), __ebo_hash(__h) { } + + __hash_code + _M_hash_code(const _Key& __key) const + { return 0; } + + std::size_t + _M_bucket_index(const _Key& __k, __hash_code, std::size_t __n) const + { return _M_ranged_hash()(__k, __n); } + + std::size_t + _M_bucket_index(const __node_type* __p, std::size_t __n) const + noexcept( noexcept(declval()(declval(), + (std::size_t)0)) ) + { return _M_ranged_hash()(_M_extract()(__p->_M_v()), __n); } + + void + _M_store_code(__node_type*, __hash_code) const + { } + + void + _M_copy_code(__node_type*, const __node_type*) const + { } + + void + _M_swap(_Hash_code_base& __x) + { + std::swap(_M_extract(), __x._M_extract()); + std::swap(_M_ranged_hash(), __x._M_ranged_hash()); + } + + const _ExtractKey& + _M_extract() const { return __ebo_extract_key::_S_cget(*this); } + + _ExtractKey& + _M_extract() { return __ebo_extract_key::_S_get(*this); } + + const _Hash& + _M_ranged_hash() const { return __ebo_hash::_S_cget(*this); } + + _Hash& + _M_ranged_hash() { return __ebo_hash::_S_get(*this); } + }; + + // No specialization for ranged hash function while caching hash codes. + // That combination is meaningless, and trying to do it is an error. + + /// Specialization: ranged hash function, cache hash codes. This + /// combination is meaningless, so we provide only a declaration + /// and no definition. + template + struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, true>; + + /// Specialization: hash function and range-hashing function, no + /// caching of hash codes. + /// Provides typedef and accessor required by C++ 11. + template + struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, + _Default_ranged_hash, false> + : private _Hashtable_ebo_helper<0, _ExtractKey>, + private _Hashtable_ebo_helper<1, _H1>, + private _Hashtable_ebo_helper<2, _H2> + { + private: + using __ebo_extract_key = _Hashtable_ebo_helper<0, _ExtractKey>; + using __ebo_h1 = _Hashtable_ebo_helper<1, _H1>; + using __ebo_h2 = _Hashtable_ebo_helper<2, _H2>; + + // Gives the local iterator implementation access to _M_bucket_index(). + friend struct _Local_iterator_base<_Key, _Value, _ExtractKey, _H1, _H2, + _Default_ranged_hash, false>; + + public: + typedef _H1 hasher; + + hasher + hash_function() const + { return _M_h1(); } + + protected: + typedef std::size_t __hash_code; + typedef _Hash_node<_Value, false> __node_type; + + // We need the default constructor for the local iterators and _Hashtable + // default constructor. + _Hash_code_base() = default; + + _Hash_code_base(const _ExtractKey& __ex, + const _H1& __h1, const _H2& __h2, + const _Default_ranged_hash&) + : __ebo_extract_key(__ex), __ebo_h1(__h1), __ebo_h2(__h2) { } + + __hash_code + _M_hash_code(const _Key& __k) const + { return _M_h1()(__k); } + + std::size_t + _M_bucket_index(const _Key&, __hash_code __c, std::size_t __n) const + { return _M_h2()(__c, __n); } + + std::size_t + _M_bucket_index(const __node_type* __p, std::size_t __n) const + noexcept( noexcept(declval()(declval())) + && noexcept(declval()((__hash_code)0, + (std::size_t)0)) ) + { return _M_h2()(_M_h1()(_M_extract()(__p->_M_v())), __n); } + + void + _M_store_code(__node_type*, __hash_code) const + { } + + void + _M_copy_code(__node_type*, const __node_type*) const + { } + + void + _M_swap(_Hash_code_base& __x) + { + std::swap(_M_extract(), __x._M_extract()); + std::swap(_M_h1(), __x._M_h1()); + std::swap(_M_h2(), __x._M_h2()); + } + + const _ExtractKey& + _M_extract() const { return __ebo_extract_key::_S_cget(*this); } + + _ExtractKey& + _M_extract() { return __ebo_extract_key::_S_get(*this); } + + const _H1& + _M_h1() const { return __ebo_h1::_S_cget(*this); } + + _H1& + _M_h1() { return __ebo_h1::_S_get(*this); } + + const _H2& + _M_h2() const { return __ebo_h2::_S_cget(*this); } + + _H2& + _M_h2() { return __ebo_h2::_S_get(*this); } + }; + + /// Specialization: hash function and range-hashing function, + /// caching hash codes. H is provided but ignored. Provides + /// typedef and accessor required by C++ 11. + template + struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, + _Default_ranged_hash, true> + : private _Hashtable_ebo_helper<0, _ExtractKey>, + private _Hashtable_ebo_helper<1, _H1>, + private _Hashtable_ebo_helper<2, _H2> + { + private: + // Gives the local iterator implementation access to _M_h2(). + friend struct _Local_iterator_base<_Key, _Value, _ExtractKey, _H1, _H2, + _Default_ranged_hash, true>; + + using __ebo_extract_key = _Hashtable_ebo_helper<0, _ExtractKey>; + using __ebo_h1 = _Hashtable_ebo_helper<1, _H1>; + using __ebo_h2 = _Hashtable_ebo_helper<2, _H2>; + + public: + typedef _H1 hasher; + + hasher + hash_function() const + { return _M_h1(); } + + protected: + typedef std::size_t __hash_code; + typedef _Hash_node<_Value, true> __node_type; + + // We need the default constructor for _Hashtable default constructor. + _Hash_code_base() = default; + _Hash_code_base(const _ExtractKey& __ex, + const _H1& __h1, const _H2& __h2, + const _Default_ranged_hash&) + : __ebo_extract_key(__ex), __ebo_h1(__h1), __ebo_h2(__h2) { } + + __hash_code + _M_hash_code(const _Key& __k) const + { return _M_h1()(__k); } + + std::size_t + _M_bucket_index(const _Key&, __hash_code __c, + std::size_t __n) const + { return _M_h2()(__c, __n); } + + std::size_t + _M_bucket_index(const __node_type* __p, std::size_t __n) const + noexcept( noexcept(declval()((__hash_code)0, + (std::size_t)0)) ) + { return _M_h2()(__p->_M_hash_code, __n); } + + void + _M_store_code(__node_type* __n, __hash_code __c) const + { __n->_M_hash_code = __c; } + + void + _M_copy_code(__node_type* __to, const __node_type* __from) const + { __to->_M_hash_code = __from->_M_hash_code; } + + void + _M_swap(_Hash_code_base& __x) + { + std::swap(_M_extract(), __x._M_extract()); + std::swap(_M_h1(), __x._M_h1()); + std::swap(_M_h2(), __x._M_h2()); + } + + const _ExtractKey& + _M_extract() const { return __ebo_extract_key::_S_cget(*this); } + + _ExtractKey& + _M_extract() { return __ebo_extract_key::_S_get(*this); } + + const _H1& + _M_h1() const { return __ebo_h1::_S_cget(*this); } + + _H1& + _M_h1() { return __ebo_h1::_S_get(*this); } + + const _H2& + _M_h2() const { return __ebo_h2::_S_cget(*this); } + + _H2& + _M_h2() { return __ebo_h2::_S_get(*this); } + }; + + /** + * Primary class template _Equal_helper. + * + */ + template + struct _Equal_helper; + + /// Specialization. + template + struct _Equal_helper<_Key, _Value, _ExtractKey, _Equal, _HashCodeType, true> + { + static bool + _S_equals(const _Equal& __eq, const _ExtractKey& __extract, + const _Key& __k, _HashCodeType __c, _Hash_node<_Value, true>* __n) + { return __c == __n->_M_hash_code && __eq(__k, __extract(__n->_M_v())); } + }; + + /// Specialization. + template + struct _Equal_helper<_Key, _Value, _ExtractKey, _Equal, _HashCodeType, false> + { + static bool + _S_equals(const _Equal& __eq, const _ExtractKey& __extract, + const _Key& __k, _HashCodeType, _Hash_node<_Value, false>* __n) + { return __eq(__k, __extract(__n->_M_v())); } + }; + + + /// Partial specialization used when nodes contain a cached hash code. + template + struct _Local_iterator_base<_Key, _Value, _ExtractKey, + _H1, _H2, _Hash, true> + : private _Hashtable_ebo_helper<0, _H2> + { + protected: + using __base_type = _Hashtable_ebo_helper<0, _H2>; + using __hash_code_base = _Hash_code_base<_Key, _Value, _ExtractKey, + _H1, _H2, _Hash, true>; + + _Local_iterator_base() = default; + _Local_iterator_base(const __hash_code_base& __base, + _Hash_node<_Value, true>* __p, + std::size_t __bkt, std::size_t __bkt_count) + : __base_type(__base._M_h2()), + _M_cur(__p), _M_bucket(__bkt), _M_bucket_count(__bkt_count) { } + + void + _M_incr() + { + _M_cur = _M_cur->_M_next(); + if (_M_cur) + { + std::size_t __bkt + = __base_type::_S_get(*this)(_M_cur->_M_hash_code, + _M_bucket_count); + if (__bkt != _M_bucket) + _M_cur = nullptr; + } + } + + _Hash_node<_Value, true>* _M_cur; + std::size_t _M_bucket; + std::size_t _M_bucket_count; + + public: + const void* + _M_curr() const { return _M_cur; } // for equality ops + + std::size_t + _M_get_bucket() const { return _M_bucket; } // for debug mode + }; + + // Uninitialized storage for a _Hash_code_base. + // This type is DefaultConstructible and Assignable even if the + // _Hash_code_base type isn't, so that _Local_iterator_base<..., false> + // can be DefaultConstructible and Assignable. + template::value> + struct _Hash_code_storage + { + __gnu_cxx::__aligned_buffer<_Tp> _M_storage; + + _Tp* + _M_h() { return _M_storage._M_ptr(); } + + const _Tp* + _M_h() const { return _M_storage._M_ptr(); } + }; + + // Empty partial specialization for empty _Hash_code_base types. + template + struct _Hash_code_storage<_Tp, true> + { + static_assert( std::is_empty<_Tp>::value, "Type must be empty" ); + + // As _Tp is an empty type there will be no bytes written/read through + // the cast pointer, so no strict-aliasing violation. + _Tp* + _M_h() { return reinterpret_cast<_Tp*>(this); } + + const _Tp* + _M_h() const { return reinterpret_cast(this); } + }; + + template + using __hash_code_for_local_iter + = _Hash_code_storage<_Hash_code_base<_Key, _Value, _ExtractKey, + _H1, _H2, _Hash, false>>; + + // Partial specialization used when hash codes are not cached + template + struct _Local_iterator_base<_Key, _Value, _ExtractKey, + _H1, _H2, _Hash, false> + : __hash_code_for_local_iter<_Key, _Value, _ExtractKey, _H1, _H2, _Hash> + { + protected: + using __hash_code_base = _Hash_code_base<_Key, _Value, _ExtractKey, + _H1, _H2, _Hash, false>; + + _Local_iterator_base() : _M_bucket_count(-1) { } + + _Local_iterator_base(const __hash_code_base& __base, + _Hash_node<_Value, false>* __p, + std::size_t __bkt, std::size_t __bkt_count) + : _M_cur(__p), _M_bucket(__bkt), _M_bucket_count(__bkt_count) + { _M_init(__base); } + + ~_Local_iterator_base() + { + if (_M_bucket_count != -1) + _M_destroy(); + } + + _Local_iterator_base(const _Local_iterator_base& __iter) + : _M_cur(__iter._M_cur), _M_bucket(__iter._M_bucket), + _M_bucket_count(__iter._M_bucket_count) + { + if (_M_bucket_count != -1) + _M_init(*__iter._M_h()); + } + + _Local_iterator_base& + operator=(const _Local_iterator_base& __iter) + { + if (_M_bucket_count != -1) + _M_destroy(); + _M_cur = __iter._M_cur; + _M_bucket = __iter._M_bucket; + _M_bucket_count = __iter._M_bucket_count; + if (_M_bucket_count != -1) + _M_init(*__iter._M_h()); + return *this; + } + + void + _M_incr() + { + _M_cur = _M_cur->_M_next(); + if (_M_cur) + { + std::size_t __bkt = this->_M_h()->_M_bucket_index(_M_cur, + _M_bucket_count); + if (__bkt != _M_bucket) + _M_cur = nullptr; + } + } + + _Hash_node<_Value, false>* _M_cur; + std::size_t _M_bucket; + std::size_t _M_bucket_count; + + void + _M_init(const __hash_code_base& __base) + { ::new(this->_M_h()) __hash_code_base(__base); } + + void + _M_destroy() { this->_M_h()->~__hash_code_base(); } + + public: + const void* + _M_curr() const { return _M_cur; } // for equality ops and debug mode + + std::size_t + _M_get_bucket() const { return _M_bucket; } // for debug mode + }; + + template + inline bool + operator==(const _Local_iterator_base<_Key, _Value, _ExtractKey, + _H1, _H2, _Hash, __cache>& __x, + const _Local_iterator_base<_Key, _Value, _ExtractKey, + _H1, _H2, _Hash, __cache>& __y) + { return __x._M_curr() == __y._M_curr(); } + + template + inline bool + operator!=(const _Local_iterator_base<_Key, _Value, _ExtractKey, + _H1, _H2, _Hash, __cache>& __x, + const _Local_iterator_base<_Key, _Value, _ExtractKey, + _H1, _H2, _Hash, __cache>& __y) + { return __x._M_curr() != __y._M_curr(); } + + /// local iterators + template + struct _Local_iterator + : public _Local_iterator_base<_Key, _Value, _ExtractKey, + _H1, _H2, _Hash, __cache> + { + private: + using __base_type = _Local_iterator_base<_Key, _Value, _ExtractKey, + _H1, _H2, _Hash, __cache>; + using __hash_code_base = typename __base_type::__hash_code_base; + public: + typedef _Value value_type; + typedef typename std::conditional<__constant_iterators, + const _Value*, _Value*>::type + pointer; + typedef typename std::conditional<__constant_iterators, + const _Value&, _Value&>::type + reference; + typedef std::ptrdiff_t difference_type; + typedef std::forward_iterator_tag iterator_category; + + _Local_iterator() = default; + + _Local_iterator(const __hash_code_base& __base, + _Hash_node<_Value, __cache>* __p, + std::size_t __bkt, std::size_t __bkt_count) + : __base_type(__base, __p, __bkt, __bkt_count) + { } + + reference + operator*() const + { return this->_M_cur->_M_v(); } + + pointer + operator->() const + { return this->_M_cur->_M_valptr(); } + + _Local_iterator& + operator++() + { + this->_M_incr(); + return *this; + } + + _Local_iterator + operator++(int) + { + _Local_iterator __tmp(*this); + this->_M_incr(); + return __tmp; + } + }; + + /// local const_iterators + template + struct _Local_const_iterator + : public _Local_iterator_base<_Key, _Value, _ExtractKey, + _H1, _H2, _Hash, __cache> + { + private: + using __base_type = _Local_iterator_base<_Key, _Value, _ExtractKey, + _H1, _H2, _Hash, __cache>; + using __hash_code_base = typename __base_type::__hash_code_base; + + public: + typedef _Value value_type; + typedef const _Value* pointer; + typedef const _Value& reference; + typedef std::ptrdiff_t difference_type; + typedef std::forward_iterator_tag iterator_category; + + _Local_const_iterator() = default; + + _Local_const_iterator(const __hash_code_base& __base, + _Hash_node<_Value, __cache>* __p, + std::size_t __bkt, std::size_t __bkt_count) + : __base_type(__base, __p, __bkt, __bkt_count) + { } + + _Local_const_iterator(const _Local_iterator<_Key, _Value, _ExtractKey, + _H1, _H2, _Hash, + __constant_iterators, + __cache>& __x) + : __base_type(__x) + { } + + reference + operator*() const + { return this->_M_cur->_M_v(); } + + pointer + operator->() const + { return this->_M_cur->_M_valptr(); } + + _Local_const_iterator& + operator++() + { + this->_M_incr(); + return *this; + } + + _Local_const_iterator + operator++(int) + { + _Local_const_iterator __tmp(*this); + this->_M_incr(); + return __tmp; + } + }; + + /** + * Primary class template _Hashtable_base. + * + * Helper class adding management of _Equal functor to + * _Hash_code_base type. + * + * Base class templates are: + * - __detail::_Hash_code_base + * - __detail::_Hashtable_ebo_helper + */ + template + struct _Hashtable_base + : public _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, + _Traits::__hash_cached::value>, + private _Hashtable_ebo_helper<0, _Equal> + { + public: + typedef _Key key_type; + typedef _Value value_type; + typedef _Equal key_equal; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + + using __traits_type = _Traits; + using __hash_cached = typename __traits_type::__hash_cached; + using __constant_iterators = typename __traits_type::__constant_iterators; + using __unique_keys = typename __traits_type::__unique_keys; + + using __hash_code_base = _Hash_code_base<_Key, _Value, _ExtractKey, + _H1, _H2, _Hash, + __hash_cached::value>; + + using __hash_code = typename __hash_code_base::__hash_code; + using __node_type = typename __hash_code_base::__node_type; + + using iterator = __detail::_Node_iterator; + + using const_iterator = __detail::_Node_const_iterator; + + using local_iterator = __detail::_Local_iterator; + + using const_local_iterator = __detail::_Local_const_iterator; + + using __ireturn_type = typename std::conditional<__unique_keys::value, + std::pair, + iterator>::type; + private: + using _EqualEBO = _Hashtable_ebo_helper<0, _Equal>; + using _EqualHelper = _Equal_helper<_Key, _Value, _ExtractKey, _Equal, + __hash_code, __hash_cached::value>; + + protected: + _Hashtable_base() = default; + _Hashtable_base(const _ExtractKey& __ex, const _H1& __h1, const _H2& __h2, + const _Hash& __hash, const _Equal& __eq) + : __hash_code_base(__ex, __h1, __h2, __hash), _EqualEBO(__eq) + { } + + bool + _M_equals(const _Key& __k, __hash_code __c, __node_type* __n) const + { + return _EqualHelper::_S_equals(_M_eq(), this->_M_extract(), + __k, __c, __n); + } + + void + _M_swap(_Hashtable_base& __x) + { + __hash_code_base::_M_swap(__x); + std::swap(_M_eq(), __x._M_eq()); + } + + const _Equal& + _M_eq() const { return _EqualEBO::_S_cget(*this); } + + _Equal& + _M_eq() { return _EqualEBO::_S_get(*this); } + }; + + /** + * struct _Equality_base. + * + * Common types and functions for class _Equality. + */ + struct _Equality_base + { + protected: + template + static bool + _S_is_permutation(_Uiterator, _Uiterator, _Uiterator); + }; + + // See std::is_permutation in N3068. + template + bool + _Equality_base:: + _S_is_permutation(_Uiterator __first1, _Uiterator __last1, + _Uiterator __first2) + { + for (; __first1 != __last1; ++__first1, ++__first2) + if (!(*__first1 == *__first2)) + break; + + if (__first1 == __last1) + return true; + + _Uiterator __last2 = __first2; + std::advance(__last2, std::distance(__first1, __last1)); + + for (_Uiterator __it1 = __first1; __it1 != __last1; ++__it1) + { + _Uiterator __tmp = __first1; + while (__tmp != __it1 && !bool(*__tmp == *__it1)) + ++__tmp; + + // We've seen this one before. + if (__tmp != __it1) + continue; + + std::ptrdiff_t __n2 = 0; + for (__tmp = __first2; __tmp != __last2; ++__tmp) + if (*__tmp == *__it1) + ++__n2; + + if (!__n2) + return false; + + std::ptrdiff_t __n1 = 0; + for (__tmp = __it1; __tmp != __last1; ++__tmp) + if (*__tmp == *__it1) + ++__n1; + + if (__n1 != __n2) + return false; + } + return true; + } + + /** + * Primary class template _Equality. + * + * This is for implementing equality comparison for unordered + * containers, per N3068, by John Lakos and Pablo Halpern. + * Algorithmically, we follow closely the reference implementations + * therein. + */ + template + struct _Equality; + + /// Specialization. + template + struct _Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits, true> + { + using __hashtable = _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>; + + bool + _M_equal(const __hashtable&) const; + }; + + template + bool + _Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits, true>:: + _M_equal(const __hashtable& __other) const + { + const __hashtable* __this = static_cast(this); + + if (__this->size() != __other.size()) + return false; + + for (auto __itx = __this->begin(); __itx != __this->end(); ++__itx) + { + const auto __ity = __other.find(_ExtractKey()(*__itx)); + if (__ity == __other.end() || !bool(*__ity == *__itx)) + return false; + } + return true; + } + + /// Specialization. + template + struct _Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits, false> + : public _Equality_base + { + using __hashtable = _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits>; + + bool + _M_equal(const __hashtable&) const; + }; + + template + bool + _Equality<_Key, _Value, _Alloc, _ExtractKey, _Equal, + _H1, _H2, _Hash, _RehashPolicy, _Traits, false>:: + _M_equal(const __hashtable& __other) const + { + const __hashtable* __this = static_cast(this); + + if (__this->size() != __other.size()) + return false; + + for (auto __itx = __this->begin(); __itx != __this->end();) + { + const auto __xrange = __this->equal_range(_ExtractKey()(*__itx)); + const auto __yrange = __other.equal_range(_ExtractKey()(*__itx)); + + if (std::distance(__xrange.first, __xrange.second) + != std::distance(__yrange.first, __yrange.second)) + return false; + + if (!_S_is_permutation(__xrange.first, __xrange.second, + __yrange.first)) + return false; + + __itx = __xrange.second; + } + return true; + } + + /** + * This type deals with all allocation and keeps an allocator instance through + * inheritance to benefit from EBO when possible. + */ + template + struct _Hashtable_alloc : private _Hashtable_ebo_helper<0, _NodeAlloc> + { + private: + using __ebo_node_alloc = _Hashtable_ebo_helper<0, _NodeAlloc>; + public: + using __node_type = typename _NodeAlloc::value_type; + using __node_alloc_type = _NodeAlloc; + // Use __gnu_cxx to benefit from _S_always_equal and al. + using __node_alloc_traits = __gnu_cxx::__alloc_traits<__node_alloc_type>; + + using __value_type = typename __node_type::value_type; + using __value_alloc_type = + __alloc_rebind<__node_alloc_type, __value_type>; + using __value_alloc_traits = std::allocator_traits<__value_alloc_type>; + + using __node_base = __detail::_Hash_node_base; + using __bucket_type = __node_base*; + using __bucket_alloc_type = + __alloc_rebind<__node_alloc_type, __bucket_type>; + using __bucket_alloc_traits = std::allocator_traits<__bucket_alloc_type>; + + _Hashtable_alloc() = default; + _Hashtable_alloc(const _Hashtable_alloc&) = default; + _Hashtable_alloc(_Hashtable_alloc&&) = default; + + template + _Hashtable_alloc(_Alloc&& __a) + : __ebo_node_alloc(std::forward<_Alloc>(__a)) + { } + + __node_alloc_type& + _M_node_allocator() + { return __ebo_node_alloc::_S_get(*this); } + + const __node_alloc_type& + _M_node_allocator() const + { return __ebo_node_alloc::_S_cget(*this); } + + template + __node_type* + _M_allocate_node(_Args&&... __args); + + void + _M_deallocate_node(__node_type* __n); + + // Deallocate the linked list of nodes pointed to by __n + void + _M_deallocate_nodes(__node_type* __n); + + __bucket_type* + _M_allocate_buckets(std::size_t __n); + + void + _M_deallocate_buckets(__bucket_type*, std::size_t __n); + }; + + // Definitions of class template _Hashtable_alloc's out-of-line member + // functions. + template + template + typename _Hashtable_alloc<_NodeAlloc>::__node_type* + _Hashtable_alloc<_NodeAlloc>::_M_allocate_node(_Args&&... __args) + { + auto __nptr = __node_alloc_traits::allocate(_M_node_allocator(), 1); + __node_type* __n = std::__addressof(*__nptr); + __try + { + __value_alloc_type __a(_M_node_allocator()); + ::new ((void*)__n) __node_type; + __value_alloc_traits::construct(__a, __n->_M_valptr(), + std::forward<_Args>(__args)...); + return __n; + } + __catch(...) + { + __node_alloc_traits::deallocate(_M_node_allocator(), __nptr, 1); + __throw_exception_again; + } + } + + template + void + _Hashtable_alloc<_NodeAlloc>::_M_deallocate_node(__node_type* __n) + { + typedef typename __node_alloc_traits::pointer _Ptr; + auto __ptr = std::pointer_traits<_Ptr>::pointer_to(*__n); + __value_alloc_type __a(_M_node_allocator()); + __value_alloc_traits::destroy(__a, __n->_M_valptr()); + __n->~__node_type(); + __node_alloc_traits::deallocate(_M_node_allocator(), __ptr, 1); + } + + template + void + _Hashtable_alloc<_NodeAlloc>::_M_deallocate_nodes(__node_type* __n) + { + while (__n) + { + __node_type* __tmp = __n; + __n = __n->_M_next(); + _M_deallocate_node(__tmp); + } + } + + template + typename _Hashtable_alloc<_NodeAlloc>::__bucket_type* + _Hashtable_alloc<_NodeAlloc>::_M_allocate_buckets(std::size_t __n) + { + __bucket_alloc_type __alloc(_M_node_allocator()); + + auto __ptr = __bucket_alloc_traits::allocate(__alloc, __n); + __bucket_type* __p = std::__addressof(*__ptr); + __builtin_memset(__p, 0, __n * sizeof(__bucket_type)); + return __p; + } + + template + void + _Hashtable_alloc<_NodeAlloc>::_M_deallocate_buckets(__bucket_type* __bkts, + std::size_t __n) + { + typedef typename __bucket_alloc_traits::pointer _Ptr; + auto __ptr = std::pointer_traits<_Ptr>::pointer_to(*__bkts); + __bucket_alloc_type __alloc(_M_node_allocator()); + __bucket_alloc_traits::deallocate(__alloc, __ptr, __n); + } + + //@} hashtable-detail +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace __detail +} // namespace std + +#endif // _HASHTABLE_POLICY_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/indirect_array.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/indirect_array.h new file mode 100644 index 0000000..ed79970 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/indirect_array.h @@ -0,0 +1,212 @@ +// The template and inlines for the -*- C++ -*- indirect_array class. + +// Copyright (C) 1997-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/indirect_array.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{valarray} + */ + +// Written by Gabriel Dos Reis + +#ifndef _INDIRECT_ARRAY_H +#define _INDIRECT_ARRAY_H 1 + +#pragma GCC system_header + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup numeric_arrays + * @{ + */ + + /** + * @brief Reference to arbitrary subset of an array. + * + * An indirect_array is a reference to the actual elements of an array + * specified by an ordered array of indices. The way to get an + * indirect_array is to call operator[](valarray) on a valarray. + * The returned indirect_array then permits carrying operations out on the + * referenced subset of elements in the original valarray. + * + * For example, if an indirect_array is obtained using the array (4,2,0) as + * an argument, and then assigned to an array containing (1,2,3), then the + * underlying array will have array[0]==3, array[2]==2, and array[4]==1. + * + * @param Tp Element type. + */ + template + class indirect_array + { + public: + typedef _Tp value_type; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 253. valarray helper functions are almost entirely useless + + /// Copy constructor. Both slices refer to the same underlying array. + indirect_array(const indirect_array&); + + /// Assignment operator. Assigns elements to corresponding elements + /// of @a a. + indirect_array& operator=(const indirect_array&); + + /// Assign slice elements to corresponding elements of @a v. + void operator=(const valarray<_Tp>&) const; + /// Multiply slice elements by corresponding elements of @a v. + void operator*=(const valarray<_Tp>&) const; + /// Divide slice elements by corresponding elements of @a v. + void operator/=(const valarray<_Tp>&) const; + /// Modulo slice elements by corresponding elements of @a v. + void operator%=(const valarray<_Tp>&) const; + /// Add corresponding elements of @a v to slice elements. + void operator+=(const valarray<_Tp>&) const; + /// Subtract corresponding elements of @a v from slice elements. + void operator-=(const valarray<_Tp>&) const; + /// Logical xor slice elements with corresponding elements of @a v. + void operator^=(const valarray<_Tp>&) const; + /// Logical and slice elements with corresponding elements of @a v. + void operator&=(const valarray<_Tp>&) const; + /// Logical or slice elements with corresponding elements of @a v. + void operator|=(const valarray<_Tp>&) const; + /// Left shift slice elements by corresponding elements of @a v. + void operator<<=(const valarray<_Tp>&) const; + /// Right shift slice elements by corresponding elements of @a v. + void operator>>=(const valarray<_Tp>&) const; + /// Assign all slice elements to @a t. + void operator= (const _Tp&) const; + // ~indirect_array(); + + template + void operator=(const _Expr<_Dom, _Tp>&) const; + template + void operator*=(const _Expr<_Dom, _Tp>&) const; + template + void operator/=(const _Expr<_Dom, _Tp>&) const; + template + void operator%=(const _Expr<_Dom, _Tp>&) const; + template + void operator+=(const _Expr<_Dom, _Tp>&) const; + template + void operator-=(const _Expr<_Dom, _Tp>&) const; + template + void operator^=(const _Expr<_Dom, _Tp>&) const; + template + void operator&=(const _Expr<_Dom, _Tp>&) const; + template + void operator|=(const _Expr<_Dom, _Tp>&) const; + template + void operator<<=(const _Expr<_Dom, _Tp>&) const; + template + void operator>>=(const _Expr<_Dom, _Tp>&) const; + + private: + /// Copy constructor. Both slices refer to the same underlying array. + indirect_array(_Array<_Tp>, size_t, _Array); + + friend class valarray<_Tp>; + friend class gslice_array<_Tp>; + + const size_t _M_sz; + const _Array _M_index; + const _Array<_Tp> _M_array; + + // not implemented + indirect_array(); + }; + + template + inline + indirect_array<_Tp>::indirect_array(const indirect_array<_Tp>& __a) + : _M_sz(__a._M_sz), _M_index(__a._M_index), _M_array(__a._M_array) {} + + template + inline + indirect_array<_Tp>::indirect_array(_Array<_Tp> __a, size_t __s, + _Array __i) + : _M_sz(__s), _M_index(__i), _M_array(__a) {} + + template + inline indirect_array<_Tp>& + indirect_array<_Tp>::operator=(const indirect_array<_Tp>& __a) + { + std::__valarray_copy(__a._M_array, _M_sz, __a._M_index, _M_array, + _M_index); + return *this; + } + + template + inline void + indirect_array<_Tp>::operator=(const _Tp& __t) const + { std::__valarray_fill(_M_array, _M_index, _M_sz, __t); } + + template + inline void + indirect_array<_Tp>::operator=(const valarray<_Tp>& __v) const + { std::__valarray_copy(_Array<_Tp>(__v), _M_sz, _M_array, _M_index); } + + template + template + inline void + indirect_array<_Tp>::operator=(const _Expr<_Dom, _Tp>& __e) const + { std::__valarray_copy(__e, _M_sz, _M_array, _M_index); } + +#undef _DEFINE_VALARRAY_OPERATOR +#define _DEFINE_VALARRAY_OPERATOR(_Op, _Name) \ + template \ + inline void \ + indirect_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const\ + { \ + _Array_augmented_##_Name(_M_array, _M_index, _Array<_Tp>(__v), _M_sz); \ + } \ + \ + template \ + template \ + inline void \ + indirect_array<_Tp>::operator _Op##=(const _Expr<_Dom,_Tp>& __e) const\ + { \ + _Array_augmented_##_Name(_M_array, _M_index, __e, _M_sz); \ + } + +_DEFINE_VALARRAY_OPERATOR(*, __multiplies) +_DEFINE_VALARRAY_OPERATOR(/, __divides) +_DEFINE_VALARRAY_OPERATOR(%, __modulus) +_DEFINE_VALARRAY_OPERATOR(+, __plus) +_DEFINE_VALARRAY_OPERATOR(-, __minus) +_DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor) +_DEFINE_VALARRAY_OPERATOR(&, __bitwise_and) +_DEFINE_VALARRAY_OPERATOR(|, __bitwise_or) +_DEFINE_VALARRAY_OPERATOR(<<, __shift_left) +_DEFINE_VALARRAY_OPERATOR(>>, __shift_right) + +#undef _DEFINE_VALARRAY_OPERATOR + + // @} group numeric_arrays + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _INDIRECT_ARRAY_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/invoke.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/invoke.h new file mode 100644 index 0000000..eba8707 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/invoke.h @@ -0,0 +1,104 @@ +// Implementation of INVOKE -*- C++ -*- + +// Copyright (C) 2016-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/bits/invoke.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{functional} + */ + +#ifndef _GLIBCXX_INVOKE_H +#define _GLIBCXX_INVOKE_H 1 + +#pragma GCC system_header + +#if __cplusplus < 201103L +# include +#else + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup utilities + * @{ + */ + + // Used by __invoke_impl instead of std::forward<_Tp> so that a + // reference_wrapper is converted to an lvalue-reference. + template::type> + constexpr _Up&& + __invfwd(typename remove_reference<_Tp>::type& __t) noexcept + { return static_cast<_Up&&>(__t); } + + template + constexpr _Res + __invoke_impl(__invoke_other, _Fn&& __f, _Args&&... __args) + { return std::forward<_Fn>(__f)(std::forward<_Args>(__args)...); } + + template + constexpr _Res + __invoke_impl(__invoke_memfun_ref, _MemFun&& __f, _Tp&& __t, + _Args&&... __args) + { return (__invfwd<_Tp>(__t).*__f)(std::forward<_Args>(__args)...); } + + template + constexpr _Res + __invoke_impl(__invoke_memfun_deref, _MemFun&& __f, _Tp&& __t, + _Args&&... __args) + { + return ((*std::forward<_Tp>(__t)).*__f)(std::forward<_Args>(__args)...); + } + + template + constexpr _Res + __invoke_impl(__invoke_memobj_ref, _MemPtr&& __f, _Tp&& __t) + { return __invfwd<_Tp>(__t).*__f; } + + template + constexpr _Res + __invoke_impl(__invoke_memobj_deref, _MemPtr&& __f, _Tp&& __t) + { return (*std::forward<_Tp>(__t)).*__f; } + + /// Invoke a callable object. + template + constexpr typename __invoke_result<_Callable, _Args...>::type + __invoke(_Callable&& __fn, _Args&&... __args) + noexcept(__is_nothrow_invocable<_Callable, _Args...>::value) + { + using __result = __invoke_result<_Callable, _Args...>; + using __type = typename __result::type; + using __tag = typename __result::__invoke_type; + return std::__invoke_impl<__type>(__tag{}, std::forward<_Callable>(__fn), + std::forward<_Args>(__args)...); + } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // C++11 + +#endif // _GLIBCXX_INVOKE_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/ios_base.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/ios_base.h new file mode 100644 index 0000000..e5a107d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/ios_base.h @@ -0,0 +1,1079 @@ +// Iostreams base classes -*- C++ -*- + +// Copyright (C) 1997-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/ios_base.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{ios} + */ + +// +// ISO C++ 14882: 27.4 Iostreams base classes +// + +#ifndef _IOS_BASE_H +#define _IOS_BASE_H 1 + +#pragma GCC system_header + +#include +#include +#include + +#if __cplusplus < 201103L +# include +#else +# include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // The following definitions of bitmask types are enums, not ints, + // as permitted (but not required) in the standard, in order to provide + // better type safety in iostream calls. A side effect is that in C++98 + // expressions involving them are not compile-time constants. + enum _Ios_Fmtflags + { + _S_boolalpha = 1L << 0, + _S_dec = 1L << 1, + _S_fixed = 1L << 2, + _S_hex = 1L << 3, + _S_internal = 1L << 4, + _S_left = 1L << 5, + _S_oct = 1L << 6, + _S_right = 1L << 7, + _S_scientific = 1L << 8, + _S_showbase = 1L << 9, + _S_showpoint = 1L << 10, + _S_showpos = 1L << 11, + _S_skipws = 1L << 12, + _S_unitbuf = 1L << 13, + _S_uppercase = 1L << 14, + _S_adjustfield = _S_left | _S_right | _S_internal, + _S_basefield = _S_dec | _S_oct | _S_hex, + _S_floatfield = _S_scientific | _S_fixed, + _S_ios_fmtflags_end = 1L << 16, + _S_ios_fmtflags_max = __INT_MAX__, + _S_ios_fmtflags_min = ~__INT_MAX__ + }; + + inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags + operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) + { return _Ios_Fmtflags(static_cast(__a) & static_cast(__b)); } + + inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags + operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b) + { return _Ios_Fmtflags(static_cast(__a) | static_cast(__b)); } + + inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags + operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b) + { return _Ios_Fmtflags(static_cast(__a) ^ static_cast(__b)); } + + inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags + operator~(_Ios_Fmtflags __a) + { return _Ios_Fmtflags(~static_cast(__a)); } + + inline const _Ios_Fmtflags& + operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) + { return __a = __a | __b; } + + inline const _Ios_Fmtflags& + operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) + { return __a = __a & __b; } + + inline const _Ios_Fmtflags& + operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) + { return __a = __a ^ __b; } + + + enum _Ios_Openmode + { + _S_app = 1L << 0, + _S_ate = 1L << 1, + _S_bin = 1L << 2, + _S_in = 1L << 3, + _S_out = 1L << 4, + _S_trunc = 1L << 5, + _S_ios_openmode_end = 1L << 16, + _S_ios_openmode_max = __INT_MAX__, + _S_ios_openmode_min = ~__INT_MAX__ + }; + + inline _GLIBCXX_CONSTEXPR _Ios_Openmode + operator&(_Ios_Openmode __a, _Ios_Openmode __b) + { return _Ios_Openmode(static_cast(__a) & static_cast(__b)); } + + inline _GLIBCXX_CONSTEXPR _Ios_Openmode + operator|(_Ios_Openmode __a, _Ios_Openmode __b) + { return _Ios_Openmode(static_cast(__a) | static_cast(__b)); } + + inline _GLIBCXX_CONSTEXPR _Ios_Openmode + operator^(_Ios_Openmode __a, _Ios_Openmode __b) + { return _Ios_Openmode(static_cast(__a) ^ static_cast(__b)); } + + inline _GLIBCXX_CONSTEXPR _Ios_Openmode + operator~(_Ios_Openmode __a) + { return _Ios_Openmode(~static_cast(__a)); } + + inline const _Ios_Openmode& + operator|=(_Ios_Openmode& __a, _Ios_Openmode __b) + { return __a = __a | __b; } + + inline const _Ios_Openmode& + operator&=(_Ios_Openmode& __a, _Ios_Openmode __b) + { return __a = __a & __b; } + + inline const _Ios_Openmode& + operator^=(_Ios_Openmode& __a, _Ios_Openmode __b) + { return __a = __a ^ __b; } + + + enum _Ios_Iostate + { + _S_goodbit = 0, + _S_badbit = 1L << 0, + _S_eofbit = 1L << 1, + _S_failbit = 1L << 2, + _S_ios_iostate_end = 1L << 16, + _S_ios_iostate_max = __INT_MAX__, + _S_ios_iostate_min = ~__INT_MAX__ + }; + + inline _GLIBCXX_CONSTEXPR _Ios_Iostate + operator&(_Ios_Iostate __a, _Ios_Iostate __b) + { return _Ios_Iostate(static_cast(__a) & static_cast(__b)); } + + inline _GLIBCXX_CONSTEXPR _Ios_Iostate + operator|(_Ios_Iostate __a, _Ios_Iostate __b) + { return _Ios_Iostate(static_cast(__a) | static_cast(__b)); } + + inline _GLIBCXX_CONSTEXPR _Ios_Iostate + operator^(_Ios_Iostate __a, _Ios_Iostate __b) + { return _Ios_Iostate(static_cast(__a) ^ static_cast(__b)); } + + inline _GLIBCXX_CONSTEXPR _Ios_Iostate + operator~(_Ios_Iostate __a) + { return _Ios_Iostate(~static_cast(__a)); } + + inline const _Ios_Iostate& + operator|=(_Ios_Iostate& __a, _Ios_Iostate __b) + { return __a = __a | __b; } + + inline const _Ios_Iostate& + operator&=(_Ios_Iostate& __a, _Ios_Iostate __b) + { return __a = __a & __b; } + + inline const _Ios_Iostate& + operator^=(_Ios_Iostate& __a, _Ios_Iostate __b) + { return __a = __a ^ __b; } + + + enum _Ios_Seekdir + { + _S_beg = 0, + _S_cur = _GLIBCXX_STDIO_SEEK_CUR, + _S_end = _GLIBCXX_STDIO_SEEK_END, + _S_ios_seekdir_end = 1L << 16 + }; + +#if __cplusplus >= 201103L + /// I/O error code + enum class io_errc { stream = 1 }; + + template <> struct is_error_code_enum : public true_type { }; + + const error_category& iostream_category() noexcept; + + inline error_code + make_error_code(io_errc __e) noexcept + { return error_code(static_cast(__e), iostream_category()); } + + inline error_condition + make_error_condition(io_errc __e) noexcept + { return error_condition(static_cast(__e), iostream_category()); } +#endif + + // 27.4.2 Class ios_base + /** + * @brief The base of the I/O class hierarchy. + * @ingroup io + * + * This class defines everything that can be defined about I/O that does + * not depend on the type of characters being input or output. Most + * people will only see @c ios_base when they need to specify the full + * name of the various I/O flags (e.g., the openmodes). + */ + class ios_base + { +#if _GLIBCXX_USE_CXX11_ABI +#if __cplusplus < 201103L + // Type that is layout-compatible with std::system_error + struct system_error : std::runtime_error + { + // Type that is layout-compatible with std::error_code + struct error_code + { + error_code() { } + private: + int _M_value; + const void* _M_cat; + } _M_code; + }; +#endif +#endif + public: + + /** + * @brief These are thrown to indicate problems with io. + * @ingroup exceptions + * + * 27.4.2.1.1 Class ios_base::failure + */ +#if _GLIBCXX_USE_CXX11_ABI + class _GLIBCXX_ABI_TAG_CXX11 failure : public system_error + { + public: + explicit + failure(const string& __str); + +#if __cplusplus >= 201103L + explicit + failure(const string&, const error_code&); + + explicit + failure(const char*, const error_code& = io_errc::stream); +#endif + + virtual + ~failure() throw(); + + virtual const char* + what() const throw(); + }; +#else + class failure : public exception + { + public: + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 48. Use of non-existent exception constructor + explicit + failure(const string& __str) throw(); + + // This declaration is not useless: + // http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Vague-Linkage.html + virtual + ~failure() throw(); + + virtual const char* + what() const throw(); + + private: + string _M_msg; + }; +#endif + + // 27.4.2.1.2 Type ios_base::fmtflags + /** + * @brief This is a bitmask type. + * + * @c @a _Ios_Fmtflags is implementation-defined, but it is valid to + * perform bitwise operations on these values and expect the Right + * Thing to happen. Defined objects of type fmtflags are: + * - boolalpha + * - dec + * - fixed + * - hex + * - internal + * - left + * - oct + * - right + * - scientific + * - showbase + * - showpoint + * - showpos + * - skipws + * - unitbuf + * - uppercase + * - adjustfield + * - basefield + * - floatfield + */ + typedef _Ios_Fmtflags fmtflags; + + /// Insert/extract @c bool in alphabetic rather than numeric format. + static const fmtflags boolalpha = _S_boolalpha; + + /// Converts integer input or generates integer output in decimal base. + static const fmtflags dec = _S_dec; + + /// Generate floating-point output in fixed-point notation. + static const fmtflags fixed = _S_fixed; + + /// Converts integer input or generates integer output in hexadecimal base. + static const fmtflags hex = _S_hex; + + /// Adds fill characters at a designated internal point in certain + /// generated output, or identical to @c right if no such point is + /// designated. + static const fmtflags internal = _S_internal; + + /// Adds fill characters on the right (final positions) of certain + /// generated output. (I.e., the thing you print is flush left.) + static const fmtflags left = _S_left; + + /// Converts integer input or generates integer output in octal base. + static const fmtflags oct = _S_oct; + + /// Adds fill characters on the left (initial positions) of certain + /// generated output. (I.e., the thing you print is flush right.) + static const fmtflags right = _S_right; + + /// Generates floating-point output in scientific notation. + static const fmtflags scientific = _S_scientific; + + /// Generates a prefix indicating the numeric base of generated integer + /// output. + static const fmtflags showbase = _S_showbase; + + /// Generates a decimal-point character unconditionally in generated + /// floating-point output. + static const fmtflags showpoint = _S_showpoint; + + /// Generates a + sign in non-negative generated numeric output. + static const fmtflags showpos = _S_showpos; + + /// Skips leading white space before certain input operations. + static const fmtflags skipws = _S_skipws; + + /// Flushes output after each output operation. + static const fmtflags unitbuf = _S_unitbuf; + + /// Replaces certain lowercase letters with their uppercase equivalents + /// in generated output. + static const fmtflags uppercase = _S_uppercase; + + /// A mask of left|right|internal. Useful for the 2-arg form of @c setf. + static const fmtflags adjustfield = _S_adjustfield; + + /// A mask of dec|oct|hex. Useful for the 2-arg form of @c setf. + static const fmtflags basefield = _S_basefield; + + /// A mask of scientific|fixed. Useful for the 2-arg form of @c setf. + static const fmtflags floatfield = _S_floatfield; + + // 27.4.2.1.3 Type ios_base::iostate + /** + * @brief This is a bitmask type. + * + * @c @a _Ios_Iostate is implementation-defined, but it is valid to + * perform bitwise operations on these values and expect the Right + * Thing to happen. Defined objects of type iostate are: + * - badbit + * - eofbit + * - failbit + * - goodbit + */ + typedef _Ios_Iostate iostate; + + /// Indicates a loss of integrity in an input or output sequence (such + /// as an irrecoverable read error from a file). + static const iostate badbit = _S_badbit; + + /// Indicates that an input operation reached the end of an input sequence. + static const iostate eofbit = _S_eofbit; + + /// Indicates that an input operation failed to read the expected + /// characters, or that an output operation failed to generate the + /// desired characters. + static const iostate failbit = _S_failbit; + + /// Indicates all is well. + static const iostate goodbit = _S_goodbit; + + // 27.4.2.1.4 Type ios_base::openmode + /** + * @brief This is a bitmask type. + * + * @c @a _Ios_Openmode is implementation-defined, but it is valid to + * perform bitwise operations on these values and expect the Right + * Thing to happen. Defined objects of type openmode are: + * - app + * - ate + * - binary + * - in + * - out + * - trunc + */ + typedef _Ios_Openmode openmode; + + /// Seek to end before each write. + static const openmode app = _S_app; + + /// Open and seek to end immediately after opening. + static const openmode ate = _S_ate; + + /// Perform input and output in binary mode (as opposed to text mode). + /// This is probably not what you think it is; see + /// https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary + static const openmode binary = _S_bin; + + /// Open for input. Default for @c ifstream and fstream. + static const openmode in = _S_in; + + /// Open for output. Default for @c ofstream and fstream. + static const openmode out = _S_out; + + /// Open for input. Default for @c ofstream. + static const openmode trunc = _S_trunc; + + // 27.4.2.1.5 Type ios_base::seekdir + /** + * @brief This is an enumerated type. + * + * @c @a _Ios_Seekdir is implementation-defined. Defined values + * of type seekdir are: + * - beg + * - cur, equivalent to @c SEEK_CUR in the C standard library. + * - end, equivalent to @c SEEK_END in the C standard library. + */ + typedef _Ios_Seekdir seekdir; + + /// Request a seek relative to the beginning of the stream. + static const seekdir beg = _S_beg; + + /// Request a seek relative to the current position within the sequence. + static const seekdir cur = _S_cur; + + /// Request a seek relative to the current end of the sequence. + static const seekdir end = _S_end; + + // Annex D.6 + typedef int io_state; + typedef int open_mode; + typedef int seek_dir; + + typedef std::streampos streampos; + typedef std::streamoff streamoff; + + // Callbacks; + /** + * @brief The set of events that may be passed to an event callback. + * + * erase_event is used during ~ios() and copyfmt(). imbue_event is used + * during imbue(). copyfmt_event is used during copyfmt(). + */ + enum event + { + erase_event, + imbue_event, + copyfmt_event + }; + + /** + * @brief The type of an event callback function. + * @param __e One of the members of the event enum. + * @param __b Reference to the ios_base object. + * @param __i The integer provided when the callback was registered. + * + * Event callbacks are user defined functions that get called during + * several ios_base and basic_ios functions, specifically imbue(), + * copyfmt(), and ~ios(). + */ + typedef void (*event_callback) (event __e, ios_base& __b, int __i); + + /** + * @brief Add the callback __fn with parameter __index. + * @param __fn The function to add. + * @param __index The integer to pass to the function when invoked. + * + * Registers a function as an event callback with an integer parameter to + * be passed to the function when invoked. Multiple copies of the + * function are allowed. If there are multiple callbacks, they are + * invoked in the order they were registered. + */ + void + register_callback(event_callback __fn, int __index); + + protected: + streamsize _M_precision; + streamsize _M_width; + fmtflags _M_flags; + iostate _M_exception; + iostate _M_streambuf_state; + + // 27.4.2.6 Members for callbacks + // 27.4.2.6 ios_base callbacks + struct _Callback_list + { + // Data Members + _Callback_list* _M_next; + ios_base::event_callback _M_fn; + int _M_index; + _Atomic_word _M_refcount; // 0 means one reference. + + _Callback_list(ios_base::event_callback __fn, int __index, + _Callback_list* __cb) + : _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { } + + void + _M_add_reference() { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); } + + // 0 => OK to delete. + int + _M_remove_reference() + { + // Be race-detector-friendly. For more info see bits/c++config. + _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount); + int __res = __gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1); + if (__res == 0) + { + _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount); + } + return __res; + } + }; + + _Callback_list* _M_callbacks; + + void + _M_call_callbacks(event __ev) throw(); + + void + _M_dispose_callbacks(void) throw(); + + // 27.4.2.5 Members for iword/pword storage + struct _Words + { + void* _M_pword; + long _M_iword; + _Words() : _M_pword(0), _M_iword(0) { } + }; + + // Only for failed iword/pword calls. + _Words _M_word_zero; + + // Guaranteed storage. + // The first 5 iword and pword slots are reserved for internal use. + enum { _S_local_word_size = 8 }; + _Words _M_local_word[_S_local_word_size]; + + // Allocated storage. + int _M_word_size; + _Words* _M_word; + + _Words& + _M_grow_words(int __index, bool __iword); + + // Members for locale and locale caching. + locale _M_ios_locale; + + void + _M_init() throw(); + + public: + + // 27.4.2.1.6 Class ios_base::Init + // Used to initialize standard streams. In theory, g++ could use + // -finit-priority to order this stuff correctly without going + // through these machinations. + class Init + { + friend class ios_base; + public: + Init(); + ~Init(); + + private: + static _Atomic_word _S_refcount; + static bool _S_synced_with_stdio; + }; + + // [27.4.2.2] fmtflags state functions + /** + * @brief Access to format flags. + * @return The format control flags for both input and output. + */ + fmtflags + flags() const + { return _M_flags; } + + /** + * @brief Setting new format flags all at once. + * @param __fmtfl The new flags to set. + * @return The previous format control flags. + * + * This function overwrites all the format flags with @a __fmtfl. + */ + fmtflags + flags(fmtflags __fmtfl) + { + fmtflags __old = _M_flags; + _M_flags = __fmtfl; + return __old; + } + + /** + * @brief Setting new format flags. + * @param __fmtfl Additional flags to set. + * @return The previous format control flags. + * + * This function sets additional flags in format control. Flags that + * were previously set remain set. + */ + fmtflags + setf(fmtflags __fmtfl) + { + fmtflags __old = _M_flags; + _M_flags |= __fmtfl; + return __old; + } + + /** + * @brief Setting new format flags. + * @param __fmtfl Additional flags to set. + * @param __mask The flags mask for @a fmtfl. + * @return The previous format control flags. + * + * This function clears @a mask in the format flags, then sets + * @a fmtfl @c & @a mask. An example mask is @c ios_base::adjustfield. + */ + fmtflags + setf(fmtflags __fmtfl, fmtflags __mask) + { + fmtflags __old = _M_flags; + _M_flags &= ~__mask; + _M_flags |= (__fmtfl & __mask); + return __old; + } + + /** + * @brief Clearing format flags. + * @param __mask The flags to unset. + * + * This function clears @a __mask in the format flags. + */ + void + unsetf(fmtflags __mask) + { _M_flags &= ~__mask; } + + /** + * @brief Flags access. + * @return The precision to generate on certain output operations. + * + * Be careful if you try to give a definition of @a precision here; see + * DR 189. + */ + streamsize + precision() const + { return _M_precision; } + + /** + * @brief Changing flags. + * @param __prec The new precision value. + * @return The previous value of precision(). + */ + streamsize + precision(streamsize __prec) + { + streamsize __old = _M_precision; + _M_precision = __prec; + return __old; + } + + /** + * @brief Flags access. + * @return The minimum field width to generate on output operations. + * + * Minimum field width refers to the number of characters. + */ + streamsize + width() const + { return _M_width; } + + /** + * @brief Changing flags. + * @param __wide The new width value. + * @return The previous value of width(). + */ + streamsize + width(streamsize __wide) + { + streamsize __old = _M_width; + _M_width = __wide; + return __old; + } + + // [27.4.2.4] ios_base static members + /** + * @brief Interaction with the standard C I/O objects. + * @param __sync Whether to synchronize or not. + * @return True if the standard streams were previously synchronized. + * + * The synchronization referred to is @e only that between the standard + * C facilities (e.g., stdout) and the standard C++ objects (e.g., + * cout). User-declared streams are unaffected. See + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/fstreams.html#std.io.filestreams.binary + */ + static bool + sync_with_stdio(bool __sync = true); + + // [27.4.2.3] ios_base locale functions + /** + * @brief Setting a new locale. + * @param __loc The new locale. + * @return The previous locale. + * + * Sets the new locale for this stream, and then invokes each callback + * with imbue_event. + */ + locale + imbue(const locale& __loc) throw(); + + /** + * @brief Locale access + * @return A copy of the current locale. + * + * If @c imbue(loc) has previously been called, then this function + * returns @c loc. Otherwise, it returns a copy of @c std::locale(), + * the global C++ locale. + */ + locale + getloc() const + { return _M_ios_locale; } + + /** + * @brief Locale access + * @return A reference to the current locale. + * + * Like getloc above, but returns a reference instead of + * generating a copy. + */ + const locale& + _M_getloc() const + { return _M_ios_locale; } + + // [27.4.2.5] ios_base storage functions + /** + * @brief Access to unique indices. + * @return An integer different from all previous calls. + * + * This function returns a unique integer every time it is called. It + * can be used for any purpose, but is primarily intended to be a unique + * index for the iword and pword functions. The expectation is that an + * application calls xalloc in order to obtain an index in the iword and + * pword arrays that can be used without fear of conflict. + * + * The implementation maintains a static variable that is incremented and + * returned on each invocation. xalloc is guaranteed to return an index + * that is safe to use in the iword and pword arrays. + */ + static int + xalloc() throw(); + + /** + * @brief Access to integer array. + * @param __ix Index into the array. + * @return A reference to an integer associated with the index. + * + * The iword function provides access to an array of integers that can be + * used for any purpose. The array grows as required to hold the + * supplied index. All integers in the array are initialized to 0. + * + * The implementation reserves several indices. You should use xalloc to + * obtain an index that is safe to use. Also note that since the array + * can grow dynamically, it is not safe to hold onto the reference. + */ + long& + iword(int __ix) + { + _Words& __word = (__ix < _M_word_size) + ? _M_word[__ix] : _M_grow_words(__ix, true); + return __word._M_iword; + } + + /** + * @brief Access to void pointer array. + * @param __ix Index into the array. + * @return A reference to a void* associated with the index. + * + * The pword function provides access to an array of pointers that can be + * used for any purpose. The array grows as required to hold the + * supplied index. All pointers in the array are initialized to 0. + * + * The implementation reserves several indices. You should use xalloc to + * obtain an index that is safe to use. Also note that since the array + * can grow dynamically, it is not safe to hold onto the reference. + */ + void*& + pword(int __ix) + { + _Words& __word = (__ix < _M_word_size) + ? _M_word[__ix] : _M_grow_words(__ix, false); + return __word._M_pword; + } + + // Destructor + /** + * Invokes each callback with erase_event. Destroys local storage. + * + * Note that the ios_base object for the standard streams never gets + * destroyed. As a result, any callbacks registered with the standard + * streams will not get invoked with erase_event (unless copyfmt is + * used). + */ + virtual ~ios_base(); + + protected: + ios_base() throw (); + +#if __cplusplus < 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 50. Copy constructor and assignment operator of ios_base + private: + ios_base(const ios_base&); + + ios_base& + operator=(const ios_base&); +#else + public: + ios_base(const ios_base&) = delete; + + ios_base& + operator=(const ios_base&) = delete; + + protected: + void + _M_move(ios_base&) noexcept; + + void + _M_swap(ios_base& __rhs) noexcept; +#endif + }; + + // [27.4.5.1] fmtflags manipulators + /// Calls base.setf(ios_base::boolalpha). + inline ios_base& + boolalpha(ios_base& __base) + { + __base.setf(ios_base::boolalpha); + return __base; + } + + /// Calls base.unsetf(ios_base::boolalpha). + inline ios_base& + noboolalpha(ios_base& __base) + { + __base.unsetf(ios_base::boolalpha); + return __base; + } + + /// Calls base.setf(ios_base::showbase). + inline ios_base& + showbase(ios_base& __base) + { + __base.setf(ios_base::showbase); + return __base; + } + + /// Calls base.unsetf(ios_base::showbase). + inline ios_base& + noshowbase(ios_base& __base) + { + __base.unsetf(ios_base::showbase); + return __base; + } + + /// Calls base.setf(ios_base::showpoint). + inline ios_base& + showpoint(ios_base& __base) + { + __base.setf(ios_base::showpoint); + return __base; + } + + /// Calls base.unsetf(ios_base::showpoint). + inline ios_base& + noshowpoint(ios_base& __base) + { + __base.unsetf(ios_base::showpoint); + return __base; + } + + /// Calls base.setf(ios_base::showpos). + inline ios_base& + showpos(ios_base& __base) + { + __base.setf(ios_base::showpos); + return __base; + } + + /// Calls base.unsetf(ios_base::showpos). + inline ios_base& + noshowpos(ios_base& __base) + { + __base.unsetf(ios_base::showpos); + return __base; + } + + /// Calls base.setf(ios_base::skipws). + inline ios_base& + skipws(ios_base& __base) + { + __base.setf(ios_base::skipws); + return __base; + } + + /// Calls base.unsetf(ios_base::skipws). + inline ios_base& + noskipws(ios_base& __base) + { + __base.unsetf(ios_base::skipws); + return __base; + } + + /// Calls base.setf(ios_base::uppercase). + inline ios_base& + uppercase(ios_base& __base) + { + __base.setf(ios_base::uppercase); + return __base; + } + + /// Calls base.unsetf(ios_base::uppercase). + inline ios_base& + nouppercase(ios_base& __base) + { + __base.unsetf(ios_base::uppercase); + return __base; + } + + /// Calls base.setf(ios_base::unitbuf). + inline ios_base& + unitbuf(ios_base& __base) + { + __base.setf(ios_base::unitbuf); + return __base; + } + + /// Calls base.unsetf(ios_base::unitbuf). + inline ios_base& + nounitbuf(ios_base& __base) + { + __base.unsetf(ios_base::unitbuf); + return __base; + } + + // [27.4.5.2] adjustfield manipulators + /// Calls base.setf(ios_base::internal, ios_base::adjustfield). + inline ios_base& + internal(ios_base& __base) + { + __base.setf(ios_base::internal, ios_base::adjustfield); + return __base; + } + + /// Calls base.setf(ios_base::left, ios_base::adjustfield). + inline ios_base& + left(ios_base& __base) + { + __base.setf(ios_base::left, ios_base::adjustfield); + return __base; + } + + /// Calls base.setf(ios_base::right, ios_base::adjustfield). + inline ios_base& + right(ios_base& __base) + { + __base.setf(ios_base::right, ios_base::adjustfield); + return __base; + } + + // [27.4.5.3] basefield manipulators + /// Calls base.setf(ios_base::dec, ios_base::basefield). + inline ios_base& + dec(ios_base& __base) + { + __base.setf(ios_base::dec, ios_base::basefield); + return __base; + } + + /// Calls base.setf(ios_base::hex, ios_base::basefield). + inline ios_base& + hex(ios_base& __base) + { + __base.setf(ios_base::hex, ios_base::basefield); + return __base; + } + + /// Calls base.setf(ios_base::oct, ios_base::basefield). + inline ios_base& + oct(ios_base& __base) + { + __base.setf(ios_base::oct, ios_base::basefield); + return __base; + } + + // [27.4.5.4] floatfield manipulators + /// Calls base.setf(ios_base::fixed, ios_base::floatfield). + inline ios_base& + fixed(ios_base& __base) + { + __base.setf(ios_base::fixed, ios_base::floatfield); + return __base; + } + + /// Calls base.setf(ios_base::scientific, ios_base::floatfield). + inline ios_base& + scientific(ios_base& __base) + { + __base.setf(ios_base::scientific, ios_base::floatfield); + return __base; + } + +#if __cplusplus >= 201103L + // New C++11 floatfield manipulators + + /// Calls + /// base.setf(ios_base::fixed|ios_base::scientific, ios_base::floatfield) + inline ios_base& + hexfloat(ios_base& __base) + { + __base.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield); + return __base; + } + + /// Calls @c base.unsetf(ios_base::floatfield) + inline ios_base& + defaultfloat(ios_base& __base) + { + __base.unsetf(ios_base::floatfield); + return __base; + } +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _IOS_BASE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/locale_classes.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/locale_classes.h new file mode 100644 index 0000000..b63e9c8 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/locale_classes.h @@ -0,0 +1,853 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/locale_classes.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{locale} + */ + +// +// ISO C++ 14882: 22.1 Locales +// + +#ifndef _LOCALE_CLASSES_H +#define _LOCALE_CLASSES_H 1 + +#pragma GCC system_header + +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // 22.1.1 Class locale + /** + * @brief Container class for localization functionality. + * @ingroup locales + * + * The locale class is first a class wrapper for C library locales. It is + * also an extensible container for user-defined localization. A locale is + * a collection of facets that implement various localization features such + * as money, time, and number printing. + * + * Constructing C++ locales does not change the C library locale. + * + * This library supports efficient construction and copying of locales + * through a reference counting implementation of the locale class. + */ + class locale + { + public: + // Types: + /// Definition of locale::category. + typedef int category; + + // Forward decls and friends: + class facet; + class id; + class _Impl; + + friend class facet; + friend class _Impl; + + template + friend bool + has_facet(const locale&) throw(); + + template + friend const _Facet& + use_facet(const locale&); + + template + friend struct __use_cache; + + //@{ + /** + * @brief Category values. + * + * The standard category values are none, ctype, numeric, collate, time, + * monetary, and messages. They form a bitmask that supports union and + * intersection. The category all is the union of these values. + * + * NB: Order must match _S_facet_categories definition in locale.cc + */ + static const category none = 0; + static const category ctype = 1L << 0; + static const category numeric = 1L << 1; + static const category collate = 1L << 2; + static const category time = 1L << 3; + static const category monetary = 1L << 4; + static const category messages = 1L << 5; + static const category all = (ctype | numeric | collate | + time | monetary | messages); + //@} + + // Construct/copy/destroy: + + /** + * @brief Default constructor. + * + * Constructs a copy of the global locale. If no locale has been + * explicitly set, this is the C locale. + */ + locale() throw(); + + /** + * @brief Copy constructor. + * + * Constructs a copy of @a other. + * + * @param __other The locale to copy. + */ + locale(const locale& __other) throw(); + + /** + * @brief Named locale constructor. + * + * Constructs a copy of the named C library locale. + * + * @param __s Name of the locale to construct. + * @throw std::runtime_error if __s is null or an undefined locale. + */ + explicit + locale(const char* __s); + + /** + * @brief Construct locale with facets from another locale. + * + * Constructs a copy of the locale @a base. The facets specified by @a + * cat are replaced with those from the locale named by @a s. If base is + * named, this locale instance will also be named. + * + * @param __base The locale to copy. + * @param __s Name of the locale to use facets from. + * @param __cat Set of categories defining the facets to use from __s. + * @throw std::runtime_error if __s is null or an undefined locale. + */ + locale(const locale& __base, const char* __s, category __cat); + +#if __cplusplus >= 201103L + /** + * @brief Named locale constructor. + * + * Constructs a copy of the named C library locale. + * + * @param __s Name of the locale to construct. + * @throw std::runtime_error if __s is an undefined locale. + */ + explicit + locale(const std::string& __s) : locale(__s.c_str()) { } + + /** + * @brief Construct locale with facets from another locale. + * + * Constructs a copy of the locale @a base. The facets specified by @a + * cat are replaced with those from the locale named by @a s. If base is + * named, this locale instance will also be named. + * + * @param __base The locale to copy. + * @param __s Name of the locale to use facets from. + * @param __cat Set of categories defining the facets to use from __s. + * @throw std::runtime_error if __s is an undefined locale. + */ + locale(const locale& __base, const std::string& __s, category __cat) + : locale(__base, __s.c_str(), __cat) { } +#endif + + /** + * @brief Construct locale with facets from another locale. + * + * Constructs a copy of the locale @a base. The facets specified by @a + * cat are replaced with those from the locale @a add. If @a base and @a + * add are named, this locale instance will also be named. + * + * @param __base The locale to copy. + * @param __add The locale to use facets from. + * @param __cat Set of categories defining the facets to use from add. + */ + locale(const locale& __base, const locale& __add, category __cat); + + /** + * @brief Construct locale with another facet. + * + * Constructs a copy of the locale @a __other. The facet @a __f + * is added to @a __other, replacing an existing facet of type + * Facet if there is one. If @a __f is null, this locale is a + * copy of @a __other. + * + * @param __other The locale to copy. + * @param __f The facet to add in. + */ + template + locale(const locale& __other, _Facet* __f); + + /// Locale destructor. + ~locale() throw(); + + /** + * @brief Assignment operator. + * + * Set this locale to be a copy of @a other. + * + * @param __other The locale to copy. + * @return A reference to this locale. + */ + const locale& + operator=(const locale& __other) throw(); + + /** + * @brief Construct locale with another facet. + * + * Constructs and returns a new copy of this locale. Adds or replaces an + * existing facet of type Facet from the locale @a other into the new + * locale. + * + * @tparam _Facet The facet type to copy from other + * @param __other The locale to copy from. + * @return Newly constructed locale. + * @throw std::runtime_error if __other has no facet of type _Facet. + */ + template + locale + combine(const locale& __other) const; + + // Locale operations: + /** + * @brief Return locale name. + * @return Locale name or "*" if unnamed. + */ + _GLIBCXX_DEFAULT_ABI_TAG + string + name() const; + + /** + * @brief Locale equality. + * + * @param __other The locale to compare against. + * @return True if other and this refer to the same locale instance, are + * copies, or have the same name. False otherwise. + */ + bool + operator==(const locale& __other) const throw(); + + /** + * @brief Locale inequality. + * + * @param __other The locale to compare against. + * @return ! (*this == __other) + */ + bool + operator!=(const locale& __other) const throw() + { return !(this->operator==(__other)); } + + /** + * @brief Compare two strings according to collate. + * + * Template operator to compare two strings using the compare function of + * the collate facet in this locale. One use is to provide the locale to + * the sort function. For example, a vector v of strings could be sorted + * according to locale loc by doing: + * @code + * std::sort(v.begin(), v.end(), loc); + * @endcode + * + * @param __s1 First string to compare. + * @param __s2 Second string to compare. + * @return True if collate<_Char> facet compares __s1 < __s2, else false. + */ + template + bool + operator()(const basic_string<_Char, _Traits, _Alloc>& __s1, + const basic_string<_Char, _Traits, _Alloc>& __s2) const; + + // Global locale objects: + /** + * @brief Set global locale + * + * This function sets the global locale to the argument and returns a + * copy of the previous global locale. If the argument has a name, it + * will also call std::setlocale(LC_ALL, loc.name()). + * + * @param __loc The new locale to make global. + * @return Copy of the old global locale. + */ + static locale + global(const locale& __loc); + + /** + * @brief Return reference to the C locale. + */ + static const locale& + classic(); + + private: + // The (shared) implementation + _Impl* _M_impl; + + // The "C" reference locale + static _Impl* _S_classic; + + // Current global locale + static _Impl* _S_global; + + // Names of underlying locale categories. + // NB: locale::global() has to know how to modify all the + // underlying categories, not just the ones required by the C++ + // standard. + static const char* const* const _S_categories; + + // Number of standard categories. For C++, these categories are + // collate, ctype, monetary, numeric, time, and messages. These + // directly correspond to ISO C99 macros LC_COLLATE, LC_CTYPE, + // LC_MONETARY, LC_NUMERIC, and LC_TIME. In addition, POSIX (IEEE + // 1003.1-2001) specifies LC_MESSAGES. + // In addition to the standard categories, the underlying + // operating system is allowed to define extra LC_* + // macros. For GNU systems, the following are also valid: + // LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE, LC_MEASUREMENT, + // and LC_IDENTIFICATION. + enum { _S_categories_size = 6 + _GLIBCXX_NUM_CATEGORIES }; + +#ifdef __GTHREADS + static __gthread_once_t _S_once; +#endif + + explicit + locale(_Impl*) throw(); + + static void + _S_initialize(); + + static void + _S_initialize_once() throw(); + + static category + _S_normalize_category(category); + + void + _M_coalesce(const locale& __base, const locale& __add, category __cat); + +#if _GLIBCXX_USE_CXX11_ABI + static const id* const _S_twinned_facets[]; +#endif + }; + + + // 22.1.1.1.2 Class locale::facet + /** + * @brief Localization functionality base class. + * @ingroup locales + * + * The facet class is the base class for a localization feature, such as + * money, time, and number printing. It provides common support for facets + * and reference management. + * + * Facets may not be copied or assigned. + */ + class locale::facet + { + private: + friend class locale; + friend class locale::_Impl; + + mutable _Atomic_word _M_refcount; + + // Contains data from the underlying "C" library for the classic locale. + static __c_locale _S_c_locale; + + // String literal for the name of the classic locale. + static const char _S_c_name[2]; + +#ifdef __GTHREADS + static __gthread_once_t _S_once; +#endif + + static void + _S_initialize_once(); + + protected: + /** + * @brief Facet constructor. + * + * This is the constructor provided by the standard. If refs is 0, the + * facet is destroyed when the last referencing locale is destroyed. + * Otherwise the facet will never be destroyed. + * + * @param __refs The initial value for reference count. + */ + explicit + facet(size_t __refs = 0) throw() : _M_refcount(__refs ? 1 : 0) + { } + + /// Facet destructor. + virtual + ~facet(); + + static void + _S_create_c_locale(__c_locale& __cloc, const char* __s, + __c_locale __old = 0); + + static __c_locale + _S_clone_c_locale(__c_locale& __cloc) throw(); + + static void + _S_destroy_c_locale(__c_locale& __cloc); + + static __c_locale + _S_lc_ctype_c_locale(__c_locale __cloc, const char* __s); + + // Returns data from the underlying "C" library data for the + // classic locale. + static __c_locale + _S_get_c_locale(); + + _GLIBCXX_CONST static const char* + _S_get_c_name() throw(); + +#if __cplusplus < 201103L + private: + facet(const facet&); // Not defined. + + facet& + operator=(const facet&); // Not defined. +#else + facet(const facet&) = delete; + + facet& + operator=(const facet&) = delete; +#endif + + private: + void + _M_add_reference() const throw() + { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); } + + void + _M_remove_reference() const throw() + { + // Be race-detector-friendly. For more info see bits/c++config. + _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount); + if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1) + { + _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount); + __try + { delete this; } + __catch(...) + { } + } + } + + const facet* _M_sso_shim(const id*) const; + const facet* _M_cow_shim(const id*) const; + + protected: + class __shim; // For internal use only. + }; + + + // 22.1.1.1.3 Class locale::id + /** + * @brief Facet ID class. + * @ingroup locales + * + * The ID class provides facets with an index used to identify them. + * Every facet class must define a public static member locale::id, or be + * derived from a facet that provides this member, otherwise the facet + * cannot be used in a locale. The locale::id ensures that each class + * type gets a unique identifier. + */ + class locale::id + { + private: + friend class locale; + friend class locale::_Impl; + + template + friend const _Facet& + use_facet(const locale&); + + template + friend bool + has_facet(const locale&) throw(); + + // NB: There is no accessor for _M_index because it may be used + // before the constructor is run; the effect of calling a member + // function (even an inline) would be undefined. + mutable size_t _M_index; + + // Last id number assigned. + static _Atomic_word _S_refcount; + + void + operator=(const id&); // Not defined. + + id(const id&); // Not defined. + + public: + // NB: This class is always a static data member, and thus can be + // counted on to be zero-initialized. + /// Constructor. + id() { } + + size_t + _M_id() const throw(); + }; + + + // Implementation object for locale. + class locale::_Impl + { + public: + // Friends. + friend class locale; + friend class locale::facet; + + template + friend bool + has_facet(const locale&) throw(); + + template + friend const _Facet& + use_facet(const locale&); + + template + friend struct __use_cache; + + private: + // Data Members. + _Atomic_word _M_refcount; + const facet** _M_facets; + size_t _M_facets_size; + const facet** _M_caches; + char** _M_names; + static const locale::id* const _S_id_ctype[]; + static const locale::id* const _S_id_numeric[]; + static const locale::id* const _S_id_collate[]; + static const locale::id* const _S_id_time[]; + static const locale::id* const _S_id_monetary[]; + static const locale::id* const _S_id_messages[]; + static const locale::id* const* const _S_facet_categories[]; + + void + _M_add_reference() throw() + { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); } + + void + _M_remove_reference() throw() + { + // Be race-detector-friendly. For more info see bits/c++config. + _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount); + if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1) + { + _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount); + __try + { delete this; } + __catch(...) + { } + } + } + + _Impl(const _Impl&, size_t); + _Impl(const char*, size_t); + _Impl(size_t) throw(); + + ~_Impl() throw(); + + _Impl(const _Impl&); // Not defined. + + void + operator=(const _Impl&); // Not defined. + + bool + _M_check_same_name() + { + bool __ret = true; + if (_M_names[1]) + // We must actually compare all the _M_names: can be all equal! + for (size_t __i = 0; __ret && __i < _S_categories_size - 1; ++__i) + __ret = __builtin_strcmp(_M_names[__i], _M_names[__i + 1]) == 0; + return __ret; + } + + void + _M_replace_categories(const _Impl*, category); + + void + _M_replace_category(const _Impl*, const locale::id* const*); + + void + _M_replace_facet(const _Impl*, const locale::id*); + + void + _M_install_facet(const locale::id*, const facet*); + + template + void + _M_init_facet(_Facet* __facet) + { _M_install_facet(&_Facet::id, __facet); } + + template + void + _M_init_facet_unchecked(_Facet* __facet) + { + __facet->_M_add_reference(); + _M_facets[_Facet::id._M_id()] = __facet; + } + + void + _M_install_cache(const facet*, size_t); + + void _M_init_extra(facet**); + void _M_init_extra(void*, void*, const char*, const char*); + }; + + + /** + * @brief Facet for localized string comparison. + * + * This facet encapsulates the code to compare strings in a localized + * manner. + * + * The collate template uses protected virtual functions to provide + * the actual results. The public accessors forward the call to + * the virtual functions. These virtual functions are hooks for + * developers to implement the behavior they require from the + * collate facet. + */ + template + class _GLIBCXX_NAMESPACE_CXX11 collate : public locale::facet + { + public: + // Types: + //@{ + /// Public typedefs + typedef _CharT char_type; + typedef basic_string<_CharT> string_type; + //@} + + protected: + // Underlying "C" library locale information saved from + // initialization, needed by collate_byname as well. + __c_locale _M_c_locale_collate; + + public: + /// Numpunct facet id. + static locale::id id; + + /** + * @brief Constructor performs initialization. + * + * This is the constructor provided by the standard. + * + * @param __refs Passed to the base facet class. + */ + explicit + collate(size_t __refs = 0) + : facet(__refs), _M_c_locale_collate(_S_get_c_locale()) + { } + + /** + * @brief Internal constructor. Not for general use. + * + * This is a constructor for use by the library itself to set up new + * locales. + * + * @param __cloc The C locale. + * @param __refs Passed to the base facet class. + */ + explicit + collate(__c_locale __cloc, size_t __refs = 0) + : facet(__refs), _M_c_locale_collate(_S_clone_c_locale(__cloc)) + { } + + /** + * @brief Compare two strings. + * + * This function compares two strings and returns the result by calling + * collate::do_compare(). + * + * @param __lo1 Start of string 1. + * @param __hi1 End of string 1. + * @param __lo2 Start of string 2. + * @param __hi2 End of string 2. + * @return 1 if string1 > string2, -1 if string1 < string2, else 0. + */ + int + compare(const _CharT* __lo1, const _CharT* __hi1, + const _CharT* __lo2, const _CharT* __hi2) const + { return this->do_compare(__lo1, __hi1, __lo2, __hi2); } + + /** + * @brief Transform string to comparable form. + * + * This function is a wrapper for strxfrm functionality. It takes the + * input string and returns a modified string that can be directly + * compared to other transformed strings. In the C locale, this + * function just returns a copy of the input string. In some other + * locales, it may replace two chars with one, change a char for + * another, etc. It does so by returning collate::do_transform(). + * + * @param __lo Start of string. + * @param __hi End of string. + * @return Transformed string_type. + */ + string_type + transform(const _CharT* __lo, const _CharT* __hi) const + { return this->do_transform(__lo, __hi); } + + /** + * @brief Return hash of a string. + * + * This function computes and returns a hash on the input string. It + * does so by returning collate::do_hash(). + * + * @param __lo Start of string. + * @param __hi End of string. + * @return Hash value. + */ + long + hash(const _CharT* __lo, const _CharT* __hi) const + { return this->do_hash(__lo, __hi); } + + // Used to abstract out _CharT bits in virtual member functions, below. + int + _M_compare(const _CharT*, const _CharT*) const throw(); + + size_t + _M_transform(_CharT*, const _CharT*, size_t) const throw(); + + protected: + /// Destructor. + virtual + ~collate() + { _S_destroy_c_locale(_M_c_locale_collate); } + + /** + * @brief Compare two strings. + * + * This function is a hook for derived classes to change the value + * returned. @see compare(). + * + * @param __lo1 Start of string 1. + * @param __hi1 End of string 1. + * @param __lo2 Start of string 2. + * @param __hi2 End of string 2. + * @return 1 if string1 > string2, -1 if string1 < string2, else 0. + */ + virtual int + do_compare(const _CharT* __lo1, const _CharT* __hi1, + const _CharT* __lo2, const _CharT* __hi2) const; + + /** + * @brief Transform string to comparable form. + * + * This function is a hook for derived classes to change the value + * returned. + * + * @param __lo Start. + * @param __hi End. + * @return transformed string. + */ + virtual string_type + do_transform(const _CharT* __lo, const _CharT* __hi) const; + + /** + * @brief Return hash of a string. + * + * This function computes and returns a hash on the input string. This + * function is a hook for derived classes to change the value returned. + * + * @param __lo Start of string. + * @param __hi End of string. + * @return Hash value. + */ + virtual long + do_hash(const _CharT* __lo, const _CharT* __hi) const; + }; + + template + locale::id collate<_CharT>::id; + + // Specializations. + template<> + int + collate::_M_compare(const char*, const char*) const throw(); + + template<> + size_t + collate::_M_transform(char*, const char*, size_t) const throw(); + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + int + collate::_M_compare(const wchar_t*, const wchar_t*) const throw(); + + template<> + size_t + collate::_M_transform(wchar_t*, const wchar_t*, size_t) const throw(); +#endif + + /// class collate_byname [22.2.4.2]. + template + class _GLIBCXX_NAMESPACE_CXX11 collate_byname : public collate<_CharT> + { + public: + //@{ + /// Public typedefs + typedef _CharT char_type; + typedef basic_string<_CharT> string_type; + //@} + + explicit + collate_byname(const char* __s, size_t __refs = 0) + : collate<_CharT>(__refs) + { + if (__builtin_strcmp(__s, "C") != 0 + && __builtin_strcmp(__s, "POSIX") != 0) + { + this->_S_destroy_c_locale(this->_M_c_locale_collate); + this->_S_create_c_locale(this->_M_c_locale_collate, __s); + } + } + +#if __cplusplus >= 201103L + explicit + collate_byname(const string& __s, size_t __refs = 0) + : collate_byname(__s.c_str(), __refs) { } +#endif + + protected: + virtual + ~collate_byname() { } + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +# include + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/locale_conv.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/locale_conv.h new file mode 100644 index 0000000..b8f77dc --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/locale_conv.h @@ -0,0 +1,549 @@ +// wstring_convert implementation -*- C++ -*- + +// Copyright (C) 2015-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/locale_conv.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{locale} + */ + +#ifndef _LOCALE_CONV_H +#define _LOCALE_CONV_H 1 + +#if __cplusplus < 201103L +# include +#else + +#include +#include "stringfwd.h" +#include "allocator.h" +#include "codecvt.h" +#include "unique_ptr.h" + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup locales + * @{ + */ + + template + bool + __do_str_codecvt(const _InChar* __first, const _InChar* __last, + _OutStr& __outstr, const _Codecvt& __cvt, _State& __state, + size_t& __count, _Fn __fn) + { + if (__first == __last) + { + __outstr.clear(); + __count = 0; + return true; + } + + size_t __outchars = 0; + auto __next = __first; + const auto __maxlen = __cvt.max_length() + 1; + + codecvt_base::result __result; + do + { + __outstr.resize(__outstr.size() + (__last - __next) * __maxlen); + auto __outnext = &__outstr.front() + __outchars; + auto const __outlast = &__outstr.back() + 1; + __result = (__cvt.*__fn)(__state, __next, __last, __next, + __outnext, __outlast, __outnext); + __outchars = __outnext - &__outstr.front(); + } + while (__result == codecvt_base::partial && __next != __last + && (__outstr.size() - __outchars) < __maxlen); + + if (__result == codecvt_base::error) + { + __count = __next - __first; + return false; + } + + if (__result == codecvt_base::noconv) + { + __outstr.assign(__first, __last); + __count = __last - __first; + } + else + { + __outstr.resize(__outchars); + __count = __next - __first; + } + + return true; + } + + // Convert narrow character string to wide. + template + inline bool + __str_codecvt_in(const char* __first, const char* __last, + basic_string<_CharT, _Traits, _Alloc>& __outstr, + const codecvt<_CharT, char, _State>& __cvt, + _State& __state, size_t& __count) + { + using _Codecvt = codecvt<_CharT, char, _State>; + using _ConvFn + = codecvt_base::result + (_Codecvt::*)(_State&, const char*, const char*, const char*&, + _CharT*, _CharT*, _CharT*&) const; + _ConvFn __fn = &codecvt<_CharT, char, _State>::in; + return __do_str_codecvt(__first, __last, __outstr, __cvt, __state, + __count, __fn); + } + + template + inline bool + __str_codecvt_in(const char* __first, const char* __last, + basic_string<_CharT, _Traits, _Alloc>& __outstr, + const codecvt<_CharT, char, _State>& __cvt) + { + _State __state = {}; + size_t __n; + return __str_codecvt_in(__first, __last, __outstr, __cvt, __state, __n); + } + + // Convert wide character string to narrow. + template + inline bool + __str_codecvt_out(const _CharT* __first, const _CharT* __last, + basic_string& __outstr, + const codecvt<_CharT, char, _State>& __cvt, + _State& __state, size_t& __count) + { + using _Codecvt = codecvt<_CharT, char, _State>; + using _ConvFn + = codecvt_base::result + (_Codecvt::*)(_State&, const _CharT*, const _CharT*, const _CharT*&, + char*, char*, char*&) const; + _ConvFn __fn = &codecvt<_CharT, char, _State>::out; + return __do_str_codecvt(__first, __last, __outstr, __cvt, __state, + __count, __fn); + } + + template + inline bool + __str_codecvt_out(const _CharT* __first, const _CharT* __last, + basic_string& __outstr, + const codecvt<_CharT, char, _State>& __cvt) + { + _State __state = {}; + size_t __n; + return __str_codecvt_out(__first, __last, __outstr, __cvt, __state, __n); + } + +#ifdef _GLIBCXX_USE_WCHAR_T + +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + /// String conversions + template, + typename _Byte_alloc = allocator> + class wstring_convert + { + public: + typedef basic_string, _Byte_alloc> byte_string; + typedef basic_string<_Elem, char_traits<_Elem>, _Wide_alloc> wide_string; + typedef typename _Codecvt::state_type state_type; + typedef typename wide_string::traits_type::int_type int_type; + + /** Default constructor. + * + * @param __pcvt The facet to use for conversions. + * + * Takes ownership of @p __pcvt and will delete it in the destructor. + */ + explicit + wstring_convert(_Codecvt* __pcvt = new _Codecvt()) : _M_cvt(__pcvt) + { + if (!_M_cvt) + __throw_logic_error("wstring_convert"); + } + + /** Construct with an initial converstion state. + * + * @param __pcvt The facet to use for conversions. + * @param __state Initial conversion state. + * + * Takes ownership of @p __pcvt and will delete it in the destructor. + * The object's conversion state will persist between conversions. + */ + wstring_convert(_Codecvt* __pcvt, state_type __state) + : _M_cvt(__pcvt), _M_state(__state), _M_with_cvtstate(true) + { + if (!_M_cvt) + __throw_logic_error("wstring_convert"); + } + + /** Construct with error strings. + * + * @param __byte_err A string to return on failed conversions. + * @param __wide_err A wide string to return on failed conversions. + */ + explicit + wstring_convert(const byte_string& __byte_err, + const wide_string& __wide_err = wide_string()) + : _M_cvt(new _Codecvt), + _M_byte_err_string(__byte_err), _M_wide_err_string(__wide_err), + _M_with_strings(true) + { + if (!_M_cvt) + __throw_logic_error("wstring_convert"); + } + + ~wstring_convert() = default; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2176. Special members for wstring_convert and wbuffer_convert + wstring_convert(const wstring_convert&) = delete; + wstring_convert& operator=(const wstring_convert&) = delete; + + /// @{ Convert from bytes. + wide_string + from_bytes(char __byte) + { + char __bytes[2] = { __byte }; + return from_bytes(__bytes, __bytes+1); + } + + wide_string + from_bytes(const char* __ptr) + { return from_bytes(__ptr, __ptr+char_traits::length(__ptr)); } + + wide_string + from_bytes(const byte_string& __str) + { + auto __ptr = __str.data(); + return from_bytes(__ptr, __ptr + __str.size()); + } + + wide_string + from_bytes(const char* __first, const char* __last) + { + if (!_M_with_cvtstate) + _M_state = state_type(); + wide_string __out{ _M_wide_err_string.get_allocator() }; + if (__str_codecvt_in(__first, __last, __out, *_M_cvt, _M_state, + _M_count)) + return __out; + if (_M_with_strings) + return _M_wide_err_string; + __throw_range_error("wstring_convert::from_bytes"); + } + /// @} + + /// @{ Convert to bytes. + byte_string + to_bytes(_Elem __wchar) + { + _Elem __wchars[2] = { __wchar }; + return to_bytes(__wchars, __wchars+1); + } + + byte_string + to_bytes(const _Elem* __ptr) + { + return to_bytes(__ptr, __ptr+wide_string::traits_type::length(__ptr)); + } + + byte_string + to_bytes(const wide_string& __wstr) + { + auto __ptr = __wstr.data(); + return to_bytes(__ptr, __ptr + __wstr.size()); + } + + byte_string + to_bytes(const _Elem* __first, const _Elem* __last) + { + if (!_M_with_cvtstate) + _M_state = state_type(); + byte_string __out{ _M_byte_err_string.get_allocator() }; + if (__str_codecvt_out(__first, __last, __out, *_M_cvt, _M_state, + _M_count)) + return __out; + if (_M_with_strings) + return _M_byte_err_string; + __throw_range_error("wstring_convert::to_bytes"); + } + /// @} + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2174. wstring_convert::converted() should be noexcept + /// The number of elements successfully converted in the last conversion. + size_t converted() const noexcept { return _M_count; } + + /// The final conversion state of the last conversion. + state_type state() const { return _M_state; } + + private: + unique_ptr<_Codecvt> _M_cvt; + byte_string _M_byte_err_string; + wide_string _M_wide_err_string; + state_type _M_state = state_type(); + size_t _M_count = 0; + bool _M_with_cvtstate = false; + bool _M_with_strings = false; + }; + +_GLIBCXX_END_NAMESPACE_CXX11 + + /// Buffer conversions + template> + class wbuffer_convert : public basic_streambuf<_Elem, _Tr> + { + typedef basic_streambuf<_Elem, _Tr> _Wide_streambuf; + + public: + typedef typename _Codecvt::state_type state_type; + + /** Default constructor. + * + * @param __bytebuf The underlying byte stream buffer. + * @param __pcvt The facet to use for conversions. + * @param __state Initial conversion state. + * + * Takes ownership of @p __pcvt and will delete it in the destructor. + */ + explicit + wbuffer_convert(streambuf* __bytebuf = 0, _Codecvt* __pcvt = new _Codecvt, + state_type __state = state_type()) + : _M_buf(__bytebuf), _M_cvt(__pcvt), _M_state(__state) + { + if (!_M_cvt) + __throw_logic_error("wbuffer_convert"); + + _M_always_noconv = _M_cvt->always_noconv(); + + if (_M_buf) + { + this->setp(_M_put_area, _M_put_area + _S_buffer_length); + this->setg(_M_get_area + _S_putback_length, + _M_get_area + _S_putback_length, + _M_get_area + _S_putback_length); + } + } + + ~wbuffer_convert() = default; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2176. Special members for wstring_convert and wbuffer_convert + wbuffer_convert(const wbuffer_convert&) = delete; + wbuffer_convert& operator=(const wbuffer_convert&) = delete; + + streambuf* rdbuf() const noexcept { return _M_buf; } + + streambuf* + rdbuf(streambuf *__bytebuf) noexcept + { + auto __prev = _M_buf; + _M_buf = __bytebuf; + return __prev; + } + + /// The conversion state following the last conversion. + state_type state() const noexcept { return _M_state; } + + protected: + int + sync() + { return _M_buf && _M_conv_put() && !_M_buf->pubsync() ? 0 : -1; } + + typename _Wide_streambuf::int_type + overflow(typename _Wide_streambuf::int_type __out) + { + if (!_M_buf || !_M_conv_put()) + return _Tr::eof(); + else if (!_Tr::eq_int_type(__out, _Tr::eof())) + return this->sputc(__out); + return _Tr::not_eof(__out); + } + + typename _Wide_streambuf::int_type + underflow() + { + if (!_M_buf) + return _Tr::eof(); + + if (this->gptr() < this->egptr() || (_M_buf && _M_conv_get())) + return _Tr::to_int_type(*this->gptr()); + else + return _Tr::eof(); + } + + streamsize + xsputn(const typename _Wide_streambuf::char_type* __s, streamsize __n) + { + if (!_M_buf || __n == 0) + return 0; + streamsize __done = 0; + do + { + auto __nn = std::min(this->epptr() - this->pptr(), + __n - __done); + _Tr::copy(this->pptr(), __s + __done, __nn); + this->pbump(__nn); + __done += __nn; + } while (__done < __n && _M_conv_put()); + return __done; + } + + private: + // fill the get area from converted contents of the byte stream buffer + bool + _M_conv_get() + { + const streamsize __pb1 = this->gptr() - this->eback(); + const streamsize __pb2 = _S_putback_length; + const streamsize __npb = std::min(__pb1, __pb2); + + _Tr::move(_M_get_area + _S_putback_length - __npb, + this->gptr() - __npb, __npb); + + streamsize __nbytes = sizeof(_M_get_buf) - _M_unconv; + __nbytes = std::min(__nbytes, _M_buf->in_avail()); + if (__nbytes < 1) + __nbytes = 1; + __nbytes = _M_buf->sgetn(_M_get_buf + _M_unconv, __nbytes); + if (__nbytes < 1) + return false; + __nbytes += _M_unconv; + + // convert _M_get_buf into _M_get_area + + _Elem* __outbuf = _M_get_area + _S_putback_length; + _Elem* __outnext = __outbuf; + const char* __bnext = _M_get_buf; + + codecvt_base::result __result; + if (_M_always_noconv) + __result = codecvt_base::noconv; + else + { + _Elem* __outend = _M_get_area + _S_buffer_length; + + __result = _M_cvt->in(_M_state, + __bnext, __bnext + __nbytes, __bnext, + __outbuf, __outend, __outnext); + } + + if (__result == codecvt_base::noconv) + { + // cast is safe because noconv means _Elem is same type as char + auto __get_buf = reinterpret_cast(_M_get_buf); + _Tr::copy(__outbuf, __get_buf, __nbytes); + _M_unconv = 0; + return true; + } + + if ((_M_unconv = _M_get_buf + __nbytes - __bnext)) + char_traits::move(_M_get_buf, __bnext, _M_unconv); + + this->setg(__outbuf, __outbuf, __outnext); + + return __result != codecvt_base::error; + } + + // unused + bool + _M_put(...) + { return false; } + + bool + _M_put(const char* __p, streamsize __n) + { + if (_M_buf->sputn(__p, __n) < __n) + return false; + return true; + } + + // convert the put area and write to the byte stream buffer + bool + _M_conv_put() + { + _Elem* const __first = this->pbase(); + const _Elem* const __last = this->pptr(); + const streamsize __pending = __last - __first; + + if (_M_always_noconv) + return _M_put(__first, __pending); + + char __outbuf[2 * _S_buffer_length]; + + const _Elem* __next = __first; + const _Elem* __start; + do + { + __start = __next; + char* __outnext = __outbuf; + char* const __outlast = __outbuf + sizeof(__outbuf); + auto __result = _M_cvt->out(_M_state, __next, __last, __next, + __outnext, __outlast, __outnext); + if (__result == codecvt_base::error) + return false; + else if (__result == codecvt_base::noconv) + return _M_put(__next, __pending); + + if (!_M_put(__outbuf, __outnext - __outbuf)) + return false; + } + while (__next != __last && __next != __start); + + if (__next != __last) + _Tr::move(__first, __next, __last - __next); + + this->pbump(__first - __next); + return __next != __first; + } + + streambuf* _M_buf; + unique_ptr<_Codecvt> _M_cvt; + state_type _M_state; + + static const streamsize _S_buffer_length = 32; + static const streamsize _S_putback_length = 3; + _Elem _M_put_area[_S_buffer_length]; + _Elem _M_get_area[_S_buffer_length]; + streamsize _M_unconv = 0; + char _M_get_buf[_S_buffer_length-_S_putback_length]; + bool _M_always_noconv; + }; + +#endif // _GLIBCXX_USE_WCHAR_T + + /// @} group locales + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif // __cplusplus + +#endif /* _LOCALE_CONV_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/locale_facets.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/locale_facets.h new file mode 100644 index 0000000..1ad0eb5 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/locale_facets.h @@ -0,0 +1,2653 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 1997-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/locale_facets.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{locale} + */ + +// +// ISO C++ 14882: 22.1 Locales +// + +#ifndef _LOCALE_FACETS_H +#define _LOCALE_FACETS_H 1 + +#pragma GCC system_header + +#include // For wctype_t +#include +#include +#include +#include // For ios_base, ios_base::iostate +#include +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // NB: Don't instantiate required wchar_t facets if no wchar_t support. +#ifdef _GLIBCXX_USE_WCHAR_T +# define _GLIBCXX_NUM_FACETS 28 +# define _GLIBCXX_NUM_CXX11_FACETS 16 +#else +# define _GLIBCXX_NUM_FACETS 14 +# define _GLIBCXX_NUM_CXX11_FACETS 8 +#endif +#ifdef _GLIBCXX_USE_C99_STDINT_TR1 +# define _GLIBCXX_NUM_UNICODE_FACETS 2 +#else +# define _GLIBCXX_NUM_UNICODE_FACETS 0 +#endif + + // Convert string to numeric value of type _Tp and store results. + // NB: This is specialized for all required types, there is no + // generic definition. + template + void + __convert_to_v(const char*, _Tp&, ios_base::iostate&, + const __c_locale&) throw(); + + // Explicit specializations for required types. + template<> + void + __convert_to_v(const char*, float&, ios_base::iostate&, + const __c_locale&) throw(); + + template<> + void + __convert_to_v(const char*, double&, ios_base::iostate&, + const __c_locale&) throw(); + + template<> + void + __convert_to_v(const char*, long double&, ios_base::iostate&, + const __c_locale&) throw(); + + // NB: __pad is a struct, rather than a function, so it can be + // partially-specialized. + template + struct __pad + { + static void + _S_pad(ios_base& __io, _CharT __fill, _CharT* __news, + const _CharT* __olds, streamsize __newlen, streamsize __oldlen); + }; + + // Used by both numeric and monetary facets. + // Inserts "group separator" characters into an array of characters. + // It's recursive, one iteration per group. It moves the characters + // in the buffer this way: "xxxx12345" -> "12,345xxx". Call this + // only with __gsize != 0. + template + _CharT* + __add_grouping(_CharT* __s, _CharT __sep, + const char* __gbeg, size_t __gsize, + const _CharT* __first, const _CharT* __last); + + // This template permits specializing facet output code for + // ostreambuf_iterator. For ostreambuf_iterator, sputn is + // significantly more efficient than incrementing iterators. + template + inline + ostreambuf_iterator<_CharT> + __write(ostreambuf_iterator<_CharT> __s, const _CharT* __ws, int __len) + { + __s._M_put(__ws, __len); + return __s; + } + + // This is the unspecialized form of the template. + template + inline + _OutIter + __write(_OutIter __s, const _CharT* __ws, int __len) + { + for (int __j = 0; __j < __len; __j++, ++__s) + *__s = __ws[__j]; + return __s; + } + + + // 22.2.1.1 Template class ctype + // Include host and configuration specific ctype enums for ctype_base. + + /** + * @brief Common base for ctype facet + * + * This template class provides implementations of the public functions + * that forward to the protected virtual functions. + * + * This template also provides abstract stubs for the protected virtual + * functions. + */ + template + class __ctype_abstract_base : public locale::facet, public ctype_base + { + public: + // Types: + /// Typedef for the template parameter + typedef _CharT char_type; + + /** + * @brief Test char_type classification. + * + * This function finds a mask M for @a __c and compares it to + * mask @a __m. It does so by returning the value of + * ctype::do_is(). + * + * @param __c The char_type to compare the mask of. + * @param __m The mask to compare against. + * @return (M & __m) != 0. + */ + bool + is(mask __m, char_type __c) const + { return this->do_is(__m, __c); } + + /** + * @brief Return a mask array. + * + * This function finds the mask for each char_type in the range [lo,hi) + * and successively writes it to vec. vec must have as many elements + * as the char array. It does so by returning the value of + * ctype::do_is(). + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @param __vec Pointer to an array of mask storage. + * @return @a __hi. + */ + const char_type* + is(const char_type *__lo, const char_type *__hi, mask *__vec) const + { return this->do_is(__lo, __hi, __vec); } + + /** + * @brief Find char_type matching a mask + * + * This function searches for and returns the first char_type c in + * [lo,hi) for which is(m,c) is true. It does so by returning + * ctype::do_scan_is(). + * + * @param __m The mask to compare against. + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return Pointer to matching char_type if found, else @a __hi. + */ + const char_type* + scan_is(mask __m, const char_type* __lo, const char_type* __hi) const + { return this->do_scan_is(__m, __lo, __hi); } + + /** + * @brief Find char_type not matching a mask + * + * This function searches for and returns the first char_type c in + * [lo,hi) for which is(m,c) is false. It does so by returning + * ctype::do_scan_not(). + * + * @param __m The mask to compare against. + * @param __lo Pointer to first char in range. + * @param __hi Pointer to end of range. + * @return Pointer to non-matching char if found, else @a __hi. + */ + const char_type* + scan_not(mask __m, const char_type* __lo, const char_type* __hi) const + { return this->do_scan_not(__m, __lo, __hi); } + + /** + * @brief Convert to uppercase. + * + * This function converts the argument to uppercase if possible. + * If not possible (for example, '2'), returns the argument. It does + * so by returning ctype::do_toupper(). + * + * @param __c The char_type to convert. + * @return The uppercase char_type if convertible, else @a __c. + */ + char_type + toupper(char_type __c) const + { return this->do_toupper(__c); } + + /** + * @brief Convert array to uppercase. + * + * This function converts each char_type in the range [lo,hi) to + * uppercase if possible. Other elements remain untouched. It does so + * by returning ctype:: do_toupper(lo, hi). + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return @a __hi. + */ + const char_type* + toupper(char_type *__lo, const char_type* __hi) const + { return this->do_toupper(__lo, __hi); } + + /** + * @brief Convert to lowercase. + * + * This function converts the argument to lowercase if possible. If + * not possible (for example, '2'), returns the argument. It does so + * by returning ctype::do_tolower(c). + * + * @param __c The char_type to convert. + * @return The lowercase char_type if convertible, else @a __c. + */ + char_type + tolower(char_type __c) const + { return this->do_tolower(__c); } + + /** + * @brief Convert array to lowercase. + * + * This function converts each char_type in the range [__lo,__hi) to + * lowercase if possible. Other elements remain untouched. It does so + * by returning ctype:: do_tolower(__lo, __hi). + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return @a __hi. + */ + const char_type* + tolower(char_type* __lo, const char_type* __hi) const + { return this->do_tolower(__lo, __hi); } + + /** + * @brief Widen char to char_type + * + * This function converts the char argument to char_type using the + * simplest reasonable transformation. It does so by returning + * ctype::do_widen(c). + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __c The char to convert. + * @return The converted char_type. + */ + char_type + widen(char __c) const + { return this->do_widen(__c); } + + /** + * @brief Widen array to char_type + * + * This function converts each char in the input to char_type using the + * simplest reasonable transformation. It does so by returning + * ctype::do_widen(c). + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @param __to Pointer to the destination array. + * @return @a __hi. + */ + const char* + widen(const char* __lo, const char* __hi, char_type* __to) const + { return this->do_widen(__lo, __hi, __to); } + + /** + * @brief Narrow char_type to char + * + * This function converts the char_type to char using the simplest + * reasonable transformation. If the conversion fails, dfault is + * returned instead. It does so by returning + * ctype::do_narrow(__c). + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __c The char_type to convert. + * @param __dfault Char to return if conversion fails. + * @return The converted char. + */ + char + narrow(char_type __c, char __dfault) const + { return this->do_narrow(__c, __dfault); } + + /** + * @brief Narrow array to char array + * + * This function converts each char_type in the input to char using the + * simplest reasonable transformation and writes the results to the + * destination array. For any char_type in the input that cannot be + * converted, @a dfault is used instead. It does so by returning + * ctype::do_narrow(__lo, __hi, __dfault, __to). + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @param __dfault Char to use if conversion fails. + * @param __to Pointer to the destination array. + * @return @a __hi. + */ + const char_type* + narrow(const char_type* __lo, const char_type* __hi, + char __dfault, char* __to) const + { return this->do_narrow(__lo, __hi, __dfault, __to); } + + protected: + explicit + __ctype_abstract_base(size_t __refs = 0): facet(__refs) { } + + virtual + ~__ctype_abstract_base() { } + + /** + * @brief Test char_type classification. + * + * This function finds a mask M for @a c and compares it to mask @a m. + * + * do_is() is a hook for a derived facet to change the behavior of + * classifying. do_is() must always return the same result for the + * same input. + * + * @param __c The char_type to find the mask of. + * @param __m The mask to compare against. + * @return (M & __m) != 0. + */ + virtual bool + do_is(mask __m, char_type __c) const = 0; + + /** + * @brief Return a mask array. + * + * This function finds the mask for each char_type in the range [lo,hi) + * and successively writes it to vec. vec must have as many elements + * as the input. + * + * do_is() is a hook for a derived facet to change the behavior of + * classifying. do_is() must always return the same result for the + * same input. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @param __vec Pointer to an array of mask storage. + * @return @a __hi. + */ + virtual const char_type* + do_is(const char_type* __lo, const char_type* __hi, + mask* __vec) const = 0; + + /** + * @brief Find char_type matching mask + * + * This function searches for and returns the first char_type c in + * [__lo,__hi) for which is(__m,c) is true. + * + * do_scan_is() is a hook for a derived facet to change the behavior of + * match searching. do_is() must always return the same result for the + * same input. + * + * @param __m The mask to compare against. + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return Pointer to a matching char_type if found, else @a __hi. + */ + virtual const char_type* + do_scan_is(mask __m, const char_type* __lo, + const char_type* __hi) const = 0; + + /** + * @brief Find char_type not matching mask + * + * This function searches for and returns a pointer to the first + * char_type c of [lo,hi) for which is(m,c) is false. + * + * do_scan_is() is a hook for a derived facet to change the behavior of + * match searching. do_is() must always return the same result for the + * same input. + * + * @param __m The mask to compare against. + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return Pointer to a non-matching char_type if found, else @a __hi. + */ + virtual const char_type* + do_scan_not(mask __m, const char_type* __lo, + const char_type* __hi) const = 0; + + /** + * @brief Convert to uppercase. + * + * This virtual function converts the char_type argument to uppercase + * if possible. If not possible (for example, '2'), returns the + * argument. + * + * do_toupper() is a hook for a derived facet to change the behavior of + * uppercasing. do_toupper() must always return the same result for + * the same input. + * + * @param __c The char_type to convert. + * @return The uppercase char_type if convertible, else @a __c. + */ + virtual char_type + do_toupper(char_type __c) const = 0; + + /** + * @brief Convert array to uppercase. + * + * This virtual function converts each char_type in the range [__lo,__hi) + * to uppercase if possible. Other elements remain untouched. + * + * do_toupper() is a hook for a derived facet to change the behavior of + * uppercasing. do_toupper() must always return the same result for + * the same input. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return @a __hi. + */ + virtual const char_type* + do_toupper(char_type* __lo, const char_type* __hi) const = 0; + + /** + * @brief Convert to lowercase. + * + * This virtual function converts the argument to lowercase if + * possible. If not possible (for example, '2'), returns the argument. + * + * do_tolower() is a hook for a derived facet to change the behavior of + * lowercasing. do_tolower() must always return the same result for + * the same input. + * + * @param __c The char_type to convert. + * @return The lowercase char_type if convertible, else @a __c. + */ + virtual char_type + do_tolower(char_type __c) const = 0; + + /** + * @brief Convert array to lowercase. + * + * This virtual function converts each char_type in the range [__lo,__hi) + * to lowercase if possible. Other elements remain untouched. + * + * do_tolower() is a hook for a derived facet to change the behavior of + * lowercasing. do_tolower() must always return the same result for + * the same input. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return @a __hi. + */ + virtual const char_type* + do_tolower(char_type* __lo, const char_type* __hi) const = 0; + + /** + * @brief Widen char + * + * This virtual function converts the char to char_type using the + * simplest reasonable transformation. + * + * do_widen() is a hook for a derived facet to change the behavior of + * widening. do_widen() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __c The char to convert. + * @return The converted char_type + */ + virtual char_type + do_widen(char __c) const = 0; + + /** + * @brief Widen char array + * + * This function converts each char in the input to char_type using the + * simplest reasonable transformation. + * + * do_widen() is a hook for a derived facet to change the behavior of + * widening. do_widen() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __lo Pointer to start range. + * @param __hi Pointer to end of range. + * @param __to Pointer to the destination array. + * @return @a __hi. + */ + virtual const char* + do_widen(const char* __lo, const char* __hi, char_type* __to) const = 0; + + /** + * @brief Narrow char_type to char + * + * This virtual function converts the argument to char using the + * simplest reasonable transformation. If the conversion fails, dfault + * is returned instead. + * + * do_narrow() is a hook for a derived facet to change the behavior of + * narrowing. do_narrow() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __c The char_type to convert. + * @param __dfault Char to return if conversion fails. + * @return The converted char. + */ + virtual char + do_narrow(char_type __c, char __dfault) const = 0; + + /** + * @brief Narrow char_type array to char + * + * This virtual function converts each char_type in the range + * [__lo,__hi) to char using the simplest reasonable + * transformation and writes the results to the destination + * array. For any element in the input that cannot be + * converted, @a __dfault is used instead. + * + * do_narrow() is a hook for a derived facet to change the behavior of + * narrowing. do_narrow() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @param __dfault Char to use if conversion fails. + * @param __to Pointer to the destination array. + * @return @a __hi. + */ + virtual const char_type* + do_narrow(const char_type* __lo, const char_type* __hi, + char __dfault, char* __to) const = 0; + }; + + /** + * @brief Primary class template ctype facet. + * @ingroup locales + * + * This template class defines classification and conversion functions for + * character sets. It wraps cctype functionality. Ctype gets used by + * streams for many I/O operations. + * + * This template provides the protected virtual functions the developer + * will have to replace in a derived class or specialization to make a + * working facet. The public functions that access them are defined in + * __ctype_abstract_base, to allow for implementation flexibility. See + * ctype for an example. The functions are documented in + * __ctype_abstract_base. + * + * Note: implementations are provided for all the protected virtual + * functions, but will likely not be useful. + */ + template + class ctype : public __ctype_abstract_base<_CharT> + { + public: + // Types: + typedef _CharT char_type; + typedef typename __ctype_abstract_base<_CharT>::mask mask; + + /// The facet id for ctype + static locale::id id; + + explicit + ctype(size_t __refs = 0) : __ctype_abstract_base<_CharT>(__refs) { } + + protected: + virtual + ~ctype(); + + virtual bool + do_is(mask __m, char_type __c) const; + + virtual const char_type* + do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const; + + virtual const char_type* + do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const; + + virtual const char_type* + do_scan_not(mask __m, const char_type* __lo, + const char_type* __hi) const; + + virtual char_type + do_toupper(char_type __c) const; + + virtual const char_type* + do_toupper(char_type* __lo, const char_type* __hi) const; + + virtual char_type + do_tolower(char_type __c) const; + + virtual const char_type* + do_tolower(char_type* __lo, const char_type* __hi) const; + + virtual char_type + do_widen(char __c) const; + + virtual const char* + do_widen(const char* __lo, const char* __hi, char_type* __dest) const; + + virtual char + do_narrow(char_type, char __dfault) const; + + virtual const char_type* + do_narrow(const char_type* __lo, const char_type* __hi, + char __dfault, char* __to) const; + }; + + template + locale::id ctype<_CharT>::id; + + /** + * @brief The ctype specialization. + * @ingroup locales + * + * This class defines classification and conversion functions for + * the char type. It gets used by char streams for many I/O + * operations. The char specialization provides a number of + * optimizations as well. + */ + template<> + class ctype : public locale::facet, public ctype_base + { + public: + // Types: + /// Typedef for the template parameter char. + typedef char char_type; + + protected: + // Data Members: + __c_locale _M_c_locale_ctype; + bool _M_del; + __to_type _M_toupper; + __to_type _M_tolower; + const mask* _M_table; + mutable char _M_widen_ok; + mutable char _M_widen[1 + static_cast(-1)]; + mutable char _M_narrow[1 + static_cast(-1)]; + mutable char _M_narrow_ok; // 0 uninitialized, 1 init, + // 2 memcpy can't be used + + public: + /// The facet id for ctype + static locale::id id; + /// The size of the mask table. It is SCHAR_MAX + 1. + static const size_t table_size = 1 + static_cast(-1); + + /** + * @brief Constructor performs initialization. + * + * This is the constructor provided by the standard. + * + * @param __table If non-zero, table is used as the per-char mask. + * Else classic_table() is used. + * @param __del If true, passes ownership of table to this facet. + * @param __refs Passed to the base facet class. + */ + explicit + ctype(const mask* __table = 0, bool __del = false, size_t __refs = 0); + + /** + * @brief Constructor performs static initialization. + * + * This constructor is used to construct the initial C locale facet. + * + * @param __cloc Handle to C locale data. + * @param __table If non-zero, table is used as the per-char mask. + * @param __del If true, passes ownership of table to this facet. + * @param __refs Passed to the base facet class. + */ + explicit + ctype(__c_locale __cloc, const mask* __table = 0, bool __del = false, + size_t __refs = 0); + + /** + * @brief Test char classification. + * + * This function compares the mask table[c] to @a __m. + * + * @param __c The char to compare the mask of. + * @param __m The mask to compare against. + * @return True if __m & table[__c] is true, false otherwise. + */ + inline bool + is(mask __m, char __c) const; + + /** + * @brief Return a mask array. + * + * This function finds the mask for each char in the range [lo, hi) and + * successively writes it to vec. vec must have as many elements as + * the char array. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @param __vec Pointer to an array of mask storage. + * @return @a __hi. + */ + inline const char* + is(const char* __lo, const char* __hi, mask* __vec) const; + + /** + * @brief Find char matching a mask + * + * This function searches for and returns the first char in [lo,hi) for + * which is(m,char) is true. + * + * @param __m The mask to compare against. + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return Pointer to a matching char if found, else @a __hi. + */ + inline const char* + scan_is(mask __m, const char* __lo, const char* __hi) const; + + /** + * @brief Find char not matching a mask + * + * This function searches for and returns a pointer to the first char + * in [__lo,__hi) for which is(m,char) is false. + * + * @param __m The mask to compare against. + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return Pointer to a non-matching char if found, else @a __hi. + */ + inline const char* + scan_not(mask __m, const char* __lo, const char* __hi) const; + + /** + * @brief Convert to uppercase. + * + * This function converts the char argument to uppercase if possible. + * If not possible (for example, '2'), returns the argument. + * + * toupper() acts as if it returns ctype::do_toupper(c). + * do_toupper() must always return the same result for the same input. + * + * @param __c The char to convert. + * @return The uppercase char if convertible, else @a __c. + */ + char_type + toupper(char_type __c) const + { return this->do_toupper(__c); } + + /** + * @brief Convert array to uppercase. + * + * This function converts each char in the range [__lo,__hi) to uppercase + * if possible. Other chars remain untouched. + * + * toupper() acts as if it returns ctype:: do_toupper(__lo, __hi). + * do_toupper() must always return the same result for the same input. + * + * @param __lo Pointer to first char in range. + * @param __hi Pointer to end of range. + * @return @a __hi. + */ + const char_type* + toupper(char_type *__lo, const char_type* __hi) const + { return this->do_toupper(__lo, __hi); } + + /** + * @brief Convert to lowercase. + * + * This function converts the char argument to lowercase if possible. + * If not possible (for example, '2'), returns the argument. + * + * tolower() acts as if it returns ctype::do_tolower(__c). + * do_tolower() must always return the same result for the same input. + * + * @param __c The char to convert. + * @return The lowercase char if convertible, else @a __c. + */ + char_type + tolower(char_type __c) const + { return this->do_tolower(__c); } + + /** + * @brief Convert array to lowercase. + * + * This function converts each char in the range [lo,hi) to lowercase + * if possible. Other chars remain untouched. + * + * tolower() acts as if it returns ctype:: do_tolower(__lo, __hi). + * do_tolower() must always return the same result for the same input. + * + * @param __lo Pointer to first char in range. + * @param __hi Pointer to end of range. + * @return @a __hi. + */ + const char_type* + tolower(char_type* __lo, const char_type* __hi) const + { return this->do_tolower(__lo, __hi); } + + /** + * @brief Widen char + * + * This function converts the char to char_type using the simplest + * reasonable transformation. For an underived ctype facet, the + * argument will be returned unchanged. + * + * This function works as if it returns ctype::do_widen(c). + * do_widen() must always return the same result for the same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __c The char to convert. + * @return The converted character. + */ + char_type + widen(char __c) const + { + if (_M_widen_ok) + return _M_widen[static_cast(__c)]; + this->_M_widen_init(); + return this->do_widen(__c); + } + + /** + * @brief Widen char array + * + * This function converts each char in the input to char using the + * simplest reasonable transformation. For an underived ctype + * facet, the argument will be copied unchanged. + * + * This function works as if it returns ctype::do_widen(c). + * do_widen() must always return the same result for the same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __lo Pointer to first char in range. + * @param __hi Pointer to end of range. + * @param __to Pointer to the destination array. + * @return @a __hi. + */ + const char* + widen(const char* __lo, const char* __hi, char_type* __to) const + { + if (_M_widen_ok == 1) + { + __builtin_memcpy(__to, __lo, __hi - __lo); + return __hi; + } + if (!_M_widen_ok) + _M_widen_init(); + return this->do_widen(__lo, __hi, __to); + } + + /** + * @brief Narrow char + * + * This function converts the char to char using the simplest + * reasonable transformation. If the conversion fails, dfault is + * returned instead. For an underived ctype facet, @a c + * will be returned unchanged. + * + * This function works as if it returns ctype::do_narrow(c). + * do_narrow() must always return the same result for the same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __c The char to convert. + * @param __dfault Char to return if conversion fails. + * @return The converted character. + */ + char + narrow(char_type __c, char __dfault) const + { + if (_M_narrow[static_cast(__c)]) + return _M_narrow[static_cast(__c)]; + const char __t = do_narrow(__c, __dfault); + if (__t != __dfault) + _M_narrow[static_cast(__c)] = __t; + return __t; + } + + /** + * @brief Narrow char array + * + * This function converts each char in the input to char using the + * simplest reasonable transformation and writes the results to the + * destination array. For any char in the input that cannot be + * converted, @a dfault is used instead. For an underived ctype + * facet, the argument will be copied unchanged. + * + * This function works as if it returns ctype::do_narrow(lo, hi, + * dfault, to). do_narrow() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @param __dfault Char to use if conversion fails. + * @param __to Pointer to the destination array. + * @return @a __hi. + */ + const char_type* + narrow(const char_type* __lo, const char_type* __hi, + char __dfault, char* __to) const + { + if (__builtin_expect(_M_narrow_ok == 1, true)) + { + __builtin_memcpy(__to, __lo, __hi - __lo); + return __hi; + } + if (!_M_narrow_ok) + _M_narrow_init(); + return this->do_narrow(__lo, __hi, __dfault, __to); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 695. ctype::classic_table() not accessible. + /// Returns a pointer to the mask table provided to the constructor, or + /// the default from classic_table() if none was provided. + const mask* + table() const throw() + { return _M_table; } + + /// Returns a pointer to the C locale mask table. + static const mask* + classic_table() throw(); + protected: + + /** + * @brief Destructor. + * + * This function deletes table() if @a del was true in the + * constructor. + */ + virtual + ~ctype(); + + /** + * @brief Convert to uppercase. + * + * This virtual function converts the char argument to uppercase if + * possible. If not possible (for example, '2'), returns the argument. + * + * do_toupper() is a hook for a derived facet to change the behavior of + * uppercasing. do_toupper() must always return the same result for + * the same input. + * + * @param __c The char to convert. + * @return The uppercase char if convertible, else @a __c. + */ + virtual char_type + do_toupper(char_type __c) const; + + /** + * @brief Convert array to uppercase. + * + * This virtual function converts each char in the range [lo,hi) to + * uppercase if possible. Other chars remain untouched. + * + * do_toupper() is a hook for a derived facet to change the behavior of + * uppercasing. do_toupper() must always return the same result for + * the same input. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return @a __hi. + */ + virtual const char_type* + do_toupper(char_type* __lo, const char_type* __hi) const; + + /** + * @brief Convert to lowercase. + * + * This virtual function converts the char argument to lowercase if + * possible. If not possible (for example, '2'), returns the argument. + * + * do_tolower() is a hook for a derived facet to change the behavior of + * lowercasing. do_tolower() must always return the same result for + * the same input. + * + * @param __c The char to convert. + * @return The lowercase char if convertible, else @a __c. + */ + virtual char_type + do_tolower(char_type __c) const; + + /** + * @brief Convert array to lowercase. + * + * This virtual function converts each char in the range [lo,hi) to + * lowercase if possible. Other chars remain untouched. + * + * do_tolower() is a hook for a derived facet to change the behavior of + * lowercasing. do_tolower() must always return the same result for + * the same input. + * + * @param __lo Pointer to first char in range. + * @param __hi Pointer to end of range. + * @return @a __hi. + */ + virtual const char_type* + do_tolower(char_type* __lo, const char_type* __hi) const; + + /** + * @brief Widen char + * + * This virtual function converts the char to char using the simplest + * reasonable transformation. For an underived ctype facet, the + * argument will be returned unchanged. + * + * do_widen() is a hook for a derived facet to change the behavior of + * widening. do_widen() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __c The char to convert. + * @return The converted character. + */ + virtual char_type + do_widen(char __c) const + { return __c; } + + /** + * @brief Widen char array + * + * This function converts each char in the range [lo,hi) to char using + * the simplest reasonable transformation. For an underived + * ctype facet, the argument will be copied unchanged. + * + * do_widen() is a hook for a derived facet to change the behavior of + * widening. do_widen() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @param __to Pointer to the destination array. + * @return @a __hi. + */ + virtual const char* + do_widen(const char* __lo, const char* __hi, char_type* __to) const + { + __builtin_memcpy(__to, __lo, __hi - __lo); + return __hi; + } + + /** + * @brief Narrow char + * + * This virtual function converts the char to char using the simplest + * reasonable transformation. If the conversion fails, dfault is + * returned instead. For an underived ctype facet, @a c will be + * returned unchanged. + * + * do_narrow() is a hook for a derived facet to change the behavior of + * narrowing. do_narrow() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __c The char to convert. + * @param __dfault Char to return if conversion fails. + * @return The converted char. + */ + virtual char + do_narrow(char_type __c, char __dfault __attribute__((__unused__))) const + { return __c; } + + /** + * @brief Narrow char array to char array + * + * This virtual function converts each char in the range [lo,hi) to + * char using the simplest reasonable transformation and writes the + * results to the destination array. For any char in the input that + * cannot be converted, @a dfault is used instead. For an underived + * ctype facet, the argument will be copied unchanged. + * + * do_narrow() is a hook for a derived facet to change the behavior of + * narrowing. do_narrow() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @param __dfault Char to use if conversion fails. + * @param __to Pointer to the destination array. + * @return @a __hi. + */ + virtual const char_type* + do_narrow(const char_type* __lo, const char_type* __hi, + char __dfault __attribute__((__unused__)), char* __to) const + { + __builtin_memcpy(__to, __lo, __hi - __lo); + return __hi; + } + + private: + void _M_narrow_init() const; + void _M_widen_init() const; + }; + +#ifdef _GLIBCXX_USE_WCHAR_T + /** + * @brief The ctype specialization. + * @ingroup locales + * + * This class defines classification and conversion functions for the + * wchar_t type. It gets used by wchar_t streams for many I/O operations. + * The wchar_t specialization provides a number of optimizations as well. + * + * ctype inherits its public methods from + * __ctype_abstract_base. + */ + template<> + class ctype : public __ctype_abstract_base + { + public: + // Types: + /// Typedef for the template parameter wchar_t. + typedef wchar_t char_type; + typedef wctype_t __wmask_type; + + protected: + __c_locale _M_c_locale_ctype; + + // Pre-computed narrowed and widened chars. + bool _M_narrow_ok; + char _M_narrow[128]; + wint_t _M_widen[1 + static_cast(-1)]; + + // Pre-computed elements for do_is. + mask _M_bit[16]; + __wmask_type _M_wmask[16]; + + public: + // Data Members: + /// The facet id for ctype + static locale::id id; + + /** + * @brief Constructor performs initialization. + * + * This is the constructor provided by the standard. + * + * @param __refs Passed to the base facet class. + */ + explicit + ctype(size_t __refs = 0); + + /** + * @brief Constructor performs static initialization. + * + * This constructor is used to construct the initial C locale facet. + * + * @param __cloc Handle to C locale data. + * @param __refs Passed to the base facet class. + */ + explicit + ctype(__c_locale __cloc, size_t __refs = 0); + + protected: + __wmask_type + _M_convert_to_wmask(const mask __m) const throw(); + + /// Destructor + virtual + ~ctype(); + + /** + * @brief Test wchar_t classification. + * + * This function finds a mask M for @a c and compares it to mask @a m. + * + * do_is() is a hook for a derived facet to change the behavior of + * classifying. do_is() must always return the same result for the + * same input. + * + * @param __c The wchar_t to find the mask of. + * @param __m The mask to compare against. + * @return (M & __m) != 0. + */ + virtual bool + do_is(mask __m, char_type __c) const; + + /** + * @brief Return a mask array. + * + * This function finds the mask for each wchar_t in the range [lo,hi) + * and successively writes it to vec. vec must have as many elements + * as the input. + * + * do_is() is a hook for a derived facet to change the behavior of + * classifying. do_is() must always return the same result for the + * same input. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @param __vec Pointer to an array of mask storage. + * @return @a __hi. + */ + virtual const char_type* + do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const; + + /** + * @brief Find wchar_t matching mask + * + * This function searches for and returns the first wchar_t c in + * [__lo,__hi) for which is(__m,c) is true. + * + * do_scan_is() is a hook for a derived facet to change the behavior of + * match searching. do_is() must always return the same result for the + * same input. + * + * @param __m The mask to compare against. + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return Pointer to a matching wchar_t if found, else @a __hi. + */ + virtual const char_type* + do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const; + + /** + * @brief Find wchar_t not matching mask + * + * This function searches for and returns a pointer to the first + * wchar_t c of [__lo,__hi) for which is(__m,c) is false. + * + * do_scan_is() is a hook for a derived facet to change the behavior of + * match searching. do_is() must always return the same result for the + * same input. + * + * @param __m The mask to compare against. + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return Pointer to a non-matching wchar_t if found, else @a __hi. + */ + virtual const char_type* + do_scan_not(mask __m, const char_type* __lo, + const char_type* __hi) const; + + /** + * @brief Convert to uppercase. + * + * This virtual function converts the wchar_t argument to uppercase if + * possible. If not possible (for example, '2'), returns the argument. + * + * do_toupper() is a hook for a derived facet to change the behavior of + * uppercasing. do_toupper() must always return the same result for + * the same input. + * + * @param __c The wchar_t to convert. + * @return The uppercase wchar_t if convertible, else @a __c. + */ + virtual char_type + do_toupper(char_type __c) const; + + /** + * @brief Convert array to uppercase. + * + * This virtual function converts each wchar_t in the range [lo,hi) to + * uppercase if possible. Other elements remain untouched. + * + * do_toupper() is a hook for a derived facet to change the behavior of + * uppercasing. do_toupper() must always return the same result for + * the same input. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return @a __hi. + */ + virtual const char_type* + do_toupper(char_type* __lo, const char_type* __hi) const; + + /** + * @brief Convert to lowercase. + * + * This virtual function converts the argument to lowercase if + * possible. If not possible (for example, '2'), returns the argument. + * + * do_tolower() is a hook for a derived facet to change the behavior of + * lowercasing. do_tolower() must always return the same result for + * the same input. + * + * @param __c The wchar_t to convert. + * @return The lowercase wchar_t if convertible, else @a __c. + */ + virtual char_type + do_tolower(char_type __c) const; + + /** + * @brief Convert array to lowercase. + * + * This virtual function converts each wchar_t in the range [lo,hi) to + * lowercase if possible. Other elements remain untouched. + * + * do_tolower() is a hook for a derived facet to change the behavior of + * lowercasing. do_tolower() must always return the same result for + * the same input. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @return @a __hi. + */ + virtual const char_type* + do_tolower(char_type* __lo, const char_type* __hi) const; + + /** + * @brief Widen char to wchar_t + * + * This virtual function converts the char to wchar_t using the + * simplest reasonable transformation. For an underived ctype + * facet, the argument will be cast to wchar_t. + * + * do_widen() is a hook for a derived facet to change the behavior of + * widening. do_widen() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __c The char to convert. + * @return The converted wchar_t. + */ + virtual char_type + do_widen(char __c) const; + + /** + * @brief Widen char array to wchar_t array + * + * This function converts each char in the input to wchar_t using the + * simplest reasonable transformation. For an underived ctype + * facet, the argument will be copied, casting each element to wchar_t. + * + * do_widen() is a hook for a derived facet to change the behavior of + * widening. do_widen() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __lo Pointer to start range. + * @param __hi Pointer to end of range. + * @param __to Pointer to the destination array. + * @return @a __hi. + */ + virtual const char* + do_widen(const char* __lo, const char* __hi, char_type* __to) const; + + /** + * @brief Narrow wchar_t to char + * + * This virtual function converts the argument to char using + * the simplest reasonable transformation. If the conversion + * fails, dfault is returned instead. For an underived + * ctype facet, @a c will be cast to char and + * returned. + * + * do_narrow() is a hook for a derived facet to change the + * behavior of narrowing. do_narrow() must always return the + * same result for the same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __c The wchar_t to convert. + * @param __dfault Char to return if conversion fails. + * @return The converted char. + */ + virtual char + do_narrow(char_type __c, char __dfault) const; + + /** + * @brief Narrow wchar_t array to char array + * + * This virtual function converts each wchar_t in the range [lo,hi) to + * char using the simplest reasonable transformation and writes the + * results to the destination array. For any wchar_t in the input that + * cannot be converted, @a dfault is used instead. For an underived + * ctype facet, the argument will be copied, casting each + * element to char. + * + * do_narrow() is a hook for a derived facet to change the behavior of + * narrowing. do_narrow() must always return the same result for the + * same input. + * + * Note: this is not what you want for codepage conversions. See + * codecvt for that. + * + * @param __lo Pointer to start of range. + * @param __hi Pointer to end of range. + * @param __dfault Char to use if conversion fails. + * @param __to Pointer to the destination array. + * @return @a __hi. + */ + virtual const char_type* + do_narrow(const char_type* __lo, const char_type* __hi, + char __dfault, char* __to) const; + + // For use at construction time only. + void + _M_initialize_ctype() throw(); + }; +#endif //_GLIBCXX_USE_WCHAR_T + + /// class ctype_byname [22.2.1.2]. + template + class ctype_byname : public ctype<_CharT> + { + public: + typedef typename ctype<_CharT>::mask mask; + + explicit + ctype_byname(const char* __s, size_t __refs = 0); + +#if __cplusplus >= 201103L + explicit + ctype_byname(const string& __s, size_t __refs = 0) + : ctype_byname(__s.c_str(), __refs) { } +#endif + + protected: + virtual + ~ctype_byname() { }; + }; + + /// 22.2.1.4 Class ctype_byname specializations. + template<> + class ctype_byname : public ctype + { + public: + explicit + ctype_byname(const char* __s, size_t __refs = 0); + +#if __cplusplus >= 201103L + explicit + ctype_byname(const string& __s, size_t __refs = 0); +#endif + + protected: + virtual + ~ctype_byname(); + }; + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + class ctype_byname : public ctype + { + public: + explicit + ctype_byname(const char* __s, size_t __refs = 0); + +#if __cplusplus >= 201103L + explicit + ctype_byname(const string& __s, size_t __refs = 0); +#endif + + protected: + virtual + ~ctype_byname(); + }; +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +// Include host and configuration specific ctype inlines. +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // 22.2.2 The numeric category. + class __num_base + { + public: + // NB: Code depends on the order of _S_atoms_out elements. + // Below are the indices into _S_atoms_out. + enum + { + _S_ominus, + _S_oplus, + _S_ox, + _S_oX, + _S_odigits, + _S_odigits_end = _S_odigits + 16, + _S_oudigits = _S_odigits_end, + _S_oudigits_end = _S_oudigits + 16, + _S_oe = _S_odigits + 14, // For scientific notation, 'e' + _S_oE = _S_oudigits + 14, // For scientific notation, 'E' + _S_oend = _S_oudigits_end + }; + + // A list of valid numeric literals for output. This array + // contains chars that will be passed through the current locale's + // ctype<_CharT>.widen() and then used to render numbers. + // For the standard "C" locale, this is + // "-+xX0123456789abcdef0123456789ABCDEF". + static const char* _S_atoms_out; + + // String literal of acceptable (narrow) input, for num_get. + // "-+xX0123456789abcdefABCDEF" + static const char* _S_atoms_in; + + enum + { + _S_iminus, + _S_iplus, + _S_ix, + _S_iX, + _S_izero, + _S_ie = _S_izero + 14, + _S_iE = _S_izero + 20, + _S_iend = 26 + }; + + // num_put + // Construct and return valid scanf format for floating point types. + static void + _S_format_float(const ios_base& __io, char* __fptr, char __mod) throw(); + }; + + template + struct __numpunct_cache : public locale::facet + { + const char* _M_grouping; + size_t _M_grouping_size; + bool _M_use_grouping; + const _CharT* _M_truename; + size_t _M_truename_size; + const _CharT* _M_falsename; + size_t _M_falsename_size; + _CharT _M_decimal_point; + _CharT _M_thousands_sep; + + // A list of valid numeric literals for output: in the standard + // "C" locale, this is "-+xX0123456789abcdef0123456789ABCDEF". + // This array contains the chars after having been passed + // through the current locale's ctype<_CharT>.widen(). + _CharT _M_atoms_out[__num_base::_S_oend]; + + // A list of valid numeric literals for input: in the standard + // "C" locale, this is "-+xX0123456789abcdefABCDEF" + // This array contains the chars after having been passed + // through the current locale's ctype<_CharT>.widen(). + _CharT _M_atoms_in[__num_base::_S_iend]; + + bool _M_allocated; + + __numpunct_cache(size_t __refs = 0) + : facet(__refs), _M_grouping(0), _M_grouping_size(0), + _M_use_grouping(false), + _M_truename(0), _M_truename_size(0), _M_falsename(0), + _M_falsename_size(0), _M_decimal_point(_CharT()), + _M_thousands_sep(_CharT()), _M_allocated(false) + { } + + ~__numpunct_cache(); + + void + _M_cache(const locale& __loc); + + private: + __numpunct_cache& + operator=(const __numpunct_cache&); + + explicit + __numpunct_cache(const __numpunct_cache&); + }; + + template + __numpunct_cache<_CharT>::~__numpunct_cache() + { + if (_M_allocated) + { + delete [] _M_grouping; + delete [] _M_truename; + delete [] _M_falsename; + } + } + +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + /** + * @brief Primary class template numpunct. + * @ingroup locales + * + * This facet stores several pieces of information related to printing and + * scanning numbers, such as the decimal point character. It takes a + * template parameter specifying the char type. The numpunct facet is + * used by streams for many I/O operations involving numbers. + * + * The numpunct template uses protected virtual functions to provide the + * actual results. The public accessors forward the call to the virtual + * functions. These virtual functions are hooks for developers to + * implement the behavior they require from a numpunct facet. + */ + template + class numpunct : public locale::facet + { + public: + // Types: + //@{ + /// Public typedefs + typedef _CharT char_type; + typedef basic_string<_CharT> string_type; + //@} + typedef __numpunct_cache<_CharT> __cache_type; + + protected: + __cache_type* _M_data; + + public: + /// Numpunct facet id. + static locale::id id; + + /** + * @brief Numpunct constructor. + * + * @param __refs Refcount to pass to the base class. + */ + explicit + numpunct(size_t __refs = 0) + : facet(__refs), _M_data(0) + { _M_initialize_numpunct(); } + + /** + * @brief Internal constructor. Not for general use. + * + * This is a constructor for use by the library itself to set up the + * predefined locale facets. + * + * @param __cache __numpunct_cache object. + * @param __refs Refcount to pass to the base class. + */ + explicit + numpunct(__cache_type* __cache, size_t __refs = 0) + : facet(__refs), _M_data(__cache) + { _M_initialize_numpunct(); } + + /** + * @brief Internal constructor. Not for general use. + * + * This is a constructor for use by the library itself to set up new + * locales. + * + * @param __cloc The C locale. + * @param __refs Refcount to pass to the base class. + */ + explicit + numpunct(__c_locale __cloc, size_t __refs = 0) + : facet(__refs), _M_data(0) + { _M_initialize_numpunct(__cloc); } + + /** + * @brief Return decimal point character. + * + * This function returns a char_type to use as a decimal point. It + * does so by returning returning + * numpunct::do_decimal_point(). + * + * @return @a char_type representing a decimal point. + */ + char_type + decimal_point() const + { return this->do_decimal_point(); } + + /** + * @brief Return thousands separator character. + * + * This function returns a char_type to use as a thousands + * separator. It does so by returning returning + * numpunct::do_thousands_sep(). + * + * @return char_type representing a thousands separator. + */ + char_type + thousands_sep() const + { return this->do_thousands_sep(); } + + /** + * @brief Return grouping specification. + * + * This function returns a string representing groupings for the + * integer part of a number. Groupings indicate where thousands + * separators should be inserted in the integer part of a number. + * + * Each char in the return string is interpret as an integer + * rather than a character. These numbers represent the number + * of digits in a group. The first char in the string + * represents the number of digits in the least significant + * group. If a char is negative, it indicates an unlimited + * number of digits for the group. If more chars from the + * string are required to group a number, the last char is used + * repeatedly. + * + * For example, if the grouping() returns "\003\002" and is + * applied to the number 123456789, this corresponds to + * 12,34,56,789. Note that if the string was "32", this would + * put more than 50 digits into the least significant group if + * the character set is ASCII. + * + * The string is returned by calling + * numpunct::do_grouping(). + * + * @return string representing grouping specification. + */ + string + grouping() const + { return this->do_grouping(); } + + /** + * @brief Return string representation of bool true. + * + * This function returns a string_type containing the text + * representation for true bool variables. It does so by calling + * numpunct::do_truename(). + * + * @return string_type representing printed form of true. + */ + string_type + truename() const + { return this->do_truename(); } + + /** + * @brief Return string representation of bool false. + * + * This function returns a string_type containing the text + * representation for false bool variables. It does so by calling + * numpunct::do_falsename(). + * + * @return string_type representing printed form of false. + */ + string_type + falsename() const + { return this->do_falsename(); } + + protected: + /// Destructor. + virtual + ~numpunct(); + + /** + * @brief Return decimal point character. + * + * Returns a char_type to use as a decimal point. This function is a + * hook for derived classes to change the value returned. + * + * @return @a char_type representing a decimal point. + */ + virtual char_type + do_decimal_point() const + { return _M_data->_M_decimal_point; } + + /** + * @brief Return thousands separator character. + * + * Returns a char_type to use as a thousands separator. This function + * is a hook for derived classes to change the value returned. + * + * @return @a char_type representing a thousands separator. + */ + virtual char_type + do_thousands_sep() const + { return _M_data->_M_thousands_sep; } + + /** + * @brief Return grouping specification. + * + * Returns a string representing groupings for the integer part of a + * number. This function is a hook for derived classes to change the + * value returned. @see grouping() for details. + * + * @return String representing grouping specification. + */ + virtual string + do_grouping() const + { return _M_data->_M_grouping; } + + /** + * @brief Return string representation of bool true. + * + * Returns a string_type containing the text representation for true + * bool variables. This function is a hook for derived classes to + * change the value returned. + * + * @return string_type representing printed form of true. + */ + virtual string_type + do_truename() const + { return _M_data->_M_truename; } + + /** + * @brief Return string representation of bool false. + * + * Returns a string_type containing the text representation for false + * bool variables. This function is a hook for derived classes to + * change the value returned. + * + * @return string_type representing printed form of false. + */ + virtual string_type + do_falsename() const + { return _M_data->_M_falsename; } + + // For use at construction time only. + void + _M_initialize_numpunct(__c_locale __cloc = 0); + }; + + template + locale::id numpunct<_CharT>::id; + + template<> + numpunct::~numpunct(); + + template<> + void + numpunct::_M_initialize_numpunct(__c_locale __cloc); + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + numpunct::~numpunct(); + + template<> + void + numpunct::_M_initialize_numpunct(__c_locale __cloc); +#endif + + /// class numpunct_byname [22.2.3.2]. + template + class numpunct_byname : public numpunct<_CharT> + { + public: + typedef _CharT char_type; + typedef basic_string<_CharT> string_type; + + explicit + numpunct_byname(const char* __s, size_t __refs = 0) + : numpunct<_CharT>(__refs) + { + if (__builtin_strcmp(__s, "C") != 0 + && __builtin_strcmp(__s, "POSIX") != 0) + { + __c_locale __tmp; + this->_S_create_c_locale(__tmp, __s); + this->_M_initialize_numpunct(__tmp); + this->_S_destroy_c_locale(__tmp); + } + } + +#if __cplusplus >= 201103L + explicit + numpunct_byname(const string& __s, size_t __refs = 0) + : numpunct_byname(__s.c_str(), __refs) { } +#endif + + protected: + virtual + ~numpunct_byname() { } + }; + +_GLIBCXX_END_NAMESPACE_CXX11 + +_GLIBCXX_BEGIN_NAMESPACE_LDBL + + /** + * @brief Primary class template num_get. + * @ingroup locales + * + * This facet encapsulates the code to parse and return a number + * from a string. It is used by the istream numeric extraction + * operators. + * + * The num_get template uses protected virtual functions to provide the + * actual results. The public accessors forward the call to the virtual + * functions. These virtual functions are hooks for developers to + * implement the behavior they require from the num_get facet. + */ + template + class num_get : public locale::facet + { + public: + // Types: + //@{ + /// Public typedefs + typedef _CharT char_type; + typedef _InIter iter_type; + //@} + + /// Numpunct facet id. + static locale::id id; + + /** + * @brief Constructor performs initialization. + * + * This is the constructor provided by the standard. + * + * @param __refs Passed to the base facet class. + */ + explicit + num_get(size_t __refs = 0) : facet(__refs) { } + + /** + * @brief Numeric parsing. + * + * Parses the input stream into the bool @a v. It does so by calling + * num_get::do_get(). + * + * If ios_base::boolalpha is set, attempts to read + * ctype::truename() or ctype::falsename(). Sets + * @a v to true or false if successful. Sets err to + * ios_base::failbit if reading the string fails. Sets err to + * ios_base::eofbit if the stream is emptied. + * + * If ios_base::boolalpha is not set, proceeds as with reading a long, + * except if the value is 1, sets @a v to true, if the value is 0, sets + * @a v to false, and otherwise set err to ios_base::failbit. + * + * @param __in Start of input stream. + * @param __end End of input stream. + * @param __io Source of locale and flags. + * @param __err Error flags to set. + * @param __v Value to format and insert. + * @return Iterator after reading. + */ + iter_type + get(iter_type __in, iter_type __end, ios_base& __io, + ios_base::iostate& __err, bool& __v) const + { return this->do_get(__in, __end, __io, __err, __v); } + + //@{ + /** + * @brief Numeric parsing. + * + * Parses the input stream into the integral variable @a v. It does so + * by calling num_get::do_get(). + * + * Parsing is affected by the flag settings in @a io. + * + * The basic parse is affected by the value of io.flags() & + * ios_base::basefield. If equal to ios_base::oct, parses like the + * scanf %o specifier. Else if equal to ios_base::hex, parses like %X + * specifier. Else if basefield equal to 0, parses like the %i + * specifier. Otherwise, parses like %d for signed and %u for unsigned + * types. The matching type length modifier is also used. + * + * Digit grouping is interpreted according to + * numpunct::grouping() and numpunct::thousands_sep(). If the + * pattern of digit groups isn't consistent, sets err to + * ios_base::failbit. + * + * If parsing the string yields a valid value for @a v, @a v is set. + * Otherwise, sets err to ios_base::failbit and leaves @a v unaltered. + * Sets err to ios_base::eofbit if the stream is emptied. + * + * @param __in Start of input stream. + * @param __end End of input stream. + * @param __io Source of locale and flags. + * @param __err Error flags to set. + * @param __v Value to format and insert. + * @return Iterator after reading. + */ + iter_type + get(iter_type __in, iter_type __end, ios_base& __io, + ios_base::iostate& __err, long& __v) const + { return this->do_get(__in, __end, __io, __err, __v); } + + iter_type + get(iter_type __in, iter_type __end, ios_base& __io, + ios_base::iostate& __err, unsigned short& __v) const + { return this->do_get(__in, __end, __io, __err, __v); } + + iter_type + get(iter_type __in, iter_type __end, ios_base& __io, + ios_base::iostate& __err, unsigned int& __v) const + { return this->do_get(__in, __end, __io, __err, __v); } + + iter_type + get(iter_type __in, iter_type __end, ios_base& __io, + ios_base::iostate& __err, unsigned long& __v) const + { return this->do_get(__in, __end, __io, __err, __v); } + +#ifdef _GLIBCXX_USE_LONG_LONG + iter_type + get(iter_type __in, iter_type __end, ios_base& __io, + ios_base::iostate& __err, long long& __v) const + { return this->do_get(__in, __end, __io, __err, __v); } + + iter_type + get(iter_type __in, iter_type __end, ios_base& __io, + ios_base::iostate& __err, unsigned long long& __v) const + { return this->do_get(__in, __end, __io, __err, __v); } +#endif + //@} + + //@{ + /** + * @brief Numeric parsing. + * + * Parses the input stream into the integral variable @a v. It does so + * by calling num_get::do_get(). + * + * The input characters are parsed like the scanf %g specifier. The + * matching type length modifier is also used. + * + * The decimal point character used is numpunct::decimal_point(). + * Digit grouping is interpreted according to + * numpunct::grouping() and numpunct::thousands_sep(). If the + * pattern of digit groups isn't consistent, sets err to + * ios_base::failbit. + * + * If parsing the string yields a valid value for @a v, @a v is set. + * Otherwise, sets err to ios_base::failbit and leaves @a v unaltered. + * Sets err to ios_base::eofbit if the stream is emptied. + * + * @param __in Start of input stream. + * @param __end End of input stream. + * @param __io Source of locale and flags. + * @param __err Error flags to set. + * @param __v Value to format and insert. + * @return Iterator after reading. + */ + iter_type + get(iter_type __in, iter_type __end, ios_base& __io, + ios_base::iostate& __err, float& __v) const + { return this->do_get(__in, __end, __io, __err, __v); } + + iter_type + get(iter_type __in, iter_type __end, ios_base& __io, + ios_base::iostate& __err, double& __v) const + { return this->do_get(__in, __end, __io, __err, __v); } + + iter_type + get(iter_type __in, iter_type __end, ios_base& __io, + ios_base::iostate& __err, long double& __v) const + { return this->do_get(__in, __end, __io, __err, __v); } + //@} + + /** + * @brief Numeric parsing. + * + * Parses the input stream into the pointer variable @a v. It does so + * by calling num_get::do_get(). + * + * The input characters are parsed like the scanf %p specifier. + * + * Digit grouping is interpreted according to + * numpunct::grouping() and numpunct::thousands_sep(). If the + * pattern of digit groups isn't consistent, sets err to + * ios_base::failbit. + * + * Note that the digit grouping effect for pointers is a bit ambiguous + * in the standard and shouldn't be relied on. See DR 344. + * + * If parsing the string yields a valid value for @a v, @a v is set. + * Otherwise, sets err to ios_base::failbit and leaves @a v unaltered. + * Sets err to ios_base::eofbit if the stream is emptied. + * + * @param __in Start of input stream. + * @param __end End of input stream. + * @param __io Source of locale and flags. + * @param __err Error flags to set. + * @param __v Value to format and insert. + * @return Iterator after reading. + */ + iter_type + get(iter_type __in, iter_type __end, ios_base& __io, + ios_base::iostate& __err, void*& __v) const + { return this->do_get(__in, __end, __io, __err, __v); } + + protected: + /// Destructor. + virtual ~num_get() { } + + _GLIBCXX_DEFAULT_ABI_TAG + iter_type + _M_extract_float(iter_type, iter_type, ios_base&, ios_base::iostate&, + string&) const; + + template + _GLIBCXX_DEFAULT_ABI_TAG + iter_type + _M_extract_int(iter_type, iter_type, ios_base&, ios_base::iostate&, + _ValueT&) const; + + template + typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, int>::__type + _M_find(const _CharT2*, size_t __len, _CharT2 __c) const + { + int __ret = -1; + if (__len <= 10) + { + if (__c >= _CharT2('0') && __c < _CharT2(_CharT2('0') + __len)) + __ret = __c - _CharT2('0'); + } + else + { + if (__c >= _CharT2('0') && __c <= _CharT2('9')) + __ret = __c - _CharT2('0'); + else if (__c >= _CharT2('a') && __c <= _CharT2('f')) + __ret = 10 + (__c - _CharT2('a')); + else if (__c >= _CharT2('A') && __c <= _CharT2('F')) + __ret = 10 + (__c - _CharT2('A')); + } + return __ret; + } + + template + typename __gnu_cxx::__enable_if::__value, + int>::__type + _M_find(const _CharT2* __zero, size_t __len, _CharT2 __c) const + { + int __ret = -1; + const char_type* __q = char_traits<_CharT2>::find(__zero, __len, __c); + if (__q) + { + __ret = __q - __zero; + if (__ret > 15) + __ret -= 6; + } + return __ret; + } + + //@{ + /** + * @brief Numeric parsing. + * + * Parses the input stream into the variable @a v. This function is a + * hook for derived classes to change the value returned. @see get() + * for more details. + * + * @param __beg Start of input stream. + * @param __end End of input stream. + * @param __io Source of locale and flags. + * @param __err Error flags to set. + * @param __v Value to format and insert. + * @return Iterator after reading. + */ + virtual iter_type + do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const; + + virtual iter_type + do_get(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, long& __v) const + { return _M_extract_int(__beg, __end, __io, __err, __v); } + + virtual iter_type + do_get(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, unsigned short& __v) const + { return _M_extract_int(__beg, __end, __io, __err, __v); } + + virtual iter_type + do_get(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, unsigned int& __v) const + { return _M_extract_int(__beg, __end, __io, __err, __v); } + + virtual iter_type + do_get(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, unsigned long& __v) const + { return _M_extract_int(__beg, __end, __io, __err, __v); } + +#ifdef _GLIBCXX_USE_LONG_LONG + virtual iter_type + do_get(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, long long& __v) const + { return _M_extract_int(__beg, __end, __io, __err, __v); } + + virtual iter_type + do_get(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, unsigned long long& __v) const + { return _M_extract_int(__beg, __end, __io, __err, __v); } +#endif + + virtual iter_type + do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, float&) const; + + virtual iter_type + do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, + double&) const; + + // XXX GLIBCXX_ABI Deprecated +#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ + virtual iter_type + __do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, + double&) const; +#else + virtual iter_type + do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, + long double&) const; +#endif + + virtual iter_type + do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, void*&) const; + + // XXX GLIBCXX_ABI Deprecated +#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ + virtual iter_type + do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, + long double&) const; +#endif + //@} + }; + + template + locale::id num_get<_CharT, _InIter>::id; + + + /** + * @brief Primary class template num_put. + * @ingroup locales + * + * This facet encapsulates the code to convert a number to a string. It is + * used by the ostream numeric insertion operators. + * + * The num_put template uses protected virtual functions to provide the + * actual results. The public accessors forward the call to the virtual + * functions. These virtual functions are hooks for developers to + * implement the behavior they require from the num_put facet. + */ + template + class num_put : public locale::facet + { + public: + // Types: + //@{ + /// Public typedefs + typedef _CharT char_type; + typedef _OutIter iter_type; + //@} + + /// Numpunct facet id. + static locale::id id; + + /** + * @brief Constructor performs initialization. + * + * This is the constructor provided by the standard. + * + * @param __refs Passed to the base facet class. + */ + explicit + num_put(size_t __refs = 0) : facet(__refs) { } + + /** + * @brief Numeric formatting. + * + * Formats the boolean @a v and inserts it into a stream. It does so + * by calling num_put::do_put(). + * + * If ios_base::boolalpha is set, writes ctype::truename() or + * ctype::falsename(). Otherwise formats @a v as an int. + * + * @param __s Stream to write to. + * @param __io Source of locale and flags. + * @param __fill Char_type to use for filling. + * @param __v Value to format and insert. + * @return Iterator after writing. + */ + iter_type + put(iter_type __s, ios_base& __io, char_type __fill, bool __v) const + { return this->do_put(__s, __io, __fill, __v); } + + //@{ + /** + * @brief Numeric formatting. + * + * Formats the integral value @a v and inserts it into a + * stream. It does so by calling num_put::do_put(). + * + * Formatting is affected by the flag settings in @a io. + * + * The basic format is affected by the value of io.flags() & + * ios_base::basefield. If equal to ios_base::oct, formats like the + * printf %o specifier. Else if equal to ios_base::hex, formats like + * %x or %X with ios_base::uppercase unset or set respectively. + * Otherwise, formats like %d, %ld, %lld for signed and %u, %lu, %llu + * for unsigned values. Note that if both oct and hex are set, neither + * will take effect. + * + * If ios_base::showpos is set, '+' is output before positive values. + * If ios_base::showbase is set, '0' precedes octal values (except 0) + * and '0[xX]' precedes hex values. + * + * The decimal point character used is numpunct::decimal_point(). + * Thousands separators are inserted according to + * numpunct::grouping() and numpunct::thousands_sep(). + * + * If io.width() is non-zero, enough @a fill characters are inserted to + * make the result at least that wide. If + * (io.flags() & ios_base::adjustfield) == ios_base::left, result is + * padded at the end. If ios_base::internal, then padding occurs + * immediately after either a '+' or '-' or after '0x' or '0X'. + * Otherwise, padding occurs at the beginning. + * + * @param __s Stream to write to. + * @param __io Source of locale and flags. + * @param __fill Char_type to use for filling. + * @param __v Value to format and insert. + * @return Iterator after writing. + */ + iter_type + put(iter_type __s, ios_base& __io, char_type __fill, long __v) const + { return this->do_put(__s, __io, __fill, __v); } + + iter_type + put(iter_type __s, ios_base& __io, char_type __fill, + unsigned long __v) const + { return this->do_put(__s, __io, __fill, __v); } + +#ifdef _GLIBCXX_USE_LONG_LONG + iter_type + put(iter_type __s, ios_base& __io, char_type __fill, long long __v) const + { return this->do_put(__s, __io, __fill, __v); } + + iter_type + put(iter_type __s, ios_base& __io, char_type __fill, + unsigned long long __v) const + { return this->do_put(__s, __io, __fill, __v); } +#endif + //@} + + //@{ + /** + * @brief Numeric formatting. + * + * Formats the floating point value @a v and inserts it into a stream. + * It does so by calling num_put::do_put(). + * + * Formatting is affected by the flag settings in @a io. + * + * The basic format is affected by the value of io.flags() & + * ios_base::floatfield. If equal to ios_base::fixed, formats like the + * printf %f specifier. Else if equal to ios_base::scientific, formats + * like %e or %E with ios_base::uppercase unset or set respectively. + * Otherwise, formats like %g or %G depending on uppercase. Note that + * if both fixed and scientific are set, the effect will also be like + * %g or %G. + * + * The output precision is given by io.precision(). This precision is + * capped at numeric_limits::digits10 + 2 (different for double and + * long double). The default precision is 6. + * + * If ios_base::showpos is set, '+' is output before positive values. + * If ios_base::showpoint is set, a decimal point will always be + * output. + * + * The decimal point character used is numpunct::decimal_point(). + * Thousands separators are inserted according to + * numpunct::grouping() and numpunct::thousands_sep(). + * + * If io.width() is non-zero, enough @a fill characters are inserted to + * make the result at least that wide. If + * (io.flags() & ios_base::adjustfield) == ios_base::left, result is + * padded at the end. If ios_base::internal, then padding occurs + * immediately after either a '+' or '-' or after '0x' or '0X'. + * Otherwise, padding occurs at the beginning. + * + * @param __s Stream to write to. + * @param __io Source of locale and flags. + * @param __fill Char_type to use for filling. + * @param __v Value to format and insert. + * @return Iterator after writing. + */ + iter_type + put(iter_type __s, ios_base& __io, char_type __fill, double __v) const + { return this->do_put(__s, __io, __fill, __v); } + + iter_type + put(iter_type __s, ios_base& __io, char_type __fill, + long double __v) const + { return this->do_put(__s, __io, __fill, __v); } + //@} + + /** + * @brief Numeric formatting. + * + * Formats the pointer value @a v and inserts it into a stream. It + * does so by calling num_put::do_put(). + * + * This function formats @a v as an unsigned long with ios_base::hex + * and ios_base::showbase set. + * + * @param __s Stream to write to. + * @param __io Source of locale and flags. + * @param __fill Char_type to use for filling. + * @param __v Value to format and insert. + * @return Iterator after writing. + */ + iter_type + put(iter_type __s, ios_base& __io, char_type __fill, + const void* __v) const + { return this->do_put(__s, __io, __fill, __v); } + + protected: + template + iter_type + _M_insert_float(iter_type, ios_base& __io, char_type __fill, + char __mod, _ValueT __v) const; + + void + _M_group_float(const char* __grouping, size_t __grouping_size, + char_type __sep, const char_type* __p, char_type* __new, + char_type* __cs, int& __len) const; + + template + iter_type + _M_insert_int(iter_type, ios_base& __io, char_type __fill, + _ValueT __v) const; + + void + _M_group_int(const char* __grouping, size_t __grouping_size, + char_type __sep, ios_base& __io, char_type* __new, + char_type* __cs, int& __len) const; + + void + _M_pad(char_type __fill, streamsize __w, ios_base& __io, + char_type* __new, const char_type* __cs, int& __len) const; + + /// Destructor. + virtual + ~num_put() { }; + + //@{ + /** + * @brief Numeric formatting. + * + * These functions do the work of formatting numeric values and + * inserting them into a stream. This function is a hook for derived + * classes to change the value returned. + * + * @param __s Stream to write to. + * @param __io Source of locale and flags. + * @param __fill Char_type to use for filling. + * @param __v Value to format and insert. + * @return Iterator after writing. + */ + virtual iter_type + do_put(iter_type __s, ios_base& __io, char_type __fill, bool __v) const; + + virtual iter_type + do_put(iter_type __s, ios_base& __io, char_type __fill, long __v) const + { return _M_insert_int(__s, __io, __fill, __v); } + + virtual iter_type + do_put(iter_type __s, ios_base& __io, char_type __fill, + unsigned long __v) const + { return _M_insert_int(__s, __io, __fill, __v); } + +#ifdef _GLIBCXX_USE_LONG_LONG + virtual iter_type + do_put(iter_type __s, ios_base& __io, char_type __fill, + long long __v) const + { return _M_insert_int(__s, __io, __fill, __v); } + + virtual iter_type + do_put(iter_type __s, ios_base& __io, char_type __fill, + unsigned long long __v) const + { return _M_insert_int(__s, __io, __fill, __v); } +#endif + + virtual iter_type + do_put(iter_type, ios_base&, char_type, double) const; + + // XXX GLIBCXX_ABI Deprecated +#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ + virtual iter_type + __do_put(iter_type, ios_base&, char_type, double) const; +#else + virtual iter_type + do_put(iter_type, ios_base&, char_type, long double) const; +#endif + + virtual iter_type + do_put(iter_type, ios_base&, char_type, const void*) const; + + // XXX GLIBCXX_ABI Deprecated +#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ + virtual iter_type + do_put(iter_type, ios_base&, char_type, long double) const; +#endif + //@} + }; + + template + locale::id num_put<_CharT, _OutIter>::id; + +_GLIBCXX_END_NAMESPACE_LDBL + + // Subclause convenience interfaces, inlines. + // NB: These are inline because, when used in a loop, some compilers + // can hoist the body out of the loop; then it's just as fast as the + // C is*() function. + + /// Convenience interface to ctype.is(ctype_base::space, __c). + template + inline bool + isspace(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::space, __c); } + + /// Convenience interface to ctype.is(ctype_base::print, __c). + template + inline bool + isprint(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::print, __c); } + + /// Convenience interface to ctype.is(ctype_base::cntrl, __c). + template + inline bool + iscntrl(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::cntrl, __c); } + + /// Convenience interface to ctype.is(ctype_base::upper, __c). + template + inline bool + isupper(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::upper, __c); } + + /// Convenience interface to ctype.is(ctype_base::lower, __c). + template + inline bool + islower(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::lower, __c); } + + /// Convenience interface to ctype.is(ctype_base::alpha, __c). + template + inline bool + isalpha(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::alpha, __c); } + + /// Convenience interface to ctype.is(ctype_base::digit, __c). + template + inline bool + isdigit(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::digit, __c); } + + /// Convenience interface to ctype.is(ctype_base::punct, __c). + template + inline bool + ispunct(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::punct, __c); } + + /// Convenience interface to ctype.is(ctype_base::xdigit, __c). + template + inline bool + isxdigit(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::xdigit, __c); } + + /// Convenience interface to ctype.is(ctype_base::alnum, __c). + template + inline bool + isalnum(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::alnum, __c); } + + /// Convenience interface to ctype.is(ctype_base::graph, __c). + template + inline bool + isgraph(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::graph, __c); } + +#if __cplusplus >= 201103L + /// Convenience interface to ctype.is(ctype_base::blank, __c). + template + inline bool + isblank(_CharT __c, const locale& __loc) + { return use_facet >(__loc).is(ctype_base::blank, __c); } +#endif + + /// Convenience interface to ctype.toupper(__c). + template + inline _CharT + toupper(_CharT __c, const locale& __loc) + { return use_facet >(__loc).toupper(__c); } + + /// Convenience interface to ctype.tolower(__c). + template + inline _CharT + tolower(_CharT __c, const locale& __loc) + { return use_facet >(__loc).tolower(__c); } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +# include + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/locale_facets_nonio.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/locale_facets_nonio.h new file mode 100644 index 0000000..0cd307f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/locale_facets_nonio.h @@ -0,0 +1,2015 @@ +// Locale support -*- C++ -*- + +// Copyright (C) 2007-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/locale_facets_nonio.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{locale} + */ + +// +// ISO C++ 14882: 22.1 Locales +// + +#ifndef _LOCALE_FACETS_NONIO_H +#define _LOCALE_FACETS_NONIO_H 1 + +#pragma GCC system_header + +#include // For struct tm + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @brief Time format ordering data. + * @ingroup locales + * + * This class provides an enum representing different orderings of + * time: day, month, and year. + */ + class time_base + { + public: + enum dateorder { no_order, dmy, mdy, ymd, ydm }; + }; + + template + struct __timepunct_cache : public locale::facet + { + // List of all known timezones, with GMT first. + static const _CharT* _S_timezones[14]; + + const _CharT* _M_date_format; + const _CharT* _M_date_era_format; + const _CharT* _M_time_format; + const _CharT* _M_time_era_format; + const _CharT* _M_date_time_format; + const _CharT* _M_date_time_era_format; + const _CharT* _M_am; + const _CharT* _M_pm; + const _CharT* _M_am_pm_format; + + // Day names, starting with "C"'s Sunday. + const _CharT* _M_day1; + const _CharT* _M_day2; + const _CharT* _M_day3; + const _CharT* _M_day4; + const _CharT* _M_day5; + const _CharT* _M_day6; + const _CharT* _M_day7; + + // Abbreviated day names, starting with "C"'s Sun. + const _CharT* _M_aday1; + const _CharT* _M_aday2; + const _CharT* _M_aday3; + const _CharT* _M_aday4; + const _CharT* _M_aday5; + const _CharT* _M_aday6; + const _CharT* _M_aday7; + + // Month names, starting with "C"'s January. + const _CharT* _M_month01; + const _CharT* _M_month02; + const _CharT* _M_month03; + const _CharT* _M_month04; + const _CharT* _M_month05; + const _CharT* _M_month06; + const _CharT* _M_month07; + const _CharT* _M_month08; + const _CharT* _M_month09; + const _CharT* _M_month10; + const _CharT* _M_month11; + const _CharT* _M_month12; + + // Abbreviated month names, starting with "C"'s Jan. + const _CharT* _M_amonth01; + const _CharT* _M_amonth02; + const _CharT* _M_amonth03; + const _CharT* _M_amonth04; + const _CharT* _M_amonth05; + const _CharT* _M_amonth06; + const _CharT* _M_amonth07; + const _CharT* _M_amonth08; + const _CharT* _M_amonth09; + const _CharT* _M_amonth10; + const _CharT* _M_amonth11; + const _CharT* _M_amonth12; + + bool _M_allocated; + + __timepunct_cache(size_t __refs = 0) : facet(__refs), + _M_date_format(0), _M_date_era_format(0), _M_time_format(0), + _M_time_era_format(0), _M_date_time_format(0), + _M_date_time_era_format(0), _M_am(0), _M_pm(0), + _M_am_pm_format(0), _M_day1(0), _M_day2(0), _M_day3(0), + _M_day4(0), _M_day5(0), _M_day6(0), _M_day7(0), + _M_aday1(0), _M_aday2(0), _M_aday3(0), _M_aday4(0), + _M_aday5(0), _M_aday6(0), _M_aday7(0), _M_month01(0), + _M_month02(0), _M_month03(0), _M_month04(0), _M_month05(0), + _M_month06(0), _M_month07(0), _M_month08(0), _M_month09(0), + _M_month10(0), _M_month11(0), _M_month12(0), _M_amonth01(0), + _M_amonth02(0), _M_amonth03(0), _M_amonth04(0), + _M_amonth05(0), _M_amonth06(0), _M_amonth07(0), + _M_amonth08(0), _M_amonth09(0), _M_amonth10(0), + _M_amonth11(0), _M_amonth12(0), _M_allocated(false) + { } + + ~__timepunct_cache(); + + private: + __timepunct_cache& + operator=(const __timepunct_cache&); + + explicit + __timepunct_cache(const __timepunct_cache&); + }; + + template + __timepunct_cache<_CharT>::~__timepunct_cache() + { + if (_M_allocated) + { + // Unused. + } + } + + // Specializations. + template<> + const char* + __timepunct_cache::_S_timezones[14]; + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + const wchar_t* + __timepunct_cache::_S_timezones[14]; +#endif + + // Generic. + template + const _CharT* __timepunct_cache<_CharT>::_S_timezones[14]; + + template + class __timepunct : public locale::facet + { + public: + // Types: + typedef _CharT __char_type; + typedef __timepunct_cache<_CharT> __cache_type; + + protected: + __cache_type* _M_data; + __c_locale _M_c_locale_timepunct; + const char* _M_name_timepunct; + + public: + /// Numpunct facet id. + static locale::id id; + + explicit + __timepunct(size_t __refs = 0); + + explicit + __timepunct(__cache_type* __cache, size_t __refs = 0); + + /** + * @brief Internal constructor. Not for general use. + * + * This is a constructor for use by the library itself to set up new + * locales. + * + * @param __cloc The C locale. + * @param __s The name of a locale. + * @param refs Passed to the base facet class. + */ + explicit + __timepunct(__c_locale __cloc, const char* __s, size_t __refs = 0); + + // FIXME: for error checking purposes _M_put should return the return + // value of strftime/wcsftime. + void + _M_put(_CharT* __s, size_t __maxlen, const _CharT* __format, + const tm* __tm) const throw (); + + void + _M_date_formats(const _CharT** __date) const + { + // Always have default first. + __date[0] = _M_data->_M_date_format; + __date[1] = _M_data->_M_date_era_format; + } + + void + _M_time_formats(const _CharT** __time) const + { + // Always have default first. + __time[0] = _M_data->_M_time_format; + __time[1] = _M_data->_M_time_era_format; + } + + void + _M_date_time_formats(const _CharT** __dt) const + { + // Always have default first. + __dt[0] = _M_data->_M_date_time_format; + __dt[1] = _M_data->_M_date_time_era_format; + } + + void + _M_am_pm_format(const _CharT* __ampm) const + { __ampm = _M_data->_M_am_pm_format; } + + void + _M_am_pm(const _CharT** __ampm) const + { + __ampm[0] = _M_data->_M_am; + __ampm[1] = _M_data->_M_pm; + } + + void + _M_days(const _CharT** __days) const + { + __days[0] = _M_data->_M_day1; + __days[1] = _M_data->_M_day2; + __days[2] = _M_data->_M_day3; + __days[3] = _M_data->_M_day4; + __days[4] = _M_data->_M_day5; + __days[5] = _M_data->_M_day6; + __days[6] = _M_data->_M_day7; + } + + void + _M_days_abbreviated(const _CharT** __days) const + { + __days[0] = _M_data->_M_aday1; + __days[1] = _M_data->_M_aday2; + __days[2] = _M_data->_M_aday3; + __days[3] = _M_data->_M_aday4; + __days[4] = _M_data->_M_aday5; + __days[5] = _M_data->_M_aday6; + __days[6] = _M_data->_M_aday7; + } + + void + _M_months(const _CharT** __months) const + { + __months[0] = _M_data->_M_month01; + __months[1] = _M_data->_M_month02; + __months[2] = _M_data->_M_month03; + __months[3] = _M_data->_M_month04; + __months[4] = _M_data->_M_month05; + __months[5] = _M_data->_M_month06; + __months[6] = _M_data->_M_month07; + __months[7] = _M_data->_M_month08; + __months[8] = _M_data->_M_month09; + __months[9] = _M_data->_M_month10; + __months[10] = _M_data->_M_month11; + __months[11] = _M_data->_M_month12; + } + + void + _M_months_abbreviated(const _CharT** __months) const + { + __months[0] = _M_data->_M_amonth01; + __months[1] = _M_data->_M_amonth02; + __months[2] = _M_data->_M_amonth03; + __months[3] = _M_data->_M_amonth04; + __months[4] = _M_data->_M_amonth05; + __months[5] = _M_data->_M_amonth06; + __months[6] = _M_data->_M_amonth07; + __months[7] = _M_data->_M_amonth08; + __months[8] = _M_data->_M_amonth09; + __months[9] = _M_data->_M_amonth10; + __months[10] = _M_data->_M_amonth11; + __months[11] = _M_data->_M_amonth12; + } + + protected: + virtual + ~__timepunct(); + + // For use at construction time only. + void + _M_initialize_timepunct(__c_locale __cloc = 0); + }; + + template + locale::id __timepunct<_CharT>::id; + + // Specializations. + template<> + void + __timepunct::_M_initialize_timepunct(__c_locale __cloc); + + template<> + void + __timepunct::_M_put(char*, size_t, const char*, const tm*) const throw (); + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + void + __timepunct::_M_initialize_timepunct(__c_locale __cloc); + + template<> + void + __timepunct::_M_put(wchar_t*, size_t, const wchar_t*, + const tm*) const throw (); +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + + // Include host and configuration specific timepunct functions. + #include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + /** + * @brief Primary class template time_get. + * @ingroup locales + * + * This facet encapsulates the code to parse and return a date or + * time from a string. It is used by the istream numeric + * extraction operators. + * + * The time_get template uses protected virtual functions to provide the + * actual results. The public accessors forward the call to the virtual + * functions. These virtual functions are hooks for developers to + * implement the behavior they require from the time_get facet. + */ + template + class time_get : public locale::facet, public time_base + { + public: + // Types: + //@{ + /// Public typedefs + typedef _CharT char_type; + typedef _InIter iter_type; + //@} + + /// Numpunct facet id. + static locale::id id; + + /** + * @brief Constructor performs initialization. + * + * This is the constructor provided by the standard. + * + * @param __refs Passed to the base facet class. + */ + explicit + time_get(size_t __refs = 0) + : facet (__refs) { } + + /** + * @brief Return preferred order of month, day, and year. + * + * This function returns an enum from time_base::dateorder giving the + * preferred ordering if the format @a x given to time_put::put() only + * uses month, day, and year. If the format @a x for the associated + * locale uses other fields, this function returns + * time_base::dateorder::noorder. + * + * NOTE: The library always returns noorder at the moment. + * + * @return A member of time_base::dateorder. + */ + dateorder + date_order() const + { return this->do_date_order(); } + + /** + * @brief Parse input time string. + * + * This function parses a time according to the format @a X and puts the + * results into a user-supplied struct tm. The result is returned by + * calling time_get::do_get_time(). + * + * If there is a valid time string according to format @a X, @a tm will + * be filled in accordingly and the returned iterator will point to the + * first character beyond the time string. If an error occurs before + * the end, err |= ios_base::failbit. If parsing reads all the + * characters, err |= ios_base::eofbit. + * + * @param __beg Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @return Iterator to first char beyond time string. + */ + iter_type + get_time(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm) const + { return this->do_get_time(__beg, __end, __io, __err, __tm); } + + /** + * @brief Parse input date string. + * + * This function parses a date according to the format @a x and puts the + * results into a user-supplied struct tm. The result is returned by + * calling time_get::do_get_date(). + * + * If there is a valid date string according to format @a x, @a tm will + * be filled in accordingly and the returned iterator will point to the + * first character beyond the date string. If an error occurs before + * the end, err |= ios_base::failbit. If parsing reads all the + * characters, err |= ios_base::eofbit. + * + * @param __beg Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @return Iterator to first char beyond date string. + */ + iter_type + get_date(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm) const + { return this->do_get_date(__beg, __end, __io, __err, __tm); } + + /** + * @brief Parse input weekday string. + * + * This function parses a weekday name and puts the results into a + * user-supplied struct tm. The result is returned by calling + * time_get::do_get_weekday(). + * + * Parsing starts by parsing an abbreviated weekday name. If a valid + * abbreviation is followed by a character that would lead to the full + * weekday name, parsing continues until the full name is found or an + * error occurs. Otherwise parsing finishes at the end of the + * abbreviated name. + * + * If an error occurs before the end, err |= ios_base::failbit. If + * parsing reads all the characters, err |= ios_base::eofbit. + * + * @param __beg Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @return Iterator to first char beyond weekday name. + */ + iter_type + get_weekday(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm) const + { return this->do_get_weekday(__beg, __end, __io, __err, __tm); } + + /** + * @brief Parse input month string. + * + * This function parses a month name and puts the results into a + * user-supplied struct tm. The result is returned by calling + * time_get::do_get_monthname(). + * + * Parsing starts by parsing an abbreviated month name. If a valid + * abbreviation is followed by a character that would lead to the full + * month name, parsing continues until the full name is found or an + * error occurs. Otherwise parsing finishes at the end of the + * abbreviated name. + * + * If an error occurs before the end, err |= ios_base::failbit. If + * parsing reads all the characters, err |= + * ios_base::eofbit. + * + * @param __beg Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @return Iterator to first char beyond month name. + */ + iter_type + get_monthname(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm) const + { return this->do_get_monthname(__beg, __end, __io, __err, __tm); } + + /** + * @brief Parse input year string. + * + * This function reads up to 4 characters to parse a year string and + * puts the results into a user-supplied struct tm. The result is + * returned by calling time_get::do_get_year(). + * + * 4 consecutive digits are interpreted as a full year. If there are + * exactly 2 consecutive digits, the library interprets this as the + * number of years since 1900. + * + * If an error occurs before the end, err |= ios_base::failbit. If + * parsing reads all the characters, err |= ios_base::eofbit. + * + * @param __beg Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @return Iterator to first char beyond year. + */ + iter_type + get_year(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm) const + { return this->do_get_year(__beg, __end, __io, __err, __tm); } + +#if __cplusplus >= 201103L + /** + * @brief Parse input string according to format. + * + * This function calls time_get::do_get with the provided + * parameters. @see do_get() and get(). + * + * @param __s Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @param __format Format specifier. + * @param __modifier Format modifier. + * @return Iterator to first char not parsed. + */ + inline + iter_type get(iter_type __s, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm, char __format, + char __modifier = 0) const + { + return this->do_get(__s, __end, __io, __err, __tm, __format, + __modifier); + } + + /** + * @brief Parse input string according to format. + * + * This function parses the input string according to a + * provided format string. It does the inverse of + * time_put::put. The format string follows the format + * specified for strftime(3)/strptime(3). The actual parsing + * is done by time_get::do_get. + * + * @param __s Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @param __fmt Start of the format string. + * @param __fmtend End of the format string. + * @return Iterator to first char not parsed. + */ + iter_type get(iter_type __s, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm, const char_type* __fmt, + const char_type* __fmtend) const; +#endif // __cplusplus >= 201103L + + protected: + /// Destructor. + virtual + ~time_get() { } + + /** + * @brief Return preferred order of month, day, and year. + * + * This function returns an enum from time_base::dateorder giving the + * preferred ordering if the format @a x given to time_put::put() only + * uses month, day, and year. This function is a hook for derived + * classes to change the value returned. + * + * @return A member of time_base::dateorder. + */ + virtual dateorder + do_date_order() const; + + /** + * @brief Parse input time string. + * + * This function parses a time according to the format @a x and puts the + * results into a user-supplied struct tm. This function is a hook for + * derived classes to change the value returned. @see get_time() for + * details. + * + * @param __beg Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @return Iterator to first char beyond time string. + */ + virtual iter_type + do_get_time(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm) const; + + /** + * @brief Parse input date string. + * + * This function parses a date according to the format @a X and puts the + * results into a user-supplied struct tm. This function is a hook for + * derived classes to change the value returned. @see get_date() for + * details. + * + * @param __beg Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @return Iterator to first char beyond date string. + */ + virtual iter_type + do_get_date(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm) const; + + /** + * @brief Parse input weekday string. + * + * This function parses a weekday name and puts the results into a + * user-supplied struct tm. This function is a hook for derived + * classes to change the value returned. @see get_weekday() for + * details. + * + * @param __beg Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @return Iterator to first char beyond weekday name. + */ + virtual iter_type + do_get_weekday(iter_type __beg, iter_type __end, ios_base&, + ios_base::iostate& __err, tm* __tm) const; + + /** + * @brief Parse input month string. + * + * This function parses a month name and puts the results into a + * user-supplied struct tm. This function is a hook for derived + * classes to change the value returned. @see get_monthname() for + * details. + * + * @param __beg Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @return Iterator to first char beyond month name. + */ + virtual iter_type + do_get_monthname(iter_type __beg, iter_type __end, ios_base&, + ios_base::iostate& __err, tm* __tm) const; + + /** + * @brief Parse input year string. + * + * This function reads up to 4 characters to parse a year string and + * puts the results into a user-supplied struct tm. This function is a + * hook for derived classes to change the value returned. @see + * get_year() for details. + * + * @param __beg Start of string to parse. + * @param __end End of string to parse. + * @param __io Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @return Iterator to first char beyond year. + */ + virtual iter_type + do_get_year(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm) const; + +#if __cplusplus >= 201103L + /** + * @brief Parse input string according to format. + * + * This function parses the string according to the provided + * format and optional modifier. This function is a hook for + * derived classes to change the value returned. @see get() + * for more details. + * + * @param __s Start of string to parse. + * @param __end End of string to parse. + * @param __f Source of the locale. + * @param __err Error flags to set. + * @param __tm Pointer to struct tm to fill in. + * @param __format Format specifier. + * @param __modifier Format modifier. + * @return Iterator to first char not parsed. + */ +#if _GLIBCXX_USE_CXX11_ABI + virtual +#endif + iter_type + do_get(iter_type __s, iter_type __end, ios_base& __f, + ios_base::iostate& __err, tm* __tm, + char __format, char __modifier) const; +#endif // __cplusplus >= 201103L + + // Extract numeric component of length __len. + iter_type + _M_extract_num(iter_type __beg, iter_type __end, int& __member, + int __min, int __max, size_t __len, + ios_base& __io, ios_base::iostate& __err) const; + + // Extract any unique array of string literals in a const _CharT* array. + iter_type + _M_extract_name(iter_type __beg, iter_type __end, int& __member, + const _CharT** __names, size_t __indexlen, + ios_base& __io, ios_base::iostate& __err) const; + + // Extract day or month name in a const _CharT* array. + iter_type + _M_extract_wday_or_month(iter_type __beg, iter_type __end, int& __member, + const _CharT** __names, size_t __indexlen, + ios_base& __io, ios_base::iostate& __err) const; + + // Extract on a component-by-component basis, via __format argument. + iter_type + _M_extract_via_format(iter_type __beg, iter_type __end, ios_base& __io, + ios_base::iostate& __err, tm* __tm, + const _CharT* __format) const; + }; + + template + locale::id time_get<_CharT, _InIter>::id; + + /// class time_get_byname [22.2.5.2]. + template + class time_get_byname : public time_get<_CharT, _InIter> + { + public: + // Types: + typedef _CharT char_type; + typedef _InIter iter_type; + + explicit + time_get_byname(const char*, size_t __refs = 0) + : time_get<_CharT, _InIter>(__refs) { } + +#if __cplusplus >= 201103L + explicit + time_get_byname(const string& __s, size_t __refs = 0) + : time_get_byname(__s.c_str(), __refs) { } +#endif + + protected: + virtual + ~time_get_byname() { } + }; + +_GLIBCXX_END_NAMESPACE_CXX11 + + /** + * @brief Primary class template time_put. + * @ingroup locales + * + * This facet encapsulates the code to format and output dates and times + * according to formats used by strftime(). + * + * The time_put template uses protected virtual functions to provide the + * actual results. The public accessors forward the call to the virtual + * functions. These virtual functions are hooks for developers to + * implement the behavior they require from the time_put facet. + */ + template + class time_put : public locale::facet + { + public: + // Types: + //@{ + /// Public typedefs + typedef _CharT char_type; + typedef _OutIter iter_type; + //@} + + /// Numpunct facet id. + static locale::id id; + + /** + * @brief Constructor performs initialization. + * + * This is the constructor provided by the standard. + * + * @param __refs Passed to the base facet class. + */ + explicit + time_put(size_t __refs = 0) + : facet(__refs) { } + + /** + * @brief Format and output a time or date. + * + * This function formats the data in struct tm according to the + * provided format string. The format string is interpreted as by + * strftime(). + * + * @param __s The stream to write to. + * @param __io Source of locale. + * @param __fill char_type to use for padding. + * @param __tm Struct tm with date and time info to format. + * @param __beg Start of format string. + * @param __end End of format string. + * @return Iterator after writing. + */ + iter_type + put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm, + const _CharT* __beg, const _CharT* __end) const; + + /** + * @brief Format and output a time or date. + * + * This function formats the data in struct tm according to the + * provided format char and optional modifier. The format and modifier + * are interpreted as by strftime(). It does so by returning + * time_put::do_put(). + * + * @param __s The stream to write to. + * @param __io Source of locale. + * @param __fill char_type to use for padding. + * @param __tm Struct tm with date and time info to format. + * @param __format Format char. + * @param __mod Optional modifier char. + * @return Iterator after writing. + */ + iter_type + put(iter_type __s, ios_base& __io, char_type __fill, + const tm* __tm, char __format, char __mod = 0) const + { return this->do_put(__s, __io, __fill, __tm, __format, __mod); } + + protected: + /// Destructor. + virtual + ~time_put() + { } + + /** + * @brief Format and output a time or date. + * + * This function formats the data in struct tm according to the + * provided format char and optional modifier. This function is a hook + * for derived classes to change the value returned. @see put() for + * more details. + * + * @param __s The stream to write to. + * @param __io Source of locale. + * @param __fill char_type to use for padding. + * @param __tm Struct tm with date and time info to format. + * @param __format Format char. + * @param __mod Optional modifier char. + * @return Iterator after writing. + */ + virtual iter_type + do_put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm, + char __format, char __mod) const; + }; + + template + locale::id time_put<_CharT, _OutIter>::id; + + /// class time_put_byname [22.2.5.4]. + template + class time_put_byname : public time_put<_CharT, _OutIter> + { + public: + // Types: + typedef _CharT char_type; + typedef _OutIter iter_type; + + explicit + time_put_byname(const char*, size_t __refs = 0) + : time_put<_CharT, _OutIter>(__refs) + { }; + +#if __cplusplus >= 201103L + explicit + time_put_byname(const string& __s, size_t __refs = 0) + : time_put_byname(__s.c_str(), __refs) { } +#endif + + protected: + virtual + ~time_put_byname() { } + }; + + + /** + * @brief Money format ordering data. + * @ingroup locales + * + * This class contains an ordered array of 4 fields to represent the + * pattern for formatting a money amount. Each field may contain one entry + * from the part enum. symbol, sign, and value must be present and the + * remaining field must contain either none or space. @see + * moneypunct::pos_format() and moneypunct::neg_format() for details of how + * these fields are interpreted. + */ + class money_base + { + public: + enum part { none, space, symbol, sign, value }; + struct pattern { char field[4]; }; + + static const pattern _S_default_pattern; + + enum + { + _S_minus, + _S_zero, + _S_end = 11 + }; + + // String literal of acceptable (narrow) input/output, for + // money_get/money_put. "-0123456789" + static const char* _S_atoms; + + // Construct and return valid pattern consisting of some combination of: + // space none symbol sign value + _GLIBCXX_CONST static pattern + _S_construct_pattern(char __precedes, char __space, char __posn) throw (); + }; + + template + struct __moneypunct_cache : public locale::facet + { + const char* _M_grouping; + size_t _M_grouping_size; + bool _M_use_grouping; + _CharT _M_decimal_point; + _CharT _M_thousands_sep; + const _CharT* _M_curr_symbol; + size_t _M_curr_symbol_size; + const _CharT* _M_positive_sign; + size_t _M_positive_sign_size; + const _CharT* _M_negative_sign; + size_t _M_negative_sign_size; + int _M_frac_digits; + money_base::pattern _M_pos_format; + money_base::pattern _M_neg_format; + + // A list of valid numeric literals for input and output: in the standard + // "C" locale, this is "-0123456789". This array contains the chars after + // having been passed through the current locale's ctype<_CharT>.widen(). + _CharT _M_atoms[money_base::_S_end]; + + bool _M_allocated; + + __moneypunct_cache(size_t __refs = 0) : facet(__refs), + _M_grouping(0), _M_grouping_size(0), _M_use_grouping(false), + _M_decimal_point(_CharT()), _M_thousands_sep(_CharT()), + _M_curr_symbol(0), _M_curr_symbol_size(0), + _M_positive_sign(0), _M_positive_sign_size(0), + _M_negative_sign(0), _M_negative_sign_size(0), + _M_frac_digits(0), + _M_pos_format(money_base::pattern()), + _M_neg_format(money_base::pattern()), _M_allocated(false) + { } + + ~__moneypunct_cache(); + + void + _M_cache(const locale& __loc); + + private: + __moneypunct_cache& + operator=(const __moneypunct_cache&); + + explicit + __moneypunct_cache(const __moneypunct_cache&); + }; + + template + __moneypunct_cache<_CharT, _Intl>::~__moneypunct_cache() + { + if (_M_allocated) + { + delete [] _M_grouping; + delete [] _M_curr_symbol; + delete [] _M_positive_sign; + delete [] _M_negative_sign; + } + } + +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + /** + * @brief Primary class template moneypunct. + * @ingroup locales + * + * This facet encapsulates the punctuation, grouping and other formatting + * features of money amount string representations. + */ + template + class moneypunct : public locale::facet, public money_base + { + public: + // Types: + //@{ + /// Public typedefs + typedef _CharT char_type; + typedef basic_string<_CharT> string_type; + //@} + typedef __moneypunct_cache<_CharT, _Intl> __cache_type; + + private: + __cache_type* _M_data; + + public: + /// This value is provided by the standard, but no reason for its + /// existence. + static const bool intl = _Intl; + /// Numpunct facet id. + static locale::id id; + + /** + * @brief Constructor performs initialization. + * + * This is the constructor provided by the standard. + * + * @param __refs Passed to the base facet class. + */ + explicit + moneypunct(size_t __refs = 0) + : facet(__refs), _M_data(0) + { _M_initialize_moneypunct(); } + + /** + * @brief Constructor performs initialization. + * + * This is an internal constructor. + * + * @param __cache Cache for optimization. + * @param __refs Passed to the base facet class. + */ + explicit + moneypunct(__cache_type* __cache, size_t __refs = 0) + : facet(__refs), _M_data(__cache) + { _M_initialize_moneypunct(); } + + /** + * @brief Internal constructor. Not for general use. + * + * This is a constructor for use by the library itself to set up new + * locales. + * + * @param __cloc The C locale. + * @param __s The name of a locale. + * @param __refs Passed to the base facet class. + */ + explicit + moneypunct(__c_locale __cloc, const char* __s, size_t __refs = 0) + : facet(__refs), _M_data(0) + { _M_initialize_moneypunct(__cloc, __s); } + + /** + * @brief Return decimal point character. + * + * This function returns a char_type to use as a decimal point. It + * does so by returning returning + * moneypunct::do_decimal_point(). + * + * @return @a char_type representing a decimal point. + */ + char_type + decimal_point() const + { return this->do_decimal_point(); } + + /** + * @brief Return thousands separator character. + * + * This function returns a char_type to use as a thousands + * separator. It does so by returning returning + * moneypunct::do_thousands_sep(). + * + * @return char_type representing a thousands separator. + */ + char_type + thousands_sep() const + { return this->do_thousands_sep(); } + + /** + * @brief Return grouping specification. + * + * This function returns a string representing groupings for the + * integer part of an amount. Groupings indicate where thousands + * separators should be inserted. + * + * Each char in the return string is interpret as an integer rather + * than a character. These numbers represent the number of digits in a + * group. The first char in the string represents the number of digits + * in the least significant group. If a char is negative, it indicates + * an unlimited number of digits for the group. If more chars from the + * string are required to group a number, the last char is used + * repeatedly. + * + * For example, if the grouping() returns \003\002 + * and is applied to the number 123456789, this corresponds to + * 12,34,56,789. Note that if the string was 32, this would + * put more than 50 digits into the least significant group if + * the character set is ASCII. + * + * The string is returned by calling + * moneypunct::do_grouping(). + * + * @return string representing grouping specification. + */ + string + grouping() const + { return this->do_grouping(); } + + /** + * @brief Return currency symbol string. + * + * This function returns a string_type to use as a currency symbol. It + * does so by returning returning + * moneypunct::do_curr_symbol(). + * + * @return @a string_type representing a currency symbol. + */ + string_type + curr_symbol() const + { return this->do_curr_symbol(); } + + /** + * @brief Return positive sign string. + * + * This function returns a string_type to use as a sign for positive + * amounts. It does so by returning returning + * moneypunct::do_positive_sign(). + * + * If the return value contains more than one character, the first + * character appears in the position indicated by pos_format() and the + * remainder appear at the end of the formatted string. + * + * @return @a string_type representing a positive sign. + */ + string_type + positive_sign() const + { return this->do_positive_sign(); } + + /** + * @brief Return negative sign string. + * + * This function returns a string_type to use as a sign for negative + * amounts. It does so by returning returning + * moneypunct::do_negative_sign(). + * + * If the return value contains more than one character, the first + * character appears in the position indicated by neg_format() and the + * remainder appear at the end of the formatted string. + * + * @return @a string_type representing a negative sign. + */ + string_type + negative_sign() const + { return this->do_negative_sign(); } + + /** + * @brief Return number of digits in fraction. + * + * This function returns the exact number of digits that make up the + * fractional part of a money amount. It does so by returning + * returning moneypunct::do_frac_digits(). + * + * The fractional part of a money amount is optional. But if it is + * present, there must be frac_digits() digits. + * + * @return Number of digits in amount fraction. + */ + int + frac_digits() const + { return this->do_frac_digits(); } + + //@{ + /** + * @brief Return pattern for money values. + * + * This function returns a pattern describing the formatting of a + * positive or negative valued money amount. It does so by returning + * returning moneypunct::do_pos_format() or + * moneypunct::do_neg_format(). + * + * The pattern has 4 fields describing the ordering of symbol, sign, + * value, and none or space. There must be one of each in the pattern. + * The none and space enums may not appear in the first field and space + * may not appear in the final field. + * + * The parts of a money string must appear in the order indicated by + * the fields of the pattern. The symbol field indicates that the + * value of curr_symbol() may be present. The sign field indicates + * that the value of positive_sign() or negative_sign() must be + * present. The value field indicates that the absolute value of the + * money amount is present. none indicates 0 or more whitespace + * characters, except at the end, where it permits no whitespace. + * space indicates that 1 or more whitespace characters must be + * present. + * + * For example, for the US locale and pos_format() pattern + * {symbol,sign,value,none}, curr_symbol() == '$' + * positive_sign() == '+', and value 10.01, and + * options set to force the symbol, the corresponding string is + * $+10.01. + * + * @return Pattern for money values. + */ + pattern + pos_format() const + { return this->do_pos_format(); } + + pattern + neg_format() const + { return this->do_neg_format(); } + //@} + + protected: + /// Destructor. + virtual + ~moneypunct(); + + /** + * @brief Return decimal point character. + * + * Returns a char_type to use as a decimal point. This function is a + * hook for derived classes to change the value returned. + * + * @return @a char_type representing a decimal point. + */ + virtual char_type + do_decimal_point() const + { return _M_data->_M_decimal_point; } + + /** + * @brief Return thousands separator character. + * + * Returns a char_type to use as a thousands separator. This function + * is a hook for derived classes to change the value returned. + * + * @return @a char_type representing a thousands separator. + */ + virtual char_type + do_thousands_sep() const + { return _M_data->_M_thousands_sep; } + + /** + * @brief Return grouping specification. + * + * Returns a string representing groupings for the integer part of a + * number. This function is a hook for derived classes to change the + * value returned. @see grouping() for details. + * + * @return String representing grouping specification. + */ + virtual string + do_grouping() const + { return _M_data->_M_grouping; } + + /** + * @brief Return currency symbol string. + * + * This function returns a string_type to use as a currency symbol. + * This function is a hook for derived classes to change the value + * returned. @see curr_symbol() for details. + * + * @return @a string_type representing a currency symbol. + */ + virtual string_type + do_curr_symbol() const + { return _M_data->_M_curr_symbol; } + + /** + * @brief Return positive sign string. + * + * This function returns a string_type to use as a sign for positive + * amounts. This function is a hook for derived classes to change the + * value returned. @see positive_sign() for details. + * + * @return @a string_type representing a positive sign. + */ + virtual string_type + do_positive_sign() const + { return _M_data->_M_positive_sign; } + + /** + * @brief Return negative sign string. + * + * This function returns a string_type to use as a sign for negative + * amounts. This function is a hook for derived classes to change the + * value returned. @see negative_sign() for details. + * + * @return @a string_type representing a negative sign. + */ + virtual string_type + do_negative_sign() const + { return _M_data->_M_negative_sign; } + + /** + * @brief Return number of digits in fraction. + * + * This function returns the exact number of digits that make up the + * fractional part of a money amount. This function is a hook for + * derived classes to change the value returned. @see frac_digits() + * for details. + * + * @return Number of digits in amount fraction. + */ + virtual int + do_frac_digits() const + { return _M_data->_M_frac_digits; } + + /** + * @brief Return pattern for money values. + * + * This function returns a pattern describing the formatting of a + * positive valued money amount. This function is a hook for derived + * classes to change the value returned. @see pos_format() for + * details. + * + * @return Pattern for money values. + */ + virtual pattern + do_pos_format() const + { return _M_data->_M_pos_format; } + + /** + * @brief Return pattern for money values. + * + * This function returns a pattern describing the formatting of a + * negative valued money amount. This function is a hook for derived + * classes to change the value returned. @see neg_format() for + * details. + * + * @return Pattern for money values. + */ + virtual pattern + do_neg_format() const + { return _M_data->_M_neg_format; } + + // For use at construction time only. + void + _M_initialize_moneypunct(__c_locale __cloc = 0, + const char* __name = 0); + }; + + template + locale::id moneypunct<_CharT, _Intl>::id; + + template + const bool moneypunct<_CharT, _Intl>::intl; + + template<> + moneypunct::~moneypunct(); + + template<> + moneypunct::~moneypunct(); + + template<> + void + moneypunct::_M_initialize_moneypunct(__c_locale, const char*); + + template<> + void + moneypunct::_M_initialize_moneypunct(__c_locale, const char*); + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + moneypunct::~moneypunct(); + + template<> + moneypunct::~moneypunct(); + + template<> + void + moneypunct::_M_initialize_moneypunct(__c_locale, + const char*); + + template<> + void + moneypunct::_M_initialize_moneypunct(__c_locale, + const char*); +#endif + + /// class moneypunct_byname [22.2.6.4]. + template + class moneypunct_byname : public moneypunct<_CharT, _Intl> + { + public: + typedef _CharT char_type; + typedef basic_string<_CharT> string_type; + + static const bool intl = _Intl; + + explicit + moneypunct_byname(const char* __s, size_t __refs = 0) + : moneypunct<_CharT, _Intl>(__refs) + { + if (__builtin_strcmp(__s, "C") != 0 + && __builtin_strcmp(__s, "POSIX") != 0) + { + __c_locale __tmp; + this->_S_create_c_locale(__tmp, __s); + this->_M_initialize_moneypunct(__tmp); + this->_S_destroy_c_locale(__tmp); + } + } + +#if __cplusplus >= 201103L + explicit + moneypunct_byname(const string& __s, size_t __refs = 0) + : moneypunct_byname(__s.c_str(), __refs) { } +#endif + + protected: + virtual + ~moneypunct_byname() { } + }; + + template + const bool moneypunct_byname<_CharT, _Intl>::intl; + +_GLIBCXX_END_NAMESPACE_CXX11 + +_GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 + + /** + * @brief Primary class template money_get. + * @ingroup locales + * + * This facet encapsulates the code to parse and return a monetary + * amount from a string. + * + * The money_get template uses protected virtual functions to + * provide the actual results. The public accessors forward the + * call to the virtual functions. These virtual functions are + * hooks for developers to implement the behavior they require from + * the money_get facet. + */ + template + class money_get : public locale::facet + { + public: + // Types: + //@{ + /// Public typedefs + typedef _CharT char_type; + typedef _InIter iter_type; + typedef basic_string<_CharT> string_type; + //@} + + /// Numpunct facet id. + static locale::id id; + + /** + * @brief Constructor performs initialization. + * + * This is the constructor provided by the standard. + * + * @param __refs Passed to the base facet class. + */ + explicit + money_get(size_t __refs = 0) : facet(__refs) { } + + /** + * @brief Read and parse a monetary value. + * + * This function reads characters from @a __s, interprets them as a + * monetary value according to moneypunct and ctype facets retrieved + * from io.getloc(), and returns the result in @a units as an integral + * value moneypunct::frac_digits() * the actual amount. For example, + * the string $10.01 in a US locale would store 1001 in @a units. + * + * Any characters not part of a valid money amount are not consumed. + * + * If a money value cannot be parsed from the input stream, sets + * err=(err|io.failbit). If the stream is consumed before finishing + * parsing, sets err=(err|io.failbit|io.eofbit). @a units is + * unchanged if parsing fails. + * + * This function works by returning the result of do_get(). + * + * @param __s Start of characters to parse. + * @param __end End of characters to parse. + * @param __intl Parameter to use_facet >. + * @param __io Source of facets and io state. + * @param __err Error field to set if parsing fails. + * @param __units Place to store result of parsing. + * @return Iterator referencing first character beyond valid money + * amount. + */ + iter_type + get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, + ios_base::iostate& __err, long double& __units) const + { return this->do_get(__s, __end, __intl, __io, __err, __units); } + + /** + * @brief Read and parse a monetary value. + * + * This function reads characters from @a __s, interprets them as + * a monetary value according to moneypunct and ctype facets + * retrieved from io.getloc(), and returns the result in @a + * digits. For example, the string $10.01 in a US locale would + * store 1001 in @a digits. + * + * Any characters not part of a valid money amount are not consumed. + * + * If a money value cannot be parsed from the input stream, sets + * err=(err|io.failbit). If the stream is consumed before finishing + * parsing, sets err=(err|io.failbit|io.eofbit). + * + * This function works by returning the result of do_get(). + * + * @param __s Start of characters to parse. + * @param __end End of characters to parse. + * @param __intl Parameter to use_facet >. + * @param __io Source of facets and io state. + * @param __err Error field to set if parsing fails. + * @param __digits Place to store result of parsing. + * @return Iterator referencing first character beyond valid money + * amount. + */ + iter_type + get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, + ios_base::iostate& __err, string_type& __digits) const + { return this->do_get(__s, __end, __intl, __io, __err, __digits); } + + protected: + /// Destructor. + virtual + ~money_get() { } + + /** + * @brief Read and parse a monetary value. + * + * This function reads and parses characters representing a monetary + * value. This function is a hook for derived classes to change the + * value returned. @see get() for details. + */ + // XXX GLIBCXX_ABI Deprecated +#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \ + && _GLIBCXX_USE_CXX11_ABI == 0 + virtual iter_type + __do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, + ios_base::iostate& __err, double& __units) const; +#else + virtual iter_type + do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, + ios_base::iostate& __err, long double& __units) const; +#endif + + /** + * @brief Read and parse a monetary value. + * + * This function reads and parses characters representing a monetary + * value. This function is a hook for derived classes to change the + * value returned. @see get() for details. + */ + virtual iter_type + do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, + ios_base::iostate& __err, string_type& __digits) const; + + // XXX GLIBCXX_ABI Deprecated +#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \ + && _GLIBCXX_USE_CXX11_ABI == 0 + virtual iter_type + do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io, + ios_base::iostate& __err, long double& __units) const; +#endif + + template + iter_type + _M_extract(iter_type __s, iter_type __end, ios_base& __io, + ios_base::iostate& __err, string& __digits) const; + }; + + template + locale::id money_get<_CharT, _InIter>::id; + + /** + * @brief Primary class template money_put. + * @ingroup locales + * + * This facet encapsulates the code to format and output a monetary + * amount. + * + * The money_put template uses protected virtual functions to + * provide the actual results. The public accessors forward the + * call to the virtual functions. These virtual functions are + * hooks for developers to implement the behavior they require from + * the money_put facet. + */ + template + class money_put : public locale::facet + { + public: + //@{ + /// Public typedefs + typedef _CharT char_type; + typedef _OutIter iter_type; + typedef basic_string<_CharT> string_type; + //@} + + /// Numpunct facet id. + static locale::id id; + + /** + * @brief Constructor performs initialization. + * + * This is the constructor provided by the standard. + * + * @param __refs Passed to the base facet class. + */ + explicit + money_put(size_t __refs = 0) : facet(__refs) { } + + /** + * @brief Format and output a monetary value. + * + * This function formats @a units as a monetary value according to + * moneypunct and ctype facets retrieved from io.getloc(), and writes + * the resulting characters to @a __s. For example, the value 1001 in a + * US locale would write $10.01 to @a __s. + * + * This function works by returning the result of do_put(). + * + * @param __s The stream to write to. + * @param __intl Parameter to use_facet >. + * @param __io Source of facets and io state. + * @param __fill char_type to use for padding. + * @param __units Place to store result of parsing. + * @return Iterator after writing. + */ + iter_type + put(iter_type __s, bool __intl, ios_base& __io, + char_type __fill, long double __units) const + { return this->do_put(__s, __intl, __io, __fill, __units); } + + /** + * @brief Format and output a monetary value. + * + * This function formats @a digits as a monetary value + * according to moneypunct and ctype facets retrieved from + * io.getloc(), and writes the resulting characters to @a __s. + * For example, the string 1001 in a US locale + * would write $10.01 to @a __s. + * + * This function works by returning the result of do_put(). + * + * @param __s The stream to write to. + * @param __intl Parameter to use_facet >. + * @param __io Source of facets and io state. + * @param __fill char_type to use for padding. + * @param __digits Place to store result of parsing. + * @return Iterator after writing. + */ + iter_type + put(iter_type __s, bool __intl, ios_base& __io, + char_type __fill, const string_type& __digits) const + { return this->do_put(__s, __intl, __io, __fill, __digits); } + + protected: + /// Destructor. + virtual + ~money_put() { } + + /** + * @brief Format and output a monetary value. + * + * This function formats @a units as a monetary value according to + * moneypunct and ctype facets retrieved from io.getloc(), and writes + * the resulting characters to @a __s. For example, the value 1001 in a + * US locale would write $10.01 to @a __s. + * + * This function is a hook for derived classes to change the value + * returned. @see put(). + * + * @param __s The stream to write to. + * @param __intl Parameter to use_facet >. + * @param __io Source of facets and io state. + * @param __fill char_type to use for padding. + * @param __units Place to store result of parsing. + * @return Iterator after writing. + */ + // XXX GLIBCXX_ABI Deprecated +#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \ + && _GLIBCXX_USE_CXX11_ABI == 0 + virtual iter_type + __do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, + double __units) const; +#else + virtual iter_type + do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, + long double __units) const; +#endif + + /** + * @brief Format and output a monetary value. + * + * This function formats @a digits as a monetary value + * according to moneypunct and ctype facets retrieved from + * io.getloc(), and writes the resulting characters to @a __s. + * For example, the string 1001 in a US locale + * would write $10.01 to @a __s. + * + * This function is a hook for derived classes to change the value + * returned. @see put(). + * + * @param __s The stream to write to. + * @param __intl Parameter to use_facet >. + * @param __io Source of facets and io state. + * @param __fill char_type to use for padding. + * @param __digits Place to store result of parsing. + * @return Iterator after writing. + */ + virtual iter_type + do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, + const string_type& __digits) const; + + // XXX GLIBCXX_ABI Deprecated +#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \ + && _GLIBCXX_USE_CXX11_ABI == 0 + virtual iter_type + do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill, + long double __units) const; +#endif + + template + iter_type + _M_insert(iter_type __s, ios_base& __io, char_type __fill, + const string_type& __digits) const; + }; + + template + locale::id money_put<_CharT, _OutIter>::id; + +_GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 + + /** + * @brief Messages facet base class providing catalog typedef. + * @ingroup locales + */ + struct messages_base + { + typedef int catalog; + }; + +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + /** + * @brief Primary class template messages. + * @ingroup locales + * + * This facet encapsulates the code to retrieve messages from + * message catalogs. The only thing defined by the standard for this facet + * is the interface. All underlying functionality is + * implementation-defined. + * + * This library currently implements 3 versions of the message facet. The + * first version (gnu) is a wrapper around gettext, provided by libintl. + * The second version (ieee) is a wrapper around catgets. The final + * version (default) does no actual translation. These implementations are + * only provided for char and wchar_t instantiations. + * + * The messages template uses protected virtual functions to + * provide the actual results. The public accessors forward the + * call to the virtual functions. These virtual functions are + * hooks for developers to implement the behavior they require from + * the messages facet. + */ + template + class messages : public locale::facet, public messages_base + { + public: + // Types: + //@{ + /// Public typedefs + typedef _CharT char_type; + typedef basic_string<_CharT> string_type; + //@} + + protected: + // Underlying "C" library locale information saved from + // initialization, needed by messages_byname as well. + __c_locale _M_c_locale_messages; + const char* _M_name_messages; + + public: + /// Numpunct facet id. + static locale::id id; + + /** + * @brief Constructor performs initialization. + * + * This is the constructor provided by the standard. + * + * @param __refs Passed to the base facet class. + */ + explicit + messages(size_t __refs = 0); + + // Non-standard. + /** + * @brief Internal constructor. Not for general use. + * + * This is a constructor for use by the library itself to set up new + * locales. + * + * @param __cloc The C locale. + * @param __s The name of a locale. + * @param __refs Refcount to pass to the base class. + */ + explicit + messages(__c_locale __cloc, const char* __s, size_t __refs = 0); + + /* + * @brief Open a message catalog. + * + * This function opens and returns a handle to a message catalog by + * returning do_open(__s, __loc). + * + * @param __s The catalog to open. + * @param __loc Locale to use for character set conversions. + * @return Handle to the catalog or value < 0 if open fails. + */ + catalog + open(const basic_string& __s, const locale& __loc) const + { return this->do_open(__s, __loc); } + + // Non-standard and unorthodox, yet effective. + /* + * @brief Open a message catalog. + * + * This non-standard function opens and returns a handle to a message + * catalog by returning do_open(s, loc). The third argument provides a + * message catalog root directory for gnu gettext and is ignored + * otherwise. + * + * @param __s The catalog to open. + * @param __loc Locale to use for character set conversions. + * @param __dir Message catalog root directory. + * @return Handle to the catalog or value < 0 if open fails. + */ + catalog + open(const basic_string&, const locale&, const char*) const; + + /* + * @brief Look up a string in a message catalog. + * + * This function retrieves and returns a message from a catalog by + * returning do_get(c, set, msgid, s). + * + * For gnu, @a __set and @a msgid are ignored. Returns gettext(s). + * For default, returns s. For ieee, returns catgets(c,set,msgid,s). + * + * @param __c The catalog to access. + * @param __set Implementation-defined. + * @param __msgid Implementation-defined. + * @param __s Default return value if retrieval fails. + * @return Retrieved message or @a __s if get fails. + */ + string_type + get(catalog __c, int __set, int __msgid, const string_type& __s) const + { return this->do_get(__c, __set, __msgid, __s); } + + /* + * @brief Close a message catalog. + * + * Closes catalog @a c by calling do_close(c). + * + * @param __c The catalog to close. + */ + void + close(catalog __c) const + { return this->do_close(__c); } + + protected: + /// Destructor. + virtual + ~messages(); + + /* + * @brief Open a message catalog. + * + * This function opens and returns a handle to a message catalog in an + * implementation-defined manner. This function is a hook for derived + * classes to change the value returned. + * + * @param __s The catalog to open. + * @param __loc Locale to use for character set conversions. + * @return Handle to the opened catalog, value < 0 if open failed. + */ + virtual catalog + do_open(const basic_string&, const locale&) const; + + /* + * @brief Look up a string in a message catalog. + * + * This function retrieves and returns a message from a catalog in an + * implementation-defined manner. This function is a hook for derived + * classes to change the value returned. + * + * For gnu, @a __set and @a __msgid are ignored. Returns gettext(s). + * For default, returns s. For ieee, returns catgets(c,set,msgid,s). + * + * @param __c The catalog to access. + * @param __set Implementation-defined. + * @param __msgid Implementation-defined. + * @param __s Default return value if retrieval fails. + * @return Retrieved message or @a __s if get fails. + */ + virtual string_type + do_get(catalog, int, int, const string_type& __dfault) const; + + /* + * @brief Close a message catalog. + * + * @param __c The catalog to close. + */ + virtual void + do_close(catalog) const; + + // Returns a locale and codeset-converted string, given a char* message. + char* + _M_convert_to_char(const string_type& __msg) const + { + // XXX + return reinterpret_cast(const_cast<_CharT*>(__msg.c_str())); + } + + // Returns a locale and codeset-converted string, given a char* message. + string_type + _M_convert_from_char(char*) const + { + // XXX + return string_type(); + } + }; + + template + locale::id messages<_CharT>::id; + + /// Specializations for required instantiations. + template<> + string + messages::do_get(catalog, int, int, const string&) const; + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> + wstring + messages::do_get(catalog, int, int, const wstring&) const; +#endif + + /// class messages_byname [22.2.7.2]. + template + class messages_byname : public messages<_CharT> + { + public: + typedef _CharT char_type; + typedef basic_string<_CharT> string_type; + + explicit + messages_byname(const char* __s, size_t __refs = 0); + +#if __cplusplus >= 201103L + explicit + messages_byname(const string& __s, size_t __refs = 0) + : messages_byname(__s.c_str(), __refs) { } +#endif + + protected: + virtual + ~messages_byname() + { } + }; + +_GLIBCXX_END_NAMESPACE_CXX11 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +// Include host and configuration specific messages functions. +#include + +// 22.2.1.5 Template class codecvt +#include + +#include + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/localefwd.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/localefwd.h new file mode 100644 index 0000000..ae302e2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/localefwd.h @@ -0,0 +1,206 @@ +// Forward declarations -*- C++ -*- + +// Copyright (C) 1997-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/localefwd.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{locale} + */ + +// +// ISO C++ 14882: 22.1 Locales +// + +#ifndef _LOCALE_FWD_H +#define _LOCALE_FWD_H 1 + +#pragma GCC system_header + +#include +#include // Defines __c_locale, config-specific include +#include // For ostreambuf_iterator, istreambuf_iterator +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @defgroup locales Locales + * + * Classes and functions for internationalization and localization. + */ + + // 22.1.1 Locale + class locale; + + template + bool + has_facet(const locale&) throw(); + + template + const _Facet& + use_facet(const locale&); + + // 22.1.3 Convenience interfaces + template + bool + isspace(_CharT, const locale&); + + template + bool + isprint(_CharT, const locale&); + + template + bool + iscntrl(_CharT, const locale&); + + template + bool + isupper(_CharT, const locale&); + + template + bool + islower(_CharT, const locale&); + + template + bool + isalpha(_CharT, const locale&); + + template + bool + isdigit(_CharT, const locale&); + + template + bool + ispunct(_CharT, const locale&); + + template + bool + isxdigit(_CharT, const locale&); + + template + bool + isalnum(_CharT, const locale&); + + template + bool + isgraph(_CharT, const locale&); + +#if __cplusplus >= 201103L + template + bool + isblank(_CharT, const locale&); +#endif + + template + _CharT + toupper(_CharT, const locale&); + + template + _CharT + tolower(_CharT, const locale&); + + // 22.2.1 and 22.2.1.3 ctype + class ctype_base; + template + class ctype; + template<> class ctype; +#ifdef _GLIBCXX_USE_WCHAR_T + template<> class ctype; +#endif + template + class ctype_byname; + // NB: Specialized for char and wchar_t in locale_facets.h. + + class codecvt_base; + template + class codecvt; + template<> class codecvt; +#ifdef _GLIBCXX_USE_WCHAR_T + template<> class codecvt; +#endif + template + class codecvt_byname; + + // 22.2.2 and 22.2.3 numeric +_GLIBCXX_BEGIN_NAMESPACE_LDBL + template > + class num_get; + template > + class num_put; +_GLIBCXX_END_NAMESPACE_LDBL +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + template class numpunct; + template class numpunct_byname; +_GLIBCXX_END_NAMESPACE_CXX11 + +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + // 22.2.4 collation + template + class collate; + template + class collate_byname; +_GLIBCXX_END_NAMESPACE_CXX11 + + // 22.2.5 date and time + class time_base; +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + template > + class time_get; + template > + class time_get_byname; +_GLIBCXX_END_NAMESPACE_CXX11 + template > + class time_put; + template > + class time_put_byname; + + // 22.2.6 money + class money_base; +_GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 + template > + class money_get; + template > + class money_put; +_GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + template + class moneypunct; + template + class moneypunct_byname; +_GLIBCXX_END_NAMESPACE_CXX11 + + // 22.2.7 message retrieval + class messages_base; +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + template + class messages; + template + class messages_byname; +_GLIBCXX_END_NAMESPACE_CXX11 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/mask_array.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/mask_array.h new file mode 100644 index 0000000..5c4fcc6 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/mask_array.h @@ -0,0 +1,208 @@ +// The template and inlines for the -*- C++ -*- mask_array class. + +// Copyright (C) 1997-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/mask_array.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{valarray} + */ + +// Written by Gabriel Dos Reis + +#ifndef _MASK_ARRAY_H +#define _MASK_ARRAY_H 1 + +#pragma GCC system_header + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup numeric_arrays + * @{ + */ + + /** + * @brief Reference to selected subset of an array. + * + * A mask_array is a reference to the actual elements of an array specified + * by a bitmask in the form of an array of bool. The way to get a + * mask_array is to call operator[](valarray) on a valarray. The + * returned mask_array then permits carrying operations out on the + * referenced subset of elements in the original valarray. + * + * For example, if a mask_array is obtained using the array (false, true, + * false, true) as an argument, the mask array has two elements referring + * to array[1] and array[3] in the underlying array. + * + * @param Tp Element type. + */ + template + class mask_array + { + public: + typedef _Tp value_type; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 253. valarray helper functions are almost entirely useless + + /// Copy constructor. Both slices refer to the same underlying array. + mask_array (const mask_array&); + + /// Assignment operator. Assigns elements to corresponding elements + /// of @a a. + mask_array& operator=(const mask_array&); + + void operator=(const valarray<_Tp>&) const; + /// Multiply slice elements by corresponding elements of @a v. + void operator*=(const valarray<_Tp>&) const; + /// Divide slice elements by corresponding elements of @a v. + void operator/=(const valarray<_Tp>&) const; + /// Modulo slice elements by corresponding elements of @a v. + void operator%=(const valarray<_Tp>&) const; + /// Add corresponding elements of @a v to slice elements. + void operator+=(const valarray<_Tp>&) const; + /// Subtract corresponding elements of @a v from slice elements. + void operator-=(const valarray<_Tp>&) const; + /// Logical xor slice elements with corresponding elements of @a v. + void operator^=(const valarray<_Tp>&) const; + /// Logical and slice elements with corresponding elements of @a v. + void operator&=(const valarray<_Tp>&) const; + /// Logical or slice elements with corresponding elements of @a v. + void operator|=(const valarray<_Tp>&) const; + /// Left shift slice elements by corresponding elements of @a v. + void operator<<=(const valarray<_Tp>&) const; + /// Right shift slice elements by corresponding elements of @a v. + void operator>>=(const valarray<_Tp>&) const; + /// Assign all slice elements to @a t. + void operator=(const _Tp&) const; + + // ~mask_array (); + + template + void operator=(const _Expr<_Dom,_Tp>&) const; + template + void operator*=(const _Expr<_Dom,_Tp>&) const; + template + void operator/=(const _Expr<_Dom,_Tp>&) const; + template + void operator%=(const _Expr<_Dom,_Tp>&) const; + template + void operator+=(const _Expr<_Dom,_Tp>&) const; + template + void operator-=(const _Expr<_Dom,_Tp>&) const; + template + void operator^=(const _Expr<_Dom,_Tp>&) const; + template + void operator&=(const _Expr<_Dom,_Tp>&) const; + template + void operator|=(const _Expr<_Dom,_Tp>&) const; + template + void operator<<=(const _Expr<_Dom,_Tp>&) const; + template + void operator>>=(const _Expr<_Dom,_Tp>&) const; + + private: + mask_array(_Array<_Tp>, size_t, _Array); + friend class valarray<_Tp>; + + const size_t _M_sz; + const _Array _M_mask; + const _Array<_Tp> _M_array; + + // not implemented + mask_array(); + }; + + template + inline mask_array<_Tp>::mask_array(const mask_array<_Tp>& __a) + : _M_sz(__a._M_sz), _M_mask(__a._M_mask), _M_array(__a._M_array) {} + + template + inline + mask_array<_Tp>::mask_array(_Array<_Tp> __a, size_t __s, _Array __m) + : _M_sz(__s), _M_mask(__m), _M_array(__a) {} + + template + inline mask_array<_Tp>& + mask_array<_Tp>::operator=(const mask_array<_Tp>& __a) + { + std::__valarray_copy(__a._M_array, __a._M_mask, + _M_sz, _M_array, _M_mask); + return *this; + } + + template + inline void + mask_array<_Tp>::operator=(const _Tp& __t) const + { std::__valarray_fill(_M_array, _M_sz, _M_mask, __t); } + + template + inline void + mask_array<_Tp>::operator=(const valarray<_Tp>& __v) const + { std::__valarray_copy(_Array<_Tp>(__v), __v.size(), _M_array, _M_mask); } + + template + template + inline void + mask_array<_Tp>::operator=(const _Expr<_Ex, _Tp>& __e) const + { std::__valarray_copy(__e, __e.size(), _M_array, _M_mask); } + +#undef _DEFINE_VALARRAY_OPERATOR +#define _DEFINE_VALARRAY_OPERATOR(_Op, _Name) \ + template \ + inline void \ + mask_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const \ + { \ + _Array_augmented_##_Name(_M_array, _M_mask, \ + _Array<_Tp>(__v), __v.size()); \ + } \ + \ + template \ + template \ + inline void \ + mask_array<_Tp>::operator _Op##=(const _Expr<_Dom, _Tp>& __e) const\ + { \ + _Array_augmented_##_Name(_M_array, _M_mask, __e, __e.size()); \ + } + +_DEFINE_VALARRAY_OPERATOR(*, __multiplies) +_DEFINE_VALARRAY_OPERATOR(/, __divides) +_DEFINE_VALARRAY_OPERATOR(%, __modulus) +_DEFINE_VALARRAY_OPERATOR(+, __plus) +_DEFINE_VALARRAY_OPERATOR(-, __minus) +_DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor) +_DEFINE_VALARRAY_OPERATOR(&, __bitwise_and) +_DEFINE_VALARRAY_OPERATOR(|, __bitwise_or) +_DEFINE_VALARRAY_OPERATOR(<<, __shift_left) +_DEFINE_VALARRAY_OPERATOR(>>, __shift_right) + +#undef _DEFINE_VALARRAY_OPERATOR + + // @} group numeric_arrays + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _MASK_ARRAY_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/memoryfwd.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/memoryfwd.h new file mode 100644 index 0000000..1429026 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/memoryfwd.h @@ -0,0 +1,78 @@ +// Forward declarations -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * Copyright (c) 1996-1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/memoryfwd.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _MEMORYFWD_H +#define _MEMORYFWD_H 1 + +#pragma GCC system_header + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @defgroup allocators Allocators + * @ingroup memory + * + * Classes encapsulating memory operations. + * + * @{ + */ + + template + class allocator; + + template<> + class allocator; + + /// Declare uses_allocator so it can be specialized in \ etc. + template + struct uses_allocator; + + /// @} group memory + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/move.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/move.h new file mode 100644 index 0000000..5f47b0e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/move.h @@ -0,0 +1,225 @@ +// Move, forward and identity for C++11 + swap -*- C++ -*- + +// Copyright (C) 2007-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/move.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{utility} + */ + +#ifndef _MOVE_H +#define _MOVE_H 1 + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // Used, in C++03 mode too, by allocators, etc. + /** + * @brief Same as C++11 std::addressof + * @ingroup utilities + */ + template + inline _GLIBCXX_CONSTEXPR _Tp* + __addressof(_Tp& __r) _GLIBCXX_NOEXCEPT + { return __builtin_addressof(__r); } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#if __cplusplus >= 201103L +#include // Brings in std::declval too. + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup utilities + * @{ + */ + + /** + * @brief Forward an lvalue. + * @return The parameter cast to the specified type. + * + * This function is used to implement "perfect forwarding". + */ + template + constexpr _Tp&& + forward(typename std::remove_reference<_Tp>::type& __t) noexcept + { return static_cast<_Tp&&>(__t); } + + /** + * @brief Forward an rvalue. + * @return The parameter cast to the specified type. + * + * This function is used to implement "perfect forwarding". + */ + template + constexpr _Tp&& + forward(typename std::remove_reference<_Tp>::type&& __t) noexcept + { + static_assert(!std::is_lvalue_reference<_Tp>::value, "template argument" + " substituting _Tp is an lvalue reference type"); + return static_cast<_Tp&&>(__t); + } + + /** + * @brief Convert a value to an rvalue. + * @param __t A thing of arbitrary type. + * @return The parameter cast to an rvalue-reference to allow moving it. + */ + template + constexpr typename std::remove_reference<_Tp>::type&& + move(_Tp&& __t) noexcept + { return static_cast::type&&>(__t); } + + + template + struct __move_if_noexcept_cond + : public __and_<__not_>, + is_copy_constructible<_Tp>>::type { }; + + /** + * @brief Conditionally convert a value to an rvalue. + * @param __x A thing of arbitrary type. + * @return The parameter, possibly cast to an rvalue-reference. + * + * Same as std::move unless the type's move constructor could throw and the + * type is copyable, in which case an lvalue-reference is returned instead. + */ + template + constexpr typename + conditional<__move_if_noexcept_cond<_Tp>::value, const _Tp&, _Tp&&>::type + move_if_noexcept(_Tp& __x) noexcept + { return std::move(__x); } + + // declval, from type_traits. + +#if __cplusplus > 201402L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2296. std::addressof should be constexpr +# define __cpp_lib_addressof_constexpr 201603 +#endif + /** + * @brief Returns the actual address of the object or function + * referenced by r, even in the presence of an overloaded + * operator&. + * @param __r Reference to an object or function. + * @return The actual address. + */ + template + inline _GLIBCXX17_CONSTEXPR _Tp* + addressof(_Tp& __r) noexcept + { return std::__addressof(__r); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2598. addressof works on temporaries + template + const _Tp* addressof(const _Tp&&) = delete; + + // C++11 version of std::exchange for internal use. + template + inline _Tp + __exchange(_Tp& __obj, _Up&& __new_val) + { + _Tp __old_val = std::move(__obj); + __obj = std::forward<_Up>(__new_val); + return __old_val; + } + + /// @} group utilities +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#define _GLIBCXX_MOVE(__val) std::move(__val) +#define _GLIBCXX_FORWARD(_Tp, __val) std::forward<_Tp>(__val) +#else +#define _GLIBCXX_MOVE(__val) (__val) +#define _GLIBCXX_FORWARD(_Tp, __val) (__val) +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup utilities + * @{ + */ + + /** + * @brief Swaps two values. + * @param __a A thing of arbitrary type. + * @param __b Another thing of arbitrary type. + * @return Nothing. + */ + template + inline +#if __cplusplus >= 201103L + typename enable_if<__and_<__not_<__is_tuple_like<_Tp>>, + is_move_constructible<_Tp>, + is_move_assignable<_Tp>>::value>::type + swap(_Tp& __a, _Tp& __b) + noexcept(__and_, + is_nothrow_move_assignable<_Tp>>::value) +#else + void + swap(_Tp& __a, _Tp& __b) +#endif + { + // concept requirements + __glibcxx_function_requires(_SGIAssignableConcept<_Tp>) + + _Tp __tmp = _GLIBCXX_MOVE(__a); + __a = _GLIBCXX_MOVE(__b); + __b = _GLIBCXX_MOVE(__tmp); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 809. std::swap should be overloaded for array types. + /// Swap the contents of two arrays. + template + inline +#if __cplusplus >= 201103L + typename enable_if<__is_swappable<_Tp>::value>::type + swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) + noexcept(__is_nothrow_swappable<_Tp>::value) +#else + void + swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) +#endif + { + for (size_t __n = 0; __n < _Nm; ++__n) + swap(__a[__n], __b[__n]); + } + + /// @} group utilities +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _MOVE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/nested_exception.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/nested_exception.h new file mode 100644 index 0000000..43970b4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/nested_exception.h @@ -0,0 +1,161 @@ +// Nested Exception support header (nested_exception class) for -*- C++ -*- + +// Copyright (C) 2009-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/nested_exception.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{exception} + */ + +#ifndef _GLIBCXX_NESTED_EXCEPTION_H +#define _GLIBCXX_NESTED_EXCEPTION_H 1 + +#pragma GCC visibility push(default) + +#if __cplusplus < 201103L +# include +#else + +#include +#include + +extern "C++" { + +namespace std +{ + /** + * @addtogroup exceptions + * @{ + */ + + /// Exception class with exception_ptr data member. + class nested_exception + { + exception_ptr _M_ptr; + + public: + nested_exception() noexcept : _M_ptr(current_exception()) { } + + nested_exception(const nested_exception&) noexcept = default; + + nested_exception& operator=(const nested_exception&) noexcept = default; + + virtual ~nested_exception() noexcept; + + [[noreturn]] + void + rethrow_nested() const + { + if (_M_ptr) + rethrow_exception(_M_ptr); + std::terminate(); + } + + exception_ptr + nested_ptr() const noexcept + { return _M_ptr; } + }; + + template + struct _Nested_exception : public _Except, public nested_exception + { + explicit _Nested_exception(const _Except& __ex) + : _Except(__ex) + { } + + explicit _Nested_exception(_Except&& __ex) + : _Except(static_cast<_Except&&>(__ex)) + { } + }; + + // [except.nested]/8 + // Throw an exception of unspecified type that is publicly derived from + // both remove_reference_t<_Tp> and nested_exception. + template + inline void + __throw_with_nested_impl(_Tp&& __t, true_type) + { + using _Up = typename remove_reference<_Tp>::type; + throw _Nested_exception<_Up>{std::forward<_Tp>(__t)}; + } + + template + inline void + __throw_with_nested_impl(_Tp&& __t, false_type) + { throw std::forward<_Tp>(__t); } + + /// If @p __t is derived from nested_exception, throws @p __t. + /// Else, throws an implementation-defined object derived from both. + template + [[noreturn]] + inline void + throw_with_nested(_Tp&& __t) + { + using _Up = typename decay<_Tp>::type; + using _CopyConstructible + = __and_, is_move_constructible<_Up>>; + static_assert(_CopyConstructible::value, + "throw_with_nested argument must be CopyConstructible"); + using __nest = __and_, __bool_constant, + __not_>>; + std::__throw_with_nested_impl(std::forward<_Tp>(__t), __nest{}); + } + + // Determine if dynamic_cast would be well-formed. + template + using __rethrow_if_nested_cond = typename enable_if< + __and_, + __or_<__not_>, + is_convertible<_Tp*, nested_exception*>>>::value + >::type; + + // Attempt dynamic_cast to nested_exception and call rethrow_nested(). + template + inline __rethrow_if_nested_cond<_Ex> + __rethrow_if_nested_impl(const _Ex* __ptr) + { + if (auto __ne_ptr = dynamic_cast(__ptr)) + __ne_ptr->rethrow_nested(); + } + + // Otherwise, no effects. + inline void + __rethrow_if_nested_impl(const void*) + { } + + /// If @p __ex is derived from nested_exception, @p __ex.rethrow_nested(). + template + inline void + rethrow_if_nested(const _Ex& __ex) + { std::__rethrow_if_nested_impl(std::__addressof(__ex)); } + + // @} group exceptions +} // namespace std + +} // extern "C++" + +#endif // C++11 + +#pragma GCC visibility pop + +#endif // _GLIBCXX_NESTED_EXCEPTION_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/node_handle.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/node_handle.h new file mode 100644 index 0000000..f75f742 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/node_handle.h @@ -0,0 +1,293 @@ +// Node handles for containers -*- C++ -*- + +// Copyright (C) 2016-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/node_handle.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. + * @headername{map,set,unordered_map,unordered_set} + */ + +#ifndef _NODE_HANDLE +#define _NODE_HANDLE 1 + +#pragma GCC system_header + +#if __cplusplus > 201402L +# define __cpp_lib_node_extract 201606 + +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /// Base class for node handle types of maps and sets. + template + class _Node_handle_common + { + using _AllocTraits = allocator_traits<_NodeAlloc>; + + public: + using allocator_type = __alloc_rebind<_NodeAlloc, _Val>; + + allocator_type + get_allocator() const noexcept + { + __glibcxx_assert(!this->empty()); + return allocator_type(*_M_alloc); + } + + explicit operator bool() const noexcept { return _M_ptr != nullptr; } + + bool empty() const noexcept { return _M_ptr == nullptr; } + + protected: + constexpr _Node_handle_common() noexcept : _M_ptr(), _M_alloc() {} + + ~_Node_handle_common() { _M_destroy(); } + + _Node_handle_common(_Node_handle_common&& __nh) noexcept + : _M_ptr(__nh._M_ptr), _M_alloc(std::move(__nh._M_alloc)) + { + __nh._M_ptr = nullptr; + __nh._M_alloc = nullopt; + } + + _Node_handle_common& + operator=(_Node_handle_common&& __nh) noexcept + { + _M_destroy(); + _M_ptr = __nh._M_ptr; + if constexpr (is_move_assignable_v<_NodeAlloc>) + { + if (_AllocTraits::propagate_on_container_move_assignment::value + || !this->_M_alloc) + this->_M_alloc = std::move(__nh._M_alloc); + else + __glibcxx_assert(this->_M_alloc == __nh._M_alloc); + } + else + __glibcxx_assert(_M_alloc); + __nh._M_ptr = nullptr; + __nh._M_alloc = nullopt; + return *this; + } + + _Node_handle_common(typename _AllocTraits::pointer __ptr, + const _NodeAlloc& __alloc) + : _M_ptr(__ptr), _M_alloc(__alloc) { } + + void + _M_swap(_Node_handle_common& __nh) noexcept + { + using std::swap; + swap(_M_ptr, __nh._M_ptr); + if (_AllocTraits::propagate_on_container_swap + || !_M_alloc || !__nh._M_alloc) + _M_alloc.swap(__nh._M_alloc); + else + __glibcxx_assert(_M_alloc == __nh._M_alloc); + } + + private: + void + _M_destroy() noexcept + { + if (_M_ptr != nullptr) + { + allocator_type __alloc(*_M_alloc); + allocator_traits::destroy(__alloc, + _M_ptr->_M_valptr()); + _AllocTraits::deallocate(*_M_alloc, _M_ptr, 1); + } + } + + protected: + typename _AllocTraits::pointer _M_ptr; + private: + optional<_NodeAlloc> _M_alloc; + + template + friend class _Rb_tree; + }; + + /// Node handle type for maps. + template + class _Node_handle : public _Node_handle_common<_Value, _NodeAlloc> + { + public: + constexpr _Node_handle() noexcept = default; + ~_Node_handle() = default; + _Node_handle(_Node_handle&&) noexcept = default; + + _Node_handle& + operator=(_Node_handle&&) noexcept = default; + + using key_type = _Key; + using mapped_type = typename _Value::second_type; + + key_type& + key() const noexcept + { + __glibcxx_assert(!this->empty()); + return *_M_pkey; + } + + mapped_type& + mapped() const noexcept + { + __glibcxx_assert(!this->empty()); + return *_M_pmapped; + } + + void + swap(_Node_handle& __nh) noexcept + { + this->_M_swap(__nh); + using std::swap; + swap(_M_pkey, __nh._M_pkey); + swap(_M_pmapped, __nh._M_pmapped); + } + + friend void + swap(_Node_handle& __x, _Node_handle& __y) + noexcept(noexcept(__x.swap(__y))) + { __x.swap(__y); } + + private: + using _AllocTraits = allocator_traits<_NodeAlloc>; + + _Node_handle(typename _AllocTraits::pointer __ptr, + const _NodeAlloc& __alloc) + : _Node_handle_common<_Value, _NodeAlloc>(__ptr, __alloc) + { + if (__ptr) + { + auto& __key = const_cast<_Key&>(__ptr->_M_valptr()->first); + _M_pkey = _S_pointer_to(__key); + _M_pmapped = _S_pointer_to(__ptr->_M_valptr()->second); + } + else + { + _M_pkey = nullptr; + _M_pmapped = nullptr; + } + } + + template + using __pointer + = __ptr_rebind>; + + __pointer<_Key> _M_pkey = nullptr; + __pointer _M_pmapped = nullptr; + + template + __pointer<_Tp> + _S_pointer_to(_Tp& __obj) + { return pointer_traits<__pointer<_Tp>>::pointer_to(__obj); } + + const key_type& + _M_key() const noexcept { return key(); } + + template + friend class _Rb_tree; + + template + friend class _Hashtable; + }; + + /// Node handle type for sets. + template + class _Node_handle<_Value, _Value, _NodeAlloc> + : public _Node_handle_common<_Value, _NodeAlloc> + { + public: + constexpr _Node_handle() noexcept = default; + ~_Node_handle() = default; + _Node_handle(_Node_handle&&) noexcept = default; + + _Node_handle& + operator=(_Node_handle&&) noexcept = default; + + using value_type = _Value; + + value_type& + value() const noexcept + { + __glibcxx_assert(!this->empty()); + return *this->_M_ptr->_M_valptr(); + } + + void + swap(_Node_handle& __nh) noexcept + { this->_M_swap(__nh); } + + friend void + swap(_Node_handle& __x, _Node_handle& __y) + noexcept(noexcept(__x.swap(__y))) + { __x.swap(__y); } + + private: + using _AllocTraits = allocator_traits<_NodeAlloc>; + + _Node_handle(typename _AllocTraits::pointer __ptr, + const _NodeAlloc& __alloc) + : _Node_handle_common<_Value, _NodeAlloc>(__ptr, __alloc) { } + + const value_type& + _M_key() const noexcept { return value(); } + + template + friend class _Rb_tree; + + template + friend class _Hashtable; + }; + + /// Return type of insert(node_handle&&) on unique maps/sets. + template + struct _Node_insert_return + { + _Iterator position = _Iterator(); + bool inserted = false; + _NodeHandle node; + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // C++17 +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/ostream_insert.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/ostream_insert.h new file mode 100644 index 0000000..8c9b941 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/ostream_insert.h @@ -0,0 +1,129 @@ +// Helpers for ostream inserters -*- C++ -*- + +// Copyright (C) 2007-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/ostream_insert.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{ostream} + */ + +#ifndef _OSTREAM_INSERT_H +#define _OSTREAM_INSERT_H 1 + +#pragma GCC system_header + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + inline void + __ostream_write(basic_ostream<_CharT, _Traits>& __out, + const _CharT* __s, streamsize __n) + { + typedef basic_ostream<_CharT, _Traits> __ostream_type; + typedef typename __ostream_type::ios_base __ios_base; + + const streamsize __put = __out.rdbuf()->sputn(__s, __n); + if (__put != __n) + __out.setstate(__ios_base::badbit); + } + + template + inline void + __ostream_fill(basic_ostream<_CharT, _Traits>& __out, streamsize __n) + { + typedef basic_ostream<_CharT, _Traits> __ostream_type; + typedef typename __ostream_type::ios_base __ios_base; + + const _CharT __c = __out.fill(); + for (; __n > 0; --__n) + { + const typename _Traits::int_type __put = __out.rdbuf()->sputc(__c); + if (_Traits::eq_int_type(__put, _Traits::eof())) + { + __out.setstate(__ios_base::badbit); + break; + } + } + } + + template + basic_ostream<_CharT, _Traits>& + __ostream_insert(basic_ostream<_CharT, _Traits>& __out, + const _CharT* __s, streamsize __n) + { + typedef basic_ostream<_CharT, _Traits> __ostream_type; + typedef typename __ostream_type::ios_base __ios_base; + + typename __ostream_type::sentry __cerb(__out); + if (__cerb) + { + __try + { + const streamsize __w = __out.width(); + if (__w > __n) + { + const bool __left = ((__out.flags() + & __ios_base::adjustfield) + == __ios_base::left); + if (!__left) + __ostream_fill(__out, __w - __n); + if (__out.good()) + __ostream_write(__out, __s, __n); + if (__left && __out.good()) + __ostream_fill(__out, __w - __n); + } + else + __ostream_write(__out, __s, __n); + __out.width(0); + } + __catch(__cxxabiv1::__forced_unwind&) + { + __out._M_setstate(__ios_base::badbit); + __throw_exception_again; + } + __catch(...) + { __out._M_setstate(__ios_base::badbit); } + } + return __out; + } + + // Inhibit implicit instantiations for required instantiations, + // which are defined via explicit instantiations elsewhere. +#if _GLIBCXX_EXTERN_TEMPLATE + extern template ostream& __ostream_insert(ostream&, const char*, streamsize); + +#ifdef _GLIBCXX_USE_WCHAR_T + extern template wostream& __ostream_insert(wostream&, const wchar_t*, + streamsize); +#endif +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif /* _OSTREAM_INSERT_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/parse_numbers.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/parse_numbers.h new file mode 100644 index 0000000..b82df75 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/parse_numbers.h @@ -0,0 +1,288 @@ +// Components for compile-time parsing of numbers -*- C++ -*- + +// Copyright (C) 2013-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/parse_numbers.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{chrono} + */ + +#ifndef _GLIBCXX_PARSE_NUMBERS_H +#define _GLIBCXX_PARSE_NUMBERS_H 1 + +#pragma GCC system_header + +// From n3642.pdf except I added binary literals and digit separator '\''. + +#if __cplusplus > 201103L + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +namespace __parse_int +{ + template + struct _Digit; + + template + struct _Digit<_Base, '0'> : integral_constant + { + using __valid = true_type; + }; + + template + struct _Digit<_Base, '1'> : integral_constant + { + using __valid = true_type; + }; + + template + struct _Digit_impl : integral_constant + { + static_assert(_Base > _Val, "invalid digit"); + using __valid = true_type; + }; + + template + struct _Digit<_Base, '2'> : _Digit_impl<_Base, 2> + { }; + + template + struct _Digit<_Base, '3'> : _Digit_impl<_Base, 3> + { }; + + template + struct _Digit<_Base, '4'> : _Digit_impl<_Base, 4> + { }; + + template + struct _Digit<_Base, '5'> : _Digit_impl<_Base, 5> + { }; + + template + struct _Digit<_Base, '6'> : _Digit_impl<_Base, 6> + { }; + + template + struct _Digit<_Base, '7'> : _Digit_impl<_Base, 7> + { }; + + template + struct _Digit<_Base, '8'> : _Digit_impl<_Base, 8> + { }; + + template + struct _Digit<_Base, '9'> : _Digit_impl<_Base, 9> + { }; + + template + struct _Digit<_Base, 'a'> : _Digit_impl<_Base, 0xa> + { }; + + template + struct _Digit<_Base, 'A'> : _Digit_impl<_Base, 0xa> + { }; + + template + struct _Digit<_Base, 'b'> : _Digit_impl<_Base, 0xb> + { }; + + template + struct _Digit<_Base, 'B'> : _Digit_impl<_Base, 0xb> + { }; + + template + struct _Digit<_Base, 'c'> : _Digit_impl<_Base, 0xc> + { }; + + template + struct _Digit<_Base, 'C'> : _Digit_impl<_Base, 0xc> + { }; + + template + struct _Digit<_Base, 'd'> : _Digit_impl<_Base, 0xd> + { }; + + template + struct _Digit<_Base, 'D'> : _Digit_impl<_Base, 0xd> + { }; + + template + struct _Digit<_Base, 'e'> : _Digit_impl<_Base, 0xe> + { }; + + template + struct _Digit<_Base, 'E'> : _Digit_impl<_Base, 0xe> + { }; + + template + struct _Digit<_Base, 'f'> : _Digit_impl<_Base, 0xf> + { }; + + template + struct _Digit<_Base, 'F'> : _Digit_impl<_Base, 0xf> + { }; + + // Digit separator + template + struct _Digit<_Base, '\''> : integral_constant + { + using __valid = false_type; + }; + +//------------------------------------------------------------------------------ + + template + using __ull_constant = integral_constant; + + template + struct _Power_help + { + using __next = typename _Power_help<_Base, _Digs...>::type; + using __valid_digit = typename _Digit<_Base, _Dig>::__valid; + using type + = __ull_constant<__next::value * (__valid_digit{} ? _Base : 1ULL)>; + }; + + template + struct _Power_help<_Base, _Dig> + { + using __valid_digit = typename _Digit<_Base, _Dig>::__valid; + using type = __ull_constant<__valid_digit::value>; + }; + + template + struct _Power : _Power_help<_Base, _Digs...>::type + { }; + + template + struct _Power<_Base> : __ull_constant<0> + { }; + +//------------------------------------------------------------------------------ + + template + struct _Number_help + { + using __digit = _Digit<_Base, _Dig>; + using __valid_digit = typename __digit::__valid; + using __next = _Number_help<_Base, + __valid_digit::value ? _Pow / _Base : _Pow, + _Digs...>; + using type = __ull_constant<_Pow * __digit::value + __next::type::value>; + static_assert((type::value / _Pow) == __digit::value, + "integer literal does not fit in unsigned long long"); + }; + + template + struct _Number_help<_Base, _Pow, _Dig> + { + //static_assert(_Pow == 1U, "power should be one"); + using type = __ull_constant<_Digit<_Base, _Dig>::value>; + }; + + template + struct _Number + : _Number_help<_Base, _Power<_Base, _Digs...>::value, _Digs...>::type + { }; + + template + struct _Number<_Base> + : __ull_constant<0> + { }; + +//------------------------------------------------------------------------------ + + template + struct _Parse_int; + + template + struct _Parse_int<'0', 'b', _Digs...> + : _Number<2U, _Digs...>::type + { }; + + template + struct _Parse_int<'0', 'B', _Digs...> + : _Number<2U, _Digs...>::type + { }; + + template + struct _Parse_int<'0', 'x', _Digs...> + : _Number<16U, _Digs...>::type + { }; + + template + struct _Parse_int<'0', 'X', _Digs...> + : _Number<16U, _Digs...>::type + { }; + + template + struct _Parse_int<'0', _Digs...> + : _Number<8U, _Digs...>::type + { }; + + template + struct _Parse_int + : _Number<10U, _Digs...>::type + { }; + +} // namespace __parse_int + + +namespace __select_int +{ + template + struct _Select_int_base; + + template + struct _Select_int_base<_Val, _IntType, _Ints...> + : conditional_t<(_Val <= std::numeric_limits<_IntType>::max()), + integral_constant<_IntType, _Val>, + _Select_int_base<_Val, _Ints...>> + { }; + + template + struct _Select_int_base<_Val> + { }; + + template + using _Select_int = typename _Select_int_base< + __parse_int::_Parse_int<_Digs...>::value, + unsigned char, + unsigned short, + unsigned int, + unsigned long, + unsigned long long + >::type; + +} // namespace __select_int + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // __cplusplus > 201103L + +#endif // _GLIBCXX_PARSE_NUMBERS_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/postypes.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/postypes.h new file mode 100644 index 0000000..8180863 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/postypes.h @@ -0,0 +1,242 @@ +// Position types -*- C++ -*- + +// Copyright (C) 1997-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/postypes.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iosfwd} + */ + +// +// ISO C++ 14882: 27.4.1 - Types +// ISO C++ 14882: 27.4.3 - Template class fpos +// + +#ifndef _GLIBCXX_POSTYPES_H +#define _GLIBCXX_POSTYPES_H 1 + +#pragma GCC system_header + +#include // For mbstate_t + +// XXX If is really needed, make sure to define the macros +// before including it, in order not to break (and +// in C++11). Reconsider all this as soon as possible... +#if (defined(_GLIBCXX_HAVE_INT64_T) && !defined(_GLIBCXX_HAVE_INT64_T_LONG) \ + && !defined(_GLIBCXX_HAVE_INT64_T_LONG_LONG)) + +#ifndef __STDC_LIMIT_MACROS +# define _UNDEF__STDC_LIMIT_MACROS +# define __STDC_LIMIT_MACROS +#endif +#ifndef __STDC_CONSTANT_MACROS +# define _UNDEF__STDC_CONSTANT_MACROS +# define __STDC_CONSTANT_MACROS +#endif +#include // For int64_t +#ifdef _UNDEF__STDC_LIMIT_MACROS +# undef __STDC_LIMIT_MACROS +# undef _UNDEF__STDC_LIMIT_MACROS +#endif +#ifdef _UNDEF__STDC_CONSTANT_MACROS +# undef __STDC_CONSTANT_MACROS +# undef _UNDEF__STDC_CONSTANT_MACROS +#endif + +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // The types streamoff, streampos and wstreampos and the class + // template fpos<> are described in clauses 21.1.2, 21.1.3, 27.1.2, + // 27.2, 27.4.1, 27.4.3 and D.6. Despite all this verbiage, the + // behaviour of these types is mostly implementation defined or + // unspecified. The behaviour in this implementation is as noted + // below. + + /** + * @brief Type used by fpos, char_traits, and char_traits. + * + * In clauses 21.1.3.1 and 27.4.1 streamoff is described as an + * implementation defined type. + * Note: In versions of GCC up to and including GCC 3.3, streamoff + * was typedef long. + */ +#ifdef _GLIBCXX_HAVE_INT64_T_LONG + typedef long streamoff; +#elif defined(_GLIBCXX_HAVE_INT64_T_LONG_LONG) + typedef long long streamoff; +#elif defined(_GLIBCXX_HAVE_INT64_T) + typedef int64_t streamoff; +#else + typedef long long streamoff; +#endif + + /// Integral type for I/O operation counts and buffer sizes. + typedef ptrdiff_t streamsize; // Signed integral type + + /** + * @brief Class representing stream positions. + * + * The standard places no requirements upon the template parameter StateT. + * In this implementation StateT must be DefaultConstructible, + * CopyConstructible and Assignable. The standard only requires that fpos + * should contain a member of type StateT. In this implementation it also + * contains an offset stored as a signed integer. + * + * @param StateT Type passed to and returned from state(). + */ + template + class fpos + { + private: + streamoff _M_off; + _StateT _M_state; + + public: + // The standard doesn't require that fpos objects can be default + // constructed. This implementation provides a default + // constructor that initializes the offset to 0 and default + // constructs the state. + fpos() + : _M_off(0), _M_state() { } + + // The standard requires that fpos objects can be constructed + // from streamoff objects using the constructor syntax, and + // fails to give any meaningful semantics. In this + // implementation implicit conversion is also allowed, and this + // constructor stores the streamoff as the offset and default + // constructs the state. + /// Construct position from offset. + fpos(streamoff __off) + : _M_off(__off), _M_state() { } + + /// Convert to streamoff. + operator streamoff() const { return _M_off; } + + /// Remember the value of @a st. + void + state(_StateT __st) + { _M_state = __st; } + + /// Return the last set value of @a st. + _StateT + state() const + { return _M_state; } + + // The standard requires that this operator must be defined, but + // gives no semantics. In this implementation it just adds its + // argument to the stored offset and returns *this. + /// Add offset to this position. + fpos& + operator+=(streamoff __off) + { + _M_off += __off; + return *this; + } + + // The standard requires that this operator must be defined, but + // gives no semantics. In this implementation it just subtracts + // its argument from the stored offset and returns *this. + /// Subtract offset from this position. + fpos& + operator-=(streamoff __off) + { + _M_off -= __off; + return *this; + } + + // The standard requires that this operator must be defined, but + // defines its semantics only in terms of operator-. In this + // implementation it constructs a copy of *this, adds the + // argument to that copy using operator+= and then returns the + // copy. + /// Add position and offset. + fpos + operator+(streamoff __off) const + { + fpos __pos(*this); + __pos += __off; + return __pos; + } + + // The standard requires that this operator must be defined, but + // defines its semantics only in terms of operator+. In this + // implementation it constructs a copy of *this, subtracts the + // argument from that copy using operator-= and then returns the + // copy. + /// Subtract offset from position. + fpos + operator-(streamoff __off) const + { + fpos __pos(*this); + __pos -= __off; + return __pos; + } + + // The standard requires that this operator must be defined, but + // defines its semantics only in terms of operator+. In this + // implementation it returns the difference between the offset + // stored in *this and in the argument. + /// Subtract position to return offset. + streamoff + operator-(const fpos& __other) const + { return _M_off - __other._M_off; } + }; + + // The standard only requires that operator== must be an + // equivalence relation. In this implementation two fpos + // objects belong to the same equivalence class if the contained + // offsets compare equal. + /// Test if equivalent to another position. + template + inline bool + operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) + { return streamoff(__lhs) == streamoff(__rhs); } + + template + inline bool + operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) + { return streamoff(__lhs) != streamoff(__rhs); } + + // Clauses 21.1.3.1 and 21.1.3.2 describe streampos and wstreampos + // as implementation defined types, but clause 27.2 requires that + // they must both be typedefs for fpos + /// File position for char streams. + typedef fpos streampos; + /// File position for wchar_t streams. + typedef fpos wstreampos; + +#if __cplusplus >= 201103L + /// File position for char16_t streams. + typedef fpos u16streampos; + /// File position for char32_t streams. + typedef fpos u32streampos; +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/predefined_ops.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/predefined_ops.h new file mode 100644 index 0000000..0624a38 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/predefined_ops.h @@ -0,0 +1,362 @@ +// Default predicates for internal use -*- C++ -*- + +// Copyright (C) 2013-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file predefined_ops.h + * This is an internal header file, included by other library headers. + * You should not attempt to use it directly. @headername{algorithm} + */ + +#ifndef _GLIBCXX_PREDEFINED_OPS_H +#define _GLIBCXX_PREDEFINED_OPS_H 1 + +namespace __gnu_cxx +{ +namespace __ops +{ + struct _Iter_less_iter + { + template + _GLIBCXX14_CONSTEXPR + bool + operator()(_Iterator1 __it1, _Iterator2 __it2) const + { return *__it1 < *__it2; } + }; + + _GLIBCXX14_CONSTEXPR + inline _Iter_less_iter + __iter_less_iter() + { return _Iter_less_iter(); } + + struct _Iter_less_val + { +#if __cplusplus >= 201103L + constexpr _Iter_less_val() = default; +#else + _Iter_less_val() { } +#endif + + explicit + _Iter_less_val(_Iter_less_iter) { } + + template + bool + operator()(_Iterator __it, _Value& __val) const + { return *__it < __val; } + }; + + inline _Iter_less_val + __iter_less_val() + { return _Iter_less_val(); } + + inline _Iter_less_val + __iter_comp_val(_Iter_less_iter) + { return _Iter_less_val(); } + + struct _Val_less_iter + { +#if __cplusplus >= 201103L + constexpr _Val_less_iter() = default; +#else + _Val_less_iter() { } +#endif + + explicit + _Val_less_iter(_Iter_less_iter) { } + + template + bool + operator()(_Value& __val, _Iterator __it) const + { return __val < *__it; } + }; + + inline _Val_less_iter + __val_less_iter() + { return _Val_less_iter(); } + + inline _Val_less_iter + __val_comp_iter(_Iter_less_iter) + { return _Val_less_iter(); } + + struct _Iter_equal_to_iter + { + template + bool + operator()(_Iterator1 __it1, _Iterator2 __it2) const + { return *__it1 == *__it2; } + }; + + inline _Iter_equal_to_iter + __iter_equal_to_iter() + { return _Iter_equal_to_iter(); } + + struct _Iter_equal_to_val + { + template + bool + operator()(_Iterator __it, _Value& __val) const + { return *__it == __val; } + }; + + inline _Iter_equal_to_val + __iter_equal_to_val() + { return _Iter_equal_to_val(); } + + inline _Iter_equal_to_val + __iter_comp_val(_Iter_equal_to_iter) + { return _Iter_equal_to_val(); } + + template + struct _Iter_comp_iter + { + _Compare _M_comp; + + explicit _GLIBCXX14_CONSTEXPR + _Iter_comp_iter(_Compare __comp) + : _M_comp(_GLIBCXX_MOVE(__comp)) + { } + + template + _GLIBCXX14_CONSTEXPR + bool + operator()(_Iterator1 __it1, _Iterator2 __it2) + { return bool(_M_comp(*__it1, *__it2)); } + }; + + template + _GLIBCXX14_CONSTEXPR + inline _Iter_comp_iter<_Compare> + __iter_comp_iter(_Compare __comp) + { return _Iter_comp_iter<_Compare>(_GLIBCXX_MOVE(__comp)); } + + template + struct _Iter_comp_val + { + _Compare _M_comp; + + explicit + _Iter_comp_val(_Compare __comp) + : _M_comp(_GLIBCXX_MOVE(__comp)) + { } + + explicit + _Iter_comp_val(const _Iter_comp_iter<_Compare>& __comp) + : _M_comp(__comp._M_comp) + { } + +#if __cplusplus >= 201103L + explicit + _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp) + : _M_comp(std::move(__comp._M_comp)) + { } +#endif + + template + bool + operator()(_Iterator __it, _Value& __val) + { return bool(_M_comp(*__it, __val)); } + }; + + template + inline _Iter_comp_val<_Compare> + __iter_comp_val(_Compare __comp) + { return _Iter_comp_val<_Compare>(_GLIBCXX_MOVE(__comp)); } + + template + inline _Iter_comp_val<_Compare> + __iter_comp_val(_Iter_comp_iter<_Compare> __comp) + { return _Iter_comp_val<_Compare>(_GLIBCXX_MOVE(__comp)); } + + template + struct _Val_comp_iter + { + _Compare _M_comp; + + explicit + _Val_comp_iter(_Compare __comp) + : _M_comp(_GLIBCXX_MOVE(__comp)) + { } + + explicit + _Val_comp_iter(const _Iter_comp_iter<_Compare>& __comp) + : _M_comp(__comp._M_comp) + { } + +#if __cplusplus >= 201103L + explicit + _Val_comp_iter(_Iter_comp_iter<_Compare>&& __comp) + : _M_comp(std::move(__comp._M_comp)) + { } +#endif + + template + bool + operator()(_Value& __val, _Iterator __it) + { return bool(_M_comp(__val, *__it)); } + }; + + template + inline _Val_comp_iter<_Compare> + __val_comp_iter(_Compare __comp) + { return _Val_comp_iter<_Compare>(_GLIBCXX_MOVE(__comp)); } + + template + inline _Val_comp_iter<_Compare> + __val_comp_iter(_Iter_comp_iter<_Compare> __comp) + { return _Val_comp_iter<_Compare>(_GLIBCXX_MOVE(__comp)); } + + template + struct _Iter_equals_val + { + _Value& _M_value; + + explicit + _Iter_equals_val(_Value& __value) + : _M_value(__value) + { } + + template + bool + operator()(_Iterator __it) + { return *__it == _M_value; } + }; + + template + inline _Iter_equals_val<_Value> + __iter_equals_val(_Value& __val) + { return _Iter_equals_val<_Value>(__val); } + + template + struct _Iter_equals_iter + { + _Iterator1 _M_it1; + + explicit + _Iter_equals_iter(_Iterator1 __it1) + : _M_it1(__it1) + { } + + template + bool + operator()(_Iterator2 __it2) + { return *__it2 == *_M_it1; } + }; + + template + inline _Iter_equals_iter<_Iterator> + __iter_comp_iter(_Iter_equal_to_iter, _Iterator __it) + { return _Iter_equals_iter<_Iterator>(__it); } + + template + struct _Iter_pred + { + _Predicate _M_pred; + + explicit + _Iter_pred(_Predicate __pred) + : _M_pred(_GLIBCXX_MOVE(__pred)) + { } + + template + bool + operator()(_Iterator __it) + { return bool(_M_pred(*__it)); } + }; + + template + inline _Iter_pred<_Predicate> + __pred_iter(_Predicate __pred) + { return _Iter_pred<_Predicate>(_GLIBCXX_MOVE(__pred)); } + + template + struct _Iter_comp_to_val + { + _Compare _M_comp; + _Value& _M_value; + + _Iter_comp_to_val(_Compare __comp, _Value& __value) + : _M_comp(_GLIBCXX_MOVE(__comp)), _M_value(__value) + { } + + template + bool + operator()(_Iterator __it) + { return bool(_M_comp(*__it, _M_value)); } + }; + + template + _Iter_comp_to_val<_Compare, _Value> + __iter_comp_val(_Compare __comp, _Value &__val) + { + return _Iter_comp_to_val<_Compare, _Value>(_GLIBCXX_MOVE(__comp), __val); + } + + template + struct _Iter_comp_to_iter + { + _Compare _M_comp; + _Iterator1 _M_it1; + + _Iter_comp_to_iter(_Compare __comp, _Iterator1 __it1) + : _M_comp(_GLIBCXX_MOVE(__comp)), _M_it1(__it1) + { } + + template + bool + operator()(_Iterator2 __it2) + { return bool(_M_comp(*__it2, *_M_it1)); } + }; + + template + inline _Iter_comp_to_iter<_Compare, _Iterator> + __iter_comp_iter(_Iter_comp_iter<_Compare> __comp, _Iterator __it) + { + return _Iter_comp_to_iter<_Compare, _Iterator>( + _GLIBCXX_MOVE(__comp._M_comp), __it); + } + + template + struct _Iter_negate + { + _Predicate _M_pred; + + explicit + _Iter_negate(_Predicate __pred) + : _M_pred(_GLIBCXX_MOVE(__pred)) + { } + + template + bool + operator()(_Iterator __it) + { return !bool(_M_pred(*__it)); } + }; + + template + inline _Iter_negate<_Predicate> + __negate(_Iter_pred<_Predicate> __pred) + { return _Iter_negate<_Predicate>(_GLIBCXX_MOVE(__pred._M_pred)); } + +} // namespace __ops +} // namespace __gnu_cxx + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/ptr_traits.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/ptr_traits.h new file mode 100644 index 0000000..797e7fc --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/ptr_traits.h @@ -0,0 +1,154 @@ +// Pointer Traits -*- C++ -*- + +// Copyright (C) 2011-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/ptr_traits.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _PTR_TRAITS_H +#define _PTR_TRAITS_H 1 + +#if __cplusplus >= 201103L + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + class __undefined; + + // Given Template return T, otherwise invalid. + template + struct __get_first_arg + { using type = __undefined; }; + + template class _Template, typename _Tp, + typename... _Types> + struct __get_first_arg<_Template<_Tp, _Types...>> + { using type = _Tp; }; + + template + using __get_first_arg_t = typename __get_first_arg<_Tp>::type; + + // Given Template and U return Template, otherwise invalid. + template + struct __replace_first_arg + { }; + + template class _Template, typename _Up, + typename _Tp, typename... _Types> + struct __replace_first_arg<_Template<_Tp, _Types...>, _Up> + { using type = _Template<_Up, _Types...>; }; + + template + using __replace_first_arg_t = typename __replace_first_arg<_Tp, _Up>::type; + + template + using __make_not_void + = typename conditional::value, __undefined, _Tp>::type; + + /** + * @brief Uniform interface to all pointer-like types + * @ingroup pointer_abstractions + */ + template + struct pointer_traits + { + private: + template + using __element_type = typename _Tp::element_type; + + template + using __difference_type = typename _Tp::difference_type; + + template + struct __rebind : __replace_first_arg<_Tp, _Up> { }; + + template + struct __rebind<_Tp, _Up, __void_t>> + { using type = typename _Tp::template rebind<_Up>; }; + + public: + /// The pointer type. + using pointer = _Ptr; + + /// The type pointed to. + using element_type + = __detected_or_t<__get_first_arg_t<_Ptr>, __element_type, _Ptr>; + + /// The type used to represent the difference between two pointers. + using difference_type + = __detected_or_t; + + /// A pointer to a different type. + template + using rebind = typename __rebind<_Ptr, _Up>::type; + + static _Ptr + pointer_to(__make_not_void& __e) + { return _Ptr::pointer_to(__e); } + + static_assert(!is_same::value, + "pointer type defines element_type or is like SomePointer"); + }; + + /** + * @brief Partial specialization for built-in pointers. + * @ingroup pointer_abstractions + */ + template + struct pointer_traits<_Tp*> + { + /// The pointer type + typedef _Tp* pointer; + /// The type pointed to + typedef _Tp element_type; + /// Type used to represent the difference between two pointers + typedef ptrdiff_t difference_type; + + template + using rebind = _Up*; + + /** + * @brief Obtain a pointer to an object + * @param __r A reference to an object of type @c element_type + * @return @c addressof(__r) + */ + static pointer + pointer_to(__make_not_void& __r) noexcept + { return std::addressof(__r); } + }; + + /// Convenience alias for rebinding pointers. + template + using __ptr_rebind = typename pointer_traits<_Ptr>::template rebind<_Tp>; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/quoted_string.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/quoted_string.h new file mode 100644 index 0000000..10cfec2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/quoted_string.h @@ -0,0 +1,164 @@ +// Helpers for quoted stream manipulators -*- C++ -*- + +// Copyright (C) 2013-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/quoted_string.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iomanip} + */ + +#ifndef _GLIBCXX_QUOTED_STRING_H +#define _GLIBCXX_QUOTED_STRING_H 1 + +#pragma GCC system_header + +#if __cplusplus < 201103L +# include +#else +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ + namespace __detail { + _GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @brief Struct for delimited strings. + */ + template + struct _Quoted_string + { + static_assert(is_reference<_String>::value + || is_pointer<_String>::value, + "String type must be pointer or reference"); + + _Quoted_string(_String __str, _CharT __del, _CharT __esc) + : _M_string(__str), _M_delim{__del}, _M_escape{__esc} + { } + + _Quoted_string& + operator=(_Quoted_string&) = delete; + + _String _M_string; + _CharT _M_delim; + _CharT _M_escape; + }; + + /** + * @brief Inserter for quoted strings. + * + * _GLIBCXX_RESOLVE_LIB_DEFECTS + * DR 2344 quoted()'s interaction with padding is unclear + */ + template + std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const _Quoted_string& __str) + { + std::basic_ostringstream<_CharT, _Traits> __ostr; + __ostr << __str._M_delim; + for (const _CharT* __c = __str._M_string; *__c; ++__c) + { + if (*__c == __str._M_delim || *__c == __str._M_escape) + __ostr << __str._M_escape; + __ostr << *__c; + } + __ostr << __str._M_delim; + + return __os << __ostr.str(); + } + + /** + * @brief Inserter for quoted strings. + * + * _GLIBCXX_RESOLVE_LIB_DEFECTS + * DR 2344 quoted()'s interaction with padding is unclear + */ + template + std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const _Quoted_string<_String, _CharT>& __str) + { + std::basic_ostringstream<_CharT, _Traits> __ostr; + __ostr << __str._M_delim; + for (auto& __c : __str._M_string) + { + if (__c == __str._M_delim || __c == __str._M_escape) + __ostr << __str._M_escape; + __ostr << __c; + } + __ostr << __str._M_delim; + + return __os << __ostr.str(); + } + + /** + * @brief Extractor for delimited strings. + * The left and right delimiters can be different. + */ + template + std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + const _Quoted_string&, + _CharT>& __str) + { + _CharT __c; + __is >> __c; + if (!__is.good()) + return __is; + if (__c != __str._M_delim) + { + __is.unget(); + __is >> __str._M_string; + return __is; + } + __str._M_string.clear(); + std::ios_base::fmtflags __flags + = __is.flags(__is.flags() & ~std::ios_base::skipws); + do + { + __is >> __c; + if (!__is.good()) + break; + if (__c == __str._M_escape) + { + __is >> __c; + if (!__is.good()) + break; + } + else if (__c == __str._M_delim) + break; + __str._M_string += __c; + } + while (true); + __is.setf(__flags); + + return __is; + } + + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace __detail +} // namespace std + +#endif // C++11 +#endif /* _GLIBCXX_QUOTED_STRING_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/random.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/random.h new file mode 100644 index 0000000..d39cc3e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/random.h @@ -0,0 +1,6000 @@ +// random number generation -*- C++ -*- + +// Copyright (C) 2009-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** + * @file bits/random.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{random} + */ + +#ifndef _RANDOM_H +#define _RANDOM_H 1 + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // [26.4] Random number generation + + /** + * @defgroup random Random Number Generation + * @ingroup numerics + * + * A facility for generating random numbers on selected distributions. + * @{ + */ + + /** + * @brief A function template for converting the output of a (integral) + * uniform random number generator to a floatng point result in the range + * [0-1). + */ + template + _RealType + generate_canonical(_UniformRandomNumberGenerator& __g); + +_GLIBCXX_END_NAMESPACE_VERSION + + /* + * Implementation-space details. + */ + namespace __detail + { + _GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + (std::numeric_limits<_UIntType>::digits)> + struct _Shift + { static const _UIntType __value = 0; }; + + template + struct _Shift<_UIntType, __w, true> + { static const _UIntType __value = _UIntType(1) << __w; }; + + template + struct _Select_uint_least_t + { + static_assert(__which < 0, /* needs to be dependent */ + "sorry, would be too much trouble for a slow result"); + }; + + template + struct _Select_uint_least_t<__s, 4> + { typedef unsigned int type; }; + + template + struct _Select_uint_least_t<__s, 3> + { typedef unsigned long type; }; + + template + struct _Select_uint_least_t<__s, 2> + { typedef unsigned long long type; }; + +#ifdef _GLIBCXX_USE_INT128 + template + struct _Select_uint_least_t<__s, 1> + { typedef unsigned __int128 type; }; +#endif + + // Assume a != 0, a < m, c < m, x < m. + template= __m - 1), + bool __schrage_ok = __m % __a < __m / __a> + struct _Mod + { + typedef typename _Select_uint_least_t::type _Tp2; + static _Tp + __calc(_Tp __x) + { return static_cast<_Tp>((_Tp2(__a) * __x + __c) % __m); } + }; + + // Schrage. + template + struct _Mod<_Tp, __m, __a, __c, false, true> + { + static _Tp + __calc(_Tp __x); + }; + + // Special cases: + // - for m == 2^n or m == 0, unsigned integer overflow is safe. + // - a * (m - 1) + c fits in _Tp, there is no overflow. + template + struct _Mod<_Tp, __m, __a, __c, true, __s> + { + static _Tp + __calc(_Tp __x) + { + _Tp __res = __a * __x + __c; + if (__m) + __res %= __m; + return __res; + } + }; + + template + inline _Tp + __mod(_Tp __x) + { return _Mod<_Tp, __m, __a, __c>::__calc(__x); } + + /* + * An adaptor class for converting the output of any Generator into + * the input for a specific Distribution. + */ + template + struct _Adaptor + { + static_assert(std::is_floating_point<_DInputType>::value, + "template argument must be a floating point type"); + + public: + _Adaptor(_Engine& __g) + : _M_g(__g) { } + + _DInputType + min() const + { return _DInputType(0); } + + _DInputType + max() const + { return _DInputType(1); } + + /* + * Converts a value generated by the adapted random number generator + * into a value in the input domain for the dependent random number + * distribution. + */ + _DInputType + operator()() + { + return std::generate_canonical<_DInputType, + std::numeric_limits<_DInputType>::digits, + _Engine>(_M_g); + } + + private: + _Engine& _M_g; + }; + + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace __detail + +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup random_generators Random Number Generators + * @ingroup random + * + * These classes define objects which provide random or pseudorandom + * numbers, either from a discrete or a continuous interval. The + * random number generator supplied as a part of this library are + * all uniform random number generators which provide a sequence of + * random number uniformly distributed over their range. + * + * A number generator is a function object with an operator() that + * takes zero arguments and returns a number. + * + * A compliant random number generator must satisfy the following + * requirements. + * + *
Random Number Generator Requirements
To be documented.
+ * + * @{ + */ + + /** + * @brief A model of a linear congruential random number generator. + * + * A random number generator that produces pseudorandom numbers via + * linear function: + * @f[ + * x_{i+1}\leftarrow(ax_{i} + c) \bmod m + * @f] + * + * The template parameter @p _UIntType must be an unsigned integral type + * large enough to store values up to (__m-1). If the template parameter + * @p __m is 0, the modulus @p __m used is + * std::numeric_limits<_UIntType>::max() plus 1. Otherwise, the template + * parameters @p __a and @p __c must be less than @p __m. + * + * The size of the state is @f$1@f$. + */ + template + class linear_congruential_engine + { + static_assert(std::is_unsigned<_UIntType>::value, + "result_type must be an unsigned integral type"); + static_assert(__m == 0u || (__a < __m && __c < __m), + "template argument substituting __m out of bounds"); + + public: + /** The type of the generated random value. */ + typedef _UIntType result_type; + + /** The multiplier. */ + static constexpr result_type multiplier = __a; + /** An increment. */ + static constexpr result_type increment = __c; + /** The modulus. */ + static constexpr result_type modulus = __m; + static constexpr result_type default_seed = 1u; + + /** + * @brief Constructs a %linear_congruential_engine random number + * generator engine with seed @p __s. The default seed value + * is 1. + * + * @param __s The initial seed value. + */ + explicit + linear_congruential_engine(result_type __s = default_seed) + { seed(__s); } + + /** + * @brief Constructs a %linear_congruential_engine random number + * generator engine seeded from the seed sequence @p __q. + * + * @param __q the seed sequence. + */ + template::value> + ::type> + explicit + linear_congruential_engine(_Sseq& __q) + { seed(__q); } + + /** + * @brief Reseeds the %linear_congruential_engine random number generator + * engine sequence to the seed @p __s. + * + * @param __s The new seed. + */ + void + seed(result_type __s = default_seed); + + /** + * @brief Reseeds the %linear_congruential_engine random number generator + * engine + * sequence using values from the seed sequence @p __q. + * + * @param __q the seed sequence. + */ + template + typename std::enable_if::value>::type + seed(_Sseq& __q); + + /** + * @brief Gets the smallest possible value in the output range. + * + * The minimum depends on the @p __c parameter: if it is zero, the + * minimum generated must be > 0, otherwise 0 is allowed. + */ + static constexpr result_type + min() + { return __c == 0u ? 1u : 0u; } + + /** + * @brief Gets the largest possible value in the output range. + */ + static constexpr result_type + max() + { return __m - 1u; } + + /** + * @brief Discard a sequence of random numbers. + */ + void + discard(unsigned long long __z) + { + for (; __z != 0ULL; --__z) + (*this)(); + } + + /** + * @brief Gets the next random number in the sequence. + */ + result_type + operator()() + { + _M_x = __detail::__mod<_UIntType, __m, __a, __c>(_M_x); + return _M_x; + } + + /** + * @brief Compares two linear congruential random number generator + * objects of the same type for equality. + * + * @param __lhs A linear congruential random number generator object. + * @param __rhs Another linear congruential random number generator + * object. + * + * @returns true if the infinite sequences of generated values + * would be equal, false otherwise. + */ + friend bool + operator==(const linear_congruential_engine& __lhs, + const linear_congruential_engine& __rhs) + { return __lhs._M_x == __rhs._M_x; } + + /** + * @brief Writes the textual representation of the state x(i) of x to + * @p __os. + * + * @param __os The output stream. + * @param __lcr A % linear_congruential_engine random number generator. + * @returns __os. + */ + template + friend std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::linear_congruential_engine<_UIntType1, + __a1, __c1, __m1>& __lcr); + + /** + * @brief Sets the state of the engine by reading its textual + * representation from @p __is. + * + * The textual representation must have been previously written using + * an output stream whose imbued locale and whose type's template + * specialization arguments _CharT and _Traits were the same as those + * of @p __is. + * + * @param __is The input stream. + * @param __lcr A % linear_congruential_engine random number generator. + * @returns __is. + */ + template + friend std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::linear_congruential_engine<_UIntType1, __a1, + __c1, __m1>& __lcr); + + private: + _UIntType _M_x; + }; + + /** + * @brief Compares two linear congruential random number generator + * objects of the same type for inequality. + * + * @param __lhs A linear congruential random number generator object. + * @param __rhs Another linear congruential random number generator + * object. + * + * @returns true if the infinite sequences of generated values + * would be different, false otherwise. + */ + template + inline bool + operator!=(const std::linear_congruential_engine<_UIntType, __a, + __c, __m>& __lhs, + const std::linear_congruential_engine<_UIntType, __a, + __c, __m>& __rhs) + { return !(__lhs == __rhs); } + + + /** + * A generalized feedback shift register discrete random number generator. + * + * This algorithm avoids multiplication and division and is designed to be + * friendly to a pipelined architecture. If the parameters are chosen + * correctly, this generator will produce numbers with a very long period and + * fairly good apparent entropy, although still not cryptographically strong. + * + * The best way to use this generator is with the predefined mt19937 class. + * + * This algorithm was originally invented by Makoto Matsumoto and + * Takuji Nishimura. + * + * @tparam __w Word size, the number of bits in each element of + * the state vector. + * @tparam __n The degree of recursion. + * @tparam __m The period parameter. + * @tparam __r The separation point bit index. + * @tparam __a The last row of the twist matrix. + * @tparam __u The first right-shift tempering matrix parameter. + * @tparam __d The first right-shift tempering matrix mask. + * @tparam __s The first left-shift tempering matrix parameter. + * @tparam __b The first left-shift tempering matrix mask. + * @tparam __t The second left-shift tempering matrix parameter. + * @tparam __c The second left-shift tempering matrix mask. + * @tparam __l The second right-shift tempering matrix parameter. + * @tparam __f Initialization multiplier. + */ + template + class mersenne_twister_engine + { + static_assert(std::is_unsigned<_UIntType>::value, + "result_type must be an unsigned integral type"); + static_assert(1u <= __m && __m <= __n, + "template argument substituting __m out of bounds"); + static_assert(__r <= __w, "template argument substituting " + "__r out of bound"); + static_assert(__u <= __w, "template argument substituting " + "__u out of bound"); + static_assert(__s <= __w, "template argument substituting " + "__s out of bound"); + static_assert(__t <= __w, "template argument substituting " + "__t out of bound"); + static_assert(__l <= __w, "template argument substituting " + "__l out of bound"); + static_assert(__w <= std::numeric_limits<_UIntType>::digits, + "template argument substituting __w out of bound"); + static_assert(__a <= (__detail::_Shift<_UIntType, __w>::__value - 1), + "template argument substituting __a out of bound"); + static_assert(__b <= (__detail::_Shift<_UIntType, __w>::__value - 1), + "template argument substituting __b out of bound"); + static_assert(__c <= (__detail::_Shift<_UIntType, __w>::__value - 1), + "template argument substituting __c out of bound"); + static_assert(__d <= (__detail::_Shift<_UIntType, __w>::__value - 1), + "template argument substituting __d out of bound"); + static_assert(__f <= (__detail::_Shift<_UIntType, __w>::__value - 1), + "template argument substituting __f out of bound"); + + public: + /** The type of the generated random value. */ + typedef _UIntType result_type; + + // parameter values + static constexpr size_t word_size = __w; + static constexpr size_t state_size = __n; + static constexpr size_t shift_size = __m; + static constexpr size_t mask_bits = __r; + static constexpr result_type xor_mask = __a; + static constexpr size_t tempering_u = __u; + static constexpr result_type tempering_d = __d; + static constexpr size_t tempering_s = __s; + static constexpr result_type tempering_b = __b; + static constexpr size_t tempering_t = __t; + static constexpr result_type tempering_c = __c; + static constexpr size_t tempering_l = __l; + static constexpr result_type initialization_multiplier = __f; + static constexpr result_type default_seed = 5489u; + + // constructors and member function + explicit + mersenne_twister_engine(result_type __sd = default_seed) + { seed(__sd); } + + /** + * @brief Constructs a %mersenne_twister_engine random number generator + * engine seeded from the seed sequence @p __q. + * + * @param __q the seed sequence. + */ + template::value> + ::type> + explicit + mersenne_twister_engine(_Sseq& __q) + { seed(__q); } + + void + seed(result_type __sd = default_seed); + + template + typename std::enable_if::value>::type + seed(_Sseq& __q); + + /** + * @brief Gets the smallest possible value in the output range. + */ + static constexpr result_type + min() + { return 0; }; + + /** + * @brief Gets the largest possible value in the output range. + */ + static constexpr result_type + max() + { return __detail::_Shift<_UIntType, __w>::__value - 1; } + + /** + * @brief Discard a sequence of random numbers. + */ + void + discard(unsigned long long __z); + + result_type + operator()(); + + /** + * @brief Compares two % mersenne_twister_engine random number generator + * objects of the same type for equality. + * + * @param __lhs A % mersenne_twister_engine random number generator + * object. + * @param __rhs Another % mersenne_twister_engine random number + * generator object. + * + * @returns true if the infinite sequences of generated values + * would be equal, false otherwise. + */ + friend bool + operator==(const mersenne_twister_engine& __lhs, + const mersenne_twister_engine& __rhs) + { return (std::equal(__lhs._M_x, __lhs._M_x + state_size, __rhs._M_x) + && __lhs._M_p == __rhs._M_p); } + + /** + * @brief Inserts the current state of a % mersenne_twister_engine + * random number generator engine @p __x into the output stream + * @p __os. + * + * @param __os An output stream. + * @param __x A % mersenne_twister_engine random number generator + * engine. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + friend std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::mersenne_twister_engine<_UIntType1, __w1, __n1, + __m1, __r1, __a1, __u1, __d1, __s1, __b1, __t1, __c1, + __l1, __f1>& __x); + + /** + * @brief Extracts the current state of a % mersenne_twister_engine + * random number generator engine @p __x from the input stream + * @p __is. + * + * @param __is An input stream. + * @param __x A % mersenne_twister_engine random number generator + * engine. + * + * @returns The input stream with the state of @p __x extracted or in + * an error state. + */ + template + friend std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::mersenne_twister_engine<_UIntType1, __w1, __n1, __m1, + __r1, __a1, __u1, __d1, __s1, __b1, __t1, __c1, + __l1, __f1>& __x); + + private: + void _M_gen_rand(); + + _UIntType _M_x[state_size]; + size_t _M_p; + }; + + /** + * @brief Compares two % mersenne_twister_engine random number generator + * objects of the same type for inequality. + * + * @param __lhs A % mersenne_twister_engine random number generator + * object. + * @param __rhs Another % mersenne_twister_engine random number + * generator object. + * + * @returns true if the infinite sequences of generated values + * would be different, false otherwise. + */ + template + inline bool + operator!=(const std::mersenne_twister_engine<_UIntType, __w, __n, __m, + __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __lhs, + const std::mersenne_twister_engine<_UIntType, __w, __n, __m, + __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>& __rhs) + { return !(__lhs == __rhs); } + + + /** + * @brief The Marsaglia-Zaman generator. + * + * This is a model of a Generalized Fibonacci discrete random number + * generator, sometimes referred to as the SWC generator. + * + * A discrete random number generator that produces pseudorandom + * numbers using: + * @f[ + * x_{i}\leftarrow(x_{i - s} - x_{i - r} - carry_{i-1}) \bmod m + * @f] + * + * The size of the state is @f$r@f$ + * and the maximum period of the generator is @f$(m^r - m^s - 1)@f$. + */ + template + class subtract_with_carry_engine + { + static_assert(std::is_unsigned<_UIntType>::value, + "result_type must be an unsigned integral type"); + static_assert(0u < __s && __s < __r, + "0 < s < r"); + static_assert(0u < __w && __w <= std::numeric_limits<_UIntType>::digits, + "template argument substituting __w out of bounds"); + + public: + /** The type of the generated random value. */ + typedef _UIntType result_type; + + // parameter values + static constexpr size_t word_size = __w; + static constexpr size_t short_lag = __s; + static constexpr size_t long_lag = __r; + static constexpr result_type default_seed = 19780503u; + + /** + * @brief Constructs an explicitly seeded % subtract_with_carry_engine + * random number generator. + */ + explicit + subtract_with_carry_engine(result_type __sd = default_seed) + { seed(__sd); } + + /** + * @brief Constructs a %subtract_with_carry_engine random number engine + * seeded from the seed sequence @p __q. + * + * @param __q the seed sequence. + */ + template::value> + ::type> + explicit + subtract_with_carry_engine(_Sseq& __q) + { seed(__q); } + + /** + * @brief Seeds the initial state @f$x_0@f$ of the random number + * generator. + * + * N1688[4.19] modifies this as follows. If @p __value == 0, + * sets value to 19780503. In any case, with a linear + * congruential generator lcg(i) having parameters @f$ m_{lcg} = + * 2147483563, a_{lcg} = 40014, c_{lcg} = 0, and lcg(0) = value + * @f$, sets @f$ x_{-r} \dots x_{-1} @f$ to @f$ lcg(1) \bmod m + * \dots lcg(r) \bmod m @f$ respectively. If @f$ x_{-1} = 0 @f$ + * set carry to 1, otherwise sets carry to 0. + */ + void + seed(result_type __sd = default_seed); + + /** + * @brief Seeds the initial state @f$x_0@f$ of the + * % subtract_with_carry_engine random number generator. + */ + template + typename std::enable_if::value>::type + seed(_Sseq& __q); + + /** + * @brief Gets the inclusive minimum value of the range of random + * integers returned by this generator. + */ + static constexpr result_type + min() + { return 0; } + + /** + * @brief Gets the inclusive maximum value of the range of random + * integers returned by this generator. + */ + static constexpr result_type + max() + { return __detail::_Shift<_UIntType, __w>::__value - 1; } + + /** + * @brief Discard a sequence of random numbers. + */ + void + discard(unsigned long long __z) + { + for (; __z != 0ULL; --__z) + (*this)(); + } + + /** + * @brief Gets the next random number in the sequence. + */ + result_type + operator()(); + + /** + * @brief Compares two % subtract_with_carry_engine random number + * generator objects of the same type for equality. + * + * @param __lhs A % subtract_with_carry_engine random number generator + * object. + * @param __rhs Another % subtract_with_carry_engine random number + * generator object. + * + * @returns true if the infinite sequences of generated values + * would be equal, false otherwise. + */ + friend bool + operator==(const subtract_with_carry_engine& __lhs, + const subtract_with_carry_engine& __rhs) + { return (std::equal(__lhs._M_x, __lhs._M_x + long_lag, __rhs._M_x) + && __lhs._M_carry == __rhs._M_carry + && __lhs._M_p == __rhs._M_p); } + + /** + * @brief Inserts the current state of a % subtract_with_carry_engine + * random number generator engine @p __x into the output stream + * @p __os. + * + * @param __os An output stream. + * @param __x A % subtract_with_carry_engine random number generator + * engine. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + friend std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::subtract_with_carry_engine<_UIntType1, __w1, + __s1, __r1>& __x); + + /** + * @brief Extracts the current state of a % subtract_with_carry_engine + * random number generator engine @p __x from the input stream + * @p __is. + * + * @param __is An input stream. + * @param __x A % subtract_with_carry_engine random number generator + * engine. + * + * @returns The input stream with the state of @p __x extracted or in + * an error state. + */ + template + friend std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::subtract_with_carry_engine<_UIntType1, __w1, + __s1, __r1>& __x); + + private: + /// The state of the generator. This is a ring buffer. + _UIntType _M_x[long_lag]; + _UIntType _M_carry; ///< The carry + size_t _M_p; ///< Current index of x(i - r). + }; + + /** + * @brief Compares two % subtract_with_carry_engine random number + * generator objects of the same type for inequality. + * + * @param __lhs A % subtract_with_carry_engine random number generator + * object. + * @param __rhs Another % subtract_with_carry_engine random number + * generator object. + * + * @returns true if the infinite sequences of generated values + * would be different, false otherwise. + */ + template + inline bool + operator!=(const std::subtract_with_carry_engine<_UIntType, __w, + __s, __r>& __lhs, + const std::subtract_with_carry_engine<_UIntType, __w, + __s, __r>& __rhs) + { return !(__lhs == __rhs); } + + + /** + * Produces random numbers from some base engine by discarding blocks of + * data. + * + * 0 <= @p __r <= @p __p + */ + template + class discard_block_engine + { + static_assert(1 <= __r && __r <= __p, + "template argument substituting __r out of bounds"); + + public: + /** The type of the generated random value. */ + typedef typename _RandomNumberEngine::result_type result_type; + + // parameter values + static constexpr size_t block_size = __p; + static constexpr size_t used_block = __r; + + /** + * @brief Constructs a default %discard_block_engine engine. + * + * The underlying engine is default constructed as well. + */ + discard_block_engine() + : _M_b(), _M_n(0) { } + + /** + * @brief Copy constructs a %discard_block_engine engine. + * + * Copies an existing base class random number generator. + * @param __rng An existing (base class) engine object. + */ + explicit + discard_block_engine(const _RandomNumberEngine& __rng) + : _M_b(__rng), _M_n(0) { } + + /** + * @brief Move constructs a %discard_block_engine engine. + * + * Copies an existing base class random number generator. + * @param __rng An existing (base class) engine object. + */ + explicit + discard_block_engine(_RandomNumberEngine&& __rng) + : _M_b(std::move(__rng)), _M_n(0) { } + + /** + * @brief Seed constructs a %discard_block_engine engine. + * + * Constructs the underlying generator engine seeded with @p __s. + * @param __s A seed value for the base class engine. + */ + explicit + discard_block_engine(result_type __s) + : _M_b(__s), _M_n(0) { } + + /** + * @brief Generator construct a %discard_block_engine engine. + * + * @param __q A seed sequence. + */ + template::value + && !std::is_same<_Sseq, _RandomNumberEngine>::value> + ::type> + explicit + discard_block_engine(_Sseq& __q) + : _M_b(__q), _M_n(0) + { } + + /** + * @brief Reseeds the %discard_block_engine object with the default + * seed for the underlying base class generator engine. + */ + void + seed() + { + _M_b.seed(); + _M_n = 0; + } + + /** + * @brief Reseeds the %discard_block_engine object with the default + * seed for the underlying base class generator engine. + */ + void + seed(result_type __s) + { + _M_b.seed(__s); + _M_n = 0; + } + + /** + * @brief Reseeds the %discard_block_engine object with the given seed + * sequence. + * @param __q A seed generator function. + */ + template + void + seed(_Sseq& __q) + { + _M_b.seed(__q); + _M_n = 0; + } + + /** + * @brief Gets a const reference to the underlying generator engine + * object. + */ + const _RandomNumberEngine& + base() const noexcept + { return _M_b; } + + /** + * @brief Gets the minimum value in the generated random number range. + */ + static constexpr result_type + min() + { return _RandomNumberEngine::min(); } + + /** + * @brief Gets the maximum value in the generated random number range. + */ + static constexpr result_type + max() + { return _RandomNumberEngine::max(); } + + /** + * @brief Discard a sequence of random numbers. + */ + void + discard(unsigned long long __z) + { + for (; __z != 0ULL; --__z) + (*this)(); + } + + /** + * @brief Gets the next value in the generated random number sequence. + */ + result_type + operator()(); + + /** + * @brief Compares two %discard_block_engine random number generator + * objects of the same type for equality. + * + * @param __lhs A %discard_block_engine random number generator object. + * @param __rhs Another %discard_block_engine random number generator + * object. + * + * @returns true if the infinite sequences of generated values + * would be equal, false otherwise. + */ + friend bool + operator==(const discard_block_engine& __lhs, + const discard_block_engine& __rhs) + { return __lhs._M_b == __rhs._M_b && __lhs._M_n == __rhs._M_n; } + + /** + * @brief Inserts the current state of a %discard_block_engine random + * number generator engine @p __x into the output stream + * @p __os. + * + * @param __os An output stream. + * @param __x A %discard_block_engine random number generator engine. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + friend std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::discard_block_engine<_RandomNumberEngine1, + __p1, __r1>& __x); + + /** + * @brief Extracts the current state of a % subtract_with_carry_engine + * random number generator engine @p __x from the input stream + * @p __is. + * + * @param __is An input stream. + * @param __x A %discard_block_engine random number generator engine. + * + * @returns The input stream with the state of @p __x extracted or in + * an error state. + */ + template + friend std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::discard_block_engine<_RandomNumberEngine1, + __p1, __r1>& __x); + + private: + _RandomNumberEngine _M_b; + size_t _M_n; + }; + + /** + * @brief Compares two %discard_block_engine random number generator + * objects of the same type for inequality. + * + * @param __lhs A %discard_block_engine random number generator object. + * @param __rhs Another %discard_block_engine random number generator + * object. + * + * @returns true if the infinite sequences of generated values + * would be different, false otherwise. + */ + template + inline bool + operator!=(const std::discard_block_engine<_RandomNumberEngine, __p, + __r>& __lhs, + const std::discard_block_engine<_RandomNumberEngine, __p, + __r>& __rhs) + { return !(__lhs == __rhs); } + + + /** + * Produces random numbers by combining random numbers from some base + * engine to produce random numbers with a specifies number of bits @p __w. + */ + template + class independent_bits_engine + { + static_assert(std::is_unsigned<_UIntType>::value, + "result_type must be an unsigned integral type"); + static_assert(0u < __w && __w <= std::numeric_limits<_UIntType>::digits, + "template argument substituting __w out of bounds"); + + public: + /** The type of the generated random value. */ + typedef _UIntType result_type; + + /** + * @brief Constructs a default %independent_bits_engine engine. + * + * The underlying engine is default constructed as well. + */ + independent_bits_engine() + : _M_b() { } + + /** + * @brief Copy constructs a %independent_bits_engine engine. + * + * Copies an existing base class random number generator. + * @param __rng An existing (base class) engine object. + */ + explicit + independent_bits_engine(const _RandomNumberEngine& __rng) + : _M_b(__rng) { } + + /** + * @brief Move constructs a %independent_bits_engine engine. + * + * Copies an existing base class random number generator. + * @param __rng An existing (base class) engine object. + */ + explicit + independent_bits_engine(_RandomNumberEngine&& __rng) + : _M_b(std::move(__rng)) { } + + /** + * @brief Seed constructs a %independent_bits_engine engine. + * + * Constructs the underlying generator engine seeded with @p __s. + * @param __s A seed value for the base class engine. + */ + explicit + independent_bits_engine(result_type __s) + : _M_b(__s) { } + + /** + * @brief Generator construct a %independent_bits_engine engine. + * + * @param __q A seed sequence. + */ + template::value + && !std::is_same<_Sseq, _RandomNumberEngine>::value> + ::type> + explicit + independent_bits_engine(_Sseq& __q) + : _M_b(__q) + { } + + /** + * @brief Reseeds the %independent_bits_engine object with the default + * seed for the underlying base class generator engine. + */ + void + seed() + { _M_b.seed(); } + + /** + * @brief Reseeds the %independent_bits_engine object with the default + * seed for the underlying base class generator engine. + */ + void + seed(result_type __s) + { _M_b.seed(__s); } + + /** + * @brief Reseeds the %independent_bits_engine object with the given + * seed sequence. + * @param __q A seed generator function. + */ + template + void + seed(_Sseq& __q) + { _M_b.seed(__q); } + + /** + * @brief Gets a const reference to the underlying generator engine + * object. + */ + const _RandomNumberEngine& + base() const noexcept + { return _M_b; } + + /** + * @brief Gets the minimum value in the generated random number range. + */ + static constexpr result_type + min() + { return 0U; } + + /** + * @brief Gets the maximum value in the generated random number range. + */ + static constexpr result_type + max() + { return __detail::_Shift<_UIntType, __w>::__value - 1; } + + /** + * @brief Discard a sequence of random numbers. + */ + void + discard(unsigned long long __z) + { + for (; __z != 0ULL; --__z) + (*this)(); + } + + /** + * @brief Gets the next value in the generated random number sequence. + */ + result_type + operator()(); + + /** + * @brief Compares two %independent_bits_engine random number generator + * objects of the same type for equality. + * + * @param __lhs A %independent_bits_engine random number generator + * object. + * @param __rhs Another %independent_bits_engine random number generator + * object. + * + * @returns true if the infinite sequences of generated values + * would be equal, false otherwise. + */ + friend bool + operator==(const independent_bits_engine& __lhs, + const independent_bits_engine& __rhs) + { return __lhs._M_b == __rhs._M_b; } + + /** + * @brief Extracts the current state of a % subtract_with_carry_engine + * random number generator engine @p __x from the input stream + * @p __is. + * + * @param __is An input stream. + * @param __x A %independent_bits_engine random number generator + * engine. + * + * @returns The input stream with the state of @p __x extracted or in + * an error state. + */ + template + friend std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::independent_bits_engine<_RandomNumberEngine, + __w, _UIntType>& __x) + { + __is >> __x._M_b; + return __is; + } + + private: + _RandomNumberEngine _M_b; + }; + + /** + * @brief Compares two %independent_bits_engine random number generator + * objects of the same type for inequality. + * + * @param __lhs A %independent_bits_engine random number generator + * object. + * @param __rhs Another %independent_bits_engine random number generator + * object. + * + * @returns true if the infinite sequences of generated values + * would be different, false otherwise. + */ + template + inline bool + operator!=(const std::independent_bits_engine<_RandomNumberEngine, __w, + _UIntType>& __lhs, + const std::independent_bits_engine<_RandomNumberEngine, __w, + _UIntType>& __rhs) + { return !(__lhs == __rhs); } + + /** + * @brief Inserts the current state of a %independent_bits_engine random + * number generator engine @p __x into the output stream @p __os. + * + * @param __os An output stream. + * @param __x A %independent_bits_engine random number generator engine. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::independent_bits_engine<_RandomNumberEngine, + __w, _UIntType>& __x) + { + __os << __x.base(); + return __os; + } + + + /** + * @brief Produces random numbers by combining random numbers from some + * base engine to produce random numbers with a specifies number of bits + * @p __k. + */ + template + class shuffle_order_engine + { + static_assert(1u <= __k, "template argument substituting " + "__k out of bound"); + + public: + /** The type of the generated random value. */ + typedef typename _RandomNumberEngine::result_type result_type; + + static constexpr size_t table_size = __k; + + /** + * @brief Constructs a default %shuffle_order_engine engine. + * + * The underlying engine is default constructed as well. + */ + shuffle_order_engine() + : _M_b() + { _M_initialize(); } + + /** + * @brief Copy constructs a %shuffle_order_engine engine. + * + * Copies an existing base class random number generator. + * @param __rng An existing (base class) engine object. + */ + explicit + shuffle_order_engine(const _RandomNumberEngine& __rng) + : _M_b(__rng) + { _M_initialize(); } + + /** + * @brief Move constructs a %shuffle_order_engine engine. + * + * Copies an existing base class random number generator. + * @param __rng An existing (base class) engine object. + */ + explicit + shuffle_order_engine(_RandomNumberEngine&& __rng) + : _M_b(std::move(__rng)) + { _M_initialize(); } + + /** + * @brief Seed constructs a %shuffle_order_engine engine. + * + * Constructs the underlying generator engine seeded with @p __s. + * @param __s A seed value for the base class engine. + */ + explicit + shuffle_order_engine(result_type __s) + : _M_b(__s) + { _M_initialize(); } + + /** + * @brief Generator construct a %shuffle_order_engine engine. + * + * @param __q A seed sequence. + */ + template::value + && !std::is_same<_Sseq, _RandomNumberEngine>::value> + ::type> + explicit + shuffle_order_engine(_Sseq& __q) + : _M_b(__q) + { _M_initialize(); } + + /** + * @brief Reseeds the %shuffle_order_engine object with the default seed + for the underlying base class generator engine. + */ + void + seed() + { + _M_b.seed(); + _M_initialize(); + } + + /** + * @brief Reseeds the %shuffle_order_engine object with the default seed + * for the underlying base class generator engine. + */ + void + seed(result_type __s) + { + _M_b.seed(__s); + _M_initialize(); + } + + /** + * @brief Reseeds the %shuffle_order_engine object with the given seed + * sequence. + * @param __q A seed generator function. + */ + template + void + seed(_Sseq& __q) + { + _M_b.seed(__q); + _M_initialize(); + } + + /** + * Gets a const reference to the underlying generator engine object. + */ + const _RandomNumberEngine& + base() const noexcept + { return _M_b; } + + /** + * Gets the minimum value in the generated random number range. + */ + static constexpr result_type + min() + { return _RandomNumberEngine::min(); } + + /** + * Gets the maximum value in the generated random number range. + */ + static constexpr result_type + max() + { return _RandomNumberEngine::max(); } + + /** + * Discard a sequence of random numbers. + */ + void + discard(unsigned long long __z) + { + for (; __z != 0ULL; --__z) + (*this)(); + } + + /** + * Gets the next value in the generated random number sequence. + */ + result_type + operator()(); + + /** + * Compares two %shuffle_order_engine random number generator objects + * of the same type for equality. + * + * @param __lhs A %shuffle_order_engine random number generator object. + * @param __rhs Another %shuffle_order_engine random number generator + * object. + * + * @returns true if the infinite sequences of generated values + * would be equal, false otherwise. + */ + friend bool + operator==(const shuffle_order_engine& __lhs, + const shuffle_order_engine& __rhs) + { return (__lhs._M_b == __rhs._M_b + && std::equal(__lhs._M_v, __lhs._M_v + __k, __rhs._M_v) + && __lhs._M_y == __rhs._M_y); } + + /** + * @brief Inserts the current state of a %shuffle_order_engine random + * number generator engine @p __x into the output stream + @p __os. + * + * @param __os An output stream. + * @param __x A %shuffle_order_engine random number generator engine. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + friend std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::shuffle_order_engine<_RandomNumberEngine1, + __k1>& __x); + + /** + * @brief Extracts the current state of a % subtract_with_carry_engine + * random number generator engine @p __x from the input stream + * @p __is. + * + * @param __is An input stream. + * @param __x A %shuffle_order_engine random number generator engine. + * + * @returns The input stream with the state of @p __x extracted or in + * an error state. + */ + template + friend std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::shuffle_order_engine<_RandomNumberEngine1, __k1>& __x); + + private: + void _M_initialize() + { + for (size_t __i = 0; __i < __k; ++__i) + _M_v[__i] = _M_b(); + _M_y = _M_b(); + } + + _RandomNumberEngine _M_b; + result_type _M_v[__k]; + result_type _M_y; + }; + + /** + * Compares two %shuffle_order_engine random number generator objects + * of the same type for inequality. + * + * @param __lhs A %shuffle_order_engine random number generator object. + * @param __rhs Another %shuffle_order_engine random number generator + * object. + * + * @returns true if the infinite sequences of generated values + * would be different, false otherwise. + */ + template + inline bool + operator!=(const std::shuffle_order_engine<_RandomNumberEngine, + __k>& __lhs, + const std::shuffle_order_engine<_RandomNumberEngine, + __k>& __rhs) + { return !(__lhs == __rhs); } + + + /** + * The classic Minimum Standard rand0 of Lewis, Goodman, and Miller. + */ + typedef linear_congruential_engine + minstd_rand0; + + /** + * An alternative LCR (Lehmer Generator function). + */ + typedef linear_congruential_engine + minstd_rand; + + /** + * The classic Mersenne Twister. + * + * Reference: + * M. Matsumoto and T. Nishimura, Mersenne Twister: A 623-Dimensionally + * Equidistributed Uniform Pseudo-Random Number Generator, ACM Transactions + * on Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3-30. + */ + typedef mersenne_twister_engine< + uint_fast32_t, + 32, 624, 397, 31, + 0x9908b0dfUL, 11, + 0xffffffffUL, 7, + 0x9d2c5680UL, 15, + 0xefc60000UL, 18, 1812433253UL> mt19937; + + /** + * An alternative Mersenne Twister. + */ + typedef mersenne_twister_engine< + uint_fast64_t, + 64, 312, 156, 31, + 0xb5026f5aa96619e9ULL, 29, + 0x5555555555555555ULL, 17, + 0x71d67fffeda60000ULL, 37, + 0xfff7eee000000000ULL, 43, + 6364136223846793005ULL> mt19937_64; + + typedef subtract_with_carry_engine + ranlux24_base; + + typedef subtract_with_carry_engine + ranlux48_base; + + typedef discard_block_engine ranlux24; + + typedef discard_block_engine ranlux48; + + typedef shuffle_order_engine knuth_b; + + typedef minstd_rand0 default_random_engine; + + /** + * A standard interface to a platform-specific non-deterministic + * random number generator (if any are available). + */ + class random_device + { + public: + /** The type of the generated random value. */ + typedef unsigned int result_type; + + // constructors, destructors and member functions + +#ifdef _GLIBCXX_USE_RANDOM_TR1 + + explicit + random_device(const std::string& __token = "default") + { + _M_init(__token); + } + + ~random_device() + { _M_fini(); } + +#else + + explicit + random_device(const std::string& __token = "mt19937") + { _M_init_pretr1(__token); } + + public: + +#endif + + static constexpr result_type + min() + { return std::numeric_limits::min(); } + + static constexpr result_type + max() + { return std::numeric_limits::max(); } + + double + entropy() const noexcept + { return 0.0; } + + result_type + operator()() + { +#ifdef _GLIBCXX_USE_RANDOM_TR1 + return this->_M_getval(); +#else + return this->_M_getval_pretr1(); +#endif + } + + // No copy functions. + random_device(const random_device&) = delete; + void operator=(const random_device&) = delete; + + private: + + void _M_init(const std::string& __token); + void _M_init_pretr1(const std::string& __token); + void _M_fini(); + + result_type _M_getval(); + result_type _M_getval_pretr1(); + + union + { + void* _M_file; + mt19937 _M_mt; + }; + }; + + /* @} */ // group random_generators + + /** + * @addtogroup random_distributions Random Number Distributions + * @ingroup random + * @{ + */ + + /** + * @addtogroup random_distributions_uniform Uniform Distributions + * @ingroup random_distributions + * @{ + */ + + // std::uniform_int_distribution is defined in + + /** + * @brief Return true if two uniform integer distributions have + * different parameters. + */ + template + inline bool + operator!=(const std::uniform_int_distribution<_IntType>& __d1, + const std::uniform_int_distribution<_IntType>& __d2) + { return !(__d1 == __d2); } + + /** + * @brief Inserts a %uniform_int_distribution random number + * distribution @p __x into the output stream @p os. + * + * @param __os An output stream. + * @param __x A %uniform_int_distribution random number distribution. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>&, + const std::uniform_int_distribution<_IntType>&); + + /** + * @brief Extracts a %uniform_int_distribution random number distribution + * @p __x from the input stream @p __is. + * + * @param __is An input stream. + * @param __x A %uniform_int_distribution random number generator engine. + * + * @returns The input stream with @p __x extracted or in an error state. + */ + template + std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>&, + std::uniform_int_distribution<_IntType>&); + + + /** + * @brief Uniform continuous distribution for random numbers. + * + * A continuous random distribution on the range [min, max) with equal + * probability throughout the range. The URNG should be real-valued and + * deliver number in the range [0, 1). + */ + template + class uniform_real_distribution + { + static_assert(std::is_floating_point<_RealType>::value, + "result_type must be a floating point type"); + + public: + /** The type of the range of the distribution. */ + typedef _RealType result_type; + + /** Parameter type. */ + struct param_type + { + typedef uniform_real_distribution<_RealType> distribution_type; + + explicit + param_type(_RealType __a = _RealType(0), + _RealType __b = _RealType(1)) + : _M_a(__a), _M_b(__b) + { + __glibcxx_assert(_M_a <= _M_b); + } + + result_type + a() const + { return _M_a; } + + result_type + b() const + { return _M_b; } + + friend bool + operator==(const param_type& __p1, const param_type& __p2) + { return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; } + + friend bool + operator!=(const param_type& __p1, const param_type& __p2) + { return !(__p1 == __p2); } + + private: + _RealType _M_a; + _RealType _M_b; + }; + + public: + /** + * @brief Constructs a uniform_real_distribution object. + * + * @param __a [IN] The lower bound of the distribution. + * @param __b [IN] The upper bound of the distribution. + */ + explicit + uniform_real_distribution(_RealType __a = _RealType(0), + _RealType __b = _RealType(1)) + : _M_param(__a, __b) + { } + + explicit + uniform_real_distribution(const param_type& __p) + : _M_param(__p) + { } + + /** + * @brief Resets the distribution state. + * + * Does nothing for the uniform real distribution. + */ + void + reset() { } + + result_type + a() const + { return _M_param.a(); } + + result_type + b() const + { return _M_param.b(); } + + /** + * @brief Returns the parameter set of the distribution. + */ + param_type + param() const + { return _M_param; } + + /** + * @brief Sets the parameter set of the distribution. + * @param __param The new parameter set of the distribution. + */ + void + param(const param_type& __param) + { _M_param = __param; } + + /** + * @brief Returns the inclusive lower bound of the distribution range. + */ + result_type + min() const + { return this->a(); } + + /** + * @brief Returns the inclusive upper bound of the distribution range. + */ + result_type + max() const + { return this->b(); } + + /** + * @brief Generating functions. + */ + template + result_type + operator()(_UniformRandomNumberGenerator& __urng) + { return this->operator()(__urng, _M_param); } + + template + result_type + operator()(_UniformRandomNumberGenerator& __urng, + const param_type& __p) + { + __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> + __aurng(__urng); + return (__aurng() * (__p.b() - __p.a())) + __p.a(); + } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate(__f, __t, __urng, _M_param); } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + /** + * @brief Return true if two uniform real distributions have + * the same parameters. + */ + friend bool + operator==(const uniform_real_distribution& __d1, + const uniform_real_distribution& __d2) + { return __d1._M_param == __d2._M_param; } + + private: + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p); + + param_type _M_param; + }; + + /** + * @brief Return true if two uniform real distributions have + * different parameters. + */ + template + inline bool + operator!=(const std::uniform_real_distribution<_IntType>& __d1, + const std::uniform_real_distribution<_IntType>& __d2) + { return !(__d1 == __d2); } + + /** + * @brief Inserts a %uniform_real_distribution random number + * distribution @p __x into the output stream @p __os. + * + * @param __os An output stream. + * @param __x A %uniform_real_distribution random number distribution. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>&, + const std::uniform_real_distribution<_RealType>&); + + /** + * @brief Extracts a %uniform_real_distribution random number distribution + * @p __x from the input stream @p __is. + * + * @param __is An input stream. + * @param __x A %uniform_real_distribution random number generator engine. + * + * @returns The input stream with @p __x extracted or in an error state. + */ + template + std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>&, + std::uniform_real_distribution<_RealType>&); + + /* @} */ // group random_distributions_uniform + + /** + * @addtogroup random_distributions_normal Normal Distributions + * @ingroup random_distributions + * @{ + */ + + /** + * @brief A normal continuous distribution for random numbers. + * + * The formula for the normal probability density function is + * @f[ + * p(x|\mu,\sigma) = \frac{1}{\sigma \sqrt{2 \pi}} + * e^{- \frac{{x - \mu}^ {2}}{2 \sigma ^ {2}} } + * @f] + */ + template + class normal_distribution + { + static_assert(std::is_floating_point<_RealType>::value, + "result_type must be a floating point type"); + + public: + /** The type of the range of the distribution. */ + typedef _RealType result_type; + + /** Parameter type. */ + struct param_type + { + typedef normal_distribution<_RealType> distribution_type; + + explicit + param_type(_RealType __mean = _RealType(0), + _RealType __stddev = _RealType(1)) + : _M_mean(__mean), _M_stddev(__stddev) + { + __glibcxx_assert(_M_stddev > _RealType(0)); + } + + _RealType + mean() const + { return _M_mean; } + + _RealType + stddev() const + { return _M_stddev; } + + friend bool + operator==(const param_type& __p1, const param_type& __p2) + { return (__p1._M_mean == __p2._M_mean + && __p1._M_stddev == __p2._M_stddev); } + + friend bool + operator!=(const param_type& __p1, const param_type& __p2) + { return !(__p1 == __p2); } + + private: + _RealType _M_mean; + _RealType _M_stddev; + }; + + public: + /** + * Constructs a normal distribution with parameters @f$mean@f$ and + * standard deviation. + */ + explicit + normal_distribution(result_type __mean = result_type(0), + result_type __stddev = result_type(1)) + : _M_param(__mean, __stddev), _M_saved_available(false) + { } + + explicit + normal_distribution(const param_type& __p) + : _M_param(__p), _M_saved_available(false) + { } + + /** + * @brief Resets the distribution state. + */ + void + reset() + { _M_saved_available = false; } + + /** + * @brief Returns the mean of the distribution. + */ + _RealType + mean() const + { return _M_param.mean(); } + + /** + * @brief Returns the standard deviation of the distribution. + */ + _RealType + stddev() const + { return _M_param.stddev(); } + + /** + * @brief Returns the parameter set of the distribution. + */ + param_type + param() const + { return _M_param; } + + /** + * @brief Sets the parameter set of the distribution. + * @param __param The new parameter set of the distribution. + */ + void + param(const param_type& __param) + { _M_param = __param; } + + /** + * @brief Returns the greatest lower bound value of the distribution. + */ + result_type + min() const + { return std::numeric_limits::lowest(); } + + /** + * @brief Returns the least upper bound value of the distribution. + */ + result_type + max() const + { return std::numeric_limits::max(); } + + /** + * @brief Generating functions. + */ + template + result_type + operator()(_UniformRandomNumberGenerator& __urng) + { return this->operator()(__urng, _M_param); } + + template + result_type + operator()(_UniformRandomNumberGenerator& __urng, + const param_type& __p); + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate(__f, __t, __urng, _M_param); } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + /** + * @brief Return true if two normal distributions have + * the same parameters and the sequences that would + * be generated are equal. + */ + template + friend bool + operator==(const std::normal_distribution<_RealType1>& __d1, + const std::normal_distribution<_RealType1>& __d2); + + /** + * @brief Inserts a %normal_distribution random number distribution + * @p __x into the output stream @p __os. + * + * @param __os An output stream. + * @param __x A %normal_distribution random number distribution. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + friend std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::normal_distribution<_RealType1>& __x); + + /** + * @brief Extracts a %normal_distribution random number distribution + * @p __x from the input stream @p __is. + * + * @param __is An input stream. + * @param __x A %normal_distribution random number generator engine. + * + * @returns The input stream with @p __x extracted or in an error + * state. + */ + template + friend std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::normal_distribution<_RealType1>& __x); + + private: + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p); + + param_type _M_param; + result_type _M_saved; + bool _M_saved_available; + }; + + /** + * @brief Return true if two normal distributions are different. + */ + template + inline bool + operator!=(const std::normal_distribution<_RealType>& __d1, + const std::normal_distribution<_RealType>& __d2) + { return !(__d1 == __d2); } + + + /** + * @brief A lognormal_distribution random number distribution. + * + * The formula for the normal probability mass function is + * @f[ + * p(x|m,s) = \frac{1}{sx\sqrt{2\pi}} + * \exp{-\frac{(\ln{x} - m)^2}{2s^2}} + * @f] + */ + template + class lognormal_distribution + { + static_assert(std::is_floating_point<_RealType>::value, + "result_type must be a floating point type"); + + public: + /** The type of the range of the distribution. */ + typedef _RealType result_type; + + /** Parameter type. */ + struct param_type + { + typedef lognormal_distribution<_RealType> distribution_type; + + explicit + param_type(_RealType __m = _RealType(0), + _RealType __s = _RealType(1)) + : _M_m(__m), _M_s(__s) + { } + + _RealType + m() const + { return _M_m; } + + _RealType + s() const + { return _M_s; } + + friend bool + operator==(const param_type& __p1, const param_type& __p2) + { return __p1._M_m == __p2._M_m && __p1._M_s == __p2._M_s; } + + friend bool + operator!=(const param_type& __p1, const param_type& __p2) + { return !(__p1 == __p2); } + + private: + _RealType _M_m; + _RealType _M_s; + }; + + explicit + lognormal_distribution(_RealType __m = _RealType(0), + _RealType __s = _RealType(1)) + : _M_param(__m, __s), _M_nd() + { } + + explicit + lognormal_distribution(const param_type& __p) + : _M_param(__p), _M_nd() + { } + + /** + * Resets the distribution state. + */ + void + reset() + { _M_nd.reset(); } + + /** + * + */ + _RealType + m() const + { return _M_param.m(); } + + _RealType + s() const + { return _M_param.s(); } + + /** + * @brief Returns the parameter set of the distribution. + */ + param_type + param() const + { return _M_param; } + + /** + * @brief Sets the parameter set of the distribution. + * @param __param The new parameter set of the distribution. + */ + void + param(const param_type& __param) + { _M_param = __param; } + + /** + * @brief Returns the greatest lower bound value of the distribution. + */ + result_type + min() const + { return result_type(0); } + + /** + * @brief Returns the least upper bound value of the distribution. + */ + result_type + max() const + { return std::numeric_limits::max(); } + + /** + * @brief Generating functions. + */ + template + result_type + operator()(_UniformRandomNumberGenerator& __urng) + { return this->operator()(__urng, _M_param); } + + template + result_type + operator()(_UniformRandomNumberGenerator& __urng, + const param_type& __p) + { return std::exp(__p.s() * _M_nd(__urng) + __p.m()); } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate(__f, __t, __urng, _M_param); } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + /** + * @brief Return true if two lognormal distributions have + * the same parameters and the sequences that would + * be generated are equal. + */ + friend bool + operator==(const lognormal_distribution& __d1, + const lognormal_distribution& __d2) + { return (__d1._M_param == __d2._M_param + && __d1._M_nd == __d2._M_nd); } + + /** + * @brief Inserts a %lognormal_distribution random number distribution + * @p __x into the output stream @p __os. + * + * @param __os An output stream. + * @param __x A %lognormal_distribution random number distribution. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + friend std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::lognormal_distribution<_RealType1>& __x); + + /** + * @brief Extracts a %lognormal_distribution random number distribution + * @p __x from the input stream @p __is. + * + * @param __is An input stream. + * @param __x A %lognormal_distribution random number + * generator engine. + * + * @returns The input stream with @p __x extracted or in an error state. + */ + template + friend std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::lognormal_distribution<_RealType1>& __x); + + private: + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p); + + param_type _M_param; + + std::normal_distribution _M_nd; + }; + + /** + * @brief Return true if two lognormal distributions are different. + */ + template + inline bool + operator!=(const std::lognormal_distribution<_RealType>& __d1, + const std::lognormal_distribution<_RealType>& __d2) + { return !(__d1 == __d2); } + + + /** + * @brief A gamma continuous distribution for random numbers. + * + * The formula for the gamma probability density function is: + * @f[ + * p(x|\alpha,\beta) = \frac{1}{\beta\Gamma(\alpha)} + * (x/\beta)^{\alpha - 1} e^{-x/\beta} + * @f] + */ + template + class gamma_distribution + { + static_assert(std::is_floating_point<_RealType>::value, + "result_type must be a floating point type"); + + public: + /** The type of the range of the distribution. */ + typedef _RealType result_type; + + /** Parameter type. */ + struct param_type + { + typedef gamma_distribution<_RealType> distribution_type; + friend class gamma_distribution<_RealType>; + + explicit + param_type(_RealType __alpha_val = _RealType(1), + _RealType __beta_val = _RealType(1)) + : _M_alpha(__alpha_val), _M_beta(__beta_val) + { + __glibcxx_assert(_M_alpha > _RealType(0)); + _M_initialize(); + } + + _RealType + alpha() const + { return _M_alpha; } + + _RealType + beta() const + { return _M_beta; } + + friend bool + operator==(const param_type& __p1, const param_type& __p2) + { return (__p1._M_alpha == __p2._M_alpha + && __p1._M_beta == __p2._M_beta); } + + friend bool + operator!=(const param_type& __p1, const param_type& __p2) + { return !(__p1 == __p2); } + + private: + void + _M_initialize(); + + _RealType _M_alpha; + _RealType _M_beta; + + _RealType _M_malpha, _M_a2; + }; + + public: + /** + * @brief Constructs a gamma distribution with parameters + * @f$\alpha@f$ and @f$\beta@f$. + */ + explicit + gamma_distribution(_RealType __alpha_val = _RealType(1), + _RealType __beta_val = _RealType(1)) + : _M_param(__alpha_val, __beta_val), _M_nd() + { } + + explicit + gamma_distribution(const param_type& __p) + : _M_param(__p), _M_nd() + { } + + /** + * @brief Resets the distribution state. + */ + void + reset() + { _M_nd.reset(); } + + /** + * @brief Returns the @f$\alpha@f$ of the distribution. + */ + _RealType + alpha() const + { return _M_param.alpha(); } + + /** + * @brief Returns the @f$\beta@f$ of the distribution. + */ + _RealType + beta() const + { return _M_param.beta(); } + + /** + * @brief Returns the parameter set of the distribution. + */ + param_type + param() const + { return _M_param; } + + /** + * @brief Sets the parameter set of the distribution. + * @param __param The new parameter set of the distribution. + */ + void + param(const param_type& __param) + { _M_param = __param; } + + /** + * @brief Returns the greatest lower bound value of the distribution. + */ + result_type + min() const + { return result_type(0); } + + /** + * @brief Returns the least upper bound value of the distribution. + */ + result_type + max() const + { return std::numeric_limits::max(); } + + /** + * @brief Generating functions. + */ + template + result_type + operator()(_UniformRandomNumberGenerator& __urng) + { return this->operator()(__urng, _M_param); } + + template + result_type + operator()(_UniformRandomNumberGenerator& __urng, + const param_type& __p); + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate(__f, __t, __urng, _M_param); } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + /** + * @brief Return true if two gamma distributions have the same + * parameters and the sequences that would be generated + * are equal. + */ + friend bool + operator==(const gamma_distribution& __d1, + const gamma_distribution& __d2) + { return (__d1._M_param == __d2._M_param + && __d1._M_nd == __d2._M_nd); } + + /** + * @brief Inserts a %gamma_distribution random number distribution + * @p __x into the output stream @p __os. + * + * @param __os An output stream. + * @param __x A %gamma_distribution random number distribution. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + friend std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::gamma_distribution<_RealType1>& __x); + + /** + * @brief Extracts a %gamma_distribution random number distribution + * @p __x from the input stream @p __is. + * + * @param __is An input stream. + * @param __x A %gamma_distribution random number generator engine. + * + * @returns The input stream with @p __x extracted or in an error state. + */ + template + friend std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::gamma_distribution<_RealType1>& __x); + + private: + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p); + + param_type _M_param; + + std::normal_distribution _M_nd; + }; + + /** + * @brief Return true if two gamma distributions are different. + */ + template + inline bool + operator!=(const std::gamma_distribution<_RealType>& __d1, + const std::gamma_distribution<_RealType>& __d2) + { return !(__d1 == __d2); } + + + /** + * @brief A chi_squared_distribution random number distribution. + * + * The formula for the normal probability mass function is + * @f$p(x|n) = \frac{x^{(n/2) - 1}e^{-x/2}}{\Gamma(n/2) 2^{n/2}}@f$ + */ + template + class chi_squared_distribution + { + static_assert(std::is_floating_point<_RealType>::value, + "result_type must be a floating point type"); + + public: + /** The type of the range of the distribution. */ + typedef _RealType result_type; + + /** Parameter type. */ + struct param_type + { + typedef chi_squared_distribution<_RealType> distribution_type; + + explicit + param_type(_RealType __n = _RealType(1)) + : _M_n(__n) + { } + + _RealType + n() const + { return _M_n; } + + friend bool + operator==(const param_type& __p1, const param_type& __p2) + { return __p1._M_n == __p2._M_n; } + + friend bool + operator!=(const param_type& __p1, const param_type& __p2) + { return !(__p1 == __p2); } + + private: + _RealType _M_n; + }; + + explicit + chi_squared_distribution(_RealType __n = _RealType(1)) + : _M_param(__n), _M_gd(__n / 2) + { } + + explicit + chi_squared_distribution(const param_type& __p) + : _M_param(__p), _M_gd(__p.n() / 2) + { } + + /** + * @brief Resets the distribution state. + */ + void + reset() + { _M_gd.reset(); } + + /** + * + */ + _RealType + n() const + { return _M_param.n(); } + + /** + * @brief Returns the parameter set of the distribution. + */ + param_type + param() const + { return _M_param; } + + /** + * @brief Sets the parameter set of the distribution. + * @param __param The new parameter set of the distribution. + */ + void + param(const param_type& __param) + { _M_param = __param; } + + /** + * @brief Returns the greatest lower bound value of the distribution. + */ + result_type + min() const + { return result_type(0); } + + /** + * @brief Returns the least upper bound value of the distribution. + */ + result_type + max() const + { return std::numeric_limits::max(); } + + /** + * @brief Generating functions. + */ + template + result_type + operator()(_UniformRandomNumberGenerator& __urng) + { return 2 * _M_gd(__urng); } + + template + result_type + operator()(_UniformRandomNumberGenerator& __urng, + const param_type& __p) + { + typedef typename std::gamma_distribution::param_type + param_type; + return 2 * _M_gd(__urng, param_type(__p.n() / 2)); + } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate_impl(__f, __t, __urng); } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { typename std::gamma_distribution::param_type + __p2(__p.n() / 2); + this->__generate_impl(__f, __t, __urng, __p2); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate_impl(__f, __t, __urng); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { typename std::gamma_distribution::param_type + __p2(__p.n() / 2); + this->__generate_impl(__f, __t, __urng, __p2); } + + /** + * @brief Return true if two Chi-squared distributions have + * the same parameters and the sequences that would be + * generated are equal. + */ + friend bool + operator==(const chi_squared_distribution& __d1, + const chi_squared_distribution& __d2) + { return __d1._M_param == __d2._M_param && __d1._M_gd == __d2._M_gd; } + + /** + * @brief Inserts a %chi_squared_distribution random number distribution + * @p __x into the output stream @p __os. + * + * @param __os An output stream. + * @param __x A %chi_squared_distribution random number distribution. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + friend std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::chi_squared_distribution<_RealType1>& __x); + + /** + * @brief Extracts a %chi_squared_distribution random number distribution + * @p __x from the input stream @p __is. + * + * @param __is An input stream. + * @param __x A %chi_squared_distribution random number + * generator engine. + * + * @returns The input stream with @p __x extracted or in an error state. + */ + template + friend std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::chi_squared_distribution<_RealType1>& __x); + + private: + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng); + + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const typename + std::gamma_distribution::param_type& __p); + + param_type _M_param; + + std::gamma_distribution _M_gd; + }; + + /** + * @brief Return true if two Chi-squared distributions are different. + */ + template + inline bool + operator!=(const std::chi_squared_distribution<_RealType>& __d1, + const std::chi_squared_distribution<_RealType>& __d2) + { return !(__d1 == __d2); } + + + /** + * @brief A cauchy_distribution random number distribution. + * + * The formula for the normal probability mass function is + * @f$p(x|a,b) = (\pi b (1 + (\frac{x-a}{b})^2))^{-1}@f$ + */ + template + class cauchy_distribution + { + static_assert(std::is_floating_point<_RealType>::value, + "result_type must be a floating point type"); + + public: + /** The type of the range of the distribution. */ + typedef _RealType result_type; + + /** Parameter type. */ + struct param_type + { + typedef cauchy_distribution<_RealType> distribution_type; + + explicit + param_type(_RealType __a = _RealType(0), + _RealType __b = _RealType(1)) + : _M_a(__a), _M_b(__b) + { } + + _RealType + a() const + { return _M_a; } + + _RealType + b() const + { return _M_b; } + + friend bool + operator==(const param_type& __p1, const param_type& __p2) + { return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; } + + friend bool + operator!=(const param_type& __p1, const param_type& __p2) + { return !(__p1 == __p2); } + + private: + _RealType _M_a; + _RealType _M_b; + }; + + explicit + cauchy_distribution(_RealType __a = _RealType(0), + _RealType __b = _RealType(1)) + : _M_param(__a, __b) + { } + + explicit + cauchy_distribution(const param_type& __p) + : _M_param(__p) + { } + + /** + * @brief Resets the distribution state. + */ + void + reset() + { } + + /** + * + */ + _RealType + a() const + { return _M_param.a(); } + + _RealType + b() const + { return _M_param.b(); } + + /** + * @brief Returns the parameter set of the distribution. + */ + param_type + param() const + { return _M_param; } + + /** + * @brief Sets the parameter set of the distribution. + * @param __param The new parameter set of the distribution. + */ + void + param(const param_type& __param) + { _M_param = __param; } + + /** + * @brief Returns the greatest lower bound value of the distribution. + */ + result_type + min() const + { return std::numeric_limits::lowest(); } + + /** + * @brief Returns the least upper bound value of the distribution. + */ + result_type + max() const + { return std::numeric_limits::max(); } + + /** + * @brief Generating functions. + */ + template + result_type + operator()(_UniformRandomNumberGenerator& __urng) + { return this->operator()(__urng, _M_param); } + + template + result_type + operator()(_UniformRandomNumberGenerator& __urng, + const param_type& __p); + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate(__f, __t, __urng, _M_param); } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + /** + * @brief Return true if two Cauchy distributions have + * the same parameters. + */ + friend bool + operator==(const cauchy_distribution& __d1, + const cauchy_distribution& __d2) + { return __d1._M_param == __d2._M_param; } + + private: + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p); + + param_type _M_param; + }; + + /** + * @brief Return true if two Cauchy distributions have + * different parameters. + */ + template + inline bool + operator!=(const std::cauchy_distribution<_RealType>& __d1, + const std::cauchy_distribution<_RealType>& __d2) + { return !(__d1 == __d2); } + + /** + * @brief Inserts a %cauchy_distribution random number distribution + * @p __x into the output stream @p __os. + * + * @param __os An output stream. + * @param __x A %cauchy_distribution random number distribution. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::cauchy_distribution<_RealType>& __x); + + /** + * @brief Extracts a %cauchy_distribution random number distribution + * @p __x from the input stream @p __is. + * + * @param __is An input stream. + * @param __x A %cauchy_distribution random number + * generator engine. + * + * @returns The input stream with @p __x extracted or in an error state. + */ + template + std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::cauchy_distribution<_RealType>& __x); + + + /** + * @brief A fisher_f_distribution random number distribution. + * + * The formula for the normal probability mass function is + * @f[ + * p(x|m,n) = \frac{\Gamma((m+n)/2)}{\Gamma(m/2)\Gamma(n/2)} + * (\frac{m}{n})^{m/2} x^{(m/2)-1} + * (1 + \frac{mx}{n})^{-(m+n)/2} + * @f] + */ + template + class fisher_f_distribution + { + static_assert(std::is_floating_point<_RealType>::value, + "result_type must be a floating point type"); + + public: + /** The type of the range of the distribution. */ + typedef _RealType result_type; + + /** Parameter type. */ + struct param_type + { + typedef fisher_f_distribution<_RealType> distribution_type; + + explicit + param_type(_RealType __m = _RealType(1), + _RealType __n = _RealType(1)) + : _M_m(__m), _M_n(__n) + { } + + _RealType + m() const + { return _M_m; } + + _RealType + n() const + { return _M_n; } + + friend bool + operator==(const param_type& __p1, const param_type& __p2) + { return __p1._M_m == __p2._M_m && __p1._M_n == __p2._M_n; } + + friend bool + operator!=(const param_type& __p1, const param_type& __p2) + { return !(__p1 == __p2); } + + private: + _RealType _M_m; + _RealType _M_n; + }; + + explicit + fisher_f_distribution(_RealType __m = _RealType(1), + _RealType __n = _RealType(1)) + : _M_param(__m, __n), _M_gd_x(__m / 2), _M_gd_y(__n / 2) + { } + + explicit + fisher_f_distribution(const param_type& __p) + : _M_param(__p), _M_gd_x(__p.m() / 2), _M_gd_y(__p.n() / 2) + { } + + /** + * @brief Resets the distribution state. + */ + void + reset() + { + _M_gd_x.reset(); + _M_gd_y.reset(); + } + + /** + * + */ + _RealType + m() const + { return _M_param.m(); } + + _RealType + n() const + { return _M_param.n(); } + + /** + * @brief Returns the parameter set of the distribution. + */ + param_type + param() const + { return _M_param; } + + /** + * @brief Sets the parameter set of the distribution. + * @param __param The new parameter set of the distribution. + */ + void + param(const param_type& __param) + { _M_param = __param; } + + /** + * @brief Returns the greatest lower bound value of the distribution. + */ + result_type + min() const + { return result_type(0); } + + /** + * @brief Returns the least upper bound value of the distribution. + */ + result_type + max() const + { return std::numeric_limits::max(); } + + /** + * @brief Generating functions. + */ + template + result_type + operator()(_UniformRandomNumberGenerator& __urng) + { return (_M_gd_x(__urng) * n()) / (_M_gd_y(__urng) * m()); } + + template + result_type + operator()(_UniformRandomNumberGenerator& __urng, + const param_type& __p) + { + typedef typename std::gamma_distribution::param_type + param_type; + return ((_M_gd_x(__urng, param_type(__p.m() / 2)) * n()) + / (_M_gd_y(__urng, param_type(__p.n() / 2)) * m())); + } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate_impl(__f, __t, __urng); } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate_impl(__f, __t, __urng); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + /** + * @brief Return true if two Fisher f distributions have + * the same parameters and the sequences that would + * be generated are equal. + */ + friend bool + operator==(const fisher_f_distribution& __d1, + const fisher_f_distribution& __d2) + { return (__d1._M_param == __d2._M_param + && __d1._M_gd_x == __d2._M_gd_x + && __d1._M_gd_y == __d2._M_gd_y); } + + /** + * @brief Inserts a %fisher_f_distribution random number distribution + * @p __x into the output stream @p __os. + * + * @param __os An output stream. + * @param __x A %fisher_f_distribution random number distribution. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + friend std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::fisher_f_distribution<_RealType1>& __x); + + /** + * @brief Extracts a %fisher_f_distribution random number distribution + * @p __x from the input stream @p __is. + * + * @param __is An input stream. + * @param __x A %fisher_f_distribution random number + * generator engine. + * + * @returns The input stream with @p __x extracted or in an error state. + */ + template + friend std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::fisher_f_distribution<_RealType1>& __x); + + private: + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng); + + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p); + + param_type _M_param; + + std::gamma_distribution _M_gd_x, _M_gd_y; + }; + + /** + * @brief Return true if two Fisher f distributions are different. + */ + template + inline bool + operator!=(const std::fisher_f_distribution<_RealType>& __d1, + const std::fisher_f_distribution<_RealType>& __d2) + { return !(__d1 == __d2); } + + /** + * @brief A student_t_distribution random number distribution. + * + * The formula for the normal probability mass function is: + * @f[ + * p(x|n) = \frac{1}{\sqrt(n\pi)} \frac{\Gamma((n+1)/2)}{\Gamma(n/2)} + * (1 + \frac{x^2}{n}) ^{-(n+1)/2} + * @f] + */ + template + class student_t_distribution + { + static_assert(std::is_floating_point<_RealType>::value, + "result_type must be a floating point type"); + + public: + /** The type of the range of the distribution. */ + typedef _RealType result_type; + + /** Parameter type. */ + struct param_type + { + typedef student_t_distribution<_RealType> distribution_type; + + explicit + param_type(_RealType __n = _RealType(1)) + : _M_n(__n) + { } + + _RealType + n() const + { return _M_n; } + + friend bool + operator==(const param_type& __p1, const param_type& __p2) + { return __p1._M_n == __p2._M_n; } + + friend bool + operator!=(const param_type& __p1, const param_type& __p2) + { return !(__p1 == __p2); } + + private: + _RealType _M_n; + }; + + explicit + student_t_distribution(_RealType __n = _RealType(1)) + : _M_param(__n), _M_nd(), _M_gd(__n / 2, 2) + { } + + explicit + student_t_distribution(const param_type& __p) + : _M_param(__p), _M_nd(), _M_gd(__p.n() / 2, 2) + { } + + /** + * @brief Resets the distribution state. + */ + void + reset() + { + _M_nd.reset(); + _M_gd.reset(); + } + + /** + * + */ + _RealType + n() const + { return _M_param.n(); } + + /** + * @brief Returns the parameter set of the distribution. + */ + param_type + param() const + { return _M_param; } + + /** + * @brief Sets the parameter set of the distribution. + * @param __param The new parameter set of the distribution. + */ + void + param(const param_type& __param) + { _M_param = __param; } + + /** + * @brief Returns the greatest lower bound value of the distribution. + */ + result_type + min() const + { return std::numeric_limits::lowest(); } + + /** + * @brief Returns the least upper bound value of the distribution. + */ + result_type + max() const + { return std::numeric_limits::max(); } + + /** + * @brief Generating functions. + */ + template + result_type + operator()(_UniformRandomNumberGenerator& __urng) + { return _M_nd(__urng) * std::sqrt(n() / _M_gd(__urng)); } + + template + result_type + operator()(_UniformRandomNumberGenerator& __urng, + const param_type& __p) + { + typedef typename std::gamma_distribution::param_type + param_type; + + const result_type __g = _M_gd(__urng, param_type(__p.n() / 2, 2)); + return _M_nd(__urng) * std::sqrt(__p.n() / __g); + } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate_impl(__f, __t, __urng); } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate_impl(__f, __t, __urng); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + /** + * @brief Return true if two Student t distributions have + * the same parameters and the sequences that would + * be generated are equal. + */ + friend bool + operator==(const student_t_distribution& __d1, + const student_t_distribution& __d2) + { return (__d1._M_param == __d2._M_param + && __d1._M_nd == __d2._M_nd && __d1._M_gd == __d2._M_gd); } + + /** + * @brief Inserts a %student_t_distribution random number distribution + * @p __x into the output stream @p __os. + * + * @param __os An output stream. + * @param __x A %student_t_distribution random number distribution. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + friend std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::student_t_distribution<_RealType1>& __x); + + /** + * @brief Extracts a %student_t_distribution random number distribution + * @p __x from the input stream @p __is. + * + * @param __is An input stream. + * @param __x A %student_t_distribution random number + * generator engine. + * + * @returns The input stream with @p __x extracted or in an error state. + */ + template + friend std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::student_t_distribution<_RealType1>& __x); + + private: + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng); + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p); + + param_type _M_param; + + std::normal_distribution _M_nd; + std::gamma_distribution _M_gd; + }; + + /** + * @brief Return true if two Student t distributions are different. + */ + template + inline bool + operator!=(const std::student_t_distribution<_RealType>& __d1, + const std::student_t_distribution<_RealType>& __d2) + { return !(__d1 == __d2); } + + + /* @} */ // group random_distributions_normal + + /** + * @addtogroup random_distributions_bernoulli Bernoulli Distributions + * @ingroup random_distributions + * @{ + */ + + /** + * @brief A Bernoulli random number distribution. + * + * Generates a sequence of true and false values with likelihood @f$p@f$ + * that true will come up and @f$(1 - p)@f$ that false will appear. + */ + class bernoulli_distribution + { + public: + /** The type of the range of the distribution. */ + typedef bool result_type; + + /** Parameter type. */ + struct param_type + { + typedef bernoulli_distribution distribution_type; + + explicit + param_type(double __p = 0.5) + : _M_p(__p) + { + __glibcxx_assert((_M_p >= 0.0) && (_M_p <= 1.0)); + } + + double + p() const + { return _M_p; } + + friend bool + operator==(const param_type& __p1, const param_type& __p2) + { return __p1._M_p == __p2._M_p; } + + friend bool + operator!=(const param_type& __p1, const param_type& __p2) + { return !(__p1 == __p2); } + + private: + double _M_p; + }; + + public: + /** + * @brief Constructs a Bernoulli distribution with likelihood @p p. + * + * @param __p [IN] The likelihood of a true result being returned. + * Must be in the interval @f$[0, 1]@f$. + */ + explicit + bernoulli_distribution(double __p = 0.5) + : _M_param(__p) + { } + + explicit + bernoulli_distribution(const param_type& __p) + : _M_param(__p) + { } + + /** + * @brief Resets the distribution state. + * + * Does nothing for a Bernoulli distribution. + */ + void + reset() { } + + /** + * @brief Returns the @p p parameter of the distribution. + */ + double + p() const + { return _M_param.p(); } + + /** + * @brief Returns the parameter set of the distribution. + */ + param_type + param() const + { return _M_param; } + + /** + * @brief Sets the parameter set of the distribution. + * @param __param The new parameter set of the distribution. + */ + void + param(const param_type& __param) + { _M_param = __param; } + + /** + * @brief Returns the greatest lower bound value of the distribution. + */ + result_type + min() const + { return std::numeric_limits::min(); } + + /** + * @brief Returns the least upper bound value of the distribution. + */ + result_type + max() const + { return std::numeric_limits::max(); } + + /** + * @brief Generating functions. + */ + template + result_type + operator()(_UniformRandomNumberGenerator& __urng) + { return this->operator()(__urng, _M_param); } + + template + result_type + operator()(_UniformRandomNumberGenerator& __urng, + const param_type& __p) + { + __detail::_Adaptor<_UniformRandomNumberGenerator, double> + __aurng(__urng); + if ((__aurng() - __aurng.min()) + < __p.p() * (__aurng.max() - __aurng.min())) + return true; + return false; + } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate(__f, __t, __urng, _M_param); } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + /** + * @brief Return true if two Bernoulli distributions have + * the same parameters. + */ + friend bool + operator==(const bernoulli_distribution& __d1, + const bernoulli_distribution& __d2) + { return __d1._M_param == __d2._M_param; } + + private: + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p); + + param_type _M_param; + }; + + /** + * @brief Return true if two Bernoulli distributions have + * different parameters. + */ + inline bool + operator!=(const std::bernoulli_distribution& __d1, + const std::bernoulli_distribution& __d2) + { return !(__d1 == __d2); } + + /** + * @brief Inserts a %bernoulli_distribution random number distribution + * @p __x into the output stream @p __os. + * + * @param __os An output stream. + * @param __x A %bernoulli_distribution random number distribution. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::bernoulli_distribution& __x); + + /** + * @brief Extracts a %bernoulli_distribution random number distribution + * @p __x from the input stream @p __is. + * + * @param __is An input stream. + * @param __x A %bernoulli_distribution random number generator engine. + * + * @returns The input stream with @p __x extracted or in an error state. + */ + template + std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::bernoulli_distribution& __x) + { + double __p; + __is >> __p; + __x.param(bernoulli_distribution::param_type(__p)); + return __is; + } + + + /** + * @brief A discrete binomial random number distribution. + * + * The formula for the binomial probability density function is + * @f$p(i|t,p) = \binom{t}{i} p^i (1 - p)^{t - i}@f$ where @f$t@f$ + * and @f$p@f$ are the parameters of the distribution. + */ + template + class binomial_distribution + { + static_assert(std::is_integral<_IntType>::value, + "result_type must be an integral type"); + + public: + /** The type of the range of the distribution. */ + typedef _IntType result_type; + + /** Parameter type. */ + struct param_type + { + typedef binomial_distribution<_IntType> distribution_type; + friend class binomial_distribution<_IntType>; + + explicit + param_type(_IntType __t = _IntType(1), double __p = 0.5) + : _M_t(__t), _M_p(__p) + { + __glibcxx_assert((_M_t >= _IntType(0)) + && (_M_p >= 0.0) + && (_M_p <= 1.0)); + _M_initialize(); + } + + _IntType + t() const + { return _M_t; } + + double + p() const + { return _M_p; } + + friend bool + operator==(const param_type& __p1, const param_type& __p2) + { return __p1._M_t == __p2._M_t && __p1._M_p == __p2._M_p; } + + friend bool + operator!=(const param_type& __p1, const param_type& __p2) + { return !(__p1 == __p2); } + + private: + void + _M_initialize(); + + _IntType _M_t; + double _M_p; + + double _M_q; +#if _GLIBCXX_USE_C99_MATH_TR1 + double _M_d1, _M_d2, _M_s1, _M_s2, _M_c, + _M_a1, _M_a123, _M_s, _M_lf, _M_lp1p; +#endif + bool _M_easy; + }; + + // constructors and member function + explicit + binomial_distribution(_IntType __t = _IntType(1), + double __p = 0.5) + : _M_param(__t, __p), _M_nd() + { } + + explicit + binomial_distribution(const param_type& __p) + : _M_param(__p), _M_nd() + { } + + /** + * @brief Resets the distribution state. + */ + void + reset() + { _M_nd.reset(); } + + /** + * @brief Returns the distribution @p t parameter. + */ + _IntType + t() const + { return _M_param.t(); } + + /** + * @brief Returns the distribution @p p parameter. + */ + double + p() const + { return _M_param.p(); } + + /** + * @brief Returns the parameter set of the distribution. + */ + param_type + param() const + { return _M_param; } + + /** + * @brief Sets the parameter set of the distribution. + * @param __param The new parameter set of the distribution. + */ + void + param(const param_type& __param) + { _M_param = __param; } + + /** + * @brief Returns the greatest lower bound value of the distribution. + */ + result_type + min() const + { return 0; } + + /** + * @brief Returns the least upper bound value of the distribution. + */ + result_type + max() const + { return _M_param.t(); } + + /** + * @brief Generating functions. + */ + template + result_type + operator()(_UniformRandomNumberGenerator& __urng) + { return this->operator()(__urng, _M_param); } + + template + result_type + operator()(_UniformRandomNumberGenerator& __urng, + const param_type& __p); + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate(__f, __t, __urng, _M_param); } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + /** + * @brief Return true if two binomial distributions have + * the same parameters and the sequences that would + * be generated are equal. + */ + friend bool + operator==(const binomial_distribution& __d1, + const binomial_distribution& __d2) +#ifdef _GLIBCXX_USE_C99_MATH_TR1 + { return __d1._M_param == __d2._M_param && __d1._M_nd == __d2._M_nd; } +#else + { return __d1._M_param == __d2._M_param; } +#endif + + /** + * @brief Inserts a %binomial_distribution random number distribution + * @p __x into the output stream @p __os. + * + * @param __os An output stream. + * @param __x A %binomial_distribution random number distribution. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + friend std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::binomial_distribution<_IntType1>& __x); + + /** + * @brief Extracts a %binomial_distribution random number distribution + * @p __x from the input stream @p __is. + * + * @param __is An input stream. + * @param __x A %binomial_distribution random number generator engine. + * + * @returns The input stream with @p __x extracted or in an error + * state. + */ + template + friend std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::binomial_distribution<_IntType1>& __x); + + private: + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p); + + template + result_type + _M_waiting(_UniformRandomNumberGenerator& __urng, + _IntType __t, double __q); + + param_type _M_param; + + // NB: Unused when _GLIBCXX_USE_C99_MATH_TR1 is undefined. + std::normal_distribution _M_nd; + }; + + /** + * @brief Return true if two binomial distributions are different. + */ + template + inline bool + operator!=(const std::binomial_distribution<_IntType>& __d1, + const std::binomial_distribution<_IntType>& __d2) + { return !(__d1 == __d2); } + + + /** + * @brief A discrete geometric random number distribution. + * + * The formula for the geometric probability density function is + * @f$p(i|p) = p(1 - p)^{i}@f$ where @f$p@f$ is the parameter of the + * distribution. + */ + template + class geometric_distribution + { + static_assert(std::is_integral<_IntType>::value, + "result_type must be an integral type"); + + public: + /** The type of the range of the distribution. */ + typedef _IntType result_type; + + /** Parameter type. */ + struct param_type + { + typedef geometric_distribution<_IntType> distribution_type; + friend class geometric_distribution<_IntType>; + + explicit + param_type(double __p = 0.5) + : _M_p(__p) + { + __glibcxx_assert((_M_p > 0.0) && (_M_p < 1.0)); + _M_initialize(); + } + + double + p() const + { return _M_p; } + + friend bool + operator==(const param_type& __p1, const param_type& __p2) + { return __p1._M_p == __p2._M_p; } + + friend bool + operator!=(const param_type& __p1, const param_type& __p2) + { return !(__p1 == __p2); } + + private: + void + _M_initialize() + { _M_log_1_p = std::log(1.0 - _M_p); } + + double _M_p; + + double _M_log_1_p; + }; + + // constructors and member function + explicit + geometric_distribution(double __p = 0.5) + : _M_param(__p) + { } + + explicit + geometric_distribution(const param_type& __p) + : _M_param(__p) + { } + + /** + * @brief Resets the distribution state. + * + * Does nothing for the geometric distribution. + */ + void + reset() { } + + /** + * @brief Returns the distribution parameter @p p. + */ + double + p() const + { return _M_param.p(); } + + /** + * @brief Returns the parameter set of the distribution. + */ + param_type + param() const + { return _M_param; } + + /** + * @brief Sets the parameter set of the distribution. + * @param __param The new parameter set of the distribution. + */ + void + param(const param_type& __param) + { _M_param = __param; } + + /** + * @brief Returns the greatest lower bound value of the distribution. + */ + result_type + min() const + { return 0; } + + /** + * @brief Returns the least upper bound value of the distribution. + */ + result_type + max() const + { return std::numeric_limits::max(); } + + /** + * @brief Generating functions. + */ + template + result_type + operator()(_UniformRandomNumberGenerator& __urng) + { return this->operator()(__urng, _M_param); } + + template + result_type + operator()(_UniformRandomNumberGenerator& __urng, + const param_type& __p); + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate(__f, __t, __urng, _M_param); } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + /** + * @brief Return true if two geometric distributions have + * the same parameters. + */ + friend bool + operator==(const geometric_distribution& __d1, + const geometric_distribution& __d2) + { return __d1._M_param == __d2._M_param; } + + private: + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p); + + param_type _M_param; + }; + + /** + * @brief Return true if two geometric distributions have + * different parameters. + */ + template + inline bool + operator!=(const std::geometric_distribution<_IntType>& __d1, + const std::geometric_distribution<_IntType>& __d2) + { return !(__d1 == __d2); } + + /** + * @brief Inserts a %geometric_distribution random number distribution + * @p __x into the output stream @p __os. + * + * @param __os An output stream. + * @param __x A %geometric_distribution random number distribution. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::geometric_distribution<_IntType>& __x); + + /** + * @brief Extracts a %geometric_distribution random number distribution + * @p __x from the input stream @p __is. + * + * @param __is An input stream. + * @param __x A %geometric_distribution random number generator engine. + * + * @returns The input stream with @p __x extracted or in an error state. + */ + template + std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::geometric_distribution<_IntType>& __x); + + + /** + * @brief A negative_binomial_distribution random number distribution. + * + * The formula for the negative binomial probability mass function is + * @f$p(i) = \binom{n}{i} p^i (1 - p)^{t - i}@f$ where @f$t@f$ + * and @f$p@f$ are the parameters of the distribution. + */ + template + class negative_binomial_distribution + { + static_assert(std::is_integral<_IntType>::value, + "result_type must be an integral type"); + + public: + /** The type of the range of the distribution. */ + typedef _IntType result_type; + + /** Parameter type. */ + struct param_type + { + typedef negative_binomial_distribution<_IntType> distribution_type; + + explicit + param_type(_IntType __k = 1, double __p = 0.5) + : _M_k(__k), _M_p(__p) + { + __glibcxx_assert((_M_k > 0) && (_M_p > 0.0) && (_M_p <= 1.0)); + } + + _IntType + k() const + { return _M_k; } + + double + p() const + { return _M_p; } + + friend bool + operator==(const param_type& __p1, const param_type& __p2) + { return __p1._M_k == __p2._M_k && __p1._M_p == __p2._M_p; } + + friend bool + operator!=(const param_type& __p1, const param_type& __p2) + { return !(__p1 == __p2); } + + private: + _IntType _M_k; + double _M_p; + }; + + explicit + negative_binomial_distribution(_IntType __k = 1, double __p = 0.5) + : _M_param(__k, __p), _M_gd(__k, (1.0 - __p) / __p) + { } + + explicit + negative_binomial_distribution(const param_type& __p) + : _M_param(__p), _M_gd(__p.k(), (1.0 - __p.p()) / __p.p()) + { } + + /** + * @brief Resets the distribution state. + */ + void + reset() + { _M_gd.reset(); } + + /** + * @brief Return the @f$k@f$ parameter of the distribution. + */ + _IntType + k() const + { return _M_param.k(); } + + /** + * @brief Return the @f$p@f$ parameter of the distribution. + */ + double + p() const + { return _M_param.p(); } + + /** + * @brief Returns the parameter set of the distribution. + */ + param_type + param() const + { return _M_param; } + + /** + * @brief Sets the parameter set of the distribution. + * @param __param The new parameter set of the distribution. + */ + void + param(const param_type& __param) + { _M_param = __param; } + + /** + * @brief Returns the greatest lower bound value of the distribution. + */ + result_type + min() const + { return result_type(0); } + + /** + * @brief Returns the least upper bound value of the distribution. + */ + result_type + max() const + { return std::numeric_limits::max(); } + + /** + * @brief Generating functions. + */ + template + result_type + operator()(_UniformRandomNumberGenerator& __urng); + + template + result_type + operator()(_UniformRandomNumberGenerator& __urng, + const param_type& __p); + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate_impl(__f, __t, __urng); } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate_impl(__f, __t, __urng); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + /** + * @brief Return true if two negative binomial distributions have + * the same parameters and the sequences that would be + * generated are equal. + */ + friend bool + operator==(const negative_binomial_distribution& __d1, + const negative_binomial_distribution& __d2) + { return __d1._M_param == __d2._M_param && __d1._M_gd == __d2._M_gd; } + + /** + * @brief Inserts a %negative_binomial_distribution random + * number distribution @p __x into the output stream @p __os. + * + * @param __os An output stream. + * @param __x A %negative_binomial_distribution random number + * distribution. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + friend std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::negative_binomial_distribution<_IntType1>& __x); + + /** + * @brief Extracts a %negative_binomial_distribution random number + * distribution @p __x from the input stream @p __is. + * + * @param __is An input stream. + * @param __x A %negative_binomial_distribution random number + * generator engine. + * + * @returns The input stream with @p __x extracted or in an error state. + */ + template + friend std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::negative_binomial_distribution<_IntType1>& __x); + + private: + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng); + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p); + + param_type _M_param; + + std::gamma_distribution _M_gd; + }; + + /** + * @brief Return true if two negative binomial distributions are different. + */ + template + inline bool + operator!=(const std::negative_binomial_distribution<_IntType>& __d1, + const std::negative_binomial_distribution<_IntType>& __d2) + { return !(__d1 == __d2); } + + + /* @} */ // group random_distributions_bernoulli + + /** + * @addtogroup random_distributions_poisson Poisson Distributions + * @ingroup random_distributions + * @{ + */ + + /** + * @brief A discrete Poisson random number distribution. + * + * The formula for the Poisson probability density function is + * @f$p(i|\mu) = \frac{\mu^i}{i!} e^{-\mu}@f$ where @f$\mu@f$ is the + * parameter of the distribution. + */ + template + class poisson_distribution + { + static_assert(std::is_integral<_IntType>::value, + "result_type must be an integral type"); + + public: + /** The type of the range of the distribution. */ + typedef _IntType result_type; + + /** Parameter type. */ + struct param_type + { + typedef poisson_distribution<_IntType> distribution_type; + friend class poisson_distribution<_IntType>; + + explicit + param_type(double __mean = 1.0) + : _M_mean(__mean) + { + __glibcxx_assert(_M_mean > 0.0); + _M_initialize(); + } + + double + mean() const + { return _M_mean; } + + friend bool + operator==(const param_type& __p1, const param_type& __p2) + { return __p1._M_mean == __p2._M_mean; } + + friend bool + operator!=(const param_type& __p1, const param_type& __p2) + { return !(__p1 == __p2); } + + private: + // Hosts either log(mean) or the threshold of the simple method. + void + _M_initialize(); + + double _M_mean; + + double _M_lm_thr; +#if _GLIBCXX_USE_C99_MATH_TR1 + double _M_lfm, _M_sm, _M_d, _M_scx, _M_1cx, _M_c2b, _M_cb; +#endif + }; + + // constructors and member function + explicit + poisson_distribution(double __mean = 1.0) + : _M_param(__mean), _M_nd() + { } + + explicit + poisson_distribution(const param_type& __p) + : _M_param(__p), _M_nd() + { } + + /** + * @brief Resets the distribution state. + */ + void + reset() + { _M_nd.reset(); } + + /** + * @brief Returns the distribution parameter @p mean. + */ + double + mean() const + { return _M_param.mean(); } + + /** + * @brief Returns the parameter set of the distribution. + */ + param_type + param() const + { return _M_param; } + + /** + * @brief Sets the parameter set of the distribution. + * @param __param The new parameter set of the distribution. + */ + void + param(const param_type& __param) + { _M_param = __param; } + + /** + * @brief Returns the greatest lower bound value of the distribution. + */ + result_type + min() const + { return 0; } + + /** + * @brief Returns the least upper bound value of the distribution. + */ + result_type + max() const + { return std::numeric_limits::max(); } + + /** + * @brief Generating functions. + */ + template + result_type + operator()(_UniformRandomNumberGenerator& __urng) + { return this->operator()(__urng, _M_param); } + + template + result_type + operator()(_UniformRandomNumberGenerator& __urng, + const param_type& __p); + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate(__f, __t, __urng, _M_param); } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + /** + * @brief Return true if two Poisson distributions have the same + * parameters and the sequences that would be generated + * are equal. + */ + friend bool + operator==(const poisson_distribution& __d1, + const poisson_distribution& __d2) +#ifdef _GLIBCXX_USE_C99_MATH_TR1 + { return __d1._M_param == __d2._M_param && __d1._M_nd == __d2._M_nd; } +#else + { return __d1._M_param == __d2._M_param; } +#endif + + /** + * @brief Inserts a %poisson_distribution random number distribution + * @p __x into the output stream @p __os. + * + * @param __os An output stream. + * @param __x A %poisson_distribution random number distribution. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + friend std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::poisson_distribution<_IntType1>& __x); + + /** + * @brief Extracts a %poisson_distribution random number distribution + * @p __x from the input stream @p __is. + * + * @param __is An input stream. + * @param __x A %poisson_distribution random number generator engine. + * + * @returns The input stream with @p __x extracted or in an error + * state. + */ + template + friend std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::poisson_distribution<_IntType1>& __x); + + private: + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p); + + param_type _M_param; + + // NB: Unused when _GLIBCXX_USE_C99_MATH_TR1 is undefined. + std::normal_distribution _M_nd; + }; + + /** + * @brief Return true if two Poisson distributions are different. + */ + template + inline bool + operator!=(const std::poisson_distribution<_IntType>& __d1, + const std::poisson_distribution<_IntType>& __d2) + { return !(__d1 == __d2); } + + + /** + * @brief An exponential continuous distribution for random numbers. + * + * The formula for the exponential probability density function is + * @f$p(x|\lambda) = \lambda e^{-\lambda x}@f$. + * + * + * + * + * + * + * + * + *
Distribution Statistics
Mean@f$\frac{1}{\lambda}@f$
Median@f$\frac{\ln 2}{\lambda}@f$
Mode@f$zero@f$
Range@f$[0, \infty]@f$
Standard Deviation@f$\frac{1}{\lambda}@f$
+ */ + template + class exponential_distribution + { + static_assert(std::is_floating_point<_RealType>::value, + "result_type must be a floating point type"); + + public: + /** The type of the range of the distribution. */ + typedef _RealType result_type; + + /** Parameter type. */ + struct param_type + { + typedef exponential_distribution<_RealType> distribution_type; + + explicit + param_type(_RealType __lambda = _RealType(1)) + : _M_lambda(__lambda) + { + __glibcxx_assert(_M_lambda > _RealType(0)); + } + + _RealType + lambda() const + { return _M_lambda; } + + friend bool + operator==(const param_type& __p1, const param_type& __p2) + { return __p1._M_lambda == __p2._M_lambda; } + + friend bool + operator!=(const param_type& __p1, const param_type& __p2) + { return !(__p1 == __p2); } + + private: + _RealType _M_lambda; + }; + + public: + /** + * @brief Constructs an exponential distribution with inverse scale + * parameter @f$\lambda@f$. + */ + explicit + exponential_distribution(const result_type& __lambda = result_type(1)) + : _M_param(__lambda) + { } + + explicit + exponential_distribution(const param_type& __p) + : _M_param(__p) + { } + + /** + * @brief Resets the distribution state. + * + * Has no effect on exponential distributions. + */ + void + reset() { } + + /** + * @brief Returns the inverse scale parameter of the distribution. + */ + _RealType + lambda() const + { return _M_param.lambda(); } + + /** + * @brief Returns the parameter set of the distribution. + */ + param_type + param() const + { return _M_param; } + + /** + * @brief Sets the parameter set of the distribution. + * @param __param The new parameter set of the distribution. + */ + void + param(const param_type& __param) + { _M_param = __param; } + + /** + * @brief Returns the greatest lower bound value of the distribution. + */ + result_type + min() const + { return result_type(0); } + + /** + * @brief Returns the least upper bound value of the distribution. + */ + result_type + max() const + { return std::numeric_limits::max(); } + + /** + * @brief Generating functions. + */ + template + result_type + operator()(_UniformRandomNumberGenerator& __urng) + { return this->operator()(__urng, _M_param); } + + template + result_type + operator()(_UniformRandomNumberGenerator& __urng, + const param_type& __p) + { + __detail::_Adaptor<_UniformRandomNumberGenerator, result_type> + __aurng(__urng); + return -std::log(result_type(1) - __aurng()) / __p.lambda(); + } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate(__f, __t, __urng, _M_param); } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + /** + * @brief Return true if two exponential distributions have the same + * parameters. + */ + friend bool + operator==(const exponential_distribution& __d1, + const exponential_distribution& __d2) + { return __d1._M_param == __d2._M_param; } + + private: + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p); + + param_type _M_param; + }; + + /** + * @brief Return true if two exponential distributions have different + * parameters. + */ + template + inline bool + operator!=(const std::exponential_distribution<_RealType>& __d1, + const std::exponential_distribution<_RealType>& __d2) + { return !(__d1 == __d2); } + + /** + * @brief Inserts a %exponential_distribution random number distribution + * @p __x into the output stream @p __os. + * + * @param __os An output stream. + * @param __x A %exponential_distribution random number distribution. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::exponential_distribution<_RealType>& __x); + + /** + * @brief Extracts a %exponential_distribution random number distribution + * @p __x from the input stream @p __is. + * + * @param __is An input stream. + * @param __x A %exponential_distribution random number + * generator engine. + * + * @returns The input stream with @p __x extracted or in an error state. + */ + template + std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::exponential_distribution<_RealType>& __x); + + + /** + * @brief A weibull_distribution random number distribution. + * + * The formula for the normal probability density function is: + * @f[ + * p(x|\alpha,\beta) = \frac{\alpha}{\beta} (\frac{x}{\beta})^{\alpha-1} + * \exp{(-(\frac{x}{\beta})^\alpha)} + * @f] + */ + template + class weibull_distribution + { + static_assert(std::is_floating_point<_RealType>::value, + "result_type must be a floating point type"); + + public: + /** The type of the range of the distribution. */ + typedef _RealType result_type; + + /** Parameter type. */ + struct param_type + { + typedef weibull_distribution<_RealType> distribution_type; + + explicit + param_type(_RealType __a = _RealType(1), + _RealType __b = _RealType(1)) + : _M_a(__a), _M_b(__b) + { } + + _RealType + a() const + { return _M_a; } + + _RealType + b() const + { return _M_b; } + + friend bool + operator==(const param_type& __p1, const param_type& __p2) + { return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; } + + friend bool + operator!=(const param_type& __p1, const param_type& __p2) + { return !(__p1 == __p2); } + + private: + _RealType _M_a; + _RealType _M_b; + }; + + explicit + weibull_distribution(_RealType __a = _RealType(1), + _RealType __b = _RealType(1)) + : _M_param(__a, __b) + { } + + explicit + weibull_distribution(const param_type& __p) + : _M_param(__p) + { } + + /** + * @brief Resets the distribution state. + */ + void + reset() + { } + + /** + * @brief Return the @f$a@f$ parameter of the distribution. + */ + _RealType + a() const + { return _M_param.a(); } + + /** + * @brief Return the @f$b@f$ parameter of the distribution. + */ + _RealType + b() const + { return _M_param.b(); } + + /** + * @brief Returns the parameter set of the distribution. + */ + param_type + param() const + { return _M_param; } + + /** + * @brief Sets the parameter set of the distribution. + * @param __param The new parameter set of the distribution. + */ + void + param(const param_type& __param) + { _M_param = __param; } + + /** + * @brief Returns the greatest lower bound value of the distribution. + */ + result_type + min() const + { return result_type(0); } + + /** + * @brief Returns the least upper bound value of the distribution. + */ + result_type + max() const + { return std::numeric_limits::max(); } + + /** + * @brief Generating functions. + */ + template + result_type + operator()(_UniformRandomNumberGenerator& __urng) + { return this->operator()(__urng, _M_param); } + + template + result_type + operator()(_UniformRandomNumberGenerator& __urng, + const param_type& __p); + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate(__f, __t, __urng, _M_param); } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + /** + * @brief Return true if two Weibull distributions have the same + * parameters. + */ + friend bool + operator==(const weibull_distribution& __d1, + const weibull_distribution& __d2) + { return __d1._M_param == __d2._M_param; } + + private: + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p); + + param_type _M_param; + }; + + /** + * @brief Return true if two Weibull distributions have different + * parameters. + */ + template + inline bool + operator!=(const std::weibull_distribution<_RealType>& __d1, + const std::weibull_distribution<_RealType>& __d2) + { return !(__d1 == __d2); } + + /** + * @brief Inserts a %weibull_distribution random number distribution + * @p __x into the output stream @p __os. + * + * @param __os An output stream. + * @param __x A %weibull_distribution random number distribution. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::weibull_distribution<_RealType>& __x); + + /** + * @brief Extracts a %weibull_distribution random number distribution + * @p __x from the input stream @p __is. + * + * @param __is An input stream. + * @param __x A %weibull_distribution random number + * generator engine. + * + * @returns The input stream with @p __x extracted or in an error state. + */ + template + std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::weibull_distribution<_RealType>& __x); + + + /** + * @brief A extreme_value_distribution random number distribution. + * + * The formula for the normal probability mass function is + * @f[ + * p(x|a,b) = \frac{1}{b} + * \exp( \frac{a-x}{b} - \exp(\frac{a-x}{b})) + * @f] + */ + template + class extreme_value_distribution + { + static_assert(std::is_floating_point<_RealType>::value, + "result_type must be a floating point type"); + + public: + /** The type of the range of the distribution. */ + typedef _RealType result_type; + + /** Parameter type. */ + struct param_type + { + typedef extreme_value_distribution<_RealType> distribution_type; + + explicit + param_type(_RealType __a = _RealType(0), + _RealType __b = _RealType(1)) + : _M_a(__a), _M_b(__b) + { } + + _RealType + a() const + { return _M_a; } + + _RealType + b() const + { return _M_b; } + + friend bool + operator==(const param_type& __p1, const param_type& __p2) + { return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; } + + friend bool + operator!=(const param_type& __p1, const param_type& __p2) + { return !(__p1 == __p2); } + + private: + _RealType _M_a; + _RealType _M_b; + }; + + explicit + extreme_value_distribution(_RealType __a = _RealType(0), + _RealType __b = _RealType(1)) + : _M_param(__a, __b) + { } + + explicit + extreme_value_distribution(const param_type& __p) + : _M_param(__p) + { } + + /** + * @brief Resets the distribution state. + */ + void + reset() + { } + + /** + * @brief Return the @f$a@f$ parameter of the distribution. + */ + _RealType + a() const + { return _M_param.a(); } + + /** + * @brief Return the @f$b@f$ parameter of the distribution. + */ + _RealType + b() const + { return _M_param.b(); } + + /** + * @brief Returns the parameter set of the distribution. + */ + param_type + param() const + { return _M_param; } + + /** + * @brief Sets the parameter set of the distribution. + * @param __param The new parameter set of the distribution. + */ + void + param(const param_type& __param) + { _M_param = __param; } + + /** + * @brief Returns the greatest lower bound value of the distribution. + */ + result_type + min() const + { return std::numeric_limits::lowest(); } + + /** + * @brief Returns the least upper bound value of the distribution. + */ + result_type + max() const + { return std::numeric_limits::max(); } + + /** + * @brief Generating functions. + */ + template + result_type + operator()(_UniformRandomNumberGenerator& __urng) + { return this->operator()(__urng, _M_param); } + + template + result_type + operator()(_UniformRandomNumberGenerator& __urng, + const param_type& __p); + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate(__f, __t, __urng, _M_param); } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + /** + * @brief Return true if two extreme value distributions have the same + * parameters. + */ + friend bool + operator==(const extreme_value_distribution& __d1, + const extreme_value_distribution& __d2) + { return __d1._M_param == __d2._M_param; } + + private: + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p); + + param_type _M_param; + }; + + /** + * @brief Return true if two extreme value distributions have different + * parameters. + */ + template + inline bool + operator!=(const std::extreme_value_distribution<_RealType>& __d1, + const std::extreme_value_distribution<_RealType>& __d2) + { return !(__d1 == __d2); } + + /** + * @brief Inserts a %extreme_value_distribution random number distribution + * @p __x into the output stream @p __os. + * + * @param __os An output stream. + * @param __x A %extreme_value_distribution random number distribution. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::extreme_value_distribution<_RealType>& __x); + + /** + * @brief Extracts a %extreme_value_distribution random number + * distribution @p __x from the input stream @p __is. + * + * @param __is An input stream. + * @param __x A %extreme_value_distribution random number + * generator engine. + * + * @returns The input stream with @p __x extracted or in an error state. + */ + template + std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::extreme_value_distribution<_RealType>& __x); + + + /** + * @brief A discrete_distribution random number distribution. + * + * The formula for the discrete probability mass function is + * + */ + template + class discrete_distribution + { + static_assert(std::is_integral<_IntType>::value, + "result_type must be an integral type"); + + public: + /** The type of the range of the distribution. */ + typedef _IntType result_type; + + /** Parameter type. */ + struct param_type + { + typedef discrete_distribution<_IntType> distribution_type; + friend class discrete_distribution<_IntType>; + + param_type() + : _M_prob(), _M_cp() + { } + + template + param_type(_InputIterator __wbegin, + _InputIterator __wend) + : _M_prob(__wbegin, __wend), _M_cp() + { _M_initialize(); } + + param_type(initializer_list __wil) + : _M_prob(__wil.begin(), __wil.end()), _M_cp() + { _M_initialize(); } + + template + param_type(size_t __nw, double __xmin, double __xmax, + _Func __fw); + + // See: http://cpp-next.com/archive/2010/10/implicit-move-must-go/ + param_type(const param_type&) = default; + param_type& operator=(const param_type&) = default; + + std::vector + probabilities() const + { return _M_prob.empty() ? std::vector(1, 1.0) : _M_prob; } + + friend bool + operator==(const param_type& __p1, const param_type& __p2) + { return __p1._M_prob == __p2._M_prob; } + + friend bool + operator!=(const param_type& __p1, const param_type& __p2) + { return !(__p1 == __p2); } + + private: + void + _M_initialize(); + + std::vector _M_prob; + std::vector _M_cp; + }; + + discrete_distribution() + : _M_param() + { } + + template + discrete_distribution(_InputIterator __wbegin, + _InputIterator __wend) + : _M_param(__wbegin, __wend) + { } + + discrete_distribution(initializer_list __wl) + : _M_param(__wl) + { } + + template + discrete_distribution(size_t __nw, double __xmin, double __xmax, + _Func __fw) + : _M_param(__nw, __xmin, __xmax, __fw) + { } + + explicit + discrete_distribution(const param_type& __p) + : _M_param(__p) + { } + + /** + * @brief Resets the distribution state. + */ + void + reset() + { } + + /** + * @brief Returns the probabilities of the distribution. + */ + std::vector + probabilities() const + { + return _M_param._M_prob.empty() + ? std::vector(1, 1.0) : _M_param._M_prob; + } + + /** + * @brief Returns the parameter set of the distribution. + */ + param_type + param() const + { return _M_param; } + + /** + * @brief Sets the parameter set of the distribution. + * @param __param The new parameter set of the distribution. + */ + void + param(const param_type& __param) + { _M_param = __param; } + + /** + * @brief Returns the greatest lower bound value of the distribution. + */ + result_type + min() const + { return result_type(0); } + + /** + * @brief Returns the least upper bound value of the distribution. + */ + result_type + max() const + { + return _M_param._M_prob.empty() + ? result_type(0) : result_type(_M_param._M_prob.size() - 1); + } + + /** + * @brief Generating functions. + */ + template + result_type + operator()(_UniformRandomNumberGenerator& __urng) + { return this->operator()(__urng, _M_param); } + + template + result_type + operator()(_UniformRandomNumberGenerator& __urng, + const param_type& __p); + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate(__f, __t, __urng, _M_param); } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + /** + * @brief Return true if two discrete distributions have the same + * parameters. + */ + friend bool + operator==(const discrete_distribution& __d1, + const discrete_distribution& __d2) + { return __d1._M_param == __d2._M_param; } + + /** + * @brief Inserts a %discrete_distribution random number distribution + * @p __x into the output stream @p __os. + * + * @param __os An output stream. + * @param __x A %discrete_distribution random number distribution. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + friend std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::discrete_distribution<_IntType1>& __x); + + /** + * @brief Extracts a %discrete_distribution random number distribution + * @p __x from the input stream @p __is. + * + * @param __is An input stream. + * @param __x A %discrete_distribution random number + * generator engine. + * + * @returns The input stream with @p __x extracted or in an error + * state. + */ + template + friend std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::discrete_distribution<_IntType1>& __x); + + private: + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p); + + param_type _M_param; + }; + + /** + * @brief Return true if two discrete distributions have different + * parameters. + */ + template + inline bool + operator!=(const std::discrete_distribution<_IntType>& __d1, + const std::discrete_distribution<_IntType>& __d2) + { return !(__d1 == __d2); } + + + /** + * @brief A piecewise_constant_distribution random number distribution. + * + * The formula for the piecewise constant probability mass function is + * + */ + template + class piecewise_constant_distribution + { + static_assert(std::is_floating_point<_RealType>::value, + "result_type must be a floating point type"); + + public: + /** The type of the range of the distribution. */ + typedef _RealType result_type; + + /** Parameter type. */ + struct param_type + { + typedef piecewise_constant_distribution<_RealType> distribution_type; + friend class piecewise_constant_distribution<_RealType>; + + param_type() + : _M_int(), _M_den(), _M_cp() + { } + + template + param_type(_InputIteratorB __bfirst, + _InputIteratorB __bend, + _InputIteratorW __wbegin); + + template + param_type(initializer_list<_RealType> __bi, _Func __fw); + + template + param_type(size_t __nw, _RealType __xmin, _RealType __xmax, + _Func __fw); + + // See: http://cpp-next.com/archive/2010/10/implicit-move-must-go/ + param_type(const param_type&) = default; + param_type& operator=(const param_type&) = default; + + std::vector<_RealType> + intervals() const + { + if (_M_int.empty()) + { + std::vector<_RealType> __tmp(2); + __tmp[1] = _RealType(1); + return __tmp; + } + else + return _M_int; + } + + std::vector + densities() const + { return _M_den.empty() ? std::vector(1, 1.0) : _M_den; } + + friend bool + operator==(const param_type& __p1, const param_type& __p2) + { return __p1._M_int == __p2._M_int && __p1._M_den == __p2._M_den; } + + friend bool + operator!=(const param_type& __p1, const param_type& __p2) + { return !(__p1 == __p2); } + + private: + void + _M_initialize(); + + std::vector<_RealType> _M_int; + std::vector _M_den; + std::vector _M_cp; + }; + + explicit + piecewise_constant_distribution() + : _M_param() + { } + + template + piecewise_constant_distribution(_InputIteratorB __bfirst, + _InputIteratorB __bend, + _InputIteratorW __wbegin) + : _M_param(__bfirst, __bend, __wbegin) + { } + + template + piecewise_constant_distribution(initializer_list<_RealType> __bl, + _Func __fw) + : _M_param(__bl, __fw) + { } + + template + piecewise_constant_distribution(size_t __nw, + _RealType __xmin, _RealType __xmax, + _Func __fw) + : _M_param(__nw, __xmin, __xmax, __fw) + { } + + explicit + piecewise_constant_distribution(const param_type& __p) + : _M_param(__p) + { } + + /** + * @brief Resets the distribution state. + */ + void + reset() + { } + + /** + * @brief Returns a vector of the intervals. + */ + std::vector<_RealType> + intervals() const + { + if (_M_param._M_int.empty()) + { + std::vector<_RealType> __tmp(2); + __tmp[1] = _RealType(1); + return __tmp; + } + else + return _M_param._M_int; + } + + /** + * @brief Returns a vector of the probability densities. + */ + std::vector + densities() const + { + return _M_param._M_den.empty() + ? std::vector(1, 1.0) : _M_param._M_den; + } + + /** + * @brief Returns the parameter set of the distribution. + */ + param_type + param() const + { return _M_param; } + + /** + * @brief Sets the parameter set of the distribution. + * @param __param The new parameter set of the distribution. + */ + void + param(const param_type& __param) + { _M_param = __param; } + + /** + * @brief Returns the greatest lower bound value of the distribution. + */ + result_type + min() const + { + return _M_param._M_int.empty() + ? result_type(0) : _M_param._M_int.front(); + } + + /** + * @brief Returns the least upper bound value of the distribution. + */ + result_type + max() const + { + return _M_param._M_int.empty() + ? result_type(1) : _M_param._M_int.back(); + } + + /** + * @brief Generating functions. + */ + template + result_type + operator()(_UniformRandomNumberGenerator& __urng) + { return this->operator()(__urng, _M_param); } + + template + result_type + operator()(_UniformRandomNumberGenerator& __urng, + const param_type& __p); + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate(__f, __t, __urng, _M_param); } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + /** + * @brief Return true if two piecewise constant distributions have the + * same parameters. + */ + friend bool + operator==(const piecewise_constant_distribution& __d1, + const piecewise_constant_distribution& __d2) + { return __d1._M_param == __d2._M_param; } + + /** + * @brief Inserts a %piecewise_constant_distribution random + * number distribution @p __x into the output stream @p __os. + * + * @param __os An output stream. + * @param __x A %piecewise_constant_distribution random number + * distribution. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + friend std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::piecewise_constant_distribution<_RealType1>& __x); + + /** + * @brief Extracts a %piecewise_constant_distribution random + * number distribution @p __x from the input stream @p __is. + * + * @param __is An input stream. + * @param __x A %piecewise_constant_distribution random number + * generator engine. + * + * @returns The input stream with @p __x extracted or in an error + * state. + */ + template + friend std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::piecewise_constant_distribution<_RealType1>& __x); + + private: + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p); + + param_type _M_param; + }; + + /** + * @brief Return true if two piecewise constant distributions have + * different parameters. + */ + template + inline bool + operator!=(const std::piecewise_constant_distribution<_RealType>& __d1, + const std::piecewise_constant_distribution<_RealType>& __d2) + { return !(__d1 == __d2); } + + + /** + * @brief A piecewise_linear_distribution random number distribution. + * + * The formula for the piecewise linear probability mass function is + * + */ + template + class piecewise_linear_distribution + { + static_assert(std::is_floating_point<_RealType>::value, + "result_type must be a floating point type"); + + public: + /** The type of the range of the distribution. */ + typedef _RealType result_type; + + /** Parameter type. */ + struct param_type + { + typedef piecewise_linear_distribution<_RealType> distribution_type; + friend class piecewise_linear_distribution<_RealType>; + + param_type() + : _M_int(), _M_den(), _M_cp(), _M_m() + { } + + template + param_type(_InputIteratorB __bfirst, + _InputIteratorB __bend, + _InputIteratorW __wbegin); + + template + param_type(initializer_list<_RealType> __bl, _Func __fw); + + template + param_type(size_t __nw, _RealType __xmin, _RealType __xmax, + _Func __fw); + + // See: http://cpp-next.com/archive/2010/10/implicit-move-must-go/ + param_type(const param_type&) = default; + param_type& operator=(const param_type&) = default; + + std::vector<_RealType> + intervals() const + { + if (_M_int.empty()) + { + std::vector<_RealType> __tmp(2); + __tmp[1] = _RealType(1); + return __tmp; + } + else + return _M_int; + } + + std::vector + densities() const + { return _M_den.empty() ? std::vector(2, 1.0) : _M_den; } + + friend bool + operator==(const param_type& __p1, const param_type& __p2) + { return __p1._M_int == __p2._M_int && __p1._M_den == __p2._M_den; } + + friend bool + operator!=(const param_type& __p1, const param_type& __p2) + { return !(__p1 == __p2); } + + private: + void + _M_initialize(); + + std::vector<_RealType> _M_int; + std::vector _M_den; + std::vector _M_cp; + std::vector _M_m; + }; + + explicit + piecewise_linear_distribution() + : _M_param() + { } + + template + piecewise_linear_distribution(_InputIteratorB __bfirst, + _InputIteratorB __bend, + _InputIteratorW __wbegin) + : _M_param(__bfirst, __bend, __wbegin) + { } + + template + piecewise_linear_distribution(initializer_list<_RealType> __bl, + _Func __fw) + : _M_param(__bl, __fw) + { } + + template + piecewise_linear_distribution(size_t __nw, + _RealType __xmin, _RealType __xmax, + _Func __fw) + : _M_param(__nw, __xmin, __xmax, __fw) + { } + + explicit + piecewise_linear_distribution(const param_type& __p) + : _M_param(__p) + { } + + /** + * Resets the distribution state. + */ + void + reset() + { } + + /** + * @brief Return the intervals of the distribution. + */ + std::vector<_RealType> + intervals() const + { + if (_M_param._M_int.empty()) + { + std::vector<_RealType> __tmp(2); + __tmp[1] = _RealType(1); + return __tmp; + } + else + return _M_param._M_int; + } + + /** + * @brief Return a vector of the probability densities of the + * distribution. + */ + std::vector + densities() const + { + return _M_param._M_den.empty() + ? std::vector(2, 1.0) : _M_param._M_den; + } + + /** + * @brief Returns the parameter set of the distribution. + */ + param_type + param() const + { return _M_param; } + + /** + * @brief Sets the parameter set of the distribution. + * @param __param The new parameter set of the distribution. + */ + void + param(const param_type& __param) + { _M_param = __param; } + + /** + * @brief Returns the greatest lower bound value of the distribution. + */ + result_type + min() const + { + return _M_param._M_int.empty() + ? result_type(0) : _M_param._M_int.front(); + } + + /** + * @brief Returns the least upper bound value of the distribution. + */ + result_type + max() const + { + return _M_param._M_int.empty() + ? result_type(1) : _M_param._M_int.back(); + } + + /** + * @brief Generating functions. + */ + template + result_type + operator()(_UniformRandomNumberGenerator& __urng) + { return this->operator()(__urng, _M_param); } + + template + result_type + operator()(_UniformRandomNumberGenerator& __urng, + const param_type& __p); + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate(__f, __t, __urng, _M_param); } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + /** + * @brief Return true if two piecewise linear distributions have the + * same parameters. + */ + friend bool + operator==(const piecewise_linear_distribution& __d1, + const piecewise_linear_distribution& __d2) + { return __d1._M_param == __d2._M_param; } + + /** + * @brief Inserts a %piecewise_linear_distribution random number + * distribution @p __x into the output stream @p __os. + * + * @param __os An output stream. + * @param __x A %piecewise_linear_distribution random number + * distribution. + * + * @returns The output stream with the state of @p __x inserted or in + * an error state. + */ + template + friend std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const std::piecewise_linear_distribution<_RealType1>& __x); + + /** + * @brief Extracts a %piecewise_linear_distribution random number + * distribution @p __x from the input stream @p __is. + * + * @param __is An input stream. + * @param __x A %piecewise_linear_distribution random number + * generator engine. + * + * @returns The input stream with @p __x extracted or in an error + * state. + */ + template + friend std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, + std::piecewise_linear_distribution<_RealType1>& __x); + + private: + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p); + + param_type _M_param; + }; + + /** + * @brief Return true if two piecewise linear distributions have + * different parameters. + */ + template + inline bool + operator!=(const std::piecewise_linear_distribution<_RealType>& __d1, + const std::piecewise_linear_distribution<_RealType>& __d2) + { return !(__d1 == __d2); } + + + /* @} */ // group random_distributions_poisson + + /* @} */ // group random_distributions + + /** + * @addtogroup random_utilities Random Number Utilities + * @ingroup random + * @{ + */ + + /** + * @brief The seed_seq class generates sequences of seeds for random + * number generators. + */ + class seed_seq + { + public: + /** The type of the seed vales. */ + typedef uint_least32_t result_type; + + /** Default constructor. */ + seed_seq() noexcept + : _M_v() + { } + + template + seed_seq(std::initializer_list<_IntType> il); + + template + seed_seq(_InputIterator __begin, _InputIterator __end); + + // generating functions + template + void + generate(_RandomAccessIterator __begin, _RandomAccessIterator __end); + + // property functions + size_t size() const noexcept + { return _M_v.size(); } + + template + void + param(OutputIterator __dest) const + { std::copy(_M_v.begin(), _M_v.end(), __dest); } + + // no copy functions + seed_seq(const seed_seq&) = delete; + seed_seq& operator=(const seed_seq&) = delete; + + private: + std::vector _M_v; + }; + + /* @} */ // group random_utilities + + /* @} */ // group random + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/range_access.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/range_access.h new file mode 100644 index 0000000..2a037ad --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/range_access.h @@ -0,0 +1,328 @@ +// -*- C++ -*- + +// Copyright (C) 2010-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/range_access.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iterator} + */ + +#ifndef _GLIBCXX_RANGE_ACCESS_H +#define _GLIBCXX_RANGE_ACCESS_H 1 + +#pragma GCC system_header + +#if __cplusplus >= 201103L +#include +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @brief Return an iterator pointing to the first element of + * the container. + * @param __cont Container. + */ + template + inline _GLIBCXX17_CONSTEXPR auto + begin(_Container& __cont) -> decltype(__cont.begin()) + { return __cont.begin(); } + + /** + * @brief Return an iterator pointing to the first element of + * the const container. + * @param __cont Container. + */ + template + inline _GLIBCXX17_CONSTEXPR auto + begin(const _Container& __cont) -> decltype(__cont.begin()) + { return __cont.begin(); } + + /** + * @brief Return an iterator pointing to one past the last element of + * the container. + * @param __cont Container. + */ + template + inline _GLIBCXX17_CONSTEXPR auto + end(_Container& __cont) -> decltype(__cont.end()) + { return __cont.end(); } + + /** + * @brief Return an iterator pointing to one past the last element of + * the const container. + * @param __cont Container. + */ + template + inline _GLIBCXX17_CONSTEXPR auto + end(const _Container& __cont) -> decltype(__cont.end()) + { return __cont.end(); } + + /** + * @brief Return an iterator pointing to the first element of the array. + * @param __arr Array. + */ + template + inline _GLIBCXX14_CONSTEXPR _Tp* + begin(_Tp (&__arr)[_Nm]) + { return __arr; } + + /** + * @brief Return an iterator pointing to one past the last element + * of the array. + * @param __arr Array. + */ + template + inline _GLIBCXX14_CONSTEXPR _Tp* + end(_Tp (&__arr)[_Nm]) + { return __arr + _Nm; } + +#if __cplusplus >= 201402L + + template class valarray; + // These overloads must be declared for cbegin and cend to use them. + template _Tp* begin(valarray<_Tp>&); + template const _Tp* begin(const valarray<_Tp>&); + template _Tp* end(valarray<_Tp>&); + template const _Tp* end(const valarray<_Tp>&); + + /** + * @brief Return an iterator pointing to the first element of + * the const container. + * @param __cont Container. + */ + template + inline constexpr auto + cbegin(const _Container& __cont) noexcept(noexcept(std::begin(__cont))) + -> decltype(std::begin(__cont)) + { return std::begin(__cont); } + + /** + * @brief Return an iterator pointing to one past the last element of + * the const container. + * @param __cont Container. + */ + template + inline constexpr auto + cend(const _Container& __cont) noexcept(noexcept(std::end(__cont))) + -> decltype(std::end(__cont)) + { return std::end(__cont); } + + /** + * @brief Return a reverse iterator pointing to the last element of + * the container. + * @param __cont Container. + */ + template + inline _GLIBCXX17_CONSTEXPR auto + rbegin(_Container& __cont) -> decltype(__cont.rbegin()) + { return __cont.rbegin(); } + + /** + * @brief Return a reverse iterator pointing to the last element of + * the const container. + * @param __cont Container. + */ + template + inline _GLIBCXX17_CONSTEXPR auto + rbegin(const _Container& __cont) -> decltype(__cont.rbegin()) + { return __cont.rbegin(); } + + /** + * @brief Return a reverse iterator pointing one past the first element of + * the container. + * @param __cont Container. + */ + template + inline _GLIBCXX17_CONSTEXPR auto + rend(_Container& __cont) -> decltype(__cont.rend()) + { return __cont.rend(); } + + /** + * @brief Return a reverse iterator pointing one past the first element of + * the const container. + * @param __cont Container. + */ + template + inline _GLIBCXX17_CONSTEXPR auto + rend(const _Container& __cont) -> decltype(__cont.rend()) + { return __cont.rend(); } + + /** + * @brief Return a reverse iterator pointing to the last element of + * the array. + * @param __arr Array. + */ + template + inline _GLIBCXX17_CONSTEXPR reverse_iterator<_Tp*> + rbegin(_Tp (&__arr)[_Nm]) + { return reverse_iterator<_Tp*>(__arr + _Nm); } + + /** + * @brief Return a reverse iterator pointing one past the first element of + * the array. + * @param __arr Array. + */ + template + inline _GLIBCXX17_CONSTEXPR reverse_iterator<_Tp*> + rend(_Tp (&__arr)[_Nm]) + { return reverse_iterator<_Tp*>(__arr); } + + /** + * @brief Return a reverse iterator pointing to the last element of + * the initializer_list. + * @param __il initializer_list. + */ + template + inline _GLIBCXX17_CONSTEXPR reverse_iterator + rbegin(initializer_list<_Tp> __il) + { return reverse_iterator(__il.end()); } + + /** + * @brief Return a reverse iterator pointing one past the first element of + * the initializer_list. + * @param __il initializer_list. + */ + template + inline _GLIBCXX17_CONSTEXPR reverse_iterator + rend(initializer_list<_Tp> __il) + { return reverse_iterator(__il.begin()); } + + /** + * @brief Return a reverse iterator pointing to the last element of + * the const container. + * @param __cont Container. + */ + template + inline _GLIBCXX17_CONSTEXPR auto + crbegin(const _Container& __cont) -> decltype(std::rbegin(__cont)) + { return std::rbegin(__cont); } + + /** + * @brief Return a reverse iterator pointing one past the first element of + * the const container. + * @param __cont Container. + */ + template + inline _GLIBCXX17_CONSTEXPR auto + crend(const _Container& __cont) -> decltype(std::rend(__cont)) + { return std::rend(__cont); } + +#endif // C++14 + +#if __cplusplus >= 201703L +#define __cpp_lib_nonmember_container_access 201411 + + /** + * @brief Return the size of a container. + * @param __cont Container. + */ + template + constexpr auto + size(const _Container& __cont) noexcept(noexcept(__cont.size())) + -> decltype(__cont.size()) + { return __cont.size(); } + + /** + * @brief Return the size of an array. + * @param __array Array. + */ + template + constexpr size_t + size(const _Tp (&/*__array*/)[_Nm]) noexcept + { return _Nm; } + + /** + * @brief Return whether a container is empty. + * @param __cont Container. + */ + template + constexpr auto + empty(const _Container& __cont) noexcept(noexcept(__cont.empty())) + -> decltype(__cont.empty()) + { return __cont.empty(); } + + /** + * @brief Return whether an array is empty (always false). + * @param __array Container. + */ + template + constexpr bool + empty(const _Tp (&/*__array*/)[_Nm]) noexcept + { return false; } + + /** + * @brief Return whether an initializer_list is empty. + * @param __il Initializer list. + */ + template + constexpr bool + empty(initializer_list<_Tp> __il) noexcept + { return __il.size() == 0;} + + /** + * @brief Return the data pointer of a container. + * @param __cont Container. + */ + template + constexpr auto + data(_Container& __cont) noexcept(noexcept(__cont.data())) + -> decltype(__cont.data()) + { return __cont.data(); } + + /** + * @brief Return the data pointer of a const container. + * @param __cont Container. + */ + template + constexpr auto + data(const _Container& __cont) noexcept(noexcept(__cont.data())) + -> decltype(__cont.data()) + { return __cont.data(); } + + /** + * @brief Return the data pointer of an array. + * @param __array Array. + */ + template + constexpr _Tp* + data(_Tp (&__array)[_Nm]) noexcept + { return __array; } + + /** + * @brief Return the data pointer of an initializer list. + * @param __il Initializer list. + */ + template + constexpr const _Tp* + data(initializer_list<_Tp> __il) noexcept + { return __il.begin(); } + +#endif // C++17 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif // C++11 + +#endif // _GLIBCXX_RANGE_ACCESS_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/refwrap.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/refwrap.h new file mode 100644 index 0000000..86260da --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/refwrap.h @@ -0,0 +1,398 @@ +// Implementation of std::reference_wrapper -*- C++ -*- + +// Copyright (C) 2004-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/bits/bind.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{functional} + */ + +#ifndef _GLIBCXX_REFWRAP_H +#define _GLIBCXX_REFWRAP_H 1 + +#pragma GCC system_header + +#if __cplusplus < 201103L +# include +#else + +#include +#include +#include // for unary_function and binary_function + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /// If we have found a result_type, extract it. + template> + struct _Maybe_get_result_type + { }; + + template + struct _Maybe_get_result_type<_Functor, + __void_t> + { typedef typename _Functor::result_type result_type; }; + + /** + * Base class for any function object that has a weak result type, as + * defined in 20.8.2 [func.require] of C++11. + */ + template + struct _Weak_result_type_impl + : _Maybe_get_result_type<_Functor> + { }; + + /// Retrieve the result type for a function type. + template + struct _Weak_result_type_impl<_Res(_ArgTypes...) _GLIBCXX_NOEXCEPT_QUAL> + { typedef _Res result_type; }; + + template + struct _Weak_result_type_impl<_Res(_ArgTypes......) _GLIBCXX_NOEXCEPT_QUAL> + { typedef _Res result_type; }; + + template + struct _Weak_result_type_impl<_Res(_ArgTypes...) const> + { typedef _Res result_type; }; + + template + struct _Weak_result_type_impl<_Res(_ArgTypes......) const> + { typedef _Res result_type; }; + + template + struct _Weak_result_type_impl<_Res(_ArgTypes...) volatile> + { typedef _Res result_type; }; + + template + struct _Weak_result_type_impl<_Res(_ArgTypes......) volatile> + { typedef _Res result_type; }; + + template + struct _Weak_result_type_impl<_Res(_ArgTypes...) const volatile> + { typedef _Res result_type; }; + + template + struct _Weak_result_type_impl<_Res(_ArgTypes......) const volatile> + { typedef _Res result_type; }; + + /// Retrieve the result type for a function reference. + template + struct _Weak_result_type_impl<_Res(&)(_ArgTypes...)> + { typedef _Res result_type; }; + + template + struct _Weak_result_type_impl<_Res(&)(_ArgTypes......)> + { typedef _Res result_type; }; + + /// Retrieve the result type for a function pointer. + template + struct _Weak_result_type_impl<_Res(*)(_ArgTypes...) _GLIBCXX_NOEXCEPT_QUAL> + { typedef _Res result_type; }; + + template + struct _Weak_result_type_impl<_Res(*)(_ArgTypes......) + _GLIBCXX_NOEXCEPT_QUAL> + { typedef _Res result_type; }; + + /// Retrieve result type for a member function pointer. + template + struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...) + _GLIBCXX_NOEXCEPT_QUAL> + { typedef _Res result_type; }; + + template + struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes......) + _GLIBCXX_NOEXCEPT_QUAL> + { typedef _Res result_type; }; + + /// Retrieve result type for a const member function pointer. + template + struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...) const + _GLIBCXX_NOEXCEPT_QUAL> + { typedef _Res result_type; }; + + template + struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes......) const + _GLIBCXX_NOEXCEPT_QUAL> + { typedef _Res result_type; }; + + /// Retrieve result type for a volatile member function pointer. + template + struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...) volatile + _GLIBCXX_NOEXCEPT_QUAL> + { typedef _Res result_type; }; + + template + struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes......) volatile + _GLIBCXX_NOEXCEPT_QUAL> + { typedef _Res result_type; }; + + /// Retrieve result type for a const volatile member function pointer. + template + struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes...) + const volatile _GLIBCXX_NOEXCEPT_QUAL> + { typedef _Res result_type; }; + + template + struct _Weak_result_type_impl<_Res (_Class::*)(_ArgTypes......) + const volatile _GLIBCXX_NOEXCEPT_QUAL> + { typedef _Res result_type; }; + + /** + * Strip top-level cv-qualifiers from the function object and let + * _Weak_result_type_impl perform the real work. + */ + template + struct _Weak_result_type + : _Weak_result_type_impl::type> + { }; + + // Detect nested argument_type. + template> + struct _Refwrap_base_arg1 + { }; + + // Nested argument_type. + template + struct _Refwrap_base_arg1<_Tp, + __void_t> + { + typedef typename _Tp::argument_type argument_type; + }; + + // Detect nested first_argument_type and second_argument_type. + template> + struct _Refwrap_base_arg2 + { }; + + // Nested first_argument_type and second_argument_type. + template + struct _Refwrap_base_arg2<_Tp, + __void_t> + { + typedef typename _Tp::first_argument_type first_argument_type; + typedef typename _Tp::second_argument_type second_argument_type; + }; + + /** + * Derives from unary_function or binary_function when it + * can. Specializations handle all of the easy cases. The primary + * template determines what to do with a class type, which may + * derive from both unary_function and binary_function. + */ + template + struct _Reference_wrapper_base + : _Weak_result_type<_Tp>, _Refwrap_base_arg1<_Tp>, _Refwrap_base_arg2<_Tp> + { }; + + // - a function type (unary) + template + struct _Reference_wrapper_base<_Res(_T1) _GLIBCXX_NOEXCEPT_QUAL> + : unary_function<_T1, _Res> + { }; + + template + struct _Reference_wrapper_base<_Res(_T1) const> + : unary_function<_T1, _Res> + { }; + + template + struct _Reference_wrapper_base<_Res(_T1) volatile> + : unary_function<_T1, _Res> + { }; + + template + struct _Reference_wrapper_base<_Res(_T1) const volatile> + : unary_function<_T1, _Res> + { }; + + // - a function type (binary) + template + struct _Reference_wrapper_base<_Res(_T1, _T2) _GLIBCXX_NOEXCEPT_QUAL> + : binary_function<_T1, _T2, _Res> + { }; + + template + struct _Reference_wrapper_base<_Res(_T1, _T2) const> + : binary_function<_T1, _T2, _Res> + { }; + + template + struct _Reference_wrapper_base<_Res(_T1, _T2) volatile> + : binary_function<_T1, _T2, _Res> + { }; + + template + struct _Reference_wrapper_base<_Res(_T1, _T2) const volatile> + : binary_function<_T1, _T2, _Res> + { }; + + // - a function pointer type (unary) + template + struct _Reference_wrapper_base<_Res(*)(_T1) _GLIBCXX_NOEXCEPT_QUAL> + : unary_function<_T1, _Res> + { }; + + // - a function pointer type (binary) + template + struct _Reference_wrapper_base<_Res(*)(_T1, _T2) _GLIBCXX_NOEXCEPT_QUAL> + : binary_function<_T1, _T2, _Res> + { }; + + // - a pointer to member function type (unary, no qualifiers) + template + struct _Reference_wrapper_base<_Res (_T1::*)() _GLIBCXX_NOEXCEPT_QUAL> + : unary_function<_T1*, _Res> + { }; + + // - a pointer to member function type (binary, no qualifiers) + template + struct _Reference_wrapper_base<_Res (_T1::*)(_T2) _GLIBCXX_NOEXCEPT_QUAL> + : binary_function<_T1*, _T2, _Res> + { }; + + // - a pointer to member function type (unary, const) + template + struct _Reference_wrapper_base<_Res (_T1::*)() const _GLIBCXX_NOEXCEPT_QUAL> + : unary_function + { }; + + // - a pointer to member function type (binary, const) + template + struct _Reference_wrapper_base<_Res (_T1::*)(_T2) const _GLIBCXX_NOEXCEPT_QUAL> + : binary_function + { }; + + // - a pointer to member function type (unary, volatile) + template + struct _Reference_wrapper_base<_Res (_T1::*)() volatile _GLIBCXX_NOEXCEPT_QUAL> + : unary_function + { }; + + // - a pointer to member function type (binary, volatile) + template + struct _Reference_wrapper_base<_Res (_T1::*)(_T2) volatile _GLIBCXX_NOEXCEPT_QUAL> + : binary_function + { }; + + // - a pointer to member function type (unary, const volatile) + template + struct _Reference_wrapper_base<_Res (_T1::*)() const volatile _GLIBCXX_NOEXCEPT_QUAL> + : unary_function + { }; + + // - a pointer to member function type (binary, const volatile) + template + struct _Reference_wrapper_base<_Res (_T1::*)(_T2) const volatile _GLIBCXX_NOEXCEPT_QUAL> + : binary_function + { }; + + /** + * @brief Primary class template for reference_wrapper. + * @ingroup functors + * @{ + */ + template + class reference_wrapper + : public _Reference_wrapper_base::type> + { + _Tp* _M_data; + + public: + typedef _Tp type; + + reference_wrapper(_Tp& __indata) noexcept + : _M_data(std::__addressof(__indata)) + { } + + reference_wrapper(_Tp&&) = delete; + + reference_wrapper(const reference_wrapper&) = default; + + reference_wrapper& + operator=(const reference_wrapper&) = default; + + operator _Tp&() const noexcept + { return this->get(); } + + _Tp& + get() const noexcept + { return *_M_data; } + + template + typename result_of<_Tp&(_Args&&...)>::type + operator()(_Args&&... __args) const + { + return std::__invoke(get(), std::forward<_Args>(__args)...); + } + }; + + + /// Denotes a reference should be taken to a variable. + template + inline reference_wrapper<_Tp> + ref(_Tp& __t) noexcept + { return reference_wrapper<_Tp>(__t); } + + /// Denotes a const reference should be taken to a variable. + template + inline reference_wrapper + cref(const _Tp& __t) noexcept + { return reference_wrapper(__t); } + + template + void ref(const _Tp&&) = delete; + + template + void cref(const _Tp&&) = delete; + + /// Partial specialization. + template + inline reference_wrapper<_Tp> + ref(reference_wrapper<_Tp> __t) noexcept + { return ref(__t.get()); } + + /// Partial specialization. + template + inline reference_wrapper + cref(reference_wrapper<_Tp> __t) noexcept + { return cref(__t.get()); } + + // @} group functors + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // C++11 + +#endif // _GLIBCXX_REFWRAP_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex.h new file mode 100644 index 0000000..14a1ae6 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex.h @@ -0,0 +1,2802 @@ +// class template regex -*- C++ -*- + +// Copyright (C) 2010-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** + * @file bits/regex.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{regex} + */ + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + template + class basic_regex; + + template + class match_results; + +_GLIBCXX_END_NAMESPACE_CXX11 +_GLIBCXX_END_NAMESPACE_VERSION + +namespace __detail +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + enum class _RegexExecutorPolicy : int + { _S_auto, _S_alternate }; + + template + bool + __regex_algo_impl(_BiIter __s, + _BiIter __e, + match_results<_BiIter, _Alloc>& __m, + const basic_regex<_CharT, _TraitsT>& __re, + regex_constants::match_flag_type __flags); + + template + class _Executor; + +_GLIBCXX_END_NAMESPACE_VERSION +} + +_GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + /** + * @addtogroup regex + * @{ + */ + + /** + * @brief Describes aspects of a regular expression. + * + * A regular expression traits class that satisfies the requirements of + * section [28.7]. + * + * The class %regex is parameterized around a set of related types and + * functions used to complete the definition of its semantics. This class + * satisfies the requirements of such a traits class. + */ + template + struct regex_traits + { + public: + typedef _Ch_type char_type; + typedef std::basic_string string_type; + typedef std::locale locale_type; + private: + struct _RegexMask + { + typedef std::ctype_base::mask _BaseType; + _BaseType _M_base; + unsigned char _M_extended; + static constexpr unsigned char _S_under = 1 << 0; + static constexpr unsigned char _S_valid_mask = 0x1; + + constexpr _RegexMask(_BaseType __base = 0, + unsigned char __extended = 0) + : _M_base(__base), _M_extended(__extended) + { } + + constexpr _RegexMask + operator&(_RegexMask __other) const + { + return _RegexMask(_M_base & __other._M_base, + _M_extended & __other._M_extended); + } + + constexpr _RegexMask + operator|(_RegexMask __other) const + { + return _RegexMask(_M_base | __other._M_base, + _M_extended | __other._M_extended); + } + + constexpr _RegexMask + operator^(_RegexMask __other) const + { + return _RegexMask(_M_base ^ __other._M_base, + _M_extended ^ __other._M_extended); + } + + constexpr _RegexMask + operator~() const + { return _RegexMask(~_M_base, ~_M_extended); } + + _RegexMask& + operator&=(_RegexMask __other) + { return *this = (*this) & __other; } + + _RegexMask& + operator|=(_RegexMask __other) + { return *this = (*this) | __other; } + + _RegexMask& + operator^=(_RegexMask __other) + { return *this = (*this) ^ __other; } + + constexpr bool + operator==(_RegexMask __other) const + { + return (_M_extended & _S_valid_mask) + == (__other._M_extended & _S_valid_mask) + && _M_base == __other._M_base; + } + + constexpr bool + operator!=(_RegexMask __other) const + { return !((*this) == __other); } + + }; + public: + typedef _RegexMask char_class_type; + + public: + /** + * @brief Constructs a default traits object. + */ + regex_traits() { } + + /** + * @brief Gives the length of a C-style string starting at @p __p. + * + * @param __p a pointer to the start of a character sequence. + * + * @returns the number of characters between @p *__p and the first + * default-initialized value of type @p char_type. In other words, uses + * the C-string algorithm for determining the length of a sequence of + * characters. + */ + static std::size_t + length(const char_type* __p) + { return string_type::traits_type::length(__p); } + + /** + * @brief Performs the identity translation. + * + * @param __c A character to the locale-specific character set. + * + * @returns __c. + */ + char_type + translate(char_type __c) const + { return __c; } + + /** + * @brief Translates a character into a case-insensitive equivalent. + * + * @param __c A character to the locale-specific character set. + * + * @returns the locale-specific lower-case equivalent of __c. + * @throws std::bad_cast if the imbued locale does not support the ctype + * facet. + */ + char_type + translate_nocase(char_type __c) const + { + typedef std::ctype __ctype_type; + const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale)); + return __fctyp.tolower(__c); + } + + /** + * @brief Gets a sort key for a character sequence. + * + * @param __first beginning of the character sequence. + * @param __last one-past-the-end of the character sequence. + * + * Returns a sort key for the character sequence designated by the + * iterator range [F1, F2) such that if the character sequence [G1, G2) + * sorts before the character sequence [H1, H2) then + * v.transform(G1, G2) < v.transform(H1, H2). + * + * What this really does is provide a more efficient way to compare a + * string to multiple other strings in locales with fancy collation + * rules and equivalence classes. + * + * @returns a locale-specific sort key equivalent to the input range. + * + * @throws std::bad_cast if the current locale does not have a collate + * facet. + */ + template + string_type + transform(_Fwd_iter __first, _Fwd_iter __last) const + { + typedef std::collate __collate_type; + const __collate_type& __fclt(use_facet<__collate_type>(_M_locale)); + string_type __s(__first, __last); + return __fclt.transform(__s.data(), __s.data() + __s.size()); + } + + /** + * @brief Gets a sort key for a character sequence, independent of case. + * + * @param __first beginning of the character sequence. + * @param __last one-past-the-end of the character sequence. + * + * Effects: if typeid(use_facet >) == + * typeid(collate_byname<_Ch_type>) and the form of the sort key + * returned by collate_byname<_Ch_type>::transform(__first, __last) + * is known and can be converted into a primary sort key + * then returns that key, otherwise returns an empty string. + * + * @todo Implement this function correctly. + */ + template + string_type + transform_primary(_Fwd_iter __first, _Fwd_iter __last) const + { + // TODO : this is not entirely correct. + // This function requires extra support from the platform. + // + // Read http://gcc.gnu.org/ml/libstdc++/2013-09/msg00117.html and + // http://www.open-std.org/Jtc1/sc22/wg21/docs/papers/2003/n1429.htm + // for details. + typedef std::ctype __ctype_type; + const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale)); + std::vector __s(__first, __last); + __fctyp.tolower(__s.data(), __s.data() + __s.size()); + return this->transform(__s.data(), __s.data() + __s.size()); + } + + /** + * @brief Gets a collation element by name. + * + * @param __first beginning of the collation element name. + * @param __last one-past-the-end of the collation element name. + * + * @returns a sequence of one or more characters that represents the + * collating element consisting of the character sequence designated by + * the iterator range [__first, __last). Returns an empty string if the + * character sequence is not a valid collating element. + */ + template + string_type + lookup_collatename(_Fwd_iter __first, _Fwd_iter __last) const; + + /** + * @brief Maps one or more characters to a named character + * classification. + * + * @param __first beginning of the character sequence. + * @param __last one-past-the-end of the character sequence. + * @param __icase ignores the case of the classification name. + * + * @returns an unspecified value that represents the character + * classification named by the character sequence designated by + * the iterator range [__first, __last). If @p icase is true, + * the returned mask identifies the classification regardless of + * the case of the characters to be matched (for example, + * [[:lower:]] is the same as [[:alpha:]]), otherwise a + * case-dependent classification is returned. The value + * returned shall be independent of the case of the characters + * in the character sequence. If the name is not recognized then + * returns a value that compares equal to 0. + * + * At least the following names (or their wide-character equivalent) are + * supported. + * - d + * - w + * - s + * - alnum + * - alpha + * - blank + * - cntrl + * - digit + * - graph + * - lower + * - print + * - punct + * - space + * - upper + * - xdigit + */ + template + char_class_type + lookup_classname(_Fwd_iter __first, _Fwd_iter __last, + bool __icase = false) const; + + /** + * @brief Determines if @p c is a member of an identified class. + * + * @param __c a character. + * @param __f a class type (as returned from lookup_classname). + * + * @returns true if the character @p __c is a member of the classification + * represented by @p __f, false otherwise. + * + * @throws std::bad_cast if the current locale does not have a ctype + * facet. + */ + bool + isctype(_Ch_type __c, char_class_type __f) const; + + /** + * @brief Converts a digit to an int. + * + * @param __ch a character representing a digit. + * @param __radix the radix if the numeric conversion (limited to 8, 10, + * or 16). + * + * @returns the value represented by the digit __ch in base radix if the + * character __ch is a valid digit in base radix; otherwise returns -1. + */ + int + value(_Ch_type __ch, int __radix) const; + + /** + * @brief Imbues the regex_traits object with a copy of a new locale. + * + * @param __loc A locale. + * + * @returns a copy of the previous locale in use by the regex_traits + * object. + * + * @note Calling imbue with a different locale than the one currently in + * use invalidates all cached data held by *this. + */ + locale_type + imbue(locale_type __loc) + { + std::swap(_M_locale, __loc); + return __loc; + } + + /** + * @brief Gets a copy of the current locale in use by the regex_traits + * object. + */ + locale_type + getloc() const + { return _M_locale; } + + protected: + locale_type _M_locale; + }; + + // [7.8] Class basic_regex + /** + * Objects of specializations of this class represent regular expressions + * constructed from sequences of character type @p _Ch_type. + * + * Storage for the regular expression is allocated and deallocated as + * necessary by the member functions of this class. + */ + template> + class basic_regex + { + public: + static_assert(is_same<_Ch_type, typename _Rx_traits::char_type>::value, + "regex traits class must have the same char_type"); + + // types: + typedef _Ch_type value_type; + typedef _Rx_traits traits_type; + typedef typename traits_type::string_type string_type; + typedef regex_constants::syntax_option_type flag_type; + typedef typename traits_type::locale_type locale_type; + + /** + * @name Constants + * std [28.8.1](1) + */ + //@{ + static constexpr flag_type icase = regex_constants::icase; + static constexpr flag_type nosubs = regex_constants::nosubs; + static constexpr flag_type optimize = regex_constants::optimize; + static constexpr flag_type collate = regex_constants::collate; + static constexpr flag_type ECMAScript = regex_constants::ECMAScript; + static constexpr flag_type basic = regex_constants::basic; + static constexpr flag_type extended = regex_constants::extended; + static constexpr flag_type awk = regex_constants::awk; + static constexpr flag_type grep = regex_constants::grep; + static constexpr flag_type egrep = regex_constants::egrep; + //@} + + // [7.8.2] construct/copy/destroy + /** + * Constructs a basic regular expression that does not match any + * character sequence. + */ + basic_regex() + : _M_flags(ECMAScript), _M_loc(), _M_automaton(nullptr) + { } + + /** + * @brief Constructs a basic regular expression from the + * sequence [__p, __p + char_traits<_Ch_type>::length(__p)) + * interpreted according to the flags in @p __f. + * + * @param __p A pointer to the start of a C-style null-terminated string + * containing a regular expression. + * @param __f Flags indicating the syntax rules and options. + * + * @throws regex_error if @p __p is not a valid regular expression. + */ + explicit + basic_regex(const _Ch_type* __p, flag_type __f = ECMAScript) + : basic_regex(__p, __p + char_traits<_Ch_type>::length(__p), __f) + { } + + /** + * @brief Constructs a basic regular expression from the sequence + * [p, p + len) interpreted according to the flags in @p f. + * + * @param __p A pointer to the start of a string containing a regular + * expression. + * @param __len The length of the string containing the regular + * expression. + * @param __f Flags indicating the syntax rules and options. + * + * @throws regex_error if @p __p is not a valid regular expression. + */ + basic_regex(const _Ch_type* __p, std::size_t __len, + flag_type __f = ECMAScript) + : basic_regex(__p, __p + __len, __f) + { } + + /** + * @brief Copy-constructs a basic regular expression. + * + * @param __rhs A @p regex object. + */ + basic_regex(const basic_regex& __rhs) = default; + + /** + * @brief Move-constructs a basic regular expression. + * + * @param __rhs A @p regex object. + */ + basic_regex(basic_regex&& __rhs) noexcept = default; + + /** + * @brief Constructs a basic regular expression from the string + * @p s interpreted according to the flags in @p f. + * + * @param __s A string containing a regular expression. + * @param __f Flags indicating the syntax rules and options. + * + * @throws regex_error if @p __s is not a valid regular expression. + */ + template + explicit + basic_regex(const std::basic_string<_Ch_type, _Ch_traits, + _Ch_alloc>& __s, + flag_type __f = ECMAScript) + : basic_regex(__s.data(), __s.data() + __s.size(), __f) + { } + + /** + * @brief Constructs a basic regular expression from the range + * [first, last) interpreted according to the flags in @p f. + * + * @param __first The start of a range containing a valid regular + * expression. + * @param __last The end of a range containing a valid regular + * expression. + * @param __f The format flags of the regular expression. + * + * @throws regex_error if @p [__first, __last) is not a valid regular + * expression. + */ + template + basic_regex(_FwdIter __first, _FwdIter __last, + flag_type __f = ECMAScript) + : basic_regex(std::move(__first), std::move(__last), locale_type(), __f) + { } + + /** + * @brief Constructs a basic regular expression from an initializer list. + * + * @param __l The initializer list. + * @param __f The format flags of the regular expression. + * + * @throws regex_error if @p __l is not a valid regular expression. + */ + basic_regex(initializer_list<_Ch_type> __l, flag_type __f = ECMAScript) + : basic_regex(__l.begin(), __l.end(), __f) + { } + + /** + * @brief Destroys a basic regular expression. + */ + ~basic_regex() + { } + + /** + * @brief Assigns one regular expression to another. + */ + basic_regex& + operator=(const basic_regex& __rhs) + { return this->assign(__rhs); } + + /** + * @brief Move-assigns one regular expression to another. + */ + basic_regex& + operator=(basic_regex&& __rhs) noexcept + { return this->assign(std::move(__rhs)); } + + /** + * @brief Replaces a regular expression with a new one constructed from + * a C-style null-terminated string. + * + * @param __p A pointer to the start of a null-terminated C-style string + * containing a regular expression. + */ + basic_regex& + operator=(const _Ch_type* __p) + { return this->assign(__p); } + + /** + * @brief Replaces a regular expression with a new one constructed from + * an initializer list. + * + * @param __l The initializer list. + * + * @throws regex_error if @p __l is not a valid regular expression. + */ + basic_regex& + operator=(initializer_list<_Ch_type> __l) + { return this->assign(__l.begin(), __l.end()); } + + /** + * @brief Replaces a regular expression with a new one constructed from + * a string. + * + * @param __s A pointer to a string containing a regular expression. + */ + template + basic_regex& + operator=(const basic_string<_Ch_type, _Ch_traits, _Alloc>& __s) + { return this->assign(__s); } + + // [7.8.3] assign + /** + * @brief the real assignment operator. + * + * @param __rhs Another regular expression object. + */ + basic_regex& + assign(const basic_regex& __rhs) + { + basic_regex __tmp(__rhs); + this->swap(__tmp); + return *this; + } + + /** + * @brief The move-assignment operator. + * + * @param __rhs Another regular expression object. + */ + basic_regex& + assign(basic_regex&& __rhs) noexcept + { + basic_regex __tmp(std::move(__rhs)); + this->swap(__tmp); + return *this; + } + + /** + * @brief Assigns a new regular expression to a regex object from a + * C-style null-terminated string containing a regular expression + * pattern. + * + * @param __p A pointer to a C-style null-terminated string containing + * a regular expression pattern. + * @param __flags Syntax option flags. + * + * @throws regex_error if __p does not contain a valid regular + * expression pattern interpreted according to @p __flags. If + * regex_error is thrown, *this remains unchanged. + */ + basic_regex& + assign(const _Ch_type* __p, flag_type __flags = ECMAScript) + { return this->assign(string_type(__p), __flags); } + + /** + * @brief Assigns a new regular expression to a regex object from a + * C-style string containing a regular expression pattern. + * + * @param __p A pointer to a C-style string containing a + * regular expression pattern. + * @param __len The length of the regular expression pattern string. + * @param __flags Syntax option flags. + * + * @throws regex_error if p does not contain a valid regular + * expression pattern interpreted according to @p __flags. If + * regex_error is thrown, *this remains unchanged. + */ + basic_regex& + assign(const _Ch_type* __p, std::size_t __len, flag_type __flags) + { return this->assign(string_type(__p, __len), __flags); } + + /** + * @brief Assigns a new regular expression to a regex object from a + * string containing a regular expression pattern. + * + * @param __s A string containing a regular expression pattern. + * @param __flags Syntax option flags. + * + * @throws regex_error if __s does not contain a valid regular + * expression pattern interpreted according to @p __flags. If + * regex_error is thrown, *this remains unchanged. + */ + template + basic_regex& + assign(const basic_string<_Ch_type, _Ch_traits, _Alloc>& __s, + flag_type __flags = ECMAScript) + { + return this->assign(basic_regex(__s.data(), __s.data() + __s.size(), + _M_loc, __flags)); + } + + /** + * @brief Assigns a new regular expression to a regex object. + * + * @param __first The start of a range containing a valid regular + * expression. + * @param __last The end of a range containing a valid regular + * expression. + * @param __flags Syntax option flags. + * + * @throws regex_error if p does not contain a valid regular + * expression pattern interpreted according to @p __flags. If + * regex_error is thrown, the object remains unchanged. + */ + template + basic_regex& + assign(_InputIterator __first, _InputIterator __last, + flag_type __flags = ECMAScript) + { return this->assign(string_type(__first, __last), __flags); } + + /** + * @brief Assigns a new regular expression to a regex object. + * + * @param __l An initializer list representing a regular expression. + * @param __flags Syntax option flags. + * + * @throws regex_error if @p __l does not contain a valid + * regular expression pattern interpreted according to @p + * __flags. If regex_error is thrown, the object remains + * unchanged. + */ + basic_regex& + assign(initializer_list<_Ch_type> __l, flag_type __flags = ECMAScript) + { return this->assign(__l.begin(), __l.end(), __flags); } + + // [7.8.4] const operations + /** + * @brief Gets the number of marked subexpressions within the regular + * expression. + */ + unsigned int + mark_count() const + { + if (_M_automaton) + return _M_automaton->_M_sub_count() - 1; + return 0; + } + + /** + * @brief Gets the flags used to construct the regular expression + * or in the last call to assign(). + */ + flag_type + flags() const + { return _M_flags; } + + // [7.8.5] locale + /** + * @brief Imbues the regular expression object with the given locale. + * + * @param __loc A locale. + */ + locale_type + imbue(locale_type __loc) + { + std::swap(__loc, _M_loc); + _M_automaton.reset(); + return __loc; + } + + /** + * @brief Gets the locale currently imbued in the regular expression + * object. + */ + locale_type + getloc() const + { return _M_loc; } + + // [7.8.6] swap + /** + * @brief Swaps the contents of two regular expression objects. + * + * @param __rhs Another regular expression object. + */ + void + swap(basic_regex& __rhs) + { + std::swap(_M_flags, __rhs._M_flags); + std::swap(_M_loc, __rhs._M_loc); + std::swap(_M_automaton, __rhs._M_automaton); + } + +#ifdef _GLIBCXX_DEBUG + void + _M_dot(std::ostream& __ostr) + { _M_automaton->_M_dot(__ostr); } +#endif + + private: + typedef std::shared_ptr> _AutomatonPtr; + + template + basic_regex(_FwdIter __first, _FwdIter __last, locale_type __loc, + flag_type __f) + : _M_flags(__f), _M_loc(std::move(__loc)), + _M_automaton(__detail::__compile_nfa<_FwdIter, _Rx_traits>( + std::move(__first), std::move(__last), _M_loc, _M_flags)) + { } + + template + friend bool __detail:: +#if _GLIBCXX_INLINE_VERSION + __7:: // Required due to PR c++/59256 +#endif + __regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&, + const basic_regex<_Cp, _Rp>&, + regex_constants::match_flag_type); + + template + friend class __detail::_Executor; + + flag_type _M_flags; + locale_type _M_loc; + _AutomatonPtr _M_automaton; + }; + + /** @brief Standard regular expressions. */ + typedef basic_regex regex; + +#ifdef _GLIBCXX_USE_WCHAR_T + /** @brief Standard wide-character regular expressions. */ + typedef basic_regex wregex; +#endif + + + // [7.8.6] basic_regex swap + /** + * @brief Swaps the contents of two regular expression objects. + * @param __lhs First regular expression. + * @param __rhs Second regular expression. + */ + template + inline void + swap(basic_regex<_Ch_type, _Rx_traits>& __lhs, + basic_regex<_Ch_type, _Rx_traits>& __rhs) + { __lhs.swap(__rhs); } + + + // [7.9] Class template sub_match + /** + * A sequence of characters matched by a particular marked sub-expression. + * + * An object of this class is essentially a pair of iterators marking a + * matched subexpression within a regular expression pattern match. Such + * objects can be converted to and compared with std::basic_string objects + * of a similar base character type as the pattern matched by the regular + * expression. + * + * The iterators that make up the pair are the usual half-open interval + * referencing the actual original pattern matched. + */ + template + class sub_match : public std::pair<_BiIter, _BiIter> + { + typedef iterator_traits<_BiIter> __iter_traits; + + public: + typedef typename __iter_traits::value_type value_type; + typedef typename __iter_traits::difference_type difference_type; + typedef _BiIter iterator; + typedef std::basic_string string_type; + + bool matched; + + constexpr sub_match() : matched() { } + + /** + * Gets the length of the matching sequence. + */ + difference_type + length() const + { return this->matched ? std::distance(this->first, this->second) : 0; } + + /** + * @brief Gets the matching sequence as a string. + * + * @returns the matching sequence as a string. + * + * This is the implicit conversion operator. It is identical to the + * str() member function except that it will want to pop up in + * unexpected places and cause a great deal of confusion and cursing + * from the unwary. + */ + operator string_type() const + { + return this->matched + ? string_type(this->first, this->second) + : string_type(); + } + + /** + * @brief Gets the matching sequence as a string. + * + * @returns the matching sequence as a string. + */ + string_type + str() const + { + return this->matched + ? string_type(this->first, this->second) + : string_type(); + } + + /** + * @brief Compares this and another matched sequence. + * + * @param __s Another matched sequence to compare to this one. + * + * @retval <0 this matched sequence will collate before @p __s. + * @retval =0 this matched sequence is equivalent to @p __s. + * @retval <0 this matched sequence will collate after @p __s. + */ + int + compare(const sub_match& __s) const + { return this->str().compare(__s.str()); } + + /** + * @brief Compares this sub_match to a string. + * + * @param __s A string to compare to this sub_match. + * + * @retval <0 this matched sequence will collate before @p __s. + * @retval =0 this matched sequence is equivalent to @p __s. + * @retval <0 this matched sequence will collate after @p __s. + */ + int + compare(const string_type& __s) const + { return this->str().compare(__s); } + + /** + * @brief Compares this sub_match to a C-style string. + * + * @param __s A C-style string to compare to this sub_match. + * + * @retval <0 this matched sequence will collate before @p __s. + * @retval =0 this matched sequence is equivalent to @p __s. + * @retval <0 this matched sequence will collate after @p __s. + */ + int + compare(const value_type* __s) const + { return this->str().compare(__s); } + }; + + + /** @brief Standard regex submatch over a C-style null-terminated string. */ + typedef sub_match csub_match; + + /** @brief Standard regex submatch over a standard string. */ + typedef sub_match ssub_match; + +#ifdef _GLIBCXX_USE_WCHAR_T + /** @brief Regex submatch over a C-style null-terminated wide string. */ + typedef sub_match wcsub_match; + + /** @brief Regex submatch over a standard wide string. */ + typedef sub_match wssub_match; +#endif + + // [7.9.2] sub_match non-member operators + + /** + * @brief Tests the equivalence of two regular expression submatches. + * @param __lhs First regular expression submatch. + * @param __rhs Second regular expression submatch. + * @returns true if @a __lhs is equivalent to @a __rhs, false otherwise. + */ + template + inline bool + operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) + { return __lhs.compare(__rhs) == 0; } + + /** + * @brief Tests the inequivalence of two regular expression submatches. + * @param __lhs First regular expression submatch. + * @param __rhs Second regular expression submatch. + * @returns true if @a __lhs is not equivalent to @a __rhs, false otherwise. + */ + template + inline bool + operator!=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) + { return __lhs.compare(__rhs) != 0; } + + /** + * @brief Tests the ordering of two regular expression submatches. + * @param __lhs First regular expression submatch. + * @param __rhs Second regular expression submatch. + * @returns true if @a __lhs precedes @a __rhs, false otherwise. + */ + template + inline bool + operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) + { return __lhs.compare(__rhs) < 0; } + + /** + * @brief Tests the ordering of two regular expression submatches. + * @param __lhs First regular expression submatch. + * @param __rhs Second regular expression submatch. + * @returns true if @a __lhs does not succeed @a __rhs, false otherwise. + */ + template + inline bool + operator<=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) + { return __lhs.compare(__rhs) <= 0; } + + /** + * @brief Tests the ordering of two regular expression submatches. + * @param __lhs First regular expression submatch. + * @param __rhs Second regular expression submatch. + * @returns true if @a __lhs does not precede @a __rhs, false otherwise. + */ + template + inline bool + operator>=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) + { return __lhs.compare(__rhs) >= 0; } + + /** + * @brief Tests the ordering of two regular expression submatches. + * @param __lhs First regular expression submatch. + * @param __rhs Second regular expression submatch. + * @returns true if @a __lhs succeeds @a __rhs, false otherwise. + */ + template + inline bool + operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) + { return __lhs.compare(__rhs) > 0; } + + // Alias for sub_match'd string. + template + using __sub_match_string = basic_string< + typename iterator_traits<_Bi_iter>::value_type, + _Ch_traits, _Ch_alloc>; + + /** + * @brief Tests the equivalence of a string and a regular expression + * submatch. + * @param __lhs A string. + * @param __rhs A regular expression submatch. + * @returns true if @a __lhs is equivalent to @a __rhs, false otherwise. + */ + template + inline bool + operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, + const sub_match<_Bi_iter>& __rhs) + { + typedef typename sub_match<_Bi_iter>::string_type string_type; + return __rhs.compare(string_type(__lhs.data(), __lhs.size())) == 0; + } + + /** + * @brief Tests the inequivalence of a string and a regular expression + * submatch. + * @param __lhs A string. + * @param __rhs A regular expression submatch. + * @returns true if @a __lhs is not equivalent to @a __rhs, false otherwise. + */ + template + inline bool + operator!=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, + const sub_match<_Bi_iter>& __rhs) + { return !(__lhs == __rhs); } + + /** + * @brief Tests the ordering of a string and a regular expression submatch. + * @param __lhs A string. + * @param __rhs A regular expression submatch. + * @returns true if @a __lhs precedes @a __rhs, false otherwise. + */ + template + inline bool + operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, + const sub_match<_Bi_iter>& __rhs) + { + typedef typename sub_match<_Bi_iter>::string_type string_type; + return __rhs.compare(string_type(__lhs.data(), __lhs.size())) > 0; + } + + /** + * @brief Tests the ordering of a string and a regular expression submatch. + * @param __lhs A string. + * @param __rhs A regular expression submatch. + * @returns true if @a __lhs succeeds @a __rhs, false otherwise. + */ + template + inline bool + operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, + const sub_match<_Bi_iter>& __rhs) + { return __rhs < __lhs; } + + /** + * @brief Tests the ordering of a string and a regular expression submatch. + * @param __lhs A string. + * @param __rhs A regular expression submatch. + * @returns true if @a __lhs does not precede @a __rhs, false otherwise. + */ + template + inline bool + operator>=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, + const sub_match<_Bi_iter>& __rhs) + { return !(__lhs < __rhs); } + + /** + * @brief Tests the ordering of a string and a regular expression submatch. + * @param __lhs A string. + * @param __rhs A regular expression submatch. + * @returns true if @a __lhs does not succeed @a __rhs, false otherwise. + */ + template + inline bool + operator<=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, + const sub_match<_Bi_iter>& __rhs) + { return !(__rhs < __lhs); } + + /** + * @brief Tests the equivalence of a regular expression submatch and a + * string. + * @param __lhs A regular expression submatch. + * @param __rhs A string. + * @returns true if @a __lhs is equivalent to @a __rhs, false otherwise. + */ + template + inline bool + operator==(const sub_match<_Bi_iter>& __lhs, + const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs) + { + typedef typename sub_match<_Bi_iter>::string_type string_type; + return __lhs.compare(string_type(__rhs.data(), __rhs.size())) == 0; + } + + /** + * @brief Tests the inequivalence of a regular expression submatch and a + * string. + * @param __lhs A regular expression submatch. + * @param __rhs A string. + * @returns true if @a __lhs is not equivalent to @a __rhs, false otherwise. + */ + template + inline bool + operator!=(const sub_match<_Bi_iter>& __lhs, + const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs) + { return !(__lhs == __rhs); } + + /** + * @brief Tests the ordering of a regular expression submatch and a string. + * @param __lhs A regular expression submatch. + * @param __rhs A string. + * @returns true if @a __lhs precedes @a __rhs, false otherwise. + */ + template + inline bool + operator<(const sub_match<_Bi_iter>& __lhs, + const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs) + { + typedef typename sub_match<_Bi_iter>::string_type string_type; + return __lhs.compare(string_type(__rhs.data(), __rhs.size())) < 0; + } + + /** + * @brief Tests the ordering of a regular expression submatch and a string. + * @param __lhs A regular expression submatch. + * @param __rhs A string. + * @returns true if @a __lhs succeeds @a __rhs, false otherwise. + */ + template + inline bool + operator>(const sub_match<_Bi_iter>& __lhs, + const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs) + { return __rhs < __lhs; } + + /** + * @brief Tests the ordering of a regular expression submatch and a string. + * @param __lhs A regular expression submatch. + * @param __rhs A string. + * @returns true if @a __lhs does not precede @a __rhs, false otherwise. + */ + template + inline bool + operator>=(const sub_match<_Bi_iter>& __lhs, + const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs) + { return !(__lhs < __rhs); } + + /** + * @brief Tests the ordering of a regular expression submatch and a string. + * @param __lhs A regular expression submatch. + * @param __rhs A string. + * @returns true if @a __lhs does not succeed @a __rhs, false otherwise. + */ + template + inline bool + operator<=(const sub_match<_Bi_iter>& __lhs, + const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __rhs) + { return !(__rhs < __lhs); } + + /** + * @brief Tests the equivalence of a C string and a regular expression + * submatch. + * @param __lhs A C string. + * @param __rhs A regular expression submatch. + * @returns true if @a __lhs is equivalent to @a __rhs, false otherwise. + */ + template + inline bool + operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs, + const sub_match<_Bi_iter>& __rhs) + { return __rhs.compare(__lhs) == 0; } + + /** + * @brief Tests the inequivalence of an iterator value and a regular + * expression submatch. + * @param __lhs A regular expression submatch. + * @param __rhs A string. + * @returns true if @a __lhs is not equivalent to @a __rhs, false otherwise. + */ + template + inline bool + operator!=(typename iterator_traits<_Bi_iter>::value_type const* __lhs, + const sub_match<_Bi_iter>& __rhs) + { return !(__lhs == __rhs); } + + /** + * @brief Tests the ordering of a string and a regular expression submatch. + * @param __lhs A string. + * @param __rhs A regular expression submatch. + * @returns true if @a __lhs precedes @a __rhs, false otherwise. + */ + template + inline bool + operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, + const sub_match<_Bi_iter>& __rhs) + { return __rhs.compare(__lhs) > 0; } + + /** + * @brief Tests the ordering of a string and a regular expression submatch. + * @param __lhs A string. + * @param __rhs A regular expression submatch. + * @returns true if @a __lhs succeeds @a __rhs, false otherwise. + */ + template + inline bool + operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs, + const sub_match<_Bi_iter>& __rhs) + { return __rhs < __lhs; } + + /** + * @brief Tests the ordering of a string and a regular expression submatch. + * @param __lhs A string. + * @param __rhs A regular expression submatch. + * @returns true if @a __lhs does not precede @a __rhs, false otherwise. + */ + template + inline bool + operator>=(typename iterator_traits<_Bi_iter>::value_type const* __lhs, + const sub_match<_Bi_iter>& __rhs) + { return !(__lhs < __rhs); } + + /** + * @brief Tests the ordering of a string and a regular expression submatch. + * @param __lhs A string. + * @param __rhs A regular expression submatch. + * @returns true if @a __lhs does not succeed @a __rhs, false otherwise. + */ + template + inline bool + operator<=(typename iterator_traits<_Bi_iter>::value_type const* __lhs, + const sub_match<_Bi_iter>& __rhs) + { return !(__rhs < __lhs); } + + /** + * @brief Tests the equivalence of a regular expression submatch and a + * string. + * @param __lhs A regular expression submatch. + * @param __rhs A pointer to a string? + * @returns true if @a __lhs is equivalent to @a __rhs, false otherwise. + */ + template + inline bool + operator==(const sub_match<_Bi_iter>& __lhs, + typename iterator_traits<_Bi_iter>::value_type const* __rhs) + { return __lhs.compare(__rhs) == 0; } + + /** + * @brief Tests the inequivalence of a regular expression submatch and a + * string. + * @param __lhs A regular expression submatch. + * @param __rhs A pointer to a string. + * @returns true if @a __lhs is not equivalent to @a __rhs, false otherwise. + */ + template + inline bool + operator!=(const sub_match<_Bi_iter>& __lhs, + typename iterator_traits<_Bi_iter>::value_type const* __rhs) + { return !(__lhs == __rhs); } + + /** + * @brief Tests the ordering of a regular expression submatch and a string. + * @param __lhs A regular expression submatch. + * @param __rhs A string. + * @returns true if @a __lhs precedes @a __rhs, false otherwise. + */ + template + inline bool + operator<(const sub_match<_Bi_iter>& __lhs, + typename iterator_traits<_Bi_iter>::value_type const* __rhs) + { return __lhs.compare(__rhs) < 0; } + + /** + * @brief Tests the ordering of a regular expression submatch and a string. + * @param __lhs A regular expression submatch. + * @param __rhs A string. + * @returns true if @a __lhs succeeds @a __rhs, false otherwise. + */ + template + inline bool + operator>(const sub_match<_Bi_iter>& __lhs, + typename iterator_traits<_Bi_iter>::value_type const* __rhs) + { return __rhs < __lhs; } + + /** + * @brief Tests the ordering of a regular expression submatch and a string. + * @param __lhs A regular expression submatch. + * @param __rhs A string. + * @returns true if @a __lhs does not precede @a __rhs, false otherwise. + */ + template + inline bool + operator>=(const sub_match<_Bi_iter>& __lhs, + typename iterator_traits<_Bi_iter>::value_type const* __rhs) + { return !(__lhs < __rhs); } + + /** + * @brief Tests the ordering of a regular expression submatch and a string. + * @param __lhs A regular expression submatch. + * @param __rhs A string. + * @returns true if @a __lhs does not succeed @a __rhs, false otherwise. + */ + template + inline bool + operator<=(const sub_match<_Bi_iter>& __lhs, + typename iterator_traits<_Bi_iter>::value_type const* __rhs) + { return !(__rhs < __lhs); } + + /** + * @brief Tests the equivalence of a string and a regular expression + * submatch. + * @param __lhs A string. + * @param __rhs A regular expression submatch. + * @returns true if @a __lhs is equivalent to @a __rhs, false otherwise. + */ + template + inline bool + operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs, + const sub_match<_Bi_iter>& __rhs) + { + typedef typename sub_match<_Bi_iter>::string_type string_type; + return __rhs.compare(string_type(1, __lhs)) == 0; + } + + /** + * @brief Tests the inequivalence of a string and a regular expression + * submatch. + * @param __lhs A string. + * @param __rhs A regular expression submatch. + * @returns true if @a __lhs is not equivalent to @a __rhs, false otherwise. + */ + template + inline bool + operator!=(typename iterator_traits<_Bi_iter>::value_type const& __lhs, + const sub_match<_Bi_iter>& __rhs) + { return !(__lhs == __rhs); } + + /** + * @brief Tests the ordering of a string and a regular expression submatch. + * @param __lhs A string. + * @param __rhs A regular expression submatch. + * @returns true if @a __lhs precedes @a __rhs, false otherwise. + */ + template + inline bool + operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs, + const sub_match<_Bi_iter>& __rhs) + { + typedef typename sub_match<_Bi_iter>::string_type string_type; + return __rhs.compare(string_type(1, __lhs)) > 0; + } + + /** + * @brief Tests the ordering of a string and a regular expression submatch. + * @param __lhs A string. + * @param __rhs A regular expression submatch. + * @returns true if @a __lhs succeeds @a __rhs, false otherwise. + */ + template + inline bool + operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs, + const sub_match<_Bi_iter>& __rhs) + { return __rhs < __lhs; } + + /** + * @brief Tests the ordering of a string and a regular expression submatch. + * @param __lhs A string. + * @param __rhs A regular expression submatch. + * @returns true if @a __lhs does not precede @a __rhs, false otherwise. + */ + template + inline bool + operator>=(typename iterator_traits<_Bi_iter>::value_type const& __lhs, + const sub_match<_Bi_iter>& __rhs) + { return !(__lhs < __rhs); } + + /** + * @brief Tests the ordering of a string and a regular expression submatch. + * @param __lhs A string. + * @param __rhs A regular expression submatch. + * @returns true if @a __lhs does not succeed @a __rhs, false otherwise. + */ + template + inline bool + operator<=(typename iterator_traits<_Bi_iter>::value_type const& __lhs, + const sub_match<_Bi_iter>& __rhs) + { return !(__rhs < __lhs); } + + /** + * @brief Tests the equivalence of a regular expression submatch and a + * string. + * @param __lhs A regular expression submatch. + * @param __rhs A const string reference. + * @returns true if @a __lhs is equivalent to @a __rhs, false otherwise. + */ + template + inline bool + operator==(const sub_match<_Bi_iter>& __lhs, + typename iterator_traits<_Bi_iter>::value_type const& __rhs) + { + typedef typename sub_match<_Bi_iter>::string_type string_type; + return __lhs.compare(string_type(1, __rhs)) == 0; + } + + /** + * @brief Tests the inequivalence of a regular expression submatch and a + * string. + * @param __lhs A regular expression submatch. + * @param __rhs A const string reference. + * @returns true if @a __lhs is not equivalent to @a __rhs, false otherwise. + */ + template + inline bool + operator!=(const sub_match<_Bi_iter>& __lhs, + typename iterator_traits<_Bi_iter>::value_type const& __rhs) + { return !(__lhs == __rhs); } + + /** + * @brief Tests the ordering of a regular expression submatch and a string. + * @param __lhs A regular expression submatch. + * @param __rhs A const string reference. + * @returns true if @a __lhs precedes @a __rhs, false otherwise. + */ + template + inline bool + operator<(const sub_match<_Bi_iter>& __lhs, + typename iterator_traits<_Bi_iter>::value_type const& __rhs) + { + typedef typename sub_match<_Bi_iter>::string_type string_type; + return __lhs.compare(string_type(1, __rhs)) < 0; + } + + /** + * @brief Tests the ordering of a regular expression submatch and a string. + * @param __lhs A regular expression submatch. + * @param __rhs A const string reference. + * @returns true if @a __lhs succeeds @a __rhs, false otherwise. + */ + template + inline bool + operator>(const sub_match<_Bi_iter>& __lhs, + typename iterator_traits<_Bi_iter>::value_type const& __rhs) + { return __rhs < __lhs; } + + /** + * @brief Tests the ordering of a regular expression submatch and a string. + * @param __lhs A regular expression submatch. + * @param __rhs A const string reference. + * @returns true if @a __lhs does not precede @a __rhs, false otherwise. + */ + template + inline bool + operator>=(const sub_match<_Bi_iter>& __lhs, + typename iterator_traits<_Bi_iter>::value_type const& __rhs) + { return !(__lhs < __rhs); } + + /** + * @brief Tests the ordering of a regular expression submatch and a string. + * @param __lhs A regular expression submatch. + * @param __rhs A const string reference. + * @returns true if @a __lhs does not succeed @a __rhs, false otherwise. + */ + template + inline bool + operator<=(const sub_match<_Bi_iter>& __lhs, + typename iterator_traits<_Bi_iter>::value_type const& __rhs) + { return !(__rhs < __lhs); } + + /** + * @brief Inserts a matched string into an output stream. + * + * @param __os The output stream. + * @param __m A submatch string. + * + * @returns the output stream with the submatch string inserted. + */ + template + inline + basic_ostream<_Ch_type, _Ch_traits>& + operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os, + const sub_match<_Bi_iter>& __m) + { return __os << __m.str(); } + + // [7.10] Class template match_results + + /** + * @brief The results of a match or search operation. + * + * A collection of character sequences representing the result of a regular + * expression match. Storage for the collection is allocated and freed as + * necessary by the member functions of class template match_results. + * + * This class satisfies the Sequence requirements, with the exception that + * only the operations defined for a const-qualified Sequence are supported. + * + * The sub_match object stored at index 0 represents sub-expression 0, i.e. + * the whole match. In this case the %sub_match member matched is always true. + * The sub_match object stored at index n denotes what matched the marked + * sub-expression n within the matched expression. If the sub-expression n + * participated in a regular expression match then the %sub_match member + * matched evaluates to true, and members first and second denote the range + * of characters [first, second) which formed that match. Otherwise matched + * is false, and members first and second point to the end of the sequence + * that was searched. + * + * @nosubgrouping + */ + template > > + class match_results + : private std::vector, _Alloc> + { + private: + /* + * The vector base is empty if this does not represent a match (!ready()); + * Otherwise if it's a match failure, it contains 3 elements: + * [0] unmatched + * [1] prefix + * [2] suffix + * Otherwise it contains n+4 elements where n is the number of marked + * sub-expressions: + * [0] entire match + * [1] 1st marked subexpression + * ... + * [n] nth marked subexpression + * [n+1] unmatched + * [n+2] prefix + * [n+3] suffix + */ + typedef std::vector, _Alloc> _Base_type; + typedef std::iterator_traits<_Bi_iter> __iter_traits; + typedef regex_constants::match_flag_type match_flag_type; + + public: + /** + * @name 10.? Public Types + */ + //@{ + typedef sub_match<_Bi_iter> value_type; + typedef const value_type& const_reference; + typedef const_reference reference; + typedef typename _Base_type::const_iterator const_iterator; + typedef const_iterator iterator; + typedef typename __iter_traits::difference_type difference_type; + typedef typename allocator_traits<_Alloc>::size_type size_type; + typedef _Alloc allocator_type; + typedef typename __iter_traits::value_type char_type; + typedef std::basic_string string_type; + //@} + + public: + /** + * @name 28.10.1 Construction, Copying, and Destruction + */ + //@{ + + /** + * @brief Constructs a default %match_results container. + * @post size() returns 0 and str() returns an empty string. + */ + explicit + match_results(const _Alloc& __a = _Alloc()) + : _Base_type(__a) + { } + + /** + * @brief Copy constructs a %match_results. + */ + match_results(const match_results& __rhs) = default; + + /** + * @brief Move constructs a %match_results. + */ + match_results(match_results&& __rhs) noexcept = default; + + /** + * @brief Assigns rhs to *this. + */ + match_results& + operator=(const match_results& __rhs) = default; + + /** + * @brief Move-assigns rhs to *this. + */ + match_results& + operator=(match_results&& __rhs) = default; + + /** + * @brief Destroys a %match_results object. + */ + ~match_results() + { } + + //@} + + // 28.10.2, state: + /** + * @brief Indicates if the %match_results is ready. + * @retval true The object has a fully-established result state. + * @retval false The object is not ready. + */ + bool ready() const { return !_Base_type::empty(); } + + /** + * @name 28.10.2 Size + */ + //@{ + + /** + * @brief Gets the number of matches and submatches. + * + * The number of matches for a given regular expression will be either 0 + * if there was no match or mark_count() + 1 if a match was successful. + * Some matches may be empty. + * + * @returns the number of matches found. + */ + size_type + size() const + { return _Base_type::empty() ? 0 : _Base_type::size() - 3; } + + size_type + max_size() const + { return _Base_type::max_size(); } + + /** + * @brief Indicates if the %match_results contains no results. + * @retval true The %match_results object is empty. + * @retval false The %match_results object is not empty. + */ + bool + empty() const + { return size() == 0; } + + //@} + + /** + * @name 10.3 Element Access + */ + //@{ + + /** + * @brief Gets the length of the indicated submatch. + * @param __sub indicates the submatch. + * @pre ready() == true + * + * This function returns the length of the indicated submatch, or the + * length of the entire match if @p __sub is zero (the default). + */ + difference_type + length(size_type __sub = 0) const + { return (*this)[__sub].length(); } + + /** + * @brief Gets the offset of the beginning of the indicated submatch. + * @param __sub indicates the submatch. + * @pre ready() == true + * + * This function returns the offset from the beginning of the target + * sequence to the beginning of the submatch, unless the value of @p __sub + * is zero (the default), in which case this function returns the offset + * from the beginning of the target sequence to the beginning of the + * match. + */ + difference_type + position(size_type __sub = 0) const + { return std::distance(_M_begin, (*this)[__sub].first); } + + /** + * @brief Gets the match or submatch converted to a string type. + * @param __sub indicates the submatch. + * @pre ready() == true + * + * This function gets the submatch (or match, if @p __sub is + * zero) extracted from the target range and converted to the + * associated string type. + */ + string_type + str(size_type __sub = 0) const + { return string_type((*this)[__sub]); } + + /** + * @brief Gets a %sub_match reference for the match or submatch. + * @param __sub indicates the submatch. + * @pre ready() == true + * + * This function gets a reference to the indicated submatch, or + * the entire match if @p __sub is zero. + * + * If @p __sub >= size() then this function returns a %sub_match with a + * special value indicating no submatch. + */ + const_reference + operator[](size_type __sub) const + { + __glibcxx_assert( ready() ); + return __sub < size() + ? _Base_type::operator[](__sub) + : _M_unmatched_sub(); + } + + /** + * @brief Gets a %sub_match representing the match prefix. + * @pre ready() == true + * + * This function gets a reference to a %sub_match object representing the + * part of the target range between the start of the target range and the + * start of the match. + */ + const_reference + prefix() const + { + __glibcxx_assert( ready() ); + return !empty() ? _M_prefix() : _M_unmatched_sub(); + } + + /** + * @brief Gets a %sub_match representing the match suffix. + * @pre ready() == true + * + * This function gets a reference to a %sub_match object representing the + * part of the target range between the end of the match and the end of + * the target range. + */ + const_reference + suffix() const + { + __glibcxx_assert( ready() ); + return !empty() ? _M_suffix() : _M_unmatched_sub(); + } + + /** + * @brief Gets an iterator to the start of the %sub_match collection. + */ + const_iterator + begin() const + { return _Base_type::begin(); } + + /** + * @brief Gets an iterator to the start of the %sub_match collection. + */ + const_iterator + cbegin() const + { return this->begin(); } + + /** + * @brief Gets an iterator to one-past-the-end of the collection. + */ + const_iterator + end() const + { return _Base_type::end() - (empty() ? 0 : 3); } + + /** + * @brief Gets an iterator to one-past-the-end of the collection. + */ + const_iterator + cend() const + { return this->end(); } + + //@} + + /** + * @name 10.4 Formatting + * + * These functions perform formatted substitution of the matched + * character sequences into their target. The format specifiers and + * escape sequences accepted by these functions are determined by + * their @p flags parameter as documented above. + */ + //@{ + + /** + * @pre ready() == true + */ + template + _Out_iter + format(_Out_iter __out, const char_type* __fmt_first, + const char_type* __fmt_last, + match_flag_type __flags = regex_constants::format_default) const; + + /** + * @pre ready() == true + */ + template + _Out_iter + format(_Out_iter __out, const basic_string& __fmt, + match_flag_type __flags = regex_constants::format_default) const + { + return format(__out, __fmt.data(), __fmt.data() + __fmt.size(), + __flags); + } + + /** + * @pre ready() == true + */ + template + basic_string + format(const basic_string& __fmt, + match_flag_type __flags = regex_constants::format_default) const + { + basic_string __result; + format(std::back_inserter(__result), __fmt, __flags); + return __result; + } + + /** + * @pre ready() == true + */ + string_type + format(const char_type* __fmt, + match_flag_type __flags = regex_constants::format_default) const + { + string_type __result; + format(std::back_inserter(__result), + __fmt, + __fmt + char_traits::length(__fmt), + __flags); + return __result; + } + + //@} + + /** + * @name 10.5 Allocator + */ + //@{ + + /** + * @brief Gets a copy of the allocator. + */ + allocator_type + get_allocator() const + { return _Base_type::get_allocator(); } + + //@} + + /** + * @name 10.6 Swap + */ + //@{ + + /** + * @brief Swaps the contents of two match_results. + */ + void + swap(match_results& __that) + { + using std::swap; + _Base_type::swap(__that); + swap(_M_begin, __that._M_begin); + } + //@} + + private: + template + friend class __detail::_Executor; + + template + friend class regex_iterator; + + template + friend bool __detail:: +#if _GLIBCXX_INLINE_VERSION + __7:: // Required due to PR c++/59256 +#endif + __regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&, + const basic_regex<_Cp, _Rp>&, + regex_constants::match_flag_type); + + void + _M_resize(unsigned int __size) + { _Base_type::resize(__size + 3); } + + const_reference + _M_unmatched_sub() const + { return _Base_type::operator[](_Base_type::size() - 3); } + + sub_match<_Bi_iter>& + _M_unmatched_sub() + { return _Base_type::operator[](_Base_type::size() - 3); } + + const_reference + _M_prefix() const + { return _Base_type::operator[](_Base_type::size() - 2); } + + sub_match<_Bi_iter>& + _M_prefix() + { return _Base_type::operator[](_Base_type::size() - 2); } + + const_reference + _M_suffix() const + { return _Base_type::operator[](_Base_type::size() - 1); } + + sub_match<_Bi_iter>& + _M_suffix() + { return _Base_type::operator[](_Base_type::size() - 1); } + + _Bi_iter _M_begin; + }; + + typedef match_results cmatch; + typedef match_results smatch; +#ifdef _GLIBCXX_USE_WCHAR_T + typedef match_results wcmatch; + typedef match_results wsmatch; +#endif + + // match_results comparisons + /** + * @brief Compares two match_results for equality. + * @returns true if the two objects refer to the same match, + * false otherwise. + */ + template + inline bool + operator==(const match_results<_Bi_iter, _Alloc>& __m1, + const match_results<_Bi_iter, _Alloc>& __m2) + { + if (__m1.ready() != __m2.ready()) + return false; + if (!__m1.ready()) // both are not ready + return true; + if (__m1.empty() != __m2.empty()) + return false; + if (__m1.empty()) // both are empty + return true; + return __m1.prefix() == __m2.prefix() + && __m1.size() == __m2.size() + && std::equal(__m1.begin(), __m1.end(), __m2.begin()) + && __m1.suffix() == __m2.suffix(); + } + + /** + * @brief Compares two match_results for inequality. + * @returns true if the two objects do not refer to the same match, + * false otherwise. + */ + template + inline bool + operator!=(const match_results<_Bi_iter, _Alloc>& __m1, + const match_results<_Bi_iter, _Alloc>& __m2) + { return !(__m1 == __m2); } + + // [7.10.6] match_results swap + /** + * @brief Swaps two match results. + * @param __lhs A match result. + * @param __rhs A match result. + * + * The contents of the two match_results objects are swapped. + */ + template + inline void + swap(match_results<_Bi_iter, _Alloc>& __lhs, + match_results<_Bi_iter, _Alloc>& __rhs) + { __lhs.swap(__rhs); } + +_GLIBCXX_END_NAMESPACE_CXX11 + + // [7.11.2] Function template regex_match + /** + * @name Matching, Searching, and Replacing + */ + //@{ + + /** + * @brief Determines if there is a match between the regular expression @p e + * and all of the character sequence [first, last). + * + * @param __s Start of the character sequence to match. + * @param __e One-past-the-end of the character sequence to match. + * @param __m The match results. + * @param __re The regular expression. + * @param __flags Controls how the regular expression is matched. + * + * @retval true A match exists. + * @retval false Otherwise. + * + * @throws an exception of type regex_error. + */ + template + inline bool + regex_match(_Bi_iter __s, + _Bi_iter __e, + match_results<_Bi_iter, _Alloc>& __m, + const basic_regex<_Ch_type, _Rx_traits>& __re, + regex_constants::match_flag_type __flags + = regex_constants::match_default) + { + return __detail::__regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits, + __detail::_RegexExecutorPolicy::_S_auto, true> + (__s, __e, __m, __re, __flags); + } + + /** + * @brief Indicates if there is a match between the regular expression @p e + * and all of the character sequence [first, last). + * + * @param __first Beginning of the character sequence to match. + * @param __last One-past-the-end of the character sequence to match. + * @param __re The regular expression. + * @param __flags Controls how the regular expression is matched. + * + * @retval true A match exists. + * @retval false Otherwise. + * + * @throws an exception of type regex_error. + */ + template + inline bool + regex_match(_Bi_iter __first, _Bi_iter __last, + const basic_regex<_Ch_type, _Rx_traits>& __re, + regex_constants::match_flag_type __flags + = regex_constants::match_default) + { + match_results<_Bi_iter> __what; + return regex_match(__first, __last, __what, __re, __flags); + } + + /** + * @brief Determines if there is a match between the regular expression @p e + * and a C-style null-terminated string. + * + * @param __s The C-style null-terminated string to match. + * @param __m The match results. + * @param __re The regular expression. + * @param __f Controls how the regular expression is matched. + * + * @retval true A match exists. + * @retval false Otherwise. + * + * @throws an exception of type regex_error. + */ + template + inline bool + regex_match(const _Ch_type* __s, + match_results& __m, + const basic_regex<_Ch_type, _Rx_traits>& __re, + regex_constants::match_flag_type __f + = regex_constants::match_default) + { return regex_match(__s, __s + _Rx_traits::length(__s), __m, __re, __f); } + + /** + * @brief Determines if there is a match between the regular expression @p e + * and a string. + * + * @param __s The string to match. + * @param __m The match results. + * @param __re The regular expression. + * @param __flags Controls how the regular expression is matched. + * + * @retval true A match exists. + * @retval false Otherwise. + * + * @throws an exception of type regex_error. + */ + template + inline bool + regex_match(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s, + match_results::const_iterator, _Alloc>& __m, + const basic_regex<_Ch_type, _Rx_traits>& __re, + regex_constants::match_flag_type __flags + = regex_constants::match_default) + { return regex_match(__s.begin(), __s.end(), __m, __re, __flags); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2329. regex_match() with match_results should forbid temporary strings + /// Prevent unsafe attempts to get match_results from a temporary string. + template + bool + regex_match(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>&&, + match_results::const_iterator, _Alloc>&, + const basic_regex<_Ch_type, _Rx_traits>&, + regex_constants::match_flag_type + = regex_constants::match_default) = delete; + + /** + * @brief Indicates if there is a match between the regular expression @p e + * and a C-style null-terminated string. + * + * @param __s The C-style null-terminated string to match. + * @param __re The regular expression. + * @param __f Controls how the regular expression is matched. + * + * @retval true A match exists. + * @retval false Otherwise. + * + * @throws an exception of type regex_error. + */ + template + inline bool + regex_match(const _Ch_type* __s, + const basic_regex<_Ch_type, _Rx_traits>& __re, + regex_constants::match_flag_type __f + = regex_constants::match_default) + { return regex_match(__s, __s + _Rx_traits::length(__s), __re, __f); } + + /** + * @brief Indicates if there is a match between the regular expression @p e + * and a string. + * + * @param __s [IN] The string to match. + * @param __re [IN] The regular expression. + * @param __flags [IN] Controls how the regular expression is matched. + * + * @retval true A match exists. + * @retval false Otherwise. + * + * @throws an exception of type regex_error. + */ + template + inline bool + regex_match(const basic_string<_Ch_type, _Ch_traits, _Str_allocator>& __s, + const basic_regex<_Ch_type, _Rx_traits>& __re, + regex_constants::match_flag_type __flags + = regex_constants::match_default) + { return regex_match(__s.begin(), __s.end(), __re, __flags); } + + // [7.11.3] Function template regex_search + /** + * Searches for a regular expression within a range. + * @param __s [IN] The start of the string to search. + * @param __e [IN] One-past-the-end of the string to search. + * @param __m [OUT] The match results. + * @param __re [IN] The regular expression to search for. + * @param __flags [IN] Search policy flags. + * @retval true A match was found within the string. + * @retval false No match was found within the string, the content of %m is + * undefined. + * + * @throws an exception of type regex_error. + */ + template + inline bool + regex_search(_Bi_iter __s, _Bi_iter __e, + match_results<_Bi_iter, _Alloc>& __m, + const basic_regex<_Ch_type, _Rx_traits>& __re, + regex_constants::match_flag_type __flags + = regex_constants::match_default) + { + return __detail::__regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits, + __detail::_RegexExecutorPolicy::_S_auto, false> + (__s, __e, __m, __re, __flags); + } + + /** + * Searches for a regular expression within a range. + * @param __first [IN] The start of the string to search. + * @param __last [IN] One-past-the-end of the string to search. + * @param __re [IN] The regular expression to search for. + * @param __flags [IN] Search policy flags. + * @retval true A match was found within the string. + * @retval false No match was found within the string. + * + * @throws an exception of type regex_error. + */ + template + inline bool + regex_search(_Bi_iter __first, _Bi_iter __last, + const basic_regex<_Ch_type, _Rx_traits>& __re, + regex_constants::match_flag_type __flags + = regex_constants::match_default) + { + match_results<_Bi_iter> __what; + return regex_search(__first, __last, __what, __re, __flags); + } + + /** + * @brief Searches for a regular expression within a C-string. + * @param __s [IN] A C-string to search for the regex. + * @param __m [OUT] The set of regex matches. + * @param __e [IN] The regex to search for in @p s. + * @param __f [IN] The search flags. + * @retval true A match was found within the string. + * @retval false No match was found within the string, the content of %m is + * undefined. + * + * @throws an exception of type regex_error. + */ + template + inline bool + regex_search(const _Ch_type* __s, + match_results& __m, + const basic_regex<_Ch_type, _Rx_traits>& __e, + regex_constants::match_flag_type __f + = regex_constants::match_default) + { return regex_search(__s, __s + _Rx_traits::length(__s), __m, __e, __f); } + + /** + * @brief Searches for a regular expression within a C-string. + * @param __s [IN] The C-string to search. + * @param __e [IN] The regular expression to search for. + * @param __f [IN] Search policy flags. + * @retval true A match was found within the string. + * @retval false No match was found within the string. + * + * @throws an exception of type regex_error. + */ + template + inline bool + regex_search(const _Ch_type* __s, + const basic_regex<_Ch_type, _Rx_traits>& __e, + regex_constants::match_flag_type __f + = regex_constants::match_default) + { return regex_search(__s, __s + _Rx_traits::length(__s), __e, __f); } + + /** + * @brief Searches for a regular expression within a string. + * @param __s [IN] The string to search. + * @param __e [IN] The regular expression to search for. + * @param __flags [IN] Search policy flags. + * @retval true A match was found within the string. + * @retval false No match was found within the string. + * + * @throws an exception of type regex_error. + */ + template + inline bool + regex_search(const basic_string<_Ch_type, _Ch_traits, + _String_allocator>& __s, + const basic_regex<_Ch_type, _Rx_traits>& __e, + regex_constants::match_flag_type __flags + = regex_constants::match_default) + { return regex_search(__s.begin(), __s.end(), __e, __flags); } + + /** + * @brief Searches for a regular expression within a string. + * @param __s [IN] A C++ string to search for the regex. + * @param __m [OUT] The set of regex matches. + * @param __e [IN] The regex to search for in @p s. + * @param __f [IN] The search flags. + * @retval true A match was found within the string. + * @retval false No match was found within the string, the content of %m is + * undefined. + * + * @throws an exception of type regex_error. + */ + template + inline bool + regex_search(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>& __s, + match_results::const_iterator, _Alloc>& __m, + const basic_regex<_Ch_type, _Rx_traits>& __e, + regex_constants::match_flag_type __f + = regex_constants::match_default) + { return regex_search(__s.begin(), __s.end(), __m, __e, __f); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2329. regex_search() with match_results should forbid temporary strings + /// Prevent unsafe attempts to get match_results from a temporary string. + template + bool + regex_search(const basic_string<_Ch_type, _Ch_traits, _Ch_alloc>&&, + match_results::const_iterator, _Alloc>&, + const basic_regex<_Ch_type, _Rx_traits>&, + regex_constants::match_flag_type + = regex_constants::match_default) = delete; + + // std [28.11.4] Function template regex_replace + /** + * @brief Search for a regular expression within a range for multiple times, + and replace the matched parts through filling a format string. + * @param __out [OUT] The output iterator. + * @param __first [IN] The start of the string to search. + * @param __last [IN] One-past-the-end of the string to search. + * @param __e [IN] The regular expression to search for. + * @param __fmt [IN] The format string. + * @param __flags [IN] Search and replace policy flags. + * + * @returns __out + * @throws an exception of type regex_error. + */ + template + inline _Out_iter + regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last, + const basic_regex<_Ch_type, _Rx_traits>& __e, + const basic_string<_Ch_type, _St, _Sa>& __fmt, + regex_constants::match_flag_type __flags + = regex_constants::match_default) + { + return regex_replace(__out, __first, __last, __e, __fmt.c_str(), __flags); + } + + /** + * @brief Search for a regular expression within a range for multiple times, + and replace the matched parts through filling a format C-string. + * @param __out [OUT] The output iterator. + * @param __first [IN] The start of the string to search. + * @param __last [IN] One-past-the-end of the string to search. + * @param __e [IN] The regular expression to search for. + * @param __fmt [IN] The format C-string. + * @param __flags [IN] Search and replace policy flags. + * + * @returns __out + * @throws an exception of type regex_error. + */ + template + _Out_iter + regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last, + const basic_regex<_Ch_type, _Rx_traits>& __e, + const _Ch_type* __fmt, + regex_constants::match_flag_type __flags + = regex_constants::match_default); + + /** + * @brief Search for a regular expression within a string for multiple times, + and replace the matched parts through filling a format string. + * @param __s [IN] The string to search and replace. + * @param __e [IN] The regular expression to search for. + * @param __fmt [IN] The format string. + * @param __flags [IN] Search and replace policy flags. + * + * @returns The string after replacing. + * @throws an exception of type regex_error. + */ + template + inline basic_string<_Ch_type, _St, _Sa> + regex_replace(const basic_string<_Ch_type, _St, _Sa>& __s, + const basic_regex<_Ch_type, _Rx_traits>& __e, + const basic_string<_Ch_type, _Fst, _Fsa>& __fmt, + regex_constants::match_flag_type __flags + = regex_constants::match_default) + { + basic_string<_Ch_type, _St, _Sa> __result; + regex_replace(std::back_inserter(__result), + __s.begin(), __s.end(), __e, __fmt, __flags); + return __result; + } + + /** + * @brief Search for a regular expression within a string for multiple times, + and replace the matched parts through filling a format C-string. + * @param __s [IN] The string to search and replace. + * @param __e [IN] The regular expression to search for. + * @param __fmt [IN] The format C-string. + * @param __flags [IN] Search and replace policy flags. + * + * @returns The string after replacing. + * @throws an exception of type regex_error. + */ + template + inline basic_string<_Ch_type, _St, _Sa> + regex_replace(const basic_string<_Ch_type, _St, _Sa>& __s, + const basic_regex<_Ch_type, _Rx_traits>& __e, + const _Ch_type* __fmt, + regex_constants::match_flag_type __flags + = regex_constants::match_default) + { + basic_string<_Ch_type, _St, _Sa> __result; + regex_replace(std::back_inserter(__result), + __s.begin(), __s.end(), __e, __fmt, __flags); + return __result; + } + + /** + * @brief Search for a regular expression within a C-string for multiple + times, and replace the matched parts through filling a format string. + * @param __s [IN] The C-string to search and replace. + * @param __e [IN] The regular expression to search for. + * @param __fmt [IN] The format string. + * @param __flags [IN] Search and replace policy flags. + * + * @returns The string after replacing. + * @throws an exception of type regex_error. + */ + template + inline basic_string<_Ch_type> + regex_replace(const _Ch_type* __s, + const basic_regex<_Ch_type, _Rx_traits>& __e, + const basic_string<_Ch_type, _St, _Sa>& __fmt, + regex_constants::match_flag_type __flags + = regex_constants::match_default) + { + basic_string<_Ch_type> __result; + regex_replace(std::back_inserter(__result), __s, + __s + char_traits<_Ch_type>::length(__s), + __e, __fmt, __flags); + return __result; + } + + /** + * @brief Search for a regular expression within a C-string for multiple + times, and replace the matched parts through filling a format C-string. + * @param __s [IN] The C-string to search and replace. + * @param __e [IN] The regular expression to search for. + * @param __fmt [IN] The format C-string. + * @param __flags [IN] Search and replace policy flags. + * + * @returns The string after replacing. + * @throws an exception of type regex_error. + */ + template + inline basic_string<_Ch_type> + regex_replace(const _Ch_type* __s, + const basic_regex<_Ch_type, _Rx_traits>& __e, + const _Ch_type* __fmt, + regex_constants::match_flag_type __flags + = regex_constants::match_default) + { + basic_string<_Ch_type> __result; + regex_replace(std::back_inserter(__result), __s, + __s + char_traits<_Ch_type>::length(__s), + __e, __fmt, __flags); + return __result; + } + + //@} + +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + // std [28.12] Class template regex_iterator + /** + * An iterator adaptor that will provide repeated calls of regex_search over + * a range until no more matches remain. + */ + template::value_type, + typename _Rx_traits = regex_traits<_Ch_type> > + class regex_iterator + { + public: + typedef basic_regex<_Ch_type, _Rx_traits> regex_type; + typedef match_results<_Bi_iter> value_type; + typedef std::ptrdiff_t difference_type; + typedef const value_type* pointer; + typedef const value_type& reference; + typedef std::forward_iterator_tag iterator_category; + + /** + * @brief Provides a singular iterator, useful for indicating + * one-past-the-end of a range. + */ + regex_iterator() + : _M_pregex() + { } + + /** + * Constructs a %regex_iterator... + * @param __a [IN] The start of a text range to search. + * @param __b [IN] One-past-the-end of the text range to search. + * @param __re [IN] The regular expression to match. + * @param __m [IN] Policy flags for match rules. + */ + regex_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re, + regex_constants::match_flag_type __m + = regex_constants::match_default) + : _M_begin(__a), _M_end(__b), _M_pregex(&__re), _M_flags(__m), _M_match() + { + if (!regex_search(_M_begin, _M_end, _M_match, *_M_pregex, _M_flags)) + *this = regex_iterator(); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2332. regex_iterator should forbid temporary regexes + regex_iterator(_Bi_iter, _Bi_iter, const regex_type&&, + regex_constants::match_flag_type + = regex_constants::match_default) = delete; + /** + * Copy constructs a %regex_iterator. + */ + regex_iterator(const regex_iterator& __rhs) = default; + + /** + * @brief Assigns one %regex_iterator to another. + */ + regex_iterator& + operator=(const regex_iterator& __rhs) = default; + + /** + * @brief Tests the equivalence of two regex iterators. + */ + bool + operator==(const regex_iterator& __rhs) const; + + /** + * @brief Tests the inequivalence of two regex iterators. + */ + bool + operator!=(const regex_iterator& __rhs) const + { return !(*this == __rhs); } + + /** + * @brief Dereferences a %regex_iterator. + */ + const value_type& + operator*() const + { return _M_match; } + + /** + * @brief Selects a %regex_iterator member. + */ + const value_type* + operator->() const + { return &_M_match; } + + /** + * @brief Increments a %regex_iterator. + */ + regex_iterator& + operator++(); + + /** + * @brief Postincrements a %regex_iterator. + */ + regex_iterator + operator++(int) + { + auto __tmp = *this; + ++(*this); + return __tmp; + } + + private: + _Bi_iter _M_begin; + _Bi_iter _M_end; + const regex_type* _M_pregex; + regex_constants::match_flag_type _M_flags; + match_results<_Bi_iter> _M_match; + }; + + typedef regex_iterator cregex_iterator; + typedef regex_iterator sregex_iterator; +#ifdef _GLIBCXX_USE_WCHAR_T + typedef regex_iterator wcregex_iterator; + typedef regex_iterator wsregex_iterator; +#endif + + // [7.12.2] Class template regex_token_iterator + /** + * Iterates over submatches in a range (or @a splits a text string). + * + * The purpose of this iterator is to enumerate all, or all specified, + * matches of a regular expression within a text range. The dereferenced + * value of an iterator of this class is a std::sub_match object. + */ + template::value_type, + typename _Rx_traits = regex_traits<_Ch_type> > + class regex_token_iterator + { + public: + typedef basic_regex<_Ch_type, _Rx_traits> regex_type; + typedef sub_match<_Bi_iter> value_type; + typedef std::ptrdiff_t difference_type; + typedef const value_type* pointer; + typedef const value_type& reference; + typedef std::forward_iterator_tag iterator_category; + + public: + /** + * @brief Default constructs a %regex_token_iterator. + * + * A default-constructed %regex_token_iterator is a singular iterator + * that will compare equal to the one-past-the-end value for any + * iterator of the same type. + */ + regex_token_iterator() + : _M_position(), _M_subs(), _M_suffix(), _M_n(0), _M_result(nullptr), + _M_has_m1(false) + { } + + /** + * Constructs a %regex_token_iterator... + * @param __a [IN] The start of the text to search. + * @param __b [IN] One-past-the-end of the text to search. + * @param __re [IN] The regular expression to search for. + * @param __submatch [IN] Which submatch to return. There are some + * special values for this parameter: + * - -1 each enumerated subexpression does NOT + * match the regular expression (aka field + * splitting) + * - 0 the entire string matching the + * subexpression is returned for each match + * within the text. + * - >0 enumerates only the indicated + * subexpression from a match within the text. + * @param __m [IN] Policy flags for match rules. + */ + regex_token_iterator(_Bi_iter __a, _Bi_iter __b, const regex_type& __re, + int __submatch = 0, + regex_constants::match_flag_type __m + = regex_constants::match_default) + : _M_position(__a, __b, __re, __m), _M_subs(1, __submatch), _M_n(0) + { _M_init(__a, __b); } + + /** + * Constructs a %regex_token_iterator... + * @param __a [IN] The start of the text to search. + * @param __b [IN] One-past-the-end of the text to search. + * @param __re [IN] The regular expression to search for. + * @param __submatches [IN] A list of subexpressions to return for each + * regular expression match within the text. + * @param __m [IN] Policy flags for match rules. + */ + regex_token_iterator(_Bi_iter __a, _Bi_iter __b, + const regex_type& __re, + const std::vector& __submatches, + regex_constants::match_flag_type __m + = regex_constants::match_default) + : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0) + { _M_init(__a, __b); } + + /** + * Constructs a %regex_token_iterator... + * @param __a [IN] The start of the text to search. + * @param __b [IN] One-past-the-end of the text to search. + * @param __re [IN] The regular expression to search for. + * @param __submatches [IN] A list of subexpressions to return for each + * regular expression match within the text. + * @param __m [IN] Policy flags for match rules. + */ + regex_token_iterator(_Bi_iter __a, _Bi_iter __b, + const regex_type& __re, + initializer_list __submatches, + regex_constants::match_flag_type __m + = regex_constants::match_default) + : _M_position(__a, __b, __re, __m), _M_subs(__submatches), _M_n(0) + { _M_init(__a, __b); } + + /** + * Constructs a %regex_token_iterator... + * @param __a [IN] The start of the text to search. + * @param __b [IN] One-past-the-end of the text to search. + * @param __re [IN] The regular expression to search for. + * @param __submatches [IN] A list of subexpressions to return for each + * regular expression match within the text. + * @param __m [IN] Policy flags for match rules. + */ + template + regex_token_iterator(_Bi_iter __a, _Bi_iter __b, + const regex_type& __re, + const int (&__submatches)[_Nm], + regex_constants::match_flag_type __m + = regex_constants::match_default) + : _M_position(__a, __b, __re, __m), + _M_subs(__submatches, __submatches + _Nm), _M_n(0) + { _M_init(__a, __b); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2332. regex_token_iterator should forbid temporary regexes + regex_token_iterator(_Bi_iter, _Bi_iter, const regex_type&&, int = 0, + regex_constants::match_flag_type = + regex_constants::match_default) = delete; + regex_token_iterator(_Bi_iter, _Bi_iter, const regex_type&&, + const std::vector&, + regex_constants::match_flag_type = + regex_constants::match_default) = delete; + regex_token_iterator(_Bi_iter, _Bi_iter, const regex_type&&, + initializer_list, + regex_constants::match_flag_type = + regex_constants::match_default) = delete; + template + regex_token_iterator(_Bi_iter, _Bi_iter, const regex_type&&, + const int (&)[_Nm], + regex_constants::match_flag_type = + regex_constants::match_default) = delete; + + /** + * @brief Copy constructs a %regex_token_iterator. + * @param __rhs [IN] A %regex_token_iterator to copy. + */ + regex_token_iterator(const regex_token_iterator& __rhs) + : _M_position(__rhs._M_position), _M_subs(__rhs._M_subs), + _M_suffix(__rhs._M_suffix), _M_n(__rhs._M_n), _M_has_m1(__rhs._M_has_m1) + { _M_normalize_result(); } + + /** + * @brief Assigns a %regex_token_iterator to another. + * @param __rhs [IN] A %regex_token_iterator to copy. + */ + regex_token_iterator& + operator=(const regex_token_iterator& __rhs); + + /** + * @brief Compares a %regex_token_iterator to another for equality. + */ + bool + operator==(const regex_token_iterator& __rhs) const; + + /** + * @brief Compares a %regex_token_iterator to another for inequality. + */ + bool + operator!=(const regex_token_iterator& __rhs) const + { return !(*this == __rhs); } + + /** + * @brief Dereferences a %regex_token_iterator. + */ + const value_type& + operator*() const + { return *_M_result; } + + /** + * @brief Selects a %regex_token_iterator member. + */ + const value_type* + operator->() const + { return _M_result; } + + /** + * @brief Increments a %regex_token_iterator. + */ + regex_token_iterator& + operator++(); + + /** + * @brief Postincrements a %regex_token_iterator. + */ + regex_token_iterator + operator++(int) + { + auto __tmp = *this; + ++(*this); + return __tmp; + } + + private: + typedef regex_iterator<_Bi_iter, _Ch_type, _Rx_traits> _Position; + + void + _M_init(_Bi_iter __a, _Bi_iter __b); + + const value_type& + _M_current_match() const + { + if (_M_subs[_M_n] == -1) + return (*_M_position).prefix(); + else + return (*_M_position)[_M_subs[_M_n]]; + } + + constexpr bool + _M_end_of_seq() const + { return _M_result == nullptr; } + + // [28.12.2.2.4] + void + _M_normalize_result() + { + if (_M_position != _Position()) + _M_result = &_M_current_match(); + else if (_M_has_m1) + _M_result = &_M_suffix; + else + _M_result = nullptr; + } + + _Position _M_position; + std::vector _M_subs; + value_type _M_suffix; + std::size_t _M_n; + const value_type* _M_result; + + // Show whether _M_subs contains -1 + bool _M_has_m1; + }; + + /** @brief Token iterator for C-style NULL-terminated strings. */ + typedef regex_token_iterator cregex_token_iterator; + + /** @brief Token iterator for standard strings. */ + typedef regex_token_iterator sregex_token_iterator; + +#ifdef _GLIBCXX_USE_WCHAR_T + /** @brief Token iterator for C-style NULL-terminated wide strings. */ + typedef regex_token_iterator wcregex_token_iterator; + + /** @brief Token iterator for standard wide-character strings. */ + typedef regex_token_iterator wsregex_token_iterator; +#endif + + //@} // group regex + +_GLIBCXX_END_NAMESPACE_CXX11 +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#include diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_automaton.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_automaton.h new file mode 100644 index 0000000..a5fab63 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_automaton.h @@ -0,0 +1,400 @@ +// class template regex -*- C++ -*- + +// Copyright (C) 2013-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** + * @file bits/regex_automaton.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{regex} + */ + +// This macro defines the maximal state number a NFA can have. +#ifndef _GLIBCXX_REGEX_STATE_LIMIT +#define _GLIBCXX_REGEX_STATE_LIMIT 100000 +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace __detail +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @defgroup regex-detail Base and Implementation Classes + * @ingroup regex + * @{ + */ + + typedef long _StateIdT; + static const _StateIdT _S_invalid_state_id = -1; + + template + using _Matcher = std::function; + + /// Operation codes that define the type of transitions within the base NFA + /// that represents the regular expression. + enum _Opcode : int + { + _S_opcode_unknown, + _S_opcode_alternative, + _S_opcode_repeat, + _S_opcode_backref, + _S_opcode_line_begin_assertion, + _S_opcode_line_end_assertion, + _S_opcode_word_boundary, + _S_opcode_subexpr_lookahead, + _S_opcode_subexpr_begin, + _S_opcode_subexpr_end, + _S_opcode_dummy, + _S_opcode_match, + _S_opcode_accept, + }; + + struct _State_base + { + protected: + _Opcode _M_opcode; // type of outgoing transition + + public: + _StateIdT _M_next; // outgoing transition + union // Since they are mutually exclusive. + { + size_t _M_subexpr; // for _S_opcode_subexpr_* + size_t _M_backref_index; // for _S_opcode_backref + struct + { + // for _S_opcode_alternative, _S_opcode_repeat and + // _S_opcode_subexpr_lookahead + _StateIdT _M_alt; + // for _S_opcode_word_boundary or _S_opcode_subexpr_lookahead or + // quantifiers (ungreedy if set true) + bool _M_neg; + }; + // For _S_opcode_match + __gnu_cxx::__aligned_membuf<_Matcher> _M_matcher_storage; + }; + + protected: + explicit _State_base(_Opcode __opcode) + : _M_opcode(__opcode), _M_next(_S_invalid_state_id) + { } + + public: + bool + _M_has_alt() + { + return _M_opcode == _S_opcode_alternative + || _M_opcode == _S_opcode_repeat + || _M_opcode == _S_opcode_subexpr_lookahead; + } + +#ifdef _GLIBCXX_DEBUG + std::ostream& + _M_print(std::ostream& ostr) const; + + // Prints graphviz dot commands for state. + std::ostream& + _M_dot(std::ostream& __ostr, _StateIdT __id) const; +#endif + }; + + template + struct _State : _State_base + { + typedef _Matcher<_Char_type> _MatcherT; + static_assert(sizeof(_MatcherT) == sizeof(_Matcher), + "std::function has the same size as " + "std::function"); + static_assert(alignof(_MatcherT) == alignof(_Matcher), + "std::function has the same alignment as " + "std::function"); + + explicit + _State(_Opcode __opcode) : _State_base(__opcode) + { + if (_M_opcode() == _S_opcode_match) + new (this->_M_matcher_storage._M_addr()) _MatcherT(); + } + + _State(const _State& __rhs) : _State_base(__rhs) + { + if (__rhs._M_opcode() == _S_opcode_match) + new (this->_M_matcher_storage._M_addr()) + _MatcherT(__rhs._M_get_matcher()); + } + + _State(_State&& __rhs) : _State_base(__rhs) + { + if (__rhs._M_opcode() == _S_opcode_match) + new (this->_M_matcher_storage._M_addr()) + _MatcherT(std::move(__rhs._M_get_matcher())); + } + + _State& + operator=(const _State&) = delete; + + ~_State() + { + if (_M_opcode() == _S_opcode_match) + _M_get_matcher().~_MatcherT(); + } + + // Since correct ctor and dtor rely on _M_opcode, it's better not to + // change it over time. + _Opcode + _M_opcode() const + { return _State_base::_M_opcode; } + + bool + _M_matches(_Char_type __char) const + { return _M_get_matcher()(__char); } + + _MatcherT& + _M_get_matcher() + { return *static_cast<_MatcherT*>(this->_M_matcher_storage._M_addr()); } + + const _MatcherT& + _M_get_matcher() const + { + return *static_cast( + this->_M_matcher_storage._M_addr()); + } + }; + + struct _NFA_base + { + typedef size_t _SizeT; + typedef regex_constants::syntax_option_type _FlagT; + + explicit + _NFA_base(_FlagT __f) + : _M_flags(__f), _M_start_state(0), _M_subexpr_count(0), + _M_has_backref(false) + { } + + _NFA_base(_NFA_base&&) = default; + + protected: + ~_NFA_base() = default; + + public: + _FlagT + _M_options() const + { return _M_flags; } + + _StateIdT + _M_start() const + { return _M_start_state; } + + _SizeT + _M_sub_count() const + { return _M_subexpr_count; } + + std::vector _M_paren_stack; + _FlagT _M_flags; + _StateIdT _M_start_state; + _SizeT _M_subexpr_count; + bool _M_has_backref; + }; + + template + struct _NFA + : _NFA_base, std::vector<_State> + { + typedef typename _TraitsT::char_type _Char_type; + typedef _State<_Char_type> _StateT; + typedef _Matcher<_Char_type> _MatcherT; + + _NFA(const typename _TraitsT::locale_type& __loc, _FlagT __flags) + : _NFA_base(__flags) + { _M_traits.imbue(__loc); } + + // for performance reasons _NFA objects should only be moved not copied + _NFA(const _NFA&) = delete; + _NFA(_NFA&&) = default; + + _StateIdT + _M_insert_accept() + { + auto __ret = _M_insert_state(_StateT(_S_opcode_accept)); + return __ret; + } + + _StateIdT + _M_insert_alt(_StateIdT __next, _StateIdT __alt, + bool __neg __attribute__((__unused__))) + { + _StateT __tmp(_S_opcode_alternative); + // It labels every quantifier to make greedy comparison easier in BFS + // approach. + __tmp._M_next = __next; + __tmp._M_alt = __alt; + return _M_insert_state(std::move(__tmp)); + } + + _StateIdT + _M_insert_repeat(_StateIdT __next, _StateIdT __alt, bool __neg) + { + _StateT __tmp(_S_opcode_repeat); + // It labels every quantifier to make greedy comparison easier in BFS + // approach. + __tmp._M_next = __next; + __tmp._M_alt = __alt; + __tmp._M_neg = __neg; + return _M_insert_state(std::move(__tmp)); + } + + _StateIdT + _M_insert_matcher(_MatcherT __m) + { + _StateT __tmp(_S_opcode_match); + __tmp._M_get_matcher() = std::move(__m); + return _M_insert_state(std::move(__tmp)); + } + + _StateIdT + _M_insert_subexpr_begin() + { + auto __id = this->_M_subexpr_count++; + this->_M_paren_stack.push_back(__id); + _StateT __tmp(_S_opcode_subexpr_begin); + __tmp._M_subexpr = __id; + return _M_insert_state(std::move(__tmp)); + } + + _StateIdT + _M_insert_subexpr_end() + { + _StateT __tmp(_S_opcode_subexpr_end); + __tmp._M_subexpr = this->_M_paren_stack.back(); + this->_M_paren_stack.pop_back(); + return _M_insert_state(std::move(__tmp)); + } + + _StateIdT + _M_insert_backref(size_t __index); + + _StateIdT + _M_insert_line_begin() + { return _M_insert_state(_StateT(_S_opcode_line_begin_assertion)); } + + _StateIdT + _M_insert_line_end() + { return _M_insert_state(_StateT(_S_opcode_line_end_assertion)); } + + _StateIdT + _M_insert_word_bound(bool __neg) + { + _StateT __tmp(_S_opcode_word_boundary); + __tmp._M_neg = __neg; + return _M_insert_state(std::move(__tmp)); + } + + _StateIdT + _M_insert_lookahead(_StateIdT __alt, bool __neg) + { + _StateT __tmp(_S_opcode_subexpr_lookahead); + __tmp._M_alt = __alt; + __tmp._M_neg = __neg; + return _M_insert_state(std::move(__tmp)); + } + + _StateIdT + _M_insert_dummy() + { return _M_insert_state(_StateT(_S_opcode_dummy)); } + + _StateIdT + _M_insert_state(_StateT __s) + { + this->push_back(std::move(__s)); + if (this->size() > _GLIBCXX_REGEX_STATE_LIMIT) + __throw_regex_error( + regex_constants::error_space, + "Number of NFA states exceeds limit. Please use shorter regex " + "string, or use smaller brace expression, or make " + "_GLIBCXX_REGEX_STATE_LIMIT larger."); + return this->size()-1; + } + + // Eliminate dummy node in this NFA to make it compact. + void + _M_eliminate_dummy(); + +#ifdef _GLIBCXX_DEBUG + std::ostream& + _M_dot(std::ostream& __ostr) const; +#endif + public: + _TraitsT _M_traits; + }; + + /// Describes a sequence of one or more %_State, its current start + /// and end(s). This structure contains fragments of an NFA during + /// construction. + template + class _StateSeq + { + public: + typedef _NFA<_TraitsT> _RegexT; + + public: + _StateSeq(_RegexT& __nfa, _StateIdT __s) + : _M_nfa(__nfa), _M_start(__s), _M_end(__s) + { } + + _StateSeq(_RegexT& __nfa, _StateIdT __s, _StateIdT __end) + : _M_nfa(__nfa), _M_start(__s), _M_end(__end) + { } + + // Append a state on *this and change *this to the new sequence. + void + _M_append(_StateIdT __id) + { + _M_nfa[_M_end]._M_next = __id; + _M_end = __id; + } + + // Append a sequence on *this and change *this to the new sequence. + void + _M_append(const _StateSeq& __s) + { + _M_nfa[_M_end]._M_next = __s._M_start; + _M_end = __s._M_end; + } + + // Clones an entire sequence. + _StateSeq + _M_clone(); + + public: + _RegexT& _M_nfa; + _StateIdT _M_start; + _StateIdT _M_end; + }; + + //@} regex-detail +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace __detail +} // namespace std + +#include diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_compiler.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_compiler.h new file mode 100644 index 0000000..20f72fa --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_compiler.h @@ -0,0 +1,583 @@ +// class template regex -*- C++ -*- + +// Copyright (C) 2010-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** + * @file bits/regex_compiler.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{regex} + */ + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + template + class regex_traits; + +_GLIBCXX_END_NAMESPACE_CXX11 +_GLIBCXX_END_NAMESPACE_VERSION + +namespace __detail +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup regex-detail + * @{ + */ + + template + struct _BracketMatcher; + + /** + * @brief Builds an NFA from an input iterator range. + * + * The %_TraitsT type should fulfill requirements [28.3]. + */ + template + class _Compiler + { + public: + typedef typename _TraitsT::char_type _CharT; + typedef const _CharT* _IterT; + typedef _NFA<_TraitsT> _RegexT; + typedef regex_constants::syntax_option_type _FlagT; + + _Compiler(_IterT __b, _IterT __e, + const typename _TraitsT::locale_type& __traits, _FlagT __flags); + + shared_ptr + _M_get_nfa() + { return std::move(_M_nfa); } + + private: + typedef _Scanner<_CharT> _ScannerT; + typedef typename _TraitsT::string_type _StringT; + typedef typename _ScannerT::_TokenT _TokenT; + typedef _StateSeq<_TraitsT> _StateSeqT; + typedef std::stack<_StateSeqT> _StackT; + typedef std::ctype<_CharT> _CtypeT; + + // accepts a specific token or returns false. + bool + _M_match_token(_TokenT __token); + + void + _M_disjunction(); + + void + _M_alternative(); + + bool + _M_term(); + + bool + _M_assertion(); + + bool + _M_quantifier(); + + bool + _M_atom(); + + bool + _M_bracket_expression(); + + template + void + _M_insert_any_matcher_ecma(); + + template + void + _M_insert_any_matcher_posix(); + + template + void + _M_insert_char_matcher(); + + template + void + _M_insert_character_class_matcher(); + + template + void + _M_insert_bracket_matcher(bool __neg); + + // Returns true if successfully matched one term and should continue. + // Returns false if the compiler should move on. + template + bool + _M_expression_term(pair& __last_char, + _BracketMatcher<_TraitsT, __icase, __collate>& + __matcher); + + int + _M_cur_int_value(int __radix); + + bool + _M_try_char(); + + _StateSeqT + _M_pop() + { + auto ret = _M_stack.top(); + _M_stack.pop(); + return ret; + } + + _FlagT _M_flags; + _ScannerT _M_scanner; + shared_ptr<_RegexT> _M_nfa; + _StringT _M_value; + _StackT _M_stack; + const _TraitsT& _M_traits; + const _CtypeT& _M_ctype; + }; + + template + struct __has_contiguous_iter : std::false_type { }; + + template + struct __has_contiguous_iter> + : std::true_type + { }; + + template + struct __has_contiguous_iter> + : std::true_type + { }; + + template + struct __is_contiguous_normal_iter : std::false_type { }; + + template + struct __is_contiguous_normal_iter<_CharT*> : std::true_type { }; + + template + struct + __is_contiguous_normal_iter<__gnu_cxx::__normal_iterator<_Tp, _Cont>> + : __has_contiguous_iter<_Cont>::type + { }; + + template + using __enable_if_contiguous_normal_iter + = typename enable_if< __is_contiguous_normal_iter<_Iter>::value, + std::shared_ptr> >::type; + + template + using __disable_if_contiguous_normal_iter + = typename enable_if< !__is_contiguous_normal_iter<_Iter>::value, + std::shared_ptr> >::type; + + template + inline __enable_if_contiguous_normal_iter<_FwdIter, _TraitsT> + __compile_nfa(_FwdIter __first, _FwdIter __last, + const typename _TraitsT::locale_type& __loc, + regex_constants::syntax_option_type __flags) + { + size_t __len = __last - __first; + const auto* __cfirst = __len ? std::__addressof(*__first) : nullptr; + using _Cmplr = _Compiler<_TraitsT>; + return _Cmplr(__cfirst, __cfirst + __len, __loc, __flags)._M_get_nfa(); + } + + template + inline __disable_if_contiguous_normal_iter<_FwdIter, _TraitsT> + __compile_nfa(_FwdIter __first, _FwdIter __last, + const typename _TraitsT::locale_type& __loc, + regex_constants::syntax_option_type __flags) + { + using char_type = typename _TraitsT::char_type; + const basic_string __str(__first, __last); + return __compile_nfa(__str.data(), + __str.data() + __str.size(), __loc, __flags); + } + + // [28.13.14] + template + class _RegexTranslatorBase + { + public: + typedef typename _TraitsT::char_type _CharT; + typedef typename _TraitsT::string_type _StringT; + typedef _StringT _StrTransT; + + explicit + _RegexTranslatorBase(const _TraitsT& __traits) + : _M_traits(__traits) + { } + + _CharT + _M_translate(_CharT __ch) const + { + if (__icase) + return _M_traits.translate_nocase(__ch); + else if (__collate) + return _M_traits.translate(__ch); + else + return __ch; + } + + _StrTransT + _M_transform(_CharT __ch) const + { + _StrTransT __str(1, __ch); + return _M_traits.transform(__str.begin(), __str.end()); + } + + // See LWG 523. It's not efficiently implementable when _TraitsT is not + // std::regex_traits<>, and __collate is true. See specializations for + // implementations of other cases. + bool + _M_match_range(const _StrTransT& __first, const _StrTransT& __last, + const _StrTransT& __s) const + { return __first <= __s && __s <= __last; } + + protected: + bool _M_in_range_icase(_CharT __first, _CharT __last, _CharT __ch) const + { + typedef std::ctype<_CharT> __ctype_type; + const auto& __fctyp = use_facet<__ctype_type>(this->_M_traits.getloc()); + auto __lower = __fctyp.tolower(__ch); + auto __upper = __fctyp.toupper(__ch); + return (__first <= __lower && __lower <= __last) + || (__first <= __upper && __upper <= __last); + } + + const _TraitsT& _M_traits; + }; + + template + class _RegexTranslator + : public _RegexTranslatorBase<_TraitsT, __icase, __collate> + { + public: + typedef _RegexTranslatorBase<_TraitsT, __icase, __collate> _Base; + using _Base::_Base; + }; + + template + class _RegexTranslator<_TraitsT, __icase, false> + : public _RegexTranslatorBase<_TraitsT, __icase, false> + { + public: + typedef _RegexTranslatorBase<_TraitsT, __icase, false> _Base; + typedef typename _Base::_CharT _CharT; + typedef _CharT _StrTransT; + + using _Base::_Base; + + _StrTransT + _M_transform(_CharT __ch) const + { return __ch; } + + bool + _M_match_range(_CharT __first, _CharT __last, _CharT __ch) const + { + if (!__icase) + return __first <= __ch && __ch <= __last; + return this->_M_in_range_icase(__first, __last, __ch); + } + }; + + template + class _RegexTranslator, true, true> + : public _RegexTranslatorBase, true, true> + { + public: + typedef _RegexTranslatorBase, true, true> + _Base; + typedef typename _Base::_CharT _CharT; + typedef typename _Base::_StrTransT _StrTransT; + + using _Base::_Base; + + bool + _M_match_range(const _StrTransT& __first, const _StrTransT& __last, + const _StrTransT& __str) const + { + __glibcxx_assert(__first.size() == 1); + __glibcxx_assert(__last.size() == 1); + __glibcxx_assert(__str.size() == 1); + return this->_M_in_range_icase(__first[0], __last[0], __str[0]); + } + }; + + template + class _RegexTranslator<_TraitsT, false, false> + { + public: + typedef typename _TraitsT::char_type _CharT; + typedef _CharT _StrTransT; + + explicit + _RegexTranslator(const _TraitsT&) + { } + + _CharT + _M_translate(_CharT __ch) const + { return __ch; } + + _StrTransT + _M_transform(_CharT __ch) const + { return __ch; } + + bool + _M_match_range(_CharT __first, _CharT __last, _CharT __ch) const + { return __first <= __ch && __ch <= __last; } + }; + + template + struct _AnyMatcher; + + template + struct _AnyMatcher<_TraitsT, false, __icase, __collate> + { + typedef _RegexTranslator<_TraitsT, __icase, __collate> _TransT; + typedef typename _TransT::_CharT _CharT; + + explicit + _AnyMatcher(const _TraitsT& __traits) + : _M_translator(__traits) + { } + + bool + operator()(_CharT __ch) const + { + static auto __nul = _M_translator._M_translate('\0'); + return _M_translator._M_translate(__ch) != __nul; + } + + _TransT _M_translator; + }; + + template + struct _AnyMatcher<_TraitsT, true, __icase, __collate> + { + typedef _RegexTranslator<_TraitsT, __icase, __collate> _TransT; + typedef typename _TransT::_CharT _CharT; + + explicit + _AnyMatcher(const _TraitsT& __traits) + : _M_translator(__traits) + { } + + bool + operator()(_CharT __ch) const + { return _M_apply(__ch, typename is_same<_CharT, char>::type()); } + + bool + _M_apply(_CharT __ch, true_type) const + { + auto __c = _M_translator._M_translate(__ch); + auto __n = _M_translator._M_translate('\n'); + auto __r = _M_translator._M_translate('\r'); + return __c != __n && __c != __r; + } + + bool + _M_apply(_CharT __ch, false_type) const + { + auto __c = _M_translator._M_translate(__ch); + auto __n = _M_translator._M_translate('\n'); + auto __r = _M_translator._M_translate('\r'); + auto __u2028 = _M_translator._M_translate(u'\u2028'); + auto __u2029 = _M_translator._M_translate(u'\u2029'); + return __c != __n && __c != __r && __c != __u2028 && __c != __u2029; + } + + _TransT _M_translator; + }; + + template + struct _CharMatcher + { + typedef _RegexTranslator<_TraitsT, __icase, __collate> _TransT; + typedef typename _TransT::_CharT _CharT; + + _CharMatcher(_CharT __ch, const _TraitsT& __traits) + : _M_translator(__traits), _M_ch(_M_translator._M_translate(__ch)) + { } + + bool + operator()(_CharT __ch) const + { return _M_ch == _M_translator._M_translate(__ch); } + + _TransT _M_translator; + _CharT _M_ch; + }; + + /// Matches a character range (bracket expression) + template + struct _BracketMatcher + { + public: + typedef _RegexTranslator<_TraitsT, __icase, __collate> _TransT; + typedef typename _TransT::_CharT _CharT; + typedef typename _TransT::_StrTransT _StrTransT; + typedef typename _TraitsT::string_type _StringT; + typedef typename _TraitsT::char_class_type _CharClassT; + + public: + _BracketMatcher(bool __is_non_matching, + const _TraitsT& __traits) + : _M_class_set(0), _M_translator(__traits), _M_traits(__traits), + _M_is_non_matching(__is_non_matching) + { } + + bool + operator()(_CharT __ch) const + { + _GLIBCXX_DEBUG_ASSERT(_M_is_ready); + return _M_apply(__ch, _UseCache()); + } + + void + _M_add_char(_CharT __c) + { + _M_char_set.push_back(_M_translator._M_translate(__c)); + _GLIBCXX_DEBUG_ONLY(_M_is_ready = false); + } + + _StringT + _M_add_collate_element(const _StringT& __s) + { + auto __st = _M_traits.lookup_collatename(__s.data(), + __s.data() + __s.size()); + if (__st.empty()) + __throw_regex_error(regex_constants::error_collate, + "Invalid collate element."); + _M_char_set.push_back(_M_translator._M_translate(__st[0])); + _GLIBCXX_DEBUG_ONLY(_M_is_ready = false); + return __st; + } + + void + _M_add_equivalence_class(const _StringT& __s) + { + auto __st = _M_traits.lookup_collatename(__s.data(), + __s.data() + __s.size()); + if (__st.empty()) + __throw_regex_error(regex_constants::error_collate, + "Invalid equivalence class."); + __st = _M_traits.transform_primary(__st.data(), + __st.data() + __st.size()); + _M_equiv_set.push_back(__st); + _GLIBCXX_DEBUG_ONLY(_M_is_ready = false); + } + + // __neg should be true for \D, \S and \W only. + void + _M_add_character_class(const _StringT& __s, bool __neg) + { + auto __mask = _M_traits.lookup_classname(__s.data(), + __s.data() + __s.size(), + __icase); + if (__mask == 0) + __throw_regex_error(regex_constants::error_collate, + "Invalid character class."); + if (!__neg) + _M_class_set |= __mask; + else + _M_neg_class_set.push_back(__mask); + _GLIBCXX_DEBUG_ONLY(_M_is_ready = false); + } + + void + _M_make_range(_CharT __l, _CharT __r) + { + if (__l > __r) + __throw_regex_error(regex_constants::error_range, + "Invalid range in bracket expression."); + _M_range_set.push_back(make_pair(_M_translator._M_transform(__l), + _M_translator._M_transform(__r))); + _GLIBCXX_DEBUG_ONLY(_M_is_ready = false); + } + + void + _M_ready() + { + std::sort(_M_char_set.begin(), _M_char_set.end()); + auto __end = std::unique(_M_char_set.begin(), _M_char_set.end()); + _M_char_set.erase(__end, _M_char_set.end()); + _M_make_cache(_UseCache()); + _GLIBCXX_DEBUG_ONLY(_M_is_ready = true); + } + + private: + // Currently we only use the cache for char + typedef typename std::is_same<_CharT, char>::type _UseCache; + + static constexpr size_t + _S_cache_size() + { + return 1ul << (sizeof(_CharT) * __CHAR_BIT__ * int(_UseCache::value)); + } + + struct _Dummy { }; + typedef typename std::conditional<_UseCache::value, + std::bitset<_S_cache_size()>, + _Dummy>::type _CacheT; + typedef typename std::make_unsigned<_CharT>::type _UnsignedCharT; + + bool + _M_apply(_CharT __ch, false_type) const; + + bool + _M_apply(_CharT __ch, true_type) const + { return _M_cache[static_cast<_UnsignedCharT>(__ch)]; } + + void + _M_make_cache(true_type) + { + for (unsigned __i = 0; __i < _M_cache.size(); __i++) + _M_cache[__i] = _M_apply(static_cast<_CharT>(__i), false_type()); + } + + void + _M_make_cache(false_type) + { } + + private: + std::vector<_CharT> _M_char_set; + std::vector<_StringT> _M_equiv_set; + std::vector> _M_range_set; + std::vector<_CharClassT> _M_neg_class_set; + _CharClassT _M_class_set; + _TransT _M_translator; + const _TraitsT& _M_traits; + bool _M_is_non_matching; + _CacheT _M_cache; +#ifdef _GLIBCXX_DEBUG + bool _M_is_ready = false; +#endif + }; + + //@} regex-detail +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace __detail +} // namespace std + +#include diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_constants.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_constants.h new file mode 100644 index 0000000..dad2d63 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_constants.h @@ -0,0 +1,417 @@ +// class template regex -*- C++ -*- + +// Copyright (C) 2010-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** + * @file bits/regex_constants.h + * @brief Constant definitions for the std regex library. + * + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{regex} + */ + +namespace std _GLIBCXX_VISIBILITY(default) +{ +/** + * @defgroup regex Regular Expressions + * + * A facility for performing regular expression pattern matching. + * @{ + */ + +/** + * @namespace std::regex_constants + * @brief ISO C++-0x entities sub namespace for regex. + */ +namespace regex_constants +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @name 5.1 Regular Expression Syntax Options + */ + //@{ + enum __syntax_option + { + _S_icase, + _S_nosubs, + _S_optimize, + _S_collate, + _S_ECMAScript, + _S_basic, + _S_extended, + _S_awk, + _S_grep, + _S_egrep, + _S_polynomial, + _S_syntax_last + }; + + /** + * @brief This is a bitmask type indicating how to interpret the regex. + * + * The @c syntax_option_type is implementation defined but it is valid to + * perform bitwise operations on these values and expect the right thing to + * happen. + * + * A valid value of type syntax_option_type shall have exactly one of the + * elements @c ECMAScript, @c basic, @c extended, @c awk, @c grep, @c egrep + * %set. + */ + enum syntax_option_type : unsigned int { }; + + /** + * Specifies that the matching of regular expressions against a character + * sequence shall be performed without regard to case. + */ + _GLIBCXX17_INLINE constexpr syntax_option_type icase = + static_cast(1 << _S_icase); + + /** + * Specifies that when a regular expression is matched against a character + * container sequence, no sub-expression matches are to be stored in the + * supplied match_results structure. + */ + _GLIBCXX17_INLINE constexpr syntax_option_type nosubs = + static_cast(1 << _S_nosubs); + + /** + * Specifies that the regular expression engine should pay more attention to + * the speed with which regular expressions are matched, and less to the + * speed with which regular expression objects are constructed. Otherwise + * it has no detectable effect on the program output. + */ + _GLIBCXX17_INLINE constexpr syntax_option_type optimize = + static_cast(1 << _S_optimize); + + /** + * Specifies that character ranges of the form [a-b] should be locale + * sensitive. + */ + _GLIBCXX17_INLINE constexpr syntax_option_type collate = + static_cast(1 << _S_collate); + + /** + * Specifies that the grammar recognized by the regular expression engine is + * that used by ECMAScript in ECMA-262 [Ecma International, ECMAScript + * Language Specification, Standard Ecma-262, third edition, 1999], as + * modified in section [28.13]. This grammar is similar to that defined + * in the PERL scripting language but extended with elements found in the + * POSIX regular expression grammar. + */ + _GLIBCXX17_INLINE constexpr syntax_option_type ECMAScript = + static_cast(1 << _S_ECMAScript); + + /** + * Specifies that the grammar recognized by the regular expression engine is + * that used by POSIX basic regular expressions in IEEE Std 1003.1-2001, + * Portable Operating System Interface (POSIX), Base Definitions and + * Headers, Section 9, Regular Expressions [IEEE, Information Technology -- + * Portable Operating System Interface (POSIX), IEEE Standard 1003.1-2001]. + */ + _GLIBCXX17_INLINE constexpr syntax_option_type basic = + static_cast(1 << _S_basic); + + /** + * Specifies that the grammar recognized by the regular expression engine is + * that used by POSIX extended regular expressions in IEEE Std 1003.1-2001, + * Portable Operating System Interface (POSIX), Base Definitions and + * Headers, Section 9, Regular Expressions. + */ + _GLIBCXX17_INLINE constexpr syntax_option_type extended = + static_cast(1 << _S_extended); + + /** + * Specifies that the grammar recognized by the regular expression engine is + * that used by POSIX utility awk in IEEE Std 1003.1-2001. This option is + * identical to syntax_option_type extended, except that C-style escape + * sequences are supported. These sequences are: + * \\\\, \\a, \\b, \\f, \\n, \\r, \\t , \\v, \\&apos,, &apos,, + * and \\ddd (where ddd is one, two, or three octal digits). + */ + _GLIBCXX17_INLINE constexpr syntax_option_type awk = + static_cast(1 << _S_awk); + + /** + * Specifies that the grammar recognized by the regular expression engine is + * that used by POSIX utility grep in IEEE Std 1003.1-2001. This option is + * identical to syntax_option_type basic, except that newlines are treated + * as whitespace. + */ + _GLIBCXX17_INLINE constexpr syntax_option_type grep = + static_cast(1 << _S_grep); + + /** + * Specifies that the grammar recognized by the regular expression engine is + * that used by POSIX utility grep when given the -E option in + * IEEE Std 1003.1-2001. This option is identical to syntax_option_type + * extended, except that newlines are treated as whitespace. + */ + _GLIBCXX17_INLINE constexpr syntax_option_type egrep = + static_cast(1 << _S_egrep); + + /** + * Extension: Ensure both space complexity of compiled regex and + * time complexity execution are not exponential. + * If specified in a regex with back-references, the exception + * regex_constants::error_complexity will be thrown. + */ + _GLIBCXX17_INLINE constexpr syntax_option_type __polynomial = + static_cast(1 << _S_polynomial); + + constexpr inline syntax_option_type + operator&(syntax_option_type __a, syntax_option_type __b) + { + return (syntax_option_type)(static_cast(__a) + & static_cast(__b)); + } + + constexpr inline syntax_option_type + operator|(syntax_option_type __a, syntax_option_type __b) + { + return (syntax_option_type)(static_cast(__a) + | static_cast(__b)); + } + + constexpr inline syntax_option_type + operator^(syntax_option_type __a, syntax_option_type __b) + { + return (syntax_option_type)(static_cast(__a) + ^ static_cast(__b)); + } + + constexpr inline syntax_option_type + operator~(syntax_option_type __a) + { return (syntax_option_type)(~static_cast(__a)); } + + inline syntax_option_type& + operator&=(syntax_option_type& __a, syntax_option_type __b) + { return __a = __a & __b; } + + inline syntax_option_type& + operator|=(syntax_option_type& __a, syntax_option_type __b) + { return __a = __a | __b; } + + inline syntax_option_type& + operator^=(syntax_option_type& __a, syntax_option_type __b) + { return __a = __a ^ __b; } + + //@} + + /** + * @name 5.2 Matching Rules + * + * Matching a regular expression against a sequence of characters [first, + * last) proceeds according to the rules of the grammar specified for the + * regular expression object, modified according to the effects listed + * below for any bitmask elements set. + * + */ + //@{ + + enum __match_flag + { + _S_not_bol, + _S_not_eol, + _S_not_bow, + _S_not_eow, + _S_any, + _S_not_null, + _S_continuous, + _S_prev_avail, + _S_sed, + _S_no_copy, + _S_first_only, + _S_match_flag_last + }; + + /** + * @brief This is a bitmask type indicating regex matching rules. + * + * The @c match_flag_type is implementation defined but it is valid to + * perform bitwise operations on these values and expect the right thing to + * happen. + */ + enum match_flag_type : unsigned int { }; + + /** + * The default matching rules. + */ + _GLIBCXX17_INLINE constexpr match_flag_type match_default = + static_cast(0); + + /** + * The first character in the sequence [first, last) is treated as though it + * is not at the beginning of a line, so the character (^) in the regular + * expression shall not match [first, first). + */ + _GLIBCXX17_INLINE constexpr match_flag_type match_not_bol = + static_cast(1 << _S_not_bol); + + /** + * The last character in the sequence [first, last) is treated as though it + * is not at the end of a line, so the character ($) in the regular + * expression shall not match [last, last). + */ + _GLIBCXX17_INLINE constexpr match_flag_type match_not_eol = + static_cast(1 << _S_not_eol); + + /** + * The expression \\b is not matched against the sub-sequence + * [first,first). + */ + _GLIBCXX17_INLINE constexpr match_flag_type match_not_bow = + static_cast(1 << _S_not_bow); + + /** + * The expression \\b should not be matched against the sub-sequence + * [last,last). + */ + _GLIBCXX17_INLINE constexpr match_flag_type match_not_eow = + static_cast(1 << _S_not_eow); + + /** + * If more than one match is possible then any match is an acceptable + * result. + */ + _GLIBCXX17_INLINE constexpr match_flag_type match_any = + static_cast(1 << _S_any); + + /** + * The expression does not match an empty sequence. + */ + _GLIBCXX17_INLINE constexpr match_flag_type match_not_null = + static_cast(1 << _S_not_null); + + /** + * The expression only matches a sub-sequence that begins at first . + */ + _GLIBCXX17_INLINE constexpr match_flag_type match_continuous = + static_cast(1 << _S_continuous); + + /** + * --first is a valid iterator position. When this flag is set then the + * flags match_not_bol and match_not_bow are ignored by the regular + * expression algorithms 28.11 and iterators 28.12. + */ + _GLIBCXX17_INLINE constexpr match_flag_type match_prev_avail = + static_cast(1 << _S_prev_avail); + + /** + * When a regular expression match is to be replaced by a new string, the + * new string is constructed using the rules used by the ECMAScript replace + * function in ECMA- 262 [Ecma International, ECMAScript Language + * Specification, Standard Ecma-262, third edition, 1999], part 15.5.4.11 + * String.prototype.replace. In addition, during search and replace + * operations all non-overlapping occurrences of the regular expression + * are located and replaced, and sections of the input that did not match + * the expression are copied unchanged to the output string. + * + * Format strings (from ECMA-262 [15.5.4.11]): + * @li $$ The dollar-sign itself ($) + * @li $& The matched substring. + * @li $` The portion of @a string that precedes the matched substring. + * This would be match_results::prefix(). + * @li $' The portion of @a string that follows the matched substring. + * This would be match_results::suffix(). + * @li $n The nth capture, where n is in [1,9] and $n is not followed by a + * decimal digit. If n <= match_results::size() and the nth capture + * is undefined, use the empty string instead. If n > + * match_results::size(), the result is implementation-defined. + * @li $nn The nnth capture, where nn is a two-digit decimal number on + * [01, 99]. If nn <= match_results::size() and the nth capture is + * undefined, use the empty string instead. If + * nn > match_results::size(), the result is implementation-defined. + */ + _GLIBCXX17_INLINE constexpr match_flag_type format_default = + static_cast(0); + + /** + * When a regular expression match is to be replaced by a new string, the + * new string is constructed using the rules used by the POSIX sed utility + * in IEEE Std 1003.1- 2001 [IEEE, Information Technology -- Portable + * Operating System Interface (POSIX), IEEE Standard 1003.1-2001]. + */ + _GLIBCXX17_INLINE constexpr match_flag_type format_sed = + static_cast(1 << _S_sed); + + /** + * During a search and replace operation, sections of the character + * container sequence being searched that do not match the regular + * expression shall not be copied to the output string. + */ + _GLIBCXX17_INLINE constexpr match_flag_type format_no_copy = + static_cast(1 << _S_no_copy); + + /** + * When specified during a search and replace operation, only the first + * occurrence of the regular expression shall be replaced. + */ + _GLIBCXX17_INLINE constexpr match_flag_type format_first_only = + static_cast(1 << _S_first_only); + + constexpr inline match_flag_type + operator&(match_flag_type __a, match_flag_type __b) + { + return (match_flag_type)(static_cast(__a) + & static_cast(__b)); + } + + constexpr inline match_flag_type + operator|(match_flag_type __a, match_flag_type __b) + { + return (match_flag_type)(static_cast(__a) + | static_cast(__b)); + } + + constexpr inline match_flag_type + operator^(match_flag_type __a, match_flag_type __b) + { + return (match_flag_type)(static_cast(__a) + ^ static_cast(__b)); + } + + constexpr inline match_flag_type + operator~(match_flag_type __a) + { return (match_flag_type)(~static_cast(__a)); } + + inline match_flag_type& + operator&=(match_flag_type& __a, match_flag_type __b) + { return __a = __a & __b; } + + inline match_flag_type& + operator|=(match_flag_type& __a, match_flag_type __b) + { return __a = __a | __b; } + + inline match_flag_type& + operator^=(match_flag_type& __a, match_flag_type __b) + { return __a = __a ^ __b; } + + //@} + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace regex_constants + +/* @} */ // group regex +} // namespace std + diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_error.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_error.h new file mode 100644 index 0000000..55f6db9 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_error.h @@ -0,0 +1,177 @@ +// class template regex -*- C++ -*- + +// Copyright (C) 2010-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** + * @file bits/regex_error.h + * @brief Error and exception objects for the std regex library. + * + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{regex} + */ + +namespace std _GLIBCXX_VISIBILITY(default) +{ +/** + * @addtogroup regex + * @{ + */ + +namespace regex_constants +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @name 5.3 Error Types + */ + //@{ + + enum error_type + { + _S_error_collate, + _S_error_ctype, + _S_error_escape, + _S_error_backref, + _S_error_brack, + _S_error_paren, + _S_error_brace, + _S_error_badbrace, + _S_error_range, + _S_error_space, + _S_error_badrepeat, + _S_error_complexity, + _S_error_stack, + }; + + /** The expression contained an invalid collating element name. */ + constexpr error_type error_collate(_S_error_collate); + + /** The expression contained an invalid character class name. */ + constexpr error_type error_ctype(_S_error_ctype); + + /** + * The expression contained an invalid escaped character, or a trailing + * escape. + */ + constexpr error_type error_escape(_S_error_escape); + + /** The expression contained an invalid back reference. */ + constexpr error_type error_backref(_S_error_backref); + + /** The expression contained mismatched [ and ]. */ + constexpr error_type error_brack(_S_error_brack); + + /** The expression contained mismatched ( and ). */ + constexpr error_type error_paren(_S_error_paren); + + /** The expression contained mismatched { and } */ + constexpr error_type error_brace(_S_error_brace); + + /** The expression contained an invalid range in a {} expression. */ + constexpr error_type error_badbrace(_S_error_badbrace); + + /** + * The expression contained an invalid character range, + * such as [b-a] in most encodings. + */ + constexpr error_type error_range(_S_error_range); + + /** + * There was insufficient memory to convert the expression into a + * finite state machine. + */ + constexpr error_type error_space(_S_error_space); + + /** + * One of *?+{ was not preceded by a valid regular expression. + */ + constexpr error_type error_badrepeat(_S_error_badrepeat); + + /** + * The complexity of an attempted match against a regular expression + * exceeded a pre-set level. + */ + constexpr error_type error_complexity(_S_error_complexity); + + /** + * There was insufficient memory to determine whether the + * regular expression could match the specified character sequence. + */ + constexpr error_type error_stack(_S_error_stack); + + //@} +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace regex_constants + +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // [7.8] Class regex_error + /** + * @brief A regular expression exception class. + * @ingroup exceptions + * + * The regular expression library throws objects of this class on error. + */ + class regex_error : public std::runtime_error + { + regex_constants::error_type _M_code; + + public: + /** + * @brief Constructs a regex_error object. + * + * @param __ecode the regex error code. + */ + explicit + regex_error(regex_constants::error_type __ecode); + + virtual ~regex_error() throw(); + + /** + * @brief Gets the regex error code. + * + * @returns the regex error code. + */ + regex_constants::error_type + code() const + { return _M_code; } + + private: + regex_error(regex_constants::error_type __ecode, const char* __what) + : std::runtime_error(__what), _M_code(__ecode) + { } + + friend void __throw_regex_error(regex_constants::error_type, const char*); + }; + + //@} // group regex + + void + __throw_regex_error(regex_constants::error_type __ecode); + + inline void + __throw_regex_error(regex_constants::error_type __ecode, const char* __what) + { _GLIBCXX_THROW_OR_ABORT(regex_error(__ecode, __what)); } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_executor.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_executor.h new file mode 100644 index 0000000..6105474 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_executor.h @@ -0,0 +1,258 @@ +// class template regex -*- C++ -*- + +// Copyright (C) 2013-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** + * @file bits/regex_executor.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{regex} + */ + +// FIXME convert comments to doxygen format. + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace __detail +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup regex-detail + * @{ + */ + + /** + * @brief Takes a regex and an input string and does the matching. + * + * The %_Executor class has two modes: DFS mode and BFS mode, controlled + * by the template parameter %__dfs_mode. + */ + template + class _Executor + { + using __search_mode = integral_constant; + using __dfs = true_type; + using __bfs = false_type; + + enum class _Match_mode : unsigned char { _Exact, _Prefix }; + + public: + typedef typename iterator_traits<_BiIter>::value_type _CharT; + typedef basic_regex<_CharT, _TraitsT> _RegexT; + typedef std::vector, _Alloc> _ResultsVec; + typedef regex_constants::match_flag_type _FlagT; + typedef typename _TraitsT::char_class_type _ClassT; + typedef _NFA<_TraitsT> _NFAT; + + public: + _Executor(_BiIter __begin, + _BiIter __end, + _ResultsVec& __results, + const _RegexT& __re, + _FlagT __flags) + : _M_begin(__begin), + _M_end(__end), + _M_re(__re), + _M_nfa(*__re._M_automaton), + _M_results(__results), + _M_rep_count(_M_nfa.size()), + _M_states(_M_nfa._M_start(), _M_nfa.size()), + _M_flags((__flags & regex_constants::match_prev_avail) + ? (__flags + & ~regex_constants::match_not_bol + & ~regex_constants::match_not_bow) + : __flags) + { } + + // Set matched when string exactly matches the pattern. + bool + _M_match() + { + _M_current = _M_begin; + return _M_main(_Match_mode::_Exact); + } + + // Set matched when some prefix of the string matches the pattern. + bool + _M_search_from_first() + { + _M_current = _M_begin; + return _M_main(_Match_mode::_Prefix); + } + + bool + _M_search(); + + private: + void + _M_rep_once_more(_Match_mode __match_mode, _StateIdT); + + void + _M_handle_repeat(_Match_mode, _StateIdT); + + void + _M_handle_subexpr_begin(_Match_mode, _StateIdT); + + void + _M_handle_subexpr_end(_Match_mode, _StateIdT); + + void + _M_handle_line_begin_assertion(_Match_mode, _StateIdT); + + void + _M_handle_line_end_assertion(_Match_mode, _StateIdT); + + void + _M_handle_word_boundary(_Match_mode, _StateIdT); + + void + _M_handle_subexpr_lookahead(_Match_mode, _StateIdT); + + void + _M_handle_match(_Match_mode, _StateIdT); + + void + _M_handle_backref(_Match_mode, _StateIdT); + + void + _M_handle_accept(_Match_mode, _StateIdT); + + void + _M_handle_alternative(_Match_mode, _StateIdT); + + void + _M_dfs(_Match_mode __match_mode, _StateIdT __start); + + bool + _M_main(_Match_mode __match_mode) + { return _M_main_dispatch(__match_mode, __search_mode{}); } + + bool + _M_main_dispatch(_Match_mode __match_mode, __dfs); + + bool + _M_main_dispatch(_Match_mode __match_mode, __bfs); + + bool + _M_is_word(_CharT __ch) const + { + static const _CharT __s[2] = { 'w' }; + return _M_re._M_automaton->_M_traits.isctype + (__ch, _M_re._M_automaton->_M_traits.lookup_classname(__s, __s+1)); + } + + bool + _M_at_begin() const + { + return _M_current == _M_begin + && !(_M_flags & (regex_constants::match_not_bol + | regex_constants::match_prev_avail)); + } + + bool + _M_at_end() const + { + return _M_current == _M_end + && !(_M_flags & regex_constants::match_not_eol); + } + + bool + _M_word_boundary() const; + + bool + _M_lookahead(_StateIdT __next); + + // Holds additional information used in BFS-mode. + template + struct _State_info; + + template + struct _State_info<__bfs, _ResultsVec> + { + explicit + _State_info(_StateIdT __start, size_t __n) + : _M_visited_states(new bool[__n]()), _M_start(__start) + { } + + bool _M_visited(_StateIdT __i) + { + if (_M_visited_states[__i]) + return true; + _M_visited_states[__i] = true; + return false; + } + + void _M_queue(_StateIdT __i, const _ResultsVec& __res) + { _M_match_queue.emplace_back(__i, __res); } + + // Dummy implementations for BFS mode. + _BiIter* _M_get_sol_pos() { return nullptr; } + + // Saves states that need to be considered for the next character. + vector> _M_match_queue; + // Indicates which states are already visited. + unique_ptr _M_visited_states; + // To record current solution. + _StateIdT _M_start; + }; + + template + struct _State_info<__dfs, _ResultsVec> + { + explicit + _State_info(_StateIdT __start, size_t) : _M_start(__start) + { } + + // Dummy implementations for DFS mode. + bool _M_visited(_StateIdT) const { return false; } + void _M_queue(_StateIdT, const _ResultsVec&) { } + + _BiIter* _M_get_sol_pos() { return &_M_sol_pos; } + + // To record current solution. + _StateIdT _M_start; + _BiIter _M_sol_pos; + }; + + public: + _ResultsVec _M_cur_results; + _BiIter _M_current; + _BiIter _M_begin; + const _BiIter _M_end; + const _RegexT& _M_re; + const _NFAT& _M_nfa; + _ResultsVec& _M_results; + vector> _M_rep_count; + _State_info<__search_mode, _ResultsVec> _M_states; + _FlagT _M_flags; + // Do we have a solution so far? + bool _M_has_sol; + }; + + //@} regex-detail +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace __detail +} // namespace std + +#include diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_scanner.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_scanner.h new file mode 100644 index 0000000..37ad862 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/regex_scanner.h @@ -0,0 +1,272 @@ +// class template regex -*- C++ -*- + +// Copyright (C) 2013-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** + * @file bits/regex_scanner.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{regex} + */ + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace __detail +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup regex-detail + * @{ + */ + + struct _ScannerBase + { + public: + /// Token types returned from the scanner. + enum _TokenT : unsigned + { + _S_token_anychar, + _S_token_ord_char, + _S_token_oct_num, + _S_token_hex_num, + _S_token_backref, + _S_token_subexpr_begin, + _S_token_subexpr_no_group_begin, + _S_token_subexpr_lookahead_begin, // neg if _M_value[0] == 'n' + _S_token_subexpr_end, + _S_token_bracket_begin, + _S_token_bracket_neg_begin, + _S_token_bracket_end, + _S_token_interval_begin, + _S_token_interval_end, + _S_token_quoted_class, + _S_token_char_class_name, + _S_token_collsymbol, + _S_token_equiv_class_name, + _S_token_opt, + _S_token_or, + _S_token_closure0, + _S_token_closure1, + _S_token_line_begin, + _S_token_line_end, + _S_token_word_bound, // neg if _M_value[0] == 'n' + _S_token_comma, + _S_token_dup_count, + _S_token_eof, + _S_token_bracket_dash, + _S_token_unknown = -1u + }; + + protected: + typedef regex_constants::syntax_option_type _FlagT; + + enum _StateT + { + _S_state_normal, + _S_state_in_brace, + _S_state_in_bracket, + }; + + protected: + _ScannerBase(_FlagT __flags) + : _M_state(_S_state_normal), + _M_flags(__flags), + _M_escape_tbl(_M_is_ecma() + ? _M_ecma_escape_tbl + : _M_awk_escape_tbl), + _M_spec_char(_M_is_ecma() + ? _M_ecma_spec_char + : _M_flags & regex_constants::basic + ? _M_basic_spec_char + : _M_flags & regex_constants::extended + ? _M_extended_spec_char + : _M_flags & regex_constants::grep + ? ".[\\*^$\n" + : _M_flags & regex_constants::egrep + ? ".[\\()*+?{|^$\n" + : _M_flags & regex_constants::awk + ? _M_extended_spec_char + : nullptr), + _M_at_bracket_start(false) + { __glibcxx_assert(_M_spec_char); } + + protected: + const char* + _M_find_escape(char __c) + { + auto __it = _M_escape_tbl; + for (; __it->first != '\0'; ++__it) + if (__it->first == __c) + return &__it->second; + return nullptr; + } + + bool + _M_is_ecma() const + { return _M_flags & regex_constants::ECMAScript; } + + bool + _M_is_basic() const + { return _M_flags & (regex_constants::basic | regex_constants::grep); } + + bool + _M_is_extended() const + { + return _M_flags & (regex_constants::extended + | regex_constants::egrep + | regex_constants::awk); + } + + bool + _M_is_grep() const + { return _M_flags & (regex_constants::grep | regex_constants::egrep); } + + bool + _M_is_awk() const + { return _M_flags & regex_constants::awk; } + + protected: + // TODO: Make them static in the next abi change. + const std::pair _M_token_tbl[9] = + { + {'^', _S_token_line_begin}, + {'$', _S_token_line_end}, + {'.', _S_token_anychar}, + {'*', _S_token_closure0}, + {'+', _S_token_closure1}, + {'?', _S_token_opt}, + {'|', _S_token_or}, + {'\n', _S_token_or}, // grep and egrep + {'\0', _S_token_or}, + }; + const std::pair _M_ecma_escape_tbl[8] = + { + {'0', '\0'}, + {'b', '\b'}, + {'f', '\f'}, + {'n', '\n'}, + {'r', '\r'}, + {'t', '\t'}, + {'v', '\v'}, + {'\0', '\0'}, + }; + const std::pair _M_awk_escape_tbl[11] = + { + {'"', '"'}, + {'/', '/'}, + {'\\', '\\'}, + {'a', '\a'}, + {'b', '\b'}, + {'f', '\f'}, + {'n', '\n'}, + {'r', '\r'}, + {'t', '\t'}, + {'v', '\v'}, + {'\0', '\0'}, + }; + const char* _M_ecma_spec_char = "^$\\.*+?()[]{}|"; + const char* _M_basic_spec_char = ".[\\*^$"; + const char* _M_extended_spec_char = ".[\\()*+?{|^$"; + + _StateT _M_state; + _FlagT _M_flags; + _TokenT _M_token; + const std::pair* _M_escape_tbl; + const char* _M_spec_char; + bool _M_at_bracket_start; + }; + + /** + * @brief Scans an input range for regex tokens. + * + * The %_Scanner class interprets the regular expression pattern in + * the input range passed to its constructor as a sequence of parse + * tokens passed to the regular expression compiler. The sequence + * of tokens provided depends on the flag settings passed to the + * constructor: different regular expression grammars will interpret + * the same input pattern in syntactically different ways. + */ + template + class _Scanner + : public _ScannerBase + { + public: + typedef const _CharT* _IterT; + typedef std::basic_string<_CharT> _StringT; + typedef regex_constants::syntax_option_type _FlagT; + typedef const std::ctype<_CharT> _CtypeT; + + _Scanner(_IterT __begin, _IterT __end, + _FlagT __flags, std::locale __loc); + + void + _M_advance(); + + _TokenT + _M_get_token() const + { return _M_token; } + + const _StringT& + _M_get_value() const + { return _M_value; } + +#ifdef _GLIBCXX_DEBUG + std::ostream& + _M_print(std::ostream&); +#endif + + private: + void + _M_scan_normal(); + + void + _M_scan_in_bracket(); + + void + _M_scan_in_brace(); + + void + _M_eat_escape_ecma(); + + void + _M_eat_escape_posix(); + + void + _M_eat_escape_awk(); + + void + _M_eat_class(char); + + _IterT _M_current; + _IterT _M_end; + _CtypeT& _M_ctype; + _StringT _M_value; + void (_Scanner::* _M_eat_escape)(); + }; + + //@} regex-detail +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace __detail +} // namespace std + +#include diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/shared_ptr.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/shared_ptr.h new file mode 100644 index 0000000..c4985ee --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/shared_ptr.h @@ -0,0 +1,727 @@ +// shared_ptr and weak_ptr implementation -*- C++ -*- + +// Copyright (C) 2007-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// GCC Note: Based on files from version 1.32.0 of the Boost library. + +// shared_count.hpp +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. + +// shared_ptr.hpp +// Copyright (C) 1998, 1999 Greg Colvin and Beman Dawes. +// Copyright (C) 2001, 2002, 2003 Peter Dimov + +// weak_ptr.hpp +// Copyright (C) 2001, 2002, 2003 Peter Dimov + +// enable_shared_from_this.hpp +// Copyright (C) 2002 Peter Dimov + +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +/** @file + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _SHARED_PTR_H +#define _SHARED_PTR_H 1 + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup pointer_abstractions + * @{ + */ + + /// 20.7.2.2.11 shared_ptr I/O + template + inline std::basic_ostream<_Ch, _Tr>& + operator<<(std::basic_ostream<_Ch, _Tr>& __os, + const __shared_ptr<_Tp, _Lp>& __p) + { + __os << __p.get(); + return __os; + } + + /// 20.7.2.2.10 shared_ptr get_deleter + template + inline _Del* + get_deleter(const __shared_ptr<_Tp, _Lp>& __p) noexcept + { +#if __cpp_rtti + return static_cast<_Del*>(__p._M_get_deleter(typeid(_Del))); +#else + return 0; +#endif + } + + + /** + * @brief A smart pointer with reference-counted copy semantics. + * + * The object pointed to is deleted when the last shared_ptr pointing to + * it is destroyed or reset. + */ + template + class shared_ptr : public __shared_ptr<_Tp> + { + template + using _Constructible = typename enable_if< + is_constructible<__shared_ptr<_Tp>, _Args...>::value + >::type; + + template + using _Assignable = typename enable_if< + is_assignable<__shared_ptr<_Tp>&, _Arg>::value, shared_ptr& + >::type; + + public: + + using element_type = typename __shared_ptr<_Tp>::element_type; + +#if __cplusplus > 201402L +# define __cpp_lib_shared_ptr_weak_type 201606 + using weak_type = weak_ptr<_Tp>; +#endif + /** + * @brief Construct an empty %shared_ptr. + * @post use_count()==0 && get()==0 + */ + constexpr shared_ptr() noexcept : __shared_ptr<_Tp>() { } + + shared_ptr(const shared_ptr&) noexcept = default; + + /** + * @brief Construct a %shared_ptr that owns the pointer @a __p. + * @param __p A pointer that is convertible to element_type*. + * @post use_count() == 1 && get() == __p + * @throw std::bad_alloc, in which case @c delete @a __p is called. + */ + template> + explicit + shared_ptr(_Yp* __p) : __shared_ptr<_Tp>(__p) { } + + /** + * @brief Construct a %shared_ptr that owns the pointer @a __p + * and the deleter @a __d. + * @param __p A pointer. + * @param __d A deleter. + * @post use_count() == 1 && get() == __p + * @throw std::bad_alloc, in which case @a __d(__p) is called. + * + * Requirements: _Deleter's copy constructor and destructor must + * not throw + * + * __shared_ptr will release __p by calling __d(__p) + */ + template> + shared_ptr(_Yp* __p, _Deleter __d) + : __shared_ptr<_Tp>(__p, std::move(__d)) { } + + /** + * @brief Construct a %shared_ptr that owns a null pointer + * and the deleter @a __d. + * @param __p A null pointer constant. + * @param __d A deleter. + * @post use_count() == 1 && get() == __p + * @throw std::bad_alloc, in which case @a __d(__p) is called. + * + * Requirements: _Deleter's copy constructor and destructor must + * not throw + * + * The last owner will call __d(__p) + */ + template + shared_ptr(nullptr_t __p, _Deleter __d) + : __shared_ptr<_Tp>(__p, std::move(__d)) { } + + /** + * @brief Construct a %shared_ptr that owns the pointer @a __p + * and the deleter @a __d. + * @param __p A pointer. + * @param __d A deleter. + * @param __a An allocator. + * @post use_count() == 1 && get() == __p + * @throw std::bad_alloc, in which case @a __d(__p) is called. + * + * Requirements: _Deleter's copy constructor and destructor must + * not throw _Alloc's copy constructor and destructor must not + * throw. + * + * __shared_ptr will release __p by calling __d(__p) + */ + template> + shared_ptr(_Yp* __p, _Deleter __d, _Alloc __a) + : __shared_ptr<_Tp>(__p, std::move(__d), std::move(__a)) { } + + /** + * @brief Construct a %shared_ptr that owns a null pointer + * and the deleter @a __d. + * @param __p A null pointer constant. + * @param __d A deleter. + * @param __a An allocator. + * @post use_count() == 1 && get() == __p + * @throw std::bad_alloc, in which case @a __d(__p) is called. + * + * Requirements: _Deleter's copy constructor and destructor must + * not throw _Alloc's copy constructor and destructor must not + * throw. + * + * The last owner will call __d(__p) + */ + template + shared_ptr(nullptr_t __p, _Deleter __d, _Alloc __a) + : __shared_ptr<_Tp>(__p, std::move(__d), std::move(__a)) { } + + // Aliasing constructor + + /** + * @brief Constructs a %shared_ptr instance that stores @a __p + * and shares ownership with @a __r. + * @param __r A %shared_ptr. + * @param __p A pointer that will remain valid while @a *__r is valid. + * @post get() == __p && use_count() == __r.use_count() + * + * This can be used to construct a @c shared_ptr to a sub-object + * of an object managed by an existing @c shared_ptr. + * + * @code + * shared_ptr< pair > pii(new pair()); + * shared_ptr pi(pii, &pii->first); + * assert(pii.use_count() == 2); + * @endcode + */ + template + shared_ptr(const shared_ptr<_Yp>& __r, element_type* __p) noexcept + : __shared_ptr<_Tp>(__r, __p) { } + + /** + * @brief If @a __r is empty, constructs an empty %shared_ptr; + * otherwise construct a %shared_ptr that shares ownership + * with @a __r. + * @param __r A %shared_ptr. + * @post get() == __r.get() && use_count() == __r.use_count() + */ + template&>> + shared_ptr(const shared_ptr<_Yp>& __r) noexcept + : __shared_ptr<_Tp>(__r) { } + + /** + * @brief Move-constructs a %shared_ptr instance from @a __r. + * @param __r A %shared_ptr rvalue. + * @post *this contains the old value of @a __r, @a __r is empty. + */ + shared_ptr(shared_ptr&& __r) noexcept + : __shared_ptr<_Tp>(std::move(__r)) { } + + /** + * @brief Move-constructs a %shared_ptr instance from @a __r. + * @param __r A %shared_ptr rvalue. + * @post *this contains the old value of @a __r, @a __r is empty. + */ + template>> + shared_ptr(shared_ptr<_Yp>&& __r) noexcept + : __shared_ptr<_Tp>(std::move(__r)) { } + + /** + * @brief Constructs a %shared_ptr that shares ownership with @a __r + * and stores a copy of the pointer stored in @a __r. + * @param __r A weak_ptr. + * @post use_count() == __r.use_count() + * @throw bad_weak_ptr when __r.expired(), + * in which case the constructor has no effect. + */ + template&>> + explicit shared_ptr(const weak_ptr<_Yp>& __r) + : __shared_ptr<_Tp>(__r) { } + +#if _GLIBCXX_USE_DEPRECATED + template>> + shared_ptr(auto_ptr<_Yp>&& __r); +#endif + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2399. shared_ptr's constructor from unique_ptr should be constrained + template>> + shared_ptr(unique_ptr<_Yp, _Del>&& __r) + : __shared_ptr<_Tp>(std::move(__r)) { } + +#if __cplusplus <= 201402L && _GLIBCXX_USE_DEPRECATED + // This non-standard constructor exists to support conversions that + // were possible in C++11 and C++14 but are ill-formed in C++17. + // If an exception is thrown this constructor has no effect. + template, __sp_array_delete>* = 0> + shared_ptr(unique_ptr<_Yp, _Del>&& __r) + : __shared_ptr<_Tp>(std::move(__r), __sp_array_delete()) { } +#endif + + /** + * @brief Construct an empty %shared_ptr. + * @post use_count() == 0 && get() == nullptr + */ + constexpr shared_ptr(nullptr_t) noexcept : shared_ptr() { } + + shared_ptr& operator=(const shared_ptr&) noexcept = default; + + template + _Assignable&> + operator=(const shared_ptr<_Yp>& __r) noexcept + { + this->__shared_ptr<_Tp>::operator=(__r); + return *this; + } + +#if _GLIBCXX_USE_DEPRECATED + template + _Assignable> + operator=(auto_ptr<_Yp>&& __r) + { + this->__shared_ptr<_Tp>::operator=(std::move(__r)); + return *this; + } +#endif + + shared_ptr& + operator=(shared_ptr&& __r) noexcept + { + this->__shared_ptr<_Tp>::operator=(std::move(__r)); + return *this; + } + + template + _Assignable> + operator=(shared_ptr<_Yp>&& __r) noexcept + { + this->__shared_ptr<_Tp>::operator=(std::move(__r)); + return *this; + } + + template + _Assignable> + operator=(unique_ptr<_Yp, _Del>&& __r) + { + this->__shared_ptr<_Tp>::operator=(std::move(__r)); + return *this; + } + + private: + // This constructor is non-standard, it is used by allocate_shared. + template + shared_ptr(_Sp_make_shared_tag __tag, const _Alloc& __a, + _Args&&... __args) + : __shared_ptr<_Tp>(__tag, __a, std::forward<_Args>(__args)...) + { } + + template + friend shared_ptr<_Yp> + allocate_shared(const _Alloc& __a, _Args&&... __args); + + // This constructor is non-standard, it is used by weak_ptr::lock(). + shared_ptr(const weak_ptr<_Tp>& __r, std::nothrow_t) + : __shared_ptr<_Tp>(__r, std::nothrow) { } + + friend class weak_ptr<_Tp>; + }; + +#if __cpp_deduction_guides >= 201606 + template + shared_ptr(weak_ptr<_Tp>) -> shared_ptr<_Tp>; + template + shared_ptr(unique_ptr<_Tp, _Del>) -> shared_ptr<_Tp>; +#endif + + // 20.7.2.2.7 shared_ptr comparisons + template + inline bool + operator==(const shared_ptr<_Tp>& __a, const shared_ptr<_Up>& __b) noexcept + { return __a.get() == __b.get(); } + + template + inline bool + operator==(const shared_ptr<_Tp>& __a, nullptr_t) noexcept + { return !__a; } + + template + inline bool + operator==(nullptr_t, const shared_ptr<_Tp>& __a) noexcept + { return !__a; } + + template + inline bool + operator!=(const shared_ptr<_Tp>& __a, const shared_ptr<_Up>& __b) noexcept + { return __a.get() != __b.get(); } + + template + inline bool + operator!=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept + { return (bool)__a; } + + template + inline bool + operator!=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept + { return (bool)__a; } + + template + inline bool + operator<(const shared_ptr<_Tp>& __a, const shared_ptr<_Up>& __b) noexcept + { + using _Tp_elt = typename shared_ptr<_Tp>::element_type; + using _Up_elt = typename shared_ptr<_Up>::element_type; + using _Vp = typename common_type<_Tp_elt*, _Up_elt*>::type; + return less<_Vp>()(__a.get(), __b.get()); + } + + template + inline bool + operator<(const shared_ptr<_Tp>& __a, nullptr_t) noexcept + { + using _Tp_elt = typename shared_ptr<_Tp>::element_type; + return less<_Tp_elt*>()(__a.get(), nullptr); + } + + template + inline bool + operator<(nullptr_t, const shared_ptr<_Tp>& __a) noexcept + { + using _Tp_elt = typename shared_ptr<_Tp>::element_type; + return less<_Tp_elt*>()(nullptr, __a.get()); + } + + template + inline bool + operator<=(const shared_ptr<_Tp>& __a, const shared_ptr<_Up>& __b) noexcept + { return !(__b < __a); } + + template + inline bool + operator<=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept + { return !(nullptr < __a); } + + template + inline bool + operator<=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept + { return !(__a < nullptr); } + + template + inline bool + operator>(const shared_ptr<_Tp>& __a, const shared_ptr<_Up>& __b) noexcept + { return (__b < __a); } + + template + inline bool + operator>(const shared_ptr<_Tp>& __a, nullptr_t) noexcept + { return nullptr < __a; } + + template + inline bool + operator>(nullptr_t, const shared_ptr<_Tp>& __a) noexcept + { return __a < nullptr; } + + template + inline bool + operator>=(const shared_ptr<_Tp>& __a, const shared_ptr<_Up>& __b) noexcept + { return !(__a < __b); } + + template + inline bool + operator>=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept + { return !(__a < nullptr); } + + template + inline bool + operator>=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept + { return !(nullptr < __a); } + + template + struct less> : public _Sp_less> + { }; + + // 20.7.2.2.8 shared_ptr specialized algorithms. + template + inline void + swap(shared_ptr<_Tp>& __a, shared_ptr<_Tp>& __b) noexcept + { __a.swap(__b); } + + // 20.7.2.2.9 shared_ptr casts. + template + inline shared_ptr<_Tp> + static_pointer_cast(const shared_ptr<_Up>& __r) noexcept + { + using _Sp = shared_ptr<_Tp>; + return _Sp(__r, static_cast(__r.get())); + } + + template + inline shared_ptr<_Tp> + const_pointer_cast(const shared_ptr<_Up>& __r) noexcept + { + using _Sp = shared_ptr<_Tp>; + return _Sp(__r, const_cast(__r.get())); + } + + template + inline shared_ptr<_Tp> + dynamic_pointer_cast(const shared_ptr<_Up>& __r) noexcept + { + using _Sp = shared_ptr<_Tp>; + if (auto* __p = dynamic_cast(__r.get())) + return _Sp(__r, __p); + return _Sp(); + } + +#if __cplusplus > 201402L + template + inline shared_ptr<_Tp> + reinterpret_pointer_cast(const shared_ptr<_Up>& __r) noexcept + { + using _Sp = shared_ptr<_Tp>; + return _Sp(__r, reinterpret_cast(__r.get())); + } +#endif + + /** + * @brief A smart pointer with weak semantics. + * + * With forwarding constructors and assignment operators. + */ + template + class weak_ptr : public __weak_ptr<_Tp> + { + template + using _Constructible = typename enable_if< + is_constructible<__weak_ptr<_Tp>, _Arg>::value + >::type; + + template + using _Assignable = typename enable_if< + is_assignable<__weak_ptr<_Tp>&, _Arg>::value, weak_ptr& + >::type; + + public: + constexpr weak_ptr() noexcept = default; + + template&>> + weak_ptr(const shared_ptr<_Yp>& __r) noexcept + : __weak_ptr<_Tp>(__r) { } + + weak_ptr(const weak_ptr&) noexcept = default; + + template&>> + weak_ptr(const weak_ptr<_Yp>& __r) noexcept + : __weak_ptr<_Tp>(__r) { } + + weak_ptr(weak_ptr&&) noexcept = default; + + template>> + weak_ptr(weak_ptr<_Yp>&& __r) noexcept + : __weak_ptr<_Tp>(std::move(__r)) { } + + weak_ptr& + operator=(const weak_ptr& __r) noexcept = default; + + template + _Assignable&> + operator=(const weak_ptr<_Yp>& __r) noexcept + { + this->__weak_ptr<_Tp>::operator=(__r); + return *this; + } + + template + _Assignable&> + operator=(const shared_ptr<_Yp>& __r) noexcept + { + this->__weak_ptr<_Tp>::operator=(__r); + return *this; + } + + weak_ptr& + operator=(weak_ptr&& __r) noexcept = default; + + template + _Assignable> + operator=(weak_ptr<_Yp>&& __r) noexcept + { + this->__weak_ptr<_Tp>::operator=(std::move(__r)); + return *this; + } + + shared_ptr<_Tp> + lock() const noexcept + { return shared_ptr<_Tp>(*this, std::nothrow); } + }; + +#if __cpp_deduction_guides >= 201606 + template + weak_ptr(shared_ptr<_Tp>) -> weak_ptr<_Tp>; +#endif + + // 20.7.2.3.6 weak_ptr specialized algorithms. + template + inline void + swap(weak_ptr<_Tp>& __a, weak_ptr<_Tp>& __b) noexcept + { __a.swap(__b); } + + + /// Primary template owner_less + template + struct owner_less; + + /// Void specialization of owner_less + template<> + struct owner_less : _Sp_owner_less + { }; + + /// Partial specialization of owner_less for shared_ptr. + template + struct owner_less> + : public _Sp_owner_less, weak_ptr<_Tp>> + { }; + + /// Partial specialization of owner_less for weak_ptr. + template + struct owner_less> + : public _Sp_owner_less, shared_ptr<_Tp>> + { }; + + /** + * @brief Base class allowing use of member function shared_from_this. + */ + template + class enable_shared_from_this + { + protected: + constexpr enable_shared_from_this() noexcept { } + + enable_shared_from_this(const enable_shared_from_this&) noexcept { } + + enable_shared_from_this& + operator=(const enable_shared_from_this&) noexcept + { return *this; } + + ~enable_shared_from_this() { } + + public: + shared_ptr<_Tp> + shared_from_this() + { return shared_ptr<_Tp>(this->_M_weak_this); } + + shared_ptr + shared_from_this() const + { return shared_ptr(this->_M_weak_this); } + +#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 +#define __cpp_lib_enable_shared_from_this 201603 + weak_ptr<_Tp> + weak_from_this() noexcept + { return this->_M_weak_this; } + + weak_ptr + weak_from_this() const noexcept + { return this->_M_weak_this; } +#endif + + private: + template + void + _M_weak_assign(_Tp1* __p, const __shared_count<>& __n) const noexcept + { _M_weak_this._M_assign(__p, __n); } + + // Found by ADL when this is an associated class. + friend const enable_shared_from_this* + __enable_shared_from_this_base(const __shared_count<>&, + const enable_shared_from_this* __p) + { return __p; } + + template + friend class __shared_ptr; + + mutable weak_ptr<_Tp> _M_weak_this; + }; + + /** + * @brief Create an object that is owned by a shared_ptr. + * @param __a An allocator. + * @param __args Arguments for the @a _Tp object's constructor. + * @return A shared_ptr that owns the newly created object. + * @throw An exception thrown from @a _Alloc::allocate or from the + * constructor of @a _Tp. + * + * A copy of @a __a will be used to allocate memory for the shared_ptr + * and the new object. + */ + template + inline shared_ptr<_Tp> + allocate_shared(const _Alloc& __a, _Args&&... __args) + { + return shared_ptr<_Tp>(_Sp_make_shared_tag(), __a, + std::forward<_Args>(__args)...); + } + + /** + * @brief Create an object that is owned by a shared_ptr. + * @param __args Arguments for the @a _Tp object's constructor. + * @return A shared_ptr that owns the newly created object. + * @throw std::bad_alloc, or an exception thrown from the + * constructor of @a _Tp. + */ + template + inline shared_ptr<_Tp> + make_shared(_Args&&... __args) + { + typedef typename std::remove_const<_Tp>::type _Tp_nc; + return std::allocate_shared<_Tp>(std::allocator<_Tp_nc>(), + std::forward<_Args>(__args)...); + } + + /// std::hash specialization for shared_ptr. + template + struct hash> + : public __hash_base> + { + size_t + operator()(const shared_ptr<_Tp>& __s) const noexcept + { + return std::hash::element_type*>()(__s.get()); + } + }; + + // @} group pointer_abstractions + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif // _SHARED_PTR_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/shared_ptr_atomic.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/shared_ptr_atomic.h new file mode 100644 index 0000000..d05d686 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/shared_ptr_atomic.h @@ -0,0 +1,330 @@ +// shared_ptr atomic access -*- C++ -*- + +// Copyright (C) 2014-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/shared_ptr_atomic.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _SHARED_PTR_ATOMIC_H +#define _SHARED_PTR_ATOMIC_H 1 + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup pointer_abstractions + * @{ + */ + + struct _Sp_locker + { + _Sp_locker(const _Sp_locker&) = delete; + _Sp_locker& operator=(const _Sp_locker&) = delete; + +#ifdef __GTHREADS + explicit + _Sp_locker(const void*) noexcept; + _Sp_locker(const void*, const void*) noexcept; + ~_Sp_locker(); + + private: + unsigned char _M_key1; + unsigned char _M_key2; +#else + explicit _Sp_locker(const void*, const void* = nullptr) { } +#endif + }; + + /** + * @brief Report whether shared_ptr atomic operations are lock-free. + * @param __p A non-null pointer to a shared_ptr object. + * @return True if atomic access to @c *__p is lock-free, false otherwise. + * @{ + */ + template + inline bool + atomic_is_lock_free(const __shared_ptr<_Tp, _Lp>* __p) + { +#ifdef __GTHREADS + return __gthread_active_p() == 0; +#else + return true; +#endif + } + + template + inline bool + atomic_is_lock_free(const shared_ptr<_Tp>* __p) + { return std::atomic_is_lock_free<_Tp, __default_lock_policy>(__p); } + + // @} + + /** + * @brief Atomic load for shared_ptr objects. + * @param __p A non-null pointer to a shared_ptr object. + * @return @c *__p + * + * The memory order shall not be @c memory_order_release or + * @c memory_order_acq_rel. + * @{ + */ + template + inline shared_ptr<_Tp> + atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order) + { + _Sp_locker __lock{__p}; + return *__p; + } + + template + inline shared_ptr<_Tp> + atomic_load(const shared_ptr<_Tp>* __p) + { return std::atomic_load_explicit(__p, memory_order_seq_cst); } + + template + inline __shared_ptr<_Tp, _Lp> + atomic_load_explicit(const __shared_ptr<_Tp, _Lp>* __p, memory_order) + { + _Sp_locker __lock{__p}; + return *__p; + } + + template + inline __shared_ptr<_Tp, _Lp> + atomic_load(const __shared_ptr<_Tp, _Lp>* __p) + { return std::atomic_load_explicit(__p, memory_order_seq_cst); } + // @} + + /** + * @brief Atomic store for shared_ptr objects. + * @param __p A non-null pointer to a shared_ptr object. + * @param __r The value to store. + * + * The memory order shall not be @c memory_order_acquire or + * @c memory_order_acq_rel. + * @{ + */ + template + inline void + atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, + memory_order) + { + _Sp_locker __lock{__p}; + __p->swap(__r); // use swap so that **__p not destroyed while lock held + } + + template + inline void + atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) + { std::atomic_store_explicit(__p, std::move(__r), memory_order_seq_cst); } + + template + inline void + atomic_store_explicit(__shared_ptr<_Tp, _Lp>* __p, + __shared_ptr<_Tp, _Lp> __r, + memory_order) + { + _Sp_locker __lock{__p}; + __p->swap(__r); // use swap so that **__p not destroyed while lock held + } + + template + inline void + atomic_store(__shared_ptr<_Tp, _Lp>* __p, __shared_ptr<_Tp, _Lp> __r) + { std::atomic_store_explicit(__p, std::move(__r), memory_order_seq_cst); } + // @} + + /** + * @brief Atomic exchange for shared_ptr objects. + * @param __p A non-null pointer to a shared_ptr object. + * @param __r New value to store in @c *__p. + * @return The original value of @c *__p + * @{ + */ + template + inline shared_ptr<_Tp> + atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, + memory_order) + { + _Sp_locker __lock{__p}; + __p->swap(__r); + return __r; + } + + template + inline shared_ptr<_Tp> + atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) + { + return std::atomic_exchange_explicit(__p, std::move(__r), + memory_order_seq_cst); + } + + template + inline __shared_ptr<_Tp, _Lp> + atomic_exchange_explicit(__shared_ptr<_Tp, _Lp>* __p, + __shared_ptr<_Tp, _Lp> __r, + memory_order) + { + _Sp_locker __lock{__p}; + __p->swap(__r); + return __r; + } + + template + inline __shared_ptr<_Tp, _Lp> + atomic_exchange(__shared_ptr<_Tp, _Lp>* __p, __shared_ptr<_Tp, _Lp> __r) + { + return std::atomic_exchange_explicit(__p, std::move(__r), + memory_order_seq_cst); + } + // @} + + /** + * @brief Atomic compare-and-swap for shared_ptr objects. + * @param __p A non-null pointer to a shared_ptr object. + * @param __v A non-null pointer to a shared_ptr object. + * @param __w A non-null pointer to a shared_ptr object. + * @return True if @c *__p was equivalent to @c *__v, false otherwise. + * + * The memory order for failure shall not be @c memory_order_release or + * @c memory_order_acq_rel, or stronger than the memory order for success. + * @{ + */ + template + bool + atomic_compare_exchange_strong_explicit(shared_ptr<_Tp>* __p, + shared_ptr<_Tp>* __v, + shared_ptr<_Tp> __w, + memory_order, + memory_order) + { + shared_ptr<_Tp> __x; // goes out of scope after __lock + _Sp_locker __lock{__p, __v}; + owner_less> __less; + if (*__p == *__v && !__less(*__p, *__v) && !__less(*__v, *__p)) + { + __x = std::move(*__p); + *__p = std::move(__w); + return true; + } + __x = std::move(*__v); + *__v = *__p; + return false; + } + + template + inline bool + atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, + shared_ptr<_Tp> __w) + { + return std::atomic_compare_exchange_strong_explicit(__p, __v, + std::move(__w), memory_order_seq_cst, memory_order_seq_cst); + } + + template + inline bool + atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p, + shared_ptr<_Tp>* __v, + shared_ptr<_Tp> __w, + memory_order __success, + memory_order __failure) + { + return std::atomic_compare_exchange_strong_explicit(__p, __v, + std::move(__w), __success, __failure); + } + + template + inline bool + atomic_compare_exchange_weak(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, + shared_ptr<_Tp> __w) + { + return std::atomic_compare_exchange_weak_explicit(__p, __v, + std::move(__w), memory_order_seq_cst, memory_order_seq_cst); + } + + template + bool + atomic_compare_exchange_strong_explicit(__shared_ptr<_Tp, _Lp>* __p, + __shared_ptr<_Tp, _Lp>* __v, + __shared_ptr<_Tp, _Lp> __w, + memory_order, + memory_order) + { + __shared_ptr<_Tp, _Lp> __x; // goes out of scope after __lock + _Sp_locker __lock{__p, __v}; + owner_less<__shared_ptr<_Tp, _Lp>> __less; + if (*__p == *__v && !__less(*__p, *__v) && !__less(*__v, *__p)) + { + __x = std::move(*__p); + *__p = std::move(__w); + return true; + } + __x = std::move(*__v); + *__v = *__p; + return false; + } + + template + inline bool + atomic_compare_exchange_strong(__shared_ptr<_Tp, _Lp>* __p, + __shared_ptr<_Tp, _Lp>* __v, + __shared_ptr<_Tp, _Lp> __w) + { + return std::atomic_compare_exchange_strong_explicit(__p, __v, + std::move(__w), memory_order_seq_cst, memory_order_seq_cst); + } + + template + inline bool + atomic_compare_exchange_weak_explicit(__shared_ptr<_Tp, _Lp>* __p, + __shared_ptr<_Tp, _Lp>* __v, + __shared_ptr<_Tp, _Lp> __w, + memory_order __success, + memory_order __failure) + { + return std::atomic_compare_exchange_strong_explicit(__p, __v, + std::move(__w), __success, __failure); + } + + template + inline bool + atomic_compare_exchange_weak(__shared_ptr<_Tp, _Lp>* __p, + __shared_ptr<_Tp, _Lp>* __v, + __shared_ptr<_Tp, _Lp> __w) + { + return std::atomic_compare_exchange_weak_explicit(__p, __v, + std::move(__w), memory_order_seq_cst, memory_order_seq_cst); + } + // @} + + // @} group pointer_abstractions + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif // _SHARED_PTR_ATOMIC_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/shared_ptr_base.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/shared_ptr_base.h new file mode 100644 index 0000000..aae31f7 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/shared_ptr_base.h @@ -0,0 +1,1866 @@ +// shared_ptr and weak_ptr implementation details -*- C++ -*- + +// Copyright (C) 2007-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// GCC Note: Based on files from version 1.32.0 of the Boost library. + +// shared_count.hpp +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. + +// shared_ptr.hpp +// Copyright (C) 1998, 1999 Greg Colvin and Beman Dawes. +// Copyright (C) 2001, 2002, 2003 Peter Dimov + +// weak_ptr.hpp +// Copyright (C) 2001, 2002, 2003 Peter Dimov + +// enable_shared_from_this.hpp +// Copyright (C) 2002 Peter Dimov + +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +/** @file bits/shared_ptr_base.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _SHARED_PTR_BASE_H +#define _SHARED_PTR_BASE_H 1 + +#if __cpp_rtti +# include +#endif +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#if _GLIBCXX_USE_DEPRECATED + template class auto_ptr; +#endif + + /** + * @brief Exception possibly thrown by @c shared_ptr. + * @ingroup exceptions + */ + class bad_weak_ptr : public std::exception + { + public: + virtual char const* what() const noexcept; + + virtual ~bad_weak_ptr() noexcept; + }; + + // Substitute for bad_weak_ptr object in the case of -fno-exceptions. + inline void + __throw_bad_weak_ptr() + { _GLIBCXX_THROW_OR_ABORT(bad_weak_ptr()); } + + using __gnu_cxx::_Lock_policy; + using __gnu_cxx::__default_lock_policy; + using __gnu_cxx::_S_single; + using __gnu_cxx::_S_mutex; + using __gnu_cxx::_S_atomic; + + // Empty helper class except when the template argument is _S_mutex. + template<_Lock_policy _Lp> + class _Mutex_base + { + protected: + // The atomic policy uses fully-fenced builtins, single doesn't care. + enum { _S_need_barriers = 0 }; + }; + + template<> + class _Mutex_base<_S_mutex> + : public __gnu_cxx::__mutex + { + protected: + // This policy is used when atomic builtins are not available. + // The replacement atomic operations might not have the necessary + // memory barriers. + enum { _S_need_barriers = 1 }; + }; + + template<_Lock_policy _Lp = __default_lock_policy> + class _Sp_counted_base + : public _Mutex_base<_Lp> + { + public: + _Sp_counted_base() noexcept + : _M_use_count(1), _M_weak_count(1) { } + + virtual + ~_Sp_counted_base() noexcept + { } + + // Called when _M_use_count drops to zero, to release the resources + // managed by *this. + virtual void + _M_dispose() noexcept = 0; + + // Called when _M_weak_count drops to zero. + virtual void + _M_destroy() noexcept + { delete this; } + + virtual void* + _M_get_deleter(const std::type_info&) noexcept = 0; + + void + _M_add_ref_copy() + { __gnu_cxx::__atomic_add_dispatch(&_M_use_count, 1); } + + void + _M_add_ref_lock(); + + bool + _M_add_ref_lock_nothrow(); + + void + _M_release() noexcept + { + // Be race-detector-friendly. For more info see bits/c++config. + _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_use_count); + if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, -1) == 1) + { + _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_use_count); + _M_dispose(); + // There must be a memory barrier between dispose() and destroy() + // to ensure that the effects of dispose() are observed in the + // thread that runs destroy(). + // See http://gcc.gnu.org/ml/libstdc++/2005-11/msg00136.html + if (_Mutex_base<_Lp>::_S_need_barriers) + { + __atomic_thread_fence (__ATOMIC_ACQ_REL); + } + + // Be race-detector-friendly. For more info see bits/c++config. + _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count); + if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count, + -1) == 1) + { + _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count); + _M_destroy(); + } + } + } + + void + _M_weak_add_ref() noexcept + { __gnu_cxx::__atomic_add_dispatch(&_M_weak_count, 1); } + + void + _M_weak_release() noexcept + { + // Be race-detector-friendly. For more info see bits/c++config. + _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_weak_count); + if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count, -1) == 1) + { + _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_weak_count); + if (_Mutex_base<_Lp>::_S_need_barriers) + { + // See _M_release(), + // destroy() must observe results of dispose() + __atomic_thread_fence (__ATOMIC_ACQ_REL); + } + _M_destroy(); + } + } + + long + _M_get_use_count() const noexcept + { + // No memory barrier is used here so there is no synchronization + // with other threads. + return __atomic_load_n(&_M_use_count, __ATOMIC_RELAXED); + } + + private: + _Sp_counted_base(_Sp_counted_base const&) = delete; + _Sp_counted_base& operator=(_Sp_counted_base const&) = delete; + + _Atomic_word _M_use_count; // #shared + _Atomic_word _M_weak_count; // #weak + (#shared != 0) + }; + + template<> + inline void + _Sp_counted_base<_S_single>:: + _M_add_ref_lock() + { + if (_M_use_count == 0) + __throw_bad_weak_ptr(); + ++_M_use_count; + } + + template<> + inline void + _Sp_counted_base<_S_mutex>:: + _M_add_ref_lock() + { + __gnu_cxx::__scoped_lock sentry(*this); + if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0) + { + _M_use_count = 0; + __throw_bad_weak_ptr(); + } + } + + template<> + inline void + _Sp_counted_base<_S_atomic>:: + _M_add_ref_lock() + { + // Perform lock-free add-if-not-zero operation. + _Atomic_word __count = _M_get_use_count(); + do + { + if (__count == 0) + __throw_bad_weak_ptr(); + // Replace the current counter value with the old value + 1, as + // long as it's not changed meanwhile. + } + while (!__atomic_compare_exchange_n(&_M_use_count, &__count, __count + 1, + true, __ATOMIC_ACQ_REL, + __ATOMIC_RELAXED)); + } + + template<> + inline bool + _Sp_counted_base<_S_single>:: + _M_add_ref_lock_nothrow() + { + if (_M_use_count == 0) + return false; + ++_M_use_count; + return true; + } + + template<> + inline bool + _Sp_counted_base<_S_mutex>:: + _M_add_ref_lock_nothrow() + { + __gnu_cxx::__scoped_lock sentry(*this); + if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0) + { + _M_use_count = 0; + return false; + } + return true; + } + + template<> + inline bool + _Sp_counted_base<_S_atomic>:: + _M_add_ref_lock_nothrow() + { + // Perform lock-free add-if-not-zero operation. + _Atomic_word __count = _M_get_use_count(); + do + { + if (__count == 0) + return false; + // Replace the current counter value with the old value + 1, as + // long as it's not changed meanwhile. + } + while (!__atomic_compare_exchange_n(&_M_use_count, &__count, __count + 1, + true, __ATOMIC_ACQ_REL, + __ATOMIC_RELAXED)); + return true; + } + + template<> + inline void + _Sp_counted_base<_S_single>::_M_add_ref_copy() + { ++_M_use_count; } + + template<> + inline void + _Sp_counted_base<_S_single>::_M_release() noexcept + { + if (--_M_use_count == 0) + { + _M_dispose(); + if (--_M_weak_count == 0) + _M_destroy(); + } + } + + template<> + inline void + _Sp_counted_base<_S_single>::_M_weak_add_ref() noexcept + { ++_M_weak_count; } + + template<> + inline void + _Sp_counted_base<_S_single>::_M_weak_release() noexcept + { + if (--_M_weak_count == 0) + _M_destroy(); + } + + template<> + inline long + _Sp_counted_base<_S_single>::_M_get_use_count() const noexcept + { return _M_use_count; } + + + // Forward declarations. + template + class __shared_ptr; + + template + class __weak_ptr; + + template + class __enable_shared_from_this; + + template + class shared_ptr; + + template + class weak_ptr; + + template + struct owner_less; + + template + class enable_shared_from_this; + + template<_Lock_policy _Lp = __default_lock_policy> + class __weak_count; + + template<_Lock_policy _Lp = __default_lock_policy> + class __shared_count; + + + // Counted ptr with no deleter or allocator support + template + class _Sp_counted_ptr final : public _Sp_counted_base<_Lp> + { + public: + explicit + _Sp_counted_ptr(_Ptr __p) noexcept + : _M_ptr(__p) { } + + virtual void + _M_dispose() noexcept + { delete _M_ptr; } + + virtual void + _M_destroy() noexcept + { delete this; } + + virtual void* + _M_get_deleter(const std::type_info&) noexcept + { return nullptr; } + + _Sp_counted_ptr(const _Sp_counted_ptr&) = delete; + _Sp_counted_ptr& operator=(const _Sp_counted_ptr&) = delete; + + private: + _Ptr _M_ptr; + }; + + template<> + inline void + _Sp_counted_ptr::_M_dispose() noexcept { } + + template<> + inline void + _Sp_counted_ptr::_M_dispose() noexcept { } + + template<> + inline void + _Sp_counted_ptr::_M_dispose() noexcept { } + + template + struct _Sp_ebo_helper; + + /// Specialization using EBO. + template + struct _Sp_ebo_helper<_Nm, _Tp, true> : private _Tp + { + explicit _Sp_ebo_helper(const _Tp& __tp) : _Tp(__tp) { } + explicit _Sp_ebo_helper(_Tp&& __tp) : _Tp(std::move(__tp)) { } + + static _Tp& + _S_get(_Sp_ebo_helper& __eboh) { return static_cast<_Tp&>(__eboh); } + }; + + /// Specialization not using EBO. + template + struct _Sp_ebo_helper<_Nm, _Tp, false> + { + explicit _Sp_ebo_helper(const _Tp& __tp) : _M_tp(__tp) { } + explicit _Sp_ebo_helper(_Tp&& __tp) : _M_tp(std::move(__tp)) { } + + static _Tp& + _S_get(_Sp_ebo_helper& __eboh) + { return __eboh._M_tp; } + + private: + _Tp _M_tp; + }; + + // Support for custom deleter and/or allocator + template + class _Sp_counted_deleter final : public _Sp_counted_base<_Lp> + { + class _Impl : _Sp_ebo_helper<0, _Deleter>, _Sp_ebo_helper<1, _Alloc> + { + typedef _Sp_ebo_helper<0, _Deleter> _Del_base; + typedef _Sp_ebo_helper<1, _Alloc> _Alloc_base; + + public: + _Impl(_Ptr __p, _Deleter __d, const _Alloc& __a) noexcept + : _M_ptr(__p), _Del_base(std::move(__d)), _Alloc_base(__a) + { } + + _Deleter& _M_del() noexcept { return _Del_base::_S_get(*this); } + _Alloc& _M_alloc() noexcept { return _Alloc_base::_S_get(*this); } + + _Ptr _M_ptr; + }; + + public: + using __allocator_type = __alloc_rebind<_Alloc, _Sp_counted_deleter>; + + // __d(__p) must not throw. + _Sp_counted_deleter(_Ptr __p, _Deleter __d) noexcept + : _M_impl(__p, std::move(__d), _Alloc()) { } + + // __d(__p) must not throw. + _Sp_counted_deleter(_Ptr __p, _Deleter __d, const _Alloc& __a) noexcept + : _M_impl(__p, std::move(__d), __a) { } + + ~_Sp_counted_deleter() noexcept { } + + virtual void + _M_dispose() noexcept + { _M_impl._M_del()(_M_impl._M_ptr); } + + virtual void + _M_destroy() noexcept + { + __allocator_type __a(_M_impl._M_alloc()); + __allocated_ptr<__allocator_type> __guard_ptr{ __a, this }; + this->~_Sp_counted_deleter(); + } + + virtual void* + _M_get_deleter(const std::type_info& __ti) noexcept + { +#if __cpp_rtti + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2400. shared_ptr's get_deleter() should use addressof() + return __ti == typeid(_Deleter) + ? std::__addressof(_M_impl._M_del()) + : nullptr; +#else + return nullptr; +#endif + } + + private: + _Impl _M_impl; + }; + + // helpers for make_shared / allocate_shared + + struct _Sp_make_shared_tag { }; + + template + class _Sp_counted_ptr_inplace final : public _Sp_counted_base<_Lp> + { + class _Impl : _Sp_ebo_helper<0, _Alloc> + { + typedef _Sp_ebo_helper<0, _Alloc> _A_base; + + public: + explicit _Impl(_Alloc __a) noexcept : _A_base(__a) { } + + _Alloc& _M_alloc() noexcept { return _A_base::_S_get(*this); } + + __gnu_cxx::__aligned_buffer<_Tp> _M_storage; + }; + + public: + using __allocator_type = __alloc_rebind<_Alloc, _Sp_counted_ptr_inplace>; + + template + _Sp_counted_ptr_inplace(_Alloc __a, _Args&&... __args) + : _M_impl(__a) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2070. allocate_shared should use allocator_traits::construct + allocator_traits<_Alloc>::construct(__a, _M_ptr(), + std::forward<_Args>(__args)...); // might throw + } + + ~_Sp_counted_ptr_inplace() noexcept { } + + virtual void + _M_dispose() noexcept + { + allocator_traits<_Alloc>::destroy(_M_impl._M_alloc(), _M_ptr()); + } + + // Override because the allocator needs to know the dynamic type + virtual void + _M_destroy() noexcept + { + __allocator_type __a(_M_impl._M_alloc()); + __allocated_ptr<__allocator_type> __guard_ptr{ __a, this }; + this->~_Sp_counted_ptr_inplace(); + } + + // Sneaky trick so __shared_ptr can get the managed pointer + virtual void* + _M_get_deleter(const std::type_info& __ti) noexcept + { +#if __cpp_rtti + if (__ti == typeid(_Sp_make_shared_tag)) + return const_cast::type*>(_M_ptr()); +#endif + return nullptr; + } + + private: + _Tp* _M_ptr() noexcept { return _M_impl._M_storage._M_ptr(); } + + _Impl _M_impl; + }; + + // The default deleter for shared_ptr and shared_ptr. + struct __sp_array_delete + { + template + void operator()(_Yp* __p) const { delete[] __p; } + }; + + template<_Lock_policy _Lp> + class __shared_count + { + public: + constexpr __shared_count() noexcept : _M_pi(0) + { } + + template + explicit + __shared_count(_Ptr __p) : _M_pi(0) + { + __try + { + _M_pi = new _Sp_counted_ptr<_Ptr, _Lp>(__p); + } + __catch(...) + { + delete __p; + __throw_exception_again; + } + } + + template + __shared_count(_Ptr __p, /* is_array = */ false_type) + : __shared_count(__p) + { } + + template + __shared_count(_Ptr __p, /* is_array = */ true_type) + : __shared_count(__p, __sp_array_delete{}, allocator()) + { } + + template + __shared_count(_Ptr __p, _Deleter __d) + : __shared_count(__p, std::move(__d), allocator()) + { } + + template + __shared_count(_Ptr __p, _Deleter __d, _Alloc __a) : _M_pi(0) + { + typedef _Sp_counted_deleter<_Ptr, _Deleter, _Alloc, _Lp> _Sp_cd_type; + __try + { + typename _Sp_cd_type::__allocator_type __a2(__a); + auto __guard = std::__allocate_guarded(__a2); + _Sp_cd_type* __mem = __guard.get(); + ::new (__mem) _Sp_cd_type(__p, std::move(__d), std::move(__a)); + _M_pi = __mem; + __guard = nullptr; + } + __catch(...) + { + __d(__p); // Call _Deleter on __p. + __throw_exception_again; + } + } + + template + __shared_count(_Sp_make_shared_tag, _Tp*, const _Alloc& __a, + _Args&&... __args) + : _M_pi(0) + { + typedef _Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp> _Sp_cp_type; + typename _Sp_cp_type::__allocator_type __a2(__a); + auto __guard = std::__allocate_guarded(__a2); + _Sp_cp_type* __mem = __guard.get(); + ::new (__mem) _Sp_cp_type(std::move(__a), + std::forward<_Args>(__args)...); + _M_pi = __mem; + __guard = nullptr; + } + +#if _GLIBCXX_USE_DEPRECATED + // Special case for auto_ptr<_Tp> to provide the strong guarantee. + template + explicit + __shared_count(std::auto_ptr<_Tp>&& __r); +#endif + + // Special case for unique_ptr<_Tp,_Del> to provide the strong guarantee. + template + explicit + __shared_count(std::unique_ptr<_Tp, _Del>&& __r) : _M_pi(0) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2415. Inconsistency between unique_ptr and shared_ptr + if (__r.get() == nullptr) + return; + + using _Ptr = typename unique_ptr<_Tp, _Del>::pointer; + using _Del2 = typename conditional::value, + reference_wrapper::type>, + _Del>::type; + using _Sp_cd_type + = _Sp_counted_deleter<_Ptr, _Del2, allocator, _Lp>; + using _Alloc = allocator<_Sp_cd_type>; + using _Alloc_traits = allocator_traits<_Alloc>; + _Alloc __a; + _Sp_cd_type* __mem = _Alloc_traits::allocate(__a, 1); + _Alloc_traits::construct(__a, __mem, __r.release(), + __r.get_deleter()); // non-throwing + _M_pi = __mem; + } + + // Throw bad_weak_ptr when __r._M_get_use_count() == 0. + explicit __shared_count(const __weak_count<_Lp>& __r); + + // Does not throw if __r._M_get_use_count() == 0, caller must check. + explicit __shared_count(const __weak_count<_Lp>& __r, std::nothrow_t); + + ~__shared_count() noexcept + { + if (_M_pi != nullptr) + _M_pi->_M_release(); + } + + __shared_count(const __shared_count& __r) noexcept + : _M_pi(__r._M_pi) + { + if (_M_pi != 0) + _M_pi->_M_add_ref_copy(); + } + + __shared_count& + operator=(const __shared_count& __r) noexcept + { + _Sp_counted_base<_Lp>* __tmp = __r._M_pi; + if (__tmp != _M_pi) + { + if (__tmp != 0) + __tmp->_M_add_ref_copy(); + if (_M_pi != 0) + _M_pi->_M_release(); + _M_pi = __tmp; + } + return *this; + } + + void + _M_swap(__shared_count& __r) noexcept + { + _Sp_counted_base<_Lp>* __tmp = __r._M_pi; + __r._M_pi = _M_pi; + _M_pi = __tmp; + } + + long + _M_get_use_count() const noexcept + { return _M_pi != 0 ? _M_pi->_M_get_use_count() : 0; } + + bool + _M_unique() const noexcept + { return this->_M_get_use_count() == 1; } + + void* + _M_get_deleter(const std::type_info& __ti) const noexcept + { return _M_pi ? _M_pi->_M_get_deleter(__ti) : nullptr; } + + bool + _M_less(const __shared_count& __rhs) const noexcept + { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); } + + bool + _M_less(const __weak_count<_Lp>& __rhs) const noexcept + { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); } + + // Friend function injected into enclosing namespace and found by ADL + friend inline bool + operator==(const __shared_count& __a, const __shared_count& __b) noexcept + { return __a._M_pi == __b._M_pi; } + + private: + friend class __weak_count<_Lp>; + + _Sp_counted_base<_Lp>* _M_pi; + }; + + + template<_Lock_policy _Lp> + class __weak_count + { + public: + constexpr __weak_count() noexcept : _M_pi(nullptr) + { } + + __weak_count(const __shared_count<_Lp>& __r) noexcept + : _M_pi(__r._M_pi) + { + if (_M_pi != nullptr) + _M_pi->_M_weak_add_ref(); + } + + __weak_count(const __weak_count& __r) noexcept + : _M_pi(__r._M_pi) + { + if (_M_pi != nullptr) + _M_pi->_M_weak_add_ref(); + } + + __weak_count(__weak_count&& __r) noexcept + : _M_pi(__r._M_pi) + { __r._M_pi = nullptr; } + + ~__weak_count() noexcept + { + if (_M_pi != nullptr) + _M_pi->_M_weak_release(); + } + + __weak_count& + operator=(const __shared_count<_Lp>& __r) noexcept + { + _Sp_counted_base<_Lp>* __tmp = __r._M_pi; + if (__tmp != nullptr) + __tmp->_M_weak_add_ref(); + if (_M_pi != nullptr) + _M_pi->_M_weak_release(); + _M_pi = __tmp; + return *this; + } + + __weak_count& + operator=(const __weak_count& __r) noexcept + { + _Sp_counted_base<_Lp>* __tmp = __r._M_pi; + if (__tmp != nullptr) + __tmp->_M_weak_add_ref(); + if (_M_pi != nullptr) + _M_pi->_M_weak_release(); + _M_pi = __tmp; + return *this; + } + + __weak_count& + operator=(__weak_count&& __r) noexcept + { + if (_M_pi != nullptr) + _M_pi->_M_weak_release(); + _M_pi = __r._M_pi; + __r._M_pi = nullptr; + return *this; + } + + void + _M_swap(__weak_count& __r) noexcept + { + _Sp_counted_base<_Lp>* __tmp = __r._M_pi; + __r._M_pi = _M_pi; + _M_pi = __tmp; + } + + long + _M_get_use_count() const noexcept + { return _M_pi != nullptr ? _M_pi->_M_get_use_count() : 0; } + + bool + _M_less(const __weak_count& __rhs) const noexcept + { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); } + + bool + _M_less(const __shared_count<_Lp>& __rhs) const noexcept + { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); } + + // Friend function injected into enclosing namespace and found by ADL + friend inline bool + operator==(const __weak_count& __a, const __weak_count& __b) noexcept + { return __a._M_pi == __b._M_pi; } + + private: + friend class __shared_count<_Lp>; + + _Sp_counted_base<_Lp>* _M_pi; + }; + + // Now that __weak_count is defined we can define this constructor: + template<_Lock_policy _Lp> + inline + __shared_count<_Lp>::__shared_count(const __weak_count<_Lp>& __r) + : _M_pi(__r._M_pi) + { + if (_M_pi != nullptr) + _M_pi->_M_add_ref_lock(); + else + __throw_bad_weak_ptr(); + } + + // Now that __weak_count is defined we can define this constructor: + template<_Lock_policy _Lp> + inline + __shared_count<_Lp>:: + __shared_count(const __weak_count<_Lp>& __r, std::nothrow_t) + : _M_pi(__r._M_pi) + { + if (_M_pi != nullptr) + if (!_M_pi->_M_add_ref_lock_nothrow()) + _M_pi = nullptr; + } + +#define __cpp_lib_shared_ptr_arrays 201603 + + // Helper traits for shared_ptr of array: + + // A pointer type Y* is said to be compatible with a pointer type T* when + // either Y* is convertible to T* or Y is U[N] and T is U cv []. + template + struct __sp_compatible_with + : false_type + { }; + + template + struct __sp_compatible_with<_Yp*, _Tp*> + : is_convertible<_Yp*, _Tp*>::type + { }; + + template + struct __sp_compatible_with<_Up(*)[_Nm], _Up(*)[]> + : true_type + { }; + + template + struct __sp_compatible_with<_Up(*)[_Nm], const _Up(*)[]> + : true_type + { }; + + template + struct __sp_compatible_with<_Up(*)[_Nm], volatile _Up(*)[]> + : true_type + { }; + + template + struct __sp_compatible_with<_Up(*)[_Nm], const volatile _Up(*)[]> + : true_type + { }; + + // Test conversion from Y(*)[N] to U(*)[N] without forming invalid type Y[N]. + template + struct __sp_is_constructible_arrN + : false_type + { }; + + template + struct __sp_is_constructible_arrN<_Up, _Nm, _Yp, __void_t<_Yp[_Nm]>> + : is_convertible<_Yp(*)[_Nm], _Up(*)[_Nm]>::type + { }; + + // Test conversion from Y(*)[] to U(*)[] without forming invalid type Y[]. + template + struct __sp_is_constructible_arr + : false_type + { }; + + template + struct __sp_is_constructible_arr<_Up, _Yp, __void_t<_Yp[]>> + : is_convertible<_Yp(*)[], _Up(*)[]>::type + { }; + + // Trait to check if shared_ptr can be constructed from Y*. + template + struct __sp_is_constructible; + + // When T is U[N], Y(*)[N] shall be convertible to T*; + template + struct __sp_is_constructible<_Up[_Nm], _Yp> + : __sp_is_constructible_arrN<_Up, _Nm, _Yp>::type + { }; + + // when T is U[], Y(*)[] shall be convertible to T*; + template + struct __sp_is_constructible<_Up[], _Yp> + : __sp_is_constructible_arr<_Up, _Yp>::type + { }; + + // otherwise, Y* shall be convertible to T*. + template + struct __sp_is_constructible + : is_convertible<_Yp*, _Tp*>::type + { }; + + + // Define operator* and operator-> for shared_ptr. + template::value, bool = is_void<_Tp>::value> + class __shared_ptr_access + { + public: + using element_type = _Tp; + + element_type& + operator*() const noexcept + { + __glibcxx_assert(_M_get() != nullptr); + return *_M_get(); + } + + element_type* + operator->() const noexcept + { + _GLIBCXX_DEBUG_PEDASSERT(_M_get() != nullptr); + return _M_get(); + } + + private: + element_type* + _M_get() const noexcept + { return static_cast*>(this)->get(); } + }; + + // Define operator-> for shared_ptr. + template + class __shared_ptr_access<_Tp, _Lp, false, true> + { + public: + using element_type = _Tp; + + element_type* + operator->() const noexcept + { + auto __ptr = static_cast*>(this)->get(); + _GLIBCXX_DEBUG_PEDASSERT(__ptr != nullptr); + return __ptr; + } + }; + + // Define operator[] for shared_ptr and shared_ptr. + template + class __shared_ptr_access<_Tp, _Lp, true, false> + { + public: + using element_type = typename remove_extent<_Tp>::type; + +#if __cplusplus <= 201402L + [[__deprecated__("shared_ptr::operator* is absent from C++17")]] + element_type& + operator*() const noexcept + { + __glibcxx_assert(_M_get() != nullptr); + return *_M_get(); + } + + [[__deprecated__("shared_ptr::operator-> is absent from C++17")]] + element_type* + operator->() const noexcept + { + _GLIBCXX_DEBUG_PEDASSERT(_M_get() != nullptr); + return _M_get(); + } +#endif + + element_type& + operator[](ptrdiff_t __i) const + { + __glibcxx_assert(_M_get() != nullptr); + __glibcxx_assert(!extent<_Tp>::value || __i < extent<_Tp>::value); + return _M_get()[__i]; + } + + private: + element_type* + _M_get() const noexcept + { return static_cast*>(this)->get(); } + }; + + template + class __shared_ptr + : public __shared_ptr_access<_Tp, _Lp> + { + public: + using element_type = typename remove_extent<_Tp>::type; + + private: + // Constraint for taking ownership of a pointer of type _Yp*: + template + using _SafeConv + = typename enable_if<__sp_is_constructible<_Tp, _Yp>::value>::type; + + // Constraint for construction from shared_ptr and weak_ptr: + template + using _Compatible = typename + enable_if<__sp_compatible_with<_Yp*, _Tp*>::value, _Res>::type; + + // Constraint for assignment from shared_ptr and weak_ptr: + template + using _Assignable = _Compatible<_Yp, __shared_ptr&>; + + // Constraint for construction from unique_ptr: + template::pointer> + using _UniqCompatible = typename enable_if<__and_< + __sp_compatible_with<_Yp*, _Tp*>, is_convertible<_Ptr, element_type*> + >::value, _Res>::type; + + // Constraint for assignment from unique_ptr: + template + using _UniqAssignable = _UniqCompatible<_Yp, _Del, __shared_ptr&>; + + public: + +#if __cplusplus > 201402L + using weak_type = __weak_ptr<_Tp, _Lp>; +#endif + + constexpr __shared_ptr() noexcept + : _M_ptr(0), _M_refcount() + { } + + template> + explicit + __shared_ptr(_Yp* __p) + : _M_ptr(__p), _M_refcount(__p, typename is_array<_Tp>::type()) + { + static_assert( !is_void<_Yp>::value, "incomplete type" ); + static_assert( sizeof(_Yp) > 0, "incomplete type" ); + _M_enable_shared_from_this_with(__p); + } + + template> + __shared_ptr(_Yp* __p, _Deleter __d) + : _M_ptr(__p), _M_refcount(__p, std::move(__d)) + { + static_assert(__is_invocable<_Deleter&, _Yp*&>::value, + "deleter expression d(p) is well-formed"); + _M_enable_shared_from_this_with(__p); + } + + template> + __shared_ptr(_Yp* __p, _Deleter __d, _Alloc __a) + : _M_ptr(__p), _M_refcount(__p, std::move(__d), std::move(__a)) + { + static_assert(__is_invocable<_Deleter&, _Yp*&>::value, + "deleter expression d(p) is well-formed"); + _M_enable_shared_from_this_with(__p); + } + + template + __shared_ptr(nullptr_t __p, _Deleter __d) + : _M_ptr(0), _M_refcount(__p, std::move(__d)) + { } + + template + __shared_ptr(nullptr_t __p, _Deleter __d, _Alloc __a) + : _M_ptr(0), _M_refcount(__p, std::move(__d), std::move(__a)) + { } + + template + __shared_ptr(const __shared_ptr<_Yp, _Lp>& __r, + element_type* __p) noexcept + : _M_ptr(__p), _M_refcount(__r._M_refcount) // never throws + { } + + __shared_ptr(const __shared_ptr&) noexcept = default; + __shared_ptr& operator=(const __shared_ptr&) noexcept = default; + ~__shared_ptr() = default; + + template> + __shared_ptr(const __shared_ptr<_Yp, _Lp>& __r) noexcept + : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) + { } + + __shared_ptr(__shared_ptr&& __r) noexcept + : _M_ptr(__r._M_ptr), _M_refcount() + { + _M_refcount._M_swap(__r._M_refcount); + __r._M_ptr = 0; + } + + template> + __shared_ptr(__shared_ptr<_Yp, _Lp>&& __r) noexcept + : _M_ptr(__r._M_ptr), _M_refcount() + { + _M_refcount._M_swap(__r._M_refcount); + __r._M_ptr = 0; + } + + template> + explicit __shared_ptr(const __weak_ptr<_Yp, _Lp>& __r) + : _M_refcount(__r._M_refcount) // may throw + { + // It is now safe to copy __r._M_ptr, as + // _M_refcount(__r._M_refcount) did not throw. + _M_ptr = __r._M_ptr; + } + + // If an exception is thrown this constructor has no effect. + template> + __shared_ptr(unique_ptr<_Yp, _Del>&& __r) + : _M_ptr(__r.get()), _M_refcount() + { + auto __raw = _S_raw_ptr(__r.get()); + _M_refcount = __shared_count<_Lp>(std::move(__r)); + _M_enable_shared_from_this_with(__raw); + } + +#if __cplusplus <= 201402L && _GLIBCXX_USE_DEPRECATED + protected: + // If an exception is thrown this constructor has no effect. + template>, is_array<_Tp1>, + is_convertible::pointer, _Tp*> + >::value, bool>::type = true> + __shared_ptr(unique_ptr<_Tp1, _Del>&& __r, __sp_array_delete) + : _M_ptr(__r.get()), _M_refcount() + { + auto __raw = _S_raw_ptr(__r.get()); + _M_refcount = __shared_count<_Lp>(std::move(__r)); + _M_enable_shared_from_this_with(__raw); + } + public: +#endif + +#if _GLIBCXX_USE_DEPRECATED + // Postcondition: use_count() == 1 and __r.get() == 0 + template> + __shared_ptr(auto_ptr<_Yp>&& __r); +#endif + + constexpr __shared_ptr(nullptr_t) noexcept : __shared_ptr() { } + + template + _Assignable<_Yp> + operator=(const __shared_ptr<_Yp, _Lp>& __r) noexcept + { + _M_ptr = __r._M_ptr; + _M_refcount = __r._M_refcount; // __shared_count::op= doesn't throw + return *this; + } + +#if _GLIBCXX_USE_DEPRECATED + template + _Assignable<_Yp> + operator=(auto_ptr<_Yp>&& __r) + { + __shared_ptr(std::move(__r)).swap(*this); + return *this; + } +#endif + + __shared_ptr& + operator=(__shared_ptr&& __r) noexcept + { + __shared_ptr(std::move(__r)).swap(*this); + return *this; + } + + template + _Assignable<_Yp> + operator=(__shared_ptr<_Yp, _Lp>&& __r) noexcept + { + __shared_ptr(std::move(__r)).swap(*this); + return *this; + } + + template + _UniqAssignable<_Yp, _Del> + operator=(unique_ptr<_Yp, _Del>&& __r) + { + __shared_ptr(std::move(__r)).swap(*this); + return *this; + } + + void + reset() noexcept + { __shared_ptr().swap(*this); } + + template + _SafeConv<_Yp> + reset(_Yp* __p) // _Yp must be complete. + { + // Catch self-reset errors. + __glibcxx_assert(__p == 0 || __p != _M_ptr); + __shared_ptr(__p).swap(*this); + } + + template + _SafeConv<_Yp> + reset(_Yp* __p, _Deleter __d) + { __shared_ptr(__p, std::move(__d)).swap(*this); } + + template + _SafeConv<_Yp> + reset(_Yp* __p, _Deleter __d, _Alloc __a) + { __shared_ptr(__p, std::move(__d), std::move(__a)).swap(*this); } + + element_type* + get() const noexcept + { return _M_ptr; } + + explicit operator bool() const // never throws + { return _M_ptr == 0 ? false : true; } + + bool + unique() const noexcept + { return _M_refcount._M_unique(); } + + long + use_count() const noexcept + { return _M_refcount._M_get_use_count(); } + + void + swap(__shared_ptr<_Tp, _Lp>& __other) noexcept + { + std::swap(_M_ptr, __other._M_ptr); + _M_refcount._M_swap(__other._M_refcount); + } + + template + bool + owner_before(__shared_ptr<_Tp1, _Lp> const& __rhs) const noexcept + { return _M_refcount._M_less(__rhs._M_refcount); } + + template + bool + owner_before(__weak_ptr<_Tp1, _Lp> const& __rhs) const noexcept + { return _M_refcount._M_less(__rhs._M_refcount); } + +#if __cpp_rtti + protected: + // This constructor is non-standard, it is used by allocate_shared. + template + __shared_ptr(_Sp_make_shared_tag __tag, const _Alloc& __a, + _Args&&... __args) + : _M_ptr(), _M_refcount(__tag, (_Tp*)0, __a, + std::forward<_Args>(__args)...) + { + // _M_ptr needs to point to the newly constructed object. + // This relies on _Sp_counted_ptr_inplace::_M_get_deleter. + void* __p = _M_refcount._M_get_deleter(typeid(__tag)); + _M_ptr = static_cast<_Tp*>(__p); + _M_enable_shared_from_this_with(_M_ptr); + } +#else + template + struct _Deleter + { + void operator()(typename _Alloc::value_type* __ptr) + { + __allocated_ptr<_Alloc> __guard{ _M_alloc, __ptr }; + allocator_traits<_Alloc>::destroy(_M_alloc, __guard.get()); + } + _Alloc _M_alloc; + }; + + template + __shared_ptr(_Sp_make_shared_tag __tag, const _Alloc& __a, + _Args&&... __args) + : _M_ptr(), _M_refcount() + { + typedef typename allocator_traits<_Alloc>::template + rebind_traits::type> __traits; + _Deleter __del = { __a }; + auto __guard = std::__allocate_guarded(__del._M_alloc); + auto __ptr = __guard.get(); + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2070. allocate_shared should use allocator_traits::construct + __traits::construct(__del._M_alloc, __ptr, + std::forward<_Args>(__args)...); + __guard = nullptr; + __shared_count<_Lp> __count(__ptr, __del, __del._M_alloc); + _M_refcount._M_swap(__count); + _M_ptr = __ptr; + _M_enable_shared_from_this_with(_M_ptr); + } +#endif + + template + friend __shared_ptr<_Tp1, _Lp1> + __allocate_shared(const _Alloc& __a, _Args&&... __args); + + // This constructor is used by __weak_ptr::lock() and + // shared_ptr::shared_ptr(const weak_ptr&, std::nothrow_t). + __shared_ptr(const __weak_ptr<_Tp, _Lp>& __r, std::nothrow_t) + : _M_refcount(__r._M_refcount, std::nothrow) + { + _M_ptr = _M_refcount._M_get_use_count() ? __r._M_ptr : nullptr; + } + + friend class __weak_ptr<_Tp, _Lp>; + + private: + + template + using __esft_base_t = decltype(__enable_shared_from_this_base( + std::declval&>(), + std::declval<_Yp*>())); + + // Detect an accessible and unambiguous enable_shared_from_this base. + template + struct __has_esft_base + : false_type { }; + + template + struct __has_esft_base<_Yp, __void_t<__esft_base_t<_Yp>>> + : __not_> { }; // No enable shared_from_this for arrays + + template::type> + typename enable_if<__has_esft_base<_Yp2>::value>::type + _M_enable_shared_from_this_with(_Yp* __p) noexcept + { + if (auto __base = __enable_shared_from_this_base(_M_refcount, __p)) + __base->_M_weak_assign(const_cast<_Yp2*>(__p), _M_refcount); + } + + template::type> + typename enable_if::value>::type + _M_enable_shared_from_this_with(_Yp*) noexcept + { } + + void* + _M_get_deleter(const std::type_info& __ti) const noexcept + { return _M_refcount._M_get_deleter(__ti); } + + template + static _Tp1* + _S_raw_ptr(_Tp1* __ptr) + { return __ptr; } + + template + static auto + _S_raw_ptr(_Tp1 __ptr) -> decltype(std::__addressof(*__ptr)) + { return std::__addressof(*__ptr); } + + template friend class __shared_ptr; + template friend class __weak_ptr; + + template + friend _Del* get_deleter(const __shared_ptr<_Tp1, _Lp1>&) noexcept; + + element_type* _M_ptr; // Contained pointer. + __shared_count<_Lp> _M_refcount; // Reference counter. + }; + + + // 20.7.2.2.7 shared_ptr comparisons + template + inline bool + operator==(const __shared_ptr<_Tp1, _Lp>& __a, + const __shared_ptr<_Tp2, _Lp>& __b) noexcept + { return __a.get() == __b.get(); } + + template + inline bool + operator==(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept + { return !__a; } + + template + inline bool + operator==(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept + { return !__a; } + + template + inline bool + operator!=(const __shared_ptr<_Tp1, _Lp>& __a, + const __shared_ptr<_Tp2, _Lp>& __b) noexcept + { return __a.get() != __b.get(); } + + template + inline bool + operator!=(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept + { return (bool)__a; } + + template + inline bool + operator!=(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept + { return (bool)__a; } + + template + inline bool + operator<(const __shared_ptr<_Tp, _Lp>& __a, + const __shared_ptr<_Up, _Lp>& __b) noexcept + { + using _Tp_elt = typename __shared_ptr<_Tp, _Lp>::element_type; + using _Up_elt = typename __shared_ptr<_Up, _Lp>::element_type; + using _Vp = typename common_type<_Tp_elt*, _Up_elt*>::type; + return less<_Vp>()(__a.get(), __b.get()); + } + + template + inline bool + operator<(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept + { + using _Tp_elt = typename __shared_ptr<_Tp, _Lp>::element_type; + return less<_Tp_elt*>()(__a.get(), nullptr); + } + + template + inline bool + operator<(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept + { + using _Tp_elt = typename __shared_ptr<_Tp, _Lp>::element_type; + return less<_Tp_elt*>()(nullptr, __a.get()); + } + + template + inline bool + operator<=(const __shared_ptr<_Tp1, _Lp>& __a, + const __shared_ptr<_Tp2, _Lp>& __b) noexcept + { return !(__b < __a); } + + template + inline bool + operator<=(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept + { return !(nullptr < __a); } + + template + inline bool + operator<=(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept + { return !(__a < nullptr); } + + template + inline bool + operator>(const __shared_ptr<_Tp1, _Lp>& __a, + const __shared_ptr<_Tp2, _Lp>& __b) noexcept + { return (__b < __a); } + + template + inline bool + operator>(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept + { return nullptr < __a; } + + template + inline bool + operator>(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept + { return __a < nullptr; } + + template + inline bool + operator>=(const __shared_ptr<_Tp1, _Lp>& __a, + const __shared_ptr<_Tp2, _Lp>& __b) noexcept + { return !(__a < __b); } + + template + inline bool + operator>=(const __shared_ptr<_Tp, _Lp>& __a, nullptr_t) noexcept + { return !(__a < nullptr); } + + template + inline bool + operator>=(nullptr_t, const __shared_ptr<_Tp, _Lp>& __a) noexcept + { return !(nullptr < __a); } + + template + struct _Sp_less : public binary_function<_Sp, _Sp, bool> + { + bool + operator()(const _Sp& __lhs, const _Sp& __rhs) const noexcept + { + typedef typename _Sp::element_type element_type; + return std::less()(__lhs.get(), __rhs.get()); + } + }; + + template + struct less<__shared_ptr<_Tp, _Lp>> + : public _Sp_less<__shared_ptr<_Tp, _Lp>> + { }; + + // 20.7.2.2.8 shared_ptr specialized algorithms. + template + inline void + swap(__shared_ptr<_Tp, _Lp>& __a, __shared_ptr<_Tp, _Lp>& __b) noexcept + { __a.swap(__b); } + + // 20.7.2.2.9 shared_ptr casts + + // The seemingly equivalent code: + // shared_ptr<_Tp, _Lp>(static_cast<_Tp*>(__r.get())) + // will eventually result in undefined behaviour, attempting to + // delete the same object twice. + /// static_pointer_cast + template + inline __shared_ptr<_Tp, _Lp> + static_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r) noexcept + { + using _Sp = __shared_ptr<_Tp, _Lp>; + return _Sp(__r, static_cast(__r.get())); + } + + // The seemingly equivalent code: + // shared_ptr<_Tp, _Lp>(const_cast<_Tp*>(__r.get())) + // will eventually result in undefined behaviour, attempting to + // delete the same object twice. + /// const_pointer_cast + template + inline __shared_ptr<_Tp, _Lp> + const_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r) noexcept + { + using _Sp = __shared_ptr<_Tp, _Lp>; + return _Sp(__r, const_cast(__r.get())); + } + + // The seemingly equivalent code: + // shared_ptr<_Tp, _Lp>(dynamic_cast<_Tp*>(__r.get())) + // will eventually result in undefined behaviour, attempting to + // delete the same object twice. + /// dynamic_pointer_cast + template + inline __shared_ptr<_Tp, _Lp> + dynamic_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r) noexcept + { + using _Sp = __shared_ptr<_Tp, _Lp>; + if (auto* __p = dynamic_cast(__r.get())) + return _Sp(__r, __p); + return _Sp(); + } + +#if __cplusplus > 201402L + template + inline __shared_ptr<_Tp, _Lp> + reinterpret_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r) noexcept + { + using _Sp = __shared_ptr<_Tp, _Lp>; + return _Sp(__r, reinterpret_cast(__r.get())); + } +#endif + + template + class __weak_ptr + { + template + using _Compatible = typename + enable_if<__sp_compatible_with<_Yp*, _Tp*>::value, _Res>::type; + + // Constraint for assignment from shared_ptr and weak_ptr: + template + using _Assignable = _Compatible<_Yp, __weak_ptr&>; + + public: + using element_type = typename remove_extent<_Tp>::type; + + constexpr __weak_ptr() noexcept + : _M_ptr(nullptr), _M_refcount() + { } + + __weak_ptr(const __weak_ptr&) noexcept = default; + + ~__weak_ptr() = default; + + // The "obvious" converting constructor implementation: + // + // template + // __weak_ptr(const __weak_ptr<_Tp1, _Lp>& __r) + // : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws + // { } + // + // has a serious problem. + // + // __r._M_ptr may already have been invalidated. The _M_ptr(__r._M_ptr) + // conversion may require access to *__r._M_ptr (virtual inheritance). + // + // It is not possible to avoid spurious access violations since + // in multithreaded programs __r._M_ptr may be invalidated at any point. + template> + __weak_ptr(const __weak_ptr<_Yp, _Lp>& __r) noexcept + : _M_refcount(__r._M_refcount) + { _M_ptr = __r.lock().get(); } + + template> + __weak_ptr(const __shared_ptr<_Yp, _Lp>& __r) noexcept + : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) + { } + + __weak_ptr(__weak_ptr&& __r) noexcept + : _M_ptr(__r._M_ptr), _M_refcount(std::move(__r._M_refcount)) + { __r._M_ptr = nullptr; } + + template> + __weak_ptr(__weak_ptr<_Yp, _Lp>&& __r) noexcept + : _M_ptr(__r.lock().get()), _M_refcount(std::move(__r._M_refcount)) + { __r._M_ptr = nullptr; } + + __weak_ptr& + operator=(const __weak_ptr& __r) noexcept = default; + + template + _Assignable<_Yp> + operator=(const __weak_ptr<_Yp, _Lp>& __r) noexcept + { + _M_ptr = __r.lock().get(); + _M_refcount = __r._M_refcount; + return *this; + } + + template + _Assignable<_Yp> + operator=(const __shared_ptr<_Yp, _Lp>& __r) noexcept + { + _M_ptr = __r._M_ptr; + _M_refcount = __r._M_refcount; + return *this; + } + + __weak_ptr& + operator=(__weak_ptr&& __r) noexcept + { + _M_ptr = __r._M_ptr; + _M_refcount = std::move(__r._M_refcount); + __r._M_ptr = nullptr; + return *this; + } + + template + _Assignable<_Yp> + operator=(__weak_ptr<_Yp, _Lp>&& __r) noexcept + { + _M_ptr = __r.lock().get(); + _M_refcount = std::move(__r._M_refcount); + __r._M_ptr = nullptr; + return *this; + } + + __shared_ptr<_Tp, _Lp> + lock() const noexcept + { return __shared_ptr(*this, std::nothrow); } + + long + use_count() const noexcept + { return _M_refcount._M_get_use_count(); } + + bool + expired() const noexcept + { return _M_refcount._M_get_use_count() == 0; } + + template + bool + owner_before(const __shared_ptr<_Tp1, _Lp>& __rhs) const noexcept + { return _M_refcount._M_less(__rhs._M_refcount); } + + template + bool + owner_before(const __weak_ptr<_Tp1, _Lp>& __rhs) const noexcept + { return _M_refcount._M_less(__rhs._M_refcount); } + + void + reset() noexcept + { __weak_ptr().swap(*this); } + + void + swap(__weak_ptr& __s) noexcept + { + std::swap(_M_ptr, __s._M_ptr); + _M_refcount._M_swap(__s._M_refcount); + } + + private: + // Used by __enable_shared_from_this. + void + _M_assign(_Tp* __ptr, const __shared_count<_Lp>& __refcount) noexcept + { + if (use_count() == 0) + { + _M_ptr = __ptr; + _M_refcount = __refcount; + } + } + + template friend class __shared_ptr; + template friend class __weak_ptr; + friend class __enable_shared_from_this<_Tp, _Lp>; + friend class enable_shared_from_this<_Tp>; + + element_type* _M_ptr; // Contained pointer. + __weak_count<_Lp> _M_refcount; // Reference counter. + }; + + // 20.7.2.3.6 weak_ptr specialized algorithms. + template + inline void + swap(__weak_ptr<_Tp, _Lp>& __a, __weak_ptr<_Tp, _Lp>& __b) noexcept + { __a.swap(__b); } + + template + struct _Sp_owner_less : public binary_function<_Tp, _Tp, bool> + { + bool + operator()(const _Tp& __lhs, const _Tp& __rhs) const noexcept + { return __lhs.owner_before(__rhs); } + + bool + operator()(const _Tp& __lhs, const _Tp1& __rhs) const noexcept + { return __lhs.owner_before(__rhs); } + + bool + operator()(const _Tp1& __lhs, const _Tp& __rhs) const noexcept + { return __lhs.owner_before(__rhs); } + }; + + template<> + struct _Sp_owner_less + { + template + auto + operator()(const _Tp& __lhs, const _Up& __rhs) const noexcept + -> decltype(__lhs.owner_before(__rhs)) + { return __lhs.owner_before(__rhs); } + + using is_transparent = void; + }; + + template + struct owner_less<__shared_ptr<_Tp, _Lp>> + : public _Sp_owner_less<__shared_ptr<_Tp, _Lp>, __weak_ptr<_Tp, _Lp>> + { }; + + template + struct owner_less<__weak_ptr<_Tp, _Lp>> + : public _Sp_owner_less<__weak_ptr<_Tp, _Lp>, __shared_ptr<_Tp, _Lp>> + { }; + + + template + class __enable_shared_from_this + { + protected: + constexpr __enable_shared_from_this() noexcept { } + + __enable_shared_from_this(const __enable_shared_from_this&) noexcept { } + + __enable_shared_from_this& + operator=(const __enable_shared_from_this&) noexcept + { return *this; } + + ~__enable_shared_from_this() { } + + public: + __shared_ptr<_Tp, _Lp> + shared_from_this() + { return __shared_ptr<_Tp, _Lp>(this->_M_weak_this); } + + __shared_ptr + shared_from_this() const + { return __shared_ptr(this->_M_weak_this); } + +#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 + __weak_ptr<_Tp, _Lp> + weak_from_this() noexcept + { return this->_M_weak_this; } + + __weak_ptr + weak_from_this() const noexcept + { return this->_M_weak_this; } +#endif + + private: + template + void + _M_weak_assign(_Tp1* __p, const __shared_count<_Lp>& __n) const noexcept + { _M_weak_this._M_assign(__p, __n); } + + friend const __enable_shared_from_this* + __enable_shared_from_this_base(const __shared_count<_Lp>&, + const __enable_shared_from_this* __p) + { return __p; } + + template + friend class __shared_ptr; + + mutable __weak_ptr<_Tp, _Lp> _M_weak_this; + }; + + template + inline __shared_ptr<_Tp, _Lp> + __allocate_shared(const _Alloc& __a, _Args&&... __args) + { + return __shared_ptr<_Tp, _Lp>(_Sp_make_shared_tag(), __a, + std::forward<_Args>(__args)...); + } + + template + inline __shared_ptr<_Tp, _Lp> + __make_shared(_Args&&... __args) + { + typedef typename std::remove_const<_Tp>::type _Tp_nc; + return std::__allocate_shared<_Tp, _Lp>(std::allocator<_Tp_nc>(), + std::forward<_Args>(__args)...); + } + + /// std::hash specialization for __shared_ptr. + template + struct hash<__shared_ptr<_Tp, _Lp>> + : public __hash_base> + { + size_t + operator()(const __shared_ptr<_Tp, _Lp>& __s) const noexcept + { + return hash::element_type*>()( + __s.get()); + } + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif // _SHARED_PTR_BASE_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/slice_array.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/slice_array.h new file mode 100644 index 0000000..cd668fb --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/slice_array.h @@ -0,0 +1,274 @@ +// The template and inlines for the -*- C++ -*- slice_array class. + +// Copyright (C) 1997-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/slice_array.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{valarray} + */ + +// Written by Gabriel Dos Reis + +#ifndef _SLICE_ARRAY_H +#define _SLICE_ARRAY_H 1 + +#pragma GCC system_header + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup numeric_arrays + * @{ + */ + + /** + * @brief Class defining one-dimensional subset of an array. + * + * The slice class represents a one-dimensional subset of an array, + * specified by three parameters: start offset, size, and stride. The + * start offset is the index of the first element of the array that is part + * of the subset. The size is the total number of elements in the subset. + * Stride is the distance between each successive array element to include + * in the subset. + * + * For example, with an array of size 10, and a slice with offset 1, size 3 + * and stride 2, the subset consists of array elements 1, 3, and 5. + */ + class slice + { + public: + /// Construct an empty slice. + slice(); + + /** + * @brief Construct a slice. + * + * @param __o Offset in array of first element. + * @param __d Number of elements in slice. + * @param __s Stride between array elements. + */ + slice(size_t __o, size_t __d, size_t __s); + + /// Return array offset of first slice element. + size_t start() const; + /// Return size of slice. + size_t size() const; + /// Return array stride of slice. + size_t stride() const; + + private: + size_t _M_off; // offset + size_t _M_sz; // size + size_t _M_st; // stride unit + }; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 543. valarray slice default constructor + inline + slice::slice() + : _M_off(0), _M_sz(0), _M_st(0) {} + + inline + slice::slice(size_t __o, size_t __d, size_t __s) + : _M_off(__o), _M_sz(__d), _M_st(__s) {} + + inline size_t + slice::start() const + { return _M_off; } + + inline size_t + slice::size() const + { return _M_sz; } + + inline size_t + slice::stride() const + { return _M_st; } + + /** + * @brief Reference to one-dimensional subset of an array. + * + * A slice_array is a reference to the actual elements of an array + * specified by a slice. The way to get a slice_array is to call + * operator[](slice) on a valarray. The returned slice_array then permits + * carrying operations out on the referenced subset of elements in the + * original valarray. For example, operator+=(valarray) will add values + * to the subset of elements in the underlying valarray this slice_array + * refers to. + * + * @param Tp Element type. + */ + template + class slice_array + { + public: + typedef _Tp value_type; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 253. valarray helper functions are almost entirely useless + + /// Copy constructor. Both slices refer to the same underlying array. + slice_array(const slice_array&); + + /// Assignment operator. Assigns slice elements to corresponding + /// elements of @a a. + slice_array& operator=(const slice_array&); + + /// Assign slice elements to corresponding elements of @a v. + void operator=(const valarray<_Tp>&) const; + /// Multiply slice elements by corresponding elements of @a v. + void operator*=(const valarray<_Tp>&) const; + /// Divide slice elements by corresponding elements of @a v. + void operator/=(const valarray<_Tp>&) const; + /// Modulo slice elements by corresponding elements of @a v. + void operator%=(const valarray<_Tp>&) const; + /// Add corresponding elements of @a v to slice elements. + void operator+=(const valarray<_Tp>&) const; + /// Subtract corresponding elements of @a v from slice elements. + void operator-=(const valarray<_Tp>&) const; + /// Logical xor slice elements with corresponding elements of @a v. + void operator^=(const valarray<_Tp>&) const; + /// Logical and slice elements with corresponding elements of @a v. + void operator&=(const valarray<_Tp>&) const; + /// Logical or slice elements with corresponding elements of @a v. + void operator|=(const valarray<_Tp>&) const; + /// Left shift slice elements by corresponding elements of @a v. + void operator<<=(const valarray<_Tp>&) const; + /// Right shift slice elements by corresponding elements of @a v. + void operator>>=(const valarray<_Tp>&) const; + /// Assign all slice elements to @a t. + void operator=(const _Tp &) const; + // ~slice_array (); + + template + void operator=(const _Expr<_Dom, _Tp>&) const; + template + void operator*=(const _Expr<_Dom, _Tp>&) const; + template + void operator/=(const _Expr<_Dom, _Tp>&) const; + template + void operator%=(const _Expr<_Dom, _Tp>&) const; + template + void operator+=(const _Expr<_Dom, _Tp>&) const; + template + void operator-=(const _Expr<_Dom, _Tp>&) const; + template + void operator^=(const _Expr<_Dom, _Tp>&) const; + template + void operator&=(const _Expr<_Dom, _Tp>&) const; + template + void operator|=(const _Expr<_Dom, _Tp>&) const; + template + void operator<<=(const _Expr<_Dom, _Tp>&) const; + template + void operator>>=(const _Expr<_Dom, _Tp>&) const; + + private: + friend class valarray<_Tp>; + slice_array(_Array<_Tp>, const slice&); + + const size_t _M_sz; + const size_t _M_stride; + const _Array<_Tp> _M_array; + + // not implemented + slice_array(); + }; + + template + inline + slice_array<_Tp>::slice_array(_Array<_Tp> __a, const slice& __s) + : _M_sz(__s.size()), _M_stride(__s.stride()), + _M_array(__a.begin() + __s.start()) {} + + template + inline + slice_array<_Tp>::slice_array(const slice_array<_Tp>& __a) + : _M_sz(__a._M_sz), _M_stride(__a._M_stride), _M_array(__a._M_array) {} + + // template + // inline slice_array<_Tp>::~slice_array () {} + + template + inline slice_array<_Tp>& + slice_array<_Tp>::operator=(const slice_array<_Tp>& __a) + { + std::__valarray_copy(__a._M_array, __a._M_sz, __a._M_stride, + _M_array, _M_stride); + return *this; + } + + template + inline void + slice_array<_Tp>::operator=(const _Tp& __t) const + { std::__valarray_fill(_M_array, _M_sz, _M_stride, __t); } + + template + inline void + slice_array<_Tp>::operator=(const valarray<_Tp>& __v) const + { std::__valarray_copy(_Array<_Tp>(__v), _M_array, _M_sz, _M_stride); } + + template + template + inline void + slice_array<_Tp>::operator=(const _Expr<_Dom,_Tp>& __e) const + { std::__valarray_copy(__e, _M_sz, _M_array, _M_stride); } + +#undef _DEFINE_VALARRAY_OPERATOR +#define _DEFINE_VALARRAY_OPERATOR(_Op,_Name) \ + template \ + inline void \ + slice_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const \ + { \ + _Array_augmented_##_Name(_M_array, _M_sz, _M_stride, _Array<_Tp>(__v));\ + } \ + \ + template \ + template \ + inline void \ + slice_array<_Tp>::operator _Op##=(const _Expr<_Dom,_Tp>& __e) const\ + { \ + _Array_augmented_##_Name(_M_array, _M_stride, __e, _M_sz); \ + } + + +_DEFINE_VALARRAY_OPERATOR(*, __multiplies) +_DEFINE_VALARRAY_OPERATOR(/, __divides) +_DEFINE_VALARRAY_OPERATOR(%, __modulus) +_DEFINE_VALARRAY_OPERATOR(+, __plus) +_DEFINE_VALARRAY_OPERATOR(-, __minus) +_DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor) +_DEFINE_VALARRAY_OPERATOR(&, __bitwise_and) +_DEFINE_VALARRAY_OPERATOR(|, __bitwise_or) +_DEFINE_VALARRAY_OPERATOR(<<, __shift_left) +_DEFINE_VALARRAY_OPERATOR(>>, __shift_right) + +#undef _DEFINE_VALARRAY_OPERATOR + + // @} group numeric_arrays + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _SLICE_ARRAY_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/specfun.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/specfun.h new file mode 100644 index 0000000..6dd23d2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/specfun.h @@ -0,0 +1,1309 @@ +// Mathematical Special Functions for -*- C++ -*- + +// Copyright (C) 2006-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/specfun.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{cmath} + */ + +#ifndef _GLIBCXX_BITS_SPECFUN_H +#define _GLIBCXX_BITS_SPECFUN_H 1 + +#pragma GCC visibility push(default) + +#include + +#define __STDCPP_MATH_SPEC_FUNCS__ 201003L + +#define __cpp_lib_math_special_functions 201603L + +#if __cplusplus <= 201403L && __STDCPP_WANT_MATH_SPEC_FUNCS__ == 0 +# error include and define __STDCPP_WANT_MATH_SPEC_FUNCS__ +#endif + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @defgroup mathsf Mathematical Special Functions + * @ingroup numerics + * + * A collection of advanced mathematical special functions, + * defined by ISO/IEC IS 29124. + * @{ + */ + + /** + * @mainpage Mathematical Special Functions + * + * @section intro Introduction and History + * The first significant library upgrade on the road to C++2011, + * + * TR1, included a set of 23 mathematical functions that significantly + * extended the standard transcendental functions inherited from C and declared + * in @. + * + * Although most components from TR1 were eventually adopted for C++11 these + * math functions were left behind out of concern for implementability. + * The math functions were published as a separate international standard + * + * IS 29124 - Extensions to the C++ Library to Support Mathematical Special + * Functions. + * + * For C++17 these functions were incorporated into the main standard. + * + * @section contents Contents + * The following functions are implemented in namespace @c std: + * - @ref assoc_laguerre "assoc_laguerre - Associated Laguerre functions" + * - @ref assoc_legendre "assoc_legendre - Associated Legendre functions" + * - @ref beta "beta - Beta functions" + * - @ref comp_ellint_1 "comp_ellint_1 - Complete elliptic functions of the first kind" + * - @ref comp_ellint_2 "comp_ellint_2 - Complete elliptic functions of the second kind" + * - @ref comp_ellint_3 "comp_ellint_3 - Complete elliptic functions of the third kind" + * - @ref cyl_bessel_i "cyl_bessel_i - Regular modified cylindrical Bessel functions" + * - @ref cyl_bessel_j "cyl_bessel_j - Cylindrical Bessel functions of the first kind" + * - @ref cyl_bessel_k "cyl_bessel_k - Irregular modified cylindrical Bessel functions" + * - @ref cyl_neumann "cyl_neumann - Cylindrical Neumann functions or Cylindrical Bessel functions of the second kind" + * - @ref ellint_1 "ellint_1 - Incomplete elliptic functions of the first kind" + * - @ref ellint_2 "ellint_2 - Incomplete elliptic functions of the second kind" + * - @ref ellint_3 "ellint_3 - Incomplete elliptic functions of the third kind" + * - @ref expint "expint - The exponential integral" + * - @ref hermite "hermite - Hermite polynomials" + * - @ref laguerre "laguerre - Laguerre functions" + * - @ref legendre "legendre - Legendre polynomials" + * - @ref riemann_zeta "riemann_zeta - The Riemann zeta function" + * - @ref sph_bessel "sph_bessel - Spherical Bessel functions" + * - @ref sph_legendre "sph_legendre - Spherical Legendre functions" + * - @ref sph_neumann "sph_neumann - Spherical Neumann functions" + * + * The hypergeometric functions were stricken from the TR29124 and C++17 + * versions of this math library because of implementation concerns. + * However, since they were in the TR1 version and since they are popular + * we kept them as an extension in namespace @c __gnu_cxx: + * - @ref conf_hyperg "conf_hyperg - Confluent hypergeometric functions" + * - @ref hyperg "hyperg - Hypergeometric functions" + * + * @section general General Features + * + * @subsection promotion Argument Promotion + * The arguments suppled to the non-suffixed functions will be promoted + * according to the following rules: + * 1. If any argument intended to be floating point is given an integral value + * That integral value is promoted to double. + * 2. All floating point arguments are promoted up to the largest floating + * point precision among them. + * + * @subsection NaN NaN Arguments + * If any of the floating point arguments supplied to these functions is + * invalid or NaN (std::numeric_limits::quiet_NaN), + * the value NaN is returned. + * + * @section impl Implementation + * + * We strive to implement the underlying math with type generic algorithms + * to the greatest extent possible. In practice, the functions are thin + * wrappers that dispatch to function templates. Type dependence is + * controlled with std::numeric_limits and functions thereof. + * + * We don't promote @c float to @c double or @c double to long double + * reflexively. The goal is for @c float functions to operate more quickly, + * at the cost of @c float accuracy and possibly a smaller domain of validity. + * Similaryly, long double should give you more dynamic range + * and slightly more pecision than @c double on many systems. + * + * @section testing Testing + * + * These functions have been tested against equivalent implementations + * from the + * Gnu Scientific Library, GSL and + * should declare abs(double) + +#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO + inline _GLIBCXX_CONSTEXPR double + abs(double __x) + { return __builtin_fabs(__x); } + + inline _GLIBCXX_CONSTEXPR float + abs(float __x) + { return __builtin_fabsf(__x); } + + inline _GLIBCXX_CONSTEXPR long double + abs(long double __x) + { return __builtin_fabsl(__x); } +#endif + +#if defined(__GLIBCXX_TYPE_INT_N_0) + inline _GLIBCXX_CONSTEXPR __GLIBCXX_TYPE_INT_N_0 + abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } +#endif +#if defined(__GLIBCXX_TYPE_INT_N_1) + inline _GLIBCXX_CONSTEXPR __GLIBCXX_TYPE_INT_N_1 + abs(__GLIBCXX_TYPE_INT_N_1 __x) { return __x >= 0 ? __x : -__x; } +#endif +#if defined(__GLIBCXX_TYPE_INT_N_2) + inline _GLIBCXX_CONSTEXPR __GLIBCXX_TYPE_INT_N_2 + abs(__GLIBCXX_TYPE_INT_N_2 __x) { return __x >= 0 ? __x : -__x; } +#endif +#if defined(__GLIBCXX_TYPE_INT_N_3) + inline _GLIBCXX_CONSTEXPR __GLIBCXX_TYPE_INT_N_3 + abs(__GLIBCXX_TYPE_INT_N_3 __x) { return __x >= 0 ? __x : -__x; } +#endif + +#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128) + inline _GLIBCXX_CONSTEXPR + __float128 + abs(__float128 __x) + { return __x < 0 ? -__x : __x; } +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace +} + +#endif // _GLIBCXX_BITS_STD_ABS_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/std_function.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/std_function.h new file mode 100644 index 0000000..657b1c0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/std_function.h @@ -0,0 +1,811 @@ +// Implementation of std::function -*- C++ -*- + +// Copyright (C) 2004-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file include/bits/function.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{functional} + */ + +#ifndef _GLIBCXX_STD_FUNCTION_H +#define _GLIBCXX_STD_FUNCTION_H 1 + +#pragma GCC system_header + +#if __cplusplus < 201103L +# include +#else + +#if __cpp_rtti +# include +#endif +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * Derives from @c unary_function or @c binary_function, or perhaps + * nothing, depending on the number of arguments provided. The + * primary template is the basis case, which derives nothing. + */ + template + struct _Maybe_unary_or_binary_function { }; + + /// Derives from @c unary_function, as appropriate. + template + struct _Maybe_unary_or_binary_function<_Res, _T1> + : std::unary_function<_T1, _Res> { }; + + /// Derives from @c binary_function, as appropriate. + template + struct _Maybe_unary_or_binary_function<_Res, _T1, _T2> + : std::binary_function<_T1, _T2, _Res> { }; + + + /** + * @brief Exception class thrown when class template function's + * operator() is called with an empty target. + * @ingroup exceptions + */ + class bad_function_call : public std::exception + { + public: + virtual ~bad_function_call() noexcept; + + const char* what() const noexcept; + }; + + /** + * Trait identifying "location-invariant" types, meaning that the + * address of the object (or any of its members) will not escape. + * Trivially copyable types are location-invariant and users can + * specialize this trait for other types. + */ + template + struct __is_location_invariant + : is_trivially_copyable<_Tp>::type + { }; + + class _Undefined_class; + + union _Nocopy_types + { + void* _M_object; + const void* _M_const_object; + void (*_M_function_pointer)(); + void (_Undefined_class::*_M_member_pointer)(); + }; + + union [[gnu::may_alias]] _Any_data + { + void* _M_access() { return &_M_pod_data[0]; } + const void* _M_access() const { return &_M_pod_data[0]; } + + template + _Tp& + _M_access() + { return *static_cast<_Tp*>(_M_access()); } + + template + const _Tp& + _M_access() const + { return *static_cast(_M_access()); } + + _Nocopy_types _M_unused; + char _M_pod_data[sizeof(_Nocopy_types)]; + }; + + enum _Manager_operation + { + __get_type_info, + __get_functor_ptr, + __clone_functor, + __destroy_functor + }; + + // Simple type wrapper that helps avoid annoying const problems + // when casting between void pointers and pointers-to-pointers. + template + struct _Simple_type_wrapper + { + _Simple_type_wrapper(_Tp __value) : __value(__value) { } + + _Tp __value; + }; + + template + struct __is_location_invariant<_Simple_type_wrapper<_Tp> > + : __is_location_invariant<_Tp> + { }; + + template + class function; + + /// Base class of all polymorphic function object wrappers. + class _Function_base + { + public: + static const std::size_t _M_max_size = sizeof(_Nocopy_types); + static const std::size_t _M_max_align = __alignof__(_Nocopy_types); + + template + class _Base_manager + { + protected: + static const bool __stored_locally = + (__is_location_invariant<_Functor>::value + && sizeof(_Functor) <= _M_max_size + && __alignof__(_Functor) <= _M_max_align + && (_M_max_align % __alignof__(_Functor) == 0)); + + typedef integral_constant _Local_storage; + + // Retrieve a pointer to the function object + static _Functor* + _M_get_pointer(const _Any_data& __source) + { + const _Functor* __ptr = + __stored_locally? std::__addressof(__source._M_access<_Functor>()) + /* have stored a pointer */ : __source._M_access<_Functor*>(); + return const_cast<_Functor*>(__ptr); + } + + // Clone a location-invariant function object that fits within + // an _Any_data structure. + static void + _M_clone(_Any_data& __dest, const _Any_data& __source, true_type) + { + ::new (__dest._M_access()) _Functor(__source._M_access<_Functor>()); + } + + // Clone a function object that is not location-invariant or + // that cannot fit into an _Any_data structure. + static void + _M_clone(_Any_data& __dest, const _Any_data& __source, false_type) + { + __dest._M_access<_Functor*>() = + new _Functor(*__source._M_access<_Functor*>()); + } + + // Destroying a location-invariant object may still require + // destruction. + static void + _M_destroy(_Any_data& __victim, true_type) + { + __victim._M_access<_Functor>().~_Functor(); + } + + // Destroying an object located on the heap. + static void + _M_destroy(_Any_data& __victim, false_type) + { + delete __victim._M_access<_Functor*>(); + } + + public: + static bool + _M_manager(_Any_data& __dest, const _Any_data& __source, + _Manager_operation __op) + { + switch (__op) + { +#if __cpp_rtti + case __get_type_info: + __dest._M_access() = &typeid(_Functor); + break; +#endif + case __get_functor_ptr: + __dest._M_access<_Functor*>() = _M_get_pointer(__source); + break; + + case __clone_functor: + _M_clone(__dest, __source, _Local_storage()); + break; + + case __destroy_functor: + _M_destroy(__dest, _Local_storage()); + break; + } + return false; + } + + static void + _M_init_functor(_Any_data& __functor, _Functor&& __f) + { _M_init_functor(__functor, std::move(__f), _Local_storage()); } + + template + static bool + _M_not_empty_function(const function<_Signature>& __f) + { return static_cast(__f); } + + template + static bool + _M_not_empty_function(_Tp* __fp) + { return __fp != nullptr; } + + template + static bool + _M_not_empty_function(_Tp _Class::* __mp) + { return __mp != nullptr; } + + template + static bool + _M_not_empty_function(const _Tp&) + { return true; } + + private: + static void + _M_init_functor(_Any_data& __functor, _Functor&& __f, true_type) + { ::new (__functor._M_access()) _Functor(std::move(__f)); } + + static void + _M_init_functor(_Any_data& __functor, _Functor&& __f, false_type) + { __functor._M_access<_Functor*>() = new _Functor(std::move(__f)); } + }; + + _Function_base() : _M_manager(nullptr) { } + + ~_Function_base() + { + if (_M_manager) + _M_manager(_M_functor, _M_functor, __destroy_functor); + } + + bool _M_empty() const { return !_M_manager; } + + typedef bool (*_Manager_type)(_Any_data&, const _Any_data&, + _Manager_operation); + + _Any_data _M_functor; + _Manager_type _M_manager; + }; + + template + class _Function_handler; + + template + class _Function_handler<_Res(_ArgTypes...), _Functor> + : public _Function_base::_Base_manager<_Functor> + { + typedef _Function_base::_Base_manager<_Functor> _Base; + + public: + static _Res + _M_invoke(const _Any_data& __functor, _ArgTypes&&... __args) + { + return (*_Base::_M_get_pointer(__functor))( + std::forward<_ArgTypes>(__args)...); + } + }; + + template + class _Function_handler + : public _Function_base::_Base_manager<_Functor> + { + typedef _Function_base::_Base_manager<_Functor> _Base; + + public: + static void + _M_invoke(const _Any_data& __functor, _ArgTypes&&... __args) + { + (*_Base::_M_get_pointer(__functor))( + std::forward<_ArgTypes>(__args)...); + } + }; + + template + class _Function_handler<_Res(_ArgTypes...), _Member _Class::*> + : public _Function_handler + { + typedef _Function_handler + _Base; + + public: + static _Res + _M_invoke(const _Any_data& __functor, _ArgTypes&&... __args) + { + return std::__invoke(_Base::_M_get_pointer(__functor)->__value, + std::forward<_ArgTypes>(__args)...); + } + }; + + template + class _Function_handler + : public _Function_base::_Base_manager< + _Simple_type_wrapper< _Member _Class::* > > + { + typedef _Member _Class::* _Functor; + typedef _Simple_type_wrapper<_Functor> _Wrapper; + typedef _Function_base::_Base_manager<_Wrapper> _Base; + + public: + static bool + _M_manager(_Any_data& __dest, const _Any_data& __source, + _Manager_operation __op) + { + switch (__op) + { +#if __cpp_rtti + case __get_type_info: + __dest._M_access() = &typeid(_Functor); + break; +#endif + case __get_functor_ptr: + __dest._M_access<_Functor*>() = + &_Base::_M_get_pointer(__source)->__value; + break; + + default: + _Base::_M_manager(__dest, __source, __op); + } + return false; + } + + static void + _M_invoke(const _Any_data& __functor, _ArgTypes&&... __args) + { + std::__invoke(_Base::_M_get_pointer(__functor)->__value, + std::forward<_ArgTypes>(__args)...); + } + }; + + template + using __check_func_return_type + = __or_, is_same<_From, _To>, is_convertible<_From, _To>>; + + /** + * @brief Primary class template for std::function. + * @ingroup functors + * + * Polymorphic function wrapper. + */ + template + class function<_Res(_ArgTypes...)> + : public _Maybe_unary_or_binary_function<_Res, _ArgTypes...>, + private _Function_base + { + template::type> + struct _Callable : __check_func_return_type<_Res2, _Res> { }; + + // Used so the return type convertibility checks aren't done when + // performing overload resolution for copy construction/assignment. + template + struct _Callable : false_type { }; + + template + using _Requires = typename enable_if<_Cond::value, _Tp>::type; + + public: + typedef _Res result_type; + + // [3.7.2.1] construct/copy/destroy + + /** + * @brief Default construct creates an empty function call wrapper. + * @post @c !(bool)*this + */ + function() noexcept + : _Function_base() { } + + /** + * @brief Creates an empty function call wrapper. + * @post @c !(bool)*this + */ + function(nullptr_t) noexcept + : _Function_base() { } + + /** + * @brief %Function copy constructor. + * @param __x A %function object with identical call signature. + * @post @c bool(*this) == bool(__x) + * + * The newly-created %function contains a copy of the target of @a + * __x (if it has one). + */ + function(const function& __x); + + /** + * @brief %Function move constructor. + * @param __x A %function object rvalue with identical call signature. + * + * The newly-created %function contains the target of @a __x + * (if it has one). + */ + function(function&& __x) noexcept : _Function_base() + { + __x.swap(*this); + } + + /** + * @brief Builds a %function that targets a copy of the incoming + * function object. + * @param __f A %function object that is callable with parameters of + * type @c T1, @c T2, ..., @c TN and returns a value convertible + * to @c Res. + * + * The newly-created %function object will target a copy of + * @a __f. If @a __f is @c reference_wrapper, then this function + * object will contain a reference to the function object @c + * __f.get(). If @a __f is a NULL function pointer or NULL + * pointer-to-member, the newly-created object will be empty. + * + * If @a __f is a non-NULL function pointer or an object of type @c + * reference_wrapper, this function will not throw. + */ + template>, void>, + typename = _Requires<_Callable<_Functor>, void>> + function(_Functor); + + /** + * @brief %Function assignment operator. + * @param __x A %function with identical call signature. + * @post @c (bool)*this == (bool)x + * @returns @c *this + * + * The target of @a __x is copied to @c *this. If @a __x has no + * target, then @c *this will be empty. + * + * If @a __x targets a function pointer or a reference to a function + * object, then this operation will not throw an %exception. + */ + function& + operator=(const function& __x) + { + function(__x).swap(*this); + return *this; + } + + /** + * @brief %Function move-assignment operator. + * @param __x A %function rvalue with identical call signature. + * @returns @c *this + * + * The target of @a __x is moved to @c *this. If @a __x has no + * target, then @c *this will be empty. + * + * If @a __x targets a function pointer or a reference to a function + * object, then this operation will not throw an %exception. + */ + function& + operator=(function&& __x) noexcept + { + function(std::move(__x)).swap(*this); + return *this; + } + + /** + * @brief %Function assignment to zero. + * @post @c !(bool)*this + * @returns @c *this + * + * The target of @c *this is deallocated, leaving it empty. + */ + function& + operator=(nullptr_t) noexcept + { + if (_M_manager) + { + _M_manager(_M_functor, _M_functor, __destroy_functor); + _M_manager = nullptr; + _M_invoker = nullptr; + } + return *this; + } + + /** + * @brief %Function assignment to a new target. + * @param __f A %function object that is callable with parameters of + * type @c T1, @c T2, ..., @c TN and returns a value convertible + * to @c Res. + * @return @c *this + * + * This %function object wrapper will target a copy of @a + * __f. If @a __f is @c reference_wrapper, then this function + * object will contain a reference to the function object @c + * __f.get(). If @a __f is a NULL function pointer or NULL + * pointer-to-member, @c this object will be empty. + * + * If @a __f is a non-NULL function pointer or an object of type @c + * reference_wrapper, this function will not throw. + */ + template + _Requires<_Callable::type>, function&> + operator=(_Functor&& __f) + { + function(std::forward<_Functor>(__f)).swap(*this); + return *this; + } + + /// @overload + template + function& + operator=(reference_wrapper<_Functor> __f) noexcept + { + function(__f).swap(*this); + return *this; + } + + // [3.7.2.2] function modifiers + + /** + * @brief Swap the targets of two %function objects. + * @param __x A %function with identical call signature. + * + * Swap the targets of @c this function object and @a __f. This + * function will not throw an %exception. + */ + void swap(function& __x) noexcept + { + std::swap(_M_functor, __x._M_functor); + std::swap(_M_manager, __x._M_manager); + std::swap(_M_invoker, __x._M_invoker); + } + + // [3.7.2.3] function capacity + + /** + * @brief Determine if the %function wrapper has a target. + * + * @return @c true when this %function object contains a target, + * or @c false when it is empty. + * + * This function will not throw an %exception. + */ + explicit operator bool() const noexcept + { return !_M_empty(); } + + // [3.7.2.4] function invocation + + /** + * @brief Invokes the function targeted by @c *this. + * @returns the result of the target. + * @throws bad_function_call when @c !(bool)*this + * + * The function call operator invokes the target function object + * stored by @c this. + */ + _Res operator()(_ArgTypes... __args) const; + +#if __cpp_rtti + // [3.7.2.5] function target access + /** + * @brief Determine the type of the target of this function object + * wrapper. + * + * @returns the type identifier of the target function object, or + * @c typeid(void) if @c !(bool)*this. + * + * This function will not throw an %exception. + */ + const type_info& target_type() const noexcept; + + /** + * @brief Access the stored target function object. + * + * @return Returns a pointer to the stored target function object, + * if @c typeid(_Functor).equals(target_type()); otherwise, a NULL + * pointer. + * + * This function does not throw exceptions. + * + * @{ + */ + template _Functor* target() noexcept; + + template const _Functor* target() const noexcept; + // @} +#endif + + private: + using _Invoker_type = _Res (*)(const _Any_data&, _ArgTypes&&...); + _Invoker_type _M_invoker; + }; + +#if __cpp_deduction_guides >= 201606 + template + struct __function_guide_helper + { }; + + template + struct __function_guide_helper< + _Res (_Tp::*) (_Args...) noexcept(_Nx) + > + { using type = _Res(_Args...); }; + + template + struct __function_guide_helper< + _Res (_Tp::*) (_Args...) & noexcept(_Nx) + > + { using type = _Res(_Args...); }; + + template + struct __function_guide_helper< + _Res (_Tp::*) (_Args...) const noexcept(_Nx) + > + { using type = _Res(_Args...); }; + + template + struct __function_guide_helper< + _Res (_Tp::*) (_Args...) const & noexcept(_Nx) + > + { using type = _Res(_Args...); }; + + template + function(_Res(*)(_ArgTypes...)) -> function<_Res(_ArgTypes...)>; + + template::type> + function(_Functor) -> function<_Signature>; +#endif + + // Out-of-line member definitions. + template + function<_Res(_ArgTypes...)>:: + function(const function& __x) + : _Function_base() + { + if (static_cast(__x)) + { + __x._M_manager(_M_functor, __x._M_functor, __clone_functor); + _M_invoker = __x._M_invoker; + _M_manager = __x._M_manager; + } + } + + template + template + function<_Res(_ArgTypes...)>:: + function(_Functor __f) + : _Function_base() + { + typedef _Function_handler<_Res(_ArgTypes...), _Functor> _My_handler; + + if (_My_handler::_M_not_empty_function(__f)) + { + _My_handler::_M_init_functor(_M_functor, std::move(__f)); + _M_invoker = &_My_handler::_M_invoke; + _M_manager = &_My_handler::_M_manager; + } + } + + template + _Res + function<_Res(_ArgTypes...)>:: + operator()(_ArgTypes... __args) const + { + if (_M_empty()) + __throw_bad_function_call(); + return _M_invoker(_M_functor, std::forward<_ArgTypes>(__args)...); + } + +#if __cpp_rtti + template + const type_info& + function<_Res(_ArgTypes...)>:: + target_type() const noexcept + { + if (_M_manager) + { + _Any_data __typeinfo_result; + _M_manager(__typeinfo_result, _M_functor, __get_type_info); + return *__typeinfo_result._M_access(); + } + else + return typeid(void); + } + + template + template + _Functor* + function<_Res(_ArgTypes...)>:: + target() noexcept + { + const function* __const_this = this; + const _Functor* __func = __const_this->template target<_Functor>(); + return const_cast<_Functor*>(__func); + } + + template + template + const _Functor* + function<_Res(_ArgTypes...)>:: + target() const noexcept + { + if (typeid(_Functor) == target_type() && _M_manager) + { + _Any_data __ptr; + _M_manager(__ptr, _M_functor, __get_functor_ptr); + return __ptr._M_access(); + } + else + return nullptr; + } +#endif + + // [20.7.15.2.6] null pointer comparisons + + /** + * @brief Compares a polymorphic function object wrapper against 0 + * (the NULL pointer). + * @returns @c true if the wrapper has no target, @c false otherwise + * + * This function will not throw an %exception. + */ + template + inline bool + operator==(const function<_Res(_Args...)>& __f, nullptr_t) noexcept + { return !static_cast(__f); } + + /// @overload + template + inline bool + operator==(nullptr_t, const function<_Res(_Args...)>& __f) noexcept + { return !static_cast(__f); } + + /** + * @brief Compares a polymorphic function object wrapper against 0 + * (the NULL pointer). + * @returns @c false if the wrapper has no target, @c true otherwise + * + * This function will not throw an %exception. + */ + template + inline bool + operator!=(const function<_Res(_Args...)>& __f, nullptr_t) noexcept + { return static_cast(__f); } + + /// @overload + template + inline bool + operator!=(nullptr_t, const function<_Res(_Args...)>& __f) noexcept + { return static_cast(__f); } + + + // [20.7.15.2.7] specialized algorithms + + /** + * @brief Swap the targets of two polymorphic function object wrappers. + * + * This function will not throw an %exception. + */ + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2062. Effect contradictions w/o no-throw guarantee of std::function swaps + template + inline void + swap(function<_Res(_Args...)>& __x, function<_Res(_Args...)>& __y) noexcept + { __x.swap(__y); } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // C++11 + +#endif // _GLIBCXX_STD_FUNCTION_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/std_mutex.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/std_mutex.h new file mode 100644 index 0000000..17d55f5 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/std_mutex.h @@ -0,0 +1,373 @@ +// std::mutex implementation -*- C++ -*- + +// Copyright (C) 2003-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/std_mutex.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{mutex} + */ + +#ifndef _GLIBCXX_MUTEX_H +#define _GLIBCXX_MUTEX_H 1 + +#pragma GCC system_header + +#if __cplusplus < 201103L +# include +#else + +#include +#include +#include +#include // for std::swap + +#ifdef _GLIBCXX_USE_C99_STDINT_TR1 + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @defgroup mutexes Mutexes + * @ingroup concurrency + * + * Classes for mutex support. + * @{ + */ + +#ifdef _GLIBCXX_HAS_GTHREADS + // Common base class for std::mutex and std::timed_mutex + class __mutex_base + { + protected: + typedef __gthread_mutex_t __native_type; + +#ifdef __GTHREAD_MUTEX_INIT + __native_type _M_mutex = __GTHREAD_MUTEX_INIT; + + constexpr __mutex_base() noexcept = default; +#else + __native_type _M_mutex; + + __mutex_base() noexcept + { + // XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may) + __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex); + } + + ~__mutex_base() noexcept { __gthread_mutex_destroy(&_M_mutex); } +#endif + + __mutex_base(const __mutex_base&) = delete; + __mutex_base& operator=(const __mutex_base&) = delete; + }; + + /// The standard mutex type. + class mutex : private __mutex_base + { + public: + typedef __native_type* native_handle_type; + +#ifdef __GTHREAD_MUTEX_INIT + constexpr +#endif + mutex() noexcept = default; + ~mutex() = default; + + mutex(const mutex&) = delete; + mutex& operator=(const mutex&) = delete; + + void + lock() + { + int __e = __gthread_mutex_lock(&_M_mutex); + + // EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may) + if (__e) + __throw_system_error(__e); + } + + bool + try_lock() noexcept + { + // XXX EINVAL, EAGAIN, EBUSY + return !__gthread_mutex_trylock(&_M_mutex); + } + + void + unlock() + { + // XXX EINVAL, EAGAIN, EPERM + __gthread_mutex_unlock(&_M_mutex); + } + + native_handle_type + native_handle() noexcept + { return &_M_mutex; } + }; + +#endif // _GLIBCXX_HAS_GTHREADS + + /// Do not acquire ownership of the mutex. + struct defer_lock_t { explicit defer_lock_t() = default; }; + + /// Try to acquire ownership of the mutex without blocking. + struct try_to_lock_t { explicit try_to_lock_t() = default; }; + + /// Assume the calling thread has already obtained mutex ownership + /// and manage it. + struct adopt_lock_t { explicit adopt_lock_t() = default; }; + + /// Tag used to prevent a scoped lock from acquiring ownership of a mutex. + _GLIBCXX17_INLINE constexpr defer_lock_t defer_lock { }; + + /// Tag used to prevent a scoped lock from blocking if a mutex is locked. + _GLIBCXX17_INLINE constexpr try_to_lock_t try_to_lock { }; + + /// Tag used to make a scoped lock take ownership of a locked mutex. + _GLIBCXX17_INLINE constexpr adopt_lock_t adopt_lock { }; + + /** @brief A simple scoped lock type. + * + * A lock_guard controls mutex ownership within a scope, releasing + * ownership in the destructor. + */ + template + class lock_guard + { + public: + typedef _Mutex mutex_type; + + explicit lock_guard(mutex_type& __m) : _M_device(__m) + { _M_device.lock(); } + + lock_guard(mutex_type& __m, adopt_lock_t) noexcept : _M_device(__m) + { } // calling thread owns mutex + + ~lock_guard() + { _M_device.unlock(); } + + lock_guard(const lock_guard&) = delete; + lock_guard& operator=(const lock_guard&) = delete; + + private: + mutex_type& _M_device; + }; + + /** @brief A movable scoped lock type. + * + * A unique_lock controls mutex ownership within a scope. Ownership of the + * mutex can be delayed until after construction and can be transferred + * to another unique_lock by move construction or move assignment. If a + * mutex lock is owned when the destructor runs ownership will be released. + */ + template + class unique_lock + { + public: + typedef _Mutex mutex_type; + + unique_lock() noexcept + : _M_device(0), _M_owns(false) + { } + + explicit unique_lock(mutex_type& __m) + : _M_device(std::__addressof(__m)), _M_owns(false) + { + lock(); + _M_owns = true; + } + + unique_lock(mutex_type& __m, defer_lock_t) noexcept + : _M_device(std::__addressof(__m)), _M_owns(false) + { } + + unique_lock(mutex_type& __m, try_to_lock_t) + : _M_device(std::__addressof(__m)), _M_owns(_M_device->try_lock()) + { } + + unique_lock(mutex_type& __m, adopt_lock_t) noexcept + : _M_device(std::__addressof(__m)), _M_owns(true) + { + // XXX calling thread owns mutex + } + + template + unique_lock(mutex_type& __m, + const chrono::time_point<_Clock, _Duration>& __atime) + : _M_device(std::__addressof(__m)), + _M_owns(_M_device->try_lock_until(__atime)) + { } + + template + unique_lock(mutex_type& __m, + const chrono::duration<_Rep, _Period>& __rtime) + : _M_device(std::__addressof(__m)), + _M_owns(_M_device->try_lock_for(__rtime)) + { } + + ~unique_lock() + { + if (_M_owns) + unlock(); + } + + unique_lock(const unique_lock&) = delete; + unique_lock& operator=(const unique_lock&) = delete; + + unique_lock(unique_lock&& __u) noexcept + : _M_device(__u._M_device), _M_owns(__u._M_owns) + { + __u._M_device = 0; + __u._M_owns = false; + } + + unique_lock& operator=(unique_lock&& __u) noexcept + { + if(_M_owns) + unlock(); + + unique_lock(std::move(__u)).swap(*this); + + __u._M_device = 0; + __u._M_owns = false; + + return *this; + } + + void + lock() + { + if (!_M_device) + __throw_system_error(int(errc::operation_not_permitted)); + else if (_M_owns) + __throw_system_error(int(errc::resource_deadlock_would_occur)); + else + { + _M_device->lock(); + _M_owns = true; + } + } + + bool + try_lock() + { + if (!_M_device) + __throw_system_error(int(errc::operation_not_permitted)); + else if (_M_owns) + __throw_system_error(int(errc::resource_deadlock_would_occur)); + else + { + _M_owns = _M_device->try_lock(); + return _M_owns; + } + } + + template + bool + try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime) + { + if (!_M_device) + __throw_system_error(int(errc::operation_not_permitted)); + else if (_M_owns) + __throw_system_error(int(errc::resource_deadlock_would_occur)); + else + { + _M_owns = _M_device->try_lock_until(__atime); + return _M_owns; + } + } + + template + bool + try_lock_for(const chrono::duration<_Rep, _Period>& __rtime) + { + if (!_M_device) + __throw_system_error(int(errc::operation_not_permitted)); + else if (_M_owns) + __throw_system_error(int(errc::resource_deadlock_would_occur)); + else + { + _M_owns = _M_device->try_lock_for(__rtime); + return _M_owns; + } + } + + void + unlock() + { + if (!_M_owns) + __throw_system_error(int(errc::operation_not_permitted)); + else if (_M_device) + { + _M_device->unlock(); + _M_owns = false; + } + } + + void + swap(unique_lock& __u) noexcept + { + std::swap(_M_device, __u._M_device); + std::swap(_M_owns, __u._M_owns); + } + + mutex_type* + release() noexcept + { + mutex_type* __ret = _M_device; + _M_device = 0; + _M_owns = false; + return __ret; + } + + bool + owns_lock() const noexcept + { return _M_owns; } + + explicit operator bool() const noexcept + { return owns_lock(); } + + mutex_type* + mutex() const noexcept + { return _M_device; } + + private: + mutex_type* _M_device; + bool _M_owns; // XXX use atomic_bool + }; + + /// Swap overload for unique_lock objects. + template + inline void + swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) noexcept + { __x.swap(__y); } + + // @} group mutexes +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace +#endif // _GLIBCXX_USE_C99_STDINT_TR1 + +#endif // C++11 + +#endif // _GLIBCXX_MUTEX_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_algo.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_algo.h new file mode 100644 index 0000000..97370ed --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_algo.h @@ -0,0 +1,5836 @@ +// Algorithm implementation -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_algo.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{algorithm} + */ + +#ifndef _STL_ALGO_H +#define _STL_ALGO_H 1 + +#include // for rand +#include +#include +#include // for _Temporary_buffer +#include + +#if __cplusplus >= 201103L +#include +#endif + +// See concept_check.h for the __glibcxx_*_requires macros. + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /// Swaps the median value of *__a, *__b and *__c under __comp to *__result + template + void + __move_median_to_first(_Iterator __result,_Iterator __a, _Iterator __b, + _Iterator __c, _Compare __comp) + { + if (__comp(__a, __b)) + { + if (__comp(__b, __c)) + std::iter_swap(__result, __b); + else if (__comp(__a, __c)) + std::iter_swap(__result, __c); + else + std::iter_swap(__result, __a); + } + else if (__comp(__a, __c)) + std::iter_swap(__result, __a); + else if (__comp(__b, __c)) + std::iter_swap(__result, __c); + else + std::iter_swap(__result, __b); + } + + /// This is an overload used by find algos for the Input Iterator case. + template + inline _InputIterator + __find_if(_InputIterator __first, _InputIterator __last, + _Predicate __pred, input_iterator_tag) + { + while (__first != __last && !__pred(__first)) + ++__first; + return __first; + } + + /// This is an overload used by find algos for the RAI case. + template + _RandomAccessIterator + __find_if(_RandomAccessIterator __first, _RandomAccessIterator __last, + _Predicate __pred, random_access_iterator_tag) + { + typename iterator_traits<_RandomAccessIterator>::difference_type + __trip_count = (__last - __first) >> 2; + + for (; __trip_count > 0; --__trip_count) + { + if (__pred(__first)) + return __first; + ++__first; + + if (__pred(__first)) + return __first; + ++__first; + + if (__pred(__first)) + return __first; + ++__first; + + if (__pred(__first)) + return __first; + ++__first; + } + + switch (__last - __first) + { + case 3: + if (__pred(__first)) + return __first; + ++__first; + case 2: + if (__pred(__first)) + return __first; + ++__first; + case 1: + if (__pred(__first)) + return __first; + ++__first; + case 0: + default: + return __last; + } + } + + template + inline _Iterator + __find_if(_Iterator __first, _Iterator __last, _Predicate __pred) + { + return __find_if(__first, __last, __pred, + std::__iterator_category(__first)); + } + + /// Provided for stable_partition to use. + template + inline _InputIterator + __find_if_not(_InputIterator __first, _InputIterator __last, + _Predicate __pred) + { + return std::__find_if(__first, __last, + __gnu_cxx::__ops::__negate(__pred), + std::__iterator_category(__first)); + } + + /// Like find_if_not(), but uses and updates a count of the + /// remaining range length instead of comparing against an end + /// iterator. + template + _InputIterator + __find_if_not_n(_InputIterator __first, _Distance& __len, _Predicate __pred) + { + for (; __len; --__len, ++__first) + if (!__pred(__first)) + break; + return __first; + } + + // set_difference + // set_intersection + // set_symmetric_difference + // set_union + // for_each + // find + // find_if + // find_first_of + // adjacent_find + // count + // count_if + // search + + template + _ForwardIterator1 + __search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _ForwardIterator2 __last2, + _BinaryPredicate __predicate) + { + // Test for empty ranges + if (__first1 == __last1 || __first2 == __last2) + return __first1; + + // Test for a pattern of length 1. + _ForwardIterator2 __p1(__first2); + if (++__p1 == __last2) + return std::__find_if(__first1, __last1, + __gnu_cxx::__ops::__iter_comp_iter(__predicate, __first2)); + + // General case. + _ForwardIterator2 __p; + _ForwardIterator1 __current = __first1; + + for (;;) + { + __first1 = + std::__find_if(__first1, __last1, + __gnu_cxx::__ops::__iter_comp_iter(__predicate, __first2)); + + if (__first1 == __last1) + return __last1; + + __p = __p1; + __current = __first1; + if (++__current == __last1) + return __last1; + + while (__predicate(__current, __p)) + { + if (++__p == __last2) + return __first1; + if (++__current == __last1) + return __last1; + } + ++__first1; + } + return __first1; + } + + // search_n + + /** + * This is an helper function for search_n overloaded for forward iterators. + */ + template + _ForwardIterator + __search_n_aux(_ForwardIterator __first, _ForwardIterator __last, + _Integer __count, _UnaryPredicate __unary_pred, + std::forward_iterator_tag) + { + __first = std::__find_if(__first, __last, __unary_pred); + while (__first != __last) + { + typename iterator_traits<_ForwardIterator>::difference_type + __n = __count; + _ForwardIterator __i = __first; + ++__i; + while (__i != __last && __n != 1 && __unary_pred(__i)) + { + ++__i; + --__n; + } + if (__n == 1) + return __first; + if (__i == __last) + return __last; + __first = std::__find_if(++__i, __last, __unary_pred); + } + return __last; + } + + /** + * This is an helper function for search_n overloaded for random access + * iterators. + */ + template + _RandomAccessIter + __search_n_aux(_RandomAccessIter __first, _RandomAccessIter __last, + _Integer __count, _UnaryPredicate __unary_pred, + std::random_access_iterator_tag) + { + typedef typename std::iterator_traits<_RandomAccessIter>::difference_type + _DistanceType; + + _DistanceType __tailSize = __last - __first; + _DistanceType __remainder = __count; + + while (__remainder <= __tailSize) // the main loop... + { + __first += __remainder; + __tailSize -= __remainder; + // __first here is always pointing to one past the last element of + // next possible match. + _RandomAccessIter __backTrack = __first; + while (__unary_pred(--__backTrack)) + { + if (--__remainder == 0) + return (__first - __count); // Success + } + __remainder = __count + 1 - (__first - __backTrack); + } + return __last; // Failure + } + + template + _ForwardIterator + __search_n(_ForwardIterator __first, _ForwardIterator __last, + _Integer __count, + _UnaryPredicate __unary_pred) + { + if (__count <= 0) + return __first; + + if (__count == 1) + return std::__find_if(__first, __last, __unary_pred); + + return std::__search_n_aux(__first, __last, __count, __unary_pred, + std::__iterator_category(__first)); + } + + // find_end for forward iterators. + template + _ForwardIterator1 + __find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _ForwardIterator2 __last2, + forward_iterator_tag, forward_iterator_tag, + _BinaryPredicate __comp) + { + if (__first2 == __last2) + return __last1; + + _ForwardIterator1 __result = __last1; + while (1) + { + _ForwardIterator1 __new_result + = std::__search(__first1, __last1, __first2, __last2, __comp); + if (__new_result == __last1) + return __result; + else + { + __result = __new_result; + __first1 = __new_result; + ++__first1; + } + } + } + + // find_end for bidirectional iterators (much faster). + template + _BidirectionalIterator1 + __find_end(_BidirectionalIterator1 __first1, + _BidirectionalIterator1 __last1, + _BidirectionalIterator2 __first2, + _BidirectionalIterator2 __last2, + bidirectional_iterator_tag, bidirectional_iterator_tag, + _BinaryPredicate __comp) + { + // concept requirements + __glibcxx_function_requires(_BidirectionalIteratorConcept< + _BidirectionalIterator1>) + __glibcxx_function_requires(_BidirectionalIteratorConcept< + _BidirectionalIterator2>) + + typedef reverse_iterator<_BidirectionalIterator1> _RevIterator1; + typedef reverse_iterator<_BidirectionalIterator2> _RevIterator2; + + _RevIterator1 __rlast1(__first1); + _RevIterator2 __rlast2(__first2); + _RevIterator1 __rresult = std::__search(_RevIterator1(__last1), __rlast1, + _RevIterator2(__last2), __rlast2, + __comp); + + if (__rresult == __rlast1) + return __last1; + else + { + _BidirectionalIterator1 __result = __rresult.base(); + std::advance(__result, -std::distance(__first2, __last2)); + return __result; + } + } + + /** + * @brief Find last matching subsequence in a sequence. + * @ingroup non_mutating_algorithms + * @param __first1 Start of range to search. + * @param __last1 End of range to search. + * @param __first2 Start of sequence to match. + * @param __last2 End of sequence to match. + * @return The last iterator @c i in the range + * @p [__first1,__last1-(__last2-__first2)) such that @c *(i+N) == + * @p *(__first2+N) for each @c N in the range @p + * [0,__last2-__first2), or @p __last1 if no such iterator exists. + * + * Searches the range @p [__first1,__last1) for a sub-sequence that + * compares equal value-by-value with the sequence given by @p + * [__first2,__last2) and returns an iterator to the __first + * element of the sub-sequence, or @p __last1 if the sub-sequence + * is not found. The sub-sequence will be the last such + * subsequence contained in [__first1,__last1). + * + * Because the sub-sequence must lie completely within the range @p + * [__first1,__last1) it must start at a position less than @p + * __last1-(__last2-__first2) where @p __last2-__first2 is the + * length of the sub-sequence. This means that the returned + * iterator @c i will be in the range @p + * [__first1,__last1-(__last2-__first2)) + */ + template + inline _ForwardIterator1 + find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _ForwardIterator2 __last2) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) + __glibcxx_function_requires(_EqualOpConcept< + typename iterator_traits<_ForwardIterator1>::value_type, + typename iterator_traits<_ForwardIterator2>::value_type>) + __glibcxx_requires_valid_range(__first1, __last1); + __glibcxx_requires_valid_range(__first2, __last2); + + return std::__find_end(__first1, __last1, __first2, __last2, + std::__iterator_category(__first1), + std::__iterator_category(__first2), + __gnu_cxx::__ops::__iter_equal_to_iter()); + } + + /** + * @brief Find last matching subsequence in a sequence using a predicate. + * @ingroup non_mutating_algorithms + * @param __first1 Start of range to search. + * @param __last1 End of range to search. + * @param __first2 Start of sequence to match. + * @param __last2 End of sequence to match. + * @param __comp The predicate to use. + * @return The last iterator @c i in the range @p + * [__first1,__last1-(__last2-__first2)) such that @c + * predicate(*(i+N), @p (__first2+N)) is true for each @c N in the + * range @p [0,__last2-__first2), or @p __last1 if no such iterator + * exists. + * + * Searches the range @p [__first1,__last1) for a sub-sequence that + * compares equal value-by-value with the sequence given by @p + * [__first2,__last2) using comp as a predicate and returns an + * iterator to the first element of the sub-sequence, or @p __last1 + * if the sub-sequence is not found. The sub-sequence will be the + * last such subsequence contained in [__first,__last1). + * + * Because the sub-sequence must lie completely within the range @p + * [__first1,__last1) it must start at a position less than @p + * __last1-(__last2-__first2) where @p __last2-__first2 is the + * length of the sub-sequence. This means that the returned + * iterator @c i will be in the range @p + * [__first1,__last1-(__last2-__first2)) + */ + template + inline _ForwardIterator1 + find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _ForwardIterator2 __last2, + _BinaryPredicate __comp) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) + __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, + typename iterator_traits<_ForwardIterator1>::value_type, + typename iterator_traits<_ForwardIterator2>::value_type>) + __glibcxx_requires_valid_range(__first1, __last1); + __glibcxx_requires_valid_range(__first2, __last2); + + return std::__find_end(__first1, __last1, __first2, __last2, + std::__iterator_category(__first1), + std::__iterator_category(__first2), + __gnu_cxx::__ops::__iter_comp_iter(__comp)); + } + +#if __cplusplus >= 201103L + /** + * @brief Checks that a predicate is true for all the elements + * of a sequence. + * @ingroup non_mutating_algorithms + * @param __first An input iterator. + * @param __last An input iterator. + * @param __pred A predicate. + * @return True if the check is true, false otherwise. + * + * Returns true if @p __pred is true for each element in the range + * @p [__first,__last), and false otherwise. + */ + template + inline bool + all_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) + { return __last == std::find_if_not(__first, __last, __pred); } + + /** + * @brief Checks that a predicate is false for all the elements + * of a sequence. + * @ingroup non_mutating_algorithms + * @param __first An input iterator. + * @param __last An input iterator. + * @param __pred A predicate. + * @return True if the check is true, false otherwise. + * + * Returns true if @p __pred is false for each element in the range + * @p [__first,__last), and false otherwise. + */ + template + inline bool + none_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) + { return __last == _GLIBCXX_STD_A::find_if(__first, __last, __pred); } + + /** + * @brief Checks that a predicate is false for at least an element + * of a sequence. + * @ingroup non_mutating_algorithms + * @param __first An input iterator. + * @param __last An input iterator. + * @param __pred A predicate. + * @return True if the check is true, false otherwise. + * + * Returns true if an element exists in the range @p + * [__first,__last) such that @p __pred is true, and false + * otherwise. + */ + template + inline bool + any_of(_InputIterator __first, _InputIterator __last, _Predicate __pred) + { return !std::none_of(__first, __last, __pred); } + + /** + * @brief Find the first element in a sequence for which a + * predicate is false. + * @ingroup non_mutating_algorithms + * @param __first An input iterator. + * @param __last An input iterator. + * @param __pred A predicate. + * @return The first iterator @c i in the range @p [__first,__last) + * such that @p __pred(*i) is false, or @p __last if no such iterator exists. + */ + template + inline _InputIterator + find_if_not(_InputIterator __first, _InputIterator __last, + _Predicate __pred) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, + typename iterator_traits<_InputIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + return std::__find_if_not(__first, __last, + __gnu_cxx::__ops::__pred_iter(__pred)); + } + + /** + * @brief Checks whether the sequence is partitioned. + * @ingroup mutating_algorithms + * @param __first An input iterator. + * @param __last An input iterator. + * @param __pred A predicate. + * @return True if the range @p [__first,__last) is partioned by @p __pred, + * i.e. if all elements that satisfy @p __pred appear before those that + * do not. + */ + template + inline bool + is_partitioned(_InputIterator __first, _InputIterator __last, + _Predicate __pred) + { + __first = std::find_if_not(__first, __last, __pred); + if (__first == __last) + return true; + ++__first; + return std::none_of(__first, __last, __pred); + } + + /** + * @brief Find the partition point of a partitioned range. + * @ingroup mutating_algorithms + * @param __first An iterator. + * @param __last Another iterator. + * @param __pred A predicate. + * @return An iterator @p mid such that @p all_of(__first, mid, __pred) + * and @p none_of(mid, __last, __pred) are both true. + */ + template + _ForwardIterator + partition_point(_ForwardIterator __first, _ForwardIterator __last, + _Predicate __pred) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, + typename iterator_traits<_ForwardIterator>::value_type>) + + // A specific debug-mode test will be necessary... + __glibcxx_requires_valid_range(__first, __last); + + typedef typename iterator_traits<_ForwardIterator>::difference_type + _DistanceType; + + _DistanceType __len = std::distance(__first, __last); + _DistanceType __half; + _ForwardIterator __middle; + + while (__len > 0) + { + __half = __len >> 1; + __middle = __first; + std::advance(__middle, __half); + if (__pred(*__middle)) + { + __first = __middle; + ++__first; + __len = __len - __half - 1; + } + else + __len = __half; + } + return __first; + } +#endif + + template + _OutputIterator + __remove_copy_if(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _Predicate __pred) + { + for (; __first != __last; ++__first) + if (!__pred(__first)) + { + *__result = *__first; + ++__result; + } + return __result; + } + + /** + * @brief Copy a sequence, removing elements of a given value. + * @ingroup mutating_algorithms + * @param __first An input iterator. + * @param __last An input iterator. + * @param __result An output iterator. + * @param __value The value to be removed. + * @return An iterator designating the end of the resulting sequence. + * + * Copies each element in the range @p [__first,__last) not equal + * to @p __value to the range beginning at @p __result. + * remove_copy() is stable, so the relative order of elements that + * are copied is unchanged. + */ + template + inline _OutputIterator + remove_copy(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, const _Tp& __value) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator>::value_type>) + __glibcxx_function_requires(_EqualOpConcept< + typename iterator_traits<_InputIterator>::value_type, _Tp>) + __glibcxx_requires_valid_range(__first, __last); + + return std::__remove_copy_if(__first, __last, __result, + __gnu_cxx::__ops::__iter_equals_val(__value)); + } + + /** + * @brief Copy a sequence, removing elements for which a predicate is true. + * @ingroup mutating_algorithms + * @param __first An input iterator. + * @param __last An input iterator. + * @param __result An output iterator. + * @param __pred A predicate. + * @return An iterator designating the end of the resulting sequence. + * + * Copies each element in the range @p [__first,__last) for which + * @p __pred returns false to the range beginning at @p __result. + * + * remove_copy_if() is stable, so the relative order of elements that are + * copied is unchanged. + */ + template + inline _OutputIterator + remove_copy_if(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _Predicate __pred) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator>::value_type>) + __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, + typename iterator_traits<_InputIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + return std::__remove_copy_if(__first, __last, __result, + __gnu_cxx::__ops::__pred_iter(__pred)); + } + +#if __cplusplus >= 201103L + /** + * @brief Copy the elements of a sequence for which a predicate is true. + * @ingroup mutating_algorithms + * @param __first An input iterator. + * @param __last An input iterator. + * @param __result An output iterator. + * @param __pred A predicate. + * @return An iterator designating the end of the resulting sequence. + * + * Copies each element in the range @p [__first,__last) for which + * @p __pred returns true to the range beginning at @p __result. + * + * copy_if() is stable, so the relative order of elements that are + * copied is unchanged. + */ + template + _OutputIterator + copy_if(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _Predicate __pred) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator>::value_type>) + __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, + typename iterator_traits<_InputIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + for (; __first != __last; ++__first) + if (__pred(*__first)) + { + *__result = *__first; + ++__result; + } + return __result; + } + + template + _OutputIterator + __copy_n(_InputIterator __first, _Size __n, + _OutputIterator __result, input_iterator_tag) + { + if (__n > 0) + { + while (true) + { + *__result = *__first; + ++__result; + if (--__n > 0) + ++__first; + else + break; + } + } + return __result; + } + + template + inline _OutputIterator + __copy_n(_RandomAccessIterator __first, _Size __n, + _OutputIterator __result, random_access_iterator_tag) + { return std::copy(__first, __first + __n, __result); } + + /** + * @brief Copies the range [first,first+n) into [result,result+n). + * @ingroup mutating_algorithms + * @param __first An input iterator. + * @param __n The number of elements to copy. + * @param __result An output iterator. + * @return result+n. + * + * This inline function will boil down to a call to @c memmove whenever + * possible. Failing that, if random access iterators are passed, then the + * loop count will be known (and therefore a candidate for compiler + * optimizations such as unrolling). + */ + template + inline _OutputIterator + copy_n(_InputIterator __first, _Size __n, _OutputIterator __result) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator>::value_type>) + + return std::__copy_n(__first, __n, __result, + std::__iterator_category(__first)); + } + + /** + * @brief Copy the elements of a sequence to separate output sequences + * depending on the truth value of a predicate. + * @ingroup mutating_algorithms + * @param __first An input iterator. + * @param __last An input iterator. + * @param __out_true An output iterator. + * @param __out_false An output iterator. + * @param __pred A predicate. + * @return A pair designating the ends of the resulting sequences. + * + * Copies each element in the range @p [__first,__last) for which + * @p __pred returns true to the range beginning at @p out_true + * and each element for which @p __pred returns false to @p __out_false. + */ + template + pair<_OutputIterator1, _OutputIterator2> + partition_copy(_InputIterator __first, _InputIterator __last, + _OutputIterator1 __out_true, _OutputIterator2 __out_false, + _Predicate __pred) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator1, + typename iterator_traits<_InputIterator>::value_type>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator2, + typename iterator_traits<_InputIterator>::value_type>) + __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, + typename iterator_traits<_InputIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + for (; __first != __last; ++__first) + if (__pred(*__first)) + { + *__out_true = *__first; + ++__out_true; + } + else + { + *__out_false = *__first; + ++__out_false; + } + + return pair<_OutputIterator1, _OutputIterator2>(__out_true, __out_false); + } +#endif + + template + _ForwardIterator + __remove_if(_ForwardIterator __first, _ForwardIterator __last, + _Predicate __pred) + { + __first = std::__find_if(__first, __last, __pred); + if (__first == __last) + return __first; + _ForwardIterator __result = __first; + ++__first; + for (; __first != __last; ++__first) + if (!__pred(__first)) + { + *__result = _GLIBCXX_MOVE(*__first); + ++__result; + } + return __result; + } + + /** + * @brief Remove elements from a sequence. + * @ingroup mutating_algorithms + * @param __first An input iterator. + * @param __last An input iterator. + * @param __value The value to be removed. + * @return An iterator designating the end of the resulting sequence. + * + * All elements equal to @p __value are removed from the range + * @p [__first,__last). + * + * remove() is stable, so the relative order of elements that are + * not removed is unchanged. + * + * Elements between the end of the resulting sequence and @p __last + * are still present, but their value is unspecified. + */ + template + inline _ForwardIterator + remove(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __value) + { + // concept requirements + __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< + _ForwardIterator>) + __glibcxx_function_requires(_EqualOpConcept< + typename iterator_traits<_ForwardIterator>::value_type, _Tp>) + __glibcxx_requires_valid_range(__first, __last); + + return std::__remove_if(__first, __last, + __gnu_cxx::__ops::__iter_equals_val(__value)); + } + + /** + * @brief Remove elements from a sequence using a predicate. + * @ingroup mutating_algorithms + * @param __first A forward iterator. + * @param __last A forward iterator. + * @param __pred A predicate. + * @return An iterator designating the end of the resulting sequence. + * + * All elements for which @p __pred returns true are removed from the range + * @p [__first,__last). + * + * remove_if() is stable, so the relative order of elements that are + * not removed is unchanged. + * + * Elements between the end of the resulting sequence and @p __last + * are still present, but their value is unspecified. + */ + template + inline _ForwardIterator + remove_if(_ForwardIterator __first, _ForwardIterator __last, + _Predicate __pred) + { + // concept requirements + __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< + _ForwardIterator>) + __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + return std::__remove_if(__first, __last, + __gnu_cxx::__ops::__pred_iter(__pred)); + } + + template + _ForwardIterator + __adjacent_find(_ForwardIterator __first, _ForwardIterator __last, + _BinaryPredicate __binary_pred) + { + if (__first == __last) + return __last; + _ForwardIterator __next = __first; + while (++__next != __last) + { + if (__binary_pred(__first, __next)) + return __first; + __first = __next; + } + return __last; + } + + template + _ForwardIterator + __unique(_ForwardIterator __first, _ForwardIterator __last, + _BinaryPredicate __binary_pred) + { + // Skip the beginning, if already unique. + __first = std::__adjacent_find(__first, __last, __binary_pred); + if (__first == __last) + return __last; + + // Do the real copy work. + _ForwardIterator __dest = __first; + ++__first; + while (++__first != __last) + if (!__binary_pred(__dest, __first)) + *++__dest = _GLIBCXX_MOVE(*__first); + return ++__dest; + } + + /** + * @brief Remove consecutive duplicate values from a sequence. + * @ingroup mutating_algorithms + * @param __first A forward iterator. + * @param __last A forward iterator. + * @return An iterator designating the end of the resulting sequence. + * + * Removes all but the first element from each group of consecutive + * values that compare equal. + * unique() is stable, so the relative order of elements that are + * not removed is unchanged. + * Elements between the end of the resulting sequence and @p __last + * are still present, but their value is unspecified. + */ + template + inline _ForwardIterator + unique(_ForwardIterator __first, _ForwardIterator __last) + { + // concept requirements + __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< + _ForwardIterator>) + __glibcxx_function_requires(_EqualityComparableConcept< + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + return std::__unique(__first, __last, + __gnu_cxx::__ops::__iter_equal_to_iter()); + } + + /** + * @brief Remove consecutive values from a sequence using a predicate. + * @ingroup mutating_algorithms + * @param __first A forward iterator. + * @param __last A forward iterator. + * @param __binary_pred A binary predicate. + * @return An iterator designating the end of the resulting sequence. + * + * Removes all but the first element from each group of consecutive + * values for which @p __binary_pred returns true. + * unique() is stable, so the relative order of elements that are + * not removed is unchanged. + * Elements between the end of the resulting sequence and @p __last + * are still present, but their value is unspecified. + */ + template + inline _ForwardIterator + unique(_ForwardIterator __first, _ForwardIterator __last, + _BinaryPredicate __binary_pred) + { + // concept requirements + __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< + _ForwardIterator>) + __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, + typename iterator_traits<_ForwardIterator>::value_type, + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + return std::__unique(__first, __last, + __gnu_cxx::__ops::__iter_comp_iter(__binary_pred)); + } + + /** + * This is an uglified + * unique_copy(_InputIterator, _InputIterator, _OutputIterator, + * _BinaryPredicate) + * overloaded for forward iterators and output iterator as result. + */ + template + _OutputIterator + __unique_copy(_ForwardIterator __first, _ForwardIterator __last, + _OutputIterator __result, _BinaryPredicate __binary_pred, + forward_iterator_tag, output_iterator_tag) + { + // concept requirements -- iterators already checked + __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, + typename iterator_traits<_ForwardIterator>::value_type, + typename iterator_traits<_ForwardIterator>::value_type>) + + _ForwardIterator __next = __first; + *__result = *__first; + while (++__next != __last) + if (!__binary_pred(__first, __next)) + { + __first = __next; + *++__result = *__first; + } + return ++__result; + } + + /** + * This is an uglified + * unique_copy(_InputIterator, _InputIterator, _OutputIterator, + * _BinaryPredicate) + * overloaded for input iterators and output iterator as result. + */ + template + _OutputIterator + __unique_copy(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _BinaryPredicate __binary_pred, + input_iterator_tag, output_iterator_tag) + { + // concept requirements -- iterators already checked + __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, + typename iterator_traits<_InputIterator>::value_type, + typename iterator_traits<_InputIterator>::value_type>) + + typename iterator_traits<_InputIterator>::value_type __value = *__first; + __decltype(__gnu_cxx::__ops::__iter_comp_val(__binary_pred)) + __rebound_pred + = __gnu_cxx::__ops::__iter_comp_val(__binary_pred); + *__result = __value; + while (++__first != __last) + if (!__rebound_pred(__first, __value)) + { + __value = *__first; + *++__result = __value; + } + return ++__result; + } + + /** + * This is an uglified + * unique_copy(_InputIterator, _InputIterator, _OutputIterator, + * _BinaryPredicate) + * overloaded for input iterators and forward iterator as result. + */ + template + _ForwardIterator + __unique_copy(_InputIterator __first, _InputIterator __last, + _ForwardIterator __result, _BinaryPredicate __binary_pred, + input_iterator_tag, forward_iterator_tag) + { + // concept requirements -- iterators already checked + __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, + typename iterator_traits<_ForwardIterator>::value_type, + typename iterator_traits<_InputIterator>::value_type>) + *__result = *__first; + while (++__first != __last) + if (!__binary_pred(__result, __first)) + *++__result = *__first; + return ++__result; + } + + /** + * This is an uglified reverse(_BidirectionalIterator, + * _BidirectionalIterator) + * overloaded for bidirectional iterators. + */ + template + void + __reverse(_BidirectionalIterator __first, _BidirectionalIterator __last, + bidirectional_iterator_tag) + { + while (true) + if (__first == __last || __first == --__last) + return; + else + { + std::iter_swap(__first, __last); + ++__first; + } + } + + /** + * This is an uglified reverse(_BidirectionalIterator, + * _BidirectionalIterator) + * overloaded for random access iterators. + */ + template + void + __reverse(_RandomAccessIterator __first, _RandomAccessIterator __last, + random_access_iterator_tag) + { + if (__first == __last) + return; + --__last; + while (__first < __last) + { + std::iter_swap(__first, __last); + ++__first; + --__last; + } + } + + /** + * @brief Reverse a sequence. + * @ingroup mutating_algorithms + * @param __first A bidirectional iterator. + * @param __last A bidirectional iterator. + * @return reverse() returns no value. + * + * Reverses the order of the elements in the range @p [__first,__last), + * so that the first element becomes the last etc. + * For every @c i such that @p 0<=i<=(__last-__first)/2), @p reverse() + * swaps @p *(__first+i) and @p *(__last-(i+1)) + */ + template + inline void + reverse(_BidirectionalIterator __first, _BidirectionalIterator __last) + { + // concept requirements + __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept< + _BidirectionalIterator>) + __glibcxx_requires_valid_range(__first, __last); + std::__reverse(__first, __last, std::__iterator_category(__first)); + } + + /** + * @brief Copy a sequence, reversing its elements. + * @ingroup mutating_algorithms + * @param __first A bidirectional iterator. + * @param __last A bidirectional iterator. + * @param __result An output iterator. + * @return An iterator designating the end of the resulting sequence. + * + * Copies the elements in the range @p [__first,__last) to the + * range @p [__result,__result+(__last-__first)) such that the + * order of the elements is reversed. For every @c i such that @p + * 0<=i<=(__last-__first), @p reverse_copy() performs the + * assignment @p *(__result+(__last-__first)-1-i) = *(__first+i). + * The ranges @p [__first,__last) and @p + * [__result,__result+(__last-__first)) must not overlap. + */ + template + _OutputIterator + reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last, + _OutputIterator __result) + { + // concept requirements + __glibcxx_function_requires(_BidirectionalIteratorConcept< + _BidirectionalIterator>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_BidirectionalIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + while (__first != __last) + { + --__last; + *__result = *__last; + ++__result; + } + return __result; + } + + /** + * This is a helper function for the rotate algorithm specialized on RAIs. + * It returns the greatest common divisor of two integer values. + */ + template + _EuclideanRingElement + __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n) + { + while (__n != 0) + { + _EuclideanRingElement __t = __m % __n; + __m = __n; + __n = __t; + } + return __m; + } + + inline namespace _V2 + { + + /// This is a helper function for the rotate algorithm. + template + _ForwardIterator + __rotate(_ForwardIterator __first, + _ForwardIterator __middle, + _ForwardIterator __last, + forward_iterator_tag) + { + if (__first == __middle) + return __last; + else if (__last == __middle) + return __first; + + _ForwardIterator __first2 = __middle; + do + { + std::iter_swap(__first, __first2); + ++__first; + ++__first2; + if (__first == __middle) + __middle = __first2; + } + while (__first2 != __last); + + _ForwardIterator __ret = __first; + + __first2 = __middle; + + while (__first2 != __last) + { + std::iter_swap(__first, __first2); + ++__first; + ++__first2; + if (__first == __middle) + __middle = __first2; + else if (__first2 == __last) + __first2 = __middle; + } + return __ret; + } + + /// This is a helper function for the rotate algorithm. + template + _BidirectionalIterator + __rotate(_BidirectionalIterator __first, + _BidirectionalIterator __middle, + _BidirectionalIterator __last, + bidirectional_iterator_tag) + { + // concept requirements + __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept< + _BidirectionalIterator>) + + if (__first == __middle) + return __last; + else if (__last == __middle) + return __first; + + std::__reverse(__first, __middle, bidirectional_iterator_tag()); + std::__reverse(__middle, __last, bidirectional_iterator_tag()); + + while (__first != __middle && __middle != __last) + { + std::iter_swap(__first, --__last); + ++__first; + } + + if (__first == __middle) + { + std::__reverse(__middle, __last, bidirectional_iterator_tag()); + return __last; + } + else + { + std::__reverse(__first, __middle, bidirectional_iterator_tag()); + return __first; + } + } + + /// This is a helper function for the rotate algorithm. + template + _RandomAccessIterator + __rotate(_RandomAccessIterator __first, + _RandomAccessIterator __middle, + _RandomAccessIterator __last, + random_access_iterator_tag) + { + // concept requirements + __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>) + + if (__first == __middle) + return __last; + else if (__last == __middle) + return __first; + + typedef typename iterator_traits<_RandomAccessIterator>::difference_type + _Distance; + typedef typename iterator_traits<_RandomAccessIterator>::value_type + _ValueType; + + _Distance __n = __last - __first; + _Distance __k = __middle - __first; + + if (__k == __n - __k) + { + std::swap_ranges(__first, __middle, __middle); + return __middle; + } + + _RandomAccessIterator __p = __first; + _RandomAccessIterator __ret = __first + (__last - __middle); + + for (;;) + { + if (__k < __n - __k) + { + if (__is_pod(_ValueType) && __k == 1) + { + _ValueType __t = _GLIBCXX_MOVE(*__p); + _GLIBCXX_MOVE3(__p + 1, __p + __n, __p); + *(__p + __n - 1) = _GLIBCXX_MOVE(__t); + return __ret; + } + _RandomAccessIterator __q = __p + __k; + for (_Distance __i = 0; __i < __n - __k; ++ __i) + { + std::iter_swap(__p, __q); + ++__p; + ++__q; + } + __n %= __k; + if (__n == 0) + return __ret; + std::swap(__n, __k); + __k = __n - __k; + } + else + { + __k = __n - __k; + if (__is_pod(_ValueType) && __k == 1) + { + _ValueType __t = _GLIBCXX_MOVE(*(__p + __n - 1)); + _GLIBCXX_MOVE_BACKWARD3(__p, __p + __n - 1, __p + __n); + *__p = _GLIBCXX_MOVE(__t); + return __ret; + } + _RandomAccessIterator __q = __p + __n; + __p = __q - __k; + for (_Distance __i = 0; __i < __n - __k; ++ __i) + { + --__p; + --__q; + std::iter_swap(__p, __q); + } + __n %= __k; + if (__n == 0) + return __ret; + std::swap(__n, __k); + } + } + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 488. rotate throws away useful information + /** + * @brief Rotate the elements of a sequence. + * @ingroup mutating_algorithms + * @param __first A forward iterator. + * @param __middle A forward iterator. + * @param __last A forward iterator. + * @return first + (last - middle). + * + * Rotates the elements of the range @p [__first,__last) by + * @p (__middle - __first) positions so that the element at @p __middle + * is moved to @p __first, the element at @p __middle+1 is moved to + * @p __first+1 and so on for each element in the range + * @p [__first,__last). + * + * This effectively swaps the ranges @p [__first,__middle) and + * @p [__middle,__last). + * + * Performs + * @p *(__first+(n+(__last-__middle))%(__last-__first))=*(__first+n) + * for each @p n in the range @p [0,__last-__first). + */ + template + inline _ForwardIterator + rotate(_ForwardIterator __first, _ForwardIterator __middle, + _ForwardIterator __last) + { + // concept requirements + __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< + _ForwardIterator>) + __glibcxx_requires_valid_range(__first, __middle); + __glibcxx_requires_valid_range(__middle, __last); + + return std::__rotate(__first, __middle, __last, + std::__iterator_category(__first)); + } + + } // namespace _V2 + + /** + * @brief Copy a sequence, rotating its elements. + * @ingroup mutating_algorithms + * @param __first A forward iterator. + * @param __middle A forward iterator. + * @param __last A forward iterator. + * @param __result An output iterator. + * @return An iterator designating the end of the resulting sequence. + * + * Copies the elements of the range @p [__first,__last) to the + * range beginning at @result, rotating the copied elements by + * @p (__middle-__first) positions so that the element at @p __middle + * is moved to @p __result, the element at @p __middle+1 is moved + * to @p __result+1 and so on for each element in the range @p + * [__first,__last). + * + * Performs + * @p *(__result+(n+(__last-__middle))%(__last-__first))=*(__first+n) + * for each @p n in the range @p [0,__last-__first). + */ + template + inline _OutputIterator + rotate_copy(_ForwardIterator __first, _ForwardIterator __middle, + _ForwardIterator __last, _OutputIterator __result) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __middle); + __glibcxx_requires_valid_range(__middle, __last); + + return std::copy(__first, __middle, + std::copy(__middle, __last, __result)); + } + + /// This is a helper function... + template + _ForwardIterator + __partition(_ForwardIterator __first, _ForwardIterator __last, + _Predicate __pred, forward_iterator_tag) + { + if (__first == __last) + return __first; + + while (__pred(*__first)) + if (++__first == __last) + return __first; + + _ForwardIterator __next = __first; + + while (++__next != __last) + if (__pred(*__next)) + { + std::iter_swap(__first, __next); + ++__first; + } + + return __first; + } + + /// This is a helper function... + template + _BidirectionalIterator + __partition(_BidirectionalIterator __first, _BidirectionalIterator __last, + _Predicate __pred, bidirectional_iterator_tag) + { + while (true) + { + while (true) + if (__first == __last) + return __first; + else if (__pred(*__first)) + ++__first; + else + break; + --__last; + while (true) + if (__first == __last) + return __first; + else if (!bool(__pred(*__last))) + --__last; + else + break; + std::iter_swap(__first, __last); + ++__first; + } + } + + // partition + + /// This is a helper function... + /// Requires __first != __last and !__pred(__first) + /// and __len == distance(__first, __last). + /// + /// !__pred(__first) allows us to guarantee that we don't + /// move-assign an element onto itself. + template + _ForwardIterator + __stable_partition_adaptive(_ForwardIterator __first, + _ForwardIterator __last, + _Predicate __pred, _Distance __len, + _Pointer __buffer, + _Distance __buffer_size) + { + if (__len == 1) + return __first; + + if (__len <= __buffer_size) + { + _ForwardIterator __result1 = __first; + _Pointer __result2 = __buffer; + + // The precondition guarantees that !__pred(__first), so + // move that element to the buffer before starting the loop. + // This ensures that we only call __pred once per element. + *__result2 = _GLIBCXX_MOVE(*__first); + ++__result2; + ++__first; + for (; __first != __last; ++__first) + if (__pred(__first)) + { + *__result1 = _GLIBCXX_MOVE(*__first); + ++__result1; + } + else + { + *__result2 = _GLIBCXX_MOVE(*__first); + ++__result2; + } + + _GLIBCXX_MOVE3(__buffer, __result2, __result1); + return __result1; + } + + _ForwardIterator __middle = __first; + std::advance(__middle, __len / 2); + _ForwardIterator __left_split = + std::__stable_partition_adaptive(__first, __middle, __pred, + __len / 2, __buffer, + __buffer_size); + + // Advance past true-predicate values to satisfy this + // function's preconditions. + _Distance __right_len = __len - __len / 2; + _ForwardIterator __right_split = + std::__find_if_not_n(__middle, __right_len, __pred); + + if (__right_len) + __right_split = + std::__stable_partition_adaptive(__right_split, __last, __pred, + __right_len, + __buffer, __buffer_size); + + std::rotate(__left_split, __middle, __right_split); + std::advance(__left_split, std::distance(__middle, __right_split)); + return __left_split; + } + + template + _ForwardIterator + __stable_partition(_ForwardIterator __first, _ForwardIterator __last, + _Predicate __pred) + { + __first = std::__find_if_not(__first, __last, __pred); + + if (__first == __last) + return __first; + + typedef typename iterator_traits<_ForwardIterator>::value_type + _ValueType; + typedef typename iterator_traits<_ForwardIterator>::difference_type + _DistanceType; + + _Temporary_buffer<_ForwardIterator, _ValueType> __buf(__first, __last); + return + std::__stable_partition_adaptive(__first, __last, __pred, + _DistanceType(__buf.requested_size()), + __buf.begin(), + _DistanceType(__buf.size())); + } + + /** + * @brief Move elements for which a predicate is true to the beginning + * of a sequence, preserving relative ordering. + * @ingroup mutating_algorithms + * @param __first A forward iterator. + * @param __last A forward iterator. + * @param __pred A predicate functor. + * @return An iterator @p middle such that @p __pred(i) is true for each + * iterator @p i in the range @p [first,middle) and false for each @p i + * in the range @p [middle,last). + * + * Performs the same function as @p partition() with the additional + * guarantee that the relative ordering of elements in each group is + * preserved, so any two elements @p x and @p y in the range + * @p [__first,__last) such that @p __pred(x)==__pred(y) will have the same + * relative ordering after calling @p stable_partition(). + */ + template + inline _ForwardIterator + stable_partition(_ForwardIterator __first, _ForwardIterator __last, + _Predicate __pred) + { + // concept requirements + __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< + _ForwardIterator>) + __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + return std::__stable_partition(__first, __last, + __gnu_cxx::__ops::__pred_iter(__pred)); + } + + /// This is a helper function for the sort routines. + template + void + __heap_select(_RandomAccessIterator __first, + _RandomAccessIterator __middle, + _RandomAccessIterator __last, _Compare __comp) + { + std::__make_heap(__first, __middle, __comp); + for (_RandomAccessIterator __i = __middle; __i < __last; ++__i) + if (__comp(__i, __first)) + std::__pop_heap(__first, __middle, __i, __comp); + } + + // partial_sort + + template + _RandomAccessIterator + __partial_sort_copy(_InputIterator __first, _InputIterator __last, + _RandomAccessIterator __result_first, + _RandomAccessIterator __result_last, + _Compare __comp) + { + typedef typename iterator_traits<_InputIterator>::value_type + _InputValueType; + typedef iterator_traits<_RandomAccessIterator> _RItTraits; + typedef typename _RItTraits::difference_type _DistanceType; + + if (__result_first == __result_last) + return __result_last; + _RandomAccessIterator __result_real_last = __result_first; + while (__first != __last && __result_real_last != __result_last) + { + *__result_real_last = *__first; + ++__result_real_last; + ++__first; + } + + std::__make_heap(__result_first, __result_real_last, __comp); + while (__first != __last) + { + if (__comp(__first, __result_first)) + std::__adjust_heap(__result_first, _DistanceType(0), + _DistanceType(__result_real_last + - __result_first), + _InputValueType(*__first), __comp); + ++__first; + } + std::__sort_heap(__result_first, __result_real_last, __comp); + return __result_real_last; + } + + /** + * @brief Copy the smallest elements of a sequence. + * @ingroup sorting_algorithms + * @param __first An iterator. + * @param __last Another iterator. + * @param __result_first A random-access iterator. + * @param __result_last Another random-access iterator. + * @return An iterator indicating the end of the resulting sequence. + * + * Copies and sorts the smallest N values from the range @p [__first,__last) + * to the range beginning at @p __result_first, where the number of + * elements to be copied, @p N, is the smaller of @p (__last-__first) and + * @p (__result_last-__result_first). + * After the sort if @e i and @e j are iterators in the range + * @p [__result_first,__result_first+N) such that i precedes j then + * *j<*i is false. + * The value returned is @p __result_first+N. + */ + template + inline _RandomAccessIterator + partial_sort_copy(_InputIterator __first, _InputIterator __last, + _RandomAccessIterator __result_first, + _RandomAccessIterator __result_last) + { +#ifdef _GLIBCXX_CONCEPT_CHECKS + typedef typename iterator_traits<_InputIterator>::value_type + _InputValueType; + typedef typename iterator_traits<_RandomAccessIterator>::value_type + _OutputValueType; +#endif + + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_ConvertibleConcept<_InputValueType, + _OutputValueType>) + __glibcxx_function_requires(_LessThanOpConcept<_InputValueType, + _OutputValueType>) + __glibcxx_function_requires(_LessThanComparableConcept<_OutputValueType>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive(__first, __last); + __glibcxx_requires_valid_range(__result_first, __result_last); + + return std::__partial_sort_copy(__first, __last, + __result_first, __result_last, + __gnu_cxx::__ops::__iter_less_iter()); + } + + /** + * @brief Copy the smallest elements of a sequence using a predicate for + * comparison. + * @ingroup sorting_algorithms + * @param __first An input iterator. + * @param __last Another input iterator. + * @param __result_first A random-access iterator. + * @param __result_last Another random-access iterator. + * @param __comp A comparison functor. + * @return An iterator indicating the end of the resulting sequence. + * + * Copies and sorts the smallest N values from the range @p [__first,__last) + * to the range beginning at @p result_first, where the number of + * elements to be copied, @p N, is the smaller of @p (__last-__first) and + * @p (__result_last-__result_first). + * After the sort if @e i and @e j are iterators in the range + * @p [__result_first,__result_first+N) such that i precedes j then + * @p __comp(*j,*i) is false. + * The value returned is @p __result_first+N. + */ + template + inline _RandomAccessIterator + partial_sort_copy(_InputIterator __first, _InputIterator __last, + _RandomAccessIterator __result_first, + _RandomAccessIterator __result_last, + _Compare __comp) + { +#ifdef _GLIBCXX_CONCEPT_CHECKS + typedef typename iterator_traits<_InputIterator>::value_type + _InputValueType; + typedef typename iterator_traits<_RandomAccessIterator>::value_type + _OutputValueType; +#endif + + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __glibcxx_function_requires(_ConvertibleConcept<_InputValueType, + _OutputValueType>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + _InputValueType, _OutputValueType>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + _OutputValueType, _OutputValueType>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive_pred(__first, __last, __comp); + __glibcxx_requires_valid_range(__result_first, __result_last); + + return std::__partial_sort_copy(__first, __last, + __result_first, __result_last, + __gnu_cxx::__ops::__iter_comp_iter(__comp)); + } + + /// This is a helper function for the sort routine. + template + void + __unguarded_linear_insert(_RandomAccessIterator __last, + _Compare __comp) + { + typename iterator_traits<_RandomAccessIterator>::value_type + __val = _GLIBCXX_MOVE(*__last); + _RandomAccessIterator __next = __last; + --__next; + while (__comp(__val, __next)) + { + *__last = _GLIBCXX_MOVE(*__next); + __last = __next; + --__next; + } + *__last = _GLIBCXX_MOVE(__val); + } + + /// This is a helper function for the sort routine. + template + void + __insertion_sort(_RandomAccessIterator __first, + _RandomAccessIterator __last, _Compare __comp) + { + if (__first == __last) return; + + for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i) + { + if (__comp(__i, __first)) + { + typename iterator_traits<_RandomAccessIterator>::value_type + __val = _GLIBCXX_MOVE(*__i); + _GLIBCXX_MOVE_BACKWARD3(__first, __i, __i + 1); + *__first = _GLIBCXX_MOVE(__val); + } + else + std::__unguarded_linear_insert(__i, + __gnu_cxx::__ops::__val_comp_iter(__comp)); + } + } + + /// This is a helper function for the sort routine. + template + inline void + __unguarded_insertion_sort(_RandomAccessIterator __first, + _RandomAccessIterator __last, _Compare __comp) + { + for (_RandomAccessIterator __i = __first; __i != __last; ++__i) + std::__unguarded_linear_insert(__i, + __gnu_cxx::__ops::__val_comp_iter(__comp)); + } + + /** + * @doctodo + * This controls some aspect of the sort routines. + */ + enum { _S_threshold = 16 }; + + /// This is a helper function for the sort routine. + template + void + __final_insertion_sort(_RandomAccessIterator __first, + _RandomAccessIterator __last, _Compare __comp) + { + if (__last - __first > int(_S_threshold)) + { + std::__insertion_sort(__first, __first + int(_S_threshold), __comp); + std::__unguarded_insertion_sort(__first + int(_S_threshold), __last, + __comp); + } + else + std::__insertion_sort(__first, __last, __comp); + } + + /// This is a helper function... + template + _RandomAccessIterator + __unguarded_partition(_RandomAccessIterator __first, + _RandomAccessIterator __last, + _RandomAccessIterator __pivot, _Compare __comp) + { + while (true) + { + while (__comp(__first, __pivot)) + ++__first; + --__last; + while (__comp(__pivot, __last)) + --__last; + if (!(__first < __last)) + return __first; + std::iter_swap(__first, __last); + ++__first; + } + } + + /// This is a helper function... + template + inline _RandomAccessIterator + __unguarded_partition_pivot(_RandomAccessIterator __first, + _RandomAccessIterator __last, _Compare __comp) + { + _RandomAccessIterator __mid = __first + (__last - __first) / 2; + std::__move_median_to_first(__first, __first + 1, __mid, __last - 1, + __comp); + return std::__unguarded_partition(__first + 1, __last, __first, __comp); + } + + template + inline void + __partial_sort(_RandomAccessIterator __first, + _RandomAccessIterator __middle, + _RandomAccessIterator __last, + _Compare __comp) + { + std::__heap_select(__first, __middle, __last, __comp); + std::__sort_heap(__first, __middle, __comp); + } + + /// This is a helper function for the sort routine. + template + void + __introsort_loop(_RandomAccessIterator __first, + _RandomAccessIterator __last, + _Size __depth_limit, _Compare __comp) + { + while (__last - __first > int(_S_threshold)) + { + if (__depth_limit == 0) + { + std::__partial_sort(__first, __last, __last, __comp); + return; + } + --__depth_limit; + _RandomAccessIterator __cut = + std::__unguarded_partition_pivot(__first, __last, __comp); + std::__introsort_loop(__cut, __last, __depth_limit, __comp); + __last = __cut; + } + } + + // sort + + template + inline void + __sort(_RandomAccessIterator __first, _RandomAccessIterator __last, + _Compare __comp) + { + if (__first != __last) + { + std::__introsort_loop(__first, __last, + std::__lg(__last - __first) * 2, + __comp); + std::__final_insertion_sort(__first, __last, __comp); + } + } + + template + void + __introselect(_RandomAccessIterator __first, _RandomAccessIterator __nth, + _RandomAccessIterator __last, _Size __depth_limit, + _Compare __comp) + { + while (__last - __first > 3) + { + if (__depth_limit == 0) + { + std::__heap_select(__first, __nth + 1, __last, __comp); + // Place the nth largest element in its final position. + std::iter_swap(__first, __nth); + return; + } + --__depth_limit; + _RandomAccessIterator __cut = + std::__unguarded_partition_pivot(__first, __last, __comp); + if (__cut <= __nth) + __first = __cut; + else + __last = __cut; + } + std::__insertion_sort(__first, __last, __comp); + } + + // nth_element + + // lower_bound moved to stl_algobase.h + + /** + * @brief Finds the first position in which @p __val could be inserted + * without changing the ordering. + * @ingroup binary_search_algorithms + * @param __first An iterator. + * @param __last Another iterator. + * @param __val The search term. + * @param __comp A functor to use for comparisons. + * @return An iterator pointing to the first element not less + * than @p __val, or end() if every element is less + * than @p __val. + * @ingroup binary_search_algorithms + * + * The comparison function should have the same effects on ordering as + * the function used for the initial sort. + */ + template + inline _ForwardIterator + lower_bound(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __val, _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_ForwardIterator>::value_type, _Tp>) + __glibcxx_requires_partitioned_lower_pred(__first, __last, + __val, __comp); + + return std::__lower_bound(__first, __last, __val, + __gnu_cxx::__ops::__iter_comp_val(__comp)); + } + + template + _ForwardIterator + __upper_bound(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __val, _Compare __comp) + { + typedef typename iterator_traits<_ForwardIterator>::difference_type + _DistanceType; + + _DistanceType __len = std::distance(__first, __last); + + while (__len > 0) + { + _DistanceType __half = __len >> 1; + _ForwardIterator __middle = __first; + std::advance(__middle, __half); + if (__comp(__val, __middle)) + __len = __half; + else + { + __first = __middle; + ++__first; + __len = __len - __half - 1; + } + } + return __first; + } + + /** + * @brief Finds the last position in which @p __val could be inserted + * without changing the ordering. + * @ingroup binary_search_algorithms + * @param __first An iterator. + * @param __last Another iterator. + * @param __val The search term. + * @return An iterator pointing to the first element greater than @p __val, + * or end() if no elements are greater than @p __val. + * @ingroup binary_search_algorithms + */ + template + inline _ForwardIterator + upper_bound(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __val) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_LessThanOpConcept< + _Tp, typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_partitioned_upper(__first, __last, __val); + + return std::__upper_bound(__first, __last, __val, + __gnu_cxx::__ops::__val_less_iter()); + } + + /** + * @brief Finds the last position in which @p __val could be inserted + * without changing the ordering. + * @ingroup binary_search_algorithms + * @param __first An iterator. + * @param __last Another iterator. + * @param __val The search term. + * @param __comp A functor to use for comparisons. + * @return An iterator pointing to the first element greater than @p __val, + * or end() if no elements are greater than @p __val. + * @ingroup binary_search_algorithms + * + * The comparison function should have the same effects on ordering as + * the function used for the initial sort. + */ + template + inline _ForwardIterator + upper_bound(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __val, _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + _Tp, typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_partitioned_upper_pred(__first, __last, + __val, __comp); + + return std::__upper_bound(__first, __last, __val, + __gnu_cxx::__ops::__val_comp_iter(__comp)); + } + + template + pair<_ForwardIterator, _ForwardIterator> + __equal_range(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __val, + _CompareItTp __comp_it_val, _CompareTpIt __comp_val_it) + { + typedef typename iterator_traits<_ForwardIterator>::difference_type + _DistanceType; + + _DistanceType __len = std::distance(__first, __last); + + while (__len > 0) + { + _DistanceType __half = __len >> 1; + _ForwardIterator __middle = __first; + std::advance(__middle, __half); + if (__comp_it_val(__middle, __val)) + { + __first = __middle; + ++__first; + __len = __len - __half - 1; + } + else if (__comp_val_it(__val, __middle)) + __len = __half; + else + { + _ForwardIterator __left + = std::__lower_bound(__first, __middle, __val, __comp_it_val); + std::advance(__first, __len); + _ForwardIterator __right + = std::__upper_bound(++__middle, __first, __val, __comp_val_it); + return pair<_ForwardIterator, _ForwardIterator>(__left, __right); + } + } + return pair<_ForwardIterator, _ForwardIterator>(__first, __first); + } + + /** + * @brief Finds the largest subrange in which @p __val could be inserted + * at any place in it without changing the ordering. + * @ingroup binary_search_algorithms + * @param __first An iterator. + * @param __last Another iterator. + * @param __val The search term. + * @return An pair of iterators defining the subrange. + * @ingroup binary_search_algorithms + * + * This is equivalent to + * @code + * std::make_pair(lower_bound(__first, __last, __val), + * upper_bound(__first, __last, __val)) + * @endcode + * but does not actually call those functions. + */ + template + inline pair<_ForwardIterator, _ForwardIterator> + equal_range(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __val) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_LessThanOpConcept< + typename iterator_traits<_ForwardIterator>::value_type, _Tp>) + __glibcxx_function_requires(_LessThanOpConcept< + _Tp, typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_partitioned_lower(__first, __last, __val); + __glibcxx_requires_partitioned_upper(__first, __last, __val); + + return std::__equal_range(__first, __last, __val, + __gnu_cxx::__ops::__iter_less_val(), + __gnu_cxx::__ops::__val_less_iter()); + } + + /** + * @brief Finds the largest subrange in which @p __val could be inserted + * at any place in it without changing the ordering. + * @param __first An iterator. + * @param __last Another iterator. + * @param __val The search term. + * @param __comp A functor to use for comparisons. + * @return An pair of iterators defining the subrange. + * @ingroup binary_search_algorithms + * + * This is equivalent to + * @code + * std::make_pair(lower_bound(__first, __last, __val, __comp), + * upper_bound(__first, __last, __val, __comp)) + * @endcode + * but does not actually call those functions. + */ + template + inline pair<_ForwardIterator, _ForwardIterator> + equal_range(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __val, _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_ForwardIterator>::value_type, _Tp>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + _Tp, typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_partitioned_lower_pred(__first, __last, + __val, __comp); + __glibcxx_requires_partitioned_upper_pred(__first, __last, + __val, __comp); + + return std::__equal_range(__first, __last, __val, + __gnu_cxx::__ops::__iter_comp_val(__comp), + __gnu_cxx::__ops::__val_comp_iter(__comp)); + } + + /** + * @brief Determines whether an element exists in a range. + * @ingroup binary_search_algorithms + * @param __first An iterator. + * @param __last Another iterator. + * @param __val The search term. + * @return True if @p __val (or its equivalent) is in [@p + * __first,@p __last ]. + * + * Note that this does not actually return an iterator to @p __val. For + * that, use std::find or a container's specialized find member functions. + */ + template + bool + binary_search(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __val) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_LessThanOpConcept< + _Tp, typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_partitioned_lower(__first, __last, __val); + __glibcxx_requires_partitioned_upper(__first, __last, __val); + + _ForwardIterator __i + = std::__lower_bound(__first, __last, __val, + __gnu_cxx::__ops::__iter_less_val()); + return __i != __last && !(__val < *__i); + } + + /** + * @brief Determines whether an element exists in a range. + * @ingroup binary_search_algorithms + * @param __first An iterator. + * @param __last Another iterator. + * @param __val The search term. + * @param __comp A functor to use for comparisons. + * @return True if @p __val (or its equivalent) is in @p [__first,__last]. + * + * Note that this does not actually return an iterator to @p __val. For + * that, use std::find or a container's specialized find member functions. + * + * The comparison function should have the same effects on ordering as + * the function used for the initial sort. + */ + template + bool + binary_search(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __val, _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + _Tp, typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_partitioned_lower_pred(__first, __last, + __val, __comp); + __glibcxx_requires_partitioned_upper_pred(__first, __last, + __val, __comp); + + _ForwardIterator __i + = std::__lower_bound(__first, __last, __val, + __gnu_cxx::__ops::__iter_comp_val(__comp)); + return __i != __last && !bool(__comp(__val, *__i)); + } + + // merge + + /// This is a helper function for the __merge_adaptive routines. + template + void + __move_merge_adaptive(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _OutputIterator __result, _Compare __comp) + { + while (__first1 != __last1 && __first2 != __last2) + { + if (__comp(__first2, __first1)) + { + *__result = _GLIBCXX_MOVE(*__first2); + ++__first2; + } + else + { + *__result = _GLIBCXX_MOVE(*__first1); + ++__first1; + } + ++__result; + } + if (__first1 != __last1) + _GLIBCXX_MOVE3(__first1, __last1, __result); + } + + /// This is a helper function for the __merge_adaptive routines. + template + void + __move_merge_adaptive_backward(_BidirectionalIterator1 __first1, + _BidirectionalIterator1 __last1, + _BidirectionalIterator2 __first2, + _BidirectionalIterator2 __last2, + _BidirectionalIterator3 __result, + _Compare __comp) + { + if (__first1 == __last1) + { + _GLIBCXX_MOVE_BACKWARD3(__first2, __last2, __result); + return; + } + else if (__first2 == __last2) + return; + + --__last1; + --__last2; + while (true) + { + if (__comp(__last2, __last1)) + { + *--__result = _GLIBCXX_MOVE(*__last1); + if (__first1 == __last1) + { + _GLIBCXX_MOVE_BACKWARD3(__first2, ++__last2, __result); + return; + } + --__last1; + } + else + { + *--__result = _GLIBCXX_MOVE(*__last2); + if (__first2 == __last2) + return; + --__last2; + } + } + } + + /// This is a helper function for the merge routines. + template + _BidirectionalIterator1 + __rotate_adaptive(_BidirectionalIterator1 __first, + _BidirectionalIterator1 __middle, + _BidirectionalIterator1 __last, + _Distance __len1, _Distance __len2, + _BidirectionalIterator2 __buffer, + _Distance __buffer_size) + { + _BidirectionalIterator2 __buffer_end; + if (__len1 > __len2 && __len2 <= __buffer_size) + { + if (__len2) + { + __buffer_end = _GLIBCXX_MOVE3(__middle, __last, __buffer); + _GLIBCXX_MOVE_BACKWARD3(__first, __middle, __last); + return _GLIBCXX_MOVE3(__buffer, __buffer_end, __first); + } + else + return __first; + } + else if (__len1 <= __buffer_size) + { + if (__len1) + { + __buffer_end = _GLIBCXX_MOVE3(__first, __middle, __buffer); + _GLIBCXX_MOVE3(__middle, __last, __first); + return _GLIBCXX_MOVE_BACKWARD3(__buffer, __buffer_end, __last); + } + else + return __last; + } + else + { + std::rotate(__first, __middle, __last); + std::advance(__first, std::distance(__middle, __last)); + return __first; + } + } + + /// This is a helper function for the merge routines. + template + void + __merge_adaptive(_BidirectionalIterator __first, + _BidirectionalIterator __middle, + _BidirectionalIterator __last, + _Distance __len1, _Distance __len2, + _Pointer __buffer, _Distance __buffer_size, + _Compare __comp) + { + if (__len1 <= __len2 && __len1 <= __buffer_size) + { + _Pointer __buffer_end = _GLIBCXX_MOVE3(__first, __middle, __buffer); + std::__move_merge_adaptive(__buffer, __buffer_end, __middle, __last, + __first, __comp); + } + else if (__len2 <= __buffer_size) + { + _Pointer __buffer_end = _GLIBCXX_MOVE3(__middle, __last, __buffer); + std::__move_merge_adaptive_backward(__first, __middle, __buffer, + __buffer_end, __last, __comp); + } + else + { + _BidirectionalIterator __first_cut = __first; + _BidirectionalIterator __second_cut = __middle; + _Distance __len11 = 0; + _Distance __len22 = 0; + if (__len1 > __len2) + { + __len11 = __len1 / 2; + std::advance(__first_cut, __len11); + __second_cut + = std::__lower_bound(__middle, __last, *__first_cut, + __gnu_cxx::__ops::__iter_comp_val(__comp)); + __len22 = std::distance(__middle, __second_cut); + } + else + { + __len22 = __len2 / 2; + std::advance(__second_cut, __len22); + __first_cut + = std::__upper_bound(__first, __middle, *__second_cut, + __gnu_cxx::__ops::__val_comp_iter(__comp)); + __len11 = std::distance(__first, __first_cut); + } + + _BidirectionalIterator __new_middle + = std::__rotate_adaptive(__first_cut, __middle, __second_cut, + __len1 - __len11, __len22, __buffer, + __buffer_size); + std::__merge_adaptive(__first, __first_cut, __new_middle, __len11, + __len22, __buffer, __buffer_size, __comp); + std::__merge_adaptive(__new_middle, __second_cut, __last, + __len1 - __len11, + __len2 - __len22, __buffer, + __buffer_size, __comp); + } + } + + /// This is a helper function for the merge routines. + template + void + __merge_without_buffer(_BidirectionalIterator __first, + _BidirectionalIterator __middle, + _BidirectionalIterator __last, + _Distance __len1, _Distance __len2, + _Compare __comp) + { + if (__len1 == 0 || __len2 == 0) + return; + + if (__len1 + __len2 == 2) + { + if (__comp(__middle, __first)) + std::iter_swap(__first, __middle); + return; + } + + _BidirectionalIterator __first_cut = __first; + _BidirectionalIterator __second_cut = __middle; + _Distance __len11 = 0; + _Distance __len22 = 0; + if (__len1 > __len2) + { + __len11 = __len1 / 2; + std::advance(__first_cut, __len11); + __second_cut + = std::__lower_bound(__middle, __last, *__first_cut, + __gnu_cxx::__ops::__iter_comp_val(__comp)); + __len22 = std::distance(__middle, __second_cut); + } + else + { + __len22 = __len2 / 2; + std::advance(__second_cut, __len22); + __first_cut + = std::__upper_bound(__first, __middle, *__second_cut, + __gnu_cxx::__ops::__val_comp_iter(__comp)); + __len11 = std::distance(__first, __first_cut); + } + + std::rotate(__first_cut, __middle, __second_cut); + _BidirectionalIterator __new_middle = __first_cut; + std::advance(__new_middle, std::distance(__middle, __second_cut)); + std::__merge_without_buffer(__first, __first_cut, __new_middle, + __len11, __len22, __comp); + std::__merge_without_buffer(__new_middle, __second_cut, __last, + __len1 - __len11, __len2 - __len22, __comp); + } + + template + void + __inplace_merge(_BidirectionalIterator __first, + _BidirectionalIterator __middle, + _BidirectionalIterator __last, + _Compare __comp) + { + typedef typename iterator_traits<_BidirectionalIterator>::value_type + _ValueType; + typedef typename iterator_traits<_BidirectionalIterator>::difference_type + _DistanceType; + + if (__first == __middle || __middle == __last) + return; + + const _DistanceType __len1 = std::distance(__first, __middle); + const _DistanceType __len2 = std::distance(__middle, __last); + + typedef _Temporary_buffer<_BidirectionalIterator, _ValueType> _TmpBuf; + _TmpBuf __buf(__first, __last); + + if (__buf.begin() == 0) + std::__merge_without_buffer + (__first, __middle, __last, __len1, __len2, __comp); + else + std::__merge_adaptive + (__first, __middle, __last, __len1, __len2, __buf.begin(), + _DistanceType(__buf.size()), __comp); + } + + /** + * @brief Merges two sorted ranges in place. + * @ingroup sorting_algorithms + * @param __first An iterator. + * @param __middle Another iterator. + * @param __last Another iterator. + * @return Nothing. + * + * Merges two sorted and consecutive ranges, [__first,__middle) and + * [__middle,__last), and puts the result in [__first,__last). The + * output will be sorted. The sort is @e stable, that is, for + * equivalent elements in the two ranges, elements from the first + * range will always come before elements from the second. + * + * If enough additional memory is available, this takes (__last-__first)-1 + * comparisons. Otherwise an NlogN algorithm is used, where N is + * distance(__first,__last). + */ + template + inline void + inplace_merge(_BidirectionalIterator __first, + _BidirectionalIterator __middle, + _BidirectionalIterator __last) + { + // concept requirements + __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept< + _BidirectionalIterator>) + __glibcxx_function_requires(_LessThanComparableConcept< + typename iterator_traits<_BidirectionalIterator>::value_type>) + __glibcxx_requires_sorted(__first, __middle); + __glibcxx_requires_sorted(__middle, __last); + __glibcxx_requires_irreflexive(__first, __last); + + std::__inplace_merge(__first, __middle, __last, + __gnu_cxx::__ops::__iter_less_iter()); + } + + /** + * @brief Merges two sorted ranges in place. + * @ingroup sorting_algorithms + * @param __first An iterator. + * @param __middle Another iterator. + * @param __last Another iterator. + * @param __comp A functor to use for comparisons. + * @return Nothing. + * + * Merges two sorted and consecutive ranges, [__first,__middle) and + * [middle,last), and puts the result in [__first,__last). The output will + * be sorted. The sort is @e stable, that is, for equivalent + * elements in the two ranges, elements from the first range will always + * come before elements from the second. + * + * If enough additional memory is available, this takes (__last-__first)-1 + * comparisons. Otherwise an NlogN algorithm is used, where N is + * distance(__first,__last). + * + * The comparison function should have the same effects on ordering as + * the function used for the initial sort. + */ + template + inline void + inplace_merge(_BidirectionalIterator __first, + _BidirectionalIterator __middle, + _BidirectionalIterator __last, + _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept< + _BidirectionalIterator>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_BidirectionalIterator>::value_type, + typename iterator_traits<_BidirectionalIterator>::value_type>) + __glibcxx_requires_sorted_pred(__first, __middle, __comp); + __glibcxx_requires_sorted_pred(__middle, __last, __comp); + __glibcxx_requires_irreflexive_pred(__first, __last, __comp); + + std::__inplace_merge(__first, __middle, __last, + __gnu_cxx::__ops::__iter_comp_iter(__comp)); + } + + + /// This is a helper function for the __merge_sort_loop routines. + template + _OutputIterator + __move_merge(_InputIterator __first1, _InputIterator __last1, + _InputIterator __first2, _InputIterator __last2, + _OutputIterator __result, _Compare __comp) + { + while (__first1 != __last1 && __first2 != __last2) + { + if (__comp(__first2, __first1)) + { + *__result = _GLIBCXX_MOVE(*__first2); + ++__first2; + } + else + { + *__result = _GLIBCXX_MOVE(*__first1); + ++__first1; + } + ++__result; + } + return _GLIBCXX_MOVE3(__first2, __last2, + _GLIBCXX_MOVE3(__first1, __last1, + __result)); + } + + template + void + __merge_sort_loop(_RandomAccessIterator1 __first, + _RandomAccessIterator1 __last, + _RandomAccessIterator2 __result, _Distance __step_size, + _Compare __comp) + { + const _Distance __two_step = 2 * __step_size; + + while (__last - __first >= __two_step) + { + __result = std::__move_merge(__first, __first + __step_size, + __first + __step_size, + __first + __two_step, + __result, __comp); + __first += __two_step; + } + __step_size = std::min(_Distance(__last - __first), __step_size); + + std::__move_merge(__first, __first + __step_size, + __first + __step_size, __last, __result, __comp); + } + + template + void + __chunk_insertion_sort(_RandomAccessIterator __first, + _RandomAccessIterator __last, + _Distance __chunk_size, _Compare __comp) + { + while (__last - __first >= __chunk_size) + { + std::__insertion_sort(__first, __first + __chunk_size, __comp); + __first += __chunk_size; + } + std::__insertion_sort(__first, __last, __comp); + } + + enum { _S_chunk_size = 7 }; + + template + void + __merge_sort_with_buffer(_RandomAccessIterator __first, + _RandomAccessIterator __last, + _Pointer __buffer, _Compare __comp) + { + typedef typename iterator_traits<_RandomAccessIterator>::difference_type + _Distance; + + const _Distance __len = __last - __first; + const _Pointer __buffer_last = __buffer + __len; + + _Distance __step_size = _S_chunk_size; + std::__chunk_insertion_sort(__first, __last, __step_size, __comp); + + while (__step_size < __len) + { + std::__merge_sort_loop(__first, __last, __buffer, + __step_size, __comp); + __step_size *= 2; + std::__merge_sort_loop(__buffer, __buffer_last, __first, + __step_size, __comp); + __step_size *= 2; + } + } + + template + void + __stable_sort_adaptive(_RandomAccessIterator __first, + _RandomAccessIterator __last, + _Pointer __buffer, _Distance __buffer_size, + _Compare __comp) + { + const _Distance __len = (__last - __first + 1) / 2; + const _RandomAccessIterator __middle = __first + __len; + if (__len > __buffer_size) + { + std::__stable_sort_adaptive(__first, __middle, __buffer, + __buffer_size, __comp); + std::__stable_sort_adaptive(__middle, __last, __buffer, + __buffer_size, __comp); + } + else + { + std::__merge_sort_with_buffer(__first, __middle, __buffer, __comp); + std::__merge_sort_with_buffer(__middle, __last, __buffer, __comp); + } + std::__merge_adaptive(__first, __middle, __last, + _Distance(__middle - __first), + _Distance(__last - __middle), + __buffer, __buffer_size, + __comp); + } + + /// This is a helper function for the stable sorting routines. + template + void + __inplace_stable_sort(_RandomAccessIterator __first, + _RandomAccessIterator __last, _Compare __comp) + { + if (__last - __first < 15) + { + std::__insertion_sort(__first, __last, __comp); + return; + } + _RandomAccessIterator __middle = __first + (__last - __first) / 2; + std::__inplace_stable_sort(__first, __middle, __comp); + std::__inplace_stable_sort(__middle, __last, __comp); + std::__merge_without_buffer(__first, __middle, __last, + __middle - __first, + __last - __middle, + __comp); + } + + // stable_sort + + // Set algorithms: includes, set_union, set_intersection, set_difference, + // set_symmetric_difference. All of these algorithms have the precondition + // that their input ranges are sorted and the postcondition that their output + // ranges are sorted. + + template + bool + __includes(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _Compare __comp) + { + while (__first1 != __last1 && __first2 != __last2) + if (__comp(__first2, __first1)) + return false; + else if (__comp(__first1, __first2)) + ++__first1; + else + { + ++__first1; + ++__first2; + } + + return __first2 == __last2; + } + + /** + * @brief Determines whether all elements of a sequence exists in a range. + * @param __first1 Start of search range. + * @param __last1 End of search range. + * @param __first2 Start of sequence + * @param __last2 End of sequence. + * @return True if each element in [__first2,__last2) is contained in order + * within [__first1,__last1). False otherwise. + * @ingroup set_algorithms + * + * This operation expects both [__first1,__last1) and + * [__first2,__last2) to be sorted. Searches for the presence of + * each element in [__first2,__last2) within [__first1,__last1). + * The iterators over each range only move forward, so this is a + * linear algorithm. If an element in [__first2,__last2) is not + * found before the search iterator reaches @p __last2, false is + * returned. + */ + template + inline bool + includes(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) + __glibcxx_function_requires(_LessThanOpConcept< + typename iterator_traits<_InputIterator1>::value_type, + typename iterator_traits<_InputIterator2>::value_type>) + __glibcxx_function_requires(_LessThanOpConcept< + typename iterator_traits<_InputIterator2>::value_type, + typename iterator_traits<_InputIterator1>::value_type>) + __glibcxx_requires_sorted_set(__first1, __last1, __first2); + __glibcxx_requires_sorted_set(__first2, __last2, __first1); + __glibcxx_requires_irreflexive2(__first1, __last1); + __glibcxx_requires_irreflexive2(__first2, __last2); + + return std::__includes(__first1, __last1, __first2, __last2, + __gnu_cxx::__ops::__iter_less_iter()); + } + + /** + * @brief Determines whether all elements of a sequence exists in a range + * using comparison. + * @ingroup set_algorithms + * @param __first1 Start of search range. + * @param __last1 End of search range. + * @param __first2 Start of sequence + * @param __last2 End of sequence. + * @param __comp Comparison function to use. + * @return True if each element in [__first2,__last2) is contained + * in order within [__first1,__last1) according to comp. False + * otherwise. @ingroup set_algorithms + * + * This operation expects both [__first1,__last1) and + * [__first2,__last2) to be sorted. Searches for the presence of + * each element in [__first2,__last2) within [__first1,__last1), + * using comp to decide. The iterators over each range only move + * forward, so this is a linear algorithm. If an element in + * [__first2,__last2) is not found before the search iterator + * reaches @p __last2, false is returned. + */ + template + inline bool + includes(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_InputIterator1>::value_type, + typename iterator_traits<_InputIterator2>::value_type>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_InputIterator2>::value_type, + typename iterator_traits<_InputIterator1>::value_type>) + __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); + __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); + __glibcxx_requires_irreflexive_pred2(__first1, __last1, __comp); + __glibcxx_requires_irreflexive_pred2(__first2, __last2, __comp); + + return std::__includes(__first1, __last1, __first2, __last2, + __gnu_cxx::__ops::__iter_comp_iter(__comp)); + } + + // nth_element + // merge + // set_difference + // set_intersection + // set_union + // stable_sort + // set_symmetric_difference + // min_element + // max_element + + template + bool + __next_permutation(_BidirectionalIterator __first, + _BidirectionalIterator __last, _Compare __comp) + { + if (__first == __last) + return false; + _BidirectionalIterator __i = __first; + ++__i; + if (__i == __last) + return false; + __i = __last; + --__i; + + for(;;) + { + _BidirectionalIterator __ii = __i; + --__i; + if (__comp(__i, __ii)) + { + _BidirectionalIterator __j = __last; + while (!__comp(__i, --__j)) + {} + std::iter_swap(__i, __j); + std::__reverse(__ii, __last, + std::__iterator_category(__first)); + return true; + } + if (__i == __first) + { + std::__reverse(__first, __last, + std::__iterator_category(__first)); + return false; + } + } + } + + /** + * @brief Permute range into the next @e dictionary ordering. + * @ingroup sorting_algorithms + * @param __first Start of range. + * @param __last End of range. + * @return False if wrapped to first permutation, true otherwise. + * + * Treats all permutations of the range as a set of @e dictionary sorted + * sequences. Permutes the current sequence into the next one of this set. + * Returns true if there are more sequences to generate. If the sequence + * is the largest of the set, the smallest is generated and false returned. + */ + template + inline bool + next_permutation(_BidirectionalIterator __first, + _BidirectionalIterator __last) + { + // concept requirements + __glibcxx_function_requires(_BidirectionalIteratorConcept< + _BidirectionalIterator>) + __glibcxx_function_requires(_LessThanComparableConcept< + typename iterator_traits<_BidirectionalIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive(__first, __last); + + return std::__next_permutation + (__first, __last, __gnu_cxx::__ops::__iter_less_iter()); + } + + /** + * @brief Permute range into the next @e dictionary ordering using + * comparison functor. + * @ingroup sorting_algorithms + * @param __first Start of range. + * @param __last End of range. + * @param __comp A comparison functor. + * @return False if wrapped to first permutation, true otherwise. + * + * Treats all permutations of the range [__first,__last) as a set of + * @e dictionary sorted sequences ordered by @p __comp. Permutes the current + * sequence into the next one of this set. Returns true if there are more + * sequences to generate. If the sequence is the largest of the set, the + * smallest is generated and false returned. + */ + template + inline bool + next_permutation(_BidirectionalIterator __first, + _BidirectionalIterator __last, _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_BidirectionalIteratorConcept< + _BidirectionalIterator>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_BidirectionalIterator>::value_type, + typename iterator_traits<_BidirectionalIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive_pred(__first, __last, __comp); + + return std::__next_permutation + (__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp)); + } + + template + bool + __prev_permutation(_BidirectionalIterator __first, + _BidirectionalIterator __last, _Compare __comp) + { + if (__first == __last) + return false; + _BidirectionalIterator __i = __first; + ++__i; + if (__i == __last) + return false; + __i = __last; + --__i; + + for(;;) + { + _BidirectionalIterator __ii = __i; + --__i; + if (__comp(__ii, __i)) + { + _BidirectionalIterator __j = __last; + while (!__comp(--__j, __i)) + {} + std::iter_swap(__i, __j); + std::__reverse(__ii, __last, + std::__iterator_category(__first)); + return true; + } + if (__i == __first) + { + std::__reverse(__first, __last, + std::__iterator_category(__first)); + return false; + } + } + } + + /** + * @brief Permute range into the previous @e dictionary ordering. + * @ingroup sorting_algorithms + * @param __first Start of range. + * @param __last End of range. + * @return False if wrapped to last permutation, true otherwise. + * + * Treats all permutations of the range as a set of @e dictionary sorted + * sequences. Permutes the current sequence into the previous one of this + * set. Returns true if there are more sequences to generate. If the + * sequence is the smallest of the set, the largest is generated and false + * returned. + */ + template + inline bool + prev_permutation(_BidirectionalIterator __first, + _BidirectionalIterator __last) + { + // concept requirements + __glibcxx_function_requires(_BidirectionalIteratorConcept< + _BidirectionalIterator>) + __glibcxx_function_requires(_LessThanComparableConcept< + typename iterator_traits<_BidirectionalIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive(__first, __last); + + return std::__prev_permutation(__first, __last, + __gnu_cxx::__ops::__iter_less_iter()); + } + + /** + * @brief Permute range into the previous @e dictionary ordering using + * comparison functor. + * @ingroup sorting_algorithms + * @param __first Start of range. + * @param __last End of range. + * @param __comp A comparison functor. + * @return False if wrapped to last permutation, true otherwise. + * + * Treats all permutations of the range [__first,__last) as a set of + * @e dictionary sorted sequences ordered by @p __comp. Permutes the current + * sequence into the previous one of this set. Returns true if there are + * more sequences to generate. If the sequence is the smallest of the set, + * the largest is generated and false returned. + */ + template + inline bool + prev_permutation(_BidirectionalIterator __first, + _BidirectionalIterator __last, _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_BidirectionalIteratorConcept< + _BidirectionalIterator>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_BidirectionalIterator>::value_type, + typename iterator_traits<_BidirectionalIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive_pred(__first, __last, __comp); + + return std::__prev_permutation(__first, __last, + __gnu_cxx::__ops::__iter_comp_iter(__comp)); + } + + // replace + // replace_if + + template + _OutputIterator + __replace_copy_if(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, + _Predicate __pred, const _Tp& __new_value) + { + for (; __first != __last; ++__first, (void)++__result) + if (__pred(__first)) + *__result = __new_value; + else + *__result = *__first; + return __result; + } + + /** + * @brief Copy a sequence, replacing each element of one value with another + * value. + * @param __first An input iterator. + * @param __last An input iterator. + * @param __result An output iterator. + * @param __old_value The value to be replaced. + * @param __new_value The replacement value. + * @return The end of the output sequence, @p result+(last-first). + * + * Copies each element in the input range @p [__first,__last) to the + * output range @p [__result,__result+(__last-__first)) replacing elements + * equal to @p __old_value with @p __new_value. + */ + template + inline _OutputIterator + replace_copy(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, + const _Tp& __old_value, const _Tp& __new_value) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator>::value_type>) + __glibcxx_function_requires(_EqualOpConcept< + typename iterator_traits<_InputIterator>::value_type, _Tp>) + __glibcxx_requires_valid_range(__first, __last); + + return std::__replace_copy_if(__first, __last, __result, + __gnu_cxx::__ops::__iter_equals_val(__old_value), + __new_value); + } + + /** + * @brief Copy a sequence, replacing each value for which a predicate + * returns true with another value. + * @ingroup mutating_algorithms + * @param __first An input iterator. + * @param __last An input iterator. + * @param __result An output iterator. + * @param __pred A predicate. + * @param __new_value The replacement value. + * @return The end of the output sequence, @p __result+(__last-__first). + * + * Copies each element in the range @p [__first,__last) to the range + * @p [__result,__result+(__last-__first)) replacing elements for which + * @p __pred returns true with @p __new_value. + */ + template + inline _OutputIterator + replace_copy_if(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, + _Predicate __pred, const _Tp& __new_value) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator>::value_type>) + __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, + typename iterator_traits<_InputIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + return std::__replace_copy_if(__first, __last, __result, + __gnu_cxx::__ops::__pred_iter(__pred), + __new_value); + } + + template + typename iterator_traits<_InputIterator>::difference_type + __count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) + { + typename iterator_traits<_InputIterator>::difference_type __n = 0; + for (; __first != __last; ++__first) + if (__pred(__first)) + ++__n; + return __n; + } + +#if __cplusplus >= 201103L + /** + * @brief Determines whether the elements of a sequence are sorted. + * @ingroup sorting_algorithms + * @param __first An iterator. + * @param __last Another iterator. + * @return True if the elements are sorted, false otherwise. + */ + template + inline bool + is_sorted(_ForwardIterator __first, _ForwardIterator __last) + { return std::is_sorted_until(__first, __last) == __last; } + + /** + * @brief Determines whether the elements of a sequence are sorted + * according to a comparison functor. + * @ingroup sorting_algorithms + * @param __first An iterator. + * @param __last Another iterator. + * @param __comp A comparison functor. + * @return True if the elements are sorted, false otherwise. + */ + template + inline bool + is_sorted(_ForwardIterator __first, _ForwardIterator __last, + _Compare __comp) + { return std::is_sorted_until(__first, __last, __comp) == __last; } + + template + _ForwardIterator + __is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, + _Compare __comp) + { + if (__first == __last) + return __last; + + _ForwardIterator __next = __first; + for (++__next; __next != __last; __first = __next, (void)++__next) + if (__comp(__next, __first)) + return __next; + return __next; + } + + /** + * @brief Determines the end of a sorted sequence. + * @ingroup sorting_algorithms + * @param __first An iterator. + * @param __last Another iterator. + * @return An iterator pointing to the last iterator i in [__first, __last) + * for which the range [__first, i) is sorted. + */ + template + inline _ForwardIterator + is_sorted_until(_ForwardIterator __first, _ForwardIterator __last) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_LessThanComparableConcept< + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive(__first, __last); + + return std::__is_sorted_until(__first, __last, + __gnu_cxx::__ops::__iter_less_iter()); + } + + /** + * @brief Determines the end of a sorted sequence using comparison functor. + * @ingroup sorting_algorithms + * @param __first An iterator. + * @param __last Another iterator. + * @param __comp A comparison functor. + * @return An iterator pointing to the last iterator i in [__first, __last) + * for which the range [__first, i) is sorted. + */ + template + inline _ForwardIterator + is_sorted_until(_ForwardIterator __first, _ForwardIterator __last, + _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_ForwardIterator>::value_type, + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive_pred(__first, __last, __comp); + + return std::__is_sorted_until(__first, __last, + __gnu_cxx::__ops::__iter_comp_iter(__comp)); + } + + /** + * @brief Determines min and max at once as an ordered pair. + * @ingroup sorting_algorithms + * @param __a A thing of arbitrary type. + * @param __b Another thing of arbitrary type. + * @return A pair(__b, __a) if __b is smaller than __a, pair(__a, + * __b) otherwise. + */ + template + _GLIBCXX14_CONSTEXPR + inline pair + minmax(const _Tp& __a, const _Tp& __b) + { + // concept requirements + __glibcxx_function_requires(_LessThanComparableConcept<_Tp>) + + return __b < __a ? pair(__b, __a) + : pair(__a, __b); + } + + /** + * @brief Determines min and max at once as an ordered pair. + * @ingroup sorting_algorithms + * @param __a A thing of arbitrary type. + * @param __b Another thing of arbitrary type. + * @param __comp A @link comparison_functors comparison functor @endlink. + * @return A pair(__b, __a) if __b is smaller than __a, pair(__a, + * __b) otherwise. + */ + template + _GLIBCXX14_CONSTEXPR + inline pair + minmax(const _Tp& __a, const _Tp& __b, _Compare __comp) + { + return __comp(__b, __a) ? pair(__b, __a) + : pair(__a, __b); + } + + template + _GLIBCXX14_CONSTEXPR + pair<_ForwardIterator, _ForwardIterator> + __minmax_element(_ForwardIterator __first, _ForwardIterator __last, + _Compare __comp) + { + _ForwardIterator __next = __first; + if (__first == __last + || ++__next == __last) + return std::make_pair(__first, __first); + + _ForwardIterator __min{}, __max{}; + if (__comp(__next, __first)) + { + __min = __next; + __max = __first; + } + else + { + __min = __first; + __max = __next; + } + + __first = __next; + ++__first; + + while (__first != __last) + { + __next = __first; + if (++__next == __last) + { + if (__comp(__first, __min)) + __min = __first; + else if (!__comp(__first, __max)) + __max = __first; + break; + } + + if (__comp(__next, __first)) + { + if (__comp(__next, __min)) + __min = __next; + if (!__comp(__first, __max)) + __max = __first; + } + else + { + if (__comp(__first, __min)) + __min = __first; + if (!__comp(__next, __max)) + __max = __next; + } + + __first = __next; + ++__first; + } + + return std::make_pair(__min, __max); + } + + /** + * @brief Return a pair of iterators pointing to the minimum and maximum + * elements in a range. + * @ingroup sorting_algorithms + * @param __first Start of range. + * @param __last End of range. + * @return make_pair(m, M), where m is the first iterator i in + * [__first, __last) such that no other element in the range is + * smaller, and where M is the last iterator i in [__first, __last) + * such that no other element in the range is larger. + */ + template + _GLIBCXX14_CONSTEXPR + inline pair<_ForwardIterator, _ForwardIterator> + minmax_element(_ForwardIterator __first, _ForwardIterator __last) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_LessThanComparableConcept< + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive(__first, __last); + + return std::__minmax_element(__first, __last, + __gnu_cxx::__ops::__iter_less_iter()); + } + + /** + * @brief Return a pair of iterators pointing to the minimum and maximum + * elements in a range. + * @ingroup sorting_algorithms + * @param __first Start of range. + * @param __last End of range. + * @param __comp Comparison functor. + * @return make_pair(m, M), where m is the first iterator i in + * [__first, __last) such that no other element in the range is + * smaller, and where M is the last iterator i in [__first, __last) + * such that no other element in the range is larger. + */ + template + _GLIBCXX14_CONSTEXPR + inline pair<_ForwardIterator, _ForwardIterator> + minmax_element(_ForwardIterator __first, _ForwardIterator __last, + _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_ForwardIterator>::value_type, + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive_pred(__first, __last, __comp); + + return std::__minmax_element(__first, __last, + __gnu_cxx::__ops::__iter_comp_iter(__comp)); + } + + // N2722 + DR 915. + template + _GLIBCXX14_CONSTEXPR + inline _Tp + min(initializer_list<_Tp> __l) + { return *std::min_element(__l.begin(), __l.end()); } + + template + _GLIBCXX14_CONSTEXPR + inline _Tp + min(initializer_list<_Tp> __l, _Compare __comp) + { return *std::min_element(__l.begin(), __l.end(), __comp); } + + template + _GLIBCXX14_CONSTEXPR + inline _Tp + max(initializer_list<_Tp> __l) + { return *std::max_element(__l.begin(), __l.end()); } + + template + _GLIBCXX14_CONSTEXPR + inline _Tp + max(initializer_list<_Tp> __l, _Compare __comp) + { return *std::max_element(__l.begin(), __l.end(), __comp); } + + template + _GLIBCXX14_CONSTEXPR + inline pair<_Tp, _Tp> + minmax(initializer_list<_Tp> __l) + { + pair __p = + std::minmax_element(__l.begin(), __l.end()); + return std::make_pair(*__p.first, *__p.second); + } + + template + _GLIBCXX14_CONSTEXPR + inline pair<_Tp, _Tp> + minmax(initializer_list<_Tp> __l, _Compare __comp) + { + pair __p = + std::minmax_element(__l.begin(), __l.end(), __comp); + return std::make_pair(*__p.first, *__p.second); + } + + template + bool + __is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _BinaryPredicate __pred) + { + // Efficiently compare identical prefixes: O(N) if sequences + // have the same elements in the same order. + for (; __first1 != __last1; ++__first1, (void)++__first2) + if (!__pred(__first1, __first2)) + break; + + if (__first1 == __last1) + return true; + + // Establish __last2 assuming equal ranges by iterating over the + // rest of the list. + _ForwardIterator2 __last2 = __first2; + std::advance(__last2, std::distance(__first1, __last1)); + for (_ForwardIterator1 __scan = __first1; __scan != __last1; ++__scan) + { + if (__scan != std::__find_if(__first1, __scan, + __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan))) + continue; // We've seen this one before. + + auto __matches + = std::__count_if(__first2, __last2, + __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan)); + if (0 == __matches || + std::__count_if(__scan, __last1, + __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan)) + != __matches) + return false; + } + return true; + } + + /** + * @brief Checks whether a permutation of the second sequence is equal + * to the first sequence. + * @ingroup non_mutating_algorithms + * @param __first1 Start of first range. + * @param __last1 End of first range. + * @param __first2 Start of second range. + * @return true if there exists a permutation of the elements in the range + * [__first2, __first2 + (__last1 - __first1)), beginning with + * ForwardIterator2 begin, such that equal(__first1, __last1, begin) + * returns true; otherwise, returns false. + */ + template + inline bool + is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) + __glibcxx_function_requires(_EqualOpConcept< + typename iterator_traits<_ForwardIterator1>::value_type, + typename iterator_traits<_ForwardIterator2>::value_type>) + __glibcxx_requires_valid_range(__first1, __last1); + + return std::__is_permutation(__first1, __last1, __first2, + __gnu_cxx::__ops::__iter_equal_to_iter()); + } + + /** + * @brief Checks whether a permutation of the second sequence is equal + * to the first sequence. + * @ingroup non_mutating_algorithms + * @param __first1 Start of first range. + * @param __last1 End of first range. + * @param __first2 Start of second range. + * @param __pred A binary predicate. + * @return true if there exists a permutation of the elements in + * the range [__first2, __first2 + (__last1 - __first1)), + * beginning with ForwardIterator2 begin, such that + * equal(__first1, __last1, __begin, __pred) returns true; + * otherwise, returns false. + */ + template + inline bool + is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _BinaryPredicate __pred) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) + __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, + typename iterator_traits<_ForwardIterator1>::value_type, + typename iterator_traits<_ForwardIterator2>::value_type>) + __glibcxx_requires_valid_range(__first1, __last1); + + return std::__is_permutation(__first1, __last1, __first2, + __gnu_cxx::__ops::__iter_comp_iter(__pred)); + } + +#if __cplusplus > 201103L + template + bool + __is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _ForwardIterator2 __last2, + _BinaryPredicate __pred) + { + using _Cat1 + = typename iterator_traits<_ForwardIterator1>::iterator_category; + using _Cat2 + = typename iterator_traits<_ForwardIterator2>::iterator_category; + using _It1_is_RA = is_same<_Cat1, random_access_iterator_tag>; + using _It2_is_RA = is_same<_Cat2, random_access_iterator_tag>; + constexpr bool __ra_iters = _It1_is_RA() && _It2_is_RA(); + if (__ra_iters) + { + auto __d1 = std::distance(__first1, __last1); + auto __d2 = std::distance(__first2, __last2); + if (__d1 != __d2) + return false; + } + + // Efficiently compare identical prefixes: O(N) if sequences + // have the same elements in the same order. + for (; __first1 != __last1 && __first2 != __last2; + ++__first1, (void)++__first2) + if (!__pred(__first1, __first2)) + break; + + if (__ra_iters) + { + if (__first1 == __last1) + return true; + } + else + { + auto __d1 = std::distance(__first1, __last1); + auto __d2 = std::distance(__first2, __last2); + if (__d1 == 0 && __d2 == 0) + return true; + if (__d1 != __d2) + return false; + } + + for (_ForwardIterator1 __scan = __first1; __scan != __last1; ++__scan) + { + if (__scan != std::__find_if(__first1, __scan, + __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan))) + continue; // We've seen this one before. + + auto __matches = std::__count_if(__first2, __last2, + __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan)); + if (0 == __matches + || std::__count_if(__scan, __last1, + __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan)) + != __matches) + return false; + } + return true; + } + + /** + * @brief Checks whether a permutaion of the second sequence is equal + * to the first sequence. + * @ingroup non_mutating_algorithms + * @param __first1 Start of first range. + * @param __last1 End of first range. + * @param __first2 Start of second range. + * @param __last2 End of first range. + * @return true if there exists a permutation of the elements in the range + * [__first2, __last2), beginning with ForwardIterator2 begin, + * such that equal(__first1, __last1, begin) returns true; + * otherwise, returns false. + */ + template + inline bool + is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _ForwardIterator2 __last2) + { + __glibcxx_requires_valid_range(__first1, __last1); + __glibcxx_requires_valid_range(__first2, __last2); + + return + std::__is_permutation(__first1, __last1, __first2, __last2, + __gnu_cxx::__ops::__iter_equal_to_iter()); + } + + /** + * @brief Checks whether a permutation of the second sequence is equal + * to the first sequence. + * @ingroup non_mutating_algorithms + * @param __first1 Start of first range. + * @param __last1 End of first range. + * @param __first2 Start of second range. + * @param __last2 End of first range. + * @param __pred A binary predicate. + * @return true if there exists a permutation of the elements in the range + * [__first2, __last2), beginning with ForwardIterator2 begin, + * such that equal(__first1, __last1, __begin, __pred) returns true; + * otherwise, returns false. + */ + template + inline bool + is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _ForwardIterator2 __last2, + _BinaryPredicate __pred) + { + __glibcxx_requires_valid_range(__first1, __last1); + __glibcxx_requires_valid_range(__first2, __last2); + + return std::__is_permutation(__first1, __last1, __first2, __last2, + __gnu_cxx::__ops::__iter_comp_iter(__pred)); + } + +#if __cplusplus > 201402L + +#define __cpp_lib_clamp 201603 + + /** + * @brief Returns the value clamped between lo and hi. + * @ingroup sorting_algorithms + * @param __val A value of arbitrary type. + * @param __lo A lower limit of arbitrary type. + * @param __hi An upper limit of arbitrary type. + * @return max(__val, __lo) if __val < __hi or min(__val, __hi) otherwise. + */ + template + constexpr const _Tp& + clamp(const _Tp& __val, const _Tp& __lo, const _Tp& __hi) + { + __glibcxx_assert(!(__hi < __lo)); + return (__val < __lo) ? __lo : (__hi < __val) ? __hi : __val; + } + + /** + * @brief Returns the value clamped between lo and hi. + * @ingroup sorting_algorithms + * @param __val A value of arbitrary type. + * @param __lo A lower limit of arbitrary type. + * @param __hi An upper limit of arbitrary type. + * @param __comp A comparison functor. + * @return max(__val, __lo, __comp) if __comp(__val, __hi) + * or min(__val, __hi, __comp) otherwise. + */ + template + constexpr const _Tp& + clamp(const _Tp& __val, const _Tp& __lo, const _Tp& __hi, _Compare __comp) + { + __glibcxx_assert(!__comp(__hi, __lo)); + return __comp(__val, __lo) ? __lo : __comp(__hi, __val) ? __hi : __val; + } +#endif // C++17 +#endif // C++14 + +#ifdef _GLIBCXX_USE_C99_STDINT_TR1 + /** + * @brief Generate two uniformly distributed integers using a + * single distribution invocation. + * @param __b0 The upper bound for the first integer. + * @param __b1 The upper bound for the second integer. + * @param __g A UniformRandomBitGenerator. + * @return A pair (i, j) with i and j uniformly distributed + * over [0, __b0) and [0, __b1), respectively. + * + * Requires: __b0 * __b1 <= __g.max() - __g.min(). + * + * Using uniform_int_distribution with a range that is very + * small relative to the range of the generator ends up wasting + * potentially expensively generated randomness, since + * uniform_int_distribution does not store leftover randomness + * between invocations. + * + * If we know we want two integers in ranges that are sufficiently + * small, we can compose the ranges, use a single distribution + * invocation, and significantly reduce the waste. + */ + template + pair<_IntType, _IntType> + __gen_two_uniform_ints(_IntType __b0, _IntType __b1, + _UniformRandomBitGenerator&& __g) + { + _IntType __x + = uniform_int_distribution<_IntType>{0, (__b0 * __b1) - 1}(__g); + return std::make_pair(__x / __b1, __x % __b1); + } + + /** + * @brief Shuffle the elements of a sequence using a uniform random + * number generator. + * @ingroup mutating_algorithms + * @param __first A forward iterator. + * @param __last A forward iterator. + * @param __g A UniformRandomNumberGenerator (26.5.1.3). + * @return Nothing. + * + * Reorders the elements in the range @p [__first,__last) using @p __g to + * provide random numbers. + */ + template + void + shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, + _UniformRandomNumberGenerator&& __g) + { + // concept requirements + __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __glibcxx_requires_valid_range(__first, __last); + + if (__first == __last) + return; + + typedef typename iterator_traits<_RandomAccessIterator>::difference_type + _DistanceType; + + typedef typename std::make_unsigned<_DistanceType>::type __ud_type; + typedef typename std::uniform_int_distribution<__ud_type> __distr_type; + typedef typename __distr_type::param_type __p_type; + + typedef typename remove_reference<_UniformRandomNumberGenerator>::type + _Gen; + typedef typename common_type::type + __uc_type; + + const __uc_type __urngrange = __g.max() - __g.min(); + const __uc_type __urange = __uc_type(__last - __first); + + if (__urngrange / __urange >= __urange) + // I.e. (__urngrange >= __urange * __urange) but without wrap issues. + { + _RandomAccessIterator __i = __first + 1; + + // Since we know the range isn't empty, an even number of elements + // means an uneven number of elements /to swap/, in which case we + // do the first one up front: + + if ((__urange % 2) == 0) + { + __distr_type __d{0, 1}; + std::iter_swap(__i++, __first + __d(__g)); + } + + // Now we know that __last - __i is even, so we do the rest in pairs, + // using a single distribution invocation to produce swap positions + // for two successive elements at a time: + + while (__i != __last) + { + const __uc_type __swap_range = __uc_type(__i - __first) + 1; + + const pair<__uc_type, __uc_type> __pospos = + __gen_two_uniform_ints(__swap_range, __swap_range + 1, __g); + + std::iter_swap(__i++, __first + __pospos.first); + std::iter_swap(__i++, __first + __pospos.second); + } + + return; + } + + __distr_type __d; + + for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i) + std::iter_swap(__i, __first + __d(__g, __p_type(0, __i - __first))); + } +#endif + +#endif // C++11 + +_GLIBCXX_END_NAMESPACE_VERSION + +_GLIBCXX_BEGIN_NAMESPACE_ALGO + + /** + * @brief Apply a function to every element of a sequence. + * @ingroup non_mutating_algorithms + * @param __first An input iterator. + * @param __last An input iterator. + * @param __f A unary function object. + * @return @p __f + * + * Applies the function object @p __f to each element in the range + * @p [first,last). @p __f must not modify the order of the sequence. + * If @p __f has a return value it is ignored. + */ + template + _Function + for_each(_InputIterator __first, _InputIterator __last, _Function __f) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_requires_valid_range(__first, __last); + for (; __first != __last; ++__first) + __f(*__first); + return __f; // N.B. [alg.foreach] says std::move(f) but it's redundant. + } + + /** + * @brief Find the first occurrence of a value in a sequence. + * @ingroup non_mutating_algorithms + * @param __first An input iterator. + * @param __last An input iterator. + * @param __val The value to find. + * @return The first iterator @c i in the range @p [__first,__last) + * such that @c *i == @p __val, or @p __last if no such iterator exists. + */ + template + inline _InputIterator + find(_InputIterator __first, _InputIterator __last, + const _Tp& __val) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_EqualOpConcept< + typename iterator_traits<_InputIterator>::value_type, _Tp>) + __glibcxx_requires_valid_range(__first, __last); + return std::__find_if(__first, __last, + __gnu_cxx::__ops::__iter_equals_val(__val)); + } + + /** + * @brief Find the first element in a sequence for which a + * predicate is true. + * @ingroup non_mutating_algorithms + * @param __first An input iterator. + * @param __last An input iterator. + * @param __pred A predicate. + * @return The first iterator @c i in the range @p [__first,__last) + * such that @p __pred(*i) is true, or @p __last if no such iterator exists. + */ + template + inline _InputIterator + find_if(_InputIterator __first, _InputIterator __last, + _Predicate __pred) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, + typename iterator_traits<_InputIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + return std::__find_if(__first, __last, + __gnu_cxx::__ops::__pred_iter(__pred)); + } + + /** + * @brief Find element from a set in a sequence. + * @ingroup non_mutating_algorithms + * @param __first1 Start of range to search. + * @param __last1 End of range to search. + * @param __first2 Start of match candidates. + * @param __last2 End of match candidates. + * @return The first iterator @c i in the range + * @p [__first1,__last1) such that @c *i == @p *(i2) such that i2 is an + * iterator in [__first2,__last2), or @p __last1 if no such iterator exists. + * + * Searches the range @p [__first1,__last1) for an element that is + * equal to some element in the range [__first2,__last2). If + * found, returns an iterator in the range [__first1,__last1), + * otherwise returns @p __last1. + */ + template + _InputIterator + find_first_of(_InputIterator __first1, _InputIterator __last1, + _ForwardIterator __first2, _ForwardIterator __last2) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_EqualOpConcept< + typename iterator_traits<_InputIterator>::value_type, + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_valid_range(__first1, __last1); + __glibcxx_requires_valid_range(__first2, __last2); + + for (; __first1 != __last1; ++__first1) + for (_ForwardIterator __iter = __first2; __iter != __last2; ++__iter) + if (*__first1 == *__iter) + return __first1; + return __last1; + } + + /** + * @brief Find element from a set in a sequence using a predicate. + * @ingroup non_mutating_algorithms + * @param __first1 Start of range to search. + * @param __last1 End of range to search. + * @param __first2 Start of match candidates. + * @param __last2 End of match candidates. + * @param __comp Predicate to use. + * @return The first iterator @c i in the range + * @p [__first1,__last1) such that @c comp(*i, @p *(i2)) is true + * and i2 is an iterator in [__first2,__last2), or @p __last1 if no + * such iterator exists. + * + + * Searches the range @p [__first1,__last1) for an element that is + * equal to some element in the range [__first2,__last2). If + * found, returns an iterator in the range [__first1,__last1), + * otherwise returns @p __last1. + */ + template + _InputIterator + find_first_of(_InputIterator __first1, _InputIterator __last1, + _ForwardIterator __first2, _ForwardIterator __last2, + _BinaryPredicate __comp) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, + typename iterator_traits<_InputIterator>::value_type, + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_valid_range(__first1, __last1); + __glibcxx_requires_valid_range(__first2, __last2); + + for (; __first1 != __last1; ++__first1) + for (_ForwardIterator __iter = __first2; __iter != __last2; ++__iter) + if (__comp(*__first1, *__iter)) + return __first1; + return __last1; + } + + /** + * @brief Find two adjacent values in a sequence that are equal. + * @ingroup non_mutating_algorithms + * @param __first A forward iterator. + * @param __last A forward iterator. + * @return The first iterator @c i such that @c i and @c i+1 are both + * valid iterators in @p [__first,__last) and such that @c *i == @c *(i+1), + * or @p __last if no such iterator exists. + */ + template + inline _ForwardIterator + adjacent_find(_ForwardIterator __first, _ForwardIterator __last) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_EqualityComparableConcept< + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + return std::__adjacent_find(__first, __last, + __gnu_cxx::__ops::__iter_equal_to_iter()); + } + + /** + * @brief Find two adjacent values in a sequence using a predicate. + * @ingroup non_mutating_algorithms + * @param __first A forward iterator. + * @param __last A forward iterator. + * @param __binary_pred A binary predicate. + * @return The first iterator @c i such that @c i and @c i+1 are both + * valid iterators in @p [__first,__last) and such that + * @p __binary_pred(*i,*(i+1)) is true, or @p __last if no such iterator + * exists. + */ + template + inline _ForwardIterator + adjacent_find(_ForwardIterator __first, _ForwardIterator __last, + _BinaryPredicate __binary_pred) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, + typename iterator_traits<_ForwardIterator>::value_type, + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + return std::__adjacent_find(__first, __last, + __gnu_cxx::__ops::__iter_comp_iter(__binary_pred)); + } + + /** + * @brief Count the number of copies of a value in a sequence. + * @ingroup non_mutating_algorithms + * @param __first An input iterator. + * @param __last An input iterator. + * @param __value The value to be counted. + * @return The number of iterators @c i in the range @p [__first,__last) + * for which @c *i == @p __value + */ + template + inline typename iterator_traits<_InputIterator>::difference_type + count(_InputIterator __first, _InputIterator __last, const _Tp& __value) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_EqualOpConcept< + typename iterator_traits<_InputIterator>::value_type, _Tp>) + __glibcxx_requires_valid_range(__first, __last); + + return std::__count_if(__first, __last, + __gnu_cxx::__ops::__iter_equals_val(__value)); + } + + /** + * @brief Count the elements of a sequence for which a predicate is true. + * @ingroup non_mutating_algorithms + * @param __first An input iterator. + * @param __last An input iterator. + * @param __pred A predicate. + * @return The number of iterators @c i in the range @p [__first,__last) + * for which @p __pred(*i) is true. + */ + template + inline typename iterator_traits<_InputIterator>::difference_type + count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, + typename iterator_traits<_InputIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + return std::__count_if(__first, __last, + __gnu_cxx::__ops::__pred_iter(__pred)); + } + + /** + * @brief Search a sequence for a matching sub-sequence. + * @ingroup non_mutating_algorithms + * @param __first1 A forward iterator. + * @param __last1 A forward iterator. + * @param __first2 A forward iterator. + * @param __last2 A forward iterator. + * @return The first iterator @c i in the range @p + * [__first1,__last1-(__last2-__first2)) such that @c *(i+N) == @p + * *(__first2+N) for each @c N in the range @p + * [0,__last2-__first2), or @p __last1 if no such iterator exists. + * + * Searches the range @p [__first1,__last1) for a sub-sequence that + * compares equal value-by-value with the sequence given by @p + * [__first2,__last2) and returns an iterator to the first element + * of the sub-sequence, or @p __last1 if the sub-sequence is not + * found. + * + * Because the sub-sequence must lie completely within the range @p + * [__first1,__last1) it must start at a position less than @p + * __last1-(__last2-__first2) where @p __last2-__first2 is the + * length of the sub-sequence. + * + * This means that the returned iterator @c i will be in the range + * @p [__first1,__last1-(__last2-__first2)) + */ + template + inline _ForwardIterator1 + search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _ForwardIterator2 __last2) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) + __glibcxx_function_requires(_EqualOpConcept< + typename iterator_traits<_ForwardIterator1>::value_type, + typename iterator_traits<_ForwardIterator2>::value_type>) + __glibcxx_requires_valid_range(__first1, __last1); + __glibcxx_requires_valid_range(__first2, __last2); + + return std::__search(__first1, __last1, __first2, __last2, + __gnu_cxx::__ops::__iter_equal_to_iter()); + } + + /** + * @brief Search a sequence for a matching sub-sequence using a predicate. + * @ingroup non_mutating_algorithms + * @param __first1 A forward iterator. + * @param __last1 A forward iterator. + * @param __first2 A forward iterator. + * @param __last2 A forward iterator. + * @param __predicate A binary predicate. + * @return The first iterator @c i in the range + * @p [__first1,__last1-(__last2-__first2)) such that + * @p __predicate(*(i+N),*(__first2+N)) is true for each @c N in the range + * @p [0,__last2-__first2), or @p __last1 if no such iterator exists. + * + * Searches the range @p [__first1,__last1) for a sub-sequence that + * compares equal value-by-value with the sequence given by @p + * [__first2,__last2), using @p __predicate to determine equality, + * and returns an iterator to the first element of the + * sub-sequence, or @p __last1 if no such iterator exists. + * + * @see search(_ForwardIter1, _ForwardIter1, _ForwardIter2, _ForwardIter2) + */ + template + inline _ForwardIterator1 + search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2, _ForwardIterator2 __last2, + _BinaryPredicate __predicate) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>) + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>) + __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, + typename iterator_traits<_ForwardIterator1>::value_type, + typename iterator_traits<_ForwardIterator2>::value_type>) + __glibcxx_requires_valid_range(__first1, __last1); + __glibcxx_requires_valid_range(__first2, __last2); + + return std::__search(__first1, __last1, __first2, __last2, + __gnu_cxx::__ops::__iter_comp_iter(__predicate)); + } + + /** + * @brief Search a sequence for a number of consecutive values. + * @ingroup non_mutating_algorithms + * @param __first A forward iterator. + * @param __last A forward iterator. + * @param __count The number of consecutive values. + * @param __val The value to find. + * @return The first iterator @c i in the range @p + * [__first,__last-__count) such that @c *(i+N) == @p __val for + * each @c N in the range @p [0,__count), or @p __last if no such + * iterator exists. + * + * Searches the range @p [__first,__last) for @p count consecutive elements + * equal to @p __val. + */ + template + inline _ForwardIterator + search_n(_ForwardIterator __first, _ForwardIterator __last, + _Integer __count, const _Tp& __val) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_EqualOpConcept< + typename iterator_traits<_ForwardIterator>::value_type, _Tp>) + __glibcxx_requires_valid_range(__first, __last); + + return std::__search_n(__first, __last, __count, + __gnu_cxx::__ops::__iter_equals_val(__val)); + } + + + /** + * @brief Search a sequence for a number of consecutive values using a + * predicate. + * @ingroup non_mutating_algorithms + * @param __first A forward iterator. + * @param __last A forward iterator. + * @param __count The number of consecutive values. + * @param __val The value to find. + * @param __binary_pred A binary predicate. + * @return The first iterator @c i in the range @p + * [__first,__last-__count) such that @p + * __binary_pred(*(i+N),__val) is true for each @c N in the range + * @p [0,__count), or @p __last if no such iterator exists. + * + * Searches the range @p [__first,__last) for @p __count + * consecutive elements for which the predicate returns true. + */ + template + inline _ForwardIterator + search_n(_ForwardIterator __first, _ForwardIterator __last, + _Integer __count, const _Tp& __val, + _BinaryPredicate __binary_pred) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate, + typename iterator_traits<_ForwardIterator>::value_type, _Tp>) + __glibcxx_requires_valid_range(__first, __last); + + return std::__search_n(__first, __last, __count, + __gnu_cxx::__ops::__iter_comp_val(__binary_pred, __val)); + } + +#if __cplusplus > 201402L + /** @brief Search a sequence using a Searcher object. + * + * @param __first A forward iterator. + * @param __last A forward iterator. + * @param __searcher A callable object. + * @return @p __searcher(__first,__last).first + */ + template + inline _ForwardIterator + search(_ForwardIterator __first, _ForwardIterator __last, + const _Searcher& __searcher) + { return __searcher(__first, __last).first; } +#endif + + /** + * @brief Perform an operation on a sequence. + * @ingroup mutating_algorithms + * @param __first An input iterator. + * @param __last An input iterator. + * @param __result An output iterator. + * @param __unary_op A unary operator. + * @return An output iterator equal to @p __result+(__last-__first). + * + * Applies the operator to each element in the input range and assigns + * the results to successive elements of the output sequence. + * Evaluates @p *(__result+N)=unary_op(*(__first+N)) for each @c N in the + * range @p [0,__last-__first). + * + * @p unary_op must not alter its argument. + */ + template + _OutputIterator + transform(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _UnaryOperation __unary_op) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + // "the type returned by a _UnaryOperation" + __typeof__(__unary_op(*__first))>) + __glibcxx_requires_valid_range(__first, __last); + + for (; __first != __last; ++__first, (void)++__result) + *__result = __unary_op(*__first); + return __result; + } + + /** + * @brief Perform an operation on corresponding elements of two sequences. + * @ingroup mutating_algorithms + * @param __first1 An input iterator. + * @param __last1 An input iterator. + * @param __first2 An input iterator. + * @param __result An output iterator. + * @param __binary_op A binary operator. + * @return An output iterator equal to @p result+(last-first). + * + * Applies the operator to the corresponding elements in the two + * input ranges and assigns the results to successive elements of the + * output sequence. + * Evaluates @p + * *(__result+N)=__binary_op(*(__first1+N),*(__first2+N)) for each + * @c N in the range @p [0,__last1-__first1). + * + * @p binary_op must not alter either of its arguments. + */ + template + _OutputIterator + transform(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _OutputIterator __result, + _BinaryOperation __binary_op) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + // "the type returned by a _BinaryOperation" + __typeof__(__binary_op(*__first1,*__first2))>) + __glibcxx_requires_valid_range(__first1, __last1); + + for (; __first1 != __last1; ++__first1, (void)++__first2, ++__result) + *__result = __binary_op(*__first1, *__first2); + return __result; + } + + /** + * @brief Replace each occurrence of one value in a sequence with another + * value. + * @ingroup mutating_algorithms + * @param __first A forward iterator. + * @param __last A forward iterator. + * @param __old_value The value to be replaced. + * @param __new_value The replacement value. + * @return replace() returns no value. + * + * For each iterator @c i in the range @p [__first,__last) if @c *i == + * @p __old_value then the assignment @c *i = @p __new_value is performed. + */ + template + void + replace(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __old_value, const _Tp& __new_value) + { + // concept requirements + __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< + _ForwardIterator>) + __glibcxx_function_requires(_EqualOpConcept< + typename iterator_traits<_ForwardIterator>::value_type, _Tp>) + __glibcxx_function_requires(_ConvertibleConcept<_Tp, + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + for (; __first != __last; ++__first) + if (*__first == __old_value) + *__first = __new_value; + } + + /** + * @brief Replace each value in a sequence for which a predicate returns + * true with another value. + * @ingroup mutating_algorithms + * @param __first A forward iterator. + * @param __last A forward iterator. + * @param __pred A predicate. + * @param __new_value The replacement value. + * @return replace_if() returns no value. + * + * For each iterator @c i in the range @p [__first,__last) if @p __pred(*i) + * is true then the assignment @c *i = @p __new_value is performed. + */ + template + void + replace_if(_ForwardIterator __first, _ForwardIterator __last, + _Predicate __pred, const _Tp& __new_value) + { + // concept requirements + __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< + _ForwardIterator>) + __glibcxx_function_requires(_ConvertibleConcept<_Tp, + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + for (; __first != __last; ++__first) + if (__pred(*__first)) + *__first = __new_value; + } + + /** + * @brief Assign the result of a function object to each value in a + * sequence. + * @ingroup mutating_algorithms + * @param __first A forward iterator. + * @param __last A forward iterator. + * @param __gen A function object taking no arguments and returning + * std::iterator_traits<_ForwardIterator>::value_type + * @return generate() returns no value. + * + * Performs the assignment @c *i = @p __gen() for each @c i in the range + * @p [__first,__last). + */ + template + void + generate(_ForwardIterator __first, _ForwardIterator __last, + _Generator __gen) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_GeneratorConcept<_Generator, + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + for (; __first != __last; ++__first) + *__first = __gen(); + } + + /** + * @brief Assign the result of a function object to each value in a + * sequence. + * @ingroup mutating_algorithms + * @param __first A forward iterator. + * @param __n The length of the sequence. + * @param __gen A function object taking no arguments and returning + * std::iterator_traits<_ForwardIterator>::value_type + * @return The end of the sequence, @p __first+__n + * + * Performs the assignment @c *i = @p __gen() for each @c i in the range + * @p [__first,__first+__n). + * + * _GLIBCXX_RESOLVE_LIB_DEFECTS + * DR 865. More algorithms that throw away information + */ + template + _OutputIterator + generate_n(_OutputIterator __first, _Size __n, _Generator __gen) + { + // concept requirements + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + // "the type returned by a _Generator" + __typeof__(__gen())>) + + for (__decltype(__n + 0) __niter = __n; + __niter > 0; --__niter, ++__first) + *__first = __gen(); + return __first; + } + + /** + * @brief Copy a sequence, removing consecutive duplicate values. + * @ingroup mutating_algorithms + * @param __first An input iterator. + * @param __last An input iterator. + * @param __result An output iterator. + * @return An iterator designating the end of the resulting sequence. + * + * Copies each element in the range @p [__first,__last) to the range + * beginning at @p __result, except that only the first element is copied + * from groups of consecutive elements that compare equal. + * unique_copy() is stable, so the relative order of elements that are + * copied is unchanged. + * + * _GLIBCXX_RESOLVE_LIB_DEFECTS + * DR 241. Does unique_copy() require CopyConstructible and Assignable? + * + * _GLIBCXX_RESOLVE_LIB_DEFECTS + * DR 538. 241 again: Does unique_copy() require CopyConstructible and + * Assignable? + */ + template + inline _OutputIterator + unique_copy(_InputIterator __first, _InputIterator __last, + _OutputIterator __result) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator>::value_type>) + __glibcxx_function_requires(_EqualityComparableConcept< + typename iterator_traits<_InputIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + if (__first == __last) + return __result; + return std::__unique_copy(__first, __last, __result, + __gnu_cxx::__ops::__iter_equal_to_iter(), + std::__iterator_category(__first), + std::__iterator_category(__result)); + } + + /** + * @brief Copy a sequence, removing consecutive values using a predicate. + * @ingroup mutating_algorithms + * @param __first An input iterator. + * @param __last An input iterator. + * @param __result An output iterator. + * @param __binary_pred A binary predicate. + * @return An iterator designating the end of the resulting sequence. + * + * Copies each element in the range @p [__first,__last) to the range + * beginning at @p __result, except that only the first element is copied + * from groups of consecutive elements for which @p __binary_pred returns + * true. + * unique_copy() is stable, so the relative order of elements that are + * copied is unchanged. + * + * _GLIBCXX_RESOLVE_LIB_DEFECTS + * DR 241. Does unique_copy() require CopyConstructible and Assignable? + */ + template + inline _OutputIterator + unique_copy(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, + _BinaryPredicate __binary_pred) + { + // concept requirements -- predicates checked later + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + if (__first == __last) + return __result; + return std::__unique_copy(__first, __last, __result, + __gnu_cxx::__ops::__iter_comp_iter(__binary_pred), + std::__iterator_category(__first), + std::__iterator_category(__result)); + } + +#if _GLIBCXX_HOSTED + /** + * @brief Randomly shuffle the elements of a sequence. + * @ingroup mutating_algorithms + * @param __first A forward iterator. + * @param __last A forward iterator. + * @return Nothing. + * + * Reorder the elements in the range @p [__first,__last) using a random + * distribution, so that every possible ordering of the sequence is + * equally likely. + */ + template + inline void + random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last) + { + // concept requirements + __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __glibcxx_requires_valid_range(__first, __last); + + if (__first != __last) + for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i) + { + // XXX rand() % N is not uniformly distributed + _RandomAccessIterator __j = __first + + std::rand() % ((__i - __first) + 1); + if (__i != __j) + std::iter_swap(__i, __j); + } + } +#endif + + /** + * @brief Shuffle the elements of a sequence using a random number + * generator. + * @ingroup mutating_algorithms + * @param __first A forward iterator. + * @param __last A forward iterator. + * @param __rand The RNG functor or function. + * @return Nothing. + * + * Reorders the elements in the range @p [__first,__last) using @p __rand to + * provide a random distribution. Calling @p __rand(N) for a positive + * integer @p N should return a randomly chosen integer from the + * range [0,N). + */ + template + void + random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last, +#if __cplusplus >= 201103L + _RandomNumberGenerator&& __rand) +#else + _RandomNumberGenerator& __rand) +#endif + { + // concept requirements + __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __glibcxx_requires_valid_range(__first, __last); + + if (__first == __last) + return; + for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i) + { + _RandomAccessIterator __j = __first + __rand((__i - __first) + 1); + if (__i != __j) + std::iter_swap(__i, __j); + } + } + + + /** + * @brief Move elements for which a predicate is true to the beginning + * of a sequence. + * @ingroup mutating_algorithms + * @param __first A forward iterator. + * @param __last A forward iterator. + * @param __pred A predicate functor. + * @return An iterator @p middle such that @p __pred(i) is true for each + * iterator @p i in the range @p [__first,middle) and false for each @p i + * in the range @p [middle,__last). + * + * @p __pred must not modify its operand. @p partition() does not preserve + * the relative ordering of elements in each group, use + * @p stable_partition() if this is needed. + */ + template + inline _ForwardIterator + partition(_ForwardIterator __first, _ForwardIterator __last, + _Predicate __pred) + { + // concept requirements + __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< + _ForwardIterator>) + __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + return std::__partition(__first, __last, __pred, + std::__iterator_category(__first)); + } + + + /** + * @brief Sort the smallest elements of a sequence. + * @ingroup sorting_algorithms + * @param __first An iterator. + * @param __middle Another iterator. + * @param __last Another iterator. + * @return Nothing. + * + * Sorts the smallest @p (__middle-__first) elements in the range + * @p [first,last) and moves them to the range @p [__first,__middle). The + * order of the remaining elements in the range @p [__middle,__last) is + * undefined. + * After the sort if @e i and @e j are iterators in the range + * @p [__first,__middle) such that i precedes j and @e k is an iterator in + * the range @p [__middle,__last) then *j<*i and *k<*i are both false. + */ + template + inline void + partial_sort(_RandomAccessIterator __first, + _RandomAccessIterator __middle, + _RandomAccessIterator __last) + { + // concept requirements + __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __glibcxx_function_requires(_LessThanComparableConcept< + typename iterator_traits<_RandomAccessIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __middle); + __glibcxx_requires_valid_range(__middle, __last); + __glibcxx_requires_irreflexive(__first, __last); + + std::__partial_sort(__first, __middle, __last, + __gnu_cxx::__ops::__iter_less_iter()); + } + + /** + * @brief Sort the smallest elements of a sequence using a predicate + * for comparison. + * @ingroup sorting_algorithms + * @param __first An iterator. + * @param __middle Another iterator. + * @param __last Another iterator. + * @param __comp A comparison functor. + * @return Nothing. + * + * Sorts the smallest @p (__middle-__first) elements in the range + * @p [__first,__last) and moves them to the range @p [__first,__middle). The + * order of the remaining elements in the range @p [__middle,__last) is + * undefined. + * After the sort if @e i and @e j are iterators in the range + * @p [__first,__middle) such that i precedes j and @e k is an iterator in + * the range @p [__middle,__last) then @p *__comp(j,*i) and @p __comp(*k,*i) + * are both false. + */ + template + inline void + partial_sort(_RandomAccessIterator __first, + _RandomAccessIterator __middle, + _RandomAccessIterator __last, + _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_RandomAccessIterator>::value_type, + typename iterator_traits<_RandomAccessIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __middle); + __glibcxx_requires_valid_range(__middle, __last); + __glibcxx_requires_irreflexive_pred(__first, __last, __comp); + + std::__partial_sort(__first, __middle, __last, + __gnu_cxx::__ops::__iter_comp_iter(__comp)); + } + + /** + * @brief Sort a sequence just enough to find a particular position. + * @ingroup sorting_algorithms + * @param __first An iterator. + * @param __nth Another iterator. + * @param __last Another iterator. + * @return Nothing. + * + * Rearranges the elements in the range @p [__first,__last) so that @p *__nth + * is the same element that would have been in that position had the + * whole sequence been sorted. The elements either side of @p *__nth are + * not completely sorted, but for any iterator @e i in the range + * @p [__first,__nth) and any iterator @e j in the range @p [__nth,__last) it + * holds that *j < *i is false. + */ + template + inline void + nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, + _RandomAccessIterator __last) + { + // concept requirements + __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __glibcxx_function_requires(_LessThanComparableConcept< + typename iterator_traits<_RandomAccessIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __nth); + __glibcxx_requires_valid_range(__nth, __last); + __glibcxx_requires_irreflexive(__first, __last); + + if (__first == __last || __nth == __last) + return; + + std::__introselect(__first, __nth, __last, + std::__lg(__last - __first) * 2, + __gnu_cxx::__ops::__iter_less_iter()); + } + + /** + * @brief Sort a sequence just enough to find a particular position + * using a predicate for comparison. + * @ingroup sorting_algorithms + * @param __first An iterator. + * @param __nth Another iterator. + * @param __last Another iterator. + * @param __comp A comparison functor. + * @return Nothing. + * + * Rearranges the elements in the range @p [__first,__last) so that @p *__nth + * is the same element that would have been in that position had the + * whole sequence been sorted. The elements either side of @p *__nth are + * not completely sorted, but for any iterator @e i in the range + * @p [__first,__nth) and any iterator @e j in the range @p [__nth,__last) it + * holds that @p __comp(*j,*i) is false. + */ + template + inline void + nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, + _RandomAccessIterator __last, _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_RandomAccessIterator>::value_type, + typename iterator_traits<_RandomAccessIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __nth); + __glibcxx_requires_valid_range(__nth, __last); + __glibcxx_requires_irreflexive_pred(__first, __last, __comp); + + if (__first == __last || __nth == __last) + return; + + std::__introselect(__first, __nth, __last, + std::__lg(__last - __first) * 2, + __gnu_cxx::__ops::__iter_comp_iter(__comp)); + } + + /** + * @brief Sort the elements of a sequence. + * @ingroup sorting_algorithms + * @param __first An iterator. + * @param __last Another iterator. + * @return Nothing. + * + * Sorts the elements in the range @p [__first,__last) in ascending order, + * such that for each iterator @e i in the range @p [__first,__last-1), + * *(i+1)<*i is false. + * + * The relative ordering of equivalent elements is not preserved, use + * @p stable_sort() if this is needed. + */ + template + inline void + sort(_RandomAccessIterator __first, _RandomAccessIterator __last) + { + // concept requirements + __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __glibcxx_function_requires(_LessThanComparableConcept< + typename iterator_traits<_RandomAccessIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive(__first, __last); + + std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); + } + + /** + * @brief Sort the elements of a sequence using a predicate for comparison. + * @ingroup sorting_algorithms + * @param __first An iterator. + * @param __last Another iterator. + * @param __comp A comparison functor. + * @return Nothing. + * + * Sorts the elements in the range @p [__first,__last) in ascending order, + * such that @p __comp(*(i+1),*i) is false for every iterator @e i in the + * range @p [__first,__last-1). + * + * The relative ordering of equivalent elements is not preserved, use + * @p stable_sort() if this is needed. + */ + template + inline void + sort(_RandomAccessIterator __first, _RandomAccessIterator __last, + _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_RandomAccessIterator>::value_type, + typename iterator_traits<_RandomAccessIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive_pred(__first, __last, __comp); + + std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp)); + } + + template + _OutputIterator + __merge(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _OutputIterator __result, _Compare __comp) + { + while (__first1 != __last1 && __first2 != __last2) + { + if (__comp(__first2, __first1)) + { + *__result = *__first2; + ++__first2; + } + else + { + *__result = *__first1; + ++__first1; + } + ++__result; + } + return std::copy(__first2, __last2, + std::copy(__first1, __last1, __result)); + } + + /** + * @brief Merges two sorted ranges. + * @ingroup sorting_algorithms + * @param __first1 An iterator. + * @param __first2 Another iterator. + * @param __last1 Another iterator. + * @param __last2 Another iterator. + * @param __result An iterator pointing to the end of the merged range. + * @return An iterator pointing to the first element not less + * than @e val. + * + * Merges the ranges @p [__first1,__last1) and @p [__first2,__last2) into + * the sorted range @p [__result, __result + (__last1-__first1) + + * (__last2-__first2)). Both input ranges must be sorted, and the + * output range must not overlap with either of the input ranges. + * The sort is @e stable, that is, for equivalent elements in the + * two ranges, elements from the first range will always come + * before elements from the second. + */ + template + inline _OutputIterator + merge(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _OutputIterator __result) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator1>::value_type>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator2>::value_type>) + __glibcxx_function_requires(_LessThanOpConcept< + typename iterator_traits<_InputIterator2>::value_type, + typename iterator_traits<_InputIterator1>::value_type>) + __glibcxx_requires_sorted_set(__first1, __last1, __first2); + __glibcxx_requires_sorted_set(__first2, __last2, __first1); + __glibcxx_requires_irreflexive2(__first1, __last1); + __glibcxx_requires_irreflexive2(__first2, __last2); + + return _GLIBCXX_STD_A::__merge(__first1, __last1, + __first2, __last2, __result, + __gnu_cxx::__ops::__iter_less_iter()); + } + + /** + * @brief Merges two sorted ranges. + * @ingroup sorting_algorithms + * @param __first1 An iterator. + * @param __first2 Another iterator. + * @param __last1 Another iterator. + * @param __last2 Another iterator. + * @param __result An iterator pointing to the end of the merged range. + * @param __comp A functor to use for comparisons. + * @return An iterator pointing to the first element "not less + * than" @e val. + * + * Merges the ranges @p [__first1,__last1) and @p [__first2,__last2) into + * the sorted range @p [__result, __result + (__last1-__first1) + + * (__last2-__first2)). Both input ranges must be sorted, and the + * output range must not overlap with either of the input ranges. + * The sort is @e stable, that is, for equivalent elements in the + * two ranges, elements from the first range will always come + * before elements from the second. + * + * The comparison function should have the same effects on ordering as + * the function used for the initial sort. + */ + template + inline _OutputIterator + merge(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _OutputIterator __result, _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator1>::value_type>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator2>::value_type>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_InputIterator2>::value_type, + typename iterator_traits<_InputIterator1>::value_type>) + __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); + __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); + __glibcxx_requires_irreflexive_pred2(__first1, __last1, __comp); + __glibcxx_requires_irreflexive_pred2(__first2, __last2, __comp); + + return _GLIBCXX_STD_A::__merge(__first1, __last1, + __first2, __last2, __result, + __gnu_cxx::__ops::__iter_comp_iter(__comp)); + } + + template + inline void + __stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, + _Compare __comp) + { + typedef typename iterator_traits<_RandomAccessIterator>::value_type + _ValueType; + typedef typename iterator_traits<_RandomAccessIterator>::difference_type + _DistanceType; + + typedef _Temporary_buffer<_RandomAccessIterator, _ValueType> _TmpBuf; + _TmpBuf __buf(__first, __last); + + if (__buf.begin() == 0) + std::__inplace_stable_sort(__first, __last, __comp); + else + std::__stable_sort_adaptive(__first, __last, __buf.begin(), + _DistanceType(__buf.size()), __comp); + } + + /** + * @brief Sort the elements of a sequence, preserving the relative order + * of equivalent elements. + * @ingroup sorting_algorithms + * @param __first An iterator. + * @param __last Another iterator. + * @return Nothing. + * + * Sorts the elements in the range @p [__first,__last) in ascending order, + * such that for each iterator @p i in the range @p [__first,__last-1), + * @p *(i+1)<*i is false. + * + * The relative ordering of equivalent elements is preserved, so any two + * elements @p x and @p y in the range @p [__first,__last) such that + * @p x + inline void + stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last) + { + // concept requirements + __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __glibcxx_function_requires(_LessThanComparableConcept< + typename iterator_traits<_RandomAccessIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive(__first, __last); + + _GLIBCXX_STD_A::__stable_sort(__first, __last, + __gnu_cxx::__ops::__iter_less_iter()); + } + + /** + * @brief Sort the elements of a sequence using a predicate for comparison, + * preserving the relative order of equivalent elements. + * @ingroup sorting_algorithms + * @param __first An iterator. + * @param __last Another iterator. + * @param __comp A comparison functor. + * @return Nothing. + * + * Sorts the elements in the range @p [__first,__last) in ascending order, + * such that for each iterator @p i in the range @p [__first,__last-1), + * @p __comp(*(i+1),*i) is false. + * + * The relative ordering of equivalent elements is preserved, so any two + * elements @p x and @p y in the range @p [__first,__last) such that + * @p __comp(x,y) is false and @p __comp(y,x) is false will have the same + * relative ordering after calling @p stable_sort(). + */ + template + inline void + stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, + _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_RandomAccessIterator>::value_type, + typename iterator_traits<_RandomAccessIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive_pred(__first, __last, __comp); + + _GLIBCXX_STD_A::__stable_sort(__first, __last, + __gnu_cxx::__ops::__iter_comp_iter(__comp)); + } + + template + _OutputIterator + __set_union(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _OutputIterator __result, _Compare __comp) + { + while (__first1 != __last1 && __first2 != __last2) + { + if (__comp(__first1, __first2)) + { + *__result = *__first1; + ++__first1; + } + else if (__comp(__first2, __first1)) + { + *__result = *__first2; + ++__first2; + } + else + { + *__result = *__first1; + ++__first1; + ++__first2; + } + ++__result; + } + return std::copy(__first2, __last2, + std::copy(__first1, __last1, __result)); + } + + /** + * @brief Return the union of two sorted ranges. + * @ingroup set_algorithms + * @param __first1 Start of first range. + * @param __last1 End of first range. + * @param __first2 Start of second range. + * @param __last2 End of second range. + * @return End of the output range. + * @ingroup set_algorithms + * + * This operation iterates over both ranges, copying elements present in + * each range in order to the output range. Iterators increment for each + * range. When the current element of one range is less than the other, + * that element is copied and the iterator advanced. If an element is + * contained in both ranges, the element from the first range is copied and + * both ranges advance. The output range may not overlap either input + * range. + */ + template + inline _OutputIterator + set_union(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _OutputIterator __result) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator1>::value_type>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator2>::value_type>) + __glibcxx_function_requires(_LessThanOpConcept< + typename iterator_traits<_InputIterator1>::value_type, + typename iterator_traits<_InputIterator2>::value_type>) + __glibcxx_function_requires(_LessThanOpConcept< + typename iterator_traits<_InputIterator2>::value_type, + typename iterator_traits<_InputIterator1>::value_type>) + __glibcxx_requires_sorted_set(__first1, __last1, __first2); + __glibcxx_requires_sorted_set(__first2, __last2, __first1); + __glibcxx_requires_irreflexive2(__first1, __last1); + __glibcxx_requires_irreflexive2(__first2, __last2); + + return _GLIBCXX_STD_A::__set_union(__first1, __last1, + __first2, __last2, __result, + __gnu_cxx::__ops::__iter_less_iter()); + } + + /** + * @brief Return the union of two sorted ranges using a comparison functor. + * @ingroup set_algorithms + * @param __first1 Start of first range. + * @param __last1 End of first range. + * @param __first2 Start of second range. + * @param __last2 End of second range. + * @param __comp The comparison functor. + * @return End of the output range. + * @ingroup set_algorithms + * + * This operation iterates over both ranges, copying elements present in + * each range in order to the output range. Iterators increment for each + * range. When the current element of one range is less than the other + * according to @p __comp, that element is copied and the iterator advanced. + * If an equivalent element according to @p __comp is contained in both + * ranges, the element from the first range is copied and both ranges + * advance. The output range may not overlap either input range. + */ + template + inline _OutputIterator + set_union(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _OutputIterator __result, _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator1>::value_type>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator2>::value_type>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_InputIterator1>::value_type, + typename iterator_traits<_InputIterator2>::value_type>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_InputIterator2>::value_type, + typename iterator_traits<_InputIterator1>::value_type>) + __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); + __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); + __glibcxx_requires_irreflexive_pred2(__first1, __last1, __comp); + __glibcxx_requires_irreflexive_pred2(__first2, __last2, __comp); + + return _GLIBCXX_STD_A::__set_union(__first1, __last1, + __first2, __last2, __result, + __gnu_cxx::__ops::__iter_comp_iter(__comp)); + } + + template + _OutputIterator + __set_intersection(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _OutputIterator __result, _Compare __comp) + { + while (__first1 != __last1 && __first2 != __last2) + if (__comp(__first1, __first2)) + ++__first1; + else if (__comp(__first2, __first1)) + ++__first2; + else + { + *__result = *__first1; + ++__first1; + ++__first2; + ++__result; + } + return __result; + } + + /** + * @brief Return the intersection of two sorted ranges. + * @ingroup set_algorithms + * @param __first1 Start of first range. + * @param __last1 End of first range. + * @param __first2 Start of second range. + * @param __last2 End of second range. + * @return End of the output range. + * @ingroup set_algorithms + * + * This operation iterates over both ranges, copying elements present in + * both ranges in order to the output range. Iterators increment for each + * range. When the current element of one range is less than the other, + * that iterator advances. If an element is contained in both ranges, the + * element from the first range is copied and both ranges advance. The + * output range may not overlap either input range. + */ + template + inline _OutputIterator + set_intersection(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _OutputIterator __result) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator1>::value_type>) + __glibcxx_function_requires(_LessThanOpConcept< + typename iterator_traits<_InputIterator1>::value_type, + typename iterator_traits<_InputIterator2>::value_type>) + __glibcxx_function_requires(_LessThanOpConcept< + typename iterator_traits<_InputIterator2>::value_type, + typename iterator_traits<_InputIterator1>::value_type>) + __glibcxx_requires_sorted_set(__first1, __last1, __first2); + __glibcxx_requires_sorted_set(__first2, __last2, __first1); + __glibcxx_requires_irreflexive2(__first1, __last1); + __glibcxx_requires_irreflexive2(__first2, __last2); + + return _GLIBCXX_STD_A::__set_intersection(__first1, __last1, + __first2, __last2, __result, + __gnu_cxx::__ops::__iter_less_iter()); + } + + /** + * @brief Return the intersection of two sorted ranges using comparison + * functor. + * @ingroup set_algorithms + * @param __first1 Start of first range. + * @param __last1 End of first range. + * @param __first2 Start of second range. + * @param __last2 End of second range. + * @param __comp The comparison functor. + * @return End of the output range. + * @ingroup set_algorithms + * + * This operation iterates over both ranges, copying elements present in + * both ranges in order to the output range. Iterators increment for each + * range. When the current element of one range is less than the other + * according to @p __comp, that iterator advances. If an element is + * contained in both ranges according to @p __comp, the element from the + * first range is copied and both ranges advance. The output range may not + * overlap either input range. + */ + template + inline _OutputIterator + set_intersection(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _OutputIterator __result, _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator1>::value_type>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_InputIterator1>::value_type, + typename iterator_traits<_InputIterator2>::value_type>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_InputIterator2>::value_type, + typename iterator_traits<_InputIterator1>::value_type>) + __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); + __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); + __glibcxx_requires_irreflexive_pred2(__first1, __last1, __comp); + __glibcxx_requires_irreflexive_pred2(__first2, __last2, __comp); + + return _GLIBCXX_STD_A::__set_intersection(__first1, __last1, + __first2, __last2, __result, + __gnu_cxx::__ops::__iter_comp_iter(__comp)); + } + + template + _OutputIterator + __set_difference(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _OutputIterator __result, _Compare __comp) + { + while (__first1 != __last1 && __first2 != __last2) + if (__comp(__first1, __first2)) + { + *__result = *__first1; + ++__first1; + ++__result; + } + else if (__comp(__first2, __first1)) + ++__first2; + else + { + ++__first1; + ++__first2; + } + return std::copy(__first1, __last1, __result); + } + + /** + * @brief Return the difference of two sorted ranges. + * @ingroup set_algorithms + * @param __first1 Start of first range. + * @param __last1 End of first range. + * @param __first2 Start of second range. + * @param __last2 End of second range. + * @return End of the output range. + * @ingroup set_algorithms + * + * This operation iterates over both ranges, copying elements present in + * the first range but not the second in order to the output range. + * Iterators increment for each range. When the current element of the + * first range is less than the second, that element is copied and the + * iterator advances. If the current element of the second range is less, + * the iterator advances, but no element is copied. If an element is + * contained in both ranges, no elements are copied and both ranges + * advance. The output range may not overlap either input range. + */ + template + inline _OutputIterator + set_difference(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _OutputIterator __result) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator1>::value_type>) + __glibcxx_function_requires(_LessThanOpConcept< + typename iterator_traits<_InputIterator1>::value_type, + typename iterator_traits<_InputIterator2>::value_type>) + __glibcxx_function_requires(_LessThanOpConcept< + typename iterator_traits<_InputIterator2>::value_type, + typename iterator_traits<_InputIterator1>::value_type>) + __glibcxx_requires_sorted_set(__first1, __last1, __first2); + __glibcxx_requires_sorted_set(__first2, __last2, __first1); + __glibcxx_requires_irreflexive2(__first1, __last1); + __glibcxx_requires_irreflexive2(__first2, __last2); + + return _GLIBCXX_STD_A::__set_difference(__first1, __last1, + __first2, __last2, __result, + __gnu_cxx::__ops::__iter_less_iter()); + } + + /** + * @brief Return the difference of two sorted ranges using comparison + * functor. + * @ingroup set_algorithms + * @param __first1 Start of first range. + * @param __last1 End of first range. + * @param __first2 Start of second range. + * @param __last2 End of second range. + * @param __comp The comparison functor. + * @return End of the output range. + * @ingroup set_algorithms + * + * This operation iterates over both ranges, copying elements present in + * the first range but not the second in order to the output range. + * Iterators increment for each range. When the current element of the + * first range is less than the second according to @p __comp, that element + * is copied and the iterator advances. If the current element of the + * second range is less, no element is copied and the iterator advances. + * If an element is contained in both ranges according to @p __comp, no + * elements are copied and both ranges advance. The output range may not + * overlap either input range. + */ + template + inline _OutputIterator + set_difference(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _OutputIterator __result, _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator1>::value_type>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_InputIterator1>::value_type, + typename iterator_traits<_InputIterator2>::value_type>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_InputIterator2>::value_type, + typename iterator_traits<_InputIterator1>::value_type>) + __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); + __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); + __glibcxx_requires_irreflexive_pred2(__first1, __last1, __comp); + __glibcxx_requires_irreflexive_pred2(__first2, __last2, __comp); + + return _GLIBCXX_STD_A::__set_difference(__first1, __last1, + __first2, __last2, __result, + __gnu_cxx::__ops::__iter_comp_iter(__comp)); + } + + template + _OutputIterator + __set_symmetric_difference(_InputIterator1 __first1, + _InputIterator1 __last1, + _InputIterator2 __first2, + _InputIterator2 __last2, + _OutputIterator __result, + _Compare __comp) + { + while (__first1 != __last1 && __first2 != __last2) + if (__comp(__first1, __first2)) + { + *__result = *__first1; + ++__first1; + ++__result; + } + else if (__comp(__first2, __first1)) + { + *__result = *__first2; + ++__first2; + ++__result; + } + else + { + ++__first1; + ++__first2; + } + return std::copy(__first2, __last2, + std::copy(__first1, __last1, __result)); + } + + /** + * @brief Return the symmetric difference of two sorted ranges. + * @ingroup set_algorithms + * @param __first1 Start of first range. + * @param __last1 End of first range. + * @param __first2 Start of second range. + * @param __last2 End of second range. + * @return End of the output range. + * @ingroup set_algorithms + * + * This operation iterates over both ranges, copying elements present in + * one range but not the other in order to the output range. Iterators + * increment for each range. When the current element of one range is less + * than the other, that element is copied and the iterator advances. If an + * element is contained in both ranges, no elements are copied and both + * ranges advance. The output range may not overlap either input range. + */ + template + inline _OutputIterator + set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _OutputIterator __result) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator1>::value_type>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator2>::value_type>) + __glibcxx_function_requires(_LessThanOpConcept< + typename iterator_traits<_InputIterator1>::value_type, + typename iterator_traits<_InputIterator2>::value_type>) + __glibcxx_function_requires(_LessThanOpConcept< + typename iterator_traits<_InputIterator2>::value_type, + typename iterator_traits<_InputIterator1>::value_type>) + __glibcxx_requires_sorted_set(__first1, __last1, __first2); + __glibcxx_requires_sorted_set(__first2, __last2, __first1); + __glibcxx_requires_irreflexive2(__first1, __last1); + __glibcxx_requires_irreflexive2(__first2, __last2); + + return _GLIBCXX_STD_A::__set_symmetric_difference(__first1, __last1, + __first2, __last2, __result, + __gnu_cxx::__ops::__iter_less_iter()); + } + + /** + * @brief Return the symmetric difference of two sorted ranges using + * comparison functor. + * @ingroup set_algorithms + * @param __first1 Start of first range. + * @param __last1 End of first range. + * @param __first2 Start of second range. + * @param __last2 End of second range. + * @param __comp The comparison functor. + * @return End of the output range. + * @ingroup set_algorithms + * + * This operation iterates over both ranges, copying elements present in + * one range but not the other in order to the output range. Iterators + * increment for each range. When the current element of one range is less + * than the other according to @p comp, that element is copied and the + * iterator advances. If an element is contained in both ranges according + * to @p __comp, no elements are copied and both ranges advance. The output + * range may not overlap either input range. + */ + template + inline _OutputIterator + set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _OutputIterator __result, + _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator1>::value_type>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + typename iterator_traits<_InputIterator2>::value_type>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_InputIterator1>::value_type, + typename iterator_traits<_InputIterator2>::value_type>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_InputIterator2>::value_type, + typename iterator_traits<_InputIterator1>::value_type>) + __glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp); + __glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp); + __glibcxx_requires_irreflexive_pred2(__first1, __last1, __comp); + __glibcxx_requires_irreflexive_pred2(__first2, __last2, __comp); + + return _GLIBCXX_STD_A::__set_symmetric_difference(__first1, __last1, + __first2, __last2, __result, + __gnu_cxx::__ops::__iter_comp_iter(__comp)); + } + + template + _GLIBCXX14_CONSTEXPR + _ForwardIterator + __min_element(_ForwardIterator __first, _ForwardIterator __last, + _Compare __comp) + { + if (__first == __last) + return __first; + _ForwardIterator __result = __first; + while (++__first != __last) + if (__comp(__first, __result)) + __result = __first; + return __result; + } + + /** + * @brief Return the minimum element in a range. + * @ingroup sorting_algorithms + * @param __first Start of range. + * @param __last End of range. + * @return Iterator referencing the first instance of the smallest value. + */ + template + _GLIBCXX14_CONSTEXPR + _ForwardIterator + inline min_element(_ForwardIterator __first, _ForwardIterator __last) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_LessThanComparableConcept< + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive(__first, __last); + + return _GLIBCXX_STD_A::__min_element(__first, __last, + __gnu_cxx::__ops::__iter_less_iter()); + } + + /** + * @brief Return the minimum element in a range using comparison functor. + * @ingroup sorting_algorithms + * @param __first Start of range. + * @param __last End of range. + * @param __comp Comparison functor. + * @return Iterator referencing the first instance of the smallest value + * according to __comp. + */ + template + _GLIBCXX14_CONSTEXPR + inline _ForwardIterator + min_element(_ForwardIterator __first, _ForwardIterator __last, + _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_ForwardIterator>::value_type, + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive_pred(__first, __last, __comp); + + return _GLIBCXX_STD_A::__min_element(__first, __last, + __gnu_cxx::__ops::__iter_comp_iter(__comp)); + } + + template + _GLIBCXX14_CONSTEXPR + _ForwardIterator + __max_element(_ForwardIterator __first, _ForwardIterator __last, + _Compare __comp) + { + if (__first == __last) return __first; + _ForwardIterator __result = __first; + while (++__first != __last) + if (__comp(__result, __first)) + __result = __first; + return __result; + } + + /** + * @brief Return the maximum element in a range. + * @ingroup sorting_algorithms + * @param __first Start of range. + * @param __last End of range. + * @return Iterator referencing the first instance of the largest value. + */ + template + _GLIBCXX14_CONSTEXPR + inline _ForwardIterator + max_element(_ForwardIterator __first, _ForwardIterator __last) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_LessThanComparableConcept< + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive(__first, __last); + + return _GLIBCXX_STD_A::__max_element(__first, __last, + __gnu_cxx::__ops::__iter_less_iter()); + } + + /** + * @brief Return the maximum element in a range using comparison functor. + * @ingroup sorting_algorithms + * @param __first Start of range. + * @param __last End of range. + * @param __comp Comparison functor. + * @return Iterator referencing the first instance of the largest value + * according to __comp. + */ + template + _GLIBCXX14_CONSTEXPR + inline _ForwardIterator + max_element(_ForwardIterator __first, _ForwardIterator __last, + _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, + typename iterator_traits<_ForwardIterator>::value_type, + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive_pred(__first, __last, __comp); + + return _GLIBCXX_STD_A::__max_element(__first, __last, + __gnu_cxx::__ops::__iter_comp_iter(__comp)); + } + +#if __cplusplus >= 201402L + /// Reservoir sampling algorithm. + template + _RandomAccessIterator + __sample(_InputIterator __first, _InputIterator __last, input_iterator_tag, + _RandomAccessIterator __out, random_access_iterator_tag, + _Size __n, _UniformRandomBitGenerator&& __g) + { + using __distrib_type = uniform_int_distribution<_Size>; + using __param_type = typename __distrib_type::param_type; + __distrib_type __d{}; + _Size __sample_sz = 0; + while (__first != __last && __sample_sz != __n) + { + __out[__sample_sz++] = *__first; + ++__first; + } + for (auto __pop_sz = __sample_sz; __first != __last; + ++__first, (void) ++__pop_sz) + { + const auto __k = __d(__g, __param_type{0, __pop_sz}); + if (__k < __n) + __out[__k] = *__first; + } + return __out + __sample_sz; + } + + /// Selection sampling algorithm. + template + _OutputIterator + __sample(_ForwardIterator __first, _ForwardIterator __last, + forward_iterator_tag, + _OutputIterator __out, _Cat, + _Size __n, _UniformRandomBitGenerator&& __g) + { + using __distrib_type = uniform_int_distribution<_Size>; + using __param_type = typename __distrib_type::param_type; + using _USize = make_unsigned_t<_Size>; + using _Gen = remove_reference_t<_UniformRandomBitGenerator>; + using __uc_type = common_type_t; + + __distrib_type __d{}; + _Size __unsampled_sz = std::distance(__first, __last); + __n = std::min(__n, __unsampled_sz); + + // If possible, we use __gen_two_uniform_ints to efficiently produce + // two random numbers using a single distribution invocation: + + const __uc_type __urngrange = __g.max() - __g.min(); + if (__urngrange / __uc_type(__unsampled_sz) >= __uc_type(__unsampled_sz)) + // I.e. (__urngrange >= __unsampled_sz * __unsampled_sz) but without + // wrapping issues. + { + while (__n != 0 && __unsampled_sz >= 2) + { + const pair<_Size, _Size> __p = + __gen_two_uniform_ints(__unsampled_sz, __unsampled_sz - 1, __g); + + --__unsampled_sz; + if (__p.first < __n) + { + *__out++ = *__first; + --__n; + } + + ++__first; + + if (__n == 0) break; + + --__unsampled_sz; + if (__p.second < __n) + { + *__out++ = *__first; + --__n; + } + + ++__first; + } + } + + // The loop above is otherwise equivalent to this one-at-a-time version: + + for (; __n != 0; ++__first) + if (__d(__g, __param_type{0, --__unsampled_sz}) < __n) + { + *__out++ = *__first; + --__n; + } + return __out; + } + +#if __cplusplus > 201402L +#define __cpp_lib_sample 201603 + /// Take a random sample from a population. + template + _SampleIterator + sample(_PopulationIterator __first, _PopulationIterator __last, + _SampleIterator __out, _Distance __n, + _UniformRandomBitGenerator&& __g) + { + using __pop_cat = typename + std::iterator_traits<_PopulationIterator>::iterator_category; + using __samp_cat = typename + std::iterator_traits<_SampleIterator>::iterator_category; + + static_assert( + __or_, + is_convertible<__samp_cat, random_access_iterator_tag>>::value, + "output range must use a RandomAccessIterator when input range" + " does not meet the ForwardIterator requirements"); + + static_assert(is_integral<_Distance>::value, + "sample size must be an integer type"); + + typename iterator_traits<_PopulationIterator>::difference_type __d = __n; + return _GLIBCXX_STD_A:: + __sample(__first, __last, __pop_cat{}, __out, __samp_cat{}, __d, + std::forward<_UniformRandomBitGenerator>(__g)); + } +#endif // C++17 +#endif // C++14 + +_GLIBCXX_END_NAMESPACE_ALGO +} // namespace std + +#endif /* _STL_ALGO_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_algobase.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_algobase.h new file mode 100644 index 0000000..ea7cd21 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_algobase.h @@ -0,0 +1,1423 @@ +// Core algorithmic facilities -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_algobase.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{algorithm} + */ + +#ifndef _STL_ALGOBASE_H +#define _STL_ALGOBASE_H 1 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // For std::swap and _GLIBCXX_MOVE +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#if __cplusplus < 201103L + // See http://gcc.gnu.org/ml/libstdc++/2004-08/msg00167.html: in a + // nutshell, we are partially implementing the resolution of DR 187, + // when it's safe, i.e., the value_types are equal. + template + struct __iter_swap + { + template + static void + iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) + { + typedef typename iterator_traits<_ForwardIterator1>::value_type + _ValueType1; + _ValueType1 __tmp = _GLIBCXX_MOVE(*__a); + *__a = _GLIBCXX_MOVE(*__b); + *__b = _GLIBCXX_MOVE(__tmp); + } + }; + + template<> + struct __iter_swap + { + template + static void + iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) + { + swap(*__a, *__b); + } + }; +#endif + + /** + * @brief Swaps the contents of two iterators. + * @ingroup mutating_algorithms + * @param __a An iterator. + * @param __b Another iterator. + * @return Nothing. + * + * This function swaps the values pointed to by two iterators, not the + * iterators themselves. + */ + template + inline void + iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b) + { + // concept requirements + __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< + _ForwardIterator1>) + __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< + _ForwardIterator2>) + +#if __cplusplus < 201103L + typedef typename iterator_traits<_ForwardIterator1>::value_type + _ValueType1; + typedef typename iterator_traits<_ForwardIterator2>::value_type + _ValueType2; + + __glibcxx_function_requires(_ConvertibleConcept<_ValueType1, + _ValueType2>) + __glibcxx_function_requires(_ConvertibleConcept<_ValueType2, + _ValueType1>) + + typedef typename iterator_traits<_ForwardIterator1>::reference + _ReferenceType1; + typedef typename iterator_traits<_ForwardIterator2>::reference + _ReferenceType2; + std::__iter_swap<__are_same<_ValueType1, _ValueType2>::__value + && __are_same<_ValueType1&, _ReferenceType1>::__value + && __are_same<_ValueType2&, _ReferenceType2>::__value>:: + iter_swap(__a, __b); +#else + swap(*__a, *__b); +#endif + } + + /** + * @brief Swap the elements of two sequences. + * @ingroup mutating_algorithms + * @param __first1 A forward iterator. + * @param __last1 A forward iterator. + * @param __first2 A forward iterator. + * @return An iterator equal to @p first2+(last1-first1). + * + * Swaps each element in the range @p [first1,last1) with the + * corresponding element in the range @p [first2,(last1-first1)). + * The ranges must not overlap. + */ + template + _ForwardIterator2 + swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, + _ForwardIterator2 __first2) + { + // concept requirements + __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< + _ForwardIterator1>) + __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< + _ForwardIterator2>) + __glibcxx_requires_valid_range(__first1, __last1); + + for (; __first1 != __last1; ++__first1, (void)++__first2) + std::iter_swap(__first1, __first2); + return __first2; + } + + /** + * @brief This does what you think it does. + * @ingroup sorting_algorithms + * @param __a A thing of arbitrary type. + * @param __b Another thing of arbitrary type. + * @return The lesser of the parameters. + * + * This is the simple classic generic implementation. It will work on + * temporary expressions, since they are only evaluated once, unlike a + * preprocessor macro. + */ + template + _GLIBCXX14_CONSTEXPR + inline const _Tp& + min(const _Tp& __a, const _Tp& __b) + { + // concept requirements + __glibcxx_function_requires(_LessThanComparableConcept<_Tp>) + //return __b < __a ? __b : __a; + if (__b < __a) + return __b; + return __a; + } + + /** + * @brief This does what you think it does. + * @ingroup sorting_algorithms + * @param __a A thing of arbitrary type. + * @param __b Another thing of arbitrary type. + * @return The greater of the parameters. + * + * This is the simple classic generic implementation. It will work on + * temporary expressions, since they are only evaluated once, unlike a + * preprocessor macro. + */ + template + _GLIBCXX14_CONSTEXPR + inline const _Tp& + max(const _Tp& __a, const _Tp& __b) + { + // concept requirements + __glibcxx_function_requires(_LessThanComparableConcept<_Tp>) + //return __a < __b ? __b : __a; + if (__a < __b) + return __b; + return __a; + } + + /** + * @brief This does what you think it does. + * @ingroup sorting_algorithms + * @param __a A thing of arbitrary type. + * @param __b Another thing of arbitrary type. + * @param __comp A @link comparison_functors comparison functor@endlink. + * @return The lesser of the parameters. + * + * This will work on temporary expressions, since they are only evaluated + * once, unlike a preprocessor macro. + */ + template + _GLIBCXX14_CONSTEXPR + inline const _Tp& + min(const _Tp& __a, const _Tp& __b, _Compare __comp) + { + //return __comp(__b, __a) ? __b : __a; + if (__comp(__b, __a)) + return __b; + return __a; + } + + /** + * @brief This does what you think it does. + * @ingroup sorting_algorithms + * @param __a A thing of arbitrary type. + * @param __b Another thing of arbitrary type. + * @param __comp A @link comparison_functors comparison functor@endlink. + * @return The greater of the parameters. + * + * This will work on temporary expressions, since they are only evaluated + * once, unlike a preprocessor macro. + */ + template + _GLIBCXX14_CONSTEXPR + inline const _Tp& + max(const _Tp& __a, const _Tp& __b, _Compare __comp) + { + //return __comp(__a, __b) ? __b : __a; + if (__comp(__a, __b)) + return __b; + return __a; + } + + // Fallback implementation of the function in bits/stl_iterator.h used to + // remove the __normal_iterator wrapper. See copy, fill, ... + template + inline _Iterator + __niter_base(_Iterator __it) + { return __it; } + + // All of these auxiliary structs serve two purposes. (1) Replace + // calls to copy with memmove whenever possible. (Memmove, not memcpy, + // because the input and output ranges are permitted to overlap.) + // (2) If we're using random access iterators, then write the loop as + // a for loop with an explicit count. + + template + struct __copy_move + { + template + static _OI + __copy_m(_II __first, _II __last, _OI __result) + { + for (; __first != __last; ++__result, (void)++__first) + *__result = *__first; + return __result; + } + }; + +#if __cplusplus >= 201103L + template + struct __copy_move + { + template + static _OI + __copy_m(_II __first, _II __last, _OI __result) + { + for (; __first != __last; ++__result, (void)++__first) + *__result = std::move(*__first); + return __result; + } + }; +#endif + + template<> + struct __copy_move + { + template + static _OI + __copy_m(_II __first, _II __last, _OI __result) + { + typedef typename iterator_traits<_II>::difference_type _Distance; + for(_Distance __n = __last - __first; __n > 0; --__n) + { + *__result = *__first; + ++__first; + ++__result; + } + return __result; + } + }; + +#if __cplusplus >= 201103L + template<> + struct __copy_move + { + template + static _OI + __copy_m(_II __first, _II __last, _OI __result) + { + typedef typename iterator_traits<_II>::difference_type _Distance; + for(_Distance __n = __last - __first; __n > 0; --__n) + { + *__result = std::move(*__first); + ++__first; + ++__result; + } + return __result; + } + }; +#endif + + template + struct __copy_move<_IsMove, true, random_access_iterator_tag> + { + template + static _Tp* + __copy_m(const _Tp* __first, const _Tp* __last, _Tp* __result) + { +#if __cplusplus >= 201103L + using __assignable = conditional<_IsMove, + is_move_assignable<_Tp>, + is_copy_assignable<_Tp>>; + // trivial types can have deleted assignment + static_assert( __assignable::type::value, "type is not assignable" ); +#endif + const ptrdiff_t _Num = __last - __first; + if (_Num) + __builtin_memmove(__result, __first, sizeof(_Tp) * _Num); + return __result + _Num; + } + }; + + template + inline _OI + __copy_move_a(_II __first, _II __last, _OI __result) + { + typedef typename iterator_traits<_II>::value_type _ValueTypeI; + typedef typename iterator_traits<_OI>::value_type _ValueTypeO; + typedef typename iterator_traits<_II>::iterator_category _Category; + const bool __simple = (__is_trivial(_ValueTypeI) + && __is_pointer<_II>::__value + && __is_pointer<_OI>::__value + && __are_same<_ValueTypeI, _ValueTypeO>::__value); + + return std::__copy_move<_IsMove, __simple, + _Category>::__copy_m(__first, __last, __result); + } + + // Helpers for streambuf iterators (either istream or ostream). + // NB: avoid including , relatively large. + template + struct char_traits; + + template + class istreambuf_iterator; + + template + class ostreambuf_iterator; + + template + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + ostreambuf_iterator<_CharT, char_traits<_CharT> > >::__type + __copy_move_a2(_CharT*, _CharT*, + ostreambuf_iterator<_CharT, char_traits<_CharT> >); + + template + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + ostreambuf_iterator<_CharT, char_traits<_CharT> > >::__type + __copy_move_a2(const _CharT*, const _CharT*, + ostreambuf_iterator<_CharT, char_traits<_CharT> >); + + template + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + _CharT*>::__type + __copy_move_a2(istreambuf_iterator<_CharT, char_traits<_CharT> >, + istreambuf_iterator<_CharT, char_traits<_CharT> >, _CharT*); + + template + inline _OI + __copy_move_a2(_II __first, _II __last, _OI __result) + { + return _OI(std::__copy_move_a<_IsMove>(std::__niter_base(__first), + std::__niter_base(__last), + std::__niter_base(__result))); + } + + /** + * @brief Copies the range [first,last) into result. + * @ingroup mutating_algorithms + * @param __first An input iterator. + * @param __last An input iterator. + * @param __result An output iterator. + * @return result + (first - last) + * + * This inline function will boil down to a call to @c memmove whenever + * possible. Failing that, if random access iterators are passed, then the + * loop count will be known (and therefore a candidate for compiler + * optimizations such as unrolling). Result may not be contained within + * [first,last); the copy_backward function should be used instead. + * + * Note that the end of the output range is permitted to be contained + * within [first,last). + */ + template + inline _OI + copy(_II __first, _II __last, _OI __result) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_II>) + __glibcxx_function_requires(_OutputIteratorConcept<_OI, + typename iterator_traits<_II>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + return (std::__copy_move_a2<__is_move_iterator<_II>::__value> + (std::__miter_base(__first), std::__miter_base(__last), + __result)); + } + +#if __cplusplus >= 201103L + /** + * @brief Moves the range [first,last) into result. + * @ingroup mutating_algorithms + * @param __first An input iterator. + * @param __last An input iterator. + * @param __result An output iterator. + * @return result + (first - last) + * + * This inline function will boil down to a call to @c memmove whenever + * possible. Failing that, if random access iterators are passed, then the + * loop count will be known (and therefore a candidate for compiler + * optimizations such as unrolling). Result may not be contained within + * [first,last); the move_backward function should be used instead. + * + * Note that the end of the output range is permitted to be contained + * within [first,last). + */ + template + inline _OI + move(_II __first, _II __last, _OI __result) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_II>) + __glibcxx_function_requires(_OutputIteratorConcept<_OI, + typename iterator_traits<_II>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + return std::__copy_move_a2(std::__miter_base(__first), + std::__miter_base(__last), __result); + } + +#define _GLIBCXX_MOVE3(_Tp, _Up, _Vp) std::move(_Tp, _Up, _Vp) +#else +#define _GLIBCXX_MOVE3(_Tp, _Up, _Vp) std::copy(_Tp, _Up, _Vp) +#endif + + template + struct __copy_move_backward + { + template + static _BI2 + __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) + { + while (__first != __last) + *--__result = *--__last; + return __result; + } + }; + +#if __cplusplus >= 201103L + template + struct __copy_move_backward + { + template + static _BI2 + __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) + { + while (__first != __last) + *--__result = std::move(*--__last); + return __result; + } + }; +#endif + + template<> + struct __copy_move_backward + { + template + static _BI2 + __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) + { + typename iterator_traits<_BI1>::difference_type __n; + for (__n = __last - __first; __n > 0; --__n) + *--__result = *--__last; + return __result; + } + }; + +#if __cplusplus >= 201103L + template<> + struct __copy_move_backward + { + template + static _BI2 + __copy_move_b(_BI1 __first, _BI1 __last, _BI2 __result) + { + typename iterator_traits<_BI1>::difference_type __n; + for (__n = __last - __first; __n > 0; --__n) + *--__result = std::move(*--__last); + return __result; + } + }; +#endif + + template + struct __copy_move_backward<_IsMove, true, random_access_iterator_tag> + { + template + static _Tp* + __copy_move_b(const _Tp* __first, const _Tp* __last, _Tp* __result) + { +#if __cplusplus >= 201103L + using __assignable = conditional<_IsMove, + is_move_assignable<_Tp>, + is_copy_assignable<_Tp>>; + // trivial types can have deleted assignment + static_assert( __assignable::type::value, "type is not assignable" ); +#endif + const ptrdiff_t _Num = __last - __first; + if (_Num) + __builtin_memmove(__result - _Num, __first, sizeof(_Tp) * _Num); + return __result - _Num; + } + }; + + template + inline _BI2 + __copy_move_backward_a(_BI1 __first, _BI1 __last, _BI2 __result) + { + typedef typename iterator_traits<_BI1>::value_type _ValueType1; + typedef typename iterator_traits<_BI2>::value_type _ValueType2; + typedef typename iterator_traits<_BI1>::iterator_category _Category; + const bool __simple = (__is_trivial(_ValueType1) + && __is_pointer<_BI1>::__value + && __is_pointer<_BI2>::__value + && __are_same<_ValueType1, _ValueType2>::__value); + + return std::__copy_move_backward<_IsMove, __simple, + _Category>::__copy_move_b(__first, + __last, + __result); + } + + template + inline _BI2 + __copy_move_backward_a2(_BI1 __first, _BI1 __last, _BI2 __result) + { + return _BI2(std::__copy_move_backward_a<_IsMove> + (std::__niter_base(__first), std::__niter_base(__last), + std::__niter_base(__result))); + } + + /** + * @brief Copies the range [first,last) into result. + * @ingroup mutating_algorithms + * @param __first A bidirectional iterator. + * @param __last A bidirectional iterator. + * @param __result A bidirectional iterator. + * @return result - (first - last) + * + * The function has the same effect as copy, but starts at the end of the + * range and works its way to the start, returning the start of the result. + * This inline function will boil down to a call to @c memmove whenever + * possible. Failing that, if random access iterators are passed, then the + * loop count will be known (and therefore a candidate for compiler + * optimizations such as unrolling). + * + * Result may not be in the range (first,last]. Use copy instead. Note + * that the start of the output range may overlap [first,last). + */ + template + inline _BI2 + copy_backward(_BI1 __first, _BI1 __last, _BI2 __result) + { + // concept requirements + __glibcxx_function_requires(_BidirectionalIteratorConcept<_BI1>) + __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<_BI2>) + __glibcxx_function_requires(_ConvertibleConcept< + typename iterator_traits<_BI1>::value_type, + typename iterator_traits<_BI2>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + return (std::__copy_move_backward_a2<__is_move_iterator<_BI1>::__value> + (std::__miter_base(__first), std::__miter_base(__last), + __result)); + } + +#if __cplusplus >= 201103L + /** + * @brief Moves the range [first,last) into result. + * @ingroup mutating_algorithms + * @param __first A bidirectional iterator. + * @param __last A bidirectional iterator. + * @param __result A bidirectional iterator. + * @return result - (first - last) + * + * The function has the same effect as move, but starts at the end of the + * range and works its way to the start, returning the start of the result. + * This inline function will boil down to a call to @c memmove whenever + * possible. Failing that, if random access iterators are passed, then the + * loop count will be known (and therefore a candidate for compiler + * optimizations such as unrolling). + * + * Result may not be in the range (first,last]. Use move instead. Note + * that the start of the output range may overlap [first,last). + */ + template + inline _BI2 + move_backward(_BI1 __first, _BI1 __last, _BI2 __result) + { + // concept requirements + __glibcxx_function_requires(_BidirectionalIteratorConcept<_BI1>) + __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<_BI2>) + __glibcxx_function_requires(_ConvertibleConcept< + typename iterator_traits<_BI1>::value_type, + typename iterator_traits<_BI2>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + return std::__copy_move_backward_a2(std::__miter_base(__first), + std::__miter_base(__last), + __result); + } + +#define _GLIBCXX_MOVE_BACKWARD3(_Tp, _Up, _Vp) std::move_backward(_Tp, _Up, _Vp) +#else +#define _GLIBCXX_MOVE_BACKWARD3(_Tp, _Up, _Vp) std::copy_backward(_Tp, _Up, _Vp) +#endif + + template + inline typename + __gnu_cxx::__enable_if::__value, void>::__type + __fill_a(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __value) + { + for (; __first != __last; ++__first) + *__first = __value; + } + + template + inline typename + __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, void>::__type + __fill_a(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __value) + { + const _Tp __tmp = __value; + for (; __first != __last; ++__first) + *__first = __tmp; + } + + // Specialization: for char types we can use memset. + template + inline typename + __gnu_cxx::__enable_if<__is_byte<_Tp>::__value, void>::__type + __fill_a(_Tp* __first, _Tp* __last, const _Tp& __c) + { + const _Tp __tmp = __c; + if (const size_t __len = __last - __first) + __builtin_memset(__first, static_cast(__tmp), __len); + } + + /** + * @brief Fills the range [first,last) with copies of value. + * @ingroup mutating_algorithms + * @param __first A forward iterator. + * @param __last A forward iterator. + * @param __value A reference-to-const of arbitrary type. + * @return Nothing. + * + * This function fills a range with copies of the same value. For char + * types filling contiguous areas of memory, this becomes an inline call + * to @c memset or @c wmemset. + */ + template + inline void + fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value) + { + // concept requirements + __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< + _ForwardIterator>) + __glibcxx_requires_valid_range(__first, __last); + + std::__fill_a(std::__niter_base(__first), std::__niter_base(__last), + __value); + } + + template + inline typename + __gnu_cxx::__enable_if::__value, _OutputIterator>::__type + __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value) + { + for (__decltype(__n + 0) __niter = __n; + __niter > 0; --__niter, ++__first) + *__first = __value; + return __first; + } + + template + inline typename + __gnu_cxx::__enable_if<__is_scalar<_Tp>::__value, _OutputIterator>::__type + __fill_n_a(_OutputIterator __first, _Size __n, const _Tp& __value) + { + const _Tp __tmp = __value; + for (__decltype(__n + 0) __niter = __n; + __niter > 0; --__niter, ++__first) + *__first = __tmp; + return __first; + } + + template + inline typename + __gnu_cxx::__enable_if<__is_byte<_Tp>::__value, _Tp*>::__type + __fill_n_a(_Tp* __first, _Size __n, const _Tp& __c) + { + std::__fill_a(__first, __first + __n, __c); + return __first + __n; + } + + /** + * @brief Fills the range [first,first+n) with copies of value. + * @ingroup mutating_algorithms + * @param __first An output iterator. + * @param __n The count of copies to perform. + * @param __value A reference-to-const of arbitrary type. + * @return The iterator at first+n. + * + * This function fills a range with copies of the same value. For char + * types filling contiguous areas of memory, this becomes an inline call + * to @c memset or @ wmemset. + * + * _GLIBCXX_RESOLVE_LIB_DEFECTS + * DR 865. More algorithms that throw away information + */ + template + inline _OI + fill_n(_OI __first, _Size __n, const _Tp& __value) + { + // concept requirements + __glibcxx_function_requires(_OutputIteratorConcept<_OI, _Tp>) + + return _OI(std::__fill_n_a(std::__niter_base(__first), __n, __value)); + } + + template + struct __equal + { + template + static bool + equal(_II1 __first1, _II1 __last1, _II2 __first2) + { + for (; __first1 != __last1; ++__first1, (void)++__first2) + if (!(*__first1 == *__first2)) + return false; + return true; + } + }; + + template<> + struct __equal + { + template + static bool + equal(const _Tp* __first1, const _Tp* __last1, const _Tp* __first2) + { + if (const size_t __len = (__last1 - __first1)) + return !__builtin_memcmp(__first1, __first2, sizeof(_Tp) * __len); + return true; + } + }; + + template + inline bool + __equal_aux(_II1 __first1, _II1 __last1, _II2 __first2) + { + typedef typename iterator_traits<_II1>::value_type _ValueType1; + typedef typename iterator_traits<_II2>::value_type _ValueType2; + const bool __simple = ((__is_integer<_ValueType1>::__value + || __is_pointer<_ValueType1>::__value) + && __is_pointer<_II1>::__value + && __is_pointer<_II2>::__value + && __are_same<_ValueType1, _ValueType2>::__value); + + return std::__equal<__simple>::equal(__first1, __last1, __first2); + } + + template + struct __lc_rai + { + template + static _II1 + __newlast1(_II1, _II1 __last1, _II2, _II2) + { return __last1; } + + template + static bool + __cnd2(_II __first, _II __last) + { return __first != __last; } + }; + + template<> + struct __lc_rai + { + template + static _RAI1 + __newlast1(_RAI1 __first1, _RAI1 __last1, + _RAI2 __first2, _RAI2 __last2) + { + const typename iterator_traits<_RAI1>::difference_type + __diff1 = __last1 - __first1; + const typename iterator_traits<_RAI2>::difference_type + __diff2 = __last2 - __first2; + return __diff2 < __diff1 ? __first1 + __diff2 : __last1; + } + + template + static bool + __cnd2(_RAI, _RAI) + { return true; } + }; + + template + bool + __lexicographical_compare_impl(_II1 __first1, _II1 __last1, + _II2 __first2, _II2 __last2, + _Compare __comp) + { + typedef typename iterator_traits<_II1>::iterator_category _Category1; + typedef typename iterator_traits<_II2>::iterator_category _Category2; + typedef std::__lc_rai<_Category1, _Category2> __rai_type; + + __last1 = __rai_type::__newlast1(__first1, __last1, __first2, __last2); + for (; __first1 != __last1 && __rai_type::__cnd2(__first2, __last2); + ++__first1, (void)++__first2) + { + if (__comp(__first1, __first2)) + return true; + if (__comp(__first2, __first1)) + return false; + } + return __first1 == __last1 && __first2 != __last2; + } + + template + struct __lexicographical_compare + { + template + static bool __lc(_II1, _II1, _II2, _II2); + }; + + template + template + bool + __lexicographical_compare<_BoolType>:: + __lc(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2) + { + return std::__lexicographical_compare_impl(__first1, __last1, + __first2, __last2, + __gnu_cxx::__ops::__iter_less_iter()); + } + + template<> + struct __lexicographical_compare + { + template + static bool + __lc(const _Tp* __first1, const _Tp* __last1, + const _Up* __first2, const _Up* __last2) + { + const size_t __len1 = __last1 - __first1; + const size_t __len2 = __last2 - __first2; + if (const size_t __len = std::min(__len1, __len2)) + if (int __result = __builtin_memcmp(__first1, __first2, __len)) + return __result < 0; + return __len1 < __len2; + } + }; + + template + inline bool + __lexicographical_compare_aux(_II1 __first1, _II1 __last1, + _II2 __first2, _II2 __last2) + { + typedef typename iterator_traits<_II1>::value_type _ValueType1; + typedef typename iterator_traits<_II2>::value_type _ValueType2; + const bool __simple = + (__is_byte<_ValueType1>::__value && __is_byte<_ValueType2>::__value + && !__gnu_cxx::__numeric_traits<_ValueType1>::__is_signed + && !__gnu_cxx::__numeric_traits<_ValueType2>::__is_signed + && __is_pointer<_II1>::__value + && __is_pointer<_II2>::__value); + + return std::__lexicographical_compare<__simple>::__lc(__first1, __last1, + __first2, __last2); + } + + template + _ForwardIterator + __lower_bound(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __val, _Compare __comp) + { + typedef typename iterator_traits<_ForwardIterator>::difference_type + _DistanceType; + + _DistanceType __len = std::distance(__first, __last); + + while (__len > 0) + { + _DistanceType __half = __len >> 1; + _ForwardIterator __middle = __first; + std::advance(__middle, __half); + if (__comp(__middle, __val)) + { + __first = __middle; + ++__first; + __len = __len - __half - 1; + } + else + __len = __half; + } + return __first; + } + + /** + * @brief Finds the first position in which @a val could be inserted + * without changing the ordering. + * @param __first An iterator. + * @param __last Another iterator. + * @param __val The search term. + * @return An iterator pointing to the first element not less + * than @a val, or end() if every element is less than + * @a val. + * @ingroup binary_search_algorithms + */ + template + inline _ForwardIterator + lower_bound(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __val) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + __glibcxx_function_requires(_LessThanOpConcept< + typename iterator_traits<_ForwardIterator>::value_type, _Tp>) + __glibcxx_requires_partitioned_lower(__first, __last, __val); + + return std::__lower_bound(__first, __last, __val, + __gnu_cxx::__ops::__iter_less_val()); + } + + /// This is a helper function for the sort routines and for random.tcc. + // Precondition: __n > 0. + inline _GLIBCXX_CONSTEXPR int + __lg(int __n) + { return sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz(__n); } + + inline _GLIBCXX_CONSTEXPR unsigned + __lg(unsigned __n) + { return sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz(__n); } + + inline _GLIBCXX_CONSTEXPR long + __lg(long __n) + { return sizeof(long) * __CHAR_BIT__ - 1 - __builtin_clzl(__n); } + + inline _GLIBCXX_CONSTEXPR unsigned long + __lg(unsigned long __n) + { return sizeof(long) * __CHAR_BIT__ - 1 - __builtin_clzl(__n); } + + inline _GLIBCXX_CONSTEXPR long long + __lg(long long __n) + { return sizeof(long long) * __CHAR_BIT__ - 1 - __builtin_clzll(__n); } + + inline _GLIBCXX_CONSTEXPR unsigned long long + __lg(unsigned long long __n) + { return sizeof(long long) * __CHAR_BIT__ - 1 - __builtin_clzll(__n); } + +_GLIBCXX_END_NAMESPACE_VERSION + +_GLIBCXX_BEGIN_NAMESPACE_ALGO + + /** + * @brief Tests a range for element-wise equality. + * @ingroup non_mutating_algorithms + * @param __first1 An input iterator. + * @param __last1 An input iterator. + * @param __first2 An input iterator. + * @return A boolean true or false. + * + * This compares the elements of two ranges using @c == and returns true or + * false depending on whether all of the corresponding elements of the + * ranges are equal. + */ + template + inline bool + equal(_II1 __first1, _II1 __last1, _II2 __first2) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_II1>) + __glibcxx_function_requires(_InputIteratorConcept<_II2>) + __glibcxx_function_requires(_EqualOpConcept< + typename iterator_traits<_II1>::value_type, + typename iterator_traits<_II2>::value_type>) + __glibcxx_requires_valid_range(__first1, __last1); + + return std::__equal_aux(std::__niter_base(__first1), + std::__niter_base(__last1), + std::__niter_base(__first2)); + } + + /** + * @brief Tests a range for element-wise equality. + * @ingroup non_mutating_algorithms + * @param __first1 An input iterator. + * @param __last1 An input iterator. + * @param __first2 An input iterator. + * @param __binary_pred A binary predicate @link functors + * functor@endlink. + * @return A boolean true or false. + * + * This compares the elements of two ranges using the binary_pred + * parameter, and returns true or + * false depending on whether all of the corresponding elements of the + * ranges are equal. + */ + template + inline bool + equal(_IIter1 __first1, _IIter1 __last1, + _IIter2 __first2, _BinaryPredicate __binary_pred) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_IIter1>) + __glibcxx_function_requires(_InputIteratorConcept<_IIter2>) + __glibcxx_requires_valid_range(__first1, __last1); + + for (; __first1 != __last1; ++__first1, (void)++__first2) + if (!bool(__binary_pred(*__first1, *__first2))) + return false; + return true; + } + +#if __cplusplus > 201103L + +#define __cpp_lib_robust_nonmodifying_seq_ops 201304 + + /** + * @brief Tests a range for element-wise equality. + * @ingroup non_mutating_algorithms + * @param __first1 An input iterator. + * @param __last1 An input iterator. + * @param __first2 An input iterator. + * @param __last2 An input iterator. + * @return A boolean true or false. + * + * This compares the elements of two ranges using @c == and returns true or + * false depending on whether all of the corresponding elements of the + * ranges are equal. + */ + template + inline bool + equal(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_II1>) + __glibcxx_function_requires(_InputIteratorConcept<_II2>) + __glibcxx_function_requires(_EqualOpConcept< + typename iterator_traits<_II1>::value_type, + typename iterator_traits<_II2>::value_type>) + __glibcxx_requires_valid_range(__first1, __last1); + __glibcxx_requires_valid_range(__first2, __last2); + + using _RATag = random_access_iterator_tag; + using _Cat1 = typename iterator_traits<_II1>::iterator_category; + using _Cat2 = typename iterator_traits<_II2>::iterator_category; + using _RAIters = __and_, is_same<_Cat2, _RATag>>; + if (_RAIters()) + { + auto __d1 = std::distance(__first1, __last1); + auto __d2 = std::distance(__first2, __last2); + if (__d1 != __d2) + return false; + return _GLIBCXX_STD_A::equal(__first1, __last1, __first2); + } + + for (; __first1 != __last1 && __first2 != __last2; + ++__first1, (void)++__first2) + if (!(*__first1 == *__first2)) + return false; + return __first1 == __last1 && __first2 == __last2; + } + + /** + * @brief Tests a range for element-wise equality. + * @ingroup non_mutating_algorithms + * @param __first1 An input iterator. + * @param __last1 An input iterator. + * @param __first2 An input iterator. + * @param __last2 An input iterator. + * @param __binary_pred A binary predicate @link functors + * functor@endlink. + * @return A boolean true or false. + * + * This compares the elements of two ranges using the binary_pred + * parameter, and returns true or + * false depending on whether all of the corresponding elements of the + * ranges are equal. + */ + template + inline bool + equal(_IIter1 __first1, _IIter1 __last1, + _IIter2 __first2, _IIter2 __last2, _BinaryPredicate __binary_pred) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_IIter1>) + __glibcxx_function_requires(_InputIteratorConcept<_IIter2>) + __glibcxx_requires_valid_range(__first1, __last1); + __glibcxx_requires_valid_range(__first2, __last2); + + using _RATag = random_access_iterator_tag; + using _Cat1 = typename iterator_traits<_IIter1>::iterator_category; + using _Cat2 = typename iterator_traits<_IIter2>::iterator_category; + using _RAIters = __and_, is_same<_Cat2, _RATag>>; + if (_RAIters()) + { + auto __d1 = std::distance(__first1, __last1); + auto __d2 = std::distance(__first2, __last2); + if (__d1 != __d2) + return false; + return _GLIBCXX_STD_A::equal(__first1, __last1, __first2, + __binary_pred); + } + + for (; __first1 != __last1 && __first2 != __last2; + ++__first1, (void)++__first2) + if (!bool(__binary_pred(*__first1, *__first2))) + return false; + return __first1 == __last1 && __first2 == __last2; + } +#endif + + /** + * @brief Performs @b dictionary comparison on ranges. + * @ingroup sorting_algorithms + * @param __first1 An input iterator. + * @param __last1 An input iterator. + * @param __first2 An input iterator. + * @param __last2 An input iterator. + * @return A boolean true or false. + * + * Returns true if the sequence of elements defined by the range + * [first1,last1) is lexicographically less than the sequence of elements + * defined by the range [first2,last2). Returns false otherwise. + * (Quoted from [25.3.8]/1.) If the iterators are all character pointers, + * then this is an inline call to @c memcmp. + */ + template + inline bool + lexicographical_compare(_II1 __first1, _II1 __last1, + _II2 __first2, _II2 __last2) + { +#ifdef _GLIBCXX_CONCEPT_CHECKS + // concept requirements + typedef typename iterator_traits<_II1>::value_type _ValueType1; + typedef typename iterator_traits<_II2>::value_type _ValueType2; +#endif + __glibcxx_function_requires(_InputIteratorConcept<_II1>) + __glibcxx_function_requires(_InputIteratorConcept<_II2>) + __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>) + __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>) + __glibcxx_requires_valid_range(__first1, __last1); + __glibcxx_requires_valid_range(__first2, __last2); + + return std::__lexicographical_compare_aux(std::__niter_base(__first1), + std::__niter_base(__last1), + std::__niter_base(__first2), + std::__niter_base(__last2)); + } + + /** + * @brief Performs @b dictionary comparison on ranges. + * @ingroup sorting_algorithms + * @param __first1 An input iterator. + * @param __last1 An input iterator. + * @param __first2 An input iterator. + * @param __last2 An input iterator. + * @param __comp A @link comparison_functors comparison functor@endlink. + * @return A boolean true or false. + * + * The same as the four-parameter @c lexicographical_compare, but uses the + * comp parameter instead of @c <. + */ + template + inline bool + lexicographical_compare(_II1 __first1, _II1 __last1, + _II2 __first2, _II2 __last2, _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_II1>) + __glibcxx_function_requires(_InputIteratorConcept<_II2>) + __glibcxx_requires_valid_range(__first1, __last1); + __glibcxx_requires_valid_range(__first2, __last2); + + return std::__lexicographical_compare_impl + (__first1, __last1, __first2, __last2, + __gnu_cxx::__ops::__iter_comp_iter(__comp)); + } + + template + pair<_InputIterator1, _InputIterator2> + __mismatch(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _BinaryPredicate __binary_pred) + { + while (__first1 != __last1 && __binary_pred(__first1, __first2)) + { + ++__first1; + ++__first2; + } + return pair<_InputIterator1, _InputIterator2>(__first1, __first2); + } + + /** + * @brief Finds the places in ranges which don't match. + * @ingroup non_mutating_algorithms + * @param __first1 An input iterator. + * @param __last1 An input iterator. + * @param __first2 An input iterator. + * @return A pair of iterators pointing to the first mismatch. + * + * This compares the elements of two ranges using @c == and returns a pair + * of iterators. The first iterator points into the first range, the + * second iterator points into the second range, and the elements pointed + * to by the iterators are not equal. + */ + template + inline pair<_InputIterator1, _InputIterator2> + mismatch(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) + __glibcxx_function_requires(_EqualOpConcept< + typename iterator_traits<_InputIterator1>::value_type, + typename iterator_traits<_InputIterator2>::value_type>) + __glibcxx_requires_valid_range(__first1, __last1); + + return _GLIBCXX_STD_A::__mismatch(__first1, __last1, __first2, + __gnu_cxx::__ops::__iter_equal_to_iter()); + } + + /** + * @brief Finds the places in ranges which don't match. + * @ingroup non_mutating_algorithms + * @param __first1 An input iterator. + * @param __last1 An input iterator. + * @param __first2 An input iterator. + * @param __binary_pred A binary predicate @link functors + * functor@endlink. + * @return A pair of iterators pointing to the first mismatch. + * + * This compares the elements of two ranges using the binary_pred + * parameter, and returns a pair + * of iterators. The first iterator points into the first range, the + * second iterator points into the second range, and the elements pointed + * to by the iterators are not equal. + */ + template + inline pair<_InputIterator1, _InputIterator2> + mismatch(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _BinaryPredicate __binary_pred) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) + __glibcxx_requires_valid_range(__first1, __last1); + + return _GLIBCXX_STD_A::__mismatch(__first1, __last1, __first2, + __gnu_cxx::__ops::__iter_comp_iter(__binary_pred)); + } + +#if __cplusplus > 201103L + + template + pair<_InputIterator1, _InputIterator2> + __mismatch(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _BinaryPredicate __binary_pred) + { + while (__first1 != __last1 && __first2 != __last2 + && __binary_pred(__first1, __first2)) + { + ++__first1; + ++__first2; + } + return pair<_InputIterator1, _InputIterator2>(__first1, __first2); + } + + /** + * @brief Finds the places in ranges which don't match. + * @ingroup non_mutating_algorithms + * @param __first1 An input iterator. + * @param __last1 An input iterator. + * @param __first2 An input iterator. + * @param __last2 An input iterator. + * @return A pair of iterators pointing to the first mismatch. + * + * This compares the elements of two ranges using @c == and returns a pair + * of iterators. The first iterator points into the first range, the + * second iterator points into the second range, and the elements pointed + * to by the iterators are not equal. + */ + template + inline pair<_InputIterator1, _InputIterator2> + mismatch(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) + __glibcxx_function_requires(_EqualOpConcept< + typename iterator_traits<_InputIterator1>::value_type, + typename iterator_traits<_InputIterator2>::value_type>) + __glibcxx_requires_valid_range(__first1, __last1); + __glibcxx_requires_valid_range(__first2, __last2); + + return _GLIBCXX_STD_A::__mismatch(__first1, __last1, __first2, __last2, + __gnu_cxx::__ops::__iter_equal_to_iter()); + } + + /** + * @brief Finds the places in ranges which don't match. + * @ingroup non_mutating_algorithms + * @param __first1 An input iterator. + * @param __last1 An input iterator. + * @param __first2 An input iterator. + * @param __last2 An input iterator. + * @param __binary_pred A binary predicate @link functors + * functor@endlink. + * @return A pair of iterators pointing to the first mismatch. + * + * This compares the elements of two ranges using the binary_pred + * parameter, and returns a pair + * of iterators. The first iterator points into the first range, the + * second iterator points into the second range, and the elements pointed + * to by the iterators are not equal. + */ + template + inline pair<_InputIterator1, _InputIterator2> + mismatch(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _InputIterator2 __last2, + _BinaryPredicate __binary_pred) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) + __glibcxx_requires_valid_range(__first1, __last1); + __glibcxx_requires_valid_range(__first2, __last2); + + return _GLIBCXX_STD_A::__mismatch(__first1, __last1, __first2, __last2, + __gnu_cxx::__ops::__iter_comp_iter(__binary_pred)); + } +#endif + +_GLIBCXX_END_NAMESPACE_ALGO +} // namespace std + +// NB: This file is included within many other C++ includes, as a way +// of getting the base algorithms. So, make sure that parallel bits +// come in too if requested. +#ifdef _GLIBCXX_PARALLEL +# include +#endif + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_bvector.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_bvector.h new file mode 100644 index 0000000..37e000a --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_bvector.h @@ -0,0 +1,1294 @@ +// vector specialization -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996-1999 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_bvector.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{vector} + */ + +#ifndef _STL_BVECTOR_H +#define _STL_BVECTOR_H 1 + +#if __cplusplus >= 201103L +#include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_CONTAINER + + typedef unsigned long _Bit_type; + enum { _S_word_bit = int(__CHAR_BIT__ * sizeof(_Bit_type)) }; + + struct _Bit_reference + { + _Bit_type * _M_p; + _Bit_type _M_mask; + + _Bit_reference(_Bit_type * __x, _Bit_type __y) + : _M_p(__x), _M_mask(__y) { } + + _Bit_reference() _GLIBCXX_NOEXCEPT : _M_p(0), _M_mask(0) { } + + operator bool() const _GLIBCXX_NOEXCEPT + { return !!(*_M_p & _M_mask); } + + _Bit_reference& + operator=(bool __x) _GLIBCXX_NOEXCEPT + { + if (__x) + *_M_p |= _M_mask; + else + *_M_p &= ~_M_mask; + return *this; + } + + _Bit_reference& + operator=(const _Bit_reference& __x) _GLIBCXX_NOEXCEPT + { return *this = bool(__x); } + + bool + operator==(const _Bit_reference& __x) const + { return bool(*this) == bool(__x); } + + bool + operator<(const _Bit_reference& __x) const + { return !bool(*this) && bool(__x); } + + void + flip() _GLIBCXX_NOEXCEPT + { *_M_p ^= _M_mask; } + }; + +#if __cplusplus >= 201103L + inline void + swap(_Bit_reference __x, _Bit_reference __y) noexcept + { + bool __tmp = __x; + __x = __y; + __y = __tmp; + } + + inline void + swap(_Bit_reference __x, bool& __y) noexcept + { + bool __tmp = __x; + __x = __y; + __y = __tmp; + } + + inline void + swap(bool& __x, _Bit_reference __y) noexcept + { + bool __tmp = __x; + __x = __y; + __y = __tmp; + } +#endif + + struct _Bit_iterator_base + : public std::iterator + { + _Bit_type * _M_p; + unsigned int _M_offset; + + _Bit_iterator_base(_Bit_type * __x, unsigned int __y) + : _M_p(__x), _M_offset(__y) { } + + void + _M_bump_up() + { + if (_M_offset++ == int(_S_word_bit) - 1) + { + _M_offset = 0; + ++_M_p; + } + } + + void + _M_bump_down() + { + if (_M_offset-- == 0) + { + _M_offset = int(_S_word_bit) - 1; + --_M_p; + } + } + + void + _M_incr(ptrdiff_t __i) + { + difference_type __n = __i + _M_offset; + _M_p += __n / int(_S_word_bit); + __n = __n % int(_S_word_bit); + if (__n < 0) + { + __n += int(_S_word_bit); + --_M_p; + } + _M_offset = static_cast(__n); + } + + bool + operator==(const _Bit_iterator_base& __i) const + { return _M_p == __i._M_p && _M_offset == __i._M_offset; } + + bool + operator<(const _Bit_iterator_base& __i) const + { + return _M_p < __i._M_p + || (_M_p == __i._M_p && _M_offset < __i._M_offset); + } + + bool + operator!=(const _Bit_iterator_base& __i) const + { return !(*this == __i); } + + bool + operator>(const _Bit_iterator_base& __i) const + { return __i < *this; } + + bool + operator<=(const _Bit_iterator_base& __i) const + { return !(__i < *this); } + + bool + operator>=(const _Bit_iterator_base& __i) const + { return !(*this < __i); } + }; + + inline ptrdiff_t + operator-(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) + { + return (int(_S_word_bit) * (__x._M_p - __y._M_p) + + __x._M_offset - __y._M_offset); + } + + struct _Bit_iterator : public _Bit_iterator_base + { + typedef _Bit_reference reference; + typedef _Bit_reference* pointer; + typedef _Bit_iterator iterator; + + _Bit_iterator() : _Bit_iterator_base(0, 0) { } + + _Bit_iterator(_Bit_type * __x, unsigned int __y) + : _Bit_iterator_base(__x, __y) { } + + iterator + _M_const_cast() const + { return *this; } + + reference + operator*() const + { return reference(_M_p, 1UL << _M_offset); } + + iterator& + operator++() + { + _M_bump_up(); + return *this; + } + + iterator + operator++(int) + { + iterator __tmp = *this; + _M_bump_up(); + return __tmp; + } + + iterator& + operator--() + { + _M_bump_down(); + return *this; + } + + iterator + operator--(int) + { + iterator __tmp = *this; + _M_bump_down(); + return __tmp; + } + + iterator& + operator+=(difference_type __i) + { + _M_incr(__i); + return *this; + } + + iterator& + operator-=(difference_type __i) + { + *this += -__i; + return *this; + } + + iterator + operator+(difference_type __i) const + { + iterator __tmp = *this; + return __tmp += __i; + } + + iterator + operator-(difference_type __i) const + { + iterator __tmp = *this; + return __tmp -= __i; + } + + reference + operator[](difference_type __i) const + { return *(*this + __i); } + }; + + inline _Bit_iterator + operator+(ptrdiff_t __n, const _Bit_iterator& __x) + { return __x + __n; } + + struct _Bit_const_iterator : public _Bit_iterator_base + { + typedef bool reference; + typedef bool const_reference; + typedef const bool* pointer; + typedef _Bit_const_iterator const_iterator; + + _Bit_const_iterator() : _Bit_iterator_base(0, 0) { } + + _Bit_const_iterator(_Bit_type * __x, unsigned int __y) + : _Bit_iterator_base(__x, __y) { } + + _Bit_const_iterator(const _Bit_iterator& __x) + : _Bit_iterator_base(__x._M_p, __x._M_offset) { } + + _Bit_iterator + _M_const_cast() const + { return _Bit_iterator(_M_p, _M_offset); } + + const_reference + operator*() const + { return _Bit_reference(_M_p, 1UL << _M_offset); } + + const_iterator& + operator++() + { + _M_bump_up(); + return *this; + } + + const_iterator + operator++(int) + { + const_iterator __tmp = *this; + _M_bump_up(); + return __tmp; + } + + const_iterator& + operator--() + { + _M_bump_down(); + return *this; + } + + const_iterator + operator--(int) + { + const_iterator __tmp = *this; + _M_bump_down(); + return __tmp; + } + + const_iterator& + operator+=(difference_type __i) + { + _M_incr(__i); + return *this; + } + + const_iterator& + operator-=(difference_type __i) + { + *this += -__i; + return *this; + } + + const_iterator + operator+(difference_type __i) const + { + const_iterator __tmp = *this; + return __tmp += __i; + } + + const_iterator + operator-(difference_type __i) const + { + const_iterator __tmp = *this; + return __tmp -= __i; + } + + const_reference + operator[](difference_type __i) const + { return *(*this + __i); } + }; + + inline _Bit_const_iterator + operator+(ptrdiff_t __n, const _Bit_const_iterator& __x) + { return __x + __n; } + + inline void + __fill_bvector(_Bit_iterator __first, _Bit_iterator __last, bool __x) + { + for (; __first != __last; ++__first) + *__first = __x; + } + + inline void + fill(_Bit_iterator __first, _Bit_iterator __last, const bool& __x) + { + if (__first._M_p != __last._M_p) + { + std::fill(__first._M_p + 1, __last._M_p, __x ? ~0 : 0); + __fill_bvector(__first, _Bit_iterator(__first._M_p + 1, 0), __x); + __fill_bvector(_Bit_iterator(__last._M_p, 0), __last, __x); + } + else + __fill_bvector(__first, __last, __x); + } + + template + struct _Bvector_base + { + typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template + rebind<_Bit_type>::other _Bit_alloc_type; + typedef typename __gnu_cxx::__alloc_traits<_Bit_alloc_type> + _Bit_alloc_traits; + typedef typename _Bit_alloc_traits::pointer _Bit_pointer; + + struct _Bvector_impl + : public _Bit_alloc_type + { + _Bit_iterator _M_start; + _Bit_iterator _M_finish; + _Bit_pointer _M_end_of_storage; + + _Bvector_impl() + : _Bit_alloc_type(), _M_start(), _M_finish(), _M_end_of_storage() + { } + + _Bvector_impl(const _Bit_alloc_type& __a) + : _Bit_alloc_type(__a), _M_start(), _M_finish(), _M_end_of_storage() + { } + +#if __cplusplus >= 201103L + _Bvector_impl(_Bit_alloc_type&& __a) + : _Bit_alloc_type(std::move(__a)), _M_start(), _M_finish(), + _M_end_of_storage() + { } +#endif + + _Bit_type* + _M_end_addr() const _GLIBCXX_NOEXCEPT + { + if (_M_end_of_storage) + return std::__addressof(_M_end_of_storage[-1]) + 1; + return 0; + } + }; + + public: + typedef _Alloc allocator_type; + + _Bit_alloc_type& + _M_get_Bit_allocator() _GLIBCXX_NOEXCEPT + { return *static_cast<_Bit_alloc_type*>(&this->_M_impl); } + + const _Bit_alloc_type& + _M_get_Bit_allocator() const _GLIBCXX_NOEXCEPT + { return *static_cast(&this->_M_impl); } + + allocator_type + get_allocator() const _GLIBCXX_NOEXCEPT + { return allocator_type(_M_get_Bit_allocator()); } + + _Bvector_base() + : _M_impl() { } + + _Bvector_base(const allocator_type& __a) + : _M_impl(__a) { } + +#if __cplusplus >= 201103L + _Bvector_base(_Bvector_base&& __x) noexcept + : _M_impl(std::move(__x._M_get_Bit_allocator())) + { + this->_M_impl._M_start = __x._M_impl._M_start; + this->_M_impl._M_finish = __x._M_impl._M_finish; + this->_M_impl._M_end_of_storage = __x._M_impl._M_end_of_storage; + __x._M_impl._M_start = _Bit_iterator(); + __x._M_impl._M_finish = _Bit_iterator(); + __x._M_impl._M_end_of_storage = nullptr; + } +#endif + + ~_Bvector_base() + { this->_M_deallocate(); } + + protected: + _Bvector_impl _M_impl; + + _Bit_pointer + _M_allocate(size_t __n) + { return _Bit_alloc_traits::allocate(_M_impl, _S_nword(__n)); } + + void + _M_deallocate() + { + if (_M_impl._M_start._M_p) + { + const size_t __n = _M_impl._M_end_addr() - _M_impl._M_start._M_p; + _Bit_alloc_traits::deallocate(_M_impl, + _M_impl._M_end_of_storage - __n, + __n); + _M_impl._M_start = _M_impl._M_finish = _Bit_iterator(); + _M_impl._M_end_of_storage = _Bit_pointer(); + } + } + + static size_t + _S_nword(size_t __n) + { return (__n + int(_S_word_bit) - 1) / int(_S_word_bit); } + }; + +_GLIBCXX_END_NAMESPACE_CONTAINER +} // namespace std + +// Declare a partial specialization of vector. +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_CONTAINER + + /** + * @brief A specialization of vector for booleans which offers fixed time + * access to individual elements in any order. + * + * @ingroup sequences + * + * @tparam _Alloc Allocator type. + * + * Note that vector does not actually meet the requirements for being + * a container. This is because the reference and pointer types are not + * really references and pointers to bool. See DR96 for details. @see + * vector for function documentation. + * + * In some terminology a %vector can be described as a dynamic + * C-style array, it offers fast and efficient access to individual + * elements in any order and saves the user from worrying about + * memory and size allocation. Subscripting ( @c [] ) access is + * also provided as with C-style arrays. + */ +template + class vector : protected _Bvector_base<_Alloc> + { + typedef _Bvector_base<_Alloc> _Base; + typedef typename _Base::_Bit_pointer _Bit_pointer; + typedef typename _Base::_Bit_alloc_traits _Bit_alloc_traits; + +#if __cplusplus >= 201103L + template friend struct hash; +#endif + + public: + typedef bool value_type; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Bit_reference reference; + typedef bool const_reference; + typedef _Bit_reference* pointer; + typedef const bool* const_pointer; + typedef _Bit_iterator iterator; + typedef _Bit_const_iterator const_iterator; + typedef std::reverse_iterator const_reverse_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef _Alloc allocator_type; + + allocator_type get_allocator() const + { return _Base::get_allocator(); } + + protected: + using _Base::_M_allocate; + using _Base::_M_deallocate; + using _Base::_S_nword; + using _Base::_M_get_Bit_allocator; + + public: + vector() +#if __cplusplus >= 201103L + noexcept(is_nothrow_default_constructible::value) +#endif + : _Base() { } + + explicit + vector(const allocator_type& __a) + : _Base(__a) { } + +#if __cplusplus >= 201103L + explicit + vector(size_type __n, const allocator_type& __a = allocator_type()) + : vector(__n, false, __a) + { } + + vector(size_type __n, const bool& __value, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { + _M_initialize(__n); + std::fill(this->_M_impl._M_start._M_p, this->_M_impl._M_end_addr(), + __value ? ~0 : 0); + } +#else + explicit + vector(size_type __n, const bool& __value = bool(), + const allocator_type& __a = allocator_type()) + : _Base(__a) + { + _M_initialize(__n); + std::fill(this->_M_impl._M_start._M_p, this->_M_impl._M_end_addr(), + __value ? ~0 : 0); + } +#endif + + vector(const vector& __x) + : _Base(_Bit_alloc_traits::_S_select_on_copy(__x._M_get_Bit_allocator())) + { + _M_initialize(__x.size()); + _M_copy_aligned(__x.begin(), __x.end(), this->_M_impl._M_start); + } + +#if __cplusplus >= 201103L + vector(vector&& __x) noexcept + : _Base(std::move(__x)) { } + + vector(vector&& __x, const allocator_type& __a) + noexcept(_Bit_alloc_traits::_S_always_equal()) + : _Base(__a) + { + if (__x.get_allocator() == __a) + { + this->_M_impl._M_start = __x._M_impl._M_start; + this->_M_impl._M_finish = __x._M_impl._M_finish; + this->_M_impl._M_end_of_storage = __x._M_impl._M_end_of_storage; + __x._M_impl._M_start = _Bit_iterator(); + __x._M_impl._M_finish = _Bit_iterator(); + __x._M_impl._M_end_of_storage = nullptr; + } + else + { + _M_initialize(__x.size()); + _M_copy_aligned(__x.begin(), __x.end(), begin()); + __x.clear(); + } + } + + vector(const vector& __x, const allocator_type& __a) + : _Base(__a) + { + _M_initialize(__x.size()); + _M_copy_aligned(__x.begin(), __x.end(), this->_M_impl._M_start); + } + + vector(initializer_list __l, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { + _M_initialize_range(__l.begin(), __l.end(), + random_access_iterator_tag()); + } +#endif + +#if __cplusplus >= 201103L + template> + vector(_InputIterator __first, _InputIterator __last, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { _M_initialize_dispatch(__first, __last, __false_type()); } +#else + template + vector(_InputIterator __first, _InputIterator __last, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + _M_initialize_dispatch(__first, __last, _Integral()); + } +#endif + + ~vector() _GLIBCXX_NOEXCEPT { } + + vector& + operator=(const vector& __x) + { + if (&__x == this) + return *this; +#if __cplusplus >= 201103L + if (_Bit_alloc_traits::_S_propagate_on_copy_assign()) + { + if (this->_M_get_Bit_allocator() != __x._M_get_Bit_allocator()) + { + this->_M_deallocate(); + std::__alloc_on_copy(_M_get_Bit_allocator(), + __x._M_get_Bit_allocator()); + _M_initialize(__x.size()); + } + else + std::__alloc_on_copy(_M_get_Bit_allocator(), + __x._M_get_Bit_allocator()); + } +#endif + if (__x.size() > capacity()) + { + this->_M_deallocate(); + _M_initialize(__x.size()); + } + this->_M_impl._M_finish = _M_copy_aligned(__x.begin(), __x.end(), + begin()); + return *this; + } + +#if __cplusplus >= 201103L + vector& + operator=(vector&& __x) noexcept(_Bit_alloc_traits::_S_nothrow_move()) + { + if (_Bit_alloc_traits::_S_propagate_on_move_assign() + || this->_M_get_Bit_allocator() == __x._M_get_Bit_allocator()) + { + this->_M_deallocate(); + this->_M_impl._M_start = __x._M_impl._M_start; + this->_M_impl._M_finish = __x._M_impl._M_finish; + this->_M_impl._M_end_of_storage = __x._M_impl._M_end_of_storage; + __x._M_impl._M_start = _Bit_iterator(); + __x._M_impl._M_finish = _Bit_iterator(); + __x._M_impl._M_end_of_storage = nullptr; + std::__alloc_on_move(_M_get_Bit_allocator(), + __x._M_get_Bit_allocator()); + } + else + { + if (__x.size() > capacity()) + { + this->_M_deallocate(); + _M_initialize(__x.size()); + } + this->_M_impl._M_finish = _M_copy_aligned(__x.begin(), __x.end(), + begin()); + __x.clear(); + } + return *this; + } + + vector& + operator=(initializer_list __l) + { + this->assign (__l.begin(), __l.end()); + return *this; + } +#endif + + // assign(), a generalized assignment member function. Two + // versions: one that takes a count, and one that takes a range. + // The range version is a member template, so we dispatch on whether + // or not the type is an integer. + void + assign(size_type __n, const bool& __x) + { _M_fill_assign(__n, __x); } + +#if __cplusplus >= 201103L + template> + void + assign(_InputIterator __first, _InputIterator __last) + { _M_assign_dispatch(__first, __last, __false_type()); } +#else + template + void + assign(_InputIterator __first, _InputIterator __last) + { + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + _M_assign_dispatch(__first, __last, _Integral()); + } +#endif + +#if __cplusplus >= 201103L + void + assign(initializer_list __l) + { this->assign(__l.begin(), __l.end()); } +#endif + + iterator + begin() _GLIBCXX_NOEXCEPT + { return this->_M_impl._M_start; } + + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return this->_M_impl._M_start; } + + iterator + end() _GLIBCXX_NOEXCEPT + { return this->_M_impl._M_finish; } + + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return this->_M_impl._M_finish; } + + reverse_iterator + rbegin() _GLIBCXX_NOEXCEPT + { return reverse_iterator(end()); } + + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(end()); } + + reverse_iterator + rend() _GLIBCXX_NOEXCEPT + { return reverse_iterator(begin()); } + + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(begin()); } + +#if __cplusplus >= 201103L + const_iterator + cbegin() const noexcept + { return this->_M_impl._M_start; } + + const_iterator + cend() const noexcept + { return this->_M_impl._M_finish; } + + const_reverse_iterator + crbegin() const noexcept + { return const_reverse_iterator(end()); } + + const_reverse_iterator + crend() const noexcept + { return const_reverse_iterator(begin()); } +#endif + + size_type + size() const _GLIBCXX_NOEXCEPT + { return size_type(end() - begin()); } + + size_type + max_size() const _GLIBCXX_NOEXCEPT + { + const size_type __isize = + __gnu_cxx::__numeric_traits::__max + - int(_S_word_bit) + 1; + const size_type __asize + = _Bit_alloc_traits::max_size(_M_get_Bit_allocator()); + return (__asize <= __isize / int(_S_word_bit) + ? __asize * int(_S_word_bit) : __isize); + } + + size_type + capacity() const _GLIBCXX_NOEXCEPT + { return size_type(const_iterator(this->_M_impl._M_end_addr(), 0) + - begin()); } + + bool + empty() const _GLIBCXX_NOEXCEPT + { return begin() == end(); } + + reference + operator[](size_type __n) + { + return *iterator(this->_M_impl._M_start._M_p + + __n / int(_S_word_bit), __n % int(_S_word_bit)); + } + + const_reference + operator[](size_type __n) const + { + return *const_iterator(this->_M_impl._M_start._M_p + + __n / int(_S_word_bit), __n % int(_S_word_bit)); + } + + protected: + void + _M_range_check(size_type __n) const + { + if (__n >= this->size()) + __throw_out_of_range_fmt(__N("vector::_M_range_check: __n " + "(which is %zu) >= this->size() " + "(which is %zu)"), + __n, this->size()); + } + + public: + reference + at(size_type __n) + { _M_range_check(__n); return (*this)[__n]; } + + const_reference + at(size_type __n) const + { _M_range_check(__n); return (*this)[__n]; } + + void + reserve(size_type __n) + { + if (__n > max_size()) + __throw_length_error(__N("vector::reserve")); + if (capacity() < __n) + _M_reallocate(__n); + } + + reference + front() + { return *begin(); } + + const_reference + front() const + { return *begin(); } + + reference + back() + { return *(end() - 1); } + + const_reference + back() const + { return *(end() - 1); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 464. Suggestion for new member functions in standard containers. + // N.B. DR 464 says nothing about vector but we need something + // here due to the way we are implementing DR 464 in the debug-mode + // vector class. + void + data() _GLIBCXX_NOEXCEPT { } + + void + push_back(bool __x) + { + if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_addr()) + *this->_M_impl._M_finish++ = __x; + else + _M_insert_aux(end(), __x); + } + + void + swap(vector& __x) _GLIBCXX_NOEXCEPT + { + std::swap(this->_M_impl._M_start, __x._M_impl._M_start); + std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish); + std::swap(this->_M_impl._M_end_of_storage, + __x._M_impl._M_end_of_storage); + _Bit_alloc_traits::_S_on_swap(_M_get_Bit_allocator(), + __x._M_get_Bit_allocator()); + } + + // [23.2.5]/1, third-to-last entry in synopsis listing + static void + swap(reference __x, reference __y) _GLIBCXX_NOEXCEPT + { + bool __tmp = __x; + __x = __y; + __y = __tmp; + } + + iterator +#if __cplusplus >= 201103L + insert(const_iterator __position, const bool& __x = bool()) +#else + insert(iterator __position, const bool& __x = bool()) +#endif + { + const difference_type __n = __position - begin(); + if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_addr() + && __position == end()) + *this->_M_impl._M_finish++ = __x; + else + _M_insert_aux(__position._M_const_cast(), __x); + return begin() + __n; + } + +#if __cplusplus >= 201103L + template> + iterator + insert(const_iterator __position, + _InputIterator __first, _InputIterator __last) + { + difference_type __offset = __position - cbegin(); + _M_insert_dispatch(__position._M_const_cast(), + __first, __last, __false_type()); + return begin() + __offset; + } +#else + template + void + insert(iterator __position, + _InputIterator __first, _InputIterator __last) + { + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + _M_insert_dispatch(__position, __first, __last, _Integral()); + } +#endif + +#if __cplusplus >= 201103L + iterator + insert(const_iterator __position, size_type __n, const bool& __x) + { + difference_type __offset = __position - cbegin(); + _M_fill_insert(__position._M_const_cast(), __n, __x); + return begin() + __offset; + } +#else + void + insert(iterator __position, size_type __n, const bool& __x) + { _M_fill_insert(__position, __n, __x); } +#endif + +#if __cplusplus >= 201103L + iterator + insert(const_iterator __p, initializer_list __l) + { return this->insert(__p, __l.begin(), __l.end()); } +#endif + + void + pop_back() + { --this->_M_impl._M_finish; } + + iterator +#if __cplusplus >= 201103L + erase(const_iterator __position) +#else + erase(iterator __position) +#endif + { return _M_erase(__position._M_const_cast()); } + + iterator +#if __cplusplus >= 201103L + erase(const_iterator __first, const_iterator __last) +#else + erase(iterator __first, iterator __last) +#endif + { return _M_erase(__first._M_const_cast(), __last._M_const_cast()); } + + void + resize(size_type __new_size, bool __x = bool()) + { + if (__new_size < size()) + _M_erase_at_end(begin() + difference_type(__new_size)); + else + insert(end(), __new_size - size(), __x); + } + +#if __cplusplus >= 201103L + void + shrink_to_fit() + { _M_shrink_to_fit(); } +#endif + + void + flip() _GLIBCXX_NOEXCEPT + { + _Bit_type * const __end = this->_M_impl._M_end_addr(); + for (_Bit_type * __p = this->_M_impl._M_start._M_p; __p != __end; ++__p) + *__p = ~*__p; + } + + void + clear() _GLIBCXX_NOEXCEPT + { _M_erase_at_end(begin()); } + +#if __cplusplus >= 201103L + template +#if __cplusplus > 201402L + reference +#else + void +#endif + emplace_back(_Args&&... __args) + { + push_back(bool(__args...)); +#if __cplusplus > 201402L + return back(); +#endif + } + + template + iterator + emplace(const_iterator __pos, _Args&&... __args) + { return insert(__pos, bool(__args...)); } +#endif + + protected: + // Precondition: __first._M_offset == 0 && __result._M_offset == 0. + iterator + _M_copy_aligned(const_iterator __first, const_iterator __last, + iterator __result) + { + _Bit_type* __q = std::copy(__first._M_p, __last._M_p, __result._M_p); + return std::copy(const_iterator(__last._M_p, 0), __last, + iterator(__q, 0)); + } + + void + _M_initialize(size_type __n) + { + _Bit_pointer __q = this->_M_allocate(__n); + this->_M_impl._M_end_of_storage = __q + _S_nword(__n); + this->_M_impl._M_start = iterator(std::__addressof(*__q), 0); + this->_M_impl._M_finish = this->_M_impl._M_start + difference_type(__n); + } + + void + _M_reallocate(size_type __n); + +#if __cplusplus >= 201103L + bool + _M_shrink_to_fit(); +#endif + + // Check whether it's an integral type. If so, it's not an iterator. + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 438. Ambiguity in the "do the right thing" clause + template + void + _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type) + { + _M_initialize(static_cast(__n)); + std::fill(this->_M_impl._M_start._M_p, + this->_M_impl._M_end_addr(), __x ? ~0 : 0); + } + + template + void + _M_initialize_dispatch(_InputIterator __first, _InputIterator __last, + __false_type) + { _M_initialize_range(__first, __last, + std::__iterator_category(__first)); } + + template + void + _M_initialize_range(_InputIterator __first, _InputIterator __last, + std::input_iterator_tag) + { + for (; __first != __last; ++__first) + push_back(*__first); + } + + template + void + _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last, + std::forward_iterator_tag) + { + const size_type __n = std::distance(__first, __last); + _M_initialize(__n); + std::copy(__first, __last, this->_M_impl._M_start); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 438. Ambiguity in the "do the right thing" clause + template + void + _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) + { _M_fill_assign(__n, __val); } + + template + void + _M_assign_dispatch(_InputIterator __first, _InputIterator __last, + __false_type) + { _M_assign_aux(__first, __last, std::__iterator_category(__first)); } + + void + _M_fill_assign(size_t __n, bool __x) + { + if (__n > size()) + { + std::fill(this->_M_impl._M_start._M_p, + this->_M_impl._M_end_addr(), __x ? ~0 : 0); + insert(end(), __n - size(), __x); + } + else + { + _M_erase_at_end(begin() + __n); + std::fill(this->_M_impl._M_start._M_p, + this->_M_impl._M_end_addr(), __x ? ~0 : 0); + } + } + + template + void + _M_assign_aux(_InputIterator __first, _InputIterator __last, + std::input_iterator_tag) + { + iterator __cur = begin(); + for (; __first != __last && __cur != end(); ++__cur, ++__first) + *__cur = *__first; + if (__first == __last) + _M_erase_at_end(__cur); + else + insert(end(), __first, __last); + } + + template + void + _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, + std::forward_iterator_tag) + { + const size_type __len = std::distance(__first, __last); + if (__len < size()) + _M_erase_at_end(std::copy(__first, __last, begin())); + else + { + _ForwardIterator __mid = __first; + std::advance(__mid, size()); + std::copy(__first, __mid, begin()); + insert(end(), __mid, __last); + } + } + + // Check whether it's an integral type. If so, it's not an iterator. + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 438. Ambiguity in the "do the right thing" clause + template + void + _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x, + __true_type) + { _M_fill_insert(__pos, __n, __x); } + + template + void + _M_insert_dispatch(iterator __pos, + _InputIterator __first, _InputIterator __last, + __false_type) + { _M_insert_range(__pos, __first, __last, + std::__iterator_category(__first)); } + + void + _M_fill_insert(iterator __position, size_type __n, bool __x); + + template + void + _M_insert_range(iterator __pos, _InputIterator __first, + _InputIterator __last, std::input_iterator_tag) + { + for (; __first != __last; ++__first) + { + __pos = insert(__pos, *__first); + ++__pos; + } + } + + template + void + _M_insert_range(iterator __position, _ForwardIterator __first, + _ForwardIterator __last, std::forward_iterator_tag); + + void + _M_insert_aux(iterator __position, bool __x); + + size_type + _M_check_len(size_type __n, const char* __s) const + { + if (max_size() - size() < __n) + __throw_length_error(__N(__s)); + + const size_type __len = size() + std::max(size(), __n); + return (__len < size() || __len > max_size()) ? max_size() : __len; + } + + void + _M_erase_at_end(iterator __pos) + { this->_M_impl._M_finish = __pos; } + + iterator + _M_erase(iterator __pos); + + iterator + _M_erase(iterator __first, iterator __last); + }; + +_GLIBCXX_END_NAMESPACE_CONTAINER +} // namespace std + +#if __cplusplus >= 201103L + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // DR 1182. + /// std::hash specialization for vector. + template + struct hash<_GLIBCXX_STD_C::vector> + : public __hash_base> + { + size_t + operator()(const _GLIBCXX_STD_C::vector&) const noexcept; + }; + +_GLIBCXX_END_NAMESPACE_VERSION +}// namespace std + +#endif // C++11 + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_construct.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_construct.h new file mode 100644 index 0000000..71483b4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_construct.h @@ -0,0 +1,236 @@ +// nonstandard construct and destroy functions -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_construct.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _STL_CONSTRUCT_H +#define _STL_CONSTRUCT_H 1 + +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * Constructs an object in existing memory by invoking an allocated + * object's constructor with an initializer. + */ +#if __cplusplus >= 201103L + template + inline void + _Construct(_T1* __p, _Args&&... __args) + { ::new(static_cast(__p)) _T1(std::forward<_Args>(__args)...); } +#else + template + inline void + _Construct(_T1* __p, const _T2& __value) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 402. wrong new expression in [some_]allocator::construct + ::new(static_cast(__p)) _T1(__value); + } +#endif + + template + inline void + _Construct_novalue(_T1* __p) + { ::new(static_cast(__p)) _T1; } + + /** + * Destroy the object pointed to by a pointer type. + */ + template + inline void + _Destroy(_Tp* __pointer) + { __pointer->~_Tp(); } + + template + struct _Destroy_aux + { + template + static void + __destroy(_ForwardIterator __first, _ForwardIterator __last) + { + for (; __first != __last; ++__first) + std::_Destroy(std::__addressof(*__first)); + } + }; + + template<> + struct _Destroy_aux + { + template + static void + __destroy(_ForwardIterator, _ForwardIterator) { } + }; + + /** + * Destroy a range of objects. If the value_type of the object has + * a trivial destructor, the compiler should optimize all of this + * away, otherwise the objects' destructors must be invoked. + */ + template + inline void + _Destroy(_ForwardIterator __first, _ForwardIterator __last) + { + typedef typename iterator_traits<_ForwardIterator>::value_type + _Value_type; +#if __cplusplus >= 201103L + // A deleted destructor is trivial, this ensures we reject such types: + static_assert(is_destructible<_Value_type>::value, + "value type is destructible"); +#endif + std::_Destroy_aux<__has_trivial_destructor(_Value_type)>:: + __destroy(__first, __last); + } + + template + struct _Destroy_n_aux + { + template + static _ForwardIterator + __destroy_n(_ForwardIterator __first, _Size __count) + { + for (; __count > 0; (void)++__first, --__count) + std::_Destroy(std::__addressof(*__first)); + return __first; + } + }; + + template<> + struct _Destroy_n_aux + { + template + static _ForwardIterator + __destroy_n(_ForwardIterator __first, _Size __count) + { + std::advance(__first, __count); + return __first; + } + }; + + /** + * Destroy a range of objects. If the value_type of the object has + * a trivial destructor, the compiler should optimize all of this + * away, otherwise the objects' destructors must be invoked. + */ + template + inline _ForwardIterator + _Destroy_n(_ForwardIterator __first, _Size __count) + { + typedef typename iterator_traits<_ForwardIterator>::value_type + _Value_type; +#if __cplusplus >= 201103L + // A deleted destructor is trivial, this ensures we reject such types: + static_assert(is_destructible<_Value_type>::value, + "value type is destructible"); +#endif + return std::_Destroy_n_aux<__has_trivial_destructor(_Value_type)>:: + __destroy_n(__first, __count); + } + + /** + * Destroy a range of objects using the supplied allocator. For + * nondefault allocators we do not optimize away invocation of + * destroy() even if _Tp has a trivial destructor. + */ + + template + void + _Destroy(_ForwardIterator __first, _ForwardIterator __last, + _Allocator& __alloc) + { + typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; + for (; __first != __last; ++__first) + __traits::destroy(__alloc, std::__addressof(*__first)); + } + + template + inline void + _Destroy(_ForwardIterator __first, _ForwardIterator __last, + allocator<_Tp>&) + { + _Destroy(__first, __last); + } + +#if __cplusplus > 201402L + template + inline void + destroy_at(_Tp* __location) + { + std::_Destroy(__location); + } + + template + inline void + destroy(_ForwardIterator __first, _ForwardIterator __last) + { + std::_Destroy(__first, __last); + } + + template + inline _ForwardIterator + destroy_n(_ForwardIterator __first, _Size __count) + { + return std::_Destroy_n(__first, __count); + } +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif /* _STL_CONSTRUCT_H */ + diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_deque.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_deque.h new file mode 100644 index 0000000..6090635 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_deque.h @@ -0,0 +1,2321 @@ +// Deque implementation -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_deque.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{deque} + */ + +#ifndef _STL_DEQUE_H +#define _STL_DEQUE_H 1 + +#include +#include +#include +#if __cplusplus >= 201103L +#include +#endif + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_CONTAINER + + /** + * @brief This function controls the size of memory nodes. + * @param __size The size of an element. + * @return The number (not byte size) of elements per node. + * + * This function started off as a compiler kludge from SGI, but + * seems to be a useful wrapper around a repeated constant + * expression. The @b 512 is tunable (and no other code needs to + * change), but no investigation has been done since inheriting the + * SGI code. Touch _GLIBCXX_DEQUE_BUF_SIZE only if you know what + * you are doing, however: changing it breaks the binary + * compatibility!! + */ + +#ifndef _GLIBCXX_DEQUE_BUF_SIZE +#define _GLIBCXX_DEQUE_BUF_SIZE 512 +#endif + + _GLIBCXX_CONSTEXPR inline size_t + __deque_buf_size(size_t __size) + { return (__size < _GLIBCXX_DEQUE_BUF_SIZE + ? size_t(_GLIBCXX_DEQUE_BUF_SIZE / __size) : size_t(1)); } + + + /** + * @brief A deque::iterator. + * + * Quite a bit of intelligence here. Much of the functionality of + * deque is actually passed off to this class. A deque holds two + * of these internally, marking its valid range. Access to + * elements is done as offsets of either of those two, relying on + * operator overloading in this class. + * + * All the functions are op overloads except for _M_set_node. + */ + template + struct _Deque_iterator + { +#if __cplusplus < 201103L + typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator; + typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator; + typedef _Tp* _Elt_pointer; + typedef _Tp** _Map_pointer; +#else + private: + template + using __ptr_to = typename pointer_traits<_Ptr>::template rebind<_Up>; + template + using __iter = _Deque_iterator<_Tp, _CvTp&, __ptr_to<_CvTp>>; + public: + typedef __iter<_Tp> iterator; + typedef __iter const_iterator; + typedef __ptr_to<_Tp> _Elt_pointer; + typedef __ptr_to<_Elt_pointer> _Map_pointer; +#endif + + static size_t _S_buffer_size() _GLIBCXX_NOEXCEPT + { return __deque_buf_size(sizeof(_Tp)); } + + typedef std::random_access_iterator_tag iterator_category; + typedef _Tp value_type; + typedef _Ptr pointer; + typedef _Ref reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Deque_iterator _Self; + + _Elt_pointer _M_cur; + _Elt_pointer _M_first; + _Elt_pointer _M_last; + _Map_pointer _M_node; + + _Deque_iterator(_Elt_pointer __x, _Map_pointer __y) _GLIBCXX_NOEXCEPT + : _M_cur(__x), _M_first(*__y), + _M_last(*__y + _S_buffer_size()), _M_node(__y) { } + + _Deque_iterator() _GLIBCXX_NOEXCEPT + : _M_cur(), _M_first(), _M_last(), _M_node() { } + + _Deque_iterator(const iterator& __x) _GLIBCXX_NOEXCEPT + : _M_cur(__x._M_cur), _M_first(__x._M_first), + _M_last(__x._M_last), _M_node(__x._M_node) { } + + iterator + _M_const_cast() const _GLIBCXX_NOEXCEPT + { return iterator(_M_cur, _M_node); } + + reference + operator*() const _GLIBCXX_NOEXCEPT + { return *_M_cur; } + + pointer + operator->() const _GLIBCXX_NOEXCEPT + { return _M_cur; } + + _Self& + operator++() _GLIBCXX_NOEXCEPT + { + ++_M_cur; + if (_M_cur == _M_last) + { + _M_set_node(_M_node + 1); + _M_cur = _M_first; + } + return *this; + } + + _Self + operator++(int) _GLIBCXX_NOEXCEPT + { + _Self __tmp = *this; + ++*this; + return __tmp; + } + + _Self& + operator--() _GLIBCXX_NOEXCEPT + { + if (_M_cur == _M_first) + { + _M_set_node(_M_node - 1); + _M_cur = _M_last; + } + --_M_cur; + return *this; + } + + _Self + operator--(int) _GLIBCXX_NOEXCEPT + { + _Self __tmp = *this; + --*this; + return __tmp; + } + + _Self& + operator+=(difference_type __n) _GLIBCXX_NOEXCEPT + { + const difference_type __offset = __n + (_M_cur - _M_first); + if (__offset >= 0 && __offset < difference_type(_S_buffer_size())) + _M_cur += __n; + else + { + const difference_type __node_offset = + __offset > 0 ? __offset / difference_type(_S_buffer_size()) + : -difference_type((-__offset - 1) + / _S_buffer_size()) - 1; + _M_set_node(_M_node + __node_offset); + _M_cur = _M_first + (__offset - __node_offset + * difference_type(_S_buffer_size())); + } + return *this; + } + + _Self + operator+(difference_type __n) const _GLIBCXX_NOEXCEPT + { + _Self __tmp = *this; + return __tmp += __n; + } + + _Self& + operator-=(difference_type __n) _GLIBCXX_NOEXCEPT + { return *this += -__n; } + + _Self + operator-(difference_type __n) const _GLIBCXX_NOEXCEPT + { + _Self __tmp = *this; + return __tmp -= __n; + } + + reference + operator[](difference_type __n) const _GLIBCXX_NOEXCEPT + { return *(*this + __n); } + + /** + * Prepares to traverse new_node. Sets everything except + * _M_cur, which should therefore be set by the caller + * immediately afterwards, based on _M_first and _M_last. + */ + void + _M_set_node(_Map_pointer __new_node) _GLIBCXX_NOEXCEPT + { + _M_node = __new_node; + _M_first = *__new_node; + _M_last = _M_first + difference_type(_S_buffer_size()); + } + }; + + // Note: we also provide overloads whose operands are of the same type in + // order to avoid ambiguous overload resolution when std::rel_ops operators + // are in scope (for additional details, see libstdc++/3628) + template + inline bool + operator==(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, + const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT + { return __x._M_cur == __y._M_cur; } + + template + inline bool + operator==(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, + const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT + { return __x._M_cur == __y._M_cur; } + + template + inline bool + operator!=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, + const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT + { return !(__x == __y); } + + template + inline bool + operator!=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, + const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT + { return !(__x == __y); } + + template + inline bool + operator<(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, + const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT + { return (__x._M_node == __y._M_node) ? (__x._M_cur < __y._M_cur) + : (__x._M_node < __y._M_node); } + + template + inline bool + operator<(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, + const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT + { return (__x._M_node == __y._M_node) ? (__x._M_cur < __y._M_cur) + : (__x._M_node < __y._M_node); } + + template + inline bool + operator>(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, + const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT + { return __y < __x; } + + template + inline bool + operator>(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, + const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT + { return __y < __x; } + + template + inline bool + operator<=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, + const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT + { return !(__y < __x); } + + template + inline bool + operator<=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, + const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT + { return !(__y < __x); } + + template + inline bool + operator>=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, + const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT + { return !(__x < __y); } + + template + inline bool + operator>=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, + const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT + { return !(__x < __y); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // According to the resolution of DR179 not only the various comparison + // operators but also operator- must accept mixed iterator/const_iterator + // parameters. + template + inline typename _Deque_iterator<_Tp, _Ref, _Ptr>::difference_type + operator-(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, + const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT + { + return typename _Deque_iterator<_Tp, _Ref, _Ptr>::difference_type + (_Deque_iterator<_Tp, _Ref, _Ptr>::_S_buffer_size()) + * (__x._M_node - __y._M_node - 1) + (__x._M_cur - __x._M_first) + + (__y._M_last - __y._M_cur); + } + + template + inline typename _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type + operator-(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, + const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT + { + return typename _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type + (_Deque_iterator<_Tp, _RefL, _PtrL>::_S_buffer_size()) + * (__x._M_node - __y._M_node - 1) + (__x._M_cur - __x._M_first) + + (__y._M_last - __y._M_cur); + } + + template + inline _Deque_iterator<_Tp, _Ref, _Ptr> + operator+(ptrdiff_t __n, const _Deque_iterator<_Tp, _Ref, _Ptr>& __x) + _GLIBCXX_NOEXCEPT + { return __x + __n; } + + template + void + fill(const _Deque_iterator<_Tp, _Tp&, _Tp*>&, + const _Deque_iterator<_Tp, _Tp&, _Tp*>&, const _Tp&); + + template + _Deque_iterator<_Tp, _Tp&, _Tp*> + copy(_Deque_iterator<_Tp, const _Tp&, const _Tp*>, + _Deque_iterator<_Tp, const _Tp&, const _Tp*>, + _Deque_iterator<_Tp, _Tp&, _Tp*>); + + template + inline _Deque_iterator<_Tp, _Tp&, _Tp*> + copy(_Deque_iterator<_Tp, _Tp&, _Tp*> __first, + _Deque_iterator<_Tp, _Tp&, _Tp*> __last, + _Deque_iterator<_Tp, _Tp&, _Tp*> __result) + { return std::copy(_Deque_iterator<_Tp, const _Tp&, const _Tp*>(__first), + _Deque_iterator<_Tp, const _Tp&, const _Tp*>(__last), + __result); } + + template + _Deque_iterator<_Tp, _Tp&, _Tp*> + copy_backward(_Deque_iterator<_Tp, const _Tp&, const _Tp*>, + _Deque_iterator<_Tp, const _Tp&, const _Tp*>, + _Deque_iterator<_Tp, _Tp&, _Tp*>); + + template + inline _Deque_iterator<_Tp, _Tp&, _Tp*> + copy_backward(_Deque_iterator<_Tp, _Tp&, _Tp*> __first, + _Deque_iterator<_Tp, _Tp&, _Tp*> __last, + _Deque_iterator<_Tp, _Tp&, _Tp*> __result) + { return std::copy_backward(_Deque_iterator<_Tp, + const _Tp&, const _Tp*>(__first), + _Deque_iterator<_Tp, + const _Tp&, const _Tp*>(__last), + __result); } + +#if __cplusplus >= 201103L + template + _Deque_iterator<_Tp, _Tp&, _Tp*> + move(_Deque_iterator<_Tp, const _Tp&, const _Tp*>, + _Deque_iterator<_Tp, const _Tp&, const _Tp*>, + _Deque_iterator<_Tp, _Tp&, _Tp*>); + + template + inline _Deque_iterator<_Tp, _Tp&, _Tp*> + move(_Deque_iterator<_Tp, _Tp&, _Tp*> __first, + _Deque_iterator<_Tp, _Tp&, _Tp*> __last, + _Deque_iterator<_Tp, _Tp&, _Tp*> __result) + { return std::move(_Deque_iterator<_Tp, const _Tp&, const _Tp*>(__first), + _Deque_iterator<_Tp, const _Tp&, const _Tp*>(__last), + __result); } + + template + _Deque_iterator<_Tp, _Tp&, _Tp*> + move_backward(_Deque_iterator<_Tp, const _Tp&, const _Tp*>, + _Deque_iterator<_Tp, const _Tp&, const _Tp*>, + _Deque_iterator<_Tp, _Tp&, _Tp*>); + + template + inline _Deque_iterator<_Tp, _Tp&, _Tp*> + move_backward(_Deque_iterator<_Tp, _Tp&, _Tp*> __first, + _Deque_iterator<_Tp, _Tp&, _Tp*> __last, + _Deque_iterator<_Tp, _Tp&, _Tp*> __result) + { return std::move_backward(_Deque_iterator<_Tp, + const _Tp&, const _Tp*>(__first), + _Deque_iterator<_Tp, + const _Tp&, const _Tp*>(__last), + __result); } +#endif + + /** + * Deque base class. This class provides the unified face for %deque's + * allocation. This class's constructor and destructor allocate and + * deallocate (but do not initialize) storage. This makes %exception + * safety easier. + * + * Nothing in this class ever constructs or destroys an actual Tp element. + * (Deque handles that itself.) Only/All memory management is performed + * here. + */ + template + class _Deque_base + { + protected: + typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template + rebind<_Tp>::other _Tp_alloc_type; + typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Alloc_traits; + +#if __cplusplus < 201103L + typedef _Tp* _Ptr; + typedef const _Tp* _Ptr_const; +#else + typedef typename _Alloc_traits::pointer _Ptr; + typedef typename _Alloc_traits::const_pointer _Ptr_const; +#endif + + typedef typename _Alloc_traits::template rebind<_Ptr>::other + _Map_alloc_type; + typedef __gnu_cxx::__alloc_traits<_Map_alloc_type> _Map_alloc_traits; + + public: + typedef _Alloc allocator_type; + typedef typename _Alloc_traits::size_type size_type; + + allocator_type + get_allocator() const _GLIBCXX_NOEXCEPT + { return allocator_type(_M_get_Tp_allocator()); } + + typedef _Deque_iterator<_Tp, _Tp&, _Ptr> iterator; + typedef _Deque_iterator<_Tp, const _Tp&, _Ptr_const> const_iterator; + + _Deque_base() + : _M_impl() + { _M_initialize_map(0); } + + _Deque_base(size_t __num_elements) + : _M_impl() + { _M_initialize_map(__num_elements); } + + _Deque_base(const allocator_type& __a, size_t __num_elements) + : _M_impl(__a) + { _M_initialize_map(__num_elements); } + + _Deque_base(const allocator_type& __a) + : _M_impl(__a) + { /* Caller must initialize map. */ } + +#if __cplusplus >= 201103L + _Deque_base(_Deque_base&& __x, false_type) + : _M_impl(__x._M_move_impl()) + { } + + _Deque_base(_Deque_base&& __x, true_type) + : _M_impl(std::move(__x._M_get_Tp_allocator())) + { + _M_initialize_map(0); + if (__x._M_impl._M_map) + this->_M_impl._M_swap_data(__x._M_impl); + } + + _Deque_base(_Deque_base&& __x) + : _Deque_base(std::move(__x), typename _Alloc_traits::is_always_equal{}) + { } + + _Deque_base(_Deque_base&& __x, const allocator_type& __a, size_type __n) + : _M_impl(__a) + { + if (__x.get_allocator() == __a) + { + if (__x._M_impl._M_map) + { + _M_initialize_map(0); + this->_M_impl._M_swap_data(__x._M_impl); + } + } + else + { + _M_initialize_map(__n); + } + } +#endif + + ~_Deque_base() _GLIBCXX_NOEXCEPT; + + protected: + typedef typename iterator::_Map_pointer _Map_pointer; + + //This struct encapsulates the implementation of the std::deque + //standard container and at the same time makes use of the EBO + //for empty allocators. + struct _Deque_impl + : public _Tp_alloc_type + { + _Map_pointer _M_map; + size_t _M_map_size; + iterator _M_start; + iterator _M_finish; + + _Deque_impl() + : _Tp_alloc_type(), _M_map(), _M_map_size(0), + _M_start(), _M_finish() + { } + + _Deque_impl(const _Tp_alloc_type& __a) _GLIBCXX_NOEXCEPT + : _Tp_alloc_type(__a), _M_map(), _M_map_size(0), + _M_start(), _M_finish() + { } + +#if __cplusplus >= 201103L + _Deque_impl(_Deque_impl&&) = default; + + _Deque_impl(_Tp_alloc_type&& __a) noexcept + : _Tp_alloc_type(std::move(__a)), _M_map(), _M_map_size(0), + _M_start(), _M_finish() + { } +#endif + + void _M_swap_data(_Deque_impl& __x) _GLIBCXX_NOEXCEPT + { + using std::swap; + swap(this->_M_start, __x._M_start); + swap(this->_M_finish, __x._M_finish); + swap(this->_M_map, __x._M_map); + swap(this->_M_map_size, __x._M_map_size); + } + }; + + _Tp_alloc_type& + _M_get_Tp_allocator() _GLIBCXX_NOEXCEPT + { return *static_cast<_Tp_alloc_type*>(&this->_M_impl); } + + const _Tp_alloc_type& + _M_get_Tp_allocator() const _GLIBCXX_NOEXCEPT + { return *static_cast(&this->_M_impl); } + + _Map_alloc_type + _M_get_map_allocator() const _GLIBCXX_NOEXCEPT + { return _Map_alloc_type(_M_get_Tp_allocator()); } + + _Ptr + _M_allocate_node() + { + typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Traits; + return _Traits::allocate(_M_impl, __deque_buf_size(sizeof(_Tp))); + } + + void + _M_deallocate_node(_Ptr __p) _GLIBCXX_NOEXCEPT + { + typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Traits; + _Traits::deallocate(_M_impl, __p, __deque_buf_size(sizeof(_Tp))); + } + + _Map_pointer + _M_allocate_map(size_t __n) + { + _Map_alloc_type __map_alloc = _M_get_map_allocator(); + return _Map_alloc_traits::allocate(__map_alloc, __n); + } + + void + _M_deallocate_map(_Map_pointer __p, size_t __n) _GLIBCXX_NOEXCEPT + { + _Map_alloc_type __map_alloc = _M_get_map_allocator(); + _Map_alloc_traits::deallocate(__map_alloc, __p, __n); + } + + protected: + void _M_initialize_map(size_t); + void _M_create_nodes(_Map_pointer __nstart, _Map_pointer __nfinish); + void _M_destroy_nodes(_Map_pointer __nstart, + _Map_pointer __nfinish) _GLIBCXX_NOEXCEPT; + enum { _S_initial_map_size = 8 }; + + _Deque_impl _M_impl; + +#if __cplusplus >= 201103L + private: + _Deque_impl + _M_move_impl() + { + if (!_M_impl._M_map) + return std::move(_M_impl); + + // Create a copy of the current allocator. + _Tp_alloc_type __alloc{_M_get_Tp_allocator()}; + // Put that copy in a moved-from state. + _Tp_alloc_type __sink __attribute((__unused__)) {std::move(__alloc)}; + // Create an empty map that allocates using the moved-from allocator. + _Deque_base __empty{__alloc}; + __empty._M_initialize_map(0); + // Now safe to modify current allocator and perform non-throwing swaps. + _Deque_impl __ret{std::move(_M_get_Tp_allocator())}; + _M_impl._M_swap_data(__ret); + _M_impl._M_swap_data(__empty._M_impl); + return __ret; + } +#endif + }; + + template + _Deque_base<_Tp, _Alloc>:: + ~_Deque_base() _GLIBCXX_NOEXCEPT + { + if (this->_M_impl._M_map) + { + _M_destroy_nodes(this->_M_impl._M_start._M_node, + this->_M_impl._M_finish._M_node + 1); + _M_deallocate_map(this->_M_impl._M_map, this->_M_impl._M_map_size); + } + } + + /** + * @brief Layout storage. + * @param __num_elements The count of T's for which to allocate space + * at first. + * @return Nothing. + * + * The initial underlying memory layout is a bit complicated... + */ + template + void + _Deque_base<_Tp, _Alloc>:: + _M_initialize_map(size_t __num_elements) + { + const size_t __num_nodes = (__num_elements/ __deque_buf_size(sizeof(_Tp)) + + 1); + + this->_M_impl._M_map_size = std::max((size_t) _S_initial_map_size, + size_t(__num_nodes + 2)); + this->_M_impl._M_map = _M_allocate_map(this->_M_impl._M_map_size); + + // For "small" maps (needing less than _M_map_size nodes), allocation + // starts in the middle elements and grows outwards. So nstart may be + // the beginning of _M_map, but for small maps it may be as far in as + // _M_map+3. + + _Map_pointer __nstart = (this->_M_impl._M_map + + (this->_M_impl._M_map_size - __num_nodes) / 2); + _Map_pointer __nfinish = __nstart + __num_nodes; + + __try + { _M_create_nodes(__nstart, __nfinish); } + __catch(...) + { + _M_deallocate_map(this->_M_impl._M_map, this->_M_impl._M_map_size); + this->_M_impl._M_map = _Map_pointer(); + this->_M_impl._M_map_size = 0; + __throw_exception_again; + } + + this->_M_impl._M_start._M_set_node(__nstart); + this->_M_impl._M_finish._M_set_node(__nfinish - 1); + this->_M_impl._M_start._M_cur = _M_impl._M_start._M_first; + this->_M_impl._M_finish._M_cur = (this->_M_impl._M_finish._M_first + + __num_elements + % __deque_buf_size(sizeof(_Tp))); + } + + template + void + _Deque_base<_Tp, _Alloc>:: + _M_create_nodes(_Map_pointer __nstart, _Map_pointer __nfinish) + { + _Map_pointer __cur; + __try + { + for (__cur = __nstart; __cur < __nfinish; ++__cur) + *__cur = this->_M_allocate_node(); + } + __catch(...) + { + _M_destroy_nodes(__nstart, __cur); + __throw_exception_again; + } + } + + template + void + _Deque_base<_Tp, _Alloc>:: + _M_destroy_nodes(_Map_pointer __nstart, + _Map_pointer __nfinish) _GLIBCXX_NOEXCEPT + { + for (_Map_pointer __n = __nstart; __n < __nfinish; ++__n) + _M_deallocate_node(*__n); + } + + /** + * @brief A standard container using fixed-size memory allocation and + * constant-time manipulation of elements at either end. + * + * @ingroup sequences + * + * @tparam _Tp Type of element. + * @tparam _Alloc Allocator type, defaults to allocator<_Tp>. + * + * Meets the requirements of a container, a + * reversible container, and a + * sequence, including the + * optional sequence requirements. + * + * In previous HP/SGI versions of deque, there was an extra template + * parameter so users could control the node size. This extension turned + * out to violate the C++ standard (it can be detected using template + * template parameters), and it was removed. + * + * Here's how a deque manages memory. Each deque has 4 members: + * + * - Tp** _M_map + * - size_t _M_map_size + * - iterator _M_start, _M_finish + * + * map_size is at least 8. %map is an array of map_size + * pointers-to-@a nodes. (The name %map has nothing to do with the + * std::map class, and @b nodes should not be confused with + * std::list's usage of @a node.) + * + * A @a node has no specific type name as such, but it is referred + * to as @a node in this file. It is a simple array-of-Tp. If Tp + * is very large, there will be one Tp element per node (i.e., an + * @a array of one). For non-huge Tp's, node size is inversely + * related to Tp size: the larger the Tp, the fewer Tp's will fit + * in a node. The goal here is to keep the total size of a node + * relatively small and constant over different Tp's, to improve + * allocator efficiency. + * + * Not every pointer in the %map array will point to a node. If + * the initial number of elements in the deque is small, the + * /middle/ %map pointers will be valid, and the ones at the edges + * will be unused. This same situation will arise as the %map + * grows: available %map pointers, if any, will be on the ends. As + * new nodes are created, only a subset of the %map's pointers need + * to be copied @a outward. + * + * Class invariants: + * - For any nonsingular iterator i: + * - i.node points to a member of the %map array. (Yes, you read that + * correctly: i.node does not actually point to a node.) The member of + * the %map array is what actually points to the node. + * - i.first == *(i.node) (This points to the node (first Tp element).) + * - i.last == i.first + node_size + * - i.cur is a pointer in the range [i.first, i.last). NOTE: + * the implication of this is that i.cur is always a dereferenceable + * pointer, even if i is a past-the-end iterator. + * - Start and Finish are always nonsingular iterators. NOTE: this + * means that an empty deque must have one node, a deque with > + class deque : protected _Deque_base<_Tp, _Alloc> + { +#ifdef _GLIBCXX_CONCEPT_CHECKS + // concept requirements + typedef typename _Alloc::value_type _Alloc_value_type; +# if __cplusplus < 201103L + __glibcxx_class_requires(_Tp, _SGIAssignableConcept) +# endif + __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept) +#endif + + typedef _Deque_base<_Tp, _Alloc> _Base; + typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; + typedef typename _Base::_Alloc_traits _Alloc_traits; + typedef typename _Base::_Map_pointer _Map_pointer; + + public: + typedef _Tp value_type; + typedef typename _Alloc_traits::pointer pointer; + typedef typename _Alloc_traits::const_pointer const_pointer; + typedef typename _Alloc_traits::reference reference; + typedef typename _Alloc_traits::const_reference const_reference; + typedef typename _Base::iterator iterator; + typedef typename _Base::const_iterator const_iterator; + typedef std::reverse_iterator const_reverse_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Alloc allocator_type; + + protected: + static size_t _S_buffer_size() _GLIBCXX_NOEXCEPT + { return __deque_buf_size(sizeof(_Tp)); } + + // Functions controlling memory layout, and nothing else. + using _Base::_M_initialize_map; + using _Base::_M_create_nodes; + using _Base::_M_destroy_nodes; + using _Base::_M_allocate_node; + using _Base::_M_deallocate_node; + using _Base::_M_allocate_map; + using _Base::_M_deallocate_map; + using _Base::_M_get_Tp_allocator; + + /** + * A total of four data members accumulated down the hierarchy. + * May be accessed via _M_impl.* + */ + using _Base::_M_impl; + + public: + // [23.2.1.1] construct/copy/destroy + // (assign() and get_allocator() are also listed in this section) + + /** + * @brief Creates a %deque with no elements. + */ + deque() : _Base() { } + + /** + * @brief Creates a %deque with no elements. + * @param __a An allocator object. + */ + explicit + deque(const allocator_type& __a) + : _Base(__a, 0) { } + +#if __cplusplus >= 201103L + /** + * @brief Creates a %deque with default constructed elements. + * @param __n The number of elements to initially create. + * @param __a An allocator. + * + * This constructor fills the %deque with @a n default + * constructed elements. + */ + explicit + deque(size_type __n, const allocator_type& __a = allocator_type()) + : _Base(__a, __n) + { _M_default_initialize(); } + + /** + * @brief Creates a %deque with copies of an exemplar element. + * @param __n The number of elements to initially create. + * @param __value An element to copy. + * @param __a An allocator. + * + * This constructor fills the %deque with @a __n copies of @a __value. + */ + deque(size_type __n, const value_type& __value, + const allocator_type& __a = allocator_type()) + : _Base(__a, __n) + { _M_fill_initialize(__value); } +#else + /** + * @brief Creates a %deque with copies of an exemplar element. + * @param __n The number of elements to initially create. + * @param __value An element to copy. + * @param __a An allocator. + * + * This constructor fills the %deque with @a __n copies of @a __value. + */ + explicit + deque(size_type __n, const value_type& __value = value_type(), + const allocator_type& __a = allocator_type()) + : _Base(__a, __n) + { _M_fill_initialize(__value); } +#endif + + /** + * @brief %Deque copy constructor. + * @param __x A %deque of identical element and allocator types. + * + * The newly-created %deque uses a copy of the allocator object used + * by @a __x (unless the allocator traits dictate a different object). + */ + deque(const deque& __x) + : _Base(_Alloc_traits::_S_select_on_copy(__x._M_get_Tp_allocator()), + __x.size()) + { std::__uninitialized_copy_a(__x.begin(), __x.end(), + this->_M_impl._M_start, + _M_get_Tp_allocator()); } + +#if __cplusplus >= 201103L + /** + * @brief %Deque move constructor. + * @param __x A %deque of identical element and allocator types. + * + * The newly-created %deque contains the exact contents of @a __x. + * The contents of @a __x are a valid, but unspecified %deque. + */ + deque(deque&& __x) + : _Base(std::move(__x)) { } + + /// Copy constructor with alternative allocator + deque(const deque& __x, const allocator_type& __a) + : _Base(__a, __x.size()) + { std::__uninitialized_copy_a(__x.begin(), __x.end(), + this->_M_impl._M_start, + _M_get_Tp_allocator()); } + + /// Move constructor with alternative allocator + deque(deque&& __x, const allocator_type& __a) + : _Base(std::move(__x), __a, __x.size()) + { + if (__x.get_allocator() != __a) + { + std::__uninitialized_move_a(__x.begin(), __x.end(), + this->_M_impl._M_start, + _M_get_Tp_allocator()); + __x.clear(); + } + } + + /** + * @brief Builds a %deque from an initializer list. + * @param __l An initializer_list. + * @param __a An allocator object. + * + * Create a %deque consisting of copies of the elements in the + * initializer_list @a __l. + * + * This will call the element type's copy constructor N times + * (where N is __l.size()) and do no memory reallocation. + */ + deque(initializer_list __l, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { + _M_range_initialize(__l.begin(), __l.end(), + random_access_iterator_tag()); + } +#endif + + /** + * @brief Builds a %deque from a range. + * @param __first An input iterator. + * @param __last An input iterator. + * @param __a An allocator object. + * + * Create a %deque consisting of copies of the elements from [__first, + * __last). + * + * If the iterators are forward, bidirectional, or random-access, then + * this will call the elements' copy constructor N times (where N is + * distance(__first,__last)) and do no memory reallocation. But if only + * input iterators are used, then this will do at most 2N calls to the + * copy constructor, and logN memory reallocations. + */ +#if __cplusplus >= 201103L + template> + deque(_InputIterator __first, _InputIterator __last, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { _M_initialize_dispatch(__first, __last, __false_type()); } +#else + template + deque(_InputIterator __first, _InputIterator __last, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { + // Check whether it's an integral type. If so, it's not an iterator. + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + _M_initialize_dispatch(__first, __last, _Integral()); + } +#endif + + /** + * The dtor only erases the elements, and note that if the elements + * themselves are pointers, the pointed-to memory is not touched in any + * way. Managing the pointer is the user's responsibility. + */ + ~deque() + { _M_destroy_data(begin(), end(), _M_get_Tp_allocator()); } + + /** + * @brief %Deque assignment operator. + * @param __x A %deque of identical element and allocator types. + * + * All the elements of @a x are copied. + * + * The newly-created %deque uses a copy of the allocator object used + * by @a __x (unless the allocator traits dictate a different object). + */ + deque& + operator=(const deque& __x); + +#if __cplusplus >= 201103L + /** + * @brief %Deque move assignment operator. + * @param __x A %deque of identical element and allocator types. + * + * The contents of @a __x are moved into this deque (without copying, + * if the allocators permit it). + * @a __x is a valid, but unspecified %deque. + */ + deque& + operator=(deque&& __x) noexcept(_Alloc_traits::_S_always_equal()) + { + using __always_equal = typename _Alloc_traits::is_always_equal; + _M_move_assign1(std::move(__x), __always_equal{}); + return *this; + } + + /** + * @brief Assigns an initializer list to a %deque. + * @param __l An initializer_list. + * + * This function fills a %deque with copies of the elements in the + * initializer_list @a __l. + * + * Note that the assignment completely changes the %deque and that the + * resulting %deque's size is the same as the number of elements + * assigned. + */ + deque& + operator=(initializer_list __l) + { + _M_assign_aux(__l.begin(), __l.end(), + random_access_iterator_tag()); + return *this; + } +#endif + + /** + * @brief Assigns a given value to a %deque. + * @param __n Number of elements to be assigned. + * @param __val Value to be assigned. + * + * This function fills a %deque with @a n copies of the given + * value. Note that the assignment completely changes the + * %deque and that the resulting %deque's size is the same as + * the number of elements assigned. + */ + void + assign(size_type __n, const value_type& __val) + { _M_fill_assign(__n, __val); } + + /** + * @brief Assigns a range to a %deque. + * @param __first An input iterator. + * @param __last An input iterator. + * + * This function fills a %deque with copies of the elements in the + * range [__first,__last). + * + * Note that the assignment completely changes the %deque and that the + * resulting %deque's size is the same as the number of elements + * assigned. + */ +#if __cplusplus >= 201103L + template> + void + assign(_InputIterator __first, _InputIterator __last) + { _M_assign_dispatch(__first, __last, __false_type()); } +#else + template + void + assign(_InputIterator __first, _InputIterator __last) + { + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + _M_assign_dispatch(__first, __last, _Integral()); + } +#endif + +#if __cplusplus >= 201103L + /** + * @brief Assigns an initializer list to a %deque. + * @param __l An initializer_list. + * + * This function fills a %deque with copies of the elements in the + * initializer_list @a __l. + * + * Note that the assignment completely changes the %deque and that the + * resulting %deque's size is the same as the number of elements + * assigned. + */ + void + assign(initializer_list __l) + { _M_assign_aux(__l.begin(), __l.end(), random_access_iterator_tag()); } +#endif + + /// Get a copy of the memory allocation object. + allocator_type + get_allocator() const _GLIBCXX_NOEXCEPT + { return _Base::get_allocator(); } + + // iterators + /** + * Returns a read/write iterator that points to the first element in the + * %deque. Iteration is done in ordinary element order. + */ + iterator + begin() _GLIBCXX_NOEXCEPT + { return this->_M_impl._M_start; } + + /** + * Returns a read-only (constant) iterator that points to the first + * element in the %deque. Iteration is done in ordinary element order. + */ + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return this->_M_impl._M_start; } + + /** + * Returns a read/write iterator that points one past the last + * element in the %deque. Iteration is done in ordinary + * element order. + */ + iterator + end() _GLIBCXX_NOEXCEPT + { return this->_M_impl._M_finish; } + + /** + * Returns a read-only (constant) iterator that points one past + * the last element in the %deque. Iteration is done in + * ordinary element order. + */ + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return this->_M_impl._M_finish; } + + /** + * Returns a read/write reverse iterator that points to the + * last element in the %deque. Iteration is done in reverse + * element order. + */ + reverse_iterator + rbegin() _GLIBCXX_NOEXCEPT + { return reverse_iterator(this->_M_impl._M_finish); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to the last element in the %deque. Iteration is done in + * reverse element order. + */ + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(this->_M_impl._M_finish); } + + /** + * Returns a read/write reverse iterator that points to one + * before the first element in the %deque. Iteration is done + * in reverse element order. + */ + reverse_iterator + rend() _GLIBCXX_NOEXCEPT + { return reverse_iterator(this->_M_impl._M_start); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to one before the first element in the %deque. Iteration is + * done in reverse element order. + */ + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(this->_M_impl._M_start); } + +#if __cplusplus >= 201103L + /** + * Returns a read-only (constant) iterator that points to the first + * element in the %deque. Iteration is done in ordinary element order. + */ + const_iterator + cbegin() const noexcept + { return this->_M_impl._M_start; } + + /** + * Returns a read-only (constant) iterator that points one past + * the last element in the %deque. Iteration is done in + * ordinary element order. + */ + const_iterator + cend() const noexcept + { return this->_M_impl._M_finish; } + + /** + * Returns a read-only (constant) reverse iterator that points + * to the last element in the %deque. Iteration is done in + * reverse element order. + */ + const_reverse_iterator + crbegin() const noexcept + { return const_reverse_iterator(this->_M_impl._M_finish); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to one before the first element in the %deque. Iteration is + * done in reverse element order. + */ + const_reverse_iterator + crend() const noexcept + { return const_reverse_iterator(this->_M_impl._M_start); } +#endif + + // [23.2.1.2] capacity + /** Returns the number of elements in the %deque. */ + size_type + size() const _GLIBCXX_NOEXCEPT + { return this->_M_impl._M_finish - this->_M_impl._M_start; } + + /** Returns the size() of the largest possible %deque. */ + size_type + max_size() const _GLIBCXX_NOEXCEPT + { return _Alloc_traits::max_size(_M_get_Tp_allocator()); } + +#if __cplusplus >= 201103L + /** + * @brief Resizes the %deque to the specified number of elements. + * @param __new_size Number of elements the %deque should contain. + * + * This function will %resize the %deque to the specified + * number of elements. If the number is smaller than the + * %deque's current size the %deque is truncated, otherwise + * default constructed elements are appended. + */ + void + resize(size_type __new_size) + { + const size_type __len = size(); + if (__new_size > __len) + _M_default_append(__new_size - __len); + else if (__new_size < __len) + _M_erase_at_end(this->_M_impl._M_start + + difference_type(__new_size)); + } + + /** + * @brief Resizes the %deque to the specified number of elements. + * @param __new_size Number of elements the %deque should contain. + * @param __x Data with which new elements should be populated. + * + * This function will %resize the %deque to the specified + * number of elements. If the number is smaller than the + * %deque's current size the %deque is truncated, otherwise the + * %deque is extended and new elements are populated with given + * data. + */ + void + resize(size_type __new_size, const value_type& __x) + { + const size_type __len = size(); + if (__new_size > __len) + _M_fill_insert(this->_M_impl._M_finish, __new_size - __len, __x); + else if (__new_size < __len) + _M_erase_at_end(this->_M_impl._M_start + + difference_type(__new_size)); + } +#else + /** + * @brief Resizes the %deque to the specified number of elements. + * @param __new_size Number of elements the %deque should contain. + * @param __x Data with which new elements should be populated. + * + * This function will %resize the %deque to the specified + * number of elements. If the number is smaller than the + * %deque's current size the %deque is truncated, otherwise the + * %deque is extended and new elements are populated with given + * data. + */ + void + resize(size_type __new_size, value_type __x = value_type()) + { + const size_type __len = size(); + if (__new_size > __len) + _M_fill_insert(this->_M_impl._M_finish, __new_size - __len, __x); + else if (__new_size < __len) + _M_erase_at_end(this->_M_impl._M_start + + difference_type(__new_size)); + } +#endif + +#if __cplusplus >= 201103L + /** A non-binding request to reduce memory use. */ + void + shrink_to_fit() noexcept + { _M_shrink_to_fit(); } +#endif + + /** + * Returns true if the %deque is empty. (Thus begin() would + * equal end().) + */ + bool + empty() const _GLIBCXX_NOEXCEPT + { return this->_M_impl._M_finish == this->_M_impl._M_start; } + + // element access + /** + * @brief Subscript access to the data contained in the %deque. + * @param __n The index of the element for which data should be + * accessed. + * @return Read/write reference to data. + * + * This operator allows for easy, array-style, data access. + * Note that data access with this operator is unchecked and + * out_of_range lookups are not defined. (For checked lookups + * see at().) + */ + reference + operator[](size_type __n) _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_subscript(__n); + return this->_M_impl._M_start[difference_type(__n)]; + } + + /** + * @brief Subscript access to the data contained in the %deque. + * @param __n The index of the element for which data should be + * accessed. + * @return Read-only (constant) reference to data. + * + * This operator allows for easy, array-style, data access. + * Note that data access with this operator is unchecked and + * out_of_range lookups are not defined. (For checked lookups + * see at().) + */ + const_reference + operator[](size_type __n) const _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_subscript(__n); + return this->_M_impl._M_start[difference_type(__n)]; + } + + protected: + /// Safety check used only from at(). + void + _M_range_check(size_type __n) const + { + if (__n >= this->size()) + __throw_out_of_range_fmt(__N("deque::_M_range_check: __n " + "(which is %zu)>= this->size() " + "(which is %zu)"), + __n, this->size()); + } + + public: + /** + * @brief Provides access to the data contained in the %deque. + * @param __n The index of the element for which data should be + * accessed. + * @return Read/write reference to data. + * @throw std::out_of_range If @a __n is an invalid index. + * + * This function provides for safer data access. The parameter + * is first checked that it is in the range of the deque. The + * function throws out_of_range if the check fails. + */ + reference + at(size_type __n) + { + _M_range_check(__n); + return (*this)[__n]; + } + + /** + * @brief Provides access to the data contained in the %deque. + * @param __n The index of the element for which data should be + * accessed. + * @return Read-only (constant) reference to data. + * @throw std::out_of_range If @a __n is an invalid index. + * + * This function provides for safer data access. The parameter is first + * checked that it is in the range of the deque. The function throws + * out_of_range if the check fails. + */ + const_reference + at(size_type __n) const + { + _M_range_check(__n); + return (*this)[__n]; + } + + /** + * Returns a read/write reference to the data at the first + * element of the %deque. + */ + reference + front() _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_nonempty(); + return *begin(); + } + + /** + * Returns a read-only (constant) reference to the data at the first + * element of the %deque. + */ + const_reference + front() const _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_nonempty(); + return *begin(); + } + + /** + * Returns a read/write reference to the data at the last element of the + * %deque. + */ + reference + back() _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_nonempty(); + iterator __tmp = end(); + --__tmp; + return *__tmp; + } + + /** + * Returns a read-only (constant) reference to the data at the last + * element of the %deque. + */ + const_reference + back() const _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_nonempty(); + const_iterator __tmp = end(); + --__tmp; + return *__tmp; + } + + // [23.2.1.2] modifiers + /** + * @brief Add data to the front of the %deque. + * @param __x Data to be added. + * + * This is a typical stack operation. The function creates an + * element at the front of the %deque and assigns the given + * data to it. Due to the nature of a %deque this operation + * can be done in constant time. + */ + void + push_front(const value_type& __x) + { + if (this->_M_impl._M_start._M_cur != this->_M_impl._M_start._M_first) + { + _Alloc_traits::construct(this->_M_impl, + this->_M_impl._M_start._M_cur - 1, + __x); + --this->_M_impl._M_start._M_cur; + } + else + _M_push_front_aux(__x); + } + +#if __cplusplus >= 201103L + void + push_front(value_type&& __x) + { emplace_front(std::move(__x)); } + + template +#if __cplusplus > 201402L + reference +#else + void +#endif + emplace_front(_Args&&... __args); +#endif + + /** + * @brief Add data to the end of the %deque. + * @param __x Data to be added. + * + * This is a typical stack operation. The function creates an + * element at the end of the %deque and assigns the given data + * to it. Due to the nature of a %deque this operation can be + * done in constant time. + */ + void + push_back(const value_type& __x) + { + if (this->_M_impl._M_finish._M_cur + != this->_M_impl._M_finish._M_last - 1) + { + _Alloc_traits::construct(this->_M_impl, + this->_M_impl._M_finish._M_cur, __x); + ++this->_M_impl._M_finish._M_cur; + } + else + _M_push_back_aux(__x); + } + +#if __cplusplus >= 201103L + void + push_back(value_type&& __x) + { emplace_back(std::move(__x)); } + + template +#if __cplusplus > 201402L + reference +#else + void +#endif + emplace_back(_Args&&... __args); +#endif + + /** + * @brief Removes first element. + * + * This is a typical stack operation. It shrinks the %deque by one. + * + * Note that no data is returned, and if the first element's data is + * needed, it should be retrieved before pop_front() is called. + */ + void + pop_front() _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_nonempty(); + if (this->_M_impl._M_start._M_cur + != this->_M_impl._M_start._M_last - 1) + { + _Alloc_traits::destroy(this->_M_impl, + this->_M_impl._M_start._M_cur); + ++this->_M_impl._M_start._M_cur; + } + else + _M_pop_front_aux(); + } + + /** + * @brief Removes last element. + * + * This is a typical stack operation. It shrinks the %deque by one. + * + * Note that no data is returned, and if the last element's data is + * needed, it should be retrieved before pop_back() is called. + */ + void + pop_back() _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_nonempty(); + if (this->_M_impl._M_finish._M_cur + != this->_M_impl._M_finish._M_first) + { + --this->_M_impl._M_finish._M_cur; + _Alloc_traits::destroy(this->_M_impl, + this->_M_impl._M_finish._M_cur); + } + else + _M_pop_back_aux(); + } + +#if __cplusplus >= 201103L + /** + * @brief Inserts an object in %deque before specified iterator. + * @param __position A const_iterator into the %deque. + * @param __args Arguments. + * @return An iterator that points to the inserted data. + * + * This function will insert an object of type T constructed + * with T(std::forward(args)...) before the specified location. + */ + template + iterator + emplace(const_iterator __position, _Args&&... __args); + + /** + * @brief Inserts given value into %deque before specified iterator. + * @param __position A const_iterator into the %deque. + * @param __x Data to be inserted. + * @return An iterator that points to the inserted data. + * + * This function will insert a copy of the given value before the + * specified location. + */ + iterator + insert(const_iterator __position, const value_type& __x); +#else + /** + * @brief Inserts given value into %deque before specified iterator. + * @param __position An iterator into the %deque. + * @param __x Data to be inserted. + * @return An iterator that points to the inserted data. + * + * This function will insert a copy of the given value before the + * specified location. + */ + iterator + insert(iterator __position, const value_type& __x); +#endif + +#if __cplusplus >= 201103L + /** + * @brief Inserts given rvalue into %deque before specified iterator. + * @param __position A const_iterator into the %deque. + * @param __x Data to be inserted. + * @return An iterator that points to the inserted data. + * + * This function will insert a copy of the given rvalue before the + * specified location. + */ + iterator + insert(const_iterator __position, value_type&& __x) + { return emplace(__position, std::move(__x)); } + + /** + * @brief Inserts an initializer list into the %deque. + * @param __p An iterator into the %deque. + * @param __l An initializer_list. + * + * This function will insert copies of the data in the + * initializer_list @a __l into the %deque before the location + * specified by @a __p. This is known as list insert. + */ + iterator + insert(const_iterator __p, initializer_list __l) + { + auto __offset = __p - cbegin(); + _M_range_insert_aux(__p._M_const_cast(), __l.begin(), __l.end(), + std::random_access_iterator_tag()); + return begin() + __offset; + } +#endif + +#if __cplusplus >= 201103L + /** + * @brief Inserts a number of copies of given data into the %deque. + * @param __position A const_iterator into the %deque. + * @param __n Number of elements to be inserted. + * @param __x Data to be inserted. + * @return An iterator that points to the inserted data. + * + * This function will insert a specified number of copies of the given + * data before the location specified by @a __position. + */ + iterator + insert(const_iterator __position, size_type __n, const value_type& __x) + { + difference_type __offset = __position - cbegin(); + _M_fill_insert(__position._M_const_cast(), __n, __x); + return begin() + __offset; + } +#else + /** + * @brief Inserts a number of copies of given data into the %deque. + * @param __position An iterator into the %deque. + * @param __n Number of elements to be inserted. + * @param __x Data to be inserted. + * + * This function will insert a specified number of copies of the given + * data before the location specified by @a __position. + */ + void + insert(iterator __position, size_type __n, const value_type& __x) + { _M_fill_insert(__position, __n, __x); } +#endif + +#if __cplusplus >= 201103L + /** + * @brief Inserts a range into the %deque. + * @param __position A const_iterator into the %deque. + * @param __first An input iterator. + * @param __last An input iterator. + * @return An iterator that points to the inserted data. + * + * This function will insert copies of the data in the range + * [__first,__last) into the %deque before the location specified + * by @a __position. This is known as range insert. + */ + template> + iterator + insert(const_iterator __position, _InputIterator __first, + _InputIterator __last) + { + difference_type __offset = __position - cbegin(); + _M_insert_dispatch(__position._M_const_cast(), + __first, __last, __false_type()); + return begin() + __offset; + } +#else + /** + * @brief Inserts a range into the %deque. + * @param __position An iterator into the %deque. + * @param __first An input iterator. + * @param __last An input iterator. + * + * This function will insert copies of the data in the range + * [__first,__last) into the %deque before the location specified + * by @a __position. This is known as range insert. + */ + template + void + insert(iterator __position, _InputIterator __first, + _InputIterator __last) + { + // Check whether it's an integral type. If so, it's not an iterator. + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + _M_insert_dispatch(__position, __first, __last, _Integral()); + } +#endif + + /** + * @brief Remove element at given position. + * @param __position Iterator pointing to element to be erased. + * @return An iterator pointing to the next element (or end()). + * + * This function will erase the element at the given position and thus + * shorten the %deque by one. + * + * The user is cautioned that + * this function only erases the element, and that if the element is + * itself a pointer, the pointed-to memory is not touched in any way. + * Managing the pointer is the user's responsibility. + */ + iterator +#if __cplusplus >= 201103L + erase(const_iterator __position) +#else + erase(iterator __position) +#endif + { return _M_erase(__position._M_const_cast()); } + + /** + * @brief Remove a range of elements. + * @param __first Iterator pointing to the first element to be erased. + * @param __last Iterator pointing to one past the last element to be + * erased. + * @return An iterator pointing to the element pointed to by @a last + * prior to erasing (or end()). + * + * This function will erase the elements in the range + * [__first,__last) and shorten the %deque accordingly. + * + * The user is cautioned that + * this function only erases the elements, and that if the elements + * themselves are pointers, the pointed-to memory is not touched in any + * way. Managing the pointer is the user's responsibility. + */ + iterator +#if __cplusplus >= 201103L + erase(const_iterator __first, const_iterator __last) +#else + erase(iterator __first, iterator __last) +#endif + { return _M_erase(__first._M_const_cast(), __last._M_const_cast()); } + + /** + * @brief Swaps data with another %deque. + * @param __x A %deque of the same element and allocator types. + * + * This exchanges the elements between two deques in constant time. + * (Four pointers, so it should be quite fast.) + * Note that the global std::swap() function is specialized such that + * std::swap(d1,d2) will feed to this function. + * + * Whether the allocators are swapped depends on the allocator traits. + */ + void + swap(deque& __x) _GLIBCXX_NOEXCEPT + { +#if __cplusplus >= 201103L + __glibcxx_assert(_Alloc_traits::propagate_on_container_swap::value + || _M_get_Tp_allocator() == __x._M_get_Tp_allocator()); +#endif + _M_impl._M_swap_data(__x._M_impl); + _Alloc_traits::_S_on_swap(_M_get_Tp_allocator(), + __x._M_get_Tp_allocator()); + } + + /** + * Erases all the elements. Note that this function only erases the + * elements, and that if the elements themselves are pointers, the + * pointed-to memory is not touched in any way. Managing the pointer is + * the user's responsibility. + */ + void + clear() _GLIBCXX_NOEXCEPT + { _M_erase_at_end(begin()); } + + protected: + // Internal constructor functions follow. + + // called by the range constructor to implement [23.1.1]/9 + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 438. Ambiguity in the "do the right thing" clause + template + void + _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type) + { + _M_initialize_map(static_cast(__n)); + _M_fill_initialize(__x); + } + + // called by the range constructor to implement [23.1.1]/9 + template + void + _M_initialize_dispatch(_InputIterator __first, _InputIterator __last, + __false_type) + { + _M_range_initialize(__first, __last, + std::__iterator_category(__first)); + } + + // called by the second initialize_dispatch above + //@{ + /** + * @brief Fills the deque with whatever is in [first,last). + * @param __first An input iterator. + * @param __last An input iterator. + * @return Nothing. + * + * If the iterators are actually forward iterators (or better), then the + * memory layout can be done all at once. Else we move forward using + * push_back on each value from the iterator. + */ + template + void + _M_range_initialize(_InputIterator __first, _InputIterator __last, + std::input_iterator_tag); + + // called by the second initialize_dispatch above + template + void + _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last, + std::forward_iterator_tag); + //@} + + /** + * @brief Fills the %deque with copies of value. + * @param __value Initial value. + * @return Nothing. + * @pre _M_start and _M_finish have already been initialized, + * but none of the %deque's elements have yet been constructed. + * + * This function is called only when the user provides an explicit size + * (with or without an explicit exemplar value). + */ + void + _M_fill_initialize(const value_type& __value); + +#if __cplusplus >= 201103L + // called by deque(n). + void + _M_default_initialize(); +#endif + + // Internal assign functions follow. The *_aux functions do the actual + // assignment work for the range versions. + + // called by the range assign to implement [23.1.1]/9 + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 438. Ambiguity in the "do the right thing" clause + template + void + _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) + { _M_fill_assign(__n, __val); } + + // called by the range assign to implement [23.1.1]/9 + template + void + _M_assign_dispatch(_InputIterator __first, _InputIterator __last, + __false_type) + { _M_assign_aux(__first, __last, std::__iterator_category(__first)); } + + // called by the second assign_dispatch above + template + void + _M_assign_aux(_InputIterator __first, _InputIterator __last, + std::input_iterator_tag); + + // called by the second assign_dispatch above + template + void + _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, + std::forward_iterator_tag) + { + const size_type __len = std::distance(__first, __last); + if (__len > size()) + { + _ForwardIterator __mid = __first; + std::advance(__mid, size()); + std::copy(__first, __mid, begin()); + _M_range_insert_aux(end(), __mid, __last, + std::__iterator_category(__first)); + } + else + _M_erase_at_end(std::copy(__first, __last, begin())); + } + + // Called by assign(n,t), and the range assign when it turns out + // to be the same thing. + void + _M_fill_assign(size_type __n, const value_type& __val) + { + if (__n > size()) + { + std::fill(begin(), end(), __val); + _M_fill_insert(end(), __n - size(), __val); + } + else + { + _M_erase_at_end(begin() + difference_type(__n)); + std::fill(begin(), end(), __val); + } + } + + //@{ + /// Helper functions for push_* and pop_*. +#if __cplusplus < 201103L + void _M_push_back_aux(const value_type&); + + void _M_push_front_aux(const value_type&); +#else + template + void _M_push_back_aux(_Args&&... __args); + + template + void _M_push_front_aux(_Args&&... __args); +#endif + + void _M_pop_back_aux(); + + void _M_pop_front_aux(); + //@} + + // Internal insert functions follow. The *_aux functions do the actual + // insertion work when all shortcuts fail. + + // called by the range insert to implement [23.1.1]/9 + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 438. Ambiguity in the "do the right thing" clause + template + void + _M_insert_dispatch(iterator __pos, + _Integer __n, _Integer __x, __true_type) + { _M_fill_insert(__pos, __n, __x); } + + // called by the range insert to implement [23.1.1]/9 + template + void + _M_insert_dispatch(iterator __pos, + _InputIterator __first, _InputIterator __last, + __false_type) + { + _M_range_insert_aux(__pos, __first, __last, + std::__iterator_category(__first)); + } + + // called by the second insert_dispatch above + template + void + _M_range_insert_aux(iterator __pos, _InputIterator __first, + _InputIterator __last, std::input_iterator_tag); + + // called by the second insert_dispatch above + template + void + _M_range_insert_aux(iterator __pos, _ForwardIterator __first, + _ForwardIterator __last, std::forward_iterator_tag); + + // Called by insert(p,n,x), and the range insert when it turns out to be + // the same thing. Can use fill functions in optimal situations, + // otherwise passes off to insert_aux(p,n,x). + void + _M_fill_insert(iterator __pos, size_type __n, const value_type& __x); + + // called by insert(p,x) +#if __cplusplus < 201103L + iterator + _M_insert_aux(iterator __pos, const value_type& __x); +#else + template + iterator + _M_insert_aux(iterator __pos, _Args&&... __args); +#endif + + // called by insert(p,n,x) via fill_insert + void + _M_insert_aux(iterator __pos, size_type __n, const value_type& __x); + + // called by range_insert_aux for forward iterators + template + void + _M_insert_aux(iterator __pos, + _ForwardIterator __first, _ForwardIterator __last, + size_type __n); + + + // Internal erase functions follow. + + void + _M_destroy_data_aux(iterator __first, iterator __last); + + // Called by ~deque(). + // NB: Doesn't deallocate the nodes. + template + void + _M_destroy_data(iterator __first, iterator __last, const _Alloc1&) + { _M_destroy_data_aux(__first, __last); } + + void + _M_destroy_data(iterator __first, iterator __last, + const std::allocator<_Tp>&) + { + if (!__has_trivial_destructor(value_type)) + _M_destroy_data_aux(__first, __last); + } + + // Called by erase(q1, q2). + void + _M_erase_at_begin(iterator __pos) + { + _M_destroy_data(begin(), __pos, _M_get_Tp_allocator()); + _M_destroy_nodes(this->_M_impl._M_start._M_node, __pos._M_node); + this->_M_impl._M_start = __pos; + } + + // Called by erase(q1, q2), resize(), clear(), _M_assign_aux, + // _M_fill_assign, operator=. + void + _M_erase_at_end(iterator __pos) + { + _M_destroy_data(__pos, end(), _M_get_Tp_allocator()); + _M_destroy_nodes(__pos._M_node + 1, + this->_M_impl._M_finish._M_node + 1); + this->_M_impl._M_finish = __pos; + } + + iterator + _M_erase(iterator __pos); + + iterator + _M_erase(iterator __first, iterator __last); + +#if __cplusplus >= 201103L + // Called by resize(sz). + void + _M_default_append(size_type __n); + + bool + _M_shrink_to_fit(); +#endif + + //@{ + /// Memory-handling helpers for the previous internal insert functions. + iterator + _M_reserve_elements_at_front(size_type __n) + { + const size_type __vacancies = this->_M_impl._M_start._M_cur + - this->_M_impl._M_start._M_first; + if (__n > __vacancies) + _M_new_elements_at_front(__n - __vacancies); + return this->_M_impl._M_start - difference_type(__n); + } + + iterator + _M_reserve_elements_at_back(size_type __n) + { + const size_type __vacancies = (this->_M_impl._M_finish._M_last + - this->_M_impl._M_finish._M_cur) - 1; + if (__n > __vacancies) + _M_new_elements_at_back(__n - __vacancies); + return this->_M_impl._M_finish + difference_type(__n); + } + + void + _M_new_elements_at_front(size_type __new_elements); + + void + _M_new_elements_at_back(size_type __new_elements); + //@} + + + //@{ + /** + * @brief Memory-handling helpers for the major %map. + * + * Makes sure the _M_map has space for new nodes. Does not + * actually add the nodes. Can invalidate _M_map pointers. + * (And consequently, %deque iterators.) + */ + void + _M_reserve_map_at_back(size_type __nodes_to_add = 1) + { + if (__nodes_to_add + 1 > this->_M_impl._M_map_size + - (this->_M_impl._M_finish._M_node - this->_M_impl._M_map)) + _M_reallocate_map(__nodes_to_add, false); + } + + void + _M_reserve_map_at_front(size_type __nodes_to_add = 1) + { + if (__nodes_to_add > size_type(this->_M_impl._M_start._M_node + - this->_M_impl._M_map)) + _M_reallocate_map(__nodes_to_add, true); + } + + void + _M_reallocate_map(size_type __nodes_to_add, bool __add_at_front); + //@} + +#if __cplusplus >= 201103L + // Constant-time, nothrow move assignment when source object's memory + // can be moved because the allocators are equal. + void + _M_move_assign1(deque&& __x, /* always equal: */ true_type) noexcept + { + this->_M_impl._M_swap_data(__x._M_impl); + __x.clear(); + std::__alloc_on_move(_M_get_Tp_allocator(), __x._M_get_Tp_allocator()); + } + + // When the allocators are not equal the operation could throw, because + // we might need to allocate a new map for __x after moving from it + // or we might need to allocate new elements for *this. + void + _M_move_assign1(deque&& __x, /* always equal: */ false_type) + { + constexpr bool __move_storage = + _Alloc_traits::_S_propagate_on_move_assign(); + _M_move_assign2(std::move(__x), __bool_constant<__move_storage>()); + } + + // Destroy all elements and deallocate all memory, then replace + // with elements created from __args. + template + void + _M_replace_map(_Args&&... __args) + { + // Create new data first, so if allocation fails there are no effects. + deque __newobj(std::forward<_Args>(__args)...); + // Free existing storage using existing allocator. + clear(); + _M_deallocate_node(*begin()._M_node); // one node left after clear() + _M_deallocate_map(this->_M_impl._M_map, this->_M_impl._M_map_size); + this->_M_impl._M_map = nullptr; + this->_M_impl._M_map_size = 0; + // Take ownership of replacement memory. + this->_M_impl._M_swap_data(__newobj._M_impl); + } + + // Do move assignment when the allocator propagates. + void + _M_move_assign2(deque&& __x, /* propagate: */ true_type) + { + // Make a copy of the original allocator state. + auto __alloc = __x._M_get_Tp_allocator(); + // The allocator propagates so storage can be moved from __x, + // leaving __x in a valid empty state with a moved-from allocator. + _M_replace_map(std::move(__x)); + // Move the corresponding allocator state too. + _M_get_Tp_allocator() = std::move(__alloc); + } + + // Do move assignment when it may not be possible to move source + // object's memory, resulting in a linear-time operation. + void + _M_move_assign2(deque&& __x, /* propagate: */ false_type) + { + if (__x._M_get_Tp_allocator() == this->_M_get_Tp_allocator()) + { + // The allocators are equal so storage can be moved from __x, + // leaving __x in a valid empty state with its current allocator. + _M_replace_map(std::move(__x), __x.get_allocator()); + } + else + { + // The rvalue's allocator cannot be moved and is not equal, + // so we need to individually move each element. + _M_assign_aux(std::__make_move_if_noexcept_iterator(__x.begin()), + std::__make_move_if_noexcept_iterator(__x.end()), + std::random_access_iterator_tag()); + __x.clear(); + } + } +#endif + }; + + + /** + * @brief Deque equality comparison. + * @param __x A %deque. + * @param __y A %deque of the same type as @a __x. + * @return True iff the size and elements of the deques are equal. + * + * This is an equivalence relation. It is linear in the size of the + * deques. Deques are considered equivalent if their sizes are equal, + * and if corresponding elements compare equal. + */ + template + inline bool + operator==(const deque<_Tp, _Alloc>& __x, + const deque<_Tp, _Alloc>& __y) + { return __x.size() == __y.size() + && std::equal(__x.begin(), __x.end(), __y.begin()); } + + /** + * @brief Deque ordering relation. + * @param __x A %deque. + * @param __y A %deque of the same type as @a __x. + * @return True iff @a x is lexicographically less than @a __y. + * + * This is a total ordering relation. It is linear in the size of the + * deques. The elements must be comparable with @c <. + * + * See std::lexicographical_compare() for how the determination is made. + */ + template + inline bool + operator<(const deque<_Tp, _Alloc>& __x, + const deque<_Tp, _Alloc>& __y) + { return std::lexicographical_compare(__x.begin(), __x.end(), + __y.begin(), __y.end()); } + + /// Based on operator== + template + inline bool + operator!=(const deque<_Tp, _Alloc>& __x, + const deque<_Tp, _Alloc>& __y) + { return !(__x == __y); } + + /// Based on operator< + template + inline bool + operator>(const deque<_Tp, _Alloc>& __x, + const deque<_Tp, _Alloc>& __y) + { return __y < __x; } + + /// Based on operator< + template + inline bool + operator<=(const deque<_Tp, _Alloc>& __x, + const deque<_Tp, _Alloc>& __y) + { return !(__y < __x); } + + /// Based on operator< + template + inline bool + operator>=(const deque<_Tp, _Alloc>& __x, + const deque<_Tp, _Alloc>& __y) + { return !(__x < __y); } + + /// See std::deque::swap(). + template + inline void + swap(deque<_Tp,_Alloc>& __x, deque<_Tp,_Alloc>& __y) + _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y))) + { __x.swap(__y); } + +#undef _GLIBCXX_DEQUE_BUF_SIZE + +_GLIBCXX_END_NAMESPACE_CONTAINER +} // namespace std + +#endif /* _STL_DEQUE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_function.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_function.h new file mode 100644 index 0000000..4fbcdb9 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_function.h @@ -0,0 +1,1130 @@ +// Functor implementations -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_function.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{functional} + */ + +#ifndef _STL_FUNCTION_H +#define _STL_FUNCTION_H 1 + +#if __cplusplus > 201103L +#include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // 20.3.1 base classes + /** @defgroup functors Function Objects + * @ingroup utilities + * + * Function objects, or @e functors, are objects with an @c operator() + * defined and accessible. They can be passed as arguments to algorithm + * templates and used in place of a function pointer. Not only is the + * resulting expressiveness of the library increased, but the generated + * code can be more efficient than what you might write by hand. When we + * refer to @a functors, then, generally we include function pointers in + * the description as well. + * + * Often, functors are only created as temporaries passed to algorithm + * calls, rather than being created as named variables. + * + * Two examples taken from the standard itself follow. To perform a + * by-element addition of two vectors @c a and @c b containing @c double, + * and put the result in @c a, use + * \code + * transform (a.begin(), a.end(), b.begin(), a.begin(), plus()); + * \endcode + * To negate every element in @c a, use + * \code + * transform(a.begin(), a.end(), a.begin(), negate()); + * \endcode + * The addition and negation functions will be inlined directly. + * + * The standard functors are derived from structs named @c unary_function + * and @c binary_function. These two classes contain nothing but typedefs, + * to aid in generic (template) programming. If you write your own + * functors, you might consider doing the same. + * + * @{ + */ + /** + * This is one of the @link functors functor base classes@endlink. + */ + template + struct unary_function + { + /// @c argument_type is the type of the argument + typedef _Arg argument_type; + + /// @c result_type is the return type + typedef _Result result_type; + }; + + /** + * This is one of the @link functors functor base classes@endlink. + */ + template + struct binary_function + { + /// @c first_argument_type is the type of the first argument + typedef _Arg1 first_argument_type; + + /// @c second_argument_type is the type of the second argument + typedef _Arg2 second_argument_type; + + /// @c result_type is the return type + typedef _Result result_type; + }; + /** @} */ + + // 20.3.2 arithmetic + /** @defgroup arithmetic_functors Arithmetic Classes + * @ingroup functors + * + * Because basic math often needs to be done during an algorithm, + * the library provides functors for those operations. See the + * documentation for @link functors the base classes@endlink + * for examples of their use. + * + * @{ + */ + +#if __cplusplus > 201103L + struct __is_transparent; // undefined + + template + struct plus; + + template + struct minus; + + template + struct multiplies; + + template + struct divides; + + template + struct modulus; + + template + struct negate; +#endif + + /// One of the @link arithmetic_functors math functors@endlink. + template + struct plus : public binary_function<_Tp, _Tp, _Tp> + { + _GLIBCXX14_CONSTEXPR + _Tp + operator()(const _Tp& __x, const _Tp& __y) const + { return __x + __y; } + }; + + /// One of the @link arithmetic_functors math functors@endlink. + template + struct minus : public binary_function<_Tp, _Tp, _Tp> + { + _GLIBCXX14_CONSTEXPR + _Tp + operator()(const _Tp& __x, const _Tp& __y) const + { return __x - __y; } + }; + + /// One of the @link arithmetic_functors math functors@endlink. + template + struct multiplies : public binary_function<_Tp, _Tp, _Tp> + { + _GLIBCXX14_CONSTEXPR + _Tp + operator()(const _Tp& __x, const _Tp& __y) const + { return __x * __y; } + }; + + /// One of the @link arithmetic_functors math functors@endlink. + template + struct divides : public binary_function<_Tp, _Tp, _Tp> + { + _GLIBCXX14_CONSTEXPR + _Tp + operator()(const _Tp& __x, const _Tp& __y) const + { return __x / __y; } + }; + + /// One of the @link arithmetic_functors math functors@endlink. + template + struct modulus : public binary_function<_Tp, _Tp, _Tp> + { + _GLIBCXX14_CONSTEXPR + _Tp + operator()(const _Tp& __x, const _Tp& __y) const + { return __x % __y; } + }; + + /// One of the @link arithmetic_functors math functors@endlink. + template + struct negate : public unary_function<_Tp, _Tp> + { + _GLIBCXX14_CONSTEXPR + _Tp + operator()(const _Tp& __x) const + { return -__x; } + }; + +#if __cplusplus > 201103L + +#define __cpp_lib_transparent_operators 201510 + + template<> + struct plus + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) + std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) + std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) + std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + /// One of the @link arithmetic_functors math functors@endlink. + template<> + struct minus + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) - std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) - std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) - std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + /// One of the @link arithmetic_functors math functors@endlink. + template<> + struct multiplies + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) * std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) * std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) * std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + /// One of the @link arithmetic_functors math functors@endlink. + template<> + struct divides + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) / std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) / std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) / std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + /// One of the @link arithmetic_functors math functors@endlink. + template<> + struct modulus + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) % std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) % std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) % std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + /// One of the @link arithmetic_functors math functors@endlink. + template<> + struct negate + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t) const + noexcept(noexcept(-std::forward<_Tp>(__t))) + -> decltype(-std::forward<_Tp>(__t)) + { return -std::forward<_Tp>(__t); } + + typedef __is_transparent is_transparent; + }; +#endif + /** @} */ + + // 20.3.3 comparisons + /** @defgroup comparison_functors Comparison Classes + * @ingroup functors + * + * The library provides six wrapper functors for all the basic comparisons + * in C++, like @c <. + * + * @{ + */ +#if __cplusplus > 201103L + template + struct equal_to; + + template + struct not_equal_to; + + template + struct greater; + + template + struct less; + + template + struct greater_equal; + + template + struct less_equal; +#endif + + /// One of the @link comparison_functors comparison functors@endlink. + template + struct equal_to : public binary_function<_Tp, _Tp, bool> + { + _GLIBCXX14_CONSTEXPR + bool + operator()(const _Tp& __x, const _Tp& __y) const + { return __x == __y; } + }; + + /// One of the @link comparison_functors comparison functors@endlink. + template + struct not_equal_to : public binary_function<_Tp, _Tp, bool> + { + _GLIBCXX14_CONSTEXPR + bool + operator()(const _Tp& __x, const _Tp& __y) const + { return __x != __y; } + }; + + /// One of the @link comparison_functors comparison functors@endlink. + template + struct greater : public binary_function<_Tp, _Tp, bool> + { + _GLIBCXX14_CONSTEXPR + bool + operator()(const _Tp& __x, const _Tp& __y) const + { return __x > __y; } + }; + + /// One of the @link comparison_functors comparison functors@endlink. + template + struct less : public binary_function<_Tp, _Tp, bool> + { + _GLIBCXX14_CONSTEXPR + bool + operator()(const _Tp& __x, const _Tp& __y) const + { return __x < __y; } + }; + + /// One of the @link comparison_functors comparison functors@endlink. + template + struct greater_equal : public binary_function<_Tp, _Tp, bool> + { + _GLIBCXX14_CONSTEXPR + bool + operator()(const _Tp& __x, const _Tp& __y) const + { return __x >= __y; } + }; + + /// One of the @link comparison_functors comparison functors@endlink. + template + struct less_equal : public binary_function<_Tp, _Tp, bool> + { + _GLIBCXX14_CONSTEXPR + bool + operator()(const _Tp& __x, const _Tp& __y) const + { return __x <= __y; } + }; + +#if __cplusplus > 201103L + /// One of the @link comparison_functors comparison functors@endlink. + template<> + struct equal_to + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) == std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) == std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) == std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + /// One of the @link comparison_functors comparison functors@endlink. + template<> + struct not_equal_to + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) != std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) != std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) != std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + /// One of the @link comparison_functors comparison functors@endlink. + template<> + struct greater + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) > std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) > std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) > std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + /// One of the @link comparison_functors comparison functors@endlink. + template<> + struct less + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) < std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) < std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) < std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + /// One of the @link comparison_functors comparison functors@endlink. + template<> + struct greater_equal + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) >= std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) >= std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) >= std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + /// One of the @link comparison_functors comparison functors@endlink. + template<> + struct less_equal + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) <= std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) <= std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) <= std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; +#endif + /** @} */ + + // 20.3.4 logical operations + /** @defgroup logical_functors Boolean Operations Classes + * @ingroup functors + * + * Here are wrapper functors for Boolean operations: @c &&, @c ||, + * and @c !. + * + * @{ + */ +#if __cplusplus > 201103L + template + struct logical_and; + + template + struct logical_or; + + template + struct logical_not; +#endif + + /// One of the @link logical_functors Boolean operations functors@endlink. + template + struct logical_and : public binary_function<_Tp, _Tp, bool> + { + _GLIBCXX14_CONSTEXPR + bool + operator()(const _Tp& __x, const _Tp& __y) const + { return __x && __y; } + }; + + /// One of the @link logical_functors Boolean operations functors@endlink. + template + struct logical_or : public binary_function<_Tp, _Tp, bool> + { + _GLIBCXX14_CONSTEXPR + bool + operator()(const _Tp& __x, const _Tp& __y) const + { return __x || __y; } + }; + + /// One of the @link logical_functors Boolean operations functors@endlink. + template + struct logical_not : public unary_function<_Tp, bool> + { + _GLIBCXX14_CONSTEXPR + bool + operator()(const _Tp& __x) const + { return !__x; } + }; + +#if __cplusplus > 201103L + /// One of the @link logical_functors Boolean operations functors@endlink. + template<> + struct logical_and + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) && std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) && std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) && std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + /// One of the @link logical_functors Boolean operations functors@endlink. + template<> + struct logical_or + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) || std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) || std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) || std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + /// One of the @link logical_functors Boolean operations functors@endlink. + template<> + struct logical_not + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t) const + noexcept(noexcept(!std::forward<_Tp>(__t))) + -> decltype(!std::forward<_Tp>(__t)) + { return !std::forward<_Tp>(__t); } + + typedef __is_transparent is_transparent; + }; +#endif + /** @} */ + +#if __cplusplus > 201103L + template + struct bit_and; + + template + struct bit_or; + + template + struct bit_xor; + + template + struct bit_not; +#endif + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 660. Missing Bitwise Operations. + template + struct bit_and : public binary_function<_Tp, _Tp, _Tp> + { + _GLIBCXX14_CONSTEXPR + _Tp + operator()(const _Tp& __x, const _Tp& __y) const + { return __x & __y; } + }; + + template + struct bit_or : public binary_function<_Tp, _Tp, _Tp> + { + _GLIBCXX14_CONSTEXPR + _Tp + operator()(const _Tp& __x, const _Tp& __y) const + { return __x | __y; } + }; + + template + struct bit_xor : public binary_function<_Tp, _Tp, _Tp> + { + _GLIBCXX14_CONSTEXPR + _Tp + operator()(const _Tp& __x, const _Tp& __y) const + { return __x ^ __y; } + }; + + template + struct bit_not : public unary_function<_Tp, _Tp> + { + _GLIBCXX14_CONSTEXPR + _Tp + operator()(const _Tp& __x) const + { return ~__x; } + }; + +#if __cplusplus > 201103L + template <> + struct bit_and + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) & std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) & std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) & std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + template <> + struct bit_or + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) | std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) | std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) | std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + template <> + struct bit_xor + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t, _Up&& __u) const + noexcept(noexcept(std::forward<_Tp>(__t) ^ std::forward<_Up>(__u))) + -> decltype(std::forward<_Tp>(__t) ^ std::forward<_Up>(__u)) + { return std::forward<_Tp>(__t) ^ std::forward<_Up>(__u); } + + typedef __is_transparent is_transparent; + }; + + template <> + struct bit_not + { + template + _GLIBCXX14_CONSTEXPR + auto + operator()(_Tp&& __t) const + noexcept(noexcept(~std::forward<_Tp>(__t))) + -> decltype(~std::forward<_Tp>(__t)) + { return ~std::forward<_Tp>(__t); } + + typedef __is_transparent is_transparent; + }; +#endif + + // 20.3.5 negators + /** @defgroup negators Negators + * @ingroup functors + * + * The functions @c not1 and @c not2 each take a predicate functor + * and return an instance of @c unary_negate or + * @c binary_negate, respectively. These classes are functors whose + * @c operator() performs the stored predicate function and then returns + * the negation of the result. + * + * For example, given a vector of integers and a trivial predicate, + * \code + * struct IntGreaterThanThree + * : public std::unary_function + * { + * bool operator() (int x) { return x > 3; } + * }; + * + * std::find_if (v.begin(), v.end(), not1(IntGreaterThanThree())); + * \endcode + * The call to @c find_if will locate the first index (i) of @c v for which + * !(v[i] > 3) is true. + * + * The not1/unary_negate combination works on predicates taking a single + * argument. The not2/binary_negate combination works on predicates which + * take two arguments. + * + * @{ + */ + /// One of the @link negators negation functors@endlink. + template + class unary_negate + : public unary_function + { + protected: + _Predicate _M_pred; + + public: + _GLIBCXX14_CONSTEXPR + explicit + unary_negate(const _Predicate& __x) : _M_pred(__x) { } + + _GLIBCXX14_CONSTEXPR + bool + operator()(const typename _Predicate::argument_type& __x) const + { return !_M_pred(__x); } + }; + + /// One of the @link negators negation functors@endlink. + template + _GLIBCXX14_CONSTEXPR + inline unary_negate<_Predicate> + not1(const _Predicate& __pred) + { return unary_negate<_Predicate>(__pred); } + + /// One of the @link negators negation functors@endlink. + template + class binary_negate + : public binary_function + { + protected: + _Predicate _M_pred; + + public: + _GLIBCXX14_CONSTEXPR + explicit + binary_negate(const _Predicate& __x) : _M_pred(__x) { } + + _GLIBCXX14_CONSTEXPR + bool + operator()(const typename _Predicate::first_argument_type& __x, + const typename _Predicate::second_argument_type& __y) const + { return !_M_pred(__x, __y); } + }; + + /// One of the @link negators negation functors@endlink. + template + _GLIBCXX14_CONSTEXPR + inline binary_negate<_Predicate> + not2(const _Predicate& __pred) + { return binary_negate<_Predicate>(__pred); } + /** @} */ + + // 20.3.7 adaptors pointers functions + /** @defgroup pointer_adaptors Adaptors for pointers to functions + * @ingroup functors + * + * The advantage of function objects over pointers to functions is that + * the objects in the standard library declare nested typedefs describing + * their argument and result types with uniform names (e.g., @c result_type + * from the base classes @c unary_function and @c binary_function). + * Sometimes those typedefs are required, not just optional. + * + * Adaptors are provided to turn pointers to unary (single-argument) and + * binary (double-argument) functions into function objects. The + * long-winded functor @c pointer_to_unary_function is constructed with a + * function pointer @c f, and its @c operator() called with argument @c x + * returns @c f(x). The functor @c pointer_to_binary_function does the same + * thing, but with a double-argument @c f and @c operator(). + * + * The function @c ptr_fun takes a pointer-to-function @c f and constructs + * an instance of the appropriate functor. + * + * @{ + */ + /// One of the @link pointer_adaptors adaptors for function pointers@endlink. + template + class pointer_to_unary_function : public unary_function<_Arg, _Result> + { + protected: + _Result (*_M_ptr)(_Arg); + + public: + pointer_to_unary_function() { } + + explicit + pointer_to_unary_function(_Result (*__x)(_Arg)) + : _M_ptr(__x) { } + + _Result + operator()(_Arg __x) const + { return _M_ptr(__x); } + }; + + /// One of the @link pointer_adaptors adaptors for function pointers@endlink. + template + inline pointer_to_unary_function<_Arg, _Result> + ptr_fun(_Result (*__x)(_Arg)) + { return pointer_to_unary_function<_Arg, _Result>(__x); } + + /// One of the @link pointer_adaptors adaptors for function pointers@endlink. + template + class pointer_to_binary_function + : public binary_function<_Arg1, _Arg2, _Result> + { + protected: + _Result (*_M_ptr)(_Arg1, _Arg2); + + public: + pointer_to_binary_function() { } + + explicit + pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2)) + : _M_ptr(__x) { } + + _Result + operator()(_Arg1 __x, _Arg2 __y) const + { return _M_ptr(__x, __y); } + }; + + /// One of the @link pointer_adaptors adaptors for function pointers@endlink. + template + inline pointer_to_binary_function<_Arg1, _Arg2, _Result> + ptr_fun(_Result (*__x)(_Arg1, _Arg2)) + { return pointer_to_binary_function<_Arg1, _Arg2, _Result>(__x); } + /** @} */ + + template + struct _Identity + : public unary_function<_Tp,_Tp> + { + _Tp& + operator()(_Tp& __x) const + { return __x; } + + const _Tp& + operator()(const _Tp& __x) const + { return __x; } + }; + + template + struct _Select1st + : public unary_function<_Pair, typename _Pair::first_type> + { + typename _Pair::first_type& + operator()(_Pair& __x) const + { return __x.first; } + + const typename _Pair::first_type& + operator()(const _Pair& __x) const + { return __x.first; } + +#if __cplusplus >= 201103L + template + typename _Pair2::first_type& + operator()(_Pair2& __x) const + { return __x.first; } + + template + const typename _Pair2::first_type& + operator()(const _Pair2& __x) const + { return __x.first; } +#endif + }; + + template + struct _Select2nd + : public unary_function<_Pair, typename _Pair::second_type> + { + typename _Pair::second_type& + operator()(_Pair& __x) const + { return __x.second; } + + const typename _Pair::second_type& + operator()(const _Pair& __x) const + { return __x.second; } + }; + + // 20.3.8 adaptors pointers members + /** @defgroup memory_adaptors Adaptors for pointers to members + * @ingroup functors + * + * There are a total of 8 = 2^3 function objects in this family. + * (1) Member functions taking no arguments vs member functions taking + * one argument. + * (2) Call through pointer vs call through reference. + * (3) Const vs non-const member function. + * + * All of this complexity is in the function objects themselves. You can + * ignore it by using the helper function mem_fun and mem_fun_ref, + * which create whichever type of adaptor is appropriate. + * + * @{ + */ + /// One of the @link memory_adaptors adaptors for member + /// pointers@endlink. + template + class mem_fun_t : public unary_function<_Tp*, _Ret> + { + public: + explicit + mem_fun_t(_Ret (_Tp::*__pf)()) + : _M_f(__pf) { } + + _Ret + operator()(_Tp* __p) const + { return (__p->*_M_f)(); } + + private: + _Ret (_Tp::*_M_f)(); + }; + + /// One of the @link memory_adaptors adaptors for member + /// pointers@endlink. + template + class const_mem_fun_t : public unary_function + { + public: + explicit + const_mem_fun_t(_Ret (_Tp::*__pf)() const) + : _M_f(__pf) { } + + _Ret + operator()(const _Tp* __p) const + { return (__p->*_M_f)(); } + + private: + _Ret (_Tp::*_M_f)() const; + }; + + /// One of the @link memory_adaptors adaptors for member + /// pointers@endlink. + template + class mem_fun_ref_t : public unary_function<_Tp, _Ret> + { + public: + explicit + mem_fun_ref_t(_Ret (_Tp::*__pf)()) + : _M_f(__pf) { } + + _Ret + operator()(_Tp& __r) const + { return (__r.*_M_f)(); } + + private: + _Ret (_Tp::*_M_f)(); + }; + + /// One of the @link memory_adaptors adaptors for member + /// pointers@endlink. + template + class const_mem_fun_ref_t : public unary_function<_Tp, _Ret> + { + public: + explicit + const_mem_fun_ref_t(_Ret (_Tp::*__pf)() const) + : _M_f(__pf) { } + + _Ret + operator()(const _Tp& __r) const + { return (__r.*_M_f)(); } + + private: + _Ret (_Tp::*_M_f)() const; + }; + + /// One of the @link memory_adaptors adaptors for member + /// pointers@endlink. + template + class mem_fun1_t : public binary_function<_Tp*, _Arg, _Ret> + { + public: + explicit + mem_fun1_t(_Ret (_Tp::*__pf)(_Arg)) + : _M_f(__pf) { } + + _Ret + operator()(_Tp* __p, _Arg __x) const + { return (__p->*_M_f)(__x); } + + private: + _Ret (_Tp::*_M_f)(_Arg); + }; + + /// One of the @link memory_adaptors adaptors for member + /// pointers@endlink. + template + class const_mem_fun1_t : public binary_function + { + public: + explicit + const_mem_fun1_t(_Ret (_Tp::*__pf)(_Arg) const) + : _M_f(__pf) { } + + _Ret + operator()(const _Tp* __p, _Arg __x) const + { return (__p->*_M_f)(__x); } + + private: + _Ret (_Tp::*_M_f)(_Arg) const; + }; + + /// One of the @link memory_adaptors adaptors for member + /// pointers@endlink. + template + class mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret> + { + public: + explicit + mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg)) + : _M_f(__pf) { } + + _Ret + operator()(_Tp& __r, _Arg __x) const + { return (__r.*_M_f)(__x); } + + private: + _Ret (_Tp::*_M_f)(_Arg); + }; + + /// One of the @link memory_adaptors adaptors for member + /// pointers@endlink. + template + class const_mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret> + { + public: + explicit + const_mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg) const) + : _M_f(__pf) { } + + _Ret + operator()(const _Tp& __r, _Arg __x) const + { return (__r.*_M_f)(__x); } + + private: + _Ret (_Tp::*_M_f)(_Arg) const; + }; + + // Mem_fun adaptor helper functions. There are only two: + // mem_fun and mem_fun_ref. + template + inline mem_fun_t<_Ret, _Tp> + mem_fun(_Ret (_Tp::*__f)()) + { return mem_fun_t<_Ret, _Tp>(__f); } + + template + inline const_mem_fun_t<_Ret, _Tp> + mem_fun(_Ret (_Tp::*__f)() const) + { return const_mem_fun_t<_Ret, _Tp>(__f); } + + template + inline mem_fun_ref_t<_Ret, _Tp> + mem_fun_ref(_Ret (_Tp::*__f)()) + { return mem_fun_ref_t<_Ret, _Tp>(__f); } + + template + inline const_mem_fun_ref_t<_Ret, _Tp> + mem_fun_ref(_Ret (_Tp::*__f)() const) + { return const_mem_fun_ref_t<_Ret, _Tp>(__f); } + + template + inline mem_fun1_t<_Ret, _Tp, _Arg> + mem_fun(_Ret (_Tp::*__f)(_Arg)) + { return mem_fun1_t<_Ret, _Tp, _Arg>(__f); } + + template + inline const_mem_fun1_t<_Ret, _Tp, _Arg> + mem_fun(_Ret (_Tp::*__f)(_Arg) const) + { return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); } + + template + inline mem_fun1_ref_t<_Ret, _Tp, _Arg> + mem_fun_ref(_Ret (_Tp::*__f)(_Arg)) + { return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); } + + template + inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg> + mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const) + { return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); } + + /** @} */ + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED +# include +#endif + +#endif /* _STL_FUNCTION_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_heap.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_heap.h new file mode 100644 index 0000000..f8cd0c0 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_heap.h @@ -0,0 +1,561 @@ +// Heap implementation -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_heap.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{queue} + */ + +#ifndef _STL_HEAP_H +#define _STL_HEAP_H 1 + +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @defgroup heap_algorithms Heap + * @ingroup sorting_algorithms + */ + + template + _Distance + __is_heap_until(_RandomAccessIterator __first, _Distance __n, + _Compare& __comp) + { + _Distance __parent = 0; + for (_Distance __child = 1; __child < __n; ++__child) + { + if (__comp(__first + __parent, __first + __child)) + return __child; + if ((__child & 1) == 0) + ++__parent; + } + return __n; + } + + // __is_heap, a predicate testing whether or not a range is a heap. + // This function is an extension, not part of the C++ standard. + template + inline bool + __is_heap(_RandomAccessIterator __first, _Distance __n) + { + __gnu_cxx::__ops::_Iter_less_iter __comp; + return std::__is_heap_until(__first, __n, __comp) == __n; + } + + template + inline bool + __is_heap(_RandomAccessIterator __first, _Compare __comp, _Distance __n) + { + typedef __decltype(__comp) _Cmp; + __gnu_cxx::__ops::_Iter_comp_iter<_Cmp> __cmp(_GLIBCXX_MOVE(__comp)); + return std::__is_heap_until(__first, __n, __cmp) == __n; + } + + template + inline bool + __is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) + { return std::__is_heap(__first, std::distance(__first, __last)); } + + template + inline bool + __is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, + _Compare __comp) + { + return std::__is_heap(__first, _GLIBCXX_MOVE(__comp), + std::distance(__first, __last)); + } + + // Heap-manipulation functions: push_heap, pop_heap, make_heap, sort_heap, + // + is_heap and is_heap_until in C++0x. + + template + void + __push_heap(_RandomAccessIterator __first, + _Distance __holeIndex, _Distance __topIndex, _Tp __value, + _Compare& __comp) + { + _Distance __parent = (__holeIndex - 1) / 2; + while (__holeIndex > __topIndex && __comp(__first + __parent, __value)) + { + *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __parent)); + __holeIndex = __parent; + __parent = (__holeIndex - 1) / 2; + } + *(__first + __holeIndex) = _GLIBCXX_MOVE(__value); + } + + /** + * @brief Push an element onto a heap. + * @param __first Start of heap. + * @param __last End of heap + element. + * @ingroup heap_algorithms + * + * This operation pushes the element at last-1 onto the valid heap + * over the range [__first,__last-1). After completion, + * [__first,__last) is a valid heap. + */ + template + inline void + push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) + { + typedef typename iterator_traits<_RandomAccessIterator>::value_type + _ValueType; + typedef typename iterator_traits<_RandomAccessIterator>::difference_type + _DistanceType; + + // concept requirements + __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive(__first, __last); + __glibcxx_requires_heap(__first, __last - 1); + + __gnu_cxx::__ops::_Iter_less_val __comp; + _ValueType __value = _GLIBCXX_MOVE(*(__last - 1)); + std::__push_heap(__first, _DistanceType((__last - __first) - 1), + _DistanceType(0), _GLIBCXX_MOVE(__value), __comp); + } + + /** + * @brief Push an element onto a heap using comparison functor. + * @param __first Start of heap. + * @param __last End of heap + element. + * @param __comp Comparison functor. + * @ingroup heap_algorithms + * + * This operation pushes the element at __last-1 onto the valid + * heap over the range [__first,__last-1). After completion, + * [__first,__last) is a valid heap. Compare operations are + * performed using comp. + */ + template + inline void + push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, + _Compare __comp) + { + typedef typename iterator_traits<_RandomAccessIterator>::value_type + _ValueType; + typedef typename iterator_traits<_RandomAccessIterator>::difference_type + _DistanceType; + + // concept requirements + __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive_pred(__first, __last, __comp); + __glibcxx_requires_heap_pred(__first, __last - 1, __comp); + + __decltype(__gnu_cxx::__ops::__iter_comp_val(_GLIBCXX_MOVE(__comp))) + __cmp(_GLIBCXX_MOVE(__comp)); + _ValueType __value = _GLIBCXX_MOVE(*(__last - 1)); + std::__push_heap(__first, _DistanceType((__last - __first) - 1), + _DistanceType(0), _GLIBCXX_MOVE(__value), __cmp); + } + + template + void + __adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex, + _Distance __len, _Tp __value, _Compare __comp) + { + const _Distance __topIndex = __holeIndex; + _Distance __secondChild = __holeIndex; + while (__secondChild < (__len - 1) / 2) + { + __secondChild = 2 * (__secondChild + 1); + if (__comp(__first + __secondChild, + __first + (__secondChild - 1))) + __secondChild--; + *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild)); + __holeIndex = __secondChild; + } + if ((__len & 1) == 0 && __secondChild == (__len - 2) / 2) + { + __secondChild = 2 * (__secondChild + 1); + *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + + (__secondChild - 1))); + __holeIndex = __secondChild - 1; + } + __decltype(__gnu_cxx::__ops::__iter_comp_val(_GLIBCXX_MOVE(__comp))) + __cmp(_GLIBCXX_MOVE(__comp)); + std::__push_heap(__first, __holeIndex, __topIndex, + _GLIBCXX_MOVE(__value), __cmp); + } + + template + inline void + __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, + _RandomAccessIterator __result, _Compare& __comp) + { + typedef typename iterator_traits<_RandomAccessIterator>::value_type + _ValueType; + typedef typename iterator_traits<_RandomAccessIterator>::difference_type + _DistanceType; + + _ValueType __value = _GLIBCXX_MOVE(*__result); + *__result = _GLIBCXX_MOVE(*__first); + std::__adjust_heap(__first, _DistanceType(0), + _DistanceType(__last - __first), + _GLIBCXX_MOVE(__value), __comp); + } + + /** + * @brief Pop an element off a heap. + * @param __first Start of heap. + * @param __last End of heap. + * @pre [__first, __last) is a valid, non-empty range. + * @ingroup heap_algorithms + * + * This operation pops the top of the heap. The elements __first + * and __last-1 are swapped and [__first,__last-1) is made into a + * heap. + */ + template + inline void + pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) + { + // concept requirements + __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __glibcxx_function_requires(_LessThanComparableConcept< + typename iterator_traits<_RandomAccessIterator>::value_type>) + __glibcxx_requires_non_empty_range(__first, __last); + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive(__first, __last); + __glibcxx_requires_heap(__first, __last); + + if (__last - __first > 1) + { + --__last; + __gnu_cxx::__ops::_Iter_less_iter __comp; + std::__pop_heap(__first, __last, __last, __comp); + } + } + + /** + * @brief Pop an element off a heap using comparison functor. + * @param __first Start of heap. + * @param __last End of heap. + * @param __comp Comparison functor to use. + * @ingroup heap_algorithms + * + * This operation pops the top of the heap. The elements __first + * and __last-1 are swapped and [__first,__last-1) is made into a + * heap. Comparisons are made using comp. + */ + template + inline void + pop_heap(_RandomAccessIterator __first, + _RandomAccessIterator __last, _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive_pred(__first, __last, __comp); + __glibcxx_requires_non_empty_range(__first, __last); + __glibcxx_requires_heap_pred(__first, __last, __comp); + + if (__last - __first > 1) + { + typedef __decltype(__comp) _Cmp; + __gnu_cxx::__ops::_Iter_comp_iter<_Cmp> __cmp(_GLIBCXX_MOVE(__comp)); + --__last; + std::__pop_heap(__first, __last, __last, __cmp); + } + } + + template + void + __make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, + _Compare& __comp) + { + typedef typename iterator_traits<_RandomAccessIterator>::value_type + _ValueType; + typedef typename iterator_traits<_RandomAccessIterator>::difference_type + _DistanceType; + + if (__last - __first < 2) + return; + + const _DistanceType __len = __last - __first; + _DistanceType __parent = (__len - 2) / 2; + while (true) + { + _ValueType __value = _GLIBCXX_MOVE(*(__first + __parent)); + std::__adjust_heap(__first, __parent, __len, _GLIBCXX_MOVE(__value), + __comp); + if (__parent == 0) + return; + __parent--; + } + } + + /** + * @brief Construct a heap over a range. + * @param __first Start of heap. + * @param __last End of heap. + * @ingroup heap_algorithms + * + * This operation makes the elements in [__first,__last) into a heap. + */ + template + inline void + make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) + { + // concept requirements + __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __glibcxx_function_requires(_LessThanComparableConcept< + typename iterator_traits<_RandomAccessIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive(__first, __last); + + __gnu_cxx::__ops::_Iter_less_iter __comp; + std::__make_heap(__first, __last, __comp); + } + + /** + * @brief Construct a heap over a range using comparison functor. + * @param __first Start of heap. + * @param __last End of heap. + * @param __comp Comparison functor to use. + * @ingroup heap_algorithms + * + * This operation makes the elements in [__first,__last) into a heap. + * Comparisons are made using __comp. + */ + template + inline void + make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, + _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive_pred(__first, __last, __comp); + + typedef __decltype(__comp) _Cmp; + __gnu_cxx::__ops::_Iter_comp_iter<_Cmp> __cmp(_GLIBCXX_MOVE(__comp)); + std::__make_heap(__first, __last, __cmp); + } + + template + void + __sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, + _Compare& __comp) + { + while (__last - __first > 1) + { + --__last; + std::__pop_heap(__first, __last, __last, __comp); + } + } + + /** + * @brief Sort a heap. + * @param __first Start of heap. + * @param __last End of heap. + * @ingroup heap_algorithms + * + * This operation sorts the valid heap in the range [__first,__last). + */ + template + inline void + sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) + { + // concept requirements + __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __glibcxx_function_requires(_LessThanComparableConcept< + typename iterator_traits<_RandomAccessIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive(__first, __last); + __glibcxx_requires_heap(__first, __last); + + __gnu_cxx::__ops::_Iter_less_iter __comp; + std::__sort_heap(__first, __last, __comp); + } + + /** + * @brief Sort a heap using comparison functor. + * @param __first Start of heap. + * @param __last End of heap. + * @param __comp Comparison functor to use. + * @ingroup heap_algorithms + * + * This operation sorts the valid heap in the range [__first,__last). + * Comparisons are made using __comp. + */ + template + inline void + sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, + _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive_pred(__first, __last, __comp); + __glibcxx_requires_heap_pred(__first, __last, __comp); + + typedef __decltype(__comp) _Cmp; + __gnu_cxx::__ops::_Iter_comp_iter<_Cmp> __cmp(_GLIBCXX_MOVE(__comp)); + std::__sort_heap(__first, __last, __cmp); + } + +#if __cplusplus >= 201103L + /** + * @brief Search the end of a heap. + * @param __first Start of range. + * @param __last End of range. + * @return An iterator pointing to the first element not in the heap. + * @ingroup heap_algorithms + * + * This operation returns the last iterator i in [__first, __last) for which + * the range [__first, i) is a heap. + */ + template + inline _RandomAccessIterator + is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last) + { + // concept requirements + __glibcxx_function_requires(_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __glibcxx_function_requires(_LessThanComparableConcept< + typename iterator_traits<_RandomAccessIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive(__first, __last); + + __gnu_cxx::__ops::_Iter_less_iter __comp; + return __first + + std::__is_heap_until(__first, std::distance(__first, __last), __comp); + } + + /** + * @brief Search the end of a heap using comparison functor. + * @param __first Start of range. + * @param __last End of range. + * @param __comp Comparison functor to use. + * @return An iterator pointing to the first element not in the heap. + * @ingroup heap_algorithms + * + * This operation returns the last iterator i in [__first, __last) for which + * the range [__first, i) is a heap. Comparisons are made using __comp. + */ + template + inline _RandomAccessIterator + is_heap_until(_RandomAccessIterator __first, _RandomAccessIterator __last, + _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive_pred(__first, __last, __comp); + + typedef __decltype(__comp) _Cmp; + __gnu_cxx::__ops::_Iter_comp_iter<_Cmp> __cmp(_GLIBCXX_MOVE(__comp)); + return __first + + std::__is_heap_until(__first, std::distance(__first, __last), __cmp); + } + + /** + * @brief Determines whether a range is a heap. + * @param __first Start of range. + * @param __last End of range. + * @return True if range is a heap, false otherwise. + * @ingroup heap_algorithms + */ + template + inline bool + is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last) + { return std::is_heap_until(__first, __last) == __last; } + + /** + * @brief Determines whether a range is a heap using comparison functor. + * @param __first Start of range. + * @param __last End of range. + * @param __comp Comparison functor to use. + * @return True if range is a heap, false otherwise. + * @ingroup heap_algorithms + */ + template + inline bool + is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, + _Compare __comp) + { + // concept requirements + __glibcxx_function_requires(_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __glibcxx_requires_valid_range(__first, __last); + __glibcxx_requires_irreflexive_pred(__first, __last, __comp); + + const auto __dist = std::distance(__first, __last); + typedef __decltype(__comp) _Cmp; + __gnu_cxx::__ops::_Iter_comp_iter<_Cmp> __cmp(_GLIBCXX_MOVE(__comp)); + return std::__is_heap_until(__first, __dist, __cmp) == __dist; + } +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _STL_HEAP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_iterator.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_iterator.h new file mode 100644 index 0000000..e6ef784 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_iterator.h @@ -0,0 +1,1260 @@ +// Iterators -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_iterator.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iterator} + * + * This file implements reverse_iterator, back_insert_iterator, + * front_insert_iterator, insert_iterator, __normal_iterator, and their + * supporting functions and overloaded operators. + */ + +#ifndef _STL_ITERATOR_H +#define _STL_ITERATOR_H 1 + +#include +#include +#include +#include + +#if __cplusplus > 201402L +# define __cpp_lib_array_constexpr 201603 +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup iterators + * @{ + */ + + // 24.4.1 Reverse iterators + /** + * Bidirectional and random access iterators have corresponding reverse + * %iterator adaptors that iterate through the data structure in the + * opposite direction. They have the same signatures as the corresponding + * iterators. The fundamental relation between a reverse %iterator and its + * corresponding %iterator @c i is established by the identity: + * @code + * &*(reverse_iterator(i)) == &*(i - 1) + * @endcode + * + * This mapping is dictated by the fact that while there is always a + * pointer past the end of an array, there might not be a valid pointer + * before the beginning of an array. [24.4.1]/1,2 + * + * Reverse iterators can be tricky and surprising at first. Their + * semantics make sense, however, and the trickiness is a side effect of + * the requirement that the iterators must be safe. + */ + template + class reverse_iterator + : public iterator::iterator_category, + typename iterator_traits<_Iterator>::value_type, + typename iterator_traits<_Iterator>::difference_type, + typename iterator_traits<_Iterator>::pointer, + typename iterator_traits<_Iterator>::reference> + { + protected: + _Iterator current; + + typedef iterator_traits<_Iterator> __traits_type; + + public: + typedef _Iterator iterator_type; + typedef typename __traits_type::difference_type difference_type; + typedef typename __traits_type::pointer pointer; + typedef typename __traits_type::reference reference; + + /** + * The default constructor value-initializes member @p current. + * If it is a pointer, that means it is zero-initialized. + */ + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 235 No specification of default ctor for reverse_iterator + _GLIBCXX17_CONSTEXPR + reverse_iterator() : current() { } + + /** + * This %iterator will move in the opposite direction that @p x does. + */ + explicit _GLIBCXX17_CONSTEXPR + reverse_iterator(iterator_type __x) : current(__x) { } + + /** + * The copy constructor is normal. + */ + _GLIBCXX17_CONSTEXPR + reverse_iterator(const reverse_iterator& __x) + : current(__x.current) { } + + /** + * A %reverse_iterator across other types can be copied if the + * underlying %iterator can be converted to the type of @c current. + */ + template + _GLIBCXX17_CONSTEXPR + reverse_iterator(const reverse_iterator<_Iter>& __x) + : current(__x.base()) { } + + /** + * @return @c current, the %iterator used for underlying work. + */ + _GLIBCXX17_CONSTEXPR iterator_type + base() const + { return current; } + + /** + * @return A reference to the value at @c --current + * + * This requires that @c --current is dereferenceable. + * + * @warning This implementation requires that for an iterator of the + * underlying iterator type, @c x, a reference obtained by + * @c *x remains valid after @c x has been modified or + * destroyed. This is a bug: http://gcc.gnu.org/PR51823 + */ + _GLIBCXX17_CONSTEXPR reference + operator*() const + { + _Iterator __tmp = current; + return *--__tmp; + } + + /** + * @return A pointer to the value at @c --current + * + * This requires that @c --current is dereferenceable. + */ + _GLIBCXX17_CONSTEXPR pointer + operator->() const + { return &(operator*()); } + + /** + * @return @c *this + * + * Decrements the underlying iterator. + */ + _GLIBCXX17_CONSTEXPR reverse_iterator& + operator++() + { + --current; + return *this; + } + + /** + * @return The original value of @c *this + * + * Decrements the underlying iterator. + */ + _GLIBCXX17_CONSTEXPR reverse_iterator + operator++(int) + { + reverse_iterator __tmp = *this; + --current; + return __tmp; + } + + /** + * @return @c *this + * + * Increments the underlying iterator. + */ + _GLIBCXX17_CONSTEXPR reverse_iterator& + operator--() + { + ++current; + return *this; + } + + /** + * @return A reverse_iterator with the previous value of @c *this + * + * Increments the underlying iterator. + */ + _GLIBCXX17_CONSTEXPR reverse_iterator + operator--(int) + { + reverse_iterator __tmp = *this; + ++current; + return __tmp; + } + + /** + * @return A reverse_iterator that refers to @c current - @a __n + * + * The underlying iterator must be a Random Access Iterator. + */ + _GLIBCXX17_CONSTEXPR reverse_iterator + operator+(difference_type __n) const + { return reverse_iterator(current - __n); } + + /** + * @return *this + * + * Moves the underlying iterator backwards @a __n steps. + * The underlying iterator must be a Random Access Iterator. + */ + _GLIBCXX17_CONSTEXPR reverse_iterator& + operator+=(difference_type __n) + { + current -= __n; + return *this; + } + + /** + * @return A reverse_iterator that refers to @c current - @a __n + * + * The underlying iterator must be a Random Access Iterator. + */ + _GLIBCXX17_CONSTEXPR reverse_iterator + operator-(difference_type __n) const + { return reverse_iterator(current + __n); } + + /** + * @return *this + * + * Moves the underlying iterator forwards @a __n steps. + * The underlying iterator must be a Random Access Iterator. + */ + _GLIBCXX17_CONSTEXPR reverse_iterator& + operator-=(difference_type __n) + { + current += __n; + return *this; + } + + /** + * @return The value at @c current - @a __n - 1 + * + * The underlying iterator must be a Random Access Iterator. + */ + _GLIBCXX17_CONSTEXPR reference + operator[](difference_type __n) const + { return *(*this + __n); } + }; + + //@{ + /** + * @param __x A %reverse_iterator. + * @param __y A %reverse_iterator. + * @return A simple bool. + * + * Reverse iterators forward many operations to their underlying base() + * iterators. Others are implemented in terms of one another. + * + */ + template + inline _GLIBCXX17_CONSTEXPR bool + operator==(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) + { return __x.base() == __y.base(); } + + template + inline _GLIBCXX17_CONSTEXPR bool + operator<(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) + { return __y.base() < __x.base(); } + + template + inline _GLIBCXX17_CONSTEXPR bool + operator!=(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) + { return !(__x == __y); } + + template + inline _GLIBCXX17_CONSTEXPR bool + operator>(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) + { return __y < __x; } + + template + inline _GLIBCXX17_CONSTEXPR bool + operator<=(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) + { return !(__y < __x); } + + template + inline _GLIBCXX17_CONSTEXPR bool + operator>=(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) + { return !(__x < __y); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 280. Comparison of reverse_iterator to const reverse_iterator. + template + inline _GLIBCXX17_CONSTEXPR bool + operator==(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + { return __x.base() == __y.base(); } + + template + inline _GLIBCXX17_CONSTEXPR bool + operator<(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + { return __y.base() < __x.base(); } + + template + inline _GLIBCXX17_CONSTEXPR bool + operator!=(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + { return !(__x == __y); } + + template + inline _GLIBCXX17_CONSTEXPR bool + operator>(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + { return __y < __x; } + + template + inline _GLIBCXX17_CONSTEXPR bool + operator<=(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + { return !(__y < __x); } + + template + inline _GLIBCXX17_CONSTEXPR bool + operator>=(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + { return !(__x < __y); } + //@} + +#if __cplusplus < 201103L + template + inline typename reverse_iterator<_Iterator>::difference_type + operator-(const reverse_iterator<_Iterator>& __x, + const reverse_iterator<_Iterator>& __y) + { return __y.base() - __x.base(); } + + template + inline typename reverse_iterator<_IteratorL>::difference_type + operator-(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + { return __y.base() - __x.base(); } +#else + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 685. reverse_iterator/move_iterator difference has invalid signatures + template + inline _GLIBCXX17_CONSTEXPR auto + operator-(const reverse_iterator<_IteratorL>& __x, + const reverse_iterator<_IteratorR>& __y) + -> decltype(__y.base() - __x.base()) + { return __y.base() - __x.base(); } +#endif + + template + inline _GLIBCXX17_CONSTEXPR reverse_iterator<_Iterator> + operator+(typename reverse_iterator<_Iterator>::difference_type __n, + const reverse_iterator<_Iterator>& __x) + { return reverse_iterator<_Iterator>(__x.base() - __n); } + +#if __cplusplus >= 201103L + // Same as C++14 make_reverse_iterator but used in C++03 mode too. + template + inline _GLIBCXX17_CONSTEXPR reverse_iterator<_Iterator> + __make_reverse_iterator(_Iterator __i) + { return reverse_iterator<_Iterator>(__i); } + +# if __cplusplus > 201103L +# define __cpp_lib_make_reverse_iterator 201402 + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 2285. make_reverse_iterator + /// Generator function for reverse_iterator. + template + inline _GLIBCXX17_CONSTEXPR reverse_iterator<_Iterator> + make_reverse_iterator(_Iterator __i) + { return reverse_iterator<_Iterator>(__i); } +# endif +#endif + +#if __cplusplus >= 201103L + template + auto + __niter_base(reverse_iterator<_Iterator> __it) + -> decltype(__make_reverse_iterator(__niter_base(__it.base()))) + { return __make_reverse_iterator(__niter_base(__it.base())); } + + template + struct __is_move_iterator > + : __is_move_iterator<_Iterator> + { }; + + template + auto + __miter_base(reverse_iterator<_Iterator> __it) + -> decltype(__make_reverse_iterator(__miter_base(__it.base()))) + { return __make_reverse_iterator(__miter_base(__it.base())); } +#endif + + // 24.4.2.2.1 back_insert_iterator + /** + * @brief Turns assignment into insertion. + * + * These are output iterators, constructed from a container-of-T. + * Assigning a T to the iterator appends it to the container using + * push_back. + * + * Tip: Using the back_inserter function to create these iterators can + * save typing. + */ + template + class back_insert_iterator + : public iterator + { + protected: + _Container* container; + + public: + /// A nested typedef for the type of whatever container you used. + typedef _Container container_type; + + /// The only way to create this %iterator is with a container. + explicit + back_insert_iterator(_Container& __x) + : container(std::__addressof(__x)) { } + + /** + * @param __value An instance of whatever type + * container_type::const_reference is; presumably a + * reference-to-const T for container. + * @return This %iterator, for chained operations. + * + * This kind of %iterator doesn't really have a @a position in the + * container (you can think of the position as being permanently at + * the end, if you like). Assigning a value to the %iterator will + * always append the value to the end of the container. + */ +#if __cplusplus < 201103L + back_insert_iterator& + operator=(typename _Container::const_reference __value) + { + container->push_back(__value); + return *this; + } +#else + back_insert_iterator& + operator=(const typename _Container::value_type& __value) + { + container->push_back(__value); + return *this; + } + + back_insert_iterator& + operator=(typename _Container::value_type&& __value) + { + container->push_back(std::move(__value)); + return *this; + } +#endif + + /// Simply returns *this. + back_insert_iterator& + operator*() + { return *this; } + + /// Simply returns *this. (This %iterator does not @a move.) + back_insert_iterator& + operator++() + { return *this; } + + /// Simply returns *this. (This %iterator does not @a move.) + back_insert_iterator + operator++(int) + { return *this; } + }; + + /** + * @param __x A container of arbitrary type. + * @return An instance of back_insert_iterator working on @p __x. + * + * This wrapper function helps in creating back_insert_iterator instances. + * Typing the name of the %iterator requires knowing the precise full + * type of the container, which can be tedious and impedes generic + * programming. Using this function lets you take advantage of automatic + * template parameter deduction, making the compiler match the correct + * types for you. + */ + template + inline back_insert_iterator<_Container> + back_inserter(_Container& __x) + { return back_insert_iterator<_Container>(__x); } + + /** + * @brief Turns assignment into insertion. + * + * These are output iterators, constructed from a container-of-T. + * Assigning a T to the iterator prepends it to the container using + * push_front. + * + * Tip: Using the front_inserter function to create these iterators can + * save typing. + */ + template + class front_insert_iterator + : public iterator + { + protected: + _Container* container; + + public: + /// A nested typedef for the type of whatever container you used. + typedef _Container container_type; + + /// The only way to create this %iterator is with a container. + explicit front_insert_iterator(_Container& __x) + : container(std::__addressof(__x)) { } + + /** + * @param __value An instance of whatever type + * container_type::const_reference is; presumably a + * reference-to-const T for container. + * @return This %iterator, for chained operations. + * + * This kind of %iterator doesn't really have a @a position in the + * container (you can think of the position as being permanently at + * the front, if you like). Assigning a value to the %iterator will + * always prepend the value to the front of the container. + */ +#if __cplusplus < 201103L + front_insert_iterator& + operator=(typename _Container::const_reference __value) + { + container->push_front(__value); + return *this; + } +#else + front_insert_iterator& + operator=(const typename _Container::value_type& __value) + { + container->push_front(__value); + return *this; + } + + front_insert_iterator& + operator=(typename _Container::value_type&& __value) + { + container->push_front(std::move(__value)); + return *this; + } +#endif + + /// Simply returns *this. + front_insert_iterator& + operator*() + { return *this; } + + /// Simply returns *this. (This %iterator does not @a move.) + front_insert_iterator& + operator++() + { return *this; } + + /// Simply returns *this. (This %iterator does not @a move.) + front_insert_iterator + operator++(int) + { return *this; } + }; + + /** + * @param __x A container of arbitrary type. + * @return An instance of front_insert_iterator working on @p x. + * + * This wrapper function helps in creating front_insert_iterator instances. + * Typing the name of the %iterator requires knowing the precise full + * type of the container, which can be tedious and impedes generic + * programming. Using this function lets you take advantage of automatic + * template parameter deduction, making the compiler match the correct + * types for you. + */ + template + inline front_insert_iterator<_Container> + front_inserter(_Container& __x) + { return front_insert_iterator<_Container>(__x); } + + /** + * @brief Turns assignment into insertion. + * + * These are output iterators, constructed from a container-of-T. + * Assigning a T to the iterator inserts it in the container at the + * %iterator's position, rather than overwriting the value at that + * position. + * + * (Sequences will actually insert a @e copy of the value before the + * %iterator's position.) + * + * Tip: Using the inserter function to create these iterators can + * save typing. + */ + template + class insert_iterator + : public iterator + { + protected: + _Container* container; + typename _Container::iterator iter; + + public: + /// A nested typedef for the type of whatever container you used. + typedef _Container container_type; + + /** + * The only way to create this %iterator is with a container and an + * initial position (a normal %iterator into the container). + */ + insert_iterator(_Container& __x, typename _Container::iterator __i) + : container(std::__addressof(__x)), iter(__i) {} + + /** + * @param __value An instance of whatever type + * container_type::const_reference is; presumably a + * reference-to-const T for container. + * @return This %iterator, for chained operations. + * + * This kind of %iterator maintains its own position in the + * container. Assigning a value to the %iterator will insert the + * value into the container at the place before the %iterator. + * + * The position is maintained such that subsequent assignments will + * insert values immediately after one another. For example, + * @code + * // vector v contains A and Z + * + * insert_iterator i (v, ++v.begin()); + * i = 1; + * i = 2; + * i = 3; + * + * // vector v contains A, 1, 2, 3, and Z + * @endcode + */ +#if __cplusplus < 201103L + insert_iterator& + operator=(typename _Container::const_reference __value) + { + iter = container->insert(iter, __value); + ++iter; + return *this; + } +#else + insert_iterator& + operator=(const typename _Container::value_type& __value) + { + iter = container->insert(iter, __value); + ++iter; + return *this; + } + + insert_iterator& + operator=(typename _Container::value_type&& __value) + { + iter = container->insert(iter, std::move(__value)); + ++iter; + return *this; + } +#endif + + /// Simply returns *this. + insert_iterator& + operator*() + { return *this; } + + /// Simply returns *this. (This %iterator does not @a move.) + insert_iterator& + operator++() + { return *this; } + + /// Simply returns *this. (This %iterator does not @a move.) + insert_iterator& + operator++(int) + { return *this; } + }; + + /** + * @param __x A container of arbitrary type. + * @return An instance of insert_iterator working on @p __x. + * + * This wrapper function helps in creating insert_iterator instances. + * Typing the name of the %iterator requires knowing the precise full + * type of the container, which can be tedious and impedes generic + * programming. Using this function lets you take advantage of automatic + * template parameter deduction, making the compiler match the correct + * types for you. + */ + template + inline insert_iterator<_Container> + inserter(_Container& __x, _Iterator __i) + { + return insert_iterator<_Container>(__x, + typename _Container::iterator(__i)); + } + + // @} group iterators + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // This iterator adapter is @a normal in the sense that it does not + // change the semantics of any of the operators of its iterator + // parameter. Its primary purpose is to convert an iterator that is + // not a class, e.g. a pointer, into an iterator that is a class. + // The _Container parameter exists solely so that different containers + // using this template can instantiate different types, even if the + // _Iterator parameter is the same. + using std::iterator_traits; + using std::iterator; + template + class __normal_iterator + { + protected: + _Iterator _M_current; + + typedef iterator_traits<_Iterator> __traits_type; + + public: + typedef _Iterator iterator_type; + typedef typename __traits_type::iterator_category iterator_category; + typedef typename __traits_type::value_type value_type; + typedef typename __traits_type::difference_type difference_type; + typedef typename __traits_type::reference reference; + typedef typename __traits_type::pointer pointer; + + _GLIBCXX_CONSTEXPR __normal_iterator() _GLIBCXX_NOEXCEPT + : _M_current(_Iterator()) { } + + explicit + __normal_iterator(const _Iterator& __i) _GLIBCXX_NOEXCEPT + : _M_current(__i) { } + + // Allow iterator to const_iterator conversion + template + __normal_iterator(const __normal_iterator<_Iter, + typename __enable_if< + (std::__are_same<_Iter, typename _Container::pointer>::__value), + _Container>::__type>& __i) _GLIBCXX_NOEXCEPT + : _M_current(__i.base()) { } + + // Forward iterator requirements + reference + operator*() const _GLIBCXX_NOEXCEPT + { return *_M_current; } + + pointer + operator->() const _GLIBCXX_NOEXCEPT + { return _M_current; } + + __normal_iterator& + operator++() _GLIBCXX_NOEXCEPT + { + ++_M_current; + return *this; + } + + __normal_iterator + operator++(int) _GLIBCXX_NOEXCEPT + { return __normal_iterator(_M_current++); } + + // Bidirectional iterator requirements + __normal_iterator& + operator--() _GLIBCXX_NOEXCEPT + { + --_M_current; + return *this; + } + + __normal_iterator + operator--(int) _GLIBCXX_NOEXCEPT + { return __normal_iterator(_M_current--); } + + // Random access iterator requirements + reference + operator[](difference_type __n) const _GLIBCXX_NOEXCEPT + { return _M_current[__n]; } + + __normal_iterator& + operator+=(difference_type __n) _GLIBCXX_NOEXCEPT + { _M_current += __n; return *this; } + + __normal_iterator + operator+(difference_type __n) const _GLIBCXX_NOEXCEPT + { return __normal_iterator(_M_current + __n); } + + __normal_iterator& + operator-=(difference_type __n) _GLIBCXX_NOEXCEPT + { _M_current -= __n; return *this; } + + __normal_iterator + operator-(difference_type __n) const _GLIBCXX_NOEXCEPT + { return __normal_iterator(_M_current - __n); } + + const _Iterator& + base() const _GLIBCXX_NOEXCEPT + { return _M_current; } + }; + + // Note: In what follows, the left- and right-hand-side iterators are + // allowed to vary in types (conceptually in cv-qualification) so that + // comparison between cv-qualified and non-cv-qualified iterators be + // valid. However, the greedy and unfriendly operators in std::rel_ops + // will make overload resolution ambiguous (when in scope) if we don't + // provide overloads whose operands are of the same type. Can someone + // remind me what generic programming is about? -- Gaby + + // Forward iterator requirements + template + inline bool + operator==(const __normal_iterator<_IteratorL, _Container>& __lhs, + const __normal_iterator<_IteratorR, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() == __rhs.base(); } + + template + inline bool + operator==(const __normal_iterator<_Iterator, _Container>& __lhs, + const __normal_iterator<_Iterator, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() == __rhs.base(); } + + template + inline bool + operator!=(const __normal_iterator<_IteratorL, _Container>& __lhs, + const __normal_iterator<_IteratorR, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() != __rhs.base(); } + + template + inline bool + operator!=(const __normal_iterator<_Iterator, _Container>& __lhs, + const __normal_iterator<_Iterator, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() != __rhs.base(); } + + // Random access iterator requirements + template + inline bool + operator<(const __normal_iterator<_IteratorL, _Container>& __lhs, + const __normal_iterator<_IteratorR, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() < __rhs.base(); } + + template + inline bool + operator<(const __normal_iterator<_Iterator, _Container>& __lhs, + const __normal_iterator<_Iterator, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() < __rhs.base(); } + + template + inline bool + operator>(const __normal_iterator<_IteratorL, _Container>& __lhs, + const __normal_iterator<_IteratorR, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() > __rhs.base(); } + + template + inline bool + operator>(const __normal_iterator<_Iterator, _Container>& __lhs, + const __normal_iterator<_Iterator, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() > __rhs.base(); } + + template + inline bool + operator<=(const __normal_iterator<_IteratorL, _Container>& __lhs, + const __normal_iterator<_IteratorR, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() <= __rhs.base(); } + + template + inline bool + operator<=(const __normal_iterator<_Iterator, _Container>& __lhs, + const __normal_iterator<_Iterator, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() <= __rhs.base(); } + + template + inline bool + operator>=(const __normal_iterator<_IteratorL, _Container>& __lhs, + const __normal_iterator<_IteratorR, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() >= __rhs.base(); } + + template + inline bool + operator>=(const __normal_iterator<_Iterator, _Container>& __lhs, + const __normal_iterator<_Iterator, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() >= __rhs.base(); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // According to the resolution of DR179 not only the various comparison + // operators but also operator- must accept mixed iterator/const_iterator + // parameters. + template +#if __cplusplus >= 201103L + // DR 685. + inline auto + operator-(const __normal_iterator<_IteratorL, _Container>& __lhs, + const __normal_iterator<_IteratorR, _Container>& __rhs) noexcept + -> decltype(__lhs.base() - __rhs.base()) +#else + inline typename __normal_iterator<_IteratorL, _Container>::difference_type + operator-(const __normal_iterator<_IteratorL, _Container>& __lhs, + const __normal_iterator<_IteratorR, _Container>& __rhs) +#endif + { return __lhs.base() - __rhs.base(); } + + template + inline typename __normal_iterator<_Iterator, _Container>::difference_type + operator-(const __normal_iterator<_Iterator, _Container>& __lhs, + const __normal_iterator<_Iterator, _Container>& __rhs) + _GLIBCXX_NOEXCEPT + { return __lhs.base() - __rhs.base(); } + + template + inline __normal_iterator<_Iterator, _Container> + operator+(typename __normal_iterator<_Iterator, _Container>::difference_type + __n, const __normal_iterator<_Iterator, _Container>& __i) + _GLIBCXX_NOEXCEPT + { return __normal_iterator<_Iterator, _Container>(__i.base() + __n); } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + _Iterator + __niter_base(__gnu_cxx::__normal_iterator<_Iterator, _Container> __it) + { return __it.base(); } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#if __cplusplus >= 201103L + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup iterators + * @{ + */ + + // 24.4.3 Move iterators + /** + * Class template move_iterator is an iterator adapter with the same + * behavior as the underlying iterator except that its dereference + * operator implicitly converts the value returned by the underlying + * iterator's dereference operator to an rvalue reference. Some + * generic algorithms can be called with move iterators to replace + * copying with moving. + */ + template + class move_iterator + { + protected: + _Iterator _M_current; + + typedef iterator_traits<_Iterator> __traits_type; + typedef typename __traits_type::reference __base_ref; + + public: + typedef _Iterator iterator_type; + typedef typename __traits_type::iterator_category iterator_category; + typedef typename __traits_type::value_type value_type; + typedef typename __traits_type::difference_type difference_type; + // NB: DR 680. + typedef _Iterator pointer; + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2106. move_iterator wrapping iterators returning prvalues + typedef typename conditional::value, + typename remove_reference<__base_ref>::type&&, + __base_ref>::type reference; + + _GLIBCXX17_CONSTEXPR + move_iterator() + : _M_current() { } + + explicit _GLIBCXX17_CONSTEXPR + move_iterator(iterator_type __i) + : _M_current(__i) { } + + template + _GLIBCXX17_CONSTEXPR + move_iterator(const move_iterator<_Iter>& __i) + : _M_current(__i.base()) { } + + _GLIBCXX17_CONSTEXPR iterator_type + base() const + { return _M_current; } + + _GLIBCXX17_CONSTEXPR reference + operator*() const + { return static_cast(*_M_current); } + + _GLIBCXX17_CONSTEXPR pointer + operator->() const + { return _M_current; } + + _GLIBCXX17_CONSTEXPR move_iterator& + operator++() + { + ++_M_current; + return *this; + } + + _GLIBCXX17_CONSTEXPR move_iterator + operator++(int) + { + move_iterator __tmp = *this; + ++_M_current; + return __tmp; + } + + _GLIBCXX17_CONSTEXPR move_iterator& + operator--() + { + --_M_current; + return *this; + } + + _GLIBCXX17_CONSTEXPR move_iterator + operator--(int) + { + move_iterator __tmp = *this; + --_M_current; + return __tmp; + } + + _GLIBCXX17_CONSTEXPR move_iterator + operator+(difference_type __n) const + { return move_iterator(_M_current + __n); } + + _GLIBCXX17_CONSTEXPR move_iterator& + operator+=(difference_type __n) + { + _M_current += __n; + return *this; + } + + _GLIBCXX17_CONSTEXPR move_iterator + operator-(difference_type __n) const + { return move_iterator(_M_current - __n); } + + _GLIBCXX17_CONSTEXPR move_iterator& + operator-=(difference_type __n) + { + _M_current -= __n; + return *this; + } + + _GLIBCXX17_CONSTEXPR reference + operator[](difference_type __n) const + { return std::move(_M_current[__n]); } + }; + + // Note: See __normal_iterator operators note from Gaby to understand + // why there are always 2 versions for most of the move_iterator + // operators. + template + inline _GLIBCXX17_CONSTEXPR bool + operator==(const move_iterator<_IteratorL>& __x, + const move_iterator<_IteratorR>& __y) + { return __x.base() == __y.base(); } + + template + inline _GLIBCXX17_CONSTEXPR bool + operator==(const move_iterator<_Iterator>& __x, + const move_iterator<_Iterator>& __y) + { return __x.base() == __y.base(); } + + template + inline _GLIBCXX17_CONSTEXPR bool + operator!=(const move_iterator<_IteratorL>& __x, + const move_iterator<_IteratorR>& __y) + { return !(__x == __y); } + + template + inline _GLIBCXX17_CONSTEXPR bool + operator!=(const move_iterator<_Iterator>& __x, + const move_iterator<_Iterator>& __y) + { return !(__x == __y); } + + template + inline _GLIBCXX17_CONSTEXPR bool + operator<(const move_iterator<_IteratorL>& __x, + const move_iterator<_IteratorR>& __y) + { return __x.base() < __y.base(); } + + template + inline _GLIBCXX17_CONSTEXPR bool + operator<(const move_iterator<_Iterator>& __x, + const move_iterator<_Iterator>& __y) + { return __x.base() < __y.base(); } + + template + inline _GLIBCXX17_CONSTEXPR bool + operator<=(const move_iterator<_IteratorL>& __x, + const move_iterator<_IteratorR>& __y) + { return !(__y < __x); } + + template + inline _GLIBCXX17_CONSTEXPR bool + operator<=(const move_iterator<_Iterator>& __x, + const move_iterator<_Iterator>& __y) + { return !(__y < __x); } + + template + inline _GLIBCXX17_CONSTEXPR bool + operator>(const move_iterator<_IteratorL>& __x, + const move_iterator<_IteratorR>& __y) + { return __y < __x; } + + template + inline _GLIBCXX17_CONSTEXPR bool + operator>(const move_iterator<_Iterator>& __x, + const move_iterator<_Iterator>& __y) + { return __y < __x; } + + template + inline _GLIBCXX17_CONSTEXPR bool + operator>=(const move_iterator<_IteratorL>& __x, + const move_iterator<_IteratorR>& __y) + { return !(__x < __y); } + + template + inline _GLIBCXX17_CONSTEXPR bool + operator>=(const move_iterator<_Iterator>& __x, + const move_iterator<_Iterator>& __y) + { return !(__x < __y); } + + // DR 685. + template + inline _GLIBCXX17_CONSTEXPR auto + operator-(const move_iterator<_IteratorL>& __x, + const move_iterator<_IteratorR>& __y) + -> decltype(__x.base() - __y.base()) + { return __x.base() - __y.base(); } + + template + inline _GLIBCXX17_CONSTEXPR move_iterator<_Iterator> + operator+(typename move_iterator<_Iterator>::difference_type __n, + const move_iterator<_Iterator>& __x) + { return __x + __n; } + + template + inline _GLIBCXX17_CONSTEXPR move_iterator<_Iterator> + make_move_iterator(_Iterator __i) + { return move_iterator<_Iterator>(__i); } + + template::value_type>::value, + _Iterator, move_iterator<_Iterator>>::type> + inline _GLIBCXX17_CONSTEXPR _ReturnType + __make_move_if_noexcept_iterator(_Iterator __i) + { return _ReturnType(__i); } + + // Overload for pointers that matches std::move_if_noexcept more closely, + // returning a constant iterator when we don't want to move. + template::value, + const _Tp*, move_iterator<_Tp*>>::type> + inline _GLIBCXX17_CONSTEXPR _ReturnType + __make_move_if_noexcept_iterator(_Tp* __i) + { return _ReturnType(__i); } + + // @} group iterators + + template + auto + __niter_base(move_iterator<_Iterator> __it) + -> decltype(make_move_iterator(__niter_base(__it.base()))) + { return make_move_iterator(__niter_base(__it.base())); } + + template + struct __is_move_iterator > + { + enum { __value = 1 }; + typedef __true_type __type; + }; + + template + auto + __miter_base(move_iterator<_Iterator> __it) + -> decltype(__miter_base(__it.base())) + { return __miter_base(__it.base()); } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#define _GLIBCXX_MAKE_MOVE_ITERATOR(_Iter) std::make_move_iterator(_Iter) +#define _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(_Iter) \ + std::__make_move_if_noexcept_iterator(_Iter) +#else +#define _GLIBCXX_MAKE_MOVE_ITERATOR(_Iter) (_Iter) +#define _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(_Iter) (_Iter) +#endif // C++11 + +#ifdef _GLIBCXX_DEBUG +# include +#endif + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_iterator_base_funcs.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_iterator_base_funcs.h new file mode 100644 index 0000000..ce6c3d2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_iterator_base_funcs.h @@ -0,0 +1,235 @@ +// Functions used by iterators -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_iterator_base_funcs.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iterator} + * + * This file contains all of the general iterator-related utility + * functions, such as distance() and advance(). + */ + +#ifndef _STL_ITERATOR_BASE_FUNCS_H +#define _STL_ITERATOR_BASE_FUNCS_H 1 + +#pragma GCC system_header + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_CONTAINER + // Forward declaration for the overloads of __distance. + template struct _List_iterator; + template struct _List_const_iterator; +_GLIBCXX_END_NAMESPACE_CONTAINER + +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + inline _GLIBCXX14_CONSTEXPR + typename iterator_traits<_InputIterator>::difference_type + __distance(_InputIterator __first, _InputIterator __last, + input_iterator_tag) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + + typename iterator_traits<_InputIterator>::difference_type __n = 0; + while (__first != __last) + { + ++__first; + ++__n; + } + return __n; + } + + template + inline _GLIBCXX14_CONSTEXPR + typename iterator_traits<_RandomAccessIterator>::difference_type + __distance(_RandomAccessIterator __first, _RandomAccessIterator __last, + random_access_iterator_tag) + { + // concept requirements + __glibcxx_function_requires(_RandomAccessIteratorConcept< + _RandomAccessIterator>) + return __last - __first; + } + +#if _GLIBCXX_USE_CXX11_ABI + // Forward declaration because of the qualified call in distance. + template + ptrdiff_t + __distance(_GLIBCXX_STD_C::_List_iterator<_Tp>, + _GLIBCXX_STD_C::_List_iterator<_Tp>, + input_iterator_tag); + + template + ptrdiff_t + __distance(_GLIBCXX_STD_C::_List_const_iterator<_Tp>, + _GLIBCXX_STD_C::_List_const_iterator<_Tp>, + input_iterator_tag); +#endif + + /** + * @brief A generalization of pointer arithmetic. + * @param __first An input iterator. + * @param __last An input iterator. + * @return The distance between them. + * + * Returns @c n such that __first + n == __last. This requires + * that @p __last must be reachable from @p __first. Note that @c + * n may be negative. + * + * For random access iterators, this uses their @c + and @c - operations + * and are constant time. For other %iterator classes they are linear time. + */ + template + inline _GLIBCXX17_CONSTEXPR + typename iterator_traits<_InputIterator>::difference_type + distance(_InputIterator __first, _InputIterator __last) + { + // concept requirements -- taken care of in __distance + return std::__distance(__first, __last, + std::__iterator_category(__first)); + } + + template + inline _GLIBCXX14_CONSTEXPR void + __advance(_InputIterator& __i, _Distance __n, input_iterator_tag) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_assert(__n >= 0); + while (__n--) + ++__i; + } + + template + inline _GLIBCXX14_CONSTEXPR void + __advance(_BidirectionalIterator& __i, _Distance __n, + bidirectional_iterator_tag) + { + // concept requirements + __glibcxx_function_requires(_BidirectionalIteratorConcept< + _BidirectionalIterator>) + if (__n > 0) + while (__n--) + ++__i; + else + while (__n++) + --__i; + } + + template + inline _GLIBCXX14_CONSTEXPR void + __advance(_RandomAccessIterator& __i, _Distance __n, + random_access_iterator_tag) + { + // concept requirements + __glibcxx_function_requires(_RandomAccessIteratorConcept< + _RandomAccessIterator>) + __i += __n; + } + + /** + * @brief A generalization of pointer arithmetic. + * @param __i An input iterator. + * @param __n The @a delta by which to change @p __i. + * @return Nothing. + * + * This increments @p i by @p n. For bidirectional and random access + * iterators, @p __n may be negative, in which case @p __i is decremented. + * + * For random access iterators, this uses their @c + and @c - operations + * and are constant time. For other %iterator classes they are linear time. + */ + template + inline _GLIBCXX17_CONSTEXPR void + advance(_InputIterator& __i, _Distance __n) + { + // concept requirements -- taken care of in __advance + typename iterator_traits<_InputIterator>::difference_type __d = __n; + std::__advance(__i, __d, std::__iterator_category(__i)); + } + +#if __cplusplus >= 201103L + + template + inline _GLIBCXX17_CONSTEXPR _ForwardIterator + next(_ForwardIterator __x, typename + iterator_traits<_ForwardIterator>::difference_type __n = 1) + { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept< + _ForwardIterator>) + std::advance(__x, __n); + return __x; + } + + template + inline _GLIBCXX17_CONSTEXPR _BidirectionalIterator + prev(_BidirectionalIterator __x, typename + iterator_traits<_BidirectionalIterator>::difference_type __n = 1) + { + // concept requirements + __glibcxx_function_requires(_BidirectionalIteratorConcept< + _BidirectionalIterator>) + std::advance(__x, -__n); + return __x; + } + +#endif // C++11 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _STL_ITERATOR_BASE_FUNCS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_iterator_base_types.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_iterator_base_types.h new file mode 100644 index 0000000..d2c36ed --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_iterator_base_types.h @@ -0,0 +1,242 @@ +// Types used in iterator implementation -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_iterator_base_types.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iterator} + * + * This file contains all of the general iterator-related utility types, + * such as iterator_traits and struct iterator. + */ + +#ifndef _STL_ITERATOR_BASE_TYPES_H +#define _STL_ITERATOR_BASE_TYPES_H 1 + +#pragma GCC system_header + +#include + +#if __cplusplus >= 201103L +# include // For __void_t, is_convertible +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @defgroup iterators Iterators + * Abstractions for uniform iterating through various underlying types. + */ + //@{ + + /** + * @defgroup iterator_tags Iterator Tags + * These are empty types, used to distinguish different iterators. The + * distinction is not made by what they contain, but simply by what they + * are. Different underlying algorithms can then be used based on the + * different operations supported by different iterator types. + */ + //@{ + /// Marking input iterators. + struct input_iterator_tag { }; + + /// Marking output iterators. + struct output_iterator_tag { }; + + /// Forward iterators support a superset of input iterator operations. + struct forward_iterator_tag : public input_iterator_tag { }; + + /// Bidirectional iterators support a superset of forward iterator + /// operations. + struct bidirectional_iterator_tag : public forward_iterator_tag { }; + + /// Random-access iterators support a superset of bidirectional + /// iterator operations. + struct random_access_iterator_tag : public bidirectional_iterator_tag { }; + //@} + + /** + * @brief Common %iterator class. + * + * This class does nothing but define nested typedefs. %Iterator classes + * can inherit from this class to save some work. The typedefs are then + * used in specializations and overloading. + * + * In particular, there are no default implementations of requirements + * such as @c operator++ and the like. (How could there be?) + */ + template + struct iterator + { + /// One of the @link iterator_tags tag types@endlink. + typedef _Category iterator_category; + /// The type "pointed to" by the iterator. + typedef _Tp value_type; + /// Distance between iterators is represented as this type. + typedef _Distance difference_type; + /// This type represents a pointer-to-value_type. + typedef _Pointer pointer; + /// This type represents a reference-to-value_type. + typedef _Reference reference; + }; + + /** + * @brief Traits class for iterators. + * + * This class does nothing but define nested typedefs. The general + * version simply @a forwards the nested typedefs from the Iterator + * argument. Specialized versions for pointers and pointers-to-const + * provide tighter, more correct semantics. + */ +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2408. SFINAE-friendly common_type/iterator_traits is missing in C++14 + template> + struct __iterator_traits { }; + + template + struct __iterator_traits<_Iterator, + __void_t> + { + typedef typename _Iterator::iterator_category iterator_category; + typedef typename _Iterator::value_type value_type; + typedef typename _Iterator::difference_type difference_type; + typedef typename _Iterator::pointer pointer; + typedef typename _Iterator::reference reference; + }; + + template + struct iterator_traits + : public __iterator_traits<_Iterator> { }; +#else + template + struct iterator_traits + { + typedef typename _Iterator::iterator_category iterator_category; + typedef typename _Iterator::value_type value_type; + typedef typename _Iterator::difference_type difference_type; + typedef typename _Iterator::pointer pointer; + typedef typename _Iterator::reference reference; + }; +#endif + + /// Partial specialization for pointer types. + template + struct iterator_traits<_Tp*> + { + typedef random_access_iterator_tag iterator_category; + typedef _Tp value_type; + typedef ptrdiff_t difference_type; + typedef _Tp* pointer; + typedef _Tp& reference; + }; + + /// Partial specialization for const pointer types. + template + struct iterator_traits + { + typedef random_access_iterator_tag iterator_category; + typedef _Tp value_type; + typedef ptrdiff_t difference_type; + typedef const _Tp* pointer; + typedef const _Tp& reference; + }; + + /** + * This function is not a part of the C++ standard but is syntactic + * sugar for internal library use only. + */ + template + inline _GLIBCXX_CONSTEXPR + typename iterator_traits<_Iter>::iterator_category + __iterator_category(const _Iter&) + { return typename iterator_traits<_Iter>::iterator_category(); } + + //@} + +#if __cplusplus < 201103L + // If _Iterator has a base returns it otherwise _Iterator is returned + // untouched + template + struct _Iter_base + { + typedef _Iterator iterator_type; + static iterator_type _S_base(_Iterator __it) + { return __it; } + }; + + template + struct _Iter_base<_Iterator, true> + { + typedef typename _Iterator::iterator_type iterator_type; + static iterator_type _S_base(_Iterator __it) + { return __it.base(); } + }; +#endif + +#if __cplusplus >= 201103L + template + using _RequireInputIter = typename + enable_if::iterator_category, + input_iterator_tag>::value>::type; +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _STL_ITERATOR_BASE_TYPES_H */ + diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_list.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_list.h new file mode 100644 index 0000000..0420dbf --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_list.h @@ -0,0 +1,1995 @@ +// List implementation -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_list.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{list} + */ + +#ifndef _STL_LIST_H +#define _STL_LIST_H 1 + +#include +#include +#if __cplusplus >= 201103L +#include +#include +#include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ + namespace __detail + { + _GLIBCXX_BEGIN_NAMESPACE_VERSION + + // Supporting structures are split into common and templated + // types; the latter publicly inherits from the former in an + // effort to reduce code duplication. This results in some + // "needless" static_cast'ing later on, but it's all safe + // downcasting. + + /// Common part of a node in the %list. + struct _List_node_base + { + _List_node_base* _M_next; + _List_node_base* _M_prev; + + static void + swap(_List_node_base& __x, _List_node_base& __y) _GLIBCXX_USE_NOEXCEPT; + + void + _M_transfer(_List_node_base* const __first, + _List_node_base* const __last) _GLIBCXX_USE_NOEXCEPT; + + void + _M_reverse() _GLIBCXX_USE_NOEXCEPT; + + void + _M_hook(_List_node_base* const __position) _GLIBCXX_USE_NOEXCEPT; + + void + _M_unhook() _GLIBCXX_USE_NOEXCEPT; + }; + + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace detail + +_GLIBCXX_BEGIN_NAMESPACE_CONTAINER + + /// An actual node in the %list. + template + struct _List_node : public __detail::_List_node_base + { +#if __cplusplus >= 201103L + __gnu_cxx::__aligned_membuf<_Tp> _M_storage; + _Tp* _M_valptr() { return _M_storage._M_ptr(); } + _Tp const* _M_valptr() const { return _M_storage._M_ptr(); } +#else + _Tp _M_data; + _Tp* _M_valptr() { return std::__addressof(_M_data); } + _Tp const* _M_valptr() const { return std::__addressof(_M_data); } +#endif + }; + + /** + * @brief A list::iterator. + * + * All the functions are op overloads. + */ + template + struct _List_iterator + { + typedef _List_iterator<_Tp> _Self; + typedef _List_node<_Tp> _Node; + + typedef ptrdiff_t difference_type; + typedef std::bidirectional_iterator_tag iterator_category; + typedef _Tp value_type; + typedef _Tp* pointer; + typedef _Tp& reference; + + _List_iterator() _GLIBCXX_NOEXCEPT + : _M_node() { } + + explicit + _List_iterator(__detail::_List_node_base* __x) _GLIBCXX_NOEXCEPT + : _M_node(__x) { } + + _Self + _M_const_cast() const _GLIBCXX_NOEXCEPT + { return *this; } + + // Must downcast from _List_node_base to _List_node to get to value. + reference + operator*() const _GLIBCXX_NOEXCEPT + { return *static_cast<_Node*>(_M_node)->_M_valptr(); } + + pointer + operator->() const _GLIBCXX_NOEXCEPT + { return static_cast<_Node*>(_M_node)->_M_valptr(); } + + _Self& + operator++() _GLIBCXX_NOEXCEPT + { + _M_node = _M_node->_M_next; + return *this; + } + + _Self + operator++(int) _GLIBCXX_NOEXCEPT + { + _Self __tmp = *this; + _M_node = _M_node->_M_next; + return __tmp; + } + + _Self& + operator--() _GLIBCXX_NOEXCEPT + { + _M_node = _M_node->_M_prev; + return *this; + } + + _Self + operator--(int) _GLIBCXX_NOEXCEPT + { + _Self __tmp = *this; + _M_node = _M_node->_M_prev; + return __tmp; + } + + bool + operator==(const _Self& __x) const _GLIBCXX_NOEXCEPT + { return _M_node == __x._M_node; } + + bool + operator!=(const _Self& __x) const _GLIBCXX_NOEXCEPT + { return _M_node != __x._M_node; } + + // The only member points to the %list element. + __detail::_List_node_base* _M_node; + }; + + /** + * @brief A list::const_iterator. + * + * All the functions are op overloads. + */ + template + struct _List_const_iterator + { + typedef _List_const_iterator<_Tp> _Self; + typedef const _List_node<_Tp> _Node; + typedef _List_iterator<_Tp> iterator; + + typedef ptrdiff_t difference_type; + typedef std::bidirectional_iterator_tag iterator_category; + typedef _Tp value_type; + typedef const _Tp* pointer; + typedef const _Tp& reference; + + _List_const_iterator() _GLIBCXX_NOEXCEPT + : _M_node() { } + + explicit + _List_const_iterator(const __detail::_List_node_base* __x) + _GLIBCXX_NOEXCEPT + : _M_node(__x) { } + + _List_const_iterator(const iterator& __x) _GLIBCXX_NOEXCEPT + : _M_node(__x._M_node) { } + + iterator + _M_const_cast() const _GLIBCXX_NOEXCEPT + { return iterator(const_cast<__detail::_List_node_base*>(_M_node)); } + + // Must downcast from List_node_base to _List_node to get to value. + reference + operator*() const _GLIBCXX_NOEXCEPT + { return *static_cast<_Node*>(_M_node)->_M_valptr(); } + + pointer + operator->() const _GLIBCXX_NOEXCEPT + { return static_cast<_Node*>(_M_node)->_M_valptr(); } + + _Self& + operator++() _GLIBCXX_NOEXCEPT + { + _M_node = _M_node->_M_next; + return *this; + } + + _Self + operator++(int) _GLIBCXX_NOEXCEPT + { + _Self __tmp = *this; + _M_node = _M_node->_M_next; + return __tmp; + } + + _Self& + operator--() _GLIBCXX_NOEXCEPT + { + _M_node = _M_node->_M_prev; + return *this; + } + + _Self + operator--(int) _GLIBCXX_NOEXCEPT + { + _Self __tmp = *this; + _M_node = _M_node->_M_prev; + return __tmp; + } + + bool + operator==(const _Self& __x) const _GLIBCXX_NOEXCEPT + { return _M_node == __x._M_node; } + + bool + operator!=(const _Self& __x) const _GLIBCXX_NOEXCEPT + { return _M_node != __x._M_node; } + + // The only member points to the %list element. + const __detail::_List_node_base* _M_node; + }; + + template + inline bool + operator==(const _List_iterator<_Val>& __x, + const _List_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT + { return __x._M_node == __y._M_node; } + + template + inline bool + operator!=(const _List_iterator<_Val>& __x, + const _List_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT + { return __x._M_node != __y._M_node; } + +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + /// See bits/stl_deque.h's _Deque_base for an explanation. + template + class _List_base + { + protected: + typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template + rebind<_Tp>::other _Tp_alloc_type; + typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Tp_alloc_traits; + typedef typename _Tp_alloc_traits::template + rebind<_List_node<_Tp> >::other _Node_alloc_type; + typedef __gnu_cxx::__alloc_traits<_Node_alloc_type> _Node_alloc_traits; + + static size_t + _S_distance(const __detail::_List_node_base* __first, + const __detail::_List_node_base* __last) + { + size_t __n = 0; + while (__first != __last) + { + __first = __first->_M_next; + ++__n; + } + return __n; + } + + struct _List_impl + : public _Node_alloc_type + { +#if _GLIBCXX_USE_CXX11_ABI + _List_node _M_node; +#else + __detail::_List_node_base _M_node; +#endif + + _List_impl() _GLIBCXX_NOEXCEPT + : _Node_alloc_type(), _M_node() + { } + + _List_impl(const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT + : _Node_alloc_type(__a), _M_node() + { } + +#if __cplusplus >= 201103L + _List_impl(_Node_alloc_type&& __a) noexcept + : _Node_alloc_type(std::move(__a)), _M_node() + { } +#endif + }; + + _List_impl _M_impl; + +#if _GLIBCXX_USE_CXX11_ABI + size_t _M_get_size() const { return *_M_impl._M_node._M_valptr(); } + + void _M_set_size(size_t __n) { *_M_impl._M_node._M_valptr() = __n; } + + void _M_inc_size(size_t __n) { *_M_impl._M_node._M_valptr() += __n; } + + void _M_dec_size(size_t __n) { *_M_impl._M_node._M_valptr() -= __n; } + + size_t + _M_distance(const __detail::_List_node_base* __first, + const __detail::_List_node_base* __last) const + { return _S_distance(__first, __last); } + + // return the stored size + size_t _M_node_count() const { return *_M_impl._M_node._M_valptr(); } +#else + // dummy implementations used when the size is not stored + size_t _M_get_size() const { return 0; } + void _M_set_size(size_t) { } + void _M_inc_size(size_t) { } + void _M_dec_size(size_t) { } + size_t _M_distance(const void*, const void*) const { return 0; } + + // count the number of nodes + size_t _M_node_count() const + { + return _S_distance(_M_impl._M_node._M_next, + std::__addressof(_M_impl._M_node)); + } +#endif + + typename _Node_alloc_traits::pointer + _M_get_node() + { return _Node_alloc_traits::allocate(_M_impl, 1); } + + void + _M_put_node(typename _Node_alloc_traits::pointer __p) _GLIBCXX_NOEXCEPT + { _Node_alloc_traits::deallocate(_M_impl, __p, 1); } + + public: + typedef _Alloc allocator_type; + + _Node_alloc_type& + _M_get_Node_allocator() _GLIBCXX_NOEXCEPT + { return _M_impl; } + + const _Node_alloc_type& + _M_get_Node_allocator() const _GLIBCXX_NOEXCEPT + { return _M_impl; } + + _List_base() + : _M_impl() + { _M_init(); } + + _List_base(const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT + : _M_impl(__a) + { _M_init(); } + +#if __cplusplus >= 201103L + _List_base(_List_base&& __x) noexcept + : _M_impl(std::move(__x._M_get_Node_allocator())) + { _M_move_nodes(std::move(__x)); } + + _List_base(_List_base&& __x, _Node_alloc_type&& __a) + : _M_impl(std::move(__a)) + { + if (__x._M_get_Node_allocator() == _M_get_Node_allocator()) + _M_move_nodes(std::move(__x)); + else + _M_init(); // Caller must move individual elements. + } + + void + _M_move_nodes(_List_base&& __x) + { + auto* const __xnode = std::__addressof(__x._M_impl._M_node); + if (__xnode->_M_next == __xnode) + _M_init(); + else + { + auto* const __node = std::__addressof(_M_impl._M_node); + __node->_M_next = __xnode->_M_next; + __node->_M_prev = __xnode->_M_prev; + __node->_M_next->_M_prev = __node->_M_prev->_M_next = __node; + _M_set_size(__x._M_get_size()); + __x._M_init(); + } + } +#endif + + // This is what actually destroys the list. + ~_List_base() _GLIBCXX_NOEXCEPT + { _M_clear(); } + + void + _M_clear() _GLIBCXX_NOEXCEPT; + + void + _M_init() _GLIBCXX_NOEXCEPT + { + this->_M_impl._M_node._M_next = &this->_M_impl._M_node; + this->_M_impl._M_node._M_prev = &this->_M_impl._M_node; + _M_set_size(0); + } + }; + + /** + * @brief A standard container with linear time access to elements, + * and fixed time insertion/deletion at any point in the sequence. + * + * @ingroup sequences + * + * @tparam _Tp Type of element. + * @tparam _Alloc Allocator type, defaults to allocator<_Tp>. + * + * Meets the requirements of a container, a + * reversible container, and a + * sequence, including the + * optional sequence requirements with the + * %exception of @c at and @c operator[]. + * + * This is a @e doubly @e linked %list. Traversal up and down the + * %list requires linear time, but adding and removing elements (or + * @e nodes) is done in constant time, regardless of where the + * change takes place. Unlike std::vector and std::deque, + * random-access iterators are not provided, so subscripting ( @c + * [] ) access is not allowed. For algorithms which only need + * sequential access, this lack makes no difference. + * + * Also unlike the other standard containers, std::list provides + * specialized algorithms %unique to linked lists, such as + * splicing, sorting, and in-place reversal. + * + * A couple points on memory allocation for list: + * + * First, we never actually allocate a Tp, we allocate + * List_node's and trust [20.1.5]/4 to DTRT. This is to ensure + * that after elements from %list are spliced into + * %list, destroying the memory of the second %list is a + * valid operation, i.e., Alloc1 giveth and Alloc2 taketh away. + * + * Second, a %list conceptually represented as + * @code + * A <---> B <---> C <---> D + * @endcode + * is actually circular; a link exists between A and D. The %list + * class holds (as its only data member) a private list::iterator + * pointing to @e D, not to @e A! To get to the head of the %list, + * we start at the tail and move forward by one. When this member + * iterator's next/previous pointers refer to itself, the %list is + * %empty. + */ + template > + class list : protected _List_base<_Tp, _Alloc> + { +#ifdef _GLIBCXX_CONCEPT_CHECKS + // concept requirements + typedef typename _Alloc::value_type _Alloc_value_type; +# if __cplusplus < 201103L + __glibcxx_class_requires(_Tp, _SGIAssignableConcept) +# endif + __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept) +#endif + + typedef _List_base<_Tp, _Alloc> _Base; + typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; + typedef typename _Base::_Tp_alloc_traits _Tp_alloc_traits; + typedef typename _Base::_Node_alloc_type _Node_alloc_type; + typedef typename _Base::_Node_alloc_traits _Node_alloc_traits; + + public: + typedef _Tp value_type; + typedef typename _Tp_alloc_traits::pointer pointer; + typedef typename _Tp_alloc_traits::const_pointer const_pointer; + typedef typename _Tp_alloc_traits::reference reference; + typedef typename _Tp_alloc_traits::const_reference const_reference; + typedef _List_iterator<_Tp> iterator; + typedef _List_const_iterator<_Tp> const_iterator; + typedef std::reverse_iterator const_reverse_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Alloc allocator_type; + + protected: + // Note that pointers-to-_Node's can be ctor-converted to + // iterator types. + typedef _List_node<_Tp> _Node; + + using _Base::_M_impl; + using _Base::_M_put_node; + using _Base::_M_get_node; + using _Base::_M_get_Node_allocator; + + /** + * @param __args An instance of user data. + * + * Allocates space for a new node and constructs a copy of + * @a __args in it. + */ +#if __cplusplus < 201103L + _Node* + _M_create_node(const value_type& __x) + { + _Node* __p = this->_M_get_node(); + __try + { + _Tp_alloc_type __alloc(_M_get_Node_allocator()); + __alloc.construct(__p->_M_valptr(), __x); + } + __catch(...) + { + _M_put_node(__p); + __throw_exception_again; + } + return __p; + } +#else + template + _Node* + _M_create_node(_Args&&... __args) + { + auto __p = this->_M_get_node(); + auto& __alloc = _M_get_Node_allocator(); + __allocated_ptr<_Node_alloc_type> __guard{__alloc, __p}; + _Node_alloc_traits::construct(__alloc, __p->_M_valptr(), + std::forward<_Args>(__args)...); + __guard = nullptr; + return __p; + } +#endif + + public: + // [23.2.2.1] construct/copy/destroy + // (assign() and get_allocator() are also listed in this section) + + /** + * @brief Creates a %list with no elements. + */ + list() +#if __cplusplus >= 201103L + noexcept(is_nothrow_default_constructible<_Node_alloc_type>::value) +#endif + : _Base() { } + + /** + * @brief Creates a %list with no elements. + * @param __a An allocator object. + */ + explicit + list(const allocator_type& __a) _GLIBCXX_NOEXCEPT + : _Base(_Node_alloc_type(__a)) { } + +#if __cplusplus >= 201103L + /** + * @brief Creates a %list with default constructed elements. + * @param __n The number of elements to initially create. + * @param __a An allocator object. + * + * This constructor fills the %list with @a __n default + * constructed elements. + */ + explicit + list(size_type __n, const allocator_type& __a = allocator_type()) + : _Base(_Node_alloc_type(__a)) + { _M_default_initialize(__n); } + + /** + * @brief Creates a %list with copies of an exemplar element. + * @param __n The number of elements to initially create. + * @param __value An element to copy. + * @param __a An allocator object. + * + * This constructor fills the %list with @a __n copies of @a __value. + */ + list(size_type __n, const value_type& __value, + const allocator_type& __a = allocator_type()) + : _Base(_Node_alloc_type(__a)) + { _M_fill_initialize(__n, __value); } +#else + /** + * @brief Creates a %list with copies of an exemplar element. + * @param __n The number of elements to initially create. + * @param __value An element to copy. + * @param __a An allocator object. + * + * This constructor fills the %list with @a __n copies of @a __value. + */ + explicit + list(size_type __n, const value_type& __value = value_type(), + const allocator_type& __a = allocator_type()) + : _Base(_Node_alloc_type(__a)) + { _M_fill_initialize(__n, __value); } +#endif + + /** + * @brief %List copy constructor. + * @param __x A %list of identical element and allocator types. + * + * The newly-created %list uses a copy of the allocation object used + * by @a __x (unless the allocator traits dictate a different object). + */ + list(const list& __x) + : _Base(_Node_alloc_traits:: + _S_select_on_copy(__x._M_get_Node_allocator())) + { _M_initialize_dispatch(__x.begin(), __x.end(), __false_type()); } + +#if __cplusplus >= 201103L + /** + * @brief %List move constructor. + * @param __x A %list of identical element and allocator types. + * + * The newly-created %list contains the exact contents of @a __x. + * The contents of @a __x are a valid, but unspecified %list. + */ + list(list&& __x) noexcept + : _Base(std::move(__x)) { } + + /** + * @brief Builds a %list from an initializer_list + * @param __l An initializer_list of value_type. + * @param __a An allocator object. + * + * Create a %list consisting of copies of the elements in the + * initializer_list @a __l. This is linear in __l.size(). + */ + list(initializer_list __l, + const allocator_type& __a = allocator_type()) + : _Base(_Node_alloc_type(__a)) + { _M_initialize_dispatch(__l.begin(), __l.end(), __false_type()); } + + list(const list& __x, const allocator_type& __a) + : _Base(_Node_alloc_type(__a)) + { _M_initialize_dispatch(__x.begin(), __x.end(), __false_type()); } + + list(list&& __x, const allocator_type& __a) + noexcept(_Node_alloc_traits::_S_always_equal()) + : _Base(std::move(__x), _Node_alloc_type(__a)) + { + // If __x is not empty it means its allocator is not equal to __a, + // so we need to move from each element individually. + insert(begin(), std::__make_move_if_noexcept_iterator(__x.begin()), + std::__make_move_if_noexcept_iterator(__x.end())); + } +#endif + + /** + * @brief Builds a %list from a range. + * @param __first An input iterator. + * @param __last An input iterator. + * @param __a An allocator object. + * + * Create a %list consisting of copies of the elements from + * [@a __first,@a __last). This is linear in N (where N is + * distance(@a __first,@a __last)). + */ +#if __cplusplus >= 201103L + template> + list(_InputIterator __first, _InputIterator __last, + const allocator_type& __a = allocator_type()) + : _Base(_Node_alloc_type(__a)) + { _M_initialize_dispatch(__first, __last, __false_type()); } +#else + template + list(_InputIterator __first, _InputIterator __last, + const allocator_type& __a = allocator_type()) + : _Base(_Node_alloc_type(__a)) + { + // Check whether it's an integral type. If so, it's not an iterator. + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + _M_initialize_dispatch(__first, __last, _Integral()); + } +#endif + +#if __cplusplus >= 201103L + /** + * No explicit dtor needed as the _Base dtor takes care of + * things. The _Base dtor only erases the elements, and note + * that if the elements themselves are pointers, the pointed-to + * memory is not touched in any way. Managing the pointer is + * the user's responsibility. + */ + ~list() = default; +#endif + + /** + * @brief %List assignment operator. + * @param __x A %list of identical element and allocator types. + * + * All the elements of @a __x are copied. + * + * Whether the allocator is copied depends on the allocator traits. + */ + list& + operator=(const list& __x); + +#if __cplusplus >= 201103L + /** + * @brief %List move assignment operator. + * @param __x A %list of identical element and allocator types. + * + * The contents of @a __x are moved into this %list (without copying). + * + * Afterwards @a __x is a valid, but unspecified %list + * + * Whether the allocator is moved depends on the allocator traits. + */ + list& + operator=(list&& __x) + noexcept(_Node_alloc_traits::_S_nothrow_move()) + { + constexpr bool __move_storage = + _Node_alloc_traits::_S_propagate_on_move_assign() + || _Node_alloc_traits::_S_always_equal(); + _M_move_assign(std::move(__x), __bool_constant<__move_storage>()); + return *this; + } + + /** + * @brief %List initializer list assignment operator. + * @param __l An initializer_list of value_type. + * + * Replace the contents of the %list with copies of the elements + * in the initializer_list @a __l. This is linear in l.size(). + */ + list& + operator=(initializer_list __l) + { + this->assign(__l.begin(), __l.end()); + return *this; + } +#endif + + /** + * @brief Assigns a given value to a %list. + * @param __n Number of elements to be assigned. + * @param __val Value to be assigned. + * + * This function fills a %list with @a __n copies of the given + * value. Note that the assignment completely changes the %list + * and that the resulting %list's size is the same as the number + * of elements assigned. + */ + void + assign(size_type __n, const value_type& __val) + { _M_fill_assign(__n, __val); } + + /** + * @brief Assigns a range to a %list. + * @param __first An input iterator. + * @param __last An input iterator. + * + * This function fills a %list with copies of the elements in the + * range [@a __first,@a __last). + * + * Note that the assignment completely changes the %list and + * that the resulting %list's size is the same as the number of + * elements assigned. + */ +#if __cplusplus >= 201103L + template> + void + assign(_InputIterator __first, _InputIterator __last) + { _M_assign_dispatch(__first, __last, __false_type()); } +#else + template + void + assign(_InputIterator __first, _InputIterator __last) + { + // Check whether it's an integral type. If so, it's not an iterator. + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + _M_assign_dispatch(__first, __last, _Integral()); + } +#endif + +#if __cplusplus >= 201103L + /** + * @brief Assigns an initializer_list to a %list. + * @param __l An initializer_list of value_type. + * + * Replace the contents of the %list with copies of the elements + * in the initializer_list @a __l. This is linear in __l.size(). + */ + void + assign(initializer_list __l) + { this->_M_assign_dispatch(__l.begin(), __l.end(), __false_type()); } +#endif + + /// Get a copy of the memory allocation object. + allocator_type + get_allocator() const _GLIBCXX_NOEXCEPT + { return allocator_type(_Base::_M_get_Node_allocator()); } + + // iterators + /** + * Returns a read/write iterator that points to the first element in the + * %list. Iteration is done in ordinary element order. + */ + iterator + begin() _GLIBCXX_NOEXCEPT + { return iterator(this->_M_impl._M_node._M_next); } + + /** + * Returns a read-only (constant) iterator that points to the + * first element in the %list. Iteration is done in ordinary + * element order. + */ + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return const_iterator(this->_M_impl._M_node._M_next); } + + /** + * Returns a read/write iterator that points one past the last + * element in the %list. Iteration is done in ordinary element + * order. + */ + iterator + end() _GLIBCXX_NOEXCEPT + { return iterator(&this->_M_impl._M_node); } + + /** + * Returns a read-only (constant) iterator that points one past + * the last element in the %list. Iteration is done in ordinary + * element order. + */ + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return const_iterator(&this->_M_impl._M_node); } + + /** + * Returns a read/write reverse iterator that points to the last + * element in the %list. Iteration is done in reverse element + * order. + */ + reverse_iterator + rbegin() _GLIBCXX_NOEXCEPT + { return reverse_iterator(end()); } + + /** + * Returns a read-only (constant) reverse iterator that points to + * the last element in the %list. Iteration is done in reverse + * element order. + */ + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(end()); } + + /** + * Returns a read/write reverse iterator that points to one + * before the first element in the %list. Iteration is done in + * reverse element order. + */ + reverse_iterator + rend() _GLIBCXX_NOEXCEPT + { return reverse_iterator(begin()); } + + /** + * Returns a read-only (constant) reverse iterator that points to one + * before the first element in the %list. Iteration is done in reverse + * element order. + */ + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(begin()); } + +#if __cplusplus >= 201103L + /** + * Returns a read-only (constant) iterator that points to the + * first element in the %list. Iteration is done in ordinary + * element order. + */ + const_iterator + cbegin() const noexcept + { return const_iterator(this->_M_impl._M_node._M_next); } + + /** + * Returns a read-only (constant) iterator that points one past + * the last element in the %list. Iteration is done in ordinary + * element order. + */ + const_iterator + cend() const noexcept + { return const_iterator(&this->_M_impl._M_node); } + + /** + * Returns a read-only (constant) reverse iterator that points to + * the last element in the %list. Iteration is done in reverse + * element order. + */ + const_reverse_iterator + crbegin() const noexcept + { return const_reverse_iterator(end()); } + + /** + * Returns a read-only (constant) reverse iterator that points to one + * before the first element in the %list. Iteration is done in reverse + * element order. + */ + const_reverse_iterator + crend() const noexcept + { return const_reverse_iterator(begin()); } +#endif + + // [23.2.2.2] capacity + /** + * Returns true if the %list is empty. (Thus begin() would equal + * end().) + */ + bool + empty() const _GLIBCXX_NOEXCEPT + { return this->_M_impl._M_node._M_next == &this->_M_impl._M_node; } + + /** Returns the number of elements in the %list. */ + size_type + size() const _GLIBCXX_NOEXCEPT + { return this->_M_node_count(); } + + /** Returns the size() of the largest possible %list. */ + size_type + max_size() const _GLIBCXX_NOEXCEPT + { return _Node_alloc_traits::max_size(_M_get_Node_allocator()); } + +#if __cplusplus >= 201103L + /** + * @brief Resizes the %list to the specified number of elements. + * @param __new_size Number of elements the %list should contain. + * + * This function will %resize the %list to the specified number + * of elements. If the number is smaller than the %list's + * current size the %list is truncated, otherwise default + * constructed elements are appended. + */ + void + resize(size_type __new_size); + + /** + * @brief Resizes the %list to the specified number of elements. + * @param __new_size Number of elements the %list should contain. + * @param __x Data with which new elements should be populated. + * + * This function will %resize the %list to the specified number + * of elements. If the number is smaller than the %list's + * current size the %list is truncated, otherwise the %list is + * extended and new elements are populated with given data. + */ + void + resize(size_type __new_size, const value_type& __x); +#else + /** + * @brief Resizes the %list to the specified number of elements. + * @param __new_size Number of elements the %list should contain. + * @param __x Data with which new elements should be populated. + * + * This function will %resize the %list to the specified number + * of elements. If the number is smaller than the %list's + * current size the %list is truncated, otherwise the %list is + * extended and new elements are populated with given data. + */ + void + resize(size_type __new_size, value_type __x = value_type()); +#endif + + // element access + /** + * Returns a read/write reference to the data at the first + * element of the %list. + */ + reference + front() _GLIBCXX_NOEXCEPT + { return *begin(); } + + /** + * Returns a read-only (constant) reference to the data at the first + * element of the %list. + */ + const_reference + front() const _GLIBCXX_NOEXCEPT + { return *begin(); } + + /** + * Returns a read/write reference to the data at the last element + * of the %list. + */ + reference + back() _GLIBCXX_NOEXCEPT + { + iterator __tmp = end(); + --__tmp; + return *__tmp; + } + + /** + * Returns a read-only (constant) reference to the data at the last + * element of the %list. + */ + const_reference + back() const _GLIBCXX_NOEXCEPT + { + const_iterator __tmp = end(); + --__tmp; + return *__tmp; + } + + // [23.2.2.3] modifiers + /** + * @brief Add data to the front of the %list. + * @param __x Data to be added. + * + * This is a typical stack operation. The function creates an + * element at the front of the %list and assigns the given data + * to it. Due to the nature of a %list this operation can be + * done in constant time, and does not invalidate iterators and + * references. + */ + void + push_front(const value_type& __x) + { this->_M_insert(begin(), __x); } + +#if __cplusplus >= 201103L + void + push_front(value_type&& __x) + { this->_M_insert(begin(), std::move(__x)); } + + template +#if __cplusplus > 201402L + reference +#else + void +#endif + emplace_front(_Args&&... __args) + { + this->_M_insert(begin(), std::forward<_Args>(__args)...); +#if __cplusplus > 201402L + return front(); +#endif + } +#endif + + /** + * @brief Removes first element. + * + * This is a typical stack operation. It shrinks the %list by + * one. Due to the nature of a %list this operation can be done + * in constant time, and only invalidates iterators/references to + * the element being removed. + * + * Note that no data is returned, and if the first element's data + * is needed, it should be retrieved before pop_front() is + * called. + */ + void + pop_front() _GLIBCXX_NOEXCEPT + { this->_M_erase(begin()); } + + /** + * @brief Add data to the end of the %list. + * @param __x Data to be added. + * + * This is a typical stack operation. The function creates an + * element at the end of the %list and assigns the given data to + * it. Due to the nature of a %list this operation can be done + * in constant time, and does not invalidate iterators and + * references. + */ + void + push_back(const value_type& __x) + { this->_M_insert(end(), __x); } + +#if __cplusplus >= 201103L + void + push_back(value_type&& __x) + { this->_M_insert(end(), std::move(__x)); } + + template +#if __cplusplus > 201402L + reference +#else + void +#endif + emplace_back(_Args&&... __args) + { + this->_M_insert(end(), std::forward<_Args>(__args)...); +#if __cplusplus > 201402L + return back(); +#endif + } +#endif + + /** + * @brief Removes last element. + * + * This is a typical stack operation. It shrinks the %list by + * one. Due to the nature of a %list this operation can be done + * in constant time, and only invalidates iterators/references to + * the element being removed. + * + * Note that no data is returned, and if the last element's data + * is needed, it should be retrieved before pop_back() is called. + */ + void + pop_back() _GLIBCXX_NOEXCEPT + { this->_M_erase(iterator(this->_M_impl._M_node._M_prev)); } + +#if __cplusplus >= 201103L + /** + * @brief Constructs object in %list before specified iterator. + * @param __position A const_iterator into the %list. + * @param __args Arguments. + * @return An iterator that points to the inserted data. + * + * This function will insert an object of type T constructed + * with T(std::forward(args)...) before the specified + * location. Due to the nature of a %list this operation can + * be done in constant time, and does not invalidate iterators + * and references. + */ + template + iterator + emplace(const_iterator __position, _Args&&... __args); + + /** + * @brief Inserts given value into %list before specified iterator. + * @param __position A const_iterator into the %list. + * @param __x Data to be inserted. + * @return An iterator that points to the inserted data. + * + * This function will insert a copy of the given value before + * the specified location. Due to the nature of a %list this + * operation can be done in constant time, and does not + * invalidate iterators and references. + */ + iterator + insert(const_iterator __position, const value_type& __x); +#else + /** + * @brief Inserts given value into %list before specified iterator. + * @param __position An iterator into the %list. + * @param __x Data to be inserted. + * @return An iterator that points to the inserted data. + * + * This function will insert a copy of the given value before + * the specified location. Due to the nature of a %list this + * operation can be done in constant time, and does not + * invalidate iterators and references. + */ + iterator + insert(iterator __position, const value_type& __x); +#endif + +#if __cplusplus >= 201103L + /** + * @brief Inserts given rvalue into %list before specified iterator. + * @param __position A const_iterator into the %list. + * @param __x Data to be inserted. + * @return An iterator that points to the inserted data. + * + * This function will insert a copy of the given rvalue before + * the specified location. Due to the nature of a %list this + * operation can be done in constant time, and does not + * invalidate iterators and references. + */ + iterator + insert(const_iterator __position, value_type&& __x) + { return emplace(__position, std::move(__x)); } + + /** + * @brief Inserts the contents of an initializer_list into %list + * before specified const_iterator. + * @param __p A const_iterator into the %list. + * @param __l An initializer_list of value_type. + * @return An iterator pointing to the first element inserted + * (or __position). + * + * This function will insert copies of the data in the + * initializer_list @a l into the %list before the location + * specified by @a p. + * + * This operation is linear in the number of elements inserted and + * does not invalidate iterators and references. + */ + iterator + insert(const_iterator __p, initializer_list __l) + { return this->insert(__p, __l.begin(), __l.end()); } +#endif + +#if __cplusplus >= 201103L + /** + * @brief Inserts a number of copies of given data into the %list. + * @param __position A const_iterator into the %list. + * @param __n Number of elements to be inserted. + * @param __x Data to be inserted. + * @return An iterator pointing to the first element inserted + * (or __position). + * + * This function will insert a specified number of copies of the + * given data before the location specified by @a position. + * + * This operation is linear in the number of elements inserted and + * does not invalidate iterators and references. + */ + iterator + insert(const_iterator __position, size_type __n, const value_type& __x); +#else + /** + * @brief Inserts a number of copies of given data into the %list. + * @param __position An iterator into the %list. + * @param __n Number of elements to be inserted. + * @param __x Data to be inserted. + * + * This function will insert a specified number of copies of the + * given data before the location specified by @a position. + * + * This operation is linear in the number of elements inserted and + * does not invalidate iterators and references. + */ + void + insert(iterator __position, size_type __n, const value_type& __x) + { + list __tmp(__n, __x, get_allocator()); + splice(__position, __tmp); + } +#endif + +#if __cplusplus >= 201103L + /** + * @brief Inserts a range into the %list. + * @param __position A const_iterator into the %list. + * @param __first An input iterator. + * @param __last An input iterator. + * @return An iterator pointing to the first element inserted + * (or __position). + * + * This function will insert copies of the data in the range [@a + * first,@a last) into the %list before the location specified by + * @a position. + * + * This operation is linear in the number of elements inserted and + * does not invalidate iterators and references. + */ + template> + iterator + insert(const_iterator __position, _InputIterator __first, + _InputIterator __last); +#else + /** + * @brief Inserts a range into the %list. + * @param __position An iterator into the %list. + * @param __first An input iterator. + * @param __last An input iterator. + * + * This function will insert copies of the data in the range [@a + * first,@a last) into the %list before the location specified by + * @a position. + * + * This operation is linear in the number of elements inserted and + * does not invalidate iterators and references. + */ + template + void + insert(iterator __position, _InputIterator __first, + _InputIterator __last) + { + list __tmp(__first, __last, get_allocator()); + splice(__position, __tmp); + } +#endif + + /** + * @brief Remove element at given position. + * @param __position Iterator pointing to element to be erased. + * @return An iterator pointing to the next element (or end()). + * + * This function will erase the element at the given position and thus + * shorten the %list by one. + * + * Due to the nature of a %list this operation can be done in + * constant time, and only invalidates iterators/references to + * the element being removed. The user is also cautioned that + * this function only erases the element, and that if the element + * is itself a pointer, the pointed-to memory is not touched in + * any way. Managing the pointer is the user's responsibility. + */ + iterator +#if __cplusplus >= 201103L + erase(const_iterator __position) noexcept; +#else + erase(iterator __position); +#endif + + /** + * @brief Remove a range of elements. + * @param __first Iterator pointing to the first element to be erased. + * @param __last Iterator pointing to one past the last element to be + * erased. + * @return An iterator pointing to the element pointed to by @a last + * prior to erasing (or end()). + * + * This function will erase the elements in the range @a + * [first,last) and shorten the %list accordingly. + * + * This operation is linear time in the size of the range and only + * invalidates iterators/references to the element being removed. + * The user is also cautioned that this function only erases the + * elements, and that if the elements themselves are pointers, the + * pointed-to memory is not touched in any way. Managing the pointer + * is the user's responsibility. + */ + iterator +#if __cplusplus >= 201103L + erase(const_iterator __first, const_iterator __last) noexcept +#else + erase(iterator __first, iterator __last) +#endif + { + while (__first != __last) + __first = erase(__first); + return __last._M_const_cast(); + } + + /** + * @brief Swaps data with another %list. + * @param __x A %list of the same element and allocator types. + * + * This exchanges the elements between two lists in constant + * time. Note that the global std::swap() function is + * specialized such that std::swap(l1,l2) will feed to this + * function. + * + * Whether the allocators are swapped depends on the allocator traits. + */ + void + swap(list& __x) _GLIBCXX_NOEXCEPT + { + __detail::_List_node_base::swap(this->_M_impl._M_node, + __x._M_impl._M_node); + + size_t __xsize = __x._M_get_size(); + __x._M_set_size(this->_M_get_size()); + this->_M_set_size(__xsize); + + _Node_alloc_traits::_S_on_swap(this->_M_get_Node_allocator(), + __x._M_get_Node_allocator()); + } + + /** + * Erases all the elements. Note that this function only erases + * the elements, and that if the elements themselves are + * pointers, the pointed-to memory is not touched in any way. + * Managing the pointer is the user's responsibility. + */ + void + clear() _GLIBCXX_NOEXCEPT + { + _Base::_M_clear(); + _Base::_M_init(); + } + + // [23.2.2.4] list operations + /** + * @brief Insert contents of another %list. + * @param __position Iterator referencing the element to insert before. + * @param __x Source list. + * + * The elements of @a __x are inserted in constant time in front of + * the element referenced by @a __position. @a __x becomes an empty + * list. + * + * Requires this != @a __x. + */ + void +#if __cplusplus >= 201103L + splice(const_iterator __position, list&& __x) noexcept +#else + splice(iterator __position, list& __x) +#endif + { + if (!__x.empty()) + { + _M_check_equal_allocators(__x); + + this->_M_transfer(__position._M_const_cast(), + __x.begin(), __x.end()); + + this->_M_inc_size(__x._M_get_size()); + __x._M_set_size(0); + } + } + +#if __cplusplus >= 201103L + void + splice(const_iterator __position, list& __x) noexcept + { splice(__position, std::move(__x)); } +#endif + +#if __cplusplus >= 201103L + /** + * @brief Insert element from another %list. + * @param __position Const_iterator referencing the element to + * insert before. + * @param __x Source list. + * @param __i Const_iterator referencing the element to move. + * + * Removes the element in list @a __x referenced by @a __i and + * inserts it into the current list before @a __position. + */ + void + splice(const_iterator __position, list&& __x, const_iterator __i) noexcept +#else + /** + * @brief Insert element from another %list. + * @param __position Iterator referencing the element to insert before. + * @param __x Source list. + * @param __i Iterator referencing the element to move. + * + * Removes the element in list @a __x referenced by @a __i and + * inserts it into the current list before @a __position. + */ + void + splice(iterator __position, list& __x, iterator __i) +#endif + { + iterator __j = __i._M_const_cast(); + ++__j; + if (__position == __i || __position == __j) + return; + + if (this != std::__addressof(__x)) + _M_check_equal_allocators(__x); + + this->_M_transfer(__position._M_const_cast(), + __i._M_const_cast(), __j); + + this->_M_inc_size(1); + __x._M_dec_size(1); + } + +#if __cplusplus >= 201103L + /** + * @brief Insert element from another %list. + * @param __position Const_iterator referencing the element to + * insert before. + * @param __x Source list. + * @param __i Const_iterator referencing the element to move. + * + * Removes the element in list @a __x referenced by @a __i and + * inserts it into the current list before @a __position. + */ + void + splice(const_iterator __position, list& __x, const_iterator __i) noexcept + { splice(__position, std::move(__x), __i); } +#endif + +#if __cplusplus >= 201103L + /** + * @brief Insert range from another %list. + * @param __position Const_iterator referencing the element to + * insert before. + * @param __x Source list. + * @param __first Const_iterator referencing the start of range in x. + * @param __last Const_iterator referencing the end of range in x. + * + * Removes elements in the range [__first,__last) and inserts them + * before @a __position in constant time. + * + * Undefined if @a __position is in [__first,__last). + */ + void + splice(const_iterator __position, list&& __x, const_iterator __first, + const_iterator __last) noexcept +#else + /** + * @brief Insert range from another %list. + * @param __position Iterator referencing the element to insert before. + * @param __x Source list. + * @param __first Iterator referencing the start of range in x. + * @param __last Iterator referencing the end of range in x. + * + * Removes elements in the range [__first,__last) and inserts them + * before @a __position in constant time. + * + * Undefined if @a __position is in [__first,__last). + */ + void + splice(iterator __position, list& __x, iterator __first, + iterator __last) +#endif + { + if (__first != __last) + { + if (this != std::__addressof(__x)) + _M_check_equal_allocators(__x); + + size_t __n = this->_M_distance(__first._M_node, __last._M_node); + this->_M_inc_size(__n); + __x._M_dec_size(__n); + + this->_M_transfer(__position._M_const_cast(), + __first._M_const_cast(), + __last._M_const_cast()); + } + } + +#if __cplusplus >= 201103L + /** + * @brief Insert range from another %list. + * @param __position Const_iterator referencing the element to + * insert before. + * @param __x Source list. + * @param __first Const_iterator referencing the start of range in x. + * @param __last Const_iterator referencing the end of range in x. + * + * Removes elements in the range [__first,__last) and inserts them + * before @a __position in constant time. + * + * Undefined if @a __position is in [__first,__last). + */ + void + splice(const_iterator __position, list& __x, const_iterator __first, + const_iterator __last) noexcept + { splice(__position, std::move(__x), __first, __last); } +#endif + + /** + * @brief Remove all elements equal to value. + * @param __value The value to remove. + * + * Removes every element in the list equal to @a value. + * Remaining elements stay in list order. Note that this + * function only erases the elements, and that if the elements + * themselves are pointers, the pointed-to memory is not + * touched in any way. Managing the pointer is the user's + * responsibility. + */ + void + remove(const _Tp& __value); + + /** + * @brief Remove all elements satisfying a predicate. + * @tparam _Predicate Unary predicate function or object. + * + * Removes every element in the list for which the predicate + * returns true. Remaining elements stay in list order. Note + * that this function only erases the elements, and that if the + * elements themselves are pointers, the pointed-to memory is + * not touched in any way. Managing the pointer is the user's + * responsibility. + */ + template + void + remove_if(_Predicate); + + /** + * @brief Remove consecutive duplicate elements. + * + * For each consecutive set of elements with the same value, + * remove all but the first one. Remaining elements stay in + * list order. Note that this function only erases the + * elements, and that if the elements themselves are pointers, + * the pointed-to memory is not touched in any way. Managing + * the pointer is the user's responsibility. + */ + void + unique(); + + /** + * @brief Remove consecutive elements satisfying a predicate. + * @tparam _BinaryPredicate Binary predicate function or object. + * + * For each consecutive set of elements [first,last) that + * satisfy predicate(first,i) where i is an iterator in + * [first,last), remove all but the first one. Remaining + * elements stay in list order. Note that this function only + * erases the elements, and that if the elements themselves are + * pointers, the pointed-to memory is not touched in any way. + * Managing the pointer is the user's responsibility. + */ + template + void + unique(_BinaryPredicate); + + /** + * @brief Merge sorted lists. + * @param __x Sorted list to merge. + * + * Assumes that both @a __x and this list are sorted according to + * operator<(). Merges elements of @a __x into this list in + * sorted order, leaving @a __x empty when complete. Elements in + * this list precede elements in @a __x that are equal. + */ +#if __cplusplus >= 201103L + void + merge(list&& __x); + + void + merge(list& __x) + { merge(std::move(__x)); } +#else + void + merge(list& __x); +#endif + + /** + * @brief Merge sorted lists according to comparison function. + * @tparam _StrictWeakOrdering Comparison function defining + * sort order. + * @param __x Sorted list to merge. + * @param __comp Comparison functor. + * + * Assumes that both @a __x and this list are sorted according to + * StrictWeakOrdering. Merges elements of @a __x into this list + * in sorted order, leaving @a __x empty when complete. Elements + * in this list precede elements in @a __x that are equivalent + * according to StrictWeakOrdering(). + */ +#if __cplusplus >= 201103L + template + void + merge(list&& __x, _StrictWeakOrdering __comp); + + template + void + merge(list& __x, _StrictWeakOrdering __comp) + { merge(std::move(__x), __comp); } +#else + template + void + merge(list& __x, _StrictWeakOrdering __comp); +#endif + + /** + * @brief Reverse the elements in list. + * + * Reverse the order of elements in the list in linear time. + */ + void + reverse() _GLIBCXX_NOEXCEPT + { this->_M_impl._M_node._M_reverse(); } + + /** + * @brief Sort the elements. + * + * Sorts the elements of this list in NlogN time. Equivalent + * elements remain in list order. + */ + void + sort(); + + /** + * @brief Sort the elements according to comparison function. + * + * Sorts the elements of this list in NlogN time. Equivalent + * elements remain in list order. + */ + template + void + sort(_StrictWeakOrdering); + + protected: + // Internal constructor functions follow. + + // Called by the range constructor to implement [23.1.1]/9 + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 438. Ambiguity in the "do the right thing" clause + template + void + _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type) + { _M_fill_initialize(static_cast(__n), __x); } + + // Called by the range constructor to implement [23.1.1]/9 + template + void + _M_initialize_dispatch(_InputIterator __first, _InputIterator __last, + __false_type) + { + for (; __first != __last; ++__first) +#if __cplusplus >= 201103L + emplace_back(*__first); +#else + push_back(*__first); +#endif + } + + // Called by list(n,v,a), and the range constructor when it turns out + // to be the same thing. + void + _M_fill_initialize(size_type __n, const value_type& __x) + { + for (; __n; --__n) + push_back(__x); + } + +#if __cplusplus >= 201103L + // Called by list(n). + void + _M_default_initialize(size_type __n) + { + for (; __n; --__n) + emplace_back(); + } + + // Called by resize(sz). + void + _M_default_append(size_type __n); +#endif + + // Internal assign functions follow. + + // Called by the range assign to implement [23.1.1]/9 + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 438. Ambiguity in the "do the right thing" clause + template + void + _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) + { _M_fill_assign(__n, __val); } + + // Called by the range assign to implement [23.1.1]/9 + template + void + _M_assign_dispatch(_InputIterator __first, _InputIterator __last, + __false_type); + + // Called by assign(n,t), and the range assign when it turns out + // to be the same thing. + void + _M_fill_assign(size_type __n, const value_type& __val); + + + // Moves the elements from [first,last) before position. + void + _M_transfer(iterator __position, iterator __first, iterator __last) + { __position._M_node->_M_transfer(__first._M_node, __last._M_node); } + + // Inserts new element at position given and with value given. +#if __cplusplus < 201103L + void + _M_insert(iterator __position, const value_type& __x) + { + _Node* __tmp = _M_create_node(__x); + __tmp->_M_hook(__position._M_node); + this->_M_inc_size(1); + } +#else + template + void + _M_insert(iterator __position, _Args&&... __args) + { + _Node* __tmp = _M_create_node(std::forward<_Args>(__args)...); + __tmp->_M_hook(__position._M_node); + this->_M_inc_size(1); + } +#endif + + // Erases element at position given. + void + _M_erase(iterator __position) _GLIBCXX_NOEXCEPT + { + this->_M_dec_size(1); + __position._M_node->_M_unhook(); + _Node* __n = static_cast<_Node*>(__position._M_node); +#if __cplusplus >= 201103L + _Node_alloc_traits::destroy(_M_get_Node_allocator(), __n->_M_valptr()); +#else + _Tp_alloc_type(_M_get_Node_allocator()).destroy(__n->_M_valptr()); +#endif + + _M_put_node(__n); + } + + // To implement the splice (and merge) bits of N1599. + void + _M_check_equal_allocators(list& __x) _GLIBCXX_NOEXCEPT + { + if (std::__alloc_neq:: + _S_do_it(_M_get_Node_allocator(), __x._M_get_Node_allocator())) + __builtin_abort(); + } + + // Used to implement resize. + const_iterator + _M_resize_pos(size_type& __new_size) const; + +#if __cplusplus >= 201103L + void + _M_move_assign(list&& __x, true_type) noexcept + { + this->_M_clear(); + if (__x.empty()) + this->_M_init(); + else + { + this->_M_impl._M_node._M_next = __x._M_impl._M_node._M_next; + this->_M_impl._M_node._M_next->_M_prev = &this->_M_impl._M_node; + this->_M_impl._M_node._M_prev = __x._M_impl._M_node._M_prev; + this->_M_impl._M_node._M_prev->_M_next = &this->_M_impl._M_node; + this->_M_set_size(__x._M_get_size()); + __x._M_init(); + } + std::__alloc_on_move(this->_M_get_Node_allocator(), + __x._M_get_Node_allocator()); + } + + void + _M_move_assign(list&& __x, false_type) + { + if (__x._M_get_Node_allocator() == this->_M_get_Node_allocator()) + _M_move_assign(std::move(__x), true_type{}); + else + // The rvalue's allocator cannot be moved, or is not equal, + // so we need to individually move each element. + _M_assign_dispatch(std::__make_move_if_noexcept_iterator(__x.begin()), + std::__make_move_if_noexcept_iterator(__x.end()), + __false_type{}); + } +#endif + }; +_GLIBCXX_END_NAMESPACE_CXX11 + + /** + * @brief List equality comparison. + * @param __x A %list. + * @param __y A %list of the same type as @a __x. + * @return True iff the size and elements of the lists are equal. + * + * This is an equivalence relation. It is linear in the size of + * the lists. Lists are considered equivalent if their sizes are + * equal, and if corresponding elements compare equal. + */ + template + inline bool + operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) + { +#if _GLIBCXX_USE_CXX11_ABI + if (__x.size() != __y.size()) + return false; +#endif + + typedef typename list<_Tp, _Alloc>::const_iterator const_iterator; + const_iterator __end1 = __x.end(); + const_iterator __end2 = __y.end(); + + const_iterator __i1 = __x.begin(); + const_iterator __i2 = __y.begin(); + while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2) + { + ++__i1; + ++__i2; + } + return __i1 == __end1 && __i2 == __end2; + } + + /** + * @brief List ordering relation. + * @param __x A %list. + * @param __y A %list of the same type as @a __x. + * @return True iff @a __x is lexicographically less than @a __y. + * + * This is a total ordering relation. It is linear in the size of the + * lists. The elements must be comparable with @c <. + * + * See std::lexicographical_compare() for how the determination is made. + */ + template + inline bool + operator<(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) + { return std::lexicographical_compare(__x.begin(), __x.end(), + __y.begin(), __y.end()); } + + /// Based on operator== + template + inline bool + operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) + { return !(__x == __y); } + + /// Based on operator< + template + inline bool + operator>(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) + { return __y < __x; } + + /// Based on operator< + template + inline bool + operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) + { return !(__y < __x); } + + /// Based on operator< + template + inline bool + operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) + { return !(__x < __y); } + + /// See std::list::swap(). + template + inline void + swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y) + _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y))) + { __x.swap(__y); } + +_GLIBCXX_END_NAMESPACE_CONTAINER + +#if _GLIBCXX_USE_CXX11_ABI +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // Detect when distance is used to compute the size of the whole list. + template + inline ptrdiff_t + __distance(_GLIBCXX_STD_C::_List_iterator<_Tp> __first, + _GLIBCXX_STD_C::_List_iterator<_Tp> __last, + input_iterator_tag __tag) + { + typedef _GLIBCXX_STD_C::_List_const_iterator<_Tp> _CIter; + return std::__distance(_CIter(__first), _CIter(__last), __tag); + } + + template + inline ptrdiff_t + __distance(_GLIBCXX_STD_C::_List_const_iterator<_Tp> __first, + _GLIBCXX_STD_C::_List_const_iterator<_Tp> __last, + input_iterator_tag) + { + typedef _GLIBCXX_STD_C::_List_node _Sentinel; + _GLIBCXX_STD_C::_List_const_iterator<_Tp> __beyond = __last; + ++__beyond; + bool __whole = __first == __beyond; + if (__builtin_constant_p (__whole) && __whole) + return *static_cast(__last._M_node)->_M_valptr(); + + ptrdiff_t __n = 0; + while (__first != __last) + { + ++__first; + ++__n; + } + return __n; + } + +_GLIBCXX_END_NAMESPACE_VERSION +#endif +} // namespace std + +#endif /* _STL_LIST_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_map.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_map.h new file mode 100644 index 0000000..ea0e327 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_map.h @@ -0,0 +1,1479 @@ +// Map implementation -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_map.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{map} + */ + +#ifndef _STL_MAP_H +#define _STL_MAP_H 1 + +#include +#include +#if __cplusplus >= 201103L +#include +#include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_CONTAINER + + template + class multimap; + + /** + * @brief A standard container made up of (key,value) pairs, which can be + * retrieved based on a key, in logarithmic time. + * + * @ingroup associative_containers + * + * @tparam _Key Type of key objects. + * @tparam _Tp Type of mapped objects. + * @tparam _Compare Comparison function object type, defaults to less<_Key>. + * @tparam _Alloc Allocator type, defaults to + * allocator. + * + * Meets the requirements of a container, a + * reversible container, and an + * associative container (using unique keys). + * For a @c map the key_type is Key, the mapped_type is T, and the + * value_type is std::pair. + * + * Maps support bidirectional iterators. + * + * The private tree data is declared exactly the same way for map and + * multimap; the distinction is made entirely in how the tree functions are + * called (*_unique versus *_equal, same as the standard). + */ + template , + typename _Alloc = std::allocator > > + class map + { + public: + typedef _Key key_type; + typedef _Tp mapped_type; + typedef std::pair value_type; + typedef _Compare key_compare; + typedef _Alloc allocator_type; + + private: +#ifdef _GLIBCXX_CONCEPT_CHECKS + // concept requirements + typedef typename _Alloc::value_type _Alloc_value_type; +# if __cplusplus < 201103L + __glibcxx_class_requires(_Tp, _SGIAssignableConcept) +# endif + __glibcxx_class_requires4(_Compare, bool, _Key, _Key, + _BinaryFunctionConcept) + __glibcxx_class_requires2(value_type, _Alloc_value_type, _SameTypeConcept) +#endif + + public: + class value_compare + : public std::binary_function + { + friend class map<_Key, _Tp, _Compare, _Alloc>; + protected: + _Compare comp; + + value_compare(_Compare __c) + : comp(__c) { } + + public: + bool operator()(const value_type& __x, const value_type& __y) const + { return comp(__x.first, __y.first); } + }; + + private: + /// This turns a red-black tree into a [multi]map. + typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template + rebind::other _Pair_alloc_type; + + typedef _Rb_tree, + key_compare, _Pair_alloc_type> _Rep_type; + + /// The actual tree structure. + _Rep_type _M_t; + + typedef __gnu_cxx::__alloc_traits<_Pair_alloc_type> _Alloc_traits; + + public: + // many of these are specified differently in ISO, but the following are + // "functionally equivalent" + typedef typename _Alloc_traits::pointer pointer; + typedef typename _Alloc_traits::const_pointer const_pointer; + typedef typename _Alloc_traits::reference reference; + typedef typename _Alloc_traits::const_reference const_reference; + typedef typename _Rep_type::iterator iterator; + typedef typename _Rep_type::const_iterator const_iterator; + typedef typename _Rep_type::size_type size_type; + typedef typename _Rep_type::difference_type difference_type; + typedef typename _Rep_type::reverse_iterator reverse_iterator; + typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; + +#if __cplusplus > 201402L + using node_type = typename _Rep_type::node_type; + using insert_return_type = typename _Rep_type::insert_return_type; +#endif + + // [23.3.1.1] construct/copy/destroy + // (get_allocator() is also listed in this section) + + /** + * @brief Default constructor creates no elements. + */ +#if __cplusplus < 201103L + map() : _M_t() { } +#else + map() = default; +#endif + + /** + * @brief Creates a %map with no elements. + * @param __comp A comparison object. + * @param __a An allocator object. + */ + explicit + map(const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, _Pair_alloc_type(__a)) { } + + /** + * @brief %Map copy constructor. + * + * Whether the allocator is copied depends on the allocator traits. + */ +#if __cplusplus < 201103L + map(const map& __x) + : _M_t(__x._M_t) { } +#else + map(const map&) = default; + + /** + * @brief %Map move constructor. + * + * The newly-created %map contains the exact contents of the moved + * instance. The moved instance is a valid, but unspecified, %map. + */ + map(map&&) = default; + + /** + * @brief Builds a %map from an initializer_list. + * @param __l An initializer_list. + * @param __comp A comparison object. + * @param __a An allocator object. + * + * Create a %map consisting of copies of the elements in the + * initializer_list @a __l. + * This is linear in N if the range is already sorted, and NlogN + * otherwise (where N is @a __l.size()). + */ + map(initializer_list __l, + const _Compare& __comp = _Compare(), + const allocator_type& __a = allocator_type()) + : _M_t(__comp, _Pair_alloc_type(__a)) + { _M_t._M_insert_unique(__l.begin(), __l.end()); } + + /// Allocator-extended default constructor. + explicit + map(const allocator_type& __a) + : _M_t(_Compare(), _Pair_alloc_type(__a)) { } + + /// Allocator-extended copy constructor. + map(const map& __m, const allocator_type& __a) + : _M_t(__m._M_t, _Pair_alloc_type(__a)) { } + + /// Allocator-extended move constructor. + map(map&& __m, const allocator_type& __a) + noexcept(is_nothrow_copy_constructible<_Compare>::value + && _Alloc_traits::_S_always_equal()) + : _M_t(std::move(__m._M_t), _Pair_alloc_type(__a)) { } + + /// Allocator-extended initialier-list constructor. + map(initializer_list __l, const allocator_type& __a) + : _M_t(_Compare(), _Pair_alloc_type(__a)) + { _M_t._M_insert_unique(__l.begin(), __l.end()); } + + /// Allocator-extended range constructor. + template + map(_InputIterator __first, _InputIterator __last, + const allocator_type& __a) + : _M_t(_Compare(), _Pair_alloc_type(__a)) + { _M_t._M_insert_unique(__first, __last); } +#endif + + /** + * @brief Builds a %map from a range. + * @param __first An input iterator. + * @param __last An input iterator. + * + * Create a %map consisting of copies of the elements from + * [__first,__last). This is linear in N if the range is + * already sorted, and NlogN otherwise (where N is + * distance(__first,__last)). + */ + template + map(_InputIterator __first, _InputIterator __last) + : _M_t() + { _M_t._M_insert_unique(__first, __last); } + + /** + * @brief Builds a %map from a range. + * @param __first An input iterator. + * @param __last An input iterator. + * @param __comp A comparison functor. + * @param __a An allocator object. + * + * Create a %map consisting of copies of the elements from + * [__first,__last). This is linear in N if the range is + * already sorted, and NlogN otherwise (where N is + * distance(__first,__last)). + */ + template + map(_InputIterator __first, _InputIterator __last, + const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, _Pair_alloc_type(__a)) + { _M_t._M_insert_unique(__first, __last); } + +#if __cplusplus >= 201103L + /** + * The dtor only erases the elements, and note that if the elements + * themselves are pointers, the pointed-to memory is not touched in any + * way. Managing the pointer is the user's responsibility. + */ + ~map() = default; +#endif + + /** + * @brief %Map assignment operator. + * + * Whether the allocator is copied depends on the allocator traits. + */ +#if __cplusplus < 201103L + map& + operator=(const map& __x) + { + _M_t = __x._M_t; + return *this; + } +#else + map& + operator=(const map&) = default; + + /// Move assignment operator. + map& + operator=(map&&) = default; + + /** + * @brief %Map list assignment operator. + * @param __l An initializer_list. + * + * This function fills a %map with copies of the elements in the + * initializer list @a __l. + * + * Note that the assignment completely changes the %map and + * that the resulting %map's size is the same as the number + * of elements assigned. + */ + map& + operator=(initializer_list __l) + { + _M_t._M_assign_unique(__l.begin(), __l.end()); + return *this; + } +#endif + + /// Get a copy of the memory allocation object. + allocator_type + get_allocator() const _GLIBCXX_NOEXCEPT + { return allocator_type(_M_t.get_allocator()); } + + // iterators + /** + * Returns a read/write iterator that points to the first pair in the + * %map. + * Iteration is done in ascending order according to the keys. + */ + iterator + begin() _GLIBCXX_NOEXCEPT + { return _M_t.begin(); } + + /** + * Returns a read-only (constant) iterator that points to the first pair + * in the %map. Iteration is done in ascending order according to the + * keys. + */ + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return _M_t.begin(); } + + /** + * Returns a read/write iterator that points one past the last + * pair in the %map. Iteration is done in ascending order + * according to the keys. + */ + iterator + end() _GLIBCXX_NOEXCEPT + { return _M_t.end(); } + + /** + * Returns a read-only (constant) iterator that points one past the last + * pair in the %map. Iteration is done in ascending order according to + * the keys. + */ + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return _M_t.end(); } + + /** + * Returns a read/write reverse iterator that points to the last pair in + * the %map. Iteration is done in descending order according to the + * keys. + */ + reverse_iterator + rbegin() _GLIBCXX_NOEXCEPT + { return _M_t.rbegin(); } + + /** + * Returns a read-only (constant) reverse iterator that points to the + * last pair in the %map. Iteration is done in descending order + * according to the keys. + */ + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return _M_t.rbegin(); } + + /** + * Returns a read/write reverse iterator that points to one before the + * first pair in the %map. Iteration is done in descending order + * according to the keys. + */ + reverse_iterator + rend() _GLIBCXX_NOEXCEPT + { return _M_t.rend(); } + + /** + * Returns a read-only (constant) reverse iterator that points to one + * before the first pair in the %map. Iteration is done in descending + * order according to the keys. + */ + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return _M_t.rend(); } + +#if __cplusplus >= 201103L + /** + * Returns a read-only (constant) iterator that points to the first pair + * in the %map. Iteration is done in ascending order according to the + * keys. + */ + const_iterator + cbegin() const noexcept + { return _M_t.begin(); } + + /** + * Returns a read-only (constant) iterator that points one past the last + * pair in the %map. Iteration is done in ascending order according to + * the keys. + */ + const_iterator + cend() const noexcept + { return _M_t.end(); } + + /** + * Returns a read-only (constant) reverse iterator that points to the + * last pair in the %map. Iteration is done in descending order + * according to the keys. + */ + const_reverse_iterator + crbegin() const noexcept + { return _M_t.rbegin(); } + + /** + * Returns a read-only (constant) reverse iterator that points to one + * before the first pair in the %map. Iteration is done in descending + * order according to the keys. + */ + const_reverse_iterator + crend() const noexcept + { return _M_t.rend(); } +#endif + + // capacity + /** Returns true if the %map is empty. (Thus begin() would equal + * end().) + */ + bool + empty() const _GLIBCXX_NOEXCEPT + { return _M_t.empty(); } + + /** Returns the size of the %map. */ + size_type + size() const _GLIBCXX_NOEXCEPT + { return _M_t.size(); } + + /** Returns the maximum size of the %map. */ + size_type + max_size() const _GLIBCXX_NOEXCEPT + { return _M_t.max_size(); } + + // [23.3.1.2] element access + /** + * @brief Subscript ( @c [] ) access to %map data. + * @param __k The key for which data should be retrieved. + * @return A reference to the data of the (key,data) %pair. + * + * Allows for easy lookup with the subscript ( @c [] ) + * operator. Returns data associated with the key specified in + * subscript. If the key does not exist, a pair with that key + * is created using default values, which is then returned. + * + * Lookup requires logarithmic time. + */ + mapped_type& + operator[](const key_type& __k) + { + // concept requirements + __glibcxx_function_requires(_DefaultConstructibleConcept) + + iterator __i = lower_bound(__k); + // __i->first is greater than or equivalent to __k. + if (__i == end() || key_comp()(__k, (*__i).first)) +#if __cplusplus >= 201103L + __i = _M_t._M_emplace_hint_unique(__i, std::piecewise_construct, + std::tuple(__k), + std::tuple<>()); +#else + __i = insert(__i, value_type(__k, mapped_type())); +#endif + return (*__i).second; + } + +#if __cplusplus >= 201103L + mapped_type& + operator[](key_type&& __k) + { + // concept requirements + __glibcxx_function_requires(_DefaultConstructibleConcept) + + iterator __i = lower_bound(__k); + // __i->first is greater than or equivalent to __k. + if (__i == end() || key_comp()(__k, (*__i).first)) + __i = _M_t._M_emplace_hint_unique(__i, std::piecewise_construct, + std::forward_as_tuple(std::move(__k)), + std::tuple<>()); + return (*__i).second; + } +#endif + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 464. Suggestion for new member functions in standard containers. + /** + * @brief Access to %map data. + * @param __k The key for which data should be retrieved. + * @return A reference to the data whose key is equivalent to @a __k, if + * such a data is present in the %map. + * @throw std::out_of_range If no such data is present. + */ + mapped_type& + at(const key_type& __k) + { + iterator __i = lower_bound(__k); + if (__i == end() || key_comp()(__k, (*__i).first)) + __throw_out_of_range(__N("map::at")); + return (*__i).second; + } + + const mapped_type& + at(const key_type& __k) const + { + const_iterator __i = lower_bound(__k); + if (__i == end() || key_comp()(__k, (*__i).first)) + __throw_out_of_range(__N("map::at")); + return (*__i).second; + } + + // modifiers +#if __cplusplus >= 201103L + /** + * @brief Attempts to build and insert a std::pair into the %map. + * + * @param __args Arguments used to generate a new pair instance (see + * std::piecewise_contruct for passing arguments to each + * part of the pair constructor). + * + * @return A pair, of which the first element is an iterator that points + * to the possibly inserted pair, and the second is a bool that + * is true if the pair was actually inserted. + * + * This function attempts to build and insert a (key, value) %pair into + * the %map. + * A %map relies on unique keys and thus a %pair is only inserted if its + * first element (the key) is not already present in the %map. + * + * Insertion requires logarithmic time. + */ + template + std::pair + emplace(_Args&&... __args) + { return _M_t._M_emplace_unique(std::forward<_Args>(__args)...); } + + /** + * @brief Attempts to build and insert a std::pair into the %map. + * + * @param __pos An iterator that serves as a hint as to where the pair + * should be inserted. + * @param __args Arguments used to generate a new pair instance (see + * std::piecewise_contruct for passing arguments to each + * part of the pair constructor). + * @return An iterator that points to the element with key of the + * std::pair built from @a __args (may or may not be that + * std::pair). + * + * This function is not concerned about whether the insertion took place, + * and thus does not return a boolean like the single-argument emplace() + * does. + * Note that the first parameter is only a hint and can potentially + * improve the performance of the insertion process. A bad hint would + * cause no gains in efficiency. + * + * See + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints + * for more on @a hinting. + * + * Insertion requires logarithmic time (if the hint is not taken). + */ + template + iterator + emplace_hint(const_iterator __pos, _Args&&... __args) + { + return _M_t._M_emplace_hint_unique(__pos, + std::forward<_Args>(__args)...); + } +#endif + +#if __cplusplus > 201402L + /// Extract a node. + node_type + extract(const_iterator __pos) + { + __glibcxx_assert(__pos != end()); + return _M_t.extract(__pos); + } + + /// Extract a node. + node_type + extract(const key_type& __x) + { return _M_t.extract(__x); } + + /// Re-insert an extracted node. + insert_return_type + insert(node_type&& __nh) + { return _M_t._M_reinsert_node_unique(std::move(__nh)); } + + /// Re-insert an extracted node. + iterator + insert(const_iterator __hint, node_type&& __nh) + { return _M_t._M_reinsert_node_hint_unique(__hint, std::move(__nh)); } + + template + friend class _Rb_tree_merge_helper; + + template + void + merge(map<_Key, _Tp, _C2, _Alloc>& __source) + { + using _Merge_helper = _Rb_tree_merge_helper; + _M_t._M_merge_unique(_Merge_helper::_S_get_tree(__source)); + } + + template + void + merge(map<_Key, _Tp, _C2, _Alloc>&& __source) + { merge(__source); } + + template + void + merge(multimap<_Key, _Tp, _C2, _Alloc>& __source) + { + using _Merge_helper = _Rb_tree_merge_helper; + _M_t._M_merge_unique(_Merge_helper::_S_get_tree(__source)); + } + + template + void + merge(multimap<_Key, _Tp, _C2, _Alloc>&& __source) + { merge(__source); } +#endif // C++17 + +#if __cplusplus > 201402L +#define __cpp_lib_map_try_emplace 201411 + /** + * @brief Attempts to build and insert a std::pair into the %map. + * + * @param __k Key to use for finding a possibly existing pair in + * the map. + * @param __args Arguments used to generate the .second for a new pair + * instance. + * + * @return A pair, of which the first element is an iterator that points + * to the possibly inserted pair, and the second is a bool that + * is true if the pair was actually inserted. + * + * This function attempts to build and insert a (key, value) %pair into + * the %map. + * A %map relies on unique keys and thus a %pair is only inserted if its + * first element (the key) is not already present in the %map. + * If a %pair is not inserted, this function has no effect. + * + * Insertion requires logarithmic time. + */ + template + pair + try_emplace(const key_type& __k, _Args&&... __args) + { + iterator __i = lower_bound(__k); + if (__i == end() || key_comp()(__k, (*__i).first)) + { + __i = emplace_hint(__i, std::piecewise_construct, + std::forward_as_tuple(__k), + std::forward_as_tuple( + std::forward<_Args>(__args)...)); + return {__i, true}; + } + return {__i, false}; + } + + // move-capable overload + template + pair + try_emplace(key_type&& __k, _Args&&... __args) + { + iterator __i = lower_bound(__k); + if (__i == end() || key_comp()(__k, (*__i).first)) + { + __i = emplace_hint(__i, std::piecewise_construct, + std::forward_as_tuple(std::move(__k)), + std::forward_as_tuple( + std::forward<_Args>(__args)...)); + return {__i, true}; + } + return {__i, false}; + } + + /** + * @brief Attempts to build and insert a std::pair into the %map. + * + * @param __hint An iterator that serves as a hint as to where the + * pair should be inserted. + * @param __k Key to use for finding a possibly existing pair in + * the map. + * @param __args Arguments used to generate the .second for a new pair + * instance. + * @return An iterator that points to the element with key of the + * std::pair built from @a __args (may or may not be that + * std::pair). + * + * This function is not concerned about whether the insertion took place, + * and thus does not return a boolean like the single-argument + * try_emplace() does. However, if insertion did not take place, + * this function has no effect. + * Note that the first parameter is only a hint and can potentially + * improve the performance of the insertion process. A bad hint would + * cause no gains in efficiency. + * + * See + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints + * for more on @a hinting. + * + * Insertion requires logarithmic time (if the hint is not taken). + */ + template + iterator + try_emplace(const_iterator __hint, const key_type& __k, + _Args&&... __args) + { + iterator __i; + auto __true_hint = _M_t._M_get_insert_hint_unique_pos(__hint, __k); + if (__true_hint.second) + __i = emplace_hint(iterator(__true_hint.second), + std::piecewise_construct, + std::forward_as_tuple(__k), + std::forward_as_tuple( + std::forward<_Args>(__args)...)); + else + __i = iterator(__true_hint.first); + return __i; + } + + // move-capable overload + template + iterator + try_emplace(const_iterator __hint, key_type&& __k, _Args&&... __args) + { + iterator __i; + auto __true_hint = _M_t._M_get_insert_hint_unique_pos(__hint, __k); + if (__true_hint.second) + __i = emplace_hint(iterator(__true_hint.second), + std::piecewise_construct, + std::forward_as_tuple(std::move(__k)), + std::forward_as_tuple( + std::forward<_Args>(__args)...)); + else + __i = iterator(__true_hint.first); + return __i; + } +#endif + + /** + * @brief Attempts to insert a std::pair into the %map. + * @param __x Pair to be inserted (see std::make_pair for easy + * creation of pairs). + * + * @return A pair, of which the first element is an iterator that + * points to the possibly inserted pair, and the second is + * a bool that is true if the pair was actually inserted. + * + * This function attempts to insert a (key, value) %pair into the %map. + * A %map relies on unique keys and thus a %pair is only inserted if its + * first element (the key) is not already present in the %map. + * + * Insertion requires logarithmic time. + * @{ + */ + std::pair + insert(const value_type& __x) + { return _M_t._M_insert_unique(__x); } + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2354. Unnecessary copying when inserting into maps with braced-init + std::pair + insert(value_type&& __x) + { return _M_t._M_insert_unique(std::move(__x)); } + + template::value>::type> + std::pair + insert(_Pair&& __x) + { return _M_t._M_insert_unique(std::forward<_Pair>(__x)); } +#endif + // @} + +#if __cplusplus >= 201103L + /** + * @brief Attempts to insert a list of std::pairs into the %map. + * @param __list A std::initializer_list of pairs to be + * inserted. + * + * Complexity similar to that of the range constructor. + */ + void + insert(std::initializer_list __list) + { insert(__list.begin(), __list.end()); } +#endif + + /** + * @brief Attempts to insert a std::pair into the %map. + * @param __position An iterator that serves as a hint as to where the + * pair should be inserted. + * @param __x Pair to be inserted (see std::make_pair for easy creation + * of pairs). + * @return An iterator that points to the element with key of + * @a __x (may or may not be the %pair passed in). + * + + * This function is not concerned about whether the insertion + * took place, and thus does not return a boolean like the + * single-argument insert() does. Note that the first + * parameter is only a hint and can potentially improve the + * performance of the insertion process. A bad hint would + * cause no gains in efficiency. + * + * See + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints + * for more on @a hinting. + * + * Insertion requires logarithmic time (if the hint is not taken). + * @{ + */ + iterator +#if __cplusplus >= 201103L + insert(const_iterator __position, const value_type& __x) +#else + insert(iterator __position, const value_type& __x) +#endif + { return _M_t._M_insert_unique_(__position, __x); } + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2354. Unnecessary copying when inserting into maps with braced-init + iterator + insert(const_iterator __position, value_type&& __x) + { return _M_t._M_insert_unique_(__position, std::move(__x)); } + + template::value>::type> + iterator + insert(const_iterator __position, _Pair&& __x) + { return _M_t._M_insert_unique_(__position, + std::forward<_Pair>(__x)); } +#endif + // @} + + /** + * @brief Template function that attempts to insert a range of elements. + * @param __first Iterator pointing to the start of the range to be + * inserted. + * @param __last Iterator pointing to the end of the range. + * + * Complexity similar to that of the range constructor. + */ + template + void + insert(_InputIterator __first, _InputIterator __last) + { _M_t._M_insert_unique(__first, __last); } + +#if __cplusplus > 201402L +#define __cpp_lib_map_insertion 201411 + /** + * @brief Attempts to insert or assign a std::pair into the %map. + * @param __k Key to use for finding a possibly existing pair in + * the map. + * @param __obj Argument used to generate the .second for a pair + * instance. + * + * @return A pair, of which the first element is an iterator that + * points to the possibly inserted pair, and the second is + * a bool that is true if the pair was actually inserted. + * + * This function attempts to insert a (key, value) %pair into the %map. + * A %map relies on unique keys and thus a %pair is only inserted if its + * first element (the key) is not already present in the %map. + * If the %pair was already in the %map, the .second of the %pair + * is assigned from __obj. + * + * Insertion requires logarithmic time. + */ + template + pair + insert_or_assign(const key_type& __k, _Obj&& __obj) + { + iterator __i = lower_bound(__k); + if (__i == end() || key_comp()(__k, (*__i).first)) + { + __i = emplace_hint(__i, std::piecewise_construct, + std::forward_as_tuple(__k), + std::forward_as_tuple( + std::forward<_Obj>(__obj))); + return {__i, true}; + } + (*__i).second = std::forward<_Obj>(__obj); + return {__i, false}; + } + + // move-capable overload + template + pair + insert_or_assign(key_type&& __k, _Obj&& __obj) + { + iterator __i = lower_bound(__k); + if (__i == end() || key_comp()(__k, (*__i).first)) + { + __i = emplace_hint(__i, std::piecewise_construct, + std::forward_as_tuple(std::move(__k)), + std::forward_as_tuple( + std::forward<_Obj>(__obj))); + return {__i, true}; + } + (*__i).second = std::forward<_Obj>(__obj); + return {__i, false}; + } + + /** + * @brief Attempts to insert or assign a std::pair into the %map. + * @param __hint An iterator that serves as a hint as to where the + * pair should be inserted. + * @param __k Key to use for finding a possibly existing pair in + * the map. + * @param __obj Argument used to generate the .second for a pair + * instance. + * + * @return An iterator that points to the element with key of + * @a __x (may or may not be the %pair passed in). + * + * This function attempts to insert a (key, value) %pair into the %map. + * A %map relies on unique keys and thus a %pair is only inserted if its + * first element (the key) is not already present in the %map. + * If the %pair was already in the %map, the .second of the %pair + * is assigned from __obj. + * + * Insertion requires logarithmic time. + */ + template + iterator + insert_or_assign(const_iterator __hint, + const key_type& __k, _Obj&& __obj) + { + iterator __i; + auto __true_hint = _M_t._M_get_insert_hint_unique_pos(__hint, __k); + if (__true_hint.second) + { + return emplace_hint(iterator(__true_hint.second), + std::piecewise_construct, + std::forward_as_tuple(__k), + std::forward_as_tuple( + std::forward<_Obj>(__obj))); + } + __i = iterator(__true_hint.first); + (*__i).second = std::forward<_Obj>(__obj); + return __i; + } + + // move-capable overload + template + iterator + insert_or_assign(const_iterator __hint, key_type&& __k, _Obj&& __obj) + { + iterator __i; + auto __true_hint = _M_t._M_get_insert_hint_unique_pos(__hint, __k); + if (__true_hint.second) + { + return emplace_hint(iterator(__true_hint.second), + std::piecewise_construct, + std::forward_as_tuple(std::move(__k)), + std::forward_as_tuple( + std::forward<_Obj>(__obj))); + } + __i = iterator(__true_hint.first); + (*__i).second = std::forward<_Obj>(__obj); + return __i; + } +#endif + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 130. Associative erase should return an iterator. + /** + * @brief Erases an element from a %map. + * @param __position An iterator pointing to the element to be erased. + * @return An iterator pointing to the element immediately following + * @a position prior to the element being erased. If no such + * element exists, end() is returned. + * + * This function erases an element, pointed to by the given + * iterator, from a %map. Note that this function only erases + * the element, and that if the element is itself a pointer, + * the pointed-to memory is not touched in any way. Managing + * the pointer is the user's responsibility. + * + * @{ + */ + iterator + erase(const_iterator __position) + { return _M_t.erase(__position); } + + // LWG 2059 + _GLIBCXX_ABI_TAG_CXX11 + iterator + erase(iterator __position) + { return _M_t.erase(__position); } + // @} +#else + /** + * @brief Erases an element from a %map. + * @param __position An iterator pointing to the element to be erased. + * + * This function erases an element, pointed to by the given + * iterator, from a %map. Note that this function only erases + * the element, and that if the element is itself a pointer, + * the pointed-to memory is not touched in any way. Managing + * the pointer is the user's responsibility. + */ + void + erase(iterator __position) + { _M_t.erase(__position); } +#endif + + /** + * @brief Erases elements according to the provided key. + * @param __x Key of element to be erased. + * @return The number of elements erased. + * + * This function erases all the elements located by the given key from + * a %map. + * Note that this function only erases the element, and that if + * the element is itself a pointer, the pointed-to memory is not touched + * in any way. Managing the pointer is the user's responsibility. + */ + size_type + erase(const key_type& __x) + { return _M_t.erase(__x); } + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 130. Associative erase should return an iterator. + /** + * @brief Erases a [first,last) range of elements from a %map. + * @param __first Iterator pointing to the start of the range to be + * erased. + * @param __last Iterator pointing to the end of the range to + * be erased. + * @return The iterator @a __last. + * + * This function erases a sequence of elements from a %map. + * Note that this function only erases the element, and that if + * the element is itself a pointer, the pointed-to memory is not touched + * in any way. Managing the pointer is the user's responsibility. + */ + iterator + erase(const_iterator __first, const_iterator __last) + { return _M_t.erase(__first, __last); } +#else + /** + * @brief Erases a [__first,__last) range of elements from a %map. + * @param __first Iterator pointing to the start of the range to be + * erased. + * @param __last Iterator pointing to the end of the range to + * be erased. + * + * This function erases a sequence of elements from a %map. + * Note that this function only erases the element, and that if + * the element is itself a pointer, the pointed-to memory is not touched + * in any way. Managing the pointer is the user's responsibility. + */ + void + erase(iterator __first, iterator __last) + { _M_t.erase(__first, __last); } +#endif + + /** + * @brief Swaps data with another %map. + * @param __x A %map of the same element and allocator types. + * + * This exchanges the elements between two maps in constant + * time. (It is only swapping a pointer, an integer, and an + * instance of the @c Compare type (which itself is often + * stateless and empty), so it should be quite fast.) Note + * that the global std::swap() function is specialized such + * that std::swap(m1,m2) will feed to this function. + * + * Whether the allocators are swapped depends on the allocator traits. + */ + void + swap(map& __x) + _GLIBCXX_NOEXCEPT_IF(__is_nothrow_swappable<_Compare>::value) + { _M_t.swap(__x._M_t); } + + /** + * Erases all elements in a %map. Note that this function only + * erases the elements, and that if the elements themselves are + * pointers, the pointed-to memory is not touched in any way. + * Managing the pointer is the user's responsibility. + */ + void + clear() _GLIBCXX_NOEXCEPT + { _M_t.clear(); } + + // observers + /** + * Returns the key comparison object out of which the %map was + * constructed. + */ + key_compare + key_comp() const + { return _M_t.key_comp(); } + + /** + * Returns a value comparison object, built from the key comparison + * object out of which the %map was constructed. + */ + value_compare + value_comp() const + { return value_compare(_M_t.key_comp()); } + + // [23.3.1.3] map operations + + //@{ + /** + * @brief Tries to locate an element in a %map. + * @param __x Key of (key, value) %pair to be located. + * @return Iterator pointing to sought-after element, or end() if not + * found. + * + * This function takes a key and tries to locate the element with which + * the key matches. If successful the function returns an iterator + * pointing to the sought after %pair. If unsuccessful it returns the + * past-the-end ( @c end() ) iterator. + */ + + iterator + find(const key_type& __x) + { return _M_t.find(__x); } + +#if __cplusplus > 201103L + template + auto + find(const _Kt& __x) -> decltype(_M_t._M_find_tr(__x)) + { return _M_t._M_find_tr(__x); } +#endif + //@} + + //@{ + /** + * @brief Tries to locate an element in a %map. + * @param __x Key of (key, value) %pair to be located. + * @return Read-only (constant) iterator pointing to sought-after + * element, or end() if not found. + * + * This function takes a key and tries to locate the element with which + * the key matches. If successful the function returns a constant + * iterator pointing to the sought after %pair. If unsuccessful it + * returns the past-the-end ( @c end() ) iterator. + */ + + const_iterator + find(const key_type& __x) const + { return _M_t.find(__x); } + +#if __cplusplus > 201103L + template + auto + find(const _Kt& __x) const -> decltype(_M_t._M_find_tr(__x)) + { return _M_t._M_find_tr(__x); } +#endif + //@} + + //@{ + /** + * @brief Finds the number of elements with given key. + * @param __x Key of (key, value) pairs to be located. + * @return Number of elements with specified key. + * + * This function only makes sense for multimaps; for map the result will + * either be 0 (not present) or 1 (present). + */ + size_type + count(const key_type& __x) const + { return _M_t.find(__x) == _M_t.end() ? 0 : 1; } + +#if __cplusplus > 201103L + template + auto + count(const _Kt& __x) const -> decltype(_M_t._M_count_tr(__x)) + { return _M_t._M_count_tr(__x); } +#endif + //@} + + //@{ + /** + * @brief Finds the beginning of a subsequence matching given key. + * @param __x Key of (key, value) pair to be located. + * @return Iterator pointing to first element equal to or greater + * than key, or end(). + * + * This function returns the first element of a subsequence of elements + * that matches the given key. If unsuccessful it returns an iterator + * pointing to the first element that has a greater value than given key + * or end() if no such element exists. + */ + iterator + lower_bound(const key_type& __x) + { return _M_t.lower_bound(__x); } + +#if __cplusplus > 201103L + template + auto + lower_bound(const _Kt& __x) + -> decltype(iterator(_M_t._M_lower_bound_tr(__x))) + { return iterator(_M_t._M_lower_bound_tr(__x)); } +#endif + //@} + + //@{ + /** + * @brief Finds the beginning of a subsequence matching given key. + * @param __x Key of (key, value) pair to be located. + * @return Read-only (constant) iterator pointing to first element + * equal to or greater than key, or end(). + * + * This function returns the first element of a subsequence of elements + * that matches the given key. If unsuccessful it returns an iterator + * pointing to the first element that has a greater value than given key + * or end() if no such element exists. + */ + const_iterator + lower_bound(const key_type& __x) const + { return _M_t.lower_bound(__x); } + +#if __cplusplus > 201103L + template + auto + lower_bound(const _Kt& __x) const + -> decltype(const_iterator(_M_t._M_lower_bound_tr(__x))) + { return const_iterator(_M_t._M_lower_bound_tr(__x)); } +#endif + //@} + + //@{ + /** + * @brief Finds the end of a subsequence matching given key. + * @param __x Key of (key, value) pair to be located. + * @return Iterator pointing to the first element + * greater than key, or end(). + */ + iterator + upper_bound(const key_type& __x) + { return _M_t.upper_bound(__x); } + +#if __cplusplus > 201103L + template + auto + upper_bound(const _Kt& __x) + -> decltype(iterator(_M_t._M_upper_bound_tr(__x))) + { return iterator(_M_t._M_upper_bound_tr(__x)); } +#endif + //@} + + //@{ + /** + * @brief Finds the end of a subsequence matching given key. + * @param __x Key of (key, value) pair to be located. + * @return Read-only (constant) iterator pointing to first iterator + * greater than key, or end(). + */ + const_iterator + upper_bound(const key_type& __x) const + { return _M_t.upper_bound(__x); } + +#if __cplusplus > 201103L + template + auto + upper_bound(const _Kt& __x) const + -> decltype(const_iterator(_M_t._M_upper_bound_tr(__x))) + { return const_iterator(_M_t._M_upper_bound_tr(__x)); } +#endif + //@} + + //@{ + /** + * @brief Finds a subsequence matching given key. + * @param __x Key of (key, value) pairs to be located. + * @return Pair of iterators that possibly points to the subsequence + * matching given key. + * + * This function is equivalent to + * @code + * std::make_pair(c.lower_bound(val), + * c.upper_bound(val)) + * @endcode + * (but is faster than making the calls separately). + * + * This function probably only makes sense for multimaps. + */ + std::pair + equal_range(const key_type& __x) + { return _M_t.equal_range(__x); } + +#if __cplusplus > 201103L + template + auto + equal_range(const _Kt& __x) + -> decltype(pair(_M_t._M_equal_range_tr(__x))) + { return pair(_M_t._M_equal_range_tr(__x)); } +#endif + //@} + + //@{ + /** + * @brief Finds a subsequence matching given key. + * @param __x Key of (key, value) pairs to be located. + * @return Pair of read-only (constant) iterators that possibly points + * to the subsequence matching given key. + * + * This function is equivalent to + * @code + * std::make_pair(c.lower_bound(val), + * c.upper_bound(val)) + * @endcode + * (but is faster than making the calls separately). + * + * This function probably only makes sense for multimaps. + */ + std::pair + equal_range(const key_type& __x) const + { return _M_t.equal_range(__x); } + +#if __cplusplus > 201103L + template + auto + equal_range(const _Kt& __x) const + -> decltype(pair( + _M_t._M_equal_range_tr(__x))) + { + return pair( + _M_t._M_equal_range_tr(__x)); + } +#endif + //@} + + template + friend bool + operator==(const map<_K1, _T1, _C1, _A1>&, + const map<_K1, _T1, _C1, _A1>&); + + template + friend bool + operator<(const map<_K1, _T1, _C1, _A1>&, + const map<_K1, _T1, _C1, _A1>&); + }; + + /** + * @brief Map equality comparison. + * @param __x A %map. + * @param __y A %map of the same type as @a x. + * @return True iff the size and elements of the maps are equal. + * + * This is an equivalence relation. It is linear in the size of the + * maps. Maps are considered equivalent if their sizes are equal, + * and if corresponding elements compare equal. + */ + template + inline bool + operator==(const map<_Key, _Tp, _Compare, _Alloc>& __x, + const map<_Key, _Tp, _Compare, _Alloc>& __y) + { return __x._M_t == __y._M_t; } + + /** + * @brief Map ordering relation. + * @param __x A %map. + * @param __y A %map of the same type as @a x. + * @return True iff @a x is lexicographically less than @a y. + * + * This is a total ordering relation. It is linear in the size of the + * maps. The elements must be comparable with @c <. + * + * See std::lexicographical_compare() for how the determination is made. + */ + template + inline bool + operator<(const map<_Key, _Tp, _Compare, _Alloc>& __x, + const map<_Key, _Tp, _Compare, _Alloc>& __y) + { return __x._M_t < __y._M_t; } + + /// Based on operator== + template + inline bool + operator!=(const map<_Key, _Tp, _Compare, _Alloc>& __x, + const map<_Key, _Tp, _Compare, _Alloc>& __y) + { return !(__x == __y); } + + /// Based on operator< + template + inline bool + operator>(const map<_Key, _Tp, _Compare, _Alloc>& __x, + const map<_Key, _Tp, _Compare, _Alloc>& __y) + { return __y < __x; } + + /// Based on operator< + template + inline bool + operator<=(const map<_Key, _Tp, _Compare, _Alloc>& __x, + const map<_Key, _Tp, _Compare, _Alloc>& __y) + { return !(__y < __x); } + + /// Based on operator< + template + inline bool + operator>=(const map<_Key, _Tp, _Compare, _Alloc>& __x, + const map<_Key, _Tp, _Compare, _Alloc>& __y) + { return !(__x < __y); } + + /// See std::map::swap(). + template + inline void + swap(map<_Key, _Tp, _Compare, _Alloc>& __x, + map<_Key, _Tp, _Compare, _Alloc>& __y) + _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y))) + { __x.swap(__y); } + +_GLIBCXX_END_NAMESPACE_CONTAINER + +#if __cplusplus > 201402L +_GLIBCXX_BEGIN_NAMESPACE_VERSION + // Allow std::map access to internals of compatible maps. + template + struct + _Rb_tree_merge_helper<_GLIBCXX_STD_C::map<_Key, _Val, _Cmp1, _Alloc>, + _Cmp2> + { + private: + friend class _GLIBCXX_STD_C::map<_Key, _Val, _Cmp1, _Alloc>; + + static auto& + _S_get_tree(_GLIBCXX_STD_C::map<_Key, _Val, _Cmp2, _Alloc>& __map) + { return __map._M_t; } + + static auto& + _S_get_tree(_GLIBCXX_STD_C::multimap<_Key, _Val, _Cmp2, _Alloc>& __map) + { return __map._M_t; } + }; +_GLIBCXX_END_NAMESPACE_VERSION +#endif // C++17 + +} // namespace std + +#endif /* _STL_MAP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_multimap.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_multimap.h new file mode 100644 index 0000000..68ffea3 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_multimap.h @@ -0,0 +1,1145 @@ +// Multimap implementation -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_multimap.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{map} + */ + +#ifndef _STL_MULTIMAP_H +#define _STL_MULTIMAP_H 1 + +#include +#if __cplusplus >= 201103L +#include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_CONTAINER + + template + class map; + + /** + * @brief A standard container made up of (key,value) pairs, which can be + * retrieved based on a key, in logarithmic time. + * + * @ingroup associative_containers + * + * @tparam _Key Type of key objects. + * @tparam _Tp Type of mapped objects. + * @tparam _Compare Comparison function object type, defaults to less<_Key>. + * @tparam _Alloc Allocator type, defaults to + * allocator. + * + * Meets the requirements of a container, a + * reversible container, and an + * associative container (using equivalent + * keys). For a @c multimap the key_type is Key, the mapped_type + * is T, and the value_type is std::pair. + * + * Multimaps support bidirectional iterators. + * + * The private tree data is declared exactly the same way for map and + * multimap; the distinction is made entirely in how the tree functions are + * called (*_unique versus *_equal, same as the standard). + */ + template , + typename _Alloc = std::allocator > > + class multimap + { + public: + typedef _Key key_type; + typedef _Tp mapped_type; + typedef std::pair value_type; + typedef _Compare key_compare; + typedef _Alloc allocator_type; + + private: +#ifdef _GLIBCXX_CONCEPT_CHECKS + // concept requirements + typedef typename _Alloc::value_type _Alloc_value_type; +# if __cplusplus < 201103L + __glibcxx_class_requires(_Tp, _SGIAssignableConcept) +# endif + __glibcxx_class_requires4(_Compare, bool, _Key, _Key, + _BinaryFunctionConcept) + __glibcxx_class_requires2(value_type, _Alloc_value_type, _SameTypeConcept) +#endif + + public: + class value_compare + : public std::binary_function + { + friend class multimap<_Key, _Tp, _Compare, _Alloc>; + protected: + _Compare comp; + + value_compare(_Compare __c) + : comp(__c) { } + + public: + bool operator()(const value_type& __x, const value_type& __y) const + { return comp(__x.first, __y.first); } + }; + + private: + /// This turns a red-black tree into a [multi]map. + typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template + rebind::other _Pair_alloc_type; + + typedef _Rb_tree, + key_compare, _Pair_alloc_type> _Rep_type; + /// The actual tree structure. + _Rep_type _M_t; + + typedef __gnu_cxx::__alloc_traits<_Pair_alloc_type> _Alloc_traits; + + public: + // many of these are specified differently in ISO, but the following are + // "functionally equivalent" + typedef typename _Alloc_traits::pointer pointer; + typedef typename _Alloc_traits::const_pointer const_pointer; + typedef typename _Alloc_traits::reference reference; + typedef typename _Alloc_traits::const_reference const_reference; + typedef typename _Rep_type::iterator iterator; + typedef typename _Rep_type::const_iterator const_iterator; + typedef typename _Rep_type::size_type size_type; + typedef typename _Rep_type::difference_type difference_type; + typedef typename _Rep_type::reverse_iterator reverse_iterator; + typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; + +#if __cplusplus > 201402L + using node_type = typename _Rep_type::node_type; +#endif + + // [23.3.2] construct/copy/destroy + // (get_allocator() is also listed in this section) + + /** + * @brief Default constructor creates no elements. + */ +#if __cplusplus < 201103L + multimap() : _M_t() { } +#else + multimap() = default; +#endif + + /** + * @brief Creates a %multimap with no elements. + * @param __comp A comparison object. + * @param __a An allocator object. + */ + explicit + multimap(const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, _Pair_alloc_type(__a)) { } + + /** + * @brief %Multimap copy constructor. + * + * Whether the allocator is copied depends on the allocator traits. + */ +#if __cplusplus < 201103L + multimap(const multimap& __x) + : _M_t(__x._M_t) { } +#else + multimap(const multimap&) = default; + + /** + * @brief %Multimap move constructor. + * + * The newly-created %multimap contains the exact contents of the + * moved instance. The moved instance is a valid, but unspecified + * %multimap. + */ + multimap(multimap&&) = default; + + /** + * @brief Builds a %multimap from an initializer_list. + * @param __l An initializer_list. + * @param __comp A comparison functor. + * @param __a An allocator object. + * + * Create a %multimap consisting of copies of the elements from + * the initializer_list. This is linear in N if the list is already + * sorted, and NlogN otherwise (where N is @a __l.size()). + */ + multimap(initializer_list __l, + const _Compare& __comp = _Compare(), + const allocator_type& __a = allocator_type()) + : _M_t(__comp, _Pair_alloc_type(__a)) + { _M_t._M_insert_equal(__l.begin(), __l.end()); } + + /// Allocator-extended default constructor. + explicit + multimap(const allocator_type& __a) + : _M_t(_Compare(), _Pair_alloc_type(__a)) { } + + /// Allocator-extended copy constructor. + multimap(const multimap& __m, const allocator_type& __a) + : _M_t(__m._M_t, _Pair_alloc_type(__a)) { } + + /// Allocator-extended move constructor. + multimap(multimap&& __m, const allocator_type& __a) + noexcept(is_nothrow_copy_constructible<_Compare>::value + && _Alloc_traits::_S_always_equal()) + : _M_t(std::move(__m._M_t), _Pair_alloc_type(__a)) { } + + /// Allocator-extended initialier-list constructor. + multimap(initializer_list __l, const allocator_type& __a) + : _M_t(_Compare(), _Pair_alloc_type(__a)) + { _M_t._M_insert_equal(__l.begin(), __l.end()); } + + /// Allocator-extended range constructor. + template + multimap(_InputIterator __first, _InputIterator __last, + const allocator_type& __a) + : _M_t(_Compare(), _Pair_alloc_type(__a)) + { _M_t._M_insert_equal(__first, __last); } +#endif + + /** + * @brief Builds a %multimap from a range. + * @param __first An input iterator. + * @param __last An input iterator. + * + * Create a %multimap consisting of copies of the elements from + * [__first,__last). This is linear in N if the range is already sorted, + * and NlogN otherwise (where N is distance(__first,__last)). + */ + template + multimap(_InputIterator __first, _InputIterator __last) + : _M_t() + { _M_t._M_insert_equal(__first, __last); } + + /** + * @brief Builds a %multimap from a range. + * @param __first An input iterator. + * @param __last An input iterator. + * @param __comp A comparison functor. + * @param __a An allocator object. + * + * Create a %multimap consisting of copies of the elements from + * [__first,__last). This is linear in N if the range is already sorted, + * and NlogN otherwise (where N is distance(__first,__last)). + */ + template + multimap(_InputIterator __first, _InputIterator __last, + const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, _Pair_alloc_type(__a)) + { _M_t._M_insert_equal(__first, __last); } + +#if __cplusplus >= 201103L + /** + * The dtor only erases the elements, and note that if the elements + * themselves are pointers, the pointed-to memory is not touched in any + * way. Managing the pointer is the user's responsibility. + */ + ~multimap() = default; +#endif + + /** + * @brief %Multimap assignment operator. + * + * Whether the allocator is copied depends on the allocator traits. + */ +#if __cplusplus < 201103L + multimap& + operator=(const multimap& __x) + { + _M_t = __x._M_t; + return *this; + } +#else + multimap& + operator=(const multimap&) = default; + + /// Move assignment operator. + multimap& + operator=(multimap&&) = default; + + /** + * @brief %Multimap list assignment operator. + * @param __l An initializer_list. + * + * This function fills a %multimap with copies of the elements + * in the initializer list @a __l. + * + * Note that the assignment completely changes the %multimap and + * that the resulting %multimap's size is the same as the number + * of elements assigned. + */ + multimap& + operator=(initializer_list __l) + { + _M_t._M_assign_equal(__l.begin(), __l.end()); + return *this; + } +#endif + + /// Get a copy of the memory allocation object. + allocator_type + get_allocator() const _GLIBCXX_NOEXCEPT + { return allocator_type(_M_t.get_allocator()); } + + // iterators + /** + * Returns a read/write iterator that points to the first pair in the + * %multimap. Iteration is done in ascending order according to the + * keys. + */ + iterator + begin() _GLIBCXX_NOEXCEPT + { return _M_t.begin(); } + + /** + * Returns a read-only (constant) iterator that points to the first pair + * in the %multimap. Iteration is done in ascending order according to + * the keys. + */ + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return _M_t.begin(); } + + /** + * Returns a read/write iterator that points one past the last pair in + * the %multimap. Iteration is done in ascending order according to the + * keys. + */ + iterator + end() _GLIBCXX_NOEXCEPT + { return _M_t.end(); } + + /** + * Returns a read-only (constant) iterator that points one past the last + * pair in the %multimap. Iteration is done in ascending order according + * to the keys. + */ + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return _M_t.end(); } + + /** + * Returns a read/write reverse iterator that points to the last pair in + * the %multimap. Iteration is done in descending order according to the + * keys. + */ + reverse_iterator + rbegin() _GLIBCXX_NOEXCEPT + { return _M_t.rbegin(); } + + /** + * Returns a read-only (constant) reverse iterator that points to the + * last pair in the %multimap. Iteration is done in descending order + * according to the keys. + */ + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return _M_t.rbegin(); } + + /** + * Returns a read/write reverse iterator that points to one before the + * first pair in the %multimap. Iteration is done in descending order + * according to the keys. + */ + reverse_iterator + rend() _GLIBCXX_NOEXCEPT + { return _M_t.rend(); } + + /** + * Returns a read-only (constant) reverse iterator that points to one + * before the first pair in the %multimap. Iteration is done in + * descending order according to the keys. + */ + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return _M_t.rend(); } + +#if __cplusplus >= 201103L + /** + * Returns a read-only (constant) iterator that points to the first pair + * in the %multimap. Iteration is done in ascending order according to + * the keys. + */ + const_iterator + cbegin() const noexcept + { return _M_t.begin(); } + + /** + * Returns a read-only (constant) iterator that points one past the last + * pair in the %multimap. Iteration is done in ascending order according + * to the keys. + */ + const_iterator + cend() const noexcept + { return _M_t.end(); } + + /** + * Returns a read-only (constant) reverse iterator that points to the + * last pair in the %multimap. Iteration is done in descending order + * according to the keys. + */ + const_reverse_iterator + crbegin() const noexcept + { return _M_t.rbegin(); } + + /** + * Returns a read-only (constant) reverse iterator that points to one + * before the first pair in the %multimap. Iteration is done in + * descending order according to the keys. + */ + const_reverse_iterator + crend() const noexcept + { return _M_t.rend(); } +#endif + + // capacity + /** Returns true if the %multimap is empty. */ + bool + empty() const _GLIBCXX_NOEXCEPT + { return _M_t.empty(); } + + /** Returns the size of the %multimap. */ + size_type + size() const _GLIBCXX_NOEXCEPT + { return _M_t.size(); } + + /** Returns the maximum size of the %multimap. */ + size_type + max_size() const _GLIBCXX_NOEXCEPT + { return _M_t.max_size(); } + + // modifiers +#if __cplusplus >= 201103L + /** + * @brief Build and insert a std::pair into the %multimap. + * + * @param __args Arguments used to generate a new pair instance (see + * std::piecewise_contruct for passing arguments to each + * part of the pair constructor). + * + * @return An iterator that points to the inserted (key,value) pair. + * + * This function builds and inserts a (key, value) %pair into the + * %multimap. + * Contrary to a std::map the %multimap does not rely on unique keys and + * thus multiple pairs with the same key can be inserted. + * + * Insertion requires logarithmic time. + */ + template + iterator + emplace(_Args&&... __args) + { return _M_t._M_emplace_equal(std::forward<_Args>(__args)...); } + + /** + * @brief Builds and inserts a std::pair into the %multimap. + * + * @param __pos An iterator that serves as a hint as to where the pair + * should be inserted. + * @param __args Arguments used to generate a new pair instance (see + * std::piecewise_contruct for passing arguments to each + * part of the pair constructor). + * @return An iterator that points to the inserted (key,value) pair. + * + * This function inserts a (key, value) pair into the %multimap. + * Contrary to a std::map the %multimap does not rely on unique keys and + * thus multiple pairs with the same key can be inserted. + * Note that the first parameter is only a hint and can potentially + * improve the performance of the insertion process. A bad hint would + * cause no gains in efficiency. + * + * For more on @a hinting, see: + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints + * + * Insertion requires logarithmic time (if the hint is not taken). + */ + template + iterator + emplace_hint(const_iterator __pos, _Args&&... __args) + { + return _M_t._M_emplace_hint_equal(__pos, + std::forward<_Args>(__args)...); + } +#endif + + /** + * @brief Inserts a std::pair into the %multimap. + * @param __x Pair to be inserted (see std::make_pair for easy creation + * of pairs). + * @return An iterator that points to the inserted (key,value) pair. + * + * This function inserts a (key, value) pair into the %multimap. + * Contrary to a std::map the %multimap does not rely on unique keys and + * thus multiple pairs with the same key can be inserted. + * + * Insertion requires logarithmic time. + * @{ + */ + iterator + insert(const value_type& __x) + { return _M_t._M_insert_equal(__x); } + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2354. Unnecessary copying when inserting into maps with braced-init + iterator + insert(value_type&& __x) + { return _M_t._M_insert_equal(std::move(__x)); } + + template::value>::type> + iterator + insert(_Pair&& __x) + { return _M_t._M_insert_equal(std::forward<_Pair>(__x)); } +#endif + // @} + + /** + * @brief Inserts a std::pair into the %multimap. + * @param __position An iterator that serves as a hint as to where the + * pair should be inserted. + * @param __x Pair to be inserted (see std::make_pair for easy creation + * of pairs). + * @return An iterator that points to the inserted (key,value) pair. + * + * This function inserts a (key, value) pair into the %multimap. + * Contrary to a std::map the %multimap does not rely on unique keys and + * thus multiple pairs with the same key can be inserted. + * Note that the first parameter is only a hint and can potentially + * improve the performance of the insertion process. A bad hint would + * cause no gains in efficiency. + * + * For more on @a hinting, see: + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints + * + * Insertion requires logarithmic time (if the hint is not taken). + * @{ + */ + iterator +#if __cplusplus >= 201103L + insert(const_iterator __position, const value_type& __x) +#else + insert(iterator __position, const value_type& __x) +#endif + { return _M_t._M_insert_equal_(__position, __x); } + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2354. Unnecessary copying when inserting into maps with braced-init + iterator + insert(const_iterator __position, value_type&& __x) + { return _M_t._M_insert_equal_(__position, std::move(__x)); } + + template::value>::type> + iterator + insert(const_iterator __position, _Pair&& __x) + { return _M_t._M_insert_equal_(__position, + std::forward<_Pair>(__x)); } +#endif + // @} + + /** + * @brief A template function that attempts to insert a range + * of elements. + * @param __first Iterator pointing to the start of the range to be + * inserted. + * @param __last Iterator pointing to the end of the range. + * + * Complexity similar to that of the range constructor. + */ + template + void + insert(_InputIterator __first, _InputIterator __last) + { _M_t._M_insert_equal(__first, __last); } + +#if __cplusplus >= 201103L + /** + * @brief Attempts to insert a list of std::pairs into the %multimap. + * @param __l A std::initializer_list of pairs to be + * inserted. + * + * Complexity similar to that of the range constructor. + */ + void + insert(initializer_list __l) + { this->insert(__l.begin(), __l.end()); } +#endif + +#if __cplusplus > 201402L + /// Extract a node. + node_type + extract(const_iterator __pos) + { + __glibcxx_assert(__pos != end()); + return _M_t.extract(__pos); + } + + /// Extract a node. + node_type + extract(const key_type& __x) + { return _M_t.extract(__x); } + + /// Re-insert an extracted node. + iterator + insert(node_type&& __nh) + { return _M_t._M_reinsert_node_equal(std::move(__nh)); } + + /// Re-insert an extracted node. + iterator + insert(const_iterator __hint, node_type&& __nh) + { return _M_t._M_reinsert_node_hint_equal(__hint, std::move(__nh)); } + + template + friend class _Rb_tree_merge_helper; + + template + void + merge(multimap<_Key, _Tp, _C2, _Alloc>& __source) + { + using _Merge_helper = _Rb_tree_merge_helper; + _M_t._M_merge_equal(_Merge_helper::_S_get_tree(__source)); + } + + template + void + merge(multimap<_Key, _Tp, _C2, _Alloc>&& __source) + { merge(__source); } + + template + void + merge(map<_Key, _Tp, _C2, _Alloc>& __source) + { + using _Merge_helper = _Rb_tree_merge_helper; + _M_t._M_merge_equal(_Merge_helper::_S_get_tree(__source)); + } + + template + void + merge(map<_Key, _Tp, _C2, _Alloc>&& __source) + { merge(__source); } +#endif // C++17 + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 130. Associative erase should return an iterator. + /** + * @brief Erases an element from a %multimap. + * @param __position An iterator pointing to the element to be erased. + * @return An iterator pointing to the element immediately following + * @a position prior to the element being erased. If no such + * element exists, end() is returned. + * + * This function erases an element, pointed to by the given iterator, + * from a %multimap. Note that this function only erases the element, + * and that if the element is itself a pointer, the pointed-to memory is + * not touched in any way. Managing the pointer is the user's + * responsibility. + * + * @{ + */ + iterator + erase(const_iterator __position) + { return _M_t.erase(__position); } + + // LWG 2059. + _GLIBCXX_ABI_TAG_CXX11 + iterator + erase(iterator __position) + { return _M_t.erase(__position); } + // @} +#else + /** + * @brief Erases an element from a %multimap. + * @param __position An iterator pointing to the element to be erased. + * + * This function erases an element, pointed to by the given iterator, + * from a %multimap. Note that this function only erases the element, + * and that if the element is itself a pointer, the pointed-to memory is + * not touched in any way. Managing the pointer is the user's + * responsibility. + */ + void + erase(iterator __position) + { _M_t.erase(__position); } +#endif + + /** + * @brief Erases elements according to the provided key. + * @param __x Key of element to be erased. + * @return The number of elements erased. + * + * This function erases all elements located by the given key from a + * %multimap. + * Note that this function only erases the element, and that if + * the element is itself a pointer, the pointed-to memory is not touched + * in any way. Managing the pointer is the user's responsibility. + */ + size_type + erase(const key_type& __x) + { return _M_t.erase(__x); } + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 130. Associative erase should return an iterator. + /** + * @brief Erases a [first,last) range of elements from a %multimap. + * @param __first Iterator pointing to the start of the range to be + * erased. + * @param __last Iterator pointing to the end of the range to be + * erased . + * @return The iterator @a __last. + * + * This function erases a sequence of elements from a %multimap. + * Note that this function only erases the elements, and that if + * the elements themselves are pointers, the pointed-to memory is not + * touched in any way. Managing the pointer is the user's + * responsibility. + */ + iterator + erase(const_iterator __first, const_iterator __last) + { return _M_t.erase(__first, __last); } +#else + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 130. Associative erase should return an iterator. + /** + * @brief Erases a [first,last) range of elements from a %multimap. + * @param __first Iterator pointing to the start of the range to be + * erased. + * @param __last Iterator pointing to the end of the range to + * be erased. + * + * This function erases a sequence of elements from a %multimap. + * Note that this function only erases the elements, and that if + * the elements themselves are pointers, the pointed-to memory is not + * touched in any way. Managing the pointer is the user's + * responsibility. + */ + void + erase(iterator __first, iterator __last) + { _M_t.erase(__first, __last); } +#endif + + /** + * @brief Swaps data with another %multimap. + * @param __x A %multimap of the same element and allocator types. + * + * This exchanges the elements between two multimaps in constant time. + * (It is only swapping a pointer, an integer, and an instance of + * the @c Compare type (which itself is often stateless and empty), so it + * should be quite fast.) + * Note that the global std::swap() function is specialized such that + * std::swap(m1,m2) will feed to this function. + * + * Whether the allocators are swapped depends on the allocator traits. + */ + void + swap(multimap& __x) + _GLIBCXX_NOEXCEPT_IF(__is_nothrow_swappable<_Compare>::value) + { _M_t.swap(__x._M_t); } + + /** + * Erases all elements in a %multimap. Note that this function only + * erases the elements, and that if the elements themselves are pointers, + * the pointed-to memory is not touched in any way. Managing the pointer + * is the user's responsibility. + */ + void + clear() _GLIBCXX_NOEXCEPT + { _M_t.clear(); } + + // observers + /** + * Returns the key comparison object out of which the %multimap + * was constructed. + */ + key_compare + key_comp() const + { return _M_t.key_comp(); } + + /** + * Returns a value comparison object, built from the key comparison + * object out of which the %multimap was constructed. + */ + value_compare + value_comp() const + { return value_compare(_M_t.key_comp()); } + + // multimap operations + + //@{ + /** + * @brief Tries to locate an element in a %multimap. + * @param __x Key of (key, value) pair to be located. + * @return Iterator pointing to sought-after element, + * or end() if not found. + * + * This function takes a key and tries to locate the element with which + * the key matches. If successful the function returns an iterator + * pointing to the sought after %pair. If unsuccessful it returns the + * past-the-end ( @c end() ) iterator. + */ + iterator + find(const key_type& __x) + { return _M_t.find(__x); } + +#if __cplusplus > 201103L + template + auto + find(const _Kt& __x) -> decltype(_M_t._M_find_tr(__x)) + { return _M_t._M_find_tr(__x); } +#endif + //@} + + //@{ + /** + * @brief Tries to locate an element in a %multimap. + * @param __x Key of (key, value) pair to be located. + * @return Read-only (constant) iterator pointing to sought-after + * element, or end() if not found. + * + * This function takes a key and tries to locate the element with which + * the key matches. If successful the function returns a constant + * iterator pointing to the sought after %pair. If unsuccessful it + * returns the past-the-end ( @c end() ) iterator. + */ + const_iterator + find(const key_type& __x) const + { return _M_t.find(__x); } + +#if __cplusplus > 201103L + template + auto + find(const _Kt& __x) const -> decltype(_M_t._M_find_tr(__x)) + { return _M_t._M_find_tr(__x); } +#endif + //@} + + //@{ + /** + * @brief Finds the number of elements with given key. + * @param __x Key of (key, value) pairs to be located. + * @return Number of elements with specified key. + */ + size_type + count(const key_type& __x) const + { return _M_t.count(__x); } + +#if __cplusplus > 201103L + template + auto + count(const _Kt& __x) const -> decltype(_M_t._M_count_tr(__x)) + { return _M_t._M_count_tr(__x); } +#endif + //@} + + //@{ + /** + * @brief Finds the beginning of a subsequence matching given key. + * @param __x Key of (key, value) pair to be located. + * @return Iterator pointing to first element equal to or greater + * than key, or end(). + * + * This function returns the first element of a subsequence of elements + * that matches the given key. If unsuccessful it returns an iterator + * pointing to the first element that has a greater value than given key + * or end() if no such element exists. + */ + iterator + lower_bound(const key_type& __x) + { return _M_t.lower_bound(__x); } + +#if __cplusplus > 201103L + template + auto + lower_bound(const _Kt& __x) + -> decltype(iterator(_M_t._M_lower_bound_tr(__x))) + { return iterator(_M_t._M_lower_bound_tr(__x)); } +#endif + //@} + + //@{ + /** + * @brief Finds the beginning of a subsequence matching given key. + * @param __x Key of (key, value) pair to be located. + * @return Read-only (constant) iterator pointing to first element + * equal to or greater than key, or end(). + * + * This function returns the first element of a subsequence of + * elements that matches the given key. If unsuccessful the + * iterator will point to the next greatest element or, if no + * such greater element exists, to end(). + */ + const_iterator + lower_bound(const key_type& __x) const + { return _M_t.lower_bound(__x); } + +#if __cplusplus > 201103L + template + auto + lower_bound(const _Kt& __x) const + -> decltype(const_iterator(_M_t._M_lower_bound_tr(__x))) + { return const_iterator(_M_t._M_lower_bound_tr(__x)); } +#endif + //@} + + //@{ + /** + * @brief Finds the end of a subsequence matching given key. + * @param __x Key of (key, value) pair to be located. + * @return Iterator pointing to the first element + * greater than key, or end(). + */ + iterator + upper_bound(const key_type& __x) + { return _M_t.upper_bound(__x); } + +#if __cplusplus > 201103L + template + auto + upper_bound(const _Kt& __x) + -> decltype(iterator(_M_t._M_upper_bound_tr(__x))) + { return iterator(_M_t._M_upper_bound_tr(__x)); } +#endif + //@} + + //@{ + /** + * @brief Finds the end of a subsequence matching given key. + * @param __x Key of (key, value) pair to be located. + * @return Read-only (constant) iterator pointing to first iterator + * greater than key, or end(). + */ + const_iterator + upper_bound(const key_type& __x) const + { return _M_t.upper_bound(__x); } + +#if __cplusplus > 201103L + template + auto + upper_bound(const _Kt& __x) const + -> decltype(const_iterator(_M_t._M_upper_bound_tr(__x))) + { return const_iterator(_M_t._M_upper_bound_tr(__x)); } +#endif + //@} + + //@{ + /** + * @brief Finds a subsequence matching given key. + * @param __x Key of (key, value) pairs to be located. + * @return Pair of iterators that possibly points to the subsequence + * matching given key. + * + * This function is equivalent to + * @code + * std::make_pair(c.lower_bound(val), + * c.upper_bound(val)) + * @endcode + * (but is faster than making the calls separately). + */ + std::pair + equal_range(const key_type& __x) + { return _M_t.equal_range(__x); } + +#if __cplusplus > 201103L + template + auto + equal_range(const _Kt& __x) + -> decltype(pair(_M_t._M_equal_range_tr(__x))) + { return pair(_M_t._M_equal_range_tr(__x)); } +#endif + //@} + + //@{ + /** + * @brief Finds a subsequence matching given key. + * @param __x Key of (key, value) pairs to be located. + * @return Pair of read-only (constant) iterators that possibly points + * to the subsequence matching given key. + * + * This function is equivalent to + * @code + * std::make_pair(c.lower_bound(val), + * c.upper_bound(val)) + * @endcode + * (but is faster than making the calls separately). + */ + std::pair + equal_range(const key_type& __x) const + { return _M_t.equal_range(__x); } + +#if __cplusplus > 201103L + template + auto + equal_range(const _Kt& __x) const + -> decltype(pair( + _M_t._M_equal_range_tr(__x))) + { + return pair( + _M_t._M_equal_range_tr(__x)); + } +#endif + //@} + + template + friend bool + operator==(const multimap<_K1, _T1, _C1, _A1>&, + const multimap<_K1, _T1, _C1, _A1>&); + + template + friend bool + operator<(const multimap<_K1, _T1, _C1, _A1>&, + const multimap<_K1, _T1, _C1, _A1>&); + }; + + /** + * @brief Multimap equality comparison. + * @param __x A %multimap. + * @param __y A %multimap of the same type as @a __x. + * @return True iff the size and elements of the maps are equal. + * + * This is an equivalence relation. It is linear in the size of the + * multimaps. Multimaps are considered equivalent if their sizes are equal, + * and if corresponding elements compare equal. + */ + template + inline bool + operator==(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, + const multimap<_Key, _Tp, _Compare, _Alloc>& __y) + { return __x._M_t == __y._M_t; } + + /** + * @brief Multimap ordering relation. + * @param __x A %multimap. + * @param __y A %multimap of the same type as @a __x. + * @return True iff @a x is lexicographically less than @a y. + * + * This is a total ordering relation. It is linear in the size of the + * multimaps. The elements must be comparable with @c <. + * + * See std::lexicographical_compare() for how the determination is made. + */ + template + inline bool + operator<(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, + const multimap<_Key, _Tp, _Compare, _Alloc>& __y) + { return __x._M_t < __y._M_t; } + + /// Based on operator== + template + inline bool + operator!=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, + const multimap<_Key, _Tp, _Compare, _Alloc>& __y) + { return !(__x == __y); } + + /// Based on operator< + template + inline bool + operator>(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, + const multimap<_Key, _Tp, _Compare, _Alloc>& __y) + { return __y < __x; } + + /// Based on operator< + template + inline bool + operator<=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, + const multimap<_Key, _Tp, _Compare, _Alloc>& __y) + { return !(__y < __x); } + + /// Based on operator< + template + inline bool + operator>=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x, + const multimap<_Key, _Tp, _Compare, _Alloc>& __y) + { return !(__x < __y); } + + /// See std::multimap::swap(). + template + inline void + swap(multimap<_Key, _Tp, _Compare, _Alloc>& __x, + multimap<_Key, _Tp, _Compare, _Alloc>& __y) + _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y))) + { __x.swap(__y); } + +_GLIBCXX_END_NAMESPACE_CONTAINER + +#if __cplusplus > 201402L +_GLIBCXX_BEGIN_NAMESPACE_VERSION + // Allow std::multimap access to internals of compatible maps. + template + struct + _Rb_tree_merge_helper<_GLIBCXX_STD_C::multimap<_Key, _Val, _Cmp1, _Alloc>, + _Cmp2> + { + private: + friend class _GLIBCXX_STD_C::multimap<_Key, _Val, _Cmp1, _Alloc>; + + static auto& + _S_get_tree(_GLIBCXX_STD_C::map<_Key, _Val, _Cmp2, _Alloc>& __map) + { return __map._M_t; } + + static auto& + _S_get_tree(_GLIBCXX_STD_C::multimap<_Key, _Val, _Cmp2, _Alloc>& __map) + { return __map._M_t; } + }; +_GLIBCXX_END_NAMESPACE_VERSION +#endif // C++17 + +} // namespace std + +#endif /* _STL_MULTIMAP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_multiset.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_multiset.h new file mode 100644 index 0000000..60a3db8 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_multiset.h @@ -0,0 +1,979 @@ +// Multiset implementation -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_multiset.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{set} + */ + +#ifndef _STL_MULTISET_H +#define _STL_MULTISET_H 1 + +#include +#if __cplusplus >= 201103L +#include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_CONTAINER + + template + class set; + + /** + * @brief A standard container made up of elements, which can be retrieved + * in logarithmic time. + * + * @ingroup associative_containers + * + * + * @tparam _Key Type of key objects. + * @tparam _Compare Comparison function object type, defaults to less<_Key>. + * @tparam _Alloc Allocator type, defaults to allocator<_Key>. + * + * Meets the requirements of a container, a + * reversible container, and an + * associative container (using equivalent + * keys). For a @c multiset the key_type and value_type are Key. + * + * Multisets support bidirectional iterators. + * + * The private tree data is declared exactly the same way for set and + * multiset; the distinction is made entirely in how the tree functions are + * called (*_unique versus *_equal, same as the standard). + */ + template , + typename _Alloc = std::allocator<_Key> > + class multiset + { +#ifdef _GLIBCXX_CONCEPT_CHECKS + // concept requirements + typedef typename _Alloc::value_type _Alloc_value_type; +# if __cplusplus < 201103L + __glibcxx_class_requires(_Key, _SGIAssignableConcept) +# endif + __glibcxx_class_requires4(_Compare, bool, _Key, _Key, + _BinaryFunctionConcept) + __glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept) +#endif + + public: + // typedefs: + typedef _Key key_type; + typedef _Key value_type; + typedef _Compare key_compare; + typedef _Compare value_compare; + typedef _Alloc allocator_type; + + private: + /// This turns a red-black tree into a [multi]set. + typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template + rebind<_Key>::other _Key_alloc_type; + + typedef _Rb_tree, + key_compare, _Key_alloc_type> _Rep_type; + /// The actual tree structure. + _Rep_type _M_t; + + typedef __gnu_cxx::__alloc_traits<_Key_alloc_type> _Alloc_traits; + + public: + typedef typename _Alloc_traits::pointer pointer; + typedef typename _Alloc_traits::const_pointer const_pointer; + typedef typename _Alloc_traits::reference reference; + typedef typename _Alloc_traits::const_reference const_reference; + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 103. set::iterator is required to be modifiable, + // but this allows modification of keys. + typedef typename _Rep_type::const_iterator iterator; + typedef typename _Rep_type::const_iterator const_iterator; + typedef typename _Rep_type::const_reverse_iterator reverse_iterator; + typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; + typedef typename _Rep_type::size_type size_type; + typedef typename _Rep_type::difference_type difference_type; + +#if __cplusplus > 201402L + using node_type = typename _Rep_type::node_type; +#endif + + // allocation/deallocation + /** + * @brief Default constructor creates no elements. + */ +#if __cplusplus < 201103L + multiset() : _M_t() { } +#else + multiset() = default; +#endif + + /** + * @brief Creates a %multiset with no elements. + * @param __comp Comparator to use. + * @param __a An allocator object. + */ + explicit + multiset(const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, _Key_alloc_type(__a)) { } + + /** + * @brief Builds a %multiset from a range. + * @param __first An input iterator. + * @param __last An input iterator. + * + * Create a %multiset consisting of copies of the elements from + * [first,last). This is linear in N if the range is already sorted, + * and NlogN otherwise (where N is distance(__first,__last)). + */ + template + multiset(_InputIterator __first, _InputIterator __last) + : _M_t() + { _M_t._M_insert_equal(__first, __last); } + + /** + * @brief Builds a %multiset from a range. + * @param __first An input iterator. + * @param __last An input iterator. + * @param __comp A comparison functor. + * @param __a An allocator object. + * + * Create a %multiset consisting of copies of the elements from + * [__first,__last). This is linear in N if the range is already sorted, + * and NlogN otherwise (where N is distance(__first,__last)). + */ + template + multiset(_InputIterator __first, _InputIterator __last, + const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, _Key_alloc_type(__a)) + { _M_t._M_insert_equal(__first, __last); } + + /** + * @brief %Multiset copy constructor. + * + * Whether the allocator is copied depends on the allocator traits. + */ +#if __cplusplus < 201103L + multiset(const multiset& __x) + : _M_t(__x._M_t) { } +#else + multiset(const multiset&) = default; + + /** + * @brief %Multiset move constructor. + * + * The newly-created %multiset contains the exact contents of the + * moved instance. The moved instance is a valid, but unspecified + * %multiset. + */ + multiset(multiset&&) = default; + + /** + * @brief Builds a %multiset from an initializer_list. + * @param __l An initializer_list. + * @param __comp A comparison functor. + * @param __a An allocator object. + * + * Create a %multiset consisting of copies of the elements from + * the list. This is linear in N if the list is already sorted, + * and NlogN otherwise (where N is @a __l.size()). + */ + multiset(initializer_list __l, + const _Compare& __comp = _Compare(), + const allocator_type& __a = allocator_type()) + : _M_t(__comp, _Key_alloc_type(__a)) + { _M_t._M_insert_equal(__l.begin(), __l.end()); } + + /// Allocator-extended default constructor. + explicit + multiset(const allocator_type& __a) + : _M_t(_Compare(), _Key_alloc_type(__a)) { } + + /// Allocator-extended copy constructor. + multiset(const multiset& __m, const allocator_type& __a) + : _M_t(__m._M_t, _Key_alloc_type(__a)) { } + + /// Allocator-extended move constructor. + multiset(multiset&& __m, const allocator_type& __a) + noexcept(is_nothrow_copy_constructible<_Compare>::value + && _Alloc_traits::_S_always_equal()) + : _M_t(std::move(__m._M_t), _Key_alloc_type(__a)) { } + + /// Allocator-extended initialier-list constructor. + multiset(initializer_list __l, const allocator_type& __a) + : _M_t(_Compare(), _Key_alloc_type(__a)) + { _M_t._M_insert_equal(__l.begin(), __l.end()); } + + /// Allocator-extended range constructor. + template + multiset(_InputIterator __first, _InputIterator __last, + const allocator_type& __a) + : _M_t(_Compare(), _Key_alloc_type(__a)) + { _M_t._M_insert_equal(__first, __last); } + + /** + * The dtor only erases the elements, and note that if the elements + * themselves are pointers, the pointed-to memory is not touched in any + * way. Managing the pointer is the user's responsibility. + */ + ~multiset() = default; +#endif + + /** + * @brief %Multiset assignment operator. + * + * Whether the allocator is copied depends on the allocator traits. + */ +#if __cplusplus < 201103L + multiset& + operator=(const multiset& __x) + { + _M_t = __x._M_t; + return *this; + } +#else + multiset& + operator=(const multiset&) = default; + + /// Move assignment operator. + multiset& + operator=(multiset&&) = default; + + /** + * @brief %Multiset list assignment operator. + * @param __l An initializer_list. + * + * This function fills a %multiset with copies of the elements in the + * initializer list @a __l. + * + * Note that the assignment completely changes the %multiset and + * that the resulting %multiset's size is the same as the number + * of elements assigned. + */ + multiset& + operator=(initializer_list __l) + { + _M_t._M_assign_equal(__l.begin(), __l.end()); + return *this; + } +#endif + + // accessors: + + /// Returns the comparison object. + key_compare + key_comp() const + { return _M_t.key_comp(); } + /// Returns the comparison object. + value_compare + value_comp() const + { return _M_t.key_comp(); } + /// Returns the memory allocation object. + allocator_type + get_allocator() const _GLIBCXX_NOEXCEPT + { return allocator_type(_M_t.get_allocator()); } + + /** + * Returns a read-only (constant) iterator that points to the first + * element in the %multiset. Iteration is done in ascending order + * according to the keys. + */ + iterator + begin() const _GLIBCXX_NOEXCEPT + { return _M_t.begin(); } + + /** + * Returns a read-only (constant) iterator that points one past the last + * element in the %multiset. Iteration is done in ascending order + * according to the keys. + */ + iterator + end() const _GLIBCXX_NOEXCEPT + { return _M_t.end(); } + + /** + * Returns a read-only (constant) reverse iterator that points to the + * last element in the %multiset. Iteration is done in descending order + * according to the keys. + */ + reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return _M_t.rbegin(); } + + /** + * Returns a read-only (constant) reverse iterator that points to the + * last element in the %multiset. Iteration is done in descending order + * according to the keys. + */ + reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return _M_t.rend(); } + +#if __cplusplus >= 201103L + /** + * Returns a read-only (constant) iterator that points to the first + * element in the %multiset. Iteration is done in ascending order + * according to the keys. + */ + iterator + cbegin() const noexcept + { return _M_t.begin(); } + + /** + * Returns a read-only (constant) iterator that points one past the last + * element in the %multiset. Iteration is done in ascending order + * according to the keys. + */ + iterator + cend() const noexcept + { return _M_t.end(); } + + /** + * Returns a read-only (constant) reverse iterator that points to the + * last element in the %multiset. Iteration is done in descending order + * according to the keys. + */ + reverse_iterator + crbegin() const noexcept + { return _M_t.rbegin(); } + + /** + * Returns a read-only (constant) reverse iterator that points to the + * last element in the %multiset. Iteration is done in descending order + * according to the keys. + */ + reverse_iterator + crend() const noexcept + { return _M_t.rend(); } +#endif + + /// Returns true if the %set is empty. + bool + empty() const _GLIBCXX_NOEXCEPT + { return _M_t.empty(); } + + /// Returns the size of the %set. + size_type + size() const _GLIBCXX_NOEXCEPT + { return _M_t.size(); } + + /// Returns the maximum size of the %set. + size_type + max_size() const _GLIBCXX_NOEXCEPT + { return _M_t.max_size(); } + + /** + * @brief Swaps data with another %multiset. + * @param __x A %multiset of the same element and allocator types. + * + * This exchanges the elements between two multisets in constant time. + * (It is only swapping a pointer, an integer, and an instance of the @c + * Compare type (which itself is often stateless and empty), so it should + * be quite fast.) + * Note that the global std::swap() function is specialized such that + * std::swap(s1,s2) will feed to this function. + * + * Whether the allocators are swapped depends on the allocator traits. + */ + void + swap(multiset& __x) + _GLIBCXX_NOEXCEPT_IF(__is_nothrow_swappable<_Compare>::value) + { _M_t.swap(__x._M_t); } + + // insert/erase +#if __cplusplus >= 201103L + /** + * @brief Builds and inserts an element into the %multiset. + * @param __args Arguments used to generate the element instance to be + * inserted. + * @return An iterator that points to the inserted element. + * + * This function inserts an element into the %multiset. Contrary + * to a std::set the %multiset does not rely on unique keys and thus + * multiple copies of the same element can be inserted. + * + * Insertion requires logarithmic time. + */ + template + iterator + emplace(_Args&&... __args) + { return _M_t._M_emplace_equal(std::forward<_Args>(__args)...); } + + /** + * @brief Builds and inserts an element into the %multiset. + * @param __pos An iterator that serves as a hint as to where the + * element should be inserted. + * @param __args Arguments used to generate the element instance to be + * inserted. + * @return An iterator that points to the inserted element. + * + * This function inserts an element into the %multiset. Contrary + * to a std::set the %multiset does not rely on unique keys and thus + * multiple copies of the same element can be inserted. + * + * Note that the first parameter is only a hint and can potentially + * improve the performance of the insertion process. A bad hint would + * cause no gains in efficiency. + * + * See https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints + * for more on @a hinting. + * + * Insertion requires logarithmic time (if the hint is not taken). + */ + template + iterator + emplace_hint(const_iterator __pos, _Args&&... __args) + { + return _M_t._M_emplace_hint_equal(__pos, + std::forward<_Args>(__args)...); + } +#endif + + /** + * @brief Inserts an element into the %multiset. + * @param __x Element to be inserted. + * @return An iterator that points to the inserted element. + * + * This function inserts an element into the %multiset. Contrary + * to a std::set the %multiset does not rely on unique keys and thus + * multiple copies of the same element can be inserted. + * + * Insertion requires logarithmic time. + */ + iterator + insert(const value_type& __x) + { return _M_t._M_insert_equal(__x); } + +#if __cplusplus >= 201103L + iterator + insert(value_type&& __x) + { return _M_t._M_insert_equal(std::move(__x)); } +#endif + + /** + * @brief Inserts an element into the %multiset. + * @param __position An iterator that serves as a hint as to where the + * element should be inserted. + * @param __x Element to be inserted. + * @return An iterator that points to the inserted element. + * + * This function inserts an element into the %multiset. Contrary + * to a std::set the %multiset does not rely on unique keys and thus + * multiple copies of the same element can be inserted. + * + * Note that the first parameter is only a hint and can potentially + * improve the performance of the insertion process. A bad hint would + * cause no gains in efficiency. + * + * See https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints + * for more on @a hinting. + * + * Insertion requires logarithmic time (if the hint is not taken). + */ + iterator + insert(const_iterator __position, const value_type& __x) + { return _M_t._M_insert_equal_(__position, __x); } + +#if __cplusplus >= 201103L + iterator + insert(const_iterator __position, value_type&& __x) + { return _M_t._M_insert_equal_(__position, std::move(__x)); } +#endif + + /** + * @brief A template function that tries to insert a range of elements. + * @param __first Iterator pointing to the start of the range to be + * inserted. + * @param __last Iterator pointing to the end of the range. + * + * Complexity similar to that of the range constructor. + */ + template + void + insert(_InputIterator __first, _InputIterator __last) + { _M_t._M_insert_equal(__first, __last); } + +#if __cplusplus >= 201103L + /** + * @brief Attempts to insert a list of elements into the %multiset. + * @param __l A std::initializer_list of elements + * to be inserted. + * + * Complexity similar to that of the range constructor. + */ + void + insert(initializer_list __l) + { this->insert(__l.begin(), __l.end()); } +#endif + +#if __cplusplus > 201402L + /// Extract a node. + node_type + extract(const_iterator __pos) + { + __glibcxx_assert(__pos != end()); + return _M_t.extract(__pos); + } + + /// Extract a node. + node_type + extract(const key_type& __x) + { return _M_t.extract(__x); } + + /// Re-insert an extracted node. + iterator + insert(node_type&& __nh) + { return _M_t._M_reinsert_node_equal(std::move(__nh)); } + + /// Re-insert an extracted node. + iterator + insert(const_iterator __hint, node_type&& __nh) + { return _M_t._M_reinsert_node_hint_equal(__hint, std::move(__nh)); } + + template + friend class _Rb_tree_merge_helper; + + template + void + merge(multiset<_Key, _Compare1, _Alloc>& __source) + { + using _Merge_helper = _Rb_tree_merge_helper; + _M_t._M_merge_equal(_Merge_helper::_S_get_tree(__source)); + } + + template + void + merge(multiset<_Key, _Compare1, _Alloc>&& __source) + { merge(__source); } + + template + void + merge(set<_Key, _Compare1, _Alloc>& __source) + { + using _Merge_helper = _Rb_tree_merge_helper; + _M_t._M_merge_equal(_Merge_helper::_S_get_tree(__source)); + } + + template + void + merge(set<_Key, _Compare1, _Alloc>&& __source) + { merge(__source); } +#endif // C++17 + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 130. Associative erase should return an iterator. + /** + * @brief Erases an element from a %multiset. + * @param __position An iterator pointing to the element to be erased. + * @return An iterator pointing to the element immediately following + * @a position prior to the element being erased. If no such + * element exists, end() is returned. + * + * This function erases an element, pointed to by the given iterator, + * from a %multiset. Note that this function only erases the element, + * and that if the element is itself a pointer, the pointed-to memory is + * not touched in any way. Managing the pointer is the user's + * responsibility. + */ + _GLIBCXX_ABI_TAG_CXX11 + iterator + erase(const_iterator __position) + { return _M_t.erase(__position); } +#else + /** + * @brief Erases an element from a %multiset. + * @param __position An iterator pointing to the element to be erased. + * + * This function erases an element, pointed to by the given iterator, + * from a %multiset. Note that this function only erases the element, + * and that if the element is itself a pointer, the pointed-to memory is + * not touched in any way. Managing the pointer is the user's + * responsibility. + */ + void + erase(iterator __position) + { _M_t.erase(__position); } +#endif + + /** + * @brief Erases elements according to the provided key. + * @param __x Key of element to be erased. + * @return The number of elements erased. + * + * This function erases all elements located by the given key from a + * %multiset. + * Note that this function only erases the element, and that if + * the element is itself a pointer, the pointed-to memory is not touched + * in any way. Managing the pointer is the user's responsibility. + */ + size_type + erase(const key_type& __x) + { return _M_t.erase(__x); } + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 130. Associative erase should return an iterator. + /** + * @brief Erases a [first,last) range of elements from a %multiset. + * @param __first Iterator pointing to the start of the range to be + * erased. + * @param __last Iterator pointing to the end of the range to + * be erased. + * @return The iterator @a last. + * + * This function erases a sequence of elements from a %multiset. + * Note that this function only erases the elements, and that if + * the elements themselves are pointers, the pointed-to memory is not + * touched in any way. Managing the pointer is the user's + * responsibility. + */ + _GLIBCXX_ABI_TAG_CXX11 + iterator + erase(const_iterator __first, const_iterator __last) + { return _M_t.erase(__first, __last); } +#else + /** + * @brief Erases a [first,last) range of elements from a %multiset. + * @param first Iterator pointing to the start of the range to be + * erased. + * @param last Iterator pointing to the end of the range to be erased. + * + * This function erases a sequence of elements from a %multiset. + * Note that this function only erases the elements, and that if + * the elements themselves are pointers, the pointed-to memory is not + * touched in any way. Managing the pointer is the user's + * responsibility. + */ + void + erase(iterator __first, iterator __last) + { _M_t.erase(__first, __last); } +#endif + + /** + * Erases all elements in a %multiset. Note that this function only + * erases the elements, and that if the elements themselves are pointers, + * the pointed-to memory is not touched in any way. Managing the pointer + * is the user's responsibility. + */ + void + clear() _GLIBCXX_NOEXCEPT + { _M_t.clear(); } + + // multiset operations: + + //@{ + /** + * @brief Finds the number of elements with given key. + * @param __x Key of elements to be located. + * @return Number of elements with specified key. + */ + size_type + count(const key_type& __x) const + { return _M_t.count(__x); } + +#if __cplusplus > 201103L + template + auto + count(const _Kt& __x) const -> decltype(_M_t._M_count_tr(__x)) + { return _M_t._M_count_tr(__x); } +#endif + //@} + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 214. set::find() missing const overload + //@{ + /** + * @brief Tries to locate an element in a %set. + * @param __x Element to be located. + * @return Iterator pointing to sought-after element, or end() if not + * found. + * + * This function takes a key and tries to locate the element with which + * the key matches. If successful the function returns an iterator + * pointing to the sought after element. If unsuccessful it returns the + * past-the-end ( @c end() ) iterator. + */ + iterator + find(const key_type& __x) + { return _M_t.find(__x); } + + const_iterator + find(const key_type& __x) const + { return _M_t.find(__x); } + +#if __cplusplus > 201103L + template + auto + find(const _Kt& __x) + -> decltype(iterator{_M_t._M_find_tr(__x)}) + { return iterator{_M_t._M_find_tr(__x)}; } + + template + auto + find(const _Kt& __x) const + -> decltype(const_iterator{_M_t._M_find_tr(__x)}) + { return const_iterator{_M_t._M_find_tr(__x)}; } +#endif + //@} + + //@{ + /** + * @brief Finds the beginning of a subsequence matching given key. + * @param __x Key to be located. + * @return Iterator pointing to first element equal to or greater + * than key, or end(). + * + * This function returns the first element of a subsequence of elements + * that matches the given key. If unsuccessful it returns an iterator + * pointing to the first element that has a greater value than given key + * or end() if no such element exists. + */ + iterator + lower_bound(const key_type& __x) + { return _M_t.lower_bound(__x); } + + const_iterator + lower_bound(const key_type& __x) const + { return _M_t.lower_bound(__x); } + +#if __cplusplus > 201103L + template + auto + lower_bound(const _Kt& __x) + -> decltype(iterator(_M_t._M_lower_bound_tr(__x))) + { return iterator(_M_t._M_lower_bound_tr(__x)); } + + template + auto + lower_bound(const _Kt& __x) const + -> decltype(iterator(_M_t._M_lower_bound_tr(__x))) + { return iterator(_M_t._M_lower_bound_tr(__x)); } +#endif + //@} + + //@{ + /** + * @brief Finds the end of a subsequence matching given key. + * @param __x Key to be located. + * @return Iterator pointing to the first element + * greater than key, or end(). + */ + iterator + upper_bound(const key_type& __x) + { return _M_t.upper_bound(__x); } + + const_iterator + upper_bound(const key_type& __x) const + { return _M_t.upper_bound(__x); } + +#if __cplusplus > 201103L + template + auto + upper_bound(const _Kt& __x) + -> decltype(iterator(_M_t._M_upper_bound_tr(__x))) + { return iterator(_M_t._M_upper_bound_tr(__x)); } + + template + auto + upper_bound(const _Kt& __x) const + -> decltype(iterator(_M_t._M_upper_bound_tr(__x))) + { return iterator(_M_t._M_upper_bound_tr(__x)); } +#endif + //@} + + //@{ + /** + * @brief Finds a subsequence matching given key. + * @param __x Key to be located. + * @return Pair of iterators that possibly points to the subsequence + * matching given key. + * + * This function is equivalent to + * @code + * std::make_pair(c.lower_bound(val), + * c.upper_bound(val)) + * @endcode + * (but is faster than making the calls separately). + * + * This function probably only makes sense for multisets. + */ + std::pair + equal_range(const key_type& __x) + { return _M_t.equal_range(__x); } + + std::pair + equal_range(const key_type& __x) const + { return _M_t.equal_range(__x); } + +#if __cplusplus > 201103L + template + auto + equal_range(const _Kt& __x) + -> decltype(pair(_M_t._M_equal_range_tr(__x))) + { return pair(_M_t._M_equal_range_tr(__x)); } + + template + auto + equal_range(const _Kt& __x) const + -> decltype(pair(_M_t._M_equal_range_tr(__x))) + { return pair(_M_t._M_equal_range_tr(__x)); } +#endif + //@} + + template + friend bool + operator==(const multiset<_K1, _C1, _A1>&, + const multiset<_K1, _C1, _A1>&); + + template + friend bool + operator< (const multiset<_K1, _C1, _A1>&, + const multiset<_K1, _C1, _A1>&); + }; + + /** + * @brief Multiset equality comparison. + * @param __x A %multiset. + * @param __y A %multiset of the same type as @a __x. + * @return True iff the size and elements of the multisets are equal. + * + * This is an equivalence relation. It is linear in the size of the + * multisets. + * Multisets are considered equivalent if their sizes are equal, and if + * corresponding elements compare equal. + */ + template + inline bool + operator==(const multiset<_Key, _Compare, _Alloc>& __x, + const multiset<_Key, _Compare, _Alloc>& __y) + { return __x._M_t == __y._M_t; } + + /** + * @brief Multiset ordering relation. + * @param __x A %multiset. + * @param __y A %multiset of the same type as @a __x. + * @return True iff @a __x is lexicographically less than @a __y. + * + * This is a total ordering relation. It is linear in the size of the + * sets. The elements must be comparable with @c <. + * + * See std::lexicographical_compare() for how the determination is made. + */ + template + inline bool + operator<(const multiset<_Key, _Compare, _Alloc>& __x, + const multiset<_Key, _Compare, _Alloc>& __y) + { return __x._M_t < __y._M_t; } + + /// Returns !(x == y). + template + inline bool + operator!=(const multiset<_Key, _Compare, _Alloc>& __x, + const multiset<_Key, _Compare, _Alloc>& __y) + { return !(__x == __y); } + + /// Returns y < x. + template + inline bool + operator>(const multiset<_Key,_Compare,_Alloc>& __x, + const multiset<_Key,_Compare,_Alloc>& __y) + { return __y < __x; } + + /// Returns !(y < x) + template + inline bool + operator<=(const multiset<_Key, _Compare, _Alloc>& __x, + const multiset<_Key, _Compare, _Alloc>& __y) + { return !(__y < __x); } + + /// Returns !(x < y) + template + inline bool + operator>=(const multiset<_Key, _Compare, _Alloc>& __x, + const multiset<_Key, _Compare, _Alloc>& __y) + { return !(__x < __y); } + + /// See std::multiset::swap(). + template + inline void + swap(multiset<_Key, _Compare, _Alloc>& __x, + multiset<_Key, _Compare, _Alloc>& __y) + _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y))) + { __x.swap(__y); } + +_GLIBCXX_END_NAMESPACE_CONTAINER + +#if __cplusplus > 201402L +_GLIBCXX_BEGIN_NAMESPACE_VERSION + // Allow std::multiset access to internals of compatible sets. + template + struct + _Rb_tree_merge_helper<_GLIBCXX_STD_C::multiset<_Val, _Cmp1, _Alloc>, + _Cmp2> + { + private: + friend class _GLIBCXX_STD_C::multiset<_Val, _Cmp1, _Alloc>; + + static auto& + _S_get_tree(_GLIBCXX_STD_C::set<_Val, _Cmp2, _Alloc>& __set) + { return __set._M_t; } + + static auto& + _S_get_tree(_GLIBCXX_STD_C::multiset<_Val, _Cmp2, _Alloc>& __set) + { return __set._M_t; } + }; +_GLIBCXX_END_NAMESPACE_VERSION +#endif // C++17 + +} // namespace std + +#endif /* _STL_MULTISET_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_numeric.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_numeric.h new file mode 100644 index 0000000..9f98164 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_numeric.h @@ -0,0 +1,387 @@ +// Numeric functions implementation -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_numeric.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{numeric} + */ + +#ifndef _STL_NUMERIC_H +#define _STL_NUMERIC_H 1 + +#include +#include +#include // For _GLIBCXX_MOVE + +#if __cplusplus >= 201103L + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @brief Create a range of sequentially increasing values. + * + * For each element in the range @p [first,last) assigns @p value and + * increments @p value as if by @p ++value. + * + * @param __first Start of range. + * @param __last End of range. + * @param __value Starting value. + * @return Nothing. + */ + template + void + iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value) + { + // concept requirements + __glibcxx_function_requires(_Mutable_ForwardIteratorConcept< + _ForwardIterator>) + __glibcxx_function_requires(_ConvertibleConcept<_Tp, + typename iterator_traits<_ForwardIterator>::value_type>) + __glibcxx_requires_valid_range(__first, __last); + + for (; __first != __last; ++__first) + { + *__first = __value; + ++__value; + } + } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_ALGO + + /** + * @brief Accumulate values in a range. + * + * Accumulates the values in the range [first,last) using operator+(). The + * initial value is @a init. The values are processed in order. + * + * @param __first Start of range. + * @param __last End of range. + * @param __init Starting value to add other values to. + * @return The final sum. + */ + template + inline _Tp + accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_requires_valid_range(__first, __last); + + for (; __first != __last; ++__first) + __init = __init + *__first; + return __init; + } + + /** + * @brief Accumulate values in a range with operation. + * + * Accumulates the values in the range [first,last) using the function + * object @p __binary_op. The initial value is @p __init. The values are + * processed in order. + * + * @param __first Start of range. + * @param __last End of range. + * @param __init Starting value to add other values to. + * @param __binary_op Function object to accumulate with. + * @return The final sum. + */ + template + inline _Tp + accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, + _BinaryOperation __binary_op) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_requires_valid_range(__first, __last); + + for (; __first != __last; ++__first) + __init = __binary_op(__init, *__first); + return __init; + } + + /** + * @brief Compute inner product of two ranges. + * + * Starting with an initial value of @p __init, multiplies successive + * elements from the two ranges and adds each product into the accumulated + * value using operator+(). The values in the ranges are processed in + * order. + * + * @param __first1 Start of range 1. + * @param __last1 End of range 1. + * @param __first2 Start of range 2. + * @param __init Starting value to add other values to. + * @return The final inner product. + */ + template + inline _Tp + inner_product(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _Tp __init) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) + __glibcxx_requires_valid_range(__first1, __last1); + + for (; __first1 != __last1; ++__first1, (void)++__first2) + __init = __init + (*__first1 * *__first2); + return __init; + } + + /** + * @brief Compute inner product of two ranges. + * + * Starting with an initial value of @p __init, applies @p __binary_op2 to + * successive elements from the two ranges and accumulates each result into + * the accumulated value using @p __binary_op1. The values in the ranges are + * processed in order. + * + * @param __first1 Start of range 1. + * @param __last1 End of range 1. + * @param __first2 Start of range 2. + * @param __init Starting value to add other values to. + * @param __binary_op1 Function object to accumulate with. + * @param __binary_op2 Function object to apply to pairs of input values. + * @return The final inner product. + */ + template + inline _Tp + inner_product(_InputIterator1 __first1, _InputIterator1 __last1, + _InputIterator2 __first2, _Tp __init, + _BinaryOperation1 __binary_op1, + _BinaryOperation2 __binary_op2) + { + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) + __glibcxx_requires_valid_range(__first1, __last1); + + for (; __first1 != __last1; ++__first1, (void)++__first2) + __init = __binary_op1(__init, __binary_op2(*__first1, *__first2)); + return __init; + } + + /** + * @brief Return list of partial sums + * + * Accumulates the values in the range [first,last) using the @c + operator. + * As each successive input value is added into the total, that partial sum + * is written to @p __result. Therefore, the first value in @p __result is + * the first value of the input, the second value in @p __result is the sum + * of the first and second input values, and so on. + * + * @param __first Start of input range. + * @param __last End of input range. + * @param __result Output sum. + * @return Iterator pointing just beyond the values written to __result. + */ + template + _OutputIterator + partial_sum(_InputIterator __first, _InputIterator __last, + _OutputIterator __result) + { + typedef typename iterator_traits<_InputIterator>::value_type _ValueType; + + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + _ValueType>) + __glibcxx_requires_valid_range(__first, __last); + + if (__first == __last) + return __result; + _ValueType __value = *__first; + *__result = __value; + while (++__first != __last) + { + __value = __value + *__first; + *++__result = __value; + } + return ++__result; + } + + /** + * @brief Return list of partial sums + * + * Accumulates the values in the range [first,last) using @p __binary_op. + * As each successive input value is added into the total, that partial sum + * is written to @p __result. Therefore, the first value in @p __result is + * the first value of the input, the second value in @p __result is the sum + * of the first and second input values, and so on. + * + * @param __first Start of input range. + * @param __last End of input range. + * @param __result Output sum. + * @param __binary_op Function object. + * @return Iterator pointing just beyond the values written to __result. + */ + template + _OutputIterator + partial_sum(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _BinaryOperation __binary_op) + { + typedef typename iterator_traits<_InputIterator>::value_type _ValueType; + + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + _ValueType>) + __glibcxx_requires_valid_range(__first, __last); + + if (__first == __last) + return __result; + _ValueType __value = *__first; + *__result = __value; + while (++__first != __last) + { + __value = __binary_op(__value, *__first); + *++__result = __value; + } + return ++__result; + } + + /** + * @brief Return differences between adjacent values. + * + * Computes the difference between adjacent values in the range + * [first,last) using operator-() and writes the result to @p __result. + * + * @param __first Start of input range. + * @param __last End of input range. + * @param __result Output sums. + * @return Iterator pointing just beyond the values written to result. + * + * _GLIBCXX_RESOLVE_LIB_DEFECTS + * DR 539. partial_sum and adjacent_difference should mention requirements + */ + template + _OutputIterator + adjacent_difference(_InputIterator __first, + _InputIterator __last, _OutputIterator __result) + { + typedef typename iterator_traits<_InputIterator>::value_type _ValueType; + + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + _ValueType>) + __glibcxx_requires_valid_range(__first, __last); + + if (__first == __last) + return __result; + _ValueType __value = *__first; + *__result = __value; + while (++__first != __last) + { + _ValueType __tmp = *__first; + *++__result = __tmp - __value; + __value = _GLIBCXX_MOVE(__tmp); + } + return ++__result; + } + + /** + * @brief Return differences between adjacent values. + * + * Computes the difference between adjacent values in the range + * [__first,__last) using the function object @p __binary_op and writes the + * result to @p __result. + * + * @param __first Start of input range. + * @param __last End of input range. + * @param __result Output sum. + * @param __binary_op Function object. + * @return Iterator pointing just beyond the values written to result. + * + * _GLIBCXX_RESOLVE_LIB_DEFECTS + * DR 539. partial_sum and adjacent_difference should mention requirements + */ + template + _OutputIterator + adjacent_difference(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _BinaryOperation __binary_op) + { + typedef typename iterator_traits<_InputIterator>::value_type _ValueType; + + // concept requirements + __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) + __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, + _ValueType>) + __glibcxx_requires_valid_range(__first, __last); + + if (__first == __last) + return __result; + _ValueType __value = *__first; + *__result = __value; + while (++__first != __last) + { + _ValueType __tmp = *__first; + *++__result = __binary_op(__tmp, __value); + __value = _GLIBCXX_MOVE(__tmp); + } + return ++__result; + } + +_GLIBCXX_END_NAMESPACE_ALGO +} // namespace std + +#endif /* _STL_NUMERIC_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_pair.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_pair.h new file mode 100644 index 0000000..b6245b6 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_pair.h @@ -0,0 +1,538 @@ +// Pair implementation -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_pair.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{utility} + */ + +#ifndef _STL_PAIR_H +#define _STL_PAIR_H 1 + +#include // for std::move / std::forward, and std::swap + +#if __cplusplus >= 201103L +#include // for std::__decay_and_strip too +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup utilities + * @{ + */ + +#if __cplusplus >= 201103L + /// piecewise_construct_t + struct piecewise_construct_t { explicit piecewise_construct_t() = default; }; + + /// piecewise_construct + _GLIBCXX17_INLINE constexpr piecewise_construct_t piecewise_construct = + piecewise_construct_t(); + + // Forward declarations. + template + class tuple; + + template + struct _Index_tuple; + + // Concept utility functions, reused in conditionally-explicit + // constructors. + // See PR 70437, don't look at is_constructible or + // is_convertible if the types are the same to + // avoid querying those properties for incomplete types. + template + struct _PCC + { + template + static constexpr bool _ConstructiblePair() + { + return __and_, + is_constructible<_T2, const _U2&>>::value; + } + + template + static constexpr bool _ImplicitlyConvertiblePair() + { + return __and_, + is_convertible>::value; + } + + template + static constexpr bool _MoveConstructiblePair() + { + return __and_, + is_constructible<_T2, _U2&&>>::value; + } + + template + static constexpr bool _ImplicitlyMoveConvertiblePair() + { + return __and_, + is_convertible<_U2&&, _T2>>::value; + } + + template + static constexpr bool _CopyMovePair() + { + using __do_converts = __and_, + is_convertible<_U2&&, _T2>>; + using __converts = typename conditional<__implicit, + __do_converts, + __not_<__do_converts>>::type; + return __and_, + is_constructible<_T2, _U2&&>, + __converts + >::value; + } + + template + static constexpr bool _MoveCopyPair() + { + using __do_converts = __and_, + is_convertible>; + using __converts = typename conditional<__implicit, + __do_converts, + __not_<__do_converts>>::type; + return __and_, + is_constructible<_T2, const _U2&&>, + __converts + >::value; + } + }; + + template + struct _PCC + { + template + static constexpr bool _ConstructiblePair() + { + return false; + } + + template + static constexpr bool _ImplicitlyConvertiblePair() + { + return false; + } + + template + static constexpr bool _MoveConstructiblePair() + { + return false; + } + + template + static constexpr bool _ImplicitlyMoveConvertiblePair() + { + return false; + } + }; + + // PR libstdc++/79141, a utility type for preventing + // initialization of an argument of a disabled assignment + // operator from a pair of empty braces. + struct __nonesuch_no_braces : std::__nonesuch { + explicit __nonesuch_no_braces(const __nonesuch&) = delete; + }; + +#endif + + /** + * @brief Struct holding two objects of arbitrary type. + * + * @tparam _T1 Type of first object. + * @tparam _T2 Type of second object. + */ + template + struct pair + { + typedef _T1 first_type; /// @c first_type is the first bound type + typedef _T2 second_type; /// @c second_type is the second bound type + + _T1 first; /// @c first is a copy of the first object + _T2 second; /// @c second is a copy of the second object + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 265. std::pair::pair() effects overly restrictive + /** The default constructor creates @c first and @c second using their + * respective default constructors. */ +#if __cplusplus >= 201103L + template , + __is_implicitly_default_constructible<_U2>> + ::value, bool>::type = true> +#endif + _GLIBCXX_CONSTEXPR pair() + : first(), second() { } + +#if __cplusplus >= 201103L + template , + is_default_constructible<_U2>, + __not_< + __and_<__is_implicitly_default_constructible<_U1>, + __is_implicitly_default_constructible<_U2>>>> + ::value, bool>::type = false> + explicit constexpr pair() + : first(), second() { } +#endif + + /** Two objects may be passed to a @c pair constructor to be copied. */ +#if __cplusplus < 201103L + pair(const _T1& __a, const _T2& __b) + : first(__a), second(__b) { } +#else + // Shortcut for constraining the templates that don't take pairs. + using _PCCP = _PCC; + + template() + && _PCCP::template + _ImplicitlyConvertiblePair<_U1, _U2>(), + bool>::type=true> + constexpr pair(const _T1& __a, const _T2& __b) + : first(__a), second(__b) { } + + template() + && !_PCCP::template + _ImplicitlyConvertiblePair<_U1, _U2>(), + bool>::type=false> + explicit constexpr pair(const _T1& __a, const _T2& __b) + : first(__a), second(__b) { } +#endif + + /** There is also a templated copy ctor for the @c pair class itself. */ +#if __cplusplus < 201103L + template + pair(const pair<_U1, _U2>& __p) + : first(__p.first), second(__p.second) { } +#else + // Shortcut for constraining the templates that take pairs. + template + using _PCCFP = _PCC::value + || !is_same<_T2, _U2>::value, + _T1, _T2>; + + template::template + _ConstructiblePair<_U1, _U2>() + && _PCCFP<_U1, _U2>::template + _ImplicitlyConvertiblePair<_U1, _U2>(), + bool>::type=true> + constexpr pair(const pair<_U1, _U2>& __p) + : first(__p.first), second(__p.second) { } + + template::template + _ConstructiblePair<_U1, _U2>() + && !_PCCFP<_U1, _U2>::template + _ImplicitlyConvertiblePair<_U1, _U2>(), + bool>::type=false> + explicit constexpr pair(const pair<_U1, _U2>& __p) + : first(__p.first), second(__p.second) { } + + constexpr pair(const pair&) = default; + constexpr pair(pair&&) = default; + + // DR 811. + template(), + bool>::type=true> + constexpr pair(_U1&& __x, const _T2& __y) + : first(std::forward<_U1>(__x)), second(__y) { } + + template(), + bool>::type=false> + explicit constexpr pair(_U1&& __x, const _T2& __y) + : first(std::forward<_U1>(__x)), second(__y) { } + + template(), + bool>::type=true> + constexpr pair(const _T1& __x, _U2&& __y) + : first(__x), second(std::forward<_U2>(__y)) { } + + template(), + bool>::type=false> + explicit pair(const _T1& __x, _U2&& __y) + : first(__x), second(std::forward<_U2>(__y)) { } + + template() + && _PCCP::template + _ImplicitlyMoveConvertiblePair<_U1, _U2>(), + bool>::type=true> + constexpr pair(_U1&& __x, _U2&& __y) + : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { } + + template() + && !_PCCP::template + _ImplicitlyMoveConvertiblePair<_U1, _U2>(), + bool>::type=false> + explicit constexpr pair(_U1&& __x, _U2&& __y) + : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { } + + + template::template + _MoveConstructiblePair<_U1, _U2>() + && _PCCFP<_U1, _U2>::template + _ImplicitlyMoveConvertiblePair<_U1, _U2>(), + bool>::type=true> + constexpr pair(pair<_U1, _U2>&& __p) + : first(std::forward<_U1>(__p.first)), + second(std::forward<_U2>(__p.second)) { } + + template::template + _MoveConstructiblePair<_U1, _U2>() + && !_PCCFP<_U1, _U2>::template + _ImplicitlyMoveConvertiblePair<_U1, _U2>(), + bool>::type=false> + explicit constexpr pair(pair<_U1, _U2>&& __p) + : first(std::forward<_U1>(__p.first)), + second(std::forward<_U2>(__p.second)) { } + + template + pair(piecewise_construct_t, tuple<_Args1...>, tuple<_Args2...>); + + pair& + operator=(typename conditional< + __and_, + is_copy_assignable<_T2>>::value, + const pair&, const __nonesuch_no_braces&>::type __p) + { + first = __p.first; + second = __p.second; + return *this; + } + + pair& + operator=(typename conditional< + __not_<__and_, + is_copy_assignable<_T2>>>::value, + const pair&, const __nonesuch_no_braces&>::type __p) = delete; + + pair& + operator=(typename conditional< + __and_, + is_move_assignable<_T2>>::value, + pair&&, __nonesuch_no_braces&&>::type __p) + noexcept(__and_, + is_nothrow_move_assignable<_T2>>::value) + { + first = std::forward(__p.first); + second = std::forward(__p.second); + return *this; + } + + template + typename enable_if<__and_, + is_assignable<_T2&, const _U2&>>::value, + pair&>::type + operator=(const pair<_U1, _U2>& __p) + { + first = __p.first; + second = __p.second; + return *this; + } + + template + typename enable_if<__and_, + is_assignable<_T2&, _U2&&>>::value, + pair&>::type + operator=(pair<_U1, _U2>&& __p) + { + first = std::forward<_U1>(__p.first); + second = std::forward<_U2>(__p.second); + return *this; + } + + void + swap(pair& __p) + noexcept(__and_<__is_nothrow_swappable<_T1>, + __is_nothrow_swappable<_T2>>::value) + { + using std::swap; + swap(first, __p.first); + swap(second, __p.second); + } + + private: + template + pair(tuple<_Args1...>&, tuple<_Args2...>&, + _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>); +#endif + }; + +#if __cpp_deduction_guides >= 201606 + template pair(_T1, _T2) -> pair<_T1, _T2>; +#endif + + /// Two pairs of the same type are equal iff their members are equal. + template + inline _GLIBCXX_CONSTEXPR bool + operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) + { return __x.first == __y.first && __x.second == __y.second; } + + /// + template + inline _GLIBCXX_CONSTEXPR bool + operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) + { return __x.first < __y.first + || (!(__y.first < __x.first) && __x.second < __y.second); } + + /// Uses @c operator== to find the result. + template + inline _GLIBCXX_CONSTEXPR bool + operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) + { return !(__x == __y); } + + /// Uses @c operator< to find the result. + template + inline _GLIBCXX_CONSTEXPR bool + operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) + { return __y < __x; } + + /// Uses @c operator< to find the result. + template + inline _GLIBCXX_CONSTEXPR bool + operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) + { return !(__y < __x); } + + /// Uses @c operator< to find the result. + template + inline _GLIBCXX_CONSTEXPR bool + operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) + { return !(__x < __y); } + +#if __cplusplus >= 201103L + /// See std::pair::swap(). + // Note: no std::swap overloads in C++03 mode, this has performance + // implications, see, eg, libstdc++/38466. + template + inline +#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 + // Constrained free swap overload, see p0185r1 + typename enable_if<__and_<__is_swappable<_T1>, + __is_swappable<_T2>>::value>::type +#else + void +#endif + swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) + noexcept(noexcept(__x.swap(__y))) + { __x.swap(__y); } + +#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 + template + typename enable_if, + __is_swappable<_T2>>::value>::type + swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete; +#endif +#endif // __cplusplus >= 201103L + + /** + * @brief A convenience wrapper for creating a pair from two objects. + * @param __x The first object. + * @param __y The second object. + * @return A newly-constructed pair<> object of the appropriate type. + * + * The standard requires that the objects be passed by reference-to-const, + * but LWG issue #181 says they should be passed by const value. We follow + * the LWG by default. + */ + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 181. make_pair() unintended behavior +#if __cplusplus >= 201103L + // NB: DR 706. + template + constexpr pair::__type, + typename __decay_and_strip<_T2>::__type> + make_pair(_T1&& __x, _T2&& __y) + { + typedef typename __decay_and_strip<_T1>::__type __ds_type1; + typedef typename __decay_and_strip<_T2>::__type __ds_type2; + typedef pair<__ds_type1, __ds_type2> __pair_type; + return __pair_type(std::forward<_T1>(__x), std::forward<_T2>(__y)); + } +#else + template + inline pair<_T1, _T2> + make_pair(_T1 __x, _T2 __y) + { return pair<_T1, _T2>(__x, __y); } +#endif + + /// @} + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif /* _STL_PAIR_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_queue.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_queue.h new file mode 100644 index 0000000..c49f371 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_queue.h @@ -0,0 +1,682 @@ +// Queue implementation -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_queue.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{queue} + */ + +#ifndef _STL_QUEUE_H +#define _STL_QUEUE_H 1 + +#include +#include +#if __cplusplus >= 201103L +# include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @brief A standard container giving FIFO behavior. + * + * @ingroup sequences + * + * @tparam _Tp Type of element. + * @tparam _Sequence Type of underlying sequence, defaults to deque<_Tp>. + * + * Meets many of the requirements of a + * container, + * but does not define anything to do with iterators. Very few of the + * other standard container interfaces are defined. + * + * This is not a true container, but an @e adaptor. It holds another + * container, and provides a wrapper interface to that container. The + * wrapper is what enforces strict first-in-first-out %queue behavior. + * + * The second template parameter defines the type of the underlying + * sequence/container. It defaults to std::deque, but it can be any type + * that supports @c front, @c back, @c push_back, and @c pop_front, + * such as std::list or an appropriate user-defined type. + * + * Members not found in @a normal containers are @c container_type, + * which is a typedef for the second Sequence parameter, and @c push and + * @c pop, which are standard %queue/FIFO operations. + */ + template > + class queue + { +#ifdef _GLIBCXX_CONCEPT_CHECKS + // concept requirements + typedef typename _Sequence::value_type _Sequence_value_type; +# if __cplusplus < 201103L + __glibcxx_class_requires(_Tp, _SGIAssignableConcept) +# endif + __glibcxx_class_requires(_Sequence, _FrontInsertionSequenceConcept) + __glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept) + __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept) +#endif + + template + friend bool + operator==(const queue<_Tp1, _Seq1>&, const queue<_Tp1, _Seq1>&); + + template + friend bool + operator<(const queue<_Tp1, _Seq1>&, const queue<_Tp1, _Seq1>&); + +#if __cplusplus >= 201103L + template + using _Uses = typename + enable_if::value>::type; +#endif + + public: + typedef typename _Sequence::value_type value_type; + typedef typename _Sequence::reference reference; + typedef typename _Sequence::const_reference const_reference; + typedef typename _Sequence::size_type size_type; + typedef _Sequence container_type; + + protected: + /* Maintainers wondering why this isn't uglified as per style + * guidelines should note that this name is specified in the standard, + * C++98 [23.2.3.1]. + * (Why? Presumably for the same reason that it's protected instead + * of private: to allow derivation. But none of the other + * containers allow for derivation. Odd.) + */ + /// @c c is the underlying container. + _Sequence c; + + public: + /** + * @brief Default constructor creates no elements. + */ +#if __cplusplus < 201103L + explicit + queue(const _Sequence& __c = _Sequence()) + : c(__c) { } +#else + template::value>::type> + queue() + : c() { } + + explicit + queue(const _Sequence& __c) + : c(__c) { } + + explicit + queue(_Sequence&& __c) + : c(std::move(__c)) { } + + template> + explicit + queue(const _Alloc& __a) + : c(__a) { } + + template> + queue(const _Sequence& __c, const _Alloc& __a) + : c(__c, __a) { } + + template> + queue(_Sequence&& __c, const _Alloc& __a) + : c(std::move(__c), __a) { } + + template> + queue(const queue& __q, const _Alloc& __a) + : c(__q.c, __a) { } + + template> + queue(queue&& __q, const _Alloc& __a) + : c(std::move(__q.c), __a) { } +#endif + + /** + * Returns true if the %queue is empty. + */ + bool + empty() const + { return c.empty(); } + + /** Returns the number of elements in the %queue. */ + size_type + size() const + { return c.size(); } + + /** + * Returns a read/write reference to the data at the first + * element of the %queue. + */ + reference + front() + { + __glibcxx_requires_nonempty(); + return c.front(); + } + + /** + * Returns a read-only (constant) reference to the data at the first + * element of the %queue. + */ + const_reference + front() const + { + __glibcxx_requires_nonempty(); + return c.front(); + } + + /** + * Returns a read/write reference to the data at the last + * element of the %queue. + */ + reference + back() + { + __glibcxx_requires_nonempty(); + return c.back(); + } + + /** + * Returns a read-only (constant) reference to the data at the last + * element of the %queue. + */ + const_reference + back() const + { + __glibcxx_requires_nonempty(); + return c.back(); + } + + /** + * @brief Add data to the end of the %queue. + * @param __x Data to be added. + * + * This is a typical %queue operation. The function creates an + * element at the end of the %queue and assigns the given data + * to it. The time complexity of the operation depends on the + * underlying sequence. + */ + void + push(const value_type& __x) + { c.push_back(__x); } + +#if __cplusplus >= 201103L + void + push(value_type&& __x) + { c.push_back(std::move(__x)); } + +#if __cplusplus > 201402L + template + decltype(auto) + emplace(_Args&&... __args) + { return c.emplace_back(std::forward<_Args>(__args)...); } +#else + template + void + emplace(_Args&&... __args) + { c.emplace_back(std::forward<_Args>(__args)...); } +#endif +#endif + + /** + * @brief Removes first element. + * + * This is a typical %queue operation. It shrinks the %queue by one. + * The time complexity of the operation depends on the underlying + * sequence. + * + * Note that no data is returned, and if the first element's + * data is needed, it should be retrieved before pop() is + * called. + */ + void + pop() + { + __glibcxx_requires_nonempty(); + c.pop_front(); + } + +#if __cplusplus >= 201103L + void + swap(queue& __q) +#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 + noexcept(__is_nothrow_swappable<_Sequence>::value) +#else + noexcept(__is_nothrow_swappable<_Tp>::value) +#endif + { + using std::swap; + swap(c, __q.c); + } +#endif // __cplusplus >= 201103L + }; + + /** + * @brief Queue equality comparison. + * @param __x A %queue. + * @param __y A %queue of the same type as @a __x. + * @return True iff the size and elements of the queues are equal. + * + * This is an equivalence relation. Complexity and semantics depend on the + * underlying sequence type, but the expected rules are: this relation is + * linear in the size of the sequences, and queues are considered equivalent + * if their sequences compare equal. + */ + template + inline bool + operator==(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) + { return __x.c == __y.c; } + + /** + * @brief Queue ordering relation. + * @param __x A %queue. + * @param __y A %queue of the same type as @a x. + * @return True iff @a __x is lexicographically less than @a __y. + * + * This is an total ordering relation. Complexity and semantics + * depend on the underlying sequence type, but the expected rules + * are: this relation is linear in the size of the sequences, the + * elements must be comparable with @c <, and + * std::lexicographical_compare() is usually used to make the + * determination. + */ + template + inline bool + operator<(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) + { return __x.c < __y.c; } + + /// Based on operator== + template + inline bool + operator!=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) + { return !(__x == __y); } + + /// Based on operator< + template + inline bool + operator>(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) + { return __y < __x; } + + /// Based on operator< + template + inline bool + operator<=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) + { return !(__y < __x); } + + /// Based on operator< + template + inline bool + operator>=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y) + { return !(__x < __y); } + +#if __cplusplus >= 201103L + template + inline +#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 + // Constrained free swap overload, see p0185r1 + typename enable_if<__is_swappable<_Seq>::value>::type +#else + void +#endif + swap(queue<_Tp, _Seq>& __x, queue<_Tp, _Seq>& __y) + noexcept(noexcept(__x.swap(__y))) + { __x.swap(__y); } + + template + struct uses_allocator, _Alloc> + : public uses_allocator<_Seq, _Alloc>::type { }; +#endif // __cplusplus >= 201103L + + /** + * @brief A standard container automatically sorting its contents. + * + * @ingroup sequences + * + * @tparam _Tp Type of element. + * @tparam _Sequence Type of underlying sequence, defaults to vector<_Tp>. + * @tparam _Compare Comparison function object type, defaults to + * less<_Sequence::value_type>. + * + * This is not a true container, but an @e adaptor. It holds + * another container, and provides a wrapper interface to that + * container. The wrapper is what enforces priority-based sorting + * and %queue behavior. Very few of the standard container/sequence + * interface requirements are met (e.g., iterators). + * + * The second template parameter defines the type of the underlying + * sequence/container. It defaults to std::vector, but it can be + * any type that supports @c front(), @c push_back, @c pop_back, + * and random-access iterators, such as std::deque or an + * appropriate user-defined type. + * + * The third template parameter supplies the means of making + * priority comparisons. It defaults to @c less but + * can be anything defining a strict weak ordering. + * + * Members not found in @a normal containers are @c container_type, + * which is a typedef for the second Sequence parameter, and @c + * push, @c pop, and @c top, which are standard %queue operations. + * + * @note No equality/comparison operators are provided for + * %priority_queue. + * + * @note Sorting of the elements takes place as they are added to, + * and removed from, the %priority_queue using the + * %priority_queue's member functions. If you access the elements + * by other means, and change their data such that the sorting + * order would be different, the %priority_queue will not re-sort + * the elements for you. (How could it know to do so?) + */ + template, + typename _Compare = less > + class priority_queue + { +#ifdef _GLIBCXX_CONCEPT_CHECKS + // concept requirements + typedef typename _Sequence::value_type _Sequence_value_type; +# if __cplusplus < 201103L + __glibcxx_class_requires(_Tp, _SGIAssignableConcept) +# endif + __glibcxx_class_requires(_Sequence, _SequenceConcept) + __glibcxx_class_requires(_Sequence, _RandomAccessContainerConcept) + __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept) + __glibcxx_class_requires4(_Compare, bool, _Tp, _Tp, + _BinaryFunctionConcept) +#endif + +#if __cplusplus >= 201103L + template + using _Uses = typename + enable_if::value>::type; +#endif + + public: + typedef typename _Sequence::value_type value_type; + typedef typename _Sequence::reference reference; + typedef typename _Sequence::const_reference const_reference; + typedef typename _Sequence::size_type size_type; + typedef _Sequence container_type; + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 2684. priority_queue lacking comparator typedef + typedef _Compare value_compare; + + protected: + // See queue::c for notes on these names. + _Sequence c; + _Compare comp; + + public: + /** + * @brief Default constructor creates no elements. + */ +#if __cplusplus < 201103L + explicit + priority_queue(const _Compare& __x = _Compare(), + const _Sequence& __s = _Sequence()) + : c(__s), comp(__x) + { std::make_heap(c.begin(), c.end(), comp); } +#else + template, + is_default_constructible<_Seq>>::value>::type> + priority_queue() + : c(), comp() { } + + explicit + priority_queue(const _Compare& __x, const _Sequence& __s) + : c(__s), comp(__x) + { std::make_heap(c.begin(), c.end(), comp); } + + explicit + priority_queue(const _Compare& __x, _Sequence&& __s = _Sequence()) + : c(std::move(__s)), comp(__x) + { std::make_heap(c.begin(), c.end(), comp); } + + template> + explicit + priority_queue(const _Alloc& __a) + : c(__a), comp() { } + + template> + priority_queue(const _Compare& __x, const _Alloc& __a) + : c(__a), comp(__x) { } + + template> + priority_queue(const _Compare& __x, const _Sequence& __c, + const _Alloc& __a) + : c(__c, __a), comp(__x) { } + + template> + priority_queue(const _Compare& __x, _Sequence&& __c, const _Alloc& __a) + : c(std::move(__c), __a), comp(__x) { } + + template> + priority_queue(const priority_queue& __q, const _Alloc& __a) + : c(__q.c, __a), comp(__q.comp) { } + + template> + priority_queue(priority_queue&& __q, const _Alloc& __a) + : c(std::move(__q.c), __a), comp(std::move(__q.comp)) { } +#endif + + /** + * @brief Builds a %queue from a range. + * @param __first An input iterator. + * @param __last An input iterator. + * @param __x A comparison functor describing a strict weak ordering. + * @param __s An initial sequence with which to start. + * + * Begins by copying @a __s, inserting a copy of the elements + * from @a [first,last) into the copy of @a __s, then ordering + * the copy according to @a __x. + * + * For more information on function objects, see the + * documentation on @link functors functor base + * classes@endlink. + */ +#if __cplusplus < 201103L + template + priority_queue(_InputIterator __first, _InputIterator __last, + const _Compare& __x = _Compare(), + const _Sequence& __s = _Sequence()) + : c(__s), comp(__x) + { + __glibcxx_requires_valid_range(__first, __last); + c.insert(c.end(), __first, __last); + std::make_heap(c.begin(), c.end(), comp); + } +#else + template + priority_queue(_InputIterator __first, _InputIterator __last, + const _Compare& __x, + const _Sequence& __s) + : c(__s), comp(__x) + { + __glibcxx_requires_valid_range(__first, __last); + c.insert(c.end(), __first, __last); + std::make_heap(c.begin(), c.end(), comp); + } + + template + priority_queue(_InputIterator __first, _InputIterator __last, + const _Compare& __x = _Compare(), + _Sequence&& __s = _Sequence()) + : c(std::move(__s)), comp(__x) + { + __glibcxx_requires_valid_range(__first, __last); + c.insert(c.end(), __first, __last); + std::make_heap(c.begin(), c.end(), comp); + } +#endif + + /** + * Returns true if the %queue is empty. + */ + bool + empty() const + { return c.empty(); } + + /** Returns the number of elements in the %queue. */ + size_type + size() const + { return c.size(); } + + /** + * Returns a read-only (constant) reference to the data at the first + * element of the %queue. + */ + const_reference + top() const + { + __glibcxx_requires_nonempty(); + return c.front(); + } + + /** + * @brief Add data to the %queue. + * @param __x Data to be added. + * + * This is a typical %queue operation. + * The time complexity of the operation depends on the underlying + * sequence. + */ + void + push(const value_type& __x) + { + c.push_back(__x); + std::push_heap(c.begin(), c.end(), comp); + } + +#if __cplusplus >= 201103L + void + push(value_type&& __x) + { + c.push_back(std::move(__x)); + std::push_heap(c.begin(), c.end(), comp); + } + + template + void + emplace(_Args&&... __args) + { + c.emplace_back(std::forward<_Args>(__args)...); + std::push_heap(c.begin(), c.end(), comp); + } +#endif + + /** + * @brief Removes first element. + * + * This is a typical %queue operation. It shrinks the %queue + * by one. The time complexity of the operation depends on the + * underlying sequence. + * + * Note that no data is returned, and if the first element's + * data is needed, it should be retrieved before pop() is + * called. + */ + void + pop() + { + __glibcxx_requires_nonempty(); + std::pop_heap(c.begin(), c.end(), comp); + c.pop_back(); + } + +#if __cplusplus >= 201103L + void + swap(priority_queue& __pq) + noexcept(__and_< +#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 + __is_nothrow_swappable<_Sequence>, +#else + __is_nothrow_swappable<_Tp>, +#endif + __is_nothrow_swappable<_Compare> + >::value) + { + using std::swap; + swap(c, __pq.c); + swap(comp, __pq.comp); + } +#endif // __cplusplus >= 201103L + }; + + // No equality/comparison operators are provided for priority_queue. + +#if __cplusplus >= 201103L + template + inline +#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 + // Constrained free swap overload, see p0185r1 + typename enable_if<__and_<__is_swappable<_Sequence>, + __is_swappable<_Compare>>::value>::type +#else + void +#endif + swap(priority_queue<_Tp, _Sequence, _Compare>& __x, + priority_queue<_Tp, _Sequence, _Compare>& __y) + noexcept(noexcept(__x.swap(__y))) + { __x.swap(__y); } + + template + struct uses_allocator, _Alloc> + : public uses_allocator<_Sequence, _Alloc>::type { }; +#endif // __cplusplus >= 201103L + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _STL_QUEUE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_raw_storage_iter.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_raw_storage_iter.h new file mode 100644 index 0000000..4ad9a91 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_raw_storage_iter.h @@ -0,0 +1,123 @@ +// -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_raw_storage_iter.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _STL_RAW_STORAGE_ITERATOR_H +#define _STL_RAW_STORAGE_ITERATOR_H 1 + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * This iterator class lets algorithms store their results into + * uninitialized memory. + */ + template + class raw_storage_iterator + : public iterator + { + protected: + _OutputIterator _M_iter; + + public: + explicit + raw_storage_iterator(_OutputIterator __x) + : _M_iter(__x) {} + + raw_storage_iterator& + operator*() { return *this; } + + raw_storage_iterator& + operator=(const _Tp& __element) + { + std::_Construct(std::__addressof(*_M_iter), __element); + return *this; + } + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2127. Move-construction with raw_storage_iterator + raw_storage_iterator& + operator=(_Tp&& __element) + { + std::_Construct(std::__addressof(*_M_iter), std::move(__element)); + return *this; + } +#endif + + raw_storage_iterator& + operator++() + { + ++_M_iter; + return *this; + } + + raw_storage_iterator + operator++(int) + { + raw_storage_iterator __tmp = *this; + ++_M_iter; + return __tmp; + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2454. Add raw_storage_iterator::base() member + _OutputIterator base() const { return _M_iter; } + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_relops.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_relops.h new file mode 100644 index 0000000..a2614bd --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_relops.h @@ -0,0 +1,134 @@ +// std::rel_ops implementation -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the, 2009 Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * Copyright (c) 1996,1997 + * Silicon Graphics + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + */ + +/** @file bits/stl_relops.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{utility} + * + * Inclusion of this file has been removed from + * all of the other STL headers for safety reasons, except std_utility.h. + * For more information, see the thread of about twenty messages starting + * with http://gcc.gnu.org/ml/libstdc++/2001-01/msg00223.html, or + * http://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.ambiguous_overloads + * + * Short summary: the rel_ops operators should be avoided for the present. + */ + +#ifndef _STL_RELOPS_H +#define _STL_RELOPS_H 1 + +namespace std _GLIBCXX_VISIBILITY(default) +{ + namespace rel_ops + { + _GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** @namespace std::rel_ops + * @brief The generated relational operators are sequestered here. + */ + + /** + * @brief Defines @c != for arbitrary types, in terms of @c ==. + * @param __x A thing. + * @param __y Another thing. + * @return __x != __y + * + * This function uses @c == to determine its result. + */ + template + inline bool + operator!=(const _Tp& __x, const _Tp& __y) + { return !(__x == __y); } + + /** + * @brief Defines @c > for arbitrary types, in terms of @c <. + * @param __x A thing. + * @param __y Another thing. + * @return __x > __y + * + * This function uses @c < to determine its result. + */ + template + inline bool + operator>(const _Tp& __x, const _Tp& __y) + { return __y < __x; } + + /** + * @brief Defines @c <= for arbitrary types, in terms of @c <. + * @param __x A thing. + * @param __y Another thing. + * @return __x <= __y + * + * This function uses @c < to determine its result. + */ + template + inline bool + operator<=(const _Tp& __x, const _Tp& __y) + { return !(__y < __x); } + + /** + * @brief Defines @c >= for arbitrary types, in terms of @c <. + * @param __x A thing. + * @param __y Another thing. + * @return __x >= __y + * + * This function uses @c < to determine its result. + */ + template + inline bool + operator>=(const _Tp& __x, const _Tp& __y) + { return !(__x < __y); } + + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace rel_ops + +} // namespace std + +#endif /* _STL_RELOPS_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_set.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_set.h new file mode 100644 index 0000000..817bc2d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_set.h @@ -0,0 +1,993 @@ +// Set implementation -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_set.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{set} + */ + +#ifndef _STL_SET_H +#define _STL_SET_H 1 + +#include +#if __cplusplus >= 201103L +#include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_CONTAINER + + template + class multiset; + + /** + * @brief A standard container made up of unique keys, which can be + * retrieved in logarithmic time. + * + * @ingroup associative_containers + * + * @tparam _Key Type of key objects. + * @tparam _Compare Comparison function object type, defaults to less<_Key>. + * @tparam _Alloc Allocator type, defaults to allocator<_Key>. + * + * Meets the requirements of a container, a + * reversible container, and an + * associative container (using unique keys). + * + * Sets support bidirectional iterators. + * + * The private tree data is declared exactly the same way for set and + * multiset; the distinction is made entirely in how the tree functions are + * called (*_unique versus *_equal, same as the standard). + */ + template, + typename _Alloc = std::allocator<_Key> > + class set + { +#ifdef _GLIBCXX_CONCEPT_CHECKS + // concept requirements + typedef typename _Alloc::value_type _Alloc_value_type; +# if __cplusplus < 201103L + __glibcxx_class_requires(_Key, _SGIAssignableConcept) +# endif + __glibcxx_class_requires4(_Compare, bool, _Key, _Key, + _BinaryFunctionConcept) + __glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept) +#endif + + public: + // typedefs: + //@{ + /// Public typedefs. + typedef _Key key_type; + typedef _Key value_type; + typedef _Compare key_compare; + typedef _Compare value_compare; + typedef _Alloc allocator_type; + //@} + + private: + typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template + rebind<_Key>::other _Key_alloc_type; + + typedef _Rb_tree, + key_compare, _Key_alloc_type> _Rep_type; + _Rep_type _M_t; // Red-black tree representing set. + + typedef __gnu_cxx::__alloc_traits<_Key_alloc_type> _Alloc_traits; + + public: + //@{ + /// Iterator-related typedefs. + typedef typename _Alloc_traits::pointer pointer; + typedef typename _Alloc_traits::const_pointer const_pointer; + typedef typename _Alloc_traits::reference reference; + typedef typename _Alloc_traits::const_reference const_reference; + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 103. set::iterator is required to be modifiable, + // but this allows modification of keys. + typedef typename _Rep_type::const_iterator iterator; + typedef typename _Rep_type::const_iterator const_iterator; + typedef typename _Rep_type::const_reverse_iterator reverse_iterator; + typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; + typedef typename _Rep_type::size_type size_type; + typedef typename _Rep_type::difference_type difference_type; + //@} + +#if __cplusplus > 201402L + using node_type = typename _Rep_type::node_type; + using insert_return_type = typename _Rep_type::insert_return_type; +#endif + + // allocation/deallocation + /** + * @brief Default constructor creates no elements. + */ +#if __cplusplus < 201103L + set() : _M_t() { } +#else + set() = default; +#endif + + /** + * @brief Creates a %set with no elements. + * @param __comp Comparator to use. + * @param __a An allocator object. + */ + explicit + set(const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, _Key_alloc_type(__a)) { } + + /** + * @brief Builds a %set from a range. + * @param __first An input iterator. + * @param __last An input iterator. + * + * Create a %set consisting of copies of the elements from + * [__first,__last). This is linear in N if the range is + * already sorted, and NlogN otherwise (where N is + * distance(__first,__last)). + */ + template + set(_InputIterator __first, _InputIterator __last) + : _M_t() + { _M_t._M_insert_unique(__first, __last); } + + /** + * @brief Builds a %set from a range. + * @param __first An input iterator. + * @param __last An input iterator. + * @param __comp A comparison functor. + * @param __a An allocator object. + * + * Create a %set consisting of copies of the elements from + * [__first,__last). This is linear in N if the range is + * already sorted, and NlogN otherwise (where N is + * distance(__first,__last)). + */ + template + set(_InputIterator __first, _InputIterator __last, + const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_t(__comp, _Key_alloc_type(__a)) + { _M_t._M_insert_unique(__first, __last); } + + /** + * @brief %Set copy constructor. + * + * Whether the allocator is copied depends on the allocator traits. + */ +#if __cplusplus < 201103L + set(const set& __x) + : _M_t(__x._M_t) { } +#else + set(const set&) = default; + + /** + * @brief %Set move constructor + * + * The newly-created %set contains the exact contents of the moved + * instance. The moved instance is a valid, but unspecified, %set. + */ + set(set&&) = default; + + /** + * @brief Builds a %set from an initializer_list. + * @param __l An initializer_list. + * @param __comp A comparison functor. + * @param __a An allocator object. + * + * Create a %set consisting of copies of the elements in the list. + * This is linear in N if the list is already sorted, and NlogN + * otherwise (where N is @a __l.size()). + */ + set(initializer_list __l, + const _Compare& __comp = _Compare(), + const allocator_type& __a = allocator_type()) + : _M_t(__comp, _Key_alloc_type(__a)) + { _M_t._M_insert_unique(__l.begin(), __l.end()); } + + /// Allocator-extended default constructor. + explicit + set(const allocator_type& __a) + : _M_t(_Compare(), _Key_alloc_type(__a)) { } + + /// Allocator-extended copy constructor. + set(const set& __x, const allocator_type& __a) + : _M_t(__x._M_t, _Key_alloc_type(__a)) { } + + /// Allocator-extended move constructor. + set(set&& __x, const allocator_type& __a) + noexcept(is_nothrow_copy_constructible<_Compare>::value + && _Alloc_traits::_S_always_equal()) + : _M_t(std::move(__x._M_t), _Key_alloc_type(__a)) { } + + /// Allocator-extended initialier-list constructor. + set(initializer_list __l, const allocator_type& __a) + : _M_t(_Compare(), _Key_alloc_type(__a)) + { _M_t._M_insert_unique(__l.begin(), __l.end()); } + + /// Allocator-extended range constructor. + template + set(_InputIterator __first, _InputIterator __last, + const allocator_type& __a) + : _M_t(_Compare(), _Key_alloc_type(__a)) + { _M_t._M_insert_unique(__first, __last); } + + /** + * The dtor only erases the elements, and note that if the elements + * themselves are pointers, the pointed-to memory is not touched in any + * way. Managing the pointer is the user's responsibility. + */ + ~set() = default; +#endif + + /** + * @brief %Set assignment operator. + * + * Whether the allocator is copied depends on the allocator traits. + */ +#if __cplusplus < 201103L + set& + operator=(const set& __x) + { + _M_t = __x._M_t; + return *this; + } +#else + set& + operator=(const set&) = default; + + /// Move assignment operator. + set& + operator=(set&&) = default; + + /** + * @brief %Set list assignment operator. + * @param __l An initializer_list. + * + * This function fills a %set with copies of the elements in the + * initializer list @a __l. + * + * Note that the assignment completely changes the %set and + * that the resulting %set's size is the same as the number + * of elements assigned. + */ + set& + operator=(initializer_list __l) + { + _M_t._M_assign_unique(__l.begin(), __l.end()); + return *this; + } +#endif + + // accessors: + + /// Returns the comparison object with which the %set was constructed. + key_compare + key_comp() const + { return _M_t.key_comp(); } + /// Returns the comparison object with which the %set was constructed. + value_compare + value_comp() const + { return _M_t.key_comp(); } + /// Returns the allocator object with which the %set was constructed. + allocator_type + get_allocator() const _GLIBCXX_NOEXCEPT + { return allocator_type(_M_t.get_allocator()); } + + /** + * Returns a read-only (constant) iterator that points to the first + * element in the %set. Iteration is done in ascending order according + * to the keys. + */ + iterator + begin() const _GLIBCXX_NOEXCEPT + { return _M_t.begin(); } + + /** + * Returns a read-only (constant) iterator that points one past the last + * element in the %set. Iteration is done in ascending order according + * to the keys. + */ + iterator + end() const _GLIBCXX_NOEXCEPT + { return _M_t.end(); } + + /** + * Returns a read-only (constant) iterator that points to the last + * element in the %set. Iteration is done in descending order according + * to the keys. + */ + reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return _M_t.rbegin(); } + + /** + * Returns a read-only (constant) reverse iterator that points to the + * last pair in the %set. Iteration is done in descending order + * according to the keys. + */ + reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return _M_t.rend(); } + +#if __cplusplus >= 201103L + /** + * Returns a read-only (constant) iterator that points to the first + * element in the %set. Iteration is done in ascending order according + * to the keys. + */ + iterator + cbegin() const noexcept + { return _M_t.begin(); } + + /** + * Returns a read-only (constant) iterator that points one past the last + * element in the %set. Iteration is done in ascending order according + * to the keys. + */ + iterator + cend() const noexcept + { return _M_t.end(); } + + /** + * Returns a read-only (constant) iterator that points to the last + * element in the %set. Iteration is done in descending order according + * to the keys. + */ + reverse_iterator + crbegin() const noexcept + { return _M_t.rbegin(); } + + /** + * Returns a read-only (constant) reverse iterator that points to the + * last pair in the %set. Iteration is done in descending order + * according to the keys. + */ + reverse_iterator + crend() const noexcept + { return _M_t.rend(); } +#endif + + /// Returns true if the %set is empty. + bool + empty() const _GLIBCXX_NOEXCEPT + { return _M_t.empty(); } + + /// Returns the size of the %set. + size_type + size() const _GLIBCXX_NOEXCEPT + { return _M_t.size(); } + + /// Returns the maximum size of the %set. + size_type + max_size() const _GLIBCXX_NOEXCEPT + { return _M_t.max_size(); } + + /** + * @brief Swaps data with another %set. + * @param __x A %set of the same element and allocator types. + * + * This exchanges the elements between two sets in constant + * time. (It is only swapping a pointer, an integer, and an + * instance of the @c Compare type (which itself is often + * stateless and empty), so it should be quite fast.) Note + * that the global std::swap() function is specialized such + * that std::swap(s1,s2) will feed to this function. + * + * Whether the allocators are swapped depends on the allocator traits. + */ + void + swap(set& __x) + _GLIBCXX_NOEXCEPT_IF(__is_nothrow_swappable<_Compare>::value) + { _M_t.swap(__x._M_t); } + + // insert/erase +#if __cplusplus >= 201103L + /** + * @brief Attempts to build and insert an element into the %set. + * @param __args Arguments used to generate an element. + * @return A pair, of which the first element is an iterator that points + * to the possibly inserted element, and the second is a bool + * that is true if the element was actually inserted. + * + * This function attempts to build and insert an element into the %set. + * A %set relies on unique keys and thus an element is only inserted if + * it is not already present in the %set. + * + * Insertion requires logarithmic time. + */ + template + std::pair + emplace(_Args&&... __args) + { return _M_t._M_emplace_unique(std::forward<_Args>(__args)...); } + + /** + * @brief Attempts to insert an element into the %set. + * @param __pos An iterator that serves as a hint as to where the + * element should be inserted. + * @param __args Arguments used to generate the element to be + * inserted. + * @return An iterator that points to the element with key equivalent to + * the one generated from @a __args (may or may not be the + * element itself). + * + * This function is not concerned about whether the insertion took place, + * and thus does not return a boolean like the single-argument emplace() + * does. Note that the first parameter is only a hint and can + * potentially improve the performance of the insertion process. A bad + * hint would cause no gains in efficiency. + * + * For more on @a hinting, see: + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints + * + * Insertion requires logarithmic time (if the hint is not taken). + */ + template + iterator + emplace_hint(const_iterator __pos, _Args&&... __args) + { + return _M_t._M_emplace_hint_unique(__pos, + std::forward<_Args>(__args)...); + } +#endif + + /** + * @brief Attempts to insert an element into the %set. + * @param __x Element to be inserted. + * @return A pair, of which the first element is an iterator that points + * to the possibly inserted element, and the second is a bool + * that is true if the element was actually inserted. + * + * This function attempts to insert an element into the %set. A %set + * relies on unique keys and thus an element is only inserted if it is + * not already present in the %set. + * + * Insertion requires logarithmic time. + */ + std::pair + insert(const value_type& __x) + { + std::pair __p = + _M_t._M_insert_unique(__x); + return std::pair(__p.first, __p.second); + } + +#if __cplusplus >= 201103L + std::pair + insert(value_type&& __x) + { + std::pair __p = + _M_t._M_insert_unique(std::move(__x)); + return std::pair(__p.first, __p.second); + } +#endif + + /** + * @brief Attempts to insert an element into the %set. + * @param __position An iterator that serves as a hint as to where the + * element should be inserted. + * @param __x Element to be inserted. + * @return An iterator that points to the element with key of + * @a __x (may or may not be the element passed in). + * + * This function is not concerned about whether the insertion took place, + * and thus does not return a boolean like the single-argument insert() + * does. Note that the first parameter is only a hint and can + * potentially improve the performance of the insertion process. A bad + * hint would cause no gains in efficiency. + * + * For more on @a hinting, see: + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints + * + * Insertion requires logarithmic time (if the hint is not taken). + */ + iterator + insert(const_iterator __position, const value_type& __x) + { return _M_t._M_insert_unique_(__position, __x); } + +#if __cplusplus >= 201103L + iterator + insert(const_iterator __position, value_type&& __x) + { return _M_t._M_insert_unique_(__position, std::move(__x)); } +#endif + + /** + * @brief A template function that attempts to insert a range + * of elements. + * @param __first Iterator pointing to the start of the range to be + * inserted. + * @param __last Iterator pointing to the end of the range. + * + * Complexity similar to that of the range constructor. + */ + template + void + insert(_InputIterator __first, _InputIterator __last) + { _M_t._M_insert_unique(__first, __last); } + +#if __cplusplus >= 201103L + /** + * @brief Attempts to insert a list of elements into the %set. + * @param __l A std::initializer_list of elements + * to be inserted. + * + * Complexity similar to that of the range constructor. + */ + void + insert(initializer_list __l) + { this->insert(__l.begin(), __l.end()); } +#endif + +#if __cplusplus > 201402L + /// Extract a node. + node_type + extract(const_iterator __pos) + { + __glibcxx_assert(__pos != end()); + return _M_t.extract(__pos); + } + + /// Extract a node. + node_type + extract(const key_type& __x) + { return _M_t.extract(__x); } + + /// Re-insert an extracted node. + insert_return_type + insert(node_type&& __nh) + { return _M_t._M_reinsert_node_unique(std::move(__nh)); } + + /// Re-insert an extracted node. + iterator + insert(const_iterator __hint, node_type&& __nh) + { return _M_t._M_reinsert_node_hint_unique(__hint, std::move(__nh)); } + + template + friend class _Rb_tree_merge_helper; + + template + void + merge(set<_Key, _Compare1, _Alloc>& __source) + { + using _Merge_helper = _Rb_tree_merge_helper; + _M_t._M_merge_unique(_Merge_helper::_S_get_tree(__source)); + } + + template + void + merge(set<_Key, _Compare1, _Alloc>&& __source) + { merge(__source); } + + template + void + merge(multiset<_Key, _Compare1, _Alloc>& __source) + { + using _Merge_helper = _Rb_tree_merge_helper; + _M_t._M_merge_unique(_Merge_helper::_S_get_tree(__source)); + } + + template + void + merge(multiset<_Key, _Compare1, _Alloc>&& __source) + { merge(__source); } +#endif // C++17 + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 130. Associative erase should return an iterator. + /** + * @brief Erases an element from a %set. + * @param __position An iterator pointing to the element to be erased. + * @return An iterator pointing to the element immediately following + * @a __position prior to the element being erased. If no such + * element exists, end() is returned. + * + * This function erases an element, pointed to by the given iterator, + * from a %set. Note that this function only erases the element, and + * that if the element is itself a pointer, the pointed-to memory is not + * touched in any way. Managing the pointer is the user's + * responsibility. + */ + _GLIBCXX_ABI_TAG_CXX11 + iterator + erase(const_iterator __position) + { return _M_t.erase(__position); } +#else + /** + * @brief Erases an element from a %set. + * @param position An iterator pointing to the element to be erased. + * + * This function erases an element, pointed to by the given iterator, + * from a %set. Note that this function only erases the element, and + * that if the element is itself a pointer, the pointed-to memory is not + * touched in any way. Managing the pointer is the user's + * responsibility. + */ + void + erase(iterator __position) + { _M_t.erase(__position); } +#endif + + /** + * @brief Erases elements according to the provided key. + * @param __x Key of element to be erased. + * @return The number of elements erased. + * + * This function erases all the elements located by the given key from + * a %set. + * Note that this function only erases the element, and that if + * the element is itself a pointer, the pointed-to memory is not touched + * in any way. Managing the pointer is the user's responsibility. + */ + size_type + erase(const key_type& __x) + { return _M_t.erase(__x); } + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 130. Associative erase should return an iterator. + /** + * @brief Erases a [__first,__last) range of elements from a %set. + * @param __first Iterator pointing to the start of the range to be + * erased. + + * @param __last Iterator pointing to the end of the range to + * be erased. + * @return The iterator @a __last. + * + * This function erases a sequence of elements from a %set. + * Note that this function only erases the element, and that if + * the element is itself a pointer, the pointed-to memory is not touched + * in any way. Managing the pointer is the user's responsibility. + */ + _GLIBCXX_ABI_TAG_CXX11 + iterator + erase(const_iterator __first, const_iterator __last) + { return _M_t.erase(__first, __last); } +#else + /** + * @brief Erases a [first,last) range of elements from a %set. + * @param __first Iterator pointing to the start of the range to be + * erased. + * @param __last Iterator pointing to the end of the range to + * be erased. + * + * This function erases a sequence of elements from a %set. + * Note that this function only erases the element, and that if + * the element is itself a pointer, the pointed-to memory is not touched + * in any way. Managing the pointer is the user's responsibility. + */ + void + erase(iterator __first, iterator __last) + { _M_t.erase(__first, __last); } +#endif + + /** + * Erases all elements in a %set. Note that this function only erases + * the elements, and that if the elements themselves are pointers, the + * pointed-to memory is not touched in any way. Managing the pointer is + * the user's responsibility. + */ + void + clear() _GLIBCXX_NOEXCEPT + { _M_t.clear(); } + + // set operations: + + //@{ + /** + * @brief Finds the number of elements. + * @param __x Element to located. + * @return Number of elements with specified key. + * + * This function only makes sense for multisets; for set the result will + * either be 0 (not present) or 1 (present). + */ + size_type + count(const key_type& __x) const + { return _M_t.find(__x) == _M_t.end() ? 0 : 1; } + +#if __cplusplus > 201103L + template + auto + count(const _Kt& __x) const + -> decltype(_M_t._M_count_tr(__x)) + { return _M_t._M_count_tr(__x); } +#endif + //@} + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 214. set::find() missing const overload + //@{ + /** + * @brief Tries to locate an element in a %set. + * @param __x Element to be located. + * @return Iterator pointing to sought-after element, or end() if not + * found. + * + * This function takes a key and tries to locate the element with which + * the key matches. If successful the function returns an iterator + * pointing to the sought after element. If unsuccessful it returns the + * past-the-end ( @c end() ) iterator. + */ + iterator + find(const key_type& __x) + { return _M_t.find(__x); } + + const_iterator + find(const key_type& __x) const + { return _M_t.find(__x); } + +#if __cplusplus > 201103L + template + auto + find(const _Kt& __x) + -> decltype(iterator{_M_t._M_find_tr(__x)}) + { return iterator{_M_t._M_find_tr(__x)}; } + + template + auto + find(const _Kt& __x) const + -> decltype(const_iterator{_M_t._M_find_tr(__x)}) + { return const_iterator{_M_t._M_find_tr(__x)}; } +#endif + //@} + + //@{ + /** + * @brief Finds the beginning of a subsequence matching given key. + * @param __x Key to be located. + * @return Iterator pointing to first element equal to or greater + * than key, or end(). + * + * This function returns the first element of a subsequence of elements + * that matches the given key. If unsuccessful it returns an iterator + * pointing to the first element that has a greater value than given key + * or end() if no such element exists. + */ + iterator + lower_bound(const key_type& __x) + { return _M_t.lower_bound(__x); } + + const_iterator + lower_bound(const key_type& __x) const + { return _M_t.lower_bound(__x); } + +#if __cplusplus > 201103L + template + auto + lower_bound(const _Kt& __x) + -> decltype(iterator(_M_t._M_lower_bound_tr(__x))) + { return iterator(_M_t._M_lower_bound_tr(__x)); } + + template + auto + lower_bound(const _Kt& __x) const + -> decltype(const_iterator(_M_t._M_lower_bound_tr(__x))) + { return const_iterator(_M_t._M_lower_bound_tr(__x)); } +#endif + //@} + + //@{ + /** + * @brief Finds the end of a subsequence matching given key. + * @param __x Key to be located. + * @return Iterator pointing to the first element + * greater than key, or end(). + */ + iterator + upper_bound(const key_type& __x) + { return _M_t.upper_bound(__x); } + + const_iterator + upper_bound(const key_type& __x) const + { return _M_t.upper_bound(__x); } + +#if __cplusplus > 201103L + template + auto + upper_bound(const _Kt& __x) + -> decltype(iterator(_M_t._M_upper_bound_tr(__x))) + { return iterator(_M_t._M_upper_bound_tr(__x)); } + + template + auto + upper_bound(const _Kt& __x) const + -> decltype(iterator(_M_t._M_upper_bound_tr(__x))) + { return const_iterator(_M_t._M_upper_bound_tr(__x)); } +#endif + //@} + + //@{ + /** + * @brief Finds a subsequence matching given key. + * @param __x Key to be located. + * @return Pair of iterators that possibly points to the subsequence + * matching given key. + * + * This function is equivalent to + * @code + * std::make_pair(c.lower_bound(val), + * c.upper_bound(val)) + * @endcode + * (but is faster than making the calls separately). + * + * This function probably only makes sense for multisets. + */ + std::pair + equal_range(const key_type& __x) + { return _M_t.equal_range(__x); } + + std::pair + equal_range(const key_type& __x) const + { return _M_t.equal_range(__x); } + +#if __cplusplus > 201103L + template + auto + equal_range(const _Kt& __x) + -> decltype(pair(_M_t._M_equal_range_tr(__x))) + { return pair(_M_t._M_equal_range_tr(__x)); } + + template + auto + equal_range(const _Kt& __x) const + -> decltype(pair(_M_t._M_equal_range_tr(__x))) + { return pair(_M_t._M_equal_range_tr(__x)); } +#endif + //@} + + template + friend bool + operator==(const set<_K1, _C1, _A1>&, const set<_K1, _C1, _A1>&); + + template + friend bool + operator<(const set<_K1, _C1, _A1>&, const set<_K1, _C1, _A1>&); + }; + + + /** + * @brief Set equality comparison. + * @param __x A %set. + * @param __y A %set of the same type as @a x. + * @return True iff the size and elements of the sets are equal. + * + * This is an equivalence relation. It is linear in the size of the sets. + * Sets are considered equivalent if their sizes are equal, and if + * corresponding elements compare equal. + */ + template + inline bool + operator==(const set<_Key, _Compare, _Alloc>& __x, + const set<_Key, _Compare, _Alloc>& __y) + { return __x._M_t == __y._M_t; } + + /** + * @brief Set ordering relation. + * @param __x A %set. + * @param __y A %set of the same type as @a x. + * @return True iff @a __x is lexicographically less than @a __y. + * + * This is a total ordering relation. It is linear in the size of the + * sets. The elements must be comparable with @c <. + * + * See std::lexicographical_compare() for how the determination is made. + */ + template + inline bool + operator<(const set<_Key, _Compare, _Alloc>& __x, + const set<_Key, _Compare, _Alloc>& __y) + { return __x._M_t < __y._M_t; } + + /// Returns !(x == y). + template + inline bool + operator!=(const set<_Key, _Compare, _Alloc>& __x, + const set<_Key, _Compare, _Alloc>& __y) + { return !(__x == __y); } + + /// Returns y < x. + template + inline bool + operator>(const set<_Key, _Compare, _Alloc>& __x, + const set<_Key, _Compare, _Alloc>& __y) + { return __y < __x; } + + /// Returns !(y < x) + template + inline bool + operator<=(const set<_Key, _Compare, _Alloc>& __x, + const set<_Key, _Compare, _Alloc>& __y) + { return !(__y < __x); } + + /// Returns !(x < y) + template + inline bool + operator>=(const set<_Key, _Compare, _Alloc>& __x, + const set<_Key, _Compare, _Alloc>& __y) + { return !(__x < __y); } + + /// See std::set::swap(). + template + inline void + swap(set<_Key, _Compare, _Alloc>& __x, set<_Key, _Compare, _Alloc>& __y) + _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y))) + { __x.swap(__y); } + +_GLIBCXX_END_NAMESPACE_CONTAINER + +#if __cplusplus > 201402L +_GLIBCXX_BEGIN_NAMESPACE_VERSION + // Allow std::set access to internals of compatible sets. + template + struct + _Rb_tree_merge_helper<_GLIBCXX_STD_C::set<_Val, _Cmp1, _Alloc>, _Cmp2> + { + private: + friend class _GLIBCXX_STD_C::set<_Val, _Cmp1, _Alloc>; + + static auto& + _S_get_tree(_GLIBCXX_STD_C::set<_Val, _Cmp2, _Alloc>& __set) + { return __set._M_t; } + + static auto& + _S_get_tree(_GLIBCXX_STD_C::multiset<_Val, _Cmp2, _Alloc>& __set) + { return __set._M_t; } + }; +_GLIBCXX_END_NAMESPACE_VERSION +#endif // C++17 + +} //namespace std +#endif /* _STL_SET_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_stack.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_stack.h new file mode 100644 index 0000000..5f2b4ab --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_stack.h @@ -0,0 +1,359 @@ +// Stack implementation -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_stack.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{stack} + */ + +#ifndef _STL_STACK_H +#define _STL_STACK_H 1 + +#include +#include +#if __cplusplus >= 201103L +# include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @brief A standard container giving FILO behavior. + * + * @ingroup sequences + * + * @tparam _Tp Type of element. + * @tparam _Sequence Type of underlying sequence, defaults to deque<_Tp>. + * + * Meets many of the requirements of a + * container, + * but does not define anything to do with iterators. Very few of the + * other standard container interfaces are defined. + * + * This is not a true container, but an @e adaptor. It holds + * another container, and provides a wrapper interface to that + * container. The wrapper is what enforces strict + * first-in-last-out %stack behavior. + * + * The second template parameter defines the type of the underlying + * sequence/container. It defaults to std::deque, but it can be + * any type that supports @c back, @c push_back, and @c pop_back, + * such as std::list, std::vector, or an appropriate user-defined + * type. + * + * Members not found in @a normal containers are @c container_type, + * which is a typedef for the second Sequence parameter, and @c + * push, @c pop, and @c top, which are standard %stack/FILO + * operations. + */ + template > + class stack + { +#ifdef _GLIBCXX_CONCEPT_CHECKS + // concept requirements + typedef typename _Sequence::value_type _Sequence_value_type; +# if __cplusplus < 201103L + __glibcxx_class_requires(_Tp, _SGIAssignableConcept) + __glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept) +# endif + __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept) +#endif + + template + friend bool + operator==(const stack<_Tp1, _Seq1>&, const stack<_Tp1, _Seq1>&); + + template + friend bool + operator<(const stack<_Tp1, _Seq1>&, const stack<_Tp1, _Seq1>&); + +#if __cplusplus >= 201103L + template + using _Uses = typename + enable_if::value>::type; +#endif + + public: + typedef typename _Sequence::value_type value_type; + typedef typename _Sequence::reference reference; + typedef typename _Sequence::const_reference const_reference; + typedef typename _Sequence::size_type size_type; + typedef _Sequence container_type; + + protected: + // See queue::c for notes on this name. + _Sequence c; + + public: + // XXX removed old def ctor, added def arg to this one to match 14882 + /** + * @brief Default constructor creates no elements. + */ +#if __cplusplus < 201103L + explicit + stack(const _Sequence& __c = _Sequence()) + : c(__c) { } +#else + template::value>::type> + stack() + : c() { } + + explicit + stack(const _Sequence& __c) + : c(__c) { } + + explicit + stack(_Sequence&& __c) + : c(std::move(__c)) { } + + template> + explicit + stack(const _Alloc& __a) + : c(__a) { } + + template> + stack(const _Sequence& __c, const _Alloc& __a) + : c(__c, __a) { } + + template> + stack(_Sequence&& __c, const _Alloc& __a) + : c(std::move(__c), __a) { } + + template> + stack(const stack& __q, const _Alloc& __a) + : c(__q.c, __a) { } + + template> + stack(stack&& __q, const _Alloc& __a) + : c(std::move(__q.c), __a) { } +#endif + + /** + * Returns true if the %stack is empty. + */ + bool + empty() const + { return c.empty(); } + + /** Returns the number of elements in the %stack. */ + size_type + size() const + { return c.size(); } + + /** + * Returns a read/write reference to the data at the first + * element of the %stack. + */ + reference + top() + { + __glibcxx_requires_nonempty(); + return c.back(); + } + + /** + * Returns a read-only (constant) reference to the data at the first + * element of the %stack. + */ + const_reference + top() const + { + __glibcxx_requires_nonempty(); + return c.back(); + } + + /** + * @brief Add data to the top of the %stack. + * @param __x Data to be added. + * + * This is a typical %stack operation. The function creates an + * element at the top of the %stack and assigns the given data + * to it. The time complexity of the operation depends on the + * underlying sequence. + */ + void + push(const value_type& __x) + { c.push_back(__x); } + +#if __cplusplus >= 201103L + void + push(value_type&& __x) + { c.push_back(std::move(__x)); } + +#if __cplusplus > 201402L + template + decltype(auto) + emplace(_Args&&... __args) + { return c.emplace_back(std::forward<_Args>(__args)...); } +#else + template + void + emplace(_Args&&... __args) + { c.emplace_back(std::forward<_Args>(__args)...); } +#endif +#endif + + /** + * @brief Removes first element. + * + * This is a typical %stack operation. It shrinks the %stack + * by one. The time complexity of the operation depends on the + * underlying sequence. + * + * Note that no data is returned, and if the first element's + * data is needed, it should be retrieved before pop() is + * called. + */ + void + pop() + { + __glibcxx_requires_nonempty(); + c.pop_back(); + } + +#if __cplusplus >= 201103L + void + swap(stack& __s) +#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 + noexcept(__is_nothrow_swappable<_Sequence>::value) +#else + noexcept(__is_nothrow_swappable<_Tp>::value) +#endif + { + using std::swap; + swap(c, __s.c); + } +#endif // __cplusplus >= 201103L + }; + + /** + * @brief Stack equality comparison. + * @param __x A %stack. + * @param __y A %stack of the same type as @a __x. + * @return True iff the size and elements of the stacks are equal. + * + * This is an equivalence relation. Complexity and semantics + * depend on the underlying sequence type, but the expected rules + * are: this relation is linear in the size of the sequences, and + * stacks are considered equivalent if their sequences compare + * equal. + */ + template + inline bool + operator==(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y) + { return __x.c == __y.c; } + + /** + * @brief Stack ordering relation. + * @param __x A %stack. + * @param __y A %stack of the same type as @a x. + * @return True iff @a x is lexicographically less than @a __y. + * + * This is an total ordering relation. Complexity and semantics + * depend on the underlying sequence type, but the expected rules + * are: this relation is linear in the size of the sequences, the + * elements must be comparable with @c <, and + * std::lexicographical_compare() is usually used to make the + * determination. + */ + template + inline bool + operator<(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y) + { return __x.c < __y.c; } + + /// Based on operator== + template + inline bool + operator!=(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y) + { return !(__x == __y); } + + /// Based on operator< + template + inline bool + operator>(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y) + { return __y < __x; } + + /// Based on operator< + template + inline bool + operator<=(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y) + { return !(__y < __x); } + + /// Based on operator< + template + inline bool + operator>=(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y) + { return !(__x < __y); } + +#if __cplusplus >= 201103L + template + inline +#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 + // Constrained free swap overload, see p0185r1 + typename enable_if<__is_swappable<_Seq>::value>::type +#else + void +#endif + swap(stack<_Tp, _Seq>& __x, stack<_Tp, _Seq>& __y) + noexcept(noexcept(__x.swap(__y))) + { __x.swap(__y); } + + template + struct uses_allocator, _Alloc> + : public uses_allocator<_Seq, _Alloc>::type { }; +#endif // __cplusplus >= 201103L + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _STL_STACK_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_tempbuf.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_tempbuf.h new file mode 100644 index 0000000..03b4cd2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_tempbuf.h @@ -0,0 +1,271 @@ +// Temporary buffer implementation -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_tempbuf.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _STL_TEMPBUF_H +#define _STL_TEMPBUF_H 1 + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @brief Allocates a temporary buffer. + * @param __len The number of objects of type Tp. + * @return See full description. + * + * Reinventing the wheel, but this time with prettier spokes! + * + * This function tries to obtain storage for @c __len adjacent Tp + * objects. The objects themselves are not constructed, of course. + * A pair<> is returned containing the buffer s address and + * capacity (in the units of sizeof(_Tp)), or a pair of 0 values if + * no storage can be obtained. Note that the capacity obtained + * may be less than that requested if the memory is unavailable; + * you should compare len with the .second return value. + * + * Provides the nothrow exception guarantee. + */ + template + pair<_Tp*, ptrdiff_t> + get_temporary_buffer(ptrdiff_t __len) _GLIBCXX_NOEXCEPT + { + const ptrdiff_t __max = + __gnu_cxx::__numeric_traits::__max / sizeof(_Tp); + if (__len > __max) + __len = __max; + + while (__len > 0) + { + _Tp* __tmp = static_cast<_Tp*>(::operator new(__len * sizeof(_Tp), + std::nothrow)); + if (__tmp != 0) + return std::pair<_Tp*, ptrdiff_t>(__tmp, __len); + __len /= 2; + } + return std::pair<_Tp*, ptrdiff_t>(static_cast<_Tp*>(0), 0); + } + + /** + * @brief The companion to get_temporary_buffer(). + * @param __p A buffer previously allocated by get_temporary_buffer. + * @return None. + * + * Frees the memory pointed to by __p. + */ + template + inline void + return_temporary_buffer(_Tp* __p) + { ::operator delete(__p, std::nothrow); } + + + /** + * This class is used in two places: stl_algo.h and ext/memory, + * where it is wrapped as the temporary_buffer class. See + * temporary_buffer docs for more notes. + */ + template + class _Temporary_buffer + { + // concept requirements + __glibcxx_class_requires(_ForwardIterator, _ForwardIteratorConcept) + + public: + typedef _Tp value_type; + typedef value_type* pointer; + typedef pointer iterator; + typedef ptrdiff_t size_type; + + protected: + size_type _M_original_len; + size_type _M_len; + pointer _M_buffer; + + public: + /// As per Table mumble. + size_type + size() const + { return _M_len; } + + /// Returns the size requested by the constructor; may be >size(). + size_type + requested_size() const + { return _M_original_len; } + + /// As per Table mumble. + iterator + begin() + { return _M_buffer; } + + /// As per Table mumble. + iterator + end() + { return _M_buffer + _M_len; } + + /** + * Constructs a temporary buffer of a size somewhere between + * zero and the size of the given range. + */ + _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last); + + ~_Temporary_buffer() + { + std::_Destroy(_M_buffer, _M_buffer + _M_len); + std::return_temporary_buffer(_M_buffer); + } + + private: + // Disable copy constructor and assignment operator. + _Temporary_buffer(const _Temporary_buffer&); + + void + operator=(const _Temporary_buffer&); + }; + + + template + struct __uninitialized_construct_buf_dispatch + { + template + static void + __ucr(_Pointer __first, _Pointer __last, + _ForwardIterator __seed) + { + if(__first == __last) + return; + + _Pointer __cur = __first; + __try + { + std::_Construct(std::__addressof(*__first), + _GLIBCXX_MOVE(*__seed)); + _Pointer __prev = __cur; + ++__cur; + for(; __cur != __last; ++__cur, ++__prev) + std::_Construct(std::__addressof(*__cur), + _GLIBCXX_MOVE(*__prev)); + *__seed = _GLIBCXX_MOVE(*__prev); + } + __catch(...) + { + std::_Destroy(__first, __cur); + __throw_exception_again; + } + } + }; + + template<> + struct __uninitialized_construct_buf_dispatch + { + template + static void + __ucr(_Pointer, _Pointer, _ForwardIterator) { } + }; + + // Constructs objects in the range [first, last). + // Note that while these new objects will take valid values, + // their exact value is not defined. In particular they may + // be 'moved from'. + // + // While *__seed may be altered during this algorithm, it will have + // the same value when the algorithm finishes, unless one of the + // constructions throws. + // + // Requirements: _Pointer::value_type(_Tp&&) is valid. + template + inline void + __uninitialized_construct_buf(_Pointer __first, _Pointer __last, + _ForwardIterator __seed) + { + typedef typename std::iterator_traits<_Pointer>::value_type + _ValueType; + + std::__uninitialized_construct_buf_dispatch< + __has_trivial_constructor(_ValueType)>:: + __ucr(__first, __last, __seed); + } + + template + _Temporary_buffer<_ForwardIterator, _Tp>:: + _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last) + : _M_original_len(std::distance(__first, __last)), + _M_len(0), _M_buffer(0) + { + __try + { + std::pair __p(std::get_temporary_buffer< + value_type>(_M_original_len)); + _M_buffer = __p.first; + _M_len = __p.second; + if (_M_buffer) + std::__uninitialized_construct_buf(_M_buffer, _M_buffer + _M_len, + __first); + } + __catch(...) + { + std::return_temporary_buffer(_M_buffer); + _M_buffer = 0; + _M_len = 0; + __throw_exception_again; + } + } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _STL_TEMPBUF_H */ + diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_tree.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_tree.h new file mode 100644 index 0000000..b08496f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_tree.h @@ -0,0 +1,2614 @@ +// RB tree implementation -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + */ + +/** @file bits/stl_tree.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{map,set} + */ + +#ifndef _STL_TREE_H +#define _STL_TREE_H 1 + +#pragma GCC system_header + +#include +#include +#include +#include +#include +#if __cplusplus >= 201103L +# include +#endif +#if __cplusplus > 201402L +# include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#if __cplusplus > 201103L +# define __cpp_lib_generic_associative_lookup 201304 +#endif + + // Red-black tree class, designed for use in implementing STL + // associative containers (set, multiset, map, and multimap). The + // insertion and deletion algorithms are based on those in Cormen, + // Leiserson, and Rivest, Introduction to Algorithms (MIT Press, + // 1990), except that + // + // (1) the header cell is maintained with links not only to the root + // but also to the leftmost node of the tree, to enable constant + // time begin(), and to the rightmost node of the tree, to enable + // linear time performance when used with the generic set algorithms + // (set_union, etc.) + // + // (2) when a node being deleted has two children its successor node + // is relinked into its place, rather than copied, so that the only + // iterators invalidated are those referring to the deleted node. + + enum _Rb_tree_color { _S_red = false, _S_black = true }; + + struct _Rb_tree_node_base + { + typedef _Rb_tree_node_base* _Base_ptr; + typedef const _Rb_tree_node_base* _Const_Base_ptr; + + _Rb_tree_color _M_color; + _Base_ptr _M_parent; + _Base_ptr _M_left; + _Base_ptr _M_right; + + static _Base_ptr + _S_minimum(_Base_ptr __x) _GLIBCXX_NOEXCEPT + { + while (__x->_M_left != 0) __x = __x->_M_left; + return __x; + } + + static _Const_Base_ptr + _S_minimum(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT + { + while (__x->_M_left != 0) __x = __x->_M_left; + return __x; + } + + static _Base_ptr + _S_maximum(_Base_ptr __x) _GLIBCXX_NOEXCEPT + { + while (__x->_M_right != 0) __x = __x->_M_right; + return __x; + } + + static _Const_Base_ptr + _S_maximum(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT + { + while (__x->_M_right != 0) __x = __x->_M_right; + return __x; + } + }; + + // Helper type offering value initialization guarantee on the compare functor. + template + struct _Rb_tree_key_compare + { + _Key_compare _M_key_compare; + + _Rb_tree_key_compare() + _GLIBCXX_NOEXCEPT_IF( + is_nothrow_default_constructible<_Key_compare>::value) + : _M_key_compare() + { } + + _Rb_tree_key_compare(const _Key_compare& __comp) + : _M_key_compare(__comp) + { } + +#if __cplusplus >= 201103L + // Copy constructor added for consistency with C++98 mode. + _Rb_tree_key_compare(const _Rb_tree_key_compare&) = default; + + _Rb_tree_key_compare(_Rb_tree_key_compare&& __x) + noexcept(is_nothrow_copy_constructible<_Key_compare>::value) + : _M_key_compare(__x._M_key_compare) + { } +#endif + }; + + // Helper type to manage default initialization of node count and header. + struct _Rb_tree_header + { + _Rb_tree_node_base _M_header; + size_t _M_node_count; // Keeps track of size of tree. + + _Rb_tree_header() _GLIBCXX_NOEXCEPT + { + _M_header._M_color = _S_red; + _M_reset(); + } + +#if __cplusplus >= 201103L + _Rb_tree_header(_Rb_tree_header&& __x) noexcept + { + if (__x._M_header._M_parent != nullptr) + _M_move_data(__x); + else + { + _M_header._M_color = _S_red; + _M_reset(); + } + } +#endif + + void + _M_move_data(_Rb_tree_header& __from) + { + _M_header._M_color = __from._M_header._M_color; + _M_header._M_parent = __from._M_header._M_parent; + _M_header._M_left = __from._M_header._M_left; + _M_header._M_right = __from._M_header._M_right; + _M_header._M_parent->_M_parent = &_M_header; + _M_node_count = __from._M_node_count; + + __from._M_reset(); + } + + void + _M_reset() + { + _M_header._M_parent = 0; + _M_header._M_left = &_M_header; + _M_header._M_right = &_M_header; + _M_node_count = 0; + } + }; + + template + struct _Rb_tree_node : public _Rb_tree_node_base + { + typedef _Rb_tree_node<_Val>* _Link_type; + +#if __cplusplus < 201103L + _Val _M_value_field; + + _Val* + _M_valptr() + { return std::__addressof(_M_value_field); } + + const _Val* + _M_valptr() const + { return std::__addressof(_M_value_field); } +#else + __gnu_cxx::__aligned_membuf<_Val> _M_storage; + + _Val* + _M_valptr() + { return _M_storage._M_ptr(); } + + const _Val* + _M_valptr() const + { return _M_storage._M_ptr(); } +#endif + }; + + _GLIBCXX_PURE _Rb_tree_node_base* + _Rb_tree_increment(_Rb_tree_node_base* __x) throw (); + + _GLIBCXX_PURE const _Rb_tree_node_base* + _Rb_tree_increment(const _Rb_tree_node_base* __x) throw (); + + _GLIBCXX_PURE _Rb_tree_node_base* + _Rb_tree_decrement(_Rb_tree_node_base* __x) throw (); + + _GLIBCXX_PURE const _Rb_tree_node_base* + _Rb_tree_decrement(const _Rb_tree_node_base* __x) throw (); + + template + struct _Rb_tree_iterator + { + typedef _Tp value_type; + typedef _Tp& reference; + typedef _Tp* pointer; + + typedef bidirectional_iterator_tag iterator_category; + typedef ptrdiff_t difference_type; + + typedef _Rb_tree_iterator<_Tp> _Self; + typedef _Rb_tree_node_base::_Base_ptr _Base_ptr; + typedef _Rb_tree_node<_Tp>* _Link_type; + + _Rb_tree_iterator() _GLIBCXX_NOEXCEPT + : _M_node() { } + + explicit + _Rb_tree_iterator(_Base_ptr __x) _GLIBCXX_NOEXCEPT + : _M_node(__x) { } + + reference + operator*() const _GLIBCXX_NOEXCEPT + { return *static_cast<_Link_type>(_M_node)->_M_valptr(); } + + pointer + operator->() const _GLIBCXX_NOEXCEPT + { return static_cast<_Link_type> (_M_node)->_M_valptr(); } + + _Self& + operator++() _GLIBCXX_NOEXCEPT + { + _M_node = _Rb_tree_increment(_M_node); + return *this; + } + + _Self + operator++(int) _GLIBCXX_NOEXCEPT + { + _Self __tmp = *this; + _M_node = _Rb_tree_increment(_M_node); + return __tmp; + } + + _Self& + operator--() _GLIBCXX_NOEXCEPT + { + _M_node = _Rb_tree_decrement(_M_node); + return *this; + } + + _Self + operator--(int) _GLIBCXX_NOEXCEPT + { + _Self __tmp = *this; + _M_node = _Rb_tree_decrement(_M_node); + return __tmp; + } + + bool + operator==(const _Self& __x) const _GLIBCXX_NOEXCEPT + { return _M_node == __x._M_node; } + + bool + operator!=(const _Self& __x) const _GLIBCXX_NOEXCEPT + { return _M_node != __x._M_node; } + + _Base_ptr _M_node; + }; + + template + struct _Rb_tree_const_iterator + { + typedef _Tp value_type; + typedef const _Tp& reference; + typedef const _Tp* pointer; + + typedef _Rb_tree_iterator<_Tp> iterator; + + typedef bidirectional_iterator_tag iterator_category; + typedef ptrdiff_t difference_type; + + typedef _Rb_tree_const_iterator<_Tp> _Self; + typedef _Rb_tree_node_base::_Const_Base_ptr _Base_ptr; + typedef const _Rb_tree_node<_Tp>* _Link_type; + + _Rb_tree_const_iterator() _GLIBCXX_NOEXCEPT + : _M_node() { } + + explicit + _Rb_tree_const_iterator(_Base_ptr __x) _GLIBCXX_NOEXCEPT + : _M_node(__x) { } + + _Rb_tree_const_iterator(const iterator& __it) _GLIBCXX_NOEXCEPT + : _M_node(__it._M_node) { } + + iterator + _M_const_cast() const _GLIBCXX_NOEXCEPT + { return iterator(const_cast(_M_node)); } + + reference + operator*() const _GLIBCXX_NOEXCEPT + { return *static_cast<_Link_type>(_M_node)->_M_valptr(); } + + pointer + operator->() const _GLIBCXX_NOEXCEPT + { return static_cast<_Link_type>(_M_node)->_M_valptr(); } + + _Self& + operator++() _GLIBCXX_NOEXCEPT + { + _M_node = _Rb_tree_increment(_M_node); + return *this; + } + + _Self + operator++(int) _GLIBCXX_NOEXCEPT + { + _Self __tmp = *this; + _M_node = _Rb_tree_increment(_M_node); + return __tmp; + } + + _Self& + operator--() _GLIBCXX_NOEXCEPT + { + _M_node = _Rb_tree_decrement(_M_node); + return *this; + } + + _Self + operator--(int) _GLIBCXX_NOEXCEPT + { + _Self __tmp = *this; + _M_node = _Rb_tree_decrement(_M_node); + return __tmp; + } + + bool + operator==(const _Self& __x) const _GLIBCXX_NOEXCEPT + { return _M_node == __x._M_node; } + + bool + operator!=(const _Self& __x) const _GLIBCXX_NOEXCEPT + { return _M_node != __x._M_node; } + + _Base_ptr _M_node; + }; + + template + inline bool + operator==(const _Rb_tree_iterator<_Val>& __x, + const _Rb_tree_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT + { return __x._M_node == __y._M_node; } + + template + inline bool + operator!=(const _Rb_tree_iterator<_Val>& __x, + const _Rb_tree_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT + { return __x._M_node != __y._M_node; } + + void + _Rb_tree_insert_and_rebalance(const bool __insert_left, + _Rb_tree_node_base* __x, + _Rb_tree_node_base* __p, + _Rb_tree_node_base& __header) throw (); + + _Rb_tree_node_base* + _Rb_tree_rebalance_for_erase(_Rb_tree_node_base* const __z, + _Rb_tree_node_base& __header) throw (); + +#if __cplusplus > 201103L + template> + struct __has_is_transparent + { }; + + template + struct __has_is_transparent<_Cmp, _SfinaeType, + __void_t> + { typedef void type; }; +#endif + +#if __cplusplus > 201402L + template + struct _Rb_tree_merge_helper { }; +#endif + + template > + class _Rb_tree + { + typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template + rebind<_Rb_tree_node<_Val> >::other _Node_allocator; + + typedef __gnu_cxx::__alloc_traits<_Node_allocator> _Alloc_traits; + + protected: + typedef _Rb_tree_node_base* _Base_ptr; + typedef const _Rb_tree_node_base* _Const_Base_ptr; + typedef _Rb_tree_node<_Val>* _Link_type; + typedef const _Rb_tree_node<_Val>* _Const_Link_type; + + private: + // Functor recycling a pool of nodes and using allocation once the pool + // is empty. + struct _Reuse_or_alloc_node + { + _Reuse_or_alloc_node(_Rb_tree& __t) + : _M_root(__t._M_root()), _M_nodes(__t._M_rightmost()), _M_t(__t) + { + if (_M_root) + { + _M_root->_M_parent = 0; + + if (_M_nodes->_M_left) + _M_nodes = _M_nodes->_M_left; + } + else + _M_nodes = 0; + } + +#if __cplusplus >= 201103L + _Reuse_or_alloc_node(const _Reuse_or_alloc_node&) = delete; +#endif + + ~_Reuse_or_alloc_node() + { _M_t._M_erase(static_cast<_Link_type>(_M_root)); } + + template + _Link_type +#if __cplusplus < 201103L + operator()(const _Arg& __arg) +#else + operator()(_Arg&& __arg) +#endif + { + _Link_type __node = static_cast<_Link_type>(_M_extract()); + if (__node) + { + _M_t._M_destroy_node(__node); + _M_t._M_construct_node(__node, _GLIBCXX_FORWARD(_Arg, __arg)); + return __node; + } + + return _M_t._M_create_node(_GLIBCXX_FORWARD(_Arg, __arg)); + } + + private: + _Base_ptr + _M_extract() + { + if (!_M_nodes) + return _M_nodes; + + _Base_ptr __node = _M_nodes; + _M_nodes = _M_nodes->_M_parent; + if (_M_nodes) + { + if (_M_nodes->_M_right == __node) + { + _M_nodes->_M_right = 0; + + if (_M_nodes->_M_left) + { + _M_nodes = _M_nodes->_M_left; + + while (_M_nodes->_M_right) + _M_nodes = _M_nodes->_M_right; + + if (_M_nodes->_M_left) + _M_nodes = _M_nodes->_M_left; + } + } + else // __node is on the left. + _M_nodes->_M_left = 0; + } + else + _M_root = 0; + + return __node; + } + + _Base_ptr _M_root; + _Base_ptr _M_nodes; + _Rb_tree& _M_t; + }; + + // Functor similar to the previous one but without any pool of nodes to + // recycle. + struct _Alloc_node + { + _Alloc_node(_Rb_tree& __t) + : _M_t(__t) { } + + template + _Link_type +#if __cplusplus < 201103L + operator()(const _Arg& __arg) const +#else + operator()(_Arg&& __arg) const +#endif + { return _M_t._M_create_node(_GLIBCXX_FORWARD(_Arg, __arg)); } + + private: + _Rb_tree& _M_t; + }; + + public: + typedef _Key key_type; + typedef _Val value_type; + typedef value_type* pointer; + typedef const value_type* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Alloc allocator_type; + + _Node_allocator& + _M_get_Node_allocator() _GLIBCXX_NOEXCEPT + { return *static_cast<_Node_allocator*>(&this->_M_impl); } + + const _Node_allocator& + _M_get_Node_allocator() const _GLIBCXX_NOEXCEPT + { return *static_cast(&this->_M_impl); } + + allocator_type + get_allocator() const _GLIBCXX_NOEXCEPT + { return allocator_type(_M_get_Node_allocator()); } + + protected: + _Link_type + _M_get_node() + { return _Alloc_traits::allocate(_M_get_Node_allocator(), 1); } + + void + _M_put_node(_Link_type __p) _GLIBCXX_NOEXCEPT + { _Alloc_traits::deallocate(_M_get_Node_allocator(), __p, 1); } + +#if __cplusplus < 201103L + void + _M_construct_node(_Link_type __node, const value_type& __x) + { + __try + { get_allocator().construct(__node->_M_valptr(), __x); } + __catch(...) + { + _M_put_node(__node); + __throw_exception_again; + } + } + + _Link_type + _M_create_node(const value_type& __x) + { + _Link_type __tmp = _M_get_node(); + _M_construct_node(__tmp, __x); + return __tmp; + } + + void + _M_destroy_node(_Link_type __p) + { get_allocator().destroy(__p->_M_valptr()); } +#else + template + void + _M_construct_node(_Link_type __node, _Args&&... __args) + { + __try + { + ::new(__node) _Rb_tree_node<_Val>; + _Alloc_traits::construct(_M_get_Node_allocator(), + __node->_M_valptr(), + std::forward<_Args>(__args)...); + } + __catch(...) + { + __node->~_Rb_tree_node<_Val>(); + _M_put_node(__node); + __throw_exception_again; + } + } + + template + _Link_type + _M_create_node(_Args&&... __args) + { + _Link_type __tmp = _M_get_node(); + _M_construct_node(__tmp, std::forward<_Args>(__args)...); + return __tmp; + } + + void + _M_destroy_node(_Link_type __p) noexcept + { + _Alloc_traits::destroy(_M_get_Node_allocator(), __p->_M_valptr()); + __p->~_Rb_tree_node<_Val>(); + } +#endif + + void + _M_drop_node(_Link_type __p) _GLIBCXX_NOEXCEPT + { + _M_destroy_node(__p); + _M_put_node(__p); + } + + template + _Link_type + _M_clone_node(_Const_Link_type __x, _NodeGen& __node_gen) + { + _Link_type __tmp = __node_gen(*__x->_M_valptr()); + __tmp->_M_color = __x->_M_color; + __tmp->_M_left = 0; + __tmp->_M_right = 0; + return __tmp; + } + + protected: + // Unused _Is_pod_comparator is kept as it is part of mangled name. + template + struct _Rb_tree_impl + : public _Node_allocator + , public _Rb_tree_key_compare<_Key_compare> + , public _Rb_tree_header + { + typedef _Rb_tree_key_compare<_Key_compare> _Base_key_compare; + +#if __cplusplus < 201103L + _Rb_tree_impl() + { } +#else + _Rb_tree_impl() = default; + _Rb_tree_impl(_Rb_tree_impl&&) = default; +#endif + + _Rb_tree_impl(const _Rb_tree_impl& __x) + : _Node_allocator(_Alloc_traits::_S_select_on_copy(__x)) + , _Base_key_compare(__x._M_key_compare) + { } + +#if __cplusplus < 201103L + _Rb_tree_impl(const _Key_compare& __comp, const _Node_allocator& __a) + : _Node_allocator(__a), _Base_key_compare(__comp) + { } +#else + _Rb_tree_impl(const _Key_compare& __comp, _Node_allocator&& __a) + : _Node_allocator(std::move(__a)), _Base_key_compare(__comp) + { } +#endif + }; + + _Rb_tree_impl<_Compare> _M_impl; + + protected: + _Base_ptr& + _M_root() _GLIBCXX_NOEXCEPT + { return this->_M_impl._M_header._M_parent; } + + _Const_Base_ptr + _M_root() const _GLIBCXX_NOEXCEPT + { return this->_M_impl._M_header._M_parent; } + + _Base_ptr& + _M_leftmost() _GLIBCXX_NOEXCEPT + { return this->_M_impl._M_header._M_left; } + + _Const_Base_ptr + _M_leftmost() const _GLIBCXX_NOEXCEPT + { return this->_M_impl._M_header._M_left; } + + _Base_ptr& + _M_rightmost() _GLIBCXX_NOEXCEPT + { return this->_M_impl._M_header._M_right; } + + _Const_Base_ptr + _M_rightmost() const _GLIBCXX_NOEXCEPT + { return this->_M_impl._M_header._M_right; } + + _Link_type + _M_begin() _GLIBCXX_NOEXCEPT + { return static_cast<_Link_type>(this->_M_impl._M_header._M_parent); } + + _Const_Link_type + _M_begin() const _GLIBCXX_NOEXCEPT + { + return static_cast<_Const_Link_type> + (this->_M_impl._M_header._M_parent); + } + + _Base_ptr + _M_end() _GLIBCXX_NOEXCEPT + { return &this->_M_impl._M_header; } + + _Const_Base_ptr + _M_end() const _GLIBCXX_NOEXCEPT + { return &this->_M_impl._M_header; } + + static const_reference + _S_value(_Const_Link_type __x) + { return *__x->_M_valptr(); } + + static const _Key& + _S_key(_Const_Link_type __x) + { return _KeyOfValue()(_S_value(__x)); } + + static _Link_type + _S_left(_Base_ptr __x) _GLIBCXX_NOEXCEPT + { return static_cast<_Link_type>(__x->_M_left); } + + static _Const_Link_type + _S_left(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT + { return static_cast<_Const_Link_type>(__x->_M_left); } + + static _Link_type + _S_right(_Base_ptr __x) _GLIBCXX_NOEXCEPT + { return static_cast<_Link_type>(__x->_M_right); } + + static _Const_Link_type + _S_right(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT + { return static_cast<_Const_Link_type>(__x->_M_right); } + + static const_reference + _S_value(_Const_Base_ptr __x) + { return *static_cast<_Const_Link_type>(__x)->_M_valptr(); } + + static const _Key& + _S_key(_Const_Base_ptr __x) + { return _KeyOfValue()(_S_value(__x)); } + + static _Base_ptr + _S_minimum(_Base_ptr __x) _GLIBCXX_NOEXCEPT + { return _Rb_tree_node_base::_S_minimum(__x); } + + static _Const_Base_ptr + _S_minimum(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT + { return _Rb_tree_node_base::_S_minimum(__x); } + + static _Base_ptr + _S_maximum(_Base_ptr __x) _GLIBCXX_NOEXCEPT + { return _Rb_tree_node_base::_S_maximum(__x); } + + static _Const_Base_ptr + _S_maximum(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT + { return _Rb_tree_node_base::_S_maximum(__x); } + + public: + typedef _Rb_tree_iterator iterator; + typedef _Rb_tree_const_iterator const_iterator; + + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + +#if __cplusplus > 201402L + using node_type = _Node_handle<_Key, _Val, _Node_allocator>; + using insert_return_type = _Node_insert_return< + conditional_t, const_iterator, iterator>, + node_type>; +#endif + + pair<_Base_ptr, _Base_ptr> + _M_get_insert_unique_pos(const key_type& __k); + + pair<_Base_ptr, _Base_ptr> + _M_get_insert_equal_pos(const key_type& __k); + + pair<_Base_ptr, _Base_ptr> + _M_get_insert_hint_unique_pos(const_iterator __pos, + const key_type& __k); + + pair<_Base_ptr, _Base_ptr> + _M_get_insert_hint_equal_pos(const_iterator __pos, + const key_type& __k); + + private: +#if __cplusplus >= 201103L + template + iterator + _M_insert_(_Base_ptr __x, _Base_ptr __y, _Arg&& __v, _NodeGen&); + + iterator + _M_insert_node(_Base_ptr __x, _Base_ptr __y, _Link_type __z); + + template + iterator + _M_insert_lower(_Base_ptr __y, _Arg&& __v); + + template + iterator + _M_insert_equal_lower(_Arg&& __x); + + iterator + _M_insert_lower_node(_Base_ptr __p, _Link_type __z); + + iterator + _M_insert_equal_lower_node(_Link_type __z); +#else + template + iterator + _M_insert_(_Base_ptr __x, _Base_ptr __y, + const value_type& __v, _NodeGen&); + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 233. Insertion hints in associative containers. + iterator + _M_insert_lower(_Base_ptr __y, const value_type& __v); + + iterator + _M_insert_equal_lower(const value_type& __x); +#endif + + template + _Link_type + _M_copy(_Const_Link_type __x, _Base_ptr __p, _NodeGen&); + + template + _Link_type + _M_copy(const _Rb_tree& __x, _NodeGen& __gen) + { + _Link_type __root = _M_copy(__x._M_begin(), _M_end(), __gen); + _M_leftmost() = _S_minimum(__root); + _M_rightmost() = _S_maximum(__root); + _M_impl._M_node_count = __x._M_impl._M_node_count; + return __root; + } + + _Link_type + _M_copy(const _Rb_tree& __x) + { + _Alloc_node __an(*this); + return _M_copy(__x, __an); + } + + void + _M_erase(_Link_type __x); + + iterator + _M_lower_bound(_Link_type __x, _Base_ptr __y, + const _Key& __k); + + const_iterator + _M_lower_bound(_Const_Link_type __x, _Const_Base_ptr __y, + const _Key& __k) const; + + iterator + _M_upper_bound(_Link_type __x, _Base_ptr __y, + const _Key& __k); + + const_iterator + _M_upper_bound(_Const_Link_type __x, _Const_Base_ptr __y, + const _Key& __k) const; + + public: + // allocation/deallocation +#if __cplusplus < 201103L + _Rb_tree() { } +#else + _Rb_tree() = default; +#endif + + _Rb_tree(const _Compare& __comp, + const allocator_type& __a = allocator_type()) + : _M_impl(__comp, _Node_allocator(__a)) { } + + _Rb_tree(const _Rb_tree& __x) + : _M_impl(__x._M_impl) + { + if (__x._M_root() != 0) + _M_root() = _M_copy(__x); + } + +#if __cplusplus >= 201103L + _Rb_tree(const allocator_type& __a) + : _M_impl(_Compare(), _Node_allocator(__a)) + { } + + _Rb_tree(const _Rb_tree& __x, const allocator_type& __a) + : _M_impl(__x._M_impl._M_key_compare, _Node_allocator(__a)) + { + if (__x._M_root() != nullptr) + _M_root() = _M_copy(__x); + } + + _Rb_tree(_Rb_tree&&) = default; + + _Rb_tree(_Rb_tree&& __x, const allocator_type& __a) + : _Rb_tree(std::move(__x), _Node_allocator(__a)) + { } + + _Rb_tree(_Rb_tree&& __x, _Node_allocator&& __a); +#endif + + ~_Rb_tree() _GLIBCXX_NOEXCEPT + { _M_erase(_M_begin()); } + + _Rb_tree& + operator=(const _Rb_tree& __x); + + // Accessors. + _Compare + key_comp() const + { return _M_impl._M_key_compare; } + + iterator + begin() _GLIBCXX_NOEXCEPT + { return iterator(this->_M_impl._M_header._M_left); } + + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return const_iterator(this->_M_impl._M_header._M_left); } + + iterator + end() _GLIBCXX_NOEXCEPT + { return iterator(&this->_M_impl._M_header); } + + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return const_iterator(&this->_M_impl._M_header); } + + reverse_iterator + rbegin() _GLIBCXX_NOEXCEPT + { return reverse_iterator(end()); } + + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(end()); } + + reverse_iterator + rend() _GLIBCXX_NOEXCEPT + { return reverse_iterator(begin()); } + + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(begin()); } + + bool + empty() const _GLIBCXX_NOEXCEPT + { return _M_impl._M_node_count == 0; } + + size_type + size() const _GLIBCXX_NOEXCEPT + { return _M_impl._M_node_count; } + + size_type + max_size() const _GLIBCXX_NOEXCEPT + { return _Alloc_traits::max_size(_M_get_Node_allocator()); } + + void + swap(_Rb_tree& __t) + _GLIBCXX_NOEXCEPT_IF(__is_nothrow_swappable<_Compare>::value); + + // Insert/erase. +#if __cplusplus >= 201103L + template + pair + _M_insert_unique(_Arg&& __x); + + template + iterator + _M_insert_equal(_Arg&& __x); + + template + iterator + _M_insert_unique_(const_iterator __pos, _Arg&& __x, _NodeGen&); + + template + iterator + _M_insert_unique_(const_iterator __pos, _Arg&& __x) + { + _Alloc_node __an(*this); + return _M_insert_unique_(__pos, std::forward<_Arg>(__x), __an); + } + + template + iterator + _M_insert_equal_(const_iterator __pos, _Arg&& __x, _NodeGen&); + + template + iterator + _M_insert_equal_(const_iterator __pos, _Arg&& __x) + { + _Alloc_node __an(*this); + return _M_insert_equal_(__pos, std::forward<_Arg>(__x), __an); + } + + template + pair + _M_emplace_unique(_Args&&... __args); + + template + iterator + _M_emplace_equal(_Args&&... __args); + + template + iterator + _M_emplace_hint_unique(const_iterator __pos, _Args&&... __args); + + template + iterator + _M_emplace_hint_equal(const_iterator __pos, _Args&&... __args); +#else + pair + _M_insert_unique(const value_type& __x); + + iterator + _M_insert_equal(const value_type& __x); + + template + iterator + _M_insert_unique_(const_iterator __pos, const value_type& __x, + _NodeGen&); + + iterator + _M_insert_unique_(const_iterator __pos, const value_type& __x) + { + _Alloc_node __an(*this); + return _M_insert_unique_(__pos, __x, __an); + } + + template + iterator + _M_insert_equal_(const_iterator __pos, const value_type& __x, + _NodeGen&); + iterator + _M_insert_equal_(const_iterator __pos, const value_type& __x) + { + _Alloc_node __an(*this); + return _M_insert_equal_(__pos, __x, __an); + } +#endif + + template + void + _M_insert_unique(_InputIterator __first, _InputIterator __last); + + template + void + _M_insert_equal(_InputIterator __first, _InputIterator __last); + + private: + void + _M_erase_aux(const_iterator __position); + + void + _M_erase_aux(const_iterator __first, const_iterator __last); + + public: +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 130. Associative erase should return an iterator. + _GLIBCXX_ABI_TAG_CXX11 + iterator + erase(const_iterator __position) + { + __glibcxx_assert(__position != end()); + const_iterator __result = __position; + ++__result; + _M_erase_aux(__position); + return __result._M_const_cast(); + } + + // LWG 2059. + _GLIBCXX_ABI_TAG_CXX11 + iterator + erase(iterator __position) + { + __glibcxx_assert(__position != end()); + iterator __result = __position; + ++__result; + _M_erase_aux(__position); + return __result; + } +#else + void + erase(iterator __position) + { + __glibcxx_assert(__position != end()); + _M_erase_aux(__position); + } + + void + erase(const_iterator __position) + { + __glibcxx_assert(__position != end()); + _M_erase_aux(__position); + } +#endif + size_type + erase(const key_type& __x); + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 130. Associative erase should return an iterator. + _GLIBCXX_ABI_TAG_CXX11 + iterator + erase(const_iterator __first, const_iterator __last) + { + _M_erase_aux(__first, __last); + return __last._M_const_cast(); + } +#else + void + erase(iterator __first, iterator __last) + { _M_erase_aux(__first, __last); } + + void + erase(const_iterator __first, const_iterator __last) + { _M_erase_aux(__first, __last); } +#endif + void + erase(const key_type* __first, const key_type* __last); + + void + clear() _GLIBCXX_NOEXCEPT + { + _M_erase(_M_begin()); + _M_impl._M_reset(); + } + + // Set operations. + iterator + find(const key_type& __k); + + const_iterator + find(const key_type& __k) const; + + size_type + count(const key_type& __k) const; + + iterator + lower_bound(const key_type& __k) + { return _M_lower_bound(_M_begin(), _M_end(), __k); } + + const_iterator + lower_bound(const key_type& __k) const + { return _M_lower_bound(_M_begin(), _M_end(), __k); } + + iterator + upper_bound(const key_type& __k) + { return _M_upper_bound(_M_begin(), _M_end(), __k); } + + const_iterator + upper_bound(const key_type& __k) const + { return _M_upper_bound(_M_begin(), _M_end(), __k); } + + pair + equal_range(const key_type& __k); + + pair + equal_range(const key_type& __k) const; + +#if __cplusplus > 201103L + template::type> + iterator + _M_find_tr(const _Kt& __k) + { + const _Rb_tree* __const_this = this; + return __const_this->_M_find_tr(__k)._M_const_cast(); + } + + template::type> + const_iterator + _M_find_tr(const _Kt& __k) const + { + auto __j = _M_lower_bound_tr(__k); + if (__j != end() && _M_impl._M_key_compare(__k, _S_key(__j._M_node))) + __j = end(); + return __j; + } + + template::type> + size_type + _M_count_tr(const _Kt& __k) const + { + auto __p = _M_equal_range_tr(__k); + return std::distance(__p.first, __p.second); + } + + template::type> + iterator + _M_lower_bound_tr(const _Kt& __k) + { + const _Rb_tree* __const_this = this; + return __const_this->_M_lower_bound_tr(__k)._M_const_cast(); + } + + template::type> + const_iterator + _M_lower_bound_tr(const _Kt& __k) const + { + auto __x = _M_begin(); + auto __y = _M_end(); + while (__x != 0) + if (!_M_impl._M_key_compare(_S_key(__x), __k)) + { + __y = __x; + __x = _S_left(__x); + } + else + __x = _S_right(__x); + return const_iterator(__y); + } + + template::type> + iterator + _M_upper_bound_tr(const _Kt& __k) + { + const _Rb_tree* __const_this = this; + return __const_this->_M_upper_bound_tr(__k)._M_const_cast(); + } + + template::type> + const_iterator + _M_upper_bound_tr(const _Kt& __k) const + { + auto __x = _M_begin(); + auto __y = _M_end(); + while (__x != 0) + if (_M_impl._M_key_compare(__k, _S_key(__x))) + { + __y = __x; + __x = _S_left(__x); + } + else + __x = _S_right(__x); + return const_iterator(__y); + } + + template::type> + pair + _M_equal_range_tr(const _Kt& __k) + { + const _Rb_tree* __const_this = this; + auto __ret = __const_this->_M_equal_range_tr(__k); + return { __ret.first._M_const_cast(), __ret.second._M_const_cast() }; + } + + template::type> + pair + _M_equal_range_tr(const _Kt& __k) const + { + auto __low = _M_lower_bound_tr(__k); + auto __high = __low; + auto& __cmp = _M_impl._M_key_compare; + while (__high != end() && !__cmp(__k, _S_key(__high._M_node))) + ++__high; + return { __low, __high }; + } +#endif + + // Debugging. + bool + __rb_verify() const; + +#if __cplusplus >= 201103L + _Rb_tree& + operator=(_Rb_tree&&) + noexcept(_Alloc_traits::_S_nothrow_move() + && is_nothrow_move_assignable<_Compare>::value); + + template + void + _M_assign_unique(_Iterator, _Iterator); + + template + void + _M_assign_equal(_Iterator, _Iterator); + + private: + // Move elements from container with equal allocator. + void + _M_move_data(_Rb_tree& __x, std::true_type) + { _M_impl._M_move_data(__x._M_impl); } + + // Move elements from container with possibly non-equal allocator, + // which might result in a copy not a move. + void + _M_move_data(_Rb_tree&, std::false_type); + + // Move assignment from container with equal allocator. + void + _M_move_assign(_Rb_tree&, std::true_type); + + // Move assignment from container with possibly non-equal allocator, + // which might result in a copy not a move. + void + _M_move_assign(_Rb_tree&, std::false_type); +#endif + +#if __cplusplus > 201402L + public: + /// Re-insert an extracted node. + insert_return_type + _M_reinsert_node_unique(node_type&& __nh) + { + insert_return_type __ret; + if (__nh.empty()) + __ret.position = end(); + else + { + __glibcxx_assert(_M_get_Node_allocator() == *__nh._M_alloc); + + auto __res = _M_get_insert_unique_pos(__nh._M_key()); + if (__res.second) + { + __ret.position + = _M_insert_node(__res.first, __res.second, __nh._M_ptr); + __nh._M_ptr = nullptr; + __ret.inserted = true; + } + else + { + __ret.node = std::move(__nh); + __ret.position = iterator(__res.first); + __ret.inserted = false; + } + } + return __ret; + } + + /// Re-insert an extracted node. + iterator + _M_reinsert_node_equal(node_type&& __nh) + { + iterator __ret; + if (__nh.empty()) + __ret = end(); + else + { + __glibcxx_assert(_M_get_Node_allocator() == *__nh._M_alloc); + auto __res = _M_get_insert_equal_pos(__nh._M_key()); + if (__res.second) + __ret = _M_insert_node(__res.first, __res.second, __nh._M_ptr); + else + __ret = _M_insert_equal_lower_node(__nh._M_ptr); + __nh._M_ptr = nullptr; + } + return __ret; + } + + /// Re-insert an extracted node. + iterator + _M_reinsert_node_hint_unique(const_iterator __hint, node_type&& __nh) + { + iterator __ret; + if (__nh.empty()) + __ret = end(); + else + { + __glibcxx_assert(_M_get_Node_allocator() == *__nh._M_alloc); + auto __res = _M_get_insert_hint_unique_pos(__hint, __nh._M_key()); + if (__res.second) + { + __ret = _M_insert_node(__res.first, __res.second, __nh._M_ptr); + __nh._M_ptr = nullptr; + } + else + __ret = iterator(__res.first); + } + return __ret; + } + + /// Re-insert an extracted node. + iterator + _M_reinsert_node_hint_equal(const_iterator __hint, node_type&& __nh) + { + iterator __ret; + if (__nh.empty()) + __ret = end(); + else + { + __glibcxx_assert(_M_get_Node_allocator() == *__nh._M_alloc); + auto __res = _M_get_insert_hint_equal_pos(__hint, __nh._M_key()); + if (__res.second) + __ret = _M_insert_node(__res.first, __res.second, __nh._M_ptr); + else + __ret = _M_insert_equal_lower_node(__nh._M_ptr); + __nh._M_ptr = nullptr; + } + return __ret; + } + + /// Extract a node. + node_type + extract(const_iterator __pos) + { + auto __ptr = _Rb_tree_rebalance_for_erase( + __pos._M_const_cast()._M_node, _M_impl._M_header); + --_M_impl._M_node_count; + return { static_cast<_Link_type>(__ptr), _M_get_Node_allocator() }; + } + + /// Extract a node. + node_type + extract(const key_type& __k) + { + node_type __nh; + auto __pos = find(__k); + if (__pos != end()) + __nh = extract(const_iterator(__pos)); + return __nh; + } + + template + using _Compatible_tree + = _Rb_tree<_Key, _Val, _KeyOfValue, _Compare2, _Alloc>; + + template + friend class _Rb_tree_merge_helper; + + /// Merge from a compatible container into one with unique keys. + template + void + _M_merge_unique(_Compatible_tree<_Compare2>& __src) noexcept + { + using _Merge_helper = _Rb_tree_merge_helper<_Rb_tree, _Compare2>; + for (auto __i = __src.begin(), __end = __src.end(); __i != __end;) + { + auto __pos = __i++; + auto __res = _M_get_insert_unique_pos(_KeyOfValue()(*__pos)); + if (__res.second) + { + auto& __src_impl = _Merge_helper::_S_get_impl(__src); + auto __ptr = _Rb_tree_rebalance_for_erase( + __pos._M_node, __src_impl._M_header); + --__src_impl._M_node_count; + _M_insert_node(__res.first, __res.second, + static_cast<_Link_type>(__ptr)); + } + } + } + + /// Merge from a compatible container into one with equivalent keys. + template + void + _M_merge_equal(_Compatible_tree<_Compare2>& __src) noexcept + { + using _Merge_helper = _Rb_tree_merge_helper<_Rb_tree, _Compare2>; + for (auto __i = __src.begin(), __end = __src.end(); __i != __end;) + { + auto __pos = __i++; + auto __res = _M_get_insert_equal_pos(_KeyOfValue()(*__pos)); + if (__res.second) + { + auto& __src_impl = _Merge_helper::_S_get_impl(__src); + auto __ptr = _Rb_tree_rebalance_for_erase( + __pos._M_node, __src_impl._M_header); + --__src_impl._M_node_count; + _M_insert_node(__res.first, __res.second, + static_cast<_Link_type>(__ptr)); + } + } + } +#endif // C++17 + }; + + template + inline bool + operator==(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, + const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) + { + return __x.size() == __y.size() + && std::equal(__x.begin(), __x.end(), __y.begin()); + } + + template + inline bool + operator<(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, + const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) + { + return std::lexicographical_compare(__x.begin(), __x.end(), + __y.begin(), __y.end()); + } + + template + inline bool + operator!=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, + const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) + { return !(__x == __y); } + + template + inline bool + operator>(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, + const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) + { return __y < __x; } + + template + inline bool + operator<=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, + const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) + { return !(__y < __x); } + + template + inline bool + operator>=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, + const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) + { return !(__x < __y); } + + template + inline void + swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x, + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y) + { __x.swap(__y); } + +#if __cplusplus >= 201103L + template + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _Rb_tree(_Rb_tree&& __x, _Node_allocator&& __a) + : _M_impl(__x._M_impl._M_key_compare, std::move(__a)) + { + using __eq = typename _Alloc_traits::is_always_equal; + if (__x._M_root() != nullptr) + _M_move_data(__x, __eq()); + } + + template + void + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_move_data(_Rb_tree& __x, std::false_type) + { + if (_M_get_Node_allocator() == __x._M_get_Node_allocator()) + _M_move_data(__x, std::true_type()); + else + { + _Alloc_node __an(*this); + auto __lbd = + [&__an](const value_type& __cval) + { + auto& __val = const_cast(__cval); + return __an(std::move_if_noexcept(__val)); + }; + _M_root() = _M_copy(__x, __lbd); + } + } + + template + inline void + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_move_assign(_Rb_tree& __x, true_type) + { + clear(); + if (__x._M_root() != nullptr) + _M_move_data(__x, std::true_type()); + std::__alloc_on_move(_M_get_Node_allocator(), + __x._M_get_Node_allocator()); + } + + template + void + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_move_assign(_Rb_tree& __x, false_type) + { + if (_M_get_Node_allocator() == __x._M_get_Node_allocator()) + return _M_move_assign(__x, true_type{}); + + // Try to move each node reusing existing nodes and copying __x nodes + // structure. + _Reuse_or_alloc_node __roan(*this); + _M_impl._M_reset(); + if (__x._M_root() != nullptr) + { + auto __lbd = + [&__roan](const value_type& __cval) + { + auto& __val = const_cast(__cval); + return __roan(std::move_if_noexcept(__val)); + }; + _M_root() = _M_copy(__x, __lbd); + __x.clear(); + } + } + + template + inline _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + operator=(_Rb_tree&& __x) + noexcept(_Alloc_traits::_S_nothrow_move() + && is_nothrow_move_assignable<_Compare>::value) + { + _M_impl._M_key_compare = std::move(__x._M_impl._M_key_compare); + _M_move_assign(__x, __bool_constant<_Alloc_traits::_S_nothrow_move()>()); + return *this; + } + + template + template + void + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_assign_unique(_Iterator __first, _Iterator __last) + { + _Reuse_or_alloc_node __roan(*this); + _M_impl._M_reset(); + for (; __first != __last; ++__first) + _M_insert_unique_(end(), *__first, __roan); + } + + template + template + void + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_assign_equal(_Iterator __first, _Iterator __last) + { + _Reuse_or_alloc_node __roan(*this); + _M_impl._M_reset(); + for (; __first != __last; ++__first) + _M_insert_equal_(end(), *__first, __roan); + } +#endif + + template + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + operator=(const _Rb_tree& __x) + { + if (this != &__x) + { + // Note that _Key may be a constant type. +#if __cplusplus >= 201103L + if (_Alloc_traits::_S_propagate_on_copy_assign()) + { + auto& __this_alloc = this->_M_get_Node_allocator(); + auto& __that_alloc = __x._M_get_Node_allocator(); + if (!_Alloc_traits::_S_always_equal() + && __this_alloc != __that_alloc) + { + // Replacement allocator cannot free existing storage, we need + // to erase nodes first. + clear(); + std::__alloc_on_copy(__this_alloc, __that_alloc); + } + } +#endif + + _Reuse_or_alloc_node __roan(*this); + _M_impl._M_reset(); + _M_impl._M_key_compare = __x._M_impl._M_key_compare; + if (__x._M_root() != 0) + _M_root() = _M_copy(__x, __roan); + } + + return *this; + } + + template +#if __cplusplus >= 201103L + template +#else + template +#endif + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_insert_(_Base_ptr __x, _Base_ptr __p, +#if __cplusplus >= 201103L + _Arg&& __v, +#else + const _Val& __v, +#endif + _NodeGen& __node_gen) + { + bool __insert_left = (__x != 0 || __p == _M_end() + || _M_impl._M_key_compare(_KeyOfValue()(__v), + _S_key(__p))); + + _Link_type __z = __node_gen(_GLIBCXX_FORWARD(_Arg, __v)); + + _Rb_tree_insert_and_rebalance(__insert_left, __z, __p, + this->_M_impl._M_header); + ++_M_impl._M_node_count; + return iterator(__z); + } + + template +#if __cplusplus >= 201103L + template +#endif + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: +#if __cplusplus >= 201103L + _M_insert_lower(_Base_ptr __p, _Arg&& __v) +#else + _M_insert_lower(_Base_ptr __p, const _Val& __v) +#endif + { + bool __insert_left = (__p == _M_end() + || !_M_impl._M_key_compare(_S_key(__p), + _KeyOfValue()(__v))); + + _Link_type __z = _M_create_node(_GLIBCXX_FORWARD(_Arg, __v)); + + _Rb_tree_insert_and_rebalance(__insert_left, __z, __p, + this->_M_impl._M_header); + ++_M_impl._M_node_count; + return iterator(__z); + } + + template +#if __cplusplus >= 201103L + template +#endif + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: +#if __cplusplus >= 201103L + _M_insert_equal_lower(_Arg&& __v) +#else + _M_insert_equal_lower(const _Val& __v) +#endif + { + _Link_type __x = _M_begin(); + _Base_ptr __y = _M_end(); + while (__x != 0) + { + __y = __x; + __x = !_M_impl._M_key_compare(_S_key(__x), _KeyOfValue()(__v)) ? + _S_left(__x) : _S_right(__x); + } + return _M_insert_lower(__y, _GLIBCXX_FORWARD(_Arg, __v)); + } + + template + template + typename _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::_Link_type + _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>:: + _M_copy(_Const_Link_type __x, _Base_ptr __p, _NodeGen& __node_gen) + { + // Structural copy. __x and __p must be non-null. + _Link_type __top = _M_clone_node(__x, __node_gen); + __top->_M_parent = __p; + + __try + { + if (__x->_M_right) + __top->_M_right = _M_copy(_S_right(__x), __top, __node_gen); + __p = __top; + __x = _S_left(__x); + + while (__x != 0) + { + _Link_type __y = _M_clone_node(__x, __node_gen); + __p->_M_left = __y; + __y->_M_parent = __p; + if (__x->_M_right) + __y->_M_right = _M_copy(_S_right(__x), __y, __node_gen); + __p = __y; + __x = _S_left(__x); + } + } + __catch(...) + { + _M_erase(__top); + __throw_exception_again; + } + return __top; + } + + template + void + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_erase(_Link_type __x) + { + // Erase without rebalancing. + while (__x != 0) + { + _M_erase(_S_right(__x)); + _Link_type __y = _S_left(__x); + _M_drop_node(__x); + __x = __y; + } + } + + template + typename _Rb_tree<_Key, _Val, _KeyOfValue, + _Compare, _Alloc>::iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_lower_bound(_Link_type __x, _Base_ptr __y, + const _Key& __k) + { + while (__x != 0) + if (!_M_impl._M_key_compare(_S_key(__x), __k)) + __y = __x, __x = _S_left(__x); + else + __x = _S_right(__x); + return iterator(__y); + } + + template + typename _Rb_tree<_Key, _Val, _KeyOfValue, + _Compare, _Alloc>::const_iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_lower_bound(_Const_Link_type __x, _Const_Base_ptr __y, + const _Key& __k) const + { + while (__x != 0) + if (!_M_impl._M_key_compare(_S_key(__x), __k)) + __y = __x, __x = _S_left(__x); + else + __x = _S_right(__x); + return const_iterator(__y); + } + + template + typename _Rb_tree<_Key, _Val, _KeyOfValue, + _Compare, _Alloc>::iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_upper_bound(_Link_type __x, _Base_ptr __y, + const _Key& __k) + { + while (__x != 0) + if (_M_impl._M_key_compare(__k, _S_key(__x))) + __y = __x, __x = _S_left(__x); + else + __x = _S_right(__x); + return iterator(__y); + } + + template + typename _Rb_tree<_Key, _Val, _KeyOfValue, + _Compare, _Alloc>::const_iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_upper_bound(_Const_Link_type __x, _Const_Base_ptr __y, + const _Key& __k) const + { + while (__x != 0) + if (_M_impl._M_key_compare(__k, _S_key(__x))) + __y = __x, __x = _S_left(__x); + else + __x = _S_right(__x); + return const_iterator(__y); + } + + template + pair::iterator, + typename _Rb_tree<_Key, _Val, _KeyOfValue, + _Compare, _Alloc>::iterator> + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + equal_range(const _Key& __k) + { + _Link_type __x = _M_begin(); + _Base_ptr __y = _M_end(); + while (__x != 0) + { + if (_M_impl._M_key_compare(_S_key(__x), __k)) + __x = _S_right(__x); + else if (_M_impl._M_key_compare(__k, _S_key(__x))) + __y = __x, __x = _S_left(__x); + else + { + _Link_type __xu(__x); + _Base_ptr __yu(__y); + __y = __x, __x = _S_left(__x); + __xu = _S_right(__xu); + return pair(_M_lower_bound(__x, __y, __k), + _M_upper_bound(__xu, __yu, __k)); + } + } + return pair(iterator(__y), + iterator(__y)); + } + + template + pair::const_iterator, + typename _Rb_tree<_Key, _Val, _KeyOfValue, + _Compare, _Alloc>::const_iterator> + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + equal_range(const _Key& __k) const + { + _Const_Link_type __x = _M_begin(); + _Const_Base_ptr __y = _M_end(); + while (__x != 0) + { + if (_M_impl._M_key_compare(_S_key(__x), __k)) + __x = _S_right(__x); + else if (_M_impl._M_key_compare(__k, _S_key(__x))) + __y = __x, __x = _S_left(__x); + else + { + _Const_Link_type __xu(__x); + _Const_Base_ptr __yu(__y); + __y = __x, __x = _S_left(__x); + __xu = _S_right(__xu); + return pair(_M_lower_bound(__x, __y, __k), + _M_upper_bound(__xu, __yu, __k)); + } + } + return pair(const_iterator(__y), + const_iterator(__y)); + } + + template + void + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + swap(_Rb_tree& __t) + _GLIBCXX_NOEXCEPT_IF(__is_nothrow_swappable<_Compare>::value) + { + if (_M_root() == 0) + { + if (__t._M_root() != 0) + _M_impl._M_move_data(__t._M_impl); + } + else if (__t._M_root() == 0) + __t._M_impl._M_move_data(_M_impl); + else + { + std::swap(_M_root(),__t._M_root()); + std::swap(_M_leftmost(),__t._M_leftmost()); + std::swap(_M_rightmost(),__t._M_rightmost()); + + _M_root()->_M_parent = _M_end(); + __t._M_root()->_M_parent = __t._M_end(); + std::swap(this->_M_impl._M_node_count, __t._M_impl._M_node_count); + } + // No need to swap header's color as it does not change. + std::swap(this->_M_impl._M_key_compare, __t._M_impl._M_key_compare); + + _Alloc_traits::_S_on_swap(_M_get_Node_allocator(), + __t._M_get_Node_allocator()); + } + + template + pair::_Base_ptr, + typename _Rb_tree<_Key, _Val, _KeyOfValue, + _Compare, _Alloc>::_Base_ptr> + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_get_insert_unique_pos(const key_type& __k) + { + typedef pair<_Base_ptr, _Base_ptr> _Res; + _Link_type __x = _M_begin(); + _Base_ptr __y = _M_end(); + bool __comp = true; + while (__x != 0) + { + __y = __x; + __comp = _M_impl._M_key_compare(__k, _S_key(__x)); + __x = __comp ? _S_left(__x) : _S_right(__x); + } + iterator __j = iterator(__y); + if (__comp) + { + if (__j == begin()) + return _Res(__x, __y); + else + --__j; + } + if (_M_impl._M_key_compare(_S_key(__j._M_node), __k)) + return _Res(__x, __y); + return _Res(__j._M_node, 0); + } + + template + pair::_Base_ptr, + typename _Rb_tree<_Key, _Val, _KeyOfValue, + _Compare, _Alloc>::_Base_ptr> + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_get_insert_equal_pos(const key_type& __k) + { + typedef pair<_Base_ptr, _Base_ptr> _Res; + _Link_type __x = _M_begin(); + _Base_ptr __y = _M_end(); + while (__x != 0) + { + __y = __x; + __x = _M_impl._M_key_compare(__k, _S_key(__x)) ? + _S_left(__x) : _S_right(__x); + } + return _Res(__x, __y); + } + + template +#if __cplusplus >= 201103L + template +#endif + pair::iterator, bool> + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: +#if __cplusplus >= 201103L + _M_insert_unique(_Arg&& __v) +#else + _M_insert_unique(const _Val& __v) +#endif + { + typedef pair _Res; + pair<_Base_ptr, _Base_ptr> __res + = _M_get_insert_unique_pos(_KeyOfValue()(__v)); + + if (__res.second) + { + _Alloc_node __an(*this); + return _Res(_M_insert_(__res.first, __res.second, + _GLIBCXX_FORWARD(_Arg, __v), __an), + true); + } + + return _Res(iterator(__res.first), false); + } + + template +#if __cplusplus >= 201103L + template +#endif + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: +#if __cplusplus >= 201103L + _M_insert_equal(_Arg&& __v) +#else + _M_insert_equal(const _Val& __v) +#endif + { + pair<_Base_ptr, _Base_ptr> __res + = _M_get_insert_equal_pos(_KeyOfValue()(__v)); + _Alloc_node __an(*this); + return _M_insert_(__res.first, __res.second, + _GLIBCXX_FORWARD(_Arg, __v), __an); + } + + template + pair::_Base_ptr, + typename _Rb_tree<_Key, _Val, _KeyOfValue, + _Compare, _Alloc>::_Base_ptr> + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_get_insert_hint_unique_pos(const_iterator __position, + const key_type& __k) + { + iterator __pos = __position._M_const_cast(); + typedef pair<_Base_ptr, _Base_ptr> _Res; + + // end() + if (__pos._M_node == _M_end()) + { + if (size() > 0 + && _M_impl._M_key_compare(_S_key(_M_rightmost()), __k)) + return _Res(0, _M_rightmost()); + else + return _M_get_insert_unique_pos(__k); + } + else if (_M_impl._M_key_compare(__k, _S_key(__pos._M_node))) + { + // First, try before... + iterator __before = __pos; + if (__pos._M_node == _M_leftmost()) // begin() + return _Res(_M_leftmost(), _M_leftmost()); + else if (_M_impl._M_key_compare(_S_key((--__before)._M_node), __k)) + { + if (_S_right(__before._M_node) == 0) + return _Res(0, __before._M_node); + else + return _Res(__pos._M_node, __pos._M_node); + } + else + return _M_get_insert_unique_pos(__k); + } + else if (_M_impl._M_key_compare(_S_key(__pos._M_node), __k)) + { + // ... then try after. + iterator __after = __pos; + if (__pos._M_node == _M_rightmost()) + return _Res(0, _M_rightmost()); + else if (_M_impl._M_key_compare(__k, _S_key((++__after)._M_node))) + { + if (_S_right(__pos._M_node) == 0) + return _Res(0, __pos._M_node); + else + return _Res(__after._M_node, __after._M_node); + } + else + return _M_get_insert_unique_pos(__k); + } + else + // Equivalent keys. + return _Res(__pos._M_node, 0); + } + + template +#if __cplusplus >= 201103L + template +#else + template +#endif + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_insert_unique_(const_iterator __position, +#if __cplusplus >= 201103L + _Arg&& __v, +#else + const _Val& __v, +#endif + _NodeGen& __node_gen) + { + pair<_Base_ptr, _Base_ptr> __res + = _M_get_insert_hint_unique_pos(__position, _KeyOfValue()(__v)); + + if (__res.second) + return _M_insert_(__res.first, __res.second, + _GLIBCXX_FORWARD(_Arg, __v), + __node_gen); + return iterator(__res.first); + } + + template + pair::_Base_ptr, + typename _Rb_tree<_Key, _Val, _KeyOfValue, + _Compare, _Alloc>::_Base_ptr> + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_get_insert_hint_equal_pos(const_iterator __position, const key_type& __k) + { + iterator __pos = __position._M_const_cast(); + typedef pair<_Base_ptr, _Base_ptr> _Res; + + // end() + if (__pos._M_node == _M_end()) + { + if (size() > 0 + && !_M_impl._M_key_compare(__k, _S_key(_M_rightmost()))) + return _Res(0, _M_rightmost()); + else + return _M_get_insert_equal_pos(__k); + } + else if (!_M_impl._M_key_compare(_S_key(__pos._M_node), __k)) + { + // First, try before... + iterator __before = __pos; + if (__pos._M_node == _M_leftmost()) // begin() + return _Res(_M_leftmost(), _M_leftmost()); + else if (!_M_impl._M_key_compare(__k, _S_key((--__before)._M_node))) + { + if (_S_right(__before._M_node) == 0) + return _Res(0, __before._M_node); + else + return _Res(__pos._M_node, __pos._M_node); + } + else + return _M_get_insert_equal_pos(__k); + } + else + { + // ... then try after. + iterator __after = __pos; + if (__pos._M_node == _M_rightmost()) + return _Res(0, _M_rightmost()); + else if (!_M_impl._M_key_compare(_S_key((++__after)._M_node), __k)) + { + if (_S_right(__pos._M_node) == 0) + return _Res(0, __pos._M_node); + else + return _Res(__after._M_node, __after._M_node); + } + else + return _Res(0, 0); + } + } + + template +#if __cplusplus >= 201103L + template +#else + template +#endif + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_insert_equal_(const_iterator __position, +#if __cplusplus >= 201103L + _Arg&& __v, +#else + const _Val& __v, +#endif + _NodeGen& __node_gen) + { + pair<_Base_ptr, _Base_ptr> __res + = _M_get_insert_hint_equal_pos(__position, _KeyOfValue()(__v)); + + if (__res.second) + return _M_insert_(__res.first, __res.second, + _GLIBCXX_FORWARD(_Arg, __v), + __node_gen); + + return _M_insert_equal_lower(_GLIBCXX_FORWARD(_Arg, __v)); + } + +#if __cplusplus >= 201103L + template + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_insert_node(_Base_ptr __x, _Base_ptr __p, _Link_type __z) + { + bool __insert_left = (__x != 0 || __p == _M_end() + || _M_impl._M_key_compare(_S_key(__z), + _S_key(__p))); + + _Rb_tree_insert_and_rebalance(__insert_left, __z, __p, + this->_M_impl._M_header); + ++_M_impl._M_node_count; + return iterator(__z); + } + + template + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_insert_lower_node(_Base_ptr __p, _Link_type __z) + { + bool __insert_left = (__p == _M_end() + || !_M_impl._M_key_compare(_S_key(__p), + _S_key(__z))); + + _Rb_tree_insert_and_rebalance(__insert_left, __z, __p, + this->_M_impl._M_header); + ++_M_impl._M_node_count; + return iterator(__z); + } + + template + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_insert_equal_lower_node(_Link_type __z) + { + _Link_type __x = _M_begin(); + _Base_ptr __y = _M_end(); + while (__x != 0) + { + __y = __x; + __x = !_M_impl._M_key_compare(_S_key(__x), _S_key(__z)) ? + _S_left(__x) : _S_right(__x); + } + return _M_insert_lower_node(__y, __z); + } + + template + template + pair::iterator, bool> + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_emplace_unique(_Args&&... __args) + { + _Link_type __z = _M_create_node(std::forward<_Args>(__args)...); + + __try + { + typedef pair _Res; + auto __res = _M_get_insert_unique_pos(_S_key(__z)); + if (__res.second) + return _Res(_M_insert_node(__res.first, __res.second, __z), true); + + _M_drop_node(__z); + return _Res(iterator(__res.first), false); + } + __catch(...) + { + _M_drop_node(__z); + __throw_exception_again; + } + } + + template + template + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_emplace_equal(_Args&&... __args) + { + _Link_type __z = _M_create_node(std::forward<_Args>(__args)...); + + __try + { + auto __res = _M_get_insert_equal_pos(_S_key(__z)); + return _M_insert_node(__res.first, __res.second, __z); + } + __catch(...) + { + _M_drop_node(__z); + __throw_exception_again; + } + } + + template + template + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_emplace_hint_unique(const_iterator __pos, _Args&&... __args) + { + _Link_type __z = _M_create_node(std::forward<_Args>(__args)...); + + __try + { + auto __res = _M_get_insert_hint_unique_pos(__pos, _S_key(__z)); + + if (__res.second) + return _M_insert_node(__res.first, __res.second, __z); + + _M_drop_node(__z); + return iterator(__res.first); + } + __catch(...) + { + _M_drop_node(__z); + __throw_exception_again; + } + } + + template + template + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_emplace_hint_equal(const_iterator __pos, _Args&&... __args) + { + _Link_type __z = _M_create_node(std::forward<_Args>(__args)...); + + __try + { + auto __res = _M_get_insert_hint_equal_pos(__pos, _S_key(__z)); + + if (__res.second) + return _M_insert_node(__res.first, __res.second, __z); + + return _M_insert_equal_lower_node(__z); + } + __catch(...) + { + _M_drop_node(__z); + __throw_exception_again; + } + } +#endif + + template + template + void + _Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>:: + _M_insert_unique(_II __first, _II __last) + { + _Alloc_node __an(*this); + for (; __first != __last; ++__first) + _M_insert_unique_(end(), *__first, __an); + } + + template + template + void + _Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>:: + _M_insert_equal(_II __first, _II __last) + { + _Alloc_node __an(*this); + for (; __first != __last; ++__first) + _M_insert_equal_(end(), *__first, __an); + } + + template + void + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_erase_aux(const_iterator __position) + { + _Link_type __y = + static_cast<_Link_type>(_Rb_tree_rebalance_for_erase + (const_cast<_Base_ptr>(__position._M_node), + this->_M_impl._M_header)); + _M_drop_node(__y); + --_M_impl._M_node_count; + } + + template + void + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + _M_erase_aux(const_iterator __first, const_iterator __last) + { + if (__first == begin() && __last == end()) + clear(); + else + while (__first != __last) + _M_erase_aux(__first++); + } + + template + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + erase(const _Key& __x) + { + pair __p = equal_range(__x); + const size_type __old_size = size(); + _M_erase_aux(__p.first, __p.second); + return __old_size - size(); + } + + template + void + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + erase(const _Key* __first, const _Key* __last) + { + while (__first != __last) + erase(*__first++); + } + + template + typename _Rb_tree<_Key, _Val, _KeyOfValue, + _Compare, _Alloc>::iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + find(const _Key& __k) + { + iterator __j = _M_lower_bound(_M_begin(), _M_end(), __k); + return (__j == end() + || _M_impl._M_key_compare(__k, + _S_key(__j._M_node))) ? end() : __j; + } + + template + typename _Rb_tree<_Key, _Val, _KeyOfValue, + _Compare, _Alloc>::const_iterator + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + find(const _Key& __k) const + { + const_iterator __j = _M_lower_bound(_M_begin(), _M_end(), __k); + return (__j == end() + || _M_impl._M_key_compare(__k, + _S_key(__j._M_node))) ? end() : __j; + } + + template + typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type + _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: + count(const _Key& __k) const + { + pair __p = equal_range(__k); + const size_type __n = std::distance(__p.first, __p.second); + return __n; + } + + _GLIBCXX_PURE unsigned int + _Rb_tree_black_count(const _Rb_tree_node_base* __node, + const _Rb_tree_node_base* __root) throw (); + + template + bool + _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::__rb_verify() const + { + if (_M_impl._M_node_count == 0 || begin() == end()) + return _M_impl._M_node_count == 0 && begin() == end() + && this->_M_impl._M_header._M_left == _M_end() + && this->_M_impl._M_header._M_right == _M_end(); + + unsigned int __len = _Rb_tree_black_count(_M_leftmost(), _M_root()); + for (const_iterator __it = begin(); __it != end(); ++__it) + { + _Const_Link_type __x = static_cast<_Const_Link_type>(__it._M_node); + _Const_Link_type __L = _S_left(__x); + _Const_Link_type __R = _S_right(__x); + + if (__x->_M_color == _S_red) + if ((__L && __L->_M_color == _S_red) + || (__R && __R->_M_color == _S_red)) + return false; + + if (__L && _M_impl._M_key_compare(_S_key(__x), _S_key(__L))) + return false; + if (__R && _M_impl._M_key_compare(_S_key(__R), _S_key(__x))) + return false; + + if (!__L && !__R && _Rb_tree_black_count(__x, _M_root()) != __len) + return false; + } + + if (_M_leftmost() != _Rb_tree_node_base::_S_minimum(_M_root())) + return false; + if (_M_rightmost() != _Rb_tree_node_base::_S_maximum(_M_root())) + return false; + return true; + } + +#if __cplusplus > 201402L + // Allow access to internals of compatible _Rb_tree specializations. + template + struct _Rb_tree_merge_helper<_Rb_tree<_Key, _Val, _Sel, _Cmp1, _Alloc>, + _Cmp2> + { + private: + friend class _Rb_tree<_Key, _Val, _Sel, _Cmp1, _Alloc>; + + static auto& + _S_get_impl(_Rb_tree<_Key, _Val, _Sel, _Cmp2, _Alloc>& __tree) + { return __tree._M_impl; } + }; +#endif // C++17 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_uninitialized.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_uninitialized.h new file mode 100644 index 0000000..c2ba863 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_uninitialized.h @@ -0,0 +1,885 @@ +// Raw memory manipulators -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996,1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_uninitialized.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _STL_UNINITIALIZED_H +#define _STL_UNINITIALIZED_H 1 + +#if __cplusplus > 201402L +#include +#endif + +#if __cplusplus >= 201103L +#include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + struct __uninitialized_copy + { + template + static _ForwardIterator + __uninit_copy(_InputIterator __first, _InputIterator __last, + _ForwardIterator __result) + { + _ForwardIterator __cur = __result; + __try + { + for (; __first != __last; ++__first, (void)++__cur) + std::_Construct(std::__addressof(*__cur), *__first); + return __cur; + } + __catch(...) + { + std::_Destroy(__result, __cur); + __throw_exception_again; + } + } + }; + + template<> + struct __uninitialized_copy + { + template + static _ForwardIterator + __uninit_copy(_InputIterator __first, _InputIterator __last, + _ForwardIterator __result) + { return std::copy(__first, __last, __result); } + }; + + /** + * @brief Copies the range [first,last) into result. + * @param __first An input iterator. + * @param __last An input iterator. + * @param __result An output iterator. + * @return __result + (__first - __last) + * + * Like copy(), but does not require an initialized output range. + */ + template + inline _ForwardIterator + uninitialized_copy(_InputIterator __first, _InputIterator __last, + _ForwardIterator __result) + { + typedef typename iterator_traits<_InputIterator>::value_type + _ValueType1; + typedef typename iterator_traits<_ForwardIterator>::value_type + _ValueType2; +#if __cplusplus < 201103L + const bool __assignable = true; +#else + // trivial types can have deleted assignment + typedef typename iterator_traits<_InputIterator>::reference _RefType1; + typedef typename iterator_traits<_ForwardIterator>::reference _RefType2; + const bool __assignable = is_assignable<_RefType2, _RefType1>::value; +#endif + + return std::__uninitialized_copy<__is_trivial(_ValueType1) + && __is_trivial(_ValueType2) + && __assignable>:: + __uninit_copy(__first, __last, __result); + } + + + template + struct __uninitialized_fill + { + template + static void + __uninit_fill(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __x) + { + _ForwardIterator __cur = __first; + __try + { + for (; __cur != __last; ++__cur) + std::_Construct(std::__addressof(*__cur), __x); + } + __catch(...) + { + std::_Destroy(__first, __cur); + __throw_exception_again; + } + } + }; + + template<> + struct __uninitialized_fill + { + template + static void + __uninit_fill(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __x) + { std::fill(__first, __last, __x); } + }; + + /** + * @brief Copies the value x into the range [first,last). + * @param __first An input iterator. + * @param __last An input iterator. + * @param __x The source value. + * @return Nothing. + * + * Like fill(), but does not require an initialized output range. + */ + template + inline void + uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __x) + { + typedef typename iterator_traits<_ForwardIterator>::value_type + _ValueType; +#if __cplusplus < 201103L + const bool __assignable = true; +#else + // trivial types can have deleted assignment + const bool __assignable = is_copy_assignable<_ValueType>::value; +#endif + + std::__uninitialized_fill<__is_trivial(_ValueType) && __assignable>:: + __uninit_fill(__first, __last, __x); + } + + + template + struct __uninitialized_fill_n + { + template + static _ForwardIterator + __uninit_fill_n(_ForwardIterator __first, _Size __n, + const _Tp& __x) + { + _ForwardIterator __cur = __first; + __try + { + for (; __n > 0; --__n, ++__cur) + std::_Construct(std::__addressof(*__cur), __x); + return __cur; + } + __catch(...) + { + std::_Destroy(__first, __cur); + __throw_exception_again; + } + } + }; + + template<> + struct __uninitialized_fill_n + { + template + static _ForwardIterator + __uninit_fill_n(_ForwardIterator __first, _Size __n, + const _Tp& __x) + { return std::fill_n(__first, __n, __x); } + }; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 1339. uninitialized_fill_n should return the end of its range + /** + * @brief Copies the value x into the range [first,first+n). + * @param __first An input iterator. + * @param __n The number of copies to make. + * @param __x The source value. + * @return Nothing. + * + * Like fill_n(), but does not require an initialized output range. + */ + template + inline _ForwardIterator + uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) + { + typedef typename iterator_traits<_ForwardIterator>::value_type + _ValueType; +#if __cplusplus < 201103L + const bool __assignable = true; +#else + // trivial types can have deleted assignment + const bool __assignable = is_copy_assignable<_ValueType>::value; +#endif + return __uninitialized_fill_n<__is_trivial(_ValueType) && __assignable>:: + __uninit_fill_n(__first, __n, __x); + } + + // Extensions: versions of uninitialized_copy, uninitialized_fill, + // and uninitialized_fill_n that take an allocator parameter. + // We dispatch back to the standard versions when we're given the + // default allocator. For nondefault allocators we do not use + // any of the POD optimizations. + + template + _ForwardIterator + __uninitialized_copy_a(_InputIterator __first, _InputIterator __last, + _ForwardIterator __result, _Allocator& __alloc) + { + _ForwardIterator __cur = __result; + __try + { + typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; + for (; __first != __last; ++__first, (void)++__cur) + __traits::construct(__alloc, std::__addressof(*__cur), *__first); + return __cur; + } + __catch(...) + { + std::_Destroy(__result, __cur, __alloc); + __throw_exception_again; + } + } + + template + inline _ForwardIterator + __uninitialized_copy_a(_InputIterator __first, _InputIterator __last, + _ForwardIterator __result, allocator<_Tp>&) + { return std::uninitialized_copy(__first, __last, __result); } + + template + inline _ForwardIterator + __uninitialized_move_a(_InputIterator __first, _InputIterator __last, + _ForwardIterator __result, _Allocator& __alloc) + { + return std::__uninitialized_copy_a(_GLIBCXX_MAKE_MOVE_ITERATOR(__first), + _GLIBCXX_MAKE_MOVE_ITERATOR(__last), + __result, __alloc); + } + + template + inline _ForwardIterator + __uninitialized_move_if_noexcept_a(_InputIterator __first, + _InputIterator __last, + _ForwardIterator __result, + _Allocator& __alloc) + { + return std::__uninitialized_copy_a + (_GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__first), + _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__last), __result, __alloc); + } + + template + void + __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __x, _Allocator& __alloc) + { + _ForwardIterator __cur = __first; + __try + { + typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; + for (; __cur != __last; ++__cur) + __traits::construct(__alloc, std::__addressof(*__cur), __x); + } + __catch(...) + { + std::_Destroy(__first, __cur, __alloc); + __throw_exception_again; + } + } + + template + inline void + __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __x, allocator<_Tp2>&) + { std::uninitialized_fill(__first, __last, __x); } + + template + _ForwardIterator + __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n, + const _Tp& __x, _Allocator& __alloc) + { + _ForwardIterator __cur = __first; + __try + { + typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; + for (; __n > 0; --__n, ++__cur) + __traits::construct(__alloc, std::__addressof(*__cur), __x); + return __cur; + } + __catch(...) + { + std::_Destroy(__first, __cur, __alloc); + __throw_exception_again; + } + } + + template + inline _ForwardIterator + __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n, + const _Tp& __x, allocator<_Tp2>&) + { return std::uninitialized_fill_n(__first, __n, __x); } + + + // Extensions: __uninitialized_copy_move, __uninitialized_move_copy, + // __uninitialized_fill_move, __uninitialized_move_fill. + // All of these algorithms take a user-supplied allocator, which is used + // for construction and destruction. + + // __uninitialized_copy_move + // Copies [first1, last1) into [result, result + (last1 - first1)), and + // move [first2, last2) into + // [result, result + (last1 - first1) + (last2 - first2)). + template + inline _ForwardIterator + __uninitialized_copy_move(_InputIterator1 __first1, + _InputIterator1 __last1, + _InputIterator2 __first2, + _InputIterator2 __last2, + _ForwardIterator __result, + _Allocator& __alloc) + { + _ForwardIterator __mid = std::__uninitialized_copy_a(__first1, __last1, + __result, + __alloc); + __try + { + return std::__uninitialized_move_a(__first2, __last2, __mid, __alloc); + } + __catch(...) + { + std::_Destroy(__result, __mid, __alloc); + __throw_exception_again; + } + } + + // __uninitialized_move_copy + // Moves [first1, last1) into [result, result + (last1 - first1)), and + // copies [first2, last2) into + // [result, result + (last1 - first1) + (last2 - first2)). + template + inline _ForwardIterator + __uninitialized_move_copy(_InputIterator1 __first1, + _InputIterator1 __last1, + _InputIterator2 __first2, + _InputIterator2 __last2, + _ForwardIterator __result, + _Allocator& __alloc) + { + _ForwardIterator __mid = std::__uninitialized_move_a(__first1, __last1, + __result, + __alloc); + __try + { + return std::__uninitialized_copy_a(__first2, __last2, __mid, __alloc); + } + __catch(...) + { + std::_Destroy(__result, __mid, __alloc); + __throw_exception_again; + } + } + + // __uninitialized_fill_move + // Fills [result, mid) with x, and moves [first, last) into + // [mid, mid + (last - first)). + template + inline _ForwardIterator + __uninitialized_fill_move(_ForwardIterator __result, _ForwardIterator __mid, + const _Tp& __x, _InputIterator __first, + _InputIterator __last, _Allocator& __alloc) + { + std::__uninitialized_fill_a(__result, __mid, __x, __alloc); + __try + { + return std::__uninitialized_move_a(__first, __last, __mid, __alloc); + } + __catch(...) + { + std::_Destroy(__result, __mid, __alloc); + __throw_exception_again; + } + } + + // __uninitialized_move_fill + // Moves [first1, last1) into [first2, first2 + (last1 - first1)), and + // fills [first2 + (last1 - first1), last2) with x. + template + inline void + __uninitialized_move_fill(_InputIterator __first1, _InputIterator __last1, + _ForwardIterator __first2, + _ForwardIterator __last2, const _Tp& __x, + _Allocator& __alloc) + { + _ForwardIterator __mid2 = std::__uninitialized_move_a(__first1, __last1, + __first2, + __alloc); + __try + { + std::__uninitialized_fill_a(__mid2, __last2, __x, __alloc); + } + __catch(...) + { + std::_Destroy(__first2, __mid2, __alloc); + __throw_exception_again; + } + } + +#if __cplusplus >= 201103L + // Extensions: __uninitialized_default, __uninitialized_default_n, + // __uninitialized_default_a, __uninitialized_default_n_a. + + template + struct __uninitialized_default_1 + { + template + static void + __uninit_default(_ForwardIterator __first, _ForwardIterator __last) + { + _ForwardIterator __cur = __first; + __try + { + for (; __cur != __last; ++__cur) + std::_Construct(std::__addressof(*__cur)); + } + __catch(...) + { + std::_Destroy(__first, __cur); + __throw_exception_again; + } + } + }; + + template<> + struct __uninitialized_default_1 + { + template + static void + __uninit_default(_ForwardIterator __first, _ForwardIterator __last) + { + typedef typename iterator_traits<_ForwardIterator>::value_type + _ValueType; + + std::fill(__first, __last, _ValueType()); + } + }; + + template + struct __uninitialized_default_n_1 + { + template + static _ForwardIterator + __uninit_default_n(_ForwardIterator __first, _Size __n) + { + _ForwardIterator __cur = __first; + __try + { + for (; __n > 0; --__n, ++__cur) + std::_Construct(std::__addressof(*__cur)); + return __cur; + } + __catch(...) + { + std::_Destroy(__first, __cur); + __throw_exception_again; + } + } + }; + + template<> + struct __uninitialized_default_n_1 + { + template + static _ForwardIterator + __uninit_default_n(_ForwardIterator __first, _Size __n) + { + typedef typename iterator_traits<_ForwardIterator>::value_type + _ValueType; + + return std::fill_n(__first, __n, _ValueType()); + } + }; + + // __uninitialized_default + // Fills [first, last) with std::distance(first, last) default + // constructed value_types(s). + template + inline void + __uninitialized_default(_ForwardIterator __first, + _ForwardIterator __last) + { + typedef typename iterator_traits<_ForwardIterator>::value_type + _ValueType; + // trivial types can have deleted assignment + const bool __assignable = is_copy_assignable<_ValueType>::value; + + std::__uninitialized_default_1<__is_trivial(_ValueType) + && __assignable>:: + __uninit_default(__first, __last); + } + + // __uninitialized_default_n + // Fills [first, first + n) with n default constructed value_type(s). + template + inline _ForwardIterator + __uninitialized_default_n(_ForwardIterator __first, _Size __n) + { + typedef typename iterator_traits<_ForwardIterator>::value_type + _ValueType; + // trivial types can have deleted assignment + const bool __assignable = is_copy_assignable<_ValueType>::value; + + return __uninitialized_default_n_1<__is_trivial(_ValueType) + && __assignable>:: + __uninit_default_n(__first, __n); + } + + + // __uninitialized_default_a + // Fills [first, last) with std::distance(first, last) default + // constructed value_types(s), constructed with the allocator alloc. + template + void + __uninitialized_default_a(_ForwardIterator __first, + _ForwardIterator __last, + _Allocator& __alloc) + { + _ForwardIterator __cur = __first; + __try + { + typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; + for (; __cur != __last; ++__cur) + __traits::construct(__alloc, std::__addressof(*__cur)); + } + __catch(...) + { + std::_Destroy(__first, __cur, __alloc); + __throw_exception_again; + } + } + + template + inline void + __uninitialized_default_a(_ForwardIterator __first, + _ForwardIterator __last, + allocator<_Tp>&) + { std::__uninitialized_default(__first, __last); } + + + // __uninitialized_default_n_a + // Fills [first, first + n) with n default constructed value_types(s), + // constructed with the allocator alloc. + template + _ForwardIterator + __uninitialized_default_n_a(_ForwardIterator __first, _Size __n, + _Allocator& __alloc) + { + _ForwardIterator __cur = __first; + __try + { + typedef __gnu_cxx::__alloc_traits<_Allocator> __traits; + for (; __n > 0; --__n, ++__cur) + __traits::construct(__alloc, std::__addressof(*__cur)); + return __cur; + } + __catch(...) + { + std::_Destroy(__first, __cur, __alloc); + __throw_exception_again; + } + } + + template + inline _ForwardIterator + __uninitialized_default_n_a(_ForwardIterator __first, _Size __n, + allocator<_Tp>&) + { return std::__uninitialized_default_n(__first, __n); } + + template + struct __uninitialized_default_novalue_1 + { + template + static void + __uninit_default_novalue(_ForwardIterator __first, + _ForwardIterator __last) + { + _ForwardIterator __cur = __first; + __try + { + for (; __cur != __last; ++__cur) + std::_Construct_novalue(std::__addressof(*__cur)); + } + __catch(...) + { + std::_Destroy(__first, __cur); + __throw_exception_again; + } + } + }; + + template<> + struct __uninitialized_default_novalue_1 + { + template + static void + __uninit_default_novalue(_ForwardIterator __first, + _ForwardIterator __last) + { + } + }; + + template + struct __uninitialized_default_novalue_n_1 + { + template + static _ForwardIterator + __uninit_default_novalue_n(_ForwardIterator __first, _Size __n) + { + _ForwardIterator __cur = __first; + __try + { + for (; __n > 0; --__n, ++__cur) + std::_Construct_novalue(std::__addressof(*__cur)); + return __cur; + } + __catch(...) + { + std::_Destroy(__first, __cur); + __throw_exception_again; + } + } + }; + + template<> + struct __uninitialized_default_novalue_n_1 + { + template + static _ForwardIterator + __uninit_default_novalue_n(_ForwardIterator __first, _Size __n) + { return std::next(__first, __n); } + }; + + // __uninitialized_default_novalue + // Fills [first, last) with std::distance(first, last) default-initialized + // value_types(s). + template + inline void + __uninitialized_default_novalue(_ForwardIterator __first, + _ForwardIterator __last) + { + typedef typename iterator_traits<_ForwardIterator>::value_type + _ValueType; + + std::__uninitialized_default_novalue_1< + is_trivially_default_constructible<_ValueType>::value>:: + __uninit_default_novalue(__first, __last); + } + + // __uninitialized_default_n + // Fills [first, first + n) with n default-initialized value_type(s). + template + inline _ForwardIterator + __uninitialized_default_novalue_n(_ForwardIterator __first, _Size __n) + { + typedef typename iterator_traits<_ForwardIterator>::value_type + _ValueType; + + return __uninitialized_default_novalue_n_1< + is_trivially_default_constructible<_ValueType>::value>:: + __uninit_default_novalue_n(__first, __n); + } + + template + _ForwardIterator + __uninitialized_copy_n(_InputIterator __first, _Size __n, + _ForwardIterator __result, input_iterator_tag) + { + _ForwardIterator __cur = __result; + __try + { + for (; __n > 0; --__n, ++__first, ++__cur) + std::_Construct(std::__addressof(*__cur), *__first); + return __cur; + } + __catch(...) + { + std::_Destroy(__result, __cur); + __throw_exception_again; + } + } + + template + inline _ForwardIterator + __uninitialized_copy_n(_RandomAccessIterator __first, _Size __n, + _ForwardIterator __result, + random_access_iterator_tag) + { return std::uninitialized_copy(__first, __first + __n, __result); } + + template + pair<_InputIterator, _ForwardIterator> + __uninitialized_copy_n_pair(_InputIterator __first, _Size __n, + _ForwardIterator __result, input_iterator_tag) + { + _ForwardIterator __cur = __result; + __try + { + for (; __n > 0; --__n, ++__first, ++__cur) + std::_Construct(std::__addressof(*__cur), *__first); + return {__first, __cur}; + } + __catch(...) + { + std::_Destroy(__result, __cur); + __throw_exception_again; + } + } + + template + inline pair<_RandomAccessIterator, _ForwardIterator> + __uninitialized_copy_n_pair(_RandomAccessIterator __first, _Size __n, + _ForwardIterator __result, + random_access_iterator_tag) + { + auto __second_res = uninitialized_copy(__first, __first + __n, __result); + auto __first_res = std::next(__first, __n); + return {__first_res, __second_res}; + } + + /** + * @brief Copies the range [first,first+n) into result. + * @param __first An input iterator. + * @param __n The number of elements to copy. + * @param __result An output iterator. + * @return __result + __n + * + * Like copy_n(), but does not require an initialized output range. + */ + template + inline _ForwardIterator + uninitialized_copy_n(_InputIterator __first, _Size __n, + _ForwardIterator __result) + { return std::__uninitialized_copy_n(__first, __n, __result, + std::__iterator_category(__first)); } + + template + inline pair<_InputIterator, _ForwardIterator> + __uninitialized_copy_n_pair(_InputIterator __first, _Size __n, + _ForwardIterator __result) + { + return + std::__uninitialized_copy_n_pair(__first, __n, __result, + std::__iterator_category(__first)); + } + +#endif + +#if __cplusplus > 201402L + template + inline void + uninitialized_default_construct(_ForwardIterator __first, + _ForwardIterator __last) + { + __uninitialized_default_novalue(__first, __last); + } + + template + inline _ForwardIterator + uninitialized_default_construct_n(_ForwardIterator __first, _Size __count) + { + return __uninitialized_default_novalue_n(__first, __count); + } + + template + inline void + uninitialized_value_construct(_ForwardIterator __first, + _ForwardIterator __last) + { + return __uninitialized_default(__first, __last); + } + + template + inline _ForwardIterator + uninitialized_value_construct_n(_ForwardIterator __first, _Size __count) + { + return __uninitialized_default_n(__first, __count); + } + + template + inline _ForwardIterator + uninitialized_move(_InputIterator __first, _InputIterator __last, + _ForwardIterator __result) + { + return std::uninitialized_copy + (_GLIBCXX_MAKE_MOVE_ITERATOR(__first), + _GLIBCXX_MAKE_MOVE_ITERATOR(__last), __result); + } + + template + inline pair<_InputIterator, _ForwardIterator> + uninitialized_move_n(_InputIterator __first, _Size __count, + _ForwardIterator __result) + { + auto __res = std::__uninitialized_copy_n_pair + (_GLIBCXX_MAKE_MOVE_ITERATOR(__first), + __count, __result); + return {__res.first.base(), __res.second}; + } +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _STL_UNINITIALIZED_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_vector.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_vector.h new file mode 100644 index 0000000..fb88212 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stl_vector.h @@ -0,0 +1,1651 @@ +// Vector implementation -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Hewlett-Packard Company makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * + * Copyright (c) 1996 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file bits/stl_vector.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{vector} + */ + +#ifndef _STL_VECTOR_H +#define _STL_VECTOR_H 1 + +#include +#include +#include +#if __cplusplus >= 201103L +#include +#endif + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_CONTAINER + + /// See bits/stl_deque.h's _Deque_base for an explanation. + template + struct _Vector_base + { + typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template + rebind<_Tp>::other _Tp_alloc_type; + typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>::pointer + pointer; + + struct _Vector_impl + : public _Tp_alloc_type + { + pointer _M_start; + pointer _M_finish; + pointer _M_end_of_storage; + + _Vector_impl() + : _Tp_alloc_type(), _M_start(), _M_finish(), _M_end_of_storage() + { } + + _Vector_impl(_Tp_alloc_type const& __a) _GLIBCXX_NOEXCEPT + : _Tp_alloc_type(__a), _M_start(), _M_finish(), _M_end_of_storage() + { } + +#if __cplusplus >= 201103L + _Vector_impl(_Tp_alloc_type&& __a) noexcept + : _Tp_alloc_type(std::move(__a)), + _M_start(), _M_finish(), _M_end_of_storage() + { } +#endif + + void _M_swap_data(_Vector_impl& __x) _GLIBCXX_NOEXCEPT + { + std::swap(_M_start, __x._M_start); + std::swap(_M_finish, __x._M_finish); + std::swap(_M_end_of_storage, __x._M_end_of_storage); + } + }; + + public: + typedef _Alloc allocator_type; + + _Tp_alloc_type& + _M_get_Tp_allocator() _GLIBCXX_NOEXCEPT + { return *static_cast<_Tp_alloc_type*>(&this->_M_impl); } + + const _Tp_alloc_type& + _M_get_Tp_allocator() const _GLIBCXX_NOEXCEPT + { return *static_cast(&this->_M_impl); } + + allocator_type + get_allocator() const _GLIBCXX_NOEXCEPT + { return allocator_type(_M_get_Tp_allocator()); } + + _Vector_base() + : _M_impl() { } + + _Vector_base(const allocator_type& __a) _GLIBCXX_NOEXCEPT + : _M_impl(__a) { } + + _Vector_base(size_t __n) + : _M_impl() + { _M_create_storage(__n); } + + _Vector_base(size_t __n, const allocator_type& __a) + : _M_impl(__a) + { _M_create_storage(__n); } + +#if __cplusplus >= 201103L + _Vector_base(_Tp_alloc_type&& __a) noexcept + : _M_impl(std::move(__a)) { } + + _Vector_base(_Vector_base&& __x) noexcept + : _M_impl(std::move(__x._M_get_Tp_allocator())) + { this->_M_impl._M_swap_data(__x._M_impl); } + + _Vector_base(_Vector_base&& __x, const allocator_type& __a) + : _M_impl(__a) + { + if (__x.get_allocator() == __a) + this->_M_impl._M_swap_data(__x._M_impl); + else + { + size_t __n = __x._M_impl._M_finish - __x._M_impl._M_start; + _M_create_storage(__n); + } + } +#endif + + ~_Vector_base() _GLIBCXX_NOEXCEPT + { _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage + - this->_M_impl._M_start); } + + public: + _Vector_impl _M_impl; + + pointer + _M_allocate(size_t __n) + { + typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Tr; + return __n != 0 ? _Tr::allocate(_M_impl, __n) : pointer(); + } + + void + _M_deallocate(pointer __p, size_t __n) + { + typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Tr; + if (__p) + _Tr::deallocate(_M_impl, __p, __n); + } + + private: + void + _M_create_storage(size_t __n) + { + this->_M_impl._M_start = this->_M_allocate(__n); + this->_M_impl._M_finish = this->_M_impl._M_start; + this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n; + } + }; + + + /** + * @brief A standard container which offers fixed time access to + * individual elements in any order. + * + * @ingroup sequences + * + * @tparam _Tp Type of element. + * @tparam _Alloc Allocator type, defaults to allocator<_Tp>. + * + * Meets the requirements of a container, a + * reversible container, and a + * sequence, including the + * optional sequence requirements with the + * %exception of @c push_front and @c pop_front. + * + * In some terminology a %vector can be described as a dynamic + * C-style array, it offers fast and efficient access to individual + * elements in any order and saves the user from worrying about + * memory and size allocation. Subscripting ( @c [] ) access is + * also provided as with C-style arrays. + */ + template > + class vector : protected _Vector_base<_Tp, _Alloc> + { +#ifdef _GLIBCXX_CONCEPT_CHECKS + // Concept requirements. + typedef typename _Alloc::value_type _Alloc_value_type; +# if __cplusplus < 201103L + __glibcxx_class_requires(_Tp, _SGIAssignableConcept) +# endif + __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept) +#endif + + typedef _Vector_base<_Tp, _Alloc> _Base; + typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; + typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Alloc_traits; + + public: + typedef _Tp value_type; + typedef typename _Base::pointer pointer; + typedef typename _Alloc_traits::const_pointer const_pointer; + typedef typename _Alloc_traits::reference reference; + typedef typename _Alloc_traits::const_reference const_reference; + typedef __gnu_cxx::__normal_iterator iterator; + typedef __gnu_cxx::__normal_iterator + const_iterator; + typedef std::reverse_iterator const_reverse_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Alloc allocator_type; + + protected: + using _Base::_M_allocate; + using _Base::_M_deallocate; + using _Base::_M_impl; + using _Base::_M_get_Tp_allocator; + + public: + // [23.2.4.1] construct/copy/destroy + // (assign() and get_allocator() are also listed in this section) + + /** + * @brief Creates a %vector with no elements. + */ + vector() +#if __cplusplus >= 201103L + noexcept(is_nothrow_default_constructible<_Alloc>::value) +#endif + : _Base() { } + + /** + * @brief Creates a %vector with no elements. + * @param __a An allocator object. + */ + explicit + vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT + : _Base(__a) { } + +#if __cplusplus >= 201103L + /** + * @brief Creates a %vector with default constructed elements. + * @param __n The number of elements to initially create. + * @param __a An allocator. + * + * This constructor fills the %vector with @a __n default + * constructed elements. + */ + explicit + vector(size_type __n, const allocator_type& __a = allocator_type()) + : _Base(__n, __a) + { _M_default_initialize(__n); } + + /** + * @brief Creates a %vector with copies of an exemplar element. + * @param __n The number of elements to initially create. + * @param __value An element to copy. + * @param __a An allocator. + * + * This constructor fills the %vector with @a __n copies of @a __value. + */ + vector(size_type __n, const value_type& __value, + const allocator_type& __a = allocator_type()) + : _Base(__n, __a) + { _M_fill_initialize(__n, __value); } +#else + /** + * @brief Creates a %vector with copies of an exemplar element. + * @param __n The number of elements to initially create. + * @param __value An element to copy. + * @param __a An allocator. + * + * This constructor fills the %vector with @a __n copies of @a __value. + */ + explicit + vector(size_type __n, const value_type& __value = value_type(), + const allocator_type& __a = allocator_type()) + : _Base(__n, __a) + { _M_fill_initialize(__n, __value); } +#endif + + /** + * @brief %Vector copy constructor. + * @param __x A %vector of identical element and allocator types. + * + * All the elements of @a __x are copied, but any unused capacity in + * @a __x will not be copied + * (i.e. capacity() == size() in the new %vector). + * + * The newly-created %vector uses a copy of the allocator object used + * by @a __x (unless the allocator traits dictate a different object). + */ + vector(const vector& __x) + : _Base(__x.size(), + _Alloc_traits::_S_select_on_copy(__x._M_get_Tp_allocator())) + { + this->_M_impl._M_finish = + std::__uninitialized_copy_a(__x.begin(), __x.end(), + this->_M_impl._M_start, + _M_get_Tp_allocator()); + } + +#if __cplusplus >= 201103L + /** + * @brief %Vector move constructor. + * @param __x A %vector of identical element and allocator types. + * + * The newly-created %vector contains the exact contents of @a __x. + * The contents of @a __x are a valid, but unspecified %vector. + */ + vector(vector&& __x) noexcept + : _Base(std::move(__x)) { } + + /// Copy constructor with alternative allocator + vector(const vector& __x, const allocator_type& __a) + : _Base(__x.size(), __a) + { + this->_M_impl._M_finish = + std::__uninitialized_copy_a(__x.begin(), __x.end(), + this->_M_impl._M_start, + _M_get_Tp_allocator()); + } + + /// Move constructor with alternative allocator + vector(vector&& __rv, const allocator_type& __m) + noexcept(_Alloc_traits::_S_always_equal()) + : _Base(std::move(__rv), __m) + { + if (__rv.get_allocator() != __m) + { + this->_M_impl._M_finish = + std::__uninitialized_move_a(__rv.begin(), __rv.end(), + this->_M_impl._M_start, + _M_get_Tp_allocator()); + __rv.clear(); + } + } + + /** + * @brief Builds a %vector from an initializer list. + * @param __l An initializer_list. + * @param __a An allocator. + * + * Create a %vector consisting of copies of the elements in the + * initializer_list @a __l. + * + * This will call the element type's copy constructor N times + * (where N is @a __l.size()) and do no memory reallocation. + */ + vector(initializer_list __l, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { + _M_range_initialize(__l.begin(), __l.end(), + random_access_iterator_tag()); + } +#endif + + /** + * @brief Builds a %vector from a range. + * @param __first An input iterator. + * @param __last An input iterator. + * @param __a An allocator. + * + * Create a %vector consisting of copies of the elements from + * [first,last). + * + * If the iterators are forward, bidirectional, or + * random-access, then this will call the elements' copy + * constructor N times (where N is distance(first,last)) and do + * no memory reallocation. But if only input iterators are + * used, then this will do at most 2N calls to the copy + * constructor, and logN memory reallocations. + */ +#if __cplusplus >= 201103L + template> + vector(_InputIterator __first, _InputIterator __last, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { _M_initialize_dispatch(__first, __last, __false_type()); } +#else + template + vector(_InputIterator __first, _InputIterator __last, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { + // Check whether it's an integral type. If so, it's not an iterator. + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + _M_initialize_dispatch(__first, __last, _Integral()); + } +#endif + + /** + * The dtor only erases the elements, and note that if the + * elements themselves are pointers, the pointed-to memory is + * not touched in any way. Managing the pointer is the user's + * responsibility. + */ + ~vector() _GLIBCXX_NOEXCEPT + { std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish, + _M_get_Tp_allocator()); } + + /** + * @brief %Vector assignment operator. + * @param __x A %vector of identical element and allocator types. + * + * All the elements of @a __x are copied, but any unused capacity in + * @a __x will not be copied. + * + * Whether the allocator is copied depends on the allocator traits. + */ + vector& + operator=(const vector& __x); + +#if __cplusplus >= 201103L + /** + * @brief %Vector move assignment operator. + * @param __x A %vector of identical element and allocator types. + * + * The contents of @a __x are moved into this %vector (without copying, + * if the allocators permit it). + * Afterwards @a __x is a valid, but unspecified %vector. + * + * Whether the allocator is moved depends on the allocator traits. + */ + vector& + operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) + { + constexpr bool __move_storage = + _Alloc_traits::_S_propagate_on_move_assign() + || _Alloc_traits::_S_always_equal(); + _M_move_assign(std::move(__x), __bool_constant<__move_storage>()); + return *this; + } + + /** + * @brief %Vector list assignment operator. + * @param __l An initializer_list. + * + * This function fills a %vector with copies of the elements in the + * initializer list @a __l. + * + * Note that the assignment completely changes the %vector and + * that the resulting %vector's size is the same as the number + * of elements assigned. + */ + vector& + operator=(initializer_list __l) + { + this->_M_assign_aux(__l.begin(), __l.end(), + random_access_iterator_tag()); + return *this; + } +#endif + + /** + * @brief Assigns a given value to a %vector. + * @param __n Number of elements to be assigned. + * @param __val Value to be assigned. + * + * This function fills a %vector with @a __n copies of the given + * value. Note that the assignment completely changes the + * %vector and that the resulting %vector's size is the same as + * the number of elements assigned. + */ + void + assign(size_type __n, const value_type& __val) + { _M_fill_assign(__n, __val); } + + /** + * @brief Assigns a range to a %vector. + * @param __first An input iterator. + * @param __last An input iterator. + * + * This function fills a %vector with copies of the elements in the + * range [__first,__last). + * + * Note that the assignment completely changes the %vector and + * that the resulting %vector's size is the same as the number + * of elements assigned. + */ +#if __cplusplus >= 201103L + template> + void + assign(_InputIterator __first, _InputIterator __last) + { _M_assign_dispatch(__first, __last, __false_type()); } +#else + template + void + assign(_InputIterator __first, _InputIterator __last) + { + // Check whether it's an integral type. If so, it's not an iterator. + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + _M_assign_dispatch(__first, __last, _Integral()); + } +#endif + +#if __cplusplus >= 201103L + /** + * @brief Assigns an initializer list to a %vector. + * @param __l An initializer_list. + * + * This function fills a %vector with copies of the elements in the + * initializer list @a __l. + * + * Note that the assignment completely changes the %vector and + * that the resulting %vector's size is the same as the number + * of elements assigned. + */ + void + assign(initializer_list __l) + { + this->_M_assign_aux(__l.begin(), __l.end(), + random_access_iterator_tag()); + } +#endif + + /// Get a copy of the memory allocation object. + using _Base::get_allocator; + + // iterators + /** + * Returns a read/write iterator that points to the first + * element in the %vector. Iteration is done in ordinary + * element order. + */ + iterator + begin() _GLIBCXX_NOEXCEPT + { return iterator(this->_M_impl._M_start); } + + /** + * Returns a read-only (constant) iterator that points to the + * first element in the %vector. Iteration is done in ordinary + * element order. + */ + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return const_iterator(this->_M_impl._M_start); } + + /** + * Returns a read/write iterator that points one past the last + * element in the %vector. Iteration is done in ordinary + * element order. + */ + iterator + end() _GLIBCXX_NOEXCEPT + { return iterator(this->_M_impl._M_finish); } + + /** + * Returns a read-only (constant) iterator that points one past + * the last element in the %vector. Iteration is done in + * ordinary element order. + */ + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return const_iterator(this->_M_impl._M_finish); } + + /** + * Returns a read/write reverse iterator that points to the + * last element in the %vector. Iteration is done in reverse + * element order. + */ + reverse_iterator + rbegin() _GLIBCXX_NOEXCEPT + { return reverse_iterator(end()); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to the last element in the %vector. Iteration is done in + * reverse element order. + */ + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(end()); } + + /** + * Returns a read/write reverse iterator that points to one + * before the first element in the %vector. Iteration is done + * in reverse element order. + */ + reverse_iterator + rend() _GLIBCXX_NOEXCEPT + { return reverse_iterator(begin()); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to one before the first element in the %vector. Iteration + * is done in reverse element order. + */ + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(begin()); } + +#if __cplusplus >= 201103L + /** + * Returns a read-only (constant) iterator that points to the + * first element in the %vector. Iteration is done in ordinary + * element order. + */ + const_iterator + cbegin() const noexcept + { return const_iterator(this->_M_impl._M_start); } + + /** + * Returns a read-only (constant) iterator that points one past + * the last element in the %vector. Iteration is done in + * ordinary element order. + */ + const_iterator + cend() const noexcept + { return const_iterator(this->_M_impl._M_finish); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to the last element in the %vector. Iteration is done in + * reverse element order. + */ + const_reverse_iterator + crbegin() const noexcept + { return const_reverse_iterator(end()); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to one before the first element in the %vector. Iteration + * is done in reverse element order. + */ + const_reverse_iterator + crend() const noexcept + { return const_reverse_iterator(begin()); } +#endif + + // [23.2.4.2] capacity + /** Returns the number of elements in the %vector. */ + size_type + size() const _GLIBCXX_NOEXCEPT + { return size_type(this->_M_impl._M_finish - this->_M_impl._M_start); } + + /** Returns the size() of the largest possible %vector. */ + size_type + max_size() const _GLIBCXX_NOEXCEPT + { return _Alloc_traits::max_size(_M_get_Tp_allocator()); } + +#if __cplusplus >= 201103L + /** + * @brief Resizes the %vector to the specified number of elements. + * @param __new_size Number of elements the %vector should contain. + * + * This function will %resize the %vector to the specified + * number of elements. If the number is smaller than the + * %vector's current size the %vector is truncated, otherwise + * default constructed elements are appended. + */ + void + resize(size_type __new_size) + { + if (__new_size > size()) + _M_default_append(__new_size - size()); + else if (__new_size < size()) + _M_erase_at_end(this->_M_impl._M_start + __new_size); + } + + /** + * @brief Resizes the %vector to the specified number of elements. + * @param __new_size Number of elements the %vector should contain. + * @param __x Data with which new elements should be populated. + * + * This function will %resize the %vector to the specified + * number of elements. If the number is smaller than the + * %vector's current size the %vector is truncated, otherwise + * the %vector is extended and new elements are populated with + * given data. + */ + void + resize(size_type __new_size, const value_type& __x) + { + if (__new_size > size()) + _M_fill_insert(end(), __new_size - size(), __x); + else if (__new_size < size()) + _M_erase_at_end(this->_M_impl._M_start + __new_size); + } +#else + /** + * @brief Resizes the %vector to the specified number of elements. + * @param __new_size Number of elements the %vector should contain. + * @param __x Data with which new elements should be populated. + * + * This function will %resize the %vector to the specified + * number of elements. If the number is smaller than the + * %vector's current size the %vector is truncated, otherwise + * the %vector is extended and new elements are populated with + * given data. + */ + void + resize(size_type __new_size, value_type __x = value_type()) + { + if (__new_size > size()) + _M_fill_insert(end(), __new_size - size(), __x); + else if (__new_size < size()) + _M_erase_at_end(this->_M_impl._M_start + __new_size); + } +#endif + +#if __cplusplus >= 201103L + /** A non-binding request to reduce capacity() to size(). */ + void + shrink_to_fit() + { _M_shrink_to_fit(); } +#endif + + /** + * Returns the total number of elements that the %vector can + * hold before needing to allocate more memory. + */ + size_type + capacity() const _GLIBCXX_NOEXCEPT + { return size_type(this->_M_impl._M_end_of_storage + - this->_M_impl._M_start); } + + /** + * Returns true if the %vector is empty. (Thus begin() would + * equal end().) + */ + bool + empty() const _GLIBCXX_NOEXCEPT + { return begin() == end(); } + + /** + * @brief Attempt to preallocate enough memory for specified number of + * elements. + * @param __n Number of elements required. + * @throw std::length_error If @a n exceeds @c max_size(). + * + * This function attempts to reserve enough memory for the + * %vector to hold the specified number of elements. If the + * number requested is more than max_size(), length_error is + * thrown. + * + * The advantage of this function is that if optimal code is a + * necessity and the user can determine the number of elements + * that will be required, the user can reserve the memory in + * %advance, and thus prevent a possible reallocation of memory + * and copying of %vector data. + */ + void + reserve(size_type __n); + + // element access + /** + * @brief Subscript access to the data contained in the %vector. + * @param __n The index of the element for which data should be + * accessed. + * @return Read/write reference to data. + * + * This operator allows for easy, array-style, data access. + * Note that data access with this operator is unchecked and + * out_of_range lookups are not defined. (For checked lookups + * see at().) + */ + reference + operator[](size_type __n) _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_subscript(__n); + return *(this->_M_impl._M_start + __n); + } + + /** + * @brief Subscript access to the data contained in the %vector. + * @param __n The index of the element for which data should be + * accessed. + * @return Read-only (constant) reference to data. + * + * This operator allows for easy, array-style, data access. + * Note that data access with this operator is unchecked and + * out_of_range lookups are not defined. (For checked lookups + * see at().) + */ + const_reference + operator[](size_type __n) const _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_subscript(__n); + return *(this->_M_impl._M_start + __n); + } + + protected: + /// Safety check used only from at(). + void + _M_range_check(size_type __n) const + { + if (__n >= this->size()) + __throw_out_of_range_fmt(__N("vector::_M_range_check: __n " + "(which is %zu) >= this->size() " + "(which is %zu)"), + __n, this->size()); + } + + public: + /** + * @brief Provides access to the data contained in the %vector. + * @param __n The index of the element for which data should be + * accessed. + * @return Read/write reference to data. + * @throw std::out_of_range If @a __n is an invalid index. + * + * This function provides for safer data access. The parameter + * is first checked that it is in the range of the vector. The + * function throws out_of_range if the check fails. + */ + reference + at(size_type __n) + { + _M_range_check(__n); + return (*this)[__n]; + } + + /** + * @brief Provides access to the data contained in the %vector. + * @param __n The index of the element for which data should be + * accessed. + * @return Read-only (constant) reference to data. + * @throw std::out_of_range If @a __n is an invalid index. + * + * This function provides for safer data access. The parameter + * is first checked that it is in the range of the vector. The + * function throws out_of_range if the check fails. + */ + const_reference + at(size_type __n) const + { + _M_range_check(__n); + return (*this)[__n]; + } + + /** + * Returns a read/write reference to the data at the first + * element of the %vector. + */ + reference + front() _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_nonempty(); + return *begin(); + } + + /** + * Returns a read-only (constant) reference to the data at the first + * element of the %vector. + */ + const_reference + front() const _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_nonempty(); + return *begin(); + } + + /** + * Returns a read/write reference to the data at the last + * element of the %vector. + */ + reference + back() _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_nonempty(); + return *(end() - 1); + } + + /** + * Returns a read-only (constant) reference to the data at the + * last element of the %vector. + */ + const_reference + back() const _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_nonempty(); + return *(end() - 1); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 464. Suggestion for new member functions in standard containers. + // data access + /** + * Returns a pointer such that [data(), data() + size()) is a valid + * range. For a non-empty %vector, data() == &front(). + */ + _Tp* + data() _GLIBCXX_NOEXCEPT + { return _M_data_ptr(this->_M_impl._M_start); } + + const _Tp* + data() const _GLIBCXX_NOEXCEPT + { return _M_data_ptr(this->_M_impl._M_start); } + + // [23.2.4.3] modifiers + /** + * @brief Add data to the end of the %vector. + * @param __x Data to be added. + * + * This is a typical stack operation. The function creates an + * element at the end of the %vector and assigns the given data + * to it. Due to the nature of a %vector this operation can be + * done in constant time if the %vector has preallocated space + * available. + */ + void + push_back(const value_type& __x) + { + if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage) + { + _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, + __x); + ++this->_M_impl._M_finish; + } + else + _M_realloc_insert(end(), __x); + } + +#if __cplusplus >= 201103L + void + push_back(value_type&& __x) + { emplace_back(std::move(__x)); } + + template +#if __cplusplus > 201402L + reference +#else + void +#endif + emplace_back(_Args&&... __args); +#endif + + /** + * @brief Removes last element. + * + * This is a typical stack operation. It shrinks the %vector by one. + * + * Note that no data is returned, and if the last element's + * data is needed, it should be retrieved before pop_back() is + * called. + */ + void + pop_back() _GLIBCXX_NOEXCEPT + { + __glibcxx_requires_nonempty(); + --this->_M_impl._M_finish; + _Alloc_traits::destroy(this->_M_impl, this->_M_impl._M_finish); + } + +#if __cplusplus >= 201103L + /** + * @brief Inserts an object in %vector before specified iterator. + * @param __position A const_iterator into the %vector. + * @param __args Arguments. + * @return An iterator that points to the inserted data. + * + * This function will insert an object of type T constructed + * with T(std::forward(args)...) before the specified location. + * Note that this kind of operation could be expensive for a %vector + * and if it is frequently used the user should consider using + * std::list. + */ + template + iterator + emplace(const_iterator __position, _Args&&... __args) + { return _M_emplace_aux(__position, std::forward<_Args>(__args)...); } + + /** + * @brief Inserts given value into %vector before specified iterator. + * @param __position A const_iterator into the %vector. + * @param __x Data to be inserted. + * @return An iterator that points to the inserted data. + * + * This function will insert a copy of the given value before + * the specified location. Note that this kind of operation + * could be expensive for a %vector and if it is frequently + * used the user should consider using std::list. + */ + iterator + insert(const_iterator __position, const value_type& __x); +#else + /** + * @brief Inserts given value into %vector before specified iterator. + * @param __position An iterator into the %vector. + * @param __x Data to be inserted. + * @return An iterator that points to the inserted data. + * + * This function will insert a copy of the given value before + * the specified location. Note that this kind of operation + * could be expensive for a %vector and if it is frequently + * used the user should consider using std::list. + */ + iterator + insert(iterator __position, const value_type& __x); +#endif + +#if __cplusplus >= 201103L + /** + * @brief Inserts given rvalue into %vector before specified iterator. + * @param __position A const_iterator into the %vector. + * @param __x Data to be inserted. + * @return An iterator that points to the inserted data. + * + * This function will insert a copy of the given rvalue before + * the specified location. Note that this kind of operation + * could be expensive for a %vector and if it is frequently + * used the user should consider using std::list. + */ + iterator + insert(const_iterator __position, value_type&& __x) + { return _M_insert_rval(__position, std::move(__x)); } + + /** + * @brief Inserts an initializer_list into the %vector. + * @param __position An iterator into the %vector. + * @param __l An initializer_list. + * + * This function will insert copies of the data in the + * initializer_list @a l into the %vector before the location + * specified by @a position. + * + * Note that this kind of operation could be expensive for a + * %vector and if it is frequently used the user should + * consider using std::list. + */ + iterator + insert(const_iterator __position, initializer_list __l) + { + auto __offset = __position - cbegin(); + _M_range_insert(begin() + __offset, __l.begin(), __l.end(), + std::random_access_iterator_tag()); + return begin() + __offset; + } +#endif + +#if __cplusplus >= 201103L + /** + * @brief Inserts a number of copies of given data into the %vector. + * @param __position A const_iterator into the %vector. + * @param __n Number of elements to be inserted. + * @param __x Data to be inserted. + * @return An iterator that points to the inserted data. + * + * This function will insert a specified number of copies of + * the given data before the location specified by @a position. + * + * Note that this kind of operation could be expensive for a + * %vector and if it is frequently used the user should + * consider using std::list. + */ + iterator + insert(const_iterator __position, size_type __n, const value_type& __x) + { + difference_type __offset = __position - cbegin(); + _M_fill_insert(begin() + __offset, __n, __x); + return begin() + __offset; + } +#else + /** + * @brief Inserts a number of copies of given data into the %vector. + * @param __position An iterator into the %vector. + * @param __n Number of elements to be inserted. + * @param __x Data to be inserted. + * + * This function will insert a specified number of copies of + * the given data before the location specified by @a position. + * + * Note that this kind of operation could be expensive for a + * %vector and if it is frequently used the user should + * consider using std::list. + */ + void + insert(iterator __position, size_type __n, const value_type& __x) + { _M_fill_insert(__position, __n, __x); } +#endif + +#if __cplusplus >= 201103L + /** + * @brief Inserts a range into the %vector. + * @param __position A const_iterator into the %vector. + * @param __first An input iterator. + * @param __last An input iterator. + * @return An iterator that points to the inserted data. + * + * This function will insert copies of the data in the range + * [__first,__last) into the %vector before the location specified + * by @a pos. + * + * Note that this kind of operation could be expensive for a + * %vector and if it is frequently used the user should + * consider using std::list. + */ + template> + iterator + insert(const_iterator __position, _InputIterator __first, + _InputIterator __last) + { + difference_type __offset = __position - cbegin(); + _M_insert_dispatch(begin() + __offset, + __first, __last, __false_type()); + return begin() + __offset; + } +#else + /** + * @brief Inserts a range into the %vector. + * @param __position An iterator into the %vector. + * @param __first An input iterator. + * @param __last An input iterator. + * + * This function will insert copies of the data in the range + * [__first,__last) into the %vector before the location specified + * by @a pos. + * + * Note that this kind of operation could be expensive for a + * %vector and if it is frequently used the user should + * consider using std::list. + */ + template + void + insert(iterator __position, _InputIterator __first, + _InputIterator __last) + { + // Check whether it's an integral type. If so, it's not an iterator. + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + _M_insert_dispatch(__position, __first, __last, _Integral()); + } +#endif + + /** + * @brief Remove element at given position. + * @param __position Iterator pointing to element to be erased. + * @return An iterator pointing to the next element (or end()). + * + * This function will erase the element at the given position and thus + * shorten the %vector by one. + * + * Note This operation could be expensive and if it is + * frequently used the user should consider using std::list. + * The user is also cautioned that this function only erases + * the element, and that if the element is itself a pointer, + * the pointed-to memory is not touched in any way. Managing + * the pointer is the user's responsibility. + */ + iterator +#if __cplusplus >= 201103L + erase(const_iterator __position) + { return _M_erase(begin() + (__position - cbegin())); } +#else + erase(iterator __position) + { return _M_erase(__position); } +#endif + + /** + * @brief Remove a range of elements. + * @param __first Iterator pointing to the first element to be erased. + * @param __last Iterator pointing to one past the last element to be + * erased. + * @return An iterator pointing to the element pointed to by @a __last + * prior to erasing (or end()). + * + * This function will erase the elements in the range + * [__first,__last) and shorten the %vector accordingly. + * + * Note This operation could be expensive and if it is + * frequently used the user should consider using std::list. + * The user is also cautioned that this function only erases + * the elements, and that if the elements themselves are + * pointers, the pointed-to memory is not touched in any way. + * Managing the pointer is the user's responsibility. + */ + iterator +#if __cplusplus >= 201103L + erase(const_iterator __first, const_iterator __last) + { + const auto __beg = begin(); + const auto __cbeg = cbegin(); + return _M_erase(__beg + (__first - __cbeg), __beg + (__last - __cbeg)); + } +#else + erase(iterator __first, iterator __last) + { return _M_erase(__first, __last); } +#endif + + /** + * @brief Swaps data with another %vector. + * @param __x A %vector of the same element and allocator types. + * + * This exchanges the elements between two vectors in constant time. + * (Three pointers, so it should be quite fast.) + * Note that the global std::swap() function is specialized such that + * std::swap(v1,v2) will feed to this function. + * + * Whether the allocators are swapped depends on the allocator traits. + */ + void + swap(vector& __x) _GLIBCXX_NOEXCEPT + { +#if __cplusplus >= 201103L + __glibcxx_assert(_Alloc_traits::propagate_on_container_swap::value + || _M_get_Tp_allocator() == __x._M_get_Tp_allocator()); +#endif + this->_M_impl._M_swap_data(__x._M_impl); + _Alloc_traits::_S_on_swap(_M_get_Tp_allocator(), + __x._M_get_Tp_allocator()); + } + + /** + * Erases all the elements. Note that this function only erases the + * elements, and that if the elements themselves are pointers, the + * pointed-to memory is not touched in any way. Managing the pointer is + * the user's responsibility. + */ + void + clear() _GLIBCXX_NOEXCEPT + { _M_erase_at_end(this->_M_impl._M_start); } + + protected: + /** + * Memory expansion handler. Uses the member allocation function to + * obtain @a n bytes of memory, and then copies [first,last) into it. + */ + template + pointer + _M_allocate_and_copy(size_type __n, + _ForwardIterator __first, _ForwardIterator __last) + { + pointer __result = this->_M_allocate(__n); + __try + { + std::__uninitialized_copy_a(__first, __last, __result, + _M_get_Tp_allocator()); + return __result; + } + __catch(...) + { + _M_deallocate(__result, __n); + __throw_exception_again; + } + } + + + // Internal constructor functions follow. + + // Called by the range constructor to implement [23.1.1]/9 + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 438. Ambiguity in the "do the right thing" clause + template + void + _M_initialize_dispatch(_Integer __n, _Integer __value, __true_type) + { + this->_M_impl._M_start = _M_allocate(static_cast(__n)); + this->_M_impl._M_end_of_storage = + this->_M_impl._M_start + static_cast(__n); + _M_fill_initialize(static_cast(__n), __value); + } + + // Called by the range constructor to implement [23.1.1]/9 + template + void + _M_initialize_dispatch(_InputIterator __first, _InputIterator __last, + __false_type) + { + typedef typename std::iterator_traits<_InputIterator>:: + iterator_category _IterCategory; + _M_range_initialize(__first, __last, _IterCategory()); + } + + // Called by the second initialize_dispatch above + template + void + _M_range_initialize(_InputIterator __first, + _InputIterator __last, std::input_iterator_tag) + { + for (; __first != __last; ++__first) +#if __cplusplus >= 201103L + emplace_back(*__first); +#else + push_back(*__first); +#endif + } + + // Called by the second initialize_dispatch above + template + void + _M_range_initialize(_ForwardIterator __first, + _ForwardIterator __last, std::forward_iterator_tag) + { + const size_type __n = std::distance(__first, __last); + this->_M_impl._M_start = this->_M_allocate(__n); + this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n; + this->_M_impl._M_finish = + std::__uninitialized_copy_a(__first, __last, + this->_M_impl._M_start, + _M_get_Tp_allocator()); + } + + // Called by the first initialize_dispatch above and by the + // vector(n,value,a) constructor. + void + _M_fill_initialize(size_type __n, const value_type& __value) + { + this->_M_impl._M_finish = + std::__uninitialized_fill_n_a(this->_M_impl._M_start, __n, __value, + _M_get_Tp_allocator()); + } + +#if __cplusplus >= 201103L + // Called by the vector(n) constructor. + void + _M_default_initialize(size_type __n) + { + this->_M_impl._M_finish = + std::__uninitialized_default_n_a(this->_M_impl._M_start, __n, + _M_get_Tp_allocator()); + } +#endif + + // Internal assign functions follow. The *_aux functions do the actual + // assignment work for the range versions. + + // Called by the range assign to implement [23.1.1]/9 + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 438. Ambiguity in the "do the right thing" clause + template + void + _M_assign_dispatch(_Integer __n, _Integer __val, __true_type) + { _M_fill_assign(__n, __val); } + + // Called by the range assign to implement [23.1.1]/9 + template + void + _M_assign_dispatch(_InputIterator __first, _InputIterator __last, + __false_type) + { _M_assign_aux(__first, __last, std::__iterator_category(__first)); } + + // Called by the second assign_dispatch above + template + void + _M_assign_aux(_InputIterator __first, _InputIterator __last, + std::input_iterator_tag); + + // Called by the second assign_dispatch above + template + void + _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, + std::forward_iterator_tag); + + // Called by assign(n,t), and the range assign when it turns out + // to be the same thing. + void + _M_fill_assign(size_type __n, const value_type& __val); + + // Internal insert functions follow. + + // Called by the range insert to implement [23.1.1]/9 + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 438. Ambiguity in the "do the right thing" clause + template + void + _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val, + __true_type) + { _M_fill_insert(__pos, __n, __val); } + + // Called by the range insert to implement [23.1.1]/9 + template + void + _M_insert_dispatch(iterator __pos, _InputIterator __first, + _InputIterator __last, __false_type) + { + _M_range_insert(__pos, __first, __last, + std::__iterator_category(__first)); + } + + // Called by the second insert_dispatch above + template + void + _M_range_insert(iterator __pos, _InputIterator __first, + _InputIterator __last, std::input_iterator_tag); + + // Called by the second insert_dispatch above + template + void + _M_range_insert(iterator __pos, _ForwardIterator __first, + _ForwardIterator __last, std::forward_iterator_tag); + + // Called by insert(p,n,x), and the range insert when it turns out to be + // the same thing. + void + _M_fill_insert(iterator __pos, size_type __n, const value_type& __x); + +#if __cplusplus >= 201103L + // Called by resize(n). + void + _M_default_append(size_type __n); + + bool + _M_shrink_to_fit(); +#endif + +#if __cplusplus < 201103L + // Called by insert(p,x) + void + _M_insert_aux(iterator __position, const value_type& __x); + + void + _M_realloc_insert(iterator __position, const value_type& __x); +#else + // A value_type object constructed with _Alloc_traits::construct() + // and destroyed with _Alloc_traits::destroy(). + struct _Temporary_value + { + template + explicit + _Temporary_value(vector* __vec, _Args&&... __args) : _M_this(__vec) + { + _Alloc_traits::construct(_M_this->_M_impl, _M_ptr(), + std::forward<_Args>(__args)...); + } + + ~_Temporary_value() + { _Alloc_traits::destroy(_M_this->_M_impl, _M_ptr()); } + + value_type& + _M_val() { return *reinterpret_cast<_Tp*>(&__buf); } + + private: + pointer + _M_ptr() { return pointer_traits::pointer_to(_M_val()); } + + vector* _M_this; + typename aligned_storage::type __buf; + }; + + // Called by insert(p,x) and other functions when insertion needs to + // reallocate or move existing elements. _Arg is either _Tp& or _Tp. + template + void + _M_insert_aux(iterator __position, _Arg&& __arg); + + template + void + _M_realloc_insert(iterator __position, _Args&&... __args); + + // Either move-construct at the end, or forward to _M_insert_aux. + iterator + _M_insert_rval(const_iterator __position, value_type&& __v); + + // Try to emplace at the end, otherwise forward to _M_insert_aux. + template + iterator + _M_emplace_aux(const_iterator __position, _Args&&... __args); + + // Emplacing an rvalue of the correct type can use _M_insert_rval. + iterator + _M_emplace_aux(const_iterator __position, value_type&& __v) + { return _M_insert_rval(__position, std::move(__v)); } +#endif + + // Called by _M_fill_insert, _M_insert_aux etc. + size_type + _M_check_len(size_type __n, const char* __s) const + { + if (max_size() - size() < __n) + __throw_length_error(__N(__s)); + + const size_type __len = size() + std::max(size(), __n); + return (__len < size() || __len > max_size()) ? max_size() : __len; + } + + // Internal erase functions follow. + + // Called by erase(q1,q2), clear(), resize(), _M_fill_assign, + // _M_assign_aux. + void + _M_erase_at_end(pointer __pos) _GLIBCXX_NOEXCEPT + { + std::_Destroy(__pos, this->_M_impl._M_finish, _M_get_Tp_allocator()); + this->_M_impl._M_finish = __pos; + } + + iterator + _M_erase(iterator __position); + + iterator + _M_erase(iterator __first, iterator __last); + +#if __cplusplus >= 201103L + private: + // Constant-time move assignment when source object's memory can be + // moved, either because the source's allocator will move too + // or because the allocators are equal. + void + _M_move_assign(vector&& __x, std::true_type) noexcept + { + vector __tmp(get_allocator()); + this->_M_impl._M_swap_data(__tmp._M_impl); + this->_M_impl._M_swap_data(__x._M_impl); + std::__alloc_on_move(_M_get_Tp_allocator(), __x._M_get_Tp_allocator()); + } + + // Do move assignment when it might not be possible to move source + // object's memory, resulting in a linear-time operation. + void + _M_move_assign(vector&& __x, std::false_type) + { + if (__x._M_get_Tp_allocator() == this->_M_get_Tp_allocator()) + _M_move_assign(std::move(__x), std::true_type()); + else + { + // The rvalue's allocator cannot be moved and is not equal, + // so we need to individually move each element. + this->assign(std::__make_move_if_noexcept_iterator(__x.begin()), + std::__make_move_if_noexcept_iterator(__x.end())); + __x.clear(); + } + } +#endif + + template + _Up* + _M_data_ptr(_Up* __ptr) const _GLIBCXX_NOEXCEPT + { return __ptr; } + +#if __cplusplus >= 201103L + template + typename std::pointer_traits<_Ptr>::element_type* + _M_data_ptr(_Ptr __ptr) const + { return empty() ? nullptr : std::__addressof(*__ptr); } +#else + template + _Up* + _M_data_ptr(_Up* __ptr) _GLIBCXX_NOEXCEPT + { return __ptr; } + + template + value_type* + _M_data_ptr(_Ptr __ptr) + { return __ptr.operator->(); } + + template + const value_type* + _M_data_ptr(_Ptr __ptr) const + { return __ptr.operator->(); } +#endif + }; + + + /** + * @brief Vector equality comparison. + * @param __x A %vector. + * @param __y A %vector of the same type as @a __x. + * @return True iff the size and elements of the vectors are equal. + * + * This is an equivalence relation. It is linear in the size of the + * vectors. Vectors are considered equivalent if their sizes are equal, + * and if corresponding elements compare equal. + */ + template + inline bool + operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) + { return (__x.size() == __y.size() + && std::equal(__x.begin(), __x.end(), __y.begin())); } + + /** + * @brief Vector ordering relation. + * @param __x A %vector. + * @param __y A %vector of the same type as @a __x. + * @return True iff @a __x is lexicographically less than @a __y. + * + * This is a total ordering relation. It is linear in the size of the + * vectors. The elements must be comparable with @c <. + * + * See std::lexicographical_compare() for how the determination is made. + */ + template + inline bool + operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) + { return std::lexicographical_compare(__x.begin(), __x.end(), + __y.begin(), __y.end()); } + + /// Based on operator== + template + inline bool + operator!=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) + { return !(__x == __y); } + + /// Based on operator< + template + inline bool + operator>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) + { return __y < __x; } + + /// Based on operator< + template + inline bool + operator<=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) + { return !(__y < __x); } + + /// Based on operator< + template + inline bool + operator>=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) + { return !(__x < __y); } + + /// See std::vector::swap(). + template + inline void + swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y) + _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y))) + { __x.swap(__y); } + +_GLIBCXX_END_NAMESPACE_CONTAINER +} // namespace std + +#endif /* _STL_VECTOR_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stream_iterator.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stream_iterator.h new file mode 100644 index 0000000..552ed36 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stream_iterator.h @@ -0,0 +1,222 @@ +// Stream iterators + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/stream_iterator.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iterator} + */ + +#ifndef _STREAM_ITERATOR_H +#define _STREAM_ITERATOR_H 1 + +#pragma GCC system_header + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup iterators + * @{ + */ + + /// Provides input iterator semantics for streams. + template, typename _Dist = ptrdiff_t> + class istream_iterator + : public iterator + { + public: + typedef _CharT char_type; + typedef _Traits traits_type; + typedef basic_istream<_CharT, _Traits> istream_type; + + private: + istream_type* _M_stream; + _Tp _M_value; + bool _M_ok; + + public: + /// Construct end of input stream iterator. + _GLIBCXX_CONSTEXPR istream_iterator() + : _M_stream(0), _M_value(), _M_ok(false) {} + + /// Construct start of input stream iterator. + istream_iterator(istream_type& __s) + : _M_stream(std::__addressof(__s)) + { _M_read(); } + + istream_iterator(const istream_iterator& __obj) + : _M_stream(__obj._M_stream), _M_value(__obj._M_value), + _M_ok(__obj._M_ok) + { } + + const _Tp& + operator*() const + { + __glibcxx_requires_cond(_M_ok, + _M_message(__gnu_debug::__msg_deref_istream) + ._M_iterator(*this)); + return _M_value; + } + + const _Tp* + operator->() const { return std::__addressof((operator*())); } + + istream_iterator& + operator++() + { + __glibcxx_requires_cond(_M_ok, + _M_message(__gnu_debug::__msg_inc_istream) + ._M_iterator(*this)); + _M_read(); + return *this; + } + + istream_iterator + operator++(int) + { + __glibcxx_requires_cond(_M_ok, + _M_message(__gnu_debug::__msg_inc_istream) + ._M_iterator(*this)); + istream_iterator __tmp = *this; + _M_read(); + return __tmp; + } + + bool + _M_equal(const istream_iterator& __x) const + { return (_M_ok == __x._M_ok) && (!_M_ok || _M_stream == __x._M_stream); } + + private: + void + _M_read() + { + _M_ok = (_M_stream && *_M_stream) ? true : false; + if (_M_ok) + { + *_M_stream >> _M_value; + _M_ok = *_M_stream ? true : false; + } + } + }; + + /// Return true if x and y are both end or not end, or x and y are the same. + template + inline bool + operator==(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x, + const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y) + { return __x._M_equal(__y); } + + /// Return false if x and y are both end or not end, or x and y are the same. + template + inline bool + operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x, + const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y) + { return !__x._M_equal(__y); } + + /** + * @brief Provides output iterator semantics for streams. + * + * This class provides an iterator to write to an ostream. The type Tp is + * the only type written by this iterator and there must be an + * operator<<(Tp) defined. + * + * @tparam _Tp The type to write to the ostream. + * @tparam _CharT The ostream char_type. + * @tparam _Traits The ostream char_traits. + */ + template > + class ostream_iterator + : public iterator + { + public: + //@{ + /// Public typedef + typedef _CharT char_type; + typedef _Traits traits_type; + typedef basic_ostream<_CharT, _Traits> ostream_type; + //@} + + private: + ostream_type* _M_stream; + const _CharT* _M_string; + + public: + /// Construct from an ostream. + ostream_iterator(ostream_type& __s) + : _M_stream(std::__addressof(__s)), _M_string(0) {} + + /** + * Construct from an ostream. + * + * The delimiter string @a c is written to the stream after every Tp + * written to the stream. The delimiter is not copied, and thus must + * not be destroyed while this iterator is in use. + * + * @param __s Underlying ostream to write to. + * @param __c CharT delimiter string to insert. + */ + ostream_iterator(ostream_type& __s, const _CharT* __c) + : _M_stream(&__s), _M_string(__c) { } + + /// Copy constructor. + ostream_iterator(const ostream_iterator& __obj) + : _M_stream(__obj._M_stream), _M_string(__obj._M_string) { } + + /// Writes @a value to underlying ostream using operator<<. If + /// constructed with delimiter string, writes delimiter to ostream. + ostream_iterator& + operator=(const _Tp& __value) + { + __glibcxx_requires_cond(_M_stream != 0, + _M_message(__gnu_debug::__msg_output_ostream) + ._M_iterator(*this)); + *_M_stream << __value; + if (_M_string) *_M_stream << _M_string; + return *this; + } + + ostream_iterator& + operator*() + { return *this; } + + ostream_iterator& + operator++() + { return *this; } + + ostream_iterator& + operator++(int) + { return *this; } + }; + + // @} group iterators + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/streambuf_iterator.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/streambuf_iterator.h new file mode 100644 index 0000000..f0451b1 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/streambuf_iterator.h @@ -0,0 +1,412 @@ +// Streambuf iterators + +// Copyright (C) 1997-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/streambuf_iterator.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{iterator} + */ + +#ifndef _STREAMBUF_ITERATOR_H +#define _STREAMBUF_ITERATOR_H 1 + +#pragma GCC system_header + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup iterators + * @{ + */ + + // 24.5.3 Template class istreambuf_iterator + /// Provides input iterator semantics for streambufs. + template + class istreambuf_iterator + : public iterator= 201103L + // LWG 445. + _CharT> +#else + _CharT&> +#endif + { + public: + // Types: + //@{ + /// Public typedefs + typedef _CharT char_type; + typedef _Traits traits_type; + typedef typename _Traits::int_type int_type; + typedef basic_streambuf<_CharT, _Traits> streambuf_type; + typedef basic_istream<_CharT, _Traits> istream_type; + //@} + + template + friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, + ostreambuf_iterator<_CharT2> >::__type + copy(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, + ostreambuf_iterator<_CharT2>); + + template + friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, + _CharT2*>::__type + __copy_move_a2(istreambuf_iterator<_CharT2>, + istreambuf_iterator<_CharT2>, _CharT2*); + + template + friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, + istreambuf_iterator<_CharT2> >::__type + find(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, + const _CharT2&); + + private: + // 24.5.3 istreambuf_iterator + // p 1 + // If the end of stream is reached (streambuf_type::sgetc() + // returns traits_type::eof()), the iterator becomes equal to + // the "end of stream" iterator value. + // NB: This implementation assumes the "end of stream" value + // is EOF, or -1. + mutable streambuf_type* _M_sbuf; + mutable int_type _M_c; + + public: + /// Construct end of input stream iterator. + _GLIBCXX_CONSTEXPR istreambuf_iterator() _GLIBCXX_USE_NOEXCEPT + : _M_sbuf(0), _M_c(traits_type::eof()) { } + +#if __cplusplus >= 201103L + istreambuf_iterator(const istreambuf_iterator&) noexcept = default; + + ~istreambuf_iterator() = default; +#endif + + /// Construct start of input stream iterator. + istreambuf_iterator(istream_type& __s) _GLIBCXX_USE_NOEXCEPT + : _M_sbuf(__s.rdbuf()), _M_c(traits_type::eof()) { } + + /// Construct start of streambuf iterator. + istreambuf_iterator(streambuf_type* __s) _GLIBCXX_USE_NOEXCEPT + : _M_sbuf(__s), _M_c(traits_type::eof()) { } + + /// Return the current character pointed to by iterator. This returns + /// streambuf.sgetc(). It cannot be assigned. NB: The result of + /// operator*() on an end of stream is undefined. + char_type + operator*() const + { +#ifdef _GLIBCXX_DEBUG_PEDANTIC + // Dereferencing a past-the-end istreambuf_iterator is a + // libstdc++ extension + __glibcxx_requires_cond(!_M_at_eof(), + _M_message(__gnu_debug::__msg_deref_istreambuf) + ._M_iterator(*this)); +#endif + return traits_type::to_char_type(_M_get()); + } + + /// Advance the iterator. Calls streambuf.sbumpc(). + istreambuf_iterator& + operator++() + { + __glibcxx_requires_cond(!_M_at_eof(), + _M_message(__gnu_debug::__msg_inc_istreambuf) + ._M_iterator(*this)); + if (_M_sbuf) + { + _M_sbuf->sbumpc(); + _M_c = traits_type::eof(); + } + return *this; + } + + /// Advance the iterator. Calls streambuf.sbumpc(). + istreambuf_iterator + operator++(int) + { + __glibcxx_requires_cond(!_M_at_eof(), + _M_message(__gnu_debug::__msg_inc_istreambuf) + ._M_iterator(*this)); + + istreambuf_iterator __old = *this; + if (_M_sbuf) + { + __old._M_c = _M_sbuf->sbumpc(); + _M_c = traits_type::eof(); + } + return __old; + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 110 istreambuf_iterator::equal not const + // NB: there is also number 111 (NAD, Future) pending on this function. + /// Return true both iterators are end or both are not end. + bool + equal(const istreambuf_iterator& __b) const + { return _M_at_eof() == __b._M_at_eof(); } + + private: + int_type + _M_get() const + { + const int_type __eof = traits_type::eof(); + int_type __ret = __eof; + if (_M_sbuf) + { + if (!traits_type::eq_int_type(_M_c, __eof)) + __ret = _M_c; + else if (!traits_type::eq_int_type((__ret = _M_sbuf->sgetc()), + __eof)) + _M_c = __ret; + else + _M_sbuf = 0; + } + return __ret; + } + + bool + _M_at_eof() const + { + const int_type __eof = traits_type::eof(); + return traits_type::eq_int_type(_M_get(), __eof); + } + }; + + template + inline bool + operator==(const istreambuf_iterator<_CharT, _Traits>& __a, + const istreambuf_iterator<_CharT, _Traits>& __b) + { return __a.equal(__b); } + + template + inline bool + operator!=(const istreambuf_iterator<_CharT, _Traits>& __a, + const istreambuf_iterator<_CharT, _Traits>& __b) + { return !__a.equal(__b); } + + /// Provides output iterator semantics for streambufs. + template + class ostreambuf_iterator + : public iterator + { + public: + // Types: + //@{ + /// Public typedefs + typedef _CharT char_type; + typedef _Traits traits_type; + typedef basic_streambuf<_CharT, _Traits> streambuf_type; + typedef basic_ostream<_CharT, _Traits> ostream_type; + //@} + + template + friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, + ostreambuf_iterator<_CharT2> >::__type + copy(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>, + ostreambuf_iterator<_CharT2>); + + private: + streambuf_type* _M_sbuf; + bool _M_failed; + + public: + /// Construct output iterator from ostream. + ostreambuf_iterator(ostream_type& __s) _GLIBCXX_USE_NOEXCEPT + : _M_sbuf(__s.rdbuf()), _M_failed(!_M_sbuf) { } + + /// Construct output iterator from streambuf. + ostreambuf_iterator(streambuf_type* __s) _GLIBCXX_USE_NOEXCEPT + : _M_sbuf(__s), _M_failed(!_M_sbuf) { } + + /// Write character to streambuf. Calls streambuf.sputc(). + ostreambuf_iterator& + operator=(_CharT __c) + { + if (!_M_failed && + _Traits::eq_int_type(_M_sbuf->sputc(__c), _Traits::eof())) + _M_failed = true; + return *this; + } + + /// Return *this. + ostreambuf_iterator& + operator*() + { return *this; } + + /// Return *this. + ostreambuf_iterator& + operator++(int) + { return *this; } + + /// Return *this. + ostreambuf_iterator& + operator++() + { return *this; } + + /// Return true if previous operator=() failed. + bool + failed() const _GLIBCXX_USE_NOEXCEPT + { return _M_failed; } + + ostreambuf_iterator& + _M_put(const _CharT* __ws, streamsize __len) + { + if (__builtin_expect(!_M_failed, true) + && __builtin_expect(this->_M_sbuf->sputn(__ws, __len) != __len, + false)) + _M_failed = true; + return *this; + } + }; + + // Overloads for streambuf iterators. + template + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + ostreambuf_iterator<_CharT> >::__type + copy(istreambuf_iterator<_CharT> __first, + istreambuf_iterator<_CharT> __last, + ostreambuf_iterator<_CharT> __result) + { + if (__first._M_sbuf && !__last._M_sbuf && !__result._M_failed) + { + bool __ineof; + __copy_streambufs_eof(__first._M_sbuf, __result._M_sbuf, __ineof); + if (!__ineof) + __result._M_failed = true; + } + return __result; + } + + template + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + ostreambuf_iterator<_CharT> >::__type + __copy_move_a2(_CharT* __first, _CharT* __last, + ostreambuf_iterator<_CharT> __result) + { + const streamsize __num = __last - __first; + if (__num > 0) + __result._M_put(__first, __num); + return __result; + } + + template + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + ostreambuf_iterator<_CharT> >::__type + __copy_move_a2(const _CharT* __first, const _CharT* __last, + ostreambuf_iterator<_CharT> __result) + { + const streamsize __num = __last - __first; + if (__num > 0) + __result._M_put(__first, __num); + return __result; + } + + template + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + _CharT*>::__type + __copy_move_a2(istreambuf_iterator<_CharT> __first, + istreambuf_iterator<_CharT> __last, _CharT* __result) + { + typedef istreambuf_iterator<_CharT> __is_iterator_type; + typedef typename __is_iterator_type::traits_type traits_type; + typedef typename __is_iterator_type::streambuf_type streambuf_type; + typedef typename traits_type::int_type int_type; + + if (__first._M_sbuf && !__last._M_sbuf) + { + streambuf_type* __sb = __first._M_sbuf; + int_type __c = __sb->sgetc(); + while (!traits_type::eq_int_type(__c, traits_type::eof())) + { + const streamsize __n = __sb->egptr() - __sb->gptr(); + if (__n > 1) + { + traits_type::copy(__result, __sb->gptr(), __n); + __sb->__safe_gbump(__n); + __result += __n; + __c = __sb->underflow(); + } + else + { + *__result++ = traits_type::to_char_type(__c); + __c = __sb->snextc(); + } + } + } + return __result; + } + + template + typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, + istreambuf_iterator<_CharT> >::__type + find(istreambuf_iterator<_CharT> __first, + istreambuf_iterator<_CharT> __last, const _CharT& __val) + { + typedef istreambuf_iterator<_CharT> __is_iterator_type; + typedef typename __is_iterator_type::traits_type traits_type; + typedef typename __is_iterator_type::streambuf_type streambuf_type; + typedef typename traits_type::int_type int_type; + + if (__first._M_sbuf && !__last._M_sbuf) + { + const int_type __ival = traits_type::to_int_type(__val); + streambuf_type* __sb = __first._M_sbuf; + int_type __c = __sb->sgetc(); + while (!traits_type::eq_int_type(__c, traits_type::eof()) + && !traits_type::eq_int_type(__c, __ival)) + { + streamsize __n = __sb->egptr() - __sb->gptr(); + if (__n > 1) + { + const _CharT* __p = traits_type::find(__sb->gptr(), + __n, __val); + if (__p) + __n = __p - __sb->gptr(); + __sb->__safe_gbump(__n); + __c = __sb->sgetc(); + } + else + __c = __sb->snextc(); + } + + if (!traits_type::eq_int_type(__c, traits_type::eof())) + __first._M_c = __c; + else + __first._M_sbuf = 0; + } + return __first; + } + +// @} group iterators + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stringfwd.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stringfwd.h new file mode 100644 index 0000000..15db187 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/stringfwd.h @@ -0,0 +1,97 @@ +// Forward declarations -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/stringfwd.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{string} + */ + +// +// ISO C++ 14882: 21 Strings library +// + +#ifndef _STRINGFWD_H +#define _STRINGFWD_H 1 + +#pragma GCC system_header + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @defgroup strings Strings + * + * @{ + */ + + template + struct char_traits; + + template<> struct char_traits; + +#ifdef _GLIBCXX_USE_WCHAR_T + template<> struct char_traits; +#endif + +#if ((__cplusplus >= 201103L) \ + && defined(_GLIBCXX_USE_C99_STDINT_TR1)) + template<> struct char_traits; + template<> struct char_traits; +#endif + +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + template, + typename _Alloc = allocator<_CharT> > + class basic_string; + + /// A string of @c char + typedef basic_string string; + +#ifdef _GLIBCXX_USE_WCHAR_T + /// A string of @c wchar_t + typedef basic_string wstring; +#endif + +#if ((__cplusplus >= 201103L) \ + && defined(_GLIBCXX_USE_C99_STDINT_TR1)) + /// A string of @c char16_t + typedef basic_string u16string; + + /// A string of @c char32_t + typedef basic_string u32string; +#endif + +_GLIBCXX_END_NAMESPACE_CXX11 + + /** @} */ + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // _STRINGFWD_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/uniform_int_dist.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/uniform_int_dist.h new file mode 100644 index 0000000..af7ac14 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/uniform_int_dist.h @@ -0,0 +1,375 @@ +// Class template uniform_int_distribution -*- C++ -*- + +// Copyright (C) 2009-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** + * @file bits/uniform_int_dist.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{random} + */ + +#ifndef _GLIBCXX_BITS_UNIFORM_INT_DIST_H +#define _GLIBCXX_BITS_UNIFORM_INT_DIST_H + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ + + namespace __detail + { +_GLIBCXX_BEGIN_NAMESPACE_VERSION + /* Determine whether number is a power of 2. */ + template + inline bool + _Power_of_2(_Tp __x) + { + return ((__x - 1) & __x) == 0; + }; +_GLIBCXX_END_NAMESPACE_VERSION + } + +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @brief Uniform discrete distribution for random numbers. + * A discrete random distribution on the range @f$[min, max]@f$ with equal + * probability throughout the range. + */ + template + class uniform_int_distribution + { + static_assert(std::is_integral<_IntType>::value, + "template argument must be an integral type"); + + public: + /** The type of the range of the distribution. */ + typedef _IntType result_type; + /** Parameter type. */ + struct param_type + { + typedef uniform_int_distribution<_IntType> distribution_type; + + explicit + param_type(_IntType __a = 0, + _IntType __b = std::numeric_limits<_IntType>::max()) + : _M_a(__a), _M_b(__b) + { + __glibcxx_assert(_M_a <= _M_b); + } + + result_type + a() const + { return _M_a; } + + result_type + b() const + { return _M_b; } + + friend bool + operator==(const param_type& __p1, const param_type& __p2) + { return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; } + + friend bool + operator!=(const param_type& __p1, const param_type& __p2) + { return !(__p1 == __p2); } + + private: + _IntType _M_a; + _IntType _M_b; + }; + + public: + /** + * @brief Constructs a uniform distribution object. + */ + explicit + uniform_int_distribution(_IntType __a = 0, + _IntType __b = std::numeric_limits<_IntType>::max()) + : _M_param(__a, __b) + { } + + explicit + uniform_int_distribution(const param_type& __p) + : _M_param(__p) + { } + + /** + * @brief Resets the distribution state. + * + * Does nothing for the uniform integer distribution. + */ + void + reset() { } + + result_type + a() const + { return _M_param.a(); } + + result_type + b() const + { return _M_param.b(); } + + /** + * @brief Returns the parameter set of the distribution. + */ + param_type + param() const + { return _M_param; } + + /** + * @brief Sets the parameter set of the distribution. + * @param __param The new parameter set of the distribution. + */ + void + param(const param_type& __param) + { _M_param = __param; } + + /** + * @brief Returns the inclusive lower bound of the distribution range. + */ + result_type + min() const + { return this->a(); } + + /** + * @brief Returns the inclusive upper bound of the distribution range. + */ + result_type + max() const + { return this->b(); } + + /** + * @brief Generating functions. + */ + template + result_type + operator()(_UniformRandomNumberGenerator& __urng) + { return this->operator()(__urng, _M_param); } + + template + result_type + operator()(_UniformRandomNumberGenerator& __urng, + const param_type& __p); + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate(__f, __t, __urng, _M_param); } + + template + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + template + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + /** + * @brief Return true if two uniform integer distributions have + * the same parameters. + */ + friend bool + operator==(const uniform_int_distribution& __d1, + const uniform_int_distribution& __d2) + { return __d1._M_param == __d2._M_param; } + + private: + template + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p); + + param_type _M_param; + }; + + template + template + typename uniform_int_distribution<_IntType>::result_type + uniform_int_distribution<_IntType>:: + operator()(_UniformRandomNumberGenerator& __urng, + const param_type& __param) + { + typedef typename _UniformRandomNumberGenerator::result_type + _Gresult_type; + typedef typename std::make_unsigned::type __utype; + typedef typename std::common_type<_Gresult_type, __utype>::type + __uctype; + + const __uctype __urngmin = __urng.min(); + const __uctype __urngmax = __urng.max(); + const __uctype __urngrange = __urngmax - __urngmin; + const __uctype __urange + = __uctype(__param.b()) - __uctype(__param.a()); + + __uctype __ret; + + if (__urngrange > __urange) + { + // downscaling + const __uctype __uerange = __urange + 1; // __urange can be zero + const __uctype __scaling = __urngrange / __uerange; + const __uctype __past = __uerange * __scaling; + do + __ret = __uctype(__urng()) - __urngmin; + while (__ret >= __past); + __ret /= __scaling; + } + else if (__urngrange < __urange) + { + // upscaling + /* + Note that every value in [0, urange] + can be written uniquely as + + (urngrange + 1) * high + low + + where + + high in [0, urange / (urngrange + 1)] + + and + + low in [0, urngrange]. + */ + __uctype __tmp; // wraparound control + do + { + const __uctype __uerngrange = __urngrange + 1; + __tmp = (__uerngrange * operator() + (__urng, param_type(0, __urange / __uerngrange))); + __ret = __tmp + (__uctype(__urng()) - __urngmin); + } + while (__ret > __urange || __ret < __tmp); + } + else + __ret = __uctype(__urng()) - __urngmin; + + return __ret + __param.a(); + } + + + template + template + void + uniform_int_distribution<_IntType>:: + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __param) + { + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + typedef typename _UniformRandomNumberGenerator::result_type + _Gresult_type; + typedef typename std::make_unsigned::type __utype; + typedef typename std::common_type<_Gresult_type, __utype>::type + __uctype; + + const __uctype __urngmin = __urng.min(); + const __uctype __urngmax = __urng.max(); + const __uctype __urngrange = __urngmax - __urngmin; + const __uctype __urange + = __uctype(__param.b()) - __uctype(__param.a()); + + __uctype __ret; + + if (__urngrange > __urange) + { + if (__detail::_Power_of_2(__urngrange + 1) + && __detail::_Power_of_2(__urange + 1)) + { + while (__f != __t) + { + __ret = __uctype(__urng()) - __urngmin; + *__f++ = (__ret & __urange) + __param.a(); + } + } + else + { + // downscaling + const __uctype __uerange = __urange + 1; // __urange can be zero + const __uctype __scaling = __urngrange / __uerange; + const __uctype __past = __uerange * __scaling; + while (__f != __t) + { + do + __ret = __uctype(__urng()) - __urngmin; + while (__ret >= __past); + *__f++ = __ret / __scaling + __param.a(); + } + } + } + else if (__urngrange < __urange) + { + // upscaling + /* + Note that every value in [0, urange] + can be written uniquely as + + (urngrange + 1) * high + low + + where + + high in [0, urange / (urngrange + 1)] + + and + + low in [0, urngrange]. + */ + __uctype __tmp; // wraparound control + while (__f != __t) + { + do + { + const __uctype __uerngrange = __urngrange + 1; + __tmp = (__uerngrange * operator() + (__urng, param_type(0, __urange / __uerngrange))); + __ret = __tmp + (__uctype(__urng()) - __urngmin); + } + while (__ret > __urange || __ret < __tmp); + *__f++ = __ret; + } + } + else + while (__f != __t) + *__f++ = __uctype(__urng()) - __urngmin + __param.a(); + } + + // operator!= and operator<< and operator>> are defined in + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/unique_ptr.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/unique_ptr.h new file mode 100644 index 0000000..a31cd67 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/unique_ptr.h @@ -0,0 +1,844 @@ +// unique_ptr implementation -*- C++ -*- + +// Copyright (C) 2008-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/unique_ptr.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory} + */ + +#ifndef _UNIQUE_PTR_H +#define _UNIQUE_PTR_H 1 + +#include +#include +#include +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @addtogroup pointer_abstractions + * @{ + */ + +#if _GLIBCXX_USE_DEPRECATED + template class auto_ptr; +#endif + + /// Primary template of default_delete, used by unique_ptr + template + struct default_delete + { + /// Default constructor + constexpr default_delete() noexcept = default; + + /** @brief Converting constructor. + * + * Allows conversion from a deleter for arrays of another type, @p _Up, + * only if @p _Up* is convertible to @p _Tp*. + */ + template::value>::type> + default_delete(const default_delete<_Up>&) noexcept { } + + /// Calls @c delete @p __ptr + void + operator()(_Tp* __ptr) const + { + static_assert(!is_void<_Tp>::value, + "can't delete pointer to incomplete type"); + static_assert(sizeof(_Tp)>0, + "can't delete pointer to incomplete type"); + delete __ptr; + } + }; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 740 - omit specialization for array objects with a compile time length + /// Specialization for arrays, default_delete. + template + struct default_delete<_Tp[]> + { + public: + /// Default constructor + constexpr default_delete() noexcept = default; + + /** @brief Converting constructor. + * + * Allows conversion from a deleter for arrays of another type, such as + * a const-qualified version of @p _Tp. + * + * Conversions from types derived from @c _Tp are not allowed because + * it is unsafe to @c delete[] an array of derived types through a + * pointer to the base type. + */ + template::value>::type> + default_delete(const default_delete<_Up[]>&) noexcept { } + + /// Calls @c delete[] @p __ptr + template + typename enable_if::value>::type + operator()(_Up* __ptr) const + { + static_assert(sizeof(_Tp)>0, + "can't delete pointer to incomplete type"); + delete [] __ptr; + } + }; + + template + class __uniq_ptr_impl + { + template + struct _Ptr + { + using type = _Up*; + }; + + template + struct + _Ptr<_Up, _Ep, __void_t::type::pointer>> + { + using type = typename remove_reference<_Ep>::type::pointer; + }; + + public: + using _DeleterConstraint = enable_if< + __and_<__not_>, + is_default_constructible<_Dp>>::value>; + + using pointer = typename _Ptr<_Tp, _Dp>::type; + + __uniq_ptr_impl() = default; + __uniq_ptr_impl(pointer __p) : _M_t() { _M_ptr() = __p; } + + template + __uniq_ptr_impl(pointer __p, _Del&& __d) + : _M_t(__p, std::forward<_Del>(__d)) { } + + pointer& _M_ptr() { return std::get<0>(_M_t); } + pointer _M_ptr() const { return std::get<0>(_M_t); } + _Dp& _M_deleter() { return std::get<1>(_M_t); } + const _Dp& _M_deleter() const { return std::get<1>(_M_t); } + + private: + tuple _M_t; + }; + + /// 20.7.1.2 unique_ptr for single objects. + template > + class unique_ptr + { + template + using _DeleterConstraint = + typename __uniq_ptr_impl<_Tp, _Up>::_DeleterConstraint::type; + + __uniq_ptr_impl<_Tp, _Dp> _M_t; + + public: + using pointer = typename __uniq_ptr_impl<_Tp, _Dp>::pointer; + using element_type = _Tp; + using deleter_type = _Dp; + + // helper template for detecting a safe conversion from another + // unique_ptr + template + using __safe_conversion_up = __and_< + is_convertible::pointer, pointer>, + __not_>, + __or_<__and_, + is_same>, + __and_<__not_>, + is_convertible<_Ep, deleter_type>> + > + >; + + // Constructors. + + /// Default constructor, creates a unique_ptr that owns nothing. + template > + constexpr unique_ptr() noexcept + : _M_t() + { } + + /** Takes ownership of a pointer. + * + * @param __p A pointer to an object of @c element_type + * + * The deleter will be value-initialized. + */ + template > + explicit + unique_ptr(pointer __p) noexcept + : _M_t(__p) + { } + + /** Takes ownership of a pointer. + * + * @param __p A pointer to an object of @c element_type + * @param __d A reference to a deleter. + * + * The deleter will be initialized with @p __d + */ + unique_ptr(pointer __p, + typename conditional::value, + deleter_type, const deleter_type&>::type __d) noexcept + : _M_t(__p, __d) { } + + /** Takes ownership of a pointer. + * + * @param __p A pointer to an object of @c element_type + * @param __d An rvalue reference to a deleter. + * + * The deleter will be initialized with @p std::move(__d) + */ + unique_ptr(pointer __p, + typename remove_reference::type&& __d) noexcept + : _M_t(std::move(__p), std::move(__d)) + { static_assert(!std::is_reference::value, + "rvalue deleter bound to reference"); } + + /// Creates a unique_ptr that owns nothing. + template > + constexpr unique_ptr(nullptr_t) noexcept : unique_ptr() { } + + // Move constructors. + + /// Move constructor. + unique_ptr(unique_ptr&& __u) noexcept + : _M_t(__u.release(), std::forward(__u.get_deleter())) { } + + /** @brief Converting constructor from another type + * + * Requires that the pointer owned by @p __u is convertible to the + * type of pointer owned by this object, @p __u does not own an array, + * and @p __u has a compatible deleter type. + */ + template, + typename conditional::value, + is_same<_Ep, _Dp>, + is_convertible<_Ep, _Dp>>::type>> + unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept + : _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter())) + { } + +#if _GLIBCXX_USE_DEPRECATED + /// Converting constructor from @c auto_ptr + template, is_same<_Dp, default_delete<_Tp>>>> + unique_ptr(auto_ptr<_Up>&& __u) noexcept; +#endif + + /// Destructor, invokes the deleter if the stored pointer is not null. + ~unique_ptr() noexcept + { + auto& __ptr = _M_t._M_ptr(); + if (__ptr != nullptr) + get_deleter()(__ptr); + __ptr = pointer(); + } + + // Assignment. + + /** @brief Move assignment operator. + * + * @param __u The object to transfer ownership from. + * + * Invokes the deleter first if this object owns a pointer. + */ + unique_ptr& + operator=(unique_ptr&& __u) noexcept + { + reset(__u.release()); + get_deleter() = std::forward(__u.get_deleter()); + return *this; + } + + /** @brief Assignment from another type. + * + * @param __u The object to transfer ownership from, which owns a + * convertible pointer to a non-array object. + * + * Invokes the deleter first if this object owns a pointer. + */ + template + typename enable_if< __and_< + __safe_conversion_up<_Up, _Ep>, + is_assignable + >::value, + unique_ptr&>::type + operator=(unique_ptr<_Up, _Ep>&& __u) noexcept + { + reset(__u.release()); + get_deleter() = std::forward<_Ep>(__u.get_deleter()); + return *this; + } + + /// Reset the %unique_ptr to empty, invoking the deleter if necessary. + unique_ptr& + operator=(nullptr_t) noexcept + { + reset(); + return *this; + } + + // Observers. + + /// Dereference the stored pointer. + typename add_lvalue_reference::type + operator*() const + { + __glibcxx_assert(get() != pointer()); + return *get(); + } + + /// Return the stored pointer. + pointer + operator->() const noexcept + { + _GLIBCXX_DEBUG_PEDASSERT(get() != pointer()); + return get(); + } + + /// Return the stored pointer. + pointer + get() const noexcept + { return _M_t._M_ptr(); } + + /// Return a reference to the stored deleter. + deleter_type& + get_deleter() noexcept + { return _M_t._M_deleter(); } + + /// Return a reference to the stored deleter. + const deleter_type& + get_deleter() const noexcept + { return _M_t._M_deleter(); } + + /// Return @c true if the stored pointer is not null. + explicit operator bool() const noexcept + { return get() == pointer() ? false : true; } + + // Modifiers. + + /// Release ownership of any stored pointer. + pointer + release() noexcept + { + pointer __p = get(); + _M_t._M_ptr() = pointer(); + return __p; + } + + /** @brief Replace the stored pointer. + * + * @param __p The new pointer to store. + * + * The deleter will be invoked if a pointer is already owned. + */ + void + reset(pointer __p = pointer()) noexcept + { + using std::swap; + swap(_M_t._M_ptr(), __p); + if (__p != pointer()) + get_deleter()(__p); + } + + /// Exchange the pointer and deleter with another object. + void + swap(unique_ptr& __u) noexcept + { + using std::swap; + swap(_M_t, __u._M_t); + } + + // Disable copy from lvalue. + unique_ptr(const unique_ptr&) = delete; + unique_ptr& operator=(const unique_ptr&) = delete; + }; + + /// 20.7.1.3 unique_ptr for array objects with a runtime length + // [unique.ptr.runtime] + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 740 - omit specialization for array objects with a compile time length + template + class unique_ptr<_Tp[], _Dp> + { + template + using _DeleterConstraint = + typename __uniq_ptr_impl<_Tp, _Up>::_DeleterConstraint::type; + + __uniq_ptr_impl<_Tp, _Dp> _M_t; + + template + using __remove_cv = typename remove_cv<_Up>::type; + + // like is_base_of<_Tp, _Up> but false if unqualified types are the same + template + using __is_derived_Tp + = __and_< is_base_of<_Tp, _Up>, + __not_, __remove_cv<_Up>>> >; + + public: + using pointer = typename __uniq_ptr_impl<_Tp, _Dp>::pointer; + using element_type = _Tp; + using deleter_type = _Dp; + + // helper template for detecting a safe conversion from another + // unique_ptr + template, + typename _Up_element_type = typename _Up_up::element_type> + using __safe_conversion_up = __and_< + is_array<_Up>, + is_same, + is_same, + is_convertible<_Up_element_type(*)[], element_type(*)[]>, + __or_<__and_, is_same>, + __and_<__not_>, + is_convertible<_Ep, deleter_type>>> + >; + + // helper template for detecting a safe conversion from a raw pointer + template + using __safe_conversion_raw = __and_< + __or_<__or_, + is_same<_Up, nullptr_t>>, + __and_, + is_same, + is_convertible< + typename remove_pointer<_Up>::type(*)[], + element_type(*)[]> + > + > + >; + + // Constructors. + + /// Default constructor, creates a unique_ptr that owns nothing. + template > + constexpr unique_ptr() noexcept + : _M_t() + { } + + /** Takes ownership of a pointer. + * + * @param __p A pointer to an array of a type safely convertible + * to an array of @c element_type + * + * The deleter will be value-initialized. + */ + template, + typename = typename enable_if< + __safe_conversion_raw<_Up>::value, bool>::type> + explicit + unique_ptr(_Up __p) noexcept + : _M_t(__p) + { } + + /** Takes ownership of a pointer. + * + * @param __p A pointer to an array of a type safely convertible + * to an array of @c element_type + * @param __d A reference to a deleter. + * + * The deleter will be initialized with @p __d + */ + template::value, bool>::type> + unique_ptr(_Up __p, + typename conditional::value, + deleter_type, const deleter_type&>::type __d) noexcept + : _M_t(__p, __d) { } + + /** Takes ownership of a pointer. + * + * @param __p A pointer to an array of a type safely convertible + * to an array of @c element_type + * @param __d A reference to a deleter. + * + * The deleter will be initialized with @p std::move(__d) + */ + template::value, bool>::type> + unique_ptr(_Up __p, typename + remove_reference::type&& __d) noexcept + : _M_t(std::move(__p), std::move(__d)) + { static_assert(!is_reference::value, + "rvalue deleter bound to reference"); } + + /// Move constructor. + unique_ptr(unique_ptr&& __u) noexcept + : _M_t(__u.release(), std::forward(__u.get_deleter())) { } + + /// Creates a unique_ptr that owns nothing. + template > + constexpr unique_ptr(nullptr_t) noexcept : unique_ptr() { } + + template>> + unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept + : _M_t(__u.release(), std::forward<_Ep>(__u.get_deleter())) + { } + + /// Destructor, invokes the deleter if the stored pointer is not null. + ~unique_ptr() + { + auto& __ptr = _M_t._M_ptr(); + if (__ptr != nullptr) + get_deleter()(__ptr); + __ptr = pointer(); + } + + // Assignment. + + /** @brief Move assignment operator. + * + * @param __u The object to transfer ownership from. + * + * Invokes the deleter first if this object owns a pointer. + */ + unique_ptr& + operator=(unique_ptr&& __u) noexcept + { + reset(__u.release()); + get_deleter() = std::forward(__u.get_deleter()); + return *this; + } + + /** @brief Assignment from another type. + * + * @param __u The object to transfer ownership from, which owns a + * convertible pointer to an array object. + * + * Invokes the deleter first if this object owns a pointer. + */ + template + typename + enable_if<__and_<__safe_conversion_up<_Up, _Ep>, + is_assignable + >::value, + unique_ptr&>::type + operator=(unique_ptr<_Up, _Ep>&& __u) noexcept + { + reset(__u.release()); + get_deleter() = std::forward<_Ep>(__u.get_deleter()); + return *this; + } + + /// Reset the %unique_ptr to empty, invoking the deleter if necessary. + unique_ptr& + operator=(nullptr_t) noexcept + { + reset(); + return *this; + } + + // Observers. + + /// Access an element of owned array. + typename std::add_lvalue_reference::type + operator[](size_t __i) const + { + __glibcxx_assert(get() != pointer()); + return get()[__i]; + } + + /// Return the stored pointer. + pointer + get() const noexcept + { return _M_t._M_ptr(); } + + /// Return a reference to the stored deleter. + deleter_type& + get_deleter() noexcept + { return _M_t._M_deleter(); } + + /// Return a reference to the stored deleter. + const deleter_type& + get_deleter() const noexcept + { return _M_t._M_deleter(); } + + /// Return @c true if the stored pointer is not null. + explicit operator bool() const noexcept + { return get() == pointer() ? false : true; } + + // Modifiers. + + /// Release ownership of any stored pointer. + pointer + release() noexcept + { + pointer __p = get(); + _M_t._M_ptr() = pointer(); + return __p; + } + + /** @brief Replace the stored pointer. + * + * @param __p The new pointer to store. + * + * The deleter will be invoked if a pointer is already owned. + */ + template , + __and_, + is_pointer<_Up>, + is_convertible< + typename remove_pointer<_Up>::type(*)[], + element_type(*)[] + > + > + > + >> + void + reset(_Up __p) noexcept + { + pointer __ptr = __p; + using std::swap; + swap(_M_t._M_ptr(), __ptr); + if (__ptr != nullptr) + get_deleter()(__ptr); + } + + void reset(nullptr_t = nullptr) noexcept + { + reset(pointer()); + } + + /// Exchange the pointer and deleter with another object. + void + swap(unique_ptr& __u) noexcept + { + using std::swap; + swap(_M_t, __u._M_t); + } + + // Disable copy from lvalue. + unique_ptr(const unique_ptr&) = delete; + unique_ptr& operator=(const unique_ptr&) = delete; + }; + + template + inline +#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 + // Constrained free swap overload, see p0185r1 + typename enable_if<__is_swappable<_Dp>::value>::type +#else + void +#endif + swap(unique_ptr<_Tp, _Dp>& __x, + unique_ptr<_Tp, _Dp>& __y) noexcept + { __x.swap(__y); } + +#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 + template + typename enable_if::value>::type + swap(unique_ptr<_Tp, _Dp>&, + unique_ptr<_Tp, _Dp>&) = delete; +#endif + + template + inline bool + operator==(const unique_ptr<_Tp, _Dp>& __x, + const unique_ptr<_Up, _Ep>& __y) + { return __x.get() == __y.get(); } + + template + inline bool + operator==(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) noexcept + { return !__x; } + + template + inline bool + operator==(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) noexcept + { return !__x; } + + template + inline bool + operator!=(const unique_ptr<_Tp, _Dp>& __x, + const unique_ptr<_Up, _Ep>& __y) + { return __x.get() != __y.get(); } + + template + inline bool + operator!=(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) noexcept + { return (bool)__x; } + + template + inline bool + operator!=(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) noexcept + { return (bool)__x; } + + template + inline bool + operator<(const unique_ptr<_Tp, _Dp>& __x, + const unique_ptr<_Up, _Ep>& __y) + { + typedef typename + std::common_type::pointer, + typename unique_ptr<_Up, _Ep>::pointer>::type _CT; + return std::less<_CT>()(__x.get(), __y.get()); + } + + template + inline bool + operator<(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) + { return std::less::pointer>()(__x.get(), + nullptr); } + + template + inline bool + operator<(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) + { return std::less::pointer>()(nullptr, + __x.get()); } + + template + inline bool + operator<=(const unique_ptr<_Tp, _Dp>& __x, + const unique_ptr<_Up, _Ep>& __y) + { return !(__y < __x); } + + template + inline bool + operator<=(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) + { return !(nullptr < __x); } + + template + inline bool + operator<=(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) + { return !(__x < nullptr); } + + template + inline bool + operator>(const unique_ptr<_Tp, _Dp>& __x, + const unique_ptr<_Up, _Ep>& __y) + { return (__y < __x); } + + template + inline bool + operator>(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) + { return std::less::pointer>()(nullptr, + __x.get()); } + + template + inline bool + operator>(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) + { return std::less::pointer>()(__x.get(), + nullptr); } + + template + inline bool + operator>=(const unique_ptr<_Tp, _Dp>& __x, + const unique_ptr<_Up, _Ep>& __y) + { return !(__x < __y); } + + template + inline bool + operator>=(const unique_ptr<_Tp, _Dp>& __x, nullptr_t) + { return !(__x < nullptr); } + + template + inline bool + operator>=(nullptr_t, const unique_ptr<_Tp, _Dp>& __x) + { return !(nullptr < __x); } + + /// std::hash specialization for unique_ptr. + template + struct hash> + : public __hash_base>, + private __poison_hash::pointer> + { + size_t + operator()(const unique_ptr<_Tp, _Dp>& __u) const noexcept + { + typedef unique_ptr<_Tp, _Dp> _UP; + return std::hash()(__u.get()); + } + }; + +#if __cplusplus > 201103L + +#define __cpp_lib_make_unique 201304 + + template + struct _MakeUniq + { typedef unique_ptr<_Tp> __single_object; }; + + template + struct _MakeUniq<_Tp[]> + { typedef unique_ptr<_Tp[]> __array; }; + + template + struct _MakeUniq<_Tp[_Bound]> + { struct __invalid_type { }; }; + + /// std::make_unique for single objects + template + inline typename _MakeUniq<_Tp>::__single_object + make_unique(_Args&&... __args) + { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); } + + /// std::make_unique for arrays of unknown bound + template + inline typename _MakeUniq<_Tp>::__array + make_unique(size_t __num) + { return unique_ptr<_Tp>(new remove_extent_t<_Tp>[__num]()); } + + /// Disable std::make_unique for arrays of known bound + template + inline typename _MakeUniq<_Tp>::__invalid_type + make_unique(_Args&&...) = delete; +#endif + + // @} group pointer_abstractions + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _UNIQUE_PTR_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/unordered_map.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/unordered_map.h new file mode 100644 index 0000000..dd881d4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/unordered_map.h @@ -0,0 +1,1989 @@ +// unordered_map implementation -*- C++ -*- + +// Copyright (C) 2010-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/unordered_map.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{unordered_map} + */ + +#ifndef _UNORDERED_MAP_H +#define _UNORDERED_MAP_H + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_CONTAINER + + /// Base types for unordered_map. + template + using __umap_traits = __detail::_Hashtable_traits<_Cache, false, true>; + + template, + typename _Pred = std::equal_to<_Key>, + typename _Alloc = std::allocator >, + typename _Tr = __umap_traits<__cache_default<_Key, _Hash>::value>> + using __umap_hashtable = _Hashtable<_Key, std::pair, + _Alloc, __detail::_Select1st, + _Pred, _Hash, + __detail::_Mod_range_hashing, + __detail::_Default_ranged_hash, + __detail::_Prime_rehash_policy, _Tr>; + + /// Base types for unordered_multimap. + template + using __ummap_traits = __detail::_Hashtable_traits<_Cache, false, false>; + + template, + typename _Pred = std::equal_to<_Key>, + typename _Alloc = std::allocator >, + typename _Tr = __ummap_traits<__cache_default<_Key, _Hash>::value>> + using __ummap_hashtable = _Hashtable<_Key, std::pair, + _Alloc, __detail::_Select1st, + _Pred, _Hash, + __detail::_Mod_range_hashing, + __detail::_Default_ranged_hash, + __detail::_Prime_rehash_policy, _Tr>; + + template + class unordered_multimap; + + /** + * @brief A standard container composed of unique keys (containing + * at most one of each key value) that associates values of another type + * with the keys. + * + * @ingroup unordered_associative_containers + * + * @tparam _Key Type of key objects. + * @tparam _Tp Type of mapped objects. + * @tparam _Hash Hashing function object type, defaults to hash<_Value>. + * @tparam _Pred Predicate function object type, defaults + * to equal_to<_Value>. + * @tparam _Alloc Allocator type, defaults to + * std::allocator>. + * + * Meets the requirements of a container, and + * unordered associative container + * + * The resulting value type of the container is std::pair. + * + * Base is _Hashtable, dispatched at compile time via template + * alias __umap_hashtable. + */ + template, + class _Pred = std::equal_to<_Key>, + class _Alloc = std::allocator > > + class unordered_map + { + typedef __umap_hashtable<_Key, _Tp, _Hash, _Pred, _Alloc> _Hashtable; + _Hashtable _M_h; + + public: + // typedefs: + //@{ + /// Public typedefs. + typedef typename _Hashtable::key_type key_type; + typedef typename _Hashtable::value_type value_type; + typedef typename _Hashtable::mapped_type mapped_type; + typedef typename _Hashtable::hasher hasher; + typedef typename _Hashtable::key_equal key_equal; + typedef typename _Hashtable::allocator_type allocator_type; + //@} + + //@{ + /// Iterator-related typedefs. + typedef typename _Hashtable::pointer pointer; + typedef typename _Hashtable::const_pointer const_pointer; + typedef typename _Hashtable::reference reference; + typedef typename _Hashtable::const_reference const_reference; + typedef typename _Hashtable::iterator iterator; + typedef typename _Hashtable::const_iterator const_iterator; + typedef typename _Hashtable::local_iterator local_iterator; + typedef typename _Hashtable::const_local_iterator const_local_iterator; + typedef typename _Hashtable::size_type size_type; + typedef typename _Hashtable::difference_type difference_type; + //@} + +#if __cplusplus > 201402L + using node_type = typename _Hashtable::node_type; + using insert_return_type = typename _Hashtable::insert_return_type; +#endif + + //construct/destroy/copy + + /// Default constructor. + unordered_map() = default; + + /** + * @brief Default constructor creates no elements. + * @param __n Minimal initial number of buckets. + * @param __hf A hash functor. + * @param __eql A key equality functor. + * @param __a An allocator object. + */ + explicit + unordered_map(size_type __n, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_h(__n, __hf, __eql, __a) + { } + + /** + * @brief Builds an %unordered_map from a range. + * @param __first An input iterator. + * @param __last An input iterator. + * @param __n Minimal initial number of buckets. + * @param __hf A hash functor. + * @param __eql A key equality functor. + * @param __a An allocator object. + * + * Create an %unordered_map consisting of copies of the elements from + * [__first,__last). This is linear in N (where N is + * distance(__first,__last)). + */ + template + unordered_map(_InputIterator __first, _InputIterator __last, + size_type __n = 0, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_h(__first, __last, __n, __hf, __eql, __a) + { } + + /// Copy constructor. + unordered_map(const unordered_map&) = default; + + /// Move constructor. + unordered_map(unordered_map&&) = default; + + /** + * @brief Creates an %unordered_map with no elements. + * @param __a An allocator object. + */ + explicit + unordered_map(const allocator_type& __a) + : _M_h(__a) + { } + + /* + * @brief Copy constructor with allocator argument. + * @param __uset Input %unordered_map to copy. + * @param __a An allocator object. + */ + unordered_map(const unordered_map& __umap, + const allocator_type& __a) + : _M_h(__umap._M_h, __a) + { } + + /* + * @brief Move constructor with allocator argument. + * @param __uset Input %unordered_map to move. + * @param __a An allocator object. + */ + unordered_map(unordered_map&& __umap, + const allocator_type& __a) + : _M_h(std::move(__umap._M_h), __a) + { } + + /** + * @brief Builds an %unordered_map from an initializer_list. + * @param __l An initializer_list. + * @param __n Minimal initial number of buckets. + * @param __hf A hash functor. + * @param __eql A key equality functor. + * @param __a An allocator object. + * + * Create an %unordered_map consisting of copies of the elements in the + * list. This is linear in N (where N is @a __l.size()). + */ + unordered_map(initializer_list __l, + size_type __n = 0, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_h(__l, __n, __hf, __eql, __a) + { } + + unordered_map(size_type __n, const allocator_type& __a) + : unordered_map(__n, hasher(), key_equal(), __a) + { } + + unordered_map(size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_map(__n, __hf, key_equal(), __a) + { } + + template + unordered_map(_InputIterator __first, _InputIterator __last, + size_type __n, + const allocator_type& __a) + : unordered_map(__first, __last, __n, hasher(), key_equal(), __a) + { } + + template + unordered_map(_InputIterator __first, _InputIterator __last, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_map(__first, __last, __n, __hf, key_equal(), __a) + { } + + unordered_map(initializer_list __l, + size_type __n, + const allocator_type& __a) + : unordered_map(__l, __n, hasher(), key_equal(), __a) + { } + + unordered_map(initializer_list __l, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_map(__l, __n, __hf, key_equal(), __a) + { } + + /// Copy assignment operator. + unordered_map& + operator=(const unordered_map&) = default; + + /// Move assignment operator. + unordered_map& + operator=(unordered_map&&) = default; + + /** + * @brief %Unordered_map list assignment operator. + * @param __l An initializer_list. + * + * This function fills an %unordered_map with copies of the elements in + * the initializer list @a __l. + * + * Note that the assignment completely changes the %unordered_map and + * that the resulting %unordered_map's size is the same as the number + * of elements assigned. + */ + unordered_map& + operator=(initializer_list __l) + { + _M_h = __l; + return *this; + } + + /// Returns the allocator object used by the %unordered_map. + allocator_type + get_allocator() const noexcept + { return _M_h.get_allocator(); } + + // size and capacity: + + /// Returns true if the %unordered_map is empty. + bool + empty() const noexcept + { return _M_h.empty(); } + + /// Returns the size of the %unordered_map. + size_type + size() const noexcept + { return _M_h.size(); } + + /// Returns the maximum size of the %unordered_map. + size_type + max_size() const noexcept + { return _M_h.max_size(); } + + // iterators. + + /** + * Returns a read/write iterator that points to the first element in the + * %unordered_map. + */ + iterator + begin() noexcept + { return _M_h.begin(); } + + //@{ + /** + * Returns a read-only (constant) iterator that points to the first + * element in the %unordered_map. + */ + const_iterator + begin() const noexcept + { return _M_h.begin(); } + + const_iterator + cbegin() const noexcept + { return _M_h.begin(); } + //@} + + /** + * Returns a read/write iterator that points one past the last element in + * the %unordered_map. + */ + iterator + end() noexcept + { return _M_h.end(); } + + //@{ + /** + * Returns a read-only (constant) iterator that points one past the last + * element in the %unordered_map. + */ + const_iterator + end() const noexcept + { return _M_h.end(); } + + const_iterator + cend() const noexcept + { return _M_h.end(); } + //@} + + // modifiers. + + /** + * @brief Attempts to build and insert a std::pair into the + * %unordered_map. + * + * @param __args Arguments used to generate a new pair instance (see + * std::piecewise_contruct for passing arguments to each + * part of the pair constructor). + * + * @return A pair, of which the first element is an iterator that points + * to the possibly inserted pair, and the second is a bool that + * is true if the pair was actually inserted. + * + * This function attempts to build and insert a (key, value) %pair into + * the %unordered_map. + * An %unordered_map relies on unique keys and thus a %pair is only + * inserted if its first element (the key) is not already present in the + * %unordered_map. + * + * Insertion requires amortized constant time. + */ + template + std::pair + emplace(_Args&&... __args) + { return _M_h.emplace(std::forward<_Args>(__args)...); } + + /** + * @brief Attempts to build and insert a std::pair into the + * %unordered_map. + * + * @param __pos An iterator that serves as a hint as to where the pair + * should be inserted. + * @param __args Arguments used to generate a new pair instance (see + * std::piecewise_contruct for passing arguments to each + * part of the pair constructor). + * @return An iterator that points to the element with key of the + * std::pair built from @a __args (may or may not be that + * std::pair). + * + * This function is not concerned about whether the insertion took place, + * and thus does not return a boolean like the single-argument emplace() + * does. + * Note that the first parameter is only a hint and can potentially + * improve the performance of the insertion process. A bad hint would + * cause no gains in efficiency. + * + * See + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints + * for more on @a hinting. + * + * Insertion requires amortized constant time. + */ + template + iterator + emplace_hint(const_iterator __pos, _Args&&... __args) + { return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); } + +#if __cplusplus > 201402L + /// Extract a node. + node_type + extract(const_iterator __pos) + { + __glibcxx_assert(__pos != end()); + return _M_h.extract(__pos); + } + + /// Extract a node. + node_type + extract(const key_type& __key) + { return _M_h.extract(__key); } + + /// Re-insert an extracted node. + insert_return_type + insert(node_type&& __nh) + { return _M_h._M_reinsert_node(std::move(__nh)); } + + /// Re-insert an extracted node. + iterator + insert(const_iterator, node_type&& __nh) + { return _M_h._M_reinsert_node(std::move(__nh)).position; } + +#define __cpp_lib_unordered_map_try_emplace 201411 + /** + * @brief Attempts to build and insert a std::pair into the + * %unordered_map. + * + * @param __k Key to use for finding a possibly existing pair in + * the unordered_map. + * @param __args Arguments used to generate the .second for a + * new pair instance. + * + * @return A pair, of which the first element is an iterator that points + * to the possibly inserted pair, and the second is a bool that + * is true if the pair was actually inserted. + * + * This function attempts to build and insert a (key, value) %pair into + * the %unordered_map. + * An %unordered_map relies on unique keys and thus a %pair is only + * inserted if its first element (the key) is not already present in the + * %unordered_map. + * If a %pair is not inserted, this function has no effect. + * + * Insertion requires amortized constant time. + */ + template + pair + try_emplace(const key_type& __k, _Args&&... __args) + { + iterator __i = find(__k); + if (__i == end()) + { + __i = emplace(std::piecewise_construct, + std::forward_as_tuple(__k), + std::forward_as_tuple( + std::forward<_Args>(__args)...)) + .first; + return {__i, true}; + } + return {__i, false}; + } + + // move-capable overload + template + pair + try_emplace(key_type&& __k, _Args&&... __args) + { + iterator __i = find(__k); + if (__i == end()) + { + __i = emplace(std::piecewise_construct, + std::forward_as_tuple(std::move(__k)), + std::forward_as_tuple( + std::forward<_Args>(__args)...)) + .first; + return {__i, true}; + } + return {__i, false}; + } + + /** + * @brief Attempts to build and insert a std::pair into the + * %unordered_map. + * + * @param __hint An iterator that serves as a hint as to where the pair + * should be inserted. + * @param __k Key to use for finding a possibly existing pair in + * the unordered_map. + * @param __args Arguments used to generate the .second for a + * new pair instance. + * @return An iterator that points to the element with key of the + * std::pair built from @a __args (may or may not be that + * std::pair). + * + * This function is not concerned about whether the insertion took place, + * and thus does not return a boolean like the single-argument emplace() + * does. However, if insertion did not take place, + * this function has no effect. + * Note that the first parameter is only a hint and can potentially + * improve the performance of the insertion process. A bad hint would + * cause no gains in efficiency. + * + * See + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints + * for more on @a hinting. + * + * Insertion requires amortized constant time. + */ + template + iterator + try_emplace(const_iterator __hint, const key_type& __k, + _Args&&... __args) + { + iterator __i = find(__k); + if (__i == end()) + __i = emplace_hint(__hint, std::piecewise_construct, + std::forward_as_tuple(__k), + std::forward_as_tuple( + std::forward<_Args>(__args)...)); + return __i; + } + + // move-capable overload + template + iterator + try_emplace(const_iterator __hint, key_type&& __k, _Args&&... __args) + { + iterator __i = find(__k); + if (__i == end()) + __i = emplace_hint(__hint, std::piecewise_construct, + std::forward_as_tuple(std::move(__k)), + std::forward_as_tuple( + std::forward<_Args>(__args)...)); + return __i; + } +#endif // C++17 + + //@{ + /** + * @brief Attempts to insert a std::pair into the %unordered_map. + + * @param __x Pair to be inserted (see std::make_pair for easy + * creation of pairs). + * + * @return A pair, of which the first element is an iterator that + * points to the possibly inserted pair, and the second is + * a bool that is true if the pair was actually inserted. + * + * This function attempts to insert a (key, value) %pair into the + * %unordered_map. An %unordered_map relies on unique keys and thus a + * %pair is only inserted if its first element (the key) is not already + * present in the %unordered_map. + * + * Insertion requires amortized constant time. + */ + std::pair + insert(const value_type& __x) + { return _M_h.insert(__x); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2354. Unnecessary copying when inserting into maps with braced-init + std::pair + insert(value_type&& __x) + { return _M_h.insert(std::move(__x)); } + + template::value>::type> + std::pair + insert(_Pair&& __x) + { return _M_h.insert(std::forward<_Pair>(__x)); } + //@} + + //@{ + /** + * @brief Attempts to insert a std::pair into the %unordered_map. + * @param __hint An iterator that serves as a hint as to where the + * pair should be inserted. + * @param __x Pair to be inserted (see std::make_pair for easy creation + * of pairs). + * @return An iterator that points to the element with key of + * @a __x (may or may not be the %pair passed in). + * + * This function is not concerned about whether the insertion took place, + * and thus does not return a boolean like the single-argument insert() + * does. Note that the first parameter is only a hint and can + * potentially improve the performance of the insertion process. A bad + * hint would cause no gains in efficiency. + * + * See + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints + * for more on @a hinting. + * + * Insertion requires amortized constant time. + */ + iterator + insert(const_iterator __hint, const value_type& __x) + { return _M_h.insert(__hint, __x); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2354. Unnecessary copying when inserting into maps with braced-init + iterator + insert(const_iterator __hint, value_type&& __x) + { return _M_h.insert(__hint, std::move(__x)); } + + template::value>::type> + iterator + insert(const_iterator __hint, _Pair&& __x) + { return _M_h.insert(__hint, std::forward<_Pair>(__x)); } + //@} + + /** + * @brief A template function that attempts to insert a range of + * elements. + * @param __first Iterator pointing to the start of the range to be + * inserted. + * @param __last Iterator pointing to the end of the range. + * + * Complexity similar to that of the range constructor. + */ + template + void + insert(_InputIterator __first, _InputIterator __last) + { _M_h.insert(__first, __last); } + + /** + * @brief Attempts to insert a list of elements into the %unordered_map. + * @param __l A std::initializer_list of elements + * to be inserted. + * + * Complexity similar to that of the range constructor. + */ + void + insert(initializer_list __l) + { _M_h.insert(__l); } + + +#if __cplusplus > 201402L +#define __cpp_lib_unordered_map_insertion 201411 + /** + * @brief Attempts to insert a std::pair into the %unordered_map. + * @param __k Key to use for finding a possibly existing pair in + * the map. + * @param __obj Argument used to generate the .second for a pair + * instance. + * + * @return A pair, of which the first element is an iterator that + * points to the possibly inserted pair, and the second is + * a bool that is true if the pair was actually inserted. + * + * This function attempts to insert a (key, value) %pair into the + * %unordered_map. An %unordered_map relies on unique keys and thus a + * %pair is only inserted if its first element (the key) is not already + * present in the %unordered_map. + * If the %pair was already in the %unordered_map, the .second of + * the %pair is assigned from __obj. + * + * Insertion requires amortized constant time. + */ + template + pair + insert_or_assign(const key_type& __k, _Obj&& __obj) + { + iterator __i = find(__k); + if (__i == end()) + { + __i = emplace(std::piecewise_construct, + std::forward_as_tuple(__k), + std::forward_as_tuple(std::forward<_Obj>(__obj))) + .first; + return {__i, true}; + } + (*__i).second = std::forward<_Obj>(__obj); + return {__i, false}; + } + + // move-capable overload + template + pair + insert_or_assign(key_type&& __k, _Obj&& __obj) + { + iterator __i = find(__k); + if (__i == end()) + { + __i = emplace(std::piecewise_construct, + std::forward_as_tuple(std::move(__k)), + std::forward_as_tuple(std::forward<_Obj>(__obj))) + .first; + return {__i, true}; + } + (*__i).second = std::forward<_Obj>(__obj); + return {__i, false}; + } + + /** + * @brief Attempts to insert a std::pair into the %unordered_map. + * @param __hint An iterator that serves as a hint as to where the + * pair should be inserted. + * @param __k Key to use for finding a possibly existing pair in + * the unordered_map. + * @param __obj Argument used to generate the .second for a pair + * instance. + * @return An iterator that points to the element with key of + * @a __x (may or may not be the %pair passed in). + * + * This function is not concerned about whether the insertion took place, + * and thus does not return a boolean like the single-argument insert() + * does. + * If the %pair was already in the %unordered map, the .second of + * the %pair is assigned from __obj. + * Note that the first parameter is only a hint and can + * potentially improve the performance of the insertion process. A bad + * hint would cause no gains in efficiency. + * + * See + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints + * for more on @a hinting. + * + * Insertion requires amortized constant time. + */ + template + iterator + insert_or_assign(const_iterator __hint, const key_type& __k, + _Obj&& __obj) + { + iterator __i = find(__k); + if (__i == end()) + { + return emplace_hint(__hint, std::piecewise_construct, + std::forward_as_tuple(__k), + std::forward_as_tuple( + std::forward<_Obj>(__obj))); + } + (*__i).second = std::forward<_Obj>(__obj); + return __i; + } + + // move-capable overload + template + iterator + insert_or_assign(const_iterator __hint, key_type&& __k, _Obj&& __obj) + { + iterator __i = find(__k); + if (__i == end()) + { + return emplace_hint(__hint, std::piecewise_construct, + std::forward_as_tuple(std::move(__k)), + std::forward_as_tuple( + std::forward<_Obj>(__obj))); + } + (*__i).second = std::forward<_Obj>(__obj); + return __i; + } +#endif + + //@{ + /** + * @brief Erases an element from an %unordered_map. + * @param __position An iterator pointing to the element to be erased. + * @return An iterator pointing to the element immediately following + * @a __position prior to the element being erased. If no such + * element exists, end() is returned. + * + * This function erases an element, pointed to by the given iterator, + * from an %unordered_map. + * Note that this function only erases the element, and that if the + * element is itself a pointer, the pointed-to memory is not touched in + * any way. Managing the pointer is the user's responsibility. + */ + iterator + erase(const_iterator __position) + { return _M_h.erase(__position); } + + // LWG 2059. + iterator + erase(iterator __position) + { return _M_h.erase(__position); } + //@} + + /** + * @brief Erases elements according to the provided key. + * @param __x Key of element to be erased. + * @return The number of elements erased. + * + * This function erases all the elements located by the given key from + * an %unordered_map. For an %unordered_map the result of this function + * can only be 0 (not present) or 1 (present). + * Note that this function only erases the element, and that if the + * element is itself a pointer, the pointed-to memory is not touched in + * any way. Managing the pointer is the user's responsibility. + */ + size_type + erase(const key_type& __x) + { return _M_h.erase(__x); } + + /** + * @brief Erases a [__first,__last) range of elements from an + * %unordered_map. + * @param __first Iterator pointing to the start of the range to be + * erased. + * @param __last Iterator pointing to the end of the range to + * be erased. + * @return The iterator @a __last. + * + * This function erases a sequence of elements from an %unordered_map. + * Note that this function only erases the elements, and that if + * the element is itself a pointer, the pointed-to memory is not touched + * in any way. Managing the pointer is the user's responsibility. + */ + iterator + erase(const_iterator __first, const_iterator __last) + { return _M_h.erase(__first, __last); } + + /** + * Erases all elements in an %unordered_map. + * Note that this function only erases the elements, and that if the + * elements themselves are pointers, the pointed-to memory is not touched + * in any way. Managing the pointer is the user's responsibility. + */ + void + clear() noexcept + { _M_h.clear(); } + + /** + * @brief Swaps data with another %unordered_map. + * @param __x An %unordered_map of the same element and allocator + * types. + * + * This exchanges the elements between two %unordered_map in constant + * time. + * Note that the global std::swap() function is specialized such that + * std::swap(m1,m2) will feed to this function. + */ + void + swap(unordered_map& __x) + noexcept( noexcept(_M_h.swap(__x._M_h)) ) + { _M_h.swap(__x._M_h); } + +#if __cplusplus > 201402L + template + friend class _Hash_merge_helper; + + template + void + merge(unordered_map<_Key, _Tp, _H2, _P2, _Alloc>& __source) + { + using _Merge_helper = _Hash_merge_helper; + _M_h._M_merge_unique(_Merge_helper::_S_get_table(__source)); + } + + template + void + merge(unordered_map<_Key, _Tp, _H2, _P2, _Alloc>&& __source) + { merge(__source); } + + template + void + merge(unordered_multimap<_Key, _Tp, _H2, _P2, _Alloc>& __source) + { + using _Merge_helper = _Hash_merge_helper; + _M_h._M_merge_unique(_Merge_helper::_S_get_table(__source)); + } + + template + void + merge(unordered_multimap<_Key, _Tp, _H2, _P2, _Alloc>&& __source) + { merge(__source); } +#endif // C++17 + + // observers. + + /// Returns the hash functor object with which the %unordered_map was + /// constructed. + hasher + hash_function() const + { return _M_h.hash_function(); } + + /// Returns the key comparison object with which the %unordered_map was + /// constructed. + key_equal + key_eq() const + { return _M_h.key_eq(); } + + // lookup. + + //@{ + /** + * @brief Tries to locate an element in an %unordered_map. + * @param __x Key to be located. + * @return Iterator pointing to sought-after element, or end() if not + * found. + * + * This function takes a key and tries to locate the element with which + * the key matches. If successful the function returns an iterator + * pointing to the sought after element. If unsuccessful it returns the + * past-the-end ( @c end() ) iterator. + */ + iterator + find(const key_type& __x) + { return _M_h.find(__x); } + + const_iterator + find(const key_type& __x) const + { return _M_h.find(__x); } + //@} + + /** + * @brief Finds the number of elements. + * @param __x Key to count. + * @return Number of elements with specified key. + * + * This function only makes sense for %unordered_multimap; for + * %unordered_map the result will either be 0 (not present) or 1 + * (present). + */ + size_type + count(const key_type& __x) const + { return _M_h.count(__x); } + + //@{ + /** + * @brief Finds a subsequence matching given key. + * @param __x Key to be located. + * @return Pair of iterators that possibly points to the subsequence + * matching given key. + * + * This function probably only makes sense for %unordered_multimap. + */ + std::pair + equal_range(const key_type& __x) + { return _M_h.equal_range(__x); } + + std::pair + equal_range(const key_type& __x) const + { return _M_h.equal_range(__x); } + //@} + + //@{ + /** + * @brief Subscript ( @c [] ) access to %unordered_map data. + * @param __k The key for which data should be retrieved. + * @return A reference to the data of the (key,data) %pair. + * + * Allows for easy lookup with the subscript ( @c [] )operator. Returns + * data associated with the key specified in subscript. If the key does + * not exist, a pair with that key is created using default values, which + * is then returned. + * + * Lookup requires constant time. + */ + mapped_type& + operator[](const key_type& __k) + { return _M_h[__k]; } + + mapped_type& + operator[](key_type&& __k) + { return _M_h[std::move(__k)]; } + //@} + + //@{ + /** + * @brief Access to %unordered_map data. + * @param __k The key for which data should be retrieved. + * @return A reference to the data whose key is equal to @a __k, if + * such a data is present in the %unordered_map. + * @throw std::out_of_range If no such data is present. + */ + mapped_type& + at(const key_type& __k) + { return _M_h.at(__k); } + + const mapped_type& + at(const key_type& __k) const + { return _M_h.at(__k); } + //@} + + // bucket interface. + + /// Returns the number of buckets of the %unordered_map. + size_type + bucket_count() const noexcept + { return _M_h.bucket_count(); } + + /// Returns the maximum number of buckets of the %unordered_map. + size_type + max_bucket_count() const noexcept + { return _M_h.max_bucket_count(); } + + /* + * @brief Returns the number of elements in a given bucket. + * @param __n A bucket index. + * @return The number of elements in the bucket. + */ + size_type + bucket_size(size_type __n) const + { return _M_h.bucket_size(__n); } + + /* + * @brief Returns the bucket index of a given element. + * @param __key A key instance. + * @return The key bucket index. + */ + size_type + bucket(const key_type& __key) const + { return _M_h.bucket(__key); } + + /** + * @brief Returns a read/write iterator pointing to the first bucket + * element. + * @param __n The bucket index. + * @return A read/write local iterator. + */ + local_iterator + begin(size_type __n) + { return _M_h.begin(__n); } + + //@{ + /** + * @brief Returns a read-only (constant) iterator pointing to the first + * bucket element. + * @param __n The bucket index. + * @return A read-only local iterator. + */ + const_local_iterator + begin(size_type __n) const + { return _M_h.begin(__n); } + + const_local_iterator + cbegin(size_type __n) const + { return _M_h.cbegin(__n); } + //@} + + /** + * @brief Returns a read/write iterator pointing to one past the last + * bucket elements. + * @param __n The bucket index. + * @return A read/write local iterator. + */ + local_iterator + end(size_type __n) + { return _M_h.end(__n); } + + //@{ + /** + * @brief Returns a read-only (constant) iterator pointing to one past + * the last bucket elements. + * @param __n The bucket index. + * @return A read-only local iterator. + */ + const_local_iterator + end(size_type __n) const + { return _M_h.end(__n); } + + const_local_iterator + cend(size_type __n) const + { return _M_h.cend(__n); } + //@} + + // hash policy. + + /// Returns the average number of elements per bucket. + float + load_factor() const noexcept + { return _M_h.load_factor(); } + + /// Returns a positive number that the %unordered_map tries to keep the + /// load factor less than or equal to. + float + max_load_factor() const noexcept + { return _M_h.max_load_factor(); } + + /** + * @brief Change the %unordered_map maximum load factor. + * @param __z The new maximum load factor. + */ + void + max_load_factor(float __z) + { _M_h.max_load_factor(__z); } + + /** + * @brief May rehash the %unordered_map. + * @param __n The new number of buckets. + * + * Rehash will occur only if the new number of buckets respect the + * %unordered_map maximum load factor. + */ + void + rehash(size_type __n) + { _M_h.rehash(__n); } + + /** + * @brief Prepare the %unordered_map for a specified number of + * elements. + * @param __n Number of elements required. + * + * Same as rehash(ceil(n / max_load_factor())). + */ + void + reserve(size_type __n) + { _M_h.reserve(__n); } + + template + friend bool + operator==(const unordered_map<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&, + const unordered_map<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&); + }; + + /** + * @brief A standard container composed of equivalent keys + * (possibly containing multiple of each key value) that associates + * values of another type with the keys. + * + * @ingroup unordered_associative_containers + * + * @tparam _Key Type of key objects. + * @tparam _Tp Type of mapped objects. + * @tparam _Hash Hashing function object type, defaults to hash<_Value>. + * @tparam _Pred Predicate function object type, defaults + * to equal_to<_Value>. + * @tparam _Alloc Allocator type, defaults to + * std::allocator>. + * + * Meets the requirements of a container, and + * unordered associative container + * + * The resulting value type of the container is std::pair. + * + * Base is _Hashtable, dispatched at compile time via template + * alias __ummap_hashtable. + */ + template, + class _Pred = std::equal_to<_Key>, + class _Alloc = std::allocator > > + class unordered_multimap + { + typedef __ummap_hashtable<_Key, _Tp, _Hash, _Pred, _Alloc> _Hashtable; + _Hashtable _M_h; + + public: + // typedefs: + //@{ + /// Public typedefs. + typedef typename _Hashtable::key_type key_type; + typedef typename _Hashtable::value_type value_type; + typedef typename _Hashtable::mapped_type mapped_type; + typedef typename _Hashtable::hasher hasher; + typedef typename _Hashtable::key_equal key_equal; + typedef typename _Hashtable::allocator_type allocator_type; + //@} + + //@{ + /// Iterator-related typedefs. + typedef typename _Hashtable::pointer pointer; + typedef typename _Hashtable::const_pointer const_pointer; + typedef typename _Hashtable::reference reference; + typedef typename _Hashtable::const_reference const_reference; + typedef typename _Hashtable::iterator iterator; + typedef typename _Hashtable::const_iterator const_iterator; + typedef typename _Hashtable::local_iterator local_iterator; + typedef typename _Hashtable::const_local_iterator const_local_iterator; + typedef typename _Hashtable::size_type size_type; + typedef typename _Hashtable::difference_type difference_type; + //@} + +#if __cplusplus > 201402L + using node_type = typename _Hashtable::node_type; +#endif + + //construct/destroy/copy + + /// Default constructor. + unordered_multimap() = default; + + /** + * @brief Default constructor creates no elements. + * @param __n Mnimal initial number of buckets. + * @param __hf A hash functor. + * @param __eql A key equality functor. + * @param __a An allocator object. + */ + explicit + unordered_multimap(size_type __n, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_h(__n, __hf, __eql, __a) + { } + + /** + * @brief Builds an %unordered_multimap from a range. + * @param __first An input iterator. + * @param __last An input iterator. + * @param __n Minimal initial number of buckets. + * @param __hf A hash functor. + * @param __eql A key equality functor. + * @param __a An allocator object. + * + * Create an %unordered_multimap consisting of copies of the elements + * from [__first,__last). This is linear in N (where N is + * distance(__first,__last)). + */ + template + unordered_multimap(_InputIterator __first, _InputIterator __last, + size_type __n = 0, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_h(__first, __last, __n, __hf, __eql, __a) + { } + + /// Copy constructor. + unordered_multimap(const unordered_multimap&) = default; + + /// Move constructor. + unordered_multimap(unordered_multimap&&) = default; + + /** + * @brief Creates an %unordered_multimap with no elements. + * @param __a An allocator object. + */ + explicit + unordered_multimap(const allocator_type& __a) + : _M_h(__a) + { } + + /* + * @brief Copy constructor with allocator argument. + * @param __uset Input %unordered_multimap to copy. + * @param __a An allocator object. + */ + unordered_multimap(const unordered_multimap& __ummap, + const allocator_type& __a) + : _M_h(__ummap._M_h, __a) + { } + + /* + * @brief Move constructor with allocator argument. + * @param __uset Input %unordered_multimap to move. + * @param __a An allocator object. + */ + unordered_multimap(unordered_multimap&& __ummap, + const allocator_type& __a) + : _M_h(std::move(__ummap._M_h), __a) + { } + + /** + * @brief Builds an %unordered_multimap from an initializer_list. + * @param __l An initializer_list. + * @param __n Minimal initial number of buckets. + * @param __hf A hash functor. + * @param __eql A key equality functor. + * @param __a An allocator object. + * + * Create an %unordered_multimap consisting of copies of the elements in + * the list. This is linear in N (where N is @a __l.size()). + */ + unordered_multimap(initializer_list __l, + size_type __n = 0, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_h(__l, __n, __hf, __eql, __a) + { } + + unordered_multimap(size_type __n, const allocator_type& __a) + : unordered_multimap(__n, hasher(), key_equal(), __a) + { } + + unordered_multimap(size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multimap(__n, __hf, key_equal(), __a) + { } + + template + unordered_multimap(_InputIterator __first, _InputIterator __last, + size_type __n, + const allocator_type& __a) + : unordered_multimap(__first, __last, __n, hasher(), key_equal(), __a) + { } + + template + unordered_multimap(_InputIterator __first, _InputIterator __last, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multimap(__first, __last, __n, __hf, key_equal(), __a) + { } + + unordered_multimap(initializer_list __l, + size_type __n, + const allocator_type& __a) + : unordered_multimap(__l, __n, hasher(), key_equal(), __a) + { } + + unordered_multimap(initializer_list __l, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multimap(__l, __n, __hf, key_equal(), __a) + { } + + /// Copy assignment operator. + unordered_multimap& + operator=(const unordered_multimap&) = default; + + /// Move assignment operator. + unordered_multimap& + operator=(unordered_multimap&&) = default; + + /** + * @brief %Unordered_multimap list assignment operator. + * @param __l An initializer_list. + * + * This function fills an %unordered_multimap with copies of the + * elements in the initializer list @a __l. + * + * Note that the assignment completely changes the %unordered_multimap + * and that the resulting %unordered_multimap's size is the same as the + * number of elements assigned. + */ + unordered_multimap& + operator=(initializer_list __l) + { + _M_h = __l; + return *this; + } + + /// Returns the allocator object used by the %unordered_multimap. + allocator_type + get_allocator() const noexcept + { return _M_h.get_allocator(); } + + // size and capacity: + + /// Returns true if the %unordered_multimap is empty. + bool + empty() const noexcept + { return _M_h.empty(); } + + /// Returns the size of the %unordered_multimap. + size_type + size() const noexcept + { return _M_h.size(); } + + /// Returns the maximum size of the %unordered_multimap. + size_type + max_size() const noexcept + { return _M_h.max_size(); } + + // iterators. + + /** + * Returns a read/write iterator that points to the first element in the + * %unordered_multimap. + */ + iterator + begin() noexcept + { return _M_h.begin(); } + + //@{ + /** + * Returns a read-only (constant) iterator that points to the first + * element in the %unordered_multimap. + */ + const_iterator + begin() const noexcept + { return _M_h.begin(); } + + const_iterator + cbegin() const noexcept + { return _M_h.begin(); } + //@} + + /** + * Returns a read/write iterator that points one past the last element in + * the %unordered_multimap. + */ + iterator + end() noexcept + { return _M_h.end(); } + + //@{ + /** + * Returns a read-only (constant) iterator that points one past the last + * element in the %unordered_multimap. + */ + const_iterator + end() const noexcept + { return _M_h.end(); } + + const_iterator + cend() const noexcept + { return _M_h.end(); } + //@} + + // modifiers. + + /** + * @brief Attempts to build and insert a std::pair into the + * %unordered_multimap. + * + * @param __args Arguments used to generate a new pair instance (see + * std::piecewise_contruct for passing arguments to each + * part of the pair constructor). + * + * @return An iterator that points to the inserted pair. + * + * This function attempts to build and insert a (key, value) %pair into + * the %unordered_multimap. + * + * Insertion requires amortized constant time. + */ + template + iterator + emplace(_Args&&... __args) + { return _M_h.emplace(std::forward<_Args>(__args)...); } + + /** + * @brief Attempts to build and insert a std::pair into the + * %unordered_multimap. + * + * @param __pos An iterator that serves as a hint as to where the pair + * should be inserted. + * @param __args Arguments used to generate a new pair instance (see + * std::piecewise_contruct for passing arguments to each + * part of the pair constructor). + * @return An iterator that points to the element with key of the + * std::pair built from @a __args. + * + * Note that the first parameter is only a hint and can potentially + * improve the performance of the insertion process. A bad hint would + * cause no gains in efficiency. + * + * See + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints + * for more on @a hinting. + * + * Insertion requires amortized constant time. + */ + template + iterator + emplace_hint(const_iterator __pos, _Args&&... __args) + { return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); } + + //@{ + /** + * @brief Inserts a std::pair into the %unordered_multimap. + * @param __x Pair to be inserted (see std::make_pair for easy + * creation of pairs). + * + * @return An iterator that points to the inserted pair. + * + * Insertion requires amortized constant time. + */ + iterator + insert(const value_type& __x) + { return _M_h.insert(__x); } + + iterator + insert(value_type&& __x) + { return _M_h.insert(std::move(__x)); } + + template::value>::type> + iterator + insert(_Pair&& __x) + { return _M_h.insert(std::forward<_Pair>(__x)); } + //@} + + //@{ + /** + * @brief Inserts a std::pair into the %unordered_multimap. + * @param __hint An iterator that serves as a hint as to where the + * pair should be inserted. + * @param __x Pair to be inserted (see std::make_pair for easy creation + * of pairs). + * @return An iterator that points to the element with key of + * @a __x (may or may not be the %pair passed in). + * + * Note that the first parameter is only a hint and can potentially + * improve the performance of the insertion process. A bad hint would + * cause no gains in efficiency. + * + * See + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints + * for more on @a hinting. + * + * Insertion requires amortized constant time. + */ + iterator + insert(const_iterator __hint, const value_type& __x) + { return _M_h.insert(__hint, __x); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2354. Unnecessary copying when inserting into maps with braced-init + iterator + insert(const_iterator __hint, value_type&& __x) + { return _M_h.insert(__hint, std::move(__x)); } + + template::value>::type> + iterator + insert(const_iterator __hint, _Pair&& __x) + { return _M_h.insert(__hint, std::forward<_Pair>(__x)); } + //@} + + /** + * @brief A template function that attempts to insert a range of + * elements. + * @param __first Iterator pointing to the start of the range to be + * inserted. + * @param __last Iterator pointing to the end of the range. + * + * Complexity similar to that of the range constructor. + */ + template + void + insert(_InputIterator __first, _InputIterator __last) + { _M_h.insert(__first, __last); } + + /** + * @brief Attempts to insert a list of elements into the + * %unordered_multimap. + * @param __l A std::initializer_list of elements + * to be inserted. + * + * Complexity similar to that of the range constructor. + */ + void + insert(initializer_list __l) + { _M_h.insert(__l); } + +#if __cplusplus > 201402L + /// Extract a node. + node_type + extract(const_iterator __pos) + { + __glibcxx_assert(__pos != end()); + return _M_h.extract(__pos); + } + + /// Extract a node. + node_type + extract(const key_type& __key) + { return _M_h.extract(__key); } + + /// Re-insert an extracted node. + iterator + insert(node_type&& __nh) + { return _M_h._M_reinsert_node_multi(cend(), std::move(__nh)); } + + /// Re-insert an extracted node. + iterator + insert(const_iterator __hint, node_type&& __nh) + { return _M_h._M_reinsert_node_multi(__hint, std::move(__nh)); } +#endif // C++17 + + //@{ + /** + * @brief Erases an element from an %unordered_multimap. + * @param __position An iterator pointing to the element to be erased. + * @return An iterator pointing to the element immediately following + * @a __position prior to the element being erased. If no such + * element exists, end() is returned. + * + * This function erases an element, pointed to by the given iterator, + * from an %unordered_multimap. + * Note that this function only erases the element, and that if the + * element is itself a pointer, the pointed-to memory is not touched in + * any way. Managing the pointer is the user's responsibility. + */ + iterator + erase(const_iterator __position) + { return _M_h.erase(__position); } + + // LWG 2059. + iterator + erase(iterator __position) + { return _M_h.erase(__position); } + //@} + + /** + * @brief Erases elements according to the provided key. + * @param __x Key of elements to be erased. + * @return The number of elements erased. + * + * This function erases all the elements located by the given key from + * an %unordered_multimap. + * Note that this function only erases the element, and that if the + * element is itself a pointer, the pointed-to memory is not touched in + * any way. Managing the pointer is the user's responsibility. + */ + size_type + erase(const key_type& __x) + { return _M_h.erase(__x); } + + /** + * @brief Erases a [__first,__last) range of elements from an + * %unordered_multimap. + * @param __first Iterator pointing to the start of the range to be + * erased. + * @param __last Iterator pointing to the end of the range to + * be erased. + * @return The iterator @a __last. + * + * This function erases a sequence of elements from an + * %unordered_multimap. + * Note that this function only erases the elements, and that if + * the element is itself a pointer, the pointed-to memory is not touched + * in any way. Managing the pointer is the user's responsibility. + */ + iterator + erase(const_iterator __first, const_iterator __last) + { return _M_h.erase(__first, __last); } + + /** + * Erases all elements in an %unordered_multimap. + * Note that this function only erases the elements, and that if the + * elements themselves are pointers, the pointed-to memory is not touched + * in any way. Managing the pointer is the user's responsibility. + */ + void + clear() noexcept + { _M_h.clear(); } + + /** + * @brief Swaps data with another %unordered_multimap. + * @param __x An %unordered_multimap of the same element and allocator + * types. + * + * This exchanges the elements between two %unordered_multimap in + * constant time. + * Note that the global std::swap() function is specialized such that + * std::swap(m1,m2) will feed to this function. + */ + void + swap(unordered_multimap& __x) + noexcept( noexcept(_M_h.swap(__x._M_h)) ) + { _M_h.swap(__x._M_h); } + +#if __cplusplus > 201402L + template + friend class _Hash_merge_helper; + + template + void + merge(unordered_multimap<_Key, _Tp, _H2, _P2, _Alloc>& __source) + { + using _Merge_helper + = _Hash_merge_helper; + _M_h._M_merge_multi(_Merge_helper::_S_get_table(__source)); + } + + template + void + merge(unordered_multimap<_Key, _Tp, _H2, _P2, _Alloc>&& __source) + { merge(__source); } + + template + void + merge(unordered_map<_Key, _Tp, _H2, _P2, _Alloc>& __source) + { + using _Merge_helper + = _Hash_merge_helper; + _M_h._M_merge_multi(_Merge_helper::_S_get_table(__source)); + } + + template + void + merge(unordered_map<_Key, _Tp, _H2, _P2, _Alloc>&& __source) + { merge(__source); } +#endif // C++17 + + // observers. + + /// Returns the hash functor object with which the %unordered_multimap + /// was constructed. + hasher + hash_function() const + { return _M_h.hash_function(); } + + /// Returns the key comparison object with which the %unordered_multimap + /// was constructed. + key_equal + key_eq() const + { return _M_h.key_eq(); } + + // lookup. + + //@{ + /** + * @brief Tries to locate an element in an %unordered_multimap. + * @param __x Key to be located. + * @return Iterator pointing to sought-after element, or end() if not + * found. + * + * This function takes a key and tries to locate the element with which + * the key matches. If successful the function returns an iterator + * pointing to the sought after element. If unsuccessful it returns the + * past-the-end ( @c end() ) iterator. + */ + iterator + find(const key_type& __x) + { return _M_h.find(__x); } + + const_iterator + find(const key_type& __x) const + { return _M_h.find(__x); } + //@} + + /** + * @brief Finds the number of elements. + * @param __x Key to count. + * @return Number of elements with specified key. + */ + size_type + count(const key_type& __x) const + { return _M_h.count(__x); } + + //@{ + /** + * @brief Finds a subsequence matching given key. + * @param __x Key to be located. + * @return Pair of iterators that possibly points to the subsequence + * matching given key. + */ + std::pair + equal_range(const key_type& __x) + { return _M_h.equal_range(__x); } + + std::pair + equal_range(const key_type& __x) const + { return _M_h.equal_range(__x); } + //@} + + // bucket interface. + + /// Returns the number of buckets of the %unordered_multimap. + size_type + bucket_count() const noexcept + { return _M_h.bucket_count(); } + + /// Returns the maximum number of buckets of the %unordered_multimap. + size_type + max_bucket_count() const noexcept + { return _M_h.max_bucket_count(); } + + /* + * @brief Returns the number of elements in a given bucket. + * @param __n A bucket index. + * @return The number of elements in the bucket. + */ + size_type + bucket_size(size_type __n) const + { return _M_h.bucket_size(__n); } + + /* + * @brief Returns the bucket index of a given element. + * @param __key A key instance. + * @return The key bucket index. + */ + size_type + bucket(const key_type& __key) const + { return _M_h.bucket(__key); } + + /** + * @brief Returns a read/write iterator pointing to the first bucket + * element. + * @param __n The bucket index. + * @return A read/write local iterator. + */ + local_iterator + begin(size_type __n) + { return _M_h.begin(__n); } + + //@{ + /** + * @brief Returns a read-only (constant) iterator pointing to the first + * bucket element. + * @param __n The bucket index. + * @return A read-only local iterator. + */ + const_local_iterator + begin(size_type __n) const + { return _M_h.begin(__n); } + + const_local_iterator + cbegin(size_type __n) const + { return _M_h.cbegin(__n); } + //@} + + /** + * @brief Returns a read/write iterator pointing to one past the last + * bucket elements. + * @param __n The bucket index. + * @return A read/write local iterator. + */ + local_iterator + end(size_type __n) + { return _M_h.end(__n); } + + //@{ + /** + * @brief Returns a read-only (constant) iterator pointing to one past + * the last bucket elements. + * @param __n The bucket index. + * @return A read-only local iterator. + */ + const_local_iterator + end(size_type __n) const + { return _M_h.end(__n); } + + const_local_iterator + cend(size_type __n) const + { return _M_h.cend(__n); } + //@} + + // hash policy. + + /// Returns the average number of elements per bucket. + float + load_factor() const noexcept + { return _M_h.load_factor(); } + + /// Returns a positive number that the %unordered_multimap tries to keep + /// the load factor less than or equal to. + float + max_load_factor() const noexcept + { return _M_h.max_load_factor(); } + + /** + * @brief Change the %unordered_multimap maximum load factor. + * @param __z The new maximum load factor. + */ + void + max_load_factor(float __z) + { _M_h.max_load_factor(__z); } + + /** + * @brief May rehash the %unordered_multimap. + * @param __n The new number of buckets. + * + * Rehash will occur only if the new number of buckets respect the + * %unordered_multimap maximum load factor. + */ + void + rehash(size_type __n) + { _M_h.rehash(__n); } + + /** + * @brief Prepare the %unordered_multimap for a specified number of + * elements. + * @param __n Number of elements required. + * + * Same as rehash(ceil(n / max_load_factor())). + */ + void + reserve(size_type __n) + { _M_h.reserve(__n); } + + template + friend bool + operator==(const unordered_multimap<_Key1, _Tp1, + _Hash1, _Pred1, _Alloc1>&, + const unordered_multimap<_Key1, _Tp1, + _Hash1, _Pred1, _Alloc1>&); + }; + + template + inline void + swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, + unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) + noexcept(noexcept(__x.swap(__y))) + { __x.swap(__y); } + + template + inline void + swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, + unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) + noexcept(noexcept(__x.swap(__y))) + { __x.swap(__y); } + + template + inline bool + operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, + const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) + { return __x._M_h._M_equal(__y._M_h); } + + template + inline bool + operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, + const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) + { return !(__x == __y); } + + template + inline bool + operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, + const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) + { return __x._M_h._M_equal(__y._M_h); } + + template + inline bool + operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, + const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) + { return !(__x == __y); } + +_GLIBCXX_END_NAMESPACE_CONTAINER + +#if __cplusplus > 201402L +_GLIBCXX_BEGIN_NAMESPACE_VERSION + // Allow std::unordered_map access to internals of compatible maps. + template + struct _Hash_merge_helper< + _GLIBCXX_STD_C::unordered_map<_Key, _Val, _Hash1, _Eq1, _Alloc>, + _Hash2, _Eq2> + { + private: + template + using unordered_map = _GLIBCXX_STD_C::unordered_map<_Tp...>; + template + using unordered_multimap = _GLIBCXX_STD_C::unordered_multimap<_Tp...>; + + friend unordered_map<_Key, _Val, _Hash1, _Eq1, _Alloc>; + + static auto& + _S_get_table(unordered_map<_Key, _Val, _Hash2, _Eq2, _Alloc>& __map) + { return __map._M_h; } + + static auto& + _S_get_table(unordered_multimap<_Key, _Val, _Hash2, _Eq2, _Alloc>& __map) + { return __map._M_h; } + }; + + // Allow std::unordered_multimap access to internals of compatible maps. + template + struct _Hash_merge_helper< + _GLIBCXX_STD_C::unordered_multimap<_Key, _Val, _Hash1, _Eq1, _Alloc>, + _Hash2, _Eq2> + { + private: + template + using unordered_map = _GLIBCXX_STD_C::unordered_map<_Tp...>; + template + using unordered_multimap = _GLIBCXX_STD_C::unordered_multimap<_Tp...>; + + friend unordered_multimap<_Key, _Val, _Hash1, _Eq1, _Alloc>; + + static auto& + _S_get_table(unordered_map<_Key, _Val, _Hash2, _Eq2, _Alloc>& __map) + { return __map._M_h; } + + static auto& + _S_get_table(unordered_multimap<_Key, _Val, _Hash2, _Eq2, _Alloc>& __map) + { return __map._M_h; } + }; +_GLIBCXX_END_NAMESPACE_VERSION +#endif // C++17 + +} // namespace std + +#endif /* _UNORDERED_MAP_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/unordered_set.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/unordered_set.h new file mode 100644 index 0000000..85c2562 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/unordered_set.h @@ -0,0 +1,1612 @@ +// unordered_set implementation -*- C++ -*- + +// Copyright (C) 2010-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/unordered_set.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{unordered_set} + */ + +#ifndef _UNORDERED_SET_H +#define _UNORDERED_SET_H + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_CONTAINER + + /// Base types for unordered_set. + template + using __uset_traits = __detail::_Hashtable_traits<_Cache, true, true>; + + template, + typename _Pred = std::equal_to<_Value>, + typename _Alloc = std::allocator<_Value>, + typename _Tr = __uset_traits<__cache_default<_Value, _Hash>::value>> + using __uset_hashtable = _Hashtable<_Value, _Value, _Alloc, + __detail::_Identity, _Pred, _Hash, + __detail::_Mod_range_hashing, + __detail::_Default_ranged_hash, + __detail::_Prime_rehash_policy, _Tr>; + + /// Base types for unordered_multiset. + template + using __umset_traits = __detail::_Hashtable_traits<_Cache, true, false>; + + template, + typename _Pred = std::equal_to<_Value>, + typename _Alloc = std::allocator<_Value>, + typename _Tr = __umset_traits<__cache_default<_Value, _Hash>::value>> + using __umset_hashtable = _Hashtable<_Value, _Value, _Alloc, + __detail::_Identity, + _Pred, _Hash, + __detail::_Mod_range_hashing, + __detail::_Default_ranged_hash, + __detail::_Prime_rehash_policy, _Tr>; + + template + class unordered_multiset; + + /** + * @brief A standard container composed of unique keys (containing + * at most one of each key value) in which the elements' keys are + * the elements themselves. + * + * @ingroup unordered_associative_containers + * + * @tparam _Value Type of key objects. + * @tparam _Hash Hashing function object type, defaults to hash<_Value>. + + * @tparam _Pred Predicate function object type, defaults to + * equal_to<_Value>. + * + * @tparam _Alloc Allocator type, defaults to allocator<_Key>. + * + * Meets the requirements of a container, and + * unordered associative container + * + * Base is _Hashtable, dispatched at compile time via template + * alias __uset_hashtable. + */ + template, + class _Pred = std::equal_to<_Value>, + class _Alloc = std::allocator<_Value> > + class unordered_set + { + typedef __uset_hashtable<_Value, _Hash, _Pred, _Alloc> _Hashtable; + _Hashtable _M_h; + + public: + // typedefs: + //@{ + /// Public typedefs. + typedef typename _Hashtable::key_type key_type; + typedef typename _Hashtable::value_type value_type; + typedef typename _Hashtable::hasher hasher; + typedef typename _Hashtable::key_equal key_equal; + typedef typename _Hashtable::allocator_type allocator_type; + //@} + + //@{ + /// Iterator-related typedefs. + typedef typename _Hashtable::pointer pointer; + typedef typename _Hashtable::const_pointer const_pointer; + typedef typename _Hashtable::reference reference; + typedef typename _Hashtable::const_reference const_reference; + typedef typename _Hashtable::iterator iterator; + typedef typename _Hashtable::const_iterator const_iterator; + typedef typename _Hashtable::local_iterator local_iterator; + typedef typename _Hashtable::const_local_iterator const_local_iterator; + typedef typename _Hashtable::size_type size_type; + typedef typename _Hashtable::difference_type difference_type; + //@} + +#if __cplusplus > 201402L + using node_type = typename _Hashtable::node_type; + using insert_return_type = typename _Hashtable::insert_return_type; +#endif + + // construct/destroy/copy + + /// Default constructor. + unordered_set() = default; + + /** + * @brief Default constructor creates no elements. + * @param __n Minimal initial number of buckets. + * @param __hf A hash functor. + * @param __eql A key equality functor. + * @param __a An allocator object. + */ + explicit + unordered_set(size_type __n, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_h(__n, __hf, __eql, __a) + { } + + /** + * @brief Builds an %unordered_set from a range. + * @param __first An input iterator. + * @param __last An input iterator. + * @param __n Minimal initial number of buckets. + * @param __hf A hash functor. + * @param __eql A key equality functor. + * @param __a An allocator object. + * + * Create an %unordered_set consisting of copies of the elements from + * [__first,__last). This is linear in N (where N is + * distance(__first,__last)). + */ + template + unordered_set(_InputIterator __first, _InputIterator __last, + size_type __n = 0, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_h(__first, __last, __n, __hf, __eql, __a) + { } + + /// Copy constructor. + unordered_set(const unordered_set&) = default; + + /// Move constructor. + unordered_set(unordered_set&&) = default; + + /** + * @brief Creates an %unordered_set with no elements. + * @param __a An allocator object. + */ + explicit + unordered_set(const allocator_type& __a) + : _M_h(__a) + { } + + /* + * @brief Copy constructor with allocator argument. + * @param __uset Input %unordered_set to copy. + * @param __a An allocator object. + */ + unordered_set(const unordered_set& __uset, + const allocator_type& __a) + : _M_h(__uset._M_h, __a) + { } + + /* + * @brief Move constructor with allocator argument. + * @param __uset Input %unordered_set to move. + * @param __a An allocator object. + */ + unordered_set(unordered_set&& __uset, + const allocator_type& __a) + : _M_h(std::move(__uset._M_h), __a) + { } + + /** + * @brief Builds an %unordered_set from an initializer_list. + * @param __l An initializer_list. + * @param __n Minimal initial number of buckets. + * @param __hf A hash functor. + * @param __eql A key equality functor. + * @param __a An allocator object. + * + * Create an %unordered_set consisting of copies of the elements in the + * list. This is linear in N (where N is @a __l.size()). + */ + unordered_set(initializer_list __l, + size_type __n = 0, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_h(__l, __n, __hf, __eql, __a) + { } + + unordered_set(size_type __n, const allocator_type& __a) + : unordered_set(__n, hasher(), key_equal(), __a) + { } + + unordered_set(size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_set(__n, __hf, key_equal(), __a) + { } + + template + unordered_set(_InputIterator __first, _InputIterator __last, + size_type __n, + const allocator_type& __a) + : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) + { } + + template + unordered_set(_InputIterator __first, _InputIterator __last, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_set(__first, __last, __n, __hf, key_equal(), __a) + { } + + unordered_set(initializer_list __l, + size_type __n, + const allocator_type& __a) + : unordered_set(__l, __n, hasher(), key_equal(), __a) + { } + + unordered_set(initializer_list __l, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_set(__l, __n, __hf, key_equal(), __a) + { } + + /// Copy assignment operator. + unordered_set& + operator=(const unordered_set&) = default; + + /// Move assignment operator. + unordered_set& + operator=(unordered_set&&) = default; + + /** + * @brief %Unordered_set list assignment operator. + * @param __l An initializer_list. + * + * This function fills an %unordered_set with copies of the elements in + * the initializer list @a __l. + * + * Note that the assignment completely changes the %unordered_set and + * that the resulting %unordered_set's size is the same as the number + * of elements assigned. + */ + unordered_set& + operator=(initializer_list __l) + { + _M_h = __l; + return *this; + } + + /// Returns the allocator object used by the %unordered_set. + allocator_type + get_allocator() const noexcept + { return _M_h.get_allocator(); } + + // size and capacity: + + /// Returns true if the %unordered_set is empty. + bool + empty() const noexcept + { return _M_h.empty(); } + + /// Returns the size of the %unordered_set. + size_type + size() const noexcept + { return _M_h.size(); } + + /// Returns the maximum size of the %unordered_set. + size_type + max_size() const noexcept + { return _M_h.max_size(); } + + // iterators. + + //@{ + /** + * Returns a read-only (constant) iterator that points to the first + * element in the %unordered_set. + */ + iterator + begin() noexcept + { return _M_h.begin(); } + + const_iterator + begin() const noexcept + { return _M_h.begin(); } + //@} + + //@{ + /** + * Returns a read-only (constant) iterator that points one past the last + * element in the %unordered_set. + */ + iterator + end() noexcept + { return _M_h.end(); } + + const_iterator + end() const noexcept + { return _M_h.end(); } + //@} + + /** + * Returns a read-only (constant) iterator that points to the first + * element in the %unordered_set. + */ + const_iterator + cbegin() const noexcept + { return _M_h.begin(); } + + /** + * Returns a read-only (constant) iterator that points one past the last + * element in the %unordered_set. + */ + const_iterator + cend() const noexcept + { return _M_h.end(); } + + // modifiers. + + /** + * @brief Attempts to build and insert an element into the + * %unordered_set. + * @param __args Arguments used to generate an element. + * @return A pair, of which the first element is an iterator that points + * to the possibly inserted element, and the second is a bool + * that is true if the element was actually inserted. + * + * This function attempts to build and insert an element into the + * %unordered_set. An %unordered_set relies on unique keys and thus an + * element is only inserted if it is not already present in the + * %unordered_set. + * + * Insertion requires amortized constant time. + */ + template + std::pair + emplace(_Args&&... __args) + { return _M_h.emplace(std::forward<_Args>(__args)...); } + + /** + * @brief Attempts to insert an element into the %unordered_set. + * @param __pos An iterator that serves as a hint as to where the + * element should be inserted. + * @param __args Arguments used to generate the element to be + * inserted. + * @return An iterator that points to the element with key equivalent to + * the one generated from @a __args (may or may not be the + * element itself). + * + * This function is not concerned about whether the insertion took place, + * and thus does not return a boolean like the single-argument emplace() + * does. Note that the first parameter is only a hint and can + * potentially improve the performance of the insertion process. A bad + * hint would cause no gains in efficiency. + * + * For more on @a hinting, see: + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints + * + * Insertion requires amortized constant time. + */ + template + iterator + emplace_hint(const_iterator __pos, _Args&&... __args) + { return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); } + + //@{ + /** + * @brief Attempts to insert an element into the %unordered_set. + * @param __x Element to be inserted. + * @return A pair, of which the first element is an iterator that points + * to the possibly inserted element, and the second is a bool + * that is true if the element was actually inserted. + * + * This function attempts to insert an element into the %unordered_set. + * An %unordered_set relies on unique keys and thus an element is only + * inserted if it is not already present in the %unordered_set. + * + * Insertion requires amortized constant time. + */ + std::pair + insert(const value_type& __x) + { return _M_h.insert(__x); } + + std::pair + insert(value_type&& __x) + { return _M_h.insert(std::move(__x)); } + //@} + + //@{ + /** + * @brief Attempts to insert an element into the %unordered_set. + * @param __hint An iterator that serves as a hint as to where the + * element should be inserted. + * @param __x Element to be inserted. + * @return An iterator that points to the element with key of + * @a __x (may or may not be the element passed in). + * + * This function is not concerned about whether the insertion took place, + * and thus does not return a boolean like the single-argument insert() + * does. Note that the first parameter is only a hint and can + * potentially improve the performance of the insertion process. A bad + * hint would cause no gains in efficiency. + * + * For more on @a hinting, see: + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints + * + * Insertion requires amortized constant. + */ + iterator + insert(const_iterator __hint, const value_type& __x) + { return _M_h.insert(__hint, __x); } + + iterator + insert(const_iterator __hint, value_type&& __x) + { return _M_h.insert(__hint, std::move(__x)); } + //@} + + /** + * @brief A template function that attempts to insert a range of + * elements. + * @param __first Iterator pointing to the start of the range to be + * inserted. + * @param __last Iterator pointing to the end of the range. + * + * Complexity similar to that of the range constructor. + */ + template + void + insert(_InputIterator __first, _InputIterator __last) + { _M_h.insert(__first, __last); } + + /** + * @brief Attempts to insert a list of elements into the %unordered_set. + * @param __l A std::initializer_list of elements + * to be inserted. + * + * Complexity similar to that of the range constructor. + */ + void + insert(initializer_list __l) + { _M_h.insert(__l); } + +#if __cplusplus > 201402L + /// Extract a node. + node_type + extract(const_iterator __pos) + { + __glibcxx_assert(__pos != end()); + return _M_h.extract(__pos); + } + + /// Extract a node. + node_type + extract(const key_type& __key) + { return _M_h.extract(__key); } + + /// Re-insert an extracted node. + insert_return_type + insert(node_type&& __nh) + { return _M_h._M_reinsert_node(std::move(__nh)); } + + /// Re-insert an extracted node. + iterator + insert(const_iterator, node_type&& __nh) + { return _M_h._M_reinsert_node(std::move(__nh)).position; } +#endif // C++17 + + //@{ + /** + * @brief Erases an element from an %unordered_set. + * @param __position An iterator pointing to the element to be erased. + * @return An iterator pointing to the element immediately following + * @a __position prior to the element being erased. If no such + * element exists, end() is returned. + * + * This function erases an element, pointed to by the given iterator, + * from an %unordered_set. Note that this function only erases the + * element, and that if the element is itself a pointer, the pointed-to + * memory is not touched in any way. Managing the pointer is the user's + * responsibility. + */ + iterator + erase(const_iterator __position) + { return _M_h.erase(__position); } + + // LWG 2059. + iterator + erase(iterator __position) + { return _M_h.erase(__position); } + //@} + + /** + * @brief Erases elements according to the provided key. + * @param __x Key of element to be erased. + * @return The number of elements erased. + * + * This function erases all the elements located by the given key from + * an %unordered_set. For an %unordered_set the result of this function + * can only be 0 (not present) or 1 (present). + * Note that this function only erases the element, and that if + * the element is itself a pointer, the pointed-to memory is not touched + * in any way. Managing the pointer is the user's responsibility. + */ + size_type + erase(const key_type& __x) + { return _M_h.erase(__x); } + + /** + * @brief Erases a [__first,__last) range of elements from an + * %unordered_set. + * @param __first Iterator pointing to the start of the range to be + * erased. + * @param __last Iterator pointing to the end of the range to + * be erased. + * @return The iterator @a __last. + * + * This function erases a sequence of elements from an %unordered_set. + * Note that this function only erases the element, and that if + * the element is itself a pointer, the pointed-to memory is not touched + * in any way. Managing the pointer is the user's responsibility. + */ + iterator + erase(const_iterator __first, const_iterator __last) + { return _M_h.erase(__first, __last); } + + /** + * Erases all elements in an %unordered_set. Note that this function only + * erases the elements, and that if the elements themselves are pointers, + * the pointed-to memory is not touched in any way. Managing the pointer + * is the user's responsibility. + */ + void + clear() noexcept + { _M_h.clear(); } + + /** + * @brief Swaps data with another %unordered_set. + * @param __x An %unordered_set of the same element and allocator + * types. + * + * This exchanges the elements between two sets in constant time. + * Note that the global std::swap() function is specialized such that + * std::swap(s1,s2) will feed to this function. + */ + void + swap(unordered_set& __x) + noexcept( noexcept(_M_h.swap(__x._M_h)) ) + { _M_h.swap(__x._M_h); } + +#if __cplusplus > 201402L + template + friend class _Hash_merge_helper; + + template + void + merge(unordered_set<_Value, _H2, _P2, _Alloc>& __source) + { + using _Merge_helper = _Hash_merge_helper; + _M_h._M_merge_unique(_Merge_helper::_S_get_table(__source)); + } + + template + void + merge(unordered_set<_Value, _H2, _P2, _Alloc>&& __source) + { merge(__source); } + + template + void + merge(unordered_multiset<_Value, _H2, _P2, _Alloc>& __source) + { + using _Merge_helper = _Hash_merge_helper; + _M_h._M_merge_unique(_Merge_helper::_S_get_table(__source)); + } + + template + void + merge(unordered_multiset<_Value, _H2, _P2, _Alloc>&& __source) + { merge(__source); } +#endif // C++17 + + // observers. + + /// Returns the hash functor object with which the %unordered_set was + /// constructed. + hasher + hash_function() const + { return _M_h.hash_function(); } + + /// Returns the key comparison object with which the %unordered_set was + /// constructed. + key_equal + key_eq() const + { return _M_h.key_eq(); } + + // lookup. + + //@{ + /** + * @brief Tries to locate an element in an %unordered_set. + * @param __x Element to be located. + * @return Iterator pointing to sought-after element, or end() if not + * found. + * + * This function takes a key and tries to locate the element with which + * the key matches. If successful the function returns an iterator + * pointing to the sought after element. If unsuccessful it returns the + * past-the-end ( @c end() ) iterator. + */ + iterator + find(const key_type& __x) + { return _M_h.find(__x); } + + const_iterator + find(const key_type& __x) const + { return _M_h.find(__x); } + //@} + + /** + * @brief Finds the number of elements. + * @param __x Element to located. + * @return Number of elements with specified key. + * + * This function only makes sense for unordered_multisets; for + * unordered_set the result will either be 0 (not present) or 1 + * (present). + */ + size_type + count(const key_type& __x) const + { return _M_h.count(__x); } + + //@{ + /** + * @brief Finds a subsequence matching given key. + * @param __x Key to be located. + * @return Pair of iterators that possibly points to the subsequence + * matching given key. + * + * This function probably only makes sense for multisets. + */ + std::pair + equal_range(const key_type& __x) + { return _M_h.equal_range(__x); } + + std::pair + equal_range(const key_type& __x) const + { return _M_h.equal_range(__x); } + //@} + + // bucket interface. + + /// Returns the number of buckets of the %unordered_set. + size_type + bucket_count() const noexcept + { return _M_h.bucket_count(); } + + /// Returns the maximum number of buckets of the %unordered_set. + size_type + max_bucket_count() const noexcept + { return _M_h.max_bucket_count(); } + + /* + * @brief Returns the number of elements in a given bucket. + * @param __n A bucket index. + * @return The number of elements in the bucket. + */ + size_type + bucket_size(size_type __n) const + { return _M_h.bucket_size(__n); } + + /* + * @brief Returns the bucket index of a given element. + * @param __key A key instance. + * @return The key bucket index. + */ + size_type + bucket(const key_type& __key) const + { return _M_h.bucket(__key); } + + //@{ + /** + * @brief Returns a read-only (constant) iterator pointing to the first + * bucket element. + * @param __n The bucket index. + * @return A read-only local iterator. + */ + local_iterator + begin(size_type __n) + { return _M_h.begin(__n); } + + const_local_iterator + begin(size_type __n) const + { return _M_h.begin(__n); } + + const_local_iterator + cbegin(size_type __n) const + { return _M_h.cbegin(__n); } + //@} + + //@{ + /** + * @brief Returns a read-only (constant) iterator pointing to one past + * the last bucket elements. + * @param __n The bucket index. + * @return A read-only local iterator. + */ + local_iterator + end(size_type __n) + { return _M_h.end(__n); } + + const_local_iterator + end(size_type __n) const + { return _M_h.end(__n); } + + const_local_iterator + cend(size_type __n) const + { return _M_h.cend(__n); } + //@} + + // hash policy. + + /// Returns the average number of elements per bucket. + float + load_factor() const noexcept + { return _M_h.load_factor(); } + + /// Returns a positive number that the %unordered_set tries to keep the + /// load factor less than or equal to. + float + max_load_factor() const noexcept + { return _M_h.max_load_factor(); } + + /** + * @brief Change the %unordered_set maximum load factor. + * @param __z The new maximum load factor. + */ + void + max_load_factor(float __z) + { _M_h.max_load_factor(__z); } + + /** + * @brief May rehash the %unordered_set. + * @param __n The new number of buckets. + * + * Rehash will occur only if the new number of buckets respect the + * %unordered_set maximum load factor. + */ + void + rehash(size_type __n) + { _M_h.rehash(__n); } + + /** + * @brief Prepare the %unordered_set for a specified number of + * elements. + * @param __n Number of elements required. + * + * Same as rehash(ceil(n / max_load_factor())). + */ + void + reserve(size_type __n) + { _M_h.reserve(__n); } + + template + friend bool + operator==(const unordered_set<_Value1, _Hash1, _Pred1, _Alloc1>&, + const unordered_set<_Value1, _Hash1, _Pred1, _Alloc1>&); + }; + + /** + * @brief A standard container composed of equivalent keys + * (possibly containing multiple of each key value) in which the + * elements' keys are the elements themselves. + * + * @ingroup unordered_associative_containers + * + * @tparam _Value Type of key objects. + * @tparam _Hash Hashing function object type, defaults to hash<_Value>. + * @tparam _Pred Predicate function object type, defaults + * to equal_to<_Value>. + * @tparam _Alloc Allocator type, defaults to allocator<_Key>. + * + * Meets the requirements of a container, and + * unordered associative container + * + * Base is _Hashtable, dispatched at compile time via template + * alias __umset_hashtable. + */ + template, + class _Pred = std::equal_to<_Value>, + class _Alloc = std::allocator<_Value> > + class unordered_multiset + { + typedef __umset_hashtable<_Value, _Hash, _Pred, _Alloc> _Hashtable; + _Hashtable _M_h; + + public: + // typedefs: + //@{ + /// Public typedefs. + typedef typename _Hashtable::key_type key_type; + typedef typename _Hashtable::value_type value_type; + typedef typename _Hashtable::hasher hasher; + typedef typename _Hashtable::key_equal key_equal; + typedef typename _Hashtable::allocator_type allocator_type; + //@} + + //@{ + /// Iterator-related typedefs. + typedef typename _Hashtable::pointer pointer; + typedef typename _Hashtable::const_pointer const_pointer; + typedef typename _Hashtable::reference reference; + typedef typename _Hashtable::const_reference const_reference; + typedef typename _Hashtable::iterator iterator; + typedef typename _Hashtable::const_iterator const_iterator; + typedef typename _Hashtable::local_iterator local_iterator; + typedef typename _Hashtable::const_local_iterator const_local_iterator; + typedef typename _Hashtable::size_type size_type; + typedef typename _Hashtable::difference_type difference_type; + //@} + +#if __cplusplus > 201402L + using node_type = typename _Hashtable::node_type; +#endif + + // construct/destroy/copy + + /// Default constructor. + unordered_multiset() = default; + + /** + * @brief Default constructor creates no elements. + * @param __n Minimal initial number of buckets. + * @param __hf A hash functor. + * @param __eql A key equality functor. + * @param __a An allocator object. + */ + explicit + unordered_multiset(size_type __n, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_h(__n, __hf, __eql, __a) + { } + + /** + * @brief Builds an %unordered_multiset from a range. + * @param __first An input iterator. + * @param __last An input iterator. + * @param __n Minimal initial number of buckets. + * @param __hf A hash functor. + * @param __eql A key equality functor. + * @param __a An allocator object. + * + * Create an %unordered_multiset consisting of copies of the elements + * from [__first,__last). This is linear in N (where N is + * distance(__first,__last)). + */ + template + unordered_multiset(_InputIterator __first, _InputIterator __last, + size_type __n = 0, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_h(__first, __last, __n, __hf, __eql, __a) + { } + + /// Copy constructor. + unordered_multiset(const unordered_multiset&) = default; + + /// Move constructor. + unordered_multiset(unordered_multiset&&) = default; + + /** + * @brief Builds an %unordered_multiset from an initializer_list. + * @param __l An initializer_list. + * @param __n Minimal initial number of buckets. + * @param __hf A hash functor. + * @param __eql A key equality functor. + * @param __a An allocator object. + * + * Create an %unordered_multiset consisting of copies of the elements in + * the list. This is linear in N (where N is @a __l.size()). + */ + unordered_multiset(initializer_list __l, + size_type __n = 0, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _M_h(__l, __n, __hf, __eql, __a) + { } + + /// Copy assignment operator. + unordered_multiset& + operator=(const unordered_multiset&) = default; + + /// Move assignment operator. + unordered_multiset& + operator=(unordered_multiset&&) = default; + + /** + * @brief Creates an %unordered_multiset with no elements. + * @param __a An allocator object. + */ + explicit + unordered_multiset(const allocator_type& __a) + : _M_h(__a) + { } + + /* + * @brief Copy constructor with allocator argument. + * @param __uset Input %unordered_multiset to copy. + * @param __a An allocator object. + */ + unordered_multiset(const unordered_multiset& __umset, + const allocator_type& __a) + : _M_h(__umset._M_h, __a) + { } + + /* + * @brief Move constructor with allocator argument. + * @param __umset Input %unordered_multiset to move. + * @param __a An allocator object. + */ + unordered_multiset(unordered_multiset&& __umset, + const allocator_type& __a) + : _M_h(std::move(__umset._M_h), __a) + { } + + unordered_multiset(size_type __n, const allocator_type& __a) + : unordered_multiset(__n, hasher(), key_equal(), __a) + { } + + unordered_multiset(size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multiset(__n, __hf, key_equal(), __a) + { } + + template + unordered_multiset(_InputIterator __first, _InputIterator __last, + size_type __n, + const allocator_type& __a) + : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) + { } + + template + unordered_multiset(_InputIterator __first, _InputIterator __last, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) + { } + + unordered_multiset(initializer_list __l, + size_type __n, + const allocator_type& __a) + : unordered_multiset(__l, __n, hasher(), key_equal(), __a) + { } + + unordered_multiset(initializer_list __l, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multiset(__l, __n, __hf, key_equal(), __a) + { } + + /** + * @brief %Unordered_multiset list assignment operator. + * @param __l An initializer_list. + * + * This function fills an %unordered_multiset with copies of the elements + * in the initializer list @a __l. + * + * Note that the assignment completely changes the %unordered_multiset + * and that the resulting %unordered_multiset's size is the same as the + * number of elements assigned. + */ + unordered_multiset& + operator=(initializer_list __l) + { + _M_h = __l; + return *this; + } + + /// Returns the allocator object used by the %unordered_multiset. + allocator_type + get_allocator() const noexcept + { return _M_h.get_allocator(); } + + // size and capacity: + + /// Returns true if the %unordered_multiset is empty. + bool + empty() const noexcept + { return _M_h.empty(); } + + /// Returns the size of the %unordered_multiset. + size_type + size() const noexcept + { return _M_h.size(); } + + /// Returns the maximum size of the %unordered_multiset. + size_type + max_size() const noexcept + { return _M_h.max_size(); } + + // iterators. + + //@{ + /** + * Returns a read-only (constant) iterator that points to the first + * element in the %unordered_multiset. + */ + iterator + begin() noexcept + { return _M_h.begin(); } + + const_iterator + begin() const noexcept + { return _M_h.begin(); } + //@} + + //@{ + /** + * Returns a read-only (constant) iterator that points one past the last + * element in the %unordered_multiset. + */ + iterator + end() noexcept + { return _M_h.end(); } + + const_iterator + end() const noexcept + { return _M_h.end(); } + //@} + + /** + * Returns a read-only (constant) iterator that points to the first + * element in the %unordered_multiset. + */ + const_iterator + cbegin() const noexcept + { return _M_h.begin(); } + + /** + * Returns a read-only (constant) iterator that points one past the last + * element in the %unordered_multiset. + */ + const_iterator + cend() const noexcept + { return _M_h.end(); } + + // modifiers. + + /** + * @brief Builds and insert an element into the %unordered_multiset. + * @param __args Arguments used to generate an element. + * @return An iterator that points to the inserted element. + * + * Insertion requires amortized constant time. + */ + template + iterator + emplace(_Args&&... __args) + { return _M_h.emplace(std::forward<_Args>(__args)...); } + + /** + * @brief Inserts an element into the %unordered_multiset. + * @param __pos An iterator that serves as a hint as to where the + * element should be inserted. + * @param __args Arguments used to generate the element to be + * inserted. + * @return An iterator that points to the inserted element. + * + * Note that the first parameter is only a hint and can potentially + * improve the performance of the insertion process. A bad hint would + * cause no gains in efficiency. + * + * For more on @a hinting, see: + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints + * + * Insertion requires amortized constant time. + */ + template + iterator + emplace_hint(const_iterator __pos, _Args&&... __args) + { return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); } + + //@{ + /** + * @brief Inserts an element into the %unordered_multiset. + * @param __x Element to be inserted. + * @return An iterator that points to the inserted element. + * + * Insertion requires amortized constant time. + */ + iterator + insert(const value_type& __x) + { return _M_h.insert(__x); } + + iterator + insert(value_type&& __x) + { return _M_h.insert(std::move(__x)); } + //@} + + //@{ + /** + * @brief Inserts an element into the %unordered_multiset. + * @param __hint An iterator that serves as a hint as to where the + * element should be inserted. + * @param __x Element to be inserted. + * @return An iterator that points to the inserted element. + * + * Note that the first parameter is only a hint and can potentially + * improve the performance of the insertion process. A bad hint would + * cause no gains in efficiency. + * + * For more on @a hinting, see: + * https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints + * + * Insertion requires amortized constant. + */ + iterator + insert(const_iterator __hint, const value_type& __x) + { return _M_h.insert(__hint, __x); } + + iterator + insert(const_iterator __hint, value_type&& __x) + { return _M_h.insert(__hint, std::move(__x)); } + //@} + + /** + * @brief A template function that inserts a range of elements. + * @param __first Iterator pointing to the start of the range to be + * inserted. + * @param __last Iterator pointing to the end of the range. + * + * Complexity similar to that of the range constructor. + */ + template + void + insert(_InputIterator __first, _InputIterator __last) + { _M_h.insert(__first, __last); } + + /** + * @brief Inserts a list of elements into the %unordered_multiset. + * @param __l A std::initializer_list of elements to be + * inserted. + * + * Complexity similar to that of the range constructor. + */ + void + insert(initializer_list __l) + { _M_h.insert(__l); } + +#if __cplusplus > 201402L + /// Extract a node. + node_type + extract(const_iterator __pos) + { + __glibcxx_assert(__pos != end()); + return _M_h.extract(__pos); + } + + /// Extract a node. + node_type + extract(const key_type& __key) + { return _M_h.extract(__key); } + + /// Re-insert an extracted node. + iterator + insert(node_type&& __nh) + { return _M_h._M_reinsert_node_multi(cend(), std::move(__nh)); } + + /// Re-insert an extracted node. + iterator + insert(const_iterator __hint, node_type&& __nh) + { return _M_h._M_reinsert_node_multi(__hint, std::move(__nh)); } +#endif // C++17 + + //@{ + /** + * @brief Erases an element from an %unordered_multiset. + * @param __position An iterator pointing to the element to be erased. + * @return An iterator pointing to the element immediately following + * @a __position prior to the element being erased. If no such + * element exists, end() is returned. + * + * This function erases an element, pointed to by the given iterator, + * from an %unordered_multiset. + * + * Note that this function only erases the element, and that if the + * element is itself a pointer, the pointed-to memory is not touched in + * any way. Managing the pointer is the user's responsibility. + */ + iterator + erase(const_iterator __position) + { return _M_h.erase(__position); } + + // LWG 2059. + iterator + erase(iterator __position) + { return _M_h.erase(__position); } + //@} + + + /** + * @brief Erases elements according to the provided key. + * @param __x Key of element to be erased. + * @return The number of elements erased. + * + * This function erases all the elements located by the given key from + * an %unordered_multiset. + * + * Note that this function only erases the element, and that if the + * element is itself a pointer, the pointed-to memory is not touched in + * any way. Managing the pointer is the user's responsibility. + */ + size_type + erase(const key_type& __x) + { return _M_h.erase(__x); } + + /** + * @brief Erases a [__first,__last) range of elements from an + * %unordered_multiset. + * @param __first Iterator pointing to the start of the range to be + * erased. + * @param __last Iterator pointing to the end of the range to + * be erased. + * @return The iterator @a __last. + * + * This function erases a sequence of elements from an + * %unordered_multiset. + * + * Note that this function only erases the element, and that if + * the element is itself a pointer, the pointed-to memory is not touched + * in any way. Managing the pointer is the user's responsibility. + */ + iterator + erase(const_iterator __first, const_iterator __last) + { return _M_h.erase(__first, __last); } + + /** + * Erases all elements in an %unordered_multiset. + * + * Note that this function only erases the elements, and that if the + * elements themselves are pointers, the pointed-to memory is not touched + * in any way. Managing the pointer is the user's responsibility. + */ + void + clear() noexcept + { _M_h.clear(); } + + /** + * @brief Swaps data with another %unordered_multiset. + * @param __x An %unordered_multiset of the same element and allocator + * types. + * + * This exchanges the elements between two sets in constant time. + * Note that the global std::swap() function is specialized such that + * std::swap(s1,s2) will feed to this function. + */ + void + swap(unordered_multiset& __x) + noexcept( noexcept(_M_h.swap(__x._M_h)) ) + { _M_h.swap(__x._M_h); } + +#if __cplusplus > 201402L + template + friend class _Hash_merge_helper; + + template + void + merge(unordered_multiset<_Value, _H2, _P2, _Alloc>& __source) + { + using _Merge_helper + = _Hash_merge_helper; + _M_h._M_merge_multi(_Merge_helper::_S_get_table(__source)); + } + + template + void + merge(unordered_multiset<_Value, _H2, _P2, _Alloc>&& __source) + { merge(__source); } + + template + void + merge(unordered_set<_Value, _H2, _P2, _Alloc>& __source) + { + using _Merge_helper + = _Hash_merge_helper; + _M_h._M_merge_multi(_Merge_helper::_S_get_table(__source)); + } + + template + void + merge(unordered_set<_Value, _H2, _P2, _Alloc>&& __source) + { merge(__source); } +#endif // C++17 + + // observers. + + /// Returns the hash functor object with which the %unordered_multiset + /// was constructed. + hasher + hash_function() const + { return _M_h.hash_function(); } + + /// Returns the key comparison object with which the %unordered_multiset + /// was constructed. + key_equal + key_eq() const + { return _M_h.key_eq(); } + + // lookup. + + //@{ + /** + * @brief Tries to locate an element in an %unordered_multiset. + * @param __x Element to be located. + * @return Iterator pointing to sought-after element, or end() if not + * found. + * + * This function takes a key and tries to locate the element with which + * the key matches. If successful the function returns an iterator + * pointing to the sought after element. If unsuccessful it returns the + * past-the-end ( @c end() ) iterator. + */ + iterator + find(const key_type& __x) + { return _M_h.find(__x); } + + const_iterator + find(const key_type& __x) const + { return _M_h.find(__x); } + //@} + + /** + * @brief Finds the number of elements. + * @param __x Element to located. + * @return Number of elements with specified key. + */ + size_type + count(const key_type& __x) const + { return _M_h.count(__x); } + + //@{ + /** + * @brief Finds a subsequence matching given key. + * @param __x Key to be located. + * @return Pair of iterators that possibly points to the subsequence + * matching given key. + */ + std::pair + equal_range(const key_type& __x) + { return _M_h.equal_range(__x); } + + std::pair + equal_range(const key_type& __x) const + { return _M_h.equal_range(__x); } + //@} + + // bucket interface. + + /// Returns the number of buckets of the %unordered_multiset. + size_type + bucket_count() const noexcept + { return _M_h.bucket_count(); } + + /// Returns the maximum number of buckets of the %unordered_multiset. + size_type + max_bucket_count() const noexcept + { return _M_h.max_bucket_count(); } + + /* + * @brief Returns the number of elements in a given bucket. + * @param __n A bucket index. + * @return The number of elements in the bucket. + */ + size_type + bucket_size(size_type __n) const + { return _M_h.bucket_size(__n); } + + /* + * @brief Returns the bucket index of a given element. + * @param __key A key instance. + * @return The key bucket index. + */ + size_type + bucket(const key_type& __key) const + { return _M_h.bucket(__key); } + + //@{ + /** + * @brief Returns a read-only (constant) iterator pointing to the first + * bucket element. + * @param __n The bucket index. + * @return A read-only local iterator. + */ + local_iterator + begin(size_type __n) + { return _M_h.begin(__n); } + + const_local_iterator + begin(size_type __n) const + { return _M_h.begin(__n); } + + const_local_iterator + cbegin(size_type __n) const + { return _M_h.cbegin(__n); } + //@} + + //@{ + /** + * @brief Returns a read-only (constant) iterator pointing to one past + * the last bucket elements. + * @param __n The bucket index. + * @return A read-only local iterator. + */ + local_iterator + end(size_type __n) + { return _M_h.end(__n); } + + const_local_iterator + end(size_type __n) const + { return _M_h.end(__n); } + + const_local_iterator + cend(size_type __n) const + { return _M_h.cend(__n); } + //@} + + // hash policy. + + /// Returns the average number of elements per bucket. + float + load_factor() const noexcept + { return _M_h.load_factor(); } + + /// Returns a positive number that the %unordered_multiset tries to keep the + /// load factor less than or equal to. + float + max_load_factor() const noexcept + { return _M_h.max_load_factor(); } + + /** + * @brief Change the %unordered_multiset maximum load factor. + * @param __z The new maximum load factor. + */ + void + max_load_factor(float __z) + { _M_h.max_load_factor(__z); } + + /** + * @brief May rehash the %unordered_multiset. + * @param __n The new number of buckets. + * + * Rehash will occur only if the new number of buckets respect the + * %unordered_multiset maximum load factor. + */ + void + rehash(size_type __n) + { _M_h.rehash(__n); } + + /** + * @brief Prepare the %unordered_multiset for a specified number of + * elements. + * @param __n Number of elements required. + * + * Same as rehash(ceil(n / max_load_factor())). + */ + void + reserve(size_type __n) + { _M_h.reserve(__n); } + + template + friend bool + operator==(const unordered_multiset<_Value1, _Hash1, _Pred1, _Alloc1>&, + const unordered_multiset<_Value1, _Hash1, _Pred1, _Alloc1>&); + }; + + template + inline void + swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, + unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) + noexcept(noexcept(__x.swap(__y))) + { __x.swap(__y); } + + template + inline void + swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, + unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) + noexcept(noexcept(__x.swap(__y))) + { __x.swap(__y); } + + template + inline bool + operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, + const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) + { return __x._M_h._M_equal(__y._M_h); } + + template + inline bool + operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, + const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) + { return !(__x == __y); } + + template + inline bool + operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, + const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) + { return __x._M_h._M_equal(__y._M_h); } + + template + inline bool + operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, + const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) + { return !(__x == __y); } + +_GLIBCXX_END_NAMESPACE_CONTAINER + +#if __cplusplus > 201402L +_GLIBCXX_BEGIN_NAMESPACE_VERSION + // Allow std::unordered_set access to internals of compatible sets. + template + struct _Hash_merge_helper< + _GLIBCXX_STD_C::unordered_set<_Val, _Hash1, _Eq1, _Alloc>, _Hash2, _Eq2> + { + private: + template + using unordered_set = _GLIBCXX_STD_C::unordered_set<_Tp...>; + template + using unordered_multiset = _GLIBCXX_STD_C::unordered_multiset<_Tp...>; + + friend unordered_set<_Val, _Hash1, _Eq1, _Alloc>; + + static auto& + _S_get_table(unordered_set<_Val, _Hash2, _Eq2, _Alloc>& __set) + { return __set._M_h; } + + static auto& + _S_get_table(unordered_multiset<_Val, _Hash2, _Eq2, _Alloc>& __set) + { return __set._M_h; } + }; + + // Allow std::unordered_multiset access to internals of compatible sets. + template + struct _Hash_merge_helper< + _GLIBCXX_STD_C::unordered_multiset<_Val, _Hash1, _Eq1, _Alloc>, + _Hash2, _Eq2> + { + private: + template + using unordered_set = _GLIBCXX_STD_C::unordered_set<_Tp...>; + template + using unordered_multiset = _GLIBCXX_STD_C::unordered_multiset<_Tp...>; + + friend unordered_multiset<_Val, _Hash1, _Eq1, _Alloc>; + + static auto& + _S_get_table(unordered_set<_Val, _Hash2, _Eq2, _Alloc>& __set) + { return __set._M_h; } + + static auto& + _S_get_table(unordered_multiset<_Val, _Hash2, _Eq2, _Alloc>& __set) + { return __set._M_h; } + }; +_GLIBCXX_END_NAMESPACE_VERSION +#endif // C++17 + +} // namespace std + +#endif /* _UNORDERED_SET_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/uses_allocator.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/uses_allocator.h new file mode 100644 index 0000000..4d60716 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/uses_allocator.h @@ -0,0 +1,186 @@ +// Uses-allocator Construction -*- C++ -*- + +// Copyright (C) 2010-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +#ifndef _USES_ALLOCATOR_H +#define _USES_ALLOCATOR_H 1 + +#if __cplusplus < 201103L +# include +#else + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + struct __erased_type { }; + + template + using __is_erased_or_convertible + = __or_, is_convertible<_Alloc, _Tp>>; + + /// [allocator.tag] + struct allocator_arg_t { explicit allocator_arg_t() = default; }; + + _GLIBCXX17_INLINE constexpr allocator_arg_t allocator_arg = + allocator_arg_t(); + + template> + struct __uses_allocator_helper + : false_type { }; + + template + struct __uses_allocator_helper<_Tp, _Alloc, + __void_t> + : __is_erased_or_convertible<_Alloc, typename _Tp::allocator_type>::type + { }; + + /// [allocator.uses.trait] + template + struct uses_allocator + : __uses_allocator_helper<_Tp, _Alloc>::type + { }; + + struct __uses_alloc_base { }; + + struct __uses_alloc0 : __uses_alloc_base + { + struct _Sink { void operator=(const void*) { } } _M_a; + }; + + template + struct __uses_alloc1 : __uses_alloc_base { const _Alloc* _M_a; }; + + template + struct __uses_alloc2 : __uses_alloc_base { const _Alloc* _M_a; }; + + template + struct __uses_alloc; + + template + struct __uses_alloc + : conditional< + is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value, + __uses_alloc1<_Alloc>, + __uses_alloc2<_Alloc>>::type + { + static_assert(__or_< + is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>, + is_constructible<_Tp, _Args..., _Alloc>>::value, "construction with" + " an allocator must be possible if uses_allocator is true"); + }; + + template + struct __uses_alloc + : __uses_alloc0 { }; + + template + using __uses_alloc_t = + __uses_alloc::value, _Tp, _Alloc, _Args...>; + + template + inline __uses_alloc_t<_Tp, _Alloc, _Args...> + __use_alloc(const _Alloc& __a) + { + __uses_alloc_t<_Tp, _Alloc, _Args...> __ret; + __ret._M_a = std::__addressof(__a); + return __ret; + } + + template + void + __use_alloc(const _Alloc&&) = delete; + +#if __cplusplus > 201402L + template + inline constexpr bool uses_allocator_v = + uses_allocator<_Tp, _Alloc>::value; +#endif // C++17 + + template class _Predicate, + typename _Tp, typename _Alloc, typename... _Args> + struct __is_uses_allocator_predicate + : conditional::value, + __or_<_Predicate<_Tp, allocator_arg_t, _Alloc, _Args...>, + _Predicate<_Tp, _Args..., _Alloc>>, + _Predicate<_Tp, _Args...>>::type { }; + + template + struct __is_uses_allocator_constructible + : __is_uses_allocator_predicate + { }; + +#if __cplusplus >= 201402L + template + _GLIBCXX17_INLINE constexpr bool __is_uses_allocator_constructible_v = + __is_uses_allocator_constructible<_Tp, _Alloc, _Args...>::value; +#endif // C++14 + + template + struct __is_nothrow_uses_allocator_constructible + : __is_uses_allocator_predicate + { }; + + +#if __cplusplus >= 201402L + template + _GLIBCXX17_INLINE constexpr bool + __is_nothrow_uses_allocator_constructible_v = + __is_nothrow_uses_allocator_constructible<_Tp, _Alloc, _Args...>::value; +#endif // C++14 + + template + void __uses_allocator_construct_impl(__uses_alloc0 __a, _Tp* __ptr, + _Args&&... __args) + { ::new ((void*)__ptr) _Tp(std::forward<_Args>(__args)...); } + + template + void __uses_allocator_construct_impl(__uses_alloc1<_Alloc> __a, _Tp* __ptr, + _Args&&... __args) + { + ::new ((void*)__ptr) _Tp(allocator_arg, *__a._M_a, + std::forward<_Args>(__args)...); + } + + template + void __uses_allocator_construct_impl(__uses_alloc2<_Alloc> __a, _Tp* __ptr, + _Args&&... __args) + { ::new ((void*)__ptr) _Tp(std::forward<_Args>(__args)..., *__a._M_a); } + + template + void __uses_allocator_construct(const _Alloc& __a, _Tp* __ptr, + _Args&&... __args) + { + __uses_allocator_construct_impl(__use_alloc<_Tp, _Alloc, _Args...>(__a), + __ptr, std::forward<_Args>(__args)...); + } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/valarray_after.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/valarray_after.h new file mode 100644 index 0000000..54ba7fe --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/valarray_after.h @@ -0,0 +1,551 @@ +// The template and inlines for the -*- C++ -*- internal _Meta class. + +// Copyright (C) 1997-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/valarray_after.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{valarray} + */ + +// Written by Gabriel Dos Reis + +#ifndef _VALARRAY_AFTER_H +#define _VALARRAY_AFTER_H 1 + +#pragma GCC system_header + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // + // gslice_array closure. + // + template + class _GBase + { + public: + typedef typename _Dom::value_type value_type; + + _GBase (const _Dom& __e, const valarray& __i) + : _M_expr (__e), _M_index(__i) {} + + value_type + operator[] (size_t __i) const + { return _M_expr[_M_index[__i]]; } + + size_t + size () const + { return _M_index.size(); } + + private: + const _Dom& _M_expr; + const valarray& _M_index; + }; + + template + class _GBase<_Array<_Tp> > + { + public: + typedef _Tp value_type; + + _GBase (_Array<_Tp> __a, const valarray& __i) + : _M_array (__a), _M_index(__i) {} + + value_type + operator[] (size_t __i) const + { return _M_array._M_data[_M_index[__i]]; } + + size_t + size () const + { return _M_index.size(); } + + private: + const _Array<_Tp> _M_array; + const valarray& _M_index; + }; + + template + struct _GClos<_Expr, _Dom> + : _GBase<_Dom> + { + typedef _GBase<_Dom> _Base; + typedef typename _Base::value_type value_type; + + _GClos (const _Dom& __e, const valarray& __i) + : _Base (__e, __i) {} + }; + + template + struct _GClos<_ValArray, _Tp> + : _GBase<_Array<_Tp> > + { + typedef _GBase<_Array<_Tp> > _Base; + typedef typename _Base::value_type value_type; + + _GClos (_Array<_Tp> __a, const valarray& __i) + : _Base (__a, __i) {} + }; + + // + // indirect_array closure + // + template + class _IBase + { + public: + typedef typename _Dom::value_type value_type; + + _IBase (const _Dom& __e, const valarray& __i) + : _M_expr (__e), _M_index (__i) {} + + value_type + operator[] (size_t __i) const + { return _M_expr[_M_index[__i]]; } + + size_t + size() const + { return _M_index.size(); } + + private: + const _Dom& _M_expr; + const valarray& _M_index; + }; + + template + struct _IClos<_Expr, _Dom> + : _IBase<_Dom> + { + typedef _IBase<_Dom> _Base; + typedef typename _Base::value_type value_type; + + _IClos (const _Dom& __e, const valarray& __i) + : _Base (__e, __i) {} + }; + + template + struct _IClos<_ValArray, _Tp> + : _IBase > + { + typedef _IBase > _Base; + typedef _Tp value_type; + + _IClos (const valarray<_Tp>& __a, const valarray& __i) + : _Base (__a, __i) {} + }; + + // + // class _Expr + // + template + class _Expr + { + public: + typedef _Tp value_type; + + _Expr(const _Clos&); + + const _Clos& operator()() const; + + value_type operator[](size_t) const; + valarray operator[](slice) const; + valarray operator[](const gslice&) const; + valarray operator[](const valarray&) const; + valarray operator[](const valarray&) const; + + _Expr<_UnClos<__unary_plus, std::_Expr, _Clos>, value_type> + operator+() const; + + _Expr<_UnClos<__negate, std::_Expr, _Clos>, value_type> + operator-() const; + + _Expr<_UnClos<__bitwise_not, std::_Expr, _Clos>, value_type> + operator~() const; + + _Expr<_UnClos<__logical_not, std::_Expr, _Clos>, bool> + operator!() const; + + size_t size() const; + value_type sum() const; + + valarray shift(int) const; + valarray cshift(int) const; + + value_type min() const; + value_type max() const; + + valarray apply(value_type (*)(const value_type&)) const; + valarray apply(value_type (*)(value_type)) const; + + private: + const _Clos _M_closure; + }; + + template + inline + _Expr<_Clos, _Tp>::_Expr(const _Clos& __c) : _M_closure(__c) {} + + template + inline const _Clos& + _Expr<_Clos, _Tp>::operator()() const + { return _M_closure; } + + template + inline _Tp + _Expr<_Clos, _Tp>::operator[](size_t __i) const + { return _M_closure[__i]; } + + template + inline valarray<_Tp> + _Expr<_Clos, _Tp>::operator[](slice __s) const + { + valarray<_Tp> __v = valarray<_Tp>(*this)[__s]; + return __v; + } + + template + inline valarray<_Tp> + _Expr<_Clos, _Tp>::operator[](const gslice& __gs) const + { + valarray<_Tp> __v = valarray<_Tp>(*this)[__gs]; + return __v; + } + + template + inline valarray<_Tp> + _Expr<_Clos, _Tp>::operator[](const valarray& __m) const + { + valarray<_Tp> __v = valarray<_Tp>(*this)[__m]; + return __v; + } + + template + inline valarray<_Tp> + _Expr<_Clos, _Tp>::operator[](const valarray& __i) const + { + valarray<_Tp> __v = valarray<_Tp>(*this)[__i]; + return __v; + } + + template + inline size_t + _Expr<_Clos, _Tp>::size() const + { return _M_closure.size(); } + + template + inline valarray<_Tp> + _Expr<_Clos, _Tp>::shift(int __n) const + { + valarray<_Tp> __v = valarray<_Tp>(*this).shift(__n); + return __v; + } + + template + inline valarray<_Tp> + _Expr<_Clos, _Tp>::cshift(int __n) const + { + valarray<_Tp> __v = valarray<_Tp>(*this).cshift(__n); + return __v; + } + + template + inline valarray<_Tp> + _Expr<_Clos, _Tp>::apply(_Tp __f(const _Tp&)) const + { + valarray<_Tp> __v = valarray<_Tp>(*this).apply(__f); + return __v; + } + + template + inline valarray<_Tp> + _Expr<_Clos, _Tp>::apply(_Tp __f(_Tp)) const + { + valarray<_Tp> __v = valarray<_Tp>(*this).apply(__f); + return __v; + } + + // XXX: replace this with a more robust summation algorithm. + template + inline _Tp + _Expr<_Clos, _Tp>::sum() const + { + size_t __n = _M_closure.size(); + if (__n == 0) + return _Tp(); + else + { + _Tp __s = _M_closure[--__n]; + while (__n != 0) + __s += _M_closure[--__n]; + return __s; + } + } + + template + inline _Tp + _Expr<_Clos, _Tp>::min() const + { return __valarray_min(_M_closure); } + + template + inline _Tp + _Expr<_Clos, _Tp>::max() const + { return __valarray_max(_M_closure); } + + template + inline _Expr<_UnClos<__logical_not, _Expr, _Dom>, bool> + _Expr<_Dom, _Tp>::operator!() const + { + typedef _UnClos<__logical_not, std::_Expr, _Dom> _Closure; + return _Expr<_Closure, bool>(_Closure(this->_M_closure)); + } + +#define _DEFINE_EXPR_UNARY_OPERATOR(_Op, _Name) \ + template \ + inline _Expr<_UnClos<_Name, std::_Expr, _Dom>, _Tp> \ + _Expr<_Dom, _Tp>::operator _Op() const \ + { \ + typedef _UnClos<_Name, std::_Expr, _Dom> _Closure; \ + return _Expr<_Closure, _Tp>(_Closure(this->_M_closure)); \ + } + + _DEFINE_EXPR_UNARY_OPERATOR(+, __unary_plus) + _DEFINE_EXPR_UNARY_OPERATOR(-, __negate) + _DEFINE_EXPR_UNARY_OPERATOR(~, __bitwise_not) + +#undef _DEFINE_EXPR_UNARY_OPERATOR + +#define _DEFINE_EXPR_BINARY_OPERATOR(_Op, _Name) \ + template \ + inline _Expr<_BinClos<_Name, _Expr, _Expr, _Dom1, _Dom2>, \ + typename __fun<_Name, typename _Dom1::value_type>::result_type> \ + operator _Op(const _Expr<_Dom1, typename _Dom1::value_type>& __v, \ + const _Expr<_Dom2, typename _Dom2::value_type>& __w) \ + { \ + typedef typename _Dom1::value_type _Arg; \ + typedef typename __fun<_Name, _Arg>::result_type _Value; \ + typedef _BinClos<_Name, _Expr, _Expr, _Dom1, _Dom2> _Closure; \ + return _Expr<_Closure, _Value>(_Closure(__v(), __w())); \ + } \ + \ + template \ + inline _Expr<_BinClos<_Name, _Expr, _Constant, _Dom, \ + typename _Dom::value_type>, \ + typename __fun<_Name, typename _Dom::value_type>::result_type> \ + operator _Op(const _Expr<_Dom, typename _Dom::value_type>& __v, \ + const typename _Dom::value_type& __t) \ + { \ + typedef typename _Dom::value_type _Arg; \ + typedef typename __fun<_Name, _Arg>::result_type _Value; \ + typedef _BinClos<_Name, _Expr, _Constant, _Dom, _Arg> _Closure; \ + return _Expr<_Closure, _Value>(_Closure(__v(), __t)); \ + } \ + \ + template \ + inline _Expr<_BinClos<_Name, _Constant, _Expr, \ + typename _Dom::value_type, _Dom>, \ + typename __fun<_Name, typename _Dom::value_type>::result_type> \ + operator _Op(const typename _Dom::value_type& __t, \ + const _Expr<_Dom, typename _Dom::value_type>& __v) \ + { \ + typedef typename _Dom::value_type _Arg; \ + typedef typename __fun<_Name, _Arg>::result_type _Value; \ + typedef _BinClos<_Name, _Constant, _Expr, _Arg, _Dom> _Closure; \ + return _Expr<_Closure, _Value>(_Closure(__t, __v())); \ + } \ + \ + template \ + inline _Expr<_BinClos<_Name, _Expr, _ValArray, \ + _Dom, typename _Dom::value_type>, \ + typename __fun<_Name, typename _Dom::value_type>::result_type> \ + operator _Op(const _Expr<_Dom,typename _Dom::value_type>& __e, \ + const valarray& __v) \ + { \ + typedef typename _Dom::value_type _Arg; \ + typedef typename __fun<_Name, _Arg>::result_type _Value; \ + typedef _BinClos<_Name, _Expr, _ValArray, _Dom, _Arg> _Closure; \ + return _Expr<_Closure, _Value>(_Closure(__e(), __v)); \ + } \ + \ + template \ + inline _Expr<_BinClos<_Name, _ValArray, _Expr, \ + typename _Dom::value_type, _Dom>, \ + typename __fun<_Name, typename _Dom::value_type>::result_type> \ + operator _Op(const valarray& __v, \ + const _Expr<_Dom, typename _Dom::value_type>& __e) \ + { \ + typedef typename _Dom::value_type _Tp; \ + typedef typename __fun<_Name, _Tp>::result_type _Value; \ + typedef _BinClos<_Name, _ValArray, _Expr, _Tp, _Dom> _Closure; \ + return _Expr<_Closure, _Value>(_Closure(__v, __e ())); \ + } + + _DEFINE_EXPR_BINARY_OPERATOR(+, __plus) + _DEFINE_EXPR_BINARY_OPERATOR(-, __minus) + _DEFINE_EXPR_BINARY_OPERATOR(*, __multiplies) + _DEFINE_EXPR_BINARY_OPERATOR(/, __divides) + _DEFINE_EXPR_BINARY_OPERATOR(%, __modulus) + _DEFINE_EXPR_BINARY_OPERATOR(^, __bitwise_xor) + _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and) + _DEFINE_EXPR_BINARY_OPERATOR(|, __bitwise_or) + _DEFINE_EXPR_BINARY_OPERATOR(<<, __shift_left) + _DEFINE_EXPR_BINARY_OPERATOR(>>, __shift_right) + _DEFINE_EXPR_BINARY_OPERATOR(&&, __logical_and) + _DEFINE_EXPR_BINARY_OPERATOR(||, __logical_or) + _DEFINE_EXPR_BINARY_OPERATOR(==, __equal_to) + _DEFINE_EXPR_BINARY_OPERATOR(!=, __not_equal_to) + _DEFINE_EXPR_BINARY_OPERATOR(<, __less) + _DEFINE_EXPR_BINARY_OPERATOR(>, __greater) + _DEFINE_EXPR_BINARY_OPERATOR(<=, __less_equal) + _DEFINE_EXPR_BINARY_OPERATOR(>=, __greater_equal) + +#undef _DEFINE_EXPR_BINARY_OPERATOR + +#define _DEFINE_EXPR_UNARY_FUNCTION(_Name, _UName) \ + template \ + inline _Expr<_UnClos<_UName, _Expr, _Dom>, \ + typename _Dom::value_type> \ + _Name(const _Expr<_Dom, typename _Dom::value_type>& __e) \ + { \ + typedef typename _Dom::value_type _Tp; \ + typedef _UnClos<_UName, _Expr, _Dom> _Closure; \ + return _Expr<_Closure, _Tp>(_Closure(__e())); \ + } \ + \ + template \ + inline _Expr<_UnClos<_UName, _ValArray, _Tp>, _Tp> \ + _Name(const valarray<_Tp>& __v) \ + { \ + typedef _UnClos<_UName, _ValArray, _Tp> _Closure; \ + return _Expr<_Closure, _Tp>(_Closure(__v)); \ + } + + _DEFINE_EXPR_UNARY_FUNCTION(abs, _Abs) + _DEFINE_EXPR_UNARY_FUNCTION(cos, _Cos) + _DEFINE_EXPR_UNARY_FUNCTION(acos, _Acos) + _DEFINE_EXPR_UNARY_FUNCTION(cosh, _Cosh) + _DEFINE_EXPR_UNARY_FUNCTION(sin, _Sin) + _DEFINE_EXPR_UNARY_FUNCTION(asin, _Asin) + _DEFINE_EXPR_UNARY_FUNCTION(sinh, _Sinh) + _DEFINE_EXPR_UNARY_FUNCTION(tan, _Tan) + _DEFINE_EXPR_UNARY_FUNCTION(tanh, _Tanh) + _DEFINE_EXPR_UNARY_FUNCTION(atan, _Atan) + _DEFINE_EXPR_UNARY_FUNCTION(exp, _Exp) + _DEFINE_EXPR_UNARY_FUNCTION(log, _Log) + _DEFINE_EXPR_UNARY_FUNCTION(log10, _Log10) + _DEFINE_EXPR_UNARY_FUNCTION(sqrt, _Sqrt) + +#undef _DEFINE_EXPR_UNARY_FUNCTION + +#define _DEFINE_EXPR_BINARY_FUNCTION(_Fun, _UFun) \ + template \ + inline _Expr<_BinClos<_UFun, _Expr, _Expr, _Dom1, _Dom2>, \ + typename _Dom1::value_type> \ + _Fun(const _Expr<_Dom1, typename _Dom1::value_type>& __e1, \ + const _Expr<_Dom2, typename _Dom2::value_type>& __e2) \ + { \ + typedef typename _Dom1::value_type _Tp; \ + typedef _BinClos<_UFun, _Expr, _Expr, _Dom1, _Dom2> _Closure; \ + return _Expr<_Closure, _Tp>(_Closure(__e1(), __e2())); \ + } \ + \ + template \ + inline _Expr<_BinClos<_UFun, _Expr, _ValArray, _Dom, \ + typename _Dom::value_type>, \ + typename _Dom::value_type> \ + _Fun(const _Expr<_Dom, typename _Dom::value_type>& __e, \ + const valarray& __v) \ + { \ + typedef typename _Dom::value_type _Tp; \ + typedef _BinClos<_UFun, _Expr, _ValArray, _Dom, _Tp> _Closure; \ + return _Expr<_Closure, _Tp>(_Closure(__e(), __v)); \ + } \ + \ + template \ + inline _Expr<_BinClos<_UFun, _ValArray, _Expr, \ + typename _Dom::value_type, _Dom>, \ + typename _Dom::value_type> \ + _Fun(const valarray& __v, \ + const _Expr<_Dom, typename _Dom::value_type>& __e) \ + { \ + typedef typename _Dom::value_type _Tp; \ + typedef _BinClos<_UFun, _ValArray, _Expr, _Tp, _Dom> _Closure; \ + return _Expr<_Closure, _Tp>(_Closure(__v, __e())); \ + } \ + \ + template \ + inline _Expr<_BinClos<_UFun, _Expr, _Constant, _Dom, \ + typename _Dom::value_type>, \ + typename _Dom::value_type> \ + _Fun(const _Expr<_Dom, typename _Dom::value_type>& __e, \ + const typename _Dom::value_type& __t) \ + { \ + typedef typename _Dom::value_type _Tp; \ + typedef _BinClos<_UFun, _Expr, _Constant, _Dom, _Tp> _Closure; \ + return _Expr<_Closure, _Tp>(_Closure(__e(), __t)); \ + } \ + \ + template \ + inline _Expr<_BinClos<_UFun, _Constant, _Expr, \ + typename _Dom::value_type, _Dom>, \ + typename _Dom::value_type> \ + _Fun(const typename _Dom::value_type& __t, \ + const _Expr<_Dom, typename _Dom::value_type>& __e) \ + { \ + typedef typename _Dom::value_type _Tp; \ + typedef _BinClos<_UFun, _Constant, _Expr, _Tp, _Dom> _Closure; \ + return _Expr<_Closure, _Tp>(_Closure(__t, __e())); \ + } \ + \ + template \ + inline _Expr<_BinClos<_UFun, _ValArray, _ValArray, _Tp, _Tp>, _Tp> \ + _Fun(const valarray<_Tp>& __v, const valarray<_Tp>& __w) \ + { \ + typedef _BinClos<_UFun, _ValArray, _ValArray, _Tp, _Tp> _Closure;\ + return _Expr<_Closure, _Tp>(_Closure(__v, __w)); \ + } \ + \ + template \ + inline _Expr<_BinClos<_UFun, _ValArray, _Constant, _Tp, _Tp>, _Tp> \ + _Fun(const valarray<_Tp>& __v, const _Tp& __t) \ + { \ + typedef _BinClos<_UFun, _ValArray, _Constant, _Tp, _Tp> _Closure;\ + return _Expr<_Closure, _Tp>(_Closure(__v, __t)); \ + } \ + \ + template \ + inline _Expr<_BinClos<_UFun, _Constant, _ValArray, _Tp, _Tp>, _Tp> \ + _Fun(const _Tp& __t, const valarray<_Tp>& __v) \ + { \ + typedef _BinClos<_UFun, _Constant, _ValArray, _Tp, _Tp> _Closure;\ + return _Expr<_Closure, _Tp>(_Closure(__t, __v)); \ + } + +_DEFINE_EXPR_BINARY_FUNCTION(atan2, _Atan2) +_DEFINE_EXPR_BINARY_FUNCTION(pow, _Pow) + +#undef _DEFINE_EXPR_BINARY_FUNCTION + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _CPP_VALARRAY_AFTER_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/valarray_array.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/valarray_array.h new file mode 100644 index 0000000..f169edd --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/valarray_array.h @@ -0,0 +1,693 @@ +// The template and inlines for the -*- C++ -*- internal _Array helper class. + +// Copyright (C) 1997-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/valarray_array.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{valarray} + */ + +// Written by Gabriel Dos Reis + +#ifndef _VALARRAY_ARRAY_H +#define _VALARRAY_ARRAY_H 1 + +#pragma GCC system_header + +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // + // Helper functions on raw pointers + // + + // We get memory by the old fashion way + inline void* + __valarray_get_memory(size_t __n) + { return operator new(__n); } + + template + inline _Tp*__restrict__ + __valarray_get_storage(size_t __n) + { + return static_cast<_Tp*__restrict__> + (std::__valarray_get_memory(__n * sizeof(_Tp))); + } + + // Return memory to the system + inline void + __valarray_release_memory(void* __p) + { operator delete(__p); } + + // Turn a raw-memory into an array of _Tp filled with _Tp() + // This is required in 'valarray v(n);' + template + struct _Array_default_ctor + { + // Please note that this isn't exception safe. But + // valarrays aren't required to be exception safe. + inline static void + _S_do_it(_Tp* __b, _Tp* __e) + { + while (__b != __e) + new(__b++) _Tp(); + } + }; + + template + struct _Array_default_ctor<_Tp, true> + { + // For fundamental types, it suffices to say 'memset()' + inline static void + _S_do_it(_Tp* __b, _Tp* __e) + { __builtin_memset(__b, 0, (__e - __b) * sizeof(_Tp)); } + }; + + template + inline void + __valarray_default_construct(_Tp* __b, _Tp* __e) + { + _Array_default_ctor<_Tp, __is_scalar<_Tp>::__value>::_S_do_it(__b, __e); + } + + // Turn a raw-memory into an array of _Tp filled with __t + // This is the required in valarray v(n, t). Also + // used in valarray<>::resize(). + template + struct _Array_init_ctor + { + // Please note that this isn't exception safe. But + // valarrays aren't required to be exception safe. + inline static void + _S_do_it(_Tp* __b, _Tp* __e, const _Tp __t) + { + while (__b != __e) + new(__b++) _Tp(__t); + } + }; + + template + struct _Array_init_ctor<_Tp, true> + { + inline static void + _S_do_it(_Tp* __b, _Tp* __e, const _Tp __t) + { + while (__b != __e) + *__b++ = __t; + } + }; + + template + inline void + __valarray_fill_construct(_Tp* __b, _Tp* __e, const _Tp __t) + { + _Array_init_ctor<_Tp, __is_trivial(_Tp)>::_S_do_it(__b, __e, __t); + } + + // + // copy-construct raw array [__o, *) from plain array [__b, __e) + // We can't just say 'memcpy()' + // + template + struct _Array_copy_ctor + { + // Please note that this isn't exception safe. But + // valarrays aren't required to be exception safe. + inline static void + _S_do_it(const _Tp* __b, const _Tp* __e, _Tp* __restrict__ __o) + { + while (__b != __e) + new(__o++) _Tp(*__b++); + } + }; + + template + struct _Array_copy_ctor<_Tp, true> + { + inline static void + _S_do_it(const _Tp* __b, const _Tp* __e, _Tp* __restrict__ __o) + { __builtin_memcpy(__o, __b, (__e - __b) * sizeof(_Tp)); } + }; + + template + inline void + __valarray_copy_construct(const _Tp* __b, const _Tp* __e, + _Tp* __restrict__ __o) + { + _Array_copy_ctor<_Tp, __is_trivial(_Tp)>::_S_do_it(__b, __e, __o); + } + + // copy-construct raw array [__o, *) from strided array __a[<__n : __s>] + template + inline void + __valarray_copy_construct (const _Tp* __restrict__ __a, size_t __n, + size_t __s, _Tp* __restrict__ __o) + { + if (__is_trivial(_Tp)) + while (__n--) + { + *__o++ = *__a; + __a += __s; + } + else + while (__n--) + { + new(__o++) _Tp(*__a); + __a += __s; + } + } + + // copy-construct raw array [__o, *) from indexed array __a[__i[<__n>]] + template + inline void + __valarray_copy_construct (const _Tp* __restrict__ __a, + const size_t* __restrict__ __i, + _Tp* __restrict__ __o, size_t __n) + { + if (__is_trivial(_Tp)) + while (__n--) + *__o++ = __a[*__i++]; + else + while (__n--) + new (__o++) _Tp(__a[*__i++]); + } + + // Do the necessary cleanup when we're done with arrays. + template + inline void + __valarray_destroy_elements(_Tp* __b, _Tp* __e) + { + if (!__is_trivial(_Tp)) + while (__b != __e) + { + __b->~_Tp(); + ++__b; + } + } + + // Fill a plain array __a[<__n>] with __t + template + inline void + __valarray_fill(_Tp* __restrict__ __a, size_t __n, const _Tp& __t) + { + while (__n--) + *__a++ = __t; + } + + // fill strided array __a[<__n-1 : __s>] with __t + template + inline void + __valarray_fill(_Tp* __restrict__ __a, size_t __n, + size_t __s, const _Tp& __t) + { + for (size_t __i = 0; __i < __n; ++__i, __a += __s) + *__a = __t; + } + + // fill indirect array __a[__i[<__n>]] with __i + template + inline void + __valarray_fill(_Tp* __restrict__ __a, const size_t* __restrict__ __i, + size_t __n, const _Tp& __t) + { + for (size_t __j = 0; __j < __n; ++__j, ++__i) + __a[*__i] = __t; + } + + // copy plain array __a[<__n>] in __b[<__n>] + // For non-fundamental types, it is wrong to say 'memcpy()' + template + struct _Array_copier + { + inline static void + _S_do_it(const _Tp* __restrict__ __a, size_t __n, _Tp* __restrict__ __b) + { + while(__n--) + *__b++ = *__a++; + } + }; + + template + struct _Array_copier<_Tp, true> + { + inline static void + _S_do_it(const _Tp* __restrict__ __a, size_t __n, _Tp* __restrict__ __b) + { __builtin_memcpy(__b, __a, __n * sizeof (_Tp)); } + }; + + // Copy a plain array __a[<__n>] into a play array __b[<>] + template + inline void + __valarray_copy(const _Tp* __restrict__ __a, size_t __n, + _Tp* __restrict__ __b) + { + _Array_copier<_Tp, __is_trivial(_Tp)>::_S_do_it(__a, __n, __b); + } + + // Copy strided array __a[<__n : __s>] in plain __b[<__n>] + template + inline void + __valarray_copy(const _Tp* __restrict__ __a, size_t __n, size_t __s, + _Tp* __restrict__ __b) + { + for (size_t __i = 0; __i < __n; ++__i, ++__b, __a += __s) + *__b = *__a; + } + + // Copy a plain array __a[<__n>] into a strided array __b[<__n : __s>] + template + inline void + __valarray_copy(const _Tp* __restrict__ __a, _Tp* __restrict__ __b, + size_t __n, size_t __s) + { + for (size_t __i = 0; __i < __n; ++__i, ++__a, __b += __s) + *__b = *__a; + } + + // Copy strided array __src[<__n : __s1>] into another + // strided array __dst[< : __s2>]. Their sizes must match. + template + inline void + __valarray_copy(const _Tp* __restrict__ __src, size_t __n, size_t __s1, + _Tp* __restrict__ __dst, size_t __s2) + { + for (size_t __i = 0; __i < __n; ++__i) + __dst[__i * __s2] = __src[__i * __s1]; + } + + // Copy an indexed array __a[__i[<__n>]] in plain array __b[<__n>] + template + inline void + __valarray_copy(const _Tp* __restrict__ __a, + const size_t* __restrict__ __i, + _Tp* __restrict__ __b, size_t __n) + { + for (size_t __j = 0; __j < __n; ++__j, ++__b, ++__i) + *__b = __a[*__i]; + } + + // Copy a plain array __a[<__n>] in an indexed array __b[__i[<__n>]] + template + inline void + __valarray_copy(const _Tp* __restrict__ __a, size_t __n, + _Tp* __restrict__ __b, const size_t* __restrict__ __i) + { + for (size_t __j = 0; __j < __n; ++__j, ++__a, ++__i) + __b[*__i] = *__a; + } + + // Copy the __n first elements of an indexed array __src[<__i>] into + // another indexed array __dst[<__j>]. + template + inline void + __valarray_copy(const _Tp* __restrict__ __src, size_t __n, + const size_t* __restrict__ __i, + _Tp* __restrict__ __dst, const size_t* __restrict__ __j) + { + for (size_t __k = 0; __k < __n; ++__k) + __dst[*__j++] = __src[*__i++]; + } + + // + // Compute the sum of elements in range [__f, __l) + // This is a naive algorithm. It suffers from cancelling. + // In the future try to specialize + // for _Tp = float, double, long double using a more accurate + // algorithm. + // + template + inline _Tp + __valarray_sum(const _Tp* __f, const _Tp* __l) + { + _Tp __r = _Tp(); + while (__f != __l) + __r += *__f++; + return __r; + } + + // Compute the product of all elements in range [__f, __l) + template + inline _Tp + __valarray_product(const _Tp* __f, const _Tp* __l) + { + _Tp __r = _Tp(1); + while (__f != __l) + __r = __r * *__f++; + return __r; + } + + // Compute the min/max of an array-expression + template + inline typename _Ta::value_type + __valarray_min(const _Ta& __a) + { + size_t __s = __a.size(); + typedef typename _Ta::value_type _Value_type; + _Value_type __r = __s == 0 ? _Value_type() : __a[0]; + for (size_t __i = 1; __i < __s; ++__i) + { + _Value_type __t = __a[__i]; + if (__t < __r) + __r = __t; + } + return __r; + } + + template + inline typename _Ta::value_type + __valarray_max(const _Ta& __a) + { + size_t __s = __a.size(); + typedef typename _Ta::value_type _Value_type; + _Value_type __r = __s == 0 ? _Value_type() : __a[0]; + for (size_t __i = 1; __i < __s; ++__i) + { + _Value_type __t = __a[__i]; + if (__t > __r) + __r = __t; + } + return __r; + } + + // + // Helper class _Array, first layer of valarray abstraction. + // All operations on valarray should be forwarded to this class + // whenever possible. -- gdr + // + + template + struct _Array + { + explicit _Array(size_t); + explicit _Array(_Tp* const __restrict__); + explicit _Array(const valarray<_Tp>&); + _Array(const _Tp* __restrict__, size_t); + + _Tp* begin() const; + + _Tp* const __restrict__ _M_data; + }; + + + // Copy-construct plain array __b[<__n>] from indexed array __a[__i[<__n>]] + template + inline void + __valarray_copy_construct(_Array<_Tp> __a, _Array __i, + _Array<_Tp> __b, size_t __n) + { std::__valarray_copy_construct(__a._M_data, __i._M_data, + __b._M_data, __n); } + + // Copy-construct plain array __b[<__n>] from strided array __a[<__n : __s>] + template + inline void + __valarray_copy_construct(_Array<_Tp> __a, size_t __n, size_t __s, + _Array<_Tp> __b) + { std::__valarray_copy_construct(__a._M_data, __n, __s, __b._M_data); } + + template + inline void + __valarray_fill (_Array<_Tp> __a, size_t __n, const _Tp& __t) + { std::__valarray_fill(__a._M_data, __n, __t); } + + template + inline void + __valarray_fill(_Array<_Tp> __a, size_t __n, size_t __s, const _Tp& __t) + { std::__valarray_fill(__a._M_data, __n, __s, __t); } + + template + inline void + __valarray_fill(_Array<_Tp> __a, _Array __i, + size_t __n, const _Tp& __t) + { std::__valarray_fill(__a._M_data, __i._M_data, __n, __t); } + + // Copy a plain array __a[<__n>] into a play array __b[<>] + template + inline void + __valarray_copy(_Array<_Tp> __a, size_t __n, _Array<_Tp> __b) + { std::__valarray_copy(__a._M_data, __n, __b._M_data); } + + // Copy strided array __a[<__n : __s>] in plain __b[<__n>] + template + inline void + __valarray_copy(_Array<_Tp> __a, size_t __n, size_t __s, _Array<_Tp> __b) + { std::__valarray_copy(__a._M_data, __n, __s, __b._M_data); } + + // Copy a plain array __a[<__n>] into a strided array __b[<__n : __s>] + template + inline void + __valarray_copy(_Array<_Tp> __a, _Array<_Tp> __b, size_t __n, size_t __s) + { __valarray_copy(__a._M_data, __b._M_data, __n, __s); } + + // Copy strided array __src[<__n : __s1>] into another + // strided array __dst[< : __s2>]. Their sizes must match. + template + inline void + __valarray_copy(_Array<_Tp> __a, size_t __n, size_t __s1, + _Array<_Tp> __b, size_t __s2) + { std::__valarray_copy(__a._M_data, __n, __s1, __b._M_data, __s2); } + + // Copy an indexed array __a[__i[<__n>]] in plain array __b[<__n>] + template + inline void + __valarray_copy(_Array<_Tp> __a, _Array __i, + _Array<_Tp> __b, size_t __n) + { std::__valarray_copy(__a._M_data, __i._M_data, __b._M_data, __n); } + + // Copy a plain array __a[<__n>] in an indexed array __b[__i[<__n>]] + template + inline void + __valarray_copy(_Array<_Tp> __a, size_t __n, _Array<_Tp> __b, + _Array __i) + { std::__valarray_copy(__a._M_data, __n, __b._M_data, __i._M_data); } + + // Copy the __n first elements of an indexed array __src[<__i>] into + // another indexed array __dst[<__j>]. + template + inline void + __valarray_copy(_Array<_Tp> __src, size_t __n, _Array __i, + _Array<_Tp> __dst, _Array __j) + { + std::__valarray_copy(__src._M_data, __n, __i._M_data, + __dst._M_data, __j._M_data); + } + + template + inline + _Array<_Tp>::_Array(size_t __n) + : _M_data(__valarray_get_storage<_Tp>(__n)) + { std::__valarray_default_construct(_M_data, _M_data + __n); } + + template + inline + _Array<_Tp>::_Array(_Tp* const __restrict__ __p) + : _M_data (__p) {} + + template + inline + _Array<_Tp>::_Array(const valarray<_Tp>& __v) + : _M_data (__v._M_data) {} + + template + inline + _Array<_Tp>::_Array(const _Tp* __restrict__ __b, size_t __s) + : _M_data(__valarray_get_storage<_Tp>(__s)) + { std::__valarray_copy_construct(__b, __s, _M_data); } + + template + inline _Tp* + _Array<_Tp>::begin () const + { return _M_data; } + +#define _DEFINE_ARRAY_FUNCTION(_Op, _Name) \ + template \ + inline void \ + _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n, const _Tp& __t) \ + { \ + for (_Tp* __p = __a._M_data; __p < __a._M_data + __n; ++__p) \ + *__p _Op##= __t; \ + } \ + \ + template \ + inline void \ + _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n, _Array<_Tp> __b) \ + { \ + _Tp* __p = __a._M_data; \ + for (_Tp* __q = __b._M_data; __q < __b._M_data + __n; ++__p, ++__q) \ + *__p _Op##= *__q; \ + } \ + \ + template \ + void \ + _Array_augmented_##_Name(_Array<_Tp> __a, \ + const _Expr<_Dom, _Tp>& __e, size_t __n) \ + { \ + _Tp* __p(__a._M_data); \ + for (size_t __i = 0; __i < __n; ++__i, ++__p) \ + *__p _Op##= __e[__i]; \ + } \ + \ + template \ + inline void \ + _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n, size_t __s, \ + _Array<_Tp> __b) \ + { \ + _Tp* __q(__b._M_data); \ + for (_Tp* __p = __a._M_data; __p < __a._M_data + __s * __n; \ + __p += __s, ++__q) \ + *__p _Op##= *__q; \ + } \ + \ + template \ + inline void \ + _Array_augmented_##_Name(_Array<_Tp> __a, _Array<_Tp> __b, \ + size_t __n, size_t __s) \ + { \ + _Tp* __q(__b._M_data); \ + for (_Tp* __p = __a._M_data; __p < __a._M_data + __n; \ + ++__p, __q += __s) \ + *__p _Op##= *__q; \ + } \ + \ + template \ + void \ + _Array_augmented_##_Name(_Array<_Tp> __a, size_t __s, \ + const _Expr<_Dom, _Tp>& __e, size_t __n) \ + { \ + _Tp* __p(__a._M_data); \ + for (size_t __i = 0; __i < __n; ++__i, __p += __s) \ + *__p _Op##= __e[__i]; \ + } \ + \ + template \ + inline void \ + _Array_augmented_##_Name(_Array<_Tp> __a, _Array __i, \ + _Array<_Tp> __b, size_t __n) \ + { \ + _Tp* __q(__b._M_data); \ + for (size_t* __j = __i._M_data; __j < __i._M_data + __n; \ + ++__j, ++__q) \ + __a._M_data[*__j] _Op##= *__q; \ + } \ + \ + template \ + inline void \ + _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n, \ + _Array<_Tp> __b, _Array __i) \ + { \ + _Tp* __p(__a._M_data); \ + for (size_t* __j = __i._M_data; __j<__i._M_data + __n; \ + ++__j, ++__p) \ + *__p _Op##= __b._M_data[*__j]; \ + } \ + \ + template \ + void \ + _Array_augmented_##_Name(_Array<_Tp> __a, _Array __i, \ + const _Expr<_Dom, _Tp>& __e, size_t __n) \ + { \ + size_t* __j(__i._M_data); \ + for (size_t __k = 0; __k<__n; ++__k, ++__j) \ + __a._M_data[*__j] _Op##= __e[__k]; \ + } \ + \ + template \ + void \ + _Array_augmented_##_Name(_Array<_Tp> __a, _Array __m, \ + _Array<_Tp> __b, size_t __n) \ + { \ + bool* __ok(__m._M_data); \ + _Tp* __p(__a._M_data); \ + for (_Tp* __q = __b._M_data; __q < __b._M_data + __n; \ + ++__q, ++__ok, ++__p) \ + { \ + while (! *__ok) \ + { \ + ++__ok; \ + ++__p; \ + } \ + *__p _Op##= *__q; \ + } \ + } \ + \ + template \ + void \ + _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n, \ + _Array<_Tp> __b, _Array __m) \ + { \ + bool* __ok(__m._M_data); \ + _Tp* __q(__b._M_data); \ + for (_Tp* __p = __a._M_data; __p < __a._M_data + __n; \ + ++__p, ++__ok, ++__q) \ + { \ + while (! *__ok) \ + { \ + ++__ok; \ + ++__q; \ + } \ + *__p _Op##= *__q; \ + } \ + } \ + \ + template \ + void \ + _Array_augmented_##_Name(_Array<_Tp> __a, _Array __m, \ + const _Expr<_Dom, _Tp>& __e, size_t __n) \ + { \ + bool* __ok(__m._M_data); \ + _Tp* __p(__a._M_data); \ + for (size_t __i = 0; __i < __n; ++__i, ++__ok, ++__p) \ + { \ + while (! *__ok) \ + { \ + ++__ok; \ + ++__p; \ + } \ + *__p _Op##= __e[__i]; \ + } \ + } + + _DEFINE_ARRAY_FUNCTION(+, __plus) + _DEFINE_ARRAY_FUNCTION(-, __minus) + _DEFINE_ARRAY_FUNCTION(*, __multiplies) + _DEFINE_ARRAY_FUNCTION(/, __divides) + _DEFINE_ARRAY_FUNCTION(%, __modulus) + _DEFINE_ARRAY_FUNCTION(^, __bitwise_xor) + _DEFINE_ARRAY_FUNCTION(|, __bitwise_or) + _DEFINE_ARRAY_FUNCTION(&, __bitwise_and) + _DEFINE_ARRAY_FUNCTION(<<, __shift_left) + _DEFINE_ARRAY_FUNCTION(>>, __shift_right) + +#undef _DEFINE_ARRAY_FUNCTION + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +# include + +#endif /* _ARRAY_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/valarray_before.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/valarray_before.h new file mode 100644 index 0000000..67603e1 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/bits/valarray_before.h @@ -0,0 +1,743 @@ +// The template and inlines for the -*- C++ -*- internal _Meta class. + +// Copyright (C) 1997-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file bits/valarray_before.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{valarray} + */ + +// Written by Gabriel Dos Reis + +#ifndef _VALARRAY_BEFORE_H +#define _VALARRAY_BEFORE_H 1 + +#pragma GCC system_header + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // + // Implementing a loosened valarray return value is tricky. + // First we need to meet 26.3.1/3: we should not add more than + // two levels of template nesting. Therefore we resort to template + // template to "flatten" loosened return value types. + // At some point we use partial specialization to remove one level + // template nesting due to _Expr<> + // + + // This class is NOT defined. It doesn't need to. + template class _Constant; + + // Implementations of unary functions applied to valarray<>s. + // I use hard-coded object functions here instead of a generic + // approach like pointers to function: + // 1) correctness: some functions take references, others values. + // we can't deduce the correct type afterwards. + // 2) efficiency -- object functions can be easily inlined + // 3) be Koenig-lookup-friendly + + struct _Abs + { + template + _Tp operator()(const _Tp& __t) const + { return abs(__t); } + }; + + struct _Cos + { + template + _Tp operator()(const _Tp& __t) const + { return cos(__t); } + }; + + struct _Acos + { + template + _Tp operator()(const _Tp& __t) const + { return acos(__t); } + }; + + struct _Cosh + { + template + _Tp operator()(const _Tp& __t) const + { return cosh(__t); } + }; + + struct _Sin + { + template + _Tp operator()(const _Tp& __t) const + { return sin(__t); } + }; + + struct _Asin + { + template + _Tp operator()(const _Tp& __t) const + { return asin(__t); } + }; + + struct _Sinh + { + template + _Tp operator()(const _Tp& __t) const + { return sinh(__t); } + }; + + struct _Tan + { + template + _Tp operator()(const _Tp& __t) const + { return tan(__t); } + }; + + struct _Atan + { + template + _Tp operator()(const _Tp& __t) const + { return atan(__t); } + }; + + struct _Tanh + { + template + _Tp operator()(const _Tp& __t) const + { return tanh(__t); } + }; + + struct _Exp + { + template + _Tp operator()(const _Tp& __t) const + { return exp(__t); } + }; + + struct _Log + { + template + _Tp operator()(const _Tp& __t) const + { return log(__t); } + }; + + struct _Log10 + { + template + _Tp operator()(const _Tp& __t) const + { return log10(__t); } + }; + + struct _Sqrt + { + template + _Tp operator()(const _Tp& __t) const + { return sqrt(__t); } + }; + + // In the past, we used to tailor operator applications semantics + // to the specialization of standard function objects (i.e. plus<>, etc.) + // That is incorrect. Therefore we provide our own surrogates. + + struct __unary_plus + { + template + _Tp operator()(const _Tp& __t) const + { return +__t; } + }; + + struct __negate + { + template + _Tp operator()(const _Tp& __t) const + { return -__t; } + }; + + struct __bitwise_not + { + template + _Tp operator()(const _Tp& __t) const + { return ~__t; } + }; + + struct __plus + { + template + _Tp operator()(const _Tp& __x, const _Tp& __y) const + { return __x + __y; } + }; + + struct __minus + { + template + _Tp operator()(const _Tp& __x, const _Tp& __y) const + { return __x - __y; } + }; + + struct __multiplies + { + template + _Tp operator()(const _Tp& __x, const _Tp& __y) const + { return __x * __y; } + }; + + struct __divides + { + template + _Tp operator()(const _Tp& __x, const _Tp& __y) const + { return __x / __y; } + }; + + struct __modulus + { + template + _Tp operator()(const _Tp& __x, const _Tp& __y) const + { return __x % __y; } + }; + + struct __bitwise_xor + { + template + _Tp operator()(const _Tp& __x, const _Tp& __y) const + { return __x ^ __y; } + }; + + struct __bitwise_and + { + template + _Tp operator()(const _Tp& __x, const _Tp& __y) const + { return __x & __y; } + }; + + struct __bitwise_or + { + template + _Tp operator()(const _Tp& __x, const _Tp& __y) const + { return __x | __y; } + }; + + struct __shift_left + { + template + _Tp operator()(const _Tp& __x, const _Tp& __y) const + { return __x << __y; } + }; + + struct __shift_right + { + template + _Tp operator()(const _Tp& __x, const _Tp& __y) const + { return __x >> __y; } + }; + + struct __logical_and + { + template + bool operator()(const _Tp& __x, const _Tp& __y) const + { return __x && __y; } + }; + + struct __logical_or + { + template + bool operator()(const _Tp& __x, const _Tp& __y) const + { return __x || __y; } + }; + + struct __logical_not + { + template + bool operator()(const _Tp& __x) const + { return !__x; } + }; + + struct __equal_to + { + template + bool operator()(const _Tp& __x, const _Tp& __y) const + { return __x == __y; } + }; + + struct __not_equal_to + { + template + bool operator()(const _Tp& __x, const _Tp& __y) const + { return __x != __y; } + }; + + struct __less + { + template + bool operator()(const _Tp& __x, const _Tp& __y) const + { return __x < __y; } + }; + + struct __greater + { + template + bool operator()(const _Tp& __x, const _Tp& __y) const + { return __x > __y; } + }; + + struct __less_equal + { + template + bool operator()(const _Tp& __x, const _Tp& __y) const + { return __x <= __y; } + }; + + struct __greater_equal + { + template + bool operator()(const _Tp& __x, const _Tp& __y) const + { return __x >= __y; } + }; + + // The few binary functions we miss. + struct _Atan2 + { + template + _Tp operator()(const _Tp& __x, const _Tp& __y) const + { return atan2(__x, __y); } + }; + + struct _Pow + { + template + _Tp operator()(const _Tp& __x, const _Tp& __y) const + { return pow(__x, __y); } + }; + + template + struct __fun_with_valarray + { + typedef _Tp result_type; + }; + + template + struct __fun_with_valarray<_Tp, false> + { + // No result type defined for invalid value types. + }; + + // We need these bits in order to recover the return type of + // some functions/operators now that we're no longer using + // function templates. + template + struct __fun : __fun_with_valarray<_Tp> + { + }; + + // several specializations for relational operators. + template + struct __fun<__logical_not, _Tp> + { + typedef bool result_type; + }; + + template + struct __fun<__logical_and, _Tp> + { + typedef bool result_type; + }; + + template + struct __fun<__logical_or, _Tp> + { + typedef bool result_type; + }; + + template + struct __fun<__less, _Tp> + { + typedef bool result_type; + }; + + template + struct __fun<__greater, _Tp> + { + typedef bool result_type; + }; + + template + struct __fun<__less_equal, _Tp> + { + typedef bool result_type; + }; + + template + struct __fun<__greater_equal, _Tp> + { + typedef bool result_type; + }; + + template + struct __fun<__equal_to, _Tp> + { + typedef bool result_type; + }; + + template + struct __fun<__not_equal_to, _Tp> + { + typedef bool result_type; + }; + + // + // Apply function taking a value/const reference closure + // + + template + class _FunBase + { + public: + typedef typename _Dom::value_type value_type; + + _FunBase(const _Dom& __e, value_type __f(_Arg)) + : _M_expr(__e), _M_func(__f) {} + + value_type operator[](size_t __i) const + { return _M_func (_M_expr[__i]); } + + size_t size() const { return _M_expr.size ();} + + private: + const _Dom& _M_expr; + value_type (*_M_func)(_Arg); + }; + + template + struct _ValFunClos<_Expr,_Dom> : _FunBase<_Dom, typename _Dom::value_type> + { + typedef _FunBase<_Dom, typename _Dom::value_type> _Base; + typedef typename _Base::value_type value_type; + typedef value_type _Tp; + + _ValFunClos(const _Dom& __e, _Tp __f(_Tp)) : _Base(__e, __f) {} + }; + + template + struct _ValFunClos<_ValArray,_Tp> : _FunBase, _Tp> + { + typedef _FunBase, _Tp> _Base; + typedef _Tp value_type; + + _ValFunClos(const valarray<_Tp>& __v, _Tp __f(_Tp)) : _Base(__v, __f) {} + }; + + template + struct _RefFunClos<_Expr, _Dom> + : _FunBase<_Dom, const typename _Dom::value_type&> + { + typedef _FunBase<_Dom, const typename _Dom::value_type&> _Base; + typedef typename _Base::value_type value_type; + typedef value_type _Tp; + + _RefFunClos(const _Dom& __e, _Tp __f(const _Tp&)) + : _Base(__e, __f) {} + }; + + template + struct _RefFunClos<_ValArray, _Tp> + : _FunBase, const _Tp&> + { + typedef _FunBase, const _Tp&> _Base; + typedef _Tp value_type; + + _RefFunClos(const valarray<_Tp>& __v, _Tp __f(const _Tp&)) + : _Base(__v, __f) {} + }; + + // + // Unary expression closure. + // + + template + class _UnBase + { + public: + typedef typename _Arg::value_type _Vt; + typedef typename __fun<_Oper, _Vt>::result_type value_type; + + _UnBase(const _Arg& __e) : _M_expr(__e) {} + + value_type operator[](size_t __i) const + { return _Oper()(_M_expr[__i]); } + + size_t size() const { return _M_expr.size(); } + + private: + const _Arg& _M_expr; + }; + + template + struct _UnClos<_Oper, _Expr, _Dom> + : _UnBase<_Oper, _Dom> + { + typedef _Dom _Arg; + typedef _UnBase<_Oper, _Dom> _Base; + typedef typename _Base::value_type value_type; + + _UnClos(const _Arg& __e) : _Base(__e) {} + }; + + template + struct _UnClos<_Oper, _ValArray, _Tp> + : _UnBase<_Oper, valarray<_Tp> > + { + typedef valarray<_Tp> _Arg; + typedef _UnBase<_Oper, valarray<_Tp> > _Base; + typedef typename _Base::value_type value_type; + + _UnClos(const _Arg& __e) : _Base(__e) {} + }; + + + // + // Binary expression closure. + // + + template + class _BinBase + { + public: + typedef typename _FirstArg::value_type _Vt; + typedef typename __fun<_Oper, _Vt>::result_type value_type; + + _BinBase(const _FirstArg& __e1, const _SecondArg& __e2) + : _M_expr1(__e1), _M_expr2(__e2) {} + + value_type operator[](size_t __i) const + { return _Oper()(_M_expr1[__i], _M_expr2[__i]); } + + size_t size() const { return _M_expr1.size(); } + + private: + const _FirstArg& _M_expr1; + const _SecondArg& _M_expr2; + }; + + + template + class _BinBase2 + { + public: + typedef typename _Clos::value_type _Vt; + typedef typename __fun<_Oper, _Vt>::result_type value_type; + + _BinBase2(const _Clos& __e, const _Vt& __t) + : _M_expr1(__e), _M_expr2(__t) {} + + value_type operator[](size_t __i) const + { return _Oper()(_M_expr1[__i], _M_expr2); } + + size_t size() const { return _M_expr1.size(); } + + private: + const _Clos& _M_expr1; + const _Vt& _M_expr2; + }; + + template + class _BinBase1 + { + public: + typedef typename _Clos::value_type _Vt; + typedef typename __fun<_Oper, _Vt>::result_type value_type; + + _BinBase1(const _Vt& __t, const _Clos& __e) + : _M_expr1(__t), _M_expr2(__e) {} + + value_type operator[](size_t __i) const + { return _Oper()(_M_expr1, _M_expr2[__i]); } + + size_t size() const { return _M_expr2.size(); } + + private: + const _Vt& _M_expr1; + const _Clos& _M_expr2; + }; + + template + struct _BinClos<_Oper, _Expr, _Expr, _Dom1, _Dom2> + : _BinBase<_Oper, _Dom1, _Dom2> + { + typedef _BinBase<_Oper, _Dom1, _Dom2> _Base; + typedef typename _Base::value_type value_type; + + _BinClos(const _Dom1& __e1, const _Dom2& __e2) : _Base(__e1, __e2) {} + }; + + template + struct _BinClos<_Oper,_ValArray, _ValArray, _Tp, _Tp> + : _BinBase<_Oper, valarray<_Tp>, valarray<_Tp> > + { + typedef _BinBase<_Oper, valarray<_Tp>, valarray<_Tp> > _Base; + typedef typename _Base::value_type value_type; + + _BinClos(const valarray<_Tp>& __v, const valarray<_Tp>& __w) + : _Base(__v, __w) {} + }; + + template + struct _BinClos<_Oper, _Expr, _ValArray, _Dom, typename _Dom::value_type> + : _BinBase<_Oper, _Dom, valarray > + { + typedef typename _Dom::value_type _Tp; + typedef _BinBase<_Oper,_Dom,valarray<_Tp> > _Base; + typedef typename _Base::value_type value_type; + + _BinClos(const _Dom& __e1, const valarray<_Tp>& __e2) + : _Base(__e1, __e2) {} + }; + + template + struct _BinClos<_Oper, _ValArray, _Expr, typename _Dom::value_type, _Dom> + : _BinBase<_Oper, valarray,_Dom> + { + typedef typename _Dom::value_type _Tp; + typedef _BinBase<_Oper, valarray<_Tp>, _Dom> _Base; + typedef typename _Base::value_type value_type; + + _BinClos(const valarray<_Tp>& __e1, const _Dom& __e2) + : _Base(__e1, __e2) {} + }; + + template + struct _BinClos<_Oper, _Expr, _Constant, _Dom, typename _Dom::value_type> + : _BinBase2<_Oper, _Dom> + { + typedef typename _Dom::value_type _Tp; + typedef _BinBase2<_Oper,_Dom> _Base; + typedef typename _Base::value_type value_type; + + _BinClos(const _Dom& __e1, const _Tp& __e2) : _Base(__e1, __e2) {} + }; + + template + struct _BinClos<_Oper, _Constant, _Expr, typename _Dom::value_type, _Dom> + : _BinBase1<_Oper, _Dom> + { + typedef typename _Dom::value_type _Tp; + typedef _BinBase1<_Oper, _Dom> _Base; + typedef typename _Base::value_type value_type; + + _BinClos(const _Tp& __e1, const _Dom& __e2) : _Base(__e1, __e2) {} + }; + + template + struct _BinClos<_Oper, _ValArray, _Constant, _Tp, _Tp> + : _BinBase2<_Oper, valarray<_Tp> > + { + typedef _BinBase2<_Oper,valarray<_Tp> > _Base; + typedef typename _Base::value_type value_type; + + _BinClos(const valarray<_Tp>& __v, const _Tp& __t) : _Base(__v, __t) {} + }; + + template + struct _BinClos<_Oper, _Constant, _ValArray, _Tp, _Tp> + : _BinBase1<_Oper, valarray<_Tp> > + { + typedef _BinBase1<_Oper, valarray<_Tp> > _Base; + typedef typename _Base::value_type value_type; + + _BinClos(const _Tp& __t, const valarray<_Tp>& __v) : _Base(__t, __v) {} + }; + + // + // slice_array closure. + // + template + class _SBase + { + public: + typedef typename _Dom::value_type value_type; + + _SBase (const _Dom& __e, const slice& __s) + : _M_expr (__e), _M_slice (__s) {} + + value_type + operator[] (size_t __i) const + { return _M_expr[_M_slice.start () + __i * _M_slice.stride ()]; } + + size_t + size() const + { return _M_slice.size (); } + + private: + const _Dom& _M_expr; + const slice& _M_slice; + }; + + template + class _SBase<_Array<_Tp> > + { + public: + typedef _Tp value_type; + + _SBase (_Array<_Tp> __a, const slice& __s) + : _M_array (__a._M_data+__s.start()), _M_size (__s.size()), + _M_stride (__s.stride()) {} + + value_type + operator[] (size_t __i) const + { return _M_array._M_data[__i * _M_stride]; } + + size_t + size() const + { return _M_size; } + + private: + const _Array<_Tp> _M_array; + const size_t _M_size; + const size_t _M_stride; + }; + + template + struct _SClos<_Expr, _Dom> + : _SBase<_Dom> + { + typedef _SBase<_Dom> _Base; + typedef typename _Base::value_type value_type; + + _SClos (const _Dom& __e, const slice& __s) : _Base (__e, __s) {} + }; + + template + struct _SClos<_ValArray, _Tp> + : _SBase<_Array<_Tp> > + { + typedef _SBase<_Array<_Tp> > _Base; + typedef _Tp value_type; + + _SClos (_Array<_Tp> __a, const slice& __s) : _Base (__a, __s) {} + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _CPP_VALARRAY_BEFORE_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/complex.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/complex.h new file mode 100644 index 0000000..b9af847 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/complex.h @@ -0,0 +1,46 @@ +// -*- C++ -*- compatibility header. + +// Copyright (C) 2007-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file complex.h + * This is a Standard C++ Library header. + */ + +#include + +#if __cplusplus >= 201103L +# include +#endif + +#if _GLIBCXX_HAVE_COMPLEX_H +# include_next +# ifdef _GLIBCXX_COMPLEX +// See PR56111, keep the macro in C++03 if possible. +# undef complex +# endif +#endif + +#ifndef _GLIBCXX_COMPLEX_H +#define _GLIBCXX_COMPLEX_H 1 + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/cxxabi.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/cxxabi.h new file mode 100644 index 0000000..6e6b21d --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/cxxabi.h @@ -0,0 +1,705 @@ +// ABI Support -*- C++ -*- + +// Copyright (C) 2000-2017 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// GCC is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// Written by Nathan Sidwell, Codesourcery LLC, + +/* This file declares the new abi entry points into the runtime. It is not + normally necessary for user programs to include this header, or use the + entry points directly. However, this header is available should that be + needed. + + Some of the entry points are intended for both C and C++, thus this header + is includable from both C and C++. Though the C++ specific parts are not + available in C, naturally enough. */ + +/** @file cxxabi.h + * The header provides an interface to the C++ ABI. + */ + +#ifndef _CXXABI_H +#define _CXXABI_H 1 + +#pragma GCC system_header + +#pragma GCC visibility push(default) + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +namespace __cxxabiv1 +{ + extern "C" + { +#endif + + typedef __cxa_cdtor_return_type (*__cxa_cdtor_type)(void *); + + // Allocate array. + void* + __cxa_vec_new(size_t __element_count, size_t __element_size, + size_t __padding_size, __cxa_cdtor_type __constructor, + __cxa_cdtor_type __destructor); + + void* + __cxa_vec_new2(size_t __element_count, size_t __element_size, + size_t __padding_size, __cxa_cdtor_type __constructor, + __cxa_cdtor_type __destructor, void *(*__alloc) (size_t), + void (*__dealloc) (void*)); + + void* + __cxa_vec_new3(size_t __element_count, size_t __element_size, + size_t __padding_size, __cxa_cdtor_type __constructor, + __cxa_cdtor_type __destructor, void *(*__alloc) (size_t), + void (*__dealloc) (void*, size_t)); + + // Construct array. + __cxa_vec_ctor_return_type + __cxa_vec_ctor(void* __array_address, size_t __element_count, + size_t __element_size, __cxa_cdtor_type __constructor, + __cxa_cdtor_type __destructor); + + __cxa_vec_ctor_return_type + __cxa_vec_cctor(void* __dest_array, void* __src_array, + size_t __element_count, size_t __element_size, + __cxa_cdtor_return_type (*__constructor) (void*, void*), + __cxa_cdtor_type __destructor); + + // Destruct array. + void + __cxa_vec_dtor(void* __array_address, size_t __element_count, + size_t __element_size, __cxa_cdtor_type __destructor); + + void + __cxa_vec_cleanup(void* __array_address, size_t __element_count, size_t __s, + __cxa_cdtor_type __destructor) _GLIBCXX_NOTHROW; + + // Destruct and release array. + void + __cxa_vec_delete(void* __array_address, size_t __element_size, + size_t __padding_size, __cxa_cdtor_type __destructor); + + void + __cxa_vec_delete2(void* __array_address, size_t __element_size, + size_t __padding_size, __cxa_cdtor_type __destructor, + void (*__dealloc) (void*)); + + void + __cxa_vec_delete3(void* __array_address, size_t __element_size, + size_t __padding_size, __cxa_cdtor_type __destructor, + void (*__dealloc) (void*, size_t)); + + int + __cxa_guard_acquire(__guard*); + + void + __cxa_guard_release(__guard*) _GLIBCXX_NOTHROW; + + void + __cxa_guard_abort(__guard*) _GLIBCXX_NOTHROW; + + // DSO destruction. + int + __cxa_atexit(void (*)(void*), void*, void*) _GLIBCXX_NOTHROW; + + int + __cxa_finalize(void*); + + // TLS destruction. + int + __cxa_thread_atexit(void (*)(void*), void*, void *) _GLIBCXX_NOTHROW; + + // Pure virtual functions. + void + __cxa_pure_virtual(void) __attribute__ ((__noreturn__)); + + void + __cxa_deleted_virtual(void) __attribute__ ((__noreturn__)); + + // Exception handling auxiliary. + void + __cxa_bad_cast() __attribute__((__noreturn__)); + + void + __cxa_bad_typeid() __attribute__((__noreturn__)); + + void + __cxa_throw_bad_array_new_length() __attribute__((__noreturn__)); + + /** + * @brief Demangling routine. + * ABI-mandated entry point in the C++ runtime library for demangling. + * + * @param __mangled_name A NUL-terminated character string + * containing the name to be demangled. + * + * @param __output_buffer A region of memory, allocated with + * malloc, of @a *__length bytes, into which the demangled name is + * stored. If @a __output_buffer is not long enough, it is + * expanded using realloc. @a __output_buffer may instead be NULL; + * in that case, the demangled name is placed in a region of memory + * allocated with malloc. + * + * @param __length If @a __length is non-NULL, the length of the + * buffer containing the demangled name is placed in @a *__length. + * + * @param __status @a *__status is set to one of the following values: + * 0: The demangling operation succeeded. + * -1: A memory allocation failure occurred. + * -2: @a mangled_name is not a valid name under the C++ ABI mangling rules. + * -3: One of the arguments is invalid. + * + * @return A pointer to the start of the NUL-terminated demangled + * name, or NULL if the demangling fails. The caller is + * responsible for deallocating this memory using @c free. + * + * The demangling is performed using the C++ ABI mangling rules, + * with GNU extensions. For example, this function is used in + * __gnu_cxx::__verbose_terminate_handler. + * + * See https://gcc.gnu.org/onlinedocs/libstdc++/manual/ext_demangling.html + * for other examples of use. + * + * @note The same demangling functionality is available via + * libiberty (@c and @c libiberty.a) in GCC + * 3.1 and later, but that requires explicit installation (@c + * --enable-install-libiberty) and uses a different API, although + * the ABI is unchanged. + */ + char* + __cxa_demangle(const char* __mangled_name, char* __output_buffer, + size_t* __length, int* __status); + +#ifdef __cplusplus + } +} // namespace __cxxabiv1 +#endif + +#ifdef __cplusplus + +#include + +namespace __cxxabiv1 +{ + // Type information for int, float etc. + class __fundamental_type_info : public std::type_info + { + public: + explicit + __fundamental_type_info(const char* __n) : std::type_info(__n) { } + + virtual + ~__fundamental_type_info(); + }; + + // Type information for array objects. + class __array_type_info : public std::type_info + { + public: + explicit + __array_type_info(const char* __n) : std::type_info(__n) { } + + virtual + ~__array_type_info(); + }; + + // Type information for functions (both member and non-member). + class __function_type_info : public std::type_info + { + public: + explicit + __function_type_info(const char* __n) : std::type_info(__n) { } + + virtual + ~__function_type_info(); + + protected: + // Implementation defined member function. + virtual bool + __is_function_p() const; + }; + + // Type information for enumerations. + class __enum_type_info : public std::type_info + { + public: + explicit + __enum_type_info(const char* __n) : std::type_info(__n) { } + + virtual + ~__enum_type_info(); + }; + + // Common type information for simple pointers and pointers to member. + class __pbase_type_info : public std::type_info + { + public: + unsigned int __flags; // Qualification of the target object. + const std::type_info* __pointee; // Type of pointed to object. + + explicit + __pbase_type_info(const char* __n, int __quals, + const std::type_info* __type) + : std::type_info(__n), __flags(__quals), __pointee(__type) + { } + + virtual + ~__pbase_type_info(); + + // Implementation defined type. + enum __masks + { + __const_mask = 0x1, + __volatile_mask = 0x2, + __restrict_mask = 0x4, + __incomplete_mask = 0x8, + __incomplete_class_mask = 0x10, + __transaction_safe_mask = 0x20, + __noexcept_mask = 0x40 + }; + + protected: + __pbase_type_info(const __pbase_type_info&); + + __pbase_type_info& + operator=(const __pbase_type_info&); + + // Implementation defined member functions. + virtual bool + __do_catch(const std::type_info* __thr_type, void** __thr_obj, + unsigned int __outer) const; + + inline virtual bool + __pointer_catch(const __pbase_type_info* __thr_type, void** __thr_obj, + unsigned __outer) const; + }; + + inline bool __pbase_type_info:: + __pointer_catch (const __pbase_type_info *thrown_type, + void **thr_obj, + unsigned outer) const + { + return __pointee->__do_catch (thrown_type->__pointee, thr_obj, outer + 2); + } + + // Type information for simple pointers. + class __pointer_type_info : public __pbase_type_info + { + public: + explicit + __pointer_type_info(const char* __n, int __quals, + const std::type_info* __type) + : __pbase_type_info (__n, __quals, __type) { } + + + virtual + ~__pointer_type_info(); + + protected: + // Implementation defined member functions. + virtual bool + __is_pointer_p() const; + + virtual bool + __pointer_catch(const __pbase_type_info* __thr_type, void** __thr_obj, + unsigned __outer) const; + }; + + class __class_type_info; + + // Type information for a pointer to member variable. + class __pointer_to_member_type_info : public __pbase_type_info + { + public: + __class_type_info* __context; // Class of the member. + + explicit + __pointer_to_member_type_info(const char* __n, int __quals, + const std::type_info* __type, + __class_type_info* __klass) + : __pbase_type_info(__n, __quals, __type), __context(__klass) { } + + virtual + ~__pointer_to_member_type_info(); + + protected: + __pointer_to_member_type_info(const __pointer_to_member_type_info&); + + __pointer_to_member_type_info& + operator=(const __pointer_to_member_type_info&); + + // Implementation defined member function. + virtual bool + __pointer_catch(const __pbase_type_info* __thr_type, void** __thr_obj, + unsigned __outer) const; + }; + + // Helper class for __vmi_class_type. + class __base_class_type_info + { + public: + const __class_type_info* __base_type; // Base class type. +#ifdef _GLIBCXX_LLP64 + long long __offset_flags; // Offset and info. +#else + long __offset_flags; // Offset and info. +#endif + + enum __offset_flags_masks + { + __virtual_mask = 0x1, + __public_mask = 0x2, + __hwm_bit = 2, + __offset_shift = 8 // Bits to shift offset. + }; + + // Implementation defined member functions. + bool + __is_virtual_p() const + { return __offset_flags & __virtual_mask; } + + bool + __is_public_p() const + { return __offset_flags & __public_mask; } + + ptrdiff_t + __offset() const + { + // This shift, being of a signed type, is implementation + // defined. GCC implements such shifts as arithmetic, which is + // what we want. + return static_cast(__offset_flags) >> __offset_shift; + } + }; + + // Type information for a class. + class __class_type_info : public std::type_info + { + public: + explicit + __class_type_info (const char *__n) : type_info(__n) { } + + virtual + ~__class_type_info (); + + // Implementation defined types. + // The type sub_kind tells us about how a base object is contained + // within a derived object. We often do this lazily, hence the + // UNKNOWN value. At other times we may use NOT_CONTAINED to mean + // not publicly contained. + enum __sub_kind + { + // We have no idea. + __unknown = 0, + + // Not contained within us (in some circumstances this might + // mean not contained publicly) + __not_contained, + + // Contained ambiguously. + __contained_ambig, + + // Via a virtual path. + __contained_virtual_mask = __base_class_type_info::__virtual_mask, + + // Via a public path. + __contained_public_mask = __base_class_type_info::__public_mask, + + // Contained within us. + __contained_mask = 1 << __base_class_type_info::__hwm_bit, + + __contained_private = __contained_mask, + __contained_public = __contained_mask | __contained_public_mask + }; + + struct __upcast_result; + struct __dyncast_result; + + protected: + // Implementation defined member functions. + virtual bool + __do_upcast(const __class_type_info* __dst_type, void**__obj_ptr) const; + + virtual bool + __do_catch(const type_info* __thr_type, void** __thr_obj, + unsigned __outer) const; + + public: + // Helper for upcast. See if DST is us, or one of our bases. + // Return false if not found, true if found. + virtual bool + __do_upcast(const __class_type_info* __dst, const void* __obj, + __upcast_result& __restrict __result) const; + + // Indicate whether SRC_PTR of type SRC_TYPE is contained publicly + // within OBJ_PTR. OBJ_PTR points to a base object of our type, + // which is the destination type. SRC2DST indicates how SRC + // objects might be contained within this type. If SRC_PTR is one + // of our SRC_TYPE bases, indicate the virtuality. Returns + // not_contained for non containment or private containment. + inline __sub_kind + __find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr, + const __class_type_info* __src_type, + const void* __src_ptr) const; + + // Helper for dynamic cast. ACCESS_PATH gives the access from the + // most derived object to this base. DST_TYPE indicates the + // desired type we want. OBJ_PTR points to a base of our type + // within the complete object. SRC_TYPE indicates the static type + // started from and SRC_PTR points to that base within the most + // derived object. Fill in RESULT with what we find. Return true + // if we have located an ambiguous match. + virtual bool + __do_dyncast(ptrdiff_t __src2dst, __sub_kind __access_path, + const __class_type_info* __dst_type, const void* __obj_ptr, + const __class_type_info* __src_type, const void* __src_ptr, + __dyncast_result& __result) const; + + // Helper for find_public_subobj. SRC2DST indicates how SRC_TYPE + // bases are inherited by the type started from -- which is not + // necessarily the current type. The current type will be a base + // of the destination type. OBJ_PTR points to the current base. + virtual __sub_kind + __do_find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr, + const __class_type_info* __src_type, + const void* __src_ptr) const; + }; + + // Type information for a class with a single non-virtual base. + class __si_class_type_info : public __class_type_info + { + public: + const __class_type_info* __base_type; + + explicit + __si_class_type_info(const char *__n, const __class_type_info *__base) + : __class_type_info(__n), __base_type(__base) { } + + virtual + ~__si_class_type_info(); + + protected: + __si_class_type_info(const __si_class_type_info&); + + __si_class_type_info& + operator=(const __si_class_type_info&); + + // Implementation defined member functions. + virtual bool + __do_dyncast(ptrdiff_t __src2dst, __sub_kind __access_path, + const __class_type_info* __dst_type, const void* __obj_ptr, + const __class_type_info* __src_type, const void* __src_ptr, + __dyncast_result& __result) const; + + virtual __sub_kind + __do_find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr, + const __class_type_info* __src_type, + const void* __sub_ptr) const; + + virtual bool + __do_upcast(const __class_type_info*__dst, const void*__obj, + __upcast_result& __restrict __result) const; + }; + + // Type information for a class with multiple and/or virtual bases. + class __vmi_class_type_info : public __class_type_info + { + public: + unsigned int __flags; // Details about the class hierarchy. + unsigned int __base_count; // Number of direct bases. + + // The array of bases uses the trailing array struct hack so this + // class is not constructable with a normal constructor. It is + // internally generated by the compiler. + __base_class_type_info __base_info[1]; // Array of bases. + + explicit + __vmi_class_type_info(const char* __n, int ___flags) + : __class_type_info(__n), __flags(___flags), __base_count(0) { } + + virtual + ~__vmi_class_type_info(); + + // Implementation defined types. + enum __flags_masks + { + __non_diamond_repeat_mask = 0x1, // Distinct instance of repeated base. + __diamond_shaped_mask = 0x2, // Diamond shaped multiple inheritance. + __flags_unknown_mask = 0x10 + }; + + protected: + // Implementation defined member functions. + virtual bool + __do_dyncast(ptrdiff_t __src2dst, __sub_kind __access_path, + const __class_type_info* __dst_type, const void* __obj_ptr, + const __class_type_info* __src_type, const void* __src_ptr, + __dyncast_result& __result) const; + + virtual __sub_kind + __do_find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr, + const __class_type_info* __src_type, + const void* __src_ptr) const; + + virtual bool + __do_upcast(const __class_type_info* __dst, const void* __obj, + __upcast_result& __restrict __result) const; + }; + + // Exception handling forward declarations. + struct __cxa_exception; + struct __cxa_refcounted_exception; + struct __cxa_dependent_exception; + struct __cxa_eh_globals; + + extern "C" + { + // Dynamic cast runtime. + + // src2dst has the following possible values + // >-1: src_type is a unique public non-virtual base of dst_type + // dst_ptr + src2dst == src_ptr + // -1: unspecified relationship + // -2: src_type is not a public base of dst_type + // -3: src_type is a multiple public non-virtual base of dst_type + void* + __dynamic_cast(const void* __src_ptr, // Starting object. + const __class_type_info* __src_type, // Static type of object. + const __class_type_info* __dst_type, // Desired target type. + ptrdiff_t __src2dst); // How src and dst are related. + + + // Exception handling runtime. + + // The __cxa_eh_globals for the current thread can be obtained by using + // either of the following functions. The "fast" version assumes at least + // one prior call of __cxa_get_globals has been made from the current + // thread, so no initialization is necessary. + __cxa_eh_globals* + __cxa_get_globals() _GLIBCXX_NOTHROW __attribute__ ((__const__)); + + __cxa_eh_globals* + __cxa_get_globals_fast() _GLIBCXX_NOTHROW __attribute__ ((__const__)); + + // Free the space allocated for the primary exception. + void + __cxa_free_exception(void*) _GLIBCXX_NOTHROW; + + // Throw the exception. + void + __cxa_throw(void*, std::type_info*, void (_GLIBCXX_CDTOR_CALLABI *) (void *)) + __attribute__((__noreturn__)); + + // Used to implement exception handlers. + void* + __cxa_get_exception_ptr(void*) _GLIBCXX_NOTHROW __attribute__ ((__pure__)); + + void* + __cxa_begin_catch(void*) _GLIBCXX_NOTHROW; + + void + __cxa_end_catch(); + + void + __cxa_rethrow() __attribute__((__noreturn__)); + + // Returns the type_info for the currently handled exception [15.3/8], or + // null if there is none. + std::type_info* + __cxa_current_exception_type() _GLIBCXX_NOTHROW __attribute__ ((__pure__)); + + // GNU Extensions. + + // Allocate memory for a dependent exception. + __cxa_dependent_exception* + __cxa_allocate_dependent_exception() _GLIBCXX_NOTHROW; + + // Free the space allocated for the dependent exception. + void + __cxa_free_dependent_exception(__cxa_dependent_exception*) _GLIBCXX_NOTHROW; + + } // extern "C" + + // A magic placeholder class that can be caught by reference + // to recognize foreign exceptions. + class __foreign_exception + { + virtual ~__foreign_exception() throw(); + virtual void __pure_dummy() = 0; // prevent catch by value + }; + +} // namespace __cxxabiv1 + +/** @namespace abi + * @brief The cross-vendor C++ Application Binary Interface. A + * namespace alias to __cxxabiv1, but user programs should use the + * alias 'abi'. + * + * A brief overview of an ABI is given in the libstdc++ FAQ, question + * 5.8 (you may have a copy of the FAQ locally, or you can view the online + * version at http://gcc.gnu.org/onlinedocs/libstdc++/faq.html#5_8 ). + * + * GCC subscribes to a cross-vendor ABI for C++, sometimes + * called the IA64 ABI because it happens to be the native ABI for that + * platform. It is summarized at http://www.codesourcery.com/cxx-abi/ + * along with the current specification. + * + * For users of GCC greater than or equal to 3.x, entry points are + * available in , which notes, 'It is not normally + * necessary for user programs to include this header, or use the + * entry points directly. However, this header is available should + * that be needed.' +*/ +namespace abi = __cxxabiv1; + +namespace __gnu_cxx +{ + /** + * @brief Exception thrown by __cxa_guard_acquire. + * @ingroup exceptions + * + * 6.7[stmt.dcl]/4: If control re-enters the declaration (recursively) + * while the object is being initialized, the behavior is undefined. + * + * Since we already have a library function to handle locking, we might + * as well check for this situation and throw an exception. + * We use the second byte of the guard variable to remember that we're + * in the middle of an initialization. + */ + class recursive_init_error: public std::exception + { + public: + recursive_init_error() throw() { } + virtual ~recursive_init_error() throw (); + }; +} +#endif // __cplusplus + +#pragma GCC visibility pop + +#endif // __CXXABI_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/assertions.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/assertions.h new file mode 100644 index 0000000..6b37d4b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/assertions.h @@ -0,0 +1,68 @@ +// Debugging support implementation -*- C++ -*- + +// Copyright (C) 2003-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/assertions.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_ASSERTIONS_H +#define _GLIBCXX_DEBUG_ASSERTIONS_H 1 + +#ifndef _GLIBCXX_DEBUG + +# define _GLIBCXX_DEBUG_ASSERT(_Condition) +# define _GLIBCXX_DEBUG_PEDASSERT(_Condition) +# define _GLIBCXX_DEBUG_ONLY(_Statement) + +#endif + +#ifndef _GLIBCXX_ASSERTIONS +# define __glibcxx_requires_non_empty_range(_First,_Last) +# define __glibcxx_requires_nonempty() +# define __glibcxx_requires_subscript(_N) +#else + +// Verify that [_First, _Last) forms a non-empty iterator range. +# define __glibcxx_requires_non_empty_range(_First,_Last) \ + __glibcxx_assert(__builtin_expect(_First != _Last, true)) +# define __glibcxx_requires_subscript(_N) \ + __glibcxx_assert(__builtin_expect(_N < this->size(), true)) +// Verify that the container is nonempty +# define __glibcxx_requires_nonempty() \ + __glibcxx_assert(__builtin_expect(!this->empty(), true)) +#endif + +#ifdef _GLIBCXX_DEBUG +# define _GLIBCXX_DEBUG_ASSERT(_Condition) __glibcxx_assert(_Condition) + +# ifdef _GLIBCXX_DEBUG_PEDANTIC +# define _GLIBCXX_DEBUG_PEDASSERT(_Condition) _GLIBCXX_DEBUG_ASSERT(_Condition) +# else +# define _GLIBCXX_DEBUG_PEDASSERT(_Condition) +# endif + +# define _GLIBCXX_DEBUG_ONLY(_Statement) _Statement +#endif + +#endif // _GLIBCXX_DEBUG_ASSERTIONS diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/debug.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/debug.h new file mode 100644 index 0000000..d59d3c6 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/debug.h @@ -0,0 +1,125 @@ +// Debugging support implementation -*- C++ -*- + +// Copyright (C) 2003-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/debug.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_MACRO_SWITCH_H +#define _GLIBCXX_DEBUG_MACRO_SWITCH_H 1 + +/** Macros and namespaces used by the implementation outside of debug + * wrappers to verify certain properties. The __glibcxx_requires_xxx + * macros are merely wrappers around the __glibcxx_check_xxx wrappers + * when we are compiling with debug mode, but disappear when we are + * in release mode so that there is no checking performed in, e.g., + * the standard library algorithms. +*/ + +#include + +// Debug mode namespaces. + +/** + * @namespace std::__debug + * @brief GNU debug code, replaces standard behavior with debug behavior. + */ +namespace std +{ + namespace __debug { } +} + +/** @namespace __gnu_debug + * @brief GNU debug classes for public use. +*/ +namespace __gnu_debug +{ + using namespace std::__debug; +} + +#ifndef _GLIBCXX_DEBUG + +# define __glibcxx_requires_cond(_Cond,_Msg) +# define __glibcxx_requires_valid_range(_First,_Last) +# define __glibcxx_requires_sorted(_First,_Last) +# define __glibcxx_requires_sorted_pred(_First,_Last,_Pred) +# define __glibcxx_requires_sorted_set(_First1,_Last1,_First2) +# define __glibcxx_requires_sorted_set_pred(_First1,_Last1,_First2,_Pred) +# define __glibcxx_requires_partitioned_lower(_First,_Last,_Value) +# define __glibcxx_requires_partitioned_upper(_First,_Last,_Value) +# define __glibcxx_requires_partitioned_lower_pred(_First,_Last,_Value,_Pred) +# define __glibcxx_requires_partitioned_upper_pred(_First,_Last,_Value,_Pred) +# define __glibcxx_requires_heap(_First,_Last) +# define __glibcxx_requires_heap_pred(_First,_Last,_Pred) +# define __glibcxx_requires_string(_String) +# define __glibcxx_requires_string_len(_String,_Len) +# define __glibcxx_requires_irreflexive(_First,_Last) +# define __glibcxx_requires_irreflexive2(_First,_Last) +# define __glibcxx_requires_irreflexive_pred(_First,_Last,_Pred) +# define __glibcxx_requires_irreflexive_pred2(_First,_Last,_Pred) + +#else + +# include + +# define __glibcxx_requires_cond(_Cond,_Msg) _GLIBCXX_DEBUG_VERIFY(_Cond,_Msg) +# define __glibcxx_requires_valid_range(_First,_Last) \ + __glibcxx_check_valid_range(_First,_Last) +# define __glibcxx_requires_sorted(_First,_Last) \ + __glibcxx_check_sorted(_First,_Last) +# define __glibcxx_requires_sorted_pred(_First,_Last,_Pred) \ + __glibcxx_check_sorted_pred(_First,_Last,_Pred) +# define __glibcxx_requires_sorted_set(_First1,_Last1,_First2) \ + __glibcxx_check_sorted_set(_First1,_Last1,_First2) +# define __glibcxx_requires_sorted_set_pred(_First1,_Last1,_First2,_Pred) \ + __glibcxx_check_sorted_set_pred(_First1,_Last1,_First2,_Pred) +# define __glibcxx_requires_partitioned_lower(_First,_Last,_Value) \ + __glibcxx_check_partitioned_lower(_First,_Last,_Value) +# define __glibcxx_requires_partitioned_upper(_First,_Last,_Value) \ + __glibcxx_check_partitioned_upper(_First,_Last,_Value) +# define __glibcxx_requires_partitioned_lower_pred(_First,_Last,_Value,_Pred) \ + __glibcxx_check_partitioned_lower_pred(_First,_Last,_Value,_Pred) +# define __glibcxx_requires_partitioned_upper_pred(_First,_Last,_Value,_Pred) \ + __glibcxx_check_partitioned_upper_pred(_First,_Last,_Value,_Pred) +# define __glibcxx_requires_heap(_First,_Last) \ + __glibcxx_check_heap(_First,_Last) +# define __glibcxx_requires_heap_pred(_First,_Last,_Pred) \ + __glibcxx_check_heap_pred(_First,_Last,_Pred) +# define __glibcxx_requires_string(_String) __glibcxx_check_string(_String) +# define __glibcxx_requires_string_len(_String,_Len) \ + __glibcxx_check_string_len(_String,_Len) +# define __glibcxx_requires_irreflexive(_First,_Last) \ + __glibcxx_check_irreflexive(_First,_Last) +# define __glibcxx_requires_irreflexive2(_First,_Last) \ + __glibcxx_check_irreflexive2(_First,_Last) +# define __glibcxx_requires_irreflexive_pred(_First,_Last,_Pred) \ + __glibcxx_check_irreflexive_pred(_First,_Last,_Pred) +# define __glibcxx_requires_irreflexive_pred2(_First,_Last,_Pred) \ + __glibcxx_check_irreflexive_pred2(_First,_Last,_Pred) + +# include + +#endif + +#endif // _GLIBCXX_DEBUG_MACRO_SWITCH_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/formatter.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/formatter.h new file mode 100644 index 0000000..985e359 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/formatter.h @@ -0,0 +1,493 @@ +// Debug-mode error formatting implementation -*- C++ -*- + +// Copyright (C) 2003-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/formatter.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_FORMATTER_H +#define _GLIBCXX_DEBUG_FORMATTER_H 1 + +#include +#include + +#if __cpp_rtti +# include +# define _GLIBCXX_TYPEID(_Type) &typeid(_Type) +#else +namespace std +{ + class type_info; +} +# define _GLIBCXX_TYPEID(_Type) 0 +#endif + +namespace __gnu_debug +{ + using std::type_info; + + template + bool __check_singular(const _Iterator&); + + class _Safe_sequence_base; + + template + class _Safe_iterator; + + template + class _Safe_local_iterator; + + template + class _Safe_sequence; + + enum _Debug_msg_id + { + // General checks + __msg_valid_range, + __msg_insert_singular, + __msg_insert_different, + __msg_erase_bad, + __msg_erase_different, + __msg_subscript_oob, + __msg_empty, + __msg_unpartitioned, + __msg_unpartitioned_pred, + __msg_unsorted, + __msg_unsorted_pred, + __msg_not_heap, + __msg_not_heap_pred, + // std::bitset checks + __msg_bad_bitset_write, + __msg_bad_bitset_read, + __msg_bad_bitset_flip, + // std::list checks + __msg_self_splice, + __msg_splice_alloc, + __msg_splice_bad, + __msg_splice_other, + __msg_splice_overlap, + // iterator checks + __msg_init_singular, + __msg_init_copy_singular, + __msg_init_const_singular, + __msg_copy_singular, + __msg_bad_deref, + __msg_bad_inc, + __msg_bad_dec, + __msg_iter_subscript_oob, + __msg_advance_oob, + __msg_retreat_oob, + __msg_iter_compare_bad, + __msg_compare_different, + __msg_iter_order_bad, + __msg_order_different, + __msg_distance_bad, + __msg_distance_different, + // istream_iterator + __msg_deref_istream, + __msg_inc_istream, + // ostream_iterator + __msg_output_ostream, + // istreambuf_iterator + __msg_deref_istreambuf, + __msg_inc_istreambuf, + // forward_list + __msg_insert_after_end, + __msg_erase_after_bad, + __msg_valid_range2, + // unordered container local iterators + __msg_local_iter_compare_bad, + __msg_non_empty_range, + // self move assign + __msg_self_move_assign, + // unordered container buckets + __msg_bucket_index_oob, + __msg_valid_load_factor, + // others + __msg_equal_allocs, + __msg_insert_range_from_self, + __msg_irreflexive_ordering + }; + + class _Error_formatter + { + // Tags denoting the type of parameter for construction + struct _Is_iterator { }; + struct _Is_iterator_value_type { }; + struct _Is_sequence { }; + struct _Is_instance { }; + + public: + /// Whether an iterator is constant, mutable, or unknown + enum _Constness + { + __unknown_constness, + __const_iterator, + __mutable_iterator, + __last_constness + }; + + // The state of the iterator (fine-grained), if we know it. + enum _Iterator_state + { + __unknown_state, + __singular, // singular, may still be attached to a sequence + __begin, // dereferenceable, and at the beginning + __middle, // dereferenceable, not at the beginning + __end, // past-the-end, may be at beginning if sequence empty + __before_begin, // before begin + __last_state + }; + + // A parameter that may be referenced by an error message + struct _Parameter + { + enum + { + __unused_param, + __iterator, + __sequence, + __integer, + __string, + __instance, + __iterator_value_type + } _M_kind; + + struct _Type + { + const char* _M_name; + const type_info* _M_type; + }; + + struct _Instance : _Type + { + const void* _M_address; + }; + + union + { + // When _M_kind == __iterator + struct : _Instance + { + _Constness _M_constness; + _Iterator_state _M_state; + const void* _M_sequence; + const type_info* _M_seq_type; + } _M_iterator; + + // When _M_kind == __sequence + _Instance _M_sequence; + + // When _M_kind == __integer + struct + { + const char* _M_name; + long _M_value; + } _M_integer; + + // When _M_kind == __string + struct + { + const char* _M_name; + const char* _M_value; + } _M_string; + + // When _M_kind == __instance + _Instance _M_instance; + + // When _M_kind == __iterator_value_type + _Type _M_iterator_value_type; + } _M_variant; + + _Parameter() : _M_kind(__unused_param), _M_variant() { } + + _Parameter(long __value, const char* __name) + : _M_kind(__integer), _M_variant() + { + _M_variant._M_integer._M_name = __name; + _M_variant._M_integer._M_value = __value; + } + + _Parameter(const char* __value, const char* __name) + : _M_kind(__string), _M_variant() + { + _M_variant._M_string._M_name = __name; + _M_variant._M_string._M_value = __value; + } + + template + _Parameter(_Safe_iterator<_Iterator, _Sequence> const& __it, + const char* __name, _Is_iterator) + : _M_kind(__iterator), _M_variant() + { + _M_variant._M_iterator._M_name = __name; + _M_variant._M_iterator._M_address = std::__addressof(__it); + _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(__it); + _M_variant._M_iterator._M_constness = + std::__are_same<_Safe_iterator<_Iterator, _Sequence>, + typename _Sequence::iterator>:: + __value ? __mutable_iterator : __const_iterator; + _M_variant._M_iterator._M_sequence = __it._M_get_sequence(); + _M_variant._M_iterator._M_seq_type = _GLIBCXX_TYPEID(_Sequence); + + if (__it._M_singular()) + _M_variant._M_iterator._M_state = __singular; + else + { + if (__it._M_is_before_begin()) + _M_variant._M_iterator._M_state = __before_begin; + else if (__it._M_is_end()) + _M_variant._M_iterator._M_state = __end; + else if (__it._M_is_begin()) + _M_variant._M_iterator._M_state = __begin; + else + _M_variant._M_iterator._M_state = __middle; + } + } + + template + _Parameter(_Safe_local_iterator<_Iterator, _Sequence> const& __it, + const char* __name, _Is_iterator) + : _M_kind(__iterator), _M_variant() + { + _M_variant._M_iterator._M_name = __name; + _M_variant._M_iterator._M_address = std::__addressof(__it); + _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(__it); + _M_variant._M_iterator._M_constness = + std::__are_same<_Safe_local_iterator<_Iterator, _Sequence>, + typename _Sequence::local_iterator>:: + __value ? __mutable_iterator : __const_iterator; + _M_variant._M_iterator._M_sequence = __it._M_get_sequence(); + _M_variant._M_iterator._M_seq_type = _GLIBCXX_TYPEID(_Sequence); + + if (__it._M_singular()) + _M_variant._M_iterator._M_state = __singular; + else + { + if (__it._M_is_end()) + _M_variant._M_iterator._M_state = __end; + else if (__it._M_is_begin()) + _M_variant._M_iterator._M_state = __begin; + else + _M_variant._M_iterator._M_state = __middle; + } + } + + template + _Parameter(const _Type* const& __it, const char* __name, _Is_iterator) + : _M_kind(__iterator), _M_variant() + { + _M_variant._M_iterator._M_name = __name; + _M_variant._M_iterator._M_address = std::__addressof(__it); + _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(__it); + _M_variant._M_iterator._M_constness = __const_iterator; + _M_variant._M_iterator._M_state = __it ? __unknown_state : __singular; + _M_variant._M_iterator._M_sequence = 0; + _M_variant._M_iterator._M_seq_type = 0; + } + + template + _Parameter(_Type* const& __it, const char* __name, _Is_iterator) + : _M_kind(__iterator), _M_variant() + { + _M_variant._M_iterator._M_name = __name; + _M_variant._M_iterator._M_address = std::__addressof(__it); + _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(__it); + _M_variant._M_iterator._M_constness = __mutable_iterator; + _M_variant._M_iterator._M_state = __it ? __unknown_state : __singular; + _M_variant._M_iterator._M_sequence = 0; + _M_variant._M_iterator._M_seq_type = 0; + } + + template + _Parameter(_Iterator const& __it, const char* __name, _Is_iterator) + : _M_kind(__iterator), _M_variant() + { + _M_variant._M_iterator._M_name = __name; + _M_variant._M_iterator._M_address = std::__addressof(__it); + _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(__it); + _M_variant._M_iterator._M_constness = __unknown_constness; + _M_variant._M_iterator._M_state = + __gnu_debug::__check_singular(__it) ? __singular : __unknown_state; + _M_variant._M_iterator._M_sequence = 0; + _M_variant._M_iterator._M_seq_type = 0; + } + + template + _Parameter(const _Safe_sequence<_Sequence>& __seq, + const char* __name, _Is_sequence) + : _M_kind(__sequence), _M_variant() + { + _M_variant._M_sequence._M_name = __name; + _M_variant._M_sequence._M_address = + static_cast(std::__addressof(__seq)); + _M_variant._M_sequence._M_type = _GLIBCXX_TYPEID(_Sequence); + } + + template + _Parameter(const _Sequence& __seq, const char* __name, _Is_sequence) + : _M_kind(__sequence), _M_variant() + { + _M_variant._M_sequence._M_name = __name; + _M_variant._M_sequence._M_address = std::__addressof(__seq); + _M_variant._M_sequence._M_type = _GLIBCXX_TYPEID(_Sequence); + } + + template + _Parameter(const _Iterator& __it, const char* __name, + _Is_iterator_value_type) + : _M_kind(__iterator_value_type), _M_variant() + { + _M_variant._M_iterator_value_type._M_name = __name; + _M_variant._M_iterator_value_type._M_type = + _GLIBCXX_TYPEID(typename std::iterator_traits<_Iterator>::value_type); + } + + template + _Parameter(const _Type& __inst, const char* __name, _Is_instance) + : _M_kind(__instance), _M_variant() + { + _M_variant._M_instance._M_name = __name; + _M_variant._M_instance._M_address = &__inst; + _M_variant._M_instance._M_type = _GLIBCXX_TYPEID(_Type); + } + + void + _M_print_field(const _Error_formatter* __formatter, + const char* __name) const _GLIBCXX_DEPRECATED; + + void + _M_print_description(const _Error_formatter* __formatter) + const _GLIBCXX_DEPRECATED; + }; + + template + _Error_formatter& + _M_iterator(const _Iterator& __it, const char* __name = 0) + { + if (_M_num_parameters < std::size_t(__max_parameters)) + _M_parameters[_M_num_parameters++] = _Parameter(__it, __name, + _Is_iterator()); + return *this; + } + + template + _Error_formatter& + _M_iterator_value_type(const _Iterator& __it, + const char* __name = 0) + { + if (_M_num_parameters < __max_parameters) + _M_parameters[_M_num_parameters++] = + _Parameter(__it, __name, _Is_iterator_value_type()); + return *this; + } + + _Error_formatter& + _M_integer(long __value, const char* __name = 0) + { + if (_M_num_parameters < __max_parameters) + _M_parameters[_M_num_parameters++] = _Parameter(__value, __name); + return *this; + } + + _Error_formatter& + _M_string(const char* __value, const char* __name = 0) + { + if (_M_num_parameters < __max_parameters) + _M_parameters[_M_num_parameters++] = _Parameter(__value, __name); + return *this; + } + + template + _Error_formatter& + _M_sequence(const _Sequence& __seq, const char* __name = 0) + { + if (_M_num_parameters < __max_parameters) + _M_parameters[_M_num_parameters++] = _Parameter(__seq, __name, + _Is_sequence()); + return *this; + } + + template + _Error_formatter& + _M_instance(const _Type& __inst, const char* __name = 0) + { + if (_M_num_parameters < __max_parameters) + _M_parameters[_M_num_parameters++] = _Parameter(__inst, __name, + _Is_instance()); + return *this; + } + + _Error_formatter& + _M_message(const char* __text) + { _M_text = __text; return *this; } + + // Kept const qualifier for backward compatibility, to keep the same + // exported symbol. + _Error_formatter& + _M_message(_Debug_msg_id __id) const throw (); + + _GLIBCXX_NORETURN void + _M_error() const; + + template + void + _M_format_word(char*, int, const char*, _Tp) + const throw () _GLIBCXX_DEPRECATED; + + void + _M_print_word(const char* __word) const _GLIBCXX_DEPRECATED; + + void + _M_print_string(const char* __string) const _GLIBCXX_DEPRECATED; + + private: + _Error_formatter(const char* __file, unsigned int __line) + : _M_file(__file), _M_line(__line), _M_num_parameters(0), _M_text(0) + { } + + void + _M_get_max_length() const throw () _GLIBCXX_DEPRECATED; + + enum { __max_parameters = 9 }; + + const char* _M_file; + unsigned int _M_line; + _Parameter _M_parameters[__max_parameters]; + unsigned int _M_num_parameters; + const char* _M_text; + + public: + static _Error_formatter& + _M_at(const char* __file, unsigned int __line) + { + static _Error_formatter __formatter(__file, __line); + return __formatter; + } + }; +} // namespace __gnu_debug + +#undef _GLIBCXX_TYPEID + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/functions.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/functions.h new file mode 100644 index 0000000..be8b5a5 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/functions.h @@ -0,0 +1,492 @@ +// Debugging support implementation -*- C++ -*- + +// Copyright (C) 2003-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/functions.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_FUNCTIONS_H +#define _GLIBCXX_DEBUG_FUNCTIONS_H 1 + +#include // for __addressof +#include // for less +#if __cplusplus >= 201103L +# include // for is_lvalue_reference and conditional. +#endif + +#include +#include + +namespace __gnu_debug +{ + template + class _Safe_iterator; + + template + struct _Insert_range_from_self_is_safe + { enum { __value = 0 }; }; + + template + struct _Is_contiguous_sequence : std::__false_type { }; + + // An arbitrary iterator pointer is not singular. + inline bool + __check_singular_aux(const void*) { return false; } + + // We may have an iterator that derives from _Safe_iterator_base but isn't + // a _Safe_iterator. + template + inline bool + __check_singular(const _Iterator& __x) + { return __check_singular_aux(std::__addressof(__x)); } + + /** Non-NULL pointers are nonsingular. */ + template + inline bool + __check_singular(const _Tp* __ptr) + { return __ptr == 0; } + + /** Assume that some arbitrary iterator is dereferenceable, because we + can't prove that it isn't. */ + template + inline bool + __check_dereferenceable(const _Iterator&) + { return true; } + + /** Non-NULL pointers are dereferenceable. */ + template + inline bool + __check_dereferenceable(const _Tp* __ptr) + { return __ptr; } + + /* Checks that [first, last) is a valid range, and then returns + * __first. This routine is useful when we can't use a separate + * assertion statement because, e.g., we are in a constructor. + */ + template + inline _InputIterator + __check_valid_range(const _InputIterator& __first, + const _InputIterator& __last + __attribute__((__unused__))) + { + __glibcxx_check_valid_range(__first, __last); + return __first; + } + + /* Handle the case where __other is a pointer to _Sequence::value_type. */ + template + inline bool + __foreign_iterator_aux4(const _Safe_iterator<_Iterator, _Sequence>& __it, + const typename _Sequence::value_type* __other) + { + typedef const typename _Sequence::value_type* _PointerType; + typedef std::less<_PointerType> _Less; +#if __cplusplus >= 201103L + constexpr _Less __l{}; +#else + const _Less __l = _Less(); +#endif + const _Sequence* __seq = __it._M_get_sequence(); + const _PointerType __begin = std::__addressof(*__seq->_M_base().begin()); + const _PointerType __end = std::__addressof(*(__seq->_M_base().end()-1)); + + // Check whether __other points within the contiguous storage. + return __l(__other, __begin) || __l(__end, __other); + } + + /* Fallback overload for when we can't tell, assume it is valid. */ + template + inline bool + __foreign_iterator_aux4(const _Safe_iterator<_Iterator, _Sequence>&, ...) + { return true; } + + /* Handle sequences with contiguous storage */ + template + inline bool + __foreign_iterator_aux3(const _Safe_iterator<_Iterator, _Sequence>& __it, + const _InputIterator& __other, + const _InputIterator& __other_end, + std::__true_type) + { + if (__other == __other_end) + return true; // inserting nothing is safe even if not foreign iters + if (__it._M_get_sequence()->begin() == __it._M_get_sequence()->end()) + return true; // can't be self-inserting if self is empty + return __foreign_iterator_aux4(__it, std::__addressof(*__other)); + } + + /* Handle non-contiguous containers, assume it is valid. */ + template + inline bool + __foreign_iterator_aux3(const _Safe_iterator<_Iterator, _Sequence>&, + const _InputIterator&, const _InputIterator&, + std::__false_type) + { return true; } + + /** Handle debug iterators from the same type of container. */ + template + inline bool + __foreign_iterator_aux2(const _Safe_iterator<_Iterator, _Sequence>& __it, + const _Safe_iterator<_OtherIterator, _Sequence>& __other, + const _Safe_iterator<_OtherIterator, _Sequence>&) + { return __it._M_get_sequence() != __other._M_get_sequence(); } + + /** Handle debug iterators from different types of container. */ + template + inline bool + __foreign_iterator_aux2(const _Safe_iterator<_Iterator, _Sequence>& __it, + const _Safe_iterator<_OtherIterator, _OtherSequence>&, + const _Safe_iterator<_OtherIterator, _OtherSequence>&) + { return true; } + + /* Handle non-debug iterators. */ + template + inline bool + __foreign_iterator_aux2(const _Safe_iterator<_Iterator, _Sequence>& __it, + const _InputIterator& __other, + const _InputIterator& __other_end) + { +#if __cplusplus < 201103L + typedef _Is_contiguous_sequence<_Sequence> __tag; +#else + using __lvalref = std::is_lvalue_reference< + typename std::iterator_traits<_InputIterator>::reference>; + using __contiguous = _Is_contiguous_sequence<_Sequence>; + using __tag = typename std::conditional<__lvalref::value, __contiguous, + std::__false_type>::type; +#endif + return __foreign_iterator_aux3(__it, __other, __other_end, __tag()); + } + + /* Handle the case where we aren't really inserting a range after all */ + template + inline bool + __foreign_iterator_aux(const _Safe_iterator<_Iterator, _Sequence>&, + _Integral, _Integral, + std::__true_type) + { return true; } + + /* Handle all iterators. */ + template + inline bool + __foreign_iterator_aux(const _Safe_iterator<_Iterator, _Sequence>& __it, + _InputIterator __other, _InputIterator __other_end, + std::__false_type) + { + return _Insert_range_from_self_is_safe<_Sequence>::__value + || __foreign_iterator_aux2(__it, std::__miter_base(__other), + std::__miter_base(__other_end)); + } + + template + inline bool + __foreign_iterator(const _Safe_iterator<_Iterator, _Sequence>& __it, + _InputIterator __other, _InputIterator __other_end) + { + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + return __foreign_iterator_aux(__it, __other, __other_end, _Integral()); + } + + /** Checks that __s is non-NULL or __n == 0, and then returns __s. */ + template + inline const _CharT* + __check_string(const _CharT* __s, + const _Integer& __n __attribute__((__unused__))) + { +#ifdef _GLIBCXX_DEBUG_PEDANTIC + __glibcxx_assert(__s != 0 || __n == 0); +#endif + return __s; + } + + /** Checks that __s is non-NULL and then returns __s. */ + template + inline const _CharT* + __check_string(const _CharT* __s) + { +#ifdef _GLIBCXX_DEBUG_PEDANTIC + __glibcxx_assert(__s != 0); +#endif + return __s; + } + + // Can't check if an input iterator sequence is sorted, because we + // can't step through the sequence. + template + inline bool + __check_sorted_aux(const _InputIterator&, const _InputIterator&, + std::input_iterator_tag) + { return true; } + + // Can verify if a forward iterator sequence is in fact sorted using + // std::__is_sorted + template + inline bool + __check_sorted_aux(_ForwardIterator __first, _ForwardIterator __last, + std::forward_iterator_tag) + { + if (__first == __last) + return true; + + _ForwardIterator __next = __first; + for (++__next; __next != __last; __first = __next, (void)++__next) + if (*__next < *__first) + return false; + + return true; + } + + // Can't check if an input iterator sequence is sorted, because we can't step + // through the sequence. + template + inline bool + __check_sorted_aux(const _InputIterator&, const _InputIterator&, + _Predicate, std::input_iterator_tag) + { return true; } + + // Can verify if a forward iterator sequence is in fact sorted using + // std::__is_sorted + template + inline bool + __check_sorted_aux(_ForwardIterator __first, _ForwardIterator __last, + _Predicate __pred, std::forward_iterator_tag) + { + if (__first == __last) + return true; + + _ForwardIterator __next = __first; + for (++__next; __next != __last; __first = __next, (void)++__next) + if (__pred(*__next, *__first)) + return false; + + return true; + } + + // Determine if a sequence is sorted. + template + inline bool + __check_sorted(const _InputIterator& __first, const _InputIterator& __last) + { + // Verify that the < operator for elements in the sequence is a + // StrictWeakOrdering by checking that it is irreflexive. + __glibcxx_assert(__first == __last || !(*__first < *__first)); + + return __check_sorted_aux(__first, __last, + std::__iterator_category(__first)); + } + + template + inline bool + __check_sorted(const _InputIterator& __first, const _InputIterator& __last, + _Predicate __pred) + { + // Verify that the predicate is StrictWeakOrdering by checking that it + // is irreflexive. + __glibcxx_assert(__first == __last || !__pred(*__first, *__first)); + + return __check_sorted_aux(__first, __last, __pred, + std::__iterator_category(__first)); + } + + template + inline bool + __check_sorted_set_aux(const _InputIterator& __first, + const _InputIterator& __last, + std::__true_type) + { return __check_sorted(__first, __last); } + + template + inline bool + __check_sorted_set_aux(const _InputIterator&, + const _InputIterator&, + std::__false_type) + { return true; } + + template + inline bool + __check_sorted_set_aux(const _InputIterator& __first, + const _InputIterator& __last, + _Predicate __pred, std::__true_type) + { return __check_sorted(__first, __last, __pred); } + + template + inline bool + __check_sorted_set_aux(const _InputIterator&, + const _InputIterator&, _Predicate, + std::__false_type) + { return true; } + + // ... special variant used in std::merge, std::includes, std::set_*. + template + inline bool + __check_sorted_set(const _InputIterator1& __first, + const _InputIterator1& __last, + const _InputIterator2&) + { + typedef typename std::iterator_traits<_InputIterator1>::value_type + _ValueType1; + typedef typename std::iterator_traits<_InputIterator2>::value_type + _ValueType2; + + typedef typename std::__are_same<_ValueType1, _ValueType2>::__type + _SameType; + return __check_sorted_set_aux(__first, __last, _SameType()); + } + + template + inline bool + __check_sorted_set(const _InputIterator1& __first, + const _InputIterator1& __last, + const _InputIterator2&, _Predicate __pred) + { + typedef typename std::iterator_traits<_InputIterator1>::value_type + _ValueType1; + typedef typename std::iterator_traits<_InputIterator2>::value_type + _ValueType2; + + typedef typename std::__are_same<_ValueType1, _ValueType2>::__type + _SameType; + return __check_sorted_set_aux(__first, __last, __pred, _SameType()); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 270. Binary search requirements overly strict + // Determine if a sequence is partitioned w.r.t. this element. + template + inline bool + __check_partitioned_lower(_ForwardIterator __first, + _ForwardIterator __last, const _Tp& __value) + { + while (__first != __last && *__first < __value) + ++__first; + if (__first != __last) + { + ++__first; + while (__first != __last && !(*__first < __value)) + ++__first; + } + return __first == __last; + } + + template + inline bool + __check_partitioned_upper(_ForwardIterator __first, + _ForwardIterator __last, const _Tp& __value) + { + while (__first != __last && !(__value < *__first)) + ++__first; + if (__first != __last) + { + ++__first; + while (__first != __last && __value < *__first) + ++__first; + } + return __first == __last; + } + + // Determine if a sequence is partitioned w.r.t. this element. + template + inline bool + __check_partitioned_lower(_ForwardIterator __first, + _ForwardIterator __last, const _Tp& __value, + _Pred __pred) + { + while (__first != __last && bool(__pred(*__first, __value))) + ++__first; + if (__first != __last) + { + ++__first; + while (__first != __last && !bool(__pred(*__first, __value))) + ++__first; + } + return __first == __last; + } + + template + inline bool + __check_partitioned_upper(_ForwardIterator __first, + _ForwardIterator __last, const _Tp& __value, + _Pred __pred) + { + while (__first != __last && !bool(__pred(__value, *__first))) + ++__first; + if (__first != __last) + { + ++__first; + while (__first != __last && bool(__pred(__value, *__first))) + ++__first; + } + return __first == __last; + } + +#if __cplusplus >= 201103L + struct _Irreflexive_checker + { + template + static typename std::iterator_traits<_It>::reference + __deref(); + + template() < __deref<_It>())> + static bool + _S_is_valid(_It __it) + { return !(*__it < *__it); } + + // Fallback method if operator doesn't exist. + template + static bool + _S_is_valid(_Args...) + { return true; } + + template()(__deref<_It>(), __deref<_It>()))> + static bool + _S_is_valid_pred(_It __it, _Pred __pred) + { return !__pred(*__it, *__it); } + + // Fallback method if predicate can't be invoked. + template + static bool + _S_is_valid_pred(_Args...) + { return true; } + }; + + template + inline bool + __is_irreflexive(_Iterator __it) + { return _Irreflexive_checker::_S_is_valid(__it); } + + template + inline bool + __is_irreflexive_pred(_Iterator __it, _Pred __pred) + { return _Irreflexive_checker::_S_is_valid_pred(__it, __pred); } +#endif + +} // namespace __gnu_debug + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/helper_functions.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/helper_functions.h new file mode 100644 index 0000000..80e0e80 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/helper_functions.h @@ -0,0 +1,211 @@ +// Debugging support implementation -*- C++ -*- + +// Copyright (C) 2003-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/helper_functions.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_HELPER_FUNCTIONS_H +#define _GLIBCXX_DEBUG_HELPER_FUNCTIONS_H 1 + +#include // for iterator_traits, + // categories and _Iter_base +#include // for __is_integer + +#include // for pair + +namespace __gnu_debug +{ + /** The precision to which we can calculate the distance between + * two iterators. + */ + enum _Distance_precision + { + __dp_none, // Not even an iterator type + __dp_equality, //< Can compare iterator equality, only + __dp_sign, //< Can determine equality and ordering + __dp_exact //< Can determine distance precisely + }; + + template::__type> + struct _Distance_traits + { + private: + typedef + typename std::iterator_traits<_Iterator>::difference_type _ItDiffType; + + template::__type> + struct _DiffTraits + { typedef _DiffType __type; }; + + template + struct _DiffTraits<_DiffType, std::__true_type> + { typedef std::ptrdiff_t __type; }; + + typedef typename _DiffTraits<_ItDiffType>::__type _DiffType; + + public: + typedef std::pair<_DiffType, _Distance_precision> __type; + }; + + template + struct _Distance_traits<_Integral, std::__true_type> + { typedef std::pair __type; }; + + /** Determine the distance between two iterators with some known + * precision. + */ + template + inline typename _Distance_traits<_Iterator>::__type + __get_distance(const _Iterator& __lhs, const _Iterator& __rhs, + std::random_access_iterator_tag) + { return std::make_pair(__rhs - __lhs, __dp_exact); } + + template + inline typename _Distance_traits<_Iterator>::__type + __get_distance(const _Iterator& __lhs, const _Iterator& __rhs, + std::input_iterator_tag) + { + if (__lhs == __rhs) + return std::make_pair(0, __dp_exact); + + return std::make_pair(1, __dp_equality); + } + + template + inline typename _Distance_traits<_Iterator>::__type + __get_distance(const _Iterator& __lhs, const _Iterator& __rhs) + { return __get_distance(__lhs, __rhs, std::__iterator_category(__lhs)); } + + /** We say that integral types for a valid range, and defer to other + * routines to realize what to do with integral types instead of + * iterators. + */ + template + inline bool + __valid_range_aux(const _Integral&, const _Integral&, + typename _Distance_traits<_Integral>::__type& __dist, + std::__true_type) + { + __dist = std::make_pair(0, __dp_none); + return true; + } + + /** We have iterators, so figure out what kind of iterators that are + * to see if we can check the range ahead of time. + */ + template + inline bool + __valid_range_aux(const _InputIterator& __first, + const _InputIterator& __last, + typename _Distance_traits<_InputIterator>::__type& __dist, + std::__false_type) + { + __dist = __get_distance(__first, __last); + switch (__dist.second) + { + case __dp_none: + break; + case __dp_equality: + if (__dist.first == 0) + return true; + break; + case __dp_sign: + case __dp_exact: + return __dist.first >= 0; + } + + // Can't tell so assume it is fine. + return true; + } + + /** Don't know what these iterators are, or if they are even + * iterators (we may get an integral type for InputIterator), so + * see if they are integral and pass them on to the next phase + * otherwise. + */ + template + inline bool + __valid_range(const _InputIterator& __first, const _InputIterator& __last, + typename _Distance_traits<_InputIterator>::__type& __dist) + { + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + return __valid_range_aux(__first, __last, __dist, _Integral()); + } + + template + inline bool + __valid_range(const _InputIterator& __first, const _InputIterator& __last) + { + typename _Distance_traits<_InputIterator>::__type __dist; + return __valid_range(__first, __last, __dist); + } + +#if __cplusplus < 201103L + // Helper struct to detect random access safe iterators. + template + struct __is_safe_random_iterator + { + enum { __value = 0 }; + typedef std::__false_type __type; + }; + + template + struct _Siter_base + : std::_Iter_base<_Iterator, __is_safe_random_iterator<_Iterator>::__value> + { }; + + /** Helper function to extract base iterator of random access safe iterator + in order to reduce performance impact of debug mode. Limited to random + access iterator because it is the only category for which it is possible + to check for correct iterators order in the __valid_range function + thanks to the < operator. + */ + template + inline typename _Siter_base<_Iterator>::iterator_type + __base(_Iterator __it) + { return _Siter_base<_Iterator>::_S_base(__it); } +#else + template + inline _Iterator + __base(_Iterator __it) + { return __it; } +#endif + +#if __cplusplus < 201103L + template + struct _Unsafe_type + { typedef _Iterator _Type; }; +#endif + + /* Remove debug mode safe iterator layer, if any. */ + template + inline _Iterator + __unsafe(_Iterator __it) + { return __it; } +} + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/macros.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/macros.h new file mode 100644 index 0000000..2ecba55 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/macros.h @@ -0,0 +1,398 @@ +// Debugging support implementation -*- C++ -*- + +// Copyright (C) 2003-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/macros.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_MACROS_H +#define _GLIBCXX_DEBUG_MACROS_H 1 + +/** + * Macros used by the implementation to verify certain + * properties. These macros may only be used directly by the debug + * wrappers. Note that these are macros (instead of the more obviously + * @a correct choice of making them functions) because we need line and + * file information at the call site, to minimize the distance between + * the user error and where the error is reported. + * + */ +#define _GLIBCXX_DEBUG_VERIFY_AT(_Condition,_ErrorMessage,_File,_Line) \ + do \ + { \ + if (! (_Condition)) \ + __gnu_debug::_Error_formatter::_M_at(_File, _Line) \ + ._ErrorMessage._M_error(); \ + } while (false) + +#define _GLIBCXX_DEBUG_VERIFY(_Condition,_ErrorMessage) \ + _GLIBCXX_DEBUG_VERIFY_AT(_Condition,_ErrorMessage,__FILE__,__LINE__) + +// Verify that [_First, _Last) forms a valid iterator range. +#define __glibcxx_check_valid_range(_First,_Last) \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__valid_range(_First, _Last), \ + _M_message(__gnu_debug::__msg_valid_range) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last)) + +#define __glibcxx_check_valid_range2(_First,_Last,_Dist) \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__valid_range(_First, _Last, _Dist), \ + _M_message(__gnu_debug::__msg_valid_range) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last)) + +// Verify that [_First, _Last) forms a non-empty iterator range. +#define __glibcxx_check_non_empty_range(_First,_Last) \ +_GLIBCXX_DEBUG_VERIFY(_First != _Last, \ + _M_message(__gnu_debug::__msg_non_empty_range) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last)) + +/** Verify that we can insert into *this with the iterator _Position. + * Insertion into a container at a specific position requires that + * the iterator be nonsingular, either dereferenceable or past-the-end, + * and that it reference the sequence we are inserting into. Note that + * this macro is only valid when the container is a_Safe_sequence and + * the iterator is a _Safe_iterator. +*/ +#define __glibcxx_check_insert(_Position) \ +_GLIBCXX_DEBUG_VERIFY(!_Position._M_singular(), \ + _M_message(__gnu_debug::__msg_insert_singular) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_Position, #_Position)); \ +_GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \ + _M_message(__gnu_debug::__msg_insert_different) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_Position, #_Position)) + +/** Verify that we can insert into *this after the iterator _Position. + * Insertion into a container after a specific position requires that + * the iterator be nonsingular, either dereferenceable or before-begin, + * and that it reference the sequence we are inserting into. Note that + * this macro is only valid when the container is a_Safe_sequence and + * the iterator is a _Safe_iterator. +*/ +#define __glibcxx_check_insert_after(_Position) \ +__glibcxx_check_insert(_Position); \ +_GLIBCXX_DEBUG_VERIFY(!_Position._M_is_end(), \ + _M_message(__gnu_debug::__msg_insert_after_end) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_Position, #_Position)) + +/** Verify that we can insert the values in the iterator range + * [_First, _Last) into *this with the iterator _Position. Insertion + * into a container at a specific position requires that the iterator + * be nonsingular (i.e., either dereferenceable or past-the-end), + * that it reference the sequence we are inserting into, and that the + * iterator range [_First, _Last) is a valid (possibly empty) + * range which does not reference the sequence we are inserting into. + * Note that this macro is only valid when the container is a + * _Safe_sequence and the _Position iterator is a _Safe_iterator. +*/ +#define __glibcxx_check_insert_range(_Position,_First,_Last,_Dist) \ +__glibcxx_check_valid_range2(_First,_Last,_Dist); \ +__glibcxx_check_insert(_Position); \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__foreign_iterator(_Position,_First,_Last),\ + _M_message(__gnu_debug::__msg_insert_range_from_self)\ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last) \ + ._M_sequence(*this, "this")) + +/** Verify that we can insert the values in the iterator range + * [_First, _Last) into *this after the iterator _Position. Insertion + * into a container after a specific position requires that the iterator + * be nonsingular (i.e., either dereferenceable or past-the-end), + * that it reference the sequence we are inserting into, and that the + * iterator range [_First, _Last) is a valid (possibly empty) + * range which does not reference the sequence we are inserting into. + * Note that this macro is only valid when the container is a + * _Safe_sequence and the _Position iterator is a _Safe_iterator. +*/ +#define __glibcxx_check_insert_range_after(_Position,_First,_Last,_Dist)\ + __glibcxx_check_valid_range2(_First,_Last,_Dist); \ +__glibcxx_check_insert_after(_Position); \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__foreign_iterator(_Position,_First,_Last),\ + _M_message(__gnu_debug::__msg_insert_range_from_self)\ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last) \ + ._M_sequence(*this, "this")) + +/** Verify that we can erase the element referenced by the iterator + * _Position. We can erase the element if the _Position iterator is + * dereferenceable and references this sequence. +*/ +#define __glibcxx_check_erase(_Position) \ +_GLIBCXX_DEBUG_VERIFY(_Position._M_dereferenceable(), \ + _M_message(__gnu_debug::__msg_erase_bad) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_Position, #_Position)); \ +_GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \ + _M_message(__gnu_debug::__msg_erase_different) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_Position, #_Position)) + +/** Verify that we can erase the element after the iterator + * _Position. We can erase the element if the _Position iterator is + * before a dereferenceable one and references this sequence. +*/ +#define __glibcxx_check_erase_after(_Position) \ +_GLIBCXX_DEBUG_VERIFY(_Position._M_before_dereferenceable(), \ + _M_message(__gnu_debug::__msg_erase_after_bad) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_Position, #_Position)); \ +_GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \ + _M_message(__gnu_debug::__msg_erase_different) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_Position, #_Position)) + +/** Verify that we can erase the elements in the iterator range + * [_First, _Last). We can erase the elements if [_First, _Last) is a + * valid iterator range within this sequence. +*/ +#define __glibcxx_check_erase_range(_First,_Last) \ +__glibcxx_check_valid_range(_First,_Last); \ +_GLIBCXX_DEBUG_VERIFY(_First._M_attached_to(this), \ + _M_message(__gnu_debug::__msg_erase_different) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last)) + +/** Verify that we can erase the elements in the iterator range + * (_First, _Last). We can erase the elements if (_First, _Last) is a + * valid iterator range within this sequence. +*/ +#define __glibcxx_check_erase_range_after(_First,_Last) \ +_GLIBCXX_DEBUG_VERIFY(_First._M_can_compare(_Last), \ + _M_message(__gnu_debug::__msg_erase_different) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last)); \ +_GLIBCXX_DEBUG_VERIFY(_First._M_attached_to(this), \ + _M_message(__gnu_debug::__msg_erase_different) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_First, #_First)); \ +_GLIBCXX_DEBUG_VERIFY(_First != _Last, \ + _M_message(__gnu_debug::__msg_valid_range2) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last)); \ +_GLIBCXX_DEBUG_VERIFY(_First._M_incrementable(), \ + _M_message(__gnu_debug::__msg_valid_range2) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last)); \ +_GLIBCXX_DEBUG_VERIFY(!_Last._M_is_before_begin(), \ + _M_message(__gnu_debug::__msg_valid_range2) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last)) \ + +// Verify that the subscript _N is less than the container's size. +#define __glibcxx_check_subscript(_N) \ +_GLIBCXX_DEBUG_VERIFY(_N < this->size(), \ + _M_message(__gnu_debug::__msg_subscript_oob) \ + ._M_sequence(*this, "this") \ + ._M_integer(_N, #_N) \ + ._M_integer(this->size(), "size")) + +// Verify that the bucket _N is less than the container's buckets count. +#define __glibcxx_check_bucket_index(_N) \ +_GLIBCXX_DEBUG_VERIFY(_N < this->bucket_count(), \ + _M_message(__gnu_debug::__msg_bucket_index_oob) \ + ._M_sequence(*this, "this") \ + ._M_integer(_N, #_N) \ + ._M_integer(this->bucket_count(), "size")) + +// Verify that the container is nonempty +#define __glibcxx_check_nonempty() \ +_GLIBCXX_DEBUG_VERIFY(! this->empty(), \ + _M_message(__gnu_debug::__msg_empty) \ + ._M_sequence(*this, "this")) + +// Verify that the iterator range [_First, _Last) is sorted +#define __glibcxx_check_sorted(_First,_Last) \ +__glibcxx_check_valid_range(_First,_Last); \ + _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_sorted( \ + __gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last)), \ + _M_message(__gnu_debug::__msg_unsorted) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last)) + +/** Verify that the iterator range [_First, _Last) is sorted by the + predicate _Pred. */ +#define __glibcxx_check_sorted_pred(_First,_Last,_Pred) \ +__glibcxx_check_valid_range(_First,_Last); \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_sorted( \ + __gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last), _Pred), \ + _M_message(__gnu_debug::__msg_unsorted_pred) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last) \ + ._M_string(#_Pred)) + +// Special variant for std::merge, std::includes, std::set_* +#define __glibcxx_check_sorted_set(_First1,_Last1,_First2) \ +__glibcxx_check_valid_range(_First1,_Last1); \ +_GLIBCXX_DEBUG_VERIFY( \ + __gnu_debug::__check_sorted_set(__gnu_debug::__base(_First1), \ + __gnu_debug::__base(_Last1), _First2),\ + _M_message(__gnu_debug::__msg_unsorted) \ + ._M_iterator(_First1, #_First1) \ + ._M_iterator(_Last1, #_Last1)) + +// Likewise with a _Pred. +#define __glibcxx_check_sorted_set_pred(_First1,_Last1,_First2,_Pred) \ +__glibcxx_check_valid_range(_First1,_Last1); \ +_GLIBCXX_DEBUG_VERIFY( \ + __gnu_debug::__check_sorted_set(__gnu_debug::__base(_First1), \ + __gnu_debug::__base(_Last1), \ + _First2, _Pred), \ + _M_message(__gnu_debug::__msg_unsorted_pred) \ + ._M_iterator(_First1, #_First1) \ + ._M_iterator(_Last1, #_Last1) \ + ._M_string(#_Pred)) + +/** Verify that the iterator range [_First, _Last) is partitioned + w.r.t. the value _Value. */ +#define __glibcxx_check_partitioned_lower(_First,_Last,_Value) \ +__glibcxx_check_valid_range(_First,_Last); \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower( \ + __gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last), _Value), \ + _M_message(__gnu_debug::__msg_unpartitioned) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last) \ + ._M_string(#_Value)) + +#define __glibcxx_check_partitioned_upper(_First,_Last,_Value) \ +__glibcxx_check_valid_range(_First,_Last); \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper( \ + __gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last), _Value), \ + _M_message(__gnu_debug::__msg_unpartitioned) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last) \ + ._M_string(#_Value)) + +/** Verify that the iterator range [_First, _Last) is partitioned + w.r.t. the value _Value and predicate _Pred. */ +#define __glibcxx_check_partitioned_lower_pred(_First,_Last,_Value,_Pred) \ +__glibcxx_check_valid_range(_First,_Last); \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower( \ + __gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last), _Value, _Pred), \ + _M_message(__gnu_debug::__msg_unpartitioned_pred) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last) \ + ._M_string(#_Pred) \ + ._M_string(#_Value)) + +/** Verify that the iterator range [_First, _Last) is partitioned + w.r.t. the value _Value and predicate _Pred. */ +#define __glibcxx_check_partitioned_upper_pred(_First,_Last,_Value,_Pred) \ +__glibcxx_check_valid_range(_First,_Last); \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper( \ + __gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last), _Value, _Pred), \ + _M_message(__gnu_debug::__msg_unpartitioned_pred) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last) \ + ._M_string(#_Pred) \ + ._M_string(#_Value)) + +// Verify that the iterator range [_First, _Last) is a heap +#define __glibcxx_check_heap(_First,_Last) \ + _GLIBCXX_DEBUG_VERIFY(std::__is_heap(__gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last)), \ + _M_message(__gnu_debug::__msg_not_heap) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last)) + +/** Verify that the iterator range [_First, _Last) is a heap + w.r.t. the predicate _Pred. */ +#define __glibcxx_check_heap_pred(_First,_Last,_Pred) \ + _GLIBCXX_DEBUG_VERIFY(std::__is_heap(__gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last), \ + _Pred), \ + _M_message(__gnu_debug::__msg_not_heap_pred) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last) \ + ._M_string(#_Pred)) + +// Verify that the container is not self move assigned +#define __glibcxx_check_self_move_assign(_Other) \ +_GLIBCXX_DEBUG_VERIFY(this != &_Other, \ + _M_message(__gnu_debug::__msg_self_move_assign) \ + ._M_sequence(*this, "this")) + +// Verify that load factor is positive +#define __glibcxx_check_max_load_factor(_F) \ +_GLIBCXX_DEBUG_VERIFY(_F > 0.0f, \ + _M_message(__gnu_debug::__msg_valid_load_factor) \ + ._M_sequence(*this, "this")) + +#define __glibcxx_check_equal_allocs(_This, _Other) \ +_GLIBCXX_DEBUG_VERIFY(_This.get_allocator() == _Other.get_allocator(), \ + _M_message(__gnu_debug::__msg_equal_allocs) \ + ._M_sequence(_This, "this")) + +#define __glibcxx_check_string(_String) _GLIBCXX_DEBUG_PEDASSERT(_String != 0) +#define __glibcxx_check_string_len(_String,_Len) \ + _GLIBCXX_DEBUG_PEDASSERT(_String != 0 || _Len == 0) + +// Verify that a predicate is irreflexive +#define __glibcxx_check_irreflexive(_First,_Last) \ + _GLIBCXX_DEBUG_VERIFY(_First == _Last || !(*_First < *_First), \ + _M_message(__gnu_debug::__msg_irreflexive_ordering) \ + ._M_iterator_value_type(_First, "< operator type")) + +#if __cplusplus >= 201103L +# define __glibcxx_check_irreflexive2(_First,_Last) \ + _GLIBCXX_DEBUG_VERIFY(_First == _Last \ + || __gnu_debug::__is_irreflexive(_First), \ + _M_message(__gnu_debug::__msg_irreflexive_ordering) \ + ._M_iterator_value_type(_First, "< operator type")) +#else +# define __glibcxx_check_irreflexive2(_First,_Last) +#endif + +#define __glibcxx_check_irreflexive_pred(_First,_Last,_Pred) \ + _GLIBCXX_DEBUG_VERIFY(_First == _Last || !_Pred(*_First, *_First), \ + _M_message(__gnu_debug::__msg_irreflexive_ordering) \ + ._M_instance(_Pred, "functor") \ + ._M_iterator_value_type(_First, "ordered type")) + +#if __cplusplus >= 201103L +# define __glibcxx_check_irreflexive_pred2(_First,_Last,_Pred) \ + _GLIBCXX_DEBUG_VERIFY(_First == _Last \ + ||__gnu_debug::__is_irreflexive_pred(_First, _Pred), \ + _M_message(__gnu_debug::__msg_irreflexive_ordering) \ + ._M_instance(_Pred, "functor") \ + ._M_iterator_value_type(_First, "ordered type")) +#else +# define __glibcxx_check_irreflexive_pred2(_First,_Last,_Pred) +#endif + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/map.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/map.h new file mode 100644 index 0000000..ba6a620 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/map.h @@ -0,0 +1,741 @@ +// Debugging map implementation -*- C++ -*- + +// Copyright (C) 2003-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/map.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_MAP_H +#define _GLIBCXX_DEBUG_MAP_H 1 + +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace __debug +{ + /// Class std::map with safety/checking/debug instrumentation. + template, + typename _Allocator = std::allocator > > + class map + : public __gnu_debug::_Safe_container< + map<_Key, _Tp, _Compare, _Allocator>, _Allocator, + __gnu_debug::_Safe_node_sequence>, + public _GLIBCXX_STD_C::map<_Key, _Tp, _Compare, _Allocator> + { + typedef _GLIBCXX_STD_C::map< + _Key, _Tp, _Compare, _Allocator> _Base; + typedef __gnu_debug::_Safe_container< + map, _Allocator, __gnu_debug::_Safe_node_sequence> _Safe; + + typedef typename _Base::const_iterator _Base_const_iterator; + typedef typename _Base::iterator _Base_iterator; + typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; + + public: + // types: + typedef _Key key_type; + typedef _Tp mapped_type; + typedef std::pair value_type; + typedef _Compare key_compare; + typedef _Allocator allocator_type; + typedef typename _Base::reference reference; + typedef typename _Base::const_reference const_reference; + + typedef __gnu_debug::_Safe_iterator<_Base_iterator, map> + iterator; + typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, map> + const_iterator; + + typedef typename _Base::size_type size_type; + typedef typename _Base::difference_type difference_type; + typedef typename _Base::pointer pointer; + typedef typename _Base::const_pointer const_pointer; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + + // 23.3.1.1 construct/copy/destroy: + +#if __cplusplus < 201103L + map() : _Base() { } + + map(const map& __x) + : _Base(__x) { } + + ~map() { } +#else + map() = default; + map(const map&) = default; + map(map&&) = default; + + map(initializer_list __l, + const _Compare& __c = _Compare(), + const allocator_type& __a = allocator_type()) + : _Base(__l, __c, __a) { } + + explicit + map(const allocator_type& __a) + : _Base(__a) { } + + map(const map& __m, const allocator_type& __a) + : _Base(__m, __a) { } + + map(map&& __m, const allocator_type& __a) + : _Safe(std::move(__m._M_safe()), __a), + _Base(std::move(__m._M_base()), __a) { } + + map(initializer_list __l, const allocator_type& __a) + : _Base(__l, __a) { } + + template + map(_InputIterator __first, _InputIterator __last, + const allocator_type& __a) + : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, + __last)), + __gnu_debug::__base(__last), __a) + { } + + ~map() = default; +#endif + + map(const _Base& __x) + : _Base(__x) { } + + explicit map(const _Compare& __comp, + const _Allocator& __a = _Allocator()) + : _Base(__comp, __a) { } + + template + map(_InputIterator __first, _InputIterator __last, + const _Compare& __comp = _Compare(), + const _Allocator& __a = _Allocator()) + : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, + __last)), + __gnu_debug::__base(__last), + __comp, __a) { } + +#if __cplusplus < 201103L + map& + operator=(const map& __x) + { + this->_M_safe() = __x; + _M_base() = __x; + return *this; + } +#else + map& + operator=(const map&) = default; + + map& + operator=(map&&) = default; + + map& + operator=(initializer_list __l) + { + _M_base() = __l; + this->_M_invalidate_all(); + return *this; + } +#endif + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 133. map missing get_allocator() + using _Base::get_allocator; + + // iterators: + iterator + begin() _GLIBCXX_NOEXCEPT + { return iterator(_Base::begin(), this); } + + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::begin(), this); } + + iterator + end() _GLIBCXX_NOEXCEPT + { return iterator(_Base::end(), this); } + + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::end(), this); } + + reverse_iterator + rbegin() _GLIBCXX_NOEXCEPT + { return reverse_iterator(end()); } + + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(end()); } + + reverse_iterator + rend() _GLIBCXX_NOEXCEPT + { return reverse_iterator(begin()); } + + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(begin()); } + +#if __cplusplus >= 201103L + const_iterator + cbegin() const noexcept + { return const_iterator(_Base::begin(), this); } + + const_iterator + cend() const noexcept + { return const_iterator(_Base::end(), this); } + + const_reverse_iterator + crbegin() const noexcept + { return const_reverse_iterator(end()); } + + const_reverse_iterator + crend() const noexcept + { return const_reverse_iterator(begin()); } +#endif + + // capacity: + using _Base::empty; + using _Base::size; + using _Base::max_size; + + // 23.3.1.2 element access: + using _Base::operator[]; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 464. Suggestion for new member functions in standard containers. + using _Base::at; + + // modifiers: +#if __cplusplus >= 201103L + template + std::pair + emplace(_Args&&... __args) + { + auto __res = _Base::emplace(std::forward<_Args>(__args)...); + return std::pair(iterator(__res.first, this), + __res.second); + } + + template + iterator + emplace_hint(const_iterator __pos, _Args&&... __args) + { + __glibcxx_check_insert(__pos); + return iterator(_Base::emplace_hint(__pos.base(), + std::forward<_Args>(__args)...), + this); + } +#endif + + std::pair + insert(const value_type& __x) + { + std::pair<_Base_iterator, bool> __res = _Base::insert(__x); + return std::pair(iterator(__res.first, this), + __res.second); + } + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2354. Unnecessary copying when inserting into maps with braced-init + std::pair + insert(value_type&& __x) + { + auto __res = _Base::insert(std::move(__x)); + return { iterator(__res.first, this), __res.second }; + } + + template::value>::type> + std::pair + insert(_Pair&& __x) + { + std::pair<_Base_iterator, bool> __res + = _Base::insert(std::forward<_Pair>(__x)); + return std::pair(iterator(__res.first, this), + __res.second); + } +#endif + +#if __cplusplus >= 201103L + void + insert(std::initializer_list __list) + { _Base::insert(__list); } +#endif + + iterator +#if __cplusplus >= 201103L + insert(const_iterator __position, const value_type& __x) +#else + insert(iterator __position, const value_type& __x) +#endif + { + __glibcxx_check_insert(__position); + return iterator(_Base::insert(__position.base(), __x), this); + } + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2354. Unnecessary copying when inserting into maps with braced-init + iterator + insert(const_iterator __position, value_type&& __x) + { + __glibcxx_check_insert(__position); + return { _Base::insert(__position.base(), std::move(__x)), this }; + } + + template::value>::type> + iterator + insert(const_iterator __position, _Pair&& __x) + { + __glibcxx_check_insert(__position); + return iterator(_Base::insert(__position.base(), + std::forward<_Pair>(__x)), this); + } +#endif + + template + void + insert(_InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + + if (__dist.second >= __gnu_debug::__dp_sign) + _Base::insert(__gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + else + _Base::insert(__first, __last); + } + + +#if __cplusplus > 201402L + template + pair + try_emplace(const key_type& __k, _Args&&... __args) + { + auto __res = _Base::try_emplace(__k, + std::forward<_Args>(__args)...); + return { iterator(__res.first, this), __res.second }; + } + + template + pair + try_emplace(key_type&& __k, _Args&&... __args) + { + auto __res = _Base::try_emplace(std::move(__k), + std::forward<_Args>(__args)...); + return { iterator(__res.first, this), __res.second }; + } + + template + iterator + try_emplace(const_iterator __hint, const key_type& __k, + _Args&&... __args) + { + __glibcxx_check_insert(__hint); + return iterator(_Base::try_emplace(__hint.base(), __k, + std::forward<_Args>(__args)...), + this); + } + + template + iterator + try_emplace(const_iterator __hint, key_type&& __k, _Args&&... __args) + { + __glibcxx_check_insert(__hint); + return iterator(_Base::try_emplace(__hint.base(), std::move(__k), + std::forward<_Args>(__args)...), + this); + } + + template + std::pair + insert_or_assign(const key_type& __k, _Obj&& __obj) + { + auto __res = _Base::insert_or_assign(__k, + std::forward<_Obj>(__obj)); + return { iterator(__res.first, this), __res.second }; + } + + template + std::pair + insert_or_assign(key_type&& __k, _Obj&& __obj) + { + auto __res = _Base::insert_or_assign(std::move(__k), + std::forward<_Obj>(__obj)); + return { iterator(__res.first, this), __res.second }; + } + + template + iterator + insert_or_assign(const_iterator __hint, + const key_type& __k, _Obj&& __obj) + { + __glibcxx_check_insert(__hint); + return iterator(_Base::insert_or_assign(__hint.base(), __k, + std::forward<_Obj>(__obj)), + this); + } + + template + iterator + insert_or_assign(const_iterator __hint, key_type&& __k, _Obj&& __obj) + { + __glibcxx_check_insert(__hint); + return iterator(_Base::insert_or_assign(__hint.base(), + std::move(__k), + std::forward<_Obj>(__obj)), + this); + } +#endif // C++17 + +#if __cplusplus > 201402L + using node_type = typename _Base::node_type; + + struct insert_return_type + { + bool inserted; + iterator position; + node_type node; + }; + + node_type + extract(const_iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + return _Base::extract(__position.base()); + } + + node_type + extract(const key_type& __key) + { + const auto __position = find(__key); + if (__position != end()) + return extract(__position); + return {}; + } + + insert_return_type + insert(node_type&& __nh) + { + auto __ret = _Base::insert(std::move(__nh)); + iterator __pos = iterator(__ret.position, this); + return { __ret.inserted, __pos, std::move(__ret.node) }; + } + + iterator + insert(const_iterator __hint, node_type&& __nh) + { + __glibcxx_check_insert(__hint); + return iterator(_Base::insert(__hint.base(), std::move(__nh)), this); + } + + using _Base::merge; +#endif // C++17 + +#if __cplusplus >= 201103L + iterator + erase(const_iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + return iterator(_Base::erase(__position.base()), this); + } + + iterator + erase(iterator __position) + { return erase(const_iterator(__position)); } +#else + void + erase(iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + _Base::erase(__position.base()); + } +#endif + + size_type + erase(const key_type& __x) + { + _Base_iterator __victim = _Base::find(__x); + if (__victim == _Base::end()) + return 0; + else + { + this->_M_invalidate_if(_Equal(__victim)); + _Base::erase(__victim); + return 1; + } + } + +#if __cplusplus >= 201103L + iterator + erase(const_iterator __first, const_iterator __last) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 151. can't currently clear() empty container + __glibcxx_check_erase_range(__first, __last); + for (_Base_const_iterator __victim = __first.base(); + __victim != __last.base(); ++__victim) + { + _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), + _M_message(__gnu_debug::__msg_valid_range) + ._M_iterator(__first, "first") + ._M_iterator(__last, "last")); + this->_M_invalidate_if(_Equal(__victim)); + } + return iterator(_Base::erase(__first.base(), __last.base()), this); + } +#else + void + erase(iterator __first, iterator __last) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 151. can't currently clear() empty container + __glibcxx_check_erase_range(__first, __last); + for (_Base_iterator __victim = __first.base(); + __victim != __last.base(); ++__victim) + { + _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), + _M_message(__gnu_debug::__msg_valid_range) + ._M_iterator(__first, "first") + ._M_iterator(__last, "last")); + this->_M_invalidate_if(_Equal(__victim)); + } + _Base::erase(__first.base(), __last.base()); + } +#endif + + void + swap(map& __x) + _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) ) + { + _Safe::_M_swap(__x); + _Base::swap(__x); + } + + void + clear() _GLIBCXX_NOEXCEPT + { + this->_M_invalidate_all(); + _Base::clear(); + } + + // observers: + using _Base::key_comp; + using _Base::value_comp; + + // 23.3.1.3 map operations: + iterator + find(const key_type& __x) + { return iterator(_Base::find(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + find(const _Kt& __x) + { return { _Base::find(__x), this }; } +#endif + + const_iterator + find(const key_type& __x) const + { return const_iterator(_Base::find(__x), this); } + +#if __cplusplus > 201103L + template::type> + const_iterator + find(const _Kt& __x) const + { return { _Base::find(__x), this }; } +#endif + + using _Base::count; + + iterator + lower_bound(const key_type& __x) + { return iterator(_Base::lower_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + lower_bound(const _Kt& __x) + { return { _Base::lower_bound(__x), this }; } +#endif + + const_iterator + lower_bound(const key_type& __x) const + { return const_iterator(_Base::lower_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + const_iterator + lower_bound(const _Kt& __x) const + { return { _Base::lower_bound(__x), this }; } +#endif + + iterator + upper_bound(const key_type& __x) + { return iterator(_Base::upper_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + upper_bound(const _Kt& __x) + { return { _Base::upper_bound(__x), this }; } +#endif + + const_iterator + upper_bound(const key_type& __x) const + { return const_iterator(_Base::upper_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + const_iterator + upper_bound(const _Kt& __x) const + { return { _Base::upper_bound(__x), this }; } +#endif + + std::pair + equal_range(const key_type& __x) + { + std::pair<_Base_iterator, _Base_iterator> __res = + _Base::equal_range(__x); + return std::make_pair(iterator(__res.first, this), + iterator(__res.second, this)); + } + +#if __cplusplus > 201103L + template::type> + std::pair + equal_range(const _Kt& __x) + { + auto __res = _Base::equal_range(__x); + return { { __res.first, this }, { __res.second, this } }; + } +#endif + + std::pair + equal_range(const key_type& __x) const + { + std::pair<_Base_const_iterator, _Base_const_iterator> __res = + _Base::equal_range(__x); + return std::make_pair(const_iterator(__res.first, this), + const_iterator(__res.second, this)); + } + +#if __cplusplus > 201103L + template::type> + std::pair + equal_range(const _Kt& __x) const + { + auto __res = _Base::equal_range(__x); + return { { __res.first, this }, { __res.second, this } }; + } +#endif + + _Base& + _M_base() _GLIBCXX_NOEXCEPT { return *this; } + + const _Base& + _M_base() const _GLIBCXX_NOEXCEPT { return *this; } + }; + + template + inline bool + operator==(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, + const map<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() == __rhs._M_base(); } + + template + inline bool + operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, + const map<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() != __rhs._M_base(); } + + template + inline bool + operator<(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, + const map<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() < __rhs._M_base(); } + + template + inline bool + operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, + const map<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() <= __rhs._M_base(); } + + template + inline bool + operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, + const map<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() >= __rhs._M_base(); } + + template + inline bool + operator>(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, + const map<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() > __rhs._M_base(); } + + template + inline void + swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs, + map<_Key, _Tp, _Compare, _Allocator>& __rhs) + _GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs))) + { __lhs.swap(__rhs); } + +} // namespace __debug +} // namespace std + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/multimap.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/multimap.h new file mode 100644 index 0000000..08fc730 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/multimap.h @@ -0,0 +1,626 @@ +// Debugging multimap implementation -*- C++ -*- + +// Copyright (C) 2003-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/multimap.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_MULTIMAP_H +#define _GLIBCXX_DEBUG_MULTIMAP_H 1 + +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace __debug +{ + /// Class std::multimap with safety/checking/debug instrumentation. + template, + typename _Allocator = std::allocator > > + class multimap + : public __gnu_debug::_Safe_container< + multimap<_Key, _Tp, _Compare, _Allocator>, _Allocator, + __gnu_debug::_Safe_node_sequence>, + public _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator> + { + typedef _GLIBCXX_STD_C::multimap< + _Key, _Tp, _Compare, _Allocator> _Base; + typedef __gnu_debug::_Safe_container< + multimap, _Allocator, __gnu_debug::_Safe_node_sequence> _Safe; + + typedef typename _Base::const_iterator _Base_const_iterator; + typedef typename _Base::iterator _Base_iterator; + typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; + + public: + // types: + typedef _Key key_type; + typedef _Tp mapped_type; + typedef std::pair value_type; + typedef _Compare key_compare; + typedef _Allocator allocator_type; + typedef typename _Base::reference reference; + typedef typename _Base::const_reference const_reference; + + typedef __gnu_debug::_Safe_iterator<_Base_iterator, multimap> + iterator; + typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, + multimap> const_iterator; + + typedef typename _Base::size_type size_type; + typedef typename _Base::difference_type difference_type; + typedef typename _Base::pointer pointer; + typedef typename _Base::const_pointer const_pointer; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + + // 23.3.1.1 construct/copy/destroy: + +#if __cplusplus < 201103L + multimap() : _Base() { } + + multimap(const multimap& __x) + : _Base(__x) { } + + ~multimap() { } +#else + multimap() = default; + multimap(const multimap&) = default; + multimap(multimap&&) = default; + + multimap(initializer_list __l, + const _Compare& __c = _Compare(), + const allocator_type& __a = allocator_type()) + : _Base(__l, __c, __a) { } + + explicit + multimap(const allocator_type& __a) + : _Base(__a) { } + + multimap(const multimap& __m, const allocator_type& __a) + : _Base(__m, __a) { } + + multimap(multimap&& __m, const allocator_type& __a) + : _Safe(std::move(__m._M_safe()), __a), + _Base(std::move(__m._M_base()), __a) { } + + multimap(initializer_list __l, const allocator_type& __a) + : _Base(__l, __a) { } + + template + multimap(_InputIterator __first, _InputIterator __last, + const allocator_type& __a) + : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, + __last)), + __gnu_debug::__base(__last), __a) { } + + ~multimap() = default; +#endif + + explicit multimap(const _Compare& __comp, + const _Allocator& __a = _Allocator()) + : _Base(__comp, __a) { } + + template + multimap(_InputIterator __first, _InputIterator __last, + const _Compare& __comp = _Compare(), + const _Allocator& __a = _Allocator()) + : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, + __last)), + __gnu_debug::__base(__last), + __comp, __a) { } + + multimap(const _Base& __x) + : _Base(__x) { } + +#if __cplusplus < 201103L + multimap& + operator=(const multimap& __x) + { + this->_M_safe() = __x; + _M_base() = __x; + return *this; + } +#else + multimap& + operator=(const multimap&) = default; + + multimap& + operator=(multimap&&) = default; + + multimap& + operator=(initializer_list __l) + { + _M_base() = __l; + this->_M_invalidate_all(); + return *this; + } +#endif + + using _Base::get_allocator; + + // iterators: + iterator + begin() _GLIBCXX_NOEXCEPT + { return iterator(_Base::begin(), this); } + + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::begin(), this); } + + iterator + end() _GLIBCXX_NOEXCEPT + { return iterator(_Base::end(), this); } + + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::end(), this); } + + reverse_iterator + rbegin() _GLIBCXX_NOEXCEPT + { return reverse_iterator(end()); } + + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(end()); } + + reverse_iterator + rend() _GLIBCXX_NOEXCEPT + { return reverse_iterator(begin()); } + + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(begin()); } + +#if __cplusplus >= 201103L + const_iterator + cbegin() const noexcept + { return const_iterator(_Base::begin(), this); } + + const_iterator + cend() const noexcept + { return const_iterator(_Base::end(), this); } + + const_reverse_iterator + crbegin() const noexcept + { return const_reverse_iterator(end()); } + + const_reverse_iterator + crend() const noexcept + { return const_reverse_iterator(begin()); } +#endif + + // capacity: + using _Base::empty; + using _Base::size; + using _Base::max_size; + + // modifiers: +#if __cplusplus >= 201103L + template + iterator + emplace(_Args&&... __args) + { + return iterator(_Base::emplace(std::forward<_Args>(__args)...), this); + } + + template + iterator + emplace_hint(const_iterator __pos, _Args&&... __args) + { + __glibcxx_check_insert(__pos); + return iterator(_Base::emplace_hint(__pos.base(), + std::forward<_Args>(__args)...), + this); + } +#endif + + iterator + insert(const value_type& __x) + { return iterator(_Base::insert(__x), this); } + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2354. Unnecessary copying when inserting into maps with braced-init + iterator + insert(value_type&& __x) + { return { _Base::insert(std::move(__x)), this }; } + + template::value>::type> + iterator + insert(_Pair&& __x) + { return iterator(_Base::insert(std::forward<_Pair>(__x)), this); } +#endif + +#if __cplusplus >= 201103L + void + insert(std::initializer_list __list) + { _Base::insert(__list); } +#endif + + iterator +#if __cplusplus >= 201103L + insert(const_iterator __position, const value_type& __x) +#else + insert(iterator __position, const value_type& __x) +#endif + { + __glibcxx_check_insert(__position); + return iterator(_Base::insert(__position.base(), __x), this); + } + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2354. Unnecessary copying when inserting into maps with braced-init + iterator + insert(const_iterator __position, value_type&& __x) + { + __glibcxx_check_insert(__position); + return { _Base::insert(__position.base(), std::move(__x)), this }; + } + + template::value>::type> + iterator + insert(const_iterator __position, _Pair&& __x) + { + __glibcxx_check_insert(__position); + return iterator(_Base::insert(__position.base(), + std::forward<_Pair>(__x)), this); + } +#endif + + template + void + insert(_InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + + if (__dist.second >= __gnu_debug::__dp_sign) + _Base::insert(__gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + else + _Base::insert(__first, __last); + } + +#if __cplusplus > 201402L + using node_type = typename _Base::node_type; + + node_type + extract(const_iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + return _Base::extract(__position.base()); + } + + node_type + extract(const key_type& __key) + { + const auto __position = find(__key); + if (__position != end()) + return extract(__position); + return {}; + } + + iterator + insert(node_type&& __nh) + { return iterator(_Base::insert(std::move(__nh)), this); } + + iterator + insert(const_iterator __hint, node_type&& __nh) + { + __glibcxx_check_insert(__hint); + return iterator(_Base::insert(__hint.base(), std::move(__nh)), this); + } + + using _Base::merge; +#endif // C++17 + +#if __cplusplus >= 201103L + iterator + erase(const_iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + return iterator(_Base::erase(__position.base()), this); + } + + iterator + erase(iterator __position) + { return erase(const_iterator(__position)); } +#else + void + erase(iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + _Base::erase(__position.base()); + } +#endif + + size_type + erase(const key_type& __x) + { + std::pair<_Base_iterator, _Base_iterator> __victims = + _Base::equal_range(__x); + size_type __count = 0; + _Base_iterator __victim = __victims.first; + while (__victim != __victims.second) + { + this->_M_invalidate_if(_Equal(__victim)); + _Base::erase(__victim++); + ++__count; + } + return __count; + } + +#if __cplusplus >= 201103L + iterator + erase(const_iterator __first, const_iterator __last) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 151. can't currently clear() empty container + __glibcxx_check_erase_range(__first, __last); + for (_Base_const_iterator __victim = __first.base(); + __victim != __last.base(); ++__victim) + { + _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), + _M_message(__gnu_debug::__msg_valid_range) + ._M_iterator(__first, "first") + ._M_iterator(__last, "last")); + this->_M_invalidate_if(_Equal(__victim)); + } + return iterator(_Base::erase(__first.base(), __last.base()), this); + } +#else + void + erase(iterator __first, iterator __last) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 151. can't currently clear() empty container + __glibcxx_check_erase_range(__first, __last); + for (_Base_iterator __victim = __first.base(); + __victim != __last.base(); ++__victim) + { + _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), + _M_message(__gnu_debug::__msg_valid_range) + ._M_iterator(__first, "first") + ._M_iterator(__last, "last")); + this->_M_invalidate_if(_Equal(__victim)); + } + _Base::erase(__first.base(), __last.base()); + } +#endif + + void + swap(multimap& __x) + _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) ) + { + _Safe::_M_swap(__x); + _Base::swap(__x); + } + + void + clear() _GLIBCXX_NOEXCEPT + { + this->_M_invalidate_all(); + _Base::clear(); + } + + // observers: + using _Base::key_comp; + using _Base::value_comp; + + // 23.3.1.3 multimap operations: + iterator + find(const key_type& __x) + { return iterator(_Base::find(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + find(const _Kt& __x) + { return { _Base::find(__x), this }; } +#endif + + const_iterator + find(const key_type& __x) const + { return const_iterator(_Base::find(__x), this); } + +#if __cplusplus > 201103L + template::type> + const_iterator + find(const _Kt& __x) const + { return { _Base::find(__x), this }; } +#endif + + using _Base::count; + + iterator + lower_bound(const key_type& __x) + { return iterator(_Base::lower_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + lower_bound(const _Kt& __x) + { return { _Base::lower_bound(__x), this }; } +#endif + + const_iterator + lower_bound(const key_type& __x) const + { return const_iterator(_Base::lower_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + const_iterator + lower_bound(const _Kt& __x) const + { return { _Base::lower_bound(__x), this }; } +#endif + + iterator + upper_bound(const key_type& __x) + { return iterator(_Base::upper_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + upper_bound(const _Kt& __x) + { return { _Base::upper_bound(__x), this }; } +#endif + + const_iterator + upper_bound(const key_type& __x) const + { return const_iterator(_Base::upper_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + const_iterator + upper_bound(const _Kt& __x) const + { return { _Base::upper_bound(__x), this }; } +#endif + + std::pair + equal_range(const key_type& __x) + { + std::pair<_Base_iterator, _Base_iterator> __res = + _Base::equal_range(__x); + return std::make_pair(iterator(__res.first, this), + iterator(__res.second, this)); + } + +#if __cplusplus > 201103L + template::type> + std::pair + equal_range(const _Kt& __x) + { + auto __res = _Base::equal_range(__x); + return { { __res.first, this }, { __res.second, this } }; + } +#endif + + std::pair + equal_range(const key_type& __x) const + { + std::pair<_Base_const_iterator, _Base_const_iterator> __res = + _Base::equal_range(__x); + return std::make_pair(const_iterator(__res.first, this), + const_iterator(__res.second, this)); + } + +#if __cplusplus > 201103L + template::type> + std::pair + equal_range(const _Kt& __x) const + { + auto __res = _Base::equal_range(__x); + return { { __res.first, this }, { __res.second, this } }; + } +#endif + + _Base& + _M_base() _GLIBCXX_NOEXCEPT { return *this; } + + const _Base& + _M_base() const _GLIBCXX_NOEXCEPT { return *this; } + }; + + template + inline bool + operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, + const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() == __rhs._M_base(); } + + template + inline bool + operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, + const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() != __rhs._M_base(); } + + template + inline bool + operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, + const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() < __rhs._M_base(); } + + template + inline bool + operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, + const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() <= __rhs._M_base(); } + + template + inline bool + operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, + const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() >= __rhs._M_base(); } + + template + inline bool + operator>(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, + const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() > __rhs._M_base(); } + + template + inline void + swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, + multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) + _GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs))) + { __lhs.swap(__rhs); } + +} // namespace __debug +} // namespace std + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/multiset.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/multiset.h new file mode 100644 index 0000000..97c7b84 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/multiset.h @@ -0,0 +1,591 @@ +// Debugging multiset implementation -*- C++ -*- + +// Copyright (C) 2003-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/multiset.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_MULTISET_H +#define _GLIBCXX_DEBUG_MULTISET_H 1 + +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace __debug +{ + /// Class std::multiset with safety/checking/debug instrumentation. + template, + typename _Allocator = std::allocator<_Key> > + class multiset + : public __gnu_debug::_Safe_container< + multiset<_Key, _Compare, _Allocator>, _Allocator, + __gnu_debug::_Safe_node_sequence>, + public _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator> + { + typedef _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator> _Base; + typedef __gnu_debug::_Safe_container< + multiset, _Allocator, __gnu_debug::_Safe_node_sequence> _Safe; + + typedef typename _Base::const_iterator _Base_const_iterator; + typedef typename _Base::iterator _Base_iterator; + typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; + + public: + // types: + typedef _Key key_type; + typedef _Key value_type; + typedef _Compare key_compare; + typedef _Compare value_compare; + typedef _Allocator allocator_type; + typedef typename _Base::reference reference; + typedef typename _Base::const_reference const_reference; + + typedef __gnu_debug::_Safe_iterator<_Base_iterator, multiset> + iterator; + typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, + multiset> const_iterator; + + typedef typename _Base::size_type size_type; + typedef typename _Base::difference_type difference_type; + typedef typename _Base::pointer pointer; + typedef typename _Base::const_pointer const_pointer; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + + // 23.3.3.1 construct/copy/destroy: + +#if __cplusplus < 201103L + multiset() : _Base() { } + + multiset(const multiset& __x) + : _Base(__x) { } + + ~multiset() { } +#else + multiset() = default; + multiset(const multiset&) = default; + multiset(multiset&&) = default; + + multiset(initializer_list __l, + const _Compare& __comp = _Compare(), + const allocator_type& __a = allocator_type()) + : _Base(__l, __comp, __a) { } + + explicit + multiset(const allocator_type& __a) + : _Base(__a) { } + + multiset(const multiset& __m, const allocator_type& __a) + : _Base(__m, __a) { } + + multiset(multiset&& __m, const allocator_type& __a) + : _Safe(std::move(__m._M_safe()), __a), + _Base(std::move(__m._M_base()), __a) { } + + multiset(initializer_list __l, const allocator_type& __a) + : _Base(__l, __a) + { } + + template + multiset(_InputIterator __first, _InputIterator __last, + const allocator_type& __a) + : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, + __last)), + __gnu_debug::__base(__last), __a) { } + + ~multiset() = default; +#endif + + explicit multiset(const _Compare& __comp, + const _Allocator& __a = _Allocator()) + : _Base(__comp, __a) { } + + template + multiset(_InputIterator __first, _InputIterator __last, + const _Compare& __comp = _Compare(), + const _Allocator& __a = _Allocator()) + : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, + __last)), + __gnu_debug::__base(__last), + __comp, __a) { } + + multiset(const _Base& __x) + : _Base(__x) { } + +#if __cplusplus < 201103L + multiset& + operator=(const multiset& __x) + { + this->_M_safe() = __x; + _M_base() = __x; + return *this; + } +#else + multiset& + operator=(const multiset&) = default; + + multiset& + operator=(multiset&&) = default; + + multiset& + operator=(initializer_list __l) + { + _M_base() = __l; + this->_M_invalidate_all(); + return *this; + } +#endif + + using _Base::get_allocator; + + // iterators: + iterator + begin() _GLIBCXX_NOEXCEPT + { return iterator(_Base::begin(), this); } + + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::begin(), this); } + + iterator + end() _GLIBCXX_NOEXCEPT + { return iterator(_Base::end(), this); } + + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::end(), this); } + + reverse_iterator + rbegin() _GLIBCXX_NOEXCEPT + { return reverse_iterator(end()); } + + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(end()); } + + reverse_iterator + rend() _GLIBCXX_NOEXCEPT + { return reverse_iterator(begin()); } + + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(begin()); } + +#if __cplusplus >= 201103L + const_iterator + cbegin() const noexcept + { return const_iterator(_Base::begin(), this); } + + const_iterator + cend() const noexcept + { return const_iterator(_Base::end(), this); } + + const_reverse_iterator + crbegin() const noexcept + { return const_reverse_iterator(end()); } + + const_reverse_iterator + crend() const noexcept + { return const_reverse_iterator(begin()); } +#endif + + // capacity: + using _Base::empty; + using _Base::size; + using _Base::max_size; + + // modifiers: +#if __cplusplus >= 201103L + template + iterator + emplace(_Args&&... __args) + { + return iterator(_Base::emplace(std::forward<_Args>(__args)...), + this); + } + + template + iterator + emplace_hint(const_iterator __pos, _Args&&... __args) + { + __glibcxx_check_insert(__pos); + return iterator(_Base::emplace_hint(__pos.base(), + std::forward<_Args>(__args)...), + this); + } +#endif + + iterator + insert(const value_type& __x) + { return iterator(_Base::insert(__x), this); } + +#if __cplusplus >= 201103L + iterator + insert(value_type&& __x) + { return iterator(_Base::insert(std::move(__x)), this); } +#endif + + iterator + insert(const_iterator __position, const value_type& __x) + { + __glibcxx_check_insert(__position); + return iterator(_Base::insert(__position.base(), __x), this); + } + +#if __cplusplus >= 201103L + iterator + insert(const_iterator __position, value_type&& __x) + { + __glibcxx_check_insert(__position); + return iterator(_Base::insert(__position.base(), std::move(__x)), + this); + } +#endif + + template + void + insert(_InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + + if (__dist.second >= __gnu_debug::__dp_sign) + _Base::insert(__gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + else + _Base::insert(__first, __last); + } + +#if __cplusplus >= 201103L + void + insert(initializer_list __l) + { _Base::insert(__l); } +#endif + +#if __cplusplus > 201402L + using node_type = typename _Base::node_type; + + node_type + extract(const_iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + return _Base::extract(__position.base()); + } + + node_type + extract(const key_type& __key) + { + const auto __position = find(__key); + if (__position != end()) + return extract(__position); + return {}; + } + + iterator + insert(node_type&& __nh) + { return iterator(_Base::insert(std::move(__nh)), this); } + + iterator + insert(const_iterator __hint, node_type&& __nh) + { + __glibcxx_check_insert(__hint); + return iterator(_Base::insert(__hint.base(), std::move(__nh)), this); + } + + using _Base::merge; +#endif // C++17 + +#if __cplusplus >= 201103L + iterator + erase(const_iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + return iterator(_Base::erase(__position.base()), this); + } +#else + void + erase(iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + _Base::erase(__position.base()); + } +#endif + + size_type + erase(const key_type& __x) + { + std::pair<_Base_iterator, _Base_iterator> __victims = + _Base::equal_range(__x); + size_type __count = 0; + _Base_iterator __victim = __victims.first; + while (__victim != __victims.second) + { + this->_M_invalidate_if(_Equal(__victim)); + _Base::erase(__victim++); + ++__count; + } + return __count; + } + +#if __cplusplus >= 201103L + iterator + erase(const_iterator __first, const_iterator __last) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 151. can't currently clear() empty container + __glibcxx_check_erase_range(__first, __last); + for (_Base_const_iterator __victim = __first.base(); + __victim != __last.base(); ++__victim) + { + _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), + _M_message(__gnu_debug::__msg_valid_range) + ._M_iterator(__first, "first") + ._M_iterator(__last, "last")); + this->_M_invalidate_if(_Equal(__victim)); + } + return iterator(_Base::erase(__first.base(), __last.base()), this); + } +#else + void + erase(iterator __first, iterator __last) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 151. can't currently clear() empty container + __glibcxx_check_erase_range(__first, __last); + for (_Base_iterator __victim = __first.base(); + __victim != __last.base(); ++__victim) + { + _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), + _M_message(__gnu_debug::__msg_valid_range) + ._M_iterator(__first, "first") + ._M_iterator(__last, "last")); + this->_M_invalidate_if(_Equal(__victim)); + } + _Base::erase(__first.base(), __last.base()); + } +#endif + + void + swap(multiset& __x) + _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) ) + { + _Safe::_M_swap(__x); + _Base::swap(__x); + } + + void + clear() _GLIBCXX_NOEXCEPT + { + this->_M_invalidate_all(); + _Base::clear(); + } + + // observers: + using _Base::key_comp; + using _Base::value_comp; + + // multiset operations: + iterator + find(const key_type& __x) + { return iterator(_Base::find(__x), this); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 214. set::find() missing const overload + const_iterator + find(const key_type& __x) const + { return const_iterator(_Base::find(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + find(const _Kt& __x) + { return { _Base::find(__x), this }; } + + template::type> + const_iterator + find(const _Kt& __x) const + { return { _Base::find(__x), this }; } +#endif + + using _Base::count; + + iterator + lower_bound(const key_type& __x) + { return iterator(_Base::lower_bound(__x), this); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 214. set::find() missing const overload + const_iterator + lower_bound(const key_type& __x) const + { return const_iterator(_Base::lower_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + lower_bound(const _Kt& __x) + { return { _Base::lower_bound(__x), this }; } + + template::type> + const_iterator + lower_bound(const _Kt& __x) const + { return { _Base::lower_bound(__x), this }; } +#endif + + iterator + upper_bound(const key_type& __x) + { return iterator(_Base::upper_bound(__x), this); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 214. set::find() missing const overload + const_iterator + upper_bound(const key_type& __x) const + { return const_iterator(_Base::upper_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + upper_bound(const _Kt& __x) + { return { _Base::upper_bound(__x), this }; } + + template::type> + const_iterator + upper_bound(const _Kt& __x) const + { return { _Base::upper_bound(__x), this }; } +#endif + + std::pair + equal_range(const key_type& __x) + { + std::pair<_Base_iterator, _Base_iterator> __res = + _Base::equal_range(__x); + return std::make_pair(iterator(__res.first, this), + iterator(__res.second, this)); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 214. set::find() missing const overload + std::pair + equal_range(const key_type& __x) const + { + std::pair<_Base_const_iterator, _Base_const_iterator> __res = + _Base::equal_range(__x); + return std::make_pair(const_iterator(__res.first, this), + const_iterator(__res.second, this)); + } + +#if __cplusplus > 201103L + template::type> + std::pair + equal_range(const _Kt& __x) + { + auto __res = _Base::equal_range(__x); + return { { __res.first, this }, { __res.second, this } }; + } + + template::type> + std::pair + equal_range(const _Kt& __x) const + { + auto __res = _Base::equal_range(__x); + return { { __res.first, this }, { __res.second, this } }; + } +#endif + + _Base& + _M_base() _GLIBCXX_NOEXCEPT { return *this; } + + const _Base& + _M_base() const _GLIBCXX_NOEXCEPT { return *this; } + }; + + template + inline bool + operator==(const multiset<_Key, _Compare, _Allocator>& __lhs, + const multiset<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() == __rhs._M_base(); } + + template + inline bool + operator!=(const multiset<_Key, _Compare, _Allocator>& __lhs, + const multiset<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() != __rhs._M_base(); } + + template + inline bool + operator<(const multiset<_Key, _Compare, _Allocator>& __lhs, + const multiset<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() < __rhs._M_base(); } + + template + inline bool + operator<=(const multiset<_Key, _Compare, _Allocator>& __lhs, + const multiset<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() <= __rhs._M_base(); } + + template + inline bool + operator>=(const multiset<_Key, _Compare, _Allocator>& __lhs, + const multiset<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() >= __rhs._M_base(); } + + template + inline bool + operator>(const multiset<_Key, _Compare, _Allocator>& __lhs, + const multiset<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() > __rhs._M_base(); } + + template + void + swap(multiset<_Key, _Compare, _Allocator>& __x, + multiset<_Key, _Compare, _Allocator>& __y) + _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y))) + { return __x.swap(__y); } + +} // namespace __debug +} // namespace std + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_base.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_base.h new file mode 100644 index 0000000..3c86e56 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_base.h @@ -0,0 +1,278 @@ +// Safe sequence/iterator base implementation -*- C++ -*- + +// Copyright (C) 2003-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/safe_base.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_SAFE_BASE_H +#define _GLIBCXX_DEBUG_SAFE_BASE_H 1 + +#include + +namespace __gnu_debug +{ + class _Safe_sequence_base; + + /** \brief Basic functionality for a @a safe iterator. + * + * The %_Safe_iterator_base base class implements the functionality + * of a safe iterator that is not specific to a particular iterator + * type. It contains a pointer back to the sequence it references + * along with iterator version information and pointers to form a + * doubly-linked list of iterators referenced by the container. + * + * This class must not perform any operations that can throw an + * exception, or the exception guarantees of derived iterators will + * be broken. + */ + class _Safe_iterator_base + { + friend class _Safe_sequence_base; + + public: + /** The sequence this iterator references; may be NULL to indicate + a singular iterator. */ + _Safe_sequence_base* _M_sequence; + + /** The version number of this iterator. The sentinel value 0 is + * used to indicate an invalidated iterator (i.e., one that is + * singular because of an operation on the container). This + * version number must equal the version number in the sequence + * referenced by _M_sequence for the iterator to be + * non-singular. + */ + unsigned int _M_version; + + /** Pointer to the previous iterator in the sequence's list of + iterators. Only valid when _M_sequence != NULL. */ + _Safe_iterator_base* _M_prior; + + /** Pointer to the next iterator in the sequence's list of + iterators. Only valid when _M_sequence != NULL. */ + _Safe_iterator_base* _M_next; + + protected: + /** Initializes the iterator and makes it singular. */ + _Safe_iterator_base() + : _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0) + { } + + /** Initialize the iterator to reference the sequence pointed to + * by @p __seq. @p __constant is true when we are initializing a + * constant iterator, and false if it is a mutable iterator. Note + * that @p __seq may be NULL, in which case the iterator will be + * singular. Otherwise, the iterator will reference @p __seq and + * be nonsingular. + */ + _Safe_iterator_base(const _Safe_sequence_base* __seq, bool __constant) + : _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0) + { this->_M_attach(const_cast<_Safe_sequence_base*>(__seq), __constant); } + + /** Initializes the iterator to reference the same sequence that + @p __x does. @p __constant is true if this is a constant + iterator, and false if it is mutable. */ + _Safe_iterator_base(const _Safe_iterator_base& __x, bool __constant) + : _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0) + { this->_M_attach(__x._M_sequence, __constant); } + + ~_Safe_iterator_base() { this->_M_detach(); } + + /** For use in _Safe_iterator. */ + __gnu_cxx::__mutex& + _M_get_mutex() throw (); + + /** Attaches this iterator to the given sequence, detaching it + * from whatever sequence it was attached to originally. If the + * new sequence is the NULL pointer, the iterator is left + * unattached. + */ + void + _M_attach(_Safe_sequence_base* __seq, bool __constant); + + /** Likewise, but not thread-safe. */ + void + _M_attach_single(_Safe_sequence_base* __seq, bool __constant) throw (); + + /** Detach the iterator for whatever sequence it is attached to, + * if any. + */ + void + _M_detach(); + + public: + /** Likewise, but not thread-safe. */ + void + _M_detach_single() throw (); + + /** Determines if we are attached to the given sequence. */ + bool + _M_attached_to(const _Safe_sequence_base* __seq) const + { return _M_sequence == __seq; } + + /** Is this iterator singular? */ + _GLIBCXX_PURE bool + _M_singular() const throw (); + + /** Can we compare this iterator to the given iterator @p __x? + Returns true if both iterators are nonsingular and reference + the same sequence. */ + _GLIBCXX_PURE bool + _M_can_compare(const _Safe_iterator_base& __x) const throw (); + + /** Invalidate the iterator, making it singular. */ + void + _M_invalidate() + { _M_version = 0; } + + /** Reset all member variables */ + void + _M_reset() throw (); + + /** Unlink itself */ + void + _M_unlink() throw () + { + if (_M_prior) + _M_prior->_M_next = _M_next; + if (_M_next) + _M_next->_M_prior = _M_prior; + } + }; + + /** Iterators that derive from _Safe_iterator_base can be determined singular + * or non-singular. + **/ + inline bool + __check_singular_aux(const _Safe_iterator_base* __x) + { return __x->_M_singular(); } + + /** + * @brief Base class that supports tracking of iterators that + * reference a sequence. + * + * The %_Safe_sequence_base class provides basic support for + * tracking iterators into a sequence. Sequences that track + * iterators must derived from %_Safe_sequence_base publicly, so + * that safe iterators (which inherit _Safe_iterator_base) can + * attach to them. This class contains two linked lists of + * iterators, one for constant iterators and one for mutable + * iterators, and a version number that allows very fast + * invalidation of all iterators that reference the container. + * + * This class must ensure that no operation on it may throw an + * exception, otherwise @a safe sequences may fail to provide the + * exception-safety guarantees required by the C++ standard. + */ + class _Safe_sequence_base + { + friend class _Safe_iterator_base; + + public: + /// The list of mutable iterators that reference this container + _Safe_iterator_base* _M_iterators; + + /// The list of constant iterators that reference this container + _Safe_iterator_base* _M_const_iterators; + + /// The container version number. This number may never be 0. + mutable unsigned int _M_version; + + protected: + // Initialize with a version number of 1 and no iterators + _Safe_sequence_base() _GLIBCXX_NOEXCEPT + : _M_iterators(0), _M_const_iterators(0), _M_version(1) + { } + +#if __cplusplus >= 201103L + _Safe_sequence_base(const _Safe_sequence_base&) noexcept + : _Safe_sequence_base() { } + + // Move constructor swap iterators. + _Safe_sequence_base(_Safe_sequence_base&& __seq) noexcept + : _Safe_sequence_base() + { _M_swap(__seq); } +#endif + + /** Notify all iterators that reference this sequence that the + sequence is being destroyed. */ + ~_Safe_sequence_base() + { this->_M_detach_all(); } + + /** Detach all iterators, leaving them singular. */ + void + _M_detach_all(); + + /** Detach all singular iterators. + * @post for all iterators i attached to this sequence, + * i->_M_version == _M_version. + */ + void + _M_detach_singular(); + + /** Revalidates all attached singular iterators. This method may + * be used to validate iterators that were invalidated before + * (but for some reason, such as an exception, need to become + * valid again). + */ + void + _M_revalidate_singular(); + + /** Swap this sequence with the given sequence. This operation + * also swaps ownership of the iterators, so that when the + * operation is complete all iterators that originally referenced + * one container now reference the other container. + */ + void + _M_swap(_Safe_sequence_base& __x) _GLIBCXX_USE_NOEXCEPT; + + /** For use in _Safe_sequence. */ + __gnu_cxx::__mutex& + _M_get_mutex() throw (); + + /** Invalidates all iterators. */ + void + _M_invalidate_all() const + { if (++_M_version == 0) _M_version = 1; } + + private: + /** Attach an iterator to this sequence. */ + void + _M_attach(_Safe_iterator_base* __it, bool __constant); + + /** Likewise but not thread safe. */ + void + _M_attach_single(_Safe_iterator_base* __it, bool __constant) throw (); + + /** Detach an iterator from this sequence */ + void + _M_detach(_Safe_iterator_base* __it); + + /** Likewise but not thread safe. */ + void + _M_detach_single(_Safe_iterator_base* __it) throw (); + }; +} // namespace __gnu_debug + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_container.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_container.h new file mode 100644 index 0000000..3d44c15 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_container.h @@ -0,0 +1,122 @@ +// Safe container implementation -*- C++ -*- + +// Copyright (C) 2014-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/safe_container.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_SAFE_CONTAINER_H +#define _GLIBCXX_DEBUG_SAFE_CONTAINER_H 1 + +#include + +namespace __gnu_debug +{ + /// Safe class dealing with some allocator dependent operations. + template class _SafeBase, + bool _IsCxx11AllocatorAware = true> + class _Safe_container + : public _SafeBase<_SafeContainer> + { + typedef _SafeBase<_SafeContainer> _Base; + + _SafeContainer& + _M_cont() _GLIBCXX_NOEXCEPT + { return *static_cast<_SafeContainer*>(this); } + + protected: + _Safe_container& + _M_safe() _GLIBCXX_NOEXCEPT + { return *this; } + +#if __cplusplus >= 201103L + _Safe_container() = default; + _Safe_container(const _Safe_container&) = default; + _Safe_container(_Safe_container&&) = default; + + _Safe_container(_Safe_container&& __x, const _Alloc& __a) + : _Safe_container() + { + if (__x._M_cont().get_allocator() == __a) + _Base::_M_swap(__x); + else + __x._M_invalidate_all(); + } +#endif + + public: + // Copy assignment invalidate all iterators. + _Safe_container& + operator=(const _Safe_container&) _GLIBCXX_NOEXCEPT + { + this->_M_invalidate_all(); + return *this; + } + +#if __cplusplus >= 201103L + _Safe_container& + operator=(_Safe_container&& __x) noexcept + { + __glibcxx_check_self_move_assign(__x); + + if (_IsCxx11AllocatorAware) + { + typedef __gnu_cxx::__alloc_traits<_Alloc> _Alloc_traits; + + bool __xfer_memory = _Alloc_traits::_S_propagate_on_move_assign() + || _M_cont().get_allocator() == __x._M_cont().get_allocator(); + if (__xfer_memory) + _Base::_M_swap(__x); + else + this->_M_invalidate_all(); + } + else + _Base::_M_swap(__x); + + __x._M_invalidate_all(); + return *this; + } + + void + _M_swap(_Safe_container& __x) noexcept + { + if (_IsCxx11AllocatorAware) + { + typedef __gnu_cxx::__alloc_traits<_Alloc> _Alloc_traits; + + if (!_Alloc_traits::_S_propagate_on_swap()) + __glibcxx_check_equal_allocs(this->_M_cont()._M_base(), + __x._M_cont()._M_base()); + } + + _Base::_M_swap(__x); + } +#endif + }; + +} // namespace __gnu_debug + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_iterator.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_iterator.h new file mode 100644 index 0000000..0556757 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_iterator.h @@ -0,0 +1,906 @@ +// Safe iterator implementation -*- C++ -*- + +// Copyright (C) 2003-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/safe_iterator.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_SAFE_ITERATOR_H +#define _GLIBCXX_DEBUG_SAFE_ITERATOR_H 1 + +#include +#include +#include +#include +#include +#include + +namespace __gnu_debug +{ + /** Helper struct to deal with sequence offering a before_begin + * iterator. + **/ + template + struct _BeforeBeginHelper + { + template + static bool + _S_Is(const _Safe_iterator<_Iterator, _Sequence>&) + { return false; } + + template + static bool + _S_Is_Beginnest(const _Safe_iterator<_Iterator, _Sequence>& __it) + { return __it.base() == __it._M_get_sequence()->_M_base().begin(); } + }; + + /** Sequence traits giving the size of a container if possible. */ + template + struct _Sequence_traits + { + typedef _Distance_traits _DistTraits; + + static typename _DistTraits::__type + _S_size(const _Sequence& __seq) + { return std::make_pair(__seq.size(), __dp_exact); } + }; + + /** \brief Safe iterator wrapper. + * + * The class template %_Safe_iterator is a wrapper around an + * iterator that tracks the iterator's movement among sequences and + * checks that operations performed on the "safe" iterator are + * legal. In additional to the basic iterator operations (which are + * validated, and then passed to the underlying iterator), + * %_Safe_iterator has member functions for iterator invalidation, + * attaching/detaching the iterator from sequences, and querying + * the iterator's state. + * + * Note that _Iterator must be the first base class so that it gets + * initialized before the iterator is being attached to the container's list + * of iterators and it is being detached before _Iterator get + * destroyed. Otherwise it would result in a data race. + */ + template + class _Safe_iterator + : private _Iterator, + public _Safe_iterator_base + { + typedef _Iterator _Iter_base; + typedef _Safe_iterator_base _Safe_base; + typedef typename _Sequence::const_iterator _Const_iterator; + + /// Determine if this is a constant iterator. + bool + _M_constant() const + { return std::__are_same<_Const_iterator, _Safe_iterator>::__value; } + + typedef std::iterator_traits<_Iterator> _Traits; + + struct _Attach_single + { }; + + _Safe_iterator(const _Iterator& __i, _Safe_sequence_base* __seq, + _Attach_single) + _GLIBCXX_NOEXCEPT + : _Iter_base(__i) + { _M_attach_single(__seq); } + + public: + typedef _Iterator iterator_type; + typedef typename _Traits::iterator_category iterator_category; + typedef typename _Traits::value_type value_type; + typedef typename _Traits::difference_type difference_type; + typedef typename _Traits::reference reference; + typedef typename _Traits::pointer pointer; + + /// @post the iterator is singular and unattached + _Safe_iterator() _GLIBCXX_NOEXCEPT : _Iter_base() { } + + /** + * @brief Safe iterator construction from an unsafe iterator and + * its sequence. + * + * @pre @p seq is not NULL + * @post this is not singular + */ + _Safe_iterator(const _Iterator& __i, const _Safe_sequence_base* __seq) + _GLIBCXX_NOEXCEPT + : _Iter_base(__i), _Safe_base(__seq, _M_constant()) + { + _GLIBCXX_DEBUG_VERIFY(!this->_M_singular(), + _M_message(__msg_init_singular) + ._M_iterator(*this, "this")); + } + + /** + * @brief Copy construction. + */ + _Safe_iterator(const _Safe_iterator& __x) _GLIBCXX_NOEXCEPT + : _Iter_base(__x.base()) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 408. Is vector > forbidden? + _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() + || __x.base() == _Iterator(), + _M_message(__msg_init_copy_singular) + ._M_iterator(*this, "this") + ._M_iterator(__x, "other")); + _M_attach(__x._M_sequence); + } + +#if __cplusplus >= 201103L + /** + * @brief Move construction. + * @post __x is singular and unattached + */ + _Safe_iterator(_Safe_iterator&& __x) noexcept + : _Iter_base() + { + _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() + || __x.base() == _Iterator(), + _M_message(__msg_init_copy_singular) + ._M_iterator(*this, "this") + ._M_iterator(__x, "other")); + _Safe_sequence_base* __seq = __x._M_sequence; + __x._M_detach(); + std::swap(base(), __x.base()); + _M_attach(__seq); + } +#endif + + /** + * @brief Converting constructor from a mutable iterator to a + * constant iterator. + */ + template + _Safe_iterator( + const _Safe_iterator<_MutableIterator, + typename __gnu_cxx::__enable_if<(std::__are_same<_MutableIterator, + typename _Sequence::iterator::iterator_type>::__value), + _Sequence>::__type>& __x) _GLIBCXX_NOEXCEPT + : _Iter_base(__x.base()) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 408. Is vector > forbidden? + _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() + || __x.base() == _Iterator(), + _M_message(__msg_init_const_singular) + ._M_iterator(*this, "this") + ._M_iterator(__x, "other")); + _M_attach(__x._M_sequence); + } + + /** + * @brief Copy assignment. + */ + _Safe_iterator& + operator=(const _Safe_iterator& __x) _GLIBCXX_NOEXCEPT + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 408. Is vector > forbidden? + _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() + || __x.base() == _Iterator(), + _M_message(__msg_copy_singular) + ._M_iterator(*this, "this") + ._M_iterator(__x, "other")); + + if (this->_M_sequence && this->_M_sequence == __x._M_sequence) + { + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + base() = __x.base(); + _M_version = __x._M_sequence->_M_version; + } + else + { + _M_detach(); + base() = __x.base(); + _M_attach(__x._M_sequence); + } + + return *this; + } + +#if __cplusplus >= 201103L + /** + * @brief Move assignment. + * @post __x is singular and unattached + */ + _Safe_iterator& + operator=(_Safe_iterator&& __x) noexcept + { + _GLIBCXX_DEBUG_VERIFY(this != &__x, + _M_message(__msg_self_move_assign) + ._M_iterator(*this, "this")); + _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() + || __x.base() == _Iterator(), + _M_message(__msg_copy_singular) + ._M_iterator(*this, "this") + ._M_iterator(__x, "other")); + + if (this->_M_sequence && this->_M_sequence == __x._M_sequence) + { + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + base() = __x.base(); + _M_version = __x._M_sequence->_M_version; + } + else + { + _M_detach(); + base() = __x.base(); + _M_attach(__x._M_sequence); + } + + __x._M_detach(); + __x.base() = _Iterator(); + return *this; + } +#endif + + /** + * @brief Iterator dereference. + * @pre iterator is dereferenceable + */ + reference + operator*() const _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(), + _M_message(__msg_bad_deref) + ._M_iterator(*this, "this")); + return *base(); + } + + /** + * @brief Iterator dereference. + * @pre iterator is dereferenceable + */ + pointer + operator->() const _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(), + _M_message(__msg_bad_deref) + ._M_iterator(*this, "this")); + return base().operator->(); + } + + // ------ Input iterator requirements ------ + /** + * @brief Iterator preincrement + * @pre iterator is incrementable + */ + _Safe_iterator& + operator++() _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(), + _M_message(__msg_bad_inc) + ._M_iterator(*this, "this")); + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + ++base(); + return *this; + } + + /** + * @brief Iterator postincrement + * @pre iterator is incrementable + */ + _Safe_iterator + operator++(int) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(), + _M_message(__msg_bad_inc) + ._M_iterator(*this, "this")); + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + return _Safe_iterator(base()++, this->_M_sequence, _Attach_single()); + } + + // ------ Bidirectional iterator requirements ------ + /** + * @brief Iterator predecrement + * @pre iterator is decrementable + */ + _Safe_iterator& + operator--() _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(), + _M_message(__msg_bad_dec) + ._M_iterator(*this, "this")); + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + --base(); + return *this; + } + + /** + * @brief Iterator postdecrement + * @pre iterator is decrementable + */ + _Safe_iterator + operator--(int) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(), + _M_message(__msg_bad_dec) + ._M_iterator(*this, "this")); + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + return _Safe_iterator(base()--, this->_M_sequence, _Attach_single()); + } + + // ------ Random access iterator requirements ------ + reference + operator[](const difference_type& __n) const _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(__n) + && this->_M_can_advance(__n+1), + _M_message(__msg_iter_subscript_oob) + ._M_iterator(*this)._M_integer(__n)); + return base()[__n]; + } + + _Safe_iterator& + operator+=(const difference_type& __n) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(__n), + _M_message(__msg_advance_oob) + ._M_iterator(*this)._M_integer(__n)); + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + base() += __n; + return *this; + } + + _Safe_iterator + operator+(const difference_type& __n) const _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(__n), + _M_message(__msg_advance_oob) + ._M_iterator(*this)._M_integer(__n)); + return _Safe_iterator(base() + __n, this->_M_sequence); + } + + _Safe_iterator& + operator-=(const difference_type& __n) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(-__n), + _M_message(__msg_retreat_oob) + ._M_iterator(*this)._M_integer(__n)); + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + base() -= __n; + return *this; + } + + _Safe_iterator + operator-(const difference_type& __n) const _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(-__n), + _M_message(__msg_retreat_oob) + ._M_iterator(*this)._M_integer(__n)); + return _Safe_iterator(base() - __n, this->_M_sequence); + } + + // ------ Utilities ------ + /** + * @brief Return the underlying iterator + */ + _Iterator& + base() _GLIBCXX_NOEXCEPT { return *this; } + + const _Iterator& + base() const _GLIBCXX_NOEXCEPT { return *this; } + + /** + * @brief Conversion to underlying non-debug iterator to allow + * better interaction with non-debug containers. + */ + operator _Iterator() const _GLIBCXX_NOEXCEPT { return *this; } + + /** Attach iterator to the given sequence. */ + void + _M_attach(_Safe_sequence_base* __seq) + { _Safe_base::_M_attach(__seq, _M_constant()); } + + /** Likewise, but not thread-safe. */ + void + _M_attach_single(_Safe_sequence_base* __seq) + { _Safe_base::_M_attach_single(__seq, _M_constant()); } + + /// Is the iterator dereferenceable? + bool + _M_dereferenceable() const + { return !this->_M_singular() && !_M_is_end() && !_M_is_before_begin(); } + + /// Is the iterator before a dereferenceable one? + bool + _M_before_dereferenceable() const + { + if (this->_M_incrementable()) + { + _Iterator __base = base(); + return ++__base != _M_get_sequence()->_M_base().end(); + } + return false; + } + + /// Is the iterator incrementable? + bool + _M_incrementable() const + { return !this->_M_singular() && !_M_is_end(); } + + // Is the iterator decrementable? + bool + _M_decrementable() const { return !_M_singular() && !_M_is_begin(); } + + // Can we advance the iterator @p __n steps (@p __n may be negative) + bool + _M_can_advance(const difference_type& __n) const; + + // Is the iterator range [*this, __rhs) valid? + bool + _M_valid_range(const _Safe_iterator& __rhs, + std::pair& __dist, + bool __check_dereferenceable = true) const; + + // The sequence this iterator references. + typename + __gnu_cxx::__conditional_type::__value, + const _Sequence*, + _Sequence*>::__type + _M_get_sequence() const + { return static_cast<_Sequence*>(_M_sequence); } + + /// Is this iterator equal to the sequence's begin() iterator? + bool + _M_is_begin() const + { return base() == _M_get_sequence()->_M_base().begin(); } + + /// Is this iterator equal to the sequence's end() iterator? + bool + _M_is_end() const + { return base() == _M_get_sequence()->_M_base().end(); } + + /// Is this iterator equal to the sequence's before_begin() iterator if + /// any? + bool + _M_is_before_begin() const + { return _BeforeBeginHelper<_Sequence>::_S_Is(*this); } + + /// Is this iterator equal to the sequence's before_begin() iterator if + /// any or begin() otherwise? + bool + _M_is_beginnest() const + { return _BeforeBeginHelper<_Sequence>::_S_Is_Beginnest(*this); } + }; + + template + inline bool + operator==(const _Safe_iterator<_IteratorL, _Sequence>& __lhs, + const _Safe_iterator<_IteratorR, _Sequence>& __rhs) + _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), + _M_message(__msg_iter_compare_bad) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), + _M_message(__msg_compare_different) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + return __lhs.base() == __rhs.base(); + } + + template + inline bool + operator==(const _Safe_iterator<_Iterator, _Sequence>& __lhs, + const _Safe_iterator<_Iterator, _Sequence>& __rhs) + _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), + _M_message(__msg_iter_compare_bad) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), + _M_message(__msg_compare_different) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + return __lhs.base() == __rhs.base(); + } + + template + inline bool + operator!=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs, + const _Safe_iterator<_IteratorR, _Sequence>& __rhs) + _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), + _M_message(__msg_iter_compare_bad) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), + _M_message(__msg_compare_different) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + return __lhs.base() != __rhs.base(); + } + + template + inline bool + operator!=(const _Safe_iterator<_Iterator, _Sequence>& __lhs, + const _Safe_iterator<_Iterator, _Sequence>& __rhs) + _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), + _M_message(__msg_iter_compare_bad) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), + _M_message(__msg_compare_different) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + return __lhs.base() != __rhs.base(); + } + + template + inline bool + operator<(const _Safe_iterator<_IteratorL, _Sequence>& __lhs, + const _Safe_iterator<_IteratorR, _Sequence>& __rhs) + _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), + _M_message(__msg_iter_order_bad) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), + _M_message(__msg_order_different) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + return __lhs.base() < __rhs.base(); + } + + template + inline bool + operator<(const _Safe_iterator<_Iterator, _Sequence>& __lhs, + const _Safe_iterator<_Iterator, _Sequence>& __rhs) + _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), + _M_message(__msg_iter_order_bad) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), + _M_message(__msg_order_different) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + return __lhs.base() < __rhs.base(); + } + + template + inline bool + operator<=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs, + const _Safe_iterator<_IteratorR, _Sequence>& __rhs) + _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), + _M_message(__msg_iter_order_bad) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), + _M_message(__msg_order_different) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + return __lhs.base() <= __rhs.base(); + } + + template + inline bool + operator<=(const _Safe_iterator<_Iterator, _Sequence>& __lhs, + const _Safe_iterator<_Iterator, _Sequence>& __rhs) + _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), + _M_message(__msg_iter_order_bad) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), + _M_message(__msg_order_different) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + return __lhs.base() <= __rhs.base(); + } + + template + inline bool + operator>(const _Safe_iterator<_IteratorL, _Sequence>& __lhs, + const _Safe_iterator<_IteratorR, _Sequence>& __rhs) + _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), + _M_message(__msg_iter_order_bad) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), + _M_message(__msg_order_different) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + return __lhs.base() > __rhs.base(); + } + + template + inline bool + operator>(const _Safe_iterator<_Iterator, _Sequence>& __lhs, + const _Safe_iterator<_Iterator, _Sequence>& __rhs) + _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), + _M_message(__msg_iter_order_bad) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), + _M_message(__msg_order_different) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + return __lhs.base() > __rhs.base(); + } + + template + inline bool + operator>=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs, + const _Safe_iterator<_IteratorR, _Sequence>& __rhs) + _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), + _M_message(__msg_iter_order_bad) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), + _M_message(__msg_order_different) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + return __lhs.base() >= __rhs.base(); + } + + template + inline bool + operator>=(const _Safe_iterator<_Iterator, _Sequence>& __lhs, + const _Safe_iterator<_Iterator, _Sequence>& __rhs) + _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), + _M_message(__msg_iter_order_bad) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), + _M_message(__msg_order_different) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + return __lhs.base() >= __rhs.base(); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // According to the resolution of DR179 not only the various comparison + // operators but also operator- must accept mixed iterator/const_iterator + // parameters. + template + inline typename _Safe_iterator<_IteratorL, _Sequence>::difference_type + operator-(const _Safe_iterator<_IteratorL, _Sequence>& __lhs, + const _Safe_iterator<_IteratorR, _Sequence>& __rhs) + _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), + _M_message(__msg_distance_bad) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), + _M_message(__msg_distance_different) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + return __lhs.base() - __rhs.base(); + } + + template + inline typename _Safe_iterator<_Iterator, _Sequence>::difference_type + operator-(const _Safe_iterator<_Iterator, _Sequence>& __lhs, + const _Safe_iterator<_Iterator, _Sequence>& __rhs) + _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), + _M_message(__msg_distance_bad) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), + _M_message(__msg_distance_different) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + return __lhs.base() - __rhs.base(); + } + + template + inline _Safe_iterator<_Iterator, _Sequence> + operator+(typename _Safe_iterator<_Iterator,_Sequence>::difference_type __n, + const _Safe_iterator<_Iterator, _Sequence>& __i) _GLIBCXX_NOEXCEPT + { return __i + __n; } + + /** Safe iterators know if they are dereferenceable. */ + template + inline bool + __check_dereferenceable(const _Safe_iterator<_Iterator, _Sequence>& __x) + { return __x._M_dereferenceable(); } + + /** Safe iterators know how to check if they form a valid range. */ + template + inline bool + __valid_range(const _Safe_iterator<_Iterator, _Sequence>& __first, + const _Safe_iterator<_Iterator, _Sequence>& __last, + typename _Distance_traits<_Iterator>::__type& __dist) + { return __first._M_valid_range(__last, __dist); } + + /** Safe iterators can help to get better distance knowledge. */ + template + inline typename _Distance_traits<_Iterator>::__type + __get_distance(const _Safe_iterator<_Iterator, _Sequence>& __first, + const _Safe_iterator<_Iterator, _Sequence>& __last, + std::random_access_iterator_tag) + { return std::make_pair(__last.base() - __first.base(), __dp_exact); } + + template + inline typename _Distance_traits<_Iterator>::__type + __get_distance(const _Safe_iterator<_Iterator, _Sequence>& __first, + const _Safe_iterator<_Iterator, _Sequence>& __last, + std::input_iterator_tag) + { + typedef typename _Distance_traits<_Iterator>::__type _Diff; + typedef _Sequence_traits<_Sequence> _SeqTraits; + + if (__first.base() == __last.base()) + return std::make_pair(0, __dp_exact); + + if (__first._M_is_before_begin()) + { + if (__last._M_is_begin()) + return std::make_pair(1, __dp_exact); + + return std::make_pair(1, __dp_sign); + } + + if (__first._M_is_begin()) + { + if (__last._M_is_before_begin()) + return std::make_pair(-1, __dp_exact); + + if (__last._M_is_end()) + return _SeqTraits::_S_size(*__first._M_get_sequence()); + + return std::make_pair(1, __dp_sign); + } + + if (__first._M_is_end()) + { + if (__last._M_is_before_begin()) + return std::make_pair(-1, __dp_exact); + + if (__last._M_is_begin()) + { + _Diff __diff = _SeqTraits::_S_size(*__first._M_get_sequence()); + return std::make_pair(-__diff.first, __diff.second); + } + + return std::make_pair(-1, __dp_sign); + } + + if (__last._M_is_before_begin() || __last._M_is_begin()) + return std::make_pair(-1, __dp_sign); + + if (__last._M_is_end()) + return std::make_pair(1, __dp_sign); + + return std::make_pair(1, __dp_equality); + } + + // Get distance from sequence begin to specified iterator. + template + inline typename _Distance_traits<_Iterator>::__type + __get_distance_from_begin(const _Safe_iterator<_Iterator, _Sequence>& __it) + { + typedef _Sequence_traits<_Sequence> _SeqTraits; + + // No need to consider before_begin as this function is only used in + // _M_can_advance which won't be used for forward_list iterators. + if (__it._M_is_begin()) + return std::make_pair(0, __dp_exact); + + if (__it._M_is_end()) + return _SeqTraits::_S_size(*__it._M_get_sequence()); + + typename _Distance_traits<_Iterator>::__type __res + = __get_distance(__it._M_get_sequence()->_M_base().begin(), __it.base()); + + if (__res.second == __dp_equality) + return std::make_pair(1, __dp_sign); + + return __res; + } + + // Get distance from specified iterator to sequence end. + template + inline typename _Distance_traits<_Iterator>::__type + __get_distance_to_end(const _Safe_iterator<_Iterator, _Sequence>& __it) + { + typedef _Sequence_traits<_Sequence> _SeqTraits; + + // No need to consider before_begin as this function is only used in + // _M_can_advance which won't be used for forward_list iterators. + if (__it._M_is_begin()) + return _SeqTraits::_S_size(*__it._M_get_sequence()); + + if (__it._M_is_end()) + return std::make_pair(0, __dp_exact); + + typename _Distance_traits<_Iterator>::__type __res + = __get_distance(__it.base(), __it._M_get_sequence()->_M_base().end()); + + if (__res.second == __dp_equality) + return std::make_pair(1, __dp_sign); + + return __res; + } + +#if __cplusplus < 201103L + template + struct __is_safe_random_iterator<_Safe_iterator<_Iterator, _Sequence> > + : std::__are_same:: + iterator_category> + { }; +#else + template + _Iterator + __base(const _Safe_iterator<_Iterator, _Sequence>& __it, + std::random_access_iterator_tag) + { return __it.base(); } + + template + const _Safe_iterator<_Iterator, _Sequence>& + __base(const _Safe_iterator<_Iterator, _Sequence>& __it, + std::input_iterator_tag) + { return __it; } + + template + auto + __base(const _Safe_iterator<_Iterator, _Sequence>& __it) + -> decltype(__base(__it, std::__iterator_category(__it))) + { return __base(__it, std::__iterator_category(__it)); } +#endif + +#if __cplusplus < 201103L + template + struct _Unsafe_type<_Safe_iterator<_Iterator, _Sequence> > + { typedef _Iterator _Type; }; +#endif + + template + inline _Iterator + __unsafe(const _Safe_iterator<_Iterator, _Sequence>& __it) + { return __it.base(); } + +} // namespace __gnu_debug + +#include + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_local_iterator.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_local_iterator.h new file mode 100644 index 0000000..c46aa13 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_local_iterator.h @@ -0,0 +1,508 @@ +// Safe iterator implementation -*- C++ -*- + +// Copyright (C) 2011-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/safe_local_iterator.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_SAFE_LOCAL_ITERATOR_H +#define _GLIBCXX_DEBUG_SAFE_LOCAL_ITERATOR_H 1 + +#include + +namespace __gnu_debug +{ + /** \brief Safe iterator wrapper. + * + * The class template %_Safe_local_iterator is a wrapper around an + * iterator that tracks the iterator's movement among sequences and + * checks that operations performed on the "safe" iterator are + * legal. In additional to the basic iterator operations (which are + * validated, and then passed to the underlying iterator), + * %_Safe_local_iterator has member functions for iterator invalidation, + * attaching/detaching the iterator from sequences, and querying + * the iterator's state. + */ + template + class _Safe_local_iterator + : private _Iterator + , public _Safe_local_iterator_base + { + typedef _Iterator _Iter_base; + typedef _Safe_local_iterator_base _Safe_base; + typedef typename _Sequence::const_local_iterator _Const_local_iterator; + typedef typename _Sequence::size_type size_type; + + /// Determine if this is a constant iterator. + bool + _M_constant() const + { + return std::__are_same<_Const_local_iterator, + _Safe_local_iterator>::__value; + } + + typedef std::iterator_traits<_Iterator> _Traits; + + struct _Attach_single + { }; + + _Safe_local_iterator(const _Iterator& __i, _Safe_sequence_base* __cont, + _Attach_single) noexcept + : _Iter_base(__i) + { _M_attach_single(__cont); } + + public: + typedef _Iterator iterator_type; + typedef typename _Traits::iterator_category iterator_category; + typedef typename _Traits::value_type value_type; + typedef typename _Traits::difference_type difference_type; + typedef typename _Traits::reference reference; + typedef typename _Traits::pointer pointer; + + /// @post the iterator is singular and unattached + _Safe_local_iterator() noexcept : _Iter_base() { } + + /** + * @brief Safe iterator construction from an unsafe iterator and + * its sequence. + * + * @pre @p seq is not NULL + * @post this is not singular + */ + _Safe_local_iterator(const _Iterator& __i, + const _Safe_sequence_base* __cont) + : _Iter_base(__i), _Safe_base(__cont, _M_constant()) + { + _GLIBCXX_DEBUG_VERIFY(!this->_M_singular(), + _M_message(__msg_init_singular) + ._M_iterator(*this, "this")); + } + + /** + * @brief Copy construction. + */ + _Safe_local_iterator(const _Safe_local_iterator& __x) noexcept + : _Iter_base(__x.base()) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 408. Is vector > forbidden? + _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() + || __x.base() == _Iterator(), + _M_message(__msg_init_copy_singular) + ._M_iterator(*this, "this") + ._M_iterator(__x, "other")); + _M_attach(__x._M_sequence); + } + + /** + * @brief Move construction. + * @post __x is singular and unattached + */ + _Safe_local_iterator(_Safe_local_iterator&& __x) noexcept + : _Iter_base() + { + _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() + || __x.base() == _Iterator(), + _M_message(__msg_init_copy_singular) + ._M_iterator(*this, "this") + ._M_iterator(__x, "other")); + auto __cont = __x._M_sequence; + __x._M_detach(); + std::swap(base(), __x.base()); + _M_attach(__cont); + } + + /** + * @brief Converting constructor from a mutable iterator to a + * constant iterator. + */ + template + _Safe_local_iterator( + const _Safe_local_iterator<_MutableIterator, + typename __gnu_cxx::__enable_if::__value, + _Sequence>::__type>& __x) + : _Iter_base(__x.base()) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 408. Is vector > forbidden? + _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() + || __x.base() == _Iterator(), + _M_message(__msg_init_const_singular) + ._M_iterator(*this, "this") + ._M_iterator(__x, "other")); + _M_attach(__x._M_sequence); + } + + /** + * @brief Copy assignment. + */ + _Safe_local_iterator& + operator=(const _Safe_local_iterator& __x) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 408. Is vector > forbidden? + _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() + || __x.base() == _Iterator(), + _M_message(__msg_copy_singular) + ._M_iterator(*this, "this") + ._M_iterator(__x, "other")); + + if (this->_M_sequence && this->_M_sequence == __x._M_sequence) + { + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + base() = __x.base(); + _M_version = __x._M_sequence->_M_version; + } + else + { + _M_detach(); + base() = __x.base(); + _M_attach(__x._M_sequence); + } + + return *this; + } + + /** + * @brief Move assignment. + * @post __x is singular and unattached + */ + _Safe_local_iterator& + operator=(_Safe_local_iterator&& __x) noexcept + { + _GLIBCXX_DEBUG_VERIFY(this != &__x, + _M_message(__msg_self_move_assign) + ._M_iterator(*this, "this")); + _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() + || __x.base() == _Iterator(), + _M_message(__msg_copy_singular) + ._M_iterator(*this, "this") + ._M_iterator(__x, "other")); + + if (this->_M_sequence && this->_M_sequence == __x._M_sequence) + { + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + base() = __x.base(); + _M_version = __x._M_sequence->_M_version; + } + else + { + _M_detach(); + base() = __x.base(); + _M_attach(__x._M_sequence); + } + + __x._M_detach(); + __x.base() = _Iterator(); + return *this; + } + + /** + * @brief Iterator dereference. + * @pre iterator is dereferenceable + */ + reference + operator*() const + { + _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(), + _M_message(__msg_bad_deref) + ._M_iterator(*this, "this")); + return *base(); + } + + /** + * @brief Iterator dereference. + * @pre iterator is dereferenceable + */ + pointer + operator->() const + { + _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(), + _M_message(__msg_bad_deref) + ._M_iterator(*this, "this")); + return base().operator->(); + } + + // ------ Input iterator requirements ------ + /** + * @brief Iterator preincrement + * @pre iterator is incrementable + */ + _Safe_local_iterator& + operator++() + { + _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(), + _M_message(__msg_bad_inc) + ._M_iterator(*this, "this")); + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + ++base(); + return *this; + } + + /** + * @brief Iterator postincrement + * @pre iterator is incrementable + */ + _Safe_local_iterator + operator++(int) + { + _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(), + _M_message(__msg_bad_inc) + ._M_iterator(*this, "this")); + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + return _Safe_local_iterator(base()++, this->_M_sequence, + _Attach_single()); + } + + // ------ Utilities ------ + /** + * @brief Return the underlying iterator + */ + _Iterator& + base() noexcept { return *this; } + + const _Iterator& + base() const noexcept { return *this; } + + /** + * @brief Return the bucket + */ + size_type + bucket() const { return base()._M_get_bucket(); } + + /** + * @brief Conversion to underlying non-debug iterator to allow + * better interaction with non-debug containers. + */ + operator _Iterator() const { return *this; } + + /** Attach iterator to the given sequence. */ + void + _M_attach(_Safe_sequence_base* __seq) + { _Safe_base::_M_attach(__seq, _M_constant()); } + + /** Likewise, but not thread-safe. */ + void + _M_attach_single(_Safe_sequence_base* __seq) + { _Safe_base::_M_attach_single(__seq, _M_constant()); } + + /// Is the iterator dereferenceable? + bool + _M_dereferenceable() const + { return !this->_M_singular() && !_M_is_end(); } + + /// Is the iterator incrementable? + bool + _M_incrementable() const + { return !this->_M_singular() && !_M_is_end(); } + + // Is the iterator range [*this, __rhs) valid? + bool + _M_valid_range(const _Safe_local_iterator& __rhs, + std::pair& __dist_info) const; + + // The sequence this iterator references. + typename + __gnu_cxx::__conditional_type::__value, + const _Sequence*, + _Sequence*>::__type + _M_get_sequence() const + { return static_cast<_Sequence*>(_M_sequence); } + + /// Is this iterator equal to the sequence's begin(bucket) iterator? + bool _M_is_begin() const + { return base() == _M_get_sequence()->_M_base().begin(bucket()); } + + /// Is this iterator equal to the sequence's end(bucket) iterator? + bool _M_is_end() const + { return base() == _M_get_sequence()->_M_base().end(bucket()); } + + /// Is this iterator part of the same bucket as the other one? + template + bool + _M_in_same_bucket(const _Safe_local_iterator<_Other, + _Sequence>& __other) const + { return bucket() == __other.bucket(); } + }; + + template + inline bool + operator==(const _Safe_local_iterator<_IteratorL, _Sequence>& __lhs, + const _Safe_local_iterator<_IteratorR, _Sequence>& __rhs) + { + _GLIBCXX_DEBUG_VERIFY(!__lhs._M_singular() && !__rhs._M_singular(), + _M_message(__msg_iter_compare_bad) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), + _M_message(__msg_compare_different) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + _GLIBCXX_DEBUG_VERIFY(__lhs._M_in_same_bucket(__rhs), + _M_message(__msg_local_iter_compare_bad) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + return __lhs.base() == __rhs.base(); + } + + template + inline bool + operator==(const _Safe_local_iterator<_Iterator, _Sequence>& __lhs, + const _Safe_local_iterator<_Iterator, _Sequence>& __rhs) + { + _GLIBCXX_DEBUG_VERIFY(!__lhs._M_singular() && !__rhs._M_singular(), + _M_message(__msg_iter_compare_bad) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), + _M_message(__msg_compare_different) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + _GLIBCXX_DEBUG_VERIFY(__lhs._M_in_same_bucket(__rhs), + _M_message(__msg_local_iter_compare_bad) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + return __lhs.base() == __rhs.base(); + } + + template + inline bool + operator!=(const _Safe_local_iterator<_IteratorL, _Sequence>& __lhs, + const _Safe_local_iterator<_IteratorR, _Sequence>& __rhs) + { + _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(), + _M_message(__msg_iter_compare_bad) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), + _M_message(__msg_compare_different) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + _GLIBCXX_DEBUG_VERIFY(__lhs._M_in_same_bucket(__rhs), + _M_message(__msg_local_iter_compare_bad) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + return __lhs.base() != __rhs.base(); + } + + template + inline bool + operator!=(const _Safe_local_iterator<_Iterator, _Sequence>& __lhs, + const _Safe_local_iterator<_Iterator, _Sequence>& __rhs) + { + _GLIBCXX_DEBUG_VERIFY(!__lhs._M_singular() && !__rhs._M_singular(), + _M_message(__msg_iter_compare_bad) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs), + _M_message(__msg_compare_different) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + _GLIBCXX_DEBUG_VERIFY(__lhs._M_in_same_bucket(__rhs), + _M_message(__msg_local_iter_compare_bad) + ._M_iterator(__lhs, "lhs") + ._M_iterator(__rhs, "rhs")); + return __lhs.base() != __rhs.base(); + } + + /** Safe local iterators know if they are dereferenceable. */ + template + inline bool + __check_dereferenceable(const _Safe_local_iterator<_Iterator, + _Sequence>& __x) + { return __x._M_dereferenceable(); } + + /** Safe local iterators know how to check if they form a valid range. */ + template + inline bool + __valid_range(const _Safe_local_iterator<_Iterator, _Sequence>& __first, + const _Safe_local_iterator<_Iterator, _Sequence>& __last, + typename _Distance_traits<_Iterator>::__type& __dist_info) + { return __first._M_valid_range(__last, __dist_info); } + + /** Safe local iterators need a special method to get distance between each + other. */ + template + inline std::pair::difference_type, + _Distance_precision> + __get_distance(const _Safe_local_iterator<_Iterator, _Sequence>& __first, + const _Safe_local_iterator<_Iterator, _Sequence>& __last, + std::input_iterator_tag) + { + if (__first.base() == __last.base()) + return { 0, __dp_exact }; + + if (__first._M_is_begin()) + { + if (__last._M_is_end()) + return + { + __first._M_get_sequence()->bucket_size(__first.bucket()), + __dp_exact + }; + + return { 1, __dp_sign }; + } + + if (__first._M_is_end()) + { + if (__last._M_is_begin()) + return + { + -__first._M_get_sequence()->bucket_size(__first.bucket()), + __dp_exact + }; + + return { -1, __dp_sign }; + } + + if (__last._M_is_begin()) + return { -1, __dp_sign }; + + if (__last._M_is_end()) + return { 1, __dp_sign }; + + return { 1, __dp_equality }; + } + +#if __cplusplus < 201103L + template + struct _Unsafe_type<_Safe_local_iterator<_Iterator, _Sequence> > + { typedef _Iterator _Type; }; +#endif + + template + inline _Iterator + __unsafe(const _Safe_local_iterator<_Iterator, _Sequence>& __it) + { return __it.base(); } + +} // namespace __gnu_debug + +#include + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_sequence.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_sequence.h new file mode 100644 index 0000000..907b1c8 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_sequence.h @@ -0,0 +1,150 @@ +// Safe sequence implementation -*- C++ -*- + +// Copyright (C) 2003-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/safe_sequence.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_SAFE_SEQUENCE_H +#define _GLIBCXX_DEBUG_SAFE_SEQUENCE_H 1 + +#include +#include +#include +#include + +namespace __gnu_debug +{ + /** A simple function object that returns true if the passed-in + * value is not equal to the stored value. It saves typing over + * using both bind1st and not_equal. + */ + template + class _Not_equal_to + { + _Type __value; + + public: + explicit _Not_equal_to(const _Type& __v) : __value(__v) { } + + bool + operator()(const _Type& __x) const + { return __value != __x; } + }; + + /** A simple function object that returns true if the passed-in + * value is equal to the stored value. */ + template + class _Equal_to + { + _Type __value; + + public: + explicit _Equal_to(const _Type& __v) : __value(__v) { } + + bool + operator()(const _Type& __x) const + { return __value == __x; } + }; + + /** A function object that returns true when the given random access + iterator is at least @c n steps away from the given iterator. */ + template + class _After_nth_from + { + typedef typename std::iterator_traits<_Iterator>::difference_type + difference_type; + + _Iterator _M_base; + difference_type _M_n; + + public: + _After_nth_from(const difference_type& __n, const _Iterator& __base) + : _M_base(__base), _M_n(__n) { } + + bool + operator()(const _Iterator& __x) const + { return __x - _M_base >= _M_n; } + }; + + /** + * @brief Base class for constructing a @a safe sequence type that + * tracks iterators that reference it. + * + * The class template %_Safe_sequence simplifies the construction of + * @a safe sequences that track the iterators that reference the + * sequence, so that the iterators are notified of changes in the + * sequence that may affect their operation, e.g., if the container + * invalidates its iterators or is destructed. This class template + * may only be used by deriving from it and passing the name of the + * derived class as its template parameter via the curiously + * recurring template pattern. The derived class must have @c + * iterator and @c const_iterator types that are instantiations of + * class template _Safe_iterator for this sequence. Iterators will + * then be tracked automatically. + */ + template + class _Safe_sequence : public _Safe_sequence_base + { + public: + /** Invalidates all iterators @c x that reference this sequence, + are not singular, and for which @c __pred(x) returns @c + true. @c __pred will be invoked with the normal iterators nested + in the safe ones. */ + template + void + _M_invalidate_if(_Predicate __pred); + + /** Transfers all iterators @c x that reference @c from sequence, + are not singular, and for which @c __pred(x) returns @c + true. @c __pred will be invoked with the normal iterators nested + in the safe ones. */ + template + void + _M_transfer_from_if(_Safe_sequence& __from, _Predicate __pred); + }; + + /// Like _Safe_sequence but with a special _M_invalidate_all implementation + /// not invalidating past-the-end iterators. Used by node based sequence. + template + class _Safe_node_sequence + : public _Safe_sequence<_Sequence> + { + protected: + void + _M_invalidate_all() + { + typedef typename _Sequence::const_iterator _Const_iterator; + typedef typename _Const_iterator::iterator_type _Base_const_iterator; + typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal; + const _Sequence& __seq = *static_cast<_Sequence*>(this); + this->_M_invalidate_if(_Not_equal(__seq._M_base().end())); + } + }; + +} // namespace __gnu_debug + +#include + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_unordered_base.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_unordered_base.h new file mode 100644 index 0000000..ca5ef3b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_unordered_base.h @@ -0,0 +1,185 @@ +// Safe container/iterator base implementation -*- C++ -*- + +// Copyright (C) 2011-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/safe_unordered_base.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_SAFE_UNORDERED_BASE_H +#define _GLIBCXX_DEBUG_SAFE_UNORDERED_BASE_H 1 + +#include + +namespace __gnu_debug +{ + class _Safe_unordered_container_base; + + /** \brief Basic functionality for a @a safe iterator. + * + * The %_Safe_local_iterator_base base class implements the functionality + * of a safe local iterator that is not specific to a particular iterator + * type. It contains a pointer back to the container it references + * along with iterator version information and pointers to form a + * doubly-linked list of local iterators referenced by the container. + * + * This class must not perform any operations that can throw an + * exception, or the exception guarantees of derived iterators will + * be broken. + */ + class _Safe_local_iterator_base : public _Safe_iterator_base + { + protected: + /** Initializes the iterator and makes it singular. */ + _Safe_local_iterator_base() + { } + + /** Initialize the iterator to reference the container pointed to + * by @p __seq. @p __constant is true when we are initializing a + * constant local iterator, and false if it is a mutable local iterator. + * Note that @p __seq may be NULL, in which case the iterator will be + * singular. Otherwise, the iterator will reference @p __seq and + * be nonsingular. + */ + _Safe_local_iterator_base(const _Safe_sequence_base* __seq, bool __constant) + { this->_M_attach(const_cast<_Safe_sequence_base*>(__seq), __constant); } + + /** Initializes the iterator to reference the same container that + @p __x does. @p __constant is true if this is a constant + iterator, and false if it is mutable. */ + _Safe_local_iterator_base(const _Safe_local_iterator_base& __x, + bool __constant) + { this->_M_attach(__x._M_sequence, __constant); } + + ~_Safe_local_iterator_base() { this->_M_detach(); } + + _Safe_unordered_container_base* + _M_get_container() const noexcept; + + /** Attaches this iterator to the given container, detaching it + * from whatever container it was attached to originally. If the + * new container is the NULL pointer, the iterator is left + * unattached. + */ + void + _M_attach(_Safe_sequence_base* __seq, bool __constant); + + /** Likewise, but not thread-safe. */ + void + _M_attach_single(_Safe_sequence_base* __seq, bool __constant) throw (); + + /** Detach the iterator for whatever container it is attached to, + * if any. + */ + void + _M_detach(); + + /** Likewise, but not thread-safe. */ + void + _M_detach_single() throw (); + }; + + /** + * @brief Base class that supports tracking of local iterators that + * reference an unordered container. + * + * The %_Safe_unordered_container_base class provides basic support for + * tracking iterators into an unordered container. Containers that track + * iterators must derived from %_Safe_unordered_container_base publicly, so + * that safe iterators (which inherit _Safe_iterator_base) can + * attach to them. This class contains four linked lists of + * iterators, one for constant iterators, one for mutable + * iterators, one for constant local iterators, one for mutable local + * iterators and a version number that allows very fast + * invalidation of all iterators that reference the container. + * + * This class must ensure that no operation on it may throw an + * exception, otherwise @a safe containers may fail to provide the + * exception-safety guarantees required by the C++ standard. + */ + class _Safe_unordered_container_base : public _Safe_sequence_base + { + friend class _Safe_local_iterator_base; + typedef _Safe_sequence_base _Base; + + public: + /// The list of mutable local iterators that reference this container + _Safe_iterator_base* _M_local_iterators; + + /// The list of constant local iterators that reference this container + _Safe_iterator_base* _M_const_local_iterators; + + protected: + // Initialize with a version number of 1 and no iterators + _Safe_unordered_container_base() noexcept + : _M_local_iterators(nullptr), _M_const_local_iterators(nullptr) + { } + + // Copy constructor does not copy iterators. + _Safe_unordered_container_base(const _Safe_unordered_container_base&) + noexcept + : _Safe_unordered_container_base() { } + + // When moved unordered containers iterators are swapped. + _Safe_unordered_container_base(_Safe_unordered_container_base&& __x) + noexcept + : _Safe_unordered_container_base() + { this->_M_swap(__x); } + + /** Notify all iterators that reference this container that the + container is being destroyed. */ + ~_Safe_unordered_container_base() noexcept + { this->_M_detach_all(); } + + /** Detach all iterators, leaving them singular. */ + void + _M_detach_all(); + + /** Swap this container with the given container. This operation + * also swaps ownership of the iterators, so that when the + * operation is complete all iterators that originally referenced + * one container now reference the other container. + */ + void + _M_swap(_Safe_unordered_container_base& __x) noexcept; + + private: + /** Attach an iterator to this container. */ + void + _M_attach_local(_Safe_iterator_base* __it, bool __constant); + + /** Likewise but not thread safe. */ + void + _M_attach_local_single(_Safe_iterator_base* __it, bool __constant) throw (); + + /** Detach an iterator from this container */ + void + _M_detach_local(_Safe_iterator_base* __it); + + /** Likewise but not thread safe. */ + void + _M_detach_local_single(_Safe_iterator_base* __it) throw (); + }; +} // namespace __gnu_debug + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_unordered_container.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_unordered_container.h new file mode 100644 index 0000000..3f76290 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/safe_unordered_container.h @@ -0,0 +1,105 @@ +// Safe container implementation -*- C++ -*- + +// Copyright (C) 2011-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/safe_unordered_container.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_SAFE_UNORDERED_CONTAINER_H +#define _GLIBCXX_DEBUG_SAFE_UNORDERED_CONTAINER_H 1 + +#include +#include +#include +#include + +namespace __gnu_debug +{ + /** + * @brief Base class for constructing a @a safe unordered container type + * that tracks iterators that reference it. + * + * The class template %_Safe_unordered_container simplifies the + * construction of @a safe unordered containers that track the iterators + * that reference the container, so that the iterators are notified of + * changes in the container that may affect their operation, e.g., if + * the container invalidates its iterators or is destructed. This class + * template may only be used by deriving from it and passing the name + * of the derived class as its template parameter via the curiously + * recurring template pattern. The derived class must have @c + * iterator and @c const_iterator types that are instantiations of + * class template _Safe_iterator for this container and @c local_iterator + * and @c const_local_iterator types that are instantiations of class + * template _Safe_local_iterator for this container. Iterators will + * then be tracked automatically. + */ + template + class _Safe_unordered_container : public _Safe_unordered_container_base + { + private: + _Container& + _M_cont() noexcept + { return *static_cast<_Container*>(this); } + + protected: + void + _M_invalidate_locals() + { + auto __local_end = _M_cont()._M_base().end(0); + this->_M_invalidate_local_if( + [__local_end](__decltype(_M_cont()._M_base().cend(0)) __it) + { return __it != __local_end; }); + } + + void + _M_invalidate_all() + { + auto __end = _M_cont()._M_base().end(); + this->_M_invalidate_if( + [__end](__decltype(_M_cont()._M_base().cend()) __it) + { return __it != __end; }); + _M_invalidate_locals(); + } + + /** Invalidates all iterators @c x that reference this container, + are not singular, and for which @c __pred(x) returns @c + true. @c __pred will be invoked with the normal iterators nested + in the safe ones. */ + template + void + _M_invalidate_if(_Predicate __pred); + + /** Invalidates all local iterators @c x that reference this container, + are not singular, and for which @c __pred(x) returns @c + true. @c __pred will be invoked with the normal ilocal iterators + nested in the safe ones. */ + template + void + _M_invalidate_local_if(_Predicate __pred); + }; +} // namespace __gnu_debug + +#include + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/set.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/set.h new file mode 100644 index 0000000..0703286 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/set.h @@ -0,0 +1,609 @@ +// Debugging set implementation -*- C++ -*- + +// Copyright (C) 2003-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/set.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_SET_H +#define _GLIBCXX_DEBUG_SET_H 1 + +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace __debug +{ + /// Class std::set with safety/checking/debug instrumentation. + template, + typename _Allocator = std::allocator<_Key> > + class set + : public __gnu_debug::_Safe_container< + set<_Key, _Compare, _Allocator>, _Allocator, + __gnu_debug::_Safe_node_sequence>, + public _GLIBCXX_STD_C::set<_Key,_Compare,_Allocator> + { + typedef _GLIBCXX_STD_C::set<_Key, _Compare, _Allocator> _Base; + typedef __gnu_debug::_Safe_container< + set, _Allocator, __gnu_debug::_Safe_node_sequence> _Safe; + + typedef typename _Base::const_iterator _Base_const_iterator; + typedef typename _Base::iterator _Base_iterator; + typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; + + public: + // types: + typedef _Key key_type; + typedef _Key value_type; + typedef _Compare key_compare; + typedef _Compare value_compare; + typedef _Allocator allocator_type; + typedef typename _Base::reference reference; + typedef typename _Base::const_reference const_reference; + + typedef __gnu_debug::_Safe_iterator<_Base_iterator, set> + iterator; + typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, set> + const_iterator; + + typedef typename _Base::size_type size_type; + typedef typename _Base::difference_type difference_type; + typedef typename _Base::pointer pointer; + typedef typename _Base::const_pointer const_pointer; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + + // 23.3.3.1 construct/copy/destroy: + +#if __cplusplus < 201103L + set() : _Base() { } + + set(const set& __x) + : _Base(__x) { } + + ~set() { } +#else + set() = default; + set(const set&) = default; + set(set&&) = default; + + set(initializer_list __l, + const _Compare& __comp = _Compare(), + const allocator_type& __a = allocator_type()) + : _Base(__l, __comp, __a) { } + + explicit + set(const allocator_type& __a) + : _Base(__a) { } + + set(const set& __x, const allocator_type& __a) + : _Base(__x, __a) { } + + set(set&& __x, const allocator_type& __a) + : _Safe(std::move(__x._M_safe()), __a), + _Base(std::move(__x._M_base()), __a) { } + + set(initializer_list __l, const allocator_type& __a) + : _Base(__l, __a) { } + + template + set(_InputIterator __first, _InputIterator __last, + const allocator_type& __a) + : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, + __last)), + __gnu_debug::__base(__last), __a) { } + + ~set() = default; +#endif + + explicit set(const _Compare& __comp, + const _Allocator& __a = _Allocator()) + : _Base(__comp, __a) { } + + template + set(_InputIterator __first, _InputIterator __last, + const _Compare& __comp = _Compare(), + const _Allocator& __a = _Allocator()) + : _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first, + __last)), + __gnu_debug::__base(__last), + __comp, __a) { } + + set(const _Base& __x) + : _Base(__x) { } + +#if __cplusplus < 201103L + set& + operator=(const set& __x) + { + this->_M_safe() = __x; + _M_base() = __x; + return *this; + } +#else + set& + operator=(const set&) = default; + + set& + operator=(set&&) = default; + + set& + operator=(initializer_list __l) + { + _M_base() = __l; + this->_M_invalidate_all(); + return *this; + } +#endif + + using _Base::get_allocator; + + // iterators: + iterator + begin() _GLIBCXX_NOEXCEPT + { return iterator(_Base::begin(), this); } + + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::begin(), this); } + + iterator + end() _GLIBCXX_NOEXCEPT + { return iterator(_Base::end(), this); } + + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::end(), this); } + + reverse_iterator + rbegin() _GLIBCXX_NOEXCEPT + { return reverse_iterator(end()); } + + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(end()); } + + reverse_iterator + rend() _GLIBCXX_NOEXCEPT + { return reverse_iterator(begin()); } + + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(begin()); } + +#if __cplusplus >= 201103L + const_iterator + cbegin() const noexcept + { return const_iterator(_Base::begin(), this); } + + const_iterator + cend() const noexcept + { return const_iterator(_Base::end(), this); } + + const_reverse_iterator + crbegin() const noexcept + { return const_reverse_iterator(end()); } + + const_reverse_iterator + crend() const noexcept + { return const_reverse_iterator(begin()); } +#endif + + // capacity: + using _Base::empty; + using _Base::size; + using _Base::max_size; + + // modifiers: +#if __cplusplus >= 201103L + template + std::pair + emplace(_Args&&... __args) + { + auto __res = _Base::emplace(std::forward<_Args>(__args)...); + return std::pair(iterator(__res.first, this), + __res.second); + } + + template + iterator + emplace_hint(const_iterator __pos, _Args&&... __args) + { + __glibcxx_check_insert(__pos); + return iterator(_Base::emplace_hint(__pos.base(), + std::forward<_Args>(__args)...), + this); + } +#endif + + std::pair + insert(const value_type& __x) + { + std::pair<_Base_iterator, bool> __res = _Base::insert(__x); + return std::pair(iterator(__res.first, this), + __res.second); + } + +#if __cplusplus >= 201103L + std::pair + insert(value_type&& __x) + { + std::pair<_Base_iterator, bool> __res + = _Base::insert(std::move(__x)); + return std::pair(iterator(__res.first, this), + __res.second); + } +#endif + + iterator + insert(const_iterator __position, const value_type& __x) + { + __glibcxx_check_insert(__position); + return iterator(_Base::insert(__position.base(), __x), this); + } + +#if __cplusplus >= 201103L + iterator + insert(const_iterator __position, value_type&& __x) + { + __glibcxx_check_insert(__position); + return iterator(_Base::insert(__position.base(), std::move(__x)), + this); + } +#endif + + template + void + insert(_InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + + if (__dist.second >= __gnu_debug::__dp_sign) + _Base::insert(__gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + else + _Base::insert(__first, __last); + } + +#if __cplusplus >= 201103L + void + insert(initializer_list __l) + { _Base::insert(__l); } +#endif + +#if __cplusplus > 201402L + using node_type = typename _Base::node_type; + + struct insert_return_type + { + bool inserted; + iterator position; + node_type node; + }; + + node_type + extract(const_iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + return _Base::extract(__position.base()); + } + + node_type + extract(const key_type& __key) + { + const auto __position = find(__key); + if (__position != end()) + return extract(__position); + return {}; + } + + insert_return_type + insert(node_type&& __nh) + { + auto __ret = _Base::insert(std::move(__nh)); + iterator __pos = iterator(__ret.position, this); + return { __ret.inserted, __pos, std::move(__ret.node) }; + } + + iterator + insert(const_iterator __hint, node_type&& __nh) + { + __glibcxx_check_insert(__hint); + return iterator(_Base::insert(__hint.base(), std::move(__nh)), this); + } + + using _Base::merge; +#endif // C++17 + +#if __cplusplus >= 201103L + iterator + erase(const_iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + return iterator(_Base::erase(__position.base()), this); + } +#else + void + erase(iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + _Base::erase(__position.base()); + } +#endif + + size_type + erase(const key_type& __x) + { + _Base_iterator __victim = _Base::find(__x); + if (__victim == _Base::end()) + return 0; + else + { + this->_M_invalidate_if(_Equal(__victim)); + _Base::erase(__victim); + return 1; + } + } + +#if __cplusplus >= 201103L + iterator + erase(const_iterator __first, const_iterator __last) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 151. can't currently clear() empty container + __glibcxx_check_erase_range(__first, __last); + for (_Base_const_iterator __victim = __first.base(); + __victim != __last.base(); ++__victim) + { + _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), + _M_message(__gnu_debug::__msg_valid_range) + ._M_iterator(__first, "first") + ._M_iterator(__last, "last")); + this->_M_invalidate_if(_Equal(__victim)); + } + return iterator(_Base::erase(__first.base(), __last.base()), this); + } +#else + void + erase(iterator __first, iterator __last) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 151. can't currently clear() empty container + __glibcxx_check_erase_range(__first, __last); + for (_Base_iterator __victim = __first.base(); + __victim != __last.base(); ++__victim) + { + _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), + _M_message(__gnu_debug::__msg_valid_range) + ._M_iterator(__first, "first") + ._M_iterator(__last, "last")); + this->_M_invalidate_if(_Equal(__victim)); + } + _Base::erase(__first.base(), __last.base()); + } +#endif + + void + swap(set& __x) + _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) ) + { + _Safe::_M_swap(__x); + _Base::swap(__x); + } + + void + clear() _GLIBCXX_NOEXCEPT + { + this->_M_invalidate_all(); + _Base::clear(); + } + + // observers: + using _Base::key_comp; + using _Base::value_comp; + + // set operations: + iterator + find(const key_type& __x) + { return iterator(_Base::find(__x), this); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 214. set::find() missing const overload + const_iterator + find(const key_type& __x) const + { return const_iterator(_Base::find(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + find(const _Kt& __x) + { return { _Base::find(__x), this }; } + + template::type> + const_iterator + find(const _Kt& __x) const + { return { _Base::find(__x), this }; } +#endif + + using _Base::count; + + iterator + lower_bound(const key_type& __x) + { return iterator(_Base::lower_bound(__x), this); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 214. set::find() missing const overload + const_iterator + lower_bound(const key_type& __x) const + { return const_iterator(_Base::lower_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + lower_bound(const _Kt& __x) + { return { _Base::lower_bound(__x), this }; } + + template::type> + const_iterator + lower_bound(const _Kt& __x) const + { return { _Base::lower_bound(__x), this }; } +#endif + + iterator + upper_bound(const key_type& __x) + { return iterator(_Base::upper_bound(__x), this); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 214. set::find() missing const overload + const_iterator + upper_bound(const key_type& __x) const + { return const_iterator(_Base::upper_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + upper_bound(const _Kt& __x) + { return { _Base::upper_bound(__x), this }; } + + template::type> + const_iterator + upper_bound(const _Kt& __x) const + { return { _Base::upper_bound(__x), this }; } +#endif + + std::pair + equal_range(const key_type& __x) + { + std::pair<_Base_iterator, _Base_iterator> __res = + _Base::equal_range(__x); + return std::make_pair(iterator(__res.first, this), + iterator(__res.second, this)); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 214. set::find() missing const overload + std::pair + equal_range(const key_type& __x) const + { + std::pair<_Base_const_iterator, _Base_const_iterator> __res = + _Base::equal_range(__x); + return std::make_pair(const_iterator(__res.first, this), + const_iterator(__res.second, this)); + } + +#if __cplusplus > 201103L + template::type> + std::pair + equal_range(const _Kt& __x) + { + auto __res = _Base::equal_range(__x); + return { { __res.first, this }, { __res.second, this } }; + } + + template::type> + std::pair + equal_range(const _Kt& __x) const + { + auto __res = _Base::equal_range(__x); + return { { __res.first, this }, { __res.second, this } }; + } +#endif + + _Base& + _M_base() _GLIBCXX_NOEXCEPT { return *this; } + + const _Base& + _M_base() const _GLIBCXX_NOEXCEPT { return *this; } + }; + + template + inline bool + operator==(const set<_Key, _Compare, _Allocator>& __lhs, + const set<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() == __rhs._M_base(); } + + template + inline bool + operator!=(const set<_Key, _Compare, _Allocator>& __lhs, + const set<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() != __rhs._M_base(); } + + template + inline bool + operator<(const set<_Key, _Compare, _Allocator>& __lhs, + const set<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() < __rhs._M_base(); } + + template + inline bool + operator<=(const set<_Key, _Compare, _Allocator>& __lhs, + const set<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() <= __rhs._M_base(); } + + template + inline bool + operator>=(const set<_Key, _Compare, _Allocator>& __lhs, + const set<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() >= __rhs._M_base(); } + + template + inline bool + operator>(const set<_Key, _Compare, _Allocator>& __lhs, + const set<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() > __rhs._M_base(); } + + template + void + swap(set<_Key, _Compare, _Allocator>& __x, + set<_Key, _Compare, _Allocator>& __y) + _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y))) + { return __x.swap(__y); } + +} // namespace __debug +} // namespace std + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/stl_iterator.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/stl_iterator.h new file mode 100644 index 0000000..8012ee7 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/debug/stl_iterator.h @@ -0,0 +1,113 @@ +// Debugging support implementation -*- C++ -*- + +// Copyright (C) 2015-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/stl_iterator.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_STL_ITERATOR_H +#define _GLIBCXX_DEBUG_STL_ITERATOR_H 1 + +#include + +namespace __gnu_debug +{ + // Help Debug mode to see through reverse_iterator. + template + inline bool + __valid_range(const std::reverse_iterator<_Iterator>& __first, + const std::reverse_iterator<_Iterator>& __last, + typename _Distance_traits<_Iterator>::__type& __dist) + { return __valid_range(__last.base(), __first.base(), __dist); } + + template + inline typename _Distance_traits<_Iterator>::__type + __get_distance(const std::reverse_iterator<_Iterator>& __first, + const std::reverse_iterator<_Iterator>& __last) + { return __get_distance(__last.base(), __first.base()); } + +#if __cplusplus < 201103L + template + struct __is_safe_random_iterator > + : __is_safe_random_iterator<_Iterator> + { }; + + template + struct _Unsafe_type > + { + typedef typename _Unsafe_type<_Iterator>::_Type _UnsafeType; + typedef std::reverse_iterator<_UnsafeType> _Type; + }; + + template + inline std::reverse_iterator::_Type> + __unsafe(const std::reverse_iterator<_Iterator>& __it) + { + typedef typename _Unsafe_type<_Iterator>::_Type _UnsafeType; + return std::reverse_iterator<_UnsafeType>(__unsafe(__it.base())); + } +#else + template + inline auto + __base(const std::reverse_iterator<_Iterator>& __it) + -> decltype(std::__make_reverse_iterator(__base(__it.base()))) + { return std::__make_reverse_iterator(__base(__it.base())); } + + template + inline auto + __unsafe(const std::reverse_iterator<_Iterator>& __it) + -> decltype(std::__make_reverse_iterator(__unsafe(__it.base()))) + { return std::__make_reverse_iterator(__unsafe(__it.base())); } +#endif + +#if __cplusplus >= 201103L + // Help Debug mode to see through move_iterator. + template + inline bool + __valid_range(const std::move_iterator<_Iterator>& __first, + const std::move_iterator<_Iterator>& __last, + typename _Distance_traits<_Iterator>::__type& __dist) + { return __valid_range(__first.base(), __last.base(), __dist); } + + template + inline typename _Distance_traits<_Iterator>::__type + __get_distance(const std::move_iterator<_Iterator>& __first, + const std::move_iterator<_Iterator>& __last) + { return __get_distance(__first.base(), __last.base()); } + + template + inline auto + __unsafe(const std::move_iterator<_Iterator>& __it) + -> decltype(std::make_move_iterator(__unsafe(__it.base()))) + { return std::make_move_iterator(__unsafe(__it.base())); } + + template + inline auto + __base(const std::move_iterator<_Iterator>& __it) + -> decltype(std::make_move_iterator(__base(__it.base()))) + { return std::make_move_iterator(__base(__it.base())); } +#endif +} + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/decimal/decimal.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/decimal/decimal.h new file mode 100644 index 0000000..ede6e57 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/decimal/decimal.h @@ -0,0 +1,468 @@ +// decimal classes -*- C++ -*- + +// Copyright (C) 2009-2017 Free Software Foundation, Inc. + +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file decimal/decimal.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{decimal} + */ + +// ISO/IEC TR 24733 +// Written by Janis Johnson + +#ifndef _GLIBCXX_DECIMAL_IMPL +#define _GLIBCXX_DECIMAL_IMPL 1 + +#pragma GCC system_header + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace decimal +{ + _GLIBCXX_BEGIN_NAMESPACE_VERSION + + // ISO/IEC TR 24733 3.2.[234].1 Construct/copy/destroy. + + inline decimal32::decimal32(decimal64 __r) : __val(__r.__getval()) {} + inline decimal32::decimal32(decimal128 __r) : __val(__r.__getval()) {} + inline decimal64::decimal64(decimal32 __r) : __val(__r.__getval()) {} + inline decimal64::decimal64(decimal128 __r) : __val(__r.__getval()) {} + inline decimal128::decimal128(decimal32 __r) : __val(__r.__getval()) {} + inline decimal128::decimal128(decimal64 __r) : __val(__r.__getval()) {} + + // ISO/IEC TR 24733 3.2.[234].6 Compound assignment. + +#define _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, _T2) \ + inline _T1& _T1::operator _Op1(_T2 __rhs) \ + { \ + __setval(__getval() _Op2 __rhs.__getval()); \ + return *this; \ + } + +#define _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, _T2) \ + inline _T1& _T1::operator _Op1(_T2 __rhs) \ + { \ + __setval(__getval() _Op2 __rhs); \ + return *this; \ + } + +#define _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(_Op1, _Op2, _T1) \ + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, decimal32) \ + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, decimal64) \ + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC(_Op1, _Op2, _T1, decimal128) \ + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, int) \ + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, unsigned int) \ + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, long) \ + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, unsigned long)\ + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, long long) \ + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT(_Op1, _Op2, _T1, unsigned long long) + + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(+=, +, decimal32) + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(-=, -, decimal32) + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(*=, *, decimal32) + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(/=, /, decimal32) + + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(+=, +, decimal64) + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(-=, -, decimal64) + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(*=, *, decimal64) + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(/=, /, decimal64) + + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(+=, +, decimal128) + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(-=, -, decimal128) + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(*=, *, decimal128) + _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS(/=, /, decimal128) + +#undef _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_DEC +#undef _DEFINE_DECIMAL_COMPOUND_ASSIGNMENT_INT +#undef _DEFINE_DECIMAL_COMPOUND_ASSIGNMENTS + + // Extension: Conversion to integral type. + + inline long long decimal32_to_long_long(decimal32 __d) + { return (long long)__d.__getval(); } + + inline long long decimal64_to_long_long(decimal64 __d) + { return (long long)__d.__getval(); } + + inline long long decimal128_to_long_long(decimal128 __d) + { return (long long)__d.__getval(); } + + inline long long decimal_to_long_long(decimal32 __d) + { return (long long)__d.__getval(); } + + inline long long decimal_to_long_long(decimal64 __d) + { return (long long)__d.__getval(); } + + inline long long decimal_to_long_long(decimal128 __d) + { return (long long)__d.__getval(); } + + // ISO/IEC TR 24733 3.2.5 Initialization from coefficient and exponent. + + static decimal32 make_decimal32(long long __coeff, int __exponent) + { + decimal32 __decexp = 1, __multiplier; + + if (__exponent < 0) + { + __multiplier = 1.E-1DF; + __exponent = -__exponent; + } + else + __multiplier = 1.E1DF; + + for (int __i = 0; __i < __exponent; ++__i) + __decexp *= __multiplier; + + return __coeff * __decexp; + } + + static decimal32 make_decimal32(unsigned long long __coeff, int __exponent) + { + decimal32 __decexp = 1, __multiplier; + + if (__exponent < 0) + { + __multiplier = 1.E-1DF; + __exponent = -__exponent; + } + else + __multiplier = 1.E1DF; + + for (int __i = 0; __i < __exponent; ++__i) + __decexp *= __multiplier; + + return __coeff * __decexp; + } + + static decimal64 make_decimal64(long long __coeff, int __exponent) + { + decimal64 __decexp = 1, __multiplier; + + if (__exponent < 0) + { + __multiplier = 1.E-1DD; + __exponent = -__exponent; + } + else + __multiplier = 1.E1DD; + + for (int __i = 0; __i < __exponent; ++__i) + __decexp *= __multiplier; + + return __coeff * __decexp; + } + + static decimal64 make_decimal64(unsigned long long __coeff, int __exponent) + { + decimal64 __decexp = 1, __multiplier; + + if (__exponent < 0) + { + __multiplier = 1.E-1DD; + __exponent = -__exponent; + } + else + __multiplier = 1.E1DD; + + for (int __i = 0; __i < __exponent; ++__i) + __decexp *= __multiplier; + + return __coeff * __decexp; + } + + static decimal128 make_decimal128(long long __coeff, int __exponent) + { + decimal128 __decexp = 1, __multiplier; + + if (__exponent < 0) + { + __multiplier = 1.E-1DL; + __exponent = -__exponent; + } + else + __multiplier = 1.E1DL; + + for (int __i = 0; __i < __exponent; ++__i) + __decexp *= __multiplier; + + return __coeff * __decexp; + } + + static decimal128 make_decimal128(unsigned long long __coeff, int __exponent) + { + decimal128 __decexp = 1, __multiplier; + + if (__exponent < 0) + { + __multiplier = 1.E-1DL; + __exponent = -__exponent; + } + else + __multiplier = 1.E1DL; + + for (int __i = 0; __i < __exponent; ++__i) + __decexp *= __multiplier; + + return __coeff * __decexp; + } + + // ISO/IEC TR 24733 3.2.6 Conversion to generic floating-point type. + + inline float decimal32_to_float(decimal32 __d) + { return (float)__d.__getval(); } + + inline float decimal64_to_float(decimal64 __d) + { return (float)__d.__getval(); } + + inline float decimal128_to_float(decimal128 __d) + { return (float)__d.__getval(); } + + inline float decimal_to_float(decimal32 __d) + { return (float)__d.__getval(); } + + inline float decimal_to_float(decimal64 __d) + { return (float)__d.__getval(); } + + inline float decimal_to_float(decimal128 __d) + { return (float)__d.__getval(); } + + inline double decimal32_to_double(decimal32 __d) + { return (double)__d.__getval(); } + + inline double decimal64_to_double(decimal64 __d) + { return (double)__d.__getval(); } + + inline double decimal128_to_double(decimal128 __d) + { return (double)__d.__getval(); } + + inline double decimal_to_double(decimal32 __d) + { return (double)__d.__getval(); } + + inline double decimal_to_double(decimal64 __d) + { return (double)__d.__getval(); } + + inline double decimal_to_double(decimal128 __d) + { return (double)__d.__getval(); } + + inline long double decimal32_to_long_double(decimal32 __d) + { return (long double)__d.__getval(); } + + inline long double decimal64_to_long_double(decimal64 __d) + { return (long double)__d.__getval(); } + + inline long double decimal128_to_long_double(decimal128 __d) + { return (long double)__d.__getval(); } + + inline long double decimal_to_long_double(decimal32 __d) + { return (long double)__d.__getval(); } + + inline long double decimal_to_long_double(decimal64 __d) + { return (long double)__d.__getval(); } + + inline long double decimal_to_long_double(decimal128 __d) + { return (long double)__d.__getval(); } + + // ISO/IEC TR 24733 3.2.7 Unary arithmetic operators. + +#define _DEFINE_DECIMAL_UNARY_OP(_Op, _Tp) \ + inline _Tp operator _Op(_Tp __rhs) \ + { \ + _Tp __tmp; \ + __tmp.__setval(_Op __rhs.__getval()); \ + return __tmp; \ + } + + _DEFINE_DECIMAL_UNARY_OP(+, decimal32) + _DEFINE_DECIMAL_UNARY_OP(+, decimal64) + _DEFINE_DECIMAL_UNARY_OP(+, decimal128) + _DEFINE_DECIMAL_UNARY_OP(-, decimal32) + _DEFINE_DECIMAL_UNARY_OP(-, decimal64) + _DEFINE_DECIMAL_UNARY_OP(-, decimal128) + +#undef _DEFINE_DECIMAL_UNARY_OP + + // ISO/IEC TR 24733 3.2.8 Binary arithmetic operators. + +#define _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(_Op, _T1, _T2, _T3) \ + inline _T1 operator _Op(_T2 __lhs, _T3 __rhs) \ + { \ + _T1 __retval; \ + __retval.__setval(__lhs.__getval() _Op __rhs.__getval()); \ + return __retval; \ + } + +#define _DEFINE_DECIMAL_BINARY_OP_BOTH(_Op, _T1, _T2, _T3) \ + inline _T1 operator _Op(_T2 __lhs, _T3 __rhs) \ + { \ + _T1 __retval; \ + __retval.__setval(__lhs.__getval() _Op __rhs.__getval()); \ + return __retval; \ + } + +#define _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, _T2) \ + inline _T1 operator _Op(_T1 __lhs, _T2 __rhs) \ + { \ + _T1 __retval; \ + __retval.__setval(__lhs.__getval() _Op __rhs); \ + return __retval; \ + } + +#define _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, _T2) \ + inline _T1 operator _Op(_T2 __lhs, _T1 __rhs) \ + { \ + _T1 __retval; \ + __retval.__setval(__lhs _Op __rhs.__getval()); \ + return __retval; \ + } + +#define _DEFINE_DECIMAL_BINARY_OP_WITH_INT(_Op, _T1) \ + _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, int); \ + _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, unsigned int); \ + _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, long); \ + _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, unsigned long); \ + _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, long long); \ + _DEFINE_DECIMAL_BINARY_OP_LHS(_Op, _T1, unsigned long long); \ + _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, int); \ + _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, unsigned int); \ + _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, long); \ + _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, unsigned long); \ + _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, long long); \ + _DEFINE_DECIMAL_BINARY_OP_RHS(_Op, _T1, unsigned long long); \ + + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal32, decimal32, decimal32) + _DEFINE_DECIMAL_BINARY_OP_WITH_INT(+, decimal32) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal32, decimal64) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal64, decimal32) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal64, decimal64) + _DEFINE_DECIMAL_BINARY_OP_WITH_INT(+, decimal64) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal32, decimal128) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal64, decimal128) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal32) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal64) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal128) + _DEFINE_DECIMAL_BINARY_OP_WITH_INT(+, decimal128) + + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal32, decimal32, decimal32) + _DEFINE_DECIMAL_BINARY_OP_WITH_INT(-, decimal32) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal32, decimal64) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal64, decimal32) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal64, decimal64) + _DEFINE_DECIMAL_BINARY_OP_WITH_INT(-, decimal64) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal32, decimal128) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal64, decimal128) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal32) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal64) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal128) + _DEFINE_DECIMAL_BINARY_OP_WITH_INT(-, decimal128) + + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal32, decimal32, decimal32) + _DEFINE_DECIMAL_BINARY_OP_WITH_INT(*, decimal32) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal32, decimal64) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal64, decimal32) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal64, decimal64) + _DEFINE_DECIMAL_BINARY_OP_WITH_INT(*, decimal64) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal32, decimal128) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal64, decimal128) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal32) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal64) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal128) + _DEFINE_DECIMAL_BINARY_OP_WITH_INT(*, decimal128) + + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal32, decimal32, decimal32) + _DEFINE_DECIMAL_BINARY_OP_WITH_INT(/, decimal32) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal32, decimal64) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal64, decimal32) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal64, decimal64) + _DEFINE_DECIMAL_BINARY_OP_WITH_INT(/, decimal64) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal32, decimal128) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal64, decimal128) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal32) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal64) + _DEFINE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal128) + _DEFINE_DECIMAL_BINARY_OP_WITH_INT(/, decimal128) + +#undef _DEFINE_DECIMAL_BINARY_OP_WITH_DEC +#undef _DEFINE_DECIMAL_BINARY_OP_BOTH +#undef _DEFINE_DECIMAL_BINARY_OP_LHS +#undef _DEFINE_DECIMAL_BINARY_OP_RHS +#undef _DEFINE_DECIMAL_BINARY_OP_WITH_INT + + // ISO/IEC TR 24733 3.2.9 Comparison operators. + +#define _DEFINE_DECIMAL_COMPARISON_BOTH(_Op, _T1, _T2) \ + inline bool operator _Op(_T1 __lhs, _T2 __rhs) \ + { return __lhs.__getval() _Op __rhs.__getval(); } + +#define _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _T1, _T2) \ + inline bool operator _Op(_T1 __lhs, _T2 __rhs) \ + { return __lhs.__getval() _Op __rhs; } + +#define _DEFINE_DECIMAL_COMPARISON_RHS(_Op, _T1, _T2) \ + inline bool operator _Op(_T1 __lhs, _T2 __rhs) \ + { return __lhs _Op __rhs.__getval(); } + +#define _DEFINE_DECIMAL_COMPARISONS(_Op, _Tp) \ + _DEFINE_DECIMAL_COMPARISON_BOTH(_Op, _Tp, decimal32) \ + _DEFINE_DECIMAL_COMPARISON_BOTH(_Op, _Tp, decimal64) \ + _DEFINE_DECIMAL_COMPARISON_BOTH(_Op, _Tp, decimal128) \ + _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, int) \ + _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, unsigned int) \ + _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, long) \ + _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, unsigned long) \ + _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, long long) \ + _DEFINE_DECIMAL_COMPARISON_LHS(_Op, _Tp, unsigned long long) \ + _DEFINE_DECIMAL_COMPARISON_RHS(_Op, int, _Tp) \ + _DEFINE_DECIMAL_COMPARISON_RHS(_Op, unsigned int, _Tp) \ + _DEFINE_DECIMAL_COMPARISON_RHS(_Op, long, _Tp) \ + _DEFINE_DECIMAL_COMPARISON_RHS(_Op, unsigned long, _Tp) \ + _DEFINE_DECIMAL_COMPARISON_RHS(_Op, long long, _Tp) \ + _DEFINE_DECIMAL_COMPARISON_RHS(_Op, unsigned long long, _Tp) + + _DEFINE_DECIMAL_COMPARISONS(==, decimal32) + _DEFINE_DECIMAL_COMPARISONS(==, decimal64) + _DEFINE_DECIMAL_COMPARISONS(==, decimal128) + _DEFINE_DECIMAL_COMPARISONS(!=, decimal32) + _DEFINE_DECIMAL_COMPARISONS(!=, decimal64) + _DEFINE_DECIMAL_COMPARISONS(!=, decimal128) + _DEFINE_DECIMAL_COMPARISONS(<, decimal32) + _DEFINE_DECIMAL_COMPARISONS(<, decimal64) + _DEFINE_DECIMAL_COMPARISONS(<, decimal128) + _DEFINE_DECIMAL_COMPARISONS(<=, decimal32) + _DEFINE_DECIMAL_COMPARISONS(<=, decimal64) + _DEFINE_DECIMAL_COMPARISONS(<=, decimal128) + _DEFINE_DECIMAL_COMPARISONS(>, decimal32) + _DEFINE_DECIMAL_COMPARISONS(>, decimal64) + _DEFINE_DECIMAL_COMPARISONS(>, decimal128) + _DEFINE_DECIMAL_COMPARISONS(>=, decimal32) + _DEFINE_DECIMAL_COMPARISONS(>=, decimal64) + _DEFINE_DECIMAL_COMPARISONS(>=, decimal128) + +#undef _DEFINE_DECIMAL_COMPARISON_BOTH +#undef _DEFINE_DECIMAL_COMPARISON_LHS +#undef _DEFINE_DECIMAL_COMPARISON_RHS +#undef _DEFINE_DECIMAL_COMPARISONS + _GLIBCXX_END_NAMESPACE_VERSION +} // namespace decimal +} // namespace std + +#endif /* _GLIBCXX_DECIMAL_IMPL */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/erase_if.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/erase_if.h new file mode 100644 index 0000000..7dc47db --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/erase_if.h @@ -0,0 +1,70 @@ +// -*- C++ -*- + +// Copyright (C) 2015-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file experimental/bits/erase_if.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. + */ + +#ifndef _GLIBCXX_EXPERIMENTAL_ERASE_IF_H +#define _GLIBCXX_EXPERIMENTAL_ERASE_IF_H 1 + +#pragma GCC system_header + +#if __cplusplus <= 201103L +# include +#else +#include + +namespace std +{ +namespace experimental +{ +inline namespace fundamentals_v2 +{ + namespace __detail + { +_GLIBCXX_BEGIN_NAMESPACE_VERSION + template + void + __erase_nodes_if(_Container& __cont, _Predicate __pred) + { + for (auto __iter = __cont.begin(), __last = __cont.end(); + __iter != __last;) + { + if (__pred(*__iter)) + __iter = __cont.erase(__iter); + else + ++__iter; + } + } +_GLIBCXX_END_NAMESPACE_VERSION + } // namespace __detail +} // inline namespace fundamentals_v2 +} // namespace experimental +} // namespace std + +#endif // C++14 + +#endif // _GLIBCXX_EXPERIMENTAL_ERASE_IF_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/fs_dir.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/fs_dir.h new file mode 100644 index 0000000..0efaf94 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/fs_dir.h @@ -0,0 +1,363 @@ +// Filesystem directory utilities -*- C++ -*- + +// Copyright (C) 2014-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file experimental/bits/fs_dir.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{experimental/filesystem} + */ + +#ifndef _GLIBCXX_EXPERIMENTAL_FS_DIR_H +#define _GLIBCXX_EXPERIMENTAL_FS_DIR_H 1 + +#if __cplusplus < 201103L +# include +#else +# include +# include +# include +# include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace experimental +{ +namespace filesystem +{ +inline namespace v1 +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @ingroup filesystem + * @{ + */ + + class file_status + { + public: + // constructors + explicit + file_status(file_type __ft = file_type::none, + perms __prms = perms::unknown) noexcept + : _M_type(__ft), _M_perms(__prms) { } + + file_status(const file_status&) noexcept = default; + file_status(file_status&&) noexcept = default; + ~file_status() = default; + + file_status& operator=(const file_status&) noexcept = default; + file_status& operator=(file_status&&) noexcept = default; + + // observers + file_type type() const noexcept { return _M_type; } + perms permissions() const noexcept { return _M_perms; } + + // modifiers + void type(file_type __ft) noexcept { _M_type = __ft; } + void permissions(perms __prms) noexcept { _M_perms = __prms; } + + private: + file_type _M_type; + perms _M_perms; + }; + +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + + class directory_entry + { + public: + // constructors and destructor + directory_entry() noexcept = default; + directory_entry(const directory_entry&) = default; + directory_entry(directory_entry&&) noexcept = default; + explicit directory_entry(const filesystem::path& __p) : _M_path(__p) { } + ~directory_entry() = default; + + // modifiers + directory_entry& operator=(const directory_entry&) = default; + directory_entry& operator=(directory_entry&&) noexcept = default; + + void assign(const filesystem::path& __p) { _M_path = __p; } + + void + replace_filename(const filesystem::path& __p) + { _M_path = _M_path.parent_path() / __p; } + + // observers + const filesystem::path& path() const noexcept { return _M_path; } + operator const filesystem::path&() const noexcept { return _M_path; } + + file_status + status() const + { return filesystem::status(_M_path); } + + file_status + status(error_code& __ec) const noexcept + { return filesystem::status(_M_path, __ec); } + + file_status + symlink_status() const + { return filesystem::symlink_status(_M_path); } + + file_status + symlink_status(error_code& __ec) const noexcept + { return filesystem::symlink_status(_M_path, __ec); } + + bool + operator< (const directory_entry& __rhs) const noexcept + { return _M_path < __rhs._M_path; } + + bool + operator==(const directory_entry& __rhs) const noexcept + { return _M_path == __rhs._M_path; } + + bool + operator!=(const directory_entry& __rhs) const noexcept + { return _M_path != __rhs._M_path; } + + bool + operator<=(const directory_entry& __rhs) const noexcept + { return _M_path <= __rhs._M_path; } + + bool + operator> (const directory_entry& __rhs) const noexcept + { return _M_path > __rhs._M_path; } + + bool + operator>=(const directory_entry& __rhs) const noexcept + { return _M_path >= __rhs._M_path; } + + private: + filesystem::path _M_path; + }; + + struct _Dir; + class directory_iterator; + class recursive_directory_iterator; + + struct __directory_iterator_proxy + { + const directory_entry& operator*() const& noexcept { return _M_entry; } + + directory_entry operator*() && noexcept { return std::move(_M_entry); } + + private: + friend class directory_iterator; + friend class recursive_directory_iterator; + + explicit + __directory_iterator_proxy(const directory_entry& __e) : _M_entry(__e) { } + + directory_entry _M_entry; + }; + + class directory_iterator + { + public: + typedef directory_entry value_type; + typedef ptrdiff_t difference_type; + typedef const directory_entry* pointer; + typedef const directory_entry& reference; + typedef input_iterator_tag iterator_category; + + directory_iterator() = default; + + explicit + directory_iterator(const path& __p) + : directory_iterator(__p, directory_options::none, nullptr) { } + + directory_iterator(const path& __p, directory_options __options) + : directory_iterator(__p, __options, nullptr) { } + + directory_iterator(const path& __p, error_code& __ec) noexcept + : directory_iterator(__p, directory_options::none, __ec) { } + + directory_iterator(const path& __p, + directory_options __options, + error_code& __ec) noexcept + : directory_iterator(__p, __options, &__ec) { } + + directory_iterator(const directory_iterator& __rhs) = default; + + directory_iterator(directory_iterator&& __rhs) noexcept = default; + + ~directory_iterator() = default; + + directory_iterator& + operator=(const directory_iterator& __rhs) = default; + + directory_iterator& + operator=(directory_iterator&& __rhs) noexcept = default; + + const directory_entry& operator*() const; + const directory_entry* operator->() const { return &**this; } + directory_iterator& operator++(); + directory_iterator& increment(error_code& __ec) noexcept; + + __directory_iterator_proxy operator++(int) + { + __directory_iterator_proxy __pr{**this}; + ++*this; + return __pr; + } + + private: + directory_iterator(const path&, directory_options, error_code*); + + friend bool + operator==(const directory_iterator& __lhs, + const directory_iterator& __rhs); + + friend class recursive_directory_iterator; + + std::shared_ptr<_Dir> _M_dir; + }; + + inline directory_iterator + begin(directory_iterator __iter) noexcept + { return __iter; } + + inline directory_iterator + end(directory_iterator) noexcept + { return directory_iterator(); } + + inline bool + operator==(const directory_iterator& __lhs, const directory_iterator& __rhs) + { + return !__rhs._M_dir.owner_before(__lhs._M_dir) + && !__lhs._M_dir.owner_before(__rhs._M_dir); + } + + inline bool + operator!=(const directory_iterator& __lhs, const directory_iterator& __rhs) + { return !(__lhs == __rhs); } + + class recursive_directory_iterator + { + public: + typedef directory_entry value_type; + typedef ptrdiff_t difference_type; + typedef const directory_entry* pointer; + typedef const directory_entry& reference; + typedef input_iterator_tag iterator_category; + + recursive_directory_iterator() = default; + + explicit + recursive_directory_iterator(const path& __p) + : recursive_directory_iterator(__p, directory_options::none, nullptr) { } + + recursive_directory_iterator(const path& __p, directory_options __options) + : recursive_directory_iterator(__p, __options, nullptr) { } + + recursive_directory_iterator(const path& __p, + directory_options __options, + error_code& __ec) noexcept + : recursive_directory_iterator(__p, __options, &__ec) { } + + recursive_directory_iterator(const path& __p, error_code& __ec) noexcept + : recursive_directory_iterator(__p, directory_options::none, &__ec) { } + + recursive_directory_iterator( + const recursive_directory_iterator&) = default; + + recursive_directory_iterator(recursive_directory_iterator&&) = default; + + ~recursive_directory_iterator(); + + // observers + directory_options options() const { return _M_options; } + int depth() const; + bool recursion_pending() const { return _M_pending; } + + const directory_entry& operator*() const; + const directory_entry* operator->() const { return &**this; } + + // modifiers + recursive_directory_iterator& + operator=(const recursive_directory_iterator& __rhs) noexcept; + recursive_directory_iterator& + operator=(recursive_directory_iterator&& __rhs) noexcept; + + recursive_directory_iterator& operator++(); + recursive_directory_iterator& increment(error_code& __ec) noexcept; + + __directory_iterator_proxy operator++(int) + { + __directory_iterator_proxy __pr{**this}; + ++*this; + return __pr; + } + + void pop(); + void pop(error_code&); + + void disable_recursion_pending() { _M_pending = false; } + + private: + recursive_directory_iterator(const path&, directory_options, error_code*); + + friend bool + operator==(const recursive_directory_iterator& __lhs, + const recursive_directory_iterator& __rhs); + + struct _Dir_stack; + std::shared_ptr<_Dir_stack> _M_dirs; + directory_options _M_options = {}; + bool _M_pending = false; + }; + + inline recursive_directory_iterator + begin(recursive_directory_iterator __iter) noexcept + { return __iter; } + + inline recursive_directory_iterator + end(recursive_directory_iterator) noexcept + { return recursive_directory_iterator(); } + + inline bool + operator==(const recursive_directory_iterator& __lhs, + const recursive_directory_iterator& __rhs) + { + return !__rhs._M_dirs.owner_before(__lhs._M_dirs) + && !__lhs._M_dirs.owner_before(__rhs._M_dirs); + } + + inline bool + operator!=(const recursive_directory_iterator& __lhs, + const recursive_directory_iterator& __rhs) + { return !(__lhs == __rhs); } + +_GLIBCXX_END_NAMESPACE_CXX11 + + // @} group filesystem +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace v1 +} // namespace filesystem +} // namespace experimental +} // namespace std + +#endif // C++11 + +#endif // _GLIBCXX_EXPERIMENTAL_FS_DIR_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/fs_fwd.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/fs_fwd.h new file mode 100644 index 0000000..3ec327e --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/fs_fwd.h @@ -0,0 +1,293 @@ +// Filesystem declarations -*- C++ -*- + +// Copyright (C) 2014-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file experimental/bits/fs_fwd.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{experimental/filesystem} + */ + +#ifndef _GLIBCXX_EXPERIMENTAL_FS_FWD_H +#define _GLIBCXX_EXPERIMENTAL_FS_FWD_H 1 + +#if __cplusplus < 201103L +# include +#else + +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace experimental +{ +namespace filesystem +{ +inline namespace v1 +{ +#if _GLIBCXX_INLINE_VERSION +inline namespace __7 { } +#endif +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#if _GLIBCXX_USE_CXX11_ABI +inline namespace __cxx11 __attribute__((__abi_tag__ ("cxx11"))) { } +#endif + + /** + * @defgroup filesystem Filesystem + * @ingroup experimental + * + * Utilities for performing operations on file systems and their components, + * such as paths, regular files, and directories. + * + * @{ + */ + + class file_status; +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + class path; + class filesystem_error; + class directory_entry; + class directory_iterator; + class recursive_directory_iterator; +_GLIBCXX_END_NAMESPACE_CXX11 + + struct space_info + { + uintmax_t capacity; + uintmax_t free; + uintmax_t available; + }; + + enum class file_type : signed char { + none = 0, not_found = -1, regular = 1, directory = 2, symlink = 3, + block = 4, character = 5, fifo = 6, socket = 7, unknown = 8 + }; + + /// Bitmask type + enum class copy_options : unsigned short { + none = 0, + skip_existing = 1, overwrite_existing = 2, update_existing = 4, + recursive = 8, + copy_symlinks = 16, skip_symlinks = 32, + directories_only = 64, create_symlinks = 128, create_hard_links = 256 + }; + + constexpr copy_options + operator&(copy_options __x, copy_options __y) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) & static_cast<__utype>(__y)); + } + + constexpr copy_options + operator|(copy_options __x, copy_options __y) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) | static_cast<__utype>(__y)); + } + + constexpr copy_options + operator^(copy_options __x, copy_options __y) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) ^ static_cast<__utype>(__y)); + } + + constexpr copy_options + operator~(copy_options __x) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast(~static_cast<__utype>(__x)); + } + + inline copy_options& + operator&=(copy_options& __x, copy_options __y) noexcept + { return __x = __x & __y; } + + inline copy_options& + operator|=(copy_options& __x, copy_options __y) noexcept + { return __x = __x | __y; } + + inline copy_options& + operator^=(copy_options& __x, copy_options __y) noexcept + { return __x = __x ^ __y; } + + + /// Bitmask type + enum class perms : unsigned { + none = 0, + owner_read = 0400, + owner_write = 0200, + owner_exec = 0100, + owner_all = 0700, + group_read = 040, + group_write = 020, + group_exec = 010, + group_all = 070, + others_read = 04, + others_write = 02, + others_exec = 01, + others_all = 07, + all = 0777, + set_uid = 04000, + set_gid = 02000, + sticky_bit = 01000, + mask = 07777, + unknown = 0xFFFF, + add_perms = 0x10000, + remove_perms = 0x20000, + symlink_nofollow = 0x40000 + }; + + constexpr perms + operator&(perms __x, perms __y) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) & static_cast<__utype>(__y)); + } + + constexpr perms + operator|(perms __x, perms __y) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) | static_cast<__utype>(__y)); + } + + constexpr perms + operator^(perms __x, perms __y) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) ^ static_cast<__utype>(__y)); + } + + constexpr perms + operator~(perms __x) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast(~static_cast<__utype>(__x)); + } + + inline perms& + operator&=(perms& __x, perms __y) noexcept + { return __x = __x & __y; } + + inline perms& + operator|=(perms& __x, perms __y) noexcept + { return __x = __x | __y; } + + inline perms& + operator^=(perms& __x, perms __y) noexcept + { return __x = __x ^ __y; } + + // Bitmask type + enum class directory_options : unsigned char { + none = 0, follow_directory_symlink = 1, skip_permission_denied = 2 + }; + + constexpr directory_options + operator&(directory_options __x, directory_options __y) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) & static_cast<__utype>(__y)); + } + + constexpr directory_options + operator|(directory_options __x, directory_options __y) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) | static_cast<__utype>(__y)); + } + + constexpr directory_options + operator^(directory_options __x, directory_options __y) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast( + static_cast<__utype>(__x) ^ static_cast<__utype>(__y)); + } + + constexpr directory_options + operator~(directory_options __x) noexcept + { + using __utype = typename std::underlying_type::type; + return static_cast(~static_cast<__utype>(__x)); + } + + inline directory_options& + operator&=(directory_options& __x, directory_options __y) noexcept + { return __x = __x & __y; } + + inline directory_options& + operator|=(directory_options& __x, directory_options __y) noexcept + { return __x = __x | __y; } + + inline directory_options& + operator^=(directory_options& __x, directory_options __y) noexcept + { return __x = __x ^ __y; } + + using file_time_type = std::chrono::system_clock::time_point; + + // operational functions + + void copy(const path& __from, const path& __to, copy_options __options); + void copy(const path& __from, const path& __to, copy_options __options, + error_code&) noexcept; + + bool copy_file(const path& __from, const path& __to, copy_options __option); + bool copy_file(const path& __from, const path& __to, copy_options __option, + error_code&) noexcept; + + path current_path(); + + file_status status(const path&); + file_status status(const path&, error_code&) noexcept; + + bool status_known(file_status) noexcept; + + file_status symlink_status(const path&); + file_status symlink_status(const path&, error_code&) noexcept; + + bool is_regular_file(file_status) noexcept; + bool is_symlink(file_status) noexcept; + + // @} group filesystem +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace v1 +} // namespace filesystem +} // namespace experimental +} // namespace std + +#endif // C++11 + +#endif // _GLIBCXX_EXPERIMENTAL_FS_FWD_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/fs_ops.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/fs_ops.h new file mode 100644 index 0000000..11be712 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/fs_ops.h @@ -0,0 +1,300 @@ +// Filesystem operational functions -*- C++ -*- + +// Copyright (C) 2014-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your __option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file experimental/bits/fs_fwd.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{experimental/filesystem} + */ + +#ifndef _GLIBCXX_EXPERIMENTAL_FS_OPS_H +#define _GLIBCXX_EXPERIMENTAL_FS_OPS_H 1 + +#if __cplusplus < 201103L +# include +#else + +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace experimental +{ +namespace filesystem +{ +inline namespace v1 +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @ingroup filesystem + * @{ + */ + + path absolute(const path& __p, const path& __base = current_path()); + + path canonical(const path& __p, const path& __base = current_path()); + path canonical(const path& __p, error_code& __ec); + path canonical(const path& __p, const path& __base, error_code& __ec); + + inline void + copy(const path& __from, const path& __to) + { copy(__from, __to, copy_options::none); } + + inline void + copy(const path& __from, const path& __to, error_code& __ec) noexcept + { copy(__from, __to, copy_options::none, __ec); } + + void copy(const path& __from, const path& __to, copy_options __options); + void copy(const path& __from, const path& __to, copy_options __options, + error_code& __ec) noexcept; + + inline bool + copy_file(const path& __from, const path& __to) + { return copy_file(__from, __to, copy_options::none); } + + inline bool + copy_file(const path& __from, const path& __to, error_code& __ec) noexcept + { return copy_file(__from, __to, copy_options::none, __ec); } + + bool copy_file(const path& __from, const path& __to, copy_options __option); + bool copy_file(const path& __from, const path& __to, copy_options __option, + error_code& __ec) noexcept; + + void copy_symlink(const path& __existing_symlink, const path& __new_symlink); + void copy_symlink(const path& __existing_symlink, const path& __new_symlink, + error_code& __ec) noexcept; + + bool create_directories(const path& __p); + bool create_directories(const path& __p, error_code& __ec) noexcept; + + bool create_directory(const path& __p); + bool create_directory(const path& __p, error_code& __ec) noexcept; + + bool create_directory(const path& __p, const path& attributes); + bool create_directory(const path& __p, const path& attributes, + error_code& __ec) noexcept; + + void create_directory_symlink(const path& __to, const path& __new_symlink); + void create_directory_symlink(const path& __to, const path& __new_symlink, + error_code& __ec) noexcept; + + void create_hard_link(const path& __to, const path& __new_hard_link); + void create_hard_link(const path& __to, const path& __new_hard_link, + error_code& __ec) noexcept; + + void create_symlink(const path& __to, const path& __new_symlink); + void create_symlink(const path& __to, const path& __new_symlink, + error_code& __ec) noexcept; + + path current_path(); + path current_path(error_code& __ec); + void current_path(const path& __p); + void current_path(const path& __p, error_code& __ec) noexcept; + + bool + equivalent(const path& __p1, const path& __p2); + + bool + equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept; + + inline bool + exists(file_status __s) noexcept + { return status_known(__s) && __s.type() != file_type::not_found; } + + inline bool + exists(const path& __p) + { return exists(status(__p)); } + + inline bool + exists(const path& __p, error_code& __ec) noexcept + { + auto __s = status(__p, __ec); + if (status_known(__s)) + { + __ec.clear(); + return __s.type() != file_type::not_found; + } + return false; + } + + uintmax_t file_size(const path& __p); + uintmax_t file_size(const path& __p, error_code& __ec) noexcept; + + uintmax_t hard_link_count(const path& __p); + uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept; + + inline bool + is_block_file(file_status __s) noexcept + { return __s.type() == file_type::block; } + + inline bool + is_block_file(const path& __p) + { return is_block_file(status(__p)); } + + inline bool + is_block_file(const path& __p, error_code& __ec) noexcept + { return is_block_file(status(__p, __ec)); } + + inline bool + is_character_file(file_status __s) noexcept + { return __s.type() == file_type::character; } + + inline bool + is_character_file(const path& __p) + { return is_character_file(status(__p)); } + + inline bool + is_character_file(const path& __p, error_code& __ec) noexcept + { return is_character_file(status(__p, __ec)); } + + inline bool + is_directory(file_status __s) noexcept + { return __s.type() == file_type::directory; } + + inline bool + is_directory(const path& __p) + { return is_directory(status(__p)); } + + inline bool + is_directory(const path& __p, error_code& __ec) noexcept + { return is_directory(status(__p, __ec)); } + + bool is_empty(const path& __p); + bool is_empty(const path& __p, error_code& __ec) noexcept; + + inline bool + is_fifo(file_status __s) noexcept + { return __s.type() == file_type::fifo; } + + inline bool + is_fifo(const path& __p) + { return is_fifo(status(__p)); } + + inline bool + is_fifo(const path& __p, error_code& __ec) noexcept + { return is_fifo(status(__p, __ec)); } + + inline bool + is_other(file_status __s) noexcept + { + return exists(__s) && !is_regular_file(__s) && !is_directory(__s) + && !is_symlink(__s); + } + + inline bool + is_other(const path& __p) + { return is_other(status(__p)); } + + inline bool + is_other(const path& __p, error_code& __ec) noexcept + { return is_other(status(__p, __ec)); } + + inline bool + is_regular_file(file_status __s) noexcept + { return __s.type() == file_type::regular; } + + inline bool + is_regular_file(const path& __p) + { return is_regular_file(status(__p)); } + + inline bool + is_regular_file(const path& __p, error_code& __ec) noexcept + { return is_regular_file(status(__p, __ec)); } + + inline bool + is_socket(file_status __s) noexcept + { return __s.type() == file_type::socket; } + + inline bool + is_socket(const path& __p) + { return is_socket(status(__p)); } + + inline bool + is_socket(const path& __p, error_code& __ec) noexcept + { return is_socket(status(__p, __ec)); } + + inline bool + is_symlink(file_status __s) noexcept + { return __s.type() == file_type::symlink; } + + inline bool + is_symlink(const path& __p) + { return is_symlink(symlink_status(__p)); } + + inline bool + is_symlink(const path& __p, error_code& __ec) noexcept + { return is_symlink(symlink_status(__p, __ec)); } + + file_time_type last_write_time(const path& __p); + file_time_type last_write_time(const path& __p, error_code& __ec) noexcept; + void last_write_time(const path& __p, file_time_type __new_time); + void last_write_time(const path& __p, file_time_type __new_time, + error_code& __ec) noexcept; + + void permissions(const path& __p, perms __prms); + void permissions(const path& __p, perms __prms, error_code& __ec) noexcept; + + path read_symlink(const path& __p); + path read_symlink(const path& __p, error_code& __ec); + + bool remove(const path& __p); + bool remove(const path& __p, error_code& __ec) noexcept; + + uintmax_t remove_all(const path& __p); + uintmax_t remove_all(const path& __p, error_code& __ec) noexcept; + + void rename(const path& __from, const path& __to); + void rename(const path& __from, const path& __to, error_code& __ec) noexcept; + + void resize_file(const path& __p, uintmax_t __size); + void resize_file(const path& __p, uintmax_t __size, error_code& __ec) noexcept; + + space_info space(const path& __p); + space_info space(const path& __p, error_code& __ec) noexcept; + + file_status status(const path& __p); + file_status status(const path& __p, error_code& __ec) noexcept; + + inline bool status_known(file_status __s) noexcept + { return __s.type() != file_type::none; } + + file_status symlink_status(const path& __p); + file_status symlink_status(const path& __p, error_code& __ec) noexcept; + + path system_complete(const path& __p); + path system_complete(const path& __p, error_code& __ec); + + path temp_directory_path(); + path temp_directory_path(error_code& __ec); + + // @} group filesystem +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace v1 +} // namespace filesystem +} // namespace experimental +} // namespace std + +#endif // C++11 + +#endif // _GLIBCXX_EXPERIMENTAL_FS_OPS_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/fs_path.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/fs_path.h new file mode 100644 index 0000000..512167f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/fs_path.h @@ -0,0 +1,1091 @@ +// Class filesystem::path -*- C++ -*- + +// Copyright (C) 2014-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file experimental/bits/fs_path.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{experimental/filesystem} + */ + +#ifndef _GLIBCXX_EXPERIMENTAL_FS_PATH_H +#define _GLIBCXX_EXPERIMENTAL_FS_PATH_H 1 + +#if __cplusplus < 201103L +# include +#else + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if __cplusplus == 201402L +# include +#endif + +#if defined(_WIN32) && !defined(__CYGWIN__) +# define _GLIBCXX_FILESYSTEM_IS_WINDOWS 1 +# include +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace experimental +{ +namespace filesystem +{ +inline namespace v1 +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION +_GLIBCXX_BEGIN_NAMESPACE_CXX11 + +#if __cplusplus == 201402L + using std::experimental::basic_string_view; +#elif __cplusplus > 201402L + using std::basic_string_view; +#endif + + /** + * @ingroup filesystem + * @{ + */ + + /// A filesystem path. + class path + { + template + struct __is_encoded_char : std::false_type { }; + + template> + using __is_path_iter_src + = __and_<__is_encoded_char, + std::is_base_of>; + + template + static __is_path_iter_src<_Iter> + __is_path_src(_Iter, int); + + template + static __is_encoded_char<_CharT> + __is_path_src(const basic_string<_CharT, _Traits, _Alloc>&, int); + +#if __cplusplus >= 201402L + template + static __is_encoded_char<_CharT> + __is_path_src(const basic_string_view<_CharT, _Traits>&, int); +#endif + + template + static std::false_type + __is_path_src(const _Unknown&, ...); + + template + struct __constructible_from; + + template + struct __constructible_from<_Iter, _Iter> + : __is_path_iter_src<_Iter> + { }; + + template + struct __constructible_from<_Source, void> + : decltype(__is_path_src(std::declval<_Source>(), 0)) + { }; + + template + using _Path = typename + std::enable_if<__and_<__not_>, + __constructible_from<_Tp1, _Tp2>>::value, + path>::type; + + template + static _Source + _S_range_begin(_Source __begin) { return __begin; } + + struct __null_terminated { }; + + template + static __null_terminated + _S_range_end(_Source) { return {}; } + + template + static const _CharT* + _S_range_begin(const basic_string<_CharT, _Traits, _Alloc>& __str) + { return __str.data(); } + + template + static const _CharT* + _S_range_end(const basic_string<_CharT, _Traits, _Alloc>& __str) + { return __str.data() + __str.size(); } + +#if __cplusplus >= 201402L + template + static const _CharT* + _S_range_begin(const basic_string_view<_CharT, _Traits>& __str) + { return __str.data(); } + + template + static const _CharT* + _S_range_end(const basic_string_view<_CharT, _Traits>& __str) + { return __str.data() + __str.size(); } +#endif + + template())), + typename _Val = typename std::iterator_traits<_Iter>::value_type> + using __value_type_is_char + = typename std::enable_if::value>::type; + + public: +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + typedef wchar_t value_type; + static constexpr value_type preferred_separator = L'\\'; +#else + typedef char value_type; + static constexpr value_type preferred_separator = '/'; +#endif + typedef std::basic_string string_type; + + // constructors and destructor + + path() noexcept { } + + path(const path& __p) = default; + + path(path&& __p) noexcept + : _M_pathname(std::move(__p._M_pathname)), _M_type(__p._M_type) + { + _M_split_cmpts(); + __p.clear(); + } + + path(string_type&& __source) + : _M_pathname(std::move(__source)) + { _M_split_cmpts(); } + + template> + path(_Source const& __source) + : _M_pathname(_S_convert(_S_range_begin(__source), + _S_range_end(__source))) + { _M_split_cmpts(); } + + template> + path(_InputIterator __first, _InputIterator __last) + : _M_pathname(_S_convert(__first, __last)) + { _M_split_cmpts(); } + + template, + typename _Require2 = __value_type_is_char<_Source>> + path(_Source const& __source, const locale& __loc) + : _M_pathname(_S_convert_loc(_S_range_begin(__source), + _S_range_end(__source), __loc)) + { _M_split_cmpts(); } + + template, + typename _Require2 = __value_type_is_char<_InputIterator>> + path(_InputIterator __first, _InputIterator __last, const locale& __loc) + : _M_pathname(_S_convert_loc(__first, __last, __loc)) + { _M_split_cmpts(); } + + ~path() = default; + + // assignments + + path& operator=(const path& __p) = default; + path& operator=(path&& __p) noexcept; + path& operator=(string_type&& __source); + path& assign(string_type&& __source); + + template + _Path<_Source>& + operator=(_Source const& __source) + { return *this = path(__source); } + + template + _Path<_Source>& + assign(_Source const& __source) + { return *this = path(__source); } + + template + _Path<_InputIterator, _InputIterator>& + assign(_InputIterator __first, _InputIterator __last) + { return *this = path(__first, __last); } + + // appends + + path& operator/=(const path& __p) { return _M_append(__p._M_pathname); } + + template + _Path<_Source>& + operator/=(_Source const& __source) + { return append(__source); } + + template + _Path<_Source>& + append(_Source const& __source) + { + return _M_append(_S_convert(_S_range_begin(__source), + _S_range_end(__source))); + } + + template + _Path<_InputIterator, _InputIterator>& + append(_InputIterator __first, _InputIterator __last) + { return _M_append(_S_convert(__first, __last)); } + + // concatenation + + path& operator+=(const path& __x); + path& operator+=(const string_type& __x); + path& operator+=(const value_type* __x); + path& operator+=(value_type __x); +#if __cplusplus >= 201402L + path& operator+=(basic_string_view __x); +#endif + + template + _Path<_Source>& + operator+=(_Source const& __x) { return concat(__x); } + + template + _Path<_CharT*, _CharT*>& + operator+=(_CharT __x); + + template + _Path<_Source>& + concat(_Source const& __x) + { return *this += _S_convert(_S_range_begin(__x), _S_range_end(__x)); } + + template + _Path<_InputIterator, _InputIterator>& + concat(_InputIterator __first, _InputIterator __last) + { return *this += _S_convert(__first, __last); } + + // modifiers + + void clear() noexcept { _M_pathname.clear(); _M_split_cmpts(); } + + path& make_preferred(); + path& remove_filename(); + path& replace_filename(const path& __replacement); + path& replace_extension(const path& __replacement = path()); + + void swap(path& __rhs) noexcept; + + // native format observers + + const string_type& native() const noexcept { return _M_pathname; } + const value_type* c_str() const noexcept { return _M_pathname.c_str(); } + operator string_type() const { return _M_pathname; } + + template, + typename _Allocator = std::allocator<_CharT>> + std::basic_string<_CharT, _Traits, _Allocator> + string(const _Allocator& __a = _Allocator()) const; + + std::string string() const; +#if _GLIBCXX_USE_WCHAR_T + std::wstring wstring() const; +#endif + std::string u8string() const; + std::u16string u16string() const; + std::u32string u32string() const; + + // generic format observers + template, + typename _Allocator = std::allocator<_CharT>> + std::basic_string<_CharT, _Traits, _Allocator> + generic_string(const _Allocator& __a = _Allocator()) const; + + std::string generic_string() const; +#if _GLIBCXX_USE_WCHAR_T + std::wstring generic_wstring() const; +#endif + std::string generic_u8string() const; + std::u16string generic_u16string() const; + std::u32string generic_u32string() const; + + // compare + + int compare(const path& __p) const noexcept; + int compare(const string_type& __s) const; + int compare(const value_type* __s) const; +#if __cplusplus >= 201402L + int compare(const basic_string_view __s) const; +#endif + + // decomposition + + path root_name() const; + path root_directory() const; + path root_path() const; + path relative_path() const; + path parent_path() const; + path filename() const; + path stem() const; + path extension() const; + + // query + + bool empty() const noexcept { return _M_pathname.empty(); } + bool has_root_name() const; + bool has_root_directory() const; + bool has_root_path() const; + bool has_relative_path() const; + bool has_parent_path() const; + bool has_filename() const; + bool has_stem() const; + bool has_extension() const; + bool is_absolute() const; + bool is_relative() const { return !is_absolute(); } + + // iterators + class iterator; + typedef iterator const_iterator; + + iterator begin() const; + iterator end() const; + + private: + enum class _Type : unsigned char { + _Multi, _Root_name, _Root_dir, _Filename + }; + + path(string_type __str, _Type __type) : _M_pathname(__str), _M_type(__type) + { + __glibcxx_assert(!empty()); + __glibcxx_assert(_M_type != _Type::_Multi); + } + + enum class _Split { _Stem, _Extension }; + + path& _M_append(const string_type& __str) + { + if (!_M_pathname.empty() && !_S_is_dir_sep(_M_pathname.back()) + && !__str.empty() && !_S_is_dir_sep(__str.front())) + _M_pathname += preferred_separator; + _M_pathname += __str; + _M_split_cmpts(); + return *this; + } + + pair _M_find_extension() const; + + template + struct _Cvt; + + static string_type + _S_convert(value_type* __src, __null_terminated) + { return string_type(__src); } + + static string_type + _S_convert(const value_type* __src, __null_terminated) + { return string_type(__src); } + + template + static string_type + _S_convert(_Iter __first, _Iter __last) + { + using __value_type = typename std::iterator_traits<_Iter>::value_type; + return _Cvt::type>:: + _S_convert(__first, __last); + } + + template + static string_type + _S_convert(_InputIterator __src, __null_terminated) + { + using _Tp = typename std::iterator_traits<_InputIterator>::value_type; + std::basic_string::type> __tmp; + for (; *__src != _Tp{}; ++__src) + __tmp.push_back(*__src); + return _S_convert(__tmp.c_str(), __tmp.c_str() + __tmp.size()); + } + + static string_type + _S_convert_loc(const char* __first, const char* __last, + const std::locale& __loc); + + template + static string_type + _S_convert_loc(_Iter __first, _Iter __last, const std::locale& __loc) + { + const std::string __str(__first, __last); + return _S_convert_loc(__str.data(), __str.data()+__str.size(), __loc); + } + + template + static string_type + _S_convert_loc(_InputIterator __src, __null_terminated, + const std::locale& __loc) + { + std::string __tmp; + while (*__src != '\0') + __tmp.push_back(*__src++); + return _S_convert_loc(__tmp.data(), __tmp.data()+__tmp.size(), __loc); + } + + bool _S_is_dir_sep(value_type __ch) + { +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + return __ch == L'/' || __ch == preferred_separator; +#else + return __ch == '/'; +#endif + } + + void _M_split_cmpts(); + void _M_trim(); + void _M_add_root_name(size_t __n); + void _M_add_root_dir(size_t __pos); + void _M_add_filename(size_t __pos, size_t __n); + + string_type _M_pathname; + + struct _Cmpt; + using _List = _GLIBCXX_STD_C::vector<_Cmpt>; + _List _M_cmpts; // empty unless _M_type == _Type::_Multi + _Type _M_type = _Type::_Multi; + }; + + inline void swap(path& __lhs, path& __rhs) noexcept { __lhs.swap(__rhs); } + + size_t hash_value(const path& __p) noexcept; + + /// Compare paths + inline bool operator<(const path& __lhs, const path& __rhs) noexcept + { return __lhs.compare(__rhs) < 0; } + + /// Compare paths + inline bool operator<=(const path& __lhs, const path& __rhs) noexcept + { return !(__rhs < __lhs); } + + /// Compare paths + inline bool operator>(const path& __lhs, const path& __rhs) noexcept + { return __rhs < __lhs; } + + /// Compare paths + inline bool operator>=(const path& __lhs, const path& __rhs) noexcept + { return !(__lhs < __rhs); } + + /// Compare paths + inline bool operator==(const path& __lhs, const path& __rhs) noexcept + { return __lhs.compare(__rhs) == 0; } + + /// Compare paths + inline bool operator!=(const path& __lhs, const path& __rhs) noexcept + { return !(__lhs == __rhs); } + + /// Append one path to another + inline path operator/(const path& __lhs, const path& __rhs) + { return path(__lhs) /= __rhs; } + + /// Write a path to a stream + template + basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) + { + auto __tmp = __p.string<_CharT, _Traits>(); + using __quoted_string + = std::__detail::_Quoted_string; + __os << __quoted_string{__tmp, '"', '\\'}; + return __os; + } + + /// Read a path from a stream + template + basic_istream<_CharT, _Traits>& + operator>>(basic_istream<_CharT, _Traits>& __is, path& __p) + { + basic_string<_CharT, _Traits> __tmp; + using __quoted_string + = std::__detail::_Quoted_string; + if (__is >> __quoted_string{ __tmp, '"', '\\' }) + __p = std::move(__tmp); + return __is; + } + + // TODO constrain with _Path and __value_type_is_char + template + inline path + u8path(const _Source& __source) + { +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + return path{ path::string_type{__source} }; +#else + return path{ __source }; +#endif + } + + // TODO constrain with _Path and __value_type_is_char + template + inline path + u8path(_InputIterator __first, _InputIterator __last) + { +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + return path{ path::string_type{__first, __last} }; +#else + return path{ __first, __last }; +#endif + } + + class filesystem_error : public std::system_error + { + public: + filesystem_error(const string& __what_arg, error_code __ec) + : system_error(__ec, __what_arg) { } + + filesystem_error(const string& __what_arg, const path& __p1, + error_code __ec) + : system_error(__ec, __what_arg), _M_path1(__p1) { } + + filesystem_error(const string& __what_arg, const path& __p1, + const path& __p2, error_code __ec) + : system_error(__ec, __what_arg), _M_path1(__p1), _M_path2(__p2) + { } + + ~filesystem_error(); + + const path& path1() const noexcept { return _M_path1; } + const path& path2() const noexcept { return _M_path2; } + const char* what() const noexcept { return _M_what.c_str(); } + + private: + std::string _M_gen_what(); + + path _M_path1; + path _M_path2; + std::string _M_what = _M_gen_what(); + }; + + template<> + struct path::__is_encoded_char : std::true_type + { using value_type = char; }; + + template<> + struct path::__is_encoded_char : std::true_type + { using value_type = wchar_t; }; + + template<> + struct path::__is_encoded_char : std::true_type + { using value_type = char16_t; }; + + template<> + struct path::__is_encoded_char : std::true_type + { using value_type = char32_t; }; + + template + struct path::__is_encoded_char : __is_encoded_char<_Tp> { }; + + struct path::_Cmpt : path + { + _Cmpt(string_type __s, _Type __t, size_t __pos) + : path(std::move(__s), __t), _M_pos(__pos) { } + + _Cmpt() : _M_pos(-1) { } + + size_t _M_pos; + }; + + // specialize _Cvt for degenerate 'noconv' case + template<> + struct path::_Cvt + { + template + static string_type + _S_convert(_Iter __first, _Iter __last) + { return string_type{__first, __last}; } + }; + + template + struct path::_Cvt + { +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + static string_type + _S_wconvert(const char* __f, const char* __l, true_type) + { + using _Cvt = std::codecvt; + const auto& __cvt = std::use_facet<_Cvt>(std::locale{}); + std::wstring __wstr; + if (__str_codecvt_in(__f, __l, __wstr, __cvt)) + return __wstr; + _GLIBCXX_THROW_OR_ABORT(filesystem_error( + "Cannot convert character sequence", + std::make_error_code(errc::illegal_byte_sequence))); + } + + static string_type + _S_wconvert(const _CharT* __f, const _CharT* __l, false_type) + { + std::codecvt_utf8<_CharT> __cvt; + std::string __str; + if (__str_codecvt_out(__f, __l, __str, __cvt)) + { + const char* __f2 = __str.data(); + const char* __l2 = __f2 + __str.size(); + std::codecvt_utf8 __wcvt; + std::wstring __wstr; + if (__str_codecvt_in(__f2, __l2, __wstr, __wcvt)) + return __wstr; + } + _GLIBCXX_THROW_OR_ABORT(filesystem_error( + "Cannot convert character sequence", + std::make_error_code(errc::illegal_byte_sequence))); + } + + static string_type + _S_convert(const _CharT* __f, const _CharT* __l) + { + return _S_wconvert(__f, __l, is_same<_CharT, char>{}); + } +#else + static string_type + _S_convert(const _CharT* __f, const _CharT* __l) + { + std::codecvt_utf8<_CharT> __cvt; + std::string __str; + if (__str_codecvt_out(__f, __l, __str, __cvt)) + return __str; + _GLIBCXX_THROW_OR_ABORT(filesystem_error( + "Cannot convert character sequence", + std::make_error_code(errc::illegal_byte_sequence))); + } +#endif + + static string_type + _S_convert(_CharT* __f, _CharT* __l) + { + return _S_convert(const_cast(__f), + const_cast(__l)); + } + + template + static string_type + _S_convert(_Iter __first, _Iter __last) + { + const std::basic_string<_CharT> __str(__first, __last); + return _S_convert(__str.data(), __str.data() + __str.size()); + } + + template + static string_type + _S_convert(__gnu_cxx::__normal_iterator<_Iter, _Cont> __first, + __gnu_cxx::__normal_iterator<_Iter, _Cont> __last) + { return _S_convert(__first.base(), __last.base()); } + }; + + /// An iterator for the components of a path + class path::iterator + { + public: + using difference_type = std::ptrdiff_t; + using value_type = path; + using reference = const path&; + using pointer = const path*; + using iterator_category = std::bidirectional_iterator_tag; + + iterator() : _M_path(nullptr), _M_cur(), _M_at_end() { } + + iterator(const iterator&) = default; + iterator& operator=(const iterator&) = default; + + reference operator*() const; + pointer operator->() const { return std::__addressof(**this); } + + iterator& operator++(); + iterator operator++(int) { auto __tmp = *this; ++*this; return __tmp; } + + iterator& operator--(); + iterator operator--(int) { auto __tmp = *this; --*this; return __tmp; } + + friend bool operator==(const iterator& __lhs, const iterator& __rhs) + { return __lhs._M_equals(__rhs); } + + friend bool operator!=(const iterator& __lhs, const iterator& __rhs) + { return !__lhs._M_equals(__rhs); } + + private: + friend class path; + + iterator(const path* __path, path::_List::const_iterator __iter) + : _M_path(__path), _M_cur(__iter), _M_at_end() + { } + + iterator(const path* __path, bool __at_end) + : _M_path(__path), _M_cur(), _M_at_end(__at_end) + { } + + bool _M_equals(iterator) const; + + const path* _M_path; + path::_List::const_iterator _M_cur; + bool _M_at_end; // only used when type != _Multi + }; + + + inline path& + path::operator=(path&& __p) noexcept + { + _M_pathname = std::move(__p._M_pathname); + _M_cmpts = std::move(__p._M_cmpts); + _M_type = __p._M_type; + __p.clear(); + return *this; + } + + inline path& + path::operator=(string_type&& __source) + { return *this = path(std::move(__source)); } + + inline path& + path::assign(string_type&& __source) + { return *this = path(std::move(__source)); } + + inline path& + path::operator+=(const path& __p) + { + return operator+=(__p.native()); + } + + inline path& + path::operator+=(const string_type& __x) + { + _M_pathname += __x; + _M_split_cmpts(); + return *this; + } + + inline path& + path::operator+=(const value_type* __x) + { + _M_pathname += __x; + _M_split_cmpts(); + return *this; + } + + inline path& + path::operator+=(value_type __x) + { + _M_pathname += __x; + _M_split_cmpts(); + return *this; + } + +#if __cplusplus >= 201402L + inline path& + path::operator+=(basic_string_view __x) + { + _M_pathname.append(__x.data(), __x.size()); + _M_split_cmpts(); + return *this; + } +#endif + + template + inline path::_Path<_CharT*, _CharT*>& + path::operator+=(_CharT __x) + { + auto* __addr = std::__addressof(__x); + return concat(__addr, __addr + 1); + } + + inline path& + path::make_preferred() + { +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + std::replace(_M_pathname.begin(), _M_pathname.end(), L'/', + preferred_separator); +#endif + return *this; + } + + inline void path::swap(path& __rhs) noexcept + { + _M_pathname.swap(__rhs._M_pathname); + _M_cmpts.swap(__rhs._M_cmpts); + std::swap(_M_type, __rhs._M_type); + } + + template + inline std::basic_string<_CharT, _Traits, _Allocator> + path::string(const _Allocator& __a) const + { + if (is_same<_CharT, value_type>::value) + return { _M_pathname.begin(), _M_pathname.end(), __a }; + + const value_type* __first = _M_pathname.data(); + const value_type* __last = __first + _M_pathname.size(); + +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + using _CharAlloc = __alloc_rebind<_Allocator, char>; + using _String = basic_string, _CharAlloc>; + using _WString = basic_string<_CharT, _Traits, _Allocator>; + + // use codecvt_utf8 to convert native string to UTF-8 + codecvt_utf8 __cvt; + _String __u8str{_CharAlloc{__a}}; + if (__str_codecvt_out(__first, __last, __u8str, __cvt)) + { + struct + { + const _String* + operator()(const _String& __from, _String&, true_type) + { return std::__addressof(__from); } + + _WString* + operator()(const _String& __from, _WString& __to, false_type) + { + // use codecvt_utf8<_CharT> to convert UTF-8 to wide string + codecvt_utf8<_CharT> __cvt; + const char* __f = __from.data(); + const char* __l = __f + __from.size(); + if (__str_codecvt_in(__f, __l, __to, __cvt)) + return std::__addressof(__to); + return nullptr; + } + } __dispatch; + _WString __wstr; + if (auto* __p = __dispatch(__u8str, __wstr, is_same<_CharT, char>{})) + return *__p; + } +#else + codecvt_utf8<_CharT> __cvt; + basic_string<_CharT, _Traits, _Allocator> __wstr{__a}; + if (__str_codecvt_in(__first, __last, __wstr, __cvt)) + return __wstr; +#endif + _GLIBCXX_THROW_OR_ABORT(filesystem_error( + "Cannot convert character sequence", + std::make_error_code(errc::illegal_byte_sequence))); + } + + inline std::string + path::string() const { return string(); } + +#if _GLIBCXX_USE_WCHAR_T + inline std::wstring + path::wstring() const { return string(); } +#endif + + inline std::string + path::u8string() const + { +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + std::string __str; + // convert from native encoding to UTF-8 + codecvt_utf8 __cvt; + const value_type* __first = _M_pathname.data(); + const value_type* __last = __first + _M_pathname.size(); + if (__str_codecvt_out(__first, __last, __str, __cvt)) + return __str; + _GLIBCXX_THROW_OR_ABORT(filesystem_error( + "Cannot convert character sequence", + std::make_error_code(errc::illegal_byte_sequence))); +#else + return _M_pathname; +#endif + } + + inline std::u16string + path::u16string() const { return string(); } + + inline std::u32string + path::u32string() const { return string(); } + +#ifndef _GLIBCXX_FILESYSTEM_IS_WINDOWS + template + inline std::basic_string<_CharT, _Traits, _Allocator> + path::generic_string(const _Allocator& __a) const + { return string<_CharT, _Traits, _Allocator>(__a); } + + inline std::string + path::generic_string() const { return string(); } + +#if _GLIBCXX_USE_WCHAR_T + inline std::wstring + path::generic_wstring() const { return wstring(); } +#endif + + inline std::string + path::generic_u8string() const { return u8string(); } + + inline std::u16string + path::generic_u16string() const { return u16string(); } + + inline std::u32string + path::generic_u32string() const { return u32string(); } +#endif + + inline int + path::compare(const string_type& __s) const { return compare(path(__s)); } + + inline int + path::compare(const value_type* __s) const { return compare(path(__s)); } + +#if __cplusplus >= 201402L + inline int + path::compare(basic_string_view __s) const + { return compare(path(__s)); } +#endif + + inline path + path::filename() const { return empty() ? path() : *--end(); } + + inline path + path::stem() const + { + auto ext = _M_find_extension(); + if (ext.first && ext.second != 0) + return path{ext.first->substr(0, ext.second)}; + return {}; + } + + inline path + path::extension() const + { + auto ext = _M_find_extension(); + if (ext.first && ext.second != string_type::npos) + return path{ext.first->substr(ext.second)}; + return {}; + } + + inline bool + path::has_stem() const + { + auto ext = _M_find_extension(); + return ext.first && ext.second != 0; + } + + inline bool + path::has_extension() const + { + auto ext = _M_find_extension(); + return ext.first && ext.second != string_type::npos; + } + + inline bool + path::is_absolute() const + { +#ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS + return has_root_name(); +#else + return has_root_directory(); +#endif + } + + inline path::iterator + path::begin() const + { + if (_M_type == _Type::_Multi) + return iterator(this, _M_cmpts.begin()); + return iterator(this, false); + } + + inline path::iterator + path::end() const + { + if (_M_type == _Type::_Multi) + return iterator(this, _M_cmpts.end()); + return iterator(this, true); + } + + inline path::iterator& + path::iterator::operator++() + { + __glibcxx_assert(_M_path != nullptr); + if (_M_path->_M_type == _Type::_Multi) + { + __glibcxx_assert(_M_cur != _M_path->_M_cmpts.end()); + ++_M_cur; + } + else + { + __glibcxx_assert(!_M_at_end); + _M_at_end = true; + } + return *this; + } + + inline path::iterator& + path::iterator::operator--() + { + __glibcxx_assert(_M_path != nullptr); + if (_M_path->_M_type == _Type::_Multi) + { + __glibcxx_assert(_M_cur != _M_path->_M_cmpts.begin()); + --_M_cur; + } + else + { + __glibcxx_assert(_M_at_end); + _M_at_end = false; + } + return *this; + } + + inline path::iterator::reference + path::iterator::operator*() const + { + __glibcxx_assert(_M_path != nullptr); + if (_M_path->_M_type == _Type::_Multi) + { + __glibcxx_assert(_M_cur != _M_path->_M_cmpts.end()); + return *_M_cur; + } + return *_M_path; + } + + inline bool + path::iterator::_M_equals(iterator __rhs) const + { + if (_M_path != __rhs._M_path) + return false; + if (_M_path == nullptr) + return true; + if (_M_path->_M_type == path::_Type::_Multi) + return _M_cur == __rhs._M_cur; + return _M_at_end == __rhs._M_at_end; + } + + // @} group filesystem +_GLIBCXX_END_NAMESPACE_CXX11 +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace v1 +} // namespace filesystem +} // namespace experimental +} // namespace std + +#endif // C++11 + +#endif // _GLIBCXX_EXPERIMENTAL_FS_PATH_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/lfts_config.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/lfts_config.h new file mode 100644 index 0000000..a9faa47 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/lfts_config.h @@ -0,0 +1,64 @@ +// Namespace declarations for Library Fundamentals TS -*- C++ -*- + +// Copyright (C) 2016-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file experimental/bits/lfts_config.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. + */ + +#if __cplusplus <= 201103L +# include +#else +#include + +#if _GLIBCXX_INLINE_VERSION +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace chrono +{ +namespace experimental +{ +inline namespace fundamentals_v1 { inline namespace __7 { } } +inline namespace fundamentals_v2 { inline namespace __7 { } } +} // namespace experimental +} // namespace chrono + +namespace experimental +{ +inline namespace fundamentals_v1 { + inline namespace __7 { } + namespace __detail { inline namespace __7 { } } +} +inline namespace fundamentals_v2 { + inline namespace __7 { } + namespace pmr { inline namespace __7 { } } + namespace __detail { inline namespace __7 { } } +} // namespace fundamentals_v2 +inline namespace literals { inline namespace string_view_literals { + inline namespace __7 { } +} } // namespace literals::string_view_literals +} // namespace experimental +} // namespace std +#endif +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/shared_ptr.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/shared_ptr.h new file mode 100644 index 0000000..27f22d2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/experimental/bits/shared_ptr.h @@ -0,0 +1,684 @@ +// Experimental shared_ptr with array support -*- C++ -*- + +// Copyright (C) 2015-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file experimental/bits/shared_ptr.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{experimental/memory} + */ + +#ifndef _GLIBCXX_EXPERIMENTAL_SHARED_PTR_H +#define _GLIBCXX_EXPERIMENTAL_SHARED_PTR_H 1 + +#pragma GCC system_header + +#if __cplusplus <= 201103L +# include +#else + +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace experimental +{ +inline namespace fundamentals_v2 +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // 8.2.1 + + template class shared_ptr; + template class weak_ptr; + template class enable_shared_from_this; + + template + constexpr bool __sp_compatible_v + = std::__sp_compatible_with<_Yp*, _Tp*>::value; + + template + constexpr bool __sp_is_constructible_v + = std::__sp_is_constructible<_Tp, _Yp>::value; + + template + class shared_ptr : public __shared_ptr<_Tp> + { + using _Base_type = __shared_ptr<_Tp>; + + public: + using element_type = typename _Base_type::element_type; + + private: + // Constraint for construction from a pointer of type _Yp*: + template + using _SafeConv = enable_if_t<__sp_is_constructible_v<_Tp, _Yp>>; + + template + using _Compatible + = enable_if_t<__sp_compatible_v<_Tp1, _Tp>, _Res>; + + template::pointer, + typename _Res = void> + using _UniqCompatible = enable_if_t< + __sp_compatible_v<_Tp1, _Tp> + && experimental::is_convertible_v<_Ptr, element_type*>, + _Res>; + + public: + + // 8.2.1.1, shared_ptr constructors + constexpr shared_ptr() noexcept = default; + + template> + explicit + shared_ptr(_Tp1* __p) : _Base_type(__p) + { _M_enable_shared_from_this_with(__p); } + + template> + shared_ptr(_Tp1* __p, _Deleter __d) + : _Base_type(__p, __d) + { _M_enable_shared_from_this_with(__p); } + + template> + shared_ptr(_Tp1* __p, _Deleter __d, _Alloc __a) + : _Base_type(__p, __d, __a) + { _M_enable_shared_from_this_with(__p); } + + template + shared_ptr(nullptr_t __p, _Deleter __d) + : _Base_type(__p, __d) { } + + template + shared_ptr(nullptr_t __p, _Deleter __d, _Alloc __a) + : _Base_type(__p, __d, __a) { } + + template + shared_ptr(const shared_ptr<_Tp1>& __r, element_type* __p) noexcept + : _Base_type(__r, __p) { } + + shared_ptr(const shared_ptr& __r) noexcept + : _Base_type(__r) { } + + template> + shared_ptr(const shared_ptr<_Tp1>& __r) noexcept + : _Base_type(__r) { } + + shared_ptr(shared_ptr&& __r) noexcept + : _Base_type(std::move(__r)) { } + + template> + shared_ptr(shared_ptr<_Tp1>&& __r) noexcept + : _Base_type(std::move(__r)) { } + + template> + explicit + shared_ptr(const weak_ptr<_Tp1>& __r) + : _Base_type(__r) { } + +#if _GLIBCXX_USE_DEPRECATED + template> + shared_ptr(std::auto_ptr<_Tp1>&& __r) + : _Base_type(std::move(__r)) + { _M_enable_shared_from_this_with(static_cast<_Tp1*>(this->get())); } +#endif + + template> + shared_ptr(unique_ptr<_Tp1, _Del>&& __r) + : _Base_type(std::move(__r)) + { + // XXX assume conversion from __r.get() to this->get() to __elem_t* + // is a round trip, which might not be true in all cases. + using __elem_t = typename unique_ptr<_Tp1, _Del>::element_type; + _M_enable_shared_from_this_with(static_cast<__elem_t*>(this->get())); + } + + constexpr shared_ptr(nullptr_t __p) + : _Base_type(__p) { } + + // C++14 §20.8.2.2 + ~shared_ptr() = default; + + // C++14 §20.8.2.3 + shared_ptr& operator=(const shared_ptr&) noexcept = default; + + template + _Compatible<_Tp1, shared_ptr&> + operator=(const shared_ptr<_Tp1>& __r) noexcept + { + _Base_type::operator=(__r); + return *this; + } + + shared_ptr& + operator=(shared_ptr&& __r) noexcept + { + _Base_type::operator=(std::move(__r)); + return *this; + } + + template + _Compatible<_Tp1, shared_ptr&> + operator=(shared_ptr<_Tp1>&& __r) noexcept + { + _Base_type::operator=(std::move(__r)); + return *this; + } + +#if _GLIBCXX_USE_DEPRECATED + template + _Compatible<_Tp1, shared_ptr&> + operator=(std::auto_ptr<_Tp1>&& __r) + { + __shared_ptr<_Tp>::operator=(std::move(__r)); + return *this; + } +#endif + + template + _UniqCompatible<_Tp1, _Del, shared_ptr&> + operator=(unique_ptr<_Tp1, _Del>&& __r) + { + _Base_type::operator=(std::move(__r)); + return *this; + } + + // C++14 §20.8.2.2.4 + // swap & reset + // 8.2.1.2 shared_ptr observers + // in __shared_ptr + + private: + template + shared_ptr(_Sp_make_shared_tag __tag, const _Alloc& __a, + _Args&&... __args) + : _Base_type(__tag, __a, std::forward<_Args>(__args)...) + { _M_enable_shared_from_this_with(this->get()); } + + template + friend shared_ptr<_Tp1> + allocate_shared(const _Alloc& __a, _Args&&... __args); + + shared_ptr(const weak_ptr<_Tp>& __r, std::nothrow_t) + : _Base_type(__r, std::nothrow) { } + + friend class weak_ptr<_Tp>; + + template + using __esft_base_t = + decltype(__expt_enable_shared_from_this_base(std::declval<_Yp*>())); + + // Detect an accessible and unambiguous enable_shared_from_this base. + template + struct __has_esft_base + : false_type { }; + + template + struct __has_esft_base<_Yp, __void_t<__esft_base_t<_Yp>>> + : __bool_constant> { }; // ignore base for arrays + + template + typename enable_if<__has_esft_base<_Yp>::value>::type + _M_enable_shared_from_this_with(const _Yp* __p) noexcept + { + if (auto __base = __expt_enable_shared_from_this_base(__p)) + { + __base->_M_weak_this + = shared_ptr<_Yp>(*this, const_cast<_Yp*>(__p)); + } + } + + template + typename enable_if::value>::type + _M_enable_shared_from_this_with(const _Yp*) noexcept + { } + }; + + // C++14 §20.8.2.2.7 //DOING + template + bool operator==(const shared_ptr<_Tp1>& __a, + const shared_ptr<_Tp2>& __b) noexcept + { return __a.get() == __b.get(); } + + template + inline bool + operator==(const shared_ptr<_Tp>& __a, nullptr_t) noexcept + { return !__a; } + + template + inline bool + operator==(nullptr_t, const shared_ptr<_Tp>& __a) noexcept + { return !__a; } + + template + inline bool + operator!=(const shared_ptr<_Tp1>& __a, + const shared_ptr<_Tp2>& __b) noexcept + { return __a.get() != __b.get(); } + + template + inline bool + operator!=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept + { return (bool)__a; } + + template + inline bool + operator!=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept + { return (bool)__a; } + + template + inline bool + operator<(const shared_ptr<_Tp1>& __a, + const shared_ptr<_Tp2>& __b) noexcept + { + using __elem_t1 = typename shared_ptr<_Tp1>::element_type; + using __elem_t2 = typename shared_ptr<_Tp2>::element_type; + using _CT = common_type_t<__elem_t1*, __elem_t2*>; + return std::less<_CT>()(__a.get(), __b.get()); + } + + template + inline bool + operator<(const shared_ptr<_Tp>& __a, nullptr_t) noexcept + { + using __elem_t = typename shared_ptr<_Tp>::element_type; + return std::less<__elem_t*>()(__a.get(), nullptr); + } + + template + inline bool + operator<(nullptr_t, const shared_ptr<_Tp>& __a) noexcept + { + using __elem_t = typename shared_ptr<_Tp>::element_type; + return std::less<__elem_t*>()(nullptr, __a.get()); + } + + template + inline bool + operator<=(const shared_ptr<_Tp1>& __a, + const shared_ptr<_Tp2>& __b) noexcept + { return !(__b < __a); } + + template + inline bool + operator<=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept + { return !(nullptr < __a); } + + template + inline bool + operator<=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept + { return !(__a < nullptr); } + + template + inline bool + operator>(const shared_ptr<_Tp1>& __a, + const shared_ptr<_Tp2>& __b) noexcept + { return (__b < __a); } + + template + inline bool + operator>(const shared_ptr<_Tp>& __a, nullptr_t) noexcept + { + using __elem_t = typename shared_ptr<_Tp>::element_type; + return std::less<__elem_t*>()(nullptr, __a.get()); + } + + template + inline bool + operator>(nullptr_t, const shared_ptr<_Tp>& __a) noexcept + { + using __elem_t = typename shared_ptr<_Tp>::element_type; + return std::less<__elem_t*>()(__a.get(), nullptr); + } + + template + inline bool + operator>=(const shared_ptr<_Tp1>& __a, + const shared_ptr<_Tp2>& __b) noexcept + { return !(__a < __b); } + + template + inline bool + operator>=(const shared_ptr<_Tp>& __a, nullptr_t) noexcept + { return !(__a < nullptr); } + + template + inline bool + operator>=(nullptr_t, const shared_ptr<_Tp>& __a) noexcept + { return !(nullptr < __a); } + + // C++14 §20.8.2.2.8 + template + inline void + swap(shared_ptr<_Tp>& __a, shared_ptr<_Tp>& __b) noexcept + { __a.swap(__b); } + + // 8.2.1.3, shared_ptr casts + template + inline shared_ptr<_Tp> + static_pointer_cast(const shared_ptr<_Tp1>& __r) noexcept + { + using __elem_t = typename shared_ptr<_Tp>::element_type; + return shared_ptr<_Tp>(__r, static_cast<__elem_t*>(__r.get())); + } + + template + inline shared_ptr<_Tp> + dynamic_pointer_cast(const shared_ptr<_Tp1>& __r) noexcept + { + using __elem_t = typename shared_ptr<_Tp>::element_type; + if (_Tp* __p = dynamic_cast<__elem_t*>(__r.get())) + return shared_ptr<_Tp>(__r, __p); + return shared_ptr<_Tp>(); + } + + template + inline shared_ptr<_Tp> + const_pointer_cast(const shared_ptr<_Tp1>& __r) noexcept + { + using __elem_t = typename shared_ptr<_Tp>::element_type; + return shared_ptr<_Tp>(__r, const_cast<__elem_t*>(__r.get())); + } + + template + inline shared_ptr<_Tp> + reinterpret_pointer_cast(const shared_ptr<_Tp1>& __r) noexcept + { + using __elem_t = typename shared_ptr<_Tp>::element_type; + return shared_ptr<_Tp>(__r, reinterpret_cast<__elem_t*>(__r.get())); + } + + // C++14 §20.8.2.3 + template + class weak_ptr : public __weak_ptr<_Tp> + { + template + using _Compatible = enable_if_t<__sp_compatible_v<_Tp1, _Tp>, _Res>; + + using _Base_type = __weak_ptr<_Tp>; + + public: + constexpr weak_ptr() noexcept = default; + + template> + weak_ptr(const shared_ptr<_Tp1>& __r) noexcept + : _Base_type(__r) { } + + weak_ptr(const weak_ptr&) noexcept = default; + + template> + weak_ptr(const weak_ptr<_Tp1>& __r) noexcept + : _Base_type(__r) { } + + weak_ptr(weak_ptr&&) noexcept = default; + + template> + weak_ptr(weak_ptr<_Tp1>&& __r) noexcept + : _Base_type(std::move(__r)) { } + + weak_ptr& + operator=(const weak_ptr& __r) noexcept = default; + + template + _Compatible<_Tp1, weak_ptr&> + operator=(const weak_ptr<_Tp1>& __r) noexcept + { + this->_Base_type::operator=(__r); + return *this; + } + + template + _Compatible<_Tp1, weak_ptr&> + operator=(const shared_ptr<_Tp1>& __r) noexcept + { + this->_Base_type::operator=(__r); + return *this; + } + + weak_ptr& + operator=(weak_ptr&& __r) noexcept = default; + + template + _Compatible<_Tp1, weak_ptr&> + operator=(weak_ptr<_Tp1>&& __r) noexcept + { + this->_Base_type::operator=(std::move(__r)); + return *this; + } + + shared_ptr<_Tp> + lock() const noexcept + { return shared_ptr<_Tp>(*this, std::nothrow); } + + friend class enable_shared_from_this<_Tp>; + }; + + // C++14 §20.8.2.3.6 + template + inline void + swap(weak_ptr<_Tp>& __a, weak_ptr<_Tp>& __b) noexcept + { __a.swap(__b); } + + /// C++14 §20.8.2.2.10 + template + inline _Del* + get_deleter(const shared_ptr<_Tp>& __p) noexcept + { return std::get_deleter<_Del>(__p); } + + // C++14 §20.8.2.2.11 + template + inline std::basic_ostream<_Ch, _Tr>& + operator<<(std::basic_ostream<_Ch, _Tr>& __os, const shared_ptr<_Tp>& __p) + { + __os << __p.get(); + return __os; + } + + // C++14 §20.8.2.4 + template class owner_less; + + /// Partial specialization of owner_less for shared_ptr. + template + struct owner_less> + : public _Sp_owner_less, weak_ptr<_Tp>> + { }; + + /// Partial specialization of owner_less for weak_ptr. + template + struct owner_less> + : public _Sp_owner_less, shared_ptr<_Tp>> + { }; + + template<> + class owner_less + { + template + bool + operator()(shared_ptr<_Tp> const& __lhs, + shared_ptr<_Up> const& __rhs) const + { return __lhs.owner_before(__rhs); } + + template + bool + operator()(shared_ptr<_Tp> const& __lhs, + weak_ptr<_Up> const& __rhs) const + { return __lhs.owner_before(__rhs); } + + template + bool + operator()(weak_ptr<_Tp> const& __lhs, + shared_ptr<_Up> const& __rhs) const + { return __lhs.owner_before(__rhs); } + + template + bool + operator()(weak_ptr<_Tp> const& __lhs, + weak_ptr<_Up> const& __rhs) const + { return __lhs.owner_before(__rhs); } + + typedef void is_transparent; + }; + + // C++14 §20.8.2.6 + template + inline bool + atomic_is_lock_free(const shared_ptr<_Tp>* __p) + { return std::atomic_is_lock_free<_Tp, __default_lock_policy>(__p); } + + template + shared_ptr<_Tp> atomic_load(const shared_ptr<_Tp>* __p) + { return std::atomic_load<_Tp>(__p); } + + template + shared_ptr<_Tp> + atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order __mo) + { return std::atomic_load_explicit<_Tp>(__p, __mo); } + + template + void atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) + { return std::atomic_store<_Tp>(__p, __r); } + + template + shared_ptr<_Tp> + atomic_store_explicit(const shared_ptr<_Tp>* __p, + shared_ptr<_Tp> __r, + memory_order __mo) + { return std::atomic_store_explicit<_Tp>(__p, __r, __mo); } + + template + void atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) + { return std::atomic_exchange<_Tp>(__p, __r); } + + template + shared_ptr<_Tp> + atomic_exchange_explicit(const shared_ptr<_Tp>* __p, + shared_ptr<_Tp> __r, + memory_order __mo) + { return std::atomic_exchange_explicit<_Tp>(__p, __r, __mo); } + + template + bool atomic_compare_exchange_weak(shared_ptr<_Tp>* __p, + shared_ptr<_Tp>* __v, + shared_ptr<_Tp> __w) + { return std::atomic_compare_exchange_weak<_Tp>(__p, __v, __w); } + + template + bool atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, + shared_ptr<_Tp>* __v, + shared_ptr<_Tp> __w) + { return std::atomic_compare_exchange_strong<_Tp>(__p, __v, __w); } + + template + bool atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p, + shared_ptr<_Tp>* __v, + shared_ptr<_Tp> __w, + memory_order __success, + memory_order __failure) + { return std::atomic_compare_exchange_weak_explicit<_Tp>(__p, __v, __w, + __success, + __failure); } + + template + bool atomic_compare_exchange_strong_explicit(shared_ptr<_Tp>* __p, + shared_ptr<_Tp>* __v, + shared_ptr<_Tp> __w, + memory_order __success, + memory_order __failure) + { return std::atomic_compare_exchange_strong_explicit<_Tp>(__p, __v, __w, + __success, + __failure); } + + //enable_shared_from_this + template + class enable_shared_from_this + { + protected: + constexpr enable_shared_from_this() noexcept { } + + enable_shared_from_this(const enable_shared_from_this&) noexcept { } + + enable_shared_from_this& + operator=(const enable_shared_from_this&) noexcept + { return *this; } + + ~enable_shared_from_this() { } + + public: + shared_ptr<_Tp> + shared_from_this() + { return shared_ptr<_Tp>(this->_M_weak_this); } + + shared_ptr + shared_from_this() const + { return shared_ptr(this->_M_weak_this); } + + weak_ptr<_Tp> + weak_from_this() noexcept + { return _M_weak_this; } + + weak_ptr + weak_from_this() const noexcept + { return _M_weak_this; } + + private: + template + void + _M_weak_assign(_Tp1* __p, const __shared_count<>& __n) const noexcept + { _M_weak_this._M_assign(__p, __n); } + + // Found by ADL when this is an associated class. + friend const enable_shared_from_this* + __expt_enable_shared_from_this_base(const enable_shared_from_this* __p) + { return __p; } + + template + friend class shared_ptr; + + mutable weak_ptr<_Tp> _M_weak_this; + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace fundamentals_v2 +} // namespace experimental + +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /// std::hash specialization for shared_ptr. + template + struct hash> + : public __hash_base> + { + size_t + operator()(const experimental::shared_ptr<_Tp>& __s) const noexcept + { return std::hash<_Tp*>()(__s.get()); } + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // __cplusplus <= 201103L + +#endif // _GLIBCXX_EXPERIMENTAL_SHARED_PTR_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/aligned_buffer.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/aligned_buffer.h new file mode 100644 index 0000000..789a0c8 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/aligned_buffer.h @@ -0,0 +1,119 @@ +// Aligned memory buffer -*- C++ -*- + +// Copyright (C) 2013-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file ext/aligned_buffer.h + * This file is a GNU extension to the Standard C++ Library. + */ + +#ifndef _ALIGNED_BUFFER_H +#define _ALIGNED_BUFFER_H 1 + +#pragma GCC system_header + +#if __cplusplus >= 201103L +# include +#else +# include +#endif + +namespace __gnu_cxx +{ + // A utility type containing a POD object that can hold an object of type + // _Tp initialized via placement new or allocator_traits::construct. + // Intended for use as a data member subobject, use __aligned_buffer for + // complete objects. + template + struct __aligned_membuf + { + // Target macro ADJUST_FIELD_ALIGN can produce different alignment for + // types when used as class members. __aligned_membuf is intended + // for use as a class member, so align the buffer as for a class member. + struct _Tp2 { _Tp _M_t; }; + + alignas(__alignof__(_Tp2::_M_t)) unsigned char _M_storage[sizeof(_Tp)]; + + __aligned_membuf() = default; + + // Can be used to avoid value-initialization zeroing _M_storage. + __aligned_membuf(std::nullptr_t) { } + + void* + _M_addr() noexcept + { return static_cast(&_M_storage); } + + const void* + _M_addr() const noexcept + { return static_cast(&_M_storage); } + + _Tp* + _M_ptr() noexcept + { return static_cast<_Tp*>(_M_addr()); } + + const _Tp* + _M_ptr() const noexcept + { return static_cast(_M_addr()); } + }; + + // Similar to __aligned_membuf but aligned for complete objects, not members. + // This type is used in , , + // and , but ideally they would use __aligned_membuf + // instead, as it has smaller size for some types on some targets. + // This type is still used to avoid an ABI change. + template + struct __aligned_buffer + : std::aligned_storage::value> + { + typename + std::aligned_storage::value>::type + _M_storage; + + __aligned_buffer() = default; + + // Can be used to avoid value-initialization + __aligned_buffer(std::nullptr_t) { } + + void* + _M_addr() noexcept + { + return static_cast(&_M_storage); + } + + const void* + _M_addr() const noexcept + { + return static_cast(&_M_storage); + } + + _Tp* + _M_ptr() noexcept + { return static_cast<_Tp*>(_M_addr()); } + + const _Tp* + _M_ptr() const noexcept + { return static_cast(_M_addr()); } + }; + +} // namespace + +#endif /* _ALIGNED_BUFFER_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/alloc_traits.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/alloc_traits.h new file mode 100644 index 0000000..f4435ce --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/alloc_traits.h @@ -0,0 +1,163 @@ +// Allocator traits -*- C++ -*- + +// Copyright (C) 2011-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file ext/alloc_traits.h + * This file is a GNU extension to the Standard C++ Library. + */ + +#ifndef _EXT_ALLOC_TRAITS_H +#define _EXT_ALLOC_TRAITS_H 1 + +#pragma GCC system_header + +#if __cplusplus >= 201103L +# include +# include +#else +# include // for __alloc_swap +#endif + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +/** + * @brief Uniform interface to C++98 and C++11 allocators. + * @ingroup allocators +*/ +template + struct __alloc_traits +#if __cplusplus >= 201103L + : std::allocator_traits<_Alloc> +#endif + { + typedef _Alloc allocator_type; +#if __cplusplus >= 201103L + typedef std::allocator_traits<_Alloc> _Base_type; + typedef typename _Base_type::value_type value_type; + typedef typename _Base_type::pointer pointer; + typedef typename _Base_type::const_pointer const_pointer; + typedef typename _Base_type::size_type size_type; + typedef typename _Base_type::difference_type difference_type; + // C++11 allocators do not define reference or const_reference + typedef value_type& reference; + typedef const value_type& const_reference; + using _Base_type::allocate; + using _Base_type::deallocate; + using _Base_type::construct; + using _Base_type::destroy; + using _Base_type::max_size; + + private: + template + using __is_custom_pointer + = std::__and_, + std::__not_>>; + + public: + // overload construct for non-standard pointer types + template + static typename std::enable_if<__is_custom_pointer<_Ptr>::value>::type + construct(_Alloc& __a, _Ptr __p, _Args&&... __args) + { + _Base_type::construct(__a, std::addressof(*__p), + std::forward<_Args>(__args)...); + } + + // overload destroy for non-standard pointer types + template + static typename std::enable_if<__is_custom_pointer<_Ptr>::value>::type + destroy(_Alloc& __a, _Ptr __p) + { _Base_type::destroy(__a, std::addressof(*__p)); } + + static _Alloc _S_select_on_copy(const _Alloc& __a) + { return _Base_type::select_on_container_copy_construction(__a); } + + static void _S_on_swap(_Alloc& __a, _Alloc& __b) + { std::__alloc_on_swap(__a, __b); } + + static constexpr bool _S_propagate_on_copy_assign() + { return _Base_type::propagate_on_container_copy_assignment::value; } + + static constexpr bool _S_propagate_on_move_assign() + { return _Base_type::propagate_on_container_move_assignment::value; } + + static constexpr bool _S_propagate_on_swap() + { return _Base_type::propagate_on_container_swap::value; } + + static constexpr bool _S_always_equal() + { return _Base_type::is_always_equal::value; } + + static constexpr bool _S_nothrow_move() + { return _S_propagate_on_move_assign() || _S_always_equal(); } + + template + struct rebind + { typedef typename _Base_type::template rebind_alloc<_Tp> other; }; +#else + + typedef typename _Alloc::pointer pointer; + typedef typename _Alloc::const_pointer const_pointer; + typedef typename _Alloc::value_type value_type; + typedef typename _Alloc::reference reference; + typedef typename _Alloc::const_reference const_reference; + typedef typename _Alloc::size_type size_type; + typedef typename _Alloc::difference_type difference_type; + + static pointer + allocate(_Alloc& __a, size_type __n) + { return __a.allocate(__n); } + + static void deallocate(_Alloc& __a, pointer __p, size_type __n) + { __a.deallocate(__p, __n); } + + template + static void construct(_Alloc& __a, pointer __p, const _Tp& __arg) + { __a.construct(__p, __arg); } + + static void destroy(_Alloc& __a, pointer __p) + { __a.destroy(__p); } + + static size_type max_size(const _Alloc& __a) + { return __a.max_size(); } + + static const _Alloc& _S_select_on_copy(const _Alloc& __a) { return __a; } + + static void _S_on_swap(_Alloc& __a, _Alloc& __b) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 431. Swapping containers with unequal allocators. + std::__alloc_swap<_Alloc>::_S_do_it(__a, __b); + } + + template + struct rebind + { typedef typename _Alloc::template rebind<_Tp>::other other; }; +#endif + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace __gnu_cxx + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/array_allocator.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/array_allocator.h new file mode 100644 index 0000000..a2948e4 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/array_allocator.h @@ -0,0 +1,182 @@ +// array allocator -*- C++ -*- + +// Copyright (C) 2004-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file ext/array_allocator.h + * This file is a GNU extension to the Standard C++ Library. + */ + +#ifndef _ARRAY_ALLOCATOR_H +#define _ARRAY_ALLOCATOR_H 1 + +#include +#include +#include +#include +#include +#if __cplusplus >= 201103L +#include +#endif + +// Suppress deprecated warning for this file. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + using std::size_t; + using std::ptrdiff_t; + + /// Base class. + template + class array_allocator_base + { + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Tp* pointer; + typedef const _Tp* const_pointer; + typedef _Tp& reference; + typedef const _Tp& const_reference; + typedef _Tp value_type; + + pointer + address(reference __x) const _GLIBCXX_NOEXCEPT + { return std::__addressof(__x); } + + const_pointer + address(const_reference __x) const _GLIBCXX_NOEXCEPT + { return std::__addressof(__x); } + + void + deallocate(pointer, size_type) + { + // Does nothing. + } + + size_type + max_size() const _GLIBCXX_USE_NOEXCEPT + { return size_t(-1) / sizeof(_Tp); } + +#if __cplusplus >= 201103L + template + void + construct(_Up* __p, _Args&&... __args) + { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } + + template + void + destroy(_Up* __p) { __p->~_Up(); } +#else + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 402. wrong new expression in [some_] allocator::construct + void + construct(pointer __p, const _Tp& __val) + { ::new((void *)__p) value_type(__val); } + + void + destroy(pointer __p) { __p->~_Tp(); } +#endif + } _GLIBCXX_DEPRECATED; + + /** + * @brief An allocator that uses previously allocated memory. + * This memory can be externally, globally, or otherwise allocated. + * @ingroup allocators + */ + template > + class array_allocator : public array_allocator_base<_Tp> + { + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Tp* pointer; + typedef const _Tp* const_pointer; + typedef _Tp& reference; + typedef const _Tp& const_reference; + typedef _Tp value_type; + typedef _Array array_type; + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2103. std::allocator propagate_on_container_move_assignment + typedef std::true_type propagate_on_container_move_assignment; + + typedef std::true_type is_always_equal; +#endif + + private: + array_type* _M_array; + size_type _M_used; + + public: + template + struct rebind + { + typedef array_allocator<_Tp1, _Array1> other _GLIBCXX_DEPRECATED; + } _GLIBCXX_DEPRECATED; + + array_allocator(array_type* __array = 0) _GLIBCXX_USE_NOEXCEPT + : _M_array(__array), _M_used(size_type()) { } + + array_allocator(const array_allocator& __o) _GLIBCXX_USE_NOEXCEPT + : _M_array(__o._M_array), _M_used(__o._M_used) { } + + template + array_allocator(const array_allocator<_Tp1, _Array1>&) + _GLIBCXX_USE_NOEXCEPT + : _M_array(0), _M_used(size_type()) { } + + ~array_allocator() _GLIBCXX_USE_NOEXCEPT { } + + pointer + allocate(size_type __n, const void* = 0) + { + if (_M_array == 0 || _M_used + __n > _M_array->size()) + std::__throw_bad_alloc(); + pointer __ret = _M_array->begin() + _M_used; + _M_used += __n; + return __ret; + } + } _GLIBCXX_DEPRECATED; + + template + inline bool + operator==(const array_allocator<_Tp, _Array>&, + const array_allocator<_Tp, _Array>&) + { return true; } + + template + inline bool + operator!=(const array_allocator<_Tp, _Array>&, + const array_allocator<_Tp, _Array>&) + { return false; } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#pragma GCC diagnostic pop + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/atomicity.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/atomicity.h new file mode 100644 index 0000000..e6043fd --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/atomicity.h @@ -0,0 +1,117 @@ +// Support for atomic operations -*- C++ -*- + +// Copyright (C) 2004-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file ext/atomicity.h + * This file is a GNU extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_ATOMICITY_H +#define _GLIBCXX_ATOMICITY_H 1 + +#pragma GCC system_header + +#include +#include +#include + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // Functions for portable atomic access. + // To abstract locking primitives across all thread policies, use: + // __exchange_and_add_dispatch + // __atomic_add_dispatch +#ifdef _GLIBCXX_ATOMIC_BUILTINS + static inline _Atomic_word + __exchange_and_add(volatile _Atomic_word* __mem, int __val) + { return __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); } + + static inline void + __atomic_add(volatile _Atomic_word* __mem, int __val) + { __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); } +#else + _Atomic_word + __attribute__ ((__unused__)) + __exchange_and_add(volatile _Atomic_word*, int) throw (); + + void + __attribute__ ((__unused__)) + __atomic_add(volatile _Atomic_word*, int) throw (); +#endif + + static inline _Atomic_word + __exchange_and_add_single(_Atomic_word* __mem, int __val) + { + _Atomic_word __result = *__mem; + *__mem += __val; + return __result; + } + + static inline void + __atomic_add_single(_Atomic_word* __mem, int __val) + { *__mem += __val; } + + static inline _Atomic_word + __attribute__ ((__unused__)) + __exchange_and_add_dispatch(_Atomic_word* __mem, int __val) + { +#ifdef __GTHREADS + if (__gthread_active_p()) + return __exchange_and_add(__mem, __val); + else + return __exchange_and_add_single(__mem, __val); +#else + return __exchange_and_add_single(__mem, __val); +#endif + } + + static inline void + __attribute__ ((__unused__)) + __atomic_add_dispatch(_Atomic_word* __mem, int __val) + { +#ifdef __GTHREADS + if (__gthread_active_p()) + __atomic_add(__mem, __val); + else + __atomic_add_single(__mem, __val); +#else + __atomic_add_single(__mem, __val); +#endif + } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +// Even if the CPU doesn't need a memory barrier, we need to ensure +// that the compiler doesn't reorder memory accesses across the +// barriers. +#ifndef _GLIBCXX_READ_MEM_BARRIER +#define _GLIBCXX_READ_MEM_BARRIER __atomic_thread_fence (__ATOMIC_ACQUIRE) +#endif +#ifndef _GLIBCXX_WRITE_MEM_BARRIER +#define _GLIBCXX_WRITE_MEM_BARRIER __atomic_thread_fence (__ATOMIC_RELEASE) +#endif + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/bitmap_allocator.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/bitmap_allocator.h new file mode 100644 index 0000000..3e31269 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/bitmap_allocator.h @@ -0,0 +1,1137 @@ +// Bitmap Allocator. -*- C++ -*- + +// Copyright (C) 2004-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file ext/bitmap_allocator.h + * This file is a GNU extension to the Standard C++ Library. + */ + +#ifndef _BITMAP_ALLOCATOR_H +#define _BITMAP_ALLOCATOR_H 1 + +#include // For std::pair. +#include // For __throw_bad_alloc(). +#include // For greater_equal, and less_equal. +#include // For operator new. +#include // _GLIBCXX_DEBUG_ASSERT +#include +#include + +/** @brief The constant in the expression below is the alignment + * required in bytes. + */ +#define _BALLOC_ALIGN_BYTES 8 + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ + using std::size_t; + using std::ptrdiff_t; + + namespace __detail + { + _GLIBCXX_BEGIN_NAMESPACE_VERSION + /** @class __mini_vector bitmap_allocator.h bitmap_allocator.h + * + * @brief __mini_vector<> is a stripped down version of the + * full-fledged std::vector<>. + * + * It is to be used only for built-in types or PODs. Notable + * differences are: + * + * 1. Not all accessor functions are present. + * 2. Used ONLY for PODs. + * 3. No Allocator template argument. Uses ::operator new() to get + * memory, and ::operator delete() to free it. + * Caveat: The dtor does NOT free the memory allocated, so this a + * memory-leaking vector! + */ + template + class __mini_vector + { + __mini_vector(const __mini_vector&); + __mini_vector& operator=(const __mini_vector&); + + public: + typedef _Tp value_type; + typedef _Tp* pointer; + typedef _Tp& reference; + typedef const _Tp& const_reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef pointer iterator; + + private: + pointer _M_start; + pointer _M_finish; + pointer _M_end_of_storage; + + size_type + _M_space_left() const throw() + { return _M_end_of_storage - _M_finish; } + + pointer + allocate(size_type __n) + { return static_cast(::operator new(__n * sizeof(_Tp))); } + + void + deallocate(pointer __p, size_type) + { ::operator delete(__p); } + + public: + // Members used: size(), push_back(), pop_back(), + // insert(iterator, const_reference), erase(iterator), + // begin(), end(), back(), operator[]. + + __mini_vector() + : _M_start(0), _M_finish(0), _M_end_of_storage(0) { } + + size_type + size() const throw() + { return _M_finish - _M_start; } + + iterator + begin() const throw() + { return this->_M_start; } + + iterator + end() const throw() + { return this->_M_finish; } + + reference + back() const throw() + { return *(this->end() - 1); } + + reference + operator[](const size_type __pos) const throw() + { return this->_M_start[__pos]; } + + void + insert(iterator __pos, const_reference __x); + + void + push_back(const_reference __x) + { + if (this->_M_space_left()) + { + *this->end() = __x; + ++this->_M_finish; + } + else + this->insert(this->end(), __x); + } + + void + pop_back() throw() + { --this->_M_finish; } + + void + erase(iterator __pos) throw(); + + void + clear() throw() + { this->_M_finish = this->_M_start; } + }; + + // Out of line function definitions. + template + void __mini_vector<_Tp>:: + insert(iterator __pos, const_reference __x) + { + if (this->_M_space_left()) + { + size_type __to_move = this->_M_finish - __pos; + iterator __dest = this->end(); + iterator __src = this->end() - 1; + + ++this->_M_finish; + while (__to_move) + { + *__dest = *__src; + --__dest; --__src; --__to_move; + } + *__pos = __x; + } + else + { + size_type __new_size = this->size() ? this->size() * 2 : 1; + iterator __new_start = this->allocate(__new_size); + iterator __first = this->begin(); + iterator __start = __new_start; + while (__first != __pos) + { + *__start = *__first; + ++__start; ++__first; + } + *__start = __x; + ++__start; + while (__first != this->end()) + { + *__start = *__first; + ++__start; ++__first; + } + if (this->_M_start) + this->deallocate(this->_M_start, this->size()); + + this->_M_start = __new_start; + this->_M_finish = __start; + this->_M_end_of_storage = this->_M_start + __new_size; + } + } + + template + void __mini_vector<_Tp>:: + erase(iterator __pos) throw() + { + while (__pos + 1 != this->end()) + { + *__pos = __pos[1]; + ++__pos; + } + --this->_M_finish; + } + + + template + struct __mv_iter_traits + { + typedef typename _Tp::value_type value_type; + typedef typename _Tp::difference_type difference_type; + }; + + template + struct __mv_iter_traits<_Tp*> + { + typedef _Tp value_type; + typedef ptrdiff_t difference_type; + }; + + enum + { + bits_per_byte = 8, + bits_per_block = sizeof(size_t) * size_t(bits_per_byte) + }; + + template + _ForwardIterator + __lower_bound(_ForwardIterator __first, _ForwardIterator __last, + const _Tp& __val, _Compare __comp) + { + typedef typename __mv_iter_traits<_ForwardIterator>::difference_type + _DistanceType; + + _DistanceType __len = __last - __first; + _DistanceType __half; + _ForwardIterator __middle; + + while (__len > 0) + { + __half = __len >> 1; + __middle = __first; + __middle += __half; + if (__comp(*__middle, __val)) + { + __first = __middle; + ++__first; + __len = __len - __half - 1; + } + else + __len = __half; + } + return __first; + } + + /** @brief The number of Blocks pointed to by the address pair + * passed to the function. + */ + template + inline size_t + __num_blocks(_AddrPair __ap) + { return (__ap.second - __ap.first) + 1; } + + /** @brief The number of Bit-maps pointed to by the address pair + * passed to the function. + */ + template + inline size_t + __num_bitmaps(_AddrPair __ap) + { return __num_blocks(__ap) / size_t(bits_per_block); } + + // _Tp should be a pointer type. + template + class _Inclusive_between + : public std::unary_function, bool> + { + typedef _Tp pointer; + pointer _M_ptr_value; + typedef typename std::pair<_Tp, _Tp> _Block_pair; + + public: + _Inclusive_between(pointer __ptr) : _M_ptr_value(__ptr) + { } + + bool + operator()(_Block_pair __bp) const throw() + { + if (std::less_equal()(_M_ptr_value, __bp.second) + && std::greater_equal()(_M_ptr_value, __bp.first)) + return true; + else + return false; + } + }; + + // Used to pass a Functor to functions by reference. + template + class _Functor_Ref + : public std::unary_function + { + _Functor& _M_fref; + + public: + typedef typename _Functor::argument_type argument_type; + typedef typename _Functor::result_type result_type; + + _Functor_Ref(_Functor& __fref) : _M_fref(__fref) + { } + + result_type + operator()(argument_type __arg) + { return _M_fref(__arg); } + }; + + /** @class _Ffit_finder bitmap_allocator.h bitmap_allocator.h + * + * @brief The class which acts as a predicate for applying the + * first-fit memory allocation policy for the bitmap allocator. + */ + // _Tp should be a pointer type, and _Alloc is the Allocator for + // the vector. + template + class _Ffit_finder + : public std::unary_function, bool> + { + typedef typename std::pair<_Tp, _Tp> _Block_pair; + typedef typename __detail::__mini_vector<_Block_pair> _BPVector; + typedef typename _BPVector::difference_type _Counter_type; + + size_t* _M_pbitmap; + _Counter_type _M_data_offset; + + public: + _Ffit_finder() : _M_pbitmap(0), _M_data_offset(0) + { } + + bool + operator()(_Block_pair __bp) throw() + { + // Set the _rover to the last physical location bitmap, + // which is the bitmap which belongs to the first free + // block. Thus, the bitmaps are in exact reverse order of + // the actual memory layout. So, we count down the bitmaps, + // which is the same as moving up the memory. + + // If the used count stored at the start of the Bit Map headers + // is equal to the number of Objects that the current Block can + // store, then there is definitely no space for another single + // object, so just return false. + _Counter_type __diff = __detail::__num_bitmaps(__bp); + + if (*(reinterpret_cast + (__bp.first) - (__diff + 1)) == __detail::__num_blocks(__bp)) + return false; + + size_t* __rover = reinterpret_cast(__bp.first) - 1; + + for (_Counter_type __i = 0; __i < __diff; ++__i) + { + _M_data_offset = __i; + if (*__rover) + { + _M_pbitmap = __rover; + return true; + } + --__rover; + } + return false; + } + + size_t* + _M_get() const throw() + { return _M_pbitmap; } + + _Counter_type + _M_offset() const throw() + { return _M_data_offset * size_t(bits_per_block); } + }; + + /** @class _Bitmap_counter bitmap_allocator.h bitmap_allocator.h + * + * @brief The bitmap counter which acts as the bitmap + * manipulator, and manages the bit-manipulation functions and + * the searching and identification functions on the bit-map. + */ + // _Tp should be a pointer type. + template + class _Bitmap_counter + { + typedef typename + __detail::__mini_vector > _BPVector; + typedef typename _BPVector::size_type _Index_type; + typedef _Tp pointer; + + _BPVector& _M_vbp; + size_t* _M_curr_bmap; + size_t* _M_last_bmap_in_block; + _Index_type _M_curr_index; + + public: + // Use the 2nd parameter with care. Make sure that such an + // entry exists in the vector before passing that particular + // index to this ctor. + _Bitmap_counter(_BPVector& Rvbp, long __index = -1) : _M_vbp(Rvbp) + { this->_M_reset(__index); } + + void + _M_reset(long __index = -1) throw() + { + if (__index == -1) + { + _M_curr_bmap = 0; + _M_curr_index = static_cast<_Index_type>(-1); + return; + } + + _M_curr_index = __index; + _M_curr_bmap = reinterpret_cast + (_M_vbp[_M_curr_index].first) - 1; + + _GLIBCXX_DEBUG_ASSERT(__index <= (long)_M_vbp.size() - 1); + + _M_last_bmap_in_block = _M_curr_bmap + - ((_M_vbp[_M_curr_index].second + - _M_vbp[_M_curr_index].first + 1) + / size_t(bits_per_block) - 1); + } + + // Dangerous Function! Use with extreme care. Pass to this + // function ONLY those values that are known to be correct, + // otherwise this will mess up big time. + void + _M_set_internal_bitmap(size_t* __new_internal_marker) throw() + { _M_curr_bmap = __new_internal_marker; } + + bool + _M_finished() const throw() + { return(_M_curr_bmap == 0); } + + _Bitmap_counter& + operator++() throw() + { + if (_M_curr_bmap == _M_last_bmap_in_block) + { + if (++_M_curr_index == _M_vbp.size()) + _M_curr_bmap = 0; + else + this->_M_reset(_M_curr_index); + } + else + --_M_curr_bmap; + return *this; + } + + size_t* + _M_get() const throw() + { return _M_curr_bmap; } + + pointer + _M_base() const throw() + { return _M_vbp[_M_curr_index].first; } + + _Index_type + _M_offset() const throw() + { + return size_t(bits_per_block) + * ((reinterpret_cast(this->_M_base()) + - _M_curr_bmap) - 1); + } + + _Index_type + _M_where() const throw() + { return _M_curr_index; } + }; + + /** @brief Mark a memory address as allocated by re-setting the + * corresponding bit in the bit-map. + */ + inline void + __bit_allocate(size_t* __pbmap, size_t __pos) throw() + { + size_t __mask = 1 << __pos; + __mask = ~__mask; + *__pbmap &= __mask; + } + + /** @brief Mark a memory address as free by setting the + * corresponding bit in the bit-map. + */ + inline void + __bit_free(size_t* __pbmap, size_t __pos) throw() + { + size_t __mask = 1 << __pos; + *__pbmap |= __mask; + } + + _GLIBCXX_END_NAMESPACE_VERSION + } // namespace __detail + +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** @brief Generic Version of the bsf instruction. + */ + inline size_t + _Bit_scan_forward(size_t __num) + { return static_cast(__builtin_ctzl(__num)); } + + /** @class free_list bitmap_allocator.h bitmap_allocator.h + * + * @brief The free list class for managing chunks of memory to be + * given to and returned by the bitmap_allocator. + */ + class free_list + { + public: + typedef size_t* value_type; + typedef __detail::__mini_vector vector_type; + typedef vector_type::iterator iterator; + typedef __mutex __mutex_type; + + private: + struct _LT_pointer_compare + { + bool + operator()(const size_t* __pui, + const size_t __cui) const throw() + { return *__pui < __cui; } + }; + +#if defined __GTHREADS + __mutex_type& + _M_get_mutex() + { + static __mutex_type _S_mutex; + return _S_mutex; + } +#endif + + vector_type& + _M_get_free_list() + { + static vector_type _S_free_list; + return _S_free_list; + } + + /** @brief Performs validation of memory based on their size. + * + * @param __addr The pointer to the memory block to be + * validated. + * + * Validates the memory block passed to this function and + * appropriately performs the action of managing the free list of + * blocks by adding this block to the free list or deleting this + * or larger blocks from the free list. + */ + void + _M_validate(size_t* __addr) throw() + { + vector_type& __free_list = _M_get_free_list(); + const vector_type::size_type __max_size = 64; + if (__free_list.size() >= __max_size) + { + // Ok, the threshold value has been reached. We determine + // which block to remove from the list of free blocks. + if (*__addr >= *__free_list.back()) + { + // Ok, the new block is greater than or equal to the + // last block in the list of free blocks. We just free + // the new block. + ::operator delete(static_cast(__addr)); + return; + } + else + { + // Deallocate the last block in the list of free lists, + // and insert the new one in its correct position. + ::operator delete(static_cast(__free_list.back())); + __free_list.pop_back(); + } + } + + // Just add the block to the list of free lists unconditionally. + iterator __temp = __detail::__lower_bound + (__free_list.begin(), __free_list.end(), + *__addr, _LT_pointer_compare()); + + // We may insert the new free list before _temp; + __free_list.insert(__temp, __addr); + } + + /** @brief Decides whether the wastage of memory is acceptable for + * the current memory request and returns accordingly. + * + * @param __block_size The size of the block available in the free + * list. + * + * @param __required_size The required size of the memory block. + * + * @return true if the wastage incurred is acceptable, else returns + * false. + */ + bool + _M_should_i_give(size_t __block_size, + size_t __required_size) throw() + { + const size_t __max_wastage_percentage = 36; + if (__block_size >= __required_size && + (((__block_size - __required_size) * 100 / __block_size) + < __max_wastage_percentage)) + return true; + else + return false; + } + + public: + /** @brief This function returns the block of memory to the + * internal free list. + * + * @param __addr The pointer to the memory block that was given + * by a call to the _M_get function. + */ + inline void + _M_insert(size_t* __addr) throw() + { +#if defined __GTHREADS + __scoped_lock __bfl_lock(_M_get_mutex()); +#endif + // Call _M_validate to decide what should be done with + // this particular free list. + this->_M_validate(reinterpret_cast(__addr) - 1); + // See discussion as to why this is 1! + } + + /** @brief This function gets a block of memory of the specified + * size from the free list. + * + * @param __sz The size in bytes of the memory required. + * + * @return A pointer to the new memory block of size at least + * equal to that requested. + */ + size_t* + _M_get(size_t __sz) _GLIBCXX_THROW(std::bad_alloc); + + /** @brief This function just clears the internal Free List, and + * gives back all the memory to the OS. + */ + void + _M_clear(); + }; + + + // Forward declare the class. + template + class bitmap_allocator; + + // Specialize for void: + template<> + class bitmap_allocator + { + public: + typedef void* pointer; + typedef const void* const_pointer; + + // Reference-to-void members are impossible. + typedef void value_type; + template + struct rebind + { + typedef bitmap_allocator<_Tp1> other; + }; + }; + + /** + * @brief Bitmap Allocator, primary template. + * @ingroup allocators + */ + template + class bitmap_allocator : private free_list + { + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Tp* pointer; + typedef const _Tp* const_pointer; + typedef _Tp& reference; + typedef const _Tp& const_reference; + typedef _Tp value_type; + typedef free_list::__mutex_type __mutex_type; + + template + struct rebind + { + typedef bitmap_allocator<_Tp1> other; + }; + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2103. propagate_on_container_move_assignment + typedef std::true_type propagate_on_container_move_assignment; +#endif + + private: + template + struct aligned_size + { + enum + { + modulus = _BSize % _AlignSize, + value = _BSize + (modulus ? _AlignSize - (modulus) : 0) + }; + }; + + struct _Alloc_block + { + char __M_unused[aligned_size::value]; + }; + + + typedef typename std::pair<_Alloc_block*, _Alloc_block*> _Block_pair; + + typedef typename __detail::__mini_vector<_Block_pair> _BPVector; + typedef typename _BPVector::iterator _BPiter; + + template + static _BPiter + _S_find(_Predicate __p) + { + _BPiter __first = _S_mem_blocks.begin(); + while (__first != _S_mem_blocks.end() && !__p(*__first)) + ++__first; + return __first; + } + +#if defined _GLIBCXX_DEBUG + // Complexity: O(lg(N)). Where, N is the number of block of size + // sizeof(value_type). + void + _S_check_for_free_blocks() throw() + { + typedef typename __detail::_Ffit_finder<_Alloc_block*> _FFF; + _BPiter __bpi = _S_find(_FFF()); + + _GLIBCXX_DEBUG_ASSERT(__bpi == _S_mem_blocks.end()); + } +#endif + + /** @brief Responsible for exponentially growing the internal + * memory pool. + * + * @throw std::bad_alloc. If memory can not be allocated. + * + * Complexity: O(1), but internally depends upon the + * complexity of the function free_list::_M_get. The part where + * the bitmap headers are written has complexity: O(X),where X + * is the number of blocks of size sizeof(value_type) within + * the newly acquired block. Having a tight bound. + */ + void + _S_refill_pool() _GLIBCXX_THROW(std::bad_alloc) + { +#if defined _GLIBCXX_DEBUG + _S_check_for_free_blocks(); +#endif + + const size_t __num_bitmaps = (_S_block_size + / size_t(__detail::bits_per_block)); + const size_t __size_to_allocate = sizeof(size_t) + + _S_block_size * sizeof(_Alloc_block) + + __num_bitmaps * sizeof(size_t); + + size_t* __temp = + reinterpret_cast(this->_M_get(__size_to_allocate)); + *__temp = 0; + ++__temp; + + // The Header information goes at the Beginning of the Block. + _Block_pair __bp = + std::make_pair(reinterpret_cast<_Alloc_block*> + (__temp + __num_bitmaps), + reinterpret_cast<_Alloc_block*> + (__temp + __num_bitmaps) + + _S_block_size - 1); + + // Fill the Vector with this information. + _S_mem_blocks.push_back(__bp); + + for (size_t __i = 0; __i < __num_bitmaps; ++__i) + __temp[__i] = ~static_cast(0); // 1 Indicates all Free. + + _S_block_size *= 2; + } + + static _BPVector _S_mem_blocks; + static size_t _S_block_size; + static __detail::_Bitmap_counter<_Alloc_block*> _S_last_request; + static typename _BPVector::size_type _S_last_dealloc_index; +#if defined __GTHREADS + static __mutex_type _S_mut; +#endif + + public: + + /** @brief Allocates memory for a single object of size + * sizeof(_Tp). + * + * @throw std::bad_alloc. If memory can not be allocated. + * + * Complexity: Worst case complexity is O(N), but that + * is hardly ever hit. If and when this particular case is + * encountered, the next few cases are guaranteed to have a + * worst case complexity of O(1)! That's why this function + * performs very well on average. You can consider this + * function to have a complexity referred to commonly as: + * Amortized Constant time. + */ + pointer + _M_allocate_single_object() _GLIBCXX_THROW(std::bad_alloc) + { +#if defined __GTHREADS + __scoped_lock __bit_lock(_S_mut); +#endif + + // The algorithm is something like this: The last_request + // variable points to the last accessed Bit Map. When such a + // condition occurs, we try to find a free block in the + // current bitmap, or succeeding bitmaps until the last bitmap + // is reached. If no free block turns up, we resort to First + // Fit method. + + // WARNING: Do not re-order the condition in the while + // statement below, because it relies on C++'s short-circuit + // evaluation. The return from _S_last_request->_M_get() will + // NOT be dereference able if _S_last_request->_M_finished() + // returns true. This would inevitably lead to a NULL pointer + // dereference if tinkered with. + while (_S_last_request._M_finished() == false + && (*(_S_last_request._M_get()) == 0)) + _S_last_request.operator++(); + + if (__builtin_expect(_S_last_request._M_finished() == true, false)) + { + // Fall Back to First Fit algorithm. + typedef typename __detail::_Ffit_finder<_Alloc_block*> _FFF; + _FFF __fff; + _BPiter __bpi = _S_find(__detail::_Functor_Ref<_FFF>(__fff)); + + if (__bpi != _S_mem_blocks.end()) + { + // Search was successful. Ok, now mark the first bit from + // the right as 0, meaning Allocated. This bit is obtained + // by calling _M_get() on __fff. + size_t __nz_bit = _Bit_scan_forward(*__fff._M_get()); + __detail::__bit_allocate(__fff._M_get(), __nz_bit); + + _S_last_request._M_reset(__bpi - _S_mem_blocks.begin()); + + // Now, get the address of the bit we marked as allocated. + pointer __ret = reinterpret_cast + (__bpi->first + __fff._M_offset() + __nz_bit); + size_t* __puse_count = + reinterpret_cast + (__bpi->first) - (__detail::__num_bitmaps(*__bpi) + 1); + + ++(*__puse_count); + return __ret; + } + else + { + // Search was unsuccessful. We Add more memory to the + // pool by calling _S_refill_pool(). + _S_refill_pool(); + + // _M_Reset the _S_last_request structure to the first + // free block's bit map. + _S_last_request._M_reset(_S_mem_blocks.size() - 1); + + // Now, mark that bit as allocated. + } + } + + // _S_last_request holds a pointer to a valid bit map, that + // points to a free block in memory. + size_t __nz_bit = _Bit_scan_forward(*_S_last_request._M_get()); + __detail::__bit_allocate(_S_last_request._M_get(), __nz_bit); + + pointer __ret = reinterpret_cast + (_S_last_request._M_base() + _S_last_request._M_offset() + __nz_bit); + + size_t* __puse_count = reinterpret_cast + (_S_mem_blocks[_S_last_request._M_where()].first) + - (__detail:: + __num_bitmaps(_S_mem_blocks[_S_last_request._M_where()]) + 1); + + ++(*__puse_count); + return __ret; + } + + /** @brief Deallocates memory that belongs to a single object of + * size sizeof(_Tp). + * + * Complexity: O(lg(N)), but the worst case is not hit + * often! This is because containers usually deallocate memory + * close to each other and this case is handled in O(1) time by + * the deallocate function. + */ + void + _M_deallocate_single_object(pointer __p) throw() + { +#if defined __GTHREADS + __scoped_lock __bit_lock(_S_mut); +#endif + _Alloc_block* __real_p = reinterpret_cast<_Alloc_block*>(__p); + + typedef typename _BPVector::iterator _Iterator; + typedef typename _BPVector::difference_type _Difference_type; + + _Difference_type __diff; + long __displacement; + + _GLIBCXX_DEBUG_ASSERT(_S_last_dealloc_index >= 0); + + __detail::_Inclusive_between<_Alloc_block*> __ibt(__real_p); + if (__ibt(_S_mem_blocks[_S_last_dealloc_index])) + { + _GLIBCXX_DEBUG_ASSERT(_S_last_dealloc_index + <= _S_mem_blocks.size() - 1); + + // Initial Assumption was correct! + __diff = _S_last_dealloc_index; + __displacement = __real_p - _S_mem_blocks[__diff].first; + } + else + { + _Iterator _iter = _S_find(__ibt); + + _GLIBCXX_DEBUG_ASSERT(_iter != _S_mem_blocks.end()); + + __diff = _iter - _S_mem_blocks.begin(); + __displacement = __real_p - _S_mem_blocks[__diff].first; + _S_last_dealloc_index = __diff; + } + + // Get the position of the iterator that has been found. + const size_t __rotate = (__displacement + % size_t(__detail::bits_per_block)); + size_t* __bitmapC = + reinterpret_cast + (_S_mem_blocks[__diff].first) - 1; + __bitmapC -= (__displacement / size_t(__detail::bits_per_block)); + + __detail::__bit_free(__bitmapC, __rotate); + size_t* __puse_count = reinterpret_cast + (_S_mem_blocks[__diff].first) + - (__detail::__num_bitmaps(_S_mem_blocks[__diff]) + 1); + + _GLIBCXX_DEBUG_ASSERT(*__puse_count != 0); + + --(*__puse_count); + + if (__builtin_expect(*__puse_count == 0, false)) + { + _S_block_size /= 2; + + // We can safely remove this block. + // _Block_pair __bp = _S_mem_blocks[__diff]; + this->_M_insert(__puse_count); + _S_mem_blocks.erase(_S_mem_blocks.begin() + __diff); + + // Reset the _S_last_request variable to reflect the + // erased block. We do this to protect future requests + // after the last block has been removed from a particular + // memory Chunk, which in turn has been returned to the + // free list, and hence had been erased from the vector, + // so the size of the vector gets reduced by 1. + if ((_Difference_type)_S_last_request._M_where() >= __diff--) + _S_last_request._M_reset(__diff); + + // If the Index into the vector of the region of memory + // that might hold the next address that will be passed to + // deallocated may have been invalidated due to the above + // erase procedure being called on the vector, hence we + // try to restore this invariant too. + if (_S_last_dealloc_index >= _S_mem_blocks.size()) + { + _S_last_dealloc_index =(__diff != -1 ? __diff : 0); + _GLIBCXX_DEBUG_ASSERT(_S_last_dealloc_index >= 0); + } + } + } + + public: + bitmap_allocator() _GLIBCXX_USE_NOEXCEPT + { } + + bitmap_allocator(const bitmap_allocator&) _GLIBCXX_USE_NOEXCEPT + { } + + template + bitmap_allocator(const bitmap_allocator<_Tp1>&) _GLIBCXX_USE_NOEXCEPT + { } + + ~bitmap_allocator() _GLIBCXX_USE_NOEXCEPT + { } + + pointer + allocate(size_type __n) + { + if (__n > this->max_size()) + std::__throw_bad_alloc(); + +#if __cpp_aligned_new + if (alignof(value_type) > __STDCPP_DEFAULT_NEW_ALIGNMENT__) + { + const size_type __b = __n * sizeof(value_type); + std::align_val_t __al = std::align_val_t(alignof(value_type)); + return static_cast(::operator new(__b, __al)); + } +#endif + + if (__builtin_expect(__n == 1, true)) + return this->_M_allocate_single_object(); + else + { + const size_type __b = __n * sizeof(value_type); + return reinterpret_cast(::operator new(__b)); + } + } + + pointer + allocate(size_type __n, typename bitmap_allocator::const_pointer) + { return allocate(__n); } + + void + deallocate(pointer __p, size_type __n) throw() + { + if (__builtin_expect(__p != 0, true)) + { +#if __cpp_aligned_new + // Types with extended alignment are handled by operator delete. + if (alignof(value_type) > __STDCPP_DEFAULT_NEW_ALIGNMENT__) + { + ::operator delete(__p, std::align_val_t(alignof(value_type))); + return; + } +#endif + + if (__builtin_expect(__n == 1, true)) + this->_M_deallocate_single_object(__p); + else + ::operator delete(__p); + } + } + + pointer + address(reference __r) const _GLIBCXX_NOEXCEPT + { return std::__addressof(__r); } + + const_pointer + address(const_reference __r) const _GLIBCXX_NOEXCEPT + { return std::__addressof(__r); } + + size_type + max_size() const _GLIBCXX_USE_NOEXCEPT + { return size_type(-1) / sizeof(value_type); } + +#if __cplusplus >= 201103L + template + void + construct(_Up* __p, _Args&&... __args) + { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } + + template + void + destroy(_Up* __p) + { __p->~_Up(); } +#else + void + construct(pointer __p, const_reference __data) + { ::new((void *)__p) value_type(__data); } + + void + destroy(pointer __p) + { __p->~value_type(); } +#endif + }; + + template + bool + operator==(const bitmap_allocator<_Tp1>&, + const bitmap_allocator<_Tp2>&) throw() + { return true; } + + template + bool + operator!=(const bitmap_allocator<_Tp1>&, + const bitmap_allocator<_Tp2>&) throw() + { return false; } + + // Static member definitions. + template + typename bitmap_allocator<_Tp>::_BPVector + bitmap_allocator<_Tp>::_S_mem_blocks; + + template + size_t bitmap_allocator<_Tp>::_S_block_size = + 2 * size_t(__detail::bits_per_block); + + template + typename bitmap_allocator<_Tp>::_BPVector::size_type + bitmap_allocator<_Tp>::_S_last_dealloc_index = 0; + + template + __detail::_Bitmap_counter + ::_Alloc_block*> + bitmap_allocator<_Tp>::_S_last_request(_S_mem_blocks); + +#if defined __GTHREADS + template + typename bitmap_allocator<_Tp>::__mutex_type + bitmap_allocator<_Tp>::_S_mut; +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace __gnu_cxx + +#endif + diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/cast.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/cast.h new file mode 100644 index 0000000..95b0113 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/cast.h @@ -0,0 +1,121 @@ +// -*- C++ -*- + +// Copyright (C) 2008-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file ext/cast.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{ext/pointer.h} + */ + +#ifndef _GLIBCXX_CAST_H +#define _GLIBCXX_CAST_H 1 + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * These functions are here to allow containers to support non standard + * pointer types. For normal pointers, these resolve to the use of the + * standard cast operation. For other types the functions will perform + * the appropriate cast to/from the custom pointer class so long as that + * class meets the following conditions: + * 1) has a typedef element_type which names tehe type it points to. + * 2) has a get() const method which returns element_type*. + * 3) has a constructor which can take one element_type* argument. + */ + + /** + * This type supports the semantics of the pointer cast operators (below.) + */ + template + struct _Caster + { typedef typename _ToType::element_type* type; }; + + template + struct _Caster<_ToType*> + { typedef _ToType* type; }; + + /** + * Casting operations for cases where _FromType is not a standard pointer. + * _ToType can be a standard or non-standard pointer. Given that _FromType + * is not a pointer, it must have a get() method that returns the standard + * pointer equivalent of the address it points to, and must have an + * element_type typedef which names the type it points to. + */ + template + inline _ToType + __static_pointer_cast(const _FromType& __arg) + { return _ToType(static_cast:: + type>(__arg.get())); } + + template + inline _ToType + __dynamic_pointer_cast(const _FromType& __arg) + { return _ToType(dynamic_cast:: + type>(__arg.get())); } + + template + inline _ToType + __const_pointer_cast(const _FromType& __arg) + { return _ToType(const_cast:: + type>(__arg.get())); } + + template + inline _ToType + __reinterpret_pointer_cast(const _FromType& __arg) + { return _ToType(reinterpret_cast:: + type>(__arg.get())); } + + /** + * Casting operations for cases where _FromType is a standard pointer. + * _ToType can be a standard or non-standard pointer. + */ + template + inline _ToType + __static_pointer_cast(_FromType* __arg) + { return _ToType(static_cast:: + type>(__arg)); } + + template + inline _ToType + __dynamic_pointer_cast(_FromType* __arg) + { return _ToType(dynamic_cast:: + type>(__arg)); } + + template + inline _ToType + __const_pointer_cast(_FromType* __arg) + { return _ToType(const_cast:: + type>(__arg)); } + + template + inline _ToType + __reinterpret_pointer_cast(_FromType* __arg) + { return _ToType(reinterpret_cast:: + type>(__arg)); } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif // _GLIBCXX_CAST_H diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/codecvt_specializations.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/codecvt_specializations.h new file mode 100644 index 0000000..1f0452f --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/codecvt_specializations.h @@ -0,0 +1,515 @@ +// Locale support (codecvt) -*- C++ -*- + +// Copyright (C) 2000-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +// +// ISO C++ 14882: 22.2.1.5 Template class codecvt +// + +// Written by Benjamin Kosnik + +/** @file ext/codecvt_specializations.h + * This file is a GNU extension to the Standard C++ Library. + */ + +#ifndef _EXT_CODECVT_SPECIALIZATIONS_H +#define _EXT_CODECVT_SPECIALIZATIONS_H 1 + +#include +#include +#include + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_CXX11 +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /// Extension to use iconv for dealing with character encodings. + // This includes conversions and comparisons between various character + // sets. This object encapsulates data that may need to be shared between + // char_traits, codecvt and ctype. + class encoding_state + { + public: + // Types: + // NB: A conversion descriptor subsumes and enhances the + // functionality of a simple state type such as mbstate_t. + typedef iconv_t descriptor_type; + + protected: + // Name of internal character set encoding. + std::string _M_int_enc; + + // Name of external character set encoding. + std::string _M_ext_enc; + + // Conversion descriptor between external encoding to internal encoding. + descriptor_type _M_in_desc; + + // Conversion descriptor between internal encoding to external encoding. + descriptor_type _M_out_desc; + + // The byte-order marker for the external encoding, if necessary. + int _M_ext_bom; + + // The byte-order marker for the internal encoding, if necessary. + int _M_int_bom; + + // Number of external bytes needed to construct one complete + // character in the internal encoding. + // NB: -1 indicates variable, or stateful, encodings. + int _M_bytes; + + public: + explicit + encoding_state() + : _M_in_desc(0), _M_out_desc(0), _M_ext_bom(0), _M_int_bom(0), _M_bytes(0) + { } + + explicit + encoding_state(const char* __int, const char* __ext, + int __ibom = 0, int __ebom = 0, int __bytes = 1) + : _M_int_enc(__int), _M_ext_enc(__ext), _M_in_desc(0), _M_out_desc(0), + _M_ext_bom(__ebom), _M_int_bom(__ibom), _M_bytes(__bytes) + { init(); } + + // 21.1.2 traits typedefs + // p4 + // typedef STATE_T state_type + // requires: state_type shall meet the requirements of + // CopyConstructible types (20.1.3) + // NB: This does not preserve the actual state of the conversion + // descriptor member, but it does duplicate the encoding + // information. + encoding_state(const encoding_state& __obj) : _M_in_desc(0), _M_out_desc(0) + { construct(__obj); } + + // Need assignment operator as well. + encoding_state& + operator=(const encoding_state& __obj) + { + construct(__obj); + return *this; + } + + ~encoding_state() + { destroy(); } + + bool + good() const throw() + { + const descriptor_type __err = (iconv_t)(-1); + bool __test = _M_in_desc && _M_in_desc != __err; + __test &= _M_out_desc && _M_out_desc != __err; + return __test; + } + + int + character_ratio() const + { return _M_bytes; } + + const std::string + internal_encoding() const + { return _M_int_enc; } + + int + internal_bom() const + { return _M_int_bom; } + + const std::string + external_encoding() const + { return _M_ext_enc; } + + int + external_bom() const + { return _M_ext_bom; } + + const descriptor_type& + in_descriptor() const + { return _M_in_desc; } + + const descriptor_type& + out_descriptor() const + { return _M_out_desc; } + + protected: + void + init() + { + const descriptor_type __err = (iconv_t)(-1); + const bool __have_encodings = _M_int_enc.size() && _M_ext_enc.size(); + if (!_M_in_desc && __have_encodings) + { + _M_in_desc = iconv_open(_M_int_enc.c_str(), _M_ext_enc.c_str()); + if (_M_in_desc == __err) + std::__throw_runtime_error(__N("encoding_state::_M_init " + "creating iconv input descriptor failed")); + } + if (!_M_out_desc && __have_encodings) + { + _M_out_desc = iconv_open(_M_ext_enc.c_str(), _M_int_enc.c_str()); + if (_M_out_desc == __err) + std::__throw_runtime_error(__N("encoding_state::_M_init " + "creating iconv output descriptor failed")); + } + } + + void + construct(const encoding_state& __obj) + { + destroy(); + _M_int_enc = __obj._M_int_enc; + _M_ext_enc = __obj._M_ext_enc; + _M_ext_bom = __obj._M_ext_bom; + _M_int_bom = __obj._M_int_bom; + _M_bytes = __obj._M_bytes; + init(); + } + + void + destroy() throw() + { + const descriptor_type __err = (iconv_t)(-1); + if (_M_in_desc && _M_in_desc != __err) + { + iconv_close(_M_in_desc); + _M_in_desc = 0; + } + if (_M_out_desc && _M_out_desc != __err) + { + iconv_close(_M_out_desc); + _M_out_desc = 0; + } + } + }; + + /// encoding_char_traits + // Custom traits type with encoding_state for the state type, and the + // associated fpos for the position type, all other + // bits equivalent to the required char_traits instantiations. + template + struct encoding_char_traits + : public std::char_traits<_CharT> + { + typedef encoding_state state_type; + typedef typename std::fpos pos_type; + }; + +_GLIBCXX_END_NAMESPACE_VERSION +_GLIBCXX_END_NAMESPACE_CXX11 +} // namespace + + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + using __gnu_cxx::encoding_state; + + /// codecvt specialization. + // This partial specialization takes advantage of iconv to provide + // code conversions between a large number of character encodings. + template + class codecvt<_InternT, _ExternT, encoding_state> + : public __codecvt_abstract_base<_InternT, _ExternT, encoding_state> + { + public: + // Types: + typedef codecvt_base::result result; + typedef _InternT intern_type; + typedef _ExternT extern_type; + typedef __gnu_cxx::encoding_state state_type; + typedef state_type::descriptor_type descriptor_type; + + // Data Members: + static locale::id id; + + explicit + codecvt(size_t __refs = 0) + : __codecvt_abstract_base(__refs) + { } + + explicit + codecvt(state_type& __enc, size_t __refs = 0) + : __codecvt_abstract_base(__refs) + { } + + protected: + virtual + ~codecvt() { } + + virtual result + do_out(state_type& __state, const intern_type* __from, + const intern_type* __from_end, const intern_type*& __from_next, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const; + + virtual result + do_unshift(state_type& __state, extern_type* __to, + extern_type* __to_end, extern_type*& __to_next) const; + + virtual result + do_in(state_type& __state, const extern_type* __from, + const extern_type* __from_end, const extern_type*& __from_next, + intern_type* __to, intern_type* __to_end, + intern_type*& __to_next) const; + + virtual int + do_encoding() const throw(); + + virtual bool + do_always_noconv() const throw(); + + virtual int + do_length(state_type&, const extern_type* __from, + const extern_type* __end, size_t __max) const; + + virtual int + do_max_length() const throw(); + }; + + template + locale::id + codecvt<_InternT, _ExternT, encoding_state>::id; + + // This adaptor works around the signature problems of the second + // argument to iconv(): SUSv2 and others use 'const char**', but glibc 2.2 + // uses 'char**', which matches the POSIX 1003.1-2001 standard. + // Using this adaptor, g++ will do the work for us. + template + inline size_t + __iconv_adaptor(size_t(*__func)(iconv_t, _Tp, size_t*, char**, size_t*), + iconv_t __cd, char** __inbuf, size_t* __inbytes, + char** __outbuf, size_t* __outbytes) + { return __func(__cd, (_Tp)__inbuf, __inbytes, __outbuf, __outbytes); } + + template + codecvt_base::result + codecvt<_InternT, _ExternT, encoding_state>:: + do_out(state_type& __state, const intern_type* __from, + const intern_type* __from_end, const intern_type*& __from_next, + extern_type* __to, extern_type* __to_end, + extern_type*& __to_next) const + { + result __ret = codecvt_base::error; + if (__state.good()) + { + const descriptor_type& __desc = __state.out_descriptor(); + const size_t __fmultiple = sizeof(intern_type); + size_t __fbytes = __fmultiple * (__from_end - __from); + const size_t __tmultiple = sizeof(extern_type); + size_t __tbytes = __tmultiple * (__to_end - __to); + + // Argument list for iconv specifies a byte sequence. Thus, + // all to/from arrays must be brutally casted to char*. + char* __cto = reinterpret_cast(__to); + char* __cfrom; + size_t __conv; + + // Some encodings need a byte order marker as the first item + // in the byte stream, to designate endian-ness. The default + // value for the byte order marker is NULL, so if this is + // the case, it's not necessary and we can just go on our + // merry way. + int __int_bom = __state.internal_bom(); + if (__int_bom) + { + size_t __size = __from_end - __from; + intern_type* __cfixed = static_cast + (__builtin_alloca(sizeof(intern_type) * (__size + 1))); + __cfixed[0] = static_cast(__int_bom); + char_traits::copy(__cfixed + 1, __from, __size); + __cfrom = reinterpret_cast(__cfixed); + __conv = __iconv_adaptor(iconv, __desc, &__cfrom, + &__fbytes, &__cto, &__tbytes); + } + else + { + intern_type* __cfixed = const_cast(__from); + __cfrom = reinterpret_cast(__cfixed); + __conv = __iconv_adaptor(iconv, __desc, &__cfrom, &__fbytes, + &__cto, &__tbytes); + } + + if (__conv != size_t(-1)) + { + __from_next = reinterpret_cast(__cfrom); + __to_next = reinterpret_cast(__cto); + __ret = codecvt_base::ok; + } + else + { + if (__fbytes < __fmultiple * (__from_end - __from)) + { + __from_next = reinterpret_cast(__cfrom); + __to_next = reinterpret_cast(__cto); + __ret = codecvt_base::partial; + } + else + __ret = codecvt_base::error; + } + } + return __ret; + } + + template + codecvt_base::result + codecvt<_InternT, _ExternT, encoding_state>:: + do_unshift(state_type& __state, extern_type* __to, + extern_type* __to_end, extern_type*& __to_next) const + { + result __ret = codecvt_base::error; + if (__state.good()) + { + const descriptor_type& __desc = __state.in_descriptor(); + const size_t __tmultiple = sizeof(intern_type); + size_t __tlen = __tmultiple * (__to_end - __to); + + // Argument list for iconv specifies a byte sequence. Thus, + // all to/from arrays must be brutally casted to char*. + char* __cto = reinterpret_cast(__to); + size_t __conv = __iconv_adaptor(iconv,__desc, 0, 0, + &__cto, &__tlen); + + if (__conv != size_t(-1)) + { + __to_next = reinterpret_cast(__cto); + if (__tlen == __tmultiple * (__to_end - __to)) + __ret = codecvt_base::noconv; + else if (__tlen == 0) + __ret = codecvt_base::ok; + else + __ret = codecvt_base::partial; + } + else + __ret = codecvt_base::error; + } + return __ret; + } + + template + codecvt_base::result + codecvt<_InternT, _ExternT, encoding_state>:: + do_in(state_type& __state, const extern_type* __from, + const extern_type* __from_end, const extern_type*& __from_next, + intern_type* __to, intern_type* __to_end, + intern_type*& __to_next) const + { + result __ret = codecvt_base::error; + if (__state.good()) + { + const descriptor_type& __desc = __state.in_descriptor(); + const size_t __fmultiple = sizeof(extern_type); + size_t __flen = __fmultiple * (__from_end - __from); + const size_t __tmultiple = sizeof(intern_type); + size_t __tlen = __tmultiple * (__to_end - __to); + + // Argument list for iconv specifies a byte sequence. Thus, + // all to/from arrays must be brutally casted to char*. + char* __cto = reinterpret_cast(__to); + char* __cfrom; + size_t __conv; + + // Some encodings need a byte order marker as the first item + // in the byte stream, to designate endian-ness. The default + // value for the byte order marker is NULL, so if this is + // the case, it's not necessary and we can just go on our + // merry way. + int __ext_bom = __state.external_bom(); + if (__ext_bom) + { + size_t __size = __from_end - __from; + extern_type* __cfixed = static_cast + (__builtin_alloca(sizeof(extern_type) * (__size + 1))); + __cfixed[0] = static_cast(__ext_bom); + char_traits::copy(__cfixed + 1, __from, __size); + __cfrom = reinterpret_cast(__cfixed); + __conv = __iconv_adaptor(iconv, __desc, &__cfrom, + &__flen, &__cto, &__tlen); + } + else + { + extern_type* __cfixed = const_cast(__from); + __cfrom = reinterpret_cast(__cfixed); + __conv = __iconv_adaptor(iconv, __desc, &__cfrom, + &__flen, &__cto, &__tlen); + } + + + if (__conv != size_t(-1)) + { + __from_next = reinterpret_cast(__cfrom); + __to_next = reinterpret_cast(__cto); + __ret = codecvt_base::ok; + } + else + { + if (__flen < static_cast(__from_end - __from)) + { + __from_next = reinterpret_cast(__cfrom); + __to_next = reinterpret_cast(__cto); + __ret = codecvt_base::partial; + } + else + __ret = codecvt_base::error; + } + } + return __ret; + } + + template + int + codecvt<_InternT, _ExternT, encoding_state>:: + do_encoding() const throw() + { + int __ret = 0; + if (sizeof(_ExternT) <= sizeof(_InternT)) + __ret = sizeof(_InternT) / sizeof(_ExternT); + return __ret; + } + + template + bool + codecvt<_InternT, _ExternT, encoding_state>:: + do_always_noconv() const throw() + { return false; } + + template + int + codecvt<_InternT, _ExternT, encoding_state>:: + do_length(state_type&, const extern_type* __from, + const extern_type* __end, size_t __max) const + { return std::min(__max, static_cast(__end - __from)); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 74. Garbled text for codecvt::do_max_length + template + int + codecvt<_InternT, _ExternT, encoding_state>:: + do_max_length() const throw() + { return 1; } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/concurrence.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/concurrence.h new file mode 100644 index 0000000..3b017da --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/concurrence.h @@ -0,0 +1,318 @@ +// Support for concurrent programing -*- C++ -*- + +// Copyright (C) 2003-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file ext/concurrence.h + * This file is a GNU extension to the Standard C++ Library. + */ + +#ifndef _CONCURRENCE_H +#define _CONCURRENCE_H 1 + +#pragma GCC system_header + +#include +#include +#include +#include +#include + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // Available locking policies: + // _S_single single-threaded code that doesn't need to be locked. + // _S_mutex multi-threaded code that requires additional support + // from gthr.h or abstraction layers in concurrence.h. + // _S_atomic multi-threaded code using atomic operations. + enum _Lock_policy { _S_single, _S_mutex, _S_atomic }; + + // Compile time constant that indicates prefered locking policy in + // the current configuration. + static const _Lock_policy __default_lock_policy = +#ifdef __GTHREADS +#if (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) \ + && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)) + _S_atomic; +#else + _S_mutex; +#endif +#else + _S_single; +#endif + + // NB: As this is used in libsupc++, need to only depend on + // exception. No stdexception classes, no use of std::string. + class __concurrence_lock_error : public std::exception + { + public: + virtual char const* + what() const throw() + { return "__gnu_cxx::__concurrence_lock_error"; } + }; + + class __concurrence_unlock_error : public std::exception + { + public: + virtual char const* + what() const throw() + { return "__gnu_cxx::__concurrence_unlock_error"; } + }; + + class __concurrence_broadcast_error : public std::exception + { + public: + virtual char const* + what() const throw() + { return "__gnu_cxx::__concurrence_broadcast_error"; } + }; + + class __concurrence_wait_error : public std::exception + { + public: + virtual char const* + what() const throw() + { return "__gnu_cxx::__concurrence_wait_error"; } + }; + + // Substitute for concurrence_error object in the case of -fno-exceptions. + inline void + __throw_concurrence_lock_error() + { _GLIBCXX_THROW_OR_ABORT(__concurrence_lock_error()); } + + inline void + __throw_concurrence_unlock_error() + { _GLIBCXX_THROW_OR_ABORT(__concurrence_unlock_error()); } + +#ifdef __GTHREAD_HAS_COND + inline void + __throw_concurrence_broadcast_error() + { _GLIBCXX_THROW_OR_ABORT(__concurrence_broadcast_error()); } + + inline void + __throw_concurrence_wait_error() + { _GLIBCXX_THROW_OR_ABORT(__concurrence_wait_error()); } +#endif + + class __mutex + { + private: +#if __GTHREADS && defined __GTHREAD_MUTEX_INIT + __gthread_mutex_t _M_mutex = __GTHREAD_MUTEX_INIT; +#else + __gthread_mutex_t _M_mutex; +#endif + + __mutex(const __mutex&); + __mutex& operator=(const __mutex&); + + public: + __mutex() + { +#if __GTHREADS && ! defined __GTHREAD_MUTEX_INIT + if (__gthread_active_p()) + __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex); +#endif + } + +#if __GTHREADS && ! defined __GTHREAD_MUTEX_INIT + ~__mutex() + { + if (__gthread_active_p()) + __gthread_mutex_destroy(&_M_mutex); + } +#endif + + void lock() + { +#if __GTHREADS + if (__gthread_active_p()) + { + if (__gthread_mutex_lock(&_M_mutex) != 0) + __throw_concurrence_lock_error(); + } +#endif + } + + void unlock() + { +#if __GTHREADS + if (__gthread_active_p()) + { + if (__gthread_mutex_unlock(&_M_mutex) != 0) + __throw_concurrence_unlock_error(); + } +#endif + } + + __gthread_mutex_t* gthread_mutex(void) + { return &_M_mutex; } + }; + + class __recursive_mutex + { + private: +#if __GTHREADS && defined __GTHREAD_RECURSIVE_MUTEX_INIT + __gthread_recursive_mutex_t _M_mutex = __GTHREAD_RECURSIVE_MUTEX_INIT; +#else + __gthread_recursive_mutex_t _M_mutex; +#endif + + __recursive_mutex(const __recursive_mutex&); + __recursive_mutex& operator=(const __recursive_mutex&); + + public: + __recursive_mutex() + { +#if __GTHREADS && ! defined __GTHREAD_RECURSIVE_MUTEX_INIT + if (__gthread_active_p()) + __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex); +#endif + } + +#if __GTHREADS && ! defined __GTHREAD_RECURSIVE_MUTEX_INIT + ~__recursive_mutex() + { + if (__gthread_active_p()) + __gthread_recursive_mutex_destroy(&_M_mutex); + } +#endif + + void lock() + { +#if __GTHREADS + if (__gthread_active_p()) + { + if (__gthread_recursive_mutex_lock(&_M_mutex) != 0) + __throw_concurrence_lock_error(); + } +#endif + } + + void unlock() + { +#if __GTHREADS + if (__gthread_active_p()) + { + if (__gthread_recursive_mutex_unlock(&_M_mutex) != 0) + __throw_concurrence_unlock_error(); + } +#endif + } + + __gthread_recursive_mutex_t* gthread_recursive_mutex(void) + { return &_M_mutex; } + }; + + /// Scoped lock idiom. + // Acquire the mutex here with a constructor call, then release with + // the destructor call in accordance with RAII style. + class __scoped_lock + { + public: + typedef __mutex __mutex_type; + + private: + __mutex_type& _M_device; + + __scoped_lock(const __scoped_lock&); + __scoped_lock& operator=(const __scoped_lock&); + + public: + explicit __scoped_lock(__mutex_type& __name) : _M_device(__name) + { _M_device.lock(); } + + ~__scoped_lock() throw() + { _M_device.unlock(); } + }; + +#ifdef __GTHREAD_HAS_COND + class __cond + { + private: +#if __GTHREADS && defined __GTHREAD_COND_INIT + __gthread_cond_t _M_cond = __GTHREAD_COND_INIT; +#else + __gthread_cond_t _M_cond; +#endif + + __cond(const __cond&); + __cond& operator=(const __cond&); + + public: + __cond() + { +#if __GTHREADS && ! defined __GTHREAD_COND_INIT + if (__gthread_active_p()) + __GTHREAD_COND_INIT_FUNCTION(&_M_cond); +#endif + } + +#if __GTHREADS && ! defined __GTHREAD_COND_INIT + ~__cond() + { + if (__gthread_active_p()) + __gthread_cond_destroy(&_M_cond); + } +#endif + + void broadcast() + { +#if __GTHREADS + if (__gthread_active_p()) + { + if (__gthread_cond_broadcast(&_M_cond) != 0) + __throw_concurrence_broadcast_error(); + } +#endif + } + + void wait(__mutex *mutex) + { +#if __GTHREADS + { + if (__gthread_cond_wait(&_M_cond, mutex->gthread_mutex()) != 0) + __throw_concurrence_wait_error(); + } +#endif + } + + void wait_recursive(__recursive_mutex *mutex) + { +#if __GTHREADS + { + if (__gthread_cond_wait_recursive(&_M_cond, + mutex->gthread_recursive_mutex()) + != 0) + __throw_concurrence_wait_error(); + } +#endif + } + }; +#endif + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/debug_allocator.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/debug_allocator.h new file mode 100644 index 0000000..f3f2d7b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/debug_allocator.h @@ -0,0 +1,191 @@ +// Allocators -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/* + * Copyright (c) 1996-1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/** @file ext/debug_allocator.h + * This file is a GNU extension to the Standard C++ Library. + */ + +#ifndef _DEBUG_ALLOCATOR_H +#define _DEBUG_ALLOCATOR_H 1 + +#include +#include +#include + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + using std::size_t; + + /** + * @brief A meta-allocator with debugging bits. + * @ingroup allocators + * + * This is precisely the allocator defined in the C++03 Standard. + */ + template + class debug_allocator + { + template friend class debug_allocator; + + typedef __alloc_traits<_Alloc> _Traits; + + public: + typedef typename _Traits::size_type size_type; + typedef typename _Traits::difference_type difference_type; + typedef typename _Traits::pointer pointer; + typedef typename _Traits::const_pointer const_pointer; + typedef typename _Traits::reference reference; + typedef typename _Traits::const_reference const_reference; + typedef typename _Traits::value_type value_type; + + template + class rebind + { + typedef typename _Traits::template rebind<_Up>::other __other; + + public: + typedef debug_allocator<__other> other; + }; + + private: + // _M_extra is the number of objects that correspond to the + // extra space where debug information is stored. + size_type _M_extra; + + _Alloc _M_allocator; + + template::other> + struct __convertible + { }; + + template + struct __convertible<_Alloc2, _Alloc> + { + typedef void* __type; + }; + + size_type _S_extra() + { + const size_t __obj_size = sizeof(value_type); + return (sizeof(size_type) + __obj_size - 1) / __obj_size; + } + + public: + debug_allocator() : _M_extra(_S_extra()) { } + + template + debug_allocator(const debug_allocator<_Alloc2>& __a2, + typename __convertible<_Alloc2>::__type = 0) + : _M_allocator(__a2._M_allocator), _M_extra(_S_extra()) { } + + debug_allocator(const _Alloc& __a) + : _M_allocator(__a), _M_extra(_S_extra()) { } + + pointer + allocate(size_type __n) + { + pointer __res = _M_allocator.allocate(__n + _M_extra); + size_type* __ps = reinterpret_cast(__res); + *__ps = __n; + return __res + _M_extra; + } + + pointer + allocate(size_type __n, const void* __hint) + { + pointer __res = _M_allocator.allocate(__n + _M_extra, __hint); + size_type* __ps = reinterpret_cast(__res); + *__ps = __n; + return __res + _M_extra; + } + + void + deallocate(pointer __p, size_type __n) + { + using std::__throw_runtime_error; + if (__p) + { + pointer __real_p = __p - _M_extra; + if (*reinterpret_cast(__real_p) != __n) + __throw_runtime_error("debug_allocator::deallocate wrong size"); + _M_allocator.deallocate(__real_p, __n + _M_extra); + } + else + __throw_runtime_error("debug_allocator::deallocate null pointer"); + } + + void + construct(pointer __p, const value_type& __val) + { _Traits::construct(_M_allocator, __p, __val); } + +#if __cplusplus >= 201103L + template + void + construct(_Tp* __p, _Args&&... __args) + { + _Traits::construct(_M_allocator, __p, + std::forward<_Args>(__args)...); + } +#endif + + template + void + destroy(_Tp* __p) + { _Traits::destroy(_M_allocator, __p); } + + size_type + max_size() const throw() + { return _Traits::max_size(_M_allocator) - _M_extra; } + + friend bool + operator==(const debug_allocator& __lhs, const debug_allocator& __rhs) + { return __lhs._M_allocator == __rhs._M_allocator; } + }; + + template + inline bool + operator!=(const debug_allocator<_Alloc>& __lhs, + const debug_allocator<_Alloc>& __rhs) + { return !(__lhs == __rhs); } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/enc_filebuf.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/enc_filebuf.h new file mode 100644 index 0000000..acc5ed2 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/enc_filebuf.h @@ -0,0 +1,65 @@ +// filebuf with encoding state type -*- C++ -*- + +// Copyright (C) 2002-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file ext/enc_filebuf.h + * This file is a GNU extension to the Standard C++ Library. + */ + +#ifndef _EXT_ENC_FILEBUF_H +#define _EXT_ENC_FILEBUF_H 1 + +#include +#include +#include + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /// class enc_filebuf. + template + class enc_filebuf + : public std::basic_filebuf<_CharT, encoding_char_traits<_CharT> > + { + public: + typedef encoding_char_traits<_CharT> traits_type; + typedef typename traits_type::state_type state_type; + typedef typename traits_type::pos_type pos_type; + + enc_filebuf(state_type& __state) + : std::basic_filebuf<_CharT, encoding_char_traits<_CharT> >() + { this->_M_state_beg = __state; } + + private: + // concept requirements: + // Set state type to something useful. + // Something more than copyconstructible is needed here, so + // require default and copy constructible + assignment operator. + __glibcxx_class_requires(state_type, _SGIAssignableConcept) + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/extptr_allocator.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/extptr_allocator.h new file mode 100644 index 0000000..2004992 --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/extptr_allocator.h @@ -0,0 +1,197 @@ +// -*- C++ -*- + +// Copyright (C) 2008-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** + * @file ext/extptr_allocator.h + * This file is a GNU extension to the Standard C++ Library. + * + * @author Bob Walters + * + * An example allocator which uses an alternative pointer type from + * bits/pointer.h. Supports test cases which confirm container support + * for alternative pointers. + */ + +#ifndef _EXTPTR_ALLOCATOR_H +#define _EXTPTR_ALLOCATOR_H 1 + +#include +#include +#include + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @brief An example allocator which uses a non-standard pointer type. + * @ingroup allocators + * + * This allocator specifies that containers use a 'relative pointer' as it's + * pointer type. (See ext/pointer.h) Memory allocation in this example + * is still performed using std::allocator. + */ + template + class _ExtPtr_allocator + { + public: + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + + // Note the non-standard pointer types. + typedef _Pointer_adapter<_Relative_pointer_impl<_Tp> > pointer; + typedef _Pointer_adapter<_Relative_pointer_impl > + const_pointer; + + typedef _Tp& reference; + typedef const _Tp& const_reference; + typedef _Tp value_type; + + template + struct rebind + { typedef _ExtPtr_allocator<_Up> other; }; + + _ExtPtr_allocator() _GLIBCXX_USE_NOEXCEPT + : _M_real_alloc() { } + + _ExtPtr_allocator(const _ExtPtr_allocator& __rarg) _GLIBCXX_USE_NOEXCEPT + : _M_real_alloc(__rarg._M_real_alloc) { } + + template + _ExtPtr_allocator(const _ExtPtr_allocator<_Up>& __rarg) + _GLIBCXX_USE_NOEXCEPT + : _M_real_alloc(__rarg._M_getUnderlyingImp()) { } + + ~_ExtPtr_allocator() _GLIBCXX_USE_NOEXCEPT + { } + + pointer address(reference __x) const _GLIBCXX_NOEXCEPT + { return std::__addressof(__x); } + + const_pointer address(const_reference __x) const _GLIBCXX_NOEXCEPT + { return std::__addressof(__x); } + + pointer allocate(size_type __n, void* __hint = 0) + { return _M_real_alloc.allocate(__n,__hint); } + + void deallocate(pointer __p, size_type __n) + { _M_real_alloc.deallocate(__p.get(), __n); } + + size_type max_size() const _GLIBCXX_USE_NOEXCEPT + { return __numeric_traits::__max / sizeof(_Tp); } + +#if __cplusplus >= 201103L + template + void + construct(_Up* __p, _Args&&... __args) + { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } + + template + void + construct(pointer __p, _Args&&... __args) + { construct(__p.get(), std::forward<_Args>(__args)...); } + + template + void + destroy(_Up* __p) + { __p->~_Up(); } + + void destroy(pointer __p) + { destroy(__p.get()); } + +#else + + void construct(pointer __p, const _Tp& __val) + { ::new(__p.get()) _Tp(__val); } + + void destroy(pointer __p) + { __p->~_Tp(); } +#endif + + template + inline bool + operator==(const _ExtPtr_allocator<_Up>& __rarg) + { return _M_real_alloc == __rarg._M_getUnderlyingImp(); } + + inline bool + operator==(const _ExtPtr_allocator& __rarg) + { return _M_real_alloc == __rarg._M_real_alloc; } + + template + inline bool + operator!=(const _ExtPtr_allocator<_Up>& __rarg) + { return _M_real_alloc != __rarg._M_getUnderlyingImp(); } + + inline bool + operator!=(const _ExtPtr_allocator& __rarg) + { return _M_real_alloc != __rarg._M_real_alloc; } + + template + inline friend void + swap(_ExtPtr_allocator<_Up>&, _ExtPtr_allocator<_Up>&); + + // A method specific to this implementation. + const std::allocator<_Tp>& + _M_getUnderlyingImp() const + { return _M_real_alloc; } + + private: + std::allocator<_Tp> _M_real_alloc; + }; + + // _ExtPtr_allocator specialization. + template<> + class _ExtPtr_allocator + { + public: + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + typedef void value_type; + + // Note the non-standard pointer types + typedef _Pointer_adapter<_Relative_pointer_impl > pointer; + typedef _Pointer_adapter<_Relative_pointer_impl > + const_pointer; + + template + struct rebind + { typedef _ExtPtr_allocator<_Up> other; }; + + private: + std::allocator _M_real_alloc; + }; + + template + inline void + swap(_ExtPtr_allocator<_Tp>& __larg, _ExtPtr_allocator<_Tp>& __rarg) + { + std::allocator<_Tp> __tmp( __rarg._M_real_alloc ); + __rarg._M_real_alloc = __larg._M_real_alloc; + __larg._M_real_alloc = __tmp; + } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif /* _EXTPTR_ALLOCATOR_H */ diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/malloc_allocator.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/malloc_allocator.h new file mode 100644 index 0000000..88e0c7b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/malloc_allocator.h @@ -0,0 +1,175 @@ +// Allocator that wraps "C" malloc -*- C++ -*- + +// Copyright (C) 2001-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file ext/malloc_allocator.h + * This file is a GNU extension to the Standard C++ Library. + */ + +#ifndef _MALLOC_ALLOCATOR_H +#define _MALLOC_ALLOCATOR_H 1 + +#include +#include +#include +#include +#include +#if __cplusplus >= 201103L +#include +#endif + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + using std::size_t; + using std::ptrdiff_t; + + /** + * @brief An allocator that uses malloc. + * @ingroup allocators + * + * This is precisely the allocator defined in the C++ Standard. + * - all allocation calls malloc + * - all deallocation calls free + */ + template + class malloc_allocator + { + public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Tp* pointer; + typedef const _Tp* const_pointer; + typedef _Tp& reference; + typedef const _Tp& const_reference; + typedef _Tp value_type; + + template + struct rebind + { typedef malloc_allocator<_Tp1> other; }; + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2103. propagate_on_container_move_assignment + typedef std::true_type propagate_on_container_move_assignment; +#endif + + malloc_allocator() _GLIBCXX_USE_NOEXCEPT { } + + malloc_allocator(const malloc_allocator&) _GLIBCXX_USE_NOEXCEPT { } + + template + malloc_allocator(const malloc_allocator<_Tp1>&) + _GLIBCXX_USE_NOEXCEPT { } + + ~malloc_allocator() _GLIBCXX_USE_NOEXCEPT { } + + pointer + address(reference __x) const _GLIBCXX_NOEXCEPT + { return std::__addressof(__x); } + + const_pointer + address(const_reference __x) const _GLIBCXX_NOEXCEPT + { return std::__addressof(__x); } + + // NB: __n is permitted to be 0. The C++ standard says nothing + // about what the return value is when __n == 0. + pointer + allocate(size_type __n, const void* = 0) + { + if (__n > this->max_size()) + std::__throw_bad_alloc(); + + pointer __ret = 0; +#if __cpp_aligned_new +#if __cplusplus > 201402L && _GLIBCXX_HAVE_ALIGNED_ALLOC + if (alignof(_Tp) > alignof(std::max_align_t)) + { + __ret = static_cast<_Tp*>(::aligned_alloc(alignof(_Tp), + __n * sizeof(_Tp))); + } +#else +# define _GLIBCXX_CHECK_MALLOC_RESULT +#endif +#endif + if (!__ret) + __ret = static_cast<_Tp*>(std::malloc(__n * sizeof(_Tp))); + if (!__ret) + std::__throw_bad_alloc(); +#ifdef _GLIBCXX_CHECK_MALLOC_RESULT +#undef _GLIBCXX_CHECK_MALLOC_RESULT + if (reinterpret_cast(__ret) % alignof(_Tp)) + { + // Memory returned by malloc is not suitably aligned for _Tp. + deallocate(__ret, __n); + std::__throw_bad_alloc(); + } +#endif + return __ret; + } + + // __p is not permitted to be a null pointer. + void + deallocate(pointer __p, size_type) + { std::free(static_cast(__p)); } + + size_type + max_size() const _GLIBCXX_USE_NOEXCEPT + { return size_t(-1) / sizeof(_Tp); } + +#if __cplusplus >= 201103L + template + void + construct(_Up* __p, _Args&&... __args) + { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } + + template + void + destroy(_Up* __p) { __p->~_Up(); } +#else + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 402. wrong new expression in [some_] allocator::construct + void + construct(pointer __p, const _Tp& __val) + { ::new((void *)__p) value_type(__val); } + + void + destroy(pointer __p) { __p->~_Tp(); } +#endif + }; + + template + inline bool + operator==(const malloc_allocator<_Tp>&, const malloc_allocator<_Tp>&) + { return true; } + + template + inline bool + operator!=(const malloc_allocator<_Tp>&, const malloc_allocator<_Tp>&) + { return false; } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace + +#endif diff --git a/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/mt_allocator.h b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/mt_allocator.h new file mode 100644 index 0000000..effb13b --- /dev/null +++ b/dingux/opt/mipsel-linux-uclibc/mipsel-buildroot-linux-uclibc/include/c++/7.3.0/ext/mt_allocator.h @@ -0,0 +1,784 @@ +// MT-optimized allocator -*- C++ -*- + +// Copyright (C) 2003-2017 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file ext/mt_allocator.h + * This file is a GNU extension to the Standard C++ Library. + */ + +#ifndef _MT_ALLOCATOR_H +#define _MT_ALLOCATOR_H 1 + +#include +#include +#include +#include +#include +#if __cplusplus >= 201103L +#include +#endif + +namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + using std::size_t; + using std::ptrdiff_t; + + typedef void (*__destroy_handler)(void*); + + /// Base class for pool object. + struct __pool_base + { + // Using short int as type for the binmap implies we are never + // caching blocks larger than 32768 with this allocator. + typedef unsigned short int _Binmap_type; + + // Variables used to configure the behavior of the allocator, + // assigned and explained in detail below. + struct _Tune + { + // Compile time constants for the default _Tune values. + enum { _S_align = 8 }; + enum { _S_max_bytes = 128 }; + enum { _S_min_bin = 8 }; + enum { _S_chunk_size = 4096 - 4 * sizeof(void*) }; + enum { _S_max_threads = 4096 }; + enum { _S_freelist_headroom = 10 }; + + // Alignment needed. + // NB: In any case must be >= sizeof(_Block_record), that + // is 4 on 32 bit machines and 8 on 64 bit machines. + size_t _M_align; + + // Allocation requests (after round-up to power of 2) below + // this value will be handled by the allocator. A raw new/ + // call will be used for requests larger than this value. + // NB: Must be much smaller than _M_chunk_size and in any + // case <= 32768. + size_t _M_max_bytes; + + // Size in bytes of the smallest bin. + // NB: Must be a power of 2 and >= _M_align (and of course + // much smaller than _M_max_bytes). + size_t _M_min_bin; + + // In order to avoid fragmenting and minimize the number of + // new() calls we always request new memory using this + // value. Based on previous discussions on the libstdc++ + // mailing list we have chosen the value below. + // See http://gcc.gnu.org/ml/libstdc++/2001-07/msg00077.html + // NB: At least one order of magnitude > _M_max_bytes. + size_t _M_chunk_size; + + // The maximum number of supported threads. For + // single-threaded operation, use one. Maximum values will + // vary depending on details of the underlying system. (For + // instance, Linux 2.4.18 reports 4070 in + // /proc/sys/kernel/threads-max, while Linux 2.6.6 reports + // 65534) + size_t _M_max_threads; + + // Each time a deallocation occurs in a threaded application + // we make sure that there are no more than + // _M_freelist_headroom % of used memory on the freelist. If + // the number of additional records is more than + // _M_freelist_headroom % of the freelist, we move these + // records back to the global pool. + size_t _M_freelist_headroom; + + // Set to true forces all allocations to use new(). + bool _M_force_new; + + explicit + _Tune() + : _M_align(_S_align), _M_max_bytes(_S_max_bytes), _M_min_bin(_S_min_bin), + _M_chunk_size(_S_chunk_size), _M_max_threads(_S_max_threads), + _M_freelist_headroom(_S_freelist_headroom), + _M_force_new(std::getenv("GLIBCXX_FORCE_NEW") ? true : false) + { } + + explicit + _Tune(size_t __align, size_t __maxb, size_t __minbin, size_t __chunk, + size_t __maxthreads, size_t __headroom, bool __force) + : _M_align(__align), _M_max_bytes(__maxb), _M_min_bin(__minbin), + _M_chunk_size(__chunk), _M_max_threads(__maxthreads), + _M_freelist_headroom(__headroom), _M_force_new(__force) + { } + }; + + struct _Block_address + { + void* _M_initial; + _Block_address* _M_next; + }; + + const _Tune& + _M_get_options() const + { return _M_options; } + + void + _M_set_options(_Tune __t) + { + if (!_M_init) + _M_options = __t; + } + + bool + _M_check_threshold(size_t __bytes) + { return __bytes > _M_options._M_max_bytes || _M_options._M_force_new; } + + size_t + _M_get_binmap(size_t __bytes) + { return _M_binmap[__bytes]; } + + size_t + _M_get_align() + { return _M_options._M_align; } + + explicit + __pool_base() + : _M_options(_Tune()), _M_binmap(0), _M_init(false) { } + + explicit + __pool_base(const _Tune& __options) + : _M_options(__options), _M_binmap(0), _M_init(false) { } + + private: + explicit + __pool_base(const __pool_base&); + + __pool_base& + operator=(const __pool_base&); + + protected: + // Configuration options. + _Tune _M_options; + + _Binmap_type* _M_binmap; + + // Configuration of the pool object via _M_options can happen + // after construction but before initialization. After + // initialization is complete, this variable is set to true. + bool _M_init; + }; + + + /** + * @brief Data describing the underlying memory pool, parameterized on + * threading support. + */ + template + class __pool; + + /// Specialization for single thread. + template<> + class __pool : public __pool_base + { + public: + union _Block_record + { + // Points to the block_record of the next free block. + _Block_record* _M_next; + }; + + struct _Bin_record + { + // An "array" of pointers to the first free block. + _Block_record** _M_first; + + // A list of the initial addresses of all allocated blocks. + _Block_address* _M_address; + }; + + void + _M_initialize_once() + { + if (__builtin_expect(_M_init == false, false)) + _M_initialize(); + } + + void + _M_destroy() throw(); + + char* + _M_reserve_block(size_t __bytes, const size_t __thread_id); + + void + _M_reclaim_block(char* __p, size_t __bytes) throw (); + + size_t + _M_get_thread_id() { return 0; } + + const _Bin_record& + _M_get_bin(size_t __which) + { return _M_bin[__which]; } + + void + _M_adjust_freelist(const _Bin_record&, _Block_record*, size_t) + { } + + explicit __pool() + : _M_bin(0), _M_bin_size(1) { } + + explicit __pool(const __pool_base::_Tune& __tune) + : __pool_base(__tune), _M_bin(0), _M_bin_size(1) { } + + private: + // An "array" of bin_records each of which represents a specific + // power of 2 size. Memory to this "array" is allocated in + // _M_initialize(). + _Bin_record* _M_bin; + + // Actual value calculated in _M_initialize(). + size_t _M_bin_size; + + void + _M_initialize(); + }; + +#ifdef __GTHREADS + /// Specialization for thread enabled, via gthreads.h. + template<> + class __pool : public __pool_base + { + public: + // Each requesting thread is assigned an id ranging from 1 to + // _S_max_threads. Thread id 0 is used as a global memory pool. + // In order to get constant performance on the thread assignment + // routine, we keep a list of free ids. When a thread first + // requests memory we remove the first record in this list and + // stores the address in a __gthread_key. When initializing the + // __gthread_key we specify a destructor. When this destructor + // (i.e. the thread dies) is called, we return the thread id to + // the front of this list. + struct _Thread_record + { + // Points to next free thread id record. NULL if last record in list. + _Thread_record* _M_next; + + // Thread id ranging from 1 to _S_max_threads. + size_t _M_id; + }; + + union _Block_record + { + // Points to the block_record of the next free block. + _Block_record* _M_next; + + // The thread id of the thread which has requested this block. + size_t _M_thread_id; + }; + + struct _Bin_record + { + // An "array" of pointers to the first free block for each + // thread id. Memory to this "array" is allocated in + // _S_initialize() for _S_max_threads + global pool 0. + _Block_record** _M_first; + + // A list of the initial addresses of all allocated blocks. + _Block_address* _M_address; + + // An "array" of counters used to keep track of the amount of + // blocks that are on the freelist/used for each thread id. + // - Note that the second part of the allocated _M_used "array" + // actually hosts (atomic) counters of reclaimed blocks: in + // _M_reserve_block and in _M_reclaim_block those numbers are + // subtracted from the first ones to obtain the actual size + // of the "working set" of the given thread. + // - Memory to these "arrays" is allocated in _S_initialize() + // for _S_max_threads + global pool 0. + size_t* _M_free; + size_t* _M_used; + + // Each bin has its own mutex which is used to ensure data + // integrity while changing "ownership" on a block. The mutex + // is initialized in _S_initialize(). + __gthread_mutex_t* _M_mutex; + }; + + // XXX GLIBCXX_ABI Deprecated + void + _M_initialize(__destroy_handler); + + void + _M_initialize_once() + { + if (__builtin_expect(_M_init == false, false)) + _M_initialize(); + } + + void + _M_destroy() throw(); + + char* + _M_reserve_block(size_t __bytes, const size_t __thread_id); + + void + _M_reclaim_block(char* __p, size_t __bytes) throw (); + + const _Bin_record& + _M_get_bin(size_t __which) + { return _M_bin[__which]; } + + void + _M_adjust_freelist(const _Bin_record& __bin, _Block_record* __block, + size_t __thread_id) + { + if (__gthread_active_p()) + { + __block->_M_thread_id = __thread_id; + --__bin._M_free[__thread_id]; + ++__bin._M_used[__thread_id]; + } + } + + // XXX GLIBCXX_ABI Deprecated + _GLIBCXX_CONST void + _M_destroy_thread_key(void*) throw (); + + size_t + _M_get_thread_id(); + + explicit __pool() + : _M_bin(0), _M_bin_size(1), _M_thread_freelist(0) + { } + + explicit __pool(const __pool_base::_Tune& __tune) + : __pool_base(__tune), _M_bin(0), _M_bin_size(1), + _M_thread_freelist(0) + { } + + private: + // An "array" of bin_records each of which represents a specific + // power of 2 size. Memory to this "array" is allocated in + // _M_initialize(). + _Bin_record* _M_bin; + + // Actual value calculated in _M_initialize(). + size_t _M_bin_size; + + _Thread_record* _M_thread_freelist; + void* _M_thread_freelist_initial; + + void + _M_initialize(); + }; +#endif + + template